summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/VertexCache.h136
-rw-r--r--indra/newview/VorbisFramework.h32
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl58
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl62
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl98
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl38
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl44
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl54
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl46
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl52
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl50
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl42
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl110
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cofF.glsl62
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl172
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl62
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl144
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/genbrdflutF.glsl128
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/genbrdflutV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialV.glsl54
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl40
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaBlendF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl42
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl156
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl68
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredVisualizeBuffers.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl40
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/starsF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/starsV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeF.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowF.glsl46
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowV.glsl40
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/srgbF.glsl44
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterV.glsl104
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/alphamaskV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/benchmarkF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/benchmarkV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/clipF.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/clipV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/copyF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/copyV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/debugF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/debugV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/gaussianF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightNormV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightSpecV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/irradianceGenV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/occlusionCubeV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/occlusionSkinnedV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/onetexturefilterF.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/onetexturefilterV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl146
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/radianceGenV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/twotexturecompareV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/uiF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/uiV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl40
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightF.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl54
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl56
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightNonIndexedF.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl38
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/bumpF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/bumpV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/impostorF.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/impostorV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/previewF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/previewPhysicsF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/previewPhysicsV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/previewV.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl70
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class2/interface/reflectionprobeF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/interface/reflectionprobeV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl126
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl42
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/waterF.glsl38
-rw-r--r--indra/newview/app_settings/shaders/class3/lighting/lightV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl60
-rw-r--r--indra/newview/app_settings/shaders/errorF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/errorV.glsl10
-rwxr-xr-xindra/newview/build_win32_appConfig.py20
-rw-r--r--indra/newview/groupchatlistener.cpp32
-rw-r--r--indra/newview/groupchatlistener.h12
-rw-r--r--indra/newview/llaccountingcost.h40
-rw-r--r--indra/newview/llaccountingcostmanager.cpp52
-rw-r--r--indra/newview/llaccountingcostmanager.h56
-rw-r--r--indra/newview/llagent.cpp5778
-rw-r--r--indra/newview/llagent.h1308
-rw-r--r--indra/newview/llagentaccess.cpp152
-rw-r--r--indra/newview/llagentaccess.h78
-rw-r--r--indra/newview/llagentbenefits.cpp226
-rw-r--r--indra/newview/llagentbenefits.h74
-rw-r--r--indra/newview/llagentcamera.cpp4594
-rw-r--r--indra/newview/llagentcamera.h610
-rw-r--r--indra/newview/llagentdata.cpp10
-rw-r--r--indra/newview/llagentdata.h10
-rw-r--r--indra/newview/llagentlanguage.cpp34
-rw-r--r--indra/newview/llagentlanguage.h14
-rw-r--r--indra/newview/llagentlistener.cpp472
-rw-r--r--indra/newview/llagentlistener.h22
-rw-r--r--indra/newview/llagentpicksinfo.cpp120
-rw-r--r--indra/newview/llagentpicksinfo.h104
-rw-r--r--indra/newview/llagentpilot.cpp604
-rw-r--r--indra/newview/llagentpilot.h142
-rw-r--r--indra/newview/llagentui.cpp234
-rw-r--r--indra/newview/llagentui.h50
-rw-r--r--indra/newview/llagentwearables.cpp2476
-rw-r--r--indra/newview/llagentwearables.h368
-rw-r--r--indra/newview/llaisapi.cpp968
-rw-r--r--indra/newview/llaisapi.h82
-rw-r--r--indra/newview/llanimstatelabels.cpp12
-rw-r--r--indra/newview/llanimstatelabels.h12
-rw-r--r--indra/newview/llappcorehttp.cpp802
-rw-r--r--indra/newview/llappcorehttp.h434
-rw-r--r--indra/newview/llappearance.h32
-rw-r--r--indra/newview/llappearancemgr.cpp6102
-rw-r--r--indra/newview/llappearancemgr.h408
-rw-r--r--indra/newview/llappviewer.cpp6992
-rw-r--r--indra/newview/llappviewer.h436
-rw-r--r--indra/newview/llappviewerlinux.cpp624
-rw-r--r--indra/newview/llappviewerlinux.h44
-rw-r--r--indra/newview/llappviewerlinux_api.h12
-rw-r--r--indra/newview/llappviewerlinux_api_dbus.cpp122
-rw-r--r--indra/newview/llappviewerlinux_api_dbus.h10
-rw-r--r--indra/newview/llappviewerlistener.cpp10
-rw-r--r--indra/newview/llappviewerlistener.h10
-rw-r--r--indra/newview/llappviewermacosx-for-objc.h2
-rw-r--r--indra/newview/llappviewermacosx-objc.h10
-rw-r--r--indra/newview/llappviewermacosx.cpp332
-rw-r--r--indra/newview/llappviewermacosx.h28
-rw-r--r--indra/newview/llappviewerwin32.cpp906
-rw-r--r--indra/newview/llappviewerwin32.h46
-rw-r--r--indra/newview/llattachmentsmgr.cpp296
-rw-r--r--indra/newview/llattachmentsmgr.h54
-rw-r--r--indra/newview/llaudiosourcevo.cpp196
-rw-r--r--indra/newview/llaudiosourcevo.h28
-rw-r--r--indra/newview/llautoreplace.cpp1228
-rw-r--r--indra/newview/llautoreplace.h278
-rw-r--r--indra/newview/llavataractions.cpp1812
-rw-r--r--indra/newview/llavataractions.h418
-rw-r--r--indra/newview/llavatariconctrl.cpp436
-rw-r--r--indra/newview/llavatariconctrl.h134
-rw-r--r--indra/newview/llavatarlist.cpp680
-rw-r--r--indra/newview/llavatarlist.h198
-rw-r--r--indra/newview/llavatarlistitem.cpp864
-rw-r--r--indra/newview/llavatarlistitem.h382
-rw-r--r--indra/newview/llavatarpropertiesprocessor.cpp812
-rw-r--r--indra/newview/llavatarpropertiesprocessor.h338
-rw-r--r--indra/newview/llavatarrenderinfoaccountant.cpp160
-rw-r--r--indra/newview/llavatarrenderinfoaccountant.h38
-rw-r--r--indra/newview/llavatarrendernotifier.cpp64
-rw-r--r--indra/newview/llavatarrendernotifier.h50
-rw-r--r--indra/newview/llblockedlistitem.cpp86
-rw-r--r--indra/newview/llblockedlistitem.h26
-rw-r--r--indra/newview/llblocklist.cpp626
-rw-r--r--indra/newview/llblocklist.h110
-rw-r--r--indra/newview/llbox.cpp102
-rw-r--r--indra/newview/llbox.h26
-rw-r--r--indra/newview/llbreadcrumbview.cpp10
-rw-r--r--indra/newview/llbreadcrumbview.h10
-rw-r--r--indra/newview/llbreastmotion.cpp604
-rw-r--r--indra/newview/llbreastmotion.h178
-rw-r--r--indra/newview/llbrowsernotification.cpp40
-rw-r--r--indra/newview/llbuycurrencyhtml.cpp204
-rw-r--r--indra/newview/llbuycurrencyhtml.h30
-rw-r--r--indra/newview/llcallbacklist.cpp302
-rw-r--r--indra/newview/llcallingcard.cpp1202
-rw-r--r--indra/newview/llcallingcard.h334
-rw-r--r--indra/newview/llcapabilityprovider.h10
-rw-r--r--indra/newview/llchannelmanager.cpp288
-rw-r--r--indra/newview/llchannelmanager.h108
-rw-r--r--indra/newview/llchatbar.cpp922
-rw-r--r--indra/newview/llchatbar.h94
-rw-r--r--indra/newview/llchathistory.cpp2586
-rw-r--r--indra/newview/llchathistory.h240
-rw-r--r--indra/newview/llchatitemscontainerctrl.cpp584
-rw-r--r--indra/newview/llchatitemscontainerctrl.h82
-rw-r--r--indra/newview/llchatmsgbox.cpp80
-rw-r--r--indra/newview/llchatmsgbox.h32
-rw-r--r--indra/newview/llchiclet.cpp1352
-rw-r--r--indra/newview/llchiclet.h1274
-rw-r--r--indra/newview/llchicletbar.cpp314
-rw-r--r--indra/newview/llchicletbar.h86
-rw-r--r--indra/newview/llclassifiedinfo.cpp36
-rw-r--r--indra/newview/llclassifiedinfo.h18
-rw-r--r--indra/newview/llcofwearables.cpp1116
-rw-r--r--indra/newview/llcofwearables.h134
-rw-r--r--indra/newview/llcolorswatch.cpp474
-rw-r--r--indra/newview/llcolorswatch.h150
-rw-r--r--indra/newview/llcommanddispatcherlistener.cpp10
-rw-r--r--indra/newview/llcommanddispatcherlistener.h10
-rw-r--r--indra/newview/llcommandhandler.cpp246
-rw-r--r--indra/newview/llcommandhandler.h100
-rw-r--r--indra/newview/llcommandlineparser.cpp184
-rw-r--r--indra/newview/llcommandlineparser.h206
-rw-r--r--indra/newview/llcommunicationchannel.cpp30
-rw-r--r--indra/newview/llcommunicationchannel.h26
-rw-r--r--indra/newview/llcompilequeue.cpp156
-rw-r--r--indra/newview/llcompilequeue.h124
-rw-r--r--indra/newview/llconfirmationmanager.cpp116
-rw-r--r--indra/newview/llconfirmationmanager.h106
-rw-r--r--indra/newview/llcontrolavatar.cpp350
-rw-r--r--indra/newview/llcontrolavatar.h34
-rw-r--r--indra/newview/llconversationlog.cpp766
-rw-r--r--indra/newview/llconversationlog.h256
-rw-r--r--indra/newview/llconversationloglist.cpp772
-rw-r--r--indra/newview/llconversationloglist.h116
-rw-r--r--indra/newview/llconversationloglistitem.cpp160
-rw-r--r--indra/newview/llconversationloglistitem.h50
-rw-r--r--indra/newview/llconversationmodel.cpp882
-rw-r--r--indra/newview/llconversationmodel.h430
-rw-r--r--indra/newview/llconversationview.cpp724
-rw-r--r--indra/newview/llconversationview.h152
-rw-r--r--indra/newview/llcurrencyuimanager.cpp812
-rw-r--r--indra/newview/llcurrencyuimanager.h124
-rw-r--r--indra/newview/llcylinder.cpp56
-rw-r--r--indra/newview/llcylinder.h14
-rw-r--r--indra/newview/lldateutil.cpp280
-rw-r--r--indra/newview/lldateutil.h102
-rw-r--r--indra/newview/lldebugmessagebox.cpp394
-rw-r--r--indra/newview/lldebugmessagebox.h66
-rw-r--r--indra/newview/lldebugview.cpp140
-rw-r--r--indra/newview/lldebugview.h46
-rw-r--r--indra/newview/lldeferredsounds.cpp20
-rw-r--r--indra/newview/lldeferredsounds.h12
-rw-r--r--indra/newview/lldelayedgestureerror.cpp124
-rw-r--r--indra/newview/lldelayedgestureerror.h62
-rw-r--r--indra/newview/lldensityctrl.cpp4
-rw-r--r--indra/newview/lldensityctrl.h4
-rw-r--r--indra/newview/lldirpicker.cpp326
-rw-r--r--indra/newview/lldirpicker.h94
-rw-r--r--indra/newview/lldndbutton.cpp20
-rw-r--r--indra/newview/lldndbutton.h54
-rw-r--r--indra/newview/lldonotdisturbnotificationstorage.cpp214
-rw-r--r--indra/newview/lldonotdisturbnotificationstorage.h16
-rw-r--r--indra/newview/lldrawable.cpp2656
-rw-r--r--indra/newview/lldrawable.h502
-rw-r--r--indra/newview/lldrawpool.cpp422
-rw-r--r--indra/newview/lldrawpool.h368
-rw-r--r--indra/newview/lldrawpoolalpha.cpp178
-rw-r--r--indra/newview/lldrawpoolalpha.h58
-rw-r--r--indra/newview/lldrawpoolavatar.cpp892
-rw-r--r--indra/newview/lldrawpoolavatar.h118
-rw-r--r--indra/newview/lldrawpoolbump.cpp1382
-rw-r--r--indra/newview/lldrawpoolbump.h132
-rw-r--r--indra/newview/lldrawpoolmaterials.cpp128
-rw-r--r--indra/newview/lldrawpoolmaterials.h58
-rw-r--r--indra/newview/lldrawpoolpbropaque.cpp10
-rw-r--r--indra/newview/lldrawpoolpbropaque.h10
-rw-r--r--indra/newview/lldrawpoolsimple.cpp74
-rw-r--r--indra/newview/lldrawpoolsimple.h154
-rw-r--r--indra/newview/lldrawpoolsky.cpp16
-rw-r--r--indra/newview/lldrawpoolsky.h50
-rw-r--r--indra/newview/lldrawpoolterrain.cpp1232
-rw-r--r--indra/newview/lldrawpoolterrain.h72
-rw-r--r--indra/newview/lldrawpooltree.cpp60
-rw-r--r--indra/newview/lldrawpooltree.h54
-rw-r--r--indra/newview/lldrawpoolwater.cpp32
-rw-r--r--indra/newview/lldrawpoolwater.h48
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp162
-rw-r--r--indra/newview/lldrawpoolwlsky.h60
-rw-r--r--indra/newview/lldynamictexture.cpp302
-rw-r--r--indra/newview/lldynamictexture.h94
-rw-r--r--indra/newview/llemote.cpp114
-rw-r--r--indra/newview/llemote.h98
-rw-r--r--indra/newview/llenvadapters.cpp14
-rw-r--r--indra/newview/llenvadapters.h54
-rw-r--r--indra/newview/llenvironment.cpp90
-rw-r--r--indra/newview/llenvironment.h18
-rw-r--r--indra/newview/llestateinfomodel.cpp178
-rw-r--r--indra/newview/llestateinfomodel.h126
-rw-r--r--indra/newview/lleventnotifier.cpp346
-rw-r--r--indra/newview/lleventnotifier.h66
-rw-r--r--indra/newview/lleventpoll.cpp36
-rw-r--r--indra/newview/lleventpoll.h20
-rw-r--r--indra/newview/llexpandabletextbox.cpp602
-rw-r--r--indra/newview/llexpandabletextbox.h294
-rw-r--r--indra/newview/llexperiencelog.cpp346
-rw-r--r--indra/newview/llexperiencelog.h76
-rw-r--r--indra/newview/llexternaleditor.cpp278
-rw-r--r--indra/newview/llexternaleditor.h104
-rw-r--r--indra/newview/llface.cpp3360
-rw-r--r--indra/newview/llface.h538
-rw-r--r--indra/newview/llface.inl172
-rw-r--r--indra/newview/llfasttimerview.cpp2828
-rw-r--r--indra/newview/llfasttimerview.h212
-rw-r--r--indra/newview/llfavoritesbar.cpp2900
-rw-r--r--indra/newview/llfavoritesbar.h378
-rw-r--r--indra/newview/llfeaturemanager.cpp968
-rw-r--r--indra/newview/llfeaturemanager.h190
-rw-r--r--indra/newview/llfetchedgltfmaterial.cpp2
-rw-r--r--indra/newview/llfetchedgltfmaterial.h2
-rw-r--r--indra/newview/llfilepicker.cpp2080
-rw-r--r--indra/newview/llfilepicker.h206
-rw-r--r--indra/newview/llfilepicker_mac.h12
-rw-r--r--indra/newview/llfilteredwearablelist.cpp134
-rw-r--r--indra/newview/llfilteredwearablelist.h60
-rw-r--r--indra/newview/llfirstuse.cpp132
-rw-r--r--indra/newview/llfirstuse.h54
-rw-r--r--indra/newview/llflexibleobject.cpp1448
-rw-r--r--indra/newview/llflexibleobject.h206
-rw-r--r--indra/newview/llfloater360capture.cpp4
-rw-r--r--indra/newview/llfloaterabout.cpp262
-rw-r--r--indra/newview/llfloaterabout.h16
-rw-r--r--indra/newview/llfloateraddpaymentmethod.cpp48
-rw-r--r--indra/newview/llfloateraddpaymentmethod.h30
-rw-r--r--indra/newview/llfloaterauction.cpp776
-rw-r--r--indra/newview/llfloaterauction.h62
-rw-r--r--indra/newview/llfloaterautoreplacesettings.cpp918
-rw-r--r--indra/newview/llfloaterautoreplacesettings.h150
-rw-r--r--indra/newview/llfloateravatar.cpp24
-rw-r--r--indra/newview/llfloateravatar.h20
-rw-r--r--indra/newview/llfloateravatarpicker.cpp1054
-rw-r--r--indra/newview/llfloateravatarpicker.h108
-rw-r--r--indra/newview/llfloateravatarrendersettings.cpp6
-rw-r--r--indra/newview/llfloateravatartextures.cpp260
-rw-r--r--indra/newview/llfloateravatartextures.h28
-rw-r--r--indra/newview/llfloaterbeacons.cpp174
-rw-r--r--indra/newview/llfloaterbeacons.h28
-rw-r--r--indra/newview/llfloaterbigpreview.cpp66
-rw-r--r--indra/newview/llfloaterbigpreview.h18
-rw-r--r--indra/newview/llfloaterbuildoptions.cpp18
-rw-r--r--indra/newview/llfloaterbuildoptions.h26
-rw-r--r--indra/newview/llfloaterbulkpermission.cpp588
-rw-r--r--indra/newview/llfloaterbulkpermission.h142
-rw-r--r--indra/newview/llfloaterbump.cpp304
-rw-r--r--indra/newview/llfloaterbump.h66
-rw-r--r--indra/newview/llfloaterbuy.cpp494
-rw-r--r--indra/newview/llfloaterbuy.h52
-rw-r--r--indra/newview/llfloaterbuycontents.cpp436
-rw-r--r--indra/newview/llfloaterbuycontents.h40
-rw-r--r--indra/newview/llfloaterbuycurrency.cpp450
-rw-r--r--indra/newview/llfloaterbuycurrency.h46
-rw-r--r--indra/newview/llfloaterbuycurrencyhtml.cpp102
-rw-r--r--indra/newview/llfloaterbuycurrencyhtml.h46
-rw-r--r--indra/newview/llfloaterbuyland.cpp2236
-rw-r--r--indra/newview/llfloaterbuyland.h28
-rw-r--r--indra/newview/llfloaterbvhpreview.cpp1524
-rw-r--r--indra/newview/llfloaterbvhpreview.h152
-rw-r--r--indra/newview/llfloatercamera.cpp724
-rw-r--r--indra/newview/llfloatercamera.h188
-rw-r--r--indra/newview/llfloatercamerapresets.cpp16
-rw-r--r--indra/newview/llfloatercamerapresets.h10
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.cpp14
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.h12
-rw-r--r--indra/newview/llfloaterchatvoicevolume.cpp16
-rw-r--r--indra/newview/llfloaterchatvoicevolume.h18
-rw-r--r--indra/newview/llfloatercolorpicker.cpp1524
-rw-r--r--indra/newview/llfloatercolorpicker.h298
-rw-r--r--indra/newview/llfloaterconversationlog.cpp132
-rw-r--r--indra/newview/llfloaterconversationlog.h18
-rw-r--r--indra/newview/llfloaterconversationpreview.cpp396
-rw-r--r--indra/newview/llfloaterconversationpreview.h50
-rw-r--r--indra/newview/llfloatercreatelandmark.cpp424
-rw-r--r--indra/newview/llfloatercreatelandmark.h54
-rw-r--r--indra/newview/llfloaterdeleteprefpreset.cpp92
-rw-r--r--indra/newview/llfloaterdeleteprefpreset.h24
-rw-r--r--indra/newview/llfloaterdestinations.cpp16
-rw-r--r--indra/newview/llfloaterdestinations.h20
-rw-r--r--indra/newview/llfloaterdisplayname.cpp248
-rw-r--r--indra/newview/llfloaterdisplayname.h14
-rw-r--r--indra/newview/llfloatereditenvironmentbase.cpp10
-rw-r--r--indra/newview/llfloatereditenvironmentbase.h14
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp34
-rw-r--r--indra/newview/llfloatereditextdaycycle.h58
-rw-r--r--indra/newview/llfloatereditsky.cpp446
-rw-r--r--indra/newview/llfloatereditwater.cpp324
-rw-r--r--indra/newview/llfloateremojipicker.cpp4
-rw-r--r--indra/newview/llfloateremojipicker.h2
-rw-r--r--indra/newview/llfloaterenvironmentadjust.cpp12
-rw-r--r--indra/newview/llfloaterenvironmentadjust.h10
-rw-r--r--indra/newview/llfloaterevent.cpp74
-rw-r--r--indra/newview/llfloaterevent.h28
-rw-r--r--indra/newview/llfloaterexperiencepicker.cpp76
-rw-r--r--indra/newview/llfloaterexperiencepicker.h36
-rw-r--r--indra/newview/llfloaterexperienceprofile.cpp188
-rw-r--r--indra/newview/llfloaterexperienceprofile.h24
-rw-r--r--indra/newview/llfloaterexperiences.cpp54
-rw-r--r--indra/newview/llfloaterexperiences.h22
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp22
-rw-r--r--indra/newview/llfloaterfixedenvironment.h16
-rw-r--r--indra/newview/llfloaterfonttest.cpp12
-rw-r--r--indra/newview/llfloaterfonttest.h18
-rw-r--r--indra/newview/llfloaterforgetuser.cpp12
-rw-r--r--indra/newview/llfloaterforgetuser.h10
-rw-r--r--indra/newview/llfloatergesture.cpp1094
-rw-r--r--indra/newview/llfloatergesture.h104
-rw-r--r--indra/newview/llfloatergodtools.cpp1570
-rw-r--r--indra/newview/llfloatergodtools.h284
-rw-r--r--indra/newview/llfloatergotoline.cpp40
-rw-r--r--indra/newview/llfloatergotoline.h2
-rw-r--r--indra/newview/llfloatergridstatus.cpp10
-rw-r--r--indra/newview/llfloatergridstatus.h10
-rw-r--r--indra/newview/llfloatergroupbulkban.cpp130
-rw-r--r--indra/newview/llfloatergroupbulkban.h12
-rw-r--r--indra/newview/llfloatergroupinvite.cpp156
-rw-r--r--indra/newview/llfloatergroupinvite.h20
-rw-r--r--indra/newview/llfloatergroups.cpp406
-rw-r--r--indra/newview/llfloatergroups.h122
-rw-r--r--indra/newview/llfloaterhandler.cpp82
-rw-r--r--indra/newview/llfloaterhandler.h16
-rw-r--r--indra/newview/llfloaterhelpbrowser.cpp140
-rw-r--r--indra/newview/llfloaterhelpbrowser.h44
-rw-r--r--indra/newview/llfloaterhoverheight.cpp142
-rw-r--r--indra/newview/llfloaterhoverheight.h22
-rw-r--r--indra/newview/llfloaterhowto.cpp24
-rw-r--r--indra/newview/llfloaterhowto.h10
-rw-r--r--indra/newview/llfloaterhud.cpp66
-rw-r--r--indra/newview/llfloaterhud.h24
-rw-r--r--indra/newview/llfloaterimagepreview.cpp1312
-rw-r--r--indra/newview/llfloaterimagepreview.h142
-rw-r--r--indra/newview/llfloaterimcontainer.cpp2994
-rw-r--r--indra/newview/llfloaterimcontainer.h284
-rw-r--r--indra/newview/llfloaterimnearbychat.cpp1234
-rw-r--r--indra/newview/llfloaterimnearbychat.h102
-rw-r--r--indra/newview/llfloaterimnearbychathandler.cpp960
-rw-r--r--indra/newview/llfloaterimnearbychathandler.h20
-rw-r--r--indra/newview/llfloaterimnearbychatlistener.cpp82
-rw-r--r--indra/newview/llfloaterimnearbychatlistener.h4
-rw-r--r--indra/newview/llfloaterimsession.cpp1868
-rw-r--r--indra/newview/llfloaterimsession.h254
-rw-r--r--indra/newview/llfloaterimsessiontab.cpp1798
-rw-r--r--indra/newview/llfloaterimsessiontab.h354
-rw-r--r--indra/newview/llfloaterinspect.cpp490
-rw-r--r--indra/newview/llfloaterinspect.h60
-rw-r--r--indra/newview/llfloaterjoystick.cpp480
-rw-r--r--indra/newview/llfloaterjoystick.h100
-rw-r--r--indra/newview/llfloaterlagmeter.cpp596
-rw-r--r--indra/newview/llfloaterlagmeter.h78
-rw-r--r--indra/newview/llfloaterland.cpp5044
-rw-r--r--indra/newview/llfloaterland.h574
-rw-r--r--indra/newview/llfloaterlandholdings.cpp476
-rw-r--r--indra/newview/llfloaterlandholdings.h58
-rw-r--r--indra/newview/llfloaterlinkreplace.cpp618
-rw-r--r--indra/newview/llfloaterlinkreplace.h136
-rw-r--r--indra/newview/llfloaterloadprefpreset.cpp74
-rw-r--r--indra/newview/llfloaterloadprefpreset.h24
-rwxr-xr-xindra/newview/llfloatermap.cpp182
-rw-r--r--indra/newview/llfloatermap.h50
-rw-r--r--indra/newview/llfloatermarketplacelistings.cpp480
-rw-r--r--indra/newview/llfloatermarketplacelistings.h190
-rw-r--r--indra/newview/llfloatermediasettings.cpp384
-rw-r--r--indra/newview/llfloatermediasettings.h82
-rw-r--r--indra/newview/llfloatermemleak.cpp274
-rw-r--r--indra/newview/llfloatermemleak.h68
-rw-r--r--indra/newview/llfloatermodelpreview.cpp1920
-rw-r--r--indra/newview/llfloatermodelpreview.h320
-rw-r--r--indra/newview/llfloatermodeluploadbase.cpp34
-rw-r--r--indra/newview/llfloatermodeluploadbase.h24
-rw-r--r--indra/newview/llfloatermyenvironment.cpp18
-rw-r--r--indra/newview/llfloatermyenvironment.h14
-rw-r--r--indra/newview/llfloatermyscripts.cpp386
-rw-r--r--indra/newview/llfloatermyscripts.h44
-rw-r--r--indra/newview/llfloaternamedesc.cpp204
-rw-r--r--indra/newview/llfloaternamedesc.h50
-rw-r--r--indra/newview/llfloaternewfeaturenotification.cpp12
-rw-r--r--indra/newview/llfloaternewfeaturenotification.h14
-rw-r--r--indra/newview/llfloaternotificationsconsole.cpp320
-rw-r--r--indra/newview/llfloaternotificationsconsole.h44
-rw-r--r--indra/newview/llfloaternotificationstabbed.cpp26
-rw-r--r--indra/newview/llfloaternotificationstabbed.h28
-rw-r--r--indra/newview/llfloaterobjectweights.cpp336
-rw-r--r--indra/newview/llfloaterobjectweights.h50
-rw-r--r--indra/newview/llfloateropenobject.cpp238
-rw-r--r--indra/newview/llfloateropenobject.h64
-rw-r--r--indra/newview/llfloaterpathfindingcharacters.cpp326
-rw-r--r--indra/newview/llfloaterpathfindingcharacters.h62
-rw-r--r--indra/newview/llfloaterpathfindingconsole.cpp1790
-rw-r--r--indra/newview/llfloaterpathfindingconsole.h302
-rw-r--r--indra/newview/llfloaterpathfindinglinksets.cpp1082
-rw-r--r--indra/newview/llfloaterpathfindinglinksets.h136
-rw-r--r--indra/newview/llfloaterpathfindingobjects.cpp1120
-rw-r--r--indra/newview/llfloaterpathfindingobjects.h206
-rw-r--r--indra/newview/llfloaterpay.cpp788
-rw-r--r--indra/newview/llfloaterpay.h38
-rw-r--r--indra/newview/llfloaterperformance.cpp18
-rw-r--r--indra/newview/llfloaterperformance.h12
-rw-r--r--indra/newview/llfloaterperms.cpp226
-rw-r--r--indra/newview/llfloaterperms.h82
-rw-r--r--indra/newview/llfloaterpostprocess.cpp250
-rw-r--r--indra/newview/llfloaterpostprocess.h46
-rw-r--r--indra/newview/llfloaterpreference.cpp3280
-rw-r--r--indra/newview/llfloaterpreference.h516
-rw-r--r--indra/newview/llfloaterpreferencesgraphicsadvanced.cpp44
-rw-r--r--indra/newview/llfloaterpreferencesgraphicsadvanced.h22
-rw-r--r--indra/newview/llfloaterpreferenceviewadvanced.cpp54
-rw-r--r--indra/newview/llfloaterpreferenceviewadvanced.h26
-rw-r--r--indra/newview/llfloaterpreviewtrash.cpp36
-rw-r--r--indra/newview/llfloaterpreviewtrash.h26
-rw-r--r--indra/newview/llfloaterprofile.cpp2
-rw-r--r--indra/newview/llfloaterprofiletexture.cpp14
-rw-r--r--indra/newview/llfloaterprofiletexture.h10
-rw-r--r--indra/newview/llfloaterregiondebugconsole.cpp176
-rw-r--r--indra/newview/llfloaterregiondebugconsole.h32
-rw-r--r--indra/newview/llfloaterregioninfo.cpp5134
-rw-r--r--indra/newview/llfloaterregioninfo.h614
-rw-r--r--indra/newview/llfloaterregionrestarting.cpp196
-rw-r--r--indra/newview/llfloaterregionrestarting.h58
-rw-r--r--indra/newview/llfloaterreporter.cpp1270
-rw-r--r--indra/newview/llfloaterreporter.h148
-rw-r--r--indra/newview/llfloatersavecamerapreset.cpp196
-rw-r--r--indra/newview/llfloatersavecamerapreset.h34
-rw-r--r--indra/newview/llfloatersaveprefpreset.cpp102
-rw-r--r--indra/newview/llfloatersaveprefpreset.h30
-rw-r--r--indra/newview/llfloatersceneloadstats.cpp18
-rw-r--r--indra/newview/llfloatersceneloadstats.h16
-rw-r--r--indra/newview/llfloaterscriptdebug.cpp224
-rw-r--r--indra/newview/llfloaterscriptdebug.h38
-rw-r--r--indra/newview/llfloaterscriptedprefs.cpp32
-rw-r--r--indra/newview/llfloaterscriptedprefs.h18
-rw-r--r--indra/newview/llfloaterscriptlimits.cpp1184
-rw-r--r--indra/newview/llfloaterscriptlimits.h128
-rw-r--r--indra/newview/llfloatersearch.cpp224
-rw-r--r--indra/newview/llfloatersearch.h70
-rw-r--r--indra/newview/llfloatersellland.cpp798
-rw-r--r--indra/newview/llfloatersellland.h18
-rw-r--r--indra/newview/llfloatersettingsdebug.cpp706
-rw-r--r--indra/newview/llfloatersettingsdebug.h38
-rw-r--r--indra/newview/llfloatersidepanelcontainer.cpp180
-rw-r--r--indra/newview/llfloatersidepanelcontainer.h70
-rw-r--r--indra/newview/llfloatersimplesnapshot.cpp14
-rw-r--r--indra/newview/llfloatersimplesnapshot.h2
-rw-r--r--indra/newview/llfloatersnapshot.cpp2022
-rw-r--r--indra/newview/llfloatersnapshot.h294
-rw-r--r--indra/newview/llfloatersounddevices.cpp54
-rw-r--r--indra/newview/llfloatersounddevices.h22
-rw-r--r--indra/newview/llfloaterspellchecksettings.cpp700
-rw-r--r--indra/newview/llfloaterspellchecksettings.h48
-rw-r--r--indra/newview/llfloatertelehub.cpp348
-rw-r--r--indra/newview/llfloatertelehub.h62
-rw-r--r--indra/newview/llfloatertestinspectors.cpp74
-rw-r--r--indra/newview/llfloatertestinspectors.h50
-rw-r--r--indra/newview/llfloatertestlistview.cpp12
-rw-r--r--indra/newview/llfloatertestlistview.h18
-rw-r--r--indra/newview/llfloatertools.cpp1598
-rw-r--r--indra/newview/llfloatertools.h226
-rw-r--r--indra/newview/llfloatertopobjects.cpp676
-rw-r--r--indra/newview/llfloatertopobjects.h98
-rw-r--r--indra/newview/llfloatertos.cpp266
-rw-r--r--indra/newview/llfloatertos.h50
-rw-r--r--indra/newview/llfloatertoybox.cpp190
-rw-r--r--indra/newview/llfloatertoybox.h40
-rw-r--r--indra/newview/llfloatertranslationsettings.cpp254
-rw-r--r--indra/newview/llfloatertranslationsettings.h64
-rw-r--r--indra/newview/llfloateruipreview.cpp2664
-rw-r--r--indra/newview/llfloateruipreview.h10
-rw-r--r--indra/newview/llfloaterurlentry.cpp260
-rw-r--r--indra/newview/llfloaterurlentry.h38
-rw-r--r--indra/newview/llfloatervoiceeffect.cpp418
-rw-r--r--indra/newview/llfloatervoiceeffect.h54
-rw-r--r--indra/newview/llfloatervoicevolume.cpp224
-rw-r--r--indra/newview/llfloatervoicevolume.h14
-rw-r--r--indra/newview/llfloaterwebcontent.cpp608
-rw-r--r--indra/newview/llfloaterwebcontent.h124
-rw-r--r--indra/newview/llfloaterwhitelistentry.cpp46
-rw-r--r--indra/newview/llfloaterwhitelistentry.h30
-rw-r--r--indra/newview/llfloaterwindowsize.cpp130
-rw-r--r--indra/newview/llfloaterwindowsize.h26
-rwxr-xr-xindra/newview/llfloaterworldmap.cpp2450
-rw-r--r--indra/newview/llfloaterworldmap.h232
-rw-r--r--indra/newview/llflyoutcombobtn.cpp22
-rw-r--r--indra/newview/llflyoutcombobtn.h18
-rw-r--r--indra/newview/llfolderviewmodelinventory.cpp506
-rw-r--r--indra/newview/llfolderviewmodelinventory.h132
-rw-r--r--indra/newview/llfollowcam.cpp1118
-rw-r--r--indra/newview/llfollowcam.h328
-rw-r--r--indra/newview/llfriendcard.cpp666
-rw-r--r--indra/newview/llfriendcard.h178
-rw-r--r--indra/newview/llgesturelistener.cpp158
-rw-r--r--indra/newview/llgesturelistener.h6
-rw-r--r--indra/newview/llgesturemgr.cpp2382
-rw-r--r--indra/newview/llgesturemgr.h224
-rw-r--r--indra/newview/llgiveinventory.cpp924
-rw-r--r--indra/newview/llgiveinventory.h96
-rw-r--r--indra/newview/llglsandbox.cpp1828
-rw-r--r--indra/newview/llgltfmateriallist.cpp18
-rw-r--r--indra/newview/llgltfmateriallist.h4
-rw-r--r--indra/newview/llgroupactions.cpp698
-rw-r--r--indra/newview/llgroupactions.h180
-rw-r--r--indra/newview/llgroupiconctrl.cpp136
-rw-r--r--indra/newview/llgroupiconctrl.h86
-rw-r--r--indra/newview/llgrouplist.cpp348
-rw-r--r--indra/newview/llgrouplist.h116
-rw-r--r--indra/newview/llgroupmgr.cpp3680
-rw-r--r--indra/newview/llgroupmgr.h636
-rw-r--r--indra/newview/llhasheduniqueid.cpp44
-rw-r--r--indra/newview/llhasheduniqueid.h12
-rw-r--r--indra/newview/llhints.cpp652
-rw-r--r--indra/newview/llhints.h30
-rw-r--r--indra/newview/llhttpretrypolicy.cpp158
-rw-r--r--indra/newview/llhttpretrypolicy.h78
-rw-r--r--indra/newview/llhudeffect.cpp68
-rw-r--r--indra/newview/llhudeffect.h54
-rw-r--r--indra/newview/llhudeffectbeam.cpp532
-rw-r--r--indra/newview/llhudeffectbeam.h48
-rw-r--r--indra/newview/llhudeffectblob.cpp98
-rw-r--r--indra/newview/llhudeffectblob.h30
-rw-r--r--indra/newview/llhudeffectlookat.cpp964
-rw-r--r--indra/newview/llhudeffectlookat.h90
-rw-r--r--indra/newview/llhudeffectpointat.cpp614
-rw-r--r--indra/newview/llhudeffectpointat.h72
-rw-r--r--indra/newview/llhudeffecttrail.cpp384
-rw-r--r--indra/newview/llhudeffecttrail.h100
-rw-r--r--indra/newview/llhudicon.cpp476
-rw-r--r--indra/newview/llhudicon.h60
-rw-r--r--indra/newview/llhudmanager.cpp266
-rw-r--r--indra/newview/llhudmanager.h32
-rw-r--r--indra/newview/llhudnametag.cpp1416
-rw-r--r--indra/newview/llhudnametag.h248
-rw-r--r--indra/newview/llhudobject.cpp398
-rw-r--r--indra/newview/llhudobject.h140
-rw-r--r--indra/newview/llhudrender.cpp214
-rw-r--r--indra/newview/llhudrender.h42
-rw-r--r--indra/newview/llhudtext.cpp934
-rw-r--r--indra/newview/llhudtext.h230
-rw-r--r--indra/newview/llhudview.cpp28
-rw-r--r--indra/newview/llhudview.h18
-rw-r--r--indra/newview/llimagefiltersmanager.cpp54
-rw-r--r--indra/newview/llimagefiltersmanager.h30
-rw-r--r--indra/newview/llimhandler.cpp100
-rw-r--r--indra/newview/llimpanel.cpp1352
-rw-r--r--indra/newview/llimpanel.h280
-rw-r--r--indra/newview/llimprocessing.cpp26
-rw-r--r--indra/newview/llimview.cpp5086
-rw-r--r--indra/newview/llimview.h890
-rw-r--r--indra/newview/llinspect.cpp192
-rw-r--r--indra/newview/llinspect.h50
-rw-r--r--indra/newview/llinspectavatar.cpp528
-rw-r--r--indra/newview/llinspectavatar.h14
-rw-r--r--indra/newview/llinspectgroup.cpp332
-rw-r--r--indra/newview/llinspectgroup.h14
-rw-r--r--indra/newview/llinspectobject.cpp948
-rw-r--r--indra/newview/llinspectobject.h12
-rw-r--r--indra/newview/llinspectremoteobject.cpp198
-rw-r--r--indra/newview/llinspectremoteobject.h12
-rw-r--r--indra/newview/llinspecttexture.cpp130
-rw-r--r--indra/newview/llinspecttexture.h12
-rw-r--r--indra/newview/llinspecttoast.cpp140
-rw-r--r--indra/newview/llinspecttoast.h10
-rw-r--r--indra/newview/llinventoryactions.h10
-rw-r--r--indra/newview/llinventorybridge.cpp9598
-rw-r--r--indra/newview/llinventorybridge.h942
-rw-r--r--indra/newview/llinventoryclipboard.cpp62
-rw-r--r--indra/newview/llinventoryclipboard.h62
-rw-r--r--indra/newview/llinventoryfilter.cpp2178
-rw-r--r--indra/newview/llinventoryfilter.h600
-rw-r--r--indra/newview/llinventoryfunctions.cpp1946
-rw-r--r--indra/newview/llinventoryfunctions.h272
-rw-r--r--indra/newview/llinventorygallery.cpp48
-rw-r--r--indra/newview/llinventorygallery.h12
-rw-r--r--indra/newview/llinventorygallerymenu.cpp12
-rw-r--r--indra/newview/llinventoryicon.cpp262
-rw-r--r--indra/newview/llinventoryicon.h34
-rw-r--r--indra/newview/llinventoryitemslist.cpp130
-rw-r--r--indra/newview/llinventoryitemslist.h120
-rw-r--r--indra/newview/llinventorylistitem.cpp556
-rw-r--r--indra/newview/llinventorylistitem.h306
-rw-r--r--indra/newview/llinventorymodel.cpp6688
-rw-r--r--indra/newview/llinventorymodel.h970
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp988
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.h68
-rw-r--r--indra/newview/llinventoryobserver.cpp974
-rw-r--r--indra/newview/llinventoryobserver.h270
-rw-r--r--indra/newview/llinventorypanel.cpp2164
-rw-r--r--indra/newview/llinventorypanel.h524
-rw-r--r--indra/newview/lljoystickbutton.cpp964
-rw-r--r--indra/newview/lljoystickbutton.h242
-rw-r--r--indra/newview/llkeyconflict.cpp14
-rw-r--r--indra/newview/llkeyconflict.h12
-rw-r--r--indra/newview/lllandmarkactions.cpp496
-rw-r--r--indra/newview/lllandmarkactions.h130
-rw-r--r--indra/newview/lllandmarklist.cpp186
-rw-r--r--indra/newview/lllandmarklist.h78
-rw-r--r--indra/newview/lllegacyatmospherics.cpp654
-rw-r--r--indra/newview/lllegacyatmospherics.h22
-rw-r--r--indra/newview/lllightconstants.h14
-rw-r--r--indra/newview/lllistbrowser.cpp10
-rw-r--r--indra/newview/lllistbrowser.h10
-rw-r--r--indra/newview/lllistcontextmenu.cpp110
-rw-r--r--indra/newview/lllistcontextmenu.h50
-rw-r--r--indra/newview/lllistview.cpp44
-rw-r--r--indra/newview/lllistview.h48
-rw-r--r--indra/newview/lllocalbitmaps.cpp1648
-rw-r--r--indra/newview/lllocalbitmaps.h162
-rw-r--r--indra/newview/lllocalgltfmaterials.cpp16
-rw-r--r--indra/newview/lllocalgltfmaterials.h20
-rw-r--r--indra/newview/lllocationhistory.cpp226
-rw-r--r--indra/newview/lllocationhistory.h180
-rw-r--r--indra/newview/lllocationinputctrl.cpp1904
-rw-r--r--indra/newview/lllocationinputctrl.h316
-rw-r--r--indra/newview/lllogchat.cpp1632
-rw-r--r--indra/newview/lllogchat.h228
-rw-r--r--indra/newview/llloginhandler.cpp222
-rw-r--r--indra/newview/llloginhandler.h32
-rw-r--r--indra/newview/lllogininstance.cpp356
-rw-r--r--indra/newview/lllogininstance.h110
-rw-r--r--indra/newview/lllookshistorypanel.h48
-rw-r--r--indra/newview/llmachineid.cpp34
-rw-r--r--indra/newview/llmachineid.h16
-rw-r--r--indra/newview/llmanip.cpp864
-rw-r--r--indra/newview/llmanip.h230
-rw-r--r--indra/newview/llmaniprotate.cpp3472
-rw-r--r--indra/newview/llmaniprotate.h134
-rw-r--r--indra/newview/llmanipscale.cpp3696
-rw-r--r--indra/newview/llmanipscale.h224
-rw-r--r--indra/newview/llmaniptranslate.cpp4222
-rw-r--r--indra/newview/llmaniptranslate.h138
-rw-r--r--indra/newview/llmarketplacefunctions.cpp496
-rw-r--r--indra/newview/llmarketplacefunctions.h174
-rw-r--r--indra/newview/llmarketplacenotifications.cpp106
-rw-r--r--indra/newview/llmarketplacenotifications.h18
-rw-r--r--indra/newview/llmaterialeditor.cpp82
-rw-r--r--indra/newview/llmaterialeditor.h20
-rw-r--r--indra/newview/llmaterialmgr.cpp1174
-rw-r--r--indra/newview/llmaterialmgr.h180
-rw-r--r--indra/newview/llmediactrl.cpp1694
-rw-r--r--indra/newview/llmediactrl.h322
-rw-r--r--indra/newview/llmediadataclient.cpp984
-rw-r--r--indra/newview/llmediadataclient.h518
-rw-r--r--indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp294
-rw-r--r--indra/newview/llmenuoptionpathfindingrebakenavmesh.h62
-rw-r--r--indra/newview/llmeshrepository.cpp7270
-rw-r--r--indra/newview/llmeshrepository.h892
-rw-r--r--indra/newview/llmimetypes.cpp378
-rw-r--r--indra/newview/llmimetypes.h144
-rw-r--r--indra/newview/llmodelpreview.cpp40
-rw-r--r--indra/newview/llmodelpreview.h82
-rw-r--r--indra/newview/llmorphview.cpp162
-rw-r--r--indra/newview/llmorphview.h82
-rw-r--r--indra/newview/llmoveview.cpp878
-rw-r--r--indra/newview/llmoveview.h228
-rw-r--r--indra/newview/llmutelist.cpp1214
-rw-r--r--indra/newview/llmutelist.h266
-rw-r--r--indra/newview/llnamebox.cpp124
-rw-r--r--indra/newview/llnamebox.h52
-rw-r--r--indra/newview/llnameeditor.cpp86
-rw-r--r--indra/newview/llnameeditor.h52
-rw-r--r--indra/newview/llnamelistctrl.cpp864
-rw-r--r--indra/newview/llnamelistctrl.h244
-rw-r--r--indra/newview/llnavigationbar.cpp958
-rwxr-xr-xindra/newview/llnavigationbar.h194
-rw-r--r--indra/newview/llnetmap.cpp1216
-rw-r--r--indra/newview/llnetmap.h110
-rw-r--r--indra/newview/llnotificationalerthandler.cpp162
-rw-r--r--indra/newview/llnotificationgrouphandler.cpp84
-rw-r--r--indra/newview/llnotificationhandler.h308
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp410
-rw-r--r--indra/newview/llnotificationhinthandler.cpp18
-rw-r--r--indra/newview/llnotificationlistitem.cpp112
-rw-r--r--indra/newview/llnotificationlistitem.h38
-rw-r--r--indra/newview/llnotificationlistview.cpp10
-rw-r--r--indra/newview/llnotificationlistview.h12
-rw-r--r--indra/newview/llnotificationmanager.cpp34
-rw-r--r--indra/newview/llnotificationmanager.h34
-rw-r--r--indra/newview/llnotificationofferhandler.cpp280
-rw-r--r--indra/newview/llnotificationscripthandler.cpp164
-rw-r--r--indra/newview/llnotificationstorage.cpp110
-rw-r--r--indra/newview/llnotificationstorage.h28
-rw-r--r--indra/newview/llnotificationtiphandler.cpp162
-rw-r--r--indra/newview/lloutfitgallery.cpp28
-rw-r--r--indra/newview/lloutfitgallery.h24
-rw-r--r--indra/newview/lloutfitobserver.cpp180
-rw-r--r--indra/newview/lloutfitobserver.h70
-rw-r--r--indra/newview/lloutfitslist.cpp730
-rw-r--r--indra/newview/lloutfitslist.h226
-rw-r--r--indra/newview/lloutputmonitorctrl.cpp472
-rw-r--r--indra/newview/lloutputmonitorctrl.h228
-rw-r--r--indra/newview/llpanelappearancetab.cpp20
-rw-r--r--indra/newview/llpanelappearancetab.h30
-rw-r--r--indra/newview/llpanelavatartag.cpp64
-rw-r--r--indra/newview/llpanelavatartag.h84
-rw-r--r--indra/newview/llpanelblockedlist.cpp280
-rw-r--r--indra/newview/llpanelblockedlist.h98
-rw-r--r--indra/newview/llpanelclassified.cpp686
-rw-r--r--indra/newview/llpanelclassified.h166
-rw-r--r--indra/newview/llpanelcontents.cpp180
-rw-r--r--indra/newview/llpanelcontents.h30
-rw-r--r--indra/newview/llpaneleditsky.cpp18
-rw-r--r--indra/newview/llpaneleditsky.h12
-rw-r--r--indra/newview/llpaneleditwater.h8
-rw-r--r--indra/newview/llpaneleditwearable.cpp26
-rw-r--r--indra/newview/llpaneleditwearable.h244
-rw-r--r--indra/newview/llpanelenvironment.cpp28
-rw-r--r--indra/newview/llpanelenvironment.h10
-rw-r--r--indra/newview/llpanelexperiencelisteditor.cpp286
-rw-r--r--indra/newview/llpanelexperiencelisteditor.h100
-rw-r--r--indra/newview/llpanelexperiencelog.cpp330
-rw-r--r--indra/newview/llpanelexperiencelog.h46
-rw-r--r--indra/newview/llpanelexperiencepicker.cpp530
-rw-r--r--indra/newview/llpanelexperiencepicker.h82
-rw-r--r--indra/newview/llpanelexperiences.cpp118
-rw-r--r--indra/newview/llpanelexperiences.h50
-rw-r--r--indra/newview/llpanelface.cpp3932
-rw-r--r--indra/newview/llpanelface.h806
-rw-r--r--indra/newview/llpanelgenerictip.cpp22
-rw-r--r--indra/newview/llpanelgenerictip.h30
-rw-r--r--indra/newview/llpanelgroup.cpp832
-rw-r--r--indra/newview/llpanelgroup.h166
-rw-r--r--indra/newview/llpanelgroupbulk.cpp562
-rw-r--r--indra/newview/llpanelgroupbulk.h38
-rw-r--r--indra/newview/llpanelgroupbulkban.cpp338
-rw-r--r--indra/newview/llpanelgroupbulkban.h14
-rw-r--r--indra/newview/llpanelgroupbulkimpl.h76
-rw-r--r--indra/newview/llpanelgroupcreate.cpp10
-rw-r--r--indra/newview/llpanelgroupcreate.h10
-rw-r--r--indra/newview/llpanelgroupexperiences.cpp62
-rw-r--r--indra/newview/llpanelgroupexperiences.h32
-rw-r--r--indra/newview/llpanelgroupgeneral.cpp1176
-rw-r--r--indra/newview/llpanelgroupgeneral.h108
-rw-r--r--indra/newview/llpanelgroupinvite.cpp1028
-rw-r--r--indra/newview/llpanelgroupinvite.h50
-rw-r--r--indra/newview/llpanelgrouplandmoney.cpp2478
-rw-r--r--indra/newview/llpanelgrouplandmoney.h50
-rw-r--r--indra/newview/llpanelgroupnotices.cpp924
-rw-r--r--indra/newview/llpanelgroupnotices.h138
-rw-r--r--indra/newview/llpanelgrouproles.cpp5146
-rw-r--r--indra/newview/llpanelgrouproles.h446
-rw-r--r--indra/newview/llpanelhome.cpp44
-rw-r--r--indra/newview/llpanelhome.h22
-rw-r--r--indra/newview/llpanelimcontrolpanel.h50
-rw-r--r--indra/newview/llpanelland.cpp302
-rw-r--r--indra/newview/llpanelland.h40
-rw-r--r--indra/newview/llpanellandaudio.cpp190
-rw-r--r--indra/newview/llpanellandaudio.h40
-rw-r--r--indra/newview/llpanellandmarkinfo.cpp690
-rw-r--r--indra/newview/llpanellandmarkinfo.h74
-rw-r--r--indra/newview/llpanellandmarks.cpp1446
-rw-r--r--indra/newview/llpanellandmarks.h186
-rw-r--r--indra/newview/llpanellandmedia.cpp416
-rw-r--r--indra/newview/llpanellandmedia.h64
-rw-r--r--indra/newview/llpanellogin.cpp1624
-rw-r--r--indra/newview/llpanellogin.h154
-rw-r--r--indra/newview/llpanelloginlistener.cpp10
-rw-r--r--indra/newview/llpanelloginlistener.h10
-rw-r--r--indra/newview/llpanelmaininventory.cpp2202
-rw-r--r--indra/newview/llpanelmaininventory.h208
-rw-r--r--indra/newview/llpanelmarketplaceinbox.cpp366
-rw-r--r--indra/newview/llpanelmarketplaceinbox.h58
-rw-r--r--indra/newview/llpanelmarketplaceinboxinventory.cpp294
-rw-r--r--indra/newview/llpanelmarketplaceinboxinventory.h122
-rw-r--r--indra/newview/llpanelmediasettingsgeneral.cpp698
-rw-r--r--indra/newview/llpanelmediasettingsgeneral.h110
-rw-r--r--indra/newview/llpanelmediasettingspermissions.cpp254
-rw-r--r--indra/newview/llpanelmediasettingspermissions.h62
-rw-r--r--indra/newview/llpanelmediasettingssecurity.cpp418
-rw-r--r--indra/newview/llpanelmediasettingssecurity.h76
-rw-r--r--indra/newview/llpanelnearbymedia.cpp1880
-rw-r--r--indra/newview/llpanelnearbymedia.h256
-rw-r--r--indra/newview/llpanelobject.cpp3554
-rw-r--r--indra/newview/llpanelobject.h242
-rw-r--r--indra/newview/llpanelobjectinventory.cpp2430
-rw-r--r--indra/newview/llpanelobjectinventory.h112
-rw-r--r--indra/newview/llpanelonlinestatus.cpp36
-rw-r--r--indra/newview/llpanelonlinestatus.h18
-rw-r--r--indra/newview/llpaneloutfitedit.cpp2140
-rw-r--r--indra/newview/llpaneloutfitedit.h358
-rw-r--r--indra/newview/llpaneloutfitsinventory.cpp376
-rw-r--r--indra/newview/llpaneloutfitsinventory.h94
-rw-r--r--indra/newview/llpanelpeople.cpp2282
-rw-r--r--indra/newview/llpanelpeople.h210
-rw-r--r--indra/newview/llpanelpeoplemenus.cpp542
-rw-r--r--indra/newview/llpanelpeoplemenus.h30
-rw-r--r--indra/newview/llpanelpermissions.cpp2108
-rw-r--r--indra/newview/llpanelpermissions.h88
-rw-r--r--indra/newview/llpanelplaceinfo.cpp336
-rw-r--r--indra/newview/llpanelplaceinfo.h134
-rw-r--r--indra/newview/llpanelplaceprofile.cpp1094
-rw-r--r--indra/newview/llpanelplaceprofile.h150
-rw-r--r--indra/newview/llpanelplaces.cpp1910
-rw-r--r--indra/newview/llpanelplaces.h164
-rw-r--r--indra/newview/llpanelplacestab.cpp58
-rw-r--r--indra/newview/llpanelplacestab.h52
-rw-r--r--indra/newview/llpanelpresetscamerapulldown.cpp126
-rw-r--r--indra/newview/llpanelpresetscamerapulldown.h24
-rw-r--r--indra/newview/llpanelpresetspulldown.cpp144
-rw-r--r--indra/newview/llpanelpresetspulldown.h24
-rw-r--r--indra/newview/llpanelprimmediacontrols.cpp2214
-rw-r--r--indra/newview/llpanelprimmediacontrols.h368
-rw-r--r--indra/newview/llpanelprofile.cpp238
-rw-r--r--indra/newview/llpanelprofile.h268
-rw-r--r--indra/newview/llpanelprofileclassifieds.cpp10
-rw-r--r--indra/newview/llpanelpulldown.h10
-rw-r--r--indra/newview/llpanelsnapshot.cpp192
-rw-r--r--indra/newview/llpanelsnapshot.h60
-rw-r--r--indra/newview/llpanelsnapshotinventory.cpp76
-rw-r--r--indra/newview/llpanelsnapshotlocal.cpp174
-rw-r--r--indra/newview/llpanelsnapshotoptions.cpp84
-rw-r--r--indra/newview/llpanelsnapshotpostcard.cpp208
-rw-r--r--indra/newview/llpanelsnapshotprofile.cpp56
-rw-r--r--indra/newview/llpanelteleporthistory.cpp1326
-rw-r--r--indra/newview/llpanelteleporthistory.h104
-rw-r--r--indra/newview/llpaneltiptoast.cpp48
-rw-r--r--indra/newview/llpaneltiptoast.h20
-rw-r--r--indra/newview/llpaneltopinfobar.cpp618
-rw-r--r--indra/newview/llpaneltopinfobar.h262
-rw-r--r--indra/newview/llpanelvoicedevicesettings.cpp458
-rw-r--r--indra/newview/llpanelvoicedevicesettings.h60
-rw-r--r--indra/newview/llpanelvoiceeffect.cpp192
-rw-r--r--indra/newview/llpanelvoiceeffect.h46
-rw-r--r--indra/newview/llpanelvolume.cpp1506
-rw-r--r--indra/newview/llpanelvolume.h128
-rw-r--r--indra/newview/llpanelvolumepulldown.cpp70
-rw-r--r--indra/newview/llpanelvolumepulldown.h28
-rw-r--r--indra/newview/llpanelwearing.cpp796
-rw-r--r--indra/newview/llpanelwearing.h80
-rw-r--r--indra/newview/llparcelselection.cpp42
-rw-r--r--indra/newview/llparcelselection.h58
-rw-r--r--indra/newview/llparticipantlist.cpp342
-rw-r--r--indra/newview/llparticipantlist.h216
-rw-r--r--indra/newview/llpatchvertexarray.cpp386
-rw-r--r--indra/newview/llpatchvertexarray.h60
-rw-r--r--indra/newview/llpathfindingcharacter.cpp60
-rw-r--r--indra/newview/llpathfindingcharacter.h28
-rw-r--r--indra/newview/llpathfindingcharacterlist.cpp2
-rw-r--r--indra/newview/llpathfindingcharacterlist.h10
-rw-r--r--indra/newview/llpathfindinglinkset.cpp556
-rw-r--r--indra/newview/llpathfindinglinkset.h142
-rw-r--r--indra/newview/llpathfindinglinksetlist.cpp250
-rw-r--r--indra/newview/llpathfindinglinksetlist.h24
-rw-r--r--indra/newview/llpathfindingmanager.cpp652
-rw-r--r--indra/newview/llpathfindingmanager.h112
-rw-r--r--indra/newview/llpathfindingnavmesh.cpp198
-rw-r--r--indra/newview/llpathfindingnavmesh.h66
-rw-r--r--indra/newview/llpathfindingnavmeshstatus.cpp122
-rw-r--r--indra/newview/llpathfindingnavmeshstatus.h56
-rw-r--r--indra/newview/llpathfindingnavmeshzone.cpp568
-rw-r--r--indra/newview/llpathfindingnavmeshzone.h154
-rw-r--r--indra/newview/llpathfindingobject.cpp206
-rw-r--r--indra/newview/llpathfindingobject.h64
-rw-r--r--indra/newview/llpathfindingobjectlist.cpp84
-rw-r--r--indra/newview/llpathfindingobjectlist.h26
-rw-r--r--indra/newview/llpathfindingpathtool.cpp488
-rw-r--r--indra/newview/llpathfindingpathtool.h184
-rw-r--r--indra/newview/llperfstats.cpp66
-rw-r--r--indra/newview/llperfstats.h28
-rw-r--r--indra/newview/llpersistentnotificationstorage.cpp242
-rw-r--r--indra/newview/llpersistentnotificationstorage.h18
-rw-r--r--indra/newview/llphysicsmotion.cpp574
-rw-r--r--indra/newview/llphysicsmotion.h102
-rw-r--r--indra/newview/llphysicsshapebuilderutil.cpp362
-rw-r--r--indra/newview/llphysicsshapebuilderutil.h124
-rw-r--r--indra/newview/llpipelinelistener.cpp346
-rw-r--r--indra/newview/llpipelinelistener.h12
-rw-r--r--indra/newview/llplacesfolderview.cpp14
-rw-r--r--indra/newview/llplacesfolderview.h44
-rw-r--r--indra/newview/llplacesinventorybridge.cpp250
-rw-r--r--indra/newview/llplacesinventorybridge.h74
-rw-r--r--indra/newview/llplacesinventorypanel.cpp70
-rw-r--r--indra/newview/llplacesinventorypanel.h34
-rw-r--r--indra/newview/llpopupview.cpp330
-rw-r--r--indra/newview/llpopupview.h50
-rw-r--r--indra/newview/llpostcard.cpp18
-rw-r--r--indra/newview/llpostcard.h24
-rw-r--r--indra/newview/llpresetsmanager.cpp864
-rw-r--r--indra/newview/llpresetsmanager.h84
-rw-r--r--indra/newview/llpreview.cpp736
-rw-r--r--indra/newview/llpreview.h182
-rw-r--r--indra/newview/llpreviewanim.cpp222
-rw-r--r--indra/newview/llpreviewanim.h34
-rw-r--r--indra/newview/llpreviewgesture.cpp2610
-rw-r--r--indra/newview/llpreviewgesture.h210
-rw-r--r--indra/newview/llpreviewnotecard.cpp942
-rw-r--r--indra/newview/llpreviewnotecard.h94
-rw-r--r--indra/newview/llpreviewscript.cpp3010
-rw-r--r--indra/newview/llpreviewscript.h390
-rw-r--r--indra/newview/llpreviewsound.cpp76
-rw-r--r--indra/newview/llpreviewsound.h18
-rw-r--r--indra/newview/llpreviewtexture.cpp990
-rw-r--r--indra/newview/llpreviewtexture.h132
-rw-r--r--indra/newview/llproductinforequest.cpp46
-rw-r--r--indra/newview/llproductinforequest.h18
-rw-r--r--indra/newview/llprogressview.cpp582
-rw-r--r--indra/newview/llprogressview.h108
-rw-r--r--indra/newview/llrecentpeople.cpp102
-rw-r--r--indra/newview/llrecentpeople.h144
-rw-r--r--indra/newview/llreflectionmap.cpp14
-rw-r--r--indra/newview/llreflectionmap.h6
-rw-r--r--indra/newview/llreflectionmapmanager.cpp70
-rw-r--r--indra/newview/llreflectionmapmanager.h12
-rw-r--r--indra/newview/llregioninfomodel.cpp368
-rw-r--r--indra/newview/llregioninfomodel.h88
-rw-r--r--indra/newview/llregionposition.cpp66
-rw-r--r--indra/newview/llregionposition.h34
-rw-r--r--indra/newview/llremoteparcelrequest.cpp224
-rw-r--r--indra/newview/llremoteparcelrequest.h72
-rw-r--r--indra/newview/llresourcedata.h24
-rw-r--r--indra/newview/llrootview.h20
-rw-r--r--indra/newview/llsavedsettingsglue.cpp20
-rw-r--r--indra/newview/llsavedsettingsglue.h20
-rw-r--r--indra/newview/llsaveoutfitcombobtn.cpp74
-rw-r--r--indra/newview/llsaveoutfitcombobtn.h28
-rw-r--r--indra/newview/llscenemonitor.cpp1176
-rw-r--r--indra/newview/llscenemonitor.h138
-rw-r--r--indra/newview/llsceneview.cpp732
-rw-r--r--indra/newview/llsceneview.h18
-rw-r--r--indra/newview/llscreenchannel.cpp1700
-rw-r--r--indra/newview/llscreenchannel.h494
-rw-r--r--indra/newview/llscripteditor.cpp266
-rw-r--r--indra/newview/llscripteditor.h58
-rw-r--r--indra/newview/llscriptfloater.cpp1124
-rw-r--r--indra/newview/llscriptfloater.h258
-rw-r--r--indra/newview/llscriptruntimeperms.h42
-rw-r--r--indra/newview/llscrollingpanelparam.cpp474
-rw-r--r--indra/newview/llscrollingpanelparam.h76
-rw-r--r--indra/newview/llscrollingpanelparambase.cpp96
-rw-r--r--indra/newview/llscrollingpanelparambase.h36
-rw-r--r--indra/newview/llsculptidsize.cpp136
-rw-r--r--indra/newview/llsculptidsize.h150
-rw-r--r--indra/newview/llsearchableui.cpp188
-rw-r--r--indra/newview/llsearchableui.h164
-rw-r--r--indra/newview/llsearchcombobox.cpp308
-rw-r--r--indra/newview/llsearchcombobox.h114
-rw-r--r--indra/newview/llsearchhistory.cpp142
-rw-r--r--indra/newview/llsearchhistory.h152
-rw-r--r--indra/newview/llsecapi.cpp182
-rw-r--r--indra/newview/llsecapi.h580
-rw-r--r--indra/newview/llsechandler_basic.cpp2440
-rw-r--r--indra/newview/llsechandler_basic.h504
-rw-r--r--indra/newview/llselectmgr.cpp11720
-rw-r--r--indra/newview/llselectmgr.h1520
-rw-r--r--indra/newview/llsetkeybinddialog.cpp16
-rw-r--r--indra/newview/llsetkeybinddialog.h10
-rw-r--r--indra/newview/llsettingspicker.cpp10
-rw-r--r--indra/newview/llsettingspicker.h16
-rw-r--r--indra/newview/llsettingsvo.cpp82
-rw-r--r--indra/newview/llsettingsvo.h4
-rw-r--r--indra/newview/llshareavatarhandler.cpp70
-rw-r--r--indra/newview/llsidepanelappearance.cpp724
-rw-r--r--indra/newview/llsidepanelappearance.h86
-rw-r--r--indra/newview/llsidepanelinventory.cpp618
-rw-r--r--indra/newview/llsidepanelinventory.h94
-rw-r--r--indra/newview/llsidepanelinventorysubpanel.cpp88
-rw-r--r--indra/newview/llsidepanelinventorysubpanel.h54
-rw-r--r--indra/newview/llsidepaneliteminfo.cpp1296
-rw-r--r--indra/newview/llsidepaneliteminfo.h94
-rw-r--r--indra/newview/llsidepaneltaskinfo.cpp1936
-rw-r--r--indra/newview/llsidepaneltaskinfo.h168
-rw-r--r--indra/newview/llsidetraypanelcontainer.cpp76
-rw-r--r--indra/newview/llsidetraypanelcontainer.h92
-rw-r--r--indra/newview/llskinningutil.cpp40
-rw-r--r--indra/newview/llskinningutil.h8
-rw-r--r--indra/newview/llsky.cpp266
-rw-r--r--indra/newview/llsky.h56
-rw-r--r--indra/newview/llslurl.cpp12
-rw-r--r--indra/newview/llslurl.h150
-rw-r--r--indra/newview/llsnapshotlivepreview.cpp1044
-rw-r--r--indra/newview/llsnapshotlivepreview.h208
-rw-r--r--indra/newview/llsnapshotmodel.h36
-rw-r--r--indra/newview/llspatialpartition.cpp5792
-rw-r--r--indra/newview/llspatialpartition.h848
-rw-r--r--indra/newview/llspeakers.cpp1322
-rw-r--r--indra/newview/llspeakers.h430
-rw-r--r--indra/newview/llspeakingindicatormanager.cpp384
-rw-r--r--indra/newview/llspeakingindicatormanager.h88
-rw-r--r--indra/newview/llsplitbutton.cpp306
-rw-r--r--indra/newview/llsplitbutton.h100
-rw-r--r--indra/newview/llsprite.cpp400
-rw-r--r--indra/newview/llsprite.h104
-rw-r--r--indra/newview/llsrv.cpp54
-rw-r--r--indra/newview/llsrv.h12
-rw-r--r--indra/newview/llstartup.cpp5956
-rw-r--r--indra/newview/llstartup.h150
-rw-r--r--indra/newview/llstartuplistener.cpp10
-rw-r--r--indra/newview/llstartuplistener.h10
-rw-r--r--indra/newview/llstatusbar.cpp856
-rw-r--r--indra/newview/llstatusbar.h150
-rw-r--r--indra/newview/llstylemap.cpp82
-rw-r--r--indra/newview/llstylemap.h20
-rw-r--r--indra/newview/llsurface.cpp2018
-rw-r--r--indra/newview/llsurface.h270
-rw-r--r--indra/newview/llsurfacepatch.cpp1626
-rw-r--r--indra/newview/llsurfacepatch.h244
-rw-r--r--indra/newview/llsyntaxid.cpp294
-rw-r--r--indra/newview/llsyntaxid.h62
-rw-r--r--indra/newview/llsyswellitem.cpp44
-rw-r--r--indra/newview/llsyswellitem.h62
-rw-r--r--indra/newview/llsyswellwindow.cpp444
-rw-r--r--indra/newview/llsyswellwindow.h148
-rw-r--r--indra/newview/lltable.h68
-rw-r--r--indra/newview/llteleporthistory.cpp308
-rw-r--r--indra/newview/llteleporthistory.h362
-rw-r--r--indra/newview/llteleporthistorystorage.cpp300
-rw-r--r--indra/newview/llteleporthistorystorage.h122
-rw-r--r--indra/newview/lltexturecache.cpp3746
-rw-r--r--indra/newview/lltexturecache.h384
-rw-r--r--indra/newview/lltexturectrl.cpp2242
-rw-r--r--indra/newview/lltexturectrl.h520
-rw-r--r--indra/newview/lltexturefetch.cpp5048
-rw-r--r--indra/newview/lltexturefetch.h574
-rw-r--r--indra/newview/lltextureinfo.cpp428
-rw-r--r--indra/newview/lltextureinfo.h62
-rw-r--r--indra/newview/lltextureinfodetails.cpp16
-rw-r--r--indra/newview/lltextureinfodetails.h34
-rw-r--r--indra/newview/lltexturestats.cpp42
-rw-r--r--indra/newview/lltexturestats.h10
-rw-r--r--indra/newview/lltextureview.cpp1568
-rw-r--r--indra/newview/lltextureview.h60
-rw-r--r--indra/newview/llthumbnailctrl.cpp44
-rw-r--r--indra/newview/llthumbnailctrl.h38
-rw-r--r--indra/newview/lltinygltfhelper.cpp4
-rw-r--r--indra/newview/lltoast.cpp774
-rw-r--r--indra/newview/lltoast.h292
-rw-r--r--indra/newview/lltoastalertpanel.cpp828
-rw-r--r--indra/newview/lltoastalertpanel.h94
-rw-r--r--indra/newview/lltoastgroupnotifypanel.cpp286
-rw-r--r--indra/newview/lltoastgroupnotifypanel.h34
-rw-r--r--indra/newview/lltoastimpanel.cpp356
-rw-r--r--indra/newview/lltoastimpanel.h68
-rw-r--r--indra/newview/lltoastnotifypanel.cpp528
-rw-r--r--indra/newview/lltoastnotifypanel.h192
-rw-r--r--indra/newview/lltoastpanel.cpp142
-rw-r--r--indra/newview/lltoastpanel.h60
-rw-r--r--indra/newview/lltoastscriptquestion.cpp142
-rw-r--r--indra/newview/lltoastscriptquestion.h16
-rw-r--r--indra/newview/lltoastscripttextbox.cpp120
-rw-r--r--indra/newview/lltoastscripttextbox.h32
-rw-r--r--indra/newview/lltool.cpp184
-rw-r--r--indra/newview/lltool.h104
-rw-r--r--indra/newview/lltoolbarview.cpp1016
-rw-r--r--indra/newview/lltoolbarview.h166
-rw-r--r--indra/newview/lltoolbrush.cpp1066
-rw-r--r--indra/newview/lltoolbrush.h92
-rw-r--r--indra/newview/lltoolcomp.cpp924
-rw-r--r--indra/newview/lltoolcomp.h218
-rw-r--r--indra/newview/lltooldraganddrop.cpp4632
-rw-r--r--indra/newview/lltooldraganddrop.h454
-rw-r--r--indra/newview/lltoolface.cpp152
-rw-r--r--indra/newview/lltoolface.h28
-rw-r--r--indra/newview/lltoolfocus.cpp614
-rw-r--r--indra/newview/lltoolfocus.h66
-rw-r--r--indra/newview/lltoolgrab.cpp1962
-rw-r--r--indra/newview/lltoolgrab.h154
-rw-r--r--indra/newview/lltoolgun.cpp150
-rw-r--r--indra/newview/lltoolgun.h28
-rw-r--r--indra/newview/lltoolindividual.cpp66
-rw-r--r--indra/newview/lltoolindividual.h22
-rw-r--r--indra/newview/lltoolmgr.cpp666
-rw-r--r--indra/newview/lltoolmgr.h118
-rw-r--r--indra/newview/lltoolmorph.cpp334
-rw-r--r--indra/newview/lltoolmorph.h110
-rw-r--r--indra/newview/lltoolobjpicker.cpp172
-rw-r--r--indra/newview/lltoolobjpicker.h40
-rw-r--r--indra/newview/lltoolpie.cpp2874
-rw-r--r--indra/newview/lltoolpie.h162
-rw-r--r--indra/newview/lltoolpipette.cpp118
-rw-r--r--indra/newview/lltoolpipette.h46
-rw-r--r--indra/newview/lltoolplacer.cpp876
-rw-r--r--indra/newview/lltoolplacer.h36
-rw-r--r--indra/newview/lltoolselect.cpp390
-rw-r--r--indra/newview/lltoolselect.h30
-rw-r--r--indra/newview/lltoolselectland.cpp268
-rw-r--r--indra/newview/lltoolselectland.h58
-rw-r--r--indra/newview/lltoolselectrect.cpp222
-rw-r--r--indra/newview/lltoolselectrect.h42
-rw-r--r--indra/newview/lltoolview.cpp226
-rw-r--r--indra/newview/lltoolview.h44
-rw-r--r--indra/newview/lltracker.cpp1306
-rw-r--r--indra/newview/lltracker.h214
-rw-r--r--indra/newview/lltrackpicker.cpp2
-rw-r--r--indra/newview/lltrackpicker.h10
-rw-r--r--indra/newview/lltransientdockablefloater.cpp108
-rw-r--r--indra/newview/lltransientdockablefloater.h24
-rw-r--r--indra/newview/lltransientfloatermgr.cpp184
-rw-r--r--indra/newview/lltransientfloatermgr.h64
-rw-r--r--indra/newview/lltranslate.cpp278
-rw-r--r--indra/newview/lltranslate.h78
-rw-r--r--indra/newview/lluiavatar.cpp8
-rw-r--r--indra/newview/lluiavatar.h4
-rw-r--r--indra/newview/lluiconstants.h20
-rw-r--r--indra/newview/lluilistener.cpp14
-rw-r--r--indra/newview/lluilistener.h10
-rw-r--r--indra/newview/lluploaddialog.cpp186
-rw-r--r--indra/newview/lluploaddialog.h30
-rw-r--r--indra/newview/lluploadfloaterobservers.h36
-rw-r--r--indra/newview/llurl.cpp418
-rw-r--r--indra/newview/llurl.h56
-rw-r--r--indra/newview/llurldispatcher.cpp500
-rw-r--r--indra/newview/llurldispatcher.h50
-rw-r--r--indra/newview/llurldispatcherlistener.cpp12
-rw-r--r--indra/newview/llurldispatcherlistener.h10
-rw-r--r--indra/newview/llurlfloaterdispatchhandler.cpp12
-rw-r--r--indra/newview/llurlfloaterdispatchhandler.h10
-rw-r--r--indra/newview/llurlhistory.cpp86
-rw-r--r--indra/newview/llurlhistory.h28
-rw-r--r--indra/newview/llurllineeditorctrl.cpp78
-rw-r--r--indra/newview/llurllineeditorctrl.h94
-rw-r--r--indra/newview/llurlwhitelist.cpp192
-rw-r--r--indra/newview/llurlwhitelist.h42
-rw-r--r--indra/newview/llvectorperfoptions.cpp10
-rw-r--r--indra/newview/llvectorperfoptions.h10
-rw-r--r--indra/newview/llversioninfo.cpp90
-rw-r--r--indra/newview/llversioninfo.h100
-rw-r--r--indra/newview/llviewchildren.cpp70
-rw-r--r--indra/newview/llviewchildren.h52
-rw-r--r--indra/newview/llviewerassetstats.cpp346
-rw-r--r--indra/newview/llviewerassetstats.h250
-rw-r--r--indra/newview/llviewerassetstorage.cpp50
-rw-r--r--indra/newview/llviewerassetstorage.h76
-rw-r--r--indra/newview/llviewerassettype.cpp120
-rw-r--r--indra/newview/llviewerassettype.h24
-rw-r--r--indra/newview/llviewerassetupload.cpp168
-rw-r--r--indra/newview/llviewerassetupload.h6
-rw-r--r--indra/newview/llviewerattachmenu.cpp158
-rw-r--r--indra/newview/llviewerattachmenu.h14
-rw-r--r--indra/newview/llvieweraudio.cpp884
-rw-r--r--indra/newview/llvieweraudio.h88
-rw-r--r--indra/newview/llviewercamera.cpp1364
-rw-r--r--indra/newview/llviewercamera.h156
-rw-r--r--indra/newview/llviewerchat.cpp396
-rw-r--r--indra/newview/llviewerchat.h34
-rw-r--r--indra/newview/llviewercontrol.cpp476
-rw-r--r--indra/newview/llviewercontrol.h12
-rw-r--r--indra/newview/llviewercontrollistener.cpp298
-rw-r--r--indra/newview/llviewercontrollistener.h22
-rw-r--r--indra/newview/llviewerdisplay.cpp2438
-rw-r--r--indra/newview/llviewerdisplay.h16
-rw-r--r--indra/newview/llviewerdisplayname.cpp248
-rw-r--r--indra/newview/llviewerdisplayname.h36
-rw-r--r--indra/newview/llviewerfloaterreg.cpp418
-rw-r--r--indra/newview/llviewerfloaterreg.h12
-rw-r--r--indra/newview/llviewerfoldertype.cpp476
-rw-r--r--indra/newview/llviewerfoldertype.h30
-rw-r--r--indra/newview/llviewergenericmessage.cpp96
-rw-r--r--indra/newview/llviewergenericmessage.h14
-rw-r--r--indra/newview/llviewergesture.cpp218
-rw-r--r--indra/newview/llviewergesture.h56
-rw-r--r--indra/newview/llviewerhelp.cpp136
-rw-r--r--indra/newview/llviewerhelp.h34
-rw-r--r--indra/newview/llviewerhelputil.cpp46
-rw-r--r--indra/newview/llviewerhelputil.h14
-rw-r--r--indra/newview/llviewerhome.cpp64
-rw-r--r--indra/newview/llviewerhome.h18
-rw-r--r--indra/newview/llviewerinput.cpp1136
-rw-r--r--indra/newview/llviewerinput.h146
-rw-r--r--indra/newview/llviewerinventory.cpp2370
-rw-r--r--indra/newview/llviewerinventory.h492
-rw-r--r--indra/newview/llviewerjoint.cpp198
-rw-r--r--indra/newview/llviewerjoint.h38
-rw-r--r--indra/newview/llviewerjointattachment.cpp660
-rw-r--r--indra/newview/llviewerjointattachment.h132
-rw-r--r--indra/newview/llviewerjointmesh.cpp736
-rw-r--r--indra/newview/llviewerjointmesh.h50
-rw-r--r--indra/newview/llviewerjoystick.cpp1842
-rw-r--r--indra/newview/llviewerjoystick.h124
-rw-r--r--indra/newview/llviewerlayer.cpp104
-rw-r--r--indra/newview/llviewerlayer.h26
-rw-r--r--indra/newview/llviewermedia.cpp4444
-rw-r--r--indra/newview/llviewermedia.h810
-rw-r--r--indra/newview/llviewermedia_streamingaudio.cpp168
-rw-r--r--indra/newview/llviewermedia_streamingaudio.h40
-rw-r--r--indra/newview/llviewermediafocus.cpp870
-rw-r--r--indra/newview/llviewermediafocus.h142
-rw-r--r--indra/newview/llviewermediaobserver.h46
-rw-r--r--indra/newview/llviewermenu.cpp12022
-rw-r--r--indra/newview/llviewermenu.h56
-rw-r--r--indra/newview/llviewermenufile.cpp1416
-rw-r--r--indra/newview/llviewermenufile.h76
-rw-r--r--indra/newview/llviewermessage.cpp10514
-rw-r--r--indra/newview/llviewermessage.h166
-rw-r--r--indra/newview/llviewernetwork.cpp950
-rw-r--r--indra/newview/llviewernetwork.h358
-rw-r--r--indra/newview/llviewerobject.cpp10026
-rw-r--r--indra/newview/llviewerobject.h1426
-rw-r--r--indra/newview/llviewerobjectlist.cpp3044
-rw-r--r--indra/newview/llviewerobjectlist.h362
-rw-r--r--indra/newview/llvieweroctree.cpp1718
-rw-r--r--indra/newview/llvieweroctree.h512
-rw-r--r--indra/newview/llviewerparcelaskplay.cpp12
-rw-r--r--indra/newview/llviewerparcelaskplay.h8
-rw-r--r--indra/newview/llviewerparcelmedia.cpp934
-rw-r--r--indra/newview/llviewerparcelmedia.h80
-rw-r--r--indra/newview/llviewerparcelmediaautoplay.cpp208
-rw-r--r--indra/newview/llviewerparcelmediaautoplay.h24
-rw-r--r--indra/newview/llviewerparcelmgr.cpp3636
-rw-r--r--indra/newview/llviewerparcelmgr.h546
-rwxr-xr-xindra/newview/llviewerparceloverlay.cpp1600
-rw-r--r--indra/newview/llviewerparceloverlay.h166
-rw-r--r--indra/newview/llviewerpartsim.cpp1388
-rw-r--r--indra/newview/llviewerpartsim.h222
-rw-r--r--indra/newview/llviewerpartsource.cpp1468
-rw-r--r--indra/newview/llviewerpartsource.h180
-rw-r--r--indra/newview/llviewerprecompiledheaders.h10
-rwxr-xr-xindra/newview/llviewerregion.cpp4306
-rw-r--r--indra/newview/llviewerregion.h894
-rw-r--r--indra/newview/llviewershadermgr.cpp2748
-rw-r--r--indra/newview/llviewershadermgr.h350
-rw-r--r--indra/newview/llviewerstats.cpp1072
-rw-r--r--indra/newview/llviewerstats.h416
-rw-r--r--indra/newview/llviewerstatsrecorder.cpp324
-rw-r--r--indra/newview/llviewerstatsrecorder.h160
-rw-r--r--indra/newview/llviewertexlayer.cpp344
-rw-r--r--indra/newview/llviewertexlayer.h134
-rw-r--r--indra/newview/llviewertexteditor.cpp1944
-rw-r--r--indra/newview/llviewertexteditor.h192
-rw-r--r--indra/newview/llviewertexture.cpp5418
-rw-r--r--indra/newview/llviewertexture.h1128
-rw-r--r--indra/newview/llviewertextureanim.cpp376
-rw-r--r--indra/newview/llviewertextureanim.h50
-rw-r--r--indra/newview/llviewertexturelist.cpp2080
-rw-r--r--indra/newview/llviewertexturelist.h312
-rw-r--r--indra/newview/llviewerthrottle.cpp378
-rw-r--r--indra/newview/llviewerthrottle.h68
-rw-r--r--indra/newview/llviewerwearable.cpp894
-rw-r--r--indra/newview/llviewerwearable.h96
-rw-r--r--indra/newview/llviewerwindow.cpp8848
-rw-r--r--indra/newview/llviewerwindow.h890
-rw-r--r--indra/newview/llviewerwindowlistener.cpp20
-rw-r--r--indra/newview/llviewerwindowlistener.h10
-rw-r--r--indra/newview/llvlcomposition.cpp788
-rw-r--r--indra/newview/llvlcomposition.h84
-rw-r--r--indra/newview/llvlmanager.cpp176
-rw-r--r--indra/newview/llvlmanager.h52
-rw-r--r--indra/newview/llvoavatar.cpp14440
-rw-r--r--indra/newview/llvoavatar.h1438
-rw-r--r--indra/newview/llvoavatarself.cpp4108
-rw-r--r--indra/newview/llvoavatarself.h428
-rw-r--r--indra/newview/llvocache.cpp2324
-rw-r--r--indra/newview/llvocache.h416
-rw-r--r--indra/newview/llvograss.cpp1462
-rw-r--r--indra/newview/llvograss.h168
-rw-r--r--indra/newview/llvoicecallhandler.cpp72
-rw-r--r--indra/newview/llvoicechannel.cpp1266
-rw-r--r--indra/newview/llvoicechannel.h272
-rw-r--r--indra/newview/llvoiceclient.cpp1130
-rw-r--r--indra/newview/llvoiceclient.h812
-rw-r--r--indra/newview/llvoicevisualizer.cpp810
-rw-r--r--indra/newview/llvoicevisualizer.h198
-rw-r--r--indra/newview/llvoicevivox.cpp8218
-rw-r--r--indra/newview/llvoicevivox.h1660
-rw-r--r--indra/newview/llvoinventorylistener.cpp42
-rw-r--r--indra/newview/llvoinventorylistener.h46
-rw-r--r--indra/newview/llvopartgroup.cpp1390
-rw-r--r--indra/newview/llvopartgroup.h144
-rw-r--r--indra/newview/llvosky.cpp1438
-rw-r--r--indra/newview/llvosky.h442
-rw-r--r--indra/newview/llvosurfacepatch.cpp1696
-rw-r--r--indra/newview/llvosurfacepatch.h178
-rw-r--r--indra/newview/llvotree.cpp1998
-rw-r--r--indra/newview/llvotree.h306
-rw-r--r--indra/newview/llvovolume.cpp8274
-rw-r--r--indra/newview/llvovolume.h596
-rw-r--r--indra/newview/llvowater.cpp322
-rw-r--r--indra/newview/llvowater.h76
-rw-r--r--indra/newview/llvowlsky.cpp714
-rw-r--r--indra/newview/llvowlsky.h78
-rw-r--r--indra/newview/llwatchdog.cpp266
-rw-r--r--indra/newview/llwatchdog.h92
-rw-r--r--indra/newview/llwearableitemslist.cpp1288
-rw-r--r--indra/newview/llwearableitemslist.h508
-rw-r--r--indra/newview/llwearablelist.cpp386
-rw-r--r--indra/newview/llwearablelist.h48
-rw-r--r--indra/newview/llweb.cpp286
-rw-r--r--indra/newview/llweb.h54
-rw-r--r--indra/newview/llwebprofile.cpp28
-rw-r--r--indra/newview/llwebprofile.h28
-rw-r--r--indra/newview/llwind.cpp354
-rw-r--r--indra/newview/llwind.h42
-rw-r--r--indra/newview/llwindebug.cpp240
-rw-r--r--indra/newview/llwindebug.h22
-rw-r--r--indra/newview/llwindowlistener.cpp746
-rw-r--r--indra/newview/llwindowlistener.h36
-rw-r--r--indra/newview/llwldaycycle.cpp422
-rw-r--r--indra/newview/llwldaycycle.h122
-rw-r--r--indra/newview/llwlhandlers.cpp114
-rw-r--r--indra/newview/llwlhandlers.h22
-rw-r--r--indra/newview/llworld.cpp2006
-rw-r--r--indra/newview/llworld.h206
-rw-r--r--indra/newview/llworldmap.cpp846
-rw-r--r--indra/newview/llworldmap.h374
-rw-r--r--indra/newview/llworldmapmessage.cpp380
-rw-r--r--indra/newview/llworldmapmessage.h74
-rwxr-xr-xindra/newview/llworldmapview.cpp2704
-rw-r--r--indra/newview/llworldmapview.h256
-rw-r--r--indra/newview/llworldmipmap.cpp336
-rw-r--r--indra/newview/llworldmipmap.h80
-rw-r--r--indra/newview/llxmlrpclistener.cpp68
-rw-r--r--indra/newview/llxmlrpclistener.h10
-rw-r--r--indra/newview/llxmlrpctransaction.cpp632
-rw-r--r--indra/newview/llxmlrpctransaction.h182
-rw-r--r--indra/newview/macmain.h32
-rw-r--r--indra/newview/macutil_Prefix.h14
-rw-r--r--indra/newview/macview_Prefix.h20
-rw-r--r--indra/newview/noise.cpp68
-rw-r--r--indra/newview/noise.h416
-rw-r--r--indra/newview/pipeline.cpp12194
-rw-r--r--indra/newview/pipeline.h1516
-rw-r--r--indra/newview/res/resource.h12
-rw-r--r--indra/newview/roles_constants.h214
-rw-r--r--indra/newview/tests/cppfeatures_test.cpp244
-rw-r--r--indra/newview/tests/llagentaccess_test.cpp338
-rw-r--r--indra/newview/tests/lldateutil_test.cpp270
-rw-r--r--indra/newview/tests/lldir_stub.cpp16
-rw-r--r--indra/newview/tests/llglslshader_stub.cpp10
-rw-r--r--indra/newview/tests/llhttpretrypolicy_test.cpp486
-rw-r--r--indra/newview/tests/lllogininstance_test.cpp444
-rw-r--r--indra/newview/tests/llmediadataclient_test.cpp1594
-rw-r--r--indra/newview/tests/llpipeline_stub.cpp10
-rw-r--r--indra/newview/tests/llremoteparcelrequest_test.cpp90
-rw-r--r--indra/newview/tests/llsecapi_test.cpp106
-rw-r--r--indra/newview/tests/llsechandler_basic_test.cpp1572
-rw-r--r--indra/newview/tests/llsky_stub.cpp12
-rw-r--r--indra/newview/tests/llslurl_test.cpp496
-rw-r--r--indra/newview/tests/lltextureinfo_test.cpp454
-rw-r--r--indra/newview/tests/lltextureinfodetails_test.cpp76
-rw-r--r--indra/newview/tests/lltexturestatsuploader_test.cpp178
-rw-r--r--indra/newview/tests/llversioninfo_test.cpp152
-rw-r--r--indra/newview/tests/llviewerassetstats_test.cpp880
-rw-r--r--indra/newview/tests/llviewercontrollistener_test.cpp2
-rw-r--r--indra/newview/tests/llviewerhelputil_test.cpp170
-rw-r--r--indra/newview/tests/llviewernetwork_test.cpp708
-rw-r--r--indra/newview/tests/llvieweroctree_stub.cpp10
-rw-r--r--indra/newview/tests/llviewershadermgr_stub.cpp20
-rw-r--r--indra/newview/tests/llviewertexture_stub.cpp10
-rw-r--r--indra/newview/tests/llwlanimator_stub.cpp10
-rw-r--r--indra/newview/tests/llwldaycycle_stub.cpp16
-rw-r--r--indra/newview/tests/llwlparammanager_test.cpp414
-rw-r--r--indra/newview/tests/llwlparamset_stub.cpp10
-rw-r--r--indra/newview/tests/llworldmap_test.cpp862
-rw-r--r--indra/newview/tests/llworldmipmap_test.cpp216
-rw-r--r--indra/newview/tests/llxmlrpclistener_test.cpp10
-rwxr-xr-xindra/newview/viewer_manifest.py24
1539 files changed, 342449 insertions, 342449 deletions
diff --git a/indra/newview/VertexCache.h b/indra/newview/VertexCache.h
index 0eadad7e01..edb231feb1 100644
--- a/indra/newview/VertexCache.h
+++ b/indra/newview/VertexCache.h
@@ -1,99 +1,99 @@
-/**
+/**
* @file VertexCache.h
* @brief VertexCache class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
#ifndef VERTEX_CACHE_H
#define VERTEX_CACHE_H
class VertexCache
{
-
+
public:
-
- VertexCache(int size)
- {
- numEntries = size;
-
- entries = new int[numEntries];
-
- for(int i = 0; i < numEntries; i++)
- entries[i] = -1;
- }
-
- VertexCache() { VertexCache(16); }
- ~VertexCache() { delete[] entries; entries = 0; }
-
- bool InCache(int entry)
- {
- bool returnVal = false;
- for(int i = 0; i < numEntries; i++)
- {
- if(entries[i] == entry)
- {
- returnVal = true;
- break;
- }
- }
-
- return returnVal;
- }
-
- int AddEntry(int entry)
- {
- int removed;
-
- removed = entries[numEntries - 1];
-
- //push everything right one
- for(int i = numEntries - 2; i >= 0; i--)
- {
- entries[i + 1] = entries[i];
- }
-
- entries[0] = entry;
-
- return removed;
- }
-
- void Clear()
- {
- memset(entries, -1, sizeof(int) * numEntries);
- }
-
- void Copy(VertexCache* inVcache)
- {
- for(int i = 0; i < numEntries; i++)
- {
- inVcache->Set(i, entries[i]);
- }
- }
-
- int At(int index) { return entries[index]; }
- void Set(int index, int value) { entries[index] = value; }
+
+ VertexCache(int size)
+ {
+ numEntries = size;
+
+ entries = new int[numEntries];
+
+ for(int i = 0; i < numEntries; i++)
+ entries[i] = -1;
+ }
+
+ VertexCache() { VertexCache(16); }
+ ~VertexCache() { delete[] entries; entries = 0; }
+
+ bool InCache(int entry)
+ {
+ bool returnVal = false;
+ for(int i = 0; i < numEntries; i++)
+ {
+ if(entries[i] == entry)
+ {
+ returnVal = true;
+ break;
+ }
+ }
+
+ return returnVal;
+ }
+
+ int AddEntry(int entry)
+ {
+ int removed;
+
+ removed = entries[numEntries - 1];
+
+ //push everything right one
+ for(int i = numEntries - 2; i >= 0; i--)
+ {
+ entries[i + 1] = entries[i];
+ }
+
+ entries[0] = entry;
+
+ return removed;
+ }
+
+ void Clear()
+ {
+ memset(entries, -1, sizeof(int) * numEntries);
+ }
+
+ void Copy(VertexCache* inVcache)
+ {
+ for(int i = 0; i < numEntries; i++)
+ {
+ inVcache->Set(i, entries[i]);
+ }
+ }
+
+ int At(int index) { return entries[index]; }
+ void Set(int index, int value) { entries[index] = value; }
private:
diff --git a/indra/newview/VorbisFramework.h b/indra/newview/VorbisFramework.h
index 874a22fc30..7ee9a8c411 100644
--- a/indra/newview/VorbisFramework.h
+++ b/indra/newview/VorbisFramework.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file VorbisFramework.h
* @author Dave Camp
* @date Fri Oct 10 2003
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,10 +37,10 @@ extern "C" {
extern int mac_vorbis_analysis(vorbis_block *vb,ogg_packet *op);
extern int mac_vorbis_analysis_headerout(vorbis_dsp_state *v,
- vorbis_comment *vc,
- ogg_packet *op,
- ogg_packet *op_comm,
- ogg_packet *op_code);
+ vorbis_comment *vc,
+ ogg_packet *op,
+ ogg_packet *op_comm,
+ ogg_packet *op_code);
extern int mac_vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
@@ -49,12 +49,12 @@ extern int mac_vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
extern int mac_vorbis_encode_setup_init(vorbis_info *vi);
extern int mac_vorbis_encode_setup_managed(vorbis_info *vi,
- long channels,
- long rate,
-
- long max_bitrate,
- long nominal_bitrate,
- long min_bitrate);
+ long channels,
+ long rate,
+
+ long max_bitrate,
+ long nominal_bitrate,
+ long min_bitrate);
extern void mac_vorbis_info_init(vorbis_info *vi);
extern void mac_vorbis_info_clear(vorbis_info *vi);
@@ -67,7 +67,7 @@ extern float **mac_vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
extern int mac_vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
extern int mac_vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
-extern int mac_ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
+extern int mac_ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
extern int mac_ogg_stream_init(ogg_stream_state *os,int serialno);
extern int mac_ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
extern int mac_ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl
index b631ecb7d2..ad9240a6af 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl
@@ -1,34 +1,34 @@
-/**
+/**
* @file avatarF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
void default_lighting();
-void main()
+void main()
{
- default_lighting();
+ default_lighting();
}
-
+
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
index 374469ce2f..cdf661893c 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file avatarSkinV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
in vec4 weight;
@@ -30,20 +30,20 @@ uniform vec4 matrixPalette[45];
mat4 getSkinnedTransform()
{
- mat4 ret;
- int i = int(floor(weight.x));
- float x = fract(weight.x);
-
- ret[0] = mix(matrixPalette[i+0], matrixPalette[i+1], x);
- ret[1] = mix(matrixPalette[i+15],matrixPalette[i+16], x);
- ret[2] = mix(matrixPalette[i+30],matrixPalette[i+31], x);
- ret[3] = vec4(0,0,0,1);
+ mat4 ret;
+ int i = int(floor(weight.x));
+ float x = fract(weight.x);
+
+ ret[0] = mix(matrixPalette[i+0], matrixPalette[i+1], x);
+ ret[1] = mix(matrixPalette[i+15],matrixPalette[i+16], x);
+ ret[2] = mix(matrixPalette[i+30],matrixPalette[i+31], x);
+ ret[3] = vec4(0,0,0,1);
- return ret;
+ return ret;
#ifdef IS_AMD_CARD
- // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
- vec4 dummy1 = matrixPalette[0];
- vec4 dummy2 = matrixPalette[44];
+ // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
+ vec4 dummy1 = matrixPalette[0];
+ vec4 dummy2 = matrixPalette[44];
#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
index 9adc68e62b..1c3fdfe2a2 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file avatarV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,30 +40,30 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
- vary_texcoord0 = texcoord0;
-
- vec4 pos;
- vec3 norm;
-
- vec4 pos_in = vec4(position.xyz, 1.0);
-
- mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], pos_in);
- pos.y = dot(trans[1], pos_in);
- pos.z = dot(trans[2], pos_in);
- pos.w = 1.0;
-
- norm.x = dot(trans[0].xyz, normal);
- norm.y = dot(trans[1].xyz, normal);
- norm.z = dot(trans[2].xyz, normal);
- norm = normalize(norm);
-
- gl_Position = projection_matrix * pos;
-
- calcAtmospherics(pos.xyz);
-
- vec4 col = calcLighting(pos.xyz, norm, color);
- vertex_color = col;
+ vary_texcoord0 = texcoord0;
+
+ vec4 pos;
+ vec3 norm;
+
+ vec4 pos_in = vec4(position.xyz, 1.0);
+
+ mat4 trans = getSkinnedTransform();
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
+ pos.w = 1.0;
+
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
+ norm = normalize(norm);
+
+ gl_Position = projection_matrix * pos;
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 col = calcLighting(pos.xyz, norm, color);
+ vertex_color = col;
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl
index 4296e551db..57d3695dcd 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl
@@ -1,34 +1,34 @@
-/**
+/**
* @file eyeballF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
void default_lighting();
-void main()
+void main()
{
- default_lighting();
+ default_lighting();
}
-
+
diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
index 837074f08c..df05473b04 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file eyeballV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,19 +41,19 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
- //transform vertex
- vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
-
- vec3 norm = normalize(normal_matrix * normal);
-
- calcAtmospherics(pos.xyz);
-
- vec4 specular = vec4(1.0);
- vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular);
- vertex_color = color;
+ //transform vertex
+ vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+
+ vec3 norm = normalize(normal_matrix * normal);
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 specular = vec4(1.0);
+ vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular);
+ vertex_color = color;
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
index 0817076dd5..67f84ecaec 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
@@ -1,66 +1,66 @@
-/**
+/**
* @file objectSkinV.glsl
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-in vec4 weight4;
+in vec4 weight4;
uniform mat3x4 matrixPalette[MAX_JOINTS_PER_MESH_OBJECT];
mat4 getObjectSkinnedTransform()
{
- int i;
-
- vec4 w = fract(weight4);
- vec4 index = floor(weight4);
-
+ int i;
+
+ vec4 w = fract(weight4);
+ vec4 index = floor(weight4);
+
index = min(index, vec4(MAX_JOINTS_PER_MESH_OBJECT-1));
index = max(index, vec4( 0.0));
w *= 1.0/(w.x+w.y+w.z+w.w);
-
- int i1 = int(index.x);
- int i2 = int(index.y);
- int i3 = int(index.z);
- int i4 = int(index.w);
- mat3 mat = mat3(matrixPalette[i1])*w.x;
- mat += mat3(matrixPalette[i2])*w.y;
- mat += mat3(matrixPalette[i3])*w.z;
- mat += mat3(matrixPalette[i4])*w.w;
+ int i1 = int(index.x);
+ int i2 = int(index.y);
+ int i3 = int(index.z);
+ int i4 = int(index.w);
+
+ mat3 mat = mat3(matrixPalette[i1])*w.x;
+ mat += mat3(matrixPalette[i2])*w.y;
+ mat += mat3(matrixPalette[i3])*w.z;
+ mat += mat3(matrixPalette[i4])*w.w;
+
+ vec3 trans = vec3(matrixPalette[i1][0].w,matrixPalette[i1][1].w,matrixPalette[i1][2].w)*w.x;
+ trans += vec3(matrixPalette[i2][0].w,matrixPalette[i2][1].w,matrixPalette[i2][2].w)*w.y;
+ trans += vec3(matrixPalette[i3][0].w,matrixPalette[i3][1].w,matrixPalette[i3][2].w)*w.z;
+ trans += vec3(matrixPalette[i4][0].w,matrixPalette[i4][1].w,matrixPalette[i4][2].w)*w.w;
- vec3 trans = vec3(matrixPalette[i1][0].w,matrixPalette[i1][1].w,matrixPalette[i1][2].w)*w.x;
- trans += vec3(matrixPalette[i2][0].w,matrixPalette[i2][1].w,matrixPalette[i2][2].w)*w.y;
- trans += vec3(matrixPalette[i3][0].w,matrixPalette[i3][1].w,matrixPalette[i3][2].w)*w.z;
- trans += vec3(matrixPalette[i4][0].w,matrixPalette[i4][1].w,matrixPalette[i4][2].w)*w.w;
+ mat4 ret;
- mat4 ret;
+ ret[0] = vec4(mat[0], 0);
+ ret[1] = vec4(mat[1], 0);
+ ret[2] = vec4(mat[2], 0);
+ ret[3] = vec4(trans, 1.0);
- ret[0] = vec4(mat[0], 0);
- ret[1] = vec4(mat[1], 0);
- ret[2] = vec4(mat[2], 0);
- ret[3] = vec4(trans, 1.0);
-
- return ret;
+ return ret;
#ifdef IS_AMD_CARD
// If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index 4c9d813c9c..799b8767d5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file alphaV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -69,70 +69,70 @@ uniform float near_clip;
void main()
{
- vec4 pos;
- vec3 norm;
-
- //transform vertex
+ vec4 pos;
+ vec3 norm;
+
+ //transform vertex
#ifdef HAS_SKIN
- mat4 trans = getObjectSkinnedTransform();
- trans = modelview_matrix * trans;
-
- pos = trans * vec4(position.xyz, 1.0);
-
- norm = position.xyz + normal.xyz;
- norm = normalize((trans * vec4(norm, 1.0)).xyz - pos.xyz);
- vec4 frag_pos = projection_matrix * pos;
- gl_Position = frag_pos;
+ mat4 trans = getObjectSkinnedTransform();
+ trans = modelview_matrix * trans;
+
+ pos = trans * vec4(position.xyz, 1.0);
+
+ norm = position.xyz + normal.xyz;
+ norm = normalize((trans * vec4(norm, 1.0)).xyz - pos.xyz);
+ vec4 frag_pos = projection_matrix * pos;
+ gl_Position = frag_pos;
#else
#ifdef IS_AVATAR_SKIN
- mat4 trans = getSkinnedTransform();
- vec4 pos_in = vec4(position.xyz, 1.0);
- pos.x = dot(trans[0], pos_in);
- pos.y = dot(trans[1], pos_in);
- pos.z = dot(trans[2], pos_in);
- pos.w = 1.0;
-
- norm.x = dot(trans[0].xyz, normal);
- norm.y = dot(trans[1].xyz, normal);
- norm.z = dot(trans[2].xyz, normal);
- norm = normalize(norm);
-
- vec4 frag_pos = projection_matrix * pos;
- gl_Position = frag_pos;
+ mat4 trans = getSkinnedTransform();
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
+ pos.w = 1.0;
+
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
+ norm = normalize(norm);
+
+ vec4 frag_pos = projection_matrix * pos;
+ gl_Position = frag_pos;
#else
- norm = normalize(normal_matrix * normal);
- vec4 vert = vec4(position.xyz, 1.0);
- pos = (modelview_matrix * vert);
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ norm = normalize(normal_matrix * normal);
+ vec4 vert = vec4(position.xyz, 1.0);
+ pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
#endif //IS_AVATAR_SKIN
-
+
#endif // HAS_SKIN
#ifdef USE_INDEXED_TEX
- passTextureIndex();
+ passTextureIndex();
#endif
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- vary_norm = norm;
- vary_position = pos.xyz;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ vary_norm = norm;
+ vary_position = pos.xyz;
#ifdef USE_VERTEX_COLOR
- vertex_color = diffuse_color;
+ vertex_color = diffuse_color;
#endif
-
+
#ifdef HAS_SKIN
- vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
+ vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
#else
#ifdef IS_AVATAR_SKIN
- vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
+ vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
#else
- pos = modelview_projection_matrix * vert;
- vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
+ pos = modelview_projection_matrix * vert;
+ vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
#endif
-
+
#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl
index da467cd5da..49470f0e39 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1/deferred/aoUtil.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -70,7 +70,7 @@ vec2 getKern(int i)
kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
-
+
return kern[i] / screen_res;
}
@@ -83,33 +83,33 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen)
float angle_hidden = 0.0;
float points = 0;
-
+
float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
-
+
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
for (int i = 0; i < 8; i++)
{
vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect);
- vec3 samppos_world = getPositionAo(samppos_screen).xyz;
+ vec3 samppos_world = getPositionAo(samppos_screen).xyz;
vec3 diff = pos_world - samppos_world;
float dist2 = dot(diff, diff);
-
+
// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area
// --> solid angle shrinking by the square of distance
//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2
//(k should vary inversely with # of samples, but this is taken care of later)
-
+
float funky_val = (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) ? 1.0 : 0.0;
angle_hidden = angle_hidden + funky_val * min(1.0/dist2, ssao_factor_inv);
-
- // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"
+
+ // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"
float diffz_val = (diff.z > -1.0) ? 1.0 : 0.0;
points = points + diffz_val;
}
-
+
angle_hidden = min(ssao_factor*angle_hidden/points, 1.0);
-
+
float points_val = (points > 0.0) ? 1.0 : 0.0;
ret = (1.0 - (points_val * angle_hidden));
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl
index f1dc1159d0..f1e0295859 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file avatarAlphaMaskShadowF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,22 +32,22 @@ in float target_pos_x;
in float pos_w;
in vec2 vary_texcoord0;
-void main()
+void main()
{
- float alpha = texture(diffuseMap, vary_texcoord0.xy).a;
+ float alpha = texture(diffuseMap, vary_texcoord0.xy).a;
- if (alpha < 0.05) // treat as totally transparent
- {
- discard;
- }
+ if (alpha < 0.05) // treat as totally transparent
+ {
+ discard;
+ }
- if (alpha < minimum_alpha)
- {
- if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25)
- {
- discard;
- }
- }
+ if (alpha < minimum_alpha)
+ {
+ if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25)
+ {
+ discard;
+ }
+ }
- frag_color = vec4(1,1,1,1);
+ frag_color = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl
index 097e28aa0c..18ce998cb6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file avatarAlphaShadowF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,22 +34,22 @@ in float target_pos_x;
in vec2 vary_texcoord0;
uniform vec4 color;
-void main()
+void main()
{
- float alpha = texture(diffuseMap, vary_texcoord0.xy).a * color.a;
-
- if (alpha < 0.05) // treat as totally transparent
- {
- discard;
- }
-
- if (alpha < minimum_alpha) // treat as semi-transparent
- {
- if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25)
- {
- discard;
- }
- }
-
- frag_color = vec4(1,1,1,1);
+ float alpha = texture(diffuseMap, vary_texcoord0.xy).a * color.a;
+
+ if (alpha < 0.05) // treat as totally transparent
+ {
+ discard;
+ }
+
+ if (alpha < minimum_alpha) // treat as semi-transparent
+ {
+ if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25)
+ {
+ discard;
+ }
+ }
+
+ frag_color = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl
index 57e0b2b59f..8d32dab911 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file avatarAlphaShadowV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
uniform mat4 texture_matrix0;
uniform mat4 projection_matrix;
uniform float shadow_target_width;
@@ -40,31 +40,31 @@ out vec2 vary_texcoord0;
void main()
{
- vec4 pos;
- vec3 norm;
-
- vec4 pos_in = vec4(position.xyz, 1.0);
- mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], pos_in);
- pos.y = dot(trans[1], pos_in);
- pos.z = dot(trans[2], pos_in);
- pos.w = 1.0;
-
- norm.x = dot(trans[0].xyz, normal);
- norm.y = dot(trans[1].xyz, normal);
- norm.z = dot(trans[2].xyz, normal);
- norm = normalize(norm);
-
- pos = projection_matrix * pos;
+ vec4 pos;
+ vec3 norm;
+
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ mat4 trans = getSkinnedTransform();
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
+ pos.w = 1.0;
+
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
+ norm = normalize(norm);
+
+ pos = projection_matrix * pos;
- target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x;
+ target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x;
- pos_w = pos.w;
+ pos_w = pos.w;
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
- gl_Position = pos;
+ gl_Position = pos;
- passTextureIndex();
+ passTextureIndex();
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
index 83b0ba096c..d9a6c9e5f1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file avatarEyesV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,11 +38,11 @@ out vec2 vary_texcoord0;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- vary_normal = normalize(normal_matrix * normal);
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ vary_normal = normalize(normal_matrix * normal);
- vertex_color = diffuse_color;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
index 6ebe4ce251..63d8e12e62 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file avatarF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,18 +36,18 @@ in vec2 vary_texcoord0;
vec2 encode_normal(vec3 n);
-void main()
+void main()
{
- vec4 diff = texture(diffuseMap, vary_texcoord0.xy);
-
- if (diff.a < minimum_alpha)
- {
- discard;
- }
-
- frag_data[0] = vec4(diff.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0);
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
+ vec4 diff = texture(diffuseMap, vary_texcoord0.xy);
+
+ if (diff.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ frag_data[0] = vec4(diff.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0);
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
index 0c386ade6c..438e1d1b33 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
@@ -1,36 +1,36 @@
-/**
+/**
* @file avatarShadowF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-/*[EXTRA_CODE_HERE]*/
+/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
uniform sampler2D diffuseMap;
-void main()
+void main()
{
- frag_color = vec4(1,1,1,1);
+ frag_color = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
index 5c64d48399..95db062203 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file avatarShadowV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
uniform mat4 projection_matrix;
mat4 getSkinnedTransform();
@@ -33,23 +33,23 @@ in vec2 texcoord0;
void main()
{
- vec4 pos;
- vec3 norm;
-
- vec4 pos_in = vec4(position.xyz, 1.0);
- mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], pos_in);
- pos.y = dot(trans[1], pos_in);
- pos.z = dot(trans[2], pos_in);
- pos.w = 1.0;
-
- norm.x = dot(trans[0].xyz, normal);
- norm.y = dot(trans[1].xyz, normal);
- norm.z = dot(trans[2].xyz, normal);
- norm = normalize(norm);
-
- pos = projection_matrix * pos;
- gl_Position = pos;
+ vec4 pos;
+ vec3 norm;
+
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ mat4 trans = getSkinnedTransform();
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
+ pos.w = 1.0;
+
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
+ norm = normalize(norm);
+
+ pos = projection_matrix * pos;
+ gl_Position = pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
index bc0c11ec46..74d16592de 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file avatarV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
uniform mat4 projection_matrix;
in vec3 position;
@@ -38,26 +38,26 @@ out vec2 vary_texcoord0;
void main()
{
- vary_texcoord0 = texcoord0;
-
- vec4 pos;
- vec3 norm;
-
- vec4 pos_in = vec4(position.xyz, 1.0);
- mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], pos_in);
- pos.y = dot(trans[1], pos_in);
- pos.z = dot(trans[2], pos_in);
- pos.w = 1.0;
-
- norm.x = dot(trans[0].xyz, normal);
- norm.y = dot(trans[1].xyz, normal);
- norm.z = dot(trans[2].xyz, normal);
- norm = normalize(norm);
-
- vary_normal = norm;
-
- gl_Position = projection_matrix * pos;
+ vary_texcoord0 = texcoord0;
+
+ vec4 pos;
+ vec3 norm;
+
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ mat4 trans = getSkinnedTransform();
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
+ pos.w = 1.0;
+
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
+ norm = normalize(norm);
+
+ vary_normal = norm;
+
+ gl_Position = projection_matrix * pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
index 08baf98686..19fc660c2d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file blurLightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,16 +42,16 @@ in vec2 vary_fragcoord;
vec4 getPosition(vec2 pos_screen);
vec3 getNorm(vec2 pos_screen);
-void main()
+void main()
{
vec2 tc = vary_fragcoord.xy;
vec3 norm = getNorm(tc);
vec3 pos = getPosition(tc).xyz;
vec4 ccol = texture(lightMap, tc).rgba;
-
+
vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy);
dlt /= max(-pos.z*dist_factor, 1.0);
-
+
vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
vec4 col = defined_weight.xyxx * ccol;
@@ -75,15 +75,15 @@ void main()
k[1] = (k[0]+k[2])*0.5f;
k[3] = (k[2]+k[4])*0.5f;
k[5] = (k[4]+k[6])*0.5f;
-
+
for (int i = 1; i < 7; i++)
{
vec2 samptc = tc + k[i].z*dlt*2.0;
samptc /= screen_res;
- vec3 samppos = getPosition(samptc).xyz;
+ vec3 samppos = getPosition(samptc).xyz;
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
-
+
if (d*d <= pointplanedist_tolerance_pow2)
{
col += texture(lightMap, samptc)*k[i].xyxx;
@@ -95,10 +95,10 @@ void main()
{
vec2 samptc = tc - k[i].z*dlt*2.0;
samptc /= screen_res;
- vec3 samppos = getPosition(samptc).xyz;
+ vec3 samppos = getPosition(samptc).xyz;
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
-
+
if (d*d <= pointplanedist_tolerance_pow2)
{
col += texture(lightMap, samptc)*k[i].xyxx;
@@ -108,7 +108,7 @@ void main()
col /= defined_weight.xyxx;
//col.y *= col.y;
-
+
frag_color = max(col, vec4(0));
#ifdef IS_AMD_CARD
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
index 5abaa1f2a6..969fbc5a7d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file blurLightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,8 +30,8 @@ uniform vec2 screen_res;
void main()
{
- //transform vertex
- vec4 pos = vec4(position.xyz, 1.0);
- gl_Position = pos;
- vary_fragcoord = (pos.xy*0.5+0.5);
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
+ gl_Position = pos;
+ vary_fragcoord = (pos.xy*0.5+0.5);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
index 35f483f633..11deecafbb 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
@@ -1,30 +1,30 @@
-/**
+/**
* @file bumpF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/*[EXTRA_CODE_HERE]*/
-
+
out vec4 frag_data[4];
uniform float minimum_alpha;
@@ -40,26 +40,26 @@ in vec2 vary_texcoord0;
vec2 encode_normal(vec3 n);
-void main()
+void main()
{
- vec4 col = texture(diffuseMap, vary_texcoord0.xy);
-
- if(col.a < minimum_alpha)
- {
- discard;
- }
- col *= vertex_color;
-
- vec3 norm = texture(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy);
+
+ if(col.a < minimum_alpha)
+ {
+ discard;
+ }
+ col *= vertex_color;
+
+ vec3 norm = texture(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
+
+ vec3 tnorm = vec3(dot(norm,vary_mat0),
+ dot(norm,vary_mat1),
+ dot(norm,vary_mat2));
- vec3 tnorm = vec3(dot(norm,vary_mat0),
- dot(norm,vary_mat1),
- dot(norm,vary_mat2));
-
- frag_data[0] = vec4(col.rgb, 0.0);
- frag_data[1] = vertex_color.aaaa; // spec
- //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
- vec3 nvn = normalize(tnorm);
- frag_data[2] = vec4(encode_normal(nvn), vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[0] = vec4(col.rgb, 0.0);
+ frag_data[1] = vertex_color.aaaa; // spec
+ //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
+ vec3 nvn = normalize(tnorm);
+ frag_data[2] = vec4(encode_normal(nvn), vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
index 3af2eab1e4..4ac757be65 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file bumpV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,27 +47,27 @@ uniform mat4 modelview_matrix;
void main()
{
- //transform vertex
+ //transform vertex
#ifdef HAS_SKIN
mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
- vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- gl_Position = projection_matrix*vec4(pos, 1.0);
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
+ gl_Position = projection_matrix*vec4(pos, 1.0);
- vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
- vec3 t = normalize((mat * vec4(tangent.xyz+position.xyz, 1.0)).xyz-pos.xyz);
+ vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
+ vec3 t = normalize((mat * vec4(tangent.xyz+position.xyz, 1.0)).xyz-pos.xyz);
#else
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec3 n = normalize(normal_matrix * normal);
- vec3 t = normalize(normal_matrix * tangent.xyz);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vec3 n = normalize(normal_matrix * normal);
+ vec3 t = normalize(normal_matrix * tangent.xyz);
#endif
- vec3 b = cross(n, t) * tangent.w;
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vec3 b = cross(n, t) * tangent.w;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ vary_mat0 = vec3(t.x, b.x, n.x);
+ vary_mat1 = vec3(t.y, b.y, n.y);
+ vary_mat2 = vec3(t.z, b.z, n.z);
- vary_mat0 = vec3(t.x, b.x, n.x);
- vary_mat1 = vec3(t.y, b.y, n.y);
- vary_mat2 = vec3(t.z, b.z, n.z);
-
- vertex_color = diffuse_color;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
index f6870c3ff0..450d4c4c4a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file class1\deferred\cloudsF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-/*[EXTRA_CODE_HERE]*/
+/*[EXTRA_CODE_HERE]*/
out vec4 frag_data[4];
@@ -93,7 +93,7 @@ void main()
// And smooth
alpha1 = 1. - alpha1 * alpha1;
- alpha1 = 1. - alpha1 * alpha1;
+ alpha1 = 1. - alpha1 * alpha1;
alpha1 *= altitude_blend_factor;
alpha1 = clamp(alpha1, 0.0, 1.0);
@@ -105,7 +105,7 @@ void main()
// And smooth
alpha2 = 1. - alpha2;
- alpha2 = 1. - alpha2 * alpha2;
+ alpha2 = 1. - alpha2 * alpha2;
// Combine
vec3 color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
index 98314d39d3..c019b5606a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file WLCloudsV.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -75,53 +75,53 @@ uniform float cloud_scale;
// indra\newview\llsettingsvo.cpp
void main()
{
- // World / view / projection
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ // World / view / projection
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- // Texture coords
+ // Texture coords
// SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
vary_texcoord0 = vec2(-texcoord0.x, texcoord0.y); // See: LLSettingsVOSky::applySpecial
- vary_texcoord0.xy -= 0.5;
- vary_texcoord0.xy /= cloud_scale;
- vary_texcoord0.xy += 0.5;
+ vary_texcoord0.xy -= 0.5;
+ vary_texcoord0.xy /= cloud_scale;
+ vary_texcoord0.xy += 0.5;
- vary_texcoord1 = vary_texcoord0;
- vary_texcoord1.x += lightnorm.x * 0.0125;
- vary_texcoord1.y += lightnorm.z * 0.0125;
+ vary_texcoord1 = vary_texcoord0;
+ vary_texcoord1.x += lightnorm.x * 0.0125;
+ vary_texcoord1.y += lightnorm.z * 0.0125;
- vary_texcoord2 = vary_texcoord0 * 16.;
- vary_texcoord3 = vary_texcoord1 * 16.;
+ vary_texcoord2 = vary_texcoord0 * 16.;
+ vary_texcoord3 = vary_texcoord1 * 16.;
- // Get relative position
+ // Get relative position
vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);
altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0);
- // Set altitude
+ // Set altitude
if (rel_pos.y > 0)
- {
+ {
rel_pos *= (max_y / rel_pos.y);
- }
+ }
if (rel_pos.y < 0)
- {
- altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon
+ {
+ altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon
rel_pos *= (-32000. / rel_pos.y);
- }
+ }
- // Can normalize then
+ // Can normalize then
vec3 rel_pos_norm = normalize(rel_pos);
float rel_pos_len = length(rel_pos);
- // Initialize temp variables
- vec3 sunlight = sunlight_color;
- vec3 light_atten;
+ // Initialize temp variables
+ vec3 sunlight = sunlight_color;
+ vec3 light_atten;
- // Sunlight attenuation effect (hue and brightness) due to atmosphere
- // this is used later for sunlight modulation at various altitudes
+ // Sunlight attenuation effect (hue and brightness) due to atmosphere
+ // this is used later for sunlight modulation at various altitudes
light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y);
- // Calculate relative weights
+ // Calculate relative weights
vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density));
vec3 blue_weight = blue_density / combined_haze;
vec3 haze_weight = haze_density / combined_haze;
@@ -130,64 +130,64 @@ void main()
float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);
sunlight *= exp(-light_atten * off_axis);
- // Distance
+ // Distance
float density_dist = rel_pos_len * density_multiplier;
// Transparency (-> combined_haze)
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
- // compiler gets confused.
+ // compiler gets confused.
combined_haze = exp(-combined_haze * density_dist);
- // Compute haze glow
+ // Compute haze glow
float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);
// haze_glow is 0 at the sun and increases away from sun
haze_glow = max(haze_glow, .001);
- // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
+ // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
haze_glow *= glow.x;
- // Higher glow.x gives dimmer glow (because next step is 1 / "angle")
+ // Higher glow.x gives dimmer glow (because next step is 1 / "angle")
haze_glow = pow(haze_glow, glow.z);
- // glow.z should be negative, so we're doing a sort of (1 / "angle") function
+ // glow.z should be negative, so we're doing a sort of (1 / "angle") function
haze_glow *= sun_moon_glow_factor;
- // Add "minimum anti-solar illumination"
+ // Add "minimum anti-solar illumination"
// For sun, add to glow. For moon, remove glow entirely. SL-13768
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25);
- // Increase ambient when there are more clouds
- vec3 tmpAmbient = ambient_color;
- tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
+ // Increase ambient when there are more clouds
+ vec3 tmpAmbient = ambient_color;
+ tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
- // Dim sunlight by cloud shadow percentage
- sunlight *= (1. - cloud_shadow);
+ // Dim sunlight by cloud shadow percentage
+ sunlight *= (1. - cloud_shadow);
- // Haze color below cloud
+ // Haze color below cloud
vec3 additiveColorBelowCloud =
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
- // CLOUDS
+ // CLOUDS
sunlight = sunlight_color;
off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);
sunlight *= exp(-light_atten * off_axis);
- // Cloud color out
+ // Cloud color out
vary_CloudColorSun = (sunlight * haze_glow) * cloud_color;
- vary_CloudColorAmbient = tmpAmbient * cloud_color;
-
- // Attenuate cloud color by atmosphere
+ vary_CloudColorAmbient = tmpAmbient * cloud_color;
+
+ // Attenuate cloud color by atmosphere
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
vary_CloudColorSun *= combined_haze;
vary_CloudColorAmbient *= combined_haze;
vec3 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze);
- // Make a nice cloud density based on the cloud_shadow value that was passed in.
- vary_CloudDensity = 2. * (cloud_shadow - 0.25);
+ // Make a nice cloud density based on the cloud_shadow value that was passed in.
+ vary_CloudDensity = 2. * (cloud_shadow - 0.25);
- // Combine these to minimize register use
- vary_CloudColorAmbient += oHazeColorBelowCloud;
+ // Combine these to minimize register use
+ vary_CloudColorAmbient += oHazeColorBelowCloud;
- // needs this to compile on mac
- //vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
+ // needs this to compile on mac
+ //vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
- // END CLOUDS
+ // END CLOUDS
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
index d95a33a6be..0a0fa0a374 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file cofF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,35 +45,35 @@ in vec2 vary_fragcoord;
float calc_cof(float depth)
{
- float sc = (depth-focal_distance)/-depth*blur_constant;
-
- sc /= magnification;
-
- // tan_pixel_angle = pixel_length/-depth;
- float pixel_length = tan_pixel_angle*-focal_distance;
-
- sc = sc/pixel_length;
- sc *= 1.414;
-
- return sc;
+ float sc = (depth-focal_distance)/-depth*blur_constant;
+
+ sc /= magnification;
+
+ // tan_pixel_angle = pixel_length/-depth;
+ float pixel_length = tan_pixel_angle*-focal_distance;
+
+ sc = sc/pixel_length;
+ sc *= 1.414;
+
+ return sc;
}
-void main()
+void main()
{
- vec2 tc = vary_fragcoord.xy;
+ vec2 tc = vary_fragcoord.xy;
float z = texture(depthMap, tc).r;
- z = z*2.0-1.0;
- vec4 ndc = vec4(0.0, 0.0, z, 1.0);
- vec4 p = inv_proj*ndc;
- float depth = p.z/p.w;
-
- vec4 diff = texture(diffuseRect, vary_fragcoord.xy);
-
- float sc = calc_cof(depth);
- sc = min(sc, max_cof);
- sc = max(sc, -max_cof);
-
- frag_color.rgb = diff.rgb;
- frag_color.a = sc/max_cof*0.5+0.5;
+ z = z*2.0-1.0;
+ vec4 ndc = vec4(0.0, 0.0, z, 1.0);
+ vec4 p = inv_proj*ndc;
+ float depth = p.z/p.w;
+
+ vec4 diff = texture(diffuseRect, vary_fragcoord.xy);
+
+ float sc = calc_cof(depth);
+ sc = min(sc, max_cof);
+ sc = max(sc, -max_cof);
+
+ frag_color.rgb = diff.rgb;
+ frag_color.a = sc/max_cof*0.5+0.5;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index f9ebf33b4a..5ef3d63eb2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1/deferred/deferredUtil.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -385,14 +385,14 @@ vec3 pbrIbl(vec3 diffuseColor,
float perceptualRough)
{
// retrieve a scale and bias to F0. See [1], Figure 3
- vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough);
- vec3 diffuseLight = irradiance;
- vec3 specularLight = radiance;
-
- vec3 diffuse = diffuseLight * diffuseColor;
- vec3 specular = specularLight * (specularColor * brdf.x + brdf.y);
+ vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough);
+ vec3 diffuseLight = irradiance;
+ vec3 specularLight = radiance;
- return (diffuse + specular) * ao;
+ vec3 diffuse = diffuseLight * diffuseColor;
+ vec3 specular = specularLight * (specularColor * brdf.x + brdf.y);
+
+ return (diffuse + specular) * ao;
}
@@ -401,18 +401,18 @@ vec3 pbrIbl(vec3 diffuseColor,
// of the shading terms, outlined in the Readme.MD Appendix.
struct PBRInfo
{
- float NdotL; // cos angle between normal and light direction
- float NdotV; // cos angle between normal and view direction
- float NdotH; // cos angle between normal and half vector
- float LdotH; // cos angle between light direction and half vector
- float VdotH; // cos angle between view direction and half vector
- float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)
- float metalness; // metallic value at the surface
- vec3 reflectance0; // full reflectance color (normal incidence angle)
- vec3 reflectance90; // reflectance color at grazing angle
- float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])
- vec3 diffuseColor; // color contribution from diffuse lighting
- vec3 specularColor; // color contribution from specular lighting
+ float NdotL; // cos angle between normal and light direction
+ float NdotV; // cos angle between normal and view direction
+ float NdotH; // cos angle between normal and half vector
+ float LdotH; // cos angle between light direction and half vector
+ float VdotH; // cos angle between view direction and half vector
+ float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)
+ float metalness; // metallic value at the surface
+ vec3 reflectance0; // full reflectance color (normal incidence angle)
+ vec3 reflectance90; // reflectance color at grazing angle
+ float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])
+ vec3 diffuseColor; // color contribution from diffuse lighting
+ vec3 specularColor; // color contribution from specular lighting
};
// Basic Lambertian diffuse
@@ -420,14 +420,14 @@ struct PBRInfo
// See also [1], Equation 1
vec3 diffuse(PBRInfo pbrInputs)
{
- return pbrInputs.diffuseColor / M_PI;
+ return pbrInputs.diffuseColor / M_PI;
}
// The following equation models the Fresnel reflectance term of the spec equation (aka F())
// Implementation of fresnel from [4], Equation 15
vec3 specularReflection(PBRInfo pbrInputs)
{
- return pbrInputs.reflectance0 + (pbrInputs.reflectance90 - pbrInputs.reflectance0) * pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
+ return pbrInputs.reflectance0 + (pbrInputs.reflectance90 - pbrInputs.reflectance0) * pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
}
// This calculates the specular geometric attenuation (aka G()),
@@ -436,13 +436,13 @@ vec3 specularReflection(PBRInfo pbrInputs)
// alphaRoughness as input as originally proposed in [2].
float geometricOcclusion(PBRInfo pbrInputs)
{
- float NdotL = pbrInputs.NdotL;
- float NdotV = pbrInputs.NdotV;
- float r = pbrInputs.alphaRoughness;
+ float NdotL = pbrInputs.NdotL;
+ float NdotV = pbrInputs.NdotV;
+ float r = pbrInputs.alphaRoughness;
- float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
- float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
- return attenuationL * attenuationV;
+ float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
+ float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
+ return attenuationL * attenuationV;
}
// The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())
@@ -450,13 +450,13 @@ float geometricOcclusion(PBRInfo pbrInputs)
// Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.
float microfacetDistribution(PBRInfo pbrInputs)
{
- float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
- float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
- return roughnessSq / (M_PI * f * f);
+ float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
+ float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
+ return roughnessSq / (M_PI * f * f);
}
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
+vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+ float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@@ -464,53 +464,53 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
{
// make sure specular highlights from punctual lights don't fall off of polished surfaces
perceptualRoughness = max(perceptualRoughness, 8.0/255.0);
-
- float alphaRoughness = perceptualRoughness * perceptualRoughness;
-
- // Compute reflectance.
- float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
-
- // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.
- // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.
- float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
- vec3 specularEnvironmentR0 = specularColor.rgb;
- vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
-
- vec3 h = normalize(l+v); // Half vector between both l and v
- vec3 reflection = -normalize(reflect(v, n));
- reflection.y *= -1.0f;
-
- float NdotL = clamp(dot(n, l), 0.001, 1.0);
- float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
- float NdotH = clamp(dot(n, h), 0.0, 1.0);
- float LdotH = clamp(dot(l, h), 0.0, 1.0);
- float VdotH = clamp(dot(v, h), 0.0, 1.0);
-
- PBRInfo pbrInputs = PBRInfo(
- NdotL,
- NdotV,
- NdotH,
- LdotH,
- VdotH,
- perceptualRoughness,
- metallic,
- specularEnvironmentR0,
- specularEnvironmentR90,
- alphaRoughness,
- diffuseColor,
- specularColor
- );
-
- // Calculate the shading terms for the microfacet specular shading model
- vec3 F = specularReflection(pbrInputs);
- float G = geometricOcclusion(pbrInputs);
- float D = microfacetDistribution(pbrInputs);
-
- // Calculation of analytical lighting contribution
- vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
- vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
- // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
- vec3 color = NdotL * (diffuseContrib + specContrib);
+
+ float alphaRoughness = perceptualRoughness * perceptualRoughness;
+
+ // Compute reflectance.
+ float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
+
+ // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.
+ // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.
+ float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
+ vec3 specularEnvironmentR0 = specularColor.rgb;
+ vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
+
+ vec3 h = normalize(l+v); // Half vector between both l and v
+ vec3 reflection = -normalize(reflect(v, n));
+ reflection.y *= -1.0f;
+
+ float NdotL = clamp(dot(n, l), 0.001, 1.0);
+ float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
+ float NdotH = clamp(dot(n, h), 0.0, 1.0);
+ float LdotH = clamp(dot(l, h), 0.0, 1.0);
+ float VdotH = clamp(dot(v, h), 0.0, 1.0);
+
+ PBRInfo pbrInputs = PBRInfo(
+ NdotL,
+ NdotV,
+ NdotH,
+ LdotH,
+ VdotH,
+ perceptualRoughness,
+ metallic,
+ specularEnvironmentR0,
+ specularEnvironmentR90,
+ alphaRoughness,
+ diffuseColor,
+ specularColor
+ );
+
+ // Calculate the shading terms for the microfacet specular shading model
+ vec3 F = specularReflection(pbrInputs);
+ float G = geometricOcclusion(pbrInputs);
+ float D = microfacetDistribution(pbrInputs);
+
+ // Calculation of analytical lighting contribution
+ vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
+ vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
+ // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
+ vec3 color = NdotL * (diffuseContrib + specContrib);
return clamp(color, vec3(0), vec3(10));
}
@@ -528,9 +528,9 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v,
vec3 color = vec3(0);
float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0);
-
+
color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness);
-
+
color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir)) * sunlit * 3.0 * scol; //magic number to balance with legacy materials
color += colorEmissive;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
index 6f3b94f734..c2fb3201f4 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file diffuseAlphaMaskF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,19 +37,19 @@ in vec2 vary_texcoord0;
vec2 encode_normal(vec3 n);
-void main()
+void main()
{
- vec4 col = texture(diffuseMap, vary_texcoord0.xy) * vertex_color;
-
- if (col.a < minimum_alpha)
- {
- discard;
- }
-
- frag_data[0] = vec4(col.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0); // spec
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy) * vertex_color;
+
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ frag_data[0] = vec4(col.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0); // spec
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
index e5f2af2c53..dce1f91bc3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file diffuseAlphaMaskIndexedF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,18 +36,18 @@ in vec2 vary_texcoord0;
vec2 encode_normal(vec3 n);
-void main()
+void main()
{
- vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color;
-
- if (col.a < minimum_alpha)
- {
- discard;
- }
-
- frag_data[0] = vec4(col.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0);
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
+ vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color;
+
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ frag_data[0] = vec4(col.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0);
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
index 234f096ed5..1fc719dde5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file diffuseAlphaMaskNoColorF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_data[4];
@@ -36,19 +36,19 @@ in vec2 vary_texcoord0;
vec2 encode_normal(vec3 n);
-void main()
+void main()
{
- vec4 col = texture(diffuseMap, vary_texcoord0.xy);
-
- if (col.a < minimum_alpha)
- {
- discard;
- }
-
- frag_data[0] = vec4(col.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0); // spec
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy);
+
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ frag_data[0] = vec4(col.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0); // spec
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
index 68fb8bf499..d3d375b20a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
@@ -1,30 +1,30 @@
-/**
+/**
* @file diffuseF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/*[EXTRA_CODE_HERE]*/
-
+
out vec4 frag_data[4];
uniform sampler2D diffuseMap;
@@ -35,14 +35,14 @@ in vec2 vary_texcoord0;
vec2 encode_normal(vec3 n);
-void main()
+void main()
{
- vec3 col = vertex_color.rgb * texture(diffuseMap, vary_texcoord0.xy).rgb;
- frag_data[0] = vec4(col, 0.0);
- frag_data[1] = vertex_color.aaaa; // spec
- //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(encode_normal(nvn.xyz), vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
+ vec3 col = vertex_color.rgb * texture(diffuseMap, vary_texcoord0.xy).rgb;
+ frag_data[0] = vec4(col, 0.0);
+ frag_data[1] = vertex_color.aaaa; // spec
+ //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(encode_normal(nvn.xyz), vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
index 93d561504e..afdd043c7c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file diffuseIndexedF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,16 +34,16 @@ in vec2 vary_texcoord0;
vec2 encode_normal(vec3 n);
vec3 linear_to_srgb(vec3 c);
-void main()
+void main()
{
- vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
+ vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
- vec3 spec;
- spec.rgb = vec3(vertex_color.a);
+ vec3 spec;
+ spec.rgb = vec3(vertex_color.a);
- frag_data[0] = vec4(col, 0.0);
- frag_data[1] = vec4(spec, vertex_color.a); // spec
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(encode_normal(nvn.xyz), vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[0] = vec4(col, 0.0);
+ frag_data[1] = vec4(spec, vertex_color.a); // spec
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(encode_normal(nvn.xyz), vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
index 13cc612fab..9ee34a2d77 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
@@ -1,31 +1,31 @@
-/**
+/**
* @file diffuseNoColorV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
uniform mat3 normal_matrix;
uniform mat4 texture_matrix0;
-uniform mat4 modelview_projection_matrix;
+uniform mat4 modelview_projection_matrix;
in vec3 position;
in vec3 normal;
@@ -37,9 +37,9 @@ out vec2 vary_texcoord0;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- vary_normal = normalize(normal_matrix * normal);
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ vary_normal = normalize(normal_matrix * normal);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
index 2402cc3b70..304c01ecc3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file diffuseV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,13 +54,13 @@ void main()
gl_Position = projection_matrix * pos;
vary_normal = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
#else
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_normal = normalize(normal_matrix * normal);
#endif
-
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- passTextureIndex();
- vertex_color = diffuse_color;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ passTextureIndex();
+
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
index 3b9b8ae696..65476c24ff 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file dofCombineF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,34 +42,34 @@ in vec2 vary_fragcoord;
vec4 dofSample(sampler2D tex, vec2 tc)
{
- tc.x = min(tc.x, dof_width);
- tc.y = min(tc.y, dof_height);
+ tc.x = min(tc.x, dof_width);
+ tc.y = min(tc.y, dof_height);
- return texture(tex, tc);
+ return texture(tex, tc);
}
-void main()
+void main()
{
- vec2 tc = vary_fragcoord.xy;
-
- vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale);
-
- vec4 diff = texture(lightMap, vary_fragcoord.xy);
-
- float a = min(abs(diff.a*2.0-1.0) * max_cof*res_scale*res_scale, 1.0);
-
- if (a > 0.25 && a < 0.75)
- { //help out the transition a bit
- float sc = a/res_scale;
-
- vec4 col;
- col = texture(lightMap, vary_fragcoord.xy+vec2(sc,sc)/screen_res);
- col += texture(lightMap, vary_fragcoord.xy+vec2(-sc,sc)/screen_res);
- col += texture(lightMap, vary_fragcoord.xy+vec2(sc,-sc)/screen_res);
- col += texture(lightMap, vary_fragcoord.xy+vec2(-sc,-sc)/screen_res);
-
- diff = mix(diff, col*0.25, a);
- }
-
- frag_color = mix(diff, dof, a);
+ vec2 tc = vary_fragcoord.xy;
+
+ vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale);
+
+ vec4 diff = texture(lightMap, vary_fragcoord.xy);
+
+ float a = min(abs(diff.a*2.0-1.0) * max_cof*res_scale*res_scale, 1.0);
+
+ if (a > 0.25 && a < 0.75)
+ { //help out the transition a bit
+ float sc = a/res_scale;
+
+ vec4 col;
+ col = texture(lightMap, vary_fragcoord.xy+vec2(sc,sc)/screen_res);
+ col += texture(lightMap, vary_fragcoord.xy+vec2(-sc,sc)/screen_res);
+ col += texture(lightMap, vary_fragcoord.xy+vec2(sc,-sc)/screen_res);
+ col += texture(lightMap, vary_fragcoord.xy+vec2(-sc,-sc)/screen_res);
+
+ diff = mix(diff, col*0.25, a);
+ }
+
+ frag_color = mix(diff, dof, a);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
index c95f791dbf..0c86ec4563 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file emissiveF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -30,10 +30,10 @@ out vec4 frag_color;
in vec4 vertex_color;
in vec2 vary_texcoord0;
-void main()
+void main()
{
// NOTE: when this shader is used, only alpha is being written to
- float a = diffuseLookup(vary_texcoord0.xy).a*vertex_color.a;
- frag_color = max(vec4(0, 0, 0, a), vec4(0));
+ float a = diffuseLookup(vary_texcoord0.xy).a*vertex_color.a;
+ frag_color = max(vec4(0, 0, 0, a), vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
index 5a0913a970..fc8f873e8e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file emissiveV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,8 +47,8 @@ uniform mat4 projection_matrix;
void main()
{
- //transform vertex
- passTextureIndex();
+ //transform vertex
+ passTextureIndex();
#ifdef HAS_SKIN
mat4 mat = getObjectSkinnedTransform();
@@ -57,15 +57,15 @@ void main()
vec4 pos = mat * vec4(position.xyz, 1.0);
gl_Position = projection_matrix * pos;
#else
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
#endif
-
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- calcAtmospherics(pos.xyz);
-
- vertex_color = emissive;
-
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ calcAtmospherics(pos.xyz);
+
+ vertex_color = emissive;
+
+
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl
index 9ac4ceb37e..709b47dcbd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file exposureF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -41,7 +41,7 @@ float lum(vec3 col)
return dot(l, col);
}
-void main()
+void main()
{
vec2 tc = vec2(0.5,0.5);
@@ -55,7 +55,7 @@ void main()
float prev = texture(exposureMap, vec2(0.5,0.5)).r;
s = mix(prev, s, min(dt*2.0*abs(prev-s), 0.04));
-
+
frag_color = max(vec4(s, s, s, dt), vec4(0.0));
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index a6fab10791..ec6a4a502f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file deferred/fullbrightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -50,7 +50,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
#endif
-void main()
+void main()
{
#ifdef IS_ALPHA
@@ -88,7 +88,7 @@ void main()
calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten);
color.rgb = applySkyAndWaterFog(pos, additive, atten, color).rgb;
-
+
#endif
#endif
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl
index 5795384b47..3b55c4645c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl
@@ -4,21 +4,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,28 +54,28 @@ uniform mat4 projection_matrix;
void main()
{
- //transform vertex
- vec4 vert = vec4(position.xyz,1.0);
- passTextureIndex();
+ //transform vertex
+ vec4 vert = vec4(position.xyz,1.0);
+ passTextureIndex();
#ifdef HAS_SKIN
mat4 mat = getObjectSkinnedTransform();
mat = modelview_matrix * mat;
vec4 pos = mat * vert;
gl_Position = projection_matrix * pos;
- vec3 norm = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
+ vec3 norm = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
#else
- vec4 pos = (modelview_matrix * vert);
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- vec3 norm = normalize(normal_matrix * normal);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ vec3 norm = normalize(normal_matrix * normal);
#endif
vary_position = pos.xyz;
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
vary_texcoord1 = norm;
- calcAtmospherics(pos.xyz);
+ calcAtmospherics(pos.xyz);
- vertex_color = diffuse_color;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
index 77e63e6360..9304ed6dfa 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file fullbrightV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,9 +50,9 @@ uniform mat4 projection_matrix;
void main()
{
- //transform vertex
- vec4 vert = vec4(position.xyz, 1.0);
- passTextureIndex();
+ //transform vertex
+ vec4 vert = vec4(position.xyz, 1.0);
+ passTextureIndex();
#ifdef HAS_SKIN
mat4 mat = getObjectSkinnedTransform();
@@ -60,15 +60,15 @@ void main()
vec4 pos = mat * vert;
gl_Position = projection_matrix * pos;
#else
- vec4 pos = (modelview_matrix * vert);
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
#endif
- vary_position = pos.xyz;
+ vary_position = pos.xyz;
+
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- calcAtmospherics(pos.xyz);
+ calcAtmospherics(pos.xyz);
- vertex_color = diffuse_color;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
index cd56ed0adf..94dac7e5a9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file fxaaF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable
@@ -70,11 +70,11 @@ Example,
Or,
#define FXAA_360 1
-
+
Or,
#define FXAA_PS3 1
-
+
Etc.
(2.)
@@ -85,7 +85,7 @@ Then include this file,
(3.)
Then call the FXAA pixel shader from within your desired shader.
Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
-As for FXAA 3.11 all inputs for all shaders are the same
+As for FXAA 3.11 all inputs for all shaders are the same
to enable easy porting between platforms.
return FxaaPixelShader(...);
@@ -116,7 +116,7 @@ Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
(6.)
Have FXAA vertex shader run as a full screen triangle,
-and output "pos" and "fxaaConsolePosPos"
+and output "pos" and "fxaaConsolePosPos"
such that inputs in the pixel shader provide,
// {xy} = center of pixel
@@ -133,7 +133,7 @@ Insure the texture sampler(s) used by FXAA are set to bilinear filtering.
------------------------------------------------------------------------------
INTEGRATION - RGBL AND COLORSPACE
------------------------------------------------------------------------------
-FXAA3 requires RGBL as input unless the following is set,
+FXAA3 requires RGBL as input unless the following is set,
#define FXAA_GREEN_AS_LUMA 1
@@ -186,7 +186,7 @@ Getting luma correct is required for the algorithm to work correctly.
------------------------------------------------------------------------------
Applying FXAA to a framebuffer with linear RGB color will look worse.
This is very counter intuitive, but happends to be true in this case.
-The reason is because dithering artifacts will be more visiable
+The reason is because dithering artifacts will be more visiable
in a linear colorspace.
@@ -281,7 +281,7 @@ A. Or use FXAA_GREEN_AS_LUMA.
// Might want to lower the settings for both,
// fxaaConsoleEdgeThresholdMin
// fxaaQualityEdgeThresholdMin
- // In order to insure AA does not get turned off on colors
+ // In order to insure AA does not get turned off on colors
// which contain a minor amount of green.
//
// 1 = On.
@@ -342,23 +342,23 @@ A. Or use FXAA_GREEN_AS_LUMA.
// 1 = API supports gather4 on alpha channel.
// 0 = API does not support gather4 on alpha channel.
//
- #if (FXAA_GLSL_130 == 0)
- #define FXAA_GATHER4_ALPHA 0
- #endif
+ #if (FXAA_GLSL_130 == 0)
+ #define FXAA_GATHER4_ALPHA 0
+ #endif
#if (FXAA_HLSL_5 == 1)
#define FXAA_GATHER4_ALPHA 1
#endif
#ifndef FXAA_GATHER4_ALPHA
- #ifdef GL_ARB_gpu_shader5
- #define FXAA_GATHER4_ALPHA 1
- #endif
- #ifdef GL_NV_gpu_shader5
- #define FXAA_GATHER4_ALPHA 1
- #endif
- #ifndef FXAA_GATHER4_ALPHA
- #define FXAA_GATHER4_ALPHA 0
- #endif
- #endif
+ #ifdef GL_ARB_gpu_shader5
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifdef GL_NV_gpu_shader5
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifndef FXAA_GATHER4_ALPHA
+ #define FXAA_GATHER4_ALPHA 0
+ #endif
+ #endif
#endif
/*============================================================================
@@ -421,14 +421,14 @@ NOTE the other tuning knobs are now in the shader function inputs!
//
// Choose the quality preset.
// This needs to be compiled into the shader as it effects code.
- // Best option to include multiple presets is to
+ // Best option to include multiple presets is to
// in each shader define the preset, then include this file.
- //
+ //
// OPTIONS
// -----------------------------------------------------------------------
// 10 to 15 - default medium dither (10=fastest, 15=highest quality)
// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
- // 39 - no dither, very expensive
+ // 39 - no dither, very expensive
//
// NOTES
// -----------------------------------------------------------------------
@@ -437,7 +437,7 @@ NOTE the other tuning knobs are now in the shader function inputs!
// 23 = closest to FXAA 3.9 visually and performance wise
// _ = the lowest digit is directly related to performance
// _ = the highest digit is directly related to style
- //
+ //
#define FXAA_QUALITY__PRESET 12
#endif
@@ -747,7 +747,7 @@ NOTE the other tuning knobs are now in the shader function inputs!
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }
#else
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
-#endif
+#endif
@@ -801,28 +801,28 @@ FxaaFloat4 FxaaPixelShader(
// Where N ranges between,
// N = 0.50 (default)
// N = 0.33 (sharper)
- // {x___} = -N/screenWidthInPixels
+ // {x___} = -N/screenWidthInPixels
// {_y__} = -N/screenHeightInPixels
- // {__z_} = N/screenWidthInPixels
- // {___w} = N/screenHeightInPixels
+ // {__z_} = N/screenWidthInPixels
+ // {___w} = N/screenHeightInPixels
FxaaFloat4 fxaaConsoleRcpFrameOpt,
//
// Only used on FXAA Console.
// Not used on 360, but used on PS3 and PC.
// This must be from a constant/uniform.
- // {x___} = -2.0/screenWidthInPixels
+ // {x___} = -2.0/screenWidthInPixels
// {_y__} = -2.0/screenHeightInPixels
- // {__z_} = 2.0/screenWidthInPixels
- // {___w} = 2.0/screenHeightInPixels
+ // {__z_} = 2.0/screenWidthInPixels
+ // {___w} = 2.0/screenHeightInPixels
FxaaFloat4 fxaaConsoleRcpFrameOpt2,
//
// Only used on FXAA Console.
// Only used on 360 in place of fxaaConsoleRcpFrameOpt2.
// This must be from a constant/uniform.
- // {x___} = 8.0/screenWidthInPixels
+ // {x___} = 8.0/screenWidthInPixels
// {_y__} = 8.0/screenHeightInPixels
- // {__z_} = -4.0/screenWidthInPixels
- // {___w} = -4.0/screenHeightInPixels
+ // {__z_} = -4.0/screenWidthInPixels
+ // {___w} = -4.0/screenHeightInPixels
FxaaFloat4 fxaaConsole360RcpFrameOpt2,
//
// Only used on FXAA Quality.
@@ -844,7 +844,7 @@ FxaaFloat4 FxaaPixelShader(
// 0.333 - too little (faster)
// 0.250 - low quality
// 0.166 - default
- // 0.125 - high quality
+ // 0.125 - high quality
// 0.063 - overkill (slower)
FxaaFloat fxaaQualityEdgeThreshold,
//
@@ -862,7 +862,7 @@ FxaaFloat4 FxaaPixelShader(
// Tune by looking at mostly non-green content,
// then start at zero and increase until aliasing is a problem.
FxaaFloat fxaaQualityEdgeThresholdMin,
- //
+ //
// Only used on FXAA Console.
// This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
// It is here now to allow easier tuning.
@@ -897,7 +897,7 @@ FxaaFloat4 FxaaPixelShader(
// Trims the algorithm from processing darks.
// The console setting has a different mapping than the quality setting.
// This only applies when FXAA_EARLY_EXIT is 1.
- // This does not apply to PS3,
+ // This does not apply to PS3,
// PS3 was simplified to avoid more shader instructions.
// 0.06 - faster but more aliasing in darks
// 0.05 - default
@@ -909,7 +909,7 @@ FxaaFloat4 FxaaPixelShader(
// Tune by looking at mostly non-green content,
// then start at zero and increase until aliasing is a problem.
FxaaFloat fxaaConsoleEdgeThresholdMin,
- //
+ //
// Extra constants for 360 FXAA Console only.
// Use zeros or anything else for other platforms.
// These must be in physical constant registers and NOT immedates.
@@ -1286,11 +1286,11 @@ FxaaFloat4 FxaaPixelShader(
/*============================================================================
FXAA3 CONSOLE - PC VERSION
-
+
------------------------------------------------------------------------------
Instead of using this on PC, I'd suggest just using FXAA Quality with
#define FXAA_QUALITY__PRESET 10
-Or
+Or
#define FXAA_QUALITY__PRESET 20
Either are higher qualilty and almost as fast as this on modern PC GPUs.
============================================================================*/
@@ -1379,7 +1379,7 @@ FxaaFloat4 FxaaPixelShader(
/*============================================================================
- FXAA3 CONSOLE - 360 PIXEL SHADER
+ FXAA3 CONSOLE - 360 PIXEL SHADER
------------------------------------------------------------------------------
This optimized version thanks to suggestions from Andy Luedke.
@@ -1414,14 +1414,14 @@ float4 FxaaPixelShader(
/*--------------------------------------------------------------------------*/
float4 lumaNwNeSwSe;
#if (FXAA_GREEN_AS_LUMA == 0)
- asm {
+ asm {
tfetch2D lumaNwNeSwSe.w___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false
tfetch2D lumaNwNeSwSe._w__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false
tfetch2D lumaNwNeSwSe.__w_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false
tfetch2D lumaNwNeSwSe.___w, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false
};
#else
- asm {
+ asm {
tfetch2D lumaNwNeSwSe.y___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false
tfetch2D lumaNwNeSwSe._y__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false
tfetch2D lumaNwNeSwSe.__y_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false
@@ -1442,7 +1442,7 @@ float4 FxaaPixelShader(
#else
float lumaMinM = min(lumaMin, rgbyM.y);
float lumaMaxM = max(lumaMax, rgbyM.y);
- #endif
+ #endif
if((lumaMaxM - lumaMinM) < max(fxaaConsoleEdgeThresholdMin, lumaMax * fxaaConsoleEdgeThreshold)) return rgbyM;
/*--------------------------------------------------------------------------*/
float2 dir;
@@ -1591,7 +1591,7 @@ Pass | Unit | uOp | PC: Op
| | |
13 | SCT0 | mad | 48: ADDxc0_s rc, h2, h2.w---;
| SCB0/1 | mul | 49: MOVh h0(NE0.xxxx), h1;
-
+
Pass SCT TEX SCB
1: 0% 100% 25%
2: 0% 100% 25%
@@ -1677,7 +1677,7 @@ half4 FxaaPixelShader(
#else
dir.x += lumaSw.y;
dir.z += lumaSw.y;
- #endif
+ #endif
/*--------------------------------------------------------------------------*/
// (3)
half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0));
@@ -1740,7 +1740,7 @@ half4 FxaaPixelShader(
#else
half lumaMin = min(min(lumaNw.y, lumaSw.y), min(lumaNe.y, lumaSe.y));
half lumaMax = max(max(lumaNw.y, lumaSw.y), max(lumaNe.y, lumaSe.y));
- #endif
+ #endif
rgby2 = (rgby2 + rgby1) * 0.5;
/*--------------------------------------------------------------------------*/
// (12)
@@ -1896,7 +1896,7 @@ Pass | Unit | uOp | PC: Op
| | |
15 | SCT0/1 | mul | 55: MOVh h0(NE0.wwww), h2;
| SCB0/1 | mul | 56: MOVh h0(NE0.xxxx), h1;
-
+
Pass SCT TEX SCB
1: 0% 100% 25%
2: 0% 100% 25%
@@ -2096,28 +2096,28 @@ uniform vec4 rcp_frame_opt2;
in vec2 vary_fragcoord;
in vec2 vary_tc;
-void main()
+void main()
{
- vec4 diff = FxaaPixelShader(vary_tc, //pos
- vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos
- diffuseMap, //tex
- diffuseMap,
- diffuseMap,
- rcp_screen_res, //fxaaQualityRcpFrame
- vec4(0,0,0,0), //fxaaConsoleRcpFrameOpt
- rcp_frame_opt, //fxaaConsoleRcpFrameOpt2
- rcp_frame_opt2, //fxaaConsole360RcpFrameOpt2
- 0.75, //fxaaQualitySubpix
- 0.07, //fxaaQualityEdgeThreshold
- 0.03, //fxaaQualityEdgeThresholdMin
- 8.0, //fxaaConsoleEdgeSharpness
- 0.125, //fxaaConsoleEdgeThreshold
- 0.05, //fxaaConsoleEdgeThresholdMin
- vec4(0,0,0,0)); //fxaaConsole360ConstDir
+ vec4 diff = FxaaPixelShader(vary_tc, //pos
+ vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos
+ diffuseMap, //tex
+ diffuseMap,
+ diffuseMap,
+ rcp_screen_res, //fxaaQualityRcpFrame
+ vec4(0,0,0,0), //fxaaConsoleRcpFrameOpt
+ rcp_frame_opt, //fxaaConsoleRcpFrameOpt2
+ rcp_frame_opt2, //fxaaConsole360RcpFrameOpt2
+ 0.75, //fxaaQualitySubpix
+ 0.07, //fxaaQualityEdgeThreshold
+ 0.03, //fxaaQualityEdgeThresholdMin
+ 8.0, //fxaaConsoleEdgeSharpness
+ 0.125, //fxaaConsoleEdgeThreshold
+ 0.05, //fxaaConsoleEdgeThresholdMin
+ vec4(0,0,0,0)); //fxaaConsole360ConstDir
frag_color = diff;
-
+
gl_FragDepth = texture(depthMap, vary_fragcoord.xy).r;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/genbrdflutF.glsl b/indra/newview/app_settings/shaders/class1/deferred/genbrdflutF.glsl
index e40d070268..f57b10b720 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/genbrdflutF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/genbrdflutF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1/deferred/genbrdflut.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -60,82 +60,82 @@ const float PI = 3.1415926536;
// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
float random(vec2 co)
{
- float a = 12.9898;
- float b = 78.233;
- float c = 43758.5453;
- float dt= dot(co.xy ,vec2(a,b));
- float sn= mod(dt,3.14);
- return fract(sin(sn) * c);
+ float a = 12.9898;
+ float b = 78.233;
+ float c = 43758.5453;
+ float dt= dot(co.xy ,vec2(a,b));
+ float sn= mod(dt,3.14);
+ return fract(sin(sn) * c);
}
-vec2 hammersley2d(uint i, uint N)
+vec2 hammersley2d(uint i, uint N)
{
- // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
- uint bits = (i << 16u) | (i >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- float rdi = float(bits) * 2.3283064365386963e-10;
- return vec2(float(i) /float(N), rdi);
+ // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
+ uint bits = (i << 16u) | (i >> 16u);
+ bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
+ bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
+ bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
+ bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
+ float rdi = float(bits) * 2.3283064365386963e-10;
+ return vec2(float(i) /float(N), rdi);
}
// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
-vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
+vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
{
- // Maps a 2D point to a hemisphere with spread based on roughness
- float alpha = roughness * roughness;
- float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
- float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
- float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
- vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
-
- // Tangent space
- vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangentX = normalize(cross(up, normal));
- vec3 tangentY = normalize(cross(normal, tangentX));
-
- // Convert to world Space
- return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
+ // Maps a 2D point to a hemisphere with spread based on roughness
+ float alpha = roughness * roughness;
+ float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
+ float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
+ float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
+ vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
+
+ // Tangent space
+ vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
+ vec3 tangentX = normalize(cross(up, normal));
+ vec3 tangentY = normalize(cross(normal, tangentX));
+
+ // Convert to world Space
+ return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
}
// Geometric Shadowing function
float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness)
{
- float k = (roughness * roughness) / 2.0;
- float GL = dotNL / (dotNL * (1.0 - k) + k);
- float GV = dotNV / (dotNV * (1.0 - k) + k);
- return GL * GV;
+ float k = (roughness * roughness) / 2.0;
+ float GL = dotNL / (dotNL * (1.0 - k) + k);
+ float GV = dotNV / (dotNV * (1.0 - k) + k);
+ return GL * GV;
}
vec2 BRDF(float NoV, float roughness)
{
- // Normal always points along z-axis for the 2D lookup
- const vec3 N = vec3(0.0, 0.0, 1.0);
- vec3 V = vec3(sqrt(1.0 - NoV*NoV), 0.0, NoV);
-
- vec2 LUT = vec2(0.0);
- for(uint i = 0u; i < NUM_SAMPLES; i++) {
- vec2 Xi = hammersley2d(i, NUM_SAMPLES);
- vec3 H = importanceSample_GGX(Xi, roughness, N);
- vec3 L = 2.0 * dot(V, H) * H - V;
-
- float dotNL = max(dot(N, L), 0.0);
- float dotNV = max(dot(N, V), 0.0);
- float dotVH = max(dot(V, H), 0.0);
- float dotNH = max(dot(H, N), 0.0);
-
- if (dotNL > 0.0) {
- float G = G_SchlicksmithGGX(dotNL, dotNV, roughness);
- float G_Vis = (G * dotVH) / (dotNH * dotNV);
- float Fc = pow(1.0 - dotVH, 5.0);
- LUT += vec2((1.0 - Fc) * G_Vis, Fc * G_Vis);
- }
- }
- return LUT / float(NUM_SAMPLES);
+ // Normal always points along z-axis for the 2D lookup
+ const vec3 N = vec3(0.0, 0.0, 1.0);
+ vec3 V = vec3(sqrt(1.0 - NoV*NoV), 0.0, NoV);
+
+ vec2 LUT = vec2(0.0);
+ for(uint i = 0u; i < NUM_SAMPLES; i++) {
+ vec2 Xi = hammersley2d(i, NUM_SAMPLES);
+ vec3 H = importanceSample_GGX(Xi, roughness, N);
+ vec3 L = 2.0 * dot(V, H) * H - V;
+
+ float dotNL = max(dot(N, L), 0.0);
+ float dotNV = max(dot(N, V), 0.0);
+ float dotVH = max(dot(V, H), 0.0);
+ float dotNH = max(dot(H, N), 0.0);
+
+ if (dotNL > 0.0) {
+ float G = G_SchlicksmithGGX(dotNL, dotNV, roughness);
+ float G_Vis = (G * dotVH) / (dotNH * dotNV);
+ float Fc = pow(1.0 - dotVH, 5.0);
+ LUT += vec2((1.0 - Fc) * G_Vis, Fc * G_Vis);
+ }
+ }
+ return LUT / float(NUM_SAMPLES);
}
-void main()
+void main()
{
- outColor = vec4(BRDF(vary_uv.s, 1.0-vary_uv.t), 0.0, 1.0);
+ outColor = vec4(BRDF(vary_uv.s, 1.0-vary_uv.t), 0.0, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/genbrdflutV.glsl b/indra/newview/app_settings/shaders/class1/deferred/genbrdflutV.glsl
index 3a1572996f..a609776176 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/genbrdflutV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/genbrdflutV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class3\deferred\genbrdflutV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,9 +31,9 @@ out vec2 vary_uv;
void main()
{
- //transform vertex
- vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_uv = position.xy*0.5+0.5;
+ //transform vertex
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_uv = position.xy*0.5+0.5;
- gl_Position = vec4(position.xyz, 1.0);
+ gl_Position = vec4(position.xyz, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl
index 748fcbed80..5c09950712 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file highlightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
out vec4 frag_data[4];
uniform vec4 color;
@@ -30,10 +30,10 @@ uniform sampler2D diffuseMap;
in vec2 vary_texcoord0;
-void main()
+void main()
{
- frag_data[0] = color*texture(diffuseMap, vary_texcoord0.xy);
- frag_data[1] = vec4(0.0);
- frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
+ frag_data[0] = color*texture(diffuseMap, vary_texcoord0.xy);
+ frag_data[1] = vec4(0.0);
+ frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index aae595f619..5561a3d488 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file impostorF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,20 +39,20 @@ in vec2 vary_texcoord0;
vec3 linear_to_srgb(vec3 c);
vec2 encode_normal (vec3 n);
-void main()
+void main()
{
- vec4 col = texture(diffuseMap, vary_texcoord0.xy);
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy);
- if (col.a < minimum_alpha)
- {
- discard;
- }
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
- vec4 norm = texture(normalMap, vary_texcoord0.xy);
- vec4 spec = texture(specularMap, vary_texcoord0.xy);
+ vec4 norm = texture(normalMap, vary_texcoord0.xy);
+ vec4 spec = texture(specularMap, vary_texcoord0.xy);
- frag_data[0] = vec4(col.rgb, 0.0);
- frag_data[1] = spec;
- frag_data[2] = vec4(encode_normal(norm.xyz),0,GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[0] = vec4(col.rgb, 0.0);
+ frag_data[1] = spec;
+ frag_data[2] = vec4(encode_normal(norm.xyz),0,GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
index 444c54a31e..6af0757143 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file impostorV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@ out vec2 vary_texcoord0;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
index c8afacf9bb..b9337a357f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
@@ -1,32 +1,32 @@
-/**
+/**
* @file luminanceF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
-// take a luminance sample of diffuseRect and emissiveRect
+// take a luminance sample of diffuseRect and emissiveRect
out vec4 frag_color;
@@ -41,7 +41,7 @@ float lum(vec3 col)
return dot(l, col);
}
-void main()
+void main()
{
vec2 tc = vary_fragcoord*0.6+0.2;
tc.y -= 0.1; // HACK - nudge exposure sample down a little bit to favor ground over sky
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 4dee23372f..c23729ef30 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -39,7 +39,7 @@ void main()
{
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
frag_color = vec4(0.5, 0, 1, 0.5);
-#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
+#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
// deferred path // See: C++: addDeferredAttachment(), shader: softenLightF.glsl
frag_data[0] = vec4(0.5, 0, 1, 0); // gbuffer is sRGB for legacy materials
frag_data[1] = vec4(0); // XYZ = Specular color. W = Specular exponent.
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
index 7cdddfe8db..5e48ff709f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file materialV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -72,70 +72,70 @@ out vec3 vary_normal;
in vec2 texcoord2;
out vec2 vary_texcoord2;
#endif
-
+
out vec4 vertex_color;
out vec2 vary_texcoord0;
void main()
{
#ifdef HAS_SKIN
- mat4 mat = getObjectSkinnedTransform();
+ mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
+ mat = modelview_matrix * mat;
- vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
+ vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
- vary_position = pos;
+ vary_position = pos;
#endif
- gl_Position = projection_matrix*vec4(pos,1.0);
+ gl_Position = projection_matrix*vec4(pos,1.0);
#else
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
#endif
-
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
+
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
#ifdef HAS_NORMAL_MAP
- vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
+ vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
#endif
#ifdef HAS_SPECULAR_MAP
- vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
+ vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
#endif
#ifdef HAS_SKIN
- vec3 n = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
+ vec3 n = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
#ifdef HAS_NORMAL_MAP
- vec3 t = normalize((mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz);
+ vec3 t = normalize((mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz);
vary_tangent = t;
vary_sign = tangent.w;
vary_normal = n;
#else //HAS_NORMAL_MAP
- vary_normal = n;
+ vary_normal = n;
#endif //HAS_NORMAL_MAP
#else //HAS_SKIN
- vec3 n = normalize(normal_matrix * normal);
+ vec3 n = normalize(normal_matrix * normal);
#ifdef HAS_NORMAL_MAP
- vec3 t = normalize(normal_matrix * tangent.xyz);
+ vec3 t = normalize(normal_matrix * tangent.xyz);
vary_tangent = t;
vary_sign = tangent.w;
vary_normal = n;
#else //HAS_NORMAL_MAP
- vary_normal = n;
+ vary_normal = n;
#endif //HAS_NORMAL_MAP
#endif //HAS_SKIN
-
- vertex_color = diffuse_color;
+
+ vertex_color = diffuse_color;
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
#if !defined(HAS_SKIN)
- vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
+ vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
#endif
#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index 183354b9bd..03a8518c36 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file class1\deferred\moonF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, 2020 Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_data[4];
@@ -34,7 +34,7 @@ uniform sampler2D diffuseMap;
in vec2 vary_texcoord0;
-void main()
+void main()
{
// Restore Pre-EEP alpha fade moon near horizon
float fade = 1.0;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl
index c2a1dccb33..8d9df7e926 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1\deferred\moonV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, 2020 Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
index 05dced0026..902746366d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file normgenF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -37,18 +37,18 @@ uniform float norm_scale;
void main()
{
- float c = texture(alphaMap, vary_texcoord0).r;
-
- vec3 right = vec3(norm_scale, 0, (texture(alphaMap, vary_texcoord0+vec2(stepX, 0)).r-c)*255);
- vec3 left = vec3(-norm_scale, 0, (texture(alphaMap, vary_texcoord0-vec2(stepX, 0)).r-c)*255);
- vec3 up = vec3(0, -norm_scale, (texture(alphaMap, vary_texcoord0-vec2(0, stepY)).r-c)*255);
- vec3 down = vec3(0, norm_scale, (texture(alphaMap, vary_texcoord0+vec2(0, stepY)).r-c)*255);
-
- vec3 norm = cross(right, down) + cross(down, left) + cross(left,up) + cross(up, right);
-
- norm = normalize(norm);
- norm *= 0.5;
- norm += 0.5;
-
- frag_color = vec4(norm, c);
+ float c = texture(alphaMap, vary_texcoord0).r;
+
+ vec3 right = vec3(norm_scale, 0, (texture(alphaMap, vary_texcoord0+vec2(stepX, 0)).r-c)*255);
+ vec3 left = vec3(-norm_scale, 0, (texture(alphaMap, vary_texcoord0-vec2(stepX, 0)).r-c)*255);
+ vec3 up = vec3(0, -norm_scale, (texture(alphaMap, vary_texcoord0-vec2(0, stepY)).r-c)*255);
+ vec3 down = vec3(0, norm_scale, (texture(alphaMap, vary_texcoord0+vec2(0, stepY)).r-c)*255);
+
+ vec3 norm = cross(right, down) + cross(down, left) + cross(left,up) + cross(up, right);
+
+ norm = normalize(norm);
+ norm *= 0.5;
+ norm += 0.5;
+
+ frag_color = vec4(norm, c);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl b/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl
index 7896659ad3..135ebf9418 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file normgenV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
in vec3 position;
in vec2 texcoord0;
@@ -31,6 +31,6 @@ out vec2 vary_texcoord0;
void main()
{
- gl_Position = vec4(position.x*2.0-1.0, position.y*2.0-1.0, -1.0, 1.0);
- vary_texcoord0 = texcoord0;
+ gl_Position = vec4(position.x*2.0-1.0, position.y*2.0-1.0, -1.0, 1.0);
+ vary_texcoord0 = texcoord0;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaBlendF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaBlendF.glsl
index 79425ad716..dbaab9bbda 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaBlendF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaBlendF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pbrShadowAlphaBlendF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@ in vec4 vertex_color;
in vec2 vary_texcoord0;
uniform float minimum_alpha;
-void main()
+void main()
{
float alpha = texture(diffuseMap,vary_texcoord0.xy).a;
@@ -52,5 +52,5 @@ void main()
}
}
- frag_color = vec4(1,1,1,1);
+ frag_color = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl
index 1d1545be7e..c1fb9f5d84 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pbrShadowAlphaMaskF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@ in vec4 vertex_color;
in vec2 vary_texcoord0;
uniform float minimum_alpha;
-void main()
+void main()
{
float alpha = texture(diffuseMap,vary_texcoord0.xy).a;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskV.glsl
index 4fb5fbcf06..0cfe3c9a5f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pbrShadowAlphaMaskV.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,7 +67,7 @@ void main()
post_pos = pos;
gl_Position = pos;
-
+
passTextureIndex();
vary_texcoord0 = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl
index 2ccd3fd962..566f4f9c2a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pbralphaF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl
index 6b960fae33..d0fc362db9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1\deferred\pbralphaV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -77,13 +77,13 @@ vec3 tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] kh
void main()
{
#ifdef HAS_SKIN
- mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
- vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
- vary_position = pos;
+ mat4 mat = getObjectSkinnedTransform();
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
+ vary_position = pos;
vec4 vert = projection_matrix * vec4(pos,1.0);
#else
- //transform vertex
+ //transform vertex
vec4 vert = modelview_projection_matrix * vec4(position.xyz, 1.0);
#endif
gl_Position = vert;
@@ -96,11 +96,11 @@ void main()
emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);
#ifdef HAS_SKIN
- vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz;
- vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz;
+ vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz;
+ vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz;
#else //HAS_SKIN
- vec3 n = normal_matrix * normal;
- vec3 t = normal_matrix * tangent.xyz;
+ vec3 n = normal_matrix * normal;
+ vec3 t = normal_matrix * tangent.xyz;
#endif //HAS_SKIN
n = normalize(n);
@@ -109,10 +109,10 @@ void main()
vary_sign = tangent.w;
vary_normal = n;
- vertex_color = diffuse_color;
+ vertex_color = diffuse_color;
#if !defined(HAS_SKIN)
- vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
+ vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
#endif
}
@@ -145,7 +145,7 @@ vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl
void main()
{
- //transform vertex
+ //transform vertex
vec4 vert = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_Position = vert;
vary_position = vert.xyz;
@@ -153,7 +153,7 @@ void main()
base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0);
emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);
- vertex_color = diffuse_color;
+ vertex_color = diffuse_color;
}
#endif
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl
index b74b2e6a83..0c52c924b0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pbrglowF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl
index 82a50a115c..f739099359 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pbgglowV.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,7 +44,7 @@ in vec2 texcoord0;
out vec2 base_color_texcoord;
out vec2 emissive_texcoord;
-
+
out vec4 vertex_emissive;
vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);
@@ -61,7 +61,7 @@ void main()
gl_Position = projection_matrix*vec4(pos,1.0);
#else
//transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
#endif
base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl
index faa273b834..ed19fba228 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pbropaqueF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,7 +28,7 @@
#ifndef IS_HUD
-// deferred opaque implementation
+// deferred opaque implementation
uniform sampler2D diffuseMap; //always in sRGB space
@@ -75,7 +75,7 @@ void main()
float sign = vary_sign;
vec3 vN = vary_normal;
vec3 vT = vary_tangent.xyz;
-
+
vec3 vB = sign * cross(vN, vT);
vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN );
@@ -85,7 +85,7 @@ void main()
// roughness 0.0
// metal 0.0
vec3 spec = texture(specularMap, metallic_roughness_texcoord.xy).rgb;
-
+
spec.g *= roughnessFactor;
spec.b *= metallicFactor;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl
index 160ae7a215..53e4b732df 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pbropaqueV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,7 +53,7 @@ out vec2 base_color_texcoord;
out vec2 normal_texcoord;
out vec2 metallic_roughness_texcoord;
out vec2 emissive_texcoord;
-
+
out vec4 vertex_color;
out vec3 vary_tangent;
@@ -66,17 +66,17 @@ vec3 tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] kh
void main()
{
#ifdef HAS_SKIN
- mat4 mat = getObjectSkinnedTransform();
+ mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
+ mat = modelview_matrix * mat;
- vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
+ vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
- gl_Position = projection_matrix*vec4(pos,1.0);
+ gl_Position = projection_matrix*vec4(pos,1.0);
#else
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
#endif
base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0);
@@ -85,11 +85,11 @@ void main()
emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);
#ifdef HAS_SKIN
- vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz;
- vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz;
+ vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz;
+ vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz;
#else //HAS_SKIN
- vec3 n = normal_matrix * normal;
- vec3 t = normal_matrix * tangent.xyz;
+ vec3 n = normal_matrix * normal;
+ vec3 t = normal_matrix * tangent.xyz;
#endif
n = normalize(n);
@@ -97,11 +97,11 @@ void main()
vary_tangent = normalize(tangent_space_transform(vec4(t, tangent.w), n, texture_normal_transform, texture_matrix0));
vary_sign = tangent.w;
vary_normal = n;
-
- vertex_color = diffuse_color;
+
+ vertex_color = diffuse_color;
}
-#else
+#else
// fullbright HUD implementation
@@ -118,7 +118,7 @@ in vec2 texcoord0;
out vec2 base_color_texcoord;
out vec2 emissive_texcoord;
-
+
out vec4 vertex_color;
vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);
@@ -126,7 +126,7 @@ vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl
void main()
{
//transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0);
emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
index 86e3f1acda..9797bcd2ce 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file postDeferredF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,87 +38,87 @@ in vec2 vary_fragcoord;
void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc)
{
- vec4 s = texture(diffuseRect, tc);
-
- float sc = abs(s.a*2.0-1.0)*max_cof;
-
- if (sc > min_sc) //sampled pixel is more "out of focus" than current sample radius
- {
- float wg = 0.25;
-
- // de-weight dull areas to make highlights 'pop'
- wg += s.r+s.g+s.b;
-
- diff += wg*s;
-
- w += wg;
- }
+ vec4 s = texture(diffuseRect, tc);
+
+ float sc = abs(s.a*2.0-1.0)*max_cof;
+
+ if (sc > min_sc) //sampled pixel is more "out of focus" than current sample radius
+ {
+ float wg = 0.25;
+
+ // de-weight dull areas to make highlights 'pop'
+ wg += s.r+s.g+s.b;
+
+ diff += wg*s;
+
+ w += wg;
+ }
}
void dofSampleNear(inout vec4 diff, inout float w, float min_sc, vec2 tc)
{
- vec4 s = texture(diffuseRect, tc);
+ vec4 s = texture(diffuseRect, tc);
- float wg = 0.25;
+ float wg = 0.25;
- // de-weight dull areas to make highlights 'pop'
- wg += s.r+s.g+s.b;
+ // de-weight dull areas to make highlights 'pop'
+ wg += s.r+s.g+s.b;
- diff += wg*s;
-
- w += wg;
+ diff += wg*s;
+
+ w += wg;
}
-void main()
+void main()
{
- vec2 tc = vary_fragcoord.xy;
-
- vec4 diff = texture(diffuseRect, vary_fragcoord.xy);
-
- {
- float w = 1.0;
-
- float sc = (diff.a*2.0-1.0)*max_cof;
-
- float PI = 3.14159265358979323846264;
-
- // sample quite uniformly spaced points within a circle, for a circular 'bokeh'
- if (sc > 0.5)
- {
- while (sc > 0.5)
- {
- int its = int(max(1.0,(sc*3.7)));
- for (int i=0; i<its; ++i)
- {
- float ang = sc+i*2*PI/its; // sc is added for rotary perturbance
- float samp_x = sc*sin(ang);
- float samp_y = sc*cos(ang);
- // you could test sample coords against an interesting non-circular aperture shape here, if desired.
- dofSampleNear(diff, w, sc, vary_fragcoord.xy + (vec2(samp_x,samp_y) / screen_res));
- }
- sc -= 1.0;
- }
- }
- else if (sc < -0.5)
- {
- sc = abs(sc);
- while (sc > 0.5)
- {
- int its = int(max(1.0,(sc*3.7)));
- for (int i=0; i<its; ++i)
- {
- float ang = sc+i*2*PI/its; // sc is added for rotary perturbance
- float samp_x = sc*sin(ang);
- float samp_y = sc*cos(ang);
- // you could test sample coords against an interesting non-circular aperture shape here, if desired.
- dofSample(diff, w, sc, vary_fragcoord.xy + (vec2(samp_x,samp_y) / screen_res));
- }
- sc -= 1.0;
- }
- }
-
- diff /= w;
- }
-
- frag_color = diff;
+ vec2 tc = vary_fragcoord.xy;
+
+ vec4 diff = texture(diffuseRect, vary_fragcoord.xy);
+
+ {
+ float w = 1.0;
+
+ float sc = (diff.a*2.0-1.0)*max_cof;
+
+ float PI = 3.14159265358979323846264;
+
+ // sample quite uniformly spaced points within a circle, for a circular 'bokeh'
+ if (sc > 0.5)
+ {
+ while (sc > 0.5)
+ {
+ int its = int(max(1.0,(sc*3.7)));
+ for (int i=0; i<its; ++i)
+ {
+ float ang = sc+i*2*PI/its; // sc is added for rotary perturbance
+ float samp_x = sc*sin(ang);
+ float samp_y = sc*cos(ang);
+ // you could test sample coords against an interesting non-circular aperture shape here, if desired.
+ dofSampleNear(diff, w, sc, vary_fragcoord.xy + (vec2(samp_x,samp_y) / screen_res));
+ }
+ sc -= 1.0;
+ }
+ }
+ else if (sc < -0.5)
+ {
+ sc = abs(sc);
+ while (sc > 0.5)
+ {
+ int its = int(max(1.0,(sc*3.7)));
+ for (int i=0; i<its; ++i)
+ {
+ float ang = sc+i*2*PI/its; // sc is added for rotary perturbance
+ float samp_x = sc*sin(ang);
+ float samp_y = sc*cos(ang);
+ // you could test sample coords against an interesting non-circular aperture shape here, if desired.
+ dofSample(diff, w, sc, vary_fragcoord.xy + (vec2(samp_x,samp_y) / screen_res));
+ }
+ sc -= 1.0;
+ }
+ }
+
+ diff /= w;
+ }
+
+ frag_color = diff;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 3443785e1a..7a25f63260 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file postDeferredGammaCorrect.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -79,7 +79,7 @@ vec3 RRTAndODTFit(vec3 color)
}
-// tone mapping
+// tone mapping
vec3 toneMapACES_Hill(vec3 color)
{
color = ACESInputMat * color;
@@ -102,7 +102,7 @@ vec3 toneMap(vec3 color)
{
#ifndef NO_POST
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
-
+
color *= exposure * exp_scale;
// mix ACES and Linear here as a compromise to avoid over-darkening legacy content
@@ -116,38 +116,38 @@ vec3 toneMap(vec3 color)
//=================================
// borrowed noise from:
-// <https://www.shadertoy.com/view/4dS3Wd>
-// By Morgan McGuire @morgan3d, http://graphicscodex.com
+// <https://www.shadertoy.com/view/4dS3Wd>
+// By Morgan McGuire @morgan3d, http://graphicscodex.com
//
float hash(float n) { return fract(sin(n) * 1e4); }
float hash(vec2 p) { return fract(1e4 * sin(17.0 * p.x + p.y * 0.1) * (0.1 + abs(sin(p.y * 13.0 + p.x)))); }
float noise(float x) {
- float i = floor(x);
- float f = fract(x);
- float u = f * f * (3.0 - 2.0 * f);
- return mix(hash(i), hash(i + 1.0), u);
+ float i = floor(x);
+ float f = fract(x);
+ float u = f * f * (3.0 - 2.0 * f);
+ return mix(hash(i), hash(i + 1.0), u);
}
float noise(vec2 x) {
- vec2 i = floor(x);
- vec2 f = fract(x);
-
- // Four corners in 2D of a tile
- float a = hash(i);
- float b = hash(i + vec2(1.0, 0.0));
- float c = hash(i + vec2(0.0, 1.0));
- float d = hash(i + vec2(1.0, 1.0));
-
- // Simple 2D lerp using smoothstep envelope between the values.
- // return vec3(mix(mix(a, b, smoothstep(0.0, 1.0, f.x)),
- // mix(c, d, smoothstep(0.0, 1.0, f.x)),
- // smoothstep(0.0, 1.0, f.y)));
-
- // Same code, with the clamps in smoothstep and common subexpressions
- // optimized away.
- vec2 u = f * f * (3.0 - 2.0 * f);
- return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
+ vec2 i = floor(x);
+ vec2 f = fract(x);
+
+ // Four corners in 2D of a tile
+ float a = hash(i);
+ float b = hash(i + vec2(1.0, 0.0));
+ float c = hash(i + vec2(0.0, 1.0));
+ float d = hash(i + vec2(1.0, 1.0));
+
+ // Simple 2D lerp using smoothstep envelope between the values.
+ // return vec3(mix(mix(a, b, smoothstep(0.0, 1.0, f.x)),
+ // mix(c, d, smoothstep(0.0, 1.0, f.x)),
+ // smoothstep(0.0, 1.0, f.y)));
+
+ // Same code, with the clamps in smoothstep and common subexpressions
+ // optimized away.
+ vec2 u = f * f * (3.0 - 2.0 * f);
+ return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
}
//=============================
@@ -161,7 +161,7 @@ vec3 legacyGamma(vec3 color)
return c;
}
-void main()
+void main()
{
//this is the one of the rare spots where diffuseRect contains linear color values (not sRGB)
vec4 diff = texture(diffuseRect, vary_fragcoord);
@@ -180,7 +180,7 @@ void main()
vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y);
vec3 nz = vec3(noise(seed.rg), noise(seed.gb), noise(seed.rb));
diff.rgb += nz*0.003;
-
+
frag_color = max(diff, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
index bace9b8c90..07384ebe9b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file postDeferredNoDoFF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -33,11 +33,11 @@ uniform sampler2D depthMap;
uniform vec2 screen_res;
in vec2 vary_fragcoord;
-void main()
+void main()
{
- vec4 diff = texture(diffuseRect, vary_fragcoord.xy);
-
- frag_color = diff;
+ vec4 diff = texture(diffuseRect, vary_fragcoord.xy);
+
+ frag_color = diff;
gl_FragDepth = texture(depthMap, vary_fragcoord.xy).r;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl
index 7e8a5d68d4..87f28621ae 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file postDeferredV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,8 +31,8 @@ uniform vec2 screen_res;
void main()
{
- //transform vertex
- vec4 pos = vec4(position.xyz, 1.0);
- gl_Position = pos;
- vary_fragcoord = (pos.xy*0.5+0.5);
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
+ gl_Position = pos;
+ vary_fragcoord = (pos.xy*0.5+0.5);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
index 10b4b3e76c..09fe443e2d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file postDeferredV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,9 +34,9 @@ uniform vec2 screen_res;
void main()
{
- //transform vertex
- vec4 pos = vec4(position.xyz, 1.0);
- gl_Position = pos;
- vary_tc = (pos.xy*0.5+0.5)*tc_scale;
- vary_fragcoord = (pos.xy*0.5+0.5);
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
+ gl_Position = pos;
+ vary_tc = (pos.xy*0.5+0.5)*tc_scale;
+ vary_fragcoord = (pos.xy*0.5+0.5);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredVisualizeBuffers.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredVisualizeBuffers.glsl
index 2c17de311c..a539d5af90 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredVisualizeBuffers.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredVisualizeBuffers.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file postDeferredNoDoFF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -32,10 +32,10 @@ uniform float mipLevel;
in vec2 vary_fragcoord;
-void main()
+void main()
{
- vec4 diff = textureLod(diffuseRect, vary_fragcoord.xy, mipLevel);
-
- frag_color = diff;
+ vec4 diff = textureLod(diffuseRect, vary_fragcoord.xy, mipLevel);
+
+ frag_color = diff;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
index 1a85d70256..cf0595ee45 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl
@@ -25,7 +25,7 @@
// debug stub
-float random (vec2 uv)
+float random (vec2 uv)
{
return 0;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
index a8febabcc6..9db8f461dd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file shadowAlphaMaskF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,9 +35,9 @@ in vec4 vertex_color;
in vec2 vary_texcoord0;
uniform float minimum_alpha;
-void main()
+void main()
{
- float alpha = diffuseLookup(vary_texcoord0.xy).a;
+ float alpha = diffuseLookup(vary_texcoord0.xy).a;
if (alpha < minimum_alpha)
{
@@ -61,5 +61,5 @@ void main()
}
}
- frag_color = vec4(1,1,1,1);
+ frag_color = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
index 26db1a5d4d..665ff6d3df 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file shadowAlphaMaskV.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,26 +47,26 @@ void passTextureIndex();
void main()
{
- //transform vertex
+ //transform vertex
#if defined(HAS_SKIN)
- vec4 pre_pos = vec4(position.xyz, 1.0);
- mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
- vec4 pos = mat * pre_pos;
- pos = projection_matrix * pos;
+ vec4 pre_pos = vec4(position.xyz, 1.0);
+ mat4 mat = getObjectSkinnedTransform();
+ mat = modelview_matrix * mat;
+ vec4 pos = mat * pre_pos;
+ pos = projection_matrix * pos;
#else
- vec4 pre_pos = vec4(position.xyz, 1.0);
- vec4 pos = modelview_projection_matrix * pre_pos;
+ vec4 pre_pos = vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * pre_pos;
#endif
- target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x;
+ target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x;
+
+ post_pos = pos;
- post_pos = pos;
+ gl_Position = pos;
- gl_Position = pos;
-
- passTextureIndex();
+ passTextureIndex();
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
- vertex_color = diffuse_color;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl
index 0f5f9ed289..1c169b3cc9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file shadowCubeV.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,9 +32,9 @@ uniform vec3 box_size;
void main()
{
- //transform vertex
- vec3 p = position*box_size+box_center;
- vec4 pos = modelview_projection_matrix*vec4(p.xyz, 1.0);
+ //transform vertex
+ vec3 p = position*box_size+box_center;
+ vec4 pos = modelview_projection_matrix*vec4(p.xyz, 1.0);
- gl_Position = pos;
+ gl_Position = pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
index 370aa75d04..b55d769fd6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
@@ -1,31 +1,31 @@
-/**
+/**
* @file shadowF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
out vec4 frag_color;
-void main()
+void main()
{
- frag_color = vec4(1,1,1,1);
+ frag_color = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl
index 9bbc63bce1..1485ea9121 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file shadowSkinnedV.glsl
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,12 +32,12 @@ mat4 getObjectSkinnedTransform();
void main()
{
- //transform vertex
- mat4 mat = getObjectSkinnedTransform();
-
- mat = modelview_matrix * mat;
- vec4 pos = (mat*vec4(position.xyz, 1.0));
- pos = projection_matrix*pos;
+ //transform vertex
+ mat4 mat = getObjectSkinnedTransform();
+
+ mat = modelview_matrix * mat;
+ vec4 pos = (mat*vec4(position.xyz, 1.0));
+ pos = projection_matrix*pos;
- gl_Position = pos;
+ gl_Position = pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
index ee3a5f1f31..16cc7cfbbc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1/deferred/shadowUtil.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -83,7 +83,7 @@ float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2
vec2 off = 1.0/proj_shadow_res;
off.y *= 1.5;
-
+
shadow += texture(shadowMap, stc.xyz+vec3(off.x*2.0, off.y, 0.0));
shadow += texture(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0));
shadow += texture(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0));
@@ -112,7 +112,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
vec4 spos = vec4(shadow_pos.xyz, 1.0);
if (spos.z > -shadow_clip.w)
- {
+ {
vec4 lpos;
vec4 near_split = shadow_clip*-0.75;
vec4 far_split = shadow_clip*-1.25;
@@ -122,7 +122,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
if (spos.z < near_split.z)
{
lpos = shadow_matrix[3]*spos;
-
+
float w = 1.0;
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
//w = clamp(w, 0.0, 1.0);
@@ -138,7 +138,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
if (spos.z < near_split.y && spos.z > far_split.z)
{
lpos = shadow_matrix[2]*spos;
-
+
float w = 1.0;
w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
@@ -154,7 +154,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
if (spos.z < near_split.x && spos.z > far_split.y)
{
lpos = shadow_matrix[1]*spos;
-
+
float w = 1.0;
w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
@@ -170,7 +170,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
if (spos.z > far_split.x)
{
lpos = shadow_matrix[0]*spos;
-
+
float w = 1.0;
w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
//w = clamp(w, 0.0, 1.0);
@@ -203,9 +203,9 @@ float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen)
vec4 spos = vec4(pos,1.0);
if (spos.z > -shadow_clip.w)
- {
+ {
vec4 lpos;
-
+
vec4 near_split = shadow_clip*-0.75;
vec4 far_split = shadow_clip*-1.25;
vec4 transition_domain = near_split-far_split;
@@ -216,7 +216,7 @@ float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen)
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
if (index == 0)
- {
+ {
lpos = shadow_matrix[4]*spos;
shadow += pcfSpotShadow(shadowMap4, lpos, 0.8, spos.xy)*w;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
index bd62954ff8..5e1c502822 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file shadowV.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,6 +29,6 @@ in vec3 position;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ //transform vertex
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index 9d9ba49d82..a07a4301bc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1/deferred/skyF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -71,9 +71,9 @@ vec3 halo22(float d)
void main()
{
- // Potential Fill-rate optimization. Add cloud calculation
- // back in and output alpha of 0 (so that alpha culling kills
- // the fragment) if the sky wouldn't show up because the clouds
+ // Potential Fill-rate optimization. Add cloud calculation
+ // back in and output alpha of 0 (so that alpha culling kills
+ // the fragment) if the sky wouldn't show up because the clouds
// are fully opaque.
vec3 color = vary_HazeColor;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
index 17ce2dee5b..6110b6ade0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
@@ -92,7 +92,7 @@ void main()
// Initialize temp variables
vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color * 0.7; //magic 0.7 to match legacy color
-
+
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y);
@@ -142,7 +142,7 @@ void main()
sunlight *= max(0.0, (1. - cloud_shadow));
// Haze color below cloud
- vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient)
+ vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient)
+ (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient));
// Attenuate cloud color by atmosphere
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
index b35d10c8a0..6f45adc68d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file starsF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,15 +44,15 @@ float twinkle(){
// See:
// ALM off: class1/environment/starsF.glsl
// ALM on : class1/deferred/starsF.glsl
-void main()
+void main()
{
- // camera above water: class1\deferred\starsF.glsl
- // camera below water: class1\environment\starsF.glsl
+ // camera above water: class1\deferred\starsF.glsl
+ // camera below water: class1\environment\starsF.glsl
vec4 col_a = texture(diffuseMap, vary_texcoord0.xy);
vec4 col_b = texture(diffuseMap, vary_texcoord0.xy);
vec4 col = mix(col_b, col_a, blend_factor);
col.rgb *= vertex_color.rgb;
-
+
float factor = smoothstep(0.0f, 0.9f, custom_alpha);
col.a = (col.a * factor) * 32.0f;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
index 726508607d..97ee437870 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file starsV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,18 +37,18 @@ out vec2 screenpos;
void main()
{
- //transform vertex
+ //transform vertex
vec4 pos = modelview_projection_matrix * vec4(position, 1.0);
-
- // smash to far clip plane to
+
+ // smash to far clip plane to
// avoid rendering on top of moon (do NOT write to gl_FragDepth, it's slow)
pos.z = pos.w;
- gl_Position = pos;
+ gl_Position = pos;
float t = mod(time, 1.25f);
screenpos = position.xy * vec2(t, t);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
- vertex_color = diffuse_color;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
index fd343ed2dc..e3441add35 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file sunDiscF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_data[4];
@@ -35,7 +35,7 @@ uniform float blend_factor; // interp factor between sunDisc A/B
in vec2 vary_texcoord0;
in float sun_fade;
-void main()
+void main()
{
vec4 sunDiscA = texture(diffuseMap, vary_texcoord0.xy);
vec4 sunDiscB = texture(altDiffuseMap, vary_texcoord0.xy);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl
index 9a8d791a1d..ef45e6ab32 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file sunDiscV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,7 +47,7 @@ void main()
// smash to *almost* far clip plane -- behind clouds but in front of stars
pos.z = pos.w*0.999999;
gl_Position = pos;
-
+
calcAtmospherics(pos.xyz);
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
index f6d509e2c6..bee9e6d2fe 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file class1\deferred\terrainF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_data[4];
@@ -43,7 +43,7 @@ vec2 encode_normal(vec3 n);
void main()
{
/// Note: This should duplicate the blending functionality currently used for the terrain rendering.
-
+
vec4 color0 = texture(detail_0, vary_texcoord0.xy);
vec4 color1 = texture(detail_1, vary_texcoord0.xy);
vec4 color2 = texture(detail_2, vary_texcoord0.xy);
@@ -53,9 +53,9 @@ void main()
float alpha2 = texture(alpha_ramp,vary_texcoord1.xy).a;
float alphaFinal = texture(alpha_ramp, vary_texcoord1.zw).a;
vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
-
- outColor.a = 0.0; // yes, downstream atmospherics
-
+
+ outColor.a = 0.0; // yes, downstream atmospherics
+
frag_data[0] = outColor;
frag_data[1] = vec4(0.0,0.0,0.0,-1.0);
vec3 nvn = normalize(vary_normal);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
index f6d3b59e85..aab2abff1e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1\environment\terrainV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,15 +44,15 @@ uniform vec4 object_plane_t;
vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
{
vec4 tcoord;
-
+
tcoord.x = dot(vpos, tp0);
tcoord.y = dot(vpos, tp1);
tcoord.z = tc.z;
tcoord.w = tc.w;
-
- tcoord = mat * tcoord;
-
- return tcoord;
+
+ tcoord = mat * tcoord;
+
+ return tcoord;
}
void main()
@@ -65,12 +65,12 @@ void main()
pos = t_pos.xyz;
vary_normal = normalize(normal_matrix * normal);
-
+
// Transform and pass tex coords
vary_texcoord0.xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy;
-
+
vec4 t = vec4(texcoord1,0,1);
-
+
vary_texcoord0.zw = t.xy;
vary_texcoord1.xy = t.xy-vec2(2.0, 0.0);
vary_texcoord1.zw = t.xy-vec2(1.0, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl b/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl
index 636dfed4ba..8e641522e3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/textureUtilV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1/deferred/textureUtilV.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
index e2d87e68fa..db6070f328 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file treeF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,17 +37,17 @@ uniform float minimum_alpha;
vec2 encode_normal(vec3 n);
-void main()
+void main()
{
- vec4 col = texture(diffuseMap, vary_texcoord0.xy);
- if (col.a < minimum_alpha)
- {
- discard;
- }
-
- frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0);
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy);
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0);
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
index 7dcab640f2..33a5efa45d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file treeShadowF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,14 +34,14 @@ uniform sampler2D diffuseMap;
in vec2 vary_texcoord0;
-void main()
+void main()
{
- float alpha = texture(diffuseMap, vary_texcoord0.xy).a;
+ float alpha = texture(diffuseMap, vary_texcoord0.xy).a;
- if (alpha < minimum_alpha)
- {
- discard;
- }
+ if (alpha < minimum_alpha)
+ {
+ discard;
+ }
- frag_color = vec4(1,1,1,1);
+ frag_color = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl
index f5192c3009..f2c80072dc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file treeShadowV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -26,7 +26,7 @@
uniform mat4 texture_matrix0;
uniform mat4 modelview_matrix;
uniform mat4 projection_matrix;
-
+
in vec3 position;
in vec2 texcoord0;
@@ -36,13 +36,13 @@ mat4 getObjectSkinnedTransform();
void main()
{
- //transform vertex
+ //transform vertex
mat4 mat = getObjectSkinnedTransform();
-
- mat = modelview_matrix * mat;
-
- vec4 pos = mat * vec4(position.xyz, 1.0);
+
+ mat = modelview_matrix * mat;
+
+ vec4 pos = mat * vec4(position.xyz, 1.0);
gl_Position = projection_matrix * pos;
-
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
index 3102c870fc..8f359a0a3d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
@@ -1,31 +1,31 @@
-/**
+/**
* @file treeShadowV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
uniform mat4 texture_matrix0;
uniform mat4 modelview_projection_matrix;
-
+
in vec3 position;
in vec2 texcoord0;
@@ -33,8 +33,8 @@ out vec2 vary_texcoord0;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
-
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ //transform vertex
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
index ce8a10712c..81900fba70 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file treeV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,11 +37,11 @@ out vec2 vary_texcoord0;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- vary_normal = normalize(normal_matrix * normal);
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ vary_normal = normalize(normal_matrix * normal);
- vertex_color = vec4(1,1,1,1);
+ vertex_color = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
index b5437d43d2..72eda80716 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file glowExtractF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -42,12 +42,12 @@ in vec2 vary_texcoord0;
void main()
{
- vec4 col = texture(diffuseMap, vary_texcoord0.xy);
- /// CALCULATING LUMINANCE (Using NTSC lum weights)
- /// http://en.wikipedia.org/wiki/Luma_%28video%29
- float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) );
- float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) );
-
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy);
+ /// CALCULATING LUMINANCE (Using NTSC lum weights)
+ /// http://en.wikipedia.org/wiki/Luma_%28video%29
+ float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) );
+ float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) );
+
#if HAS_NOISE
float TRUE_NOISE_RES = 128; // See mTrueNoiseMap
// *NOTE: Usually this is vary_fragcoord not vary_texcoord0, but glow extraction is in screen space
@@ -57,7 +57,7 @@ void main()
col.rgb += glow_noise / NOISE_DEPTH;
col.rgb = max(col.rgb, vec3(0));
#endif
- frag_color.rgb = col.rgb;
- frag_color.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha);
-
+ frag_color.rgb = col.rgb;
+ frag_color.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha);
+
}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
index ccda75596d..209c3081fb 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file glowExtractV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,9 +29,9 @@ in vec3 position;
out vec2 vary_texcoord0;
-void main()
+void main()
{
- gl_Position = vec4(position, 1.0);
-
- vary_texcoord0.xy = position.xy * 0.5 + 0.5;
+ gl_Position = vec4(position, 1.0);
+
+ vary_texcoord0.xy = position.xy * 0.5 + 0.5;
}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
index 8718dd8b52..ce17dcf810 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file glowF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
out vec4 frag_color;
uniform sampler2D diffuseMap;
@@ -36,21 +36,21 @@ in vec4 vary_texcoord3;
void main()
{
- vec4 col = vec4(0.0, 0.0, 0.0, 0.0);
-
- // ATI compiler falls down on array initialization.
- float kern[8];
- kern[0] = 0.25; kern[1] = 0.5; kern[2] = 0.8; kern[3] = 1.0;
- kern[4] = 1.0; kern[5] = 0.8; kern[6] = 0.5; kern[7] = 0.25;
-
- col += kern[0] * texture(diffuseMap, vary_texcoord0.xy);
- col += kern[1] * texture(diffuseMap, vary_texcoord1.xy);
- col += kern[2] * texture(diffuseMap, vary_texcoord2.xy);
- col += kern[3] * texture(diffuseMap, vary_texcoord3.xy);
- col += kern[4] * texture(diffuseMap, vary_texcoord0.zw);
- col += kern[5] * texture(diffuseMap, vary_texcoord1.zw);
- col += kern[6] * texture(diffuseMap, vary_texcoord2.zw);
- col += kern[7] * texture(diffuseMap, vary_texcoord3.zw);
-
- frag_color = max(vec4(col.rgb * glowStrength, col.a), vec4(0));
+ vec4 col = vec4(0.0, 0.0, 0.0, 0.0);
+
+ // ATI compiler falls down on array initialization.
+ float kern[8];
+ kern[0] = 0.25; kern[1] = 0.5; kern[2] = 0.8; kern[3] = 1.0;
+ kern[4] = 1.0; kern[5] = 0.8; kern[6] = 0.5; kern[7] = 0.25;
+
+ col += kern[0] * texture(diffuseMap, vary_texcoord0.xy);
+ col += kern[1] * texture(diffuseMap, vary_texcoord1.xy);
+ col += kern[2] * texture(diffuseMap, vary_texcoord2.xy);
+ col += kern[3] * texture(diffuseMap, vary_texcoord3.xy);
+ col += kern[4] * texture(diffuseMap, vary_texcoord0.zw);
+ col += kern[5] * texture(diffuseMap, vary_texcoord1.zw);
+ col += kern[6] * texture(diffuseMap, vary_texcoord2.zw);
+ col += kern[7] * texture(diffuseMap, vary_texcoord3.zw);
+
+ frag_color = max(vec4(col.rgb * glowStrength, col.a), vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
index 60ec4e6f3b..a824c69f0c 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file glowV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
uniform mat4 modelview_projection_matrix;
in vec3 position;
@@ -34,19 +34,19 @@ out vec4 vary_texcoord1;
out vec4 vary_texcoord2;
out vec4 vary_texcoord3;
-void main()
+void main()
{
- gl_Position = vec4(position, 1.0);
-
- vec2 texcoord = position.xy * 0.5 + 0.5;
-
-
- vary_texcoord0.xy = texcoord + glowDelta*(-3.5);
- vary_texcoord1.xy = texcoord + glowDelta*(-2.5);
- vary_texcoord2.xy = texcoord + glowDelta*(-1.5);
- vary_texcoord3.xy = texcoord + glowDelta*(-0.5);
- vary_texcoord0.zw = texcoord + glowDelta*(0.5);
- vary_texcoord1.zw = texcoord + glowDelta*(1.5);
- vary_texcoord2.zw = texcoord + glowDelta*(2.5);
- vary_texcoord3.zw = texcoord + glowDelta*(3.5);
+ gl_Position = vec4(position, 1.0);
+
+ vec2 texcoord = position.xy * 0.5 + 0.5;
+
+
+ vary_texcoord0.xy = texcoord + glowDelta*(-3.5);
+ vary_texcoord1.xy = texcoord + glowDelta*(-2.5);
+ vary_texcoord2.xy = texcoord + glowDelta*(-1.5);
+ vary_texcoord3.xy = texcoord + glowDelta*(-0.5);
+ vary_texcoord0.zw = texcoord + glowDelta*(0.5);
+ vary_texcoord1.zw = texcoord + glowDelta*(1.5);
+ vary_texcoord2.zw = texcoord + glowDelta*(2.5);
+ vary_texcoord3.zw = texcoord + glowDelta*(3.5);
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl b/indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl
index 6cd2445522..ca3e4f6718 100644
--- a/indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/encodeNormF.glsl
@@ -4,21 +4,21 @@
* $LicenseInfo:firstyear=2018&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2018, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,7 +28,7 @@
// Also see: A_bit_more_deferred_-_CryEngine3.ppt
vec2 encode_normal(vec3 n)
{
- float f = sqrt(8 * n.z + 8);
- return n.xy / f + 0.5;
+ float f = sqrt(8 * n.z + 8);
+ return n.xy / f + 0.5;
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
index e3fd10447e..7e1d906878 100644
--- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file srgbF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,37 +27,37 @@
vec3 srgb_to_linear(vec3 cs)
{
- vec3 low_range = cs / vec3(12.92);
- vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
- bvec3 lte = lessThanEqual(cs,vec3(0.04045));
+ vec3 low_range = cs / vec3(12.92);
+ vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
+ bvec3 lte = lessThanEqual(cs,vec3(0.04045));
#ifdef OLD_SELECT
- vec3 result;
- result.r = lte.r ? low_range.r : high_range.r;
- result.g = lte.g ? low_range.g : high_range.g;
- result.b = lte.b ? low_range.b : high_range.b;
+ vec3 result;
+ result.r = lte.r ? low_range.r : high_range.r;
+ result.g = lte.g ? low_range.g : high_range.g;
+ result.b = lte.b ? low_range.b : high_range.b;
return result;
#else
- return mix(high_range, low_range, lte);
+ return mix(high_range, low_range, lte);
#endif
}
vec3 linear_to_srgb(vec3 cl)
{
- cl = clamp(cl, vec3(0), vec3(1));
- vec3 low_range = cl * 12.92;
- vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
- bvec3 lt = lessThan(cl,vec3(0.0031308));
+ cl = clamp(cl, vec3(0), vec3(1));
+ vec3 low_range = cl * 12.92;
+ vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
+ bvec3 lt = lessThan(cl,vec3(0.0031308));
#ifdef OLD_SELECT
- vec3 result;
- result.r = lt.r ? low_range.r : high_range.r;
- result.g = lt.g ? low_range.g : high_range.g;
- result.b = lt.b ? low_range.b : high_range.b;
+ vec3 result;
+ result.r = lt.r ? low_range.r : high_range.r;
+ result.g = lt.g ? low_range.g : high_range.g;
+ result.b = lt.b ? low_range.b : high_range.b;
return result;
#else
- return mix(high_range, low_range, lt);
+ return mix(high_range, low_range, lt);
#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
index 075397d96c..9f94bf57fc 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file waterF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
index f796bb5f3f..20b61e9302 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -4,25 +4,25 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
uniform vec4 waterPlane;
@@ -44,30 +44,30 @@ vec4 getWaterFogViewNoClip(vec3 pos)
float es = -(dot(view, waterPlane.xyz));
//find intersection point with water plane and eye vector
-
+
//get eye depth
float e0 = max(-waterPlane.w, 0.0);
-
+
vec3 int_v = waterPlane.w > 0.0 ? view * waterPlane.w/es : vec3(0.0, 0.0, 0.0);
-
+
//get object depth
float depth = length(pos - int_v);
-
+
//get "thickness" of water
float l = max(depth, 0.1);
float kd = waterFogDensity;
float ks = waterFogKS;
vec4 kc = waterFogColor;
-
+
float F = 0.98;
-
+
float t1 = -kd * pow(F, ks * e0);
float t2 = kd + ks * es;
float t3 = pow(F, t2*l) - 1.0;
-
+
float L = min(t1/t2*t3, 1.0);
-
+
float D = pow(0.98, l*kd);
return vec4(srgb_to_linear(kc.rgb*L), D);
@@ -86,7 +86,7 @@ vec4 getWaterFogView(vec3 pos)
vec4 applyWaterFogView(vec3 pos, vec4 color)
{
vec4 fogged = getWaterFogView(pos);
-
+
color.rgb = color.rgb * fogged.a + fogged.rgb;
return color;
@@ -120,7 +120,7 @@ vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color)
if (eye_above_water)
{
if (!obj_above_water)
- {
+ {
color.rgb = applyWaterFogViewLinearNoClip(pos, color).rgb;
}
else
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
index 5a3845b1a3..33f35aff2d 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1\environment\waterV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,62 +48,62 @@ out vec3 vary_tangent;
out vec3 vary_normal;
out vec2 vary_fragcoord;
-float wave(vec2 v, float t, float f, vec2 d, float s)
+float wave(vec2 v, float t, float f, vec2 d, float s)
{
return (dot(d, v)*f + t*s)*f;
}
void main()
{
- //transform vertex
- vec4 pos = vec4(position.xyz, 1.0);
- mat4 modelViewProj = modelview_projection_matrix;
-
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
+ mat4 modelViewProj = modelview_projection_matrix;
+
vary_position = (modelview_matrix * pos).xyz;
vary_light_dir = normal_matrix * lightDir;
vary_normal = normal_matrix * vec3(0, 0, 1);
vary_tangent = normal_matrix * vec3(1, 0, 0);
- vec4 oPosition;
-
- //get view vector
- vec3 oEyeVec;
- oEyeVec.xyz = pos.xyz-eyeVec;
-
- float d = length(oEyeVec.xy);
- float ld = min(d, 2560.0);
-
- pos.xy = eyeVec.xy + oEyeVec.xy/d*ld;
- view.xyz = oEyeVec;
-
- d = clamp(ld/1536.0-0.5, 0.0, 1.0);
- d *= d;
-
- oPosition = vec4(position, 1.0);
-// oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); // SL-11589 remove "U" shaped horizon
-
- oPosition = modelViewProj * oPosition;
-
- refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
-
- //get wave position parameter (create sweeping horizontal waves)
- vec3 v = pos.xyz;
- v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0;
-
- //push position for further horizon effect.
- pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
- pos.w = 1.0;
- pos = modelview_matrix*pos;
-
- calcAtmospherics(pos.xyz);
-
- //pass wave parameters to pixel shader
- vec2 bigWave = (v.xy) * vec2(0.04,0.04) + waveDir1 * time * 0.055;
- //get two normal map (detail map) texture coordinates
- littleWave.xy = (v.xy) * vec2(0.45, 0.9) + waveDir2 * time * 0.13;
- littleWave.zw = (v.xy) * vec2(0.1, 0.2) + waveDir1 * time * 0.1;
- view.w = bigWave.y;
- refCoord.w = bigWave.x;
-
- gl_Position = oPosition;
+ vec4 oPosition;
+
+ //get view vector
+ vec3 oEyeVec;
+ oEyeVec.xyz = pos.xyz-eyeVec;
+
+ float d = length(oEyeVec.xy);
+ float ld = min(d, 2560.0);
+
+ pos.xy = eyeVec.xy + oEyeVec.xy/d*ld;
+ view.xyz = oEyeVec;
+
+ d = clamp(ld/1536.0-0.5, 0.0, 1.0);
+ d *= d;
+
+ oPosition = vec4(position, 1.0);
+// oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); // SL-11589 remove "U" shaped horizon
+
+ oPosition = modelViewProj * oPosition;
+
+ refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
+
+ //get wave position parameter (create sweeping horizontal waves)
+ vec3 v = pos.xyz;
+ v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0;
+
+ //push position for further horizon effect.
+ pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
+ pos.w = 1.0;
+ pos = modelview_matrix*pos;
+
+ calcAtmospherics(pos.xyz);
+
+ //pass wave parameters to pixel shader
+ vec2 bigWave = (v.xy) * vec2(0.04,0.04) + waveDir1 * time * 0.055;
+ //get two normal map (detail map) texture coordinates
+ littleWave.xy = (v.xy) * vec2(0.45, 0.9) + waveDir2 * time * 0.13;
+ littleWave.zw = (v.xy) * vec2(0.1, 0.2) + waveDir1 * time * 0.1;
+ view.w = bigWave.y;
+ refCoord.w = bigWave.x;
+
+ gl_Position = oPosition;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl b/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl
index a46e91c394..18fdf6be25 100644
--- a/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file alphamaskF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,13 +32,13 @@ uniform float minimum_alpha;
in vec2 vary_texcoord0;
in vec4 vertex_color;
-void main()
+void main()
{
- vec4 col = vertex_color*texture(diffuseMap, vary_texcoord0.xy);
- if (col.a < minimum_alpha)
- {
- discard;
- }
+ vec4 col = vertex_color*texture(diffuseMap, vary_texcoord0.xy);
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
- frag_color = max(col, vec4(0));
+ frag_color = max(col, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/alphamaskV.glsl b/indra/newview/app_settings/shaders/class1/interface/alphamaskV.glsl
index a8dac55130..0306d5fc5a 100644
--- a/indra/newview/app_settings/shaders/class1/interface/alphamaskV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/alphamaskV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file alphamaskV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,8 +35,8 @@ out vec2 vary_texcoord0;
void main()
{
- gl_Position = modelview_projection_matrix * vec4(position, 1);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
- vertex_color = diffuse_color;
+ gl_Position = modelview_projection_matrix * vec4(position, 1);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/benchmarkF.glsl b/indra/newview/app_settings/shaders/class1/interface/benchmarkF.glsl
index 06b19c22c9..748a789bc1 100644
--- a/indra/newview/app_settings/shaders/class1/interface/benchmarkF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/benchmarkF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file benchmarkF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,7 +29,7 @@ uniform sampler2D diffuseMap;
in vec2 tc0;
-void main()
+void main()
{
- frag_color = texture(diffuseMap, tc0);
+ frag_color = texture(diffuseMap, tc0);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/benchmarkV.glsl b/indra/newview/app_settings/shaders/class1/interface/benchmarkV.glsl
index cbcc6bef97..9bf6d140d9 100644
--- a/indra/newview/app_settings/shaders/class1/interface/benchmarkV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/benchmarkV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file benchmarkV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,8 +31,8 @@ out vec2 tc0;
void main()
{
- gl_Position = vec4(position, 1.0);
-
- tc0 = (position.xy*0.5+0.5);
+ gl_Position = vec4(position, 1.0);
+
+ tc0 = (position.xy*0.5+0.5);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/clipF.glsl b/indra/newview/app_settings/shaders/class1/interface/clipF.glsl
index ee2d652f32..1b5415da3f 100644
--- a/indra/newview/app_settings/shaders/class1/interface/clipF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/clipF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file debugF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,12 +31,12 @@ uniform vec4 clip_plane;
in vec3 vary_position;
-void main()
+void main()
{
- if (dot(vary_position,clip_plane.xyz)+clip_plane.w < 0.0)
- {
- discard;
- }
+ if (dot(vary_position,clip_plane.xyz)+clip_plane.w < 0.0)
+ {
+ discard;
+ }
- frag_color = max(color, vec4(0));
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/clipV.glsl b/indra/newview/app_settings/shaders/class1/interface/clipV.glsl
index 7dd2ef593f..e9a8444bb8 100644
--- a/indra/newview/app_settings/shaders/class1/interface/clipV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/clipV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file debugV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,7 +32,7 @@ out vec3 vary_position;
void main()
{
- vary_position = (modelview_matrix*vec4(position.xyz,1.0)).xyz;
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_position = (modelview_matrix*vec4(position.xyz,1.0)).xyz;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/copyF.glsl b/indra/newview/app_settings/shaders/class1/interface/copyF.glsl
index 65d3c20091..edaa2488f0 100644
--- a/indra/newview/app_settings/shaders/class1/interface/copyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/copyF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file copyF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@ uniform sampler2D diffuseMap;
out vec4 frag_color;
-void main()
+void main()
{
frag_color = texture(diffuseMap, tc);
#if defined(COPY_DEPTH)
diff --git a/indra/newview/app_settings/shaders/class1/interface/copyV.glsl b/indra/newview/app_settings/shaders/class1/interface/copyV.glsl
index ace5da6578..e8cc189c61 100644
--- a/indra/newview/app_settings/shaders/class1/interface/copyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/copyV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file copyV.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
in vec3 position;
out vec2 tc;
-void main()
+void main()
{
tc = position.xy * 0.5 + 0.5;
gl_Position = vec4(position, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/interface/debugF.glsl b/indra/newview/app_settings/shaders/class1/interface/debugF.glsl
index cefa429639..f863d1ad20 100644
--- a/indra/newview/app_settings/shaders/class1/interface/debugF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/debugF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file debugF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@ out vec4 frag_color;
uniform vec4 color;
-void main()
+void main()
{
- frag_color = max(color, vec4(0));
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
index 2e32863109..82d1b6ca04 100644
--- a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file debugV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,7 +41,7 @@ void main()
vec4 pos = mat * vec4(position.xyz,1.0);
gl_Position = projection_matrix * pos;
#else
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/gaussianF.glsl b/indra/newview/app_settings/shaders/class1/interface/gaussianF.glsl
index eca591d387..09eb7a6a6a 100644
--- a/indra/newview/app_settings/shaders/class1/interface/gaussianF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/gaussianF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file gaussianF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,12 +37,12 @@ in vec2 vary_texcoord0;
// get linear depth value given a depth buffer sample d and znear and zfar values
float linearDepth(float d, float znear, float zfar);
-void main()
+void main()
{
vec3 col = vec3(0,0,0);
float w[9] = float[9]( 0.0002, 0.0060, 0.0606, 0.2417, 0.3829, 0.2417, 0.0606, 0.0060, 0.0002 );
-
+
for (int i = 0; i < 9; ++i)
{
vec2 tc = vary_texcoord0 + (i-4)*direction*resScale;
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
index fa8aa5c7fe..ca000dcb23 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file glowcombineF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,7 +32,7 @@ uniform sampler2D emissiveRect;
in vec2 tc;
-void main()
+void main()
{
- frag_color = texture(diffuseRect, tc) + texture(emissiveRect, tc);
+ frag_color = texture(diffuseRect, tc) + texture(emissiveRect, tc);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
index 3d4035620f..6d34c8aefa 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file glowcombineFXAAF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -33,9 +33,9 @@ uniform vec2 screen_res;
in vec2 vary_tc;
-void main()
+void main()
{
vec3 col = texture(diffuseRect, vary_tc).rgb;
-
+
frag_color = vec4(col.rgb, dot(col.rgb, vec3(0.299, 0.587, 0.144)));
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
index fa67b13e4d..780624a402 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file glowcombineFXAAV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,9 +30,9 @@ out vec2 vary_tc;
void main()
{
- vec4 pos = vec4(position.xyz, 1.0);
- gl_Position = pos;
+ vec4 pos = vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vary_tc = pos.xy*0.5+0.5;
+ vary_tc = pos.xy*0.5+0.5;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
index 8fa08a18c3..03b70b6c47 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file glowcombineV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
index 9bba1b2e18..c70acf4cde 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file highlightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
out vec4 frag_color;
uniform vec4 color;
@@ -30,7 +30,7 @@ uniform sampler2D diffuseMap;
in vec2 vary_texcoord0;
-void main()
+void main()
{
- frag_color = max(color*texture(diffuseMap, vary_texcoord0.xy), vec4(0));
+ frag_color = max(color*texture(diffuseMap, vary_texcoord0.xy), vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightNormV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightNormV.glsl
index 0253c7236d..993bfe1a30 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightNormV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightNormV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file highlightV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,8 +35,8 @@ out vec2 vary_texcoord0;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightSpecV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightSpecV.glsl
index 9f7ff8337a..cf8fbf79eb 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightSpecV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightSpecV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file highlightV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,8 +35,8 @@ out vec2 vary_texcoord0;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
index 481b7a3b1d..f97b2c4ae1 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file highlightV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,15 +39,15 @@ uniform mat4 modelview_matrix;
void main()
{
- //transform vertex
+ //transform vertex
#ifdef HAS_SKIN
mat4 mat = getObjectSkinnedTransform();
mat = modelview_matrix * mat;
vec4 pos = mat * vec4(position.xyz,1.0);
gl_Position = projection_matrix * pos;
#else
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
#endif
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/irradianceGenV.glsl b/indra/newview/app_settings/shaders/class1/interface/irradianceGenV.glsl
index 633c928e6b..1d37a16975 100644
--- a/indra/newview/app_settings/shaders/class1/interface/irradianceGenV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/irradianceGenV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file irradianceGenV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,8 +31,8 @@ out vec3 vary_dir;
void main()
{
- gl_Position = vec4(position, 1.0);
+ gl_Position = vec4(position, 1.0);
- vary_dir = vec3(modelview_matrix * vec4(position, 1.0)).xyz;
+ vary_dir = vec3(modelview_matrix * vec4(position, 1.0)).xyz;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionCubeV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionCubeV.glsl
index 75ff19e470..f144ca558d 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionCubeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionCubeV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file occlusionCubeV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,7 +32,7 @@ uniform vec3 box_size;
void main()
{
- vec3 p = position*box_size+box_center;
- gl_Position = modelview_projection_matrix * vec4(p.xyz, 1.0);
+ vec3 p = position*box_size+box_center;
+ gl_Position = modelview_projection_matrix * vec4(p.xyz, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl
index f5d2804c7f..ee821d3884 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionF.glsl
@@ -1,31 +1,31 @@
-/**
+/**
* @file occlusionF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
out vec4 frag_data[4];
-void main()
+void main()
{
// emissive red PBR material for debugging
frag_data[0] = vec4(0, 0, 0, 0);
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionSkinnedV.glsl
index 1ff9c347b6..583e4d378c 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionSkinnedV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file occlusionSkinnedV.glsl
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,9 +32,9 @@ mat4 getObjectSkinnedTransform();
void main()
{
- mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
- vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- gl_Position = projection_matrix*vec4(pos, 1.0);
+ mat4 mat = getObjectSkinnedTransform();
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
+ gl_Position = projection_matrix*vec4(pos, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
index b44c746fa7..026467d916 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file uiV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,6 +29,6 @@ in vec3 position;
void main()
{
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturefilterF.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturefilterF.glsl
index a85d055a5b..b3ba3c5f13 100644
--- a/indra/newview/app_settings/shaders/class1/interface/onetexturefilterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturefilterF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file onetexturefilterF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,16 +30,16 @@ uniform float tolerance;
in vec2 vary_texcoord0;
-void main()
+void main()
{
- frag_color = texture(tex0, vary_texcoord0.xy);
-
- if(frag_color[0] + frag_color[1] + frag_color[2] < tolerance)
- {
- discard;
- }
- else
- {
- frag_color[3] = 0.95f;
- }
+ frag_color = texture(tex0, vary_texcoord0.xy);
+
+ if(frag_color[0] + frag_color[1] + frag_color[2] < tolerance)
+ {
+ discard;
+ }
+ else
+ {
+ frag_color[3] = 0.95f;
+ }
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturefilterV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturefilterV.glsl
index 1b8411603a..d2400dcb20 100644
--- a/indra/newview/app_settings/shaders/class1/interface/onetexturefilterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturefilterV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file onetexturefilterV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
uniform mat4 modelview_projection_matrix;
in vec3 position;
@@ -32,7 +32,7 @@ out vec2 vary_texcoord0;
void main()
{
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = texcoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = texcoord0;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl
index fac22be6de..55a5c9ab8a 100644
--- a/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pathfindingF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@ out vec4 frag_color;
in vec4 vertex_color;
-void main()
+void main()
{
- frag_color = vertex_color;
+ frag_color = vertex_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl
index 4f08df839d..f90eec554f 100644
--- a/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pathfindingV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,11 +32,11 @@ out vec4 vertex_color;
uniform float tint;
uniform float alpha_scale;
-
+
void main()
{
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vertex_color = vec4(diffuse_color.rgb * tint, diffuse_color.a*alpha_scale);
+ vertex_color = vec4(diffuse_color.rgb * tint, diffuse_color.a*alpha_scale);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl
index 9e77927cb8..a7e30cf2ef 100644
--- a/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pathfindingV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,21 +34,21 @@ out vec4 vertex_color;
uniform float tint;
uniform float ambiance;
uniform float alpha_scale;
-
+
void main()
{
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+
+ vec3 l1 = vec3(-0.75, 1, 1.0)*0.5;
+ vec3 l2 = vec3(0.5, -0.6, 0.4)*0.25;
+ vec3 l3 = vec3(0.5, -0.8, 0.3)*0.5;
- vec3 l1 = vec3(-0.75, 1, 1.0)*0.5;
- vec3 l2 = vec3(0.5, -0.6, 0.4)*0.25;
- vec3 l3 = vec3(0.5, -0.8, 0.3)*0.5;
+ float lit = max(dot(normal, l1), 0.0);
+ lit += max(dot(normal, l2), 0.0);
+ lit += max(dot(normal, l3), 0.0);
- float lit = max(dot(normal, l1), 0.0);
- lit += max(dot(normal, l2), 0.0);
- lit += max(dot(normal, l3), 0.0);
+ lit = clamp(lit, ambiance, 1.0);
- lit = clamp(lit, ambiance, 1.0);
-
- vertex_color = vec4(diffuse_color.rgb * tint * lit, diffuse_color.a*alpha_scale);
+ vertex_color = vec4(diffuse_color.rgb * tint * lit, diffuse_color.a*alpha_scale);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
index 9ecdf0bf77..eb0f7297ad 100644
--- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file radianceGenF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
@@ -36,7 +36,7 @@ in vec3 vary_dir;
//uniform float roughness;
uniform float mipLevel;
-uniform int u_width;
+uniform int u_width;
uniform float max_probe_lod;
@@ -73,95 +73,95 @@ const float PI = 3.1415926536;
// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
float random(vec2 co)
{
- float a = 12.9898;
- float b = 78.233;
- float c = 43758.5453;
- float dt= dot(co.xy ,vec2(a,b));
- float sn= mod(dt,3.14);
- return fract(sin(sn) * c);
+ float a = 12.9898;
+ float b = 78.233;
+ float c = 43758.5453;
+ float dt= dot(co.xy ,vec2(a,b));
+ float sn= mod(dt,3.14);
+ return fract(sin(sn) * c);
}
-vec2 hammersley2d(uint i, uint N)
+vec2 hammersley2d(uint i, uint N)
{
- // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
- uint bits = (i << 16u) | (i >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- float rdi = float(bits) * 2.3283064365386963e-10;
- return vec2(float(i) /float(N), rdi);
+ // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
+ uint bits = (i << 16u) | (i >> 16u);
+ bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
+ bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
+ bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
+ bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
+ float rdi = float(bits) * 2.3283064365386963e-10;
+ return vec2(float(i) /float(N), rdi);
}
// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
-vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
+vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
{
- // Maps a 2D point to a hemisphere with spread based on roughness
- float alpha = roughness * roughness;
- float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
- float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
- float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
- vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
-
- // Tangent space
- vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangentX = normalize(cross(up, normal));
- vec3 tangentY = normalize(cross(normal, tangentX));
-
- // Convert to world Space
- return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
+ // Maps a 2D point to a hemisphere with spread based on roughness
+ float alpha = roughness * roughness;
+ float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
+ float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
+ float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
+ vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
+
+ // Tangent space
+ vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
+ vec3 tangentX = normalize(cross(up, normal));
+ vec3 tangentY = normalize(cross(normal, tangentX));
+
+ // Convert to world Space
+ return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
}
// Normal Distribution function
float D_GGX(float dotNH, float roughness)
{
- float alpha = roughness * roughness;
- float alpha2 = alpha * alpha;
- float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0;
- return (alpha2)/(PI * denom*denom);
+ float alpha = roughness * roughness;
+ float alpha2 = alpha * alpha;
+ float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0;
+ return (alpha2)/(PI * denom*denom);
}
vec4 prefilterEnvMap(vec3 R)
{
- vec3 N = R;
- vec3 V = R;
- vec4 color = vec4(0.0);
- float totalWeight = 0.0;
- float envMapDim = float(textureSize(reflectionProbes, 0).s);
+ vec3 N = R;
+ vec3 V = R;
+ vec4 color = vec4(0.0);
+ float totalWeight = 0.0;
+ float envMapDim = float(textureSize(reflectionProbes, 0).s);
float roughness = mipLevel/max_probe_lod;
int numSamples = max(int(32*roughness), 1);
float numMips = max_probe_lod+1;
- for(uint i = 0u; i < numSamples; i++) {
- vec2 Xi = hammersley2d(i, numSamples);
- vec3 H = importanceSample_GGX(Xi, roughness, N);
- vec3 L = 2.0 * dot(V, H) * H - V;
- float dotNL = clamp(dot(N, L), 0.0, 1.0);
- if(dotNL > 0.0) {
- // Filtering based on https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/
-
- float dotNH = clamp(dot(N, H), 0.0, 1.0);
- float dotVH = clamp(dot(V, H), 0.0, 1.0);
-
- // Probability Distribution Function
- float pdf = D_GGX(dotNH, roughness) * dotNH / (4.0 * dotVH) + 0.0001;
- // Slid angle of current smple
- float omegaS = 1.0 / (float(numSamples) * pdf);
- // Solid angle of 1 pixel across all cube faces
- float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim);
- // Biased (+1.0) mip level for better result
- float mipLevel = roughness == 0.0 ? 0.0 : clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, max_probe_lod);
- color += textureLod(reflectionProbes, vec4(L, sourceIdx), mipLevel) * dotNL;
- totalWeight += dotNL;
- }
- }
- return (color / totalWeight);
+ for(uint i = 0u; i < numSamples; i++) {
+ vec2 Xi = hammersley2d(i, numSamples);
+ vec3 H = importanceSample_GGX(Xi, roughness, N);
+ vec3 L = 2.0 * dot(V, H) * H - V;
+ float dotNL = clamp(dot(N, L), 0.0, 1.0);
+ if(dotNL > 0.0) {
+ // Filtering based on https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/
+
+ float dotNH = clamp(dot(N, H), 0.0, 1.0);
+ float dotVH = clamp(dot(V, H), 0.0, 1.0);
+
+ // Probability Distribution Function
+ float pdf = D_GGX(dotNH, roughness) * dotNH / (4.0 * dotVH) + 0.0001;
+ // Slid angle of current smple
+ float omegaS = 1.0 / (float(numSamples) * pdf);
+ // Solid angle of 1 pixel across all cube faces
+ float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim);
+ // Biased (+1.0) mip level for better result
+ float mipLevel = roughness == 0.0 ? 0.0 : clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, max_probe_lod);
+ color += textureLod(reflectionProbes, vec4(L, sourceIdx), mipLevel) * dotNL;
+ totalWeight += dotNL;
+ }
+ }
+ return (color / totalWeight);
}
void main()
-{
- vec3 N = normalize(vary_dir);
- frag_color = max(prefilterEnvMap(N), vec4(0));
+{
+ vec3 N = normalize(vary_dir);
+ frag_color = max(prefilterEnvMap(N), vec4(0));
}
// =============================================================================================================
diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenV.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenV.glsl
index 2c31e98838..145bf39fa0 100644
--- a/indra/newview/app_settings/shaders/class1/interface/radianceGenV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file radianceGenV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,8 +31,8 @@ out vec3 vary_dir;
void main()
{
- gl_Position = vec4(position, 1.0);
+ gl_Position = vec4(position, 1.0);
- vary_dir = vec3(modelview_matrix * vec4(position, 1.0)).xyz;
+ vary_dir = vec3(modelview_matrix * vec4(position, 1.0)).xyz;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl b/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl
index 45267e4403..69bee991f5 100644
--- a/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl
@@ -1,35 +1,35 @@
-/**
+/**
* @file reflectionmipF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
out vec4 frag_color;
uniform sampler2D diffuseRect;
in vec2 vary_texcoord0;
-void main()
+void main()
{
vec3 col = texture(diffuseRect, vary_texcoord0.xy).rgb;
frag_color = vec4(col, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
index a14334fd01..b7b2306412 100644
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file twotextureaddF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,9 +31,9 @@ uniform vec4 color;
in vec2 vary_texcoord0;
-void main()
+void main()
{
- float alpha = texture(tex0, vary_texcoord0.xy).a * color.a;
+ float alpha = texture(tex0, vary_texcoord0.xy).a * color.a;
- frag_color = vec4(color.rgb, alpha);
+ frag_color = vec4(color.rgb, alpha);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
index b280fcdc15..9b0e35c555 100644
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
@@ -1,30 +1,30 @@
-/**
+/**
* @file solidcolorV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
uniform mat4 modelview_projection_matrix;
-
+
in vec3 position;
in vec2 texcoord0;
@@ -32,7 +32,7 @@ out vec2 vary_texcoord0;
void main()
{
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = texcoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = texcoord0;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
index 7af7f20f85..6141e1ff9a 100644
--- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file splattexturerectV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,7 +31,7 @@ out vec2 vary_texcoord0;
void main()
{
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = position.xy*0.5+0.5;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = position.xy*0.5+0.5;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl
index 6d51b898b7..8477e8eb97 100644
--- a/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file twotexturecompareF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,20 +35,20 @@ uniform float dither_scale_t;
in vec2 vary_texcoord0;
in vec2 vary_texcoord1;
-void main()
+void main()
{
- frag_color = abs(texture(tex0, vary_texcoord0.xy) - texture(tex1, vary_texcoord0.xy));
+ frag_color = abs(texture(tex0, vary_texcoord0.xy) - texture(tex1, vary_texcoord0.xy));
- vec2 dither_coord;
- dither_coord[0] = vary_texcoord0[0] * dither_scale_s;
- dither_coord[1] = vary_texcoord0[1] * dither_scale_t;
- vec4 dither_vec = texture(dither_tex, dither_coord.xy);
+ vec2 dither_coord;
+ dither_coord[0] = vary_texcoord0[0] * dither_scale_s;
+ dither_coord[1] = vary_texcoord0[1] * dither_scale_t;
+ vec4 dither_vec = texture(dither_tex, dither_coord.xy);
- for(int i = 0; i < 3; i++)
- {
- if(frag_color[i] < dither_vec[i] * dither_scale)
- {
- frag_color[i] = 0.f;
- }
- }
+ for(int i = 0; i < 3; i++)
+ {
+ if(frag_color[i] < dither_vec[i] * dither_scale)
+ {
+ frag_color[i] = 0.f;
+ }
+ }
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/twotexturecompareV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareV.glsl
index a103bff12d..f98ab5bb16 100644
--- a/indra/newview/app_settings/shaders/class1/interface/twotexturecompareV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file twotexturecompareV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
uniform mat4 modelview_projection_matrix;
in vec3 position;
@@ -34,8 +34,8 @@ out vec2 vary_texcoord1;
void main()
{
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = texcoord0;
- vary_texcoord1 = texcoord1;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = texcoord0;
+ vary_texcoord1 = texcoord1;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/uiF.glsl b/indra/newview/app_settings/shaders/class1/interface/uiF.glsl
index a29b848253..83fe1c505f 100644
--- a/indra/newview/app_settings/shaders/class1/interface/uiF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/uiF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file uiF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@ uniform sampler2D diffuseMap;
in vec2 vary_texcoord0;
in vec4 vertex_color;
-void main()
+void main()
{
- frag_color = vertex_color*texture(diffuseMap, vary_texcoord0.xy);
+ frag_color = vertex_color*texture(diffuseMap, vary_texcoord0.xy);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
index 91a846b9fa..c56b122a78 100644
--- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file uiV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,8 +35,8 @@ out vec2 vary_texcoord0;
void main()
{
- gl_Position = modelview_projection_matrix * vec4(position, 1);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
- vertex_color = diffuse_color;
+ gl_Position = modelview_projection_matrix * vec4(position, 1);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl
index 6535c0835e..c7cb076099 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file class1\lighting\lightAlphaMaskF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
out vec4 frag_color;
uniform float minimum_alpha;
@@ -33,20 +33,20 @@ vec3 scaleSoftClip(vec3 light);
in vec4 vertex_color;
in vec2 vary_texcoord0;
-void default_lighting()
+void default_lighting()
{
- vec4 color = diffuseLookup(vary_texcoord0.xy);
-
- if (color.a < minimum_alpha)
- {
- discard;
- }
-
- color *= vertex_color;
-
- color.rgb = atmosLighting(color.rgb);
- color.rgb = scaleSoftClip(color.rgb);
-
- frag_color = max(color, vec4(0));
+ vec4 color = diffuseLookup(vary_texcoord0.xy);
+
+ if (color.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ color *= vertex_color;
+
+ color.rgb = atmosLighting(color.rgb);
+ color.rgb = scaleSoftClip(color.rgb);
+
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl
index 4dc67028d5..77324edcff 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1\lighting\lightAlphaMaskNonIndexedF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,21 +35,21 @@ vec3 scaleSoftClip(vec3 light);
in vec4 vertex_color;
in vec2 vary_texcoord0;
-void default_lighting()
+void default_lighting()
{
- vec4 color = texture(diffuseMap,vary_texcoord0.xy);
+ vec4 color = texture(diffuseMap,vary_texcoord0.xy);
- if (color.a < minimum_alpha)
- {
- discard;
- }
+ if (color.a < minimum_alpha)
+ {
+ discard;
+ }
- color *= vertex_color;
+ color *= vertex_color;
- color.rgb = atmosLighting(color.rgb);
+ color.rgb = atmosLighting(color.rgb);
- color.rgb = scaleSoftClip(color.rgb);
+ color.rgb = scaleSoftClip(color.rgb);
- frag_color = max(color, vec4(0));
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
index 2d1c7dadb0..e8523935ed 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1\lighting\lightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,14 +31,14 @@ in vec2 vary_texcoord0;
vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light);
-void default_lighting()
+void default_lighting()
{
- vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
-
- color.rgb = atmosLighting(color.rgb);
+ vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
+
+ color.rgb = atmosLighting(color.rgb);
- color.rgb = scaleSoftClip(color.rgb);
+ color.rgb = scaleSoftClip(color.rgb);
- frag_color = max(color, vec4(0));
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl
index 13a6dde4aa..6ca6c88289 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl
@@ -1,58 +1,58 @@
-/**
+/**
* @file class1/lighting\lightFuncSpecularV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
float calcDirectionalSpecular(vec3 view, vec3 n, vec3 l)
{
- return pow(max(dot(reflect(view, n),l), 0.0),8.0);
+ return pow(max(dot(reflect(view, n),l), 0.0),8.0);
}
float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da)
{
-
- specular.rgb += calcDirectionalSpecular(view,n,l)*lightCol*da;
- return max(dot(n,l),0.0);
+
+ specular.rgb += calcDirectionalSpecular(view,n,l)*lightCol*da;
+ return max(dot(n,l),0.0);
}
vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol)
{
- //get light vector
- vec3 lv = l-v;
-
- //get distance
- float d = length(lv);
-
- //normalize light vector
- lv *= 1.0/d;
-
- //distance attenuation
- float da = clamp(1.0/(r * d), 0.0, 1.0);
-
- //angular attenuation
-
- da *= calcDirectionalLightSpecular(specular, view, n, lv, lightCol, da);
-
- return da*lightCol;
+ //get light vector
+ vec3 lv = l-v;
+
+ //get distance
+ float d = length(lv);
+
+ //normalize light vector
+ lv *= 1.0/d;
+
+ //distance attenuation
+ float da = clamp(1.0/(r * d), 0.0, 1.0);
+
+ //angular attenuation
+
+ da *= calcDirectionalLightSpecular(specular, view, n, lv, lightCol, da);
+
+ return da*lightCol;
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
index 45701002b8..6ddf7b9417 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
@@ -1,58 +1,58 @@
-/**
+/**
* @file class1\lighting\lightFuncV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
float calcDirectionalLight(vec3 n, vec3 l)
{
- float a = max(dot(n,l),0.0);
- return a;
+ float a = max(dot(n,l),0.0);
+ return a;
}
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
- //get light vector
- vec3 lv = lp.xyz-v;
-
- //get distance
- float d = length(lv);
-
- //normalize light vector
- lv *= 1.0/d;
-
- //distance attenuation
- float da = clamp(1.0/(la * d), 0.0, 1.0);
-
- // spotlight coefficient.
- float spot = max(dot(-ln, lv), is_pointlight);
- da *= spot*spot; // GL_SPOT_EXPONENT=2
-
- //angular attenuation
- da *= calcDirectionalLight(n, lv);
-
- return da;
+ //get light vector
+ vec3 lv = lp.xyz-v;
+
+ //get distance
+ float d = length(lv);
+
+ //normalize light vector
+ lv *= 1.0/d;
+
+ //distance attenuation
+ float da = clamp(1.0/(la * d), 0.0, 1.0);
+
+ // spotlight coefficient.
+ float spot = max(dot(-ln, lv), is_pointlight);
+ da *= spot*spot; // GL_SPOT_EXPONENT=2
+
+ //angular attenuation
+ da *= calcDirectionalLight(n, lv);
+
+ return da;
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightNonIndexedF.glsl
index cea08ecffd..95200444b9 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightNonIndexedF.glsl
@@ -1,30 +1,30 @@
-/**
+/**
* @file class1\lighting\lightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
out vec4 frag_color;
-
+
in vec4 vertex_color;
in vec2 vary_texcoord0;
@@ -33,14 +33,14 @@ uniform sampler2D diffuseMap;
vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light);
-void default_lighting()
+void default_lighting()
{
- vec4 color = texture(diffuseMap,vary_texcoord0.xy) * vertex_color;
-
- color.rgb = atmosLighting(color.rgb);
+ vec4 color = texture(diffuseMap,vary_texcoord0.xy) * vertex_color;
+
+ color.rgb = atmosLighting(color.rgb);
- color.rgb = scaleSoftClip(color.rgb);
+ color.rgb = scaleSoftClip(color.rgb);
- frag_color = max(color, vec4(0));
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
index 06aed40e26..c510932930 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file class1\lighting\lightSpecularV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
// All lights, no specular highlights
@@ -31,6 +31,6 @@ vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor)
{
- return sumLightsSpecular(pos, norm, color, specularColor);
+ return sumLightsSpecular(pos, norm, color, specularColor);
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
index 7c3697c333..ceb2bce4f1 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
@@ -4,25 +4,25 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);
@@ -36,22 +36,22 @@ uniform vec3 light_diffuse[8];
vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor)
{
- vec4 col = vec4(0,0,0, color.a);
-
- vec3 view = normalize(pos);
-
- /// collect all the specular values from each calcXXXLightSpecular() function
- vec4 specularSum = vec4(0.0);
+ vec4 col = vec4(0,0,0, color.a);
+
+ vec3 view = normalize(pos);
+
+ /// collect all the specular values from each calcXXXLightSpecular() function
+ vec4 specularSum = vec4(0.0);
- col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0);
- col.rgb = scaleDownLight(col.rgb);
- col.rgb += atmosAmbient();
- col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz, atmosGetDiffuseSunlightColor(), 1.0));
+ col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0);
+ col.rgb = scaleDownLight(col.rgb);
+ col.rgb += atmosAmbient();
+ col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz, atmosGetDiffuseSunlightColor(), 1.0));
- col.rgb = min(col.rgb * color.rgb, 1.0);
- specularColor.rgb = min(specularColor.rgb * specularSum.rgb, 1.0);
+ col.rgb = min(col.rgb * color.rgb, 1.0);
+ specularColor.rgb = min(specularColor.rgb * specularSum.rgb, 1.0);
- col.rgb += specularColor.rgb;
+ col.rgb += specularColor.rgb;
- return col;
+ return col;
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
index 75a327d3d7..a2521384b5 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
@@ -4,25 +4,25 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
uniform vec4 light_position[8];
uniform vec3 light_diffuse[8];
@@ -34,14 +34,14 @@ vec3 scaleDownLight(vec3 light);
vec4 sumLights(vec3 pos, vec3 norm, vec4 color)
{
- vec4 col = vec4(0);
- col.a = color.a;
-
- col.rgb = light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
+ vec4 col = vec4(0);
+ col.a = color.a;
+
+ col.rgb = light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
col.rgb += light_diffuse[1].rgb * sqrt(calcDirectionalLight(norm, -light_position[1].xyz)*0.5+0.25);
- col.rgb = min(col.rgb*color.rgb, 1.0);
- return col;
+ col.rgb = min(col.rgb*color.rgb, 1.0);
+ return col;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
index 67c99530e3..db26e64f17 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file bumpF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,10 +31,10 @@ uniform sampler2D texture1;
in vec2 vary_texcoord0;
in vec2 vary_texcoord1;
-void main()
+void main()
{
- float tex0 = texture(texture0, vary_texcoord0.xy).a;
- float tex1 = texture(texture1, vary_texcoord1.xy).a;
+ float tex0 = texture(texture0, vary_texcoord0.xy).a;
+ float tex1 = texture(texture1, vary_texcoord1.xy).a;
- frag_color = max(vec4(tex0+(1.0-tex1)-0.5), vec4(0));
+ frag_color = max(vec4(tex0+(1.0-tex1)-0.5), vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
index 7d5417919e..834c20e14d 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file bumpV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,15 +41,15 @@ uniform mat4 modelview_matrix;
void main()
{
- //transform vertex
+ //transform vertex
#ifdef HAS_SKIN
mat4 mat = getObjectSkinnedTransform();
mat = modelview_matrix * mat;
vec4 pos = mat * vec4(position.xyz, 1.0);
gl_Position = projection_matrix * pos;
#else
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
#endif
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
- vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
index ff9aaf3357..6fe89b4f16 100644
--- a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file impostorF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,12 +33,12 @@ in vec2 vary_texcoord0;
void main()
{
- vec4 color = texture(diffuseMap,vary_texcoord0.xy);
-
- if (color.a < minimum_alpha)
- {
- discard;
- }
+ vec4 color = texture(diffuseMap,vary_texcoord0.xy);
+
+ if (color.a < minimum_alpha)
+ {
+ discard;
+ }
- frag_color = max(color, vec4(0));
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
index cf3162f5f1..a56eeba63d 100644
--- a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
@@ -4,21 +4,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,7 +34,7 @@ out vec2 vary_texcoord0;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl
index d90f9271dc..7c921abb80 100644
--- a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file indexedTextureV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,6 +29,6 @@ flat out int vary_texture_index;
void passTextureIndex()
{
- vary_texture_index = texture_index;
+ vary_texture_index = texture_index;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl
index 80ea286ac0..84b66b71f3 100644
--- a/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file nonindexedTextureV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewF.glsl b/indra/newview/app_settings/shaders/class1/objects/previewF.glsl
index ec785cd1c0..89275bad59 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file previewF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,6 +32,6 @@ in vec2 vary_texcoord0;
void main()
{
- vec4 color = texture(diffuseMap,vary_texcoord0.xy) * vertex_color;
- frag_color = max(color, vec4(0));
+ vec4 color = texture(diffuseMap,vary_texcoord0.xy) * vertex_color;
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewPhysicsF.glsl b/indra/newview/app_settings/shaders/class1/objects/previewPhysicsF.glsl
index e3e71202ae..974048cf91 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewPhysicsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewPhysicsF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file previewPhysicsF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewPhysicsV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewPhysicsV.glsl
index d8c74e8537..03a06f7ca3 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewPhysicsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewPhysicsV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file previewPhysicsV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,7 +36,7 @@ out vec2 vary_texcoord0;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
index f51b0f4d9e..f415253be9 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file previewV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,7 +38,7 @@ out vec2 vary_texcoord0;
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
-uniform vec3 light_attenuation[8];
+uniform vec3 light_attenuation[8];
uniform vec3 light_diffuse[8];
//===================================================================================================
@@ -46,8 +46,8 @@ uniform vec3 light_diffuse[8];
//drivers that are picky about functions being declared but not defined even if they aren't called
float calcDirectionalLight(vec3 n, vec3 l)
{
- float a = max(dot(n,l),0.0);
- return a;
+ float a = max(dot(n,l),0.0);
+ return a;
}
//====================================================================================================
@@ -69,18 +69,18 @@ void main()
gl_Position = projection_matrix * pos;
norm = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
#else
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
norm = normalize(normal_matrix * normal);
#endif
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
- vec4 col = vec4(0,0,0,1);
+ vec4 col = vec4(0,0,0,1);
- // Collect normal lights (need to be divided by two, as we later multiply by 2)
- col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
+ // Collect normal lights (need to be divided by two, as we later multiply by 2)
+ col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
col.rgb += light_diffuse[2].rgb * calcDirectionalLight(norm, light_position[2].xyz);
col.rgb += light_diffuse[3].rgb * calcDirectionalLight(norm, light_position[3].xyz);
- vertex_color = col*color;
+ vertex_color = col*color;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl
index 29a2ce617b..5dd8916fe4 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl
@@ -1,31 +1,31 @@
-/**
+/**
* @file simpleF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
void default_lighting();
-void main()
+void main()
{
- default_lighting();
+ default_lighting();
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
index 07f5d250cf..a3aca25db2 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file simpleNoColorV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,17 +43,17 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
- //transform vertex
- vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- vec3 norm = normalize(normal_matrix * normal);
+ //transform vertex
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ vec3 norm = normalize(normal_matrix * normal);
+
+ calcAtmospherics(pos.xyz);
- calcAtmospherics(pos.xyz);
+ vec4 col = calcLighting(pos.xyz, norm, color);
+ vertex_color = col;
- vec4 col = calcLighting(pos.xyz, norm, color);
- vertex_color = col;
-
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl
index 41a848a14f..a892ff9cdc 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class2\wl\atmosphericsF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@ vec3 linear_to_srgb(vec3 col);
uniform float sky_hdr_scale;
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
-{
+{
light *= atten.r;
additive = srgb_to_linear(additive*2.0);
additive *= sky_hdr_scale;
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index a1da4b1f9a..b7cd3f0589 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -57,9 +57,9 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
vec3 rel_pos_norm = normalize(rel_pos);
float rel_pos_len = length(rel_pos);
-
+
vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color;
-
+
// sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y);
@@ -119,7 +119,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
additive = (blue_horizon.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb);
// brightness of surface both sunlight and ambient
-
+
sunlit = sunlight.rgb;
amblit = tmpAmbient;
@@ -128,7 +128,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
vec3 srgb_to_linear(vec3 col);
-// provide a touch of lighting in the opposite direction of the sun light
+// provide a touch of lighting in the opposite direction of the sun light
// so areas in shadow don't lose all detail
float ambientLighting(vec3 norm, vec3 light_dir)
{
@@ -150,7 +150,7 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou
// (allows for mixing of light sources other than sunlight e.g. reflection probes)
sunlit *= sky_sunlight_scale;
amblit *= sky_ambient_scale;
-
+
amblit = srgb_to_linear(amblit);
amblit *= ambientLighting(norm, light_dir);
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl
index 800d08047a..1e36a3adae 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl
@@ -4,21 +4,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
index 4f88aed765..4d7f77edd5 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
@@ -4,25 +4,25 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
// Output variables
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
index 7b59e07243..1372ddbcfa 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
@@ -4,21 +4,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,7 +46,7 @@ void calcAtmospherics(vec3 inPositionEye) {
vec3 tmpamblit = vec3(1);
vec3 tmpaddlit = vec3(1);
vec3 tmpattenlit = vec3(1);
- vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
+ vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
calcAtmosphericVars(inPositionEye, light_dir, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit);
setSunlitColor(tmpsunlit);
setAmblitColor(tmpamblit);
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
index 9d5f60b313..642d0bc1e4 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
@@ -1,48 +1,48 @@
-/**
+/**
* @file class2\wl\atmosphericVarsF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
in vec3 vary_AdditiveColor;
in vec3 vary_AtmosAttenuation;
vec3 getSunlitColor()
{
- return vec3(0,0,0);
+ return vec3(0,0,0);
}
vec3 getAmblitColor()
{
- return vec3(0,0,0);
+ return vec3(0,0,0);
}
vec3 getAdditiveColor()
{
- return vary_AdditiveColor;
+ return vary_AdditiveColor;
}
vec3 getAtmosAttenuation()
{
- return vary_AtmosAttenuation;
+ return vary_AtmosAttenuation;
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
index 0617bc9908..5d770948c5 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file class2\wl\atmosphericVars.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
out vec3 vary_AdditiveColor;
out vec3 vary_AtmosAttenuation;
@@ -34,40 +34,40 @@ vec3 amblit_color;
vec3 getSunlitColor()
{
- return sunlit_color;
+ return sunlit_color;
}
vec3 getAmblitColor()
{
- return amblit_color;
+ return amblit_color;
}
vec3 getAdditiveColor()
{
- return additive_color;
+ return additive_color;
}
vec3 getAtmosAttenuation()
{
- return atmos_attenuation;
+ return atmos_attenuation;
}
void setSunlitColor(vec3 v)
{
- sunlit_color = v;
+ sunlit_color = v;
}
void setAmblitColor(vec3 v)
{
- amblit_color = v;
+ amblit_color = v;
}
void setAdditiveColor(vec3 v)
{
- additive_color = v;
- vary_AdditiveColor = v;
+ additive_color = v;
+ vary_AdditiveColor = v;
}
void setAtmosAttenuation(vec3 v)
{
- atmos_attenuation = v;
- vary_AtmosAttenuation = v;
+ atmos_attenuation = v;
+ vary_AtmosAttenuation = v;
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
index 027bfb866f..e881f82824 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class2\wl\gammaF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index acd32a81b3..e6bdaf265e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file alphaF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -60,7 +60,7 @@ uniform vec2 screen_res;
uniform int sun_up_factor;
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
-uniform vec4 light_attenuation[8];
+uniform vec4 light_attenuation[8];
uniform vec3 light_diffuse[8];
void waterClip(vec3 pos);
@@ -90,15 +90,15 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
float falloff_factor = (12.0 * fa) - 9.0;
float inverted_la = falloff_factor / la;
// Yes, it makes me want to cry as well. DJH
-
+
vec3 col = vec3(0);
- //get light vector
- vec3 lv = lp.xyz-v;
+ //get light vector
+ vec3 lv = lp.xyz-v;
- //get distance
- float dist = length(lv);
- float da = 1.0;
+ //get distance
+ float dist = length(lv);
+ float da = 1.0;
/*if (dist > inverted_la)
{
@@ -111,23 +111,23 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
if (proj_tc.z < 0
|| proj_tc.z > 1
|| proj_tc.x < 0
- || proj_tc.x > 1
+ || proj_tc.x > 1
|| proj_tc.y < 0
|| proj_tc.y > 1)
{
return col;
}*/
- if (dist > 0.0 && inverted_la > 0.0)
- {
+ if (dist > 0.0 && inverted_la > 0.0)
+ {
dist /= inverted_la;
- //normalize light vector
- lv = normalize(lv);
-
- //distance attenuation
- float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
- dist_atten *= dist_atten;
+ //normalize light vector
+ lv = normalize(lv);
+
+ //distance attenuation
+ float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
+ dist_atten *= dist_atten;
dist_atten *= 2.0f;
if (dist_atten <= 0.0)
@@ -135,20 +135,20 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
return col;
}
- // spotlight coefficient.
- float spot = max(dot(-ln, lv), is_pointlight);
- da *= spot*spot; // GL_SPOT_EXPONENT=2
+ // spotlight coefficient.
+ float spot = max(dot(-ln, lv), is_pointlight);
+ da *= spot*spot; // GL_SPOT_EXPONENT=2
- //angular attenuation
- da *= dot(n, lv);
+ //angular attenuation
+ da *= dot(n, lv);
da = max(0.0, da);
- float lit = 0.0f;
+ float lit = 0.0f;
float amb_da = 0.0;//ambiance;
if (da > 0)
{
- lit = max(da * dist_atten,0.0);
+ lit = max(da * dist_atten,0.0);
col = lit * light_col * diffuse;
amb_da += (da*0.5+0.5) * ambiance;
}
@@ -165,10 +165,10 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
return col;
}
-void main()
+void main()
{
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
-
+
vec4 pos = vec4(vary_position, 1.0);
#ifndef IS_AVATAR_SKIN
// clip against water plane unless this is a legacy avatar skin
@@ -199,7 +199,7 @@ void main()
float final_alpha = diffuse_srgb.a * vertex_color.a;
diffuse_srgb.rgb *= vertex_color.rgb;
-
+
// Insure we don't pollute depth with invis pixels in impostor rendering
//
if (final_alpha < minimum_alpha)
@@ -222,7 +222,7 @@ void main()
final_alpha *= vertex_color.a;
if (final_alpha < minimum_alpha)
- { // TODO: figure out how to get invisible faces out of
+ { // TODO: figure out how to get invisible faces out of
// render batches without breaking glow
discard;
}
@@ -245,11 +245,11 @@ void main()
vec3 glossenv;
vec3 legacyenv;
sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0, true, amblit_linear);
-
+
float da = dot(norm.xyz, light_dir.xyz);
da = clamp(da, -1.0, 1.0);
-
+
float final_da = da;
final_da = clamp(final_da, 0.0f, 1.0f);
@@ -266,7 +266,7 @@ void main()
color.rgb *= diffuse_linear.rgb;
vec4 light = vec4(0,0,0,0);
-
+
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w);
LIGHT_LOOP(1)
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index 003dd05e6f..34d86b6147 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1\deferred\pbralphaF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -87,7 +87,7 @@ vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
float calcLegacyDistanceAttenuation(float distance, float falloff);
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
-void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
+void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear);
void waterClip(vec3 pos);
@@ -110,15 +110,15 @@ vec3 pbrBaseLight(vec3 diffuseColor,
vec3 additive,
vec3 atten);
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
+vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+ float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
vec3 l); //surface point to light
-vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
+vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
+ float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 p, // pixel position
@@ -178,7 +178,7 @@ void main()
float sign = vary_sign;
vec3 vN = vary_normal;
vec3 vT = vary_tangent.xyz;
-
+
vec3 vB = sign * cross(vN, vT);
vec3 norm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN );
@@ -215,7 +215,7 @@ void main()
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true, amblit);
-
+
vec3 diffuseColor;
vec3 specularColor;
calcDiffuseSpecular(col.rgb, metallic, diffuseColor, specularColor);
@@ -242,7 +242,7 @@ void main()
color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, vec4(color, 1.0)).rgb;
float a = basecolor.a*vertex_color.a;
-
+
frag_color = max(vec4(color.rgb,a), vec4(0));
}
@@ -292,7 +292,7 @@ void main()
// emissiveMap here is a vanilla RGB texture encoded as sRGB, manually convert to linear
colorEmissive *= srgb_to_linear(texture(emissiveMap, emissive_texcoord.xy).rgb);
-
+
float a = basecolor.a*vertex_color.a;
color += colorEmissive;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
index 52e71edcac..d178bf22b6 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
@@ -37,7 +37,7 @@ void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear)
{
ambenv = vec3(reflection_probe_ambiance * 0.25);
-
+
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
vec3 env_vec = env_mat * refnormpersp;
glossenv = srgb_to_linear(texture(environmentMap, env_vec).rgb);
@@ -59,7 +59,7 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear)
{
ambenv = vec3(reflection_probe_ambiance * 0.25);
-
+
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
vec3 env_vec = env_mat * refnormpersp;
@@ -70,7 +70,7 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout
void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm)
{
-
+
}
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity)
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
index d1db6dd943..e490ad72ee 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file softenLightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,13 +35,13 @@ void setAdditiveColor(vec3 c);
void main()
{
- //transform vertex
- vec4 pos = vec4(position.xyz, 1.0);
- gl_Position = pos;
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
+ gl_Position = pos;
// appease OSX GLSL compiler/linker by touching all the varyings we said we would
setAtmosAttenuation(vec3(1));
setAdditiveColor(vec3(0));
- vary_fragcoord = (pos.xy*0.5+0.5);
+ vary_fragcoord = (pos.xy*0.5+0.5);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 1ea57516a4..10bfe2c5d5 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file sunLightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,7 +41,7 @@ vec4 getPosition(vec2 pos_screen);
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen);
-void main()
+void main()
{
vec2 pos_screen = vary_fragcoord.xy;
vec4 pos = getPosition(pos_screen);
@@ -50,7 +50,7 @@ void main()
vec4 col;
col.r = sampleDirectionalShadow(pos.xyz, norm, pos_screen);
col.g = 1.0f;
- col.b = sampleSpotShadow(pos.xyz, norm, 0, pos_screen);
+ col.b = sampleSpotShadow(pos.xyz, norm, 0, pos_screen);
col.a = sampleSpotShadow(pos.xyz, norm, 1, pos_screen);
frag_color = clamp(col, vec4(0), vec4(1));
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 0126e09d4c..2f1819bff7 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -1,27 +1,27 @@
-/**
+/**
* @file class2/deferred/sunLightSSAOF.glsl
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -38,7 +38,7 @@ float sampleDirectionalShadow(vec3 shadow_pos, vec3 norm, vec2 pos_screen);
float sampleSpotShadow(vec3 shadow_pos, vec3 norm, int index, vec2 pos_screen);
float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen);
-void main()
+void main()
{
vec2 pos_screen = vary_fragcoord.xy;
vec4 pos = getPosition(pos_screen);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
index 5ae7f2c571..0e9f7bbfb2 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file sunLightV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,9 +31,9 @@ uniform vec2 screen_res;
void main()
{
- //transform vertex
- vec4 pos = vec4(position.xyz, 1.0);
- gl_Position = pos;
-
- vary_fragcoord = (pos.xy * 0.5 + 0.5);
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
+ vary_fragcoord = (pos.xy * 0.5 + 0.5);
}
diff --git a/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl b/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl
index 0753e73dc8..1d6d6fd514 100644
--- a/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl
+++ b/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file irradianceGenF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
@@ -130,12 +130,12 @@ vec4 getImportanceSample(int sampleIndex, vec3 N, float roughness)
// generate the points on the hemisphere with a fitting mapping for
// the distribution (e.g. lambertian uses a cosine importance)
importanceSample = Lambertian(xi, roughness);
-
+
// transform the hemisphere sample to the normal coordinate frame
// i.e. rotate the hemisphere to the normal direction
vec3 localSpaceDirection = normalize(vec3(
- importanceSample.sinTheta * cos(importanceSample.phi),
- importanceSample.sinTheta * sin(importanceSample.phi),
+ importanceSample.sinTheta * cos(importanceSample.phi),
+ importanceSample.sinTheta * sin(importanceSample.phi),
importanceSample.cosTheta
));
mat3 TBN = generateTBN(N);
@@ -152,9 +152,9 @@ float computeLod(float pdf)
// // Solid angle of current sample -- bigger for less likely samples
// float omegaS = 1.0 / (float(u_sampleCount) * pdf);
// // Solid angle of texel
- // // note: the factor of 4.0 * MATH_PI
+ // // note: the factor of 4.0 * MATH_PI
// float omegaP = 4.0 * MATH_PI / (6.0 * float(u_width) * float(u_width));
- // // Mip level is determined by the ratio of our sample's solid angle to a texel's solid angle
+ // // Mip level is determined by the ratio of our sample's solid angle to a texel's solid angle
// // note that 0.5 * log2 is equivalent to log4
// float lod = 0.5 * log2(omegaS / omegaP);
@@ -176,7 +176,7 @@ float computeLod(float pdf)
vec4 filterColor(vec3 N)
{
vec4 color = vec4(0.f);
-
+
for(int i = 0; i < u_sampleCount; ++i)
{
vec4 importanceSample = getImportanceSample(i, N, 1.0);
@@ -208,7 +208,7 @@ void main()
vec4 color = vec4(0);
color = filterColor(vary_dir);
-
+
frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class2/interface/reflectionprobeF.glsl b/indra/newview/app_settings/shaders/class2/interface/reflectionprobeF.glsl
index c858531998..a27fa40f2e 100644
--- a/indra/newview/app_settings/shaders/class2/interface/reflectionprobeF.glsl
+++ b/indra/newview/app_settings/shaders/class2/interface/reflectionprobeF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file reflectionprobeF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/class2/interface/reflectionprobeV.glsl b/indra/newview/app_settings/shaders/class2/interface/reflectionprobeV.glsl
index e45b1c288b..65fc7cec43 100644
--- a/indra/newview/app_settings/shaders/class2/interface/reflectionprobeV.glsl
+++ b/indra/newview/app_settings/shaders/class2/interface/reflectionprobeV.glsl
@@ -1,29 +1,29 @@
-/**
+/**
* @file reflectionprobeV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
in vec3 position;
out vec2 vary_fragcoord;
@@ -32,7 +32,7 @@ void main()
{
//transform vertex
vec4 pos = vec4(position.xyz, 1.0);
- gl_Position = pos;
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5);
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
index 8430cca325..22408387b1 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file fullbrightShinyF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -56,16 +56,16 @@ void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3
void main()
{
#ifdef HAS_DIFFUSE_LOOKUP
- vec4 color = diffuseLookup(vary_texcoord0.xy);
+ vec4 color = diffuseLookup(vary_texcoord0.xy);
#else
- vec4 color = texture(diffuseMap, vary_texcoord0.xy);
+ vec4 color = texture(diffuseMap, vary_texcoord0.xy);
#endif
-
- color.rgb *= vertex_color.rgb;
- // SL-9632 HUDs are affected by Atmosphere
+ color.rgb *= vertex_color.rgb;
+
+ // SL-9632 HUDs are affected by Atmosphere
#ifndef IS_HUD
-
+
vec3 sunlit;
vec3 amblit;
vec3 additive;
@@ -87,8 +87,8 @@ void main()
applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity);
#endif
- color.a = 1.0;
+ color.a = 1.0;
- frag_color = max(color, vec4(0));
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl
index 0b154e82ad..7f75b16cf0 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl
@@ -68,16 +68,16 @@ void main()
calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
vec3 sunlit_linear = srgb_to_linear(sunlit);
-
+
// mask off atmospherics below water (when camera is under water)
bool do_atmospherics = false;
-
+
if (dot(vec3(0), waterPlane.xyz) + waterPlane.w > 0.0 ||
dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0)
{
do_atmospherics = true;
}
-
+
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
@@ -102,5 +102,5 @@ void main()
}
frag_color = max(vec4(color.rgb, alpha), vec4(0)); //output linear since local lights will be added to this shader's results
-
+
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index ec1e49eeb4..20f063fe3e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -93,7 +93,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
float falloff_factor = (12.0 * fa) - 9.0;
float inverted_la = falloff_factor / la;
// Yes, it makes me want to cry as well. DJH
-
+
vec3 col = vec3(0);
//get light vector
@@ -215,19 +215,19 @@ vec2 encode_normal(vec3 n);
vec3 getNormal(inout float glossiness)
{
#ifdef HAS_NORMAL_MAP
- vec4 vNt = texture(bumpMap, vary_texcoord1.xy);
+ vec4 vNt = texture(bumpMap, vary_texcoord1.xy);
glossiness *= vNt.a;
- vNt.xyz = vNt.xyz * 2 - 1;
+ vNt.xyz = vNt.xyz * 2 - 1;
float sign = vary_sign;
vec3 vN = vary_normal;
vec3 vT = vary_tangent.xyz;
-
+
vec3 vB = sign * cross(vN, vT);
vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN );
- return tnorm;
+ return tnorm;
#else
- return normalize(vary_normal);
+ return normalize(vary_normal);
#endif
}
@@ -264,9 +264,9 @@ void waterClip()
float getEmissive(vec4 diffcol)
{
#if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE)
- return emissive_brightness;
+ return emissive_brightness;
#else
- return max(diffcol.a, emissive_brightness);
+ return max(diffcol.a, emissive_brightness);
#endif
}
@@ -289,7 +289,7 @@ void main()
// diffcol == diffuse map combined with vertex color
vec4 diffcol = texture(diffuseMap, vary_texcoord0.xy);
- diffcol.rgb *= vertex_color.rgb;
+ diffcol.rgb *= vertex_color.rgb;
alphaMask(diffcol.a);
@@ -325,7 +325,7 @@ void main()
vec3 additive;
vec3 atten;
calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
-
+
vec3 sunlit_linear = srgb_to_linear(sunlit);
vec3 amblit_linear = amblit;
@@ -333,7 +333,7 @@ void main()
vec3 glossenv;
vec3 legacyenv;
sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true, amblit_linear);
-
+
color = ambenv;
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
@@ -405,7 +405,7 @@ void main()
frag_color = max(vec4(color, al), vec4(0));
-#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
+#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
// deferred path // See: C++: addDeferredAttachment(), shader: softenLightF.glsl
frag_data[0] = vec4(diffcol.rgb, emissive); // gbuffer is sRGB for legacy materials
frag_data[1] = vec4(spec.rgb, glossiness); // XYZ = Specular color. W = Specular exponent.
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
index ec8168465e..31aca8a745 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
@@ -56,8 +56,8 @@ vec3 srgb_to_linear(vec3 c);
// Util
vec3 hue_to_rgb(float hue);
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
+vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+ float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@@ -92,7 +92,7 @@ void main()
float metallic = orm.b;
vec3 f0 = vec3(0.04);
vec3 baseColor = diffuse.rgb;
-
+
vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);
diffuseColor *= 1.0 - metallic;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl
index c2b9ed3d96..09fd389370 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class3\deferred\multiPointLightV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,9 +29,9 @@ out vec4 vary_fragcoord;
void main()
{
- //transform vertex
- vec4 pos = vec4(position.xyz, 1.0);
- vary_fragcoord = pos;
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
+ vary_fragcoord = pos;
- gl_Position = pos;
+ gl_Position = pos;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
index 31af1208bd..c27310cf89 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file class3\deferred\pointLightF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -59,8 +59,8 @@ vec2 getScreenCoord(vec4 clip);
vec3 srgb_to_linear(vec3 c);
float getDepth(vec2 tc);
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
+vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+ float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@@ -94,13 +94,13 @@ void main()
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
{
- vec3 colorEmissive = texture(emissiveRect, tc).rgb;
+ vec3 colorEmissive = texture(emissiveRect, tc).rgb;
vec3 orm = spec.rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
vec3 f0 = vec3(0.04);
vec3 baseColor = diffuse.rgb;
-
+
vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);
diffuseColor *= 1.0 - metallic;
@@ -137,7 +137,7 @@ void main()
final_color += lit*scol*color.rgb*spec.rgb;
}
}
-
+
if (dot(final_color, final_color) <= 0.0)
{
discard;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl
index 8d23f1b427..6111f0bf77 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class3\deferred\pointLightV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,10 +36,10 @@ out vec3 trans_center;
void main()
{
- //transform vertex
- vec3 p = position*size+center;
- vec4 pos = modelview_projection_matrix * vec4(p.xyz, 1.0);
- vary_fragcoord = pos;
- trans_center = (modelview_matrix*vec4(center.xyz, 1.0)).xyz;
- gl_Position = pos;
+ //transform vertex
+ vec3 p = position*size+center;
+ vec4 pos = modelview_projection_matrix * vec4(p.xyz, 1.0);
+ vary_fragcoord = pos;
+ trans_center = (modelview_matrix*vec4(center.xyz, 1.0)).xyz;
+ gl_Position = pos;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index 906e66ecc8..ae81a4b472 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -49,7 +49,7 @@ layout (std140) uniform ReflectionProbes
mat4 refBox[MAX_REFMAP_COUNT];
// list of bounding spheres for reflection probes sorted by distance to camera (closest first)
vec4 refSphere[MAX_REFMAP_COUNT];
- // extra parameters
+ // extra parameters
// x - irradiance scale
// y - radiance scale
// z - fade in
@@ -95,7 +95,7 @@ bool shouldSampleProbe(int i, vec3 pos)
if (refIndex[i].w < 0)
{
vec4 v = refBox[i] * vec4(pos, 1.0);
- if (abs(v.x) > 1 ||
+ if (abs(v.x) > 1 ||
abs(v.y) > 1 ||
abs(v.z) > 1)
{
@@ -222,7 +222,7 @@ void preProbeSample(vec3 pos)
}
}
count++;
-
+
++neighborIdx;
}
@@ -244,56 +244,56 @@ void preProbeSample(vec3 pos)
// original reference implementation:
/*
-bool intersect(const Ray &ray) const
-{
- float t0, t1; // solutions for t if the ray intersects
-#if 0
+bool intersect(const Ray &ray) const
+{
+ float t0, t1; // solutions for t if the ray intersects
+#if 0
// geometric solution
- Vec3f L = center - orig;
- float tca = L.dotProduct(dir);
+ Vec3f L = center - orig;
+ float tca = L.dotProduct(dir);
// if (tca < 0) return false;
- float d2 = L.dotProduct(L) - tca * tca;
- if (d2 > radius2) return false;
- float thc = sqrt(radius2 - d2);
- t0 = tca - thc;
- t1 = tca + thc;
-#else
+ float d2 = L.dotProduct(L) - tca * tca;
+ if (d2 > radius2) return false;
+ float thc = sqrt(radius2 - d2);
+ t0 = tca - thc;
+ t1 = tca + thc;
+#else
// analytic solution
- Vec3f L = orig - center;
- float a = dir.dotProduct(dir);
- float b = 2 * dir.dotProduct(L);
- float c = L.dotProduct(L) - radius2;
- if (!solveQuadratic(a, b, c, t0, t1)) return false;
-#endif
- if (t0 > t1) std::swap(t0, t1);
-
- if (t0 < 0) {
- t0 = t1; // if t0 is negative, let's use t1 instead
- if (t0 < 0) return false; // both t0 and t1 are negative
- }
-
- t = t0;
-
- return true;
+ Vec3f L = orig - center;
+ float a = dir.dotProduct(dir);
+ float b = 2 * dir.dotProduct(L);
+ float c = L.dotProduct(L) - radius2;
+ if (!solveQuadratic(a, b, c, t0, t1)) return false;
+#endif
+ if (t0 > t1) std::swap(t0, t1);
+
+ if (t0 < 0) {
+ t0 = t1; // if t0 is negative, let's use t1 instead
+ if (t0 < 0) return false; // both t0 and t1 are negative
+ }
+
+ t = t0;
+
+ return true;
} */
// adapted -- assume that origin is inside sphere, return intersection of ray with edge of sphere
vec3 sphereIntersect(vec3 origin, vec3 dir, vec3 center, float radius2)
-{
- float t0, t1; // solutions for t if the ray intersects
+{
+ float t0, t1; // solutions for t if the ray intersects
- vec3 L = center - origin;
+ vec3 L = center - origin;
float tca = dot(L,dir);
- float d2 = dot(L,L) - tca * tca;
+ float d2 = dot(L,L) - tca * tca;
+
+ float thc = sqrt(radius2 - d2);
+ t0 = tca - thc;
+ t1 = tca + thc;
- float thc = sqrt(radius2 - d2);
- t0 = tca - thc;
- t1 = tca + thc;
-
vec3 v = origin + dir * t1;
- return v;
-}
+ return v;
+}
void swap(inout float a, inout float b)
{
@@ -305,17 +305,17 @@ void swap(inout float a, inout float b)
// debug implementation, make no assumptions about origin
void sphereIntersectDebug(vec3 origin, vec3 dir, vec3 center, float radius2, float depth, inout vec4 col)
{
- float t[2]; // solutions for t if the ray intersects
+ float t[2]; // solutions for t if the ray intersects
// geometric solution
- vec3 L = center - origin;
+ vec3 L = center - origin;
float tca = dot(L, dir);
// if (tca < 0) return false;
- float d2 = dot(L, L) - tca * tca;
- if (d2 > radius2) return;
- float thc = sqrt(radius2 - d2);
- t[0] = tca - thc;
- t[1] = tca + thc;
+ float d2 = dot(L, L) - tca * tca;
+ if (d2 > radius2) return;
+ float thc = sqrt(radius2 - d2);
+ t[0] = tca - thc;
+ t[1] = tca + thc;
for (int i = 0; i < 2; ++i)
{
@@ -404,8 +404,8 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col)
bool behind = dot(v,v) > dot(pos,pos);
float w = 0.25;
-
- if (behind)
+
+ if (behind)
{
w *= 0.5;
w /= (length(v)-length(pos))*0.5+1.0;
@@ -419,7 +419,7 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col)
// cribbed from https://iquilezles.org/articles/intersectors/
// axis aligned box centered at the origin, with size boxSize
-void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col)
+void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col)
{
vec3 rd = normalize(p-ro);
@@ -446,7 +446,7 @@ void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col)
void boxIntersectDebug(vec3 origin, vec3 pos, int i, inout vec4 col)
{
mat4 clipToLocal = refBox[i];
-
+
// transform into unit cube space
origin = (clipToLocal * vec4(origin, 1.0)).xyz;
pos = (clipToLocal * vec4(pos, 1.0)).xyz;
@@ -464,7 +464,7 @@ void boxIntersectDebug(vec3 origin, vec3 pos, int i, inout vec4 col)
// dw - distance weight
float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, int i, out float dw)
{
- float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)
+ float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)
vec3 delta = pos.xyz - origin;
float d2 = max(length(delta), 0.001);
@@ -488,7 +488,7 @@ float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, int i, out float dw
// lod - which mip to sample (lower is higher res, sharper reflections)
// c - center of probe
// r2 - radius of probe squared
-// i - index of probe
+// i - index of probe
vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, int i)
{
// parallax adjustment
@@ -507,7 +507,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,
float rr = r * r;
- v = sphereIntersect(pos, dir, c,
+ v = sphereIntersect(pos, dir, c,
refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres
rr);
@@ -518,7 +518,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,
vec3 d = normalize(v);
v = env_mat * v;
-
+
vec4 ret = textureLod(reflectionProbes, vec4(v.xyz, refIndex[i].x), lod) * refParams[i].y;
return ret.rgb;
@@ -529,7 +529,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,
// dir - pixel normal
// w - weight of sample (distance and angular attenuation)
// dw - weight of sample (distance only)
-// i - index of probe
+// i - index of probe
vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i, vec3 amblit)
{
// parallax adjustment
@@ -547,7 +547,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int
// pad sphere for manual probe extending into automatic probe space
float rr = r * r;
- v = sphereIntersect(pos, dir, c,
+ v = sphereIntersect(pos, dir, c,
refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres
rr);
@@ -556,7 +556,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int
v -= c;
v = env_mat * v;
-
+
vec3 col = textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x;
col = mix(amblit, col, min(refParams[i].x, 1.0));
@@ -618,7 +618,7 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod)
col[1] *= 1.0/wsum[1];
col[0] = vec3(0);
}
-
+
return col[1]+col[0];
}
@@ -647,7 +647,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit)
{
continue;
}
-
+
{
float w = 0;
float dw = 0;
@@ -677,7 +677,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit)
col[1] *= 1.0/wsum[1];
col[0] = vec3(0);
}
-
+
return col[1]+col[0];
}
@@ -800,7 +800,7 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout
float lod = (1.0-glossiness)*reflection_lods;
glossenv = sampleProbes(pos, normalize(refnormpersp), lod);
}
-
+
if (envIntensity > 0.0)
{
legacyenv = sampleProbes(pos, normalize(refnormpersp), 0.0);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl
index dbf20fe2d8..63fa4ecc55 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl
@@ -53,7 +53,7 @@ float random (vec2 uv);
float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source, float glossiness);
-void main()
+void main()
{
vec2 tc = vary_fragcoord.xy;
float depth = linearDepth01(getDepth(tc), zNear, zFar);
@@ -63,13 +63,13 @@ void main()
vec3 pos = getPositionWithDepth(tc, getDepth(tc)).xyz;
vec4 spec = texture(specularRect, tc);
vec2 hitpixel;
-
+
vec4 diffuse = texture(diffuseRect, tc);
vec3 specCol = spec.rgb;
vec4 fcol = texture(diffuseMap, tc);
- if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
+ if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
{
vec3 orm = specCol.rgb;
float perceptualRoughness = orm.g;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl
index f7e7268cc3..5555024b03 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl
@@ -36,13 +36,13 @@ out vec3 camera_ray;
void main()
{
- //transform vertex
- vec4 pos = vec4(position.xyz, 1.0);
- gl_Position = pos;
-
- vary_fragcoord = pos.xy * 0.5 + 0.5;
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vec4 rayOrig = inv_proj * vec4(pos.xy, 1, 1);
+ vary_fragcoord = pos.xy * 0.5 + 0.5;
+
+ vec4 rayOrig = inv_proj * vec4(pos.xy, 1, 1);
camera_ray = rayOrig.xyz / rayOrig.w;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl
index f14f7eac8d..e8901c7ba2 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl
@@ -92,7 +92,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float
vec2 screenPosition;
bool hit = false;
hitColor = vec4(0);
-
+
int i = 0;
if (depth > depthRejectBias)
{
@@ -107,7 +107,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float
}
depthFromScreen = getLinearDepth(screenPosition);
delta = abs(marchingPosition.z) - depthFromScreen;
-
+
if (depth < depthFromScreen + epsilon && depth > depthFromScreen - epsilon)
{
break;
@@ -151,7 +151,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float
{
step *= 0.5;
marchingPosition = marchingPosition - step * sign(delta);
-
+
screenPosition = generateProjectedPosition(marchingPosition);
if (screenPosition.x > 1 || screenPosition.x < 0 ||
screenPosition.y > 1 || screenPosition.y < 0)
@@ -180,7 +180,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float
}
}
}
-
+
return hit;
}
@@ -335,18 +335,18 @@ collectedColor = vec4(1, 0, 1, 1);
vec2 uv2 = tc * screen_res;
float c = (uv2.x + uv2.y) * 0.125;
float jitter = mod( c, 1.0);
-
+
vec2 screenpos = 1 - abs(tc * 2 - 1);
float vignette = clamp((abs(screenpos.x) * abs(screenpos.y)) * 16,0, 1);
vignette *= clamp((dot(normalize(viewPos), n) * 0.5 + 0.5) * 5.5 - 0.8, 0, 1);
-
+
float zFar = 128.0;
vignette *= clamp(1.0+(viewPos.z/zFar), 0.0, 1.0);
vignette *= clamp(glossiness * 3 - 1.7, 0, 1);
vec4 hitpoint;
-
+
glossiness = 1 - glossiness;
totalSamples = int(max(glossySampleCount, glossySampleCount * glossiness * vignette));
@@ -376,7 +376,7 @@ collectedColor = vec4(1, 0, 1, 1);
collectedColor.a += 1;
}
}
-
+
if (hits > 0)
{
collectedColor /= hits;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 5e8fe9301a..47b5934b84 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -104,8 +104,8 @@ vec3 pbrBaseLight(vec3 diffuseColor,
vec3 additive,
vec3 atten);
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
+vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+ float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@@ -168,7 +168,7 @@ void main()
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
{
- vec3 orm = texture(specularRect, tc).rgb;
+ vec3 orm = texture(specularRect, tc).rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
float ao = orm.r;
@@ -176,9 +176,9 @@ void main()
vec3 colorEmissive = texture(emissiveRect, tc).rgb;
// PBR IBL
float gloss = 1.0 - perceptualRoughness;
-
+
sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear);
-
+
adjustIrradiance(irradiance, ambocc);
vec3 diffuseColor;
@@ -199,7 +199,7 @@ void main()
{
// legacy shaders are still writng sRGB to gbuffer
baseColor.rgb = srgb_to_linear(baseColor.rgb);
-
+
spec.rgb = srgb_to_linear(spec.rgb);
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
@@ -209,7 +209,7 @@ void main()
vec3 legacyenv = vec3(0);
sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false, amblit_linear);
-
+
adjustIrradiance(irradiance, ambocc);
// apply lambertian IBL only (see pbrIbl)
@@ -218,7 +218,7 @@ void main()
vec3 sun_contrib = min(da, scol) * sunlit_linear;
color.rgb += sun_contrib;
color.rgb *= baseColor.rgb;
-
+
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
if (spec.a > 0.0)
@@ -247,7 +247,7 @@ void main()
}
color.rgb = mix(color.rgb, baseColor.rgb, baseColor.a);
-
+
if (envIntensity > 0.0)
{ // add environment map
applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
index d31b37fb60..871c7ce812 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file class3\deferred\spotLightF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -83,8 +83,8 @@ vec4 getPosition(vec2 pos_screen);
const float M_PI = 3.14159265;
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
+vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+ float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@@ -112,13 +112,13 @@ void main()
}
float shadow = 1.0;
-
+
if (proj_shadow_idx >= 0)
{
vec4 shd = texture(lightMap, tc);
shadow = (proj_shadow_idx==0)?shd.b:shd.a;
shadow += shadow_fade;
- shadow = clamp(shadow, 0.0, 1.0);
+ shadow = clamp(shadow, 0.0, 1.0);
}
float envIntensity;
@@ -145,13 +145,13 @@ void main()
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
{
- vec3 colorEmissive = texture(emissiveRect, tc).rgb;
+ vec3 colorEmissive = texture(emissiveRect, tc).rgb;
vec3 orm = spec.rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
vec3 f0 = vec3(0.04);
vec3 baseColor = diffuse.rgb;
-
+
vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);
diffuseColor *= 1.0 - metallic;
@@ -169,7 +169,7 @@ void main()
if (nl > 0.0)
{
amb_da += (nl*0.5 + 0.5) * proj_ambiance;
-
+
dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
vec3 intensity = dist_atten * dlit * 3.25 * shadow; // Legacy attenuation, magic number to balance with legacy materials
@@ -205,11 +205,11 @@ void main()
// unshadowed for consistency between forward and deferred?
amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
}
-
+
amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );
final_color += diffuse.rgb * amb_rgb * max(dot(-normalize(lv), n), 0.0);
}
-
+
if (spec.a > 0.0)
{
dlit *= min(nl*6.0, 1.0) * dist_atten;
@@ -218,7 +218,7 @@ void main()
float gtdenom = 2 * nh;
float gt = max(0, min(gtdenom * nv / vh, gtdenom * nl / vh));
-
+
if (nh > 0.0)
{
float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl);
@@ -226,26 +226,26 @@ void main()
speccol = clamp(speccol, vec3(0), vec3(1));
final_color += speccol;
}
- }
+ }
if (envIntensity > 0.0)
{
vec3 ref = reflect(normalize(pos), n);
-
+
//project from point pos in direction ref to plane proj_p, proj_n
vec3 pdelta = proj_p-pos;
float ds = dot(ref, proj_n);
-
+
if (ds < 0.0)
{
vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-
+
vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
if (stc.z > 0.0)
{
stc /= stc.w;
-
+
if (stc.x < 1.0 &&
stc.y < 1.0 &&
stc.x > 0.0 &&
diff --git a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl
index f6b8299f91..61059e2339 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl
@@ -43,7 +43,7 @@ void main()
float depth = getDepth(tc.xy);
if (above_water > 0)
- {
+ {
// we want to depth test when the camera is above water, but some GPUs have a hard time
// with depth testing against render targets that are bound for sampling in the same shader
// so we do it manually here
@@ -61,5 +61,5 @@ void main()
vec4 fogged = getWaterFogView(pos.xyz);
frag_color = max(fogged, vec4(0)); //output linear since local lights will be added to this shader's results
-
+
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl
index 16381a5d51..9c2b367158 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl
@@ -41,19 +41,19 @@ uniform mat4 modelview_projection_matrix;
void main()
{
- //transform vertex
- vec4 pos = vec4(position.xyz, 1.0);
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
if (above_water > 0)
{
pos = modelview_projection_matrix*pos;
}
- gl_Position = pos;
+ gl_Position = pos;
// appease OSX GLSL compiler/linker by touching all the varyings we said we would
setAtmosAttenuation(vec3(1));
setAdditiveColor(vec3(0));
- vary_fragcoord = pos;
+ vary_fragcoord = pos;
}
diff --git a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl
index 223e55eb69..3bf606a252 100644
--- a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl
@@ -4,25 +4,25 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
out vec4 frag_color;
uniform sampler2D diffuseMap;
@@ -56,26 +56,26 @@ in vec3 vary_position;
vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color);
-void main()
+void main()
{
- vec4 color;
+ vec4 color;
//get detail normals
- vec3 wave1 = texture(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
- vec3 wave2 = texture(bumpMap, littleWave.xy).xyz*2.0-1.0;
- vec3 wave3 = texture(bumpMap, littleWave.zw).xyz*2.0-1.0;
- vec3 wavef = normalize(wave1+wave2+wave3);
-
- //figure out distortion vector (ripply)
- vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
- distort = distort+wavef.xy*refScale;
+ vec3 wave1 = texture(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
+ vec3 wave2 = texture(bumpMap, littleWave.xy).xyz*2.0-1.0;
+ vec3 wave3 = texture(bumpMap, littleWave.zw).xyz*2.0-1.0;
+ vec3 wavef = normalize(wave1+wave2+wave3);
+
+ //figure out distortion vector (ripply)
+ vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
+ distort = distort+wavef.xy*refScale;
#ifdef TRANSPARENT_WATER
- vec4 fb = texture(screenTex, distort);
+ vec4 fb = texture(screenTex, distort);
#else
vec4 fb = vec4(waterFogColorLinear, 0.0);
#endif
-
+
fb = applyWaterFogViewLinearNoClip(vary_position, fb);
frag_color = max(fb, vec4(0));
diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
index b364e454e8..88c38c46a2 100644
--- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file waterF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
// class3/environment/waterF.glsl
out vec4 frag_color;
@@ -127,7 +127,7 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,
vec3 getPositionWithNDC(vec3 ndc);
-void main()
+void main()
{
vN = vary_normal;
vT = vary_tangent;
@@ -157,7 +157,7 @@ void main()
vec3 wave3 = BlendNormal(wave3_a, wave3_b);
vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
-
+
//wave1 = transform_normal(wave1);
//wave2 = transform_normal(wave2);
//wave3 = transform_normal(wave3);
@@ -168,7 +168,7 @@ void main()
vec3 up = transform_normal(vec3(0,0,1));
float vdu = -dot(viewVec, up)*2;
-
+
vec3 wave_ibl = wavef;
wave_ibl.z *= 2.0;
wave_ibl = transform_normal(normalize(wave_ibl));
@@ -182,13 +182,13 @@ void main()
//wavef = vec3(0, 0, 1);
wavef = transform_normal(wavef);
-
- float dist2 = dist;
- dist = max(dist, 5.0);
-
- float dmod = sqrt(dist);
-
- //figure out distortion vector (ripply)
+
+ float dist2 = dist;
+ dist = max(dist, 5.0);
+
+ float dmod = sqrt(dist);
+
+ //figure out distortion vector (ripply)
vec2 distort2 = distort + waver.xy * refScale / max(dmod, 1.0);
distort2 = clamp(distort2, vec2(0), vec2(0.999));
@@ -232,7 +232,7 @@ void main()
float metallic = 0.0;
float perceptualRoughness = 0.05;
float gloss = 1.0 - perceptualRoughness;
-
+
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
sampleReflectionProbesWater(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss, amblit);
@@ -248,7 +248,7 @@ void main()
vec3 colorEmissive = vec3(0);
float ao = 1.0;
vec3 light_dir = transform_normal(lightDir);
-
+
perceptualRoughness = 0.0;
metallic = 1.0;
@@ -281,7 +281,7 @@ void main()
color = ((1.0 - f) * color) + fb.rgb;
float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0.05);
-
+
frag_color = max(vec4(color, spec), vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
index 77bbbabfae..8d6b5cf890 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
@@ -1,34 +1,34 @@
-/**
+/**
* @file class3\lighting\lightV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
// used for preview renders only
vec4 sumLights(vec3 pos, vec3 norm, vec4 color);
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)
{
- vec4 c = sumLights(pos, norm, color);
+ vec4 c = sumLights(pos, norm, color);
return c;
}
diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl
index c1aee69c30..85b05ca034 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl
@@ -4,25 +4,25 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);
vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol);
@@ -32,35 +32,35 @@ vec3 atmosGetDiffuseSunlightColor();
vec3 scaleDownLight(vec3 light);
uniform vec4 light_position[8];
-uniform vec4 light_attenuation[8];
+uniform vec4 light_attenuation[8];
uniform vec3 light_diffuse[8];
vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor)
{
- vec4 col = vec4(0.0, 0.0, 0.0, color.a);
-
- vec3 view = normalize(pos);
-
- /// collect all the specular values from each calcXXXLightSpecular() function
- vec4 specularSum = vec4(0.0);
-
- // Collect normal lights (need to be divided by two, as we later multiply by 2)
- col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0);
- col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[2].xyz, light_attenuation[2].x, light_attenuation[2].y, light_diffuse[2].rgb);
- col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[3].xyz, light_attenuation[3].x, light_attenuation[3].y, light_diffuse[3].rgb);
- col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[4].xyz, light_attenuation[4].x, light_attenuation[4].y, light_diffuse[4].rgb);
- col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[5].xyz, light_attenuation[5].x, light_attenuation[5].y, light_diffuse[5].rgb);
- col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[6].xyz, light_attenuation[6].x, light_attenuation[6].y, light_diffuse[6].rgb);
- col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[7].xyz, light_attenuation[7].x, light_attenuation[7].y, light_diffuse[7].rgb);
- col.rgb = scaleDownLight(col.rgb);
-
- // Add windlight lights
- col.rgb += atmosAmbient();
- col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor(), 1.0));
+ vec4 col = vec4(0.0, 0.0, 0.0, color.a);
+
+ vec3 view = normalize(pos);
+
+ /// collect all the specular values from each calcXXXLightSpecular() function
+ vec4 specularSum = vec4(0.0);
+
+ // Collect normal lights (need to be divided by two, as we later multiply by 2)
+ col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0);
+ col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[2].xyz, light_attenuation[2].x, light_attenuation[2].y, light_diffuse[2].rgb);
+ col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[3].xyz, light_attenuation[3].x, light_attenuation[3].y, light_diffuse[3].rgb);
+ col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[4].xyz, light_attenuation[4].x, light_attenuation[4].y, light_diffuse[4].rgb);
+ col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[5].xyz, light_attenuation[5].x, light_attenuation[5].y, light_diffuse[5].rgb);
+ col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[6].xyz, light_attenuation[6].x, light_attenuation[6].y, light_diffuse[6].rgb);
+ col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[7].xyz, light_attenuation[7].x, light_attenuation[7].y, light_diffuse[7].rgb);
+ col.rgb = scaleDownLight(col.rgb);
+
+ // Add windlight lights
+ col.rgb += atmosAmbient();
+ col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor(), 1.0));
- col.rgb = min(col.rgb*color.rgb, 1.0);
- specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0);
+ col.rgb = min(col.rgb*color.rgb, 1.0);
+ specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0);
- col.rgb += specularColor.rgb;
- return col;
+ col.rgb += specularColor.rgb;
+ return col;
}
diff --git a/indra/newview/app_settings/shaders/errorF.glsl b/indra/newview/app_settings/shaders/errorF.glsl
index 573bb5887b..a4ad1e62d9 100644
--- a/indra/newview/app_settings/shaders/errorF.glsl
+++ b/indra/newview/app_settings/shaders/errorF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file errorF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/app_settings/shaders/errorV.glsl b/indra/newview/app_settings/shaders/errorV.glsl
index e4b362c8c8..54516dee4e 100644
--- a/indra/newview/app_settings/shaders/errorV.glsl
+++ b/indra/newview/app_settings/shaders/errorV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file errorV.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/build_win32_appConfig.py b/indra/newview/build_win32_appConfig.py
index d18d7b88cb..1bfcc7a9bc 100755
--- a/indra/newview/build_win32_appConfig.py
+++ b/indra/newview/build_win32_appConfig.py
@@ -4,21 +4,21 @@
# $LicenseInfo:firstyear=2009&license=viewerlgpl$
# Second Life Viewer Source Code
# Copyright (C) 2010, Linden Research, Inc.
-#
+#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation;
# version 2.1 of the License only.
-#
+#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
-#
+#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
+#
# Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
# $/LicenseInfo$
@@ -29,7 +29,7 @@ def munge_binding_redirect_version(src_manifest_name, src_config_name, dst_confi
manifest_dom = parse(src_manifest_name)
node = manifest_dom.getElementsByTagName('assemblyIdentity')[0]
manifest_assm_ver = node.getAttribute('version')
-
+
config_dom = parse(src_config_name)
node = config_dom.getElementsByTagName('bindingRedirect')[0]
node.setAttribute('newVersion', manifest_assm_ver)
@@ -42,15 +42,15 @@ def munge_binding_redirect_version(src_manifest_name, src_config_name, dst_confi
f = open(dst_config_name, 'w')
config_dom.writexml(f)
f.close()
-
-
+
+
def main():
config = sys.argv[1]
src_dir = sys.argv[2]
dst_dir = sys.argv[3]
dst_name = sys.argv[4]
-
+
if config.lower() == 'debug':
src_manifest_name = dst_dir + '/Microsoft.VC80.DebugCRT.manifest'
src_config_name = src_dir + '/SecondLifeDebug.exe.config'
@@ -59,9 +59,9 @@ def main():
src_config_name = src_dir + '/SecondLife.exe.config'
dst_config_name = dst_dir + '/' + dst_name
-
+
munge_binding_redirect_version(src_manifest_name, src_config_name, dst_config_name)
-
+
return 0
if __name__ == "__main__":
diff --git a/indra/newview/groupchatlistener.cpp b/indra/newview/groupchatlistener.cpp
index a05caa961b..43507f13e9 100644
--- a/indra/newview/groupchatlistener.cpp
+++ b/indra/newview/groupchatlistener.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2011-04-11
* @brief Implementation for groupchatlistener.
- *
+ *
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,16 +39,16 @@
namespace {
- void startIm_wrapper(LLSD const & event)
- {
- LLUUID session_id = LLGroupActions::startIM(event["id"].asUUID());
- sendReply(LLSDMap("session_id", LLSD(session_id)), event);
- }
+ void startIm_wrapper(LLSD const & event)
+ {
+ LLUUID session_id = LLGroupActions::startIM(event["id"].asUUID());
+ sendReply(LLSDMap("session_id", LLSD(session_id)), event);
+ }
- void send_message_wrapper(const std::string& text, const LLUUID& session_id, const LLUUID& group_id)
- {
- LLIMModel::sendMessage(text, session_id, group_id, IM_SESSION_GROUP_START);
- }
+ void send_message_wrapper(const std::string& text, const LLUUID& session_id, const LLUUID& group_id)
+ {
+ LLIMModel::sendMessage(text, session_id, group_id, IM_SESSION_GROUP_START);
+ }
}
@@ -71,6 +71,6 @@ GroupChatListener::GroupChatListener():
llsd::array("text", "session_id", "group_id"));
}
/*
- static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
- const LLUUID& other_participant_id, EInstantMessage dialog);
+ static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
+ const LLUUID& other_participant_id, EInstantMessage dialog);
*/
diff --git a/indra/newview/groupchatlistener.h b/indra/newview/groupchatlistener.h
index 0c76db305e..3819ac59b7 100644
--- a/indra/newview/groupchatlistener.h
+++ b/indra/newview/groupchatlistener.h
@@ -2,26 +2,26 @@
* @file groupchatlistener.h
* @author Nat Goodspeed
* @date 2011-04-11
- * @brief
- *
+ * @brief
+ *
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llaccountingcost.h b/indra/newview/llaccountingcost.h
index bc770fe1d2..d28ff48131 100644
--- a/indra/newview/llaccountingcost.h
+++ b/indra/newview/llaccountingcost.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llaccountingcost.h
* @
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,21 +30,21 @@
//SelectionQuota atm does not require a id
struct SelectionCost
{
- SelectionCost( /*LLTransactionID transactionId, */ F32 physicsCost, F32 networkCost, F32 simulationCost )
- //: mTransactionId( transactionId)
- : mPhysicsCost( physicsCost )
- , mNetworkCost( networkCost )
- , mSimulationCost( simulationCost )
- {
- }
- SelectionCost()
- : mPhysicsCost( 0.0f )
- , mNetworkCost( 0.0f )
- , mSimulationCost( 0.0f )
- {}
-
- F32 mPhysicsCost, mNetworkCost, mSimulationCost;
- //LLTransactionID mTransactionId;
+ SelectionCost( /*LLTransactionID transactionId, */ F32 physicsCost, F32 networkCost, F32 simulationCost )
+ //: mTransactionId( transactionId)
+ : mPhysicsCost( physicsCost )
+ , mNetworkCost( networkCost )
+ , mSimulationCost( simulationCost )
+ {
+ }
+ SelectionCost()
+ : mPhysicsCost( 0.0f )
+ , mNetworkCost( 0.0f )
+ , mSimulationCost( 0.0f )
+ {}
+
+ F32 mPhysicsCost, mNetworkCost, mSimulationCost;
+ //LLTransactionID mTransactionId;
};
typedef enum { Roots = 0 , Prims } eSelectionType;
diff --git a/indra/newview/llaccountingcostmanager.cpp b/indra/newview/llaccountingcostmanager.cpp
index d3f988d715..38fa4477b3 100644
--- a/indra/newview/llaccountingcostmanager.cpp
+++ b/indra/newview/llaccountingcostmanager.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file LLAccountingQuotaManager.cpp
- * @ Handles the setting and accessing for costs associated with mesh
+ * @ Handles the setting and accessing for costs associated with mesh
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,11 +38,11 @@
//===============================================================================
LLAccountingCostManager::LLAccountingCostManager()
-{
+{
}
-// Coroutine for sending and processing avatar name cache requests.
+// Coroutine for sending and processing avatar name cache requests.
// Do not call directly. See documentation in lleventcoro.h and llcoro.h for
// further explanation.
void LLAccountingCostManager::accountingCostCoro(std::string url,
@@ -103,9 +103,9 @@ void LLAccountingCostManager::accountingCostCoro(std::string url,
LLSD httpResults = results["http_result"];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
- // do/while(false) allows error conditions to break out of following
+ // do/while(false) allows error conditions to break out of following
// block while normal flow goes forward once.
- do
+ do
{
observer = observerHandle.get();
@@ -164,34 +164,34 @@ void LLAccountingCostManager::accountingCostCoro(std::string url,
//===============================================================================
void LLAccountingCostManager::fetchCosts( eSelectionType selectionType,
- const std::string& url,
- const LLHandle<LLAccountingCostObserver>& observer_handle )
+ const std::string& url,
+ const LLHandle<LLAccountingCostObserver>& observer_handle )
{
- // Invoking system must have already determined capability availability
- if ( !url.empty() )
- {
- std::string coroname =
+ // Invoking system must have already determined capability availability
+ if ( !url.empty() )
+ {
+ std::string coroname =
LLCoros::instance().launch("LLAccountingCostManager::accountingCostCoro",
boost::bind(&LLAccountingCostManager::accountingCostCoro, this, url, selectionType, observer_handle));
LL_DEBUGS() << coroname << " with url '" << url << LL_ENDL;
- }
- else
- {
- //url was empty - warn & continue
- LL_WARNS()<<"Supplied url is empty "<<LL_ENDL;
- mObjectList.clear();
- mPendingObjectQuota.clear();
- }
+ }
+ else
+ {
+ //url was empty - warn & continue
+ LL_WARNS()<<"Supplied url is empty "<<LL_ENDL;
+ mObjectList.clear();
+ mPendingObjectQuota.clear();
+ }
}
//===============================================================================
void LLAccountingCostManager::addObject( const LLUUID& objectID )
{
- mObjectList.insert( objectID );
+ mObjectList.insert( objectID );
}
//===============================================================================
void LLAccountingCostManager::removePendingObject( const LLUUID& objectID )
{
- mPendingObjectQuota.erase( objectID );
+ mPendingObjectQuota.erase( objectID );
}
//===============================================================================
diff --git a/indra/newview/llaccountingcostmanager.h b/indra/newview/llaccountingcostmanager.h
index d133c6437b..a147d8bdbf 100644
--- a/indra/newview/llaccountingcostmanager.h
+++ b/indra/newview/llaccountingcostmanager.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllAccountingQuotaManager.h
* @
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,39 +36,39 @@
class LLAccountingCostObserver
{
public:
- LLAccountingCostObserver() { mObserverHandle.bind(this); }
- virtual ~LLAccountingCostObserver() {}
- virtual void onWeightsUpdate(const SelectionCost& selection_cost) = 0;
- virtual void setErrorStatus(S32 status, const std::string& reason) = 0;
- const LLHandle<LLAccountingCostObserver>& getObserverHandle() const { return mObserverHandle; }
- const LLUUID& getTransactionID() { return mTransactionID; }
+ LLAccountingCostObserver() { mObserverHandle.bind(this); }
+ virtual ~LLAccountingCostObserver() {}
+ virtual void onWeightsUpdate(const SelectionCost& selection_cost) = 0;
+ virtual void setErrorStatus(S32 status, const std::string& reason) = 0;
+ const LLHandle<LLAccountingCostObserver>& getObserverHandle() const { return mObserverHandle; }
+ const LLUUID& getTransactionID() { return mTransactionID; }
protected:
- virtual void generateTransactionID() = 0;
+ virtual void generateTransactionID() = 0;
- LLRootHandle<LLAccountingCostObserver> mObserverHandle;
- LLUUID mTransactionID;
+ LLRootHandle<LLAccountingCostObserver> mObserverHandle;
+ LLUUID mTransactionID;
};
//===============================================================================
class LLAccountingCostManager : public LLSingleton<LLAccountingCostManager>
{
- LLSINGLETON(LLAccountingCostManager);
+ LLSINGLETON(LLAccountingCostManager);
public:
- //Store an object that will be eventually fetched
- void addObject( const LLUUID& objectID );
- //Request quotas for object list
- void fetchCosts( eSelectionType selectionType, const std::string& url,
- const LLHandle<LLAccountingCostObserver>& observer_handle );
- //Delete a specific object from the pending list
- void removePendingObject( const LLUUID& objectID );
-
+ //Store an object that will be eventually fetched
+ void addObject( const LLUUID& objectID );
+ //Request quotas for object list
+ void fetchCosts( eSelectionType selectionType, const std::string& url,
+ const LLHandle<LLAccountingCostObserver>& observer_handle );
+ //Delete a specific object from the pending list
+ void removePendingObject( const LLUUID& objectID );
+
private:
- //Set of objects that will be used to generate a cost
- uuid_set_t mObjectList;
- //During fetchCosts we move object into a the pending set to signify that
- //a fetch has been instigated.
- uuid_set_t mPendingObjectQuota;
+ //Set of objects that will be used to generate a cost
+ uuid_set_t mObjectList;
+ //During fetchCosts we move object into a the pending set to signify that
+ //a fetch has been instigated.
+ uuid_set_t mPendingObjectQuota;
void accountingCostCoro(std::string url, eSelectionType selectionType, const LLHandle<LLAccountingCostObserver> observerHandle);
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 13501833b2..6db7088812 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagent.cpp
* @brief LLAgent class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
#include "llviewerprecompiledheaders.h"
-#include "llagent.h"
+#include "llagent.h"
#include "pipeline.h"
@@ -103,14 +103,14 @@ using namespace LLAvatarAppearanceDefines;
extern LLMenuBarGL* gMenuBarView;
const BOOL ANIMATE = TRUE;
-const U8 AGENT_STATE_TYPING = 0x04;
+const U8 AGENT_STATE_TYPING = 0x04;
const U8 AGENT_STATE_EDITING = 0x10;
// Autopilot constants
-const F32 AUTOPILOT_HEIGHT_ADJUST_DISTANCE = 8.f; // meters
-const F32 AUTOPILOT_MIN_TARGET_HEIGHT_OFF_GROUND = 1.f; // meters
-const F32 AUTOPILOT_MAX_TIME_NO_PROGRESS_WALK = 1.5f; // seconds
-const F32 AUTOPILOT_MAX_TIME_NO_PROGRESS_FLY = 2.5f; // seconds. Flying is less presize, needs a bit more time
+const F32 AUTOPILOT_HEIGHT_ADJUST_DISTANCE = 8.f; // meters
+const F32 AUTOPILOT_MIN_TARGET_HEIGHT_OFF_GROUND = 1.f; // meters
+const F32 AUTOPILOT_MAX_TIME_NO_PROGRESS_WALK = 1.5f; // seconds
+const F32 AUTOPILOT_MAX_TIME_NO_PROGRESS_FLY = 2.5f; // seconds. Flying is less presize, needs a bit more time
const F32 MAX_VELOCITY_AUTO_LAND_SQUARED = 4.f * 4.f;
const F64 CHAT_AGE_FAST_RATE = 3.0;
@@ -129,112 +129,112 @@ LLAgent gAgent;
class LLTeleportRequest
{
public:
- enum EStatus
- {
- kPending,
- kStarted,
- kFailed,
- kRestartPending
- };
+ enum EStatus
+ {
+ kPending,
+ kStarted,
+ kFailed,
+ kRestartPending
+ };
- LLTeleportRequest();
- virtual ~LLTeleportRequest();
+ LLTeleportRequest();
+ virtual ~LLTeleportRequest();
- EStatus getStatus() const {return mStatus;};
- void setStatus(EStatus pStatus) {mStatus = pStatus;};
+ EStatus getStatus() const {return mStatus;};
+ void setStatus(EStatus pStatus) {mStatus = pStatus;};
- static std::map<S32, std::string> sTeleportStatusName;
- static const std::string& statusName(EStatus status);
- virtual void toOstream(std::ostream& os) const;
+ static std::map<S32, std::string> sTeleportStatusName;
+ static const std::string& statusName(EStatus status);
+ virtual void toOstream(std::ostream& os) const;
- virtual bool canRestartTeleport();
+ virtual bool canRestartTeleport();
- virtual void startTeleport() = 0;
- virtual void restartTeleport();
+ virtual void startTeleport() = 0;
+ virtual void restartTeleport();
protected:
private:
- EStatus mStatus;
+ EStatus mStatus;
};
std::map<S32, std::string> LLTeleportRequest::sTeleportStatusName = { { kPending, "kPending" },
- { kStarted, "kStarted" },
- { kFailed, "kFailed" },
- { kRestartPending, "kRestartPending"} };
+ { kStarted, "kStarted" },
+ { kFailed, "kFailed" },
+ { kRestartPending, "kRestartPending"} };
class LLTeleportRequestViaLandmark : public LLTeleportRequest
{
public:
- LLTeleportRequestViaLandmark(const LLUUID &pLandmarkId);
- virtual ~LLTeleportRequestViaLandmark();
+ LLTeleportRequestViaLandmark(const LLUUID &pLandmarkId);
+ virtual ~LLTeleportRequestViaLandmark();
- virtual void toOstream(std::ostream& os) const;
+ virtual void toOstream(std::ostream& os) const;
- virtual bool canRestartTeleport();
+ virtual bool canRestartTeleport();
- virtual void startTeleport();
- virtual void restartTeleport();
+ virtual void startTeleport();
+ virtual void restartTeleport();
protected:
- inline const LLUUID &getLandmarkId() const {return mLandmarkId;};
+ inline const LLUUID &getLandmarkId() const {return mLandmarkId;};
private:
- LLUUID mLandmarkId;
+ LLUUID mLandmarkId;
};
class LLTeleportRequestViaLure : public LLTeleportRequestViaLandmark
{
public:
- LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL pIsLureGodLike);
- virtual ~LLTeleportRequestViaLure();
+ LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL pIsLureGodLike);
+ virtual ~LLTeleportRequestViaLure();
- virtual void toOstream(std::ostream& os) const;
+ virtual void toOstream(std::ostream& os) const;
- virtual bool canRestartTeleport();
+ virtual bool canRestartTeleport();
- virtual void startTeleport();
+ virtual void startTeleport();
protected:
- inline BOOL isLureGodLike() const {return mIsLureGodLike;};
+ inline BOOL isLureGodLike() const {return mIsLureGodLike;};
private:
- BOOL mIsLureGodLike;
+ BOOL mIsLureGodLike;
};
class LLTeleportRequestViaLocation : public LLTeleportRequest
{
public:
- LLTeleportRequestViaLocation(const LLVector3d &pPosGlobal);
- virtual ~LLTeleportRequestViaLocation();
+ LLTeleportRequestViaLocation(const LLVector3d &pPosGlobal);
+ virtual ~LLTeleportRequestViaLocation();
- virtual void toOstream(std::ostream& os) const;
+ virtual void toOstream(std::ostream& os) const;
- virtual bool canRestartTeleport();
+ virtual bool canRestartTeleport();
- virtual void startTeleport();
- virtual void restartTeleport();
+ virtual void startTeleport();
+ virtual void restartTeleport();
protected:
- inline const LLVector3d &getPosGlobal() const {return mPosGlobal;};
+ inline const LLVector3d &getPosGlobal() const {return mPosGlobal;};
private:
- LLVector3d mPosGlobal;
+ LLVector3d mPosGlobal;
};
class LLTeleportRequestViaLocationLookAt : public LLTeleportRequestViaLocation
{
public:
- LLTeleportRequestViaLocationLookAt(const LLVector3d &pPosGlobal);
- virtual ~LLTeleportRequestViaLocationLookAt();
+ LLTeleportRequestViaLocationLookAt(const LLVector3d &pPosGlobal);
+ virtual ~LLTeleportRequestViaLocationLookAt();
- virtual void toOstream(std::ostream& os) const;
+ virtual void toOstream(std::ostream& os) const;
- virtual bool canRestartTeleport();
+ virtual bool canRestartTeleport();
- virtual void startTeleport();
- virtual void restartTeleport();
+ virtual void startTeleport();
+ virtual void restartTeleport();
protected:
@@ -257,48 +257,48 @@ std::map<std::string, std::string> LLAgent::sTeleportProgressMessages;
class LLAgentFriendObserver : public LLFriendObserver
{
public:
- LLAgentFriendObserver() {}
- virtual ~LLAgentFriendObserver() {}
- virtual void changed(U32 mask);
+ LLAgentFriendObserver() {}
+ virtual ~LLAgentFriendObserver() {}
+ virtual void changed(U32 mask);
};
void LLAgentFriendObserver::changed(U32 mask)
{
- // if there's a change we're interested in.
- if((mask & (LLFriendObserver::POWERS)) != 0)
- {
- gAgent.friendsChanged();
- }
+ // if there's a change we're interested in.
+ if((mask & (LLFriendObserver::POWERS)) != 0)
+ {
+ gAgent.friendsChanged();
+ }
}
bool handleSlowMotionAnimation(const LLSD& newvalue)
{
- if (newvalue.asBoolean())
- {
- gAgentAvatarp->setAnimTimeFactor(0.2f);
- }
- else
- {
- gAgentAvatarp->setAnimTimeFactor(1.0f);
- }
- return true;
+ if (newvalue.asBoolean())
+ {
+ gAgentAvatarp->setAnimTimeFactor(0.2f);
+ }
+ else
+ {
+ gAgentAvatarp->setAnimTimeFactor(1.0f);
+ }
+ return true;
}
void LLAgent::setCanEditParcel() // called via mParcelChangedSignal
{
- bool can_edit = LLToolMgr::getInstance()->canEdit();
- gAgent.mCanEditParcel = can_edit;
+ bool can_edit = LLToolMgr::getInstance()->canEdit();
+ gAgent.mCanEditParcel = can_edit;
}
// static
bool LLAgent::isActionAllowed(const LLSD& sdname)
{
- bool retval = false;
+ bool retval = false;
- const std::string& param = sdname.asString();
+ const std::string& param = sdname.asString();
- if (param == "speak")
- {
+ if (param == "speak")
+ {
bool allow_agent_voice = false;
LLVoiceChannel* channel = LLVoiceChannel::getCurrentVoiceChannel();
if (channel != NULL)
@@ -317,42 +317,42 @@ bool LLAgent::isActionAllowed(const LLSD& sdname)
if (gAgent.isVoiceConnected() &&
allow_agent_voice &&
!LLVoiceClient::getInstance()->inTuningMode())
- {
- retval = true;
- }
- else
- {
- retval = false;
- }
- }
+ {
+ retval = true;
+ }
+ else
+ {
+ retval = false;
+ }
+ }
- return retval;
+ return retval;
}
-// static
+// static
void LLAgent::pressMicrophone(const LLSD& name)
{
- LLFirstUse::speak(false);
+ LLFirstUse::speak(false);
- LLVoiceClient::getInstance()->inputUserControlState(true);
+ LLVoiceClient::getInstance()->inputUserControlState(true);
}
-// static
+// static
void LLAgent::releaseMicrophone(const LLSD& name)
{
- LLVoiceClient::getInstance()->inputUserControlState(false);
+ LLVoiceClient::getInstance()->inputUserControlState(false);
}
// static
void LLAgent::toggleMicrophone(const LLSD& name)
{
- LLVoiceClient::getInstance()->toggleUserPTTState();
+ LLVoiceClient::getInstance()->toggleUserPTTState();
}
// static
bool LLAgent::isMicrophoneOn(const LLSD& sdname)
{
- return LLVoiceClient::getInstance()->getUserPTTState();
+ return LLVoiceClient::getInstance()->getUserPTTState();
}
// ************************************************************
@@ -371,105 +371,105 @@ bool LLAgent::isMicrophoneOn(const LLSD& sdname)
// LLAgent()
//-----------------------------------------------------------------------------
LLAgent::LLAgent() :
- mGroupPowers(0),
- mHideGroupTitle(FALSE),
- mGroupID(),
-
- mInitialized(false),
- mListener(),
-
- mDoubleTapRunTimer(),
- mDoubleTapRunMode(DOUBLETAP_NONE),
-
- mbAlwaysRun(false),
- mbRunning(false),
- mbTeleportKeepsLookAt(false),
-
- mAgentAccess(new LLAgentAccess(gSavedSettings)),
- mGodLevelChangeSignal(),
- mCanEditParcel(false),
- mTeleportSourceSLURL(new LLSLURL),
- mTeleportRequest(),
- mTeleportFinishedSlot(),
- mTeleportFailedSlot(),
- mIsMaturityRatingChangingDuringTeleport(false),
- mTPNeedsNeabyChatSeparator(false),
- mMaturityRatingChange(0U),
- mIsDoSendMaturityPreferenceToServer(false),
- mMaturityPreferenceRequestId(0U),
- mMaturityPreferenceResponseId(0U),
- mMaturityPreferenceNumRetries(0U),
- mLastKnownRequestMaturity(SIM_ACCESS_MIN),
- mLastKnownResponseMaturity(SIM_ACCESS_MIN),
- mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),
- mTeleportState(TELEPORT_NONE),
- mRegionp(NULL),
+ mGroupPowers(0),
+ mHideGroupTitle(FALSE),
+ mGroupID(),
+
+ mInitialized(false),
+ mListener(),
+
+ mDoubleTapRunTimer(),
+ mDoubleTapRunMode(DOUBLETAP_NONE),
+
+ mbAlwaysRun(false),
+ mbRunning(false),
+ mbTeleportKeepsLookAt(false),
+
+ mAgentAccess(new LLAgentAccess(gSavedSettings)),
+ mGodLevelChangeSignal(),
+ mCanEditParcel(false),
+ mTeleportSourceSLURL(new LLSLURL),
+ mTeleportRequest(),
+ mTeleportFinishedSlot(),
+ mTeleportFailedSlot(),
+ mIsMaturityRatingChangingDuringTeleport(false),
+ mTPNeedsNeabyChatSeparator(false),
+ mMaturityRatingChange(0U),
+ mIsDoSendMaturityPreferenceToServer(false),
+ mMaturityPreferenceRequestId(0U),
+ mMaturityPreferenceResponseId(0U),
+ mMaturityPreferenceNumRetries(0U),
+ mLastKnownRequestMaturity(SIM_ACCESS_MIN),
+ mLastKnownResponseMaturity(SIM_ACCESS_MIN),
+ mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),
+ mTeleportState(TELEPORT_NONE),
+ mRegionp(NULL),
mInterestListMode(LLViewerRegion::IL_MODE_DEFAULT),
- mAgentOriginGlobal(),
- mPositionGlobal(),
+ mAgentOriginGlobal(),
+ mPositionGlobal(),
mLastTestGlobal(),
- mDistanceTraveled(0.F),
- mLastPositionGlobal(LLVector3d::zero),
+ mDistanceTraveled(0.F),
+ mLastPositionGlobal(LLVector3d::zero),
+
+ mRenderState(0),
+ mTypingTimer(),
- mRenderState(0),
- mTypingTimer(),
+ mViewsPushed(FALSE),
- mViewsPushed(FALSE),
+ mCustomAnim(FALSE),
+ mShowAvatar(TRUE),
+ mFrameAgent(),
- mCustomAnim(FALSE),
- mShowAvatar(TRUE),
- mFrameAgent(),
+ mIsDoNotDisturb(false),
- mIsDoNotDisturb(false),
+ mControlFlags(0x00000000),
+ mbFlagsDirty(FALSE),
+ mbFlagsNeedReset(FALSE),
- mControlFlags(0x00000000),
- mbFlagsDirty(FALSE),
- mbFlagsNeedReset(FALSE),
+ mAutoPilot(FALSE),
+ mAutoPilotFlyOnStop(FALSE),
+ mAutoPilotAllowFlying(TRUE),
+ mAutoPilotTargetGlobal(),
+ mAutoPilotStopDistance(1.f),
+ mAutoPilotUseRotation(FALSE),
+ mAutoPilotTargetFacing(LLVector3::zero),
+ mAutoPilotTargetDist(0.f),
+ mAutoPilotNoProgressFrameCount(0),
+ mAutoPilotRotationThreshold(0.f),
+ mAutoPilotFinishedCallback(NULL),
+ mAutoPilotCallbackData(NULL),
- mAutoPilot(FALSE),
- mAutoPilotFlyOnStop(FALSE),
- mAutoPilotAllowFlying(TRUE),
- mAutoPilotTargetGlobal(),
- mAutoPilotStopDistance(1.f),
- mAutoPilotUseRotation(FALSE),
- mAutoPilotTargetFacing(LLVector3::zero),
- mAutoPilotTargetDist(0.f),
- mAutoPilotNoProgressFrameCount(0),
- mAutoPilotRotationThreshold(0.f),
- mAutoPilotFinishedCallback(NULL),
- mAutoPilotCallbackData(NULL),
-
- mMovementKeysLocked(FALSE),
+ mMovementKeysLocked(FALSE),
- mEffectColor(new LLUIColor(LLColor4(0.f, 1.f, 1.f, 1.f))),
+ mEffectColor(new LLUIColor(LLColor4(0.f, 1.f, 1.f, 1.f))),
- mHaveHomePosition(FALSE),
- mHomeRegionHandle( 0 ),
- mNearChatRadius(CHAT_NORMAL_RADIUS / 2.f),
+ mHaveHomePosition(FALSE),
+ mHomeRegionHandle( 0 ),
+ mNearChatRadius(CHAT_NORMAL_RADIUS / 2.f),
- mNextFidgetTime(0.f),
- mCurrentFidget(0),
- mFirstLogin(false),
- mOutfitChosen(FALSE),
+ mNextFidgetTime(0.f),
+ mCurrentFidget(0),
+ mFirstLogin(false),
+ mOutfitChosen(FALSE),
- mVoiceConnected(false),
+ mVoiceConnected(false),
- mMouselookModeInSignal(NULL),
- mMouselookModeOutSignal(NULL)
+ mMouselookModeInSignal(NULL),
+ mMouselookModeOutSignal(NULL)
{
- for (U32 i = 0; i < TOTAL_CONTROLS; i++)
- {
- mControlsTakenCount[i] = 0;
- mControlsTakenPassedOnCount[i] = 0;
- }
+ for (U32 i = 0; i < TOTAL_CONTROLS; i++)
+ {
+ mControlsTakenCount[i] = 0;
+ mControlsTakenPassedOnCount[i] = 0;
+ }
- mListener.reset(new LLAgentListener(*this));
+ mListener.reset(new LLAgentListener(*this));
- addParcelChangedCallback(&setCanEditParcel);
+ addParcelChangedCallback(&setCanEditParcel);
- mMoveTimer.stop();
+ mMoveTimer.stop();
}
// Requires gSavedSettings to be initialized.
@@ -478,12 +478,12 @@ LLAgent::LLAgent() :
//-----------------------------------------------------------------------------
void LLAgent::init()
{
- mMoveTimer.start();
+ mMoveTimer.start();
- gSavedSettings.declareBOOL("SlowMotionAnimation", FALSE, "Declared in code", LLControlVariable::PERSIST_NO);
- gSavedSettings.getControl("SlowMotionAnimation")->getSignal()->connect(boost::bind(&handleSlowMotionAnimation, _2));
-
- // *Note: this is where LLViewerCamera::getInstance() used to be constructed.
+ gSavedSettings.declareBOOL("SlowMotionAnimation", FALSE, "Declared in code", LLControlVariable::PERSIST_NO);
+ gSavedSettings.getControl("SlowMotionAnimation")->getSignal()->connect(boost::bind(&handleSlowMotionAnimation, _2));
+
+ // *Note: this is where LLViewerCamera::getInstance() used to be constructed.
bool is_flying = gSavedSettings.getBOOL("FlyingAtExit");
if(is_flying)
@@ -491,28 +491,28 @@ void LLAgent::init()
setFlying(is_flying);
}
- *mEffectColor = LLUIColorTable::instance().getColor("EffectColor");
+ *mEffectColor = LLUIColorTable::instance().getColor("EffectColor");
- gSavedSettings.getControl("PreferredMaturity")->getValidateSignal()->connect(boost::bind(&LLAgent::validateMaturity, this, _2));
- gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLAgent::handleMaturity, this, _2));
- mLastKnownResponseMaturity = static_cast<U8>(gSavedSettings.getU32("PreferredMaturity"));
- mLastKnownRequestMaturity = mLastKnownResponseMaturity;
- mIsDoSendMaturityPreferenceToServer = true;
+ gSavedSettings.getControl("PreferredMaturity")->getValidateSignal()->connect(boost::bind(&LLAgent::validateMaturity, this, _2));
+ gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLAgent::handleMaturity, this, _2));
+ mLastKnownResponseMaturity = static_cast<U8>(gSavedSettings.getU32("PreferredMaturity"));
+ mLastKnownRequestMaturity = mLastKnownResponseMaturity;
+ mIsDoSendMaturityPreferenceToServer = true;
- if (!mTeleportFinishedSlot.connected())
- {
- mTeleportFinishedSlot = LLViewerParcelMgr::getInstance()->setTeleportFinishedCallback(boost::bind(&LLAgent::handleTeleportFinished, this));
- }
- if (!mTeleportFailedSlot.connected())
- {
- mTeleportFailedSlot = LLViewerParcelMgr::getInstance()->setTeleportFailedCallback(boost::bind(&LLAgent::handleTeleportFailed, this));
- }
+ if (!mTeleportFinishedSlot.connected())
+ {
+ mTeleportFinishedSlot = LLViewerParcelMgr::getInstance()->setTeleportFinishedCallback(boost::bind(&LLAgent::handleTeleportFinished, this));
+ }
+ if (!mTeleportFailedSlot.connected())
+ {
+ mTeleportFailedSlot = LLViewerParcelMgr::getInstance()->setTeleportFailedCallback(boost::bind(&LLAgent::handleTeleportFailed, this));
+ }
- LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
+ LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
- mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AGENT);
+ mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AGENT);
- mInitialized = true;
+ mInitialized = true;
}
//-----------------------------------------------------------------------------
@@ -520,17 +520,17 @@ void LLAgent::init()
//-----------------------------------------------------------------------------
void LLAgent::cleanup()
{
- mRegionp = NULL;
+ mRegionp = NULL;
mTeleportRequest = NULL;
mTeleportCanceled = NULL;
- if (mTeleportFinishedSlot.connected())
- {
- mTeleportFinishedSlot.disconnect();
- }
- if (mTeleportFailedSlot.connected())
- {
- mTeleportFailedSlot.disconnect();
- }
+ if (mTeleportFinishedSlot.connected())
+ {
+ mTeleportFinishedSlot.disconnect();
+ }
+ if (mTeleportFailedSlot.connected())
+ {
+ mTeleportFailedSlot.disconnect();
+ }
}
//-----------------------------------------------------------------------------
@@ -538,19 +538,19 @@ void LLAgent::cleanup()
//-----------------------------------------------------------------------------
LLAgent::~LLAgent()
{
- cleanup();
+ cleanup();
- delete mMouselookModeInSignal;
- mMouselookModeInSignal = NULL;
- delete mMouselookModeOutSignal;
- mMouselookModeOutSignal = NULL;
+ delete mMouselookModeInSignal;
+ mMouselookModeInSignal = NULL;
+ delete mMouselookModeOutSignal;
+ mMouselookModeOutSignal = NULL;
- delete mAgentAccess;
- mAgentAccess = NULL;
- delete mEffectColor;
- mEffectColor = NULL;
- delete mTeleportSourceSLURL;
- mTeleportSourceSLURL = NULL;
+ delete mAgentAccess;
+ mAgentAccess = NULL;
+ delete mEffectColor;
+ mEffectColor = NULL;
+ delete mTeleportSourceSLURL;
+ mTeleportSourceSLURL = NULL;
}
// Handle any actions that need to be performed when the main app gains focus
@@ -560,11 +560,11 @@ LLAgent::~LLAgent()
//-----------------------------------------------------------------------------
void LLAgent::onAppFocusGained()
{
- if (CAMERA_MODE_MOUSELOOK == gAgentCamera.getCameraMode())
- {
- gAgentCamera.changeCameraToDefault();
- LLToolMgr::getInstance()->clearSavedTool();
- }
+ if (CAMERA_MODE_MOUSELOOK == gAgentCamera.getCameraMode())
+ {
+ gAgentCamera.changeCameraToDefault();
+ LLToolMgr::getInstance()->clearSavedTool();
+ }
}
void LLAgent::setFirstLogin(bool b)
@@ -657,13 +657,13 @@ void LLAgent::showLatestFeatureNotification(const std::string key)
void LLAgent::ageChat()
{
- if (isAgentAvatarValid())
- {
- // get amount of time since I last chatted
- F64 elapsed_time = (F64)gAgentAvatarp->mChatTimer.getElapsedTimeF32();
- // add in frame time * 3 (so it ages 4x)
- gAgentAvatarp->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0));
- }
+ if (isAgentAvatarValid())
+ {
+ // get amount of time since I last chatted
+ F64 elapsed_time = (F64)gAgentAvatarp->mChatTimer.getElapsedTimeF32();
+ // add in frame time * 3 (so it ages 4x)
+ gAgentAvatarp->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0));
+ }
}
//-----------------------------------------------------------------------------
@@ -671,29 +671,29 @@ void LLAgent::ageChat()
//-----------------------------------------------------------------------------
void LLAgent::moveAt(S32 direction, bool reset)
{
- LLUIUsage::instance().logCommand("Agent.MoveAt");
-
- mMoveTimer.reset();
- LLFirstUse::notMoving(false);
+ LLUIUsage::instance().logCommand("Agent.MoveAt");
- // age chat timer so it fades more quickly when you are intentionally moving
- ageChat();
+ mMoveTimer.reset();
+ LLFirstUse::notMoving(false);
- gAgentCamera.setAtKey(LLAgentCamera::directionToKey(direction));
+ // age chat timer so it fades more quickly when you are intentionally moving
+ ageChat();
- if (direction > 0)
- {
- setControlFlags(AGENT_CONTROL_AT_POS | AGENT_CONTROL_FAST_AT);
- }
- else if (direction < 0)
- {
- setControlFlags(AGENT_CONTROL_AT_NEG | AGENT_CONTROL_FAST_AT);
- }
+ gAgentCamera.setAtKey(LLAgentCamera::directionToKey(direction));
- if (reset)
- {
- gAgentCamera.resetView();
- }
+ if (direction > 0)
+ {
+ setControlFlags(AGENT_CONTROL_AT_POS | AGENT_CONTROL_FAST_AT);
+ }
+ else if (direction < 0)
+ {
+ setControlFlags(AGENT_CONTROL_AT_NEG | AGENT_CONTROL_FAST_AT);
+ }
+
+ if (reset)
+ {
+ gAgentCamera.resetView();
+ }
}
//-----------------------------------------------------------------------------
@@ -701,24 +701,24 @@ void LLAgent::moveAt(S32 direction, bool reset)
//-----------------------------------------------------------------------------
void LLAgent::moveAtNudge(S32 direction)
{
- mMoveTimer.reset();
- LLFirstUse::notMoving(false);
+ mMoveTimer.reset();
+ LLFirstUse::notMoving(false);
- // age chat timer so it fades more quickly when you are intentionally moving
- ageChat();
+ // age chat timer so it fades more quickly when you are intentionally moving
+ ageChat();
- gAgentCamera.setWalkKey(LLAgentCamera::directionToKey(direction));
+ gAgentCamera.setWalkKey(LLAgentCamera::directionToKey(direction));
- if (direction > 0)
- {
- setControlFlags(AGENT_CONTROL_NUDGE_AT_POS);
- }
- else if (direction < 0)
- {
- setControlFlags(AGENT_CONTROL_NUDGE_AT_NEG);
- }
+ if (direction > 0)
+ {
+ setControlFlags(AGENT_CONTROL_NUDGE_AT_POS);
+ }
+ else if (direction < 0)
+ {
+ setControlFlags(AGENT_CONTROL_NUDGE_AT_NEG);
+ }
- gAgentCamera.resetView();
+ gAgentCamera.resetView();
}
//-----------------------------------------------------------------------------
@@ -726,24 +726,24 @@ void LLAgent::moveAtNudge(S32 direction)
//-----------------------------------------------------------------------------
void LLAgent::moveLeft(S32 direction)
{
- mMoveTimer.reset();
- LLFirstUse::notMoving(false);
+ mMoveTimer.reset();
+ LLFirstUse::notMoving(false);
- // age chat timer so it fades more quickly when you are intentionally moving
- ageChat();
+ // age chat timer so it fades more quickly when you are intentionally moving
+ ageChat();
- gAgentCamera.setLeftKey(LLAgentCamera::directionToKey(direction));
+ gAgentCamera.setLeftKey(LLAgentCamera::directionToKey(direction));
- if (direction > 0)
- {
- setControlFlags(AGENT_CONTROL_LEFT_POS | AGENT_CONTROL_FAST_LEFT);
- }
- else if (direction < 0)
- {
- setControlFlags(AGENT_CONTROL_LEFT_NEG | AGENT_CONTROL_FAST_LEFT);
- }
+ if (direction > 0)
+ {
+ setControlFlags(AGENT_CONTROL_LEFT_POS | AGENT_CONTROL_FAST_LEFT);
+ }
+ else if (direction < 0)
+ {
+ setControlFlags(AGENT_CONTROL_LEFT_NEG | AGENT_CONTROL_FAST_LEFT);
+ }
- gAgentCamera.resetView();
+ gAgentCamera.resetView();
}
//-----------------------------------------------------------------------------
@@ -751,24 +751,24 @@ void LLAgent::moveLeft(S32 direction)
//-----------------------------------------------------------------------------
void LLAgent::moveLeftNudge(S32 direction)
{
- mMoveTimer.reset();
- LLFirstUse::notMoving(false);
+ mMoveTimer.reset();
+ LLFirstUse::notMoving(false);
- // age chat timer so it fades more quickly when you are intentionally moving
- ageChat();
+ // age chat timer so it fades more quickly when you are intentionally moving
+ ageChat();
- gAgentCamera.setLeftKey(LLAgentCamera::directionToKey(direction));
+ gAgentCamera.setLeftKey(LLAgentCamera::directionToKey(direction));
- if (direction > 0)
- {
- setControlFlags(AGENT_CONTROL_NUDGE_LEFT_POS);
- }
- else if (direction < 0)
- {
- setControlFlags(AGENT_CONTROL_NUDGE_LEFT_NEG);
- }
+ if (direction > 0)
+ {
+ setControlFlags(AGENT_CONTROL_NUDGE_LEFT_POS);
+ }
+ else if (direction < 0)
+ {
+ setControlFlags(AGENT_CONTROL_NUDGE_LEFT_NEG);
+ }
- gAgentCamera.resetView();
+ gAgentCamera.resetView();
}
//-----------------------------------------------------------------------------
@@ -776,24 +776,24 @@ void LLAgent::moveLeftNudge(S32 direction)
//-----------------------------------------------------------------------------
void LLAgent::moveUp(S32 direction)
{
- mMoveTimer.reset();
- LLFirstUse::notMoving(false);
+ mMoveTimer.reset();
+ LLFirstUse::notMoving(false);
- // age chat timer so it fades more quickly when you are intentionally moving
- ageChat();
+ // age chat timer so it fades more quickly when you are intentionally moving
+ ageChat();
- gAgentCamera.setUpKey(LLAgentCamera::directionToKey(direction));
+ gAgentCamera.setUpKey(LLAgentCamera::directionToKey(direction));
- if (direction > 0)
- {
- setControlFlags(AGENT_CONTROL_UP_POS | AGENT_CONTROL_FAST_UP);
- }
- else if (direction < 0)
- {
- setControlFlags(AGENT_CONTROL_UP_NEG | AGENT_CONTROL_FAST_UP);
- }
+ if (direction > 0)
+ {
+ setControlFlags(AGENT_CONTROL_UP_POS | AGENT_CONTROL_FAST_UP);
+ }
+ else if (direction < 0)
+ {
+ setControlFlags(AGENT_CONTROL_UP_NEG | AGENT_CONTROL_FAST_UP);
+ }
- gAgentCamera.resetView();
+ gAgentCamera.resetView();
}
//-----------------------------------------------------------------------------
@@ -801,16 +801,16 @@ void LLAgent::moveUp(S32 direction)
//-----------------------------------------------------------------------------
void LLAgent::moveYaw(F32 mag, bool reset_view)
{
- gAgentCamera.setYawKey(mag);
+ gAgentCamera.setYawKey(mag);
- if (mag > 0)
- {
- setControlFlags(AGENT_CONTROL_YAW_POS);
- }
- else if (mag < 0)
- {
- setControlFlags(AGENT_CONTROL_YAW_NEG);
- }
+ if (mag > 0)
+ {
+ setControlFlags(AGENT_CONTROL_YAW_POS);
+ }
+ else if (mag < 0)
+ {
+ setControlFlags(AGENT_CONTROL_YAW_NEG);
+ }
U32 mask = AGENT_CONTROL_YAW_POS | AGENT_CONTROL_YAW_NEG;
if ((getControlFlags() & mask) == mask)
@@ -822,9 +822,9 @@ void LLAgent::moveYaw(F32 mag, bool reset_view)
}
if (reset_view)
- {
+ {
gAgentCamera.resetView();
- }
+ }
}
//-----------------------------------------------------------------------------
@@ -832,42 +832,42 @@ void LLAgent::moveYaw(F32 mag, bool reset_view)
//-----------------------------------------------------------------------------
void LLAgent::movePitch(F32 mag)
{
- gAgentCamera.setPitchKey(mag);
+ gAgentCamera.setPitchKey(mag);
- if (mag > 0)
- {
- setControlFlags(AGENT_CONTROL_PITCH_POS);
- }
- else if (mag < 0)
- {
- setControlFlags(AGENT_CONTROL_PITCH_NEG);
- }
+ if (mag > 0)
+ {
+ setControlFlags(AGENT_CONTROL_PITCH_POS);
+ }
+ else if (mag < 0)
+ {
+ setControlFlags(AGENT_CONTROL_PITCH_NEG);
+ }
}
// Does this parcel allow you to fly?
BOOL LLAgent::canFly()
{
- if (isGodlike()) return TRUE;
+ if (isGodlike()) return TRUE;
- LLViewerRegion* regionp = getRegion();
- if (regionp && regionp->getBlockFly()) return FALSE;
-
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!parcel) return FALSE;
+ LLViewerRegion* regionp = getRegion();
+ if (regionp && regionp->getBlockFly()) return FALSE;
- // Allow owners to fly on their own land.
- if (LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_ALLOW_FLY))
- {
- return TRUE;
- }
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!parcel) return FALSE;
- return parcel->getAllowFly();
+ // Allow owners to fly on their own land.
+ if (LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_ALLOW_FLY))
+ {
+ return TRUE;
+ }
+
+ return parcel->getAllowFly();
}
BOOL LLAgent::getFlying() const
-{
- return mControlFlags & AGENT_CONTROL_FLY;
+{
+ return mControlFlags & AGENT_CONTROL_FLY;
}
//-----------------------------------------------------------------------------
@@ -875,55 +875,55 @@ BOOL LLAgent::getFlying() const
//-----------------------------------------------------------------------------
void LLAgent::setFlying(BOOL fly, BOOL fail_sound)
{
- if (isAgentAvatarValid())
- {
- // *HACK: Don't allow to start the flying mode if we got ANIM_AGENT_STANDUP signal
- // because in this case we won't get a signal to start avatar flying animation and
- // it will be walking with flying mode "ON" indication. However we allow to switch
- // the flying mode off if we get ANIM_AGENT_STANDUP signal. See process_avatar_animation().
- // See EXT-2781.
- if(fly && gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != gAgentAvatarp->mSignaledAnimations.end())
- {
- return;
- }
-
- // don't allow taking off while sitting
- if (fly && gAgentAvatarp->isSitting())
- {
- return;
- }
- }
-
- if (fly)
- {
- BOOL was_flying = getFlying();
- if (!canFly() && !was_flying)
- {
- // parcel doesn't let you start fly
- // gods can always fly
- // and it's OK if you're already flying
- if (fail_sound)
- {
- make_ui_sound("UISndBadKeystroke");
- }
- return;
- }
- if( !was_flying )
- {
- add(LLStatViewer::FLY, 1);
- }
- setControlFlags(AGENT_CONTROL_FLY);
- }
- else
- {
- clearControlFlags(AGENT_CONTROL_FLY);
- }
-
-
- // Update Movement Controls according to Fly mode
- LLFloaterMove::setFlyingMode(fly);
-
- mbFlagsDirty = TRUE;
+ if (isAgentAvatarValid())
+ {
+ // *HACK: Don't allow to start the flying mode if we got ANIM_AGENT_STANDUP signal
+ // because in this case we won't get a signal to start avatar flying animation and
+ // it will be walking with flying mode "ON" indication. However we allow to switch
+ // the flying mode off if we get ANIM_AGENT_STANDUP signal. See process_avatar_animation().
+ // See EXT-2781.
+ if(fly && gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ return;
+ }
+
+ // don't allow taking off while sitting
+ if (fly && gAgentAvatarp->isSitting())
+ {
+ return;
+ }
+ }
+
+ if (fly)
+ {
+ BOOL was_flying = getFlying();
+ if (!canFly() && !was_flying)
+ {
+ // parcel doesn't let you start fly
+ // gods can always fly
+ // and it's OK if you're already flying
+ if (fail_sound)
+ {
+ make_ui_sound("UISndBadKeystroke");
+ }
+ return;
+ }
+ if( !was_flying )
+ {
+ add(LLStatViewer::FLY, 1);
+ }
+ setControlFlags(AGENT_CONTROL_FLY);
+ }
+ else
+ {
+ clearControlFlags(AGENT_CONTROL_FLY);
+ }
+
+
+ // Update Movement Controls according to Fly mode
+ LLFloaterMove::setFlyingMode(fly);
+
+ mbFlagsDirty = TRUE;
}
@@ -934,29 +934,29 @@ void LLAgent::setFlying(BOOL fly, BOOL fail_sound)
// static
void LLAgent::toggleFlying()
{
- if ( gAgent.mAutoPilot )
- {
- LLToolPie::instance().stopClickToWalk();
- }
+ if ( gAgent.mAutoPilot )
+ {
+ LLToolPie::instance().stopClickToWalk();
+ }
- BOOL fly = !gAgent.getFlying();
+ BOOL fly = !gAgent.getFlying();
- gAgent.mMoveTimer.reset();
- LLFirstUse::notMoving(false);
+ gAgent.mMoveTimer.reset();
+ LLFirstUse::notMoving(false);
- gAgent.setFlying( fly );
- gAgentCamera.resetView();
+ gAgent.setFlying( fly );
+ gAgentCamera.resetView();
}
// static
bool LLAgent::enableFlying()
{
- BOOL sitting = FALSE;
- if (isAgentAvatarValid())
- {
- sitting = gAgentAvatarp->isSitting();
- }
- return !sitting;
+ BOOL sitting = FALSE;
+ if (isAgentAvatarValid())
+ {
+ sitting = gAgentAvatarp->isSitting();
+ }
+ return !sitting;
}
// static
@@ -972,24 +972,24 @@ bool LLAgent::isSitting()
void LLAgent::standUp()
{
- setControlFlags(AGENT_CONTROL_STAND_UP);
+ setControlFlags(AGENT_CONTROL_STAND_UP);
}
void LLAgent::changeParcels()
{
- LL_DEBUGS("AgentLocation") << "Calling ParcelChanged callbacks" << LL_ENDL;
- // Notify anything that wants to know about parcel changes
- mParcelChangedSignal();
+ LL_DEBUGS("AgentLocation") << "Calling ParcelChanged callbacks" << LL_ENDL;
+ // Notify anything that wants to know about parcel changes
+ mParcelChangedSignal();
}
boost::signals2::connection LLAgent::addParcelChangedCallback(parcel_changed_callback_t cb)
{
- return mParcelChangedSignal.connect(cb);
+ return mParcelChangedSignal.connect(cb);
}
// static
void LLAgent::capabilityReceivedCallback(const LLUUID &region_id, LLViewerRegion *regionp)
-{ // Changed regions and now have the region capabilities
+{ // Changed regions and now have the region capabilities
if (regionp)
{
if (regionp->getRegionID() == region_id)
@@ -1011,40 +1011,40 @@ void LLAgent::capabilityReceivedCallback(const LLUUID &region_id, LLViewerRegion
//-----------------------------------------------------------------------------
void LLAgent::setRegion(LLViewerRegion *regionp)
{
- llassert(regionp);
- if (mRegionp != regionp)
- {
-
- LL_INFOS("AgentLocation","Teleport") << "Moving agent into region: handle " << regionp->getHandle()
- << " id " << regionp->getRegionID()
- << " name " << regionp->getName()
- << " previous region "
- << (mRegionp ? mRegionp->getRegionID() : LLUUID::null)
- << LL_ENDL;
- if (mRegionp)
- {
- // We've changed regions, we're now going to change our agent coordinate frame.
- mAgentOriginGlobal = regionp->getOriginGlobal();
- LLVector3d agent_offset_global = mRegionp->getOriginGlobal();
-
- LLVector3 delta;
- delta.setVec(regionp->getOriginGlobal() - mRegionp->getOriginGlobal());
-
- setPositionAgent(getPositionAgent() - delta);
-
- LLVector3 camera_position_agent = LLViewerCamera::getInstance()->getOrigin();
- LLViewerCamera::getInstance()->setOrigin(camera_position_agent - delta);
-
- // Update all of the regions.
- LLWorld::getInstance()->updateAgentOffset(agent_offset_global);
-
- // Hack to keep sky in the agent's region, otherwise it may get deleted - DJS 08/02/02
- // *TODO: possibly refactor into gSky->setAgentRegion(regionp)? -Brad
- if (gSky.mVOSkyp)
- {
- gSky.mVOSkyp->setRegion(regionp);
- }
-
+ llassert(regionp);
+ if (mRegionp != regionp)
+ {
+
+ LL_INFOS("AgentLocation","Teleport") << "Moving agent into region: handle " << regionp->getHandle()
+ << " id " << regionp->getRegionID()
+ << " name " << regionp->getName()
+ << " previous region "
+ << (mRegionp ? mRegionp->getRegionID() : LLUUID::null)
+ << LL_ENDL;
+ if (mRegionp)
+ {
+ // We've changed regions, we're now going to change our agent coordinate frame.
+ mAgentOriginGlobal = regionp->getOriginGlobal();
+ LLVector3d agent_offset_global = mRegionp->getOriginGlobal();
+
+ LLVector3 delta;
+ delta.setVec(regionp->getOriginGlobal() - mRegionp->getOriginGlobal());
+
+ setPositionAgent(getPositionAgent() - delta);
+
+ LLVector3 camera_position_agent = LLViewerCamera::getInstance()->getOrigin();
+ LLViewerCamera::getInstance()->setOrigin(camera_position_agent - delta);
+
+ // Update all of the regions.
+ LLWorld::getInstance()->updateAgentOffset(agent_offset_global);
+
+ // Hack to keep sky in the agent's region, otherwise it may get deleted - DJS 08/02/02
+ // *TODO: possibly refactor into gSky->setAgentRegion(regionp)? -Brad
+ if (gSky.mVOSkyp)
+ {
+ gSky.mVOSkyp->setRegion(regionp);
+ }
+
if (regionp->capabilitiesReceived())
{
regionp->requestSimulatorFeatures();
@@ -1055,22 +1055,22 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
regionp->setCapabilitiesReceivedCallback(LLAgent::capabilityReceivedCallback);
}
- }
- else
- {
- // First time initialization.
- // We've changed regions, we're now going to change our agent coordinate frame.
- mAgentOriginGlobal = regionp->getOriginGlobal();
+ }
+ else
+ {
+ // First time initialization.
+ // We've changed regions, we're now going to change our agent coordinate frame.
+ mAgentOriginGlobal = regionp->getOriginGlobal();
- LLVector3 delta;
- delta.setVec(regionp->getOriginGlobal());
+ LLVector3 delta;
+ delta.setVec(regionp->getOriginGlobal());
- setPositionAgent(getPositionAgent() - delta);
- LLVector3 camera_position_agent = LLViewerCamera::getInstance()->getOrigin();
- LLViewerCamera::getInstance()->setOrigin(camera_position_agent - delta);
+ setPositionAgent(getPositionAgent() - delta);
+ LLVector3 camera_position_agent = LLViewerCamera::getInstance()->getOrigin();
+ LLViewerCamera::getInstance()->setOrigin(camera_position_agent - delta);
- // Update all of the regions.
- LLWorld::getInstance()->updateAgentOffset(mAgentOriginGlobal);
+ // Update all of the regions.
+ LLWorld::getInstance()->updateAgentOffset(mAgentOriginGlobal);
if (regionp->capabilitiesReceived())
{
@@ -1080,36 +1080,36 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
{
regionp->setCapabilitiesReceivedCallback([](const LLUUID &region_id, LLViewerRegion* regionp) {LLAppViewer::instance()->updateNameLookupUrl(regionp); });
}
- }
+ }
- // Pass new region along to metrics components that care about this level of detail.
- LLAppViewer::metricsUpdateRegion(regionp->getHandle());
- }
+ // Pass new region along to metrics components that care about this level of detail.
+ LLAppViewer::metricsUpdateRegion(regionp->getHandle());
+ }
- mRegionp = regionp;
+ mRegionp = regionp;
- // TODO - most of what follows probably should be moved into callbacks
+ // TODO - most of what follows probably should be moved into callbacks
- // Pass the region host to LLUrlEntryParcel to resolve parcel name
- // with a server request.
- LLUrlEntryParcel::setRegionHost(getRegionHost());
+ // Pass the region host to LLUrlEntryParcel to resolve parcel name
+ // with a server request.
+ LLUrlEntryParcel::setRegionHost(getRegionHost());
- // Must shift hole-covering water object locations because local
- // coordinate frame changed.
- LLWorld::getInstance()->updateWaterObjects();
+ // Must shift hole-covering water object locations because local
+ // coordinate frame changed.
+ LLWorld::getInstance()->updateWaterObjects();
- // keep a list of regions we've been too
- // this is just an interesting stat, logged at the dataserver
- // we could trake this at the dataserver side, but that's harder
- U64 handle = regionp->getHandle();
- mRegionsVisited.insert(handle);
+ // keep a list of regions we've been too
+ // this is just an interesting stat, logged at the dataserver
+ // we could trake this at the dataserver side, but that's harder
+ U64 handle = regionp->getHandle();
+ mRegionsVisited.insert(handle);
- LLSelectMgr::getInstance()->updateSelectionCenter();
+ LLSelectMgr::getInstance()->updateSelectionCenter();
- LLFloaterMove::sUpdateFlyingStatus();
+ LLFloaterMove::sUpdateFlyingStatus();
- LL_DEBUGS("AgentLocation") << "Calling RegionChanged callbacks" << LL_ENDL;
- mRegionChangedSignal();
+ LL_DEBUGS("AgentLocation") << "Calling RegionChanged callbacks" << LL_ENDL;
+ mRegionChangedSignal();
}
@@ -1118,30 +1118,30 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
//-----------------------------------------------------------------------------
LLViewerRegion *LLAgent::getRegion() const
{
- return mRegionp;
+ return mRegionp;
}
LLHost LLAgent::getRegionHost() const
{
- if (mRegionp)
- {
- return mRegionp->getHost();
- }
- else
- {
- return LLHost();
- }
+ if (mRegionp)
+ {
+ return mRegionp->getHost();
+ }
+ else
+ {
+ return LLHost();
+ }
}
boost::signals2::connection LLAgent::addRegionChangedCallback(const region_changed_signal_t::slot_type& cb)
{
- return mRegionChangedSignal.connect(cb);
+ return mRegionChangedSignal.connect(cb);
}
void LLAgent::removeRegionChangedCallback(boost::signals2::connection callback)
{
- mRegionChangedSignal.disconnect(callback);
+ mRegionChangedSignal.disconnect(callback);
}
//-----------------------------------------------------------------------------
@@ -1149,7 +1149,7 @@ void LLAgent::removeRegionChangedCallback(boost::signals2::connection callback)
//-----------------------------------------------------------------------------
BOOL LLAgent::inPrelude()
{
- return mRegionp && mRegionp->isPrelude();
+ return mRegionp && mRegionp->isPrelude();
}
@@ -1157,7 +1157,7 @@ std::string LLAgent::getRegionCapability(const std::string &name)
{
if (!mRegionp)
return std::string();
-
+
return mRegionp->getCapability(name);
}
@@ -1168,7 +1168,7 @@ std::string LLAgent::getRegionCapability(const std::string &name)
BOOL LLAgent::canManageEstate() const
{
- return mRegionp && mRegionp->canManageEstate();
+ return mRegionp && mRegionp->canManageEstate();
}
//-----------------------------------------------------------------------------
@@ -1176,17 +1176,17 @@ BOOL LLAgent::canManageEstate() const
//-----------------------------------------------------------------------------
void LLAgent::sendMessage()
{
- if (gDisconnected)
- {
- LL_WARNS() << "Trying to send message when disconnected!" << LL_ENDL;
- return;
- }
- if (!mRegionp)
- {
- LL_ERRS() << "No region for agent yet!" << LL_ENDL;
- return;
- }
- gMessageSystem->sendMessage(mRegionp->getHost());
+ if (gDisconnected)
+ {
+ LL_WARNS() << "Trying to send message when disconnected!" << LL_ENDL;
+ return;
+ }
+ if (!mRegionp)
+ {
+ LL_ERRS() << "No region for agent yet!" << LL_ENDL;
+ return;
+ }
+ gMessageSystem->sendMessage(mRegionp->getHost());
}
@@ -1195,17 +1195,17 @@ void LLAgent::sendMessage()
//-----------------------------------------------------------------------------
void LLAgent::sendReliableMessage()
{
- if (gDisconnected)
- {
- LL_DEBUGS() << "Trying to send message when disconnected!" << LL_ENDL;
- return;
- }
- if (!mRegionp)
- {
- LL_DEBUGS() << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << LL_ENDL;
- return;
- }
- gMessageSystem->sendReliable(mRegionp->getHost());
+ if (gDisconnected)
+ {
+ LL_DEBUGS() << "Trying to send message when disconnected!" << LL_ENDL;
+ return;
+ }
+ if (!mRegionp)
+ {
+ LL_DEBUGS() << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << LL_ENDL;
+ return;
+ }
+ gMessageSystem->sendReliable(mRegionp->getHost());
}
//-----------------------------------------------------------------------------
@@ -1213,14 +1213,14 @@ void LLAgent::sendReliableMessage()
//-----------------------------------------------------------------------------
LLVector3 LLAgent::getVelocity() const
{
- if (isAgentAvatarValid())
- {
- return gAgentAvatarp->getVelocity();
- }
- else
- {
- return LLVector3::zero;
- }
+ if (isAgentAvatarValid())
+ {
+ return gAgentAvatarp->getVelocity();
+ }
+ else
+ {
+ return LLVector3::zero;
+ }
}
@@ -1229,35 +1229,35 @@ LLVector3 LLAgent::getVelocity() const
//-----------------------------------------------------------------------------
void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
{
- if (!pos_agent.isFinite())
- {
- LL_ERRS() << "setPositionAgent is not a number" << LL_ENDL;
- }
+ if (!pos_agent.isFinite())
+ {
+ LL_ERRS() << "setPositionAgent is not a number" << LL_ENDL;
+ }
- if (isAgentAvatarValid() && gAgentAvatarp->getParent())
- {
- LLVector3 pos_agent_sitting;
- LLVector3d pos_agent_d;
- LLViewerObject *parent = (LLViewerObject*)gAgentAvatarp->getParent();
+ if (isAgentAvatarValid() && gAgentAvatarp->getParent())
+ {
+ LLVector3 pos_agent_sitting;
+ LLVector3d pos_agent_d;
+ LLViewerObject *parent = (LLViewerObject*)gAgentAvatarp->getParent();
- pos_agent_sitting = gAgentAvatarp->getPosition() * parent->getRotation() + parent->getPositionAgent();
- pos_agent_d.setVec(pos_agent_sitting);
+ pos_agent_sitting = gAgentAvatarp->getPosition() * parent->getRotation() + parent->getPositionAgent();
+ pos_agent_d.setVec(pos_agent_sitting);
- mFrameAgent.setOrigin(pos_agent_sitting);
- mPositionGlobal = pos_agent_d + mAgentOriginGlobal;
- }
- else
- {
- mFrameAgent.setOrigin(pos_agent);
+ mFrameAgent.setOrigin(pos_agent_sitting);
+ mPositionGlobal = pos_agent_d + mAgentOriginGlobal;
+ }
+ else
+ {
+ mFrameAgent.setOrigin(pos_agent);
- LLVector3d pos_agent_d;
- pos_agent_d.setVec(pos_agent);
- mPositionGlobal = pos_agent_d + mAgentOriginGlobal;
- }
+ LLVector3d pos_agent_d;
+ pos_agent_d.setVec(pos_agent);
+ mPositionGlobal = pos_agent_d + mAgentOriginGlobal;
+ }
if (((mLastTestGlobal - mPositionGlobal).lengthSquared() > 1.0) && !mOnPositionChanged.empty())
{ // If the position has changed my more than 1 meter since the last time we triggered.
- // filters out some noise.
+ // filters out some noise.
mLastTestGlobal = mPositionGlobal;
mOnPositionChanged(mFrameAgent.getOrigin(), mPositionGlobal);
}
@@ -1268,16 +1268,16 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
//-----------------------------------------------------------------------------
const LLVector3d &LLAgent::getPositionGlobal() const
{
- if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull())
- {
- mPositionGlobal = getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());
- }
- else
- {
- mPositionGlobal = getPosGlobalFromAgent(mFrameAgent.getOrigin());
- }
+ if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull())
+ {
+ mPositionGlobal = getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());
+ }
+ else
+ {
+ mPositionGlobal = getPosGlobalFromAgent(mFrameAgent.getOrigin());
+ }
- return mPositionGlobal;
+ return mPositionGlobal;
}
//-----------------------------------------------------------------------------
@@ -1285,20 +1285,20 @@ const LLVector3d &LLAgent::getPositionGlobal() const
//-----------------------------------------------------------------------------
const LLVector3 &LLAgent::getPositionAgent()
{
- if (isAgentAvatarValid())
- {
- if(gAgentAvatarp->mDrawable.isNull())
- {
- mFrameAgent.setOrigin(gAgentAvatarp->getPositionAgent());
- }
- else
- {
- mFrameAgent.setOrigin(gAgentAvatarp->getRenderPosition());
- }
- }
+ if (isAgentAvatarValid())
+ {
+ if(gAgentAvatarp->mDrawable.isNull())
+ {
+ mFrameAgent.setOrigin(gAgentAvatarp->getPositionAgent());
+ }
+ else
+ {
+ mFrameAgent.setOrigin(gAgentAvatarp->getRenderPosition());
+ }
+ }
- return mFrameAgent.getOrigin();
+ return mFrameAgent.getOrigin();
}
boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot_type fn)
@@ -1312,7 +1312,7 @@ boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot
//-----------------------------------------------------------------------------
S32 LLAgent::getRegionsVisited() const
{
- return mRegionsVisited.size();
+ return mRegionsVisited.size();
}
//-----------------------------------------------------------------------------
@@ -1320,7 +1320,7 @@ S32 LLAgent::getRegionsVisited() const
//-----------------------------------------------------------------------------
F64 LLAgent::getDistanceTraveled() const
{
- return mDistanceTraveled;
+ return mDistanceTraveled;
}
@@ -1329,9 +1329,9 @@ F64 LLAgent::getDistanceTraveled() const
//-----------------------------------------------------------------------------
LLVector3 LLAgent::getPosAgentFromGlobal(const LLVector3d &pos_global) const
{
- LLVector3 pos_agent;
- pos_agent.setVec(pos_global - mAgentOriginGlobal);
- return pos_agent;
+ LLVector3 pos_agent;
+ pos_agent.setVec(pos_global - mAgentOriginGlobal);
+ return pos_agent;
}
@@ -1340,14 +1340,14 @@ LLVector3 LLAgent::getPosAgentFromGlobal(const LLVector3d &pos_global) const
//-----------------------------------------------------------------------------
LLVector3d LLAgent::getPosGlobalFromAgent(const LLVector3 &pos_agent) const
{
- LLVector3d pos_agent_d;
- pos_agent_d.setVec(pos_agent);
- return pos_agent_d + mAgentOriginGlobal;
+ LLVector3d pos_agent_d;
+ pos_agent_d.setVec(pos_agent);
+ return pos_agent_d + mAgentOriginGlobal;
}
void LLAgent::sitDown()
{
- setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
+ setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
}
@@ -1356,7 +1356,7 @@ void LLAgent::sitDown()
//-----------------------------------------------------------------------------
void LLAgent::resetAxes()
{
- mFrameAgent.resetAxes();
+ mFrameAgent.resetAxes();
}
@@ -1367,61 +1367,61 @@ void LLAgent::resetAxes()
//-----------------------------------------------------------------------------
void LLAgent::resetAxes(const LLVector3 &look_at)
{
- LLVector3 skyward = getReferenceUpVector();
+ LLVector3 skyward = getReferenceUpVector();
- // if look_at has zero length, fail
- // if look_at and skyward are parallel, fail
- //
- // Test both of these conditions with a cross product.
- LLVector3 cross(look_at % skyward);
- if (cross.isNull())
- {
- LL_INFOS() << "LLAgent::resetAxes cross-product is zero" << LL_ENDL;
- return;
- }
+ // if look_at has zero length, fail
+ // if look_at and skyward are parallel, fail
+ //
+ // Test both of these conditions with a cross product.
+ LLVector3 cross(look_at % skyward);
+ if (cross.isNull())
+ {
+ LL_INFOS() << "LLAgent::resetAxes cross-product is zero" << LL_ENDL;
+ return;
+ }
- // Make sure look_at and skyward are not parallel
- // and neither are zero length
- LLVector3 left(skyward % look_at);
- LLVector3 up(look_at % left);
+ // Make sure look_at and skyward are not parallel
+ // and neither are zero length
+ LLVector3 left(skyward % look_at);
+ LLVector3 up(look_at % left);
- mFrameAgent.setAxes(look_at, left, up);
+ mFrameAgent.setAxes(look_at, left, up);
}
//-----------------------------------------------------------------------------
// rotate()
//-----------------------------------------------------------------------------
-void LLAgent::rotate(F32 angle, const LLVector3 &axis)
-{
- mFrameAgent.rotate(angle, axis);
+void LLAgent::rotate(F32 angle, const LLVector3 &axis)
+{
+ mFrameAgent.rotate(angle, axis);
}
//-----------------------------------------------------------------------------
// rotate()
//-----------------------------------------------------------------------------
-void LLAgent::rotate(F32 angle, F32 x, F32 y, F32 z)
-{
- mFrameAgent.rotate(angle, x, y, z);
+void LLAgent::rotate(F32 angle, F32 x, F32 y, F32 z)
+{
+ mFrameAgent.rotate(angle, x, y, z);
}
//-----------------------------------------------------------------------------
// rotate()
//-----------------------------------------------------------------------------
-void LLAgent::rotate(const LLMatrix3 &matrix)
-{
- mFrameAgent.rotate(matrix);
+void LLAgent::rotate(const LLMatrix3 &matrix)
+{
+ mFrameAgent.rotate(matrix);
}
//-----------------------------------------------------------------------------
// rotate()
//-----------------------------------------------------------------------------
-void LLAgent::rotate(const LLQuaternion &quaternion)
-{
- mFrameAgent.rotate(quaternion);
+void LLAgent::rotate(const LLQuaternion &quaternion)
+{
+ mFrameAgent.rotate(quaternion);
}
@@ -1430,27 +1430,27 @@ void LLAgent::rotate(const LLQuaternion &quaternion)
//-----------------------------------------------------------------------------
LLVector3 LLAgent::getReferenceUpVector()
{
- // this vector is in the coordinate frame of the avatar's parent object, or the world if none
- LLVector3 up_vector = LLVector3::z_axis;
- if (isAgentAvatarValid() &&
- gAgentAvatarp->getParent() &&
- gAgentAvatarp->mDrawable.notNull())
- {
- U32 camera_mode = gAgentCamera.getCameraAnimating() ? gAgentCamera.getLastCameraMode() : gAgentCamera.getCameraMode();
- // and in third person...
- if (camera_mode == CAMERA_MODE_THIRD_PERSON)
- {
- // make the up vector point to the absolute +z axis
- up_vector = up_vector * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
- }
- else if (camera_mode == CAMERA_MODE_MOUSELOOK)
- {
- // make the up vector point to the avatar's +z axis
- up_vector = up_vector * gAgentAvatarp->mDrawable->getRotation();
- }
- }
-
- return up_vector;
+ // this vector is in the coordinate frame of the avatar's parent object, or the world if none
+ LLVector3 up_vector = LLVector3::z_axis;
+ if (isAgentAvatarValid() &&
+ gAgentAvatarp->getParent() &&
+ gAgentAvatarp->mDrawable.notNull())
+ {
+ U32 camera_mode = gAgentCamera.getCameraAnimating() ? gAgentCamera.getLastCameraMode() : gAgentCamera.getCameraMode();
+ // and in third person...
+ if (camera_mode == CAMERA_MODE_THIRD_PERSON)
+ {
+ // make the up vector point to the absolute +z axis
+ up_vector = up_vector * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
+ }
+ else if (camera_mode == CAMERA_MODE_MOUSELOOK)
+ {
+ // make the up vector point to the avatar's +z axis
+ up_vector = up_vector * gAgentAvatarp->mDrawable->getRotation();
+ }
+ }
+
+ return up_vector;
}
@@ -1460,41 +1460,41 @@ LLVector3 LLAgent::getReferenceUpVector()
//-----------------------------------------------------------------------------
void LLAgent::pitch(F32 angle)
{
- // don't let user pitch if pointed almost all the way down or up
-
- // A dot B = mag(A) * mag(B) * cos(angle between A and B)
- // so... cos(angle between A and B) = A dot B / mag(A) / mag(B)
- // = A dot B for unit vectors
-
- LLVector3 skyward = getReferenceUpVector();
-
- // clamp pitch to limits
- if (angle >= 0.f)
- {
- const F32 look_down_limit = 179.f * DEG_TO_RAD;
- F32 angle_from_skyward = acos(mFrameAgent.getAtAxis() * skyward);
- if (angle_from_skyward + angle > look_down_limit)
- {
- angle = look_down_limit - angle_from_skyward;
- }
- }
- else if (angle < 0.f)
- {
- const F32 look_up_limit = 5.f * DEG_TO_RAD;
- const LLVector3& viewer_camera_pos = LLViewerCamera::getInstance()->getOrigin();
- LLVector3 agent_focus_pos = getPosAgentFromGlobal(gAgentCamera.calcFocusPositionTargetGlobal());
- LLVector3 look_dir = agent_focus_pos - viewer_camera_pos;
- F32 angle_from_skyward = angle_between(look_dir, skyward);
- if (angle_from_skyward + angle < look_up_limit)
- {
- angle = look_up_limit - angle_from_skyward;
- }
- }
-
- if (fabs(angle) > 1e-4)
- {
- mFrameAgent.pitch(angle);
- }
+ // don't let user pitch if pointed almost all the way down or up
+
+ // A dot B = mag(A) * mag(B) * cos(angle between A and B)
+ // so... cos(angle between A and B) = A dot B / mag(A) / mag(B)
+ // = A dot B for unit vectors
+
+ LLVector3 skyward = getReferenceUpVector();
+
+ // clamp pitch to limits
+ if (angle >= 0.f)
+ {
+ const F32 look_down_limit = 179.f * DEG_TO_RAD;
+ F32 angle_from_skyward = acos(mFrameAgent.getAtAxis() * skyward);
+ if (angle_from_skyward + angle > look_down_limit)
+ {
+ angle = look_down_limit - angle_from_skyward;
+ }
+ }
+ else if (angle < 0.f)
+ {
+ const F32 look_up_limit = 5.f * DEG_TO_RAD;
+ const LLVector3& viewer_camera_pos = LLViewerCamera::getInstance()->getOrigin();
+ LLVector3 agent_focus_pos = getPosAgentFromGlobal(gAgentCamera.calcFocusPositionTargetGlobal());
+ LLVector3 look_dir = agent_focus_pos - viewer_camera_pos;
+ F32 angle_from_skyward = angle_between(look_dir, skyward);
+ if (angle_from_skyward + angle < look_up_limit)
+ {
+ angle = look_up_limit - angle_from_skyward;
+ }
+ }
+
+ if (fabs(angle) > 1e-4)
+ {
+ mFrameAgent.pitch(angle);
+ }
}
@@ -1503,7 +1503,7 @@ void LLAgent::pitch(F32 angle)
//-----------------------------------------------------------------------------
void LLAgent::roll(F32 angle)
{
- mFrameAgent.roll(angle);
+ mFrameAgent.roll(angle);
}
@@ -1512,10 +1512,10 @@ void LLAgent::roll(F32 angle)
//-----------------------------------------------------------------------------
void LLAgent::yaw(F32 angle)
{
- if (!rotateGrabbed())
- {
- mFrameAgent.rotate(angle, getReferenceUpVector());
- }
+ if (!rotateGrabbed())
+ {
+ mFrameAgent.rotate(angle, getReferenceUpVector());
+ }
}
@@ -1525,7 +1525,7 @@ void LLAgent::yaw(F32 angle)
//-----------------------------------------------------------------------------
LLQuaternion LLAgent::getQuat() const
{
- return mFrameAgent.getQuaternion();
+ return mFrameAgent.getQuaternion();
}
//-----------------------------------------------------------------------------
@@ -1533,7 +1533,7 @@ LLQuaternion LLAgent::getQuat() const
//-----------------------------------------------------------------------------
U32 LLAgent::getControlFlags()
{
- return mControlFlags;
+ return mControlFlags;
}
//-----------------------------------------------------------------------------
@@ -1541,8 +1541,8 @@ U32 LLAgent::getControlFlags()
//-----------------------------------------------------------------------------
void LLAgent::setControlFlags(U32 mask)
{
- mControlFlags |= mask;
- mbFlagsDirty = TRUE;
+ mControlFlags |= mask;
+ mbFlagsDirty = TRUE;
}
@@ -1551,12 +1551,12 @@ void LLAgent::setControlFlags(U32 mask)
//-----------------------------------------------------------------------------
void LLAgent::clearControlFlags(U32 mask)
{
- U32 old_flags = mControlFlags;
- mControlFlags &= ~mask;
- if (old_flags != mControlFlags)
- {
- mbFlagsDirty = TRUE;
- }
+ U32 old_flags = mControlFlags;
+ mControlFlags &= ~mask;
+ if (old_flags != mControlFlags)
+ {
+ mbFlagsDirty = TRUE;
+ }
}
//-----------------------------------------------------------------------------
@@ -1564,7 +1564,7 @@ void LLAgent::clearControlFlags(U32 mask)
//-----------------------------------------------------------------------------
BOOL LLAgent::controlFlagsDirty() const
{
- return mbFlagsDirty;
+ return mbFlagsDirty;
}
//-----------------------------------------------------------------------------
@@ -1572,7 +1572,7 @@ BOOL LLAgent::controlFlagsDirty() const
//-----------------------------------------------------------------------------
void LLAgent::enableControlFlagReset()
{
- mbFlagsNeedReset = TRUE;
+ mbFlagsNeedReset = TRUE;
}
//-----------------------------------------------------------------------------
@@ -1580,14 +1580,14 @@ void LLAgent::enableControlFlagReset()
//-----------------------------------------------------------------------------
void LLAgent::resetControlFlags()
{
- if (mbFlagsNeedReset)
- {
- mbFlagsNeedReset = FALSE;
- mbFlagsDirty = FALSE;
- // reset all of the ephemeral flags
- // some flags are managed elsewhere
- mControlFlags &= AGENT_CONTROL_AWAY | AGENT_CONTROL_FLY | AGENT_CONTROL_MOUSELOOK;
- }
+ if (mbFlagsNeedReset)
+ {
+ mbFlagsNeedReset = FALSE;
+ mbFlagsDirty = FALSE;
+ // reset all of the ephemeral flags
+ // some flags are managed elsewhere
+ mControlFlags &= AGENT_CONTROL_AWAY | AGENT_CONTROL_FLY | AGENT_CONTROL_MOUSELOOK;
+ }
}
//-----------------------------------------------------------------------------
@@ -1595,18 +1595,18 @@ void LLAgent::resetControlFlags()
//-----------------------------------------------------------------------------
void LLAgent::setAFK()
{
- if (gNonInteractive || !gAgent.getRegion())
- {
- // Don't set AFK if we're not talking to a region yet.
- return;
- }
+ if (gNonInteractive || !gAgent.getRegion())
+ {
+ // Don't set AFK if we're not talking to a region yet.
+ return;
+ }
- if (!(mControlFlags & AGENT_CONTROL_AWAY))
- {
- sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_START);
- setControlFlags(AGENT_CONTROL_AWAY | AGENT_CONTROL_STOP);
- gAwayTimer.start();
- }
+ if (!(mControlFlags & AGENT_CONTROL_AWAY))
+ {
+ sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_START);
+ setControlFlags(AGENT_CONTROL_AWAY | AGENT_CONTROL_STOP);
+ gAwayTimer.start();
+ }
}
//-----------------------------------------------------------------------------
@@ -1614,17 +1614,17 @@ void LLAgent::setAFK()
//-----------------------------------------------------------------------------
void LLAgent::clearAFK()
{
- gAwayTriggerTimer.reset();
+ gAwayTriggerTimer.reset();
- // Gods can sometimes get into away state (via gestures)
- // without setting the appropriate control flag. JC
- if (mControlFlags & AGENT_CONTROL_AWAY
- || (isAgentAvatarValid()
- && (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AWAY) != gAgentAvatarp->mSignaledAnimations.end())))
- {
- sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP);
- clearControlFlags(AGENT_CONTROL_AWAY);
- }
+ // Gods can sometimes get into away state (via gestures)
+ // without setting the appropriate control flag. JC
+ if (mControlFlags & AGENT_CONTROL_AWAY
+ || (isAgentAvatarValid()
+ && (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AWAY) != gAgentAvatarp->mSignaledAnimations.end())))
+ {
+ sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP);
+ clearControlFlags(AGENT_CONTROL_AWAY);
+ }
}
//-----------------------------------------------------------------------------
@@ -1632,7 +1632,7 @@ void LLAgent::clearAFK()
//-----------------------------------------------------------------------------
BOOL LLAgent::getAFK() const
{
- return (mControlFlags & AGENT_CONTROL_AWAY) != 0;
+ return (mControlFlags & AGENT_CONTROL_AWAY) != 0;
}
//-----------------------------------------------------------------------------
@@ -1640,15 +1640,15 @@ BOOL LLAgent::getAFK() const
//-----------------------------------------------------------------------------
void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb)
{
- bool isDoNotDisturbSwitchedOff = (mIsDoNotDisturb && !pIsDoNotDisturb);
- mIsDoNotDisturb = pIsDoNotDisturb;
- sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDoNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP));
- LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDoNotDisturb);
- if (isDoNotDisturbSwitchedOff)
- {
- LLDoNotDisturbNotificationStorage::getInstance()->updateNotifications();
- }
- gIMMgr->updateDNDMessageStatus();
+ bool isDoNotDisturbSwitchedOff = (mIsDoNotDisturb && !pIsDoNotDisturb);
+ mIsDoNotDisturb = pIsDoNotDisturb;
+ sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDoNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP));
+ LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDoNotDisturb);
+ if (isDoNotDisturbSwitchedOff)
+ {
+ LLDoNotDisturbNotificationStorage::getInstance()->updateNotifications();
+ }
+ gIMMgr->updateDNDMessageStatus();
}
//-----------------------------------------------------------------------------
@@ -1656,7 +1656,7 @@ void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb)
//-----------------------------------------------------------------------------
bool LLAgent::isDoNotDisturb() const
{
- return mIsDoNotDisturb;
+ return mIsDoNotDisturb;
}
@@ -1664,105 +1664,105 @@ bool LLAgent::isDoNotDisturb() const
// startAutoPilotGlobal()
//-----------------------------------------------------------------------------
void LLAgent::startAutoPilotGlobal(
- const LLVector3d &target_global,
- const std::string& behavior_name,
- const LLQuaternion *target_rotation,
- void (*finish_callback)(BOOL, void *),
- void *callback_data,
- F32 stop_distance,
- F32 rot_threshold,
- BOOL allow_flying)
-{
- if (!isAgentAvatarValid())
- {
- return;
- }
+ const LLVector3d &target_global,
+ const std::string& behavior_name,
+ const LLQuaternion *target_rotation,
+ void (*finish_callback)(BOOL, void *),
+ void *callback_data,
+ F32 stop_distance,
+ F32 rot_threshold,
+ BOOL allow_flying)
+{
+ if (!isAgentAvatarValid())
+ {
+ return;
+ }
if (target_global.isExactlyZero())
{
LL_WARNS() << "Canceling attempt to start autopilot towards invalid position" << LL_ENDL;
return;
}
-
- // Are there any pending callbacks from previous auto pilot requests?
- if (mAutoPilotFinishedCallback)
- {
- mAutoPilotFinishedCallback(dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal) < mAutoPilotStopDistance, mAutoPilotCallbackData);
- }
-
- mAutoPilotFinishedCallback = finish_callback;
- mAutoPilotCallbackData = callback_data;
- mAutoPilotRotationThreshold = rot_threshold;
- mAutoPilotBehaviorName = behavior_name;
- mAutoPilotAllowFlying = allow_flying;
-
- LLVector3d delta_pos( target_global );
- delta_pos -= getPositionGlobal();
- F64 distance = delta_pos.magVec();
- LLVector3d trace_target = target_global;
-
- trace_target.mdV[VZ] -= 10.f;
-
- LLVector3d intersection;
- LLVector3 normal;
- LLViewerObject *hit_obj;
- F32 heightDelta = LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, trace_target, intersection, normal, &hit_obj);
-
- if (stop_distance > 0.f)
- {
- mAutoPilotStopDistance = stop_distance;
- }
- else
- {
- // Guess at a reasonable stop distance.
- mAutoPilotStopDistance = (F32) sqrt( distance );
- if (mAutoPilotStopDistance < 0.5f)
- {
- mAutoPilotStopDistance = 0.5f;
- }
- }
-
- if (mAutoPilotAllowFlying)
- {
- mAutoPilotFlyOnStop = getFlying();
- }
- else
- {
- mAutoPilotFlyOnStop = FALSE;
- }
-
- if (distance > 30.0 && mAutoPilotAllowFlying)
- {
- setFlying(TRUE);
- }
-
- if ( distance > 1.f &&
- mAutoPilotAllowFlying &&
- heightDelta > (sqrtf(mAutoPilotStopDistance) + 1.f))
- {
- setFlying(TRUE);
- // Do not force flying for "Sit" behavior to prevent flying after pressing "Stand"
- // from an object. See EXT-1655.
- if ("Sit" != mAutoPilotBehaviorName)
- mAutoPilotFlyOnStop = TRUE;
- }
-
- mAutoPilot = TRUE;
- setAutoPilotTargetGlobal(target_global);
-
- if (target_rotation)
- {
- mAutoPilotUseRotation = TRUE;
- mAutoPilotTargetFacing = LLVector3::x_axis * *target_rotation;
- mAutoPilotTargetFacing.mV[VZ] = 0.f;
- mAutoPilotTargetFacing.normalize();
- }
- else
- {
- mAutoPilotUseRotation = FALSE;
- }
-
- mAutoPilotNoProgressFrameCount = 0;
+
+ // Are there any pending callbacks from previous auto pilot requests?
+ if (mAutoPilotFinishedCallback)
+ {
+ mAutoPilotFinishedCallback(dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal) < mAutoPilotStopDistance, mAutoPilotCallbackData);
+ }
+
+ mAutoPilotFinishedCallback = finish_callback;
+ mAutoPilotCallbackData = callback_data;
+ mAutoPilotRotationThreshold = rot_threshold;
+ mAutoPilotBehaviorName = behavior_name;
+ mAutoPilotAllowFlying = allow_flying;
+
+ LLVector3d delta_pos( target_global );
+ delta_pos -= getPositionGlobal();
+ F64 distance = delta_pos.magVec();
+ LLVector3d trace_target = target_global;
+
+ trace_target.mdV[VZ] -= 10.f;
+
+ LLVector3d intersection;
+ LLVector3 normal;
+ LLViewerObject *hit_obj;
+ F32 heightDelta = LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, trace_target, intersection, normal, &hit_obj);
+
+ if (stop_distance > 0.f)
+ {
+ mAutoPilotStopDistance = stop_distance;
+ }
+ else
+ {
+ // Guess at a reasonable stop distance.
+ mAutoPilotStopDistance = (F32) sqrt( distance );
+ if (mAutoPilotStopDistance < 0.5f)
+ {
+ mAutoPilotStopDistance = 0.5f;
+ }
+ }
+
+ if (mAutoPilotAllowFlying)
+ {
+ mAutoPilotFlyOnStop = getFlying();
+ }
+ else
+ {
+ mAutoPilotFlyOnStop = FALSE;
+ }
+
+ if (distance > 30.0 && mAutoPilotAllowFlying)
+ {
+ setFlying(TRUE);
+ }
+
+ if ( distance > 1.f &&
+ mAutoPilotAllowFlying &&
+ heightDelta > (sqrtf(mAutoPilotStopDistance) + 1.f))
+ {
+ setFlying(TRUE);
+ // Do not force flying for "Sit" behavior to prevent flying after pressing "Stand"
+ // from an object. See EXT-1655.
+ if ("Sit" != mAutoPilotBehaviorName)
+ mAutoPilotFlyOnStop = TRUE;
+ }
+
+ mAutoPilot = TRUE;
+ setAutoPilotTargetGlobal(target_global);
+
+ if (target_rotation)
+ {
+ mAutoPilotUseRotation = TRUE;
+ mAutoPilotTargetFacing = LLVector3::x_axis * *target_rotation;
+ mAutoPilotTargetFacing.mV[VZ] = 0.f;
+ mAutoPilotTargetFacing.normalize();
+ }
+ else
+ {
+ mAutoPilotUseRotation = FALSE;
+ }
+
+ mAutoPilotNoProgressFrameCount = 0;
}
@@ -1771,27 +1771,27 @@ void LLAgent::startAutoPilotGlobal(
//-----------------------------------------------------------------------------
void LLAgent::setAutoPilotTargetGlobal(const LLVector3d &target_global)
{
- if (mAutoPilot)
- {
- mAutoPilotTargetGlobal = target_global;
+ if (mAutoPilot)
+ {
+ mAutoPilotTargetGlobal = target_global;
- // trace ray down to find height of destination from ground
- LLVector3d traceEndPt = target_global;
- traceEndPt.mdV[VZ] -= 20.f;
+ // trace ray down to find height of destination from ground
+ LLVector3d traceEndPt = target_global;
+ traceEndPt.mdV[VZ] -= 20.f;
- LLVector3d targetOnGround;
- LLVector3 groundNorm;
- LLViewerObject *obj;
+ LLVector3d targetOnGround;
+ LLVector3 groundNorm;
+ LLViewerObject *obj;
- LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj);
- // Note: this might malfunction for sitting agent, since pelvis stays same, but agent's position becomes lower
- // But for autopilot to work we assume that agent is standing and ready to go.
- F64 target_height = llmax((F64)gAgentAvatarp->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]);
+ LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj);
+ // Note: this might malfunction for sitting agent, since pelvis stays same, but agent's position becomes lower
+ // But for autopilot to work we assume that agent is standing and ready to go.
+ F64 target_height = llmax((F64)gAgentAvatarp->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]);
- // clamp z value of target to minimum height above ground
- mAutoPilotTargetGlobal.mdV[VZ] = targetOnGround.mdV[VZ] + target_height;
- mAutoPilotTargetDist = (F32)dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal);
- }
+ // clamp z value of target to minimum height above ground
+ mAutoPilotTargetGlobal.mdV[VZ] = targetOnGround.mdV[VZ] + target_height;
+ mAutoPilotTargetDist = (F32)dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal);
+ }
}
//-----------------------------------------------------------------------------
@@ -1799,24 +1799,24 @@ void LLAgent::setAutoPilotTargetGlobal(const LLVector3d &target_global)
//-----------------------------------------------------------------------------
void LLAgent::startFollowPilot(const LLUUID &leader_id, BOOL allow_flying, F32 stop_distance)
{
- mLeaderID = leader_id;
- if ( mLeaderID.isNull() ) return;
+ mLeaderID = leader_id;
+ if ( mLeaderID.isNull() ) return;
- LLViewerObject* object = gObjectList.findObject(mLeaderID);
- if (!object)
- {
- mLeaderID = LLUUID::null;
- return;
- }
+ LLViewerObject* object = gObjectList.findObject(mLeaderID);
+ if (!object)
+ {
+ mLeaderID = LLUUID::null;
+ return;
+ }
- startAutoPilotGlobal(object->getPositionGlobal(),
- std::string(), // behavior_name
- NULL, // target_rotation
- NULL, // finish_callback
- NULL, // callback_data
- stop_distance,
- 0.03f, // rotation_threshold
- allow_flying);
+ startAutoPilotGlobal(object->getPositionGlobal(),
+ std::string(), // behavior_name
+ NULL, // target_rotation
+ NULL, // finish_callback
+ NULL, // callback_data
+ stop_distance,
+ 0.03f, // rotation_threshold
+ allow_flying);
}
@@ -1825,40 +1825,40 @@ void LLAgent::startFollowPilot(const LLUUID &leader_id, BOOL allow_flying, F32 s
//-----------------------------------------------------------------------------
void LLAgent::stopAutoPilot(BOOL user_cancel)
{
- if (mAutoPilot)
- {
- mAutoPilot = FALSE;
- if (mAutoPilotUseRotation && !user_cancel)
- {
- resetAxes(mAutoPilotTargetFacing);
- }
- // Restore previous flying state before invoking mAutoPilotFinishedCallback to allow
- // callback function to change the flying state (like in near_sit_down_point()).
- // If the user cancelled, don't change the fly state
- if (!user_cancel)
- {
- setFlying(mAutoPilotFlyOnStop);
- }
- //NB: auto pilot can terminate for a reason other than reaching the destination
- if (mAutoPilotFinishedCallback)
- {
- mAutoPilotFinishedCallback(!user_cancel && dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal) < mAutoPilotStopDistance, mAutoPilotCallbackData);
- mAutoPilotFinishedCallback = NULL;
- }
- mLeaderID = LLUUID::null;
-
- setControlFlags(AGENT_CONTROL_STOP);
-
- if (user_cancel && !mAutoPilotBehaviorName.empty())
- {
- if (mAutoPilotBehaviorName == "Sit")
- LL_INFOS("Agent") << "Autopilot-Sit was canceled by user action" << LL_ENDL;
- else if (mAutoPilotBehaviorName == "Attach")
- LLNotificationsUtil::add("CancelledAttach");
- else
- LLNotificationsUtil::add("Cancelled");
- }
- }
+ if (mAutoPilot)
+ {
+ mAutoPilot = FALSE;
+ if (mAutoPilotUseRotation && !user_cancel)
+ {
+ resetAxes(mAutoPilotTargetFacing);
+ }
+ // Restore previous flying state before invoking mAutoPilotFinishedCallback to allow
+ // callback function to change the flying state (like in near_sit_down_point()).
+ // If the user cancelled, don't change the fly state
+ if (!user_cancel)
+ {
+ setFlying(mAutoPilotFlyOnStop);
+ }
+ //NB: auto pilot can terminate for a reason other than reaching the destination
+ if (mAutoPilotFinishedCallback)
+ {
+ mAutoPilotFinishedCallback(!user_cancel && dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal) < mAutoPilotStopDistance, mAutoPilotCallbackData);
+ mAutoPilotFinishedCallback = NULL;
+ }
+ mLeaderID = LLUUID::null;
+
+ setControlFlags(AGENT_CONTROL_STOP);
+
+ if (user_cancel && !mAutoPilotBehaviorName.empty())
+ {
+ if (mAutoPilotBehaviorName == "Sit")
+ LL_INFOS("Agent") << "Autopilot-Sit was canceled by user action" << LL_ENDL;
+ else if (mAutoPilotBehaviorName == "Attach")
+ LLNotificationsUtil::add("CancelledAttach");
+ else
+ LLNotificationsUtil::add("Cancelled");
+ }
+ }
}
@@ -1868,36 +1868,36 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
//-----------------------------------------------------------------------------
void LLAgent::autoPilot(F32 *delta_yaw)
{
- if (mAutoPilot)
- {
- if (!mLeaderID.isNull())
- {
- LLViewerObject* object = gObjectList.findObject(mLeaderID);
- if (!object)
- {
- stopAutoPilot();
- return;
- }
- mAutoPilotTargetGlobal = object->getPositionGlobal();
- }
-
- if (!isAgentAvatarValid()) return;
-
- if (gAgentAvatarp->mInAir && mAutoPilotAllowFlying)
- {
- setFlying(TRUE);
- }
-
- LLVector3 at;
- at.setVec(mFrameAgent.getAtAxis());
- LLVector3 target_agent = getPosAgentFromGlobal(mAutoPilotTargetGlobal);
- LLVector3 direction = target_agent - getPositionAgent();
-
- F32 target_dist = direction.magVec();
-
- if (target_dist >= mAutoPilotTargetDist)
- {
- mAutoPilotNoProgressFrameCount++;
+ if (mAutoPilot)
+ {
+ if (!mLeaderID.isNull())
+ {
+ LLViewerObject* object = gObjectList.findObject(mLeaderID);
+ if (!object)
+ {
+ stopAutoPilot();
+ return;
+ }
+ mAutoPilotTargetGlobal = object->getPositionGlobal();
+ }
+
+ if (!isAgentAvatarValid()) return;
+
+ if (gAgentAvatarp->mInAir && mAutoPilotAllowFlying)
+ {
+ setFlying(TRUE);
+ }
+
+ LLVector3 at;
+ at.setVec(mFrameAgent.getAtAxis());
+ LLVector3 target_agent = getPosAgentFromGlobal(mAutoPilotTargetGlobal);
+ LLVector3 direction = target_agent - getPositionAgent();
+
+ F32 target_dist = direction.magVec();
+
+ if (target_dist >= mAutoPilotTargetDist)
+ {
+ mAutoPilotNoProgressFrameCount++;
bool out_of_time = false;
if (getFlying())
{
@@ -1907,104 +1907,104 @@ void LLAgent::autoPilot(F32 *delta_yaw)
{
out_of_time = mAutoPilotNoProgressFrameCount > AUTOPILOT_MAX_TIME_NO_PROGRESS_WALK * gFPSClamped;
}
- if (out_of_time)
- {
- stopAutoPilot();
- return;
- }
- }
-
- mAutoPilotTargetDist = target_dist;
-
- // Make this a two-dimensional solution
- at.mV[VZ] = 0.f;
- direction.mV[VZ] = 0.f;
-
- at.normalize();
- F32 xy_distance = direction.normalize();
-
- F32 yaw = 0.f;
- if (mAutoPilotTargetDist > mAutoPilotStopDistance)
- {
- yaw = angle_between(mFrameAgent.getAtAxis(), direction);
- }
- else if (mAutoPilotUseRotation)
- {
- // we're close now just aim at target facing
- yaw = angle_between(at, mAutoPilotTargetFacing);
- direction = mAutoPilotTargetFacing;
- }
-
- yaw = 4.f * yaw / gFPSClamped;
-
- // figure out which direction to turn
- LLVector3 scratch(at % direction);
-
- if (scratch.mV[VZ] > 0.f)
- {
- setControlFlags(AGENT_CONTROL_YAW_POS);
- }
- else
- {
- yaw = -yaw;
- setControlFlags(AGENT_CONTROL_YAW_NEG);
- }
-
- *delta_yaw = yaw;
-
- // Compute when to start slowing down
- F32 slow_distance;
- if (getFlying())
- {
- slow_distance = llmax(8.f, mAutoPilotStopDistance + 5.f);
- }
- else
- {
- slow_distance = llmax(3.f, mAutoPilotStopDistance + 2.f);
- }
-
- // If we're flying, handle autopilot points above or below you.
- if (getFlying() && xy_distance < AUTOPILOT_HEIGHT_ADJUST_DISTANCE)
- {
- if (isAgentAvatarValid())
- {
- F64 current_height = gAgentAvatarp->getPositionGlobal().mdV[VZ];
- F32 delta_z = (F32)(mAutoPilotTargetGlobal.mdV[VZ] - current_height);
- F32 slope = delta_z / xy_distance;
- if (slope > 0.45f && delta_z > 6.f)
- {
- setControlFlags(AGENT_CONTROL_FAST_UP | AGENT_CONTROL_UP_POS);
- }
- else if (slope > 0.002f && delta_z > 0.5f)
- {
- setControlFlags(AGENT_CONTROL_UP_POS);
- }
- else if (slope < -0.45f && delta_z < -6.f && current_height > AUTOPILOT_MIN_TARGET_HEIGHT_OFF_GROUND)
- {
- setControlFlags(AGENT_CONTROL_FAST_UP | AGENT_CONTROL_UP_NEG);
- }
- else if (slope < -0.002f && delta_z < -0.5f && current_height > AUTOPILOT_MIN_TARGET_HEIGHT_OFF_GROUND)
- {
- setControlFlags(AGENT_CONTROL_UP_NEG);
- }
- }
- }
-
- // calculate delta rotation to target heading
- F32 delta_target_heading = angle_between(mFrameAgent.getAtAxis(), mAutoPilotTargetFacing);
-
- if (xy_distance > slow_distance && yaw < (F_PI / 10.f))
- {
- // walking/flying fast
- setControlFlags(AGENT_CONTROL_FAST_AT | AGENT_CONTROL_AT_POS);
- }
- else if (mAutoPilotTargetDist > mAutoPilotStopDistance)
- {
+ if (out_of_time)
+ {
+ stopAutoPilot();
+ return;
+ }
+ }
+
+ mAutoPilotTargetDist = target_dist;
+
+ // Make this a two-dimensional solution
+ at.mV[VZ] = 0.f;
+ direction.mV[VZ] = 0.f;
+
+ at.normalize();
+ F32 xy_distance = direction.normalize();
+
+ F32 yaw = 0.f;
+ if (mAutoPilotTargetDist > mAutoPilotStopDistance)
+ {
+ yaw = angle_between(mFrameAgent.getAtAxis(), direction);
+ }
+ else if (mAutoPilotUseRotation)
+ {
+ // we're close now just aim at target facing
+ yaw = angle_between(at, mAutoPilotTargetFacing);
+ direction = mAutoPilotTargetFacing;
+ }
+
+ yaw = 4.f * yaw / gFPSClamped;
+
+ // figure out which direction to turn
+ LLVector3 scratch(at % direction);
+
+ if (scratch.mV[VZ] > 0.f)
+ {
+ setControlFlags(AGENT_CONTROL_YAW_POS);
+ }
+ else
+ {
+ yaw = -yaw;
+ setControlFlags(AGENT_CONTROL_YAW_NEG);
+ }
+
+ *delta_yaw = yaw;
+
+ // Compute when to start slowing down
+ F32 slow_distance;
+ if (getFlying())
+ {
+ slow_distance = llmax(8.f, mAutoPilotStopDistance + 5.f);
+ }
+ else
+ {
+ slow_distance = llmax(3.f, mAutoPilotStopDistance + 2.f);
+ }
+
+ // If we're flying, handle autopilot points above or below you.
+ if (getFlying() && xy_distance < AUTOPILOT_HEIGHT_ADJUST_DISTANCE)
+ {
+ if (isAgentAvatarValid())
+ {
+ F64 current_height = gAgentAvatarp->getPositionGlobal().mdV[VZ];
+ F32 delta_z = (F32)(mAutoPilotTargetGlobal.mdV[VZ] - current_height);
+ F32 slope = delta_z / xy_distance;
+ if (slope > 0.45f && delta_z > 6.f)
+ {
+ setControlFlags(AGENT_CONTROL_FAST_UP | AGENT_CONTROL_UP_POS);
+ }
+ else if (slope > 0.002f && delta_z > 0.5f)
+ {
+ setControlFlags(AGENT_CONTROL_UP_POS);
+ }
+ else if (slope < -0.45f && delta_z < -6.f && current_height > AUTOPILOT_MIN_TARGET_HEIGHT_OFF_GROUND)
+ {
+ setControlFlags(AGENT_CONTROL_FAST_UP | AGENT_CONTROL_UP_NEG);
+ }
+ else if (slope < -0.002f && delta_z < -0.5f && current_height > AUTOPILOT_MIN_TARGET_HEIGHT_OFF_GROUND)
+ {
+ setControlFlags(AGENT_CONTROL_UP_NEG);
+ }
+ }
+ }
+
+ // calculate delta rotation to target heading
+ F32 delta_target_heading = angle_between(mFrameAgent.getAtAxis(), mAutoPilotTargetFacing);
+
+ if (xy_distance > slow_distance && yaw < (F_PI / 10.f))
+ {
+ // walking/flying fast
+ setControlFlags(AGENT_CONTROL_FAST_AT | AGENT_CONTROL_AT_POS);
+ }
+ else if (mAutoPilotTargetDist > mAutoPilotStopDistance)
+ {
// walking/flying slow
U32 movement_flag = 0;
- if (at * direction > 0.9f)
- {
+ if (at * direction > 0.9f)
+ {
movement_flag = AGENT_CONTROL_AT_POS;
}
else if (at * direction < -0.9f)
@@ -2035,19 +2035,19 @@ void LLAgent::autoPilot(F32 *delta_yaw)
if (movement_flag)
{
setControlFlags(movement_flag);
- }
- }
+ }
+ }
- // check to see if we need to keep rotating to target orientation
- if (mAutoPilotTargetDist < mAutoPilotStopDistance)
- {
- setControlFlags(AGENT_CONTROL_STOP);
- if(!mAutoPilotUseRotation || (delta_target_heading < mAutoPilotRotationThreshold))
- {
- stopAutoPilot();
- }
- }
- }
+ // check to see if we need to keep rotating to target orientation
+ if (mAutoPilotTargetDist < mAutoPilotStopDistance)
+ {
+ setControlFlags(AGENT_CONTROL_STOP);
+ if(!mAutoPilotUseRotation || (delta_target_heading < mAutoPilotRotationThreshold))
+ {
+ stopAutoPilot();
+ }
+ }
+ }
}
@@ -2056,45 +2056,45 @@ void LLAgent::autoPilot(F32 *delta_yaw)
//-----------------------------------------------------------------------------
void LLAgent::propagate(const F32 dt)
{
- // Update UI based on agent motion
- LLFloaterMove *floater_move = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
- if (floater_move)
- {
- floater_move->mForwardButton ->setToggleState( gAgentCamera.getAtKey() > 0 || gAgentCamera.getWalkKey() > 0 );
- floater_move->mBackwardButton ->setToggleState( gAgentCamera.getAtKey() < 0 || gAgentCamera.getWalkKey() < 0 );
- floater_move->mTurnLeftButton ->setToggleState( gAgentCamera.getYawKey() > 0.f );
- floater_move->mTurnRightButton ->setToggleState( gAgentCamera.getYawKey() < 0.f );
- floater_move->mSlideLeftButton ->setToggleState( gAgentCamera.getLeftKey() > 0.f );
- floater_move->mSlideRightButton ->setToggleState( gAgentCamera.getLeftKey() < 0.f );
- floater_move->mMoveUpButton ->setToggleState( gAgentCamera.getUpKey() > 0 );
- floater_move->mMoveDownButton ->setToggleState( gAgentCamera.getUpKey() < 0 );
- }
-
- // handle rotation based on keyboard levels
- const F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second
- yaw(YAW_RATE * gAgentCamera.getYawKey() * dt);
-
- const F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second
- pitch(PITCH_RATE * gAgentCamera.getPitchKey() * dt);
-
- // handle auto-land behavior
- if (isAgentAvatarValid())
- {
- BOOL in_air = gAgentAvatarp->mInAir;
- LLVector3 land_vel = getVelocity();
- land_vel.mV[VZ] = 0.f;
-
- if (!in_air
- && gAgentCamera.getUpKey() < 0
- && land_vel.magVecSquared() < MAX_VELOCITY_AUTO_LAND_SQUARED
- && gSavedSettings.getBOOL("AutomaticFly"))
- {
- // land automatically
- setFlying(FALSE);
- }
- }
-
- gAgentCamera.clearGeneralKeys();
+ // Update UI based on agent motion
+ LLFloaterMove *floater_move = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
+ if (floater_move)
+ {
+ floater_move->mForwardButton ->setToggleState( gAgentCamera.getAtKey() > 0 || gAgentCamera.getWalkKey() > 0 );
+ floater_move->mBackwardButton ->setToggleState( gAgentCamera.getAtKey() < 0 || gAgentCamera.getWalkKey() < 0 );
+ floater_move->mTurnLeftButton ->setToggleState( gAgentCamera.getYawKey() > 0.f );
+ floater_move->mTurnRightButton ->setToggleState( gAgentCamera.getYawKey() < 0.f );
+ floater_move->mSlideLeftButton ->setToggleState( gAgentCamera.getLeftKey() > 0.f );
+ floater_move->mSlideRightButton ->setToggleState( gAgentCamera.getLeftKey() < 0.f );
+ floater_move->mMoveUpButton ->setToggleState( gAgentCamera.getUpKey() > 0 );
+ floater_move->mMoveDownButton ->setToggleState( gAgentCamera.getUpKey() < 0 );
+ }
+
+ // handle rotation based on keyboard levels
+ const F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second
+ yaw(YAW_RATE * gAgentCamera.getYawKey() * dt);
+
+ const F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second
+ pitch(PITCH_RATE * gAgentCamera.getPitchKey() * dt);
+
+ // handle auto-land behavior
+ if (isAgentAvatarValid())
+ {
+ BOOL in_air = gAgentAvatarp->mInAir;
+ LLVector3 land_vel = getVelocity();
+ land_vel.mV[VZ] = 0.f;
+
+ if (!in_air
+ && gAgentCamera.getUpKey() < 0
+ && land_vel.magVecSquared() < MAX_VELOCITY_AUTO_LAND_SQUARED
+ && gSavedSettings.getBOOL("AutomaticFly"))
+ {
+ // land automatically
+ setFlying(FALSE);
+ }
+ }
+
+ gAgentCamera.clearGeneralKeys();
}
//-----------------------------------------------------------------------------
@@ -2103,22 +2103,22 @@ void LLAgent::propagate(const F32 dt)
void LLAgent::updateAgentPosition(const F32 dt, const F32 yaw_radians, const S32 mouse_x, const S32 mouse_y)
{
static LLCachedControl<F32> hint_timeout(gSavedSettings, "NotMovingHintTimeout");
- if (mMoveTimer.getStarted() && mMoveTimer.getElapsedTimeF32() > hint_timeout)
- {
- LLFirstUse::notMoving();
- }
+ if (mMoveTimer.getStarted() && mMoveTimer.getElapsedTimeF32() > hint_timeout)
+ {
+ LLFirstUse::notMoving();
+ }
+
+ propagate(dt);
- propagate(dt);
+ // static S32 cameraUpdateCount = 0;
- // static S32 cameraUpdateCount = 0;
+ rotate(yaw_radians, 0, 0, 1);
- rotate(yaw_radians, 0, 0, 1);
-
- //
- // Check for water and land collision, set underwater flag
- //
+ //
+ // Check for water and land collision, set underwater flag
+ //
- gAgentCamera.updateLookAt(mouse_x, mouse_y);
+ gAgentCamera.updateLookAt(mouse_x, mouse_y);
// When agent has no parents, position updates come from setPositionAgent()
// But when agent has a parent (ex: is seated), position remains unchanged
@@ -2135,7 +2135,7 @@ void LLAgent::updateAgentPosition(const F32 dt, const F32 yaw_radians, const S32
if ((mLastTestGlobal - new_position).lengthSquared() > 1.0)
{
// If the position has changed by more than 1 meter since the last time we triggered.
- // filters out some noise.
+ // filters out some noise.
mLastTestGlobal = new_position;
mOnPositionChanged(mFrameAgent.getOrigin(), new_position);
}
@@ -2146,12 +2146,12 @@ void LLAgent::updateAgentPosition(const F32 dt, const F32 yaw_radians, const S32
std::ostream& operator<<(std::ostream &s, const LLAgent &agent)
{
- // This is unfinished, but might never be used.
- // We'll just leave it for now; we can always delete it.
- s << " { "
- << " Frame = " << agent.mFrameAgent << "\n"
- << " }";
- return s;
+ // This is unfinished, but might never be used.
+ // We'll just leave it for now; we can always delete it.
+ s << " { "
+ << " Frame = " << agent.mFrameAgent << "\n"
+ << " }";
+ return s;
}
// TRUE if your own avatar needs to be rendered. Usually only
@@ -2161,18 +2161,18 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent)
//-----------------------------------------------------------------------------
BOOL LLAgent::needsRenderAvatar()
{
- if (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson)
- {
- return FALSE;
- }
+ if (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson)
+ {
+ return FALSE;
+ }
- return mShowAvatar && mOutfitChosen;
+ return mShowAvatar && mOutfitChosen;
}
// TRUE if we need to render your own avatar's head.
BOOL LLAgent::needsRenderHead()
{
- return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook());
+ return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook());
}
//-----------------------------------------------------------------------------
@@ -2180,30 +2180,30 @@ BOOL LLAgent::needsRenderHead()
//-----------------------------------------------------------------------------
void LLAgent::startTyping()
{
- mTypingTimer.reset();
+ mTypingTimer.reset();
- if (getRenderState() & AGENT_STATE_TYPING)
- {
- // already typing, don't trigger a different animation
- return;
- }
- setRenderState(AGENT_STATE_TYPING);
+ if (getRenderState() & AGENT_STATE_TYPING)
+ {
+ // already typing, don't trigger a different animation
+ return;
+ }
+ setRenderState(AGENT_STATE_TYPING);
- if (mChatTimer.getElapsedTimeF32() < 2.f)
- {
- LLViewerObject* chatter = gObjectList.findObject(mLastChatterID);
- if (chatter && chatter->isAvatar())
- {
- gAgentCamera.setLookAt(LOOKAT_TARGET_RESPOND, chatter, LLVector3::zero);
- }
- }
+ if (mChatTimer.getElapsedTimeF32() < 2.f)
+ {
+ LLViewerObject* chatter = gObjectList.findObject(mLastChatterID);
+ if (chatter && chatter->isAvatar())
+ {
+ gAgentCamera.setLookAt(LOOKAT_TARGET_RESPOND, chatter, LLVector3::zero);
+ }
+ }
- if (gSavedSettings.getBOOL("PlayTypingAnim"))
- {
- sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START);
- }
- (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->
- sendChatFromViewer("", CHAT_TYPE_START, FALSE);
+ if (gSavedSettings.getBOOL("PlayTypingAnim"))
+ {
+ sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START);
+ }
+ (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->
+ sendChatFromViewer("", CHAT_TYPE_START, FALSE);
}
//-----------------------------------------------------------------------------
@@ -2211,13 +2211,13 @@ void LLAgent::startTyping()
//-----------------------------------------------------------------------------
void LLAgent::stopTyping()
{
- if (mRenderState & AGENT_STATE_TYPING)
- {
- clearRenderState(AGENT_STATE_TYPING);
- sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP);
- (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->
- sendChatFromViewer("", CHAT_TYPE_STOP, FALSE);
- }
+ if (mRenderState & AGENT_STATE_TYPING)
+ {
+ clearRenderState(AGENT_STATE_TYPING);
+ sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP);
+ (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->
+ sendChatFromViewer("", CHAT_TYPE_STOP, FALSE);
+ }
}
//-----------------------------------------------------------------------------
@@ -2225,7 +2225,7 @@ void LLAgent::stopTyping()
//-----------------------------------------------------------------------------
void LLAgent::setRenderState(U8 newstate)
{
- mRenderState |= newstate;
+ mRenderState |= newstate;
}
//-----------------------------------------------------------------------------
@@ -2233,7 +2233,7 @@ void LLAgent::setRenderState(U8 newstate)
//-----------------------------------------------------------------------------
void LLAgent::clearRenderState(U8 clearstate)
{
- mRenderState &= ~clearstate;
+ mRenderState &= ~clearstate;
}
@@ -2242,24 +2242,24 @@ void LLAgent::clearRenderState(U8 clearstate)
//-----------------------------------------------------------------------------
U8 LLAgent::getRenderState()
{
- // *FIX: don't do stuff in a getter! This is infinite loop city!
- if ((mTypingTimer.getElapsedTimeF32() > TYPING_TIMEOUT_SECS)
- && (mRenderState & AGENT_STATE_TYPING))
- {
- stopTyping();
- }
-
- if ((!LLSelectMgr::getInstance()->getSelection()->isEmpty() && LLSelectMgr::getInstance()->shouldShowSelection())
- || LLToolMgr::getInstance()->getCurrentTool()->isEditing() )
- {
- setRenderState(AGENT_STATE_EDITING);
- }
- else
- {
- clearRenderState(AGENT_STATE_EDITING);
- }
+ // *FIX: don't do stuff in a getter! This is infinite loop city!
+ if ((mTypingTimer.getElapsedTimeF32() > TYPING_TIMEOUT_SECS)
+ && (mRenderState & AGENT_STATE_TYPING))
+ {
+ stopTyping();
+ }
+
+ if ((!LLSelectMgr::getInstance()->getSelection()->isEmpty() && LLSelectMgr::getInstance()->shouldShowSelection())
+ || LLToolMgr::getInstance()->getCurrentTool()->isEditing() )
+ {
+ setRenderState(AGENT_STATE_EDITING);
+ }
+ else
+ {
+ clearRenderState(AGENT_STATE_EDITING);
+ }
- return mRenderState;
+ return mRenderState;
}
//-----------------------------------------------------------------------------
@@ -2270,278 +2270,278 @@ U8 LLAgent::getRenderState()
//-----------------------------------------------------------------------------
void LLAgent::endAnimationUpdateUI()
{
- if (LLApp::isExiting()
- || !gViewerWindow
- || !gMenuBarView
- || !gToolBarView
- || !gStatusBar)
- {
- return;
- }
- if (gAgentCamera.getCameraMode() == gAgentCamera.getLastCameraMode())
- {
- // We're already done endAnimationUpdateUI for this transition.
- return;
- }
-
- // clean up UI from mode we're leaving
- if (gAgentCamera.getLastCameraMode() == CAMERA_MODE_MOUSELOOK )
- {
- gToolBarView->setToolBarsVisible(true);
- // show mouse cursor
- gViewerWindow->showCursor();
- // show menus
- gMenuBarView->setVisible(TRUE);
- LLNavigationBar::getInstance()->setVisible(TRUE && gSavedSettings.getBOOL("ShowNavbarNavigationPanel"));
- gStatusBar->setVisibleForMouselook(true);
+ if (LLApp::isExiting()
+ || !gViewerWindow
+ || !gMenuBarView
+ || !gToolBarView
+ || !gStatusBar)
+ {
+ return;
+ }
+ if (gAgentCamera.getCameraMode() == gAgentCamera.getLastCameraMode())
+ {
+ // We're already done endAnimationUpdateUI for this transition.
+ return;
+ }
+
+ // clean up UI from mode we're leaving
+ if (gAgentCamera.getLastCameraMode() == CAMERA_MODE_MOUSELOOK )
+ {
+ gToolBarView->setToolBarsVisible(true);
+ // show mouse cursor
+ gViewerWindow->showCursor();
+ // show menus
+ gMenuBarView->setVisible(TRUE);
+ LLNavigationBar::getInstance()->setVisible(TRUE && gSavedSettings.getBOOL("ShowNavbarNavigationPanel"));
+ gStatusBar->setVisibleForMouselook(true);
static LLCachedControl<bool> show_mini_location_panel(gSavedSettings, "ShowMiniLocationPanel");
- if (show_mini_location_panel)
- {
- LLPanelTopInfoBar::getInstance()->setVisible(TRUE);
- }
+ if (show_mini_location_panel)
+ {
+ LLPanelTopInfoBar::getInstance()->setVisible(TRUE);
+ }
- LLChicletBar::getInstance()->setVisible(TRUE);
+ LLChicletBar::getInstance()->setVisible(TRUE);
- LLPanelStandStopFlying::getInstance()->setVisible(TRUE);
+ LLPanelStandStopFlying::getInstance()->setVisible(TRUE);
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- LLFloaterCamera::onLeavingMouseLook();
+ LLFloaterCamera::onLeavingMouseLook();
- if (mMouselookModeOutSignal)
- {
- (*mMouselookModeOutSignal)();
- }
+ if (mMouselookModeOutSignal)
+ {
+ (*mMouselookModeOutSignal)();
+ }
- // Only pop if we have pushed...
- if (TRUE == mViewsPushed)
- {
+ // Only pop if we have pushed...
+ if (TRUE == mViewsPushed)
+ {
#if 0 // Use this once all floaters are registered
- LLFloaterReg::restoreVisibleInstances();
+ LLFloaterReg::restoreVisibleInstances();
#else // Use this for now
- LLFloaterView::skip_list_t skip_list;
- if (LLFloaterReg::findInstance("mini_map"))
- {
- skip_list.insert(LLFloaterReg::findInstance("mini_map"));
- }
- if (LLFloaterReg::findInstance("beacons"))
- {
- skip_list.insert(LLFloaterReg::findInstance("beacons"));
- }
- LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- LLFloaterIMContainer::floater_list_t conversations;
- im_box->getDetachedConversationFloaters(conversations);
- for (LLFloater* conversation : conversations)
- {
- LL_INFOS() << "skip_list.insert(session_floater): " << conversation->getTitle() << LL_ENDL;
- skip_list.insert(conversation);
- }
-
- gFloaterView->popVisibleAll(skip_list);
+ LLFloaterView::skip_list_t skip_list;
+ if (LLFloaterReg::findInstance("mini_map"))
+ {
+ skip_list.insert(LLFloaterReg::findInstance("mini_map"));
+ }
+ if (LLFloaterReg::findInstance("beacons"))
+ {
+ skip_list.insert(LLFloaterReg::findInstance("beacons"));
+ }
+ LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ LLFloaterIMContainer::floater_list_t conversations;
+ im_box->getDetachedConversationFloaters(conversations);
+ for (LLFloater* conversation : conversations)
+ {
+ LL_INFOS() << "skip_list.insert(session_floater): " << conversation->getTitle() << LL_ENDL;
+ skip_list.insert(conversation);
+ }
+
+ gFloaterView->popVisibleAll(skip_list);
#endif
- mViewsPushed = FALSE;
- }
-
-
- gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
- if( gMorphView )
- {
- gMorphView->setVisible( FALSE );
- }
-
- // Disable mouselook-specific animations
- if (isAgentAvatarValid())
- {
- if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
- {
- if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end())
- {
- sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_STOP);
- sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_START);
- }
- if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end())
- {
- sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_STOP);
- sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_START);
- }
- if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end())
- {
- sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_STOP);
- sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_START);
- }
- if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != gAgentAvatarp->mSignaledAnimations.end())
- {
- sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_STOP);
- sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_START);
- }
- }
- }
- }
- else if (gAgentCamera.getLastCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
- {
- // make sure we ask to save changes
-
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
-
- if( gMorphView )
- {
- gMorphView->setVisible( FALSE );
- }
-
- if (isAgentAvatarValid())
- {
- if(mCustomAnim)
- {
- sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_STOP);
- sendAnimationRequest(ANIM_AGENT_CUSTOMIZE_DONE, ANIM_REQUEST_START);
-
- mCustomAnim = FALSE ;
- }
-
- }
- gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
-
- LLFloaterCamera::onAvatarEditingAppearance(false);
- }
-
- //---------------------------------------------------------------------
- // Set up UI for mode we're entering
- //---------------------------------------------------------------------
- if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
- {
- // clean up UI
- // first show anything hidden by UI toggle
- gViewerWindow->setUIVisibility(TRUE);
-
- // then hide stuff we want hidden for mouselook
- gToolBarView->setToolBarsVisible(false);
- gMenuBarView->setVisible(FALSE);
- LLNavigationBar::getInstance()->setVisible(FALSE);
- gStatusBar->setVisibleForMouselook(false);
-
- LLPanelTopInfoBar::getInstance()->setVisible(FALSE);
-
- LLChicletBar::getInstance()->setVisible(FALSE);
-
- LLPanelStandStopFlying::getInstance()->setVisible(FALSE);
-
- // clear out camera lag effect
- gAgentCamera.clearCameraLag();
-
- // JC - Added for always chat in third person option
- gFocusMgr.setKeyboardFocus(NULL);
-
- LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset);
-
- mViewsPushed = TRUE;
-
- if (mMouselookModeInSignal)
- {
- (*mMouselookModeInSignal)();
- }
-
- // hide all floaters except the mini map
+ mViewsPushed = FALSE;
+ }
+
+
+ gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
+ if( gMorphView )
+ {
+ gMorphView->setVisible( FALSE );
+ }
+
+ // Disable mouselook-specific animations
+ if (isAgentAvatarValid())
+ {
+ if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
+ {
+ if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_STOP);
+ sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_START);
+ }
+ if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_STOP);
+ sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_START);
+ }
+ if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_STOP);
+ sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_START);
+ }
+ if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_STOP);
+ sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_START);
+ }
+ }
+ }
+ }
+ else if (gAgentCamera.getLastCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
+ {
+ // make sure we ask to save changes
+
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+
+ if( gMorphView )
+ {
+ gMorphView->setVisible( FALSE );
+ }
+
+ if (isAgentAvatarValid())
+ {
+ if(mCustomAnim)
+ {
+ sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_STOP);
+ sendAnimationRequest(ANIM_AGENT_CUSTOMIZE_DONE, ANIM_REQUEST_START);
+
+ mCustomAnim = FALSE ;
+ }
+
+ }
+ gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
+
+ LLFloaterCamera::onAvatarEditingAppearance(false);
+ }
+
+ //---------------------------------------------------------------------
+ // Set up UI for mode we're entering
+ //---------------------------------------------------------------------
+ if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
+ {
+ // clean up UI
+ // first show anything hidden by UI toggle
+ gViewerWindow->setUIVisibility(TRUE);
+
+ // then hide stuff we want hidden for mouselook
+ gToolBarView->setToolBarsVisible(false);
+ gMenuBarView->setVisible(FALSE);
+ LLNavigationBar::getInstance()->setVisible(FALSE);
+ gStatusBar->setVisibleForMouselook(false);
+
+ LLPanelTopInfoBar::getInstance()->setVisible(FALSE);
+
+ LLChicletBar::getInstance()->setVisible(FALSE);
+
+ LLPanelStandStopFlying::getInstance()->setVisible(FALSE);
+
+ // clear out camera lag effect
+ gAgentCamera.clearCameraLag();
+
+ // JC - Added for always chat in third person option
+ gFocusMgr.setKeyboardFocus(NULL);
+
+ LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset);
+
+ mViewsPushed = TRUE;
+
+ if (mMouselookModeInSignal)
+ {
+ (*mMouselookModeInSignal)();
+ }
+
+ // hide all floaters except the mini map
#if 0 // Use this once all floaters are registered
- std::set<std::string> exceptions;
- exceptions.insert("mini_map");
- LLFloaterReg::hideVisibleInstances(exceptions);
+ std::set<std::string> exceptions;
+ exceptions.insert("mini_map");
+ LLFloaterReg::hideVisibleInstances(exceptions);
#else // Use this for now
- LLFloaterView::skip_list_t skip_list;
- skip_list.insert(LLFloaterReg::findInstance("mini_map"));
- skip_list.insert(LLFloaterReg::findInstance("beacons"));
- gFloaterView->pushVisibleAll(FALSE, skip_list);
+ LLFloaterView::skip_list_t skip_list;
+ skip_list.insert(LLFloaterReg::findInstance("mini_map"));
+ skip_list.insert(LLFloaterReg::findInstance("beacons"));
+ gFloaterView->pushVisibleAll(FALSE, skip_list);
#endif
- if( gMorphView )
- {
- gMorphView->setVisible(FALSE);
- }
-
- gConsole->setVisible( TRUE );
-
- if (isAgentAvatarValid())
- {
- // Trigger mouselook-specific animations
- if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
- {
- if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end())
- {
- sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_STOP);
- sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_START);
- }
- if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end())
- {
- sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_STOP);
- sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_START);
- }
- if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end())
- {
- sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_STOP);
- sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_START);
- }
- if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != gAgentAvatarp->mSignaledAnimations.end())
- {
- sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_STOP);
- sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_START);
- }
- }
- if (gAgentAvatarp->getParent())
- {
- LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis();
- LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot();
- if (root_object->flagCameraDecoupled())
- {
- resetAxes(at_axis);
- }
- else
- {
- resetAxes(at_axis * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation());
- }
- }
- }
- }
- else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
- {
- LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset);
-
- if( gMorphView )
- {
- gMorphView->setVisible( TRUE );
- }
-
- // freeze avatar
- if (isAgentAvatarValid())
- {
- mPauseRequest = gAgentAvatarp->requestPause();
- }
-
- LLFloaterCamera::onAvatarEditingAppearance(true);
- }
-
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
- }
-
- gFloaterTools->dirty();
-
- // Don't let this be called more than once if the camera
- // mode hasn't changed. --JC
- gAgentCamera.updateLastCamera();
+ if( gMorphView )
+ {
+ gMorphView->setVisible(FALSE);
+ }
+
+ gConsole->setVisible( TRUE );
+
+ if (isAgentAvatarValid())
+ {
+ // Trigger mouselook-specific animations
+ if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
+ {
+ if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_STOP);
+ sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_START);
+ }
+ if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_STOP);
+ sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_START);
+ }
+ if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_STOP);
+ sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_START);
+ }
+ if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_STOP);
+ sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_START);
+ }
+ }
+ if (gAgentAvatarp->getParent())
+ {
+ LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis();
+ LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot();
+ if (root_object->flagCameraDecoupled())
+ {
+ resetAxes(at_axis);
+ }
+ else
+ {
+ resetAxes(at_axis * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation());
+ }
+ }
+ }
+ }
+ else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset);
+
+ if( gMorphView )
+ {
+ gMorphView->setVisible( TRUE );
+ }
+
+ // freeze avatar
+ if (isAgentAvatarValid())
+ {
+ mPauseRequest = gAgentAvatarp->requestPause();
+ }
+
+ LLFloaterCamera::onAvatarEditingAppearance(true);
+ }
+
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+ }
+
+ gFloaterTools->dirty();
+
+ // Don't let this be called more than once if the camera
+ // mode hasn't changed. --JC
+ gAgentCamera.updateLastCamera();
}
boost::signals2::connection LLAgent::setMouselookModeInCallback( const camera_signal_t::slot_type& cb )
{
- if (!mMouselookModeInSignal) mMouselookModeInSignal = new camera_signal_t();
- return mMouselookModeInSignal->connect(cb);
+ if (!mMouselookModeInSignal) mMouselookModeInSignal = new camera_signal_t();
+ return mMouselookModeInSignal->connect(cb);
}
boost::signals2::connection LLAgent::setMouselookModeOutCallback( const camera_signal_t::slot_type& cb )
{
- if (!mMouselookModeOutSignal) mMouselookModeOutSignal = new camera_signal_t();
- return mMouselookModeOutSignal->connect(cb);
+ if (!mMouselookModeOutSignal) mMouselookModeOutSignal = new camera_signal_t();
+ return mMouselookModeOutSignal->connect(cb);
}
//-----------------------------------------------------------------------------
@@ -2549,21 +2549,21 @@ boost::signals2::connection LLAgent::setMouselookModeOutCallback( const camera_s
//-----------------------------------------------------------------------------
void LLAgent::heardChat(const LLUUID& id)
{
- // log text and voice chat to speaker mgr
- // for keeping track of active speakers, etc.
- LLLocalSpeakerMgr::getInstance()->speakerChatted(id);
+ // log text and voice chat to speaker mgr
+ // for keeping track of active speakers, etc.
+ LLLocalSpeakerMgr::getInstance()->speakerChatted(id);
- // don't respond to your own voice
- if (id == getID()) return;
-
- if (ll_rand(2) == 0)
- {
- LLViewerObject *chatter = gObjectList.findObject(mLastChatterID);
- gAgentCamera.setLookAt(LOOKAT_TARGET_AUTO_LISTEN, chatter, LLVector3::zero);
- }
+ // don't respond to your own voice
+ if (id == getID()) return;
- mLastChatterID = id;
- mChatTimer.reset();
+ if (ll_rand(2) == 0)
+ {
+ LLViewerObject *chatter = gObjectList.findObject(mLastChatterID);
+ gAgentCamera.setLookAt(LOOKAT_TARGET_AUTO_LISTEN, chatter, LLVector3::zero);
+ }
+
+ mLastChatterID = id;
+ mChatTimer.reset();
}
LLSD ll_sdmap_from_vector3(const LLVector3& vec)
@@ -2632,7 +2632,7 @@ void LLAgent::setStartPosition( U32 location_id )
body["HomeLocation"] = homeLocation;
- if (!requestPostCapability("HomeLocation", body,
+ if (!requestPostCapability("HomeLocation", body,
boost::bind(&LLAgent::setStartPositionSuccess, this, _1)))
LL_WARNS() << "Unable to post to HomeLocation capability." << LL_ENDL;
}
@@ -2685,282 +2685,282 @@ void LLAgent::setStartPositionSuccess(const LLSD &result)
void LLAgent::requestStopMotion( LLMotion* motion )
{
- // Notify all avatars that a motion has stopped.
- // This is needed to clear the animation state bits
- LLUUID anim_state = motion->getID();
- onAnimStop(motion->getID());
+ // Notify all avatars that a motion has stopped.
+ // This is needed to clear the animation state bits
+ LLUUID anim_state = motion->getID();
+ onAnimStop(motion->getID());
- // if motion is not looping, it could have stopped by running out of time
- // so we need to tell the server this
-// LL_INFOS() << "Sending stop for motion " << motion->getName() << LL_ENDL;
- sendAnimationRequest( anim_state, ANIM_REQUEST_STOP );
+ // if motion is not looping, it could have stopped by running out of time
+ // so we need to tell the server this
+// LL_INFOS() << "Sending stop for motion " << motion->getName() << LL_ENDL;
+ sendAnimationRequest( anim_state, ANIM_REQUEST_STOP );
}
void LLAgent::onAnimStop(const LLUUID& id)
{
- // handle automatic state transitions (based on completion of animation playback)
- if (id == ANIM_AGENT_STAND)
- {
- stopFidget();
- }
- else if (id == ANIM_AGENT_AWAY)
- {
- clearAFK();
- }
- else if (id == ANIM_AGENT_STANDUP)
- {
- // send stand up command
- setControlFlags(AGENT_CONTROL_FINISH_ANIM);
-
- // now trigger dusting self off animation
- if (isAgentAvatarValid() && !gAgentAvatarp->mBelowWater && rand() % 3 == 0)
- sendAnimationRequest( ANIM_AGENT_BRUSH, ANIM_REQUEST_START );
- }
- else if (id == ANIM_AGENT_PRE_JUMP || id == ANIM_AGENT_LAND || id == ANIM_AGENT_MEDIUM_LAND)
- {
- setControlFlags(AGENT_CONTROL_FINISH_ANIM);
- }
+ // handle automatic state transitions (based on completion of animation playback)
+ if (id == ANIM_AGENT_STAND)
+ {
+ stopFidget();
+ }
+ else if (id == ANIM_AGENT_AWAY)
+ {
+ clearAFK();
+ }
+ else if (id == ANIM_AGENT_STANDUP)
+ {
+ // send stand up command
+ setControlFlags(AGENT_CONTROL_FINISH_ANIM);
+
+ // now trigger dusting self off animation
+ if (isAgentAvatarValid() && !gAgentAvatarp->mBelowWater && rand() % 3 == 0)
+ sendAnimationRequest( ANIM_AGENT_BRUSH, ANIM_REQUEST_START );
+ }
+ else if (id == ANIM_AGENT_PRE_JUMP || id == ANIM_AGENT_LAND || id == ANIM_AGENT_MEDIUM_LAND)
+ {
+ setControlFlags(AGENT_CONTROL_FINISH_ANIM);
+ }
}
bool LLAgent::isGodlike() const
{
- return mAgentAccess->isGodlike();
+ return mAgentAccess->isGodlike();
}
bool LLAgent::isGodlikeWithoutAdminMenuFakery() const
{
- return mAgentAccess->isGodlikeWithoutAdminMenuFakery();
+ return mAgentAccess->isGodlikeWithoutAdminMenuFakery();
}
U8 LLAgent::getGodLevel() const
{
- return mAgentAccess->getGodLevel();
+ return mAgentAccess->getGodLevel();
}
bool LLAgent::wantsPGOnly() const
{
- return mAgentAccess->wantsPGOnly();
+ return mAgentAccess->wantsPGOnly();
}
bool LLAgent::canAccessMature() const
{
- return mAgentAccess->canAccessMature();
+ return mAgentAccess->canAccessMature();
}
bool LLAgent::canAccessAdult() const
{
- return mAgentAccess->canAccessAdult();
+ return mAgentAccess->canAccessAdult();
}
bool LLAgent::canAccessMaturityInRegion( U64 region_handle ) const
{
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle( region_handle );
- if( regionp )
- {
- switch( regionp->getSimAccess() )
- {
- case SIM_ACCESS_MATURE:
- if( !canAccessMature() )
- return false;
- break;
- case SIM_ACCESS_ADULT:
- if( !canAccessAdult() )
- return false;
- break;
- default:
- // Oh, go on and hear the silly noises.
- break;
- }
- }
-
- return true;
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle( region_handle );
+ if( regionp )
+ {
+ switch( regionp->getSimAccess() )
+ {
+ case SIM_ACCESS_MATURE:
+ if( !canAccessMature() )
+ return false;
+ break;
+ case SIM_ACCESS_ADULT:
+ if( !canAccessAdult() )
+ return false;
+ break;
+ default:
+ // Oh, go on and hear the silly noises.
+ break;
+ }
+ }
+
+ return true;
}
bool LLAgent::canAccessMaturityAtGlobal( LLVector3d pos_global ) const
{
- U64 region_handle = to_region_handle_global( pos_global.mdV[0], pos_global.mdV[1] );
- return canAccessMaturityInRegion( region_handle );
+ U64 region_handle = to_region_handle_global( pos_global.mdV[0], pos_global.mdV[1] );
+ return canAccessMaturityInRegion( region_handle );
}
bool LLAgent::prefersPG() const
{
- return mAgentAccess->prefersPG();
+ return mAgentAccess->prefersPG();
}
bool LLAgent::prefersMature() const
{
- return mAgentAccess->prefersMature();
+ return mAgentAccess->prefersMature();
}
-
+
bool LLAgent::prefersAdult() const
{
- return mAgentAccess->prefersAdult();
+ return mAgentAccess->prefersAdult();
}
bool LLAgent::isTeen() const
{
- return mAgentAccess->isTeen();
+ return mAgentAccess->isTeen();
}
bool LLAgent::isMature() const
{
- return mAgentAccess->isMature();
+ return mAgentAccess->isMature();
}
bool LLAgent::isAdult() const
{
- return mAgentAccess->isAdult();
+ return mAgentAccess->isAdult();
}
-//static
+//static
int LLAgent::convertTextToMaturity(char text)
{
- return LLAgentAccess::convertTextToMaturity(text);
+ return LLAgentAccess::convertTextToMaturity(text);
}
void LLAgent::handlePreferredMaturityResult(U8 pServerMaturity)
{
- // Update the number of responses received
- ++mMaturityPreferenceResponseId;
- llassert(mMaturityPreferenceResponseId <= mMaturityPreferenceRequestId);
-
- // Update the last known server maturity response
- mLastKnownResponseMaturity = pServerMaturity;
-
- // Ignore all responses if we know there are more unanswered requests that are expected
- if (mMaturityPreferenceResponseId == mMaturityPreferenceRequestId)
- {
- // If we received a response that matches the last known request, then we are good
- if (mLastKnownRequestMaturity == mLastKnownResponseMaturity)
- {
- mMaturityPreferenceNumRetries = 0;
- reportPreferredMaturitySuccess();
- llassert(static_cast<U8>(gSavedSettings.getU32("PreferredMaturity")) == mLastKnownResponseMaturity);
- }
- // Else, the viewer is out of sync with the server, so let's try to re-sync with the
- // server by re-sending our last known request. Cap the re-tries at 3 just to be safe.
- else if (++mMaturityPreferenceNumRetries <= 3)
- {
- LL_INFOS() << "Retrying attempt #" << mMaturityPreferenceNumRetries << " to set viewer preferred maturity to '"
- << LLViewerRegion::accessToString(mLastKnownRequestMaturity) << "'" << LL_ENDL;
- sendMaturityPreferenceToServer(mLastKnownRequestMaturity);
- }
- // Else, the viewer is style out of sync with the server after 3 retries, so inform the user
- else
- {
- mMaturityPreferenceNumRetries = 0;
- LL_WARNS() << "Too many retries for maturity preference" << LL_ENDL;
- reportPreferredMaturityError();
- }
- }
+ // Update the number of responses received
+ ++mMaturityPreferenceResponseId;
+ llassert(mMaturityPreferenceResponseId <= mMaturityPreferenceRequestId);
+
+ // Update the last known server maturity response
+ mLastKnownResponseMaturity = pServerMaturity;
+
+ // Ignore all responses if we know there are more unanswered requests that are expected
+ if (mMaturityPreferenceResponseId == mMaturityPreferenceRequestId)
+ {
+ // If we received a response that matches the last known request, then we are good
+ if (mLastKnownRequestMaturity == mLastKnownResponseMaturity)
+ {
+ mMaturityPreferenceNumRetries = 0;
+ reportPreferredMaturitySuccess();
+ llassert(static_cast<U8>(gSavedSettings.getU32("PreferredMaturity")) == mLastKnownResponseMaturity);
+ }
+ // Else, the viewer is out of sync with the server, so let's try to re-sync with the
+ // server by re-sending our last known request. Cap the re-tries at 3 just to be safe.
+ else if (++mMaturityPreferenceNumRetries <= 3)
+ {
+ LL_INFOS() << "Retrying attempt #" << mMaturityPreferenceNumRetries << " to set viewer preferred maturity to '"
+ << LLViewerRegion::accessToString(mLastKnownRequestMaturity) << "'" << LL_ENDL;
+ sendMaturityPreferenceToServer(mLastKnownRequestMaturity);
+ }
+ // Else, the viewer is style out of sync with the server after 3 retries, so inform the user
+ else
+ {
+ mMaturityPreferenceNumRetries = 0;
+ LL_WARNS() << "Too many retries for maturity preference" << LL_ENDL;
+ reportPreferredMaturityError();
+ }
+ }
}
void LLAgent::handlePreferredMaturityError()
{
- // Update the number of responses received
- ++mMaturityPreferenceResponseId;
- llassert(mMaturityPreferenceResponseId <= mMaturityPreferenceRequestId);
-
- // Ignore all responses if we know there are more unanswered requests that are expected
- if (mMaturityPreferenceResponseId == mMaturityPreferenceRequestId)
- {
- mMaturityPreferenceNumRetries = 0;
-
- // If we received a response that matches the last known request, then we are synced with
- // the server, but not quite sure why we are
- if (mLastKnownRequestMaturity == mLastKnownResponseMaturity)
- {
- LL_WARNS() << "Got an error but maturity preference '" << LLViewerRegion::accessToString(mLastKnownRequestMaturity)
- << "' seems to be in sync with the server" << LL_ENDL;
- reportPreferredMaturitySuccess();
- }
- // Else, the more likely case is that the last request does not match the last response,
- // so inform the user
- else
- {
- reportPreferredMaturityError();
- }
- }
+ // Update the number of responses received
+ ++mMaturityPreferenceResponseId;
+ llassert(mMaturityPreferenceResponseId <= mMaturityPreferenceRequestId);
+
+ // Ignore all responses if we know there are more unanswered requests that are expected
+ if (mMaturityPreferenceResponseId == mMaturityPreferenceRequestId)
+ {
+ mMaturityPreferenceNumRetries = 0;
+
+ // If we received a response that matches the last known request, then we are synced with
+ // the server, but not quite sure why we are
+ if (mLastKnownRequestMaturity == mLastKnownResponseMaturity)
+ {
+ LL_WARNS() << "Got an error but maturity preference '" << LLViewerRegion::accessToString(mLastKnownRequestMaturity)
+ << "' seems to be in sync with the server" << LL_ENDL;
+ reportPreferredMaturitySuccess();
+ }
+ // Else, the more likely case is that the last request does not match the last response,
+ // so inform the user
+ else
+ {
+ reportPreferredMaturityError();
+ }
+ }
}
void LLAgent::reportPreferredMaturitySuccess()
{
- // If there is a pending teleport request waiting for the maturity preference to be synced with
- // the server, let's start the pending request
- if (hasPendingTeleportRequest())
- {
- startTeleportRequest();
- }
+ // If there is a pending teleport request waiting for the maturity preference to be synced with
+ // the server, let's start the pending request
+ if (hasPendingTeleportRequest())
+ {
+ startTeleportRequest();
+ }
}
void LLAgent::reportPreferredMaturityError()
{
- // If there is a pending teleport request waiting for the maturity preference to be synced with
- // the server, we were unable to successfully sync with the server on maturity preference, so let's
- // just raise the screen.
- mIsMaturityRatingChangingDuringTeleport = false;
- if (hasPendingTeleportRequest())
- {
- LL_WARNS("Teleport") << "Teleport failing due to preferred maturity error" << LL_ENDL;
- setTeleportState(LLAgent::TELEPORT_NONE);
- }
-
- // Get the last known maturity request from the user activity
- std::string preferredMaturity = LLViewerRegion::accessToString(mLastKnownRequestMaturity);
- LLStringUtil::toLower(preferredMaturity);
-
- // Get the last known maturity response from the server
- std::string actualMaturity = LLViewerRegion::accessToString(mLastKnownResponseMaturity);
- LLStringUtil::toLower(actualMaturity);
-
- // Notify the user
- LLSD args = LLSD::emptyMap();
- args["PREFERRED_MATURITY"] = preferredMaturity;
- args["ACTUAL_MATURITY"] = actualMaturity;
- LLNotificationsUtil::add("MaturityChangeError", args);
-
- // Check the saved settings to ensure that we are consistent. If we are not consistent, update
- // the viewer, but do not send anything to server
- U8 localMaturity = static_cast<U8>(gSavedSettings.getU32("PreferredMaturity"));
- if (localMaturity != mLastKnownResponseMaturity)
- {
- bool tmpIsDoSendMaturityPreferenceToServer = mIsDoSendMaturityPreferenceToServer;
- mIsDoSendMaturityPreferenceToServer = false;
- LL_INFOS() << "Setting viewer preferred maturity to '" << LLViewerRegion::accessToString(mLastKnownResponseMaturity) << "'" << LL_ENDL;
- gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(mLastKnownResponseMaturity));
- mIsDoSendMaturityPreferenceToServer = tmpIsDoSendMaturityPreferenceToServer;
- }
+ // If there is a pending teleport request waiting for the maturity preference to be synced with
+ // the server, we were unable to successfully sync with the server on maturity preference, so let's
+ // just raise the screen.
+ mIsMaturityRatingChangingDuringTeleport = false;
+ if (hasPendingTeleportRequest())
+ {
+ LL_WARNS("Teleport") << "Teleport failing due to preferred maturity error" << LL_ENDL;
+ setTeleportState(LLAgent::TELEPORT_NONE);
+ }
+
+ // Get the last known maturity request from the user activity
+ std::string preferredMaturity = LLViewerRegion::accessToString(mLastKnownRequestMaturity);
+ LLStringUtil::toLower(preferredMaturity);
+
+ // Get the last known maturity response from the server
+ std::string actualMaturity = LLViewerRegion::accessToString(mLastKnownResponseMaturity);
+ LLStringUtil::toLower(actualMaturity);
+
+ // Notify the user
+ LLSD args = LLSD::emptyMap();
+ args["PREFERRED_MATURITY"] = preferredMaturity;
+ args["ACTUAL_MATURITY"] = actualMaturity;
+ LLNotificationsUtil::add("MaturityChangeError", args);
+
+ // Check the saved settings to ensure that we are consistent. If we are not consistent, update
+ // the viewer, but do not send anything to server
+ U8 localMaturity = static_cast<U8>(gSavedSettings.getU32("PreferredMaturity"));
+ if (localMaturity != mLastKnownResponseMaturity)
+ {
+ bool tmpIsDoSendMaturityPreferenceToServer = mIsDoSendMaturityPreferenceToServer;
+ mIsDoSendMaturityPreferenceToServer = false;
+ LL_INFOS() << "Setting viewer preferred maturity to '" << LLViewerRegion::accessToString(mLastKnownResponseMaturity) << "'" << LL_ENDL;
+ gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(mLastKnownResponseMaturity));
+ mIsDoSendMaturityPreferenceToServer = tmpIsDoSendMaturityPreferenceToServer;
+ }
}
bool LLAgent::isMaturityPreferenceSyncedWithServer() const
{
- return (mMaturityPreferenceRequestId == mMaturityPreferenceResponseId);
+ return (mMaturityPreferenceRequestId == mMaturityPreferenceResponseId);
}
void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)
{
- // Only send maturity preference to the server if enabled
- if (mIsDoSendMaturityPreferenceToServer)
- {
- // Increment the number of requests. The handlers manage a separate count of responses.
- ++mMaturityPreferenceRequestId;
+ // Only send maturity preference to the server if enabled
+ if (mIsDoSendMaturityPreferenceToServer)
+ {
+ // Increment the number of requests. The handlers manage a separate count of responses.
+ ++mMaturityPreferenceRequestId;
- // Update the last know maturity request
- mLastKnownRequestMaturity = pPreferredMaturity;
+ // Update the last know maturity request
+ mLastKnownRequestMaturity = pPreferredMaturity;
- // If we don't have a region, report it as an error
- if (getRegion() == NULL)
- {
- LL_WARNS("Agent") << "Region is not defined, can not change Maturity setting." << LL_ENDL;
- return;
- }
+ // If we don't have a region, report it as an error
+ if (getRegion() == NULL)
+ {
+ LL_WARNS("Agent") << "Region is not defined, can not change Maturity setting." << LL_ENDL;
+ return;
+ }
- LLSD access_prefs = LLSD::emptyMap();
- access_prefs["max"] = LLViewerRegion::accessToShortString(pPreferredMaturity);
+ LLSD access_prefs = LLSD::emptyMap();
+ access_prefs["max"] = LLViewerRegion::accessToShortString(pPreferredMaturity);
- LLSD postData = LLSD::emptyMap();
- postData["access_prefs"] = access_prefs;
- LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) << LL_ENDL;
+ LLSD postData = LLSD::emptyMap();
+ postData["access_prefs"] = access_prefs;
+ LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) << LL_ENDL;
if (!requestPostCapability("UpdateAgentInformation", postData,
static_cast<httpCallback_t>(boost::bind(&LLAgent::processMaturityPreferenceFromServer, this, _1, pPreferredMaturity)),
@@ -2969,7 +2969,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)
{
LL_WARNS("Agent") << "Maturity request post failed." << LL_ENDL;
}
- }
+ }
}
@@ -3036,10 +3036,10 @@ void LLAgent::changeInterestListMode(const std::string &new_mode)
}
}
}
- else
- {
- LL_DEBUGS("360Capture") << "Agent interest list mode is already set to " << mInterestListMode << LL_ENDL;
- }
+ else
+ {
+ LL_DEBUGS("360Capture") << "Agent interest list mode is already set to " << mInterestListMode << LL_ENDL;
+ }
}
@@ -3049,7 +3049,7 @@ bool LLAgent::requestPostCapability(const std::string &capName, LLSD &postData,
{
return getRegion()->requestPostCapability(capName, postData, cbSuccess, cbFailure);
}
- return false;
+ return false;
}
bool LLAgent::requestGetCapability(const std::string &capName, httpCallback_t cbSuccess, httpCallback_t cbFailure)
@@ -3061,45 +3061,45 @@ bool LLAgent::requestGetCapability(const std::string &capName, httpCallback_t cb
return false;
}
-BOOL LLAgent::getAdminOverride() const
-{
- return mAgentAccess->getAdminOverride();
+BOOL LLAgent::getAdminOverride() const
+{
+ return mAgentAccess->getAdminOverride();
}
void LLAgent::setMaturity(char text)
{
- mAgentAccess->setMaturity(text);
+ mAgentAccess->setMaturity(text);
}
-void LLAgent::setAdminOverride(BOOL b)
-{
- mAgentAccess->setAdminOverride(b);
+void LLAgent::setAdminOverride(BOOL b)
+{
+ mAgentAccess->setAdminOverride(b);
}
-void LLAgent::setGodLevel(U8 god_level)
-{
- mAgentAccess->setGodLevel(god_level);
- mGodLevelChangeSignal(god_level);
+void LLAgent::setGodLevel(U8 god_level)
+{
+ mAgentAccess->setGodLevel(god_level);
+ mGodLevelChangeSignal(god_level);
}
LLAgent::god_level_change_slot_t LLAgent::registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback)
{
- return mGodLevelChangeSignal.connect(pGodLevelChangeCallback);
+ return mGodLevelChangeSignal.connect(pGodLevelChangeCallback);
}
const LLAgentAccess& LLAgent::getAgentAccess()
{
- return *mAgentAccess;
+ return *mAgentAccess;
}
bool LLAgent::validateMaturity(const LLSD& newvalue)
{
- return mAgentAccess->canSetMaturity(newvalue.asInteger());
+ return mAgentAccess->canSetMaturity(newvalue.asInteger());
}
void LLAgent::handleMaturity(const LLSD &pNewValue)
{
- sendMaturityPreferenceToServer(static_cast<U8>(pNewValue.asInteger()));
+ sendMaturityPreferenceToServer(static_cast<U8>(pNewValue.asInteger()));
}
//----------------------------------------------------------------------------
@@ -3107,267 +3107,267 @@ void LLAgent::handleMaturity(const LLSD &pNewValue)
//*TODO remove, is not used anywhere as of August 20, 2009
void LLAgent::buildFullnameAndTitle(std::string& name) const
{
- if (isGroupMember())
- {
- name = mGroupTitle;
- name += ' ';
- }
- else
- {
- name.erase(0, name.length());
- }
+ if (isGroupMember())
+ {
+ name = mGroupTitle;
+ name += ' ';
+ }
+ else
+ {
+ name.erase(0, name.length());
+ }
- if (isAgentAvatarValid())
- {
- name += gAgentAvatarp->getFullname();
- }
+ if (isAgentAvatarValid())
+ {
+ name += gAgentAvatarp->getFullname();
+ }
}
BOOL LLAgent::isInGroup(const LLUUID& group_id, BOOL ignore_god_mode /* FALSE */) const
{
- if (!ignore_god_mode && isGodlike())
- return true;
+ if (!ignore_god_mode && isGodlike())
+ return true;
- U32 count = mGroups.size();
- for(U32 i = 0; i < count; ++i)
- {
- if(mGroups[i].mID == group_id)
- {
- return TRUE;
- }
- }
- return FALSE;
+ U32 count = mGroups.size();
+ for(U32 i = 0; i < count; ++i)
+ {
+ if(mGroups[i].mID == group_id)
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
// This implementation should mirror LLAgentInfo::hasPowerInGroup
BOOL LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const
{
- if (isGodlikeWithoutAdminMenuFakery())
- return true;
+ if (isGodlikeWithoutAdminMenuFakery())
+ return true;
- // GP_NO_POWERS can also mean no power is enough to grant an ability.
- if (GP_NO_POWERS == power) return FALSE;
+ // GP_NO_POWERS can also mean no power is enough to grant an ability.
+ if (GP_NO_POWERS == power) return FALSE;
- U32 count = mGroups.size();
- for(U32 i = 0; i < count; ++i)
- {
- if(mGroups[i].mID == group_id)
- {
- return (BOOL)((mGroups[i].mPowers & power) > 0);
- }
- }
- return FALSE;
+ U32 count = mGroups.size();
+ for(U32 i = 0; i < count; ++i)
+ {
+ if(mGroups[i].mID == group_id)
+ {
+ return (BOOL)((mGroups[i].mPowers & power) > 0);
+ }
+ }
+ return FALSE;
}
BOOL LLAgent::hasPowerInActiveGroup(U64 power) const
{
- return (mGroupID.notNull() && (hasPowerInGroup(mGroupID, power)));
+ return (mGroupID.notNull() && (hasPowerInGroup(mGroupID, power)));
}
U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const
{
- if (isGodlike())
- return GP_ALL_POWERS;
-
- U32 count = mGroups.size();
- for(U32 i = 0; i < count; ++i)
- {
- if(mGroups[i].mID == group_id)
- {
- return (mGroups[i].mPowers);
- }
- }
+ if (isGodlike())
+ return GP_ALL_POWERS;
+
+ U32 count = mGroups.size();
+ for(U32 i = 0; i < count; ++i)
+ {
+ if(mGroups[i].mID == group_id)
+ {
+ return (mGroups[i].mPowers);
+ }
+ }
- return GP_NO_POWERS;
+ return GP_NO_POWERS;
}
BOOL LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const
{
- S32 count = mGroups.size();
- for(S32 i = 0; i < count; ++i)
- {
- if(mGroups[i].mID == group_id)
- {
- data = mGroups[i];
- return TRUE;
- }
- }
- return FALSE;
+ S32 count = mGroups.size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ if(mGroups[i].mID == group_id)
+ {
+ data = mGroups[i];
+ return TRUE;
+ }
+ }
+ return FALSE;
}
S32 LLAgent::getGroupContribution(const LLUUID& group_id) const
{
- S32 count = mGroups.size();
- for(S32 i = 0; i < count; ++i)
- {
- if(mGroups[i].mID == group_id)
- {
- S32 contribution = mGroups[i].mContribution;
- return contribution;
- }
- }
- return 0;
+ S32 count = mGroups.size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ if(mGroups[i].mID == group_id)
+ {
+ S32 contribution = mGroups[i].mContribution;
+ return contribution;
+ }
+ }
+ return 0;
}
BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution)
{
- S32 count = mGroups.size();
- for(S32 i = 0; i < count; ++i)
- {
- if(mGroups[i].mID == group_id)
- {
- mGroups[i].mContribution = contribution;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("SetGroupContribution");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgentID);
- msg->addUUID("SessionID", gAgentSessionID);
- msg->nextBlock("Data");
- msg->addUUID("GroupID", group_id);
- msg->addS32("Contribution", contribution);
- sendReliableMessage();
- return TRUE;
- }
- }
- return FALSE;
+ S32 count = mGroups.size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ if(mGroups[i].mID == group_id)
+ {
+ mGroups[i].mContribution = contribution;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("SetGroupContribution");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgentID);
+ msg->addUUID("SessionID", gAgentSessionID);
+ msg->nextBlock("Data");
+ msg->addUUID("GroupID", group_id);
+ msg->addS32("Contribution", contribution);
+ sendReliableMessage();
+ return TRUE;
+ }
+ }
+ return FALSE;
}
BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile)
{
- S32 count = mGroups.size();
- for(S32 i = 0; i < count; ++i)
- {
- if(mGroups[i].mID == group_id)
- {
- mGroups[i].mAcceptNotices = accept_notices;
- mGroups[i].mListInProfile = list_in_profile;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("SetGroupAcceptNotices");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgentID);
- msg->addUUID("SessionID", gAgentSessionID);
- msg->nextBlock("Data");
- msg->addUUID("GroupID", group_id);
- msg->addBOOL("AcceptNotices", accept_notices);
- msg->nextBlock("NewData");
- msg->addBOOL("ListInProfile", list_in_profile);
- sendReliableMessage();
- return TRUE;
- }
- }
- return FALSE;
+ S32 count = mGroups.size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ if(mGroups[i].mID == group_id)
+ {
+ mGroups[i].mAcceptNotices = accept_notices;
+ mGroups[i].mListInProfile = list_in_profile;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("SetGroupAcceptNotices");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgentID);
+ msg->addUUID("SessionID", gAgentSessionID);
+ msg->nextBlock("Data");
+ msg->addUUID("GroupID", group_id);
+ msg->addBOOL("AcceptNotices", accept_notices);
+ msg->nextBlock("NewData");
+ msg->addBOOL("ListInProfile", list_in_profile);
+ sendReliableMessage();
+ return TRUE;
+ }
+ }
+ return FALSE;
}
BOOL LLAgent::canJoinGroups() const
{
- return (S32)mGroups.size() < LLAgentBenefitsMgr::current().getGroupMembershipLimit();
+ return (S32)mGroups.size() < LLAgentBenefitsMgr::current().getGroupMembershipLimit();
}
LLQuaternion LLAgent::getHeadRotation()
{
- if (!isAgentAvatarValid() || !gAgentAvatarp->mPelvisp || !gAgentAvatarp->mHeadp)
- {
- return LLQuaternion::DEFAULT;
- }
+ if (!isAgentAvatarValid() || !gAgentAvatarp->mPelvisp || !gAgentAvatarp->mHeadp)
+ {
+ return LLQuaternion::DEFAULT;
+ }
- if (!gAgentCamera.cameraMouselook())
- {
- return gAgentAvatarp->getRotation();
- }
+ if (!gAgentCamera.cameraMouselook())
+ {
+ return gAgentAvatarp->getRotation();
+ }
- // We must be in mouselook
- LLVector3 look_dir( LLViewerCamera::getInstance()->getAtAxis() );
- LLVector3 up = look_dir % mFrameAgent.getLeftAxis();
- LLVector3 left = up % look_dir;
+ // We must be in mouselook
+ LLVector3 look_dir( LLViewerCamera::getInstance()->getAtAxis() );
+ LLVector3 up = look_dir % mFrameAgent.getLeftAxis();
+ LLVector3 left = up % look_dir;
- LLQuaternion rot(look_dir, left, up);
- if (gAgentAvatarp->getParent())
- {
- rot = rot * ~gAgentAvatarp->getParent()->getRotation();
- }
+ LLQuaternion rot(look_dir, left, up);
+ if (gAgentAvatarp->getParent())
+ {
+ rot = rot * ~gAgentAvatarp->getParent()->getRotation();
+ }
- return rot;
+ return rot;
}
void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request)
{
- if (gAgentID.isNull())
- {
- return;
- }
-
- S32 num_valid_anims = 0;
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_AgentAnimation);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
-
- for (S32 i = 0; i < anim_ids.size(); i++)
- {
- if (anim_ids[i].isNull())
- {
- continue;
- }
- msg->nextBlockFast(_PREHASH_AnimationList);
- msg->addUUIDFast(_PREHASH_AnimID, (anim_ids[i]) );
- msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE);
- num_valid_anims++;
- }
-
- msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
- msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
- if (num_valid_anims)
- {
- sendReliableMessage();
- }
+ if (gAgentID.isNull())
+ {
+ return;
+ }
+
+ S32 num_valid_anims = 0;
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_AgentAnimation);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+
+ for (S32 i = 0; i < anim_ids.size(); i++)
+ {
+ if (anim_ids[i].isNull())
+ {
+ continue;
+ }
+ msg->nextBlockFast(_PREHASH_AnimationList);
+ msg->addUUIDFast(_PREHASH_AnimID, (anim_ids[i]) );
+ msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE);
+ num_valid_anims++;
+ }
+
+ msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
+ msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
+ if (num_valid_anims)
+ {
+ sendReliableMessage();
+ }
}
void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request)
{
- if (gAgentID.isNull() || anim_id.isNull() || !mRegionp)
- {
- return;
- }
+ if (gAgentID.isNull() || anim_id.isNull() || !mRegionp)
+ {
+ return;
+ }
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_AgentAnimation);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_AgentAnimation);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- msg->nextBlockFast(_PREHASH_AnimationList);
- msg->addUUIDFast(_PREHASH_AnimID, (anim_id) );
- msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE);
+ msg->nextBlockFast(_PREHASH_AnimationList);
+ msg->addUUIDFast(_PREHASH_AnimID, (anim_id) );
+ msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE);
- msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
- msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
- sendReliableMessage();
+ msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
+ msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
+ sendReliableMessage();
}
// Send a message to the region to stop the NULL animation state
// This will reset animation state overrides for the agent.
void LLAgent::sendAnimationStateReset()
{
- if (gAgentID.isNull() || !mRegionp)
- {
- return;
- }
+ if (gAgentID.isNull() || !mRegionp)
+ {
+ return;
+ }
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_AgentAnimation);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_AgentAnimation);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- msg->nextBlockFast(_PREHASH_AnimationList);
- msg->addUUIDFast(_PREHASH_AnimID, LLUUID::null );
- msg->addBOOLFast(_PREHASH_StartAnim, FALSE);
+ msg->nextBlockFast(_PREHASH_AnimationList);
+ msg->addUUIDFast(_PREHASH_AnimID, LLUUID::null );
+ msg->addBOOLFast(_PREHASH_StartAnim, FALSE);
- msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
- msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
- sendReliableMessage();
+ msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
+ msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
+ sendReliableMessage();
}
@@ -3376,638 +3376,638 @@ void LLAgent::sendAnimationStateReset()
// If it is the region ID, all scripts clear the permissions for this agent
void LLAgent::sendRevokePermissions(const LLUUID & target, U32 permissions)
{
- // Currently only the bits for SCRIPT_PERMISSION_TRIGGER_ANIMATION and SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS
- // are supported by the server. Sending any other bits will cause the message to be dropped without changing permissions
+ // Currently only the bits for SCRIPT_PERMISSION_TRIGGER_ANIMATION and SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS
+ // are supported by the server. Sending any other bits will cause the message to be dropped without changing permissions
- if (gAgentID.notNull() && gMessageSystem)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RevokePermissions);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, getID()); // Must be our ID
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+ if (gAgentID.notNull() && gMessageSystem)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RevokePermissions);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, getID()); // Must be our ID
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- msg->nextBlockFast(_PREHASH_Data);
- msg->addUUIDFast(_PREHASH_ObjectID, target); // Must be in the region
- msg->addS32Fast(_PREHASH_ObjectPermissions, (S32) permissions);
+ msg->nextBlockFast(_PREHASH_Data);
+ msg->addUUIDFast(_PREHASH_ObjectID, target); // Must be in the region
+ msg->addS32Fast(_PREHASH_ObjectPermissions, (S32) permissions);
- sendReliableMessage();
- }
+ sendReliableMessage();
+ }
}
void LLAgent::sendWalkRun(bool running)
{
- LLMessageSystem* msgsys = gMessageSystem;
- if (msgsys)
- {
- msgsys->newMessageFast(_PREHASH_SetAlwaysRun);
- msgsys->nextBlockFast(_PREHASH_AgentData);
- msgsys->addUUIDFast(_PREHASH_AgentID, getID());
- msgsys->addUUIDFast(_PREHASH_SessionID, getSessionID());
- msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(running) );
- sendReliableMessage();
- }
+ LLMessageSystem* msgsys = gMessageSystem;
+ if (msgsys)
+ {
+ msgsys->newMessageFast(_PREHASH_SetAlwaysRun);
+ msgsys->nextBlockFast(_PREHASH_AgentData);
+ msgsys->addUUIDFast(_PREHASH_AgentID, getID());
+ msgsys->addUUIDFast(_PREHASH_SessionID, getSessionID());
+ msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(running) );
+ sendReliableMessage();
+ }
}
void LLAgent::friendsChanged()
{
- LLCollectProxyBuddies collector;
- LLAvatarTracker::instance().applyFunctor(collector);
- mProxyForAgents = collector.mProxy;
+ LLCollectProxyBuddies collector;
+ LLAvatarTracker::instance().applyFunctor(collector);
+ mProxyForAgents = collector.mProxy;
}
BOOL LLAgent::isGrantedProxy(const LLPermissions& perm)
{
- return (mProxyForAgents.count(perm.getOwner()) > 0);
+ return (mProxyForAgents.count(perm.getOwner()) > 0);
}
BOOL LLAgent::allowOperation(PermissionBit op,
- const LLPermissions& perm,
- U64 group_proxy_power,
- U8 god_minimum)
-{
- // Check god level.
- if (getGodLevel() >= god_minimum) return TRUE;
-
- if (!perm.isOwned()) return FALSE;
-
- // A group member with group_proxy_power can act as owner.
- BOOL is_group_owned;
- LLUUID owner_id;
- perm.getOwnership(owner_id, is_group_owned);
- LLUUID group_id(perm.getGroup());
- LLUUID agent_proxy(getID());
-
- if (is_group_owned)
- {
- if (hasPowerInGroup(group_id, group_proxy_power))
- {
- // Let the member assume the group's id for permission requests.
- agent_proxy = owner_id;
- }
- }
- else
- {
- // Check for granted mod permissions.
- if ((PERM_OWNER != op) && isGrantedProxy(perm))
- {
- agent_proxy = owner_id;
- }
- }
-
- // This is the group id to use for permission requests.
- // Only group members may use this field.
- LLUUID group_proxy = LLUUID::null;
- if (group_id.notNull() && isInGroup(group_id))
- {
- group_proxy = group_id;
- }
-
- // We now have max ownership information.
- if (PERM_OWNER == op)
- {
- // This this was just a check for ownership, we can now return the answer.
- return (agent_proxy == owner_id);
- }
-
- return perm.allowOperationBy(op, agent_proxy, group_proxy);
+ const LLPermissions& perm,
+ U64 group_proxy_power,
+ U8 god_minimum)
+{
+ // Check god level.
+ if (getGodLevel() >= god_minimum) return TRUE;
+
+ if (!perm.isOwned()) return FALSE;
+
+ // A group member with group_proxy_power can act as owner.
+ BOOL is_group_owned;
+ LLUUID owner_id;
+ perm.getOwnership(owner_id, is_group_owned);
+ LLUUID group_id(perm.getGroup());
+ LLUUID agent_proxy(getID());
+
+ if (is_group_owned)
+ {
+ if (hasPowerInGroup(group_id, group_proxy_power))
+ {
+ // Let the member assume the group's id for permission requests.
+ agent_proxy = owner_id;
+ }
+ }
+ else
+ {
+ // Check for granted mod permissions.
+ if ((PERM_OWNER != op) && isGrantedProxy(perm))
+ {
+ agent_proxy = owner_id;
+ }
+ }
+
+ // This is the group id to use for permission requests.
+ // Only group members may use this field.
+ LLUUID group_proxy = LLUUID::null;
+ if (group_id.notNull() && isInGroup(group_id))
+ {
+ group_proxy = group_id;
+ }
+
+ // We now have max ownership information.
+ if (PERM_OWNER == op)
+ {
+ // This this was just a check for ownership, we can now return the answer.
+ return (agent_proxy == owner_id);
+ }
+
+ return perm.allowOperationBy(op, agent_proxy, group_proxy);
}
const LLColor4 &LLAgent::getEffectColor()
{
- return *mEffectColor;
+ return *mEffectColor;
}
void LLAgent::setEffectColor(const LLColor4 &color)
{
- *mEffectColor = color;
+ *mEffectColor = color;
}
void LLAgent::initOriginGlobal(const LLVector3d &origin_global)
{
- mAgentOriginGlobal = origin_global;
+ mAgentOriginGlobal = origin_global;
}
-BOOL LLAgent::leftButtonGrabbed() const
-{
- const BOOL camera_mouse_look = gAgentCamera.cameraMouselook();
- return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
- || (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0)
- || (!camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
- || (camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0);
+BOOL LLAgent::leftButtonGrabbed() const
+{
+ const BOOL camera_mouse_look = gAgentCamera.cameraMouselook();
+ return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
+ || (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0)
+ || (!camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
+ || (camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0);
}
-BOOL LLAgent::rotateGrabbed() const
-{
- return (mControlsTakenCount[CONTROL_YAW_POS_INDEX] > 0)
- || (mControlsTakenCount[CONTROL_YAW_NEG_INDEX] > 0);
+BOOL LLAgent::rotateGrabbed() const
+{
+ return (mControlsTakenCount[CONTROL_YAW_POS_INDEX] > 0)
+ || (mControlsTakenCount[CONTROL_YAW_NEG_INDEX] > 0);
}
BOOL LLAgent::forwardGrabbed() const
-{
- return (mControlsTakenCount[CONTROL_AT_POS_INDEX] > 0);
+{
+ return (mControlsTakenCount[CONTROL_AT_POS_INDEX] > 0);
}
BOOL LLAgent::backwardGrabbed() const
-{
- return (mControlsTakenCount[CONTROL_AT_NEG_INDEX] > 0);
+{
+ return (mControlsTakenCount[CONTROL_AT_NEG_INDEX] > 0);
}
-BOOL LLAgent::upGrabbed() const
-{
- return (mControlsTakenCount[CONTROL_UP_POS_INDEX] > 0);
+BOOL LLAgent::upGrabbed() const
+{
+ return (mControlsTakenCount[CONTROL_UP_POS_INDEX] > 0);
}
-BOOL LLAgent::downGrabbed() const
-{
- return (mControlsTakenCount[CONTROL_UP_NEG_INDEX] > 0);
+BOOL LLAgent::downGrabbed() const
+{
+ return (mControlsTakenCount[CONTROL_UP_NEG_INDEX] > 0);
}
void update_group_floaters(const LLUUID& group_id)
{
-
- LLGroupActions::refresh(group_id);
- //*TODO Implement group update for Profile View
- // still actual as of July 31, 2009 (DZ)
- gAgent.fireEvent(new LLOldEvents::LLEvent(&gAgent, "new group"), "");
+ LLGroupActions::refresh(group_id);
+ //*TODO Implement group update for Profile View
+ // still actual as of July 31, 2009 (DZ)
+
+ gAgent.fireEvent(new LLOldEvents::LLEvent(&gAgent, "new group"), "");
}
// static
void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **)
{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
-
- if (agent_id != gAgentID)
- {
- LL_WARNS() << "processAgentDropGroup for agent other than me" << LL_ENDL;
- return;
- }
-
- LLUUID group_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
-
- // Remove the group if it already exists remove it and add the new data to pick up changes.
- LLGroupData gd;
- gd.mID = group_id;
- std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
- if (found_it != gAgent.mGroups.end())
- {
- gAgent.mGroups.erase(found_it);
- if (gAgent.getGroupID() == group_id)
- {
- gAgent.mGroupID.setNull();
- gAgent.mGroupPowers = 0;
- gAgent.mGroupName.clear();
- gAgent.mGroupTitle.clear();
- }
-
- // refresh all group information
- gAgent.sendAgentDataUpdateRequest();
-
- LLGroupMgr::getInstance()->clearGroupData(group_id);
- // close the floater for this group, if any.
- LLGroupActions::closeGroup(group_id);
- }
- else
- {
- LL_WARNS() << "processAgentDropGroup, agent is not part of group " << group_id << LL_ENDL;
- }
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+
+ if (agent_id != gAgentID)
+ {
+ LL_WARNS() << "processAgentDropGroup for agent other than me" << LL_ENDL;
+ return;
+ }
+
+ LLUUID group_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
+
+ // Remove the group if it already exists remove it and add the new data to pick up changes.
+ LLGroupData gd;
+ gd.mID = group_id;
+ std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
+ if (found_it != gAgent.mGroups.end())
+ {
+ gAgent.mGroups.erase(found_it);
+ if (gAgent.getGroupID() == group_id)
+ {
+ gAgent.mGroupID.setNull();
+ gAgent.mGroupPowers = 0;
+ gAgent.mGroupName.clear();
+ gAgent.mGroupTitle.clear();
+ }
+
+ // refresh all group information
+ gAgent.sendAgentDataUpdateRequest();
+
+ LLGroupMgr::getInstance()->clearGroupData(group_id);
+ // close the floater for this group, if any.
+ LLGroupActions::closeGroup(group_id);
+ }
+ else
+ {
+ LL_WARNS() << "processAgentDropGroup, agent is not part of group " << group_id << LL_ENDL;
+ }
}
class LLAgentDropGroupViewerNode : public LLHTTPNode
{
- virtual void post(
- LLHTTPNode::ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
-
- if (
- !input.isMap() ||
- !input.has("body") )
- {
- //what to do with badly formed message?
- response->extendedResult(HTTP_BAD_REQUEST, LLSD("Invalid message parameters"));
- }
-
- LLSD body = input["body"];
- if ( body.has("body") )
- {
- //stupid message system doubles up the "body"s
- body = body["body"];
- }
-
- if (
- body.has("AgentData") &&
- body["AgentData"].isArray() &&
- body["AgentData"][0].isMap() )
- {
- LL_INFOS() << "VALID DROP GROUP" << LL_ENDL;
-
- //there is only one set of data in the AgentData block
- LLSD agent_data = body["AgentData"][0];
- LLUUID agent_id;
- LLUUID group_id;
-
- agent_id = agent_data["AgentID"].asUUID();
- group_id = agent_data["GroupID"].asUUID();
-
- if (agent_id != gAgentID)
- {
- LL_WARNS()
- << "AgentDropGroup for agent other than me" << LL_ENDL;
-
- response->notFound();
- return;
- }
-
- // Remove the group if it already exists remove it
- // and add the new data to pick up changes.
- LLGroupData gd;
- gd.mID = group_id;
- std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
- if (found_it != gAgent.mGroups.end())
- {
- gAgent.mGroups.erase(found_it);
- if (gAgent.getGroupID() == group_id)
- {
- gAgent.mGroupID.setNull();
- gAgent.mGroupPowers = 0;
- gAgent.mGroupName.clear();
- gAgent.mGroupTitle.clear();
- }
-
- // refresh all group information
- gAgent.sendAgentDataUpdateRequest();
-
- LLGroupMgr::getInstance()->clearGroupData(group_id);
- // close the floater for this group, if any.
- LLGroupActions::closeGroup(group_id);
- }
- else
- {
- LL_WARNS()
- << "AgentDropGroup, agent is not part of group "
- << group_id << LL_ENDL;
- }
-
- response->result(LLSD());
- }
- else
- {
- //what to do with badly formed message?
- response->extendedResult(HTTP_BAD_REQUEST, LLSD("Invalid message parameters"));
- }
- }
+ virtual void post(
+ LLHTTPNode::ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+
+ if (
+ !input.isMap() ||
+ !input.has("body") )
+ {
+ //what to do with badly formed message?
+ response->extendedResult(HTTP_BAD_REQUEST, LLSD("Invalid message parameters"));
+ }
+
+ LLSD body = input["body"];
+ if ( body.has("body") )
+ {
+ //stupid message system doubles up the "body"s
+ body = body["body"];
+ }
+
+ if (
+ body.has("AgentData") &&
+ body["AgentData"].isArray() &&
+ body["AgentData"][0].isMap() )
+ {
+ LL_INFOS() << "VALID DROP GROUP" << LL_ENDL;
+
+ //there is only one set of data in the AgentData block
+ LLSD agent_data = body["AgentData"][0];
+ LLUUID agent_id;
+ LLUUID group_id;
+
+ agent_id = agent_data["AgentID"].asUUID();
+ group_id = agent_data["GroupID"].asUUID();
+
+ if (agent_id != gAgentID)
+ {
+ LL_WARNS()
+ << "AgentDropGroup for agent other than me" << LL_ENDL;
+
+ response->notFound();
+ return;
+ }
+
+ // Remove the group if it already exists remove it
+ // and add the new data to pick up changes.
+ LLGroupData gd;
+ gd.mID = group_id;
+ std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
+ if (found_it != gAgent.mGroups.end())
+ {
+ gAgent.mGroups.erase(found_it);
+ if (gAgent.getGroupID() == group_id)
+ {
+ gAgent.mGroupID.setNull();
+ gAgent.mGroupPowers = 0;
+ gAgent.mGroupName.clear();
+ gAgent.mGroupTitle.clear();
+ }
+
+ // refresh all group information
+ gAgent.sendAgentDataUpdateRequest();
+
+ LLGroupMgr::getInstance()->clearGroupData(group_id);
+ // close the floater for this group, if any.
+ LLGroupActions::closeGroup(group_id);
+ }
+ else
+ {
+ LL_WARNS()
+ << "AgentDropGroup, agent is not part of group "
+ << group_id << LL_ENDL;
+ }
+
+ response->result(LLSD());
+ }
+ else
+ {
+ //what to do with badly formed message?
+ response->extendedResult(HTTP_BAD_REQUEST, LLSD("Invalid message parameters"));
+ }
+ }
};
LLHTTPRegistration<LLAgentDropGroupViewerNode>
- gHTTPRegistrationAgentDropGroupViewerNode(
- "/message/AgentDropGroup");
+ gHTTPRegistrationAgentDropGroupViewerNode(
+ "/message/AgentDropGroup");
// static
void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **)
{
- LLUUID agent_id;
-
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
-
- if (agent_id != gAgentID)
- {
- LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL;
- return;
- }
-
- S32 count = msg->getNumberOfBlocksFast(_PREHASH_GroupData);
- LLGroupData group;
- bool need_floater_update = false;
- for(S32 i = 0; i < count; ++i)
- {
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group.mID, i);
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupInsigniaID, group.mInsigniaID, i);
- msg->getU64(_PREHASH_GroupData, "GroupPowers", group.mPowers, i);
- msg->getBOOL(_PREHASH_GroupData, "AcceptNotices", group.mAcceptNotices, i);
- msg->getS32(_PREHASH_GroupData, "Contribution", group.mContribution, i);
- msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group.mName, i);
-
- if(group.mID.notNull())
- {
- need_floater_update = true;
- // Remove the group if it already exists remove it and add the new data to pick up changes.
- std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
- if (found_it != gAgent.mGroups.end())
- {
- gAgent.mGroups.erase(found_it);
- }
- gAgent.mGroups.push_back(group);
- }
- if (need_floater_update)
- {
- update_group_floaters(group.mID);
- }
- }
+ LLUUID agent_id;
+
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+
+ if (agent_id != gAgentID)
+ {
+ LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL;
+ return;
+ }
+
+ S32 count = msg->getNumberOfBlocksFast(_PREHASH_GroupData);
+ LLGroupData group;
+ bool need_floater_update = false;
+ for(S32 i = 0; i < count; ++i)
+ {
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group.mID, i);
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupInsigniaID, group.mInsigniaID, i);
+ msg->getU64(_PREHASH_GroupData, "GroupPowers", group.mPowers, i);
+ msg->getBOOL(_PREHASH_GroupData, "AcceptNotices", group.mAcceptNotices, i);
+ msg->getS32(_PREHASH_GroupData, "Contribution", group.mContribution, i);
+ msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group.mName, i);
+
+ if(group.mID.notNull())
+ {
+ need_floater_update = true;
+ // Remove the group if it already exists remove it and add the new data to pick up changes.
+ std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
+ if (found_it != gAgent.mGroups.end())
+ {
+ gAgent.mGroups.erase(found_it);
+ }
+ gAgent.mGroups.push_back(group);
+ }
+ if (need_floater_update)
+ {
+ update_group_floaters(group.mID);
+ }
+ }
}
class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode
{
- virtual void post(
- LLHTTPNode::ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- LLSD body = input["body"];
- if(body.has("body"))
- body = body["body"];
- LLUUID agent_id = body["AgentData"][0]["AgentID"].asUUID();
-
- if (agent_id != gAgentID)
- {
- LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL;
- return;
- }
-
- LLSD group_data = body["GroupData"];
-
- LLSD::array_iterator iter_group =
- group_data.beginArray();
- LLSD::array_iterator end_group =
- group_data.endArray();
- int group_index = 0;
- for(; iter_group != end_group; ++iter_group)
- {
-
- LLGroupData group;
- bool need_floater_update = false;
-
- group.mID = (*iter_group)["GroupID"].asUUID();
- group.mPowers = ll_U64_from_sd((*iter_group)["GroupPowers"]);
- group.mAcceptNotices = (*iter_group)["AcceptNotices"].asBoolean();
- group.mListInProfile = body["NewGroupData"][group_index]["ListInProfile"].asBoolean();
- group.mInsigniaID = (*iter_group)["GroupInsigniaID"].asUUID();
- group.mName = (*iter_group)["GroupName"].asString();
- group.mContribution = (*iter_group)["Contribution"].asInteger();
-
- group_index++;
-
- if(group.mID.notNull())
- {
- need_floater_update = true;
- // Remove the group if it already exists remove it and add the new data to pick up changes.
- std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
- if (found_it != gAgent.mGroups.end())
- {
- gAgent.mGroups.erase(found_it);
- }
- gAgent.mGroups.push_back(group);
- }
- if (need_floater_update)
- {
- update_group_floaters(group.mID);
- }
- }
- }
+ virtual void post(
+ LLHTTPNode::ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LLSD body = input["body"];
+ if(body.has("body"))
+ body = body["body"];
+ LLUUID agent_id = body["AgentData"][0]["AgentID"].asUUID();
+
+ if (agent_id != gAgentID)
+ {
+ LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL;
+ return;
+ }
+
+ LLSD group_data = body["GroupData"];
+
+ LLSD::array_iterator iter_group =
+ group_data.beginArray();
+ LLSD::array_iterator end_group =
+ group_data.endArray();
+ int group_index = 0;
+ for(; iter_group != end_group; ++iter_group)
+ {
+
+ LLGroupData group;
+ bool need_floater_update = false;
+
+ group.mID = (*iter_group)["GroupID"].asUUID();
+ group.mPowers = ll_U64_from_sd((*iter_group)["GroupPowers"]);
+ group.mAcceptNotices = (*iter_group)["AcceptNotices"].asBoolean();
+ group.mListInProfile = body["NewGroupData"][group_index]["ListInProfile"].asBoolean();
+ group.mInsigniaID = (*iter_group)["GroupInsigniaID"].asUUID();
+ group.mName = (*iter_group)["GroupName"].asString();
+ group.mContribution = (*iter_group)["Contribution"].asInteger();
+
+ group_index++;
+
+ if(group.mID.notNull())
+ {
+ need_floater_update = true;
+ // Remove the group if it already exists remove it and add the new data to pick up changes.
+ std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
+ if (found_it != gAgent.mGroups.end())
+ {
+ gAgent.mGroups.erase(found_it);
+ }
+ gAgent.mGroups.push_back(group);
+ }
+ if (need_floater_update)
+ {
+ update_group_floaters(group.mID);
+ }
+ }
+ }
};
LLHTTPRegistration<LLAgentGroupDataUpdateViewerNode >
- gHTTPRegistrationAgentGroupDataUpdateViewerNode ("/message/AgentGroupDataUpdate");
+ gHTTPRegistrationAgentGroupDataUpdateViewerNode ("/message/AgentGroupDataUpdate");
// static
void LLAgent::processAgentDataUpdate(LLMessageSystem *msg, void **)
{
- LLUUID agent_id;
+ LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- if (agent_id != gAgentID)
- {
- LL_WARNS() << "processAgentDataUpdate for agent other than me" << LL_ENDL;
- return;
- }
+ if (agent_id != gAgentID)
+ {
+ LL_WARNS() << "processAgentDataUpdate for agent other than me" << LL_ENDL;
+ return;
+ }
- msg->getStringFast(_PREHASH_AgentData, _PREHASH_GroupTitle, gAgent.mGroupTitle);
- LLUUID active_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_ActiveGroupID, active_id);
+ msg->getStringFast(_PREHASH_AgentData, _PREHASH_GroupTitle, gAgent.mGroupTitle);
+ LLUUID active_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_ActiveGroupID, active_id);
- if(active_id.notNull())
- {
- gAgent.mGroupID = active_id;
- msg->getU64(_PREHASH_AgentData, "GroupPowers", gAgent.mGroupPowers);
- msg->getString(_PREHASH_AgentData, _PREHASH_GroupName, gAgent.mGroupName);
- }
- else
- {
- gAgent.mGroupID.setNull();
- gAgent.mGroupPowers = 0;
- gAgent.mGroupName.clear();
- }
+ if(active_id.notNull())
+ {
+ gAgent.mGroupID = active_id;
+ msg->getU64(_PREHASH_AgentData, "GroupPowers", gAgent.mGroupPowers);
+ msg->getString(_PREHASH_AgentData, _PREHASH_GroupName, gAgent.mGroupName);
+ }
+ else
+ {
+ gAgent.mGroupID.setNull();
+ gAgent.mGroupPowers = 0;
+ gAgent.mGroupName.clear();
+ }
- update_group_floaters(active_id);
+ update_group_floaters(active_id);
}
// static
void LLAgent::processScriptControlChange(LLMessageSystem *msg, void **)
{
- S32 block_count = msg->getNumberOfBlocks("Data");
- for (S32 block_index = 0; block_index < block_count; block_index++)
- {
- BOOL take_controls;
- U32 controls;
- BOOL passon;
- U32 i;
- msg->getBOOL("Data", "TakeControls", take_controls, block_index);
- if (take_controls)
- {
- // take controls
- msg->getU32("Data", "Controls", controls, block_index );
- msg->getBOOL("Data", "PassToAgent", passon, block_index );
- for (i = 0; i < TOTAL_CONTROLS; i++)
- {
- if (controls & ( 1 << i))
- {
- if (passon)
- {
- gAgent.mControlsTakenPassedOnCount[i]++;
- }
- else
- {
- gAgent.mControlsTakenCount[i]++;
- }
- }
- }
- }
- else
- {
- // release controls
- msg->getU32("Data", "Controls", controls, block_index );
- msg->getBOOL("Data", "PassToAgent", passon, block_index );
- for (i = 0; i < TOTAL_CONTROLS; i++)
- {
- if (controls & ( 1 << i))
- {
- if (passon)
- {
- gAgent.mControlsTakenPassedOnCount[i]--;
- if (gAgent.mControlsTakenPassedOnCount[i] < 0)
- {
- gAgent.mControlsTakenPassedOnCount[i] = 0;
- }
- }
- else
- {
- gAgent.mControlsTakenCount[i]--;
- if (gAgent.mControlsTakenCount[i] < 0)
- {
- gAgent.mControlsTakenCount[i] = 0;
- }
- }
- }
- }
- }
- }
+ S32 block_count = msg->getNumberOfBlocks("Data");
+ for (S32 block_index = 0; block_index < block_count; block_index++)
+ {
+ BOOL take_controls;
+ U32 controls;
+ BOOL passon;
+ U32 i;
+ msg->getBOOL("Data", "TakeControls", take_controls, block_index);
+ if (take_controls)
+ {
+ // take controls
+ msg->getU32("Data", "Controls", controls, block_index );
+ msg->getBOOL("Data", "PassToAgent", passon, block_index );
+ for (i = 0; i < TOTAL_CONTROLS; i++)
+ {
+ if (controls & ( 1 << i))
+ {
+ if (passon)
+ {
+ gAgent.mControlsTakenPassedOnCount[i]++;
+ }
+ else
+ {
+ gAgent.mControlsTakenCount[i]++;
+ }
+ }
+ }
+ }
+ else
+ {
+ // release controls
+ msg->getU32("Data", "Controls", controls, block_index );
+ msg->getBOOL("Data", "PassToAgent", passon, block_index );
+ for (i = 0; i < TOTAL_CONTROLS; i++)
+ {
+ if (controls & ( 1 << i))
+ {
+ if (passon)
+ {
+ gAgent.mControlsTakenPassedOnCount[i]--;
+ if (gAgent.mControlsTakenPassedOnCount[i] < 0)
+ {
+ gAgent.mControlsTakenPassedOnCount[i] = 0;
+ }
+ }
+ else
+ {
+ gAgent.mControlsTakenCount[i]--;
+ if (gAgent.mControlsTakenCount[i] < 0)
+ {
+ gAgent.mControlsTakenCount[i] = 0;
+ }
+ }
+ }
+ }
+ }
+ }
}
/*
// static
void LLAgent::processControlTake(LLMessageSystem *msg, void **)
{
- U32 controls;
- msg->getU32("Data", "Controls", controls );
- U32 passon;
- msg->getBOOL("Data", "PassToAgent", passon );
-
- S32 i;
- S32 total_count = 0;
- for (i = 0; i < TOTAL_CONTROLS; i++)
- {
- if (controls & ( 1 << i))
- {
- if (passon)
- {
- gAgent.mControlsTakenPassedOnCount[i]++;
- }
- else
- {
- gAgent.mControlsTakenCount[i]++;
- }
- total_count++;
- }
- }
-
- // Any control taken? If so, might be first time.
- if (total_count > 0)
- {
- LLFirstUse::useOverrideKeys();
- }
+ U32 controls;
+ msg->getU32("Data", "Controls", controls );
+ U32 passon;
+ msg->getBOOL("Data", "PassToAgent", passon );
+
+ S32 i;
+ S32 total_count = 0;
+ for (i = 0; i < TOTAL_CONTROLS; i++)
+ {
+ if (controls & ( 1 << i))
+ {
+ if (passon)
+ {
+ gAgent.mControlsTakenPassedOnCount[i]++;
+ }
+ else
+ {
+ gAgent.mControlsTakenCount[i]++;
+ }
+ total_count++;
+ }
+ }
+
+ // Any control taken? If so, might be first time.
+ if (total_count > 0)
+ {
+ LLFirstUse::useOverrideKeys();
+ }
}
// static
void LLAgent::processControlRelease(LLMessageSystem *msg, void **)
{
- U32 controls;
- msg->getU32("Data", "Controls", controls );
- U32 passon;
- msg->getBOOL("Data", "PassToAgent", passon );
-
- S32 i;
- for (i = 0; i < TOTAL_CONTROLS; i++)
- {
- if (controls & ( 1 << i))
- {
- if (passon)
- {
- gAgent.mControlsTakenPassedOnCount[i]--;
- if (gAgent.mControlsTakenPassedOnCount[i] < 0)
- {
- gAgent.mControlsTakenPassedOnCount[i] = 0;
- }
- }
- else
- {
- gAgent.mControlsTakenCount[i]--;
- if (gAgent.mControlsTakenCount[i] < 0)
- {
- gAgent.mControlsTakenCount[i] = 0;
- }
- }
- }
- }
+ U32 controls;
+ msg->getU32("Data", "Controls", controls );
+ U32 passon;
+ msg->getBOOL("Data", "PassToAgent", passon );
+
+ S32 i;
+ for (i = 0; i < TOTAL_CONTROLS; i++)
+ {
+ if (controls & ( 1 << i))
+ {
+ if (passon)
+ {
+ gAgent.mControlsTakenPassedOnCount[i]--;
+ if (gAgent.mControlsTakenPassedOnCount[i] < 0)
+ {
+ gAgent.mControlsTakenPassedOnCount[i] = 0;
+ }
+ }
+ else
+ {
+ gAgent.mControlsTakenCount[i]--;
+ if (gAgent.mControlsTakenCount[i] < 0)
+ {
+ gAgent.mControlsTakenCount[i] = 0;
+ }
+ }
+ }
+ }
}
*/
BOOL LLAgent::anyControlGrabbed() const
{
- for (U32 i = 0; i < TOTAL_CONTROLS; i++)
- {
- if (gAgent.mControlsTakenCount[i] > 0)
- return TRUE;
- if (gAgent.mControlsTakenPassedOnCount[i] > 0)
- return TRUE;
- }
- return FALSE;
+ for (U32 i = 0; i < TOTAL_CONTROLS; i++)
+ {
+ if (gAgent.mControlsTakenCount[i] > 0)
+ return TRUE;
+ if (gAgent.mControlsTakenPassedOnCount[i] > 0)
+ return TRUE;
+ }
+ return FALSE;
}
BOOL LLAgent::isControlGrabbed(S32 control_index) const
{
- return mControlsTakenCount[control_index] > 0;
+ return mControlsTakenCount[control_index] > 0;
}
void LLAgent::forceReleaseControls()
{
- gMessageSystem->newMessage("ForceScriptControlRelease");
- gMessageSystem->nextBlock("AgentData");
- gMessageSystem->addUUID("AgentID", getID());
- gMessageSystem->addUUID("SessionID", getSessionID());
- sendReliableMessage();
+ gMessageSystem->newMessage("ForceScriptControlRelease");
+ gMessageSystem->nextBlock("AgentData");
+ gMessageSystem->addUUID("AgentID", getID());
+ gMessageSystem->addUUID("SessionID", getSessionID());
+ sendReliableMessage();
}
void LLAgent::setHomePosRegion( const U64& region_handle, const LLVector3& pos_region)
{
- mHaveHomePosition = TRUE;
- mHomeRegionHandle = region_handle;
- mHomePosRegion = pos_region;
+ mHaveHomePosition = TRUE;
+ mHomeRegionHandle = region_handle;
+ mHomePosRegion = pos_region;
}
BOOL LLAgent::getHomePosGlobal( LLVector3d* pos_global )
{
- if(!mHaveHomePosition)
- {
- return FALSE;
- }
- F32 x = 0;
- F32 y = 0;
- from_region_handle( mHomeRegionHandle, &x, &y);
- pos_global->setVec( x + mHomePosRegion.mV[VX], y + mHomePosRegion.mV[VY], mHomePosRegion.mV[VZ] );
- return TRUE;
+ if(!mHaveHomePosition)
+ {
+ return FALSE;
+ }
+ F32 x = 0;
+ F32 y = 0;
+ from_region_handle( mHomeRegionHandle, &x, &y);
+ pos_global->setVec( x + mHomePosRegion.mV[VX], y + mHomePosRegion.mV[VY], mHomePosRegion.mV[VZ] );
+ return TRUE;
}
bool LLAgent::isInHomeRegion()
{
- if(!mHaveHomePosition)
- {
- return false;
- }
- if (!getRegion())
- {
- return false;
- }
- if (getRegion()->getHandle() != mHomeRegionHandle)
- {
- return false;
- }
- return true;
+ if(!mHaveHomePosition)
+ {
+ return false;
+ }
+ if (!getRegion())
+ {
+ return false;
+ }
+ if (getRegion()->getHandle() != mHomeRegionHandle)
+ {
+ return false;
+ }
+ return true;
}
void LLAgent::clearVisualParams(void *data)
{
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->clearVisualParamWeights();
- gAgentAvatarp->updateVisualParams();
- }
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->clearVisualParamWeights();
+ gAgentAvatarp->updateVisualParams();
+ }
}
//---------------------------------------------------------------------------
@@ -4019,29 +4019,29 @@ void LLAgent::clearVisualParams(void *data)
bool LLAgent::teleportCore(bool is_local)
{
LL_DEBUGS("Teleport") << "In teleport core" << LL_ENDL;
- if ((TELEPORT_NONE != mTeleportState) && (mTeleportState != TELEPORT_PENDING))
- {
- LL_WARNS() << "Attempt to teleport when already teleporting." << LL_ENDL;
- return false;
- }
-
- // force stand up and stop a sitting animation (if any), see MAINT-3969
- if (isAgentAvatarValid() && gAgentAvatarp->getParent() && gAgentAvatarp->isSitting())
- {
- gAgentAvatarp->getOffObject();
- }
+ if ((TELEPORT_NONE != mTeleportState) && (mTeleportState != TELEPORT_PENDING))
+ {
+ LL_WARNS() << "Attempt to teleport when already teleporting." << LL_ENDL;
+ return false;
+ }
+
+ // force stand up and stop a sitting animation (if any), see MAINT-3969
+ if (isAgentAvatarValid() && gAgentAvatarp->getParent() && gAgentAvatarp->isSitting())
+ {
+ gAgentAvatarp->getOffObject();
+ }
#if 0
- // This should not exist. It has been added, removed, added, and now removed again.
- // This change needs to come from the simulator. Otherwise, the agent ends up out of
- // sync with other viewers. Discuss in DEV-14145/VWR-6744 before reenabling.
+ // This should not exist. It has been added, removed, added, and now removed again.
+ // This change needs to come from the simulator. Otherwise, the agent ends up out of
+ // sync with other viewers. Discuss in DEV-14145/VWR-6744 before reenabling.
- // Stop all animation before actual teleporting
+ // Stop all animation before actual teleporting
if (isAgentAvatarValid())
- {
- for ( LLVOAvatar::AnimIterator anim_it= gAgentAvatarp->mPlayingAnimations.begin();
- anim_it != gAgentAvatarp->mPlayingAnimations.end();
- ++anim_it)
+ {
+ for ( LLVOAvatar::AnimIterator anim_it= gAgentAvatarp->mPlayingAnimations.begin();
+ anim_it != gAgentAvatarp->mPlayingAnimations.end();
+ ++anim_it)
{
gAgentAvatarp->stopMotion(anim_it->first);
}
@@ -4049,59 +4049,59 @@ bool LLAgent::teleportCore(bool is_local)
}
#endif
- // Don't call LLFirstUse::useTeleport because we don't know
- // yet if the teleport will succeed. Look in
- // process_teleport_location_reply
-
- // hide land floater too - it'll be out of date
- LLFloaterReg::hideInstance("about_land");
-
- // hide the Region/Estate floater
- LLFloaterReg::hideInstance("region_info");
-
- LLViewerParcelMgr::getInstance()->deselectLand();
- LLViewerMediaFocus::getInstance()->clearFocus();
-
- // Close all pie menus, deselect land, etc.
- // Don't change the camera until we know teleport succeeded. JC
- gAgentCamera.resetView(FALSE);
-
- // local logic
- add(LLStatViewer::TELEPORT, 1);
- if (is_local)
- {
- LL_INFOS("Teleport") << "Setting teleport state to TELEPORT_LOCAL" << LL_ENDL;
- gAgent.setTeleportState( LLAgent::TELEPORT_LOCAL );
- }
- else
- {
- gTeleportDisplay = TRUE;
- LL_INFOS("Teleport") << "Non-local, setting teleport state to TELEPORT_START" << LL_ENDL;
- gAgent.setTeleportState( LLAgent::TELEPORT_START );
- }
- make_ui_sound("UISndTeleportOut");
-
- // MBW -- Let the voice client know a teleport has begun so it can leave the existing channel.
- // This was breaking the case of teleporting within a single sim. Backing it out for now.
-// LLVoiceClient::getInstance()->leaveChannel();
-
- return true;
+ // Don't call LLFirstUse::useTeleport because we don't know
+ // yet if the teleport will succeed. Look in
+ // process_teleport_location_reply
+
+ // hide land floater too - it'll be out of date
+ LLFloaterReg::hideInstance("about_land");
+
+ // hide the Region/Estate floater
+ LLFloaterReg::hideInstance("region_info");
+
+ LLViewerParcelMgr::getInstance()->deselectLand();
+ LLViewerMediaFocus::getInstance()->clearFocus();
+
+ // Close all pie menus, deselect land, etc.
+ // Don't change the camera until we know teleport succeeded. JC
+ gAgentCamera.resetView(FALSE);
+
+ // local logic
+ add(LLStatViewer::TELEPORT, 1);
+ if (is_local)
+ {
+ LL_INFOS("Teleport") << "Setting teleport state to TELEPORT_LOCAL" << LL_ENDL;
+ gAgent.setTeleportState( LLAgent::TELEPORT_LOCAL );
+ }
+ else
+ {
+ gTeleportDisplay = TRUE;
+ LL_INFOS("Teleport") << "Non-local, setting teleport state to TELEPORT_START" << LL_ENDL;
+ gAgent.setTeleportState( LLAgent::TELEPORT_START );
+ }
+ make_ui_sound("UISndTeleportOut");
+
+ // MBW -- Let the voice client know a teleport has begun so it can leave the existing channel.
+ // This was breaking the case of teleporting within a single sim. Backing it out for now.
+// LLVoiceClient::getInstance()->leaveChannel();
+
+ return true;
}
bool LLAgent::hasRestartableFailedTeleportRequest()
{
- return ((mTeleportRequest != NULL) && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed) &&
- mTeleportRequest->canRestartTeleport());
+ return ((mTeleportRequest != NULL) && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed) &&
+ mTeleportRequest->canRestartTeleport());
}
void LLAgent::restartFailedTeleportRequest()
{
LL_INFOS("Teleport") << "Agent wishes to restart failed teleport." << LL_ENDL;
- if (hasRestartableFailedTeleportRequest())
- {
- mTeleportRequest->setStatus(LLTeleportRequest::kRestartPending);
- startTeleportRequest();
- }
+ if (hasRestartableFailedTeleportRequest())
+ {
+ mTeleportRequest->setStatus(LLTeleportRequest::kRestartPending);
+ startTeleportRequest();
+ }
}
void LLAgent::clearTeleportRequest()
@@ -4110,14 +4110,14 @@ void LLAgent::clearTeleportRequest()
{
LLVoiceClient::getInstance()->setHidden(FALSE);
}
- mTeleportRequest.reset();
+ mTeleportRequest.reset();
mTPNeedsNeabyChatSeparator = false;
}
void LLAgent::setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange)
{
- mIsMaturityRatingChangingDuringTeleport = true;
- mMaturityRatingChange = pMaturityRatingChange;
+ mIsMaturityRatingChangingDuringTeleport = true;
+ mMaturityRatingChange = pMaturityRatingChange;
}
void LLAgent::sheduleTeleportIM()
@@ -4128,9 +4128,9 @@ void LLAgent::sheduleTeleportIM()
bool LLAgent::hasPendingTeleportRequest()
{
- return ((mTeleportRequest != NULL) &&
- ((mTeleportRequest->getStatus() == LLTeleportRequest::kPending) ||
- (mTeleportRequest->getStatus() == LLTeleportRequest::kRestartPending)));
+ return ((mTeleportRequest != NULL) &&
+ ((mTeleportRequest->getStatus() == LLTeleportRequest::kPending) ||
+ (mTeleportRequest->getStatus() == LLTeleportRequest::kRestartPending)));
}
void LLAgent::startTeleportRequest()
@@ -4140,35 +4140,35 @@ void LLAgent::startTeleportRequest()
{
LLVoiceClient::getInstance()->setHidden(TRUE);
}
- if (hasPendingTeleportRequest())
- {
- LLUIUsage::instance().logCommand("Agent.StartTeleportRequest");
+ if (hasPendingTeleportRequest())
+ {
+ LLUIUsage::instance().logCommand("Agent.StartTeleportRequest");
mTeleportCanceled.reset();
- if (!isMaturityPreferenceSyncedWithServer())
- {
- gTeleportDisplay = TRUE;
- LL_INFOS("Teleport") << "Maturity preference not synced yet, setting teleport state to TELEPORT_PENDING" << LL_ENDL;
- setTeleportState(TELEPORT_PENDING);
- }
- else
- {
- switch (mTeleportRequest->getStatus())
- {
- case LLTeleportRequest::kPending :
- mTeleportRequest->setStatus(LLTeleportRequest::kStarted);
- mTeleportRequest->startTeleport();
- break;
- case LLTeleportRequest::kRestartPending :
- llassert(mTeleportRequest->canRestartTeleport());
- mTeleportRequest->setStatus(LLTeleportRequest::kStarted);
- mTeleportRequest->restartTeleport();
- break;
- default :
- llassert(0);
- break;
- }
- }
- }
+ if (!isMaturityPreferenceSyncedWithServer())
+ {
+ gTeleportDisplay = TRUE;
+ LL_INFOS("Teleport") << "Maturity preference not synced yet, setting teleport state to TELEPORT_PENDING" << LL_ENDL;
+ setTeleportState(TELEPORT_PENDING);
+ }
+ else
+ {
+ switch (mTeleportRequest->getStatus())
+ {
+ case LLTeleportRequest::kPending :
+ mTeleportRequest->setStatus(LLTeleportRequest::kStarted);
+ mTeleportRequest->startTeleport();
+ break;
+ case LLTeleportRequest::kRestartPending :
+ llassert(mTeleportRequest->canRestartTeleport());
+ mTeleportRequest->setStatus(LLTeleportRequest::kStarted);
+ mTeleportRequest->restartTeleport();
+ break;
+ default :
+ llassert(0);
+ break;
+ }
+ }
+ }
}
void LLAgent::handleTeleportFinished()
@@ -4180,36 +4180,36 @@ void LLAgent::handleTeleportFinished()
addTPNearbyChatSeparator();
mTPNeedsNeabyChatSeparator = false;
}
- clearTeleportRequest();
+ clearTeleportRequest();
mTeleportCanceled.reset();
- if (mIsMaturityRatingChangingDuringTeleport)
- {
- // notify user that the maturity preference has been changed
- std::string maturityRating = LLViewerRegion::accessToString(mMaturityRatingChange);
- LLStringUtil::toLower(maturityRating);
- LLSD args;
- args["RATING"] = maturityRating;
- LLNotificationsUtil::add("PreferredMaturityChanged", args);
- mIsMaturityRatingChangingDuringTeleport = false;
- }
-
+ if (mIsMaturityRatingChangingDuringTeleport)
+ {
+ // notify user that the maturity preference has been changed
+ std::string maturityRating = LLViewerRegion::accessToString(mMaturityRatingChange);
+ LLStringUtil::toLower(maturityRating);
+ LLSD args;
+ args["RATING"] = maturityRating;
+ LLNotificationsUtil::add("PreferredMaturityChanged", args);
+ mIsMaturityRatingChangingDuringTeleport = false;
+ }
+
if (mRegionp)
{
if (mRegionp->capabilitiesReceived())
{
- LL_DEBUGS("Teleport") << "capabilities have been received for region handle "
- << mRegionp->getHandle()
- << " id " << mRegionp->getRegionID()
- << ", calling onCapabilitiesReceivedAfterTeleport()"
- << LL_ENDL;
+ LL_DEBUGS("Teleport") << "capabilities have been received for region handle "
+ << mRegionp->getHandle()
+ << " id " << mRegionp->getRegionID()
+ << ", calling onCapabilitiesReceivedAfterTeleport()"
+ << LL_ENDL;
onCapabilitiesReceivedAfterTeleport();
}
else
{
- LL_DEBUGS("Teleport") << "Capabilities not yet received for region handle "
- << mRegionp->getHandle()
- << " id " << mRegionp->getRegionID()
- << LL_ENDL;
+ LL_DEBUGS("Teleport") << "Capabilities not yet received for region handle "
+ << mRegionp->getHandle()
+ << " id " << mRegionp->getRegionID()
+ << LL_ENDL;
mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::onCapabilitiesReceivedAfterTeleport));
}
}
@@ -4230,19 +4230,19 @@ void LLAgent::handleTeleportFailed()
// gTeleportDisplay = FALSE;
if (mTeleportRequest)
- {
- mTeleportRequest->setStatus(LLTeleportRequest::kFailed);
- }
- if (mIsMaturityRatingChangingDuringTeleport)
- {
- // notify user that the maturity preference has been changed
- std::string maturityRating = LLViewerRegion::accessToString(mMaturityRatingChange);
- LLStringUtil::toLower(maturityRating);
- LLSD args;
- args["RATING"] = maturityRating;
- LLNotificationsUtil::add("PreferredMaturityChanged", args);
- mIsMaturityRatingChangingDuringTeleport = false;
- }
+ {
+ mTeleportRequest->setStatus(LLTeleportRequest::kFailed);
+ }
+ if (mIsMaturityRatingChangingDuringTeleport)
+ {
+ // notify user that the maturity preference has been changed
+ std::string maturityRating = LLViewerRegion::accessToString(mMaturityRatingChange);
+ LLStringUtil::toLower(maturityRating);
+ LLSD args;
+ args["RATING"] = maturityRating;
+ LLNotificationsUtil::add("PreferredMaturityChanged", args);
+ mIsMaturityRatingChangingDuringTeleport = false;
+ }
mTPNeedsNeabyChatSeparator = false;
@@ -4288,49 +4288,49 @@ void LLAgent::addTPNearbyChatSeparator()
/*static*/
void LLAgent::onCapabilitiesReceivedAfterTeleport()
{
- if (gAgent.getRegion())
- {
- LL_DEBUGS("Teleport") << "running after capabilities received callback has been triggered, agent region "
- << gAgent.getRegion()->getHandle()
- << " id " << gAgent.getRegion()->getRegionID()
- << " name " << gAgent.getRegion()->getName()
- << LL_ENDL;
- }
- else
- {
- LL_WARNS("Teleport") << "called when agent region is null!" << LL_ENDL;
- }
+ if (gAgent.getRegion())
+ {
+ LL_DEBUGS("Teleport") << "running after capabilities received callback has been triggered, agent region "
+ << gAgent.getRegion()->getHandle()
+ << " id " << gAgent.getRegion()->getRegionID()
+ << " name " << gAgent.getRegion()->getName()
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Teleport") << "called when agent region is null!" << LL_ENDL;
+ }
check_merchant_status();
}
void LLAgent::teleportRequest(
- const U64& region_handle,
- const LLVector3& pos_local,
- bool look_at_from_camera)
-{
- LLViewerRegion* regionp = getRegion();
- if (regionp && teleportCore(region_handle == regionp->getHandle()))
- {
- LL_INFOS("Teleport") << "Sending TeleportLocationRequest: '" << region_handle << "':"
- << pos_local << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("TeleportLocationRequest");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- msg->nextBlockFast(_PREHASH_Info);
- msg->addU64("RegionHandle", region_handle);
- msg->addVector3("Position", pos_local);
- LLVector3 look_at(0,1,0);
- if (look_at_from_camera)
- {
- look_at = LLViewerCamera::getInstance()->getAtAxis();
- }
- msg->addVector3("LookAt", look_at);
- sendReliableMessage();
- }
+ const U64& region_handle,
+ const LLVector3& pos_local,
+ bool look_at_from_camera)
+{
+ LLViewerRegion* regionp = getRegion();
+ if (regionp && teleportCore(region_handle == regionp->getHandle()))
+ {
+ LL_INFOS("Teleport") << "Sending TeleportLocationRequest: '" << region_handle << "':"
+ << pos_local << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("TeleportLocationRequest");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+ msg->nextBlockFast(_PREHASH_Info);
+ msg->addU64("RegionHandle", region_handle);
+ msg->addVector3("Position", pos_local);
+ LLVector3 look_at(0,1,0);
+ if (look_at_from_camera)
+ {
+ look_at = LLViewerCamera::getInstance()->getAtAxis();
+ }
+ msg->addVector3("LookAt", look_at);
+ sendReliableMessage();
+ }
}
// Landmark ID = LLUUID::null means teleport home
@@ -4340,100 +4340,100 @@ void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id)
{
gAgentCamera.resetView();
}
- mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLandmark(landmark_asset_id));
- startTeleportRequest();
+ mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLandmark(landmark_asset_id));
+ startTeleportRequest();
}
void LLAgent::doTeleportViaLandmark(const LLUUID& landmark_asset_id)
{
- LLViewerRegion *regionp = getRegion();
- if(regionp && teleportCore())
- {
- LL_INFOS("Teleport") << "Sending TeleportLandmarkRequest. Current region handle " << regionp->getHandle()
- << " region id " << regionp->getRegionID()
- << " requested landmark id " << landmark_asset_id
- << LL_ENDL;
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_TeleportLandmarkRequest);
- msg->nextBlockFast(_PREHASH_Info);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- msg->addUUIDFast(_PREHASH_LandmarkID, landmark_asset_id);
- sendReliableMessage();
- }
+ LLViewerRegion *regionp = getRegion();
+ if(regionp && teleportCore())
+ {
+ LL_INFOS("Teleport") << "Sending TeleportLandmarkRequest. Current region handle " << regionp->getHandle()
+ << " region id " << regionp->getRegionID()
+ << " requested landmark id " << landmark_asset_id
+ << LL_ENDL;
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_TeleportLandmarkRequest);
+ msg->nextBlockFast(_PREHASH_Info);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+ msg->addUUIDFast(_PREHASH_LandmarkID, landmark_asset_id);
+ sendReliableMessage();
+ }
}
void LLAgent::teleportViaLure(const LLUUID& lure_id, BOOL godlike)
{
- mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLure(lure_id, godlike));
- startTeleportRequest();
+ mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLure(lure_id, godlike));
+ startTeleportRequest();
}
void LLAgent::doTeleportViaLure(const LLUUID& lure_id, BOOL godlike)
{
- LLViewerRegion* regionp = getRegion();
- if(regionp && teleportCore())
- {
- U32 teleport_flags = 0x0;
- if (godlike)
- {
- teleport_flags |= TELEPORT_FLAGS_VIA_GODLIKE_LURE;
- teleport_flags |= TELEPORT_FLAGS_DISABLE_CANCEL;
- }
- else
- {
- teleport_flags |= TELEPORT_FLAGS_VIA_LURE;
- }
-
- LL_INFOS("Teleport") << "Sending TeleportLureRequest."
- << " Current region handle " << regionp->getHandle()
- << " region id " << regionp->getRegionID()
- << " lure id " << lure_id
- << LL_ENDL;
- // send the message
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_TeleportLureRequest);
- msg->nextBlockFast(_PREHASH_Info);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- msg->addUUIDFast(_PREHASH_LureID, lure_id);
- // teleport_flags is a legacy field, now derived sim-side:
- msg->addU32("TeleportFlags", teleport_flags);
- sendReliableMessage();
- }
+ LLViewerRegion* regionp = getRegion();
+ if(regionp && teleportCore())
+ {
+ U32 teleport_flags = 0x0;
+ if (godlike)
+ {
+ teleport_flags |= TELEPORT_FLAGS_VIA_GODLIKE_LURE;
+ teleport_flags |= TELEPORT_FLAGS_DISABLE_CANCEL;
+ }
+ else
+ {
+ teleport_flags |= TELEPORT_FLAGS_VIA_LURE;
+ }
+
+ LL_INFOS("Teleport") << "Sending TeleportLureRequest."
+ << " Current region handle " << regionp->getHandle()
+ << " region id " << regionp->getRegionID()
+ << " lure id " << lure_id
+ << LL_ENDL;
+ // send the message
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_TeleportLureRequest);
+ msg->nextBlockFast(_PREHASH_Info);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+ msg->addUUIDFast(_PREHASH_LureID, lure_id);
+ // teleport_flags is a legacy field, now derived sim-side:
+ msg->addU32("TeleportFlags", teleport_flags);
+ sendReliableMessage();
+ }
}
// James Cook, July 28, 2005
void LLAgent::teleportCancel()
{
- if (!hasPendingTeleportRequest())
- {
- LLViewerRegion* regionp = getRegion();
- if(regionp)
- {
- LL_INFOS("Teleport") << "Sending TeleportCancel" << LL_ENDL;
-
- // send the message
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("TeleportCancel");
- msg->nextBlockFast(_PREHASH_Info);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- sendReliableMessage();
- }
- mTeleportCanceled = mTeleportRequest;
- }
- clearTeleportRequest();
- gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
+ if (!hasPendingTeleportRequest())
+ {
+ LLViewerRegion* regionp = getRegion();
+ if(regionp)
+ {
+ LL_INFOS("Teleport") << "Sending TeleportCancel" << LL_ENDL;
+
+ // send the message
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("TeleportCancel");
+ msg->nextBlockFast(_PREHASH_Info);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+ sendReliableMessage();
+ }
+ mTeleportCanceled = mTeleportRequest;
+ }
+ clearTeleportRequest();
+ gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
}
void LLAgent::restoreCanceledTeleportRequest()
{
if (mTeleportCanceled != NULL)
{
- LL_INFOS() << "Restoring canceled teleport request, setting state to TELEPORT_REQUESTED" << LL_ENDL;
+ LL_INFOS() << "Restoring canceled teleport request, setting state to TELEPORT_REQUESTED" << LL_ENDL;
gAgent.setTeleportState( LLAgent::TELEPORT_REQUESTED );
mTeleportRequest = mTeleportCanceled;
mTeleportCanceled.reset();
@@ -4444,88 +4444,88 @@ void LLAgent::restoreCanceledTeleportRequest()
void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
{
- mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLocation(pos_global));
- startTeleportRequest();
+ mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLocation(pos_global));
+ startTeleportRequest();
}
void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global)
{
- LLViewerRegion* regionp = getRegion();
-
- if (!regionp)
- {
- return;
- }
-
- U64 handle = to_region_handle(pos_global);
- LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle);
- if(regionp && info)
- {
- LLVector3d region_origin = info->getGlobalOrigin();
- LLVector3 pos_local(
- (F32)(pos_global.mdV[VX] - region_origin.mdV[VX]),
- (F32)(pos_global.mdV[VY] - region_origin.mdV[VY]),
- (F32)(pos_global.mdV[VZ]));
- teleportRequest(handle, pos_local);
- }
- else if(regionp &&
- teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY])))
- {
- // send the message
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_TeleportLocationRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
-
- msg->nextBlockFast(_PREHASH_Info);
- F32 width = regionp->getWidth();
- LLVector3 pos(fmod((F32)pos_global.mdV[VX], width),
- fmod((F32)pos_global.mdV[VY], width),
- (F32)pos_global.mdV[VZ]);
- F32 region_x = (F32)(pos_global.mdV[VX]);
- F32 region_y = (F32)(pos_global.mdV[VY]);
- U64 region_handle = to_region_handle_global(region_x, region_y);
- msg->addU64Fast(_PREHASH_RegionHandle, region_handle);
- msg->addVector3Fast(_PREHASH_Position, pos);
- pos.mV[VX] += 1;
- msg->addVector3Fast(_PREHASH_LookAt, pos);
-
- LL_WARNS("Teleport") << "Sending deprecated(?) TeleportLocationRequest."
- << " pos_global " << pos_global
- << " region_x " << region_x
- << " region_y " << region_y
- << " region_handle " << region_handle
- << LL_ENDL;
-
- sendReliableMessage();
- }
-}
-
-// Teleport to global position, but keep facing in the same direction
+ LLViewerRegion* regionp = getRegion();
+
+ if (!regionp)
+ {
+ return;
+ }
+
+ U64 handle = to_region_handle(pos_global);
+ LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle);
+ if(regionp && info)
+ {
+ LLVector3d region_origin = info->getGlobalOrigin();
+ LLVector3 pos_local(
+ (F32)(pos_global.mdV[VX] - region_origin.mdV[VX]),
+ (F32)(pos_global.mdV[VY] - region_origin.mdV[VY]),
+ (F32)(pos_global.mdV[VZ]));
+ teleportRequest(handle, pos_local);
+ }
+ else if(regionp &&
+ teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY])))
+ {
+ // send the message
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_TeleportLocationRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+
+ msg->nextBlockFast(_PREHASH_Info);
+ F32 width = regionp->getWidth();
+ LLVector3 pos(fmod((F32)pos_global.mdV[VX], width),
+ fmod((F32)pos_global.mdV[VY], width),
+ (F32)pos_global.mdV[VZ]);
+ F32 region_x = (F32)(pos_global.mdV[VX]);
+ F32 region_y = (F32)(pos_global.mdV[VY]);
+ U64 region_handle = to_region_handle_global(region_x, region_y);
+ msg->addU64Fast(_PREHASH_RegionHandle, region_handle);
+ msg->addVector3Fast(_PREHASH_Position, pos);
+ pos.mV[VX] += 1;
+ msg->addVector3Fast(_PREHASH_LookAt, pos);
+
+ LL_WARNS("Teleport") << "Sending deprecated(?) TeleportLocationRequest."
+ << " pos_global " << pos_global
+ << " region_x " << region_x
+ << " region_y " << region_y
+ << " region_handle " << region_handle
+ << LL_ENDL;
+
+ sendReliableMessage();
+ }
+}
+
+// Teleport to global position, but keep facing in the same direction
void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global)
{
- mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLocationLookAt(pos_global));
- startTeleportRequest();
+ mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLocationLookAt(pos_global));
+ startTeleportRequest();
}
void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global)
{
- mbTeleportKeepsLookAt = true;
+ mbTeleportKeepsLookAt = true;
- if(!gAgentCamera.isfollowCamLocked())
- {
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction
- }
+ if(!gAgentCamera.isfollowCamLocked())
+ {
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction
+ }
- U64 region_handle = to_region_handle(pos_global);
- LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
- teleportRequest(region_handle, pos_local, getTeleportKeepsLookAt());
+ U64 region_handle = to_region_handle(pos_global);
+ LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
+ teleportRequest(region_handle, pos_local, getTeleportKeepsLookAt());
}
-LLAgent::ETeleportState LLAgent::getTeleportState() const
+LLAgent::ETeleportState LLAgent::getTeleportState() const
{
- return (mTeleportRequest && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed)) ?
+ return (mTeleportRequest && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed)) ?
TELEPORT_NONE : mTeleportState;
}
@@ -4533,45 +4533,45 @@ LLAgent::ETeleportState LLAgent::getTeleportState() const
void LLAgent::setTeleportState(ETeleportState state)
{
if (mTeleportRequest && (state != TELEPORT_NONE) && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed))
- { // A late message has come in regarding a failed teleport.
+ { // A late message has come in regarding a failed teleport.
// We have already decided that it failed so should not reinitiate the teleport sequence in the viewer.
LL_WARNS("Teleport") << "Attempt to set teleport state to " << state <<
" for previously failed teleport. Ignore!" << LL_ENDL;
return;
}
LL_DEBUGS("Teleport") << "Setting teleport state to "
- << LLAgent::teleportStateName(state) << "(" << state << ")"
- << " Previous state: "
- << teleportStateName(mTeleportState) << "(" << mTeleportState << ")"
- << LL_ENDL;
- mTeleportState = state;
- if (mTeleportState > TELEPORT_NONE && gSavedSettings.getBOOL("FreezeTime"))
- {
- LLFloaterReg::hideInstance("snapshot");
- }
+ << LLAgent::teleportStateName(state) << "(" << state << ")"
+ << " Previous state: "
+ << teleportStateName(mTeleportState) << "(" << mTeleportState << ")"
+ << LL_ENDL;
+ mTeleportState = state;
+ if (mTeleportState > TELEPORT_NONE && gSavedSettings.getBOOL("FreezeTime"))
+ {
+ LLFloaterReg::hideInstance("snapshot");
+ }
- switch (mTeleportState)
- {
- case TELEPORT_NONE:
- mbTeleportKeepsLookAt = false;
- break;
+ switch (mTeleportState)
+ {
+ case TELEPORT_NONE:
+ mbTeleportKeepsLookAt = false;
+ break;
- case TELEPORT_MOVING:
- // We're outa here. Save "back" slurl.
- LLAgentUI::buildSLURL(*mTeleportSourceSLURL);
- break;
+ case TELEPORT_MOVING:
+ // We're outa here. Save "back" slurl.
+ LLAgentUI::buildSLURL(*mTeleportSourceSLURL);
+ break;
- case TELEPORT_ARRIVING:
- // First two position updates after a teleport tend to be weird
- //LLViewerStats::getInstance()->mAgentPositionSnaps.mCountOfNextUpdatesToIgnore = 2;
+ case TELEPORT_ARRIVING:
+ // First two position updates after a teleport tend to be weird
+ //LLViewerStats::getInstance()->mAgentPositionSnaps.mCountOfNextUpdatesToIgnore = 2;
- // Let the interested parties know we've teleported.
- LLViewerParcelMgr::getInstance()->onTeleportFinished(false, getPositionGlobal());
- break;
+ // Let the interested parties know we've teleported.
+ LLViewerParcelMgr::getInstance()->onTeleportFinished(false, getPositionGlobal());
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
}
@@ -4579,154 +4579,154 @@ void LLAgent::stopCurrentAnimations()
{
LL_DEBUGS("Avatar") << "Stopping current animations" << LL_ENDL;
- // This function stops all current overriding animations on this
- // avatar, propagating this change back to the server.
- if (isAgentAvatarValid())
- {
- std::vector<LLUUID> anim_ids;
-
- for ( LLVOAvatar::AnimIterator anim_it =
- gAgentAvatarp->mPlayingAnimations.begin();
- anim_it != gAgentAvatarp->mPlayingAnimations.end();
- anim_it++)
- {
- if ((anim_it->first == ANIM_AGENT_DO_NOT_DISTURB)||
- (anim_it->first == ANIM_AGENT_SIT_GROUND_CONSTRAINED))
- {
- // don't cancel a ground-sit anim, as viewers
- // use this animation's status in
- // determining whether we're sitting. ick.
+ // This function stops all current overriding animations on this
+ // avatar, propagating this change back to the server.
+ if (isAgentAvatarValid())
+ {
+ std::vector<LLUUID> anim_ids;
+
+ for ( LLVOAvatar::AnimIterator anim_it =
+ gAgentAvatarp->mPlayingAnimations.begin();
+ anim_it != gAgentAvatarp->mPlayingAnimations.end();
+ anim_it++)
+ {
+ if ((anim_it->first == ANIM_AGENT_DO_NOT_DISTURB)||
+ (anim_it->first == ANIM_AGENT_SIT_GROUND_CONSTRAINED))
+ {
+ // don't cancel a ground-sit anim, as viewers
+ // use this animation's status in
+ // determining whether we're sitting. ick.
LL_DEBUGS("Avatar") << "sit or do-not-disturb animation will not be stopped" << LL_ENDL;
- }
- else
- {
- // stop this animation locally
- gAgentAvatarp->stopMotion(anim_it->first, TRUE);
- // ...and tell the server to tell everyone.
- anim_ids.push_back(anim_it->first);
- }
- }
-
- sendAnimationRequests(anim_ids, ANIM_REQUEST_STOP);
-
- // Tell the region to clear any animation state overrides
- sendAnimationStateReset();
-
- // Revoke all animation permissions
- if (mRegionp &&
- gSavedSettings.getBOOL("RevokePermsOnStopAnimation"))
- {
- U32 permissions = SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_TRIGGER_ANIMATION].permbit | SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS].permbit;
- sendRevokePermissions(mRegionp->getRegionID(), permissions);
- if (gAgentAvatarp->isSitting())
- { // Also stand up, since auto-granted sit animation permission has been revoked
- gAgent.standUp();
- }
- }
-
- // re-assert at least the default standing animation, because
- // viewers get confused by avs with no associated anims.
- sendAnimationRequest(ANIM_AGENT_STAND, ANIM_REQUEST_START);
- }
+ }
+ else
+ {
+ // stop this animation locally
+ gAgentAvatarp->stopMotion(anim_it->first, TRUE);
+ // ...and tell the server to tell everyone.
+ anim_ids.push_back(anim_it->first);
+ }
+ }
+
+ sendAnimationRequests(anim_ids, ANIM_REQUEST_STOP);
+
+ // Tell the region to clear any animation state overrides
+ sendAnimationStateReset();
+
+ // Revoke all animation permissions
+ if (mRegionp &&
+ gSavedSettings.getBOOL("RevokePermsOnStopAnimation"))
+ {
+ U32 permissions = SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_TRIGGER_ANIMATION].permbit | SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS].permbit;
+ sendRevokePermissions(mRegionp->getRegionID(), permissions);
+ if (gAgentAvatarp->isSitting())
+ { // Also stand up, since auto-granted sit animation permission has been revoked
+ gAgent.standUp();
+ }
+ }
+
+ // re-assert at least the default standing animation, because
+ // viewers get confused by avs with no associated anims.
+ sendAnimationRequest(ANIM_AGENT_STAND, ANIM_REQUEST_START);
+ }
}
void LLAgent::fidget()
{
- if (!getAFK())
- {
- F32 curTime = mFidgetTimer.getElapsedTimeF32();
- if (curTime > mNextFidgetTime)
- {
- // pick a random fidget anim here
- S32 oldFidget = mCurrentFidget;
-
- mCurrentFidget = ll_rand(NUM_AGENT_STAND_ANIMS);
-
- if (mCurrentFidget != oldFidget)
- {
- LLAgent::stopFidget();
-
-
- switch(mCurrentFidget)
- {
- case 0:
- mCurrentFidget = 0;
- break;
- case 1:
- sendAnimationRequest(ANIM_AGENT_STAND_1, ANIM_REQUEST_START);
- mCurrentFidget = 1;
- break;
- case 2:
- sendAnimationRequest(ANIM_AGENT_STAND_2, ANIM_REQUEST_START);
- mCurrentFidget = 2;
- break;
- case 3:
- sendAnimationRequest(ANIM_AGENT_STAND_3, ANIM_REQUEST_START);
- mCurrentFidget = 3;
- break;
- case 4:
- sendAnimationRequest(ANIM_AGENT_STAND_4, ANIM_REQUEST_START);
- mCurrentFidget = 4;
- break;
- }
- }
-
- // calculate next fidget time
- mNextFidgetTime = curTime + ll_frand(MAX_FIDGET_TIME - MIN_FIDGET_TIME) + MIN_FIDGET_TIME;
- }
- }
+ if (!getAFK())
+ {
+ F32 curTime = mFidgetTimer.getElapsedTimeF32();
+ if (curTime > mNextFidgetTime)
+ {
+ // pick a random fidget anim here
+ S32 oldFidget = mCurrentFidget;
+
+ mCurrentFidget = ll_rand(NUM_AGENT_STAND_ANIMS);
+
+ if (mCurrentFidget != oldFidget)
+ {
+ LLAgent::stopFidget();
+
+
+ switch(mCurrentFidget)
+ {
+ case 0:
+ mCurrentFidget = 0;
+ break;
+ case 1:
+ sendAnimationRequest(ANIM_AGENT_STAND_1, ANIM_REQUEST_START);
+ mCurrentFidget = 1;
+ break;
+ case 2:
+ sendAnimationRequest(ANIM_AGENT_STAND_2, ANIM_REQUEST_START);
+ mCurrentFidget = 2;
+ break;
+ case 3:
+ sendAnimationRequest(ANIM_AGENT_STAND_3, ANIM_REQUEST_START);
+ mCurrentFidget = 3;
+ break;
+ case 4:
+ sendAnimationRequest(ANIM_AGENT_STAND_4, ANIM_REQUEST_START);
+ mCurrentFidget = 4;
+ break;
+ }
+ }
+
+ // calculate next fidget time
+ mNextFidgetTime = curTime + ll_frand(MAX_FIDGET_TIME - MIN_FIDGET_TIME) + MIN_FIDGET_TIME;
+ }
+ }
}
void LLAgent::stopFidget()
{
- std::vector<LLUUID> anims;
- anims.reserve(4);
- anims.push_back(ANIM_AGENT_STAND_1);
- anims.push_back(ANIM_AGENT_STAND_2);
- anims.push_back(ANIM_AGENT_STAND_3);
- anims.push_back(ANIM_AGENT_STAND_4);
+ std::vector<LLUUID> anims;
+ anims.reserve(4);
+ anims.push_back(ANIM_AGENT_STAND_1);
+ anims.push_back(ANIM_AGENT_STAND_2);
+ anims.push_back(ANIM_AGENT_STAND_3);
+ anims.push_back(ANIM_AGENT_STAND_4);
- gAgent.sendAnimationRequests(anims, ANIM_REQUEST_STOP);
+ gAgent.sendAnimationRequests(anims, ANIM_REQUEST_STOP);
}
void LLAgent::requestEnterGodMode()
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RequestGodlikePowers);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_RequestBlock);
- msg->addBOOLFast(_PREHASH_Godlike, TRUE);
- msg->addUUIDFast(_PREHASH_Token, LLUUID::null);
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RequestGodlikePowers);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_RequestBlock);
+ msg->addBOOLFast(_PREHASH_Godlike, TRUE);
+ msg->addUUIDFast(_PREHASH_Token, LLUUID::null);
- // simulators need to know about your request
- sendReliableMessage();
+ // simulators need to know about your request
+ sendReliableMessage();
}
void LLAgent::requestLeaveGodMode()
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RequestGodlikePowers);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_RequestBlock);
- msg->addBOOLFast(_PREHASH_Godlike, FALSE);
- msg->addUUIDFast(_PREHASH_Token, LLUUID::null);
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RequestGodlikePowers);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_RequestBlock);
+ msg->addBOOLFast(_PREHASH_Godlike, FALSE);
+ msg->addUUIDFast(_PREHASH_Token, LLUUID::null);
- // simulator needs to know about your request
- sendReliableMessage();
+ // simulator needs to know about your request
+ sendReliableMessage();
}
void LLAgent::sendAgentDataUpdateRequest()
{
- gMessageSystem->newMessageFast(_PREHASH_AgentDataUpdateRequest);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- sendReliableMessage();
+ gMessageSystem->newMessageFast(_PREHASH_AgentDataUpdateRequest);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ sendReliableMessage();
}
void LLAgent::sendAgentUserInfoRequest()
@@ -4745,7 +4745,7 @@ void LLAgent::sendAgentUserInfoRequest()
boost::bind(&LLAgent::requestAgentUserInfoCoro, this, cap));
}
else
- {
+ {
sendAgentUserInfoRequestMessage();
}
}
@@ -4783,7 +4783,7 @@ void LLAgent::requestAgentUserInfoCoro(std::string capurl)
email = result["email"].asString();
dir_visibility = result["directory_visibility"].asString();
- // TODO: This should probably be changed. I'm not entirely comfortable
+ // TODO: This should probably be changed. I'm not entirely comfortable
// having LLAgent interact directly with the UI in this way.
LLFloaterPreference::updateUserInfo(dir_visibility);
LLFloaterSnapshot::setAgentEmail(email);
@@ -4867,138 +4867,138 @@ void LLAgent::sendAgentUpdateUserInfoMessage(const std::string& directory_visibi
void LLAgent::observeFriends()
{
- if(!mFriendObserver)
- {
- mFriendObserver = new LLAgentFriendObserver;
- LLAvatarTracker::instance().addObserver(mFriendObserver);
- friendsChanged();
- }
+ if(!mFriendObserver)
+ {
+ mFriendObserver = new LLAgentFriendObserver;
+ LLAvatarTracker::instance().addObserver(mFriendObserver);
+ friendsChanged();
+ }
}
std::map<S32, std::string> LLAgent::sTeleportStateName = { { TELEPORT_NONE, "TELEPORT_NONE" },
- { TELEPORT_START, "TELEPORT_START" },
- { TELEPORT_REQUESTED, "TELEPORT_REQUESTED" },
- { TELEPORT_MOVING, "TELEPORT_MOVING" },
- { TELEPORT_START_ARRIVAL, "TELEPORT_START_ARRIVAL" },
- { TELEPORT_ARRIVING, "TELEPORT_ARRIVING" },
- { TELEPORT_LOCAL, "TELEPORT_LOCAL" },
- { TELEPORT_PENDING, "TELEPORT_PENDING" } };
+ { TELEPORT_START, "TELEPORT_START" },
+ { TELEPORT_REQUESTED, "TELEPORT_REQUESTED" },
+ { TELEPORT_MOVING, "TELEPORT_MOVING" },
+ { TELEPORT_START_ARRIVAL, "TELEPORT_START_ARRIVAL" },
+ { TELEPORT_ARRIVING, "TELEPORT_ARRIVING" },
+ { TELEPORT_LOCAL, "TELEPORT_LOCAL" },
+ { TELEPORT_PENDING, "TELEPORT_PENDING" } };
const std::string& LLAgent::teleportStateName(S32 state)
{
- static std::string invalid_state_str("INVALID");
- auto iter = LLAgent::sTeleportStateName.find(state);
- if (iter != LLAgent::sTeleportStateName.end())
- {
- return iter->second;
- }
- else
- {
- return invalid_state_str;
- }
+ static std::string invalid_state_str("INVALID");
+ auto iter = LLAgent::sTeleportStateName.find(state);
+ if (iter != LLAgent::sTeleportStateName.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ return invalid_state_str;
+ }
}
const std::string& LLAgent::getTeleportStateName() const
{
- return teleportStateName(getTeleportState());
+ return teleportStateName(getTeleportState());
}
void LLAgent::parseTeleportMessages(const std::string& xml_filename)
{
- LLXMLNodePtr root;
- BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
-
- if (!success || !root || !root->hasName( "teleport_messages" ))
- {
- LL_ERRS() << "Problem reading teleport string XML file: "
- << xml_filename << LL_ENDL;
- return;
- }
-
- for (LLXMLNode* message_set = root->getFirstChild();
- message_set != NULL;
- message_set = message_set->getNextSibling())
- {
- if ( !message_set->hasName("message_set") ) continue;
-
- std::map<std::string, std::string> *teleport_msg_map = NULL;
- std::string message_set_name;
-
- if ( message_set->getAttributeString("name", message_set_name) )
- {
- //now we loop over all the string in the set and add them
- //to the appropriate set
- if ( message_set_name == "errors" )
- {
- teleport_msg_map = &sTeleportErrorMessages;
- }
- else if ( message_set_name == "progress" )
- {
- teleport_msg_map = &sTeleportProgressMessages;
- }
- }
-
- if ( !teleport_msg_map ) continue;
-
- std::string message_name;
- for (LLXMLNode* message_node = message_set->getFirstChild();
- message_node != NULL;
- message_node = message_node->getNextSibling())
- {
- if ( message_node->hasName("message") &&
- message_node->getAttributeString("name", message_name) )
- {
- (*teleport_msg_map)[message_name] =
- message_node->getTextContents();
- } //end if ( message exists and has a name)
- } //end for (all message in set)
- }//end for (all message sets in xml file)
+ LLXMLNodePtr root;
+ BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
+
+ if (!success || !root || !root->hasName( "teleport_messages" ))
+ {
+ LL_ERRS() << "Problem reading teleport string XML file: "
+ << xml_filename << LL_ENDL;
+ return;
+ }
+
+ for (LLXMLNode* message_set = root->getFirstChild();
+ message_set != NULL;
+ message_set = message_set->getNextSibling())
+ {
+ if ( !message_set->hasName("message_set") ) continue;
+
+ std::map<std::string, std::string> *teleport_msg_map = NULL;
+ std::string message_set_name;
+
+ if ( message_set->getAttributeString("name", message_set_name) )
+ {
+ //now we loop over all the string in the set and add them
+ //to the appropriate set
+ if ( message_set_name == "errors" )
+ {
+ teleport_msg_map = &sTeleportErrorMessages;
+ }
+ else if ( message_set_name == "progress" )
+ {
+ teleport_msg_map = &sTeleportProgressMessages;
+ }
+ }
+
+ if ( !teleport_msg_map ) continue;
+
+ std::string message_name;
+ for (LLXMLNode* message_node = message_set->getFirstChild();
+ message_node != NULL;
+ message_node = message_node->getNextSibling())
+ {
+ if ( message_node->hasName("message") &&
+ message_node->getAttributeString("name", message_name) )
+ {
+ (*teleport_msg_map)[message_name] =
+ message_node->getTextContents();
+ } //end if ( message exists and has a name)
+ } //end for (all message in set)
+ }//end for (all message sets in xml file)
}
const void LLAgent::getTeleportSourceSLURL(LLSLURL& slurl) const
{
- slurl = *mTeleportSourceSLURL;
+ slurl = *mTeleportSourceSLURL;
}
// static
void LLAgent::dumpGroupInfo()
{
- LL_INFOS() << "group " << gAgent.mGroupName << LL_ENDL;
- LL_INFOS() << "ID " << gAgent.mGroupID << LL_ENDL;
- LL_INFOS() << "powers " << gAgent.mGroupPowers << LL_ENDL;
- LL_INFOS() << "title " << gAgent.mGroupTitle << LL_ENDL;
- //LL_INFOS() << "insig " << gAgent.mGroupInsigniaID << LL_ENDL;
+ LL_INFOS() << "group " << gAgent.mGroupName << LL_ENDL;
+ LL_INFOS() << "ID " << gAgent.mGroupID << LL_ENDL;
+ LL_INFOS() << "powers " << gAgent.mGroupPowers << LL_ENDL;
+ LL_INFOS() << "title " << gAgent.mGroupTitle << LL_ENDL;
+ //LL_INFOS() << "insig " << gAgent.mGroupInsigniaID << LL_ENDL;
}
// Draw a representation of current autopilot target
void LLAgent::renderAutoPilotTarget()
{
- if (mAutoPilot)
- {
- F32 height_meters;
- LLVector3d target_global;
+ if (mAutoPilot)
+ {
+ F32 height_meters;
+ LLVector3d target_global;
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
- // not textured
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ // not textured
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- // lovely green
- gGL.color4f(0.f, 1.f, 1.f, 1.f);
+ // lovely green
+ gGL.color4f(0.f, 1.f, 1.f, 1.f);
- target_global = mAutoPilotTargetGlobal;
+ target_global = mAutoPilotTargetGlobal;
- gGL.translatef((F32)(target_global.mdV[VX]), (F32)(target_global.mdV[VY]), (F32)(target_global.mdV[VZ]));
+ gGL.translatef((F32)(target_global.mdV[VX]), (F32)(target_global.mdV[VY]), (F32)(target_global.mdV[VZ]));
- height_meters = 1.f;
+ height_meters = 1.f;
- gGL.scalef(height_meters, height_meters, height_meters);
+ gGL.scalef(height_meters, height_meters, height_meters);
- gSphere.render();
+ gSphere.render();
- gGL.popMatrix();
- }
+ gGL.popMatrix();
+ }
}
/********************************************************************************/
@@ -5008,7 +5008,7 @@ void LLAgent::renderAutoPilotTarget()
//-----------------------------------------------------------------------------
LLTeleportRequest::LLTeleportRequest()
- : mStatus(kPending)
+ : mStatus(kPending)
{
}
@@ -5018,46 +5018,46 @@ LLTeleportRequest::~LLTeleportRequest()
bool LLTeleportRequest::canRestartTeleport()
{
- return false;
+ return false;
}
void LLTeleportRequest::restartTeleport()
{
- llassert(0);
+ llassert(0);
}
// TODO this enum -> name idiom should be in a common class rather than repeated various places.
const std::string& LLTeleportRequest::statusName(EStatus status)
{
- static std::string invalid_status_str("INVALID");
- auto iter = LLTeleportRequest::sTeleportStatusName.find(status);
- if (iter != LLTeleportRequest::sTeleportStatusName.end())
- {
- return iter->second;
- }
- else
- {
- return invalid_status_str;
- }
+ static std::string invalid_status_str("INVALID");
+ auto iter = LLTeleportRequest::sTeleportStatusName.find(status);
+ if (iter != LLTeleportRequest::sTeleportStatusName.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ return invalid_status_str;
+ }
}
std::ostream& operator<<(std::ostream& os, const LLTeleportRequest& req)
{
- req.toOstream(os);
- return os;
+ req.toOstream(os);
+ return os;
}
void LLTeleportRequest::toOstream(std::ostream& os) const
{
- os << "status " << statusName(mStatus) << "(" << mStatus << ")";
+ os << "status " << statusName(mStatus) << "(" << mStatus << ")";
}
//-----------------------------------------------------------------------------
// LLTeleportRequestViaLandmark
//-----------------------------------------------------------------------------
LLTeleportRequestViaLandmark::LLTeleportRequestViaLandmark(const LLUUID &pLandmarkId)
- : LLTeleportRequest(),
- mLandmarkId(pLandmarkId)
+ : LLTeleportRequest(),
+ mLandmarkId(pLandmarkId)
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark created, " << *this << LL_ENDL;
}
@@ -5069,34 +5069,34 @@ LLTeleportRequestViaLandmark::~LLTeleportRequestViaLandmark()
void LLTeleportRequestViaLandmark::toOstream(std::ostream& os) const
{
- os << "landmark " << mLandmarkId << " ";
- LLTeleportRequest::toOstream(os);
+ os << "landmark " << mLandmarkId << " ";
+ LLTeleportRequest::toOstream(os);
}
bool LLTeleportRequestViaLandmark::canRestartTeleport()
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::canRestartTeleport? -> true, " << *this << LL_ENDL;
- return true;
+ return true;
}
void LLTeleportRequestViaLandmark::startTeleport()
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::startTeleport, " << *this << LL_ENDL;
- gAgent.doTeleportViaLandmark(getLandmarkId());
+ gAgent.doTeleportViaLandmark(getLandmarkId());
}
void LLTeleportRequestViaLandmark::restartTeleport()
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::restartTeleport, " << *this << LL_ENDL;
- gAgent.doTeleportViaLandmark(getLandmarkId());
+ gAgent.doTeleportViaLandmark(getLandmarkId());
}
//-----------------------------------------------------------------------------
// LLTeleportRequestViaLure
//-----------------------------------------------------------------------------
LLTeleportRequestViaLure::LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL pIsLureGodLike)
- : LLTeleportRequestViaLandmark(pLureId),
- mIsLureGodLike(pIsLureGodLike)
+ : LLTeleportRequestViaLandmark(pLureId),
+ mIsLureGodLike(pIsLureGodLike)
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLure created" << LL_ENDL;
}
@@ -5108,23 +5108,23 @@ LLTeleportRequestViaLure::~LLTeleportRequestViaLure()
void LLTeleportRequestViaLure::toOstream(std::ostream& os) const
{
- os << "mIsLureGodLike " << (S32) mIsLureGodLike << " ";
- LLTeleportRequestViaLandmark::toOstream(os);
+ os << "mIsLureGodLike " << (S32) mIsLureGodLike << " ";
+ LLTeleportRequestViaLandmark::toOstream(os);
}
bool LLTeleportRequestViaLure::canRestartTeleport()
{
- // stinson 05/17/2012 : cannot restart a teleport via lure because of server-side restrictions
- // The current scenario is as follows:
- // 1. User A initializes a request for User B to teleport via lure
- // 2. User B accepts the teleport via lure request
- // 3. The server sees the init request from User A and the accept request from User B and matches them up
- // 4. The server then removes the paired requests up from the "queue"
- // 5. The server then fails User B's teleport for reason of maturity level (for example)
- // 6. User B's viewer prompts user to increase their maturity level profile value.
- // 7. User B confirms and accepts increase in maturity level
- // 8. User B's viewer then attempts to teleport via lure again
- // 9. This request will time-out on the viewer-side because User A's initial request has been removed from the "queue" in step 4
+ // stinson 05/17/2012 : cannot restart a teleport via lure because of server-side restrictions
+ // The current scenario is as follows:
+ // 1. User A initializes a request for User B to teleport via lure
+ // 2. User B accepts the teleport via lure request
+ // 3. The server sees the init request from User A and the accept request from User B and matches them up
+ // 4. The server then removes the paired requests up from the "queue"
+ // 5. The server then fails User B's teleport for reason of maturity level (for example)
+ // 6. User B's viewer prompts user to increase their maturity level profile value.
+ // 7. User B confirms and accepts increase in maturity level
+ // 8. User B's viewer then attempts to teleport via lure again
+ // 9. This request will time-out on the viewer-side because User A's initial request has been removed from the "queue" in step 4
LL_INFOS("Teleport") << "LLTeleportRequestViaLure::canRestartTeleport? -> false" << LL_ENDL;
return false;
@@ -5133,7 +5133,7 @@ bool LLTeleportRequestViaLure::canRestartTeleport()
void LLTeleportRequestViaLure::startTeleport()
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLure::startTeleport" << LL_ENDL;
- gAgent.doTeleportViaLure(getLandmarkId(), isLureGodLike());
+ gAgent.doTeleportViaLure(getLandmarkId(), isLureGodLike());
}
//-----------------------------------------------------------------------------
@@ -5141,8 +5141,8 @@ void LLTeleportRequestViaLure::startTeleport()
//-----------------------------------------------------------------------------
LLTeleportRequestViaLocation::LLTeleportRequestViaLocation(const LLVector3d &pPosGlobal)
- : LLTeleportRequest(),
- mPosGlobal(pPosGlobal)
+ : LLTeleportRequest(),
+ mPosGlobal(pPosGlobal)
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLocation created" << LL_ENDL;
}
@@ -5154,20 +5154,20 @@ LLTeleportRequestViaLocation::~LLTeleportRequestViaLocation()
void LLTeleportRequestViaLocation::toOstream(std::ostream& os) const
{
- os << "mPosGlobal " << mPosGlobal << " ";
- LLTeleportRequest::toOstream(os);
+ os << "mPosGlobal " << mPosGlobal << " ";
+ LLTeleportRequest::toOstream(os);
}
bool LLTeleportRequestViaLocation::canRestartTeleport()
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLocation::canRestartTeleport -> true" << LL_ENDL;
- return true;
+ return true;
}
void LLTeleportRequestViaLocation::startTeleport()
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLocation::startTeleport" << LL_ENDL;
- gAgent.doTeleportViaLocation(getPosGlobal());
+ gAgent.doTeleportViaLocation(getPosGlobal());
}
void LLTeleportRequestViaLocation::restartTeleport()
@@ -5181,7 +5181,7 @@ void LLTeleportRequestViaLocation::restartTeleport()
//-----------------------------------------------------------------------------
LLTeleportRequestViaLocationLookAt::LLTeleportRequestViaLocationLookAt(const LLVector3d &pPosGlobal)
- : LLTeleportRequestViaLocation(pPosGlobal)
+ : LLTeleportRequestViaLocation(pPosGlobal)
{
LL_INFOS("Teleport") << "LLTeleportRequestViaLocationLookAt created" << LL_ENDL;
}
@@ -5193,7 +5193,7 @@ LLTeleportRequestViaLocationLookAt::~LLTeleportRequestViaLocationLookAt()
void LLTeleportRequestViaLocationLookAt::toOstream(std::ostream& os) const
{
- LLTeleportRequestViaLocation::toOstream(os);
+ LLTeleportRequestViaLocation::toOstream(os);
}
bool LLTeleportRequestViaLocationLookAt::canRestartTeleport()
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 43b4457bf5..71fa4e20b1 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagent.h
* @brief LLAgent class header file
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,10 +28,10 @@
#define LL_LLAGENT_H
#include "indra_constants.h"
-#include "llevent.h" // LLObservable base class
-#include "llagentdata.h" // gAgentID, gAgentSessionID
+#include "llevent.h" // LLObservable base class
+#include "llagentdata.h" // gAgentID, gAgentSessionID
#include "llcharacter.h"
-#include "llcoordframe.h" // for mFrameAgent
+#include "llcoordframe.h" // for mFrameAgent
#include "llavatarappearancedefines.h"
#include "llpermissionsflags.h"
#include "llevents.h"
@@ -43,9 +43,9 @@
#include <boost/shared_ptr.hpp>
#include <boost/signals2.hpp>
-extern const BOOL ANIMATE;
-extern const U8 AGENT_STATE_TYPING; // Typing indication
-extern const U8 AGENT_STATE_EDITING; // Set when agent has objects selected
+extern const BOOL ANIMATE;
+extern const U8 AGENT_STATE_TYPING; // Typing indication
+extern const U8 AGENT_STATE_EDITING; // Set when agent has objects selected
class LLViewerRegion;
class LLMotion;
@@ -69,19 +69,19 @@ typedef std::shared_ptr<LLTeleportRequest> LLTeleportRequestPtr;
enum EAnimRequest
{
- ANIM_REQUEST_START,
- ANIM_REQUEST_STOP
+ ANIM_REQUEST_START,
+ ANIM_REQUEST_STOP
};
struct LLGroupData
{
- LLUUID mID;
- LLUUID mInsigniaID;
- U64 mPowers;
- BOOL mAcceptNotices;
- BOOL mListInProfile;
- S32 mContribution;
- std::string mName;
+ LLUUID mID;
+ LLUUID mInsigniaID;
+ U64 mPowers;
+ BOOL mAcceptNotices;
+ BOOL mListInProfile;
+ S32 mContribution;
+ std::string mName;
};
class LLAgentListener;
@@ -91,61 +91,61 @@ class LLAgentListener;
//------------------------------------------------------------------------
class LLAgent : public LLOldEvents::LLObservable
{
- LOG_CLASS(LLAgent);
+ LOG_CLASS(LLAgent);
public:
- friend class LLAgentDropGroupViewerNode;
+ friend class LLAgentDropGroupViewerNode;
/********************************************************************************
** **
** INITIALIZATION
**/
- //--------------------------------------------------------------------
- // Constructors / Destructors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Constructors / Destructors
+ //--------------------------------------------------------------------
public:
- LLAgent();
- virtual ~LLAgent();
- void init();
- void cleanup();
+ LLAgent();
+ virtual ~LLAgent();
+ void init();
+ void cleanup();
private:
- //--------------------------------------------------------------------
- // Login
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Login
+ //--------------------------------------------------------------------
public:
- void onAppFocusGained();
- void setFirstLogin(bool b);
- // Return TRUE if the database reported this login as the first for this particular user.
- bool isFirstLogin() const { return mFirstLogin; }
- bool isInitialized() const { return mInitialized; }
+ void onAppFocusGained();
+ void setFirstLogin(bool b);
+ // Return TRUE if the database reported this login as the first for this particular user.
+ bool isFirstLogin() const { return mFirstLogin; }
+ bool isInitialized() const { return mInitialized; }
void setFeatureVersion(S32 version, S32 flags);
S32 getFeatureVersion();
void getFeatureVersionAndFlags(S32 &version, S32 &flags);
void showLatestFeatureNotification(const std::string key);
public:
- std::string mMOTD; // Message of the day
+ std::string mMOTD; // Message of the day
private:
- bool mInitialized;
- bool mFirstLogin;
- std::shared_ptr<LLAgentListener> mListener;
+ bool mInitialized;
+ bool mFirstLogin;
+ std::shared_ptr<LLAgentListener> mListener;
- //--------------------------------------------------------------------
- // Session
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Session
+ //--------------------------------------------------------------------
public:
- const LLUUID& getID() const { return gAgentID; }
- const LLUUID& getSessionID() const { return gAgentSessionID; }
- // Note: NEVER send this value in the clear or over any weakly
- // encrypted channel (such as simple XOR masking). If you are unsure
- // ask Aaron or MarkL.
- const LLUUID& getSecureSessionID() const { return mSecureSessionID; }
+ const LLUUID& getID() const { return gAgentID; }
+ const LLUUID& getSessionID() const { return gAgentSessionID; }
+ // Note: NEVER send this value in the clear or over any weakly
+ // encrypted channel (such as simple XOR masking). If you are unsure
+ // ask Aaron or MarkL.
+ const LLUUID& getSecureSessionID() const { return mSecureSessionID; }
public:
- LLUUID mSecureSessionID; // Secure token for this login session
-
+ LLUUID mSecureSessionID; // Secure token for this login session
+
/** Initialization
** **
*******************************************************************************/
@@ -155,24 +155,24 @@ public:
** IDENTITY
**/
- //--------------------------------------------------------------------
- // Name
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Name
+ //--------------------------------------------------------------------
public:
- //*TODO remove, is not used as of August 20, 2009
- void buildFullnameAndTitle(std::string &name) const;
+ //*TODO remove, is not used as of August 20, 2009
+ void buildFullnameAndTitle(std::string &name) const;
- //--------------------------------------------------------------------
- // Gender
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Gender
+ //--------------------------------------------------------------------
public:
- // On the very first login, outfit needs to be chosen by some
- // mechanism, usually by loading the requested initial outfit. We
- // don't render the avatar until the choice is made.
- BOOL isOutfitChosen() const { return mOutfitChosen; }
- void setOutfitChosen(BOOL b) { mOutfitChosen = b; }
+ // On the very first login, outfit needs to be chosen by some
+ // mechanism, usually by loading the requested initial outfit. We
+ // don't render the avatar until the choice is made.
+ BOOL isOutfitChosen() const { return mOutfitChosen; }
+ void setOutfitChosen(BOOL b) { mOutfitChosen = b; }
private:
- BOOL mOutfitChosen;
+ BOOL mOutfitChosen;
/** Identity
** **
@@ -183,148 +183,148 @@ private:
** POSITION
**/
- //--------------------------------------------------------------------
- // Position
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Position
+ //--------------------------------------------------------------------
public:
typedef boost::signals2::signal<void(const LLVector3 &position_local, const LLVector3d &position_global)> position_signal_t;
- LLVector3 getPosAgentFromGlobal(const LLVector3d &pos_global) const;
- LLVector3d getPosGlobalFromAgent(const LLVector3 &pos_agent) const;
- const LLVector3d &getPositionGlobal() const;
- const LLVector3 &getPositionAgent();
- // Call once per frame to update position, angles (radians).
- void updateAgentPosition(const F32 dt, const F32 yaw, const S32 mouse_x, const S32 mouse_y);
- void setPositionAgent(const LLVector3 &center);
+ LLVector3 getPosAgentFromGlobal(const LLVector3d &pos_global) const;
+ LLVector3d getPosGlobalFromAgent(const LLVector3 &pos_agent) const;
+ const LLVector3d &getPositionGlobal() const;
+ const LLVector3 &getPositionAgent();
+ // Call once per frame to update position, angles (radians).
+ void updateAgentPosition(const F32 dt, const F32 yaw, const S32 mouse_x, const S32 mouse_y);
+ void setPositionAgent(const LLVector3 &center);
boost::signals2::connection whenPositionChanged(position_signal_t::slot_type fn);
protected:
- void propagate(const F32 dt); // ! BUG ! Should roll into updateAgentPosition
+ void propagate(const F32 dt); // ! BUG ! Should roll into updateAgentPosition
private:
- mutable LLVector3d mPositionGlobal;
+ mutable LLVector3d mPositionGlobal;
position_signal_t mOnPositionChanged;
LLVector3d mLastTestGlobal;
- //--------------------------------------------------------------------
- // Velocity
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Velocity
+ //--------------------------------------------------------------------
public:
- LLVector3 getVelocity() const;
- F32 getVelocityZ() const { return getVelocity().mV[VZ]; } // ! HACK !
-
- //--------------------------------------------------------------------
- // Coordinate System
- //--------------------------------------------------------------------
+ LLVector3 getVelocity() const;
+ F32 getVelocityZ() const { return getVelocity().mV[VZ]; } // ! HACK !
+
+ //--------------------------------------------------------------------
+ // Coordinate System
+ //--------------------------------------------------------------------
public:
- const LLCoordFrame& getFrameAgent() const { return mFrameAgent; }
- void initOriginGlobal(const LLVector3d &origin_global); // Only to be used in ONE place
- void resetAxes();
- void resetAxes(const LLVector3 &look_at); // Makes reasonable left and up
- // The following three get*Axis functions return direction avatar is looking, not camera.
- const LLVector3& getAtAxis() const { return mFrameAgent.getAtAxis(); }
- const LLVector3& getUpAxis() const { return mFrameAgent.getUpAxis(); }
- const LLVector3& getLeftAxis() const { return mFrameAgent.getLeftAxis(); }
- LLQuaternion getQuat() const; // Returns the quat that represents the rotation of the agent in the absolute frame
+ const LLCoordFrame& getFrameAgent() const { return mFrameAgent; }
+ void initOriginGlobal(const LLVector3d &origin_global); // Only to be used in ONE place
+ void resetAxes();
+ void resetAxes(const LLVector3 &look_at); // Makes reasonable left and up
+ // The following three get*Axis functions return direction avatar is looking, not camera.
+ const LLVector3& getAtAxis() const { return mFrameAgent.getAtAxis(); }
+ const LLVector3& getUpAxis() const { return mFrameAgent.getUpAxis(); }
+ const LLVector3& getLeftAxis() const { return mFrameAgent.getLeftAxis(); }
+ LLQuaternion getQuat() const; // Returns the quat that represents the rotation of the agent in the absolute frame
private:
- LLVector3d mAgentOriginGlobal; // Origin of agent coords from global coords
- LLCoordFrame mFrameAgent; // Agent position and view, agent-region coordinates
+ LLVector3d mAgentOriginGlobal; // Origin of agent coords from global coords
+ LLCoordFrame mFrameAgent; // Agent position and view, agent-region coordinates
- //--------------------------------------------------------------------
- // Home
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Home
+ //--------------------------------------------------------------------
public:
- void setStartPosition(U32 location_id); // Marks current location as start, sends information to servers
- void setHomePosRegion(const U64& region_handle, const LLVector3& pos_region);
- BOOL getHomePosGlobal(LLVector3d* pos_global);
- bool isInHomeRegion();
+ void setStartPosition(U32 location_id); // Marks current location as start, sends information to servers
+ void setHomePosRegion(const U64& region_handle, const LLVector3& pos_region);
+ BOOL getHomePosGlobal(LLVector3d* pos_global);
+ bool isInHomeRegion();
private:
void setStartPositionSuccess(const LLSD &result);
- BOOL mHaveHomePosition;
- U64 mHomeRegionHandle;
- LLVector3 mHomePosRegion;
+ BOOL mHaveHomePosition;
+ U64 mHomeRegionHandle;
+ LLVector3 mHomePosRegion;
- //--------------------------------------------------------------------
- // Parcel
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Parcel
+ //--------------------------------------------------------------------
public:
- void changeParcels(); // called by LLViewerParcelMgr when we cross a parcel boundary
-
- // Register a boost callback to be called when the agent changes parcels
- typedef boost::function<void()> parcel_changed_callback_t;
- boost::signals2::connection addParcelChangedCallback(parcel_changed_callback_t);
+ void changeParcels(); // called by LLViewerParcelMgr when we cross a parcel boundary
+
+ // Register a boost callback to be called when the agent changes parcels
+ typedef boost::function<void()> parcel_changed_callback_t;
+ boost::signals2::connection addParcelChangedCallback(parcel_changed_callback_t);
private:
- static void capabilityReceivedCallback(const LLUUID &region_id, LLViewerRegion *regionp);
+ static void capabilityReceivedCallback(const LLUUID &region_id, LLViewerRegion *regionp);
- typedef boost::signals2::signal<void()> parcel_changed_signal_t;
- parcel_changed_signal_t mParcelChangedSignal;
+ typedef boost::signals2::signal<void()> parcel_changed_signal_t;
+ parcel_changed_signal_t mParcelChangedSignal;
- //--------------------------------------------------------------------
- // Region
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Region
+ //--------------------------------------------------------------------
public:
- void setRegion(LLViewerRegion *regionp);
- LLViewerRegion *getRegion() const;
- LLHost getRegionHost() const;
- BOOL inPrelude();
+ void setRegion(LLViewerRegion *regionp);
+ LLViewerRegion *getRegion() const;
+ LLHost getRegionHost() const;
+ BOOL inPrelude();
- // Capability
+ // Capability
std::string getRegionCapability(const std::string &name); // short hand for if (getRegion()) { getRegion()->getCapability(name) }
- /**
- * Register a boost callback to be called when the agent changes regions
- * Note that if you need to access a capability for the region, you may need to wait
- * for the capabilities to be received, since in some cases your region changed
- * callback will be called before the capabilities have been received. Your callback
- * may need to look something like:
- *
- * LLViewerRegion* region = gAgent.getRegion();
- * if (region->capabilitiesReceived())
- * {
- * useCapability(region);
- * }
- * else // Need to handle via callback after caps arrive.
- * {
- * region->setCapabilitiesReceivedCallback(boost::bind(&useCapability,region,_1));
- * // you may or may not want to remove that callback
- * }
- */
- typedef boost::signals2::signal<void()> region_changed_signal_t;
-
- boost::signals2::connection addRegionChangedCallback(const region_changed_signal_t::slot_type& cb);
- void removeRegionChangedCallback(boost::signals2::connection callback);
-
-
- void changeInterestListMode(const std::string & new_mode);
+ /**
+ * Register a boost callback to be called when the agent changes regions
+ * Note that if you need to access a capability for the region, you may need to wait
+ * for the capabilities to be received, since in some cases your region changed
+ * callback will be called before the capabilities have been received. Your callback
+ * may need to look something like:
+ *
+ * LLViewerRegion* region = gAgent.getRegion();
+ * if (region->capabilitiesReceived())
+ * {
+ * useCapability(region);
+ * }
+ * else // Need to handle via callback after caps arrive.
+ * {
+ * region->setCapabilitiesReceivedCallback(boost::bind(&useCapability,region,_1));
+ * // you may or may not want to remove that callback
+ * }
+ */
+ typedef boost::signals2::signal<void()> region_changed_signal_t;
+
+ boost::signals2::connection addRegionChangedCallback(const region_changed_signal_t::slot_type& cb);
+ void removeRegionChangedCallback(boost::signals2::connection callback);
+
+
+ void changeInterestListMode(const std::string & new_mode);
const std::string & getInterestListMode() const { return mInterestListMode; }
private:
- LLViewerRegion *mRegionp;
- region_changed_signal_t mRegionChangedSignal;
+ LLViewerRegion *mRegionp;
+ region_changed_signal_t mRegionChangedSignal;
- std::string mInterestListMode; // How agent wants regions to send updates
+ std::string mInterestListMode; // How agent wants regions to send updates
- //--------------------------------------------------------------------
- // History
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // History
+ //--------------------------------------------------------------------
public:
- S32 getRegionsVisited() const;
- F64 getDistanceTraveled() const;
- void setDistanceTraveled(F64 dist) { mDistanceTraveled = dist; }
-
- const LLVector3d &getLastPositionGlobal() const { return mLastPositionGlobal; }
- void setLastPositionGlobal(const LLVector3d &pos) { mLastPositionGlobal = pos; }
+ S32 getRegionsVisited() const;
+ F64 getDistanceTraveled() const;
+ void setDistanceTraveled(F64 dist) { mDistanceTraveled = dist; }
+
+ const LLVector3d &getLastPositionGlobal() const { return mLastPositionGlobal; }
+ void setLastPositionGlobal(const LLVector3d &pos) { mLastPositionGlobal = pos; }
private:
- std::set<U64> mRegionsVisited; // Stat - what distinct regions has the avatar been to?
- F64 mDistanceTraveled; // Stat - how far has the avatar moved?
- LLVector3d mLastPositionGlobal; // Used to calculate travel distance
-
+ std::set<U64> mRegionsVisited; // Stat - what distinct regions has the avatar been to?
+ F64 mDistanceTraveled; // Stat - how far has the avatar moved?
+ LLVector3d mLastPositionGlobal; // Used to calculate travel distance
+
/** Position
** **
*******************************************************************************/
@@ -334,192 +334,192 @@ private:
** ACTIONS
**/
- //--------------------------------------------------------------------
- // Fidget
- //--------------------------------------------------------------------
- // Trigger random fidget animations
+ //--------------------------------------------------------------------
+ // Fidget
+ //--------------------------------------------------------------------
+ // Trigger random fidget animations
public:
- void fidget();
- static void stopFidget();
+ void fidget();
+ static void stopFidget();
private:
- LLFrameTimer mFidgetTimer;
- LLFrameTimer mFocusObjectFadeTimer;
- LLFrameTimer mMoveTimer;
- F32 mNextFidgetTime;
- S32 mCurrentFidget;
+ LLFrameTimer mFidgetTimer;
+ LLFrameTimer mFocusObjectFadeTimer;
+ LLFrameTimer mMoveTimer;
+ F32 mNextFidgetTime;
+ S32 mCurrentFidget;
- //--------------------------------------------------------------------
- // Fly
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Fly
+ //--------------------------------------------------------------------
public:
- BOOL getFlying() const;
- void setFlying(BOOL fly, BOOL fail_sound = FALSE);
- static void toggleFlying();
- static bool enableFlying();
- BOOL canFly(); // Does this parcel allow you to fly?
- static bool isSitting();
+ BOOL getFlying() const;
+ void setFlying(BOOL fly, BOOL fail_sound = FALSE);
+ static void toggleFlying();
+ static bool enableFlying();
+ BOOL canFly(); // Does this parcel allow you to fly?
+ static bool isSitting();
- //--------------------------------------------------------------------
- // Voice
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Voice
+ //--------------------------------------------------------------------
public:
- bool isVoiceConnected() const { return mVoiceConnected; }
- void setVoiceConnected(const bool b) { mVoiceConnected = b; }
+ bool isVoiceConnected() const { return mVoiceConnected; }
+ void setVoiceConnected(const bool b) { mVoiceConnected = b; }
- static void pressMicrophone(const LLSD& name);
- static void releaseMicrophone(const LLSD& name);
- static void toggleMicrophone(const LLSD& name);
- static bool isMicrophoneOn(const LLSD& sdname);
- static bool isActionAllowed(const LLSD& sdname);
+ static void pressMicrophone(const LLSD& name);
+ static void releaseMicrophone(const LLSD& name);
+ static void toggleMicrophone(const LLSD& name);
+ static bool isMicrophoneOn(const LLSD& sdname);
+ static bool isActionAllowed(const LLSD& sdname);
private:
- bool mVoiceConnected;
+ bool mVoiceConnected;
- //--------------------------------------------------------------------
- // Chat
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Chat
+ //--------------------------------------------------------------------
public:
- void heardChat(const LLUUID& id);
- F32 getTypingTime() { return mTypingTimer.getElapsedTimeF32(); }
- LLUUID getLastChatter() const { return mLastChatterID; }
- F32 getNearChatRadius() { return mNearChatRadius; }
+ void heardChat(const LLUUID& id);
+ F32 getTypingTime() { return mTypingTimer.getElapsedTimeF32(); }
+ LLUUID getLastChatter() const { return mLastChatterID; }
+ F32 getNearChatRadius() { return mNearChatRadius; }
protected:
- void ageChat(); // Helper function to prematurely age chat when agent is moving
-private:
- LLFrameTimer mChatTimer;
- LLUUID mLastChatterID;
- F32 mNearChatRadius;
-
- //--------------------------------------------------------------------
- // Typing
- //--------------------------------------------------------------------
-public:
- void startTyping();
- void stopTyping();
-public:
- // When the agent hasn't typed anything for this duration, it leaves the
- // typing state (for both chat and IM).
- static const F32 TYPING_TIMEOUT_SECS;
-private:
- LLFrameTimer mTypingTimer;
-
- //--------------------------------------------------------------------
- // AFK
- //--------------------------------------------------------------------
-public:
- void setAFK();
- void clearAFK();
- BOOL getAFK() const;
- static const F32 MIN_AFK_TIME;
-
- //--------------------------------------------------------------------
- // Run
- //--------------------------------------------------------------------
-public:
- enum EDoubleTapRunMode
- {
- DOUBLETAP_NONE,
- DOUBLETAP_FORWARD,
- DOUBLETAP_BACKWARD,
- DOUBLETAP_SLIDELEFT,
- DOUBLETAP_SLIDERIGHT
- };
-
- void setAlwaysRun() { mbAlwaysRun = true; }
- void clearAlwaysRun() { mbAlwaysRun = false; }
- void setRunning() { mbRunning = true; }
- void clearRunning() { mbRunning = false; }
- void sendWalkRun(bool running);
- bool getAlwaysRun() const { return mbAlwaysRun; }
- bool getRunning() const { return mbRunning; }
-public:
- LLFrameTimer mDoubleTapRunTimer;
- EDoubleTapRunMode mDoubleTapRunMode;
-private:
- bool mbAlwaysRun; // Should the avatar run by default rather than walk?
- bool mbRunning; // Is the avatar trying to run right now?
- bool mbTeleportKeepsLookAt; // Try to keep look-at after teleport is complete
-
- //--------------------------------------------------------------------
- // Sit and stand
- //--------------------------------------------------------------------
-public:
- void standUp();
- /// @brief ground-sit at agent's current position
- void sitDown();
-
- //--------------------------------------------------------------------
- // Do Not Disturb
- //--------------------------------------------------------------------
-public:
- void setDoNotDisturb(bool pIsDoNotDisturb);
- bool isDoNotDisturb() const;
-private:
- bool mIsDoNotDisturb;
-
- //--------------------------------------------------------------------
- // Grab
- //--------------------------------------------------------------------
-public:
- BOOL leftButtonGrabbed() const;
- BOOL rotateGrabbed() const;
- BOOL forwardGrabbed() const;
- BOOL backwardGrabbed() const;
- BOOL upGrabbed() const;
- BOOL downGrabbed() const;
-
- //--------------------------------------------------------------------
- // Controls
- //--------------------------------------------------------------------
-public:
- U32 getControlFlags();
- void setControlFlags(U32 mask); // Performs bitwise mControlFlags |= mask
- void clearControlFlags(U32 mask); // Performs bitwise mControlFlags &= ~mask
- BOOL controlFlagsDirty() const;
- void enableControlFlagReset();
- void resetControlFlags();
- BOOL anyControlGrabbed() const; // True iff a script has taken over a control
- BOOL isControlGrabbed(S32 control_index) const;
- // Send message to simulator to force grabbed controls to be
- // released, in case of a poorly written script.
- void forceReleaseControls();
- void setFlagsDirty() { mbFlagsDirty = TRUE; }
-
-private:
- S32 mControlsTakenCount[TOTAL_CONTROLS];
- S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS];
- U32 mControlFlags; // Replacement for the mFooKey's
- BOOL mbFlagsDirty;
- BOOL mbFlagsNeedReset; // ! HACK ! For preventing incorrect flags sent when crossing region boundaries
-
- //--------------------------------------------------------------------
- // Animations
- //--------------------------------------------------------------------
-public:
- void stopCurrentAnimations();
- void requestStopMotion(LLMotion* motion);
- void onAnimStop(const LLUUID& id);
- void sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request);
- void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
- void sendAnimationStateReset();
- void sendRevokePermissions(const LLUUID & target, U32 permissions);
-
- void endAnimationUpdateUI();
- void unpauseAnimation() { mPauseRequest = NULL; }
- BOOL getCustomAnim() const { return mCustomAnim; }
- void setCustomAnim(BOOL anim) { mCustomAnim = anim; }
-
- typedef boost::signals2::signal<void ()> camera_signal_t;
- boost::signals2::connection setMouselookModeInCallback( const camera_signal_t::slot_type& cb );
- boost::signals2::connection setMouselookModeOutCallback( const camera_signal_t::slot_type& cb );
-
-private:
- camera_signal_t* mMouselookModeInSignal;
- camera_signal_t* mMouselookModeOutSignal;
- BOOL mCustomAnim; // Current animation is ANIM_AGENT_CUSTOMIZE ?
- LLPointer<LLPauseRequestHandle> mPauseRequest;
- BOOL mViewsPushed; // Keep track of whether or not we have pushed views
-
+ void ageChat(); // Helper function to prematurely age chat when agent is moving
+private:
+ LLFrameTimer mChatTimer;
+ LLUUID mLastChatterID;
+ F32 mNearChatRadius;
+
+ //--------------------------------------------------------------------
+ // Typing
+ //--------------------------------------------------------------------
+public:
+ void startTyping();
+ void stopTyping();
+public:
+ // When the agent hasn't typed anything for this duration, it leaves the
+ // typing state (for both chat and IM).
+ static const F32 TYPING_TIMEOUT_SECS;
+private:
+ LLFrameTimer mTypingTimer;
+
+ //--------------------------------------------------------------------
+ // AFK
+ //--------------------------------------------------------------------
+public:
+ void setAFK();
+ void clearAFK();
+ BOOL getAFK() const;
+ static const F32 MIN_AFK_TIME;
+
+ //--------------------------------------------------------------------
+ // Run
+ //--------------------------------------------------------------------
+public:
+ enum EDoubleTapRunMode
+ {
+ DOUBLETAP_NONE,
+ DOUBLETAP_FORWARD,
+ DOUBLETAP_BACKWARD,
+ DOUBLETAP_SLIDELEFT,
+ DOUBLETAP_SLIDERIGHT
+ };
+
+ void setAlwaysRun() { mbAlwaysRun = true; }
+ void clearAlwaysRun() { mbAlwaysRun = false; }
+ void setRunning() { mbRunning = true; }
+ void clearRunning() { mbRunning = false; }
+ void sendWalkRun(bool running);
+ bool getAlwaysRun() const { return mbAlwaysRun; }
+ bool getRunning() const { return mbRunning; }
+public:
+ LLFrameTimer mDoubleTapRunTimer;
+ EDoubleTapRunMode mDoubleTapRunMode;
+private:
+ bool mbAlwaysRun; // Should the avatar run by default rather than walk?
+ bool mbRunning; // Is the avatar trying to run right now?
+ bool mbTeleportKeepsLookAt; // Try to keep look-at after teleport is complete
+
+ //--------------------------------------------------------------------
+ // Sit and stand
+ //--------------------------------------------------------------------
+public:
+ void standUp();
+ /// @brief ground-sit at agent's current position
+ void sitDown();
+
+ //--------------------------------------------------------------------
+ // Do Not Disturb
+ //--------------------------------------------------------------------
+public:
+ void setDoNotDisturb(bool pIsDoNotDisturb);
+ bool isDoNotDisturb() const;
+private:
+ bool mIsDoNotDisturb;
+
+ //--------------------------------------------------------------------
+ // Grab
+ //--------------------------------------------------------------------
+public:
+ BOOL leftButtonGrabbed() const;
+ BOOL rotateGrabbed() const;
+ BOOL forwardGrabbed() const;
+ BOOL backwardGrabbed() const;
+ BOOL upGrabbed() const;
+ BOOL downGrabbed() const;
+
+ //--------------------------------------------------------------------
+ // Controls
+ //--------------------------------------------------------------------
+public:
+ U32 getControlFlags();
+ void setControlFlags(U32 mask); // Performs bitwise mControlFlags |= mask
+ void clearControlFlags(U32 mask); // Performs bitwise mControlFlags &= ~mask
+ BOOL controlFlagsDirty() const;
+ void enableControlFlagReset();
+ void resetControlFlags();
+ BOOL anyControlGrabbed() const; // True iff a script has taken over a control
+ BOOL isControlGrabbed(S32 control_index) const;
+ // Send message to simulator to force grabbed controls to be
+ // released, in case of a poorly written script.
+ void forceReleaseControls();
+ void setFlagsDirty() { mbFlagsDirty = TRUE; }
+
+private:
+ S32 mControlsTakenCount[TOTAL_CONTROLS];
+ S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS];
+ U32 mControlFlags; // Replacement for the mFooKey's
+ BOOL mbFlagsDirty;
+ BOOL mbFlagsNeedReset; // ! HACK ! For preventing incorrect flags sent when crossing region boundaries
+
+ //--------------------------------------------------------------------
+ // Animations
+ //--------------------------------------------------------------------
+public:
+ void stopCurrentAnimations();
+ void requestStopMotion(LLMotion* motion);
+ void onAnimStop(const LLUUID& id);
+ void sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request);
+ void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
+ void sendAnimationStateReset();
+ void sendRevokePermissions(const LLUUID & target, U32 permissions);
+
+ void endAnimationUpdateUI();
+ void unpauseAnimation() { mPauseRequest = NULL; }
+ BOOL getCustomAnim() const { return mCustomAnim; }
+ void setCustomAnim(BOOL anim) { mCustomAnim = anim; }
+
+ typedef boost::signals2::signal<void ()> camera_signal_t;
+ boost::signals2::connection setMouselookModeInCallback( const camera_signal_t::slot_type& cb );
+ boost::signals2::connection setMouselookModeOutCallback( const camera_signal_t::slot_type& cb );
+
+private:
+ camera_signal_t* mMouselookModeInSignal;
+ camera_signal_t* mMouselookModeOutSignal;
+ BOOL mCustomAnim; // Current animation is ANIM_AGENT_CUSTOMIZE ?
+ LLPointer<LLPauseRequestHandle> mPauseRequest;
+ BOOL mViewsPushed; // Keep track of whether or not we have pushed views
+
/** Animation
** **
*******************************************************************************/
@@ -529,79 +529,79 @@ private:
** MOVEMENT
**/
- //--------------------------------------------------------------------
- // Movement from user input
- //--------------------------------------------------------------------
- // All set the appropriate animation flags.
- // All turn off autopilot and make sure the camera is behind the avatar.
- // Direction is either positive, zero, or negative
-public:
- void moveAt(S32 direction, bool reset_view = true);
- void moveAtNudge(S32 direction);
- void moveLeft(S32 direction);
- void moveLeftNudge(S32 direction);
- void moveUp(S32 direction);
- void moveYaw(F32 mag, bool reset_view = true);
- void movePitch(F32 mag);
-
- BOOL isMovementLocked() const { return mMovementKeysLocked; }
- void setMovementLocked(BOOL set_locked) { mMovementKeysLocked = set_locked; }
-
- //--------------------------------------------------------------------
- // Move the avatar's frame
- //--------------------------------------------------------------------
-public:
- void rotate(F32 angle, const LLVector3 &axis);
- void rotate(F32 angle, F32 x, F32 y, F32 z);
- void rotate(const LLMatrix3 &matrix);
- void rotate(const LLQuaternion &quaternion);
- void pitch(F32 angle);
- void roll(F32 angle);
- void yaw(F32 angle);
- LLVector3 getReferenceUpVector();
-
- //--------------------------------------------------------------------
- // Autopilot
- //--------------------------------------------------------------------
-public:
- BOOL getAutoPilot() const { return mAutoPilot; }
- LLVector3d getAutoPilotTargetGlobal() const { return mAutoPilotTargetGlobal; }
- LLUUID getAutoPilotLeaderID() const { return mLeaderID; }
- F32 getAutoPilotStopDistance() const { return mAutoPilotStopDistance; }
- F32 getAutoPilotTargetDist() const { return mAutoPilotTargetDist; }
- BOOL getAutoPilotUseRotation() const { return mAutoPilotUseRotation; }
- LLVector3 getAutoPilotTargetFacing() const { return mAutoPilotTargetFacing; }
- F32 getAutoPilotRotationThreshold() const { return mAutoPilotRotationThreshold; }
- std::string getAutoPilotBehaviorName() const { return mAutoPilotBehaviorName; }
-
- void startAutoPilotGlobal(const LLVector3d &pos_global,
- const std::string& behavior_name = std::string(),
- const LLQuaternion *target_rotation = NULL,
- void (*finish_callback)(BOOL, void *) = NULL, void *callback_data = NULL,
- F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f,
- BOOL allow_flying = TRUE);
- void startFollowPilot(const LLUUID &leader_id, BOOL allow_flying = TRUE, F32 stop_distance = 0.5f);
- void stopAutoPilot(BOOL user_cancel = FALSE);
- void setAutoPilotTargetGlobal(const LLVector3d &target_global);
- void autoPilot(F32 *delta_yaw); // Autopilot walking action, angles in radians
- void renderAutoPilotTarget();
-private:
- BOOL mAutoPilot;
- BOOL mAutoPilotFlyOnStop;
- BOOL mAutoPilotAllowFlying;
- LLVector3d mAutoPilotTargetGlobal;
- F32 mAutoPilotStopDistance;
- BOOL mAutoPilotUseRotation;
- LLVector3 mAutoPilotTargetFacing;
- F32 mAutoPilotTargetDist;
- S32 mAutoPilotNoProgressFrameCount;
- F32 mAutoPilotRotationThreshold;
- std::string mAutoPilotBehaviorName;
- void (*mAutoPilotFinishedCallback)(BOOL, void *);
- void* mAutoPilotCallbackData;
- LLUUID mLeaderID;
- BOOL mMovementKeysLocked;
-
+ //--------------------------------------------------------------------
+ // Movement from user input
+ //--------------------------------------------------------------------
+ // All set the appropriate animation flags.
+ // All turn off autopilot and make sure the camera is behind the avatar.
+ // Direction is either positive, zero, or negative
+public:
+ void moveAt(S32 direction, bool reset_view = true);
+ void moveAtNudge(S32 direction);
+ void moveLeft(S32 direction);
+ void moveLeftNudge(S32 direction);
+ void moveUp(S32 direction);
+ void moveYaw(F32 mag, bool reset_view = true);
+ void movePitch(F32 mag);
+
+ BOOL isMovementLocked() const { return mMovementKeysLocked; }
+ void setMovementLocked(BOOL set_locked) { mMovementKeysLocked = set_locked; }
+
+ //--------------------------------------------------------------------
+ // Move the avatar's frame
+ //--------------------------------------------------------------------
+public:
+ void rotate(F32 angle, const LLVector3 &axis);
+ void rotate(F32 angle, F32 x, F32 y, F32 z);
+ void rotate(const LLMatrix3 &matrix);
+ void rotate(const LLQuaternion &quaternion);
+ void pitch(F32 angle);
+ void roll(F32 angle);
+ void yaw(F32 angle);
+ LLVector3 getReferenceUpVector();
+
+ //--------------------------------------------------------------------
+ // Autopilot
+ //--------------------------------------------------------------------
+public:
+ BOOL getAutoPilot() const { return mAutoPilot; }
+ LLVector3d getAutoPilotTargetGlobal() const { return mAutoPilotTargetGlobal; }
+ LLUUID getAutoPilotLeaderID() const { return mLeaderID; }
+ F32 getAutoPilotStopDistance() const { return mAutoPilotStopDistance; }
+ F32 getAutoPilotTargetDist() const { return mAutoPilotTargetDist; }
+ BOOL getAutoPilotUseRotation() const { return mAutoPilotUseRotation; }
+ LLVector3 getAutoPilotTargetFacing() const { return mAutoPilotTargetFacing; }
+ F32 getAutoPilotRotationThreshold() const { return mAutoPilotRotationThreshold; }
+ std::string getAutoPilotBehaviorName() const { return mAutoPilotBehaviorName; }
+
+ void startAutoPilotGlobal(const LLVector3d &pos_global,
+ const std::string& behavior_name = std::string(),
+ const LLQuaternion *target_rotation = NULL,
+ void (*finish_callback)(BOOL, void *) = NULL, void *callback_data = NULL,
+ F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f,
+ BOOL allow_flying = TRUE);
+ void startFollowPilot(const LLUUID &leader_id, BOOL allow_flying = TRUE, F32 stop_distance = 0.5f);
+ void stopAutoPilot(BOOL user_cancel = FALSE);
+ void setAutoPilotTargetGlobal(const LLVector3d &target_global);
+ void autoPilot(F32 *delta_yaw); // Autopilot walking action, angles in radians
+ void renderAutoPilotTarget();
+private:
+ BOOL mAutoPilot;
+ BOOL mAutoPilotFlyOnStop;
+ BOOL mAutoPilotAllowFlying;
+ LLVector3d mAutoPilotTargetGlobal;
+ F32 mAutoPilotStopDistance;
+ BOOL mAutoPilotUseRotation;
+ LLVector3 mAutoPilotTargetFacing;
+ F32 mAutoPilotTargetDist;
+ S32 mAutoPilotNoProgressFrameCount;
+ F32 mAutoPilotRotationThreshold;
+ std::string mAutoPilotBehaviorName;
+ void (*mAutoPilotFinishedCallback)(BOOL, void *);
+ void* mAutoPilotCallbackData;
+ LLUUID mLeaderID;
+ BOOL mMovementKeysLocked;
+
/** Movement
** **
*******************************************************************************/
@@ -612,122 +612,122 @@ private:
**/
public:
- enum ETeleportState
- {
- TELEPORT_NONE = 0, // No teleport in progress
- TELEPORT_START = 1, // Transition to REQUESTED. Viewer has sent a TeleportRequest to the source simulator
- TELEPORT_REQUESTED = 2, // Waiting for source simulator to respond
- TELEPORT_MOVING = 3, // Viewer has received destination location from source simulator
- TELEPORT_START_ARRIVAL = 4, // Transition to ARRIVING. Viewer has received avatar update, etc., from destination simulator
- TELEPORT_ARRIVING = 5, // Make the user wait while content "pre-caches"
- TELEPORT_LOCAL = 6, // Teleporting in-sim without showing the progress screen
- TELEPORT_PENDING = 7
- };
+ enum ETeleportState
+ {
+ TELEPORT_NONE = 0, // No teleport in progress
+ TELEPORT_START = 1, // Transition to REQUESTED. Viewer has sent a TeleportRequest to the source simulator
+ TELEPORT_REQUESTED = 2, // Waiting for source simulator to respond
+ TELEPORT_MOVING = 3, // Viewer has received destination location from source simulator
+ TELEPORT_START_ARRIVAL = 4, // Transition to ARRIVING. Viewer has received avatar update, etc., from destination simulator
+ TELEPORT_ARRIVING = 5, // Make the user wait while content "pre-caches"
+ TELEPORT_LOCAL = 6, // Teleporting in-sim without showing the progress screen
+ TELEPORT_PENDING = 7
+ };
- static std::map<S32, std::string> sTeleportStateName;
- static const std::string& teleportStateName(S32);
- const std::string& getTeleportStateName() const;
+ static std::map<S32, std::string> sTeleportStateName;
+ static const std::string& teleportStateName(S32);
+ const std::string& getTeleportStateName() const;
public:
- static void parseTeleportMessages(const std::string& xml_filename);
- const void getTeleportSourceSLURL(LLSLURL& slurl) const;
+ static void parseTeleportMessages(const std::string& xml_filename);
+ const void getTeleportSourceSLURL(LLSLURL& slurl) const;
public:
- // ! TODO ! Define ERROR and PROGRESS enums here instead of exposing the mappings.
- static std::map<std::string, std::string> sTeleportErrorMessages;
- static std::map<std::string, std::string> sTeleportProgressMessages;
+ // ! TODO ! Define ERROR and PROGRESS enums here instead of exposing the mappings.
+ static std::map<std::string, std::string> sTeleportErrorMessages;
+ static std::map<std::string, std::string> sTeleportProgressMessages;
private:
- LLSLURL * mTeleportSourceSLURL; // SLURL where last TP began
+ LLSLURL * mTeleportSourceSLURL; // SLURL where last TP began
- //--------------------------------------------------------------------
- // Teleport Actions
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Teleport Actions
+ //--------------------------------------------------------------------
public:
- void teleportViaLandmark(const LLUUID& landmark_id); // Teleport to a landmark
- void teleportHome() { teleportViaLandmark(LLUUID::null); } // Go home
- void teleportViaLure(const LLUUID& lure_id, BOOL godlike); // To an invited location
- void teleportViaLocation(const LLVector3d& pos_global); // To a global location - this will probably need to be deprecated
- void teleportViaLocationLookAt(const LLVector3d& pos_global);// To a global location, preserving camera rotation
- void teleportCancel(); // May or may not be allowed by server
+ void teleportViaLandmark(const LLUUID& landmark_id); // Teleport to a landmark
+ void teleportHome() { teleportViaLandmark(LLUUID::null); } // Go home
+ void teleportViaLure(const LLUUID& lure_id, BOOL godlike); // To an invited location
+ void teleportViaLocation(const LLVector3d& pos_global); // To a global location - this will probably need to be deprecated
+ void teleportViaLocationLookAt(const LLVector3d& pos_global);// To a global location, preserving camera rotation
+ void teleportCancel(); // May or may not be allowed by server
void restoreCanceledTeleportRequest();
- bool canRestoreCanceledTeleport() { return mTeleportCanceled != NULL; }
- bool getTeleportKeepsLookAt() { return mbTeleportKeepsLookAt; } // Whether look-at reset after teleport
+ bool canRestoreCanceledTeleport() { return mTeleportCanceled != NULL; }
+ bool getTeleportKeepsLookAt() { return mbTeleportKeepsLookAt; } // Whether look-at reset after teleport
protected:
- bool teleportCore(bool is_local = false); // Stuff for all teleports; returns true if the teleport can proceed
+ bool teleportCore(bool is_local = false); // Stuff for all teleports; returns true if the teleport can proceed
- //--------------------------------------------------------------------
- // Teleport State
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Teleport State
+ //--------------------------------------------------------------------
public:
- bool hasRestartableFailedTeleportRequest();
- void restartFailedTeleportRequest();
- void clearTeleportRequest();
- void setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange);
- void sheduleTeleportIM();
+ bool hasRestartableFailedTeleportRequest();
+ void restartFailedTeleportRequest();
+ void clearTeleportRequest();
+ void setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange);
+ void sheduleTeleportIM();
private:
- friend class LLTeleportRequest;
- friend class LLTeleportRequestViaLandmark;
- friend class LLTeleportRequestViaLure;
- friend class LLTeleportRequestViaLocation;
- friend class LLTeleportRequestViaLocationLookAt;
+ friend class LLTeleportRequest;
+ friend class LLTeleportRequestViaLandmark;
+ friend class LLTeleportRequestViaLure;
+ friend class LLTeleportRequestViaLocation;
+ friend class LLTeleportRequestViaLocationLookAt;
- LLTeleportRequestPtr mTeleportRequest;
- LLTeleportRequestPtr mTeleportCanceled;
- boost::signals2::connection mTeleportFinishedSlot;
- boost::signals2::connection mTeleportFailedSlot;
+ LLTeleportRequestPtr mTeleportRequest;
+ LLTeleportRequestPtr mTeleportCanceled;
+ boost::signals2::connection mTeleportFinishedSlot;
+ boost::signals2::connection mTeleportFailedSlot;
- bool mIsMaturityRatingChangingDuringTeleport;
- bool mTPNeedsNeabyChatSeparator;
- U8 mMaturityRatingChange;
+ bool mIsMaturityRatingChangingDuringTeleport;
+ bool mTPNeedsNeabyChatSeparator;
+ U8 mMaturityRatingChange;
- bool hasPendingTeleportRequest();
- void startTeleportRequest();
+ bool hasPendingTeleportRequest();
+ void startTeleportRequest();
- void teleportRequest(const U64& region_handle,
- const LLVector3& pos_local, // Go to a named location home
- bool look_at_from_camera = false);
- void doTeleportViaLandmark(const LLUUID& landmark_id); // Teleport to a landmark
- void doTeleportViaLure(const LLUUID& lure_id, BOOL godlike); // To an invited location
- void doTeleportViaLocation(const LLVector3d& pos_global); // To a global location - this will probably need to be deprecated
- void doTeleportViaLocationLookAt(const LLVector3d& pos_global);// To a global location, preserving camera rotation
+ void teleportRequest(const U64& region_handle,
+ const LLVector3& pos_local, // Go to a named location home
+ bool look_at_from_camera = false);
+ void doTeleportViaLandmark(const LLUUID& landmark_id); // Teleport to a landmark
+ void doTeleportViaLure(const LLUUID& lure_id, BOOL godlike); // To an invited location
+ void doTeleportViaLocation(const LLVector3d& pos_global); // To a global location - this will probably need to be deprecated
+ void doTeleportViaLocationLookAt(const LLVector3d& pos_global);// To a global location, preserving camera rotation
- void handleTeleportFinished();
- void handleTeleportFailed();
+ void handleTeleportFinished();
+ void handleTeleportFailed();
static void addTPNearbyChatSeparator();
static void onCapabilitiesReceivedAfterTeleport();
- //--------------------------------------------------------------------
- // Teleport State
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Teleport State
+ //--------------------------------------------------------------------
public:
- ETeleportState getTeleportState() const;
- void setTeleportState(ETeleportState state);
+ ETeleportState getTeleportState() const;
+ void setTeleportState(ETeleportState state);
private:
- ETeleportState mTeleportState;
+ ETeleportState mTeleportState;
- //--------------------------------------------------------------------
- // Teleport Message
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Teleport Message
+ //--------------------------------------------------------------------
public:
- const std::string& getTeleportMessage() const { return mTeleportMessage; }
- void setTeleportMessage(const std::string& message) { mTeleportMessage = message; }
+ const std::string& getTeleportMessage() const { return mTeleportMessage; }
+ void setTeleportMessage(const std::string& message) { mTeleportMessage = message; }
private:
- std::string mTeleportMessage;
-
+ std::string mTeleportMessage;
+
/** Teleport
** **
*******************************************************************************/
- // Build
+ // Build
public:
- bool canEditParcel() const { return mCanEditParcel; }
+ bool canEditParcel() const { return mCanEditParcel; }
private:
- static void setCanEditParcel();
- bool mCanEditParcel;
+ static void setCanEditParcel();
+ bool mCanEditParcel;
@@ -737,83 +737,83 @@ private:
**/
public:
- // Checks if agent can modify an object based on the permissions and the agent's proxy status.
- BOOL isGrantedProxy(const LLPermissions& perm);
- BOOL allowOperation(PermissionBit op,
- const LLPermissions& perm,
- U64 group_proxy_power = 0,
- U8 god_minimum = GOD_MAINTENANCE);
- const LLAgentAccess& getAgentAccess();
- BOOL canManageEstate() const;
- BOOL getAdminOverride() const;
-private:
- LLAgentAccess * mAgentAccess;
-
- //--------------------------------------------------------------------
- // God
- //--------------------------------------------------------------------
-public:
- bool isGodlike() const;
- bool isGodlikeWithoutAdminMenuFakery() const;
- U8 getGodLevel() const;
- void setAdminOverride(BOOL b);
- void setGodLevel(U8 god_level);
- void requestEnterGodMode();
- void requestLeaveGodMode();
-
- typedef boost::function<void (U8)> god_level_change_callback_t;
- typedef boost::signals2::signal<void (U8)> god_level_change_signal_t;
- typedef boost::signals2::connection god_level_change_slot_t;
-
- god_level_change_slot_t registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback);
-
-private:
- god_level_change_signal_t mGodLevelChangeSignal;
-
-
- //--------------------------------------------------------------------
- // Maturity
- //--------------------------------------------------------------------
-public:
- // Note: this is a prime candidate for pulling out into a Maturity class.
- // Rather than just expose the preference setting, we're going to actually
- // expose what the client code cares about -- what the user should see
- // based on a combination of the is* and prefers* flags, combined with god bit.
- bool wantsPGOnly() const;
- bool canAccessMature() const;
- bool canAccessAdult() const;
- bool canAccessMaturityInRegion( U64 region_handle ) const;
- bool canAccessMaturityAtGlobal( LLVector3d pos_global ) const;
- bool prefersPG() const;
- bool prefersMature() const;
- bool prefersAdult() const;
- bool isTeen() const;
- bool isMature() const;
- bool isAdult() const;
- void setMaturity(char text);
- static int convertTextToMaturity(char text);
-
-private:
- bool mIsDoSendMaturityPreferenceToServer;
- unsigned int mMaturityPreferenceRequestId;
- unsigned int mMaturityPreferenceResponseId;
- unsigned int mMaturityPreferenceNumRetries;
- U8 mLastKnownRequestMaturity;
- U8 mLastKnownResponseMaturity;
- LLCore::HttpRequest::policy_t mHttpPolicy;
-
- bool isMaturityPreferenceSyncedWithServer() const;
- void sendMaturityPreferenceToServer(U8 pPreferredMaturity);
+ // Checks if agent can modify an object based on the permissions and the agent's proxy status.
+ BOOL isGrantedProxy(const LLPermissions& perm);
+ BOOL allowOperation(PermissionBit op,
+ const LLPermissions& perm,
+ U64 group_proxy_power = 0,
+ U8 god_minimum = GOD_MAINTENANCE);
+ const LLAgentAccess& getAgentAccess();
+ BOOL canManageEstate() const;
+ BOOL getAdminOverride() const;
+private:
+ LLAgentAccess * mAgentAccess;
+
+ //--------------------------------------------------------------------
+ // God
+ //--------------------------------------------------------------------
+public:
+ bool isGodlike() const;
+ bool isGodlikeWithoutAdminMenuFakery() const;
+ U8 getGodLevel() const;
+ void setAdminOverride(BOOL b);
+ void setGodLevel(U8 god_level);
+ void requestEnterGodMode();
+ void requestLeaveGodMode();
+
+ typedef boost::function<void (U8)> god_level_change_callback_t;
+ typedef boost::signals2::signal<void (U8)> god_level_change_signal_t;
+ typedef boost::signals2::connection god_level_change_slot_t;
+
+ god_level_change_slot_t registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback);
+
+private:
+ god_level_change_signal_t mGodLevelChangeSignal;
+
+
+ //--------------------------------------------------------------------
+ // Maturity
+ //--------------------------------------------------------------------
+public:
+ // Note: this is a prime candidate for pulling out into a Maturity class.
+ // Rather than just expose the preference setting, we're going to actually
+ // expose what the client code cares about -- what the user should see
+ // based on a combination of the is* and prefers* flags, combined with god bit.
+ bool wantsPGOnly() const;
+ bool canAccessMature() const;
+ bool canAccessAdult() const;
+ bool canAccessMaturityInRegion( U64 region_handle ) const;
+ bool canAccessMaturityAtGlobal( LLVector3d pos_global ) const;
+ bool prefersPG() const;
+ bool prefersMature() const;
+ bool prefersAdult() const;
+ bool isTeen() const;
+ bool isMature() const;
+ bool isAdult() const;
+ void setMaturity(char text);
+ static int convertTextToMaturity(char text);
+
+private:
+ bool mIsDoSendMaturityPreferenceToServer;
+ unsigned int mMaturityPreferenceRequestId;
+ unsigned int mMaturityPreferenceResponseId;
+ unsigned int mMaturityPreferenceNumRetries;
+ U8 mLastKnownRequestMaturity;
+ U8 mLastKnownResponseMaturity;
+ LLCore::HttpRequest::policy_t mHttpPolicy;
+
+ bool isMaturityPreferenceSyncedWithServer() const;
+ void sendMaturityPreferenceToServer(U8 pPreferredMaturity);
void processMaturityPreferenceFromServer(const LLSD &result, U8 perferredMaturity);
- void handlePreferredMaturityResult(U8 pServerMaturity);
- void handlePreferredMaturityError();
- void reportPreferredMaturitySuccess();
- void reportPreferredMaturityError();
+ void handlePreferredMaturityResult(U8 pServerMaturity);
+ void handlePreferredMaturityError();
+ void reportPreferredMaturitySuccess();
+ void reportPreferredMaturityError();
- // Maturity callbacks for PreferredMaturity control variable
- void handleMaturity(const LLSD &pNewValue);
- bool validateMaturity(const LLSD& newvalue);
+ // Maturity callbacks for PreferredMaturity control variable
+ void handleMaturity(const LLSD &pNewValue);
+ bool validateMaturity(const LLSD& newvalue);
/** Access
@@ -826,33 +826,33 @@ private:
**/
public:
- LLQuaternion getHeadRotation();
- BOOL needsRenderAvatar(); // TRUE when camera mode is such that your own avatar should draw
- BOOL needsRenderHead();
- void setShowAvatar(BOOL show) { mShowAvatar = show; }
- BOOL getShowAvatar() const { return mShowAvatar; }
-
+ LLQuaternion getHeadRotation();
+ BOOL needsRenderAvatar(); // TRUE when camera mode is such that your own avatar should draw
+ BOOL needsRenderHead();
+ void setShowAvatar(BOOL show) { mShowAvatar = show; }
+ BOOL getShowAvatar() const { return mShowAvatar; }
+
private:
- BOOL mShowAvatar; // Should we render the avatar?
+ BOOL mShowAvatar; // Should we render the avatar?
- //--------------------------------------------------------------------
- // Rendering state bitmap helpers
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Rendering state bitmap helpers
+ //--------------------------------------------------------------------
public:
- void setRenderState(U8 newstate);
- void clearRenderState(U8 clearstate);
- U8 getRenderState();
+ void setRenderState(U8 newstate);
+ void clearRenderState(U8 clearstate);
+ U8 getRenderState();
private:
- U8 mRenderState; // Current behavior state of agent
+ U8 mRenderState; // Current behavior state of agent
- //--------------------------------------------------------------------
- // HUD
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // HUD
+ //--------------------------------------------------------------------
public:
- const LLColor4 &getEffectColor();
- void setEffectColor(const LLColor4 &color);
+ const LLColor4 &getEffectColor();
+ void setEffectColor(const LLColor4 &color);
private:
- LLUIColor * mEffectColor;
+ LLUIColor * mEffectColor;
/** Rendering
** **
@@ -864,60 +864,60 @@ private:
**/
public:
- const LLUUID &getGroupID() const { return mGroupID; }
- // Get group information by group_id, or FALSE if not in group.
- BOOL getGroupData(const LLUUID& group_id, LLGroupData& data) const;
- // Get just the agent's contribution to the given group.
- S32 getGroupContribution(const LLUUID& group_id) const;
- // Update internal datastructures and update the server.
- BOOL setGroupContribution(const LLUUID& group_id, S32 contribution);
- BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile);
- const std::string &getGroupName() const { return mGroupName; }
- BOOL canJoinGroups() const;
+ const LLUUID &getGroupID() const { return mGroupID; }
+ // Get group information by group_id, or FALSE if not in group.
+ BOOL getGroupData(const LLUUID& group_id, LLGroupData& data) const;
+ // Get just the agent's contribution to the given group.
+ S32 getGroupContribution(const LLUUID& group_id) const;
+ // Update internal datastructures and update the server.
+ BOOL setGroupContribution(const LLUUID& group_id, S32 contribution);
+ BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile);
+ const std::string &getGroupName() const { return mGroupName; }
+ BOOL canJoinGroups() const;
private:
- std::string mGroupName;
- LLUUID mGroupID;
+ std::string mGroupName;
+ LLUUID mGroupID;
- //--------------------------------------------------------------------
- // Group Membership
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Group Membership
+ //--------------------------------------------------------------------
public:
- // Checks against all groups in the entire agent group list.
- BOOL isInGroup(const LLUUID& group_id, BOOL ingnore_God_mod = FALSE) const;
+ // Checks against all groups in the entire agent group list.
+ BOOL isInGroup(const LLUUID& group_id, BOOL ingnore_God_mod = FALSE) const;
protected:
- // Only used for building titles.
- BOOL isGroupMember() const { return !mGroupID.isNull(); }
+ // Only used for building titles.
+ BOOL isGroupMember() const { return !mGroupID.isNull(); }
public:
- std::vector<LLGroupData> mGroups;
+ std::vector<LLGroupData> mGroups;
- //--------------------------------------------------------------------
- // Group Title
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Group Title
+ //--------------------------------------------------------------------
public:
- void setHideGroupTitle(BOOL hide) { mHideGroupTitle = hide; }
- BOOL isGroupTitleHidden() const { return mHideGroupTitle; }
+ void setHideGroupTitle(BOOL hide) { mHideGroupTitle = hide; }
+ BOOL isGroupTitleHidden() const { return mHideGroupTitle; }
private:
- std::string mGroupTitle; // Honorific, like "Sir"
- BOOL mHideGroupTitle;
+ std::string mGroupTitle; // Honorific, like "Sir"
+ BOOL mHideGroupTitle;
- //--------------------------------------------------------------------
- // Group Powers
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Group Powers
+ //--------------------------------------------------------------------
public:
- BOOL hasPowerInGroup(const LLUUID& group_id, U64 power) const;
- BOOL hasPowerInActiveGroup(const U64 power) const;
- U64 getPowerInGroup(const LLUUID& group_id) const;
- U64 mGroupPowers;
+ BOOL hasPowerInGroup(const LLUUID& group_id, U64 power) const;
+ BOOL hasPowerInActiveGroup(const U64 power) const;
+ U64 getPowerInGroup(const LLUUID& group_id) const;
+ U64 mGroupPowers;
- //--------------------------------------------------------------------
- // Friends
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Friends
+ //--------------------------------------------------------------------
public:
- void observeFriends();
- void friendsChanged();
+ void observeFriends();
+ void friendsChanged();
private:
- LLFriendObserver* mFriendObserver;
- std::set<LLUUID> mProxyForAgents;
+ LLFriendObserver* mFriendObserver;
+ std::set<LLUUID> mProxyForAgents;
/** Groups
** **
@@ -928,34 +928,34 @@ private:
** MESSAGING
**/
- //--------------------------------------------------------------------
- // Send
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Send
+ //--------------------------------------------------------------------
public:
- void sendMessage(); // Send message to this agent's region
- void sendReliableMessage();
- void sendAgentDataUpdateRequest();
- void sendAgentUserInfoRequest();
+ void sendMessage(); // Send message to this agent's region
+ void sendReliableMessage();
+ void sendAgentDataUpdateRequest();
+ void sendAgentUserInfoRequest();
// IM to Email and Online visibility
- void sendAgentUpdateUserInfo(const std::string& directory_visibility);
+ void sendAgentUpdateUserInfo(const std::string& directory_visibility);
private:
void requestAgentUserInfoCoro(std::string capurl);
void updateAgentUserInfoCoro(std::string capurl, std::string directory_visibility);
- // DEPRECATED: may be removed when User Info cap propagates
- void sendAgentUserInfoRequestMessage();
+ // DEPRECATED: may be removed when User Info cap propagates
+ void sendAgentUserInfoRequestMessage();
void sendAgentUpdateUserInfoMessage(const std::string& directory_visibility);
- //--------------------------------------------------------------------
- // Receive
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Receive
+ //--------------------------------------------------------------------
public:
- static void processAgentDataUpdate(LLMessageSystem *msg, void **);
- static void processAgentGroupDataUpdate(LLMessageSystem *msg, void **);
- static void processAgentDropGroup(LLMessageSystem *msg, void **);
- static void processScriptControlChange(LLMessageSystem *msg, void **);
-
+ static void processAgentDataUpdate(LLMessageSystem *msg, void **);
+ static void processAgentGroupDataUpdate(LLMessageSystem *msg, void **);
+ static void processAgentDropGroup(LLMessageSystem *msg, void **);
+ static void processScriptControlChange(LLMessageSystem *msg, void **);
+
/** Messaging
** **
*******************************************************************************/
@@ -967,8 +967,8 @@ public:
public:
typedef LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t httpCallback_t;
- /// Utilities for allowing the the agent sub managers to post and get via
- /// HTTP using the agent's policy settings and headers.
+ /// Utilities for allowing the the agent sub managers to post and get via
+ /// HTTP using the agent's policy settings and headers.
bool requestPostCapability(const std::string &capName, LLSD &postData, httpCallback_t cbSuccess = NULL, httpCallback_t cbFailure = NULL);
bool requestGetCapability(const std::string &capName, httpCallback_t cbSuccess = NULL, httpCallback_t cbFailure = NULL);
@@ -984,9 +984,9 @@ public:
**/
public:
- static void dumpGroupInfo();
- static void clearVisualParams(void *);
- friend std::ostream& operator<<(std::ostream &s, const LLAgent &sphere);
+ static void dumpGroupInfo();
+ static void clearVisualParams(void *);
+ friend std::ostream& operator<<(std::ostream &s, const LLAgent &sphere);
/** Debugging
** **
@@ -998,7 +998,7 @@ extern LLAgent gAgent;
inline bool operator==(const LLGroupData &a, const LLGroupData &b)
{
- return (a.mID == b.mID);
+ return (a.mID == b.mID);
}
#endif
diff --git a/indra/newview/llagentaccess.cpp b/indra/newview/llagentaccess.cpp
index c4ee321e04..7d834b2926 100644
--- a/indra/newview/llagentaccess.cpp
+++ b/indra/newview/llagentaccess.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentaccess.cpp
* @brief LLAgentAccess class implementation - manages maturity and godmode info
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,153 +30,153 @@
#include "llcontrol.h"
LLAgentAccess::LLAgentAccess(LLControlGroup& savedSettings) :
- mSavedSettings(savedSettings),
- mAccess(SIM_ACCESS_PG),
- mAdminOverride(false),
- mGodLevel(GOD_NOT)
+ mSavedSettings(savedSettings),
+ mAccess(SIM_ACCESS_PG),
+ mAdminOverride(false),
+ mGodLevel(GOD_NOT)
{
}
-bool LLAgentAccess::getAdminOverride() const
-{
- return mAdminOverride;
+bool LLAgentAccess::getAdminOverride() const
+{
+ return mAdminOverride;
}
void LLAgentAccess::setAdminOverride(bool b)
-{
- mAdminOverride = b;
+{
+ mAdminOverride = b;
}
void LLAgentAccess::setGodLevel(U8 god_level)
-{
- mGodLevel = god_level;
+{
+ mGodLevel = god_level;
}
bool LLAgentAccess::isGodlike() const
{
#ifdef HACKED_GODLIKE_VIEWER
- return true;
+ return true;
#else
- if(mAdminOverride) return true;
- return mGodLevel > GOD_NOT;
+ if(mAdminOverride) return true;
+ return mGodLevel > GOD_NOT;
#endif
}
bool LLAgentAccess::isGodlikeWithoutAdminMenuFakery() const
{
#ifdef HACKED_GODLIKE_VIEWER
- return true;
+ return true;
#else
- return mGodLevel > GOD_NOT;
+ return mGodLevel > GOD_NOT;
#endif
}
U8 LLAgentAccess::getGodLevel() const
{
#ifdef HACKED_GODLIKE_VIEWER
- return GOD_MAINTENANCE;
+ return GOD_MAINTENANCE;
#else
- if(mAdminOverride) return GOD_FULL; // :(
- return mGodLevel;
+ if(mAdminOverride) return GOD_FULL; // :(
+ return mGodLevel;
#endif
}
bool LLAgentAccess::wantsPGOnly() const
{
- return (prefersPG() || isTeen()) && !isGodlike();
+ return (prefersPG() || isTeen()) && !isGodlike();
}
bool LLAgentAccess::canAccessMature() const
{
- // if you prefer mature, you're either mature or adult, and
- // therefore can access all mature content
- return isGodlike() || (prefersMature() && !isTeen());
+ // if you prefer mature, you're either mature or adult, and
+ // therefore can access all mature content
+ return isGodlike() || (prefersMature() && !isTeen());
}
bool LLAgentAccess::canAccessAdult() const
{
- // if you prefer adult, you must BE adult.
- return isGodlike() || (prefersAdult() && isAdult());
+ // if you prefer adult, you must BE adult.
+ return isGodlike() || (prefersAdult() && isAdult());
}
bool LLAgentAccess::prefersPG() const
{
- U32 access = mSavedSettings.getU32("PreferredMaturity");
- return access < SIM_ACCESS_MATURE;
+ U32 access = mSavedSettings.getU32("PreferredMaturity");
+ return access < SIM_ACCESS_MATURE;
}
bool LLAgentAccess::prefersMature() const
{
- U32 access = mSavedSettings.getU32("PreferredMaturity");
- return access >= SIM_ACCESS_MATURE;
+ U32 access = mSavedSettings.getU32("PreferredMaturity");
+ return access >= SIM_ACCESS_MATURE;
}
bool LLAgentAccess::prefersAdult() const
{
- U32 access = mSavedSettings.getU32("PreferredMaturity");
- return access >= SIM_ACCESS_ADULT;
+ U32 access = mSavedSettings.getU32("PreferredMaturity");
+ return access >= SIM_ACCESS_ADULT;
}
bool LLAgentAccess::isTeen() const
{
- return mAccess < SIM_ACCESS_MATURE;
+ return mAccess < SIM_ACCESS_MATURE;
}
bool LLAgentAccess::isMature() const
{
- return mAccess >= SIM_ACCESS_MATURE;
+ return mAccess >= SIM_ACCESS_MATURE;
}
bool LLAgentAccess::isAdult() const
{
- return mAccess >= SIM_ACCESS_ADULT;
+ return mAccess >= SIM_ACCESS_ADULT;
}
-//static
+//static
int LLAgentAccess::convertTextToMaturity(char text)
{
- if ('A' == text)
- {
- return SIM_ACCESS_ADULT;
- }
- else if ('M'== text)
- {
- return SIM_ACCESS_MATURE;
- }
- else if ('P'== text)
- {
- return SIM_ACCESS_PG;
- }
- return SIM_ACCESS_MIN;
+ if ('A' == text)
+ {
+ return SIM_ACCESS_ADULT;
+ }
+ else if ('M'== text)
+ {
+ return SIM_ACCESS_MATURE;
+ }
+ else if ('P'== text)
+ {
+ return SIM_ACCESS_PG;
+ }
+ return SIM_ACCESS_MIN;
}
void LLAgentAccess::setMaturity(char text)
{
- mAccess = LLAgentAccess::convertTextToMaturity(text);
- U32 preferred_access = mSavedSettings.getU32("PreferredMaturity");
- while (!canSetMaturity(preferred_access))
- {
- if (preferred_access == SIM_ACCESS_ADULT)
- {
- preferred_access = SIM_ACCESS_MATURE;
- }
- else
- {
- // Mature or invalid access gets set to PG
- preferred_access = SIM_ACCESS_PG;
- }
- }
- mSavedSettings.setU32("PreferredMaturity", preferred_access);
+ mAccess = LLAgentAccess::convertTextToMaturity(text);
+ U32 preferred_access = mSavedSettings.getU32("PreferredMaturity");
+ while (!canSetMaturity(preferred_access))
+ {
+ if (preferred_access == SIM_ACCESS_ADULT)
+ {
+ preferred_access = SIM_ACCESS_MATURE;
+ }
+ else
+ {
+ // Mature or invalid access gets set to PG
+ preferred_access = SIM_ACCESS_PG;
+ }
+ }
+ mSavedSettings.setU32("PreferredMaturity", preferred_access);
}
bool LLAgentAccess::canSetMaturity(S32 maturity)
{
- if (isGodlike()) // Gods can always set their Maturity level
- return true;
- if (isAdult()) // Adults can always set their Maturity level
- return true;
- if (maturity == SIM_ACCESS_PG || (maturity == SIM_ACCESS_MATURE && isMature()))
- return true;
- else
- return false;
+ if (isGodlike()) // Gods can always set their Maturity level
+ return true;
+ if (isAdult()) // Adults can always set their Maturity level
+ return true;
+ if (maturity == SIM_ACCESS_PG || (maturity == SIM_ACCESS_MATURE && isMature()))
+ return true;
+ else
+ return false;
}
diff --git a/indra/newview/llagentaccess.h b/indra/newview/llagentaccess.h
index 4e851b0aa0..c6199ce955 100644
--- a/indra/newview/llagentaccess.h
+++ b/indra/newview/llagentaccess.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentaccess.h
* @brief LLAgentAccess class implementation - manages maturity and godmode info
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,42 +35,42 @@ class LLControlGroup;
class LLAgentAccess
{
public:
- LLAgentAccess(LLControlGroup& savedSettings);
-
- bool getAdminOverride() const;
- void setAdminOverride(bool b);
+ LLAgentAccess(LLControlGroup& savedSettings);
+
+ bool getAdminOverride() const;
+ void setAdminOverride(bool b);
+
+ void setGodLevel(U8 god_level);
+ bool isGodlike() const;
+ bool isGodlikeWithoutAdminMenuFakery() const;
+ U8 getGodLevel() const;
+
+
+ // rather than just expose the preference setting, we're going to actually
+ // expose what the client code cares about -- what the user should see
+ // based on a combination of the is* and prefers* flags, combined with God bit.
+ bool wantsPGOnly() const;
+ bool canAccessMature() const;
+ bool canAccessAdult() const;
+ bool prefersPG() const;
+ bool prefersMature() const;
+ bool prefersAdult() const;
+ bool isTeen() const;
+ bool isMature() const;
+ bool isAdult() const;
+
+ void setMaturity(char text);
+
+ static int convertTextToMaturity(char text);
+
+ bool canSetMaturity(S32 maturity);
- void setGodLevel(U8 god_level);
- bool isGodlike() const;
- bool isGodlikeWithoutAdminMenuFakery() const;
- U8 getGodLevel() const;
-
-
- // rather than just expose the preference setting, we're going to actually
- // expose what the client code cares about -- what the user should see
- // based on a combination of the is* and prefers* flags, combined with God bit.
- bool wantsPGOnly() const;
- bool canAccessMature() const;
- bool canAccessAdult() const;
- bool prefersPG() const;
- bool prefersMature() const;
- bool prefersAdult() const;
- bool isTeen() const;
- bool isMature() const;
- bool isAdult() const;
-
- void setMaturity(char text);
-
- static int convertTextToMaturity(char text);
-
- bool canSetMaturity(S32 maturity);
-
private:
- U8 mAccess; // SIM_ACCESS_MATURE etc
- U8 mGodLevel;
- bool mAdminOverride;
-
- LLControlGroup& mSavedSettings;
+ U8 mAccess; // SIM_ACCESS_MATURE etc
+ U8 mGodLevel;
+ bool mAdminOverride;
+
+ LLControlGroup& mSavedSettings;
};
#endif // LL_LLAGENTACCESS_H
diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp
index 2d219735a0..c2a1589682 100644
--- a/indra/newview/llagentbenefits.cpp
+++ b/indra/newview/llagentbenefits.cpp
@@ -27,14 +27,14 @@
#include "llagentbenefits.h"
LLAgentBenefits::LLAgentBenefits():
- m_initalized(false),
- m_animated_object_limit(-1),
- m_animation_upload_cost(-1),
- m_attachment_limit(-1),
- m_group_membership_limit(-1),
- m_picks_limit(-1),
- m_sound_upload_cost(-1),
- m_texture_upload_cost(-1)
+ m_initalized(false),
+ m_animated_object_limit(-1),
+ m_animation_upload_cost(-1),
+ m_attachment_limit(-1),
+ m_group_membership_limit(-1),
+ m_picks_limit(-1),
+ m_sound_upload_cost(-1),
+ m_texture_upload_cost(-1)
{
}
@@ -47,118 +47,118 @@ LLAgentBenefits::~LLAgentBenefits()
// the viewer cares about are integer.
bool get_required_S32(const LLSD& sd, const LLSD::String& key, S32& value)
{
- value = -1;
- if (sd.has(key))
- {
- value = sd[key].asInteger();
- return true;
- }
+ value = -1;
+ if (sd.has(key))
+ {
+ value = sd[key].asInteger();
+ return true;
+ }
- LL_WARNS("Benefits") << "Missing required benefit field " << key << LL_ENDL;
- return false;
+ LL_WARNS("Benefits") << "Missing required benefit field " << key << LL_ENDL;
+ return false;
}
bool LLAgentBenefits::init(const LLSD& benefits_sd)
{
- LL_DEBUGS("Benefits") << "initializing benefits from " << benefits_sd << LL_ENDL;
-
- if (!get_required_S32(benefits_sd, "animated_object_limit", m_animated_object_limit))
- {
- return false;
- }
- if (!get_required_S32(benefits_sd, "animation_upload_cost", m_animation_upload_cost))
- {
- return false;
- }
- if (!get_required_S32(benefits_sd, "attachment_limit", m_attachment_limit))
- {
- return false;
- }
- if (!get_required_S32(benefits_sd, "create_group_cost", m_create_group_cost))
- {
- return false;
- }
- if (!get_required_S32(benefits_sd, "group_membership_limit", m_group_membership_limit))
- {
- return false;
- }
- if (!get_required_S32(benefits_sd, "picks_limit", m_picks_limit))
- {
- return false;
- }
- if (!get_required_S32(benefits_sd, "sound_upload_cost", m_sound_upload_cost))
- {
- return false;
- }
- if (!get_required_S32(benefits_sd, "texture_upload_cost", m_texture_upload_cost))
- {
- return false;
- }
-
- // FIXME PREMIUM - either use this field or get rid of it
- m_initalized = true;
- return true;
+ LL_DEBUGS("Benefits") << "initializing benefits from " << benefits_sd << LL_ENDL;
+
+ if (!get_required_S32(benefits_sd, "animated_object_limit", m_animated_object_limit))
+ {
+ return false;
+ }
+ if (!get_required_S32(benefits_sd, "animation_upload_cost", m_animation_upload_cost))
+ {
+ return false;
+ }
+ if (!get_required_S32(benefits_sd, "attachment_limit", m_attachment_limit))
+ {
+ return false;
+ }
+ if (!get_required_S32(benefits_sd, "create_group_cost", m_create_group_cost))
+ {
+ return false;
+ }
+ if (!get_required_S32(benefits_sd, "group_membership_limit", m_group_membership_limit))
+ {
+ return false;
+ }
+ if (!get_required_S32(benefits_sd, "picks_limit", m_picks_limit))
+ {
+ return false;
+ }
+ if (!get_required_S32(benefits_sd, "sound_upload_cost", m_sound_upload_cost))
+ {
+ return false;
+ }
+ if (!get_required_S32(benefits_sd, "texture_upload_cost", m_texture_upload_cost))
+ {
+ return false;
+ }
+
+ // FIXME PREMIUM - either use this field or get rid of it
+ m_initalized = true;
+ return true;
}
S32 LLAgentBenefits::getAnimatedObjectLimit() const
{
- return m_animated_object_limit;
+ return m_animated_object_limit;
}
S32 LLAgentBenefits::getAnimationUploadCost() const
{
- return m_animation_upload_cost;
+ return m_animation_upload_cost;
}
S32 LLAgentBenefits::getAttachmentLimit() const
{
- return m_attachment_limit;
+ return m_attachment_limit;
}
S32 LLAgentBenefits::getCreateGroupCost() const
{
- return m_create_group_cost;
+ return m_create_group_cost;
}
S32 LLAgentBenefits::getGroupMembershipLimit() const
{
- return m_group_membership_limit;
+ return m_group_membership_limit;
}
S32 LLAgentBenefits::getPicksLimit() const
{
- return m_picks_limit;
+ return m_picks_limit;
}
S32 LLAgentBenefits::getSoundUploadCost() const
{
- return m_sound_upload_cost;
+ return m_sound_upload_cost;
}
S32 LLAgentBenefits::getTextureUploadCost() const
{
- return m_texture_upload_cost;
+ return m_texture_upload_cost;
}
bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) const
{
- bool succ = false;
- if (asset_type == LLAssetType::AT_TEXTURE)
- {
- cost = getTextureUploadCost();
- succ = true;
- }
- else if (asset_type == LLAssetType::AT_SOUND)
- {
- cost = getSoundUploadCost();
- succ = true;
- }
- else if (asset_type == LLAssetType::AT_ANIMATION)
- {
- cost = getAnimationUploadCost();
- succ = true;
- }
- return succ;
+ bool succ = false;
+ if (asset_type == LLAssetType::AT_TEXTURE)
+ {
+ cost = getTextureUploadCost();
+ succ = true;
+ }
+ else if (asset_type == LLAssetType::AT_SOUND)
+ {
+ cost = getSoundUploadCost();
+ succ = true;
+ }
+ else if (asset_type == LLAssetType::AT_ANIMATION)
+ {
+ cost = getAnimationUploadCost();
+ succ = true;
+ }
+ return succ;
}
LLAgentBenefitsMgr::LLAgentBenefitsMgr()
@@ -172,65 +172,65 @@ LLAgentBenefitsMgr::~LLAgentBenefitsMgr()
// static
const LLAgentBenefits& LLAgentBenefitsMgr::current()
{
- return instance().mCurrent;
+ return instance().mCurrent;
}
// static
const LLAgentBenefits& LLAgentBenefitsMgr::get(const std::string& package)
{
- if (instance().mPackageMap.find(package) != instance().mPackageMap.end())
- {
- return instance().mPackageMap[package];
- }
- else
- {
- return instance().mDefault;
- }
+ if (instance().mPackageMap.find(package) != instance().mPackageMap.end())
+ {
+ return instance().mPackageMap[package];
+ }
+ else
+ {
+ return instance().mDefault;
+ }
}
// static
bool LLAgentBenefitsMgr::init(const std::string& package, const LLSD& benefits_sd)
{
- LLAgentBenefits benefits;
- if (!benefits.init(benefits_sd))
- {
- LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL;
- return false;
- }
- else
- {
- instance().mPackageMap[package] = benefits;
- }
- return true;
+ LLAgentBenefits benefits;
+ if (!benefits.init(benefits_sd))
+ {
+ LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL;
+ return false;
+ }
+ else
+ {
+ instance().mPackageMap[package] = benefits;
+ }
+ return true;
}
// static
bool LLAgentBenefitsMgr::initCurrent(const std::string& package, const LLSD& benefits_sd)
{
- LLAgentBenefits benefits;
- if (!benefits.init(benefits_sd))
- {
- LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL;
- return false;
- }
- else
- {
- instance().mCurrent = benefits;
- instance().mCurrentName = package;
- }
- return true;
+ LLAgentBenefits benefits;
+ if (!benefits.init(benefits_sd))
+ {
+ LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL;
+ return false;
+ }
+ else
+ {
+ instance().mCurrent = benefits;
+ instance().mCurrentName = package;
+ }
+ return true;
}
// static
bool LLAgentBenefitsMgr::has(const std::string& package)
{
- return instance().mPackageMap.find(package) != instance().mPackageMap.end();
+ return instance().mPackageMap.find(package) != instance().mPackageMap.end();
}
//static
bool LLAgentBenefitsMgr::isCurrent(const std::string& package)
{
- return instance().mCurrentName == package;
+ return instance().mCurrentName == package;
}
diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h
index 48aa6bd869..1afc80a6cc 100644
--- a/indra/newview/llagentbenefits.h
+++ b/indra/newview/llagentbenefits.h
@@ -33,55 +33,55 @@
class LLAgentBenefits
{
public:
- LLAgentBenefits();
- ~LLAgentBenefits();
- LOG_CLASS(LLAgentBenefits);
+ LLAgentBenefits();
+ ~LLAgentBenefits();
+ LOG_CLASS(LLAgentBenefits);
- bool init(const LLSD& benefits_sd);
+ bool init(const LLSD& benefits_sd);
- S32 getAnimatedObjectLimit() const;
- S32 getAnimationUploadCost() const;
- S32 getAttachmentLimit() const;
- S32 getCreateGroupCost() const;
- S32 getGroupMembershipLimit() const;
- S32 getPicksLimit() const;
- S32 getSoundUploadCost() const;
- S32 getTextureUploadCost() const;
+ S32 getAnimatedObjectLimit() const;
+ S32 getAnimationUploadCost() const;
+ S32 getAttachmentLimit() const;
+ S32 getCreateGroupCost() const;
+ S32 getGroupMembershipLimit() const;
+ S32 getPicksLimit() const;
+ S32 getSoundUploadCost() const;
+ S32 getTextureUploadCost() const;
+
+ bool findUploadCost(LLAssetType::EType& asset_type, S32& cost) const;
- bool findUploadCost(LLAssetType::EType& asset_type, S32& cost) const;
-
private:
- S32 m_animated_object_limit;
- S32 m_animation_upload_cost;
- S32 m_attachment_limit;
- S32 m_create_group_cost;
- S32 m_group_membership_limit;
- S32 m_picks_limit;
- S32 m_sound_upload_cost;
- S32 m_texture_upload_cost;
+ S32 m_animated_object_limit;
+ S32 m_animation_upload_cost;
+ S32 m_attachment_limit;
+ S32 m_create_group_cost;
+ S32 m_group_membership_limit;
+ S32 m_picks_limit;
+ S32 m_sound_upload_cost;
+ S32 m_texture_upload_cost;
- bool m_initalized;
+ bool m_initalized;
};
-class LLAgentBenefitsMgr: public LLSingleton<LLAgentBenefitsMgr>
+class LLAgentBenefitsMgr: public LLSingleton<LLAgentBenefitsMgr>
{
- LLSINGLETON(LLAgentBenefitsMgr);
- ~LLAgentBenefitsMgr();
- LOG_CLASS(LLAgentBenefitsMgr);
+ LLSINGLETON(LLAgentBenefitsMgr);
+ ~LLAgentBenefitsMgr();
+ LOG_CLASS(LLAgentBenefitsMgr);
public:
- static const LLAgentBenefits& current();
- static const LLAgentBenefits& get(const std::string& package);
- static bool init(const std::string& package, const LLSD& benefits_sd);
- static bool initCurrent(const std::string& package, const LLSD& benefits_sd);
- static bool has(const std::string& package);
- static bool isCurrent(const std::string& package);
+ static const LLAgentBenefits& current();
+ static const LLAgentBenefits& get(const std::string& package);
+ static bool init(const std::string& package, const LLSD& benefits_sd);
+ static bool initCurrent(const std::string& package, const LLSD& benefits_sd);
+ static bool has(const std::string& package);
+ static bool isCurrent(const std::string& package);
private:
- std::string mCurrentName;
- LLAgentBenefits mCurrent;
- LLAgentBenefits mDefault;
- std::map<std::string, LLAgentBenefits> mPackageMap;
+ std::string mCurrentName;
+ LLAgentBenefits mCurrent;
+ LLAgentBenefits mDefault;
+ std::map<std::string, LLAgentBenefits> mPackageMap;
};
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 0d0d6e7e46..e763e797b5 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -1,31 +1,31 @@
-/**
+/**
* @file llagentcamera.cpp
* @brief LLAgent class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
-#include "llagentcamera.h"
+#include "llagentcamera.h"
#include "pipeline.h"
@@ -60,8 +60,8 @@ const F32 MIN_ZOOM_FRACTION = 0.25f;
const F32 INITIAL_ZOOM_FRACTION = 1.f;
const F32 MAX_ZOOM_FRACTION = 8.f;
-const F32 CAMERA_ZOOM_HALF_LIFE = 0.07f; // seconds
-const F32 FOV_ZOOM_HALF_LIFE = 0.07f; // seconds
+const F32 CAMERA_ZOOM_HALF_LIFE = 0.07f; // seconds
+const F32 FOV_ZOOM_HALF_LIFE = 0.07f; // seconds
const F32 CAMERA_FOCUS_HALF_LIFE = 0.f;//0.02f;
const F32 CAMERA_LAG_HALF_LIFE = 0.25f;
@@ -102,8 +102,8 @@ const F32 OBJECT_EXTENTS_PADDING = 0.5f;
static bool isDisableCameraConstraints()
{
- static LLCachedControl<bool> sDisableCameraConstraints(gSavedSettings, "DisableCameraConstraints", false);
- return sDisableCameraConstraints;
+ static LLCachedControl<bool> sDisableCameraConstraints(gSavedSettings, "DisableCameraConstraints", false);
+ return sDisableCameraConstraints;
}
// The agent instance.
@@ -113,84 +113,84 @@ LLAgentCamera gAgentCamera;
// LLAgentCamera()
//-----------------------------------------------------------------------------
LLAgentCamera::LLAgentCamera() :
- mInitialized(false),
-
- mDrawDistance( DEFAULT_FAR_PLANE ),
-
- mLookAt(NULL),
- mPointAt(NULL),
-
- mHUDTargetZoom(1.f),
- mHUDCurZoom(1.f),
-
- mForceMouselook(FALSE),
-
- mCameraMode( CAMERA_MODE_THIRD_PERSON ),
- mLastCameraMode( CAMERA_MODE_THIRD_PERSON ),
-
- mCameraPreset(CAMERA_PRESET_REAR_VIEW),
-
- mCameraAnimating( FALSE ),
- mAnimationCameraStartGlobal(),
- mAnimationFocusStartGlobal(),
- mAnimationTimer(),
- mAnimationDuration(0.33f),
-
- mCameraFOVZoomFactor(0.f),
- mCameraCurrentFOVZoomFactor(0.f),
- mCameraFocusOffset(),
-
- mCameraCollidePlane(),
-
- mCurrentCameraDistance(2.f), // meters, set in init()
- mTargetCameraDistance(2.f),
- mCameraZoomFraction(1.f), // deprecated
- mThirdPersonHeadOffset(0.f, 0.f, 1.f),
- mSitCameraEnabled(FALSE),
- mCameraSmoothingLastPositionGlobal(),
- mCameraSmoothingLastPositionAgent(),
- mCameraSmoothingStop(false),
-
- mCameraUpVector(LLVector3::z_axis), // default is straight up
-
- mFocusOnAvatar(TRUE),
- mAllowChangeToFollow(FALSE),
- mFocusGlobal(),
- mFocusTargetGlobal(),
- mFocusObject(NULL),
- mFocusObjectDist(0.f),
- mFocusObjectOffset(),
- mTrackFocusObject(TRUE),
-
- mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed
- mWalkKey(0), // like AtKey, but causes less forward thrust
- mLeftKey(0),
- mUpKey(0),
- mYawKey(0.f),
- mPitchKey(0.f),
-
- mOrbitLeftKey(0.f),
- mOrbitRightKey(0.f),
- mOrbitUpKey(0.f),
- mOrbitDownKey(0.f),
- mOrbitInKey(0.f),
- mOrbitOutKey(0.f),
-
- mPanUpKey(0.f),
- mPanDownKey(0.f),
- mPanLeftKey(0.f),
- mPanRightKey(0.f),
- mPanInKey(0.f),
- mPanOutKey(0.f)
-{
- mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT );
-
- clearGeneralKeys();
- clearOrbitKeys();
- clearPanKeys();
-
- resetPanDiff();
- resetOrbitDiff();
+ mInitialized(false),
+
+ mDrawDistance( DEFAULT_FAR_PLANE ),
+
+ mLookAt(NULL),
+ mPointAt(NULL),
+
+ mHUDTargetZoom(1.f),
+ mHUDCurZoom(1.f),
+
+ mForceMouselook(FALSE),
+
+ mCameraMode( CAMERA_MODE_THIRD_PERSON ),
+ mLastCameraMode( CAMERA_MODE_THIRD_PERSON ),
+
+ mCameraPreset(CAMERA_PRESET_REAR_VIEW),
+
+ mCameraAnimating( FALSE ),
+ mAnimationCameraStartGlobal(),
+ mAnimationFocusStartGlobal(),
+ mAnimationTimer(),
+ mAnimationDuration(0.33f),
+
+ mCameraFOVZoomFactor(0.f),
+ mCameraCurrentFOVZoomFactor(0.f),
+ mCameraFocusOffset(),
+
+ mCameraCollidePlane(),
+
+ mCurrentCameraDistance(2.f), // meters, set in init()
+ mTargetCameraDistance(2.f),
+ mCameraZoomFraction(1.f), // deprecated
+ mThirdPersonHeadOffset(0.f, 0.f, 1.f),
+ mSitCameraEnabled(FALSE),
+ mCameraSmoothingLastPositionGlobal(),
+ mCameraSmoothingLastPositionAgent(),
+ mCameraSmoothingStop(false),
+
+ mCameraUpVector(LLVector3::z_axis), // default is straight up
+
+ mFocusOnAvatar(TRUE),
+ mAllowChangeToFollow(FALSE),
+ mFocusGlobal(),
+ mFocusTargetGlobal(),
+ mFocusObject(NULL),
+ mFocusObjectDist(0.f),
+ mFocusObjectOffset(),
+ mTrackFocusObject(TRUE),
+
+ mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed
+ mWalkKey(0), // like AtKey, but causes less forward thrust
+ mLeftKey(0),
+ mUpKey(0),
+ mYawKey(0.f),
+ mPitchKey(0.f),
+
+ mOrbitLeftKey(0.f),
+ mOrbitRightKey(0.f),
+ mOrbitUpKey(0.f),
+ mOrbitDownKey(0.f),
+ mOrbitInKey(0.f),
+ mOrbitOutKey(0.f),
+
+ mPanUpKey(0.f),
+ mPanDownKey(0.f),
+ mPanLeftKey(0.f),
+ mPanRightKey(0.f),
+ mPanInKey(0.f),
+ mPanOutKey(0.f)
+{
+ mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT );
+
+ clearGeneralKeys();
+ clearOrbitKeys();
+ clearPanKeys();
+
+ resetPanDiff();
+ resetOrbitDiff();
}
// Requires gSavedSettings to be initialized.
@@ -199,28 +199,28 @@ LLAgentCamera::LLAgentCamera() :
//-----------------------------------------------------------------------------
void LLAgentCamera::init()
{
- // *Note: this is where LLViewerCamera::getInstance() used to be constructed.
+ // *Note: this is where LLViewerCamera::getInstance() used to be constructed.
+
+ mDrawDistance = gSavedSettings.getF32("RenderFarClip");
- mDrawDistance = gSavedSettings.getF32("RenderFarClip");
+ LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW);
+ // Leave at 0.1 meters until we have real near clip management
+ LLViewerCamera::getInstance()->setNear(0.1f);
+ LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h
+ LLViewerCamera::getInstance()->setAspect( gViewerWindow->getWorldViewAspectRatio() ); // default, overridden in LLViewerWindow::reshape
+ LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape
- LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW);
- // Leave at 0.1 meters until we have real near clip management
- LLViewerCamera::getInstance()->setNear(0.1f);
- LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h
- LLViewerCamera::getInstance()->setAspect( gViewerWindow->getWorldViewAspectRatio() ); // default, overridden in LLViewerWindow::reshape
- LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape
+ mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild"));
- mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild"));
-
- mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPresetType");
+ mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPresetType");
- mCameraCollidePlane.clearVec();
- mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale");
- mTargetCameraDistance = mCurrentCameraDistance;
- mCameraZoomFraction = 1.f;
- mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject");
+ mCameraCollidePlane.clearVec();
+ mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale");
+ mTargetCameraDistance = mCurrentCameraDistance;
+ mCameraZoomFraction = 1.f;
+ mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject");
- mInitialized = true;
+ mInitialized = true;
}
//-----------------------------------------------------------------------------
@@ -228,40 +228,40 @@ void LLAgentCamera::init()
//-----------------------------------------------------------------------------
void LLAgentCamera::cleanup()
{
- setSitCamera(LLUUID::null);
+ setSitCamera(LLUUID::null);
- if(mLookAt)
- {
- mLookAt->markDead() ;
- mLookAt = NULL;
- }
- if(mPointAt)
- {
- mPointAt->markDead() ;
- mPointAt = NULL;
- }
- setFocusObject(NULL);
+ if(mLookAt)
+ {
+ mLookAt->markDead() ;
+ mLookAt = NULL;
+ }
+ if(mPointAt)
+ {
+ mPointAt->markDead() ;
+ mPointAt = NULL;
+ }
+ setFocusObject(NULL);
}
void LLAgentCamera::setAvatarObject(LLVOAvatarSelf* avatar)
{
- if (!mLookAt)
- {
- mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT);
- }
- if (!mPointAt)
- {
- mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT);
- }
-
- if (!mLookAt.isNull())
- {
- mLookAt->setSourceObject(avatar);
- }
- if (!mPointAt.isNull())
- {
- mPointAt->setSourceObject(avatar);
- }
+ if (!mLookAt)
+ {
+ mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT);
+ }
+ if (!mPointAt)
+ {
+ mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT);
+ }
+
+ if (!mLookAt.isNull())
+ {
+ mLookAt->setSourceObject(avatar);
+ }
+ if (!mPointAt.isNull())
+ {
+ mPointAt->setSourceObject(avatar);
+ }
}
//-----------------------------------------------------------------------------
@@ -269,9 +269,9 @@ void LLAgentCamera::setAvatarObject(LLVOAvatarSelf* avatar)
//-----------------------------------------------------------------------------
LLAgentCamera::~LLAgentCamera()
{
- cleanup();
+ cleanup();
- // *Note: this is where LLViewerCamera::getInstance() used to be deleted.
+ // *Note: this is where LLViewerCamera::getInstance() used to be deleted.
}
// Change camera back to third person, stop the autopilot,
@@ -281,80 +281,80 @@ LLAgentCamera::~LLAgentCamera()
//-----------------------------------------------------------------------------
void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera)
{
- if (gDisconnected)
- {
- return;
- }
-
- if (gAgent.getAutoPilot())
- {
- gAgent.stopAutoPilot(TRUE);
- }
-
- LLSelectMgr::getInstance()->unhighlightAll();
-
- // By popular request, keep land selection while walking around. JC
- // LLViewerParcelMgr::getInstance()->deselectLand();
-
- // force deselect when walking and attachment is selected
- // this is so people don't wig out when their avatar moves without animating
- if (LLSelectMgr::getInstance()->getSelection()->isAttachment())
- {
- LLSelectMgr::getInstance()->deselectAll();
- }
-
- if (gMenuHolder != NULL)
- {
- // Hide all popup menus
- gMenuHolder->hideMenus();
- }
-
- if (change_camera && !gSavedSettings.getBOOL("FreezeTime"))
- {
- changeCameraToDefault();
-
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- handle_toggle_flycam();
- }
-
- // reset avatar mode from eventual residual motion
- if (LLToolMgr::getInstance()->inBuildMode())
- {
- LLViewerJoystick::getInstance()->moveAvatar(true);
- }
-
- //Camera Tool is needed for Free Camera Control Mode
- if (!LLFloaterCamera::inFreeCameraMode())
- {
- LLFloaterReg::hideInstance("build");
-
- // Switch back to basic toolset
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- }
-
- gViewerWindow->showCursor();
- }
-
-
- if (reset_camera && !gSavedSettings.getBOOL("FreezeTime"))
- {
- if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson())
- {
- // leaving mouse-steer mode
- LLVector3 agent_at_axis = gAgent.getAtAxis();
- agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector());
- agent_at_axis.normalize();
- gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f)));
- }
-
- setFocusOnAvatar(TRUE, ANIMATE);
-
- mCameraFOVZoomFactor = 0.f;
- }
- resetPanDiff();
- resetOrbitDiff();
- mHUDTargetZoom = 1.f;
+ if (gDisconnected)
+ {
+ return;
+ }
+
+ if (gAgent.getAutoPilot())
+ {
+ gAgent.stopAutoPilot(TRUE);
+ }
+
+ LLSelectMgr::getInstance()->unhighlightAll();
+
+ // By popular request, keep land selection while walking around. JC
+ // LLViewerParcelMgr::getInstance()->deselectLand();
+
+ // force deselect when walking and attachment is selected
+ // this is so people don't wig out when their avatar moves without animating
+ if (LLSelectMgr::getInstance()->getSelection()->isAttachment())
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+
+ if (gMenuHolder != NULL)
+ {
+ // Hide all popup menus
+ gMenuHolder->hideMenus();
+ }
+
+ if (change_camera && !gSavedSettings.getBOOL("FreezeTime"))
+ {
+ changeCameraToDefault();
+
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ handle_toggle_flycam();
+ }
+
+ // reset avatar mode from eventual residual motion
+ if (LLToolMgr::getInstance()->inBuildMode())
+ {
+ LLViewerJoystick::getInstance()->moveAvatar(true);
+ }
+
+ //Camera Tool is needed for Free Camera Control Mode
+ if (!LLFloaterCamera::inFreeCameraMode())
+ {
+ LLFloaterReg::hideInstance("build");
+
+ // Switch back to basic toolset
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ }
+
+ gViewerWindow->showCursor();
+ }
+
+
+ if (reset_camera && !gSavedSettings.getBOOL("FreezeTime"))
+ {
+ if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson())
+ {
+ // leaving mouse-steer mode
+ LLVector3 agent_at_axis = gAgent.getAtAxis();
+ agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector());
+ agent_at_axis.normalize();
+ gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f)));
+ }
+
+ setFocusOnAvatar(TRUE, ANIMATE);
+
+ mCameraFOVZoomFactor = 0.f;
+ }
+ resetPanDiff();
+ resetOrbitDiff();
+ mHUDTargetZoom = 1.f;
if (LLSelectMgr::getInstance()->mAllowSelectAvatar)
{
@@ -375,14 +375,14 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera)
//-----------------------------------------------------------------------------
void LLAgentCamera::unlockView()
{
- if (getFocusOnAvatar())
- {
- if (isAgentAvatarValid())
- {
- setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID);
- }
- setFocusOnAvatar(FALSE, FALSE); // no animation
- }
+ if (getFocusOnAvatar())
+ {
+ if (isAgentAvatarValid())
+ {
+ setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID);
+ }
+ setFocusOnAvatar(FALSE, FALSE); // no animation
+ }
}
//-----------------------------------------------------------------------------
@@ -390,10 +390,10 @@ void LLAgentCamera::unlockView()
//-----------------------------------------------------------------------------
void LLAgentCamera::slamLookAt(const LLVector3 &look_at)
{
- LLVector3 look_at_norm = look_at;
- look_at_norm.mV[VZ] = 0.f;
- look_at_norm.normalize();
- gAgent.resetAxes(look_at_norm);
+ LLVector3 look_at_norm = look_at;
+ look_at_norm.mV[VZ] = 0.f;
+ look_at_norm.normalize();
+ gAgent.resetAxes(look_at_norm);
}
//-----------------------------------------------------------------------------
@@ -401,172 +401,172 @@ void LLAgentCamera::slamLookAt(const LLVector3 &look_at)
//-----------------------------------------------------------------------------
LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 original_focus_point, S32 x, S32 y)
{
- LLMatrix4 obj_matrix = object->getRenderMatrix();
- LLQuaternion obj_rot = object->getRenderRotation();
- LLVector3 obj_pos = object->getRenderPosition();
+ LLMatrix4 obj_matrix = object->getRenderMatrix();
+ LLQuaternion obj_rot = object->getRenderRotation();
+ LLVector3 obj_pos = object->getRenderPosition();
- // if is avatar - don't do any funk heuristics to position the focal point
- // see DEV-30589
- if ((object->isAvatar() && !object->isRoot()) || (object->isAnimatedObject() && object->getControlAvatar()))
- {
- return original_focus_point - obj_pos;
- }
+ // if is avatar - don't do any funk heuristics to position the focal point
+ // see DEV-30589
+ if ((object->isAvatar() && !object->isRoot()) || (object->isAnimatedObject() && object->getControlAvatar()))
+ {
+ return original_focus_point - obj_pos;
+ }
if (object->isAvatar())
{
LLVOAvatar* av = object->asAvatar();
return original_focus_point - av->getCharacterPosition();
}
-
- LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation
- LLVector3 object_extents = object->getScale();
-
- // make sure they object extents are non-zero
- object_extents.clamp(0.001f, F32_MAX);
-
- // obj_to_cam_ray is unit vector pointing from object center to camera, in the coordinate frame of the object
- LLVector3 obj_to_cam_ray = obj_pos - LLViewerCamera::getInstance()->getOrigin();
- obj_to_cam_ray.rotVec(inv_obj_rot);
- obj_to_cam_ray.normalize();
-
- // obj_to_cam_ray_proportions are the (positive) ratios of
- // the obj_to_cam_ray x,y,z components with the x,y,z object dimensions.
- LLVector3 obj_to_cam_ray_proportions;
- obj_to_cam_ray_proportions.mV[VX] = llabs(obj_to_cam_ray.mV[VX] / object_extents.mV[VX]);
- obj_to_cam_ray_proportions.mV[VY] = llabs(obj_to_cam_ray.mV[VY] / object_extents.mV[VY]);
- obj_to_cam_ray_proportions.mV[VZ] = llabs(obj_to_cam_ray.mV[VZ] / object_extents.mV[VZ]);
-
- // find the largest ratio stored in obj_to_cam_ray_proportions
- // this corresponds to the object's local axial plane (XY, YZ, XZ) that is *most* facing the camera
- LLVector3 longest_object_axis;
- // is x-axis longest?
- if (obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VY]
- && obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VZ])
- {
- // then grab it
- longest_object_axis.setVec(obj_matrix.getFwdRow4());
- }
- // is y-axis longest?
- else if (obj_to_cam_ray_proportions.mV[VY] > obj_to_cam_ray_proportions.mV[VZ])
- {
- // then grab it
- longest_object_axis.setVec(obj_matrix.getLeftRow4());
- }
- // otherwise, use z axis
- else
- {
- longest_object_axis.setVec(obj_matrix.getUpRow4());
- }
-
- // Use this axis as the normal to project mouse click on to plane with that normal, at the object center.
- // This generates a point behind the mouse cursor that is approximately in the middle of the object in
- // terms of depth.
- // We do this to allow the camera rotation tool to "tumble" the object by rotating the camera.
- // If the focus point were the object surface under the mouse, camera rotation would introduce an undesirable
- // eccentricity to the object orientation
- LLVector3 focus_plane_normal(longest_object_axis);
- focus_plane_normal.normalize();
-
- LLVector3d focus_pt_global;
- gViewerWindow->mousePointOnPlaneGlobal(focus_pt_global, x, y, gAgent.getPosGlobalFromAgent(obj_pos), focus_plane_normal);
- LLVector3 focus_pt = gAgent.getPosAgentFromGlobal(focus_pt_global);
-
- // find vector from camera to focus point in object space
- LLVector3 camera_to_focus_vec = focus_pt - LLViewerCamera::getInstance()->getOrigin();
- camera_to_focus_vec.rotVec(inv_obj_rot);
-
- // find vector from object origin to focus point in object coordinates
- LLVector3 focus_offset_from_object_center = focus_pt - obj_pos;
- // convert to object-local space
- focus_offset_from_object_center.rotVec(inv_obj_rot);
-
- // We need to project the focus point back into the bounding box of the focused object.
- // Do this by calculating the XYZ scale factors needed to get focus offset back in bounds along the camera_focus axis
- LLVector3 clip_fraction;
-
- // for each axis...
- for (U32 axis = VX; axis <= VZ; axis++)
- {
- //...calculate distance that focus offset sits outside of bounding box along that axis...
- //NOTE: dist_out_of_bounds keeps the sign of focus_offset_from_object_center
- F32 dist_out_of_bounds;
- if (focus_offset_from_object_center.mV[axis] > 0.f)
- {
- dist_out_of_bounds = llmax(0.f, focus_offset_from_object_center.mV[axis] - (object_extents.mV[axis] * 0.5f));
- }
- else
- {
- dist_out_of_bounds = llmin(0.f, focus_offset_from_object_center.mV[axis] + (object_extents.mV[axis] * 0.5f));
- }
-
- //...then calculate the scale factor needed to push camera_to_focus_vec back in bounds along current axis
- if (llabs(camera_to_focus_vec.mV[axis]) < 0.0001f)
- {
- // don't divide by very small number
- clip_fraction.mV[axis] = 0.f;
- }
- else
- {
- clip_fraction.mV[axis] = dist_out_of_bounds / camera_to_focus_vec.mV[axis];
- }
- }
-
- LLVector3 abs_clip_fraction = clip_fraction;
- abs_clip_fraction.abs();
-
- // find axis of focus offset that is *most* outside the bounding box and use that to
- // rescale focus offset to inside object extents
- if (abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VY]
- && abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VZ])
- {
- focus_offset_from_object_center -= clip_fraction.mV[VX] * camera_to_focus_vec;
- }
- else if (abs_clip_fraction.mV[VY] > abs_clip_fraction.mV[VZ])
- {
- focus_offset_from_object_center -= clip_fraction.mV[VY] * camera_to_focus_vec;
- }
- else
- {
- focus_offset_from_object_center -= clip_fraction.mV[VZ] * camera_to_focus_vec;
- }
-
- // convert back to world space
- focus_offset_from_object_center.rotVec(obj_rot);
-
- // now, based on distance of camera from object relative to object size
- // push the focus point towards the near surface of the object when (relatively) close to the objcet
- // or keep the focus point in the object middle when (relatively) far
- // NOTE: leave focus point in middle of avatars, since the behavior you want when alt-zooming on avatars
- // is almost always "tumble about middle" and not "spin around surface point"
- {
- LLVector3 obj_rel = original_focus_point - object->getRenderPosition();
-
- //now that we have the object relative position, we should bias toward the center of the object
- //based on the distance of the camera to the focus point vs. the distance of the camera to the focus
-
- F32 relDist = llabs(obj_rel * LLViewerCamera::getInstance()->getAtAxis());
- F32 viewDist = dist_vec(obj_pos + obj_rel, LLViewerCamera::getInstance()->getOrigin());
-
-
- LLBBox obj_bbox = object->getBoundingBoxAgent();
- F32 bias = 0.f;
-
- // virtual_camera_pos is the camera position we are simulating by backing the camera off
- // and adjusting the FOV
- LLVector3 virtual_camera_pos = gAgent.getPosAgentFromGlobal(mFocusTargetGlobal + (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor));
-
- // if the camera is inside the object (large, hollow objects, for example)
- // leave focus point all the way to destination depth, away from object center
- if(!obj_bbox.containsPointAgent(virtual_camera_pos))
- {
- // perform magic number biasing of focus point towards surface vs. planar center
- bias = clamp_rescale(relDist/viewDist, 0.1f, 0.7f, 0.0f, 1.0f);
- obj_rel = lerp(focus_offset_from_object_center, obj_rel, bias);
- }
-
- focus_offset_from_object_center = obj_rel;
- }
-
- return focus_offset_from_object_center;
+
+ LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation
+ LLVector3 object_extents = object->getScale();
+
+ // make sure they object extents are non-zero
+ object_extents.clamp(0.001f, F32_MAX);
+
+ // obj_to_cam_ray is unit vector pointing from object center to camera, in the coordinate frame of the object
+ LLVector3 obj_to_cam_ray = obj_pos - LLViewerCamera::getInstance()->getOrigin();
+ obj_to_cam_ray.rotVec(inv_obj_rot);
+ obj_to_cam_ray.normalize();
+
+ // obj_to_cam_ray_proportions are the (positive) ratios of
+ // the obj_to_cam_ray x,y,z components with the x,y,z object dimensions.
+ LLVector3 obj_to_cam_ray_proportions;
+ obj_to_cam_ray_proportions.mV[VX] = llabs(obj_to_cam_ray.mV[VX] / object_extents.mV[VX]);
+ obj_to_cam_ray_proportions.mV[VY] = llabs(obj_to_cam_ray.mV[VY] / object_extents.mV[VY]);
+ obj_to_cam_ray_proportions.mV[VZ] = llabs(obj_to_cam_ray.mV[VZ] / object_extents.mV[VZ]);
+
+ // find the largest ratio stored in obj_to_cam_ray_proportions
+ // this corresponds to the object's local axial plane (XY, YZ, XZ) that is *most* facing the camera
+ LLVector3 longest_object_axis;
+ // is x-axis longest?
+ if (obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VY]
+ && obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VZ])
+ {
+ // then grab it
+ longest_object_axis.setVec(obj_matrix.getFwdRow4());
+ }
+ // is y-axis longest?
+ else if (obj_to_cam_ray_proportions.mV[VY] > obj_to_cam_ray_proportions.mV[VZ])
+ {
+ // then grab it
+ longest_object_axis.setVec(obj_matrix.getLeftRow4());
+ }
+ // otherwise, use z axis
+ else
+ {
+ longest_object_axis.setVec(obj_matrix.getUpRow4());
+ }
+
+ // Use this axis as the normal to project mouse click on to plane with that normal, at the object center.
+ // This generates a point behind the mouse cursor that is approximately in the middle of the object in
+ // terms of depth.
+ // We do this to allow the camera rotation tool to "tumble" the object by rotating the camera.
+ // If the focus point were the object surface under the mouse, camera rotation would introduce an undesirable
+ // eccentricity to the object orientation
+ LLVector3 focus_plane_normal(longest_object_axis);
+ focus_plane_normal.normalize();
+
+ LLVector3d focus_pt_global;
+ gViewerWindow->mousePointOnPlaneGlobal(focus_pt_global, x, y, gAgent.getPosGlobalFromAgent(obj_pos), focus_plane_normal);
+ LLVector3 focus_pt = gAgent.getPosAgentFromGlobal(focus_pt_global);
+
+ // find vector from camera to focus point in object space
+ LLVector3 camera_to_focus_vec = focus_pt - LLViewerCamera::getInstance()->getOrigin();
+ camera_to_focus_vec.rotVec(inv_obj_rot);
+
+ // find vector from object origin to focus point in object coordinates
+ LLVector3 focus_offset_from_object_center = focus_pt - obj_pos;
+ // convert to object-local space
+ focus_offset_from_object_center.rotVec(inv_obj_rot);
+
+ // We need to project the focus point back into the bounding box of the focused object.
+ // Do this by calculating the XYZ scale factors needed to get focus offset back in bounds along the camera_focus axis
+ LLVector3 clip_fraction;
+
+ // for each axis...
+ for (U32 axis = VX; axis <= VZ; axis++)
+ {
+ //...calculate distance that focus offset sits outside of bounding box along that axis...
+ //NOTE: dist_out_of_bounds keeps the sign of focus_offset_from_object_center
+ F32 dist_out_of_bounds;
+ if (focus_offset_from_object_center.mV[axis] > 0.f)
+ {
+ dist_out_of_bounds = llmax(0.f, focus_offset_from_object_center.mV[axis] - (object_extents.mV[axis] * 0.5f));
+ }
+ else
+ {
+ dist_out_of_bounds = llmin(0.f, focus_offset_from_object_center.mV[axis] + (object_extents.mV[axis] * 0.5f));
+ }
+
+ //...then calculate the scale factor needed to push camera_to_focus_vec back in bounds along current axis
+ if (llabs(camera_to_focus_vec.mV[axis]) < 0.0001f)
+ {
+ // don't divide by very small number
+ clip_fraction.mV[axis] = 0.f;
+ }
+ else
+ {
+ clip_fraction.mV[axis] = dist_out_of_bounds / camera_to_focus_vec.mV[axis];
+ }
+ }
+
+ LLVector3 abs_clip_fraction = clip_fraction;
+ abs_clip_fraction.abs();
+
+ // find axis of focus offset that is *most* outside the bounding box and use that to
+ // rescale focus offset to inside object extents
+ if (abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VY]
+ && abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VZ])
+ {
+ focus_offset_from_object_center -= clip_fraction.mV[VX] * camera_to_focus_vec;
+ }
+ else if (abs_clip_fraction.mV[VY] > abs_clip_fraction.mV[VZ])
+ {
+ focus_offset_from_object_center -= clip_fraction.mV[VY] * camera_to_focus_vec;
+ }
+ else
+ {
+ focus_offset_from_object_center -= clip_fraction.mV[VZ] * camera_to_focus_vec;
+ }
+
+ // convert back to world space
+ focus_offset_from_object_center.rotVec(obj_rot);
+
+ // now, based on distance of camera from object relative to object size
+ // push the focus point towards the near surface of the object when (relatively) close to the objcet
+ // or keep the focus point in the object middle when (relatively) far
+ // NOTE: leave focus point in middle of avatars, since the behavior you want when alt-zooming on avatars
+ // is almost always "tumble about middle" and not "spin around surface point"
+ {
+ LLVector3 obj_rel = original_focus_point - object->getRenderPosition();
+
+ //now that we have the object relative position, we should bias toward the center of the object
+ //based on the distance of the camera to the focus point vs. the distance of the camera to the focus
+
+ F32 relDist = llabs(obj_rel * LLViewerCamera::getInstance()->getAtAxis());
+ F32 viewDist = dist_vec(obj_pos + obj_rel, LLViewerCamera::getInstance()->getOrigin());
+
+
+ LLBBox obj_bbox = object->getBoundingBoxAgent();
+ F32 bias = 0.f;
+
+ // virtual_camera_pos is the camera position we are simulating by backing the camera off
+ // and adjusting the FOV
+ LLVector3 virtual_camera_pos = gAgent.getPosAgentFromGlobal(mFocusTargetGlobal + (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor));
+
+ // if the camera is inside the object (large, hollow objects, for example)
+ // leave focus point all the way to destination depth, away from object center
+ if(!obj_bbox.containsPointAgent(virtual_camera_pos))
+ {
+ // perform magic number biasing of focus point towards surface vs. planar center
+ bias = clamp_rescale(relDist/viewDist, 0.1f, 0.7f, 0.0f, 1.0f);
+ obj_rel = lerp(focus_offset_from_object_center, obj_rel, bias);
+ }
+
+ focus_offset_from_object_center = obj_rel;
+ }
+
+ return focus_offset_from_object_center;
}
//-----------------------------------------------------------------------------
@@ -574,277 +574,277 @@ LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 origi
//-----------------------------------------------------------------------------
BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance)
{
- BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars)
+ BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars)
- if (!mFocusObject || mFocusObject->isDead() ||
- mFocusObject->isMesh() ||
- isDisableCameraConstraints())
- {
- obj_min_distance = 0.f;
- return TRUE;
- }
+ if (!mFocusObject || mFocusObject->isDead() ||
+ mFocusObject->isMesh() ||
+ isDisableCameraConstraints())
+ {
+ obj_min_distance = 0.f;
+ return TRUE;
+ }
- if (mFocusObject->mDrawable.isNull())
- {
+ if (mFocusObject->mDrawable.isNull())
+ {
#ifdef LL_RELEASE_FOR_DOWNLOAD
- LL_WARNS() << "Focus object with no drawable!" << LL_ENDL;
+ LL_WARNS() << "Focus object with no drawable!" << LL_ENDL;
#else
- mFocusObject->dump();
- LL_ERRS() << "Focus object with no drawable!" << LL_ENDL;
+ mFocusObject->dump();
+ LL_ERRS() << "Focus object with no drawable!" << LL_ENDL;
#endif
- obj_min_distance = 0.f;
- return TRUE;
- }
-
- LLQuaternion inv_object_rot = ~mFocusObject->getRenderRotation();
- LLVector3 target_offset_origin = mFocusObjectOffset;
- LLVector3 camera_offset_target(getCameraPositionAgent() - gAgent.getPosAgentFromGlobal(mFocusTargetGlobal));
-
- // convert offsets into object local space
- camera_offset_target.rotVec(inv_object_rot);
- target_offset_origin.rotVec(inv_object_rot);
-
- // push around object extents based on target offset
- LLVector3 object_extents = mFocusObject->getScale();
- if (mFocusObject->isAvatar())
- {
- // fudge factors that lets you zoom in on avatars a bit more (which don't do FOV zoom)
- object_extents.mV[VX] *= AVATAR_ZOOM_MIN_X_FACTOR;
- object_extents.mV[VY] *= AVATAR_ZOOM_MIN_Y_FACTOR;
- object_extents.mV[VZ] *= AVATAR_ZOOM_MIN_Z_FACTOR;
- soft_limit = TRUE;
- }
- LLVector3 abs_target_offset = target_offset_origin;
- abs_target_offset.abs();
-
- LLVector3 target_offset_dir = target_offset_origin;
-
- BOOL target_outside_object_extents = FALSE;
-
- for (U32 i = VX; i <= VZ; i++)
- {
- if (abs_target_offset.mV[i] * 2.f > object_extents.mV[i] + OBJECT_EXTENTS_PADDING)
- {
- target_outside_object_extents = TRUE;
- }
- if (camera_offset_target.mV[i] > 0.f)
- {
- object_extents.mV[i] -= target_offset_origin.mV[i] * 2.f;
- }
- else
- {
- object_extents.mV[i] += target_offset_origin.mV[i] * 2.f;
- }
- }
-
- // don't shrink the object extents so far that the object inverts
- object_extents.clamp(0.001f, F32_MAX);
-
- // move into first octant
- LLVector3 camera_offset_target_abs_norm = camera_offset_target;
- camera_offset_target_abs_norm.abs();
- // make sure offset is non-zero
- camera_offset_target_abs_norm.clamp(0.001f, F32_MAX);
- camera_offset_target_abs_norm.normalize();
-
- // find camera position relative to normalized object extents
- LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm;
- camera_offset_target_scaled.mV[VX] /= object_extents.mV[VX];
- camera_offset_target_scaled.mV[VY] /= object_extents.mV[VY];
- camera_offset_target_scaled.mV[VZ] /= object_extents.mV[VZ];
-
- if (camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VY] &&
- camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VZ])
- {
- if (camera_offset_target_abs_norm.mV[VX] < 0.001f)
- {
- obj_min_distance = object_extents.mV[VX] * 0.5f;
- }
- else
- {
- obj_min_distance = object_extents.mV[VX] * 0.5f / camera_offset_target_abs_norm.mV[VX];
- }
- }
- else if (camera_offset_target_scaled.mV[VY] > camera_offset_target_scaled.mV[VZ])
- {
- if (camera_offset_target_abs_norm.mV[VY] < 0.001f)
- {
- obj_min_distance = object_extents.mV[VY] * 0.5f;
- }
- else
- {
- obj_min_distance = object_extents.mV[VY] * 0.5f / camera_offset_target_abs_norm.mV[VY];
- }
- }
- else
- {
- if (camera_offset_target_abs_norm.mV[VZ] < 0.001f)
- {
- obj_min_distance = object_extents.mV[VZ] * 0.5f;
- }
- else
- {
- obj_min_distance = object_extents.mV[VZ] * 0.5f / camera_offset_target_abs_norm.mV[VZ];
- }
- }
-
- LLVector3 object_split_axis;
- LLVector3 target_offset_scaled = target_offset_origin;
- target_offset_scaled.abs();
- target_offset_scaled.normalize();
- target_offset_scaled.mV[VX] /= object_extents.mV[VX];
- target_offset_scaled.mV[VY] /= object_extents.mV[VY];
- target_offset_scaled.mV[VZ] /= object_extents.mV[VZ];
-
- if (target_offset_scaled.mV[VX] > target_offset_scaled.mV[VY] &&
- target_offset_scaled.mV[VX] > target_offset_scaled.mV[VZ])
- {
- object_split_axis = LLVector3::x_axis;
- }
- else if (target_offset_scaled.mV[VY] > target_offset_scaled.mV[VZ])
- {
- object_split_axis = LLVector3::y_axis;
- }
- else
- {
- object_split_axis = LLVector3::z_axis;
- }
-
- LLVector3 camera_offset_object(getCameraPositionAgent() - mFocusObject->getPositionAgent());
-
-
- F32 camera_offset_clip = camera_offset_object * object_split_axis;
- F32 target_offset_clip = target_offset_dir * object_split_axis;
-
- // target has moved outside of object extents
- // check to see if camera and target are on same side
- if (target_outside_object_extents)
- {
- if (camera_offset_clip > 0.f && target_offset_clip > 0.f)
- {
- return FALSE;
- }
- else if (camera_offset_clip < 0.f && target_offset_clip < 0.f)
- {
- return FALSE;
- }
- }
-
- // clamp obj distance to diagonal of 10 by 10 cube
- obj_min_distance = llmin(obj_min_distance, 10.f * F_SQRT3);
-
- obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f);
-
- return TRUE;
+ obj_min_distance = 0.f;
+ return TRUE;
+ }
+
+ LLQuaternion inv_object_rot = ~mFocusObject->getRenderRotation();
+ LLVector3 target_offset_origin = mFocusObjectOffset;
+ LLVector3 camera_offset_target(getCameraPositionAgent() - gAgent.getPosAgentFromGlobal(mFocusTargetGlobal));
+
+ // convert offsets into object local space
+ camera_offset_target.rotVec(inv_object_rot);
+ target_offset_origin.rotVec(inv_object_rot);
+
+ // push around object extents based on target offset
+ LLVector3 object_extents = mFocusObject->getScale();
+ if (mFocusObject->isAvatar())
+ {
+ // fudge factors that lets you zoom in on avatars a bit more (which don't do FOV zoom)
+ object_extents.mV[VX] *= AVATAR_ZOOM_MIN_X_FACTOR;
+ object_extents.mV[VY] *= AVATAR_ZOOM_MIN_Y_FACTOR;
+ object_extents.mV[VZ] *= AVATAR_ZOOM_MIN_Z_FACTOR;
+ soft_limit = TRUE;
+ }
+ LLVector3 abs_target_offset = target_offset_origin;
+ abs_target_offset.abs();
+
+ LLVector3 target_offset_dir = target_offset_origin;
+
+ BOOL target_outside_object_extents = FALSE;
+
+ for (U32 i = VX; i <= VZ; i++)
+ {
+ if (abs_target_offset.mV[i] * 2.f > object_extents.mV[i] + OBJECT_EXTENTS_PADDING)
+ {
+ target_outside_object_extents = TRUE;
+ }
+ if (camera_offset_target.mV[i] > 0.f)
+ {
+ object_extents.mV[i] -= target_offset_origin.mV[i] * 2.f;
+ }
+ else
+ {
+ object_extents.mV[i] += target_offset_origin.mV[i] * 2.f;
+ }
+ }
+
+ // don't shrink the object extents so far that the object inverts
+ object_extents.clamp(0.001f, F32_MAX);
+
+ // move into first octant
+ LLVector3 camera_offset_target_abs_norm = camera_offset_target;
+ camera_offset_target_abs_norm.abs();
+ // make sure offset is non-zero
+ camera_offset_target_abs_norm.clamp(0.001f, F32_MAX);
+ camera_offset_target_abs_norm.normalize();
+
+ // find camera position relative to normalized object extents
+ LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm;
+ camera_offset_target_scaled.mV[VX] /= object_extents.mV[VX];
+ camera_offset_target_scaled.mV[VY] /= object_extents.mV[VY];
+ camera_offset_target_scaled.mV[VZ] /= object_extents.mV[VZ];
+
+ if (camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VY] &&
+ camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VZ])
+ {
+ if (camera_offset_target_abs_norm.mV[VX] < 0.001f)
+ {
+ obj_min_distance = object_extents.mV[VX] * 0.5f;
+ }
+ else
+ {
+ obj_min_distance = object_extents.mV[VX] * 0.5f / camera_offset_target_abs_norm.mV[VX];
+ }
+ }
+ else if (camera_offset_target_scaled.mV[VY] > camera_offset_target_scaled.mV[VZ])
+ {
+ if (camera_offset_target_abs_norm.mV[VY] < 0.001f)
+ {
+ obj_min_distance = object_extents.mV[VY] * 0.5f;
+ }
+ else
+ {
+ obj_min_distance = object_extents.mV[VY] * 0.5f / camera_offset_target_abs_norm.mV[VY];
+ }
+ }
+ else
+ {
+ if (camera_offset_target_abs_norm.mV[VZ] < 0.001f)
+ {
+ obj_min_distance = object_extents.mV[VZ] * 0.5f;
+ }
+ else
+ {
+ obj_min_distance = object_extents.mV[VZ] * 0.5f / camera_offset_target_abs_norm.mV[VZ];
+ }
+ }
+
+ LLVector3 object_split_axis;
+ LLVector3 target_offset_scaled = target_offset_origin;
+ target_offset_scaled.abs();
+ target_offset_scaled.normalize();
+ target_offset_scaled.mV[VX] /= object_extents.mV[VX];
+ target_offset_scaled.mV[VY] /= object_extents.mV[VY];
+ target_offset_scaled.mV[VZ] /= object_extents.mV[VZ];
+
+ if (target_offset_scaled.mV[VX] > target_offset_scaled.mV[VY] &&
+ target_offset_scaled.mV[VX] > target_offset_scaled.mV[VZ])
+ {
+ object_split_axis = LLVector3::x_axis;
+ }
+ else if (target_offset_scaled.mV[VY] > target_offset_scaled.mV[VZ])
+ {
+ object_split_axis = LLVector3::y_axis;
+ }
+ else
+ {
+ object_split_axis = LLVector3::z_axis;
+ }
+
+ LLVector3 camera_offset_object(getCameraPositionAgent() - mFocusObject->getPositionAgent());
+
+
+ F32 camera_offset_clip = camera_offset_object * object_split_axis;
+ F32 target_offset_clip = target_offset_dir * object_split_axis;
+
+ // target has moved outside of object extents
+ // check to see if camera and target are on same side
+ if (target_outside_object_extents)
+ {
+ if (camera_offset_clip > 0.f && target_offset_clip > 0.f)
+ {
+ return FALSE;
+ }
+ else if (camera_offset_clip < 0.f && target_offset_clip < 0.f)
+ {
+ return FALSE;
+ }
+ }
+
+ // clamp obj distance to diagonal of 10 by 10 cube
+ obj_min_distance = llmin(obj_min_distance, 10.f * F_SQRT3);
+
+ obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f);
+
+ return TRUE;
}
F32 LLAgentCamera::getCameraZoomFraction(bool get_third_person)
{
- // 0.f -> camera zoomed all the way out
- // 1.f -> camera zoomed all the way in
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
- {
- // already [0,1]
- return mHUDTargetZoom;
- }
-
- if (isDisableCameraConstraints())
- {
- return mCameraZoomFraction;
- }
-
- if (get_third_person || (mFocusOnAvatar && cameraThirdPerson()))
- {
- return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f);
- }
-
- if (cameraCustomizeAvatar())
- {
- F32 distance = (F32)mCameraFocusOffsetTarget.magVec();
- return clamp_rescale(distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM, 1.f, 0.f );
- }
-
- F32 min_zoom;
- F32 max_zoom = getCameraMaxZoomDistance();
-
- F32 distance = (F32)mCameraFocusOffsetTarget.magVec();
- if (mFocusObject.notNull())
- {
- if (mFocusObject->isAvatar())
- {
- min_zoom = AVATAR_MIN_ZOOM;
- }
- else
- {
- min_zoom = OBJECT_MIN_ZOOM;
- }
- }
- else
- {
- min_zoom = LAND_MIN_ZOOM;
- }
-
- return clamp_rescale(distance, min_zoom, max_zoom, 1.f, 0.f);
+ // 0.f -> camera zoomed all the way out
+ // 1.f -> camera zoomed all the way in
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ // already [0,1]
+ return mHUDTargetZoom;
+ }
+
+ if (isDisableCameraConstraints())
+ {
+ return mCameraZoomFraction;
+ }
+
+ if (get_third_person || (mFocusOnAvatar && cameraThirdPerson()))
+ {
+ return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f);
+ }
+
+ if (cameraCustomizeAvatar())
+ {
+ F32 distance = (F32)mCameraFocusOffsetTarget.magVec();
+ return clamp_rescale(distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM, 1.f, 0.f );
+ }
+
+ F32 min_zoom;
+ F32 max_zoom = getCameraMaxZoomDistance();
+
+ F32 distance = (F32)mCameraFocusOffsetTarget.magVec();
+ if (mFocusObject.notNull())
+ {
+ if (mFocusObject->isAvatar())
+ {
+ min_zoom = AVATAR_MIN_ZOOM;
+ }
+ else
+ {
+ min_zoom = OBJECT_MIN_ZOOM;
+ }
+ }
+ else
+ {
+ min_zoom = LAND_MIN_ZOOM;
+ }
+
+ return clamp_rescale(distance, min_zoom, max_zoom, 1.f, 0.f);
}
void LLAgentCamera::setCameraZoomFraction(F32 fraction)
{
- // 0.f -> camera zoomed all the way out
- // 1.f -> camera zoomed all the way in
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
-
- if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
- {
- mHUDTargetZoom = fraction;
- }
- else if (isDisableCameraConstraints())
- {
- mCameraZoomFraction = fraction;
- }
- else if (mFocusOnAvatar && cameraThirdPerson())
- {
- mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION);
- }
- else if (cameraCustomizeAvatar())
- {
- LLVector3d camera_offset_dir = mCameraFocusOffsetTarget;
- camera_offset_dir.normalize();
- mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM);
- }
- else
- {
- F32 min_zoom = LAND_MIN_ZOOM;
- F32 max_zoom = getCameraMaxZoomDistance();
-
- if (mFocusObject.notNull())
- {
- if (mFocusObject.notNull())
- {
- if (mFocusObject->isAvatar())
- {
- min_zoom = AVATAR_MIN_ZOOM;
- }
- else
- {
- min_zoom = OBJECT_MIN_ZOOM;
- }
- }
- }
-
- LLVector3d camera_offset_dir = mCameraFocusOffsetTarget;
- camera_offset_dir.normalize();
- mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom);
- }
-
- startCameraAnimation();
+ // 0.f -> camera zoomed all the way out
+ // 1.f -> camera zoomed all the way in
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+
+ if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ mHUDTargetZoom = fraction;
+ }
+ else if (isDisableCameraConstraints())
+ {
+ mCameraZoomFraction = fraction;
+ }
+ else if (mFocusOnAvatar && cameraThirdPerson())
+ {
+ mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION);
+ }
+ else if (cameraCustomizeAvatar())
+ {
+ LLVector3d camera_offset_dir = mCameraFocusOffsetTarget;
+ camera_offset_dir.normalize();
+ mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM);
+ }
+ else
+ {
+ F32 min_zoom = LAND_MIN_ZOOM;
+ F32 max_zoom = getCameraMaxZoomDistance();
+
+ if (mFocusObject.notNull())
+ {
+ if (mFocusObject.notNull())
+ {
+ if (mFocusObject->isAvatar())
+ {
+ min_zoom = AVATAR_MIN_ZOOM;
+ }
+ else
+ {
+ min_zoom = OBJECT_MIN_ZOOM;
+ }
+ }
+ }
+
+ LLVector3d camera_offset_dir = mCameraFocusOffsetTarget;
+ camera_offset_dir.normalize();
+ mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom);
+ }
+
+ startCameraAnimation();
}
F32 LLAgentCamera::getAgentHUDTargetZoom()
{
- static LLCachedControl<F32> hud_scale_factor(gSavedSettings, "HUDScaleFactor");
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- return (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) ? hud_scale_factor*gAgentCamera.mHUDTargetZoom : hud_scale_factor;
+ static LLCachedControl<F32> hud_scale_factor(gSavedSettings, "HUDScaleFactor");
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ return (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) ? hud_scale_factor*gAgentCamera.mHUDTargetZoom : hud_scale_factor;
}
//-----------------------------------------------------------------------------
@@ -852,22 +852,22 @@ F32 LLAgentCamera::getAgentHUDTargetZoom()
//-----------------------------------------------------------------------------
void LLAgentCamera::cameraOrbitAround(const F32 radians)
{
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
- {
- // do nothing for hud selection
- }
- else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON || mCameraMode == CAMERA_MODE_FOLLOW))
- {
- gAgent.yaw(radians);
- }
- else
- {
- mOrbitAroundRadians += radians;
- mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f);
-
- cameraZoomIn(1.f);
- }
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ // do nothing for hud selection
+ }
+ else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON || mCameraMode == CAMERA_MODE_FOLLOW))
+ {
+ gAgent.yaw(radians);
+ }
+ else
+ {
+ mOrbitAroundRadians += radians;
+ mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f);
+
+ cameraZoomIn(1.f);
+ }
}
@@ -876,51 +876,51 @@ void LLAgentCamera::cameraOrbitAround(const F32 radians)
//-----------------------------------------------------------------------------
void LLAgentCamera::cameraOrbitOver(const F32 angle)
{
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
- {
- // do nothing for hud selection
- }
- else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON)
- {
- gAgent.pitch(angle);
- }
- else
- {
- LLVector3 camera_offset_unit(mCameraFocusOffsetTarget);
- camera_offset_unit.normalize();
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ // do nothing for hud selection
+ }
+ else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON)
+ {
+ gAgent.pitch(angle);
+ }
+ else
+ {
+ LLVector3 camera_offset_unit(mCameraFocusOffsetTarget);
+ camera_offset_unit.normalize();
- F32 angle_from_up = acos( camera_offset_unit * gAgent.getReferenceUpVector() );
+ F32 angle_from_up = acos( camera_offset_unit * gAgent.getReferenceUpVector() );
- LLVector3d left_axis;
- left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis());
- F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD);
- mOrbitOverAngle += angle_from_up - new_angle;
- mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis);
+ LLVector3d left_axis;
+ left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis());
+ F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD);
+ mOrbitOverAngle += angle_from_up - new_angle;
+ mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis);
- cameraZoomIn(1.f);
- }
+ cameraZoomIn(1.f);
+ }
}
void LLAgentCamera::resetCameraOrbit()
{
- LLVector3 camera_offset_unit(mCameraFocusOffsetTarget);
- camera_offset_unit.normalize();
+ LLVector3 camera_offset_unit(mCameraFocusOffsetTarget);
+ camera_offset_unit.normalize();
+
+ LLVector3d left_axis;
+ left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis());
+ mCameraFocusOffsetTarget.rotVec(-mOrbitOverAngle, left_axis);
- LLVector3d left_axis;
- left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis());
- mCameraFocusOffsetTarget.rotVec(-mOrbitOverAngle, left_axis);
-
- mCameraFocusOffsetTarget.rotVec(-mOrbitAroundRadians, 0.f, 0.f, 1.f);
+ mCameraFocusOffsetTarget.rotVec(-mOrbitAroundRadians, 0.f, 0.f, 1.f);
- cameraZoomIn(1.f);
- resetOrbitDiff();
+ cameraZoomIn(1.f);
+ resetOrbitDiff();
}
void LLAgentCamera::resetOrbitDiff()
{
- mOrbitAroundRadians = 0;
- mOrbitOverAngle = 0;
+ mOrbitAroundRadians = 0;
+ mOrbitOverAngle = 0;
}
//-----------------------------------------------------------------------------
@@ -928,56 +928,56 @@ void LLAgentCamera::resetOrbitDiff()
//-----------------------------------------------------------------------------
void LLAgentCamera::cameraZoomIn(const F32 fraction)
{
- if (gDisconnected)
- {
- return;
- }
-
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- if (LLToolMgr::getInstance()->inBuildMode() && selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
- {
- // just update hud zoom level
- mHUDTargetZoom /= fraction;
- return;
- }
+ if (gDisconnected)
+ {
+ return;
+ }
- LLVector3d camera_offset_unit(mCameraFocusOffsetTarget);
- F32 current_distance = (F32)camera_offset_unit.normalize();
- F32 new_distance = current_distance * fraction;
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ if (LLToolMgr::getInstance()->inBuildMode() && selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ // just update hud zoom level
+ mHUDTargetZoom /= fraction;
+ return;
+ }
- // Unless camera is unlocked
- if (!isDisableCameraConstraints())
- {
- F32 min_zoom = LAND_MIN_ZOOM;
+ LLVector3d camera_offset_unit(mCameraFocusOffsetTarget);
+ F32 current_distance = (F32)camera_offset_unit.normalize();
+ F32 new_distance = current_distance * fraction;
- // Don't move through focus point
- if (mFocusObject)
- {
- LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]);
+ // Unless camera is unlocked
+ if (!isDisableCameraConstraints())
+ {
+ F32 min_zoom = LAND_MIN_ZOOM;
- if (mFocusObject->isAvatar())
- {
- calcCameraMinDistance(min_zoom);
- }
- else
- {
- min_zoom = OBJECT_MIN_ZOOM;
- }
- }
+ // Don't move through focus point
+ if (mFocusObject)
+ {
+ LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]);
+
+ if (mFocusObject->isAvatar())
+ {
+ calcCameraMinDistance(min_zoom);
+ }
+ else
+ {
+ min_zoom = OBJECT_MIN_ZOOM;
+ }
+ }
- new_distance = llmax(new_distance, min_zoom);
+ new_distance = llmax(new_distance, min_zoom);
- F32 max_distance = getCameraMaxZoomDistance();
- max_distance = llmin(max_distance, current_distance * 4.f); //Scaled max relative to current distance. MAINT-3154
- new_distance = llmin(new_distance, max_distance);
+ F32 max_distance = getCameraMaxZoomDistance();
+ max_distance = llmin(max_distance, current_distance * 4.f); //Scaled max relative to current distance. MAINT-3154
+ new_distance = llmin(new_distance, max_distance);
- if (cameraCustomizeAvatar())
- {
- new_distance = llclamp(new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM);
- }
- }
+ if (cameraCustomizeAvatar())
+ {
+ new_distance = llclamp(new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM);
+ }
+ }
- mCameraFocusOffsetTarget = new_distance * camera_offset_unit;
+ mCameraFocusOffsetTarget = new_distance * camera_offset_unit;
}
//-----------------------------------------------------------------------------
@@ -985,62 +985,62 @@ void LLAgentCamera::cameraZoomIn(const F32 fraction)
//-----------------------------------------------------------------------------
void LLAgentCamera::cameraOrbitIn(const F32 meters)
{
- if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON)
- {
- F32 camera_offset_dist = llmax(0.001f, getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"));
-
- mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist;
-
- if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f)
- {
- // No need to animate, camera is already there.
- changeCameraToMouselook(FALSE);
- }
-
- if (!isDisableCameraConstraints())
- {
- mCameraZoomFraction = llclamp(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION);
- }
- }
- else
- {
- LLVector3d camera_offset_unit(mCameraFocusOffsetTarget);
- F32 current_distance = (F32)camera_offset_unit.normalize();
- F32 new_distance = current_distance - meters;
-
- // Unless camera is unlocked
- if (!isDisableCameraConstraints())
- {
- F32 min_zoom = LAND_MIN_ZOOM;
-
- // Don't move through focus point
- if (mFocusObject.notNull())
- {
- if (mFocusObject->isAvatar())
- {
- min_zoom = AVATAR_MIN_ZOOM;
- }
- else
- {
- min_zoom = OBJECT_MIN_ZOOM;
- }
- }
-
- new_distance = llmax(new_distance, min_zoom);
-
- F32 max_distance = getCameraMaxZoomDistance();
- new_distance = llmin(new_distance, max_distance);
-
- if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode())
- {
- new_distance = llclamp(new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM);
- }
- }
-
- // Compute new camera offset
- mCameraFocusOffsetTarget = new_distance * camera_offset_unit;
- cameraZoomIn(1.f);
- }
+ if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON)
+ {
+ F32 camera_offset_dist = llmax(0.001f, getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"));
+
+ mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist;
+
+ if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f)
+ {
+ // No need to animate, camera is already there.
+ changeCameraToMouselook(FALSE);
+ }
+
+ if (!isDisableCameraConstraints())
+ {
+ mCameraZoomFraction = llclamp(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION);
+ }
+ }
+ else
+ {
+ LLVector3d camera_offset_unit(mCameraFocusOffsetTarget);
+ F32 current_distance = (F32)camera_offset_unit.normalize();
+ F32 new_distance = current_distance - meters;
+
+ // Unless camera is unlocked
+ if (!isDisableCameraConstraints())
+ {
+ F32 min_zoom = LAND_MIN_ZOOM;
+
+ // Don't move through focus point
+ if (mFocusObject.notNull())
+ {
+ if (mFocusObject->isAvatar())
+ {
+ min_zoom = AVATAR_MIN_ZOOM;
+ }
+ else
+ {
+ min_zoom = OBJECT_MIN_ZOOM;
+ }
+ }
+
+ new_distance = llmax(new_distance, min_zoom);
+
+ F32 max_distance = getCameraMaxZoomDistance();
+ new_distance = llmin(new_distance, max_distance);
+
+ if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode())
+ {
+ new_distance = llclamp(new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM);
+ }
+ }
+
+ // Compute new camera offset
+ mCameraFocusOffsetTarget = new_distance * camera_offset_unit;
+ cameraZoomIn(1.f);
+ }
}
//-----------------------------------------------------------------------------
@@ -1048,17 +1048,17 @@ void LLAgentCamera::cameraOrbitIn(const F32 meters)
//-----------------------------------------------------------------------------
void LLAgentCamera::cameraPanIn(F32 meters)
{
- LLVector3d at_axis;
- at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis());
+ LLVector3d at_axis;
+ at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis());
- mPanFocusDiff += meters * at_axis;
+ mPanFocusDiff += meters * at_axis;
- mFocusTargetGlobal += meters * at_axis;
- mFocusGlobal = mFocusTargetGlobal;
- // don't enforce zoom constraints as this is the only way for users to get past them easily
- updateFocusOffset();
- // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx
- mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal();
+ mFocusTargetGlobal += meters * at_axis;
+ mFocusGlobal = mFocusTargetGlobal;
+ // don't enforce zoom constraints as this is the only way for users to get past them easily
+ updateFocusOffset();
+ // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx
+ mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal();
}
//-----------------------------------------------------------------------------
@@ -1066,21 +1066,21 @@ void LLAgentCamera::cameraPanIn(F32 meters)
//-----------------------------------------------------------------------------
void LLAgentCamera::cameraPanLeft(F32 meters)
{
- LLVector3d left_axis;
- left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis());
+ LLVector3d left_axis;
+ left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis());
- mPanFocusDiff += meters * left_axis;
+ mPanFocusDiff += meters * left_axis;
- mFocusTargetGlobal += meters * left_axis;
- mFocusGlobal = mFocusTargetGlobal;
+ mFocusTargetGlobal += meters * left_axis;
+ mFocusGlobal = mFocusTargetGlobal;
- // disable smoothing for camera pan, which causes some residents unhappiness
- mCameraSmoothingStop = true;
-
- cameraZoomIn(1.f);
- updateFocusOffset();
- // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind - Nyx
- mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal();
+ // disable smoothing for camera pan, which causes some residents unhappiness
+ mCameraSmoothingStop = true;
+
+ cameraZoomIn(1.f);
+ updateFocusOffset();
+ // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind - Nyx
+ mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal();
}
//-----------------------------------------------------------------------------
@@ -1088,41 +1088,41 @@ void LLAgentCamera::cameraPanLeft(F32 meters)
//-----------------------------------------------------------------------------
void LLAgentCamera::cameraPanUp(F32 meters)
{
- LLVector3d up_axis;
- up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis());
+ LLVector3d up_axis;
+ up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis());
- mPanFocusDiff += meters * up_axis;
+ mPanFocusDiff += meters * up_axis;
- mFocusTargetGlobal += meters * up_axis;
- mFocusGlobal = mFocusTargetGlobal;
+ mFocusTargetGlobal += meters * up_axis;
+ mFocusGlobal = mFocusTargetGlobal;
- // disable smoothing for camera pan, which causes some residents unhappiness
- mCameraSmoothingStop = true;
+ // disable smoothing for camera pan, which causes some residents unhappiness
+ mCameraSmoothingStop = true;
- cameraZoomIn(1.f);
- updateFocusOffset();
- // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx
- mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal();
+ cameraZoomIn(1.f);
+ updateFocusOffset();
+ // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx
+ mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal();
}
void LLAgentCamera::resetCameraPan()
{
- mFocusTargetGlobal -= mPanFocusDiff;
+ mFocusTargetGlobal -= mPanFocusDiff;
- mFocusGlobal = mFocusTargetGlobal;
- mCameraSmoothingStop = true;
+ mFocusGlobal = mFocusTargetGlobal;
+ mCameraSmoothingStop = true;
- cameraZoomIn(1.f);
- updateFocusOffset();
+ cameraZoomIn(1.f);
+ updateFocusOffset();
- mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal();
+ mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal();
- resetPanDiff();
+ resetPanDiff();
}
void LLAgentCamera::resetPanDiff()
{
- mPanFocusDiff.clear();
+ mPanFocusDiff.clear();
}
//-----------------------------------------------------------------------------
@@ -1130,67 +1130,67 @@ void LLAgentCamera::resetPanDiff()
//-----------------------------------------------------------------------------
void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
{
- static LLVector3 last_at_axis;
-
- if (!isAgentAvatarValid()) return;
-
- LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot->getWorldRotation();
- LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot->getWorldRotation();
-
- if (LLTrace::get_frame_recording().getLastRecording().getLastValue(*gViewerWindow->getMouseVelocityStat()) < 0.01f
- && (root_at * last_at_axis > 0.95f))
- {
- LLVector3 vel = gAgentAvatarp->getVelocity();
- if (vel.magVecSquared() > 4.f)
- {
- setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, vel * av_inv_rot);
- }
- else
- {
- // *FIX: rotate mframeagent by sit object's rotation?
- LLQuaternion look_rotation = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation
- LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot;
- setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, look_offset);
- }
- last_at_axis = root_at;
- return;
- }
-
- last_at_axis = root_at;
-
- if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode())
- {
- setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, LLVector3(-2.f, 0.f, 0.f));
- }
- else
- {
- // Move head based on cursor position
- ELookAtType lookAtType = LOOKAT_TARGET_NONE;
- LLVector3 headLookAxis;
- LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance());
-
- if (cameraMouselook())
- {
- lookAtType = LOOKAT_TARGET_MOUSELOOK;
- }
- else if (cameraThirdPerson())
- {
- // range from -.5 to .5
- F32 x_from_center =
- ((F32) mouse_x / (F32) gViewerWindow->getWorldViewWidthScaled() ) - 0.5f;
- F32 y_from_center =
- ((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f;
-
- frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD);
- frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD);
- lookAtType = LOOKAT_TARGET_FREELOOK;
- }
-
- headLookAxis = frameCamera.getAtAxis();
- // RN: we use world-space offset for mouselook and freelook
- //headLookAxis = headLookAxis * av_inv_rot;
- setLookAt(lookAtType, gAgentAvatarp, headLookAxis);
- }
+ static LLVector3 last_at_axis;
+
+ if (!isAgentAvatarValid()) return;
+
+ LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot->getWorldRotation();
+ LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot->getWorldRotation();
+
+ if (LLTrace::get_frame_recording().getLastRecording().getLastValue(*gViewerWindow->getMouseVelocityStat()) < 0.01f
+ && (root_at * last_at_axis > 0.95f))
+ {
+ LLVector3 vel = gAgentAvatarp->getVelocity();
+ if (vel.magVecSquared() > 4.f)
+ {
+ setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, vel * av_inv_rot);
+ }
+ else
+ {
+ // *FIX: rotate mframeagent by sit object's rotation?
+ LLQuaternion look_rotation = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation
+ LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot;
+ setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, look_offset);
+ }
+ last_at_axis = root_at;
+ return;
+ }
+
+ last_at_axis = root_at;
+
+ if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode())
+ {
+ setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, LLVector3(-2.f, 0.f, 0.f));
+ }
+ else
+ {
+ // Move head based on cursor position
+ ELookAtType lookAtType = LOOKAT_TARGET_NONE;
+ LLVector3 headLookAxis;
+ LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance());
+
+ if (cameraMouselook())
+ {
+ lookAtType = LOOKAT_TARGET_MOUSELOOK;
+ }
+ else if (cameraThirdPerson())
+ {
+ // range from -.5 to .5
+ F32 x_from_center =
+ ((F32) mouse_x / (F32) gViewerWindow->getWorldViewWidthScaled() ) - 0.5f;
+ F32 y_from_center =
+ ((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f;
+
+ frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD);
+ frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD);
+ lookAtType = LOOKAT_TARGET_FREELOOK;
+ }
+
+ headLookAxis = frameCamera.getAtAxis();
+ // RN: we use world-space offset for mouselook and freelook
+ //headLookAxis = headLookAxis * av_inv_rot;
+ setLookAt(lookAtType, gAgentAvatarp, headLookAxis);
+ }
}
static LLTrace::BlockTimerStatHandle FTM_UPDATE_CAMERA("Camera");
@@ -1202,377 +1202,377 @@ extern BOOL gCubeSnapshot;
//-----------------------------------------------------------------------------
void LLAgentCamera::updateCamera()
{
- LL_RECORD_BLOCK_TIME(FTM_UPDATE_CAMERA);
+ LL_RECORD_BLOCK_TIME(FTM_UPDATE_CAMERA);
if (gCubeSnapshot)
{
return;
}
- // - changed camera_skyward to the new global "mCameraUpVector"
- mCameraUpVector = LLVector3::z_axis;
- //LLVector3 camera_skyward(0.f, 0.f, 1.f);
-
- U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode;
-
- validateFocusObject();
-
- if (isAgentAvatarValid() &&
- gAgentAvatarp->isSitting() &&
- camera_mode == CAMERA_MODE_MOUSELOOK)
- {
- //changed camera_skyward to the new global "mCameraUpVector"
- mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation();
- }
-
- if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getInstance()->getActiveFollowCamParams())
- {
- mAllowChangeToFollow = FALSE;
- mFocusOnAvatar = TRUE;
- changeCameraToFollow();
- }
-
- //NOTE - this needs to be integrated into a general upVector system here within llAgent.
- if ( camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar )
- {
- mCameraUpVector = mFollowCam.getUpVector();
- }
-
- if (mSitCameraEnabled)
- {
- if (mSitCameraReferenceObject->isDead())
- {
- setSitCamera(LLUUID::null);
- }
- }
-
- // Update UI with our camera inputs
- LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera");
- if (camera_floater)
- {
- camera_floater->mRotate->setToggleState(gAgentCamera.getOrbitRightKey() > 0.f, // left
- gAgentCamera.getOrbitUpKey() > 0.f, // top
- gAgentCamera.getOrbitLeftKey() > 0.f, // right
- gAgentCamera.getOrbitDownKey() > 0.f); // bottom
-
- camera_floater->mTrack->setToggleState(gAgentCamera.getPanLeftKey() > 0.f, // left
- gAgentCamera.getPanUpKey() > 0.f, // top
- gAgentCamera.getPanRightKey() > 0.f, // right
- gAgentCamera.getPanDownKey() > 0.f); // bottom
- }
-
- // Handle camera movement based on keyboard.
- const F32 ORBIT_OVER_RATE = 90.f * DEG_TO_RAD; // radians per second
- const F32 ORBIT_AROUND_RATE = 90.f * DEG_TO_RAD; // radians per second
- const F32 PAN_RATE = 5.f; // meters per second
-
- if (gAgentCamera.getOrbitUpKey() || gAgentCamera.getOrbitDownKey())
- {
- F32 input_rate = gAgentCamera.getOrbitUpKey() - gAgentCamera.getOrbitDownKey();
- cameraOrbitOver( input_rate * ORBIT_OVER_RATE / gFPSClamped );
- }
-
- if (gAgentCamera.getOrbitLeftKey() || gAgentCamera.getOrbitRightKey())
- {
- F32 input_rate = gAgentCamera.getOrbitLeftKey() - gAgentCamera.getOrbitRightKey();
- cameraOrbitAround(input_rate * ORBIT_AROUND_RATE / gFPSClamped);
- }
-
- if (gAgentCamera.getOrbitInKey() || gAgentCamera.getOrbitOutKey())
- {
- F32 input_rate = gAgentCamera.getOrbitInKey() - gAgentCamera.getOrbitOutKey();
-
- LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal();
- F32 distance_to_focus = (F32)to_focus.magVec();
- // Move at distance (in meters) meters per second
- cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped );
- }
-
- if (gAgentCamera.getPanInKey() || gAgentCamera.getPanOutKey())
- {
- F32 input_rate = gAgentCamera.getPanInKey() - gAgentCamera.getPanOutKey();
- cameraPanIn(input_rate * PAN_RATE / gFPSClamped);
- }
-
- if (gAgentCamera.getPanRightKey() || gAgentCamera.getPanLeftKey())
- {
- F32 input_rate = gAgentCamera.getPanRightKey() - gAgentCamera.getPanLeftKey();
- cameraPanLeft(input_rate * -PAN_RATE / gFPSClamped );
- }
-
- if (gAgentCamera.getPanUpKey() || gAgentCamera.getPanDownKey())
- {
- F32 input_rate = gAgentCamera.getPanUpKey() - gAgentCamera.getPanDownKey();
- cameraPanUp(input_rate * PAN_RATE / gFPSClamped );
- }
-
- // Clear camera keyboard keys.
- gAgentCamera.clearOrbitKeys();
- gAgentCamera.clearPanKeys();
-
- // lerp camera focus offset
- mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLSmoothInterpolation::getInterpolant(CAMERA_FOCUS_HALF_LIFE));
-
- if ( mCameraMode == CAMERA_MODE_FOLLOW )
- {
- if (isAgentAvatarValid())
- {
- //--------------------------------------------------------------------------------
- // this is where the avatar's position and rotation are given to followCam, and
- // where it is updated. All three of its attributes are updated: (1) position,
- // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent.
- //--------------------------------------------------------------------------------
- // *TODO: use combined rotation of frameagent and sit object
- LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion();
-
- LLFollowCamParams* current_cam = LLFollowCamMgr::getInstance()->getActiveFollowCamParams();
- if (current_cam)
- {
- mFollowCam.copyParams(*current_cam);
- mFollowCam.setSubjectPositionAndRotation( gAgentAvatarp->getRenderPosition(), avatarRotationForFollowCam );
- mFollowCam.update();
- LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true);
- }
- else
- {
- changeCameraToThirdPerson(TRUE);
- }
- }
- }
-
- BOOL hit_limit;
- LLVector3d camera_pos_global;
- LLVector3d camera_target_global = calcCameraPositionTargetGlobal(&hit_limit);
- mCameraVirtualPositionAgent = gAgent.getPosAgentFromGlobal(camera_target_global);
- LLVector3d focus_target_global = calcFocusPositionTargetGlobal();
-
- // perform field of view correction
- mCameraFOVZoomFactor = calcCameraFOVZoomFactor();
- camera_target_global = focus_target_global + (camera_target_global - focus_target_global) * (1.f + mCameraFOVZoomFactor);
-
- gAgent.setShowAvatar(TRUE); // can see avatar by default
-
- // Adjust position for animation
- if (mCameraAnimating)
- {
- F32 time = mAnimationTimer.getElapsedTimeF32();
-
- // yet another instance of critically damped motion, hooray!
- // F32 fraction_of_animation = 1.f - pow(2.f, -time / CAMERA_ZOOM_HALF_LIFE);
-
- // linear interpolation
- F32 fraction_of_animation = time / mAnimationDuration;
-
- BOOL isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK;
- BOOL wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK;
- F32 fraction_animation_to_skip;
-
- if (mAnimationCameraStartGlobal == camera_target_global)
- {
- fraction_animation_to_skip = 0.f;
- }
- else
- {
- LLVector3d cam_delta = mAnimationCameraStartGlobal - camera_target_global;
- fraction_animation_to_skip = HEAD_BUFFER_SIZE / (F32)cam_delta.magVec();
- }
- F32 animation_start_fraction = (wasfirstPerson) ? fraction_animation_to_skip : 0.f;
- F32 animation_finish_fraction = (isfirstPerson) ? (1.f - fraction_animation_to_skip) : 1.f;
-
- if (fraction_of_animation < animation_finish_fraction)
- {
- if (fraction_of_animation < animation_start_fraction || fraction_of_animation > animation_finish_fraction )
- {
- gAgent.setShowAvatar(FALSE);
- }
-
- // ...adjust position for animation
- F32 smooth_fraction_of_animation = llsmoothstep(0.0f, 1.0f, fraction_of_animation);
- camera_pos_global = lerp(mAnimationCameraStartGlobal, camera_target_global, smooth_fraction_of_animation);
- mFocusGlobal = lerp(mAnimationFocusStartGlobal, focus_target_global, smooth_fraction_of_animation);
- }
- else
- {
- // ...animation complete
- mCameraAnimating = FALSE;
-
- camera_pos_global = camera_target_global;
- mFocusGlobal = focus_target_global;
-
- gAgent.endAnimationUpdateUI();
- gAgent.setShowAvatar(TRUE);
- }
-
- if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK))
- {
- gAgentAvatarp->updateAttachmentVisibility(mCameraMode);
- }
- }
- else
- {
- camera_pos_global = camera_target_global;
- mFocusGlobal = focus_target_global;
- gAgent.setShowAvatar(TRUE);
- }
-
- // smoothing
- if (TRUE)
- {
- LLVector3d agent_pos = gAgent.getPositionGlobal();
- LLVector3d camera_pos_agent = camera_pos_global - agent_pos;
- // Sitting on what you're manipulating can cause camera jitter with smoothing.
- // This turns off smoothing while editing. -MG
- bool in_build_mode = LLToolMgr::getInstance()->inBuildMode();
- mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode;
-
- if (cameraThirdPerson() && !mCameraSmoothingStop)
- {
- const F32 SMOOTHING_HALF_LIFE = 0.02f;
-
- F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE);
-
- if (mFocusOnAvatar && !mFocusObject) // we differentiate on avatar mode
- {
- // for avatar-relative focus, we smooth in avatar space -
- // the avatar moves too jerkily w/r/t global space to smooth there.
-
- LLVector3d delta = camera_pos_agent - mCameraSmoothingLastPositionAgent;
- if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please
- {
- camera_pos_agent = lerp(mCameraSmoothingLastPositionAgent, camera_pos_agent, smoothing);
- camera_pos_global = camera_pos_agent + agent_pos;
- }
- }
- else
- {
- LLVector3d delta = camera_pos_global - mCameraSmoothingLastPositionGlobal;
- if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please
- {
- camera_pos_global = lerp(mCameraSmoothingLastPositionGlobal, camera_pos_global, smoothing);
- }
- }
- }
-
- mCameraSmoothingLastPositionGlobal = camera_pos_global;
- mCameraSmoothingLastPositionAgent = camera_pos_agent;
- mCameraSmoothingStop = false;
- }
-
-
- mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLSmoothInterpolation::getInterpolant(FOV_ZOOM_HALF_LIFE));
-
-// LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL;
-
- LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal);
-
- mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global);
-
- // Move the camera
-
- LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent);
- //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent);
-
- // Change FOV
- LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor));
-
- // follow camera when in customize mode
- if (cameraCustomizeAvatar())
- {
- setLookAt(LOOKAT_TARGET_FOCUS, NULL, mCameraPositionAgent);
- }
-
- // update the travel distance stat
- // this isn't directly related to the camera
- // but this seemed like the best place to do this
- LLVector3d global_pos = gAgent.getPositionGlobal();
- if (!gAgent.getLastPositionGlobal().isExactlyZero())
- {
- LLVector3d delta = global_pos - gAgent.getLastPositionGlobal();
- gAgent.setDistanceTraveled(gAgent.getDistanceTraveled() + delta.magVec());
- }
- gAgent.setLastPositionGlobal(global_pos);
-
- if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook())
- {
- LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() +
- LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() +
- LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation();
- LLVector3 diff = mCameraPositionAgent - head_pos;
- diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation();
-
- LLJoint* torso_joint = gAgentAvatarp->mTorsop;
- LLJoint* chest_joint = gAgentAvatarp->mChestp;
- LLVector3 torso_scale = torso_joint->getScale();
- LLVector3 chest_scale = chest_joint->getScale();
-
- // shorten avatar skeleton to avoid foot interpenetration
- if (!gAgentAvatarp->mInAir)
- {
- LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation();
- F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f);
- F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f);
- torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor));
-
- LLJoint* neck_joint = gAgentAvatarp->mNeckp;
- LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation();
- scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f);
- chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor));
- diff.mV[VZ] = 0.f;
- }
-
- // SL-315
- gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
-
- gAgentAvatarp->mRoot->updateWorldMatrixChildren();
-
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); )
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject *attached_object = attachment_iter->get();
- if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull())
- {
- // clear any existing "early" movements of attachment
- attached_object->mDrawable->clearState(LLDrawable::EARLY_MOVE);
- gPipeline.updateMoveNormalAsync(attached_object->mDrawable);
- attached_object->updateText();
- }
- }
- }
-
- torso_joint->setScale(torso_scale);
- chest_joint->setScale(chest_scale);
- }
+ // - changed camera_skyward to the new global "mCameraUpVector"
+ mCameraUpVector = LLVector3::z_axis;
+ //LLVector3 camera_skyward(0.f, 0.f, 1.f);
+
+ U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode;
+
+ validateFocusObject();
+
+ if (isAgentAvatarValid() &&
+ gAgentAvatarp->isSitting() &&
+ camera_mode == CAMERA_MODE_MOUSELOOK)
+ {
+ //changed camera_skyward to the new global "mCameraUpVector"
+ mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation();
+ }
+
+ if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getInstance()->getActiveFollowCamParams())
+ {
+ mAllowChangeToFollow = FALSE;
+ mFocusOnAvatar = TRUE;
+ changeCameraToFollow();
+ }
+
+ //NOTE - this needs to be integrated into a general upVector system here within llAgent.
+ if ( camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar )
+ {
+ mCameraUpVector = mFollowCam.getUpVector();
+ }
+
+ if (mSitCameraEnabled)
+ {
+ if (mSitCameraReferenceObject->isDead())
+ {
+ setSitCamera(LLUUID::null);
+ }
+ }
+
+ // Update UI with our camera inputs
+ LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera");
+ if (camera_floater)
+ {
+ camera_floater->mRotate->setToggleState(gAgentCamera.getOrbitRightKey() > 0.f, // left
+ gAgentCamera.getOrbitUpKey() > 0.f, // top
+ gAgentCamera.getOrbitLeftKey() > 0.f, // right
+ gAgentCamera.getOrbitDownKey() > 0.f); // bottom
+
+ camera_floater->mTrack->setToggleState(gAgentCamera.getPanLeftKey() > 0.f, // left
+ gAgentCamera.getPanUpKey() > 0.f, // top
+ gAgentCamera.getPanRightKey() > 0.f, // right
+ gAgentCamera.getPanDownKey() > 0.f); // bottom
+ }
+
+ // Handle camera movement based on keyboard.
+ const F32 ORBIT_OVER_RATE = 90.f * DEG_TO_RAD; // radians per second
+ const F32 ORBIT_AROUND_RATE = 90.f * DEG_TO_RAD; // radians per second
+ const F32 PAN_RATE = 5.f; // meters per second
+
+ if (gAgentCamera.getOrbitUpKey() || gAgentCamera.getOrbitDownKey())
+ {
+ F32 input_rate = gAgentCamera.getOrbitUpKey() - gAgentCamera.getOrbitDownKey();
+ cameraOrbitOver( input_rate * ORBIT_OVER_RATE / gFPSClamped );
+ }
+
+ if (gAgentCamera.getOrbitLeftKey() || gAgentCamera.getOrbitRightKey())
+ {
+ F32 input_rate = gAgentCamera.getOrbitLeftKey() - gAgentCamera.getOrbitRightKey();
+ cameraOrbitAround(input_rate * ORBIT_AROUND_RATE / gFPSClamped);
+ }
+
+ if (gAgentCamera.getOrbitInKey() || gAgentCamera.getOrbitOutKey())
+ {
+ F32 input_rate = gAgentCamera.getOrbitInKey() - gAgentCamera.getOrbitOutKey();
+
+ LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal();
+ F32 distance_to_focus = (F32)to_focus.magVec();
+ // Move at distance (in meters) meters per second
+ cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped );
+ }
+
+ if (gAgentCamera.getPanInKey() || gAgentCamera.getPanOutKey())
+ {
+ F32 input_rate = gAgentCamera.getPanInKey() - gAgentCamera.getPanOutKey();
+ cameraPanIn(input_rate * PAN_RATE / gFPSClamped);
+ }
+
+ if (gAgentCamera.getPanRightKey() || gAgentCamera.getPanLeftKey())
+ {
+ F32 input_rate = gAgentCamera.getPanRightKey() - gAgentCamera.getPanLeftKey();
+ cameraPanLeft(input_rate * -PAN_RATE / gFPSClamped );
+ }
+
+ if (gAgentCamera.getPanUpKey() || gAgentCamera.getPanDownKey())
+ {
+ F32 input_rate = gAgentCamera.getPanUpKey() - gAgentCamera.getPanDownKey();
+ cameraPanUp(input_rate * PAN_RATE / gFPSClamped );
+ }
+
+ // Clear camera keyboard keys.
+ gAgentCamera.clearOrbitKeys();
+ gAgentCamera.clearPanKeys();
+
+ // lerp camera focus offset
+ mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLSmoothInterpolation::getInterpolant(CAMERA_FOCUS_HALF_LIFE));
+
+ if ( mCameraMode == CAMERA_MODE_FOLLOW )
+ {
+ if (isAgentAvatarValid())
+ {
+ //--------------------------------------------------------------------------------
+ // this is where the avatar's position and rotation are given to followCam, and
+ // where it is updated. All three of its attributes are updated: (1) position,
+ // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent.
+ //--------------------------------------------------------------------------------
+ // *TODO: use combined rotation of frameagent and sit object
+ LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion();
+
+ LLFollowCamParams* current_cam = LLFollowCamMgr::getInstance()->getActiveFollowCamParams();
+ if (current_cam)
+ {
+ mFollowCam.copyParams(*current_cam);
+ mFollowCam.setSubjectPositionAndRotation( gAgentAvatarp->getRenderPosition(), avatarRotationForFollowCam );
+ mFollowCam.update();
+ LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true);
+ }
+ else
+ {
+ changeCameraToThirdPerson(TRUE);
+ }
+ }
+ }
+
+ BOOL hit_limit;
+ LLVector3d camera_pos_global;
+ LLVector3d camera_target_global = calcCameraPositionTargetGlobal(&hit_limit);
+ mCameraVirtualPositionAgent = gAgent.getPosAgentFromGlobal(camera_target_global);
+ LLVector3d focus_target_global = calcFocusPositionTargetGlobal();
+
+ // perform field of view correction
+ mCameraFOVZoomFactor = calcCameraFOVZoomFactor();
+ camera_target_global = focus_target_global + (camera_target_global - focus_target_global) * (1.f + mCameraFOVZoomFactor);
+
+ gAgent.setShowAvatar(TRUE); // can see avatar by default
+
+ // Adjust position for animation
+ if (mCameraAnimating)
+ {
+ F32 time = mAnimationTimer.getElapsedTimeF32();
+
+ // yet another instance of critically damped motion, hooray!
+ // F32 fraction_of_animation = 1.f - pow(2.f, -time / CAMERA_ZOOM_HALF_LIFE);
+
+ // linear interpolation
+ F32 fraction_of_animation = time / mAnimationDuration;
+
+ BOOL isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK;
+ BOOL wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK;
+ F32 fraction_animation_to_skip;
+
+ if (mAnimationCameraStartGlobal == camera_target_global)
+ {
+ fraction_animation_to_skip = 0.f;
+ }
+ else
+ {
+ LLVector3d cam_delta = mAnimationCameraStartGlobal - camera_target_global;
+ fraction_animation_to_skip = HEAD_BUFFER_SIZE / (F32)cam_delta.magVec();
+ }
+ F32 animation_start_fraction = (wasfirstPerson) ? fraction_animation_to_skip : 0.f;
+ F32 animation_finish_fraction = (isfirstPerson) ? (1.f - fraction_animation_to_skip) : 1.f;
+
+ if (fraction_of_animation < animation_finish_fraction)
+ {
+ if (fraction_of_animation < animation_start_fraction || fraction_of_animation > animation_finish_fraction )
+ {
+ gAgent.setShowAvatar(FALSE);
+ }
+
+ // ...adjust position for animation
+ F32 smooth_fraction_of_animation = llsmoothstep(0.0f, 1.0f, fraction_of_animation);
+ camera_pos_global = lerp(mAnimationCameraStartGlobal, camera_target_global, smooth_fraction_of_animation);
+ mFocusGlobal = lerp(mAnimationFocusStartGlobal, focus_target_global, smooth_fraction_of_animation);
+ }
+ else
+ {
+ // ...animation complete
+ mCameraAnimating = FALSE;
+
+ camera_pos_global = camera_target_global;
+ mFocusGlobal = focus_target_global;
+
+ gAgent.endAnimationUpdateUI();
+ gAgent.setShowAvatar(TRUE);
+ }
+
+ if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK))
+ {
+ gAgentAvatarp->updateAttachmentVisibility(mCameraMode);
+ }
+ }
+ else
+ {
+ camera_pos_global = camera_target_global;
+ mFocusGlobal = focus_target_global;
+ gAgent.setShowAvatar(TRUE);
+ }
+
+ // smoothing
+ if (TRUE)
+ {
+ LLVector3d agent_pos = gAgent.getPositionGlobal();
+ LLVector3d camera_pos_agent = camera_pos_global - agent_pos;
+ // Sitting on what you're manipulating can cause camera jitter with smoothing.
+ // This turns off smoothing while editing. -MG
+ bool in_build_mode = LLToolMgr::getInstance()->inBuildMode();
+ mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode;
+
+ if (cameraThirdPerson() && !mCameraSmoothingStop)
+ {
+ const F32 SMOOTHING_HALF_LIFE = 0.02f;
+
+ F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE);
+
+ if (mFocusOnAvatar && !mFocusObject) // we differentiate on avatar mode
+ {
+ // for avatar-relative focus, we smooth in avatar space -
+ // the avatar moves too jerkily w/r/t global space to smooth there.
+
+ LLVector3d delta = camera_pos_agent - mCameraSmoothingLastPositionAgent;
+ if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please
+ {
+ camera_pos_agent = lerp(mCameraSmoothingLastPositionAgent, camera_pos_agent, smoothing);
+ camera_pos_global = camera_pos_agent + agent_pos;
+ }
+ }
+ else
+ {
+ LLVector3d delta = camera_pos_global - mCameraSmoothingLastPositionGlobal;
+ if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please
+ {
+ camera_pos_global = lerp(mCameraSmoothingLastPositionGlobal, camera_pos_global, smoothing);
+ }
+ }
+ }
+
+ mCameraSmoothingLastPositionGlobal = camera_pos_global;
+ mCameraSmoothingLastPositionAgent = camera_pos_agent;
+ mCameraSmoothingStop = false;
+ }
+
+
+ mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLSmoothInterpolation::getInterpolant(FOV_ZOOM_HALF_LIFE));
+
+// LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL;
+
+ LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal);
+
+ mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global);
+
+ // Move the camera
+
+ LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent);
+ //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent);
+
+ // Change FOV
+ LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor));
+
+ // follow camera when in customize mode
+ if (cameraCustomizeAvatar())
+ {
+ setLookAt(LOOKAT_TARGET_FOCUS, NULL, mCameraPositionAgent);
+ }
+
+ // update the travel distance stat
+ // this isn't directly related to the camera
+ // but this seemed like the best place to do this
+ LLVector3d global_pos = gAgent.getPositionGlobal();
+ if (!gAgent.getLastPositionGlobal().isExactlyZero())
+ {
+ LLVector3d delta = global_pos - gAgent.getLastPositionGlobal();
+ gAgent.setDistanceTraveled(gAgent.getDistanceTraveled() + delta.magVec());
+ }
+ gAgent.setLastPositionGlobal(global_pos);
+
+ if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook())
+ {
+ LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() +
+ LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() +
+ LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation();
+ LLVector3 diff = mCameraPositionAgent - head_pos;
+ diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation();
+
+ LLJoint* torso_joint = gAgentAvatarp->mTorsop;
+ LLJoint* chest_joint = gAgentAvatarp->mChestp;
+ LLVector3 torso_scale = torso_joint->getScale();
+ LLVector3 chest_scale = chest_joint->getScale();
+
+ // shorten avatar skeleton to avoid foot interpenetration
+ if (!gAgentAvatarp->mInAir)
+ {
+ LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation();
+ F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f);
+ F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f);
+ torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor));
+
+ LLJoint* neck_joint = gAgentAvatarp->mNeckp;
+ LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation();
+ scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f);
+ chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor));
+ diff.mV[VZ] = 0.f;
+ }
+
+ // SL-315
+ gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
+
+ gAgentAvatarp->mRoot->updateWorldMatrixChildren();
+
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject *attached_object = attachment_iter->get();
+ if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull())
+ {
+ // clear any existing "early" movements of attachment
+ attached_object->mDrawable->clearState(LLDrawable::EARLY_MOVE);
+ gPipeline.updateMoveNormalAsync(attached_object->mDrawable);
+ attached_object->updateText();
+ }
+ }
+ }
+
+ torso_joint->setScale(torso_scale);
+ chest_joint->setScale(chest_scale);
+ }
}
void LLAgentCamera::updateLastCamera()
{
- mLastCameraMode = mCameraMode;
+ mLastCameraMode = mCameraMode;
}
void LLAgentCamera::updateFocusOffset()
{
- validateFocusObject();
- if (mFocusObject.notNull())
- {
- LLVector3d obj_pos = gAgent.getPosGlobalFromAgent(mFocusObject->getRenderPosition());
- mFocusObjectOffset.setVec(mFocusTargetGlobal - obj_pos);
- }
+ validateFocusObject();
+ if (mFocusObject.notNull())
+ {
+ LLVector3d obj_pos = gAgent.getPosGlobalFromAgent(mFocusObject->getRenderPosition());
+ mFocusObjectOffset.setVec(mFocusTargetGlobal - obj_pos);
+ }
}
void LLAgentCamera::validateFocusObject()
{
- if (mFocusObject.notNull() &&
- mFocusObject->isDead())
- {
- mFocusObjectOffset.clearVec();
- clearFocusObject();
- mCameraFOVZoomFactor = 0.f;
- }
+ if (mFocusObject.notNull() &&
+ mFocusObject->isDead())
+ {
+ mFocusObjectOffset.clearVec();
+ clearFocusObject();
+ mCameraFOVZoomFactor = 0.f;
+ }
}
//-----------------------------------------------------------------------------
@@ -1580,124 +1580,124 @@ void LLAgentCamera::validateFocusObject()
//-----------------------------------------------------------------------------
LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal()
{
- if (mFocusObject.notNull() && mFocusObject->isDead())
- {
- clearFocusObject();
- }
-
- if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar)
- {
- mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedFocus());
- return mFocusTargetGlobal;
- }
- else if (mCameraMode == CAMERA_MODE_MOUSELOOK)
- {
- LLVector3d at_axis(1.0, 0.0, 0.0);
- LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion();
- if (isAgentAvatarValid() && gAgentAvatarp->getParent())
- {
- LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot();
- if (!root_object->flagCameraDecoupled())
- {
- agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation();
- }
- }
- at_axis = at_axis * agent_rot;
- mFocusTargetGlobal = calcCameraPositionTargetGlobal() + at_axis;
- return mFocusTargetGlobal;
- }
- else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR)
- {
- if (mFocusOnAvatar)
- {
- LLVector3 focus_target = isAgentAvatarValid()
- ? gAgentAvatarp->mHeadp->getWorldPosition()
- : gAgent.getPositionAgent();
- LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target);
- mFocusTargetGlobal = focus_target_global;
- }
- return mFocusTargetGlobal;
- }
- else if (!mFocusOnAvatar)
- {
- if (mFocusObject.notNull() && !mFocusObject->isDead() && mFocusObject->mDrawable.notNull())
- {
- LLDrawable* drawablep = mFocusObject->mDrawable;
-
- if (mTrackFocusObject &&
- drawablep &&
- drawablep->isActive())
- {
- if (!mFocusObject->isAvatar())
- {
- if (mFocusObject->isSelected())
- {
- gPipeline.updateMoveNormalAsync(drawablep);
- }
- else
- {
- if (drawablep->isState(LLDrawable::MOVE_UNDAMPED))
- {
- gPipeline.updateMoveNormalAsync(drawablep);
- }
- else
- {
- gPipeline.updateMoveDampedAsync(drawablep);
- }
- }
- }
- }
- // if not tracking object, update offset based on new object position
- else
- {
- updateFocusOffset();
- }
- LLVector3 focus_agent = mFocusObject->getRenderPosition() + mFocusObjectOffset;
- mFocusTargetGlobal.setVec(gAgent.getPosGlobalFromAgent(focus_agent));
- }
- return mFocusTargetGlobal;
- }
- else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull())
- {
- // sit camera
- LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition();
- LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation();
-
- LLVector3 target_pos = object_pos + (mSitCameraFocus * object_rot);
- return gAgent.getPosGlobalFromAgent(target_pos);
- }
- else
- {
- return gAgent.getPositionGlobal() + calcThirdPersonFocusOffset();
- }
+ if (mFocusObject.notNull() && mFocusObject->isDead())
+ {
+ clearFocusObject();
+ }
+
+ if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar)
+ {
+ mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedFocus());
+ return mFocusTargetGlobal;
+ }
+ else if (mCameraMode == CAMERA_MODE_MOUSELOOK)
+ {
+ LLVector3d at_axis(1.0, 0.0, 0.0);
+ LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion();
+ if (isAgentAvatarValid() && gAgentAvatarp->getParent())
+ {
+ LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot();
+ if (!root_object->flagCameraDecoupled())
+ {
+ agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation();
+ }
+ }
+ at_axis = at_axis * agent_rot;
+ mFocusTargetGlobal = calcCameraPositionTargetGlobal() + at_axis;
+ return mFocusTargetGlobal;
+ }
+ else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR)
+ {
+ if (mFocusOnAvatar)
+ {
+ LLVector3 focus_target = isAgentAvatarValid()
+ ? gAgentAvatarp->mHeadp->getWorldPosition()
+ : gAgent.getPositionAgent();
+ LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target);
+ mFocusTargetGlobal = focus_target_global;
+ }
+ return mFocusTargetGlobal;
+ }
+ else if (!mFocusOnAvatar)
+ {
+ if (mFocusObject.notNull() && !mFocusObject->isDead() && mFocusObject->mDrawable.notNull())
+ {
+ LLDrawable* drawablep = mFocusObject->mDrawable;
+
+ if (mTrackFocusObject &&
+ drawablep &&
+ drawablep->isActive())
+ {
+ if (!mFocusObject->isAvatar())
+ {
+ if (mFocusObject->isSelected())
+ {
+ gPipeline.updateMoveNormalAsync(drawablep);
+ }
+ else
+ {
+ if (drawablep->isState(LLDrawable::MOVE_UNDAMPED))
+ {
+ gPipeline.updateMoveNormalAsync(drawablep);
+ }
+ else
+ {
+ gPipeline.updateMoveDampedAsync(drawablep);
+ }
+ }
+ }
+ }
+ // if not tracking object, update offset based on new object position
+ else
+ {
+ updateFocusOffset();
+ }
+ LLVector3 focus_agent = mFocusObject->getRenderPosition() + mFocusObjectOffset;
+ mFocusTargetGlobal.setVec(gAgent.getPosGlobalFromAgent(focus_agent));
+ }
+ return mFocusTargetGlobal;
+ }
+ else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull())
+ {
+ // sit camera
+ LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition();
+ LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation();
+
+ LLVector3 target_pos = object_pos + (mSitCameraFocus * object_rot);
+ return gAgent.getPosGlobalFromAgent(target_pos);
+ }
+ else
+ {
+ return gAgent.getPositionGlobal() + calcThirdPersonFocusOffset();
+ }
}
LLVector3d LLAgentCamera::calcThirdPersonFocusOffset()
{
- // ...offset from avatar
- LLVector3d focus_offset;
- LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion();
- if (isAgentAvatarValid() && gAgentAvatarp->getParent())
- {
- agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation();
- }
+ // ...offset from avatar
+ LLVector3d focus_offset;
+ LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion();
+ if (isAgentAvatarValid() && gAgentAvatarp->getParent())
+ {
+ agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation();
+ }
static LLCachedControl<LLVector3d> focus_offset_initial(gSavedSettings, "FocusOffsetRearView", LLVector3d());
- return focus_offset_initial * agent_rot;
+ return focus_offset_initial * agent_rot;
}
void LLAgentCamera::setupSitCamera()
{
- // agent frame entering this function is in world coordinates
- if (isAgentAvatarValid() && gAgentAvatarp->getParent())
- {
- LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
- // slam agent coordinate frame to proper parent local version
- LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis();
- at_axis.mV[VZ] = 0.f;
- at_axis.normalize();
- gAgent.resetAxes(at_axis * ~parent_rot);
- }
+ // agent frame entering this function is in world coordinates
+ if (isAgentAvatarValid() && gAgentAvatarp->getParent())
+ {
+ LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
+ // slam agent coordinate frame to proper parent local version
+ LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis();
+ at_axis.mV[VZ] = 0.f;
+ at_axis.normalize();
+ gAgent.resetAxes(at_axis * ~parent_rot);
+ }
}
//-----------------------------------------------------------------------------
@@ -1705,7 +1705,7 @@ void LLAgentCamera::setupSitCamera()
//-----------------------------------------------------------------------------
const LLVector3 &LLAgentCamera::getCameraPositionAgent() const
{
- return LLViewerCamera::getInstance()->getOrigin();
+ return LLViewerCamera::getInstance()->getOrigin();
}
//-----------------------------------------------------------------------------
@@ -1713,39 +1713,39 @@ const LLVector3 &LLAgentCamera::getCameraPositionAgent() const
//-----------------------------------------------------------------------------
LLVector3d LLAgentCamera::getCameraPositionGlobal() const
{
- return gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin());
+ return gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin());
}
//-----------------------------------------------------------------------------
// calcCameraFOVZoomFactor()
//-----------------------------------------------------------------------------
-F32 LLAgentCamera::calcCameraFOVZoomFactor()
+F32 LLAgentCamera::calcCameraFOVZoomFactor()
{
- LLVector3 camera_offset_dir;
- camera_offset_dir.setVec(mCameraFocusOffset);
+ LLVector3 camera_offset_dir;
+ camera_offset_dir.setVec(mCameraFocusOffset);
- if (mCameraMode == CAMERA_MODE_MOUSELOOK)
- {
- return 0.f;
- }
- else if (mFocusObject.notNull() && !mFocusObject->isAvatar() && !mFocusOnAvatar)
- {
- // don't FOV zoom on mostly transparent objects
- F32 obj_min_dist = 0.f;
- calcCameraMinDistance(obj_min_dist);
- F32 current_distance = llmax(0.001f, camera_offset_dir.magVec());
+ if (mCameraMode == CAMERA_MODE_MOUSELOOK)
+ {
+ return 0.f;
+ }
+ else if (mFocusObject.notNull() && !mFocusObject->isAvatar() && !mFocusOnAvatar)
+ {
+ // don't FOV zoom on mostly transparent objects
+ F32 obj_min_dist = 0.f;
+ calcCameraMinDistance(obj_min_dist);
+ F32 current_distance = llmax(0.001f, camera_offset_dir.magVec());
- mFocusObjectDist = obj_min_dist - current_distance;
+ mFocusObjectDist = obj_min_dist - current_distance;
- F32 new_fov_zoom = llclamp(mFocusObjectDist / current_distance, 0.f, 1000.f);
- return new_fov_zoom;
- }
- else // focusing on land or avatar
- {
- // keep old field of view until user changes focus explicitly
- return mCameraFOVZoomFactor;
- //return 0.f;
- }
+ F32 new_fov_zoom = llclamp(mFocusObjectDist / current_distance, 0.f, 1000.f);
+ return new_fov_zoom;
+ }
+ else // focusing on land or avatar
+ {
+ // keep old field of view until user changes focus explicitly
+ return mCameraFOVZoomFactor;
+ //return 0.f;
+ }
}
//-----------------------------------------------------------------------------
@@ -1753,307 +1753,307 @@ F32 LLAgentCamera::calcCameraFOVZoomFactor()
//-----------------------------------------------------------------------------
LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
{
- // Compute base camera position and look-at points.
- F32 camera_land_height;
- LLVector3d frame_center_global = !isAgentAvatarValid() ?
- gAgent.getPositionGlobal() :
- gAgent.getPosGlobalFromAgent(getAvatarRootPosition());
-
- BOOL isConstrained = FALSE;
- LLVector3d head_offset;
- head_offset.setVec(mThirdPersonHeadOffset);
-
- LLVector3d camera_position_global;
-
- if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar)
- {
- camera_position_global = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedPosition());
- }
- else if (mCameraMode == CAMERA_MODE_MOUSELOOK)
- {
- if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull())
- {
- LL_WARNS() << "Null avatar drawable!" << LL_ENDL;
- return LLVector3d::zero;
- }
-
- head_offset.clearVec();
- F32 fixup;
+ // Compute base camera position and look-at points.
+ F32 camera_land_height;
+ LLVector3d frame_center_global = !isAgentAvatarValid() ?
+ gAgent.getPositionGlobal() :
+ gAgent.getPosGlobalFromAgent(getAvatarRootPosition());
+
+ BOOL isConstrained = FALSE;
+ LLVector3d head_offset;
+ head_offset.setVec(mThirdPersonHeadOffset);
+
+ LLVector3d camera_position_global;
+
+ if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar)
+ {
+ camera_position_global = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedPosition());
+ }
+ else if (mCameraMode == CAMERA_MODE_MOUSELOOK)
+ {
+ if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull())
+ {
+ LL_WARNS() << "Null avatar drawable!" << LL_ENDL;
+ return LLVector3d::zero;
+ }
+
+ head_offset.clearVec();
+ F32 fixup;
if (gAgentAvatarp->hasPelvisFixup(fixup) && !gAgentAvatarp->isSitting())
- {
- head_offset[VZ] -= fixup;
- }
- if (gAgentAvatarp->isSitting())
- {
- head_offset.mdV[VZ] += 0.1;
- }
-
- if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent())
- {
- gAgentAvatarp->updateHeadOffset();
- head_offset.mdV[VX] += gAgentAvatarp->mHeadOffset.mV[VX];
- head_offset.mdV[VY] += gAgentAvatarp->mHeadOffset.mV[VY];
- head_offset.mdV[VZ] += gAgentAvatarp->mHeadOffset.mV[VZ];
- const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatarp->getParent())->getRenderMatrix();
- camera_position_global = gAgent.getPosGlobalFromAgent
- ((gAgentAvatarp->getPosition()+
- LLVector3(head_offset)*gAgentAvatarp->getRotation()) * mat);
- }
- else
- {
- head_offset.mdV[VZ] += gAgentAvatarp->mHeadOffset.mV[VZ];
- camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global;
- head_offset = head_offset * gAgentAvatarp->getRenderRotation();
- camera_position_global = camera_position_global + head_offset;
- }
- }
- else if (mCameraMode == CAMERA_MODE_THIRD_PERSON && mFocusOnAvatar)
- {
- LLVector3 local_camera_offset;
- F32 camera_distance = 0.f;
-
- if (mSitCameraEnabled
- && isAgentAvatarValid()
- && gAgentAvatarp->isSitting()
- && mSitCameraReferenceObject.notNull())
- {
- // sit camera
- LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition();
- LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation();
-
- LLVector3 target_pos = object_pos + (mSitCameraPos * object_rot);
-
- camera_position_global = gAgent.getPosGlobalFromAgent(target_pos);
- }
- else
- {
+ {
+ head_offset[VZ] -= fixup;
+ }
+ if (gAgentAvatarp->isSitting())
+ {
+ head_offset.mdV[VZ] += 0.1;
+ }
+
+ if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent())
+ {
+ gAgentAvatarp->updateHeadOffset();
+ head_offset.mdV[VX] += gAgentAvatarp->mHeadOffset.mV[VX];
+ head_offset.mdV[VY] += gAgentAvatarp->mHeadOffset.mV[VY];
+ head_offset.mdV[VZ] += gAgentAvatarp->mHeadOffset.mV[VZ];
+ const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatarp->getParent())->getRenderMatrix();
+ camera_position_global = gAgent.getPosGlobalFromAgent
+ ((gAgentAvatarp->getPosition()+
+ LLVector3(head_offset)*gAgentAvatarp->getRotation()) * mat);
+ }
+ else
+ {
+ head_offset.mdV[VZ] += gAgentAvatarp->mHeadOffset.mV[VZ];
+ camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global;
+ head_offset = head_offset * gAgentAvatarp->getRenderRotation();
+ camera_position_global = camera_position_global + head_offset;
+ }
+ }
+ else if (mCameraMode == CAMERA_MODE_THIRD_PERSON && mFocusOnAvatar)
+ {
+ LLVector3 local_camera_offset;
+ F32 camera_distance = 0.f;
+
+ if (mSitCameraEnabled
+ && isAgentAvatarValid()
+ && gAgentAvatarp->isSitting()
+ && mSitCameraReferenceObject.notNull())
+ {
+ // sit camera
+ LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition();
+ LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation();
+
+ LLVector3 target_pos = object_pos + (mSitCameraPos * object_rot);
+
+ camera_position_global = gAgent.getPosGlobalFromAgent(target_pos);
+ }
+ else
+ {
static LLCachedControl<F32> camera_offset_scale(gSavedSettings, "CameraOffsetScale");
local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * camera_offset_scale;
- // are we sitting down?
- if (isAgentAvatarValid() && gAgentAvatarp->getParent())
- {
- LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
- // slam agent coordinate frame to proper parent local version
- LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis() * parent_rot;
- at_axis.mV[VZ] = 0.f;
- at_axis.normalize();
- gAgent.resetAxes(at_axis * ~parent_rot);
-
- local_camera_offset = local_camera_offset * gAgent.getFrameAgent().getQuaternion() * parent_rot;
- }
- else
- {
- local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset );
- }
-
- if (!isDisableCameraConstraints() && !mCameraCollidePlane.isExactlyZero() &&
- (!isAgentAvatarValid() || !gAgentAvatarp->isSitting()))
- {
- LLVector3 plane_normal;
- plane_normal.setVec(mCameraCollidePlane.mV);
-
- F32 offset_dot_norm = local_camera_offset * plane_normal;
- if (llabs(offset_dot_norm) < 0.001f)
- {
- offset_dot_norm = 0.001f;
- }
-
- camera_distance = local_camera_offset.normalize();
-
- F32 pos_dot_norm = gAgent.getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal;
-
- // if agent is outside the colliding half-plane
- if (pos_dot_norm > mCameraCollidePlane.mV[VW])
- {
- // check to see if camera is on the opposite side (inside) the half-plane
- if (offset_dot_norm + pos_dot_norm < mCameraCollidePlane.mV[VW])
- {
- // diminish offset by factor to push it back outside the half-plane
- camera_distance *= (pos_dot_norm - mCameraCollidePlane.mV[VW] - CAMERA_COLLIDE_EPSILON) / -offset_dot_norm;
- }
- }
- else
- {
- if (offset_dot_norm + pos_dot_norm > mCameraCollidePlane.mV[VW])
- {
- camera_distance *= (mCameraCollidePlane.mV[VW] - pos_dot_norm - CAMERA_COLLIDE_EPSILON) / offset_dot_norm;
- }
- }
- }
- else
- {
- camera_distance = local_camera_offset.normalize();
- }
-
- mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE);
-
- if (mTargetCameraDistance != mCurrentCameraDistance)
- {
- F32 camera_lerp_amt = LLSmoothInterpolation::getInterpolant(CAMERA_ZOOM_HALF_LIFE);
-
- mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt);
- }
-
- // Make the camera distance current
- local_camera_offset *= mCurrentCameraDistance;
-
- // set the global camera position
- LLVector3d camera_offset;
-
- camera_offset.setVec( local_camera_offset );
- camera_position_global = frame_center_global + head_offset + camera_offset;
-
- if (isAgentAvatarValid())
- {
- LLVector3d camera_lag_d;
- F32 lag_interp = LLSmoothInterpolation::getInterpolant(CAMERA_LAG_HALF_LIFE);
- LLVector3 target_lag;
- LLVector3 vel = gAgent.getVelocity();
-
- // lag by appropriate amount for flying
- F32 time_in_air = gAgentAvatarp->mTimeInAir.getElapsedTimeF32();
- if(!mCameraAnimating && gAgentAvatarp->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME)
- {
- LLVector3 frame_at_axis = gAgent.getFrameAgent().getAtAxis();
- frame_at_axis -= projected_vec(frame_at_axis, gAgent.getReferenceUpVector());
- frame_at_axis.normalize();
-
- //transition smoothly in air mode, to avoid camera pop
- F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME;
- u = llclamp(u, 0.f, 1.f);
-
- lag_interp *= u;
-
- if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatarp->getID())
- {
- // disable camera lag when using mouse-directed steering
- target_lag.clearVec();
- }
- else
- {
- target_lag = vel * gSavedSettings.getF32("DynamicCameraStrength") / 30.f;
- }
-
- mCameraLag = lerp(mCameraLag, target_lag, lag_interp);
-
- F32 lag_dist = mCameraLag.magVec();
- if (lag_dist > MAX_CAMERA_LAG)
- {
- mCameraLag = mCameraLag * MAX_CAMERA_LAG / lag_dist;
- }
-
- // clamp camera lag so that avatar is always in front
- F32 dot = (mCameraLag - (frame_at_axis * (MIN_CAMERA_LAG * u))) * frame_at_axis;
- if (dot < -(MIN_CAMERA_LAG * u))
- {
- mCameraLag -= (dot + (MIN_CAMERA_LAG * u)) * frame_at_axis;
- }
- }
- else
- {
- mCameraLag = lerp(mCameraLag, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.15f));
- }
-
- camera_lag_d.setVec(mCameraLag);
- camera_position_global = camera_position_global - camera_lag_d;
- }
- }
- }
- else
- {
- LLVector3d focusPosGlobal = calcFocusPositionTargetGlobal();
- // camera gets pushed out later wrt mCameraFOVZoomFactor...this is "raw" value
- camera_position_global = focusPosGlobal + mCameraFocusOffset;
- }
-
- if (!isDisableCameraConstraints() && !gAgent.isGodlike())
- {
- LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global);
- bool constrain = true;
- if(regionp && regionp->canManageEstate())
- {
- constrain = false;
- }
- if(constrain)
- {
- F32 max_dist = (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode) ? APPEARANCE_MAX_ZOOM : mDrawDistance;
-
- LLVector3d camera_offset = camera_position_global - gAgent.getPositionGlobal();
- F32 camera_distance = (F32)camera_offset.magVec();
-
- if(camera_distance > max_dist)
- {
- camera_position_global = gAgent.getPositionGlobal() + (max_dist/camera_distance)*camera_offset;
- isConstrained = TRUE;
- }
- }
+ // are we sitting down?
+ if (isAgentAvatarValid() && gAgentAvatarp->getParent())
+ {
+ LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
+ // slam agent coordinate frame to proper parent local version
+ LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis() * parent_rot;
+ at_axis.mV[VZ] = 0.f;
+ at_axis.normalize();
+ gAgent.resetAxes(at_axis * ~parent_rot);
+
+ local_camera_offset = local_camera_offset * gAgent.getFrameAgent().getQuaternion() * parent_rot;
+ }
+ else
+ {
+ local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset );
+ }
+
+ if (!isDisableCameraConstraints() && !mCameraCollidePlane.isExactlyZero() &&
+ (!isAgentAvatarValid() || !gAgentAvatarp->isSitting()))
+ {
+ LLVector3 plane_normal;
+ plane_normal.setVec(mCameraCollidePlane.mV);
+
+ F32 offset_dot_norm = local_camera_offset * plane_normal;
+ if (llabs(offset_dot_norm) < 0.001f)
+ {
+ offset_dot_norm = 0.001f;
+ }
+
+ camera_distance = local_camera_offset.normalize();
+
+ F32 pos_dot_norm = gAgent.getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal;
+
+ // if agent is outside the colliding half-plane
+ if (pos_dot_norm > mCameraCollidePlane.mV[VW])
+ {
+ // check to see if camera is on the opposite side (inside) the half-plane
+ if (offset_dot_norm + pos_dot_norm < mCameraCollidePlane.mV[VW])
+ {
+ // diminish offset by factor to push it back outside the half-plane
+ camera_distance *= (pos_dot_norm - mCameraCollidePlane.mV[VW] - CAMERA_COLLIDE_EPSILON) / -offset_dot_norm;
+ }
+ }
+ else
+ {
+ if (offset_dot_norm + pos_dot_norm > mCameraCollidePlane.mV[VW])
+ {
+ camera_distance *= (mCameraCollidePlane.mV[VW] - pos_dot_norm - CAMERA_COLLIDE_EPSILON) / offset_dot_norm;
+ }
+ }
+ }
+ else
+ {
+ camera_distance = local_camera_offset.normalize();
+ }
+
+ mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE);
+
+ if (mTargetCameraDistance != mCurrentCameraDistance)
+ {
+ F32 camera_lerp_amt = LLSmoothInterpolation::getInterpolant(CAMERA_ZOOM_HALF_LIFE);
+
+ mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt);
+ }
+
+ // Make the camera distance current
+ local_camera_offset *= mCurrentCameraDistance;
+
+ // set the global camera position
+ LLVector3d camera_offset;
+
+ camera_offset.setVec( local_camera_offset );
+ camera_position_global = frame_center_global + head_offset + camera_offset;
+
+ if (isAgentAvatarValid())
+ {
+ LLVector3d camera_lag_d;
+ F32 lag_interp = LLSmoothInterpolation::getInterpolant(CAMERA_LAG_HALF_LIFE);
+ LLVector3 target_lag;
+ LLVector3 vel = gAgent.getVelocity();
+
+ // lag by appropriate amount for flying
+ F32 time_in_air = gAgentAvatarp->mTimeInAir.getElapsedTimeF32();
+ if(!mCameraAnimating && gAgentAvatarp->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME)
+ {
+ LLVector3 frame_at_axis = gAgent.getFrameAgent().getAtAxis();
+ frame_at_axis -= projected_vec(frame_at_axis, gAgent.getReferenceUpVector());
+ frame_at_axis.normalize();
+
+ //transition smoothly in air mode, to avoid camera pop
+ F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME;
+ u = llclamp(u, 0.f, 1.f);
+
+ lag_interp *= u;
+
+ if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatarp->getID())
+ {
+ // disable camera lag when using mouse-directed steering
+ target_lag.clearVec();
+ }
+ else
+ {
+ target_lag = vel * gSavedSettings.getF32("DynamicCameraStrength") / 30.f;
+ }
+
+ mCameraLag = lerp(mCameraLag, target_lag, lag_interp);
+
+ F32 lag_dist = mCameraLag.magVec();
+ if (lag_dist > MAX_CAMERA_LAG)
+ {
+ mCameraLag = mCameraLag * MAX_CAMERA_LAG / lag_dist;
+ }
+
+ // clamp camera lag so that avatar is always in front
+ F32 dot = (mCameraLag - (frame_at_axis * (MIN_CAMERA_LAG * u))) * frame_at_axis;
+ if (dot < -(MIN_CAMERA_LAG * u))
+ {
+ mCameraLag -= (dot + (MIN_CAMERA_LAG * u)) * frame_at_axis;
+ }
+ }
+ else
+ {
+ mCameraLag = lerp(mCameraLag, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.15f));
+ }
+
+ camera_lag_d.setVec(mCameraLag);
+ camera_position_global = camera_position_global - camera_lag_d;
+ }
+ }
+ }
+ else
+ {
+ LLVector3d focusPosGlobal = calcFocusPositionTargetGlobal();
+ // camera gets pushed out later wrt mCameraFOVZoomFactor...this is "raw" value
+ camera_position_global = focusPosGlobal + mCameraFocusOffset;
+ }
+
+ if (!isDisableCameraConstraints() && !gAgent.isGodlike())
+ {
+ LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global);
+ bool constrain = true;
+ if(regionp && regionp->canManageEstate())
+ {
+ constrain = false;
+ }
+ if(constrain)
+ {
+ F32 max_dist = (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode) ? APPEARANCE_MAX_ZOOM : mDrawDistance;
+
+ LLVector3d camera_offset = camera_position_global - gAgent.getPositionGlobal();
+ F32 camera_distance = (F32)camera_offset.magVec();
+
+ if(camera_distance > max_dist)
+ {
+ camera_position_global = gAgent.getPositionGlobal() + (max_dist/camera_distance)*camera_offset;
+ isConstrained = TRUE;
+ }
+ }
// JC - Could constrain camera based on parcel stuff here.
-// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global);
-//
-// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global)))
-// {
-// camera_position_global = last_position_global;
+// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global);
+//
+// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global)))
+// {
+// camera_position_global = last_position_global;
//
-// isConstrained = TRUE;
-// }
- }
+// isConstrained = TRUE;
+// }
+ }
- // Don't let camera go underground
- F32 camera_min_off_ground = getCameraMinOffGround();
- camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global);
- F32 minZ = llmax(F_ALMOST_ZERO, camera_land_height + camera_min_off_ground);
- if (camera_position_global.mdV[VZ] < minZ)
- {
- camera_position_global.mdV[VZ] = minZ;
- isConstrained = TRUE;
- }
+ // Don't let camera go underground
+ F32 camera_min_off_ground = getCameraMinOffGround();
+ camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global);
+ F32 minZ = llmax(F_ALMOST_ZERO, camera_land_height + camera_min_off_ground);
+ if (camera_position_global.mdV[VZ] < minZ)
+ {
+ camera_position_global.mdV[VZ] = minZ;
+ isConstrained = TRUE;
+ }
- if (hit_limit)
- {
- *hit_limit = isConstrained;
- }
+ if (hit_limit)
+ {
+ *hit_limit = isConstrained;
+ }
- return camera_position_global;
+ return camera_position_global;
}
LLVector3 LLAgentCamera::getCurrentCameraOffset()
{
- return (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~getCurrentAvatarRotation();
+ return (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~getCurrentAvatarRotation();
}
LLVector3d LLAgentCamera::getCurrentFocusOffset()
{
- return (mFocusTargetGlobal - gAgent.getPositionGlobal()) * ~getCurrentAvatarRotation();
+ return (mFocusTargetGlobal - gAgent.getPositionGlobal()) * ~getCurrentAvatarRotation();
}
LLQuaternion LLAgentCamera::getCurrentAvatarRotation()
{
- LLViewerObject* sit_object = (LLViewerObject*)gAgentAvatarp->getParent();
-
- LLQuaternion av_rot = gAgent.getFrameAgent().getQuaternion();
- LLQuaternion obj_rot = sit_object ? sit_object->getRenderRotation() : LLQuaternion::DEFAULT;
- return av_rot * obj_rot;
+ LLViewerObject* sit_object = (LLViewerObject*)gAgentAvatarp->getParent();
+
+ LLQuaternion av_rot = gAgent.getFrameAgent().getQuaternion();
+ LLQuaternion obj_rot = sit_object ? sit_object->getRenderRotation() : LLQuaternion::DEFAULT;
+ return av_rot * obj_rot;
}
bool LLAgentCamera::isJoystickCameraUsed()
{
- return ((mOrbitAroundRadians != 0) || (mOrbitOverAngle != 0) || !mPanFocusDiff.isNull());
+ return ((mOrbitAroundRadians != 0) || (mOrbitOverAngle != 0) || !mPanFocusDiff.isNull());
}
LLVector3 LLAgentCamera::getCameraOffsetInitial()
{
// getCameraOffsetInitial and getFocusOffsetInitial can be called on update from idle before init()
static LLCachedControl<LLVector3> camera_offset_initial (gSavedSettings, "CameraOffsetRearView", LLVector3());
- return camera_offset_initial;
+ return camera_offset_initial;
}
LLVector3d LLAgentCamera::getFocusOffsetInitial()
{
static LLCachedControl<LLVector3d> focus_offset_initial(gSavedSettings, "FocusOffsetRearView", LLVector3d());
- return focus_offset_initial;
+ return focus_offset_initial;
}
F32 LLAgentCamera::getCameraMaxZoomDistance()
@@ -2082,48 +2082,48 @@ LLVector3 LLAgentCamera::getAvatarRootPosition()
//-----------------------------------------------------------------------------
void LLAgentCamera::handleScrollWheel(S32 clicks)
{
- if (mCameraMode == CAMERA_MODE_FOLLOW && getFocusOnAvatar())
- {
- if (!mFollowCam.getPositionLocked()) // not if the followCam position is locked in place
- {
- mFollowCam.zoom(clicks);
- if (mFollowCam.isZoomedToMinimumDistance())
- {
- changeCameraToMouselook(FALSE);
- }
- }
- }
- else
- {
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2);
-
- // Block if camera is animating
- if (mCameraAnimating)
- {
- return;
- }
-
- if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
- {
- F32 zoom_factor = (F32)pow(0.8, -clicks);
- cameraZoomIn(zoom_factor);
- }
- else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON))
- {
- F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec();
-
- F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale"));
- current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks);
-
- cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale"));
- }
- else
- {
- F32 current_zoom_fraction = (F32)mCameraFocusOffsetTarget.magVec();
- cameraOrbitIn(current_zoom_fraction * (1.f - pow(ROOT_ROOT_TWO, clicks)));
- }
- }
+ if (mCameraMode == CAMERA_MODE_FOLLOW && getFocusOnAvatar())
+ {
+ if (!mFollowCam.getPositionLocked()) // not if the followCam position is locked in place
+ {
+ mFollowCam.zoom(clicks);
+ if (mFollowCam.isZoomedToMinimumDistance())
+ {
+ changeCameraToMouselook(FALSE);
+ }
+ }
+ }
+ else
+ {
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2);
+
+ // Block if camera is animating
+ if (mCameraAnimating)
+ {
+ return;
+ }
+
+ if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ F32 zoom_factor = (F32)pow(0.8, -clicks);
+ cameraZoomIn(zoom_factor);
+ }
+ else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON))
+ {
+ F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec();
+
+ F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale"));
+ current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks);
+
+ cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale"));
+ }
+ else
+ {
+ F32 current_zoom_fraction = (F32)mCameraFocusOffsetTarget.magVec();
+ cameraOrbitIn(current_zoom_fraction * (1.f - pow(ROOT_ROOT_TWO, clicks)));
+ }
+ }
}
@@ -2132,17 +2132,17 @@ void LLAgentCamera::handleScrollWheel(S32 clicks)
//-----------------------------------------------------------------------------
F32 LLAgentCamera::getCameraMinOffGround()
{
- if (mCameraMode == CAMERA_MODE_MOUSELOOK)
- {
- return 0.f;
- }
+ if (mCameraMode == CAMERA_MODE_MOUSELOOK)
+ {
+ return 0.f;
+ }
- if (isDisableCameraConstraints())
- {
- return -1000.f;
- }
+ if (isDisableCameraConstraints())
+ {
+ return -1000.f;
+ }
- return 0.5f;
+ return 0.5f;
}
@@ -2151,15 +2151,15 @@ F32 LLAgentCamera::getCameraMinOffGround()
//-----------------------------------------------------------------------------
void LLAgentCamera::resetCamera()
{
- // Remove any pitch from the avatar
- LLVector3 at = gAgent.getFrameAgent().getAtAxis();
- at.mV[VZ] = 0.f;
- at.normalize();
- gAgent.resetAxes(at);
- // have to explicitly clear field of view zoom now
- mCameraFOVZoomFactor = 0.f;
+ // Remove any pitch from the avatar
+ LLVector3 at = gAgent.getFrameAgent().getAtAxis();
+ at.mV[VZ] = 0.f;
+ at.normalize();
+ gAgent.resetAxes(at);
+ // have to explicitly clear field of view zoom now
+ mCameraFOVZoomFactor = 0.f;
- updateCamera();
+ updateCamera();
}
//-----------------------------------------------------------------------------
@@ -2167,58 +2167,58 @@ void LLAgentCamera::resetCamera()
//-----------------------------------------------------------------------------
void LLAgentCamera::changeCameraToMouselook(BOOL animate)
{
- if (!gSavedSettings.getBOOL("EnableMouselook")
- || LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- return;
- }
-
- // visibility changes at end of animation
- gViewerWindow->getWindow()->resetBusyCount();
-
- // Menus should not remain open on switching to mouselook...
- LLMenuGL::sMenuContainer->hideMenus();
- LLUI::getInstance()->clearPopups();
-
- // unpause avatar animation
- gAgent.unpauseAnimation();
-
- LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset);
-
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->stopMotion(ANIM_AGENT_BODY_NOISE);
- gAgentAvatarp->stopMotion(ANIM_AGENT_BREATHE_ROT);
- }
-
- //gViewerWindow->stopGrab();
- LLSelectMgr::getInstance()->deselectAll();
- gViewerWindow->hideCursor();
- gViewerWindow->moveCursorToCenter();
-
- if (mCameraMode != CAMERA_MODE_MOUSELOOK)
- {
- gFocusMgr.setKeyboardFocus(NULL);
-
- updateLastCamera();
- mCameraMode = CAMERA_MODE_MOUSELOOK;
- const U32 old_flags = gAgent.getControlFlags();
- gAgent.setControlFlags(AGENT_CONTROL_MOUSELOOK);
- if (old_flags != gAgent.getControlFlags())
- {
- gAgent.setFlagsDirty();
- }
-
- if (animate)
- {
- startCameraAnimation();
- }
- else
- {
- mCameraAnimating = FALSE;
- gAgent.endAnimationUpdateUI();
- }
- }
+ if (!gSavedSettings.getBOOL("EnableMouselook")
+ || LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ return;
+ }
+
+ // visibility changes at end of animation
+ gViewerWindow->getWindow()->resetBusyCount();
+
+ // Menus should not remain open on switching to mouselook...
+ LLMenuGL::sMenuContainer->hideMenus();
+ LLUI::getInstance()->clearPopups();
+
+ // unpause avatar animation
+ gAgent.unpauseAnimation();
+
+ LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset);
+
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->stopMotion(ANIM_AGENT_BODY_NOISE);
+ gAgentAvatarp->stopMotion(ANIM_AGENT_BREATHE_ROT);
+ }
+
+ //gViewerWindow->stopGrab();
+ LLSelectMgr::getInstance()->deselectAll();
+ gViewerWindow->hideCursor();
+ gViewerWindow->moveCursorToCenter();
+
+ if (mCameraMode != CAMERA_MODE_MOUSELOOK)
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+
+ updateLastCamera();
+ mCameraMode = CAMERA_MODE_MOUSELOOK;
+ const U32 old_flags = gAgent.getControlFlags();
+ gAgent.setControlFlags(AGENT_CONTROL_MOUSELOOK);
+ if (old_flags != gAgent.getControlFlags())
+ {
+ gAgent.setFlagsDirty();
+ }
+
+ if (animate)
+ {
+ startCameraAnimation();
+ }
+ else
+ {
+ mCameraAnimating = FALSE;
+ gAgent.endAnimationUpdateUI();
+ }
+ }
}
@@ -2227,24 +2227,24 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate)
//-----------------------------------------------------------------------------
void LLAgentCamera::changeCameraToDefault()
{
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- return;
- }
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ return;
+ }
- if (LLFollowCamMgr::getInstance()->getActiveFollowCamParams())
- {
- changeCameraToFollow();
- }
- else
- {
- changeCameraToThirdPerson();
- }
- if (gSavedSettings.getBOOL("HideUIControls"))
- {
- gViewerWindow->setUIVisibility(false);
- LLPanelStandStopFlying::getInstance()->setVisible(false);
- }
+ if (LLFollowCamMgr::getInstance()->getActiveFollowCamParams())
+ {
+ changeCameraToFollow();
+ }
+ else
+ {
+ changeCameraToThirdPerson();
+ }
+ if (gSavedSettings.getBOOL("HideUIControls"))
+ {
+ gViewerWindow->setUIVisibility(false);
+ LLPanelStandStopFlying::getInstance()->setVisible(false);
+ }
}
@@ -2253,53 +2253,53 @@ void LLAgentCamera::changeCameraToDefault()
//-----------------------------------------------------------------------------
void LLAgentCamera::changeCameraToFollow(BOOL animate)
{
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- return;
- }
-
- if(mCameraMode != CAMERA_MODE_FOLLOW)
- {
- if (mCameraMode == CAMERA_MODE_MOUSELOOK)
- {
- animate = FALSE;
- }
- startCameraAnimation();
-
- updateLastCamera();
- mCameraMode = CAMERA_MODE_FOLLOW;
-
- // bang-in the current focus, position, and up vector of the follow cam
- mFollowCam.reset(mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis);
-
- if (gBasicToolset)
- {
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- }
-
- if (isAgentAvatarValid())
- {
- // SL-315
- gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero);
- gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE );
- gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT );
- }
-
- // unpause avatar animation
- gAgent.unpauseAnimation();
-
- gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
-
- if (animate)
- {
- startCameraAnimation();
- }
- else
- {
- mCameraAnimating = FALSE;
- gAgent.endAnimationUpdateUI();
- }
- }
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ return;
+ }
+
+ if(mCameraMode != CAMERA_MODE_FOLLOW)
+ {
+ if (mCameraMode == CAMERA_MODE_MOUSELOOK)
+ {
+ animate = FALSE;
+ }
+ startCameraAnimation();
+
+ updateLastCamera();
+ mCameraMode = CAMERA_MODE_FOLLOW;
+
+ // bang-in the current focus, position, and up vector of the follow cam
+ mFollowCam.reset(mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis);
+
+ if (gBasicToolset)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ }
+
+ if (isAgentAvatarValid())
+ {
+ // SL-315
+ gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero);
+ gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE );
+ gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT );
+ }
+
+ // unpause avatar animation
+ gAgent.unpauseAnimation();
+
+ gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
+
+ if (animate)
+ {
+ startCameraAnimation();
+ }
+ else
+ {
+ mCameraAnimating = FALSE;
+ gAgent.endAnimationUpdateUI();
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -2307,69 +2307,69 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate)
//-----------------------------------------------------------------------------
void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
{
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- return;
- }
-
- gViewerWindow->getWindow()->resetBusyCount();
-
- mCameraZoomFraction = INITIAL_ZOOM_FRACTION;
-
- if (isAgentAvatarValid())
- {
- if (!gAgentAvatarp->isSitting())
- {
- // SL-315
- gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero);
- }
- gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE);
- gAgentAvatarp->startMotion(ANIM_AGENT_BREATHE_ROT);
- }
-
- LLVector3 at_axis;
-
- // unpause avatar animation
- gAgent.unpauseAnimation();
-
- if (mCameraMode != CAMERA_MODE_THIRD_PERSON)
- {
- if (gBasicToolset)
- {
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- }
-
- mCameraLag.clearVec();
- if (mCameraMode == CAMERA_MODE_MOUSELOOK)
- {
- mCurrentCameraDistance = MIN_CAMERA_DISTANCE;
- mTargetCameraDistance = MIN_CAMERA_DISTANCE;
- animate = FALSE;
- }
- updateLastCamera();
- mCameraMode = CAMERA_MODE_THIRD_PERSON;
- gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
- }
-
- // Remove any pitch from the avatar
- if (!isAgentAvatarValid() || !gAgentAvatarp->getParent())
- {
- at_axis = gAgent.getFrameAgent().getAtAxis();
- at_axis.mV[VZ] = 0.f;
- at_axis.normalize();
- gAgent.resetAxes(at_axis);
- }
-
-
- if (animate)
- {
- startCameraAnimation();
- }
- else
- {
- mCameraAnimating = FALSE;
- gAgent.endAnimationUpdateUI();
- }
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ return;
+ }
+
+ gViewerWindow->getWindow()->resetBusyCount();
+
+ mCameraZoomFraction = INITIAL_ZOOM_FRACTION;
+
+ if (isAgentAvatarValid())
+ {
+ if (!gAgentAvatarp->isSitting())
+ {
+ // SL-315
+ gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero);
+ }
+ gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE);
+ gAgentAvatarp->startMotion(ANIM_AGENT_BREATHE_ROT);
+ }
+
+ LLVector3 at_axis;
+
+ // unpause avatar animation
+ gAgent.unpauseAnimation();
+
+ if (mCameraMode != CAMERA_MODE_THIRD_PERSON)
+ {
+ if (gBasicToolset)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ }
+
+ mCameraLag.clearVec();
+ if (mCameraMode == CAMERA_MODE_MOUSELOOK)
+ {
+ mCurrentCameraDistance = MIN_CAMERA_DISTANCE;
+ mTargetCameraDistance = MIN_CAMERA_DISTANCE;
+ animate = FALSE;
+ }
+ updateLastCamera();
+ mCameraMode = CAMERA_MODE_THIRD_PERSON;
+ gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
+ }
+
+ // Remove any pitch from the avatar
+ if (!isAgentAvatarValid() || !gAgentAvatarp->getParent())
+ {
+ at_axis = gAgent.getFrameAgent().getAtAxis();
+ at_axis.mV[VZ] = 0.f;
+ at_axis.normalize();
+ gAgent.resetAxes(at_axis);
+ }
+
+
+ if (animate)
+ {
+ startCameraAnimation();
+ }
+ else
+ {
+ mCameraAnimating = FALSE;
+ gAgent.endAnimationUpdateUI();
+ }
}
//-----------------------------------------------------------------------------
@@ -2377,89 +2377,89 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
//-----------------------------------------------------------------------------
void LLAgentCamera::changeCameraToCustomizeAvatar()
{
- if (LLViewerJoystick::getInstance()->getOverrideCamera() || !isAgentAvatarValid())
- {
- return;
- }
+ if (LLViewerJoystick::getInstance()->getOverrideCamera() || !isAgentAvatarValid())
+ {
+ return;
+ }
- gAgent.standUp(); // force stand up
- gViewerWindow->getWindow()->resetBusyCount();
+ gAgent.standUp(); // force stand up
+ gViewerWindow->getWindow()->resetBusyCount();
if (LLSelectMgr::getInstance()->getSelection()->isAttachment())
{
LLSelectMgr::getInstance()->deselectAll();
}
- if (gFaceEditToolset)
- {
- LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset);
- }
-
- startCameraAnimation();
-
- if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR)
- {
- updateLastCamera();
- mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR;
- gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
-
- gFocusMgr.setKeyboardFocus( NULL );
- gFocusMgr.setMouseCapture( NULL );
- if( gMorphView )
- {
- gMorphView->setVisible( TRUE );
- }
- // Remove any pitch or rotation from the avatar
- LLVector3 at = gAgent.getAtAxis();
- at.mV[VZ] = 0.f;
- at.normalize();
- gAgent.resetAxes(at);
-
- gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START);
- gAgent.setCustomAnim(TRUE);
- gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE);
- LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE);
-
- if (turn_motion)
- {
- // delay camera animation long enough to play through turn animation
- setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP);
- }
- }
-
- LLVector3 agent_at = gAgent.getAtAxis();
- agent_at.mV[VZ] = 0.f;
- agent_at.normalize();
-
- // default focus point for customize avatar
- LLVector3 focus_target = isAgentAvatarValid()
- ? gAgentAvatarp->mHeadp->getWorldPosition()
- : gAgent.getPositionAgent();
-
- LLVector3d camera_offset(agent_at * -1.0);
- // push camera up and out from avatar
- camera_offset.mdV[VZ] = 0.1f;
- camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST;
- LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target);
- setAnimationDuration(gSavedSettings.getF32("ZoomTime"));
- setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID());
+ if (gFaceEditToolset)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset);
+ }
+
+ startCameraAnimation();
+
+ if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR)
+ {
+ updateLastCamera();
+ mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR;
+ gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
+
+ gFocusMgr.setKeyboardFocus( NULL );
+ gFocusMgr.setMouseCapture( NULL );
+ if( gMorphView )
+ {
+ gMorphView->setVisible( TRUE );
+ }
+ // Remove any pitch or rotation from the avatar
+ LLVector3 at = gAgent.getAtAxis();
+ at.mV[VZ] = 0.f;
+ at.normalize();
+ gAgent.resetAxes(at);
+
+ gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START);
+ gAgent.setCustomAnim(TRUE);
+ gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE);
+ LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE);
+
+ if (turn_motion)
+ {
+ // delay camera animation long enough to play through turn animation
+ setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP);
+ }
+ }
+
+ LLVector3 agent_at = gAgent.getAtAxis();
+ agent_at.mV[VZ] = 0.f;
+ agent_at.normalize();
+
+ // default focus point for customize avatar
+ LLVector3 focus_target = isAgentAvatarValid()
+ ? gAgentAvatarp->mHeadp->getWorldPosition()
+ : gAgent.getPositionAgent();
+
+ LLVector3d camera_offset(agent_at * -1.0);
+ // push camera up and out from avatar
+ camera_offset.mdV[VZ] = 0.1f;
+ camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST;
+ LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target);
+ setAnimationDuration(gSavedSettings.getF32("ZoomTime"));
+ setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID());
}
void LLAgentCamera::switchCameraPreset(ECameraPreset preset)
{
- //zoom is supposed to be reset for the front and group views
- mCameraZoomFraction = 1.f;
+ //zoom is supposed to be reset for the front and group views
+ mCameraZoomFraction = 1.f;
- //focusing on avatar in that case means following him on movements
- mFocusOnAvatar = TRUE;
+ //focusing on avatar in that case means following him on movements
+ mFocusOnAvatar = TRUE;
- mCameraPreset = preset;
+ mCameraPreset = preset;
- resetPanDiff();
- resetOrbitDiff();
+ resetPanDiff();
+ resetOrbitDiff();
- gSavedSettings.setU32("CameraPresetType", mCameraPreset);
+ gSavedSettings.setU32("CameraPresetType", mCameraPreset);
}
@@ -2468,17 +2468,17 @@ void LLAgentCamera::switchCameraPreset(ECameraPreset preset)
//
void LLAgentCamera::setAnimationDuration(F32 duration)
-{
- if (mCameraAnimating)
- {
- // do not cut any existing camera animation short
- F32 animation_left = llmax(0.f, mAnimationDuration - mAnimationTimer.getElapsedTimeF32());
- mAnimationDuration = llmax(duration, animation_left);
- }
- else
- {
- mAnimationDuration = duration;
- }
+{
+ if (mCameraAnimating)
+ {
+ // do not cut any existing camera animation short
+ F32 animation_left = llmax(0.f, mAnimationDuration - mAnimationTimer.getElapsedTimeF32());
+ mAnimationDuration = llmax(duration, animation_left);
+ }
+ else
+ {
+ mAnimationDuration = duration;
+ }
}
//-----------------------------------------------------------------------------
@@ -2486,11 +2486,11 @@ void LLAgentCamera::setAnimationDuration(F32 duration)
//-----------------------------------------------------------------------------
void LLAgentCamera::startCameraAnimation()
{
- mAnimationCameraStartGlobal = getCameraPositionGlobal();
- mAnimationFocusStartGlobal = mFocusGlobal;
- setAnimationDuration(gSavedSettings.getF32("ZoomTime"));
- mAnimationTimer.reset();
- mCameraAnimating = TRUE;
+ mAnimationCameraStartGlobal = getCameraPositionGlobal();
+ mAnimationFocusStartGlobal = mFocusGlobal;
+ setAnimationDuration(gSavedSettings.getF32("ZoomTime"));
+ mAnimationTimer.reset();
+ mCameraAnimating = TRUE;
}
//-----------------------------------------------------------------------------
@@ -2498,23 +2498,23 @@ void LLAgentCamera::startCameraAnimation()
//-----------------------------------------------------------------------------
void LLAgentCamera::stopCameraAnimation()
{
- mCameraAnimating = FALSE;
+ mCameraAnimating = FALSE;
}
void LLAgentCamera::clearFocusObject()
{
- if (mFocusObject.notNull())
- {
- startCameraAnimation();
+ if (mFocusObject.notNull())
+ {
+ startCameraAnimation();
- setFocusObject(NULL);
- mFocusObjectOffset.clearVec();
- }
+ setFocusObject(NULL);
+ mFocusObjectOffset.clearVec();
+ }
}
void LLAgentCamera::setFocusObject(LLViewerObject* object)
{
- mFocusObject = object;
+ mFocusObject = object;
}
// Focus on a point, but try to keep camera position stable.
@@ -2523,104 +2523,104 @@ void LLAgentCamera::setFocusObject(LLViewerObject* object)
//-----------------------------------------------------------------------------
void LLAgentCamera::setFocusGlobal(const LLPickInfo& pick)
{
- LLViewerObject* objectp = gObjectList.findObject(pick.mObjectID);
+ LLViewerObject* objectp = gObjectList.findObject(pick.mObjectID);
- if (objectp)
- {
- // focus on object plus designated offset
- // which may or may not be same as pick.mPosGlobal
- setFocusGlobal(objectp->getPositionGlobal() + LLVector3d(pick.mObjectOffset), pick.mObjectID);
- }
- else
- {
- // focus directly on point where user clicked
- setFocusGlobal(pick.mPosGlobal, pick.mObjectID);
- }
+ if (objectp)
+ {
+ // focus on object plus designated offset
+ // which may or may not be same as pick.mPosGlobal
+ setFocusGlobal(objectp->getPositionGlobal() + LLVector3d(pick.mObjectOffset), pick.mObjectID);
+ }
+ else
+ {
+ // focus directly on point where user clicked
+ setFocusGlobal(pick.mPosGlobal, pick.mObjectID);
+ }
}
void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object_id)
{
- setFocusObject(gObjectList.findObject(object_id));
- LLVector3d old_focus = mFocusTargetGlobal;
- LLViewerObject *focus_obj = mFocusObject;
-
- // if focus has changed
- if (old_focus != focus)
- {
- if (focus.isExactlyZero())
- {
- if (isAgentAvatarValid())
- {
- mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition());
- }
- else
- {
- mFocusTargetGlobal = gAgent.getPositionGlobal();
- }
- mCameraFocusOffsetTarget = getCameraPositionGlobal() - mFocusTargetGlobal;
- mCameraFocusOffset = mCameraFocusOffsetTarget;
- setLookAt(LOOKAT_TARGET_CLEAR);
- }
- else
- {
- mFocusTargetGlobal = focus;
- if (!focus_obj)
- {
- mCameraFOVZoomFactor = 0.f;
- }
-
- mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(mCameraVirtualPositionAgent) - mFocusTargetGlobal;
-
- startCameraAnimation();
-
- if (focus_obj)
- {
- if (focus_obj->isAvatar())
- {
- setLookAt(LOOKAT_TARGET_FOCUS, focus_obj);
- }
- else
- {
- setLookAt(LOOKAT_TARGET_FOCUS, focus_obj, (gAgent.getPosAgentFromGlobal(focus) - focus_obj->getRenderPosition()) * ~focus_obj->getRenderRotation());
- }
- }
- else
- {
- setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal));
- }
- }
- }
- else // focus == mFocusTargetGlobal
- {
- if (focus.isExactlyZero())
- {
- if (isAgentAvatarValid())
- {
- mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition());
- }
- else
- {
- mFocusTargetGlobal = gAgent.getPositionGlobal();
- }
- }
- mCameraFocusOffsetTarget = (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor);;
- mCameraFocusOffset = mCameraFocusOffsetTarget;
- }
-
- if (mFocusObject.notNull())
- {
- // for attachments, make offset relative to avatar, not the attachment
- if (mFocusObject->isAttachment())
- {
- while (mFocusObject.notNull() && !mFocusObject->isAvatar())
- {
- mFocusObject = (LLViewerObject*) mFocusObject->getParent();
- }
- setFocusObject((LLViewerObject*)mFocusObject);
- }
- updateFocusOffset();
- }
+ setFocusObject(gObjectList.findObject(object_id));
+ LLVector3d old_focus = mFocusTargetGlobal;
+ LLViewerObject *focus_obj = mFocusObject;
+
+ // if focus has changed
+ if (old_focus != focus)
+ {
+ if (focus.isExactlyZero())
+ {
+ if (isAgentAvatarValid())
+ {
+ mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition());
+ }
+ else
+ {
+ mFocusTargetGlobal = gAgent.getPositionGlobal();
+ }
+ mCameraFocusOffsetTarget = getCameraPositionGlobal() - mFocusTargetGlobal;
+ mCameraFocusOffset = mCameraFocusOffsetTarget;
+ setLookAt(LOOKAT_TARGET_CLEAR);
+ }
+ else
+ {
+ mFocusTargetGlobal = focus;
+ if (!focus_obj)
+ {
+ mCameraFOVZoomFactor = 0.f;
+ }
+
+ mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(mCameraVirtualPositionAgent) - mFocusTargetGlobal;
+
+ startCameraAnimation();
+
+ if (focus_obj)
+ {
+ if (focus_obj->isAvatar())
+ {
+ setLookAt(LOOKAT_TARGET_FOCUS, focus_obj);
+ }
+ else
+ {
+ setLookAt(LOOKAT_TARGET_FOCUS, focus_obj, (gAgent.getPosAgentFromGlobal(focus) - focus_obj->getRenderPosition()) * ~focus_obj->getRenderRotation());
+ }
+ }
+ else
+ {
+ setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal));
+ }
+ }
+ }
+ else // focus == mFocusTargetGlobal
+ {
+ if (focus.isExactlyZero())
+ {
+ if (isAgentAvatarValid())
+ {
+ mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition());
+ }
+ else
+ {
+ mFocusTargetGlobal = gAgent.getPositionGlobal();
+ }
+ }
+ mCameraFocusOffsetTarget = (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor);;
+ mCameraFocusOffset = mCameraFocusOffsetTarget;
+ }
+
+ if (mFocusObject.notNull())
+ {
+ // for attachments, make offset relative to avatar, not the attachment
+ if (mFocusObject->isAttachment())
+ {
+ while (mFocusObject.notNull() && !mFocusObject->isAvatar())
+ {
+ mFocusObject = (LLViewerObject*) mFocusObject->getParent();
+ }
+ setFocusObject((LLViewerObject*)mFocusObject);
+ }
+ updateFocusOffset();
+ }
}
// Used for avatar customization
@@ -2629,48 +2629,48 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object
//-----------------------------------------------------------------------------
void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, const LLVector3d& focus, const LLUUID &object_id)
{
- LLVector3d old_focus = mFocusTargetGlobal.isExactlyZero() ? focus : mFocusTargetGlobal;
-
- F64 focus_delta_squared = (old_focus - focus).magVecSquared();
- const F64 ANIM_EPSILON_SQUARED = 0.0001;
- if (focus_delta_squared > ANIM_EPSILON_SQUARED)
- {
- startCameraAnimation();
- }
-
- //LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) );
- setFocusObject(gObjectList.findObject(object_id));
- mFocusTargetGlobal = focus;
- mCameraFocusOffsetTarget = camera_pos - focus;
- mCameraFocusOffset = mCameraFocusOffsetTarget;
-
- if (mFocusObject)
- {
- if (mFocusObject->isAvatar())
- {
- setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject);
- }
- else
- {
- setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject, (gAgent.getPosAgentFromGlobal(focus) - mFocusObject->getRenderPosition()) * ~mFocusObject->getRenderRotation());
- }
- }
- else
- {
- setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal));
- }
-
- if (mCameraAnimating)
- {
- const F64 ANIM_METERS_PER_SECOND = 10.0;
- const F64 MIN_ANIM_SECONDS = 0.5;
- const F64 MAX_ANIM_SECONDS = 10.0;
- F64 anim_duration = llmax( MIN_ANIM_SECONDS, sqrt(focus_delta_squared) / ANIM_METERS_PER_SECOND );
- anim_duration = llmin( anim_duration, MAX_ANIM_SECONDS );
- setAnimationDuration( (F32)anim_duration );
- }
-
- updateFocusOffset();
+ LLVector3d old_focus = mFocusTargetGlobal.isExactlyZero() ? focus : mFocusTargetGlobal;
+
+ F64 focus_delta_squared = (old_focus - focus).magVecSquared();
+ const F64 ANIM_EPSILON_SQUARED = 0.0001;
+ if (focus_delta_squared > ANIM_EPSILON_SQUARED)
+ {
+ startCameraAnimation();
+ }
+
+ //LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) );
+ setFocusObject(gObjectList.findObject(object_id));
+ mFocusTargetGlobal = focus;
+ mCameraFocusOffsetTarget = camera_pos - focus;
+ mCameraFocusOffset = mCameraFocusOffsetTarget;
+
+ if (mFocusObject)
+ {
+ if (mFocusObject->isAvatar())
+ {
+ setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject);
+ }
+ else
+ {
+ setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject, (gAgent.getPosAgentFromGlobal(focus) - mFocusObject->getRenderPosition()) * ~mFocusObject->getRenderRotation());
+ }
+ }
+ else
+ {
+ setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal));
+ }
+
+ if (mCameraAnimating)
+ {
+ const F64 ANIM_METERS_PER_SECOND = 10.0;
+ const F64 MIN_ANIM_SECONDS = 0.5;
+ const F64 MAX_ANIM_SECONDS = 10.0;
+ F64 anim_duration = llmax( MIN_ANIM_SECONDS, sqrt(focus_delta_squared) / ANIM_METERS_PER_SECOND );
+ anim_duration = llmin( anim_duration, MAX_ANIM_SECONDS );
+ setAnimationDuration( (F32)anim_duration );
+ }
+
+ updateFocusOffset();
}
//-----------------------------------------------------------------------------
@@ -2678,27 +2678,27 @@ void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, con
//-----------------------------------------------------------------------------
void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos, const LLVector3 &camera_focus)
{
- BOOL camera_enabled = !object_id.isNull();
-
- if (camera_enabled)
- {
- LLViewerObject *reference_object = gObjectList.findObject(object_id);
- if (reference_object)
- {
- //convert to root object relative?
- mSitCameraPos = camera_pos;
- mSitCameraFocus = camera_focus;
- mSitCameraReferenceObject = reference_object;
- mSitCameraEnabled = TRUE;
- }
- }
- else
- {
- mSitCameraPos.clearVec();
- mSitCameraFocus.clearVec();
- mSitCameraReferenceObject = NULL;
- mSitCameraEnabled = FALSE;
- }
+ BOOL camera_enabled = !object_id.isNull();
+
+ if (camera_enabled)
+ {
+ LLViewerObject *reference_object = gObjectList.findObject(object_id);
+ if (reference_object)
+ {
+ //convert to root object relative?
+ mSitCameraPos = camera_pos;
+ mSitCameraFocus = camera_focus;
+ mSitCameraReferenceObject = reference_object;
+ mSitCameraEnabled = TRUE;
+ }
+ }
+ else
+ {
+ mSitCameraPos.clearVec();
+ mSitCameraFocus.clearVec();
+ mSitCameraReferenceObject = NULL;
+ mSitCameraEnabled = FALSE;
+ }
}
//-----------------------------------------------------------------------------
@@ -2706,30 +2706,30 @@ void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camer
//-----------------------------------------------------------------------------
void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate, BOOL reset_axes)
{
- if (focus_on_avatar != mFocusOnAvatar)
- {
- if (animate)
- {
- startCameraAnimation();
- }
- else
- {
- stopCameraAnimation();
- }
- }
-
- //RN: when focused on the avatar, we're not "looking" at it
- // looking implies intent while focusing on avatar means
- // you're just walking around with a camera on you...eesh.
- if (!mFocusOnAvatar && focus_on_avatar && reset_axes)
- {
- setFocusGlobal(LLVector3d::zero);
- mCameraFOVZoomFactor = 0.f;
- if (mCameraMode == CAMERA_MODE_THIRD_PERSON)
- {
- LLVector3 at_axis;
- if (!isAgentAvatarValid() || !gAgentAvatarp->getParent())
- {
+ if (focus_on_avatar != mFocusOnAvatar)
+ {
+ if (animate)
+ {
+ startCameraAnimation();
+ }
+ else
+ {
+ stopCameraAnimation();
+ }
+ }
+
+ //RN: when focused on the avatar, we're not "looking" at it
+ // looking implies intent while focusing on avatar means
+ // you're just walking around with a camera on you...eesh.
+ if (!mFocusOnAvatar && focus_on_avatar && reset_axes)
+ {
+ setFocusGlobal(LLVector3d::zero);
+ mCameraFOVZoomFactor = 0.f;
+ if (mCameraMode == CAMERA_MODE_THIRD_PERSON)
+ {
+ LLVector3 at_axis;
+ if (!isAgentAvatarValid() || !gAgentAvatarp->getParent())
+ {
// In case of front view rotate agent to look into direction opposite to camera
// In case of rear view rotate agent into diraction same as camera, e t c
LLVector3 vect = getCameraOffsetInitial();
@@ -2743,44 +2743,44 @@ void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate, BOOL re
at_axis.normalize();
gAgent.resetAxes(at_axis);
gAgent.yaw(0);
- }
- }
- }
- // unlocking camera from avatar
- else if (mFocusOnAvatar && !focus_on_avatar)
- {
- // keep camera focus point consistent, even though it is now unlocked
- setFocusGlobal(gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(), gAgent.getID());
- mAllowChangeToFollow = FALSE;
- }
-
- mFocusOnAvatar = focus_on_avatar;
+ }
+ }
+ }
+ // unlocking camera from avatar
+ else if (mFocusOnAvatar && !focus_on_avatar)
+ {
+ // keep camera focus point consistent, even though it is now unlocked
+ setFocusGlobal(gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(), gAgent.getID());
+ mAllowChangeToFollow = FALSE;
+ }
+
+ mFocusOnAvatar = focus_on_avatar;
}
BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position)
{
- if(object && object->isAttachment())
- {
- LLViewerObject* parent = object;
- while(parent)
- {
- if (parent == gAgentAvatarp)
- {
- // looking at an attachment on ourselves, which we don't want to do
- object = gAgentAvatarp;
- position.clearVec();
- }
- parent = (LLViewerObject*)parent->getParent();
- }
- }
- if(!mLookAt || mLookAt->isDead())
- {
- mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT);
- mLookAt->setSourceObject(gAgentAvatarp);
- }
-
- return mLookAt->setLookAt(target_type, object, position);
+ if(object && object->isAttachment())
+ {
+ LLViewerObject* parent = object;
+ while(parent)
+ {
+ if (parent == gAgentAvatarp)
+ {
+ // looking at an attachment on ourselves, which we don't want to do
+ object = gAgentAvatarp;
+ position.clearVec();
+ }
+ parent = (LLViewerObject*)parent->getParent();
+ }
+ }
+ if(!mLookAt || mLookAt->isDead())
+ {
+ mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT);
+ mLookAt->setSourceObject(gAgentAvatarp);
+ }
+
+ return mLookAt->setLookAt(target_type, object, position);
}
//-----------------------------------------------------------------------------
@@ -2788,168 +2788,168 @@ BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, L
//-----------------------------------------------------------------------------
void LLAgentCamera::lookAtLastChat()
{
- // Block if camera is animating or not in normal third person camera mode
- if (mCameraAnimating || !cameraThirdPerson())
- {
- return;
- }
-
- LLViewerObject *chatter = gObjectList.findObject(gAgent.getLastChatter());
- if (!chatter)
- {
- return;
- }
-
- LLVector3 delta_pos;
- if (chatter->isAvatar())
- {
- LLVOAvatar *chatter_av = (LLVOAvatar*)chatter;
- if (isAgentAvatarValid() && chatter_av->mHeadp)
- {
- delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition();
- }
- else
- {
- delta_pos = chatter->getPositionAgent() - gAgent.getPositionAgent();
- }
- delta_pos.normalize();
-
- gAgent.setControlFlags(AGENT_CONTROL_STOP);
-
- changeCameraToThirdPerson();
-
- LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition();
- LLVector3 left = delta_pos % LLVector3::z_axis;
- left.normalize();
- LLVector3 up = left % delta_pos;
- up.normalize();
- new_camera_pos -= delta_pos * 0.4f;
- new_camera_pos += left * 0.3f;
- new_camera_pos += up * 0.2f;
-
- setFocusOnAvatar(FALSE, FALSE);
-
- if (chatter_av->mHeadp)
- {
- setFocusGlobal(gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()), gAgent.getLastChatter());
- mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition());
- }
- else
- {
- setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter());
- mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal();
- }
- }
- else
- {
- delta_pos = chatter->getRenderPosition() - gAgent.getPositionAgent();
- delta_pos.normalize();
-
- gAgent.setControlFlags(AGENT_CONTROL_STOP);
-
- changeCameraToThirdPerson();
-
- LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition();
- LLVector3 left = delta_pos % LLVector3::z_axis;
- left.normalize();
- LLVector3 up = left % delta_pos;
- up.normalize();
- new_camera_pos -= delta_pos * 0.4f;
- new_camera_pos += left * 0.3f;
- new_camera_pos += up * 0.2f;
-
- setFocusOnAvatar(FALSE, FALSE);
-
- setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter());
- mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal();
- }
+ // Block if camera is animating or not in normal third person camera mode
+ if (mCameraAnimating || !cameraThirdPerson())
+ {
+ return;
+ }
+
+ LLViewerObject *chatter = gObjectList.findObject(gAgent.getLastChatter());
+ if (!chatter)
+ {
+ return;
+ }
+
+ LLVector3 delta_pos;
+ if (chatter->isAvatar())
+ {
+ LLVOAvatar *chatter_av = (LLVOAvatar*)chatter;
+ if (isAgentAvatarValid() && chatter_av->mHeadp)
+ {
+ delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition();
+ }
+ else
+ {
+ delta_pos = chatter->getPositionAgent() - gAgent.getPositionAgent();
+ }
+ delta_pos.normalize();
+
+ gAgent.setControlFlags(AGENT_CONTROL_STOP);
+
+ changeCameraToThirdPerson();
+
+ LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition();
+ LLVector3 left = delta_pos % LLVector3::z_axis;
+ left.normalize();
+ LLVector3 up = left % delta_pos;
+ up.normalize();
+ new_camera_pos -= delta_pos * 0.4f;
+ new_camera_pos += left * 0.3f;
+ new_camera_pos += up * 0.2f;
+
+ setFocusOnAvatar(FALSE, FALSE);
+
+ if (chatter_av->mHeadp)
+ {
+ setFocusGlobal(gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()), gAgent.getLastChatter());
+ mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition());
+ }
+ else
+ {
+ setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter());
+ mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal();
+ }
+ }
+ else
+ {
+ delta_pos = chatter->getRenderPosition() - gAgent.getPositionAgent();
+ delta_pos.normalize();
+
+ gAgent.setControlFlags(AGENT_CONTROL_STOP);
+
+ changeCameraToThirdPerson();
+
+ LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition();
+ LLVector3 left = delta_pos % LLVector3::z_axis;
+ left.normalize();
+ LLVector3 up = left % delta_pos;
+ up.normalize();
+ new_camera_pos -= delta_pos * 0.4f;
+ new_camera_pos += left * 0.3f;
+ new_camera_pos += up * 0.2f;
+
+ setFocusOnAvatar(FALSE, FALSE);
+
+ setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter());
+ mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal();
+ }
}
bool LLAgentCamera::isfollowCamLocked()
{
- return mFollowCam.getPositionLocked();
+ return mFollowCam.getPositionLocked();
}
BOOL LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position)
{
- // disallow pointing at attachments and avatars
- if (object && (object->isAttachment() || object->isAvatar()))
- {
- return FALSE;
- }
- if (!mPointAt || mPointAt->isDead())
- {
- mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT);
- mPointAt->setSourceObject(gAgentAvatarp);
- }
- return mPointAt->setPointAt(target_type, object, position);
+ // disallow pointing at attachments and avatars
+ if (object && (object->isAttachment() || object->isAvatar()))
+ {
+ return FALSE;
+ }
+ if (!mPointAt || mPointAt->isDead())
+ {
+ mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT);
+ mPointAt->setSourceObject(gAgentAvatarp);
+ }
+ return mPointAt->setPointAt(target_type, object, position);
}
void LLAgentCamera::rotateToInitSitRot()
{
- gAgent.rotate(~gAgent.getFrameAgent().getQuaternion());
- gAgent.rotate(mInitSitRot);
+ gAgent.rotate(~gAgent.getFrameAgent().getQuaternion());
+ gAgent.rotate(mInitSitRot);
}
void LLAgentCamera::resetCameraZoomFraction()
-{
- mCameraZoomFraction = INITIAL_ZOOM_FRACTION;
+{
+ mCameraZoomFraction = INITIAL_ZOOM_FRACTION;
}
ELookAtType LLAgentCamera::getLookAtType()
{
- if (mLookAt)
- {
- return mLookAt->getLookAtType();
- }
- return LOOKAT_TARGET_NONE;
+ if (mLookAt)
+ {
+ return mLookAt->getLookAtType();
+ }
+ return LOOKAT_TARGET_NONE;
}
EPointAtType LLAgentCamera::getPointAtType()
-{
- if (mPointAt)
- {
- return mPointAt->getPointAtType();
- }
- return POINTAT_TARGET_NONE;
+{
+ if (mPointAt)
+ {
+ return mPointAt->getPointAtType();
+ }
+ return POINTAT_TARGET_NONE;
}
void LLAgentCamera::clearGeneralKeys()
{
- mAtKey = 0;
- mWalkKey = 0;
- mLeftKey = 0;
- mUpKey = 0;
- mYawKey = 0.f;
- mPitchKey = 0.f;
+ mAtKey = 0;
+ mWalkKey = 0;
+ mLeftKey = 0;
+ mUpKey = 0;
+ mYawKey = 0.f;
+ mPitchKey = 0.f;
}
void LLAgentCamera::clearOrbitKeys()
{
- mOrbitLeftKey = 0.f;
- mOrbitRightKey = 0.f;
- mOrbitUpKey = 0.f;
- mOrbitDownKey = 0.f;
- mOrbitInKey = 0.f;
- mOrbitOutKey = 0.f;
+ mOrbitLeftKey = 0.f;
+ mOrbitRightKey = 0.f;
+ mOrbitUpKey = 0.f;
+ mOrbitDownKey = 0.f;
+ mOrbitInKey = 0.f;
+ mOrbitOutKey = 0.f;
}
void LLAgentCamera::clearPanKeys()
{
- mPanRightKey = 0.f;
- mPanLeftKey = 0.f;
- mPanUpKey = 0.f;
- mPanDownKey = 0.f;
- mPanInKey = 0.f;
- mPanOutKey = 0.f;
+ mPanRightKey = 0.f;
+ mPanLeftKey = 0.f;
+ mPanUpKey = 0.f;
+ mPanDownKey = 0.f;
+ mPanInKey = 0.f;
+ mPanOutKey = 0.f;
}
// static
S32 LLAgentCamera::directionToKey(S32 direction)
{
- if (direction > 0) return 1;
- if (direction < 0) return -1;
- return 0;
+ if (direction > 0) return 1;
+ if (direction < 0) return -1;
+ return 0;
}
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index d27cdb0c5c..4a9e5efadf 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagent.h
* @brief LLAgent class header file
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,9 +27,9 @@
#ifndef LL_LLAGENTCAMERA_H
#define LL_LLAGENTCAMERA_H
-#include "llfollowcam.h" // Ventrella
-#include "llhudeffectlookat.h" // EPointAtType
-#include "llhudeffectpointat.h" // ELookAtType
+#include "llfollowcam.h" // Ventrella
+#include "llhudeffectlookat.h" // EPointAtType
+#include "llhudeffectpointat.h" // ELookAtType
class LLPickInfo;
class LLVOAvatarSelf;
@@ -40,26 +40,26 @@ class LLControlVariable;
//--------------------------------------------------------------------
enum ECameraMode
{
- CAMERA_MODE_THIRD_PERSON,
- CAMERA_MODE_MOUSELOOK,
- CAMERA_MODE_CUSTOMIZE_AVATAR,
- CAMERA_MODE_FOLLOW
+ CAMERA_MODE_THIRD_PERSON,
+ CAMERA_MODE_MOUSELOOK,
+ CAMERA_MODE_CUSTOMIZE_AVATAR,
+ CAMERA_MODE_FOLLOW
};
/** Camera Presets for CAMERA_MODE_THIRD_PERSON */
-enum ECameraPreset
+enum ECameraPreset
{
- /** Default preset, what the Third Person Mode actually was */
- CAMERA_PRESET_REAR_VIEW,
-
- /** "Looking at the Avatar from the front" */
- CAMERA_PRESET_FRONT_VIEW,
+ /** Default preset, what the Third Person Mode actually was */
+ CAMERA_PRESET_REAR_VIEW,
+
+ /** "Looking at the Avatar from the front" */
+ CAMERA_PRESET_FRONT_VIEW,
- /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */
- CAMERA_PRESET_GROUP_VIEW,
+ /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */
+ CAMERA_PRESET_GROUP_VIEW,
- /** Current view when a preset is saved */
- CAMERA_PRESET_CUSTOM
+ /** Current view when a preset is saved */
+ CAMERA_PRESET_CUSTOM
};
//------------------------------------------------------------------------
@@ -67,254 +67,254 @@ enum ECameraPreset
//------------------------------------------------------------------------
class LLAgentCamera
{
- LOG_CLASS(LLAgentCamera);
+ LOG_CLASS(LLAgentCamera);
public:
- //--------------------------------------------------------------------
- // Constructors / Destructors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Constructors / Destructors
+ //--------------------------------------------------------------------
public:
- LLAgentCamera();
- virtual ~LLAgentCamera();
- void init();
- void cleanup();
- void setAvatarObject(LLVOAvatarSelf* avatar);
- bool isInitialized() { return mInitialized; }
+ LLAgentCamera();
+ virtual ~LLAgentCamera();
+ void init();
+ void cleanup();
+ void setAvatarObject(LLVOAvatarSelf* avatar);
+ bool isInitialized() { return mInitialized; }
private:
- bool mInitialized;
+ bool mInitialized;
- //--------------------------------------------------------------------
- // Mode
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Mode
+ //--------------------------------------------------------------------
public:
- void changeCameraToDefault();
- void changeCameraToMouselook(BOOL animate = TRUE);
- void changeCameraToThirdPerson(BOOL animate = TRUE);
- void changeCameraToCustomizeAvatar(); // Trigger transition animation
- void changeCameraToFollow(BOOL animate = TRUE); // Ventrella
- BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); }
- BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); }
- BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); }
- BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); }
- ECameraMode getCameraMode() const { return mCameraMode; }
- ECameraMode getLastCameraMode() const { return mLastCameraMode; }
- void updateCamera(); // Call once per frame to update camera location/orientation
- void resetCamera(); // Slam camera into its default position
- void updateLastCamera(); // Set last camera to current camera
+ void changeCameraToDefault();
+ void changeCameraToMouselook(BOOL animate = TRUE);
+ void changeCameraToThirdPerson(BOOL animate = TRUE);
+ void changeCameraToCustomizeAvatar(); // Trigger transition animation
+ void changeCameraToFollow(BOOL animate = TRUE); // Ventrella
+ BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); }
+ BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); }
+ BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); }
+ BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); }
+ ECameraMode getCameraMode() const { return mCameraMode; }
+ ECameraMode getLastCameraMode() const { return mLastCameraMode; }
+ void updateCamera(); // Call once per frame to update camera location/orientation
+ void resetCamera(); // Slam camera into its default position
+ void updateLastCamera(); // Set last camera to current camera
private:
- ECameraMode mCameraMode; // Target mode after transition animation is done
- ECameraMode mLastCameraMode;
+ ECameraMode mCameraMode; // Target mode after transition animation is done
+ ECameraMode mLastCameraMode;
- //--------------------------------------------------------------------
- // Preset
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Preset
+ //--------------------------------------------------------------------
public:
- void switchCameraPreset(ECameraPreset preset);
- /** Determines default camera offset depending on the current camera preset */
- LLVector3 getCameraOffsetInitial();
- /** Determines default focus offset depending on the current camera preset */
- LLVector3d getFocusOffsetInitial();
-
- LLVector3 getCurrentCameraOffset();
- LLVector3d getCurrentFocusOffset();
- LLQuaternion getCurrentAvatarRotation();
- bool isJoystickCameraUsed();
- void setInitSitRot(LLQuaternion sit_rot) { mInitSitRot = sit_rot; };
- void rotateToInitSitRot();
+ void switchCameraPreset(ECameraPreset preset);
+ /** Determines default camera offset depending on the current camera preset */
+ LLVector3 getCameraOffsetInitial();
+ /** Determines default focus offset depending on the current camera preset */
+ LLVector3d getFocusOffsetInitial();
+
+ LLVector3 getCurrentCameraOffset();
+ LLVector3d getCurrentFocusOffset();
+ LLQuaternion getCurrentAvatarRotation();
+ bool isJoystickCameraUsed();
+ void setInitSitRot(LLQuaternion sit_rot) { mInitSitRot = sit_rot; };
+ void rotateToInitSitRot();
private:
- /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */
- F32 getCameraMaxZoomDistance();
+ /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */
+ F32 getCameraMaxZoomDistance();
- /** Camera preset in Third Person Mode */
- ECameraPreset mCameraPreset;
+ /** Camera preset in Third Person Mode */
+ ECameraPreset mCameraPreset;
- LLQuaternion mInitSitRot;
+ LLQuaternion mInitSitRot;
- //--------------------------------------------------------------------
- // Position
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Position
+ //--------------------------------------------------------------------
public:
- LLVector3d getCameraPositionGlobal() const;
- const LLVector3 &getCameraPositionAgent() const;
- LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target
- F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters
- void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; }
- BOOL calcCameraMinDistance(F32 &obj_min_distance);
- F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); }
- void clearCameraLag() { mCameraLag.clearVec(); }
+ LLVector3d getCameraPositionGlobal() const;
+ const LLVector3 &getCameraPositionAgent() const;
+ LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target
+ F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters
+ void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; }
+ BOOL calcCameraMinDistance(F32 &obj_min_distance);
+ F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); }
+ void clearCameraLag() { mCameraLag.clearVec(); }
private:
- LLVector3 getAvatarRootPosition();
-
- F32 mCurrentCameraDistance; // Current camera offset from avatar
- F32 mTargetCameraDistance; // Target camera offset from avatar
- F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object
- F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom
- LLVector4 mCameraCollidePlane; // Colliding plane for camera
- F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom
- LLVector3 mCameraPositionAgent; // Camera position in agent coordinates
- LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom
- LLVector3d mCameraSmoothingLastPositionGlobal;
- LLVector3d mCameraSmoothingLastPositionAgent;
- bool mCameraSmoothingStop;
- LLVector3 mCameraLag; // Third person camera lag
- LLVector3 mCameraUpVector; // Camera's up direction in world coordinates (determines the 'roll' of the view)
-
- //--------------------------------------------------------------------
- // Follow
- //--------------------------------------------------------------------
+ LLVector3 getAvatarRootPosition();
+
+ F32 mCurrentCameraDistance; // Current camera offset from avatar
+ F32 mTargetCameraDistance; // Target camera offset from avatar
+ F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object
+ F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom
+ LLVector4 mCameraCollidePlane; // Colliding plane for camera
+ F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom
+ LLVector3 mCameraPositionAgent; // Camera position in agent coordinates
+ LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom
+ LLVector3d mCameraSmoothingLastPositionGlobal;
+ LLVector3d mCameraSmoothingLastPositionAgent;
+ bool mCameraSmoothingStop;
+ LLVector3 mCameraLag; // Third person camera lag
+ LLVector3 mCameraUpVector; // Camera's up direction in world coordinates (determines the 'roll' of the view)
+
+ //--------------------------------------------------------------------
+ // Follow
+ //--------------------------------------------------------------------
public:
- bool isfollowCamLocked();
+ bool isfollowCamLocked();
private:
- LLFollowCam mFollowCam; // Ventrella
+ LLFollowCam mFollowCam; // Ventrella
- //--------------------------------------------------------------------
- // Sit
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Sit
+ //--------------------------------------------------------------------
public:
- void setupSitCamera();
- BOOL sitCameraEnabled() { return mSitCameraEnabled; }
- void setSitCamera(const LLUUID &object_id,
- const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero);
+ void setupSitCamera();
+ BOOL sitCameraEnabled() { return mSitCameraEnabled; }
+ void setSitCamera(const LLUUID &object_id,
+ const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero);
private:
- LLPointer<LLViewerObject> mSitCameraReferenceObject; // Object to which camera is related when sitting
- BOOL mSitCameraEnabled; // Use provided camera information when sitting?
- LLVector3 mSitCameraPos; // Root relative camera pos when sitting
- LLVector3 mSitCameraFocus; // Root relative camera target when sitting
-
- //--------------------------------------------------------------------
- // Animation
- //--------------------------------------------------------------------
+ LLPointer<LLViewerObject> mSitCameraReferenceObject; // Object to which camera is related when sitting
+ BOOL mSitCameraEnabled; // Use provided camera information when sitting?
+ LLVector3 mSitCameraPos; // Root relative camera pos when sitting
+ LLVector3 mSitCameraFocus; // Root relative camera target when sitting
+
+ //--------------------------------------------------------------------
+ // Animation
+ //--------------------------------------------------------------------
public:
- void setCameraAnimating(BOOL b) { mCameraAnimating = b; }
- BOOL getCameraAnimating() { return mCameraAnimating; }
- void setAnimationDuration(F32 seconds);
- void startCameraAnimation();
- void stopCameraAnimation();
+ void setCameraAnimating(BOOL b) { mCameraAnimating = b; }
+ BOOL getCameraAnimating() { return mCameraAnimating; }
+ void setAnimationDuration(F32 seconds);
+ void startCameraAnimation();
+ void stopCameraAnimation();
private:
- LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active
- F32 mAnimationDuration; // In seconds
- BOOL mCameraAnimating; // Camera is transitioning from one mode to another
- LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords
- LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords
-
- //--------------------------------------------------------------------
- // Focus
- //--------------------------------------------------------------------
+ LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active
+ F32 mAnimationDuration; // In seconds
+ BOOL mCameraAnimating; // Camera is transitioning from one mode to another
+ LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords
+ LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords
+
+ //--------------------------------------------------------------------
+ // Focus
+ //--------------------------------------------------------------------
public:
- LLVector3d calcFocusPositionTargetGlobal();
- LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y);
- BOOL getFocusOnAvatar() const { return mFocusOnAvatar; }
- LLPointer<LLViewerObject>& getFocusObject() { return mFocusObject; }
- F32 getFocusObjectDist() const { return mFocusObjectDist; }
- void updateFocusOffset();
- void validateFocusObject();
- void setFocusGlobal(const LLPickInfo& pick);
- void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null);
- void setFocusOnAvatar(BOOL focus, BOOL animate, BOOL reset_axes = TRUE);
- void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id);
- void clearFocusObject();
- void setFocusObject(LLViewerObject* object);
- void setAllowChangeToFollow(BOOL focus) { mAllowChangeToFollow = focus; }
- void setObjectTracking(BOOL track) { mTrackFocusObject = track; }
- const LLVector3d &getFocusGlobal() const { return mFocusGlobal; }
- const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; }
+ LLVector3d calcFocusPositionTargetGlobal();
+ LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y);
+ BOOL getFocusOnAvatar() const { return mFocusOnAvatar; }
+ LLPointer<LLViewerObject>& getFocusObject() { return mFocusObject; }
+ F32 getFocusObjectDist() const { return mFocusObjectDist; }
+ void updateFocusOffset();
+ void validateFocusObject();
+ void setFocusGlobal(const LLPickInfo& pick);
+ void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null);
+ void setFocusOnAvatar(BOOL focus, BOOL animate, BOOL reset_axes = TRUE);
+ void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id);
+ void clearFocusObject();
+ void setFocusObject(LLViewerObject* object);
+ void setAllowChangeToFollow(BOOL focus) { mAllowChangeToFollow = focus; }
+ void setObjectTracking(BOOL track) { mTrackFocusObject = track; }
+ const LLVector3d &getFocusGlobal() const { return mFocusGlobal; }
+ const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; }
private:
- LLVector3d mCameraFocusOffset; // Offset from focus point in build mode
- LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset
- BOOL mFocusOnAvatar;
- BOOL mAllowChangeToFollow;
- LLVector3d mFocusGlobal;
- LLVector3d mFocusTargetGlobal;
- LLPointer<LLViewerObject> mFocusObject;
- F32 mFocusObjectDist;
- LLVector3 mFocusObjectOffset;
- BOOL mTrackFocusObject;
-
- //--------------------------------------------------------------------
- // Lookat / Pointat
- //--------------------------------------------------------------------
+ LLVector3d mCameraFocusOffset; // Offset from focus point in build mode
+ LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset
+ BOOL mFocusOnAvatar;
+ BOOL mAllowChangeToFollow;
+ LLVector3d mFocusGlobal;
+ LLVector3d mFocusTargetGlobal;
+ LLPointer<LLViewerObject> mFocusObject;
+ F32 mFocusObjectDist;
+ LLVector3 mFocusObjectOffset;
+ BOOL mTrackFocusObject;
+
+ //--------------------------------------------------------------------
+ // Lookat / Pointat
+ //--------------------------------------------------------------------
public:
- void updateLookAt(const S32 mouse_x, const S32 mouse_y);
- BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero);
- ELookAtType getLookAtType();
- void lookAtLastChat();
- void slamLookAt(const LLVector3 &look_at); // Set the physics data
- BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero);
- EPointAtType getPointAtType();
+ void updateLookAt(const S32 mouse_x, const S32 mouse_y);
+ BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero);
+ ELookAtType getLookAtType();
+ void lookAtLastChat();
+ void slamLookAt(const LLVector3 &look_at); // Set the physics data
+ BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero);
+ EPointAtType getPointAtType();
public:
- LLPointer<LLHUDEffectLookAt> mLookAt;
- LLPointer<LLHUDEffectPointAt> mPointAt;
+ LLPointer<LLHUDEffectLookAt> mLookAt;
+ LLPointer<LLHUDEffectPointAt> mPointAt;
- //--------------------------------------------------------------------
- // Third person
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Third person
+ //--------------------------------------------------------------------
public:
- LLVector3d calcThirdPersonFocusOffset();
- void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; }
+ LLVector3d calcThirdPersonFocusOffset();
+ void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; }
private:
- LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position
+ LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position
- //--------------------------------------------------------------------
- // Orbit
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Orbit
+ //--------------------------------------------------------------------
public:
- void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point
- void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point
- void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point
- void resetCameraOrbit();
- void resetOrbitDiff();
- //--------------------------------------------------------------------
- // Zoom
- //--------------------------------------------------------------------
+ void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point
+ void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point
+ void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point
+ void resetCameraOrbit();
+ void resetOrbitDiff();
+ //--------------------------------------------------------------------
+ // Zoom
+ //--------------------------------------------------------------------
public:
- void handleScrollWheel(S32 clicks); // Mousewheel driven zoom
- void cameraZoomIn(const F32 factor); // Zoom in by fraction of current distance
- F32 getCameraZoomFraction(bool get_third_person = false); // Get camera zoom as fraction of minimum and maximum zoom
- void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom
- F32 calcCameraFOVZoomFactor();
- F32 getAgentHUDTargetZoom();
-
- void resetCameraZoomFraction();
- F32 getCurrentCameraZoomFraction() { return mCameraZoomFraction; }
-
- //--------------------------------------------------------------------
- // Pan
- //--------------------------------------------------------------------
+ void handleScrollWheel(S32 clicks); // Mousewheel driven zoom
+ void cameraZoomIn(const F32 factor); // Zoom in by fraction of current distance
+ F32 getCameraZoomFraction(bool get_third_person = false); // Get camera zoom as fraction of minimum and maximum zoom
+ void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom
+ F32 calcCameraFOVZoomFactor();
+ F32 getAgentHUDTargetZoom();
+
+ void resetCameraZoomFraction();
+ F32 getCurrentCameraZoomFraction() { return mCameraZoomFraction; }
+
+ //--------------------------------------------------------------------
+ // Pan
+ //--------------------------------------------------------------------
public:
- void cameraPanIn(const F32 meters);
- void cameraPanLeft(const F32 meters);
- void cameraPanUp(const F32 meters);
- void resetCameraPan();
- void resetPanDiff();
- //--------------------------------------------------------------------
- // View
- //--------------------------------------------------------------------
+ void cameraPanIn(const F32 meters);
+ void cameraPanLeft(const F32 meters);
+ void cameraPanUp(const F32 meters);
+ void resetCameraPan();
+ void resetPanDiff();
+ //--------------------------------------------------------------------
+ // View
+ //--------------------------------------------------------------------
public:
- // Called whenever the agent moves. Puts camera back in default position, deselects items, etc.
- void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE);
- // Called on camera movement. Unlocks camera from the default position behind the avatar.
- void unlockView();
+ // Called whenever the agent moves. Puts camera back in default position, deselects items, etc.
+ void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE);
+ // Called on camera movement. Unlocks camera from the default position behind the avatar.
+ void unlockView();
public:
- F32 mDrawDistance;
+ F32 mDrawDistance;
- //--------------------------------------------------------------------
- // Mouselook
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Mouselook
+ //--------------------------------------------------------------------
public:
- BOOL getForceMouselook() const { return mForceMouselook; }
- void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; }
+ BOOL getForceMouselook() const { return mForceMouselook; }
+ void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; }
private:
- BOOL mForceMouselook;
-
- //--------------------------------------------------------------------
- // HUD
- //--------------------------------------------------------------------
+ BOOL mForceMouselook;
+
+ //--------------------------------------------------------------------
+ // HUD
+ //--------------------------------------------------------------------
public:
- F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing)
- F32 mHUDCurZoom; // Current animated zoom level for HUD objects
+ F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing)
+ F32 mHUDCurZoom; // Current animated zoom level for HUD objects
/********************************************************************************
@@ -323,89 +323,89 @@ public:
**/
public:
- S32 getAtKey() const { return mAtKey; }
- S32 getWalkKey() const { return mWalkKey; }
- S32 getLeftKey() const { return mLeftKey; }
- S32 getUpKey() const { return mUpKey; }
- F32 getYawKey() const { return mYawKey; }
- F32 getPitchKey() const { return mPitchKey; }
-
- void setAtKey(S32 mag) { mAtKey = mag; }
- void setWalkKey(S32 mag) { mWalkKey = mag; }
- void setLeftKey(S32 mag) { mLeftKey = mag; }
- void setUpKey(S32 mag) { mUpKey = mag; }
- void setYawKey(F32 mag) { mYawKey = mag; }
- void setPitchKey(F32 mag) { mPitchKey = mag; }
-
- void clearGeneralKeys();
- static S32 directionToKey(S32 direction); // Changes direction to -1/0/1
+ S32 getAtKey() const { return mAtKey; }
+ S32 getWalkKey() const { return mWalkKey; }
+ S32 getLeftKey() const { return mLeftKey; }
+ S32 getUpKey() const { return mUpKey; }
+ F32 getYawKey() const { return mYawKey; }
+ F32 getPitchKey() const { return mPitchKey; }
+
+ void setAtKey(S32 mag) { mAtKey = mag; }
+ void setWalkKey(S32 mag) { mWalkKey = mag; }
+ void setLeftKey(S32 mag) { mLeftKey = mag; }
+ void setUpKey(S32 mag) { mUpKey = mag; }
+ void setYawKey(F32 mag) { mYawKey = mag; }
+ void setPitchKey(F32 mag) { mPitchKey = mag; }
+
+ void clearGeneralKeys();
+ static S32 directionToKey(S32 direction); // Changes direction to -1/0/1
private:
- S32 mAtKey; // Either 1, 0, or -1. Indicates that movement key is pressed
- S32 mWalkKey; // Like AtKey, but causes less forward thrust
- S32 mLeftKey;
- S32 mUpKey;
- F32 mYawKey;
- F32 mPitchKey;
-
- //--------------------------------------------------------------------
- // Orbit
- //--------------------------------------------------------------------
+ S32 mAtKey; // Either 1, 0, or -1. Indicates that movement key is pressed
+ S32 mWalkKey; // Like AtKey, but causes less forward thrust
+ S32 mLeftKey;
+ S32 mUpKey;
+ F32 mYawKey;
+ F32 mPitchKey;
+
+ //--------------------------------------------------------------------
+ // Orbit
+ //--------------------------------------------------------------------
public:
- F32 getOrbitLeftKey() const { return mOrbitLeftKey; }
- F32 getOrbitRightKey() const { return mOrbitRightKey; }
- F32 getOrbitUpKey() const { return mOrbitUpKey; }
- F32 getOrbitDownKey() const { return mOrbitDownKey; }
- F32 getOrbitInKey() const { return mOrbitInKey; }
- F32 getOrbitOutKey() const { return mOrbitOutKey; }
-
- void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; }
- void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; }
- void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; }
- void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; }
- void setOrbitInKey(F32 mag) { mOrbitInKey = mag; }
- void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; }
-
- void clearOrbitKeys();
+ F32 getOrbitLeftKey() const { return mOrbitLeftKey; }
+ F32 getOrbitRightKey() const { return mOrbitRightKey; }
+ F32 getOrbitUpKey() const { return mOrbitUpKey; }
+ F32 getOrbitDownKey() const { return mOrbitDownKey; }
+ F32 getOrbitInKey() const { return mOrbitInKey; }
+ F32 getOrbitOutKey() const { return mOrbitOutKey; }
+
+ void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; }
+ void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; }
+ void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; }
+ void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; }
+ void setOrbitInKey(F32 mag) { mOrbitInKey = mag; }
+ void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; }
+
+ void clearOrbitKeys();
private:
- F32 mOrbitLeftKey;
- F32 mOrbitRightKey;
- F32 mOrbitUpKey;
- F32 mOrbitDownKey;
- F32 mOrbitInKey;
- F32 mOrbitOutKey;
-
- F32 mOrbitAroundRadians;
- F32 mOrbitOverAngle;
-
- //--------------------------------------------------------------------
- // Pan
- //--------------------------------------------------------------------
+ F32 mOrbitLeftKey;
+ F32 mOrbitRightKey;
+ F32 mOrbitUpKey;
+ F32 mOrbitDownKey;
+ F32 mOrbitInKey;
+ F32 mOrbitOutKey;
+
+ F32 mOrbitAroundRadians;
+ F32 mOrbitOverAngle;
+
+ //--------------------------------------------------------------------
+ // Pan
+ //--------------------------------------------------------------------
public:
- F32 getPanLeftKey() const { return mPanLeftKey; }
- F32 getPanRightKey() const { return mPanRightKey; }
- F32 getPanUpKey() const { return mPanUpKey; }
- F32 getPanDownKey() const { return mPanDownKey; }
- F32 getPanInKey() const { return mPanInKey; }
- F32 getPanOutKey() const { return mPanOutKey; }
-
- void setPanLeftKey(F32 mag) { mPanLeftKey = mag; }
- void setPanRightKey(F32 mag) { mPanRightKey = mag; }
- void setPanUpKey(F32 mag) { mPanUpKey = mag; }
- void setPanDownKey(F32 mag) { mPanDownKey = mag; }
- void setPanInKey(F32 mag) { mPanInKey = mag; }
- void setPanOutKey(F32 mag) { mPanOutKey = mag; }
-
- void clearPanKeys();
+ F32 getPanLeftKey() const { return mPanLeftKey; }
+ F32 getPanRightKey() const { return mPanRightKey; }
+ F32 getPanUpKey() const { return mPanUpKey; }
+ F32 getPanDownKey() const { return mPanDownKey; }
+ F32 getPanInKey() const { return mPanInKey; }
+ F32 getPanOutKey() const { return mPanOutKey; }
+
+ void setPanLeftKey(F32 mag) { mPanLeftKey = mag; }
+ void setPanRightKey(F32 mag) { mPanRightKey = mag; }
+ void setPanUpKey(F32 mag) { mPanUpKey = mag; }
+ void setPanDownKey(F32 mag) { mPanDownKey = mag; }
+ void setPanInKey(F32 mag) { mPanInKey = mag; }
+ void setPanOutKey(F32 mag) { mPanOutKey = mag; }
+
+ void clearPanKeys();
private:
- F32 mPanUpKey;
- F32 mPanDownKey;
- F32 mPanLeftKey;
- F32 mPanRightKey;
- F32 mPanInKey;
- F32 mPanOutKey;
-
- LLVector3d mPanFocusDiff;
+ F32 mPanUpKey;
+ F32 mPanDownKey;
+ F32 mPanLeftKey;
+ F32 mPanRightKey;
+ F32 mPanInKey;
+ F32 mPanOutKey;
+
+ LLVector3d mPanFocusDiff;
/** Keys
** **
diff --git a/indra/newview/llagentdata.cpp b/indra/newview/llagentdata.cpp
index d2c644a06f..872c0567b4 100644
--- a/indra/newview/llagentdata.cpp
+++ b/indra/newview/llagentdata.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llagentdata.cpp
* @brief Contains commonly used agent data.
* @author James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llagentdata.h b/indra/newview/llagentdata.h
index efdd97f6c4..4fa313b204 100644
--- a/indra/newview/llagentdata.h
+++ b/indra/newview/llagentdata.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llagentdata.h
* @brief Contains commonly used agent data
* @author James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llagentlanguage.cpp b/indra/newview/llagentlanguage.cpp
index cdb0e3302d..caf5950e53 100644
--- a/indra/newview/llagentlanguage.cpp
+++ b/indra/newview/llagentlanguage.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,24 +31,24 @@
#include "llviewercontrol.h"
#include "llviewerregion.h"
// library includes
-#include "llui.h" // getLanguage()
+#include "llui.h" // getLanguage()
#include "httpcommon.h"
// static
void LLAgentLanguage::init()
{
- gSavedSettings.getControl("Language")->getSignal()->connect(boost::bind(&onChange));
- gSavedSettings.getControl("InstallLanguage")->getSignal()->connect(boost::bind(&onChange));
- gSavedSettings.getControl("SystemLanguage")->getSignal()->connect(boost::bind(&onChange));
- gSavedSettings.getControl("LanguageIsPublic")->getSignal()->connect(boost::bind(&onChange));
+ gSavedSettings.getControl("Language")->getSignal()->connect(boost::bind(&onChange));
+ gSavedSettings.getControl("InstallLanguage")->getSignal()->connect(boost::bind(&onChange));
+ gSavedSettings.getControl("SystemLanguage")->getSignal()->connect(boost::bind(&onChange));
+ gSavedSettings.getControl("LanguageIsPublic")->getSignal()->connect(boost::bind(&onChange));
}
// static
void LLAgentLanguage::onChange()
{
- // Clear inventory cache so that default names of inventory items
- // appear retranslated (EXT-8308).
- gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
+ // Clear inventory cache so that default names of inventory items
+ // appear retranslated (EXT-8308).
+ gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
}
// send language settings to the sim
@@ -57,11 +57,11 @@ bool LLAgentLanguage::update()
{
LLSD body;
- std::string language = LLUI::getLanguage();
-
- body["language"] = language;
- body["language_is_public"] = gSavedSettings.getBOOL("LanguageIsPublic");
-
+ std::string language = LLUI::getLanguage();
+
+ body["language"] = language;
+ body["language_is_public"] = gSavedSettings.getBOOL("LanguageIsPublic");
+
if (!gAgent.requestPostCapability("UpdateAgentLanguage", body))
{
LL_WARNS("Language") << "Language capability unavailable." << LL_ENDL;
diff --git a/indra/newview/llagentlanguage.h b/indra/newview/llagentlanguage.h
index 2bb2eb7809..062ffde845 100644
--- a/indra/newview/llagentlanguage.h
+++ b/indra/newview/llagentlanguage.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,11 +30,11 @@
class LLAgentLanguage
{
public:
- static void init();
- static bool update();
+ static void init();
+ static bool update();
private:
- static void onChange();
+ static void onChange();
};
#endif // LL_LLAGENTLANGUAGE_H
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index 77a3d47aea..54998f3945 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -3,25 +3,25 @@
* @author Brad Kittenbrink
* @date 2009-07-10
* @brief Implementation for llagentlistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,16 +55,16 @@ LLAgentListener::LLAgentListener(LLAgent &agent)
"If [\"skip_confirmation\"] is true, use LLURLDispatcher rather than LLCommandDispatcher.",
&LLAgentListener::requestTeleport);
add("requestSit",
- "[\"obj_uuid\"]: id of object to sit on, use this or [\"position\"] to indicate the sit target"
- "[\"position\"]: region position {x, y, z} where to find closest object to sit on",
+ "[\"obj_uuid\"]: id of object to sit on, use this or [\"position\"] to indicate the sit target"
+ "[\"position\"]: region position {x, y, z} where to find closest object to sit on",
&LLAgentListener::requestSit);
add("requestStand",
"Ask to stand up",
&LLAgentListener::requestStand);
add("requestTouch",
- "[\"obj_uuid\"]: id of object to touch, use this or [\"position\"] to indicate the object to touch"
- "[\"position\"]: region position {x, y, z} where to find closest object to touch"
- "[\"face\"]: optional object face number to touch[Default: 0]",
+ "[\"obj_uuid\"]: id of object to touch, use this or [\"position\"] to indicate the object to touch"
+ "[\"position\"]: region position {x, y, z} where to find closest object to touch"
+ "[\"face\"]: optional object face number to touch[Default: 0]",
&LLAgentListener::requestTouch);
add("resetAxes",
"Set the agent to a fixed orientation (optionally specify [\"lookat\"] = array of [x, y, z])",
@@ -109,8 +109,8 @@ LLAgentListener::LLAgentListener(LLAgent &agent)
&LLAgentListener::getAutoPilot,
LLSDMap("reply", LLSD()));
add("startFollowPilot",
- "[\"leader_id\"]: uuid of target to follow using the autopilot system (optional with avatar_name)\n"
- "[\"avatar_name\"]: avatar name to follow using the autopilot system (optional with leader_id)\n"
+ "[\"leader_id\"]: uuid of target to follow using the autopilot system (optional with avatar_name)\n"
+ "[\"avatar_name\"]: avatar name to follow using the autopilot system (optional with leader_id)\n"
"[\"allow_flying\"]: allow flying during autopilot [default: True]\n"
"[\"stop_distance\"]: target maxiumum distance from target [default: autopilot guess]",
&LLAgentListener::startFollowPilot);
@@ -123,9 +123,9 @@ LLAgentListener::LLAgentListener(LLAgent &agent)
"[\"user_cancel\"] indicates whether or not to act as though user canceled autopilot [default: false]",
&LLAgentListener::stopAutoPilot);
add("lookAt",
- "[\"type\"]: number to indicate the lookAt type, 0 to clear\n"
- "[\"obj_uuid\"]: id of object to look at, use this or [\"position\"] to indicate the target\n"
- "[\"position\"]: region position {x, y, z} where to find closest object or avatar to look at",
+ "[\"type\"]: number to indicate the lookAt type, 0 to clear\n"
+ "[\"obj_uuid\"]: id of object to look at, use this or [\"position\"] to indicate the target\n"
+ "[\"position\"]: region position {x, y, z} where to find closest object or avatar to look at",
&LLAgentListener::lookAt);
add("getGroups",
"Send information about the agent's groups on [\"reply\"]:\n"
@@ -155,9 +155,9 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
}
else
{
- std::string url = LLSLURL(event_data["regionname"],
- LLVector3(event_data["x"].asReal(),
- event_data["y"].asReal(),
+ std::string url = LLSLURL(event_data["regionname"],
+ LLVector3(event_data["x"].asReal(),
+ event_data["y"].asReal(),
event_data["z"].asReal())).getSLURLString();
LLURLDispatcher::dispatch(url, LLCommandHandler::NAV_TYPE_CLICKED, NULL, false);
}
@@ -169,16 +169,16 @@ void LLAgentListener::requestSit(LLSD const & event_data) const
// shamelessly ripped from llviewermenu.cpp:handle_sit_or_stand()
// *TODO - find a permanent place to share this code properly.
- LLViewerObject *object = NULL;
- if (event_data.has("obj_uuid"))
- {
- object = gObjectList.findObject(event_data["obj_uuid"]);
- }
- else if (event_data.has("position"))
- {
- LLVector3 target_position = ll_vector3_from_sd(event_data["position"]);
- object = findObjectClosestTo(target_position);
- }
+ LLViewerObject *object = NULL;
+ if (event_data.has("obj_uuid"))
+ {
+ object = gObjectList.findObject(event_data["obj_uuid"]);
+ }
+ else if (event_data.has("position"))
+ {
+ LLVector3 target_position = ll_vector3_from_sd(event_data["position"]);
+ object = findObjectClosestTo(target_position);
+ }
if (object && object->getPCode() == LL_PCODE_VOLUME)
{
@@ -192,11 +192,11 @@ void LLAgentListener::requestSit(LLSD const & event_data) const
object->getRegion()->sendReliableMessage();
}
- else
- {
- LL_WARNS() << "LLAgent requestSit could not find the sit target: "
- << event_data << LL_ENDL;
- }
+ else
+ {
+ LL_WARNS() << "LLAgent requestSit could not find the sit target: "
+ << event_data << LL_ENDL;
+ }
}
void LLAgentListener::requestStand(LLSD const & event_data) const
@@ -207,79 +207,79 @@ void LLAgentListener::requestStand(LLSD const & event_data) const
LLViewerObject * LLAgentListener::findObjectClosestTo( const LLVector3 & position ) const
{
- LLViewerObject *object = NULL;
-
- // Find the object closest to that position
- F32 min_distance = 10000.0f; // Start big
- S32 num_objects = gObjectList.getNumObjects();
- S32 cur_index = 0;
- while (cur_index < num_objects)
- {
- LLViewerObject * cur_object = gObjectList.getObject(cur_index++);
- if (cur_object)
- { // Calculate distance from the target position
- LLVector3 target_diff = cur_object->getPositionRegion() - position;
- F32 distance_to_target = target_diff.length();
- if (distance_to_target < min_distance)
- { // Found an object closer
- min_distance = distance_to_target;
- object = cur_object;
- }
- }
- }
-
- return object;
+ LLViewerObject *object = NULL;
+
+ // Find the object closest to that position
+ F32 min_distance = 10000.0f; // Start big
+ S32 num_objects = gObjectList.getNumObjects();
+ S32 cur_index = 0;
+ while (cur_index < num_objects)
+ {
+ LLViewerObject * cur_object = gObjectList.getObject(cur_index++);
+ if (cur_object)
+ { // Calculate distance from the target position
+ LLVector3 target_diff = cur_object->getPositionRegion() - position;
+ F32 distance_to_target = target_diff.length();
+ if (distance_to_target < min_distance)
+ { // Found an object closer
+ min_distance = distance_to_target;
+ object = cur_object;
+ }
+ }
+ }
+
+ return object;
}
void LLAgentListener::requestTouch(LLSD const & event_data) const
{
- LLViewerObject *object = NULL;
-
- if (event_data.has("obj_uuid"))
- {
- object = gObjectList.findObject(event_data["obj_uuid"]);
- }
- else if (event_data.has("position"))
- {
- LLVector3 target_position = ll_vector3_from_sd(event_data["position"]);
- object = findObjectClosestTo(target_position);
- }
-
- S32 face = 0;
- if (event_data.has("face"))
- {
- face = event_data["face"].asInteger();
- }
+ LLViewerObject *object = NULL;
+
+ if (event_data.has("obj_uuid"))
+ {
+ object = gObjectList.findObject(event_data["obj_uuid"]);
+ }
+ else if (event_data.has("position"))
+ {
+ LLVector3 target_position = ll_vector3_from_sd(event_data["position"]);
+ object = findObjectClosestTo(target_position);
+ }
+
+ S32 face = 0;
+ if (event_data.has("face"))
+ {
+ face = event_data["face"].asInteger();
+ }
if (object && object->getPCode() == LL_PCODE_VOLUME)
{
- // Fake enough pick info to get it to (hopefully) work
- LLPickInfo pick;
- pick.mObjectFace = face;
-
- /*
- These values are sent to the simulator, but face seems to be easiest to use
-
- pick.mUVCoords "UVCoord"
- pick.mSTCoords "STCoord"
- pick.mObjectFace "FaceIndex"
- pick.mIntersection "Position"
- pick.mNormal "Normal"
- pick.mBinormal "Binormal"
- */
-
- // A touch is a sketchy message sequence ... send a grab, immediately
- // followed by un-grabbing, crossing fingers and hoping packets arrive in
- // the correct order
- send_ObjectGrab_message(object, pick, LLVector3::zero);
- send_ObjectDeGrab_message(object, pick);
+ // Fake enough pick info to get it to (hopefully) work
+ LLPickInfo pick;
+ pick.mObjectFace = face;
+
+ /*
+ These values are sent to the simulator, but face seems to be easiest to use
+
+ pick.mUVCoords "UVCoord"
+ pick.mSTCoords "STCoord"
+ pick.mObjectFace "FaceIndex"
+ pick.mIntersection "Position"
+ pick.mNormal "Normal"
+ pick.mBinormal "Binormal"
+ */
+
+ // A touch is a sketchy message sequence ... send a grab, immediately
+ // followed by un-grabbing, crossing fingers and hoping packets arrive in
+ // the correct order
+ send_ObjectGrab_message(object, pick, LLVector3::zero);
+ send_ObjectDeGrab_message(object, pick);
+ }
+ else
+ {
+ LL_WARNS() << "LLAgent requestTouch could not find the touch target "
+ << event_data["obj_uuid"].asUUID() << LL_ENDL;
}
- else
- {
- LL_WARNS() << "LLAgent requestTouch could not find the touch target "
- << event_data["obj_uuid"].asUUID() << LL_ENDL;
- }
}
@@ -303,12 +303,12 @@ void LLAgentListener::getAxes(const LLSD& event_data) const
quat.getEulerAngles(&roll, &pitch, &yaw);
// The official query API for LLQuaternion's [x, y, z, w] values is its
// public member mQ...
- LLSD reply = LLSD::emptyMap();
- reply["quat"] = llsd_copy_array(boost::begin(quat.mQ), boost::end(quat.mQ));
- reply["euler"] = LLSD::emptyMap();
- reply["euler"]["roll"] = roll;
- reply["euler"]["pitch"] = pitch;
- reply["euler"]["yaw"] = yaw;
+ LLSD reply = LLSD::emptyMap();
+ reply["quat"] = llsd_copy_array(boost::begin(quat.mQ), boost::end(quat.mQ));
+ reply["euler"] = LLSD::emptyMap();
+ reply["euler"]["roll"] = roll;
+ reply["euler"]["pitch"] = pitch;
+ reply["euler"]["yaw"] = yaw;
sendReply(reply, event_data);
}
@@ -318,16 +318,16 @@ void LLAgentListener::getPosition(const LLSD& event_data) const
LLQuaternion quat(mAgent.getQuat());
quat.getEulerAngles(&roll, &pitch, &yaw);
- LLSD reply = LLSD::emptyMap();
- reply["quat"] = llsd_copy_array(boost::begin(quat.mQ), boost::end(quat.mQ));
- reply["euler"] = LLSD::emptyMap();
- reply["euler"]["roll"] = roll;
- reply["euler"]["pitch"] = pitch;
- reply["euler"]["yaw"] = yaw;
+ LLSD reply = LLSD::emptyMap();
+ reply["quat"] = llsd_copy_array(boost::begin(quat.mQ), boost::end(quat.mQ));
+ reply["euler"] = LLSD::emptyMap();
+ reply["euler"]["roll"] = roll;
+ reply["euler"]["pitch"] = pitch;
+ reply["euler"]["yaw"] = yaw;
reply["region"] = ll_sd_from_vector3(mAgent.getPositionAgent());
reply["global"] = ll_sd_from_vector3d(mAgent.getPositionGlobal());
- sendReply(reply, event_data);
+ sendReply(reply, event_data);
}
@@ -346,22 +346,22 @@ void LLAgentListener::startAutoPilot(LLSD const & event_data)
{
rotation_threshold = event_data["rotation_threshold"].asReal();
}
-
- BOOL allow_flying = TRUE;
- if (event_data.has("allow_flying"))
- {
- allow_flying = (BOOL) event_data["allow_flying"].asBoolean();
- mAgent.setFlying(allow_flying);
- }
-
- F32 stop_distance = 0.f;
- if (event_data.has("stop_distance"))
- {
- stop_distance = event_data["stop_distance"].asReal();
- }
-
- // Clear follow target, this is doing a path
- mFollowTarget.setNull();
+
+ BOOL allow_flying = TRUE;
+ if (event_data.has("allow_flying"))
+ {
+ allow_flying = (BOOL) event_data["allow_flying"].asBoolean();
+ mAgent.setFlying(allow_flying);
+ }
+
+ F32 stop_distance = 0.f;
+ if (event_data.has("stop_distance"))
+ {
+ stop_distance = event_data["stop_distance"].asReal();
+ }
+
+ // Clear follow target, this is doing a path
+ mFollowTarget.setNull();
mAgent.startAutoPilotGlobal(ll_vector3d_from_sd(event_data["target_global"]),
event_data["behavior_name"],
@@ -369,137 +369,137 @@ void LLAgentListener::startAutoPilot(LLSD const & event_data)
NULL, NULL,
stop_distance,
rotation_threshold,
- allow_flying);
+ allow_flying);
}
void LLAgentListener::getAutoPilot(const LLSD& event_data) const
{
- LLSD reply = LLSD::emptyMap();
-
- LLSD::Boolean enabled = mAgent.getAutoPilot();
- reply["enabled"] = enabled;
-
- reply["target_global"] = ll_sd_from_vector3d(mAgent.getAutoPilotTargetGlobal());
-
- reply["leader_id"] = mAgent.getAutoPilotLeaderID();
-
- reply["stop_distance"] = mAgent.getAutoPilotStopDistance();
-
- reply["target_distance"] = mAgent.getAutoPilotTargetDist();
- if (!enabled &&
- mFollowTarget.notNull())
- { // Get an actual distance from the target object we were following
- LLViewerObject * target = gObjectList.findObject(mFollowTarget);
- if (target)
- { // Found the target AV, return the actual distance to them as well as their ID
- LLVector3 difference = target->getPositionRegion() - mAgent.getPositionAgent();
- reply["target_distance"] = difference.length();
- reply["leader_id"] = mFollowTarget;
- }
- }
-
- reply["use_rotation"] = (LLSD::Boolean) mAgent.getAutoPilotUseRotation();
- reply["target_facing"] = ll_sd_from_vector3(mAgent.getAutoPilotTargetFacing());
- reply["rotation_threshold"] = mAgent.getAutoPilotRotationThreshold();
- reply["behavior_name"] = mAgent.getAutoPilotBehaviorName();
- reply["fly"] = (LLSD::Boolean) mAgent.getFlying();
-
- sendReply(reply, event_data);
+ LLSD reply = LLSD::emptyMap();
+
+ LLSD::Boolean enabled = mAgent.getAutoPilot();
+ reply["enabled"] = enabled;
+
+ reply["target_global"] = ll_sd_from_vector3d(mAgent.getAutoPilotTargetGlobal());
+
+ reply["leader_id"] = mAgent.getAutoPilotLeaderID();
+
+ reply["stop_distance"] = mAgent.getAutoPilotStopDistance();
+
+ reply["target_distance"] = mAgent.getAutoPilotTargetDist();
+ if (!enabled &&
+ mFollowTarget.notNull())
+ { // Get an actual distance from the target object we were following
+ LLViewerObject * target = gObjectList.findObject(mFollowTarget);
+ if (target)
+ { // Found the target AV, return the actual distance to them as well as their ID
+ LLVector3 difference = target->getPositionRegion() - mAgent.getPositionAgent();
+ reply["target_distance"] = difference.length();
+ reply["leader_id"] = mFollowTarget;
+ }
+ }
+
+ reply["use_rotation"] = (LLSD::Boolean) mAgent.getAutoPilotUseRotation();
+ reply["target_facing"] = ll_sd_from_vector3(mAgent.getAutoPilotTargetFacing());
+ reply["rotation_threshold"] = mAgent.getAutoPilotRotationThreshold();
+ reply["behavior_name"] = mAgent.getAutoPilotBehaviorName();
+ reply["fly"] = (LLSD::Boolean) mAgent.getFlying();
+
+ sendReply(reply, event_data);
}
void LLAgentListener::startFollowPilot(LLSD const & event_data)
{
- LLUUID target_id;
-
- BOOL allow_flying = TRUE;
- if (event_data.has("allow_flying"))
- {
- allow_flying = (BOOL) event_data["allow_flying"].asBoolean();
- }
-
- if (event_data.has("leader_id"))
- {
- target_id = event_data["leader_id"];
- }
- else if (event_data.has("avatar_name"))
- { // Find the avatar with matching name
- std::string target_name = event_data["avatar_name"].asString();
-
- if (target_name.length() > 0)
- {
- S32 num_objects = gObjectList.getNumObjects();
- S32 cur_index = 0;
- while (cur_index < num_objects)
- {
- LLViewerObject * cur_object = gObjectList.getObject(cur_index++);
- if (cur_object &&
- cur_object->asAvatar() &&
- cur_object->asAvatar()->getFullname() == target_name)
- { // Found avatar with matching name, extract id and break out of loop
- target_id = cur_object->getID();
- break;
- }
- }
- }
- }
-
- F32 stop_distance = 0.f;
- if (event_data.has("stop_distance"))
- {
- stop_distance = event_data["stop_distance"].asReal();
- }
-
- if (target_id.notNull())
- {
- mAgent.setFlying(allow_flying);
- mFollowTarget = target_id; // Save follow target so we can report distance later
-
- mAgent.startFollowPilot(target_id, allow_flying, stop_distance);
- }
+ LLUUID target_id;
+
+ BOOL allow_flying = TRUE;
+ if (event_data.has("allow_flying"))
+ {
+ allow_flying = (BOOL) event_data["allow_flying"].asBoolean();
+ }
+
+ if (event_data.has("leader_id"))
+ {
+ target_id = event_data["leader_id"];
+ }
+ else if (event_data.has("avatar_name"))
+ { // Find the avatar with matching name
+ std::string target_name = event_data["avatar_name"].asString();
+
+ if (target_name.length() > 0)
+ {
+ S32 num_objects = gObjectList.getNumObjects();
+ S32 cur_index = 0;
+ while (cur_index < num_objects)
+ {
+ LLViewerObject * cur_object = gObjectList.getObject(cur_index++);
+ if (cur_object &&
+ cur_object->asAvatar() &&
+ cur_object->asAvatar()->getFullname() == target_name)
+ { // Found avatar with matching name, extract id and break out of loop
+ target_id = cur_object->getID();
+ break;
+ }
+ }
+ }
+ }
+
+ F32 stop_distance = 0.f;
+ if (event_data.has("stop_distance"))
+ {
+ stop_distance = event_data["stop_distance"].asReal();
+ }
+
+ if (target_id.notNull())
+ {
+ mAgent.setFlying(allow_flying);
+ mFollowTarget = target_id; // Save follow target so we can report distance later
+
+ mAgent.startFollowPilot(target_id, allow_flying, stop_distance);
+ }
}
void LLAgentListener::setAutoPilotTarget(LLSD const & event_data) const
{
- if (event_data.has("target_global"))
- {
- LLVector3d target_global(ll_vector3d_from_sd(event_data["target_global"]));
- mAgent.setAutoPilotTargetGlobal(target_global);
- }
+ if (event_data.has("target_global"))
+ {
+ LLVector3d target_global(ll_vector3d_from_sd(event_data["target_global"]));
+ mAgent.setAutoPilotTargetGlobal(target_global);
+ }
}
void LLAgentListener::stopAutoPilot(LLSD const & event_data) const
{
- BOOL user_cancel = FALSE;
- if (event_data.has("user_cancel"))
- {
- user_cancel = event_data["user_cancel"].asBoolean();
- }
+ BOOL user_cancel = FALSE;
+ if (event_data.has("user_cancel"))
+ {
+ user_cancel = event_data["user_cancel"].asBoolean();
+ }
mAgent.stopAutoPilot(user_cancel);
}
void LLAgentListener::lookAt(LLSD const & event_data) const
{
- LLViewerObject *object = NULL;
- if (event_data.has("obj_uuid"))
- {
- object = gObjectList.findObject(event_data["obj_uuid"]);
- }
- else if (event_data.has("position"))
- {
- LLVector3 target_position = ll_vector3_from_sd(event_data["position"]);
- object = findObjectClosestTo(target_position);
- }
-
- S32 look_at_type = (S32) LOOKAT_TARGET_NONE;
- if (event_data.has("type"))
- {
- look_at_type = event_data["type"].asInteger();
- }
- if (look_at_type >= (S32) LOOKAT_TARGET_NONE &&
- look_at_type < (S32) LOOKAT_NUM_TARGETS)
- {
- gAgentCamera.setLookAt((ELookAtType) look_at_type, object);
- }
+ LLViewerObject *object = NULL;
+ if (event_data.has("obj_uuid"))
+ {
+ object = gObjectList.findObject(event_data["obj_uuid"]);
+ }
+ else if (event_data.has("position"))
+ {
+ LLVector3 target_position = ll_vector3_from_sd(event_data["position"]);
+ object = findObjectClosestTo(target_position);
+ }
+
+ S32 look_at_type = (S32) LOOKAT_TARGET_NONE;
+ if (event_data.has("type"))
+ {
+ look_at_type = event_data["type"].asInteger();
+ }
+ if (look_at_type >= (S32) LOOKAT_TARGET_NONE &&
+ look_at_type < (S32) LOOKAT_NUM_TARGETS)
+ {
+ gAgentCamera.setLookAt((ELookAtType) look_at_type, object);
+ }
}
void LLAgentListener::getGroups(const LLSD& event) const
diff --git a/indra/newview/llagentlistener.h b/indra/newview/llagentlistener.h
index 9a9c4073fe..c544d089ce 100644
--- a/indra/newview/llagentlistener.h
+++ b/indra/newview/llagentlistener.h
@@ -3,25 +3,25 @@
* @author Brad Kittenbrink
* @date 2009-07-09
* @brief Event API for subset of LLViewerControl methods
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,7 +34,7 @@
class LLAgent;
class LLSD;
-class LLViewerObject;
+class LLViewerObject;
class LLVector3d;
class LLAgentListener : public LLEventAPI
@@ -49,20 +49,20 @@ private:
void requestTouch(LLSD const & event_data) const;
void resetAxes(const LLSD& event_data) const;
void getAxes(const LLSD& event_data) const;
- void getGroups(const LLSD& event) const;
+ void getGroups(const LLSD& event) const;
void getPosition(const LLSD& event_data) const;
void startAutoPilot(const LLSD& event_data);
void getAutoPilot(const LLSD& event_data) const;
void startFollowPilot(const LLSD& event_data);
void setAutoPilotTarget(const LLSD& event_data) const;
void stopAutoPilot(const LLSD& event_data) const;
- void lookAt(LLSD const & event_data) const;
+ void lookAt(LLSD const & event_data) const;
- LLViewerObject * findObjectClosestTo( const LLVector3 & position ) const;
+ LLViewerObject * findObjectClosestTo( const LLVector3 & position ) const;
private:
- LLAgent & mAgent;
- LLUUID mFollowTarget;
+ LLAgent & mAgent;
+ LLUUID mFollowTarget;
};
#endif // LL_LLAGENTLISTENER_H
diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp
index 799060eeab..288d04d9a0 100644
--- a/indra/newview/llagentpicksinfo.cpp
+++ b/indra/newview/llagentpicksinfo.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentpicksinfo.cpp
* @brief LLAgentPicksInfo class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,47 +36,47 @@ const S32 MAX_AVATAR_PICKS = 10;
class LLAgentPicksInfo::LLAgentPicksObserver : public LLAvatarPropertiesObserver
{
public:
- LLAgentPicksObserver()
- {
- LLAvatarPropertiesProcessor::getInstance()->addObserver(gAgent.getID(), this);
- }
-
- ~LLAgentPicksObserver()
- {
- if (LLAvatarPropertiesProcessor::instanceExists())
- LLAvatarPropertiesProcessor::getInstance()->removeObserver(gAgent.getID(), this);
- }
-
- void sendAgentPicksRequest()
- {
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(gAgent.getID());
- }
-
- typedef boost::function<void(LLAvatarPicks*)> server_respond_callback_t;
-
- void setServerRespondCallback(const server_respond_callback_t& cb)
- {
- mServerRespondCallback = cb;
- }
-
- virtual void processProperties(void* data, EAvatarProcessorType type)
- {
- if(APT_PICKS == type)
- {
- LLAvatarPicks* picks = static_cast<LLAvatarPicks*>(data);
- if(picks && gAgent.getID() == picks->target_id)
- {
- if(mServerRespondCallback)
- {
- mServerRespondCallback(picks);
- }
- }
- }
- }
+ LLAgentPicksObserver()
+ {
+ LLAvatarPropertiesProcessor::getInstance()->addObserver(gAgent.getID(), this);
+ }
+
+ ~LLAgentPicksObserver()
+ {
+ if (LLAvatarPropertiesProcessor::instanceExists())
+ LLAvatarPropertiesProcessor::getInstance()->removeObserver(gAgent.getID(), this);
+ }
+
+ void sendAgentPicksRequest()
+ {
+ LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(gAgent.getID());
+ }
+
+ typedef boost::function<void(LLAvatarPicks*)> server_respond_callback_t;
+
+ void setServerRespondCallback(const server_respond_callback_t& cb)
+ {
+ mServerRespondCallback = cb;
+ }
+
+ virtual void processProperties(void* data, EAvatarProcessorType type)
+ {
+ if(APT_PICKS == type)
+ {
+ LLAvatarPicks* picks = static_cast<LLAvatarPicks*>(data);
+ if(picks && gAgent.getID() == picks->target_id)
+ {
+ if(mServerRespondCallback)
+ {
+ mServerRespondCallback(picks);
+ }
+ }
+ }
+ }
private:
- server_respond_callback_t mServerRespondCallback;
+ server_respond_callback_t mServerRespondCallback;
};
//////////////////////////////////////////////////////////////////////////
@@ -86,42 +86,42 @@ private:
LLAgentPicksInfo::LLAgentPicksInfo()
: mAgentPicksObserver(NULL)
, mMaxNumberOfPicks(MAX_AVATAR_PICKS)
- // Disable Pick creation until we get number of Picks from server - in case
+ // Disable Pick creation until we get number of Picks from server - in case
// avatar has maximum number of Picks.
- , mNumberOfPicks(mMaxNumberOfPicks)
+ , mNumberOfPicks(mMaxNumberOfPicks)
{
}
LLAgentPicksInfo::~LLAgentPicksInfo()
{
- delete mAgentPicksObserver;
+ delete mAgentPicksObserver;
}
void LLAgentPicksInfo::requestNumberOfPicks()
{
- if(!mAgentPicksObserver)
- {
- mAgentPicksObserver = new LLAgentPicksObserver();
+ if(!mAgentPicksObserver)
+ {
+ mAgentPicksObserver = new LLAgentPicksObserver();
- mAgentPicksObserver->setServerRespondCallback(boost::bind(
- &LLAgentPicksInfo::onServerRespond, this, _1));
- }
+ mAgentPicksObserver->setServerRespondCallback(boost::bind(
+ &LLAgentPicksInfo::onServerRespond, this, _1));
+ }
- mAgentPicksObserver->sendAgentPicksRequest();
+ mAgentPicksObserver->sendAgentPicksRequest();
}
bool LLAgentPicksInfo::isPickLimitReached()
{
- return getNumberOfPicks() >= getMaxNumberOfPicks();
+ return getNumberOfPicks() >= getMaxNumberOfPicks();
}
void LLAgentPicksInfo::onServerRespond(LLAvatarPicks* picks)
{
- if(!picks)
- {
- LL_ERRS() << "Unexpected value" << LL_ENDL;
- return;
- }
+ if(!picks)
+ {
+ LL_ERRS() << "Unexpected value" << LL_ENDL;
+ return;
+ }
- setNumberOfPicks(picks->picks_list.size());
+ setNumberOfPicks(picks->picks_list.size());
}
diff --git a/indra/newview/llagentpicksinfo.h b/indra/newview/llagentpicksinfo.h
index 21df036cb7..19d593bab5 100644
--- a/indra/newview/llagentpicksinfo.h
+++ b/indra/newview/llagentpicksinfo.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentpicksinfo.h
* @brief LLAgentPicksInfo class header file
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,63 +36,63 @@ struct LLAvatarPicks;
*/
class LLAgentPicksInfo : public LLSingleton<LLAgentPicksInfo>
{
- LLSINGLETON(LLAgentPicksInfo);
- virtual ~LLAgentPicksInfo();
+ LLSINGLETON(LLAgentPicksInfo);
+ virtual ~LLAgentPicksInfo();
- class LLAgentPicksObserver;
+ class LLAgentPicksObserver;
public:
- /**
- * Requests number of picks from server.
- *
- * Number of Picks is requested from server, thus it is not available immediately.
- */
- void requestNumberOfPicks();
-
- /**
- * Returns number of Picks.
- */
- S32 getNumberOfPicks() { return mNumberOfPicks; }
-
- /**
- * Returns maximum number of Picks.
- */
- S32 getMaxNumberOfPicks() { return mMaxNumberOfPicks; }
-
- /**
- * Returns TRUE if Agent has maximum allowed number of Picks.
- */
- bool isPickLimitReached();
-
- /**
- * After creating or deleting a Pick we can assume operation on server will be
- * completed successfully. Incrementing/decrementing number of picks makes new number
- * of picks available immediately. Actual number of picks will be updated when we receive
- * response from server.
- */
- void incrementNumberOfPicks() { ++mNumberOfPicks; }
-
- void decrementNumberOfPicks() { --mNumberOfPicks; }
-
- void onServerRespond(LLAvatarPicks* picks);
+ /**
+ * Requests number of picks from server.
+ *
+ * Number of Picks is requested from server, thus it is not available immediately.
+ */
+ void requestNumberOfPicks();
+
+ /**
+ * Returns number of Picks.
+ */
+ S32 getNumberOfPicks() { return mNumberOfPicks; }
+
+ /**
+ * Returns maximum number of Picks.
+ */
+ S32 getMaxNumberOfPicks() { return mMaxNumberOfPicks; }
+
+ /**
+ * Returns TRUE if Agent has maximum allowed number of Picks.
+ */
+ bool isPickLimitReached();
+
+ /**
+ * After creating or deleting a Pick we can assume operation on server will be
+ * completed successfully. Incrementing/decrementing number of picks makes new number
+ * of picks available immediately. Actual number of picks will be updated when we receive
+ * response from server.
+ */
+ void incrementNumberOfPicks() { ++mNumberOfPicks; }
+
+ void decrementNumberOfPicks() { --mNumberOfPicks; }
+
+ void onServerRespond(LLAvatarPicks* picks);
private:
- /**
- * Sets number of Picks.
- */
- void setNumberOfPicks(S32 number) { mNumberOfPicks = number; }
+ /**
+ * Sets number of Picks.
+ */
+ void setNumberOfPicks(S32 number) { mNumberOfPicks = number; }
- /**
- * Sets maximum number of Picks.
- */
- void setMaxNumberOfPicks(S32 max_picks) { mMaxNumberOfPicks = max_picks; }
+ /**
+ * Sets maximum number of Picks.
+ */
+ void setMaxNumberOfPicks(S32 max_picks) { mMaxNumberOfPicks = max_picks; }
private:
- LLAgentPicksObserver* mAgentPicksObserver;
- S32 mMaxNumberOfPicks;
- S32 mNumberOfPicks;
+ LLAgentPicksObserver* mAgentPicksObserver;
+ S32 mMaxNumberOfPicks;
+ S32 mNumberOfPicks;
};
#endif //LL_LLAGENTPICKS_H
diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp
index cfc445f998..ecb705ec2d 100644
--- a/indra/newview/llagentpilot.cpp
+++ b/indra/newview/llagentpilot.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentpilot.cpp
* @brief LLAgentPilot class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,16 +41,16 @@
LLAgentPilot gAgentPilot;
LLAgentPilot::LLAgentPilot() :
- mNumRuns(-1),
- mQuitAfterRuns(FALSE),
- mRecording(FALSE),
- mLastRecordTime(0.f),
- mStarted(FALSE),
- mPlaying(FALSE),
- mCurrentAction(0),
- mOverrideCamera(FALSE),
- mLoop(TRUE),
- mReplaySession(FALSE)
+ mNumRuns(-1),
+ mQuitAfterRuns(FALSE),
+ mRecording(FALSE),
+ mLastRecordTime(0.f),
+ mStarted(FALSE),
+ mPlaying(FALSE),
+ mCurrentAction(0),
+ mOverrideCamera(FALSE),
+ mLoop(TRUE),
+ mReplaySession(FALSE)
{
}
@@ -60,348 +60,348 @@ LLAgentPilot::~LLAgentPilot()
void LLAgentPilot::load()
{
- std::string txt_filename = gSavedSettings.getString("StatsPilotFile");
- std::string xml_filename = gSavedSettings.getString("StatsPilotXMLFile");
- if (LLFile::isfile(xml_filename))
- {
- loadXML(xml_filename);
- }
- else if (LLFile::isfile(txt_filename))
- {
- loadTxt(txt_filename);
- }
- else
- {
- LL_DEBUGS() << "no autopilot file found" << LL_ENDL;
- return;
- }
+ std::string txt_filename = gSavedSettings.getString("StatsPilotFile");
+ std::string xml_filename = gSavedSettings.getString("StatsPilotXMLFile");
+ if (LLFile::isfile(xml_filename))
+ {
+ loadXML(xml_filename);
+ }
+ else if (LLFile::isfile(txt_filename))
+ {
+ loadTxt(txt_filename);
+ }
+ else
+ {
+ LL_DEBUGS() << "no autopilot file found" << LL_ENDL;
+ return;
+ }
}
void LLAgentPilot::loadTxt(const std::string& filename)
{
- if(filename.empty())
- {
- return;
- }
-
- llifstream file(filename.c_str());
-
- if (!file)
- {
- LL_DEBUGS() << "Couldn't open " << filename
- << ", aborting agentpilot load!" << LL_ENDL;
- return;
- }
- else
- {
- LL_INFOS() << "Opening pilot file " << filename << LL_ENDL;
- }
-
- mActions.clear();
- S32 num_actions;
-
- file >> num_actions;
-
- mActions.reserve(num_actions);
- for (S32 i = 0; i < num_actions; i++)
- {
- S32 action_type;
- Action new_action;
- file >> new_action.mTime >> action_type;
- file >> new_action.mTarget.mdV[VX] >> new_action.mTarget.mdV[VY] >> new_action.mTarget.mdV[VZ];
- new_action.mType = (EActionType)action_type;
- mActions.push_back(new_action);
- }
-
- mOverrideCamera = false;
-
- file.close();
+ if(filename.empty())
+ {
+ return;
+ }
+
+ llifstream file(filename.c_str());
+
+ if (!file)
+ {
+ LL_DEBUGS() << "Couldn't open " << filename
+ << ", aborting agentpilot load!" << LL_ENDL;
+ return;
+ }
+ else
+ {
+ LL_INFOS() << "Opening pilot file " << filename << LL_ENDL;
+ }
+
+ mActions.clear();
+ S32 num_actions;
+
+ file >> num_actions;
+
+ mActions.reserve(num_actions);
+ for (S32 i = 0; i < num_actions; i++)
+ {
+ S32 action_type;
+ Action new_action;
+ file >> new_action.mTime >> action_type;
+ file >> new_action.mTarget.mdV[VX] >> new_action.mTarget.mdV[VY] >> new_action.mTarget.mdV[VZ];
+ new_action.mType = (EActionType)action_type;
+ mActions.push_back(new_action);
+ }
+
+ mOverrideCamera = false;
+
+ file.close();
}
void LLAgentPilot::loadXML(const std::string& filename)
{
- if(filename.empty())
- {
- return;
- }
-
- llifstream file(filename.c_str());
-
- if (!file)
- {
- LL_DEBUGS() << "Couldn't open " << filename
- << ", aborting agentpilot load!" << LL_ENDL;
- return;
- }
- else
- {
- LL_INFOS() << "Opening pilot file " << filename << LL_ENDL;
- }
-
- mActions.clear();
- LLSD record;
- while (!file.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(record, file))
- {
- Action action;
- action.mTime = record["time"].asReal();
- action.mType = (EActionType)record["type"].asInteger();
- action.mCameraView = record["camera_view"].asReal();
- action.mTarget = ll_vector3d_from_sd(record["target"]);
- action.mCameraOrigin = ll_vector3_from_sd(record["camera_origin"]);
- action.mCameraXAxis = ll_vector3_from_sd(record["camera_xaxis"]);
- action.mCameraYAxis = ll_vector3_from_sd(record["camera_yaxis"]);
- action.mCameraZAxis = ll_vector3_from_sd(record["camera_zaxis"]);
- mActions.push_back(action);
- }
- mOverrideCamera = true;
- file.close();
+ if(filename.empty())
+ {
+ return;
+ }
+
+ llifstream file(filename.c_str());
+
+ if (!file)
+ {
+ LL_DEBUGS() << "Couldn't open " << filename
+ << ", aborting agentpilot load!" << LL_ENDL;
+ return;
+ }
+ else
+ {
+ LL_INFOS() << "Opening pilot file " << filename << LL_ENDL;
+ }
+
+ mActions.clear();
+ LLSD record;
+ while (!file.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(record, file))
+ {
+ Action action;
+ action.mTime = record["time"].asReal();
+ action.mType = (EActionType)record["type"].asInteger();
+ action.mCameraView = record["camera_view"].asReal();
+ action.mTarget = ll_vector3d_from_sd(record["target"]);
+ action.mCameraOrigin = ll_vector3_from_sd(record["camera_origin"]);
+ action.mCameraXAxis = ll_vector3_from_sd(record["camera_xaxis"]);
+ action.mCameraYAxis = ll_vector3_from_sd(record["camera_yaxis"]);
+ action.mCameraZAxis = ll_vector3_from_sd(record["camera_zaxis"]);
+ mActions.push_back(action);
+ }
+ mOverrideCamera = true;
+ file.close();
}
void LLAgentPilot::save()
{
- std::string txt_filename = gSavedSettings.getString("StatsPilotFile");
- std::string xml_filename = gSavedSettings.getString("StatsPilotXMLFile");
- saveTxt(txt_filename);
- saveXML(xml_filename);
+ std::string txt_filename = gSavedSettings.getString("StatsPilotFile");
+ std::string xml_filename = gSavedSettings.getString("StatsPilotXMLFile");
+ saveTxt(txt_filename);
+ saveXML(xml_filename);
}
void LLAgentPilot::saveTxt(const std::string& filename)
{
- llofstream file;
- file.open(filename.c_str());
+ llofstream file;
+ file.open(filename.c_str());
- if (!file)
- {
- LL_INFOS() << "Couldn't open " << filename << ", aborting agentpilot save!" << LL_ENDL;
- }
+ if (!file)
+ {
+ LL_INFOS() << "Couldn't open " << filename << ", aborting agentpilot save!" << LL_ENDL;
+ }
- file << mActions.size() << '\n';
+ file << mActions.size() << '\n';
- S32 i;
- for (i = 0; i < mActions.size(); i++)
- {
- file << mActions[i].mTime << "\t" << mActions[i].mType << "\t";
- file << std::setprecision(32) << mActions[i].mTarget.mdV[VX] << "\t" << mActions[i].mTarget.mdV[VY] << "\t" << mActions[i].mTarget.mdV[VZ];
- file << '\n';
- }
+ S32 i;
+ for (i = 0; i < mActions.size(); i++)
+ {
+ file << mActions[i].mTime << "\t" << mActions[i].mType << "\t";
+ file << std::setprecision(32) << mActions[i].mTarget.mdV[VX] << "\t" << mActions[i].mTarget.mdV[VY] << "\t" << mActions[i].mTarget.mdV[VZ];
+ file << '\n';
+ }
- file.close();
+ file.close();
}
void LLAgentPilot::saveXML(const std::string& filename)
{
- llofstream file;
- file.open(filename.c_str());
-
- if (!file)
- {
- LL_INFOS() << "Couldn't open " << filename << ", aborting agentpilot save!" << LL_ENDL;
- }
-
- S32 i;
- for (i = 0; i < mActions.size(); i++)
- {
- Action& action = mActions[i];
- LLSD record;
- record["time"] = (LLSD::Real)action.mTime;
- record["type"] = (LLSD::Integer)action.mType;
- record["camera_view"] = (LLSD::Real)action.mCameraView;
- record["target"] = ll_sd_from_vector3d(action.mTarget);
- record["camera_origin"] = ll_sd_from_vector3(action.mCameraOrigin);
- record["camera_xaxis"] = ll_sd_from_vector3(action.mCameraXAxis);
- record["camera_yaxis"] = ll_sd_from_vector3(action.mCameraYAxis);
- record["camera_zaxis"] = ll_sd_from_vector3(action.mCameraZAxis);
- LLSDSerialize::toXML(record, file);
- }
- file.close();
+ llofstream file;
+ file.open(filename.c_str());
+
+ if (!file)
+ {
+ LL_INFOS() << "Couldn't open " << filename << ", aborting agentpilot save!" << LL_ENDL;
+ }
+
+ S32 i;
+ for (i = 0; i < mActions.size(); i++)
+ {
+ Action& action = mActions[i];
+ LLSD record;
+ record["time"] = (LLSD::Real)action.mTime;
+ record["type"] = (LLSD::Integer)action.mType;
+ record["camera_view"] = (LLSD::Real)action.mCameraView;
+ record["target"] = ll_sd_from_vector3d(action.mTarget);
+ record["camera_origin"] = ll_sd_from_vector3(action.mCameraOrigin);
+ record["camera_xaxis"] = ll_sd_from_vector3(action.mCameraXAxis);
+ record["camera_yaxis"] = ll_sd_from_vector3(action.mCameraYAxis);
+ record["camera_zaxis"] = ll_sd_from_vector3(action.mCameraZAxis);
+ LLSDSerialize::toXML(record, file);
+ }
+ file.close();
}
void LLAgentPilot::startRecord()
{
- mActions.clear();
- mTimer.reset();
- addAction(STRAIGHT);
- mRecording = TRUE;
+ mActions.clear();
+ mTimer.reset();
+ addAction(STRAIGHT);
+ mRecording = TRUE;
}
void LLAgentPilot::stopRecord()
{
- gAgentPilot.addAction(STRAIGHT);
- gAgentPilot.save();
- mRecording = FALSE;
+ gAgentPilot.addAction(STRAIGHT);
+ gAgentPilot.save();
+ mRecording = FALSE;
}
void LLAgentPilot::addAction(enum EActionType action_type)
{
- LL_INFOS() << "Adding waypoint: " << gAgent.getPositionGlobal() << LL_ENDL;
- Action action;
- action.mType = action_type;
- action.mTarget = gAgent.getPositionGlobal();
- action.mTime = mTimer.getElapsedTimeF32();
- LLViewerCamera *cam = LLViewerCamera::getInstance();
- action.mCameraView = cam->getView();
- action.mCameraOrigin = cam->getOrigin();
- action.mCameraXAxis = cam->getXAxis();
- action.mCameraYAxis = cam->getYAxis();
- action.mCameraZAxis = cam->getZAxis();
- mLastRecordTime = (F32)action.mTime;
- mActions.push_back(action);
+ LL_INFOS() << "Adding waypoint: " << gAgent.getPositionGlobal() << LL_ENDL;
+ Action action;
+ action.mType = action_type;
+ action.mTarget = gAgent.getPositionGlobal();
+ action.mTime = mTimer.getElapsedTimeF32();
+ LLViewerCamera *cam = LLViewerCamera::getInstance();
+ action.mCameraView = cam->getView();
+ action.mCameraOrigin = cam->getOrigin();
+ action.mCameraXAxis = cam->getXAxis();
+ action.mCameraYAxis = cam->getYAxis();
+ action.mCameraZAxis = cam->getZAxis();
+ mLastRecordTime = (F32)action.mTime;
+ mActions.push_back(action);
}
void LLAgentPilot::startPlayback()
{
- if (!mPlaying)
- {
- mPlaying = TRUE;
- mCurrentAction = 0;
- mTimer.reset();
-
- if (mActions.size())
- {
- LL_INFOS() << "Starting playback, moving to waypoint 0" << LL_ENDL;
- gAgent.startAutoPilotGlobal(mActions[0].mTarget);
- moveCamera();
- mStarted = FALSE;
- }
- else
- {
- LL_INFOS() << "No autopilot data, cancelling!" << LL_ENDL;
- mPlaying = FALSE;
- }
- }
+ if (!mPlaying)
+ {
+ mPlaying = TRUE;
+ mCurrentAction = 0;
+ mTimer.reset();
+
+ if (mActions.size())
+ {
+ LL_INFOS() << "Starting playback, moving to waypoint 0" << LL_ENDL;
+ gAgent.startAutoPilotGlobal(mActions[0].mTarget);
+ moveCamera();
+ mStarted = FALSE;
+ }
+ else
+ {
+ LL_INFOS() << "No autopilot data, cancelling!" << LL_ENDL;
+ mPlaying = FALSE;
+ }
+ }
}
void LLAgentPilot::stopPlayback()
{
- if (mPlaying)
- {
- mPlaying = FALSE;
- mCurrentAction = 0;
- mTimer.reset();
- gAgent.stopAutoPilot();
- }
-
- if (mReplaySession)
- {
- LLAppViewer::instance()->forceQuit();
- }
+ if (mPlaying)
+ {
+ mPlaying = FALSE;
+ mCurrentAction = 0;
+ mTimer.reset();
+ gAgent.stopAutoPilot();
+ }
+
+ if (mReplaySession)
+ {
+ LLAppViewer::instance()->forceQuit();
+ }
}
void LLAgentPilot::moveCamera()
{
- if (!getOverrideCamera())
- return;
-
- if (mCurrentAction<mActions.size())
- {
- S32 start_index = llmax(mCurrentAction-1,0);
- S32 end_index = mCurrentAction;
- F32 t = 0.0;
- F32 timedelta = mActions[end_index].mTime - mActions[start_index].mTime;
- F32 tickelapsed = mTimer.getElapsedTimeF32()-mActions[start_index].mTime;
- if (timedelta > 0.0)
- {
- t = tickelapsed/timedelta;
- }
-
- if ((t<0.0)||(t>1.0))
- {
- LL_WARNS() << "mCurrentAction is invalid, t = " << t << LL_ENDL;
- return;
- }
-
- Action& start = mActions[start_index];
- Action& end = mActions[end_index];
-
- F32 view = lerp(start.mCameraView, end.mCameraView, t);
- LLVector3 origin = lerp(start.mCameraOrigin, end.mCameraOrigin, t);
- LLQuaternion start_quat(start.mCameraXAxis, start.mCameraYAxis, start.mCameraZAxis);
- LLQuaternion end_quat(end.mCameraXAxis, end.mCameraYAxis, end.mCameraZAxis);
- LLQuaternion quat = nlerp(t, start_quat, end_quat);
- LLMatrix3 mat(quat);
-
- LLViewerCamera::getInstance()->setView(view);
- LLViewerCamera::getInstance()->setOrigin(origin);
- LLViewerCamera::getInstance()->mXAxis = LLVector3(mat.mMatrix[0]);
- LLViewerCamera::getInstance()->mYAxis = LLVector3(mat.mMatrix[1]);
- LLViewerCamera::getInstance()->mZAxis = LLVector3(mat.mMatrix[2]);
- }
+ if (!getOverrideCamera())
+ return;
+
+ if (mCurrentAction<mActions.size())
+ {
+ S32 start_index = llmax(mCurrentAction-1,0);
+ S32 end_index = mCurrentAction;
+ F32 t = 0.0;
+ F32 timedelta = mActions[end_index].mTime - mActions[start_index].mTime;
+ F32 tickelapsed = mTimer.getElapsedTimeF32()-mActions[start_index].mTime;
+ if (timedelta > 0.0)
+ {
+ t = tickelapsed/timedelta;
+ }
+
+ if ((t<0.0)||(t>1.0))
+ {
+ LL_WARNS() << "mCurrentAction is invalid, t = " << t << LL_ENDL;
+ return;
+ }
+
+ Action& start = mActions[start_index];
+ Action& end = mActions[end_index];
+
+ F32 view = lerp(start.mCameraView, end.mCameraView, t);
+ LLVector3 origin = lerp(start.mCameraOrigin, end.mCameraOrigin, t);
+ LLQuaternion start_quat(start.mCameraXAxis, start.mCameraYAxis, start.mCameraZAxis);
+ LLQuaternion end_quat(end.mCameraXAxis, end.mCameraYAxis, end.mCameraZAxis);
+ LLQuaternion quat = nlerp(t, start_quat, end_quat);
+ LLMatrix3 mat(quat);
+
+ LLViewerCamera::getInstance()->setView(view);
+ LLViewerCamera::getInstance()->setOrigin(origin);
+ LLViewerCamera::getInstance()->mXAxis = LLVector3(mat.mMatrix[0]);
+ LLViewerCamera::getInstance()->mYAxis = LLVector3(mat.mMatrix[1]);
+ LLViewerCamera::getInstance()->mZAxis = LLVector3(mat.mMatrix[2]);
+ }
}
void LLAgentPilot::updateTarget()
{
- if (mPlaying)
- {
- if (mCurrentAction < mActions.size())
- {
- if (0 == mCurrentAction)
- {
- if (gAgent.getAutoPilot())
- {
- // Wait until we get to the first location before starting.
- return;
- }
- else
- {
- if (!mStarted)
- {
- LL_INFOS() << "At start, beginning playback" << LL_ENDL;
- mTimer.reset();
- mStarted = TRUE;
- }
- }
- }
- if (mTimer.getElapsedTimeF32() > mActions[mCurrentAction].mTime)
- {
- //gAgent.stopAutoPilot();
- mCurrentAction++;
-
- if (mCurrentAction < mActions.size())
- {
- gAgent.startAutoPilotGlobal(mActions[mCurrentAction].mTarget);
- moveCamera();
- }
- else
- {
- stopPlayback();
- mNumRuns--;
- if (mLoop)
- {
- if ((mNumRuns < 0) || (mNumRuns > 0))
- {
- LL_INFOS() << "Looping, restarting playback" << LL_ENDL;
- startPlayback();
- }
- else if (mQuitAfterRuns)
- {
- LL_INFOS() << "Done with all runs, quitting viewer!" << LL_ENDL;
- LLAppViewer::instance()->forceQuit();
- }
- else
- {
- LL_INFOS() << "Done with all runs, disabling pilot" << LL_ENDL;
- stopPlayback();
- }
- }
- }
- }
- }
- else
- {
- stopPlayback();
- }
- }
- else if (mRecording)
- {
- if (mTimer.getElapsedTimeF32() - mLastRecordTime > 1.f)
- {
- addAction(STRAIGHT);
- }
- }
+ if (mPlaying)
+ {
+ if (mCurrentAction < mActions.size())
+ {
+ if (0 == mCurrentAction)
+ {
+ if (gAgent.getAutoPilot())
+ {
+ // Wait until we get to the first location before starting.
+ return;
+ }
+ else
+ {
+ if (!mStarted)
+ {
+ LL_INFOS() << "At start, beginning playback" << LL_ENDL;
+ mTimer.reset();
+ mStarted = TRUE;
+ }
+ }
+ }
+ if (mTimer.getElapsedTimeF32() > mActions[mCurrentAction].mTime)
+ {
+ //gAgent.stopAutoPilot();
+ mCurrentAction++;
+
+ if (mCurrentAction < mActions.size())
+ {
+ gAgent.startAutoPilotGlobal(mActions[mCurrentAction].mTarget);
+ moveCamera();
+ }
+ else
+ {
+ stopPlayback();
+ mNumRuns--;
+ if (mLoop)
+ {
+ if ((mNumRuns < 0) || (mNumRuns > 0))
+ {
+ LL_INFOS() << "Looping, restarting playback" << LL_ENDL;
+ startPlayback();
+ }
+ else if (mQuitAfterRuns)
+ {
+ LL_INFOS() << "Done with all runs, quitting viewer!" << LL_ENDL;
+ LLAppViewer::instance()->forceQuit();
+ }
+ else
+ {
+ LL_INFOS() << "Done with all runs, disabling pilot" << LL_ENDL;
+ stopPlayback();
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ stopPlayback();
+ }
+ }
+ else if (mRecording)
+ {
+ if (mTimer.getElapsedTimeF32() - mLastRecordTime > 1.f)
+ {
+ addAction(STRAIGHT);
+ }
+ }
}
void LLAgentPilot::addWaypoint()
{
- addAction(STRAIGHT);
+ addAction(STRAIGHT);
}
diff --git a/indra/newview/llagentpilot.h b/indra/newview/llagentpilot.h
index f6b6376086..42ca716511 100644
--- a/indra/newview/llagentpilot.h
+++ b/indra/newview/llagentpilot.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentpilot.h
* @brief LLAgentPilot class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,84 +36,84 @@
class LLAgentPilot
{
public:
- enum EActionType
- {
- STRAIGHT,
- TURN
- };
-
- LLAgentPilot();
- virtual ~LLAgentPilot();
-
- void load();
- void loadTxt(const std::string& filename);
- void loadXML(const std::string& filename);
- void save();
- void saveTxt(const std::string& filename);
- void saveXML(const std::string& filename);
-
- void startRecord();
- void stopRecord();
- void addAction(enum EActionType action);
-
- void startPlayback();
- void stopPlayback();
-
- bool isRecording() { return mRecording; }
- bool isPlaying() { return mPlaying; }
- bool getOverrideCamera() { return mOverrideCamera; }
-
- void updateTarget();
-
- void addWaypoint();
- void moveCamera();
-
- void setReplaySession(BOOL new_val) { mReplaySession = new_val; }
- BOOL getReplaySession() { return mReplaySession; }
-
- void setLoop(BOOL new_val) { mLoop = new_val; }
- BOOL getLoop() { return mLoop; }
-
- void setQuitAfterRuns(BOOL quit_val) { mQuitAfterRuns = quit_val; }
- void setNumRuns(S32 num_runs) { mNumRuns = num_runs; }
-
+ enum EActionType
+ {
+ STRAIGHT,
+ TURN
+ };
+
+ LLAgentPilot();
+ virtual ~LLAgentPilot();
+
+ void load();
+ void loadTxt(const std::string& filename);
+ void loadXML(const std::string& filename);
+ void save();
+ void saveTxt(const std::string& filename);
+ void saveXML(const std::string& filename);
+
+ void startRecord();
+ void stopRecord();
+ void addAction(enum EActionType action);
+
+ void startPlayback();
+ void stopPlayback();
+
+ bool isRecording() { return mRecording; }
+ bool isPlaying() { return mPlaying; }
+ bool getOverrideCamera() { return mOverrideCamera; }
+
+ void updateTarget();
+
+ void addWaypoint();
+ void moveCamera();
+
+ void setReplaySession(BOOL new_val) { mReplaySession = new_val; }
+ BOOL getReplaySession() { return mReplaySession; }
+
+ void setLoop(BOOL new_val) { mLoop = new_val; }
+ BOOL getLoop() { return mLoop; }
+
+ void setQuitAfterRuns(BOOL quit_val) { mQuitAfterRuns = quit_val; }
+ void setNumRuns(S32 num_runs) { mNumRuns = num_runs; }
+
private:
- BOOL mLoop;
- BOOL mReplaySession;
+ BOOL mLoop;
+ BOOL mReplaySession;
- S32 mNumRuns;
- BOOL mQuitAfterRuns;
+ S32 mNumRuns;
+ BOOL mQuitAfterRuns;
- void setAutopilotTarget(const S32 id);
+ void setAutopilotTarget(const S32 id);
- BOOL mRecording;
- F32 mLastRecordTime;
+ BOOL mRecording;
+ F32 mLastRecordTime;
- BOOL mStarted;
- BOOL mPlaying;
- S32 mCurrentAction;
+ BOOL mStarted;
+ BOOL mPlaying;
+ S32 mCurrentAction;
- BOOL mOverrideCamera;
+ BOOL mOverrideCamera;
- class Action
- {
- public:
+ class Action
+ {
+ public:
- EActionType mType;
- LLVector3d mTarget;
- F64 mTime;
- F32 mCameraView;
- LLVector3 mCameraOrigin;
- LLVector3 mCameraXAxis;
- LLVector3 mCameraYAxis;
- LLVector3 mCameraZAxis;
- };
+ EActionType mType;
+ LLVector3d mTarget;
+ F64 mTime;
+ F32 mCameraView;
+ LLVector3 mCameraOrigin;
+ LLVector3 mCameraXAxis;
+ LLVector3 mCameraYAxis;
+ LLVector3 mCameraZAxis;
+ };
- std::vector<Action> mActions;
- LLTimer mTimer;
+ std::vector<Action> mActions;
+ LLTimer mTimer;
};
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index acb1a37ff5..6657ed9857 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentui.cpp
* @brief Utility methods to process agent's data as slurl's etc. before displaying
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,8 +42,8 @@
//static
void LLAgentUI::buildFullname(std::string& name)
{
- if (isAgentAvatarValid())
- name = gAgentAvatarp->getFullname();
+ if (isAgentAvatarValid())
+ name = gAgentAvatarp->getFullname();
}
//static
@@ -64,131 +64,131 @@ void LLAgentUI::buildSLURL(LLSLURL& slurl, const bool escaped /*= true*/)
return_slurl = LLSLURL(regionp->getName(), global_pos);
}
- slurl = return_slurl;
+ slurl = return_slurl;
}
//static
BOOL LLAgentUI::checkAgentDistance(const LLVector3& pole, F32 radius)
{
- F32 delta_x = gAgent.getPositionAgent().mV[VX] - pole.mV[VX];
- F32 delta_y = gAgent.getPositionAgent().mV[VY] - pole.mV[VY];
-
- return sqrt( delta_x* delta_x + delta_y* delta_y ) < radius;
+ F32 delta_x = gAgent.getPositionAgent().mV[VX] - pole.mV[VX];
+ F32 delta_y = gAgent.getPositionAgent().mV[VY] - pole.mV[VY];
+
+ return sqrt( delta_x* delta_x + delta_y* delta_y ) < radius;
}
BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region)
{
- LLViewerRegion* region = gAgent.getRegion();
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ LLViewerRegion* region = gAgent.getRegion();
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!region || !parcel) return FALSE;
+ if (!region || !parcel) return FALSE;
- S32 pos_x = S32(agent_pos_region.mV[VX] + 0.5f);
- S32 pos_y = S32(agent_pos_region.mV[VY] + 0.5f);
- S32 pos_z = S32(agent_pos_region.mV[VZ] + 0.5f);
+ S32 pos_x = S32(agent_pos_region.mV[VX] + 0.5f);
+ S32 pos_y = S32(agent_pos_region.mV[VY] + 0.5f);
+ S32 pos_z = S32(agent_pos_region.mV[VZ] + 0.5f);
- // Round the numbers based on the velocity
- F32 velocity_mag_sq = gAgent.getVelocity().magVecSquared();
+ // Round the numbers based on the velocity
+ F32 velocity_mag_sq = gAgent.getVelocity().magVecSquared();
- const F32 FLY_CUTOFF = 6.f; // meters/sec
- const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF;
- const F32 WALK_CUTOFF = 1.5f; // meters/sec
- const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF;
+ const F32 FLY_CUTOFF = 6.f; // meters/sec
+ const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF;
+ const F32 WALK_CUTOFF = 1.5f; // meters/sec
+ const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF;
- if (velocity_mag_sq > FLY_CUTOFF_SQ)
- {
- pos_x -= pos_x % 4;
- pos_y -= pos_y % 4;
- }
- else if (velocity_mag_sq > WALK_CUTOFF_SQ)
- {
- pos_x -= pos_x % 2;
- pos_y -= pos_y % 2;
- }
+ if (velocity_mag_sq > FLY_CUTOFF_SQ)
+ {
+ pos_x -= pos_x % 4;
+ pos_y -= pos_y % 4;
+ }
+ else if (velocity_mag_sq > WALK_CUTOFF_SQ)
+ {
+ pos_x -= pos_x % 2;
+ pos_y -= pos_y % 2;
+ }
- // create a default name and description for the landmark
- std::string parcel_name = LLViewerParcelMgr::getInstance()->getAgentParcelName();
- std::string region_name = region->getName();
- std::string sim_access_string = region->getSimAccessString();
- std::string buffer;
- if( parcel_name.empty() )
- {
- // the parcel doesn't have a name
- switch (fmt)
- {
- case LOCATION_FORMAT_LANDMARK:
- buffer = llformat("%.100s", region_name.c_str());
- break;
- case LOCATION_FORMAT_NORMAL:
- buffer = llformat("%s", region_name.c_str());
- break;
- case LOCATION_FORMAT_NORMAL_COORDS:
- buffer = llformat("%s (%d, %d, %d)",
- region_name.c_str(),
- pos_x, pos_y, pos_z);
- break;
- case LOCATION_FORMAT_NO_COORDS:
- buffer = llformat("%s%s%s",
- region_name.c_str(),
- sim_access_string.empty() ? "" : " - ",
- sim_access_string.c_str());
- break;
- case LOCATION_FORMAT_NO_MATURITY:
- buffer = llformat("%s (%d, %d, %d)",
- region_name.c_str(),
- pos_x, pos_y, pos_z);
- break;
- case LOCATION_FORMAT_FULL:
- buffer = llformat("%s (%d, %d, %d)%s%s",
- region_name.c_str(),
- pos_x, pos_y, pos_z,
- sim_access_string.empty() ? "" : " - ",
- sim_access_string.c_str());
- break;
- }
- }
- else
- {
- // the parcel has a name, so include it in the landmark name
- switch (fmt)
- {
- case LOCATION_FORMAT_LANDMARK:
- buffer = llformat("%.100s", parcel_name.c_str());
- break;
- case LOCATION_FORMAT_NORMAL:
- buffer = llformat("%s, %s", parcel_name.c_str(), region_name.c_str());
- break;
- case LOCATION_FORMAT_NORMAL_COORDS:
- buffer = llformat("%s (%d, %d, %d)",
- parcel_name.c_str(),
- pos_x, pos_y, pos_z);
- break;
- case LOCATION_FORMAT_NO_MATURITY:
- buffer = llformat("%s, %s (%d, %d, %d)",
- parcel_name.c_str(),
- region_name.c_str(),
- pos_x, pos_y, pos_z);
- break;
- case LOCATION_FORMAT_NO_COORDS:
- buffer = llformat("%s, %s%s%s",
- parcel_name.c_str(),
- region_name.c_str(),
- sim_access_string.empty() ? "" : " - ",
- sim_access_string.c_str());
- break;
- case LOCATION_FORMAT_FULL:
- buffer = llformat("%s, %s (%d, %d, %d)%s%s",
- parcel_name.c_str(),
- region_name.c_str(),
- pos_x, pos_y, pos_z,
- sim_access_string.empty() ? "" : " - ",
- sim_access_string.c_str());
- break;
- }
- }
- str = buffer;
- return TRUE;
+ // create a default name and description for the landmark
+ std::string parcel_name = LLViewerParcelMgr::getInstance()->getAgentParcelName();
+ std::string region_name = region->getName();
+ std::string sim_access_string = region->getSimAccessString();
+ std::string buffer;
+ if( parcel_name.empty() )
+ {
+ // the parcel doesn't have a name
+ switch (fmt)
+ {
+ case LOCATION_FORMAT_LANDMARK:
+ buffer = llformat("%.100s", region_name.c_str());
+ break;
+ case LOCATION_FORMAT_NORMAL:
+ buffer = llformat("%s", region_name.c_str());
+ break;
+ case LOCATION_FORMAT_NORMAL_COORDS:
+ buffer = llformat("%s (%d, %d, %d)",
+ region_name.c_str(),
+ pos_x, pos_y, pos_z);
+ break;
+ case LOCATION_FORMAT_NO_COORDS:
+ buffer = llformat("%s%s%s",
+ region_name.c_str(),
+ sim_access_string.empty() ? "" : " - ",
+ sim_access_string.c_str());
+ break;
+ case LOCATION_FORMAT_NO_MATURITY:
+ buffer = llformat("%s (%d, %d, %d)",
+ region_name.c_str(),
+ pos_x, pos_y, pos_z);
+ break;
+ case LOCATION_FORMAT_FULL:
+ buffer = llformat("%s (%d, %d, %d)%s%s",
+ region_name.c_str(),
+ pos_x, pos_y, pos_z,
+ sim_access_string.empty() ? "" : " - ",
+ sim_access_string.c_str());
+ break;
+ }
+ }
+ else
+ {
+ // the parcel has a name, so include it in the landmark name
+ switch (fmt)
+ {
+ case LOCATION_FORMAT_LANDMARK:
+ buffer = llformat("%.100s", parcel_name.c_str());
+ break;
+ case LOCATION_FORMAT_NORMAL:
+ buffer = llformat("%s, %s", parcel_name.c_str(), region_name.c_str());
+ break;
+ case LOCATION_FORMAT_NORMAL_COORDS:
+ buffer = llformat("%s (%d, %d, %d)",
+ parcel_name.c_str(),
+ pos_x, pos_y, pos_z);
+ break;
+ case LOCATION_FORMAT_NO_MATURITY:
+ buffer = llformat("%s, %s (%d, %d, %d)",
+ parcel_name.c_str(),
+ region_name.c_str(),
+ pos_x, pos_y, pos_z);
+ break;
+ case LOCATION_FORMAT_NO_COORDS:
+ buffer = llformat("%s, %s%s%s",
+ parcel_name.c_str(),
+ region_name.c_str(),
+ sim_access_string.empty() ? "" : " - ",
+ sim_access_string.c_str());
+ break;
+ case LOCATION_FORMAT_FULL:
+ buffer = llformat("%s, %s (%d, %d, %d)%s%s",
+ parcel_name.c_str(),
+ region_name.c_str(),
+ pos_x, pos_y, pos_z,
+ sim_access_string.empty() ? "" : " - ",
+ sim_access_string.c_str());
+ break;
+ }
+ }
+ str = buffer;
+ return TRUE;
}
BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt)
{
- return buildLocationString(str,fmt, gAgent.getPositionAgent());
+ return buildLocationString(str,fmt, gAgent.getPositionAgent());
}
diff --git a/indra/newview/llagentui.h b/indra/newview/llagentui.h
index bb48dad14c..cbf5a095db 100644
--- a/indra/newview/llagentui.h
+++ b/indra/newview/llagentui.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentui.h
* @brief Utility methods to process agent's data as slurl's etc. before displaying
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,28 +32,28 @@ class LLSLURL;
class LLAgentUI
{
public:
- enum ELocationFormat
- {
- LOCATION_FORMAT_NORMAL, // Parcel
- LOCATION_FORMAT_NORMAL_COORDS, // Parcel (x, y, z)
- LOCATION_FORMAT_LANDMARK, // Parcel, Region
- LOCATION_FORMAT_NO_MATURITY, // Parcel, Region (x, y, z)
- LOCATION_FORMAT_NO_COORDS, // Parcel, Region - Maturity
- LOCATION_FORMAT_FULL, // Parcel, Region (x, y, z) - Maturity
- };
+ enum ELocationFormat
+ {
+ LOCATION_FORMAT_NORMAL, // Parcel
+ LOCATION_FORMAT_NORMAL_COORDS, // Parcel (x, y, z)
+ LOCATION_FORMAT_LANDMARK, // Parcel, Region
+ LOCATION_FORMAT_NO_MATURITY, // Parcel, Region (x, y, z)
+ LOCATION_FORMAT_NO_COORDS, // Parcel, Region - Maturity
+ LOCATION_FORMAT_FULL, // Parcel, Region (x, y, z) - Maturity
+ };
- static void buildFullname(std::string &name);
+ static void buildFullname(std::string &name);
- static void buildSLURL(LLSLURL& slurl, const bool escaped = true);
- //build location string using the current position of gAgent.
- static BOOL buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK);
- //build location string using a region position of the avatar.
- static BOOL buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region);
- /**
- * @brief Check whether the agent is in neighborhood of the pole Within same region
- * @return true if the agent is in neighborhood.
- */
- static BOOL checkAgentDistance(const LLVector3& local_pole, F32 radius);
+ static void buildSLURL(LLSLURL& slurl, const bool escaped = true);
+ //build location string using the current position of gAgent.
+ static BOOL buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK);
+ //build location string using a region position of the avatar.
+ static BOOL buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region);
+ /**
+ * @brief Check whether the agent is in neighborhood of the pole Within same region
+ * @return true if the agent is in neighborhood.
+ */
+ static BOOL checkAgentDistance(const LLVector3& local_pole, F32 radius);
};
#endif //LLAGENTUI_H
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index db99f20775..d2046c0f83 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentwearables.cpp
* @brief LLAgentWearables class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -64,56 +64,56 @@ using namespace LLAvatarAppearanceDefines;
void set_default_permissions(LLViewerInventoryItem* item)
{
- llassert(item);
- LLPermissions perm = item->getPermissions();
- if (perm.getMaskNextOwner() != LLFloaterPerms::getNextOwnerPerms("Wearables")
- || perm.getMaskEveryone() != LLFloaterPerms::getEveryonePerms("Wearables")
- || perm.getMaskGroup() != LLFloaterPerms::getGroupPerms("Wearables"))
- {
- perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables"));
- perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables"));
- perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables"));
+ llassert(item);
+ LLPermissions perm = item->getPermissions();
+ if (perm.getMaskNextOwner() != LLFloaterPerms::getNextOwnerPerms("Wearables")
+ || perm.getMaskEveryone() != LLFloaterPerms::getEveryonePerms("Wearables")
+ || perm.getMaskGroup() != LLFloaterPerms::getGroupPerms("Wearables"))
+ {
+ perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables"));
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables"));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables"));
- item->setPermissions(perm);
+ item->setPermissions(perm);
- item->updateServer(FALSE);
- }
+ item->updateServer(FALSE);
+ }
}
// Callback to wear and start editing an item that has just been created.
void wear_and_edit_cb(const LLUUID& inv_item)
{
- if (inv_item.isNull()) return;
-
- LLViewerInventoryItem* item = gInventory.getItem(inv_item);
- if (!item) return;
+ if (inv_item.isNull()) return;
+
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (!item) return;
- set_default_permissions(item);
+ set_default_permissions(item);
- // item was just created, update even if permissions did not changed
- gInventory.updateItem(item);
- gInventory.notifyObservers();
+ // item was just created, update even if permissions did not changed
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
- // Request editing the item after it gets worn.
- gAgentWearables.requestEditingWearable(inv_item);
-
- // Wear it.
- LLAppearanceMgr::instance().wearItemOnAvatar(inv_item,true);
+ // Request editing the item after it gets worn.
+ gAgentWearables.requestEditingWearable(inv_item);
+
+ // Wear it.
+ LLAppearanceMgr::instance().wearItemOnAvatar(inv_item,true);
}
void wear_cb(const LLUUID& inv_item)
{
- if (!inv_item.isNull())
- {
- LLViewerInventoryItem* item = gInventory.getItem(inv_item);
- if (item)
- {
- set_default_permissions(item);
-
- gInventory.updateItem(item);
- gInventory.notifyObservers();
- }
- }
+ if (!inv_item.isNull())
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (item)
+ {
+ set_default_permissions(item);
+
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+ }
}
///////////////////////////////////////////////////////////////////////////////
@@ -125,83 +125,83 @@ void wear_cb(const LLUUID& inv_item)
// turns up in other inventories.
void checkWearableAgainstInventory(LLViewerWearable *wearable)
{
- if (wearable->getItemID().isNull())
- return;
-
- // Check for wearable type consistent with inventory item wearable type.
- LLViewerInventoryItem *item = gInventory.getItem(wearable->getItemID());
- if (item)
- {
- if (!item->isWearableType())
- {
- LL_WARNS() << "wearable associated with non-wearable item" << LL_ENDL;
- }
- if (item->getWearableType() != wearable->getType())
- {
- LL_WARNS() << "type mismatch: wearable " << wearable->getName()
- << " has type " << wearable->getType()
- << " but inventory item " << item->getName()
- << " has type " << item->getWearableType() << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS() << "wearable inventory item not found" << wearable->getName()
- << " itemID " << wearable->getItemID().asString() << LL_ENDL;
- }
+ if (wearable->getItemID().isNull())
+ return;
+
+ // Check for wearable type consistent with inventory item wearable type.
+ LLViewerInventoryItem *item = gInventory.getItem(wearable->getItemID());
+ if (item)
+ {
+ if (!item->isWearableType())
+ {
+ LL_WARNS() << "wearable associated with non-wearable item" << LL_ENDL;
+ }
+ if (item->getWearableType() != wearable->getType())
+ {
+ LL_WARNS() << "type mismatch: wearable " << wearable->getName()
+ << " has type " << wearable->getType()
+ << " but inventory item " << item->getName()
+ << " has type " << item->getWearableType() << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "wearable inventory item not found" << wearable->getName()
+ << " itemID " << wearable->getItemID().asString() << LL_ENDL;
+ }
}
void LLAgentWearables::dump()
{
- LL_INFOS() << "LLAgentWearablesDump" << LL_ENDL;
- for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
- {
- U32 count = getWearableCount((LLWearableType::EType)i);
- LL_INFOS() << "Type: " << i << " count " << count << LL_ENDL;
- for (U32 j=0; j<count; j++)
- {
- LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)i,j);
- if (wearable == NULL)
- {
- LL_INFOS() << " " << j << " NULL wearable" << LL_ENDL;
- }
- LL_INFOS() << " " << j << " Name " << wearable->getName()
- << " description " << wearable->getDescription() << LL_ENDL;
-
- }
- }
+ LL_INFOS() << "LLAgentWearablesDump" << LL_ENDL;
+ for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
+ {
+ U32 count = getWearableCount((LLWearableType::EType)i);
+ LL_INFOS() << "Type: " << i << " count " << count << LL_ENDL;
+ for (U32 j=0; j<count; j++)
+ {
+ LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)i,j);
+ if (wearable == NULL)
+ {
+ LL_INFOS() << " " << j << " NULL wearable" << LL_ENDL;
+ }
+ LL_INFOS() << " " << j << " Name " << wearable->getName()
+ << " description " << wearable->getDescription() << LL_ENDL;
+
+ }
+ }
}
struct LLAgentDumper
{
- LLAgentDumper(std::string name):
- mName(name)
- {
- LL_INFOS() << LL_ENDL;
- LL_INFOS() << "LLAgentDumper " << mName << LL_ENDL;
- gAgentWearables.dump();
- }
-
- ~LLAgentDumper()
- {
- LL_INFOS() << LL_ENDL;
- LL_INFOS() << "~LLAgentDumper " << mName << LL_ENDL;
- gAgentWearables.dump();
- }
-
- std::string mName;
+ LLAgentDumper(std::string name):
+ mName(name)
+ {
+ LL_INFOS() << LL_ENDL;
+ LL_INFOS() << "LLAgentDumper " << mName << LL_ENDL;
+ gAgentWearables.dump();
+ }
+
+ ~LLAgentDumper()
+ {
+ LL_INFOS() << LL_ENDL;
+ LL_INFOS() << "~LLAgentDumper " << mName << LL_ENDL;
+ gAgentWearables.dump();
+ }
+
+ std::string mName;
};
LLAgentWearables::LLAgentWearables() :
- LLWearableData(),
- mWearablesLoaded(FALSE)
-, mCOFChangeInProgress(false)
+ LLWearableData(),
+ mWearablesLoaded(FALSE)
+, mCOFChangeInProgress(false)
{
}
LLAgentWearables::~LLAgentWearables()
{
- cleanup();
+ cleanup();
}
void LLAgentWearables::cleanup()
@@ -211,15 +211,15 @@ void LLAgentWearables::cleanup()
// static
void LLAgentWearables::initClass()
{
- // this can not be called from constructor because its instance is global and is created too early.
- // Subscribe to "COF is Saved" signal to notify observers about this (Loading indicator for ex.).
- LLOutfitObserver::instance().addCOFSavedCallback(boost::bind(&LLAgentWearables::notifyLoadingFinished, &gAgentWearables));
+ // this can not be called from constructor because its instance is global and is created too early.
+ // Subscribe to "COF is Saved" signal to notify observers about this (Loading indicator for ex.).
+ LLOutfitObserver::instance().addCOFSavedCallback(boost::bind(&LLAgentWearables::notifyLoadingFinished, &gAgentWearables));
}
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
{
- llassert(avatar);
- setAvatarAppearance(avatar);
+ llassert(avatar);
+ setAvatarAppearance(avatar);
}
/**
@@ -233,300 +233,300 @@ void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
* @param todo Bitmask of actions to take on completion.
*/
LLAgentWearables::AddWearableToAgentInventoryCallback::AddWearableToAgentInventoryCallback(
- LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo, const std::string description) :
- mType(type),
- mIndex(index),
- mWearable(wearable),
- mTodo(todo),
- mCB(cb),
- mDescription(description)
+ LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo, const std::string description) :
+ mType(type),
+ mIndex(index),
+ mWearable(wearable),
+ mTodo(todo),
+ mCB(cb),
+ mDescription(description)
{
- LL_INFOS() << "constructor" << LL_ENDL;
+ LL_INFOS() << "constructor" << LL_ENDL;
}
void LLAgentWearables::AddWearableToAgentInventoryCallback::fire(const LLUUID& inv_item)
{
- if (inv_item.isNull())
- return;
+ if (inv_item.isNull())
+ return;
- gAgentWearables.addWearabletoAgentInventoryDone(mType, mIndex, inv_item, mWearable);
+ gAgentWearables.addWearabletoAgentInventoryDone(mType, mIndex, inv_item, mWearable);
- /*
- * Do this for every one in the loop
- */
- if (mTodo & CALL_MAKENEWOUTFITDONE)
- {
- gAgentWearables.makeNewOutfitDone(mType, mIndex);
- }
- if (mTodo & CALL_WEARITEM)
- {
- LLAppearanceMgr::instance().addCOFItemLink(inv_item,
- new LLUpdateAppearanceAndEditWearableOnDestroy(inv_item), mDescription);
- editWearable(inv_item);
- }
+ /*
+ * Do this for every one in the loop
+ */
+ if (mTodo & CALL_MAKENEWOUTFITDONE)
+ {
+ gAgentWearables.makeNewOutfitDone(mType, mIndex);
+ }
+ if (mTodo & CALL_WEARITEM)
+ {
+ LLAppearanceMgr::instance().addCOFItemLink(inv_item,
+ new LLUpdateAppearanceAndEditWearableOnDestroy(inv_item), mDescription);
+ editWearable(inv_item);
+ }
}
void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::EType type,
- const U32 index,
- const LLUUID& item_id,
- LLViewerWearable* wearable)
-{
- LL_INFOS() << "type " << type << " index " << index << " item " << item_id.asString() << LL_ENDL;
-
- if (item_id.isNull())
- return;
-
- LLUUID old_item_id = getWearableItemID(type,index);
-
- if (wearable)
- {
- wearable->setItemID(item_id);
-
- if (old_item_id.notNull())
- {
- gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
- setWearable(type,index,wearable);
- }
- else
- {
- pushWearable(type,wearable);
- }
- }
-
- gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
-
- LLViewerInventoryItem* item = gInventory.getItem(item_id);
- if (item && wearable)
- {
- // We're changing the asset id, so we both need to set it
- // locally via setAssetUUID() and via setTransactionID() which
- // will be decoded on the server. JC
- item->setAssetUUID(wearable->getAssetID());
- item->setTransactionID(wearable->getTransactionID());
- gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id);
- item->updateServer(FALSE);
- }
- gInventory.notifyObservers();
+ const U32 index,
+ const LLUUID& item_id,
+ LLViewerWearable* wearable)
+{
+ LL_INFOS() << "type " << type << " index " << index << " item " << item_id.asString() << LL_ENDL;
+
+ if (item_id.isNull())
+ return;
+
+ LLUUID old_item_id = getWearableItemID(type,index);
+
+ if (wearable)
+ {
+ wearable->setItemID(item_id);
+
+ if (old_item_id.notNull())
+ {
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
+ setWearable(type,index,wearable);
+ }
+ else
+ {
+ pushWearable(type,wearable);
+ }
+ }
+
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+
+ LLViewerInventoryItem* item = gInventory.getItem(item_id);
+ if (item && wearable)
+ {
+ // We're changing the asset id, so we both need to set it
+ // locally via setAssetUUID() and via setTransactionID() which
+ // will be decoded on the server. JC
+ item->setAssetUUID(wearable->getAssetID());
+ item->setTransactionID(wearable->getTransactionID());
+ gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id);
+ item->updateServer(FALSE);
+ }
+ gInventory.notifyObservers();
}
void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index,
- const std::string new_name)
-{
- LLViewerWearable* old_wearable = getViewerWearable(type, index);
- if(!old_wearable) return;
- bool name_changed = !new_name.empty() && (new_name != old_wearable->getName());
- if (name_changed || old_wearable->isDirty() || old_wearable->isOldVersion())
- {
- LLUUID old_item_id = old_wearable->getItemID();
- LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
- new_wearable->setItemID(old_item_id); // should this be in LLViewerWearable::copyDataFrom()?
- setWearable(type,index,new_wearable);
-
- // old_wearable may still be referred to by other inventory items. Revert
- // unsaved changes so other inventory items aren't affected by the changes
- // that were just saved.
- old_wearable->revertValues();
-
- LLInventoryItem* item = gInventory.getItem(old_item_id);
- if (item)
- {
- std::string item_name = item->getName();
- if (name_changed)
- {
- LL_INFOS() << "saveWearable changing name from " << item->getName() << " to " << new_name << LL_ENDL;
- item_name = new_name;
- }
- // Update existing inventory item
- LLPointer<LLViewerInventoryItem> template_item =
- new LLViewerInventoryItem(item->getUUID(),
- item->getParentUUID(),
- item->getPermissions(),
- new_wearable->getAssetID(),
- new_wearable->getAssetType(),
- item->getInventoryType(),
- item_name,
- item->getDescription(),
- item->getSaleInfo(),
- item->getFlags(),
- item->getCreationDate());
- template_item->setTransactionID(new_wearable->getTransactionID());
- update_inventory_item(template_item, gAgentAvatarp->mEndCustomizeCallback);
- }
- else
- {
- // Add a new inventory item (shouldn't ever happen here)
- U32 todo = AddWearableToAgentInventoryCallback::CALL_NONE;
- LLPointer<LLInventoryCallback> cb =
- new AddWearableToAgentInventoryCallback(
- LLPointer<LLRefCount>(NULL),
- type,
- index,
- new_wearable,
- todo);
- addWearableToAgentInventory(cb, new_wearable);
- return;
- }
-
- gAgentAvatarp->wearableUpdated(type);
- }
+ const std::string new_name)
+{
+ LLViewerWearable* old_wearable = getViewerWearable(type, index);
+ if(!old_wearable) return;
+ bool name_changed = !new_name.empty() && (new_name != old_wearable->getName());
+ if (name_changed || old_wearable->isDirty() || old_wearable->isOldVersion())
+ {
+ LLUUID old_item_id = old_wearable->getItemID();
+ LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
+ new_wearable->setItemID(old_item_id); // should this be in LLViewerWearable::copyDataFrom()?
+ setWearable(type,index,new_wearable);
+
+ // old_wearable may still be referred to by other inventory items. Revert
+ // unsaved changes so other inventory items aren't affected by the changes
+ // that were just saved.
+ old_wearable->revertValues();
+
+ LLInventoryItem* item = gInventory.getItem(old_item_id);
+ if (item)
+ {
+ std::string item_name = item->getName();
+ if (name_changed)
+ {
+ LL_INFOS() << "saveWearable changing name from " << item->getName() << " to " << new_name << LL_ENDL;
+ item_name = new_name;
+ }
+ // Update existing inventory item
+ LLPointer<LLViewerInventoryItem> template_item =
+ new LLViewerInventoryItem(item->getUUID(),
+ item->getParentUUID(),
+ item->getPermissions(),
+ new_wearable->getAssetID(),
+ new_wearable->getAssetType(),
+ item->getInventoryType(),
+ item_name,
+ item->getDescription(),
+ item->getSaleInfo(),
+ item->getFlags(),
+ item->getCreationDate());
+ template_item->setTransactionID(new_wearable->getTransactionID());
+ update_inventory_item(template_item, gAgentAvatarp->mEndCustomizeCallback);
+ }
+ else
+ {
+ // Add a new inventory item (shouldn't ever happen here)
+ U32 todo = AddWearableToAgentInventoryCallback::CALL_NONE;
+ LLPointer<LLInventoryCallback> cb =
+ new AddWearableToAgentInventoryCallback(
+ LLPointer<LLRefCount>(NULL),
+ type,
+ index,
+ new_wearable,
+ todo);
+ addWearableToAgentInventory(cb, new_wearable);
+ return;
+ }
+
+ gAgentAvatarp->wearableUpdated(type);
+ }
}
void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
- const U32 index,
- const std::string& new_name,
- const std::string& description,
- BOOL save_in_lost_and_found)
-{
- if (!isWearableCopyable(type, index))
- {
- LL_WARNS() << "LLAgent::saveWearableAs() not copyable." << LL_ENDL;
- return;
- }
- LLViewerWearable* old_wearable = getViewerWearable(type, index);
- if (!old_wearable)
- {
- LL_WARNS() << "LLAgent::saveWearableAs() no old wearable." << LL_ENDL;
- return;
- }
-
- LLInventoryItem* item = gInventory.getItem(getWearableItemID(type,index));
- if (!item)
- {
- LL_WARNS() << "LLAgent::saveWearableAs() no inventory item." << LL_ENDL;
- return;
- }
- std::string trunc_name(new_name);
- LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN);
- LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(
- old_wearable,
- trunc_name);
-
- LLPointer<LLInventoryCallback> cb =
- new AddWearableToAgentInventoryCallback(
- LLPointer<LLRefCount>(NULL),
- type,
- index,
- new_wearable,
- AddWearableToAgentInventoryCallback::CALL_WEARITEM,
- description
- );
- LLUUID category_id;
- if (save_in_lost_and_found)
- {
- category_id = gInventory.findCategoryUUIDForType(
- LLFolderType::FT_LOST_AND_FOUND);
- }
- else
- {
- // put in same folder as original
- category_id = item->getParentUUID();
- }
-
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- category_id,
- new_name,
- cb);
-
- // old_wearable may still be referred to by other inventory items. Revert
- // unsaved changes so other inventory items aren't affected by the changes
- // that were just saved.
- old_wearable->revertValuesWithoutUpdate();
+ const U32 index,
+ const std::string& new_name,
+ const std::string& description,
+ BOOL save_in_lost_and_found)
+{
+ if (!isWearableCopyable(type, index))
+ {
+ LL_WARNS() << "LLAgent::saveWearableAs() not copyable." << LL_ENDL;
+ return;
+ }
+ LLViewerWearable* old_wearable = getViewerWearable(type, index);
+ if (!old_wearable)
+ {
+ LL_WARNS() << "LLAgent::saveWearableAs() no old wearable." << LL_ENDL;
+ return;
+ }
+
+ LLInventoryItem* item = gInventory.getItem(getWearableItemID(type,index));
+ if (!item)
+ {
+ LL_WARNS() << "LLAgent::saveWearableAs() no inventory item." << LL_ENDL;
+ return;
+ }
+ std::string trunc_name(new_name);
+ LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN);
+ LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(
+ old_wearable,
+ trunc_name);
+
+ LLPointer<LLInventoryCallback> cb =
+ new AddWearableToAgentInventoryCallback(
+ LLPointer<LLRefCount>(NULL),
+ type,
+ index,
+ new_wearable,
+ AddWearableToAgentInventoryCallback::CALL_WEARITEM,
+ description
+ );
+ LLUUID category_id;
+ if (save_in_lost_and_found)
+ {
+ category_id = gInventory.findCategoryUUIDForType(
+ LLFolderType::FT_LOST_AND_FOUND);
+ }
+ else
+ {
+ // put in same folder as original
+ category_id = item->getParentUUID();
+ }
+
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ category_id,
+ new_name,
+ cb);
+
+ // old_wearable may still be referred to by other inventory items. Revert
+ // unsaved changes so other inventory items aren't affected by the changes
+ // that were just saved.
+ old_wearable->revertValuesWithoutUpdate();
}
void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
{
- LLViewerWearable* wearable = getViewerWearable(type, index);
- llassert(wearable);
- if (wearable)
- {
- wearable->revertValues();
- }
+ LLViewerWearable* wearable = getViewerWearable(type, index);
+ llassert(wearable);
+ if (wearable)
+ {
+ wearable->revertValues();
+ }
}
void LLAgentWearables::saveAllWearables()
{
- //if (!gInventory.isLoaded())
- //{
- // return;
- //}
+ //if (!gInventory.isLoaded())
+ //{
+ // return;
+ //}
- for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
- {
- for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
- saveWearable((LLWearableType::EType)i, j);
- }
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+ {
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+ saveWearable((LLWearableType::EType)i, j);
+ }
}
// Called when the user changes the name of a wearable inventory item that is currently being worn.
void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& new_name)
{
- for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
- {
- for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
- {
- LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
- if (curr_item_id == item_id)
- {
- LLViewerWearable* old_wearable = getViewerWearable((LLWearableType::EType)i,j);
- llassert(old_wearable);
- if (!old_wearable) continue;
-
- std::string old_name = old_wearable->getName();
- old_wearable->setName(new_name);
- LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
- new_wearable->setItemID(item_id);
- LLInventoryItem* item = gInventory.getItem(item_id);
- if (item)
- {
- new_wearable->setPermissions(item->getPermissions());
- }
- old_wearable->setName(old_name);
-
- setWearable((LLWearableType::EType)i,j,new_wearable);
- break;
- }
- }
- }
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+ {
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+ {
+ LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
+ if (curr_item_id == item_id)
+ {
+ LLViewerWearable* old_wearable = getViewerWearable((LLWearableType::EType)i,j);
+ llassert(old_wearable);
+ if (!old_wearable) continue;
+
+ std::string old_name = old_wearable->getName();
+ old_wearable->setName(new_name);
+ LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
+ new_wearable->setItemID(item_id);
+ LLInventoryItem* item = gInventory.getItem(item_id);
+ if (item)
+ {
+ new_wearable->setPermissions(item->getPermissions());
+ }
+ old_wearable->setName(old_name);
+
+ setWearable((LLWearableType::EType)i,j,new_wearable);
+ break;
+ }
+ }
+ }
}
BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const
{
- LLUUID item_id = getWearableItemID(type, index);
- return item_id.notNull() ? isWearableModifiable(item_id) : FALSE;
+ LLUUID item_id = getWearableItemID(type, index);
+ return item_id.notNull() ? isWearableModifiable(item_id) : FALSE;
}
BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const
{
- const LLUUID& linked_id = gInventory.getLinkedItemID(item_id);
- if (linked_id.notNull())
- {
- LLInventoryItem* item = gInventory.getItem(linked_id);
- if (item && item->getPermissions().allowModifyBy(gAgent.getID(),
- gAgent.getGroupID()))
- {
- return TRUE;
- }
- }
- return FALSE;
+ const LLUUID& linked_id = gInventory.getLinkedItemID(item_id);
+ if (linked_id.notNull())
+ {
+ LLInventoryItem* item = gInventory.getItem(linked_id);
+ if (item && item->getPermissions().allowModifyBy(gAgent.getID(),
+ gAgent.getGroupID()))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const
{
- LLUUID item_id = getWearableItemID(type, index);
- if (!item_id.isNull())
- {
- LLInventoryItem* item = gInventory.getItem(item_id);
- if (item && item->getPermissions().allowCopyBy(gAgent.getID(),
- gAgent.getGroupID()))
- {
- return TRUE;
- }
- }
- return FALSE;
+ LLUUID item_id = getWearableItemID(type, index);
+ if (!item_id.isNull())
+ {
+ LLInventoryItem* item = gInventory.getItem(item_id);
+ if (item && item->getPermissions().allowCopyBy(gAgent.getID(),
+ gAgent.getGroupID()))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
/*
@@ -547,270 +547,270 @@ BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index)
LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type, U32 index)
{
- LLUUID item_id = getWearableItemID(type,index);
- LLInventoryItem* item = NULL;
- if (item_id.notNull())
- {
- item = gInventory.getItem(item_id);
- }
- return item;
+ LLUUID item_id = getWearableItemID(type,index);
+ LLInventoryItem* item = NULL;
+ if (item_id.notNull())
+ {
+ item = gInventory.getItem(item_id);
+ }
+ return item;
}
const LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
- for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
- {
- for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
- {
- const LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
- if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
- {
- return curr_wearable;
- }
- }
- }
- return NULL;
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+ {
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+ {
+ const LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
+ if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
+ {
+ return curr_wearable;
+ }
+ }
+ }
+ return NULL;
}
LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
- for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
- {
- for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
- {
- LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
- if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
- {
- return curr_wearable;
- }
- }
- }
- return NULL;
-}
-
-LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
-{
- for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
- {
- for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
- {
- LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
- if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
- {
- return curr_wearable;
- }
- }
- }
- return NULL;
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+ {
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+ {
+ LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
+ if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
+ {
+ return curr_wearable;
+ }
+ }
+ }
+ return NULL;
+}
+
+LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
+{
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+ {
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+ {
+ LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
+ if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
+ {
+ return curr_wearable;
+ }
+ }
+ }
+ return NULL;
}
LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/)
{
- return dynamic_cast<LLViewerWearable*> (getWearable(type, index));
+ return dynamic_cast<LLViewerWearable*> (getWearable(type, index));
}
const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const
{
- return dynamic_cast<const LLViewerWearable*> (getWearable(type, index));
+ return dynamic_cast<const LLViewerWearable*> (getWearable(type, index));
}
// static
BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
{
- return (gAgentWearables.getWearableCount(type) > 0);
+ return (gAgentWearables.getWearableCount(type) > 0);
}
// virtual
void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed)
{
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->wearableUpdated(wearable->getType());
- }
-
- LLWearableData::wearableUpdated(wearable, removed);
-
- if (!removed)
- {
- LLViewerWearable* viewer_wearable = dynamic_cast<LLViewerWearable*>(wearable);
- viewer_wearable->refreshName();
-
- // Hack pt 2. If the wearable we just loaded has definition version 24,
- // then force a re-save of this wearable after slamming the version number to 22.
- // This number was incorrectly incremented for internal builds before release, and
- // this fix will ensure that the affected wearables are re-saved with the right version number.
- // the versions themselves are compatible. This code can be removed before release.
- if( wearable->getDefinitionVersion() == 24 )
- {
- U32 index;
- if (getWearableIndex(wearable,index))
- {
- LL_INFOS() << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << LL_ENDL;
- wearable->setDefinitionVersion(22);
- saveWearable(wearable->getType(),index);
- }
- }
-
- checkWearableAgainstInventory(viewer_wearable);
- }
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->wearableUpdated(wearable->getType());
+ }
+
+ LLWearableData::wearableUpdated(wearable, removed);
+
+ if (!removed)
+ {
+ LLViewerWearable* viewer_wearable = dynamic_cast<LLViewerWearable*>(wearable);
+ viewer_wearable->refreshName();
+
+ // Hack pt 2. If the wearable we just loaded has definition version 24,
+ // then force a re-save of this wearable after slamming the version number to 22.
+ // This number was incorrectly incremented for internal builds before release, and
+ // this fix will ensure that the affected wearables are re-saved with the right version number.
+ // the versions themselves are compatible. This code can be removed before release.
+ if( wearable->getDefinitionVersion() == 24 )
+ {
+ U32 index;
+ if (getWearableIndex(wearable,index))
+ {
+ LL_INFOS() << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << LL_ENDL;
+ wearable->setDefinitionVersion(22);
+ saveWearable(wearable->getType(),index);
+ }
+ }
+
+ checkWearableAgainstInventory(viewer_wearable);
+ }
}
const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
{
- const LLViewerWearable *wearable = getViewerWearable(type,index);
- if (wearable)
- return wearable->getItemID();
- else
- return LLUUID();
+ const LLViewerWearable *wearable = getViewerWearable(type,index);
+ if (wearable)
+ return wearable->getItemID();
+ else
+ return LLUUID();
}
const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
{
- const LLViewerWearable *wearable = getViewerWearable(type,index);
- if (wearable)
- return wearable->getAssetID();
- else
- return LLUUID();
+ const LLViewerWearable *wearable = getViewerWearable(type,index);
+ if (wearable)
+ return wearable->getAssetID();
+ else
+ return LLUUID();
}
BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id) const
{
- return getWearableFromItemID(item_id) != NULL;
+ return getWearableFromItemID(item_id) != NULL;
}
void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index)
{
- LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)wearable_type, wearable_index);
- if (!wearable)
- {
- LL_ERRS() << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << LL_ENDL;
- return;
- }
- LLLocalTextureObject lto;
- wearable->setLocalTextureObject(texture_type, lto);
+ LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)wearable_type, wearable_index);
+ if (!wearable)
+ {
+ LL_ERRS() << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << LL_ENDL;
+ return;
+ }
+ LLLocalTextureObject lto;
+ wearable->setLocalTextureObject(texture_type, lto);
}
class OnWearableItemCreatedCB: public LLInventoryCallback
{
public:
- OnWearableItemCreatedCB():
- mWearablesAwaitingItems(LLWearableType::WT_COUNT,NULL)
- {
- LL_INFOS() << "created callback" << LL_ENDL;
- }
- /* virtual */ void fire(const LLUUID& inv_item)
- {
- LL_INFOS() << "One item created " << inv_item.asString() << LL_ENDL;
- LLConstPointer<LLInventoryObject> item = gInventory.getItem(inv_item);
- mItemsToLink.push_back(item);
- updatePendingWearable(inv_item);
- }
- ~OnWearableItemCreatedCB()
- {
- LL_INFOS() << "All items created" << LL_ENDL;
- LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
- link_inventory_array(LLAppearanceMgr::instance().getCOF(),
- mItemsToLink,
- link_waiter);
- }
- void addPendingWearable(LLViewerWearable *wearable)
- {
- if (!wearable)
- {
- LL_WARNS() << "no wearable" << LL_ENDL;
- return;
- }
- LLWearableType::EType type = wearable->getType();
- if (type<LLWearableType::WT_COUNT)
- {
- mWearablesAwaitingItems[type] = wearable;
- }
- else
- {
- LL_WARNS() << "invalid type " << type << LL_ENDL;
- }
- }
- void updatePendingWearable(const LLUUID& inv_item)
- {
- LLViewerInventoryItem *item = gInventory.getItem(inv_item);
- if (!item)
- {
- LL_WARNS() << "no item found" << LL_ENDL;
- return;
- }
- if (!item->isWearableType())
- {
- LL_WARNS() << "non-wearable item found" << LL_ENDL;
- return;
- }
- if (item && item->isWearableType())
- {
- LLWearableType::EType type = item->getWearableType();
- if (type < LLWearableType::WT_COUNT)
- {
- LLViewerWearable *wearable = mWearablesAwaitingItems[type];
- if (wearable)
- wearable->setItemID(inv_item);
- }
- else
- {
- LL_WARNS() << "invalid wearable type " << type << LL_ENDL;
- }
- }
- }
-
+ OnWearableItemCreatedCB():
+ mWearablesAwaitingItems(LLWearableType::WT_COUNT,NULL)
+ {
+ LL_INFOS() << "created callback" << LL_ENDL;
+ }
+ /* virtual */ void fire(const LLUUID& inv_item)
+ {
+ LL_INFOS() << "One item created " << inv_item.asString() << LL_ENDL;
+ LLConstPointer<LLInventoryObject> item = gInventory.getItem(inv_item);
+ mItemsToLink.push_back(item);
+ updatePendingWearable(inv_item);
+ }
+ ~OnWearableItemCreatedCB()
+ {
+ LL_INFOS() << "All items created" << LL_ENDL;
+ LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
+ link_inventory_array(LLAppearanceMgr::instance().getCOF(),
+ mItemsToLink,
+ link_waiter);
+ }
+ void addPendingWearable(LLViewerWearable *wearable)
+ {
+ if (!wearable)
+ {
+ LL_WARNS() << "no wearable" << LL_ENDL;
+ return;
+ }
+ LLWearableType::EType type = wearable->getType();
+ if (type<LLWearableType::WT_COUNT)
+ {
+ mWearablesAwaitingItems[type] = wearable;
+ }
+ else
+ {
+ LL_WARNS() << "invalid type " << type << LL_ENDL;
+ }
+ }
+ void updatePendingWearable(const LLUUID& inv_item)
+ {
+ LLViewerInventoryItem *item = gInventory.getItem(inv_item);
+ if (!item)
+ {
+ LL_WARNS() << "no item found" << LL_ENDL;
+ return;
+ }
+ if (!item->isWearableType())
+ {
+ LL_WARNS() << "non-wearable item found" << LL_ENDL;
+ return;
+ }
+ if (item && item->isWearableType())
+ {
+ LLWearableType::EType type = item->getWearableType();
+ if (type < LLWearableType::WT_COUNT)
+ {
+ LLViewerWearable *wearable = mWearablesAwaitingItems[type];
+ if (wearable)
+ wearable->setItemID(inv_item);
+ }
+ else
+ {
+ LL_WARNS() << "invalid wearable type " << type << LL_ENDL;
+ }
+ }
+ }
+
private:
- LLInventoryObject::const_object_list_t mItemsToLink;
- std::vector<LLViewerWearable*> mWearablesAwaitingItems;
+ LLInventoryObject::const_object_list_t mItemsToLink;
+ std::vector<LLViewerWearable*> mWearablesAwaitingItems;
};
void LLAgentWearables::createStandardWearables()
{
- LL_WARNS() << "Creating standard wearables" << LL_ENDL;
-
- if (!isAgentAvatarValid()) return;
-
- const BOOL create[LLWearableType::WT_COUNT] =
- {
- TRUE, //LLWearableType::WT_SHAPE
- TRUE, //LLWearableType::WT_SKIN
- TRUE, //LLWearableType::WT_HAIR
- TRUE, //LLWearableType::WT_EYES
- TRUE, //LLWearableType::WT_SHIRT
- TRUE, //LLWearableType::WT_PANTS
- TRUE, //LLWearableType::WT_SHOES
- TRUE, //LLWearableType::WT_SOCKS
- FALSE, //LLWearableType::WT_JACKET
- FALSE, //LLWearableType::WT_GLOVES
- TRUE, //LLWearableType::WT_UNDERSHIRT
- TRUE, //LLWearableType::WT_UNDERPANTS
- FALSE //LLWearableType::WT_SKIRT
- };
-
- LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB;
- for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
- {
- if (create[i])
- {
- llassert(getWearableCount((LLWearableType::EType)i) == 0);
- LLViewerWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i, gAgentAvatarp);
- ((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable);
- // no need to update here...
- LLUUID category_id = LLUUID::null;
+ LL_WARNS() << "Creating standard wearables" << LL_ENDL;
+
+ if (!isAgentAvatarValid()) return;
+
+ const BOOL create[LLWearableType::WT_COUNT] =
+ {
+ TRUE, //LLWearableType::WT_SHAPE
+ TRUE, //LLWearableType::WT_SKIN
+ TRUE, //LLWearableType::WT_HAIR
+ TRUE, //LLWearableType::WT_EYES
+ TRUE, //LLWearableType::WT_SHIRT
+ TRUE, //LLWearableType::WT_PANTS
+ TRUE, //LLWearableType::WT_SHOES
+ TRUE, //LLWearableType::WT_SOCKS
+ FALSE, //LLWearableType::WT_JACKET
+ FALSE, //LLWearableType::WT_GLOVES
+ TRUE, //LLWearableType::WT_UNDERSHIRT
+ TRUE, //LLWearableType::WT_UNDERPANTS
+ FALSE //LLWearableType::WT_SKIRT
+ };
+
+ LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB;
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
+ {
+ if (create[i])
+ {
+ llassert(getWearableCount((LLWearableType::EType)i) == 0);
+ LLViewerWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i, gAgentAvatarp);
+ ((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable);
+ // no need to update here...
+ LLUUID category_id = LLUUID::null;
create_inventory_wearable(gAgent.getID(),
- gAgent.getSessionID(),
- category_id,
- wearable->getTransactionID(),
- wearable->getName(),
- wearable->getDescription(),
- wearable->getAssetType(),
- wearable->getType(),
- wearable->getPermissions().getMaskNextOwner(),
- cb);
- }
- }
+ gAgent.getSessionID(),
+ category_id,
+ wearable->getTransactionID(),
+ wearable->getName(),
+ wearable->getDescription(),
+ wearable->getAssetType(),
+ wearable->getType(),
+ wearable->getPermissions().getMaskNextOwner(),
+ cb);
+ }
+ }
}
// We no longer need this message in the current viewer, but send
@@ -818,622 +818,622 @@ void LLAgentWearables::createStandardWearables()
// remove this function once the SH-3455 changesets are universally deployed.
void LLAgentWearables::sendDummyAgentWearablesUpdate()
{
- LL_DEBUGS("Avatar") << "sendAgentWearablesUpdate()" << LL_ENDL;
+ LL_DEBUGS("Avatar") << "sendAgentWearablesUpdate()" << LL_ENDL;
+
+ // Send the AgentIsNowWearing
+ gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing);
- // Send the AgentIsNowWearing
- gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing);
-
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- // Send 4 standardized nonsense item ids (same as returned by the modified sim, not that it especially matters).
- gMessageSystem->nextBlockFast(_PREHASH_WearableData);
- gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(1));
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("db5a4e5f-9da3-44c8-992d-1181c5795498"));
+ // Send 4 standardized nonsense item ids (same as returned by the modified sim, not that it especially matters).
+ gMessageSystem->nextBlockFast(_PREHASH_WearableData);
+ gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(1));
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("db5a4e5f-9da3-44c8-992d-1181c5795498"));
- gMessageSystem->nextBlockFast(_PREHASH_WearableData);
- gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(2));
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("6969c7cc-f72f-4a76-a19b-c293cce8ce4f"));
+ gMessageSystem->nextBlockFast(_PREHASH_WearableData);
+ gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(2));
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("6969c7cc-f72f-4a76-a19b-c293cce8ce4f"));
- gMessageSystem->nextBlockFast(_PREHASH_WearableData);
- gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(3));
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("7999702b-b291-48f9-8903-c91dfb828408"));
+ gMessageSystem->nextBlockFast(_PREHASH_WearableData);
+ gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(3));
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("7999702b-b291-48f9-8903-c91dfb828408"));
- gMessageSystem->nextBlockFast(_PREHASH_WearableData);
- gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(4));
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("566cb59e-ef60-41d7-bfa6-e0f293fbea40"));
+ gMessageSystem->nextBlockFast(_PREHASH_WearableData);
+ gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(4));
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("566cb59e-ef60-41d7-bfa6-e0f293fbea40"));
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
}
void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
{
- LLUUID first_item_id = getWearableItemID((LLWearableType::EType)type, index);
- // Open the inventory and select the first item we added.
- if (first_item_id.notNull())
- {
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
- if (active_panel)
- {
- active_panel->setSelection(first_item_id, TAKE_FOCUS_NO);
- }
- }
+ LLUUID first_item_id = getWearableItemID((LLWearableType::EType)type, index);
+ // Open the inventory and select the first item we added.
+ if (first_item_id.notNull())
+ {
+ LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
+ if (active_panel)
+ {
+ active_panel->setSelection(first_item_id, TAKE_FOCUS_NO);
+ }
+ }
}
void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
- LLViewerWearable* wearable,
- const LLUUID& category_id,
- BOOL notify)
+ LLViewerWearable* wearable,
+ const LLUUID& category_id,
+ BOOL notify)
{
create_inventory_wearable(gAgent.getID(),
- gAgent.getSessionID(),
- category_id,
- wearable->getTransactionID(),
- wearable->getName(),
- wearable->getDescription(),
- wearable->getAssetType(),
- wearable->getType(),
- wearable->getPermissions().getMaskNextOwner(),
- cb);
+ gAgent.getSessionID(),
+ category_id,
+ wearable->getTransactionID(),
+ wearable->getName(),
+ wearable->getDescription(),
+ wearable->getAssetType(),
+ wearable->getType(),
+ wearable->getPermissions().getMaskNextOwner(),
+ cb);
}
void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_remove_all, U32 index)
{
- if (getWearableCount(type) == 0)
- {
- // no wearables to remove
- return;
- }
-
- if (do_remove_all)
- {
- removeWearableFinal(type, do_remove_all, index);
- }
- else
- {
- LLViewerWearable* old_wearable = getViewerWearable(type,index);
-
- if (old_wearable)
- {
- if (old_wearable->isDirty())
- {
- LLSD payload;
- payload["wearable_type"] = (S32)type;
- payload["wearable_index"] = (S32)index;
- // Bring up view-modal dialog: Save changes? Yes, No, Cancel
- LLNotificationsUtil::add("WearableSave", LLSD(), payload, &LLAgentWearables::onRemoveWearableDialog);
- return;
- }
- else
- {
- removeWearableFinal(type, do_remove_all, index);
- }
- }
- }
-}
-
-
-// static
+ if (getWearableCount(type) == 0)
+ {
+ // no wearables to remove
+ return;
+ }
+
+ if (do_remove_all)
+ {
+ removeWearableFinal(type, do_remove_all, index);
+ }
+ else
+ {
+ LLViewerWearable* old_wearable = getViewerWearable(type,index);
+
+ if (old_wearable)
+ {
+ if (old_wearable->isDirty())
+ {
+ LLSD payload;
+ payload["wearable_type"] = (S32)type;
+ payload["wearable_index"] = (S32)index;
+ // Bring up view-modal dialog: Save changes? Yes, No, Cancel
+ LLNotificationsUtil::add("WearableSave", LLSD(), payload, &LLAgentWearables::onRemoveWearableDialog);
+ return;
+ }
+ else
+ {
+ removeWearableFinal(type, do_remove_all, index);
+ }
+ }
+ }
+}
+
+
+// static
bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLWearableType::EType type = (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger();
- S32 index = (S32)notification["payload"]["wearable_index"].asInteger();
- switch(option)
- {
- case 0: // "Save"
- gAgentWearables.saveWearable(type, index);
- gAgentWearables.removeWearableFinal(type, false, index);
- break;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLWearableType::EType type = (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger();
+ S32 index = (S32)notification["payload"]["wearable_index"].asInteger();
+ switch(option)
+ {
+ case 0: // "Save"
+ gAgentWearables.saveWearable(type, index);
+ gAgentWearables.removeWearableFinal(type, false, index);
+ break;
- case 1: // "Don't Save"
- gAgentWearables.removeWearableFinal(type, false, index);
- break;
+ case 1: // "Don't Save"
+ gAgentWearables.removeWearableFinal(type, false, index);
+ break;
- case 2: // "Cancel"
- break;
+ case 2: // "Cancel"
+ break;
- default:
- llassert(0);
- break;
- }
- return false;
+ default:
+ llassert(0);
+ break;
+ }
+ return false;
}
// Called by removeWearable() and onRemoveWearableDialog() to actually do the removal.
void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, bool do_remove_all, U32 index)
{
- //LLAgentDumper dumper("removeWearable");
- if (do_remove_all)
- {
- S32 max_entry = getWearableCount(type)-1;
- for (S32 i=max_entry; i>=0; i--)
- {
- LLViewerWearable* old_wearable = getViewerWearable(type,i);
- if (old_wearable)
- {
- eraseWearable(old_wearable);
- old_wearable->removeFromAvatar();
- }
- }
- clearWearableType(type);
- }
- else
- {
- LLViewerWearable* old_wearable = getViewerWearable(type, index);
-
- if (old_wearable)
- {
- eraseWearable(old_wearable);
- old_wearable->removeFromAvatar();
- }
- }
-
- gInventory.notifyObservers();
+ //LLAgentDumper dumper("removeWearable");
+ if (do_remove_all)
+ {
+ S32 max_entry = getWearableCount(type)-1;
+ for (S32 i=max_entry; i>=0; i--)
+ {
+ LLViewerWearable* old_wearable = getViewerWearable(type,i);
+ if (old_wearable)
+ {
+ eraseWearable(old_wearable);
+ old_wearable->removeFromAvatar();
+ }
+ }
+ clearWearableType(type);
+ }
+ else
+ {
+ LLViewerWearable* old_wearable = getViewerWearable(type, index);
+
+ if (old_wearable)
+ {
+ eraseWearable(old_wearable);
+ old_wearable->removeFromAvatar();
+ }
+ }
+
+ gInventory.notifyObservers();
}
// Assumes existing wearables are not dirty.
void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items,
- const std::vector< LLViewerWearable* >& wearables)
-{
- LL_INFOS() << "setWearableOutfit() start" << LL_ENDL;
-
- S32 count = wearables.size();
- llassert(items.size() == count);
-
- // Check for whether outfit already matches the one requested
- S32 matched = 0, mismatched = 0;
- const S32 arr_size = LLWearableType::WT_COUNT;
- S32 type_counts[arr_size];
- BOOL update_inventory = FALSE;
- std::fill(type_counts,type_counts+arr_size,0);
- for (S32 i = 0; i < count; i++)
- {
- LLViewerWearable* new_wearable = wearables[i];
- LLPointer<LLInventoryItem> new_item = items[i];
-
- const LLWearableType::EType type = new_wearable->getType();
- if (type < 0 || type>=LLWearableType::WT_COUNT)
- {
- LL_WARNS() << "invalid type " << type << LL_ENDL;
- mismatched++;
- continue;
- }
- S32 index = type_counts[type];
- type_counts[type]++;
-
- LLViewerWearable *curr_wearable = dynamic_cast<LLViewerWearable*>(getWearable(type,index));
- if (!new_wearable || !curr_wearable ||
- new_wearable->getAssetID() != curr_wearable->getAssetID())
- {
- LL_DEBUGS("Avatar") << "mismatch, type " << type << " index " << index
- << " names " << (curr_wearable ? curr_wearable->getName() : "NONE") << ","
- << " names " << (new_wearable ? new_wearable->getName() : "NONE") << LL_ENDL;
- mismatched++;
- continue;
- }
-
- // Update only inventory in this case - ordering of wearables with the same asset id has no effect.
- // Updating wearables in this case causes the two-alphas error in MAINT-4158.
- // We should actually disallow wearing two wearables with the same asset id.
- if (curr_wearable->getName() != new_item->getName() ||
- curr_wearable->getItemID() != new_item->getUUID())
- {
- LL_DEBUGS("Avatar") << "mismatch on name or inventory id, names "
- << curr_wearable->getName() << " vs " << new_item->getName()
- << " item ids " << curr_wearable->getItemID() << " vs " << new_item->getUUID()
- << LL_ENDL;
- update_inventory = TRUE;
- continue;
- }
- // If we got here, everything matches.
- matched++;
- }
- LL_DEBUGS("Avatar") << "matched " << matched << " mismatched " << mismatched << LL_ENDL;
- for (S32 j=0; j<LLWearableType::WT_COUNT; j++)
- {
- LLWearableType::EType type = (LLWearableType::EType) j;
- if (getWearableCount(type) != type_counts[j])
- {
- LL_DEBUGS("Avatar") << "count mismatch for type " << j << " current " << getWearableCount(j) << " requested " << type_counts[j] << LL_ENDL;
- mismatched++;
- }
- }
- if (mismatched == 0 && !update_inventory)
- {
- LL_DEBUGS("Avatar") << "no changes, bailing out" << LL_ENDL;
- notifyLoadingFinished();
- return;
- }
-
- // updating inventory
+ const std::vector< LLViewerWearable* >& wearables)
+{
+ LL_INFOS() << "setWearableOutfit() start" << LL_ENDL;
+
+ S32 count = wearables.size();
+ llassert(items.size() == count);
+
+ // Check for whether outfit already matches the one requested
+ S32 matched = 0, mismatched = 0;
+ const S32 arr_size = LLWearableType::WT_COUNT;
+ S32 type_counts[arr_size];
+ BOOL update_inventory = FALSE;
+ std::fill(type_counts,type_counts+arr_size,0);
+ for (S32 i = 0; i < count; i++)
+ {
+ LLViewerWearable* new_wearable = wearables[i];
+ LLPointer<LLInventoryItem> new_item = items[i];
+
+ const LLWearableType::EType type = new_wearable->getType();
+ if (type < 0 || type>=LLWearableType::WT_COUNT)
+ {
+ LL_WARNS() << "invalid type " << type << LL_ENDL;
+ mismatched++;
+ continue;
+ }
+ S32 index = type_counts[type];
+ type_counts[type]++;
+
+ LLViewerWearable *curr_wearable = dynamic_cast<LLViewerWearable*>(getWearable(type,index));
+ if (!new_wearable || !curr_wearable ||
+ new_wearable->getAssetID() != curr_wearable->getAssetID())
+ {
+ LL_DEBUGS("Avatar") << "mismatch, type " << type << " index " << index
+ << " names " << (curr_wearable ? curr_wearable->getName() : "NONE") << ","
+ << " names " << (new_wearable ? new_wearable->getName() : "NONE") << LL_ENDL;
+ mismatched++;
+ continue;
+ }
+
+ // Update only inventory in this case - ordering of wearables with the same asset id has no effect.
+ // Updating wearables in this case causes the two-alphas error in MAINT-4158.
+ // We should actually disallow wearing two wearables with the same asset id.
+ if (curr_wearable->getName() != new_item->getName() ||
+ curr_wearable->getItemID() != new_item->getUUID())
+ {
+ LL_DEBUGS("Avatar") << "mismatch on name or inventory id, names "
+ << curr_wearable->getName() << " vs " << new_item->getName()
+ << " item ids " << curr_wearable->getItemID() << " vs " << new_item->getUUID()
+ << LL_ENDL;
+ update_inventory = TRUE;
+ continue;
+ }
+ // If we got here, everything matches.
+ matched++;
+ }
+ LL_DEBUGS("Avatar") << "matched " << matched << " mismatched " << mismatched << LL_ENDL;
+ for (S32 j=0; j<LLWearableType::WT_COUNT; j++)
+ {
+ LLWearableType::EType type = (LLWearableType::EType) j;
+ if (getWearableCount(type) != type_counts[j])
+ {
+ LL_DEBUGS("Avatar") << "count mismatch for type " << j << " current " << getWearableCount(j) << " requested " << type_counts[j] << LL_ENDL;
+ mismatched++;
+ }
+ }
+ if (mismatched == 0 && !update_inventory)
+ {
+ LL_DEBUGS("Avatar") << "no changes, bailing out" << LL_ENDL;
+ notifyLoadingFinished();
+ return;
+ }
+
+ // updating inventory
LLWearableType* wearable_type_inst = LLWearableType::getInstance();
- // TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later
- // note: shirt is the first non-body part wearable item. Update if wearable order changes.
- // This loop should remove all clothing, but not any body parts
- for (S32 j = 0; j < (S32)LLWearableType::WT_COUNT; j++)
- {
- if (wearable_type_inst->getAssetType((LLWearableType::EType)j) == LLAssetType::AT_CLOTHING)
- {
- removeWearable((LLWearableType::EType)j, true, 0);
- }
- }
-
- for (S32 i = 0; i < count; i++)
- {
- LLViewerWearable* new_wearable = wearables[i];
- LLPointer<LLInventoryItem> new_item = items[i];
-
- llassert(new_wearable);
- if (new_wearable)
- {
- const LLWearableType::EType type = new_wearable->getType();
-
- LLUUID old_wearable_id = new_wearable->getItemID();
- new_wearable->setName(new_item->getName());
- new_wearable->setItemID(new_item->getUUID());
-
- if (wearable_type_inst->getAssetType(type) == LLAssetType::AT_BODYPART)
- {
- // exactly one wearable per body part
- setWearable(type,0,new_wearable);
- if (old_wearable_id.notNull())
- {
- // we changed id before setting wearable, update old item manually
- // to complete the swap.
- gInventory.addChangedMask(LLInventoryObserver::LABEL, old_wearable_id);
- }
- }
- else
- {
- pushWearable(type,new_wearable);
- }
-
- const BOOL removed = FALSE;
- wearableUpdated(new_wearable, removed);
- }
- }
-
- gInventory.notifyObservers();
-
- if (mismatched == 0)
- {
- LL_DEBUGS("Avatar") << "inventory updated, wearable assets not changed, bailing out" << LL_ENDL;
- notifyLoadingFinished();
- return;
- }
-
- // updating agent avatar
-
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
-
- // If we have not yet declouded, we may want to use
- // baked texture UUIDs sent from the first objectUpdate message
- // don't overwrite these. If we have already declouded, we've saved
- // these ids as the last known good textures and can invalidate without
- // re-clouding.
- if (!gAgentAvatarp->getIsCloud())
- {
- gAgentAvatarp->invalidateAll();
- }
- }
-
- // Start rendering & update the server
- mWearablesLoaded = TRUE;
-
- notifyLoadingFinished();
-
- // Copy wearable params to avatar.
- gAgentAvatarp->writeWearablesToAvatar();
-
- // Then update the avatar based on the copied params.
- gAgentAvatarp->updateVisualParams();
-
- gAgentAvatarp->dumpAvatarTEs("setWearableOutfit");
-
- LL_DEBUGS("Avatar") << "setWearableOutfit() end" << LL_ENDL;
+ // TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later
+ // note: shirt is the first non-body part wearable item. Update if wearable order changes.
+ // This loop should remove all clothing, but not any body parts
+ for (S32 j = 0; j < (S32)LLWearableType::WT_COUNT; j++)
+ {
+ if (wearable_type_inst->getAssetType((LLWearableType::EType)j) == LLAssetType::AT_CLOTHING)
+ {
+ removeWearable((LLWearableType::EType)j, true, 0);
+ }
+ }
+
+ for (S32 i = 0; i < count; i++)
+ {
+ LLViewerWearable* new_wearable = wearables[i];
+ LLPointer<LLInventoryItem> new_item = items[i];
+
+ llassert(new_wearable);
+ if (new_wearable)
+ {
+ const LLWearableType::EType type = new_wearable->getType();
+
+ LLUUID old_wearable_id = new_wearable->getItemID();
+ new_wearable->setName(new_item->getName());
+ new_wearable->setItemID(new_item->getUUID());
+
+ if (wearable_type_inst->getAssetType(type) == LLAssetType::AT_BODYPART)
+ {
+ // exactly one wearable per body part
+ setWearable(type,0,new_wearable);
+ if (old_wearable_id.notNull())
+ {
+ // we changed id before setting wearable, update old item manually
+ // to complete the swap.
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, old_wearable_id);
+ }
+ }
+ else
+ {
+ pushWearable(type,new_wearable);
+ }
+
+ const BOOL removed = FALSE;
+ wearableUpdated(new_wearable, removed);
+ }
+ }
+
+ gInventory.notifyObservers();
+
+ if (mismatched == 0)
+ {
+ LL_DEBUGS("Avatar") << "inventory updated, wearable assets not changed, bailing out" << LL_ENDL;
+ notifyLoadingFinished();
+ return;
+ }
+
+ // updating agent avatar
+
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
+
+ // If we have not yet declouded, we may want to use
+ // baked texture UUIDs sent from the first objectUpdate message
+ // don't overwrite these. If we have already declouded, we've saved
+ // these ids as the last known good textures and can invalidate without
+ // re-clouding.
+ if (!gAgentAvatarp->getIsCloud())
+ {
+ gAgentAvatarp->invalidateAll();
+ }
+ }
+
+ // Start rendering & update the server
+ mWearablesLoaded = TRUE;
+
+ notifyLoadingFinished();
+
+ // Copy wearable params to avatar.
+ gAgentAvatarp->writeWearablesToAvatar();
+
+ // Then update the avatar based on the copied params.
+ gAgentAvatarp->updateVisualParams();
+
+ gAgentAvatarp->dumpAvatarTEs("setWearableOutfit");
+
+ LL_DEBUGS("Avatar") << "setWearableOutfit() end" << LL_ENDL;
}
// User has picked "wear on avatar" from a menu.
void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append)
{
- //LLAgentDumper dumper("setWearableItem");
- if (isWearingItem(new_item->getUUID()))
- {
- LL_WARNS() << "wearable " << new_item->getUUID() << " is already worn" << LL_ENDL;
- return;
- }
-
- const LLWearableType::EType type = new_wearable->getType();
-
- if (!do_append)
- {
- // Remove old wearable, if any
- // MULTI_WEARABLE: hardwired to 0
- LLViewerWearable* old_wearable = getViewerWearable(type,0);
- if (old_wearable)
- {
- const LLUUID& old_item_id = old_wearable->getItemID();
- if ((old_wearable->getAssetID() == new_wearable->getAssetID()) &&
- (old_item_id == new_item->getUUID()))
- {
- LL_DEBUGS() << "No change to wearable asset and item: " << LLWearableType::getInstance()->getTypeName(type) << LL_ENDL;
- return;
- }
-
- if (old_wearable->isDirty())
- {
- // Bring up modal dialog: Save changes? Yes, No, Cancel
- LLSD payload;
- payload["item_id"] = new_item->getUUID();
- LLNotificationsUtil::add("WearableSave", LLSD(), payload, boost::bind(onSetWearableDialog, _1, _2, new_wearable));
- return;
- }
- }
- }
-
- setWearableFinal(new_item, new_wearable, do_append);
-}
-
-// static
+ //LLAgentDumper dumper("setWearableItem");
+ if (isWearingItem(new_item->getUUID()))
+ {
+ LL_WARNS() << "wearable " << new_item->getUUID() << " is already worn" << LL_ENDL;
+ return;
+ }
+
+ const LLWearableType::EType type = new_wearable->getType();
+
+ if (!do_append)
+ {
+ // Remove old wearable, if any
+ // MULTI_WEARABLE: hardwired to 0
+ LLViewerWearable* old_wearable = getViewerWearable(type,0);
+ if (old_wearable)
+ {
+ const LLUUID& old_item_id = old_wearable->getItemID();
+ if ((old_wearable->getAssetID() == new_wearable->getAssetID()) &&
+ (old_item_id == new_item->getUUID()))
+ {
+ LL_DEBUGS() << "No change to wearable asset and item: " << LLWearableType::getInstance()->getTypeName(type) << LL_ENDL;
+ return;
+ }
+
+ if (old_wearable->isDirty())
+ {
+ // Bring up modal dialog: Save changes? Yes, No, Cancel
+ LLSD payload;
+ payload["item_id"] = new_item->getUUID();
+ LLNotificationsUtil::add("WearableSave", LLSD(), payload, boost::bind(onSetWearableDialog, _1, _2, new_wearable));
+ return;
+ }
+ }
+ }
+
+ setWearableFinal(new_item, new_wearable, do_append);
+}
+
+// static
bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLInventoryItem* new_item = gInventory.getItem(notification["payload"]["item_id"].asUUID());
- U32 index;
- if (!gAgentWearables.getWearableIndex(wearable,index))
- {
- LL_WARNS() << "Wearable not found" << LL_ENDL;
- delete wearable;
- return false;
- }
- if (!new_item)
- {
- delete wearable;
- return false;
- }
-
- switch(option)
- {
- case 0: // "Save"
- gAgentWearables.saveWearable(wearable->getType(),index);
- gAgentWearables.setWearableFinal(new_item, wearable);
- break;
-
- case 1: // "Don't Save"
- gAgentWearables.setWearableFinal(new_item, wearable);
- break;
-
- case 2: // "Cancel"
- break;
-
- default:
- llassert(0);
- break;
- }
-
- delete wearable;
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLInventoryItem* new_item = gInventory.getItem(notification["payload"]["item_id"].asUUID());
+ U32 index;
+ if (!gAgentWearables.getWearableIndex(wearable,index))
+ {
+ LL_WARNS() << "Wearable not found" << LL_ENDL;
+ delete wearable;
+ return false;
+ }
+ if (!new_item)
+ {
+ delete wearable;
+ return false;
+ }
+
+ switch(option)
+ {
+ case 0: // "Save"
+ gAgentWearables.saveWearable(wearable->getType(),index);
+ gAgentWearables.setWearableFinal(new_item, wearable);
+ break;
+
+ case 1: // "Don't Save"
+ gAgentWearables.setWearableFinal(new_item, wearable);
+ break;
+
+ case 2: // "Cancel"
+ break;
+
+ default:
+ llassert(0);
+ break;
+ }
+
+ delete wearable;
+ return false;
}
// Called from setWearableItem() and onSetWearableDialog() to actually set the wearable.
// MULTI_WEARABLE: unify code after null objects are gone.
void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append)
{
- const LLWearableType::EType type = new_wearable->getType();
-
- if (do_append && getWearableItemID(type,0).notNull())
- {
- new_wearable->setItemID(new_item->getUUID());
- const bool trigger_updated = false;
- pushWearable(type, new_wearable, trigger_updated);
- LL_INFOS() << "Added additional wearable for type " << type
- << " size is now " << getWearableCount(type) << LL_ENDL;
- checkWearableAgainstInventory(new_wearable);
- }
- else
- {
- // Replace the old wearable with a new one.
- llassert(new_item->getAssetUUID() == new_wearable->getAssetID());
-
- LLViewerWearable *old_wearable = getViewerWearable(type,0);
- LLUUID old_item_id;
- if (old_wearable)
- {
- old_item_id = old_wearable->getItemID();
- }
- new_wearable->setItemID(new_item->getUUID());
- setWearable(type,0,new_wearable);
-
- if (old_item_id.notNull())
- {
- gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
- gInventory.notifyObservers();
- }
- LL_INFOS() << "Replaced current element 0 for type " << type
- << " size is now " << getWearableCount(type) << LL_ENDL;
- }
+ const LLWearableType::EType type = new_wearable->getType();
+
+ if (do_append && getWearableItemID(type,0).notNull())
+ {
+ new_wearable->setItemID(new_item->getUUID());
+ const bool trigger_updated = false;
+ pushWearable(type, new_wearable, trigger_updated);
+ LL_INFOS() << "Added additional wearable for type " << type
+ << " size is now " << getWearableCount(type) << LL_ENDL;
+ checkWearableAgainstInventory(new_wearable);
+ }
+ else
+ {
+ // Replace the old wearable with a new one.
+ llassert(new_item->getAssetUUID() == new_wearable->getAssetID());
+
+ LLViewerWearable *old_wearable = getViewerWearable(type,0);
+ LLUUID old_item_id;
+ if (old_wearable)
+ {
+ old_item_id = old_wearable->getItemID();
+ }
+ new_wearable->setItemID(new_item->getUUID());
+ setWearable(type,0,new_wearable);
+
+ if (old_item_id.notNull())
+ {
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
+ gInventory.notifyObservers();
+ }
+ LL_INFOS() << "Replaced current element 0 for type " << type
+ << " size is now " << getWearableCount(type) << LL_ENDL;
+ }
}
// User has picked "remove from avatar" from a menu.
// static
void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type, const U32 &index)
{
- if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
- //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
- {
- gAgentWearables.removeWearable(type,false,index);
- }
+ if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
+ //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
+ {
+ gAgentWearables.removeWearable(type,false,index);
+ }
}
-//static
+//static
void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &type)
{
- if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
- //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
- {
- gAgentWearables.removeWearable(type,true,0);
- }
+ if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
+ //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
+ {
+ gAgentWearables.removeWearable(type,true,0);
+ }
}
// Given a desired set of attachments, find what objects need to be
// removed, and what additional inventory items need to be added.
void LLAgentWearables::findAttachmentsAddRemoveInfo(LLInventoryModel::item_array_t& obj_item_array,
- llvo_vec_t& objects_to_remove,
- llvo_vec_t& objects_to_retain,
- LLInventoryModel::item_array_t& items_to_add)
-{
- // Possible cases:
- // already wearing but not in request set -> take off.
- // already wearing and in request set -> leave alone.
- // not wearing and in request set -> put on.
-
- if (!isAgentAvatarValid()) return;
-
- std::set<LLUUID> requested_item_ids;
- std::set<LLUUID> current_item_ids;
- for (S32 i=0; i<obj_item_array.size(); i++)
- {
- const LLUUID & requested_id = obj_item_array[i].get()->getLinkedUUID();
- //LL_INFOS() << "Requested attachment id " << requested_id << LL_ENDL;
- requested_item_ids.insert(requested_id);
- }
-
- // Build up list of objects to be removed and items currently attached.
+ llvo_vec_t& objects_to_remove,
+ llvo_vec_t& objects_to_retain,
+ LLInventoryModel::item_array_t& items_to_add)
+{
+ // Possible cases:
+ // already wearing but not in request set -> take off.
+ // already wearing and in request set -> leave alone.
+ // not wearing and in request set -> put on.
+
+ if (!isAgentAvatarValid()) return;
+
+ std::set<LLUUID> requested_item_ids;
+ std::set<LLUUID> current_item_ids;
+ for (S32 i=0; i<obj_item_array.size(); i++)
+ {
+ const LLUUID & requested_id = obj_item_array[i].get()->getLinkedUUID();
+ //LL_INFOS() << "Requested attachment id " << requested_id << LL_ENDL;
+ requested_item_ids.insert(requested_id);
+ }
+
+ // Build up list of objects to be removed and items currently attached.
LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
LLVOAvatar::attachment_map_t::iterator end = gAgentAvatarp->mAttachmentPoints.end();
- while (iter != end)
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject *objectp = attachment_iter->get();
- if (objectp)
- {
- LLUUID object_item_id = objectp->getAttachmentItemID();
-
- bool remove_attachment = true;
- if (requested_item_ids.find(object_item_id) != requested_item_ids.end())
- { // Object currently worn, was requested to keep it
- // Flag as currently worn so we won't have to add it again.
- remove_attachment = false;
- }
- else if (objectp->isTempAttachment())
- { // Check if we should keep this temp attachment
- remove_attachment = LLAppearanceMgr::instance().shouldRemoveTempAttachment(objectp->getID());
- }
-
- if (remove_attachment)
- {
- // LL_INFOS() << "found object to remove, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL;
- objects_to_remove.push_back(objectp);
- }
- else
- {
- // LL_INFOS() << "found object to keep, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL;
- current_item_ids.insert(object_item_id);
- objects_to_retain.push_back(objectp);
- }
- }
- }
- }
-
- for (LLInventoryModel::item_array_t::iterator it = obj_item_array.begin();
- it != obj_item_array.end();
- ++it)
- {
- LLUUID linked_id = (*it).get()->getLinkedUUID();
- if (current_item_ids.find(linked_id) != current_item_ids.end())
- {
- // Requested attachment is already worn.
- }
- else
- {
- // Requested attachment is not worn yet.
- items_to_add.push_back(*it);
- }
- }
- // S32 remove_count = objects_to_remove.size();
- // S32 add_count = items_to_add.size();
- // LL_INFOS() << "remove " << remove_count << " add " << add_count << LL_ENDL;
+ while (iter != end)
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject *objectp = attachment_iter->get();
+ if (objectp)
+ {
+ LLUUID object_item_id = objectp->getAttachmentItemID();
+
+ bool remove_attachment = true;
+ if (requested_item_ids.find(object_item_id) != requested_item_ids.end())
+ { // Object currently worn, was requested to keep it
+ // Flag as currently worn so we won't have to add it again.
+ remove_attachment = false;
+ }
+ else if (objectp->isTempAttachment())
+ { // Check if we should keep this temp attachment
+ remove_attachment = LLAppearanceMgr::instance().shouldRemoveTempAttachment(objectp->getID());
+ }
+
+ if (remove_attachment)
+ {
+ // LL_INFOS() << "found object to remove, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL;
+ objects_to_remove.push_back(objectp);
+ }
+ else
+ {
+ // LL_INFOS() << "found object to keep, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL;
+ current_item_ids.insert(object_item_id);
+ objects_to_retain.push_back(objectp);
+ }
+ }
+ }
+ }
+
+ for (LLInventoryModel::item_array_t::iterator it = obj_item_array.begin();
+ it != obj_item_array.end();
+ ++it)
+ {
+ LLUUID linked_id = (*it).get()->getLinkedUUID();
+ if (current_item_ids.find(linked_id) != current_item_ids.end())
+ {
+ // Requested attachment is already worn.
+ }
+ else
+ {
+ // Requested attachment is not worn yet.
+ items_to_add.push_back(*it);
+ }
+ }
+ // S32 remove_count = objects_to_remove.size();
+ // S32 add_count = items_to_add.size();
+ // LL_INFOS() << "remove " << remove_count << " add " << add_count << LL_ENDL;
}
std::vector<LLViewerObject*> LLAgentWearables::getTempAttachments()
{
- llvo_vec_t temp_attachs;
- if (isAgentAvatarValid())
- {
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end();)
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject *objectp = attachment_iter->get();
- if (objectp && objectp->isTempAttachment())
- {
- temp_attachs.push_back(objectp);
- }
- }
- }
- }
- return temp_attachs;
+ llvo_vec_t temp_attachs;
+ if (isAgentAvatarValid())
+ {
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end();)
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject *objectp = attachment_iter->get();
+ if (objectp && objectp->isTempAttachment())
+ {
+ temp_attachs.push_back(objectp);
+ }
+ }
+ }
+ }
+ return temp_attachs;
}
void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remove)
{
- if (!isAgentAvatarValid()) return;
-
- if (objects_to_remove.empty())
- return;
-
- LL_DEBUGS("Avatar") << "ATT [ObjectDetach] removing " << objects_to_remove.size() << " objects" << LL_ENDL;
- gMessageSystem->newMessage("ObjectDetach");
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-
- for (llvo_vec_t::iterator it = objects_to_remove.begin();
- it != objects_to_remove.end();
- ++it)
- {
- LLViewerObject *objectp = *it;
- //gAgentAvatarp->resetJointPositionsOnDetach(objectp);
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID());
- const LLUUID& item_id = objectp->getAttachmentItemID();
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_DEBUGS("Avatar") << "ATT removing object, item is " << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
+ if (!isAgentAvatarValid()) return;
+
+ if (objects_to_remove.empty())
+ return;
+
+ LL_DEBUGS("Avatar") << "ATT [ObjectDetach] removing " << objects_to_remove.size() << " objects" << LL_ENDL;
+ gMessageSystem->newMessage("ObjectDetach");
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+
+ for (llvo_vec_t::iterator it = objects_to_remove.begin();
+ it != objects_to_remove.end();
+ ++it)
+ {
+ LLViewerObject *objectp = *it;
+ //gAgentAvatarp->resetJointPositionsOnDetach(objectp);
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID());
+ const LLUUID& item_id = objectp->getAttachmentItemID();
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << "ATT removing object, item is " << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
LLAttachmentsMgr::instance().onDetachRequested(item_id);
- }
- gMessageSystem->sendReliable(gAgent.getRegionHost());
+ }
+ gMessageSystem->sendReliable(gAgent.getRegionHost());
}
void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array)
{
- // Build a compound message to send all the objects that need to be rezzed.
- S32 obj_count = obj_item_array.size();
- if (obj_count > 0)
- {
- LL_DEBUGS("Avatar") << "ATT attaching multiple, total obj_count " << obj_count << LL_ENDL;
- }
+ // Build a compound message to send all the objects that need to be rezzed.
+ S32 obj_count = obj_item_array.size();
+ if (obj_count > 0)
+ {
+ LL_DEBUGS("Avatar") << "ATT attaching multiple, total obj_count " << obj_count << LL_ENDL;
+ }
for(LLInventoryModel::item_array_t::const_iterator it = obj_item_array.begin();
it != obj_item_array.end();
++it)
{
- const LLInventoryItem* item = *it;
+ const LLInventoryItem* item = *it;
LLAttachmentsMgr::instance().addAttachmentRequest(item->getLinkedUUID(), 0, TRUE);
}
}
@@ -1442,150 +1442,150 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
// (depending on closer_to_body parameter).
bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body) const
{
- const LLWearable* wearable = getWearableFromItemID(item_id);
- if (!wearable) return false;
+ const LLWearable* wearable = getWearableFromItemID(item_id);
+ if (!wearable) return false;
- LLWearableType::EType wtype = wearable->getType();
- const LLWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype);
- if (!marginal_wearable) return false;
+ LLWearableType::EType wtype = wearable->getType();
+ const LLWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype);
+ if (!marginal_wearable) return false;
- return wearable != marginal_wearable;
+ return wearable != marginal_wearable;
}
BOOL LLAgentWearables::areWearablesLoaded() const
{
- return mWearablesLoaded;
+ return mWearablesLoaded;
}
bool LLAgentWearables::canWearableBeRemoved(const LLViewerWearable* wearable) const
{
- if (!wearable) return false;
-
- LLWearableType::EType type = wearable->getType();
- // Make sure the user always has at least one shape, skin, eyes, and hair type currently worn.
- return !(((type == LLWearableType::WT_SHAPE) || (type == LLWearableType::WT_SKIN) || (type == LLWearableType::WT_HAIR) || (type == LLWearableType::WT_EYES))
- && (getWearableCount(type) <= 1) );
+ if (!wearable) return false;
+
+ LLWearableType::EType type = wearable->getType();
+ // Make sure the user always has at least one shape, skin, eyes, and hair type currently worn.
+ return !(((type == LLWearableType::WT_SHAPE) || (type == LLWearableType::WT_SKIN) || (type == LLWearableType::WT_HAIR) || (type == LLWearableType::WT_EYES))
+ && (getWearableCount(type) <= 1) );
}
void LLAgentWearables::animateAllWearableParams(F32 delta)
{
- for( S32 type = 0; type < LLWearableType::WT_COUNT; ++type )
- {
- for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
- {
- LLViewerWearable *wearable = getViewerWearable((LLWearableType::EType)type,count);
- llassert(wearable);
- if (wearable)
- {
- wearable->animateParams(delta);
- }
- }
- }
+ for( S32 type = 0; type < LLWearableType::WT_COUNT; ++type )
+ {
+ for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
+ {
+ LLViewerWearable *wearable = getViewerWearable((LLWearableType::EType)type,count);
+ llassert(wearable);
+ if (wearable)
+ {
+ wearable->animateParams(delta);
+ }
+ }
+ }
}
bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool closer_to_body)
{
- if (!item) return false;
- if (!item->isWearableType()) return false;
-
- LLWearableType::EType type = item->getWearableType();
- U32 wearable_count = getWearableCount(type);
- if (0 == wearable_count) return false;
-
- const LLUUID& asset_id = item->getAssetUUID();
-
- //nowhere to move if the wearable is already on any boundary (closest to the body/furthest from the body)
- if (closer_to_body)
- {
- LLViewerWearable* bottom_wearable = dynamic_cast<LLViewerWearable*>( getBottomWearable(type) );
- if (bottom_wearable->getAssetID() == asset_id)
- {
- return false;
- }
- }
- else // !closer_to_body
- {
- LLViewerWearable* top_wearable = dynamic_cast<LLViewerWearable*>( getTopWearable(type) );
- if (top_wearable->getAssetID() == asset_id)
- {
- return false;
- }
- }
-
- for (U32 i = 0; i < wearable_count; ++i)
- {
- LLViewerWearable* wearable = getViewerWearable(type, i);
- if (!wearable) continue;
- if (wearable->getAssetID() != asset_id) continue;
-
- //swapping wearables
- U32 swap_i = closer_to_body ? i-1 : i+1;
- swapWearables(type, i, swap_i);
- return true;
- }
-
- return false;
+ if (!item) return false;
+ if (!item->isWearableType()) return false;
+
+ LLWearableType::EType type = item->getWearableType();
+ U32 wearable_count = getWearableCount(type);
+ if (0 == wearable_count) return false;
+
+ const LLUUID& asset_id = item->getAssetUUID();
+
+ //nowhere to move if the wearable is already on any boundary (closest to the body/furthest from the body)
+ if (closer_to_body)
+ {
+ LLViewerWearable* bottom_wearable = dynamic_cast<LLViewerWearable*>( getBottomWearable(type) );
+ if (bottom_wearable->getAssetID() == asset_id)
+ {
+ return false;
+ }
+ }
+ else // !closer_to_body
+ {
+ LLViewerWearable* top_wearable = dynamic_cast<LLViewerWearable*>( getTopWearable(type) );
+ if (top_wearable->getAssetID() == asset_id)
+ {
+ return false;
+ }
+ }
+
+ for (U32 i = 0; i < wearable_count; ++i)
+ {
+ LLViewerWearable* wearable = getViewerWearable(type, i);
+ if (!wearable) continue;
+ if (wearable->getAssetID() != asset_id) continue;
+
+ //swapping wearables
+ U32 swap_i = closer_to_body ? i-1 : i+1;
+ swapWearables(type, i, swap_i);
+ return true;
+ }
+
+ return false;
}
// static
void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, const LLUUID& parent_id, std::function<void(const LLUUID&)> created_cb)
{
- if (type == LLWearableType::WT_INVALID || type == LLWearableType::WT_NONE) return;
-
- if (type == LLWearableType::WT_UNIVERSAL && !gAgent.getRegion()->bakesOnMeshEnabled())
- {
- LL_WARNS("Inventory") << "Can't create WT_UNIVERSAL type " << LL_ENDL;
- return;
- }
-
- LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
- LLAssetType::EType asset_type = wearable->getAssetType();
- LLPointer<LLBoostFuncInventoryCallback> cb;
- if(wear)
- {
- cb = new LLBoostFuncInventoryCallback(wear_and_edit_cb);
- }
- else
- {
- cb = new LLBoostFuncInventoryCallback(wear_cb);
- }
+ if (type == LLWearableType::WT_INVALID || type == LLWearableType::WT_NONE) return;
+
+ if (type == LLWearableType::WT_UNIVERSAL && !gAgent.getRegion()->bakesOnMeshEnabled())
+ {
+ LL_WARNS("Inventory") << "Can't create WT_UNIVERSAL type " << LL_ENDL;
+ return;
+ }
+
+ LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
+ LLAssetType::EType asset_type = wearable->getAssetType();
+ LLPointer<LLBoostFuncInventoryCallback> cb;
+ if(wear)
+ {
+ cb = new LLBoostFuncInventoryCallback(wear_and_edit_cb);
+ }
+ else
+ {
+ cb = new LLBoostFuncInventoryCallback(wear_cb);
+ }
if (created_cb != NULL)
{
cb->addOnFireFunc(created_cb);
}
- LLUUID folder_id;
+ LLUUID folder_id;
- if (parent_id.notNull())
- {
- folder_id = parent_id;
- }
- else
- {
- LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(asset_type);
- folder_id = gInventory.findCategoryUUIDForType(folder_type);
- }
+ if (parent_id.notNull())
+ {
+ folder_id = parent_id;
+ }
+ else
+ {
+ LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(asset_type);
+ folder_id = gInventory.findCategoryUUIDForType(folder_type);
+ }
create_inventory_wearable(gAgent.getID(),
- gAgent.getSessionID(),
- folder_id,
- wearable->getTransactionID(),
- wearable->getName(),
- wearable->getDescription(),
- asset_type,
- wearable->getType(),
- LLFloaterPerms::getNextOwnerPerms("Wearables"),
- cb);
+ gAgent.getSessionID(),
+ folder_id,
+ wearable->getTransactionID(),
+ wearable->getName(),
+ wearable->getDescription(),
+ asset_type,
+ wearable->getType(),
+ LLFloaterPerms::getNextOwnerPerms("Wearables"),
+ cb);
}
// static
void LLAgentWearables::editWearable(const LLUUID& item_id)
{
- LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id);
- if (!item)
- {
- LL_WARNS() << "Failed to get linked item" << LL_ENDL;
- return;
- }
+ LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id);
+ if (!item)
+ {
+ LL_WARNS() << "Failed to get linked item" << LL_ENDL;
+ return;
+ }
if (!item->isFinished())
{
@@ -1595,18 +1595,18 @@ void LLAgentWearables::editWearable(const LLUUID& item_id)
return;
}
- LLViewerWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
- if (!wearable)
- {
- LL_WARNS() << "Cannot get wearable" << LL_ENDL;
- return;
- }
+ LLViewerWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
+ if (!wearable)
+ {
+ LL_WARNS() << "Cannot get wearable" << LL_ENDL;
+ return;
+ }
- if (!gAgentWearables.isWearableModifiable(item->getUUID()))
- {
- LL_WARNS() << "Cannot modify wearable" << LL_ENDL;
- return;
- }
+ if (!gAgentWearables.isWearableModifiable(item->getUUID()))
+ {
+ LL_WARNS() << "Cannot modify wearable" << LL_ENDL;
+ return;
+ }
S32 shape_count = gAgentWearables.getWearableCount(LLWearableType::WT_SHAPE);
S32 hair_count = gAgentWearables.getWearableCount(LLWearableType::WT_HAIR);
@@ -1620,53 +1620,53 @@ void LLAgentWearables::editWearable(const LLUUID& item_id)
return;
}
- const BOOL disable_camera_switch = LLWearableType::getInstance()->getDisableCameraSwitch(wearable->getType());
- LLPanel* panel = LLFloaterSidePanelContainer::getPanel("appearance");
- LLSidepanelAppearance::editWearable(wearable, panel, disable_camera_switch);
+ const BOOL disable_camera_switch = LLWearableType::getInstance()->getDisableCameraSwitch(wearable->getType());
+ LLPanel* panel = LLFloaterSidePanelContainer::getPanel("appearance");
+ LLSidepanelAppearance::editWearable(wearable, panel, disable_camera_switch);
}
// Request editing the item after it gets worn.
void LLAgentWearables::requestEditingWearable(const LLUUID& item_id)
{
- mItemToEdit = gInventory.getLinkedItemID(item_id);
+ mItemToEdit = gInventory.getLinkedItemID(item_id);
}
// Start editing the item if previously requested.
void LLAgentWearables::editWearableIfRequested(const LLUUID& item_id)
{
- if (mItemToEdit.notNull() &&
- mItemToEdit == gInventory.getLinkedItemID(item_id))
- {
- LLAgentWearables::editWearable(item_id);
- mItemToEdit.setNull();
- }
+ if (mItemToEdit.notNull() &&
+ mItemToEdit == gInventory.getLinkedItemID(item_id))
+ {
+ LLAgentWearables::editWearable(item_id);
+ mItemToEdit.setNull();
+ }
}
boost::signals2::connection LLAgentWearables::addLoadingStartedCallback(loading_started_callback_t cb)
{
- return mLoadingStartedSignal.connect(cb);
+ return mLoadingStartedSignal.connect(cb);
}
boost::signals2::connection LLAgentWearables::addLoadedCallback(loaded_callback_t cb)
{
- return mLoadedSignal.connect(cb);
+ return mLoadedSignal.connect(cb);
}
bool LLAgentWearables::changeInProgress() const
{
- return mCOFChangeInProgress;
+ return mCOFChangeInProgress;
}
void LLAgentWearables::notifyLoadingStarted()
{
- mCOFChangeInProgress = true;
- mCOFChangeTimer.reset();
- mLoadingStartedSignal();
+ mCOFChangeInProgress = true;
+ mCOFChangeTimer.reset();
+ mLoadingStartedSignal();
}
void LLAgentWearables::notifyLoadingFinished()
{
- mCOFChangeInProgress = false;
- mLoadedSignal();
+ mCOFChangeInProgress = false;
+ mLoadedSignal();
}
// EOF
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index e20f5df7fa..de3d91b87c 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentwearables.h
* @brief LLAgentWearables class header file
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,212 +47,212 @@ class LLViewerObject;
class LLAgentWearables : public LLInitClass<LLAgentWearables>, public LLWearableData
{
- //--------------------------------------------------------------------
- // Constructors / destructors / Initializers
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Constructors / destructors / Initializers
+ //--------------------------------------------------------------------
public:
- LLAgentWearables();
- virtual ~LLAgentWearables();
- void setAvatarObject(LLVOAvatarSelf *avatar);
- void createStandardWearables();
- void cleanup();
- void dump();
-
- // LLInitClass interface
- static void initClass();
-
- //--------------------------------------------------------------------
- // Queries
- //--------------------------------------------------------------------
+ LLAgentWearables();
+ virtual ~LLAgentWearables();
+ void setAvatarObject(LLVOAvatarSelf *avatar);
+ void createStandardWearables();
+ void cleanup();
+ void dump();
+
+ // LLInitClass interface
+ static void initClass();
+
+ //--------------------------------------------------------------------
+ // Queries
+ //--------------------------------------------------------------------
public:
- BOOL isWearingItem(const LLUUID& item_id) const;
- BOOL isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const;
- BOOL isWearableModifiable(const LLUUID& item_id) const;
-
- BOOL isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const;
- BOOL areWearablesLoaded() const;
- bool isCOFChangeInProgress() const { return mCOFChangeInProgress; }
- F32 getCOFChangeTime() const { return mCOFChangeTimer.getElapsedTimeF32(); }
- void updateWearablesLoaded();
- void checkWearablesLoaded() const;
- bool canMoveWearable(const LLUUID& item_id, bool closer_to_body) const;
-
- // Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
- bool canWearableBeRemoved(const LLViewerWearable* wearable) const;
-
- void animateAllWearableParams(F32 delta);
-
- //--------------------------------------------------------------------
- // Accessors
- //--------------------------------------------------------------------
+ BOOL isWearingItem(const LLUUID& item_id) const;
+ BOOL isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const;
+ BOOL isWearableModifiable(const LLUUID& item_id) const;
+
+ BOOL isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const;
+ BOOL areWearablesLoaded() const;
+ bool isCOFChangeInProgress() const { return mCOFChangeInProgress; }
+ F32 getCOFChangeTime() const { return mCOFChangeTimer.getElapsedTimeF32(); }
+ void updateWearablesLoaded();
+ void checkWearablesLoaded() const;
+ bool canMoveWearable(const LLUUID& item_id, bool closer_to_body) const;
+
+ // Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
+ bool canWearableBeRemoved(const LLViewerWearable* wearable) const;
+
+ void animateAllWearableParams(F32 delta);
+
+ //--------------------------------------------------------------------
+ // Accessors
+ //--------------------------------------------------------------------
public:
- const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const;
- const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
- const LLViewerWearable* getWearableFromItemID(const LLUUID& item_id) const;
- LLViewerWearable* getWearableFromItemID(const LLUUID& item_id);
- LLViewerWearable* getWearableFromAssetID(const LLUUID& asset_id);
- LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/);
- const LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
- LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/);
- static BOOL selfHasWearable(LLWearableType::EType type);
-
- //--------------------------------------------------------------------
- // Setters
- //--------------------------------------------------------------------
+ const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const;
+ const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
+ const LLViewerWearable* getWearableFromItemID(const LLUUID& item_id) const;
+ LLViewerWearable* getWearableFromItemID(const LLUUID& item_id);
+ LLViewerWearable* getWearableFromAssetID(const LLUUID& asset_id);
+ LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/);
+ const LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
+ LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/);
+ static BOOL selfHasWearable(LLWearableType::EType type);
+
+ //--------------------------------------------------------------------
+ // Setters
+ //--------------------------------------------------------------------
private:
- /*virtual*/void wearableUpdated(LLWearable *wearable, BOOL removed);
+ /*virtual*/void wearableUpdated(LLWearable *wearable, BOOL removed);
public:
- void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false);
- void setWearableOutfit(const LLInventoryItem::item_array_t& items, const std::vector< LLViewerWearable* >& wearables);
- void setWearableName(const LLUUID& item_id, const std::string& new_name);
- // *TODO: Move this into llappearance/LLWearableData ?
- void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index);
+ void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false);
+ void setWearableOutfit(const LLInventoryItem::item_array_t& items, const std::vector< LLViewerWearable* >& wearables);
+ void setWearableName(const LLUUID& item_id, const std::string& new_name);
+ // *TODO: Move this into llappearance/LLWearableData ?
+ void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index);
protected:
- void setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append = false);
- static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable);
-
- void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
- LLViewerWearable* wearable,
- const LLUUID& category_id = LLUUID::null,
- BOOL notify = TRUE);
- void addWearabletoAgentInventoryDone(const LLWearableType::EType type,
- const U32 index,
- const LLUUID& item_id,
- LLViewerWearable* wearable);
- void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/);
- void recoverMissingWearableDone();
-
- //--------------------------------------------------------------------
- // Editing/moving wearables
- //--------------------------------------------------------------------
+ void setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append = false);
+ static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable);
+
+ void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
+ LLViewerWearable* wearable,
+ const LLUUID& category_id = LLUUID::null,
+ BOOL notify = TRUE);
+ void addWearabletoAgentInventoryDone(const LLWearableType::EType type,
+ const U32 index,
+ const LLUUID& item_id,
+ LLViewerWearable* wearable);
+ void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/);
+ void recoverMissingWearableDone();
+
+ //--------------------------------------------------------------------
+ // Editing/moving wearables
+ //--------------------------------------------------------------------
public:
- static void createWearable(LLWearableType::EType type, bool wear = false, const LLUUID& parent_id = LLUUID::null, std::function<void(const LLUUID&)> created_cb = NULL);
- static void editWearable(const LLUUID& item_id);
- bool moveWearable(const LLViewerInventoryItem* item, bool closer_to_body);
+ static void createWearable(LLWearableType::EType type, bool wear = false, const LLUUID& parent_id = LLUUID::null, std::function<void(const LLUUID&)> created_cb = NULL);
+ static void editWearable(const LLUUID& item_id);
+ bool moveWearable(const LLViewerInventoryItem* item, bool closer_to_body);
- void requestEditingWearable(const LLUUID& item_id);
- void editWearableIfRequested(const LLUUID& item_id);
+ void requestEditingWearable(const LLUUID& item_id);
+ void editWearableIfRequested(const LLUUID& item_id);
private:
- LLUUID mItemToEdit;
+ LLUUID mItemToEdit;
- //--------------------------------------------------------------------
- // Removing wearables
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Removing wearables
+ //--------------------------------------------------------------------
public:
- void removeWearable(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
+ void removeWearable(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
private:
- void removeWearableFinal(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
+ void removeWearableFinal(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
protected:
- static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response);
+ static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response);
- //--------------------------------------------------------------------
- // Outfits
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Outfits
+ //--------------------------------------------------------------------
private:
- void makeNewOutfitDone(S32 type, U32 index);
-
- //--------------------------------------------------------------------
- // Save Wearables
- //--------------------------------------------------------------------
-public:
- void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, BOOL save_in_lost_and_found);
- void saveWearable(const LLWearableType::EType type, const U32 index,
- const std::string new_name = "");
- void saveAllWearables();
- void revertWearable(const LLWearableType::EType type, const U32 index);
-
- // We no longer need this message in the current viewer, but send
- // it for now to maintain compatibility with release viewers. Can
- // remove this function once the SH-3455 changesets are universally deployed.
- void sendDummyAgentWearablesUpdate();
-
- //--------------------------------------------------------------------
- // Static UI hooks
- //--------------------------------------------------------------------
+ void makeNewOutfitDone(S32 type, U32 index);
+
+ //--------------------------------------------------------------------
+ // Save Wearables
+ //--------------------------------------------------------------------
public:
- static void userRemoveWearable(const LLWearableType::EType &type, const U32 &index);
- static void userRemoveWearablesOfType(const LLWearableType::EType &type);
-
- typedef std::vector<LLViewerObject*> llvo_vec_t;
-
- static void findAttachmentsAddRemoveInfo(LLInventoryModel::item_array_t& obj_item_array,
- llvo_vec_t& objects_to_remove,
- llvo_vec_t& objects_to_retain,
- LLInventoryModel::item_array_t& items_to_add);
- static void userRemoveMultipleAttachments(llvo_vec_t& llvo_array);
- static void userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array);
-
- static llvo_vec_t getTempAttachments();
-
- //--------------------------------------------------------------------
- // Signals
- //--------------------------------------------------------------------
+ void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, BOOL save_in_lost_and_found);
+ void saveWearable(const LLWearableType::EType type, const U32 index,
+ const std::string new_name = "");
+ void saveAllWearables();
+ void revertWearable(const LLWearableType::EType type, const U32 index);
+
+ // We no longer need this message in the current viewer, but send
+ // it for now to maintain compatibility with release viewers. Can
+ // remove this function once the SH-3455 changesets are universally deployed.
+ void sendDummyAgentWearablesUpdate();
+
+ //--------------------------------------------------------------------
+ // Static UI hooks
+ //--------------------------------------------------------------------
public:
- typedef boost::function<void()> loading_started_callback_t;
- typedef boost::signals2::signal<void()> loading_started_signal_t;
- boost::signals2::connection addLoadingStartedCallback(loading_started_callback_t cb);
+ static void userRemoveWearable(const LLWearableType::EType &type, const U32 &index);
+ static void userRemoveWearablesOfType(const LLWearableType::EType &type);
- typedef boost::function<void()> loaded_callback_t;
- typedef boost::signals2::signal<void()> loaded_signal_t;
- boost::signals2::connection addLoadedCallback(loaded_callback_t cb);
+ typedef std::vector<LLViewerObject*> llvo_vec_t;
- bool changeInProgress() const;
- void notifyLoadingStarted();
- void notifyLoadingFinished();
+ static void findAttachmentsAddRemoveInfo(LLInventoryModel::item_array_t& obj_item_array,
+ llvo_vec_t& objects_to_remove,
+ llvo_vec_t& objects_to_retain,
+ LLInventoryModel::item_array_t& items_to_add);
+ static void userRemoveMultipleAttachments(llvo_vec_t& llvo_array);
+ static void userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array);
+
+ static llvo_vec_t getTempAttachments();
+
+ //--------------------------------------------------------------------
+ // Signals
+ //--------------------------------------------------------------------
+public:
+ typedef boost::function<void()> loading_started_callback_t;
+ typedef boost::signals2::signal<void()> loading_started_signal_t;
+ boost::signals2::connection addLoadingStartedCallback(loading_started_callback_t cb);
+
+ typedef boost::function<void()> loaded_callback_t;
+ typedef boost::signals2::signal<void()> loaded_signal_t;
+ boost::signals2::connection addLoadedCallback(loaded_callback_t cb);
+
+ bool changeInProgress() const;
+ void notifyLoadingStarted();
+ void notifyLoadingFinished();
private:
- loading_started_signal_t mLoadingStartedSignal; // should be called before wearables are changed
- loaded_signal_t mLoadedSignal; // emitted when all agent wearables get loaded
+ loading_started_signal_t mLoadingStartedSignal; // should be called before wearables are changed
+ loaded_signal_t mLoadedSignal; // emitted when all agent wearables get loaded
- //--------------------------------------------------------------------
- // Member variables
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Member variables
+ //--------------------------------------------------------------------
private:
- static BOOL mInitialWearablesUpdateReceived;
- BOOL mWearablesLoaded;
-
- /**
- * True if agent's outfit is being changed now.
- */
- BOOL mCOFChangeInProgress;
- LLTimer mCOFChangeTimer;
-
- //--------------------------------------------------------------------------------
- // Support classes
- //--------------------------------------------------------------------------------
+ static BOOL mInitialWearablesUpdateReceived;
+ BOOL mWearablesLoaded;
+
+ /**
+ * True if agent's outfit is being changed now.
+ */
+ BOOL mCOFChangeInProgress;
+ LLTimer mCOFChangeTimer;
+
+ //--------------------------------------------------------------------------------
+ // Support classes
+ //--------------------------------------------------------------------------------
private:
- class AddWearableToAgentInventoryCallback : public LLInventoryCallback
- {
- public:
- enum ETodo
- {
- CALL_NONE = 0,
- CALL_UPDATE = 1,
- CALL_RECOVERDONE = 2,
- CALL_CREATESTANDARDDONE = 4,
- CALL_MAKENEWOUTFITDONE = 8,
- CALL_WEARITEM = 16
- };
-
- AddWearableToAgentInventoryCallback(LLPointer<LLRefCount> cb,
- LLWearableType::EType type,
- U32 index,
- LLViewerWearable* wearable,
- U32 todo = CALL_NONE,
- const std::string description = "");
- virtual void fire(const LLUUID& inv_item);
- private:
- LLWearableType::EType mType;
- U32 mIndex;
- LLViewerWearable* mWearable;
- U32 mTodo;
- LLPointer<LLRefCount> mCB;
- std::string mDescription;
- };
+ class AddWearableToAgentInventoryCallback : public LLInventoryCallback
+ {
+ public:
+ enum ETodo
+ {
+ CALL_NONE = 0,
+ CALL_UPDATE = 1,
+ CALL_RECOVERDONE = 2,
+ CALL_CREATESTANDARDDONE = 4,
+ CALL_MAKENEWOUTFITDONE = 8,
+ CALL_WEARITEM = 16
+ };
+
+ AddWearableToAgentInventoryCallback(LLPointer<LLRefCount> cb,
+ LLWearableType::EType type,
+ U32 index,
+ LLViewerWearable* wearable,
+ U32 todo = CALL_NONE,
+ const std::string description = "");
+ virtual void fire(const LLUUID& inv_item);
+ private:
+ LLWearableType::EType mType;
+ U32 mIndex;
+ LLViewerWearable* mWearable;
+ U32 mTodo;
+ LLPointer<LLRefCount> mCB;
+ std::string mDescription;
+ };
}; // LLAgentWearables
@@ -260,6 +260,6 @@ extern LLAgentWearables gAgentWearables;
//--------------------------------------------------------------------
// Types
-//--------------------------------------------------------------------
+//--------------------------------------------------------------------
#endif // LL_AGENTWEARABLES_H
diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index f23ce13608..76271571cd 100644
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llaisapi.cpp
- * @brief classes and functions for interfacing with the v3+ ais inventory service.
+ * @brief classes and functions for interfacing with the v3+ ais inventory service.
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*
@@ -95,7 +95,7 @@ std::string AISAPI::getLibCap()
return std::string();
}
-/*static*/
+/*static*/
void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, completion_t callback)
{
std::string cap = getInvCap();
@@ -115,15 +115,15 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
std::string url = cap + std::string("/category/") + parentId.asString() + "?tid=" + tid.asString();
LL_DEBUGS("Inventory") << "url: " << url << " parentID " << parentId << " newInventory " << newInventory << LL_ENDL;
- // I may be suffering from golden hammer here, but the first part of this bind
- // is actually a static cast for &HttpCoroutineAdapter::postAndSuspend so that
+ // I may be suffering from golden hammer here, but the first part of this bind
+ // is actually a static cast for &HttpCoroutineAdapter::postAndSuspend so that
// the compiler can identify the correct signature to select.
- //
+ //
// Reads as follows:
// LLSD - method returning LLSD
// (LLCoreHttpUtil::HttpCoroutineAdapter::*) - pointer to member function of HttpCoroutineAdapter
// (LLCore::HttpRequest::ptr_t, const std::string &, const LLSD &, LLCore::HttpOptions::ptr_t, LLCore::HttpHeaders::ptr_t) - signature of method
- //
+ //
invokationFn_t postFn = boost::bind(
// Humans ignore next line. It is just a cast.
static_cast<LLSD (LLCoreHttpUtil::HttpCoroutineAdapter::*)(LLCore::HttpRequest::ptr_t, const std::string &, const LLSD &, LLCore::HttpOptions::ptr_t, LLCore::HttpHeaders::ptr_t)>
@@ -131,7 +131,7 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::postAndSuspend), _1, _2, _3, _4, _5, _6);
@@ -141,7 +141,7 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
EnqueueAISCommand("CreateInventory", proc);
}
-/*static*/
+/*static*/
void AISAPI::SlamFolder(const LLUUID& folderId, const LLSD& newInventory, completion_t callback)
{
std::string cap = getInvCap();
@@ -168,7 +168,7 @@ void AISAPI::SlamFolder(const LLUUID& folderId, const LLSD& newInventory, comple
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::putAndSuspend), _1, _2, _3, _4, _5, _6);
@@ -204,7 +204,7 @@ void AISAPI::RemoveCategory(const LLUUID &categoryId, completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::deleteAndSuspend), _1, _2, _3, _5, _6);
@@ -215,7 +215,7 @@ void AISAPI::RemoveCategory(const LLUUID &categoryId, completion_t callback)
EnqueueAISCommand("RemoveCategory", proc);
}
-/*static*/
+/*static*/
void AISAPI::RemoveItem(const LLUUID &itemId, completion_t callback)
{
std::string cap;
@@ -241,7 +241,7 @@ void AISAPI::RemoveItem(const LLUUID &itemId, completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::deleteAndSuspend), _1, _2, _3, _5, _6);
@@ -288,18 +288,18 @@ void AISAPI::CopyLibraryCategory(const LLUUID& sourceId, const LLUUID& destId, b
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::copyAndSuspend), _1, _2, _3, destination, _5, _6);
-
+
LLCoprocedureManager::CoProcedure_t proc(boost::bind(&AISAPI::InvokeAISCommandCoro,
_1, copyFn, url, destId, LLSD(), callback, COPYLIBRARYCATEGORY));
EnqueueAISCommand("CopyLibraryCategory", proc);
}
-/*static*/
+/*static*/
void AISAPI::PurgeDescendents(const LLUUID &categoryId, completion_t callback)
{
std::string cap;
@@ -325,7 +325,7 @@ void AISAPI::PurgeDescendents(const LLUUID &categoryId, completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::deleteAndSuspend), _1, _2, _3, _5, _6);
@@ -361,7 +361,7 @@ void AISAPI::UpdateCategory(const LLUUID &categoryId, const LLSD &updates, compl
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::patchAndSuspend), _1, _2, _3, _4, _5, _6);
@@ -397,7 +397,7 @@ void AISAPI::UpdateItem(const LLUUID &itemId, const LLSD &updates, completion_t
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::patchAndSuspend), _1, _2, _3, _4, _5, _6);
@@ -411,36 +411,36 @@ void AISAPI::UpdateItem(const LLUUID &itemId, const LLSD &updates, completion_t
/*static*/
void AISAPI::FetchItem(const LLUUID &itemId, ITEM_TYPE type, completion_t callback)
{
- std::string cap;
+ std::string cap;
- cap = (type == INVENTORY) ? getInvCap() : getLibCap();
- if (cap.empty())
- {
- LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL;
+ cap = (type == INVENTORY) ? getInvCap() : getLibCap();
+ if (cap.empty())
+ {
+ LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL;
if (callback)
{
callback(LLUUID::null);
}
- return;
- }
- std::string url = cap + std::string("/item/") + itemId.asString();
-
- invokationFn_t getFn = boost::bind(
- // Humans ignore next line. It is just a cast to specify which LLCoreHttpUtil::HttpCoroutineAdapter routine overload.
- static_cast<LLSD(LLCoreHttpUtil::HttpCoroutineAdapter::*)(LLCore::HttpRequest::ptr_t, const std::string &, LLCore::HttpOptions::ptr_t, LLCore::HttpHeaders::ptr_t)>
- //----
- // _1 -> httpAdapter
- // _2 -> httpRequest
- // _3 -> url
- // _4 -> body
- // _5 -> httpOptions
- // _6 -> httpHeaders
- (&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
-
- LLCoprocedureManager::CoProcedure_t proc(boost::bind(&AISAPI::InvokeAISCommandCoro,
- _1, getFn, url, itemId, LLSD(), callback, FETCHITEM));
-
- EnqueueAISCommand("FetchItem", proc);
+ return;
+ }
+ std::string url = cap + std::string("/item/") + itemId.asString();
+
+ invokationFn_t getFn = boost::bind(
+ // Humans ignore next line. It is just a cast to specify which LLCoreHttpUtil::HttpCoroutineAdapter routine overload.
+ static_cast<LLSD(LLCoreHttpUtil::HttpCoroutineAdapter::*)(LLCore::HttpRequest::ptr_t, const std::string &, LLCore::HttpOptions::ptr_t, LLCore::HttpHeaders::ptr_t)>
+ //----
+ // _1 -> httpAdapter
+ // _2 -> httpRequest
+ // _3 -> url
+ // _4 -> body
+ // _5 -> httpOptions
+ // _6 -> httpHeaders
+ (&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
+
+ LLCoprocedureManager::CoProcedure_t proc(boost::bind(&AISAPI::InvokeAISCommandCoro,
+ _1, getFn, url, itemId, LLSD(), callback, FETCHITEM));
+
+ EnqueueAISCommand("FetchItem", proc);
}
/*static*/
@@ -480,7 +480,7 @@ void AISAPI::FetchCategoryChildren(const LLUUID &catId, ITEM_TYPE type, bool rec
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -533,7 +533,7 @@ void AISAPI::FetchCategoryChildren(const std::string &identifier, bool recursive
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -584,7 +584,7 @@ void AISAPI::FetchCategoryCategories(const LLUUID &catId, ITEM_TYPE type, bool r
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -661,7 +661,7 @@ void AISAPI::FetchCategorySubset(const LLUUID& catId,
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -698,7 +698,7 @@ void AISAPI::FetchCOF(completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6);
@@ -771,7 +771,7 @@ void AISAPI::FetchOrphans(completion_t callback)
// _1 -> httpAdapter
// _2 -> httpRequest
// _3 -> url
- // _4 -> body
+ // _4 -> body
// _5 -> httpOptions
// _6 -> httpHeaders
(&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend) , _1 , _2 , _3 , _5 , _6);
@@ -824,7 +824,7 @@ void AISAPI::onIdle(void *userdata)
pending_in_pool++;
}
}
-
+
if (sPostponedQuery.empty())
{
// Nothing to do anymore
@@ -848,8 +848,8 @@ void AISAPI::onUpdateReceived(const LLSD& update, COMMAND_TYPE type, const LLSD&
}
/*static*/
-void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter,
- invokationFn_t invoke, std::string url,
+void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter,
+ invokationFn_t invoke, std::string url,
LLUUID targetId, LLSD body, completion_t callback, COMMAND_TYPE type)
{
if (gDisconnected)
@@ -947,7 +947,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
LL_WARNS("Inventory") << ll_pretty_print_sd(result) << LL_ENDL;
}
- LL_DEBUGS("Inventory", "AIS3") << "Result: " << result << LL_ENDL;
+ LL_DEBUGS("Inventory", "AIS3") << "Result: " << result << LL_ENDL;
onUpdateReceived(result, type, body);
if (callback && !callback.empty())
@@ -1038,22 +1038,22 @@ AISUpdate::AISUpdate(const LLSD& update, AISAPI::COMMAND_TYPE type, const LLSD&
mTimer.setTimerExpirySec(AIS_EXPIRY_SECONDS);
mTimer.start();
- parseUpdate(update);
+ parseUpdate(update);
}
void AISUpdate::clearParseResults()
{
- mCatDescendentDeltas.clear();
- mCatDescendentsKnown.clear();
- mCatVersionsUpdated.clear();
- mItemsCreated.clear();
+ mCatDescendentDeltas.clear();
+ mCatDescendentsKnown.clear();
+ mCatVersionsUpdated.clear();
+ mItemsCreated.clear();
mItemsLost.clear();
- mItemsUpdated.clear();
- mCategoriesCreated.clear();
- mCategoriesUpdated.clear();
- mObjectsDeletedIds.clear();
- mItemIds.clear();
- mCategoryIds.clear();
+ mItemsUpdated.clear();
+ mCategoriesCreated.clear();
+ mCategoriesUpdated.clear();
+ mObjectsDeletedIds.clear();
+ mItemIds.clear();
+ mCategoryIds.clear();
}
void AISUpdate::checkTimeout()
@@ -1068,87 +1068,87 @@ void AISUpdate::checkTimeout()
void AISUpdate::parseUpdate(const LLSD& update)
{
- clearParseResults();
- parseMeta(update);
- parseContent(update);
+ clearParseResults();
+ parseMeta(update);
+ parseContent(update);
}
void AISUpdate::parseMeta(const LLSD& update)
{
- // parse _categories_removed -> mObjectsDeletedIds
- uuid_list_t cat_ids;
- parseUUIDArray(update,"_categories_removed",cat_ids);
- for (uuid_list_t::const_iterator it = cat_ids.begin();
- it != cat_ids.end(); ++it)
- {
- LLViewerInventoryCategory *cat = gInventory.getCategory(*it);
- if(cat)
- {
- mCatDescendentDeltas[cat->getParentUUID()]--;
- mObjectsDeletedIds.insert(*it);
- }
- else
- {
- LL_WARNS("Inventory") << "removed category not found " << *it << LL_ENDL;
- }
- }
-
- // parse _categories_items_removed -> mObjectsDeletedIds
- uuid_list_t item_ids;
- parseUUIDArray(update,"_category_items_removed",item_ids);
- parseUUIDArray(update,"_removed_items",item_ids);
- for (uuid_list_t::const_iterator it = item_ids.begin();
- it != item_ids.end(); ++it)
- {
- LLViewerInventoryItem *item = gInventory.getItem(*it);
- if(item)
- {
- mCatDescendentDeltas[item->getParentUUID()]--;
- mObjectsDeletedIds.insert(*it);
- }
- else
- {
- LL_WARNS("Inventory") << "removed item not found " << *it << LL_ENDL;
- }
- }
-
- // parse _broken_links_removed -> mObjectsDeletedIds
- uuid_list_t broken_link_ids;
- parseUUIDArray(update,"_broken_links_removed",broken_link_ids);
- for (uuid_list_t::const_iterator it = broken_link_ids.begin();
- it != broken_link_ids.end(); ++it)
- {
- LLViewerInventoryItem *item = gInventory.getItem(*it);
- if(item)
- {
- mCatDescendentDeltas[item->getParentUUID()]--;
- mObjectsDeletedIds.insert(*it);
- }
- else
- {
- LL_WARNS("Inventory") << "broken link not found " << *it << LL_ENDL;
- }
- }
-
- // parse _created_items
- parseUUIDArray(update,"_created_items",mItemIds);
-
- // parse _created_categories
- parseUUIDArray(update,"_created_categories",mCategoryIds);
-
- // Parse updated category versions.
- const std::string& ucv = "_updated_category_versions";
- if (update.has(ucv))
- {
- for(LLSD::map_const_iterator it = update[ucv].beginMap(),
- end = update[ucv].endMap();
- it != end; ++it)
- {
- const LLUUID id((*it).first);
- S32 version = (*it).second.asInteger();
- mCatVersionsUpdated[id] = version;
- }
- }
+ // parse _categories_removed -> mObjectsDeletedIds
+ uuid_list_t cat_ids;
+ parseUUIDArray(update,"_categories_removed",cat_ids);
+ for (uuid_list_t::const_iterator it = cat_ids.begin();
+ it != cat_ids.end(); ++it)
+ {
+ LLViewerInventoryCategory *cat = gInventory.getCategory(*it);
+ if(cat)
+ {
+ mCatDescendentDeltas[cat->getParentUUID()]--;
+ mObjectsDeletedIds.insert(*it);
+ }
+ else
+ {
+ LL_WARNS("Inventory") << "removed category not found " << *it << LL_ENDL;
+ }
+ }
+
+ // parse _categories_items_removed -> mObjectsDeletedIds
+ uuid_list_t item_ids;
+ parseUUIDArray(update,"_category_items_removed",item_ids);
+ parseUUIDArray(update,"_removed_items",item_ids);
+ for (uuid_list_t::const_iterator it = item_ids.begin();
+ it != item_ids.end(); ++it)
+ {
+ LLViewerInventoryItem *item = gInventory.getItem(*it);
+ if(item)
+ {
+ mCatDescendentDeltas[item->getParentUUID()]--;
+ mObjectsDeletedIds.insert(*it);
+ }
+ else
+ {
+ LL_WARNS("Inventory") << "removed item not found " << *it << LL_ENDL;
+ }
+ }
+
+ // parse _broken_links_removed -> mObjectsDeletedIds
+ uuid_list_t broken_link_ids;
+ parseUUIDArray(update,"_broken_links_removed",broken_link_ids);
+ for (uuid_list_t::const_iterator it = broken_link_ids.begin();
+ it != broken_link_ids.end(); ++it)
+ {
+ LLViewerInventoryItem *item = gInventory.getItem(*it);
+ if(item)
+ {
+ mCatDescendentDeltas[item->getParentUUID()]--;
+ mObjectsDeletedIds.insert(*it);
+ }
+ else
+ {
+ LL_WARNS("Inventory") << "broken link not found " << *it << LL_ENDL;
+ }
+ }
+
+ // parse _created_items
+ parseUUIDArray(update,"_created_items",mItemIds);
+
+ // parse _created_categories
+ parseUUIDArray(update,"_created_categories",mCategoryIds);
+
+ // Parse updated category versions.
+ const std::string& ucv = "_updated_category_versions";
+ if (update.has(ucv))
+ {
+ for(LLSD::map_const_iterator it = update[ucv].beginMap(),
+ end = update[ucv].endMap();
+ it != end; ++it)
+ {
+ const LLUUID id((*it).first);
+ S32 version = (*it).second.asInteger();
+ mCatVersionsUpdated[id] = version;
+ }
+ }
}
void AISUpdate::parseContent(const LLSD& update)
@@ -1157,14 +1157,14 @@ void AISUpdate::parseContent(const LLSD& update)
// full item or folder.
// Todo: Depending on error we might want to do something,
// like removing a 404 item or refetching parent folder
- if (update.has("linked_id") && update.has("parent_id"))
- {
- parseLink(update, mFetchDepth);
- }
- else if (update.has("item_id") && update.has("parent_id"))
- {
- parseItem(update);
- }
+ if (update.has("linked_id") && update.has("parent_id"))
+ {
+ parseLink(update, mFetchDepth);
+ }
+ else if (update.has("item_id") && update.has("parent_id"))
+ {
+ parseItem(update);
+ }
if (mType == AISAPI::FETCHCATEGORYSUBSET)
{
@@ -1179,28 +1179,28 @@ void AISUpdate::parseContent(const LLSD& update)
{
parseCategory(update, mFetchDepth);
}
- else
- {
- if (update.has("_embedded"))
- {
- parseEmbedded(update["_embedded"], mFetchDepth);
- }
- }
+ else
+ {
+ if (update.has("_embedded"))
+ {
+ parseEmbedded(update["_embedded"], mFetchDepth);
+ }
+ }
}
void AISUpdate::parseItem(const LLSD& item_map)
{
- LLUUID item_id = item_map["item_id"].asUUID();
- LLPointer<LLViewerInventoryItem> new_item(new LLViewerInventoryItem);
- LLViewerInventoryItem *curr_item = gInventory.getItem(item_id);
- if (curr_item)
- {
- // Default to current values where not provided.
- new_item->copyViewerItem(curr_item);
- }
- BOOL rv = new_item->unpackMessage(item_map);
- if (rv)
- {
+ LLUUID item_id = item_map["item_id"].asUUID();
+ LLPointer<LLViewerInventoryItem> new_item(new LLViewerInventoryItem);
+ LLViewerInventoryItem *curr_item = gInventory.getItem(item_id);
+ if (curr_item)
+ {
+ // Default to current values where not provided.
+ new_item->copyViewerItem(curr_item);
+ }
+ BOOL rv = new_item->unpackMessage(item_map);
+ if (rv)
+ {
if (mFetch)
{
mItemsCreated[item_id] = new_item;
@@ -1212,41 +1212,41 @@ void AISUpdate::parseItem(const LLSD& item_map)
}
}
else if (curr_item)
- {
- mItemsUpdated[item_id] = new_item;
- // This statement is here to cause a new entry with 0
- // delta to be created if it does not already exist;
- // otherwise has no effect.
- mCatDescendentDeltas[new_item->getParentUUID()];
- }
- else
- {
- mItemsCreated[item_id] = new_item;
- mCatDescendentDeltas[new_item->getParentUUID()]++;
+ {
+ mItemsUpdated[item_id] = new_item;
+ // This statement is here to cause a new entry with 0
+ // delta to be created if it does not already exist;
+ // otherwise has no effect.
+ mCatDescendentDeltas[new_item->getParentUUID()];
+ }
+ else
+ {
+ mItemsCreated[item_id] = new_item;
+ mCatDescendentDeltas[new_item->getParentUUID()]++;
new_item->setComplete(true);
- }
- }
- else
- {
- // *TODO: Wow, harsh. Should we just complain and get out?
- LL_ERRS() << "unpack failed" << LL_ENDL;
- }
+ }
+ }
+ else
+ {
+ // *TODO: Wow, harsh. Should we just complain and get out?
+ LL_ERRS() << "unpack failed" << LL_ENDL;
+ }
}
void AISUpdate::parseLink(const LLSD& link_map, S32 depth)
{
- LLUUID item_id = link_map["item_id"].asUUID();
- LLPointer<LLViewerInventoryItem> new_link(new LLViewerInventoryItem);
- LLViewerInventoryItem *curr_link = gInventory.getItem(item_id);
- if (curr_link)
- {
- // Default to current values where not provided.
- new_link->copyViewerItem(curr_link);
- }
- BOOL rv = new_link->unpackMessage(link_map);
- if (rv)
- {
- const LLUUID& parent_id = new_link->getParentUUID();
+ LLUUID item_id = link_map["item_id"].asUUID();
+ LLPointer<LLViewerInventoryItem> new_link(new LLViewerInventoryItem);
+ LLViewerInventoryItem *curr_link = gInventory.getItem(item_id);
+ if (curr_link)
+ {
+ // Default to current values where not provided.
+ new_link->copyViewerItem(curr_link);
+ }
+ BOOL rv = new_link->unpackMessage(link_map);
+ if (rv)
+ {
+ const LLUUID& parent_id = new_link->getParentUUID();
if (mFetch)
{
LLPermissions default_perms;
@@ -1264,38 +1264,38 @@ void AISUpdate::parseLink(const LLSD& link_map, S32 depth)
mItemsLost[item_id] = new_link;
}
}
- else if (curr_link)
- {
- mItemsUpdated[item_id] = new_link;
- // This statement is here to cause a new entry with 0
- // delta to be created if it does not already exist;
- // otherwise has no effect.
- mCatDescendentDeltas[parent_id];
- }
- else
- {
- LLPermissions default_perms;
- default_perms.init(gAgent.getID(),gAgent.getID(),LLUUID::null,LLUUID::null);
- default_perms.initMasks(PERM_NONE,PERM_NONE,PERM_NONE,PERM_NONE,PERM_NONE);
- new_link->setPermissions(default_perms);
- LLSaleInfo default_sale_info;
- new_link->setSaleInfo(default_sale_info);
- //LL_DEBUGS("Inventory") << "creating link from llsd: " << ll_pretty_print_sd(link_map) << LL_ENDL;
- mItemsCreated[item_id] = new_link;
- mCatDescendentDeltas[parent_id]++;
+ else if (curr_link)
+ {
+ mItemsUpdated[item_id] = new_link;
+ // This statement is here to cause a new entry with 0
+ // delta to be created if it does not already exist;
+ // otherwise has no effect.
+ mCatDescendentDeltas[parent_id];
+ }
+ else
+ {
+ LLPermissions default_perms;
+ default_perms.init(gAgent.getID(),gAgent.getID(),LLUUID::null,LLUUID::null);
+ default_perms.initMasks(PERM_NONE,PERM_NONE,PERM_NONE,PERM_NONE,PERM_NONE);
+ new_link->setPermissions(default_perms);
+ LLSaleInfo default_sale_info;
+ new_link->setSaleInfo(default_sale_info);
+ //LL_DEBUGS("Inventory") << "creating link from llsd: " << ll_pretty_print_sd(link_map) << LL_ENDL;
+ mItemsCreated[item_id] = new_link;
+ mCatDescendentDeltas[parent_id]++;
new_link->setComplete(true);
- }
+ }
if (link_map.has("_embedded"))
{
parseEmbedded(link_map["_embedded"], depth);
}
- }
- else
- {
- // *TODO: Wow, harsh. Should we just complain and get out?
- LL_ERRS() << "unpack failed" << LL_ENDL;
- }
+ }
+ else
+ {
+ // *TODO: Wow, harsh. Should we just complain and get out?
+ LL_ERRS() << "unpack failed" << LL_ENDL;
+ }
}
@@ -1322,10 +1322,10 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth)
return;
}
- LLPointer<LLViewerInventoryCategory> new_cat;
- if (curr_cat)
- {
- // Default to current values where not provided.
+ LLPointer<LLViewerInventoryCategory> new_cat;
+ if (curr_cat)
+ {
+ // Default to current values where not provided.
new_cat = new LLViewerInventoryCategory(curr_cat);
}
else
@@ -1340,10 +1340,10 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth)
new_cat = new LLViewerInventoryCategory(LLUUID::null);
}
}
- BOOL rv = new_cat->unpackMessage(category_map);
- // *NOTE: unpackMessage does not unpack version or descendent count.
- if (rv)
- {
+ BOOL rv = new_cat->unpackMessage(category_map);
+ // *NOTE: unpackMessage does not unpack version or descendent count.
+ if (rv)
+ {
// Check descendent count first, as it may be needed
// to populate newly created categories
if (category_map.has("_embedded"))
@@ -1393,19 +1393,19 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth)
}
mCategoriesCreated[category_id] = new_cat;
}
- else if (curr_cat)
- {
- mCategoriesUpdated[category_id] = new_cat;
- // This statement is here to cause a new entry with 0
- // delta to be created if it does not already exist;
- // otherwise has no effect.
- mCatDescendentDeltas[new_cat->getParentUUID()];
- // Capture update for the category itself as well.
- mCatDescendentDeltas[category_id];
- }
- else
- {
- // Set version/descendents for newly created categories.
+ else if (curr_cat)
+ {
+ mCategoriesUpdated[category_id] = new_cat;
+ // This statement is here to cause a new entry with 0
+ // delta to be created if it does not already exist;
+ // otherwise has no effect.
+ mCatDescendentDeltas[new_cat->getParentUUID()];
+ // Capture update for the category itself as well.
+ mCatDescendentDeltas[category_id];
+ }
+ else
+ {
+ // Set version/descendents for newly created categories.
uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id);
if (mCatDescendentsKnown.end() != lookup_it)
{
@@ -1422,22 +1422,22 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth)
<< " for new category " << category_id << LL_ENDL;
new_cat->setVersion(version);
}
- }
- mCategoriesCreated[category_id] = new_cat;
- mCatDescendentDeltas[new_cat->getParentUUID()]++;
- }
- }
- else
- {
- // *TODO: Wow, harsh. Should we just complain and get out?
- LL_ERRS() << "unpack failed" << LL_ENDL;
- }
-
- // Check for more embedded content.
- if (category_map.has("_embedded"))
- {
- parseEmbedded(category_map["_embedded"], depth - 1);
- }
+ }
+ mCategoriesCreated[category_id] = new_cat;
+ mCatDescendentDeltas[new_cat->getParentUUID()]++;
+ }
+ }
+ else
+ {
+ // *TODO: Wow, harsh. Should we just complain and get out?
+ LL_ERRS() << "unpack failed" << LL_ENDL;
+ }
+
+ // Check for more embedded content.
+ if (category_map.has("_embedded"))
+ {
+ parseEmbedded(category_map["_embedded"], depth - 1);
+ }
}
void AISUpdate::parseDescendentCount(const LLUUID& category_id, LLFolderType::EType type, const LLSD& embedded)
@@ -1462,178 +1462,178 @@ void AISUpdate::parseEmbedded(const LLSD& embedded, S32 depth)
{
checkTimeout();
- if (embedded.has("links")) // _embedded in a category
- {
- parseEmbeddedLinks(embedded["links"], depth);
- }
- if (embedded.has("items")) // _embedded in a category
- {
- parseEmbeddedItems(embedded["items"]);
- }
- if (embedded.has("item")) // _embedded in a link
- {
- parseEmbeddedItem(embedded["item"]);
- }
- if (embedded.has("categories")) // _embedded in a category
- {
- parseEmbeddedCategories(embedded["categories"], depth);
- }
- if (embedded.has("category")) // _embedded in a link
- {
- parseEmbeddedCategory(embedded["category"], depth);
- }
+ if (embedded.has("links")) // _embedded in a category
+ {
+ parseEmbeddedLinks(embedded["links"], depth);
+ }
+ if (embedded.has("items")) // _embedded in a category
+ {
+ parseEmbeddedItems(embedded["items"]);
+ }
+ if (embedded.has("item")) // _embedded in a link
+ {
+ parseEmbeddedItem(embedded["item"]);
+ }
+ if (embedded.has("categories")) // _embedded in a category
+ {
+ parseEmbeddedCategories(embedded["categories"], depth);
+ }
+ if (embedded.has("category")) // _embedded in a link
+ {
+ parseEmbeddedCategory(embedded["category"], depth);
+ }
}
void AISUpdate::parseUUIDArray(const LLSD& content, const std::string& name, uuid_list_t& ids)
{
- if (content.has(name))
- {
- for(LLSD::array_const_iterator it = content[name].beginArray(),
- end = content[name].endArray();
- it != end; ++it)
- {
- ids.insert((*it).asUUID());
- }
- }
+ if (content.has(name))
+ {
+ for(LLSD::array_const_iterator it = content[name].beginArray(),
+ end = content[name].endArray();
+ it != end; ++it)
+ {
+ ids.insert((*it).asUUID());
+ }
+ }
}
void AISUpdate::parseEmbeddedLinks(const LLSD& links, S32 depth)
{
- for(LLSD::map_const_iterator linkit = links.beginMap(),
- linkend = links.endMap();
- linkit != linkend; ++linkit)
- {
- const LLUUID link_id((*linkit).first);
- const LLSD& link_map = (*linkit).second;
- if (!mFetch && mItemIds.end() == mItemIds.find(link_id))
- {
- LL_DEBUGS("Inventory") << "Ignoring link not in items list " << link_id << LL_ENDL;
- }
- else
- {
- parseLink(link_map, depth);
- }
- }
+ for(LLSD::map_const_iterator linkit = links.beginMap(),
+ linkend = links.endMap();
+ linkit != linkend; ++linkit)
+ {
+ const LLUUID link_id((*linkit).first);
+ const LLSD& link_map = (*linkit).second;
+ if (!mFetch && mItemIds.end() == mItemIds.find(link_id))
+ {
+ LL_DEBUGS("Inventory") << "Ignoring link not in items list " << link_id << LL_ENDL;
+ }
+ else
+ {
+ parseLink(link_map, depth);
+ }
+ }
}
void AISUpdate::parseEmbeddedItem(const LLSD& item)
{
- // a single item (_embedded in a link)
- if (item.has("item_id"))
- {
- if (mFetch || mItemIds.end() != mItemIds.find(item["item_id"].asUUID()))
- {
- parseItem(item);
- }
- }
+ // a single item (_embedded in a link)
+ if (item.has("item_id"))
+ {
+ if (mFetch || mItemIds.end() != mItemIds.find(item["item_id"].asUUID()))
+ {
+ parseItem(item);
+ }
+ }
}
void AISUpdate::parseEmbeddedItems(const LLSD& items)
{
- // a map of items (_embedded in a category)
- for(LLSD::map_const_iterator itemit = items.beginMap(),
- itemend = items.endMap();
- itemit != itemend; ++itemit)
- {
- const LLUUID item_id((*itemit).first);
- const LLSD& item_map = (*itemit).second;
- if (!mFetch && mItemIds.end() == mItemIds.find(item_id))
- {
- LL_DEBUGS("Inventory") << "Ignoring item not in items list " << item_id << LL_ENDL;
- }
- else
- {
- parseItem(item_map);
- }
- }
+ // a map of items (_embedded in a category)
+ for(LLSD::map_const_iterator itemit = items.beginMap(),
+ itemend = items.endMap();
+ itemit != itemend; ++itemit)
+ {
+ const LLUUID item_id((*itemit).first);
+ const LLSD& item_map = (*itemit).second;
+ if (!mFetch && mItemIds.end() == mItemIds.find(item_id))
+ {
+ LL_DEBUGS("Inventory") << "Ignoring item not in items list " << item_id << LL_ENDL;
+ }
+ else
+ {
+ parseItem(item_map);
+ }
+ }
}
void AISUpdate::parseEmbeddedCategory(const LLSD& category, S32 depth)
{
- // a single category (_embedded in a link)
- if (category.has("category_id"))
- {
- if (mFetch || mCategoryIds.end() != mCategoryIds.find(category["category_id"].asUUID()))
- {
- parseCategory(category, depth);
- }
- }
+ // a single category (_embedded in a link)
+ if (category.has("category_id"))
+ {
+ if (mFetch || mCategoryIds.end() != mCategoryIds.find(category["category_id"].asUUID()))
+ {
+ parseCategory(category, depth);
+ }
+ }
}
void AISUpdate::parseEmbeddedCategories(const LLSD& categories, S32 depth)
{
- // a map of categories (_embedded in a category)
- for(LLSD::map_const_iterator categoryit = categories.beginMap(),
- categoryend = categories.endMap();
- categoryit != categoryend; ++categoryit)
- {
- const LLUUID category_id((*categoryit).first);
- const LLSD& category_map = (*categoryit).second;
- if (!mFetch && mCategoryIds.end() == mCategoryIds.find(category_id))
- {
- LL_DEBUGS("Inventory") << "Ignoring category not in categories list " << category_id << LL_ENDL;
- }
- else
- {
- parseCategory(category_map, depth);
- }
- }
+ // a map of categories (_embedded in a category)
+ for(LLSD::map_const_iterator categoryit = categories.beginMap(),
+ categoryend = categories.endMap();
+ categoryit != categoryend; ++categoryit)
+ {
+ const LLUUID category_id((*categoryit).first);
+ const LLSD& category_map = (*categoryit).second;
+ if (!mFetch && mCategoryIds.end() == mCategoryIds.find(category_id))
+ {
+ LL_DEBUGS("Inventory") << "Ignoring category not in categories list " << category_id << LL_ENDL;
+ }
+ else
+ {
+ parseCategory(category_map, depth);
+ }
+ }
}
void AISUpdate::doUpdate()
{
checkTimeout();
- // Do version/descendant accounting.
- for (std::map<LLUUID,S32>::const_iterator catit = mCatDescendentDeltas.begin();
- catit != mCatDescendentDeltas.end(); ++catit)
- {
- LL_DEBUGS("Inventory") << "descendant accounting for " << catit->first << LL_ENDL;
-
- const LLUUID cat_id(catit->first);
- // Don't account for update if we just created this category.
- if (mCategoriesCreated.find(cat_id) != mCategoriesCreated.end())
- {
- LL_DEBUGS("Inventory") << "Skipping version increment for new category " << cat_id << LL_ENDL;
- continue;
- }
-
- // Don't account for update unless AIS told us it updated that category.
- if (mCatVersionsUpdated.find(cat_id) == mCatVersionsUpdated.end())
- {
- LL_DEBUGS("Inventory") << "Skipping version increment for non-updated category " << cat_id << LL_ENDL;
- continue;
- }
-
- // If we have a known descendant count, set that now.
- LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
- if (cat)
- {
- S32 descendent_delta = catit->second;
- S32 old_count = cat->getDescendentCount();
- LL_DEBUGS("Inventory") << "Updating descendant count for "
- << cat->getName() << " " << cat_id
- << " with delta " << descendent_delta << " from "
- << old_count << " to " << (old_count+descendent_delta) << LL_ENDL;
- LLInventoryModel::LLCategoryUpdate up(cat_id, descendent_delta);
- gInventory.accountForUpdate(up);
- }
- else
- {
- LL_DEBUGS("Inventory") << "Skipping version accounting for unknown category " << cat_id << LL_ENDL;
- }
- }
-
- // CREATE CATEGORIES
+ // Do version/descendant accounting.
+ for (std::map<LLUUID,S32>::const_iterator catit = mCatDescendentDeltas.begin();
+ catit != mCatDescendentDeltas.end(); ++catit)
+ {
+ LL_DEBUGS("Inventory") << "descendant accounting for " << catit->first << LL_ENDL;
+
+ const LLUUID cat_id(catit->first);
+ // Don't account for update if we just created this category.
+ if (mCategoriesCreated.find(cat_id) != mCategoriesCreated.end())
+ {
+ LL_DEBUGS("Inventory") << "Skipping version increment for new category " << cat_id << LL_ENDL;
+ continue;
+ }
+
+ // Don't account for update unless AIS told us it updated that category.
+ if (mCatVersionsUpdated.find(cat_id) == mCatVersionsUpdated.end())
+ {
+ LL_DEBUGS("Inventory") << "Skipping version increment for non-updated category " << cat_id << LL_ENDL;
+ continue;
+ }
+
+ // If we have a known descendant count, set that now.
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (cat)
+ {
+ S32 descendent_delta = catit->second;
+ S32 old_count = cat->getDescendentCount();
+ LL_DEBUGS("Inventory") << "Updating descendant count for "
+ << cat->getName() << " " << cat_id
+ << " with delta " << descendent_delta << " from "
+ << old_count << " to " << (old_count+descendent_delta) << LL_ENDL;
+ LLInventoryModel::LLCategoryUpdate up(cat_id, descendent_delta);
+ gInventory.accountForUpdate(up);
+ }
+ else
+ {
+ LL_DEBUGS("Inventory") << "Skipping version accounting for unknown category " << cat_id << LL_ENDL;
+ }
+ }
+
+ // CREATE CATEGORIES
const S32 MAX_UPDATE_BACKLOG = 50; // stall prevention
- for (deferred_category_map_t::const_iterator create_it = mCategoriesCreated.begin();
- create_it != mCategoriesCreated.end(); ++create_it)
- {
- LLUUID category_id(create_it->first);
- LLPointer<LLViewerInventoryCategory> new_category = create_it->second;
+ for (deferred_category_map_t::const_iterator create_it = mCategoriesCreated.begin();
+ create_it != mCategoriesCreated.end(); ++create_it)
+ {
+ LLUUID category_id(create_it->first);
+ LLPointer<LLViewerInventoryCategory> new_category = create_it->second;
- gInventory.updateCategory(new_category, LLInventoryObserver::CREATE);
- LL_DEBUGS("Inventory") << "created category " << category_id << LL_ENDL;
+ gInventory.updateCategory(new_category, LLInventoryObserver::CREATE);
+ LL_DEBUGS("Inventory") << "created category " << category_id << LL_ENDL;
// fetching can receive massive amount of items and folders
if (gInventory.getChangedIDs().size() > MAX_UPDATE_BACKLOG)
@@ -1641,29 +1641,29 @@ void AISUpdate::doUpdate()
gInventory.notifyObservers();
checkTimeout();
}
- }
-
- // UPDATE CATEGORIES
- for (deferred_category_map_t::const_iterator update_it = mCategoriesUpdated.begin();
- update_it != mCategoriesUpdated.end(); ++update_it)
- {
- LLUUID category_id(update_it->first);
- LLPointer<LLViewerInventoryCategory> new_category = update_it->second;
- // Since this is a copy of the category *before* the accounting update, above,
- // we need to transfer back the updated version/descendant count.
- LLViewerInventoryCategory* curr_cat = gInventory.getCategory(new_category->getUUID());
- if (!curr_cat)
- {
- LL_WARNS("Inventory") << "Failed to update unknown category " << new_category->getUUID() << LL_ENDL;
- }
- else
- {
- new_category->setVersion(curr_cat->getVersion());
- new_category->setDescendentCount(curr_cat->getDescendentCount());
- gInventory.updateCategory(new_category);
- LL_DEBUGS("Inventory") << "updated category " << new_category->getName() << " " << category_id << LL_ENDL;
- }
- }
+ }
+
+ // UPDATE CATEGORIES
+ for (deferred_category_map_t::const_iterator update_it = mCategoriesUpdated.begin();
+ update_it != mCategoriesUpdated.end(); ++update_it)
+ {
+ LLUUID category_id(update_it->first);
+ LLPointer<LLViewerInventoryCategory> new_category = update_it->second;
+ // Since this is a copy of the category *before* the accounting update, above,
+ // we need to transfer back the updated version/descendant count.
+ LLViewerInventoryCategory* curr_cat = gInventory.getCategory(new_category->getUUID());
+ if (!curr_cat)
+ {
+ LL_WARNS("Inventory") << "Failed to update unknown category " << new_category->getUUID() << LL_ENDL;
+ }
+ else
+ {
+ new_category->setVersion(curr_cat->getVersion());
+ new_category->setDescendentCount(curr_cat->getDescendentCount());
+ gInventory.updateCategory(new_category);
+ LL_DEBUGS("Inventory") << "updated category " << new_category->getName() << " " << category_id << LL_ENDL;
+ }
+ }
// LOST ITEMS
if (!mItemsLost.empty())
@@ -1683,18 +1683,18 @@ void AISUpdate::doUpdate()
}
}
- // CREATE ITEMS
- for (deferred_item_map_t::const_iterator create_it = mItemsCreated.begin();
- create_it != mItemsCreated.end(); ++create_it)
- {
- LLUUID item_id(create_it->first);
- LLPointer<LLViewerInventoryItem> new_item = create_it->second;
+ // CREATE ITEMS
+ for (deferred_item_map_t::const_iterator create_it = mItemsCreated.begin();
+ create_it != mItemsCreated.end(); ++create_it)
+ {
+ LLUUID item_id(create_it->first);
+ LLPointer<LLViewerInventoryItem> new_item = create_it->second;
- // FIXME risky function since it calls updateServer() in some
- // cases. Maybe break out the update/create cases, in which
- // case this is create.
- LL_DEBUGS("Inventory") << "created item " << item_id << LL_ENDL;
- gInventory.updateItem(new_item, LLInventoryObserver::CREATE);
+ // FIXME risky function since it calls updateServer() in some
+ // cases. Maybe break out the update/create cases, in which
+ // case this is create.
+ LL_DEBUGS("Inventory") << "created item " << item_id << LL_ENDL;
+ gInventory.updateItem(new_item, LLInventoryObserver::CREATE);
// fetching can receive massive amount of items and folders
if (gInventory.getChangedIDs().size() > MAX_UPDATE_BACKLOG)
@@ -1702,48 +1702,48 @@ void AISUpdate::doUpdate()
gInventory.notifyObservers();
checkTimeout();
}
- }
-
- // UPDATE ITEMS
- for (deferred_item_map_t::const_iterator update_it = mItemsUpdated.begin();
- update_it != mItemsUpdated.end(); ++update_it)
- {
- LLUUID item_id(update_it->first);
- LLPointer<LLViewerInventoryItem> new_item = update_it->second;
- // FIXME risky function since it calls updateServer() in some
- // cases. Maybe break out the update/create cases, in which
- // case this is update.
- LL_DEBUGS("Inventory") << "updated item " << item_id << LL_ENDL;
- //LL_DEBUGS("Inventory") << ll_pretty_print_sd(new_item->asLLSD()) << LL_ENDL;
- gInventory.updateItem(new_item);
- }
-
- // DELETE OBJECTS
- for (uuid_list_t::const_iterator del_it = mObjectsDeletedIds.begin();
- del_it != mObjectsDeletedIds.end(); ++del_it)
- {
- LL_DEBUGS("Inventory") << "deleted item " << *del_it << LL_ENDL;
- gInventory.onObjectDeletedFromServer(*del_it, false, false, false);
- }
-
- // TODO - how can we use this version info? Need to be sure all
- // changes are going through AIS first, or at least through
- // something with a reliable responder.
- for (uuid_int_map_t::iterator ucv_it = mCatVersionsUpdated.begin();
- ucv_it != mCatVersionsUpdated.end(); ++ucv_it)
- {
- const LLUUID id = ucv_it->first;
- S32 version = ucv_it->second;
- LLViewerInventoryCategory *cat = gInventory.getCategory(id);
- LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL;
- if (cat->getVersion() != version)
- {
- // the AIS version should be considered the true version. Adjust
- // our local category model to reflect this version number. Otherwise
- // it becomes possible to get stuck with the viewer being out of
- // sync with the inventory system. Under normal circumstances
- // inventory COF is maintained on the viewer through calls to
- // LLInventoryModel::accountForUpdate when a changing operation
+ }
+
+ // UPDATE ITEMS
+ for (deferred_item_map_t::const_iterator update_it = mItemsUpdated.begin();
+ update_it != mItemsUpdated.end(); ++update_it)
+ {
+ LLUUID item_id(update_it->first);
+ LLPointer<LLViewerInventoryItem> new_item = update_it->second;
+ // FIXME risky function since it calls updateServer() in some
+ // cases. Maybe break out the update/create cases, in which
+ // case this is update.
+ LL_DEBUGS("Inventory") << "updated item " << item_id << LL_ENDL;
+ //LL_DEBUGS("Inventory") << ll_pretty_print_sd(new_item->asLLSD()) << LL_ENDL;
+ gInventory.updateItem(new_item);
+ }
+
+ // DELETE OBJECTS
+ for (uuid_list_t::const_iterator del_it = mObjectsDeletedIds.begin();
+ del_it != mObjectsDeletedIds.end(); ++del_it)
+ {
+ LL_DEBUGS("Inventory") << "deleted item " << *del_it << LL_ENDL;
+ gInventory.onObjectDeletedFromServer(*del_it, false, false, false);
+ }
+
+ // TODO - how can we use this version info? Need to be sure all
+ // changes are going through AIS first, or at least through
+ // something with a reliable responder.
+ for (uuid_int_map_t::iterator ucv_it = mCatVersionsUpdated.begin();
+ ucv_it != mCatVersionsUpdated.end(); ++ucv_it)
+ {
+ const LLUUID id = ucv_it->first;
+ S32 version = ucv_it->second;
+ LLViewerInventoryCategory *cat = gInventory.getCategory(id);
+ LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL;
+ if (cat->getVersion() != version)
+ {
+ // the AIS version should be considered the true version. Adjust
+ // our local category model to reflect this version number. Otherwise
+ // it becomes possible to get stuck with the viewer being out of
+ // sync with the inventory system. Under normal circumstances
+ // inventory COF is maintained on the viewer through calls to
+ // LLInventoryModel::accountForUpdate when a changing operation
// is performed. This occasionally gets out of sync however.
if (version != LLViewerInventoryCategory::VERSION_UNKNOWN)
{
@@ -1765,11 +1765,11 @@ void AISUpdate::doUpdate()
const S32 LONG_EXPIRY = 360;
cat->fetch(LONG_EXPIRY);
}
- }
- }
+ }
+ }
checkTimeout();
- gInventory.notifyObservers();
+ gInventory.notifyObservers();
}
diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h
index f254f21e42..0dabd9f678 100644
--- a/indra/newview/llaisapi.h
+++ b/indra/newview/llaisapi.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llaisapi.h
- * @brief classes and functions for interfacing with the v3+ ais inventory service.
+ * @brief classes and functions for interfacing with the v3+ ais inventory service.
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -99,8 +99,8 @@ private:
static std::string getInvCap();
static std::string getLibCap();
- static void InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter,
- invokationFn_t invoke, std::string url, LLUUID targetId, LLSD body,
+ static void InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter,
+ invokationFn_t invoke, std::string url, LLUUID targetId, LLSD body,
completion_t callback, COMMAND_TYPE type);
typedef std::pair<std::string, LLCoprocedureManager::CoProcedure_t> ais_query_item_t;
@@ -110,48 +110,48 @@ private:
class AISUpdate
{
public:
- AISUpdate(const LLSD& update, AISAPI::COMMAND_TYPE type, const LLSD& request_body);
- void parseUpdate(const LLSD& update);
- void parseMeta(const LLSD& update);
- void parseContent(const LLSD& update);
- void parseUUIDArray(const LLSD& content, const std::string& name, uuid_list_t& ids);
- void parseLink(const LLSD& link_map, S32 depth);
- void parseItem(const LLSD& link_map);
- void parseCategory(const LLSD& link_map, S32 depth);
- void parseDescendentCount(const LLUUID& category_id, LLFolderType::EType type, const LLSD& embedded);
- void parseEmbedded(const LLSD& embedded, S32 depth);
- void parseEmbeddedLinks(const LLSD& links, S32 depth);
- void parseEmbeddedItems(const LLSD& items);
- void parseEmbeddedCategories(const LLSD& categories, S32 depth);
- void parseEmbeddedItem(const LLSD& item);
- void parseEmbeddedCategory(const LLSD& category, S32 depth);
- void doUpdate();
+ AISUpdate(const LLSD& update, AISAPI::COMMAND_TYPE type, const LLSD& request_body);
+ void parseUpdate(const LLSD& update);
+ void parseMeta(const LLSD& update);
+ void parseContent(const LLSD& update);
+ void parseUUIDArray(const LLSD& content, const std::string& name, uuid_list_t& ids);
+ void parseLink(const LLSD& link_map, S32 depth);
+ void parseItem(const LLSD& link_map);
+ void parseCategory(const LLSD& link_map, S32 depth);
+ void parseDescendentCount(const LLUUID& category_id, LLFolderType::EType type, const LLSD& embedded);
+ void parseEmbedded(const LLSD& embedded, S32 depth);
+ void parseEmbeddedLinks(const LLSD& links, S32 depth);
+ void parseEmbeddedItems(const LLSD& items);
+ void parseEmbeddedCategories(const LLSD& categories, S32 depth);
+ void parseEmbeddedItem(const LLSD& item);
+ void parseEmbeddedCategory(const LLSD& category, S32 depth);
+ void doUpdate();
private:
- void clearParseResults();
+ void clearParseResults();
void checkTimeout();
// Fetch can return large packets of data, throttle it to not cause lags
// Todo: make throttle work over all fetch requests isntead of per-request
const F32 AIS_EXPIRY_SECONDS = 0.008f;
- typedef std::map<LLUUID,S32> uuid_int_map_t;
- uuid_int_map_t mCatDescendentDeltas;
- uuid_int_map_t mCatDescendentsKnown;
- uuid_int_map_t mCatVersionsUpdated;
+ typedef std::map<LLUUID,S32> uuid_int_map_t;
+ uuid_int_map_t mCatDescendentDeltas;
+ uuid_int_map_t mCatDescendentsKnown;
+ uuid_int_map_t mCatVersionsUpdated;
- typedef std::map<LLUUID,LLPointer<LLViewerInventoryItem> > deferred_item_map_t;
- deferred_item_map_t mItemsCreated;
+ typedef std::map<LLUUID,LLPointer<LLViewerInventoryItem> > deferred_item_map_t;
+ deferred_item_map_t mItemsCreated;
deferred_item_map_t mItemsLost;
- deferred_item_map_t mItemsUpdated;
- typedef std::map<LLUUID,LLPointer<LLViewerInventoryCategory> > deferred_category_map_t;
- deferred_category_map_t mCategoriesCreated;
- deferred_category_map_t mCategoriesUpdated;
-
- // These keep track of uuid's mentioned in meta values.
- // Useful for filtering out which content we are interested in.
- uuid_list_t mObjectsDeletedIds;
- uuid_list_t mItemIds;
- uuid_list_t mCategoryIds;
+ deferred_item_map_t mItemsUpdated;
+ typedef std::map<LLUUID,LLPointer<LLViewerInventoryCategory> > deferred_category_map_t;
+ deferred_category_map_t mCategoriesCreated;
+ deferred_category_map_t mCategoriesUpdated;
+
+ // These keep track of uuid's mentioned in meta values.
+ // Useful for filtering out which content we are interested in.
+ uuid_list_t mObjectsDeletedIds;
+ uuid_list_t mItemIds;
+ uuid_list_t mCategoryIds;
bool mFetch;
S32 mFetchDepth;
LLTimer mTimer;
diff --git a/indra/newview/llanimstatelabels.cpp b/indra/newview/llanimstatelabels.cpp
index a0858612c2..d9940df225 100644
--- a/indra/newview/llanimstatelabels.cpp
+++ b/indra/newview/llanimstatelabels.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llanimationstatenames.cpp
* @brief Names for built-in animation states
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,5 +30,5 @@
std::string LLAnimStateLabels::getStateLabel( const char* animName )
{
- return LLTrans::getString(std::string("anim_") + std::string(animName) );
+ return LLTrans::getString(std::string("anim_") + std::string(animName) );
}
diff --git a/indra/newview/llanimstatelabels.h b/indra/newview/llanimstatelabels.h
index 97aabf5378..2745f4ef4d 100644
--- a/indra/newview/llanimstatelabels.h
+++ b/indra/newview/llanimstatelabels.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llanimstatelabels.h
* @brief Declaration of LLVOAvatar class which is a derivation fo
* LLViewerObject
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,7 +31,7 @@
class LLAnimStateLabels
{
public:
- static std::string getStateLabel( const char *animName );
+ static std::string getStateLabel( const char *animName );
};
#endif // LL_ANIMSTATELABELS_H
diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp
index 51e259992d..f4f19906f1 100644
--- a/indra/newview/llappcorehttp.cpp
+++ b/indra/newview/llappcorehttp.cpp
@@ -1,6 +1,6 @@
/**
* @file llappcorehttp.cpp
- * @brief
+ * @brief
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -54,65 +54,65 @@ const long LLAppCoreHttp::PIPELINING_DEPTH(5L);
// Default and dynamic values for classes
static const struct
{
- U32 mDefault;
- U32 mMin;
- U32 mMax;
- U32 mRate;
- bool mPipelined;
- std::string mKey;
- const char * mUsage;
+ U32 mDefault;
+ U32 mMin;
+ U32 mMax;
+ U32 mRate;
+ bool mPipelined;
+ std::string mKey;
+ const char * mUsage;
} init_data[LLAppCoreHttp::AP_COUNT] =
{
- { // AP_DEFAULT
- 8, 8, 8, 0, false,
- "",
- "other"
- },
- { // AP_TEXTURE
- 8, 1, 12, 0, true,
- "TextureFetchConcurrency",
- "texture fetch"
- },
- { // AP_MESH1
- 32, 1, 128, 0, false,
- "MeshMaxConcurrentRequests",
- "mesh fetch"
- },
- { // AP_MESH2
- 8, 1, 32, 0, true,
- "Mesh2MaxConcurrentRequests",
- "mesh2 fetch"
- },
- { // AP_LARGE_MESH
- 2, 1, 8, 0, false,
- "",
- "large mesh fetch"
- },
- { // AP_UPLOADS
- 2, 1, 8, 0, false,
- "",
- "asset upload"
- },
- { // AP_LONG_POLL
- 32, 32, 32, 0, false,
- "",
- "long poll"
- },
- { // AP_INVENTORY
- 4, 1, 4, 0, false,
- "",
- "inventory"
- },
- { // AP_MATERIALS
- 2, 1, 8, 0, false,
- "RenderMaterials",
- "material manager requests"
- },
- { // AP_AGENT
- 2, 1, 32, 0, false,
- "Agent",
- "Agent requests"
- }
+ { // AP_DEFAULT
+ 8, 8, 8, 0, false,
+ "",
+ "other"
+ },
+ { // AP_TEXTURE
+ 8, 1, 12, 0, true,
+ "TextureFetchConcurrency",
+ "texture fetch"
+ },
+ { // AP_MESH1
+ 32, 1, 128, 0, false,
+ "MeshMaxConcurrentRequests",
+ "mesh fetch"
+ },
+ { // AP_MESH2
+ 8, 1, 32, 0, true,
+ "Mesh2MaxConcurrentRequests",
+ "mesh2 fetch"
+ },
+ { // AP_LARGE_MESH
+ 2, 1, 8, 0, false,
+ "",
+ "large mesh fetch"
+ },
+ { // AP_UPLOADS
+ 2, 1, 8, 0, false,
+ "",
+ "asset upload"
+ },
+ { // AP_LONG_POLL
+ 32, 32, 32, 0, false,
+ "",
+ "long poll"
+ },
+ { // AP_INVENTORY
+ 4, 1, 4, 0, false,
+ "",
+ "inventory"
+ },
+ { // AP_MATERIALS
+ 2, 1, 8, 0, false,
+ "RenderMaterials",
+ "material manager requests"
+ },
+ { // AP_AGENT
+ 2, 1, 32, 0, false,
+ "Agent",
+ "Agent requests"
+ }
};
static void setting_changed();
@@ -120,25 +120,25 @@ static void ssl_verification_changed();
LLAppCoreHttp::HttpClass::HttpClass()
- : mPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),
- mConnLimit(0U),
- mPipelined(false)
+ : mPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),
+ mConnLimit(0U),
+ mPipelined(false)
{}
LLAppCoreHttp::LLAppCoreHttp()
- : mRequest(NULL),
- mStopHandle(LLCORE_HTTP_HANDLE_INVALID),
- mStopRequested(0.0),
- mStopped(false),
- mPipelined(true)
+ : mRequest(NULL),
+ mStopHandle(LLCORE_HTTP_HANDLE_INVALID),
+ mStopRequested(0.0),
+ mStopped(false),
+ mPipelined(true)
{}
LLAppCoreHttp::~LLAppCoreHttp()
{
- delete mRequest;
- mRequest = NULL;
+ delete mRequest;
+ mRequest = NULL;
}
@@ -150,14 +150,14 @@ void LLAppCoreHttp::init()
LLCore::LLHttp::initialize();
- LLCore::HttpStatus status = LLCore::HttpRequest::createService();
- if (! status)
- {
- LL_ERRS("Init") << "Failed to initialize HTTP services. Reason: " << status.toString()
- << LL_ENDL;
- }
+ LLCore::HttpStatus status = LLCore::HttpRequest::createService();
+ if (! status)
+ {
+ LL_ERRS("Init") << "Failed to initialize HTTP services. Reason: " << status.toString()
+ << LL_ENDL;
+ }
- // Point to our certs or SSH/https: will fail on connect
+ // Point to our certs or SSH/https: will fail on connect
std::string ca_file = gDirUtilp->getCAFile();
if ( LLFile::isfile(ca_file) )
{
@@ -171,31 +171,31 @@ void LLAppCoreHttp::init()
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS("Init") << "Missing CA File; should be at " << ca_file << LL_ENDL;
}
-
- if (! status)
- {
- LL_ERRS("Init") << "Failed to set CA File for HTTP services. Reason: " << status.toString()
- << LL_ENDL;
- }
-
- // Establish HTTP Proxy, if desired.
- status = LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_LLPROXY,
- LLCore::HttpRequest::GLOBAL_POLICY_ID,
- 1, NULL);
- if (! status)
- {
- LL_WARNS("Init") << "Failed to set HTTP proxy for HTTP services. Reason: " << status.toString()
- << LL_ENDL;
- }
-
- // Set up SSL Verification call back.
- status = LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_SSL_VERIFY_CALLBACK,
- LLCore::HttpRequest::GLOBAL_POLICY_ID,
- sslVerify, NULL);
- if (!status)
- {
- LL_WARNS("Init") << "Failed to set SSL Verification. Reason: " << status.toString() << LL_ENDL;
- }
+
+ if (! status)
+ {
+ LL_ERRS("Init") << "Failed to set CA File for HTTP services. Reason: " << status.toString()
+ << LL_ENDL;
+ }
+
+ // Establish HTTP Proxy, if desired.
+ status = LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_LLPROXY,
+ LLCore::HttpRequest::GLOBAL_POLICY_ID,
+ 1, NULL);
+ if (! status)
+ {
+ LL_WARNS("Init") << "Failed to set HTTP proxy for HTTP services. Reason: " << status.toString()
+ << LL_ENDL;
+ }
+
+ // Set up SSL Verification call back.
+ status = LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_SSL_VERIFY_CALLBACK,
+ LLCore::HttpRequest::GLOBAL_POLICY_ID,
+ sslVerify, NULL);
+ if (!status)
+ {
+ LL_WARNS("Init") << "Failed to set SSL Verification. Reason: " << status.toString() << LL_ENDL;
+ }
// Set up Default SSL Verification option.
const std::string no_verify_ssl("NoVerifySSLCert");
@@ -214,98 +214,98 @@ void LLAppCoreHttp::init()
}
}
- // Tracing levels for library & libcurl (note that 2 & 3 are beyond spammy):
- // 0 - None
- // 1 - Basic start, stop simple transitions
- // 2 - libcurl CURLOPT_VERBOSE mode with brief lines
- // 3 - with partial data content
- static const std::string http_trace("QAModeHttpTrace");
- if (gSavedSettings.controlExists(http_trace))
- {
- long trace_level(0L);
- trace_level = long(gSavedSettings.getU32(http_trace));
- status = LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_TRACE,
- LLCore::HttpRequest::GLOBAL_POLICY_ID,
- trace_level, NULL);
- }
-
- // Setup default policy and constrain if directed to
- mHttpClasses[AP_DEFAULT].mPolicy = LLCore::HttpRequest::DEFAULT_POLICY_ID;
-
- // Setup additional policies based on table and some special rules
- llassert(LL_ARRAY_SIZE(init_data) == AP_COUNT);
- for (int i(0); i < LL_ARRAY_SIZE(init_data); ++i)
- {
- const EAppPolicy app_policy(static_cast<EAppPolicy>(i));
-
- if (AP_DEFAULT == app_policy)
- {
- // Pre-created
- continue;
- }
-
- mHttpClasses[app_policy].mPolicy = LLCore::HttpRequest::createPolicyClass();
- // We have run out of available HTTP policies. Adjust HTTP_POLICY_CLASS_LIMIT in _httpinternal.h
- llassert(mHttpClasses[app_policy].mPolicy != LLCore::HttpRequest::INVALID_POLICY_ID);
- if (! mHttpClasses[app_policy].mPolicy)
- {
- // Use default policy (but don't accidentally modify default)
- LL_WARNS("Init") << "Failed to create HTTP policy class for " << init_data[i].mUsage
- << ". Using default policy."
- << LL_ENDL;
- mHttpClasses[app_policy].mPolicy = mHttpClasses[AP_DEFAULT].mPolicy;
- continue;
- }
- }
-
- // Need a request object to handle dynamic options before setting them
- mRequest = new LLCore::HttpRequest;
-
- // Apply initial settings
- refreshSettings(true);
-
- // Kick the thread
- status = LLCore::HttpRequest::startThread();
- if (! status)
- {
- LL_ERRS("Init") << "Failed to start HTTP servicing thread. Reason: " << status.toString()
- << LL_ENDL;
- }
-
- // Global pipelining setting
- static const std::string http_pipelining("HttpPipelining");
- if (gSavedSettings.controlExists(http_pipelining))
- {
- // Default to true (in ctor) if absent.
- mPipelined = gSavedSettings.getBOOL(http_pipelining);
- LL_INFOS("Init") << "HTTP Pipelining " << (mPipelined ? "enabled" : "disabled") << "!" << LL_ENDL;
- }
-
- // Register signals for settings and state changes
- for (int i(0); i < LL_ARRAY_SIZE(init_data); ++i)
- {
- const EAppPolicy app_policy(static_cast<EAppPolicy>(i));
-
- if (! init_data[i].mKey.empty() && gSavedSettings.controlExists(init_data[i].mKey))
- {
- LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl(init_data[i].mKey);
- if (cntrl_ptr.isNull())
- {
- LL_WARNS("Init") << "Unable to set signal on global setting '" << init_data[i].mKey
- << "'" << LL_ENDL;
- }
- else
- {
- mHttpClasses[app_policy].mSettingsSignal = cntrl_ptr->getCommitSignal()->connect(boost::bind(&setting_changed));
- }
- }
- }
+ // Tracing levels for library & libcurl (note that 2 & 3 are beyond spammy):
+ // 0 - None
+ // 1 - Basic start, stop simple transitions
+ // 2 - libcurl CURLOPT_VERBOSE mode with brief lines
+ // 3 - with partial data content
+ static const std::string http_trace("QAModeHttpTrace");
+ if (gSavedSettings.controlExists(http_trace))
+ {
+ long trace_level(0L);
+ trace_level = long(gSavedSettings.getU32(http_trace));
+ status = LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_TRACE,
+ LLCore::HttpRequest::GLOBAL_POLICY_ID,
+ trace_level, NULL);
+ }
+
+ // Setup default policy and constrain if directed to
+ mHttpClasses[AP_DEFAULT].mPolicy = LLCore::HttpRequest::DEFAULT_POLICY_ID;
+
+ // Setup additional policies based on table and some special rules
+ llassert(LL_ARRAY_SIZE(init_data) == AP_COUNT);
+ for (int i(0); i < LL_ARRAY_SIZE(init_data); ++i)
+ {
+ const EAppPolicy app_policy(static_cast<EAppPolicy>(i));
+
+ if (AP_DEFAULT == app_policy)
+ {
+ // Pre-created
+ continue;
+ }
+
+ mHttpClasses[app_policy].mPolicy = LLCore::HttpRequest::createPolicyClass();
+ // We have run out of available HTTP policies. Adjust HTTP_POLICY_CLASS_LIMIT in _httpinternal.h
+ llassert(mHttpClasses[app_policy].mPolicy != LLCore::HttpRequest::INVALID_POLICY_ID);
+ if (! mHttpClasses[app_policy].mPolicy)
+ {
+ // Use default policy (but don't accidentally modify default)
+ LL_WARNS("Init") << "Failed to create HTTP policy class for " << init_data[i].mUsage
+ << ". Using default policy."
+ << LL_ENDL;
+ mHttpClasses[app_policy].mPolicy = mHttpClasses[AP_DEFAULT].mPolicy;
+ continue;
+ }
+ }
+
+ // Need a request object to handle dynamic options before setting them
+ mRequest = new LLCore::HttpRequest;
+
+ // Apply initial settings
+ refreshSettings(true);
+
+ // Kick the thread
+ status = LLCore::HttpRequest::startThread();
+ if (! status)
+ {
+ LL_ERRS("Init") << "Failed to start HTTP servicing thread. Reason: " << status.toString()
+ << LL_ENDL;
+ }
+
+ // Global pipelining setting
+ static const std::string http_pipelining("HttpPipelining");
+ if (gSavedSettings.controlExists(http_pipelining))
+ {
+ // Default to true (in ctor) if absent.
+ mPipelined = gSavedSettings.getBOOL(http_pipelining);
+ LL_INFOS("Init") << "HTTP Pipelining " << (mPipelined ? "enabled" : "disabled") << "!" << LL_ENDL;
+ }
+
+ // Register signals for settings and state changes
+ for (int i(0); i < LL_ARRAY_SIZE(init_data); ++i)
+ {
+ const EAppPolicy app_policy(static_cast<EAppPolicy>(i));
+
+ if (! init_data[i].mKey.empty() && gSavedSettings.controlExists(init_data[i].mKey))
+ {
+ LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl(init_data[i].mKey);
+ if (cntrl_ptr.isNull())
+ {
+ LL_WARNS("Init") << "Unable to set signal on global setting '" << init_data[i].mKey
+ << "'" << LL_ENDL;
+ }
+ else
+ {
+ mHttpClasses[app_policy].mSettingsSignal = cntrl_ptr->getCommitSignal()->connect(boost::bind(&setting_changed));
+ }
+ }
+ }
}
void setting_changed()
{
- LLAppViewer::instance()->getAppCoreHttp().refreshSettings(false);
+ LLAppViewer::instance()->getAppCoreHttp().refreshSettings(false);
}
void ssl_verification_changed()
@@ -316,11 +316,11 @@ void ssl_verification_changed()
namespace
{
// The NoOpDeletor is used when wrapping LLAppCoreHttp in a smart pointer below for
- // passage into the LLCore::Http libararies. When the smart pointer is destroyed,
+ // passage into the LLCore::Http libararies. When the smart pointer is destroyed,
// no action will be taken since we do not in this case want the entire LLAppCoreHttp object
// to be destroyed at the end of the call.
- //
- // *NOTE$: Yes! It is "Deletor"
+ //
+ // *NOTE$: Yes! It is "Deletor"
// http://english.stackexchange.com/questions/4733/what-s-the-rule-for-adding-er-vs-or-when-nouning-a-verb
// "delete" derives from Latin "deletus"
void NoOpDeletor(LLCore::HttpHandler *)
@@ -329,13 +329,13 @@ namespace
void LLAppCoreHttp::requestStop()
{
- llassert_always(mRequest);
+ llassert_always(mRequest);
- mStopHandle = mRequest->requestStopThread(LLCore::HttpHandler::ptr_t(this, NoOpDeletor));
- if (LLCORE_HTTP_HANDLE_INVALID != mStopHandle)
- {
- mStopRequested = LLTimer::getTotalSeconds();
- }
+ mStopHandle = mRequest->requestStopThread(LLCore::HttpHandler::ptr_t(this, NoOpDeletor));
+ if (LLCORE_HTTP_HANDLE_INVALID != mStopHandle)
+ {
+ mStopRequested = LLTimer::getTotalSeconds();
+ }
}
@@ -343,187 +343,187 @@ void LLAppCoreHttp::cleanup()
{
LLCore::HTTPStats::instance().dumpStats();
- if (LLCORE_HTTP_HANDLE_INVALID == mStopHandle)
- {
- // Should have been started already...
- requestStop();
- }
-
- if (LLCORE_HTTP_HANDLE_INVALID == mStopHandle)
- {
- LL_WARNS("Cleanup") << "Attempting to cleanup HTTP services without thread shutdown"
- << LL_ENDL;
- }
- else
- {
- while (! mStopped && LLTimer::getTotalSeconds() < (mStopRequested + MAX_THREAD_WAIT_TIME))
- {
- mRequest->update(200000);
- ms_sleep(50);
- }
- if (! mStopped)
- {
- LL_WARNS("Cleanup") << "Attempting to cleanup HTTP services with thread shutdown incomplete"
- << LL_ENDL;
- }
- }
-
- for (int i(0); i < LL_ARRAY_SIZE(mHttpClasses); ++i)
- {
- mHttpClasses[i].mSettingsSignal.disconnect();
- }
+ if (LLCORE_HTTP_HANDLE_INVALID == mStopHandle)
+ {
+ // Should have been started already...
+ requestStop();
+ }
+
+ if (LLCORE_HTTP_HANDLE_INVALID == mStopHandle)
+ {
+ LL_WARNS("Cleanup") << "Attempting to cleanup HTTP services without thread shutdown"
+ << LL_ENDL;
+ }
+ else
+ {
+ while (! mStopped && LLTimer::getTotalSeconds() < (mStopRequested + MAX_THREAD_WAIT_TIME))
+ {
+ mRequest->update(200000);
+ ms_sleep(50);
+ }
+ if (! mStopped)
+ {
+ LL_WARNS("Cleanup") << "Attempting to cleanup HTTP services with thread shutdown incomplete"
+ << LL_ENDL;
+ }
+ }
+
+ for (int i(0); i < LL_ARRAY_SIZE(mHttpClasses); ++i)
+ {
+ mHttpClasses[i].mSettingsSignal.disconnect();
+ }
mSSLNoVerifySignal.disconnect();
- mPipelinedSignal.disconnect();
-
- delete mRequest;
- mRequest = NULL;
-
- LLCore::HttpStatus status = LLCore::HttpRequest::destroyService();
- if (! status)
- {
- LL_WARNS("Cleanup") << "Failed to shutdown HTTP services, continuing. Reason: "
- << status.toString()
- << LL_ENDL;
- }
+ mPipelinedSignal.disconnect();
+
+ delete mRequest;
+ mRequest = NULL;
+
+ LLCore::HttpStatus status = LLCore::HttpRequest::destroyService();
+ if (! status)
+ {
+ LL_WARNS("Cleanup") << "Failed to shutdown HTTP services, continuing. Reason: "
+ << status.toString()
+ << LL_ENDL;
+ }
}
void LLAppCoreHttp::refreshSettings(bool initial)
{
- LLCore::HttpStatus status;
-
- for (int i(0); i < LL_ARRAY_SIZE(init_data); ++i)
- {
- const EAppPolicy app_policy(static_cast<EAppPolicy>(i));
-
- if (initial)
- {
- // Init-time only settings, can use the static setters here
-
- if (init_data[i].mRate)
- {
- // Set any desired throttle
- status = LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_THROTTLE_RATE,
- mHttpClasses[app_policy].mPolicy,
- init_data[i].mRate,
- NULL);
- if (! status)
- {
- LL_WARNS("Init") << "Unable to set " << init_data[i].mUsage
- << " throttle rate. Reason: " << status.toString()
- << LL_ENDL;
- }
- }
-
- }
-
- // Init- or run-time settings. Must use the queued request API.
-
- // Pipelining changes
- if (initial)
- {
- const bool to_pipeline(mPipelined && init_data[i].mPipelined);
- if (to_pipeline != mHttpClasses[app_policy].mPipelined)
- {
- // Pipeline election changing, set dynamic option via request
-
- LLCore::HttpHandle handle;
- const long new_depth(to_pipeline ? PIPELINING_DEPTH : 0);
-
- handle = mRequest->setPolicyOption(LLCore::HttpRequest::PO_PIPELINING_DEPTH,
- mHttpClasses[app_policy].mPolicy,
- new_depth,
+ LLCore::HttpStatus status;
+
+ for (int i(0); i < LL_ARRAY_SIZE(init_data); ++i)
+ {
+ const EAppPolicy app_policy(static_cast<EAppPolicy>(i));
+
+ if (initial)
+ {
+ // Init-time only settings, can use the static setters here
+
+ if (init_data[i].mRate)
+ {
+ // Set any desired throttle
+ status = LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_THROTTLE_RATE,
+ mHttpClasses[app_policy].mPolicy,
+ init_data[i].mRate,
+ NULL);
+ if (! status)
+ {
+ LL_WARNS("Init") << "Unable to set " << init_data[i].mUsage
+ << " throttle rate. Reason: " << status.toString()
+ << LL_ENDL;
+ }
+ }
+
+ }
+
+ // Init- or run-time settings. Must use the queued request API.
+
+ // Pipelining changes
+ if (initial)
+ {
+ const bool to_pipeline(mPipelined && init_data[i].mPipelined);
+ if (to_pipeline != mHttpClasses[app_policy].mPipelined)
+ {
+ // Pipeline election changing, set dynamic option via request
+
+ LLCore::HttpHandle handle;
+ const long new_depth(to_pipeline ? PIPELINING_DEPTH : 0);
+
+ handle = mRequest->setPolicyOption(LLCore::HttpRequest::PO_PIPELINING_DEPTH,
+ mHttpClasses[app_policy].mPolicy,
+ new_depth,
LLCore::HttpHandler::ptr_t());
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- status = mRequest->getStatus();
- LL_WARNS("Init") << "Unable to set " << init_data[i].mUsage
- << " pipelining. Reason: " << status.toString()
- << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("Init") << "Changed " << init_data[i].mUsage
- << " pipelining. New value: " << new_depth
- << LL_ENDL;
- mHttpClasses[app_policy].mPipelined = to_pipeline;
- }
- }
- }
-
- // Get target connection concurrency value
- U32 setting(init_data[i].mDefault);
- if (! init_data[i].mKey.empty() && gSavedSettings.controlExists(init_data[i].mKey))
- {
- U32 new_setting(gSavedSettings.getU32(init_data[i].mKey));
- if (new_setting)
- {
- // Treat zero settings as an ask for default
- setting = llclamp(new_setting, init_data[i].mMin, init_data[i].mMax);
- }
- }
-
- if (initial || setting != mHttpClasses[app_policy].mConnLimit)
- {
- // Set it and report. Strategies depend on pipelining:
- //
- // No Pipelining. Llcorehttp manages connections itself based
- // on the PO_CONNECTION_LIMIT setting. Set both limits to the
- // same value for logical consistency. In the future, may
- // hand over connection management to libcurl after the
- // connection cache has been better vetted.
- //
- // Pipelining. Libcurl is allowed to manage connections to a
- // great degree. Steady state will connection limit based on
- // the per-host setting. Transitions (region crossings, new
- // avatars, etc.) can request additional outbound connections
- // to other servers via 2X total connection limit.
- //
- LLCore::HttpHandle handle;
- handle = mRequest->setPolicyOption(LLCore::HttpRequest::PO_CONNECTION_LIMIT,
- mHttpClasses[app_policy].mPolicy,
- (mHttpClasses[app_policy].mPipelined ? 2 * setting : setting),
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ status = mRequest->getStatus();
+ LL_WARNS("Init") << "Unable to set " << init_data[i].mUsage
+ << " pipelining. Reason: " << status.toString()
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("Init") << "Changed " << init_data[i].mUsage
+ << " pipelining. New value: " << new_depth
+ << LL_ENDL;
+ mHttpClasses[app_policy].mPipelined = to_pipeline;
+ }
+ }
+ }
+
+ // Get target connection concurrency value
+ U32 setting(init_data[i].mDefault);
+ if (! init_data[i].mKey.empty() && gSavedSettings.controlExists(init_data[i].mKey))
+ {
+ U32 new_setting(gSavedSettings.getU32(init_data[i].mKey));
+ if (new_setting)
+ {
+ // Treat zero settings as an ask for default
+ setting = llclamp(new_setting, init_data[i].mMin, init_data[i].mMax);
+ }
+ }
+
+ if (initial || setting != mHttpClasses[app_policy].mConnLimit)
+ {
+ // Set it and report. Strategies depend on pipelining:
+ //
+ // No Pipelining. Llcorehttp manages connections itself based
+ // on the PO_CONNECTION_LIMIT setting. Set both limits to the
+ // same value for logical consistency. In the future, may
+ // hand over connection management to libcurl after the
+ // connection cache has been better vetted.
+ //
+ // Pipelining. Libcurl is allowed to manage connections to a
+ // great degree. Steady state will connection limit based on
+ // the per-host setting. Transitions (region crossings, new
+ // avatars, etc.) can request additional outbound connections
+ // to other servers via 2X total connection limit.
+ //
+ LLCore::HttpHandle handle;
+ handle = mRequest->setPolicyOption(LLCore::HttpRequest::PO_CONNECTION_LIMIT,
+ mHttpClasses[app_policy].mPolicy,
+ (mHttpClasses[app_policy].mPipelined ? 2 * setting : setting),
LLCore::HttpHandler::ptr_t());
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- status = mRequest->getStatus();
- LL_WARNS("Init") << "Unable to set " << init_data[i].mUsage
- << " concurrency. Reason: " << status.toString()
- << LL_ENDL;
- }
- else
- {
- handle = mRequest->setPolicyOption(LLCore::HttpRequest::PO_PER_HOST_CONNECTION_LIMIT,
- mHttpClasses[app_policy].mPolicy,
- setting,
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ status = mRequest->getStatus();
+ LL_WARNS("Init") << "Unable to set " << init_data[i].mUsage
+ << " concurrency. Reason: " << status.toString()
+ << LL_ENDL;
+ }
+ else
+ {
+ handle = mRequest->setPolicyOption(LLCore::HttpRequest::PO_PER_HOST_CONNECTION_LIMIT,
+ mHttpClasses[app_policy].mPolicy,
+ setting,
LLCore::HttpHandler::ptr_t());
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- status = mRequest->getStatus();
- LL_WARNS("Init") << "Unable to set " << init_data[i].mUsage
- << " per-host concurrency. Reason: " << status.toString()
- << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("Init") << "Changed " << init_data[i].mUsage
- << " concurrency. New value: " << setting
- << LL_ENDL;
- mHttpClasses[app_policy].mConnLimit = setting;
- if (initial && setting != init_data[i].mDefault)
- {
- LL_INFOS("Init") << "Application settings overriding default " << init_data[i].mUsage
- << " concurrency. New value: " << setting
- << LL_ENDL;
- }
- }
- }
- }
- }
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ status = mRequest->getStatus();
+ LL_WARNS("Init") << "Unable to set " << init_data[i].mUsage
+ << " per-host concurrency. Reason: " << status.toString()
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("Init") << "Changed " << init_data[i].mUsage
+ << " concurrency. New value: " << setting
+ << LL_ENDL;
+ mHttpClasses[app_policy].mConnLimit = setting;
+ if (initial && setting != init_data[i].mDefault)
+ {
+ LL_INFOS("Init") << "Application settings overriding default " << init_data[i].mUsage
+ << " concurrency. New value: " << setting
+ << LL_ENDL;
+ }
+ }
+ }
+ }
+ }
}
-LLCore::HttpStatus LLAppCoreHttp::sslVerify(const std::string &url,
- const LLCore::HttpHandler::ptr_t &handler, void *appdata)
+LLCore::HttpStatus LLAppCoreHttp::sslVerify(const std::string &url,
+ const LLCore::HttpHandler::ptr_t &handler, void *appdata)
{
if (gDisconnected)
{
@@ -544,40 +544,40 @@ LLCore::HttpStatus LLAppCoreHttp::sslVerify(const std::string &url,
// *TODO: In the case of an exception while validating the cert, we need a way
// to pass the offending(?) cert back out. *Rider*
- // don't validate hostname. Let libcurl do it instead. That way, it'll handle redirects
- store->validate(VALIDATION_POLICY_SSL & (~VALIDATION_POLICY_HOSTNAME), chain, validation_params);
- }
- catch (LLCertValidationTrustException &cert_exception)
- {
- // this exception is is handled differently than the general cert
- // exceptions, as we allow the user to actually add the certificate
- // for trust.
- // therefore we pass back a different error code
- // NOTE: We're currently 'wired' to pass around CURL error codes. This is
- // somewhat clumsy, as we may run into errors that do not map directly to curl
- // error codes. Should be refactored with login refactoring, perhaps.
- result = LLCore::HttpStatus(LLCore::HttpStatus::EXT_CURL_EASY, CURLE_SSL_CACERT);
- result.setMessage(cert_exception.what());
- LLSD certdata = cert_exception.getCertData();
- result.setErrorData(certdata);
- // We should probably have a more generic way of passing information
- // back to the error handlers.
- }
- catch (LLCertException &cert_exception)
- {
- result = LLCore::HttpStatus(LLCore::HttpStatus::EXT_CURL_EASY, CURLE_SSL_PEER_CERTIFICATE);
- result.setMessage(cert_exception.what());
- LLSD certdata = cert_exception.getCertData();
- result.setErrorData(certdata);
- }
- catch (...)
- {
- LOG_UNHANDLED_EXCEPTION(STRINGIZE("('" << url << "')"));
- // any other odd error, we just handle as a connect error.
- result = LLCore::HttpStatus(LLCore::HttpStatus::EXT_CURL_EASY, CURLE_SSL_CONNECT_ERROR);
- }
-
- return result;
+ // don't validate hostname. Let libcurl do it instead. That way, it'll handle redirects
+ store->validate(VALIDATION_POLICY_SSL & (~VALIDATION_POLICY_HOSTNAME), chain, validation_params);
+ }
+ catch (LLCertValidationTrustException &cert_exception)
+ {
+ // this exception is is handled differently than the general cert
+ // exceptions, as we allow the user to actually add the certificate
+ // for trust.
+ // therefore we pass back a different error code
+ // NOTE: We're currently 'wired' to pass around CURL error codes. This is
+ // somewhat clumsy, as we may run into errors that do not map directly to curl
+ // error codes. Should be refactored with login refactoring, perhaps.
+ result = LLCore::HttpStatus(LLCore::HttpStatus::EXT_CURL_EASY, CURLE_SSL_CACERT);
+ result.setMessage(cert_exception.what());
+ LLSD certdata = cert_exception.getCertData();
+ result.setErrorData(certdata);
+ // We should probably have a more generic way of passing information
+ // back to the error handlers.
+ }
+ catch (LLCertException &cert_exception)
+ {
+ result = LLCore::HttpStatus(LLCore::HttpStatus::EXT_CURL_EASY, CURLE_SSL_PEER_CERTIFICATE);
+ result.setMessage(cert_exception.what());
+ LLSD certdata = cert_exception.getCertData();
+ result.setErrorData(certdata);
+ }
+ catch (...)
+ {
+ LOG_UNHANDLED_EXCEPTION(STRINGIZE("('" << url << "')"));
+ // any other odd error, we just handle as a connect error.
+ result = LLCore::HttpStatus(LLCore::HttpStatus::EXT_CURL_EASY, CURLE_SSL_CONNECT_ERROR);
+ }
+
+ return result;
}
@@ -585,5 +585,5 @@ LLCore::HttpStatus LLAppCoreHttp::sslVerify(const std::string &url,
void LLAppCoreHttp::onCompleted(LLCore::HttpHandle, LLCore::HttpResponse *)
{
- mStopped = true;
+ mStopped = true;
}
diff --git a/indra/newview/llappcorehttp.h b/indra/newview/llappcorehttp.h
index 751c498ab0..c02c4a532d 100644
--- a/indra/newview/llappcorehttp.h
+++ b/indra/newview/llappcorehttp.h
@@ -24,8 +24,8 @@
* $/LicenseInfo$
*/
-#ifndef _LL_APP_COREHTTP_H_
-#define _LL_APP_COREHTTP_H_
+#ifndef _LL_APP_COREHTTP_H_
+#define _LL_APP_COREHTTP_H_
#include "httprequest.h"
@@ -41,225 +41,225 @@
class LLAppCoreHttp : public LLCore::HttpHandler
{
public:
- static const long PIPELINING_DEPTH;
-
- typedef LLCore::HttpRequest::policy_t policy_t;
-
- enum EAppPolicy
- {
- /// Catchall policy class. Not used yet
- /// but will have a generous concurrency
- /// limit. Deep queueing possible by having
- /// a chatty HTTP user.
- ///
- /// Destination: anywhere
- /// Protocol: http: or https:
- /// Transfer size: KB-MB
- /// Long poll: no
- /// Concurrency: high
- /// Request rate: unknown
- /// Pipelined: no
- AP_DEFAULT,
-
- /// Texture fetching policy class. Used to
- /// download textures via capability or SSA
- /// baking service. Deep queueing of requests.
- /// Do not share. GET requests only.
- ///
- /// Destination: simhost:12046 & {bake-texture,cdn}:80
- /// Protocol: http:
- /// Transfer size: KB-MB
- /// Long poll: no
- /// Concurrency: high
- /// Request rate: high
- /// Pipelined: yes
- AP_TEXTURE,
-
- /// Legacy mesh fetching policy class. Used to
- /// download textures via 'GetMesh' capability.
- /// To be deprecated. Do not share.
- ///
- /// Destination: simhost:12046
- /// Protocol: http:
- /// Transfer size: KB-MB
- /// Long poll: no
- /// Concurrency: dangerously high
- /// Request rate: high
- /// Pipelined: no
- AP_MESH1,
-
- /// New mesh fetching policy class. Used to
- /// download textures via 'GetMesh2' capability.
- /// Used when fetch request (typically one LOD)
- /// is 'small', currently defined as 2MB.
- /// Very deeply queued. Do not share. GET
- /// requests only.
- ///
- /// Destination: simhost:12046 & cdn:80
- /// Protocol: http:
- /// Transfer size: KB-MB
- /// Long poll: no
- /// Concurrency: high
- /// Request rate: high
- /// Pipelined: yes
- AP_MESH2,
-
- /// Large mesh fetching policy class. Used to
- /// download textures via 'GetMesh' or 'GetMesh2'
- /// capability. Used when fetch request
- /// is not small to avoid head-of-line problem
- /// when large requests block a sequence of small,
- /// fast requests. Can be shared with similar
- /// traffic that can wait for longish stalls
- /// (default timeout 600S).
- ///
- /// Destination: simhost:12046 & cdn:80
- /// Protocol: http:
- /// Transfer size: MB
- /// Long poll: no
- /// Concurrency: low
- /// Request rate: low
- /// Pipelined: no
- AP_LARGE_MESH,
-
- /// Asset upload policy class. Used to store
- /// assets (mesh only at the moment) via
- /// changeable URL. Responses may take some
- /// time (default timeout 240S).
- ///
- /// Destination: simhost:12043
- /// Protocol: https:
- /// Transfer size: KB-MB
- /// Long poll: no
- /// Concurrency: low
- /// Request rate: low
- /// Pipelined: no
- AP_UPLOADS,
-
- /// Long-poll-type HTTP requests. Not
- /// bound by a connection limit. Requests
- /// will typically hang around for a long
- /// time (~30S). Only shareable with other
- /// long-poll requests.
- ///
- /// Destination: simhost:12043
- /// Protocol: https:
- /// Transfer size: KB
- /// Long poll: yes
- /// Concurrency: unlimited but low in practice
- /// Request rate: low
- /// Pipelined: no
- AP_LONG_POLL,
-
- /// Inventory operations (really Capabilities-
- /// related operations). Mix of high-priority
- /// and low-priority operations.
- ///
- /// Destination: simhost:12043
- /// Protocol: https:
- /// Transfer size: KB-MB
- /// Long poll: no
- /// Concurrency: high
- /// Request rate: high
- /// Pipelined: no
- AP_INVENTORY,
- AP_REPORTING = AP_INVENTORY, // Piggy-back on inventory
-
- /// Material resource requests and puts.
- ///
- /// Destination: simhost:12043
- /// Protocol: https:
- /// Transfer size: KB
- /// Long poll: no
- /// Concurrency: low
- /// Request rate: low
- /// Pipelined: no
- AP_MATERIALS,
-
- /// Appearance resource requests and puts.
- ///
- /// Destination: simhost:12043
- /// Protocol: https:
- /// Transfer size: KB
- /// Long poll: no
- /// Concurrency: mid
- /// Request rate: low
- /// Pipelined: yes
- AP_AGENT,
-
- AP_COUNT // Must be last
- };
-
+ static const long PIPELINING_DEPTH;
+
+ typedef LLCore::HttpRequest::policy_t policy_t;
+
+ enum EAppPolicy
+ {
+ /// Catchall policy class. Not used yet
+ /// but will have a generous concurrency
+ /// limit. Deep queueing possible by having
+ /// a chatty HTTP user.
+ ///
+ /// Destination: anywhere
+ /// Protocol: http: or https:
+ /// Transfer size: KB-MB
+ /// Long poll: no
+ /// Concurrency: high
+ /// Request rate: unknown
+ /// Pipelined: no
+ AP_DEFAULT,
+
+ /// Texture fetching policy class. Used to
+ /// download textures via capability or SSA
+ /// baking service. Deep queueing of requests.
+ /// Do not share. GET requests only.
+ ///
+ /// Destination: simhost:12046 & {bake-texture,cdn}:80
+ /// Protocol: http:
+ /// Transfer size: KB-MB
+ /// Long poll: no
+ /// Concurrency: high
+ /// Request rate: high
+ /// Pipelined: yes
+ AP_TEXTURE,
+
+ /// Legacy mesh fetching policy class. Used to
+ /// download textures via 'GetMesh' capability.
+ /// To be deprecated. Do not share.
+ ///
+ /// Destination: simhost:12046
+ /// Protocol: http:
+ /// Transfer size: KB-MB
+ /// Long poll: no
+ /// Concurrency: dangerously high
+ /// Request rate: high
+ /// Pipelined: no
+ AP_MESH1,
+
+ /// New mesh fetching policy class. Used to
+ /// download textures via 'GetMesh2' capability.
+ /// Used when fetch request (typically one LOD)
+ /// is 'small', currently defined as 2MB.
+ /// Very deeply queued. Do not share. GET
+ /// requests only.
+ ///
+ /// Destination: simhost:12046 & cdn:80
+ /// Protocol: http:
+ /// Transfer size: KB-MB
+ /// Long poll: no
+ /// Concurrency: high
+ /// Request rate: high
+ /// Pipelined: yes
+ AP_MESH2,
+
+ /// Large mesh fetching policy class. Used to
+ /// download textures via 'GetMesh' or 'GetMesh2'
+ /// capability. Used when fetch request
+ /// is not small to avoid head-of-line problem
+ /// when large requests block a sequence of small,
+ /// fast requests. Can be shared with similar
+ /// traffic that can wait for longish stalls
+ /// (default timeout 600S).
+ ///
+ /// Destination: simhost:12046 & cdn:80
+ /// Protocol: http:
+ /// Transfer size: MB
+ /// Long poll: no
+ /// Concurrency: low
+ /// Request rate: low
+ /// Pipelined: no
+ AP_LARGE_MESH,
+
+ /// Asset upload policy class. Used to store
+ /// assets (mesh only at the moment) via
+ /// changeable URL. Responses may take some
+ /// time (default timeout 240S).
+ ///
+ /// Destination: simhost:12043
+ /// Protocol: https:
+ /// Transfer size: KB-MB
+ /// Long poll: no
+ /// Concurrency: low
+ /// Request rate: low
+ /// Pipelined: no
+ AP_UPLOADS,
+
+ /// Long-poll-type HTTP requests. Not
+ /// bound by a connection limit. Requests
+ /// will typically hang around for a long
+ /// time (~30S). Only shareable with other
+ /// long-poll requests.
+ ///
+ /// Destination: simhost:12043
+ /// Protocol: https:
+ /// Transfer size: KB
+ /// Long poll: yes
+ /// Concurrency: unlimited but low in practice
+ /// Request rate: low
+ /// Pipelined: no
+ AP_LONG_POLL,
+
+ /// Inventory operations (really Capabilities-
+ /// related operations). Mix of high-priority
+ /// and low-priority operations.
+ ///
+ /// Destination: simhost:12043
+ /// Protocol: https:
+ /// Transfer size: KB-MB
+ /// Long poll: no
+ /// Concurrency: high
+ /// Request rate: high
+ /// Pipelined: no
+ AP_INVENTORY,
+ AP_REPORTING = AP_INVENTORY, // Piggy-back on inventory
+
+ /// Material resource requests and puts.
+ ///
+ /// Destination: simhost:12043
+ /// Protocol: https:
+ /// Transfer size: KB
+ /// Long poll: no
+ /// Concurrency: low
+ /// Request rate: low
+ /// Pipelined: no
+ AP_MATERIALS,
+
+ /// Appearance resource requests and puts.
+ ///
+ /// Destination: simhost:12043
+ /// Protocol: https:
+ /// Transfer size: KB
+ /// Long poll: no
+ /// Concurrency: mid
+ /// Request rate: low
+ /// Pipelined: yes
+ AP_AGENT,
+
+ AP_COUNT // Must be last
+ };
+
public:
- LLAppCoreHttp();
- ~LLAppCoreHttp();
-
- // Initialize the LLCore::HTTP library creating service classes
- // and starting the servicing thread. Caller is expected to do
- // other initializations (SSL mutex, thread hash function) appropriate
- // for the application.
- void init();
-
- // Request that the servicing thread stop servicing requests,
- // release resource references and stop. Request is asynchronous
- // and @see cleanup() will perform a limited wait loop for this
- // request to stop the thread.
- void requestStop();
-
- // Terminate LLCore::HTTP library services. Caller is expected
- // to have made a best-effort to shutdown the servicing thread
- // by issuing a requestThreadStop() and waiting for completion
- // notification that the stop has completed.
- void cleanup();
-
- // Notification when the stop request is complete.
- virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
-
- // Retrieve a policy class identifier for desired
- // application function.
- policy_t getPolicy(EAppPolicy policy) const
- {
- return mHttpClasses[policy].mPolicy;
- }
-
- // Return whether a policy is using pipelined operations.
- bool isPipelined(EAppPolicy policy) const
- {
- return mHttpClasses[policy].mPipelined;
- }
-
- // Apply initial or new settings from the environment.
- void refreshSettings(bool initial);
-
+ LLAppCoreHttp();
+ ~LLAppCoreHttp();
+
+ // Initialize the LLCore::HTTP library creating service classes
+ // and starting the servicing thread. Caller is expected to do
+ // other initializations (SSL mutex, thread hash function) appropriate
+ // for the application.
+ void init();
+
+ // Request that the servicing thread stop servicing requests,
+ // release resource references and stop. Request is asynchronous
+ // and @see cleanup() will perform a limited wait loop for this
+ // request to stop the thread.
+ void requestStop();
+
+ // Terminate LLCore::HTTP library services. Caller is expected
+ // to have made a best-effort to shutdown the servicing thread
+ // by issuing a requestThreadStop() and waiting for completion
+ // notification that the stop has completed.
+ void cleanup();
+
+ // Notification when the stop request is complete.
+ virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
+
+ // Retrieve a policy class identifier for desired
+ // application function.
+ policy_t getPolicy(EAppPolicy policy) const
+ {
+ return mHttpClasses[policy].mPolicy;
+ }
+
+ // Return whether a policy is using pipelined operations.
+ bool isPipelined(EAppPolicy policy) const
+ {
+ return mHttpClasses[policy].mPipelined;
+ }
+
+ // Apply initial or new settings from the environment.
+ void refreshSettings(bool initial);
+
private:
- static const F64 MAX_THREAD_WAIT_TIME;
-
+ static const F64 MAX_THREAD_WAIT_TIME;
+
private:
- // PODish container for per-class settings and state.
- struct HttpClass
- {
- public:
- HttpClass();
-
- public:
- policy_t mPolicy; // Policy class id for the class
- U32 mConnLimit;
- bool mPipelined;
- boost::signals2::connection mSettingsSignal; // Signal to global setting that affect this class (if any)
- };
-
- LLCore::HttpRequest * mRequest; // Request queue to issue shutdowns
- LLCore::HttpHandle mStopHandle;
- F64 mStopRequested;
- bool mStopped;
- HttpClass mHttpClasses[AP_COUNT];
- bool mPipelined; // Global setting
- boost::signals2::connection mPipelinedSignal; // Signal for 'HttpPipelining' setting
- boost::signals2::connection mSSLNoVerifySignal; // Signal for 'NoVerifySSLCert' setting
-
- static LLCore::HttpStatus sslVerify(const std::string &uri, const LLCore::HttpHandler::ptr_t &handler, void *appdata);
+ // PODish container for per-class settings and state.
+ struct HttpClass
+ {
+ public:
+ HttpClass();
+
+ public:
+ policy_t mPolicy; // Policy class id for the class
+ U32 mConnLimit;
+ bool mPipelined;
+ boost::signals2::connection mSettingsSignal; // Signal to global setting that affect this class (if any)
+ };
+
+ LLCore::HttpRequest * mRequest; // Request queue to issue shutdowns
+ LLCore::HttpHandle mStopHandle;
+ F64 mStopRequested;
+ bool mStopped;
+ HttpClass mHttpClasses[AP_COUNT];
+ bool mPipelined; // Global setting
+ boost::signals2::connection mPipelinedSignal; // Signal for 'HttpPipelining' setting
+ boost::signals2::connection mSSLNoVerifySignal; // Signal for 'NoVerifySSLCert' setting
+
+ static LLCore::HttpStatus sslVerify(const std::string &uri, const LLCore::HttpHandler::ptr_t &handler, void *appdata);
};
-#endif // _LL_APP_COREHTTP_H_
+#endif // _LL_APP_COREHTTP_H_
diff --git a/indra/newview/llappearance.h b/indra/newview/llappearance.h
index 05dfac4e42..10b9c9246e 100644
--- a/indra/newview/llappearance.h
+++ b/indra/newview/llappearance.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llappearance.h
* @brief LLAppearance class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,20 +32,20 @@
class LLAppearance
{
public:
- LLAppearance() {}
- ~LLAppearance() { mParamMap.clear(); }
+ LLAppearance() {}
+ ~LLAppearance() { mParamMap.clear(); }
+
+ void addParam( S32 id, F32 value ) { mParamMap[id] = value; }
+ F32 getParam( S32 id, F32 defval ) { return get_if_there(mParamMap, id, defval ); }
- void addParam( S32 id, F32 value ) { mParamMap[id] = value; }
- F32 getParam( S32 id, F32 defval ) { return get_if_there(mParamMap, id, defval ); }
+ void addTexture( S32 te, const LLUUID& uuid ) { if( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) mTextures[te] = uuid; }
+ const LLUUID& getTexture( S32 te ) { return ( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) ? mTextures[te] : LLUUID::null; }
- void addTexture( S32 te, const LLUUID& uuid ) { if( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) mTextures[te] = uuid; }
- const LLUUID& getTexture( S32 te ) { return ( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) ? mTextures[te] : LLUUID::null; }
-
- void clear() { mParamMap.clear(); for( S32 i=0; i<LLAvatarAppearanceDefines::TEX_NUM_INDICES; i++ ) mTextures[i].setNull(); }
+ void clear() { mParamMap.clear(); for( S32 i=0; i<LLAvatarAppearanceDefines::TEX_NUM_INDICES; i++ ) mTextures[i].setNull(); }
- typedef std::map<S32, F32> param_map_t;
- param_map_t mParamMap;
- LLUUID mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES];
+ typedef std::map<S32, F32> param_map_t;
+ param_map_t mParamMap;
+ LLUUID mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES];
};
#endif // LL_LLAPPEARANCE_H
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index c84657cf7a..ceeefd7415 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1,29 +1,29 @@
-/**
+/**
* @file llappearancemgr.cpp
* @brief Manager for initiating appearance changes on the viewer
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
#include "llviewerprecompiledheaders.h"
#include <boost/lexical_cast.hpp>
@@ -71,7 +71,7 @@
#pragma warning (disable:4702)
#endif
-namespace
+namespace
{
const S32 BAKE_RETRY_MAX_COUNT = 5;
const F32 BAKE_RETRY_TIMEOUT = 2.0F;
@@ -87,8 +87,8 @@ void doAppearanceCb(LLPointer<LLInventoryCallback> cb, LLUUID id)
std::string self_av_string()
{
- // On logout gAgentAvatarp can already be invalid
- return isAgentAvatarValid() ? gAgentAvatarp->avString() : "";
+ // On logout gAgentAvatarp can already be invalid
+ return isAgentAvatarValid() ? gAgentAvatarp->avString() : "";
}
// RAII thingy to guarantee that a variable gets reset when the Setter
@@ -97,17 +97,17 @@ std::string self_av_string()
class BoolSetter
{
public:
- BoolSetter(bool& var):
- mVar(var)
- {
- mVar = true;
- }
- ~BoolSetter()
- {
- mVar = false;
- }
+ BoolSetter(bool& var):
+ mVar(var)
+ {
+ mVar = true;
+ }
+ ~BoolSetter()
+ {
+ mVar = false;
+ }
private:
- bool& mVar;
+ bool& mVar;
};
char ORDER_NUMBER_SEPARATOR('@');
@@ -115,54 +115,54 @@ char ORDER_NUMBER_SEPARATOR('@');
class LLOutfitUnLockTimer: public LLEventTimer
{
public:
- LLOutfitUnLockTimer(F32 period) : LLEventTimer(period)
- {
- // restart timer on BOF changed event
- LLOutfitObserver::instance().addBOFChangedCallback(boost::bind(
- &LLOutfitUnLockTimer::reset, this));
- stop();
- }
-
- /*virtual*/
- BOOL tick()
- {
- if(mEventTimer.hasExpired())
- {
- LLAppearanceMgr::instance().setOutfitLocked(false);
- }
- return FALSE;
- }
- void stop() { mEventTimer.stop(); }
- void start() { mEventTimer.start(); }
- void reset() { mEventTimer.reset(); }
- BOOL getStarted() { return mEventTimer.getStarted(); }
-
- LLTimer& getEventTimer() { return mEventTimer;}
+ LLOutfitUnLockTimer(F32 period) : LLEventTimer(period)
+ {
+ // restart timer on BOF changed event
+ LLOutfitObserver::instance().addBOFChangedCallback(boost::bind(
+ &LLOutfitUnLockTimer::reset, this));
+ stop();
+ }
+
+ /*virtual*/
+ BOOL tick()
+ {
+ if(mEventTimer.hasExpired())
+ {
+ LLAppearanceMgr::instance().setOutfitLocked(false);
+ }
+ return FALSE;
+ }
+ void stop() { mEventTimer.stop(); }
+ void start() { mEventTimer.start(); }
+ void reset() { mEventTimer.reset(); }
+ BOOL getStarted() { return mEventTimer.getStarted(); }
+
+ LLTimer& getEventTimer() { return mEventTimer;}
};
// support for secondlife:///app/appearance SLapps
class LLAppearanceHandler : public LLCommandHandler
{
public:
- // requests will be throttled from a non-trusted browser
- LLAppearanceHandler() : LLCommandHandler("appearance", UNTRUSTED_THROTTLE) {}
+ // requests will be throttled from a non-trusted browser
+ LLAppearanceHandler() : LLCommandHandler("appearance", UNTRUSTED_THROTTLE) {}
- bool handle(const LLSD& params,
+ bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- // support secondlife:///app/appearance/show, but for now we just
- // make all secondlife:///app/appearance SLapps behave this way
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAppearance"))
- {
- LLNotificationsUtil::add("NoAppearance", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
-
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD());
- return true;
- }
+ {
+ // support secondlife:///app/appearance/show, but for now we just
+ // make all secondlife:///app/appearance SLapps behave this way
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAppearance"))
+ {
+ LLNotificationsUtil::add("NoAppearance", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD());
+ return true;
+ }
};
LLAppearanceHandler gAppearanceHandler;
@@ -170,27 +170,27 @@ LLAppearanceHandler gAppearanceHandler;
LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string& name)
{
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- LLNameCategoryCollector has_name(name);
- gInventory.collectDescendentsIf(parent_id,
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- has_name);
- if (0 == cat_array.size())
- return LLUUID();
- else
- {
- LLViewerInventoryCategory *cat = cat_array.at(0);
- if (cat)
- return cat->getUUID();
- else
- {
- LL_WARNS() << "null cat" << LL_ENDL;
- return LLUUID();
- }
- }
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ LLNameCategoryCollector has_name(name);
+ gInventory.collectDescendentsIf(parent_id,
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ has_name);
+ if (0 == cat_array.size())
+ return LLUUID();
+ else
+ {
+ LLViewerInventoryCategory *cat = cat_array.at(0);
+ if (cat)
+ return cat->getUUID();
+ else
+ {
+ LL_WARNS() << "null cat" << LL_ENDL;
+ return LLUUID();
+ }
+ }
}
// We want this to be much lower (e.g. 15.0 is usually fine), bumping
@@ -203,261 +203,261 @@ const F32 DEFAULT_RETRY_AFTER_INTERVAL = 300.0;
// leave at 0 if the operations become actually reliable).
const S32 DEFAULT_MAX_RETRIES = 0;
-class LLCallAfterInventoryBatchMgr: public LLEventTimer
+class LLCallAfterInventoryBatchMgr: public LLEventTimer
{
public:
- LLCallAfterInventoryBatchMgr(const LLUUID& dst_cat_id,
- const std::string& phase_name,
- nullary_func_t on_completion_func,
- nullary_func_t on_failure_func = no_op,
- F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL,
- S32 max_retries = DEFAULT_MAX_RETRIES
- ):
- mDstCatID(dst_cat_id),
- mTrackingPhase(phase_name),
- mOnCompletionFunc(on_completion_func),
- mOnFailureFunc(on_failure_func),
- mRetryAfter(retry_after),
- mMaxRetries(max_retries),
- mPendingRequests(0),
- mFailCount(0),
- mCompletionOrFailureCalled(false),
- mRetryCount(0),
- LLEventTimer(5.0)
- {
- if (!mTrackingPhase.empty())
- {
- selfStartPhase(mTrackingPhase);
- }
- }
-
- void addItems(LLInventoryModel::item_array_t& src_items)
- {
- for (LLInventoryModel::item_array_t::const_iterator it = src_items.begin();
- it != src_items.end();
- ++it)
- {
- LLViewerInventoryItem* item = *it;
- llassert(item);
- addItem(item->getUUID());
- }
- }
-
- // Request or re-request operation for specified item.
- void addItem(const LLUUID& item_id)
- {
- LL_DEBUGS("Avatar") << "item_id " << item_id << LL_ENDL;
- if (!requestOperation(item_id))
- {
- LL_DEBUGS("Avatar") << "item_id " << item_id << " requestOperation false, skipping" << LL_ENDL;
- return;
- }
-
- mPendingRequests++;
- // On a re-request, this will reset the timer.
- mWaitTimes[item_id] = LLTimer();
- if (mRetryCounts.find(item_id) == mRetryCounts.end())
- {
- mRetryCounts[item_id] = 0;
- }
- else
- {
- mRetryCounts[item_id]++;
- }
- }
-
- virtual bool requestOperation(const LLUUID& item_id) = 0;
-
- void onOp(const LLUUID& src_id, const LLUUID& dst_id, LLTimer timestamp)
- {
- if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateLateOpRate"))
- {
- LL_WARNS() << "Simulating late operation by punting handling to later" << LL_ENDL;
- doAfterInterval(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,src_id,dst_id,timestamp),
- mRetryAfter);
- return;
- }
- mPendingRequests--;
- F32 elapsed = timestamp.getElapsedTimeF32();
- LL_DEBUGS("Avatar") << "op done, src_id " << src_id << " dst_id " << dst_id << " after " << elapsed << " seconds" << LL_ENDL;
- if (mWaitTimes.find(src_id) == mWaitTimes.end())
- {
- // No longer waiting for this item - either serviced
- // already or gave up after too many retries.
- LL_WARNS() << "duplicate or late operation, src_id " << src_id << "dst_id " << dst_id
- << " elapsed " << elapsed << " after end " << (S32) mCompletionOrFailureCalled << LL_ENDL;
- }
- mTimeStats.push(elapsed);
- mWaitTimes.erase(src_id);
- if (mWaitTimes.empty() && !mCompletionOrFailureCalled)
- {
- onCompletionOrFailure();
- }
- }
-
- void onCompletionOrFailure()
- {
- assert (!mCompletionOrFailureCalled);
- mCompletionOrFailureCalled = true;
-
- // Will never call onCompletion() if any item has been flagged as
- // a failure - otherwise could wind up with corrupted
- // outfit, involuntary nudity, etc.
- reportStats();
- if (!mTrackingPhase.empty())
- {
- selfStopPhase(mTrackingPhase);
- }
- if (!mFailCount)
- {
- onCompletion();
- }
- else
- {
- onFailure();
- }
- }
-
- void onFailure()
- {
- LL_INFOS() << "failed" << LL_ENDL;
- mOnFailureFunc();
- }
-
- void onCompletion()
- {
- LL_INFOS() << "done" << LL_ENDL;
- mOnCompletionFunc();
- }
-
- // virtual
- // Will be deleted after returning true - only safe to do this if all callbacks have fired.
- BOOL tick()
- {
- // mPendingRequests will be zero if all requests have been
- // responded to. mWaitTimes.empty() will be true if we have
- // received at least one reply for each UUID. If requests
- // have been dropped and retried, these will not necessarily
- // be the same. Only safe to return true if all requests have
- // been serviced, since it will result in this object being
- // deleted.
- bool all_done = (mPendingRequests==0);
-
- if (!mWaitTimes.empty())
- {
- LL_WARNS() << "still waiting on " << mWaitTimes.size() << " items" << LL_ENDL;
- for (std::map<LLUUID,LLTimer>::iterator it = mWaitTimes.begin();
- it != mWaitTimes.end();)
- {
- // Use a copy of iterator because it may be erased/invalidated.
- std::map<LLUUID,LLTimer>::iterator curr_it = it;
- ++it;
-
- F32 time_waited = curr_it->second.getElapsedTimeF32();
- S32 retries = mRetryCounts[curr_it->first];
- if (time_waited > mRetryAfter)
- {
- if (retries < mMaxRetries)
- {
- LL_DEBUGS("Avatar") << "Waited " << time_waited <<
- " for " << curr_it->first << ", retrying" << LL_ENDL;
- mRetryCount++;
- addItem(curr_it->first);
- }
- else
- {
- LL_WARNS() << "Giving up on " << curr_it->first << " after too many retries" << LL_ENDL;
- mWaitTimes.erase(curr_it);
- mFailCount++;
- }
- }
- if (mWaitTimes.empty())
- {
- onCompletionOrFailure();
- }
-
- }
- }
- return all_done;
- }
-
- void reportStats()
- {
- LL_DEBUGS("Avatar") << "Phase: " << mTrackingPhase << LL_ENDL;
- LL_DEBUGS("Avatar") << "mFailCount: " << mFailCount << LL_ENDL;
- LL_DEBUGS("Avatar") << "mRetryCount: " << mRetryCount << LL_ENDL;
- LL_DEBUGS("Avatar") << "Times: n " << mTimeStats.getCount() << " min " << mTimeStats.getMinValue() << " max " << mTimeStats.getMaxValue() << LL_ENDL;
- LL_DEBUGS("Avatar") << "Mean " << mTimeStats.getMean() << " stddev " << mTimeStats.getStdDev() << LL_ENDL;
- }
-
- virtual ~LLCallAfterInventoryBatchMgr()
- {
- LL_DEBUGS("Avatar") << "deleting" << LL_ENDL;
- }
+ LLCallAfterInventoryBatchMgr(const LLUUID& dst_cat_id,
+ const std::string& phase_name,
+ nullary_func_t on_completion_func,
+ nullary_func_t on_failure_func = no_op,
+ F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL,
+ S32 max_retries = DEFAULT_MAX_RETRIES
+ ):
+ mDstCatID(dst_cat_id),
+ mTrackingPhase(phase_name),
+ mOnCompletionFunc(on_completion_func),
+ mOnFailureFunc(on_failure_func),
+ mRetryAfter(retry_after),
+ mMaxRetries(max_retries),
+ mPendingRequests(0),
+ mFailCount(0),
+ mCompletionOrFailureCalled(false),
+ mRetryCount(0),
+ LLEventTimer(5.0)
+ {
+ if (!mTrackingPhase.empty())
+ {
+ selfStartPhase(mTrackingPhase);
+ }
+ }
+
+ void addItems(LLInventoryModel::item_array_t& src_items)
+ {
+ for (LLInventoryModel::item_array_t::const_iterator it = src_items.begin();
+ it != src_items.end();
+ ++it)
+ {
+ LLViewerInventoryItem* item = *it;
+ llassert(item);
+ addItem(item->getUUID());
+ }
+ }
+
+ // Request or re-request operation for specified item.
+ void addItem(const LLUUID& item_id)
+ {
+ LL_DEBUGS("Avatar") << "item_id " << item_id << LL_ENDL;
+ if (!requestOperation(item_id))
+ {
+ LL_DEBUGS("Avatar") << "item_id " << item_id << " requestOperation false, skipping" << LL_ENDL;
+ return;
+ }
+
+ mPendingRequests++;
+ // On a re-request, this will reset the timer.
+ mWaitTimes[item_id] = LLTimer();
+ if (mRetryCounts.find(item_id) == mRetryCounts.end())
+ {
+ mRetryCounts[item_id] = 0;
+ }
+ else
+ {
+ mRetryCounts[item_id]++;
+ }
+ }
+
+ virtual bool requestOperation(const LLUUID& item_id) = 0;
+
+ void onOp(const LLUUID& src_id, const LLUUID& dst_id, LLTimer timestamp)
+ {
+ if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateLateOpRate"))
+ {
+ LL_WARNS() << "Simulating late operation by punting handling to later" << LL_ENDL;
+ doAfterInterval(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,src_id,dst_id,timestamp),
+ mRetryAfter);
+ return;
+ }
+ mPendingRequests--;
+ F32 elapsed = timestamp.getElapsedTimeF32();
+ LL_DEBUGS("Avatar") << "op done, src_id " << src_id << " dst_id " << dst_id << " after " << elapsed << " seconds" << LL_ENDL;
+ if (mWaitTimes.find(src_id) == mWaitTimes.end())
+ {
+ // No longer waiting for this item - either serviced
+ // already or gave up after too many retries.
+ LL_WARNS() << "duplicate or late operation, src_id " << src_id << "dst_id " << dst_id
+ << " elapsed " << elapsed << " after end " << (S32) mCompletionOrFailureCalled << LL_ENDL;
+ }
+ mTimeStats.push(elapsed);
+ mWaitTimes.erase(src_id);
+ if (mWaitTimes.empty() && !mCompletionOrFailureCalled)
+ {
+ onCompletionOrFailure();
+ }
+ }
+
+ void onCompletionOrFailure()
+ {
+ assert (!mCompletionOrFailureCalled);
+ mCompletionOrFailureCalled = true;
+
+ // Will never call onCompletion() if any item has been flagged as
+ // a failure - otherwise could wind up with corrupted
+ // outfit, involuntary nudity, etc.
+ reportStats();
+ if (!mTrackingPhase.empty())
+ {
+ selfStopPhase(mTrackingPhase);
+ }
+ if (!mFailCount)
+ {
+ onCompletion();
+ }
+ else
+ {
+ onFailure();
+ }
+ }
+
+ void onFailure()
+ {
+ LL_INFOS() << "failed" << LL_ENDL;
+ mOnFailureFunc();
+ }
+
+ void onCompletion()
+ {
+ LL_INFOS() << "done" << LL_ENDL;
+ mOnCompletionFunc();
+ }
+
+ // virtual
+ // Will be deleted after returning true - only safe to do this if all callbacks have fired.
+ BOOL tick()
+ {
+ // mPendingRequests will be zero if all requests have been
+ // responded to. mWaitTimes.empty() will be true if we have
+ // received at least one reply for each UUID. If requests
+ // have been dropped and retried, these will not necessarily
+ // be the same. Only safe to return true if all requests have
+ // been serviced, since it will result in this object being
+ // deleted.
+ bool all_done = (mPendingRequests==0);
+
+ if (!mWaitTimes.empty())
+ {
+ LL_WARNS() << "still waiting on " << mWaitTimes.size() << " items" << LL_ENDL;
+ for (std::map<LLUUID,LLTimer>::iterator it = mWaitTimes.begin();
+ it != mWaitTimes.end();)
+ {
+ // Use a copy of iterator because it may be erased/invalidated.
+ std::map<LLUUID,LLTimer>::iterator curr_it = it;
+ ++it;
+
+ F32 time_waited = curr_it->second.getElapsedTimeF32();
+ S32 retries = mRetryCounts[curr_it->first];
+ if (time_waited > mRetryAfter)
+ {
+ if (retries < mMaxRetries)
+ {
+ LL_DEBUGS("Avatar") << "Waited " << time_waited <<
+ " for " << curr_it->first << ", retrying" << LL_ENDL;
+ mRetryCount++;
+ addItem(curr_it->first);
+ }
+ else
+ {
+ LL_WARNS() << "Giving up on " << curr_it->first << " after too many retries" << LL_ENDL;
+ mWaitTimes.erase(curr_it);
+ mFailCount++;
+ }
+ }
+ if (mWaitTimes.empty())
+ {
+ onCompletionOrFailure();
+ }
+
+ }
+ }
+ return all_done;
+ }
+
+ void reportStats()
+ {
+ LL_DEBUGS("Avatar") << "Phase: " << mTrackingPhase << LL_ENDL;
+ LL_DEBUGS("Avatar") << "mFailCount: " << mFailCount << LL_ENDL;
+ LL_DEBUGS("Avatar") << "mRetryCount: " << mRetryCount << LL_ENDL;
+ LL_DEBUGS("Avatar") << "Times: n " << mTimeStats.getCount() << " min " << mTimeStats.getMinValue() << " max " << mTimeStats.getMaxValue() << LL_ENDL;
+ LL_DEBUGS("Avatar") << "Mean " << mTimeStats.getMean() << " stddev " << mTimeStats.getStdDev() << LL_ENDL;
+ }
+
+ virtual ~LLCallAfterInventoryBatchMgr()
+ {
+ LL_DEBUGS("Avatar") << "deleting" << LL_ENDL;
+ }
protected:
- std::string mTrackingPhase;
- std::map<LLUUID,LLTimer> mWaitTimes;
- std::map<LLUUID,S32> mRetryCounts;
- LLUUID mDstCatID;
- nullary_func_t mOnCompletionFunc;
- nullary_func_t mOnFailureFunc;
- F32 mRetryAfter;
- S32 mMaxRetries;
- S32 mPendingRequests;
- S32 mFailCount;
- S32 mRetryCount;
- bool mCompletionOrFailureCalled;
- LLViewerStats::StatsAccumulator mTimeStats;
+ std::string mTrackingPhase;
+ std::map<LLUUID,LLTimer> mWaitTimes;
+ std::map<LLUUID,S32> mRetryCounts;
+ LLUUID mDstCatID;
+ nullary_func_t mOnCompletionFunc;
+ nullary_func_t mOnFailureFunc;
+ F32 mRetryAfter;
+ S32 mMaxRetries;
+ S32 mPendingRequests;
+ S32 mFailCount;
+ S32 mRetryCount;
+ bool mCompletionOrFailureCalled;
+ LLViewerStats::StatsAccumulator mTimeStats;
};
class LLCallAfterInventoryCopyMgr: public LLCallAfterInventoryBatchMgr
{
public:
- LLCallAfterInventoryCopyMgr(LLInventoryModel::item_array_t& src_items,
- const LLUUID& dst_cat_id,
- const std::string& phase_name,
- nullary_func_t on_completion_func,
- nullary_func_t on_failure_func = no_op,
- F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL,
- S32 max_retries = DEFAULT_MAX_RETRIES
- ):
- LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries)
- {
- addItems(src_items);
- sInstanceCount++;
- }
-
- ~LLCallAfterInventoryCopyMgr()
- {
- sInstanceCount--;
- }
-
- virtual bool requestOperation(const LLUUID& item_id)
- {
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- llassert(item);
- LL_DEBUGS("Avatar") << "copying item " << item_id << LL_ENDL;
- if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateOpFailureRate"))
- {
- LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << LL_ENDL;
- return true;
- }
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- mDstCatID,
- std::string(),
- new LLBoostFuncInventoryCallback(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))
- );
- return true;
- }
-
- static S32 getInstanceCount() { return sInstanceCount; }
-
+ LLCallAfterInventoryCopyMgr(LLInventoryModel::item_array_t& src_items,
+ const LLUUID& dst_cat_id,
+ const std::string& phase_name,
+ nullary_func_t on_completion_func,
+ nullary_func_t on_failure_func = no_op,
+ F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL,
+ S32 max_retries = DEFAULT_MAX_RETRIES
+ ):
+ LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries)
+ {
+ addItems(src_items);
+ sInstanceCount++;
+ }
+
+ ~LLCallAfterInventoryCopyMgr()
+ {
+ sInstanceCount--;
+ }
+
+ virtual bool requestOperation(const LLUUID& item_id)
+ {
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ llassert(item);
+ LL_DEBUGS("Avatar") << "copying item " << item_id << LL_ENDL;
+ if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateOpFailureRate"))
+ {
+ LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << LL_ENDL;
+ return true;
+ }
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ mDstCatID,
+ std::string(),
+ new LLBoostFuncInventoryCallback(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))
+ );
+ return true;
+ }
+
+ static S32 getInstanceCount() { return sInstanceCount; }
+
private:
- static S32 sInstanceCount;
+ static S32 sInstanceCount;
};
S32 LLCallAfterInventoryCopyMgr::sInstanceCount = 0;
@@ -465,97 +465,97 @@ S32 LLCallAfterInventoryCopyMgr::sInstanceCount = 0;
class LLWearCategoryAfterCopy: public LLInventoryCallback
{
public:
- LLWearCategoryAfterCopy(bool append):
- mAppend(append)
- {}
-
- // virtual
- void fire(const LLUUID& id)
- {
- // Wear the inventory category.
- LLInventoryCategory* cat = gInventory.getCategory(id);
- LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(cat, mAppend);
- }
+ LLWearCategoryAfterCopy(bool append):
+ mAppend(append)
+ {}
+
+ // virtual
+ void fire(const LLUUID& id)
+ {
+ // Wear the inventory category.
+ LLInventoryCategory* cat = gInventory.getCategory(id);
+ LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(cat, mAppend);
+ }
private:
- bool mAppend;
+ bool mAppend;
};
class LLTrackPhaseWrapper : public LLInventoryCallback
{
public:
- LLTrackPhaseWrapper(const std::string& phase_name, LLPointer<LLInventoryCallback> cb = NULL):
- mTrackingPhase(phase_name),
- mCB(cb)
- {
- selfStartPhase(mTrackingPhase);
- }
-
- // virtual
- void fire(const LLUUID& id)
- {
- if (mCB)
- {
- mCB->fire(id);
- }
- }
-
- // virtual
- ~LLTrackPhaseWrapper()
- {
- selfStopPhase(mTrackingPhase);
- }
+ LLTrackPhaseWrapper(const std::string& phase_name, LLPointer<LLInventoryCallback> cb = NULL):
+ mTrackingPhase(phase_name),
+ mCB(cb)
+ {
+ selfStartPhase(mTrackingPhase);
+ }
+
+ // virtual
+ void fire(const LLUUID& id)
+ {
+ if (mCB)
+ {
+ mCB->fire(id);
+ }
+ }
+
+ // virtual
+ ~LLTrackPhaseWrapper()
+ {
+ selfStopPhase(mTrackingPhase);
+ }
protected:
- std::string mTrackingPhase;
- LLPointer<LLInventoryCallback> mCB;
+ std::string mTrackingPhase;
+ LLPointer<LLInventoryCallback> mCB;
};
LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy(bool enforce_item_restrictions,
- bool enforce_ordering,
- nullary_func_t post_update_func
- ):
- mFireCount(0),
- mEnforceItemRestrictions(enforce_item_restrictions),
- mEnforceOrdering(enforce_ordering),
- mPostUpdateFunc(post_update_func)
+ bool enforce_ordering,
+ nullary_func_t post_update_func
+ ):
+ mFireCount(0),
+ mEnforceItemRestrictions(enforce_item_restrictions),
+ mEnforceOrdering(enforce_ordering),
+ mPostUpdateFunc(post_update_func)
{
- selfStartPhase("update_appearance_on_destroy");
+ selfStartPhase("update_appearance_on_destroy");
}
void LLUpdateAppearanceOnDestroy::fire(const LLUUID& inv_item)
{
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(inv_item);
- const std::string item_name = item ? item->getName() : "ITEM NOT FOUND";
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(inv_item);
+ const std::string item_name = item ? item->getName() : "ITEM NOT FOUND";
#ifndef LL_RELEASE_FOR_DOWNLOAD
- LL_DEBUGS("Avatar") << self_av_string() << "callback fired [ name:" << item_name << " UUID:" << inv_item << " count:" << mFireCount << " ] " << LL_ENDL;
+ LL_DEBUGS("Avatar") << self_av_string() << "callback fired [ name:" << item_name << " UUID:" << inv_item << " count:" << mFireCount << " ] " << LL_ENDL;
#endif
- mFireCount++;
+ mFireCount++;
}
LLUpdateAppearanceOnDestroy::~LLUpdateAppearanceOnDestroy()
{
- if (!LLApp::isExiting())
- {
- // speculative fix for MAINT-1150
- LL_INFOS("Avatar") << self_av_string() << "done update appearance on destroy" << LL_ENDL;
+ if (!LLApp::isExiting())
+ {
+ // speculative fix for MAINT-1150
+ LL_INFOS("Avatar") << self_av_string() << "done update appearance on destroy" << LL_ENDL;
- selfStopPhase("update_appearance_on_destroy");
+ selfStopPhase("update_appearance_on_destroy");
- LLAppearanceMgr::instance().updateAppearanceFromCOF(mEnforceItemRestrictions,
- mEnforceOrdering,
- mPostUpdateFunc);
- }
+ LLAppearanceMgr::instance().updateAppearanceFromCOF(mEnforceItemRestrictions,
+ mEnforceOrdering,
+ mPostUpdateFunc);
+ }
}
LLUpdateAppearanceAndEditWearableOnDestroy::LLUpdateAppearanceAndEditWearableOnDestroy(const LLUUID& item_id):
- mItemID(item_id)
+ mItemID(item_id)
{
}
LLRequestServerAppearanceUpdateOnDestroy::~LLRequestServerAppearanceUpdateOnDestroy()
{
- LL_DEBUGS("Avatar") << "ATT requesting server appearance update" << LL_ENDL;
+ LL_DEBUGS("Avatar") << "ATT requesting server appearance update" << LL_ENDL;
if (!LLApp::isExiting())
{
LLAppearanceMgr::instance().requestServerAppearanceUpdate();
@@ -564,30 +564,30 @@ LLRequestServerAppearanceUpdateOnDestroy::~LLRequestServerAppearanceUpdateOnDest
void edit_wearable_and_customize_avatar(LLUUID item_id)
{
- // Start editing the item if previously requested.
- gAgentWearables.editWearableIfRequested(item_id);
-
- // TODO: camera mode may not be changed if a debug setting is tweaked
- if( gAgentCamera.cameraCustomizeAvatar() )
- {
- // If we're in appearance editing mode, the current tab may need to be refreshed
- LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(
- LLFloaterSidePanelContainer::getPanel("appearance"));
- if (panel)
- {
- panel->showDefaultSubpart();
- }
- }
+ // Start editing the item if previously requested.
+ gAgentWearables.editWearableIfRequested(item_id);
+
+ // TODO: camera mode may not be changed if a debug setting is tweaked
+ if( gAgentCamera.cameraCustomizeAvatar() )
+ {
+ // If we're in appearance editing mode, the current tab may need to be refreshed
+ LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(
+ LLFloaterSidePanelContainer::getPanel("appearance"));
+ if (panel)
+ {
+ panel->showDefaultSubpart();
+ }
+ }
}
LLUpdateAppearanceAndEditWearableOnDestroy::~LLUpdateAppearanceAndEditWearableOnDestroy()
{
- if (!LLApp::isExiting())
- {
- LLAppearanceMgr::instance().updateAppearanceFromCOF(
- true,true,
- boost::bind(edit_wearable_and_customize_avatar, mItemID));
- }
+ if (!LLApp::isExiting())
+ {
+ LLAppearanceMgr::instance().updateAppearanceFromCOF(
+ true,true,
+ boost::bind(edit_wearable_and_customize_avatar, mItemID));
+ }
}
class LLBrokenLinkObserver : public LLInventoryObserver
@@ -658,738 +658,738 @@ void LLBrokenLinkObserver::postProcess()
struct LLFoundData
{
- LLFoundData() :
- mAssetType(LLAssetType::AT_NONE),
- mWearableType(LLWearableType::WT_INVALID),
- mWearable(NULL) {}
-
- LLFoundData(const LLUUID& item_id,
- const LLUUID& asset_id,
- const std::string& name,
- const LLAssetType::EType& asset_type,
- const LLWearableType::EType& wearable_type,
- const bool is_replacement = false
- ) :
- mItemID(item_id),
- mAssetID(asset_id),
- mName(name),
- mAssetType(asset_type),
- mWearableType(wearable_type),
- mIsReplacement(is_replacement),
- mWearable( NULL ) {}
-
- LLUUID mItemID;
- LLUUID mAssetID;
- std::string mName;
- LLAssetType::EType mAssetType;
- LLWearableType::EType mWearableType;
- LLViewerWearable* mWearable;
- bool mIsReplacement;
+ LLFoundData() :
+ mAssetType(LLAssetType::AT_NONE),
+ mWearableType(LLWearableType::WT_INVALID),
+ mWearable(NULL) {}
+
+ LLFoundData(const LLUUID& item_id,
+ const LLUUID& asset_id,
+ const std::string& name,
+ const LLAssetType::EType& asset_type,
+ const LLWearableType::EType& wearable_type,
+ const bool is_replacement = false
+ ) :
+ mItemID(item_id),
+ mAssetID(asset_id),
+ mName(name),
+ mAssetType(asset_type),
+ mWearableType(wearable_type),
+ mIsReplacement(is_replacement),
+ mWearable( NULL ) {}
+
+ LLUUID mItemID;
+ LLUUID mAssetID;
+ std::string mName;
+ LLAssetType::EType mAssetType;
+ LLWearableType::EType mWearableType;
+ LLViewerWearable* mWearable;
+ bool mIsReplacement;
};
-
+
class LLWearableHoldingPattern
{
- LOG_CLASS(LLWearableHoldingPattern);
+ LOG_CLASS(LLWearableHoldingPattern);
public:
- LLWearableHoldingPattern();
- ~LLWearableHoldingPattern();
-
- bool pollFetchCompletion();
- void onFetchCompletion();
- bool isFetchCompleted();
- bool isTimedOut();
-
- void checkMissingWearables();
- bool pollMissingWearables();
- bool isMissingCompleted();
- void recoverMissingWearable(LLWearableType::EType type);
- void clearCOFLinksForMissingWearables();
-
- void onWearableAssetFetch(LLViewerWearable *wearable);
- void onAllComplete();
-
- typedef std::list<LLFoundData> found_list_t;
- found_list_t& getFoundList();
- void eraseTypeToLink(LLWearableType::EType type);
- void eraseTypeToRecover(LLWearableType::EType type);
- void setObjItems(const LLInventoryModel::item_array_t& items);
- void setGestItems(const LLInventoryModel::item_array_t& items);
- bool isMostRecent();
- void handleLateArrivals();
- void resetTime(F32 timeout);
- static S32 countActive() { return sActiveHoldingPatterns.size(); }
- S32 index() { return mIndex; }
-
+ LLWearableHoldingPattern();
+ ~LLWearableHoldingPattern();
+
+ bool pollFetchCompletion();
+ void onFetchCompletion();
+ bool isFetchCompleted();
+ bool isTimedOut();
+
+ void checkMissingWearables();
+ bool pollMissingWearables();
+ bool isMissingCompleted();
+ void recoverMissingWearable(LLWearableType::EType type);
+ void clearCOFLinksForMissingWearables();
+
+ void onWearableAssetFetch(LLViewerWearable *wearable);
+ void onAllComplete();
+
+ typedef std::list<LLFoundData> found_list_t;
+ found_list_t& getFoundList();
+ void eraseTypeToLink(LLWearableType::EType type);
+ void eraseTypeToRecover(LLWearableType::EType type);
+ void setObjItems(const LLInventoryModel::item_array_t& items);
+ void setGestItems(const LLInventoryModel::item_array_t& items);
+ bool isMostRecent();
+ void handleLateArrivals();
+ void resetTime(F32 timeout);
+ static S32 countActive() { return sActiveHoldingPatterns.size(); }
+ S32 index() { return mIndex; }
+
private:
- found_list_t mFoundList;
- LLInventoryModel::item_array_t mObjItems;
- LLInventoryModel::item_array_t mGestItems;
- typedef std::set<S32> type_set_t;
- type_set_t mTypesToRecover;
- type_set_t mTypesToLink;
- S32 mResolved;
- LLTimer mWaitTime;
- bool mFired;
- typedef std::set<LLWearableHoldingPattern*> type_set_hp;
- static type_set_hp sActiveHoldingPatterns;
- static S32 sNextIndex;
- S32 mIndex;
- bool mIsMostRecent;
- std::set<LLViewerWearable*> mLateArrivals;
- bool mIsAllComplete;
+ found_list_t mFoundList;
+ LLInventoryModel::item_array_t mObjItems;
+ LLInventoryModel::item_array_t mGestItems;
+ typedef std::set<S32> type_set_t;
+ type_set_t mTypesToRecover;
+ type_set_t mTypesToLink;
+ S32 mResolved;
+ LLTimer mWaitTime;
+ bool mFired;
+ typedef std::set<LLWearableHoldingPattern*> type_set_hp;
+ static type_set_hp sActiveHoldingPatterns;
+ static S32 sNextIndex;
+ S32 mIndex;
+ bool mIsMostRecent;
+ std::set<LLViewerWearable*> mLateArrivals;
+ bool mIsAllComplete;
};
LLWearableHoldingPattern::type_set_hp LLWearableHoldingPattern::sActiveHoldingPatterns;
S32 LLWearableHoldingPattern::sNextIndex = 0;
LLWearableHoldingPattern::LLWearableHoldingPattern():
- mResolved(0),
- mFired(false),
- mIsMostRecent(true),
- mIsAllComplete(false)
-{
- if (countActive()>0)
- {
- LL_INFOS() << "Creating LLWearableHoldingPattern when "
- << countActive()
- << " other attempts are active."
- << " Flagging others as invalid."
- << LL_ENDL;
- for (type_set_hp::iterator it = sActiveHoldingPatterns.begin();
- it != sActiveHoldingPatterns.end();
- ++it)
- {
- (*it)->mIsMostRecent = false;
- }
-
- }
- mIndex = sNextIndex++;
- sActiveHoldingPatterns.insert(this);
- LL_DEBUGS("Avatar") << "HP " << index() << " created" << LL_ENDL;
- selfStartPhase("holding_pattern");
+ mResolved(0),
+ mFired(false),
+ mIsMostRecent(true),
+ mIsAllComplete(false)
+{
+ if (countActive()>0)
+ {
+ LL_INFOS() << "Creating LLWearableHoldingPattern when "
+ << countActive()
+ << " other attempts are active."
+ << " Flagging others as invalid."
+ << LL_ENDL;
+ for (type_set_hp::iterator it = sActiveHoldingPatterns.begin();
+ it != sActiveHoldingPatterns.end();
+ ++it)
+ {
+ (*it)->mIsMostRecent = false;
+ }
+
+ }
+ mIndex = sNextIndex++;
+ sActiveHoldingPatterns.insert(this);
+ LL_DEBUGS("Avatar") << "HP " << index() << " created" << LL_ENDL;
+ selfStartPhase("holding_pattern");
}
LLWearableHoldingPattern::~LLWearableHoldingPattern()
{
- sActiveHoldingPatterns.erase(this);
- if (isMostRecent())
- {
- selfStopPhase("holding_pattern");
- }
- LL_DEBUGS("Avatar") << "HP " << index() << " deleted" << LL_ENDL;
+ sActiveHoldingPatterns.erase(this);
+ if (isMostRecent())
+ {
+ selfStopPhase("holding_pattern");
+ }
+ LL_DEBUGS("Avatar") << "HP " << index() << " deleted" << LL_ENDL;
}
bool LLWearableHoldingPattern::isMostRecent()
{
- return mIsMostRecent;
+ return mIsMostRecent;
}
LLWearableHoldingPattern::found_list_t& LLWearableHoldingPattern::getFoundList()
{
- return mFoundList;
+ return mFoundList;
}
void LLWearableHoldingPattern::eraseTypeToLink(LLWearableType::EType type)
{
- mTypesToLink.erase(type);
+ mTypesToLink.erase(type);
}
void LLWearableHoldingPattern::eraseTypeToRecover(LLWearableType::EType type)
{
- mTypesToRecover.erase(type);
+ mTypesToRecover.erase(type);
}
void LLWearableHoldingPattern::setObjItems(const LLInventoryModel::item_array_t& items)
{
- mObjItems = items;
+ mObjItems = items;
}
void LLWearableHoldingPattern::setGestItems(const LLInventoryModel::item_array_t& items)
{
- mGestItems = items;
+ mGestItems = items;
}
bool LLWearableHoldingPattern::isFetchCompleted()
{
- return (mResolved >= (S32)getFoundList().size()); // have everything we were waiting for?
+ return (mResolved >= (S32)getFoundList().size()); // have everything we were waiting for?
}
bool LLWearableHoldingPattern::isTimedOut()
{
- return mWaitTime.hasExpired();
+ return mWaitTime.hasExpired();
}
void LLWearableHoldingPattern::checkMissingWearables()
{
- if (!isMostRecent())
- {
- // runway why don't we actually skip here?
- LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
- }
-
- std::vector<S32> found_by_type(LLWearableType::WT_COUNT,0);
- std::vector<S32> requested_by_type(LLWearableType::WT_COUNT,0);
- for (found_list_t::iterator it = getFoundList().begin(); it != getFoundList().end(); ++it)
- {
- LLFoundData &data = *it;
- if (data.mWearableType < LLWearableType::WT_COUNT)
- requested_by_type[data.mWearableType]++;
- if (data.mWearable)
- found_by_type[data.mWearableType]++;
- }
-
- for (S32 type = 0; type < LLWearableType::WT_COUNT; ++type)
- {
- if (requested_by_type[type] > found_by_type[type])
- {
- LL_WARNS() << self_av_string() << "got fewer wearables than requested, type " << type << ": requested " << requested_by_type[type] << ", found " << found_by_type[type] << LL_ENDL;
- }
- if (found_by_type[type] > 0)
- continue;
- if (
- // If at least one wearable of certain types (pants/shirt/skirt)
- // was requested but none was found, create a default asset as a replacement.
- // In all other cases, don't do anything.
- // For critical types (shape/hair/skin/eyes), this will keep the avatar as a cloud
- // due to logic in LLVOAvatarSelf::getIsCloud().
- // For non-critical types (tatoo, socks, etc.) the wearable will just be missing.
- (requested_by_type[type] > 0) &&
- ((type == LLWearableType::WT_PANTS) || (type == LLWearableType::WT_SHIRT) || (type == LLWearableType::WT_SKIRT)))
- {
- mTypesToRecover.insert(type);
- mTypesToLink.insert(type);
- recoverMissingWearable((LLWearableType::EType)type);
- LL_WARNS() << self_av_string() << "need to replace " << type << LL_ENDL;
- }
- }
-
- resetTime(60.0F);
-
- if (isMostRecent())
- {
- selfStartPhase("get_missing_wearables_2");
- }
- if (!pollMissingWearables())
- {
- doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollMissingWearables,this));
- }
+ if (!isMostRecent())
+ {
+ // runway why don't we actually skip here?
+ LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
+ }
+
+ std::vector<S32> found_by_type(LLWearableType::WT_COUNT,0);
+ std::vector<S32> requested_by_type(LLWearableType::WT_COUNT,0);
+ for (found_list_t::iterator it = getFoundList().begin(); it != getFoundList().end(); ++it)
+ {
+ LLFoundData &data = *it;
+ if (data.mWearableType < LLWearableType::WT_COUNT)
+ requested_by_type[data.mWearableType]++;
+ if (data.mWearable)
+ found_by_type[data.mWearableType]++;
+ }
+
+ for (S32 type = 0; type < LLWearableType::WT_COUNT; ++type)
+ {
+ if (requested_by_type[type] > found_by_type[type])
+ {
+ LL_WARNS() << self_av_string() << "got fewer wearables than requested, type " << type << ": requested " << requested_by_type[type] << ", found " << found_by_type[type] << LL_ENDL;
+ }
+ if (found_by_type[type] > 0)
+ continue;
+ if (
+ // If at least one wearable of certain types (pants/shirt/skirt)
+ // was requested but none was found, create a default asset as a replacement.
+ // In all other cases, don't do anything.
+ // For critical types (shape/hair/skin/eyes), this will keep the avatar as a cloud
+ // due to logic in LLVOAvatarSelf::getIsCloud().
+ // For non-critical types (tatoo, socks, etc.) the wearable will just be missing.
+ (requested_by_type[type] > 0) &&
+ ((type == LLWearableType::WT_PANTS) || (type == LLWearableType::WT_SHIRT) || (type == LLWearableType::WT_SKIRT)))
+ {
+ mTypesToRecover.insert(type);
+ mTypesToLink.insert(type);
+ recoverMissingWearable((LLWearableType::EType)type);
+ LL_WARNS() << self_av_string() << "need to replace " << type << LL_ENDL;
+ }
+ }
+
+ resetTime(60.0F);
+
+ if (isMostRecent())
+ {
+ selfStartPhase("get_missing_wearables_2");
+ }
+ if (!pollMissingWearables())
+ {
+ doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollMissingWearables,this));
+ }
}
void LLWearableHoldingPattern::onAllComplete()
{
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->outputRezTiming("Agent wearables fetch complete");
- }
-
- if (!isMostRecent())
- {
- // runway need to skip here?
- LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
- }
-
- // Activate all gestures in this folder
- if (mGestItems.size() > 0)
- {
- LL_DEBUGS("Avatar") << self_av_string() << "Activating " << mGestItems.size() << " gestures" << LL_ENDL;
-
- LLGestureMgr::instance().activateGestures(mGestItems);
-
- // Update the inventory item labels to reflect the fact
- // they are active.
- LLViewerInventoryCategory* catp =
- gInventory.getCategory(LLAppearanceMgr::instance().getCOF());
-
- if (catp)
- {
- gInventory.updateCategory(catp);
- gInventory.notifyObservers();
- }
- }
-
- if (isAgentAvatarValid())
- {
- LL_DEBUGS("Avatar") << self_av_string() << "Updating " << mObjItems.size() << " attachments" << LL_ENDL;
- LLAgentWearables::llvo_vec_t objects_to_remove;
- LLAgentWearables::llvo_vec_t objects_to_retain;
- LLInventoryModel::item_array_t items_to_add;
-
- LLAgentWearables::findAttachmentsAddRemoveInfo(mObjItems,
- objects_to_remove,
- objects_to_retain,
- items_to_add);
-
- LL_DEBUGS("Avatar") << self_av_string() << "Removing " << objects_to_remove.size()
- << " attachments" << LL_ENDL;
-
- // Here we remove the attachment pos overrides for *all*
- // attachments, even those that are not being removed. This is
- // needed to get joint positions all slammed down to their
- // pre-attachment states.
- gAgentAvatarp->clearAttachmentOverrides();
-
- if (objects_to_remove.size() || items_to_add.size())
- {
- LL_DEBUGS("Avatar") << "ATT will remove " << objects_to_remove.size()
- << " and add " << items_to_add.size() << " items" << LL_ENDL;
- }
-
- // Take off the attachments that will no longer be in the outfit.
- LLAgentWearables::userRemoveMultipleAttachments(objects_to_remove);
-
- // Update wearables.
- LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " updating agent wearables with "
- << mResolved << " wearable items " << LL_ENDL;
- LLAppearanceMgr::instance().updateAgentWearables(this);
-
- // Restore attachment pos overrides for the attachments that
- // are remaining in the outfit.
- for (LLAgentWearables::llvo_vec_t::iterator it = objects_to_retain.begin();
- it != objects_to_retain.end();
- ++it)
- {
- LLViewerObject *objectp = *it;
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->outputRezTiming("Agent wearables fetch complete");
+ }
+
+ if (!isMostRecent())
+ {
+ // runway need to skip here?
+ LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
+ }
+
+ // Activate all gestures in this folder
+ if (mGestItems.size() > 0)
+ {
+ LL_DEBUGS("Avatar") << self_av_string() << "Activating " << mGestItems.size() << " gestures" << LL_ENDL;
+
+ LLGestureMgr::instance().activateGestures(mGestItems);
+
+ // Update the inventory item labels to reflect the fact
+ // they are active.
+ LLViewerInventoryCategory* catp =
+ gInventory.getCategory(LLAppearanceMgr::instance().getCOF());
+
+ if (catp)
+ {
+ gInventory.updateCategory(catp);
+ gInventory.notifyObservers();
+ }
+ }
+
+ if (isAgentAvatarValid())
+ {
+ LL_DEBUGS("Avatar") << self_av_string() << "Updating " << mObjItems.size() << " attachments" << LL_ENDL;
+ LLAgentWearables::llvo_vec_t objects_to_remove;
+ LLAgentWearables::llvo_vec_t objects_to_retain;
+ LLInventoryModel::item_array_t items_to_add;
+
+ LLAgentWearables::findAttachmentsAddRemoveInfo(mObjItems,
+ objects_to_remove,
+ objects_to_retain,
+ items_to_add);
+
+ LL_DEBUGS("Avatar") << self_av_string() << "Removing " << objects_to_remove.size()
+ << " attachments" << LL_ENDL;
+
+ // Here we remove the attachment pos overrides for *all*
+ // attachments, even those that are not being removed. This is
+ // needed to get joint positions all slammed down to their
+ // pre-attachment states.
+ gAgentAvatarp->clearAttachmentOverrides();
+
+ if (objects_to_remove.size() || items_to_add.size())
+ {
+ LL_DEBUGS("Avatar") << "ATT will remove " << objects_to_remove.size()
+ << " and add " << items_to_add.size() << " items" << LL_ENDL;
+ }
+
+ // Take off the attachments that will no longer be in the outfit.
+ LLAgentWearables::userRemoveMultipleAttachments(objects_to_remove);
+
+ // Update wearables.
+ LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " updating agent wearables with "
+ << mResolved << " wearable items " << LL_ENDL;
+ LLAppearanceMgr::instance().updateAgentWearables(this);
+
+ // Restore attachment pos overrides for the attachments that
+ // are remaining in the outfit.
+ for (LLAgentWearables::llvo_vec_t::iterator it = objects_to_retain.begin();
+ it != objects_to_retain.end();
+ ++it)
+ {
+ LLViewerObject *objectp = *it;
if (!objectp->isAnimatedObject())
{
gAgentAvatarp->addAttachmentOverridesForObject(objectp);
}
- }
-
- // Add new attachments to match those requested.
- LL_DEBUGS("Avatar") << self_av_string() << "Adding " << items_to_add.size() << " attachments" << LL_ENDL;
- LLAgentWearables::userAttachMultipleAttachments(items_to_add);
- }
-
- if (isFetchCompleted() && isMissingCompleted())
- {
- // Only safe to delete if all wearable callbacks and all missing wearables completed.
- delete this;
- }
- else
- {
- mIsAllComplete = true;
- handleLateArrivals();
- }
+ }
+
+ // Add new attachments to match those requested.
+ LL_DEBUGS("Avatar") << self_av_string() << "Adding " << items_to_add.size() << " attachments" << LL_ENDL;
+ LLAgentWearables::userAttachMultipleAttachments(items_to_add);
+ }
+
+ if (isFetchCompleted() && isMissingCompleted())
+ {
+ // Only safe to delete if all wearable callbacks and all missing wearables completed.
+ delete this;
+ }
+ else
+ {
+ mIsAllComplete = true;
+ handleLateArrivals();
+ }
}
void LLWearableHoldingPattern::onFetchCompletion()
{
- if (isMostRecent())
- {
- selfStopPhase("get_wearables_2");
- }
-
- if (!isMostRecent())
- {
- // runway skip here?
- LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
- }
+ if (isMostRecent())
+ {
+ selfStopPhase("get_wearables_2");
+ }
+
+ if (!isMostRecent())
+ {
+ // runway skip here?
+ LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
+ }
- checkMissingWearables();
+ checkMissingWearables();
}
// Runs as an idle callback until all wearables are fetched (or we time out).
bool LLWearableHoldingPattern::pollFetchCompletion()
{
- if (!isMostRecent())
- {
- // runway skip here?
- LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
- }
+ if (!isMostRecent())
+ {
+ // runway skip here?
+ LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
+ }
- bool completed = isFetchCompleted();
- bool timed_out = isTimedOut();
- bool done = completed || timed_out;
+ bool completed = isFetchCompleted();
+ bool timed_out = isTimedOut();
+ bool done = completed || timed_out;
+
+ if (done)
+ {
+ LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " polling, done status: " << completed << " timed out " << timed_out
+ << " elapsed " << mWaitTime.getElapsedTimeF32() << LL_ENDL;
- if (done)
- {
- LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " polling, done status: " << completed << " timed out " << timed_out
- << " elapsed " << mWaitTime.getElapsedTimeF32() << LL_ENDL;
+ mFired = true;
- mFired = true;
-
- if (timed_out)
- {
- LL_WARNS() << self_av_string() << "Exceeded max wait time for wearables, updating appearance based on what has arrived" << LL_ENDL;
- }
+ if (timed_out)
+ {
+ LL_WARNS() << self_av_string() << "Exceeded max wait time for wearables, updating appearance based on what has arrived" << LL_ENDL;
+ }
- onFetchCompletion();
- }
- return done;
+ onFetchCompletion();
+ }
+ return done;
}
void recovered_item_link_cb(const LLUUID& item_id, LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder)
{
- if (!holder->isMostRecent())
- {
- LL_WARNS() << "HP " << holder->index() << " skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
- // runway skip here?
- }
-
- LL_INFOS("Avatar") << "HP " << holder->index() << " recovered item link for type " << type << LL_ENDL;
- holder->eraseTypeToLink(type);
- // Add wearable to FoundData for actual wearing
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
-
- if (linked_item)
- {
- gInventory.addChangedMask(LLInventoryObserver::LABEL, linked_item->getUUID());
-
- if (item)
- {
- LLFoundData found(linked_item->getUUID(),
- linked_item->getAssetUUID(),
- linked_item->getName(),
- linked_item->getType(),
- linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID,
- true // is replacement
- );
- found.mWearable = wearable;
- holder->getFoundList().push_front(found);
- }
- else
- {
- LL_WARNS() << self_av_string() << "inventory link not found for recovered wearable" << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS() << self_av_string() << "HP " << holder->index() << " inventory link not found for recovered wearable" << LL_ENDL;
- }
+ if (!holder->isMostRecent())
+ {
+ LL_WARNS() << "HP " << holder->index() << " skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
+ // runway skip here?
+ }
+
+ LL_INFOS("Avatar") << "HP " << holder->index() << " recovered item link for type " << type << LL_ENDL;
+ holder->eraseTypeToLink(type);
+ // Add wearable to FoundData for actual wearing
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
+
+ if (linked_item)
+ {
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, linked_item->getUUID());
+
+ if (item)
+ {
+ LLFoundData found(linked_item->getUUID(),
+ linked_item->getAssetUUID(),
+ linked_item->getName(),
+ linked_item->getType(),
+ linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID,
+ true // is replacement
+ );
+ found.mWearable = wearable;
+ holder->getFoundList().push_front(found);
+ }
+ else
+ {
+ LL_WARNS() << self_av_string() << "inventory link not found for recovered wearable" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS() << self_av_string() << "HP " << holder->index() << " inventory link not found for recovered wearable" << LL_ENDL;
+ }
}
void recovered_item_cb(const LLUUID& item_id, LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder)
{
- if (!holder->isMostRecent())
- {
- // runway skip here?
- LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
- }
+ if (!holder->isMostRecent())
+ {
+ // runway skip here?
+ LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
+ }
- LL_DEBUGS("Avatar") << self_av_string() << "Recovered item for type " << type << LL_ENDL;
- LLConstPointer<LLInventoryObject> itemp = gInventory.getItem(item_id);
- wearable->setItemID(item_id);
- holder->eraseTypeToRecover(type);
- llassert(itemp);
- if (itemp)
- {
- LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(recovered_item_link_cb,_1,type,wearable,holder));
+ LL_DEBUGS("Avatar") << self_av_string() << "Recovered item for type " << type << LL_ENDL;
+ LLConstPointer<LLInventoryObject> itemp = gInventory.getItem(item_id);
+ wearable->setItemID(item_id);
+ holder->eraseTypeToRecover(type);
+ llassert(itemp);
+ if (itemp)
+ {
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(recovered_item_link_cb,_1,type,wearable,holder));
- link_inventory_object(LLAppearanceMgr::instance().getCOF(), itemp, cb);
- }
+ link_inventory_object(LLAppearanceMgr::instance().getCOF(), itemp, cb);
+ }
}
void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type)
{
- if (!isMostRecent())
- {
- // runway skip here?
- LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
- }
-
- // Try to recover by replacing missing wearable with a new one.
- LLNotificationsUtil::add("ReplacedMissingWearable");
- LL_DEBUGS("Avatar") << "Wearable of type '" << LLWearableType::getInstance()->getTypeName(type)
- << "' could not be downloaded. Replaced inventory item with default wearable." << LL_ENDL;
- LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
-
- // Add a new one in the lost and found folder.
- const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(recovered_item_cb,_1,type,wearable,this));
+ if (!isMostRecent())
+ {
+ // runway skip here?
+ LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
+ }
+
+ // Try to recover by replacing missing wearable with a new one.
+ LLNotificationsUtil::add("ReplacedMissingWearable");
+ LL_DEBUGS("Avatar") << "Wearable of type '" << LLWearableType::getInstance()->getTypeName(type)
+ << "' could not be downloaded. Replaced inventory item with default wearable." << LL_ENDL;
+ LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
+
+ // Add a new one in the lost and found folder.
+ const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(recovered_item_cb,_1,type,wearable,this));
create_inventory_wearable(gAgent.getID(),
- gAgent.getSessionID(),
- lost_and_found_id,
- wearable->getTransactionID(),
- wearable->getName(),
- wearable->getDescription(),
- wearable->getAssetType(),
- wearable->getType(),
- wearable->getPermissions().getMaskNextOwner(),
- cb);
+ gAgent.getSessionID(),
+ lost_and_found_id,
+ wearable->getTransactionID(),
+ wearable->getName(),
+ wearable->getDescription(),
+ wearable->getAssetType(),
+ wearable->getType(),
+ wearable->getPermissions().getMaskNextOwner(),
+ cb);
}
bool LLWearableHoldingPattern::isMissingCompleted()
{
- return mTypesToLink.size()==0 && mTypesToRecover.size()==0;
+ return mTypesToLink.size()==0 && mTypesToRecover.size()==0;
}
void LLWearableHoldingPattern::clearCOFLinksForMissingWearables()
{
- for (found_list_t::iterator it = getFoundList().begin(); it != getFoundList().end(); ++it)
- {
- LLFoundData &data = *it;
- if ((data.mWearableType < LLWearableType::WT_COUNT) && (!data.mWearable))
- {
- // Wearable link that was never resolved; remove links to it from COF
- LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " removing link for unresolved item " << data.mItemID.asString() << LL_ENDL;
- LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID);
- }
- }
+ for (found_list_t::iterator it = getFoundList().begin(); it != getFoundList().end(); ++it)
+ {
+ LLFoundData &data = *it;
+ if ((data.mWearableType < LLWearableType::WT_COUNT) && (!data.mWearable))
+ {
+ // Wearable link that was never resolved; remove links to it from COF
+ LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " removing link for unresolved item " << data.mItemID.asString() << LL_ENDL;
+ LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID);
+ }
+ }
}
bool LLWearableHoldingPattern::pollMissingWearables()
{
- if (!isMostRecent())
- {
- // runway skip here?
- LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
- }
-
- bool timed_out = isTimedOut();
- bool missing_completed = isMissingCompleted();
- bool done = timed_out || missing_completed;
-
- if (!done)
- {
- LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " polling missing wearables, waiting for items " << mTypesToRecover.size()
- << " links " << mTypesToLink.size()
- << " wearables, timed out " << timed_out
- << " elapsed " << mWaitTime.getElapsedTimeF32()
- << " done " << done << LL_ENDL;
- }
-
- if (done)
- {
- if (isMostRecent())
- {
- selfStopPhase("get_missing_wearables_2");
- }
-
- gAgentAvatarp->debugWearablesLoaded();
-
- // BAP - if we don't call clearCOFLinksForMissingWearables()
- // here, we won't have to add the link back in later if the
- // wearable arrives late. This is to avoid corruption of
- // wearable ordering info. Also has the effect of making
- // unworn item links visible in the COF under some
- // circumstances.
-
- //clearCOFLinksForMissingWearables();
- onAllComplete();
- }
- return done;
+ if (!isMostRecent())
+ {
+ // runway skip here?
+ LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
+ }
+
+ bool timed_out = isTimedOut();
+ bool missing_completed = isMissingCompleted();
+ bool done = timed_out || missing_completed;
+
+ if (!done)
+ {
+ LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " polling missing wearables, waiting for items " << mTypesToRecover.size()
+ << " links " << mTypesToLink.size()
+ << " wearables, timed out " << timed_out
+ << " elapsed " << mWaitTime.getElapsedTimeF32()
+ << " done " << done << LL_ENDL;
+ }
+
+ if (done)
+ {
+ if (isMostRecent())
+ {
+ selfStopPhase("get_missing_wearables_2");
+ }
+
+ gAgentAvatarp->debugWearablesLoaded();
+
+ // BAP - if we don't call clearCOFLinksForMissingWearables()
+ // here, we won't have to add the link back in later if the
+ // wearable arrives late. This is to avoid corruption of
+ // wearable ordering info. Also has the effect of making
+ // unworn item links visible in the COF under some
+ // circumstances.
+
+ //clearCOFLinksForMissingWearables();
+ onAllComplete();
+ }
+ return done;
}
// Handle wearables that arrived after the timeout period expired.
void LLWearableHoldingPattern::handleLateArrivals()
{
- // Only safe to run if we have previously finished the missing
- // wearables and other processing - otherwise we could be in some
- // intermediate state - but have not been superceded by a later
- // outfit change request.
- if (mLateArrivals.size() == 0)
- {
- // Nothing to process.
- return;
- }
- if (!isMostRecent())
- {
- LL_WARNS() << self_av_string() << "Late arrivals not handled - outfit change no longer valid" << LL_ENDL;
- }
- if (!mIsAllComplete)
- {
- LL_WARNS() << self_av_string() << "Late arrivals not handled - in middle of missing wearables processing" << LL_ENDL;
- }
-
- LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " need to handle " << mLateArrivals.size() << " late arriving wearables" << LL_ENDL;
-
- // Update mFoundList using late-arriving wearables.
- std::set<LLWearableType::EType> replaced_types;
- for (LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin();
- iter != getFoundList().end(); ++iter)
- {
- LLFoundData& data = *iter;
- for (std::set<LLViewerWearable*>::iterator wear_it = mLateArrivals.begin();
- wear_it != mLateArrivals.end();
- ++wear_it)
- {
- LLViewerWearable *wearable = *wear_it;
-
- if(wearable->getAssetID() == data.mAssetID)
- {
- data.mWearable = wearable;
-
- replaced_types.insert(data.mWearableType);
-
- // BAP - if we didn't call
- // clearCOFLinksForMissingWearables() earlier, we
- // don't need to restore the link here. Fixes
- // wearable ordering problems.
-
- // LLAppearanceMgr::instance().addCOFItemLink(data.mItemID,false);
-
- // BAP failing this means inventory or asset server
- // are corrupted in a way we don't handle.
- llassert((data.mWearableType < LLWearableType::WT_COUNT) && (wearable->getType() == data.mWearableType));
- break;
- }
- }
- }
-
- // Remove COF links for any default wearables previously used to replace the late arrivals.
- // All this pussyfooting around with a while loop and explicit
- // iterator incrementing is to allow removing items from the list
- // without clobbering the iterator we're using to navigate.
- LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin();
- while (iter != getFoundList().end())
- {
- LLFoundData& data = *iter;
-
- // If an item of this type has recently shown up, removed the corresponding replacement wearable from COF.
- if (data.mWearable && data.mIsReplacement &&
- replaced_types.find(data.mWearableType) != replaced_types.end())
- {
- LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID);
- std::list<LLFoundData>::iterator clobber_ator = iter;
- ++iter;
- getFoundList().erase(clobber_ator);
- }
- else
- {
- ++iter;
- }
- }
-
- // Clear contents of late arrivals.
- mLateArrivals.clear();
-
- // Update appearance based on mFoundList
- LLAppearanceMgr::instance().updateAgentWearables(this);
+ // Only safe to run if we have previously finished the missing
+ // wearables and other processing - otherwise we could be in some
+ // intermediate state - but have not been superceded by a later
+ // outfit change request.
+ if (mLateArrivals.size() == 0)
+ {
+ // Nothing to process.
+ return;
+ }
+ if (!isMostRecent())
+ {
+ LL_WARNS() << self_av_string() << "Late arrivals not handled - outfit change no longer valid" << LL_ENDL;
+ }
+ if (!mIsAllComplete)
+ {
+ LL_WARNS() << self_av_string() << "Late arrivals not handled - in middle of missing wearables processing" << LL_ENDL;
+ }
+
+ LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " need to handle " << mLateArrivals.size() << " late arriving wearables" << LL_ENDL;
+
+ // Update mFoundList using late-arriving wearables.
+ std::set<LLWearableType::EType> replaced_types;
+ for (LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin();
+ iter != getFoundList().end(); ++iter)
+ {
+ LLFoundData& data = *iter;
+ for (std::set<LLViewerWearable*>::iterator wear_it = mLateArrivals.begin();
+ wear_it != mLateArrivals.end();
+ ++wear_it)
+ {
+ LLViewerWearable *wearable = *wear_it;
+
+ if(wearable->getAssetID() == data.mAssetID)
+ {
+ data.mWearable = wearable;
+
+ replaced_types.insert(data.mWearableType);
+
+ // BAP - if we didn't call
+ // clearCOFLinksForMissingWearables() earlier, we
+ // don't need to restore the link here. Fixes
+ // wearable ordering problems.
+
+ // LLAppearanceMgr::instance().addCOFItemLink(data.mItemID,false);
+
+ // BAP failing this means inventory or asset server
+ // are corrupted in a way we don't handle.
+ llassert((data.mWearableType < LLWearableType::WT_COUNT) && (wearable->getType() == data.mWearableType));
+ break;
+ }
+ }
+ }
+
+ // Remove COF links for any default wearables previously used to replace the late arrivals.
+ // All this pussyfooting around with a while loop and explicit
+ // iterator incrementing is to allow removing items from the list
+ // without clobbering the iterator we're using to navigate.
+ LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin();
+ while (iter != getFoundList().end())
+ {
+ LLFoundData& data = *iter;
+
+ // If an item of this type has recently shown up, removed the corresponding replacement wearable from COF.
+ if (data.mWearable && data.mIsReplacement &&
+ replaced_types.find(data.mWearableType) != replaced_types.end())
+ {
+ LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID);
+ std::list<LLFoundData>::iterator clobber_ator = iter;
+ ++iter;
+ getFoundList().erase(clobber_ator);
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+
+ // Clear contents of late arrivals.
+ mLateArrivals.clear();
+
+ // Update appearance based on mFoundList
+ LLAppearanceMgr::instance().updateAgentWearables(this);
}
void LLWearableHoldingPattern::resetTime(F32 timeout)
{
- mWaitTime.reset();
- mWaitTime.setTimerExpirySec(timeout);
+ mWaitTime.reset();
+ mWaitTime.setTimerExpirySec(timeout);
}
void LLWearableHoldingPattern::onWearableAssetFetch(LLViewerWearable *wearable)
{
- if (!isMostRecent())
- {
- LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
- }
-
- mResolved += 1; // just counting callbacks, not successes.
- LL_DEBUGS("Avatar") << self_av_string() << "HP " << index() << " resolved " << mResolved << "/" << getFoundList().size() << LL_ENDL;
- if (!wearable)
- {
- LL_WARNS() << self_av_string() << "no wearable found" << LL_ENDL;
- }
-
- if (mFired)
- {
- LL_WARNS() << self_av_string() << "called after holder fired" << LL_ENDL;
- if (wearable)
- {
- mLateArrivals.insert(wearable);
- if (mIsAllComplete)
- {
- handleLateArrivals();
- }
- }
- return;
- }
-
- if (!wearable)
- {
- return;
- }
-
- U32 use_count = 0;
- for (LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin();
- iter != getFoundList().end(); ++iter)
- {
- LLFoundData& data = *iter;
- if (wearable->getAssetID() == data.mAssetID)
- {
- // Failing this means inventory or asset server are corrupted in a way we don't handle.
- if ((data.mWearableType >= LLWearableType::WT_COUNT) || (wearable->getType() != data.mWearableType))
- {
- LL_WARNS() << self_av_string() << "recovered wearable but type invalid. inventory wearable type: " << data.mWearableType << " asset wearable type: " << wearable->getType() << LL_ENDL;
- break;
- }
-
- if (use_count == 0)
- {
- data.mWearable = wearable;
- use_count++;
- }
- else
- {
- LLViewerInventoryItem* wearable_item = gInventory.getItem(data.mItemID);
- if (wearable_item && wearable_item->isFinished() && wearable_item->getPermissions().allowModifyBy(gAgentID))
- {
- // We can't edit and do some other interactions with same asset twice, copy it
- // Note: can't update incomplete items. Usually attached from previous viewer build, but
- // consider adding fetch and completion callback
- LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(wearable, wearable->getName());
- data.mWearable = new_wearable;
- data.mAssetID = new_wearable->getAssetID();
-
- // Update existing inventory item
- wearable_item->setAssetUUID(new_wearable->getAssetID());
- wearable_item->setTransactionID(new_wearable->getTransactionID());
- gInventory.updateItem(wearable_item, LLInventoryObserver::INTERNAL);
- wearable_item->updateServer(FALSE);
-
- use_count++;
- }
- else
- {
- // Note: technically a bug, LLViewerWearable can identify only one item id at a time,
- // yet we are tying it to multiple items here.
- // LLViewerWearable need to support more then one item.
- LL_WARNS() << "Same LLViewerWearable is used by multiple items! " << wearable->getAssetID() << LL_ENDL;
- data.mWearable = wearable;
- }
- }
- }
- }
-
- if (use_count > 1)
- {
- LL_WARNS() << "Copying wearable, multiple asset id uses! " << wearable->getAssetID() << LL_ENDL;
- gInventory.notifyObservers();
- }
+ if (!isMostRecent())
+ {
+ LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
+ }
+
+ mResolved += 1; // just counting callbacks, not successes.
+ LL_DEBUGS("Avatar") << self_av_string() << "HP " << index() << " resolved " << mResolved << "/" << getFoundList().size() << LL_ENDL;
+ if (!wearable)
+ {
+ LL_WARNS() << self_av_string() << "no wearable found" << LL_ENDL;
+ }
+
+ if (mFired)
+ {
+ LL_WARNS() << self_av_string() << "called after holder fired" << LL_ENDL;
+ if (wearable)
+ {
+ mLateArrivals.insert(wearable);
+ if (mIsAllComplete)
+ {
+ handleLateArrivals();
+ }
+ }
+ return;
+ }
+
+ if (!wearable)
+ {
+ return;
+ }
+
+ U32 use_count = 0;
+ for (LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin();
+ iter != getFoundList().end(); ++iter)
+ {
+ LLFoundData& data = *iter;
+ if (wearable->getAssetID() == data.mAssetID)
+ {
+ // Failing this means inventory or asset server are corrupted in a way we don't handle.
+ if ((data.mWearableType >= LLWearableType::WT_COUNT) || (wearable->getType() != data.mWearableType))
+ {
+ LL_WARNS() << self_av_string() << "recovered wearable but type invalid. inventory wearable type: " << data.mWearableType << " asset wearable type: " << wearable->getType() << LL_ENDL;
+ break;
+ }
+
+ if (use_count == 0)
+ {
+ data.mWearable = wearable;
+ use_count++;
+ }
+ else
+ {
+ LLViewerInventoryItem* wearable_item = gInventory.getItem(data.mItemID);
+ if (wearable_item && wearable_item->isFinished() && wearable_item->getPermissions().allowModifyBy(gAgentID))
+ {
+ // We can't edit and do some other interactions with same asset twice, copy it
+ // Note: can't update incomplete items. Usually attached from previous viewer build, but
+ // consider adding fetch and completion callback
+ LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(wearable, wearable->getName());
+ data.mWearable = new_wearable;
+ data.mAssetID = new_wearable->getAssetID();
+
+ // Update existing inventory item
+ wearable_item->setAssetUUID(new_wearable->getAssetID());
+ wearable_item->setTransactionID(new_wearable->getTransactionID());
+ gInventory.updateItem(wearable_item, LLInventoryObserver::INTERNAL);
+ wearable_item->updateServer(FALSE);
+
+ use_count++;
+ }
+ else
+ {
+ // Note: technically a bug, LLViewerWearable can identify only one item id at a time,
+ // yet we are tying it to multiple items here.
+ // LLViewerWearable need to support more then one item.
+ LL_WARNS() << "Same LLViewerWearable is used by multiple items! " << wearable->getAssetID() << LL_ENDL;
+ data.mWearable = wearable;
+ }
+ }
+ }
+ }
+
+ if (use_count > 1)
+ {
+ LL_WARNS() << "Copying wearable, multiple asset id uses! " << wearable->getAssetID() << LL_ENDL;
+ gInventory.notifyObservers();
+ }
}
static void onWearableAssetFetch(LLViewerWearable* wearable, void* data)
{
- LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data;
- holder->onWearableAssetFetch(wearable);
+ LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data;
+ holder->onWearableAssetFetch(wearable);
}
static void removeDuplicateItems(LLInventoryModel::item_array_t& items)
{
- LLInventoryModel::item_array_t new_items;
- std::set<LLUUID> items_seen;
- std::deque<LLViewerInventoryItem*> tmp_list;
- // Traverse from the front and keep the first of each item
- // encountered, so we actually keep the *last* of each duplicate
- // item. This is needed to give the right priority when adding
- // duplicate items to an existing outfit.
- for (S32 i=items.size()-1; i>=0; i--)
- {
- LLViewerInventoryItem *item = items.at(i);
- LLUUID item_id = item->getLinkedUUID();
- if (items_seen.find(item_id)!=items_seen.end())
- continue;
- items_seen.insert(item_id);
- tmp_list.push_front(item);
- }
- for (std::deque<LLViewerInventoryItem*>::iterator it = tmp_list.begin();
- it != tmp_list.end();
- ++it)
- {
- new_items.push_back(*it);
- }
- items = new_items;
+ LLInventoryModel::item_array_t new_items;
+ std::set<LLUUID> items_seen;
+ std::deque<LLViewerInventoryItem*> tmp_list;
+ // Traverse from the front and keep the first of each item
+ // encountered, so we actually keep the *last* of each duplicate
+ // item. This is needed to give the right priority when adding
+ // duplicate items to an existing outfit.
+ for (S32 i=items.size()-1; i>=0; i--)
+ {
+ LLViewerInventoryItem *item = items.at(i);
+ LLUUID item_id = item->getLinkedUUID();
+ if (items_seen.find(item_id)!=items_seen.end())
+ continue;
+ items_seen.insert(item_id);
+ tmp_list.push_front(item);
+ }
+ for (std::deque<LLViewerInventoryItem*>::iterator it = tmp_list.begin();
+ it != tmp_list.end();
+ ++it)
+ {
+ new_items.push_back(*it);
+ }
+ items = new_items;
}
//=========================================================================
@@ -1398,98 +1398,98 @@ const std::string LLAppearanceMgr::sExpectedTextureName = "OutfitPreview";
const LLUUID LLAppearanceMgr::getCOF() const
{
- return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
}
S32 LLAppearanceMgr::getCOFVersion() const
{
- LLViewerInventoryCategory *cof = gInventory.getCategory(getCOF());
- if (cof)
- {
- return cof->getVersion();
- }
- else
- {
- return LLViewerInventoryCategory::VERSION_UNKNOWN;
- }
+ LLViewerInventoryCategory *cof = gInventory.getCategory(getCOF());
+ if (cof)
+ {
+ return cof->getVersion();
+ }
+ else
+ {
+ return LLViewerInventoryCategory::VERSION_UNKNOWN;
+ }
}
const LLViewerInventoryItem* LLAppearanceMgr::getBaseOutfitLink()
{
- const LLUUID& current_outfit_cat = getCOF();
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- // Can't search on FT_OUTFIT since links to categories return FT_CATEGORY for type since they don't
- // return preferred type.
- LLIsType is_category( LLAssetType::AT_CATEGORY );
- gInventory.collectDescendentsIf(current_outfit_cat,
- cat_array,
- item_array,
- false,
- is_category);
- for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
- iter != item_array.end();
- iter++)
- {
- const LLViewerInventoryItem *item = (*iter);
- const LLViewerInventoryCategory *cat = item->getLinkedCategory();
- if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
- {
- const LLUUID parent_id = cat->getParentUUID();
- LLViewerInventoryCategory* parent_cat = gInventory.getCategory(parent_id);
- // if base outfit moved to trash it means that we don't have base outfit
- if (parent_cat != NULL && parent_cat->getPreferredType() == LLFolderType::FT_TRASH)
- {
- return NULL;
- }
- return item;
- }
- }
- return NULL;
+ const LLUUID& current_outfit_cat = getCOF();
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ // Can't search on FT_OUTFIT since links to categories return FT_CATEGORY for type since they don't
+ // return preferred type.
+ LLIsType is_category( LLAssetType::AT_CATEGORY );
+ gInventory.collectDescendentsIf(current_outfit_cat,
+ cat_array,
+ item_array,
+ false,
+ is_category);
+ for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
+ iter != item_array.end();
+ iter++)
+ {
+ const LLViewerInventoryItem *item = (*iter);
+ const LLViewerInventoryCategory *cat = item->getLinkedCategory();
+ if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
+ {
+ const LLUUID parent_id = cat->getParentUUID();
+ LLViewerInventoryCategory* parent_cat = gInventory.getCategory(parent_id);
+ // if base outfit moved to trash it means that we don't have base outfit
+ if (parent_cat != NULL && parent_cat->getPreferredType() == LLFolderType::FT_TRASH)
+ {
+ return NULL;
+ }
+ return item;
+ }
+ }
+ return NULL;
}
bool LLAppearanceMgr::getBaseOutfitName(std::string& name)
{
- const LLViewerInventoryItem* outfit_link = getBaseOutfitLink();
- if(outfit_link)
- {
- const LLViewerInventoryCategory *cat = outfit_link->getLinkedCategory();
- if (cat)
- {
- name = cat->getName();
- return true;
- }
- }
- return false;
+ const LLViewerInventoryItem* outfit_link = getBaseOutfitLink();
+ if(outfit_link)
+ {
+ const LLViewerInventoryCategory *cat = outfit_link->getLinkedCategory();
+ if (cat)
+ {
+ name = cat->getName();
+ return true;
+ }
+ }
+ return false;
}
const LLUUID LLAppearanceMgr::getBaseOutfitUUID()
{
- const LLViewerInventoryItem* outfit_link = getBaseOutfitLink();
- if (!outfit_link || !outfit_link->getIsLinkType()) return LLUUID::null;
+ const LLViewerInventoryItem* outfit_link = getBaseOutfitLink();
+ if (!outfit_link || !outfit_link->getIsLinkType()) return LLUUID::null;
- const LLViewerInventoryCategory* outfit_cat = outfit_link->getLinkedCategory();
- if (!outfit_cat) return LLUUID::null;
+ const LLViewerInventoryCategory* outfit_cat = outfit_link->getLinkedCategory();
+ if (!outfit_cat) return LLUUID::null;
- if (outfit_cat->getPreferredType() != LLFolderType::FT_OUTFIT)
- {
- LL_WARNS() << "Expected outfit type:" << LLFolderType::FT_OUTFIT << " but got type:" << outfit_cat->getType() << " for folder name:" << outfit_cat->getName() << LL_ENDL;
- return LLUUID::null;
- }
+ if (outfit_cat->getPreferredType() != LLFolderType::FT_OUTFIT)
+ {
+ LL_WARNS() << "Expected outfit type:" << LLFolderType::FT_OUTFIT << " but got type:" << outfit_cat->getType() << " for folder name:" << outfit_cat->getName() << LL_ENDL;
+ return LLUUID::null;
+ }
- return outfit_cat->getUUID();
+ return outfit_cat->getUUID();
}
void wear_on_avatar_cb(const LLUUID& inv_item, bool do_replace = false)
{
- if (inv_item.isNull())
- return;
-
- LLViewerInventoryItem *item = gInventory.getItem(inv_item);
- if (item)
- {
- LLAppearanceMgr::instance().wearItemOnAvatar(inv_item, true, do_replace);
- }
+ if (inv_item.isNull())
+ return;
+
+ LLViewerInventoryItem *item = gInventory.getItem(inv_item);
+ if (item)
+ {
+ LLAppearanceMgr::instance().wearItemOnAvatar(inv_item, true, do_replace);
+ }
}
void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
@@ -1497,8 +1497,8 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
bool replace,
LLPointer<LLInventoryCallback> cb)
{
- LL_DEBUGS("UIUsage") << "wearItemsOnAvatar" << LL_ENDL;
- LLUIUsage::instance().logCommand("Avatar.WearItem");
+ LL_DEBUGS("UIUsage") << "wearItemsOnAvatar" << LL_ENDL;
+ LLUIUsage::instance().logCommand("Avatar.WearItem");
bool first = true;
@@ -1534,13 +1534,13 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
copy_inventory_item(gAgent.getID(), item_to_wear->getPermissions().getOwner(),
item_to_wear->getUUID(), LLUUID::null, std::string(), cb);
continue;
- }
+ }
else if (!gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.getRootFolderID()))
{
- // not in library and not in agent's inventory
+ // not in library and not in agent's inventory
LL_DEBUGS("Avatar") << "inventory item not in user inventory or library, skipping "
<< item_to_wear->getName() << " id " << item_id_to_wear << LL_ENDL;
- continue;
+ continue;
}
else if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH)))
{
@@ -1574,16 +1574,16 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
wearable_count-1);
removeCOFItemLinks(item_id, cb);
}
-
+
items_to_link.push_back(item_to_wear);
- }
+ }
}
break;
case LLAssetType::AT_BODYPART:
{
// TODO: investigate wearables may not be loaded at this point EXT-8231
-
+
// Remove the existing wearables of the same type.
// Remove existing body parts anyway because we must not be able to wear e.g. two skins.
removeCOFLinksOfType(item_to_wear->getWearableType());
@@ -1594,7 +1594,7 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
items_to_link.push_back(item_to_wear);
}
break;
-
+
case LLAssetType::AT_OBJECT:
{
rez_attachment(item_to_wear, NULL, replace);
@@ -1608,14 +1608,14 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
// Batch up COF link creation - more efficient if using AIS.
if (items_to_link.size())
{
- link_inventory_array(getCOF(), items_to_link, cb);
+ link_inventory_array(getCOF(), items_to_link, cb);
}
}
void LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear,
- bool do_update,
- bool replace,
- LLPointer<LLInventoryCallback> cb)
+ bool do_update,
+ bool replace,
+ LLPointer<LLInventoryCallback> cb)
{
uuid_vec_t ids;
ids.push_back(item_id_to_wear);
@@ -1625,15 +1625,15 @@ void LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear,
// Update appearance from outfit folder.
void LLAppearanceMgr::changeOutfit(bool proceed, const LLUUID& category, bool append)
{
- if (!proceed)
- return;
- LLAppearanceMgr::instance().updateCOF(category,append);
+ if (!proceed)
+ return;
+ LLAppearanceMgr::instance().updateCOF(category,append);
}
void LLAppearanceMgr::replaceCurrentOutfit(const LLUUID& new_outfit)
{
- LLViewerInventoryCategory* cat = gInventory.getCategory(new_outfit);
- wearInventoryCategory(cat, false, false);
+ LLViewerInventoryCategory* cat = gInventory.getCategory(new_outfit);
+ wearInventoryCategory(cat, false, false);
}
// Remove existing photo link from outfit folder.
@@ -1666,112 +1666,112 @@ void LLAppearanceMgr::removeOutfitPhoto(const LLUUID& outfit_id)
// Open outfit renaming dialog.
void LLAppearanceMgr::renameOutfit(const LLUUID& outfit_id)
{
- LLViewerInventoryCategory* cat = gInventory.getCategory(outfit_id);
- if (!cat)
- {
- return;
- }
+ LLViewerInventoryCategory* cat = gInventory.getCategory(outfit_id);
+ if (!cat)
+ {
+ return;
+ }
- LLSD args;
- args["NAME"] = cat->getName();
+ LLSD args;
+ args["NAME"] = cat->getName();
- LLSD payload;
- payload["cat_id"] = outfit_id;
+ LLSD payload;
+ payload["cat_id"] = outfit_id;
- LLNotificationsUtil::add("RenameOutfit", args, payload, boost::bind(onOutfitRename, _1, _2));
+ LLNotificationsUtil::add("RenameOutfit", args, payload, boost::bind(onOutfitRename, _1, _2));
}
// User typed new outfit name.
// static
void LLAppearanceMgr::onOutfitRename(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return; // canceled
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return; // canceled
- std::string outfit_name = response["new_name"].asString();
- LLStringUtil::trim(outfit_name);
- if (!outfit_name.empty())
- {
- LLUUID cat_id = notification["payload"]["cat_id"].asUUID();
- rename_category(&gInventory, cat_id, outfit_name);
- }
+ std::string outfit_name = response["new_name"].asString();
+ LLStringUtil::trim(outfit_name);
+ if (!outfit_name.empty())
+ {
+ LLUUID cat_id = notification["payload"]["cat_id"].asUUID();
+ rename_category(&gInventory, cat_id, outfit_name);
+ }
}
void LLAppearanceMgr::setOutfitLocked(bool locked)
{
- if (mOutfitLocked == locked)
- {
- return;
- }
+ if (mOutfitLocked == locked)
+ {
+ return;
+ }
- mOutfitLocked = locked;
- if (locked)
- {
- mUnlockOutfitTimer->reset();
- mUnlockOutfitTimer->start();
- }
- else
- {
- mUnlockOutfitTimer->stop();
- }
+ mOutfitLocked = locked;
+ if (locked)
+ {
+ mUnlockOutfitTimer->reset();
+ mUnlockOutfitTimer->start();
+ }
+ else
+ {
+ mUnlockOutfitTimer->stop();
+ }
- LLOutfitObserver::instance().notifyOutfitLockChanged();
+ LLOutfitObserver::instance().notifyOutfitLockChanged();
}
void LLAppearanceMgr::addCategoryToCurrentOutfit(const LLUUID& cat_id)
{
- LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
- wearInventoryCategory(cat, false, true);
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ wearInventoryCategory(cat, false, true);
}
void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id)
{
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFindWearablesEx collector(/*is_worn=*/ true, /*include_body_parts=*/ false);
-
- gInventory.collectDescendentsIf(cat_id, cats, items, FALSE, collector);
-
- LLInventoryModel::item_array_t::const_iterator it = items.begin();
- const LLInventoryModel::item_array_t::const_iterator it_end = items.end();
- uuid_vec_t uuids_to_remove;
- for( ; it_end != it; ++it)
- {
- LLViewerInventoryItem* item = *it;
- uuids_to_remove.push_back(item->getUUID());
- }
- removeItemsFromAvatar(uuids_to_remove);
-
- // deactivate all gestures in the outfit folder
- LLInventoryModel::item_array_t gest_items;
- getDescendentsOfAssetType(cat_id, gest_items, LLAssetType::AT_GESTURE);
- for(S32 i = 0; i < gest_items.size(); ++i)
- {
- LLViewerInventoryItem *gest_item = gest_items[i];
- if ( LLGestureMgr::instance().isGestureActive( gest_item->getLinkedUUID()) )
- {
- LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
- }
- }
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearablesEx collector(/*is_worn=*/ true, /*include_body_parts=*/ false);
+
+ gInventory.collectDescendentsIf(cat_id, cats, items, FALSE, collector);
+
+ LLInventoryModel::item_array_t::const_iterator it = items.begin();
+ const LLInventoryModel::item_array_t::const_iterator it_end = items.end();
+ uuid_vec_t uuids_to_remove;
+ for( ; it_end != it; ++it)
+ {
+ LLViewerInventoryItem* item = *it;
+ uuids_to_remove.push_back(item->getUUID());
+ }
+ removeItemsFromAvatar(uuids_to_remove);
+
+ // deactivate all gestures in the outfit folder
+ LLInventoryModel::item_array_t gest_items;
+ getDescendentsOfAssetType(cat_id, gest_items, LLAssetType::AT_GESTURE);
+ for(S32 i = 0; i < gest_items.size(); ++i)
+ {
+ LLViewerInventoryItem *gest_item = gest_items[i];
+ if ( LLGestureMgr::instance().isGestureActive( gest_item->getLinkedUUID()) )
+ {
+ LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
+ }
+ }
}
// Create a copy of src_id + contents as a subfolder of dst_id.
void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
- LLPointer<LLInventoryCallback> cb)
-{
- LLInventoryCategory *src_cat = gInventory.getCategory(src_id);
- if (!src_cat)
- {
- LL_WARNS() << "folder not found for src " << src_id.asString() << LL_ENDL;
- return;
- }
- LL_INFOS() << "starting, src_id " << src_id << " name " << src_cat->getName() << " dst_id " << dst_id << LL_ENDL;
- LLUUID parent_id = dst_id;
- if(parent_id.isNull())
- {
- parent_id = gInventory.getRootFolderID();
- }
- gInventory.createNewCategory(
+ LLPointer<LLInventoryCallback> cb)
+{
+ LLInventoryCategory *src_cat = gInventory.getCategory(src_id);
+ if (!src_cat)
+ {
+ LL_WARNS() << "folder not found for src " << src_id.asString() << LL_ENDL;
+ return;
+ }
+ LL_INFOS() << "starting, src_id " << src_id << " name " << src_cat->getName() << " dst_id " << dst_id << LL_ENDL;
+ LLUUID parent_id = dst_id;
+ if(parent_id.isNull())
+ {
+ parent_id = gInventory.getRootFolderID();
+ }
+ gInventory.createNewCategory(
parent_id,
LLFolderType::FT_NONE,
src_cat->getName(),
@@ -1786,326 +1786,326 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds
}
void LLAppearanceMgr::slamCategoryLinks(const LLUUID& src_id, const LLUUID& dst_id,
- bool include_folder_links, LLPointer<LLInventoryCallback> cb)
-{
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- LLSD contents = LLSD::emptyArray();
- gInventory.getDirectDescendentsOf(src_id, cats, items);
- if (!cats || !items)
- {
- // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
- // that the cat just doesn't have any items or subfolders).
- LLViewerInventoryCategory* category = gInventory.getCategory(src_id);
- if (category)
- {
- LL_WARNS() << "Category '" << category->getName() << "' descendents corrupted, linking content failed." << LL_ENDL;
- }
- else
- {
- LL_WARNS() << "Category could not be retrieved, linking content failed." << LL_ENDL;
- }
- llassert(cats != NULL && items != NULL);
-
- return;
- }
-
- LL_INFOS() << "copying " << items->size() << " items" << LL_ENDL;
- for (LLInventoryModel::item_array_t::const_iterator iter = items->begin();
- iter != items->end();
- ++iter)
- {
- const LLViewerInventoryItem* item = (*iter);
- switch (item->getActualType())
- {
- case LLAssetType::AT_LINK:
- {
- LL_DEBUGS("Avatar") << "linking inventory item " << item->getName() << LL_ENDL;
- //getActualDescription() is used for a new description
- //to propagate ordering information saved in descriptions of links
- LLSD item_contents;
- item_contents["name"] = item->getName();
- item_contents["desc"] = item->getActualDescription();
- item_contents["linked_id"] = item->getLinkedUUID();
- item_contents["type"] = LLAssetType::AT_LINK;
- contents.append(item_contents);
- break;
- }
- case LLAssetType::AT_LINK_FOLDER:
- {
- LLViewerInventoryCategory *catp = item->getLinkedCategory();
- if (catp && include_folder_links)
- {
- LL_DEBUGS("Avatar") << "linking inventory folder " << item->getName() << LL_ENDL;
- LLSD base_contents;
- base_contents["name"] = catp->getName();
- base_contents["desc"] = ""; // categories don't have descriptions.
- base_contents["linked_id"] = catp->getLinkedUUID();
- base_contents["type"] = LLAssetType::AT_LINK_FOLDER;
- contents.append(base_contents);
- }
- break;
- }
- default:
- {
- // Linux refuses to compile unless all possible enums are handled. Really, Linux?
- break;
- }
- }
- }
- slam_inventory_folder(dst_id, contents, cb);
+ bool include_folder_links, LLPointer<LLInventoryCallback> cb)
+{
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ LLSD contents = LLSD::emptyArray();
+ gInventory.getDirectDescendentsOf(src_id, cats, items);
+ if (!cats || !items)
+ {
+ // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
+ // that the cat just doesn't have any items or subfolders).
+ LLViewerInventoryCategory* category = gInventory.getCategory(src_id);
+ if (category)
+ {
+ LL_WARNS() << "Category '" << category->getName() << "' descendents corrupted, linking content failed." << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "Category could not be retrieved, linking content failed." << LL_ENDL;
+ }
+ llassert(cats != NULL && items != NULL);
+
+ return;
+ }
+
+ LL_INFOS() << "copying " << items->size() << " items" << LL_ENDL;
+ for (LLInventoryModel::item_array_t::const_iterator iter = items->begin();
+ iter != items->end();
+ ++iter)
+ {
+ const LLViewerInventoryItem* item = (*iter);
+ switch (item->getActualType())
+ {
+ case LLAssetType::AT_LINK:
+ {
+ LL_DEBUGS("Avatar") << "linking inventory item " << item->getName() << LL_ENDL;
+ //getActualDescription() is used for a new description
+ //to propagate ordering information saved in descriptions of links
+ LLSD item_contents;
+ item_contents["name"] = item->getName();
+ item_contents["desc"] = item->getActualDescription();
+ item_contents["linked_id"] = item->getLinkedUUID();
+ item_contents["type"] = LLAssetType::AT_LINK;
+ contents.append(item_contents);
+ break;
+ }
+ case LLAssetType::AT_LINK_FOLDER:
+ {
+ LLViewerInventoryCategory *catp = item->getLinkedCategory();
+ if (catp && include_folder_links)
+ {
+ LL_DEBUGS("Avatar") << "linking inventory folder " << item->getName() << LL_ENDL;
+ LLSD base_contents;
+ base_contents["name"] = catp->getName();
+ base_contents["desc"] = ""; // categories don't have descriptions.
+ base_contents["linked_id"] = catp->getLinkedUUID();
+ base_contents["type"] = LLAssetType::AT_LINK_FOLDER;
+ contents.append(base_contents);
+ }
+ break;
+ }
+ default:
+ {
+ // Linux refuses to compile unless all possible enums are handled. Really, Linux?
+ break;
+ }
+ }
+ }
+ slam_inventory_folder(dst_id, contents, cb);
}
// Copy contents of src_id to dst_id.
void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id,
- LLPointer<LLInventoryCallback> cb)
-{
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(src_id, cats, items);
- LL_INFOS() << "copying " << items->size() << " items" << LL_ENDL;
- LLInventoryObject::const_object_list_t link_array;
- for (LLInventoryModel::item_array_t::const_iterator iter = items->begin();
- iter != items->end();
- ++iter)
- {
- const LLViewerInventoryItem* item = (*iter);
- switch (item->getActualType())
- {
- case LLAssetType::AT_LINK:
- {
- LL_DEBUGS("Avatar") << "linking inventory item " << item->getName() << LL_ENDL;
- link_array.push_back(LLConstPointer<LLInventoryObject>(item));
- break;
- }
- case LLAssetType::AT_LINK_FOLDER:
- {
- LLViewerInventoryCategory *catp = item->getLinkedCategory();
- // Skip copying outfit links.
- if (catp && catp->getPreferredType() != LLFolderType::FT_OUTFIT)
- {
- LL_DEBUGS("Avatar") << "linking inventory folder " << item->getName() << LL_ENDL;
- link_array.push_back(LLConstPointer<LLInventoryObject>(item));
- }
- break;
- }
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_OBJECT:
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_GESTURE:
- {
- LL_DEBUGS("Avatar") << "copying inventory item " << item->getName() << LL_ENDL;
- copy_inventory_item(gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- dst_id,
- item->getName(),
- cb);
- break;
- }
- default:
- // Ignore non-outfit asset types
- break;
- }
- }
- if (!link_array.empty())
- {
- link_inventory_array(dst_id, link_array, cb);
- }
+ LLPointer<LLInventoryCallback> cb)
+{
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ gInventory.getDirectDescendentsOf(src_id, cats, items);
+ LL_INFOS() << "copying " << items->size() << " items" << LL_ENDL;
+ LLInventoryObject::const_object_list_t link_array;
+ for (LLInventoryModel::item_array_t::const_iterator iter = items->begin();
+ iter != items->end();
+ ++iter)
+ {
+ const LLViewerInventoryItem* item = (*iter);
+ switch (item->getActualType())
+ {
+ case LLAssetType::AT_LINK:
+ {
+ LL_DEBUGS("Avatar") << "linking inventory item " << item->getName() << LL_ENDL;
+ link_array.push_back(LLConstPointer<LLInventoryObject>(item));
+ break;
+ }
+ case LLAssetType::AT_LINK_FOLDER:
+ {
+ LLViewerInventoryCategory *catp = item->getLinkedCategory();
+ // Skip copying outfit links.
+ if (catp && catp->getPreferredType() != LLFolderType::FT_OUTFIT)
+ {
+ LL_DEBUGS("Avatar") << "linking inventory folder " << item->getName() << LL_ENDL;
+ link_array.push_back(LLConstPointer<LLInventoryObject>(item));
+ }
+ break;
+ }
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_OBJECT:
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_GESTURE:
+ {
+ LL_DEBUGS("Avatar") << "copying inventory item " << item->getName() << LL_ENDL;
+ copy_inventory_item(gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ dst_id,
+ item->getName(),
+ cb);
+ break;
+ }
+ default:
+ // Ignore non-outfit asset types
+ break;
+ }
+ }
+ if (!link_array.empty())
+ {
+ link_inventory_array(dst_id, link_array, cb);
+ }
}
BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id)
{
- // These are the wearable items that are required for considering this
- // folder as containing a complete outfit.
- U32 required_wearables = 0;
- required_wearables |= 1LL << LLWearableType::WT_SHAPE;
- required_wearables |= 1LL << LLWearableType::WT_SKIN;
- required_wearables |= 1LL << LLWearableType::WT_HAIR;
- required_wearables |= 1LL << LLWearableType::WT_EYES;
-
- // These are the wearables that the folder actually contains.
- U32 folder_wearables = 0;
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(folder_id, cats, items);
- for (LLInventoryModel::item_array_t::const_iterator iter = items->begin();
- iter != items->end();
- ++iter)
- {
- const LLViewerInventoryItem* item = (*iter);
- if (item->isWearableType())
- {
- const LLWearableType::EType wearable_type = item->getWearableType();
- folder_wearables |= 1LL << wearable_type;
- }
- }
-
- // If the folder contains the required wearables, return TRUE.
- return ((required_wearables & folder_wearables) == required_wearables);
+ // These are the wearable items that are required for considering this
+ // folder as containing a complete outfit.
+ U32 required_wearables = 0;
+ required_wearables |= 1LL << LLWearableType::WT_SHAPE;
+ required_wearables |= 1LL << LLWearableType::WT_SKIN;
+ required_wearables |= 1LL << LLWearableType::WT_HAIR;
+ required_wearables |= 1LL << LLWearableType::WT_EYES;
+
+ // These are the wearables that the folder actually contains.
+ U32 folder_wearables = 0;
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ gInventory.getDirectDescendentsOf(folder_id, cats, items);
+ for (LLInventoryModel::item_array_t::const_iterator iter = items->begin();
+ iter != items->end();
+ ++iter)
+ {
+ const LLViewerInventoryItem* item = (*iter);
+ if (item->isWearableType())
+ {
+ const LLWearableType::EType wearable_type = item->getWearableType();
+ folder_wearables |= 1LL << wearable_type;
+ }
+ }
+
+ // If the folder contains the required wearables, return TRUE.
+ return ((required_wearables & folder_wearables) == required_wearables);
}
bool LLAppearanceMgr::getCanRemoveOutfit(const LLUUID& outfit_cat_id)
{
- // Disallow removing the base outfit.
- if (outfit_cat_id == getBaseOutfitUUID())
- {
- return false;
- }
+ // Disallow removing the base outfit.
+ if (outfit_cat_id == getBaseOutfitUUID())
+ {
+ return false;
+ }
- // Check if the outfit folder itself is removable.
- if (!get_is_category_removable(&gInventory, outfit_cat_id))
- {
- return false;
- }
+ // Check if the outfit folder itself is removable.
+ if (!get_is_category_removable(&gInventory, outfit_cat_id))
+ {
+ return false;
+ }
- // Check for the folder's non-removable descendants.
- LLFindNonRemovableObjects filter_non_removable;
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendentsIf(outfit_cat_id, cats, items, false, filter_non_removable);
- if (!cats.empty() || !items.empty())
- {
- return false;
- }
+ // Check for the folder's non-removable descendants.
+ LLFindNonRemovableObjects filter_non_removable;
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendentsIf(outfit_cat_id, cats, items, false, filter_non_removable);
+ if (!cats.empty() || !items.empty())
+ {
+ return false;
+ }
- return true;
+ return true;
}
// static
bool LLAppearanceMgr::getCanRemoveFromCOF(const LLUUID& outfit_cat_id)
{
- if (gAgentWearables.isCOFChangeInProgress())
- {
- return false;
- }
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
- gInventory.collectDescendentsIf(outfit_cat_id,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_worn);
- return items.size() > 0;
+ if (gAgentWearables.isCOFChangeInProgress())
+ {
+ return false;
+ }
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
+ gInventory.collectDescendentsIf(outfit_cat_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_worn);
+ return items.size() > 0;
}
// static
bool LLAppearanceMgr::getCanAddToCOF(const LLUUID& outfit_cat_id)
{
- if (gAgentWearables.isCOFChangeInProgress())
- {
- return false;
- }
+ if (gAgentWearables.isCOFChangeInProgress())
+ {
+ return false;
+ }
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
- gInventory.collectDescendentsIf(outfit_cat_id,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- not_worn);
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
+ gInventory.collectDescendentsIf(outfit_cat_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ not_worn);
- return items.size() > 0;
+ return items.size() > 0;
}
bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id)
{
- // Don't allow wearing anything while we're changing appearance.
- if (gAgentWearables.isCOFChangeInProgress())
- {
- return false;
- }
+ // Don't allow wearing anything while we're changing appearance.
+ if (gAgentWearables.isCOFChangeInProgress())
+ {
+ return false;
+ }
- // Check whether it's the base outfit.
- if (outfit_cat_id.isNull())
- {
- return false;
- }
+ // Check whether it's the base outfit.
+ if (outfit_cat_id.isNull())
+ {
+ return false;
+ }
- // Check whether the outfit contains any wearables
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFindWearables is_wearable;
- gInventory.collectDescendentsIf(outfit_cat_id,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_wearable);
+ // Check whether the outfit contains any wearables
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearables is_wearable;
+ gInventory.collectDescendentsIf(outfit_cat_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_wearable);
- return items.size() > 0;
+ return items.size() > 0;
}
// Moved from LLWearableList::ContextMenu for wider utility.
bool LLAppearanceMgr::canAddWearables(const uuid_vec_t& item_ids) const
{
- // TODO: investigate wearables may not be loaded at this point EXT-8231
-
- U32 n_objects = 0;
- U32 n_clothes = 0;
-
- // Count given clothes (by wearable type) and objects.
- for (uuid_vec_t::const_iterator it = item_ids.begin(); it != item_ids.end(); ++it)
- {
- const LLViewerInventoryItem* item = gInventory.getItem(*it);
- if (!item)
- {
- return false;
- }
-
- if (item->getType() == LLAssetType::AT_OBJECT)
- {
- ++n_objects;
- }
- else if (item->getType() == LLAssetType::AT_CLOTHING)
- {
- ++n_clothes;
- }
- else if (item->getType() == LLAssetType::AT_BODYPART || item->getType() == LLAssetType::AT_GESTURE)
- {
- return isAgentAvatarValid();
- }
- else
- {
- LL_WARNS() << "Unexpected wearable type" << LL_ENDL;
- return false;
- }
- }
-
- // Check whether we can add all the objects.
- if (!isAgentAvatarValid() || !gAgentAvatarp->canAttachMoreObjects(n_objects))
- {
- return false;
- }
-
- // Check whether we can add all the clothes.
+ // TODO: investigate wearables may not be loaded at this point EXT-8231
+
+ U32 n_objects = 0;
+ U32 n_clothes = 0;
+
+ // Count given clothes (by wearable type) and objects.
+ for (uuid_vec_t::const_iterator it = item_ids.begin(); it != item_ids.end(); ++it)
+ {
+ const LLViewerInventoryItem* item = gInventory.getItem(*it);
+ if (!item)
+ {
+ return false;
+ }
+
+ if (item->getType() == LLAssetType::AT_OBJECT)
+ {
+ ++n_objects;
+ }
+ else if (item->getType() == LLAssetType::AT_CLOTHING)
+ {
+ ++n_clothes;
+ }
+ else if (item->getType() == LLAssetType::AT_BODYPART || item->getType() == LLAssetType::AT_GESTURE)
+ {
+ return isAgentAvatarValid();
+ }
+ else
+ {
+ LL_WARNS() << "Unexpected wearable type" << LL_ENDL;
+ return false;
+ }
+ }
+
+ // Check whether we can add all the objects.
+ if (!isAgentAvatarValid() || !gAgentAvatarp->canAttachMoreObjects(n_objects))
+ {
+ return false;
+ }
+
+ // Check whether we can add all the clothes.
U32 sum_clothes = n_clothes + gAgentWearables.getClothingLayerCount();
return sum_clothes <= LLAgentWearables::MAX_CLOTHING_LAYERS;
}
void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> cb)
{
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(category, cats, items,
- LLInventoryModel::EXCLUDE_TRASH);
- for (S32 i = 0; i < items.size(); ++i)
- {
- LLViewerInventoryItem *item = items.at(i);
- if (item->getActualType() != LLAssetType::AT_LINK_FOLDER)
- continue;
- LLViewerInventoryCategory* catp = item->getLinkedCategory();
- if(catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
- {
- remove_inventory_item(item->getUUID(), cb);
- }
- }
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendents(category, cats, items,
+ LLInventoryModel::EXCLUDE_TRASH);
+ for (S32 i = 0; i < items.size(); ++i)
+ {
+ LLViewerInventoryItem *item = items.at(i);
+ if (item->getActualType() != LLAssetType::AT_LINK_FOLDER)
+ continue;
+ LLViewerInventoryCategory* catp = item->getLinkedCategory();
+ if(catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
+ {
+ remove_inventory_item(item->getUUID(), cb);
+ }
+ }
}
// Keep the last N wearables of each type. For viewer 2.0, N is 1 for
// both body parts and clothing items.
void LLAppearanceMgr::filterWearableItems(
- LLInventoryModel::item_array_t& items, S32 max_per_type, S32 max_total)
+ LLInventoryModel::item_array_t& items, S32 max_per_type, S32 max_total)
{
// Restrict by max total items first.
if ((max_total > 0) && (items.size() > max_total))
@@ -2142,348 +2142,348 @@ void LLAppearanceMgr::filterWearableItems(
void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
{
- LLViewerInventoryCategory *pcat = gInventory.getCategory(category);
- if (!pcat)
- {
- LL_WARNS() << "no category found for id " << category << LL_ENDL;
- return;
- }
- LL_INFOS("Avatar") << self_av_string() << "starting, cat '" << (pcat ? pcat->getName() : "[UNKNOWN]") << "'" << LL_ENDL;
-
- const LLUUID cof = getCOF();
-
- // Deactivate currently active gestures in the COF, if replacing outfit
- if (!append)
- {
- LLInventoryModel::item_array_t gest_items;
- getDescendentsOfAssetType(cof, gest_items, LLAssetType::AT_GESTURE);
- for(S32 i = 0; i < gest_items.size(); ++i)
- {
- LLViewerInventoryItem *gest_item = gest_items.at(i);
- if ( LLGestureMgr::instance().isGestureActive( gest_item->getLinkedUUID()) )
- {
- LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
- }
- }
- }
-
- // Collect and filter descendents to determine new COF contents.
-
- // - Body parts: always include COF contents as a fallback in case any
- // required parts are missing.
- // Preserve body parts from COF if appending.
- LLInventoryModel::item_array_t body_items;
- getDescendentsOfAssetType(cof, body_items, LLAssetType::AT_BODYPART);
- getDescendentsOfAssetType(category, body_items, LLAssetType::AT_BODYPART);
- if (append)
- reverse(body_items.begin(), body_items.end());
- // Reduce body items to max of one per type.
- removeDuplicateItems(body_items);
- filterWearableItems(body_items, 1, 0);
-
- // - Wearables: include COF contents only if appending.
- LLInventoryModel::item_array_t wear_items;
- if (append)
- getDescendentsOfAssetType(cof, wear_items, LLAssetType::AT_CLOTHING);
- getDescendentsOfAssetType(category, wear_items, LLAssetType::AT_CLOTHING);
- // Reduce wearables to max of one per type.
- removeDuplicateItems(wear_items);
- filterWearableItems(wear_items, 0, LLAgentWearables::MAX_CLOTHING_LAYERS);
-
- // - Attachments: include COF contents only if appending.
- LLInventoryModel::item_array_t obj_items;
- if (append)
- getDescendentsOfAssetType(cof, obj_items, LLAssetType::AT_OBJECT);
- getDescendentsOfAssetType(category, obj_items, LLAssetType::AT_OBJECT);
- removeDuplicateItems(obj_items);
-
- // - Gestures: include COF contents only if appending.
- LLInventoryModel::item_array_t gest_items;
- if (append)
- getDescendentsOfAssetType(cof, gest_items, LLAssetType::AT_GESTURE);
- getDescendentsOfAssetType(category, gest_items, LLAssetType::AT_GESTURE);
- removeDuplicateItems(gest_items);
-
- // Create links to new COF contents.
- LLInventoryModel::item_array_t all_items;
- std::copy(body_items.begin(), body_items.end(), std::back_inserter(all_items));
- std::copy(wear_items.begin(), wear_items.end(), std::back_inserter(all_items));
- std::copy(obj_items.begin(), obj_items.end(), std::back_inserter(all_items));
- std::copy(gest_items.begin(), gest_items.end(), std::back_inserter(all_items));
-
- // Find any wearables that need description set to enforce ordering.
- desc_map_t desc_map;
- getWearableOrderingDescUpdates(wear_items, desc_map);
-
- // Will link all the above items.
- // link_waiter enforce flags are false because we've already fixed everything up in updateCOF().
- LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy(false,false);
- LLSD contents = LLSD::emptyArray();
-
- for (LLInventoryModel::item_array_t::const_iterator it = all_items.begin();
- it != all_items.end(); ++it)
- {
- LLSD item_contents;
- LLInventoryItem *item = *it;
-
- std::string desc;
- desc_map_t::const_iterator desc_iter = desc_map.find(item->getUUID());
- if (desc_iter != desc_map.end())
- {
- desc = desc_iter->second;
- LL_DEBUGS("Avatar") << item->getName() << " overriding desc to: " << desc
- << " (was: " << item->getActualDescription() << ")" << LL_ENDL;
- }
- else
- {
- desc = item->getActualDescription();
- }
-
- item_contents["name"] = item->getName();
- item_contents["desc"] = desc;
- item_contents["linked_id"] = item->getLinkedUUID();
- item_contents["type"] = LLAssetType::AT_LINK;
- contents.append(item_contents);
- }
- const LLUUID& base_id = append ? getBaseOutfitUUID() : category;
- LLViewerInventoryCategory *base_cat = gInventory.getCategory(base_id);
- if (base_cat && (base_cat->getPreferredType() == LLFolderType::FT_OUTFIT))
- {
- LLSD base_contents;
- base_contents["name"] = base_cat->getName();
- base_contents["desc"] = "";
- base_contents["linked_id"] = base_cat->getLinkedUUID();
- base_contents["type"] = LLAssetType::AT_LINK_FOLDER;
- contents.append(base_contents);
- }
- if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
- {
- dump_sequential_xml(gAgentAvatarp->getFullname() + "_slam_request", contents);
- }
- slam_inventory_folder(getCOF(), contents, link_waiter);
-
- LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL;
+ LLViewerInventoryCategory *pcat = gInventory.getCategory(category);
+ if (!pcat)
+ {
+ LL_WARNS() << "no category found for id " << category << LL_ENDL;
+ return;
+ }
+ LL_INFOS("Avatar") << self_av_string() << "starting, cat '" << (pcat ? pcat->getName() : "[UNKNOWN]") << "'" << LL_ENDL;
+
+ const LLUUID cof = getCOF();
+
+ // Deactivate currently active gestures in the COF, if replacing outfit
+ if (!append)
+ {
+ LLInventoryModel::item_array_t gest_items;
+ getDescendentsOfAssetType(cof, gest_items, LLAssetType::AT_GESTURE);
+ for(S32 i = 0; i < gest_items.size(); ++i)
+ {
+ LLViewerInventoryItem *gest_item = gest_items.at(i);
+ if ( LLGestureMgr::instance().isGestureActive( gest_item->getLinkedUUID()) )
+ {
+ LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
+ }
+ }
+ }
+
+ // Collect and filter descendents to determine new COF contents.
+
+ // - Body parts: always include COF contents as a fallback in case any
+ // required parts are missing.
+ // Preserve body parts from COF if appending.
+ LLInventoryModel::item_array_t body_items;
+ getDescendentsOfAssetType(cof, body_items, LLAssetType::AT_BODYPART);
+ getDescendentsOfAssetType(category, body_items, LLAssetType::AT_BODYPART);
+ if (append)
+ reverse(body_items.begin(), body_items.end());
+ // Reduce body items to max of one per type.
+ removeDuplicateItems(body_items);
+ filterWearableItems(body_items, 1, 0);
+
+ // - Wearables: include COF contents only if appending.
+ LLInventoryModel::item_array_t wear_items;
+ if (append)
+ getDescendentsOfAssetType(cof, wear_items, LLAssetType::AT_CLOTHING);
+ getDescendentsOfAssetType(category, wear_items, LLAssetType::AT_CLOTHING);
+ // Reduce wearables to max of one per type.
+ removeDuplicateItems(wear_items);
+ filterWearableItems(wear_items, 0, LLAgentWearables::MAX_CLOTHING_LAYERS);
+
+ // - Attachments: include COF contents only if appending.
+ LLInventoryModel::item_array_t obj_items;
+ if (append)
+ getDescendentsOfAssetType(cof, obj_items, LLAssetType::AT_OBJECT);
+ getDescendentsOfAssetType(category, obj_items, LLAssetType::AT_OBJECT);
+ removeDuplicateItems(obj_items);
+
+ // - Gestures: include COF contents only if appending.
+ LLInventoryModel::item_array_t gest_items;
+ if (append)
+ getDescendentsOfAssetType(cof, gest_items, LLAssetType::AT_GESTURE);
+ getDescendentsOfAssetType(category, gest_items, LLAssetType::AT_GESTURE);
+ removeDuplicateItems(gest_items);
+
+ // Create links to new COF contents.
+ LLInventoryModel::item_array_t all_items;
+ std::copy(body_items.begin(), body_items.end(), std::back_inserter(all_items));
+ std::copy(wear_items.begin(), wear_items.end(), std::back_inserter(all_items));
+ std::copy(obj_items.begin(), obj_items.end(), std::back_inserter(all_items));
+ std::copy(gest_items.begin(), gest_items.end(), std::back_inserter(all_items));
+
+ // Find any wearables that need description set to enforce ordering.
+ desc_map_t desc_map;
+ getWearableOrderingDescUpdates(wear_items, desc_map);
+
+ // Will link all the above items.
+ // link_waiter enforce flags are false because we've already fixed everything up in updateCOF().
+ LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy(false,false);
+ LLSD contents = LLSD::emptyArray();
+
+ for (LLInventoryModel::item_array_t::const_iterator it = all_items.begin();
+ it != all_items.end(); ++it)
+ {
+ LLSD item_contents;
+ LLInventoryItem *item = *it;
+
+ std::string desc;
+ desc_map_t::const_iterator desc_iter = desc_map.find(item->getUUID());
+ if (desc_iter != desc_map.end())
+ {
+ desc = desc_iter->second;
+ LL_DEBUGS("Avatar") << item->getName() << " overriding desc to: " << desc
+ << " (was: " << item->getActualDescription() << ")" << LL_ENDL;
+ }
+ else
+ {
+ desc = item->getActualDescription();
+ }
+
+ item_contents["name"] = item->getName();
+ item_contents["desc"] = desc;
+ item_contents["linked_id"] = item->getLinkedUUID();
+ item_contents["type"] = LLAssetType::AT_LINK;
+ contents.append(item_contents);
+ }
+ const LLUUID& base_id = append ? getBaseOutfitUUID() : category;
+ LLViewerInventoryCategory *base_cat = gInventory.getCategory(base_id);
+ if (base_cat && (base_cat->getPreferredType() == LLFolderType::FT_OUTFIT))
+ {
+ LLSD base_contents;
+ base_contents["name"] = base_cat->getName();
+ base_contents["desc"] = "";
+ base_contents["linked_id"] = base_cat->getLinkedUUID();
+ base_contents["type"] = LLAssetType::AT_LINK_FOLDER;
+ contents.append(base_contents);
+ }
+ if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
+ {
+ dump_sequential_xml(gAgentAvatarp->getFullname() + "_slam_request", contents);
+ }
+ slam_inventory_folder(getCOF(), contents, link_waiter);
+
+ LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL;
}
void LLAppearanceMgr::updatePanelOutfitName(const std::string& name)
{
- LLSidepanelAppearance* panel_appearance =
- dynamic_cast<LLSidepanelAppearance *>(LLFloaterSidePanelContainer::getPanel("appearance"));
- if (panel_appearance)
- {
- panel_appearance->refreshCurrentOutfitName(name);
- }
+ LLSidepanelAppearance* panel_appearance =
+ dynamic_cast<LLSidepanelAppearance *>(LLFloaterSidePanelContainer::getPanel("appearance"));
+ if (panel_appearance)
+ {
+ panel_appearance->refreshCurrentOutfitName(name);
+ }
}
void LLAppearanceMgr::createBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> link_waiter)
{
- const LLUUID cof = getCOF();
- LLViewerInventoryCategory* catp = gInventory.getCategory(category);
- std::string new_outfit_name = "";
+ const LLUUID cof = getCOF();
+ LLViewerInventoryCategory* catp = gInventory.getCategory(category);
+ std::string new_outfit_name = "";
+
+ purgeBaseOutfitLink(cof, link_waiter);
- purgeBaseOutfitLink(cof, link_waiter);
+ if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
+ {
+ link_inventory_object(cof, catp, link_waiter);
+ new_outfit_name = catp->getName();
+ }
- if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
- {
- link_inventory_object(cof, catp, link_waiter);
- new_outfit_name = catp->getName();
- }
-
- updatePanelOutfitName(new_outfit_name);
+ updatePanelOutfitName(new_outfit_name);
}
void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder)
{
- LL_DEBUGS("Avatar") << "updateAgentWearables()" << LL_ENDL;
- LLInventoryItem::item_array_t items;
- std::vector< LLViewerWearable* > wearables;
- wearables.reserve(32);
-
- // For each wearable type, find the wearables of that type.
- for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
- {
- for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->getFoundList().begin();
- iter != holder->getFoundList().end(); ++iter)
- {
- LLFoundData& data = *iter;
- LLViewerWearable* wearable = data.mWearable;
- if( wearable && ((S32)wearable->getType() == i) )
- {
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
- if( item && (item->getAssetUUID() == wearable->getAssetID()) )
- {
- items.push_back(item);
- wearables.push_back(wearable);
- }
- }
- }
- }
-
- if(wearables.size() > 0)
- {
- gAgentWearables.setWearableOutfit(items, wearables);
- }
+ LL_DEBUGS("Avatar") << "updateAgentWearables()" << LL_ENDL;
+ LLInventoryItem::item_array_t items;
+ std::vector< LLViewerWearable* > wearables;
+ wearables.reserve(32);
+
+ // For each wearable type, find the wearables of that type.
+ for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
+ {
+ for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->getFoundList().begin();
+ iter != holder->getFoundList().end(); ++iter)
+ {
+ LLFoundData& data = *iter;
+ LLViewerWearable* wearable = data.mWearable;
+ if( wearable && ((S32)wearable->getType() == i) )
+ {
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
+ if( item && (item->getAssetUUID() == wearable->getAssetID()) )
+ {
+ items.push_back(item);
+ wearables.push_back(wearable);
+ }
+ }
+ }
+ }
+
+ if(wearables.size() > 0)
+ {
+ gAgentWearables.setWearableOutfit(items, wearables);
+ }
}
S32 LLAppearanceMgr::countActiveHoldingPatterns()
{
- return LLWearableHoldingPattern::countActive();
+ return LLWearableHoldingPattern::countActive();
}
static void remove_non_link_items(LLInventoryModel::item_array_t &items)
{
- LLInventoryModel::item_array_t pruned_items;
- for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
- iter != items.end();
- ++iter)
- {
- const LLViewerInventoryItem *item = (*iter);
- if (item && item->getIsLinkType())
- {
- pruned_items.push_back((*iter));
- }
- }
- items = pruned_items;
+ LLInventoryModel::item_array_t pruned_items;
+ for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
+ iter != items.end();
+ ++iter)
+ {
+ const LLViewerInventoryItem *item = (*iter);
+ if (item && item->getIsLinkType())
+ {
+ pruned_items.push_back((*iter));
+ }
+ }
+ items = pruned_items;
}
//a predicate for sorting inventory items by actual descriptions
bool sort_by_actual_description(const LLInventoryItem* item1, const LLInventoryItem* item2)
{
- if (!item1 || !item2)
- {
- LL_WARNS() << "either item1 or item2 is NULL" << LL_ENDL;
- return true;
- }
+ if (!item1 || !item2)
+ {
+ LL_WARNS() << "either item1 or item2 is NULL" << LL_ENDL;
+ return true;
+ }
- return item1->getActualDescription() < item2->getActualDescription();
+ return item1->getActualDescription() < item2->getActualDescription();
}
void item_array_diff(LLInventoryModel::item_array_t& full_list,
- LLInventoryModel::item_array_t& keep_list,
- LLInventoryModel::item_array_t& kill_list)
-
-{
- for (LLInventoryModel::item_array_t::iterator it = full_list.begin();
- it != full_list.end();
- ++it)
- {
- LLViewerInventoryItem *item = *it;
- if (std::find(keep_list.begin(), keep_list.end(), item) == keep_list.end())
- {
- kill_list.push_back(item);
- }
- }
+ LLInventoryModel::item_array_t& keep_list,
+ LLInventoryModel::item_array_t& kill_list)
+
+{
+ for (LLInventoryModel::item_array_t::iterator it = full_list.begin();
+ it != full_list.end();
+ ++it)
+ {
+ LLViewerInventoryItem *item = *it;
+ if (std::find(keep_list.begin(), keep_list.end(), item) == keep_list.end())
+ {
+ kill_list.push_back(item);
+ }
+ }
}
S32 LLAppearanceMgr::findExcessOrDuplicateItems(const LLUUID& cat_id,
- LLAssetType::EType type,
- S32 max_items_per_type,
- S32 max_items_total,
- LLInventoryObject::object_list_t& items_to_kill)
-{
- S32 to_kill_count = 0;
-
- LLInventoryModel::item_array_t items;
- getDescendentsOfAssetType(cat_id, items, type);
- LLInventoryModel::item_array_t curr_items = items;
- removeDuplicateItems(items);
- if (max_items_per_type > 0 || max_items_total > 0)
- {
- filterWearableItems(items, max_items_per_type, max_items_total);
- }
- LLInventoryModel::item_array_t kill_items;
- item_array_diff(curr_items,items,kill_items);
- for (LLInventoryModel::item_array_t::iterator it = kill_items.begin();
- it != kill_items.end();
- ++it)
- {
- items_to_kill.push_back(LLPointer<LLInventoryObject>(*it));
- to_kill_count++;
- }
- return to_kill_count;
-}
-
+ LLAssetType::EType type,
+ S32 max_items_per_type,
+ S32 max_items_total,
+ LLInventoryObject::object_list_t& items_to_kill)
+{
+ S32 to_kill_count = 0;
+
+ LLInventoryModel::item_array_t items;
+ getDescendentsOfAssetType(cat_id, items, type);
+ LLInventoryModel::item_array_t curr_items = items;
+ removeDuplicateItems(items);
+ if (max_items_per_type > 0 || max_items_total > 0)
+ {
+ filterWearableItems(items, max_items_per_type, max_items_total);
+ }
+ LLInventoryModel::item_array_t kill_items;
+ item_array_diff(curr_items,items,kill_items);
+ for (LLInventoryModel::item_array_t::iterator it = kill_items.begin();
+ it != kill_items.end();
+ ++it)
+ {
+ items_to_kill.push_back(LLPointer<LLInventoryObject>(*it));
+ to_kill_count++;
+ }
+ return to_kill_count;
+}
+
void LLAppearanceMgr::findAllExcessOrDuplicateItems(const LLUUID& cat_id,
- LLInventoryObject::object_list_t& items_to_kill)
+ LLInventoryObject::object_list_t& items_to_kill)
{
- findExcessOrDuplicateItems(cat_id,LLAssetType::AT_BODYPART,
- 1, 0, items_to_kill);
- findExcessOrDuplicateItems(cat_id,LLAssetType::AT_CLOTHING,
- 0, LLAgentWearables::MAX_CLOTHING_LAYERS, items_to_kill);
- findExcessOrDuplicateItems(cat_id,LLAssetType::AT_OBJECT,
- 0, 0, items_to_kill);
+ findExcessOrDuplicateItems(cat_id,LLAssetType::AT_BODYPART,
+ 1, 0, items_to_kill);
+ findExcessOrDuplicateItems(cat_id,LLAssetType::AT_CLOTHING,
+ 0, LLAgentWearables::MAX_CLOTHING_LAYERS, items_to_kill);
+ findExcessOrDuplicateItems(cat_id,LLAssetType::AT_OBJECT,
+ 0, 0, items_to_kill);
}
void LLAppearanceMgr::enforceCOFItemRestrictions(LLPointer<LLInventoryCallback> cb)
{
- LLInventoryObject::object_list_t items_to_kill;
- findAllExcessOrDuplicateItems(getCOF(), items_to_kill);
- if (items_to_kill.size()>0)
- {
- // Remove duplicate or excess wearables. Should normally be enforced at the UI level, but
- // this should catch anything that gets through.
- remove_inventory_items(items_to_kill, cb);
- }
+ LLInventoryObject::object_list_t items_to_kill;
+ findAllExcessOrDuplicateItems(getCOF(), items_to_kill);
+ if (items_to_kill.size()>0)
+ {
+ // Remove duplicate or excess wearables. Should normally be enforced at the UI level, but
+ // this should catch anything that gets through.
+ remove_inventory_items(items_to_kill, cb);
+ }
}
bool sort_by_linked_uuid(const LLViewerInventoryItem* item1, const LLViewerInventoryItem* item2)
{
- if (!item1 || !item2)
- {
- LL_WARNS() << "item1, item2 cannot be null, something is very wrong" << LL_ENDL;
- return true;
- }
+ if (!item1 || !item2)
+ {
+ LL_WARNS() << "item1, item2 cannot be null, something is very wrong" << LL_ENDL;
+ return true;
+ }
- return item1->getLinkedUUID() < item2->getLinkedUUID();
+ return item1->getLinkedUUID() < item2->getLinkedUUID();
}
void get_sorted_base_and_cof_items(LLInventoryModel::item_array_t& cof_item_array, LLInventoryModel::item_array_t& outfit_item_array)
{
- LLUUID base_outfit_id = LLAppearanceMgr::instance().getBaseOutfitUUID();
+ LLUUID base_outfit_id = LLAppearanceMgr::instance().getBaseOutfitUUID();
- if (base_outfit_id.notNull())
- {
- LLIsValidItemLink collector;
- LLInventoryModel::cat_array_t sub_cat_array;
+ if (base_outfit_id.notNull())
+ {
+ LLIsValidItemLink collector;
+ LLInventoryModel::cat_array_t sub_cat_array;
- gInventory.collectDescendents(base_outfit_id,
- sub_cat_array,
- outfit_item_array,
- LLInventoryModel::EXCLUDE_TRASH);
+ gInventory.collectDescendents(base_outfit_id,
+ sub_cat_array,
+ outfit_item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
- LLInventoryModel::cat_array_t cof_cats;
+ LLInventoryModel::cat_array_t cof_cats;
- gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), cof_cats, cof_item_array,
- LLInventoryModel::EXCLUDE_TRASH, collector);
+ gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), cof_cats, cof_item_array,
+ LLInventoryModel::EXCLUDE_TRASH, collector);
- for (U32 i = 0; i < outfit_item_array.size(); ++i)
- {
- LLViewerInventoryItem* linked_item = outfit_item_array.at(i)->getLinkedItem();
- if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
- {
- outfit_item_array.erase(outfit_item_array.begin() + i);
- break;
- }
- }
+ for (U32 i = 0; i < outfit_item_array.size(); ++i)
+ {
+ LLViewerInventoryItem* linked_item = outfit_item_array.at(i)->getLinkedItem();
+ if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
+ {
+ outfit_item_array.erase(outfit_item_array.begin() + i);
+ break;
+ }
+ }
- std::sort(cof_item_array.begin(), cof_item_array.end(), sort_by_linked_uuid);
- std::sort(outfit_item_array.begin(), outfit_item_array.end(), sort_by_linked_uuid);
- }
+ std::sort(cof_item_array.begin(), cof_item_array.end(), sort_by_linked_uuid);
+ std::sort(outfit_item_array.begin(), outfit_item_array.end(), sort_by_linked_uuid);
+ }
}
void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
- bool enforce_ordering,
- nullary_func_t post_update_func)
+ bool enforce_ordering,
+ nullary_func_t post_update_func)
{
- if (mIsInUpdateAppearanceFromCOF)
- {
- LL_WARNS() << "Called updateAppearanceFromCOF inside updateAppearanceFromCOF, skipping" << LL_ENDL;
- return;
- }
+ if (mIsInUpdateAppearanceFromCOF)
+ {
+ LL_WARNS() << "Called updateAppearanceFromCOF inside updateAppearanceFromCOF, skipping" << LL_ENDL;
+ return;
+ }
- LL_DEBUGS("Avatar") << self_av_string() << "starting" << LL_ENDL;
+ LL_DEBUGS("Avatar") << self_av_string() << "starting" << LL_ENDL;
if (gInventory.hasPosiblyBrockenLinks())
{
@@ -2518,263 +2518,263 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
}
}
- if (enforce_item_restrictions)
- {
- // The point here is just to call
- // updateAppearanceFromCOF() again after excess items
- // have been removed. That time we will set
- // enforce_item_restrictions to false so we don't get
- // caught in a perpetual loop.
- LLPointer<LLInventoryCallback> cb(
- new LLUpdateAppearanceOnDestroy(false, enforce_ordering, post_update_func));
- enforceCOFItemRestrictions(cb);
- return;
- }
-
- if (enforce_ordering)
- {
- //checking integrity of the COF in terms of ordering of wearables,
- //checking and updating links' descriptions of wearables in the COF (before analyzed for "dirty" state)
-
- // As with enforce_item_restrictions handling above, we want
- // to wait for the update callbacks, then (finally!) call
- // updateAppearanceFromCOF() with no additional COF munging needed.
- LLPointer<LLInventoryCallback> cb(
- new LLUpdateAppearanceOnDestroy(false, false, post_update_func));
- updateClothingOrderingInfo(LLUUID::null, cb);
- return;
- }
-
- if (!validateClothingOrderingInfo())
- {
-
- LLInventoryModel::item_array_t outfit_item_array;
- LLInventoryModel::item_array_t cof_item_array;
- get_sorted_base_and_cof_items(cof_item_array, outfit_item_array);
-
- if (outfit_item_array.size() == cof_item_array.size())
- {
- for (U32 i = 0; i < cof_item_array.size(); ++i)
- {
- LLViewerInventoryItem *cof_it = cof_item_array.at(i);
- LLViewerInventoryItem *base_it = outfit_item_array.at(i);
-
- if (cof_it->getActualDescription() != base_it->getActualDescription())
- {
- if (cof_it->getLinkedUUID() == base_it->getLinkedUUID())
- {
- cof_it->setDescription(base_it->getActualDescription());
- gInventory.updateItem(cof_it);
- }
- }
- }
- LLAppearanceMgr::getInstance()->updateIsDirty();
- }
-
- }
-
- BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF);
- selfStartPhase("update_appearance_from_cof");
-
- // update dirty flag to see if the state of the COF matches
- // the saved outfit stored as a folder link
- updateIsDirty();
-
- // Send server request for appearance update
- if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion())
- {
- requestServerAppearanceUpdate();
- }
-
- LLUUID current_outfit_id = getCOF();
-
- // Find all the wearables that are in the COF's subtree.
- LL_DEBUGS() << "LLAppearanceMgr::updateFromCOF()" << LL_ENDL;
- LLInventoryModel::item_array_t wear_items;
- LLInventoryModel::item_array_t obj_items;
- LLInventoryModel::item_array_t gest_items;
- getUserDescendents(current_outfit_id, wear_items, obj_items, gest_items);
- // Get rid of non-links in case somehow the COF was corrupted.
- remove_non_link_items(wear_items);
- remove_non_link_items(obj_items);
- remove_non_link_items(gest_items);
-
- dumpItemArray(wear_items,"asset_dump: wear_item");
- dumpItemArray(obj_items,"asset_dump: obj_item");
-
- LLViewerInventoryCategory *cof = gInventory.getCategory(current_outfit_id);
- if (!gInventory.isCategoryComplete(current_outfit_id))
- {
- LL_WARNS() << "COF info is not complete. Version " << cof->getVersion()
- << " descendent_count " << cof->getDescendentCount()
- << " viewer desc count " << cof->getViewerDescendentCount() << LL_ENDL;
- }
- if(!wear_items.size())
- {
- LLNotificationsUtil::add("CouldNotPutOnOutfit");
- return;
- }
-
- //preparing the list of wearables in the correct order for LLAgentWearables
- sortItemsByActualDescription(wear_items);
-
-
- LL_DEBUGS("Avatar") << "HP block starts" << LL_ENDL;
- LLTimer hp_block_timer;
- LLWearableHoldingPattern* holder = new LLWearableHoldingPattern;
-
- holder->setObjItems(obj_items);
- holder->setGestItems(gest_items);
-
- // Note: can't do normal iteration, because if all the
- // wearables can be resolved immediately, then the
- // callback will be called (and this object deleted)
- // before the final getNextData().
-
- for(S32 i = 0; i < wear_items.size(); ++i)
- {
- LLViewerInventoryItem *item = wear_items.at(i);
- LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
-
- // Fault injection: use debug setting to test asset
- // fetch failures (should be replaced by new defaults in
- // lost&found).
- U32 skip_type = gSavedSettings.getU32("ForceAssetFail");
-
- if (item && item->getIsLinkType() && linked_item)
- {
- LLFoundData found(linked_item->getUUID(),
- linked_item->getAssetUUID(),
- linked_item->getName(),
- linked_item->getType(),
- linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID
- );
-
- if (skip_type != LLWearableType::WT_INVALID && skip_type == found.mWearableType)
- {
- found.mAssetID.generate(); // Replace with new UUID, guaranteed not to exist in DB
- }
- //pushing back, not front, to preserve order of wearables for LLAgentWearables
- holder->getFoundList().push_back(found);
- }
- else
- {
- if (!item)
- {
- LL_WARNS() << "Attempt to wear a null item " << LL_ENDL;
- }
- else if (!linked_item)
- {
- LL_WARNS() << "Attempt to wear a broken link [ name:" << item->getName() << " ] " << LL_ENDL;
- }
- }
- }
-
- selfStartPhase("get_wearables_2");
-
- for (LLWearableHoldingPattern::found_list_t::iterator it = holder->getFoundList().begin();
- it != holder->getFoundList().end(); ++it)
- {
- LLFoundData& found = *it;
-
- LL_DEBUGS() << self_av_string() << "waiting for onWearableAssetFetch callback, asset " << found.mAssetID.asString() << LL_ENDL;
-
- // Fetch the wearables about to be worn.
- LLWearableList::instance().getAsset(found.mAssetID,
- found.mName,
- gAgentAvatarp,
- found.mAssetType,
- onWearableAssetFetch,
- (void*)holder);
-
- }
-
- holder->resetTime(gSavedSettings.getF32("MaxWearableWaitTime"));
- if (!holder->pollFetchCompletion())
- {
- doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollFetchCompletion,holder));
- }
- post_update_func();
-
- LL_DEBUGS("Avatar") << "HP block ends, elapsed " << hp_block_timer.getElapsedTimeF32() << LL_ENDL;
+ if (enforce_item_restrictions)
+ {
+ // The point here is just to call
+ // updateAppearanceFromCOF() again after excess items
+ // have been removed. That time we will set
+ // enforce_item_restrictions to false so we don't get
+ // caught in a perpetual loop.
+ LLPointer<LLInventoryCallback> cb(
+ new LLUpdateAppearanceOnDestroy(false, enforce_ordering, post_update_func));
+ enforceCOFItemRestrictions(cb);
+ return;
+ }
+
+ if (enforce_ordering)
+ {
+ //checking integrity of the COF in terms of ordering of wearables,
+ //checking and updating links' descriptions of wearables in the COF (before analyzed for "dirty" state)
+
+ // As with enforce_item_restrictions handling above, we want
+ // to wait for the update callbacks, then (finally!) call
+ // updateAppearanceFromCOF() with no additional COF munging needed.
+ LLPointer<LLInventoryCallback> cb(
+ new LLUpdateAppearanceOnDestroy(false, false, post_update_func));
+ updateClothingOrderingInfo(LLUUID::null, cb);
+ return;
+ }
+
+ if (!validateClothingOrderingInfo())
+ {
+
+ LLInventoryModel::item_array_t outfit_item_array;
+ LLInventoryModel::item_array_t cof_item_array;
+ get_sorted_base_and_cof_items(cof_item_array, outfit_item_array);
+
+ if (outfit_item_array.size() == cof_item_array.size())
+ {
+ for (U32 i = 0; i < cof_item_array.size(); ++i)
+ {
+ LLViewerInventoryItem *cof_it = cof_item_array.at(i);
+ LLViewerInventoryItem *base_it = outfit_item_array.at(i);
+
+ if (cof_it->getActualDescription() != base_it->getActualDescription())
+ {
+ if (cof_it->getLinkedUUID() == base_it->getLinkedUUID())
+ {
+ cof_it->setDescription(base_it->getActualDescription());
+ gInventory.updateItem(cof_it);
+ }
+ }
+ }
+ LLAppearanceMgr::getInstance()->updateIsDirty();
+ }
+
+ }
+
+ BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF);
+ selfStartPhase("update_appearance_from_cof");
+
+ // update dirty flag to see if the state of the COF matches
+ // the saved outfit stored as a folder link
+ updateIsDirty();
+
+ // Send server request for appearance update
+ if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion())
+ {
+ requestServerAppearanceUpdate();
+ }
+
+ LLUUID current_outfit_id = getCOF();
+
+ // Find all the wearables that are in the COF's subtree.
+ LL_DEBUGS() << "LLAppearanceMgr::updateFromCOF()" << LL_ENDL;
+ LLInventoryModel::item_array_t wear_items;
+ LLInventoryModel::item_array_t obj_items;
+ LLInventoryModel::item_array_t gest_items;
+ getUserDescendents(current_outfit_id, wear_items, obj_items, gest_items);
+ // Get rid of non-links in case somehow the COF was corrupted.
+ remove_non_link_items(wear_items);
+ remove_non_link_items(obj_items);
+ remove_non_link_items(gest_items);
+
+ dumpItemArray(wear_items,"asset_dump: wear_item");
+ dumpItemArray(obj_items,"asset_dump: obj_item");
+
+ LLViewerInventoryCategory *cof = gInventory.getCategory(current_outfit_id);
+ if (!gInventory.isCategoryComplete(current_outfit_id))
+ {
+ LL_WARNS() << "COF info is not complete. Version " << cof->getVersion()
+ << " descendent_count " << cof->getDescendentCount()
+ << " viewer desc count " << cof->getViewerDescendentCount() << LL_ENDL;
+ }
+ if(!wear_items.size())
+ {
+ LLNotificationsUtil::add("CouldNotPutOnOutfit");
+ return;
+ }
+
+ //preparing the list of wearables in the correct order for LLAgentWearables
+ sortItemsByActualDescription(wear_items);
+
+
+ LL_DEBUGS("Avatar") << "HP block starts" << LL_ENDL;
+ LLTimer hp_block_timer;
+ LLWearableHoldingPattern* holder = new LLWearableHoldingPattern;
+
+ holder->setObjItems(obj_items);
+ holder->setGestItems(gest_items);
+
+ // Note: can't do normal iteration, because if all the
+ // wearables can be resolved immediately, then the
+ // callback will be called (and this object deleted)
+ // before the final getNextData().
+
+ for(S32 i = 0; i < wear_items.size(); ++i)
+ {
+ LLViewerInventoryItem *item = wear_items.at(i);
+ LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
+
+ // Fault injection: use debug setting to test asset
+ // fetch failures (should be replaced by new defaults in
+ // lost&found).
+ U32 skip_type = gSavedSettings.getU32("ForceAssetFail");
+
+ if (item && item->getIsLinkType() && linked_item)
+ {
+ LLFoundData found(linked_item->getUUID(),
+ linked_item->getAssetUUID(),
+ linked_item->getName(),
+ linked_item->getType(),
+ linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID
+ );
+
+ if (skip_type != LLWearableType::WT_INVALID && skip_type == found.mWearableType)
+ {
+ found.mAssetID.generate(); // Replace with new UUID, guaranteed not to exist in DB
+ }
+ //pushing back, not front, to preserve order of wearables for LLAgentWearables
+ holder->getFoundList().push_back(found);
+ }
+ else
+ {
+ if (!item)
+ {
+ LL_WARNS() << "Attempt to wear a null item " << LL_ENDL;
+ }
+ else if (!linked_item)
+ {
+ LL_WARNS() << "Attempt to wear a broken link [ name:" << item->getName() << " ] " << LL_ENDL;
+ }
+ }
+ }
+
+ selfStartPhase("get_wearables_2");
+
+ for (LLWearableHoldingPattern::found_list_t::iterator it = holder->getFoundList().begin();
+ it != holder->getFoundList().end(); ++it)
+ {
+ LLFoundData& found = *it;
+
+ LL_DEBUGS() << self_av_string() << "waiting for onWearableAssetFetch callback, asset " << found.mAssetID.asString() << LL_ENDL;
+
+ // Fetch the wearables about to be worn.
+ LLWearableList::instance().getAsset(found.mAssetID,
+ found.mName,
+ gAgentAvatarp,
+ found.mAssetType,
+ onWearableAssetFetch,
+ (void*)holder);
+
+ }
+
+ holder->resetTime(gSavedSettings.getF32("MaxWearableWaitTime"));
+ if (!holder->pollFetchCompletion())
+ {
+ doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollFetchCompletion,holder));
+ }
+ post_update_func();
+
+ LL_DEBUGS("Avatar") << "HP block ends, elapsed " << hp_block_timer.getElapsedTimeF32() << LL_ENDL;
}
void LLAppearanceMgr::getDescendentsOfAssetType(const LLUUID& category,
- LLInventoryModel::item_array_t& items,
- LLAssetType::EType type)
-{
- LLInventoryModel::cat_array_t cats;
- LLIsType is_of_type(type);
- gInventory.collectDescendentsIf(category,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_of_type);
-}
-
-void LLAppearanceMgr::getUserDescendents(const LLUUID& category,
- LLInventoryModel::item_array_t& wear_items,
- LLInventoryModel::item_array_t& obj_items,
- LLInventoryModel::item_array_t& gest_items)
-{
- LLInventoryModel::cat_array_t wear_cats;
- LLFindWearables is_wearable;
- gInventory.collectDescendentsIf(category,
- wear_cats,
- wear_items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_wearable);
-
- LLInventoryModel::cat_array_t obj_cats;
- LLIsType is_object( LLAssetType::AT_OBJECT );
- gInventory.collectDescendentsIf(category,
- obj_cats,
- obj_items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_object);
-
- // Find all gestures in this folder
- LLInventoryModel::cat_array_t gest_cats;
- LLIsType is_gesture( LLAssetType::AT_GESTURE );
- gInventory.collectDescendentsIf(category,
- gest_cats,
- gest_items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_gesture);
+ LLInventoryModel::item_array_t& items,
+ LLAssetType::EType type)
+{
+ LLInventoryModel::cat_array_t cats;
+ LLIsType is_of_type(type);
+ gInventory.collectDescendentsIf(category,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_of_type);
+}
+
+void LLAppearanceMgr::getUserDescendents(const LLUUID& category,
+ LLInventoryModel::item_array_t& wear_items,
+ LLInventoryModel::item_array_t& obj_items,
+ LLInventoryModel::item_array_t& gest_items)
+{
+ LLInventoryModel::cat_array_t wear_cats;
+ LLFindWearables is_wearable;
+ gInventory.collectDescendentsIf(category,
+ wear_cats,
+ wear_items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_wearable);
+
+ LLInventoryModel::cat_array_t obj_cats;
+ LLIsType is_object( LLAssetType::AT_OBJECT );
+ gInventory.collectDescendentsIf(category,
+ obj_cats,
+ obj_items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_object);
+
+ // Find all gestures in this folder
+ LLInventoryModel::cat_array_t gest_cats;
+ LLIsType is_gesture( LLAssetType::AT_GESTURE );
+ gInventory.collectDescendentsIf(category,
+ gest_cats,
+ gest_items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_gesture);
}
void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append)
{
- if(!category) return;
+ if(!category) return;
- selfClearPhases();
- selfStartPhase("wear_inventory_category");
+ selfClearPhases();
+ selfStartPhase("wear_inventory_category");
- gAgentWearables.notifyLoadingStarted();
+ gAgentWearables.notifyLoadingStarted();
- LL_INFOS("Avatar") << self_av_string() << "wearInventoryCategory( " << category->getName()
- << " )" << LL_ENDL;
+ LL_INFOS("Avatar") << self_av_string() << "wearInventoryCategory( " << category->getName()
+ << " )" << LL_ENDL;
- // If we are copying from library, attempt to use AIS to copy the category.
+ // If we are copying from library, attempt to use AIS to copy the category.
if (copy && AISAPI::isAvailable())
- {
- LLUUID parent_id;
- parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- if (parent_id.isNull())
- {
- parent_id = gInventory.getRootFolderID();
- }
-
- LLPointer<LLInventoryCallback> copy_cb = new LLWearCategoryAfterCopy(append);
- LLPointer<LLInventoryCallback> track_cb = new LLTrackPhaseWrapper(
- std::string("wear_inventory_category_callback"), copy_cb);
+ {
+ LLUUID parent_id;
+ parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
+ if (parent_id.isNull())
+ {
+ parent_id = gInventory.getRootFolderID();
+ }
+
+ LLPointer<LLInventoryCallback> copy_cb = new LLWearCategoryAfterCopy(append);
+ LLPointer<LLInventoryCallback> track_cb = new LLTrackPhaseWrapper(
+ std::string("wear_inventory_category_callback"), copy_cb);
AISAPI::completion_t cr = boost::bind(&doAppearanceCb, track_cb, _1);
AISAPI::CopyLibraryCategory(category->getUUID(), parent_id, false, cr);
- }
+ }
else
- {
- selfStartPhase("wear_inventory_category_fetch");
+ {
+ selfStartPhase("wear_inventory_category_fetch");
if (AISAPI::isAvailable() && category->getPreferredType() == LLFolderType::FT_OUTFIT)
{
// for reliability just fetch it whole, linked items included
@@ -2792,66 +2792,66 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool
&LLAppearanceMgr::instance(),
category->getUUID(), copy, append));
}
- }
+ }
}
S32 LLAppearanceMgr::getActiveCopyOperations() const
{
- return LLCallAfterInventoryCopyMgr::getInstanceCount();
+ return LLCallAfterInventoryCopyMgr::getInstanceCount();
}
void LLAppearanceMgr::wearCategoryFinal(const LLUUID& cat_id, bool copy_items, bool append)
{
- LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL;
-
- selfStopPhase("wear_inventory_category_fetch");
-
- // We now have an outfit ready to be copied to agent inventory. Do
- // it, and wear that outfit normally.
- LLInventoryCategory* cat = gInventory.getCategory(cat_id);
- if(copy_items)
- {
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(cat_id, cats, items);
- std::string name;
- if(!cat)
- {
- // should never happen.
- name = "New Outfit";
- }
- else
- {
- name = cat->getName();
- }
- LLViewerInventoryItem* item = NULL;
- LLInventoryModel::item_array_t::const_iterator it = items->begin();
- LLInventoryModel::item_array_t::const_iterator end = items->end();
- LLUUID pid;
- for(; it < end; ++it)
- {
- item = *it;
- if(item)
- {
- if(LLInventoryType::IT_GESTURE == item->getInventoryType())
- {
- pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
- }
- else
- {
- pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- }
- break;
- }
- }
- if(pid.isNull())
- {
- pid = gInventory.getRootFolderID();
- }
-
- gInventory.createNewCategory(
- pid,
- LLFolderType::FT_NONE,
+ LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL;
+
+ selfStopPhase("wear_inventory_category_fetch");
+
+ // We now have an outfit ready to be copied to agent inventory. Do
+ // it, and wear that outfit normally.
+ LLInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if(copy_items)
+ {
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ gInventory.getDirectDescendentsOf(cat_id, cats, items);
+ std::string name;
+ if(!cat)
+ {
+ // should never happen.
+ name = "New Outfit";
+ }
+ else
+ {
+ name = cat->getName();
+ }
+ LLViewerInventoryItem* item = NULL;
+ LLInventoryModel::item_array_t::const_iterator it = items->begin();
+ LLInventoryModel::item_array_t::const_iterator end = items->end();
+ LLUUID pid;
+ for(; it < end; ++it)
+ {
+ item = *it;
+ if(item)
+ {
+ if(LLInventoryType::IT_GESTURE == item->getInventoryType())
+ {
+ pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
+ }
+ else
+ {
+ pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
+ }
+ break;
+ }
+ }
+ if(pid.isNull())
+ {
+ pid = gInventory.getRootFolderID();
+ }
+
+ gInventory.createNewCategory(
+ pid,
+ LLFolderType::FT_NONE,
name,
[cat_id, append](const LLUUID& new_cat_id)
{
@@ -2871,205 +2871,205 @@ void LLAppearanceMgr::wearCategoryFinal(const LLUUID& cat_id, bool copy_items, b
},
cat->getThumbnailUUID()
);
- }
- else
- {
- // Wear the inventory category.
- LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(cat, append);
- }
+ }
+ else
+ {
+ // Wear the inventory category.
+ LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(cat, append);
+ }
}
// *NOTE: hack to get from avatar inventory to avatar
void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* category, bool append )
{
- // Avoid unintentionally overwriting old wearables. We have to do
- // this up front to avoid having to deal with the case of multiple
- // wearables being dirty.
- if (!category) return;
+ // Avoid unintentionally overwriting old wearables. We have to do
+ // this up front to avoid having to deal with the case of multiple
+ // wearables being dirty.
+ if (!category) return;
+
+ if ( !LLInventoryCallbackManager::is_instantiated() )
+ {
+ // shutting down, ignore.
+ return;
+ }
- if ( !LLInventoryCallbackManager::is_instantiated() )
- {
- // shutting down, ignore.
- return;
- }
+ LL_INFOS("Avatar") << self_av_string() << "wearInventoryCategoryOnAvatar '" << category->getName()
+ << "'" << LL_ENDL;
+ LLUIUsage::instance().logCommand("Avatar.WearCategory");
- LL_INFOS("Avatar") << self_av_string() << "wearInventoryCategoryOnAvatar '" << category->getName()
- << "'" << LL_ENDL;
- LLUIUsage::instance().logCommand("Avatar.WearCategory");
-
- if (gAgentCamera.cameraCustomizeAvatar())
- {
- // switching to outfit editor should automagically save any currently edited wearable
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
- }
+ if (gAgentCamera.cameraCustomizeAvatar())
+ {
+ // switching to outfit editor should automagically save any currently edited wearable
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
+ }
- LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append);
+ LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append);
}
// FIXME do we really want to search entire inventory for matching name?
void LLAppearanceMgr::wearOutfitByName(const std::string& name)
{
- LL_INFOS("Avatar") << self_av_string() << "Wearing category " << name << LL_ENDL;
-
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- LLNameCategoryCollector has_name(name);
- gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- has_name);
- bool copy_items = false;
- LLInventoryCategory* cat = NULL;
- if (cat_array.size() > 0)
- {
- // Just wear the first one that matches
- cat = cat_array.at(0);
- }
- else
- {
- gInventory.collectDescendentsIf(LLUUID::null,
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- has_name);
- if(cat_array.size() > 0)
- {
- cat = cat_array.at(0);
- copy_items = true;
- }
- }
-
- if(cat)
- {
- LLAppearanceMgr::wearInventoryCategory(cat, copy_items, false);
- }
- else
- {
- LL_WARNS() << "Couldn't find outfit " <<name<< " in wearOutfitByName()"
- << LL_ENDL;
- }
+ LL_INFOS("Avatar") << self_av_string() << "Wearing category " << name << LL_ENDL;
+
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ LLNameCategoryCollector has_name(name);
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ has_name);
+ bool copy_items = false;
+ LLInventoryCategory* cat = NULL;
+ if (cat_array.size() > 0)
+ {
+ // Just wear the first one that matches
+ cat = cat_array.at(0);
+ }
+ else
+ {
+ gInventory.collectDescendentsIf(LLUUID::null,
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ has_name);
+ if(cat_array.size() > 0)
+ {
+ cat = cat_array.at(0);
+ copy_items = true;
+ }
+ }
+
+ if(cat)
+ {
+ LLAppearanceMgr::wearInventoryCategory(cat, copy_items, false);
+ }
+ else
+ {
+ LL_WARNS() << "Couldn't find outfit " <<name<< " in wearOutfitByName()"
+ << LL_ENDL;
+ }
}
bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventoryItem *b)
{
- return (a->isWearableType() && b->isWearableType() &&
- (a->getWearableType() == b->getWearableType()));
+ return (a->isWearableType() && b->isWearableType() &&
+ (a->getWearableType() == b->getWearableType()));
}
class LLDeferredCOFLinkObserver: public LLInventoryObserver
{
public:
- LLDeferredCOFLinkObserver(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb, const std::string& description):
- mItemID(item_id),
- mCallback(cb),
- mDescription(description)
- {
- }
-
- ~LLDeferredCOFLinkObserver()
- {
- }
-
- /* virtual */ void changed(U32 mask)
- {
- const LLInventoryItem *item = gInventory.getItem(mItemID);
- if (item)
- {
- gInventory.removeObserver(this);
- LLAppearanceMgr::instance().addCOFItemLink(item, mCallback, mDescription);
- delete this;
- }
- }
+ LLDeferredCOFLinkObserver(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb, const std::string& description):
+ mItemID(item_id),
+ mCallback(cb),
+ mDescription(description)
+ {
+ }
+
+ ~LLDeferredCOFLinkObserver()
+ {
+ }
+
+ /* virtual */ void changed(U32 mask)
+ {
+ const LLInventoryItem *item = gInventory.getItem(mItemID);
+ if (item)
+ {
+ gInventory.removeObserver(this);
+ LLAppearanceMgr::instance().addCOFItemLink(item, mCallback, mDescription);
+ delete this;
+ }
+ }
private:
- const LLUUID mItemID;
- std::string mDescription;
- LLPointer<LLInventoryCallback> mCallback;
+ const LLUUID mItemID;
+ std::string mDescription;
+ LLPointer<LLInventoryCallback> mCallback;
};
// BAP - note that this runs asynchronously if the item is not already loaded from inventory.
// Dangerous if caller assumes link will exist after calling the function.
void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id,
- LLPointer<LLInventoryCallback> cb,
- const std::string description)
+ LLPointer<LLInventoryCallback> cb,
+ const std::string description)
{
- const LLInventoryItem *item = gInventory.getItem(item_id);
- if (!item)
- {
- LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, cb, description);
- gInventory.addObserver(observer);
- }
- else
- {
- addCOFItemLink(item, cb, description);
- }
+ const LLInventoryItem *item = gInventory.getItem(item_id);
+ if (!item)
+ {
+ LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, cb, description);
+ gInventory.addObserver(observer);
+ }
+ else
+ {
+ addCOFItemLink(item, cb, description);
+ }
}
void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item,
- LLPointer<LLInventoryCallback> cb,
- const std::string description)
-{
- const LLViewerInventoryItem *vitem = dynamic_cast<const LLViewerInventoryItem*>(item);
- if (!vitem)
- {
- LL_WARNS() << "not an llviewerinventoryitem, failed" << LL_ENDL;
- return;
- }
-
- gInventory.addChangedMask(LLInventoryObserver::LABEL, vitem->getLinkedUUID());
-
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- gInventory.collectDescendents(LLAppearanceMgr::getCOF(),
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH);
- bool linked_already = false;
- for (S32 i=0; i<item_array.size(); i++)
- {
- // Are these links to the same object?
- const LLViewerInventoryItem* inv_item = item_array.at(i).get();
- const LLWearableType::EType wearable_type = inv_item->getWearableType();
-
- const bool is_body_part = (wearable_type == LLWearableType::WT_SHAPE)
- || (wearable_type == LLWearableType::WT_HAIR)
- || (wearable_type == LLWearableType::WT_EYES)
- || (wearable_type == LLWearableType::WT_SKIN);
-
- if (inv_item->getLinkedUUID() == vitem->getLinkedUUID())
- {
- linked_already = true;
- }
- // Are these links to different items of the same body part
- // type? If so, new item will replace old.
- else if ((vitem->isWearableType()) && (vitem->getWearableType() == wearable_type))
- {
- if (is_body_part && inv_item->getIsLinkType())
- {
- remove_inventory_item(inv_item->getUUID(), cb);
- }
- else if (!gAgentWearables.canAddWearable(wearable_type))
- {
- // MULTI-WEARABLES: make sure we don't go over clothing limits
- remove_inventory_item(inv_item->getUUID(), cb);
- }
- }
- }
-
- if (!linked_already)
- {
- LLViewerInventoryItem *copy_item = new LLViewerInventoryItem;
- copy_item->copyViewerItem(vitem);
- copy_item->setDescription(description);
- link_inventory_object(getCOF(), copy_item, cb);
- }
+ LLPointer<LLInventoryCallback> cb,
+ const std::string description)
+{
+ const LLViewerInventoryItem *vitem = dynamic_cast<const LLViewerInventoryItem*>(item);
+ if (!vitem)
+ {
+ LL_WARNS() << "not an llviewerinventoryitem, failed" << LL_ENDL;
+ return;
+ }
+
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, vitem->getLinkedUUID());
+
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ gInventory.collectDescendents(LLAppearanceMgr::getCOF(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+ bool linked_already = false;
+ for (S32 i=0; i<item_array.size(); i++)
+ {
+ // Are these links to the same object?
+ const LLViewerInventoryItem* inv_item = item_array.at(i).get();
+ const LLWearableType::EType wearable_type = inv_item->getWearableType();
+
+ const bool is_body_part = (wearable_type == LLWearableType::WT_SHAPE)
+ || (wearable_type == LLWearableType::WT_HAIR)
+ || (wearable_type == LLWearableType::WT_EYES)
+ || (wearable_type == LLWearableType::WT_SKIN);
+
+ if (inv_item->getLinkedUUID() == vitem->getLinkedUUID())
+ {
+ linked_already = true;
+ }
+ // Are these links to different items of the same body part
+ // type? If so, new item will replace old.
+ else if ((vitem->isWearableType()) && (vitem->getWearableType() == wearable_type))
+ {
+ if (is_body_part && inv_item->getIsLinkType())
+ {
+ remove_inventory_item(inv_item->getUUID(), cb);
+ }
+ else if (!gAgentWearables.canAddWearable(wearable_type))
+ {
+ // MULTI-WEARABLES: make sure we don't go over clothing limits
+ remove_inventory_item(inv_item->getUUID(), cb);
+ }
+ }
+ }
+
+ if (!linked_already)
+ {
+ LLViewerInventoryItem *copy_item = new LLViewerInventoryItem;
+ copy_item->copyViewerItem(vitem);
+ copy_item->setDescription(description);
+ link_inventory_object(getCOF(), copy_item, cb);
+ }
}
LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& item_id)
{
- LLInventoryModel::item_array_t result;
+ LLInventoryModel::item_array_t result;
LLUUID linked_id = gInventory.getLinkedItemID(item_id);
LLInventoryModel::cat_array_t cat_array;
@@ -3086,232 +3086,232 @@ LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& i
result.push_back(item_array.at(i));
}
}
- return result;
+ return result;
}
bool LLAppearanceMgr::isLinkedInCOF(const LLUUID& item_id)
{
- LLInventoryModel::item_array_t links = LLAppearanceMgr::instance().findCOFItemLinks(item_id);
- return links.size() > 0;
+ LLInventoryModel::item_array_t links = LLAppearanceMgr::instance().findCOFItemLinks(item_id);
+ return links.size() > 0;
}
void LLAppearanceMgr::removeAllClothesFromAvatar()
{
- // Fetch worn clothes (i.e. the ones in COF).
- LLInventoryModel::item_array_t clothing_items;
- LLInventoryModel::cat_array_t dummy;
- LLIsType is_clothing(LLAssetType::AT_CLOTHING);
- gInventory.collectDescendentsIf(getCOF(),
- dummy,
- clothing_items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_clothing);
- uuid_vec_t item_ids;
- for (LLInventoryModel::item_array_t::iterator it = clothing_items.begin();
- it != clothing_items.end(); ++it)
- {
- item_ids.push_back((*it).get()->getLinkedUUID());
- }
-
- // Take them off by removing from COF.
- removeItemsFromAvatar(item_ids);
+ // Fetch worn clothes (i.e. the ones in COF).
+ LLInventoryModel::item_array_t clothing_items;
+ LLInventoryModel::cat_array_t dummy;
+ LLIsType is_clothing(LLAssetType::AT_CLOTHING);
+ gInventory.collectDescendentsIf(getCOF(),
+ dummy,
+ clothing_items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_clothing);
+ uuid_vec_t item_ids;
+ for (LLInventoryModel::item_array_t::iterator it = clothing_items.begin();
+ it != clothing_items.end(); ++it)
+ {
+ item_ids.push_back((*it).get()->getLinkedUUID());
+ }
+
+ // Take them off by removing from COF.
+ removeItemsFromAvatar(item_ids);
}
void LLAppearanceMgr::removeAllAttachmentsFromAvatar()
{
- if (!isAgentAvatarValid()) return;
-
- LLAgentWearables::llvo_vec_t objects_to_remove;
-
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end();)
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject *attached_object = attachment_iter->get();
- if (attached_object)
- {
- objects_to_remove.push_back(attached_object);
- }
- }
- }
- uuid_vec_t ids_to_remove;
- for (LLAgentWearables::llvo_vec_t::iterator it = objects_to_remove.begin();
- it != objects_to_remove.end();
- ++it)
- {
- ids_to_remove.push_back((*it)->getAttachmentItemID());
- }
- removeItemsFromAvatar(ids_to_remove);
+ if (!isAgentAvatarValid()) return;
+
+ LLAgentWearables::llvo_vec_t objects_to_remove;
+
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end();)
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject *attached_object = attachment_iter->get();
+ if (attached_object)
+ {
+ objects_to_remove.push_back(attached_object);
+ }
+ }
+ }
+ uuid_vec_t ids_to_remove;
+ for (LLAgentWearables::llvo_vec_t::iterator it = objects_to_remove.begin();
+ it != objects_to_remove.end();
+ ++it)
+ {
+ ids_to_remove.push_back((*it)->getAttachmentItemID());
+ }
+ removeItemsFromAvatar(ids_to_remove);
}
class LLUpdateOnCOFLinkRemove : public LLInventoryCallback
{
public:
- LLUpdateOnCOFLinkRemove(const LLUUID& remove_item_id, LLPointer<LLInventoryCallback> cb = NULL):
- mItemID(remove_item_id),
- mCB(cb)
- {
- }
-
- /* virtual */ void fire(const LLUUID& item_id)
- {
- // just removed cof link, "(wear)" suffix depends on presence of link, so update label
- gInventory.addChangedMask(LLInventoryObserver::LABEL, mItemID);
- if (mCB.notNull())
- {
- mCB->fire(item_id);
- }
- }
+ LLUpdateOnCOFLinkRemove(const LLUUID& remove_item_id, LLPointer<LLInventoryCallback> cb = NULL):
+ mItemID(remove_item_id),
+ mCB(cb)
+ {
+ }
+
+ /* virtual */ void fire(const LLUUID& item_id)
+ {
+ // just removed cof link, "(wear)" suffix depends on presence of link, so update label
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, mItemID);
+ if (mCB.notNull())
+ {
+ mCB->fire(item_id);
+ }
+ }
private:
- LLUUID mItemID;
- LLPointer<LLInventoryCallback> mCB;
+ LLUUID mItemID;
+ LLPointer<LLInventoryCallback> mCB;
};
void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb)
-{ LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- gInventory.collectDescendents(LLAppearanceMgr::getCOF(),
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH);
- for (S32 i=0; i<item_array.size(); i++)
- {
- const LLInventoryItem* item = item_array.at(i).get();
- if (item->getIsLinkType() && item->getLinkedUUID() == item_id)
- {
- if (item->getType() == LLAssetType::AT_OBJECT)
- {
- // Immediate delete
- remove_inventory_item(item->getUUID(), cb, true);
- gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
- }
- else
- {
- // Delayed delete
- // Pointless to update item_id label here since link still exists and first notifyObservers
- // call will restore (wear) suffix, mark for update after deletion
- LLPointer<LLUpdateOnCOFLinkRemove> cb_label = new LLUpdateOnCOFLinkRemove(item_id, cb);
- remove_inventory_item(item->getUUID(), cb_label, false);
- }
- }
- }
+{ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ gInventory.collectDescendents(LLAppearanceMgr::getCOF(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+ for (S32 i=0; i<item_array.size(); i++)
+ {
+ const LLInventoryItem* item = item_array.at(i).get();
+ if (item->getIsLinkType() && item->getLinkedUUID() == item_id)
+ {
+ if (item->getType() == LLAssetType::AT_OBJECT)
+ {
+ // Immediate delete
+ remove_inventory_item(item->getUUID(), cb, true);
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+ }
+ else
+ {
+ // Delayed delete
+ // Pointless to update item_id label here since link still exists and first notifyObservers
+ // call will restore (wear) suffix, mark for update after deletion
+ LLPointer<LLUpdateOnCOFLinkRemove> cb_label = new LLUpdateOnCOFLinkRemove(item_id, cb);
+ remove_inventory_item(item->getUUID(), cb_label, false);
+ }
+ }
+ }
}
void LLAppearanceMgr::removeCOFLinksOfType(LLWearableType::EType type, LLPointer<LLInventoryCallback> cb)
{
- LLFindWearablesOfType filter_wearables_of_type(type);
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLInventoryModel::item_array_t::const_iterator it;
+ LLFindWearablesOfType filter_wearables_of_type(type);
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLInventoryModel::item_array_t::const_iterator it;
- gInventory.collectDescendentsIf(getCOF(), cats, items, true, filter_wearables_of_type);
- for (it = items.begin(); it != items.end(); ++it)
- {
- const LLViewerInventoryItem* item = *it;
- if (item->getIsLinkType()) // we must operate on links only
- {
- remove_inventory_item(item->getUUID(), cb);
- }
- }
+ gInventory.collectDescendentsIf(getCOF(), cats, items, true, filter_wearables_of_type);
+ for (it = items.begin(); it != items.end(); ++it)
+ {
+ const LLViewerInventoryItem* item = *it;
+ if (item->getIsLinkType()) // we must operate on links only
+ {
+ remove_inventory_item(item->getUUID(), cb);
+ }
+ }
}
void LLAppearanceMgr::updateIsDirty()
{
- LLUUID cof = getCOF();
- LLUUID base_outfit;
-
- // find base outfit link
- const LLViewerInventoryItem* base_outfit_item = getBaseOutfitLink();
- LLViewerInventoryCategory* catp = NULL;
- if (base_outfit_item && base_outfit_item->getIsLinkType())
- {
- catp = base_outfit_item->getLinkedCategory();
- }
- if(catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
- {
- base_outfit = catp->getUUID();
- }
-
- // Set dirty to "false" if no base outfit found to disable "Save"
- // and leave only "Save As" enabled in My Outfits.
- mOutfitIsDirty = false;
-
- if (base_outfit.notNull())
- {
- LLIsValidItemLink collector;
-
- LLInventoryModel::cat_array_t cof_cats;
- LLInventoryModel::item_array_t cof_items;
- gInventory.collectDescendentsIf(cof, cof_cats, cof_items,
- LLInventoryModel::EXCLUDE_TRASH, collector);
-
- LLInventoryModel::cat_array_t outfit_cats;
- LLInventoryModel::item_array_t outfit_items;
- gInventory.collectDescendentsIf(base_outfit, outfit_cats, outfit_items,
- LLInventoryModel::EXCLUDE_TRASH, collector);
-
- for (U32 i = 0; i < outfit_items.size(); ++i)
- {
- LLViewerInventoryItem* linked_item = outfit_items.at(i)->getLinkedItem();
- if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
- {
- outfit_items.erase(outfit_items.begin() + i);
- break;
- }
- }
-
- if(outfit_items.size() != cof_items.size())
- {
- LL_DEBUGS("Avatar") << "item count different - base " << outfit_items.size() << " cof " << cof_items.size() << LL_ENDL;
- // Current outfit folder should have one more item than the outfit folder.
- // this one item is the link back to the outfit folder itself.
- mOutfitIsDirty = true;
- return;
- }
-
- //"dirty" - also means a difference in linked UUIDs and/or a difference in wearables order (links' descriptions)
- std::sort(cof_items.begin(), cof_items.end(), sort_by_linked_uuid);
- std::sort(outfit_items.begin(), outfit_items.end(), sort_by_linked_uuid);
-
- for (U32 i = 0; i < cof_items.size(); ++i)
- {
- LLViewerInventoryItem *item1 = cof_items.at(i);
- LLViewerInventoryItem *item2 = outfit_items.at(i);
-
- if (item1->getLinkedUUID() != item2->getLinkedUUID() ||
- item1->getName() != item2->getName() ||
- item1->getActualDescription() != item2->getActualDescription())
- {
- if (item1->getLinkedUUID() != item2->getLinkedUUID())
- {
- LL_DEBUGS("Avatar") << "link id different " << LL_ENDL;
- }
- else
- {
- if (item1->getName() != item2->getName())
- {
- LL_DEBUGS("Avatar") << "name different " << item1->getName() << " " << item2->getName() << LL_ENDL;
- }
- if (item1->getActualDescription() != item2->getActualDescription())
- {
- LL_DEBUGS("Avatar") << "desc different " << item1->getActualDescription()
- << " " << item2->getActualDescription()
- << " names " << item1->getName() << " " << item2->getName() << LL_ENDL;
- }
- }
- mOutfitIsDirty = true;
- return;
- }
- }
- }
- llassert(!mOutfitIsDirty);
- LL_DEBUGS("Avatar") << "clean" << LL_ENDL;
+ LLUUID cof = getCOF();
+ LLUUID base_outfit;
+
+ // find base outfit link
+ const LLViewerInventoryItem* base_outfit_item = getBaseOutfitLink();
+ LLViewerInventoryCategory* catp = NULL;
+ if (base_outfit_item && base_outfit_item->getIsLinkType())
+ {
+ catp = base_outfit_item->getLinkedCategory();
+ }
+ if(catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
+ {
+ base_outfit = catp->getUUID();
+ }
+
+ // Set dirty to "false" if no base outfit found to disable "Save"
+ // and leave only "Save As" enabled in My Outfits.
+ mOutfitIsDirty = false;
+
+ if (base_outfit.notNull())
+ {
+ LLIsValidItemLink collector;
+
+ LLInventoryModel::cat_array_t cof_cats;
+ LLInventoryModel::item_array_t cof_items;
+ gInventory.collectDescendentsIf(cof, cof_cats, cof_items,
+ LLInventoryModel::EXCLUDE_TRASH, collector);
+
+ LLInventoryModel::cat_array_t outfit_cats;
+ LLInventoryModel::item_array_t outfit_items;
+ gInventory.collectDescendentsIf(base_outfit, outfit_cats, outfit_items,
+ LLInventoryModel::EXCLUDE_TRASH, collector);
+
+ for (U32 i = 0; i < outfit_items.size(); ++i)
+ {
+ LLViewerInventoryItem* linked_item = outfit_items.at(i)->getLinkedItem();
+ if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
+ {
+ outfit_items.erase(outfit_items.begin() + i);
+ break;
+ }
+ }
+
+ if(outfit_items.size() != cof_items.size())
+ {
+ LL_DEBUGS("Avatar") << "item count different - base " << outfit_items.size() << " cof " << cof_items.size() << LL_ENDL;
+ // Current outfit folder should have one more item than the outfit folder.
+ // this one item is the link back to the outfit folder itself.
+ mOutfitIsDirty = true;
+ return;
+ }
+
+ //"dirty" - also means a difference in linked UUIDs and/or a difference in wearables order (links' descriptions)
+ std::sort(cof_items.begin(), cof_items.end(), sort_by_linked_uuid);
+ std::sort(outfit_items.begin(), outfit_items.end(), sort_by_linked_uuid);
+
+ for (U32 i = 0; i < cof_items.size(); ++i)
+ {
+ LLViewerInventoryItem *item1 = cof_items.at(i);
+ LLViewerInventoryItem *item2 = outfit_items.at(i);
+
+ if (item1->getLinkedUUID() != item2->getLinkedUUID() ||
+ item1->getName() != item2->getName() ||
+ item1->getActualDescription() != item2->getActualDescription())
+ {
+ if (item1->getLinkedUUID() != item2->getLinkedUUID())
+ {
+ LL_DEBUGS("Avatar") << "link id different " << LL_ENDL;
+ }
+ else
+ {
+ if (item1->getName() != item2->getName())
+ {
+ LL_DEBUGS("Avatar") << "name different " << item1->getName() << " " << item2->getName() << LL_ENDL;
+ }
+ if (item1->getActualDescription() != item2->getActualDescription())
+ {
+ LL_DEBUGS("Avatar") << "desc different " << item1->getActualDescription()
+ << " " << item2->getActualDescription()
+ << " names " << item1->getName() << " " << item2->getName() << LL_ENDL;
+ }
+ }
+ mOutfitIsDirty = true;
+ return;
+ }
+ }
+ }
+ llassert(!mOutfitIsDirty);
+ LL_DEBUGS("Avatar") << "clean" << LL_ENDL;
}
// *HACK: Must match name in Library or agent inventory
@@ -3324,152 +3324,152 @@ const std::string OTHER_GESTURES_FOLDER = "Other Gestures";
void LLAppearanceMgr::copyLibraryGestures()
{
- LL_INFOS("Avatar") << self_av_string() << "Copying library gestures" << LL_ENDL;
-
- // Copy gestures
- LLUUID lib_gesture_cat_id =
- gInventory.findLibraryCategoryUUIDForType(LLFolderType::FT_GESTURE);
- if (lib_gesture_cat_id.isNull())
- {
- LL_WARNS() << "Unable to copy gestures, source category not found" << LL_ENDL;
- }
- LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
-
- std::vector<std::string> gesture_folders_to_copy;
- gesture_folders_to_copy.push_back(MALE_GESTURES_FOLDER);
- gesture_folders_to_copy.push_back(FEMALE_GESTURES_FOLDER);
- gesture_folders_to_copy.push_back(COMMON_GESTURES_FOLDER);
- gesture_folders_to_copy.push_back(SPEECH_GESTURES_FOLDER);
- gesture_folders_to_copy.push_back(OTHER_GESTURES_FOLDER);
-
- for(std::vector<std::string>::iterator it = gesture_folders_to_copy.begin();
- it != gesture_folders_to_copy.end();
- ++it)
- {
- std::string& folder_name = *it;
-
- LLPointer<LLInventoryCallback> cb(NULL);
-
- // After copying gestures, activate Common, Other, plus
- // Male and/or Female, depending upon the initial outfit gender.
- ESex gender = gAgentAvatarp->getSex();
-
- std::string activate_male_gestures;
- std::string activate_female_gestures;
- switch (gender) {
- case SEX_MALE:
- activate_male_gestures = MALE_GESTURES_FOLDER;
- break;
- case SEX_FEMALE:
- activate_female_gestures = FEMALE_GESTURES_FOLDER;
- break;
- case SEX_BOTH:
- activate_male_gestures = MALE_GESTURES_FOLDER;
- activate_female_gestures = FEMALE_GESTURES_FOLDER;
- break;
- }
-
- if (folder_name == activate_male_gestures ||
- folder_name == activate_female_gestures ||
- folder_name == COMMON_GESTURES_FOLDER ||
- folder_name == OTHER_GESTURES_FOLDER)
- {
- cb = new LLBoostFuncInventoryCallback(activate_gesture_cb);
- }
-
- LLUUID cat_id = findDescendentCategoryIDByName(lib_gesture_cat_id,folder_name);
- if (cat_id.isNull())
- {
- LL_WARNS() << self_av_string() << "failed to find gesture folder for " << folder_name << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("Avatar") << self_av_string() << "initiating fetch and copy for " << folder_name << " cat_id " << cat_id << LL_ENDL;
- callAfterCategoryFetch(cat_id,
- boost::bind(&LLAppearanceMgr::shallowCopyCategory,
- &LLAppearanceMgr::instance(),
- cat_id, dst_id, cb));
- }
- }
+ LL_INFOS("Avatar") << self_av_string() << "Copying library gestures" << LL_ENDL;
+
+ // Copy gestures
+ LLUUID lib_gesture_cat_id =
+ gInventory.findLibraryCategoryUUIDForType(LLFolderType::FT_GESTURE);
+ if (lib_gesture_cat_id.isNull())
+ {
+ LL_WARNS() << "Unable to copy gestures, source category not found" << LL_ENDL;
+ }
+ LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
+
+ std::vector<std::string> gesture_folders_to_copy;
+ gesture_folders_to_copy.push_back(MALE_GESTURES_FOLDER);
+ gesture_folders_to_copy.push_back(FEMALE_GESTURES_FOLDER);
+ gesture_folders_to_copy.push_back(COMMON_GESTURES_FOLDER);
+ gesture_folders_to_copy.push_back(SPEECH_GESTURES_FOLDER);
+ gesture_folders_to_copy.push_back(OTHER_GESTURES_FOLDER);
+
+ for(std::vector<std::string>::iterator it = gesture_folders_to_copy.begin();
+ it != gesture_folders_to_copy.end();
+ ++it)
+ {
+ std::string& folder_name = *it;
+
+ LLPointer<LLInventoryCallback> cb(NULL);
+
+ // After copying gestures, activate Common, Other, plus
+ // Male and/or Female, depending upon the initial outfit gender.
+ ESex gender = gAgentAvatarp->getSex();
+
+ std::string activate_male_gestures;
+ std::string activate_female_gestures;
+ switch (gender) {
+ case SEX_MALE:
+ activate_male_gestures = MALE_GESTURES_FOLDER;
+ break;
+ case SEX_FEMALE:
+ activate_female_gestures = FEMALE_GESTURES_FOLDER;
+ break;
+ case SEX_BOTH:
+ activate_male_gestures = MALE_GESTURES_FOLDER;
+ activate_female_gestures = FEMALE_GESTURES_FOLDER;
+ break;
+ }
+
+ if (folder_name == activate_male_gestures ||
+ folder_name == activate_female_gestures ||
+ folder_name == COMMON_GESTURES_FOLDER ||
+ folder_name == OTHER_GESTURES_FOLDER)
+ {
+ cb = new LLBoostFuncInventoryCallback(activate_gesture_cb);
+ }
+
+ LLUUID cat_id = findDescendentCategoryIDByName(lib_gesture_cat_id,folder_name);
+ if (cat_id.isNull())
+ {
+ LL_WARNS() << self_av_string() << "failed to find gesture folder for " << folder_name << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("Avatar") << self_av_string() << "initiating fetch and copy for " << folder_name << " cat_id " << cat_id << LL_ENDL;
+ callAfterCategoryFetch(cat_id,
+ boost::bind(&LLAppearanceMgr::shallowCopyCategory,
+ &LLAppearanceMgr::instance(),
+ cat_id, dst_id, cb));
+ }
+ }
}
// Handler for anything that's deferred until avatar de-clouds.
void LLAppearanceMgr::onFirstFullyVisible()
{
- gAgentAvatarp->outputRezTiming("Avatar fully loaded");
- gAgentAvatarp->reportAvatarRezTime();
- gAgentAvatarp->debugAvatarVisible();
+ gAgentAvatarp->outputRezTiming("Avatar fully loaded");
+ gAgentAvatarp->reportAvatarRezTime();
+ gAgentAvatarp->debugAvatarVisible();
- // If this is the first time we've ever logged in,
- // then copy default gestures from the library.
- if (gAgent.isFirstLogin()) {
- copyLibraryGestures();
- }
+ // If this is the first time we've ever logged in,
+ // then copy default gestures from the library.
+ if (gAgent.isFirstLogin()) {
+ copyLibraryGestures();
+ }
}
// update "dirty" state - defined outside class to allow for calling
// after appearance mgr instance has been destroyed.
void appearance_mgr_update_dirty_state()
{
- if (LLAppearanceMgr::instanceExists())
- {
- LLAppearanceMgr& app_mgr = LLAppearanceMgr::instance();
- LLUUID image_id = app_mgr.getOutfitImage();
- if(image_id.notNull())
- {
- LLPointer<LLInventoryCallback> cb = NULL;
- link_inventory_object(app_mgr.getBaseOutfitUUID(), image_id, cb);
- }
+ if (LLAppearanceMgr::instanceExists())
+ {
+ LLAppearanceMgr& app_mgr = LLAppearanceMgr::instance();
+ LLUUID image_id = app_mgr.getOutfitImage();
+ if(image_id.notNull())
+ {
+ LLPointer<LLInventoryCallback> cb = NULL;
+ link_inventory_object(app_mgr.getBaseOutfitUUID(), image_id, cb);
+ }
- LLAppearanceMgr::getInstance()->updateIsDirty();
- LLAppearanceMgr::getInstance()->setOutfitLocked(false);
- gAgentWearables.notifyLoadingFinished();
- }
+ LLAppearanceMgr::getInstance()->updateIsDirty();
+ LLAppearanceMgr::getInstance()->setOutfitLocked(false);
+ gAgentWearables.notifyLoadingFinished();
+ }
}
void update_base_outfit_after_ordering()
{
- LLAppearanceMgr& app_mgr = LLAppearanceMgr::instance();
- app_mgr.setOutfitImage(LLUUID());
- LLInventoryModel::cat_array_t sub_cat_array;
- LLInventoryModel::item_array_t outfit_item_array;
- gInventory.collectDescendents(app_mgr.getBaseOutfitUUID(),
- sub_cat_array,
- outfit_item_array,
- LLInventoryModel::EXCLUDE_TRASH);
- for (LLViewerInventoryItem* outfit_item : outfit_item_array)
- {
- LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem();
- if (linked_item != NULL)
- {
- if (linked_item->getActualType() == LLAssetType::AT_TEXTURE)
- {
- app_mgr.setOutfitImage(linked_item->getLinkedUUID());
- if (linked_item->getName() == LLAppearanceMgr::sExpectedTextureName)
- {
- // Images with "appropriate" name take priority
- break;
- }
- }
- }
- else if (outfit_item->getActualType() == LLAssetType::AT_TEXTURE)
- {
- app_mgr.setOutfitImage(outfit_item->getUUID());
- if (outfit_item->getName() == LLAppearanceMgr::sExpectedTextureName)
- {
- // Images with "appropriate" name take priority
- break;
- }
- }
- }
-
- LLPointer<LLInventoryCallback> dirty_state_updater =
- new LLBoostFuncInventoryCallback(no_op_inventory_func, appearance_mgr_update_dirty_state);
-
- //COF contains only links so we copy to the Base Outfit only links
- const LLUUID base_outfit_id = app_mgr.getBaseOutfitUUID();
- bool copy_folder_links = false;
- app_mgr.slamCategoryLinks(app_mgr.getCOF(), base_outfit_id, copy_folder_links, dirty_state_updater);
+ LLAppearanceMgr& app_mgr = LLAppearanceMgr::instance();
+ app_mgr.setOutfitImage(LLUUID());
+ LLInventoryModel::cat_array_t sub_cat_array;
+ LLInventoryModel::item_array_t outfit_item_array;
+ gInventory.collectDescendents(app_mgr.getBaseOutfitUUID(),
+ sub_cat_array,
+ outfit_item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+ for (LLViewerInventoryItem* outfit_item : outfit_item_array)
+ {
+ LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem();
+ if (linked_item != NULL)
+ {
+ if (linked_item->getActualType() == LLAssetType::AT_TEXTURE)
+ {
+ app_mgr.setOutfitImage(linked_item->getLinkedUUID());
+ if (linked_item->getName() == LLAppearanceMgr::sExpectedTextureName)
+ {
+ // Images with "appropriate" name take priority
+ break;
+ }
+ }
+ }
+ else if (outfit_item->getActualType() == LLAssetType::AT_TEXTURE)
+ {
+ app_mgr.setOutfitImage(outfit_item->getUUID());
+ if (outfit_item->getName() == LLAppearanceMgr::sExpectedTextureName)
+ {
+ // Images with "appropriate" name take priority
+ break;
+ }
+ }
+ }
+
+ LLPointer<LLInventoryCallback> dirty_state_updater =
+ new LLBoostFuncInventoryCallback(no_op_inventory_func, appearance_mgr_update_dirty_state);
+
+ //COF contains only links so we copy to the Base Outfit only links
+ const LLUUID base_outfit_id = app_mgr.getBaseOutfitUUID();
+ bool copy_folder_links = false;
+ app_mgr.slamCategoryLinks(app_mgr.getCOF(), base_outfit_id, copy_folder_links, dirty_state_updater);
if (base_outfit_id.notNull())
{
@@ -3521,245 +3521,245 @@ void update_base_outfit_after_ordering()
// to match the current COF. Fails if no current base outfit is set.
bool LLAppearanceMgr::updateBaseOutfit()
{
- if (isOutfitLocked())
- {
- // don't allow modify locked outfit
- llassert(!isOutfitLocked());
- return false;
- }
+ if (isOutfitLocked())
+ {
+ // don't allow modify locked outfit
+ llassert(!isOutfitLocked());
+ return false;
+ }
- setOutfitLocked(true);
+ setOutfitLocked(true);
- gAgentWearables.notifyLoadingStarted();
+ gAgentWearables.notifyLoadingStarted();
- const LLUUID base_outfit_id = getBaseOutfitUUID();
- if (base_outfit_id.isNull()) return false;
- LL_DEBUGS("Avatar") << "saving cof to base outfit " << base_outfit_id << LL_ENDL;
+ const LLUUID base_outfit_id = getBaseOutfitUUID();
+ if (base_outfit_id.isNull()) return false;
+ LL_DEBUGS("Avatar") << "saving cof to base outfit " << base_outfit_id << LL_ENDL;
- LLPointer<LLInventoryCallback> cb =
- new LLBoostFuncInventoryCallback(no_op_inventory_func, update_base_outfit_after_ordering);
- // Really shouldn't be needed unless there's a race condition -
- // updateAppearanceFromCOF() already calls updateClothingOrderingInfo.
- updateClothingOrderingInfo(LLUUID::null, cb);
+ LLPointer<LLInventoryCallback> cb =
+ new LLBoostFuncInventoryCallback(no_op_inventory_func, update_base_outfit_after_ordering);
+ // Really shouldn't be needed unless there's a race condition -
+ // updateAppearanceFromCOF() already calls updateClothingOrderingInfo.
+ updateClothingOrderingInfo(LLUUID::null, cb);
- return true;
+ return true;
}
void LLAppearanceMgr::divvyWearablesByType(const LLInventoryModel::item_array_t& items, wearables_by_type_t& items_by_type)
{
- items_by_type.resize(LLWearableType::WT_COUNT);
- if (items.empty()) return;
-
- for (S32 i=0; i<items.size(); i++)
- {
- LLViewerInventoryItem *item = items.at(i);
- if (!item)
- {
- LL_WARNS("Appearance") << "NULL item found" << LL_ENDL;
- continue;
- }
- // Ignore non-wearables.
- if (!item->isWearableType())
- continue;
- LLWearableType::EType type = item->getWearableType();
- if(type < 0 || type >= LLWearableType::WT_COUNT)
- {
- LL_WARNS("Appearance") << "Invalid wearable type. Inventory type does not match wearable flag bitfield." << LL_ENDL;
- continue;
- }
- items_by_type[type].push_back(item);
- }
+ items_by_type.resize(LLWearableType::WT_COUNT);
+ if (items.empty()) return;
+
+ for (S32 i=0; i<items.size(); i++)
+ {
+ LLViewerInventoryItem *item = items.at(i);
+ if (!item)
+ {
+ LL_WARNS("Appearance") << "NULL item found" << LL_ENDL;
+ continue;
+ }
+ // Ignore non-wearables.
+ if (!item->isWearableType())
+ continue;
+ LLWearableType::EType type = item->getWearableType();
+ if(type < 0 || type >= LLWearableType::WT_COUNT)
+ {
+ LL_WARNS("Appearance") << "Invalid wearable type. Inventory type does not match wearable flag bitfield." << LL_ENDL;
+ continue;
+ }
+ items_by_type[type].push_back(item);
+ }
}
std::string build_order_string(LLWearableType::EType type, U32 i)
{
- std::ostringstream order_num;
- order_num << ORDER_NUMBER_SEPARATOR << type * 100 + i;
- return order_num.str();
+ std::ostringstream order_num;
+ order_num << ORDER_NUMBER_SEPARATOR << type * 100 + i;
+ return order_num.str();
}
struct WearablesOrderComparator
{
- LOG_CLASS(WearablesOrderComparator);
- WearablesOrderComparator(const LLWearableType::EType type)
- {
- mControlSize = build_order_string(type, 0).size();
- };
-
- bool operator()(const LLInventoryItem* item1, const LLInventoryItem* item2)
- {
- const std::string& desc1 = item1->getActualDescription();
- const std::string& desc2 = item2->getActualDescription();
-
- bool item1_valid = (desc1.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc1[0]);
- bool item2_valid = (desc2.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc2[0]);
-
- if (item1_valid && item2_valid)
- return desc1 < desc2;
-
- //we need to sink down invalid items: items with empty descriptions, items with "Broken link" descriptions,
- //items with ordering information but not for the associated wearables type
- if (!item1_valid && item2_valid)
- return false;
- else if (item1_valid && !item2_valid)
- return true;
-
- return item1->getName() < item2->getName();
- }
-
- U32 mControlSize;
+ LOG_CLASS(WearablesOrderComparator);
+ WearablesOrderComparator(const LLWearableType::EType type)
+ {
+ mControlSize = build_order_string(type, 0).size();
+ };
+
+ bool operator()(const LLInventoryItem* item1, const LLInventoryItem* item2)
+ {
+ const std::string& desc1 = item1->getActualDescription();
+ const std::string& desc2 = item2->getActualDescription();
+
+ bool item1_valid = (desc1.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc1[0]);
+ bool item2_valid = (desc2.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc2[0]);
+
+ if (item1_valid && item2_valid)
+ return desc1 < desc2;
+
+ //we need to sink down invalid items: items with empty descriptions, items with "Broken link" descriptions,
+ //items with ordering information but not for the associated wearables type
+ if (!item1_valid && item2_valid)
+ return false;
+ else if (item1_valid && !item2_valid)
+ return true;
+
+ return item1->getName() < item2->getName();
+ }
+
+ U32 mControlSize;
};
void LLAppearanceMgr::getWearableOrderingDescUpdates(LLInventoryModel::item_array_t& wear_items,
- desc_map_t& desc_map)
-{
- wearables_by_type_t items_by_type(LLWearableType::WT_COUNT);
- divvyWearablesByType(wear_items, items_by_type);
-
- for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++)
- {
- U32 size = items_by_type[type].size();
- if (!size) continue;
-
- //sinking down invalid items which need reordering
- std::sort(items_by_type[type].begin(), items_by_type[type].end(), WearablesOrderComparator((LLWearableType::EType) type));
-
- //requesting updates only for those links which don't have "valid" descriptions
- for (U32 i = 0; i < size; i++)
- {
- LLViewerInventoryItem* item = items_by_type[type][i];
- if (!item) continue;
-
- std::string new_order_str = build_order_string((LLWearableType::EType)type, i);
- if (new_order_str == item->getActualDescription()) continue;
-
- desc_map[item->getUUID()] = new_order_str;
- }
- }
+ desc_map_t& desc_map)
+{
+ wearables_by_type_t items_by_type(LLWearableType::WT_COUNT);
+ divvyWearablesByType(wear_items, items_by_type);
+
+ for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++)
+ {
+ U32 size = items_by_type[type].size();
+ if (!size) continue;
+
+ //sinking down invalid items which need reordering
+ std::sort(items_by_type[type].begin(), items_by_type[type].end(), WearablesOrderComparator((LLWearableType::EType) type));
+
+ //requesting updates only for those links which don't have "valid" descriptions
+ for (U32 i = 0; i < size; i++)
+ {
+ LLViewerInventoryItem* item = items_by_type[type][i];
+ if (!item) continue;
+
+ std::string new_order_str = build_order_string((LLWearableType::EType)type, i);
+ if (new_order_str == item->getActualDescription()) continue;
+
+ desc_map[item->getUUID()] = new_order_str;
+ }
+ }
}
bool LLAppearanceMgr::validateClothingOrderingInfo(LLUUID cat_id)
{
- // COF is processed if cat_id is not specified
- if (cat_id.isNull())
- {
- cat_id = getCOF();
- }
-
- LLInventoryModel::item_array_t wear_items;
- getDescendentsOfAssetType(cat_id, wear_items, LLAssetType::AT_CLOTHING);
-
- // Identify items for which desc needs to change.
- desc_map_t desc_map;
- getWearableOrderingDescUpdates(wear_items, desc_map);
-
- for (desc_map_t::const_iterator it = desc_map.begin();
- it != desc_map.end(); ++it)
- {
- const LLUUID& item_id = it->first;
- const std::string& new_order_str = it->second;
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_WARNS() << "Order validation fails: " << item->getName()
- << " needs to update desc to: " << new_order_str
- << " (from: " << item->getActualDescription() << ")" << LL_ENDL;
- }
-
- return desc_map.size() == 0;
+ // COF is processed if cat_id is not specified
+ if (cat_id.isNull())
+ {
+ cat_id = getCOF();
+ }
+
+ LLInventoryModel::item_array_t wear_items;
+ getDescendentsOfAssetType(cat_id, wear_items, LLAssetType::AT_CLOTHING);
+
+ // Identify items for which desc needs to change.
+ desc_map_t desc_map;
+ getWearableOrderingDescUpdates(wear_items, desc_map);
+
+ for (desc_map_t::const_iterator it = desc_map.begin();
+ it != desc_map.end(); ++it)
+ {
+ const LLUUID& item_id = it->first;
+ const std::string& new_order_str = it->second;
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_WARNS() << "Order validation fails: " << item->getName()
+ << " needs to update desc to: " << new_order_str
+ << " (from: " << item->getActualDescription() << ")" << LL_ENDL;
+ }
+
+ return desc_map.size() == 0;
}
void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id,
- LLPointer<LLInventoryCallback> cb)
+ LLPointer<LLInventoryCallback> cb)
{
- // COF is processed if cat_id is not specified
- if (cat_id.isNull())
- {
- cat_id = getCOF();
- }
+ // COF is processed if cat_id is not specified
+ if (cat_id.isNull())
+ {
+ cat_id = getCOF();
+ }
+
+ LLInventoryModel::item_array_t wear_items;
+ getDescendentsOfAssetType(cat_id, wear_items, LLAssetType::AT_CLOTHING);
- LLInventoryModel::item_array_t wear_items;
- getDescendentsOfAssetType(cat_id, wear_items, LLAssetType::AT_CLOTHING);
+ // Identify items for which desc needs to change.
+ desc_map_t desc_map;
+ getWearableOrderingDescUpdates(wear_items, desc_map);
- // Identify items for which desc needs to change.
- desc_map_t desc_map;
- getWearableOrderingDescUpdates(wear_items, desc_map);
+ for (desc_map_t::const_iterator it = desc_map.begin();
+ it != desc_map.end(); ++it)
+ {
+ LLSD updates;
+ const LLUUID& item_id = it->first;
+ const std::string& new_order_str = it->second;
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << item->getName() << " updating desc to: " << new_order_str
+ << " (was: " << item->getActualDescription() << ")" << LL_ENDL;
+ updates["desc"] = new_order_str;
+ update_inventory_item(item_id,updates,cb);
+ }
- for (desc_map_t::const_iterator it = desc_map.begin();
- it != desc_map.end(); ++it)
- {
- LLSD updates;
- const LLUUID& item_id = it->first;
- const std::string& new_order_str = it->second;
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_DEBUGS("Avatar") << item->getName() << " updating desc to: " << new_order_str
- << " (was: " << item->getActualDescription() << ")" << LL_ENDL;
- updates["desc"] = new_order_str;
- update_inventory_item(item_id,updates,cb);
- }
-
}
LLSD LLAppearanceMgr::dumpCOF() const
{
- LLSD links = LLSD::emptyArray();
- LLMD5 md5;
-
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- gInventory.collectDescendents(getCOF(),cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
- for (S32 i=0; i<item_array.size(); i++)
- {
- const LLViewerInventoryItem* inv_item = item_array.at(i).get();
- LLSD item;
- LLUUID item_id(inv_item->getUUID());
- md5.update((unsigned char*)item_id.mData, 16);
- item["description"] = inv_item->getActualDescription();
- md5.update(inv_item->getActualDescription());
- item["asset_type"] = inv_item->getActualType();
- LLUUID linked_id(inv_item->getLinkedUUID());
- item["linked_id"] = linked_id;
- md5.update((unsigned char*)linked_id.mData, 16);
-
- if (LLAssetType::AT_LINK == inv_item->getActualType())
- {
- const LLViewerInventoryItem* linked_item = inv_item->getLinkedItem();
- if (NULL == linked_item)
- {
- LL_WARNS() << "Broken link for item '" << inv_item->getName()
- << "' (" << inv_item->getUUID()
- << ") during requestServerAppearanceUpdate" << LL_ENDL;
- continue;
- }
- // Some assets may be 'hidden' and show up as null in the viewer.
- //if (linked_item->getAssetUUID().isNull())
- //{
- // LL_WARNS() << "Broken link (null asset) for item '" << inv_item->getName()
- // << "' (" << inv_item->getUUID()
- // << ") during requestServerAppearanceUpdate" << LL_ENDL;
- // continue;
- //}
- LLUUID linked_asset_id(linked_item->getAssetUUID());
- md5.update((unsigned char*)linked_asset_id.mData, 16);
- U32 flags = linked_item->getFlags();
- md5.update(std::to_string(flags));
- }
- else if (LLAssetType::AT_LINK_FOLDER != inv_item->getActualType())
- {
- LL_WARNS() << "Non-link item '" << inv_item->getName()
- << "' (" << inv_item->getUUID()
- << ") type " << (S32) inv_item->getActualType()
- << " during requestServerAppearanceUpdate" << LL_ENDL;
- continue;
- }
- links.append(item);
- }
- LLSD result = LLSD::emptyMap();
- result["cof_contents"] = links;
- char cof_md5sum[MD5HEX_STR_SIZE];
- md5.finalize();
- md5.hex_digest(cof_md5sum);
- result["cof_md5sum"] = std::string(cof_md5sum);
- return result;
+ LLSD links = LLSD::emptyArray();
+ LLMD5 md5;
+
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ gInventory.collectDescendents(getCOF(),cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
+ for (S32 i=0; i<item_array.size(); i++)
+ {
+ const LLViewerInventoryItem* inv_item = item_array.at(i).get();
+ LLSD item;
+ LLUUID item_id(inv_item->getUUID());
+ md5.update((unsigned char*)item_id.mData, 16);
+ item["description"] = inv_item->getActualDescription();
+ md5.update(inv_item->getActualDescription());
+ item["asset_type"] = inv_item->getActualType();
+ LLUUID linked_id(inv_item->getLinkedUUID());
+ item["linked_id"] = linked_id;
+ md5.update((unsigned char*)linked_id.mData, 16);
+
+ if (LLAssetType::AT_LINK == inv_item->getActualType())
+ {
+ const LLViewerInventoryItem* linked_item = inv_item->getLinkedItem();
+ if (NULL == linked_item)
+ {
+ LL_WARNS() << "Broken link for item '" << inv_item->getName()
+ << "' (" << inv_item->getUUID()
+ << ") during requestServerAppearanceUpdate" << LL_ENDL;
+ continue;
+ }
+ // Some assets may be 'hidden' and show up as null in the viewer.
+ //if (linked_item->getAssetUUID().isNull())
+ //{
+ // LL_WARNS() << "Broken link (null asset) for item '" << inv_item->getName()
+ // << "' (" << inv_item->getUUID()
+ // << ") during requestServerAppearanceUpdate" << LL_ENDL;
+ // continue;
+ //}
+ LLUUID linked_asset_id(linked_item->getAssetUUID());
+ md5.update((unsigned char*)linked_asset_id.mData, 16);
+ U32 flags = linked_item->getFlags();
+ md5.update(std::to_string(flags));
+ }
+ else if (LLAssetType::AT_LINK_FOLDER != inv_item->getActualType())
+ {
+ LL_WARNS() << "Non-link item '" << inv_item->getName()
+ << "' (" << inv_item->getUUID()
+ << ") type " << (S32) inv_item->getActualType()
+ << " during requestServerAppearanceUpdate" << LL_ENDL;
+ continue;
+ }
+ links.append(item);
+ }
+ LLSD result = LLSD::emptyMap();
+ result["cof_contents"] = links;
+ char cof_md5sum[MD5HEX_STR_SIZE];
+ md5.finalize();
+ md5.hex_digest(cof_md5sum);
+ result["cof_md5sum"] = std::string(cof_md5sum);
+ return result;
}
// static
@@ -3827,7 +3827,7 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd
bool bRetry;
do
{
- // If we have already received an update for this or higher cof version,
+ // If we have already received an update for this or higher cof version,
// put a warning in the log and cancel the request.
S32 cofVersion = getCOFVersion();
S32 lastRcv = gAgentAvatarp->mLastUpdateReceivedCOFVersion;
@@ -3899,9 +3899,9 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd
std::string message = (result.has("error")) ? result["error"].asString() : status.toString();
LL_WARNS("Avatar") << "Appearance Failure. server responded with \"" << message << "\"" << LL_ENDL;
- // We may have requested a bake for a stale COF (especially if the inventory
- // is still updating. If that is the case re send the request with the
- // corrected COF version. (This may also be the case if the viewer is running
+ // We may have requested a bake for a stale COF (especially if the inventory
+ // is still updating. If that is the case re send the request with the
+ // corrected COF version. (This may also be the case if the viewer is running
// on multiple machines.
if (result.has("expected"))
{
@@ -3925,7 +3925,7 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd
LL_WARNS("Avatar") << "Bake retry #" << retryCount << " in " << timeout << " seconds." << LL_ENDL;
- llcoro::suspendUntilTimeout(timeout);
+ llcoro::suspendUntilTimeout(timeout);
if (LLApp::isExiting())
{
return;
@@ -4036,81 +4036,81 @@ void LLAppearanceMgr::debugAppearanceUpdateCOF(const LLSD& content)
std::string LLAppearanceMgr::getAppearanceServiceURL() const
{
- if (gSavedSettings.getString("DebugAvatarAppearanceServiceURLOverride").empty())
- {
- return mAppearanceServiceURL;
- }
- return gSavedSettings.getString("DebugAvatarAppearanceServiceURLOverride");
+ if (gSavedSettings.getString("DebugAvatarAppearanceServiceURLOverride").empty())
+ {
+ return mAppearanceServiceURL;
+ }
+ return gSavedSettings.getString("DebugAvatarAppearanceServiceURLOverride");
}
void show_created_outfit(LLUUID& folder_id, bool show_panel = true)
{
- if (!LLApp::isRunning())
- {
- LL_WARNS() << "called during shutdown, skipping" << LL_ENDL;
- return;
- }
-
- LL_DEBUGS("Avatar") << "called" << LL_ENDL;
- LLSD key;
-
- //EXT-7727. For new accounts inventory callback is created during login process
- // and may be processed after login process is finished
- if (show_panel)
- {
- LL_DEBUGS("Avatar") << "showing panel" << LL_ENDL;
- LLFloaterSidePanelContainer::showPanel("appearance", "panel_outfits_inventory", key);
-
- }
- LLOutfitsList *outfits_list =
- dynamic_cast<LLOutfitsList*>(LLFloaterSidePanelContainer::getPanel("appearance", "outfitslist_tab"));
- if (outfits_list)
- {
- outfits_list->setSelectedOutfitByUUID(folder_id);
- }
-
- LLAppearanceMgr::getInstance()->updateIsDirty();
- gAgentWearables.notifyLoadingFinished(); // New outfit is saved.
- LLAppearanceMgr::getInstance()->updatePanelOutfitName("");
-
- // For SSB, need to update appearance after we add a base outfit
- // link, since, the COF version has changed. There is a race
- // condition in initial outfit setup which can lead to rez
- // failures - SH-3860.
- LL_DEBUGS("Avatar") << "requesting appearance update after createBaseOutfitLink" << LL_ENDL;
- LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
- LLAppearanceMgr::getInstance()->createBaseOutfitLink(folder_id, cb);
+ if (!LLApp::isRunning())
+ {
+ LL_WARNS() << "called during shutdown, skipping" << LL_ENDL;
+ return;
+ }
+
+ LL_DEBUGS("Avatar") << "called" << LL_ENDL;
+ LLSD key;
+
+ //EXT-7727. For new accounts inventory callback is created during login process
+ // and may be processed after login process is finished
+ if (show_panel)
+ {
+ LL_DEBUGS("Avatar") << "showing panel" << LL_ENDL;
+ LLFloaterSidePanelContainer::showPanel("appearance", "panel_outfits_inventory", key);
+
+ }
+ LLOutfitsList *outfits_list =
+ dynamic_cast<LLOutfitsList*>(LLFloaterSidePanelContainer::getPanel("appearance", "outfitslist_tab"));
+ if (outfits_list)
+ {
+ outfits_list->setSelectedOutfitByUUID(folder_id);
+ }
+
+ LLAppearanceMgr::getInstance()->updateIsDirty();
+ gAgentWearables.notifyLoadingFinished(); // New outfit is saved.
+ LLAppearanceMgr::getInstance()->updatePanelOutfitName("");
+
+ // For SSB, need to update appearance after we add a base outfit
+ // link, since, the COF version has changed. There is a race
+ // condition in initial outfit setup which can lead to rez
+ // failures - SH-3860.
+ LL_DEBUGS("Avatar") << "requesting appearance update after createBaseOutfitLink" << LL_ENDL;
+ LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
+ LLAppearanceMgr::getInstance()->createBaseOutfitLink(folder_id, cb);
}
void LLAppearanceMgr::onOutfitFolderCreated(const LLUUID& folder_id, bool show_panel)
{
- LLPointer<LLInventoryCallback> cb =
- new LLBoostFuncInventoryCallback(no_op_inventory_func,
- boost::bind(&LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered,this,folder_id,show_panel));
- updateClothingOrderingInfo(LLUUID::null, cb);
+ LLPointer<LLInventoryCallback> cb =
+ new LLBoostFuncInventoryCallback(no_op_inventory_func,
+ boost::bind(&LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered,this,folder_id,show_panel));
+ updateClothingOrderingInfo(LLUUID::null, cb);
}
void LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered(const LLUUID& folder_id, bool show_panel)
{
- LLPointer<LLInventoryCallback> cb =
- new LLBoostFuncInventoryCallback(no_op_inventory_func,
- boost::bind(show_created_outfit,folder_id,show_panel));
- bool copy_folder_links = false;
- slamCategoryLinks(getCOF(), folder_id, copy_folder_links, cb);
+ LLPointer<LLInventoryCallback> cb =
+ new LLBoostFuncInventoryCallback(no_op_inventory_func,
+ boost::bind(show_created_outfit,folder_id,show_panel));
+ bool copy_folder_links = false;
+ slamCategoryLinks(getCOF(), folder_id, copy_folder_links, cb);
}
void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, bool show_panel)
{
- if (!isAgentAvatarValid()) return;
+ if (!isAgentAvatarValid()) return;
- LLUIUsage::instance().logCommand("Avatar.CreateNewOutfit");
+ LLUIUsage::instance().logCommand("Avatar.CreateNewOutfit");
- LL_DEBUGS("Avatar") << "creating new outfit" << LL_ENDL;
+ LL_DEBUGS("Avatar") << "creating new outfit" << LL_ENDL;
- gAgentWearables.notifyLoadingStarted();
+ gAgentWearables.notifyLoadingStarted();
- // First, make a folder in the My Outfits directory.
- const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+ // First, make a folder in the My Outfits directory.
+ const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
gInventory.createNewCategory(
parent_id,
@@ -4124,218 +4124,218 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo
void LLAppearanceMgr::wearBaseOutfit()
{
- const LLUUID& base_outfit_id = getBaseOutfitUUID();
- if (base_outfit_id.isNull()) return;
-
- updateCOF(base_outfit_id);
+ const LLUUID& base_outfit_id = getBaseOutfitUUID();
+ if (base_outfit_id.isNull()) return;
+
+ updateCOF(base_outfit_id);
}
void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove)
{
- LL_DEBUGS("UIUsage") << "removeItemsFromAvatar" << LL_ENDL;
- LLUIUsage::instance().logCommand("Avatar.RemoveItem");
-
- if (ids_to_remove.empty())
- {
- LL_WARNS() << "called with empty list, nothing to do" << LL_ENDL;
- return;
- }
- LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
- for (uuid_vec_t::const_iterator it = ids_to_remove.begin(); it != ids_to_remove.end(); ++it)
- {
- const LLUUID& id_to_remove = *it;
- const LLUUID& linked_item_id = gInventory.getLinkedItemID(id_to_remove);
- LLViewerInventoryItem *item = gInventory.getItem(linked_item_id);
- if (item && item->getType() == LLAssetType::AT_OBJECT)
- {
- LL_DEBUGS("Avatar") << "ATT removing attachment " << item->getName() << " id " << item->getUUID() << LL_ENDL;
- }
- if (item && item->getType() == LLAssetType::AT_BODYPART)
- {
- continue;
- }
- removeCOFItemLinks(linked_item_id, cb);
- addDoomedTempAttachment(linked_item_id);
- }
+ LL_DEBUGS("UIUsage") << "removeItemsFromAvatar" << LL_ENDL;
+ LLUIUsage::instance().logCommand("Avatar.RemoveItem");
+
+ if (ids_to_remove.empty())
+ {
+ LL_WARNS() << "called with empty list, nothing to do" << LL_ENDL;
+ return;
+ }
+ LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
+ for (uuid_vec_t::const_iterator it = ids_to_remove.begin(); it != ids_to_remove.end(); ++it)
+ {
+ const LLUUID& id_to_remove = *it;
+ const LLUUID& linked_item_id = gInventory.getLinkedItemID(id_to_remove);
+ LLViewerInventoryItem *item = gInventory.getItem(linked_item_id);
+ if (item && item->getType() == LLAssetType::AT_OBJECT)
+ {
+ LL_DEBUGS("Avatar") << "ATT removing attachment " << item->getName() << " id " << item->getUUID() << LL_ENDL;
+ }
+ if (item && item->getType() == LLAssetType::AT_BODYPART)
+ {
+ continue;
+ }
+ removeCOFItemLinks(linked_item_id, cb);
+ addDoomedTempAttachment(linked_item_id);
+ }
}
void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove)
{
- uuid_vec_t ids_to_remove;
- ids_to_remove.push_back(id_to_remove);
- removeItemsFromAvatar(ids_to_remove);
+ uuid_vec_t ids_to_remove;
+ ids_to_remove.push_back(id_to_remove);
+ removeItemsFromAvatar(ids_to_remove);
}
// Adds the given item ID to mDoomedTempAttachmentIDs iff it's a temp attachment
void LLAppearanceMgr::addDoomedTempAttachment(const LLUUID& id_to_remove)
{
- LLViewerObject * attachmentp = gAgentAvatarp->findAttachmentByID(id_to_remove);
- if (attachmentp &&
- attachmentp->isTempAttachment())
- { // If this is a temp attachment and we want to remove it, record the ID
- // so it will be deleted when attachments are synced up with COF
- mDoomedTempAttachmentIDs.insert(id_to_remove);
- //LL_INFOS() << "Will remove temp attachment id " << id_to_remove << LL_ENDL;
- }
+ LLViewerObject * attachmentp = gAgentAvatarp->findAttachmentByID(id_to_remove);
+ if (attachmentp &&
+ attachmentp->isTempAttachment())
+ { // If this is a temp attachment and we want to remove it, record the ID
+ // so it will be deleted when attachments are synced up with COF
+ mDoomedTempAttachmentIDs.insert(id_to_remove);
+ //LL_INFOS() << "Will remove temp attachment id " << id_to_remove << LL_ENDL;
+ }
}
// Find AND REMOVES the given UUID from mDoomedTempAttachmentIDs
bool LLAppearanceMgr::shouldRemoveTempAttachment(const LLUUID& item_id)
{
- doomed_temp_attachments_t::iterator iter = mDoomedTempAttachmentIDs.find(item_id);
- if (iter != mDoomedTempAttachmentIDs.end())
- {
- mDoomedTempAttachmentIDs.erase(iter);
- return true;
- }
- return false;
+ doomed_temp_attachments_t::iterator iter = mDoomedTempAttachmentIDs.find(item_id);
+ if (iter != mDoomedTempAttachmentIDs.end())
+ {
+ mDoomedTempAttachmentIDs.erase(iter);
+ return true;
+ }
+ return false;
}
bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_body)
{
- if (!item || !item->isWearableType()) return false;
- if (item->getType() != LLAssetType::AT_CLOTHING) return false;
- if (!gInventory.isObjectDescendentOf(item->getUUID(), getCOF())) return false;
+ if (!item || !item->isWearableType()) return false;
+ if (item->getType() != LLAssetType::AT_CLOTHING) return false;
+ if (!gInventory.isObjectDescendentOf(item->getUUID(), getCOF())) return false;
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFindWearablesOfType filter_wearables_of_type(item->getWearableType());
- gInventory.collectDescendentsIf(getCOF(), cats, items, true, filter_wearables_of_type);
- if (items.empty()) return false;
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearablesOfType filter_wearables_of_type(item->getWearableType());
+ gInventory.collectDescendentsIf(getCOF(), cats, items, true, filter_wearables_of_type);
+ if (items.empty()) return false;
- // We assume that the items have valid descriptions.
- std::sort(items.begin(), items.end(), WearablesOrderComparator(item->getWearableType()));
+ // We assume that the items have valid descriptions.
+ std::sort(items.begin(), items.end(), WearablesOrderComparator(item->getWearableType()));
- if (closer_to_body && items.front() == item) return false;
- if (!closer_to_body && items.back() == item) return false;
-
- LLInventoryModel::item_array_t::iterator it = std::find(items.begin(), items.end(), item);
- if (items.end() == it) return false;
+ if (closer_to_body && items.front() == item) return false;
+ if (!closer_to_body && items.back() == item) return false;
+ LLInventoryModel::item_array_t::iterator it = std::find(items.begin(), items.end(), item);
+ if (items.end() == it) return false;
- //swapping descriptions
- closer_to_body ? --it : ++it;
- LLViewerInventoryItem* swap_item = *it;
- if (!swap_item) return false;
- std::string tmp = swap_item->getActualDescription();
- swap_item->setDescription(item->getActualDescription());
- item->setDescription(tmp);
- // LL_DEBUGS("Inventory") << "swap, item "
- // << ll_pretty_print_sd(item->asLLSD())
- // << " swap_item "
- // << ll_pretty_print_sd(swap_item->asLLSD()) << LL_ENDL;
+ //swapping descriptions
+ closer_to_body ? --it : ++it;
+ LLViewerInventoryItem* swap_item = *it;
+ if (!swap_item) return false;
+ std::string tmp = swap_item->getActualDescription();
+ swap_item->setDescription(item->getActualDescription());
+ item->setDescription(tmp);
- // FIXME switch to use AISv3 where supported.
- //items need to be updated on a dataserver
- item->setComplete(TRUE);
- item->updateServer(FALSE);
- gInventory.updateItem(item);
+ // LL_DEBUGS("Inventory") << "swap, item "
+ // << ll_pretty_print_sd(item->asLLSD())
+ // << " swap_item "
+ // << ll_pretty_print_sd(swap_item->asLLSD()) << LL_ENDL;
- swap_item->setComplete(TRUE);
- swap_item->updateServer(FALSE);
- gInventory.updateItem(swap_item);
+ // FIXME switch to use AISv3 where supported.
+ //items need to be updated on a dataserver
+ item->setComplete(TRUE);
+ item->updateServer(FALSE);
+ gInventory.updateItem(item);
- //to cause appearance of the agent to be updated
- bool result = false;
- if ((result = gAgentWearables.moveWearable(item, closer_to_body)))
- {
- gAgentAvatarp->wearableUpdated(item->getWearableType());
- }
+ swap_item->setComplete(TRUE);
+ swap_item->updateServer(FALSE);
+ gInventory.updateItem(swap_item);
+
+ //to cause appearance of the agent to be updated
+ bool result = false;
+ if ((result = gAgentWearables.moveWearable(item, closer_to_body)))
+ {
+ gAgentAvatarp->wearableUpdated(item->getWearableType());
+ }
- setOutfitDirty(true);
+ setOutfitDirty(true);
- //*TODO do we need to notify observers here in such a way?
- gInventory.notifyObservers();
+ //*TODO do we need to notify observers here in such a way?
+ gInventory.notifyObservers();
- return result;
+ return result;
}
//static
void LLAppearanceMgr::sortItemsByActualDescription(LLInventoryModel::item_array_t& items)
{
- if (items.size() < 2) return;
+ if (items.size() < 2) return;
- std::sort(items.begin(), items.end(), sort_by_actual_description);
+ std::sort(items.begin(), items.end(), sort_by_actual_description);
}
//#define DUMP_CAT_VERBOSE
void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg)
{
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH);
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendents(cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH);
#ifdef DUMP_CAT_VERBOSE
- LL_INFOS() << LL_ENDL;
- LL_INFOS() << str << LL_ENDL;
- S32 hitcount = 0;
- for(S32 i=0; i<items.size(); i++)
- {
- LLViewerInventoryItem *item = items.get(i);
- if (item)
- hitcount++;
- LL_INFOS() << i <<" "<< item->getName() <<LL_ENDL;
- }
+ LL_INFOS() << LL_ENDL;
+ LL_INFOS() << str << LL_ENDL;
+ S32 hitcount = 0;
+ for(S32 i=0; i<items.size(); i++)
+ {
+ LLViewerInventoryItem *item = items.get(i);
+ if (item)
+ hitcount++;
+ LL_INFOS() << i <<" "<< item->getName() <<LL_ENDL;
+ }
#endif
- LL_INFOS() << msg << " count " << items.size() << LL_ENDL;
+ LL_INFOS() << msg << " count " << items.size() << LL_ENDL;
}
void LLAppearanceMgr::dumpItemArray(const LLInventoryModel::item_array_t& items,
- const std::string& msg)
+ const std::string& msg)
{
- for (S32 i=0; i<items.size(); i++)
- {
- LLViewerInventoryItem *item = items.at(i);
- LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
- LLUUID asset_id;
- if (linked_item)
- {
- asset_id = linked_item->getAssetUUID();
- }
- LL_DEBUGS("Avatar") << self_av_string() << msg << " " << i <<" " << (item ? item->getName() : "(nullitem)") << " " << asset_id.asString() << LL_ENDL;
- }
+ for (S32 i=0; i<items.size(); i++)
+ {
+ LLViewerInventoryItem *item = items.at(i);
+ LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
+ LLUUID asset_id;
+ if (linked_item)
+ {
+ asset_id = linked_item->getAssetUUID();
+ }
+ LL_DEBUGS("Avatar") << self_av_string() << msg << " " << i <<" " << (item ? item->getName() : "(nullitem)") << " " << asset_id.asString() << LL_ENDL;
+ }
}
bool LLAppearanceMgr::mActive = true;
LLAppearanceMgr::LLAppearanceMgr():
- mAttachmentInvLinkEnabled(false),
- mOutfitIsDirty(false),
- mOutfitLocked(false),
- mInFlightTimer(),
- mIsInUpdateAppearanceFromCOF(false),
+ mAttachmentInvLinkEnabled(false),
+ mOutfitIsDirty(false),
+ mOutfitLocked(false),
+ mInFlightTimer(),
+ mIsInUpdateAppearanceFromCOF(false),
mOutstandingAppearanceBakeRequest(false),
mRerequestAppearanceBake(false)
{
- LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
- // unlock outfit on save operation completed
- outfit_observer.addCOFSavedCallback(boost::bind(
- &LLAppearanceMgr::setOutfitLocked, this, false));
+ LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
+ // unlock outfit on save operation completed
+ outfit_observer.addCOFSavedCallback(boost::bind(
+ &LLAppearanceMgr::setOutfitLocked, this, false));
- mUnlockOutfitTimer.reset(new LLOutfitUnLockTimer(gSavedSettings.getS32(
- "OutfitOperationsTimeout")));
+ mUnlockOutfitTimer.reset(new LLOutfitUnLockTimer(gSavedSettings.getS32(
+ "OutfitOperationsTimeout")));
- gIdleCallbacks.addFunction(&LLAttachmentsMgr::onIdle, NULL);
- gIdleCallbacks.addFunction(&LLAppearanceMgr::onIdle, NULL); //sheduling appearance update requests
+ gIdleCallbacks.addFunction(&LLAttachmentsMgr::onIdle, NULL);
+ gIdleCallbacks.addFunction(&LLAppearanceMgr::onIdle, NULL); //sheduling appearance update requests
}
LLAppearanceMgr::~LLAppearanceMgr()
{
- mActive = false;
+ mActive = false;
}
void LLAppearanceMgr::setAttachmentInvLinkEnable(bool val)
{
- LL_DEBUGS("Avatar") << "setAttachmentInvLinkEnable => " << (int) val << LL_ENDL;
- mAttachmentInvLinkEnabled = val;
+ LL_DEBUGS("Avatar") << "setAttachmentInvLinkEnable => " << (int) val << LL_ENDL;
+ mAttachmentInvLinkEnabled = val;
}
boost::signals2::connection LLAppearanceMgr::setAttachmentsChangedCallback(attachments_changed_callback_t cb)
{
- return mAttachmentsChangeSignal.connect(cb);
+ return mAttachmentsChangeSignal.connect(cb);
}
void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg)
@@ -4357,101 +4357,101 @@ void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg)
void LLAppearanceMgr::registerAttachment(const LLUUID& item_id)
{
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_DEBUGS("Avatar") << "ATT registering attachment "
- << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
- gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << "ATT registering attachment "
+ << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
- LLAttachmentsMgr::instance().onAttachmentArrived(item_id);
+ LLAttachmentsMgr::instance().onAttachmentArrived(item_id);
- mAttachmentsChangeSignal();
+ mAttachmentsChangeSignal();
}
void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id)
{
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_DEBUGS("Avatar") << "ATT unregistering attachment "
- << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
- gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << "ATT unregistering attachment "
+ << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
LLAttachmentsMgr::instance().onDetachCompleted(item_id);
- if (mAttachmentInvLinkEnabled && isLinkedInCOF(item_id))
- {
- LL_DEBUGS("Avatar") << "ATT removing COF link for attachment "
- << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
- LLAppearanceMgr::removeCOFItemLinks(item_id);
- }
- else
- {
- //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL;
- }
+ if (mAttachmentInvLinkEnabled && isLinkedInCOF(item_id))
+ {
+ LL_DEBUGS("Avatar") << "ATT removing COF link for attachment "
+ << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
+ LLAppearanceMgr::removeCOFItemLinks(item_id);
+ }
+ else
+ {
+ //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL;
+ }
- mAttachmentsChangeSignal();
+ mAttachmentsChangeSignal();
}
BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const
{
- const LLUUID& cof = getCOF();
- if (obj_id == cof)
- return TRUE;
- const LLInventoryObject* obj = gInventory.getObject(obj_id);
- if (obj && obj->getParentUUID() == cof)
- return TRUE;
- return FALSE;
+ const LLUUID& cof = getCOF();
+ if (obj_id == cof)
+ return TRUE;
+ const LLInventoryObject* obj = gInventory.getObject(obj_id);
+ if (obj && obj->getParentUUID() == cof)
+ return TRUE;
+ return FALSE;
}
BOOL LLAppearanceMgr::getIsProtectedCOFItem(const LLUUID& obj_id) const
{
- if (!getIsInCOF(obj_id)) return FALSE;
+ if (!getIsInCOF(obj_id)) return FALSE;
- // If a non-link somehow ended up in COF, allow deletion.
- const LLInventoryObject *obj = gInventory.getObject(obj_id);
- if (obj && !obj->getIsLinkType())
- {
- return FALSE;
- }
+ // If a non-link somehow ended up in COF, allow deletion.
+ const LLInventoryObject *obj = gInventory.getObject(obj_id);
+ if (obj && !obj->getIsLinkType())
+ {
+ return FALSE;
+ }
- // For now, don't allow direct deletion from the COF. Instead, force users
- // to choose "Detach" or "Take Off".
- return TRUE;
+ // For now, don't allow direct deletion from the COF. Instead, force users
+ // to choose "Detach" or "Take Off".
+ return TRUE;
}
class CallAfterCategoryFetchStage2: public LLInventoryFetchItemsObserver
{
public:
- CallAfterCategoryFetchStage2(const uuid_vec_t& ids,
- nullary_func_t callable) :
- LLInventoryFetchItemsObserver(ids),
- mCallable(callable)
- {
- }
- ~CallAfterCategoryFetchStage2()
- {
- }
- virtual void done()
- {
- LL_INFOS() << this << " done with incomplete " << mIncomplete.size()
- << " complete " << mComplete.size() << " calling callable" << LL_ENDL;
-
- gInventory.removeObserver(this);
- doOnIdleOneTime(mCallable);
- delete this;
- }
+ CallAfterCategoryFetchStage2(const uuid_vec_t& ids,
+ nullary_func_t callable) :
+ LLInventoryFetchItemsObserver(ids),
+ mCallable(callable)
+ {
+ }
+ ~CallAfterCategoryFetchStage2()
+ {
+ }
+ virtual void done()
+ {
+ LL_INFOS() << this << " done with incomplete " << mIncomplete.size()
+ << " complete " << mComplete.size() << " calling callable" << LL_ENDL;
+
+ gInventory.removeObserver(this);
+ doOnIdleOneTime(mCallable);
+ delete this;
+ }
protected:
- nullary_func_t mCallable;
+ nullary_func_t mCallable;
};
class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver
{
public:
- CallAfterCategoryFetchStage1(const LLUUID& cat_id, nullary_func_t callable) :
- LLInventoryFetchDescendentsObserver(cat_id),
- mCallable(callable)
- {
- }
- ~CallAfterCategoryFetchStage1()
- {
- }
+ CallAfterCategoryFetchStage1(const LLUUID& cat_id, nullary_func_t callable) :
+ LLInventoryFetchDescendentsObserver(cat_id),
+ mCallable(callable)
+ {
+ }
+ ~CallAfterCategoryFetchStage1()
+ {
+ }
/*virtual*/ void startFetch()
{
bool ais3 = AISAPI::isAvailable();
@@ -4466,8 +4466,8 @@ public:
// as result fetch won't start and folder will potentially get stuck as
// incomplete in observer.
// Likely either both should use only version or both should check descendants.
- cat->fetch(); //blindly fetch it without seeing if anything else is fetching it.
- mIncomplete.push_back(*it); //Add to list of things being downloaded for this observer.
+ cat->fetch(); //blindly fetch it without seeing if anything else is fetching it.
+ mIncomplete.push_back(*it); //Add to list of things being downloaded for this observer.
}
else if (!isCategoryComplete(cat))
{
@@ -4519,8 +4519,8 @@ public:
}
}
}
- virtual void done()
- {
+ virtual void done()
+ {
if (mComplete.size() <= 0)
{
// Ex: timeout
@@ -4532,54 +4532,54 @@ public:
return;
}
- // What we do here is get the complete information on the
- // items in the requested category, and set up an observer
- // that will wait for that to happen.
+ // What we do here is get the complete information on the
+ // items in the requested category, and set up an observer
+ // that will wait for that to happen.
LLInventoryModel::cat_array_t* cats;
LLInventoryModel::item_array_t* items;
gInventory.getDirectDescendentsOf(mComplete.front(), cats, items);
- S32 count = items->size();
- if(!count)
- {
- LL_WARNS() << "Nothing fetched in category " << mComplete.front()
- << LL_ENDL;
- gInventory.removeObserver(this);
- doOnIdleOneTime(mCallable);
+ S32 count = items->size();
+ if(!count)
+ {
+ LL_WARNS() << "Nothing fetched in category " << mComplete.front()
+ << LL_ENDL;
+ gInventory.removeObserver(this);
+ doOnIdleOneTime(mCallable);
- delete this;
- return;
- }
+ delete this;
+ return;
+ }
LLViewerInventoryCategory* cat = gInventory.getCategory(mComplete.front());
S32 version = cat ? cat->getVersion() : -2;
- LL_INFOS() << "stage1, category " << mComplete.front() << " got " << count << " items, version " << version << " passing to stage2 " << LL_ENDL;
- uuid_vec_t ids;
- for(S32 i = 0; i < count; ++i)
- {
- ids.push_back(items->at(i)->getUUID());
- }
-
- gInventory.removeObserver(this);
-
- // do the fetch
- CallAfterCategoryFetchStage2 *stage2 = new CallAfterCategoryFetchStage2(ids, mCallable);
- stage2->startFetch();
- if(stage2->isFinished())
- {
- // everything is already here - call done.
- stage2->done();
- }
- else
- {
- // it's all on it's way - add an observer, and the inventory
- // will call done for us when everything is here.
- gInventory.addObserver(stage2);
- }
- delete this;
- }
+ LL_INFOS() << "stage1, category " << mComplete.front() << " got " << count << " items, version " << version << " passing to stage2 " << LL_ENDL;
+ uuid_vec_t ids;
+ for(S32 i = 0; i < count; ++i)
+ {
+ ids.push_back(items->at(i)->getUUID());
+ }
+
+ gInventory.removeObserver(this);
+
+ // do the fetch
+ CallAfterCategoryFetchStage2 *stage2 = new CallAfterCategoryFetchStage2(ids, mCallable);
+ stage2->startFetch();
+ if(stage2->isFinished())
+ {
+ // everything is already here - call done.
+ stage2->done();
+ }
+ else
+ {
+ // it's all on it's way - add an observer, and the inventory
+ // will call done for us when everything is here.
+ gInventory.addObserver(stage2);
+ }
+ delete this;
+ }
protected:
- nullary_func_t mCallable;
+ nullary_func_t mCallable;
};
void callAfterCOFFetch(nullary_func_t cb)
@@ -4629,7 +4629,7 @@ void callAfterCategoryLinksFetch(const LLUUID &cat_id, nullary_func_t cb)
LL_WARNS() << "AIS API v3 not available, can't use AISAPI::FetchCOF" << LL_ENDL;
callAfterCategoryFetch(cat_id, cb);
}
-
+
}
void add_wearable_type_counts(const uuid_vec_t& ids,
@@ -4681,7 +4681,7 @@ void wear_multiple(const uuid_vec_t& ids, bool replace)
{
cb = new LLUpdateAppearanceOnDestroy;
}
- LLAppearanceMgr::instance().wearItemsOnAvatar(ids, true, replace, cb);
+ LLAppearanceMgr::instance().wearItemsOnAvatar(ids, true, replace, cb);
}
// SLapp for easy-wearing of a stock (library) avatar
@@ -4689,50 +4689,50 @@ void wear_multiple(const uuid_vec_t& ids, bool replace)
class LLWearFolderHandler : public LLCommandHandler
{
public:
- // not allowed from outside the app
- LLWearFolderHandler() : LLCommandHandler("wear_folder", UNTRUSTED_BLOCK) { }
+ // not allowed from outside the app
+ LLWearFolderHandler() : LLCommandHandler("wear_folder", UNTRUSTED_BLOCK) { }
- bool handle(const LLSD& tokens,
+ bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- LLSD::UUID folder_uuid;
-
- if (folder_uuid.isNull() && query_map.has("folder_name"))
- {
- std::string outfit_folder_name = query_map["folder_name"];
- folder_uuid = findDescendentCategoryIDByName(
- gInventory.getLibraryRootFolderID(),
- outfit_folder_name);
- }
- if (folder_uuid.isNull() && query_map.has("folder_id"))
- {
- folder_uuid = query_map["folder_id"].asUUID();
- }
-
- if (folder_uuid.notNull())
- {
- LLPointer<LLInventoryCategory> category = new LLInventoryCategory(folder_uuid,
- LLUUID::null,
- LLFolderType::FT_CLOTHING,
- "Quick Appearance");
- if ( gInventory.getCategory( folder_uuid ) != NULL )
- {
- // Assume this is coming from the predefined avatars web floater
- LLUIUsage::instance().logCommand("Avatar.WearPredefinedAppearance");
- LLAppearanceMgr::getInstance()->wearInventoryCategory(category, true, false);
-
- // *TODOw: This may not be necessary if initial outfit is chosen already -- josh
- gAgent.setOutfitChosen(TRUE);
- }
- }
-
- // release avatar picker keyboard focus
- gFocusMgr.setKeyboardFocus( NULL );
-
- return true;
- }
+ {
+ LLSD::UUID folder_uuid;
+
+ if (folder_uuid.isNull() && query_map.has("folder_name"))
+ {
+ std::string outfit_folder_name = query_map["folder_name"];
+ folder_uuid = findDescendentCategoryIDByName(
+ gInventory.getLibraryRootFolderID(),
+ outfit_folder_name);
+ }
+ if (folder_uuid.isNull() && query_map.has("folder_id"))
+ {
+ folder_uuid = query_map["folder_id"].asUUID();
+ }
+
+ if (folder_uuid.notNull())
+ {
+ LLPointer<LLInventoryCategory> category = new LLInventoryCategory(folder_uuid,
+ LLUUID::null,
+ LLFolderType::FT_CLOTHING,
+ "Quick Appearance");
+ if ( gInventory.getCategory( folder_uuid ) != NULL )
+ {
+ // Assume this is coming from the predefined avatars web floater
+ LLUIUsage::instance().logCommand("Avatar.WearPredefinedAppearance");
+ LLAppearanceMgr::getInstance()->wearInventoryCategory(category, true, false);
+
+ // *TODOw: This may not be necessary if initial outfit is chosen already -- josh
+ gAgent.setOutfitChosen(TRUE);
+ }
+ }
+
+ // release avatar picker keyboard focus
+ gFocusMgr.setKeyboardFocus( NULL );
+
+ return true;
+ }
};
LLWearFolderHandler gWearFolderHandler;
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index da29ceee3a..ae23022513 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llappearancemgr.h
* @brief Manager for initiating appearance changes on the viewer
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,198 +43,198 @@ class LLOutfitUnLockTimer;
class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
{
- LLSINGLETON(LLAppearanceMgr);
- ~LLAppearanceMgr();
- LOG_CLASS(LLAppearanceMgr);
+ LLSINGLETON(LLAppearanceMgr);
+ ~LLAppearanceMgr();
+ LOG_CLASS(LLAppearanceMgr);
+
+ friend class LLOutfitUnLockTimer;
- friend class LLOutfitUnLockTimer;
-
public:
- typedef std::vector<LLInventoryModel::item_array_t> wearables_by_type_t;
-
- void updateAppearanceFromCOF(bool enforce_item_restrictions = true,
- bool enforce_ordering = true,
- nullary_func_t post_update_func = no_op);
- void updateCOF(const LLUUID& category, bool append = false);
- void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append);
- void wearInventoryCategoryOnAvatar(LLInventoryCategory* category, bool append);
- void wearCategoryFinal(const LLUUID& cat_id, bool copy_items, bool append);
- void wearOutfitByName(const std::string& name);
- void changeOutfit(bool proceed, const LLUUID& category, bool append);
- void replaceCurrentOutfit(const LLUUID& new_outfit);
- void renameOutfit(const LLUUID& outfit_id);
- void removeOutfitPhoto(const LLUUID& outfit_id);
- void takeOffOutfit(const LLUUID& cat_id);
- void addCategoryToCurrentOutfit(const LLUUID& cat_id);
- S32 findExcessOrDuplicateItems(const LLUUID& cat_id,
- LLAssetType::EType type,
- S32 max_items_per_type,
- S32 max_items_total,
- LLInventoryObject::object_list_t& items_to_kill);
- void findAllExcessOrDuplicateItems(const LLUUID& cat_id,
- LLInventoryObject::object_list_t& items_to_kill);
- void enforceCOFItemRestrictions(LLPointer<LLInventoryCallback> cb);
-
- S32 getActiveCopyOperations() const;
-
- // Replace category contents with copied links via the slam_inventory_folder
- // command (single inventory operation where supported)
- void slamCategoryLinks(const LLUUID& src_id, const LLUUID& dst_id,
- bool include_folder_links, LLPointer<LLInventoryCallback> cb);
-
- // Copy all items and the src category itself.
- void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
- LLPointer<LLInventoryCallback> cb);
-
- // Return whether this folder contains minimal contents suitable for making a full outfit.
- BOOL getCanMakeFolderIntoOutfit(const LLUUID& folder_id);
-
- // Determine whether a given outfit can be removed.
- bool getCanRemoveOutfit(const LLUUID& outfit_cat_id);
-
- // Determine whether we're wearing any of the outfit contents (excluding body parts).
- static bool getCanRemoveFromCOF(const LLUUID& outfit_cat_id);
-
- // Determine whether we can add anything (but body parts) from the outfit contents to COF.
- static bool getCanAddToCOF(const LLUUID& outfit_cat_id);
-
- // Determine whether we can replace current outfit with the given one.
- bool getCanReplaceCOF(const LLUUID& outfit_cat_id);
+ typedef std::vector<LLInventoryModel::item_array_t> wearables_by_type_t;
+
+ void updateAppearanceFromCOF(bool enforce_item_restrictions = true,
+ bool enforce_ordering = true,
+ nullary_func_t post_update_func = no_op);
+ void updateCOF(const LLUUID& category, bool append = false);
+ void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append);
+ void wearInventoryCategoryOnAvatar(LLInventoryCategory* category, bool append);
+ void wearCategoryFinal(const LLUUID& cat_id, bool copy_items, bool append);
+ void wearOutfitByName(const std::string& name);
+ void changeOutfit(bool proceed, const LLUUID& category, bool append);
+ void replaceCurrentOutfit(const LLUUID& new_outfit);
+ void renameOutfit(const LLUUID& outfit_id);
+ void removeOutfitPhoto(const LLUUID& outfit_id);
+ void takeOffOutfit(const LLUUID& cat_id);
+ void addCategoryToCurrentOutfit(const LLUUID& cat_id);
+ S32 findExcessOrDuplicateItems(const LLUUID& cat_id,
+ LLAssetType::EType type,
+ S32 max_items_per_type,
+ S32 max_items_total,
+ LLInventoryObject::object_list_t& items_to_kill);
+ void findAllExcessOrDuplicateItems(const LLUUID& cat_id,
+ LLInventoryObject::object_list_t& items_to_kill);
+ void enforceCOFItemRestrictions(LLPointer<LLInventoryCallback> cb);
+
+ S32 getActiveCopyOperations() const;
+
+ // Replace category contents with copied links via the slam_inventory_folder
+ // command (single inventory operation where supported)
+ void slamCategoryLinks(const LLUUID& src_id, const LLUUID& dst_id,
+ bool include_folder_links, LLPointer<LLInventoryCallback> cb);
+
+ // Copy all items and the src category itself.
+ void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
+ LLPointer<LLInventoryCallback> cb);
+
+ // Return whether this folder contains minimal contents suitable for making a full outfit.
+ BOOL getCanMakeFolderIntoOutfit(const LLUUID& folder_id);
+
+ // Determine whether a given outfit can be removed.
+ bool getCanRemoveOutfit(const LLUUID& outfit_cat_id);
+
+ // Determine whether we're wearing any of the outfit contents (excluding body parts).
+ static bool getCanRemoveFromCOF(const LLUUID& outfit_cat_id);
+
+ // Determine whether we can add anything (but body parts) from the outfit contents to COF.
+ static bool getCanAddToCOF(const LLUUID& outfit_cat_id);
+
+ // Determine whether we can replace current outfit with the given one.
+ bool getCanReplaceCOF(const LLUUID& outfit_cat_id);
// Can we add all referenced items to the avatar?
bool canAddWearables(const uuid_vec_t& item_ids) const;
-
- // Copy all items in a category.
- void shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id,
- LLPointer<LLInventoryCallback> cb);
- // Find the Current Outfit folder.
- const LLUUID getCOF() const;
- S32 getCOFVersion() const;
+ // Copy all items in a category.
+ void shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id,
+ LLPointer<LLInventoryCallback> cb);
+
+ // Find the Current Outfit folder.
+ const LLUUID getCOF() const;
+ S32 getCOFVersion() const;
- // Debugging - get truncated LLSD summary of COF contents.
- LLSD dumpCOF() const;
+ // Debugging - get truncated LLSD summary of COF contents.
+ LLSD dumpCOF() const;
- // Finds the folder link to the currently worn outfit
- const LLViewerInventoryItem *getBaseOutfitLink();
- bool getBaseOutfitName(std::string &name);
+ // Finds the folder link to the currently worn outfit
+ const LLViewerInventoryItem *getBaseOutfitLink();
+ bool getBaseOutfitName(std::string &name);
- // find the UUID of the currently worn outfit (Base Outfit)
- const LLUUID getBaseOutfitUUID();
+ // find the UUID of the currently worn outfit (Base Outfit)
+ const LLUUID getBaseOutfitUUID();
void wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
bool do_update,
bool replace,
LLPointer<LLInventoryCallback> cb = NULL);
- // Wear/attach an item (from a user's inventory) on the agent
- void wearItemOnAvatar(const LLUUID& item_to_wear, bool do_update, bool replace = false,
- LLPointer<LLInventoryCallback> cb = NULL);
+ // Wear/attach an item (from a user's inventory) on the agent
+ void wearItemOnAvatar(const LLUUID& item_to_wear, bool do_update, bool replace = false,
+ LLPointer<LLInventoryCallback> cb = NULL);
- // Update the displayed outfit name in UI.
- void updatePanelOutfitName(const std::string& name);
+ // Update the displayed outfit name in UI.
+ void updatePanelOutfitName(const std::string& name);
- void purgeBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> cb = NULL);
- void createBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> link_waiter);
+ void purgeBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> cb = NULL);
+ void createBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> link_waiter);
- void updateAgentWearables(LLWearableHoldingPattern* holder);
+ void updateAgentWearables(LLWearableHoldingPattern* holder);
- S32 countActiveHoldingPatterns();
+ S32 countActiveHoldingPatterns();
- // For debugging - could be moved elsewhere.
- void dumpCat(const LLUUID& cat_id, const std::string& msg);
- void dumpItemArray(const LLInventoryModel::item_array_t& items, const std::string& msg);
+ // For debugging - could be moved elsewhere.
+ void dumpCat(const LLUUID& cat_id, const std::string& msg);
+ void dumpItemArray(const LLInventoryModel::item_array_t& items, const std::string& msg);
- // Attachment link management
- void unregisterAttachment(const LLUUID& item_id);
- void registerAttachment(const LLUUID& item_id);
- void setAttachmentInvLinkEnable(bool val);
+ // Attachment link management
+ void unregisterAttachment(const LLUUID& item_id);
+ void registerAttachment(const LLUUID& item_id);
+ void setAttachmentInvLinkEnable(bool val);
- // Add COF link to individual item.
- void addCOFItemLink(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb = NULL, const std::string description = "");
- void addCOFItemLink(const LLInventoryItem *item, LLPointer<LLInventoryCallback> cb = NULL, const std::string description = "");
+ // Add COF link to individual item.
+ void addCOFItemLink(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb = NULL, const std::string description = "");
+ void addCOFItemLink(const LLInventoryItem *item, LLPointer<LLInventoryCallback> cb = NULL, const std::string description = "");
- // Find COF entries referencing the given item.
- LLInventoryModel::item_array_t findCOFItemLinks(const LLUUID& item_id);
- bool isLinkedInCOF(const LLUUID& item_id);
+ // Find COF entries referencing the given item.
+ LLInventoryModel::item_array_t findCOFItemLinks(const LLUUID& item_id);
+ bool isLinkedInCOF(const LLUUID& item_id);
- // Remove COF entries
- void removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb = NULL);
- void removeCOFLinksOfType(LLWearableType::EType type, LLPointer<LLInventoryCallback> cb = NULL);
- void removeAllClothesFromAvatar();
- void removeAllAttachmentsFromAvatar();
+ // Remove COF entries
+ void removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb = NULL);
+ void removeCOFLinksOfType(LLWearableType::EType type, LLPointer<LLInventoryCallback> cb = NULL);
+ void removeAllClothesFromAvatar();
+ void removeAllAttachmentsFromAvatar();
- // Special handling of temp attachments, which are not in the COF
- bool shouldRemoveTempAttachment(const LLUUID& item_id);
+ // Special handling of temp attachments, which are not in the COF
+ bool shouldRemoveTempAttachment(const LLUUID& item_id);
- //has the current outfit changed since it was loaded?
- bool isOutfitDirty() { return mOutfitIsDirty; }
+ //has the current outfit changed since it was loaded?
+ bool isOutfitDirty() { return mOutfitIsDirty; }
- // set false if you just loaded the outfit, true otherwise
- void setOutfitDirty(bool isDirty) { mOutfitIsDirty = isDirty; }
-
- // manually compare ouftit folder link to COF to see if outfit has changed.
- // should only be necessary to do on initial login.
- void updateIsDirty();
+ // set false if you just loaded the outfit, true otherwise
+ void setOutfitDirty(bool isDirty) { mOutfitIsDirty = isDirty; }
- void setOutfitLocked(bool locked);
+ // manually compare ouftit folder link to COF to see if outfit has changed.
+ // should only be necessary to do on initial login.
+ void updateIsDirty();
- // Called when self avatar is first fully visible.
- void onFirstFullyVisible();
+ void setOutfitLocked(bool locked);
- // Copy initial gestures from library.
- void copyLibraryGestures();
-
- void wearBaseOutfit();
+ // Called when self avatar is first fully visible.
+ void onFirstFullyVisible();
- void setOutfitImage(const LLUUID& image_id) {mCOFImageID = image_id;}
- LLUUID getOutfitImage() {return mCOFImageID;}
+ // Copy initial gestures from library.
+ void copyLibraryGestures();
- // Overrides the base outfit with the content from COF
- // @return false if there is no base outfit
- bool updateBaseOutfit();
+ void wearBaseOutfit();
- //Remove clothing or detach an object from the agent (a bodypart cannot be removed)
- void removeItemsFromAvatar(const uuid_vec_t& item_ids);
- void removeItemFromAvatar(const LLUUID& item_id);
+ void setOutfitImage(const LLUUID& image_id) {mCOFImageID = image_id;}
+ LLUUID getOutfitImage() {return mCOFImageID;}
+ // Overrides the base outfit with the content from COF
+ // @return false if there is no base outfit
+ bool updateBaseOutfit();
- void onOutfitFolderCreated(const LLUUID& folder_id, bool show_panel);
- void onOutfitFolderCreatedAndClothingOrdered(const LLUUID& folder_id, bool show_panel);
+ //Remove clothing or detach an object from the agent (a bodypart cannot be removed)
+ void removeItemsFromAvatar(const uuid_vec_t& item_ids);
+ void removeItemFromAvatar(const LLUUID& item_id);
- void makeNewOutfitLinks(const std::string& new_folder_name,bool show_panel = true);
- bool moveWearable(LLViewerInventoryItem* item, bool closer_to_body);
+ void onOutfitFolderCreated(const LLUUID& folder_id, bool show_panel);
+ void onOutfitFolderCreatedAndClothingOrdered(const LLUUID& folder_id, bool show_panel);
- static void sortItemsByActualDescription(LLInventoryModel::item_array_t& items);
+ void makeNewOutfitLinks(const std::string& new_folder_name,bool show_panel = true);
- //Divvy items into arrays by wearable type
- static void divvyWearablesByType(const LLInventoryModel::item_array_t& items, wearables_by_type_t& items_by_type);
+ bool moveWearable(LLViewerInventoryItem* item, bool closer_to_body);
- typedef std::map<LLUUID,std::string> desc_map_t;
+ static void sortItemsByActualDescription(LLInventoryModel::item_array_t& items);
- void getWearableOrderingDescUpdates(LLInventoryModel::item_array_t& wear_items, desc_map_t& desc_map);
+ //Divvy items into arrays by wearable type
+ static void divvyWearablesByType(const LLInventoryModel::item_array_t& items, wearables_by_type_t& items_by_type);
- //Check ordering information on wearables stored in links' descriptions and update if it is invalid
- // COF is processed if cat_id is not specified
- bool validateClothingOrderingInfo(LLUUID cat_id = LLUUID::null);
-
- void updateClothingOrderingInfo(LLUUID cat_id = LLUUID::null,
- LLPointer<LLInventoryCallback> cb = NULL);
+ typedef std::map<LLUUID,std::string> desc_map_t;
- bool isOutfitLocked() { return mOutfitLocked; }
+ void getWearableOrderingDescUpdates(LLInventoryModel::item_array_t& wear_items, desc_map_t& desc_map);
- bool isInUpdateAppearanceFromCOF() { return mIsInUpdateAppearanceFromCOF; }
+ //Check ordering information on wearables stored in links' descriptions and update if it is invalid
+ // COF is processed if cat_id is not specified
+ bool validateClothingOrderingInfo(LLUUID cat_id = LLUUID::null);
- static void onIdle(void *);
- void requestServerAppearanceUpdate();
+ void updateClothingOrderingInfo(LLUUID cat_id = LLUUID::null,
+ LLPointer<LLInventoryCallback> cb = NULL);
- void setAppearanceServiceURL(const std::string& url) { mAppearanceServiceURL = url; }
- std::string getAppearanceServiceURL() const;
+ bool isOutfitLocked() { return mOutfitLocked; }
- typedef boost::function<void ()> attachments_changed_callback_t;
- typedef boost::signals2::signal<void ()> attachments_changed_signal_t;
- boost::signals2::connection setAttachmentsChangedCallback(attachments_changed_callback_t cb);
+ bool isInUpdateAppearanceFromCOF() { return mIsInUpdateAppearanceFromCOF; }
+
+ static void onIdle(void *);
+ void requestServerAppearanceUpdate();
+
+ void setAppearanceServiceURL(const std::string& url) { mAppearanceServiceURL = url; }
+ std::string getAppearanceServiceURL() const;
+
+ typedef boost::function<void ()> attachments_changed_callback_t;
+ typedef boost::signals2::signal<void ()> attachments_changed_signal_t;
+ boost::signals2::connection setAttachmentsChangedCallback(attachments_changed_callback_t cb);
private:
@@ -242,97 +242,97 @@ private:
static void debugAppearanceUpdateCOF(const LLSD& content);
- std::string mAppearanceServiceURL;
+ std::string mAppearanceServiceURL;
private:
- void filterWearableItems(LLInventoryModel::item_array_t& items, S32 max_per_type, S32 max_total);
-
- void getDescendentsOfAssetType(const LLUUID& category,
- LLInventoryModel::item_array_t& items,
- LLAssetType::EType type);
+ void filterWearableItems(LLInventoryModel::item_array_t& items, S32 max_per_type, S32 max_total);
- void getUserDescendents(const LLUUID& category,
- LLInventoryModel::item_array_t& wear_items,
- LLInventoryModel::item_array_t& obj_items,
- LLInventoryModel::item_array_t& gest_items);
+ void getDescendentsOfAssetType(const LLUUID& category,
+ LLInventoryModel::item_array_t& items,
+ LLAssetType::EType type);
- static void onOutfitRename(const LLSD& notification, const LLSD& response);
+ void getUserDescendents(const LLUUID& category,
+ LLInventoryModel::item_array_t& wear_items,
+ LLInventoryModel::item_array_t& obj_items,
+ LLInventoryModel::item_array_t& gest_items);
- bool mAttachmentInvLinkEnabled;
- bool mOutfitIsDirty;
- bool mIsInUpdateAppearanceFromCOF; // to detect recursive calls.
+ static void onOutfitRename(const LLSD& notification, const LLSD& response);
+
+ bool mAttachmentInvLinkEnabled;
+ bool mOutfitIsDirty;
+ bool mIsInUpdateAppearanceFromCOF; // to detect recursive calls.
bool mOutstandingAppearanceBakeRequest; // A bake request is outstanding. Do not overlap.
bool mRerequestAppearanceBake;
- /**
- * Lock for blocking operations on outfit until server reply or timeout exceed
- * to avoid unsynchronized outfit state or performing duplicate operations.
- */
- bool mOutfitLocked;
- LLTimer mInFlightTimer;
- static bool mActive;
+ /**
+ * Lock for blocking operations on outfit until server reply or timeout exceed
+ * to avoid unsynchronized outfit state or performing duplicate operations.
+ */
+ bool mOutfitLocked;
+ LLTimer mInFlightTimer;
+ static bool mActive;
+
+ attachments_changed_signal_t mAttachmentsChangeSignal;
- attachments_changed_signal_t mAttachmentsChangeSignal;
-
- LLUUID mCOFImageID;
+ LLUUID mCOFImageID;
- std::unique_ptr<LLOutfitUnLockTimer> mUnlockOutfitTimer;
+ std::unique_ptr<LLOutfitUnLockTimer> mUnlockOutfitTimer;
- // Set of temp attachment UUIDs that should be removed
- typedef std::set<LLUUID> doomed_temp_attachments_t;
- doomed_temp_attachments_t mDoomedTempAttachmentIDs;
+ // Set of temp attachment UUIDs that should be removed
+ typedef std::set<LLUUID> doomed_temp_attachments_t;
+ doomed_temp_attachments_t mDoomedTempAttachmentIDs;
- void addDoomedTempAttachment(const LLUUID& id_to_remove);
+ void addDoomedTempAttachment(const LLUUID& id_to_remove);
- //////////////////////////////////////////////////////////////////////////////////
- // Item-specific convenience functions
+ //////////////////////////////////////////////////////////////////////////////////
+ // Item-specific convenience functions
public:
- // Is this in the COF?
- BOOL getIsInCOF(const LLUUID& obj_id) const;
- // Is this in the COF and can the user delete it from the COF?
- BOOL getIsProtectedCOFItem(const LLUUID& obj_id) const;
+ // Is this in the COF?
+ BOOL getIsInCOF(const LLUUID& obj_id) const;
+ // Is this in the COF and can the user delete it from the COF?
+ BOOL getIsProtectedCOFItem(const LLUUID& obj_id) const;
- // Outfits will prioritize textures with such name to use for preview in gallery
- static const std::string sExpectedTextureName;
+ // Outfits will prioritize textures with such name to use for preview in gallery
+ static const std::string sExpectedTextureName;
};
class LLUpdateAppearanceOnDestroy: public LLInventoryCallback
{
public:
- LLUpdateAppearanceOnDestroy(bool enforce_item_restrictions = true,
- bool enforce_ordering = true,
- nullary_func_t post_update_func = no_op);
- virtual ~LLUpdateAppearanceOnDestroy();
- /* virtual */ void fire(const LLUUID& inv_item);
+ LLUpdateAppearanceOnDestroy(bool enforce_item_restrictions = true,
+ bool enforce_ordering = true,
+ nullary_func_t post_update_func = no_op);
+ virtual ~LLUpdateAppearanceOnDestroy();
+ /* virtual */ void fire(const LLUUID& inv_item);
private:
- U32 mFireCount;
- bool mEnforceItemRestrictions;
- bool mEnforceOrdering;
- nullary_func_t mPostUpdateFunc;
+ U32 mFireCount;
+ bool mEnforceItemRestrictions;
+ bool mEnforceOrdering;
+ nullary_func_t mPostUpdateFunc;
};
class LLUpdateAppearanceAndEditWearableOnDestroy: public LLInventoryCallback
{
public:
- LLUpdateAppearanceAndEditWearableOnDestroy(const LLUUID& item_id);
+ LLUpdateAppearanceAndEditWearableOnDestroy(const LLUUID& item_id);
+
+ /* virtual */ void fire(const LLUUID& item_id) {}
- /* virtual */ void fire(const LLUUID& item_id) {}
+ ~LLUpdateAppearanceAndEditWearableOnDestroy();
- ~LLUpdateAppearanceAndEditWearableOnDestroy();
-
private:
- LLUUID mItemID;
+ LLUUID mItemID;
};
class LLRequestServerAppearanceUpdateOnDestroy: public LLInventoryCallback
{
public:
- LLRequestServerAppearanceUpdateOnDestroy() {}
- ~LLRequestServerAppearanceUpdateOnDestroy();
+ LLRequestServerAppearanceUpdateOnDestroy() {}
+ ~LLRequestServerAppearanceUpdateOnDestroy();
- /* virtual */ void fire(const LLUUID& item_id) {}
+ /* virtual */ void fire(const LLUUID& item_id) {}
};
LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string& name);
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index d6a4c41497..754ee5aa23 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -108,7 +108,7 @@
#include "llscenemonitor.h"
#include "llavatarrenderinfoaccountant.h"
#include "lllocalbitmaps.h"
-#include "llperfstats.h"
+#include "llperfstats.h"
#include "llgltfmateriallist.h"
// Linden library includes
@@ -148,7 +148,7 @@
#include <boost/throw_exception.hpp>
#if LL_WINDOWS
-# include <share.h> // For _SH_DENYWR in processMarkerFiles
+# include <share.h> // For _SH_DENYWR in processMarkerFiles
#else
# include <sys/file.h> // For processMarkerFiles
#endif
@@ -316,16 +316,16 @@ const char* gPlatform = LL_PLATFORM_KEY;
LLSD gDebugInfo;
-U32 gFrameCount = 0;
+U32 gFrameCount = 0;
U32 gForegroundFrameCount = 0; // number of frames that app window was in foreground
LLPumpIO* gServicePump = NULL;
U64MicrosecondsImplicit gFrameTime = 0;
F32SecondsImplicit gFrameTimeSeconds = 0.f;
F32SecondsImplicit gFrameIntervalSeconds = 0.f;
-F32 gFPSClamped = 10.f; // Pretend we start at target rate.
-F32 gFrameDTClamped = 0.f; // Time between adjacent checks to network for packets
-U64MicrosecondsImplicit gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds
+F32 gFPSClamped = 10.f; // Pretend we start at target rate.
+F32 gFrameDTClamped = 0.f; // Time between adjacent checks to network for packets
+U64MicrosecondsImplicit gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds
LLTimer gRenderStartTime;
LLFrameTimer gForegroundTime;
@@ -338,24 +338,24 @@ F32 gLogoutMaxTime = LOGOUT_REQUEST_TIME;
S32 gPendingMetricsUploads = 0;
-BOOL gDisconnected = FALSE;
+BOOL gDisconnected = FALSE;
// used to restore texture state after a mode switch
-LLFrameTimer gRestoreGLTimer;
-BOOL gRestoreGL = FALSE;
-bool gUseWireframe = FALSE;
+LLFrameTimer gRestoreGLTimer;
+BOOL gRestoreGL = FALSE;
+bool gUseWireframe = FALSE;
LLMemoryInfo gSysMemory;
U64Bytes gMemoryAllocated(0); // updated in display_stats() in llviewerdisplay.cpp
std::string gLastVersionChannel;
-LLVector3 gWindVec(3.0, 3.0, 0.0);
-LLVector3 gRelativeWindVec(0.0, 0.0, 0.0);
+LLVector3 gWindVec(3.0, 3.0, 0.0);
+LLVector3 gRelativeWindVec(0.0, 0.0, 0.0);
-U32 gPacketsIn = 0;
+U32 gPacketsIn = 0;
-BOOL gPrintMessagesThisFrame = FALSE;
+BOOL gPrintMessagesThisFrame = FALSE;
BOOL gRandomizeFramerate = FALSE;
BOOL gPeriodicSlowFrame = FALSE;
@@ -390,53 +390,53 @@ const char* const VIEWER_WINDOW_CLASSNAME = "Second Life";
static std::set<std::string> default_trans_args;
void init_default_trans_args()
{
- default_trans_args.insert("SECOND_LIFE"); // World
- default_trans_args.insert("APP_NAME");
- default_trans_args.insert("CAPITALIZED_APP_NAME");
- default_trans_args.insert("SECOND_LIFE_GRID");
- default_trans_args.insert("SUPPORT_SITE");
- // This URL shows up in a surprising number of places in various skin
- // files. We really only want to have to maintain a single copy of it.
- default_trans_args.insert("create_account_url");
+ default_trans_args.insert("SECOND_LIFE"); // World
+ default_trans_args.insert("APP_NAME");
+ default_trans_args.insert("CAPITALIZED_APP_NAME");
+ default_trans_args.insert("SECOND_LIFE_GRID");
+ default_trans_args.insert("SUPPORT_SITE");
+ // This URL shows up in a surprising number of places in various skin
+ // files. We really only want to have to maintain a single copy of it.
+ default_trans_args.insert("create_account_url");
}
struct SettingsFile : public LLInitParam::Block<SettingsFile>
{
- Mandatory<std::string> name;
- Optional<std::string> file_name;
- Optional<bool> required,
- persistent;
- Optional<std::string> file_name_setting;
-
- SettingsFile()
- : name("name"),
- file_name("file_name"),
- required("required", false),
- persistent("persistent", true),
- file_name_setting("file_name_setting")
- {}
+ Mandatory<std::string> name;
+ Optional<std::string> file_name;
+ Optional<bool> required,
+ persistent;
+ Optional<std::string> file_name_setting;
+
+ SettingsFile()
+ : name("name"),
+ file_name("file_name"),
+ required("required", false),
+ persistent("persistent", true),
+ file_name_setting("file_name_setting")
+ {}
};
struct SettingsGroup : public LLInitParam::Block<SettingsGroup>
{
- Mandatory<std::string> name;
- Mandatory<S32> path_index;
- Multiple<SettingsFile> files;
-
- SettingsGroup()
- : name("name"),
- path_index("path_index"),
- files("file")
- {}
+ Mandatory<std::string> name;
+ Mandatory<S32> path_index;
+ Multiple<SettingsFile> files;
+
+ SettingsGroup()
+ : name("name"),
+ path_index("path_index"),
+ files("file")
+ {}
};
struct SettingsFiles : public LLInitParam::Block<SettingsFiles>
{
- Multiple<SettingsGroup> groups;
+ Multiple<SettingsGroup> groups;
- SettingsFiles()
- : groups("group")
- {}
+ SettingsFiles()
+ : groups("group")
+ {}
};
static std::string gWindowTitle;
@@ -451,122 +451,122 @@ static bool app_metrics_qa_mode = false;
void idle_afk_check()
{
- // check idle timers
- F32 current_idle = gAwayTriggerTimer.getElapsedTimeF32();
- F32 afk_timeout = gSavedSettings.getS32("AFKTimeout");
- if (afk_timeout && (current_idle > afk_timeout) && ! gAgent.getAFK())
- {
- LL_INFOS("IdleAway") << "Idle more than " << afk_timeout << " seconds: automatically changing to Away status" << LL_ENDL;
- gAgent.setAFK();
- }
+ // check idle timers
+ F32 current_idle = gAwayTriggerTimer.getElapsedTimeF32();
+ F32 afk_timeout = gSavedSettings.getS32("AFKTimeout");
+ if (afk_timeout && (current_idle > afk_timeout) && ! gAgent.getAFK())
+ {
+ LL_INFOS("IdleAway") << "Idle more than " << afk_timeout << " seconds: automatically changing to Away status" << LL_ENDL;
+ gAgent.setAFK();
+ }
}
// A callback set in LLAppViewer::init()
static void ui_audio_callback(const LLUUID& uuid)
{
- if (gAudiop)
- {
- SoundData soundData(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
- gAudiop->triggerSound(soundData);
- }
+ if (gAudiop)
+ {
+ SoundData soundData(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
+ gAudiop->triggerSound(soundData);
+ }
}
// A callback set in LLAppViewer::init()
static void deferred_ui_audio_callback(const LLUUID& uuid)
{
- if (gAudiop)
- {
- SoundData soundData(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
- LLDeferredSounds::instance().deferSound(soundData);
- }
+ if (gAudiop)
+ {
+ SoundData soundData(uuid, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
+ LLDeferredSounds::instance().deferSound(soundData);
+ }
}
-bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base)
+bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base)
{
- if(!match || !base || base->getPlainText())
- return false;
-
- LLUUID match_id = match->getID();
-
- LLIconCtrl* icon;
-
- if( match->getMenuName() == "menu_url_group.xml" // See LLUrlEntryGroup constructor
- || gAgent.isInGroup(match_id, TRUE)) //This check seems unfiting, urls are either /agent or /group
- {
- LLGroupIconCtrl::Params icon_params;
- icon_params.group_id = match_id;
- icon_params.rect = LLRect(0, 16, 16, 0);
- icon_params.visible = true;
- icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params);
- }
- else
- {
- LLAvatarIconCtrl::Params icon_params;
- icon_params.avatar_id = match_id;
- icon_params.rect = LLRect(0, 16, 16, 0);
- icon_params.visible = true;
- icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params);
- }
-
- LLInlineViewSegment::Params params;
- params.force_newline = false;
- params.view = icon;
- params.left_pad = 4;
- params.right_pad = 4;
- params.top_pad = -2;
- params.bottom_pad = 2;
-
- base->appendWidget(params," ",false);
-
- return true;
+ if(!match || !base || base->getPlainText())
+ return false;
+
+ LLUUID match_id = match->getID();
+
+ LLIconCtrl* icon;
+
+ if( match->getMenuName() == "menu_url_group.xml" // See LLUrlEntryGroup constructor
+ || gAgent.isInGroup(match_id, TRUE)) //This check seems unfiting, urls are either /agent or /group
+ {
+ LLGroupIconCtrl::Params icon_params;
+ icon_params.group_id = match_id;
+ icon_params.rect = LLRect(0, 16, 16, 0);
+ icon_params.visible = true;
+ icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params);
+ }
+ else
+ {
+ LLAvatarIconCtrl::Params icon_params;
+ icon_params.avatar_id = match_id;
+ icon_params.rect = LLRect(0, 16, 16, 0);
+ icon_params.visible = true;
+ icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params);
+ }
+
+ LLInlineViewSegment::Params params;
+ params.force_newline = false;
+ params.view = icon;
+ params.left_pad = 4;
+ params.right_pad = 4;
+ params.top_pad = -2;
+ params.bottom_pad = 2;
+
+ base->appendWidget(params," ",false);
+
+ return true;
}
// Use these strictly for things that are constructed at startup,
// or for things that are performance critical. JC
static void settings_to_globals()
{
- LLBUTTON_H_PAD = gSavedSettings.getS32("ButtonHPad");
- BTN_HEIGHT_SMALL = gSavedSettings.getS32("ButtonHeightSmall");
- BTN_HEIGHT = gSavedSettings.getS32("ButtonHeight");
+ LLBUTTON_H_PAD = gSavedSettings.getS32("ButtonHPad");
+ BTN_HEIGHT_SMALL = gSavedSettings.getS32("ButtonHeightSmall");
+ BTN_HEIGHT = gSavedSettings.getS32("ButtonHeight");
- MENU_BAR_HEIGHT = gSavedSettings.getS32("MenuBarHeight");
- MENU_BAR_WIDTH = gSavedSettings.getS32("MenuBarWidth");
+ MENU_BAR_HEIGHT = gSavedSettings.getS32("MenuBarHeight");
+ MENU_BAR_WIDTH = gSavedSettings.getS32("MenuBarWidth");
- LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize"));
+ LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize"));
#if LL_DARWIN
LLRender::sGLCoreProfile = true;
#else
LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLContextCoreProfile");
#endif
- LLRender::sNsightDebugSupport = gSavedSettings.getBOOL("RenderNsightDebugSupport");
- LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic");
- LLImageGL::sCompressTextures = gSavedSettings.getBOOL("RenderCompressTextures");
- LLVOVolume::sLODFactor = llclamp(gSavedSettings.getF32("RenderVolumeLODFactor"), 0.01f, MAX_LOD_FACTOR);
- LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
- LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor");
- LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor");
- LLVOAvatar::sLODFactor = llclamp(gSavedSettings.getF32("RenderAvatarLODFactor"), 0.f, MAX_AVATAR_LOD_FACTOR);
- LLVOAvatar::sPhysicsLODFactor = llclamp(gSavedSettings.getF32("RenderAvatarPhysicsLODFactor"), 0.f, MAX_AVATAR_LOD_FACTOR);
- LLVOAvatar::updateImpostorRendering(gSavedSettings.getU32("RenderAvatarMaxNonImpostors"));
- LLVOAvatar::sVisibleInFirstPerson = gSavedSettings.getBOOL("FirstPersonAvatarVisible");
- // clamp auto-open time to some minimum usable value
- LLFolderView::sAutoOpenTime = llmax(0.25f, gSavedSettings.getF32("FolderAutoOpenDelay"));
- LLSelectMgr::sRectSelectInclusive = gSavedSettings.getBOOL("RectangleSelectInclusive");
- LLSelectMgr::sRenderHiddenSelections = gSavedSettings.getBOOL("RenderHiddenSelections");
- LLSelectMgr::sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius");
-
- gAgentPilot.setNumRuns(gSavedSettings.getS32("StatsNumRuns"));
- gAgentPilot.setQuitAfterRuns(gSavedSettings.getBOOL("StatsQuitAfterRuns"));
- gAgent.setHideGroupTitle(gSavedSettings.getBOOL("RenderHideGroupTitle"));
-
- gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc");
- gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates");
+ LLRender::sNsightDebugSupport = gSavedSettings.getBOOL("RenderNsightDebugSupport");
+ LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic");
+ LLImageGL::sCompressTextures = gSavedSettings.getBOOL("RenderCompressTextures");
+ LLVOVolume::sLODFactor = llclamp(gSavedSettings.getF32("RenderVolumeLODFactor"), 0.01f, MAX_LOD_FACTOR);
+ LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
+ LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor");
+ LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor");
+ LLVOAvatar::sLODFactor = llclamp(gSavedSettings.getF32("RenderAvatarLODFactor"), 0.f, MAX_AVATAR_LOD_FACTOR);
+ LLVOAvatar::sPhysicsLODFactor = llclamp(gSavedSettings.getF32("RenderAvatarPhysicsLODFactor"), 0.f, MAX_AVATAR_LOD_FACTOR);
+ LLVOAvatar::updateImpostorRendering(gSavedSettings.getU32("RenderAvatarMaxNonImpostors"));
+ LLVOAvatar::sVisibleInFirstPerson = gSavedSettings.getBOOL("FirstPersonAvatarVisible");
+ // clamp auto-open time to some minimum usable value
+ LLFolderView::sAutoOpenTime = llmax(0.25f, gSavedSettings.getF32("FolderAutoOpenDelay"));
+ LLSelectMgr::sRectSelectInclusive = gSavedSettings.getBOOL("RectangleSelectInclusive");
+ LLSelectMgr::sRenderHiddenSelections = gSavedSettings.getBOOL("RenderHiddenSelections");
+ LLSelectMgr::sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius");
+
+ gAgentPilot.setNumRuns(gSavedSettings.getS32("StatsNumRuns"));
+ gAgentPilot.setQuitAfterRuns(gSavedSettings.getBOOL("StatsQuitAfterRuns"));
+ gAgent.setHideGroupTitle(gSavedSettings.getBOOL("RenderHideGroupTitle"));
+
+ gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc");
+ gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates");
LLWorldMapView::setScaleSetting(gSavedSettings.getF32("MapScale"));
-
+
#if LL_DARWIN
LLWindowMacOSX::sUseMultGL = gSavedSettings.getBOOL("RenderAppleUseMultGL");
- gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI");
+ gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI");
#endif
}
@@ -584,41 +584,41 @@ static void settings_modify()
class LLFastTimerLogThread : public LLThread
{
public:
- std::string mFile;
-
- LLFastTimerLogThread(std::string& test_name) : LLThread("fast timer log")
- {
- std::string file_name = test_name + std::string(".slp");
- mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, file_name);
- }
-
- void run()
- {
- llofstream os(mFile.c_str());
-
- while (!LLAppViewer::instance()->isQuitting())
- {
- LLTrace::BlockTimer::writeLog(os);
- os.flush();
- ms_sleep(32);
- }
-
- os.close();
- }
+ std::string mFile;
+
+ LLFastTimerLogThread(std::string& test_name) : LLThread("fast timer log")
+ {
+ std::string file_name = test_name + std::string(".slp");
+ mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, file_name);
+ }
+
+ void run()
+ {
+ llofstream os(mFile.c_str());
+
+ while (!LLAppViewer::instance()->isQuitting())
+ {
+ LLTrace::BlockTimer::writeLog(os);
+ os.flush();
+ ms_sleep(32);
+ }
+
+ os.close();
+ }
};
//virtual
bool LLAppViewer::initSLURLHandler()
{
- // does nothing unless subclassed
- return false;
+ // does nothing unless subclassed
+ return false;
}
//virtual
bool LLAppViewer::sendURLToOtherInstance(const std::string& url)
{
- // does nothing unless subclassed
- return false;
+ // does nothing unless subclassed
+ return false;
}
//----------------------------------------------------------------------------
@@ -634,402 +634,402 @@ LLPurgeDiskCacheThread* LLAppViewer::sPurgeDiskCacheThread = NULL;
std::string getRuntime()
{
- return llformat("%.4f", (F32)LLTimer::getElapsedSeconds().value());
+ return llformat("%.4f", (F32)LLTimer::getElapsedSeconds().value());
}
LLAppViewer::LLAppViewer()
-: mMarkerFile(),
- mLogoutMarkerFile(),
- mReportedCrash(false),
- mNumSessions(0),
+: mMarkerFile(),
+ mLogoutMarkerFile(),
+ mReportedCrash(false),
+ mNumSessions(0),
mGeneralThreadPool(nullptr),
- mPurgeCache(false),
- mPurgeCacheOnExit(false),
- mPurgeUserDataOnExit(false),
- mSecondInstance(false),
- mUpdaterNotFound(false),
- mSavedFinalSnapshot(false),
- mSavePerAccountSettings(false), // don't save settings on logout unless login succeeded.
- mQuitRequested(false),
- mLogoutRequestSent(false),
- mLastAgentControlFlags(0),
- mLastAgentForceUpdate(0),
- mMainloopTimeout(NULL),
- mAgentRegionLastAlive(false),
- mRandomizeFramerate(LLCachedControl<bool>(gSavedSettings,"Randomize Framerate", FALSE)),
- mPeriodicSlowFrame(LLCachedControl<bool>(gSavedSettings,"Periodic Slow Frame", FALSE)),
- mFastTimerLogThread(NULL),
- mSettingsLocationList(NULL),
- mIsFirstRun(false)
+ mPurgeCache(false),
+ mPurgeCacheOnExit(false),
+ mPurgeUserDataOnExit(false),
+ mSecondInstance(false),
+ mUpdaterNotFound(false),
+ mSavedFinalSnapshot(false),
+ mSavePerAccountSettings(false), // don't save settings on logout unless login succeeded.
+ mQuitRequested(false),
+ mLogoutRequestSent(false),
+ mLastAgentControlFlags(0),
+ mLastAgentForceUpdate(0),
+ mMainloopTimeout(NULL),
+ mAgentRegionLastAlive(false),
+ mRandomizeFramerate(LLCachedControl<bool>(gSavedSettings,"Randomize Framerate", FALSE)),
+ mPeriodicSlowFrame(LLCachedControl<bool>(gSavedSettings,"Periodic Slow Frame", FALSE)),
+ mFastTimerLogThread(NULL),
+ mSettingsLocationList(NULL),
+ mIsFirstRun(false)
{
- if(NULL != sInstance)
- {
- LL_ERRS() << "Oh no! An instance of LLAppViewer already exists! LLAppViewer is sort of like a singleton." << LL_ENDL;
- }
+ if(NULL != sInstance)
+ {
+ LL_ERRS() << "Oh no! An instance of LLAppViewer already exists! LLAppViewer is sort of like a singleton." << LL_ENDL;
+ }
mDumpPath ="";
- // Need to do this initialization before we do anything else, since anything
- // that touches files should really go through the lldir API
- gDirUtilp->initAppDirs("SecondLife");
- //
- // IMPORTANT! Do NOT put anything that will write
- // into the log files during normal startup until AFTER
- // we run the "program crashed last time" error handler below.
- //
- sInstance = this;
-
- gLoggedInTime.stop();
-
- processMarkerFiles();
- //
- // OK to write stuff to logs now, we've now crash reported if necessary
- //
-
- LLLoginInstance::instance().setPlatformInfo(gPlatform, LLOSInfo::instance().getOSVersionString(), LLOSInfo::instance().getOSStringSimple());
-
- // Under some circumstances we want to read the static_debug_info.log file
- // from the previous viewer run between this constructor call and the
- // init() call, which will overwrite the static_debug_info.log file for
- // THIS run. So setDebugFileNames() early.
+ // Need to do this initialization before we do anything else, since anything
+ // that touches files should really go through the lldir API
+ gDirUtilp->initAppDirs("SecondLife");
+ //
+ // IMPORTANT! Do NOT put anything that will write
+ // into the log files during normal startup until AFTER
+ // we run the "program crashed last time" error handler below.
+ //
+ sInstance = this;
+
+ gLoggedInTime.stop();
+
+ processMarkerFiles();
+ //
+ // OK to write stuff to logs now, we've now crash reported if necessary
+ //
+
+ LLLoginInstance::instance().setPlatformInfo(gPlatform, LLOSInfo::instance().getOSVersionString(), LLOSInfo::instance().getOSStringSimple());
+
+ // Under some circumstances we want to read the static_debug_info.log file
+ // from the previous viewer run between this constructor call and the
+ // init() call, which will overwrite the static_debug_info.log file for
+ // THIS run. So setDebugFileNames() early.
# ifdef LL_BUGSPLAT
- // MAINT-8917: don't create a dump directory just for the
- // static_debug_info.log file
- std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
+ // MAINT-8917: don't create a dump directory just for the
+ // static_debug_info.log file
+ std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
# else // ! LL_BUGSPLAT
- // write Google Breakpad minidump files to a per-run dump directory to avoid multiple viewer issues.
- std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "");
+ // write Google Breakpad minidump files to a per-run dump directory to avoid multiple viewer issues.
+ std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "");
# endif // ! LL_BUGSPLAT
- mDumpPath = logdir;
+ mDumpPath = logdir;
- setDebugFileNames(logdir);
+ setDebugFileNames(logdir);
}
LLAppViewer::~LLAppViewer()
{
- delete mSettingsLocationList;
+ delete mSettingsLocationList;
- destroyMainloopTimeout();
+ destroyMainloopTimeout();
- // If we got to this destructor somehow, the app didn't hang.
- removeMarkerFiles();
+ // If we got to this destructor somehow, the app didn't hang.
+ removeMarkerFiles();
}
class LLUITranslationBridge : public LLTranslationBridge
{
public:
- virtual std::string getString(const std::string &xml_desc)
- {
- return LLTrans::getString(xml_desc);
- }
+ virtual std::string getString(const std::string &xml_desc)
+ {
+ return LLTrans::getString(xml_desc);
+ }
};
bool LLAppViewer::init()
{
- setupErrorHandling(mSecondInstance);
+ setupErrorHandling(mSecondInstance);
- //
- // Start of the application
- //
+ //
+ // Start of the application
+ //
// initialize the LLSettingsType translation bridge.
LLTranslationBridge::ptr_t trans = std::make_shared<LLUITranslationBridge>();
LLSettingsType::initParamSingleton(trans);
- // initialize SSE options
- LLVector4a::initClass();
+ // initialize SSE options
+ LLVector4a::initClass();
- //initialize particle index pool
- LLVOPartGroup::initClass();
+ //initialize particle index pool
+ LLVOPartGroup::initClass();
- // set skin search path to default, will be overridden later
- // this allows simple skinned file lookups to work
- gDirUtilp->setSkinFolder("default", "en");
+ // set skin search path to default, will be overridden later
+ // this allows simple skinned file lookups to work
+ gDirUtilp->setSkinFolder("default", "en");
-// initLoggingAndGetLastDuration();
+// initLoggingAndGetLastDuration();
- //
- // OK to write stuff to logs now, we've now crash reported if necessary
- //
- init_default_trans_args();
+ //
+ // OK to write stuff to logs now, we've now crash reported if necessary
+ //
+ init_default_trans_args();
// inits from settings.xml and from strings.xml
- if (!initConfiguration())
- return false;
+ if (!initConfiguration())
+ return false;
- LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ;
+ LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ;
- //set the max heap size.
- initMaxHeapSize() ;
- LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize"));
+ //set the max heap size.
+ initMaxHeapSize() ;
+ LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize"));
- // Although initLoggingAndGetLastDuration() is the right place to mess with
- // setFatalFunction(), we can't query gSavedSettings until after
- // initConfiguration().
- S32 rc(gSavedSettings.getS32("QAModeTermCode"));
- if (rc >= 0)
- {
- // QAModeTermCode set, terminate with that rc on LL_ERRS. Use
- // _exit() rather than exit() because normal cleanup depends too
- // much on successful startup!
- LLError::setFatalFunction([rc](const std::string&){ _exit(rc); });
- }
+ // Although initLoggingAndGetLastDuration() is the right place to mess with
+ // setFatalFunction(), we can't query gSavedSettings until after
+ // initConfiguration().
+ S32 rc(gSavedSettings.getS32("QAModeTermCode"));
+ if (rc >= 0)
+ {
+ // QAModeTermCode set, terminate with that rc on LL_ERRS. Use
+ // _exit() rather than exit() because normal cleanup depends too
+ // much on successful startup!
+ LLError::setFatalFunction([rc](const std::string&){ _exit(rc); });
+ }
mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling"));
- // Initialize the non-LLCurl libcurl library. Should be called
- // before consumers (LLTextureFetch).
- mAppCoreHttp.init();
+ // Initialize the non-LLCurl libcurl library. Should be called
+ // before consumers (LLTextureFetch).
+ mAppCoreHttp.init();
- LL_INFOS("InitInfo") << "LLCore::Http initialized." << LL_ENDL ;
+ LL_INFOS("InitInfo") << "LLCore::Http initialized." << LL_ENDL ;
LLMachineID::init();
- {
- if (gSavedSettings.getBOOL("QAModeMetrics"))
- {
- app_metrics_qa_mode = true;
- app_metrics_interval = METRICS_INTERVAL_QA;
- }
- LLViewerAssetStatsFF::init();
- }
-
- initThreads();
- LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ;
-
- // Initialize settings early so that the defaults for ignorable dialogs are
- // picked up and then correctly re-saved after launching the updater (STORM-1268).
- LLUI::settings_map_t settings_map;
- settings_map["config"] = &gSavedSettings;
- settings_map["ignores"] = &gWarningSettings;
- settings_map["floater"] = &gSavedSettings; // *TODO: New settings file
- settings_map["account"] = &gSavedPerAccountSettings;
-
- LLUI::initParamSingleton(settings_map,
- LLUIImageList::getInstance(),
- ui_audio_callback,
- deferred_ui_audio_callback);
- LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ;
-
- // NOW LLUI::getLanguage() should work. gDirUtilp must know the language
- // for this session ASAP so all the file-loading commands that follow,
- // that use findSkinnedFilenames(), will include the localized files.
- gDirUtilp->setSkinFolder(gDirUtilp->getSkinFolder(), LLUI::getLanguage());
-
- // Setup LLTrans after LLUI::initClass has been called.
- initStrings();
+ {
+ if (gSavedSettings.getBOOL("QAModeMetrics"))
+ {
+ app_metrics_qa_mode = true;
+ app_metrics_interval = METRICS_INTERVAL_QA;
+ }
+ LLViewerAssetStatsFF::init();
+ }
+
+ initThreads();
+ LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ;
+
+ // Initialize settings early so that the defaults for ignorable dialogs are
+ // picked up and then correctly re-saved after launching the updater (STORM-1268).
+ LLUI::settings_map_t settings_map;
+ settings_map["config"] = &gSavedSettings;
+ settings_map["ignores"] = &gWarningSettings;
+ settings_map["floater"] = &gSavedSettings; // *TODO: New settings file
+ settings_map["account"] = &gSavedPerAccountSettings;
+
+ LLUI::initParamSingleton(settings_map,
+ LLUIImageList::getInstance(),
+ ui_audio_callback,
+ deferred_ui_audio_callback);
+ LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ;
+
+ // NOW LLUI::getLanguage() should work. gDirUtilp must know the language
+ // for this session ASAP so all the file-loading commands that follow,
+ // that use findSkinnedFilenames(), will include the localized files.
+ gDirUtilp->setSkinFolder(gDirUtilp->getSkinFolder(), LLUI::getLanguage());
+
+ // Setup LLTrans after LLUI::initClass has been called.
+ initStrings();
// initialize LLWearableType translation bridge.
// Will immediately use LLTranslationBridge to init LLWearableDictionary
LLWearableType::initParamSingleton(trans);
- // Setup notifications after LLUI::initClass() has been called.
- LLNotifications::instance();
- LL_INFOS("InitInfo") << "Notifications initialized." << LL_ENDL ;
+ // Setup notifications after LLUI::initClass() has been called.
+ LLNotifications::instance();
+ LL_INFOS("InitInfo") << "Notifications initialized." << LL_ENDL ;
- //////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
- // *FIX: The following code isn't grouped into functions yet.
+ //////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////////
+ // *FIX: The following code isn't grouped into functions yet.
- //
- // Various introspection concerning the libs we're using - particularly
- // the libs involved in getting to a full login screen.
- //
- LL_INFOS("InitInfo") << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << LL_ENDL;
- LL_INFOS("InitInfo") << "libcurl version is: " << LLCore::LLHttp::getCURLVersion() << LL_ENDL;
+ //
+ // Various introspection concerning the libs we're using - particularly
+ // the libs involved in getting to a full login screen.
+ //
+ LL_INFOS("InitInfo") << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << LL_ENDL;
+ LL_INFOS("InitInfo") << "libcurl version is: " << LLCore::LLHttp::getCURLVersion() << LL_ENDL;
- /////////////////////////////////////////////////
- // OS-specific login dialogs
- /////////////////////////////////////////////////
+ /////////////////////////////////////////////////
+ // OS-specific login dialogs
+ /////////////////////////////////////////////////
- //test_cached_control();
+ //test_cached_control();
- // track number of times that app has run
- mNumSessions = gSavedSettings.getS32("NumSessions");
- mNumSessions++;
- gSavedSettings.setS32("NumSessions", mNumSessions);
+ // track number of times that app has run
+ mNumSessions = gSavedSettings.getS32("NumSessions");
+ mNumSessions++;
+ gSavedSettings.setS32("NumSessions", mNumSessions);
- // LLKeyboard relies on LLUI to know what some accelerator keys are called.
- LLKeyboard::setStringTranslatorFunc( LLTrans::getKeyboardString );
+ // LLKeyboard relies on LLUI to know what some accelerator keys are called.
+ LLKeyboard::setStringTranslatorFunc( LLTrans::getKeyboardString );
- // Provide the text fields with callbacks for opening Urls
- LLUrlAction::setOpenURLCallback(boost::bind(&LLWeb::loadURL, _1, LLStringUtil::null, LLStringUtil::null));
- LLUrlAction::setOpenURLInternalCallback(boost::bind(&LLWeb::loadURLInternal, _1, LLStringUtil::null, LLStringUtil::null, false));
- LLUrlAction::setOpenURLExternalCallback(boost::bind(&LLWeb::loadURLExternal, _1, true, LLStringUtil::null));
- LLUrlAction::setExecuteSLURLCallback(&LLURLDispatcher::dispatchFromTextEditor);
+ // Provide the text fields with callbacks for opening Urls
+ LLUrlAction::setOpenURLCallback(boost::bind(&LLWeb::loadURL, _1, LLStringUtil::null, LLStringUtil::null));
+ LLUrlAction::setOpenURLInternalCallback(boost::bind(&LLWeb::loadURLInternal, _1, LLStringUtil::null, LLStringUtil::null, false));
+ LLUrlAction::setOpenURLExternalCallback(boost::bind(&LLWeb::loadURLExternal, _1, true, LLStringUtil::null));
+ LLUrlAction::setExecuteSLURLCallback(&LLURLDispatcher::dispatchFromTextEditor);
- // Let code in llui access the viewer help floater
- LLUI::getInstance()->mHelpImpl = LLViewerHelp::getInstance();
+ // Let code in llui access the viewer help floater
+ LLUI::getInstance()->mHelpImpl = LLViewerHelp::getInstance();
- LL_INFOS("InitInfo") << "UI initialization is done." << LL_ENDL ;
+ LL_INFOS("InitInfo") << "UI initialization is done." << LL_ENDL ;
- // Load translations for tooltips
- LLFloater::initClass();
- LLUrlFloaterDispatchHandler::registerInDispatcher();
+ // Load translations for tooltips
+ LLFloater::initClass();
+ LLUrlFloaterDispatchHandler::registerInDispatcher();
- /////////////////////////////////////////////////
+ /////////////////////////////////////////////////
- LLToolMgr::getInstance(); // Initialize tool manager if not already instantiated
+ LLToolMgr::getInstance(); // Initialize tool manager if not already instantiated
- LLViewerFloaterReg::registerFloaters();
+ LLViewerFloaterReg::registerFloaters();
- /////////////////////////////////////////////////
- //
- // Load settings files
- //
- //
- LLGroupMgr::parseRoleActions("role_actions.xml");
+ /////////////////////////////////////////////////
+ //
+ // Load settings files
+ //
+ //
+ LLGroupMgr::parseRoleActions("role_actions.xml");
- LLAgent::parseTeleportMessages("teleport_strings.xml");
+ LLAgent::parseTeleportMessages("teleport_strings.xml");
- // load MIME type -> media impl mappings
- std::string mime_types_name;
+ // load MIME type -> media impl mappings
+ std::string mime_types_name;
#if LL_DARWIN
- mime_types_name = "mime_types_mac.xml";
+ mime_types_name = "mime_types_mac.xml";
#elif LL_LINUX
- mime_types_name = "mime_types_linux.xml";
+ mime_types_name = "mime_types_linux.xml";
#else
- mime_types_name = "mime_types.xml";
+ mime_types_name = "mime_types.xml";
#endif
- LLMIMETypes::parseMIMETypes( mime_types_name );
-
- // Copy settings to globals. *TODO: Remove or move to appropriage class initializers
- settings_to_globals();
- // Setup settings listeners
- settings_setup_listeners();
- // Modify settings based on system configuration and compile options
- settings_modify();
-
- // Find partition serial number (Windows) or hardware serial (Mac)
- mSerialNumber = generateSerialNumber();
-
- // do any necessary set-up for accepting incoming SLURLs from apps
- initSLURLHandler();
-
- if(false == initHardwareTest())
- {
- // Early out from user choice.
- return false;
- }
- LL_INFOS("InitInfo") << "Hardware test initialization done." << LL_ENDL ;
-
- // Prepare for out-of-memory situations, during which we will crash on
- // purpose and save a dump.
+ LLMIMETypes::parseMIMETypes( mime_types_name );
+
+ // Copy settings to globals. *TODO: Remove or move to appropriage class initializers
+ settings_to_globals();
+ // Setup settings listeners
+ settings_setup_listeners();
+ // Modify settings based on system configuration and compile options
+ settings_modify();
+
+ // Find partition serial number (Windows) or hardware serial (Mac)
+ mSerialNumber = generateSerialNumber();
+
+ // do any necessary set-up for accepting incoming SLURLs from apps
+ initSLURLHandler();
+
+ if(false == initHardwareTest())
+ {
+ // Early out from user choice.
+ return false;
+ }
+ LL_INFOS("InitInfo") << "Hardware test initialization done." << LL_ENDL ;
+
+ // Prepare for out-of-memory situations, during which we will crash on
+ // purpose and save a dump.
#if LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP
- MemSetErrorHandler(first_mem_error_handler);
+ MemSetErrorHandler(first_mem_error_handler);
#endif // LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP
- // *Note: this is where gViewerStats used to be created.
+ // *Note: this is where gViewerStats used to be created.
- if (!initCache())
- {
- LL_WARNS("InitInfo") << "Failed to init cache" << LL_ENDL;
- std::ostringstream msg;
- msg << LLTrans::getString("MBUnableToAccessFile");
- OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK);
- return 0;
- }
- LL_INFOS("InitInfo") << "Cache initialization is done." << LL_ENDL ;
+ if (!initCache())
+ {
+ LL_WARNS("InitInfo") << "Failed to init cache" << LL_ENDL;
+ std::ostringstream msg;
+ msg << LLTrans::getString("MBUnableToAccessFile");
+ OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK);
+ return 0;
+ }
+ LL_INFOS("InitInfo") << "Cache initialization is done." << LL_ENDL ;
// Initialize event recorder
LLViewerEventRecorder::createInstance();
- //
- // Initialize the window
- //
- gGLActive = TRUE;
- initWindow();
- LL_INFOS("InitInfo") << "Window is initialized." << LL_ENDL ;
+ //
+ // Initialize the window
+ //
+ gGLActive = TRUE;
+ initWindow();
+ LL_INFOS("InitInfo") << "Window is initialized." << LL_ENDL ;
// writeSystemInfo can be called after window is initialized (gViewerWindow non-null)
writeSystemInfo();
- // initWindow also initializes the Feature List, so now we can initialize this global.
- LLCubeMap::sUseCubeMaps = LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap");
+ // initWindow also initializes the Feature List, so now we can initialize this global.
+ LLCubeMap::sUseCubeMaps = LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap");
- // call all self-registered classes
- LLInitClassList::instance().fireCallbacks();
+ // call all self-registered classes
+ LLInitClassList::instance().fireCallbacks();
- LLFolderViewItem::initClass(); // SJB: Needs to happen after initWindow(), not sure why but related to fonts
+ LLFolderViewItem::initClass(); // SJB: Needs to happen after initWindow(), not sure why but related to fonts
- gGLManager.getGLInfo(gDebugInfo);
- gGLManager.printGLInfoString();
+ gGLManager.getGLInfo(gDebugInfo);
+ gGLManager.printGLInfoString();
- // If we don't have the right GL requirements, exit.
- if (!gGLManager.mHasRequirements)
- {
+ // If we don't have the right GL requirements, exit.
+ if (!gGLManager.mHasRequirements)
+ {
// already handled with a MBVideoDrvErr
- return 0;
- }
-
- // Without SSE2 support we will crash almost immediately, warn here.
- if (!gSysCPU.hasSSE2())
- {
- // can't use an alert here since we're exiting and
- // all hell breaks lose.
- OSMessageBox(
- LLNotifications::instance().getGlobalString("UnsupportedCPUSSE2"),
- LLStringUtil::null,
- OSMB_OK);
- return 0;
- }
-
- // alert the user if they are using unsupported hardware
- if(!gSavedSettings.getBOOL("AlertedUnsupportedHardware"))
- {
- bool unsupported = false;
- LLSD args;
- std::string minSpecs;
-
- // get cpu data from xml
- std::stringstream minCPUString(LLNotifications::instance().getGlobalString("UnsupportedCPUAmount"));
- S32 minCPU = 0;
- minCPUString >> minCPU;
-
- // get RAM data from XML
- std::stringstream minRAMString(LLNotifications::instance().getGlobalString("UnsupportedRAMAmount"));
- U64Bytes minRAM;
- minRAMString >> minRAM;
-
- if(!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN)
- {
- minSpecs += LLNotifications::instance().getGlobalString("UnsupportedGPU");
- minSpecs += "\n";
- unsupported = true;
- }
- if(gSysCPU.getMHz() < minCPU)
- {
- minSpecs += LLNotifications::instance().getGlobalString("UnsupportedCPU");
- minSpecs += "\n";
- unsupported = true;
- }
- if(gSysMemory.getPhysicalMemoryKB() < minRAM)
- {
- minSpecs += LLNotifications::instance().getGlobalString("UnsupportedRAM");
- minSpecs += "\n";
- unsupported = true;
- }
-
- if (LLFeatureManager::getInstance()->getGPUClass() == GPU_CLASS_UNKNOWN)
- {
- LLNotificationsUtil::add("UnknownGPU");
- }
-
- if(unsupported)
- {
- if(!gSavedSettings.controlExists("WarnUnsupportedHardware")
- || gSavedSettings.getBOOL("WarnUnsupportedHardware"))
- {
- args["MINSPECS"] = minSpecs;
- LLNotificationsUtil::add("UnsupportedHardware", args );
- }
-
- }
- }
+ return 0;
+ }
+
+ // Without SSE2 support we will crash almost immediately, warn here.
+ if (!gSysCPU.hasSSE2())
+ {
+ // can't use an alert here since we're exiting and
+ // all hell breaks lose.
+ OSMessageBox(
+ LLNotifications::instance().getGlobalString("UnsupportedCPUSSE2"),
+ LLStringUtil::null,
+ OSMB_OK);
+ return 0;
+ }
+
+ // alert the user if they are using unsupported hardware
+ if(!gSavedSettings.getBOOL("AlertedUnsupportedHardware"))
+ {
+ bool unsupported = false;
+ LLSD args;
+ std::string minSpecs;
+
+ // get cpu data from xml
+ std::stringstream minCPUString(LLNotifications::instance().getGlobalString("UnsupportedCPUAmount"));
+ S32 minCPU = 0;
+ minCPUString >> minCPU;
+
+ // get RAM data from XML
+ std::stringstream minRAMString(LLNotifications::instance().getGlobalString("UnsupportedRAMAmount"));
+ U64Bytes minRAM;
+ minRAMString >> minRAM;
+
+ if(!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN)
+ {
+ minSpecs += LLNotifications::instance().getGlobalString("UnsupportedGPU");
+ minSpecs += "\n";
+ unsupported = true;
+ }
+ if(gSysCPU.getMHz() < minCPU)
+ {
+ minSpecs += LLNotifications::instance().getGlobalString("UnsupportedCPU");
+ minSpecs += "\n";
+ unsupported = true;
+ }
+ if(gSysMemory.getPhysicalMemoryKB() < minRAM)
+ {
+ minSpecs += LLNotifications::instance().getGlobalString("UnsupportedRAM");
+ minSpecs += "\n";
+ unsupported = true;
+ }
+
+ if (LLFeatureManager::getInstance()->getGPUClass() == GPU_CLASS_UNKNOWN)
+ {
+ LLNotificationsUtil::add("UnknownGPU");
+ }
+
+ if(unsupported)
+ {
+ if(!gSavedSettings.controlExists("WarnUnsupportedHardware")
+ || gSavedSettings.getBOOL("WarnUnsupportedHardware"))
+ {
+ args["MINSPECS"] = minSpecs;
+ LLNotificationsUtil::add("UnsupportedHardware", args );
+ }
+
+ }
+ }
#if LL_WINDOWS && ADDRESS_SIZE == 64
if (gGLManager.mIsIntel)
@@ -1080,54 +1080,54 @@ bool LLAppViewer::init()
// Obsolete? mExpectedGLVersion is always zero
#if LL_WINDOWS
- if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion())
- {
- std::string url;
- if (gGLManager.mIsIntel)
- {
- url = LLTrans::getString("IntelDriverPage");
- }
- else if (gGLManager.mIsNVIDIA)
- {
- url = LLTrans::getString("NvidiaDriverPage");
- }
- else if (gGLManager.mIsAMD)
- {
- url = LLTrans::getString("AMDDriverPage");
- }
-
- if (!url.empty())
- {
- LLNotificationsUtil::add("OldGPUDriver", LLSD().with("URL", url));
- }
- }
+ if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion())
+ {
+ std::string url;
+ if (gGLManager.mIsIntel)
+ {
+ url = LLTrans::getString("IntelDriverPage");
+ }
+ else if (gGLManager.mIsNVIDIA)
+ {
+ url = LLTrans::getString("NvidiaDriverPage");
+ }
+ else if (gGLManager.mIsAMD)
+ {
+ url = LLTrans::getString("AMDDriverPage");
+ }
+
+ if (!url.empty())
+ {
+ LLNotificationsUtil::add("OldGPUDriver", LLSD().with("URL", url));
+ }
+ }
#endif
- // save the graphics card
- gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString();
+ // save the graphics card
+ gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString();
- // Save the current version to the prefs file
- gSavedSettings.setString("LastRunVersion",
- LLVersionInfo::instance().getChannelAndVersion());
+ // Save the current version to the prefs file
+ gSavedSettings.setString("LastRunVersion",
+ LLVersionInfo::instance().getChannelAndVersion());
- gSimLastTime = gRenderStartTime.getElapsedTimeF32();
- gSimFrames = (F32)gFrameCount;
+ gSimLastTime = gRenderStartTime.getElapsedTimeF32();
+ gSimFrames = (F32)gFrameCount;
if (gSavedSettings.getBOOL("JoystickEnabled"))
{
LLViewerJoystick::getInstance()->init(false);
}
- try {
- initializeSecHandler();
- }
- catch (LLProtectedDataException&)
- {
- LLNotificationsUtil::add("CorruptedProtectedDataStore");
- }
+ try {
+ initializeSecHandler();
+ }
+ catch (LLProtectedDataException&)
+ {
+ LLNotificationsUtil::add("CorruptedProtectedDataStore");
+ }
- gGLActive = FALSE;
+ gGLActive = FALSE;
#if LL_RELEASE_FOR_DOWNLOAD
// Skip updater if this is a non-interactive instance
@@ -1225,25 +1225,25 @@ bool LLAppViewer::init()
<< LL_ENDL;
}
- LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match;
+ LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match;
- //EXT-7013 - On windows for some locale (Japanese) standard
- //datetime formatting functions didn't support some parameters such as "weekday".
- //Names for days and months localized in xml are also useful for Polish locale(STORM-107).
- std::string language = gSavedSettings.getString("Language");
- if(language == "ja" || language == "pl")
- {
- LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames"));
- LLStringOps::setupWeekDaysShortNames(LLTrans::getString("dateTimeWeekdaysShortNames"));
- LLStringOps::setupMonthNames(LLTrans::getString("dateTimeMonthNames"));
- LLStringOps::setupMonthShortNames(LLTrans::getString("dateTimeMonthShortNames"));
- LLStringOps::setupDayFormat(LLTrans::getString("dateTimeDayFormat"));
-
- LLStringOps::sAM = LLTrans::getString("dateTimeAM");
- LLStringOps::sPM = LLTrans::getString("dateTimePM");
- }
+ //EXT-7013 - On windows for some locale (Japanese) standard
+ //datetime formatting functions didn't support some parameters such as "weekday".
+ //Names for days and months localized in xml are also useful for Polish locale(STORM-107).
+ std::string language = gSavedSettings.getString("Language");
+ if(language == "ja" || language == "pl")
+ {
+ LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames"));
+ LLStringOps::setupWeekDaysShortNames(LLTrans::getString("dateTimeWeekdaysShortNames"));
+ LLStringOps::setupMonthNames(LLTrans::getString("dateTimeMonthNames"));
+ LLStringOps::setupMonthShortNames(LLTrans::getString("dateTimeMonthShortNames"));
+ LLStringOps::setupDayFormat(LLTrans::getString("dateTimeDayFormat"));
+
+ LLStringOps::sAM = LLTrans::getString("dateTimeAM");
+ LLStringOps::sPM = LLTrans::getString("dateTimePM");
+ }
- LLAgentLanguage::init();
+ LLAgentLanguage::init();
/// Tell the Coprocedure manager how to discover and store the pool sizes
// what I wanted
@@ -1251,27 +1251,27 @@ bool LLAppViewer::init()
boost::bind(&LLControlGroup::getU32, boost::ref(gSavedSettings), _1),
boost::bind(&LLControlGroup::declareU32, boost::ref(gSavedSettings), _1, _2, _3, LLControlVariable::PERSIST_ALWAYS));
- // TODO: consider moving proxy initialization here or LLCopocedureManager after proxy initialization, may be implement
- // some other protection to make sure we don't use network before initializng proxy
+ // TODO: consider moving proxy initialization here or LLCopocedureManager after proxy initialization, may be implement
+ // some other protection to make sure we don't use network before initializng proxy
- /*----------------------------------------------------------------------*/
- // nat 2016-06-29 moved the following here from the former mainLoop().
- mMainloopTimeout = new LLWatchdogTimeout();
+ /*----------------------------------------------------------------------*/
+ // nat 2016-06-29 moved the following here from the former mainLoop().
+ mMainloopTimeout = new LLWatchdogTimeout();
- // Create IO Pump to use for HTTP Requests.
- gServicePump = new LLPumpIO(gAPRPoolp);
+ // Create IO Pump to use for HTTP Requests.
+ gServicePump = new LLPumpIO(gAPRPoolp);
- // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
+ // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
- LLVoiceChannel::initClass();
- LLVoiceClient::initParamSingleton(gServicePump);
- LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLFloaterIMContainer::onCurrentChannelChanged, _1), true);
+ LLVoiceChannel::initClass();
+ LLVoiceClient::initParamSingleton(gServicePump);
+ LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLFloaterIMContainer::onCurrentChannelChanged, _1), true);
- joystick = LLViewerJoystick::getInstance();
- joystick->setNeedsReset(true);
- /*----------------------------------------------------------------------*/
- // Load User's bindings
- loadKeyBindings();
+ joystick = LLViewerJoystick::getInstance();
+ joystick->setNeedsReset(true);
+ /*----------------------------------------------------------------------*/
+ // Load User's bindings
+ loadKeyBindings();
//LLSimpleton creations
LLEnvironment::createInstance();
@@ -1286,23 +1286,23 @@ bool LLAppViewer::init()
}
#endif
- return true;
+ return true;
}
void LLAppViewer::initMaxHeapSize()
{
- //set the max heap size.
- //here is some info regarding to the max heap size:
- //------------------------------------------------------------------------------------------
- // OS | setting | SL address bits | max manageable memory space | max heap size
- // Win 32 | default | 32-bit | 2GB | < 1.7GB
- // Win 32 | /3G | 32-bit | 3GB | < 1.7GB or 2.7GB
- //Linux 32 | default | 32-bit | 3GB | < 2.7GB
- //Linux 32 |HUGEMEM | 32-bit | 4GB | < 3.7GB
- //64-bit OS |default | 32-bit | 4GB | < 3.7GB
- //64-bit OS |default | 64-bit | N/A (> 4GB) | N/A (> 4GB)
- //------------------------------------------------------------------------------------------
- //currently SL is built under 32-bit setting, we set its max heap size no more than 1.6 GB.
+ //set the max heap size.
+ //here is some info regarding to the max heap size:
+ //------------------------------------------------------------------------------------------
+ // OS | setting | SL address bits | max manageable memory space | max heap size
+ // Win 32 | default | 32-bit | 2GB | < 1.7GB
+ // Win 32 | /3G | 32-bit | 3GB | < 1.7GB or 2.7GB
+ //Linux 32 | default | 32-bit | 3GB | < 2.7GB
+ //Linux 32 |HUGEMEM | 32-bit | 4GB | < 3.7GB
+ //64-bit OS |default | 32-bit | 4GB | < 3.7GB
+ //64-bit OS |default | 64-bit | N/A (> 4GB) | N/A (> 4GB)
+ //------------------------------------------------------------------------------------------
+ //currently SL is built under 32-bit setting, we set its max heap size no more than 1.6 GB.
#ifndef LL_X86_64
F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ;
@@ -1319,42 +1319,42 @@ LLTrace::BlockTimerStatHandle FTM_FRAME("Frame");
bool LLAppViewer::frame()
{
- bool ret = false;
-
- if (gSimulateMemLeak)
- {
- try
- {
- ret = doFrame();
- }
- catch (const LLContinueError&)
- {
- LOG_UNHANDLED_EXCEPTION("");
- }
- catch (std::bad_alloc&)
- {
- LLMemory::logMemoryInfo(TRUE);
- LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
- if (mem_leak_instance)
- {
- mem_leak_instance->stop();
- }
- LL_WARNS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL;
- }
- }
- else
- {
- try
- {
- ret = doFrame();
- }
- catch (const LLContinueError&)
- {
- LOG_UNHANDLED_EXCEPTION("");
- }
- }
-
- return ret;
+ bool ret = false;
+
+ if (gSimulateMemLeak)
+ {
+ try
+ {
+ ret = doFrame();
+ }
+ catch (const LLContinueError&)
+ {
+ LOG_UNHANDLED_EXCEPTION("");
+ }
+ catch (std::bad_alloc&)
+ {
+ LLMemory::logMemoryInfo(TRUE);
+ LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
+ if (mem_leak_instance)
+ {
+ mem_leak_instance->stop();
+ }
+ LL_WARNS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL;
+ }
+ }
+ else
+ {
+ try
+ {
+ ret = doFrame();
+ }
+ catch (const LLContinueError&)
+ {
+ LOG_UNHANDLED_EXCEPTION("");
+ }
+ }
+
+ return ret;
}
bool LLAppViewer::doFrame()
@@ -1447,63 +1447,63 @@ bool LLAppViewer::doFrame()
}
}
- if (!LLApp::isExiting())
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df JoystickKeyboard" )
- pingMainloopTimeout("Main:JoystickKeyboard");
-
- // Scan keyboard for movement keys. Command keys and typing
- // are handled by windows callbacks. Don't do this until we're
- // done initializing. JC
- if (gViewerWindow
- && (gHeadlessClient || gViewerWindow->getWindow()->getVisible())
- && gViewerWindow->getActive()
- && !gViewerWindow->getWindow()->getMinimized()
- && LLStartUp::getStartupState() == STATE_STARTED
- && (gHeadlessClient || !gViewerWindow->getShowProgress())
- && !gFocusMgr.focusLocked())
- {
+ if (!LLApp::isExiting())
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df JoystickKeyboard" )
+ pingMainloopTimeout("Main:JoystickKeyboard");
+
+ // Scan keyboard for movement keys. Command keys and typing
+ // are handled by windows callbacks. Don't do this until we're
+ // done initializing. JC
+ if (gViewerWindow
+ && (gHeadlessClient || gViewerWindow->getWindow()->getVisible())
+ && gViewerWindow->getActive()
+ && !gViewerWindow->getWindow()->getMinimized()
+ && LLStartUp::getStartupState() == STATE_STARTED
+ && (gHeadlessClient || !gViewerWindow->getShowProgress())
+ && !gFocusMgr.focusLocked())
+ {
LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE);
- joystick->scanJoystick();
- gKeyboard->scanKeyboard();
+ joystick->scanJoystick();
+ gKeyboard->scanKeyboard();
gViewerInput.scanMouse();
- }
+ }
- // Update state based on messages, user input, object idle.
- {
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" )
- pauseMainloopTimeout(); // *TODO: Remove. Messages shouldn't be stalling for 20+ seconds!
- }
+ // Update state based on messages, user input, object idle.
+ {
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" )
+ pauseMainloopTimeout(); // *TODO: Remove. Messages shouldn't be stalling for 20+ seconds!
+ }
- {
+ {
LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE);
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df idle");
- idle();
- }
+ idle();
+ }
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df resumeMainloopTimeout" )
- resumeMainloopTimeout();
- }
- }
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df resumeMainloopTimeout" )
+ resumeMainloopTimeout();
+ }
+ }
- if (gDoDisconnect && (LLStartUp::getStartupState() == STATE_STARTED))
- {
- pauseMainloopTimeout();
- saveFinalSnapshot();
+ if (gDoDisconnect && (LLStartUp::getStartupState() == STATE_STARTED))
+ {
+ pauseMainloopTimeout();
+ saveFinalSnapshot();
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->terminate();
}
- disconnectViewer();
- resumeMainloopTimeout();
- }
+ disconnectViewer();
+ resumeMainloopTimeout();
+ }
- // Render scene.
- // *TODO: Should we run display() even during gHeadlessClient? DK 2011-02-18
+ // Render scene.
+ // *TODO: Should we run display() even during gHeadlessClient? DK 2011-02-18
if (!LLApp::isExiting() && !gHeadlessClient && gViewerWindow)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df Display");
@@ -1527,159 +1527,159 @@ bool LLAppViewer::doFrame()
LLViewerStatsRecorder::instance().idle();
}
}
- }
+ }
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" )
- pingMainloopTimeout("Main:Sleep");
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" )
+ pingMainloopTimeout("Main:Sleep");
- pauseMainloopTimeout();
- }
+ pauseMainloopTimeout();
+ }
- // Sleep and run background threads
- {
- //LL_RECORD_BLOCK_TIME(SLEEP2);
- LL_PROFILE_ZONE_WARN( "Sleep2" )
+ // Sleep and run background threads
+ {
+ //LL_RECORD_BLOCK_TIME(SLEEP2);
+ LL_PROFILE_ZONE_WARN( "Sleep2" )
- // yield some time to the os based on command line option
- static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1);
- if(yield_time >= 0)
- {
+ // yield some time to the os based on command line option
+ static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1);
+ if(yield_time >= 0)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Yield");
- LL_PROFILE_ZONE_NUM( yield_time )
- ms_sleep(yield_time);
- }
-
- if (gNonInteractive)
- {
- S32 non_interactive_ms_sleep_time = 100;
- LLAppViewer::getTextureCache()->pause();
- ms_sleep(non_interactive_ms_sleep_time);
- }
-
- // yield cooperatively when not running as foreground window
- // and when not quiting (causes trouble at mac's cleanup stage)
- if (!LLApp::isExiting()
- && ((gViewerWindow && !gViewerWindow->getWindow()->getVisible())
- || !gFocusMgr.getAppHasFocus()))
- {
- // Sleep if we're not rendering, or the window is minimized.
- static LLCachedControl<S32> s_background_yield_time(gSavedSettings, "BackgroundYieldTime", 40);
- S32 milliseconds_to_sleep = llclamp((S32)s_background_yield_time, 0, 1000);
- // don't sleep when BackgroundYieldTime set to 0, since this will still yield to other threads
- // of equal priority on Windows
- if (milliseconds_to_sleep > 0)
- {
+ LL_PROFILE_ZONE_NUM( yield_time )
+ ms_sleep(yield_time);
+ }
+
+ if (gNonInteractive)
+ {
+ S32 non_interactive_ms_sleep_time = 100;
+ LLAppViewer::getTextureCache()->pause();
+ ms_sleep(non_interactive_ms_sleep_time);
+ }
+
+ // yield cooperatively when not running as foreground window
+ // and when not quiting (causes trouble at mac's cleanup stage)
+ if (!LLApp::isExiting()
+ && ((gViewerWindow && !gViewerWindow->getWindow()->getVisible())
+ || !gFocusMgr.getAppHasFocus()))
+ {
+ // Sleep if we're not rendering, or the window is minimized.
+ static LLCachedControl<S32> s_background_yield_time(gSavedSettings, "BackgroundYieldTime", 40);
+ S32 milliseconds_to_sleep = llclamp((S32)s_background_yield_time, 0, 1000);
+ // don't sleep when BackgroundYieldTime set to 0, since this will still yield to other threads
+ // of equal priority on Windows
+ if (milliseconds_to_sleep > 0)
+ {
LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_SLEEP );
ms_sleep(milliseconds_to_sleep);
- // also pause worker threads during this wait period
- LLAppViewer::getTextureCache()->pause();
- }
- }
-
- if (mRandomizeFramerate)
- {
- ms_sleep(rand() % 200);
- }
-
- if (mPeriodicSlowFrame
- && (gFrameCount % 10 == 0))
- {
- LL_INFOS() << "Periodic slow frame - sleeping 500 ms" << LL_ENDL;
- ms_sleep(500);
- }
-
- S32 total_work_pending = 0;
- S32 total_io_pending = 0;
- {
- S32 work_pending = 0;
- S32 io_pending = 0;
- F32 max_time = llmin(gFrameIntervalSeconds.value() *10.f, 1.f);
-
- work_pending += updateTextureThreads(max_time);
-
- {
+ // also pause worker threads during this wait period
+ LLAppViewer::getTextureCache()->pause();
+ }
+ }
+
+ if (mRandomizeFramerate)
+ {
+ ms_sleep(rand() % 200);
+ }
+
+ if (mPeriodicSlowFrame
+ && (gFrameCount % 10 == 0))
+ {
+ LL_INFOS() << "Periodic slow frame - sleeping 500 ms" << LL_ENDL;
+ ms_sleep(500);
+ }
+
+ S32 total_work_pending = 0;
+ S32 total_io_pending = 0;
+ {
+ S32 work_pending = 0;
+ S32 io_pending = 0;
+ F32 max_time = llmin(gFrameIntervalSeconds.value() *10.f, 1.f);
+
+ work_pending += updateTextureThreads(max_time);
+
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("LFS Thread");
- io_pending += LLLFSThread::updateClass(1);
- }
-
- if (io_pending > 1000)
- {
- ms_sleep(llmin(io_pending/100,100)); // give the lfs some time to catch up
- }
-
- total_work_pending += work_pending ;
- total_io_pending += io_pending ;
-
- }
-
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df gMeshRepo" )
- gMeshRepo.update() ;
- }
-
- if(!total_work_pending) //pause texture fetching threads if nothing to process.
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df getTextureCache" )
- LLAppViewer::getTextureCache()->pause();
- LLAppViewer::getTextureFetch()->pause();
- }
- if(!total_io_pending) //pause file threads if nothing to process.
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df LLVFSThread" )
- LLLFSThread::sLocal->pause();
- }
-
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df resumeMainloopTimeout" )
- resumeMainloopTimeout();
- }
- pingMainloopTimeout("Main:End");
- }
- }
-
- if (LLApp::isExiting())
- {
- // Save snapshot for next time, if we made it through initialization
- if (STATE_STARTED == LLStartUp::getStartupState())
- {
- saveFinalSnapshot();
- }
-
- if (LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->terminate();
- }
-
- delete gServicePump;
- gServicePump = NULL;
-
- destroyMainloopTimeout();
-
- LL_INFOS() << "Exiting main_loop" << LL_ENDL;
- }
+ io_pending += LLLFSThread::updateClass(1);
+ }
+
+ if (io_pending > 1000)
+ {
+ ms_sleep(llmin(io_pending/100,100)); // give the lfs some time to catch up
+ }
+
+ total_work_pending += work_pending ;
+ total_io_pending += io_pending ;
+
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df gMeshRepo" )
+ gMeshRepo.update() ;
+ }
+
+ if(!total_work_pending) //pause texture fetching threads if nothing to process.
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df getTextureCache" )
+ LLAppViewer::getTextureCache()->pause();
+ LLAppViewer::getTextureFetch()->pause();
+ }
+ if(!total_io_pending) //pause file threads if nothing to process.
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df LLVFSThread" )
+ LLLFSThread::sLocal->pause();
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df resumeMainloopTimeout" )
+ resumeMainloopTimeout();
+ }
+ pingMainloopTimeout("Main:End");
+ }
+ }
+
+ if (LLApp::isExiting())
+ {
+ // Save snapshot for next time, if we made it through initialization
+ if (STATE_STARTED == LLStartUp::getStartupState())
+ {
+ saveFinalSnapshot();
+ }
+
+ if (LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->terminate();
+ }
+
+ delete gServicePump;
+ gServicePump = NULL;
+
+ destroyMainloopTimeout();
+
+ LL_INFOS() << "Exiting main_loop" << LL_ENDL;
+ }
}LLPerfStats::StatsRecorder::endFrame();
LL_PROFILER_FRAME_END
- return ! LLApp::isRunning();
+ return ! LLApp::isRunning();
}
S32 LLAppViewer::updateTextureThreads(F32 max_time)
{
- S32 work_pending = 0;
- {
+ S32 work_pending = 0;
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Texture Cache");
- work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread
- }
- {
+ work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread
+ }
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Image Decode");
- work_pending += LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread
- }
- {
+ work_pending += LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread
+ }
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Image Fetch");
- work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread
- }
- return work_pending;
+ work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread
+ }
+ return work_pending;
}
void LLAppViewer::flushLFSIO()
@@ -1704,200 +1704,200 @@ bool LLAppViewer::cleanup()
{
LLAtmosphere::cleanupClass();
- //ditch LLVOAvatarSelf instance
- gAgentAvatarp = NULL;
+ //ditch LLVOAvatarSelf instance
+ gAgentAvatarp = NULL;
LLNotifications::instance().clear();
- // workaround for DEV-35406 crash on shutdown
- LLEventPumps::instance().reset(true);
+ // workaround for DEV-35406 crash on shutdown
+ LLEventPumps::instance().reset(true);
- //dump scene loading monitor results
- if (LLSceneMonitor::instanceExists())
- {
- if (!isSecondInstance())
- {
+ //dump scene loading monitor results
+ if (LLSceneMonitor::instanceExists())
+ {
+ if (!isSecondInstance())
+ {
std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv");
- LLSceneMonitor::instance().dumpToFile(dump_path);
- }
- LLSceneMonitor::deleteSingleton();
- }
-
- // There used to be an 'if (LLFastTimerView::sAnalyzePerformance)' block
- // here, completely redundant with the one that occurs later in this same
- // function. Presumably the duplication was due to an automated merge gone
- // bad. Not knowing which instance to prefer, we chose to retain the later
- // one because it happens just after mFastTimerLogThread is deleted. This
- // comment is in case we guessed wrong, so we can move it here instead.
+ LLSceneMonitor::instance().dumpToFile(dump_path);
+ }
+ LLSceneMonitor::deleteSingleton();
+ }
+
+ // There used to be an 'if (LLFastTimerView::sAnalyzePerformance)' block
+ // here, completely redundant with the one that occurs later in this same
+ // function. Presumably the duplication was due to an automated merge gone
+ // bad. Not knowing which instance to prefer, we chose to retain the later
+ // one because it happens just after mFastTimerLogThread is deleted. This
+ // comment is in case we guessed wrong, so we can move it here instead.
#if LL_LINUX
- // remove any old breakpad minidump files from the log directory
- if (! isError())
- {
- std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
- gDirUtilp->deleteFilesInDir(logdir, "*-*-*-*-*.dmp");
- }
+ // remove any old breakpad minidump files from the log directory
+ if (! isError())
+ {
+ std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
+ gDirUtilp->deleteFilesInDir(logdir, "*-*-*-*-*.dmp");
+ }
#endif
- // Kill off LLLeap objects. We can find them all because LLLeap is derived
- // from LLInstanceTracker.
- LLLeap::instance_snapshot().deleteAll();
+ // Kill off LLLeap objects. We can find them all because LLLeap is derived
+ // from LLInstanceTracker.
+ LLLeap::instance_snapshot().deleteAll();
- //flag all elements as needing to be destroyed immediately
- // to ensure shutdown order
- LLMortician::setZealous(TRUE);
+ //flag all elements as needing to be destroyed immediately
+ // to ensure shutdown order
+ LLMortician::setZealous(TRUE);
// Give any remaining SLPlugin instances a chance to exit cleanly.
LLPluginProcessParent::shutdown();
- disconnectViewer();
- LLViewerCamera::deleteSingleton();
+ disconnectViewer();
+ LLViewerCamera::deleteSingleton();
- LL_INFOS() << "Viewer disconnected" << LL_ENDL;
-
- if (gKeyboard)
- {
- gKeyboard->resetKeys();
- }
+ LL_INFOS() << "Viewer disconnected" << LL_ENDL;
- display_cleanup();
+ if (gKeyboard)
+ {
+ gKeyboard->resetKeys();
+ }
- release_start_screen(); // just in case
+ display_cleanup();
- LLError::logToFixedBuffer(NULL); // stop the fixed buffer recorder
+ release_start_screen(); // just in case
- LL_INFOS() << "Cleaning Up" << LL_ENDL;
+ LLError::logToFixedBuffer(NULL); // stop the fixed buffer recorder
- // shut down mesh streamer
- gMeshRepo.shutdown();
+ LL_INFOS() << "Cleaning Up" << LL_ENDL;
- // shut down Havok
- LLPhysicsExtensions::quitSystem();
+ // shut down mesh streamer
+ gMeshRepo.shutdown();
- // Must clean up texture references before viewer window is destroyed.
- if(LLHUDManager::instanceExists())
- {
- LLHUDManager::getInstance()->updateEffects();
- LLHUDObject::updateAll();
- LLHUDManager::getInstance()->cleanupEffects();
- LLHUDObject::cleanupHUDObjects();
- LL_INFOS() << "HUD Objects cleaned up" << LL_ENDL;
- }
+ // shut down Havok
+ LLPhysicsExtensions::quitSystem();
- LLKeyframeDataCache::clear();
+ // Must clean up texture references before viewer window is destroyed.
+ if(LLHUDManager::instanceExists())
+ {
+ LLHUDManager::getInstance()->updateEffects();
+ LLHUDObject::updateAll();
+ LLHUDManager::getInstance()->cleanupEffects();
+ LLHUDObject::cleanupHUDObjects();
+ LL_INFOS() << "HUD Objects cleaned up" << LL_ENDL;
+ }
- // End TransferManager before deleting systems it depends on (Audio, AssetStorage)
+ LLKeyframeDataCache::clear();
+
+ // End TransferManager before deleting systems it depends on (Audio, AssetStorage)
#if 0 // this seems to get us stuck in an infinite loop...
- gTransferManager.cleanup();
+ gTransferManager.cleanup();
#endif
- // Note: this is where gWorldMap used to be deleted.
+ // Note: this is where gWorldMap used to be deleted.
- // Note: this is where gHUDManager used to be deleted.
- if(LLHUDManager::instanceExists())
- {
- LLHUDManager::getInstance()->shutdownClass();
- }
+ // Note: this is where gHUDManager used to be deleted.
+ if(LLHUDManager::instanceExists())
+ {
+ LLHUDManager::getInstance()->shutdownClass();
+ }
- delete gAssetStorage;
- gAssetStorage = NULL;
+ delete gAssetStorage;
+ gAssetStorage = NULL;
- LLPolyMesh::freeAllMeshes();
+ LLPolyMesh::freeAllMeshes();
- LLStartUp::cleanupNameCache();
+ LLStartUp::cleanupNameCache();
- // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be deleted.
+ // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be deleted.
- if (LLWorldMap::instanceExists())
- {
- LLWorldMap::getInstance()->reset(); // release any images
- }
+ if (LLWorldMap::instanceExists())
+ {
+ LLWorldMap::getInstance()->reset(); // release any images
+ }
- LLCalc::cleanUp();
+ LLCalc::cleanUp();
- LL_INFOS() << "Global stuff deleted" << LL_ENDL;
+ LL_INFOS() << "Global stuff deleted" << LL_ENDL;
- if (gAudiop)
- {
+ if (gAudiop)
+ {
LL_INFOS() << "Shutting down audio" << LL_ENDL;
// be sure to stop the internet stream cleanly BEFORE destroying the interface to stop it.
gAudiop->stopInternetStream();
// shut down the streaming audio sub-subsystem first, in case it relies on not outliving the general audio subsystem.
LLStreamingAudioInterface *sai = gAudiop->getStreamingAudioImpl();
- delete sai;
- gAudiop->setStreamingAudioImpl(NULL);
+ delete sai;
+ gAudiop->setStreamingAudioImpl(NULL);
// shut down the audio subsystem
gAudiop->shutdown();
- delete gAudiop;
- gAudiop = NULL;
- }
-
- // Note: this is where LLFeatureManager::getInstance()-> used to be deleted.
+ delete gAudiop;
+ gAudiop = NULL;
+ }
- // Patch up settings for next time
- // Must do this before we delete the viewer window,
- // such that we can suck rectangle information out of
- // it.
- cleanupSavedSettings();
- LL_INFOS() << "Settings patched up" << LL_ENDL;
+ // Note: this is where LLFeatureManager::getInstance()-> used to be deleted.
- // delete some of the files left around in the cache.
- removeCacheFiles("*.wav");
- removeCacheFiles("*.tmp");
- removeCacheFiles("*.lso");
- removeCacheFiles("*.out");
- removeCacheFiles("*.dsf");
- removeCacheFiles("*.bodypart");
- removeCacheFiles("*.clothing");
+ // Patch up settings for next time
+ // Must do this before we delete the viewer window,
+ // such that we can suck rectangle information out of
+ // it.
+ cleanupSavedSettings();
+ LL_INFOS() << "Settings patched up" << LL_ENDL;
- LL_INFOS() << "Cache files removed" << LL_ENDL;
+ // delete some of the files left around in the cache.
+ removeCacheFiles("*.wav");
+ removeCacheFiles("*.tmp");
+ removeCacheFiles("*.lso");
+ removeCacheFiles("*.out");
+ removeCacheFiles("*.dsf");
+ removeCacheFiles("*.bodypart");
+ removeCacheFiles("*.clothing");
- LL_INFOS() << "Shutting down Views" << LL_ENDL;
+ LL_INFOS() << "Cache files removed" << LL_ENDL;
- // Destroy the UI
- if( gViewerWindow)
- gViewerWindow->shutdownViews();
+ LL_INFOS() << "Shutting down Views" << LL_ENDL;
- LL_INFOS() << "Cleaning up Inventory" << LL_ENDL;
+ // Destroy the UI
+ if( gViewerWindow)
+ gViewerWindow->shutdownViews();
- // Cleanup Inventory after the UI since it will delete any remaining observers
- // (Deleted observers should have already removed themselves)
- gInventory.cleanupInventory();
+ LL_INFOS() << "Cleaning up Inventory" << LL_ENDL;
- LLCoros::getInstance()->printActiveCoroutines();
+ // Cleanup Inventory after the UI since it will delete any remaining observers
+ // (Deleted observers should have already removed themselves)
+ gInventory.cleanupInventory();
- LL_INFOS() << "Cleaning up Selections" << LL_ENDL;
+ LLCoros::getInstance()->printActiveCoroutines();
- // Clean up selection managers after UI is destroyed, as UI may be observing them.
- // Clean up before GL is shut down because we might be holding on to objects with texture references
- LLSelectMgr::cleanupGlobals();
+ LL_INFOS() << "Cleaning up Selections" << LL_ENDL;
- LL_INFOS() << "Shutting down OpenGL" << LL_ENDL;
+ // Clean up selection managers after UI is destroyed, as UI may be observing them.
+ // Clean up before GL is shut down because we might be holding on to objects with texture references
+ LLSelectMgr::cleanupGlobals();
- // Shut down OpenGL
- if( gViewerWindow)
- {
- gViewerWindow->shutdownGL();
+ LL_INFOS() << "Shutting down OpenGL" << LL_ENDL;
- // Destroy window, and make sure we're not fullscreen
- // This may generate window reshape and activation events.
- // Therefore must do this before destroying the message system.
- delete gViewerWindow;
- gViewerWindow = NULL;
- LL_INFOS() << "ViewerWindow deleted" << LL_ENDL;
- }
+ // Shut down OpenGL
+ if( gViewerWindow)
+ {
+ gViewerWindow->shutdownGL();
+
+ // Destroy window, and make sure we're not fullscreen
+ // This may generate window reshape and activation events.
+ // Therefore must do this before destroying the message system.
+ delete gViewerWindow;
+ gViewerWindow = NULL;
+ LL_INFOS() << "ViewerWindow deleted" << LL_ENDL;
+ }
LLSplashScreen::show();
LLSplashScreen::update(LLTrans::getString("ShuttingDown"));
- LL_INFOS() << "Cleaning up Keyboard & Joystick" << LL_ENDL;
+ LL_INFOS() << "Cleaning up Keyboard & Joystick" << LL_ENDL;
- // viewer UI relies on keyboard so keep it aound until viewer UI isa gone
- delete gKeyboard;
- gKeyboard = NULL;
+ // viewer UI relies on keyboard so keep it aound until viewer UI isa gone
+ delete gKeyboard;
+ gKeyboard = NULL;
if (LLViewerJoystick::instanceExists())
{
@@ -1905,142 +1905,142 @@ bool LLAppViewer::cleanup()
LLViewerJoystick::getInstance()->terminate();
}
- LL_INFOS() << "Cleaning up Objects" << LL_ENDL;
+ LL_INFOS() << "Cleaning up Objects" << LL_ENDL;
- LLViewerObject::cleanupVOClasses();
+ LLViewerObject::cleanupVOClasses();
- SUBSYSTEM_CLEANUP(LLAvatarAppearance);
+ SUBSYSTEM_CLEANUP(LLAvatarAppearance);
- SUBSYSTEM_CLEANUP(LLPostProcess);
+ SUBSYSTEM_CLEANUP(LLPostProcess);
- LLTracker::cleanupInstance();
+ LLTracker::cleanupInstance();
- // *FIX: This is handled in LLAppViewerWin32::cleanup().
- // I'm keeping the comment to remember its order in cleanup,
- // in case of unforseen dependency.
- //#if LL_WINDOWS
- // gDXHardware.cleanup();
- //#endif // LL_WINDOWS
+ // *FIX: This is handled in LLAppViewerWin32::cleanup().
+ // I'm keeping the comment to remember its order in cleanup,
+ // in case of unforseen dependency.
+ //#if LL_WINDOWS
+ // gDXHardware.cleanup();
+ //#endif // LL_WINDOWS
- LLVolumeMgr* volume_manager = LLPrimitive::getVolumeManager();
- if (!volume_manager->cleanup())
- {
- LL_WARNS() << "Remaining references in the volume manager!" << LL_ENDL;
- }
- LLPrimitive::cleanupVolumeManager();
+ LLVolumeMgr* volume_manager = LLPrimitive::getVolumeManager();
+ if (!volume_manager->cleanup())
+ {
+ LL_WARNS() << "Remaining references in the volume manager!" << LL_ENDL;
+ }
+ LLPrimitive::cleanupVolumeManager();
- LL_INFOS() << "Additional Cleanup..." << LL_ENDL;
+ LL_INFOS() << "Additional Cleanup..." << LL_ENDL;
- LLViewerParcelMgr::cleanupGlobals();
+ LLViewerParcelMgr::cleanupGlobals();
- // *Note: this is where gViewerStats used to be deleted.
+ // *Note: this is where gViewerStats used to be deleted.
- //end_messaging_system();
+ //end_messaging_system();
- LLPrimitive::cleanupVolumeManager();
- SUBSYSTEM_CLEANUP(LLWorldMapView);
- SUBSYSTEM_CLEANUP(LLFolderViewItem);
+ LLPrimitive::cleanupVolumeManager();
+ SUBSYSTEM_CLEANUP(LLWorldMapView);
+ SUBSYSTEM_CLEANUP(LLFolderViewItem);
- LL_INFOS() << "Saving Data" << LL_ENDL;
+ LL_INFOS() << "Saving Data" << LL_ENDL;
- // Store the time of our current logoff
- gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
+ // Store the time of our current logoff
+ gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
if (LLEnvironment::instanceExists())
{
- //Store environment settings if necessary
+ //Store environment settings if necessary
LLEnvironment::getInstance()->saveToSettings();
}
- // Must do this after all panels have been deleted because panels that have persistent rects
- // save their rects on delete.
- gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
-
- LLUIColorTable::instance().saveUserSettings();
-
- // PerAccountSettingsFile should be empty if no user has been logged on.
- // *FIX:Mani This should get really saved in a "logoff" mode.
- if (gSavedSettings.getString("PerAccountSettingsFile").empty())
- {
- LL_INFOS() << "Not saving per-account settings; don't know the account name yet." << LL_ENDL;
- }
- // Only save per account settings if the previous login succeeded, otherwise
- // we might end up with a cleared out settings file in case a previous login
- // failed after loading per account settings.
- else if (!mSavePerAccountSettings)
- {
- LL_INFOS() << "Not saving per-account settings; last login was not successful." << LL_ENDL;
- }
- else
- {
- gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
- LL_INFOS() << "Saved settings" << LL_ENDL;
-
- if (LLViewerParcelAskPlay::instanceExists())
- {
- LLViewerParcelAskPlay::getInstance()->saveSettings();
- }
- }
-
- std::string warnings_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Warnings"));
- gWarningSettings.saveToFile(warnings_settings_filename, TRUE);
-
- // Save URL history file
- LLURLHistory::saveFile("url_history.xml");
-
- // save mute list. gMuteList used to also be deleted here too.
- if (gAgent.isInitialized() && LLMuteList::instanceExists())
- {
- LLMuteList::getInstance()->cache(gAgent.getID());
- }
-
- //save call log list
- if (LLConversationLog::instanceExists())
- {
- LLConversationLog::instance().cache();
+ // Must do this after all panels have been deleted because panels that have persistent rects
+ // save their rects on delete.
+ gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
+
+ LLUIColorTable::instance().saveUserSettings();
+
+ // PerAccountSettingsFile should be empty if no user has been logged on.
+ // *FIX:Mani This should get really saved in a "logoff" mode.
+ if (gSavedSettings.getString("PerAccountSettingsFile").empty())
+ {
+ LL_INFOS() << "Not saving per-account settings; don't know the account name yet." << LL_ENDL;
+ }
+ // Only save per account settings if the previous login succeeded, otherwise
+ // we might end up with a cleared out settings file in case a previous login
+ // failed after loading per account settings.
+ else if (!mSavePerAccountSettings)
+ {
+ LL_INFOS() << "Not saving per-account settings; last login was not successful." << LL_ENDL;
+ }
+ else
+ {
+ gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
+ LL_INFOS() << "Saved settings" << LL_ENDL;
+
+ if (LLViewerParcelAskPlay::instanceExists())
+ {
+ LLViewerParcelAskPlay::getInstance()->saveSettings();
+ }
+ }
+
+ std::string warnings_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Warnings"));
+ gWarningSettings.saveToFile(warnings_settings_filename, TRUE);
+
+ // Save URL history file
+ LLURLHistory::saveFile("url_history.xml");
+
+ // save mute list. gMuteList used to also be deleted here too.
+ if (gAgent.isInitialized() && LLMuteList::instanceExists())
+ {
+ LLMuteList::getInstance()->cache(gAgent.getID());
+ }
+
+ //save call log list
+ if (LLConversationLog::instanceExists())
+ {
+ LLConversationLog::instance().cache();
}
clearSecHandler();
- if (mPurgeCacheOnExit)
- {
- LL_INFOS() << "Purging all cache files on exit" << LL_ENDL;
- gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*");
- }
-
- writeDebugInfo();
-
- LLLocationHistory::getInstance()->save();
-
- LLAvatarIconIDCache::getInstance()->save();
-
- // Stop the plugin read thread if it's running.
- LLPluginProcessParent::setUseReadThread(false);
-
- LL_INFOS() << "Shutting down Threads" << LL_ENDL;
-
- // Let threads finish
- LLTimer idleTimer;
- idleTimer.reset();
- const F64 max_idle_time = 5.f; // 5 seconds
- while(1)
- {
- S32 pending = 0;
- pending += LLAppViewer::getTextureCache()->update(1); // unpauses the worker thread
- pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread
- pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
- pending += LLLFSThread::updateClass(0);
- F64 idle_time = idleTimer.getElapsedTimeF64();
- if(!pending)
- {
- break ; //done
- }
- else if(idle_time >= max_idle_time)
- {
- LL_WARNS() << "Quitting with pending background tasks." << LL_ENDL;
- break;
- }
- }
+ if (mPurgeCacheOnExit)
+ {
+ LL_INFOS() << "Purging all cache files on exit" << LL_ENDL;
+ gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*");
+ }
+
+ writeDebugInfo();
+
+ LLLocationHistory::getInstance()->save();
+
+ LLAvatarIconIDCache::getInstance()->save();
+
+ // Stop the plugin read thread if it's running.
+ LLPluginProcessParent::setUseReadThread(false);
+
+ LL_INFOS() << "Shutting down Threads" << LL_ENDL;
+
+ // Let threads finish
+ LLTimer idleTimer;
+ idleTimer.reset();
+ const F64 max_idle_time = 5.f; // 5 seconds
+ while(1)
+ {
+ S32 pending = 0;
+ pending += LLAppViewer::getTextureCache()->update(1); // unpauses the worker thread
+ pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread
+ pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
+ pending += LLLFSThread::updateClass(0);
+ F64 idle_time = idleTimer.getElapsedTimeF64();
+ if(!pending)
+ {
+ break ; //done
+ }
+ else if(idle_time >= max_idle_time)
+ {
+ LL_WARNS() << "Quitting with pending background tasks." << LL_ENDL;
+ break;
+ }
+ }
if (mPurgeUserDataOnExit)
{
@@ -2050,32 +2050,32 @@ bool LLAppViewer::cleanup()
gDirUtilp->deleteDirAndContents(user_path);
}
- // Delete workers first
- // shotdown all worker threads before deleting them in case of co-dependencies
- mAppCoreHttp.requestStop();
- sTextureFetch->shutdown();
- sTextureCache->shutdown();
- sImageDecodeThread->shutdown();
- sPurgeDiskCacheThread->shutdown();
- if (mGeneralThreadPool)
- {
- mGeneralThreadPool->close();
- }
+ // Delete workers first
+ // shotdown all worker threads before deleting them in case of co-dependencies
+ mAppCoreHttp.requestStop();
+ sTextureFetch->shutdown();
+ sTextureCache->shutdown();
+ sImageDecodeThread->shutdown();
+ sPurgeDiskCacheThread->shutdown();
+ if (mGeneralThreadPool)
+ {
+ mGeneralThreadPool->close();
+ }
- sTextureFetch->shutDownTextureCacheThread() ;
+ sTextureFetch->shutDownTextureCacheThread() ;
LLLFSThread::sLocal->shutdown();
- LL_INFOS() << "Shutting down message system" << LL_ENDL;
- end_messaging_system();
+ LL_INFOS() << "Shutting down message system" << LL_ENDL;
+ end_messaging_system();
- // Non-LLCurl libcurl library
- mAppCoreHttp.cleanup();
+ // Non-LLCurl libcurl library
+ mAppCoreHttp.cleanup();
- SUBSYSTEM_CLEANUP(LLFilePickerThread);
- SUBSYSTEM_CLEANUP(LLDirPickerThread);
+ SUBSYSTEM_CLEANUP(LLFilePickerThread);
+ SUBSYSTEM_CLEANUP(LLDirPickerThread);
- //MUST happen AFTER SUBSYSTEM_CLEANUP(LLCurl)
- delete sTextureCache;
+ //MUST happen AFTER SUBSYSTEM_CLEANUP(LLCurl)
+ delete sTextureCache;
sTextureCache = NULL;
if (sTextureFetch)
{
@@ -2084,101 +2084,101 @@ bool LLAppViewer::cleanup()
delete sTextureFetch;
sTextureFetch = NULL;
}
- delete sImageDecodeThread;
+ delete sImageDecodeThread;
sImageDecodeThread = NULL;
- delete mFastTimerLogThread;
- mFastTimerLogThread = NULL;
- delete sPurgeDiskCacheThread;
- sPurgeDiskCacheThread = NULL;
+ delete mFastTimerLogThread;
+ mFastTimerLogThread = NULL;
+ delete sPurgeDiskCacheThread;
+ sPurgeDiskCacheThread = NULL;
delete mGeneralThreadPool;
mGeneralThreadPool = NULL;
- if (LLFastTimerView::sAnalyzePerformance)
- {
- LL_INFOS() << "Analyzing performance" << LL_ENDL;
+ if (LLFastTimerView::sAnalyzePerformance)
+ {
+ LL_INFOS() << "Analyzing performance" << LL_ENDL;
- std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp";
- std::string current_name = LLTrace::BlockTimer::sLogName + ".slp";
- std::string report_name = LLTrace::BlockTimer::sLogName + "_report.csv";
+ std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp";
+ std::string current_name = LLTrace::BlockTimer::sLogName + ".slp";
+ std::string report_name = LLTrace::BlockTimer::sLogName + "_report.csv";
- LLFastTimerView::doAnalysis(
- gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name),
- gDirUtilp->getExpandedFilename(LL_PATH_LOGS, current_name),
- gDirUtilp->getExpandedFilename(LL_PATH_LOGS, report_name));
- }
+ LLFastTimerView::doAnalysis(
+ gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name),
+ gDirUtilp->getExpandedFilename(LL_PATH_LOGS, current_name),
+ gDirUtilp->getExpandedFilename(LL_PATH_LOGS, report_name));
+ }
- SUBSYSTEM_CLEANUP(LLMetricPerformanceTesterBasic) ;
+ SUBSYSTEM_CLEANUP(LLMetricPerformanceTesterBasic) ;
- LL_INFOS() << "Cleaning up Media and Textures" << LL_ENDL;
+ LL_INFOS() << "Cleaning up Media and Textures" << LL_ENDL;
- //Note:
- //SUBSYSTEM_CLEANUP(LLViewerMedia) has to be put before gTextureList.shutdown()
- //because some new image might be generated during cleaning up media. --bao
- gTextureList.shutdown(); // shutdown again in case a callback added something
- LLUIImageList::getInstance()->cleanUp();
+ //Note:
+ //SUBSYSTEM_CLEANUP(LLViewerMedia) has to be put before gTextureList.shutdown()
+ //because some new image might be generated during cleaning up media. --bao
+ gTextureList.shutdown(); // shutdown again in case a callback added something
+ LLUIImageList::getInstance()->cleanUp();
- SUBSYSTEM_CLEANUP(LLImage);
- SUBSYSTEM_CLEANUP(LLLFSThread);
+ SUBSYSTEM_CLEANUP(LLImage);
+ SUBSYSTEM_CLEANUP(LLLFSThread);
- LL_INFOS() << "Misc Cleanup" << LL_ENDL;
+ LL_INFOS() << "Misc Cleanup" << LL_ENDL;
- gSavedSettings.cleanup();
- LLUIColorTable::instance().clear();
+ gSavedSettings.cleanup();
+ LLUIColorTable::instance().clear();
- LLWatchdog::getInstance()->cleanup();
+ LLWatchdog::getInstance()->cleanup();
- LLViewerAssetStatsFF::cleanup();
+ LLViewerAssetStatsFF::cleanup();
- // If we're exiting to launch an URL, do that here so the screen
- // is at the right resolution before we launch IE.
- if (!gLaunchFileOnQuit.empty())
- {
- LL_INFOS() << "Launch file on quit." << LL_ENDL;
+ // If we're exiting to launch an URL, do that here so the screen
+ // is at the right resolution before we launch IE.
+ if (!gLaunchFileOnQuit.empty())
+ {
+ LL_INFOS() << "Launch file on quit." << LL_ENDL;
#if LL_WINDOWS
- // Indicate an application is starting.
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ // Indicate an application is starting.
+ SetCursor(LoadCursor(NULL, IDC_WAIT));
#endif
- // HACK: Attempt to wait until the screen res. switch is complete.
- ms_sleep(1000);
+ // HACK: Attempt to wait until the screen res. switch is complete.
+ ms_sleep(1000);
- LLWeb::loadURLExternal( gLaunchFileOnQuit, false );
- LL_INFOS() << "File launched." << LL_ENDL;
- }
- // make sure nothing uses applyProxySettings by this point.
- LL_INFOS() << "Cleaning up LLProxy." << LL_ENDL;
- SUBSYSTEM_CLEANUP(LLProxy);
+ LLWeb::loadURLExternal( gLaunchFileOnQuit, false );
+ LL_INFOS() << "File launched." << LL_ENDL;
+ }
+ // make sure nothing uses applyProxySettings by this point.
+ LL_INFOS() << "Cleaning up LLProxy." << LL_ENDL;
+ SUBSYSTEM_CLEANUP(LLProxy);
LLCore::LLHttp::cleanup();
- ll_close_fail_log();
+ ll_close_fail_log();
- LLError::LLCallStacks::cleanup();
+ LLError::LLCallStacks::cleanup();
- LLEnvironment::deleteSingleton();
- LLSelectMgr::deleteSingleton();
- LLViewerEventRecorder::deleteSingleton();
+ LLEnvironment::deleteSingleton();
+ LLSelectMgr::deleteSingleton();
+ LLViewerEventRecorder::deleteSingleton();
LLWorld::deleteSingleton();
LLVoiceClient::deleteSingleton();
- // It's not at first obvious where, in this long sequence, a generic cleanup
- // call OUGHT to go. So let's say this: as we migrate cleanup from
- // explicit hand-placed calls into the generic mechanism, eventually
- // all cleanup will get subsumed into the generic call. So the calls you
- // still see above are calls that MUST happen before the generic cleanup
- // kicks in.
+ // It's not at first obvious where, in this long sequence, a generic cleanup
+ // call OUGHT to go. So let's say this: as we migrate cleanup from
+ // explicit hand-placed calls into the generic mechanism, eventually
+ // all cleanup will get subsumed into the generic call. So the calls you
+ // still see above are calls that MUST happen before the generic cleanup
+ // kicks in.
- // This calls every remaining LLSingleton's cleanupSingleton() and
- // deleteSingleton() methods.
- LLSingletonBase::deleteAll();
+ // This calls every remaining LLSingleton's cleanupSingleton() and
+ // deleteSingleton() methods.
+ LLSingletonBase::deleteAll();
LLSplashScreen::hide();
LL_INFOS() << "Goodbye!" << LL_ENDL;
- removeDumpDir();
+ removeDumpDir();
- // return 0;
- return true;
+ // return 0;
+ return true;
}
void LLAppViewer::initGeneralThread()
@@ -2194,11 +2194,11 @@ void LLAppViewer::initGeneralThread()
bool LLAppViewer::initThreads()
{
- static const bool enable_threads = true;
+ static const bool enable_threads = true;
- LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
+ LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
- LLLFSThread::initClass(enable_threads && true); // TODO: fix crashes associated with this shutdo
+ LLLFSThread::initClass(enable_threads && true); // TODO: fix crashes associated with this shutdo
//auto configure thread count
LLSD threadCounts = gSavedSettings.getLLSD("ThreadPoolSizes");
@@ -2213,39 +2213,39 @@ bool LLAppViewer::initThreads()
}
// The only configurable thread count right now is ImageDecode
- // The viewer typically starts around 8 threads not including image decode,
+ // The viewer typically starts around 8 threads not including image decode,
// so try to leave at least one core free
S32 image_decode_count = llclamp(cores - 9, 1, 8);
threadCounts["ImageDecode"] = image_decode_count;
gSavedSettings.setLLSD("ThreadPoolSizes", threadCounts);
- // Image decoding
- LLAppViewer::sImageDecodeThread = new LLImageDecodeThread(enable_threads && true);
- LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true);
- LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(),
- enable_threads && true,
- app_metrics_qa_mode);
+ // Image decoding
+ LLAppViewer::sImageDecodeThread = new LLImageDecodeThread(enable_threads && true);
+ LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true);
+ LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(),
+ enable_threads && true,
+ app_metrics_qa_mode);
// general task background thread (LLPerfStats, etc)
LLAppViewer::instance()->initGeneralThread();
- LLAppViewer::sPurgeDiskCacheThread = new LLPurgeDiskCacheThread();
+ LLAppViewer::sPurgeDiskCacheThread = new LLPurgeDiskCacheThread();
- if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog)
- {
- LLTrace::BlockTimer::setLogLock(new LLMutex());
- mFastTimerLogThread = new LLFastTimerLogThread(LLTrace::BlockTimer::sLogName);
- mFastTimerLogThread->start();
- }
+ if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog)
+ {
+ LLTrace::BlockTimer::setLogLock(new LLMutex());
+ mFastTimerLogThread = new LLFastTimerLogThread(LLTrace::BlockTimer::sLogName);
+ mFastTimerLogThread->start();
+ }
- // Mesh streaming and caching
- gMeshRepo.init();
+ // Mesh streaming and caching
+ gMeshRepo.init();
- LLFilePickerThread::initClass();
- LLDirPickerThread::initClass();
+ LLFilePickerThread::initClass();
+ LLDirPickerThread::initClass();
- // *FIX: no error handling here!
- return true;
+ // *FIX: no error handling here!
+ return true;
}
void errorCallback(LLError::ELevel level, const std::string &error_string)
@@ -2289,7 +2289,7 @@ void LLAppViewer::initLoggingAndGetLastDuration()
if (mSecondInstance)
{
LLFile::mkdir(gDirUtilp->getDumpLogsDirPath());
-
+
LLUUID uid;
uid.generate();
LLError::logToFile(gDirUtilp->getDumpLogsDirPath(uid.asString() + ".log"));
@@ -2360,123 +2360,123 @@ void LLAppViewer::initLoggingAndGetLastDuration()
}
bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key,
- bool set_defaults)
+ bool set_defaults)
{
- if (!mSettingsLocationList)
- {
- LL_ERRS() << "Invalid settings location list" << LL_ENDL;
- }
-
- for (const SettingsGroup& group : mSettingsLocationList->groups)
- {
- // skip settings groups that aren't the one we requested
- if (group.name() != location_key) continue;
-
- ELLPath path_index = (ELLPath)group.path_index();
- if(path_index <= LL_PATH_NONE || path_index >= LL_PATH_LAST)
- {
- LL_ERRS() << "Out of range path index in app_settings/settings_files.xml" << LL_ENDL;
- return false;
- }
-
- for (const SettingsFile& file : group.files)
- {
- LL_INFOS("Settings") << "Attempting to load settings for the group " << file.name()
- << " - from location " << location_key << LL_ENDL;
-
- auto settings_group = LLControlGroup::getInstance(file.name);
- if(!settings_group)
- {
- LL_WARNS("Settings") << "No matching settings group for name " << file.name() << LL_ENDL;
- continue;
- }
-
- std::string full_settings_path;
-
- if (file.file_name_setting.isProvided()
- && gSavedSettings.controlExists(file.file_name_setting))
- {
- // try to find filename stored in file_name_setting control
- full_settings_path = gSavedSettings.getString(file.file_name_setting);
- if (full_settings_path.empty())
- {
- continue;
- }
- else if (!gDirUtilp->fileExists(full_settings_path))
- {
- // search in default path
- full_settings_path = gDirUtilp->getExpandedFilename((ELLPath)path_index, full_settings_path);
- }
- }
- else
- {
- // by default, use specified file name
- full_settings_path = gDirUtilp->getExpandedFilename((ELLPath)path_index, file.file_name());
- }
-
- if(settings_group->loadFromFile(full_settings_path, set_defaults, file.persistent))
- { // success!
- LL_INFOS("Settings") << "Loaded settings file " << full_settings_path << LL_ENDL;
- }
- else
- { // failed to load
- if(file.required)
- {
+ if (!mSettingsLocationList)
+ {
+ LL_ERRS() << "Invalid settings location list" << LL_ENDL;
+ }
+
+ for (const SettingsGroup& group : mSettingsLocationList->groups)
+ {
+ // skip settings groups that aren't the one we requested
+ if (group.name() != location_key) continue;
+
+ ELLPath path_index = (ELLPath)group.path_index();
+ if(path_index <= LL_PATH_NONE || path_index >= LL_PATH_LAST)
+ {
+ LL_ERRS() << "Out of range path index in app_settings/settings_files.xml" << LL_ENDL;
+ return false;
+ }
+
+ for (const SettingsFile& file : group.files)
+ {
+ LL_INFOS("Settings") << "Attempting to load settings for the group " << file.name()
+ << " - from location " << location_key << LL_ENDL;
+
+ auto settings_group = LLControlGroup::getInstance(file.name);
+ if(!settings_group)
+ {
+ LL_WARNS("Settings") << "No matching settings group for name " << file.name() << LL_ENDL;
+ continue;
+ }
+
+ std::string full_settings_path;
+
+ if (file.file_name_setting.isProvided()
+ && gSavedSettings.controlExists(file.file_name_setting))
+ {
+ // try to find filename stored in file_name_setting control
+ full_settings_path = gSavedSettings.getString(file.file_name_setting);
+ if (full_settings_path.empty())
+ {
+ continue;
+ }
+ else if (!gDirUtilp->fileExists(full_settings_path))
+ {
+ // search in default path
+ full_settings_path = gDirUtilp->getExpandedFilename((ELLPath)path_index, full_settings_path);
+ }
+ }
+ else
+ {
+ // by default, use specified file name
+ full_settings_path = gDirUtilp->getExpandedFilename((ELLPath)path_index, file.file_name());
+ }
+
+ if(settings_group->loadFromFile(full_settings_path, set_defaults, file.persistent))
+ { // success!
+ LL_INFOS("Settings") << "Loaded settings file " << full_settings_path << LL_ENDL;
+ }
+ else
+ { // failed to load
+ if(file.required)
+ {
LLError::LLUserWarningMsg::showMissingFiles();
- LL_ERRS() << "Error: Cannot load required settings file from: " << full_settings_path << LL_ENDL;
- return false;
- }
- else
- {
- // only complain if we actually have a filename at this point
- if (!full_settings_path.empty())
- {
- LL_INFOS("Settings") << "Cannot load " << full_settings_path << " - No settings found." << LL_ENDL;
- }
- }
- }
- }
- }
-
- return true;
+ LL_ERRS() << "Error: Cannot load required settings file from: " << full_settings_path << LL_ENDL;
+ return false;
+ }
+ else
+ {
+ // only complain if we actually have a filename at this point
+ if (!full_settings_path.empty())
+ {
+ LL_INFOS("Settings") << "Cannot load " << full_settings_path << " - No settings found." << LL_ENDL;
+ }
+ }
+ }
+ }
+ }
+
+ return true;
}
std::string LLAppViewer::getSettingsFilename(const std::string& location_key,
- const std::string& file)
+ const std::string& file)
{
- for (const SettingsGroup& group : mSettingsLocationList->groups)
- {
- if (group.name() == location_key)
- {
- for (const SettingsFile& settings_file : group.files)
- {
- if (settings_file.name() == file)
- {
- return settings_file.file_name;
- }
- }
- }
- }
-
- return std::string();
+ for (const SettingsGroup& group : mSettingsLocationList->groups)
+ {
+ if (group.name() == location_key)
+ {
+ for (const SettingsFile& settings_file : group.files)
+ {
+ if (settings_file.name() == file)
+ {
+ return settings_file.file_name;
+ }
+ }
+ }
+ }
+
+ return std::string();
}
void LLAppViewer::loadColorSettings()
{
- LLUIColorTable::instance().loadFromSettings();
+ LLUIColorTable::instance().loadFromSettings();
}
namespace
{
void handleCommandLineError(LLControlGroupCLP& clp)
{
- LL_WARNS() << "Error parsing command line options. Command Line options ignored." << LL_ENDL;
+ LL_WARNS() << "Error parsing command line options. Command Line options ignored." << LL_ENDL;
- LL_INFOS() << "Command line usage:\n" << clp << LL_ENDL;
+ LL_INFOS() << "Command line usage:\n" << clp << LL_ENDL;
- OSMessageBox(STRINGIZE(LLTrans::getString("MBCmdLineError") << clp.getErrorMessage()),
- LLStringUtil::null,
- OSMB_OK);
+ OSMessageBox(STRINGIZE(LLTrans::getString("MBCmdLineError") << clp.getErrorMessage()),
+ LLStringUtil::null,
+ OSMB_OK);
}
} // anonymous namespace
@@ -2484,42 +2484,42 @@ namespace
// Name can be specified as "<control_group>.<control_name>", with default group being Global.
bool tempSetControl(const std::string& name, const std::string& value)
{
- std::string name_part;
- std::string group_part;
- LLControlVariable* control = NULL;
-
- // Name can be further split into ControlGroup.Name, with the default control group being Global
- size_t pos = name.find('.');
- if (pos != std::string::npos)
- {
- group_part = name.substr(0, pos);
- name_part = name.substr(pos+1);
- LL_INFOS() << "Setting " << group_part << "." << name_part << " to " << value << LL_ENDL;
- auto g = LLControlGroup::getInstance(group_part);
- if (g) control = g->getControl(name_part);
- }
- else
- {
- LL_INFOS() << "Setting Global." << name << " to " << value << LL_ENDL;
- control = gSavedSettings.getControl(name);
- }
-
- if (control)
- {
- control->setValue(value, false);
- return true;
- }
- return false;
+ std::string name_part;
+ std::string group_part;
+ LLControlVariable* control = NULL;
+
+ // Name can be further split into ControlGroup.Name, with the default control group being Global
+ size_t pos = name.find('.');
+ if (pos != std::string::npos)
+ {
+ group_part = name.substr(0, pos);
+ name_part = name.substr(pos+1);
+ LL_INFOS() << "Setting " << group_part << "." << name_part << " to " << value << LL_ENDL;
+ auto g = LLControlGroup::getInstance(group_part);
+ if (g) control = g->getControl(name_part);
+ }
+ else
+ {
+ LL_INFOS() << "Setting Global." << name << " to " << value << LL_ENDL;
+ control = gSavedSettings.getControl(name);
+ }
+
+ if (control)
+ {
+ control->setValue(value, false);
+ return true;
+ }
+ return false;
}
bool LLAppViewer::initConfiguration()
{
- //Load settings files list
- std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml");
- LLXMLNodePtr root;
- BOOL success = LLXMLNode::parseFile(settings_file_list, root, NULL);
- if (!success)
- {
+ //Load settings files list
+ std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml");
+ LLXMLNodePtr root;
+ BOOL success = LLXMLNode::parseFile(settings_file_list, root, NULL);
+ if (!success)
+ {
LL_WARNS() << "Cannot load default configuration file " << settings_file_list << LL_ENDL;
LLError::LLUserWarningMsg::showMissingFiles();
if (gDirUtilp->fileExists(settings_file_list))
@@ -2536,175 +2536,175 @@ bool LLAppViewer::initConfiguration()
<< "and contact https://support.secondlife.com if issue persists after reinstall."
<< LL_ENDL;
}
- }
+ }
- mSettingsLocationList = new SettingsFiles();
+ mSettingsLocationList = new SettingsFiles();
- LLXUIParser parser;
- parser.readXUI(root, *mSettingsLocationList, settings_file_list);
+ LLXUIParser parser;
+ parser.readXUI(root, *mSettingsLocationList, settings_file_list);
- if (!mSettingsLocationList->validateBlock())
- {
+ if (!mSettingsLocationList->validateBlock())
+ {
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS() << "Invalid settings file list " << settings_file_list << LL_ENDL;
- }
-
- // The settings and command line parsing have a fragile
- // order-of-operation:
- // - load defaults from app_settings
- // - set procedural settings values
- // - read command line settings
- // - selectively apply settings needed to load user settings.
+ }
+
+ // The settings and command line parsing have a fragile
+ // order-of-operation:
+ // - load defaults from app_settings
+ // - set procedural settings values
+ // - read command line settings
+ // - selectively apply settings needed to load user settings.
// - load overrides from user_settings
- // - apply command line settings (to override the overrides)
- // - load per account settings (happens in llstartup
-
- // - load defaults
- bool set_defaults = true;
- if(!loadSettingsFromDirectory("Default", set_defaults))
- {
- OSMessageBox(
- "Unable to load default settings file. The installation may be corrupted.",
- LLStringUtil::null,OSMB_OK);
- return false;
- }
-
- initStrings(); // setup paths for LLTrans based on settings files only
- // - set procedural settings
- // Note: can't use LL_PATH_PER_SL_ACCOUNT for any of these since we haven't logged in yet
- gSavedSettings.setString("ClientSettingsFile",
+ // - apply command line settings (to override the overrides)
+ // - load per account settings (happens in llstartup
+
+ // - load defaults
+ bool set_defaults = true;
+ if(!loadSettingsFromDirectory("Default", set_defaults))
+ {
+ OSMessageBox(
+ "Unable to load default settings file. The installation may be corrupted.",
+ LLStringUtil::null,OSMB_OK);
+ return false;
+ }
+
+ initStrings(); // setup paths for LLTrans based on settings files only
+ // - set procedural settings
+ // Note: can't use LL_PATH_PER_SL_ACCOUNT for any of these since we haven't logged in yet
+ gSavedSettings.setString("ClientSettingsFile",
gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Global")));
-#ifndef LL_RELEASE_FOR_DOWNLOAD
- // provide developer build only overrides for these control variables that are not
- // persisted to settings.xml
- LLControlVariable* c = gSavedSettings.getControl("AllowMultipleViewers");
- if (c)
- {
- c->setValue(true, false);
- }
-
- gSavedSettings.setBOOL("QAMode", TRUE );
- gSavedSettings.setS32("WatchdogEnabled", 0);
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+ // provide developer build only overrides for these control variables that are not
+ // persisted to settings.xml
+ LLControlVariable* c = gSavedSettings.getControl("AllowMultipleViewers");
+ if (c)
+ {
+ c->setValue(true, false);
+ }
+
+ gSavedSettings.setBOOL("QAMode", TRUE );
+ gSavedSettings.setS32("WatchdogEnabled", 0);
#endif
- // These are warnings that appear on the first experience of that condition.
- // They are already set in the settings_default.xml file, but still need to be added to LLFirstUse
- // for disable/reset ability
-// LLFirstUse::addConfigVariable("FirstBalanceIncrease");
-// LLFirstUse::addConfigVariable("FirstBalanceDecrease");
-// LLFirstUse::addConfigVariable("FirstSit");
-// LLFirstUse::addConfigVariable("FirstMap");
-// LLFirstUse::addConfigVariable("FirstGoTo");
-// LLFirstUse::addConfigVariable("FirstBuild");
-// LLFirstUse::addConfigVariable("FirstLeftClickNoHit");
-// LLFirstUse::addConfigVariable("FirstTeleport");
-// LLFirstUse::addConfigVariable("FirstOverrideKeys");
-// LLFirstUse::addConfigVariable("FirstAttach");
-// LLFirstUse::addConfigVariable("FirstAppearance");
-// LLFirstUse::addConfigVariable("FirstInventory");
-// LLFirstUse::addConfigVariable("FirstSandbox");
-// LLFirstUse::addConfigVariable("FirstFlexible");
-// LLFirstUse::addConfigVariable("FirstDebugMenus");
-// LLFirstUse::addConfigVariable("FirstSculptedPrim");
-// LLFirstUse::addConfigVariable("FirstVoice");
-// LLFirstUse::addConfigVariable("FirstMedia");
-
- // - read command line settings.
- LLControlGroupCLP clp;
- std::string cmd_line_config = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,
- "cmd_line.xml");
-
- clp.configure(cmd_line_config, &gSavedSettings);
-
- if(!initParseCommandLine(clp))
- {
- handleCommandLineError(clp);
- return false;
- }
-
- // - selectively apply settings
-
- // If the user has specified a alternate settings file name.
- // Load it now before loading the user_settings/settings.xml
- if(clp.hasOption("settings"))
- {
- std::string user_settings_filename =
- gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
- clp.getOption("settings")[0]);
- gSavedSettings.setString("ClientSettingsFile", user_settings_filename);
- LL_INFOS("Settings") << "Using command line specified settings filename: "
- << user_settings_filename << LL_ENDL;
- }
-
- // - load overrides from user_settings
- loadSettingsFromDirectory("User");
-
- if (gSavedSettings.getBOOL("FirstRunThisInstall"))
- {
- // Set firstrun flag to indicate that some further init actiona should be taken
- // like determining screen DPI value and so on
- mIsFirstRun = true;
-
- gSavedSettings.setBOOL("FirstRunThisInstall", FALSE);
- }
-
- if (clp.hasOption("sessionsettings"))
- {
- std::string session_settings_filename = clp.getOption("sessionsettings")[0];
- gSavedSettings.setString("SessionSettingsFile", session_settings_filename);
- LL_INFOS("Settings") << "Using session settings filename: "
- << session_settings_filename << LL_ENDL;
- }
- loadSettingsFromDirectory("Session");
-
- if (clp.hasOption("usersessionsettings"))
- {
- std::string user_session_settings_filename = clp.getOption("usersessionsettings")[0];
- gSavedSettings.setString("UserSessionSettingsFile", user_session_settings_filename);
- LL_INFOS("Settings") << "Using user session settings filename: "
- << user_session_settings_filename << LL_ENDL;
-
- }
- loadSettingsFromDirectory("UserSession");
-
- // - apply command line settings
- if (! clp.notify())
- {
- handleCommandLineError(clp);
- return false;
- }
-
- // Register the core crash option as soon as we can
- // if we want gdb post-mortem on cores we need to be up and running
- // ASAP or we might miss init issue etc.
- if(gSavedSettings.getBOOL("DisableCrashLogger"))
- {
- LL_WARNS() << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << LL_ENDL;
- disableCrashlogger();
- }
-
- gNonInteractive = gSavedSettings.getBOOL("NonInteractive");
- // Handle initialization from settings.
- // Start up the debugging console before handling other options.
- if (gSavedSettings.getBOOL("ShowConsoleWindow") && !gNonInteractive)
- {
- initConsole();
- }
-
- if(clp.hasOption("help"))
- {
- std::ostringstream msg;
- msg << LLTrans::getString("MBCmdLineUsg") << "\n" << clp;
- LL_INFOS() << msg.str() << LL_ENDL;
-
- OSMessageBox(
- msg.str(),
- LLStringUtil::null,
- OSMB_OK);
-
- return false;
- }
+ // These are warnings that appear on the first experience of that condition.
+ // They are already set in the settings_default.xml file, but still need to be added to LLFirstUse
+ // for disable/reset ability
+// LLFirstUse::addConfigVariable("FirstBalanceIncrease");
+// LLFirstUse::addConfigVariable("FirstBalanceDecrease");
+// LLFirstUse::addConfigVariable("FirstSit");
+// LLFirstUse::addConfigVariable("FirstMap");
+// LLFirstUse::addConfigVariable("FirstGoTo");
+// LLFirstUse::addConfigVariable("FirstBuild");
+// LLFirstUse::addConfigVariable("FirstLeftClickNoHit");
+// LLFirstUse::addConfigVariable("FirstTeleport");
+// LLFirstUse::addConfigVariable("FirstOverrideKeys");
+// LLFirstUse::addConfigVariable("FirstAttach");
+// LLFirstUse::addConfigVariable("FirstAppearance");
+// LLFirstUse::addConfigVariable("FirstInventory");
+// LLFirstUse::addConfigVariable("FirstSandbox");
+// LLFirstUse::addConfigVariable("FirstFlexible");
+// LLFirstUse::addConfigVariable("FirstDebugMenus");
+// LLFirstUse::addConfigVariable("FirstSculptedPrim");
+// LLFirstUse::addConfigVariable("FirstVoice");
+// LLFirstUse::addConfigVariable("FirstMedia");
+
+ // - read command line settings.
+ LLControlGroupCLP clp;
+ std::string cmd_line_config = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,
+ "cmd_line.xml");
+
+ clp.configure(cmd_line_config, &gSavedSettings);
+
+ if(!initParseCommandLine(clp))
+ {
+ handleCommandLineError(clp);
+ return false;
+ }
+
+ // - selectively apply settings
+
+ // If the user has specified a alternate settings file name.
+ // Load it now before loading the user_settings/settings.xml
+ if(clp.hasOption("settings"))
+ {
+ std::string user_settings_filename =
+ gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+ clp.getOption("settings")[0]);
+ gSavedSettings.setString("ClientSettingsFile", user_settings_filename);
+ LL_INFOS("Settings") << "Using command line specified settings filename: "
+ << user_settings_filename << LL_ENDL;
+ }
+
+ // - load overrides from user_settings
+ loadSettingsFromDirectory("User");
+
+ if (gSavedSettings.getBOOL("FirstRunThisInstall"))
+ {
+ // Set firstrun flag to indicate that some further init actiona should be taken
+ // like determining screen DPI value and so on
+ mIsFirstRun = true;
+
+ gSavedSettings.setBOOL("FirstRunThisInstall", FALSE);
+ }
+
+ if (clp.hasOption("sessionsettings"))
+ {
+ std::string session_settings_filename = clp.getOption("sessionsettings")[0];
+ gSavedSettings.setString("SessionSettingsFile", session_settings_filename);
+ LL_INFOS("Settings") << "Using session settings filename: "
+ << session_settings_filename << LL_ENDL;
+ }
+ loadSettingsFromDirectory("Session");
+
+ if (clp.hasOption("usersessionsettings"))
+ {
+ std::string user_session_settings_filename = clp.getOption("usersessionsettings")[0];
+ gSavedSettings.setString("UserSessionSettingsFile", user_session_settings_filename);
+ LL_INFOS("Settings") << "Using user session settings filename: "
+ << user_session_settings_filename << LL_ENDL;
+
+ }
+ loadSettingsFromDirectory("UserSession");
+
+ // - apply command line settings
+ if (! clp.notify())
+ {
+ handleCommandLineError(clp);
+ return false;
+ }
+
+ // Register the core crash option as soon as we can
+ // if we want gdb post-mortem on cores we need to be up and running
+ // ASAP or we might miss init issue etc.
+ if(gSavedSettings.getBOOL("DisableCrashLogger"))
+ {
+ LL_WARNS() << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << LL_ENDL;
+ disableCrashlogger();
+ }
+
+ gNonInteractive = gSavedSettings.getBOOL("NonInteractive");
+ // Handle initialization from settings.
+ // Start up the debugging console before handling other options.
+ if (gSavedSettings.getBOOL("ShowConsoleWindow") && !gNonInteractive)
+ {
+ initConsole();
+ }
+
+ if(clp.hasOption("help"))
+ {
+ std::ostringstream msg;
+ msg << LLTrans::getString("MBCmdLineUsg") << "\n" << clp;
+ LL_INFOS() << msg.str() << LL_ENDL;
+
+ OSMessageBox(
+ msg.str(),
+ LLStringUtil::null,
+ OSMB_OK);
+
+ return false;
+ }
if(clp.hasOption("set"))
{
@@ -2722,43 +2722,43 @@ bool LLAppViewer::initConfiguration()
const std::string& value = *(++itr);
if (!tempSetControl(name,value))
{
- LL_WARNS() << "Failed --set " << name << ": setting name unknown." << LL_ENDL;
+ LL_WARNS() << "Failed --set " << name << ": setting name unknown." << LL_ENDL;
}
}
}
}
if (clp.hasOption("logevents")) {
- LLViewerEventRecorder::instance().setEventLoggingOn();
+ LLViewerEventRecorder::instance().setEventLoggingOn();
}
- std::string CmdLineChannel(gSavedSettings.getString("CmdLineChannel"));
- if(! CmdLineChannel.empty())
+ std::string CmdLineChannel(gSavedSettings.getString("CmdLineChannel"));
+ if(! CmdLineChannel.empty())
{
- LLVersionInfo::instance().resetChannel(CmdLineChannel);
- }
+ LLVersionInfo::instance().resetChannel(CmdLineChannel);
+ }
- // If we have specified crash on startup, set the global so we'll trigger the crash at the right time
- gCrashOnStartup = gSavedSettings.getBOOL("CrashOnStartup");
+ // If we have specified crash on startup, set the global so we'll trigger the crash at the right time
+ gCrashOnStartup = gSavedSettings.getBOOL("CrashOnStartup");
- if (gSavedSettings.getBOOL("LogPerformance"))
- {
- LLTrace::BlockTimer::sLog = true;
- LLTrace::BlockTimer::sLogName = std::string("performance");
- }
+ if (gSavedSettings.getBOOL("LogPerformance"))
+ {
+ LLTrace::BlockTimer::sLog = true;
+ LLTrace::BlockTimer::sLogName = std::string("performance");
+ }
- std::string test_name(gSavedSettings.getString("LogMetrics"));
- if (! test_name.empty())
- {
- LLTrace::BlockTimer::sMetricLog = TRUE;
- // '--logmetrics' is specified with a named test metric argument so the data gathering is done only on that test
- // In the absence of argument, every metric would be gathered (makes for a rather slow run and hard to decipher report...)
- LL_INFOS() << "'--logmetrics' argument : " << test_name << LL_ENDL;
- LLTrace::BlockTimer::sLogName = test_name;
- }
+ std::string test_name(gSavedSettings.getString("LogMetrics"));
+ if (! test_name.empty())
+ {
+ LLTrace::BlockTimer::sMetricLog = TRUE;
+ // '--logmetrics' is specified with a named test metric argument so the data gathering is done only on that test
+ // In the absence of argument, every metric would be gathered (makes for a rather slow run and hard to decipher report...)
+ LL_INFOS() << "'--logmetrics' argument : " << test_name << LL_ENDL;
+ LLTrace::BlockTimer::sLogName = test_name;
+ }
- if (clp.hasOption("graphicslevel"))
- {
+ if (clp.hasOption("graphicslevel"))
+ {
// User explicitly requested --graphicslevel on the command line. We
// expect this switch has already set RenderQualityPerformance. Check
// that value for validity later.
@@ -2767,18 +2767,18 @@ bool LLAppViewer::initConfiguration()
// will call LLFeatureManager::applyRecommendedSettings(), which
// overwrites this settings variable!
mForceGraphicsLevel = gSavedSettings.getU32("RenderQualityPerformance");
- }
+ }
- LLFastTimerView::sAnalyzePerformance = gSavedSettings.getBOOL("AnalyzePerformance");
- gAgentPilot.setReplaySession(gSavedSettings.getBOOL("ReplaySession"));
+ LLFastTimerView::sAnalyzePerformance = gSavedSettings.getBOOL("AnalyzePerformance");
+ gAgentPilot.setReplaySession(gSavedSettings.getBOOL("ReplaySession"));
- if (gSavedSettings.getBOOL("DebugSession"))
- {
- gDebugSession = TRUE;
- gDebugGL = TRUE;
+ if (gSavedSettings.getBOOL("DebugSession"))
+ {
+ gDebugSession = TRUE;
+ gDebugGL = TRUE;
- ll_init_fail_log(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "test_failures.log"));
- }
+ ll_init_fail_log(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "test_failures.log"));
+ }
if (gSavedSettings.getBOOL("RenderDebugGLSession"))
{
@@ -2789,47 +2789,47 @@ bool LLAppViewer::initConfiguration()
gSavedSettings.setBOOL("RenderDebugGLSession", FALSE);
}
- const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
- if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString())
- {
- // Examining "Language" may not suffice -- see LLUI::getLanguage()
- // logic. Unfortunately LLUI::getLanguage() doesn't yet do us much
- // good because we haven't yet called LLUI::initClass().
- gDirUtilp->setSkinFolder(skinfolder->getValue().asString(),
- gSavedSettings.getString("Language"));
- }
-
- if (gSavedSettings.getBOOL("SpellCheck"))
- {
- std::list<std::string> dict_list;
- std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary");
- boost::split(dict_list, dict_setting, boost::is_any_of(std::string(",")));
- if (!dict_list.empty())
- {
- LLSpellChecker::setUseSpellCheck(dict_list.front());
- dict_list.pop_front();
- LLSpellChecker::instance().setSecondaryDictionaries(dict_list);
- }
- }
-
- if (gNonInteractive)
- {
- tempSetControl("AllowMultipleViewers", "TRUE");
- tempSetControl("SLURLPassToOtherInstance", "FALSE");
- tempSetControl("RenderWater", "FALSE");
- tempSetControl("FlyingAtExit", "FALSE");
- tempSetControl("WindowWidth", "1024");
- tempSetControl("WindowHeight", "200");
- LLError::setEnabledLogTypesMask(0);
- llassert_always(!gSavedSettings.getBOOL("SLURLPassToOtherInstance"));
- }
-
-
- // Handle slurl use. NOTE: Don't let SL-55321 reappear.
- // This initial-SLURL logic, up through the call to
- // sendURLToOtherInstance(), must precede LLSplashScreen::show() --
- // because if sendURLToOtherInstance() succeeds, we take a fast exit,
- // SKIPPING the splash screen and everything else.
+ const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
+ if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString())
+ {
+ // Examining "Language" may not suffice -- see LLUI::getLanguage()
+ // logic. Unfortunately LLUI::getLanguage() doesn't yet do us much
+ // good because we haven't yet called LLUI::initClass().
+ gDirUtilp->setSkinFolder(skinfolder->getValue().asString(),
+ gSavedSettings.getString("Language"));
+ }
+
+ if (gSavedSettings.getBOOL("SpellCheck"))
+ {
+ std::list<std::string> dict_list;
+ std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary");
+ boost::split(dict_list, dict_setting, boost::is_any_of(std::string(",")));
+ if (!dict_list.empty())
+ {
+ LLSpellChecker::setUseSpellCheck(dict_list.front());
+ dict_list.pop_front();
+ LLSpellChecker::instance().setSecondaryDictionaries(dict_list);
+ }
+ }
+
+ if (gNonInteractive)
+ {
+ tempSetControl("AllowMultipleViewers", "TRUE");
+ tempSetControl("SLURLPassToOtherInstance", "FALSE");
+ tempSetControl("RenderWater", "FALSE");
+ tempSetControl("FlyingAtExit", "FALSE");
+ tempSetControl("WindowWidth", "1024");
+ tempSetControl("WindowHeight", "200");
+ LLError::setEnabledLogTypesMask(0);
+ llassert_always(!gSavedSettings.getBOOL("SLURLPassToOtherInstance"));
+ }
+
+
+ // Handle slurl use. NOTE: Don't let SL-55321 reappear.
+ // This initial-SLURL logic, up through the call to
+ // sendURLToOtherInstance(), must precede LLSplashScreen::show() --
+ // because if sendURLToOtherInstance() succeeds, we take a fast exit,
+ // SKIPPING the splash screen and everything else.
// *FIX: This init code should be made more robust to prevent
// the issue SL-55321 from returning. One thought is to allow
@@ -2847,143 +2847,143 @@ bool LLAppViewer::initConfiguration()
// other browsers) and do the rough equivalent of command
// injection and steal passwords. Phoenix. SL-55321
- std::string starting_location;
-
- std::string cmd_line_login_location(gSavedSettings.getString("CmdLineLoginLocation"));
- if(! cmd_line_login_location.empty())
- {
- starting_location = cmd_line_login_location;
- }
- else
- {
- std::string default_login_location(gSavedSettings.getString("DefaultLoginLocation"));
- if (! default_login_location.empty())
- {
- starting_location = default_login_location;
- }
- }
-
- LLSLURL start_slurl;
- if (! starting_location.empty())
- {
- start_slurl = starting_location;
- LLStartUp::setStartSLURL(start_slurl);
- if(start_slurl.getType() == LLSLURL::LOCATION)
- {
- LLGridManager::getInstance()->setGridChoice(start_slurl.getGrid());
- }
- }
-
- // NextLoginLocation is set as a side effect of LLStartUp::setStartSLURL()
- std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
- if ( !nextLoginLocation.empty() )
- {
- LL_DEBUGS("AppInit")<<"set start from NextLoginLocation: "<<nextLoginLocation<<LL_ENDL;
- LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
- }
- else if ( ( clp.hasOption("login") || clp.hasOption("autologin"))
- && gSavedSettings.getString("CmdLineLoginLocation").empty())
- {
- // If automatic login from command line with --login switch
- // init StartSLURL location.
- std::string start_slurl_setting = gSavedSettings.getString("LoginLocation");
- LL_DEBUGS("AppInit") << "start slurl setting '" << start_slurl_setting << "'" << LL_ENDL;
- LLStartUp::setStartSLURL(LLSLURL(start_slurl_setting));
- }
- else
- {
- // the login location will be set by the login panel (see LLPanelLogin)
- }
-
- //RN: if we received a URL, hand it off to the existing instance.
- // don't call anotherInstanceRunning() when doing URL handoff, as
- // it relies on checking a marker file which will not work when running
- // out of different directories
-
- if (start_slurl.isValid() &&
- (gSavedSettings.getBOOL("SLURLPassToOtherInstance")))
- {
- if (sendURLToOtherInstance(start_slurl.getSLURLString()))
- {
- // successfully handed off URL to existing instance, exit
- return false;
- }
- }
-
- // Display splash screen. Must be after above check for previous
- // crash as this dialog is always frontmost.
- std::string splash_msg;
- LLStringUtil::format_map_t args;
- args["[APP_NAME]"] = LLTrans::getString("SECOND_LIFE");
- splash_msg = LLTrans::getString("StartupLoading", args);
- LLSplashScreen::show();
- LLSplashScreen::update(splash_msg);
-
- //LLVolumeMgr::initClass();
- LLVolumeMgr* volume_manager = new LLVolumeMgr();
- volume_manager->useMutex(); // LLApp and LLMutex magic must be manually enabled
- LLPrimitive::setVolumeManager(volume_manager);
-
- // Note: this is where we used to initialize gFeatureManagerp.
-
- gStartTime = totalTime();
-
- //
- // Set the name of the window
- //
- gWindowTitle = LLTrans::getString("APP_NAME");
+ std::string starting_location;
+
+ std::string cmd_line_login_location(gSavedSettings.getString("CmdLineLoginLocation"));
+ if(! cmd_line_login_location.empty())
+ {
+ starting_location = cmd_line_login_location;
+ }
+ else
+ {
+ std::string default_login_location(gSavedSettings.getString("DefaultLoginLocation"));
+ if (! default_login_location.empty())
+ {
+ starting_location = default_login_location;
+ }
+ }
+
+ LLSLURL start_slurl;
+ if (! starting_location.empty())
+ {
+ start_slurl = starting_location;
+ LLStartUp::setStartSLURL(start_slurl);
+ if(start_slurl.getType() == LLSLURL::LOCATION)
+ {
+ LLGridManager::getInstance()->setGridChoice(start_slurl.getGrid());
+ }
+ }
+
+ // NextLoginLocation is set as a side effect of LLStartUp::setStartSLURL()
+ std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
+ if ( !nextLoginLocation.empty() )
+ {
+ LL_DEBUGS("AppInit")<<"set start from NextLoginLocation: "<<nextLoginLocation<<LL_ENDL;
+ LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
+ }
+ else if ( ( clp.hasOption("login") || clp.hasOption("autologin"))
+ && gSavedSettings.getString("CmdLineLoginLocation").empty())
+ {
+ // If automatic login from command line with --login switch
+ // init StartSLURL location.
+ std::string start_slurl_setting = gSavedSettings.getString("LoginLocation");
+ LL_DEBUGS("AppInit") << "start slurl setting '" << start_slurl_setting << "'" << LL_ENDL;
+ LLStartUp::setStartSLURL(LLSLURL(start_slurl_setting));
+ }
+ else
+ {
+ // the login location will be set by the login panel (see LLPanelLogin)
+ }
+
+ //RN: if we received a URL, hand it off to the existing instance.
+ // don't call anotherInstanceRunning() when doing URL handoff, as
+ // it relies on checking a marker file which will not work when running
+ // out of different directories
+
+ if (start_slurl.isValid() &&
+ (gSavedSettings.getBOOL("SLURLPassToOtherInstance")))
+ {
+ if (sendURLToOtherInstance(start_slurl.getSLURLString()))
+ {
+ // successfully handed off URL to existing instance, exit
+ return false;
+ }
+ }
+
+ // Display splash screen. Must be after above check for previous
+ // crash as this dialog is always frontmost.
+ std::string splash_msg;
+ LLStringUtil::format_map_t args;
+ args["[APP_NAME]"] = LLTrans::getString("SECOND_LIFE");
+ splash_msg = LLTrans::getString("StartupLoading", args);
+ LLSplashScreen::show();
+ LLSplashScreen::update(splash_msg);
+
+ //LLVolumeMgr::initClass();
+ LLVolumeMgr* volume_manager = new LLVolumeMgr();
+ volume_manager->useMutex(); // LLApp and LLMutex magic must be manually enabled
+ LLPrimitive::setVolumeManager(volume_manager);
+
+ // Note: this is where we used to initialize gFeatureManagerp.
+
+ gStartTime = totalTime();
+
+ //
+ // Set the name of the window
+ //
+ gWindowTitle = LLTrans::getString("APP_NAME");
#if LL_DEBUG
- gWindowTitle += std::string(" [DEBUG]");
+ gWindowTitle += std::string(" [DEBUG]");
#endif
- if (!gArgs.empty())
- {
- gWindowTitle += std::string(" ") + gArgs;
- }
- LLStringUtil::truncate(gWindowTitle, 255);
-
- //
- // Check for another instance of the app running
- // This happens AFTER LLSplashScreen::show(). That may or may not be
- // important.
- //
- if (mSecondInstance && !gSavedSettings.getBOOL("AllowMultipleViewers"))
- {
- OSMessageBox(
- LLTrans::getString("MBAlreadyRunning"),
- LLStringUtil::null,
- OSMB_OK);
- return false;
- }
-
- if (mSecondInstance)
- {
- // This is the second instance of SL. Mute voice,
- // but make sure the setting is *not* persisted.
- // Also see LLVivoxVoiceClient::voiceEnabled()
- LLControlVariable* enable_voice = gSavedSettings.getControl("EnableVoiceChat");
- if(enable_voice)
- {
- const BOOL DO_NOT_PERSIST = FALSE;
- enable_voice->setValue(LLSD(FALSE), DO_NOT_PERSIST);
- }
- }
-
- gLastRunVersion = gSavedSettings.getString("LastRunVersion");
-
- loadColorSettings();
-
- // Let anyone else who cares know that we've populated our settings
- // variables.
- for (const auto& key : LLControlGroup::key_snapshot())
- {
- // For each named instance of LLControlGroup, send an event saying
- // we've initialized an LLControlGroup instance by that name.
- LLEventPumps::instance().obtain("LLControlGroup").post(LLSDMap("init", key));
- }
+ if (!gArgs.empty())
+ {
+ gWindowTitle += std::string(" ") + gArgs;
+ }
+ LLStringUtil::truncate(gWindowTitle, 255);
+
+ //
+ // Check for another instance of the app running
+ // This happens AFTER LLSplashScreen::show(). That may or may not be
+ // important.
+ //
+ if (mSecondInstance && !gSavedSettings.getBOOL("AllowMultipleViewers"))
+ {
+ OSMessageBox(
+ LLTrans::getString("MBAlreadyRunning"),
+ LLStringUtil::null,
+ OSMB_OK);
+ return false;
+ }
+
+ if (mSecondInstance)
+ {
+ // This is the second instance of SL. Mute voice,
+ // but make sure the setting is *not* persisted.
+ // Also see LLVivoxVoiceClient::voiceEnabled()
+ LLControlVariable* enable_voice = gSavedSettings.getControl("EnableVoiceChat");
+ if(enable_voice)
+ {
+ const BOOL DO_NOT_PERSIST = FALSE;
+ enable_voice->setValue(LLSD(FALSE), DO_NOT_PERSIST);
+ }
+ }
+
+ gLastRunVersion = gSavedSettings.getString("LastRunVersion");
+
+ loadColorSettings();
+
+ // Let anyone else who cares know that we've populated our settings
+ // variables.
+ for (const auto& key : LLControlGroup::key_snapshot())
+ {
+ // For each named instance of LLControlGroup, send an event saying
+ // we've initialized an LLControlGroup instance by that name.
+ LLEventPumps::instance().obtain("LLControlGroup").post(LLSDMap("init", key));
+ }
LLError::LLUserWarningMsg::setOutOfMemoryStrings(LLTrans::getString("MBOutOfMemoryTitle"), LLTrans::getString("MBOutOfMemoryErr"));
- return true; // Config was successful.
+ return true; // Config was successful.
}
// The following logic is replicated in initConfiguration() (to be able to get
@@ -2992,214 +2992,214 @@ bool LLAppViewer::initConfiguration()
// keeps growing, necessitating a method all its own.
void LLAppViewer::initStrings()
{
- std::string strings_file = "strings.xml";
- std::string strings_path_full = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, strings_file);
- if (strings_path_full.empty() || !LLFile::isfile(strings_path_full))
- {
- if (strings_path_full.empty())
- {
- LL_WARNS() << "The file '" << strings_file << "' is not found" << LL_ENDL;
- }
- else
- {
- llstat st;
- int rc = LLFile::stat(strings_path_full, &st);
- if (rc != 0)
- {
- LL_WARNS() << "The file '" << strings_path_full << "' failed to get status. Error code: " << rc << LL_ENDL;
- }
- else if (S_ISDIR(st.st_mode))
- {
- LL_WARNS() << "The filename '" << strings_path_full << "' is a directory name" << LL_ENDL;
- }
- else
- {
- LL_WARNS() << "The filename '" << strings_path_full << "' doesn't seem to be a regular file name" << LL_ENDL;
- }
- }
-
- // initial check to make sure files are there failed
- gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN);
+ std::string strings_file = "strings.xml";
+ std::string strings_path_full = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, strings_file);
+ if (strings_path_full.empty() || !LLFile::isfile(strings_path_full))
+ {
+ if (strings_path_full.empty())
+ {
+ LL_WARNS() << "The file '" << strings_file << "' is not found" << LL_ENDL;
+ }
+ else
+ {
+ llstat st;
+ int rc = LLFile::stat(strings_path_full, &st);
+ if (rc != 0)
+ {
+ LL_WARNS() << "The file '" << strings_path_full << "' failed to get status. Error code: " << rc << LL_ENDL;
+ }
+ else if (S_ISDIR(st.st_mode))
+ {
+ LL_WARNS() << "The filename '" << strings_path_full << "' is a directory name" << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "The filename '" << strings_path_full << "' doesn't seem to be a regular file name" << LL_ENDL;
+ }
+ }
+
+ // initial check to make sure files are there failed
+ gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN);
LLError::LLUserWarningMsg::showMissingFiles();
- LL_ERRS() << "Viewer failed to find localization and UI files."
- << " Please reinstall viewer from https://secondlife.com/support/downloads"
- << " and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL;
- }
- LLTransUtil::parseStrings(strings_file, default_trans_args);
- LLTransUtil::parseLanguageStrings("language_settings.xml");
-
- // parseStrings() sets up the LLTrans substitution table. Add this one item.
- LLTrans::setDefaultArg("[sourceid]", gSavedSettings.getString("sourceid"));
-
- // Now that we've set "[sourceid]", have to go back through
- // default_trans_args and reinitialize all those other keys because some
- // of them, in turn, reference "[sourceid]".
- for (const std::string& key : default_trans_args)
- {
- std::string brackets(key), nobrackets(key);
- // Invalid to inspect key[0] if key is empty(). But then, the entire
- // body of this loop is pointless if key is empty().
- if (key.empty())
- continue;
-
- if (key[0] != '[')
- {
- // key was passed without brackets. That means that 'nobrackets'
- // is correct but 'brackets' is not.
- brackets = STRINGIZE('[' << brackets << ']');
- }
- else
- {
- // key was passed with brackets. That means that 'brackets' is
- // correct but 'nobrackets' is not. Erase the left bracket.
- nobrackets.erase(0, 1);
- std::string::size_type length(nobrackets.length());
- if (length && nobrackets[length - 1] == ']')
- {
- nobrackets.erase(length - 1);
- }
- }
- // Calling LLTrans::getString() is what embeds the other default
- // translation strings into this one.
- LLTrans::setDefaultArg(brackets, LLTrans::getString(nobrackets));
- }
+ LL_ERRS() << "Viewer failed to find localization and UI files."
+ << " Please reinstall viewer from https://secondlife.com/support/downloads"
+ << " and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL;
+ }
+ LLTransUtil::parseStrings(strings_file, default_trans_args);
+ LLTransUtil::parseLanguageStrings("language_settings.xml");
+
+ // parseStrings() sets up the LLTrans substitution table. Add this one item.
+ LLTrans::setDefaultArg("[sourceid]", gSavedSettings.getString("sourceid"));
+
+ // Now that we've set "[sourceid]", have to go back through
+ // default_trans_args and reinitialize all those other keys because some
+ // of them, in turn, reference "[sourceid]".
+ for (const std::string& key : default_trans_args)
+ {
+ std::string brackets(key), nobrackets(key);
+ // Invalid to inspect key[0] if key is empty(). But then, the entire
+ // body of this loop is pointless if key is empty().
+ if (key.empty())
+ continue;
+
+ if (key[0] != '[')
+ {
+ // key was passed without brackets. That means that 'nobrackets'
+ // is correct but 'brackets' is not.
+ brackets = STRINGIZE('[' << brackets << ']');
+ }
+ else
+ {
+ // key was passed with brackets. That means that 'brackets' is
+ // correct but 'nobrackets' is not. Erase the left bracket.
+ nobrackets.erase(0, 1);
+ std::string::size_type length(nobrackets.length());
+ if (length && nobrackets[length - 1] == ']')
+ {
+ nobrackets.erase(length - 1);
+ }
+ }
+ // Calling LLTrans::getString() is what embeds the other default
+ // translation strings into this one.
+ LLTrans::setDefaultArg(brackets, LLTrans::getString(nobrackets));
+ }
}
bool LLAppViewer::meetsRequirementsForMaximizedStart()
{
bool maximizedOk = (gSysMemory.getPhysicalMemoryKB() >= U32Gigabytes(1));
- return maximizedOk;
+ return maximizedOk;
}
bool LLAppViewer::initWindow()
{
- LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL;
-
- // store setting in a global for easy access and modification
- gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient");
-
- // always start windowed
- BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth");
-
- LLViewerWindow::Params window_params;
- window_params
- .title(gWindowTitle)
- .name(VIEWER_WINDOW_CLASSNAME)
- .x(gSavedSettings.getS32("WindowX"))
- .y(gSavedSettings.getS32("WindowY"))
- .width(gSavedSettings.getU32("WindowWidth"))
- .height(gSavedSettings.getU32("WindowHeight"))
- .min_width(gSavedSettings.getU32("MinWindowWidth"))
- .min_height(gSavedSettings.getU32("MinWindowHeight"))
- .fullscreen(gSavedSettings.getBOOL("FullScreen"))
- .ignore_pixel_depth(ignorePixelDepth)
- .first_run(mIsFirstRun);
-
- gViewerWindow = new LLViewerWindow(window_params);
-
- LL_INFOS("AppInit") << "gViewerwindow created." << LL_ENDL;
-
- // Need to load feature table before cheking to start watchdog.
- bool use_watchdog = false;
- int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled");
- if (watchdog_enabled_setting == -1)
- {
- use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled");
- }
- else
- {
- // The user has explicitly set this setting; always use that value.
- use_watchdog = bool(watchdog_enabled_setting);
- }
-
- LL_INFOS("AppInit") << "watchdog"
- << (use_watchdog ? " " : " NOT ")
- << "enabled"
- << " (setting = " << watchdog_enabled_setting << ")"
- << LL_ENDL;
-
- if (use_watchdog)
- {
- LLWatchdog::getInstance()->init();
- }
-
- LLNotificationsUI::LLNotificationManager::getInstance();
+ LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL;
+
+ // store setting in a global for easy access and modification
+ gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient");
+
+ // always start windowed
+ BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth");
+
+ LLViewerWindow::Params window_params;
+ window_params
+ .title(gWindowTitle)
+ .name(VIEWER_WINDOW_CLASSNAME)
+ .x(gSavedSettings.getS32("WindowX"))
+ .y(gSavedSettings.getS32("WindowY"))
+ .width(gSavedSettings.getU32("WindowWidth"))
+ .height(gSavedSettings.getU32("WindowHeight"))
+ .min_width(gSavedSettings.getU32("MinWindowWidth"))
+ .min_height(gSavedSettings.getU32("MinWindowHeight"))
+ .fullscreen(gSavedSettings.getBOOL("FullScreen"))
+ .ignore_pixel_depth(ignorePixelDepth)
+ .first_run(mIsFirstRun);
+
+ gViewerWindow = new LLViewerWindow(window_params);
+
+ LL_INFOS("AppInit") << "gViewerwindow created." << LL_ENDL;
+
+ // Need to load feature table before cheking to start watchdog.
+ bool use_watchdog = false;
+ int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled");
+ if (watchdog_enabled_setting == -1)
+ {
+ use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled");
+ }
+ else
+ {
+ // The user has explicitly set this setting; always use that value.
+ use_watchdog = bool(watchdog_enabled_setting);
+ }
+
+ LL_INFOS("AppInit") << "watchdog"
+ << (use_watchdog ? " " : " NOT ")
+ << "enabled"
+ << " (setting = " << watchdog_enabled_setting << ")"
+ << LL_ENDL;
+
+ if (use_watchdog)
+ {
+ LLWatchdog::getInstance()->init();
+ }
+
+ LLNotificationsUI::LLNotificationManager::getInstance();
#ifdef LL_DARWIN
- //Satisfy both MAINT-3135 (OSX 10.6 and earlier) MAINT-3288 (OSX 10.7 and later)
- LLOSInfo& os_info = LLOSInfo::instance();
- if (os_info.mMajorVer == 10 && os_info.mMinorVer < 7)
- {
- if ( os_info.mMinorVer == 6 && os_info.mBuild < 8 )
- gViewerWindow->getWindow()->setOldResize(true);
- }
+ //Satisfy both MAINT-3135 (OSX 10.6 and earlier) MAINT-3288 (OSX 10.7 and later)
+ LLOSInfo& os_info = LLOSInfo::instance();
+ if (os_info.mMajorVer == 10 && os_info.mMinorVer < 7)
+ {
+ if ( os_info.mMinorVer == 6 && os_info.mBuild < 8 )
+ gViewerWindow->getWindow()->setOldResize(true);
+ }
#endif
- if (gSavedSettings.getBOOL("WindowMaximized"))
- {
- gViewerWindow->getWindow()->maximize();
- }
+ if (gSavedSettings.getBOOL("WindowMaximized"))
+ {
+ gViewerWindow->getWindow()->maximize();
+ }
- //
- // Initialize GL stuff
- //
+ //
+ // Initialize GL stuff
+ //
- if (mForceGraphicsLevel && (LLFeatureManager::instance().isValidGraphicsLevel(*mForceGraphicsLevel)))
- {
- LLFeatureManager::getInstance()->setGraphicsLevel(*mForceGraphicsLevel, false);
- gSavedSettings.setU32("RenderQualityPerformance", *mForceGraphicsLevel);
- }
+ if (mForceGraphicsLevel && (LLFeatureManager::instance().isValidGraphicsLevel(*mForceGraphicsLevel)))
+ {
+ LLFeatureManager::getInstance()->setGraphicsLevel(*mForceGraphicsLevel, false);
+ gSavedSettings.setU32("RenderQualityPerformance", *mForceGraphicsLevel);
+ }
- // Set this flag in case we crash while initializing GL
- gSavedSettings.setBOOL("RenderInitError", TRUE);
- gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
+ // Set this flag in case we crash while initializing GL
+ gSavedSettings.setBOOL("RenderInitError", TRUE);
+ gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
- gPipeline.init();
- LL_INFOS("AppInit") << "gPipeline Initialized" << LL_ENDL;
+ gPipeline.init();
+ LL_INFOS("AppInit") << "gPipeline Initialized" << LL_ENDL;
- stop_glerror();
- gViewerWindow->initGLDefaults();
+ stop_glerror();
+ gViewerWindow->initGLDefaults();
- gSavedSettings.setBOOL("RenderInitError", FALSE);
- gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
+ gSavedSettings.setBOOL("RenderInitError", FALSE);
+ gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
- //If we have a startup crash, it's usually near GL initialization, so simulate that.
- if(gCrashOnStartup)
- {
- LLAppViewer::instance()->forceErrorLLError();
- }
+ //If we have a startup crash, it's usually near GL initialization, so simulate that.
+ if(gCrashOnStartup)
+ {
+ LLAppViewer::instance()->forceErrorLLError();
+ }
- //
- // Determine if the window should start maximized on initial run based
- // on graphics capability
- //
- if (gSavedSettings.getBOOL("FirstLoginThisInstall") && meetsRequirementsForMaximizedStart())
- {
- LL_INFOS("AppInit") << "This client met the requirements for a maximized initial screen." << LL_ENDL;
- gSavedSettings.setBOOL("WindowMaximized", TRUE);
- }
+ //
+ // Determine if the window should start maximized on initial run based
+ // on graphics capability
+ //
+ if (gSavedSettings.getBOOL("FirstLoginThisInstall") && meetsRequirementsForMaximizedStart())
+ {
+ LL_INFOS("AppInit") << "This client met the requirements for a maximized initial screen." << LL_ENDL;
+ gSavedSettings.setBOOL("WindowMaximized", TRUE);
+ }
- if (gSavedSettings.getBOOL("WindowMaximized"))
- {
- gViewerWindow->getWindow()->maximize();
- }
+ if (gSavedSettings.getBOOL("WindowMaximized"))
+ {
+ gViewerWindow->getWindow()->maximize();
+ }
- LLUI::getInstance()->mWindow = gViewerWindow->getWindow();
+ LLUI::getInstance()->mWindow = gViewerWindow->getWindow();
- // Show watch cursor
- gViewerWindow->setCursor(UI_CURSOR_WAIT);
+ // Show watch cursor
+ gViewerWindow->setCursor(UI_CURSOR_WAIT);
- // Finish view initialization
- gViewerWindow->initBase();
+ // Finish view initialization
+ gViewerWindow->initBase();
- // show viewer window
- //gViewerWindow->getWindow()->show();
+ // show viewer window
+ //gViewerWindow->getWindow()->show();
- LL_INFOS("AppInit") << "Window initialization done." << LL_ENDL;
+ LL_INFOS("AppInit") << "Window initialization done." << LL_ENDL;
- return true;
+ return true;
}
bool LLAppViewer::isUpdaterMissing()
@@ -3238,28 +3238,28 @@ void LLAppViewer::writeDebugInfo(bool isStatic)
LLSD LLAppViewer::getViewerInfo() const
{
- // The point of having one method build an LLSD info block and the other
- // construct the user-visible About string is to ensure that the same info
- // is available to a getInfo() caller as to the user opening
- // LLFloaterAbout.
- LLSD info;
- auto& versionInfo(LLVersionInfo::instance());
- // With GitHub builds, the build number is too big to fit in a 32-bit int,
- // and LLSD doesn't deal with integers wider than int. Use string.
- info["VIEWER_VERSION"] = llsd::array(versionInfo.getMajor(), versionInfo.getMinor(),
- versionInfo.getPatch(), stringize(versionInfo.getBuild()));
- info["VIEWER_VERSION_STR"] = versionInfo.getVersion();
- info["CHANNEL"] = versionInfo.getChannel();
- info["ADDRESS_SIZE"] = ADDRESS_SIZE;
- std::string build_config = versionInfo.getBuildConfig();
- if (build_config != "Release")
- {
- info["BUILD_CONFIG"] = build_config;
- }
-
- // return a URL to the release notes for this viewer, such as:
- // https://releasenotes.secondlife.com/viewer/2.1.0.123456.html
- std::string url = versionInfo.getReleaseNotes(); // VVM supplied
+ // The point of having one method build an LLSD info block and the other
+ // construct the user-visible About string is to ensure that the same info
+ // is available to a getInfo() caller as to the user opening
+ // LLFloaterAbout.
+ LLSD info;
+ auto& versionInfo(LLVersionInfo::instance());
+ // With GitHub builds, the build number is too big to fit in a 32-bit int,
+ // and LLSD doesn't deal with integers wider than int. Use string.
+ info["VIEWER_VERSION"] = llsd::array(versionInfo.getMajor(), versionInfo.getMinor(),
+ versionInfo.getPatch(), stringize(versionInfo.getBuild()));
+ info["VIEWER_VERSION_STR"] = versionInfo.getVersion();
+ info["CHANNEL"] = versionInfo.getChannel();
+ info["ADDRESS_SIZE"] = ADDRESS_SIZE;
+ std::string build_config = versionInfo.getBuildConfig();
+ if (build_config != "Release")
+ {
+ info["BUILD_CONFIG"] = build_config;
+ }
+
+ // return a URL to the release notes for this viewer, such as:
+ // https://releasenotes.secondlife.com/viewer/2.1.0.123456.html
+ std::string url = versionInfo.getReleaseNotes(); // VVM supplied
if (url.empty())
{
url = LLTrans::getString("RELEASE_NOTES_BASE_URL");
@@ -3267,32 +3267,32 @@ LLSD LLAppViewer::getViewerInfo() const
url += "/";
url += LLURI::escape(versionInfo.getVersion()) + ".html";
}
- info["VIEWER_RELEASE_NOTES_URL"] = url;
-
- // Position
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
- LLVector3d pos = gAgent.getPositionGlobal();
- info["POSITION"] = ll_sd_from_vector3d(pos);
- info["POSITION_LOCAL"] = ll_sd_from_vector3(gAgent.getPosAgentFromGlobal(pos));
- info["REGION"] = gAgent.getRegion()->getName();
-
- boost::regex regex("\\.(secondlife|lindenlab)\\..*");
- info["HOSTNAME"] = boost::regex_replace(gAgent.getRegion()->getSimHostName(), regex, "");
- info["SERVER_VERSION"] = gLastVersionChannel;
- LLSLURL slurl;
- LLAgentUI::buildSLURL(slurl);
- info["SLURL"] = slurl.getSLURLString();
- }
-
- // CPU
- info["CPU"] = gSysCPU.getCPUString();
- info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits<LLUnits::Megabytes>());
- // Moved hack adjustment to Windows memory size into llsys.cpp
- info["OS_VERSION"] = LLOSInfo::instance().getOSString();
- info["GRAPHICS_CARD_VENDOR"] = ll_safe_string((const char*)(glGetString(GL_VENDOR)));
- info["GRAPHICS_CARD"] = ll_safe_string((const char*)(glGetString(GL_RENDERER)));
+ info["VIEWER_RELEASE_NOTES_URL"] = url;
+
+ // Position
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ LLVector3d pos = gAgent.getPositionGlobal();
+ info["POSITION"] = ll_sd_from_vector3d(pos);
+ info["POSITION_LOCAL"] = ll_sd_from_vector3(gAgent.getPosAgentFromGlobal(pos));
+ info["REGION"] = gAgent.getRegion()->getName();
+
+ boost::regex regex("\\.(secondlife|lindenlab)\\..*");
+ info["HOSTNAME"] = boost::regex_replace(gAgent.getRegion()->getSimHostName(), regex, "");
+ info["SERVER_VERSION"] = gLastVersionChannel;
+ LLSLURL slurl;
+ LLAgentUI::buildSLURL(slurl);
+ info["SLURL"] = slurl.getSLURLString();
+ }
+
+ // CPU
+ info["CPU"] = gSysCPU.getCPUString();
+ info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits<LLUnits::Megabytes>());
+ // Moved hack adjustment to Windows memory size into llsys.cpp
+ info["OS_VERSION"] = LLOSInfo::instance().getOSString();
+ info["GRAPHICS_CARD_VENDOR"] = ll_safe_string((const char*)(glGetString(GL_VENDOR)));
+ info["GRAPHICS_CARD"] = ll_safe_string((const char*)(glGetString(GL_RENDERER)));
#if LL_WINDOWS
std::string drvinfo;
@@ -3317,22 +3317,22 @@ LLSD LLAppViewer::getViewerInfo() const
drvinfo = gDXHardware.getDriverVersionWMI(LLDXHardware::GPU_ANY);
}
- if (!drvinfo.empty())
- {
- info["GRAPHICS_DRIVER_VERSION"] = drvinfo;
- }
- else
- {
- LL_WARNS("DriverVersion")<< "Cannot get driver version from getDriverVersionWMI" << LL_ENDL;
- LLSD driver_info = gDXHardware.getDisplayInfo();
- if (driver_info.has("DriverVersion"))
- {
- info["GRAPHICS_DRIVER_VERSION"] = driver_info["DriverVersion"];
- }
- }
+ if (!drvinfo.empty())
+ {
+ info["GRAPHICS_DRIVER_VERSION"] = drvinfo;
+ }
+ else
+ {
+ LL_WARNS("DriverVersion")<< "Cannot get driver version from getDriverVersionWMI" << LL_ENDL;
+ LLSD driver_info = gDXHardware.getDisplayInfo();
+ if (driver_info.has("DriverVersion"))
+ {
+ info["GRAPHICS_DRIVER_VERSION"] = driver_info["DriverVersion"];
+ }
+ }
#endif
- info["OPENGL_VERSION"] = ll_safe_string((const char*)(glGetString(GL_VERSION)));
+ info["OPENGL_VERSION"] = ll_safe_string((const char*)(glGetString(GL_VERSION)));
// Settings
@@ -3351,16 +3351,16 @@ LLSD LLAppViewer::getViewerInfo() const
info["HIDPI"] = gHiDPISupport;
#endif
- // Libraries
+ // Libraries
- info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
- bool want_fullname = true;
- info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : "Undefined";
- if(LLVoiceClient::getInstance()->voiceEnabled())
- {
+ info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
+ bool want_fullname = true;
+ info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : "Undefined";
+ if(LLVoiceClient::getInstance()->voiceEnabled())
+ {
LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
const std::string build_version = version.mBuildVersion;
- std::ostringstream version_string;
+ std::ostringstream version_string;
if (std::equal(build_version.begin(), build_version.begin() + version.serverVersion.size(),
version.serverVersion.begin()))
{ // Normal case: Show type and build version.
@@ -3370,210 +3370,210 @@ LLSD LLAppViewer::getViewerInfo() const
{ // Mismatch: Show both versions.
version_string << version.serverVersion << "/" << build_version << std::endl;
}
- info["VOICE_VERSION"] = version_string.str();
- }
- else
- {
- info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
- }
+ info["VOICE_VERSION"] = version_string.str();
+ }
+ else
+ {
+ info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
+ }
#if !LL_LINUX
- std::ostringstream cef_ver_codec;
- cef_ver_codec << "Dullahan: ";
- cef_ver_codec << DULLAHAN_VERSION_MAJOR;
- cef_ver_codec << ".";
- cef_ver_codec << DULLAHAN_VERSION_MINOR;
- cef_ver_codec << ".";
- cef_ver_codec << DULLAHAN_VERSION_POINT;
- cef_ver_codec << ".";
- cef_ver_codec << DULLAHAN_VERSION_BUILD;
-
- cef_ver_codec << std::endl;
- cef_ver_codec << " CEF: ";
- cef_ver_codec << CEF_VERSION;
-
- cef_ver_codec << std::endl;
- cef_ver_codec << " Chromium: ";
- cef_ver_codec << CHROME_VERSION_MAJOR;
- cef_ver_codec << ".";
- cef_ver_codec << CHROME_VERSION_MINOR;
- cef_ver_codec << ".";
- cef_ver_codec << CHROME_VERSION_BUILD;
- cef_ver_codec << ".";
- cef_ver_codec << CHROME_VERSION_PATCH;
-
- info["LIBCEF_VERSION"] = cef_ver_codec.str();
+ std::ostringstream cef_ver_codec;
+ cef_ver_codec << "Dullahan: ";
+ cef_ver_codec << DULLAHAN_VERSION_MAJOR;
+ cef_ver_codec << ".";
+ cef_ver_codec << DULLAHAN_VERSION_MINOR;
+ cef_ver_codec << ".";
+ cef_ver_codec << DULLAHAN_VERSION_POINT;
+ cef_ver_codec << ".";
+ cef_ver_codec << DULLAHAN_VERSION_BUILD;
+
+ cef_ver_codec << std::endl;
+ cef_ver_codec << " CEF: ";
+ cef_ver_codec << CEF_VERSION;
+
+ cef_ver_codec << std::endl;
+ cef_ver_codec << " Chromium: ";
+ cef_ver_codec << CHROME_VERSION_MAJOR;
+ cef_ver_codec << ".";
+ cef_ver_codec << CHROME_VERSION_MINOR;
+ cef_ver_codec << ".";
+ cef_ver_codec << CHROME_VERSION_BUILD;
+ cef_ver_codec << ".";
+ cef_ver_codec << CHROME_VERSION_PATCH;
+
+ info["LIBCEF_VERSION"] = cef_ver_codec.str();
#else
- info["LIBCEF_VERSION"] = "Undefined";
+ info["LIBCEF_VERSION"] = "Undefined";
#endif
#if !LL_LINUX
- std::ostringstream vlc_ver_codec;
- vlc_ver_codec << LIBVLC_VERSION_MAJOR;
- vlc_ver_codec << ".";
- vlc_ver_codec << LIBVLC_VERSION_MINOR;
- vlc_ver_codec << ".";
- vlc_ver_codec << LIBVLC_VERSION_REVISION;
- info["LIBVLC_VERSION"] = vlc_ver_codec.str();
+ std::ostringstream vlc_ver_codec;
+ vlc_ver_codec << LIBVLC_VERSION_MAJOR;
+ vlc_ver_codec << ".";
+ vlc_ver_codec << LIBVLC_VERSION_MINOR;
+ vlc_ver_codec << ".";
+ vlc_ver_codec << LIBVLC_VERSION_REVISION;
+ info["LIBVLC_VERSION"] = vlc_ver_codec.str();
#else
- info["LIBVLC_VERSION"] = "Undefined";
+ info["LIBVLC_VERSION"] = "Undefined";
#endif
- S32 packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
- if (packets_in > 0)
- {
- info["PACKETS_LOST"] = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_LOST);
- info["PACKETS_IN"] = packets_in;
- info["PACKETS_PCT"] = 100.f*info["PACKETS_LOST"].asReal() / info["PACKETS_IN"].asReal();
- }
-
- if (mServerReleaseNotesURL.empty())
- {
- if (gAgent.getRegion())
- {
- info["SERVER_RELEASE_NOTES_URL"] = LLTrans::getString("RetrievingData");
- }
- else
- {
- info["SERVER_RELEASE_NOTES_URL"] = LLTrans::getString("NotConnected");
- }
- }
- else if (LLStringUtil::startsWith(mServerReleaseNotesURL, "http")) // it's an URL
- {
- info["SERVER_RELEASE_NOTES_URL"] = "[" + LLWeb::escapeURL(mServerReleaseNotesURL) + " " + LLTrans::getString("ReleaseNotes") + "]";
- }
- else
- {
- info["SERVER_RELEASE_NOTES_URL"] = mServerReleaseNotesURL;
- }
+ S32 packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
+ if (packets_in > 0)
+ {
+ info["PACKETS_LOST"] = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_LOST);
+ info["PACKETS_IN"] = packets_in;
+ info["PACKETS_PCT"] = 100.f*info["PACKETS_LOST"].asReal() / info["PACKETS_IN"].asReal();
+ }
+
+ if (mServerReleaseNotesURL.empty())
+ {
+ if (gAgent.getRegion())
+ {
+ info["SERVER_RELEASE_NOTES_URL"] = LLTrans::getString("RetrievingData");
+ }
+ else
+ {
+ info["SERVER_RELEASE_NOTES_URL"] = LLTrans::getString("NotConnected");
+ }
+ }
+ else if (LLStringUtil::startsWith(mServerReleaseNotesURL, "http")) // it's an URL
+ {
+ info["SERVER_RELEASE_NOTES_URL"] = "[" + LLWeb::escapeURL(mServerReleaseNotesURL) + " " + LLTrans::getString("ReleaseNotes") + "]";
+ }
+ else
+ {
+ info["SERVER_RELEASE_NOTES_URL"] = mServerReleaseNotesURL;
+ }
// populate field for new local disk cache with some details
info["DISK_CACHE_INFO"] = LLDiskCache::getInstance()->getCacheInfo();
- return info;
+ return info;
}
std::string LLAppViewer::getViewerInfoString(bool default_string) const
{
- std::ostringstream support;
-
- LLSD info(getViewerInfo());
-
- // Render the LLSD from getInfo() as a format_map_t
- LLStringUtil::format_map_t args;
-
- // allow the "Release Notes" URL label to be localized
- args["ReleaseNotes"] = LLTrans::getString("ReleaseNotes", default_string);
-
- for (LLSD::map_const_iterator ii(info.beginMap()), iend(info.endMap());
- ii != iend; ++ii)
- {
- if (! ii->second.isArray())
- {
- // Scalar value
- if (ii->second.isUndefined())
- {
- args[ii->first] = LLTrans::getString("none_text", default_string);
- }
- else
- {
- // don't forget to render value asString()
- args[ii->first] = ii->second.asString();
- }
- }
- else
- {
- // array value: build KEY_0, KEY_1 etc. entries
- for (LLSD::Integer n(0), size(ii->second.size()); n < size; ++n)
- {
- args[STRINGIZE(ii->first << '_' << n)] = ii->second[n].asString();
- }
- }
- }
-
- // Now build the various pieces
- support << LLTrans::getString("AboutHeader", args, default_string);
- if (info.has("BUILD_CONFIG"))
- {
- support << "\n" << LLTrans::getString("BuildConfig", args, default_string);
- }
- if (info.has("REGION"))
- {
- support << "\n\n" << LLTrans::getString("AboutPosition", args, default_string);
- }
- support << "\n\n" << LLTrans::getString("AboutSystem", args, default_string);
- support << "\n";
- if (info.has("GRAPHICS_DRIVER_VERSION"))
- {
- support << "\n" << LLTrans::getString("AboutDriver", args, default_string);
- }
- support << "\n" << LLTrans::getString("AboutOGL", args, default_string);
- support << "\n\n" << LLTrans::getString("AboutSettings", args, default_string);
+ std::ostringstream support;
+
+ LLSD info(getViewerInfo());
+
+ // Render the LLSD from getInfo() as a format_map_t
+ LLStringUtil::format_map_t args;
+
+ // allow the "Release Notes" URL label to be localized
+ args["ReleaseNotes"] = LLTrans::getString("ReleaseNotes", default_string);
+
+ for (LLSD::map_const_iterator ii(info.beginMap()), iend(info.endMap());
+ ii != iend; ++ii)
+ {
+ if (! ii->second.isArray())
+ {
+ // Scalar value
+ if (ii->second.isUndefined())
+ {
+ args[ii->first] = LLTrans::getString("none_text", default_string);
+ }
+ else
+ {
+ // don't forget to render value asString()
+ args[ii->first] = ii->second.asString();
+ }
+ }
+ else
+ {
+ // array value: build KEY_0, KEY_1 etc. entries
+ for (LLSD::Integer n(0), size(ii->second.size()); n < size; ++n)
+ {
+ args[STRINGIZE(ii->first << '_' << n)] = ii->second[n].asString();
+ }
+ }
+ }
+
+ // Now build the various pieces
+ support << LLTrans::getString("AboutHeader", args, default_string);
+ if (info.has("BUILD_CONFIG"))
+ {
+ support << "\n" << LLTrans::getString("BuildConfig", args, default_string);
+ }
+ if (info.has("REGION"))
+ {
+ support << "\n\n" << LLTrans::getString("AboutPosition", args, default_string);
+ }
+ support << "\n\n" << LLTrans::getString("AboutSystem", args, default_string);
+ support << "\n";
+ if (info.has("GRAPHICS_DRIVER_VERSION"))
+ {
+ support << "\n" << LLTrans::getString("AboutDriver", args, default_string);
+ }
+ support << "\n" << LLTrans::getString("AboutOGL", args, default_string);
+ support << "\n\n" << LLTrans::getString("AboutSettings", args, default_string);
#if LL_DARWIN
- support << "\n" << LLTrans::getString("AboutOSXHiDPI", args, default_string);
+ support << "\n" << LLTrans::getString("AboutOSXHiDPI", args, default_string);
#endif
- support << "\n\n" << LLTrans::getString("AboutLibs", args, default_string);
- if (info.has("COMPILER"))
- {
- support << "\n" << LLTrans::getString("AboutCompiler", args, default_string);
- }
- if (info.has("PACKETS_IN"))
- {
- support << '\n' << LLTrans::getString("AboutTraffic", args, default_string);
- }
-
- // SLT timestamp
- LLSD substitution;
- substitution["datetime"] = (S32)time(NULL);//(S32)time_corrected();
- support << "\n" << LLTrans::getString("AboutTime", substitution, default_string);
-
- return support.str();
+ support << "\n\n" << LLTrans::getString("AboutLibs", args, default_string);
+ if (info.has("COMPILER"))
+ {
+ support << "\n" << LLTrans::getString("AboutCompiler", args, default_string);
+ }
+ if (info.has("PACKETS_IN"))
+ {
+ support << '\n' << LLTrans::getString("AboutTraffic", args, default_string);
+ }
+
+ // SLT timestamp
+ LLSD substitution;
+ substitution["datetime"] = (S32)time(NULL);//(S32)time_corrected();
+ support << "\n" << LLTrans::getString("AboutTime", substitution, default_string);
+
+ return support.str();
}
void LLAppViewer::cleanupSavedSettings()
{
- gSavedSettings.setBOOL("MouseSun", FALSE);
+ gSavedSettings.setBOOL("MouseSun", FALSE);
- gSavedSettings.setBOOL("UseEnergy", TRUE); // force toggle to turn off, since sends message to simulator
+ gSavedSettings.setBOOL("UseEnergy", TRUE); // force toggle to turn off, since sends message to simulator
- gSavedSettings.setBOOL("DebugWindowProc", gDebugWindowProc);
+ gSavedSettings.setBOOL("DebugWindowProc", gDebugWindowProc);
- gSavedSettings.setBOOL("ShowObjectUpdates", gShowObjectUpdates);
+ gSavedSettings.setBOOL("ShowObjectUpdates", gShowObjectUpdates);
- if (gDebugView)
- {
- gSavedSettings.setBOOL("ShowDebugConsole", gDebugView->mDebugConsolep->getVisible());
- }
+ if (gDebugView)
+ {
+ gSavedSettings.setBOOL("ShowDebugConsole", gDebugView->mDebugConsolep->getVisible());
+ }
- // save window position if not maximized
- // as we don't track it in callbacks
- if(NULL != gViewerWindow)
- {
- BOOL maximized = gViewerWindow->getWindow()->getMaximized();
- if (!maximized)
- {
- LLCoordScreen window_pos;
+ // save window position if not maximized
+ // as we don't track it in callbacks
+ if(NULL != gViewerWindow)
+ {
+ BOOL maximized = gViewerWindow->getWindow()->getMaximized();
+ if (!maximized)
+ {
+ LLCoordScreen window_pos;
- if (gViewerWindow->getWindow()->getPosition(&window_pos))
- {
- gSavedSettings.setS32("WindowX", window_pos.mX);
- gSavedSettings.setS32("WindowY", window_pos.mY);
- }
- }
- }
+ if (gViewerWindow->getWindow()->getPosition(&window_pos))
+ {
+ gSavedSettings.setS32("WindowX", window_pos.mX);
+ gSavedSettings.setS32("WindowY", window_pos.mY);
+ }
+ }
+ }
gSavedSettings.setF32("MapScale", LLWorldMapView::getScaleSetting());
- // Some things are cached in LLAgent.
- if (gAgent.isInitialized())
- {
- gSavedSettings.setF32("RenderFarClip", gAgentCamera.mDrawDistance);
- }
+ // Some things are cached in LLAgent.
+ if (gAgent.isInitialized())
+ {
+ gSavedSettings.setF32("RenderFarClip", gAgentCamera.mDrawDistance);
+ }
}
void LLAppViewer::removeCacheFiles(const std::string& file_mask)
{
- gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), file_mask);
+ gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), file_mask);
}
void LLAppViewer::writeSystemInfo()
@@ -3583,96 +3583,96 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["Dynamic"] = LLSD::emptyMap();
#if LL_WINDOWS && !LL_BUGSPLAT
- gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log");
+ gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log");
#else
//Not ideal but sufficient for good reporting.
gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.old"); //LLError::logFileName();
#endif
- gDebugInfo["ClientInfo"]["Name"] = LLVersionInfo::instance().getChannel();
- gDebugInfo["ClientInfo"]["MajorVersion"] = LLVersionInfo::instance().getMajor();
- gDebugInfo["ClientInfo"]["MinorVersion"] = LLVersionInfo::instance().getMinor();
- gDebugInfo["ClientInfo"]["PatchVersion"] = LLVersionInfo::instance().getPatch();
- gDebugInfo["ClientInfo"]["BuildVersion"] = std::to_string(LLVersionInfo::instance().getBuild());
- gDebugInfo["ClientInfo"]["AddressSize"] = LLVersionInfo::instance().getAddressSize();
+ gDebugInfo["ClientInfo"]["Name"] = LLVersionInfo::instance().getChannel();
+ gDebugInfo["ClientInfo"]["MajorVersion"] = LLVersionInfo::instance().getMajor();
+ gDebugInfo["ClientInfo"]["MinorVersion"] = LLVersionInfo::instance().getMinor();
+ gDebugInfo["ClientInfo"]["PatchVersion"] = LLVersionInfo::instance().getPatch();
+ gDebugInfo["ClientInfo"]["BuildVersion"] = std::to_string(LLVersionInfo::instance().getBuild());
+ gDebugInfo["ClientInfo"]["AddressSize"] = LLVersionInfo::instance().getAddressSize();
- gDebugInfo["CAFilename"] = gDirUtilp->getCAFile();
+ gDebugInfo["CAFilename"] = gDirUtilp->getCAFile();
- gDebugInfo["CPUInfo"]["CPUString"] = gSysCPU.getCPUString();
- gDebugInfo["CPUInfo"]["CPUFamily"] = gSysCPU.getFamily();
- gDebugInfo["CPUInfo"]["CPUMhz"] = (S32)gSysCPU.getMHz();
- gDebugInfo["CPUInfo"]["CPUAltivec"] = gSysCPU.hasAltivec();
- gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE();
- gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2();
+ gDebugInfo["CPUInfo"]["CPUString"] = gSysCPU.getCPUString();
+ gDebugInfo["CPUInfo"]["CPUFamily"] = gSysCPU.getFamily();
+ gDebugInfo["CPUInfo"]["CPUMhz"] = (S32)gSysCPU.getMHz();
+ gDebugInfo["CPUInfo"]["CPUAltivec"] = gSysCPU.hasAltivec();
+ gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE();
+ gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2();
- gDebugInfo["RAMInfo"]["Physical"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().value());
- gDebugInfo["RAMInfo"]["Allocated"] = LLSD::Integer(gMemoryAllocated.valueInUnits<LLUnits::Kilobytes>());
- gDebugInfo["OSInfo"] = LLOSInfo::instance().getOSStringSimple();
+ gDebugInfo["RAMInfo"]["Physical"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().value());
+ gDebugInfo["RAMInfo"]["Allocated"] = LLSD::Integer(gMemoryAllocated.valueInUnits<LLUnits::Kilobytes>());
+ gDebugInfo["OSInfo"] = LLOSInfo::instance().getOSStringSimple();
- // The user is not logged on yet, but record the current grid choice login url
- // which may have been the intended grid.
- gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridId();
+ // The user is not logged on yet, but record the current grid choice login url
+ // which may have been the intended grid.
+ gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridId();
- // *FIX:Mani - move this down in llappviewerwin32
+ // *FIX:Mani - move this down in llappviewerwin32
#ifdef LL_WINDOWS
- DWORD thread_id = GetCurrentThreadId();
- gDebugInfo["MainloopThreadID"] = (S32)thread_id;
+ DWORD thread_id = GetCurrentThreadId();
+ gDebugInfo["MainloopThreadID"] = (S32)thread_id;
#endif
#ifndef LL_BUGSPLAT
- // "CrashNotHandled" is set here, while things are running well,
- // in case of a freeze. If there is a freeze, the crash logger will be launched
- // and can read this value from the debug_info.log.
- gDebugInfo["CrashNotHandled"] = LLSD::Boolean(true);
+ // "CrashNotHandled" is set here, while things are running well,
+ // in case of a freeze. If there is a freeze, the crash logger will be launched
+ // and can read this value from the debug_info.log.
+ gDebugInfo["CrashNotHandled"] = LLSD::Boolean(true);
#else // LL_BUGSPLAT
- // "CrashNotHandled" is obsolete; it used (not very successsfully)
+ // "CrashNotHandled" is obsolete; it used (not very successsfully)
// to try to distinguish crashes from freezes - the intent here to to avoid calling it a freeze
- gDebugInfo["CrashNotHandled"] = LLSD::Boolean(false);
+ gDebugInfo["CrashNotHandled"] = LLSD::Boolean(false);
#endif // ! LL_BUGSPLAT
- // Insert crash host url (url to post crash log to) if configured. This insures
- // that the crash report will go to the proper location in the case of a
- // prior freeze.
- std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl");
- if(crashHostUrl != "")
- {
- gDebugInfo["CrashHostUrl"] = crashHostUrl;
- }
-
- // Dump some debugging info
- LL_INFOS("SystemInfo") << "Application: " << LLTrans::getString("APP_NAME") << LL_ENDL;
- LL_INFOS("SystemInfo") << "Version: " << LLVersionInfo::instance().getChannelAndVersion() << LL_ENDL;
-
- // Dump the local time and time zone
- time_t now;
- time(&now);
- char tbuffer[256]; /* Flawfinder: ignore */
- strftime(tbuffer, 256, "%Y-%m-%dT%H:%M:%S %Z", localtime(&now));
- LL_INFOS("SystemInfo") << "Local time: " << tbuffer << LL_ENDL;
-
- // query some system information
- LL_INFOS("SystemInfo") << "CPU info:\n" << gSysCPU << LL_ENDL;
- LL_INFOS("SystemInfo") << "Memory info:\n" << gSysMemory << LL_ENDL;
- LL_INFOS("SystemInfo") << "OS: " << LLOSInfo::instance().getOSStringSimple() << LL_ENDL;
- LL_INFOS("SystemInfo") << "OS info: " << LLOSInfo::instance() << LL_ENDL;
+ // Insert crash host url (url to post crash log to) if configured. This insures
+ // that the crash report will go to the proper location in the case of a
+ // prior freeze.
+ std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl");
+ if(crashHostUrl != "")
+ {
+ gDebugInfo["CrashHostUrl"] = crashHostUrl;
+ }
+
+ // Dump some debugging info
+ LL_INFOS("SystemInfo") << "Application: " << LLTrans::getString("APP_NAME") << LL_ENDL;
+ LL_INFOS("SystemInfo") << "Version: " << LLVersionInfo::instance().getChannelAndVersion() << LL_ENDL;
+
+ // Dump the local time and time zone
+ time_t now;
+ time(&now);
+ char tbuffer[256]; /* Flawfinder: ignore */
+ strftime(tbuffer, 256, "%Y-%m-%dT%H:%M:%S %Z", localtime(&now));
+ LL_INFOS("SystemInfo") << "Local time: " << tbuffer << LL_ENDL;
+
+ // query some system information
+ LL_INFOS("SystemInfo") << "CPU info:\n" << gSysCPU << LL_ENDL;
+ LL_INFOS("SystemInfo") << "Memory info:\n" << gSysMemory << LL_ENDL;
+ LL_INFOS("SystemInfo") << "OS: " << LLOSInfo::instance().getOSStringSimple() << LL_ENDL;
+ LL_INFOS("SystemInfo") << "OS info: " << LLOSInfo::instance() << LL_ENDL;
gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile");
- gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName();
- gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath();
- gDebugInfo["FirstLogin"] = LLSD::Boolean(gAgent.isFirstLogin());
- gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall");
+ gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName();
+ gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath();
+ gDebugInfo["FirstLogin"] = LLSD::Boolean(gAgent.isFirstLogin());
+ gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall");
gDebugInfo["StartupState"] = LLStartUp::getStartupStateString();
if (gViewerWindow)
{
- std::vector<std::string> resolutions = gViewerWindow->getWindow()->getDisplaysResolutionList();
- for (auto res_iter : resolutions)
- {
- gDebugInfo["DisplayInfo"].append(res_iter);
- }
+ std::vector<std::string> resolutions = gViewerWindow->getWindow()->getDisplaysResolutionList();
+ for (auto res_iter : resolutions)
+ {
+ gDebugInfo["DisplayInfo"].append(res_iter);
+ }
}
- writeDebugInfo(); // Save out debug_info.log early, in case of crash.
+ writeDebugInfo(); // Save out debug_info.log early, in case of crash.
}
#ifdef LL_WINDOWS
@@ -3684,265 +3684,265 @@ void LLAppViewer::writeSystemInfo()
// TODO make this a member function.
void getFileList()
{
- std::stringstream filenames;
-
- typedef std::vector<std::string> vec;
- std::string pathname = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"");
- vec file_vec = gDirUtilp->getFilesInDir(pathname);
- for(vec::const_iterator iter=file_vec.begin(); iter!=file_vec.end(); ++iter)
- {
- filenames << *iter << " ";
- if ( ( iter->length() > 30 ) && (iter->rfind(".dmp") == (iter->length()-4) ) )
- {
- std::string fullname = pathname + *iter;
- llifstream fdat( fullname.c_str(), std::ifstream::binary);
- if (fdat)
- {
- char buf[5];
- fdat.read(buf,4);
- fdat.close();
- if (!strncmp(buf,"MDMP",4))
- {
- gDebugInfo["Dynamic"]["MinidumpPath"] = fullname;
- break;
- }
- }
- }
- }
- filenames << std::endl;
- gDebugInfo["Dynamic"]["DumpDirContents"] = filenames.str();
+ std::stringstream filenames;
+
+ typedef std::vector<std::string> vec;
+ std::string pathname = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"");
+ vec file_vec = gDirUtilp->getFilesInDir(pathname);
+ for(vec::const_iterator iter=file_vec.begin(); iter!=file_vec.end(); ++iter)
+ {
+ filenames << *iter << " ";
+ if ( ( iter->length() > 30 ) && (iter->rfind(".dmp") == (iter->length()-4) ) )
+ {
+ std::string fullname = pathname + *iter;
+ llifstream fdat( fullname.c_str(), std::ifstream::binary);
+ if (fdat)
+ {
+ char buf[5];
+ fdat.read(buf,4);
+ fdat.close();
+ if (!strncmp(buf,"MDMP",4))
+ {
+ gDebugInfo["Dynamic"]["MinidumpPath"] = fullname;
+ break;
+ }
+ }
+ }
+ }
+ filenames << std::endl;
+ gDebugInfo["Dynamic"]["DumpDirContents"] = filenames.str();
}
#endif
// static
void LLAppViewer::recordMarkerVersion(LLAPRFile& marker_file)
{
- std::string marker_version(LLVersionInfo::instance().getChannelAndVersion());
- if ( marker_version.length() > MAX_MARKER_LENGTH )
- {
- LL_WARNS_ONCE("MarkerFile") << "Version length ("<< marker_version.length()<< ")"
- << " greater than maximum (" << MAX_MARKER_LENGTH << ")"
- << ": marker matching may be incorrect"
- << LL_ENDL;
- }
-
- // record the viewer version in the marker file
- marker_file.write(marker_version.data(), marker_version.length());
+ std::string marker_version(LLVersionInfo::instance().getChannelAndVersion());
+ if ( marker_version.length() > MAX_MARKER_LENGTH )
+ {
+ LL_WARNS_ONCE("MarkerFile") << "Version length ("<< marker_version.length()<< ")"
+ << " greater than maximum (" << MAX_MARKER_LENGTH << ")"
+ << ": marker matching may be incorrect"
+ << LL_ENDL;
+ }
+
+ // record the viewer version in the marker file
+ marker_file.write(marker_version.data(), marker_version.length());
}
bool LLAppViewer::markerIsSameVersion(const std::string& marker_name) const
{
- bool sameVersion = false;
-
- std::string my_version(LLVersionInfo::instance().getChannelAndVersion());
- char marker_version[MAX_MARKER_LENGTH];
- S32 marker_version_length;
-
- LLAPRFile marker_file;
- marker_file.open(marker_name, LL_APR_RB);
- if (marker_file.getFileHandle())
- {
- marker_version_length = marker_file.read(marker_version, sizeof(marker_version));
- std::string marker_string(marker_version, marker_version_length);
- if ( 0 == my_version.compare( 0, my_version.length(), marker_version, 0, marker_version_length ) )
- {
- sameVersion = true;
- }
- LL_DEBUGS("MarkerFile") << "Compare markers for '" << marker_name << "': "
- << "\n mine '" << my_version << "'"
- << "\n marker '" << marker_string << "'"
- << "\n " << ( sameVersion ? "same" : "different" ) << " version"
- << LL_ENDL;
- marker_file.close();
- }
- return sameVersion;
+ bool sameVersion = false;
+
+ std::string my_version(LLVersionInfo::instance().getChannelAndVersion());
+ char marker_version[MAX_MARKER_LENGTH];
+ S32 marker_version_length;
+
+ LLAPRFile marker_file;
+ marker_file.open(marker_name, LL_APR_RB);
+ if (marker_file.getFileHandle())
+ {
+ marker_version_length = marker_file.read(marker_version, sizeof(marker_version));
+ std::string marker_string(marker_version, marker_version_length);
+ if ( 0 == my_version.compare( 0, my_version.length(), marker_version, 0, marker_version_length ) )
+ {
+ sameVersion = true;
+ }
+ LL_DEBUGS("MarkerFile") << "Compare markers for '" << marker_name << "': "
+ << "\n mine '" << my_version << "'"
+ << "\n marker '" << marker_string << "'"
+ << "\n " << ( sameVersion ? "same" : "different" ) << " version"
+ << LL_ENDL;
+ marker_file.close();
+ }
+ return sameVersion;
}
void LLAppViewer::processMarkerFiles()
{
- //We've got 4 things to test for here
- // - Other Process Running (SecondLife.exec_marker present, locked)
- // - Freeze (SecondLife.exec_marker present, not locked)
- // - LLError Crash (SecondLife.llerror_marker present)
- // - Other Crash (SecondLife.error_marker present)
- // These checks should also remove these files for the last 2 cases if they currently exist
-
- std::ostringstream marker_log_stream;
- bool marker_is_same_version = true;
- // first, look for the marker created at startup and deleted on a clean exit
- mMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,MARKER_FILE_NAME);
- if (LLAPRFile::isExist(mMarkerFileName, NULL, LL_APR_RB))
- {
- // File exists...
- // first, read it to see if it was created by the same version (we need this later)
- marker_is_same_version = markerIsSameVersion(mMarkerFileName);
-
- // now test to see if this file is locked by a running process (try to open for write)
- marker_log_stream << "Checking exec marker file for lock...";
- mMarkerFile.open(mMarkerFileName, LL_APR_WB);
- apr_file_t* fMarker = mMarkerFile.getFileHandle() ;
- if (!fMarker)
- {
- marker_log_stream << "Exec marker file open failed - assume it is locked.";
- mSecondInstance = true; // lock means that instance is running.
- }
- else
- {
- // We were able to open it, now try to lock it ourselves...
- if (apr_file_lock(fMarker, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS)
- {
- marker_log_stream << "Locking exec marker failed.";
- mSecondInstance = true; // lost a race? be conservative
- }
- else
- {
- // No other instances; we've locked this file now, so record our version; delete on quit.
- recordMarkerVersion(mMarkerFile);
- marker_log_stream << "Exec marker file existed but was not locked; rewritten.";
- }
- }
- initLoggingAndGetLastDuration();
-
- std::string marker_log_msg(marker_log_stream.str());
- LL_INFOS("MarkerFile") << marker_log_msg << LL_ENDL;
-
- if (mSecondInstance)
- {
- LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' owned by another instance" << LL_ENDL;
- }
- else if (marker_is_same_version)
- {
- // the file existed, is ours, and matched our version, so we can report on what it says
- LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' found; last exec crashed" << LL_ENDL;
- gLastExecEvent = LAST_EXEC_OTHER_CRASH;
- }
- else
- {
- LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' found, but versions did not match" << LL_ENDL;
- }
- }
- else // marker did not exist... last exec (if any) did not freeze
- {
- initLoggingAndGetLastDuration();
- // Create the marker file for this execution & lock it; it will be deleted on a clean exit
- apr_status_t s;
- s = mMarkerFile.open(mMarkerFileName, LL_APR_WB, TRUE);
-
- if (s == APR_SUCCESS && mMarkerFile.getFileHandle())
- {
- LL_DEBUGS("MarkerFile") << "Exec marker file '"<< mMarkerFileName << "' created." << LL_ENDL;
- if (APR_SUCCESS == apr_file_lock(mMarkerFile.getFileHandle(), APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE))
- {
- recordMarkerVersion(mMarkerFile);
- LL_DEBUGS("MarkerFile") << "Exec marker file locked." << LL_ENDL;
- }
- else
- {
- LL_WARNS("MarkerFile") << "Exec marker file cannot be locked." << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("MarkerFile") << "Failed to create exec marker file '"<< mMarkerFileName << "'." << LL_ENDL;
- }
- }
-
- // now check for cases in which the exec marker may have been cleaned up by crash handlers
-
- // check for any last exec event report based on whether or not it happened during logout
- // (the logout marker is created when logout begins)
- std::string logout_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LOGOUT_MARKER_FILE_NAME);
- if(LLAPRFile::isExist(logout_marker_file, NULL, LL_APR_RB))
- {
- if (markerIsSameVersion(logout_marker_file))
- {
- gLastExecEvent = LAST_EXEC_LOGOUT_FROZE;
- LL_INFOS("MarkerFile") << "Logout crash marker '"<< logout_marker_file << "', changing LastExecEvent to LOGOUT_FROZE" << LL_ENDL;
- }
- else
- {
- LL_INFOS("MarkerFile") << "Logout crash marker '"<< logout_marker_file << "' found, but versions did not match" << LL_ENDL;
- }
- LLAPRFile::remove(logout_marker_file);
- }
- // further refine based on whether or not a marker created during an llerr crash is found
- std::string llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME);
- if(LLAPRFile::isExist(llerror_marker_file, NULL, LL_APR_RB))
- {
- if (markerIsSameVersion(llerror_marker_file))
- {
- if ( gLastExecEvent == LAST_EXEC_LOGOUT_FROZE )
- {
- gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
- LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' crashed, setting LastExecEvent to LOGOUT_CRASH" << LL_ENDL;
- }
- else
- {
- gLastExecEvent = LAST_EXEC_LLERROR_CRASH;
- LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' crashed, setting LastExecEvent to LLERROR_CRASH" << LL_ENDL;
- }
- }
- else
- {
- LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' found, but versions did not match" << LL_ENDL;
- }
- LLAPRFile::remove(llerror_marker_file);
- }
- // and last refine based on whether or not a marker created during a non-llerr crash is found
- std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME);
- if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB))
- {
- if (markerIsSameVersion(error_marker_file))
- {
- if (gLastExecEvent == LAST_EXEC_LOGOUT_FROZE)
- {
- gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
- LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to LOGOUT_CRASH" << LL_ENDL;
- }
- else
- {
- gLastExecEvent = LAST_EXEC_OTHER_CRASH;
- LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
- }
- }
- else
- {
- LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' marker found, but versions did not match" << LL_ENDL;
- }
- LLAPRFile::remove(error_marker_file);
- }
+ //We've got 4 things to test for here
+ // - Other Process Running (SecondLife.exec_marker present, locked)
+ // - Freeze (SecondLife.exec_marker present, not locked)
+ // - LLError Crash (SecondLife.llerror_marker present)
+ // - Other Crash (SecondLife.error_marker present)
+ // These checks should also remove these files for the last 2 cases if they currently exist
+
+ std::ostringstream marker_log_stream;
+ bool marker_is_same_version = true;
+ // first, look for the marker created at startup and deleted on a clean exit
+ mMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,MARKER_FILE_NAME);
+ if (LLAPRFile::isExist(mMarkerFileName, NULL, LL_APR_RB))
+ {
+ // File exists...
+ // first, read it to see if it was created by the same version (we need this later)
+ marker_is_same_version = markerIsSameVersion(mMarkerFileName);
+
+ // now test to see if this file is locked by a running process (try to open for write)
+ marker_log_stream << "Checking exec marker file for lock...";
+ mMarkerFile.open(mMarkerFileName, LL_APR_WB);
+ apr_file_t* fMarker = mMarkerFile.getFileHandle() ;
+ if (!fMarker)
+ {
+ marker_log_stream << "Exec marker file open failed - assume it is locked.";
+ mSecondInstance = true; // lock means that instance is running.
+ }
+ else
+ {
+ // We were able to open it, now try to lock it ourselves...
+ if (apr_file_lock(fMarker, APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE) != APR_SUCCESS)
+ {
+ marker_log_stream << "Locking exec marker failed.";
+ mSecondInstance = true; // lost a race? be conservative
+ }
+ else
+ {
+ // No other instances; we've locked this file now, so record our version; delete on quit.
+ recordMarkerVersion(mMarkerFile);
+ marker_log_stream << "Exec marker file existed but was not locked; rewritten.";
+ }
+ }
+ initLoggingAndGetLastDuration();
+
+ std::string marker_log_msg(marker_log_stream.str());
+ LL_INFOS("MarkerFile") << marker_log_msg << LL_ENDL;
+
+ if (mSecondInstance)
+ {
+ LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' owned by another instance" << LL_ENDL;
+ }
+ else if (marker_is_same_version)
+ {
+ // the file existed, is ours, and matched our version, so we can report on what it says
+ LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' found; last exec crashed" << LL_ENDL;
+ gLastExecEvent = LAST_EXEC_OTHER_CRASH;
+ }
+ else
+ {
+ LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' found, but versions did not match" << LL_ENDL;
+ }
+ }
+ else // marker did not exist... last exec (if any) did not freeze
+ {
+ initLoggingAndGetLastDuration();
+ // Create the marker file for this execution & lock it; it will be deleted on a clean exit
+ apr_status_t s;
+ s = mMarkerFile.open(mMarkerFileName, LL_APR_WB, TRUE);
+
+ if (s == APR_SUCCESS && mMarkerFile.getFileHandle())
+ {
+ LL_DEBUGS("MarkerFile") << "Exec marker file '"<< mMarkerFileName << "' created." << LL_ENDL;
+ if (APR_SUCCESS == apr_file_lock(mMarkerFile.getFileHandle(), APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE))
+ {
+ recordMarkerVersion(mMarkerFile);
+ LL_DEBUGS("MarkerFile") << "Exec marker file locked." << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("MarkerFile") << "Exec marker file cannot be locked." << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("MarkerFile") << "Failed to create exec marker file '"<< mMarkerFileName << "'." << LL_ENDL;
+ }
+ }
+
+ // now check for cases in which the exec marker may have been cleaned up by crash handlers
+
+ // check for any last exec event report based on whether or not it happened during logout
+ // (the logout marker is created when logout begins)
+ std::string logout_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LOGOUT_MARKER_FILE_NAME);
+ if(LLAPRFile::isExist(logout_marker_file, NULL, LL_APR_RB))
+ {
+ if (markerIsSameVersion(logout_marker_file))
+ {
+ gLastExecEvent = LAST_EXEC_LOGOUT_FROZE;
+ LL_INFOS("MarkerFile") << "Logout crash marker '"<< logout_marker_file << "', changing LastExecEvent to LOGOUT_FROZE" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS("MarkerFile") << "Logout crash marker '"<< logout_marker_file << "' found, but versions did not match" << LL_ENDL;
+ }
+ LLAPRFile::remove(logout_marker_file);
+ }
+ // further refine based on whether or not a marker created during an llerr crash is found
+ std::string llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME);
+ if(LLAPRFile::isExist(llerror_marker_file, NULL, LL_APR_RB))
+ {
+ if (markerIsSameVersion(llerror_marker_file))
+ {
+ if ( gLastExecEvent == LAST_EXEC_LOGOUT_FROZE )
+ {
+ gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
+ LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' crashed, setting LastExecEvent to LOGOUT_CRASH" << LL_ENDL;
+ }
+ else
+ {
+ gLastExecEvent = LAST_EXEC_LLERROR_CRASH;
+ LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' crashed, setting LastExecEvent to LLERROR_CRASH" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' found, but versions did not match" << LL_ENDL;
+ }
+ LLAPRFile::remove(llerror_marker_file);
+ }
+ // and last refine based on whether or not a marker created during a non-llerr crash is found
+ std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME);
+ if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB))
+ {
+ if (markerIsSameVersion(error_marker_file))
+ {
+ if (gLastExecEvent == LAST_EXEC_LOGOUT_FROZE)
+ {
+ gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
+ LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to LOGOUT_CRASH" << LL_ENDL;
+ }
+ else
+ {
+ gLastExecEvent = LAST_EXEC_OTHER_CRASH;
+ LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' marker found, but versions did not match" << LL_ENDL;
+ }
+ LLAPRFile::remove(error_marker_file);
+ }
}
void LLAppViewer::removeMarkerFiles()
{
- if (!mSecondInstance)
- {
- if (mMarkerFile.getFileHandle())
- {
- mMarkerFile.close() ;
- LLAPRFile::remove( mMarkerFileName );
- LL_DEBUGS("MarkerFile") << "removed exec marker '"<<mMarkerFileName<<"'"<< LL_ENDL;
- }
- else
- {
- LL_WARNS("MarkerFile") << "marker '"<<mMarkerFileName<<"' not open"<< LL_ENDL;
- }
-
- if (mLogoutMarkerFile.getFileHandle())
- {
- mLogoutMarkerFile.close();
- LLAPRFile::remove( mLogoutMarkerFileName );
- LL_DEBUGS("MarkerFile") << "removed logout marker '"<<mLogoutMarkerFileName<<"'"<< LL_ENDL;
- }
- else
- {
- LL_WARNS("MarkerFile") << "logout marker '"<<mLogoutMarkerFileName<<"' not open"<< LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("MarkerFile") << "leaving markers because this is a second instance" << LL_ENDL;
- }
+ if (!mSecondInstance)
+ {
+ if (mMarkerFile.getFileHandle())
+ {
+ mMarkerFile.close() ;
+ LLAPRFile::remove( mMarkerFileName );
+ LL_DEBUGS("MarkerFile") << "removed exec marker '"<<mMarkerFileName<<"'"<< LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("MarkerFile") << "marker '"<<mMarkerFileName<<"' not open"<< LL_ENDL;
+ }
+
+ if (mLogoutMarkerFile.getFileHandle())
+ {
+ mLogoutMarkerFile.close();
+ LLAPRFile::remove( mLogoutMarkerFileName );
+ LL_DEBUGS("MarkerFile") << "removed logout marker '"<<mLogoutMarkerFileName<<"'"<< LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("MarkerFile") << "logout marker '"<<mLogoutMarkerFileName<<"' not open"<< LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("MarkerFile") << "leaving markers because this is a second instance" << LL_ENDL;
+ }
}
void LLAppViewer::removeDumpDir()
@@ -3965,212 +3965,212 @@ void LLAppViewer::removeDumpDir()
void LLAppViewer::forceQuit()
{
- LLApp::setQuitting();
+ LLApp::setQuitting();
}
//TODO: remove
void LLAppViewer::fastQuit(S32 error_code)
{
- // finish pending transfers
- flushLFSIO();
- // let sim know we're logging out
- sendLogoutRequest();
- // flush network buffers by shutting down messaging system
- end_messaging_system();
- // figure out the error code
- S32 final_error_code = error_code ? error_code : (S32)isError();
- // this isn't a crash
- removeMarkerFiles();
- // get outta here
- _exit(final_error_code);
+ // finish pending transfers
+ flushLFSIO();
+ // let sim know we're logging out
+ sendLogoutRequest();
+ // flush network buffers by shutting down messaging system
+ end_messaging_system();
+ // figure out the error code
+ S32 final_error_code = error_code ? error_code : (S32)isError();
+ // this isn't a crash
+ removeMarkerFiles();
+ // get outta here
+ _exit(final_error_code);
}
void LLAppViewer::requestQuit()
{
- LL_INFOS() << "requestQuit" << LL_ENDL;
-
- LLViewerRegion* region = gAgent.getRegion();
-
- if( (LLStartUp::getStartupState() < STATE_STARTED) || !region )
- {
- // If we have a region, make some attempt to send a logout request first.
- // This prevents the halfway-logged-in avatar from hanging around inworld for a couple minutes.
- if(region)
- {
- sendLogoutRequest();
- }
-
- // Quit immediately
- forceQuit();
- return;
- }
-
- // Try to send metrics back to the grid
- metricsSend(!gDisconnected);
-
- // Try to send last batch of avatar rez metrics.
- if (!gDisconnected && isAgentAvatarValid())
- {
- gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent.
- }
-
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
- effectp->setPositionGlobal(gAgent.getPositionGlobal());
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- LLHUDManager::getInstance()->sendEffects();
- effectp->markDead() ;//remove it.
-
- // Attempt to close all floaters that might be
- // editing things.
- if (gFloaterView)
- {
- // application is quitting
- gFloaterView->closeAllChildren(true);
- }
-
- // Send preferences once, when exiting
- bool include_preferences = true;
- send_viewer_stats(include_preferences);
-
- gLogoutTimer.reset();
- mQuitRequested = true;
+ LL_INFOS() << "requestQuit" << LL_ENDL;
+
+ LLViewerRegion* region = gAgent.getRegion();
+
+ if( (LLStartUp::getStartupState() < STATE_STARTED) || !region )
+ {
+ // If we have a region, make some attempt to send a logout request first.
+ // This prevents the halfway-logged-in avatar from hanging around inworld for a couple minutes.
+ if(region)
+ {
+ sendLogoutRequest();
+ }
+
+ // Quit immediately
+ forceQuit();
+ return;
+ }
+
+ // Try to send metrics back to the grid
+ metricsSend(!gDisconnected);
+
+ // Try to send last batch of avatar rez metrics.
+ if (!gDisconnected && isAgentAvatarValid())
+ {
+ gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent.
+ }
+
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
+ effectp->setPositionGlobal(gAgent.getPositionGlobal());
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ LLHUDManager::getInstance()->sendEffects();
+ effectp->markDead() ;//remove it.
+
+ // Attempt to close all floaters that might be
+ // editing things.
+ if (gFloaterView)
+ {
+ // application is quitting
+ gFloaterView->closeAllChildren(true);
+ }
+
+ // Send preferences once, when exiting
+ bool include_preferences = true;
+ send_viewer_stats(include_preferences);
+
+ gLogoutTimer.reset();
+ mQuitRequested = true;
}
static bool finish_quit(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- LLAppViewer::instance()->requestQuit();
- }
- return false;
+ if (option == 0)
+ {
+ LLAppViewer::instance()->requestQuit();
+ }
+ return false;
}
static LLNotificationFunctorRegistration finish_quit_reg("ConfirmQuit", finish_quit);
void LLAppViewer::userQuit()
{
- LL_INFOS() << "User requested quit" << LL_ENDL;
- if (gDisconnected
- || !gViewerWindow
- || !gViewerWindow->getProgressView()
- || gViewerWindow->getProgressView()->getVisible())
- {
- requestQuit();
- }
- else
- {
- LLNotificationsUtil::add("ConfirmQuit");
- }
+ LL_INFOS() << "User requested quit" << LL_ENDL;
+ if (gDisconnected
+ || !gViewerWindow
+ || !gViewerWindow->getProgressView()
+ || gViewerWindow->getProgressView()->getVisible())
+ {
+ requestQuit();
+ }
+ else
+ {
+ LLNotificationsUtil::add("ConfirmQuit");
+ }
}
static bool finish_early_exit(const LLSD& notification, const LLSD& response)
{
- LLAppViewer::instance()->forceQuit();
- return false;
+ LLAppViewer::instance()->forceQuit();
+ return false;
}
void LLAppViewer::earlyExit(const std::string& name, const LLSD& substitutions)
{
- LL_WARNS() << "app_early_exit: " << name << LL_ENDL;
- gDoDisconnect = TRUE;
- LLNotificationsUtil::add(name, substitutions, LLSD(), finish_early_exit);
+ LL_WARNS() << "app_early_exit: " << name << LL_ENDL;
+ gDoDisconnect = TRUE;
+ LLNotificationsUtil::add(name, substitutions, LLSD(), finish_early_exit);
}
// case where we need the viewer to exit without any need for notifications
void LLAppViewer::earlyExitNoNotify()
{
- LL_WARNS() << "app_early_exit with no notification: " << LL_ENDL;
- gDoDisconnect = TRUE;
- finish_early_exit( LLSD(), LLSD() );
+ LL_WARNS() << "app_early_exit with no notification: " << LL_ENDL;
+ gDoDisconnect = TRUE;
+ finish_early_exit( LLSD(), LLSD() );
}
void LLAppViewer::abortQuit()
{
LL_INFOS() << "abortQuit()" << LL_ENDL;
- mQuitRequested = false;
+ mQuitRequested = false;
}
void LLAppViewer::migrateCacheDirectory()
{
#if LL_WINDOWS || LL_DARWIN
- // NOTE: (Nyx) as of 1.21, cache for mac is moving to /library/caches/SecondLife from
- // /library/application support/SecondLife/cache This should clear/delete the old dir.
-
- // As of 1.23 the Windows cache moved from
- // C:\Documents and Settings\James\Application Support\SecondLife\cache
- // to
- // C:\Documents and Settings\James\Local Settings\Application Support\SecondLife
- //
- // The Windows Vista equivalent is from
- // C:\Users\James\AppData\Roaming\SecondLife\cache
- // to
- // C:\Users\James\AppData\Local\SecondLife
- //
- // Note the absence of \cache on the second path. James.
-
- // Only do this once per fresh install of this version.
- if (gSavedSettings.getBOOL("MigrateCacheDirectory"))
- {
- gSavedSettings.setBOOL("MigrateCacheDirectory", FALSE);
-
- std::string old_cache_dir = gDirUtilp->add(gDirUtilp->getOSUserAppDir(), "cache");
- std::string new_cache_dir = gDirUtilp->getCacheDir(true);
-
- if (gDirUtilp->fileExists(old_cache_dir))
- {
- LL_INFOS() << "Migrating cache from " << old_cache_dir << " to " << new_cache_dir << LL_ENDL;
-
- // Migrate inventory cache to avoid pain to inventory database after mass update
- S32 file_count = 0;
- std::string file_name;
- std::string mask = "*.*";
-
- LLDirIterator iter(old_cache_dir, mask);
- while (iter.next(file_name))
- {
- if (file_name == "." || file_name == "..") continue;
- std::string source_path = gDirUtilp->add(old_cache_dir, file_name);
- std::string dest_path = gDirUtilp->add(new_cache_dir, file_name);
- if (!LLFile::rename(source_path, dest_path))
- {
- file_count++;
- }
- }
- LL_INFOS() << "Moved " << file_count << " files" << LL_ENDL;
-
- // Nuke the old cache
- gDirUtilp->setCacheDir(old_cache_dir);
- purgeCache();
- gDirUtilp->setCacheDir(new_cache_dir);
+ // NOTE: (Nyx) as of 1.21, cache for mac is moving to /library/caches/SecondLife from
+ // /library/application support/SecondLife/cache This should clear/delete the old dir.
+
+ // As of 1.23 the Windows cache moved from
+ // C:\Documents and Settings\James\Application Support\SecondLife\cache
+ // to
+ // C:\Documents and Settings\James\Local Settings\Application Support\SecondLife
+ //
+ // The Windows Vista equivalent is from
+ // C:\Users\James\AppData\Roaming\SecondLife\cache
+ // to
+ // C:\Users\James\AppData\Local\SecondLife
+ //
+ // Note the absence of \cache on the second path. James.
+
+ // Only do this once per fresh install of this version.
+ if (gSavedSettings.getBOOL("MigrateCacheDirectory"))
+ {
+ gSavedSettings.setBOOL("MigrateCacheDirectory", FALSE);
+
+ std::string old_cache_dir = gDirUtilp->add(gDirUtilp->getOSUserAppDir(), "cache");
+ std::string new_cache_dir = gDirUtilp->getCacheDir(true);
+
+ if (gDirUtilp->fileExists(old_cache_dir))
+ {
+ LL_INFOS() << "Migrating cache from " << old_cache_dir << " to " << new_cache_dir << LL_ENDL;
+
+ // Migrate inventory cache to avoid pain to inventory database after mass update
+ S32 file_count = 0;
+ std::string file_name;
+ std::string mask = "*.*";
+
+ LLDirIterator iter(old_cache_dir, mask);
+ while (iter.next(file_name))
+ {
+ if (file_name == "." || file_name == "..") continue;
+ std::string source_path = gDirUtilp->add(old_cache_dir, file_name);
+ std::string dest_path = gDirUtilp->add(new_cache_dir, file_name);
+ if (!LLFile::rename(source_path, dest_path))
+ {
+ file_count++;
+ }
+ }
+ LL_INFOS() << "Moved " << file_count << " files" << LL_ENDL;
+
+ // Nuke the old cache
+ gDirUtilp->setCacheDir(old_cache_dir);
+ purgeCache();
+ gDirUtilp->setCacheDir(new_cache_dir);
#if LL_DARWIN
- // Clean up Mac files not deleted by removing *.*
- std::string ds_store = old_cache_dir + "/.DS_Store";
- if (gDirUtilp->fileExists(ds_store))
- {
- LLFile::remove(ds_store);
- }
+ // Clean up Mac files not deleted by removing *.*
+ std::string ds_store = old_cache_dir + "/.DS_Store";
+ if (gDirUtilp->fileExists(ds_store))
+ {
+ LLFile::remove(ds_store);
+ }
#endif
- if (LLFile::rmdir(old_cache_dir) != 0)
- {
- LL_WARNS() << "could not delete old cache directory " << old_cache_dir << LL_ENDL;
- }
- }
- }
+ if (LLFile::rmdir(old_cache_dir) != 0)
+ {
+ LL_WARNS() << "could not delete old cache directory " << old_cache_dir << LL_ENDL;
+ }
+ }
+ }
#endif // LL_WINDOWS || LL_DARWIN
}
//static
U32 LLAppViewer::getTextureCacheVersion()
{
- // Viewer texture cache version, change if the texture cache format changes.
- // 2021-03-10 Bumping up by one to help obviate texture cache issues with
- // Simple Cache Viewer - see SL-14985 for more information
- //const U32 TEXTURE_CACHE_VERSION = 8;
- const U32 TEXTURE_CACHE_VERSION = 9;
+ // Viewer texture cache version, change if the texture cache format changes.
+ // 2021-03-10 Bumping up by one to help obviate texture cache issues with
+ // Simple Cache Viewer - see SL-14985 for more information
+ //const U32 TEXTURE_CACHE_VERSION = 8;
+ const U32 TEXTURE_CACHE_VERSION = 9;
- return TEXTURE_CACHE_VERSION ;
+ return TEXTURE_CACHE_VERSION ;
}
//static
@@ -4185,92 +4185,92 @@ U32 LLAppViewer::getDiskCacheVersion()
//static
U32 LLAppViewer::getObjectCacheVersion()
{
- // Viewer object cache version, change if object update
- // format changes. JC
- const U32 INDRA_OBJECT_CACHE_VERSION = 17;
+ // Viewer object cache version, change if object update
+ // format changes. JC
+ const U32 INDRA_OBJECT_CACHE_VERSION = 17;
- return INDRA_OBJECT_CACHE_VERSION;
+ return INDRA_OBJECT_CACHE_VERSION;
}
bool LLAppViewer::initCache()
{
- mPurgeCache = false;
- BOOL read_only = mSecondInstance ? TRUE : FALSE;
- LLAppViewer::getTextureCache()->setReadOnly(read_only) ;
- LLVOCache::initParamSingleton(read_only);
+ mPurgeCache = false;
+ BOOL read_only = mSecondInstance ? TRUE : FALSE;
+ LLAppViewer::getTextureCache()->setReadOnly(read_only) ;
+ LLVOCache::initParamSingleton(read_only);
- // initialize the new disk cache using saved settings
- const std::string cache_dir_name = gSavedSettings.getString("DiskCacheDirName");
+ // initialize the new disk cache using saved settings
+ const std::string cache_dir_name = gSavedSettings.getString("DiskCacheDirName");
- const U32 MB = 1024 * 1024;
+ const U32 MB = 1024 * 1024;
const uintmax_t MIN_CACHE_SIZE = 256 * MB;
- const uintmax_t MAX_CACHE_SIZE = 9984ll * MB;
+ const uintmax_t MAX_CACHE_SIZE = 9984ll * MB;
const uintmax_t setting_cache_total_size = uintmax_t(gSavedSettings.getU32("CacheSize")) * MB;
const uintmax_t cache_total_size = llclamp(setting_cache_total_size, MIN_CACHE_SIZE, MAX_CACHE_SIZE);
const F64 disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal");
const F64 texture_cache_percent = 100.0 - disk_cache_percent;
- // note that the maximum size of this cache is defined as a percentage of the
- // total cache size - the 'CacheSize' pref - for all caches.
+ // note that the maximum size of this cache is defined as a percentage of the
+ // total cache size - the 'CacheSize' pref - for all caches.
const uintmax_t disk_cache_size = uintmax_t(cache_total_size * disk_cache_percent / 100);
- const bool enable_cache_debug_info = gSavedSettings.getBOOL("EnableDiskCacheDebugInfo");
+ const bool enable_cache_debug_info = gSavedSettings.getBOOL("EnableDiskCacheDebugInfo");
- bool texture_cache_mismatch = false;
+ bool texture_cache_mismatch = false;
bool remove_vfs_files = false;
- if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion())
- {
- texture_cache_mismatch = true;
- if(!read_only)
- {
- gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getTextureCacheVersion());
+ if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion())
+ {
+ texture_cache_mismatch = true;
+ if(!read_only)
+ {
+ gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getTextureCacheVersion());
//texture cache version was bumped up in Simple Cache Viewer, and at this point old vfs files are not needed
- remove_vfs_files = true;
- }
- }
-
- if(!read_only)
- {
- // Purge cache if user requested it
- if (gSavedSettings.getBOOL("PurgeCacheOnStartup") ||
- gSavedSettings.getBOOL("PurgeCacheOnNextStartup"))
- {
- LL_INFOS("AppCache") << "Startup cache purge requested: " << (gSavedSettings.getBOOL("PurgeCacheOnStartup") ? "ALWAYS" : "ONCE") << LL_ENDL;
- gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false);
- mPurgeCache = true;
- // STORM-1141 force purgeAllTextures to get called to prevent a crash here. -brad
- texture_cache_mismatch = true;
- }
-
- // We have moved the location of the cache directory over time.
- migrateCacheDirectory();
-
- // Setup and verify the cache location
- std::string cache_location = gSavedSettings.getString("CacheLocation");
- std::string new_cache_location = gSavedSettings.getString("NewCacheLocation");
- if (new_cache_location != cache_location)
- {
- LL_INFOS("AppCache") << "Cache location changed, cache needs purging" << LL_ENDL;
- gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"));
- purgeCache(); // purge old cache
- gDirUtilp->deleteDirAndContents(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, cache_dir_name));
- gSavedSettings.setString("CacheLocation", new_cache_location);
- gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location));
- }
- }
-
- if (!gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")))
- {
- LL_WARNS("AppCache") << "Unable to set cache location" << LL_ENDL;
- gSavedSettings.setString("CacheLocation", "");
- gSavedSettings.setString("CacheLocationTopFolder", "");
- }
-
- const std::string cache_dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, cache_dir_name);
+ remove_vfs_files = true;
+ }
+ }
+
+ if(!read_only)
+ {
+ // Purge cache if user requested it
+ if (gSavedSettings.getBOOL("PurgeCacheOnStartup") ||
+ gSavedSettings.getBOOL("PurgeCacheOnNextStartup"))
+ {
+ LL_INFOS("AppCache") << "Startup cache purge requested: " << (gSavedSettings.getBOOL("PurgeCacheOnStartup") ? "ALWAYS" : "ONCE") << LL_ENDL;
+ gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false);
+ mPurgeCache = true;
+ // STORM-1141 force purgeAllTextures to get called to prevent a crash here. -brad
+ texture_cache_mismatch = true;
+ }
+
+ // We have moved the location of the cache directory over time.
+ migrateCacheDirectory();
+
+ // Setup and verify the cache location
+ std::string cache_location = gSavedSettings.getString("CacheLocation");
+ std::string new_cache_location = gSavedSettings.getString("NewCacheLocation");
+ if (new_cache_location != cache_location)
+ {
+ LL_INFOS("AppCache") << "Cache location changed, cache needs purging" << LL_ENDL;
+ gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"));
+ purgeCache(); // purge old cache
+ gDirUtilp->deleteDirAndContents(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, cache_dir_name));
+ gSavedSettings.setString("CacheLocation", new_cache_location);
+ gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location));
+ }
+ }
+
+ if (!gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")))
+ {
+ LL_WARNS("AppCache") << "Unable to set cache location" << LL_ENDL;
+ gSavedSettings.setString("CacheLocation", "");
+ gSavedSettings.setString("CacheLocationTopFolder", "");
+ }
+
+ const std::string cache_dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, cache_dir_name);
LLDiskCache::initParamSingleton(cache_dir, disk_cache_size, enable_cache_debug_info);
- if (!read_only)
- {
+ if (!read_only)
+ {
if (gSavedSettings.getS32("DiskCacheVersion") != LLAppViewer::getDiskCacheVersion())
{
LLDiskCache::getInstance()->clearCache();
@@ -4282,166 +4282,166 @@ bool LLAppViewer::initCache()
{
LLDiskCache::getInstance()->removeOldVFSFiles();
}
-
+
if (mPurgeCache)
- {
- LLSplashScreen::update(LLTrans::getString("StartupClearingCache"));
- purgeCache();
-
- // clear the new C++ file system based cache
- LLDiskCache::getInstance()->clearCache();
- }
- else
- {
- // purge excessive files from the new file system based cache
- LLDiskCache::getInstance()->purge();
- }
- }
- LLAppViewer::getPurgeDiskCacheThread()->start();
-
- LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache"));
-
- // Init the texture cache
+ {
+ LLSplashScreen::update(LLTrans::getString("StartupClearingCache"));
+ purgeCache();
+
+ // clear the new C++ file system based cache
+ LLDiskCache::getInstance()->clearCache();
+ }
+ else
+ {
+ // purge excessive files from the new file system based cache
+ LLDiskCache::getInstance()->purge();
+ }
+ }
+ LLAppViewer::getPurgeDiskCacheThread()->start();
+
+ LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache"));
+
+ // Init the texture cache
// Allocate the remaining percent which is not allocated to the disk cache
const S64 texture_cache_size = S64(cache_total_size * texture_cache_percent / 100);
LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch);
- LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion());
+ LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion());
return true;
}
void LLAppViewer::addOnIdleCallback(const boost::function<void()>& cb)
{
- gMainloopWork.post(cb);
+ gMainloopWork.post(cb);
}
void LLAppViewer::loadKeyBindings()
{
- std::string key_bindings_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "key_bindings.xml");
- if (!gDirUtilp->fileExists(key_bindings_file) || !gViewerInput.loadBindingsXML(key_bindings_file))
- {
- // Failed to load custom bindings, try default ones
- key_bindings_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "key_bindings.xml");
- if (!gViewerInput.loadBindingsXML(key_bindings_file))
- {
+ std::string key_bindings_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "key_bindings.xml");
+ if (!gDirUtilp->fileExists(key_bindings_file) || !gViewerInput.loadBindingsXML(key_bindings_file))
+ {
+ // Failed to load custom bindings, try default ones
+ key_bindings_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "key_bindings.xml");
+ if (!gViewerInput.loadBindingsXML(key_bindings_file))
+ {
LLError::LLUserWarningMsg::showMissingFiles();
- LL_ERRS("InitInfo") << "Unable to open default key bindings from " << key_bindings_file << LL_ENDL;
- }
- }
+ LL_ERRS("InitInfo") << "Unable to open default key bindings from " << key_bindings_file << LL_ENDL;
+ }
+ }
LLUrlRegistry::instance().setKeybindingHandler(&gViewerInput);
}
void LLAppViewer::purgeCache()
{
- LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << LL_ENDL;
- LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE);
- LLVOCache::getInstance()->removeCache(LL_PATH_CACHE);
- LLViewerShaderMgr::instance()->clearShaderCache();
- std::string browser_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "cef_cache");
- if (LLFile::isdir(browser_cache))
- {
- // cef does not support clear_cache and clear_cookies, so clear what we can manually.
- gDirUtilp->deleteDirAndContents(browser_cache);
- }
- gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), "*");
+ LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << LL_ENDL;
+ LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE);
+ LLVOCache::getInstance()->removeCache(LL_PATH_CACHE);
+ LLViewerShaderMgr::instance()->clearShaderCache();
+ std::string browser_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "cef_cache");
+ if (LLFile::isdir(browser_cache))
+ {
+ // cef does not support clear_cache and clear_cookies, so clear what we can manually.
+ gDirUtilp->deleteDirAndContents(browser_cache);
+ }
+ gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), "*");
}
//purge cache immediately, do not wait until the next login.
void LLAppViewer::purgeCacheImmediate()
{
- LL_INFOS("AppCache") << "Purging Object Cache and Texture Cache immediately..." << LL_ENDL;
- LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE, false);
- LLVOCache::getInstance()->removeCache(LL_PATH_CACHE, true);
+ LL_INFOS("AppCache") << "Purging Object Cache and Texture Cache immediately..." << LL_ENDL;
+ LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE, false);
+ LLVOCache::getInstance()->removeCache(LL_PATH_CACHE, true);
}
std::string LLAppViewer::getSecondLifeTitle() const
{
- return LLTrans::getString("APP_NAME");
+ return LLTrans::getString("APP_NAME");
}
std::string LLAppViewer::getWindowTitle() const
{
- return gWindowTitle;
+ return gWindowTitle;
}
// Callback from a dialog indicating user was logged out.
bool finish_disconnect(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (1 == option)
- {
+ if (1 == option)
+ {
LLAppViewer::instance()->forceQuit();
- }
- return false;
+ }
+ return false;
}
// Callback from an early disconnect dialog, force an exit
bool finish_forced_disconnect(const LLSD& notification, const LLSD& response)
{
- LLAppViewer::instance()->forceQuit();
- return false;
+ LLAppViewer::instance()->forceQuit();
+ return false;
}
void LLAppViewer::forceDisconnect(const std::string& mesg)
{
- if (gDoDisconnect)
- {
- // Already popped up one of these dialogs, don't
- // do this again.
- return;
- }
-
- // *TODO: Translate the message if possible
- std::string big_reason = LLAgent::sTeleportErrorMessages[mesg];
- if ( big_reason.size() == 0 )
- {
- big_reason = mesg;
- }
-
- LLSD args;
- gDoDisconnect = TRUE;
-
- if (LLStartUp::getStartupState() < STATE_STARTED)
- {
- // Tell users what happened
- args["ERROR_MESSAGE"] = big_reason;
- LLNotificationsUtil::add("ErrorMessage", args, LLSD(), &finish_forced_disconnect);
- }
- else
- {
- args["MESSAGE"] = big_reason;
- LLNotificationsUtil::add("YouHaveBeenLoggedOut", args, LLSD(), &finish_disconnect );
- }
+ if (gDoDisconnect)
+ {
+ // Already popped up one of these dialogs, don't
+ // do this again.
+ return;
+ }
+
+ // *TODO: Translate the message if possible
+ std::string big_reason = LLAgent::sTeleportErrorMessages[mesg];
+ if ( big_reason.size() == 0 )
+ {
+ big_reason = mesg;
+ }
+
+ LLSD args;
+ gDoDisconnect = TRUE;
+
+ if (LLStartUp::getStartupState() < STATE_STARTED)
+ {
+ // Tell users what happened
+ args["ERROR_MESSAGE"] = big_reason;
+ LLNotificationsUtil::add("ErrorMessage", args, LLSD(), &finish_forced_disconnect);
+ }
+ else
+ {
+ args["MESSAGE"] = big_reason;
+ LLNotificationsUtil::add("YouHaveBeenLoggedOut", args, LLSD(), &finish_disconnect );
+ }
}
void LLAppViewer::badNetworkHandler()
{
- // Dump the packet
- gMessageSystem->dumpPacketToLog();
-
- // Flush all of our caches on exit in the case of disconnect due to
- // invalid packets.
-
- mPurgeCacheOnExit = TRUE;
-
- std::ostringstream message;
- message <<
- "The viewer has detected mangled network data indicative\n"
- "of a bad upstream network connection or an incomplete\n"
- "local installation of " << LLAppViewer::instance()->getSecondLifeTitle() << ". \n"
- " \n"
- "Try uninstalling and reinstalling to see if this resolves \n"
- "the issue. \n"
- " \n"
- "If the problem continues, see the Tech Support FAQ at: \n"
- "www.secondlife.com/support";
- forceDisconnect(message.str());
-
- LLApp::instance()->writeMiniDump();
+ // Dump the packet
+ gMessageSystem->dumpPacketToLog();
+
+ // Flush all of our caches on exit in the case of disconnect due to
+ // invalid packets.
+
+ mPurgeCacheOnExit = TRUE;
+
+ std::ostringstream message;
+ message <<
+ "The viewer has detected mangled network data indicative\n"
+ "of a bad upstream network connection or an incomplete\n"
+ "local installation of " << LLAppViewer::instance()->getSecondLifeTitle() << ". \n"
+ " \n"
+ "Try uninstalling and reinstalling to see if this resolves \n"
+ "the issue. \n"
+ " \n"
+ "If the problem continues, see the Tech Support FAQ at: \n"
+ "www.secondlife.com/support";
+ forceDisconnect(message.str());
+
+ LLApp::instance()->writeMiniDump();
}
// This routine may get called more than once during the shutdown process.
@@ -4449,93 +4449,93 @@ void LLAppViewer::badNetworkHandler()
// is destroyed.
void LLAppViewer::saveFinalSnapshot()
{
- if (!mSavedFinalSnapshot)
- {
- gSavedSettings.setVector3d("FocusPosOnLogout", gAgentCamera.calcFocusPositionTargetGlobal());
- gSavedSettings.setVector3d("CameraPosOnLogout", gAgentCamera.calcCameraPositionTargetGlobal());
- gViewerWindow->setCursor(UI_CURSOR_WAIT);
- gAgentCamera.changeCameraToThirdPerson( FALSE ); // don't animate, need immediate switch
- gSavedSettings.setBOOL("ShowParcelOwners", FALSE);
- idle();
-
- std::string snap_filename = gDirUtilp->getLindenUserDir();
- snap_filename += gDirUtilp->getDirDelimiter();
- snap_filename += LLStartUp::getScreenLastFilename();
- // use full pixel dimensions of viewer window (not post-scale dimensions)
- gViewerWindow->saveSnapshot(snap_filename,
- gViewerWindow->getWindowWidthRaw(),
- gViewerWindow->getWindowHeightRaw(),
- FALSE,
- gSavedSettings.getBOOL("RenderHUDInSnapshot"),
- TRUE,
- LLSnapshotModel::SNAPSHOT_TYPE_COLOR,
- LLSnapshotModel::SNAPSHOT_FORMAT_PNG);
- mSavedFinalSnapshot = TRUE;
-
- if (gAgent.isInHomeRegion())
- {
- LLVector3d home;
- if (gAgent.getHomePosGlobal(&home) && dist_vec(home, gAgent.getPositionGlobal()) < 10)
- {
- // We are at home position or close to it, see if we need to create home screenshot
- // Notes:
- // 1. It might be beneficial to also replace home if file is too old
- // 2. This is far from best way/place to update screenshot since location might be not fully loaded,
- // but we don't have many options
- std::string snap_home = gDirUtilp->getLindenUserDir();
- snap_home += gDirUtilp->getDirDelimiter();
- snap_home += LLStartUp::getScreenHomeFilename();
- if (!gDirUtilp->fileExists(snap_home))
- {
- // We are at home position yet no home image exist, fix it
- LLFile::copy(snap_filename, snap_home);
- }
- }
- }
- }
+ if (!mSavedFinalSnapshot)
+ {
+ gSavedSettings.setVector3d("FocusPosOnLogout", gAgentCamera.calcFocusPositionTargetGlobal());
+ gSavedSettings.setVector3d("CameraPosOnLogout", gAgentCamera.calcCameraPositionTargetGlobal());
+ gViewerWindow->setCursor(UI_CURSOR_WAIT);
+ gAgentCamera.changeCameraToThirdPerson( FALSE ); // don't animate, need immediate switch
+ gSavedSettings.setBOOL("ShowParcelOwners", FALSE);
+ idle();
+
+ std::string snap_filename = gDirUtilp->getLindenUserDir();
+ snap_filename += gDirUtilp->getDirDelimiter();
+ snap_filename += LLStartUp::getScreenLastFilename();
+ // use full pixel dimensions of viewer window (not post-scale dimensions)
+ gViewerWindow->saveSnapshot(snap_filename,
+ gViewerWindow->getWindowWidthRaw(),
+ gViewerWindow->getWindowHeightRaw(),
+ FALSE,
+ gSavedSettings.getBOOL("RenderHUDInSnapshot"),
+ TRUE,
+ LLSnapshotModel::SNAPSHOT_TYPE_COLOR,
+ LLSnapshotModel::SNAPSHOT_FORMAT_PNG);
+ mSavedFinalSnapshot = TRUE;
+
+ if (gAgent.isInHomeRegion())
+ {
+ LLVector3d home;
+ if (gAgent.getHomePosGlobal(&home) && dist_vec(home, gAgent.getPositionGlobal()) < 10)
+ {
+ // We are at home position or close to it, see if we need to create home screenshot
+ // Notes:
+ // 1. It might be beneficial to also replace home if file is too old
+ // 2. This is far from best way/place to update screenshot since location might be not fully loaded,
+ // but we don't have many options
+ std::string snap_home = gDirUtilp->getLindenUserDir();
+ snap_home += gDirUtilp->getDirDelimiter();
+ snap_home += LLStartUp::getScreenHomeFilename();
+ if (!gDirUtilp->fileExists(snap_home))
+ {
+ // We are at home position yet no home image exist, fix it
+ LLFile::copy(snap_filename, snap_home);
+ }
+ }
+ }
+ }
}
void LLAppViewer::loadNameCache()
{
- // display names cache
- std::string filename =
- gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
- LL_INFOS("AvNameCache") << filename << LL_ENDL;
- llifstream name_cache_stream(filename.c_str());
- if(name_cache_stream.is_open())
- {
- if ( ! LLAvatarNameCache::getInstance()->importFile(name_cache_stream))
+ // display names cache
+ std::string filename =
+ gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
+ LL_INFOS("AvNameCache") << filename << LL_ENDL;
+ llifstream name_cache_stream(filename.c_str());
+ if(name_cache_stream.is_open())
+ {
+ if ( ! LLAvatarNameCache::getInstance()->importFile(name_cache_stream))
{
LL_WARNS("AppInit") << "removing invalid '" << filename << "'" << LL_ENDL;
name_cache_stream.close();
LLFile::remove(filename);
}
- }
+ }
- if (!gCacheName) return;
+ if (!gCacheName) return;
- std::string name_cache;
- name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache");
- llifstream cache_file(name_cache.c_str());
- if(cache_file.is_open())
- {
- if(gCacheName->importFile(cache_file)) return;
- }
+ std::string name_cache;
+ name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache");
+ llifstream cache_file(name_cache.c_str());
+ if(cache_file.is_open())
+ {
+ if(gCacheName->importFile(cache_file)) return;
+ }
}
void LLAppViewer::saveNameCache()
{
- // display names cache
- std::string filename =
- gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
- llofstream name_cache_stream(filename.c_str());
- if(name_cache_stream.is_open())
- {
- LLAvatarNameCache::getInstance()->exportFile(name_cache_stream);
+ // display names cache
+ std::string filename =
+ gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
+ llofstream name_cache_stream(filename.c_str());
+ if(name_cache_stream.is_open())
+ {
+ LLAvatarNameCache::getInstance()->exportFile(name_cache_stream);
}
// real names cache
- if (gCacheName)
+ if (gCacheName)
{
std::string name_cache;
name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache");
@@ -4544,24 +4544,24 @@ void LLAppViewer::saveNameCache()
{
gCacheName->exportFile(cache_file);
}
- }
+ }
}
-/*! @brief This class is an LLFrameTimer that can be created with
- an elapsed time that starts counting up from the given value
- rather than 0.0.
+/*! @brief This class is an LLFrameTimer that can be created with
+ an elapsed time that starts counting up from the given value
+ rather than 0.0.
- Otherwise it behaves the same way as LLFrameTimer.
+ Otherwise it behaves the same way as LLFrameTimer.
*/
class LLFrameStatsTimer : public LLFrameTimer
{
public:
- LLFrameStatsTimer(F64 elapsed_already = 0.0)
- : LLFrameTimer()
- {
- mStartTime -= elapsed_already;
- }
+ LLFrameStatsTimer(F64 elapsed_already = 0.0)
+ : LLFrameTimer()
+ {
+ mStartTime -= elapsed_already;
+ }
};
static LLTrace::BlockTimerStatHandle FTM_AUDIO_UPDATE("Update Audio");
@@ -4587,118 +4587,118 @@ static LLTrace::BlockTimerStatHandle FTM_HUD_EFFECTS("HUD Effects");
void LLAppViewer::idle()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
- pingMainloopTimeout("Main:Idle");
+ pingMainloopTimeout("Main:Idle");
- // Update frame timers
- static LLTimer idle_timer;
+ // Update frame timers
+ static LLTimer idle_timer;
- LLFrameTimer::updateFrameTime();
- LLFrameTimer::updateFrameCount();
- LLEventTimer::updateClass();
+ LLFrameTimer::updateFrameTime();
+ LLFrameTimer::updateFrameCount();
+ LLEventTimer::updateClass();
LLPerfStats::updateClass();
- // LLApp::stepFrame() performs the above three calls plus mRunner.run().
- // Not sure why we don't call stepFrame() here, except that LLRunner seems
- // completely redundant with LLEventTimer.
- LLNotificationsUI::LLToast::updateClass();
- LLSmoothInterpolation::updateInterpolants();
- LLMortician::updateClass();
- LLFilePickerThread::clearDead(); //calls LLFilePickerThread::notify()
- LLDirPickerThread::clearDead();
- F32 dt_raw = idle_timer.getElapsedTimeAndResetF32();
+ // LLApp::stepFrame() performs the above three calls plus mRunner.run().
+ // Not sure why we don't call stepFrame() here, except that LLRunner seems
+ // completely redundant with LLEventTimer.
+ LLNotificationsUI::LLToast::updateClass();
+ LLSmoothInterpolation::updateInterpolants();
+ LLMortician::updateClass();
+ LLFilePickerThread::clearDead(); //calls LLFilePickerThread::notify()
+ LLDirPickerThread::clearDead();
+ F32 dt_raw = idle_timer.getElapsedTimeAndResetF32();
LLGLTFMaterialList::flushUpdates();
- // Service the WorkQueue we use for replies from worker threads.
- // Use function statics for the timeslice setting so we only have to fetch
- // and convert MainWorkTime once.
- static F32 MainWorkTimeRaw = gSavedSettings.getF32("MainWorkTime");
- static F32Milliseconds MainWorkTimeMs(MainWorkTimeRaw);
- // MainWorkTime is specified in fractional milliseconds, but std::chrono
- // uses integer representations. What if we want less than a microsecond?
- // Use nanoseconds. We're very sure we will never need to specify a
- // MainWorkTime that would be larger than we could express in
- // std::chrono::nanoseconds.
- static std::chrono::nanoseconds MainWorkTimeNanoSec{
- std::chrono::nanoseconds::rep(MainWorkTimeMs.value() * 1000000)};
- gMainloopWork.runFor(MainWorkTimeNanoSec);
-
- // Cap out-of-control frame times
- // Too low because in menus, swapping, debugger, etc.
- // Too high because idle called with no objects in view, etc.
- const F32 MIN_FRAME_RATE = 1.f;
- const F32 MAX_FRAME_RATE = 200.f;
-
- F32 frame_rate_clamped = 1.f / dt_raw;
- frame_rate_clamped = llclamp(frame_rate_clamped, MIN_FRAME_RATE, MAX_FRAME_RATE);
- gFrameDTClamped = 1.f / frame_rate_clamped;
-
- // Global frame timer
- // Smoothly weight toward current frame
- gFPSClamped = (frame_rate_clamped + (4.f * gFPSClamped)) / 5.f;
-
- F32 qas = gSavedSettings.getF32("QuitAfterSeconds");
- if (qas > 0.f)
- {
- if (gRenderStartTime.getElapsedTimeF32() > qas)
- {
- LL_INFOS() << "Quitting after " << qas << " seconds. See setting \"QuitAfterSeconds\"." << LL_ENDL;
- LLAppViewer::instance()->forceQuit();
- }
- }
-
- // Must wait until both have avatar object and mute list, so poll
- // here.
- LLIMProcessing::requestOfflineMessages();
-
- ///////////////////////////////////
- //
- // Special case idle if still starting up
- //
- if (LLStartUp::getStartupState() < STATE_STARTED)
- {
- // Skip rest if idle startup returns false (essentially, no world yet)
- gGLActive = TRUE;
- if (!idle_startup())
- {
- gGLActive = FALSE;
- return;
- }
- gGLActive = FALSE;
- }
-
-
- F32 yaw = 0.f; // radians
-
- if (!gDisconnected)
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("network"); //LL_RECORD_BLOCK_TIME(FTM_NETWORK);
- // Update spaceserver timeinfo
- LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + LLUnits::Seconds::fromValue(dt_raw));
-
-
- //////////////////////////////////////
- //
- // Update simulator agent state
- //
-
- if (gSavedSettings.getBOOL("RotateRight"))
- {
- gAgent.moveYaw(-1.f);
- }
-
- {
+ // Service the WorkQueue we use for replies from worker threads.
+ // Use function statics for the timeslice setting so we only have to fetch
+ // and convert MainWorkTime once.
+ static F32 MainWorkTimeRaw = gSavedSettings.getF32("MainWorkTime");
+ static F32Milliseconds MainWorkTimeMs(MainWorkTimeRaw);
+ // MainWorkTime is specified in fractional milliseconds, but std::chrono
+ // uses integer representations. What if we want less than a microsecond?
+ // Use nanoseconds. We're very sure we will never need to specify a
+ // MainWorkTime that would be larger than we could express in
+ // std::chrono::nanoseconds.
+ static std::chrono::nanoseconds MainWorkTimeNanoSec{
+ std::chrono::nanoseconds::rep(MainWorkTimeMs.value() * 1000000)};
+ gMainloopWork.runFor(MainWorkTimeNanoSec);
+
+ // Cap out-of-control frame times
+ // Too low because in menus, swapping, debugger, etc.
+ // Too high because idle called with no objects in view, etc.
+ const F32 MIN_FRAME_RATE = 1.f;
+ const F32 MAX_FRAME_RATE = 200.f;
+
+ F32 frame_rate_clamped = 1.f / dt_raw;
+ frame_rate_clamped = llclamp(frame_rate_clamped, MIN_FRAME_RATE, MAX_FRAME_RATE);
+ gFrameDTClamped = 1.f / frame_rate_clamped;
+
+ // Global frame timer
+ // Smoothly weight toward current frame
+ gFPSClamped = (frame_rate_clamped + (4.f * gFPSClamped)) / 5.f;
+
+ F32 qas = gSavedSettings.getF32("QuitAfterSeconds");
+ if (qas > 0.f)
+ {
+ if (gRenderStartTime.getElapsedTimeF32() > qas)
+ {
+ LL_INFOS() << "Quitting after " << qas << " seconds. See setting \"QuitAfterSeconds\"." << LL_ENDL;
+ LLAppViewer::instance()->forceQuit();
+ }
+ }
+
+ // Must wait until both have avatar object and mute list, so poll
+ // here.
+ LLIMProcessing::requestOfflineMessages();
+
+ ///////////////////////////////////
+ //
+ // Special case idle if still starting up
+ //
+ if (LLStartUp::getStartupState() < STATE_STARTED)
+ {
+ // Skip rest if idle startup returns false (essentially, no world yet)
+ gGLActive = TRUE;
+ if (!idle_startup())
+ {
+ gGLActive = FALSE;
+ return;
+ }
+ gGLActive = FALSE;
+ }
+
+
+ F32 yaw = 0.f; // radians
+
+ if (!gDisconnected)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("network"); //LL_RECORD_BLOCK_TIME(FTM_NETWORK);
+ // Update spaceserver timeinfo
+ LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + LLUnits::Seconds::fromValue(dt_raw));
+
+
+ //////////////////////////////////////
+ //
+ // Update simulator agent state
+ //
+
+ if (gSavedSettings.getBOOL("RotateRight"))
+ {
+ gAgent.moveYaw(-1.f);
+ }
+
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Autopilot");
- // Handle automatic walking towards points
- gAgentPilot.updateTarget();
- gAgent.autoPilot(&yaw);
- }
+ // Handle automatic walking towards points
+ gAgentPilot.updateTarget();
+ gAgent.autoPilot(&yaw);
+ }
- static LLFrameTimer agent_update_timer;
+ static LLFrameTimer agent_update_timer;
- // When appropriate, update agent location to the simulator.
- F32 agent_update_time = agent_update_timer.getElapsedTimeF32();
- F32 agent_force_update_time = mLastAgentForceUpdate + agent_update_time;
+ // When appropriate, update agent location to the simulator.
+ F32 agent_update_time = agent_update_timer.getElapsedTimeF32();
+ F32 agent_force_update_time = mLastAgentForceUpdate + agent_update_time;
bool timed_out = agent_update_time > (1.0f / (F32)AGENT_UPDATES_PER_SECOND);
BOOL force_send =
// if there is something to send
@@ -4709,111 +4709,111 @@ void LLAppViewer::idle()
|| (agent_force_update_time > (1.0f / (F32) AGENT_FORCE_UPDATES_PER_SECOND));
// timing out doesn't warranty that an update will be sent,
// just that it will be checked.
- if (force_send || timed_out)
- {
- LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
- // Send avatar and camera info
- mLastAgentControlFlags = gAgent.getControlFlags();
- mLastAgentForceUpdate = force_send ? 0 : agent_force_update_time;
- send_agent_update(force_send);
- agent_update_timer.reset();
- }
- }
-
- //////////////////////////////////////
- //
- // Manage statistics
- //
- //
- {
- // Initialize the viewer_stats_timer with an already elapsed time
- // of SEND_STATS_PERIOD so that the initial stats report will
- // be sent immediately.
- static LLFrameStatsTimer viewer_stats_timer(SEND_STATS_PERIOD);
-
- // Update session stats every large chunk of time
- // *FIX: (?) SAMANTHA
- if (viewer_stats_timer.getElapsedTimeF32() >= SEND_STATS_PERIOD && !gDisconnected)
- {
- LL_INFOS() << "Transmitting sessions stats" << LL_ENDL;
- bool include_preferences = false;
- send_viewer_stats(include_preferences);
- viewer_stats_timer.reset();
- }
-
- // Print the object debugging stats
- static LLFrameTimer object_debug_timer;
- if (object_debug_timer.getElapsedTimeF32() > 5.f)
- {
- object_debug_timer.reset();
- if (gObjectList.mNumDeadObjectUpdates)
- {
- LL_INFOS() << "Dead object updates: " << gObjectList.mNumDeadObjectUpdates << LL_ENDL;
- gObjectList.mNumDeadObjectUpdates = 0;
- }
- if (gObjectList.mNumUnknownUpdates)
- {
- LL_INFOS() << "Unknown object updates: " << gObjectList.mNumUnknownUpdates << LL_ENDL;
- gObjectList.mNumUnknownUpdates = 0;
- }
-
- }
- }
-
- if (!gDisconnected)
- {
+ if (force_send || timed_out)
+ {
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
+ // Send avatar and camera info
+ mLastAgentControlFlags = gAgent.getControlFlags();
+ mLastAgentForceUpdate = force_send ? 0 : agent_force_update_time;
+ send_agent_update(force_send);
+ agent_update_timer.reset();
+ }
+ }
+
+ //////////////////////////////////////
+ //
+ // Manage statistics
+ //
+ //
+ {
+ // Initialize the viewer_stats_timer with an already elapsed time
+ // of SEND_STATS_PERIOD so that the initial stats report will
+ // be sent immediately.
+ static LLFrameStatsTimer viewer_stats_timer(SEND_STATS_PERIOD);
+
+ // Update session stats every large chunk of time
+ // *FIX: (?) SAMANTHA
+ if (viewer_stats_timer.getElapsedTimeF32() >= SEND_STATS_PERIOD && !gDisconnected)
+ {
+ LL_INFOS() << "Transmitting sessions stats" << LL_ENDL;
+ bool include_preferences = false;
+ send_viewer_stats(include_preferences);
+ viewer_stats_timer.reset();
+ }
+
+ // Print the object debugging stats
+ static LLFrameTimer object_debug_timer;
+ if (object_debug_timer.getElapsedTimeF32() > 5.f)
+ {
+ object_debug_timer.reset();
+ if (gObjectList.mNumDeadObjectUpdates)
+ {
+ LL_INFOS() << "Dead object updates: " << gObjectList.mNumDeadObjectUpdates << LL_ENDL;
+ gObjectList.mNumDeadObjectUpdates = 0;
+ }
+ if (gObjectList.mNumUnknownUpdates)
+ {
+ LL_INFOS() << "Unknown object updates: " << gObjectList.mNumUnknownUpdates << LL_ENDL;
+ gObjectList.mNumUnknownUpdates = 0;
+ }
+
+ }
+ }
+
+ if (!gDisconnected)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Network");
- ////////////////////////////////////////////////
- //
- // Network processing
- //
- // NOTE: Starting at this point, we may still have pointers to "dead" objects
- // floating throughout the various object lists.
- //
- idleNameCache();
- idleNetwork();
+ ////////////////////////////////////////////////
+ //
+ // Network processing
+ //
+ // NOTE: Starting at this point, we may still have pointers to "dead" objects
+ // floating throughout the various object lists.
+ //
+ idleNameCache();
+ idleNetwork();
- // Check for away from keyboard, kick idle agents.
- idle_afk_check();
+ // Check for away from keyboard, kick idle agents.
+ idle_afk_check();
- // Update statistics for this frame
- update_statistics();
- }
+ // Update statistics for this frame
+ update_statistics();
+ }
- ////////////////////////////////////////
- //
- // Handle the regular UI idle callbacks as well as
- // hover callbacks
- //
+ ////////////////////////////////////////
+ //
+ // Handle the regular UI idle callbacks as well as
+ // hover callbacks
+ //
#ifdef LL_DARWIN
- if (!mQuitRequested) //MAINT-4243
+ if (!mQuitRequested) //MAINT-4243
#endif
- {
-// LL_RECORD_BLOCK_TIME(FTM_IDLE_CB);
+ {
+// LL_RECORD_BLOCK_TIME(FTM_IDLE_CB);
- // Do event notifications if necessary. Yes, we may want to move this elsewhere.
- gEventNotifier.update();
+ // Do event notifications if necessary. Yes, we may want to move this elsewhere.
+ gEventNotifier.update();
- gIdleCallbacks.callFunctions();
- gInventory.idleNotifyObservers();
- LLAvatarTracker::instance().idleNotifyObservers();
- }
+ gIdleCallbacks.callFunctions();
+ gInventory.idleNotifyObservers();
+ LLAvatarTracker::instance().idleNotifyObservers();
+ }
- // Metrics logging (LLViewerAssetStats, etc.)
- {
- static LLTimer report_interval;
+ // Metrics logging (LLViewerAssetStats, etc.)
+ {
+ static LLTimer report_interval;
- // *TODO: Add configuration controls for this
- F32 seconds = report_interval.getElapsedTimeF32();
- if (seconds >= app_metrics_interval)
- {
- metricsSend(! gDisconnected);
- report_interval.reset();
- }
- }
+ // *TODO: Add configuration controls for this
+ F32 seconds = report_interval.getElapsedTimeF32();
+ if (seconds >= app_metrics_interval)
+ {
+ metricsSend(! gDisconnected);
+ report_interval.reset();
+ }
+ }
// Update layonts, handle mouse events, tooltips, e t c
@@ -4822,335 +4822,335 @@ void LLAppViewer::idle()
// opening chat.
gViewerWindow->updateUI();
- if (gDisconnected)
+ if (gDisconnected)
{
- return;
+ return;
}
- if (gTeleportDisplay)
+ if (gTeleportDisplay)
{
- return;
+ return;
}
- ///////////////////////////////////////
- // Agent and camera movement
- //
- LLCoordGL current_mouse = gViewerWindow->getCurrentMouse();
+ ///////////////////////////////////////
+ // Agent and camera movement
+ //
+ LLCoordGL current_mouse = gViewerWindow->getCurrentMouse();
- {
- // After agent and camera moved, figure out if we need to
- // deselect objects.
- LLSelectMgr::getInstance()->deselectAllIfTooFar();
+ {
+ // After agent and camera moved, figure out if we need to
+ // deselect objects.
+ LLSelectMgr::getInstance()->deselectAllIfTooFar();
- }
+ }
- {
- // Handle pending gesture processing
- LL_RECORD_BLOCK_TIME(FTM_AGENT_POSITION);
- LLGestureMgr::instance().update();
+ {
+ // Handle pending gesture processing
+ LL_RECORD_BLOCK_TIME(FTM_AGENT_POSITION);
+ LLGestureMgr::instance().update();
- gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY);
- }
+ gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY);
+ }
- {
- LL_RECORD_BLOCK_TIME(FTM_OBJECTLIST_UPDATE);
+ {
+ LL_RECORD_BLOCK_TIME(FTM_OBJECTLIST_UPDATE);
if (!(logoutRequestSent() && hasSavedFinalSnapshot()))
- {
- gObjectList.update(gAgent);
- }
- }
-
- //////////////////////////////////////
- //
- // Deletes objects...
- // Has to be done after doing idleUpdates (which can kill objects)
- //
-
- {
- LL_RECORD_BLOCK_TIME(FTM_CLEANUP);
- {
- gObjectList.cleanDeadObjects();
- }
- {
- LL_RECORD_BLOCK_TIME(FTM_CLEANUP_DRAWABLES);
- LLDrawable::cleanupDeadDrawables();
- }
- }
-
- //
- // After this point, in theory we should never see a dead object
- // in the various object/drawable lists.
- //
-
- //////////////////////////////////////
- //
- // Update/send HUD effects
- //
- // At this point, HUD effects may clean up some references to
- // dead objects.
- //
-
- {
- LL_RECORD_BLOCK_TIME(FTM_HUD_EFFECTS);
- LLSelectMgr::getInstance()->updateEffects();
- LLHUDManager::getInstance()->cleanupEffects();
- LLHUDManager::getInstance()->sendEffects();
- }
-
- ////////////////////////////////////////
- //
- // Unpack layer data that we've received
- //
-
- {
- LL_RECORD_BLOCK_TIME(FTM_NETWORK);
- gVLManager.unpackData();
- }
-
- /////////////////////////
- //
- // Update surfaces, and surface textures as well.
- //
-
- LLWorld::getInstance()->updateVisibilities();
- {
- const F32 max_region_update_time = .001f; // 1ms
- LL_RECORD_BLOCK_TIME(FTM_REGION_UPDATE);
- LLWorld::getInstance()->updateRegions(max_region_update_time);
- }
-
- /////////////////////////
- //
- // Update weather effects
- //
-
- // Update wind vector
- LLVector3 wind_position_region;
- static LLVector3 average_wind;
-
- LLViewerRegion *regionp;
- regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position
- if (regionp)
- {
- gWindVec = regionp->mWind.getVelocity(wind_position_region);
-
- // Compute average wind and use to drive motion of water
-
- average_wind = regionp->mWind.getAverage();
- gSky.setWind(average_wind);
- //LLVOWater::setWind(average_wind);
- }
- else
- {
- gWindVec.setVec(0.0f, 0.0f, 0.0f);
- }
-
- //////////////////////////////////////
- //
- // Sort and cull in the new renderer are moved to pipeline.cpp
- // Here, particles are updated and drawables are moved.
- //
-
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP("world update"); //LL_RECORD_BLOCK_TIME(FTM_WORLD_UPDATE);
- gPipeline.updateMove();
- }
-
- LLWorld::getInstance()->updateParticles();
-
- if (gAgentPilot.isPlaying() && gAgentPilot.getOverrideCamera())
- {
- gAgentPilot.moveCamera();
- }
- else if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- LLViewerJoystick::getInstance()->moveFlycam();
- }
- else
- {
- if (LLToolMgr::getInstance()->inBuildMode())
- {
- LLViewerJoystick::getInstance()->moveObjects();
- }
-
- gAgentCamera.updateCamera();
- }
-
- // update media focus
- LLViewerMediaFocus::getInstance()->update();
-
- // Update marketplace
- LLMarketplaceInventoryImporter::update();
- LLMarketplaceInventoryNotifications::update();
-
- // objects and camera should be in sync, do LOD calculations now
- {
- LL_RECORD_BLOCK_TIME(FTM_LOD_UPDATE);
- gObjectList.updateApparentAngles(gAgent);
- }
-
- // Update AV render info
- LLAvatarRenderInfoAccountant::getInstance()->idle();
-
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP("audio update"); //LL_RECORD_BLOCK_TIME(FTM_AUDIO_UPDATE);
-
- if (gAudiop)
- {
- audio_update_volume(false);
- audio_update_listener();
- audio_update_wind(false);
-
- // this line actually commits the changes we've made to source positions, etc.
- gAudiop->idle();
- }
- }
-
- // Handle shutdown process, for example,
- // wait for floaters to close, send quit message,
- // forcibly quit if it has taken too long
- if (mQuitRequested)
- {
- gGLActive = TRUE;
- idleShutdown();
- }
+ {
+ gObjectList.update(gAgent);
+ }
+ }
+
+ //////////////////////////////////////
+ //
+ // Deletes objects...
+ // Has to be done after doing idleUpdates (which can kill objects)
+ //
+
+ {
+ LL_RECORD_BLOCK_TIME(FTM_CLEANUP);
+ {
+ gObjectList.cleanDeadObjects();
+ }
+ {
+ LL_RECORD_BLOCK_TIME(FTM_CLEANUP_DRAWABLES);
+ LLDrawable::cleanupDeadDrawables();
+ }
+ }
+
+ //
+ // After this point, in theory we should never see a dead object
+ // in the various object/drawable lists.
+ //
+
+ //////////////////////////////////////
+ //
+ // Update/send HUD effects
+ //
+ // At this point, HUD effects may clean up some references to
+ // dead objects.
+ //
+
+ {
+ LL_RECORD_BLOCK_TIME(FTM_HUD_EFFECTS);
+ LLSelectMgr::getInstance()->updateEffects();
+ LLHUDManager::getInstance()->cleanupEffects();
+ LLHUDManager::getInstance()->sendEffects();
+ }
+
+ ////////////////////////////////////////
+ //
+ // Unpack layer data that we've received
+ //
+
+ {
+ LL_RECORD_BLOCK_TIME(FTM_NETWORK);
+ gVLManager.unpackData();
+ }
+
+ /////////////////////////
+ //
+ // Update surfaces, and surface textures as well.
+ //
+
+ LLWorld::getInstance()->updateVisibilities();
+ {
+ const F32 max_region_update_time = .001f; // 1ms
+ LL_RECORD_BLOCK_TIME(FTM_REGION_UPDATE);
+ LLWorld::getInstance()->updateRegions(max_region_update_time);
+ }
+
+ /////////////////////////
+ //
+ // Update weather effects
+ //
+
+ // Update wind vector
+ LLVector3 wind_position_region;
+ static LLVector3 average_wind;
+
+ LLViewerRegion *regionp;
+ regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position
+ if (regionp)
+ {
+ gWindVec = regionp->mWind.getVelocity(wind_position_region);
+
+ // Compute average wind and use to drive motion of water
+
+ average_wind = regionp->mWind.getAverage();
+ gSky.setWind(average_wind);
+ //LLVOWater::setWind(average_wind);
+ }
+ else
+ {
+ gWindVec.setVec(0.0f, 0.0f, 0.0f);
+ }
+
+ //////////////////////////////////////
+ //
+ // Sort and cull in the new renderer are moved to pipeline.cpp
+ // Here, particles are updated and drawables are moved.
+ //
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("world update"); //LL_RECORD_BLOCK_TIME(FTM_WORLD_UPDATE);
+ gPipeline.updateMove();
+ }
+
+ LLWorld::getInstance()->updateParticles();
+
+ if (gAgentPilot.isPlaying() && gAgentPilot.getOverrideCamera())
+ {
+ gAgentPilot.moveCamera();
+ }
+ else if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ LLViewerJoystick::getInstance()->moveFlycam();
+ }
+ else
+ {
+ if (LLToolMgr::getInstance()->inBuildMode())
+ {
+ LLViewerJoystick::getInstance()->moveObjects();
+ }
+
+ gAgentCamera.updateCamera();
+ }
+
+ // update media focus
+ LLViewerMediaFocus::getInstance()->update();
+
+ // Update marketplace
+ LLMarketplaceInventoryImporter::update();
+ LLMarketplaceInventoryNotifications::update();
+
+ // objects and camera should be in sync, do LOD calculations now
+ {
+ LL_RECORD_BLOCK_TIME(FTM_LOD_UPDATE);
+ gObjectList.updateApparentAngles(gAgent);
+ }
+
+ // Update AV render info
+ LLAvatarRenderInfoAccountant::getInstance()->idle();
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("audio update"); //LL_RECORD_BLOCK_TIME(FTM_AUDIO_UPDATE);
+
+ if (gAudiop)
+ {
+ audio_update_volume(false);
+ audio_update_listener();
+ audio_update_wind(false);
+
+ // this line actually commits the changes we've made to source positions, etc.
+ gAudiop->idle();
+ }
+ }
+
+ // Handle shutdown process, for example,
+ // wait for floaters to close, send quit message,
+ // forcibly quit if it has taken too long
+ if (mQuitRequested)
+ {
+ gGLActive = TRUE;
+ idleShutdown();
+ }
}
void LLAppViewer::idleShutdown()
{
- // Wait for all modal alerts to get resolved
- if (LLModalDialog::activeCount() > 0)
- {
- return;
- }
-
- // close IM interface
- if(gIMMgr)
- {
- gIMMgr->disconnectAllSessions();
- }
-
- // Wait for all floaters to get resolved
- if (gFloaterView
- && !gFloaterView->allChildrenClosed())
- {
- return;
- }
-
-
-
-
- // ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup()
- // *TODO: ugly
- static bool saved_teleport_history = false;
- if (!saved_teleport_history)
- {
- saved_teleport_history = true;
- LLTeleportHistory::getInstance()->dump();
- LLLocationHistory::getInstance()->save(); // *TODO: find a better place for doing this
- return;
- }
-
- static bool saved_snapshot = false;
- if (!saved_snapshot)
- {
- saved_snapshot = true;
- saveFinalSnapshot();
- return;
- }
-
- const F32 SHUTDOWN_UPLOAD_SAVE_TIME = 5.f;
-
- S32 pending_uploads = gAssetStorage->getNumPendingUploads();
- if (pending_uploads > 0
- && gLogoutTimer.getElapsedTimeF32() < SHUTDOWN_UPLOAD_SAVE_TIME
- && !logoutRequestSent())
- {
- static S32 total_uploads = 0;
- // Sometimes total upload count can change during logout.
- total_uploads = llmax(total_uploads, pending_uploads);
- gViewerWindow->setShowProgress(TRUE);
- S32 finished_uploads = total_uploads - pending_uploads;
- F32 percent = 100.f * finished_uploads / total_uploads;
- gViewerWindow->setProgressPercent(percent);
- gViewerWindow->setProgressString(LLTrans::getString("SavingSettings"));
- return;
- }
-
- if (gPendingMetricsUploads > 0
- && gLogoutTimer.getElapsedTimeF32() < SHUTDOWN_UPLOAD_SAVE_TIME
- && !logoutRequestSent())
- {
+ // Wait for all modal alerts to get resolved
+ if (LLModalDialog::activeCount() > 0)
+ {
+ return;
+ }
+
+ // close IM interface
+ if(gIMMgr)
+ {
+ gIMMgr->disconnectAllSessions();
+ }
+
+ // Wait for all floaters to get resolved
+ if (gFloaterView
+ && !gFloaterView->allChildrenClosed())
+ {
+ return;
+ }
+
+
+
+
+ // ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup()
+ // *TODO: ugly
+ static bool saved_teleport_history = false;
+ if (!saved_teleport_history)
+ {
+ saved_teleport_history = true;
+ LLTeleportHistory::getInstance()->dump();
+ LLLocationHistory::getInstance()->save(); // *TODO: find a better place for doing this
+ return;
+ }
+
+ static bool saved_snapshot = false;
+ if (!saved_snapshot)
+ {
+ saved_snapshot = true;
+ saveFinalSnapshot();
+ return;
+ }
+
+ const F32 SHUTDOWN_UPLOAD_SAVE_TIME = 5.f;
+
+ S32 pending_uploads = gAssetStorage->getNumPendingUploads();
+ if (pending_uploads > 0
+ && gLogoutTimer.getElapsedTimeF32() < SHUTDOWN_UPLOAD_SAVE_TIME
+ && !logoutRequestSent())
+ {
+ static S32 total_uploads = 0;
+ // Sometimes total upload count can change during logout.
+ total_uploads = llmax(total_uploads, pending_uploads);
+ gViewerWindow->setShowProgress(TRUE);
+ S32 finished_uploads = total_uploads - pending_uploads;
+ F32 percent = 100.f * finished_uploads / total_uploads;
+ gViewerWindow->setProgressPercent(percent);
+ gViewerWindow->setProgressString(LLTrans::getString("SavingSettings"));
+ return;
+ }
+
+ if (gPendingMetricsUploads > 0
+ && gLogoutTimer.getElapsedTimeF32() < SHUTDOWN_UPLOAD_SAVE_TIME
+ && !logoutRequestSent())
+ {
+ gViewerWindow->setShowProgress(TRUE);
+ gViewerWindow->setProgressPercent(100.f);
+ gViewerWindow->setProgressString(LLTrans::getString("LoggingOut"));
+ return;
+ }
+
+ // All floaters are closed. Tell server we want to quit.
+ if( !logoutRequestSent() )
+ {
+ sendLogoutRequest();
+
+ // Wait for a LogoutReply message
gViewerWindow->setShowProgress(TRUE);
gViewerWindow->setProgressPercent(100.f);
gViewerWindow->setProgressString(LLTrans::getString("LoggingOut"));
- return;
- }
-
- // All floaters are closed. Tell server we want to quit.
- if( !logoutRequestSent() )
- {
- sendLogoutRequest();
-
- // Wait for a LogoutReply message
- gViewerWindow->setShowProgress(TRUE);
- gViewerWindow->setProgressPercent(100.f);
- gViewerWindow->setProgressString(LLTrans::getString("LoggingOut"));
- return;
- }
-
- // Make sure that we quit if we haven't received a reply from the server.
- if( logoutRequestSent()
- && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime )
- {
- forceQuit();
- return;
- }
+ return;
+ }
+
+ // Make sure that we quit if we haven't received a reply from the server.
+ if( logoutRequestSent()
+ && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime )
+ {
+ forceQuit();
+ return;
+ }
}
void LLAppViewer::sendLogoutRequest()
{
- if(!mLogoutRequestSent && gMessageSystem)
- {
- //Set internal status variables and marker files before actually starting the logout process
- gLogoutInProgress = TRUE;
- if (!mSecondInstance)
- {
- mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME);
-
- mLogoutMarkerFile.open(mLogoutMarkerFileName, LL_APR_WB);
- if (mLogoutMarkerFile.getFileHandle())
- {
- LL_INFOS("MarkerFile") << "Created logout marker file '"<< mLogoutMarkerFileName << "' " << LL_ENDL;
- recordMarkerVersion(mLogoutMarkerFile);
- }
- else
- {
- LL_WARNS("MarkerFile") << "Cannot create logout marker file " << mLogoutMarkerFileName << LL_ENDL;
- }
- }
- else
- {
- LL_INFOS("MarkerFile") << "Did not logout marker file because this is a second instance" << LL_ENDL;
- }
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_LogoutRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gAgent.sendReliableMessage();
-
- gLogoutTimer.reset();
- gLogoutMaxTime = LOGOUT_REQUEST_TIME;
- mLogoutRequestSent = TRUE;
-
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->leaveChannel();
- }
- }
+ if(!mLogoutRequestSent && gMessageSystem)
+ {
+ //Set internal status variables and marker files before actually starting the logout process
+ gLogoutInProgress = TRUE;
+ if (!mSecondInstance)
+ {
+ mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME);
+
+ mLogoutMarkerFile.open(mLogoutMarkerFileName, LL_APR_WB);
+ if (mLogoutMarkerFile.getFileHandle())
+ {
+ LL_INFOS("MarkerFile") << "Created logout marker file '"<< mLogoutMarkerFileName << "' " << LL_ENDL;
+ recordMarkerVersion(mLogoutMarkerFile);
+ }
+ else
+ {
+ LL_WARNS("MarkerFile") << "Cannot create logout marker file " << mLogoutMarkerFileName << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_INFOS("MarkerFile") << "Did not logout marker file because this is a second instance" << LL_ENDL;
+ }
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_LogoutRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gAgent.sendReliableMessage();
+
+ gLogoutTimer.reset();
+ gLogoutMaxTime = LOGOUT_REQUEST_TIME;
+ mLogoutRequestSent = TRUE;
+
+ if(LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->leaveChannel();
+ }
+ }
}
void LLAppViewer::updateNameLookupUrl(const LLViewerRegion * regionp)
@@ -5196,19 +5196,19 @@ void LLAppViewer::updateNameLookupUrl(const LLViewerRegion * regionp)
void LLAppViewer::idleNameCache()
{
- // Neither old nor new name cache can function before agent has a region
- LLViewerRegion* region = gAgent.getRegion();
+ // Neither old nor new name cache can function before agent has a region
+ LLViewerRegion* region = gAgent.getRegion();
if (!region)
{
return;
}
- // deal with any queued name requests and replies.
- gCacheName->processPending();
+ // deal with any queued name requests and replies.
+ gCacheName->processPending();
- // Can't run the new cache until we have the list of capabilities
- // for the agent region, and can therefore decide whether to use
- // display names or fall back to the old name system.
+ // Can't run the new cache until we have the list of capabilities
+ // for the agent region, and can therefore decide whether to use
+ // display names or fall back to the old name system.
if (!region->capabilitiesReceived())
{
return;
@@ -5238,141 +5238,141 @@ static LLTrace::BlockTimerStatHandle FTM_CHECK_REGION_CIRCUIT("Check Region Circ
void LLAppViewer::idleNetwork()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
- pingMainloopTimeout("idleNetwork");
-
- gObjectList.mNumNewObjects = 0;
- S32 total_decoded = 0;
-
- if (!gSavedSettings.getBOOL("SpeedTest"))
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("idle network"); //LL_RECORD_BLOCK_TIME(FTM_IDLE_NETWORK); // decode
-
- LLTimer check_message_timer;
- // Read all available packets from network
- const S64 frame_count = gFrameCount; // U32->S64
- F32 total_time = 0.0f;
-
- {
- LockMessageChecker lmc(gMessageSystem);
- while (lmc.checkAllMessages(frame_count, gServicePump))
- {
- if (gDoDisconnect)
- {
- // We're disconnecting, don't process any more messages from the server
- // We're usually disconnecting due to either network corruption or a
- // server going down, so this is OK.
- break;
- }
-
- total_decoded++;
- gPacketsIn++;
-
- if (total_decoded > MESSAGE_MAX_PER_FRAME)
- {
- break;
- }
+ pingMainloopTimeout("idleNetwork");
+
+ gObjectList.mNumNewObjects = 0;
+ S32 total_decoded = 0;
+
+ if (!gSavedSettings.getBOOL("SpeedTest"))
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("idle network"); //LL_RECORD_BLOCK_TIME(FTM_IDLE_NETWORK); // decode
+
+ LLTimer check_message_timer;
+ // Read all available packets from network
+ const S64 frame_count = gFrameCount; // U32->S64
+ F32 total_time = 0.0f;
+
+ {
+ LockMessageChecker lmc(gMessageSystem);
+ while (lmc.checkAllMessages(frame_count, gServicePump))
+ {
+ if (gDoDisconnect)
+ {
+ // We're disconnecting, don't process any more messages from the server
+ // We're usually disconnecting due to either network corruption or a
+ // server going down, so this is OK.
+ break;
+ }
+
+ total_decoded++;
+ gPacketsIn++;
+
+ if (total_decoded > MESSAGE_MAX_PER_FRAME)
+ {
+ break;
+ }
#ifdef TIME_THROTTLE_MESSAGES
- // Prevent slow packets from completely destroying the frame rate.
- // This usually happens due to clumps of avatars taking huge amount
- // of network processing time (which needs to be fixed, but this is
- // a good limit anyway).
- total_time = check_message_timer.getElapsedTimeF32();
- if (total_time >= CheckMessagesMaxTime)
- break;
+ // Prevent slow packets from completely destroying the frame rate.
+ // This usually happens due to clumps of avatars taking huge amount
+ // of network processing time (which needs to be fixed, but this is
+ // a good limit anyway).
+ total_time = check_message_timer.getElapsedTimeF32();
+ if (total_time >= CheckMessagesMaxTime)
+ break;
#endif
- }
+ }
- // Handle per-frame message system processing.
- lmc.processAcks(gSavedSettings.getF32("AckCollectTime"));
- }
+ // Handle per-frame message system processing.
+ lmc.processAcks(gSavedSettings.getF32("AckCollectTime"));
+ }
#ifdef TIME_THROTTLE_MESSAGES
- if (total_time >= CheckMessagesMaxTime)
- {
- // Increase CheckMessagesMaxTime so that we will eventually catch up
- CheckMessagesMaxTime *= 1.035f; // 3.5% ~= x2 in 20 frames, ~8x in 60 frames
- }
- else
- {
- // Reset CheckMessagesMaxTime to default value
- CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME;
- }
+ if (total_time >= CheckMessagesMaxTime)
+ {
+ // Increase CheckMessagesMaxTime so that we will eventually catch up
+ CheckMessagesMaxTime *= 1.035f; // 3.5% ~= x2 in 20 frames, ~8x in 60 frames
+ }
+ else
+ {
+ // Reset CheckMessagesMaxTime to default value
+ CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME;
+ }
#endif
- // we want to clear the control after sending out all necessary agent updates
- gAgent.resetControlFlags();
-
- // Decode enqueued messages...
- S32 remaining_possible_decodes = MESSAGE_MAX_PER_FRAME - total_decoded;
-
- if( remaining_possible_decodes <= 0 )
- {
- LL_INFOS() << "Maxed out number of messages per frame at " << MESSAGE_MAX_PER_FRAME << LL_ENDL;
- }
-
- if (gPrintMessagesThisFrame)
- {
- LL_INFOS() << "Decoded " << total_decoded << " msgs this frame!" << LL_ENDL;
- gPrintMessagesThisFrame = FALSE;
- }
- }
- add(LLStatViewer::NUM_NEW_OBJECTS, gObjectList.mNumNewObjects);
-
- // Retransmit unacknowledged packets.
- gXferManager->retransmitUnackedPackets();
- gAssetStorage->checkForTimeouts();
- gViewerThrottle.updateDynamicThrottle();
-
- // Check that the circuit between the viewer and the agent's current
- // region is still alive
- LLViewerRegion *agent_region = gAgent.getRegion();
- if (agent_region && (LLStartUp::getStartupState()==STATE_STARTED))
- {
- LLUUID this_region_id = agent_region->getRegionID();
- bool this_region_alive = agent_region->isAlive();
- if ((mAgentRegionLastAlive && !this_region_alive) // newly dead
- && (mAgentRegionLastID == this_region_id)) // same region
- {
- forceDisconnect(LLTrans::getString("AgentLostConnection"));
- }
- mAgentRegionLastID = this_region_id;
- mAgentRegionLastAlive = this_region_alive;
- }
+ // we want to clear the control after sending out all necessary agent updates
+ gAgent.resetControlFlags();
+
+ // Decode enqueued messages...
+ S32 remaining_possible_decodes = MESSAGE_MAX_PER_FRAME - total_decoded;
+
+ if( remaining_possible_decodes <= 0 )
+ {
+ LL_INFOS() << "Maxed out number of messages per frame at " << MESSAGE_MAX_PER_FRAME << LL_ENDL;
+ }
+
+ if (gPrintMessagesThisFrame)
+ {
+ LL_INFOS() << "Decoded " << total_decoded << " msgs this frame!" << LL_ENDL;
+ gPrintMessagesThisFrame = FALSE;
+ }
+ }
+ add(LLStatViewer::NUM_NEW_OBJECTS, gObjectList.mNumNewObjects);
+
+ // Retransmit unacknowledged packets.
+ gXferManager->retransmitUnackedPackets();
+ gAssetStorage->checkForTimeouts();
+ gViewerThrottle.updateDynamicThrottle();
+
+ // Check that the circuit between the viewer and the agent's current
+ // region is still alive
+ LLViewerRegion *agent_region = gAgent.getRegion();
+ if (agent_region && (LLStartUp::getStartupState()==STATE_STARTED))
+ {
+ LLUUID this_region_id = agent_region->getRegionID();
+ bool this_region_alive = agent_region->isAlive();
+ if ((mAgentRegionLastAlive && !this_region_alive) // newly dead
+ && (mAgentRegionLastID == this_region_id)) // same region
+ {
+ forceDisconnect(LLTrans::getString("AgentLostConnection"));
+ }
+ mAgentRegionLastID = this_region_id;
+ mAgentRegionLastAlive = this_region_alive;
+ }
}
void LLAppViewer::disconnectViewer()
{
- if (gDisconnected)
- {
- return;
- }
- //
- // Cleanup after quitting.
- //
- // Save snapshot for next time, if we made it through initialization
-
- LL_INFOS() << "Disconnecting viewer!" << LL_ENDL;
-
- // Dump our frame statistics
-
- // Remember if we were flying
- gSavedSettings.setBOOL("FlyingAtExit", gAgent.getFlying() );
-
- // Un-minimize all windows so they don't get saved minimized
- if (gFloaterView)
- {
- gFloaterView->restoreAll();
- }
-
- if (LLSelectMgr::instanceExists())
- {
- LLSelectMgr::getInstance()->deselectAll();
- }
-
- // save inventory if appropriate
+ if (gDisconnected)
+ {
+ return;
+ }
+ //
+ // Cleanup after quitting.
+ //
+ // Save snapshot for next time, if we made it through initialization
+
+ LL_INFOS() << "Disconnecting viewer!" << LL_ENDL;
+
+ // Dump our frame statistics
+
+ // Remember if we were flying
+ gSavedSettings.setBOOL("FlyingAtExit", gAgent.getFlying() );
+
+ // Un-minimize all windows so they don't get saved minimized
+ if (gFloaterView)
+ {
+ gFloaterView->restoreAll();
+ }
+
+ if (LLSelectMgr::instanceExists())
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+
+ // save inventory if appropriate
if (gInventory.isInventoryUsable()
&& gAgent.getID().notNull()) // Shouldn't be null at this stage
{
@@ -5387,44 +5387,44 @@ void LLAppViewer::disconnectViewer()
}
}
- saveNameCache();
- if (LLExperienceCache::instanceExists())
- {
- // TODO: LLExperienceCache::cleanup() logic should be moved to
- // cleanupSingleton().
- LLExperienceCache::instance().cleanup();
- }
+ saveNameCache();
+ if (LLExperienceCache::instanceExists())
+ {
+ // TODO: LLExperienceCache::cleanup() logic should be moved to
+ // cleanupSingleton().
+ LLExperienceCache::instance().cleanup();
+ }
- // close inventory interface, close all windows
- LLSidepanelInventory::cleanup();
+ // close inventory interface, close all windows
+ LLSidepanelInventory::cleanup();
- gAgentWearables.cleanup();
- gAgentCamera.cleanup();
- // Also writes cached agent settings to gSavedSettings
- gAgent.cleanup();
+ gAgentWearables.cleanup();
+ gAgentCamera.cleanup();
+ // Also writes cached agent settings to gSavedSettings
+ gAgent.cleanup();
- // This is where we used to call gObjectList.destroy() and then delete gWorldp.
- // Now we just ask the LLWorld singleton to cleanly shut down.
- if(LLWorld::instanceExists())
- {
- LLWorld::getInstance()->resetClass();
- }
- LLVOCache::deleteSingleton();
+ // This is where we used to call gObjectList.destroy() and then delete gWorldp.
+ // Now we just ask the LLWorld singleton to cleanly shut down.
+ if(LLWorld::instanceExists())
+ {
+ LLWorld::getInstance()->resetClass();
+ }
+ LLVOCache::deleteSingleton();
- // call all self-registered classes
- LLDestroyClassList::instance().fireCallbacks();
+ // call all self-registered classes
+ LLDestroyClassList::instance().fireCallbacks();
- cleanup_xfer_manager();
- gDisconnected = TRUE;
+ cleanup_xfer_manager();
+ gDisconnected = TRUE;
- // Pass the connection state to LLUrlEntryParcel not to attempt
- // parcel info requests while disconnected.
- LLUrlEntryParcel::setDisconnected(gDisconnected);
+ // Pass the connection state to LLUrlEntryParcel not to attempt
+ // parcel info requests while disconnected.
+ LLUrlEntryParcel::setDisconnected(gDisconnected);
}
void LLAppViewer::forceErrorLLError()
{
- LL_ERRS() << "This is a deliberate llerror" << LL_ENDL;
+ LL_ERRS() << "This is a deliberate llerror" << LL_ENDL;
}
void LLAppViewer::forceErrorLLErrorMsg()
@@ -5437,7 +5437,7 @@ void LLAppViewer::forceErrorLLErrorMsg()
void LLAppViewer::forceErrorBreakpoint()
{
- LL_WARNS() << "Forcing a deliberate breakpoint" << LL_ENDL;
+ LL_WARNS() << "Forcing a deliberate breakpoint" << LL_ENDL;
#ifdef LL_WINDOWS
DebugBreak();
#else
@@ -5448,7 +5448,7 @@ void LLAppViewer::forceErrorBreakpoint()
void LLAppViewer::forceErrorBadMemoryAccess()
{
- LL_WARNS() << "Forcing a deliberate bad memory access" << LL_ENDL;
+ LL_WARNS() << "Forcing a deliberate bad memory access" << LL_ENDL;
S32* crash = NULL;
*crash = 0xDEADBEEF;
return;
@@ -5456,7 +5456,7 @@ void LLAppViewer::forceErrorBadMemoryAccess()
void LLAppViewer::forceErrorInfiniteLoop()
{
- LL_WARNS() << "Forcing a deliberate infinite loop" << LL_ENDL;
+ LL_WARNS() << "Forcing a deliberate infinite loop" << LL_ENDL;
// Loop is intentionally complicated to fool basic loop detection
LLTimer timer_total;
LLTimer timer_expiry;
@@ -5475,7 +5475,7 @@ void LLAppViewer::forceErrorInfiniteLoop()
void LLAppViewer::forceErrorSoftwareException()
{
- LL_WARNS() << "Forcing a deliberate exception" << LL_ENDL;
+ LL_WARNS() << "Forcing a deliberate exception" << LL_ENDL;
LLTHROW(LLException("User selected Force Software Exception"));
}
@@ -5488,8 +5488,8 @@ void LLAppViewer::forceErrorOSSpecificException()
void LLAppViewer::forceErrorDriverCrash()
{
- LL_WARNS() << "Forcing a deliberate driver crash" << LL_ENDL;
- glDeleteTextures(1, NULL);
+ LL_WARNS() << "Forcing a deliberate driver crash" << LL_ENDL;
+ glDeleteTextures(1, NULL);
}
void LLAppViewer::forceErrorCoroutineCrash()
@@ -5521,120 +5521,120 @@ void LLAppViewer::forceErrorThreadCrash()
void LLAppViewer::initMainloopTimeout(const std::string& state, F32 secs)
{
- if(!mMainloopTimeout)
- {
- mMainloopTimeout = new LLWatchdogTimeout();
- resumeMainloopTimeout(state, secs);
- }
+ if(!mMainloopTimeout)
+ {
+ mMainloopTimeout = new LLWatchdogTimeout();
+ resumeMainloopTimeout(state, secs);
+ }
}
void LLAppViewer::destroyMainloopTimeout()
{
- if(mMainloopTimeout)
- {
- delete mMainloopTimeout;
- mMainloopTimeout = NULL;
- }
+ if(mMainloopTimeout)
+ {
+ delete mMainloopTimeout;
+ mMainloopTimeout = NULL;
+ }
}
void LLAppViewer::resumeMainloopTimeout(const std::string& state, F32 secs)
{
- if(mMainloopTimeout)
- {
- if(secs < 0.0f)
- {
- static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
- secs = mainloop_timeout;
- }
-
- mMainloopTimeout->setTimeout(secs);
- mMainloopTimeout->start(state);
- }
+ if(mMainloopTimeout)
+ {
+ if(secs < 0.0f)
+ {
+ static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
+ secs = mainloop_timeout;
+ }
+
+ mMainloopTimeout->setTimeout(secs);
+ mMainloopTimeout->start(state);
+ }
}
void LLAppViewer::pauseMainloopTimeout()
{
- if(mMainloopTimeout)
- {
- mMainloopTimeout->stop();
- }
+ if(mMainloopTimeout)
+ {
+ mMainloopTimeout->stop();
+ }
}
void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
- if(mMainloopTimeout)
- {
- if(secs < 0.0f)
- {
- static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
- secs = mainloop_timeout;
- }
-
- mMainloopTimeout->setTimeout(secs);
- mMainloopTimeout->ping(state);
- }
+ if(mMainloopTimeout)
+ {
+ if(secs < 0.0f)
+ {
+ static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
+ secs = mainloop_timeout;
+ }
+
+ mMainloopTimeout->setTimeout(secs);
+ mMainloopTimeout->ping(state);
+ }
}
void LLAppViewer::handleLoginComplete()
{
- gLoggedInTime.start();
- initMainloopTimeout("Mainloop Init");
-
- // Store some data to DebugInfo in case of a freeze.
- gDebugInfo["ClientInfo"]["Name"] = LLVersionInfo::instance().getChannel();
-
- gDebugInfo["ClientInfo"]["MajorVersion"] = LLVersionInfo::instance().getMajor();
- gDebugInfo["ClientInfo"]["MinorVersion"] = LLVersionInfo::instance().getMinor();
- gDebugInfo["ClientInfo"]["PatchVersion"] = LLVersionInfo::instance().getPatch();
- gDebugInfo["ClientInfo"]["BuildVersion"] = std::to_string(LLVersionInfo::instance().getBuild());
-
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if ( parcel && parcel->getMusicURL()[0])
- {
- gDebugInfo["ParcelMusicURL"] = parcel->getMusicURL();
- }
- if ( parcel && parcel->getMediaURL()[0])
- {
- gDebugInfo["ParcelMediaURL"] = parcel->getMediaURL();
- }
-
- gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile");
- gDebugInfo["CAFilename"] = gDirUtilp->getCAFile();
- gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName();
- gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath();
-
- if(gAgent.getRegion())
- {
- gDebugInfo["CurrentSimHost"] = gAgent.getRegion()->getSimHostName();
- gDebugInfo["CurrentRegion"] = gAgent.getRegion()->getName();
- }
-
- if(LLAppViewer::instance()->mMainloopTimeout)
- {
- gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState();
- }
-
- mOnLoginCompleted();
-
- writeDebugInfo();
-
- // we logged in successfully, so save settings on logout
- LL_INFOS() << "Login successful, per account settings will be saved on log out." << LL_ENDL;
- mSavePerAccountSettings=true;
+ gLoggedInTime.start();
+ initMainloopTimeout("Mainloop Init");
+
+ // Store some data to DebugInfo in case of a freeze.
+ gDebugInfo["ClientInfo"]["Name"] = LLVersionInfo::instance().getChannel();
+
+ gDebugInfo["ClientInfo"]["MajorVersion"] = LLVersionInfo::instance().getMajor();
+ gDebugInfo["ClientInfo"]["MinorVersion"] = LLVersionInfo::instance().getMinor();
+ gDebugInfo["ClientInfo"]["PatchVersion"] = LLVersionInfo::instance().getPatch();
+ gDebugInfo["ClientInfo"]["BuildVersion"] = std::to_string(LLVersionInfo::instance().getBuild());
+
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if ( parcel && parcel->getMusicURL()[0])
+ {
+ gDebugInfo["ParcelMusicURL"] = parcel->getMusicURL();
+ }
+ if ( parcel && parcel->getMediaURL()[0])
+ {
+ gDebugInfo["ParcelMediaURL"] = parcel->getMediaURL();
+ }
+
+ gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile");
+ gDebugInfo["CAFilename"] = gDirUtilp->getCAFile();
+ gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName();
+ gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath();
+
+ if(gAgent.getRegion())
+ {
+ gDebugInfo["CurrentSimHost"] = gAgent.getRegion()->getSimHostName();
+ gDebugInfo["CurrentRegion"] = gAgent.getRegion()->getName();
+ }
+
+ if(LLAppViewer::instance()->mMainloopTimeout)
+ {
+ gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState();
+ }
+
+ mOnLoginCompleted();
+
+ writeDebugInfo();
+
+ // we logged in successfully, so save settings on logout
+ LL_INFOS() << "Login successful, per account settings will be saved on log out." << LL_ENDL;
+ mSavePerAccountSettings=true;
}
//virtual
void LLAppViewer::setMasterSystemAudioMute(bool mute)
{
- gSavedSettings.setBOOL("MuteAudio", mute);
+ gSavedSettings.setBOOL("MuteAudio", mute);
}
//virtual
bool LLAppViewer::getMasterSystemAudioMute()
{
- return gSavedSettings.getBOOL("MuteAudio");
+ return gSavedSettings.getBOOL("MuteAudio");
}
//----------------------------------------------------------------------------
@@ -5650,10 +5650,10 @@ bool LLAppViewer::getMasterSystemAudioMute()
*/
void LLAppViewer::metricsUpdateRegion(U64 region_handle)
{
- if (0 != region_handle)
- {
- LLViewerAssetStatsFF::set_region(region_handle);
- }
+ if (0 != region_handle)
+ {
+ LLViewerAssetStatsFF::set_region(region_handle);
+ }
}
/**
@@ -5662,35 +5662,35 @@ void LLAppViewer::metricsUpdateRegion(U64 region_handle)
*/
void LLAppViewer::metricsSend(bool enable_reporting)
{
- if (! gViewerAssetStats)
- return;
+ if (! gViewerAssetStats)
+ return;
- if (LLAppViewer::sTextureFetch)
- {
- LLViewerRegion * regionp = gAgent.getRegion();
+ if (LLAppViewer::sTextureFetch)
+ {
+ LLViewerRegion * regionp = gAgent.getRegion();
- if (enable_reporting && regionp)
- {
- std::string caps_url = regionp->getCapability("ViewerMetrics");
+ if (enable_reporting && regionp)
+ {
+ std::string caps_url = regionp->getCapability("ViewerMetrics");
LLSD sd = gViewerAssetStats->asLLSD(true);
- // Send a report request into 'thread1' to get the rest of the data
- // and provide some additional parameters while here.
- LLAppViewer::sTextureFetch->commandSendMetrics(caps_url,
- gAgentSessionID,
- gAgentID,
- sd);
- }
- else
- {
- LLAppViewer::sTextureFetch->commandDataBreak();
- }
- }
-
- // Reset even if we can't report. Rather than gather up a huge chunk of
- // data, we'll keep to our sampling interval and retain the data
- // resolution in time.
- gViewerAssetStats->restart();
+ // Send a report request into 'thread1' to get the rest of the data
+ // and provide some additional parameters while here.
+ LLAppViewer::sTextureFetch->commandSendMetrics(caps_url,
+ gAgentSessionID,
+ gAgentID,
+ sd);
+ }
+ else
+ {
+ LLAppViewer::sTextureFetch->commandDataBreak();
+ }
+ }
+
+ // Reset even if we can't report. Rather than gather up a huge chunk of
+ // data, we'll keep to our sampling interval and retain the data
+ // resolution in time.
+ gViewerAssetStats->restart();
}
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 9352dba06d..27e1d32a38 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -1,9 +1,9 @@
-/**
+/**
* @mainpage
* @mainpage
*
* This is the sources for the Second Life Viewer;
- * information on the open source project is at
+ * information on the open source project is at
* https://wiki.secondlife.com/wiki/Open_Source_Portal
*
* The Mercurial repository for the trunk version is at
@@ -18,21 +18,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*
@@ -46,7 +46,7 @@
#include "llallocator.h"
#include "llapr.h"
#include "llcontrol.h"
-#include "llsys.h" // for LLOSInfo
+#include "llsys.h" // for LLOSInfo
#include "lltimer.h"
#include "llappcorehttp.h"
#include "threadpool_fwd.h"
@@ -69,86 +69,86 @@ extern LLTrace::BlockTimerStatHandle FTM_FRAME;
class LLAppViewer : public LLApp
{
public:
- LLAppViewer();
- virtual ~LLAppViewer();
-
- /**
- * @brief Access to the LLAppViewer singleton.
- *
- * The LLAppViewer singleton is created in main()/WinMain().
- * So don't use it in pre-entry (static initialization) code.
- */
- static LLAppViewer* instance() {return sInstance; }
-
- //
- // Main application logic
- //
- virtual bool init(); // Override to do application initialization
- virtual bool cleanup(); // Override to do application cleanup
- virtual bool frame(); // Override for application body logic
-
- // Application control
- void flushLFSIO(); // waits for lfs transfers to complete
- void forceQuit(); // Puts the viewer into 'shutting down without error' mode.
- void fastQuit(S32 error_code = 0); // Shuts down the viewer immediately after sending a logout message
- void requestQuit(); // Request a quit. A kinder, gentler quit.
- void userQuit(); // The users asks to quit. Confirm, then requestQuit()
- void earlyExit(const std::string& name,
- const LLSD& substitutions = LLSD()); // Display an error dialog and forcibly quit.
- void earlyExitNoNotify(); // Do not display error dialog then forcibly quit.
- void abortQuit(); // Called to abort a quit request.
-
- bool quitRequested() { return mQuitRequested; }
- bool logoutRequestSent() { return mLogoutRequestSent; }
- bool isSecondInstance() { return mSecondInstance; }
+ LLAppViewer();
+ virtual ~LLAppViewer();
+
+ /**
+ * @brief Access to the LLAppViewer singleton.
+ *
+ * The LLAppViewer singleton is created in main()/WinMain().
+ * So don't use it in pre-entry (static initialization) code.
+ */
+ static LLAppViewer* instance() {return sInstance; }
+
+ //
+ // Main application logic
+ //
+ virtual bool init(); // Override to do application initialization
+ virtual bool cleanup(); // Override to do application cleanup
+ virtual bool frame(); // Override for application body logic
+
+ // Application control
+ void flushLFSIO(); // waits for lfs transfers to complete
+ void forceQuit(); // Puts the viewer into 'shutting down without error' mode.
+ void fastQuit(S32 error_code = 0); // Shuts down the viewer immediately after sending a logout message
+ void requestQuit(); // Request a quit. A kinder, gentler quit.
+ void userQuit(); // The users asks to quit. Confirm, then requestQuit()
+ void earlyExit(const std::string& name,
+ const LLSD& substitutions = LLSD()); // Display an error dialog and forcibly quit.
+ void earlyExitNoNotify(); // Do not display error dialog then forcibly quit.
+ void abortQuit(); // Called to abort a quit request.
+
+ bool quitRequested() { return mQuitRequested; }
+ bool logoutRequestSent() { return mLogoutRequestSent; }
+ bool isSecondInstance() { return mSecondInstance; }
bool isUpdaterMissing(); // In use by tests
bool waitForUpdater();
- void writeDebugInfo(bool isStatic=true);
+ void writeDebugInfo(bool isStatic=true);
+
+ void setServerReleaseNotesURL(const std::string& url) { mServerReleaseNotesURL = url; }
+ LLSD getViewerInfo() const;
+ std::string getViewerInfoString(bool default_string = false) const;
- void setServerReleaseNotesURL(const std::string& url) { mServerReleaseNotesURL = url; }
- LLSD getViewerInfo() const;
- std::string getViewerInfoString(bool default_string = false) const;
+ // Report true if under the control of a debugger. A null-op default.
+ virtual bool beingDebugged() { return false; }
- // Report true if under the control of a debugger. A null-op default.
- virtual bool beingDebugged() { return false; }
+ virtual bool restoreErrorTrap() = 0; // Require platform specific override to reset error handling mechanism.
+ // return false if the error trap needed restoration.
+ void checkForCrash();
- virtual bool restoreErrorTrap() = 0; // Require platform specific override to reset error handling mechanism.
- // return false if the error trap needed restoration.
- void checkForCrash();
-
- // Thread accessors
- static LLTextureCache* getTextureCache() { return sTextureCache; }
- static LLImageDecodeThread* getImageDecodeThread() { return sImageDecodeThread; }
- static LLTextureFetch* getTextureFetch() { return sTextureFetch; }
- static LLPurgeDiskCacheThread* getPurgeDiskCacheThread() { return sPurgeDiskCacheThread; }
+ // Thread accessors
+ static LLTextureCache* getTextureCache() { return sTextureCache; }
+ static LLImageDecodeThread* getImageDecodeThread() { return sImageDecodeThread; }
+ static LLTextureFetch* getTextureFetch() { return sTextureFetch; }
+ static LLPurgeDiskCacheThread* getPurgeDiskCacheThread() { return sPurgeDiskCacheThread; }
- static U32 getTextureCacheVersion() ;
- static U32 getObjectCacheVersion() ;
+ static U32 getTextureCacheVersion() ;
+ static U32 getObjectCacheVersion() ;
static U32 getDiskCacheVersion() ;
- const std::string& getSerialNumber() { return mSerialNumber; }
+ const std::string& getSerialNumber() { return mSerialNumber; }
- bool getPurgeCache() const { return mPurgeCache; }
+ bool getPurgeCache() const { return mPurgeCache; }
- std::string getSecondLifeTitle() const; // The Second Life title.
- std::string getWindowTitle() const; // The window display name.
+ std::string getSecondLifeTitle() const; // The Second Life title.
+ std::string getWindowTitle() const; // The window display name.
- void forceDisconnect(const std::string& msg); // Force disconnection, with a message to the user.
- void badNetworkHandler(); // Cause a crash state due to bad network packet.
+ void forceDisconnect(const std::string& msg); // Force disconnection, with a message to the user.
+ void badNetworkHandler(); // Cause a crash state due to bad network packet.
- bool hasSavedFinalSnapshot() { return mSavedFinalSnapshot; }
- void saveFinalSnapshot();
+ bool hasSavedFinalSnapshot() { return mSavedFinalSnapshot; }
+ void saveFinalSnapshot();
- void loadNameCache();
- void saveNameCache();
+ void loadNameCache();
+ void saveNameCache();
- void loadExperienceCache();
- void saveExperienceCache();
+ void loadExperienceCache();
+ void saveExperienceCache();
- void removeMarkerFiles();
+ void removeMarkerFiles();
- void removeDumpDir();
+ void removeDumpDir();
// LLAppViewer testing helpers.
// *NOTE: These will potentially crash the viewer. Only for debugging.
virtual void forceErrorLLError();
@@ -162,175 +162,175 @@ public:
virtual void forceErrorCoroutineCrash();
virtual void forceErrorThreadCrash();
- // The list is found in app_settings/settings_files.xml
- // but since they are used explicitly in code,
- // the follow consts should also do the trick.
- static const std::string sGlobalSettingsName;
-
- LLCachedControl<bool> mRandomizeFramerate;
- LLCachedControl<bool> mPeriodicSlowFrame;
-
- // Load settings from the location specified by loction_key.
- // Key availale and rules for loading, are specified in
- // 'app_settings/settings_files.xml'
- bool loadSettingsFromDirectory(const std::string& location_key,
- bool set_defaults = false);
-
- std::string getSettingsFilename(const std::string& location_key,
- const std::string& file);
- void loadColorSettings();
-
- // For thread debugging.
- // llstartup needs to control init.
- // llworld, send_agent_pause() also controls pause/resume.
- void initMainloopTimeout(const std::string& state, F32 secs = -1.0f);
- void destroyMainloopTimeout();
- void pauseMainloopTimeout();
- void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f);
- void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f);
-
- // Handle the 'login completed' event.
- // *NOTE:Mani Fix this for login abstraction!!
- void handleLoginComplete();
-
- LLAllocator & getAllocator() { return mAlloc; }
-
- // On LoginCompleted callback
- typedef boost::signals2::signal<void (void)> login_completed_signal_t;
- login_completed_signal_t mOnLoginCompleted;
- boost::signals2::connection setOnLoginCompletedCallback( const login_completed_signal_t::slot_type& cb )
- {
- return mOnLoginCompleted.connect(cb);
- }
-
- void addOnIdleCallback(const boost::function<void()>& cb); // add a callback to fire (once) when idle
+ // The list is found in app_settings/settings_files.xml
+ // but since they are used explicitly in code,
+ // the follow consts should also do the trick.
+ static const std::string sGlobalSettingsName;
+
+ LLCachedControl<bool> mRandomizeFramerate;
+ LLCachedControl<bool> mPeriodicSlowFrame;
+
+ // Load settings from the location specified by loction_key.
+ // Key availale and rules for loading, are specified in
+ // 'app_settings/settings_files.xml'
+ bool loadSettingsFromDirectory(const std::string& location_key,
+ bool set_defaults = false);
+
+ std::string getSettingsFilename(const std::string& location_key,
+ const std::string& file);
+ void loadColorSettings();
+
+ // For thread debugging.
+ // llstartup needs to control init.
+ // llworld, send_agent_pause() also controls pause/resume.
+ void initMainloopTimeout(const std::string& state, F32 secs = -1.0f);
+ void destroyMainloopTimeout();
+ void pauseMainloopTimeout();
+ void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f);
+ void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f);
+
+ // Handle the 'login completed' event.
+ // *NOTE:Mani Fix this for login abstraction!!
+ void handleLoginComplete();
+
+ LLAllocator & getAllocator() { return mAlloc; }
+
+ // On LoginCompleted callback
+ typedef boost::signals2::signal<void (void)> login_completed_signal_t;
+ login_completed_signal_t mOnLoginCompleted;
+ boost::signals2::connection setOnLoginCompletedCallback( const login_completed_signal_t::slot_type& cb )
+ {
+ return mOnLoginCompleted.connect(cb);
+ }
+
+ void addOnIdleCallback(const boost::function<void()>& cb); // add a callback to fire (once) when idle
void initGeneralThread();
- void purgeUserDataOnExit() { mPurgeUserDataOnExit = true; }
- void purgeCache(); // Clear the local cache.
- void purgeCacheImmediate(); //clear local cache immediately.
- S32 updateTextureThreads(F32 max_time);
+ void purgeUserDataOnExit() { mPurgeUserDataOnExit = true; }
+ void purgeCache(); // Clear the local cache.
+ void purgeCacheImmediate(); //clear local cache immediately.
+ S32 updateTextureThreads(F32 max_time);
- void loadKeyBindings();
+ void loadKeyBindings();
- // mute/unmute the system's master audio
- virtual void setMasterSystemAudioMute(bool mute);
- virtual bool getMasterSystemAudioMute();
+ // mute/unmute the system's master audio
+ virtual void setMasterSystemAudioMute(bool mute);
+ virtual bool getMasterSystemAudioMute();
- // Metrics policy helper statics.
- static void metricsUpdateRegion(U64 region_handle);
- static void metricsSend(bool enable_reporting);
+ // Metrics policy helper statics.
+ static void metricsUpdateRegion(U64 region_handle);
+ static void metricsSend(bool enable_reporting);
- // llcorehttp init/shutdown/config information.
- LLAppCoreHttp & getAppCoreHttp() { return mAppCoreHttp; }
+ // llcorehttp init/shutdown/config information.
+ LLAppCoreHttp & getAppCoreHttp() { return mAppCoreHttp; }
- void updateNameLookupUrl(const LLViewerRegion* regionp);
+ void updateNameLookupUrl(const LLViewerRegion* regionp);
protected:
- virtual bool initWindow(); // Initialize the viewer's window.
- virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system
- virtual void initConsole() {}; // Initialize OS level debugging console.
- virtual bool initHardwareTest() { return true; } // A false result indicates the app should quit.
- virtual bool initSLURLHandler();
- virtual bool sendURLToOtherInstance(const std::string& url);
+ virtual bool initWindow(); // Initialize the viewer's window.
+ virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system
+ virtual void initConsole() {}; // Initialize OS level debugging console.
+ virtual bool initHardwareTest() { return true; } // A false result indicates the app should quit.
+ virtual bool initSLURLHandler();
+ virtual bool sendURLToOtherInstance(const std::string& url);
- virtual bool initParseCommandLine(LLCommandLineParser& clp)
- { return true; } // Allow platforms to specify the command line args.
+ virtual bool initParseCommandLine(LLCommandLineParser& clp)
+ { return true; } // Allow platforms to specify the command line args.
- virtual std::string generateSerialNumber() = 0; // Platforms specific classes generate this.
+ virtual std::string generateSerialNumber() = 0; // Platforms specific classes generate this.
- virtual bool meetsRequirementsForMaximizedStart(); // Used on first login to decide to launch maximized
+ virtual bool meetsRequirementsForMaximizedStart(); // Used on first login to decide to launch maximized
private:
- bool doFrame();
+ bool doFrame();
- void initMaxHeapSize();
- bool initThreads(); // Initialize viewer threads, return false on failure.
- bool initConfiguration(); // Initialize settings from the command line/config file.
- void initStrings(); // Initialize LLTrans machinery
- bool initCache(); // Initialize local client cache.
+ void initMaxHeapSize();
+ bool initThreads(); // Initialize viewer threads, return false on failure.
+ bool initConfiguration(); // Initialize settings from the command line/config file.
+ void initStrings(); // Initialize LLTrans machinery
+ bool initCache(); // Initialize local client cache.
- // We have switched locations of both Mac and Windows cache, make sure
- // files migrate and old cache is cleared out.
- void migrateCacheDirectory();
+ // We have switched locations of both Mac and Windows cache, make sure
+ // files migrate and old cache is cleared out.
+ void migrateCacheDirectory();
- void cleanupSavedSettings(); // Sets some config data to current or default values during cleanup.
- void removeCacheFiles(const std::string& filemask); // Deletes cached files the match the given wildcard.
+ void cleanupSavedSettings(); // Sets some config data to current or default values during cleanup.
+ void removeCacheFiles(const std::string& filemask); // Deletes cached files the match the given wildcard.
- void writeSystemInfo(); // Write system info to "debug_info.log"
+ void writeSystemInfo(); // Write system info to "debug_info.log"
- void processMarkerFiles();
- static void recordMarkerVersion(LLAPRFile& marker_file);
- bool markerIsSameVersion(const std::string& marker_name) const;
+ void processMarkerFiles();
+ static void recordMarkerVersion(LLAPRFile& marker_file);
+ bool markerIsSameVersion(const std::string& marker_name) const;
- void idle();
- void idleShutdown();
- // update avatar SLID and display name caches
- void idleNameCache();
- void idleNetwork();
+ void idle();
+ void idleShutdown();
+ // update avatar SLID and display name caches
+ void idleNameCache();
+ void idleNetwork();
- void sendLogoutRequest();
- void disconnectViewer();
+ void sendLogoutRequest();
+ void disconnectViewer();
- // *FIX: the app viewer class should be some sort of singleton, no?
- // Perhaps its child class is the singleton and this should be an abstract base.
- static LLAppViewer* sInstance;
+ // *FIX: the app viewer class should be some sort of singleton, no?
+ // Perhaps its child class is the singleton and this should be an abstract base.
+ static LLAppViewer* sInstance;
- bool mSecondInstance; // Is this a second instance of the app?
- bool mUpdaterNotFound; // True when attempt to start updater failed
+ bool mSecondInstance; // Is this a second instance of the app?
+ bool mUpdaterNotFound; // True when attempt to start updater failed
- std::string mMarkerFileName;
- LLAPRFile mMarkerFile; // A file created to indicate the app is running.
+ std::string mMarkerFileName;
+ LLAPRFile mMarkerFile; // A file created to indicate the app is running.
- std::string mLogoutMarkerFileName;
- LLAPRFile mLogoutMarkerFile; // A file created to indicate the app is running.
+ std::string mLogoutMarkerFileName;
+ LLAPRFile mLogoutMarkerFile; // A file created to indicate the app is running.
- bool mReportedCrash;
+ bool mReportedCrash;
- std::string mServerReleaseNotesURL;
+ std::string mServerReleaseNotesURL;
- // Thread objects.
- static LLTextureCache* sTextureCache;
- static LLImageDecodeThread* sImageDecodeThread;
- static LLTextureFetch* sTextureFetch;
- static LLPurgeDiskCacheThread* sPurgeDiskCacheThread;
+ // Thread objects.
+ static LLTextureCache* sTextureCache;
+ static LLImageDecodeThread* sImageDecodeThread;
+ static LLTextureFetch* sTextureFetch;
+ static LLPurgeDiskCacheThread* sPurgeDiskCacheThread;
LL::ThreadPool* mGeneralThreadPool;
- S32 mNumSessions;
+ S32 mNumSessions;
- std::string mSerialNumber;
- bool mPurgeCache;
- bool mPurgeCacheOnExit;
- bool mPurgeUserDataOnExit;
- LLViewerJoystick* joystick;
+ std::string mSerialNumber;
+ bool mPurgeCache;
+ bool mPurgeCacheOnExit;
+ bool mPurgeUserDataOnExit;
+ LLViewerJoystick* joystick;
- bool mSavedFinalSnapshot;
- bool mSavePerAccountSettings; // only save per account settings if login succeeded
+ bool mSavedFinalSnapshot;
+ bool mSavePerAccountSettings; // only save per account settings if login succeeded
- boost::optional<U32> mForceGraphicsLevel;
+ boost::optional<U32> mForceGraphicsLevel;
- bool mQuitRequested; // User wants to quit, may have modified documents open.
- bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim.
- U32 mLastAgentControlFlags;
- F32 mLastAgentForceUpdate;
- struct SettingsFiles* mSettingsLocationList;
+ bool mQuitRequested; // User wants to quit, may have modified documents open.
+ bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim.
+ U32 mLastAgentControlFlags;
+ F32 mLastAgentForceUpdate;
+ struct SettingsFiles* mSettingsLocationList;
- LLWatchdogTimeout* mMainloopTimeout;
+ LLWatchdogTimeout* mMainloopTimeout;
- // For performance and metric gathering
- class LLThread* mFastTimerLogThread;
+ // For performance and metric gathering
+ class LLThread* mFastTimerLogThread;
- // for tracking viewer<->region circuit death
- bool mAgentRegionLastAlive;
- LLUUID mAgentRegionLastID;
+ // for tracking viewer<->region circuit death
+ bool mAgentRegionLastAlive;
+ LLUUID mAgentRegionLastID;
- LLAllocator mAlloc;
+ LLAllocator mAlloc;
- // llcorehttp library init/shutdown helper
- LLAppCoreHttp mAppCoreHttp;
+ // llcorehttp library init/shutdown helper
+ LLAppCoreHttp mAppCoreHttp;
- bool mIsFirstRun;
+ bool mIsFirstRun;
};
// consts from viewer.h
@@ -343,16 +343,16 @@ const S32 AGENT_FORCE_UPDATES_PER_SECOND = 1;
// "// llstartup" indicates that llstartup is the only client for this global.
extern LLSD gDebugInfo;
-extern BOOL gShowObjectUpdates;
+extern BOOL gShowObjectUpdates;
-typedef enum
+typedef enum
{
- LAST_EXEC_NORMAL = 0,
- LAST_EXEC_FROZE,
- LAST_EXEC_LLERROR_CRASH,
- LAST_EXEC_OTHER_CRASH,
- LAST_EXEC_LOGOUT_FROZE,
- LAST_EXEC_LOGOUT_CRASH
+ LAST_EXEC_NORMAL = 0,
+ LAST_EXEC_FROZE,
+ LAST_EXEC_LLERROR_CRASH,
+ LAST_EXEC_OTHER_CRASH,
+ LAST_EXEC_LOGOUT_FROZE,
+ LAST_EXEC_LOGOUT_CRASH
} eLastExecEvent;
extern eLastExecEvent gLastExecEvent; // llstartup
@@ -365,12 +365,12 @@ extern U32 gForegroundFrameCount;
extern LLPumpIO* gServicePump;
-extern U64MicrosecondsImplicit gStartTime;
-extern U64MicrosecondsImplicit gFrameTime; // The timestamp of the most-recently-processed frame
-extern F32SecondsImplicit gFrameTimeSeconds; // Loses msec precision after ~4.5 hours...
-extern F32SecondsImplicit gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds
-extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame
-extern F32 gFrameDTClamped;
+extern U64MicrosecondsImplicit gStartTime;
+extern U64MicrosecondsImplicit gFrameTime; // The timestamp of the most-recently-processed frame
+extern F32SecondsImplicit gFrameTimeSeconds; // Loses msec precision after ~4.5 hours...
+extern F32SecondsImplicit gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds
+extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame
+extern F32 gFrameDTClamped;
extern LLTimer gRenderStartTime;
extern LLFrameTimer gForegroundTime;
@@ -381,14 +381,14 @@ extern LLTimer gLogoutTimer;
extern S32 gPendingMetricsUploads;
-extern F32 gSimLastTime;
+extern F32 gSimLastTime;
extern F32 gSimFrames;
-extern BOOL gDisconnected;
+extern BOOL gDisconnected;
-extern LLFrameTimer gRestoreGLTimer;
-extern BOOL gRestoreGL;
-extern bool gUseWireframe;
+extern LLFrameTimer gRestoreGLTimer;
+extern BOOL gRestoreGL;
+extern bool gUseWireframe;
extern LLMemoryInfo gSysMemory;
extern U64Bytes gMemoryAllocated;
@@ -397,7 +397,7 @@ extern std::string gLastVersionChannel;
extern LLVector3 gWindVec;
extern LLVector3 gRelativeWindVec;
-extern U32 gPacketsIn;
+extern U32 gPacketsIn;
extern BOOL gPrintMessagesThisFrame;
extern LLUUID gBlackSquareID;
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index 9f58f90326..1709970156 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -5,24 +5,24 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#include "llviewerprecompiledheaders.h"
@@ -31,7 +31,7 @@
#include "llcommandlineparser.h"
#include "lldiriterator.h"
-#include "llurldispatcher.h" // SLURL from other app instance
+#include "llurldispatcher.h" // SLURL from other app instance
#include "llviewernetwork.h"
#include "llviewercontrol.h"
#include "llwindowsdl.h"
@@ -53,57 +53,57 @@
namespace
{
- int gArgC = 0;
- char **gArgV = NULL;
- void (*gOldTerminateHandler)() = NULL;
+ int gArgC = 0;
+ char **gArgV = NULL;
+ void (*gOldTerminateHandler)() = NULL;
}
static void exceptionTerminateHandler()
{
- // reinstall default terminate() handler in case we re-terminate.
- if (gOldTerminateHandler) std::set_terminate(gOldTerminateHandler);
- // treat this like a regular viewer crash, with nice stacktrace etc.
+ // reinstall default terminate() handler in case we re-terminate.
+ if (gOldTerminateHandler) std::set_terminate(gOldTerminateHandler);
+ // treat this like a regular viewer crash, with nice stacktrace etc.
long *null_ptr;
null_ptr = 0;
*null_ptr = 0xDEADBEEF; //Force an exception that will trigger breakpad.
- // we've probably been killed-off before now, but...
- gOldTerminateHandler(); // call old terminate() handler
+ // we've probably been killed-off before now, but...
+ gOldTerminateHandler(); // call old terminate() handler
}
-int main( int argc, char **argv )
+int main( int argc, char **argv )
{
- gArgC = argc;
- gArgV = argv;
-
- LLAppViewer* viewer_app_ptr = new LLAppViewerLinux();
-
- // install unexpected exception handler
- gOldTerminateHandler = std::set_terminate(exceptionTerminateHandler);
-
- bool ok = viewer_app_ptr->init();
- if(!ok)
- {
- LL_WARNS() << "Application init failed." << LL_ENDL;
- return -1;
- }
-
- // Run the application main loop
- while (! viewer_app_ptr->frame())
- {}
-
- if (!LLApp::isError())
- {
- //
- // We don't want to do cleanup here if the error handler got called -
- // the assumption is that the error handler is responsible for doing
- // app cleanup if there was a problem.
- //
- viewer_app_ptr->cleanup();
- }
- delete viewer_app_ptr;
- viewer_app_ptr = NULL;
- return 0;
+ gArgC = argc;
+ gArgV = argv;
+
+ LLAppViewer* viewer_app_ptr = new LLAppViewerLinux();
+
+ // install unexpected exception handler
+ gOldTerminateHandler = std::set_terminate(exceptionTerminateHandler);
+
+ bool ok = viewer_app_ptr->init();
+ if(!ok)
+ {
+ LL_WARNS() << "Application init failed." << LL_ENDL;
+ return -1;
+ }
+
+ // Run the application main loop
+ while (! viewer_app_ptr->frame())
+ {}
+
+ if (!LLApp::isError())
+ {
+ //
+ // We don't want to do cleanup here if the error handler got called -
+ // the assumption is that the error handler is responsible for doing
+ // app cleanup if there was a problem.
+ //
+ viewer_app_ptr->cleanup();
+ }
+ delete viewer_app_ptr;
+ viewer_app_ptr = NULL;
+ return 0;
}
LLAppViewerLinux::LLAppViewerLinux()
@@ -116,13 +116,13 @@ LLAppViewerLinux::~LLAppViewerLinux()
bool LLAppViewerLinux::init()
{
- // g_thread_init() must be called before *any* use of glib, *and*
- // before any mutexes are held, *and* some of our third-party
- // libraries likes to use glib functions; in short, do this here
- // really early in app startup!
- if (!g_thread_supported ()) g_thread_init (NULL);
-
- bool success = LLAppViewer::init();
+ // g_thread_init() must be called before *any* use of glib, *and*
+ // before any mutexes are held, *and* some of our third-party
+ // libraries likes to use glib functions; in short, do this here
+ // really early in app startup!
+ if (!g_thread_supported ()) g_thread_init (NULL);
+
+ bool success = LLAppViewer::init();
#if LL_SEND_CRASH_REPORTS
if (success)
@@ -132,14 +132,14 @@ bool LLAppViewerLinux::init()
}
#endif
- return success;
+ return success;
}
bool LLAppViewerLinux::restoreErrorTrap()
{
- // *NOTE:Mani there is a case for implementing this on the mac.
- // Linux doesn't need it to my knowledge.
- return true;
+ // *NOTE:Mani there is a case for implementing this on the mac.
+ // Linux doesn't need it to my knowledge.
+ return true;
}
/////////////////////////////////////////
@@ -157,22 +157,22 @@ static void viewerappapi_class_init(ViewerAppAPIClass *klass);
// regrettable hacks to give us better runtime compatibility with older systems in general
static GType llg_type_register_static_simple_ONCE(GType parent_type,
- const gchar *type_name,
- guint class_size,
- GClassInitFunc class_init,
- guint instance_size,
- GInstanceInitFunc instance_init,
- GTypeFlags flags)
+ const gchar *type_name,
+ guint class_size,
+ GClassInitFunc class_init,
+ guint instance_size,
+ GInstanceInitFunc instance_init,
+ GTypeFlags flags)
{
- static GTypeInfo type_info;
- memset(&type_info, 0, sizeof(type_info));
+ static GTypeInfo type_info;
+ memset(&type_info, 0, sizeof(type_info));
- type_info.class_size = class_size;
- type_info.class_init = class_init;
- type_info.instance_size = instance_size;
- type_info.instance_init = instance_init;
+ type_info.class_size = class_size;
+ type_info.class_init = class_init;
+ type_info.instance_size = instance_size;
+ type_info.instance_init = instance_init;
- return g_type_register_static(parent_type, type_name, &type_info, flags);
+ return g_type_register_static(parent_type, type_name, &type_info, flags);
}
#define llg_intern_static_string(S) (S)
#define g_intern_static_string(S) llg_intern_static_string(S)
@@ -188,66 +188,66 @@ static bool dbus_server_init = false;
void viewerappapi_init(ViewerAppAPI *server)
{
- // Connect to the default DBUS, register our service/API.
-
- if (!dbus_server_init)
- {
- GError *error = NULL;
-
- server->connection = lldbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (server->connection)
- {
- lldbus_g_object_type_install_info(viewerappapi_get_type(), &dbus_glib_viewerapp_object_info);
-
- lldbus_g_connection_register_g_object(server->connection, VIEWERAPI_PATH, G_OBJECT(server));
-
- DBusGProxy *serverproxy = lldbus_g_proxy_new_for_name(server->connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
-
- guint request_name_ret_unused;
- // akin to org_freedesktop_DBus_request_name
- if (lldbus_g_proxy_call(serverproxy, "RequestName", &error, G_TYPE_STRING, VIEWERAPI_SERVICE, G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_UINT, &request_name_ret_unused, G_TYPE_INVALID))
- {
- // total success.
- dbus_server_init = true;
- }
- else
- {
- LL_WARNS() << "Unable to register service name: " << error->message << LL_ENDL;
- }
-
- g_object_unref(serverproxy);
- }
- else
- {
- g_warning("Unable to connect to dbus: %s", error->message);
- }
-
- if (error)
- g_error_free(error);
- }
+ // Connect to the default DBUS, register our service/API.
+
+ if (!dbus_server_init)
+ {
+ GError *error = NULL;
+
+ server->connection = lldbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (server->connection)
+ {
+ lldbus_g_object_type_install_info(viewerappapi_get_type(), &dbus_glib_viewerapp_object_info);
+
+ lldbus_g_connection_register_g_object(server->connection, VIEWERAPI_PATH, G_OBJECT(server));
+
+ DBusGProxy *serverproxy = lldbus_g_proxy_new_for_name(server->connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+
+ guint request_name_ret_unused;
+ // akin to org_freedesktop_DBus_request_name
+ if (lldbus_g_proxy_call(serverproxy, "RequestName", &error, G_TYPE_STRING, VIEWERAPI_SERVICE, G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_UINT, &request_name_ret_unused, G_TYPE_INVALID))
+ {
+ // total success.
+ dbus_server_init = true;
+ }
+ else
+ {
+ LL_WARNS() << "Unable to register service name: " << error->message << LL_ENDL;
+ }
+
+ g_object_unref(serverproxy);
+ }
+ else
+ {
+ g_warning("Unable to connect to dbus: %s", error->message);
+ }
+
+ if (error)
+ g_error_free(error);
+ }
}
gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error)
{
- bool success = false;
+ bool success = false;
- LL_INFOS() << "Was asked to go to slurl: " << slurl << LL_ENDL;
+ LL_INFOS() << "Was asked to go to slurl: " << slurl << LL_ENDL;
- std::string url = slurl;
- LLMediaCtrl* web = NULL;
- const bool trusted_browser = false;
- if (LLURLDispatcher::dispatch(url, "", web, trusted_browser))
- {
- // bring window to foreground, as it has just been "launched" from a URL
- // todo: hmm, how to get there from here?
- //xxx->mWindow->bringToFront();
- success = true;
- }
+ std::string url = slurl;
+ LLMediaCtrl* web = NULL;
+ const bool trusted_browser = false;
+ if (LLURLDispatcher::dispatch(url, "", web, trusted_browser))
+ {
+ // bring window to foreground, as it has just been "launched" from a URL
+ // todo: hmm, how to get there from here?
+ //xxx->mWindow->bringToFront();
+ success = true;
+ }
- *success_rtn = g_new (gboolean, 1);
- (*success_rtn)[0] = (gboolean)success;
+ *success_rtn = g_new (gboolean, 1);
+ (*success_rtn)[0] = (gboolean)success;
- return TRUE; // the invokation succeeded, even if the actual dispatch didn't.
+ return TRUE; // the invokation succeeded, even if the actual dispatch didn't.
}
///
@@ -255,81 +255,81 @@ gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **succ
//virtual
bool LLAppViewerLinux::initSLURLHandler()
{
- if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
- {
- return false; // failed
- }
+ if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
+ {
+ return false; // failed
+ }
- g_type_init();
+ g_type_init();
- //ViewerAppAPI *api_server = (ViewerAppAPI*)
- g_object_new(viewerappapi_get_type(), NULL);
+ //ViewerAppAPI *api_server = (ViewerAppAPI*)
+ g_object_new(viewerappapi_get_type(), NULL);
- return true;
+ return true;
}
//virtual
bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)
{
- if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
- {
- return false; // failed
- }
-
- bool success = false;
- DBusGConnection *bus;
- GError *error = NULL;
-
- g_type_init();
-
- bus = lldbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (bus)
- {
- gboolean rtn = FALSE;
- DBusGProxy *remote_object =
- lldbus_g_proxy_new_for_name(bus, VIEWERAPI_SERVICE, VIEWERAPI_PATH, VIEWERAPI_INTERFACE);
-
- if (lldbus_g_proxy_call(remote_object, "GoSLURL", &error,
- G_TYPE_STRING, url.c_str(), G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &rtn, G_TYPE_INVALID))
- {
- success = rtn;
- }
- else
- {
- LL_INFOS() << "Call-out to other instance failed (perhaps not running): " << error->message << LL_ENDL;
- }
-
- g_object_unref(G_OBJECT(remote_object));
- }
- else
- {
- LL_WARNS() << "Couldn't connect to session bus: " << error->message << LL_ENDL;
- }
-
- if (error)
- g_error_free(error);
-
- return success;
+ if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
+ {
+ return false; // failed
+ }
+
+ bool success = false;
+ DBusGConnection *bus;
+ GError *error = NULL;
+
+ g_type_init();
+
+ bus = lldbus_g_bus_get (DBUS_BUS_SESSION, &error);
+ if (bus)
+ {
+ gboolean rtn = FALSE;
+ DBusGProxy *remote_object =
+ lldbus_g_proxy_new_for_name(bus, VIEWERAPI_SERVICE, VIEWERAPI_PATH, VIEWERAPI_INTERFACE);
+
+ if (lldbus_g_proxy_call(remote_object, "GoSLURL", &error,
+ G_TYPE_STRING, url.c_str(), G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &rtn, G_TYPE_INVALID))
+ {
+ success = rtn;
+ }
+ else
+ {
+ LL_INFOS() << "Call-out to other instance failed (perhaps not running): " << error->message << LL_ENDL;
+ }
+
+ g_object_unref(G_OBJECT(remote_object));
+ }
+ else
+ {
+ LL_WARNS() << "Couldn't connect to session bus: " << error->message << LL_ENDL;
+ }
+
+ if (error)
+ g_error_free(error);
+
+ return success;
}
#else // LL_DBUS_ENABLED
bool LLAppViewerLinux::initSLURLHandler()
{
- return false; // not implemented without dbus
+ return false; // not implemented without dbus
}
bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)
{
- return false; // not implemented without dbus
+ return false; // not implemented without dbus
}
#endif // LL_DBUS_ENABLED
void LLAppViewerLinux::initCrashReporting(bool reportFreeze)
{
- std::string cmd =gDirUtilp->getExecutableDir();
- cmd += gDirUtilp->getDirDelimiter();
+ std::string cmd =gDirUtilp->getExecutableDir();
+ cmd += gDirUtilp->getDirDelimiter();
#if LL_LINUX
- cmd += "linux-crash-logger.bin";
+ cmd += "linux-crash-logger.bin";
#else
# error Unknown platform
#endif
@@ -338,157 +338,157 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze)
pid_str << LLApp::getPid();
std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "");
std::string appname = gDirUtilp->getExecutableFilename();
- // launch the actual crash logger
- const char * cmdargv[] =
- {cmd.c_str(),
- "-user",
- (char*)LLGridManager::getInstance()->getGridId().c_str(),
- "-name",
- LLAppViewer::instance()->getSecondLifeTitle().c_str(),
- "-pid",
- pid_str.str().c_str(),
- "-dumpdir",
- logdir.c_str(),
- "-procname",
- appname.c_str(),
- NULL};
- fflush(NULL);
-
- pid_t pid = fork();
- if (pid == 0)
- { // child
- execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */
- LL_WARNS() << "execv failure when trying to start " << cmd << LL_ENDL;
- _exit(1); // avoid atexit()
- }
- else
- {
- if (pid > 0)
- {
- // DO NOT wait for child proc to die; we want
- // the logger to outlive us while we quit to
- // free up the screen/keyboard/etc.
- ////int childExitStatus;
- ////waitpid(pid, &childExitStatus, 0);
- }
- else
- {
- LL_WARNS() << "fork failure." << LL_ENDL;
- }
- }
- // Sometimes signals don't seem to quit the viewer. Also, we may
- // have been called explicitly instead of from a signal handler.
- // Make sure we exit so as to not totally confuse the user.
- //_exit(1); // avoid atexit(), else we may re-crash in dtors.
+ // launch the actual crash logger
+ const char * cmdargv[] =
+ {cmd.c_str(),
+ "-user",
+ (char*)LLGridManager::getInstance()->getGridId().c_str(),
+ "-name",
+ LLAppViewer::instance()->getSecondLifeTitle().c_str(),
+ "-pid",
+ pid_str.str().c_str(),
+ "-dumpdir",
+ logdir.c_str(),
+ "-procname",
+ appname.c_str(),
+ NULL};
+ fflush(NULL);
+
+ pid_t pid = fork();
+ if (pid == 0)
+ { // child
+ execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */
+ LL_WARNS() << "execv failure when trying to start " << cmd << LL_ENDL;
+ _exit(1); // avoid atexit()
+ }
+ else
+ {
+ if (pid > 0)
+ {
+ // DO NOT wait for child proc to die; we want
+ // the logger to outlive us while we quit to
+ // free up the screen/keyboard/etc.
+ ////int childExitStatus;
+ ////waitpid(pid, &childExitStatus, 0);
+ }
+ else
+ {
+ LL_WARNS() << "fork failure." << LL_ENDL;
+ }
+ }
+ // Sometimes signals don't seem to quit the viewer. Also, we may
+ // have been called explicitly instead of from a signal handler.
+ // Make sure we exit so as to not totally confuse the user.
+ //_exit(1); // avoid atexit(), else we may re-crash in dtors.
}
bool LLAppViewerLinux::beingDebugged()
{
- static enum {unknown, no, yes} debugged = unknown;
-
- if (debugged == unknown)
- {
- pid_t ppid = getppid();
- char *name;
- int ret;
-
- ret = asprintf(&name, "/proc/%d/exe", ppid);
- if (ret != -1)
- {
- char buf[1024];
- ssize_t n;
-
- n = readlink(name, buf, sizeof(buf) - 1);
- if (n != -1)
- {
- char *base = strrchr(buf, '/');
- buf[n + 1] = '\0';
- if (base == NULL)
- {
- base = buf;
- } else {
- base += 1;
- }
-
- if (strcmp(base, "gdb") == 0)
- {
- debugged = yes;
- }
- }
- free(name);
- }
- }
-
- return debugged == yes;
+ static enum {unknown, no, yes} debugged = unknown;
+
+ if (debugged == unknown)
+ {
+ pid_t ppid = getppid();
+ char *name;
+ int ret;
+
+ ret = asprintf(&name, "/proc/%d/exe", ppid);
+ if (ret != -1)
+ {
+ char buf[1024];
+ ssize_t n;
+
+ n = readlink(name, buf, sizeof(buf) - 1);
+ if (n != -1)
+ {
+ char *base = strrchr(buf, '/');
+ buf[n + 1] = '\0';
+ if (base == NULL)
+ {
+ base = buf;
+ } else {
+ base += 1;
+ }
+
+ if (strcmp(base, "gdb") == 0)
+ {
+ debugged = yes;
+ }
+ }
+ free(name);
+ }
+ }
+
+ return debugged == yes;
}
void LLAppViewerLinux::initLoggingAndGetLastDuration()
{
- // Remove the last stack trace, if any
- // This file is no longer created, since the move to Google Breakpad
- // The code is left here to clean out any old state in the log dir
- std::string old_stack_file =
- gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log");
- LLFile::remove(old_stack_file);
-
- LLAppViewer::initLoggingAndGetLastDuration();
+ // Remove the last stack trace, if any
+ // This file is no longer created, since the move to Google Breakpad
+ // The code is left here to clean out any old state in the log dir
+ std::string old_stack_file =
+ gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log");
+ LLFile::remove(old_stack_file);
+
+ LLAppViewer::initLoggingAndGetLastDuration();
}
bool LLAppViewerLinux::initParseCommandLine(LLCommandLineParser& clp)
{
- if (!clp.parseCommandLine(gArgC, gArgV))
- {
- return false;
- }
-
- // Find the system language.
- FL_Locale *locale = NULL;
- FL_Success success = FL_FindLocale(&locale, FL_MESSAGES);
- if (success != 0)
- {
- if (success >= 2 && locale->lang) // confident!
- {
- LL_INFOS("AppInit") << "Language " << ll_safe_string(locale->lang) << LL_ENDL;
- LL_INFOS("AppInit") << "Location " << ll_safe_string(locale->country) << LL_ENDL;
- LL_INFOS("AppInit") << "Variant " << ll_safe_string(locale->variant) << LL_ENDL;
-
- LLControlVariable* c = gSavedSettings.getControl("SystemLanguage");
- if(c)
- {
- c->setValue(std::string(locale->lang), false);
- }
- }
- }
- FL_FreeLocale(&locale);
-
- return true;
+ if (!clp.parseCommandLine(gArgC, gArgV))
+ {
+ return false;
+ }
+
+ // Find the system language.
+ FL_Locale *locale = NULL;
+ FL_Success success = FL_FindLocale(&locale, FL_MESSAGES);
+ if (success != 0)
+ {
+ if (success >= 2 && locale->lang) // confident!
+ {
+ LL_INFOS("AppInit") << "Language " << ll_safe_string(locale->lang) << LL_ENDL;
+ LL_INFOS("AppInit") << "Location " << ll_safe_string(locale->country) << LL_ENDL;
+ LL_INFOS("AppInit") << "Variant " << ll_safe_string(locale->variant) << LL_ENDL;
+
+ LLControlVariable* c = gSavedSettings.getControl("SystemLanguage");
+ if(c)
+ {
+ c->setValue(std::string(locale->lang), false);
+ }
+ }
+ }
+ FL_FreeLocale(&locale);
+
+ return true;
}
std::string LLAppViewerLinux::generateSerialNumber()
{
- char serial_md5[MD5HEX_STR_SIZE];
- serial_md5[0] = 0;
- std::string best;
- std::string uuiddir("/dev/disk/by-uuid/");
-
- // trawl /dev/disk/by-uuid looking for a good-looking UUID to grab
- std::string this_name;
-
- LLDirIterator iter(uuiddir, "*");
- while (iter.next(this_name))
- {
- if (this_name.length() > best.length() ||
- (this_name.length() == best.length() &&
- this_name > best))
- {
- // longest (and secondarily alphabetically last) so far
- best = this_name;
- }
- }
-
- // we don't return the actual serial number, just a hash of it.
- LLMD5 md5( reinterpret_cast<const unsigned char*>(best.c_str()) );
- md5.hex_digest(serial_md5);
-
- return serial_md5;
+ char serial_md5[MD5HEX_STR_SIZE];
+ serial_md5[0] = 0;
+ std::string best;
+ std::string uuiddir("/dev/disk/by-uuid/");
+
+ // trawl /dev/disk/by-uuid looking for a good-looking UUID to grab
+ std::string this_name;
+
+ LLDirIterator iter(uuiddir, "*");
+ while (iter.next(this_name))
+ {
+ if (this_name.length() > best.length() ||
+ (this_name.length() == best.length() &&
+ this_name > best))
+ {
+ // longest (and secondarily alphabetically last) so far
+ best = this_name;
+ }
+ }
+
+ // we don't return the actual serial number, just a hash of it.
+ LLMD5 md5( reinterpret_cast<const unsigned char*>(best.c_str()) );
+ md5.hex_digest(serial_md5);
+
+ return serial_md5;
}
diff --git a/indra/newview/llappviewerlinux.h b/indra/newview/llappviewerlinux.h
index 0289c43043..dde223878d 100644
--- a/indra/newview/llappviewerlinux.h
+++ b/indra/newview/llappviewerlinux.h
@@ -5,24 +5,24 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#ifndef LL_LLAPPVIEWERLINUX_H
#define LL_LLAPPVIEWERLINUX_H
@@ -47,27 +47,27 @@ class LLCommandLineParser;
class LLAppViewerLinux : public LLAppViewer
{
public:
- LLAppViewerLinux();
- virtual ~LLAppViewerLinux();
+ LLAppViewerLinux();
+ virtual ~LLAppViewerLinux();
- //
- // Main application logic
- //
- virtual bool init(); // Override to do application initialization
- std::string generateSerialNumber();
- bool setupSLURLHandler();
+ //
+ // Main application logic
+ //
+ virtual bool init(); // Override to do application initialization
+ std::string generateSerialNumber();
+ bool setupSLURLHandler();
protected:
- virtual bool beingDebugged();
-
- virtual bool restoreErrorTrap();
- virtual void initCrashReporting(bool reportFreeze);
+ virtual bool beingDebugged();
+
+ virtual bool restoreErrorTrap();
+ virtual void initCrashReporting(bool reportFreeze);
- virtual void initLoggingAndGetLastDuration();
- virtual bool initParseCommandLine(LLCommandLineParser& clp);
+ virtual void initLoggingAndGetLastDuration();
+ virtual bool initParseCommandLine(LLCommandLineParser& clp);
- virtual bool initSLURLHandler();
- virtual bool sendURLToOtherInstance(const std::string& url);
+ virtual bool initSLURLHandler();
+ virtual bool sendURLToOtherInstance(const std::string& url);
};
#if LL_DBUS_ENABLED
@@ -78,7 +78,7 @@ typedef struct
} ViewerAppAPI;
extern "C" {
- gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error);
+ gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error);
}
#define VIEWERAPI_SERVICE "com.secondlife.ViewerAppAPIService"
diff --git a/indra/newview/llappviewerlinux_api.h b/indra/newview/llappviewerlinux_api.h
index 5d5fcaa3d6..3d1324dd19 100644
--- a/indra/newview/llappviewerlinux_api.h
+++ b/indra/newview/llappviewerlinux_api.h
@@ -3,29 +3,29 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#ifndef __dbus_glib_marshal_viewerapp_MARSHAL_H__
#define __dbus_glib_marshal_viewerapp_MARSHAL_H__
-#include <glib-object.h>
+#include <glib-object.h>
G_BEGIN_DECLS
diff --git a/indra/newview/llappviewerlinux_api_dbus.cpp b/indra/newview/llappviewerlinux_api_dbus.cpp
index 6ac30bd9b8..be769356c3 100644
--- a/indra/newview/llappviewerlinux_api_dbus.cpp
+++ b/indra/newview/llappviewerlinux_api_dbus.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llappviewerlinux_api_dbus.cpp
* @brief dynamic DBus symbol-grabbing code
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,78 +49,78 @@ static apr_dso_handle_t *sSymDBUSDSOHandleG = NULL;
bool grab_dbus_syms(std::string dbus_dso_name)
{
- if (sSymsGrabbed)
- {
- // already have grabbed good syms
- return TRUE;
- }
+ if (sSymsGrabbed)
+ {
+ // already have grabbed good syms
+ return TRUE;
+ }
- bool sym_error = false;
- bool rtn = false;
- apr_status_t rv;
- apr_dso_handle_t *sSymDBUSDSOHandle = NULL;
+ bool sym_error = false;
+ bool rtn = false;
+ apr_status_t rv;
+ apr_dso_handle_t *sSymDBUSDSOHandle = NULL;
#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##DBUSSYM, sSymDBUSDSOHandle, #DBUSSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #DBUSSYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #DBUSSYM, (void*)ll##DBUSSYM);}while(0)
- //attempt to load the shared library
- apr_pool_create(&sSymDBUSDSOMemoryPool, NULL);
-
- if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle,
- dbus_dso_name.c_str(),
- sSymDBUSDSOMemoryPool) ))
- {
- INFOMSG("Found DSO: %s", dbus_dso_name.c_str());
+ //attempt to load the shared library
+ apr_pool_create(&sSymDBUSDSOMemoryPool, NULL);
+
+ if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle,
+ dbus_dso_name.c_str(),
+ sSymDBUSDSOMemoryPool) ))
+ {
+ INFOMSG("Found DSO: %s", dbus_dso_name.c_str());
#include "llappviewerlinux_api_dbus_syms_raw.inc"
-
- if ( sSymDBUSDSOHandle )
- {
- sSymDBUSDSOHandleG = sSymDBUSDSOHandle;
- sSymDBUSDSOHandle = NULL;
- }
-
- rtn = !sym_error;
- }
- else
- {
- INFOMSG("Couldn't load DSO: %s", dbus_dso_name.c_str());
- rtn = false; // failure
- }
-
- if (sym_error)
- {
- WARNMSG("Failed to find necessary symbols in DBUS-GLIB libraries.");
- }
+
+ if ( sSymDBUSDSOHandle )
+ {
+ sSymDBUSDSOHandleG = sSymDBUSDSOHandle;
+ sSymDBUSDSOHandle = NULL;
+ }
+
+ rtn = !sym_error;
+ }
+ else
+ {
+ INFOMSG("Couldn't load DSO: %s", dbus_dso_name.c_str());
+ rtn = false; // failure
+ }
+
+ if (sym_error)
+ {
+ WARNMSG("Failed to find necessary symbols in DBUS-GLIB libraries.");
+ }
#undef LL_DBUS_SYM
- sSymsGrabbed = rtn;
- return rtn;
+ sSymsGrabbed = rtn;
+ return rtn;
}
void ungrab_dbus_syms()
-{
- // should be safe to call regardless of whether we've
- // actually grabbed syms.
-
- if ( sSymDBUSDSOHandleG )
- {
- apr_dso_unload(sSymDBUSDSOHandleG);
- sSymDBUSDSOHandleG = NULL;
- }
-
- if ( sSymDBUSDSOMemoryPool )
- {
- apr_pool_destroy(sSymDBUSDSOMemoryPool);
- sSymDBUSDSOMemoryPool = NULL;
- }
-
- // NULL-out all of the symbols we'd grabbed
+{
+ // should be safe to call regardless of whether we've
+ // actually grabbed syms.
+
+ if ( sSymDBUSDSOHandleG )
+ {
+ apr_dso_unload(sSymDBUSDSOHandleG);
+ sSymDBUSDSOHandleG = NULL;
+ }
+
+ if ( sSymDBUSDSOMemoryPool )
+ {
+ apr_pool_destroy(sSymDBUSDSOMemoryPool);
+ sSymDBUSDSOMemoryPool = NULL;
+ }
+
+ // NULL-out all of the symbols we'd grabbed
#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{ll##DBUSSYM = NULL;}while(0)
#include "llappviewerlinux_api_dbus_syms_raw.inc"
#undef LL_DBUS_SYM
- sSymsGrabbed = false;
+ sSymsGrabbed = false;
}
#endif // LL_DBUS_ENABLED
diff --git a/indra/newview/llappviewerlinux_api_dbus.h b/indra/newview/llappviewerlinux_api_dbus.h
index 3eee25b53d..2f4492bd7a 100644
--- a/indra/newview/llappviewerlinux_api_dbus.h
+++ b/indra/newview/llappviewerlinux_api_dbus.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llappviewerlinux_api_dbus.h
* @brief DBus-glib symbol handling
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llappviewerlistener.cpp b/indra/newview/llappviewerlistener.cpp
index 2380a8ebf0..6d519b6fef 100644
--- a/indra/newview/llappviewerlistener.cpp
+++ b/indra/newview/llappviewerlistener.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-06-23
* @brief Implementation for llappviewerlistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llappviewerlistener.h b/indra/newview/llappviewerlistener.h
index 78c8b1909e..5ade3d3e04 100644
--- a/indra/newview/llappviewerlistener.h
+++ b/indra/newview/llappviewerlistener.h
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-06-18
* @brief Wrap subset of LLAppViewer API in event API
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llappviewermacosx-for-objc.h b/indra/newview/llappviewermacosx-for-objc.h
index 94bfa2491b..5a69cd93fc 100644
--- a/indra/newview/llappviewermacosx-for-objc.h
+++ b/indra/newview/llappviewermacosx-for-objc.h
@@ -13,7 +13,7 @@
* the full llappviewermacosx.h, we would almost surely run into
* trouble due to the discrepancy between Objective-C++'s BOOL versus
* classic Microsoft/Linden BOOL.
- *
+ *
* $LicenseInfo:firstyear=2018&license=viewerlgpl$
* Copyright (c) 2018, Linden Research, Inc.
* $/LicenseInfo$
diff --git a/indra/newview/llappviewermacosx-objc.h b/indra/newview/llappviewermacosx-objc.h
index 3721151aba..d0ae0a7fc2 100644
--- a/indra/newview/llappviewermacosx-objc.h
+++ b/indra/newview/llappviewermacosx-objc.h
@@ -5,24 +5,24 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#ifndef LL_LLAPPVIEWERMACOSX_OBJC_H
#define LL_LLAPPVIEWERMACOSX_OBJC_H
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index c42c3b3daf..fcdcd3ab9b 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -5,29 +5,29 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#include "llviewerprecompiledheaders.h"
#if !defined LL_DARWIN
- #error "Use only with Mac OS X"
+ #error "Use only with Mac OS X"
#endif
#define LL_CARBON_CRASH_HANDLER 1
@@ -59,50 +59,50 @@
#include "lldir.h"
#include "lldiriterator.h"
#include <signal.h>
-#include <CoreAudio/CoreAudio.h> // for systemwide mute
-class LLMediaCtrl; // for LLURLDispatcher
+#include <CoreAudio/CoreAudio.h> // for systemwide mute
+class LLMediaCtrl; // for LLURLDispatcher
-namespace
+namespace
{
- // The command line args stored.
- // They are not used immediately by the app.
- int gArgC;
- char** gArgV;
- LLAppViewerMacOSX* gViewerAppPtr = NULL;
+ // The command line args stored.
+ // They are not used immediately by the app.
+ int gArgC;
+ char** gArgV;
+ LLAppViewerMacOSX* gViewerAppPtr = NULL;
std::string gHandleSLURL;
}
void constructViewer()
{
- // Set the working dir to <bundle>/Contents/Resources
- if (chdir(gDirUtilp->getAppRODataDir().c_str()) == -1)
- {
- LL_WARNS("InitOSX") << "Could not change directory to "
- << gDirUtilp->getAppRODataDir() << ": " << strerror(errno)
- << LL_ENDL;
- }
-
- gViewerAppPtr = new LLAppViewerMacOSX();
+ // Set the working dir to <bundle>/Contents/Resources
+ if (chdir(gDirUtilp->getAppRODataDir().c_str()) == -1)
+ {
+ LL_WARNS("InitOSX") << "Could not change directory to "
+ << gDirUtilp->getAppRODataDir() << ": " << strerror(errno)
+ << LL_ENDL;
+ }
+
+ gViewerAppPtr = new LLAppViewerMacOSX();
}
bool initViewer()
{
- bool ok = gViewerAppPtr->init();
- if(!ok)
- {
- LL_WARNS("InitOSX") << "Application init failed." << LL_ENDL;
- }
- else if (!gHandleSLURL.empty())
- {
- dispatchUrl(gHandleSLURL);
- gHandleSLURL = "";
- }
- return ok;
+ bool ok = gViewerAppPtr->init();
+ if(!ok)
+ {
+ LL_WARNS("InitOSX") << "Application init failed." << LL_ENDL;
+ }
+ else if (!gHandleSLURL.empty())
+ {
+ dispatchUrl(gHandleSLURL);
+ gHandleSLURL = "";
+ }
+ return ok;
}
void handleQuit()
{
- LLAppViewer::instance()->userQuit();
+ LLAppViewer::instance()->userQuit();
}
// This function is called pumpMainLoop() rather than runMainLoop() because
@@ -112,27 +112,27 @@ void handleQuit()
// (llappdelegate-objc.mm).
bool pumpMainLoop()
{
- bool ret = LLApp::isQuitting();
- if (!ret && gViewerAppPtr != NULL)
- {
- ret = gViewerAppPtr->frame();
- } else {
- ret = true;
- }
-
- return ret;
+ bool ret = LLApp::isQuitting();
+ if (!ret && gViewerAppPtr != NULL)
+ {
+ ret = gViewerAppPtr->frame();
+ } else {
+ ret = true;
+ }
+
+ return ret;
}
void cleanupViewer()
{
- if(!LLApp::isError())
- {
+ if(!LLApp::isError())
+ {
if (gViewerAppPtr)
gViewerAppPtr->cleanup();
- }
-
- delete gViewerAppPtr;
- gViewerAppPtr = NULL;
+ }
+
+ delete gViewerAppPtr;
+ gViewerAppPtr = NULL;
}
void clearDumpLogsDir()
@@ -197,7 +197,7 @@ CrashMetadataSingleton::CrashMetadataSingleton()
LLStringUtil::replaceChar(agentFullname, '_', ' ');
regionName = get_metadata(info, "CurrentRegion");
fatalMessage = get_metadata(info, "FatalMessage");
-
+
if (gDirUtilp->fileExists(gDirUtilp->getDumpLogsDirPath()))
{
LLDirIterator file_iter(gDirUtilp->getDumpLogsDirPath(), "*.log");
@@ -229,12 +229,12 @@ void infos(const std::string& message)
LL_INFOS("InitOSX", "Bugsplat") << message << LL_ENDL;
}
-int main( int argc, char **argv )
+int main( int argc, char **argv )
{
- // Store off the command line args for use later.
- gArgC = argc;
- gArgV = argv;
- return createNSApp(argc, (const char**)argv);
+ // Store off the command line args for use later.
+ gArgC = argc;
+ gArgV = argv;
+ return createNSApp(argc, (const char**)argv);
}
LLAppViewerMacOSX::LLAppViewerMacOSX()
@@ -261,54 +261,54 @@ void LLAppViewerMacOSX::forceErrorOSSpecificException()
// look for this method to be added to the parser in parseAndStoreResults.
std::pair<std::string, std::string> parse_psn(const std::string& s)
{
- if (s.find("-psn_") == 0)
- {
- // *FIX:Mani Not sure that the value makes sense.
- // fix it once the actual -psn_XXX syntax is known.
- return std::make_pair("psn", s.substr(5));
+ if (s.find("-psn_") == 0)
+ {
+ // *FIX:Mani Not sure that the value makes sense.
+ // fix it once the actual -psn_XXX syntax is known.
+ return std::make_pair("psn", s.substr(5));
}
- else
- {
+ else
+ {
return std::make_pair(std::string(), std::string());
}
}
bool LLAppViewerMacOSX::initParseCommandLine(LLCommandLineParser& clp)
{
- // The next two lines add the support for parsing the mac -psn_XXX arg.
- clp.addOptionDesc("psn", NULL, 1, "MacOSX process serial number");
- clp.setCustomParser(parse_psn);
-
- // parse the user's command line
- if(clp.parseCommandLine(gArgC, gArgV) == false)
- {
- return false;
- }
-
- // Get the user's preferred language string based on the Mac OS localization mechanism.
- // To add a new localization:
- // go to the "Resources" section of the project
- // get info on "language.txt"
- // in the "General" tab, click the "Add Localization" button
- // create a new localization for the language you're adding
- // set the contents of the new localization of the file to the string corresponding to our localization
- // (i.e. "en", "ja", etc. Use the existing ones as a guide.)
- CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("language"), CFSTR("txt"), NULL);
- char path[MAX_PATH];
- if(CFURLGetFileSystemRepresentation(url, false, (UInt8 *)path, sizeof(path)))
- {
- std::string lang;
- if(_read_file_into_string(lang, path)) /* Flawfinder: ignore*/
- {
+ // The next two lines add the support for parsing the mac -psn_XXX arg.
+ clp.addOptionDesc("psn", NULL, 1, "MacOSX process serial number");
+ clp.setCustomParser(parse_psn);
+
+ // parse the user's command line
+ if(clp.parseCommandLine(gArgC, gArgV) == false)
+ {
+ return false;
+ }
+
+ // Get the user's preferred language string based on the Mac OS localization mechanism.
+ // To add a new localization:
+ // go to the "Resources" section of the project
+ // get info on "language.txt"
+ // in the "General" tab, click the "Add Localization" button
+ // create a new localization for the language you're adding
+ // set the contents of the new localization of the file to the string corresponding to our localization
+ // (i.e. "en", "ja", etc. Use the existing ones as a guide.)
+ CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("language"), CFSTR("txt"), NULL);
+ char path[MAX_PATH];
+ if(CFURLGetFileSystemRepresentation(url, false, (UInt8 *)path, sizeof(path)))
+ {
+ std::string lang;
+ if(_read_file_into_string(lang, path)) /* Flawfinder: ignore*/
+ {
LLControlVariable* c = gSavedSettings.getControl("SystemLanguage");
if(c)
{
c->setValue(lang, false);
}
- }
- }
- CFRelease(url);
-
+ }
+ }
+ CFRelease(url);
+
return true;
}
@@ -317,88 +317,88 @@ bool LLAppViewerMacOSX::initParseCommandLine(LLCommandLineParser& clp)
extern void default_unix_signal_handler(int, siginfo_t *, void *);
bool LLAppViewerMacOSX::restoreErrorTrap()
{
- // This method intends to reinstate signal handlers.
- // *NOTE:Mani It was found that the first execution of a shader was overriding
- // our initial signal handlers somehow.
- // This method will be called (at least) once per mainloop execution.
- // *NOTE:Mani The signals used below are copied over from the
- // setup_signals() func in LLApp.cpp
- // LLApp could use some way of overriding that func, but for this viewer
- // fix I opt to avoid affecting the server code.
-
- // Set up signal handlers that may result in program termination
- //
- struct sigaction act;
- struct sigaction old_act;
- act.sa_sigaction = default_unix_signal_handler;
- sigemptyset( &act.sa_mask );
- act.sa_flags = SA_SIGINFO;
-
- unsigned int reset_count = 0;
-
+ // This method intends to reinstate signal handlers.
+ // *NOTE:Mani It was found that the first execution of a shader was overriding
+ // our initial signal handlers somehow.
+ // This method will be called (at least) once per mainloop execution.
+ // *NOTE:Mani The signals used below are copied over from the
+ // setup_signals() func in LLApp.cpp
+ // LLApp could use some way of overriding that func, but for this viewer
+ // fix I opt to avoid affecting the server code.
+
+ // Set up signal handlers that may result in program termination
+ //
+ struct sigaction act;
+ struct sigaction old_act;
+ act.sa_sigaction = default_unix_signal_handler;
+ sigemptyset( &act.sa_mask );
+ act.sa_flags = SA_SIGINFO;
+
+ unsigned int reset_count = 0;
+
#define SET_SIG(SIGNAL) sigaction(SIGNAL, &act, &old_act); \
if(act.sa_sigaction != old_act.sa_sigaction) ++reset_count;
- // Synchronous signals
+ // Synchronous signals
# ifndef LL_BUGSPLAT
- SET_SIG(SIGABRT) // let bugsplat catch this
-# endif
- SET_SIG(SIGALRM)
- SET_SIG(SIGBUS)
- SET_SIG(SIGFPE)
- SET_SIG(SIGHUP)
- SET_SIG(SIGILL)
- SET_SIG(SIGPIPE)
- SET_SIG(SIGSEGV)
- SET_SIG(SIGSYS)
-
- SET_SIG(LL_HEARTBEAT_SIGNAL)
- SET_SIG(LL_SMACKDOWN_SIGNAL)
-
- // Asynchronous signals that are normally ignored
- SET_SIG(SIGCHLD)
- SET_SIG(SIGUSR2)
-
- // Asynchronous signals that result in attempted graceful exit
- SET_SIG(SIGHUP)
- SET_SIG(SIGTERM)
- SET_SIG(SIGINT)
-
- // Asynchronous signals that result in core
- SET_SIG(SIGQUIT)
+ SET_SIG(SIGABRT) // let bugsplat catch this
+# endif
+ SET_SIG(SIGALRM)
+ SET_SIG(SIGBUS)
+ SET_SIG(SIGFPE)
+ SET_SIG(SIGHUP)
+ SET_SIG(SIGILL)
+ SET_SIG(SIGPIPE)
+ SET_SIG(SIGSEGV)
+ SET_SIG(SIGSYS)
+
+ SET_SIG(LL_HEARTBEAT_SIGNAL)
+ SET_SIG(LL_SMACKDOWN_SIGNAL)
+
+ // Asynchronous signals that are normally ignored
+ SET_SIG(SIGCHLD)
+ SET_SIG(SIGUSR2)
+
+ // Asynchronous signals that result in attempted graceful exit
+ SET_SIG(SIGHUP)
+ SET_SIG(SIGTERM)
+ SET_SIG(SIGINT)
+
+ // Asynchronous signals that result in core
+ SET_SIG(SIGQUIT)
#undef SET_SIG
-
- return reset_count == 0;
+
+ return reset_count == 0;
}
std::string LLAppViewerMacOSX::generateSerialNumber()
{
- char serial_md5[MD5HEX_STR_SIZE]; // Flawfinder: ignore
- serial_md5[0] = 0;
-
- // JC: Sample code from http://developer.apple.com/technotes/tn/tn1103.html
- CFStringRef serialNumber = NULL;
- io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
- IOServiceMatching("IOPlatformExpertDevice"));
- if (platformExpert)
+ char serial_md5[MD5HEX_STR_SIZE]; // Flawfinder: ignore
+ serial_md5[0] = 0;
+
+ // JC: Sample code from http://developer.apple.com/technotes/tn/tn1103.html
+ CFStringRef serialNumber = NULL;
+ io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
+ IOServiceMatching("IOPlatformExpertDevice"));
+ if (platformExpert)
+ {
+ serialNumber = (CFStringRef) IORegistryEntryCreateCFProperty(platformExpert,
+ CFSTR(kIOPlatformSerialNumberKey),
+ kCFAllocatorDefault, 0);
+ IOObjectRelease(platformExpert);
+ }
+
+ if (serialNumber)
{
- serialNumber = (CFStringRef) IORegistryEntryCreateCFProperty(platformExpert,
- CFSTR(kIOPlatformSerialNumberKey),
- kCFAllocatorDefault, 0);
- IOObjectRelease(platformExpert);
- }
-
- if (serialNumber)
- {
- char buffer[MAX_STRING]; // Flawfinder: ignore
- if (CFStringGetCString(serialNumber, buffer, MAX_STRING, kCFStringEncodingASCII))
- {
- LLMD5 md5( (unsigned char*)buffer );
- md5.hex_digest(serial_md5);
- }
- CFRelease(serialNumber);
- }
-
- return serial_md5;
+ char buffer[MAX_STRING]; // Flawfinder: ignore
+ if (CFStringGetCString(serialNumber, buffer, MAX_STRING, kCFStringEncodingASCII))
+ {
+ LLMD5 md5( (unsigned char*)buffer );
+ md5.hex_digest(serial_md5);
+ }
+ CFRelease(serialNumber);
+ }
+
+ return serial_md5;
}
void handleUrl(const char* url_utf8)
@@ -426,7 +426,7 @@ void dispatchUrl(std::string url)
{
url.replace(0, prefix.length(), "secondlife:///app/");
}
-
+
LLMediaCtrl* web = NULL;
const bool trusted_browser = false;
LLURLDispatcher::dispatch(url, "", web, trusted_browser);
diff --git a/indra/newview/llappviewermacosx.h b/indra/newview/llappviewermacosx.h
index 15c55c44a6..d50812a35e 100644
--- a/indra/newview/llappviewermacosx.h
+++ b/indra/newview/llappviewermacosx.h
@@ -5,24 +5,24 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#ifndef LL_LLAPPVIEWERMACOSX_H
#define LL_LLAPPVIEWERMACOSX_H
@@ -34,21 +34,21 @@
class LLAppViewerMacOSX : public LLAppViewer
{
public:
- LLAppViewerMacOSX();
- virtual ~LLAppViewerMacOSX();
+ LLAppViewerMacOSX();
+ virtual ~LLAppViewerMacOSX();
- //
- // Main application logic
- //
- virtual bool init(); // Override to do application initialization
+ //
+ // Main application logic
+ //
+ virtual bool init(); // Override to do application initialization
virtual void forceErrorOSSpecificException();
protected:
- virtual bool restoreErrorTrap();
+ virtual bool restoreErrorTrap();
- std::string generateSerialNumber();
- virtual bool initParseCommandLine(LLCommandLineParser& clp);
+ std::string generateSerialNumber();
+ virtual bool initParseCommandLine(LLCommandLineParser& clp);
};
#endif // LL_LLAPPVIEWERMACOSX_H
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 41101e79a6..4c90a82fcb 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -5,24 +5,24 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#include "llviewerprecompiledheaders.h"
@@ -38,11 +38,11 @@
#include "llgl.h"
#include "res/resource.h" // *FIX: for setting gIconResource.
-#include <fcntl.h> //_O_APPEND
-#include <io.h> //_open_osfhandle()
-#include <WERAPI.H> // for WerAddExcludedApplication()
-#include <process.h> // _spawnl()
-#include <tchar.h> // For TCHAR support
+#include <fcntl.h> //_O_APPEND
+#include <io.h> //_open_osfhandle()
+#include <WERAPI.H> // for WerAddExcludedApplication()
+#include <process.h> // _spawnl()
+#include <tchar.h> // For TCHAR support
#include "llviewercontrol.h"
#include "lldxhardware.h"
@@ -177,28 +177,28 @@ namespace
static void exceptionTerminateHandler()
{
- // reinstall default terminate() handler in case we re-terminate.
- if (gOldTerminateHandler) std::set_terminate(gOldTerminateHandler);
- // treat this like a regular viewer crash, with nice stacktrace etc.
+ // reinstall default terminate() handler in case we re-terminate.
+ if (gOldTerminateHandler) std::set_terminate(gOldTerminateHandler);
+ // treat this like a regular viewer crash, with nice stacktrace etc.
long *null_ptr;
null_ptr = 0;
*null_ptr = 0xDEADBEEF; //Force an exception that will trigger breakpad.
- // we've probably been killed-off before now, but...
- gOldTerminateHandler(); // call old terminate() handler
+ // we've probably been killed-off before now, but...
+ gOldTerminateHandler(); // call old terminate() handler
}
LONG WINAPI catchallCrashHandler(EXCEPTION_POINTERS * /*ExceptionInfo*/)
{
- LL_WARNS() << "Hit last ditch-effort attempt to catch crash." << LL_ENDL;
- exceptionTerminateHandler();
- return 0;
+ LL_WARNS() << "Hit last ditch-effort attempt to catch crash." << LL_ENDL;
+ exceptionTerminateHandler();
+ return 0;
}
// *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib
// The lib was compiled under VS2005 - in VS2003 we need to remap assert
#ifdef LL_DEBUG
-#ifdef LL_MSVC7
+#ifdef LL_MSVC7
extern "C" {
void _wassert(const wchar_t * _Message, const wchar_t *_File, unsigned _Line)
{
@@ -211,200 +211,200 @@ extern "C" {
const std::string LLAppViewerWin32::sWindowClass = "Second Life";
/*
- This function is used to print to the command line a text message
+ This function is used to print to the command line a text message
describing the nvapi error and quits
*/
void nvapi_error(NvAPI_Status status)
{
NvAPI_ShortString szDesc = {0};
- NvAPI_GetErrorMessage(status, szDesc);
- LL_WARNS() << szDesc << LL_ENDL;
+ NvAPI_GetErrorMessage(status, szDesc);
+ LL_WARNS() << szDesc << LL_ENDL;
- //should always trigger when asserts are enabled
- //llassert(status == NVAPI_OK);
+ //should always trigger when asserts are enabled
+ //llassert(status == NVAPI_OK);
}
-// Create app mutex creates a unique global windows object.
+// Create app mutex creates a unique global windows object.
// If the object can be created it returns true, otherwise
-// it returns false. The false result can be used to determine
+// it returns false. The false result can be used to determine
// if another instance of a second life app (this vers. or later)
// is running.
// *NOTE: Do not use this method to run a single instance of the app.
-// This is intended to help debug problems with the cross-platform
+// This is intended to help debug problems with the cross-platform
// locked file method used for that purpose.
bool create_app_mutex()
{
- bool result = true;
- LPCWSTR unique_mutex_name = L"SecondLifeAppMutex";
- HANDLE hMutex;
- hMutex = CreateMutex(NULL, TRUE, unique_mutex_name);
- if(GetLastError() == ERROR_ALREADY_EXISTS)
- {
- result = false;
- }
- return result;
+ bool result = true;
+ LPCWSTR unique_mutex_name = L"SecondLifeAppMutex";
+ HANDLE hMutex;
+ hMutex = CreateMutex(NULL, TRUE, unique_mutex_name);
+ if(GetLastError() == ERROR_ALREADY_EXISTS)
+ {
+ result = false;
+ }
+ return result;
}
void ll_nvapi_init(NvDRSSessionHandle hSession)
{
- // (2) load all the system settings into the session
- NvAPI_Status status = NvAPI_DRS_LoadSettings(hSession);
- if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
-
- NvAPI_UnicodeString profile_name;
- std::string app_name = LLTrans::getString("APP_NAME");
- llutf16string w_app_name = utf8str_to_utf16str(app_name);
- wsprintf(profile_name, L"%s", w_app_name.c_str());
- NvDRSProfileHandle hProfile = 0;
- // (3) Check if we already have an application profile for the viewer
- status = NvAPI_DRS_FindProfileByName(hSession, profile_name, &hProfile);
- if (status != NVAPI_OK && status != NVAPI_PROFILE_NOT_FOUND)
- {
- nvapi_error(status);
- return;
- }
- else if (status == NVAPI_PROFILE_NOT_FOUND)
- {
- // Don't have an application profile yet - create one
- LL_INFOS() << "Creating NVIDIA application profile" << LL_ENDL;
-
- NVDRS_PROFILE profileInfo;
- profileInfo.version = NVDRS_PROFILE_VER;
- profileInfo.isPredefined = 0;
- wsprintf(profileInfo.profileName, L"%s", w_app_name.c_str());
-
- status = NvAPI_DRS_CreateProfile(hSession, &profileInfo, &hProfile);
- if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
- }
-
- // (4) Check if current exe is part of the profile
- std::string exe_name = gDirUtilp->getExecutableFilename();
- NVDRS_APPLICATION profile_application;
- profile_application.version = NVDRS_APPLICATION_VER;
-
- llutf16string w_exe_name = utf8str_to_utf16str(exe_name);
- NvAPI_UnicodeString profile_app_name;
- wsprintf(profile_app_name, L"%s", w_exe_name.c_str());
-
- status = NvAPI_DRS_GetApplicationInfo(hSession, hProfile, profile_app_name, &profile_application);
- if (status != NVAPI_OK && status != NVAPI_EXECUTABLE_NOT_FOUND)
- {
- nvapi_error(status);
- return;
- }
- else if (status == NVAPI_EXECUTABLE_NOT_FOUND)
- {
- LL_INFOS() << "Creating application for " << exe_name << " for NVIDIA application profile" << LL_ENDL;
-
- // Add this exe to the profile
- NVDRS_APPLICATION application;
- application.version = NVDRS_APPLICATION_VER;
- application.isPredefined = 0;
- wsprintf(application.appName, L"%s", w_exe_name.c_str());
- wsprintf(application.userFriendlyName, L"%s", w_exe_name.c_str());
- wsprintf(application.launcher, L"%s", w_exe_name.c_str());
- wsprintf(application.fileInFolder, L"%s", "");
-
- status = NvAPI_DRS_CreateApplication(hSession, hProfile, &application);
- if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
-
- // Save application in case we added one
- status = NvAPI_DRS_SaveSettings(hSession);
- if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
- }
-
- // load settings for querying
- status = NvAPI_DRS_LoadSettings(hSession);
- if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
-
- //get the preferred power management mode for Second Life
- NVDRS_SETTING drsSetting = {0};
- drsSetting.version = NVDRS_SETTING_VER;
- status = NvAPI_DRS_GetSetting(hSession, hProfile, PREFERRED_PSTATE_ID, &drsSetting);
- if (status == NVAPI_SETTING_NOT_FOUND)
- { //only override if the user hasn't specifically set this setting
- // (5) Specify that we want to enable maximum performance setting
- // first we fill the NVDRS_SETTING struct, then we call the function
- drsSetting.version = NVDRS_SETTING_VER;
- drsSetting.settingId = PREFERRED_PSTATE_ID;
- drsSetting.settingType = NVDRS_DWORD_TYPE;
- drsSetting.u32CurrentValue = PREFERRED_PSTATE_PREFER_MAX;
- status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
- if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
+ // (2) load all the system settings into the session
+ NvAPI_Status status = NvAPI_DRS_LoadSettings(hSession);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ NvAPI_UnicodeString profile_name;
+ std::string app_name = LLTrans::getString("APP_NAME");
+ llutf16string w_app_name = utf8str_to_utf16str(app_name);
+ wsprintf(profile_name, L"%s", w_app_name.c_str());
+ NvDRSProfileHandle hProfile = 0;
+ // (3) Check if we already have an application profile for the viewer
+ status = NvAPI_DRS_FindProfileByName(hSession, profile_name, &hProfile);
+ if (status != NVAPI_OK && status != NVAPI_PROFILE_NOT_FOUND)
+ {
+ nvapi_error(status);
+ return;
+ }
+ else if (status == NVAPI_PROFILE_NOT_FOUND)
+ {
+ // Don't have an application profile yet - create one
+ LL_INFOS() << "Creating NVIDIA application profile" << LL_ENDL;
+
+ NVDRS_PROFILE profileInfo;
+ profileInfo.version = NVDRS_PROFILE_VER;
+ profileInfo.isPredefined = 0;
+ wsprintf(profileInfo.profileName, L"%s", w_app_name.c_str());
+
+ status = NvAPI_DRS_CreateProfile(hSession, &profileInfo, &hProfile);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+ }
+
+ // (4) Check if current exe is part of the profile
+ std::string exe_name = gDirUtilp->getExecutableFilename();
+ NVDRS_APPLICATION profile_application;
+ profile_application.version = NVDRS_APPLICATION_VER;
+
+ llutf16string w_exe_name = utf8str_to_utf16str(exe_name);
+ NvAPI_UnicodeString profile_app_name;
+ wsprintf(profile_app_name, L"%s", w_exe_name.c_str());
+
+ status = NvAPI_DRS_GetApplicationInfo(hSession, hProfile, profile_app_name, &profile_application);
+ if (status != NVAPI_OK && status != NVAPI_EXECUTABLE_NOT_FOUND)
+ {
+ nvapi_error(status);
+ return;
+ }
+ else if (status == NVAPI_EXECUTABLE_NOT_FOUND)
+ {
+ LL_INFOS() << "Creating application for " << exe_name << " for NVIDIA application profile" << LL_ENDL;
+
+ // Add this exe to the profile
+ NVDRS_APPLICATION application;
+ application.version = NVDRS_APPLICATION_VER;
+ application.isPredefined = 0;
+ wsprintf(application.appName, L"%s", w_exe_name.c_str());
+ wsprintf(application.userFriendlyName, L"%s", w_exe_name.c_str());
+ wsprintf(application.launcher, L"%s", w_exe_name.c_str());
+ wsprintf(application.fileInFolder, L"%s", "");
+
+ status = NvAPI_DRS_CreateApplication(hSession, hProfile, &application);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ // Save application in case we added one
+ status = NvAPI_DRS_SaveSettings(hSession);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+ }
+
+ // load settings for querying
+ status = NvAPI_DRS_LoadSettings(hSession);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ //get the preferred power management mode for Second Life
+ NVDRS_SETTING drsSetting = {0};
+ drsSetting.version = NVDRS_SETTING_VER;
+ status = NvAPI_DRS_GetSetting(hSession, hProfile, PREFERRED_PSTATE_ID, &drsSetting);
+ if (status == NVAPI_SETTING_NOT_FOUND)
+ { //only override if the user hasn't specifically set this setting
+ // (5) Specify that we want to enable maximum performance setting
+ // first we fill the NVDRS_SETTING struct, then we call the function
+ drsSetting.version = NVDRS_SETTING_VER;
+ drsSetting.settingId = PREFERRED_PSTATE_ID;
+ drsSetting.settingType = NVDRS_DWORD_TYPE;
+ drsSetting.u32CurrentValue = PREFERRED_PSTATE_PREFER_MAX;
+ status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
// (6) Now we apply (or save) our changes to the system
status = NvAPI_DRS_SaveSettings(hSession);
- if (status != NVAPI_OK)
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+ }
+ else if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ // enable Threaded Optimization instead of letting the driver decide
+ status = NvAPI_DRS_GetSetting(hSession, hProfile, OGL_THREAD_CONTROL_ID, &drsSetting);
+ if (status == NVAPI_SETTING_NOT_FOUND || (status == NVAPI_OK && drsSetting.u32CurrentValue != OGL_THREAD_CONTROL_ENABLE))
+ {
+ drsSetting.version = NVDRS_SETTING_VER;
+ drsSetting.settingId = OGL_THREAD_CONTROL_ID;
+ drsSetting.settingType = NVDRS_DWORD_TYPE;
+ drsSetting.u32CurrentValue = OGL_THREAD_CONTROL_ENABLE;
+ status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
+ if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
+
+ // Now we apply (or save) our changes to the system
+ status = NvAPI_DRS_SaveSettings(hSession);
+ if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
- }
- else if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
-
- // enable Threaded Optimization instead of letting the driver decide
- status = NvAPI_DRS_GetSetting(hSession, hProfile, OGL_THREAD_CONTROL_ID, &drsSetting);
- if (status == NVAPI_SETTING_NOT_FOUND || (status == NVAPI_OK && drsSetting.u32CurrentValue != OGL_THREAD_CONTROL_ENABLE))
- {
- drsSetting.version = NVDRS_SETTING_VER;
- drsSetting.settingId = OGL_THREAD_CONTROL_ID;
- drsSetting.settingType = NVDRS_DWORD_TYPE;
- drsSetting.u32CurrentValue = OGL_THREAD_CONTROL_ENABLE;
- status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
- if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
-
- // Now we apply (or save) our changes to the system
- status = NvAPI_DRS_SaveSettings(hSession);
- if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
- }
- else if (status != NVAPI_OK)
- {
- nvapi_error(status);
- return;
- }
+ }
+ else if (status != NVAPI_OK)
+ {
+ nvapi_error(status);
+ return;
+ }
}
//#define DEBUGGING_SEH_FILTER 1
#if DEBUGGING_SEH_FILTER
-# define WINMAIN DebuggingWinMain
+# define WINMAIN DebuggingWinMain
#else
-# define WINMAIN wWinMain
+# define WINMAIN wWinMain
#endif
int APIENTRY WINMAIN(HINSTANCE hInstance,
@@ -417,56 +417,56 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
LL_PROFILER_FRAME_END;
LL_PROFILER_SET_THREAD_NAME("App");
- const S32 MAX_HEAPS = 255;
- DWORD heap_enable_lfh_error[MAX_HEAPS];
- S32 num_heaps = 0;
-
- LLWindowWin32::setDPIAwareness();
+ const S32 MAX_HEAPS = 255;
+ DWORD heap_enable_lfh_error[MAX_HEAPS];
+ S32 num_heaps = 0;
+
+ LLWindowWin32::setDPIAwareness();
#if WINDOWS_CRT_MEM_CHECKS && !INCLUDE_VLD
- _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit
+ _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit
#elif 0
- // Experimental - enable the low fragmentation heap
- // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations)
- // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1
+ // Experimental - enable the low fragmentation heap
+ // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations)
+ // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1
- // Enable to get mem debugging within visual studio.
+ // Enable to get mem debugging within visual studio.
#if LL_DEBUG
- _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#else
- _CrtSetDbgFlag(0); // default, just making explicit
-
- ULONG ulEnableLFH = 2;
- HANDLE* hHeaps = new HANDLE[MAX_HEAPS];
- num_heaps = GetProcessHeaps(MAX_HEAPS, hHeaps);
- for(S32 i = 0; i < num_heaps; i++)
- {
- bool success = HeapSetInformation(hHeaps[i], HeapCompatibilityInformation, &ulEnableLFH, sizeof(ulEnableLFH));
- if (success)
- heap_enable_lfh_error[i] = 0;
- else
- heap_enable_lfh_error[i] = GetLastError();
- }
+ _CrtSetDbgFlag(0); // default, just making explicit
+
+ ULONG ulEnableLFH = 2;
+ HANDLE* hHeaps = new HANDLE[MAX_HEAPS];
+ num_heaps = GetProcessHeaps(MAX_HEAPS, hHeaps);
+ for(S32 i = 0; i < num_heaps; i++)
+ {
+ bool success = HeapSetInformation(hHeaps[i], HeapCompatibilityInformation, &ulEnableLFH, sizeof(ulEnableLFH));
+ if (success)
+ heap_enable_lfh_error[i] = 0;
+ else
+ heap_enable_lfh_error[i] = GetLastError();
+ }
#endif
#endif
-
- // *FIX: global
- gIconResource = MAKEINTRESOURCE(IDI_LL_ICON);
- LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(ll_convert_wide_to_string(pCmdLine).c_str());
+ // *FIX: global
+ gIconResource = MAKEINTRESOURCE(IDI_LL_ICON);
- gOldTerminateHandler = std::set_terminate(exceptionTerminateHandler);
+ LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(ll_convert_wide_to_string(pCmdLine).c_str());
- // Set a debug info flag to indicate if multiple instances are running.
- bool found_other_instance = !create_app_mutex();
- gDebugInfo["FoundOtherInstanceAtStartup"] = LLSD::Boolean(found_other_instance);
+ gOldTerminateHandler = std::set_terminate(exceptionTerminateHandler);
- bool ok = viewer_app_ptr->init();
- if(!ok)
- {
- LL_WARNS() << "Application init failed." << LL_ENDL;
- return -1;
- }
+ // Set a debug info flag to indicate if multiple instances are running.
+ bool found_other_instance = !create_app_mutex();
+ gDebugInfo["FoundOtherInstanceAtStartup"] = LLSD::Boolean(found_other_instance);
+
+ bool ok = viewer_app_ptr->init();
+ if(!ok)
+ {
+ LL_WARNS() << "Application init failed." << LL_ENDL;
+ return -1;
+ }
NvDRSSessionHandle hSession = 0;
static LLCachedControl<bool> use_nv_api(gSavedSettings, "NvAPICreateApplicationProfile", true);
@@ -493,70 +493,70 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
}
}
- // Have to wait until after logging is initialized to display LFH info
- if (num_heaps > 0)
- {
- LL_INFOS() << "Attempted to enable LFH for " << num_heaps << " heaps." << LL_ENDL;
- for(S32 i = 0; i < num_heaps; i++)
- {
- if (heap_enable_lfh_error[i])
- {
- LL_INFOS() << " Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << LL_ENDL;
- }
- }
- }
-
- // Run the application main loop
- while (! viewer_app_ptr->frame())
- {}
-
- if (!LLApp::isError())
- {
- //
- // We don't want to do cleanup here if the error handler got called -
- // the assumption is that the error handler is responsible for doing
- // app cleanup if there was a problem.
- //
+ // Have to wait until after logging is initialized to display LFH info
+ if (num_heaps > 0)
+ {
+ LL_INFOS() << "Attempted to enable LFH for " << num_heaps << " heaps." << LL_ENDL;
+ for(S32 i = 0; i < num_heaps; i++)
+ {
+ if (heap_enable_lfh_error[i])
+ {
+ LL_INFOS() << " Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << LL_ENDL;
+ }
+ }
+ }
+
+ // Run the application main loop
+ while (! viewer_app_ptr->frame())
+ {}
+
+ if (!LLApp::isError())
+ {
+ //
+ // We don't want to do cleanup here if the error handler got called -
+ // the assumption is that the error handler is responsible for doing
+ // app cleanup if there was a problem.
+ //
#if WINDOWS_CRT_MEM_CHECKS
- LL_INFOS() << "CRT Checking memory:" << LL_ENDL;
- if (!_CrtCheckMemory())
- {
- LL_WARNS() << "_CrtCheckMemory() failed at prior to cleanup!" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << " No corruption detected." << LL_ENDL;
- }
+ LL_INFOS() << "CRT Checking memory:" << LL_ENDL;
+ if (!_CrtCheckMemory())
+ {
+ LL_WARNS() << "_CrtCheckMemory() failed at prior to cleanup!" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << " No corruption detected." << LL_ENDL;
+ }
#endif
- gGLActive = TRUE;
+ gGLActive = TRUE;
- viewer_app_ptr->cleanup();
+ viewer_app_ptr->cleanup();
#if WINDOWS_CRT_MEM_CHECKS
- LL_INFOS() << "CRT Checking memory:" << LL_ENDL;
- if (!_CrtCheckMemory())
- {
- LL_WARNS() << "_CrtCheckMemory() failed after cleanup!" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << " No corruption detected." << LL_ENDL;
- }
+ LL_INFOS() << "CRT Checking memory:" << LL_ENDL;
+ if (!_CrtCheckMemory())
+ {
+ LL_WARNS() << "_CrtCheckMemory() failed after cleanup!" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << " No corruption detected." << LL_ENDL;
+ }
#endif
- }
- delete viewer_app_ptr;
- viewer_app_ptr = NULL;
-
- // (NVAPI) (6) We clean up. This is analogous to doing a free()
- if (hSession)
- {
- NvAPI_DRS_DestroySession(hSession);
- hSession = 0;
- }
-
- return 0;
+ }
+ delete viewer_app_ptr;
+ viewer_app_ptr = NULL;
+
+ // (NVAPI) (6) We clean up. This is analogous to doing a free()
+ if (hSession)
+ {
+ NvAPI_DRS_DestroySession(hSession);
+ hSession = 0;
+ }
+
+ return 0;
}
#if DEBUGGING_SEH_FILTER
@@ -582,16 +582,16 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
void LLAppViewerWin32::disableWinErrorReporting()
{
- std::string executable_name = gDirUtilp->getExecutableFilename();
-
- if( S_OK == WerAddExcludedApplication( utf8str_to_utf16str(executable_name).c_str(), FALSE ) )
- {
- LL_INFOS() << "WerAddExcludedApplication() succeeded for " << executable_name << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "WerAddExcludedApplication() failed for " << executable_name << LL_ENDL;
- }
+ std::string executable_name = gDirUtilp->getExecutableFilename();
+
+ if( S_OK == WerAddExcludedApplication( utf8str_to_utf16str(executable_name).c_str(), FALSE ) )
+ {
+ LL_INFOS() << "WerAddExcludedApplication() succeeded for " << executable_name << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "WerAddExcludedApplication() failed for " << executable_name << LL_ENDL;
+ }
}
const S32 MAX_CONSOLE_LINES = 7500;
@@ -666,8 +666,8 @@ void set_stream(const char* desc, FILE* fp, DWORD handle_id, const char* name, c
} // anonymous namespace
LLAppViewerWin32::LLAppViewerWin32(const char* cmd_line) :
- mCmdLine(cmd_line),
- mIsConsoleAllocated(false)
+ mCmdLine(cmd_line),
+ mIsConsoleAllocated(false)
{
}
@@ -677,18 +677,18 @@ LLAppViewerWin32::~LLAppViewerWin32()
bool LLAppViewerWin32::init()
{
- // Platform specific initialization.
-
- // Turn off Windows Error Reporting
- // (Don't send our data to Microsoft--at least until we are Logo approved and have a way
- // of getting the data back from them.)
- //
- // LL_INFOS() << "Turning off Windows error reporting." << LL_ENDL;
- disableWinErrorReporting();
+ // Platform specific initialization.
+
+ // Turn off Windows Error Reporting
+ // (Don't send our data to Microsoft--at least until we are Logo approved and have a way
+ // of getting the data back from them.)
+ //
+ // LL_INFOS() << "Turning off Windows error reporting." << LL_ENDL;
+ disableWinErrorReporting();
#ifndef LL_RELEASE_FOR_DOWNLOAD
- // Merely requesting the LLSingleton instance initializes it.
- LLWinDebug::instance();
+ // Merely requesting the LLSingleton instance initializes it.
+ LLWinDebug::instance();
#endif
#if LL_SEND_CRASH_REPORTS
@@ -787,24 +787,24 @@ bool LLAppViewerWin32::init()
#endif // LL_BUGSPLAT
#endif // LL_SEND_CRASH_REPORTS
- bool success = LLAppViewer::init();
+ bool success = LLAppViewer::init();
return success;
}
bool LLAppViewerWin32::cleanup()
{
- bool result = LLAppViewer::cleanup();
+ bool result = LLAppViewer::cleanup();
- gDXHardware.cleanup();
+ gDXHardware.cleanup();
- if (mIsConsoleAllocated)
- {
- FreeConsole();
- mIsConsoleAllocated = false;
- }
+ if (mIsConsoleAllocated)
+ {
+ FreeConsole();
+ mIsConsoleAllocated = false;
+ }
- return result;
+ return result;
}
void LLAppViewerWin32::reportCrashToBugsplat(void* pExcepInfo)
@@ -819,123 +819,123 @@ void LLAppViewerWin32::reportCrashToBugsplat(void* pExcepInfo)
void LLAppViewerWin32::initLoggingAndGetLastDuration()
{
- LLAppViewer::initLoggingAndGetLastDuration();
+ LLAppViewer::initLoggingAndGetLastDuration();
}
void LLAppViewerWin32::initConsole()
{
- // pop up debug console
- mIsConsoleAllocated = create_console();
- return LLAppViewer::initConsole();
+ // pop up debug console
+ mIsConsoleAllocated = create_console();
+ return LLAppViewer::initConsole();
}
void write_debug_dx(const char* str)
{
- std::string value = gDebugInfo["DXInfo"].asString();
- value += str;
- gDebugInfo["DXInfo"] = value;
+ std::string value = gDebugInfo["DXInfo"].asString();
+ value += str;
+ gDebugInfo["DXInfo"] = value;
}
void write_debug_dx(const std::string& str)
{
- write_debug_dx(str.c_str());
+ write_debug_dx(str.c_str());
}
bool LLAppViewerWin32::initHardwareTest()
{
- //
- // Do driver verification and initialization based on DirectX
- // hardware polling and driver versions
- //
- if (TRUE == gSavedSettings.getBOOL("ProbeHardwareOnStartup") && FALSE == gSavedSettings.getBOOL("NoHardwareProbe"))
- {
- // per DEV-11631 - disable hardware probing for everything
- // but vram.
- BOOL vram_only = TRUE;
-
- LLSplashScreen::update(LLTrans::getString("StartupDetectingHardware"));
-
- LL_DEBUGS("AppInit") << "Attempting to poll DirectX for hardware info" << LL_ENDL;
- gDXHardware.setWriteDebugFunc(write_debug_dx);
- BOOL probe_ok = gDXHardware.getInfo(vram_only);
-
- if (!probe_ok
- && gWarningSettings.getBOOL("AboutDirectX9"))
- {
- LL_WARNS("AppInit") << "DirectX probe failed, alerting user." << LL_ENDL;
-
- // Warn them that runnin without DirectX 9 will
- // not allow us to tell them about driver issues
- std::ostringstream msg;
- msg << LLTrans::getString ("MBNoDirectX");
- S32 button = OSMessageBox(
- msg.str(),
- LLTrans::getString("MBWarning"),
- OSMB_YESNO);
- if (OSBTN_NO== button)
- {
- LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL;
- LLWeb::loadURLExternal("http://secondlife.com/support/", false);
- return false;
- }
- gWarningSettings.setBOOL("AboutDirectX9", FALSE);
- }
- LL_DEBUGS("AppInit") << "Done polling DirectX for hardware info" << LL_ENDL;
-
- // Only probe once after installation
- gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE);
-
- // Disable so debugger can work
- std::string splash_msg;
- LLStringUtil::format_map_t args;
- args["[APP_NAME]"] = LLAppViewer::instance()->getSecondLifeTitle();
- splash_msg = LLTrans::getString("StartupLoading", args);
-
- LLSplashScreen::update(splash_msg);
- }
-
- if (!restoreErrorTrap())
- {
- LL_WARNS("AppInit") << " Someone took over my exception handler (post hardware probe)!" << LL_ENDL;
- }
-
- if (gGLManager.mVRAM == 0)
- {
- gGLManager.mVRAM = gDXHardware.getVRAM();
- }
-
- LL_INFOS("AppInit") << "Detected VRAM: " << gGLManager.mVRAM << LL_ENDL;
-
- return true;
+ //
+ // Do driver verification and initialization based on DirectX
+ // hardware polling and driver versions
+ //
+ if (TRUE == gSavedSettings.getBOOL("ProbeHardwareOnStartup") && FALSE == gSavedSettings.getBOOL("NoHardwareProbe"))
+ {
+ // per DEV-11631 - disable hardware probing for everything
+ // but vram.
+ BOOL vram_only = TRUE;
+
+ LLSplashScreen::update(LLTrans::getString("StartupDetectingHardware"));
+
+ LL_DEBUGS("AppInit") << "Attempting to poll DirectX for hardware info" << LL_ENDL;
+ gDXHardware.setWriteDebugFunc(write_debug_dx);
+ BOOL probe_ok = gDXHardware.getInfo(vram_only);
+
+ if (!probe_ok
+ && gWarningSettings.getBOOL("AboutDirectX9"))
+ {
+ LL_WARNS("AppInit") << "DirectX probe failed, alerting user." << LL_ENDL;
+
+ // Warn them that runnin without DirectX 9 will
+ // not allow us to tell them about driver issues
+ std::ostringstream msg;
+ msg << LLTrans::getString ("MBNoDirectX");
+ S32 button = OSMessageBox(
+ msg.str(),
+ LLTrans::getString("MBWarning"),
+ OSMB_YESNO);
+ if (OSBTN_NO== button)
+ {
+ LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL;
+ LLWeb::loadURLExternal("http://secondlife.com/support/", false);
+ return false;
+ }
+ gWarningSettings.setBOOL("AboutDirectX9", FALSE);
+ }
+ LL_DEBUGS("AppInit") << "Done polling DirectX for hardware info" << LL_ENDL;
+
+ // Only probe once after installation
+ gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE);
+
+ // Disable so debugger can work
+ std::string splash_msg;
+ LLStringUtil::format_map_t args;
+ args["[APP_NAME]"] = LLAppViewer::instance()->getSecondLifeTitle();
+ splash_msg = LLTrans::getString("StartupLoading", args);
+
+ LLSplashScreen::update(splash_msg);
+ }
+
+ if (!restoreErrorTrap())
+ {
+ LL_WARNS("AppInit") << " Someone took over my exception handler (post hardware probe)!" << LL_ENDL;
+ }
+
+ if (gGLManager.mVRAM == 0)
+ {
+ gGLManager.mVRAM = gDXHardware.getVRAM();
+ }
+
+ LL_INFOS("AppInit") << "Detected VRAM: " << gGLManager.mVRAM << LL_ENDL;
+
+ return true;
}
bool LLAppViewerWin32::initParseCommandLine(LLCommandLineParser& clp)
{
- if (!clp.parseCommandLineString(mCmdLine))
- {
- return false;
- }
-
- // Find the system language.
- FL_Locale *locale = NULL;
- FL_Success success = FL_FindLocale(&locale, FL_MESSAGES);
- if (success != 0)
- {
- if (success >= 2 && locale->lang) // confident!
- {
- LL_INFOS("AppInit") << "Language: " << ll_safe_string(locale->lang) << LL_ENDL;
- LL_INFOS("AppInit") << "Location: " << ll_safe_string(locale->country) << LL_ENDL;
- LL_INFOS("AppInit") << "Variant: " << ll_safe_string(locale->variant) << LL_ENDL;
- LLControlVariable* c = gSavedSettings.getControl("SystemLanguage");
- if(c)
- {
- c->setValue(std::string(locale->lang), false);
- }
- }
- }
- FL_FreeLocale(&locale);
-
- return true;
+ if (!clp.parseCommandLineString(mCmdLine))
+ {
+ return false;
+ }
+
+ // Find the system language.
+ FL_Locale *locale = NULL;
+ FL_Success success = FL_FindLocale(&locale, FL_MESSAGES);
+ if (success != 0)
+ {
+ if (success >= 2 && locale->lang) // confident!
+ {
+ LL_INFOS("AppInit") << "Language: " << ll_safe_string(locale->lang) << LL_ENDL;
+ LL_INFOS("AppInit") << "Location: " << ll_safe_string(locale->country) << LL_ENDL;
+ LL_INFOS("AppInit") << "Variant: " << ll_safe_string(locale->variant) << LL_ENDL;
+ LLControlVariable* c = gSavedSettings.getControl("SystemLanguage");
+ if(c)
+ {
+ c->setValue(std::string(locale->lang), false);
+ }
+ }
+ }
+ FL_FreeLocale(&locale);
+
+ return true;
}
bool LLAppViewerWin32::beingDebugged()
@@ -944,63 +944,63 @@ bool LLAppViewerWin32::beingDebugged()
}
bool LLAppViewerWin32::restoreErrorTrap()
-{
- return true; // we don't check for handler collisions on windows, so just say they're ok
+{
+ return true; // we don't check for handler collisions on windows, so just say they're ok
}
//virtual
bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url)
{
- wchar_t window_class[256]; /* Flawfinder: ignore */ // Assume max length < 255 chars.
- mbstowcs(window_class, sWindowClass.c_str(), 255);
- window_class[255] = 0;
- // Use the class instead of the window name.
- HWND other_window = FindWindow(window_class, NULL);
-
- if (other_window != NULL)
- {
- LL_DEBUGS() << "Found other window with the name '" << getWindowTitle() << "'" << LL_ENDL;
- COPYDATASTRUCT cds;
- const S32 SLURL_MESSAGE_TYPE = 0;
- cds.dwData = SLURL_MESSAGE_TYPE;
- cds.cbData = url.length() + 1;
- cds.lpData = (void*)url.c_str();
-
- LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds);
- LL_DEBUGS() << "SendMessage(WM_COPYDATA) to other window '"
- << getWindowTitle() << "' returned " << msg_result << LL_ENDL;
- return true;
- }
- return false;
+ wchar_t window_class[256]; /* Flawfinder: ignore */ // Assume max length < 255 chars.
+ mbstowcs(window_class, sWindowClass.c_str(), 255);
+ window_class[255] = 0;
+ // Use the class instead of the window name.
+ HWND other_window = FindWindow(window_class, NULL);
+
+ if (other_window != NULL)
+ {
+ LL_DEBUGS() << "Found other window with the name '" << getWindowTitle() << "'" << LL_ENDL;
+ COPYDATASTRUCT cds;
+ const S32 SLURL_MESSAGE_TYPE = 0;
+ cds.dwData = SLURL_MESSAGE_TYPE;
+ cds.cbData = url.length() + 1;
+ cds.lpData = (void*)url.c_str();
+
+ LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds);
+ LL_DEBUGS() << "SendMessage(WM_COPYDATA) to other window '"
+ << getWindowTitle() << "' returned " << msg_result << LL_ENDL;
+ return true;
+ }
+ return false;
}
std::string LLAppViewerWin32::generateSerialNumber()
{
- char serial_md5[MD5HEX_STR_SIZE]; // Flawfinder: ignore
- serial_md5[0] = 0;
-
- DWORD serial = 0;
- DWORD flags = 0;
- BOOL success = GetVolumeInformation(
- L"C:\\",
- NULL, // volume name buffer
- 0, // volume name buffer size
- &serial, // volume serial
- NULL, // max component length
- &flags, // file system flags
- NULL, // file system name buffer
- 0); // file system name buffer size
- if (success)
- {
- LLMD5 md5;
- md5.update( (unsigned char*)&serial, sizeof(DWORD));
- md5.finalize();
- md5.hex_digest(serial_md5);
- }
- else
- {
- LL_WARNS() << "GetVolumeInformation failed" << LL_ENDL;
- }
- return serial_md5;
+ char serial_md5[MD5HEX_STR_SIZE]; // Flawfinder: ignore
+ serial_md5[0] = 0;
+
+ DWORD serial = 0;
+ DWORD flags = 0;
+ BOOL success = GetVolumeInformation(
+ L"C:\\",
+ NULL, // volume name buffer
+ 0, // volume name buffer size
+ &serial, // volume serial
+ NULL, // max component length
+ &flags, // file system flags
+ NULL, // file system name buffer
+ 0); // file system name buffer size
+ if (success)
+ {
+ LLMD5 md5;
+ md5.update( (unsigned char*)&serial, sizeof(DWORD));
+ md5.finalize();
+ md5.hex_digest(serial_md5);
+ }
+ else
+ {
+ LL_WARNS() << "GetVolumeInformation failed" << LL_ENDL;
+ }
+ return serial_md5;
}
diff --git a/indra/newview/llappviewerwin32.h b/indra/newview/llappviewerwin32.h
index ab52bf15f9..2242c95b06 100644
--- a/indra/newview/llappviewerwin32.h
+++ b/indra/newview/llappviewerwin32.h
@@ -5,24 +5,24 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#ifndef LL_LLAPPVIEWERWIN32_H
#define LL_LLAPPVIEWERWIN32_H
@@ -34,37 +34,37 @@
class LLAppViewerWin32 : public LLAppViewer
{
public:
- LLAppViewerWin32(const char* cmd_line);
- virtual ~LLAppViewerWin32();
+ LLAppViewerWin32(const char* cmd_line);
+ virtual ~LLAppViewerWin32();
- //
- // Main application logic
- //
- bool init() override; // Override to do application initialization
+ //
+ // Main application logic
+ //
+ bool init() override; // Override to do application initialization
bool cleanup() override;
void reportCrashToBugsplat(void* pExcepInfo) override;
protected:
- void initLoggingAndGetLastDuration() override; // Override to clean stack_trace info.
- void initConsole() override; // Initialize OS level debugging console.
- bool initHardwareTest() override; // Win32 uses DX9 to test hardware.
- bool initParseCommandLine(LLCommandLineParser& clp) override;
+ void initLoggingAndGetLastDuration() override; // Override to clean stack_trace info.
+ void initConsole() override; // Initialize OS level debugging console.
+ bool initHardwareTest() override; // Win32 uses DX9 to test hardware.
+ bool initParseCommandLine(LLCommandLineParser& clp) override;
- bool beingDebugged() override;
- bool restoreErrorTrap() override;
+ bool beingDebugged() override;
+ bool restoreErrorTrap() override;
- bool sendURLToOtherInstance(const std::string& url) override;
+ bool sendURLToOtherInstance(const std::string& url) override;
- std::string generateSerialNumber();
+ std::string generateSerialNumber();
- static const std::string sWindowClass;
+ static const std::string sWindowClass;
private:
- void disableWinErrorReporting();
+ void disableWinErrorReporting();
- std::string mCmdLine;
- bool mIsConsoleAllocated;
+ std::string mCmdLine;
+ bool mIsConsoleAllocated;
};
#endif // LL_LLAPPVIEWERWIN32_H
diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp
index d3fce306bc..7baf5f6119 100644
--- a/indra/newview/llattachmentsmgr.cpp
+++ b/indra/newview/llattachmentsmgr.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llattachmentsmgr.cpp
* @brief Manager for initiating attachments changes on the viewer
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,7 +57,7 @@ void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id,
const U8 attachment_pt,
const BOOL add)
{
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
if (mAttachmentRequests.wasRequestedRecently(item_id))
{
@@ -66,64 +66,64 @@ void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id,
return;
}
- LL_DEBUGS("Avatar") << "ATT adding attachment to mPendingAttachments "
- << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
+ LL_DEBUGS("Avatar") << "ATT adding attachment to mPendingAttachments "
+ << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
- AttachmentsInfo attachment;
- attachment.mItemID = item_id;
- attachment.mAttachmentPt = attachment_pt;
- attachment.mAdd = add;
- mPendingAttachments.push_back(attachment);
+ AttachmentsInfo attachment;
+ attachment.mItemID = item_id;
+ attachment.mAttachmentPt = attachment_pt;
+ attachment.mAdd = add;
+ mPendingAttachments.push_back(attachment);
mAttachmentRequests.addTime(item_id);
}
void LLAttachmentsMgr::onAttachmentRequested(const LLUUID& item_id)
{
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_DEBUGS("Avatar") << "ATT attachment was requested "
- << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << "ATT attachment was requested "
+ << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
mAttachmentRequests.addTime(item_id);
}
// static
void LLAttachmentsMgr::onIdle(void *)
{
- LLAttachmentsMgr::instance().onIdle();
+ LLAttachmentsMgr::instance().onIdle();
}
void LLAttachmentsMgr::onIdle()
{
- // Make sure we got a region before trying anything else
- if( !gAgent.getRegion() )
- {
- return;
- }
+ // Make sure we got a region before trying anything else
+ if( !gAgent.getRegion() )
+ {
+ return;
+ }
- if (LLApp::isExiting())
- {
- return;
- }
+ if (LLApp::isExiting())
+ {
+ return;
+ }
- requestPendingAttachments();
+ requestPendingAttachments();
- linkRecentlyArrivedAttachments();
+ linkRecentlyArrivedAttachments();
- expireOldAttachmentRequests();
+ expireOldAttachmentRequests();
- expireOldDetachRequests();
+ expireOldDetachRequests();
- checkInvalidCOFLinks();
-
- spamStatusInfo();
+ checkInvalidCOFLinks();
+
+ spamStatusInfo();
}
void LLAttachmentsMgr::requestPendingAttachments()
{
- if (mPendingAttachments.size())
- {
- requestAttachments(mPendingAttachments);
- }
+ if (mPendingAttachments.size())
+ {
+ requestAttachments(mPendingAttachments);
+ }
}
// Send request(s) for a group of attachments. As coded, this can
@@ -132,40 +132,40 @@ void LLAttachmentsMgr::requestPendingAttachments()
// limit should not be hit in practice.
void LLAttachmentsMgr::requestAttachments(attachments_vec_t& attachment_requests)
{
- // Make sure we got a region before trying anything else
- if( !gAgent.getRegion() )
- {
- return;
- }
+ // Make sure we got a region before trying anything else
+ if( !gAgent.getRegion() )
+ {
+ return;
+ }
// For unknown reasons, requesting many attachments at once causes
// frequent server-side failures. Here we're limiting the number
// of attachments requested per idle loop.
const S32 max_objects_per_request = 5;
- S32 obj_count = llmin((S32)attachment_requests.size(),max_objects_per_request);
- if (obj_count == 0)
- {
- return;
- }
-
- // Limit number of packets to send
- const S32 MAX_PACKETS_TO_SEND = 10;
- const S32 OBJECTS_PER_PACKET = 4;
- const S32 MAX_OBJECTS_TO_SEND = MAX_PACKETS_TO_SEND * OBJECTS_PER_PACKET;
- if( obj_count > MAX_OBJECTS_TO_SEND )
- {
+ S32 obj_count = llmin((S32)attachment_requests.size(),max_objects_per_request);
+ if (obj_count == 0)
+ {
+ return;
+ }
+
+ // Limit number of packets to send
+ const S32 MAX_PACKETS_TO_SEND = 10;
+ const S32 OBJECTS_PER_PACKET = 4;
+ const S32 MAX_OBJECTS_TO_SEND = MAX_PACKETS_TO_SEND * OBJECTS_PER_PACKET;
+ if( obj_count > MAX_OBJECTS_TO_SEND )
+ {
LL_WARNS() << "ATT Too many attachments requested: " << obj_count
<< " exceeds limit of " << MAX_OBJECTS_TO_SEND << LL_ENDL;
- obj_count = MAX_OBJECTS_TO_SEND;
- }
+ obj_count = MAX_OBJECTS_TO_SEND;
+ }
- LL_DEBUGS("Avatar") << "ATT [RezMultipleAttachmentsFromInv] attaching multiple from attachment_requests,"
- " total obj_count " << obj_count << LL_ENDL;
+ LL_DEBUGS("Avatar") << "ATT [RezMultipleAttachmentsFromInv] attaching multiple from attachment_requests,"
+ " total obj_count " << obj_count << LL_ENDL;
- LLUUID compound_msg_id;
- compound_msg_id.generate();
- LLMessageSystem* msg = gMessageSystem;
+ LLUUID compound_msg_id;
+ compound_msg_id.generate();
+ LLMessageSystem* msg = gMessageSystem;
// by construction above, obj_count <= attachment_requests.size(), so no
// check against attachment_requests.empty() is needed.
@@ -173,29 +173,29 @@ void LLAttachmentsMgr::requestAttachments(attachments_vec_t& attachment_requests
for (S32 i=0; i<obj_count; i++)
{
- if( 0 == (i % OBJECTS_PER_PACKET) )
- {
- // Start a new message chunk
- msg->newMessageFast(_PREHASH_RezMultipleAttachmentsFromInv);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_HeaderData);
- msg->addUUIDFast(_PREHASH_CompoundMsgID, compound_msg_id );
- msg->addU8Fast(_PREHASH_TotalObjects, obj_count );
- msg->addBOOLFast(_PREHASH_FirstDetachAll, false );
- }
-
- const AttachmentsInfo& attachment = attachment_requests.front();
- LLViewerInventoryItem* item = gInventory.getItem(attachment.mItemID);
- if (item)
+ if( 0 == (i % OBJECTS_PER_PACKET) )
+ {
+ // Start a new message chunk
+ msg->newMessageFast(_PREHASH_RezMultipleAttachmentsFromInv);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_HeaderData);
+ msg->addUUIDFast(_PREHASH_CompoundMsgID, compound_msg_id );
+ msg->addU8Fast(_PREHASH_TotalObjects, obj_count );
+ msg->addBOOLFast(_PREHASH_FirstDetachAll, false );
+ }
+
+ const AttachmentsInfo& attachment = attachment_requests.front();
+ LLViewerInventoryItem* item = gInventory.getItem(attachment.mItemID);
+ if (item)
{
LL_DEBUGS("Avatar") << "ATT requesting from attachment_requests " << item->getName()
<< " " << item->getLinkedUUID() << LL_ENDL;
S32 attachment_pt = attachment.mAttachmentPt;
- if (attachment.mAdd)
+ if (attachment.mAdd)
attachment_pt |= ATTACHMENT_ADD;
-
+
msg->nextBlockFast(_PREHASH_ObjectData );
msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID());
msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner());
@@ -205,17 +205,17 @@ void LLAttachmentsMgr::requestAttachments(attachments_vec_t& attachment_requests
msg->addStringFast(_PREHASH_Description, item->getDescription());
}
else
- {
- LL_WARNS("Avatar") << "ATT Attempted to add non-existent item ID:" << attachment.mItemID << LL_ENDL;
- }
-
- if( (i+1 == obj_count) || ((OBJECTS_PER_PACKET-1) == (i % OBJECTS_PER_PACKET)) )
- {
- // End of message chunk
- msg->sendReliable( gAgent.getRegion()->getHost() );
- }
+ {
+ LL_WARNS("Avatar") << "ATT Attempted to add non-existent item ID:" << attachment.mItemID << LL_ENDL;
+ }
+
+ if( (i+1 == obj_count) || ((OBJECTS_PER_PACKET-1) == (i % OBJECTS_PER_PACKET)) )
+ {
+ // End of message chunk
+ msg->sendReliable( gAgent.getRegion()->getHost() );
+ }
attachment_requests.pop_front();
- }
+ }
}
void LLAttachmentsMgr::linkRecentlyArrivedAttachments()
@@ -289,14 +289,14 @@ void LLAttachmentsMgr::LLItemRequestTimes::addTime(const LLUUID& inv_item_id)
{
LLInventoryItem *item = gInventory.getItem(inv_item_id);
LL_DEBUGS("Avatar") << "ATT " << mOpName << " adding request time " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL;
- LLTimer current_time;
- (*this)[inv_item_id] = current_time;
+ LLTimer current_time;
+ (*this)[inv_item_id] = current_time;
}
void LLAttachmentsMgr::LLItemRequestTimes::removeTime(const LLUUID& inv_item_id)
{
LLInventoryItem *item = gInventory.getItem(inv_item_id);
- S32 remove_count = (*this).erase(inv_item_id);
+ S32 remove_count = (*this).erase(inv_item_id);
if (remove_count)
{
LL_DEBUGS("Avatar") << "ATT " << mOpName << " removing request time "
@@ -306,9 +306,9 @@ void LLAttachmentsMgr::LLItemRequestTimes::removeTime(const LLUUID& inv_item_id)
BOOL LLAttachmentsMgr::LLItemRequestTimes::getTime(const LLUUID& inv_item_id, LLTimer& timer) const
{
- std::map<LLUUID,LLTimer>::const_iterator it = (*this).find(inv_item_id);
- if (it != (*this).end())
- {
+ std::map<LLUUID,LLTimer>::const_iterator it = (*this).find(inv_item_id);
+ if (it != (*this).end())
+ {
timer = it->second;
return TRUE;
}
@@ -320,7 +320,7 @@ BOOL LLAttachmentsMgr::LLItemRequestTimes::wasRequestedRecently(const LLUUID& in
LLTimer request_time;
if (getTime(inv_item_id, request_time))
{
- F32 request_time_elapsed = request_time.getElapsedTimeF32();
+ F32 request_time_elapsed = request_time.getElapsedTimeF32();
return request_time_elapsed < mTimeout;
}
else
@@ -340,7 +340,7 @@ BOOL LLAttachmentsMgr::LLItemRequestTimes::wasRequestedRecently(const LLUUID& in
// requestServerAppearanceUpdate() calls may occur.
void LLAttachmentsMgr::expireOldAttachmentRequests()
{
- for (std::map<LLUUID,LLTimer>::iterator it = mAttachmentRequests.begin();
+ for (std::map<LLUUID,LLTimer>::iterator it = mAttachmentRequests.begin();
it != mAttachmentRequests.end(); )
{
std::map<LLUUID,LLTimer>::iterator curr_it = it;
@@ -358,7 +358,7 @@ void LLAttachmentsMgr::expireOldAttachmentRequests()
void LLAttachmentsMgr::expireOldDetachRequests()
{
- for (std::map<LLUUID,LLTimer>::iterator it = mDetachRequests.begin();
+ for (std::map<LLUUID,LLTimer>::iterator it = mDetachRequests.begin();
it != mDetachRequests.end(); )
{
std::map<LLUUID,LLTimer>::iterator curr_it = it;
@@ -465,55 +465,55 @@ bool LLAttachmentsMgr::isAttachmentStateComplete() const
//
void LLAttachmentsMgr::checkInvalidCOFLinks()
{
- if (!gInventory.isInventoryUsable())
- {
- return;
- }
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(),
- cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
- for (S32 i=0; i<item_array.size(); i++)
- {
- const LLViewerInventoryItem* inv_item = item_array.at(i).get();
- const LLUUID& item_id = inv_item->getLinkedUUID();
- if (inv_item->getType() == LLAssetType::AT_OBJECT)
- {
- LLTimer timer;
- bool is_flagged_questionable = mQuestionableCOFLinks.getTime(item_id,timer);
- bool is_wearing_attachment = isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item_id);
- if (is_wearing_attachment && is_flagged_questionable)
- {
- LL_DEBUGS("Avatar") << "ATT was flagged questionable but is now "
- << (is_wearing_attachment ? "attached " : "")
- <<"removing flag after "
- << timer.getElapsedTimeF32() << " item "
- << inv_item->getName() << " id " << item_id << LL_ENDL;
- mQuestionableCOFLinks.removeTime(item_id);
- }
- }
- }
-
- for(LLItemRequestTimes::iterator it = mQuestionableCOFLinks.begin();
- it != mQuestionableCOFLinks.end(); )
- {
- LLItemRequestTimes::iterator curr_it = it;
- ++it;
- const LLUUID& item_id = curr_it->first;
- LLViewerInventoryItem *inv_item = gInventory.getItem(item_id);
- if (curr_it->second.getElapsedTimeF32() > MAX_BAD_COF_TIME)
- {
- if (LLAppearanceMgr::instance().isLinkedInCOF(item_id))
- {
- LL_DEBUGS("Avatar") << "ATT Linked in COF but not attached or requested, deleting link after "
- << curr_it->second.getElapsedTimeF32() << " seconds for "
- << (inv_item ? inv_item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
- LLAppearanceMgr::instance().removeCOFItemLinks(item_id);
- }
- mQuestionableCOFLinks.erase(curr_it);
- continue;
- }
- }
+ if (!gInventory.isInventoryUsable())
+ {
+ return;
+ }
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(),
+ cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
+ for (S32 i=0; i<item_array.size(); i++)
+ {
+ const LLViewerInventoryItem* inv_item = item_array.at(i).get();
+ const LLUUID& item_id = inv_item->getLinkedUUID();
+ if (inv_item->getType() == LLAssetType::AT_OBJECT)
+ {
+ LLTimer timer;
+ bool is_flagged_questionable = mQuestionableCOFLinks.getTime(item_id,timer);
+ bool is_wearing_attachment = isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item_id);
+ if (is_wearing_attachment && is_flagged_questionable)
+ {
+ LL_DEBUGS("Avatar") << "ATT was flagged questionable but is now "
+ << (is_wearing_attachment ? "attached " : "")
+ <<"removing flag after "
+ << timer.getElapsedTimeF32() << " item "
+ << inv_item->getName() << " id " << item_id << LL_ENDL;
+ mQuestionableCOFLinks.removeTime(item_id);
+ }
+ }
+ }
+
+ for(LLItemRequestTimes::iterator it = mQuestionableCOFLinks.begin();
+ it != mQuestionableCOFLinks.end(); )
+ {
+ LLItemRequestTimes::iterator curr_it = it;
+ ++it;
+ const LLUUID& item_id = curr_it->first;
+ LLViewerInventoryItem *inv_item = gInventory.getItem(item_id);
+ if (curr_it->second.getElapsedTimeF32() > MAX_BAD_COF_TIME)
+ {
+ if (LLAppearanceMgr::instance().isLinkedInCOF(item_id))
+ {
+ LL_DEBUGS("Avatar") << "ATT Linked in COF but not attached or requested, deleting link after "
+ << curr_it->second.getElapsedTimeF32() << " seconds for "
+ << (inv_item ? inv_item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
+ LLAppearanceMgr::instance().removeCOFItemLinks(item_id);
+ }
+ mQuestionableCOFLinks.erase(curr_it);
+ continue;
+ }
+ }
}
void LLAttachmentsMgr::spamStatusInfo()
@@ -525,7 +525,7 @@ void LLAttachmentsMgr::spamStatusInfo()
if (spam_timer.getElapsedTimeF32() > spam_frequency)
{
spam_timer.reset();
-
+
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(),
diff --git a/indra/newview/llattachmentsmgr.h b/indra/newview/llattachmentsmgr.h
index 90aeff3032..513daafabe 100644
--- a/indra/newview/llattachmentsmgr.h
+++ b/indra/newview/llattachmentsmgr.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llattachmentsmgr.h
* @brief Batches up attachment requests and sends them all
* in one message.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,7 +32,7 @@
//--------------------------------------------------------------------------------
// LLAttachmentsMgr
-//
+//
// This class manages batching up of requests at two stages of
// attachment rezzing.
//
@@ -61,24 +61,24 @@
class LLAttachmentsMgr: public LLSingleton<LLAttachmentsMgr>
{
LLSINGLETON(LLAttachmentsMgr);
- virtual ~LLAttachmentsMgr();
+ virtual ~LLAttachmentsMgr();
public:
// Stores info for attachments that will be requested during idle.
- struct AttachmentsInfo
- {
- LLUUID mItemID;
- U8 mAttachmentPt;
- BOOL mAdd;
- };
- typedef std::deque<AttachmentsInfo> attachments_vec_t;
-
- void addAttachmentRequest(const LLUUID& item_id,
+ struct AttachmentsInfo
+ {
+ LLUUID mItemID;
+ U8 mAttachmentPt;
+ BOOL mAdd;
+ };
+ typedef std::deque<AttachmentsInfo> attachments_vec_t;
+
+ void addAttachmentRequest(const LLUUID& item_id,
const U8 attachment_pt,
const BOOL add);
void onAttachmentRequested(const LLUUID& item_id);
- void requestAttachments(attachments_vec_t& attachment_requests);
- static void onIdle(void *);
+ void requestAttachments(attachments_vec_t& attachment_requests);
+ static void onIdle(void *);
void onAttachmentArrived(const LLUUID& inv_item_id);
@@ -103,30 +103,30 @@ private:
std::string mOpName;
};
- void removeAttachmentRequestTime(const LLUUID& inv_item_id);
- void onIdle();
- void requestPendingAttachments();
- void linkRecentlyArrivedAttachments();
+ void removeAttachmentRequestTime(const LLUUID& inv_item_id);
+ void onIdle();
+ void requestPendingAttachments();
+ void linkRecentlyArrivedAttachments();
void expireOldAttachmentRequests();
void expireOldDetachRequests();
void checkInvalidCOFLinks();
void spamStatusInfo();
// Attachments that we are planning to rez but haven't requested from the server yet.
- attachments_vec_t mPendingAttachments;
+ attachments_vec_t mPendingAttachments;
- // Attachments that have been requested from server but have not arrived yet.
- LLItemRequestTimes mAttachmentRequests;
+ // Attachments that have been requested from server but have not arrived yet.
+ LLItemRequestTimes mAttachmentRequests;
// Attachments that have been requested to detach but have not gone away yet.
- LLItemRequestTimes mDetachRequests;
+ LLItemRequestTimes mDetachRequests;
// Attachments that have arrived but have not been linked in the COF yet.
std::set<LLUUID> mRecentlyArrivedAttachments;
LLTimer mCOFLinkBatchTimer;
// Attachments that are linked in the COF but may be invalid.
- LLItemRequestTimes mQuestionableCOFLinks;
+ LLItemRequestTimes mQuestionableCOFLinks;
};
#endif
diff --git a/indra/newview/llaudiosourcevo.cpp b/indra/newview/llaudiosourcevo.cpp
index 43abbb57ee..13a91e9713 100644
--- a/indra/newview/llaudiosourcevo.cpp
+++ b/indra/newview/llaudiosourcevo.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llaudiosourcevo.cpp
* @author Douglas Soo, James Cook
* @brief Audio sources attached to viewer objects
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,24 +37,24 @@
#include "llvoavatarself.h"
LLAudioSourceVO::LLAudioSourceVO(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain, LLViewerObject *objectp)
- : LLAudioSource(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX),
- mObjectp(objectp)
+ : LLAudioSource(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX),
+ mObjectp(objectp)
{
- update();
+ update();
}
LLAudioSourceVO::~LLAudioSourceVO()
{
- if (mObjectp)
- {
- mObjectp->clearAttachedSound();
- }
- mObjectp = NULL;
+ if (mObjectp)
+ {
+ mObjectp->clearAttachedSound();
+ }
+ mObjectp = NULL;
}
void LLAudioSourceVO::setGain(const F32 gain)
{
- mGain = llclamp(gain, 0.f, 1.f);
+ mGain = llclamp(gain, 0.f, 1.f);
}
void LLAudioSourceVO::checkCutOffRadius()
@@ -129,16 +129,16 @@ bool LLAudioSourceVO::isInCutOffRadius(const LLVector3d pos_global, const F32 cu
void LLAudioSourceVO::updateMute()
{
- if (!mObjectp || mObjectp->isDead())
- {
- mSourceMuted = true;
- return;
- }
+ if (!mObjectp || mObjectp->isDead())
+ {
+ mSourceMuted = true;
+ return;
+ }
- bool mute = false;
- LLVector3d pos_global = getPosGlobal();
+ bool mute = false;
+ LLVector3d pos_global = getPosGlobal();
- F32 cutoff = mObjectp->getSoundCutOffRadius();
+ F32 cutoff = mObjectp->getSoundCutOffRadius();
// Object can specify radius at which it turns off
// consider cutoff below 0.1m as 'cutoff off'
if (cutoff > 0.1f && !isInCutOffRadius(pos_global, cutoff))
@@ -170,90 +170,90 @@ void LLAudioSourceVO::updateMute()
}
}
- if (!mute)
- {
- if (LLMuteList::getInstance()->isMuted(mObjectp->getID()))
- {
- mute = true;
- }
- else if (LLMuteList::getInstance()->isMuted(mOwnerID, LLMute::flagObjectSounds))
- {
- mute = true;
- }
- else if (mObjectp->isAttachment())
- {
- LLViewerObject* parent = mObjectp;
- while (parent && !parent->isAvatar())
- {
- parent = (LLViewerObject*)parent->getParent();
- }
- if (parent
- && LLMuteList::getInstance()->isMuted(parent->getID()))
- {
- mute = true;
- }
- }
- }
+ if (!mute)
+ {
+ if (LLMuteList::getInstance()->isMuted(mObjectp->getID()))
+ {
+ mute = true;
+ }
+ else if (LLMuteList::getInstance()->isMuted(mOwnerID, LLMute::flagObjectSounds))
+ {
+ mute = true;
+ }
+ else if (mObjectp->isAttachment())
+ {
+ LLViewerObject* parent = mObjectp;
+ while (parent && !parent->isAvatar())
+ {
+ parent = (LLViewerObject*)parent->getParent();
+ }
+ if (parent
+ && LLMuteList::getInstance()->isMuted(parent->getID()))
+ {
+ mute = true;
+ }
+ }
+ }
- if (mute != mSourceMuted)
- {
- mSourceMuted = mute;
- if (mSourceMuted)
- {
- // Stop the sound.
- this->play(LLUUID::null);
- }
- else
- {
- // Muted sounds keep there data at all times, because
- // it's the place where the audio UUID is stored.
- // However, it's possible that mCurrentDatap is
- // NULL when this source did only preload sounds.
- if (mCurrentDatap)
- {
- // Restart the sound.
- this->play(mCurrentDatap->getID());
- }
- }
- }
+ if (mute != mSourceMuted)
+ {
+ mSourceMuted = mute;
+ if (mSourceMuted)
+ {
+ // Stop the sound.
+ this->play(LLUUID::null);
+ }
+ else
+ {
+ // Muted sounds keep there data at all times, because
+ // it's the place where the audio UUID is stored.
+ // However, it's possible that mCurrentDatap is
+ // NULL when this source did only preload sounds.
+ if (mCurrentDatap)
+ {
+ // Restart the sound.
+ this->play(mCurrentDatap->getID());
+ }
+ }
+ }
}
void LLAudioSourceVO::update()
{
- updateMute();
+ updateMute();
- if (!mObjectp)
- {
- return;
- }
+ if (!mObjectp)
+ {
+ return;
+ }
- if (mObjectp->isDead())
- {
- mObjectp = NULL;
- return;
- }
+ if (mObjectp->isDead())
+ {
+ mObjectp = NULL;
+ return;
+ }
- if (mSourceMuted)
- {
- return;
- }
+ if (mSourceMuted)
+ {
+ return;
+ }
- if (mObjectp->isHUDAttachment())
- {
- mPositionGlobal = gAgentCamera.getCameraPositionGlobal();
- }
- else
- {
- mPositionGlobal = mObjectp->getPositionGlobal();
- }
- if (mObjectp->getSubParent())
- {
- mVelocity = mObjectp->getSubParent()->getVelocity();
- }
- else
- {
- mVelocity = mObjectp->getVelocity();
- }
+ if (mObjectp->isHUDAttachment())
+ {
+ mPositionGlobal = gAgentCamera.getCameraPositionGlobal();
+ }
+ else
+ {
+ mPositionGlobal = mObjectp->getPositionGlobal();
+ }
+ if (mObjectp->getSubParent())
+ {
+ mVelocity = mObjectp->getSubParent()->getVelocity();
+ }
+ else
+ {
+ mVelocity = mObjectp->getVelocity();
+ }
- LLAudioSource::update();
+ LLAudioSource::update();
}
diff --git a/indra/newview/llaudiosourcevo.h b/indra/newview/llaudiosourcevo.h
index 672a07f7d3..3a21ec6d6b 100644
--- a/indra/newview/llaudiosourcevo.h
+++ b/indra/newview/llaudiosourcevo.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llaudiosourcevo.h
* @author Douglas Soo, James Cook
* @brief Audio sources attached to viewer objects
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,20 +36,20 @@ class LLViewerObject;
class LLAudioSourceVO : public LLAudioSource
{
public:
- LLAudioSourceVO(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain, LLViewerObject *objectp);
- virtual ~LLAudioSourceVO();
- /*virtual*/ void update();
- /*virtual*/ void setGain(const F32 gain);
+ LLAudioSourceVO(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain, LLViewerObject *objectp);
+ virtual ~LLAudioSourceVO();
+ /*virtual*/ void update();
+ /*virtual*/ void setGain(const F32 gain);
- void checkCutOffRadius();
+ void checkCutOffRadius();
private:
- LLVector3d getPosGlobal() const;
- bool isInCutOffRadius(LLVector3d pos_global, const F32 cutoff) const;
- void updateMute();
+ LLVector3d getPosGlobal() const;
+ bool isInCutOffRadius(LLVector3d pos_global, const F32 cutoff) const;
+ void updateMute();
private:
- LLPointer<LLViewerObject> mObjectp;
+ LLPointer<LLViewerObject> mObjectp;
};
#endif // LL_LLAUDIOSOURCEVO_H
diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp
index 0516520c56..e1d494f7c7 100644
--- a/indra/newview/llautoreplace.cpp
+++ b/indra/newview/llautoreplace.cpp
@@ -34,98 +34,98 @@ const char* LLAutoReplace::SETTINGS_FILE_NAME = "autoreplace.xml";
void LLAutoReplace::autoreplaceCallback(S32& replacement_start, S32& replacement_length, LLWString& replacement_string, S32& cursor_pos, const LLWString& input_text)
{
- // make sure these returned values are cleared in case there is no replacement
- replacement_start = 0;
- replacement_length = 0;
- replacement_string.clear();
-
- static LLCachedControl<bool> perform_autoreplace(gSavedSettings, "AutoReplace", 0);
- if (perform_autoreplace)
- {
- S32 word_end = cursor_pos - 1;
-
- bool at_space = (input_text[word_end] == ' ');
- bool have_word = (LLWStringUtil::isPartOfWord(input_text[word_end]));
-
- if (at_space || have_word)
- {
- if (at_space && word_end > 0)
- {
- // find out if this space immediately follows a word
- word_end--;
- have_word = (LLWStringUtil::isPartOfWord(input_text[word_end]));
- }
- if (have_word)
- {
- // word_end points to the end of a word, now find the start of the word
- std::string word;
- S32 word_start = word_end;
- for (S32 back_one = word_start - 1;
- back_one >= 0 && LLWStringUtil::isPartOfWord(input_text[back_one]);
- back_one--
- )
- {
- word_start--; // walk word_start back to the beginning of the word
- }
- LL_DEBUGS("AutoReplace") << "word_start: " << word_start << " word_end: " << word_end << LL_ENDL;
- LLWString old_string = input_text.substr(word_start, word_end - word_start + 1);
- std::string last_word = wstring_to_utf8str(old_string);
- std::string replacement_word(mSettings.replaceWord(last_word));
-
- if (replacement_word != last_word)
- {
- // The last word is one for which we have a replacement
- if (at_space)
- {
- // return the replacement string
- replacement_start = word_start;
- replacement_length = word_end - word_start + 1;
- replacement_string = utf8str_to_wstring(replacement_word);
- S32 size_change = replacement_string.size() - old_string.size();
- cursor_pos += size_change;
- }
- }
- }
- }
- }
+ // make sure these returned values are cleared in case there is no replacement
+ replacement_start = 0;
+ replacement_length = 0;
+ replacement_string.clear();
+
+ static LLCachedControl<bool> perform_autoreplace(gSavedSettings, "AutoReplace", 0);
+ if (perform_autoreplace)
+ {
+ S32 word_end = cursor_pos - 1;
+
+ bool at_space = (input_text[word_end] == ' ');
+ bool have_word = (LLWStringUtil::isPartOfWord(input_text[word_end]));
+
+ if (at_space || have_word)
+ {
+ if (at_space && word_end > 0)
+ {
+ // find out if this space immediately follows a word
+ word_end--;
+ have_word = (LLWStringUtil::isPartOfWord(input_text[word_end]));
+ }
+ if (have_word)
+ {
+ // word_end points to the end of a word, now find the start of the word
+ std::string word;
+ S32 word_start = word_end;
+ for (S32 back_one = word_start - 1;
+ back_one >= 0 && LLWStringUtil::isPartOfWord(input_text[back_one]);
+ back_one--
+ )
+ {
+ word_start--; // walk word_start back to the beginning of the word
+ }
+ LL_DEBUGS("AutoReplace") << "word_start: " << word_start << " word_end: " << word_end << LL_ENDL;
+ LLWString old_string = input_text.substr(word_start, word_end - word_start + 1);
+ std::string last_word = wstring_to_utf8str(old_string);
+ std::string replacement_word(mSettings.replaceWord(last_word));
+
+ if (replacement_word != last_word)
+ {
+ // The last word is one for which we have a replacement
+ if (at_space)
+ {
+ // return the replacement string
+ replacement_start = word_start;
+ replacement_length = word_end - word_start + 1;
+ replacement_string = utf8str_to_wstring(replacement_word);
+ S32 size_change = replacement_string.size() - old_string.size();
+ cursor_pos += size_change;
+ }
+ }
+ }
+ }
+ }
}
std::string LLAutoReplace::getUserSettingsFileName()
{
- std::string path=gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "");
+ std::string path=gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "");
- if (!path.empty())
- {
- path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, SETTINGS_FILE_NAME);
- }
- return path;
+ if (!path.empty())
+ {
+ path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, SETTINGS_FILE_NAME);
+ }
+ return path;
}
std::string LLAutoReplace::getAppSettingsFileName()
{
- std::string path=gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "");
+ std::string path=gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "");
- if (!path.empty())
- {
- path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, SETTINGS_FILE_NAME);
- }
- else
- {
- LL_ERRS("AutoReplace") << "Failed to get app settings directory name" << LL_ENDL;
- }
- return path;
+ if (!path.empty())
+ {
+ path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, SETTINGS_FILE_NAME);
+ }
+ else
+ {
+ LL_ERRS("AutoReplace") << "Failed to get app settings directory name" << LL_ENDL;
+ }
+ return path;
}
LLAutoReplaceSettings LLAutoReplace::getSettings()
{
- return mSettings;
+ return mSettings;
}
void LLAutoReplace::setSettings(const LLAutoReplaceSettings& newSettings)
{
- mSettings.set(newSettings);
- /// Make the newSettings active and write them to user storage
- saveToUserSettings();
+ mSettings.set(newSettings);
+ /// Make the newSettings active and write them to user storage
+ saveToUserSettings();
}
LLAutoReplace::LLAutoReplace()
@@ -139,87 +139,87 @@ void LLAutoReplace::initSingleton()
void LLAutoReplace::loadFromSettings()
{
- std::string filename=getUserSettingsFileName();
- if (filename.empty())
- {
- LL_INFOS("AutoReplace") << "no valid user settings directory." << LL_ENDL;
- }
- if(gDirUtilp->fileExists(filename))
- {
- LLSD userSettings;
- llifstream file;
- file.open(filename.c_str());
- if (file.is_open())
- {
- LLSDSerialize::fromXML(userSettings, file);
- }
- file.close();
- if ( mSettings.setFromLLSD(userSettings) )
- {
- LL_INFOS("AutoReplace") << "settings loaded from '" << filename << "'" << LL_ENDL;
- }
- else
- {
- LL_WARNS("AutoReplace") << "invalid settings found in '" << filename << "'" << LL_ENDL;
- }
- }
- else // no user settings found, try application settings
- {
- std::string defaultName = getAppSettingsFileName();
- LL_INFOS("AutoReplace") << " user settings file '" << filename << "' not found"<< LL_ENDL;
-
- bool gotSettings = false;
- if(gDirUtilp->fileExists(defaultName))
- {
- LLSD appDefault;
- llifstream file;
- file.open(defaultName.c_str());
- if (file.is_open())
- {
- LLSDSerialize::fromXMLDocument(appDefault, file);
- }
- file.close();
-
- if ( mSettings.setFromLLSD(appDefault) )
- {
- LL_INFOS("AutoReplace") << "settings loaded from '" << defaultName.c_str() << "'" << LL_ENDL;
- gotSettings = true;
- }
- else
- {
- LL_WARNS("AutoReplace") << "invalid settings found in '" << defaultName.c_str() << "'" << LL_ENDL;
- }
- }
-
- if ( ! gotSettings )
- {
- if (mSettings.setFromLLSD(mSettings.getExampleLLSD()))
- {
- LL_WARNS("AutoReplace") << "no settings found; loaded example." << LL_ENDL;
- }
- else
- {
- LL_WARNS("AutoReplace") << "no settings found and example invalid!" << LL_ENDL;
- }
- }
- }
+ std::string filename=getUserSettingsFileName();
+ if (filename.empty())
+ {
+ LL_INFOS("AutoReplace") << "no valid user settings directory." << LL_ENDL;
+ }
+ if(gDirUtilp->fileExists(filename))
+ {
+ LLSD userSettings;
+ llifstream file;
+ file.open(filename.c_str());
+ if (file.is_open())
+ {
+ LLSDSerialize::fromXML(userSettings, file);
+ }
+ file.close();
+ if ( mSettings.setFromLLSD(userSettings) )
+ {
+ LL_INFOS("AutoReplace") << "settings loaded from '" << filename << "'" << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "invalid settings found in '" << filename << "'" << LL_ENDL;
+ }
+ }
+ else // no user settings found, try application settings
+ {
+ std::string defaultName = getAppSettingsFileName();
+ LL_INFOS("AutoReplace") << " user settings file '" << filename << "' not found"<< LL_ENDL;
+
+ bool gotSettings = false;
+ if(gDirUtilp->fileExists(defaultName))
+ {
+ LLSD appDefault;
+ llifstream file;
+ file.open(defaultName.c_str());
+ if (file.is_open())
+ {
+ LLSDSerialize::fromXMLDocument(appDefault, file);
+ }
+ file.close();
+
+ if ( mSettings.setFromLLSD(appDefault) )
+ {
+ LL_INFOS("AutoReplace") << "settings loaded from '" << defaultName.c_str() << "'" << LL_ENDL;
+ gotSettings = true;
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "invalid settings found in '" << defaultName.c_str() << "'" << LL_ENDL;
+ }
+ }
+
+ if ( ! gotSettings )
+ {
+ if (mSettings.setFromLLSD(mSettings.getExampleLLSD()))
+ {
+ LL_WARNS("AutoReplace") << "no settings found; loaded example." << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "no settings found and example invalid!" << LL_ENDL;
+ }
+ }
+ }
}
void LLAutoReplace::saveToUserSettings()
{
- std::string filename=getUserSettingsFileName();
- llofstream file;
- file.open(filename.c_str());
- LLSDSerialize::toPrettyXML(mSettings.asLLSD(), file);
- file.close();
- LL_INFOS("AutoReplace") << "settings saved to '" << filename << "'" << LL_ENDL;
+ std::string filename=getUserSettingsFileName();
+ llofstream file;
+ file.open(filename.c_str());
+ LLSDSerialize::toPrettyXML(mSettings.asLLSD(), file);
+ file.close();
+ LL_INFOS("AutoReplace") << "settings saved to '" << filename << "'" << LL_ENDL;
}
// ================================================================
// LLAutoReplaceSettings
// ================================================================
-const std::string LLAutoReplaceSettings::AUTOREPLACE_LIST_NAME = "name"; ///< key for looking up list names
+const std::string LLAutoReplaceSettings::AUTOREPLACE_LIST_NAME = "name"; ///< key for looking up list names
const std::string LLAutoReplaceSettings::AUTOREPLACE_LIST_REPLACEMENTS = "replacements"; ///< key for looking up replacement map
LLAutoReplaceSettings::LLAutoReplaceSettings()
@@ -228,572 +228,572 @@ LLAutoReplaceSettings::LLAutoReplaceSettings()
LLAutoReplaceSettings::LLAutoReplaceSettings(const LLAutoReplaceSettings& settings)
{
- // copy all values through fundamental type intermediates for thread safety
- mLists = LLSD::emptyArray();
-
- for ( LLSD::array_const_iterator list = settings.mLists.beginArray(), listEnd = settings.mLists.endArray();
- list != listEnd;
- list++
- )
- {
- if ( (*list).isMap() ) // can fail due to LLSD-30: ignore it
- {
- LLSD listMap = LLSD::emptyMap();
- std::string listName = (*list)[AUTOREPLACE_LIST_NAME];
- listMap[AUTOREPLACE_LIST_NAME] = listName;
- listMap[AUTOREPLACE_LIST_REPLACEMENTS] = LLSD::emptyMap();
-
- for ( LLSD::map_const_iterator
- entry = (*list)[AUTOREPLACE_LIST_REPLACEMENTS].beginMap(),
- entriesEnd = (*list)[AUTOREPLACE_LIST_REPLACEMENTS].endMap();
- entry != entriesEnd;
- entry++
- )
- {
- std::string keyword = entry->first;
- std::string replacement = entry->second.asString();
- listMap[AUTOREPLACE_LIST_REPLACEMENTS].insert(keyword, LLSD(replacement));
- }
-
- mLists.append(listMap);
- }
- }
+ // copy all values through fundamental type intermediates for thread safety
+ mLists = LLSD::emptyArray();
+
+ for ( LLSD::array_const_iterator list = settings.mLists.beginArray(), listEnd = settings.mLists.endArray();
+ list != listEnd;
+ list++
+ )
+ {
+ if ( (*list).isMap() ) // can fail due to LLSD-30: ignore it
+ {
+ LLSD listMap = LLSD::emptyMap();
+ std::string listName = (*list)[AUTOREPLACE_LIST_NAME];
+ listMap[AUTOREPLACE_LIST_NAME] = listName;
+ listMap[AUTOREPLACE_LIST_REPLACEMENTS] = LLSD::emptyMap();
+
+ for ( LLSD::map_const_iterator
+ entry = (*list)[AUTOREPLACE_LIST_REPLACEMENTS].beginMap(),
+ entriesEnd = (*list)[AUTOREPLACE_LIST_REPLACEMENTS].endMap();
+ entry != entriesEnd;
+ entry++
+ )
+ {
+ std::string keyword = entry->first;
+ std::string replacement = entry->second.asString();
+ listMap[AUTOREPLACE_LIST_REPLACEMENTS].insert(keyword, LLSD(replacement));
+ }
+
+ mLists.append(listMap);
+ }
+ }
}
void LLAutoReplaceSettings::set(const LLAutoReplaceSettings& newSettings)
{
- mLists = newSettings.mLists;
+ mLists = newSettings.mLists;
}
bool LLAutoReplaceSettings::setFromLLSD(const LLSD& settingsFromLLSD)
{
- bool settingsValid = true;
-
- if ( settingsFromLLSD.isArray() )
- {
- for ( LLSD::array_const_iterator
- list = settingsFromLLSD.beginArray(),
- listEnd = settingsFromLLSD.endArray();
- settingsValid && list != listEnd;
- list++
- )
- {
- if ( (*list).isDefined() ) // can be undef due to LLSD-30: ignore it
- {
- settingsValid = listIsValid(*list);
- }
- }
- }
- else
- {
- settingsValid = false;
- LL_WARNS("AutoReplace") << "settings are not an array" << LL_ENDL;
- }
-
- if ( settingsValid )
- {
- mLists = settingsFromLLSD;
- }
- else
- {
- LL_WARNS("AutoReplace") << "invalid settings discarded; using hard coded example" << LL_ENDL;
- }
-
- return settingsValid;
+ bool settingsValid = true;
+
+ if ( settingsFromLLSD.isArray() )
+ {
+ for ( LLSD::array_const_iterator
+ list = settingsFromLLSD.beginArray(),
+ listEnd = settingsFromLLSD.endArray();
+ settingsValid && list != listEnd;
+ list++
+ )
+ {
+ if ( (*list).isDefined() ) // can be undef due to LLSD-30: ignore it
+ {
+ settingsValid = listIsValid(*list);
+ }
+ }
+ }
+ else
+ {
+ settingsValid = false;
+ LL_WARNS("AutoReplace") << "settings are not an array" << LL_ENDL;
+ }
+
+ if ( settingsValid )
+ {
+ mLists = settingsFromLLSD;
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "invalid settings discarded; using hard coded example" << LL_ENDL;
+ }
+
+ return settingsValid;
}
bool LLAutoReplaceSettings::listNameMatches( const LLSD& list, const std::string name )
{
- return list.isMap()
- && list.has(AUTOREPLACE_LIST_NAME)
- && list[AUTOREPLACE_LIST_NAME].asString() == name;
+ return list.isMap()
+ && list.has(AUTOREPLACE_LIST_NAME)
+ && list[AUTOREPLACE_LIST_NAME].asString() == name;
}
const LLSD* LLAutoReplaceSettings::getListEntries(std::string listName)
{
- const LLSD* returnedEntries = NULL;
- for( LLSD::array_const_iterator list = mLists.beginArray(), endList = mLists.endArray();
- returnedEntries == NULL && list != endList;
- list++
- )
- {
- const LLSD& thisList = *list;
- if ( listNameMatches(thisList, listName) )
- {
- returnedEntries = &thisList[AUTOREPLACE_LIST_REPLACEMENTS];
- }
- }
- return returnedEntries;
+ const LLSD* returnedEntries = NULL;
+ for( LLSD::array_const_iterator list = mLists.beginArray(), endList = mLists.endArray();
+ returnedEntries == NULL && list != endList;
+ list++
+ )
+ {
+ const LLSD& thisList = *list;
+ if ( listNameMatches(thisList, listName) )
+ {
+ returnedEntries = &thisList[AUTOREPLACE_LIST_REPLACEMENTS];
+ }
+ }
+ return returnedEntries;
}
std::string LLAutoReplaceSettings::replacementFor(std::string keyword, std::string listName)
{
- std::string replacement;
- bool foundList = false;
- for( LLSD::array_const_iterator list = mLists.beginArray(), endList = mLists.endArray();
- ! foundList && list != endList;
- list++
- )
- {
- const LLSD& thisList = *list;
- if ( listNameMatches(thisList, listName) )
- {
- foundList = true; // whether there is a replacement or not, we're done
- if ( thisList.isMap()
- && thisList.has(AUTOREPLACE_LIST_REPLACEMENTS)
- && thisList[AUTOREPLACE_LIST_REPLACEMENTS].has(keyword)
- )
- {
- replacement = thisList[AUTOREPLACE_LIST_REPLACEMENTS][keyword].asString();
- LL_DEBUGS("AutoReplace")<<"'"<<keyword<<"' -> '"<<replacement<<"'"<<LL_ENDL;
- }
- }
- if (!foundList)
- {
- LL_WARNS("AutoReplace")<<"failed to find list '"<<listName<<"'"<<LL_ENDL;
- }
- }
- if (replacement.empty())
- {
- LL_WARNS("AutoReplace")<<"failed to find '"<<keyword<<"'"<<LL_ENDL;
- }
- return replacement;
+ std::string replacement;
+ bool foundList = false;
+ for( LLSD::array_const_iterator list = mLists.beginArray(), endList = mLists.endArray();
+ ! foundList && list != endList;
+ list++
+ )
+ {
+ const LLSD& thisList = *list;
+ if ( listNameMatches(thisList, listName) )
+ {
+ foundList = true; // whether there is a replacement or not, we're done
+ if ( thisList.isMap()
+ && thisList.has(AUTOREPLACE_LIST_REPLACEMENTS)
+ && thisList[AUTOREPLACE_LIST_REPLACEMENTS].has(keyword)
+ )
+ {
+ replacement = thisList[AUTOREPLACE_LIST_REPLACEMENTS][keyword].asString();
+ LL_DEBUGS("AutoReplace")<<"'"<<keyword<<"' -> '"<<replacement<<"'"<<LL_ENDL;
+ }
+ }
+ if (!foundList)
+ {
+ LL_WARNS("AutoReplace")<<"failed to find list '"<<listName<<"'"<<LL_ENDL;
+ }
+ }
+ if (replacement.empty())
+ {
+ LL_WARNS("AutoReplace")<<"failed to find '"<<keyword<<"'"<<LL_ENDL;
+ }
+ return replacement;
}
LLSD LLAutoReplaceSettings::getListNames()
{
- LL_DEBUGS("AutoReplace")<<"====="<<LL_ENDL;
- LLSD toReturn = LLSD::emptyArray();
- S32 counter=0;
- for( LLSD::array_const_iterator list = mLists.beginArray(), endList = mLists.endArray();
- list != endList;
- list++
- )
- {
- const LLSD& thisList = *list;
- if ( thisList.isMap() )
- {
- if ( thisList.has(AUTOREPLACE_LIST_NAME) )
- {
- std::string name = thisList[AUTOREPLACE_LIST_NAME].asString();
- LL_DEBUGS("AutoReplace")<<counter<<" '"<<name<<"'"<<LL_ENDL;
- toReturn.append(LLSD(name));
- }
- else
- {
- LL_ERRS("AutoReplace") <<counter<<" ! MISSING "<<AUTOREPLACE_LIST_NAME<< LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("AutoReplace")<<counter<<" ! not a map: "<<LLSD::typeString(thisList.type())<< LL_ENDL;
- }
- counter++;
- }
- LL_DEBUGS("AutoReplace")<<"^^^^^^"<<LL_ENDL;
- return toReturn;
+ LL_DEBUGS("AutoReplace")<<"====="<<LL_ENDL;
+ LLSD toReturn = LLSD::emptyArray();
+ S32 counter=0;
+ for( LLSD::array_const_iterator list = mLists.beginArray(), endList = mLists.endArray();
+ list != endList;
+ list++
+ )
+ {
+ const LLSD& thisList = *list;
+ if ( thisList.isMap() )
+ {
+ if ( thisList.has(AUTOREPLACE_LIST_NAME) )
+ {
+ std::string name = thisList[AUTOREPLACE_LIST_NAME].asString();
+ LL_DEBUGS("AutoReplace")<<counter<<" '"<<name<<"'"<<LL_ENDL;
+ toReturn.append(LLSD(name));
+ }
+ else
+ {
+ LL_ERRS("AutoReplace") <<counter<<" ! MISSING "<<AUTOREPLACE_LIST_NAME<< LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("AutoReplace")<<counter<<" ! not a map: "<<LLSD::typeString(thisList.type())<< LL_ENDL;
+ }
+ counter++;
+ }
+ LL_DEBUGS("AutoReplace")<<"^^^^^^"<<LL_ENDL;
+ return toReturn;
}
bool LLAutoReplaceSettings::listIsValid(const LLSD& list)
{
- bool listValid = true;
- if ( ! list.isMap() )
- {
- listValid = false;
- LL_WARNS("AutoReplace") << "list is not a map" << LL_ENDL;
- }
- else if ( ! list.has(AUTOREPLACE_LIST_NAME)
- || ! list[AUTOREPLACE_LIST_NAME].isString()
- || list[AUTOREPLACE_LIST_NAME].asString().empty()
- )
- {
- listValid = false;
- LL_WARNS("AutoReplace")
- << "list found without " << AUTOREPLACE_LIST_NAME
- << " (or it is empty)"
- << LL_ENDL;
- }
- else if ( ! list.has(AUTOREPLACE_LIST_REPLACEMENTS) || ! list[AUTOREPLACE_LIST_REPLACEMENTS].isMap() )
- {
- listValid = false;
- LL_WARNS("AutoReplace") << "list '" << list[AUTOREPLACE_LIST_NAME].asString() << "' without " << AUTOREPLACE_LIST_REPLACEMENTS << LL_ENDL;
- }
- else
- {
- for ( LLSD::map_const_iterator
- entry = list[AUTOREPLACE_LIST_REPLACEMENTS].beginMap(),
- entriesEnd = list[AUTOREPLACE_LIST_REPLACEMENTS].endMap();
- listValid && entry != entriesEnd;
- entry++
- )
- {
- if ( ! entry->second.isString() )
- {
- listValid = false;
- LL_WARNS("AutoReplace")
- << "non-string replacement value found in list '"
- << list[AUTOREPLACE_LIST_NAME].asString() << "'"
- << LL_ENDL;
- }
- }
- }
-
- return listValid;
+ bool listValid = true;
+ if ( ! list.isMap() )
+ {
+ listValid = false;
+ LL_WARNS("AutoReplace") << "list is not a map" << LL_ENDL;
+ }
+ else if ( ! list.has(AUTOREPLACE_LIST_NAME)
+ || ! list[AUTOREPLACE_LIST_NAME].isString()
+ || list[AUTOREPLACE_LIST_NAME].asString().empty()
+ )
+ {
+ listValid = false;
+ LL_WARNS("AutoReplace")
+ << "list found without " << AUTOREPLACE_LIST_NAME
+ << " (or it is empty)"
+ << LL_ENDL;
+ }
+ else if ( ! list.has(AUTOREPLACE_LIST_REPLACEMENTS) || ! list[AUTOREPLACE_LIST_REPLACEMENTS].isMap() )
+ {
+ listValid = false;
+ LL_WARNS("AutoReplace") << "list '" << list[AUTOREPLACE_LIST_NAME].asString() << "' without " << AUTOREPLACE_LIST_REPLACEMENTS << LL_ENDL;
+ }
+ else
+ {
+ for ( LLSD::map_const_iterator
+ entry = list[AUTOREPLACE_LIST_REPLACEMENTS].beginMap(),
+ entriesEnd = list[AUTOREPLACE_LIST_REPLACEMENTS].endMap();
+ listValid && entry != entriesEnd;
+ entry++
+ )
+ {
+ if ( ! entry->second.isString() )
+ {
+ listValid = false;
+ LL_WARNS("AutoReplace")
+ << "non-string replacement value found in list '"
+ << list[AUTOREPLACE_LIST_NAME].asString() << "'"
+ << LL_ENDL;
+ }
+ }
+ }
+
+ return listValid;
}
const LLSD* LLAutoReplaceSettings::exportList(std::string listName)
{
- const LLSD* exportedList = NULL;
- for ( LLSD::array_const_iterator list = mLists.beginArray(), listEnd = mLists.endArray();
- exportedList == NULL && list != listEnd;
- list++
- )
- {
- if ( listNameMatches(*list, listName) )
- {
- const LLSD& namedList = (*list);
- exportedList = &namedList;
- }
- }
- return exportedList;
+ const LLSD* exportedList = NULL;
+ for ( LLSD::array_const_iterator list = mLists.beginArray(), listEnd = mLists.endArray();
+ exportedList == NULL && list != listEnd;
+ list++
+ )
+ {
+ if ( listNameMatches(*list, listName) )
+ {
+ const LLSD& namedList = (*list);
+ exportedList = &namedList;
+ }
+ }
+ return exportedList;
}
bool LLAutoReplaceSettings::listNameIsUnique(const LLSD& newList)
{
- bool nameIsUnique = true;
- // this must always be called with a valid list, so it is safe to assume it has a name
- std::string newListName = newList[AUTOREPLACE_LIST_NAME].asString();
- for ( LLSD::array_const_iterator list = mLists.beginArray(), listEnd = mLists.endArray();
- nameIsUnique && list != listEnd;
- list++
- )
- {
- if ( listNameMatches(*list, newListName) )
- {
- LL_WARNS("AutoReplace")<<"duplicate list name '"<<newListName<<"'"<<LL_ENDL;
- nameIsUnique = false;
- }
- }
- return nameIsUnique;
+ bool nameIsUnique = true;
+ // this must always be called with a valid list, so it is safe to assume it has a name
+ std::string newListName = newList[AUTOREPLACE_LIST_NAME].asString();
+ for ( LLSD::array_const_iterator list = mLists.beginArray(), listEnd = mLists.endArray();
+ nameIsUnique && list != listEnd;
+ list++
+ )
+ {
+ if ( listNameMatches(*list, newListName) )
+ {
+ LL_WARNS("AutoReplace")<<"duplicate list name '"<<newListName<<"'"<<LL_ENDL;
+ nameIsUnique = false;
+ }
+ }
+ return nameIsUnique;
}
/* static */
void LLAutoReplaceSettings::createEmptyList(LLSD& emptyList)
{
- emptyList = LLSD::emptyMap();
- emptyList[AUTOREPLACE_LIST_NAME] = "Empty";
- emptyList[AUTOREPLACE_LIST_REPLACEMENTS] = LLSD::emptyMap();
+ emptyList = LLSD::emptyMap();
+ emptyList[AUTOREPLACE_LIST_NAME] = "Empty";
+ emptyList[AUTOREPLACE_LIST_REPLACEMENTS] = LLSD::emptyMap();
}
/* static */
void LLAutoReplaceSettings::setListName(LLSD& list, const std::string& newName)
{
- list[AUTOREPLACE_LIST_NAME] = newName;
+ list[AUTOREPLACE_LIST_NAME] = newName;
}
/* static */
std::string LLAutoReplaceSettings::getListName(LLSD& list)
{
- std::string name;
- if ( list.isMap() && list.has(AUTOREPLACE_LIST_NAME) && list[AUTOREPLACE_LIST_NAME].isString() )
- {
- name = list[AUTOREPLACE_LIST_NAME].asString();
- }
- return name;
+ std::string name;
+ if ( list.isMap() && list.has(AUTOREPLACE_LIST_NAME) && list[AUTOREPLACE_LIST_NAME].isString() )
+ {
+ name = list[AUTOREPLACE_LIST_NAME].asString();
+ }
+ return name;
}
LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::addList(const LLSD& newList)
{
- AddListResult result;
- if ( listIsValid( newList ) )
- {
- if ( listNameIsUnique( newList ) )
- {
- mLists.append(newList);
- result = AddListOk;
- }
- else
- {
- LL_WARNS("AutoReplace") << "attempt to add duplicate name" << LL_ENDL;
- result = AddListDuplicateName;
- }
- }
- else
- {
- LL_WARNS("AutoReplace") << "attempt to add invalid list" << LL_ENDL;
- result = AddListInvalidList;
- }
- return result;
+ AddListResult result;
+ if ( listIsValid( newList ) )
+ {
+ if ( listNameIsUnique( newList ) )
+ {
+ mLists.append(newList);
+ result = AddListOk;
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "attempt to add duplicate name" << LL_ENDL;
+ result = AddListDuplicateName;
+ }
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "attempt to add invalid list" << LL_ENDL;
+ result = AddListInvalidList;
+ }
+ return result;
}
LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::replaceList(const LLSD& newList)
{
- AddListResult result = AddListInvalidList;
- if ( listIsValid( newList ) )
- {
- std::string listName = newList[AUTOREPLACE_LIST_NAME].asString();
- bool listFound = false;
- S32 search_index;
- LLSD targetList;
- // The following is working around the fact that LLSD arrays containing maps also seem to have undefined entries... see LLSD-30
- for ( search_index = 0, targetList = mLists[0];
- !listFound && search_index < mLists.size();
- search_index += 1, targetList = mLists[search_index]
- )
- {
- if ( targetList.isMap() )
- {
- if ( listNameMatches( targetList, listName) )
- {
- LL_DEBUGS("AutoReplace")<<"list to replace found at "<<search_index<<LL_ENDL;
- mLists.erase(search_index);
- mLists.insert(search_index, newList);
- listFound = true;
- result = AddListOk;
- }
- }
- }
-
- if ( ! listFound )
- {
- LL_WARNS("AutoReplace") << "attempt to replace unconfigured list" << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("AutoReplace") << "attempt to add invalid list" << LL_ENDL;
- }
- return result;
+ AddListResult result = AddListInvalidList;
+ if ( listIsValid( newList ) )
+ {
+ std::string listName = newList[AUTOREPLACE_LIST_NAME].asString();
+ bool listFound = false;
+ S32 search_index;
+ LLSD targetList;
+ // The following is working around the fact that LLSD arrays containing maps also seem to have undefined entries... see LLSD-30
+ for ( search_index = 0, targetList = mLists[0];
+ !listFound && search_index < mLists.size();
+ search_index += 1, targetList = mLists[search_index]
+ )
+ {
+ if ( targetList.isMap() )
+ {
+ if ( listNameMatches( targetList, listName) )
+ {
+ LL_DEBUGS("AutoReplace")<<"list to replace found at "<<search_index<<LL_ENDL;
+ mLists.erase(search_index);
+ mLists.insert(search_index, newList);
+ listFound = true;
+ result = AddListOk;
+ }
+ }
+ }
+
+ if ( ! listFound )
+ {
+ LL_WARNS("AutoReplace") << "attempt to replace unconfigured list" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "attempt to add invalid list" << LL_ENDL;
+ }
+ return result;
}
bool LLAutoReplaceSettings::removeReplacementList(std::string listName)
{
- bool found = false;
- for( S32 index = 0; !found && mLists[index].isDefined(); index++ )
- {
- if( listNameMatches(mLists.get(index), listName) )
- {
- LL_DEBUGS("AutoReplace")<<"list '"<<listName<<"'"<<LL_ENDL;
- mLists.erase(index);
- found = true;
- }
- }
- return found;
+ bool found = false;
+ for( S32 index = 0; !found && mLists[index].isDefined(); index++ )
+ {
+ if( listNameMatches(mLists.get(index), listName) )
+ {
+ LL_DEBUGS("AutoReplace")<<"list '"<<listName<<"'"<<LL_ENDL;
+ mLists.erase(index);
+ found = true;
+ }
+ }
+ return found;
}
/// Move the named list up in the priority order
bool LLAutoReplaceSettings::increaseListPriority(std::string listName)
{
- LL_DEBUGS("AutoReplace")<<listName<<LL_ENDL;
- bool found = false;
- S32 search_index, previous_index;
- LLSD targetList;
- // The following is working around the fact that LLSD arrays containing maps also seem to have undefined entries... see LLSD-30
- previous_index = -1;
- for ( search_index = 0, targetList = mLists[0];
- !found && search_index < mLists.size();
- search_index += 1, targetList = mLists[search_index]
- )
- {
- if ( targetList.isMap() )
- {
- if ( listNameMatches( targetList, listName) )
- {
- LL_DEBUGS("AutoReplace")<<"found at "<<search_index<<", previous is "<<previous_index<<LL_ENDL;
- found = true;
- if (previous_index >= 0)
- {
- LL_DEBUGS("AutoReplace") << "erase "<<search_index<<LL_ENDL;
- mLists.erase(search_index);
- LL_DEBUGS("AutoReplace") << "insert at "<<previous_index<<LL_ENDL;
- mLists.insert(previous_index, targetList);
- }
- else
- {
- LL_WARNS("AutoReplace") << "attempted to move top list up" << LL_ENDL;
- }
- }
- else
- {
- previous_index = search_index;
- }
- }
- else
- {
- LL_DEBUGS("AutoReplace") << search_index<<" is "<<LLSD::typeString(targetList.type())<<LL_ENDL;
- }
- }
- return found;
+ LL_DEBUGS("AutoReplace")<<listName<<LL_ENDL;
+ bool found = false;
+ S32 search_index, previous_index;
+ LLSD targetList;
+ // The following is working around the fact that LLSD arrays containing maps also seem to have undefined entries... see LLSD-30
+ previous_index = -1;
+ for ( search_index = 0, targetList = mLists[0];
+ !found && search_index < mLists.size();
+ search_index += 1, targetList = mLists[search_index]
+ )
+ {
+ if ( targetList.isMap() )
+ {
+ if ( listNameMatches( targetList, listName) )
+ {
+ LL_DEBUGS("AutoReplace")<<"found at "<<search_index<<", previous is "<<previous_index<<LL_ENDL;
+ found = true;
+ if (previous_index >= 0)
+ {
+ LL_DEBUGS("AutoReplace") << "erase "<<search_index<<LL_ENDL;
+ mLists.erase(search_index);
+ LL_DEBUGS("AutoReplace") << "insert at "<<previous_index<<LL_ENDL;
+ mLists.insert(previous_index, targetList);
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "attempted to move top list up" << LL_ENDL;
+ }
+ }
+ else
+ {
+ previous_index = search_index;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("AutoReplace") << search_index<<" is "<<LLSD::typeString(targetList.type())<<LL_ENDL;
+ }
+ }
+ return found;
}
/// Move the named list down in the priority order
bool LLAutoReplaceSettings::decreaseListPriority(std::string listName)
{
- LL_DEBUGS("AutoReplace")<<listName<<LL_ENDL;
- S32 found_index = -1;
- S32 search_index;
- for ( search_index = 0;
- found_index == -1 && search_index < mLists.size();
- search_index++
- )
- {
- if ( listNameMatches( mLists[search_index], listName) )
- {
- LL_DEBUGS("AutoReplace")<<"found at index "<<search_index<<LL_ENDL;
- found_index = search_index;
- }
- }
- if (found_index != -1)
- {
- S32 next_index;
- for ( next_index = found_index+1;
- next_index < mLists.size() && ! mLists[next_index].isMap();
- next_index++
- )
- {
- // skipping over any undefined slots (see LLSD-30)
- LL_WARNS("AutoReplace")<<next_index<<" ! not a map: "<<LLSD::typeString(mLists[next_index].type())<< LL_ENDL;
- }
- if ( next_index < mLists.size() )
- {
- LLSD next_list = mLists[next_index];
- LL_DEBUGS("AutoReplace") << "erase "<<next_index<<LL_ENDL;
- mLists.erase(next_index);
- LL_DEBUGS("AutoReplace") << "insert at "<<found_index<<LL_ENDL;
- mLists.insert(found_index, next_list);
- }
- else
- {
- LL_WARNS("AutoReplace") << "attempted to move bottom list down" << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("AutoReplace") << "not found" << LL_ENDL;
- }
- return (found_index != -1);
+ LL_DEBUGS("AutoReplace")<<listName<<LL_ENDL;
+ S32 found_index = -1;
+ S32 search_index;
+ for ( search_index = 0;
+ found_index == -1 && search_index < mLists.size();
+ search_index++
+ )
+ {
+ if ( listNameMatches( mLists[search_index], listName) )
+ {
+ LL_DEBUGS("AutoReplace")<<"found at index "<<search_index<<LL_ENDL;
+ found_index = search_index;
+ }
+ }
+ if (found_index != -1)
+ {
+ S32 next_index;
+ for ( next_index = found_index+1;
+ next_index < mLists.size() && ! mLists[next_index].isMap();
+ next_index++
+ )
+ {
+ // skipping over any undefined slots (see LLSD-30)
+ LL_WARNS("AutoReplace")<<next_index<<" ! not a map: "<<LLSD::typeString(mLists[next_index].type())<< LL_ENDL;
+ }
+ if ( next_index < mLists.size() )
+ {
+ LLSD next_list = mLists[next_index];
+ LL_DEBUGS("AutoReplace") << "erase "<<next_index<<LL_ENDL;
+ mLists.erase(next_index);
+ LL_DEBUGS("AutoReplace") << "insert at "<<found_index<<LL_ENDL;
+ mLists.insert(found_index, next_list);
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "attempted to move bottom list down" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "not found" << LL_ENDL;
+ }
+ return (found_index != -1);
}
std::string LLAutoReplaceSettings::replaceWord(const std::string currentWord)
{
- std::string returnedWord = currentWord; // in case no replacement is found
- static LLCachedControl<bool> autoreplace_enabled(gSavedSettings, "AutoReplace", false);
- if ( autoreplace_enabled )
- {
- LL_DEBUGS("AutoReplace")<<"checking '"<<currentWord<<"'"<< LL_ENDL;
- //loop through lists in order
- bool found = false;
- for( LLSD::array_const_iterator list = mLists.beginArray(), endLists = mLists.endArray();
- ! found && list != endLists;
- list++
- )
- {
- const LLSD& checkList = *list;
- const LLSD& replacements = checkList[AUTOREPLACE_LIST_REPLACEMENTS];
-
- if ( replacements.has(currentWord) )
- {
- found = true;
- LL_DEBUGS("AutoReplace")
- << " found in list '" << checkList[AUTOREPLACE_LIST_NAME].asString()
- << " => '" << replacements[currentWord].asString() << "'"
- << LL_ENDL;
- returnedWord = replacements[currentWord].asString();
- }
- }
- }
- return returnedWord;
+ std::string returnedWord = currentWord; // in case no replacement is found
+ static LLCachedControl<bool> autoreplace_enabled(gSavedSettings, "AutoReplace", false);
+ if ( autoreplace_enabled )
+ {
+ LL_DEBUGS("AutoReplace")<<"checking '"<<currentWord<<"'"<< LL_ENDL;
+ //loop through lists in order
+ bool found = false;
+ for( LLSD::array_const_iterator list = mLists.beginArray(), endLists = mLists.endArray();
+ ! found && list != endLists;
+ list++
+ )
+ {
+ const LLSD& checkList = *list;
+ const LLSD& replacements = checkList[AUTOREPLACE_LIST_REPLACEMENTS];
+
+ if ( replacements.has(currentWord) )
+ {
+ found = true;
+ LL_DEBUGS("AutoReplace")
+ << " found in list '" << checkList[AUTOREPLACE_LIST_NAME].asString()
+ << " => '" << replacements[currentWord].asString() << "'"
+ << LL_ENDL;
+ returnedWord = replacements[currentWord].asString();
+ }
+ }
+ }
+ return returnedWord;
}
bool LLAutoReplaceSettings::addEntryToList(LLWString keyword, LLWString replacement, std::string listName)
{
- bool added = false;
-
- if ( ! keyword.empty() && ! replacement.empty() )
- {
- bool isOneWord = true;
- for (S32 character = 0; isOneWord && character < keyword.size(); character++ )
- {
- if ( ! LLWStringUtil::isPartOfWord(keyword[character]) )
- {
- LL_WARNS("AutoReplace") << "keyword '" << wstring_to_utf8str(keyword) << "' not a single word (len "<<keyword.size()<<" '"<<character<<"')" << LL_ENDL;
- isOneWord = false;
- }
- }
-
- if ( isOneWord )
- {
- bool listFound = false;
- for( LLSD::array_iterator list = mLists.beginArray(), endLists = mLists.endArray();
- ! listFound && list != endLists;
- list++
- )
- {
- if ( listNameMatches(*list, listName) )
- {
- listFound = true;
- (*list)[AUTOREPLACE_LIST_REPLACEMENTS][wstring_to_utf8str(keyword)]=wstring_to_utf8str(replacement);
- }
- }
- if (listFound)
- {
- added = true;
- }
- else
- {
- LL_WARNS("AutoReplace") << "list '" << listName << "' not found" << LL_ENDL;
- }
- }
- }
-
- return added;
+ bool added = false;
+
+ if ( ! keyword.empty() && ! replacement.empty() )
+ {
+ bool isOneWord = true;
+ for (S32 character = 0; isOneWord && character < keyword.size(); character++ )
+ {
+ if ( ! LLWStringUtil::isPartOfWord(keyword[character]) )
+ {
+ LL_WARNS("AutoReplace") << "keyword '" << wstring_to_utf8str(keyword) << "' not a single word (len "<<keyword.size()<<" '"<<character<<"')" << LL_ENDL;
+ isOneWord = false;
+ }
+ }
+
+ if ( isOneWord )
+ {
+ bool listFound = false;
+ for( LLSD::array_iterator list = mLists.beginArray(), endLists = mLists.endArray();
+ ! listFound && list != endLists;
+ list++
+ )
+ {
+ if ( listNameMatches(*list, listName) )
+ {
+ listFound = true;
+ (*list)[AUTOREPLACE_LIST_REPLACEMENTS][wstring_to_utf8str(keyword)]=wstring_to_utf8str(replacement);
+ }
+ }
+ if (listFound)
+ {
+ added = true;
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "list '" << listName << "' not found" << LL_ENDL;
+ }
+ }
+ }
+
+ return added;
}
bool LLAutoReplaceSettings::removeEntryFromList(std::string keyword, std::string listName)
{
- bool found = false;
- for( LLSD::array_iterator list = mLists.beginArray(), endLists = mLists.endArray();
- ! found && list != endLists;
- list++
- )
- {
- if ( listNameMatches(*list, listName) )
- {
- found = true;
- (*list)[AUTOREPLACE_LIST_REPLACEMENTS].erase(keyword);
- }
- }
- if (!found)
- {
- LL_WARNS("AutoReplace") << "list '" << listName << "' not found" << LL_ENDL;
- }
- return found;
+ bool found = false;
+ for( LLSD::array_iterator list = mLists.beginArray(), endLists = mLists.endArray();
+ ! found && list != endLists;
+ list++
+ )
+ {
+ if ( listNameMatches(*list, listName) )
+ {
+ found = true;
+ (*list)[AUTOREPLACE_LIST_REPLACEMENTS].erase(keyword);
+ }
+ }
+ if (!found)
+ {
+ LL_WARNS("AutoReplace") << "list '" << listName << "' not found" << LL_ENDL;
+ }
+ return found;
}
LLSD LLAutoReplaceSettings::getExampleLLSD()
{
- LL_DEBUGS("AutoReplace")<<LL_ENDL;
- LLSD example = LLSD::emptyArray();
+ LL_DEBUGS("AutoReplace")<<LL_ENDL;
+ LLSD example = LLSD::emptyArray();
- example[0] = LLSD::emptyMap();
- example[0][AUTOREPLACE_LIST_NAME] = "Example List 1";
- example[0][AUTOREPLACE_LIST_REPLACEMENTS] = LLSD::emptyMap();
- example[0][AUTOREPLACE_LIST_REPLACEMENTS]["keyword1"] = "replacement string 1";
- example[0][AUTOREPLACE_LIST_REPLACEMENTS]["keyword2"] = "replacement string 2";
+ example[0] = LLSD::emptyMap();
+ example[0][AUTOREPLACE_LIST_NAME] = "Example List 1";
+ example[0][AUTOREPLACE_LIST_REPLACEMENTS] = LLSD::emptyMap();
+ example[0][AUTOREPLACE_LIST_REPLACEMENTS]["keyword1"] = "replacement string 1";
+ example[0][AUTOREPLACE_LIST_REPLACEMENTS]["keyword2"] = "replacement string 2";
- example[1] = LLSD::emptyMap();
- example[1][AUTOREPLACE_LIST_NAME] = "Example List 2";
- example[1][AUTOREPLACE_LIST_REPLACEMENTS] = LLSD::emptyMap();
- example[1][AUTOREPLACE_LIST_REPLACEMENTS]["mistake1"] = "correction 1";
- example[1][AUTOREPLACE_LIST_REPLACEMENTS]["mistake2"] = "correction 2";
+ example[1] = LLSD::emptyMap();
+ example[1][AUTOREPLACE_LIST_NAME] = "Example List 2";
+ example[1][AUTOREPLACE_LIST_REPLACEMENTS] = LLSD::emptyMap();
+ example[1][AUTOREPLACE_LIST_REPLACEMENTS]["mistake1"] = "correction 1";
+ example[1][AUTOREPLACE_LIST_REPLACEMENTS]["mistake2"] = "correction 2";
- return example;
+ return example;
}
const LLSD& LLAutoReplaceSettings::asLLSD()
{
- return mLists;
+ return mLists;
}
LLAutoReplaceSettings::~LLAutoReplaceSettings()
diff --git a/indra/newview/llautoreplace.h b/indra/newview/llautoreplace.h
index a1eebf9dcb..2d94132c52 100644
--- a/indra/newview/llautoreplace.h
+++ b/indra/newview/llautoreplace.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llautoreplace.h
* @brief Auto Replace Manager
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
@@ -9,12 +9,12 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -30,152 +30,152 @@ class LLAutoReplace;
*
* This is a separate class so that the LLFloaterAutoReplaceSettings
* can have a copy of the configuration to manipulate before committing
- * the changes back to the LLAutoReplace singleton that provides the
+ * the changes back to the LLAutoReplace singleton that provides the
* autoreplace callback.
*/
class LLAutoReplaceSettings
{
public:
- LLAutoReplaceSettings();
- ~LLAutoReplaceSettings();
-
- /// Constructor for creating a tempory copy of the current settings
- LLAutoReplaceSettings(const LLAutoReplaceSettings& settings);
-
- /// Replace the current settings with new ones and save them to the user settings file
- void set(const LLAutoReplaceSettings& newSettings);
-
- /// Load the current settings read from an LLSD file
- bool setFromLLSD(const LLSD& settingsFromLLSD);
- ///< @returns whether or not the settingsFromLLSD were valid
-
- // ================================================================
- ///@{ @name List Operations
- // ================================================================
-
- /// @returns the configured list names as an LLSD Array of strings
- LLSD getListNames();
-
- /// Status values returned from the addList method
- typedef enum
- {
- AddListOk,
- AddListDuplicateName,
- AddListInvalidList,
- } AddListResult;
-
- /// Inserts a new list at the end of the priority order
- AddListResult addList(const LLSD& newList);
-
- /// Inserts a list in place of an existing list of the same name
- AddListResult replaceList(const LLSD& newList);
-
- /// Removes the named list, @returns false if not found
- bool removeReplacementList(std::string listName);
-
- /// Move the named list up in the priority order
- bool increaseListPriority(std::string listName);
- ///< @returns false if the list is not found
-
- /// Move the named list down in the priority order
- bool decreaseListPriority(std::string listName);
- ///< @returns false if the list is not found
-
- /// Get a copy of just one list (for saving to an export file)
- const LLSD* exportList(std::string listName);
- /// @returns an LLSD map
-
- /// Checks for required elements, and that each has the correct type.
- bool listIsValid(const LLSD& listSettings);
-
- /// Checks for required elements, and that each has the correct type.
- bool listNameIs(const LLSD& listSettings);
-
- /// Checks to see if a new lists name conflicts with one in the settings
- bool listNameIsUnique(const LLSD& newList);
- /// @note must be called with LLSD that has passed listIsValid
-
- /// Initializes emptyList to an empty list named 'Empty'
- static void createEmptyList(LLSD& emptyList);
-
- /// Resets the name of a list to a new value
- static void setListName(LLSD& list, const std::string& newName);
-
- /// Gets the name of a list
- static std::string getListName(LLSD& list);
+ LLAutoReplaceSettings();
+ ~LLAutoReplaceSettings();
+
+ /// Constructor for creating a tempory copy of the current settings
+ LLAutoReplaceSettings(const LLAutoReplaceSettings& settings);
+
+ /// Replace the current settings with new ones and save them to the user settings file
+ void set(const LLAutoReplaceSettings& newSettings);
+
+ /// Load the current settings read from an LLSD file
+ bool setFromLLSD(const LLSD& settingsFromLLSD);
+ ///< @returns whether or not the settingsFromLLSD were valid
+
+ // ================================================================
+ ///@{ @name List Operations
+ // ================================================================
+
+ /// @returns the configured list names as an LLSD Array of strings
+ LLSD getListNames();
+
+ /// Status values returned from the addList method
+ typedef enum
+ {
+ AddListOk,
+ AddListDuplicateName,
+ AddListInvalidList,
+ } AddListResult;
+
+ /// Inserts a new list at the end of the priority order
+ AddListResult addList(const LLSD& newList);
+
+ /// Inserts a list in place of an existing list of the same name
+ AddListResult replaceList(const LLSD& newList);
+
+ /// Removes the named list, @returns false if not found
+ bool removeReplacementList(std::string listName);
+
+ /// Move the named list up in the priority order
+ bool increaseListPriority(std::string listName);
+ ///< @returns false if the list is not found
+
+ /// Move the named list down in the priority order
+ bool decreaseListPriority(std::string listName);
+ ///< @returns false if the list is not found
+
+ /// Get a copy of just one list (for saving to an export file)
+ const LLSD* exportList(std::string listName);
+ /// @returns an LLSD map
+
+ /// Checks for required elements, and that each has the correct type.
+ bool listIsValid(const LLSD& listSettings);
+
+ /// Checks for required elements, and that each has the correct type.
+ bool listNameIs(const LLSD& listSettings);
+
+ /// Checks to see if a new lists name conflicts with one in the settings
+ bool listNameIsUnique(const LLSD& newList);
+ /// @note must be called with LLSD that has passed listIsValid
+
+ /// Initializes emptyList to an empty list named 'Empty'
+ static void createEmptyList(LLSD& emptyList);
+
+ /// Resets the name of a list to a new value
+ static void setListName(LLSD& list, const std::string& newName);
+
+ /// Gets the name of a list
+ static std::string getListName(LLSD& list);
///@}
- // ================================================================
- ///@{ @name Replacement Entry Operations
- // ================================================================
-
- /// Get the replacements specified by a given list
- const LLSD* getListEntries(std::string listName);
- ///< @returns an LLSD Map of keyword -> replacement test pairs
-
- /// Get the replacement for the keyword from the specified list
- std::string replacementFor(std::string keyword, std::string listName);
-
- /// Adds a keywword/replacement pair to the named list
- bool addEntryToList(LLWString keyword, LLWString replacement, std::string listName);
-
- /// Removes the keywword and its replacement from the named list
- bool removeEntryFromList(std::string keyword, std::string listName);
-
- /**
- * Look for currentWord in the lists in order, returning any substitution found
- * If no configured substitution is found, returns currentWord
- */
- std::string replaceWord(const std::string currentWord /**< word to search for */ );
-
- /// Provides a hard-coded example of settings
- LLSD getExampleLLSD();
-
- /// Get the actual settings as LLSD
- const LLSD& asLLSD();
- ///< @note for use only in AutoReplace::saveToUserSettings
-
+ // ================================================================
+ ///@{ @name Replacement Entry Operations
+ // ================================================================
+
+ /// Get the replacements specified by a given list
+ const LLSD* getListEntries(std::string listName);
+ ///< @returns an LLSD Map of keyword -> replacement test pairs
+
+ /// Get the replacement for the keyword from the specified list
+ std::string replacementFor(std::string keyword, std::string listName);
+
+ /// Adds a keywword/replacement pair to the named list
+ bool addEntryToList(LLWString keyword, LLWString replacement, std::string listName);
+
+ /// Removes the keywword and its replacement from the named list
+ bool removeEntryFromList(std::string keyword, std::string listName);
+
+ /**
+ * Look for currentWord in the lists in order, returning any substitution found
+ * If no configured substitution is found, returns currentWord
+ */
+ std::string replaceWord(const std::string currentWord /**< word to search for */ );
+
+ /// Provides a hard-coded example of settings
+ LLSD getExampleLLSD();
+
+ /// Get the actual settings as LLSD
+ const LLSD& asLLSD();
+ ///< @note for use only in AutoReplace::saveToUserSettings
+
private:
- /// Efficiently and safely compare list names
- bool listNameMatches( const LLSD& list, const std::string name );
+ /// Efficiently and safely compare list names
+ bool listNameMatches( const LLSD& list, const std::string name );
+
+ /// The actual llsd data structure
+ LLSD mLists;
- /// The actual llsd data structure
- LLSD mLists;
+ static const std::string AUTOREPLACE_LIST_NAME; ///< key for looking up list names
+ static const std::string AUTOREPLACE_LIST_REPLACEMENTS; ///< key for looking up replacement map
- static const std::string AUTOREPLACE_LIST_NAME; ///< key for looking up list names
- static const std::string AUTOREPLACE_LIST_REPLACEMENTS; ///< key for looking up replacement map
-
/**<
- * LLSD structure of the lists
- * - The configuration is an array (mLists),
- * - Each entry in the array is a replacement list
- * - Each replacement list is a map with three keys:
- * @verbatim
- * "name" String the name of the list
- * "replacements" Map keyword -> replacement pairs
- *
- * <llsd>
- * <array>
- * <map>
- * <key>name</key> <string>List 1</string>
- * <key>data</key>
- * <map>
- * <key>keyword1</key> <string>replacement1</string>
- * <key>keyword2</key> <string>replacement2</string>
- * </map>
- * </map>
- * <map>
- * <key>name</key> <string>List 2</string>
- * <key>data</key>
- * <map>
- * <key>keyword1</key> <string>replacement1</string>
- * <key>keyword2</key> <string>replacement2</string>
- * </map>
- * </map>
- * </array>
- * </llsd>
- * @endverbatim
- */
+ * LLSD structure of the lists
+ * - The configuration is an array (mLists),
+ * - Each entry in the array is a replacement list
+ * - Each replacement list is a map with three keys:
+ * @verbatim
+ * "name" String the name of the list
+ * "replacements" Map keyword -> replacement pairs
+ *
+ * <llsd>
+ * <array>
+ * <map>
+ * <key>name</key> <string>List 1</string>
+ * <key>data</key>
+ * <map>
+ * <key>keyword1</key> <string>replacement1</string>
+ * <key>keyword2</key> <string>replacement2</string>
+ * </map>
+ * </map>
+ * <map>
+ * <key>name</key> <string>List 2</string>
+ * <key>data</key>
+ * <map>
+ * <key>keyword1</key> <string>replacement1</string>
+ * <key>keyword2</key> <string>replacement2</string>
+ * </map>
+ * </map>
+ * </array>
+ * </llsd>
+ * @endverbatim
+ */
};
/** Provides a facility to auto-replace text dynamically as it is entered.
@@ -206,7 +206,7 @@ private:
/*virtual*/ void initSingleton() override;
LLAutoReplaceSettings mSettings; ///< configuration information
-
+
/// Read settings from persistent storage
void loadFromSettings();
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 313339f131..f9c5f42de7 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavataractions.cpp
* @brief Friend-related actions (add, remove, offer teleport, etc)
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,20 +29,20 @@
#include "llavataractions.h"
-#include "boost/lambda/lambda.hpp" // for lambda::constant
+#include "boost/lambda/lambda.hpp" // for lambda::constant
-#include "llavatarnamecache.h" // IDEVO
+#include "llavatarnamecache.h" // IDEVO
#include "llsd.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "roles_constants.h" // for GP_MEMBER_INVITE
#include "llagent.h"
-#include "llappviewer.h" // for gLastVersionChannel
+#include "llappviewer.h" // for gLastVersionChannel
#include "llcachename.h"
-#include "llcallingcard.h" // for LLAvatarTracker
+#include "llcallingcard.h" // for LLAvatarTracker
#include "llconversationlog.h"
-#include "llfloateravatarpicker.h" // for LLFloaterAvatarPicker
+#include "llfloateravatarpicker.h" // for LLFloaterAvatarPicker
#include "llfloaterconversationpreview.h"
#include "llfloatergroupinvite.h"
#include "llfloatergroups.h"
@@ -55,12 +55,12 @@
#include "llfolderview.h"
#include "llgiveinventory.h"
#include "llinventorybridge.h"
-#include "llinventorymodel.h" // for gInventory.findCategoryUUIDForType
+#include "llinventorymodel.h" // for gInventory.findCategoryUUIDForType
#include "llinventorypanel.h"
#include "llfloaterimcontainer.h"
-#include "llimview.h" // for gIMMgr
+#include "llimview.h" // for gIMMgr
#include "llmutelist.h"
-#include "llnotificationsutil.h" // for LLNotificationsUtil
+#include "llnotificationsutil.h" // for LLNotificationsUtil
#include "llpaneloutfitedit.h"
#include "llpanelprofile.h"
#include "llparcel.h"
@@ -68,305 +68,305 @@
#include "lltrans.h"
#include "llviewercontrol.h"
#include "llviewerobjectlist.h"
-#include "llviewermessage.h" // for handle_lure
+#include "llviewermessage.h" // for handle_lure
#include "llviewernetwork.h" //LLGridManager
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "lltrans.h"
#include "llcallingcard.h"
-#include "llslurl.h" // IDEVO
+#include "llslurl.h" // IDEVO
#include "llsidepanelinventory.h"
#include "llavatarname.h"
#include "llagentui.h"
#include "lluiusage.h"
// Flags for kick message
-const U32 KICK_FLAGS_DEFAULT = 0x0;
-const U32 KICK_FLAGS_FREEZE = 1 << 0;
-const U32 KICK_FLAGS_UNFREEZE = 1 << 1;
+const U32 KICK_FLAGS_DEFAULT = 0x0;
+const U32 KICK_FLAGS_FREEZE = 1 << 0;
+const U32 KICK_FLAGS_UNFREEZE = 1 << 1;
std::string getProfileURL(const std::string& agent_name, bool feed_only)
{
std::string url = "[WEB_PROFILE_URL][AGENT_NAME][FEED_ONLY]";
- LLSD subs;
- subs["WEB_PROFILE_URL"] = LLGridManager::getInstance()->getWebProfileURL();
- subs["AGENT_NAME"] = agent_name;
+ LLSD subs;
+ subs["WEB_PROFILE_URL"] = LLGridManager::getInstance()->getWebProfileURL();
+ subs["AGENT_NAME"] = agent_name;
subs["FEED_ONLY"] = feed_only ? "/?feed_only=true" : "";
- url = LLWeb::expandURLSubstitutions(url, subs);
- LLStringUtil::toLower(url);
- return url;
+ url = LLWeb::expandURLSubstitutions(url, subs);
+ LLStringUtil::toLower(url);
+ return url;
}
// static
void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name)
{
- if(id == gAgentID)
- {
- LLNotificationsUtil::add("AddSelfFriend");
- return;
- }
+ if(id == gAgentID)
+ {
+ LLNotificationsUtil::add("AddSelfFriend");
+ return;
+ }
+
+ LLSD args;
+ args["NAME"] = LLSLURL("agent", id, "completename").getSLURLString();
+ LLSD payload;
+ payload["id"] = id;
+ payload["name"] = name;
- LLSD args;
- args["NAME"] = LLSLURL("agent", id, "completename").getSLURLString();
- LLSD payload;
- payload["id"] = id;
- payload["name"] = name;
-
- LLNotificationsUtil::add("AddFriendWithMessage", args, payload, &callbackAddFriendWithMessage);
+ LLNotificationsUtil::add("AddFriendWithMessage", args, payload, &callbackAddFriendWithMessage);
- // add friend to recent people list
- LLRecentPeople::instance().add(id);
+ // add friend to recent people list
+ LLRecentPeople::instance().add(id);
}
static void on_avatar_name_friendship(const LLUUID& id, const LLAvatarName av_name)
{
- LLAvatarActions::requestFriendshipDialog(id, av_name.getCompleteName());
+ LLAvatarActions::requestFriendshipDialog(id, av_name.getCompleteName());
}
// static
void LLAvatarActions::requestFriendshipDialog(const LLUUID& id)
{
- if(id.isNull())
- {
- return;
- }
+ if(id.isNull())
+ {
+ return;
+ }
- LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_friendship, _1, _2));
+ LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_friendship, _1, _2));
}
// static
void LLAvatarActions::removeFriendDialog(const LLUUID& id)
{
- if (id.isNull())
- return;
+ if (id.isNull())
+ return;
- uuid_vec_t ids;
- ids.push_back(id);
- removeFriendsDialog(ids);
+ uuid_vec_t ids;
+ ids.push_back(id);
+ removeFriendsDialog(ids);
}
// static
void LLAvatarActions::removeFriendsDialog(const uuid_vec_t& ids)
{
- if(ids.size() == 0)
- return;
-
- LLSD args;
- std::string msgType;
- if(ids.size() == 1)
- {
- LLUUID agent_id = ids[0];
- LLAvatarName av_name;
- if(LLAvatarNameCache::get(agent_id, &av_name))
- {
- args["NAME"] = av_name.getCompleteName();
- }
-
- msgType = "RemoveFromFriends";
- }
- else
- {
- msgType = "RemoveMultipleFromFriends";
- }
-
- LLSD payload;
- for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- payload["ids"].append(*it);
- }
-
- LLNotificationsUtil::add(msgType,
- args,
- payload,
- &handleRemove);
+ if(ids.size() == 0)
+ return;
+
+ LLSD args;
+ std::string msgType;
+ if(ids.size() == 1)
+ {
+ LLUUID agent_id = ids[0];
+ LLAvatarName av_name;
+ if(LLAvatarNameCache::get(agent_id, &av_name))
+ {
+ args["NAME"] = av_name.getCompleteName();
+ }
+
+ msgType = "RemoveFromFriends";
+ }
+ else
+ {
+ msgType = "RemoveMultipleFromFriends";
+ }
+
+ LLSD payload;
+ for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ payload["ids"].append(*it);
+ }
+
+ LLNotificationsUtil::add(msgType,
+ args,
+ payload,
+ &handleRemove);
}
// static
void LLAvatarActions::offerTeleport(const LLUUID& invitee)
{
- if (invitee.isNull())
- return;
+ if (invitee.isNull())
+ return;
- std::vector<LLUUID> ids;
- ids.push_back(invitee);
- offerTeleport(ids);
+ std::vector<LLUUID> ids;
+ ids.push_back(invitee);
+ offerTeleport(ids);
}
// static
-void LLAvatarActions::offerTeleport(const uuid_vec_t& ids)
+void LLAvatarActions::offerTeleport(const uuid_vec_t& ids)
{
- if (ids.size() == 0)
- return;
+ if (ids.size() == 0)
+ return;
- handle_lure(ids);
+ handle_lure(ids);
}
static void on_avatar_name_cache_start_im(const LLUUID& agent_id,
- const LLAvatarName& av_name)
+ const LLAvatarName& av_name)
{
- std::string name = av_name.getDisplayName();
- LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id);
- if (session_id != LLUUID::null)
- {
- LLFloaterIMContainer::getInstance()->showConversation(session_id);
- }
- make_ui_sound("UISndStartIM");
+ std::string name = av_name.getDisplayName();
+ LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id);
+ if (session_id != LLUUID::null)
+ {
+ LLFloaterIMContainer::getInstance()->showConversation(session_id);
+ }
+ make_ui_sound("UISndStartIM");
}
// static
void LLAvatarActions::startIM(const LLUUID& id)
{
- if (id.isNull() || gAgent.getID() == id)
- return;
+ if (id.isNull() || gAgent.getID() == id)
+ return;
- LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_cache_start_im, _1, _2));
+ LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_cache_start_im, _1, _2));
}
// static
void LLAvatarActions::endIM(const LLUUID& id)
{
- if (id.isNull())
- return;
-
- LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id);
- if (session_id != LLUUID::null)
- {
- gIMMgr->leaveSession(session_id);
- }
+ if (id.isNull())
+ return;
+
+ LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id);
+ if (session_id != LLUUID::null)
+ {
+ gIMMgr->leaveSession(session_id);
+ }
}
static void on_avatar_name_cache_start_call(const LLUUID& agent_id,
- const LLAvatarName& av_name)
+ const LLAvatarName& av_name)
{
- std::string name = av_name.getDisplayName();
- LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id, true);
- if (session_id != LLUUID::null)
- {
- gIMMgr->startCall(session_id);
- }
- make_ui_sound("UISndStartIM");
+ std::string name = av_name.getDisplayName();
+ LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id, true);
+ if (session_id != LLUUID::null)
+ {
+ gIMMgr->startCall(session_id);
+ }
+ make_ui_sound("UISndStartIM");
}
// static
void LLAvatarActions::startCall(const LLUUID& id)
{
- if (id.isNull())
- {
- return;
- }
- LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_cache_start_call, _1, _2));
+ if (id.isNull())
+ {
+ return;
+ }
+ LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_cache_start_call, _1, _2));
}
// static
void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids, const LLUUID& floater_id)
{
- if (ids.size() == 0)
- {
- return;
- }
+ if (ids.size() == 0)
+ {
+ return;
+ }
- // convert vector into std::vector for addSession
- std::vector<LLUUID> id_array;
- id_array.reserve(ids.size());
- for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- id_array.push_back(*it);
- }
+ // convert vector into std::vector for addSession
+ std::vector<LLUUID> id_array;
+ id_array.reserve(ids.size());
+ for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ id_array.push_back(*it);
+ }
- // create the new ad hoc voice session
- const std::string title = LLTrans::getString("conference-title");
- LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START,
- ids[0], id_array, true, floater_id);
- if (session_id == LLUUID::null)
- {
- return;
- }
+ // create the new ad hoc voice session
+ const std::string title = LLTrans::getString("conference-title");
+ LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START,
+ ids[0], id_array, true, floater_id);
+ if (session_id == LLUUID::null)
+ {
+ return;
+ }
- gIMMgr->autoStartCallOnStartup(session_id);
+ gIMMgr->autoStartCallOnStartup(session_id);
- make_ui_sound("UISndStartIM");
+ make_ui_sound("UISndStartIM");
}
/* AD *TODO: Is this function needed any more?
- I fixed it a bit(added check for canCall), but it appears that it is not used
- anywhere. Maybe it should be removed?
+ I fixed it a bit(added check for canCall), but it appears that it is not used
+ anywhere. Maybe it should be removed?
// static
bool LLAvatarActions::isCalling(const LLUUID &id)
{
- if (id.isNull() || !canCall())
- {
- return false;
- }
+ if (id.isNull() || !canCall())
+ {
+ return false;
+ }
- LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id);
- return (LLIMModel::getInstance()->findIMSession(session_id) != NULL);
+ LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id);
+ return (LLIMModel::getInstance()->findIMSession(session_id) != NULL);
}*/
//static
bool LLAvatarActions::canCall()
{
- return LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+ return LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
}
// static
void LLAvatarActions::startConference(const uuid_vec_t& ids, const LLUUID& floater_id)
{
- // *HACK: Copy into dynamic array
- std::vector<LLUUID> id_array;
+ // *HACK: Copy into dynamic array
+ std::vector<LLUUID> id_array;
- id_array.reserve(ids.size());
- for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- id_array.push_back(*it);
- }
- const std::string title = LLTrans::getString("conference-title");
- LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], id_array, false, floater_id);
+ id_array.reserve(ids.size());
+ for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ id_array.push_back(*it);
+ }
+ const std::string title = LLTrans::getString("conference-title");
+ LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], id_array, false, floater_id);
- if (session_id == LLUUID::null)
- {
- return;
- }
-
- LLFloaterIMContainer::getInstance()->showConversation(session_id);
-
- make_ui_sound("UISndStartIM");
+ if (session_id == LLUUID::null)
+ {
+ return;
+ }
+
+ LLFloaterIMContainer::getInstance()->showConversation(session_id);
+
+ make_ui_sound("UISndStartIM");
}
// static
void LLAvatarActions::showProfile(const LLUUID& avatar_id)
{
- if (avatar_id.notNull())
- {
- LLFloaterReg::showInstance("profile", LLSD().with("id", avatar_id));
- }
+ if (avatar_id.notNull())
+ {
+ LLFloaterReg::showInstance("profile", LLSD().with("id", avatar_id));
+ }
}
// static
void LLAvatarActions::showPicks(const LLUUID& avatar_id)
{
- if (avatar_id.notNull())
- {
+ if (avatar_id.notNull())
+ {
LLFloaterProfile* profilefloater = dynamic_cast<LLFloaterProfile*>(LLFloaterReg::showInstance("profile", LLSD().with("id", avatar_id)));
if (profilefloater)
{
profilefloater->showPick();
}
- }
+ }
}
// static
void LLAvatarActions::showPick(const LLUUID& avatar_id, const LLUUID& pick_id)
{
- if (avatar_id.notNull())
- {
+ if (avatar_id.notNull())
+ {
LLFloaterProfile* profilefloater = dynamic_cast<LLFloaterProfile*>(LLFloaterReg::showInstance("profile", LLSD().with("id", avatar_id)));
if (profilefloater)
{
profilefloater->showPick(pick_id);
}
- }
+ }
}
// static
@@ -414,27 +414,27 @@ bool LLAvatarActions::isPickTabSelected(const LLUUID& avatar_id)
// static
void LLAvatarActions::showClassifieds(const LLUUID& avatar_id)
{
- if (avatar_id.notNull())
- {
+ if (avatar_id.notNull())
+ {
LLFloaterProfile* profilefloater = dynamic_cast<LLFloaterProfile*>(LLFloaterReg::showInstance("profile", LLSD().with("id", avatar_id)));
if (profilefloater)
{
profilefloater->showClassified();
}
- }
+ }
}
// static
void LLAvatarActions::showClassified(const LLUUID& avatar_id, const LLUUID& classified_id, bool edit)
{
- if (avatar_id.notNull())
- {
+ if (avatar_id.notNull())
+ {
LLFloaterProfile* profilefloater = dynamic_cast<LLFloaterProfile*>(LLFloaterReg::showInstance("profile", LLSD().with("id", avatar_id)));
if (profilefloater)
{
profilefloater->showClassified(classified_id, edit);
}
- }
+ }
}
// static
@@ -447,13 +447,13 @@ void LLAvatarActions::createClassified()
}
}
-//static
+//static
bool LLAvatarActions::profileVisible(const LLUUID& avatar_id)
{
- LLSD sd;
- sd["id"] = avatar_id;
- LLFloater* floater = getProfileFloater(avatar_id);
- return floater && floater->isShown();
+ LLSD sd;
+ sd["id"] = avatar_id;
+ LLFloater* floater = getProfileFloater(avatar_id);
+ return floater && floater->isShown();
}
//static
@@ -463,273 +463,273 @@ LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& avatar_id)
return floater;
}
-//static
+//static
void LLAvatarActions::hideProfile(const LLUUID& avatar_id)
{
- LLSD sd;
- sd["id"] = avatar_id;
- LLFloater* floater = getProfileFloater(avatar_id);
- if (floater)
- {
- floater->closeFloater();
- }
+ LLSD sd;
+ sd["id"] = avatar_id;
+ LLFloater* floater = getProfileFloater(avatar_id);
+ if (floater)
+ {
+ floater->closeFloater();
+ }
}
// static
void LLAvatarActions::showOnMap(const LLUUID& id)
{
- LLAvatarName av_name;
- if (!LLAvatarNameCache::get(id, &av_name))
- {
- LLAvatarNameCache::get(id, boost::bind(&LLAvatarActions::showOnMap, id));
- return;
- }
+ LLAvatarName av_name;
+ if (!LLAvatarNameCache::get(id, &av_name))
+ {
+ LLAvatarNameCache::get(id, boost::bind(&LLAvatarActions::showOnMap, id));
+ return;
+ }
- gFloaterWorldMap->trackAvatar(id, av_name.getDisplayName());
- LLFloaterReg::showInstance("world_map", "center");
+ gFloaterWorldMap->trackAvatar(id, av_name.getDisplayName());
+ LLFloaterReg::showInstance("world_map", "center");
}
// static
void LLAvatarActions::pay(const LLUUID& id)
{
- LLNotification::Params params("DoNotDisturbModePay");
- params.functor.function(boost::bind(&LLAvatarActions::handlePay, _1, _2, id));
+ LLNotification::Params params("DoNotDisturbModePay");
+ params.functor.function(boost::bind(&LLAvatarActions::handlePay, _1, _2, id));
- if (gAgent.isDoNotDisturb())
- {
- // warn users of being in do not disturb mode during a transaction
- LLNotifications::instance().add(params);
- }
- else
- {
- LLNotifications::instance().forceResponse(params, 1);
- }
+ if (gAgent.isDoNotDisturb())
+ {
+ // warn users of being in do not disturb mode during a transaction
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(params, 1);
+ }
}
void LLAvatarActions::teleport_request_callback(const LLSD& notification, const LLSD& response)
{
- S32 option;
- if (response.isInteger())
- {
- option = response.asInteger();
- }
- else
- {
- option = LLNotificationsUtil::getSelectedOption(notification, response);
- }
-
- if (0 == option)
- {
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-
- msg->nextBlockFast(_PREHASH_MessageBlock);
- msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
- msg->addUUIDFast(_PREHASH_ToAgentID, notification["substitutions"]["uuid"] );
- msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
- msg->addU8Fast(_PREHASH_Dialog, IM_TELEPORT_REQUEST);
- msg->addUUIDFast(_PREHASH_ID, LLUUID::null);
- msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
-
- std::string name;
- LLAgentUI::buildFullname(name);
-
- msg->addStringFast(_PREHASH_FromAgentName, name);
- msg->addStringFast(_PREHASH_Message, response["message"]);
- msg->addU32Fast(_PREHASH_ParentEstateID, 0);
- msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
- msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
-
- gMessageSystem->addBinaryDataFast(
- _PREHASH_BinaryBucket,
- EMPTY_BINARY_BUCKET,
- EMPTY_BINARY_BUCKET_SIZE);
-
- gAgent.sendReliableMessage();
- }
+ S32 option;
+ if (response.isInteger())
+ {
+ option = response.asInteger();
+ }
+ else
+ {
+ option = LLNotificationsUtil::getSelectedOption(notification, response);
+ }
+
+ if (0 == option)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+
+ msg->nextBlockFast(_PREHASH_MessageBlock);
+ msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
+ msg->addUUIDFast(_PREHASH_ToAgentID, notification["substitutions"]["uuid"] );
+ msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
+ msg->addU8Fast(_PREHASH_Dialog, IM_TELEPORT_REQUEST);
+ msg->addUUIDFast(_PREHASH_ID, LLUUID::null);
+ msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
+
+ std::string name;
+ LLAgentUI::buildFullname(name);
+
+ msg->addStringFast(_PREHASH_FromAgentName, name);
+ msg->addStringFast(_PREHASH_Message, response["message"]);
+ msg->addU32Fast(_PREHASH_ParentEstateID, 0);
+ msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
+ msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
+
+ gMessageSystem->addBinaryDataFast(
+ _PREHASH_BinaryBucket,
+ EMPTY_BINARY_BUCKET,
+ EMPTY_BINARY_BUCKET_SIZE);
+
+ gAgent.sendReliableMessage();
+ }
}
// static
void LLAvatarActions::teleportRequest(const LLUUID& id)
{
- LLSD notification;
- notification["uuid"] = id;
- LLAvatarName av_name;
- if (!LLAvatarNameCache::get(id, &av_name))
- {
- // unlikely ... they just picked this name from somewhere...
- LLAvatarNameCache::get(id, boost::bind(&LLAvatarActions::teleportRequest, id));
- return; // reinvoke this when the name resolves
- }
- notification["NAME"] = av_name.getCompleteName();
+ LLSD notification;
+ notification["uuid"] = id;
+ LLAvatarName av_name;
+ if (!LLAvatarNameCache::get(id, &av_name))
+ {
+ // unlikely ... they just picked this name from somewhere...
+ LLAvatarNameCache::get(id, boost::bind(&LLAvatarActions::teleportRequest, id));
+ return; // reinvoke this when the name resolves
+ }
+ notification["NAME"] = av_name.getCompleteName();
- LLSD payload;
+ LLSD payload;
- LLNotificationsUtil::add("TeleportRequestPrompt", notification, payload, teleport_request_callback);
+ LLNotificationsUtil::add("TeleportRequestPrompt", notification, payload, teleport_request_callback);
}
// static
void LLAvatarActions::kick(const LLUUID& id)
{
- LLSD payload;
- payload["avatar_id"] = id;
- LLNotifications::instance().add("KickUser", LLSD(), payload, handleKick);
+ LLSD payload;
+ payload["avatar_id"] = id;
+ LLNotifications::instance().add("KickUser", LLSD(), payload, handleKick);
}
// static
void LLAvatarActions::freezeAvatar(const LLUUID& id)
{
- LLAvatarName av_name;
- LLSD payload;
- payload["avatar_id"] = id;
+ LLAvatarName av_name;
+ LLSD payload;
+ payload["avatar_id"] = id;
- if (LLAvatarNameCache::get(id, &av_name))
- {
- LLSD args;
- args["AVATAR_NAME"] = av_name.getUserName();
- LLNotificationsUtil::add("FreezeAvatarFullname", args, payload, handleFreezeAvatar);
- }
- else
- {
- LLNotificationsUtil::add("FreezeAvatar", LLSD(), payload, handleFreezeAvatar);
- }
+ if (LLAvatarNameCache::get(id, &av_name))
+ {
+ LLSD args;
+ args["AVATAR_NAME"] = av_name.getUserName();
+ LLNotificationsUtil::add("FreezeAvatarFullname", args, payload, handleFreezeAvatar);
+ }
+ else
+ {
+ LLNotificationsUtil::add("FreezeAvatar", LLSD(), payload, handleFreezeAvatar);
+ }
}
// static
void LLAvatarActions::ejectAvatar(const LLUUID& id, bool ban_enabled)
{
- LLAvatarName av_name;
- LLSD payload;
- payload["avatar_id"] = id;
- payload["ban_enabled"] = ban_enabled;
- LLSD args;
- bool has_name = LLAvatarNameCache::get(id, &av_name);
- if (has_name)
- {
- args["AVATAR_NAME"] = av_name.getUserName();
- }
-
- if (ban_enabled)
- {
- LLNotificationsUtil::add("EjectAvatarFullname", args, payload, handleEjectAvatar);
- }
- else
- {
- if (has_name)
- {
- LLNotificationsUtil::add("EjectAvatarFullnameNoBan", args, payload, handleEjectAvatar);
- }
- else
- {
- LLNotificationsUtil::add("EjectAvatarNoBan", LLSD(), payload, handleEjectAvatar);
- }
- }
+ LLAvatarName av_name;
+ LLSD payload;
+ payload["avatar_id"] = id;
+ payload["ban_enabled"] = ban_enabled;
+ LLSD args;
+ bool has_name = LLAvatarNameCache::get(id, &av_name);
+ if (has_name)
+ {
+ args["AVATAR_NAME"] = av_name.getUserName();
+ }
+
+ if (ban_enabled)
+ {
+ LLNotificationsUtil::add("EjectAvatarFullname", args, payload, handleEjectAvatar);
+ }
+ else
+ {
+ if (has_name)
+ {
+ LLNotificationsUtil::add("EjectAvatarFullnameNoBan", args, payload, handleEjectAvatar);
+ }
+ else
+ {
+ LLNotificationsUtil::add("EjectAvatarNoBan", LLSD(), payload, handleEjectAvatar);
+ }
+ }
}
// static
void LLAvatarActions::freeze(const LLUUID& id)
{
- LLSD payload;
- payload["avatar_id"] = id;
- LLNotifications::instance().add("FreezeUser", LLSD(), payload, handleFreeze);
+ LLSD payload;
+ payload["avatar_id"] = id;
+ LLNotifications::instance().add("FreezeUser", LLSD(), payload, handleFreeze);
}
// static
void LLAvatarActions::unfreeze(const LLUUID& id)
{
- LLSD payload;
- payload["avatar_id"] = id;
- LLNotifications::instance().add("UnFreezeUser", LLSD(), payload, handleUnfreeze);
+ LLSD payload;
+ payload["avatar_id"] = id;
+ LLNotifications::instance().add("UnFreezeUser", LLSD(), payload, handleUnfreeze);
}
-//static
+//static
void LLAvatarActions::csr(const LLUUID& id, std::string name)
{
- if (name.empty()) return;
-
- std::string url = "http://csr.lindenlab.com/agent/";
-
- // slow and stupid, but it's late
- S32 len = name.length();
- for (S32 i = 0; i < len; i++)
- {
- if (name[i] == ' ')
- {
- url += "%20";
- }
- else
- {
- url += name[i];
- }
- }
-
- LLWeb::loadURL(url);
-}
-
-//static
+ if (name.empty()) return;
+
+ std::string url = "http://csr.lindenlab.com/agent/";
+
+ // slow and stupid, but it's late
+ S32 len = name.length();
+ for (S32 i = 0; i < len; i++)
+ {
+ if (name[i] == ' ')
+ {
+ url += "%20";
+ }
+ else
+ {
+ url += name[i];
+ }
+ }
+
+ LLWeb::loadURL(url);
+}
+
+//static
void LLAvatarActions::share(const LLUUID& id)
{
- LLSD key;
- LLFloaterSidePanelContainer::showPanel("inventory", key);
- LLFloaterReg::showInstance("im_container");
+ LLSD key;
+ LLFloaterSidePanelContainer::showPanel("inventory", key);
+ LLFloaterReg::showInstance("im_container");
- LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL,id);
+ LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL,id);
- if (!gIMMgr->hasSession(session_id))
- {
- startIM(id);
- }
+ if (!gIMMgr->hasSession(session_id))
+ {
+ startIM(id);
+ }
- if (gIMMgr->hasSession(session_id))
- {
- // we should always get here, but check to verify anyways
- LLIMModel::getInstance()->addMessage(session_id, SYSTEM_FROM, LLUUID::null, LLTrans::getString("share_alert"), false);
+ if (gIMMgr->hasSession(session_id))
+ {
+ // we should always get here, but check to verify anyways
+ LLIMModel::getInstance()->addMessage(session_id, SYSTEM_FROM, LLUUID::null, LLTrans::getString("share_alert"), false);
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id);
- if (session_floater && session_floater->isMinimized())
- {
- session_floater->setMinimized(false);
- }
- LLFloaterIMContainer *im_container = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- im_container->selectConversationPair(session_id, true);
- }
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id);
+ if (session_floater && session_floater->isMinimized())
+ {
+ session_floater->setMinimized(false);
+ }
+ LLFloaterIMContainer *im_container = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ im_container->selectConversationPair(session_id, true);
+ }
}
namespace action_give_inventory
{
- /**
- * Returns a pointer to 'Add More' inventory panel of Edit Outfit SP.
- */
- static LLInventoryPanel* get_outfit_editor_inventory_panel()
- {
- LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit"));
- if (NULL == panel_outfit_edit) return NULL;
-
- LLInventoryPanel* inventory_panel = panel_outfit_edit->findChild<LLInventoryPanel>("folder_view");
- return inventory_panel;
- }
-
- /**
- * @return active inventory panel, or NULL if there's no such panel
- */
- static LLInventoryPanel* get_active_inventory_panel()
- {
- LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
- LLFloater* floater_appearance = LLFloaterReg::findInstance("appearance");
- if (!active_panel || (floater_appearance && floater_appearance->hasFocus()))
- {
- active_panel = get_outfit_editor_inventory_panel();
- }
-
- return active_panel;
- }
-
- /**
- * Checks My Inventory visibility.
- */
+ /**
+ * Returns a pointer to 'Add More' inventory panel of Edit Outfit SP.
+ */
+ static LLInventoryPanel* get_outfit_editor_inventory_panel()
+ {
+ LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit"));
+ if (NULL == panel_outfit_edit) return NULL;
+
+ LLInventoryPanel* inventory_panel = panel_outfit_edit->findChild<LLInventoryPanel>("folder_view");
+ return inventory_panel;
+ }
+
+ /**
+ * @return active inventory panel, or NULL if there's no such panel
+ */
+ static LLInventoryPanel* get_active_inventory_panel()
+ {
+ LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+ LLFloater* floater_appearance = LLFloaterReg::findInstance("appearance");
+ if (!active_panel || (floater_appearance && floater_appearance->hasFocus()))
+ {
+ active_panel = get_outfit_editor_inventory_panel();
+ }
+
+ return active_panel;
+ }
+
+ /**
+ * Checks My Inventory visibility.
+ */
static bool is_give_inventory_acceptable_ids(const std::set<LLUUID> inventory_selected_uuids)
{
if (inventory_selected_uuids.empty()) return false; // nothing selected
@@ -762,11 +762,11 @@ namespace action_give_inventory
return acceptable;
}
- static bool is_give_inventory_acceptable(LLInventoryPanel* panel = NULL)
- {
- // check selection in the panel
+ static bool is_give_inventory_acceptable(LLInventoryPanel* panel = NULL)
+ {
+ // check selection in the panel
std::set<LLUUID> inventory_selected_uuids = LLAvatarActions::getInventorySelectedUUIDs(panel);
- if (inventory_selected_uuids.empty())
+ if (inventory_selected_uuids.empty())
{
if(panel && panel->getRootFolder() && panel->getRootFolder()->isSingleFolderMode())
{
@@ -779,133 +779,133 @@ namespace action_give_inventory
}
return is_give_inventory_acceptable_ids(inventory_selected_uuids);
- }
-
- static void build_items_string(const std::set<LLUUID>& inventory_selected_uuids , std::string& items_string)
- {
- llassert(inventory_selected_uuids.size() > 0);
-
- const std::string& separator = LLTrans::getString("words_separator");
- for (std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin(); ; )
- {
- LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
- if (NULL != inv_cat)
- {
- items_string = inv_cat->getName();
- break;
- }
- LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
- if (NULL != inv_item)
- {
- items_string.append(inv_item->getName());
- }
- if(++it == inventory_selected_uuids.end())
- {
- break;
- }
- items_string.append(separator);
- }
- }
-
- struct LLShareInfo : public LLSingleton<LLShareInfo>
- {
- LLSINGLETON_EMPTY_CTOR(LLShareInfo);
- public:
- std::vector<LLAvatarName> mAvatarNames;
- uuid_vec_t mAvatarUuids;
- };
-
- static void give_inventory_cb(const LLSD& notification, const LLSD& response, std::set<LLUUID> inventory_selected_uuids)
- {
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- // if Cancel pressed
- if (option == 1)
- {
- return;
- }
-
- if (inventory_selected_uuids.empty())
- {
- return;
- }
-
- S32 count = LLShareInfo::instance().mAvatarNames.size();
- bool shared = count && !inventory_selected_uuids.empty();
-
- // iterate through avatars
- for(S32 i = 0; i < count; ++i)
- {
- const LLUUID& avatar_uuid = LLShareInfo::instance().mAvatarUuids[i];
-
- // We souldn't open IM session, just calculate session ID for logging purpose. See EXT-6710
- const LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, avatar_uuid);
-
- std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin();
- const std::set<LLUUID>::const_iterator it_end = inventory_selected_uuids.end();
-
- const std::string& separator = LLTrans::getString("words_separator");
- std::string noncopy_item_names;
- LLSD noncopy_items = LLSD::emptyArray();
- // iterate through selected inventory objects
- for (; it != it_end; ++it)
- {
- LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
- if (inv_cat)
- {
- if (!LLGiveInventory::doGiveInventoryCategory(avatar_uuid, inv_cat, session_id, "ItemsShared"))
- {
- shared = false;
- }
- break;
- }
- LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
- if (!inv_item->getPermissions().allowCopyBy(gAgentID))
- {
- if (!noncopy_item_names.empty())
- {
- noncopy_item_names.append(separator);
- }
- noncopy_item_names.append(inv_item->getName());
- noncopy_items.append(*it);
- }
- else
- {
- if (!LLGiveInventory::doGiveInventoryItem(avatar_uuid, inv_item, session_id))
- {
- shared = false;
- }
- }
- }
- if (noncopy_items.beginArray() != noncopy_items.endArray())
- {
- LLSD substitutions;
- substitutions["ITEMS"] = noncopy_item_names;
- LLSD payload;
- payload["agent_id"] = avatar_uuid;
- payload["items"] = noncopy_items;
- payload["success_notification"] = "ItemsShared";
- LLNotificationsUtil::add("CannotCopyWarning", substitutions, payload,
- &LLGiveInventory::handleCopyProtectedItem);
- shared = false;
- break;
- }
- }
- if (shared)
- {
- LLFloaterReg::hideInstance("avatar_picker");
- LLNotificationsUtil::add("ItemsShared");
- }
- }
-
- /**
- * Performs "give inventory" operations for provided avatars.
- *
- * Sends one requests to give all selected inventory items for each passed avatar.
- * Avatars are represent by two vectors: names and UUIDs which must be sychronized with each other.
- *
- * @param avatar_names - avatar names request to be sent.
- * @param avatar_uuids - avatar names request to be sent.
- */
+ }
+
+ static void build_items_string(const std::set<LLUUID>& inventory_selected_uuids , std::string& items_string)
+ {
+ llassert(inventory_selected_uuids.size() > 0);
+
+ const std::string& separator = LLTrans::getString("words_separator");
+ for (std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin(); ; )
+ {
+ LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
+ if (NULL != inv_cat)
+ {
+ items_string = inv_cat->getName();
+ break;
+ }
+ LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
+ if (NULL != inv_item)
+ {
+ items_string.append(inv_item->getName());
+ }
+ if(++it == inventory_selected_uuids.end())
+ {
+ break;
+ }
+ items_string.append(separator);
+ }
+ }
+
+ struct LLShareInfo : public LLSingleton<LLShareInfo>
+ {
+ LLSINGLETON_EMPTY_CTOR(LLShareInfo);
+ public:
+ std::vector<LLAvatarName> mAvatarNames;
+ uuid_vec_t mAvatarUuids;
+ };
+
+ static void give_inventory_cb(const LLSD& notification, const LLSD& response, std::set<LLUUID> inventory_selected_uuids)
+ {
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ // if Cancel pressed
+ if (option == 1)
+ {
+ return;
+ }
+
+ if (inventory_selected_uuids.empty())
+ {
+ return;
+ }
+
+ S32 count = LLShareInfo::instance().mAvatarNames.size();
+ bool shared = count && !inventory_selected_uuids.empty();
+
+ // iterate through avatars
+ for(S32 i = 0; i < count; ++i)
+ {
+ const LLUUID& avatar_uuid = LLShareInfo::instance().mAvatarUuids[i];
+
+ // We souldn't open IM session, just calculate session ID for logging purpose. See EXT-6710
+ const LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, avatar_uuid);
+
+ std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin();
+ const std::set<LLUUID>::const_iterator it_end = inventory_selected_uuids.end();
+
+ const std::string& separator = LLTrans::getString("words_separator");
+ std::string noncopy_item_names;
+ LLSD noncopy_items = LLSD::emptyArray();
+ // iterate through selected inventory objects
+ for (; it != it_end; ++it)
+ {
+ LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
+ if (inv_cat)
+ {
+ if (!LLGiveInventory::doGiveInventoryCategory(avatar_uuid, inv_cat, session_id, "ItemsShared"))
+ {
+ shared = false;
+ }
+ break;
+ }
+ LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
+ if (!inv_item->getPermissions().allowCopyBy(gAgentID))
+ {
+ if (!noncopy_item_names.empty())
+ {
+ noncopy_item_names.append(separator);
+ }
+ noncopy_item_names.append(inv_item->getName());
+ noncopy_items.append(*it);
+ }
+ else
+ {
+ if (!LLGiveInventory::doGiveInventoryItem(avatar_uuid, inv_item, session_id))
+ {
+ shared = false;
+ }
+ }
+ }
+ if (noncopy_items.beginArray() != noncopy_items.endArray())
+ {
+ LLSD substitutions;
+ substitutions["ITEMS"] = noncopy_item_names;
+ LLSD payload;
+ payload["agent_id"] = avatar_uuid;
+ payload["items"] = noncopy_items;
+ payload["success_notification"] = "ItemsShared";
+ LLNotificationsUtil::add("CannotCopyWarning", substitutions, payload,
+ &LLGiveInventory::handleCopyProtectedItem);
+ shared = false;
+ break;
+ }
+ }
+ if (shared)
+ {
+ LLFloaterReg::hideInstance("avatar_picker");
+ LLNotificationsUtil::add("ItemsShared");
+ }
+ }
+
+ /**
+ * Performs "give inventory" operations for provided avatars.
+ *
+ * Sends one requests to give all selected inventory items for each passed avatar.
+ * Avatars are represent by two vectors: names and UUIDs which must be sychronized with each other.
+ *
+ * @param avatar_names - avatar names request to be sent.
+ * @param avatar_uuids - avatar names request to be sent.
+ */
static void give_inventory_ids(const uuid_vec_t& avatar_uuids, const std::vector<LLAvatarName> avatar_names, const uuid_set_t inventory_selected_uuids)
{
@@ -970,106 +970,106 @@ namespace action_give_inventory
// static
void LLAvatarActions::buildResidentsString(std::vector<LLAvatarName> avatar_names, std::string& residents_string, bool complete_name)
{
- llassert(avatar_names.size() > 0);
-
- std::sort(avatar_names.begin(), avatar_names.end());
- const std::string& separator = LLTrans::getString("words_separator");
- for (std::vector<LLAvatarName>::const_iterator it = avatar_names.begin(); ; )
- {
- if(complete_name)
- {
- residents_string.append((*it).getCompleteName());
- }
- else
- {
- residents_string.append((*it).getDisplayName());
- }
-
- if (++it == avatar_names.end())
- {
- break;
- }
- residents_string.append(separator);
- }
+ llassert(avatar_names.size() > 0);
+
+ std::sort(avatar_names.begin(), avatar_names.end());
+ const std::string& separator = LLTrans::getString("words_separator");
+ for (std::vector<LLAvatarName>::const_iterator it = avatar_names.begin(); ; )
+ {
+ if(complete_name)
+ {
+ residents_string.append((*it).getCompleteName());
+ }
+ else
+ {
+ residents_string.append((*it).getDisplayName());
+ }
+
+ if (++it == avatar_names.end())
+ {
+ break;
+ }
+ residents_string.append(separator);
+ }
}
// static
void LLAvatarActions::buildResidentsString(const uuid_vec_t& avatar_uuids, std::string& residents_string)
{
- std::vector<LLAvatarName> avatar_names;
- uuid_vec_t::const_iterator it = avatar_uuids.begin();
- for (; it != avatar_uuids.end(); ++it)
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(*it, &av_name))
- {
- avatar_names.push_back(av_name);
- }
- }
-
- // We should check whether the vector is not empty to pass the assertion
- // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString.
- if (!avatar_names.empty())
- {
- LLAvatarActions::buildResidentsString(avatar_names, residents_string);
- }
+ std::vector<LLAvatarName> avatar_names;
+ uuid_vec_t::const_iterator it = avatar_uuids.begin();
+ for (; it != avatar_uuids.end(); ++it)
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(*it, &av_name))
+ {
+ avatar_names.push_back(av_name);
+ }
+ }
+
+ // We should check whether the vector is not empty to pass the assertion
+ // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString.
+ if (!avatar_names.empty())
+ {
+ LLAvatarActions::buildResidentsString(avatar_names, residents_string);
+ }
}
//static
std::set<LLUUID> LLAvatarActions::getInventorySelectedUUIDs(LLInventoryPanel* active_panel)
{
- std::set<LLFolderViewItem*> inventory_selected;
-
- if (!active_panel)
- {
- active_panel = action_give_inventory::get_active_inventory_panel();
- }
- if (active_panel)
- {
- inventory_selected= active_panel->getRootFolder()->getSelectionList();
- }
-
- if (inventory_selected.empty())
- {
- LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
- if (sidepanel_inventory)
- {
- inventory_selected= sidepanel_inventory->getInboxSelectionList();
- }
- }
-
- std::set<LLUUID> inventory_selected_uuids;
- for (std::set<LLFolderViewItem*>::iterator it = inventory_selected.begin(), end_it = inventory_selected.end();
- it != end_it;
- ++it)
- {
- inventory_selected_uuids.insert(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
- }
- return inventory_selected_uuids;
+ std::set<LLFolderViewItem*> inventory_selected;
+
+ if (!active_panel)
+ {
+ active_panel = action_give_inventory::get_active_inventory_panel();
+ }
+ if (active_panel)
+ {
+ inventory_selected= active_panel->getRootFolder()->getSelectionList();
+ }
+
+ if (inventory_selected.empty())
+ {
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ if (sidepanel_inventory)
+ {
+ inventory_selected= sidepanel_inventory->getInboxSelectionList();
+ }
+ }
+
+ std::set<LLUUID> inventory_selected_uuids;
+ for (std::set<LLFolderViewItem*>::iterator it = inventory_selected.begin(), end_it = inventory_selected.end();
+ it != end_it;
+ ++it)
+ {
+ inventory_selected_uuids.insert(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
+ }
+ return inventory_selected_uuids;
}
//static
void LLAvatarActions::shareWithAvatars(LLView * panel)
{
- using namespace action_give_inventory;
+ using namespace action_give_inventory;
- LLFloater* root_floater = gFloaterView->getParentFloater(panel);
- LLInventoryPanel* inv_panel = dynamic_cast<LLInventoryPanel*>(panel);
- LLFloaterAvatarPicker* picker =
- LLFloaterAvatarPicker::show(boost::bind(give_inventory, _1, _2, inv_panel), TRUE, FALSE, FALSE, root_floater->getName());
- if (!picker)
- {
- return;
- }
+ LLFloater* root_floater = gFloaterView->getParentFloater(panel);
+ LLInventoryPanel* inv_panel = dynamic_cast<LLInventoryPanel*>(panel);
+ LLFloaterAvatarPicker* picker =
+ LLFloaterAvatarPicker::show(boost::bind(give_inventory, _1, _2, inv_panel), TRUE, FALSE, FALSE, root_floater->getName());
+ if (!picker)
+ {
+ return;
+ }
+
+ picker->setOkBtnEnableCb(boost::bind(is_give_inventory_acceptable, inv_panel));
+ picker->openFriendsTab();
- picker->setOkBtnEnableCb(boost::bind(is_give_inventory_acceptable, inv_panel));
- picker->openFriendsTab();
-
if (root_floater)
{
root_floater->addDependentFloater(picker);
}
- LLNotificationsUtil::add("ShareNotification");
+ LLNotificationsUtil::add("ShareNotification");
}
//static
@@ -1086,7 +1086,7 @@ void LLAvatarActions::shareWithAvatars(const uuid_set_t inventory_selected_uuids
picker->setOkBtnEnableCb(boost::bind(is_give_inventory_acceptable_ids, inventory_selected_uuids));
picker->openFriendsTab();
-
+
if (root_floater)
{
root_floater->addDependentFloater(picker);
@@ -1097,177 +1097,177 @@ void LLAvatarActions::shareWithAvatars(const uuid_set_t inventory_selected_uuids
// static
bool LLAvatarActions::canShareSelectedItems(LLInventoryPanel* inv_panel /* = NULL*/)
{
- using namespace action_give_inventory;
+ using namespace action_give_inventory;
- if (!inv_panel)
- {
- LLInventoryPanel* active_panel = get_active_inventory_panel();
- if (!active_panel) return false;
- inv_panel = active_panel;
- }
+ if (!inv_panel)
+ {
+ LLInventoryPanel* active_panel = get_active_inventory_panel();
+ if (!active_panel) return false;
+ inv_panel = active_panel;
+ }
- // check selection in the panel
- LLFolderView* root_folder = inv_panel->getRootFolder();
+ // check selection in the panel
+ LLFolderView* root_folder = inv_panel->getRootFolder();
if (!root_folder)
{
return false;
}
- const std::set<LLFolderViewItem*> inventory_selected = root_folder->getSelectionList();
- if (inventory_selected.empty()) return false; // nothing selected
-
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- bool can_share = true;
- std::set<LLFolderViewItem*>::const_iterator it = inventory_selected.begin();
- const std::set<LLFolderViewItem*>::const_iterator it_end = inventory_selected.end();
- for (; it != it_end; ++it)
- {
- LLUUID cat_id = static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID();
- LLViewerInventoryCategory* inv_cat = gInventory.getCategory(cat_id);
- // any category can be offered if it's not in trash.
- if (inv_cat)
- {
- if ((cat_id == trash_id) || gInventory.isObjectDescendentOf(cat_id, trash_id))
- {
- can_share = false;
- break;
- }
- continue;
- }
-
- // check if inventory item can be given
- LLFolderViewItem* item = *it;
- if (!item) return false;
- LLInvFVBridge* bridge = dynamic_cast<LLInvFVBridge*>(item->getViewModelItem());
- if (bridge && bridge->canShare())
- {
- continue;
- }
-
- // there are neither item nor category in inventory
- can_share = false;
- break;
- }
-
- return can_share;
+ const std::set<LLFolderViewItem*> inventory_selected = root_folder->getSelectionList();
+ if (inventory_selected.empty()) return false; // nothing selected
+
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ bool can_share = true;
+ std::set<LLFolderViewItem*>::const_iterator it = inventory_selected.begin();
+ const std::set<LLFolderViewItem*>::const_iterator it_end = inventory_selected.end();
+ for (; it != it_end; ++it)
+ {
+ LLUUID cat_id = static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID();
+ LLViewerInventoryCategory* inv_cat = gInventory.getCategory(cat_id);
+ // any category can be offered if it's not in trash.
+ if (inv_cat)
+ {
+ if ((cat_id == trash_id) || gInventory.isObjectDescendentOf(cat_id, trash_id))
+ {
+ can_share = false;
+ break;
+ }
+ continue;
+ }
+
+ // check if inventory item can be given
+ LLFolderViewItem* item = *it;
+ if (!item) return false;
+ LLInvFVBridge* bridge = dynamic_cast<LLInvFVBridge*>(item->getViewModelItem());
+ if (bridge && bridge->canShare())
+ {
+ continue;
+ }
+
+ // there are neither item nor category in inventory
+ can_share = false;
+ break;
+ }
+
+ return can_share;
}
// static
bool LLAvatarActions::toggleBlock(const LLUUID& id)
{
- LLAvatarName av_name;
- LLAvatarNameCache::get(id, &av_name);
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(id, &av_name);
- LLMute mute(id, av_name.getUserName(), LLMute::AGENT);
+ LLMute mute(id, av_name.getUserName(), LLMute::AGENT);
- if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName))
- {
- LLMuteList::getInstance()->remove(mute);
- return false;
- }
- else
- {
- LLMuteList::getInstance()->add(mute);
- return true;
- }
+ if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName))
+ {
+ LLMuteList::getInstance()->remove(mute);
+ return false;
+ }
+ else
+ {
+ LLMuteList::getInstance()->add(mute);
+ return true;
+ }
}
// static
void LLAvatarActions::toggleMute(const LLUUID& id, U32 flags)
{
- LLAvatarName av_name;
- LLAvatarNameCache::get(id, &av_name);
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(id, &av_name);
- LLMuteList* mute_list = LLMuteList::getInstance();
- bool is_muted = mute_list->isMuted(id, flags);
+ LLMuteList* mute_list = LLMuteList::getInstance();
+ bool is_muted = mute_list->isMuted(id, flags);
- LLMute mute(id, av_name.getUserName(), LLMute::AGENT);
- if (!is_muted)
- {
- mute_list->add(mute, flags);
- }
- else
- {
- mute_list->remove(mute, flags);
- }
+ LLMute mute(id, av_name.getUserName(), LLMute::AGENT);
+ if (!is_muted)
+ {
+ mute_list->add(mute, flags);
+ }
+ else
+ {
+ mute_list->remove(mute, flags);
+ }
}
// static
void LLAvatarActions::toggleMuteVoice(const LLUUID& id)
{
- toggleMute(id, LLMute::flagVoiceChat);
+ toggleMute(id, LLMute::flagVoiceChat);
}
// static
bool LLAvatarActions::canOfferTeleport(const LLUUID& id)
{
- // First use LLAvatarTracker::isBuddy()
- // If LLAvatarTracker::instance().isBuddyOnline function only is used
- // then for avatars that are online and not a friend it will return false.
- // But we should give an ability to offer a teleport for such avatars.
- if(LLAvatarTracker::instance().isBuddy(id))
- {
- return LLAvatarTracker::instance().isBuddyOnline(id);
- }
+ // First use LLAvatarTracker::isBuddy()
+ // If LLAvatarTracker::instance().isBuddyOnline function only is used
+ // then for avatars that are online and not a friend it will return false.
+ // But we should give an ability to offer a teleport for such avatars.
+ if(LLAvatarTracker::instance().isBuddy(id))
+ {
+ return LLAvatarTracker::instance().isBuddyOnline(id);
+ }
- return true;
+ return true;
}
// static
bool LLAvatarActions::canOfferTeleport(const uuid_vec_t& ids)
{
- // We can't send more than 250 lures in a single message, so disable this
- // button when there are too many id's selected.
- if(ids.size() > 250) return false;
-
- bool result = true;
- for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- if(!canOfferTeleport(*it))
- {
- result = false;
- break;
- }
- }
- return result;
+ // We can't send more than 250 lures in a single message, so disable this
+ // button when there are too many id's selected.
+ if(ids.size() > 250) return false;
+
+ bool result = true;
+ for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ if(!canOfferTeleport(*it))
+ {
+ result = false;
+ break;
+ }
+ }
+ return result;
}
void LLAvatarActions::inviteToGroup(const LLUUID& id)
{
- LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(id));
- if (widget)
- {
- widget->center();
- widget->setPowersMask(GP_MEMBER_INVITE);
- widget->removeNoneOption();
- widget->setSelectGroupCallback(boost::bind(callback_invite_to_group, _1, id));
- }
+ LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(id));
+ if (widget)
+ {
+ widget->center();
+ widget->setPowersMask(GP_MEMBER_INVITE);
+ widget->removeNoneOption();
+ widget->setSelectGroupCallback(boost::bind(callback_invite_to_group, _1, id));
+ }
}
// static
void LLAvatarActions::viewChatHistory(const LLUUID& id)
{
- const std::vector<LLConversation>& conversations = LLConversationLog::instance().getConversations();
- std::vector<LLConversation>::const_iterator iter = conversations.begin();
+ const std::vector<LLConversation>& conversations = LLConversationLog::instance().getConversations();
+ std::vector<LLConversation>::const_iterator iter = conversations.begin();
- for (; iter != conversations.end(); ++iter)
- {
- if (iter->getParticipantID() == id)
- {
- LLFloaterReg::showInstance("preview_conversation", iter->getSessionID(), true);
- return;
- }
- }
+ for (; iter != conversations.end(); ++iter)
+ {
+ if (iter->getParticipantID() == id)
+ {
+ LLFloaterReg::showInstance("preview_conversation", iter->getSessionID(), true);
+ return;
+ }
+ }
- if (LLLogChat::isTranscriptExist(id))
- {
- LLAvatarName avatar_name;
- LLSD extended_id(id);
+ if (LLLogChat::isTranscriptExist(id))
+ {
+ LLAvatarName avatar_name;
+ LLSD extended_id(id);
- LLAvatarNameCache::get(id, &avatar_name);
- extended_id[LL_FCP_COMPLETE_NAME] = avatar_name.getCompleteName();
- extended_id[LL_FCP_ACCOUNT_NAME] = avatar_name.getAccountName();
- LLFloaterReg::showInstance("preview_conversation", extended_id, true);
- }
+ LLAvatarNameCache::get(id, &avatar_name);
+ extended_id[LL_FCP_COMPLETE_NAME] = avatar_name.getCompleteName();
+ extended_id[LL_FCP_ACCOUNT_NAME] = avatar_name.getAccountName();
+ LLFloaterReg::showInstance("preview_conversation", extended_id, true);
+ }
}
//== private methods ========================================================================================
@@ -1275,252 +1275,252 @@ void LLAvatarActions::viewChatHistory(const LLUUID& id)
// static
bool LLAvatarActions::handleRemove(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- const LLSD& ids = notification["payload"]["ids"];
- for (LLSD::array_const_iterator itr = ids.beginArray(); itr != ids.endArray(); ++itr)
- {
- LLUUID id = itr->asUUID();
- const LLRelationship* ip = LLAvatarTracker::instance().getBuddyInfo(id);
- if (ip)
- {
- switch (option)
- {
- case 0: // YES
- if( ip->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS))
- {
- LLAvatarTracker::instance().empower(id, FALSE);
- LLAvatarTracker::instance().notifyObservers();
- }
- LLAvatarTracker::instance().terminateBuddy(id);
- LLAvatarTracker::instance().notifyObservers();
- break;
-
- case 1: // NO
- default:
- LL_INFOS() << "No removal performed." << LL_ENDL;
- break;
- }
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ const LLSD& ids = notification["payload"]["ids"];
+ for (LLSD::array_const_iterator itr = ids.beginArray(); itr != ids.endArray(); ++itr)
+ {
+ LLUUID id = itr->asUUID();
+ const LLRelationship* ip = LLAvatarTracker::instance().getBuddyInfo(id);
+ if (ip)
+ {
+ switch (option)
+ {
+ case 0: // YES
+ if( ip->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS))
+ {
+ LLAvatarTracker::instance().empower(id, FALSE);
+ LLAvatarTracker::instance().notifyObservers();
+ }
+ LLAvatarTracker::instance().terminateBuddy(id);
+ LLAvatarTracker::instance().notifyObservers();
+ break;
+
+ case 1: // NO
+ default:
+ LL_INFOS() << "No removal performed." << LL_ENDL;
+ break;
+ }
+ }
+ }
+ return false;
}
// static
bool LLAvatarActions::handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- gAgent.setDoNotDisturb(false);
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ gAgent.setDoNotDisturb(false);
+ }
- LLFloaterPayUtil::payDirectly(&give_money, avatar_id, /*is_group=*/false);
- return false;
+ LLFloaterPayUtil::payDirectly(&give_money, avatar_id, /*is_group=*/false);
+ return false;
}
// static
void LLAvatarActions::callback_invite_to_group(LLUUID group_id, LLUUID id)
{
- uuid_vec_t agent_ids;
- agent_ids.push_back(id);
-
- LLFloaterGroupInvite::showForGroup(group_id, &agent_ids);
+ uuid_vec_t agent_ids;
+ agent_ids.push_back(id);
+
+ LLFloaterGroupInvite::showForGroup(group_id, &agent_ids);
}
// static
bool LLAvatarActions::callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- requestFriendship(notification["payload"]["id"].asUUID(),
- notification["payload"]["name"].asString(),
- response["message"].asString());
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ requestFriendship(notification["payload"]["id"].asUUID(),
+ notification["payload"]["name"].asString(),
+ response["message"].asString());
+ }
+ return false;
}
// static
bool LLAvatarActions::handleKick(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
-
- if (option == 0)
- {
- LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
- LLMessageSystem* msg = gMessageSystem;
+ S32 option = LLNotification::getSelectedOption(notification, response);
- msg->newMessageFast(_PREHASH_GodKickUser);
- msg->nextBlockFast(_PREHASH_UserInfo);
- msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_AgentID, avatar_id );
- msg->addU32("KickFlags", KICK_FLAGS_DEFAULT );
- msg->addStringFast(_PREHASH_Reason, response["message"].asString() );
- gAgent.sendReliableMessage();
- }
- return false;
+ if (option == 0)
+ {
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_GodKickUser);
+ msg->nextBlockFast(_PREHASH_UserInfo);
+ msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_AgentID, avatar_id );
+ msg->addU32("KickFlags", KICK_FLAGS_DEFAULT );
+ msg->addStringFast(_PREHASH_Reason, response["message"].asString() );
+ gAgent.sendReliableMessage();
+ }
+ return false;
}
bool LLAvatarActions::handleFreezeAvatar(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
-
- if (0 == option || 1 == option)
- {
- U32 flags = 0x0;
- if (1 == option)
- {
- // unfreeze
- flags |= 0x1;
- }
- LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessage("FreezeUser");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addUUID("TargetID", avatar_id );
- msg->addU32("Flags", flags );
- gAgent.sendReliableMessage();
- }
- return false;
+ S32 option = LLNotification::getSelectedOption(notification, response);
+
+ if (0 == option || 1 == option)
+ {
+ U32 flags = 0x0;
+ if (1 == option)
+ {
+ // unfreeze
+ flags |= 0x1;
+ }
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessage("FreezeUser");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addUUID("TargetID", avatar_id );
+ msg->addU32("Flags", flags );
+ gAgent.sendReliableMessage();
+ }
+ return false;
}
bool LLAvatarActions::handleEjectAvatar(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (2 == option)
- {
- return false;
- }
- LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
- bool ban_enabled = notification["payload"]["ban_enabled"].asBoolean();
-
- if (0 == option)
- {
- LLMessageSystem* msg = gMessageSystem;
- U32 flags = 0x0;
- msg->newMessage("EjectUser");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID() );
- msg->nextBlock("Data");
- msg->addUUID("TargetID", avatar_id );
- msg->addU32("Flags", flags );
- gAgent.sendReliableMessage();
- }
- else if (ban_enabled)
- {
- LLMessageSystem* msg = gMessageSystem;
-
- U32 flags = 0x1;
- msg->newMessage("EjectUser");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID() );
- msg->nextBlock("Data");
- msg->addUUID("TargetID", avatar_id );
- msg->addU32("Flags", flags );
- gAgent.sendReliableMessage();
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (2 == option)
+ {
+ return false;
+ }
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ bool ban_enabled = notification["payload"]["ban_enabled"].asBoolean();
+
+ if (0 == option)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ U32 flags = 0x0;
+ msg->newMessage("EjectUser");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID() );
+ msg->nextBlock("Data");
+ msg->addUUID("TargetID", avatar_id );
+ msg->addU32("Flags", flags );
+ gAgent.sendReliableMessage();
+ }
+ else if (ban_enabled)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+
+ U32 flags = 0x1;
+ msg->newMessage("EjectUser");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID() );
+ msg->nextBlock("Data");
+ msg->addUUID("TargetID", avatar_id );
+ msg->addU32("Flags", flags );
+ gAgent.sendReliableMessage();
+ }
+ return false;
}
bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
- if (option == 0)
- {
- LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessageFast(_PREHASH_GodKickUser);
- msg->nextBlockFast(_PREHASH_UserInfo);
- msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_AgentID, avatar_id );
- msg->addU32("KickFlags", KICK_FLAGS_FREEZE );
- msg->addStringFast(_PREHASH_Reason, response["message"].asString() );
- gAgent.sendReliableMessage();
- }
- return false;
+ S32 option = LLNotification::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_GodKickUser);
+ msg->nextBlockFast(_PREHASH_UserInfo);
+ msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_AgentID, avatar_id );
+ msg->addU32("KickFlags", KICK_FLAGS_FREEZE );
+ msg->addStringFast(_PREHASH_Reason, response["message"].asString() );
+ gAgent.sendReliableMessage();
+ }
+ return false;
}
bool LLAvatarActions::handleUnfreeze(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
- std::string text = response["message"].asString();
- if (option == 0)
- {
- LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessageFast(_PREHASH_GodKickUser);
- msg->nextBlockFast(_PREHASH_UserInfo);
- msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_AgentID, avatar_id );
- msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE );
- msg->addStringFast(_PREHASH_Reason, text );
- gAgent.sendReliableMessage();
- }
- return false;
+ S32 option = LLNotification::getSelectedOption(notification, response);
+ std::string text = response["message"].asString();
+ if (option == 0)
+ {
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_GodKickUser);
+ msg->nextBlockFast(_PREHASH_UserInfo);
+ msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_AgentID, avatar_id );
+ msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE );
+ msg->addStringFast(_PREHASH_Reason, text );
+ gAgent.sendReliableMessage();
+ }
+ return false;
}
// static
void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message)
{
- const LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
- LLUIUsage::instance().logCommand("Agent.SendFriendRequest");
+ const LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
+ LLUIUsage::instance().logCommand("Agent.SendFriendRequest");
- send_improved_im(target_id,
- target_name,
- message,
- IM_ONLINE,
- IM_FRIENDSHIP_OFFERED,
- calling_card_folder_id);
+ send_improved_im(target_id,
+ target_name,
+ message,
+ IM_ONLINE,
+ IM_FRIENDSHIP_OFFERED,
+ calling_card_folder_id);
- LLSD args;
- args["TO_NAME"] = target_name;
+ LLSD args;
+ args["TO_NAME"] = target_name;
- LLSD payload;
- payload["from_id"] = target_id;
- LLNotificationsUtil::add("FriendshipOffered", args, payload);
+ LLSD payload;
+ payload["from_id"] = target_id;
+ LLNotificationsUtil::add("FriendshipOffered", args, payload);
}
//static
bool LLAvatarActions::isFriend(const LLUUID& id)
{
- return ( NULL != LLAvatarTracker::instance().getBuddyInfo(id) );
+ return ( NULL != LLAvatarTracker::instance().getBuddyInfo(id) );
}
// static
bool LLAvatarActions::isBlocked(const LLUUID& id)
{
- LLAvatarName av_name;
- LLAvatarNameCache::get(id, &av_name);
- return LLMuteList::getInstance()->isMuted(id, av_name.getUserName());
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(id, &av_name);
+ return LLMuteList::getInstance()->isMuted(id, av_name.getUserName());
}
// static
bool LLAvatarActions::isVoiceMuted(const LLUUID& id)
{
- return LLMuteList::getInstance()->isMuted(id, LLMute::flagVoiceChat);
+ return LLMuteList::getInstance()->isMuted(id, LLMute::flagVoiceChat);
}
// static
bool LLAvatarActions::canBlock(const LLUUID& id)
{
- LLAvatarName av_name;
- LLAvatarNameCache::get(id, &av_name);
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(id, &av_name);
- std::string full_name = av_name.getUserName();
- bool is_linden = (full_name.find("Linden") != std::string::npos);
- bool is_self = id == gAgentID;
- return !is_self && !is_linden;
+ std::string full_name = av_name.getUserName();
+ bool is_linden = (full_name.find("Linden") != std::string::npos);
+ bool is_self = id == gAgentID;
+ return !is_self && !is_linden;
}
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index 8a0f40dd52..1f5a42ed22 100644
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavataractions.h
* @brief Friend-related actions (add, remove, offer teleport, etc)
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,52 +46,52 @@ std::string getProfileURL(const std::string& agent_name, bool feed_only = false)
class LLAvatarActions
{
public:
- /**
- * Show a dialog explaining what friendship entails, then request friendship.
- */
- static void requestFriendshipDialog(const LLUUID& id, const std::string& name);
-
- /**
- * Show a dialog explaining what friendship entails, then request friendship.
- */
- static void requestFriendshipDialog(const LLUUID& id);
-
- /**
- * Show a friend removal dialog.
- */
- static void removeFriendDialog(const LLUUID& id);
- static void removeFriendsDialog(const uuid_vec_t& ids);
-
- /**
- * Show teleport offer dialog.
- */
- static void offerTeleport(const LLUUID& invitee);
- static void offerTeleport(const uuid_vec_t& ids);
-
- /**
- * Start instant messaging session.
- */
- static void startIM(const LLUUID& id);
-
- /**
- * End instant messaging session.
- */
- static void endIM(const LLUUID& id);
-
- /**
- * Start an avatar-to-avatar voice call with another user
- */
- static void startCall(const LLUUID& id);
-
- /**
- * Start an ad-hoc conference voice call with multiple users in a specific IM floater.
- */
- static void startAdhocCall(const uuid_vec_t& ids, const LLUUID& floater_id = LLUUID::null);
-
- /**
- * Start conference chat with the given avatars in a specific IM floater.
- */
- static void startConference(const uuid_vec_t& ids, const LLUUID& floater_id = LLUUID::null);
+ /**
+ * Show a dialog explaining what friendship entails, then request friendship.
+ */
+ static void requestFriendshipDialog(const LLUUID& id, const std::string& name);
+
+ /**
+ * Show a dialog explaining what friendship entails, then request friendship.
+ */
+ static void requestFriendshipDialog(const LLUUID& id);
+
+ /**
+ * Show a friend removal dialog.
+ */
+ static void removeFriendDialog(const LLUUID& id);
+ static void removeFriendsDialog(const uuid_vec_t& ids);
+
+ /**
+ * Show teleport offer dialog.
+ */
+ static void offerTeleport(const LLUUID& invitee);
+ static void offerTeleport(const uuid_vec_t& ids);
+
+ /**
+ * Start instant messaging session.
+ */
+ static void startIM(const LLUUID& id);
+
+ /**
+ * End instant messaging session.
+ */
+ static void endIM(const LLUUID& id);
+
+ /**
+ * Start an avatar-to-avatar voice call with another user
+ */
+ static void startCall(const LLUUID& id);
+
+ /**
+ * Start an ad-hoc conference voice call with multiple users in a specific IM floater.
+ */
+ static void startAdhocCall(const uuid_vec_t& ids, const LLUUID& floater_id = LLUUID::null);
+
+ /**
+ * Start conference chat with the given avatars in a specific IM floater.
+ */
+ static void startConference(const uuid_vec_t& ids, const LLUUID& floater_id = LLUUID::null);
/**
* Show avatar profile.
@@ -108,168 +108,168 @@ public:
static bool isPickTabSelected(const LLUUID& avatar_id);
static LLFloater* getProfileFloater(const LLUUID& avatar_id);
- /**
- * Show avatar on world map.
- */
- static void showOnMap(const LLUUID& id);
-
- /**
- * Give money to the avatar.
- */
- static void pay(const LLUUID& id);
-
- /**
- * Request teleport from other avatar
- */
- static void teleportRequest(const LLUUID& id);
- static void teleport_request_callback(const LLSD& notification, const LLSD& response);
-
- /**
- * Share items with the avatar.
- */
- static void share(const LLUUID& id);
-
- /**
- * Share items with the picked avatars.
- */
- static void shareWithAvatars(LLView * panel);
+ /**
+ * Show avatar on world map.
+ */
+ static void showOnMap(const LLUUID& id);
+
+ /**
+ * Give money to the avatar.
+ */
+ static void pay(const LLUUID& id);
+
+ /**
+ * Request teleport from other avatar
+ */
+ static void teleportRequest(const LLUUID& id);
+ static void teleport_request_callback(const LLSD& notification, const LLSD& response);
+
+ /**
+ * Share items with the avatar.
+ */
+ static void share(const LLUUID& id);
+
+ /**
+ * Share items with the picked avatars.
+ */
+ static void shareWithAvatars(LLView * panel);
static void shareWithAvatars(const uuid_set_t inventory_selected_uuids, LLFloater* root_floater);
- /**
- * Block/unblock the avatar by id.
- * Returns true if blocked, returns false if unblocked
- */
- static bool toggleBlock(const LLUUID& id);
-
- /**
- * Mute/unmute avatar.
- */
- static void toggleMute(const LLUUID& id, U32 flags);
-
- /**
- * Block/unblock the avatar voice.
- */
- static void toggleMuteVoice(const LLUUID& id);
-
- /**
- * Return true if avatar with "id" is a friend
- */
- static bool isFriend(const LLUUID& id);
-
- /**
- * @return true if the avatar is blocked
- */
- static bool isBlocked(const LLUUID& id);
-
- /**
- * @return true if the avatar voice is blocked
- */
- static bool isVoiceMuted(const LLUUID& id);
-
- /**
- * @return true if you can block the avatar
- */
- static bool canBlock(const LLUUID& id);
-
- /**
- * Return true if the avatar is in a P2P voice call with a given user
- */
- /* AD *TODO: Is this function needed any more?
- I fixed it a bit(added check for canCall), but it appears that it is not used
- anywhere. Maybe it should be removed?
- static bool isCalling(const LLUUID &id);*/
-
- /**
- * @return true if call to the resident can be made
- */
-
- static bool canCall();
- /**
- * Invite avatar to a group.
- */
- static void inviteToGroup(const LLUUID& id);
-
- static void freezeAvatar(const LLUUID& id);
-
- static void ejectAvatar(const LLUUID& id, bool ban_enabled = false);
- /**
- * Kick avatar off grid
- */
- static void kick(const LLUUID& id);
-
- /**
- * Freeze avatar
- */
- static void freeze(const LLUUID& id);
-
- /**
- * Unfreeze avatar
- */
- static void unfreeze(const LLUUID& id);
-
- /**
- * Open csr page for avatar
- */
- static void csr(const LLUUID& id, std::string name);
-
- /**
- * Checks whether we can offer a teleport to the avatar, only offline friends
- * cannot be offered a teleport.
- *
- * @return false if avatar is a friend and not visibly online
- */
- static bool canOfferTeleport(const LLUUID& id);
-
- /**
- * @return false if any one of the specified avatars a friend and not visibly online
- */
- static bool canOfferTeleport(const uuid_vec_t& ids);
-
- /**
- * Checks whether all items selected in the given inventory panel can be shared
- *
- * @param inv_panel Inventory panel to get selection from. If NULL, the active inventory panel is used.
- *
- * @return false if the selected items cannot be shared or the active inventory panel cannot be obtained
- */
- static bool canShareSelectedItems(LLInventoryPanel* inv_panel = NULL);
-
- /**
- * Builds a string of residents' display names separated by "words_separator" string.
- *
- * @param avatar_names - a vector of given avatar names from which resulting string is built
- * @param residents_string - the resulting string
- */
- static void buildResidentsString(std::vector<LLAvatarName> avatar_names, std::string& residents_string, bool complete_name = false);
-
- /**
- * Builds a string of residents' display names separated by "words_separator" string.
- *
- * @param avatar_uuids - a vector of given avatar uuids from which resulting string is built
- * @param residents_string - the resulting string
- */
- static void buildResidentsString(const uuid_vec_t& avatar_uuids, std::string& residents_string);
-
- /**
- * Opens the chat history for avatar
- */
- static void viewChatHistory(const LLUUID& id);
-
- static std::set<LLUUID> getInventorySelectedUUIDs(LLInventoryPanel* active_panel = NULL);
+ /**
+ * Block/unblock the avatar by id.
+ * Returns true if blocked, returns false if unblocked
+ */
+ static bool toggleBlock(const LLUUID& id);
+
+ /**
+ * Mute/unmute avatar.
+ */
+ static void toggleMute(const LLUUID& id, U32 flags);
+
+ /**
+ * Block/unblock the avatar voice.
+ */
+ static void toggleMuteVoice(const LLUUID& id);
+
+ /**
+ * Return true if avatar with "id" is a friend
+ */
+ static bool isFriend(const LLUUID& id);
+
+ /**
+ * @return true if the avatar is blocked
+ */
+ static bool isBlocked(const LLUUID& id);
+
+ /**
+ * @return true if the avatar voice is blocked
+ */
+ static bool isVoiceMuted(const LLUUID& id);
+
+ /**
+ * @return true if you can block the avatar
+ */
+ static bool canBlock(const LLUUID& id);
+
+ /**
+ * Return true if the avatar is in a P2P voice call with a given user
+ */
+ /* AD *TODO: Is this function needed any more?
+ I fixed it a bit(added check for canCall), but it appears that it is not used
+ anywhere. Maybe it should be removed?
+ static bool isCalling(const LLUUID &id);*/
+
+ /**
+ * @return true if call to the resident can be made
+ */
+
+ static bool canCall();
+ /**
+ * Invite avatar to a group.
+ */
+ static void inviteToGroup(const LLUUID& id);
+
+ static void freezeAvatar(const LLUUID& id);
+
+ static void ejectAvatar(const LLUUID& id, bool ban_enabled = false);
+ /**
+ * Kick avatar off grid
+ */
+ static void kick(const LLUUID& id);
+
+ /**
+ * Freeze avatar
+ */
+ static void freeze(const LLUUID& id);
+
+ /**
+ * Unfreeze avatar
+ */
+ static void unfreeze(const LLUUID& id);
+
+ /**
+ * Open csr page for avatar
+ */
+ static void csr(const LLUUID& id, std::string name);
+
+ /**
+ * Checks whether we can offer a teleport to the avatar, only offline friends
+ * cannot be offered a teleport.
+ *
+ * @return false if avatar is a friend and not visibly online
+ */
+ static bool canOfferTeleport(const LLUUID& id);
+
+ /**
+ * @return false if any one of the specified avatars a friend and not visibly online
+ */
+ static bool canOfferTeleport(const uuid_vec_t& ids);
+
+ /**
+ * Checks whether all items selected in the given inventory panel can be shared
+ *
+ * @param inv_panel Inventory panel to get selection from. If NULL, the active inventory panel is used.
+ *
+ * @return false if the selected items cannot be shared or the active inventory panel cannot be obtained
+ */
+ static bool canShareSelectedItems(LLInventoryPanel* inv_panel = NULL);
+
+ /**
+ * Builds a string of residents' display names separated by "words_separator" string.
+ *
+ * @param avatar_names - a vector of given avatar names from which resulting string is built
+ * @param residents_string - the resulting string
+ */
+ static void buildResidentsString(std::vector<LLAvatarName> avatar_names, std::string& residents_string, bool complete_name = false);
+
+ /**
+ * Builds a string of residents' display names separated by "words_separator" string.
+ *
+ * @param avatar_uuids - a vector of given avatar uuids from which resulting string is built
+ * @param residents_string - the resulting string
+ */
+ static void buildResidentsString(const uuid_vec_t& avatar_uuids, std::string& residents_string);
+
+ /**
+ * Opens the chat history for avatar
+ */
+ static void viewChatHistory(const LLUUID& id);
+
+ static std::set<LLUUID> getInventorySelectedUUIDs(LLInventoryPanel* active_panel = NULL);
private:
- static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
- static bool handleRemove(const LLSD& notification, const LLSD& response);
- static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id);
- static bool handleFreezeAvatar(const LLSD& notification, const LLSD& response);
- static bool handleEjectAvatar(const LLSD& notification, const LLSD& response);
- static bool handleKick(const LLSD& notification, const LLSD& response);
- static bool handleFreeze(const LLSD& notification, const LLSD& response);
- static bool handleUnfreeze(const LLSD& notification, const LLSD& response);
- static void callback_invite_to_group(LLUUID group_id, LLUUID id);
-
- // Just request friendship, no dialog.
- static void requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message);
+ static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
+ static bool handleRemove(const LLSD& notification, const LLSD& response);
+ static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id);
+ static bool handleFreezeAvatar(const LLSD& notification, const LLSD& response);
+ static bool handleEjectAvatar(const LLSD& notification, const LLSD& response);
+ static bool handleKick(const LLSD& notification, const LLSD& response);
+ static bool handleFreeze(const LLSD& notification, const LLSD& response);
+ static bool handleUnfreeze(const LLSD& notification, const LLSD& response);
+ static void callback_invite_to_group(LLUUID group_id, LLUUID id);
+
+ // Just request friendship, no dialog.
+ static void requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message);
};
#endif // LL_LLAVATARACTIONS_H
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
index 44bf698caa..07e544a1ca 100644
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatariconctrl.cpp
* @brief LLAvatarIconCtrl class implementation
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,137 +51,137 @@ static LLDefaultChildRegistry::Register<LLAvatarIconCtrl> r("avatar_icon");
namespace LLInitParam
{
- void TypeValues<LLAvatarIconCtrlEnums::ESymbolPos>::declareValues()
- {
- declare("BottomLeft", LLAvatarIconCtrlEnums::BOTTOM_LEFT);
- declare("BottomRight", LLAvatarIconCtrlEnums::BOTTOM_RIGHT);
- declare("TopLeft", LLAvatarIconCtrlEnums::TOP_LEFT);
- declare("TopRight", LLAvatarIconCtrlEnums::TOP_RIGHT);
- }
+ void TypeValues<LLAvatarIconCtrlEnums::ESymbolPos>::declareValues()
+ {
+ declare("BottomLeft", LLAvatarIconCtrlEnums::BOTTOM_LEFT);
+ declare("BottomRight", LLAvatarIconCtrlEnums::BOTTOM_RIGHT);
+ declare("TopLeft", LLAvatarIconCtrlEnums::TOP_LEFT);
+ declare("TopRight", LLAvatarIconCtrlEnums::TOP_RIGHT);
+ }
}
bool LLAvatarIconIDCache::LLAvatarIconIDCacheItem::expired()
{
- const F64 SEC_PER_DAY_PLUS_HOUR = (24.0 + 1.0) * 60.0 * 60.0;
- F64 delta = LLDate::now().secondsSinceEpoch() - cached_time.secondsSinceEpoch();
- if (delta > SEC_PER_DAY_PLUS_HOUR)
- return true;
- return false;
+ const F64 SEC_PER_DAY_PLUS_HOUR = (24.0 + 1.0) * 60.0 * 60.0;
+ F64 delta = LLDate::now().secondsSinceEpoch() - cached_time.secondsSinceEpoch();
+ if (delta > SEC_PER_DAY_PLUS_HOUR)
+ return true;
+ return false;
}
-void LLAvatarIconIDCache::load ()
+void LLAvatarIconIDCache::load ()
{
- LL_INFOS() << "Loading avatar icon id cache." << LL_ENDL;
-
- // build filename for each user
- std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
- llifstream file(resolved_filename.c_str());
-
- if (!file.is_open())
- return;
-
- // add each line in the file to the list
- int uuid_len = UUID_STR_LENGTH-1;
- std::string line;
- while (std::getline(file, line))
- {
- LLUUID avatar_id;
- LLUUID icon_id;
- LLDate date;
-
- if (line.length()<=uuid_len*2)
- continue; // short line, bail out to prevent substr calls throwing exception.
-
- std::string avatar_id_str = line.substr(0,uuid_len);
- std::string icon_id_str = line.substr(uuid_len,uuid_len);
-
- std::string date_str = line.substr(uuid_len*2, line.length()-uuid_len*2);
-
- if(!avatar_id.set(avatar_id_str) || !icon_id.set(icon_id_str) || !date.fromString(date_str))
- continue;
-
- LLAvatarIconIDCacheItem item = {icon_id,date};
- mCache[avatar_id] = item;
- }
-
- file.close();
-
+ LL_INFOS() << "Loading avatar icon id cache." << LL_ENDL;
+
+ // build filename for each user
+ std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
+ llifstream file(resolved_filename.c_str());
+
+ if (!file.is_open())
+ return;
+
+ // add each line in the file to the list
+ int uuid_len = UUID_STR_LENGTH-1;
+ std::string line;
+ while (std::getline(file, line))
+ {
+ LLUUID avatar_id;
+ LLUUID icon_id;
+ LLDate date;
+
+ if (line.length()<=uuid_len*2)
+ continue; // short line, bail out to prevent substr calls throwing exception.
+
+ std::string avatar_id_str = line.substr(0,uuid_len);
+ std::string icon_id_str = line.substr(uuid_len,uuid_len);
+
+ std::string date_str = line.substr(uuid_len*2, line.length()-uuid_len*2);
+
+ if(!avatar_id.set(avatar_id_str) || !icon_id.set(icon_id_str) || !date.fromString(date_str))
+ continue;
+
+ LLAvatarIconIDCacheItem item = {icon_id,date};
+ mCache[avatar_id] = item;
+ }
+
+ file.close();
+
}
-void LLAvatarIconIDCache::save ()
+void LLAvatarIconIDCache::save ()
{
- std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
-
- // open a file for writing
- llofstream file (resolved_filename.c_str());
- if (!file.is_open())
- {
- LL_WARNS() << "can't open avatar icons cache file\"" << mFilename << "\" for writing" << LL_ENDL;
- return;
- }
-
- for(std::map<LLUUID,LLAvatarIconIDCacheItem>::iterator it = mCache.begin();it!=mCache.end();++it)
- {
- if(!it->second.expired())
- {
- file << it->first << it->second.icon_id << it->second.cached_time << std::endl;
- }
- }
-
- file.close();
+ std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
+
+ // open a file for writing
+ llofstream file (resolved_filename.c_str());
+ if (!file.is_open())
+ {
+ LL_WARNS() << "can't open avatar icons cache file\"" << mFilename << "\" for writing" << LL_ENDL;
+ return;
+ }
+
+ for(std::map<LLUUID,LLAvatarIconIDCacheItem>::iterator it = mCache.begin();it!=mCache.end();++it)
+ {
+ if(!it->second.expired())
+ {
+ file << it->first << it->second.icon_id << it->second.cached_time << std::endl;
+ }
+ }
+
+ file.close();
}
-LLUUID* LLAvatarIconIDCache::get (const LLUUID& avatar_id)
+LLUUID* LLAvatarIconIDCache::get (const LLUUID& avatar_id)
{
- std::map<LLUUID,LLAvatarIconIDCacheItem>::iterator it = mCache.find(avatar_id);
- if(it==mCache.end())
- return 0;
- if(it->second.expired())
- return 0;
- return &it->second.icon_id;
+ std::map<LLUUID,LLAvatarIconIDCacheItem>::iterator it = mCache.find(avatar_id);
+ if(it==mCache.end())
+ return 0;
+ if(it->second.expired())
+ return 0;
+ return &it->second.icon_id;
}
-void LLAvatarIconIDCache::add (const LLUUID& avatar_id,const LLUUID& icon_id)
+void LLAvatarIconIDCache::add (const LLUUID& avatar_id,const LLUUID& icon_id)
{
- LLAvatarIconIDCacheItem item = {icon_id,LLDate::now()};
- mCache[avatar_id] = item;
+ LLAvatarIconIDCacheItem item = {icon_id,LLDate::now()};
+ mCache[avatar_id] = item;
}
-void LLAvatarIconIDCache::remove (const LLUUID& avatar_id)
+void LLAvatarIconIDCache::remove (const LLUUID& avatar_id)
{
- mCache.erase(avatar_id);
+ mCache.erase(avatar_id);
}
LLAvatarIconCtrl::Params::Params()
-: avatar_id("avatar_id"),
- draw_tooltip("draw_tooltip", true),
- default_icon_name("default_icon_name"),
- symbol_hpad("symbol_hpad"),
- symbol_vpad("symbol_vpad"),
- symbol_size("symbol_size", 1),
- symbol_pos("symbol_pos", LLAvatarIconCtrlEnums::BOTTOM_RIGHT)
+: avatar_id("avatar_id"),
+ draw_tooltip("draw_tooltip", true),
+ default_icon_name("default_icon_name"),
+ symbol_hpad("symbol_hpad"),
+ symbol_vpad("symbol_vpad"),
+ symbol_size("symbol_size", 1),
+ symbol_pos("symbol_pos", LLAvatarIconCtrlEnums::BOTTOM_RIGHT)
{
- changeDefault(min_width, 32);
- changeDefault(min_height, 32);
+ changeDefault(min_width, 32);
+ changeDefault(min_height, 32);
}
LLAvatarIconCtrl::LLAvatarIconCtrl(const LLAvatarIconCtrl::Params& p)
-: LLIconCtrl(p),
- LLAvatarPropertiesObserver(),
- mAvatarId(),
- mFullName(),
- mDrawTooltip(p.draw_tooltip),
- mDefaultIconName(p.default_icon_name),
- mAvatarNameCacheConnection(),
- mSymbolHpad(p.symbol_hpad),
- mSymbolVpad(p.symbol_vpad),
- mSymbolSize(p.symbol_size),
- mSymbolPos(p.symbol_pos)
+: LLIconCtrl(p),
+ LLAvatarPropertiesObserver(),
+ mAvatarId(),
+ mFullName(),
+ mDrawTooltip(p.draw_tooltip),
+ mDefaultIconName(p.default_icon_name),
+ mAvatarNameCacheConnection(),
+ mSymbolHpad(p.symbol_hpad),
+ mSymbolVpad(p.symbol_vpad),
+ mSymbolSize(p.symbol_size),
+ mSymbolPos(p.symbol_pos)
{
- mPriority = LLViewerFetchedTexture::BOOST_ICON;
+ mPriority = LLViewerFetchedTexture::BOOST_ICON;
// don't request larger image then necessary to save gl memory,
// but ensure that quality is sufficient
@@ -189,149 +189,149 @@ LLAvatarIconCtrl::LLAvatarIconCtrl(const LLAvatarIconCtrl::Params& p)
mMaxHeight = llmax((S32)p.min_height, rect.getHeight());
mMaxWidth = llmax((S32)p.min_width, rect.getWidth());
- if (p.avatar_id.isProvided())
- {
- LLSD value(p.avatar_id);
- setValue(value);
- }
- else
- {
- LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
- }
+ if (p.avatar_id.isProvided())
+ {
+ LLSD value(p.avatar_id);
+ setValue(value);
+ }
+ else
+ {
+ LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
+ }
}
LLAvatarIconCtrl::~LLAvatarIconCtrl()
{
- if (mAvatarId.notNull())
- {
- LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId, this);
- // Name callbacks will be automatically disconnected since LLUICtrl is trackable
- }
-
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ if (mAvatarId.notNull())
+ {
+ LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId, this);
+ // Name callbacks will be automatically disconnected since LLUICtrl is trackable
+ }
+
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
}
//virtual
void LLAvatarIconCtrl::setValue(const LLSD& value)
{
- if (value.isUUID())
- {
- LLAvatarPropertiesProcessor* app =
- LLAvatarPropertiesProcessor::getInstance();
- if (mAvatarId.notNull())
- {
- app->removeObserver(mAvatarId, this);
- }
-
- if (mAvatarId != value.asUUID())
- {
- mAvatarId = value.asUUID();
-
- // *BUG: This will return stale icons if a user changes their
- // profile picture. However, otherwise we send too many upstream
- // AvatarPropertiesRequest messages.
-
- // to get fresh avatar icon use
- // LLAvatarIconIDCache::getInstance()->remove(avatar_id);
-
- // Check if cache already contains image_id for that avatar
- if (!updateFromCache())
- {
- // *TODO: Consider getting avatar icon/badge directly from
- // People API, rather than sending AvatarPropertyRequest
- // messages. People API already hits the user table.
- LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
- app->addObserver(mAvatarId, this);
- app->sendAvatarPropertiesRequest(mAvatarId);
- }
+ if (value.isUUID())
+ {
+ LLAvatarPropertiesProcessor* app =
+ LLAvatarPropertiesProcessor::getInstance();
+ if (mAvatarId.notNull())
+ {
+ app->removeObserver(mAvatarId, this);
+ }
+
+ if (mAvatarId != value.asUUID())
+ {
+ mAvatarId = value.asUUID();
+
+ // *BUG: This will return stale icons if a user changes their
+ // profile picture. However, otherwise we send too many upstream
+ // AvatarPropertiesRequest messages.
+
+ // to get fresh avatar icon use
+ // LLAvatarIconIDCache::getInstance()->remove(avatar_id);
+
+ // Check if cache already contains image_id for that avatar
+ if (!updateFromCache())
+ {
+ // *TODO: Consider getting avatar icon/badge directly from
+ // People API, rather than sending AvatarPropertyRequest
+ // messages. People API already hits the user table.
+ LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
+ app->addObserver(mAvatarId, this);
+ app->sendAvatarPropertiesRequest(mAvatarId);
+ }
else if (gAgentID == mAvatarId)
{
// Always track any changes to our own icon id
app->addObserver(mAvatarId, this);
}
- }
- }
- else
- {
- LLIconCtrl::setValue(value);
- }
-
- fetchAvatarName();
+ }
+ }
+ else
+ {
+ LLIconCtrl::setValue(value);
+ }
+
+ fetchAvatarName();
}
void LLAvatarIconCtrl::fetchAvatarName()
{
- if (mAvatarId.notNull())
- {
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarId, boost::bind(&LLAvatarIconCtrl::onAvatarNameCache, this, _1, _2));
- }
+ if (mAvatarId.notNull())
+ {
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarId, boost::bind(&LLAvatarIconCtrl::onAvatarNameCache, this, _1, _2));
+ }
}
bool LLAvatarIconCtrl::updateFromCache()
{
- LLUUID* icon_id_ptr = LLAvatarIconIDCache::getInstance()->get(mAvatarId);
- if(!icon_id_ptr)
- return false;
-
- const LLUUID& icon_id = *icon_id_ptr;
-
- // Update the avatar
- if (icon_id.notNull())
- {
- LLIconCtrl::setValue(icon_id);
- }
- else
- {
- LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
+ LLUUID* icon_id_ptr = LLAvatarIconIDCache::getInstance()->get(mAvatarId);
+ if(!icon_id_ptr)
return false;
- }
- return true;
+ const LLUUID& icon_id = *icon_id_ptr;
+
+ // Update the avatar
+ if (icon_id.notNull())
+ {
+ LLIconCtrl::setValue(icon_id);
+ }
+ else
+ {
+ LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
+ return false;
+ }
+
+ return true;
}
//virtual
void LLAvatarIconCtrl::processProperties(void* data, EAvatarProcessorType type)
{
- if (APT_PROPERTIES == type)
- {
- LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
- if (avatar_data)
- {
- if (avatar_data->avatar_id != mAvatarId)
- {
- return;
- }
-
- LLAvatarIconIDCache::getInstance()->add(mAvatarId,avatar_data->image_id);
- updateFromCache();
- }
- }
+ if (APT_PROPERTIES == type)
+ {
+ LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
+ if (avatar_data)
+ {
+ if (avatar_data->avatar_id != mAvatarId)
+ {
+ return;
+ }
+
+ LLAvatarIconIDCache::getInstance()->add(mAvatarId,avatar_data->image_id);
+ updateFromCache();
+ }
+ }
}
void LLAvatarIconCtrl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
{
- mAvatarNameCacheConnection.disconnect();
-
- if (agent_id == mAvatarId)
- {
- // Most avatar icon controls are next to a UI element that shows
- // a display name, so only show username.
- mFullName = av_name.getUserName();
-
- if (mDrawTooltip)
- {
- setToolTip(mFullName);
- }
- else
- {
- setToolTip(std::string());
- }
- }
+ mAvatarNameCacheConnection.disconnect();
+
+ if (agent_id == mAvatarId)
+ {
+ // Most avatar icon controls are next to a UI element that shows
+ // a display name, so only show username.
+ mFullName = av_name.getUserName();
+
+ if (mDrawTooltip)
+ {
+ setToolTip(mFullName);
+ }
+ else
+ {
+ setToolTip(std::string());
+ }
+ }
}
diff --git a/indra/newview/llavatariconctrl.h b/indra/newview/llavatariconctrl.h
index c510e86958..49b5d845a7 100644
--- a/indra/newview/llavatariconctrl.h
+++ b/indra/newview/llavatariconctrl.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatariconctrl.h
* @brief LLAvatarIconCtrl base class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,108 +36,108 @@ class LLAvatarName;
class LLAvatarIconIDCache: public LLSingleton<LLAvatarIconIDCache>
{
- LLSINGLETON(LLAvatarIconIDCache);
+ LLSINGLETON(LLAvatarIconIDCache);
public:
- struct LLAvatarIconIDCacheItem
- {
- LLUUID icon_id;
- LLDate cached_time;
+ struct LLAvatarIconIDCacheItem
+ {
+ LLUUID icon_id;
+ LLDate cached_time;
- bool expired();
- };
+ bool expired();
+ };
- void load ();
- void save ();
+ void load ();
+ void save ();
- LLUUID* get (const LLUUID& id);
- void add (const LLUUID& avatar_id,const LLUUID& icon_id);
+ LLUUID* get (const LLUUID& id);
+ void add (const LLUUID& avatar_id,const LLUUID& icon_id);
- void remove (const LLUUID& id);
+ void remove (const LLUUID& id);
protected:
-
- std::string mFilename;
- std::map<LLUUID,LLAvatarIconIDCacheItem> mCache;//we cache only LLUID and time
+
+ std::string mFilename;
+ std::map<LLUUID,LLAvatarIconIDCacheItem> mCache;//we cache only LLUID and time
};
inline
LLAvatarIconIDCache::LLAvatarIconIDCache()
- : mFilename("avatar_icons_cache.txt")
+ : mFilename("avatar_icons_cache.txt")
{}
namespace LLAvatarIconCtrlEnums
{
- enum ESymbolPos
- {
- BOTTOM_LEFT,
- BOTTOM_RIGHT,
- TOP_LEFT,
- TOP_RIGHT
- };
+ enum ESymbolPos
+ {
+ BOTTOM_LEFT,
+ BOTTOM_RIGHT,
+ TOP_LEFT,
+ TOP_RIGHT
+ };
}
namespace LLInitParam
{
- template<>
- struct TypeValues<LLAvatarIconCtrlEnums::ESymbolPos> : public TypeValuesHelper<LLAvatarIconCtrlEnums::ESymbolPos>
- {
- static void declareValues();
- };
+ template<>
+ struct TypeValues<LLAvatarIconCtrlEnums::ESymbolPos> : public TypeValuesHelper<LLAvatarIconCtrlEnums::ESymbolPos>
+ {
+ static void declareValues();
+ };
}
class LLAvatarIconCtrl
: public LLIconCtrl, public LLAvatarPropertiesObserver
{
public:
- struct Params : public LLInitParam::Block<Params, LLIconCtrl::Params>
- {
- Optional<LLUUID> avatar_id;
- Optional<bool> draw_tooltip;
- Optional<std::string> default_icon_name;
- Optional<S32> symbol_hpad,
- symbol_vpad,
- symbol_size;
- Optional<LLAvatarIconCtrlEnums::ESymbolPos> symbol_pos;
-
- Params();
- };
-
+ struct Params : public LLInitParam::Block<Params, LLIconCtrl::Params>
+ {
+ Optional<LLUUID> avatar_id;
+ Optional<bool> draw_tooltip;
+ Optional<std::string> default_icon_name;
+ Optional<S32> symbol_hpad,
+ symbol_vpad,
+ symbol_size;
+ Optional<LLAvatarIconCtrlEnums::ESymbolPos> symbol_pos;
+
+ Params();
+ };
+
protected:
- LLAvatarIconCtrl(const Params&);
- friend class LLUICtrlFactory;
+ LLAvatarIconCtrl(const Params&);
+ friend class LLUICtrlFactory;
public:
- virtual ~LLAvatarIconCtrl();
+ virtual ~LLAvatarIconCtrl();
- virtual void setValue(const LLSD& value);
+ virtual void setValue(const LLSD& value);
- // LLAvatarPropertiesProcessor observer trigger
- virtual void processProperties(void* data, EAvatarProcessorType type);
+ // LLAvatarPropertiesProcessor observer trigger
+ virtual void processProperties(void* data, EAvatarProcessorType type);
- const LLUUID& getAvatarId() const { return mAvatarId; }
- const std::string& getFullName() const { return mFullName; }
+ const LLUUID& getAvatarId() const { return mAvatarId; }
+ const std::string& getFullName() const { return mFullName; }
- void setDrawTooltip(bool value) { mDrawTooltip = value;}
+ void setDrawTooltip(bool value) { mDrawTooltip = value;}
protected:
- LLUUID mAvatarId;
- std::string mFullName;
- bool mDrawTooltip;
- std::string mDefaultIconName;
- S32 mSymbolHpad,
- mSymbolVpad,
- mSymbolSize;
- LLAvatarIconCtrlEnums::ESymbolPos mSymbolPos;
+ LLUUID mAvatarId;
+ std::string mFullName;
+ bool mDrawTooltip;
+ std::string mDefaultIconName;
+ S32 mSymbolHpad,
+ mSymbolVpad,
+ mSymbolSize;
+ LLAvatarIconCtrlEnums::ESymbolPos mSymbolPos;
- bool updateFromCache();
+ bool updateFromCache();
private:
- void fetchAvatarName();
- void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
+ void fetchAvatarName();
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
- boost::signals2::connection mAvatarNameCacheConnection;
+ boost::signals2::connection mAvatarNameCacheConnection;
};
#endif // LL_LLAVATARICONCTRL_H
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index c0990d9d11..e467f74f9c 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarlist.h
* @brief Generic avatar list
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,7 +45,7 @@
#include "llrecentpeople.h"
#include "lluuid.h"
#include "llvoiceclient.h"
-#include "llviewercontrol.h" // for gSavedSettings
+#include "llviewercontrol.h" // for gSavedSettings
#include "lltooldraganddrop.h"
static LLDefaultChildRegistry::Register<LLAvatarList> r("avatar_list");
@@ -59,51 +59,51 @@ static const unsigned ADD_LIMIT = 50;
bool LLAvatarList::contains(const LLUUID& id)
{
- const uuid_vec_t& ids = getIDs();
- return std::find(ids.begin(), ids.end(), id) != ids.end();
+ const uuid_vec_t& ids = getIDs();
+ return std::find(ids.begin(), ids.end(), id) != ids.end();
}
void LLAvatarList::toggleIcons()
{
- // Save the new value for new items to use.
- mShowIcons = !mShowIcons;
- gSavedSettings.setBOOL(mIconParamName, mShowIcons);
-
- // Show/hide icons for all existing items.
- std::vector<LLPanel*> items;
- getItems(items);
- for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
- {
- static_cast<LLAvatarListItem*>(*it)->setAvatarIconVisible(mShowIcons);
- }
+ // Save the new value for new items to use.
+ mShowIcons = !mShowIcons;
+ gSavedSettings.setBOOL(mIconParamName, mShowIcons);
+
+ // Show/hide icons for all existing items.
+ std::vector<LLPanel*> items;
+ getItems(items);
+ for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
+ {
+ static_cast<LLAvatarListItem*>(*it)->setAvatarIconVisible(mShowIcons);
+ }
}
void LLAvatarList::setSpeakingIndicatorsVisible(bool visible)
{
- // Save the new value for new items to use.
- mShowSpeakingIndicator = visible;
-
- // Show/hide icons for all existing items.
- std::vector<LLPanel*> items;
- getItems(items);
- for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
- {
- static_cast<LLAvatarListItem*>(*it)->showSpeakingIndicator(mShowSpeakingIndicator);
- }
+ // Save the new value for new items to use.
+ mShowSpeakingIndicator = visible;
+
+ // Show/hide icons for all existing items.
+ std::vector<LLPanel*> items;
+ getItems(items);
+ for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
+ {
+ static_cast<LLAvatarListItem*>(*it)->showSpeakingIndicator(mShowSpeakingIndicator);
+ }
}
void LLAvatarList::showPermissions(bool visible)
{
- // Save the value for new items to use.
- mShowPermissions = visible;
+ // Save the value for new items to use.
+ mShowPermissions = visible;
- // Enable or disable showing permissions icons for all existing items.
- std::vector<LLPanel*> items;
- getItems(items);
- for(std::vector<LLPanel*>::const_iterator it = items.begin(), end_it = items.end(); it != end_it; ++it)
- {
- static_cast<LLAvatarListItem*>(*it)->setShowPermissions(mShowPermissions);
- }
+ // Enable or disable showing permissions icons for all existing items.
+ std::vector<LLPanel*> items;
+ getItems(items);
+ for(std::vector<LLPanel*>::const_iterator it = items.begin(), end_it = items.end(); it != end_it; ++it)
+ {
+ static_cast<LLAvatarListItem*>(*it)->setShowPermissions(mShowPermissions);
+ }
}
static bool findInsensitive(std::string haystack, const std::string& needle_upper)
@@ -128,7 +128,7 @@ LLAvatarList::Params::Params()
}
LLAvatarList::LLAvatarList(const Params& p)
-: LLFlatListViewEx(p)
+: LLFlatListViewEx(p)
, mIgnoreOnlineStatus(p.ignore_online_status)
, mShowLastInteractionTime(p.show_last_interaction_time)
, mContextMenu(NULL)
@@ -142,103 +142,103 @@ LLAvatarList::LLAvatarList(const Params& p)
, mShowPermissions(p.show_permissions_granted)
, mShowCompleteName(false)
{
- setCommitOnSelectionChange(true);
+ setCommitOnSelectionChange(true);
- // Set default sort order.
- setComparator(&NAME_COMPARATOR);
+ // Set default sort order.
+ setComparator(&NAME_COMPARATOR);
- if (mShowLastInteractionTime)
- {
- mLITUpdateTimer = new LLTimer();
- mLITUpdateTimer->setTimerExpirySec(0); // zero to force initial update
- mLITUpdateTimer->start();
- }
-
- LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&LLAvatarList::handleDisplayNamesOptionChanged, this));
+ if (mShowLastInteractionTime)
+ {
+ mLITUpdateTimer = new LLTimer();
+ mLITUpdateTimer->setTimerExpirySec(0); // zero to force initial update
+ mLITUpdateTimer->start();
+ }
+
+ LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&LLAvatarList::handleDisplayNamesOptionChanged, this));
}
void LLAvatarList::handleDisplayNamesOptionChanged()
{
- mNeedUpdateNames = true;
+ mNeedUpdateNames = true;
}
LLAvatarList::~LLAvatarList()
{
- delete mLITUpdateTimer;
+ delete mLITUpdateTimer;
}
void LLAvatarList::setShowIcons(std::string param_name)
{
- mIconParamName= param_name;
- mShowIcons = gSavedSettings.getBOOL(mIconParamName);
+ mIconParamName= param_name;
+ mShowIcons = gSavedSettings.getBOOL(mIconParamName);
}
std::string LLAvatarList::getAvatarName(LLAvatarName av_name)
{
- return mShowCompleteName? av_name.getCompleteName(false) : av_name.getDisplayName();
+ return mShowCompleteName? av_name.getCompleteName(false) : av_name.getDisplayName();
}
// virtual
void LLAvatarList::draw()
{
- // *NOTE dzaporozhan
- // Call refresh() after draw() to avoid flickering of avatar list items.
+ // *NOTE dzaporozhan
+ // Call refresh() after draw() to avoid flickering of avatar list items.
- LLFlatListViewEx::draw();
+ LLFlatListViewEx::draw();
- if (mNeedUpdateNames)
- {
- updateAvatarNames();
- }
+ if (mNeedUpdateNames)
+ {
+ updateAvatarNames();
+ }
- if (mDirty)
- refresh();
+ if (mDirty)
+ refresh();
- if (mShowLastInteractionTime && mLITUpdateTimer->hasExpired())
- {
- updateLastInteractionTimes();
- mLITUpdateTimer->setTimerExpirySec(LIT_UPDATE_PERIOD); // restart the timer
- }
+ if (mShowLastInteractionTime && mLITUpdateTimer->hasExpired())
+ {
+ updateLastInteractionTimes();
+ mLITUpdateTimer->setTimerExpirySec(LIT_UPDATE_PERIOD); // restart the timer
+ }
}
//virtual
void LLAvatarList::clear()
{
- getIDs().clear();
- setDirty(true);
- LLFlatListViewEx::clear();
+ getIDs().clear();
+ setDirty(true);
+ LLFlatListViewEx::clear();
}
void LLAvatarList::setNameFilter(const std::string& filter)
{
- std::string filter_upper = filter;
- LLStringUtil::toUpper(filter_upper);
- if (mNameFilter != filter_upper)
- {
- mNameFilter = filter_upper;
+ std::string filter_upper = filter;
+ LLStringUtil::toUpper(filter_upper);
+ if (mNameFilter != filter_upper)
+ {
+ mNameFilter = filter_upper;
- // update message for empty state here instead of refresh() to avoid blinking when switch
- // between tabs.
- updateNoItemsMessage(filter);
- setDirty();
- }
+ // update message for empty state here instead of refresh() to avoid blinking when switch
+ // between tabs.
+ updateNoItemsMessage(filter);
+ setDirty();
+ }
}
void LLAvatarList::sortByName()
{
- setComparator(&NAME_COMPARATOR);
- sort();
+ setComparator(&NAME_COMPARATOR);
+ sort();
}
void LLAvatarList::setDirty(bool val /*= true*/, bool force_refresh /*= false*/)
{
- mDirty = val;
- if(mDirty && force_refresh)
- {
- refresh();
- }
+ mDirty = val;
+ if(mDirty && force_refresh)
+ {
+ refresh();
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -246,345 +246,345 @@ void LLAvatarList::setDirty(bool val /*= true*/, bool force_refresh /*= false*/)
//////////////////////////////////////////////////////////////////////////
void LLAvatarList::refresh()
{
- bool have_names = TRUE;
- bool add_limit_exceeded = false;
- bool modified = false;
- bool have_filter = !mNameFilter.empty();
-
- // Save selection.
- uuid_vec_t selected_ids;
- getSelectedUUIDs(selected_ids);
- LLUUID current_id = getSelectedUUID();
-
- // Determine what to add and what to remove.
- uuid_vec_t added, removed;
- LLAvatarList::computeDifference(getIDs(), added, removed);
-
- // Handle added items.
- unsigned nadded = 0;
- const std::string waiting_str = LLTrans::getString("AvatarNameWaiting");
-
- for (uuid_vec_t::const_iterator it=added.begin(); it != added.end(); it++)
- {
- const LLUUID& buddy_id = *it;
- LLAvatarName av_name;
- have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
-
- if (!have_filter || findInsensitive(getAvatarName(av_name), mNameFilter))
- {
- if (nadded >= ADD_LIMIT)
- {
- add_limit_exceeded = true;
- break;
- }
- else
- {
- // *NOTE: If you change the UI to show a different string,
- // be sure to change the filter code below.
- std::string display_name = getAvatarName(av_name);
- addNewItem(buddy_id,
- display_name.empty() ? waiting_str : display_name,
- LLAvatarTracker::instance().isBuddyOnline(buddy_id));
-
- modified = true;
- nadded++;
- }
- }
- }
-
- // Handle removed items.
- for (uuid_vec_t::const_iterator it=removed.begin(); it != removed.end(); it++)
- {
- removeItemByUUID(*it);
- modified = true;
- }
-
- // Handle filter.
- if (have_filter)
- {
- std::vector<LLSD> cur_values;
- getValues(cur_values);
-
- for (std::vector<LLSD>::const_iterator it=cur_values.begin(); it != cur_values.end(); it++)
- {
- const LLUUID& buddy_id = it->asUUID();
- LLAvatarName av_name;
- have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
- if (!findInsensitive(getAvatarName(av_name), mNameFilter))
- {
- removeItemByUUID(buddy_id);
- modified = true;
- }
- }
- }
-
- // Changed item in place, need to request sort and update columns
- // because we might have changed data in a column on which the user
- // has already sorted. JC
- sort();
-
- // re-select items
- // selectMultiple(selected_ids); // TODO: implement in LLFlatListView if need
- selectItemByUUID(current_id);
-
- // If the name filter is specified and the names are incomplete,
- // we need to re-update when the names are complete so that
- // the filter can be applied correctly.
- //
- // Otherwise, if we have no filter then no need to update again
- // because the items will update their names.
- bool dirty = add_limit_exceeded || (have_filter && !have_names);
- setDirty(dirty);
-
- // Refreshed all items.
- if(!dirty)
- {
- // Highlight items matching the filter.
- std::vector<LLPanel*> items;
- getItems(items);
- for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
- {
- static_cast<LLAvatarListItem*>(*it)->setHighlight(mNameFilter);
- }
-
- // Send refresh_complete signal.
- mRefreshCompleteSignal(this, LLSD((S32)size(false)));
- }
-
- // Commit if we've added/removed items.
- if (modified)
- onCommit();
+ bool have_names = TRUE;
+ bool add_limit_exceeded = false;
+ bool modified = false;
+ bool have_filter = !mNameFilter.empty();
+
+ // Save selection.
+ uuid_vec_t selected_ids;
+ getSelectedUUIDs(selected_ids);
+ LLUUID current_id = getSelectedUUID();
+
+ // Determine what to add and what to remove.
+ uuid_vec_t added, removed;
+ LLAvatarList::computeDifference(getIDs(), added, removed);
+
+ // Handle added items.
+ unsigned nadded = 0;
+ const std::string waiting_str = LLTrans::getString("AvatarNameWaiting");
+
+ for (uuid_vec_t::const_iterator it=added.begin(); it != added.end(); it++)
+ {
+ const LLUUID& buddy_id = *it;
+ LLAvatarName av_name;
+ have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
+
+ if (!have_filter || findInsensitive(getAvatarName(av_name), mNameFilter))
+ {
+ if (nadded >= ADD_LIMIT)
+ {
+ add_limit_exceeded = true;
+ break;
+ }
+ else
+ {
+ // *NOTE: If you change the UI to show a different string,
+ // be sure to change the filter code below.
+ std::string display_name = getAvatarName(av_name);
+ addNewItem(buddy_id,
+ display_name.empty() ? waiting_str : display_name,
+ LLAvatarTracker::instance().isBuddyOnline(buddy_id));
+
+ modified = true;
+ nadded++;
+ }
+ }
+ }
+
+ // Handle removed items.
+ for (uuid_vec_t::const_iterator it=removed.begin(); it != removed.end(); it++)
+ {
+ removeItemByUUID(*it);
+ modified = true;
+ }
+
+ // Handle filter.
+ if (have_filter)
+ {
+ std::vector<LLSD> cur_values;
+ getValues(cur_values);
+
+ for (std::vector<LLSD>::const_iterator it=cur_values.begin(); it != cur_values.end(); it++)
+ {
+ const LLUUID& buddy_id = it->asUUID();
+ LLAvatarName av_name;
+ have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
+ if (!findInsensitive(getAvatarName(av_name), mNameFilter))
+ {
+ removeItemByUUID(buddy_id);
+ modified = true;
+ }
+ }
+ }
+
+ // Changed item in place, need to request sort and update columns
+ // because we might have changed data in a column on which the user
+ // has already sorted. JC
+ sort();
+
+ // re-select items
+ // selectMultiple(selected_ids); // TODO: implement in LLFlatListView if need
+ selectItemByUUID(current_id);
+
+ // If the name filter is specified and the names are incomplete,
+ // we need to re-update when the names are complete so that
+ // the filter can be applied correctly.
+ //
+ // Otherwise, if we have no filter then no need to update again
+ // because the items will update their names.
+ bool dirty = add_limit_exceeded || (have_filter && !have_names);
+ setDirty(dirty);
+
+ // Refreshed all items.
+ if(!dirty)
+ {
+ // Highlight items matching the filter.
+ std::vector<LLPanel*> items;
+ getItems(items);
+ for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
+ {
+ static_cast<LLAvatarListItem*>(*it)->setHighlight(mNameFilter);
+ }
+
+ // Send refresh_complete signal.
+ mRefreshCompleteSignal(this, LLSD((S32)size(false)));
+ }
+
+ // Commit if we've added/removed items.
+ if (modified)
+ onCommit();
}
void LLAvatarList::updateAvatarNames()
{
- std::vector<LLPanel*> items;
- getItems(items);
+ std::vector<LLPanel*> items;
+ getItems(items);
- for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
- {
- LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it);
- item->setShowCompleteName(mShowCompleteName);
- item->updateAvatarName();
- }
- mNeedUpdateNames = false;
+ for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
+ {
+ LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it);
+ item->setShowCompleteName(mShowCompleteName);
+ item->updateAvatarName();
+ }
+ mNeedUpdateNames = false;
}
bool LLAvatarList::filterHasMatches()
{
- uuid_vec_t values = getIDs();
+ uuid_vec_t values = getIDs();
- for (uuid_vec_t::const_iterator it=values.begin(); it != values.end(); it++)
- {
- const LLUUID& buddy_id = *it;
- LLAvatarName av_name;
- bool have_name = LLAvatarNameCache::get(buddy_id, &av_name);
+ for (uuid_vec_t::const_iterator it=values.begin(); it != values.end(); it++)
+ {
+ const LLUUID& buddy_id = *it;
+ LLAvatarName av_name;
+ bool have_name = LLAvatarNameCache::get(buddy_id, &av_name);
- // If name has not been loaded yet we consider it as a match.
- // When the name will be loaded the filter will be applied again(in refresh()).
+ // If name has not been loaded yet we consider it as a match.
+ // When the name will be loaded the filter will be applied again(in refresh()).
- if (have_name && !findInsensitive(getAvatarName(av_name), mNameFilter))
- {
- continue;
- }
+ if (have_name && !findInsensitive(getAvatarName(av_name), mNameFilter))
+ {
+ continue;
+ }
- return true;
- }
- return false;
+ return true;
+ }
+ return false;
}
boost::signals2::connection LLAvatarList::setRefreshCompleteCallback(const commit_signal_t::slot_type& cb)
{
- return mRefreshCompleteSignal.connect(cb);
+ return mRefreshCompleteSignal.connect(cb);
}
boost::signals2::connection LLAvatarList::setItemDoubleClickCallback(const mouse_signal_t::slot_type& cb)
{
- return mItemDoubleClickSignal.connect(cb);
+ return mItemDoubleClickSignal.connect(cb);
}
//virtual
S32 LLAvatarList::notifyParent(const LLSD& info)
{
- if (info.has("sort") && &NAME_COMPARATOR == mItemComparator)
- {
- sort();
- return 1;
- }
- return LLFlatListViewEx::notifyParent(info);
+ if (info.has("sort") && &NAME_COMPARATOR == mItemComparator)
+ {
+ sort();
+ return 1;
+ }
+ return LLFlatListViewEx::notifyParent(info);
}
void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos)
{
- LLAvatarListItem* item = new LLAvatarListItem();
- item->setShowCompleteName(mShowCompleteName);
- // This sets the name as a side effect
- item->setAvatarId(id, mSessionID, mIgnoreOnlineStatus);
- item->setOnline(mIgnoreOnlineStatus ? true : is_online);
- item->showLastInteractionTime(mShowLastInteractionTime);
+ LLAvatarListItem* item = new LLAvatarListItem();
+ item->setShowCompleteName(mShowCompleteName);
+ // This sets the name as a side effect
+ item->setAvatarId(id, mSessionID, mIgnoreOnlineStatus);
+ item->setOnline(mIgnoreOnlineStatus ? true : is_online);
+ item->showLastInteractionTime(mShowLastInteractionTime);
- item->setAvatarIconVisible(mShowIcons);
- item->setShowInfoBtn(mShowInfoBtn);
- item->setShowProfileBtn(mShowProfileBtn);
- item->showSpeakingIndicator(mShowSpeakingIndicator);
- item->setShowPermissions(mShowPermissions);
+ item->setAvatarIconVisible(mShowIcons);
+ item->setShowInfoBtn(mShowInfoBtn);
+ item->setShowProfileBtn(mShowProfileBtn);
+ item->showSpeakingIndicator(mShowSpeakingIndicator);
+ item->setShowPermissions(mShowPermissions);
- item->setDoubleClickCallback(boost::bind(&LLAvatarList::onItemDoubleClicked, this, _1, _2, _3, _4));
+ item->setDoubleClickCallback(boost::bind(&LLAvatarList::onItemDoubleClicked, this, _1, _2, _3, _4));
- addItem(item, id, pos);
+ addItem(item, id, pos);
}
// virtual
BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
- if ( mContextMenu)
- {
- uuid_vec_t selected_uuids;
- getSelectedUUIDs(selected_uuids);
- mContextMenu->show(this, selected_uuids, x, y);
- }
- return handled;
+ BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
+ if ( mContextMenu)
+ {
+ uuid_vec_t selected_uuids;
+ getSelectedUUIDs(selected_uuids);
+ mContextMenu->show(this, selected_uuids, x, y);
+ }
+ return handled;
}
BOOL LLAvatarList::handleMouseDown(S32 x, S32 y, MASK mask)
{
- gFocusMgr.setMouseCapture(this);
+ gFocusMgr.setMouseCapture(this);
- S32 screen_x;
- S32 screen_y;
- localPointToScreen(x, y, &screen_x, &screen_y);
- LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y);
+ S32 screen_x;
+ S32 screen_y;
+ localPointToScreen(x, y, &screen_x, &screen_y);
+ LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y);
- return LLFlatListViewEx::handleMouseDown(x, y, mask);
+ return LLFlatListViewEx::handleMouseDown(x, y, mask);
}
BOOL LLAvatarList::handleMouseUp( S32 x, S32 y, MASK mask )
{
- if(hasMouseCapture())
- {
- gFocusMgr.setMouseCapture(NULL);
- }
+ if(hasMouseCapture())
+ {
+ gFocusMgr.setMouseCapture(NULL);
+ }
- return LLFlatListViewEx::handleMouseUp(x, y, mask);
+ return LLFlatListViewEx::handleMouseUp(x, y, mask);
}
BOOL LLAvatarList::handleHover(S32 x, S32 y, MASK mask)
{
- bool handled = hasMouseCapture();
- if(handled)
- {
- S32 screen_x;
- S32 screen_y;
- localPointToScreen(x, y, &screen_x, &screen_y);
-
- if(LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y))
- {
- // First, create the global drag and drop object
- std::vector<EDragAndDropType> types;
- uuid_vec_t cargo_ids;
- getSelectedUUIDs(cargo_ids);
- types.resize(cargo_ids.size(), DAD_PERSON);
- LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_PEOPLE;
- LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src);
- }
- }
-
- if(!handled)
- {
- handled = LLFlatListViewEx::handleHover(x, y, mask);
- }
-
- return handled;
+ bool handled = hasMouseCapture();
+ if(handled)
+ {
+ S32 screen_x;
+ S32 screen_y;
+ localPointToScreen(x, y, &screen_x, &screen_y);
+
+ if(LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y))
+ {
+ // First, create the global drag and drop object
+ std::vector<EDragAndDropType> types;
+ uuid_vec_t cargo_ids;
+ getSelectedUUIDs(cargo_ids);
+ types.resize(cargo_ids.size(), DAD_PERSON);
+ LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_PEOPLE;
+ LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src);
+ }
+ }
+
+ if(!handled)
+ {
+ handled = LLFlatListViewEx::handleHover(x, y, mask);
+ }
+
+ return handled;
}
void LLAvatarList::setVisible(BOOL visible)
{
- if ( visible == FALSE && mContextMenu )
- {
- mContextMenu->hide();
- }
- LLFlatListViewEx::setVisible(visible);
+ if ( visible == FALSE && mContextMenu )
+ {
+ mContextMenu->hide();
+ }
+ LLFlatListViewEx::setVisible(visible);
}
void LLAvatarList::computeDifference(
- const uuid_vec_t& vnew_unsorted,
- uuid_vec_t& vadded,
- uuid_vec_t& vremoved)
+ const uuid_vec_t& vnew_unsorted,
+ uuid_vec_t& vadded,
+ uuid_vec_t& vremoved)
{
- uuid_vec_t vcur;
+ uuid_vec_t vcur;
- // Convert LLSDs to LLUUIDs.
- {
- std::vector<LLSD> vcur_values;
- getValues(vcur_values);
+ // Convert LLSDs to LLUUIDs.
+ {
+ std::vector<LLSD> vcur_values;
+ getValues(vcur_values);
- for (size_t i=0; i<vcur_values.size(); i++)
- vcur.push_back(vcur_values[i].asUUID());
- }
+ for (size_t i=0; i<vcur_values.size(); i++)
+ vcur.push_back(vcur_values[i].asUUID());
+ }
- LLCommonUtils::computeDifference(vnew_unsorted, vcur, vadded, vremoved);
+ LLCommonUtils::computeDifference(vnew_unsorted, vcur, vadded, vremoved);
}
// Refresh shown time of our last interaction with all listed avatars.
void LLAvatarList::updateLastInteractionTimes()
{
- S32 now = (S32) LLDate::now().secondsSinceEpoch();
- std::vector<LLPanel*> items;
- getItems(items);
+ S32 now = (S32) LLDate::now().secondsSinceEpoch();
+ std::vector<LLPanel*> items;
+ getItems(items);
- for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
- {
- // *TODO: error handling
- LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it);
- S32 secs_since = now - (S32) LLRecentPeople::instance().getDate(item->getAvatarId()).secondsSinceEpoch();
- if (secs_since >= 0)
- item->setLastInteractionTime(secs_since);
- }
+ for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
+ {
+ // *TODO: error handling
+ LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it);
+ S32 secs_since = now - (S32) LLRecentPeople::instance().getDate(item->getAvatarId()).secondsSinceEpoch();
+ if (secs_since >= 0)
+ item->setLastInteractionTime(secs_since);
+ }
}
void LLAvatarList::onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask)
{
- mItemDoubleClickSignal(ctrl, x, y, mask);
+ mItemDoubleClickSignal(ctrl, x, y, mask);
}
bool LLAvatarItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const
{
- const LLAvatarListItem* avatar_item1 = dynamic_cast<const LLAvatarListItem*>(item1);
- const LLAvatarListItem* avatar_item2 = dynamic_cast<const LLAvatarListItem*>(item2);
-
- if (!avatar_item1 || !avatar_item2)
- {
- LL_ERRS() << "item1 and item2 cannot be null" << LL_ENDL;
- return true;
- }
+ const LLAvatarListItem* avatar_item1 = dynamic_cast<const LLAvatarListItem*>(item1);
+ const LLAvatarListItem* avatar_item2 = dynamic_cast<const LLAvatarListItem*>(item2);
+
+ if (!avatar_item1 || !avatar_item2)
+ {
+ LL_ERRS() << "item1 and item2 cannot be null" << LL_ENDL;
+ return true;
+ }
- return doCompare(avatar_item1, avatar_item2);
+ return doCompare(avatar_item1, avatar_item2);
}
bool LLAvatarItemNameComparator::doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const
{
- std::string name1 = avatar_item1->getAvatarName();
- std::string name2 = avatar_item2->getAvatarName();
+ std::string name1 = avatar_item1->getAvatarName();
+ std::string name2 = avatar_item2->getAvatarName();
- LLStringUtil::toUpper(name1);
- LLStringUtil::toUpper(name2);
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
- return name1 < name2;
+ return name1 < name2;
}
bool LLAvatarItemAgentOnTopComparator::doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const
{
- //keep agent on top, if first is agent,
- //then we need to return true to elevate this id, otherwise false.
- if(avatar_item1->getAvatarId() == gAgentID)
- {
- return true;
- }
- else if (avatar_item2->getAvatarId() == gAgentID)
- {
- return false;
- }
- return LLAvatarItemNameComparator::doCompare(avatar_item1,avatar_item2);
+ //keep agent on top, if first is agent,
+ //then we need to return true to elevate this id, otherwise false.
+ if(avatar_item1->getAvatarId() == gAgentID)
+ {
+ return true;
+ }
+ else if (avatar_item2->getAvatarId() == gAgentID)
+ {
+ return false;
+ }
+ return LLAvatarItemNameComparator::doCompare(avatar_item1,avatar_item2);
}
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 48b0e70454..2352c7cd55 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarlist.h
* @brief Generic avatar list
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,155 +35,155 @@ class LLListContextMenu;
/**
* Generic list of avatars.
- *
+ *
* Updates itself when it's dirty, using optional name filter.
* To initiate update, modify the UUID list and call setDirty().
- *
+ *
* @see getIDs()
* @see setDirty()
* @see setNameFilter()
*/
class LLAvatarList : public LLFlatListViewEx
{
- LOG_CLASS(LLAvatarList);
+ LOG_CLASS(LLAvatarList);
public:
- struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
- {
- Optional<bool> ignore_online_status, // show all items as online
- show_last_interaction_time, // show most recent interaction time. *HACK: move this to a derived class
- show_info_btn,
- show_profile_btn,
- show_speaking_indicator,
- show_permissions_granted;
- Params();
- };
+ struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
+ {
+ Optional<bool> ignore_online_status, // show all items as online
+ show_last_interaction_time, // show most recent interaction time. *HACK: move this to a derived class
+ show_info_btn,
+ show_profile_btn,
+ show_speaking_indicator,
+ show_permissions_granted;
+ Params();
+ };
- LLAvatarList(const Params&);
- virtual ~LLAvatarList();
+ LLAvatarList(const Params&);
+ virtual ~LLAvatarList();
- virtual void draw(); // from LLView
+ virtual void draw(); // from LLView
- virtual void clear();
+ virtual void clear();
- virtual void setVisible(BOOL visible);
+ virtual void setVisible(BOOL visible);
- void setNameFilter(const std::string& filter);
- void setDirty(bool val = true, bool force_refresh = false);
- uuid_vec_t& getIDs() { return mIDs; }
- bool contains(const LLUUID& id);
+ void setNameFilter(const std::string& filter);
+ void setDirty(bool val = true, bool force_refresh = false);
+ uuid_vec_t& getIDs() { return mIDs; }
+ bool contains(const LLUUID& id);
- void setContextMenu(LLListContextMenu* menu) { mContextMenu = menu; }
- void setSessionID(const LLUUID& session_id) { mSessionID = session_id; }
- const LLUUID& getSessionID() { return mSessionID; }
+ void setContextMenu(LLListContextMenu* menu) { mContextMenu = menu; }
+ void setSessionID(const LLUUID& session_id) { mSessionID = session_id; }
+ const LLUUID& getSessionID() { return mSessionID; }
- void toggleIcons();
- void setSpeakingIndicatorsVisible(bool visible);
- void showPermissions(bool visible);
- void sortByName();
- void setShowIcons(std::string param_name);
- bool getIconsVisible() const { return mShowIcons; }
- const std::string getIconParamName() const{return mIconParamName;}
- std::string getAvatarName(LLAvatarName av_name);
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ void toggleIcons();
+ void setSpeakingIndicatorsVisible(bool visible);
+ void showPermissions(bool visible);
+ void sortByName();
+ void setShowIcons(std::string param_name);
+ bool getIconsVisible() const { return mShowIcons; }
+ const std::string getIconParamName() const{return mIconParamName;}
+ std::string getAvatarName(LLAvatarName av_name);
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- // Return true if filter has at least one match.
- bool filterHasMatches();
+ // Return true if filter has at least one match.
+ bool filterHasMatches();
- boost::signals2::connection setRefreshCompleteCallback(const commit_signal_t::slot_type& cb);
+ boost::signals2::connection setRefreshCompleteCallback(const commit_signal_t::slot_type& cb);
- boost::signals2::connection setItemDoubleClickCallback(const mouse_signal_t::slot_type& cb);
+ boost::signals2::connection setItemDoubleClickCallback(const mouse_signal_t::slot_type& cb);
- virtual S32 notifyParent(const LLSD& info);
+ virtual S32 notifyParent(const LLSD& info);
- void handleDisplayNamesOptionChanged();
+ void handleDisplayNamesOptionChanged();
- void setShowCompleteName(bool show) { mShowCompleteName = show;};
+ void setShowCompleteName(bool show) { mShowCompleteName = show;};
protected:
- void refresh();
-
- void addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos = ADD_BOTTOM);
- void computeDifference(
- const uuid_vec_t& vnew,
- uuid_vec_t& vadded,
- uuid_vec_t& vremoved);
- void updateLastInteractionTimes();
- void rebuildNames();
- void onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask);
- void updateAvatarNames();
+ void refresh();
+
+ void addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos = ADD_BOTTOM);
+ void computeDifference(
+ const uuid_vec_t& vnew,
+ uuid_vec_t& vadded,
+ uuid_vec_t& vremoved);
+ void updateLastInteractionTimes();
+ void rebuildNames();
+ void onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask);
+ void updateAvatarNames();
private:
- bool mIgnoreOnlineStatus;
- bool mShowLastInteractionTime;
- bool mDirty;
- bool mNeedUpdateNames;
- bool mShowIcons;
- bool mShowInfoBtn;
- bool mShowProfileBtn;
- bool mShowSpeakingIndicator;
- bool mShowPermissions;
- bool mShowCompleteName;
-
- LLTimer* mLITUpdateTimer; // last interaction time update timer
- std::string mIconParamName;
- std::string mNameFilter;
- uuid_vec_t mIDs;
- LLUUID mSessionID;
-
- LLListContextMenu* mContextMenu;
-
- commit_signal_t mRefreshCompleteSignal;
- mouse_signal_t mItemDoubleClickSignal;
+ bool mIgnoreOnlineStatus;
+ bool mShowLastInteractionTime;
+ bool mDirty;
+ bool mNeedUpdateNames;
+ bool mShowIcons;
+ bool mShowInfoBtn;
+ bool mShowProfileBtn;
+ bool mShowSpeakingIndicator;
+ bool mShowPermissions;
+ bool mShowCompleteName;
+
+ LLTimer* mLITUpdateTimer; // last interaction time update timer
+ std::string mIconParamName;
+ std::string mNameFilter;
+ uuid_vec_t mIDs;
+ LLUUID mSessionID;
+
+ LLListContextMenu* mContextMenu;
+
+ commit_signal_t mRefreshCompleteSignal;
+ mouse_signal_t mItemDoubleClickSignal;
};
/** Abstract comparator for avatar items */
class LLAvatarItemComparator : public LLFlatListView::ItemComparator
{
- LOG_CLASS(LLAvatarItemComparator);
+ LOG_CLASS(LLAvatarItemComparator);
public:
- LLAvatarItemComparator() {};
- virtual ~LLAvatarItemComparator() {};
+ LLAvatarItemComparator() {};
+ virtual ~LLAvatarItemComparator() {};
- virtual bool compare(const LLPanel* item1, const LLPanel* item2) const;
+ virtual bool compare(const LLPanel* item1, const LLPanel* item2) const;
protected:
- /**
- * Returns true if avatar_item1 < avatar_item2, false otherwise
- * Implement this method in your particular comparator.
- * In Linux a compiler failed to build it using the name "compare", so it was renamed to doCompare
- */
- virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const = 0;
+ /**
+ * Returns true if avatar_item1 < avatar_item2, false otherwise
+ * Implement this method in your particular comparator.
+ * In Linux a compiler failed to build it using the name "compare", so it was renamed to doCompare
+ */
+ virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const = 0;
};
class LLAvatarItemNameComparator : public LLAvatarItemComparator
{
- LOG_CLASS(LLAvatarItemNameComparator);
+ LOG_CLASS(LLAvatarItemNameComparator);
public:
- LLAvatarItemNameComparator() {};
- virtual ~LLAvatarItemNameComparator() {};
+ LLAvatarItemNameComparator() {};
+ virtual ~LLAvatarItemNameComparator() {};
protected:
- virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
+ virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
};
class LLAvatarItemAgentOnTopComparator : public LLAvatarItemNameComparator
{
- LOG_CLASS(LLAvatarItemAgentOnTopComparator);
+ LOG_CLASS(LLAvatarItemAgentOnTopComparator);
public:
- LLAvatarItemAgentOnTopComparator() {};
- virtual ~LLAvatarItemAgentOnTopComparator() {};
+ LLAvatarItemAgentOnTopComparator() {};
+ virtual ~LLAvatarItemAgentOnTopComparator() {};
protected:
- virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
+ virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
};
#endif // LL_LLAVATARLIST_H
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 396b69ae3a..5f243d18c0 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarlistitem.cpp
* @brief avatar list item source file
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,103 +50,103 @@ S32 LLAvatarListItem::sChildrenWidths[LLAvatarListItem::ALIC_COUNT];
static LLWidgetNameRegistry::StaticRegistrar sRegisterAvatarListItemParams(&typeid(LLAvatarListItem::Params), "avatar_list_item");
LLAvatarListItem::Params::Params()
-: default_style("default_style"),
- voice_call_invited_style("voice_call_invited_style"),
- voice_call_joined_style("voice_call_joined_style"),
- voice_call_left_style("voice_call_left_style"),
- online_style("online_style"),
- offline_style("offline_style"),
- name_right_pad("name_right_pad", 0)
+: default_style("default_style"),
+ voice_call_invited_style("voice_call_invited_style"),
+ voice_call_joined_style("voice_call_joined_style"),
+ voice_call_left_style("voice_call_left_style"),
+ online_style("online_style"),
+ offline_style("offline_style"),
+ name_right_pad("name_right_pad", 0)
{};
LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/)
- : LLPanel(),
- LLFriendObserver(),
- mAvatarIcon(NULL),
- mAvatarName(NULL),
- mLastInteractionTime(NULL),
- mIconPermissionOnline(NULL),
- mIconPermissionMap(NULL),
- mIconPermissionEditMine(NULL),
- mIconPermissionEditTheirs(NULL),
- mSpeakingIndicator(NULL),
- mInfoBtn(NULL),
- mProfileBtn(NULL),
- mOnlineStatus(E_UNKNOWN),
- mShowInfoBtn(true),
- mShowProfileBtn(true),
- mShowPermissions(false),
- mShowCompleteName(false),
- mHovered(false),
- mAvatarNameCacheConnection(),
- mGreyOutUsername("")
-{
- if (not_from_ui_factory)
- {
- buildFromFile("panel_avatar_list_item.xml");
- }
- // *NOTE: mantipov: do not use any member here. They can be uninitialized here in case instance
- // is created from the UICtrlFactory
+ : LLPanel(),
+ LLFriendObserver(),
+ mAvatarIcon(NULL),
+ mAvatarName(NULL),
+ mLastInteractionTime(NULL),
+ mIconPermissionOnline(NULL),
+ mIconPermissionMap(NULL),
+ mIconPermissionEditMine(NULL),
+ mIconPermissionEditTheirs(NULL),
+ mSpeakingIndicator(NULL),
+ mInfoBtn(NULL),
+ mProfileBtn(NULL),
+ mOnlineStatus(E_UNKNOWN),
+ mShowInfoBtn(true),
+ mShowProfileBtn(true),
+ mShowPermissions(false),
+ mShowCompleteName(false),
+ mHovered(false),
+ mAvatarNameCacheConnection(),
+ mGreyOutUsername("")
+{
+ if (not_from_ui_factory)
+ {
+ buildFromFile("panel_avatar_list_item.xml");
+ }
+ // *NOTE: mantipov: do not use any member here. They can be uninitialized here in case instance
+ // is created from the UICtrlFactory
}
LLAvatarListItem::~LLAvatarListItem()
{
- if (mAvatarId.notNull())
- {
- LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this);
- }
+ if (mAvatarId.notNull())
+ {
+ LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this);
+ }
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
}
BOOL LLAvatarListItem::postBuild()
{
- mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon");
- mAvatarName = getChild<LLTextBox>("avatar_name");
- mLastInteractionTime = getChild<LLTextBox>("last_interaction");
+ mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon");
+ mAvatarName = getChild<LLTextBox>("avatar_name");
+ mLastInteractionTime = getChild<LLTextBox>("last_interaction");
- mIconPermissionOnline = getChild<LLIconCtrl>("permission_online_icon");
- mIconPermissionMap = getChild<LLIconCtrl>("permission_map_icon");
- mIconPermissionEditMine = getChild<LLIconCtrl>("permission_edit_mine_icon");
- mIconPermissionEditTheirs = getChild<LLIconCtrl>("permission_edit_theirs_icon");
- mIconPermissionOnline->setVisible(false);
- mIconPermissionMap->setVisible(false);
- mIconPermissionEditMine->setVisible(false);
- mIconPermissionEditTheirs->setVisible(false);
+ mIconPermissionOnline = getChild<LLIconCtrl>("permission_online_icon");
+ mIconPermissionMap = getChild<LLIconCtrl>("permission_map_icon");
+ mIconPermissionEditMine = getChild<LLIconCtrl>("permission_edit_mine_icon");
+ mIconPermissionEditTheirs = getChild<LLIconCtrl>("permission_edit_theirs_icon");
+ mIconPermissionOnline->setVisible(false);
+ mIconPermissionMap->setVisible(false);
+ mIconPermissionEditMine->setVisible(false);
+ mIconPermissionEditTheirs->setVisible(false);
- mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
- mSpeakingIndicator->setChannelState(LLOutputMonitorCtrl::UNDEFINED_CHANNEL);
- mInfoBtn = getChild<LLButton>("info_btn");
- mProfileBtn = getChild<LLButton>("profile_btn");
+ mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
+ mSpeakingIndicator->setChannelState(LLOutputMonitorCtrl::UNDEFINED_CHANNEL);
+ mInfoBtn = getChild<LLButton>("info_btn");
+ mProfileBtn = getChild<LLButton>("profile_btn");
- mInfoBtn->setVisible(false);
- mInfoBtn->setClickedCallback(boost::bind(&LLAvatarListItem::onInfoBtnClick, this));
+ mInfoBtn->setVisible(false);
+ mInfoBtn->setClickedCallback(boost::bind(&LLAvatarListItem::onInfoBtnClick, this));
- mProfileBtn->setVisible(false);
- mProfileBtn->setClickedCallback(boost::bind(&LLAvatarListItem::onProfileBtnClick, this));
+ mProfileBtn->setVisible(false);
+ mProfileBtn->setClickedCallback(boost::bind(&LLAvatarListItem::onProfileBtnClick, this));
- if (!sStaticInitialized)
- {
- // Remember children widths including their padding from the next sibling,
- // so that we can hide and show them again later.
- initChildrenWidths(this);
+ if (!sStaticInitialized)
+ {
+ // Remember children widths including their padding from the next sibling,
+ // so that we can hide and show them again later.
+ initChildrenWidths(this);
- // Right padding between avatar name text box and nearest visible child.
- sNameRightPadding = LLUICtrlFactory::getDefaultParams<LLAvatarListItem>().name_right_pad;
+ // Right padding between avatar name text box and nearest visible child.
+ sNameRightPadding = LLUICtrlFactory::getDefaultParams<LLAvatarListItem>().name_right_pad;
- sStaticInitialized = true;
- }
+ sStaticInitialized = true;
+ }
- return TRUE;
+ return TRUE;
}
void LLAvatarListItem::handleVisibilityChange ( BOOL new_visibility )
{
- //Adjust positions of icons (info button etc) when
+ //Adjust positions of icons (info button etc) when
//speaking indicator visibility was changed/toggled while panel was closed (not visible)
if(new_visibility && mSpeakingIndicator->getIndicatorToggled())
{
@@ -157,245 +157,245 @@ void LLAvatarListItem::handleVisibilityChange ( BOOL new_visibility )
void LLAvatarListItem::fetchAvatarName()
{
- if (mAvatarId.notNull())
- {
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2));
- }
+ if (mAvatarId.notNull())
+ {
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2));
+ }
}
S32 LLAvatarListItem::notifyParent(const LLSD& info)
{
- if (info.has("visibility_changed"))
- {
- updateChildren();
- return 1;
- }
- return LLPanel::notifyParent(info);
+ if (info.has("visibility_changed"))
+ {
+ updateChildren();
+ return 1;
+ }
+ return LLPanel::notifyParent(info);
}
void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible( true);
- mInfoBtn->setVisible(mShowInfoBtn);
- mProfileBtn->setVisible(mShowProfileBtn);
+ getChildView("hovered_icon")->setVisible( true);
+ mInfoBtn->setVisible(mShowInfoBtn);
+ mProfileBtn->setVisible(mShowProfileBtn);
- mHovered = true;
- LLPanel::onMouseEnter(x, y, mask);
+ mHovered = true;
+ LLPanel::onMouseEnter(x, y, mask);
- showPermissions(mShowPermissions);
- updateChildren();
+ showPermissions(mShowPermissions);
+ updateChildren();
}
void LLAvatarListItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible( false);
- mInfoBtn->setVisible(false);
- mProfileBtn->setVisible(false);
+ getChildView("hovered_icon")->setVisible( false);
+ mInfoBtn->setVisible(false);
+ mProfileBtn->setVisible(false);
- mHovered = false;
- LLPanel::onMouseLeave(x, y, mask);
+ mHovered = false;
+ LLPanel::onMouseLeave(x, y, mask);
- showPermissions(false);
- updateChildren();
+ showPermissions(false);
+ updateChildren();
}
// virtual, called by LLAvatarTracker
void LLAvatarListItem::changed(U32 mask)
{
- // no need to check mAvatarId for null in this case
- setOnline(LLAvatarTracker::instance().isBuddyOnline(mAvatarId));
+ // no need to check mAvatarId for null in this case
+ setOnline(LLAvatarTracker::instance().isBuddyOnline(mAvatarId));
- if (mask & LLFriendObserver::POWERS)
- {
- showPermissions(mShowPermissions && mHovered);
- updateChildren();
- }
+ if (mask & LLFriendObserver::POWERS)
+ {
+ showPermissions(mShowPermissions && mHovered);
+ updateChildren();
+ }
}
void LLAvatarListItem::setOnline(bool online)
{
- // *FIX: setName() overrides font style set by setOnline(). Not an issue ATM.
+ // *FIX: setName() overrides font style set by setOnline(). Not an issue ATM.
- if (mOnlineStatus != E_UNKNOWN && (bool) mOnlineStatus == online)
- return;
+ if (mOnlineStatus != E_UNKNOWN && (bool) mOnlineStatus == online)
+ return;
- mOnlineStatus = (EOnlineStatus) online;
+ mOnlineStatus = (EOnlineStatus) online;
- // Change avatar name font style depending on the new online status.
- setState(online ? IS_ONLINE : IS_OFFLINE);
+ // Change avatar name font style depending on the new online status.
+ setState(online ? IS_ONLINE : IS_OFFLINE);
}
void LLAvatarListItem::setAvatarName(const std::string& name)
{
- setNameInternal(name, mHighlihtSubstring);
+ setNameInternal(name, mHighlihtSubstring);
}
void LLAvatarListItem::setAvatarToolTip(const std::string& tooltip)
{
- mAvatarName->setToolTip(tooltip);
+ mAvatarName->setToolTip(tooltip);
}
void LLAvatarListItem::setHighlight(const std::string& highlight)
{
- setNameInternal(mAvatarName->getText(), mHighlihtSubstring = highlight);
+ setNameInternal(mAvatarName->getText(), mHighlihtSubstring = highlight);
}
void LLAvatarListItem::setState(EItemState item_style)
{
- const LLAvatarListItem::Params& params = LLUICtrlFactory::getDefaultParams<LLAvatarListItem>();
-
- switch(item_style)
- {
- default:
- case IS_DEFAULT:
- mAvatarNameStyle = params.default_style();
- break;
- case IS_VOICE_INVITED:
- mAvatarNameStyle = params.voice_call_invited_style();
- break;
- case IS_VOICE_JOINED:
- mAvatarNameStyle = params.voice_call_joined_style();
- break;
- case IS_VOICE_LEFT:
- mAvatarNameStyle = params.voice_call_left_style();
- break;
- case IS_ONLINE:
- mAvatarNameStyle = params.online_style();
- break;
- case IS_OFFLINE:
- mAvatarNameStyle = params.offline_style();
- break;
- }
-
- // *NOTE: You cannot set the style on a text box anymore, you must
- // rebuild the text. This will cause problems if the text contains
- // hyperlinks, as their styles will be wrong.
- setNameInternal(mAvatarName->getText(), mHighlihtSubstring);
-
- icon_color_map_t& item_icon_color_map = getItemIconColorMap();
- mAvatarIcon->setColor(item_icon_color_map[item_style]);
+ const LLAvatarListItem::Params& params = LLUICtrlFactory::getDefaultParams<LLAvatarListItem>();
+
+ switch(item_style)
+ {
+ default:
+ case IS_DEFAULT:
+ mAvatarNameStyle = params.default_style();
+ break;
+ case IS_VOICE_INVITED:
+ mAvatarNameStyle = params.voice_call_invited_style();
+ break;
+ case IS_VOICE_JOINED:
+ mAvatarNameStyle = params.voice_call_joined_style();
+ break;
+ case IS_VOICE_LEFT:
+ mAvatarNameStyle = params.voice_call_left_style();
+ break;
+ case IS_ONLINE:
+ mAvatarNameStyle = params.online_style();
+ break;
+ case IS_OFFLINE:
+ mAvatarNameStyle = params.offline_style();
+ break;
+ }
+
+ // *NOTE: You cannot set the style on a text box anymore, you must
+ // rebuild the text. This will cause problems if the text contains
+ // hyperlinks, as their styles will be wrong.
+ setNameInternal(mAvatarName->getText(), mHighlihtSubstring);
+
+ icon_color_map_t& item_icon_color_map = getItemIconColorMap();
+ mAvatarIcon->setColor(item_icon_color_map[item_style]);
}
void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes/* = false*/, bool is_resident/* = true*/)
{
- if (mAvatarId.notNull())
- LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this);
+ if (mAvatarId.notNull())
+ LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this);
- mAvatarId = id;
- mSpeakingIndicator->setSpeakerId(id, session_id);
+ mAvatarId = id;
+ mSpeakingIndicator->setSpeakerId(id, session_id);
- // We'll be notified on avatar online status changes
- if (!ignore_status_changes && mAvatarId.notNull())
- LLAvatarTracker::instance().addParticularFriendObserver(mAvatarId, this);
+ // We'll be notified on avatar online status changes
+ if (!ignore_status_changes && mAvatarId.notNull())
+ LLAvatarTracker::instance().addParticularFriendObserver(mAvatarId, this);
- if (is_resident)
- {
- mAvatarIcon->setValue(id);
+ if (is_resident)
+ {
+ mAvatarIcon->setValue(id);
- // Set avatar name.
- fetchAvatarName();
- }
+ // Set avatar name.
+ fetchAvatarName();
+ }
}
void LLAvatarListItem::showLastInteractionTime(bool show)
{
- mLastInteractionTime->setVisible(show);
- updateChildren();
+ mLastInteractionTime->setVisible(show);
+ updateChildren();
}
void LLAvatarListItem::setLastInteractionTime(U32 secs_since)
{
- mLastInteractionTime->setValue(formatSeconds(secs_since));
+ mLastInteractionTime->setValue(formatSeconds(secs_since));
}
void LLAvatarListItem::setShowInfoBtn(bool show)
{
- mShowInfoBtn = show;
+ mShowInfoBtn = show;
}
void LLAvatarListItem::setShowProfileBtn(bool show)
{
- mShowProfileBtn = show;
+ mShowProfileBtn = show;
}
void LLAvatarListItem::showSpeakingIndicator(bool visible)
{
- // Already done? Then do nothing.
- if (mSpeakingIndicator->getVisible() == (BOOL)visible)
- return;
+ // Already done? Then do nothing.
+ if (mSpeakingIndicator->getVisible() == (BOOL)visible)
+ return;
// Disabled to not contradict with SpeakingIndicatorManager functionality. EXT-3976
// probably this method should be totally removed.
-// mSpeakingIndicator->setVisible(visible);
-// updateChildren();
+// mSpeakingIndicator->setVisible(visible);
+// updateChildren();
}
void LLAvatarListItem::setAvatarIconVisible(bool visible)
{
- // Already done? Then do nothing.
- if (mAvatarIcon->getVisible() == (BOOL)visible)
- {
- return;
- }
+ // Already done? Then do nothing.
+ if (mAvatarIcon->getVisible() == (BOOL)visible)
+ {
+ return;
+ }
- // Show/hide avatar icon.
- mAvatarIcon->setVisible(visible);
- updateChildren();
+ // Show/hide avatar icon.
+ mAvatarIcon->setVisible(visible);
+ updateChildren();
}
void LLAvatarListItem::onInfoBtnClick()
{
- LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarId));
+ LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarId));
}
void LLAvatarListItem::onProfileBtnClick()
{
- LLAvatarActions::showProfile(mAvatarId);
+ LLAvatarActions::showProfile(mAvatarId);
}
BOOL LLAvatarListItem::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- if(mInfoBtn->getRect().pointInRect(x, y))
- {
- onInfoBtnClick();
- return TRUE;
- }
- if(mProfileBtn->getRect().pointInRect(x, y))
- {
- onProfileBtnClick();
- return TRUE;
- }
- return LLPanel::handleDoubleClick(x, y, mask);
+ if(mInfoBtn->getRect().pointInRect(x, y))
+ {
+ onInfoBtnClick();
+ return TRUE;
+ }
+ if(mProfileBtn->getRect().pointInRect(x, y))
+ {
+ onProfileBtnClick();
+ return TRUE;
+ }
+ return LLPanel::handleDoubleClick(x, y, mask);
}
void LLAvatarListItem::setValue( const LLSD& value )
{
- if (!value.isMap()) return;;
- if (!value.has("selected")) return;
- getChildView("selected_icon")->setVisible( value["selected"]);
+ if (!value.isMap()) return;;
+ if (!value.has("selected")) return;
+ getChildView("selected_icon")->setVisible( value["selected"]);
}
const LLUUID& LLAvatarListItem::getAvatarId() const
{
- return mAvatarId;
+ return mAvatarId;
}
std::string LLAvatarListItem::getAvatarName() const
{
- return mAvatarName->getValue();
+ return mAvatarName->getValue();
}
std::string LLAvatarListItem::getAvatarToolTip() const
{
- return mAvatarName->getToolTip();
+ return mAvatarName->getToolTip();
}
void LLAvatarListItem::updateAvatarName()
{
- fetchAvatarName();
+ fetchAvatarName();
}
//== PRIVATE SECITON ==========================================================
@@ -414,288 +414,288 @@ void LLAvatarListItem::setNameInternal(const std::string& name, const std::strin
void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name)
{
- mAvatarNameCacheConnection.disconnect();
+ mAvatarNameCacheConnection.disconnect();
- mGreyOutUsername = "";
- std::string name_string = mShowCompleteName? av_name.getCompleteName(false) : av_name.getDisplayName();
- if(av_name.getCompleteName() != av_name.getUserName())
- {
- mGreyOutUsername = "[ " + av_name.getUserName(true) + " ]";
- LLStringUtil::toLower(mGreyOutUsername);
- }
- setAvatarName(name_string);
- setAvatarToolTip(av_name.getUserName());
+ mGreyOutUsername = "";
+ std::string name_string = mShowCompleteName? av_name.getCompleteName(false) : av_name.getDisplayName();
+ if(av_name.getCompleteName() != av_name.getUserName())
+ {
+ mGreyOutUsername = "[ " + av_name.getUserName(true) + " ]";
+ LLStringUtil::toLower(mGreyOutUsername);
+ }
+ setAvatarName(name_string);
+ setAvatarToolTip(av_name.getUserName());
- //requesting the list to resort
- notifyParent(LLSD().with("sort", LLSD()));
+ //requesting the list to resort
+ notifyParent(LLSD().with("sort", LLSD()));
}
// Convert given number of seconds to a string like "23 minutes", "15 hours" or "3 years",
// taking i18n into account. The format string to use is taken from the panel XML.
std::string LLAvatarListItem::formatSeconds(U32 secs)
{
- static const U32 LL_ALI_MIN = 60;
- static const U32 LL_ALI_HOUR = LL_ALI_MIN * 60;
- static const U32 LL_ALI_DAY = LL_ALI_HOUR * 24;
- static const U32 LL_ALI_WEEK = LL_ALI_DAY * 7;
- static const U32 LL_ALI_MONTH = LL_ALI_DAY * 30;
- static const U32 LL_ALI_YEAR = LL_ALI_DAY * 365;
-
- std::string fmt;
- U32 count = 0;
-
- if (secs >= LL_ALI_YEAR)
- {
- fmt = "FormatYears"; count = secs / LL_ALI_YEAR;
- }
- else if (secs >= LL_ALI_MONTH)
- {
- fmt = "FormatMonths"; count = secs / LL_ALI_MONTH;
- }
- else if (secs >= LL_ALI_WEEK)
- {
- fmt = "FormatWeeks"; count = secs / LL_ALI_WEEK;
- }
- else if (secs >= LL_ALI_DAY)
- {
- fmt = "FormatDays"; count = secs / LL_ALI_DAY;
- }
- else if (secs >= LL_ALI_HOUR)
- {
- fmt = "FormatHours"; count = secs / LL_ALI_HOUR;
- }
- else if (secs >= LL_ALI_MIN)
- {
- fmt = "FormatMinutes"; count = secs / LL_ALI_MIN;
- }
- else
- {
- fmt = "FormatSeconds"; count = secs;
- }
-
- LLStringUtil::format_map_t args;
- args["[COUNT]"] = llformat("%u", count);
- return getString(fmt, args);
+ static const U32 LL_ALI_MIN = 60;
+ static const U32 LL_ALI_HOUR = LL_ALI_MIN * 60;
+ static const U32 LL_ALI_DAY = LL_ALI_HOUR * 24;
+ static const U32 LL_ALI_WEEK = LL_ALI_DAY * 7;
+ static const U32 LL_ALI_MONTH = LL_ALI_DAY * 30;
+ static const U32 LL_ALI_YEAR = LL_ALI_DAY * 365;
+
+ std::string fmt;
+ U32 count = 0;
+
+ if (secs >= LL_ALI_YEAR)
+ {
+ fmt = "FormatYears"; count = secs / LL_ALI_YEAR;
+ }
+ else if (secs >= LL_ALI_MONTH)
+ {
+ fmt = "FormatMonths"; count = secs / LL_ALI_MONTH;
+ }
+ else if (secs >= LL_ALI_WEEK)
+ {
+ fmt = "FormatWeeks"; count = secs / LL_ALI_WEEK;
+ }
+ else if (secs >= LL_ALI_DAY)
+ {
+ fmt = "FormatDays"; count = secs / LL_ALI_DAY;
+ }
+ else if (secs >= LL_ALI_HOUR)
+ {
+ fmt = "FormatHours"; count = secs / LL_ALI_HOUR;
+ }
+ else if (secs >= LL_ALI_MIN)
+ {
+ fmt = "FormatMinutes"; count = secs / LL_ALI_MIN;
+ }
+ else
+ {
+ fmt = "FormatSeconds"; count = secs;
+ }
+
+ LLStringUtil::format_map_t args;
+ args["[COUNT]"] = llformat("%u", count);
+ return getString(fmt, args);
}
// static
LLAvatarListItem::icon_color_map_t& LLAvatarListItem::getItemIconColorMap()
{
- static icon_color_map_t item_icon_color_map;
- if (!item_icon_color_map.empty()) return item_icon_color_map;
+ static icon_color_map_t item_icon_color_map;
+ if (!item_icon_color_map.empty()) return item_icon_color_map;
- item_icon_color_map.insert(
- std::make_pair(IS_DEFAULT,
- LLUIColorTable::instance().getColor("AvatarListItemIconDefaultColor", LLColor4::white)));
+ item_icon_color_map.insert(
+ std::make_pair(IS_DEFAULT,
+ LLUIColorTable::instance().getColor("AvatarListItemIconDefaultColor", LLColor4::white)));
- item_icon_color_map.insert(
- std::make_pair(IS_VOICE_INVITED,
- LLUIColorTable::instance().getColor("AvatarListItemIconVoiceInvitedColor", LLColor4::white)));
+ item_icon_color_map.insert(
+ std::make_pair(IS_VOICE_INVITED,
+ LLUIColorTable::instance().getColor("AvatarListItemIconVoiceInvitedColor", LLColor4::white)));
- item_icon_color_map.insert(
- std::make_pair(IS_VOICE_JOINED,
- LLUIColorTable::instance().getColor("AvatarListItemIconVoiceJoinedColor", LLColor4::white)));
+ item_icon_color_map.insert(
+ std::make_pair(IS_VOICE_JOINED,
+ LLUIColorTable::instance().getColor("AvatarListItemIconVoiceJoinedColor", LLColor4::white)));
- item_icon_color_map.insert(
- std::make_pair(IS_VOICE_LEFT,
- LLUIColorTable::instance().getColor("AvatarListItemIconVoiceLeftColor", LLColor4::white)));
+ item_icon_color_map.insert(
+ std::make_pair(IS_VOICE_LEFT,
+ LLUIColorTable::instance().getColor("AvatarListItemIconVoiceLeftColor", LLColor4::white)));
- item_icon_color_map.insert(
- std::make_pair(IS_ONLINE,
- LLUIColorTable::instance().getColor("AvatarListItemIconOnlineColor", LLColor4::white)));
+ item_icon_color_map.insert(
+ std::make_pair(IS_ONLINE,
+ LLUIColorTable::instance().getColor("AvatarListItemIconOnlineColor", LLColor4::white)));
- item_icon_color_map.insert(
- std::make_pair(IS_OFFLINE,
- LLUIColorTable::instance().getColor("AvatarListItemIconOfflineColor", LLColor4::white)));
+ item_icon_color_map.insert(
+ std::make_pair(IS_OFFLINE,
+ LLUIColorTable::instance().getColor("AvatarListItemIconOfflineColor", LLColor4::white)));
- return item_icon_color_map;
+ return item_icon_color_map;
}
// static
void LLAvatarListItem::initChildrenWidths(LLAvatarListItem* avatar_item)
{
- //speaking indicator width + padding
- S32 speaking_indicator_width = avatar_item->getRect().getWidth() - avatar_item->mSpeakingIndicator->getRect().mLeft;
+ //speaking indicator width + padding
+ S32 speaking_indicator_width = avatar_item->getRect().getWidth() - avatar_item->mSpeakingIndicator->getRect().mLeft;
- //profile btn width + padding
- S32 profile_btn_width = avatar_item->mSpeakingIndicator->getRect().mLeft - avatar_item->mProfileBtn->getRect().mLeft;
+ //profile btn width + padding
+ S32 profile_btn_width = avatar_item->mSpeakingIndicator->getRect().mLeft - avatar_item->mProfileBtn->getRect().mLeft;
- //info btn width + padding
- S32 info_btn_width = avatar_item->mProfileBtn->getRect().mLeft - avatar_item->mInfoBtn->getRect().mLeft;
+ //info btn width + padding
+ S32 info_btn_width = avatar_item->mProfileBtn->getRect().mLeft - avatar_item->mInfoBtn->getRect().mLeft;
- // online permission icon width + padding
- S32 permission_online_width = avatar_item->mInfoBtn->getRect().mLeft - avatar_item->mIconPermissionOnline->getRect().mLeft;
+ // online permission icon width + padding
+ S32 permission_online_width = avatar_item->mInfoBtn->getRect().mLeft - avatar_item->mIconPermissionOnline->getRect().mLeft;
- // map permission icon width + padding
- S32 permission_map_width = avatar_item->mIconPermissionOnline->getRect().mLeft - avatar_item->mIconPermissionMap->getRect().mLeft;
+ // map permission icon width + padding
+ S32 permission_map_width = avatar_item->mIconPermissionOnline->getRect().mLeft - avatar_item->mIconPermissionMap->getRect().mLeft;
- // edit my objects permission icon width + padding
- S32 permission_edit_mine_width = avatar_item->mIconPermissionMap->getRect().mLeft - avatar_item->mIconPermissionEditMine->getRect().mLeft;
+ // edit my objects permission icon width + padding
+ S32 permission_edit_mine_width = avatar_item->mIconPermissionMap->getRect().mLeft - avatar_item->mIconPermissionEditMine->getRect().mLeft;
- // edit their objects permission icon width + padding
- S32 permission_edit_theirs_width = avatar_item->mIconPermissionEditMine->getRect().mLeft - avatar_item->mIconPermissionEditTheirs->getRect().mLeft;
+ // edit their objects permission icon width + padding
+ S32 permission_edit_theirs_width = avatar_item->mIconPermissionEditMine->getRect().mLeft - avatar_item->mIconPermissionEditTheirs->getRect().mLeft;
- // last interaction time textbox width + padding
- S32 last_interaction_time_width = avatar_item->mIconPermissionEditTheirs->getRect().mLeft - avatar_item->mLastInteractionTime->getRect().mLeft;
+ // last interaction time textbox width + padding
+ S32 last_interaction_time_width = avatar_item->mIconPermissionEditTheirs->getRect().mLeft - avatar_item->mLastInteractionTime->getRect().mLeft;
- // avatar icon width + padding
- S32 icon_width = avatar_item->mAvatarName->getRect().mLeft - avatar_item->mAvatarIcon->getRect().mLeft;
+ // avatar icon width + padding
+ S32 icon_width = avatar_item->mAvatarName->getRect().mLeft - avatar_item->mAvatarIcon->getRect().mLeft;
- sLeftPadding = avatar_item->mAvatarIcon->getRect().mLeft;
+ sLeftPadding = avatar_item->mAvatarIcon->getRect().mLeft;
- S32 index = ALIC_COUNT;
- sChildrenWidths[--index] = icon_width;
- sChildrenWidths[--index] = 0; // for avatar name we don't need its width, it will be calculated as "left available space"
- sChildrenWidths[--index] = last_interaction_time_width;
- sChildrenWidths[--index] = permission_edit_theirs_width;
- sChildrenWidths[--index] = permission_edit_mine_width;
- sChildrenWidths[--index] = permission_map_width;
- sChildrenWidths[--index] = permission_online_width;
- sChildrenWidths[--index] = info_btn_width;
- sChildrenWidths[--index] = profile_btn_width;
- sChildrenWidths[--index] = speaking_indicator_width;
- llassert(index == 0);
+ S32 index = ALIC_COUNT;
+ sChildrenWidths[--index] = icon_width;
+ sChildrenWidths[--index] = 0; // for avatar name we don't need its width, it will be calculated as "left available space"
+ sChildrenWidths[--index] = last_interaction_time_width;
+ sChildrenWidths[--index] = permission_edit_theirs_width;
+ sChildrenWidths[--index] = permission_edit_mine_width;
+ sChildrenWidths[--index] = permission_map_width;
+ sChildrenWidths[--index] = permission_online_width;
+ sChildrenWidths[--index] = info_btn_width;
+ sChildrenWidths[--index] = profile_btn_width;
+ sChildrenWidths[--index] = speaking_indicator_width;
+ llassert(index == 0);
}
void LLAvatarListItem::updateChildren()
{
- LL_DEBUGS("AvatarItemReshape") << LL_ENDL;
- LL_DEBUGS("AvatarItemReshape") << "Updating for: " << getAvatarName() << LL_ENDL;
-
- S32 name_new_width = getRect().getWidth();
- S32 ctrl_new_left = name_new_width;
- S32 name_new_left = sLeftPadding;
-
- // iterate through all children and set them into correct position depend on each child visibility
- // assume that child indexes are in back order: the first in Enum is the last (right) in the item
- // iterate & set child views starting from right to left
- for (S32 i = 0; i < ALIC_COUNT; ++i)
- {
- // skip "name" textbox, it will be processed out of loop later
- if (ALIC_NAME == i) continue;
-
- LLView* control = getItemChildView((EAvatarListItemChildIndex)i);
+ LL_DEBUGS("AvatarItemReshape") << LL_ENDL;
+ LL_DEBUGS("AvatarItemReshape") << "Updating for: " << getAvatarName() << LL_ENDL;
- LL_DEBUGS("AvatarItemReshape") << "Processing control: " << control->getName() << LL_ENDL;
- // skip invisible views
- if (!control->getVisible()) continue;
+ S32 name_new_width = getRect().getWidth();
+ S32 ctrl_new_left = name_new_width;
+ S32 name_new_left = sLeftPadding;
- S32 ctrl_width = sChildrenWidths[i]; // including space between current & left controls
-
- // decrease available for
- name_new_width -= ctrl_width;
- LL_DEBUGS("AvatarItemReshape") << "width: " << ctrl_width << ", name_new_width: " << name_new_width << LL_ENDL;
-
- LLRect control_rect = control->getRect();
- LL_DEBUGS("AvatarItemReshape") << "rect before: " << control_rect << LL_ENDL;
-
- if (ALIC_ICON == i)
- {
- // assume that this is the last iteration,
- // so it is not necessary to save "ctrl_new_left" value calculated on previous iterations
- ctrl_new_left = sLeftPadding;
- name_new_left = ctrl_new_left + ctrl_width;
- }
- else
- {
- ctrl_new_left -= ctrl_width;
- }
-
- LL_DEBUGS("AvatarItemReshape") << "ctrl_new_left: " << ctrl_new_left << LL_ENDL;
-
- control_rect.setLeftTopAndSize(
- ctrl_new_left,
- control_rect.mTop,
- control_rect.getWidth(),
- control_rect.getHeight());
-
- LL_DEBUGS("AvatarItemReshape") << "rect after: " << control_rect << LL_ENDL;
- control->setShape(control_rect);
- }
+ // iterate through all children and set them into correct position depend on each child visibility
+ // assume that child indexes are in back order: the first in Enum is the last (right) in the item
+ // iterate & set child views starting from right to left
+ for (S32 i = 0; i < ALIC_COUNT; ++i)
+ {
+ // skip "name" textbox, it will be processed out of loop later
+ if (ALIC_NAME == i) continue;
+
+ LLView* control = getItemChildView((EAvatarListItemChildIndex)i);
+
+ LL_DEBUGS("AvatarItemReshape") << "Processing control: " << control->getName() << LL_ENDL;
+ // skip invisible views
+ if (!control->getVisible()) continue;
+
+ S32 ctrl_width = sChildrenWidths[i]; // including space between current & left controls
+
+ // decrease available for
+ name_new_width -= ctrl_width;
+ LL_DEBUGS("AvatarItemReshape") << "width: " << ctrl_width << ", name_new_width: " << name_new_width << LL_ENDL;
+
+ LLRect control_rect = control->getRect();
+ LL_DEBUGS("AvatarItemReshape") << "rect before: " << control_rect << LL_ENDL;
+
+ if (ALIC_ICON == i)
+ {
+ // assume that this is the last iteration,
+ // so it is not necessary to save "ctrl_new_left" value calculated on previous iterations
+ ctrl_new_left = sLeftPadding;
+ name_new_left = ctrl_new_left + ctrl_width;
+ }
+ else
+ {
+ ctrl_new_left -= ctrl_width;
+ }
+
+ LL_DEBUGS("AvatarItemReshape") << "ctrl_new_left: " << ctrl_new_left << LL_ENDL;
+
+ control_rect.setLeftTopAndSize(
+ ctrl_new_left,
+ control_rect.mTop,
+ control_rect.getWidth(),
+ control_rect.getHeight());
+
+ LL_DEBUGS("AvatarItemReshape") << "rect after: " << control_rect << LL_ENDL;
+ control->setShape(control_rect);
+ }
- // set size and position of the "name" child
- LLView* name_view = getItemChildView(ALIC_NAME);
- LLRect name_view_rect = name_view->getRect();
- LL_DEBUGS("AvatarItemReshape") << "name rect before: " << name_view_rect << LL_ENDL;
+ // set size and position of the "name" child
+ LLView* name_view = getItemChildView(ALIC_NAME);
+ LLRect name_view_rect = name_view->getRect();
+ LL_DEBUGS("AvatarItemReshape") << "name rect before: " << name_view_rect << LL_ENDL;
- // apply paddings
- name_new_width -= sLeftPadding;
- name_new_width -= sNameRightPadding;
+ // apply paddings
+ name_new_width -= sLeftPadding;
+ name_new_width -= sNameRightPadding;
- name_view_rect.setLeftTopAndSize(
- name_new_left,
- name_view_rect.mTop,
- name_new_width,
- name_view_rect.getHeight());
+ name_view_rect.setLeftTopAndSize(
+ name_new_left,
+ name_view_rect.mTop,
+ name_new_width,
+ name_view_rect.getHeight());
- name_view->setShape(name_view_rect);
+ name_view->setShape(name_view_rect);
- LL_DEBUGS("AvatarItemReshape") << "name rect after: " << name_view_rect << LL_ENDL;
+ LL_DEBUGS("AvatarItemReshape") << "name rect after: " << name_view_rect << LL_ENDL;
}
bool LLAvatarListItem::showPermissions(bool visible)
{
- const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
- if(relation && visible)
- {
- mIconPermissionOnline->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS));
- mIconPermissionMap->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION));
- mIconPermissionEditMine->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS));
- mIconPermissionEditTheirs->setVisible(relation->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS));
- }
- else
- {
- mIconPermissionOnline->setVisible(false);
- mIconPermissionMap->setVisible(false);
- mIconPermissionEditMine->setVisible(false);
- mIconPermissionEditTheirs->setVisible(false);
- }
-
- return NULL != relation;
+ const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
+ if(relation && visible)
+ {
+ mIconPermissionOnline->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS));
+ mIconPermissionMap->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION));
+ mIconPermissionEditMine->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS));
+ mIconPermissionEditTheirs->setVisible(relation->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS));
+ }
+ else
+ {
+ mIconPermissionOnline->setVisible(false);
+ mIconPermissionMap->setVisible(false);
+ mIconPermissionEditMine->setVisible(false);
+ mIconPermissionEditTheirs->setVisible(false);
+ }
+
+ return NULL != relation;
}
LLView* LLAvatarListItem::getItemChildView(EAvatarListItemChildIndex child_view_index)
{
- LLView* child_view = mAvatarName;
-
- switch (child_view_index)
- {
- case ALIC_ICON:
- child_view = mAvatarIcon;
- break;
- case ALIC_NAME:
- child_view = mAvatarName;
- break;
- case ALIC_INTERACTION_TIME:
- child_view = mLastInteractionTime;
- break;
- case ALIC_SPEAKER_INDICATOR:
- child_view = mSpeakingIndicator;
- break;
- case ALIC_PERMISSION_ONLINE:
- child_view = mIconPermissionOnline;
- break;
- case ALIC_PERMISSION_MAP:
- child_view = mIconPermissionMap;
- break;
- case ALIC_PERMISSION_EDIT_MINE:
- child_view = mIconPermissionEditMine;
- break;
- case ALIC_PERMISSION_EDIT_THEIRS:
- child_view = mIconPermissionEditTheirs;
- break;
- case ALIC_INFO_BUTTON:
- child_view = mInfoBtn;
- break;
- case ALIC_PROFILE_BUTTON:
- child_view = mProfileBtn;
- break;
- default:
- LL_WARNS("AvatarItemReshape") << "Unexpected child view index is passed: " << child_view_index << LL_ENDL;
- // leave child_view untouched
- }
-
- return child_view;
+ LLView* child_view = mAvatarName;
+
+ switch (child_view_index)
+ {
+ case ALIC_ICON:
+ child_view = mAvatarIcon;
+ break;
+ case ALIC_NAME:
+ child_view = mAvatarName;
+ break;
+ case ALIC_INTERACTION_TIME:
+ child_view = mLastInteractionTime;
+ break;
+ case ALIC_SPEAKER_INDICATOR:
+ child_view = mSpeakingIndicator;
+ break;
+ case ALIC_PERMISSION_ONLINE:
+ child_view = mIconPermissionOnline;
+ break;
+ case ALIC_PERMISSION_MAP:
+ child_view = mIconPermissionMap;
+ break;
+ case ALIC_PERMISSION_EDIT_MINE:
+ child_view = mIconPermissionEditMine;
+ break;
+ case ALIC_PERMISSION_EDIT_THEIRS:
+ child_view = mIconPermissionEditTheirs;
+ break;
+ case ALIC_INFO_BUTTON:
+ child_view = mInfoBtn;
+ break;
+ case ALIC_PROFILE_BUTTON:
+ child_view = mProfileBtn;
+ break;
+ default:
+ LL_WARNS("AvatarItemReshape") << "Unexpected child view index is passed: " << child_view_index << LL_ENDL;
+ // leave child_view untouched
+ }
+
+ return child_view;
}
// EOF
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index b95cd68526..3f6dcb0783 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarlistitem.h
* @brief avatar list item header file
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,198 +44,198 @@ class LLIconCtrl;
class LLAvatarListItem : public LLPanel, public LLFriendObserver
{
public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {
- Optional<LLStyle::Params> default_style,
- voice_call_invited_style,
- voice_call_joined_style,
- voice_call_left_style,
- online_style,
- offline_style;
-
- Optional<S32> name_right_pad;
-
- Params();
- };
-
- typedef enum e_item_state_type {
- IS_DEFAULT,
- IS_VOICE_INVITED,
- IS_VOICE_JOINED,
- IS_VOICE_LEFT,
- IS_ONLINE,
- IS_OFFLINE,
- } EItemState;
-
- /**
- * Creates an instance of LLAvatarListItem.
- *
- * It is not registered with LLDefaultChildRegistry. It is built via LLUICtrlFactory::buildPanel
- * or via registered LLCallbackMap depend on passed parameter.
- *
- * @param not_from_ui_factory if true instance will be build with LLUICtrlFactory::buildPanel
- * otherwise it should be registered via LLCallbackMap before creating.
- */
- LLAvatarListItem(bool not_from_ui_factory = true);
- virtual ~LLAvatarListItem();
-
- virtual BOOL postBuild();
-
- /**
- * Processes notification from speaker indicator to update children when indicator's visibility is changed.
- */
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<LLStyle::Params> default_style,
+ voice_call_invited_style,
+ voice_call_joined_style,
+ voice_call_left_style,
+ online_style,
+ offline_style;
+
+ Optional<S32> name_right_pad;
+
+ Params();
+ };
+
+ typedef enum e_item_state_type {
+ IS_DEFAULT,
+ IS_VOICE_INVITED,
+ IS_VOICE_JOINED,
+ IS_VOICE_LEFT,
+ IS_ONLINE,
+ IS_OFFLINE,
+ } EItemState;
+
+ /**
+ * Creates an instance of LLAvatarListItem.
+ *
+ * It is not registered with LLDefaultChildRegistry. It is built via LLUICtrlFactory::buildPanel
+ * or via registered LLCallbackMap depend on passed parameter.
+ *
+ * @param not_from_ui_factory if true instance will be build with LLUICtrlFactory::buildPanel
+ * otherwise it should be registered via LLCallbackMap before creating.
+ */
+ LLAvatarListItem(bool not_from_ui_factory = true);
+ virtual ~LLAvatarListItem();
+
+ virtual BOOL postBuild();
+
+ /**
+ * Processes notification from speaker indicator to update children when indicator's visibility is changed.
+ */
virtual void handleVisibilityChange ( BOOL new_visibility );
- virtual S32 notifyParent(const LLSD& info);
- virtual void onMouseLeave(S32 x, S32 y, MASK mask);
- virtual void onMouseEnter(S32 x, S32 y, MASK mask);
- virtual void setValue(const LLSD& value);
- virtual void changed(U32 mask); // from LLFriendObserver
-
- void setOnline(bool online);
- void updateAvatarName(); // re-query the name cache
- void setAvatarName(const std::string& name);
- void setAvatarToolTip(const std::string& tooltip);
- void setHighlight(const std::string& highlight);
- void setState(EItemState item_style);
- void setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes = false, bool is_resident = true);
- void setLastInteractionTime(U32 secs_since);
- //Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly
- void setShowProfileBtn(bool show);
- void setShowInfoBtn(bool show);
- void showSpeakingIndicator(bool show);
- void setShowPermissions(bool show) { mShowPermissions = show; };
- void showLastInteractionTime(bool show);
- void setAvatarIconVisible(bool visible);
- void setShowCompleteName(bool show) { mShowCompleteName = show;};
-
- const LLUUID& getAvatarId() const;
- std::string getAvatarName() const;
- std::string getAvatarToolTip() const;
-
- void onInfoBtnClick();
- void onProfileBtnClick();
-
- /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+ virtual S32 notifyParent(const LLSD& info);
+ virtual void onMouseLeave(S32 x, S32 y, MASK mask);
+ virtual void onMouseEnter(S32 x, S32 y, MASK mask);
+ virtual void setValue(const LLSD& value);
+ virtual void changed(U32 mask); // from LLFriendObserver
+
+ void setOnline(bool online);
+ void updateAvatarName(); // re-query the name cache
+ void setAvatarName(const std::string& name);
+ void setAvatarToolTip(const std::string& tooltip);
+ void setHighlight(const std::string& highlight);
+ void setState(EItemState item_style);
+ void setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes = false, bool is_resident = true);
+ void setLastInteractionTime(U32 secs_since);
+ //Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly
+ void setShowProfileBtn(bool show);
+ void setShowInfoBtn(bool show);
+ void showSpeakingIndicator(bool show);
+ void setShowPermissions(bool show) { mShowPermissions = show; };
+ void showLastInteractionTime(bool show);
+ void setAvatarIconVisible(bool visible);
+ void setShowCompleteName(bool show) { mShowCompleteName = show;};
+
+ const LLUUID& getAvatarId() const;
+ std::string getAvatarName() const;
+ std::string getAvatarToolTip() const;
+
+ void onInfoBtnClick();
+ void onProfileBtnClick();
+
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
protected:
- /**
- * Contains indicator to show voice activity.
- */
- LLOutputMonitorCtrl* mSpeakingIndicator;
-
- LLAvatarIconCtrl* mAvatarIcon;
-
- /// Indicator for permission to see me online.
- LLIconCtrl* mIconPermissionOnline;
- /// Indicator for permission to see my position on the map.
- LLIconCtrl* mIconPermissionMap;
- /// Indicator for permission to edit my objects.
- LLIconCtrl* mIconPermissionEditMine;
- /// Indicator for permission to edit their objects.
- LLIconCtrl* mIconPermissionEditTheirs;
+ /**
+ * Contains indicator to show voice activity.
+ */
+ LLOutputMonitorCtrl* mSpeakingIndicator;
+
+ LLAvatarIconCtrl* mAvatarIcon;
+
+ /// Indicator for permission to see me online.
+ LLIconCtrl* mIconPermissionOnline;
+ /// Indicator for permission to see my position on the map.
+ LLIconCtrl* mIconPermissionMap;
+ /// Indicator for permission to edit my objects.
+ LLIconCtrl* mIconPermissionEditMine;
+ /// Indicator for permission to edit their objects.
+ LLIconCtrl* mIconPermissionEditTheirs;
private:
- typedef enum e_online_status {
- E_OFFLINE,
- E_ONLINE,
- E_UNKNOWN,
- } EOnlineStatus;
-
- /**
- * Enumeration of item elements in order from right to left.
- *
- * updateChildren() assumes that indexes are in the such order to process avatar icon easier.
- *
- * @see updateChildren()
- */
- typedef enum e_avatar_item_child {
- ALIC_SPEAKER_INDICATOR,
- ALIC_PROFILE_BUTTON,
- ALIC_INFO_BUTTON,
- ALIC_PERMISSION_ONLINE,
- ALIC_PERMISSION_MAP,
- ALIC_PERMISSION_EDIT_MINE,
- ALIC_PERMISSION_EDIT_THEIRS,
- ALIC_INTERACTION_TIME,
- ALIC_NAME,
- ALIC_ICON,
- ALIC_COUNT,
- } EAvatarListItemChildIndex;
-
- void setNameInternal(const std::string& name, const std::string& highlight);
- void onAvatarNameCache(const LLAvatarName& av_name);
-
- std::string formatSeconds(U32 secs);
-
- typedef std::map<EItemState, LLColor4> icon_color_map_t;
- static icon_color_map_t& getItemIconColorMap();
-
- /**
- * Initializes widths of all children to use them while changing visibility of any of them.
- *
- * @see updateChildren()
- */
- static void initChildrenWidths(LLAvatarListItem* self);
-
- /**
- * Updates position and rectangle of visible children to fit all available item's width.
- */
- void updateChildren();
-
- /**
- * Update visibility of active permissions icons.
- *
- * Need to call updateChildren() afterwards to sort out their layout.
- */
- bool showPermissions(bool visible);
-
- /**
- * Gets child view specified by index.
- *
- * This method implemented via switch by all EAvatarListItemChildIndex values.
- * It is used to not store children in array or vector to avoid of increasing memory usage.
- */
- LLView* getItemChildView(EAvatarListItemChildIndex child_index);
-
- LLTextBox* mAvatarName;
- LLTextBox* mLastInteractionTime;
- LLStyle::Params mAvatarNameStyle;
-
- LLButton* mInfoBtn;
- LLButton* mProfileBtn;
-
- LLUUID mAvatarId;
- std::string mHighlihtSubstring; // substring to highlight
- EOnlineStatus mOnlineStatus;
- //Flag indicating that info/profile button shouldn't be shown at all.
- //Speaker indicator and avatar name coords are translated accordingly
- bool mShowInfoBtn;
- bool mShowProfileBtn;
-
- /// indicates whether to show icons representing permissions granted
- bool mShowPermissions;
-
- /// true when the mouse pointer is hovering over this item
- bool mHovered;
-
- bool mShowCompleteName;
- std::string mGreyOutUsername;
-
- void fetchAvatarName();
- boost::signals2::connection mAvatarNameCacheConnection;
-
- static bool sStaticInitialized; // this variable is introduced to improve code readability
- static S32 sLeftPadding; // padding to first left visible child (icon or name)
- static S32 sNameRightPadding; // right padding from name to next visible child
-
- /**
- * Contains widths of each child specified by EAvatarListItemChildIndex
- * including padding to the next right one.
- *
- * @see initChildrenWidths()
- */
- static S32 sChildrenWidths[ALIC_COUNT];
+ typedef enum e_online_status {
+ E_OFFLINE,
+ E_ONLINE,
+ E_UNKNOWN,
+ } EOnlineStatus;
+
+ /**
+ * Enumeration of item elements in order from right to left.
+ *
+ * updateChildren() assumes that indexes are in the such order to process avatar icon easier.
+ *
+ * @see updateChildren()
+ */
+ typedef enum e_avatar_item_child {
+ ALIC_SPEAKER_INDICATOR,
+ ALIC_PROFILE_BUTTON,
+ ALIC_INFO_BUTTON,
+ ALIC_PERMISSION_ONLINE,
+ ALIC_PERMISSION_MAP,
+ ALIC_PERMISSION_EDIT_MINE,
+ ALIC_PERMISSION_EDIT_THEIRS,
+ ALIC_INTERACTION_TIME,
+ ALIC_NAME,
+ ALIC_ICON,
+ ALIC_COUNT,
+ } EAvatarListItemChildIndex;
+
+ void setNameInternal(const std::string& name, const std::string& highlight);
+ void onAvatarNameCache(const LLAvatarName& av_name);
+
+ std::string formatSeconds(U32 secs);
+
+ typedef std::map<EItemState, LLColor4> icon_color_map_t;
+ static icon_color_map_t& getItemIconColorMap();
+
+ /**
+ * Initializes widths of all children to use them while changing visibility of any of them.
+ *
+ * @see updateChildren()
+ */
+ static void initChildrenWidths(LLAvatarListItem* self);
+
+ /**
+ * Updates position and rectangle of visible children to fit all available item's width.
+ */
+ void updateChildren();
+
+ /**
+ * Update visibility of active permissions icons.
+ *
+ * Need to call updateChildren() afterwards to sort out their layout.
+ */
+ bool showPermissions(bool visible);
+
+ /**
+ * Gets child view specified by index.
+ *
+ * This method implemented via switch by all EAvatarListItemChildIndex values.
+ * It is used to not store children in array or vector to avoid of increasing memory usage.
+ */
+ LLView* getItemChildView(EAvatarListItemChildIndex child_index);
+
+ LLTextBox* mAvatarName;
+ LLTextBox* mLastInteractionTime;
+ LLStyle::Params mAvatarNameStyle;
+
+ LLButton* mInfoBtn;
+ LLButton* mProfileBtn;
+
+ LLUUID mAvatarId;
+ std::string mHighlihtSubstring; // substring to highlight
+ EOnlineStatus mOnlineStatus;
+ //Flag indicating that info/profile button shouldn't be shown at all.
+ //Speaker indicator and avatar name coords are translated accordingly
+ bool mShowInfoBtn;
+ bool mShowProfileBtn;
+
+ /// indicates whether to show icons representing permissions granted
+ bool mShowPermissions;
+
+ /// true when the mouse pointer is hovering over this item
+ bool mHovered;
+
+ bool mShowCompleteName;
+ std::string mGreyOutUsername;
+
+ void fetchAvatarName();
+ boost::signals2::connection mAvatarNameCacheConnection;
+
+ static bool sStaticInitialized; // this variable is introduced to improve code readability
+ static S32 sLeftPadding; // padding to first left visible child (icon or name)
+ static S32 sNameRightPadding; // right padding from name to next visible child
+
+ /**
+ * Contains widths of each child specified by EAvatarListItemChildIndex
+ * including padding to the next right one.
+ *
+ * @see initChildrenWidths()
+ */
+ static S32 sChildrenWidths[ALIC_COUNT];
};
diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp
index dd0d06a8c8..f28cb6147e 100644
--- a/indra/newview/llavatarpropertiesprocessor.cpp
+++ b/indra/newview/llavatarpropertiesprocessor.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarpropertiesprocessor.cpp
* @brief LLAvatarPropertiesProcessor class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,7 +39,7 @@
#include "llavataractions.h" // for getProfileUrl
#include "lldate.h"
#include "lltrans.h"
-#include "llui.h" // LLUI::getLanguage()
+#include "llui.h" // LLUI::getLanguage()
#include "message.h"
LLAvatarPropertiesProcessor::LLAvatarPropertiesProcessor()
@@ -52,47 +52,47 @@ LLAvatarPropertiesProcessor::~LLAvatarPropertiesProcessor()
void LLAvatarPropertiesProcessor::addObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer)
{
- // Check if that observer is already in mObservers for that avatar_id
- observer_multimap_t::iterator it;
+ // Check if that observer is already in mObservers for that avatar_id
+ observer_multimap_t::iterator it;
- // IAN BUG this should update the observer's UUID if this is a dupe - sent to PE
- it = mObservers.find(avatar_id);
- while (it != mObservers.end())
- {
- if (it->second == observer)
- {
- return;
- }
- else
- {
- ++it;
- }
- }
+ // IAN BUG this should update the observer's UUID if this is a dupe - sent to PE
+ it = mObservers.find(avatar_id);
+ while (it != mObservers.end())
+ {
+ if (it->second == observer)
+ {
+ return;
+ }
+ else
+ {
+ ++it;
+ }
+ }
- mObservers.insert(std::pair<LLUUID, LLAvatarPropertiesObserver*>(avatar_id, observer));
+ mObservers.insert(std::pair<LLUUID, LLAvatarPropertiesObserver*>(avatar_id, observer));
}
void LLAvatarPropertiesProcessor::removeObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer)
{
- if (!observer)
- {
- return;
- }
-
- observer_multimap_t::iterator it;
- it = mObservers.find(avatar_id);
- while (it != mObservers.end())
- {
- if (it->second == observer)
- {
- mObservers.erase(it);
- break;
- }
- else
- {
- ++it;
- }
- }
+ if (!observer)
+ {
+ return;
+ }
+
+ observer_multimap_t::iterator it;
+ it = mObservers.find(avatar_id);
+ while (it != mObservers.end())
+ {
+ if (it->second == observer)
+ {
+ mObservers.erase(it);
+ break;
+ }
+ else
+ {
+ ++it;
+ }
+ }
}
void LLAvatarPropertiesProcessor::sendRequest(const LLUUID& avatar_id, EAvatarProcessorType type, const std::string &method)
@@ -109,12 +109,12 @@ void LLAvatarPropertiesProcessor::sendRequest(const LLUUID& avatar_id, EAvatarPr
return;
}
- // Suppress duplicate requests while waiting for a response from the network
- if (isPendingRequest(avatar_id, type))
- {
- // waiting for a response, don't re-request
- return;
- }
+ // Suppress duplicate requests while waiting for a response from the network
+ if (isPendingRequest(avatar_id, type))
+ {
+ // waiting for a response, don't re-request
+ return;
+ }
std::string cap;
@@ -191,58 +191,58 @@ void LLAvatarPropertiesProcessor::sendAvatarPicksRequest(const LLUUID& avatar_id
void LLAvatarPropertiesProcessor::sendAvatarNotesRequest(const LLUUID& avatar_id)
{
- sendGenericRequest(avatar_id, APT_NOTES, "avatarnotesrequest");
+ sendGenericRequest(avatar_id, APT_NOTES, "avatarnotesrequest");
}
void LLAvatarPropertiesProcessor::sendAvatarGroupsRequest(const LLUUID& avatar_id)
{
- sendGenericRequest(avatar_id, APT_GROUPS, "avatargroupsrequest");
+ sendGenericRequest(avatar_id, APT_GROUPS, "avatargroupsrequest");
}
void LLAvatarPropertiesProcessor::sendAvatarTexturesRequest(const LLUUID& avatar_id)
{
- sendGenericRequest(avatar_id, APT_TEXTURES, "avatartexturesrequest");
- // No response expected.
- removePendingRequest(avatar_id, APT_TEXTURES);
+ sendGenericRequest(avatar_id, APT_TEXTURES, "avatartexturesrequest");
+ // No response expected.
+ removePendingRequest(avatar_id, APT_TEXTURES);
}
void LLAvatarPropertiesProcessor::sendAvatarClassifiedsRequest(const LLUUID& avatar_id)
{
- sendGenericRequest(avatar_id, APT_CLASSIFIEDS, "avatarclassifiedsrequest");
+ sendGenericRequest(avatar_id, APT_CLASSIFIEDS, "avatarclassifiedsrequest");
}
void LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate(const LLAvatarData* avatar_props)
{
- if (!gAgent.isInitialized() || (gAgent.getID() == LLUUID::null))
- {
- LL_WARNS() << "Sending avatarinfo update DENIED - invalid agent" << LL_ENDL;
- return;
- }
+ if (!gAgent.isInitialized() || (gAgent.getID() == LLUUID::null))
+ {
+ LL_WARNS() << "Sending avatarinfo update DENIED - invalid agent" << LL_ENDL;
+ return;
+ }
- LL_WARNS() << "Sending avatarinfo update. This trims profile descriptions!!!" << LL_ENDL;
+ LL_WARNS() << "Sending avatarinfo update. This trims profile descriptions!!!" << LL_ENDL;
- // This value is required by sendAvatarPropertiesUpdate method.
- //A profile should never be mature. (From the original code)
- BOOL mature = FALSE;
+ // This value is required by sendAvatarPropertiesUpdate method.
+ //A profile should never be mature. (From the original code)
+ BOOL mature = FALSE;
- LLMessageSystem *msg = gMessageSystem;
+ LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast (_PREHASH_AvatarPropertiesUpdate);
- msg->nextBlockFast (_PREHASH_AgentData);
- msg->addUUIDFast (_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast (_PREHASH_SessionID, gAgent.getSessionID() );
- msg->nextBlockFast (_PREHASH_PropertiesData);
+ msg->newMessageFast (_PREHASH_AvatarPropertiesUpdate);
+ msg->nextBlockFast (_PREHASH_AgentData);
+ msg->addUUIDFast (_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast (_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->nextBlockFast (_PREHASH_PropertiesData);
- msg->addUUIDFast (_PREHASH_ImageID, avatar_props->image_id);
- msg->addUUIDFast (_PREHASH_FLImageID, avatar_props->fl_image_id);
- msg->addStringFast (_PREHASH_AboutText, avatar_props->about_text);
- msg->addStringFast (_PREHASH_FLAboutText, avatar_props->fl_about_text);
+ msg->addUUIDFast (_PREHASH_ImageID, avatar_props->image_id);
+ msg->addUUIDFast (_PREHASH_FLImageID, avatar_props->fl_image_id);
+ msg->addStringFast (_PREHASH_AboutText, avatar_props->about_text);
+ msg->addStringFast (_PREHASH_FLAboutText, avatar_props->fl_about_text);
- msg->addBOOL(_PREHASH_AllowPublish, avatar_props->allow_publish);
- msg->addBOOL(_PREHASH_MaturePublish, mature);
- msg->addString(_PREHASH_ProfileURL, avatar_props->profile_url);
+ msg->addBOOL(_PREHASH_AllowPublish, avatar_props->allow_publish);
+ msg->addBOOL(_PREHASH_MaturePublish, mature);
+ msg->addString(_PREHASH_ProfileURL, avatar_props->profile_url);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
}
@@ -250,65 +250,65 @@ void LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate(const LLAvatarData*
//static
std::string LLAvatarPropertiesProcessor::accountType(const LLAvatarData* avatar_data)
{
- // If you have a special account, like M Linden ("El Jefe!")
- // return an untranslated "special" string
- if (!avatar_data->caption_text.empty())
- {
- return avatar_data->caption_text;
- }
- const char* const ACCT_TYPE[] = {
- "AcctTypeResident",
- "AcctTypeTrial",
- "AcctTypeCharterMember",
- "AcctTypeEmployee"
- };
- U8 caption_max = (U8)LL_ARRAY_SIZE(ACCT_TYPE)-1;
- U8 caption_index = llclamp(avatar_data->caption_index, (U8)0, caption_max);
- return LLTrans::getString(ACCT_TYPE[caption_index]);
+ // If you have a special account, like M Linden ("El Jefe!")
+ // return an untranslated "special" string
+ if (!avatar_data->caption_text.empty())
+ {
+ return avatar_data->caption_text;
+ }
+ const char* const ACCT_TYPE[] = {
+ "AcctTypeResident",
+ "AcctTypeTrial",
+ "AcctTypeCharterMember",
+ "AcctTypeEmployee"
+ };
+ U8 caption_max = (U8)LL_ARRAY_SIZE(ACCT_TYPE)-1;
+ U8 caption_index = llclamp(avatar_data->caption_index, (U8)0, caption_max);
+ return LLTrans::getString(ACCT_TYPE[caption_index]);
}
//static
std::string LLAvatarPropertiesProcessor::paymentInfo(const LLAvatarData* avatar_data)
{
- // Special accounts like M Linden don't have payment info revealed.
- if (!avatar_data->caption_text.empty()) return "";
-
- // Linden employees don't have payment info revealed
- const S32 LINDEN_EMPLOYEE_INDEX = 3;
- if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return "";
-
- BOOL transacted = (avatar_data->flags & AVATAR_TRANSACTED);
- BOOL identified = (avatar_data->flags & AVATAR_IDENTIFIED);
- // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations
- //BOOL age_verified = (avatar_data->flags & AVATAR_AGEVERIFIED);
-
- const char* payment_text;
- if(transacted)
- {
- payment_text = "PaymentInfoUsed";
- }
- else if (identified)
- {
- payment_text = "PaymentInfoOnFile";
- }
- else
- {
- payment_text = "NoPaymentInfoOnFile";
- }
- return LLTrans::getString(payment_text);
+ // Special accounts like M Linden don't have payment info revealed.
+ if (!avatar_data->caption_text.empty()) return "";
+
+ // Linden employees don't have payment info revealed
+ const S32 LINDEN_EMPLOYEE_INDEX = 3;
+ if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return "";
+
+ BOOL transacted = (avatar_data->flags & AVATAR_TRANSACTED);
+ BOOL identified = (avatar_data->flags & AVATAR_IDENTIFIED);
+ // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations
+ //BOOL age_verified = (avatar_data->flags & AVATAR_AGEVERIFIED);
+
+ const char* payment_text;
+ if(transacted)
+ {
+ payment_text = "PaymentInfoUsed";
+ }
+ else if (identified)
+ {
+ payment_text = "PaymentInfoOnFile";
+ }
+ else
+ {
+ payment_text = "NoPaymentInfoOnFile";
+ }
+ return LLTrans::getString(payment_text);
}
//static
bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avatar_data)
{
- // Special accounts like M Linden don't have payment info revealed.
- if (!avatar_data->caption_text.empty()) return true;
+ // Special accounts like M Linden don't have payment info revealed.
+ if (!avatar_data->caption_text.empty()) return true;
- // Linden employees don't have payment info revealed
- const S32 LINDEN_EMPLOYEE_INDEX = 3;
- if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return true;
+ // Linden employees don't have payment info revealed
+ const S32 LINDEN_EMPLOYEE_INDEX = 3;
+ if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return true;
- return ((avatar_data->flags & AVATAR_TRANSACTED) || (avatar_data->flags & AVATAR_IDENTIFIED));
+ return ((avatar_data->flags & AVATAR_TRANSACTED) || (avatar_data->flags & AVATAR_IDENTIFIED));
}
// static
@@ -420,61 +420,61 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur
void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**)
{
- LLAvatarData avatar_data;
- std::string birth_date;
-
- msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, avatar_data.agent_id);
- msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, avatar_data.avatar_id);
- msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_ImageID, avatar_data.image_id);
- msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_FLImageID, avatar_data.fl_image_id);
- msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_PartnerID, avatar_data.partner_id);
- msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_AboutText, avatar_data.about_text);
- msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_FLAboutText, avatar_data.fl_about_text);
- msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_BornOn, birth_date);
- msg->getString( _PREHASH_PropertiesData, _PREHASH_ProfileURL, avatar_data.profile_url);
- msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_Flags, avatar_data.flags);
-
-
- LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date);
- avatar_data.caption_index = 0;
-
- S32 charter_member_size = 0;
- charter_member_size = msg->getSize(_PREHASH_PropertiesData, _PREHASH_CharterMember);
- if(1 == charter_member_size)
- {
- msg->getBinaryData(_PREHASH_PropertiesData, _PREHASH_CharterMember, &avatar_data.caption_index, 1);
- }
- else if(1 < charter_member_size)
- {
- msg->getString(_PREHASH_PropertiesData, _PREHASH_CharterMember, avatar_data.caption_text);
- }
- LLAvatarPropertiesProcessor* self = getInstance();
- // Request processed, no longer pending
- self->removePendingRequest(avatar_data.avatar_id, APT_PROPERTIES);
- self->notifyObservers(avatar_data.avatar_id,&avatar_data,APT_PROPERTIES);
+ LLAvatarData avatar_data;
+ std::string birth_date;
+
+ msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, avatar_data.agent_id);
+ msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, avatar_data.avatar_id);
+ msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_ImageID, avatar_data.image_id);
+ msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_FLImageID, avatar_data.fl_image_id);
+ msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_PartnerID, avatar_data.partner_id);
+ msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_AboutText, avatar_data.about_text);
+ msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_FLAboutText, avatar_data.fl_about_text);
+ msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_BornOn, birth_date);
+ msg->getString( _PREHASH_PropertiesData, _PREHASH_ProfileURL, avatar_data.profile_url);
+ msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_Flags, avatar_data.flags);
+
+
+ LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date);
+ avatar_data.caption_index = 0;
+
+ S32 charter_member_size = 0;
+ charter_member_size = msg->getSize(_PREHASH_PropertiesData, _PREHASH_CharterMember);
+ if(1 == charter_member_size)
+ {
+ msg->getBinaryData(_PREHASH_PropertiesData, _PREHASH_CharterMember, &avatar_data.caption_index, 1);
+ }
+ else if(1 < charter_member_size)
+ {
+ msg->getString(_PREHASH_PropertiesData, _PREHASH_CharterMember, avatar_data.caption_text);
+ }
+ LLAvatarPropertiesProcessor* self = getInstance();
+ // Request processed, no longer pending
+ self->removePendingRequest(avatar_data.avatar_id, APT_PROPERTIES);
+ self->notifyObservers(avatar_data.avatar_id,&avatar_data,APT_PROPERTIES);
}
void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* msg, void**)
{
/*
- AvatarInterestsReply is automatically sent by the server in response to the
- AvatarPropertiesRequest sent when the panel is opened (in addition to the AvatarPropertiesReply message).
- If the interests panel is no longer part of the design (?) we should just register the message
- to a handler function that does nothing.
- That will suppress the warnings and be compatible with old server versions.
- WARNING: LLTemplateMessageReader::decodeData: Message from 216.82.37.237:13000 with no handler function received: AvatarInterestsReply
+ AvatarInterestsReply is automatically sent by the server in response to the
+ AvatarPropertiesRequest sent when the panel is opened (in addition to the AvatarPropertiesReply message).
+ If the interests panel is no longer part of the design (?) we should just register the message
+ to a handler function that does nothing.
+ That will suppress the warnings and be compatible with old server versions.
+ WARNING: LLTemplateMessageReader::decodeData: Message from 216.82.37.237:13000 with no handler function received: AvatarInterestsReply
*/
LLInterestsData interests_data;
-
+
msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, interests_data.agent_id );
msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, interests_data.avatar_id );
- msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_WantToMask, interests_data.want_to_mask );
+ msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_WantToMask, interests_data.want_to_mask );
msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_WantToText, interests_data.want_to_text );
- msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_SkillsMask, interests_data.skills_mask );
+ msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_SkillsMask, interests_data.skills_mask );
msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_SkillsText, interests_data.skills_text );
msg->getString( _PREHASH_PropertiesData, _PREHASH_LanguagesText, interests_data.languages_text );
-
+
LLAvatarPropertiesProcessor* self = getInstance();
// Request processed, no longer pending
self->removePendingRequest(interests_data.avatar_id, APT_INTERESTS_INFO);
@@ -483,239 +483,239 @@ void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* m
void LLAvatarPropertiesProcessor::processAvatarClassifiedsReply(LLMessageSystem* msg, void**)
{
- LLAvatarClassifieds classifieds;
+ LLAvatarClassifieds classifieds;
- msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, classifieds.agent_id);
- msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, classifieds.target_id);
+ msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, classifieds.agent_id);
+ msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, classifieds.target_id);
- S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data);
+ S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data);
- for(int n = 0; n < block_count; ++n)
- {
- LLAvatarClassifieds::classified_data data;
+ for(int n = 0; n < block_count; ++n)
+ {
+ LLAvatarClassifieds::classified_data data;
- msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, data.classified_id, n);
- msg->getString(_PREHASH_Data, _PREHASH_Name, data.name, n);
+ msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, data.classified_id, n);
+ msg->getString(_PREHASH_Data, _PREHASH_Name, data.name, n);
- classifieds.classifieds_list.push_back(data);
- }
+ classifieds.classifieds_list.push_back(data);
+ }
- LLAvatarPropertiesProcessor* self = getInstance();
- // Request processed, no longer pending
- self->removePendingRequest(classifieds.target_id, APT_CLASSIFIEDS);
- self->notifyObservers(classifieds.target_id,&classifieds,APT_CLASSIFIEDS);
+ LLAvatarPropertiesProcessor* self = getInstance();
+ // Request processed, no longer pending
+ self->removePendingRequest(classifieds.target_id, APT_CLASSIFIEDS);
+ self->notifyObservers(classifieds.target_id,&classifieds,APT_CLASSIFIEDS);
}
void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* msg, void**)
{
- LLAvatarClassifiedInfo c_info;
-
- msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, c_info.agent_id);
+ LLAvatarClassifiedInfo c_info;
+
+ msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, c_info.agent_id);
+
+ msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, c_info.classified_id);
+ msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, c_info.creator_id);
+ msg->getU32(_PREHASH_Data, _PREHASH_CreationDate, c_info.creation_date);
+ msg->getU32(_PREHASH_Data, _PREHASH_ExpirationDate, c_info.expiration_date);
+ msg->getU32(_PREHASH_Data, _PREHASH_Category, c_info.category);
+ msg->getString(_PREHASH_Data, _PREHASH_Name, c_info.name);
+ msg->getString(_PREHASH_Data, _PREHASH_Desc, c_info.description);
+ msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, c_info.parcel_id);
+ msg->getU32(_PREHASH_Data, _PREHASH_ParentEstate, c_info.parent_estate);
+ msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, c_info.snapshot_id);
+ msg->getString(_PREHASH_Data, _PREHASH_SimName, c_info.sim_name);
+ msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, c_info.pos_global);
+ msg->getString(_PREHASH_Data, _PREHASH_ParcelName, c_info.parcel_name);
+ msg->getU8(_PREHASH_Data, _PREHASH_ClassifiedFlags, c_info.flags);
+ msg->getS32(_PREHASH_Data, _PREHASH_PriceForListing, c_info.price_for_listing);
- msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, c_info.classified_id);
- msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, c_info.creator_id);
- msg->getU32(_PREHASH_Data, _PREHASH_CreationDate, c_info.creation_date);
- msg->getU32(_PREHASH_Data, _PREHASH_ExpirationDate, c_info.expiration_date);
- msg->getU32(_PREHASH_Data, _PREHASH_Category, c_info.category);
- msg->getString(_PREHASH_Data, _PREHASH_Name, c_info.name);
- msg->getString(_PREHASH_Data, _PREHASH_Desc, c_info.description);
- msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, c_info.parcel_id);
- msg->getU32(_PREHASH_Data, _PREHASH_ParentEstate, c_info.parent_estate);
- msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, c_info.snapshot_id);
- msg->getString(_PREHASH_Data, _PREHASH_SimName, c_info.sim_name);
- msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, c_info.pos_global);
- msg->getString(_PREHASH_Data, _PREHASH_ParcelName, c_info.parcel_name);
- msg->getU8(_PREHASH_Data, _PREHASH_ClassifiedFlags, c_info.flags);
- msg->getS32(_PREHASH_Data, _PREHASH_PriceForListing, c_info.price_for_listing);
-
- LLAvatarPropertiesProcessor* self = getInstance();
- // Request processed, no longer pending
- self->removePendingRequest(c_info.creator_id, APT_CLASSIFIED_INFO);
- self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO);
+ LLAvatarPropertiesProcessor* self = getInstance();
+ // Request processed, no longer pending
+ self->removePendingRequest(c_info.creator_id, APT_CLASSIFIED_INFO);
+ self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO);
}
void LLAvatarPropertiesProcessor::processAvatarNotesReply(LLMessageSystem* msg, void**)
{
- LLAvatarNotes avatar_notes;
+ LLAvatarNotes avatar_notes;
- msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_notes.agent_id);
- msg->getUUID(_PREHASH_Data, _PREHASH_TargetID, avatar_notes.target_id);
- msg->getString(_PREHASH_Data, _PREHASH_Notes, avatar_notes.notes);
+ msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_notes.agent_id);
+ msg->getUUID(_PREHASH_Data, _PREHASH_TargetID, avatar_notes.target_id);
+ msg->getString(_PREHASH_Data, _PREHASH_Notes, avatar_notes.notes);
- LLAvatarPropertiesProcessor* self = getInstance();
- // Request processed, no longer pending
- self->removePendingRequest(avatar_notes.target_id, APT_NOTES);
- self->notifyObservers(avatar_notes.target_id,&avatar_notes,APT_NOTES);
+ LLAvatarPropertiesProcessor* self = getInstance();
+ // Request processed, no longer pending
+ self->removePendingRequest(avatar_notes.target_id, APT_NOTES);
+ self->notifyObservers(avatar_notes.target_id,&avatar_notes,APT_NOTES);
}
void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, void**)
{
- LLAvatarPicks avatar_picks;
- msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_picks.agent_id);
- msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, avatar_picks.target_id);
+ LLAvatarPicks avatar_picks;
+ msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_picks.agent_id);
+ msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, avatar_picks.target_id);
- S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data);
- for (int block = 0; block < block_count; ++block)
- {
- LLUUID pick_id;
- std::string pick_name;
+ S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data);
+ for (int block = 0; block < block_count; ++block)
+ {
+ LLUUID pick_id;
+ std::string pick_name;
- msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block);
- msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block);
+ msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block);
+ msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block);
- avatar_picks.picks_list.push_back(std::make_pair(pick_id,pick_name));
- }
- LLAvatarPropertiesProcessor* self = getInstance();
- // Request processed, no longer pending
- self->removePendingRequest(avatar_picks.target_id, APT_PICKS);
- self->notifyObservers(avatar_picks.target_id,&avatar_picks,APT_PICKS);
+ avatar_picks.picks_list.push_back(std::make_pair(pick_id,pick_name));
+ }
+ LLAvatarPropertiesProcessor* self = getInstance();
+ // Request processed, no longer pending
+ self->removePendingRequest(avatar_picks.target_id, APT_PICKS);
+ self->notifyObservers(avatar_picks.target_id,&avatar_picks,APT_PICKS);
}
void LLAvatarPropertiesProcessor::processPickInfoReply(LLMessageSystem* msg, void**)
{
- LLPickData pick_data;
+ LLPickData pick_data;
- // Extract the agent id and verify the message is for this
- // client.
- msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, pick_data.agent_id );
- msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_data.pick_id);
- msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, pick_data.creator_id);
+ // Extract the agent id and verify the message is for this
+ // client.
+ msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, pick_data.agent_id );
+ msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_data.pick_id);
+ msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, pick_data.creator_id);
- // ** top_pick should be deleted, not being used anymore - angela
- msg->getBOOL(_PREHASH_Data, _PREHASH_TopPick, pick_data.top_pick);
- msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, pick_data.parcel_id);
- msg->getString(_PREHASH_Data, _PREHASH_Name, pick_data.name);
- msg->getString(_PREHASH_Data, _PREHASH_Desc, pick_data.desc);
- msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, pick_data.snapshot_id);
+ // ** top_pick should be deleted, not being used anymore - angela
+ msg->getBOOL(_PREHASH_Data, _PREHASH_TopPick, pick_data.top_pick);
+ msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, pick_data.parcel_id);
+ msg->getString(_PREHASH_Data, _PREHASH_Name, pick_data.name);
+ msg->getString(_PREHASH_Data, _PREHASH_Desc, pick_data.desc);
+ msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, pick_data.snapshot_id);
- msg->getString(_PREHASH_Data, _PREHASH_User, pick_data.user_name);
- msg->getString(_PREHASH_Data, _PREHASH_OriginalName, pick_data.original_name);
- msg->getString(_PREHASH_Data, _PREHASH_SimName, pick_data.sim_name);
- msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, pick_data.pos_global);
+ msg->getString(_PREHASH_Data, _PREHASH_User, pick_data.user_name);
+ msg->getString(_PREHASH_Data, _PREHASH_OriginalName, pick_data.original_name);
+ msg->getString(_PREHASH_Data, _PREHASH_SimName, pick_data.sim_name);
+ msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, pick_data.pos_global);
- msg->getS32(_PREHASH_Data, _PREHASH_SortOrder, pick_data.sort_order);
- msg->getBOOL(_PREHASH_Data, _PREHASH_Enabled, pick_data.enabled);
+ msg->getS32(_PREHASH_Data, _PREHASH_SortOrder, pick_data.sort_order);
+ msg->getBOOL(_PREHASH_Data, _PREHASH_Enabled, pick_data.enabled);
- LLAvatarPropertiesProcessor* self = getInstance();
- // don't need to remove pending request as we don't track pick info
- self->notifyObservers(pick_data.creator_id, &pick_data, APT_PICK_INFO);
+ LLAvatarPropertiesProcessor* self = getInstance();
+ // don't need to remove pending request as we don't track pick info
+ self->notifyObservers(pick_data.creator_id, &pick_data, APT_PICK_INFO);
}
void LLAvatarPropertiesProcessor::processAvatarGroupsReply(LLMessageSystem* msg, void**)
{
- LLAvatarGroups avatar_groups;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, avatar_groups.agent_id );
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_groups.avatar_id );
+ LLAvatarGroups avatar_groups;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, avatar_groups.agent_id );
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_groups.avatar_id );
- S32 group_count = msg->getNumberOfBlocksFast(_PREHASH_GroupData);
- for(S32 i = 0; i < group_count; ++i)
- {
- LLAvatarGroups::LLGroupData group_data;
+ S32 group_count = msg->getNumberOfBlocksFast(_PREHASH_GroupData);
+ for(S32 i = 0; i < group_count; ++i)
+ {
+ LLAvatarGroups::LLGroupData group_data;
- msg->getU64( _PREHASH_GroupData, _PREHASH_GroupPowers, group_data.group_powers, i );
- msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, group_data.group_title, i );
- msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_data.group_id, i);
- msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_data.group_name, i );
- msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_data.group_insignia_id, i );
+ msg->getU64( _PREHASH_GroupData, _PREHASH_GroupPowers, group_data.group_powers, i );
+ msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, group_data.group_title, i );
+ msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_data.group_id, i);
+ msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_data.group_name, i );
+ msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_data.group_insignia_id, i );
- avatar_groups.group_list.push_back(group_data);
- }
+ avatar_groups.group_list.push_back(group_data);
+ }
- LLAvatarPropertiesProcessor* self = getInstance();
- self->removePendingRequest(avatar_groups.avatar_id, APT_GROUPS);
- self->notifyObservers(avatar_groups.avatar_id,&avatar_groups,APT_GROUPS);
+ LLAvatarPropertiesProcessor* self = getInstance();
+ self->removePendingRequest(avatar_groups.avatar_id, APT_GROUPS);
+ self->notifyObservers(avatar_groups.avatar_id,&avatar_groups,APT_GROUPS);
}
void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id,void* data, EAvatarProcessorType type)
{
- // Copy the map (because observers may delete themselves when updated?)
- LLAvatarPropertiesProcessor::observer_multimap_t observers = mObservers;
+ // Copy the map (because observers may delete themselves when updated?)
+ LLAvatarPropertiesProcessor::observer_multimap_t observers = mObservers;
- observer_multimap_t::iterator oi = observers.begin();
- observer_multimap_t::iterator end = observers.end();
- for (; oi != end; ++oi)
- {
- // only notify observers for the same agent, or if the observer
- // didn't know the agent ID and passed a NULL id.
- const LLUUID &agent_id = oi->first;
- if (agent_id == id || agent_id.isNull())
- {
- oi->second->processProperties(data,type);
- }
- }
+ observer_multimap_t::iterator oi = observers.begin();
+ observer_multimap_t::iterator end = observers.end();
+ for (; oi != end; ++oi)
+ {
+ // only notify observers for the same agent, or if the observer
+ // didn't know the agent ID and passed a NULL id.
+ const LLUUID &agent_id = oi->first;
+ if (agent_id == id || agent_id.isNull())
+ {
+ oi->second->processProperties(data,type);
+ }
+ }
}
void LLAvatarPropertiesProcessor::sendFriendRights(const LLUUID& avatar_id, S32 rights)
{
- if(!avatar_id.isNull())
- {
- LLMessageSystem* msg = gMessageSystem;
+ if(!avatar_id.isNull())
+ {
+ LLMessageSystem* msg = gMessageSystem;
- // setup message header
- msg->newMessageFast(_PREHASH_GrantUserRights);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUID(_PREHASH_AgentID, gAgent.getID());
- msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
+ // setup message header
+ msg->newMessageFast(_PREHASH_GrantUserRights);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUID(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Rights);
- msg->addUUID(_PREHASH_AgentRelated, avatar_id);
- msg->addS32(_PREHASH_RelatedRights, rights);
+ msg->nextBlockFast(_PREHASH_Rights);
+ msg->addUUID(_PREHASH_AgentRelated, avatar_id);
+ msg->addS32(_PREHASH_RelatedRights, rights);
- gAgent.sendReliableMessage();
- }
+ gAgent.sendReliableMessage();
+ }
}
void LLAvatarPropertiesProcessor::sendNotes(const LLUUID& avatar_id, const std::string notes)
{
- if(!avatar_id.isNull())
- {
- LLMessageSystem* msg = gMessageSystem;
+ if(!avatar_id.isNull())
+ {
+ LLMessageSystem* msg = gMessageSystem;
- // setup message header
- msg->newMessageFast(_PREHASH_AvatarNotesUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUID(_PREHASH_AgentID, gAgent.getID());
- msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
+ // setup message header
+ msg->newMessageFast(_PREHASH_AvatarNotesUpdate);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUID(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Data);
- msg->addUUID(_PREHASH_TargetID, avatar_id);
- msg->addString(_PREHASH_Notes, notes);
+ msg->nextBlockFast(_PREHASH_Data);
+ msg->addUUID(_PREHASH_TargetID, avatar_id);
+ msg->addString(_PREHASH_Notes, notes);
- gAgent.sendReliableMessage();
- }
+ gAgent.sendReliableMessage();
+ }
}
void LLAvatarPropertiesProcessor::sendPickDelete( const LLUUID& pick_id )
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage(_PREHASH_PickDelete);
- msg->nextBlock(_PREHASH_AgentData);
- msg->addUUID(_PREHASH_AgentID, gAgent.getID());
- msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlock(_PREHASH_Data);
- msg->addUUID(_PREHASH_PickID, pick_id);
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage(_PREHASH_PickDelete);
+ msg->nextBlock(_PREHASH_AgentData);
+ msg->addUUID(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlock(_PREHASH_Data);
+ msg->addUUID(_PREHASH_PickID, pick_id);
+ gAgent.sendReliableMessage();
- LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
- LLAgentPicksInfo::getInstance()->decrementNumberOfPicks();
+ LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
+ LLAgentPicksInfo::getInstance()->decrementNumberOfPicks();
}
void LLAvatarPropertiesProcessor::sendClassifiedDelete(const LLUUID& classified_id)
{
- LLMessageSystem* msg = gMessageSystem;
+ LLMessageSystem* msg = gMessageSystem;
- msg->newMessage(_PREHASH_ClassifiedDelete);
+ msg->newMessage(_PREHASH_ClassifiedDelete);
- msg->nextBlock(_PREHASH_AgentData);
- msg->addUUID(_PREHASH_AgentID, gAgent.getID());
- msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlock(_PREHASH_AgentData);
+ msg->addUUID(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlock(_PREHASH_Data);
- msg->addUUID(_PREHASH_ClassifiedID, classified_id);
+ msg->nextBlock(_PREHASH_Data);
+ msg->addUUID(_PREHASH_ClassifiedID, classified_id);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
}
void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData* interests_data)
@@ -729,138 +729,138 @@ void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData*
msg->newMessage(_PREHASH_AvatarInterestsUpdate);
msg->nextBlockFast( _PREHASH_AgentData);
- msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast( _PREHASH_SessionID, gAgent.getSessionID() );
msg->nextBlockFast( _PREHASH_PropertiesData);
- msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask);
- msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text);
- msg->addU32Fast( _PREHASH_SkillsMask, interests_data->skills_mask);
- msg->addStringFast( _PREHASH_SkillsText, interests_data->skills_text);
+ msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask);
+ msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text);
+ msg->addU32Fast( _PREHASH_SkillsMask, interests_data->skills_mask);
+ msg->addStringFast( _PREHASH_SkillsText, interests_data->skills_text);
msg->addString( _PREHASH_LanguagesText, interests_data->languages_text);
-
+
gAgent.sendReliableMessage();
}
void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick)
{
- if (!new_pick) return;
+ if (!new_pick) return;
- LLMessageSystem* msg = gMessageSystem;
+ LLMessageSystem* msg = gMessageSystem;
- msg->newMessage(_PREHASH_PickInfoUpdate);
- msg->nextBlock(_PREHASH_AgentData);
- msg->addUUID(_PREHASH_AgentID, gAgent.getID());
- msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->newMessage(_PREHASH_PickInfoUpdate);
+ msg->nextBlock(_PREHASH_AgentData);
+ msg->addUUID(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlock(_PREHASH_Data);
- msg->addUUID(_PREHASH_PickID, new_pick->pick_id);
- msg->addUUID(_PREHASH_CreatorID, new_pick->creator_id);
+ msg->nextBlock(_PREHASH_Data);
+ msg->addUUID(_PREHASH_PickID, new_pick->pick_id);
+ msg->addUUID(_PREHASH_CreatorID, new_pick->creator_id);
- //legacy var need to be deleted
- msg->addBOOL(_PREHASH_TopPick, FALSE);
+ //legacy var need to be deleted
+ msg->addBOOL(_PREHASH_TopPick, FALSE);
- // fills in on simulator if null
- msg->addUUID(_PREHASH_ParcelID, new_pick->parcel_id);
- msg->addString(_PREHASH_Name, new_pick->name);
- msg->addString(_PREHASH_Desc, new_pick->desc);
- msg->addUUID(_PREHASH_SnapshotID, new_pick->snapshot_id);
- msg->addVector3d(_PREHASH_PosGlobal, new_pick->pos_global);
+ // fills in on simulator if null
+ msg->addUUID(_PREHASH_ParcelID, new_pick->parcel_id);
+ msg->addString(_PREHASH_Name, new_pick->name);
+ msg->addString(_PREHASH_Desc, new_pick->desc);
+ msg->addUUID(_PREHASH_SnapshotID, new_pick->snapshot_id);
+ msg->addVector3d(_PREHASH_PosGlobal, new_pick->pos_global);
- // Only top picks have a sort order
- msg->addS32(_PREHASH_SortOrder, 0);
+ // Only top picks have a sort order
+ msg->addS32(_PREHASH_SortOrder, 0);
- msg->addBOOL(_PREHASH_Enabled, new_pick->enabled);
- gAgent.sendReliableMessage();
+ msg->addBOOL(_PREHASH_Enabled, new_pick->enabled);
+ gAgent.sendReliableMessage();
- LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
+ LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
}
void LLAvatarPropertiesProcessor::sendClassifiedInfoUpdate(const LLAvatarClassifiedInfo* c_data)
{
- if(!c_data)
- {
- return;
- }
+ if(!c_data)
+ {
+ return;
+ }
- LLMessageSystem* msg = gMessageSystem;
+ LLMessageSystem* msg = gMessageSystem;
- msg->newMessage(_PREHASH_ClassifiedInfoUpdate);
+ msg->newMessage(_PREHASH_ClassifiedInfoUpdate);
- msg->nextBlock(_PREHASH_AgentData);
- msg->addUUID(_PREHASH_AgentID, gAgent.getID());
- msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlock(_PREHASH_AgentData);
+ msg->addUUID(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlock(_PREHASH_Data);
- msg->addUUID(_PREHASH_ClassifiedID, c_data->classified_id);
- msg->addU32(_PREHASH_Category, c_data->category);
- msg->addString(_PREHASH_Name, c_data->name);
- msg->addString(_PREHASH_Desc, c_data->description);
- msg->addUUID(_PREHASH_ParcelID, c_data->parcel_id);
- msg->addU32(_PREHASH_ParentEstate, 0);
- msg->addUUID(_PREHASH_SnapshotID, c_data->snapshot_id);
- msg->addVector3d(_PREHASH_PosGlobal, c_data->pos_global);
- msg->addU8(_PREHASH_ClassifiedFlags, c_data->flags);
- msg->addS32(_PREHASH_PriceForListing, c_data->price_for_listing);
+ msg->nextBlock(_PREHASH_Data);
+ msg->addUUID(_PREHASH_ClassifiedID, c_data->classified_id);
+ msg->addU32(_PREHASH_Category, c_data->category);
+ msg->addString(_PREHASH_Name, c_data->name);
+ msg->addString(_PREHASH_Desc, c_data->description);
+ msg->addUUID(_PREHASH_ParcelID, c_data->parcel_id);
+ msg->addU32(_PREHASH_ParentEstate, 0);
+ msg->addUUID(_PREHASH_SnapshotID, c_data->snapshot_id);
+ msg->addVector3d(_PREHASH_PosGlobal, c_data->pos_global);
+ msg->addU8(_PREHASH_ClassifiedFlags, c_data->flags);
+ msg->addS32(_PREHASH_PriceForListing, c_data->price_for_listing);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
}
void LLAvatarPropertiesProcessor::sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id)
{
- // Must ask for a pick based on the creator id because
- // the pick database is distributed to the inventory cluster. JC
- std::vector<std::string> request_params;
- request_params.push_back(creator_id.asString() );
- request_params.push_back(pick_id.asString() );
- send_generic_message("pickinforequest", request_params);
+ // Must ask for a pick based on the creator id because
+ // the pick database is distributed to the inventory cluster. JC
+ std::vector<std::string> request_params;
+ request_params.push_back(creator_id.asString() );
+ request_params.push_back(pick_id.asString() );
+ send_generic_message("pickinforequest", request_params);
}
void LLAvatarPropertiesProcessor::sendClassifiedInfoRequest(const LLUUID& classified_id)
{
- LLMessageSystem* msg = gMessageSystem;
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessage(_PREHASH_ClassifiedInfoRequest);
+ msg->nextBlock(_PREHASH_AgentData);
- msg->newMessage(_PREHASH_ClassifiedInfoRequest);
- msg->nextBlock(_PREHASH_AgentData);
-
- msg->addUUID(_PREHASH_AgentID, gAgent.getID());
- msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUID(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlock(_PREHASH_Data);
- msg->addUUID(_PREHASH_ClassifiedID, classified_id);
+ msg->nextBlock(_PREHASH_Data);
+ msg->addUUID(_PREHASH_ClassifiedID, classified_id);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
}
bool LLAvatarPropertiesProcessor::isPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type)
{
- timestamp_map_t::key_type key = std::make_pair(avatar_id, type);
- timestamp_map_t::iterator it = mRequestTimestamps.find(key);
+ timestamp_map_t::key_type key = std::make_pair(avatar_id, type);
+ timestamp_map_t::iterator it = mRequestTimestamps.find(key);
- // Is this a new request?
- if (it == mRequestTimestamps.end()) return false;
+ // Is this a new request?
+ if (it == mRequestTimestamps.end()) return false;
- // We found a request, check if it has timed out
- U32 now = time(NULL);
- const U32 REQUEST_EXPIRE_SECS = 5;
- U32 expires = it->second + REQUEST_EXPIRE_SECS;
+ // We found a request, check if it has timed out
+ U32 now = time(NULL);
+ const U32 REQUEST_EXPIRE_SECS = 5;
+ U32 expires = it->second + REQUEST_EXPIRE_SECS;
- // Request is still pending if it hasn't expired yet
- // *NOTE: Expired requests will accumulate in this map, but they are rare,
- // the data is small, and they will be updated if the same data is
- // re-requested
- return (now < expires);
+ // Request is still pending if it hasn't expired yet
+ // *NOTE: Expired requests will accumulate in this map, but they are rare,
+ // the data is small, and they will be updated if the same data is
+ // re-requested
+ return (now < expires);
}
void LLAvatarPropertiesProcessor::addPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type)
{
- timestamp_map_t::key_type key = std::make_pair(avatar_id, type);
- U32 now = time(NULL);
- // Add or update existing (expired) request
- mRequestTimestamps[ key ] = now;
+ timestamp_map_t::key_type key = std::make_pair(avatar_id, type);
+ U32 now = time(NULL);
+ // Add or update existing (expired) request
+ mRequestTimestamps[ key ] = now;
}
void LLAvatarPropertiesProcessor::removePendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type)
{
- timestamp_map_t::key_type key = std::make_pair(avatar_id, type);
- mRequestTimestamps.erase(key);
+ timestamp_map_t::key_type key = std::make_pair(avatar_id, type);
+ mRequestTimestamps.erase(key);
}
diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h
index 10cde35f9c..77bf5fd51e 100644
--- a/indra/newview/llavatarpropertiesprocessor.h
+++ b/indra/newview/llavatarpropertiesprocessor.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarpropertiesprocessor.h
* @brief LLAvatatIconCtrl base class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,17 +29,17 @@
#include "lluuid.h"
#include "llsingleton.h"
-#include "v3dmath.h" // LLVector3d
+#include "v3dmath.h" // LLVector3d
#include <list>
#include <map>
// For Flags in AvatarPropertiesReply
-const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not
-const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature"
-const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info
-const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info
-const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known.
-const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified
+const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not
+const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature"
+const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info
+const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info
+const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known.
+const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified
/*
*TODO Vadim: This needs some refactoring:
@@ -50,15 +50,15 @@ class LLMessageSystem;
enum EAvatarProcessorType
{
- APT_PROPERTIES,
- APT_NOTES,
- APT_GROUPS,
- APT_PICKS,
- APT_PICK_INFO,
- APT_TEXTURES,
+ APT_PROPERTIES,
+ APT_NOTES,
+ APT_GROUPS,
+ APT_PICKS,
+ APT_PICK_INFO,
+ APT_TEXTURES,
APT_INTERESTS_INFO,
- APT_CLASSIFIEDS,
- APT_CLASSIFIED_INFO
+ APT_CLASSIFIEDS,
+ APT_CLASSIFIED_INFO
};
struct LLInterestsData
@@ -74,234 +74,234 @@ struct LLInterestsData
struct LLAvatarData
{
- LLUUID agent_id;
- LLUUID avatar_id; //target id
- LLUUID image_id;
- LLUUID fl_image_id;
- LLUUID partner_id;
- std::string about_text;
- std::string fl_about_text;
- LLDate born_on;
- std::string profile_url;
- U8 caption_index;
- std::string caption_text;
- std::string customer_type;
- U32 flags;
- BOOL allow_publish;
+ LLUUID agent_id;
+ LLUUID avatar_id; //target id
+ LLUUID image_id;
+ LLUUID fl_image_id;
+ LLUUID partner_id;
+ std::string about_text;
+ std::string fl_about_text;
+ LLDate born_on;
+ std::string profile_url;
+ U8 caption_index;
+ std::string caption_text;
+ std::string customer_type;
+ U32 flags;
+ BOOL allow_publish;
};
struct LLAvatarPicks
{
- LLUUID agent_id;
- LLUUID target_id; //target id
+ LLUUID agent_id;
+ LLUUID target_id; //target id
- typedef std::pair<LLUUID,std::string> pick_data_t;
- typedef std::list< pick_data_t> picks_list_t;
- picks_list_t picks_list;
+ typedef std::pair<LLUUID,std::string> pick_data_t;
+ typedef std::list< pick_data_t> picks_list_t;
+ picks_list_t picks_list;
};
struct LLPickData
{
- LLUUID agent_id;
- LLUUID pick_id;
- LLUUID creator_id;
- BOOL top_pick;
- LLUUID parcel_id;
- std::string name;
- std::string desc;
- LLUUID snapshot_id;
- LLVector3d pos_global;
- S32 sort_order;
- BOOL enabled;
-
- //used only in read requests
- std::string user_name;
- std::string original_name;
- std::string sim_name;
-
- //used only in write (update) requests
- LLUUID session_id;
+ LLUUID agent_id;
+ LLUUID pick_id;
+ LLUUID creator_id;
+ BOOL top_pick;
+ LLUUID parcel_id;
+ std::string name;
+ std::string desc;
+ LLUUID snapshot_id;
+ LLVector3d pos_global;
+ S32 sort_order;
+ BOOL enabled;
+
+ //used only in read requests
+ std::string user_name;
+ std::string original_name;
+ std::string sim_name;
+
+ //used only in write (update) requests
+ LLUUID session_id;
};
struct LLAvatarNotes
{
- LLUUID agent_id;
- LLUUID target_id; //target id
- std::string notes;
+ LLUUID agent_id;
+ LLUUID target_id; //target id
+ std::string notes;
};
struct LLAvatarGroups
{
- LLUUID agent_id;
- LLUUID avatar_id; //target id
- BOOL list_in_profile;
-
- struct LLGroupData;
- typedef std::list<LLGroupData> group_list_t;
-
- group_list_t group_list;
-
- struct LLGroupData
- {
- U64 group_powers;
- BOOL accept_notices;
- std::string group_title;
- LLUUID group_id;
- std::string group_name;
- LLUUID group_insignia_id;
- };
+ LLUUID agent_id;
+ LLUUID avatar_id; //target id
+ BOOL list_in_profile;
+
+ struct LLGroupData;
+ typedef std::list<LLGroupData> group_list_t;
+
+ group_list_t group_list;
+
+ struct LLGroupData
+ {
+ U64 group_powers;
+ BOOL accept_notices;
+ std::string group_title;
+ LLUUID group_id;
+ std::string group_name;
+ LLUUID group_insignia_id;
+ };
};
struct LLAvatarClassifieds
{
- LLUUID agent_id;
- LLUUID target_id;
+ LLUUID agent_id;
+ LLUUID target_id;
- struct classified_data;
- typedef std::list<classified_data> classifieds_list_t;
+ struct classified_data;
+ typedef std::list<classified_data> classifieds_list_t;
- classifieds_list_t classifieds_list;
+ classifieds_list_t classifieds_list;
- struct classified_data
- {
- LLUUID classified_id;
- std::string name;
- };
+ struct classified_data
+ {
+ LLUUID classified_id;
+ std::string name;
+ };
};
struct LLAvatarClassifiedInfo
{
- LLUUID agent_id;
- LLUUID classified_id;
- LLUUID creator_id;
- U32 creation_date;
- U32 expiration_date;
- U32 category;
- std::string name;
- std::string description;
- LLUUID parcel_id;
- U32 parent_estate;
- LLUUID snapshot_id;
- std::string sim_name;
- LLVector3d pos_global;
- std::string parcel_name;
- U8 flags;
- S32 price_for_listing;
+ LLUUID agent_id;
+ LLUUID classified_id;
+ LLUUID creator_id;
+ U32 creation_date;
+ U32 expiration_date;
+ U32 category;
+ std::string name;
+ std::string description;
+ LLUUID parcel_id;
+ U32 parent_estate;
+ LLUUID snapshot_id;
+ std::string sim_name;
+ LLVector3d pos_global;
+ std::string parcel_name;
+ U8 flags;
+ S32 price_for_listing;
};
class LLAvatarPropertiesObserver
{
public:
- virtual ~LLAvatarPropertiesObserver() {}
- virtual void processProperties(void* data, EAvatarProcessorType type) = 0;
+ virtual ~LLAvatarPropertiesObserver() {}
+ virtual void processProperties(void* data, EAvatarProcessorType type) = 0;
};
class LLAvatarPropertiesProcessor
- : public LLSingleton<LLAvatarPropertiesProcessor>
+ : public LLSingleton<LLAvatarPropertiesProcessor>
{
- LLSINGLETON(LLAvatarPropertiesProcessor);
- virtual ~LLAvatarPropertiesProcessor();
+ LLSINGLETON(LLAvatarPropertiesProcessor);
+ virtual ~LLAvatarPropertiesProcessor();
public:
- void addObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer);
+ void addObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer);
- void removeObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer);
+ void removeObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer);
- // Request various types of avatar data. Duplicate requests will be
- // suppressed while waiting for a response from the network.
- void sendAvatarPropertiesRequest(const LLUUID& avatar_id);
- void sendAvatarPicksRequest(const LLUUID& avatar_id);
- void sendAvatarNotesRequest(const LLUUID& avatar_id);
- void sendAvatarGroupsRequest(const LLUUID& avatar_id);
- void sendAvatarTexturesRequest(const LLUUID& avatar_id);
- void sendAvatarClassifiedsRequest(const LLUUID& avatar_id);
+ // Request various types of avatar data. Duplicate requests will be
+ // suppressed while waiting for a response from the network.
+ void sendAvatarPropertiesRequest(const LLUUID& avatar_id);
+ void sendAvatarPicksRequest(const LLUUID& avatar_id);
+ void sendAvatarNotesRequest(const LLUUID& avatar_id);
+ void sendAvatarGroupsRequest(const LLUUID& avatar_id);
+ void sendAvatarTexturesRequest(const LLUUID& avatar_id);
+ void sendAvatarClassifiedsRequest(const LLUUID& avatar_id);
- // Duplicate pick info requests are not suppressed.
- void sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id);
+ // Duplicate pick info requests are not suppressed.
+ void sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id);
- void sendClassifiedInfoRequest(const LLUUID& classified_id);
+ void sendClassifiedInfoRequest(const LLUUID& classified_id);
- void sendAvatarPropertiesUpdate(const LLAvatarData* avatar_props);
+ void sendAvatarPropertiesUpdate(const LLAvatarData* avatar_props);
- void sendPickInfoUpdate(const LLPickData* new_pick);
+ void sendPickInfoUpdate(const LLPickData* new_pick);
- void sendClassifiedInfoUpdate(const LLAvatarClassifiedInfo* c_data);
+ void sendClassifiedInfoUpdate(const LLAvatarClassifiedInfo* c_data);
- void sendFriendRights(const LLUUID& avatar_id, S32 rights);
+ void sendFriendRights(const LLUUID& avatar_id, S32 rights);
- void sendNotes(const LLUUID& avatar_id, const std::string notes);
+ void sendNotes(const LLUUID& avatar_id, const std::string notes);
- void sendPickDelete(const LLUUID& pick_id);
+ void sendPickDelete(const LLUUID& pick_id);
- void sendClassifiedDelete(const LLUUID& classified_id);
+ void sendClassifiedDelete(const LLUUID& classified_id);
void sendInterestsInfoUpdate(const LLInterestsData* interests_data);
- // Returns translated, human readable string for account type, such
- // as "Resident" or "Linden Employee". Used for profiles, inspectors.
- static std::string accountType(const LLAvatarData* avatar_data);
+ // Returns translated, human readable string for account type, such
+ // as "Resident" or "Linden Employee". Used for profiles, inspectors.
+ static std::string accountType(const LLAvatarData* avatar_data);
- // Returns translated, human readable string for payment info, such
- // as "Payment Info on File" or "Payment Info Used".
- // Used for profiles, inspectors.
- static std::string paymentInfo(const LLAvatarData* avatar_data);
+ // Returns translated, human readable string for payment info, such
+ // as "Payment Info on File" or "Payment Info Used".
+ // Used for profiles, inspectors.
+ static std::string paymentInfo(const LLAvatarData* avatar_data);
- static bool hasPaymentInfoOnFile(const LLAvatarData* avatar_data);
+ static bool hasPaymentInfoOnFile(const LLAvatarData* avatar_data);
static void requestAvatarPropertiesCoro(std::string cap_url, LLUUID agent_id);
- static void processAvatarPropertiesReply(LLMessageSystem* msg, void**);
+ static void processAvatarPropertiesReply(LLMessageSystem* msg, void**);
- static void processAvatarInterestsReply(LLMessageSystem* msg, void**);
+ static void processAvatarInterestsReply(LLMessageSystem* msg, void**);
- static void processAvatarClassifiedsReply(LLMessageSystem* msg, void**);
+ static void processAvatarClassifiedsReply(LLMessageSystem* msg, void**);
- static void processClassifiedInfoReply(LLMessageSystem* msg, void**);
+ static void processClassifiedInfoReply(LLMessageSystem* msg, void**);
- static void processAvatarGroupsReply(LLMessageSystem* msg, void**);
+ static void processAvatarGroupsReply(LLMessageSystem* msg, void**);
- static void processAvatarNotesReply(LLMessageSystem* msg, void**);
+ static void processAvatarNotesReply(LLMessageSystem* msg, void**);
- static void processAvatarPicksReply(LLMessageSystem* msg, void**);
+ static void processAvatarPicksReply(LLMessageSystem* msg, void**);
- static void processPickInfoReply(LLMessageSystem* msg, void**);
+ static void processPickInfoReply(LLMessageSystem* msg, void**);
protected:
- void sendRequest(const LLUUID& avatar_id, EAvatarProcessorType type, const std::string &method);
+ void sendRequest(const LLUUID& avatar_id, EAvatarProcessorType type, const std::string &method);
void sendGenericRequest(const LLUUID& avatar_id, EAvatarProcessorType type, const std::string &method);
void sendAvatarPropertiesRequestMessage(const LLUUID& avatar_id);
void initAgentProfileCapRequest(const LLUUID& avatar_id, const std::string& cap_url);
- void notifyObservers(const LLUUID& id,void* data, EAvatarProcessorType type);
+ void notifyObservers(const LLUUID& id,void* data, EAvatarProcessorType type);
- // Is there a pending, not timed out, request for this avatar's data?
- // Use this to suppress duplicate requests for data when a request is
- // pending.
- bool isPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type);
+ // Is there a pending, not timed out, request for this avatar's data?
+ // Use this to suppress duplicate requests for data when a request is
+ // pending.
+ bool isPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type);
- // Call this when a request has been sent
- void addPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type);
+ // Call this when a request has been sent
+ void addPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type);
- // Call this when the reply to the request is received
- void removePendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type);
+ // Call this when the reply to the request is received
+ void removePendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type);
- typedef void* (*processor_method_t)(LLMessageSystem*);
- static processor_method_t getProcessor(EAvatarProcessorType type);
+ typedef void* (*processor_method_t)(LLMessageSystem*);
+ static processor_method_t getProcessor(EAvatarProcessorType type);
protected:
-
- typedef std::multimap<LLUUID, LLAvatarPropertiesObserver*> observer_multimap_t;
-
- observer_multimap_t mObservers;
-
- // Keep track of pending requests for data by avatar id and type.
- // Maintain a timestamp for each request so a request that receives no reply
- // does not block future requests forever.
- // Map avatar_id+request_type -> U32 timestamp in seconds
- typedef std::map< std::pair<LLUUID, EAvatarProcessorType>, U32> timestamp_map_t;
- timestamp_map_t mRequestTimestamps;
+
+ typedef std::multimap<LLUUID, LLAvatarPropertiesObserver*> observer_multimap_t;
+
+ observer_multimap_t mObservers;
+
+ // Keep track of pending requests for data by avatar id and type.
+ // Maintain a timestamp for each request so a request that receives no reply
+ // does not block future requests forever.
+ // Map avatar_id+request_type -> U32 timestamp in seconds
+ typedef std::map< std::pair<LLUUID, EAvatarProcessorType>, U32> timestamp_map_t;
+ timestamp_map_t mRequestTimestamps;
};
#endif // LL_LLAVATARPROPERTIESPROCESSOR_H
diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp
index b95b971890..ec9cf2c8b7 100644
--- a/indra/newview/llavatarrenderinfoaccountant.cpp
+++ b/indra/newview/llavatarrenderinfoaccountant.cpp
@@ -2,26 +2,26 @@
* @file llavatarrenderinfoaccountant.cpp
* @author Dave Simmons
* @date 2013-02-28
- * @brief
- *
+ * @brief
+ *
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,20 +48,20 @@
#include "httpoptions.h"
#include "llcorehttputil.h"
-static const std::string KEY_AGENTS = "agents"; // map
-static const std::string KEY_WEIGHT = "weight"; // integer
-static const std::string KEY_TOO_COMPLEX = "tooComplex"; // bool
+static const std::string KEY_AGENTS = "agents"; // map
+static const std::string KEY_WEIGHT = "weight"; // integer
+static const std::string KEY_TOO_COMPLEX = "tooComplex"; // bool
static const std::string KEY_OVER_COMPLEXITY_LIMIT = "overlimit"; // integer
static const std::string KEY_REPORTING_COMPLEXITY_LIMIT = "reportinglimit"; // integer
-static const std::string KEY_IDENTIFIER = "identifier";
-static const std::string KEY_MESSAGE = "message";
-static const std::string KEY_ERROR = "error";
+static const std::string KEY_IDENTIFIER = "identifier";
+static const std::string KEY_MESSAGE = "message";
+static const std::string KEY_ERROR = "error";
+
+static const F32 SECS_BETWEEN_REGION_SCANS = 5.f; // Scan the region list every 5 seconds
+static const F32 SECS_BETWEEN_REGION_REQUEST = 15.0; // Look for new avs every 15 seconds
+static const F32 SECS_BETWEEN_REGION_REPORTS = 60.0; // Update each region every 60 seconds
-static const F32 SECS_BETWEEN_REGION_SCANS = 5.f; // Scan the region list every 5 seconds
-static const F32 SECS_BETWEEN_REGION_REQUEST = 15.0; // Look for new avs every 15 seconds
-static const F32 SECS_BETWEEN_REGION_REPORTS = 60.0; // Update each region every 60 seconds
-
//=========================================================================
LLAvatarRenderInfoAccountant::LLAvatarRenderInfoAccountant()
@@ -76,7 +76,7 @@ LLAvatarRenderInfoAccountant::~LLAvatarRenderInfoAccountant()
void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64 regionHandle)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("AvatarRenderInfoAccountant", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
@@ -99,7 +99,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64
LLViewerRegion * regionp = world_inst->getRegionFromHandle(regionHandle);
if (!regionp)
{
- LL_WARNS("AvatarRenderInfoAccountant") << "Avatar render weight info received but region not found for "
+ LL_WARNS("AvatarRenderInfoAccountant") << "Avatar render weight info received but region not found for "
<< regionHandle << LL_ENDL;
return;
}
@@ -137,7 +137,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64
const LLSD & agent_info_map = agent_iter->second;
if (agent_info_map.isMap())
{
- LL_DEBUGS("AvatarRenderInfo") << " Agent " << target_agent_id
+ LL_DEBUGS("AvatarRenderInfo") << " Agent " << target_agent_id
<< ": " << agent_info_map << LL_ENDL;
if (agent_info_map.has(KEY_WEIGHT))
@@ -163,7 +163,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64
{
LL_WARNS("AvatarRenderInfo") << "malformed get response '" << KEY_AGENTS << "' is not map" << LL_ENDL;
}
- } // has "agents"
+ } // has "agents"
else
{
LL_INFOS("AvatarRenderInfo") << "no '"<< KEY_AGENTS << "' key in get response" << LL_ENDL;
@@ -225,18 +225,18 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U
U32 num_avs = 0;
// Build the render info to POST to the region
LLSD agents = LLSD::emptyMap();
-
+
std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
while( iter != LLCharacter::sInstances.end() )
{
LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*iter);
if (avatar &&
- avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded)
- !avatar->isDead() && // Not dead yet
- !avatar->isControlAvatar() && // Not part of an animated object
- avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region
+ avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded)
+ !avatar->isDead() && // Not dead yet
+ !avatar->isControlAvatar() && // Not part of an animated object
+ avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region
{
- avatar->calculateUpdateRenderComplexity(); // Make sure the numbers are up-to-date
+ avatar->calculateUpdateRenderComplexity(); // Make sure the numbers are up-to-date
LLSD info = LLSD::emptyMap();
U32 avatar_complexity = avatar->getVisualComplexity();
@@ -261,7 +261,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U
if (num_avs == 0)
return; // nothing to report
-
+
LLSD report = LLSD::emptyMap();
report[KEY_AGENTS] = agents;
@@ -300,7 +300,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U
const LLSD & error = result[KEY_ERROR];
LL_WARNS("AvatarRenderInfoAccountant") << "POST error: "
<< error[KEY_IDENTIFIER]
- << ": " << error[KEY_MESSAGE]
+ << ": " << error[KEY_MESSAGE]
<< " from region " << regionp->getName()
<< LL_ENDL;
}
@@ -323,11 +323,11 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U
// called when the mRenderInfoScanTimer expires (forced when entering a new region)
void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regionp)
{
- std::string url = regionp->getCapability("AvatarRenderInfo");
- if ( !url.empty() // we have the capability
+ std::string url = regionp->getCapability("AvatarRenderInfo");
+ if ( !url.empty() // we have the capability
&& regionp->getRenderInfoReportTimer().hasExpired() // Time to make request)
)
- {
+ {
// make sure we won't re-report, coro will update timer with correct time later
regionp->getRenderInfoReportTimer().resetWithExpiry(SECS_BETWEEN_REGION_REPORTS);
@@ -342,20 +342,20 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "LLCoros::launch() allocation failure" << LL_ENDL;
}
- }
+ }
}
// Send request for avatar weights in one region
// called when the mRenderInfoScanTimer expires (forced when entering a new region)
void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regionp)
{
- std::string url = regionp->getCapability("AvatarRenderInfo");
- if ( !url.empty()
+ std::string url = regionp->getCapability("AvatarRenderInfo");
+ if ( !url.empty()
&& regionp->getRenderInfoRequestTimer().hasExpired()
)
- {
+ {
LL_DEBUGS("AvatarRenderInfo")
- << "Requesting avatar render info for region " << regionp->getName()
+ << "Requesting avatar render info for region " << regionp->getName()
<< " from " << url
<< LL_ENDL;
@@ -374,44 +374,44 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "LLCoros::launch() allocation failure" << LL_ENDL;
}
- }
+ }
}
// Called every frame - send render weight requests to every region
void LLAvatarRenderInfoAccountant::idle()
{
- if (mRenderInfoScanTimer.hasExpired() && !LLApp::isExiting())
- {
- LL_DEBUGS("AvatarRenderInfo") << "Scanning regions for render info updates"
- << LL_ENDL;
-
- // Check all regions
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end();
- ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if ( regionp
- && regionp->isAlive()
- && regionp->capabilitiesReceived())
- {
- // each of these is further governed by and resets its own timer
+ if (mRenderInfoScanTimer.hasExpired() && !LLApp::isExiting())
+ {
+ LL_DEBUGS("AvatarRenderInfo") << "Scanning regions for render info updates"
+ << LL_ENDL;
+
+ // Check all regions
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end();
+ ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if ( regionp
+ && regionp->isAlive()
+ && regionp->capabilitiesReceived())
+ {
+ // each of these is further governed by and resets its own timer
// Note: We can have multiple regions, each launches up to two coroutines,
// it likely is expensive
- sendRenderInfoToRegion(regionp);
- getRenderInfoFromRegion(regionp);
- }
- }
-
- // We scanned all the regions, reset the request timer.
- mRenderInfoScanTimer.resetWithExpiry(SECS_BETWEEN_REGION_SCANS);
- }
+ sendRenderInfoToRegion(regionp);
+ getRenderInfoFromRegion(regionp);
+ }
+ }
+
+ // We scanned all the regions, reset the request timer.
+ mRenderInfoScanTimer.resetWithExpiry(SECS_BETWEEN_REGION_SCANS);
+ }
}
void LLAvatarRenderInfoAccountant::resetRenderInfoScanTimer()
{
- // this will force the next frame to rescan
- mRenderInfoScanTimer.reset();
+ // this will force the next frame to rescan
+ mRenderInfoScanTimer.reset();
}
// static
@@ -419,21 +419,21 @@ void LLAvatarRenderInfoAccountant::resetRenderInfoScanTimer()
// are returned for a new LLViewerRegion, and is the earliest time to get render info
void LLAvatarRenderInfoAccountant::scanNewRegion(const LLUUID& region_id)
{
- LL_DEBUGS("AvatarRenderInfo") << region_id << LL_ENDL;
-
- // Reset the global timer so it will scan regions on the next call to ::idle
- LLAvatarRenderInfoAccountant::getInstance()->resetRenderInfoScanTimer();
-
- LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id);
- if (regionp)
- { // Reset the region's timers so we will:
- // * request render info from it immediately
- // * report on the following scan
- regionp->getRenderInfoRequestTimer().reset();
- regionp->getRenderInfoReportTimer().resetWithExpiry(SECS_BETWEEN_REGION_SCANS);
- }
- else
- {
- LL_WARNS("AvatarRenderInfo") << "unable to resolve region "<<region_id<<LL_ENDL;
- }
+ LL_DEBUGS("AvatarRenderInfo") << region_id << LL_ENDL;
+
+ // Reset the global timer so it will scan regions on the next call to ::idle
+ LLAvatarRenderInfoAccountant::getInstance()->resetRenderInfoScanTimer();
+
+ LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id);
+ if (regionp)
+ { // Reset the region's timers so we will:
+ // * request render info from it immediately
+ // * report on the following scan
+ regionp->getRenderInfoRequestTimer().reset();
+ regionp->getRenderInfoReportTimer().resetWithExpiry(SECS_BETWEEN_REGION_SCANS);
+ }
+ else
+ {
+ LL_WARNS("AvatarRenderInfo") << "unable to resolve region "<<region_id<<LL_ENDL;
+ }
}
diff --git a/indra/newview/llavatarrenderinfoaccountant.h b/indra/newview/llavatarrenderinfoaccountant.h
index 6b5fa7bc35..774e1b6240 100644
--- a/indra/newview/llavatarrenderinfoaccountant.h
+++ b/indra/newview/llavatarrenderinfoaccountant.h
@@ -2,26 +2,26 @@
* @file llavatarrenderinfoaccountant.h
* @author Dave Simmons
* @date 2013-02-28
- * @brief
- *
+ * @brief
+ *
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,30 +34,30 @@
class LLViewerRegion;
-// Class to gather avatar rendering information
+// Class to gather avatar rendering information
// that is sent to or fetched from regions.
class LLAvatarRenderInfoAccountant : public LLSingleton<LLAvatarRenderInfoAccountant>
{
- LLSINGLETON(LLAvatarRenderInfoAccountant);
- ~LLAvatarRenderInfoAccountant();
+ LLSINGLETON(LLAvatarRenderInfoAccountant);
+ ~LLAvatarRenderInfoAccountant();
private:
- LOG_CLASS(LLAvatarRenderInfoAccountant);
+ LOG_CLASS(LLAvatarRenderInfoAccountant);
public:
- void sendRenderInfoToRegion(LLViewerRegion * regionp);
- void getRenderInfoFromRegion(LLViewerRegion * regionp);
+ void sendRenderInfoToRegion(LLViewerRegion * regionp);
+ void getRenderInfoFromRegion(LLViewerRegion * regionp);
- void idle(); // called once per frame
+ void idle(); // called once per frame
- void resetRenderInfoScanTimer();
-
- static void scanNewRegion(const LLUUID& region_id);
+ void resetRenderInfoScanTimer();
+
+ static void scanNewRegion(const LLUUID& region_id);
private:
- // frequency of region scans,
- // further limited by per region Request and Report timers
- LLFrameTimer mRenderInfoScanTimer;
+ // frequency of region scans,
+ // further limited by per region Request and Report timers
+ LLFrameTimer mRenderInfoScanTimer;
static void avatarRenderInfoGetCoro(std::string url, U64 regionHandle);
static void avatarRenderInfoReportCoro(std::string url, U64 regionHandle);
diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp
index 8b09f7903d..61fc9d00f3 100644
--- a/indra/newview/llavatarrendernotifier.cpp
+++ b/indra/newview/llavatarrendernotifier.cpp
@@ -2,26 +2,26 @@
* @file llavatarrendernotifier.cpp
* @author andreykproductengine
* @date 2015-08-05
- * @brief
- *
+ * @brief
+ *
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -113,12 +113,12 @@ void LLAvatarRenderNotifier::displayNotification(bool show_over_limit)
{
mAgentComplexity = mLatestAgentComplexity;
mShowOverLimitAgents = show_over_limit;
- static LLCachedControl<U32> expire_delay(gSavedSettings, "ShowMyComplexityChanges", 20);
+ static LLCachedControl<U32> expire_delay(gSavedSettings, "ShowMyComplexityChanges", 20);
- LLDate expire_date(LLDate::now().secondsSinceEpoch() + expire_delay);
- LLSD args;
- args["AGENT_COMPLEXITY"] = LLSD::Integer(mLatestAgentComplexity);
- std::string notification_name;
+ LLDate expire_date(LLDate::now().secondsSinceEpoch() + expire_delay);
+ LLSD args;
+ args["AGENT_COMPLEXITY"] = LLSD::Integer(mLatestAgentComplexity);
+ std::string notification_name;
if (mShowOverLimitAgents)
{
notification_name = "AgentComplexityWithVisibility";
@@ -128,19 +128,19 @@ void LLAvatarRenderNotifier::displayNotification(bool show_over_limit)
mAgentsCount = mLatestAgentsCount;
mOverLimitAgents = mLatestOverLimitAgents;
mOverLimitPct = mLatestOverLimitPct;
- }
- else
- {
+ }
+ else
+ {
// no change in visibility, just update complexity
notification_name = "AgentComplexity";
- }
+ }
- if (mNotificationPtr != NULL && mNotificationPtr->getName() != notification_name)
- {
- // since unique tag works only for same notification,
- // old notification needs to be canceled manually
- LLNotifications::instance().cancel(mNotificationPtr);
- }
+ if (mNotificationPtr != NULL && mNotificationPtr->getName() != notification_name)
+ {
+ // since unique tag works only for same notification,
+ // old notification needs to be canceled manually
+ LLNotifications::instance().cancel(mNotificationPtr);
+ }
// log unconditionally
LL_WARNS("AvatarRenderInfo") << notification_name << " " << args << LL_ENDL;
@@ -158,21 +158,21 @@ void LLAvatarRenderNotifier::displayNotification(bool show_over_limit)
bool LLAvatarRenderNotifier::isNotificationVisible()
{
- return mNotificationPtr != NULL && mNotificationPtr->isActive();
+ return mNotificationPtr != NULL && mNotificationPtr->isActive();
}
void LLAvatarRenderNotifier::updateNotificationRegion(U32 agentcount, U32 overLimit)
{
- if (agentcount == 0)
- {
- // Data not ready
- return;
- }
+ if (agentcount == 0)
+ {
+ // Data not ready
+ return;
+ }
- // save current values for later use
- mLatestAgentsCount = agentcount > overLimit ? agentcount - 1 : agentcount; // subtract self
- mLatestOverLimitAgents = overLimit;
- mLatestOverLimitPct = mLatestAgentsCount != 0 ? ((F32)overLimit / (F32)mLatestAgentsCount) * 100.0 : 0;
+ // save current values for later use
+ mLatestAgentsCount = agentcount > overLimit ? agentcount - 1 : agentcount; // subtract self
+ mLatestOverLimitAgents = overLimit;
+ mLatestOverLimitPct = mLatestAgentsCount != 0 ? ((F32)overLimit / (F32)mLatestAgentsCount) * 100.0 : 0;
if (mAgentsCount == mLatestAgentsCount
&& mOverLimitAgents == mLatestOverLimitAgents)
@@ -313,7 +313,7 @@ void LLHUDRenderNotifier::updateNotificationHUD(hud_complexity_list_t complexity
{
return;
}
-
+
// TODO:
// Find a way to show message with list of issues, but without making it too large
// and intrusive.
diff --git a/indra/newview/llavatarrendernotifier.h b/indra/newview/llavatarrendernotifier.h
index 37130bfcf6..97c24c3cba 100644
--- a/indra/newview/llavatarrendernotifier.h
+++ b/indra/newview/llavatarrendernotifier.h
@@ -2,26 +2,26 @@
* @file llavatarrendernotifier.h
* @author andreykproductengine
* @date 2015-08-05
- * @brief
- *
+ * @brief
+ *
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -86,40 +86,40 @@ typedef std::list<LLObjectComplexity> object_complexity_list_t;
// reported that user's agent is too 'heavy' for their settings
class LLAvatarRenderNotifier : public LLSingleton<LLAvatarRenderNotifier>
{
- LLSINGLETON(LLAvatarRenderNotifier);
+ LLSINGLETON(LLAvatarRenderNotifier);
public:
void displayNotification(bool show_over_limit);
- bool isNotificationVisible();
+ bool isNotificationVisible();
- void updateNotificationRegion(U32 agentcount, U32 overLimit);
+ void updateNotificationRegion(U32 agentcount, U32 overLimit);
void updateNotificationState();
- void updateNotificationAgent(U32 agentComplexity);
+ void updateNotificationAgent(U32 agentComplexity);
void setObjectComplexityList(object_complexity_list_t object_list) { mObjectComplexityList = object_list; }
object_complexity_list_t getObjectComplexityList() { return mObjectComplexityList; }
private:
- LLNotificationPtr mNotificationPtr;
+ LLNotificationPtr mNotificationPtr;
- // to prevent notification from popping up too often, show it only
- // if certain amount of time passed since previous notification
- LLFrameTimer mPopUpDelayTimer;
+ // to prevent notification from popping up too often, show it only
+ // if certain amount of time passed since previous notification
+ LLFrameTimer mPopUpDelayTimer;
- // values since last notification for comparison purposes
- U32 mAgentsCount;
- U32 mOverLimitAgents;
- U32 mAgentComplexity;
- F32 mOverLimitPct;
+ // values since last notification for comparison purposes
+ U32 mAgentsCount;
+ U32 mOverLimitAgents;
+ U32 mAgentComplexity;
+ F32 mOverLimitPct;
- // last reported values
- U32 mLatestAgentsCount;
- U32 mLatestOverLimitAgents;
- U32 mLatestAgentComplexity;
- F32 mLatestOverLimitPct;
+ // last reported values
+ U32 mLatestAgentsCount;
+ U32 mLatestOverLimitAgents;
+ U32 mLatestAgentComplexity;
+ F32 mLatestOverLimitPct;
- bool mShowOverLimitAgents;
+ bool mShowOverLimitAgents;
std::string overLimitMessage();
// initial outfit related variables (state control)
diff --git a/indra/newview/llblockedlistitem.cpp b/indra/newview/llblockedlistitem.cpp
index d9afd2b629..875e8e0bf1 100644
--- a/indra/newview/llblockedlistitem.cpp
+++ b/indra/newview/llblockedlistitem.cpp
@@ -43,72 +43,72 @@
#include "llviewerobject.h"
LLBlockedListItem::LLBlockedListItem(const LLMute* item)
-: LLPanel(),
- mItemID(item->mID),
- mItemName(item->mName),
- mMuteType(item->mType)
+: LLPanel(),
+ mItemID(item->mID),
+ mItemName(item->mName),
+ mMuteType(item->mType)
{
- buildFromFile("panel_blocked_list_item.xml");
+ buildFromFile("panel_blocked_list_item.xml");
}
BOOL LLBlockedListItem::postBuild()
{
- mTitleCtrl = getChild<LLTextBox>("item_name");
- mTitleCtrl->setValue(mItemName);
+ mTitleCtrl = getChild<LLTextBox>("item_name");
+ mTitleCtrl->setValue(mItemName);
- switch (mMuteType)
- {
- case LLMute::AGENT:
- case LLMute::EXTERNAL:
- {
- LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon");
- avatar_icon->setVisible(TRUE);
- avatar_icon->setValue(mItemID);
- }
- break;
- case LLMute::GROUP:
- {
- LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon");
- group_icon->setVisible(TRUE);
- group_icon->setValue(mItemID);
- }
- break;
- case LLMute::OBJECT:
- case LLMute::BY_NAME:
- getChild<LLUICtrl>("object_icon")->setVisible(TRUE);
- break;
+ switch (mMuteType)
+ {
+ case LLMute::AGENT:
+ case LLMute::EXTERNAL:
+ {
+ LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon");
+ avatar_icon->setVisible(TRUE);
+ avatar_icon->setValue(mItemID);
+ }
+ break;
+ case LLMute::GROUP:
+ {
+ LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon");
+ group_icon->setVisible(TRUE);
+ group_icon->setValue(mItemID);
+ }
+ break;
+ case LLMute::OBJECT:
+ case LLMute::BY_NAME:
+ getChild<LLUICtrl>("object_icon")->setVisible(TRUE);
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- return TRUE;
+ return TRUE;
}
void LLBlockedListItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible(true);
- LLPanel::onMouseEnter(x, y, mask);
+ getChildView("hovered_icon")->setVisible(true);
+ LLPanel::onMouseEnter(x, y, mask);
}
void LLBlockedListItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible(false);
- LLPanel::onMouseLeave(x, y, mask);
+ getChildView("hovered_icon")->setVisible(false);
+ LLPanel::onMouseLeave(x, y, mask);
}
void LLBlockedListItem::setValue(const LLSD& value)
{
- if (!value.isMap() || !value.has("selected"))
- {
- return;
- }
+ if (!value.isMap() || !value.has("selected"))
+ {
+ return;
+ }
- getChildView("selected_icon")->setVisible(value["selected"]);
+ getChildView("selected_icon")->setVisible(value["selected"]);
}
void LLBlockedListItem::highlightName(const std::string& highlited_text)
{
- LLStyle::Params params;
- LLTextUtil::textboxSetHighlightedVal(mTitleCtrl, params, mItemName, highlited_text);
+ LLStyle::Params params;
+ LLTextUtil::textboxSetHighlightedVal(mTitleCtrl, params, mItemName, highlited_text);
}
diff --git a/indra/newview/llblockedlistitem.h b/indra/newview/llblockedlistitem.h
index 05409e8a3b..3eeefd622b 100644
--- a/indra/newview/llblockedlistitem.h
+++ b/indra/newview/llblockedlistitem.h
@@ -48,25 +48,25 @@ class LLBlockedListItem : public LLPanel
{
public:
- LLBlockedListItem(const LLMute* item);
- virtual BOOL postBuild();
+ LLBlockedListItem(const LLMute* item);
+ virtual BOOL postBuild();
- void onMouseEnter(S32 x, S32 y, MASK mask);
- void onMouseLeave(S32 x, S32 y, MASK mask);
+ void onMouseEnter(S32 x, S32 y, MASK mask);
+ void onMouseLeave(S32 x, S32 y, MASK mask);
- virtual void setValue(const LLSD& value);
+ virtual void setValue(const LLSD& value);
- void highlightName(const std::string& highlited_text);
- const std::string& getName() const { return mItemName; }
- const LLMute::EType& getType() const { return mMuteType; }
- const LLUUID& getUUID() const { return mItemID; }
+ void highlightName(const std::string& highlited_text);
+ const std::string& getName() const { return mItemName; }
+ const LLMute::EType& getType() const { return mMuteType; }
+ const LLUUID& getUUID() const { return mItemID; }
private:
- LLTextBox* mTitleCtrl;
- const LLUUID mItemID;
- std::string mItemName;
- LLMute::EType mMuteType;
+ LLTextBox* mTitleCtrl;
+ const LLUUID mItemID;
+ std::string mItemName;
+ LLMute::EType mMuteType;
};
diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp
index 1eab2d8e23..31b83cfb57 100644
--- a/indra/newview/llblocklist.cpp
+++ b/indra/newview/llblocklist.cpp
@@ -35,243 +35,243 @@
static LLDefaultChildRegistry::Register<LLBlockList> r("block_list");
-static const LLBlockListNameComparator NAME_COMPARATOR;
-static const LLBlockListNameTypeComparator NAME_TYPE_COMPARATOR;
+static const LLBlockListNameComparator NAME_COMPARATOR;
+static const LLBlockListNameTypeComparator NAME_TYPE_COMPARATOR;
LLBlockList::LLBlockList(const Params& p)
-: LLFlatListViewEx(p),
- mDirty(true),
- mShouldAddAll(true),
- mActionType(NONE),
- mMuteListSize(0)
+: LLFlatListViewEx(p),
+ mDirty(true),
+ mShouldAddAll(true),
+ mActionType(NONE),
+ mMuteListSize(0)
{
- LLMuteList::getInstance()->addObserver(this);
- mMuteListSize = LLMuteList::getInstance()->getMutes().size();
-
- // Set up context menu.
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
-
- registrar.add ("Block.Action", boost::bind(&LLBlockList::onCustomAction, this, _2));
- enable_registrar.add("Block.Enable", boost::bind(&LLBlockList::isActionEnabled, this, _2));
- enable_registrar.add("Block.Check", boost::bind(&LLBlockList::isMenuItemChecked, this, _2));
- enable_registrar.add("Block.Visible", boost::bind(&LLBlockList::isMenuItemVisible, this, _2));
-
- LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
- "menu_people_blocked_gear.xml",
- gMenuHolder,
- LLViewerMenuHolderGL::child_registry_t::instance());
- if(context_menu)
- {
- mContextMenu = context_menu->getHandle();
- }
+ LLMuteList::getInstance()->addObserver(this);
+ mMuteListSize = LLMuteList::getInstance()->getMutes().size();
+
+ // Set up context menu.
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+
+ registrar.add ("Block.Action", boost::bind(&LLBlockList::onCustomAction, this, _2));
+ enable_registrar.add("Block.Enable", boost::bind(&LLBlockList::isActionEnabled, this, _2));
+ enable_registrar.add("Block.Check", boost::bind(&LLBlockList::isMenuItemChecked, this, _2));
+ enable_registrar.add("Block.Visible", boost::bind(&LLBlockList::isMenuItemVisible, this, _2));
+
+ LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
+ "menu_people_blocked_gear.xml",
+ gMenuHolder,
+ LLViewerMenuHolderGL::child_registry_t::instance());
+ if(context_menu)
+ {
+ mContextMenu = context_menu->getHandle();
+ }
}
LLBlockList::~LLBlockList()
{
- if (mContextMenu.get())
- {
- mContextMenu.get()->die();
- }
+ if (mContextMenu.get())
+ {
+ mContextMenu.get()->die();
+ }
- LLMuteList::getInstance()->removeObserver(this);
+ LLMuteList::getInstance()->removeObserver(this);
}
void LLBlockList::createList()
{
- std::vector<LLMute> mutes = LLMuteList::instance().getMutes();
- std::vector<LLMute>::const_iterator mute_it = mutes.begin();
+ std::vector<LLMute> mutes = LLMuteList::instance().getMutes();
+ std::vector<LLMute>::const_iterator mute_it = mutes.begin();
- for (; mute_it != mutes.end(); ++mute_it)
- {
- addNewItem(&*mute_it);
- }
+ for (; mute_it != mutes.end(); ++mute_it)
+ {
+ addNewItem(&*mute_it);
+ }
}
BlockListActionType LLBlockList::getCurrentMuteListActionType()
{
- BlockListActionType type = NONE;
- U32 curSize = LLMuteList::getInstance()->getMutes().size();
- if( curSize > mMuteListSize)
- type = ADD;
- else if(curSize < mMuteListSize)
- type = REMOVE;
-
- return type;
+ BlockListActionType type = NONE;
+ U32 curSize = LLMuteList::getInstance()->getMutes().size();
+ if( curSize > mMuteListSize)
+ type = ADD;
+ else if(curSize < mMuteListSize)
+ type = REMOVE;
+
+ return type;
}
void LLBlockList::onChangeDetailed(const LLMute &mute)
{
- mActionType = getCurrentMuteListActionType();
+ mActionType = getCurrentMuteListActionType();
- mCurItemId = mute.mID;
- mCurItemName = mute.mName;
- mCurItemType = mute.mType;
- mCurItemFlags = mute.mFlags;
+ mCurItemId = mute.mID;
+ mCurItemName = mute.mName;
+ mCurItemType = mute.mType;
+ mCurItemFlags = mute.mFlags;
- refresh();
+ refresh();
}
BOOL LLBlockList::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
+ BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
- LLToggleableMenu* context_menu = mContextMenu.get();
- if (context_menu && size())
- {
- context_menu->buildDrawLabels();
- context_menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(this, context_menu, x, y);
- }
+ LLToggleableMenu* context_menu = mContextMenu.get();
+ if (context_menu && size())
+ {
+ context_menu->buildDrawLabels();
+ context_menu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(this, context_menu, x, y);
+ }
- return handled;
+ return handled;
}
void LLBlockList::removeListItem(const LLMute* mute)
{
- if (mute->mID.notNull())
- {
- removeItemByUUID(mute->mID);
- }
- else
- {
- removeItemByValue(mute->mName);
- }
+ if (mute->mID.notNull())
+ {
+ removeItemByUUID(mute->mID);
+ }
+ else
+ {
+ removeItemByValue(mute->mName);
+ }
}
void LLBlockList::hideListItem(LLBlockedListItem* item, bool show)
{
- item->setVisible(show);
+ item->setVisible(show);
}
void LLBlockList::setNameFilter(const std::string& filter)
{
- std::string filter_upper = filter;
- LLStringUtil::toUpper(filter_upper);
- if (mNameFilter != filter_upper)
- {
- mNameFilter = filter_upper;
- setDirty();
- }
+ std::string filter_upper = filter;
+ LLStringUtil::toUpper(filter_upper);
+ if (mNameFilter != filter_upper)
+ {
+ mNameFilter = filter_upper;
+ setDirty();
+ }
}
void LLBlockList::sortByName()
{
- setComparator(&NAME_COMPARATOR);
- sort();
+ setComparator(&NAME_COMPARATOR);
+ sort();
}
void LLBlockList::sortByType()
{
- setComparator(&NAME_TYPE_COMPARATOR);
- sort();
+ setComparator(&NAME_TYPE_COMPARATOR);
+ sort();
}
void LLBlockList::draw()
{
- if (mDirty)
- {
- refresh();
- }
+ if (mDirty)
+ {
+ refresh();
+ }
- LLFlatListView::draw();
+ LLFlatListView::draw();
}
void LLBlockList::addNewItem(const LLMute* mute)
{
- LLBlockedListItem* item = new LLBlockedListItem(mute);
- if (!mNameFilter.empty())
- {
- item->highlightName(mNameFilter);
- }
- if (item->getUUID().notNull())
- {
- addItem(item, item->getUUID(), ADD_BOTTOM);
- }
- else
- {
- addItem(item, item->getName(), ADD_BOTTOM);
- }
+ LLBlockedListItem* item = new LLBlockedListItem(mute);
+ if (!mNameFilter.empty())
+ {
+ item->highlightName(mNameFilter);
+ }
+ if (item->getUUID().notNull())
+ {
+ addItem(item, item->getUUID(), ADD_BOTTOM);
+ }
+ else
+ {
+ addItem(item, item->getName(), ADD_BOTTOM);
+ }
}
void LLBlockList::refresh()
{
- bool have_filter = !mNameFilter.empty();
-
- // save selection to restore it after list rebuilt
- LLSD selected = getSelectedValue();
- LLSD next_selected;
-
- if(mShouldAddAll) // creating list of blockers
- {
- clear();
- createList();
- mShouldAddAll = false;
- }
- else
- {
- // handle remove/add functionality
- LLMute mute(mCurItemId, mCurItemName, mCurItemType, mCurItemFlags);
- if(mActionType == ADD)
- {
- addNewItem(&mute);
- }
- else if(mActionType == REMOVE)
- {
- if ((mute.mID.notNull() && selected.isUUID() && selected.asUUID() == mute.mID)
- || (mute.mID.isNull() && selected.isString() && selected.asString() == mute.mName))
- {
- // we are going to remove currently selected item, so select next item and save the selection to restore it
- if (!selectNextItemPair(false, true))
- {
- selectNextItemPair(true, true);
- }
- next_selected = getSelectedValue();
- }
- removeListItem(&mute);
- }
- mActionType = NONE;
- }
-
- // handle filter functionality
- if(have_filter || (!have_filter && !mPrevNameFilter.empty()))
- {
- // we should update visibility of our items if previous filter was not empty
- std::vector < LLPanel* > allItems;
- getItems(allItems);
- std::vector < LLPanel* >::iterator it = allItems.begin();
-
- for(; it != allItems.end() ; ++it)
- {
- LLBlockedListItem * curItem = dynamic_cast<LLBlockedListItem *> (*it);
- if(curItem)
- {
- hideListItem(curItem, findInsensitive(curItem->getName(), mNameFilter));
- }
- }
- }
- mPrevNameFilter = mNameFilter;
-
- if (selected.isDefined())
- {
- if (getItemPair(selected))
- {
- // restore previously selected item
- selectItemPair(getItemPair(selected), true);
- }
- else if (next_selected.isDefined() && getItemPair(next_selected))
- {
- // previously selected item was removed, so select next item
- selectItemPair(getItemPair(next_selected), true);
- }
- }
- mMuteListSize = LLMuteList::getInstance()->getMutes().size();
-
- // Sort the list.
- sort();
-
- setDirty(false);
+ bool have_filter = !mNameFilter.empty();
+
+ // save selection to restore it after list rebuilt
+ LLSD selected = getSelectedValue();
+ LLSD next_selected;
+
+ if(mShouldAddAll) // creating list of blockers
+ {
+ clear();
+ createList();
+ mShouldAddAll = false;
+ }
+ else
+ {
+ // handle remove/add functionality
+ LLMute mute(mCurItemId, mCurItemName, mCurItemType, mCurItemFlags);
+ if(mActionType == ADD)
+ {
+ addNewItem(&mute);
+ }
+ else if(mActionType == REMOVE)
+ {
+ if ((mute.mID.notNull() && selected.isUUID() && selected.asUUID() == mute.mID)
+ || (mute.mID.isNull() && selected.isString() && selected.asString() == mute.mName))
+ {
+ // we are going to remove currently selected item, so select next item and save the selection to restore it
+ if (!selectNextItemPair(false, true))
+ {
+ selectNextItemPair(true, true);
+ }
+ next_selected = getSelectedValue();
+ }
+ removeListItem(&mute);
+ }
+ mActionType = NONE;
+ }
+
+ // handle filter functionality
+ if(have_filter || (!have_filter && !mPrevNameFilter.empty()))
+ {
+ // we should update visibility of our items if previous filter was not empty
+ std::vector < LLPanel* > allItems;
+ getItems(allItems);
+ std::vector < LLPanel* >::iterator it = allItems.begin();
+
+ for(; it != allItems.end() ; ++it)
+ {
+ LLBlockedListItem * curItem = dynamic_cast<LLBlockedListItem *> (*it);
+ if(curItem)
+ {
+ hideListItem(curItem, findInsensitive(curItem->getName(), mNameFilter));
+ }
+ }
+ }
+ mPrevNameFilter = mNameFilter;
+
+ if (selected.isDefined())
+ {
+ if (getItemPair(selected))
+ {
+ // restore previously selected item
+ selectItemPair(getItemPair(selected), true);
+ }
+ else if (next_selected.isDefined() && getItemPair(next_selected))
+ {
+ // previously selected item was removed, so select next item
+ selectItemPair(getItemPair(next_selected), true);
+ }
+ }
+ mMuteListSize = LLMuteList::getInstance()->getMutes().size();
+
+ // Sort the list.
+ sort();
+
+ setDirty(false);
}
bool LLBlockList::findInsensitive(std::string haystack, const std::string& needle_upper)
@@ -282,182 +282,182 @@ bool LLBlockList::findInsensitive(std::string haystack, const std::string& needl
LLBlockedListItem* LLBlockList::getBlockedItem() const
{
- LLPanel* panel = LLFlatListView::getSelectedItem();
- LLBlockedListItem* item = dynamic_cast<LLBlockedListItem*>(panel);
- return item;
+ LLPanel* panel = LLFlatListView::getSelectedItem();
+ LLBlockedListItem* item = dynamic_cast<LLBlockedListItem*>(panel);
+ return item;
}
bool LLBlockList::isActionEnabled(const LLSD& userdata)
{
- bool action_enabled = true;
-
- const std::string command_name = userdata.asString();
-
- if ("profile_item" == command_name
- || "block_voice" == command_name
- || "block_text" == command_name
- || "block_particles" == command_name
- || "block_obj_sounds" == command_name)
- {
- LLBlockedListItem* item = getBlockedItem();
- action_enabled = item && (LLMute::AGENT == item->getType());
- }
-
- if ("unblock_item" == command_name)
- {
- action_enabled = getSelectedItem() != NULL;
- }
-
- return action_enabled;
+ bool action_enabled = true;
+
+ const std::string command_name = userdata.asString();
+
+ if ("profile_item" == command_name
+ || "block_voice" == command_name
+ || "block_text" == command_name
+ || "block_particles" == command_name
+ || "block_obj_sounds" == command_name)
+ {
+ LLBlockedListItem* item = getBlockedItem();
+ action_enabled = item && (LLMute::AGENT == item->getType());
+ }
+
+ if ("unblock_item" == command_name)
+ {
+ action_enabled = getSelectedItem() != NULL;
+ }
+
+ return action_enabled;
}
void LLBlockList::onCustomAction(const LLSD& userdata)
{
- if (!isActionEnabled(userdata))
- {
- return;
- }
-
- LLBlockedListItem* item = getBlockedItem();
- const std::string command_name = userdata.asString();
-
- if ("unblock_item" == command_name)
- {
- LLMute mute(item->getUUID(), item->getName());
- LLMuteList::getInstance()->remove(mute);
- }
- else if ("profile_item" == command_name)
- {
- switch(item->getType())
- {
-
- case LLMute::AGENT:
- LLAvatarActions::showProfile(item->getUUID());
- break;
-
- default:
- break;
- }
- }
- else if ("block_voice" == command_name)
- {
- toggleMute(LLMute::flagVoiceChat);
- }
- else if ("block_text" == command_name)
- {
- toggleMute(LLMute::flagTextChat);
- }
- else if ("block_particles" == command_name)
- {
- toggleMute(LLMute::flagParticles);
- }
- else if ("block_obj_sounds" == command_name)
- {
- toggleMute(LLMute::flagObjectSounds);
- }
+ if (!isActionEnabled(userdata))
+ {
+ return;
+ }
+
+ LLBlockedListItem* item = getBlockedItem();
+ const std::string command_name = userdata.asString();
+
+ if ("unblock_item" == command_name)
+ {
+ LLMute mute(item->getUUID(), item->getName());
+ LLMuteList::getInstance()->remove(mute);
+ }
+ else if ("profile_item" == command_name)
+ {
+ switch(item->getType())
+ {
+
+ case LLMute::AGENT:
+ LLAvatarActions::showProfile(item->getUUID());
+ break;
+
+ default:
+ break;
+ }
+ }
+ else if ("block_voice" == command_name)
+ {
+ toggleMute(LLMute::flagVoiceChat);
+ }
+ else if ("block_text" == command_name)
+ {
+ toggleMute(LLMute::flagTextChat);
+ }
+ else if ("block_particles" == command_name)
+ {
+ toggleMute(LLMute::flagParticles);
+ }
+ else if ("block_obj_sounds" == command_name)
+ {
+ toggleMute(LLMute::flagObjectSounds);
+ }
}
bool LLBlockList::isMenuItemChecked(const LLSD& userdata)
{
- LLBlockedListItem* item = getBlockedItem();
- if (!item)
- {
- return false;
- }
-
- const std::string command_name = userdata.asString();
-
- if ("block_voice" == command_name)
- {
- return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagVoiceChat);
- }
- else if ("block_text" == command_name)
- {
- return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagTextChat);
- }
- else if ("block_particles" == command_name)
- {
- return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagParticles);
- }
- else if ("block_obj_sounds" == command_name)
- {
- return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagObjectSounds);
- }
-
- return false;
+ LLBlockedListItem* item = getBlockedItem();
+ if (!item)
+ {
+ return false;
+ }
+
+ const std::string command_name = userdata.asString();
+
+ if ("block_voice" == command_name)
+ {
+ return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagVoiceChat);
+ }
+ else if ("block_text" == command_name)
+ {
+ return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagTextChat);
+ }
+ else if ("block_particles" == command_name)
+ {
+ return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagParticles);
+ }
+ else if ("block_obj_sounds" == command_name)
+ {
+ return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagObjectSounds);
+ }
+
+ return false;
}
bool LLBlockList::isMenuItemVisible(const LLSD& userdata)
{
- LLBlockedListItem* item = getBlockedItem();
- const std::string command_name = userdata.asString();
-
- if ("block_voice" == command_name
- || "block_text" == command_name
- || "block_particles" == command_name
- || "block_obj_sounds" == command_name)
- {
- return item && (LLMute::AGENT == item->getType());
- }
-
- return false;
+ LLBlockedListItem* item = getBlockedItem();
+ const std::string command_name = userdata.asString();
+
+ if ("block_voice" == command_name
+ || "block_text" == command_name
+ || "block_particles" == command_name
+ || "block_obj_sounds" == command_name)
+ {
+ return item && (LLMute::AGENT == item->getType());
+ }
+
+ return false;
}
void LLBlockList::toggleMute(U32 flags)
{
- LLBlockedListItem* item = getBlockedItem();
- LLMute mute(item->getUUID(), item->getName(), item->getType());
-
- if (!LLMuteList::getInstance()->isMuted(item->getUUID(), flags))
- {
- LLMuteList::getInstance()->add(mute, flags);
- }
- else
- {
- LLMuteList::getInstance()->remove(mute, flags);
- }
+ LLBlockedListItem* item = getBlockedItem();
+ LLMute mute(item->getUUID(), item->getName(), item->getType());
+
+ if (!LLMuteList::getInstance()->isMuted(item->getUUID(), flags))
+ {
+ LLMuteList::getInstance()->add(mute, flags);
+ }
+ else
+ {
+ LLMuteList::getInstance()->remove(mute, flags);
+ }
}
bool LLBlockListItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const
{
- const LLBlockedListItem* blocked_item1 = dynamic_cast<const LLBlockedListItem*>(item1);
- const LLBlockedListItem* blocked_item2 = dynamic_cast<const LLBlockedListItem*>(item2);
+ const LLBlockedListItem* blocked_item1 = dynamic_cast<const LLBlockedListItem*>(item1);
+ const LLBlockedListItem* blocked_item2 = dynamic_cast<const LLBlockedListItem*>(item2);
- if (!blocked_item1 || !blocked_item2)
- {
- LL_ERRS() << "blocked_item1 and blocked_item2 cannot be null" << LL_ENDL;
- return true;
- }
+ if (!blocked_item1 || !blocked_item2)
+ {
+ LL_ERRS() << "blocked_item1 and blocked_item2 cannot be null" << LL_ENDL;
+ return true;
+ }
- return doCompare(blocked_item1, blocked_item2);
+ return doCompare(blocked_item1, blocked_item2);
}
bool LLBlockListNameComparator::doCompare(const LLBlockedListItem* blocked_item1, const LLBlockedListItem* blocked_item2) const
{
- std::string name1 = blocked_item1->getName();
- std::string name2 = blocked_item2->getName();
+ std::string name1 = blocked_item1->getName();
+ std::string name2 = blocked_item2->getName();
- LLStringUtil::toUpper(name1);
- LLStringUtil::toUpper(name2);
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
- return name1 < name2;
+ return name1 < name2;
}
bool LLBlockListNameTypeComparator::doCompare(const LLBlockedListItem* blocked_item1, const LLBlockedListItem* blocked_item2) const
{
- LLMute::EType type1 = blocked_item1->getType();
- LLMute::EType type2 = blocked_item2->getType();
+ LLMute::EType type1 = blocked_item1->getType();
+ LLMute::EType type2 = blocked_item2->getType();
- // if mute type is LLMute::BY_NAME or LLMute::OBJECT it means that this mute is an object
- bool both_mutes_are_objects = (LLMute::OBJECT == type1 || LLMute::BY_NAME == type1) && (LLMute::OBJECT == type2 || LLMute::BY_NAME == type2);
+ // if mute type is LLMute::BY_NAME or LLMute::OBJECT it means that this mute is an object
+ bool both_mutes_are_objects = (LLMute::OBJECT == type1 || LLMute::BY_NAME == type1) && (LLMute::OBJECT == type2 || LLMute::BY_NAME == type2);
- // mute types may be different, but since both LLMute::BY_NAME and LLMute::OBJECT types represent objects
- // it's needed to perform additional checking of both_mutes_are_objects variable
- if (type1 != type2 && !both_mutes_are_objects)
- {
- // objects in block list go first, so return true if mute type is not an avatar
- return LLMute::AGENT != type1;
- }
+ // mute types may be different, but since both LLMute::BY_NAME and LLMute::OBJECT types represent objects
+ // it's needed to perform additional checking of both_mutes_are_objects variable
+ if (type1 != type2 && !both_mutes_are_objects)
+ {
+ // objects in block list go first, so return true if mute type is not an avatar
+ return LLMute::AGENT != type1;
+ }
- return NAME_COMPARATOR.compare(blocked_item1, blocked_item2);
+ return NAME_COMPARATOR.compare(blocked_item1, blocked_item2);
}
diff --git a/indra/newview/llblocklist.h b/indra/newview/llblocklist.h
index ac0729c610..86598f2da1 100644
--- a/indra/newview/llblocklist.h
+++ b/indra/newview/llblocklist.h
@@ -44,62 +44,62 @@ enum BlockListActionType {NONE, ADD, REMOVE};
*/
class LLBlockList: public LLFlatListViewEx, public LLMuteListObserver
{
- LOG_CLASS(LLBlockList);
+ LOG_CLASS(LLBlockList);
public:
- struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
- {
- Params(){};
- };
+ struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
+ {
+ Params(){};
+ };
- LLBlockList(const Params& p);
- virtual ~LLBlockList();
+ LLBlockList(const Params& p);
+ virtual ~LLBlockList();
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- LLToggleableMenu* getContextMenu() const { return mContextMenu.get(); }
- LLBlockedListItem* getBlockedItem() const;
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ LLToggleableMenu* getContextMenu() const { return mContextMenu.get(); }
+ LLBlockedListItem* getBlockedItem() const;
- virtual void onChange() { }
- virtual void onChangeDetailed(const LLMute& );
- virtual void draw();
+ virtual void onChange() { }
+ virtual void onChangeDetailed(const LLMute& );
+ virtual void draw();
- void setNameFilter(const std::string& filter);
- void sortByName();
- void sortByType();
- void refresh();
+ void setNameFilter(const std::string& filter);
+ void sortByName();
+ void sortByType();
+ void refresh();
- U32 getMuteListSize() { return mMuteListSize; }
+ U32 getMuteListSize() { return mMuteListSize; }
private:
- void addNewItem(const LLMute* mute);
- void removeListItem(const LLMute* mute);
- void hideListItem(LLBlockedListItem* item, bool show);
- void setDirty(bool dirty = true) { mDirty = dirty; }
- bool findInsensitive(std::string haystack, const std::string& needle_upper);
+ void addNewItem(const LLMute* mute);
+ void removeListItem(const LLMute* mute);
+ void hideListItem(LLBlockedListItem* item, bool show);
+ void setDirty(bool dirty = true) { mDirty = dirty; }
+ bool findInsensitive(std::string haystack, const std::string& needle_upper);
- bool isActionEnabled(const LLSD& userdata);
- void onCustomAction (const LLSD& userdata);
- bool isMenuItemChecked(const LLSD& userdata);
- bool isMenuItemVisible(const LLSD& userdata);
- void toggleMute(U32 flags);
- void createList();
+ bool isActionEnabled(const LLSD& userdata);
+ void onCustomAction (const LLSD& userdata);
+ bool isMenuItemChecked(const LLSD& userdata);
+ bool isMenuItemVisible(const LLSD& userdata);
+ void toggleMute(U32 flags);
+ void createList();
- BlockListActionType getCurrentMuteListActionType();
+ BlockListActionType getCurrentMuteListActionType();
- LLHandle<LLToggleableMenu> mContextMenu;
+ LLHandle<LLToggleableMenu> mContextMenu;
- std::string mNameFilter;
- bool mDirty;
- bool mShouldAddAll;
- BlockListActionType mActionType;
- U32 mMuteListSize;
+ std::string mNameFilter;
+ bool mDirty;
+ bool mShouldAddAll;
+ BlockListActionType mActionType;
+ U32 mMuteListSize;
- // This data is used to save information about item that currently changed(added or removed)
- LLUUID mCurItemId;
- std::string mCurItemName;
- LLMute::EType mCurItemType;
- U32 mCurItemFlags;
- std::string mPrevNameFilter;
+ // This data is used to save information about item that currently changed(added or removed)
+ LLUUID mCurItemId;
+ std::string mCurItemName;
+ LLMute::EType mCurItemType;
+ U32 mCurItemFlags;
+ std::string mPrevNameFilter;
};
@@ -109,17 +109,17 @@ private:
*/
class LLBlockListItemComparator : public LLFlatListView::ItemComparator
{
- LOG_CLASS(LLBlockListItemComparator);
+ LOG_CLASS(LLBlockListItemComparator);
public:
- LLBlockListItemComparator() {};
- virtual ~LLBlockListItemComparator() {};
+ LLBlockListItemComparator() {};
+ virtual ~LLBlockListItemComparator() {};
- virtual bool compare(const LLPanel* item1, const LLPanel* item2) const;
+ virtual bool compare(const LLPanel* item1, const LLPanel* item2) const;
protected:
- virtual bool doCompare(const LLBlockedListItem* blocked_item1, const LLBlockedListItem* blocked_item2) const = 0;
+ virtual bool doCompare(const LLBlockedListItem* blocked_item1, const LLBlockedListItem* blocked_item2) const = 0;
};
@@ -128,15 +128,15 @@ protected:
*/
class LLBlockListNameComparator : public LLBlockListItemComparator
{
- LOG_CLASS(LLBlockListNameComparator);
+ LOG_CLASS(LLBlockListNameComparator);
public:
- LLBlockListNameComparator() {};
- virtual ~LLBlockListNameComparator() {};
+ LLBlockListNameComparator() {};
+ virtual ~LLBlockListNameComparator() {};
protected:
- virtual bool doCompare(const LLBlockedListItem* blocked_item1, const LLBlockedListItem* blocked_item2) const;
+ virtual bool doCompare(const LLBlockedListItem* blocked_item1, const LLBlockedListItem* blocked_item2) const;
};
/*
@@ -145,15 +145,15 @@ protected:
*/
class LLBlockListNameTypeComparator : public LLBlockListItemComparator
{
- LOG_CLASS(LLBlockListNameTypeComparator);
+ LOG_CLASS(LLBlockListNameTypeComparator);
public:
- LLBlockListNameTypeComparator() {};
- virtual ~LLBlockListNameTypeComparator() {};
+ LLBlockListNameTypeComparator() {};
+ virtual ~LLBlockListNameTypeComparator() {};
protected:
- virtual bool doCompare(const LLBlockedListItem* blocked_item1, const LLBlockedListItem* blocked_item2) const;
+ virtual bool doCompare(const LLBlockedListItem* blocked_item1, const LLBlockedListItem* blocked_item2) const;
};
#endif /* LLBLOCKLIST_H_ */
diff --git a/indra/newview/llbox.cpp b/indra/newview/llbox.cpp
index faf82695fe..dd12a02907 100644
--- a/indra/newview/llbox.cpp
+++ b/indra/newview/llbox.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llbox.cpp
* @brief Draws a box using display lists for speed.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,61 +32,61 @@
#include "llrender.h"
#include "llglheaders.h"
-LLBox gBox;
+LLBox gBox;
// These routines support multiple textures on a box
void LLBox::prerender()
{
- F32 size = 1.f;
+ F32 size = 1.f;
- mTriangleCount = 6 * 2;
+ mTriangleCount = 6 * 2;
- mVertex[0][0] = mVertex[1][0] = mVertex[2][0] = mVertex[3][0] = -size / 2;
- mVertex[4][0] = mVertex[5][0] = mVertex[6][0] = mVertex[7][0] = size / 2;
- mVertex[0][1] = mVertex[1][1] = mVertex[4][1] = mVertex[5][1] = -size / 2;
- mVertex[2][1] = mVertex[3][1] = mVertex[6][1] = mVertex[7][1] = size / 2;
- mVertex[0][2] = mVertex[3][2] = mVertex[4][2] = mVertex[7][2] = -size / 2;
- mVertex[1][2] = mVertex[2][2] = mVertex[5][2] = mVertex[6][2] = size / 2;
+ mVertex[0][0] = mVertex[1][0] = mVertex[2][0] = mVertex[3][0] = -size / 2;
+ mVertex[4][0] = mVertex[5][0] = mVertex[6][0] = mVertex[7][0] = size / 2;
+ mVertex[0][1] = mVertex[1][1] = mVertex[4][1] = mVertex[5][1] = -size / 2;
+ mVertex[2][1] = mVertex[3][1] = mVertex[6][1] = mVertex[7][1] = size / 2;
+ mVertex[0][2] = mVertex[3][2] = mVertex[4][2] = mVertex[7][2] = -size / 2;
+ mVertex[1][2] = mVertex[2][2] = mVertex[5][2] = mVertex[6][2] = size / 2;
}
// These routines support multiple textures on a box
void LLBox::cleanupGL()
{
- // No GL state, a noop.
+ // No GL state, a noop.
}
void LLBox::renderface(S32 which_face)
{
- /*static F32 normals[6][3] =
- {
- {-1.0f, 0.0f, 0.0f},
- { 0.0f, 1.0f, 0.0f},
- { 1.0f, 0.0f, 0.0f},
- { 0.0f, -1.0f, 0.0f},
- { 0.0f, 0.0f, 1.0f},
- { 0.0f, 0.0f, -1.0f}
- };*/
- static S32 faces[6][4] =
- {
- {0, 1, 2, 3},
- {3, 2, 6, 7},
- {7, 6, 5, 4},
- {4, 5, 1, 0},
- {5, 6, 2, 1},
- {7, 4, 0, 3}
- };
+ /*static F32 normals[6][3] =
+ {
+ {-1.0f, 0.0f, 0.0f},
+ { 0.0f, 1.0f, 0.0f},
+ { 1.0f, 0.0f, 0.0f},
+ { 0.0f, -1.0f, 0.0f},
+ { 0.0f, 0.0f, 1.0f},
+ { 0.0f, 0.0f, -1.0f}
+ };*/
+ static S32 faces[6][4] =
+ {
+ {0, 1, 2, 3},
+ {3, 2, 6, 7},
+ {7, 6, 5, 4},
+ {4, 5, 1, 0},
+ {5, 6, 2, 1},
+ {7, 4, 0, 3}
+ };
- gGL.begin(LLRender::QUADS);
- //gGL.normal3fv(&normals[which_face][0]);
- gGL.texCoord2f(1,0);
- gGL.vertex3fv(&mVertex[ faces[which_face][0] ][0]);
- gGL.texCoord2f(1,1);
- gGL.vertex3fv(&mVertex[ faces[which_face][1] ][0]);
- gGL.texCoord2f(0,1);
- gGL.vertex3fv(&mVertex[ faces[which_face][2] ][0]);
- gGL.texCoord2f(0,0);
- gGL.vertex3fv(&mVertex[ faces[which_face][3] ][0]);
- gGL.end();
+ gGL.begin(LLRender::QUADS);
+ //gGL.normal3fv(&normals[which_face][0]);
+ gGL.texCoord2f(1,0);
+ gGL.vertex3fv(&mVertex[ faces[which_face][0] ][0]);
+ gGL.texCoord2f(1,1);
+ gGL.vertex3fv(&mVertex[ faces[which_face][1] ][0]);
+ gGL.texCoord2f(0,1);
+ gGL.vertex3fv(&mVertex[ faces[which_face][2] ][0]);
+ gGL.texCoord2f(0,0);
+ gGL.vertex3fv(&mVertex[ faces[which_face][3] ][0]);
+ gGL.end();
}
void LLBox::render()
@@ -115,11 +115,11 @@ void LLBox::render()
// +------------+
// (-+-) (++-)
- renderface(5);
- renderface(4);
- renderface(3);
- renderface(2);
- renderface(1);
- renderface(0);
- gGL.flush();
+ renderface(5);
+ renderface(4);
+ renderface(3);
+ renderface(2);
+ renderface(1);
+ renderface(0);
+ gGL.flush();
}
diff --git a/indra/newview/llbox.h b/indra/newview/llbox.h
index ff641ad7cf..0817de08cd 100644
--- a/indra/newview/llbox.h
+++ b/indra/newview/llbox.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llbox.h
* @brief Draws a box using display lists for speed.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,17 +32,17 @@
class LLBox
{
protected:
-// GLuint mDisplayList;
- F32 mVertex[8][3];
- U32 mTriangleCount;
+// GLuint mDisplayList;
+ F32 mVertex[8][3];
+ U32 mTriangleCount;
public:
- void prerender();
- void cleanupGL();
+ void prerender();
+ void cleanupGL();
- void renderface(S32 which_face);
- void render();
+ void renderface(S32 which_face);
+ void render();
- U32 getTriangleCount() { return mTriangleCount; }
+ U32 getTriangleCount() { return mTriangleCount; }
};
extern LLBox gBox;
diff --git a/indra/newview/llbreadcrumbview.cpp b/indra/newview/llbreadcrumbview.cpp
index 92310452dd..59158f50ba 100644
--- a/indra/newview/llbreadcrumbview.cpp
+++ b/indra/newview/llbreadcrumbview.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llbreadcrumbview.cpp
* @brief UI widget for displaying position in a folder hierarchy and allowing
* the user to click on a location in the hierarchy.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llbreadcrumbview.h b/indra/newview/llbreadcrumbview.h
index f1b53ab526..328d39b47e 100644
--- a/indra/newview/llbreadcrumbview.h
+++ b/indra/newview/llbreadcrumbview.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llbreadcrumbview.h
* @brief UI widget for displaying position in a folder hierarchy and allowing
* the user to click on a location in the hierarchy.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llbreastmotion.cpp b/indra/newview/llbreastmotion.cpp
index 3a88bab3b3..5e445bb360 100644
--- a/indra/newview/llbreastmotion.cpp
+++ b/indra/newview/llbreastmotion.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llbreastmotion.cpp
* @brief Implementation of LLBreastMotion class.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,350 +46,350 @@
// User-set params
static const std::string breast_param_names_user[N_PARAMS] =
{
- "Breast_Female_Cleavage_Driver",
- "Breast_Gravity_Driver"
+ "Breast_Female_Cleavage_Driver",
+ "Breast_Gravity_Driver"
};
// Params driven by this algorithm
static const std::string breast_param_names_driven[N_PARAMS] =
{
- "Breast_Female_Cleavage",
- "Breast_Gravity"
+ "Breast_Female_Cleavage",
+ "Breast_Gravity"
};
-LLBreastMotion::LLBreastMotion(const LLUUID &id) :
- LLMotion(id),
- mCharacter(NULL)
+LLBreastMotion::LLBreastMotion(const LLUUID &id) :
+ LLMotion(id),
+ mCharacter(NULL)
{
- mName = "breast_motion";
- mChestState = new LLJointState;
-
- mBreastMassParam = (F32)1.0;
- mBreastDragParam = LLVector3((F32)0.1, (F32)0.1, (F32)0.1);
- mBreastSmoothingParam = (U32)2;
- mBreastGravityParam = (F32)0.0;
-
- mBreastSpringParam = LLVector3((F32)3.0, (F32)0.0, (F32)3.0);
- mBreastGainParam = LLVector3((F32)50.0, (F32)0.0, (F32)50.0);
- mBreastDampingParam = LLVector3((F32)0.3, (F32)0.0, (F32)0.3);
- mBreastMaxVelocityParam = LLVector3((F32)10.0, (F32)0.0, (F32)10.0);
-
- mBreastParamsUser[0] = mBreastParamsUser[1] = mBreastParamsUser[2] = NULL;
- mBreastParamsDriven[0] = mBreastParamsDriven[1] = mBreastParamsDriven[2] = NULL;
-
- mCharLastPosition_world_pt = LLVector3(0,0,0);
- mCharLastVelocity_local_vec = LLVector3(0,0,0);
- mCharLastAcceleration_local_vec = LLVector3(0,0,0);
- mBreastLastPosition_local_pt = LLVector3(0,0,0);
- mBreastLastUpdatePosition_local_pt = LLVector3(0,0,0);
- mBreastVelocity_local_vec = LLVector3(0,0,0);
+ mName = "breast_motion";
+ mChestState = new LLJointState;
+
+ mBreastMassParam = (F32)1.0;
+ mBreastDragParam = LLVector3((F32)0.1, (F32)0.1, (F32)0.1);
+ mBreastSmoothingParam = (U32)2;
+ mBreastGravityParam = (F32)0.0;
+
+ mBreastSpringParam = LLVector3((F32)3.0, (F32)0.0, (F32)3.0);
+ mBreastGainParam = LLVector3((F32)50.0, (F32)0.0, (F32)50.0);
+ mBreastDampingParam = LLVector3((F32)0.3, (F32)0.0, (F32)0.3);
+ mBreastMaxVelocityParam = LLVector3((F32)10.0, (F32)0.0, (F32)10.0);
+
+ mBreastParamsUser[0] = mBreastParamsUser[1] = mBreastParamsUser[2] = NULL;
+ mBreastParamsDriven[0] = mBreastParamsDriven[1] = mBreastParamsDriven[2] = NULL;
+
+ mCharLastPosition_world_pt = LLVector3(0,0,0);
+ mCharLastVelocity_local_vec = LLVector3(0,0,0);
+ mCharLastAcceleration_local_vec = LLVector3(0,0,0);
+ mBreastLastPosition_local_pt = LLVector3(0,0,0);
+ mBreastLastUpdatePosition_local_pt = LLVector3(0,0,0);
+ mBreastVelocity_local_vec = LLVector3(0,0,0);
}
LLBreastMotion::~LLBreastMotion()
{
}
-BOOL LLBreastMotion::onActivate()
-{
- return TRUE;
+BOOL LLBreastMotion::onActivate()
+{
+ return TRUE;
}
-void LLBreastMotion::onDeactivate()
+void LLBreastMotion::onDeactivate()
{
}
LLMotion::LLMotionInitStatus LLBreastMotion::onInitialize(LLCharacter *character)
{
- mCharacter = character;
-
- if (!mChestState->setJoint(character->getJoint("mChest")))
- {
- return STATUS_FAILURE;
- }
-
- mChestState->setUsage(LLJointState::ROT);
- addJointState( mChestState );
-
- for (U32 i=0; i < N_PARAMS; i++)
- {
- mBreastParamsUser[i] = NULL;
- mBreastParamsDriven[i] = NULL;
- mBreastParamsMin[i] = 0;
- mBreastParamsMax[i] = 0;
- if (breast_param_names_user[i] != "" && breast_param_names_driven[i] != "")
- {
- mBreastParamsUser[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_user[i].c_str());
- mBreastParamsDriven[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_driven[i].c_str());
- if (mBreastParamsDriven[i])
- {
- mBreastParamsMin[i] = mBreastParamsDriven[i]->getMinWeight();
- mBreastParamsMax[i] = mBreastParamsDriven[i]->getMaxWeight();
- }
- }
- }
-
- mTimer.reset();
- return STATUS_SUCCESS;
+ mCharacter = character;
+
+ if (!mChestState->setJoint(character->getJoint("mChest")))
+ {
+ return STATUS_FAILURE;
+ }
+
+ mChestState->setUsage(LLJointState::ROT);
+ addJointState( mChestState );
+
+ for (U32 i=0; i < N_PARAMS; i++)
+ {
+ mBreastParamsUser[i] = NULL;
+ mBreastParamsDriven[i] = NULL;
+ mBreastParamsMin[i] = 0;
+ mBreastParamsMax[i] = 0;
+ if (breast_param_names_user[i] != "" && breast_param_names_driven[i] != "")
+ {
+ mBreastParamsUser[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_user[i].c_str());
+ mBreastParamsDriven[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_driven[i].c_str());
+ if (mBreastParamsDriven[i])
+ {
+ mBreastParamsMin[i] = mBreastParamsDriven[i]->getMinWeight();
+ mBreastParamsMax[i] = mBreastParamsDriven[i]->getMaxWeight();
+ }
+ }
+ }
+
+ mTimer.reset();
+ return STATUS_SUCCESS;
}
-F32 LLBreastMotion::getMinPixelArea()
+F32 LLBreastMotion::getMinPixelArea()
{
- return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION;
+ return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION;
}
-
+
F32 LLBreastMotion::calculateTimeDelta()
{
- const F32 time = mTimer.getElapsedTimeF32();
- const F32 time_delta = time - mLastTime;
- mLastTime = time;
- return time_delta;
+ const F32 time = mTimer.getElapsedTimeF32();
+ const F32 time_delta = time - mLastTime;
+ mLastTime = time;
+ return time_delta;
}
// Local space means "parameter space".
LLVector3 LLBreastMotion::toLocal(const LLVector3 &world_vector)
{
- LLVector3 local_vec(0,0,0);
-
- LLJoint *chest_joint = mChestState->getJoint();
- const LLQuaternion world_rot = chest_joint->getWorldRotation();
-
- // Cleavage
- LLVector3 breast_dir_world_vec = LLVector3(-1,0,0) * world_rot; // -1 b/c cleavage param changes opposite to direction
- breast_dir_world_vec.normalize();
- local_vec[0] = world_vector * breast_dir_world_vec;
-
- // Up-Down Bounce
- LLVector3 breast_up_dir_world_vec = LLVector3(0,0,1) * world_rot;
- breast_up_dir_world_vec.normalize();
- local_vec[1] = world_vector * breast_up_dir_world_vec;
-
- return local_vec;
+ LLVector3 local_vec(0,0,0);
+
+ LLJoint *chest_joint = mChestState->getJoint();
+ const LLQuaternion world_rot = chest_joint->getWorldRotation();
+
+ // Cleavage
+ LLVector3 breast_dir_world_vec = LLVector3(-1,0,0) * world_rot; // -1 b/c cleavage param changes opposite to direction
+ breast_dir_world_vec.normalize();
+ local_vec[0] = world_vector * breast_dir_world_vec;
+
+ // Up-Down Bounce
+ LLVector3 breast_up_dir_world_vec = LLVector3(0,0,1) * world_rot;
+ breast_up_dir_world_vec.normalize();
+ local_vec[1] = world_vector * breast_up_dir_world_vec;
+
+ return local_vec;
}
LLVector3 LLBreastMotion::calculateVelocity_local(const F32 time_delta)
{
- LLJoint *chest_joint = mChestState->getJoint();
- const LLVector3 world_pos_pt = chest_joint->getWorldPosition();
- const LLQuaternion world_rot = chest_joint->getWorldRotation();
- const LLVector3 last_world_pos_pt = mCharLastPosition_world_pt;
- const LLVector3 char_velocity_world_vec = (world_pos_pt-last_world_pos_pt) / time_delta;
- const LLVector3 char_velocity_local_vec = toLocal(char_velocity_world_vec);
-
- return char_velocity_local_vec;
+ LLJoint *chest_joint = mChestState->getJoint();
+ const LLVector3 world_pos_pt = chest_joint->getWorldPosition();
+ const LLQuaternion world_rot = chest_joint->getWorldRotation();
+ const LLVector3 last_world_pos_pt = mCharLastPosition_world_pt;
+ const LLVector3 char_velocity_world_vec = (world_pos_pt-last_world_pos_pt) / time_delta;
+ const LLVector3 char_velocity_local_vec = toLocal(char_velocity_world_vec);
+
+ return char_velocity_local_vec;
}
LLVector3 LLBreastMotion::calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
- const F32 time_delta)
+ const F32 time_delta)
{
- LLVector3 char_acceleration_local_vec = new_char_velocity_local_vec - mCharLastVelocity_local_vec;
-
- char_acceleration_local_vec =
- char_acceleration_local_vec * 1.0/mBreastSmoothingParam +
- mCharLastAcceleration_local_vec * (mBreastSmoothingParam-1.0)/mBreastSmoothingParam;
+ LLVector3 char_acceleration_local_vec = new_char_velocity_local_vec - mCharLastVelocity_local_vec;
+
+ char_acceleration_local_vec =
+ char_acceleration_local_vec * 1.0/mBreastSmoothingParam +
+ mCharLastAcceleration_local_vec * (mBreastSmoothingParam-1.0)/mBreastSmoothingParam;
- mCharLastAcceleration_local_vec = char_acceleration_local_vec;
+ mCharLastAcceleration_local_vec = char_acceleration_local_vec;
- return char_acceleration_local_vec;
+ return char_acceleration_local_vec;
}
BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask)
{
- // Skip if disabled globally.
- if (!gSavedSettings.getBOOL("AvatarPhysics"))
- {
- return TRUE;
- }
-
- // Higher LOD is better. This controls the granularity
- // and frequency of updates for the motions.
- const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor;
- if (lod_factor == 0)
- {
- return TRUE;
- }
-
- if (mCharacter->getSex() != SEX_FEMALE) return TRUE;
- const F32 time_delta = calculateTimeDelta();
- if (time_delta < .01 || time_delta > 10.0) return TRUE;
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Get all parameters and settings
- //
-
- mBreastMassParam = mCharacter->getVisualParamWeight("Breast_Physics_Mass");
- mBreastSmoothingParam = (U32)(mCharacter->getVisualParamWeight("Breast_Physics_Smoothing"));
- mBreastGravityParam = mCharacter->getVisualParamWeight("Breast_Physics_Gravity");
-
- mBreastSpringParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Spring");
- mBreastGainParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Gain");
- mBreastDampingParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Damping");
- mBreastMaxVelocityParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Max_Velocity");
- mBreastDragParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Drag");
-
- mBreastSpringParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Spring");
- mBreastGainParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Gain");
- mBreastDampingParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Damping");
- mBreastMaxVelocityParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Max_Velocity");
- mBreastDragParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Drag");
-
-
- // Get the current morph parameters.
- LLVector3 breast_user_local_pt(0,0,0);
- for (U32 i=0; i < N_PARAMS; i++)
- {
- if (mBreastParamsUser[i] != NULL)
- {
- breast_user_local_pt[i] = mBreastParamsUser[i]->getWeight();
- }
- }
-
- LLVector3 breast_current_local_pt = mBreastLastPosition_local_pt;
-
- //
- // End parameters and settings
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Calculate velocity and acceleration in parameter space.
- //
-
- const LLVector3 char_velocity_local_vec = calculateVelocity_local(time_delta);
- const LLVector3 char_acceleration_local_vec = calculateAcceleration_local(char_velocity_local_vec, time_delta);
- mCharLastVelocity_local_vec = char_velocity_local_vec;
-
- LLJoint *chest_joint = mChestState->getJoint();
- mCharLastPosition_world_pt = chest_joint->getWorldPosition();
-
- //
- // End velocity and acceleration
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Calculate the total force
- //
-
- // Spring force is a restoring force towards the original user-set breast position.
- // F = kx
- const LLVector3 spring_length_local = breast_current_local_pt-breast_user_local_pt;
- LLVector3 force_spring_local_vec = -spring_length_local; force_spring_local_vec *= mBreastSpringParam;
-
- // Acceleration is the force that comes from the change in velocity of the torso.
- // F = ma + mg
- LLVector3 force_accel_local_vec = char_acceleration_local_vec * mBreastMassParam;
- const LLVector3 force_gravity_local_vec = toLocal(LLVector3(0,0,1))* mBreastGravityParam * mBreastMassParam;
- force_accel_local_vec += force_gravity_local_vec;
- force_accel_local_vec *= mBreastGainParam;
-
- // Damping is a restoring force that opposes the current velocity.
- // F = -kv
- LLVector3 force_damping_local_vec = -mBreastDampingParam;
- force_damping_local_vec *= mBreastVelocity_local_vec;
-
- // Drag is a force imparted by velocity, intuitively it is similar to wind resistance.
- // F = .5v*v
- LLVector3 force_drag_local_vec = .5*char_velocity_local_vec;
- force_drag_local_vec *= char_velocity_local_vec;
- force_drag_local_vec *= mBreastDragParam[0];
-
- LLVector3 force_net_local_vec =
- force_accel_local_vec +
- force_gravity_local_vec +
- force_spring_local_vec +
- force_damping_local_vec +
- force_drag_local_vec;
-
- //
- // End total force
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Calculate new params
- //
-
- // Calculate the new acceleration based on the net force.
- // a = F/m
- LLVector3 acceleration_local_vec = force_net_local_vec / mBreastMassParam;
- mBreastVelocity_local_vec += acceleration_local_vec;
- mBreastVelocity_local_vec.clamp(-mBreastMaxVelocityParam*100.0, mBreastMaxVelocityParam*100.0);
-
- // Temporary debugging setting to cause all avatars to move, for profiling purposes.
- if (gSavedSettings.getBOOL("AvatarPhysicsTest"))
- {
- mBreastVelocity_local_vec[0] = sin(mTimer.getElapsedTimeF32()*4.0)*5.0;
- mBreastVelocity_local_vec[1] = sin(mTimer.getElapsedTimeF32()*3.0)*5.0;
- }
- // Calculate the new parameters and clamp them to the min/max ranges.
- LLVector3 new_local_pt = breast_current_local_pt + mBreastVelocity_local_vec*time_delta;
- new_local_pt.clamp(mBreastParamsMin,mBreastParamsMax);
-
- // Set the new parameters.
- for (U32 i=0; i < 3; i++)
- {
- // If the param is disabled, just set the param to the user value.
- if (mBreastMaxVelocityParam[i] == 0)
- {
- new_local_pt[i] = breast_user_local_pt[i];
- }
- if (mBreastParamsDriven[i])
- {
- mCharacter->setVisualParamWeight(mBreastParamsDriven[i],
- new_local_pt[i]);
- }
- }
-
- mBreastLastPosition_local_pt = new_local_pt;
-
- //
- // End calculate new params
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Conditionally update the visual params
- //
-
- // Updating the visual params (i.e. what the user sees) is fairly expensive.
- // So only update if the params have changed enough, and also take into account
- // the graphics LOD settings.
-
- // For non-self, if the avatar is small enough visually, then don't update.
- const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(this) != NULL);
- if (!is_self)
- {
- const F32 area_for_max_settings = 0.0;
- const F32 area_for_min_settings = 1400.0;
-
- const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor);
- const F32 pixel_area = fsqrtf(mCharacter->getPixelArea());
- if (pixel_area < area_for_this_setting)
- {
- return TRUE;
- }
- }
-
- // If the parameter hasn't changed enough, then don't update.
- LLVector3 position_diff = mBreastLastUpdatePosition_local_pt-new_local_pt;
- for (U32 i=0; i < 3; i++)
- {
- const F32 min_delta = (1.0-lod_factor)*(mBreastParamsMax[i]-mBreastParamsMin[i])/2.0;
- if (llabs(position_diff[i]) > min_delta)
- {
- mCharacter->updateVisualParams();
- mBreastLastUpdatePosition_local_pt = new_local_pt;
- return TRUE;
- }
- }
-
- //
- // End update visual params
- ////////////////////////////////////////////////////////////////////////////////
-
- return TRUE;
+ // Skip if disabled globally.
+ if (!gSavedSettings.getBOOL("AvatarPhysics"))
+ {
+ return TRUE;
+ }
+
+ // Higher LOD is better. This controls the granularity
+ // and frequency of updates for the motions.
+ const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor;
+ if (lod_factor == 0)
+ {
+ return TRUE;
+ }
+
+ if (mCharacter->getSex() != SEX_FEMALE) return TRUE;
+ const F32 time_delta = calculateTimeDelta();
+ if (time_delta < .01 || time_delta > 10.0) return TRUE;
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Get all parameters and settings
+ //
+
+ mBreastMassParam = mCharacter->getVisualParamWeight("Breast_Physics_Mass");
+ mBreastSmoothingParam = (U32)(mCharacter->getVisualParamWeight("Breast_Physics_Smoothing"));
+ mBreastGravityParam = mCharacter->getVisualParamWeight("Breast_Physics_Gravity");
+
+ mBreastSpringParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Spring");
+ mBreastGainParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Gain");
+ mBreastDampingParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Damping");
+ mBreastMaxVelocityParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Max_Velocity");
+ mBreastDragParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Drag");
+
+ mBreastSpringParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Spring");
+ mBreastGainParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Gain");
+ mBreastDampingParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Damping");
+ mBreastMaxVelocityParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Max_Velocity");
+ mBreastDragParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Drag");
+
+
+ // Get the current morph parameters.
+ LLVector3 breast_user_local_pt(0,0,0);
+ for (U32 i=0; i < N_PARAMS; i++)
+ {
+ if (mBreastParamsUser[i] != NULL)
+ {
+ breast_user_local_pt[i] = mBreastParamsUser[i]->getWeight();
+ }
+ }
+
+ LLVector3 breast_current_local_pt = mBreastLastPosition_local_pt;
+
+ //
+ // End parameters and settings
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Calculate velocity and acceleration in parameter space.
+ //
+
+ const LLVector3 char_velocity_local_vec = calculateVelocity_local(time_delta);
+ const LLVector3 char_acceleration_local_vec = calculateAcceleration_local(char_velocity_local_vec, time_delta);
+ mCharLastVelocity_local_vec = char_velocity_local_vec;
+
+ LLJoint *chest_joint = mChestState->getJoint();
+ mCharLastPosition_world_pt = chest_joint->getWorldPosition();
+
+ //
+ // End velocity and acceleration
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Calculate the total force
+ //
+
+ // Spring force is a restoring force towards the original user-set breast position.
+ // F = kx
+ const LLVector3 spring_length_local = breast_current_local_pt-breast_user_local_pt;
+ LLVector3 force_spring_local_vec = -spring_length_local; force_spring_local_vec *= mBreastSpringParam;
+
+ // Acceleration is the force that comes from the change in velocity of the torso.
+ // F = ma + mg
+ LLVector3 force_accel_local_vec = char_acceleration_local_vec * mBreastMassParam;
+ const LLVector3 force_gravity_local_vec = toLocal(LLVector3(0,0,1))* mBreastGravityParam * mBreastMassParam;
+ force_accel_local_vec += force_gravity_local_vec;
+ force_accel_local_vec *= mBreastGainParam;
+
+ // Damping is a restoring force that opposes the current velocity.
+ // F = -kv
+ LLVector3 force_damping_local_vec = -mBreastDampingParam;
+ force_damping_local_vec *= mBreastVelocity_local_vec;
+
+ // Drag is a force imparted by velocity, intuitively it is similar to wind resistance.
+ // F = .5v*v
+ LLVector3 force_drag_local_vec = .5*char_velocity_local_vec;
+ force_drag_local_vec *= char_velocity_local_vec;
+ force_drag_local_vec *= mBreastDragParam[0];
+
+ LLVector3 force_net_local_vec =
+ force_accel_local_vec +
+ force_gravity_local_vec +
+ force_spring_local_vec +
+ force_damping_local_vec +
+ force_drag_local_vec;
+
+ //
+ // End total force
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Calculate new params
+ //
+
+ // Calculate the new acceleration based on the net force.
+ // a = F/m
+ LLVector3 acceleration_local_vec = force_net_local_vec / mBreastMassParam;
+ mBreastVelocity_local_vec += acceleration_local_vec;
+ mBreastVelocity_local_vec.clamp(-mBreastMaxVelocityParam*100.0, mBreastMaxVelocityParam*100.0);
+
+ // Temporary debugging setting to cause all avatars to move, for profiling purposes.
+ if (gSavedSettings.getBOOL("AvatarPhysicsTest"))
+ {
+ mBreastVelocity_local_vec[0] = sin(mTimer.getElapsedTimeF32()*4.0)*5.0;
+ mBreastVelocity_local_vec[1] = sin(mTimer.getElapsedTimeF32()*3.0)*5.0;
+ }
+ // Calculate the new parameters and clamp them to the min/max ranges.
+ LLVector3 new_local_pt = breast_current_local_pt + mBreastVelocity_local_vec*time_delta;
+ new_local_pt.clamp(mBreastParamsMin,mBreastParamsMax);
+
+ // Set the new parameters.
+ for (U32 i=0; i < 3; i++)
+ {
+ // If the param is disabled, just set the param to the user value.
+ if (mBreastMaxVelocityParam[i] == 0)
+ {
+ new_local_pt[i] = breast_user_local_pt[i];
+ }
+ if (mBreastParamsDriven[i])
+ {
+ mCharacter->setVisualParamWeight(mBreastParamsDriven[i],
+ new_local_pt[i]);
+ }
+ }
+
+ mBreastLastPosition_local_pt = new_local_pt;
+
+ //
+ // End calculate new params
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Conditionally update the visual params
+ //
+
+ // Updating the visual params (i.e. what the user sees) is fairly expensive.
+ // So only update if the params have changed enough, and also take into account
+ // the graphics LOD settings.
+
+ // For non-self, if the avatar is small enough visually, then don't update.
+ const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(this) != NULL);
+ if (!is_self)
+ {
+ const F32 area_for_max_settings = 0.0;
+ const F32 area_for_min_settings = 1400.0;
+
+ const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor);
+ const F32 pixel_area = fsqrtf(mCharacter->getPixelArea());
+ if (pixel_area < area_for_this_setting)
+ {
+ return TRUE;
+ }
+ }
+
+ // If the parameter hasn't changed enough, then don't update.
+ LLVector3 position_diff = mBreastLastUpdatePosition_local_pt-new_local_pt;
+ for (U32 i=0; i < 3; i++)
+ {
+ const F32 min_delta = (1.0-lod_factor)*(mBreastParamsMax[i]-mBreastParamsMin[i])/2.0;
+ if (llabs(position_diff[i]) > min_delta)
+ {
+ mCharacter->updateVisualParams();
+ mBreastLastUpdatePosition_local_pt = new_local_pt;
+ return TRUE;
+ }
+ }
+
+ //
+ // End update visual params
+ ////////////////////////////////////////////////////////////////////////////////
+
+ return TRUE;
}
diff --git a/indra/newview/llbreastmotion.h b/indra/newview/llbreastmotion.h
index aa0fdf9f8b..f1c508d4b7 100644
--- a/indra/newview/llbreastmotion.h
+++ b/indra/newview/llbreastmotion.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llbreastmotion.h
* @brief Implementation of LLBreastMotion class.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,112 +42,112 @@ class LLViewerVisualParam;
// class LLBreastMotion
//-----------------------------------------------------------------------------
class LLBreastMotion :
- public LLMotion
+ public LLMotion
{
public:
- // Constructor
- LLBreastMotion(const LLUUID &id);
+ // Constructor
+ LLBreastMotion(const LLUUID &id);
- // Destructor
- virtual ~LLBreastMotion();
+ // Destructor
+ virtual ~LLBreastMotion();
public:
- //-------------------------------------------------------------------------
- // functions to support MotionController and MotionRegistry
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ // functions to support MotionController and MotionRegistry
+ //-------------------------------------------------------------------------
- // static constructor
- // all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLBreastMotion(id); }
+ // static constructor
+ // all subclasses must implement such a function and register it
+ static LLMotion *create(const LLUUID &id) { return new LLBreastMotion(id); }
public:
- //-------------------------------------------------------------------------
- // animation callbacks to be implemented by subclasses
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ // animation callbacks to be implemented by subclasses
+ //-------------------------------------------------------------------------
- // motions must specify whether or not they loop
- virtual BOOL getLoop() { return TRUE; }
+ // motions must specify whether or not they loop
+ virtual BOOL getLoop() { return TRUE; }
- // motions must report their total duration
- virtual F32 getDuration() { return 0.0; }
+ // motions must report their total duration
+ virtual F32 getDuration() { return 0.0; }
- // motions must report their "ease in" duration
- virtual F32 getEaseInDuration() { return BREAST_MOTION_FADEIN_TIME; }
+ // motions must report their "ease in" duration
+ virtual F32 getEaseInDuration() { return BREAST_MOTION_FADEIN_TIME; }
- // motions must report their "ease out" duration.
- virtual F32 getEaseOutDuration() { return BREAST_MOTION_FADEOUT_TIME; }
+ // motions must report their "ease out" duration.
+ virtual F32 getEaseOutDuration() { return BREAST_MOTION_FADEOUT_TIME; }
- // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
- virtual F32 getMinPixelArea();
+ // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
+ virtual F32 getMinPixelArea();
- // motions must report their priority
- virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
+ // motions must report their priority
+ virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
- virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
+ virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
- // run-time (post constructor) initialization,
- // called after parameters have been set
- // must return true to indicate success and be available for activation
- virtual LLMotionInitStatus onInitialize(LLCharacter *character);
+ // run-time (post constructor) initialization,
+ // called after parameters have been set
+ // must return true to indicate success and be available for activation
+ virtual LLMotionInitStatus onInitialize(LLCharacter *character);
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate();
+ // called when a motion is activated
+ // must return TRUE to indicate success, or else
+ // it will be deactivated
+ virtual BOOL onActivate();
- // called per time step
- // must return TRUE while it is active, and
- // must return FALSE when the motion is completed.
- virtual BOOL onUpdate(F32 time, U8* joint_mask);
+ // called per time step
+ // must return TRUE while it is active, and
+ // must return FALSE when the motion is completed.
+ virtual BOOL onUpdate(F32 time, U8* joint_mask);
- // called when a motion is deactivated
- virtual void onDeactivate();
+ // called when a motion is deactivated
+ virtual void onDeactivate();
protected:
- LLVector3 toLocal(const LLVector3 &world_vector);
- LLVector3 calculateVelocity_local(const F32 time_delta);
- LLVector3 calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
- const F32 time_delta);
- F32 calculateTimeDelta();
+ LLVector3 toLocal(const LLVector3 &world_vector);
+ LLVector3 calculateVelocity_local(const F32 time_delta);
+ LLVector3 calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
+ const F32 time_delta);
+ F32 calculateTimeDelta();
private:
- //-------------------------------------------------------------------------
- // joint states to be animated
- //-------------------------------------------------------------------------
- LLPointer<LLJointState> mChestState;
- LLCharacter* mCharacter;
-
-
- //-------------------------------------------------------------------------
- // miscellaneous parameters
- //-------------------------------------------------------------------------
- LLViewerVisualParam *mBreastParamsUser[3];
- LLViewerVisualParam *mBreastParamsDriven[3];
- LLVector3 mBreastParamsMin;
- LLVector3 mBreastParamsMax;
-
- LLVector3 mCharLastPosition_world_pt; // Last position of the avatar
- LLVector3 mCharLastVelocity_local_vec; // How fast the character is moving
- LLVector3 mCharLastAcceleration_local_vec; // Change in character velocity
-
- LLVector3 mBreastLastPosition_local_pt; // Last parameters for breast
- LLVector3 mBreastVelocity_local_vec; // How fast the breast params are moving
- LLVector3 mBreastLastUpdatePosition_local_pt; // Last parameters when visual update was sent
-
-
- F32 mBreastMassParam;
- F32 mBreastGravityParam;
- U32 mBreastSmoothingParam;
-
- LLVector3 mBreastSpringParam;
- LLVector3 mBreastDampingParam;
- LLVector3 mBreastGainParam;
- LLVector3 mBreastMaxVelocityParam;
- LLVector3 mBreastDragParam;
-
- LLFrameTimer mTimer;
- F32 mLastTime;
-
- U32 mFileTicks;
+ //-------------------------------------------------------------------------
+ // joint states to be animated
+ //-------------------------------------------------------------------------
+ LLPointer<LLJointState> mChestState;
+ LLCharacter* mCharacter;
+
+
+ //-------------------------------------------------------------------------
+ // miscellaneous parameters
+ //-------------------------------------------------------------------------
+ LLViewerVisualParam *mBreastParamsUser[3];
+ LLViewerVisualParam *mBreastParamsDriven[3];
+ LLVector3 mBreastParamsMin;
+ LLVector3 mBreastParamsMax;
+
+ LLVector3 mCharLastPosition_world_pt; // Last position of the avatar
+ LLVector3 mCharLastVelocity_local_vec; // How fast the character is moving
+ LLVector3 mCharLastAcceleration_local_vec; // Change in character velocity
+
+ LLVector3 mBreastLastPosition_local_pt; // Last parameters for breast
+ LLVector3 mBreastVelocity_local_vec; // How fast the breast params are moving
+ LLVector3 mBreastLastUpdatePosition_local_pt; // Last parameters when visual update was sent
+
+
+ F32 mBreastMassParam;
+ F32 mBreastGravityParam;
+ U32 mBreastSmoothingParam;
+
+ LLVector3 mBreastSpringParam;
+ LLVector3 mBreastDampingParam;
+ LLVector3 mBreastGainParam;
+ LLVector3 mBreastMaxVelocityParam;
+ LLVector3 mBreastDragParam;
+
+ LLFrameTimer mTimer;
+ F32 mLastTime;
+
+ U32 mFileTicks;
};
#endif // LL_LLBREASTMOTION_H
diff --git a/indra/newview/llbrowsernotification.cpp b/indra/newview/llbrowsernotification.cpp
index 036215a845..0cc4cd532c 100644
--- a/indra/newview/llbrowsernotification.cpp
+++ b/indra/newview/llbrowsernotification.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,25 +36,25 @@
using namespace LLNotificationsUI;
LLBrowserNotification::LLBrowserNotification()
- : LLSystemNotificationHandler("Browser", "browser")
+ : LLSystemNotificationHandler("Browser", "browser")
{
}
bool LLBrowserNotification::processNotification(const LLNotificationPtr& notification, bool should_log)
{
- LLUUID media_id = notification->getPayload()["media_id"].asUUID();
- auto media_instance = LLMediaCtrl::getInstance(media_id);
- if (media_instance)
- {
- media_instance->showNotification(notification);
- }
- else if (LLViewerMediaFocus::instance().getControlsMediaID() == media_id)
- {
- auto impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(media_id);
- if (impl)
- {
- impl->showNotification(notification);
- }
- }
- return false;
+ LLUUID media_id = notification->getPayload()["media_id"].asUUID();
+ auto media_instance = LLMediaCtrl::getInstance(media_id);
+ if (media_instance)
+ {
+ media_instance->showNotification(notification);
+ }
+ else if (LLViewerMediaFocus::instance().getControlsMediaID() == media_id)
+ {
+ auto impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(media_id);
+ if (impl)
+ {
+ impl->showNotification(notification);
+ }
+ }
+ return false;
}
diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp
index 37de89a48b..115e68b396 100644
--- a/indra/newview/llbuycurrencyhtml.cpp
+++ b/indra/newview/llbuycurrencyhtml.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llbuycurrencyhtml.cpp
* @brief Manages Buy Currency HTML floater
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,132 +36,132 @@
#include "llstatusbar.h"
// support for secondlife:///app/buycurrencyhtml/{ACTION}/{NEXT_ACTION}/{RETURN_CODE} SLapps
-class LLBuyCurrencyHTMLHandler :
- public LLCommandHandler
+class LLBuyCurrencyHTMLHandler :
+ public LLCommandHandler
{
public:
- // requests will be throttled from a non-trusted browser
- LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_THROTTLE) {}
-
- bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- std::string action( "" );
- if ( params.size() >= 1 )
- {
- action = params[ 0 ].asString();
- };
-
- std::string next_action( "" );
- if ( params.size() >= 2 )
- {
- next_action = params[ 1 ].asString();
- };
-
- int result_code = 0;
- if ( params.size() >= 3 )
- {
- result_code = params[ 2 ].asInteger();
- if ( result_code != 0 )
- {
- LL_WARNS("LLBuyCurrency") << "Received nonzero result code: " << result_code << LL_ENDL ;
- }
- };
-
- // open the legacy XUI based currency floater
- if ( "open_legacy" == next_action )
- {
- LLFloaterBuyCurrency::buyCurrency();
- };
-
- // ask the Buy Currency floater to close
- // note: this is the last thing we can do so make
- // sure any other actions are processed before this.
- if ( "close" == action )
- {
- LLBuyCurrencyHTML::closeDialog();
- };
-
- return true;
- };
+ // requests will be throttled from a non-trusted browser
+ LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_THROTTLE) {}
+
+ bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ std::string action( "" );
+ if ( params.size() >= 1 )
+ {
+ action = params[ 0 ].asString();
+ };
+
+ std::string next_action( "" );
+ if ( params.size() >= 2 )
+ {
+ next_action = params[ 1 ].asString();
+ };
+
+ int result_code = 0;
+ if ( params.size() >= 3 )
+ {
+ result_code = params[ 2 ].asInteger();
+ if ( result_code != 0 )
+ {
+ LL_WARNS("LLBuyCurrency") << "Received nonzero result code: " << result_code << LL_ENDL ;
+ }
+ };
+
+ // open the legacy XUI based currency floater
+ if ( "open_legacy" == next_action )
+ {
+ LLFloaterBuyCurrency::buyCurrency();
+ };
+
+ // ask the Buy Currency floater to close
+ // note: this is the last thing we can do so make
+ // sure any other actions are processed before this.
+ if ( "close" == action )
+ {
+ LLBuyCurrencyHTML::closeDialog();
+ };
+
+ return true;
+ };
};
LLBuyCurrencyHTMLHandler gBuyCurrencyHTMLHandler;
////////////////////////////////////////////////////////////////////////////////
// static
-// Opens the legacy XUI based floater or new HTML based one based on
+// Opens the legacy XUI based floater or new HTML based one based on
// the QuickBuyCurrency value in settings.xml - this overload is for
// the case where the amount is not requested.
void LLBuyCurrencyHTML::openCurrencyFloater()
{
- if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) )
- {
- // HTML version
- LLBuyCurrencyHTML::showDialog( false, "", 0 );
- }
- else
- {
- // legacy version
- LLFloaterBuyCurrency::buyCurrency();
- };
+ if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) )
+ {
+ // HTML version
+ LLBuyCurrencyHTML::showDialog( false, "", 0 );
+ }
+ else
+ {
+ // legacy version
+ LLFloaterBuyCurrency::buyCurrency();
+ };
}
////////////////////////////////////////////////////////////////////////////////
// static
-// Opens the legacy XUI based floater or new HTML based one based on
+// Opens the legacy XUI based floater or new HTML based one based on
// the QuickBuyCurrency value in settings.xml - this overload is for
// the case where the amount and a string to display are requested.
void LLBuyCurrencyHTML::openCurrencyFloater( const std::string& message, S32 sum )
{
- if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) )
- {
- // HTML version
- LLBuyCurrencyHTML::showDialog( true, message, sum );
- }
- else
- {
- // legacy version
- LLFloaterBuyCurrency::buyCurrency( message, sum );
- };
+ if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) )
+ {
+ // HTML version
+ LLBuyCurrencyHTML::showDialog( true, message, sum );
+ }
+ else
+ {
+ // legacy version
+ LLFloaterBuyCurrency::buyCurrency( message, sum );
+ };
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLBuyCurrencyHTML::showDialog( bool specific_sum_requested, const std::string& message, S32 sum )
{
- LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >( LLFloaterReg::getInstance( "buy_currency_html" ) );
- if ( buy_currency_floater )
- {
- // pass on flag indicating if we want to buy specific amount and if so, how much
- buy_currency_floater->setParams( specific_sum_requested, message, sum );
-
- // force navigate to new URL
- buy_currency_floater->navigateToFinalURL();
-
- // make it visible and raise to front
- BOOL visible = TRUE;
- buy_currency_floater->setVisible( visible );
- BOOL take_focus = TRUE;
- buy_currency_floater->setFrontmost( take_focus );
-
- // spec calls for floater to be centered on client window
- buy_currency_floater->center();
- }
- else
- {
- LL_WARNS() << "Buy Currency (HTML) Floater not found" << LL_ENDL;
- };
+ LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >( LLFloaterReg::getInstance( "buy_currency_html" ) );
+ if ( buy_currency_floater )
+ {
+ // pass on flag indicating if we want to buy specific amount and if so, how much
+ buy_currency_floater->setParams( specific_sum_requested, message, sum );
+
+ // force navigate to new URL
+ buy_currency_floater->navigateToFinalURL();
+
+ // make it visible and raise to front
+ BOOL visible = TRUE;
+ buy_currency_floater->setVisible( visible );
+ BOOL take_focus = TRUE;
+ buy_currency_floater->setFrontmost( take_focus );
+
+ // spec calls for floater to be centered on client window
+ buy_currency_floater->center();
+ }
+ else
+ {
+ LL_WARNS() << "Buy Currency (HTML) Floater not found" << LL_ENDL;
+ };
}
////////////////////////////////////////////////////////////////////////////////
//
void LLBuyCurrencyHTML::closeDialog()
{
- LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >(LLFloaterReg::getInstance( "buy_currency_html" ) );
- if ( buy_currency_floater )
- {
- buy_currency_floater->closeFloater();
- };
-
- // Update L$ balance in the status bar in case L$ were purchased
- LLStatusBar::sendMoneyBalanceRequest();
+ LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >(LLFloaterReg::getInstance( "buy_currency_html" ) );
+ if ( buy_currency_floater )
+ {
+ buy_currency_floater->closeFloater();
+ };
+
+ // Update L$ balance in the status bar in case L$ were purchased
+ LLStatusBar::sendMoneyBalanceRequest();
}
diff --git a/indra/newview/llbuycurrencyhtml.h b/indra/newview/llbuycurrencyhtml.h
index 8d8857ffe3..5e3d30dcd0 100644
--- a/indra/newview/llbuycurrencyhtml.h
+++ b/indra/newview/llbuycurrencyhtml.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llbuycurrencyhtml.h
* @brief Manages Buy Currency HTML floater
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,19 +33,19 @@ class LLFloaterBuyCurrencyHTML;
class LLBuyCurrencyHTML
{
- public:
- // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is not required
- static void openCurrencyFloater();
+ public:
+ // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is not required
+ static void openCurrencyFloater();
- // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is required
- static void openCurrencyFloater( const std::string& message, S32 sum );
+ // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is required
+ static void openCurrencyFloater( const std::string& message, S32 sum );
- // show and give focus to actual currency floater - this is used for both cases
- // where the sum is required and where it is not
- static void showDialog( bool specific_sum_requested, const std::string& message, S32 sum );
+ // show and give focus to actual currency floater - this is used for both cases
+ // where the sum is required and where it is not
+ static void showDialog( bool specific_sum_requested, const std::string& message, S32 sum );
- // close (and destroy) the currency floater
- static void closeDialog();
+ // close (and destroy) the currency floater
+ static void closeDialog();
};
#endif // LL_LLBUYCURRENCYHTML_H
diff --git a/indra/newview/llcallbacklist.cpp b/indra/newview/llcallbacklist.cpp
index 59ecbdd0ea..1674750351 100644
--- a/indra/newview/llcallbacklist.cpp
+++ b/indra/newview/llcallbacklist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcallbacklist.cpp
* @brief A simple list of callback functions to call.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,7 +44,7 @@ LLCallbackList gIdleCallbacks;
LLCallbackList::LLCallbackList()
{
- // nothing
+ // nothing
}
LLCallbackList::~LLCallbackList()
@@ -54,66 +54,66 @@ LLCallbackList::~LLCallbackList()
void LLCallbackList::addFunction( callback_t func, void *data)
{
- if (!func)
- {
- LL_ERRS() << "LLCallbackList::addFunction - function is NULL" << LL_ENDL;
- return;
- }
-
- // only add one callback per func/data pair
- callback_pair_t t(func, data);
- callback_list_t::iterator iter = std::find(mCallbackList.begin(), mCallbackList.end(), t);
- if (iter == mCallbackList.end())
- {
- mCallbackList.push_back(t);
- }
+ if (!func)
+ {
+ LL_ERRS() << "LLCallbackList::addFunction - function is NULL" << LL_ENDL;
+ return;
+ }
+
+ // only add one callback per func/data pair
+ callback_pair_t t(func, data);
+ callback_list_t::iterator iter = std::find(mCallbackList.begin(), mCallbackList.end(), t);
+ if (iter == mCallbackList.end())
+ {
+ mCallbackList.push_back(t);
+ }
}
BOOL LLCallbackList::containsFunction( callback_t func, void *data)
{
- callback_pair_t t(func, data);
- callback_list_t::iterator iter = std::find(mCallbackList.begin(), mCallbackList.end(), t);
- if (iter != mCallbackList.end())
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ callback_pair_t t(func, data);
+ callback_list_t::iterator iter = std::find(mCallbackList.begin(), mCallbackList.end(), t);
+ if (iter != mCallbackList.end())
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
BOOL LLCallbackList::deleteFunction( callback_t func, void *data)
{
- callback_pair_t t(func, data);
- callback_list_t::iterator iter = std::find(mCallbackList.begin(), mCallbackList.end(), t);
- if (iter != mCallbackList.end())
- {
- mCallbackList.erase(iter);
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ callback_pair_t t(func, data);
+ callback_list_t::iterator iter = std::find(mCallbackList.begin(), mCallbackList.end(), t);
+ if (iter != mCallbackList.end())
+ {
+ mCallbackList.erase(iter);
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
void LLCallbackList::deleteAllFunctions()
{
- mCallbackList.clear();
+ mCallbackList.clear();
}
void LLCallbackList::callFunctions()
{
- for (callback_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end(); )
- {
- callback_list_t::iterator curiter = iter++;
- curiter->first(curiter->second);
- }
+ for (callback_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end(); )
+ {
+ callback_list_t::iterator curiter = iter++;
+ curiter->first(curiter->second);
+ }
}
// Shim class to allow arbitrary boost::bind
@@ -121,29 +121,29 @@ void LLCallbackList::callFunctions()
class OnIdleCallbackOneTime
{
public:
- OnIdleCallbackOneTime(nullary_func_t callable):
- mCallable(callable)
- {
- }
- static void onIdle(void *data)
- {
- gIdleCallbacks.deleteFunction(onIdle, data);
- OnIdleCallbackOneTime* self = reinterpret_cast<OnIdleCallbackOneTime*>(data);
- self->call();
- delete self;
- }
- void call()
- {
- mCallable();
- }
+ OnIdleCallbackOneTime(nullary_func_t callable):
+ mCallable(callable)
+ {
+ }
+ static void onIdle(void *data)
+ {
+ gIdleCallbacks.deleteFunction(onIdle, data);
+ OnIdleCallbackOneTime* self = reinterpret_cast<OnIdleCallbackOneTime*>(data);
+ self->call();
+ delete self;
+ }
+ void call()
+ {
+ mCallable();
+ }
private:
- nullary_func_t mCallable;
+ nullary_func_t mCallable;
};
void doOnIdleOneTime(nullary_func_t callable)
{
- OnIdleCallbackOneTime* cb_functor = new OnIdleCallbackOneTime(callable);
- gIdleCallbacks.addFunction(&OnIdleCallbackOneTime::onIdle,cb_functor);
+ OnIdleCallbackOneTime* cb_functor = new OnIdleCallbackOneTime(callable);
+ gIdleCallbacks.addFunction(&OnIdleCallbackOneTime::onIdle,cb_functor);
}
// Shim class to allow generic boost functions to be run as
@@ -152,154 +152,154 @@ void doOnIdleOneTime(nullary_func_t callable)
class OnIdleCallbackRepeating
{
public:
- OnIdleCallbackRepeating(bool_func_t callable):
- mCallable(callable)
- {
- }
- // Will keep getting called until the callable returns true.
- static void onIdle(void *data)
- {
- OnIdleCallbackRepeating* self = reinterpret_cast<OnIdleCallbackRepeating*>(data);
- bool done = self->call();
- if (done)
- {
- gIdleCallbacks.deleteFunction(onIdle, data);
- delete self;
- }
- }
- bool call()
- {
- return mCallable();
- }
+ OnIdleCallbackRepeating(bool_func_t callable):
+ mCallable(callable)
+ {
+ }
+ // Will keep getting called until the callable returns true.
+ static void onIdle(void *data)
+ {
+ OnIdleCallbackRepeating* self = reinterpret_cast<OnIdleCallbackRepeating*>(data);
+ bool done = self->call();
+ if (done)
+ {
+ gIdleCallbacks.deleteFunction(onIdle, data);
+ delete self;
+ }
+ }
+ bool call()
+ {
+ return mCallable();
+ }
private:
- bool_func_t mCallable;
+ bool_func_t mCallable;
};
void doOnIdleRepeating(bool_func_t callable)
{
- OnIdleCallbackRepeating* cb_functor = new OnIdleCallbackRepeating(callable);
- gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor);
+ OnIdleCallbackRepeating* cb_functor = new OnIdleCallbackRepeating(callable);
+ gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor);
}
class NullaryFuncEventTimer: public LLEventTimer
{
public:
- NullaryFuncEventTimer(nullary_func_t callable, F32 seconds):
- LLEventTimer(seconds),
- mCallable(callable)
- {
- }
+ NullaryFuncEventTimer(nullary_func_t callable, F32 seconds):
+ LLEventTimer(seconds),
+ mCallable(callable)
+ {
+ }
private:
- BOOL tick()
- {
- mCallable();
- return TRUE;
- }
+ BOOL tick()
+ {
+ mCallable();
+ return TRUE;
+ }
- nullary_func_t mCallable;
+ nullary_func_t mCallable;
};
// Call a given callable once after specified interval.
void doAfterInterval(nullary_func_t callable, F32 seconds)
{
- new NullaryFuncEventTimer(callable, seconds);
+ new NullaryFuncEventTimer(callable, seconds);
}
class BoolFuncEventTimer: public LLEventTimer
{
public:
- BoolFuncEventTimer(bool_func_t callable, F32 seconds):
- LLEventTimer(seconds),
- mCallable(callable)
- {
- }
+ BoolFuncEventTimer(bool_func_t callable, F32 seconds):
+ LLEventTimer(seconds),
+ mCallable(callable)
+ {
+ }
private:
- BOOL tick()
- {
- return mCallable();
- }
+ BOOL tick()
+ {
+ return mCallable();
+ }
- bool_func_t mCallable;
+ bool_func_t mCallable;
};
// Call a given callable every specified number of seconds, until it returns true.
void doPeriodically(bool_func_t callable, F32 seconds)
{
- new BoolFuncEventTimer(callable, seconds);
+ new BoolFuncEventTimer(callable, seconds);
}
#ifdef _DEBUG
void test1(void *data)
{
- S32 *s32_data = (S32 *)data;
- LL_INFOS() << "testfunc1 " << *s32_data << LL_ENDL;
+ S32 *s32_data = (S32 *)data;
+ LL_INFOS() << "testfunc1 " << *s32_data << LL_ENDL;
}
void test2(void *data)
{
- S32 *s32_data = (S32 *)data;
- LL_INFOS() << "testfunc2 " << *s32_data << LL_ENDL;
+ S32 *s32_data = (S32 *)data;
+ LL_INFOS() << "testfunc2 " << *s32_data << LL_ENDL;
}
void
LLCallbackList::test()
{
- S32 a = 1;
- S32 b = 2;
- LLCallbackList *list = new LLCallbackList;
+ S32 a = 1;
+ S32 b = 2;
+ LLCallbackList *list = new LLCallbackList;
- LL_INFOS() << "Testing LLCallbackList" << LL_ENDL;
+ LL_INFOS() << "Testing LLCallbackList" << LL_ENDL;
- if (!list->deleteFunction(NULL))
- {
- LL_INFOS() << "passed 1" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "error, removed function from empty list" << LL_ENDL;
- }
+ if (!list->deleteFunction(NULL))
+ {
+ LL_INFOS() << "passed 1" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "error, removed function from empty list" << LL_ENDL;
+ }
- // LL_INFOS() << "This should crash" << LL_ENDL;
- // list->addFunction(NULL);
+ // LL_INFOS() << "This should crash" << LL_ENDL;
+ // list->addFunction(NULL);
- list->addFunction(&test1, &a);
- list->addFunction(&test1, &a);
+ list->addFunction(&test1, &a);
+ list->addFunction(&test1, &a);
- LL_INFOS() << "Expect: test1 1, test1 1" << LL_ENDL;
- list->callFunctions();
+ LL_INFOS() << "Expect: test1 1, test1 1" << LL_ENDL;
+ list->callFunctions();
- list->addFunction(&test1, &b);
- list->addFunction(&test2, &b);
+ list->addFunction(&test1, &b);
+ list->addFunction(&test2, &b);
- LL_INFOS() << "Expect: test1 1, test1 1, test1 2, test2 2" << LL_ENDL;
- list->callFunctions();
+ LL_INFOS() << "Expect: test1 1, test1 1, test1 2, test2 2" << LL_ENDL;
+ list->callFunctions();
- if (list->deleteFunction(&test1, &b))
- {
- LL_INFOS() << "passed 3" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "error removing function" << LL_ENDL;
- }
+ if (list->deleteFunction(&test1, &b))
+ {
+ LL_INFOS() << "passed 3" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "error removing function" << LL_ENDL;
+ }
- LL_INFOS() << "Expect: test1 1, test1 1, test2 2" << LL_ENDL;
- list->callFunctions();
+ LL_INFOS() << "Expect: test1 1, test1 1, test2 2" << LL_ENDL;
+ list->callFunctions();
- list->deleteAllFunctions();
+ list->deleteAllFunctions();
- LL_INFOS() << "Expect nothing" << LL_ENDL;
- list->callFunctions();
+ LL_INFOS() << "Expect nothing" << LL_ENDL;
+ list->callFunctions();
- LL_INFOS() << "nothing :-)" << LL_ENDL;
+ LL_INFOS() << "nothing :-)" << LL_ENDL;
- delete list;
+ delete list;
- LL_INFOS() << "test complete" << LL_ENDL;
+ LL_INFOS() << "test complete" << LL_ENDL;
}
#endif // _DEBUG
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index df79043b00..f5bc2343fb 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcallingcard.cpp
* @brief Implementation of the LLPreviewCallingCard class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -62,471 +62,471 @@
class LLTrackingData
{
public:
- LLTrackingData(const LLUUID& avatar_id, const std::string& name);
- bool haveTrackingInfo();
- void setTrackedCoarseLocation(const LLVector3d& global_pos);
- void agentFound(const LLUUID& prey,
- const LLVector3d& estimated_global_pos);
-
+ LLTrackingData(const LLUUID& avatar_id, const std::string& name);
+ bool haveTrackingInfo();
+ void setTrackedCoarseLocation(const LLVector3d& global_pos);
+ void agentFound(const LLUUID& prey,
+ const LLVector3d& estimated_global_pos);
+
public:
- LLUUID mAvatarID;
- std::string mName;
- LLVector3d mGlobalPositionEstimate;
- bool mHaveInfo;
- bool mHaveCoarseInfo;
- LLTimer mCoarseLocationTimer;
- LLTimer mUpdateTimer;
- LLTimer mAgentGone;
+ LLUUID mAvatarID;
+ std::string mName;
+ LLVector3d mGlobalPositionEstimate;
+ bool mHaveInfo;
+ bool mHaveCoarseInfo;
+ LLTimer mCoarseLocationTimer;
+ LLTimer mUpdateTimer;
+ LLTimer mAgentGone;
};
const F32 COARSE_FREQUENCY = 2.2f;
-const F32 FIND_FREQUENCY = 29.7f; // This results in a database query, so cut these back
+const F32 FIND_FREQUENCY = 29.7f; // This results in a database query, so cut these back
const F32 OFFLINE_SECONDS = FIND_FREQUENCY + 8.0f;
// static
LLAvatarTracker LLAvatarTracker::sInstance;
static void on_avatar_name_cache_notify(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- bool online,
- LLSD payload);
+ const LLAvatarName& av_name,
+ bool online,
+ LLSD payload);
///----------------------------------------------------------------------------
/// Class LLAvatarTracker
///----------------------------------------------------------------------------
LLAvatarTracker::LLAvatarTracker() :
- mTrackingData(NULL),
- mTrackedAgentValid(false),
- mModifyMask(0x0),
- mIsNotifyObservers(FALSE)
+ mTrackingData(NULL),
+ mTrackedAgentValid(false),
+ mModifyMask(0x0),
+ mIsNotifyObservers(FALSE)
{
}
LLAvatarTracker::~LLAvatarTracker()
{
- deleteTrackingData();
- std::for_each(mObservers.begin(), mObservers.end(), DeletePointer());
- mObservers.clear();
- std::for_each(mBuddyInfo.begin(), mBuddyInfo.end(), DeletePairedPointer());
- mBuddyInfo.clear();
+ deleteTrackingData();
+ std::for_each(mObservers.begin(), mObservers.end(), DeletePointer());
+ mObservers.clear();
+ std::for_each(mBuddyInfo.begin(), mBuddyInfo.end(), DeletePairedPointer());
+ mBuddyInfo.clear();
}
void LLAvatarTracker::track(const LLUUID& avatar_id, const std::string& name)
{
- deleteTrackingData();
- mTrackedAgentValid = false;
- mTrackingData = new LLTrackingData(avatar_id, name);
- findAgent();
-
- // We track here because findAgent() is called on a timer (for now).
- if(avatar_id.notNull())
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_TrackAgent);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_TargetData);
- msg->addUUIDFast(_PREHASH_PreyID, avatar_id);
- gAgent.sendReliableMessage();
- }
+ deleteTrackingData();
+ mTrackedAgentValid = false;
+ mTrackingData = new LLTrackingData(avatar_id, name);
+ findAgent();
+
+ // We track here because findAgent() is called on a timer (for now).
+ if(avatar_id.notNull())
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_TrackAgent);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_TargetData);
+ msg->addUUIDFast(_PREHASH_PreyID, avatar_id);
+ gAgent.sendReliableMessage();
+ }
}
void LLAvatarTracker::untrack(const LLUUID& avatar_id)
{
- if (mTrackingData && mTrackingData->mAvatarID == avatar_id)
- {
- deleteTrackingData();
- mTrackedAgentValid = false;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_TrackAgent);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_TargetData);
- msg->addUUIDFast(_PREHASH_PreyID, LLUUID::null);
- gAgent.sendReliableMessage();
- }
+ if (mTrackingData && mTrackingData->mAvatarID == avatar_id)
+ {
+ deleteTrackingData();
+ mTrackedAgentValid = false;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_TrackAgent);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_TargetData);
+ msg->addUUIDFast(_PREHASH_PreyID, LLUUID::null);
+ gAgent.sendReliableMessage();
+ }
}
void LLAvatarTracker::setTrackedCoarseLocation(const LLVector3d& global_pos)
{
- if(mTrackingData)
- {
- mTrackingData->setTrackedCoarseLocation(global_pos);
- }
+ if(mTrackingData)
+ {
+ mTrackingData->setTrackedCoarseLocation(global_pos);
+ }
}
bool LLAvatarTracker::haveTrackingInfo()
{
- if(mTrackingData)
- {
- return mTrackingData->haveTrackingInfo();
- }
- return false;
+ if(mTrackingData)
+ {
+ return mTrackingData->haveTrackingInfo();
+ }
+ return false;
}
LLVector3d LLAvatarTracker::getGlobalPos()
{
- if(!mTrackedAgentValid || !mTrackingData) return LLVector3d();
- LLVector3d global_pos;
-
- LLViewerObject* object = gObjectList.findObject(mTrackingData->mAvatarID);
- if(object && !object->isDead())
- {
- global_pos = object->getPositionGlobal();
- // HACK - for making the tracker point above the avatar's head
- // rather than its groin
- LLVOAvatar* av = (LLVOAvatar*)object;
- global_pos.mdV[VZ] += 0.7f * (av->mBodySize.mV[VZ] + av->mAvatarOffset.mV[VZ]);
+ if(!mTrackedAgentValid || !mTrackingData) return LLVector3d();
+ LLVector3d global_pos;
- mTrackingData->mGlobalPositionEstimate = global_pos;
- }
- else
- {
- global_pos = mTrackingData->mGlobalPositionEstimate;
- }
+ LLViewerObject* object = gObjectList.findObject(mTrackingData->mAvatarID);
+ if(object && !object->isDead())
+ {
+ global_pos = object->getPositionGlobal();
+ // HACK - for making the tracker point above the avatar's head
+ // rather than its groin
+ LLVOAvatar* av = (LLVOAvatar*)object;
+ global_pos.mdV[VZ] += 0.7f * (av->mBodySize.mV[VZ] + av->mAvatarOffset.mV[VZ]);
- return global_pos;
+ mTrackingData->mGlobalPositionEstimate = global_pos;
+ }
+ else
+ {
+ global_pos = mTrackingData->mGlobalPositionEstimate;
+ }
+
+ return global_pos;
}
void LLAvatarTracker::getDegreesAndDist(F32& rot,
- F64& horiz_dist,
- F64& vert_dist)
+ F64& horiz_dist,
+ F64& vert_dist)
{
- if(!mTrackingData) return;
+ if(!mTrackingData) return;
- LLVector3d global_pos;
+ LLVector3d global_pos;
- LLViewerObject* object = gObjectList.findObject(mTrackingData->mAvatarID);
- if(object && !object->isDead())
- {
- global_pos = object->getPositionGlobal();
- mTrackingData->mGlobalPositionEstimate = global_pos;
- }
- else
- {
- global_pos = mTrackingData->mGlobalPositionEstimate;
- }
- LLVector3d to_vec = global_pos - gAgent.getPositionGlobal();
- horiz_dist = sqrt(to_vec.mdV[VX] * to_vec.mdV[VX] + to_vec.mdV[VY] * to_vec.mdV[VY]);
- vert_dist = to_vec.mdV[VZ];
- rot = F32(RAD_TO_DEG * atan2(to_vec.mdV[VY], to_vec.mdV[VX]));
+ LLViewerObject* object = gObjectList.findObject(mTrackingData->mAvatarID);
+ if(object && !object->isDead())
+ {
+ global_pos = object->getPositionGlobal();
+ mTrackingData->mGlobalPositionEstimate = global_pos;
+ }
+ else
+ {
+ global_pos = mTrackingData->mGlobalPositionEstimate;
+ }
+ LLVector3d to_vec = global_pos - gAgent.getPositionGlobal();
+ horiz_dist = sqrt(to_vec.mdV[VX] * to_vec.mdV[VX] + to_vec.mdV[VY] * to_vec.mdV[VY]);
+ vert_dist = to_vec.mdV[VZ];
+ rot = F32(RAD_TO_DEG * atan2(to_vec.mdV[VY], to_vec.mdV[VX]));
}
const std::string& LLAvatarTracker::getName()
{
- if(mTrackingData)
- {
- return mTrackingData->mName;
- }
- else
- {
- return LLStringUtil::null;
- }
+ if(mTrackingData)
+ {
+ return mTrackingData->mName;
+ }
+ else
+ {
+ return LLStringUtil::null;
+ }
}
const LLUUID& LLAvatarTracker::getAvatarID()
{
- if(mTrackingData)
- {
- return mTrackingData->mAvatarID;
- }
- else
- {
- return LLUUID::null;
- }
+ if(mTrackingData)
+ {
+ return mTrackingData->mAvatarID;
+ }
+ else
+ {
+ return LLUUID::null;
+ }
}
S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds)
{
- using namespace std;
-
- U32 new_buddy_count = 0;
- LLUUID agent_id;
- for(buddy_map_t::const_iterator itr = buds.begin(); itr != buds.end(); ++itr)
- {
- agent_id = (*itr).first;
- buddy_map_t::const_iterator existing_buddy = mBuddyInfo.find(agent_id);
- if(existing_buddy == mBuddyInfo.end())
- {
- ++new_buddy_count;
- mBuddyInfo[agent_id] = (*itr).second;
-
- // pre-request name for notifications?
- LLAvatarName av_name;
- LLAvatarNameCache::get(agent_id, &av_name);
-
- addChangedMask(LLFriendObserver::ADD, agent_id);
- LL_DEBUGS() << "Added buddy " << agent_id
- << ", " << (mBuddyInfo[agent_id]->isOnline() ? "Online" : "Offline")
- << ", TO: " << mBuddyInfo[agent_id]->getRightsGrantedTo()
- << ", FROM: " << mBuddyInfo[agent_id]->getRightsGrantedFrom()
- << LL_ENDL;
- }
- else
- {
- LLRelationship* e_r = (*existing_buddy).second;
- LLRelationship* n_r = (*itr).second;
- LL_WARNS() << "!! Add buddy for existing buddy: " << agent_id
- << " [" << (e_r->isOnline() ? "Online" : "Offline") << "->" << (n_r->isOnline() ? "Online" : "Offline")
- << ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo()
- << ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo()
- << "]" << LL_ENDL;
- }
- }
- // do not notify observers here - list can be large so let it be done on idle.
-
- return new_buddy_count;
+ using namespace std;
+
+ U32 new_buddy_count = 0;
+ LLUUID agent_id;
+ for(buddy_map_t::const_iterator itr = buds.begin(); itr != buds.end(); ++itr)
+ {
+ agent_id = (*itr).first;
+ buddy_map_t::const_iterator existing_buddy = mBuddyInfo.find(agent_id);
+ if(existing_buddy == mBuddyInfo.end())
+ {
+ ++new_buddy_count;
+ mBuddyInfo[agent_id] = (*itr).second;
+
+ // pre-request name for notifications?
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(agent_id, &av_name);
+
+ addChangedMask(LLFriendObserver::ADD, agent_id);
+ LL_DEBUGS() << "Added buddy " << agent_id
+ << ", " << (mBuddyInfo[agent_id]->isOnline() ? "Online" : "Offline")
+ << ", TO: " << mBuddyInfo[agent_id]->getRightsGrantedTo()
+ << ", FROM: " << mBuddyInfo[agent_id]->getRightsGrantedFrom()
+ << LL_ENDL;
+ }
+ else
+ {
+ LLRelationship* e_r = (*existing_buddy).second;
+ LLRelationship* n_r = (*itr).second;
+ LL_WARNS() << "!! Add buddy for existing buddy: " << agent_id
+ << " [" << (e_r->isOnline() ? "Online" : "Offline") << "->" << (n_r->isOnline() ? "Online" : "Offline")
+ << ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo()
+ << ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo()
+ << "]" << LL_ENDL;
+ }
+ }
+ // do not notify observers here - list can be large so let it be done on idle.
+
+ return new_buddy_count;
}
void LLAvatarTracker::copyBuddyList(buddy_map_t& buddies) const
{
- buddy_map_t::const_iterator it = mBuddyInfo.begin();
- buddy_map_t::const_iterator end = mBuddyInfo.end();
- for(; it != end; ++it)
- {
- buddies[(*it).first] = (*it).second;
- }
+ buddy_map_t::const_iterator it = mBuddyInfo.begin();
+ buddy_map_t::const_iterator end = mBuddyInfo.end();
+ for(; it != end; ++it)
+ {
+ buddies[(*it).first] = (*it).second;
+ }
}
void LLAvatarTracker::terminateBuddy(const LLUUID& id)
{
- LL_DEBUGS() << "LLAvatarTracker::terminateBuddy()" << LL_ENDL;
- LLUIUsage::instance().logCommand("Agent.TerminateFriendship");
-
- LLRelationship* buddy = get_ptr_in_map(mBuddyInfo, id);
- if(!buddy) return;
- mBuddyInfo.erase(id);
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("TerminateFriendship");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("ExBlock");
- msg->addUUID("OtherID", id);
- gAgent.sendReliableMessage();
-
- addChangedMask(LLFriendObserver::REMOVE, id);
- delete buddy;
+ LL_DEBUGS() << "LLAvatarTracker::terminateBuddy()" << LL_ENDL;
+ LLUIUsage::instance().logCommand("Agent.TerminateFriendship");
+
+ LLRelationship* buddy = get_ptr_in_map(mBuddyInfo, id);
+ if(!buddy) return;
+ mBuddyInfo.erase(id);
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("TerminateFriendship");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("ExBlock");
+ msg->addUUID("OtherID", id);
+ gAgent.sendReliableMessage();
+
+ addChangedMask(LLFriendObserver::REMOVE, id);
+ delete buddy;
}
// get all buddy info
const LLRelationship* LLAvatarTracker::getBuddyInfo(const LLUUID& id) const
{
- if(id.isNull()) return NULL;
- return get_ptr_in_map(mBuddyInfo, id);
+ if(id.isNull()) return NULL;
+ return get_ptr_in_map(mBuddyInfo, id);
}
bool LLAvatarTracker::isBuddy(const LLUUID& id) const
{
- LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
- return (info != NULL);
+ LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
+ return (info != NULL);
}
// online status
void LLAvatarTracker::setBuddyOnline(const LLUUID& id, bool is_online)
{
- LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
- if(info)
- {
- info->online(is_online);
- addChangedMask(LLFriendObserver::ONLINE, id);
- LL_DEBUGS() << "Set buddy " << id << (is_online ? " Online" : " Offline") << LL_ENDL;
- }
- else
- {
- LL_WARNS() << "!! No buddy info found for " << id
- << ", setting to " << (is_online ? "Online" : "Offline") << LL_ENDL;
- }
+ LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
+ if(info)
+ {
+ info->online(is_online);
+ addChangedMask(LLFriendObserver::ONLINE, id);
+ LL_DEBUGS() << "Set buddy " << id << (is_online ? " Online" : " Offline") << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "!! No buddy info found for " << id
+ << ", setting to " << (is_online ? "Online" : "Offline") << LL_ENDL;
+ }
}
bool LLAvatarTracker::isBuddyOnline(const LLUUID& id) const
{
- LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
- if(info)
- {
- return info->isOnline();
- }
- return false;
+ LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
+ if(info)
+ {
+ return info->isOnline();
+ }
+ return false;
}
// empowered status
void LLAvatarTracker::setBuddyEmpowered(const LLUUID& id, bool is_empowered)
{
- LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
- if(info)
- {
- info->grantRights(LLRelationship::GRANT_MODIFY_OBJECTS, 0);
- mModifyMask |= LLFriendObserver::POWERS;
- }
+ LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
+ if(info)
+ {
+ info->grantRights(LLRelationship::GRANT_MODIFY_OBJECTS, 0);
+ mModifyMask |= LLFriendObserver::POWERS;
+ }
}
bool LLAvatarTracker::isBuddyEmpowered(const LLUUID& id) const
{
- LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
- if(info)
- {
- return info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS);
- }
- return false;
+ LLRelationship* info = get_ptr_in_map(mBuddyInfo, id);
+ if(info)
+ {
+ return info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS);
+ }
+ return false;
}
void LLAvatarTracker::empower(const LLUUID& id, bool grant)
{
- // wrapper for ease of use in some situations.
- buddy_map_t list;
- /*
- list.insert(id);
- empowerList(list, grant);
- */
+ // wrapper for ease of use in some situations.
+ buddy_map_t list;
+ /*
+ list.insert(id);
+ empowerList(list, grant);
+ */
}
void LLAvatarTracker::empowerList(const buddy_map_t& list, bool grant)
{
- LL_WARNS() << "LLAvatarTracker::empowerList() not implemented." << LL_ENDL;
+ LL_WARNS() << "LLAvatarTracker::empowerList() not implemented." << LL_ENDL;
/*
- LLMessageSystem* msg = gMessageSystem;
- const char* message_name;
- const char* block_name;
- const char* field_name;
- if(grant)
- {
- message_name = _PREHASH_GrantModification;
- block_name = _PREHASH_EmpoweredBlock;
- field_name = _PREHASH_EmpoweredID;
- }
- else
- {
- message_name = _PREHASH_RevokeModification;
- block_name = _PREHASH_RevokedBlock;
- field_name = _PREHASH_RevokedID;
- }
-
- std::string name;
- gAgent.buildFullnameAndTitle(name);
-
- bool start_new_message = true;
- buddy_list_t::const_iterator it = list.begin();
- buddy_list_t::const_iterator end = list.end();
- for(; it != end; ++it)
- {
- if(NULL == get_ptr_in_map(mBuddyInfo, (*it))) continue;
- setBuddyEmpowered((*it), grant);
- if(start_new_message)
- {
- start_new_message = false;
- msg->newMessageFast(message_name);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addStringFast(_PREHASH_GranterName, name);
- }
- msg->nextBlockFast(block_name);
- msg->addUUIDFast(field_name, (*it));
- if(msg->isSendFullFast(block_name))
- {
- start_new_message = true;
- gAgent.sendReliableMessage();
- }
- }
- if(!start_new_message)
- {
- gAgent.sendReliableMessage();
- }
+ LLMessageSystem* msg = gMessageSystem;
+ const char* message_name;
+ const char* block_name;
+ const char* field_name;
+ if(grant)
+ {
+ message_name = _PREHASH_GrantModification;
+ block_name = _PREHASH_EmpoweredBlock;
+ field_name = _PREHASH_EmpoweredID;
+ }
+ else
+ {
+ message_name = _PREHASH_RevokeModification;
+ block_name = _PREHASH_RevokedBlock;
+ field_name = _PREHASH_RevokedID;
+ }
+
+ std::string name;
+ gAgent.buildFullnameAndTitle(name);
+
+ bool start_new_message = true;
+ buddy_list_t::const_iterator it = list.begin();
+ buddy_list_t::const_iterator end = list.end();
+ for(; it != end; ++it)
+ {
+ if(NULL == get_ptr_in_map(mBuddyInfo, (*it))) continue;
+ setBuddyEmpowered((*it), grant);
+ if(start_new_message)
+ {
+ start_new_message = false;
+ msg->newMessageFast(message_name);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addStringFast(_PREHASH_GranterName, name);
+ }
+ msg->nextBlockFast(block_name);
+ msg->addUUIDFast(field_name, (*it));
+ if(msg->isSendFullFast(block_name))
+ {
+ start_new_message = true;
+ gAgent.sendReliableMessage();
+ }
+ }
+ if(!start_new_message)
+ {
+ gAgent.sendReliableMessage();
+ }
*/
}
void LLAvatarTracker::deleteTrackingData()
{
- //make sure mTrackingData never points to freed memory
- LLTrackingData* tmp = mTrackingData;
- mTrackingData = NULL;
- delete tmp;
+ //make sure mTrackingData never points to freed memory
+ LLTrackingData* tmp = mTrackingData;
+ mTrackingData = NULL;
+ delete tmp;
}
void LLAvatarTracker::findAgent()
{
- if (!mTrackingData) return;
- if (mTrackingData->mAvatarID.isNull()) return;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_FindAgent); // Request
- msg->nextBlockFast(_PREHASH_AgentBlock);
- msg->addUUIDFast(_PREHASH_Hunter, gAgentID);
- msg->addUUIDFast(_PREHASH_Prey, mTrackingData->mAvatarID);
- msg->addU32Fast(_PREHASH_SpaceIP, 0); // will get filled in by simulator
- msg->nextBlockFast(_PREHASH_LocationBlock);
- const F64 NO_LOCATION = 0.0;
- msg->addF64Fast(_PREHASH_GlobalX, NO_LOCATION);
- msg->addF64Fast(_PREHASH_GlobalY, NO_LOCATION);
- gAgent.sendReliableMessage();
+ if (!mTrackingData) return;
+ if (mTrackingData->mAvatarID.isNull()) return;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_FindAgent); // Request
+ msg->nextBlockFast(_PREHASH_AgentBlock);
+ msg->addUUIDFast(_PREHASH_Hunter, gAgentID);
+ msg->addUUIDFast(_PREHASH_Prey, mTrackingData->mAvatarID);
+ msg->addU32Fast(_PREHASH_SpaceIP, 0); // will get filled in by simulator
+ msg->nextBlockFast(_PREHASH_LocationBlock);
+ const F64 NO_LOCATION = 0.0;
+ msg->addF64Fast(_PREHASH_GlobalX, NO_LOCATION);
+ msg->addF64Fast(_PREHASH_GlobalY, NO_LOCATION);
+ gAgent.sendReliableMessage();
}
void LLAvatarTracker::addObserver(LLFriendObserver* observer)
{
- if(observer)
- {
- mObservers.push_back(observer);
- }
+ if(observer)
+ {
+ mObservers.push_back(observer);
+ }
}
void LLAvatarTracker::removeObserver(LLFriendObserver* observer)
{
- mObservers.erase(
- std::remove(mObservers.begin(), mObservers.end(), observer),
- mObservers.end());
+ mObservers.erase(
+ std::remove(mObservers.begin(), mObservers.end(), observer),
+ mObservers.end());
}
void LLAvatarTracker::idleNotifyObservers()
{
- if (mModifyMask == LLFriendObserver::NONE && mChangedBuddyIDs.size() == 0)
- {
- return;
- }
- notifyObservers();
+ if (mModifyMask == LLFriendObserver::NONE && mChangedBuddyIDs.size() == 0)
+ {
+ return;
+ }
+ notifyObservers();
}
void LLAvatarTracker::notifyObservers()
{
- if (mIsNotifyObservers)
- {
- // Don't allow multiple calls.
- // new masks and ids will be processed later from idle.
- return;
- }
- LL_PROFILE_ZONE_SCOPED
- mIsNotifyObservers = TRUE;
-
- observer_list_t observers(mObservers);
- observer_list_t::iterator it = observers.begin();
- observer_list_t::iterator end = observers.end();
- for(; it != end; ++it)
- {
- (*it)->changed(mModifyMask);
- }
-
- for (changed_buddy_t::iterator it = mChangedBuddyIDs.begin(); it != mChangedBuddyIDs.end(); it++)
- {
- notifyParticularFriendObservers(*it);
- }
-
- mModifyMask = LLFriendObserver::NONE;
- mChangedBuddyIDs.clear();
- mIsNotifyObservers = FALSE;
+ if (mIsNotifyObservers)
+ {
+ // Don't allow multiple calls.
+ // new masks and ids will be processed later from idle.
+ return;
+ }
+ LL_PROFILE_ZONE_SCOPED
+ mIsNotifyObservers = TRUE;
+
+ observer_list_t observers(mObservers);
+ observer_list_t::iterator it = observers.begin();
+ observer_list_t::iterator end = observers.end();
+ for(; it != end; ++it)
+ {
+ (*it)->changed(mModifyMask);
+ }
+
+ for (changed_buddy_t::iterator it = mChangedBuddyIDs.begin(); it != mChangedBuddyIDs.end(); it++)
+ {
+ notifyParticularFriendObservers(*it);
+ }
+
+ mModifyMask = LLFriendObserver::NONE;
+ mChangedBuddyIDs.clear();
+ mIsNotifyObservers = FALSE;
}
void LLAvatarTracker::addParticularFriendObserver(const LLUUID& buddy_id, LLFriendObserver* observer)
{
- if (buddy_id.notNull() && observer)
- mParticularFriendObserverMap[buddy_id].insert(observer);
+ if (buddy_id.notNull() && observer)
+ mParticularFriendObserverMap[buddy_id].insert(observer);
}
void LLAvatarTracker::removeParticularFriendObserver(const LLUUID& buddy_id, LLFriendObserver* observer)
{
- if (buddy_id.isNull() || !observer)
- return;
+ if (buddy_id.isNull() || !observer)
+ return;
observer_map_t::iterator obs_it = mParticularFriendObserverMap.find(buddy_id);
if(obs_it == mParticularFriendObserverMap.end())
@@ -536,7 +536,7 @@ void LLAvatarTracker::removeParticularFriendObserver(const LLUUID& buddy_id, LLF
// purge empty sets from the map
if (obs_it->second.size() == 0)
- mParticularFriendObserverMap.erase(obs_it);
+ mParticularFriendObserverMap.erase(obs_it);
}
void LLAvatarTracker::notifyParticularFriendObservers(const LLUUID& buddy_id)
@@ -557,245 +557,245 @@ void LLAvatarTracker::notifyParticularFriendObservers(const LLUUID& buddy_id)
// and id of object change applies to
void LLAvatarTracker::addChangedMask(U32 mask, const LLUUID& referent)
{
- mModifyMask |= mask;
- if (referent.notNull())
- {
- mChangedBuddyIDs.insert(referent);
- }
+ mModifyMask |= mask;
+ if (referent.notNull())
+ {
+ mChangedBuddyIDs.insert(referent);
+ }
}
void LLAvatarTracker::applyFunctor(LLRelationshipFunctor& f)
{
- buddy_map_t::iterator it = mBuddyInfo.begin();
- buddy_map_t::iterator end = mBuddyInfo.end();
- for(; it != end; ++it)
- {
- f((*it).first, (*it).second);
- }
+ buddy_map_t::iterator it = mBuddyInfo.begin();
+ buddy_map_t::iterator end = mBuddyInfo.end();
+ for(; it != end; ++it)
+ {
+ f((*it).first, (*it).second);
+ }
}
void LLAvatarTracker::registerCallbacks(LLMessageSystem* msg)
{
- msg->setHandlerFuncFast(_PREHASH_FindAgent, processAgentFound);
- msg->setHandlerFuncFast(_PREHASH_OnlineNotification,
- processOnlineNotification);
- msg->setHandlerFuncFast(_PREHASH_OfflineNotification,
- processOfflineNotification);
- //msg->setHandlerFuncFast(_PREHASH_GrantedProxies,
- // processGrantedProxies);
- msg->setHandlerFunc("TerminateFriendship", processTerminateFriendship);
- msg->setHandlerFunc(_PREHASH_ChangeUserRights, processChangeUserRights);
+ msg->setHandlerFuncFast(_PREHASH_FindAgent, processAgentFound);
+ msg->setHandlerFuncFast(_PREHASH_OnlineNotification,
+ processOnlineNotification);
+ msg->setHandlerFuncFast(_PREHASH_OfflineNotification,
+ processOfflineNotification);
+ //msg->setHandlerFuncFast(_PREHASH_GrantedProxies,
+ // processGrantedProxies);
+ msg->setHandlerFunc("TerminateFriendship", processTerminateFriendship);
+ msg->setHandlerFunc(_PREHASH_ChangeUserRights, processChangeUserRights);
}
// static
void LLAvatarTracker::processAgentFound(LLMessageSystem* msg, void**)
{
- LLUUID id;
+ LLUUID id;
-
- msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_Hunter, id);
- msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_Prey, id);
- // *FIX: should make sure prey id matches.
- LLVector3d estimated_global_pos;
- msg->getF64Fast(_PREHASH_LocationBlock, _PREHASH_GlobalX,
- estimated_global_pos.mdV[VX]);
- msg->getF64Fast(_PREHASH_LocationBlock, _PREHASH_GlobalY,
- estimated_global_pos.mdV[VY]);
- LLAvatarTracker::instance().agentFound(id, estimated_global_pos);
+
+ msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_Hunter, id);
+ msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_Prey, id);
+ // *FIX: should make sure prey id matches.
+ LLVector3d estimated_global_pos;
+ msg->getF64Fast(_PREHASH_LocationBlock, _PREHASH_GlobalX,
+ estimated_global_pos.mdV[VX]);
+ msg->getF64Fast(_PREHASH_LocationBlock, _PREHASH_GlobalY,
+ estimated_global_pos.mdV[VY]);
+ LLAvatarTracker::instance().agentFound(id, estimated_global_pos);
}
void LLAvatarTracker::agentFound(const LLUUID& prey,
- const LLVector3d& estimated_global_pos)
+ const LLVector3d& estimated_global_pos)
{
- if(!mTrackingData) return;
- //if we get a valid reply from the server, that means the agent
- //is our friend and mappable, so enable interest list based updates
- LLAvatarTracker::instance().setTrackedAgentValid(true);
- mTrackingData->agentFound(prey, estimated_global_pos);
+ if(!mTrackingData) return;
+ //if we get a valid reply from the server, that means the agent
+ //is our friend and mappable, so enable interest list based updates
+ LLAvatarTracker::instance().setTrackedAgentValid(true);
+ mTrackingData->agentFound(prey, estimated_global_pos);
}
-// static
+// static
void LLAvatarTracker::processOnlineNotification(LLMessageSystem* msg, void**)
{
- LL_DEBUGS() << "LLAvatarTracker::processOnlineNotification()" << LL_ENDL;
- instance().processNotify(msg, true);
+ LL_DEBUGS() << "LLAvatarTracker::processOnlineNotification()" << LL_ENDL;
+ instance().processNotify(msg, true);
}
-// static
+// static
void LLAvatarTracker::processOfflineNotification(LLMessageSystem* msg, void**)
{
- LL_DEBUGS() << "LLAvatarTracker::processOfflineNotification()" << LL_ENDL;
- instance().processNotify(msg, false);
+ LL_DEBUGS() << "LLAvatarTracker::processOfflineNotification()" << LL_ENDL;
+ instance().processNotify(msg, false);
}
void LLAvatarTracker::processChange(LLMessageSystem* msg)
{
- S32 count = msg->getNumberOfBlocksFast(_PREHASH_Rights);
- LLUUID agent_id, agent_related;
- S32 new_rights;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- for(int i = 0; i < count; ++i)
- {
- msg->getUUIDFast(_PREHASH_Rights, _PREHASH_AgentRelated, agent_related, i);
- msg->getS32Fast(_PREHASH_Rights,_PREHASH_RelatedRights, new_rights, i);
- if(agent_id == gAgent.getID())
- {
- if(mBuddyInfo.find(agent_related) != mBuddyInfo.end())
- {
- (mBuddyInfo[agent_related])->setRightsTo(new_rights);
- mChangedBuddyIDs.insert(agent_related);
- }
- }
- else
- {
- if(mBuddyInfo.find(agent_id) != mBuddyInfo.end())
- {
+ S32 count = msg->getNumberOfBlocksFast(_PREHASH_Rights);
+ LLUUID agent_id, agent_related;
+ S32 new_rights;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ for(int i = 0; i < count; ++i)
+ {
+ msg->getUUIDFast(_PREHASH_Rights, _PREHASH_AgentRelated, agent_related, i);
+ msg->getS32Fast(_PREHASH_Rights,_PREHASH_RelatedRights, new_rights, i);
+ if(agent_id == gAgent.getID())
+ {
+ if(mBuddyInfo.find(agent_related) != mBuddyInfo.end())
+ {
+ (mBuddyInfo[agent_related])->setRightsTo(new_rights);
+ mChangedBuddyIDs.insert(agent_related);
+ }
+ }
+ else
+ {
+ if(mBuddyInfo.find(agent_id) != mBuddyInfo.end())
+ {
if (((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MODIFY_OBJECTS))
- {
- LLSD args;
- args["NAME"] = LLSLURL("agent", agent_id, "displayname").getSLURLString();
-
- LLSD payload;
- payload["from_id"] = agent_id;
- if(LLRelationship::GRANT_MODIFY_OBJECTS & new_rights)
- {
- LLNotifications::instance().add("GrantedModifyRights",args, payload);
- }
- else
- {
- LLNotifications::instance().add("RevokedModifyRights",args, payload);
- }
- }
- (mBuddyInfo[agent_id])->setRightsFrom(new_rights);
- }
- }
- }
-
- addChangedMask(LLFriendObserver::POWERS, agent_id);
- notifyObservers();
+ {
+ LLSD args;
+ args["NAME"] = LLSLURL("agent", agent_id, "displayname").getSLURLString();
+
+ LLSD payload;
+ payload["from_id"] = agent_id;
+ if(LLRelationship::GRANT_MODIFY_OBJECTS & new_rights)
+ {
+ LLNotifications::instance().add("GrantedModifyRights",args, payload);
+ }
+ else
+ {
+ LLNotifications::instance().add("RevokedModifyRights",args, payload);
+ }
+ }
+ (mBuddyInfo[agent_id])->setRightsFrom(new_rights);
+ }
+ }
+ }
+
+ addChangedMask(LLFriendObserver::POWERS, agent_id);
+ notifyObservers();
}
void LLAvatarTracker::processChangeUserRights(LLMessageSystem* msg, void**)
{
- LL_DEBUGS() << "LLAvatarTracker::processChangeUserRights()" << LL_ENDL;
- instance().processChange(msg);
+ LL_DEBUGS() << "LLAvatarTracker::processChangeUserRights()" << LL_ENDL;
+ instance().processChange(msg);
}
void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
{
- LL_PROFILE_ZONE_SCOPED
- S32 count = msg->getNumberOfBlocksFast(_PREHASH_AgentBlock);
- BOOL chat_notify = gSavedSettings.getBOOL("ChatOnlineNotification");
-
- LL_DEBUGS() << "Received " << count << " online notifications **** " << LL_ENDL;
- if(count > 0)
- {
- LLUUID agent_id;
- const LLRelationship* info = NULL;
- LLUUID tracking_id;
- if(mTrackingData)
- {
- tracking_id = mTrackingData->mAvatarID;
- }
- LLSD payload;
- for(S32 i = 0; i < count; ++i)
- {
- msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_AgentID, agent_id, i);
- payload["FROM_ID"] = agent_id;
- info = getBuddyInfo(agent_id);
- if(info)
- {
- setBuddyOnline(agent_id,online);
- }
- else
- {
- LL_WARNS() << "Received online notification for unknown buddy: "
- << agent_id << " is " << (online ? "ONLINE" : "OFFLINE") << LL_ENDL;
- }
-
- if(tracking_id == agent_id)
- {
- // we were tracking someone who went offline
- deleteTrackingData();
- }
+ LL_PROFILE_ZONE_SCOPED
+ S32 count = msg->getNumberOfBlocksFast(_PREHASH_AgentBlock);
+ BOOL chat_notify = gSavedSettings.getBOOL("ChatOnlineNotification");
+
+ LL_DEBUGS() << "Received " << count << " online notifications **** " << LL_ENDL;
+ if(count > 0)
+ {
+ LLUUID agent_id;
+ const LLRelationship* info = NULL;
+ LLUUID tracking_id;
+ if(mTrackingData)
+ {
+ tracking_id = mTrackingData->mAvatarID;
+ }
+ LLSD payload;
+ for(S32 i = 0; i < count; ++i)
+ {
+ msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_AgentID, agent_id, i);
+ payload["FROM_ID"] = agent_id;
+ info = getBuddyInfo(agent_id);
+ if(info)
+ {
+ setBuddyOnline(agent_id,online);
+ }
+ else
+ {
+ LL_WARNS() << "Received online notification for unknown buddy: "
+ << agent_id << " is " << (online ? "ONLINE" : "OFFLINE") << LL_ENDL;
+ }
+
+ if(tracking_id == agent_id)
+ {
+ // we were tracking someone who went offline
+ deleteTrackingData();
+ }
if(chat_notify)
{
// Look up the name of this agent for the notification
LLAvatarNameCache::get(agent_id,boost::bind(&on_avatar_name_cache_notify,_1, _2, online, payload));
}
- }
+ }
- mModifyMask |= LLFriendObserver::ONLINE;
- instance().notifyObservers();
- gInventory.notifyObservers();
- }
+ mModifyMask |= LLFriendObserver::ONLINE;
+ instance().notifyObservers();
+ gInventory.notifyObservers();
+ }
}
static void on_avatar_name_cache_notify(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- bool online,
- LLSD payload)
-{
- // Popup a notify box with online status of this agent
- // Use display name only because this user is your friend
- LLSD args;
- args["NAME"] = av_name.getDisplayName();
- args["STATUS"] = online ? LLTrans::getString("OnlineStatus") : LLTrans::getString("OfflineStatus");
-
- LLNotificationPtr notification;
- if (online)
- {
- notification =
- LLNotifications::instance().add("FriendOnlineOffline",
- args,
- payload.with("respond_on_mousedown", TRUE),
- boost::bind(&LLAvatarActions::startIM, agent_id));
- }
- else
- {
- notification =
- LLNotifications::instance().add("FriendOnlineOffline", args, payload);
- }
-
- // If there's an open IM session with this agent, send a notification there too.
- LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id);
- std::string notify_msg = notification->getMessage();
- LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg);
+ const LLAvatarName& av_name,
+ bool online,
+ LLSD payload)
+{
+ // Popup a notify box with online status of this agent
+ // Use display name only because this user is your friend
+ LLSD args;
+ args["NAME"] = av_name.getDisplayName();
+ args["STATUS"] = online ? LLTrans::getString("OnlineStatus") : LLTrans::getString("OfflineStatus");
+
+ LLNotificationPtr notification;
+ if (online)
+ {
+ notification =
+ LLNotifications::instance().add("FriendOnlineOffline",
+ args,
+ payload.with("respond_on_mousedown", TRUE),
+ boost::bind(&LLAvatarActions::startIM, agent_id));
+ }
+ else
+ {
+ notification =
+ LLNotifications::instance().add("FriendOnlineOffline", args, payload);
+ }
+
+ // If there's an open IM session with this agent, send a notification there too.
+ LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id);
+ std::string notify_msg = notification->getMessage();
+ LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg);
}
void LLAvatarTracker::formFriendship(const LLUUID& id)
{
- if(id.notNull())
- {
- LLRelationship* buddy_info = get_ptr_in_map(instance().mBuddyInfo, id);
- if(!buddy_info)
- {
- LLAvatarTracker& at = LLAvatarTracker::instance();
- //The default for relationship establishment is to have both parties
- //visible online to each other.
- buddy_info = new LLRelationship(LLRelationship::GRANT_ONLINE_STATUS,LLRelationship::GRANT_ONLINE_STATUS, false);
- at.mBuddyInfo[id] = buddy_info;
- at.addChangedMask(LLFriendObserver::ADD, id);
- at.notifyObservers();
- }
- }
+ if(id.notNull())
+ {
+ LLRelationship* buddy_info = get_ptr_in_map(instance().mBuddyInfo, id);
+ if(!buddy_info)
+ {
+ LLAvatarTracker& at = LLAvatarTracker::instance();
+ //The default for relationship establishment is to have both parties
+ //visible online to each other.
+ buddy_info = new LLRelationship(LLRelationship::GRANT_ONLINE_STATUS,LLRelationship::GRANT_ONLINE_STATUS, false);
+ at.mBuddyInfo[id] = buddy_info;
+ at.addChangedMask(LLFriendObserver::ADD, id);
+ at.notifyObservers();
+ }
+ }
}
void LLAvatarTracker::processTerminateFriendship(LLMessageSystem* msg, void**)
{
- LLUUID id;
- msg->getUUID("ExBlock", "OtherID", id);
- if(id.notNull())
- {
- LLAvatarTracker& at = LLAvatarTracker::instance();
- LLRelationship* buddy = get_ptr_in_map(at.mBuddyInfo, id);
- if(!buddy) return;
- at.mBuddyInfo.erase(id);
- at.addChangedMask(LLFriendObserver::REMOVE, id);
- delete buddy;
- at.notifyObservers();
- }
+ LLUUID id;
+ msg->getUUID("ExBlock", "OtherID", id);
+ if(id.notNull())
+ {
+ LLAvatarTracker& at = LLAvatarTracker::instance();
+ LLRelationship* buddy = get_ptr_in_map(at.mBuddyInfo, id);
+ if(!buddy) return;
+ at.mBuddyInfo.erase(id);
+ at.addChangedMask(LLFriendObserver::REMOVE, id);
+ delete buddy;
+ at.notifyObservers();
+ }
}
///----------------------------------------------------------------------------
@@ -803,70 +803,70 @@ void LLAvatarTracker::processTerminateFriendship(LLMessageSystem* msg, void**)
///----------------------------------------------------------------------------
LLTrackingData::LLTrackingData(const LLUUID& avatar_id, const std::string& name)
-: mAvatarID(avatar_id),
- mHaveInfo(false),
- mHaveCoarseInfo(false)
-{
- mCoarseLocationTimer.setTimerExpirySec(COARSE_FREQUENCY);
- mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY);
- mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
- if(!name.empty())
- {
- mName = name;
- }
+: mAvatarID(avatar_id),
+ mHaveInfo(false),
+ mHaveCoarseInfo(false)
+{
+ mCoarseLocationTimer.setTimerExpirySec(COARSE_FREQUENCY);
+ mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY);
+ mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
+ if(!name.empty())
+ {
+ mName = name;
+ }
}
void LLTrackingData::agentFound(const LLUUID& prey,
- const LLVector3d& estimated_global_pos)
+ const LLVector3d& estimated_global_pos)
{
- if(prey != mAvatarID)
- {
- LL_WARNS() << "LLTrackingData::agentFound() - found " << prey
- << " but looking for " << mAvatarID << LL_ENDL;
- }
- mHaveInfo = true;
- mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
- mGlobalPositionEstimate = estimated_global_pos;
+ if(prey != mAvatarID)
+ {
+ LL_WARNS() << "LLTrackingData::agentFound() - found " << prey
+ << " but looking for " << mAvatarID << LL_ENDL;
+ }
+ mHaveInfo = true;
+ mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
+ mGlobalPositionEstimate = estimated_global_pos;
}
bool LLTrackingData::haveTrackingInfo()
{
- LLViewerObject* object = gObjectList.findObject(mAvatarID);
- if(object && !object->isDead())
- {
- mCoarseLocationTimer.checkExpirationAndReset(COARSE_FREQUENCY);
- mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY);
- mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
- mHaveInfo = true;
- return true;
- }
- if(mHaveCoarseInfo &&
- !mCoarseLocationTimer.checkExpirationAndReset(COARSE_FREQUENCY))
- {
- // if we reach here, then we have a 'recent' coarse update
- mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY);
- mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
- return true;
- }
- if(mUpdateTimer.checkExpirationAndReset(FIND_FREQUENCY))
- {
- LLAvatarTracker::instance().findAgent();
- mHaveCoarseInfo = false;
- }
- if(mAgentGone.checkExpirationAndReset(OFFLINE_SECONDS))
- {
- mHaveInfo = false;
- mHaveCoarseInfo = false;
- }
- return mHaveInfo;
+ LLViewerObject* object = gObjectList.findObject(mAvatarID);
+ if(object && !object->isDead())
+ {
+ mCoarseLocationTimer.checkExpirationAndReset(COARSE_FREQUENCY);
+ mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY);
+ mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
+ mHaveInfo = true;
+ return true;
+ }
+ if(mHaveCoarseInfo &&
+ !mCoarseLocationTimer.checkExpirationAndReset(COARSE_FREQUENCY))
+ {
+ // if we reach here, then we have a 'recent' coarse update
+ mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY);
+ mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
+ return true;
+ }
+ if(mUpdateTimer.checkExpirationAndReset(FIND_FREQUENCY))
+ {
+ LLAvatarTracker::instance().findAgent();
+ mHaveCoarseInfo = false;
+ }
+ if(mAgentGone.checkExpirationAndReset(OFFLINE_SECONDS))
+ {
+ mHaveInfo = false;
+ mHaveCoarseInfo = false;
+ }
+ return mHaveInfo;
}
void LLTrackingData::setTrackedCoarseLocation(const LLVector3d& global_pos)
{
- mCoarseLocationTimer.setTimerExpirySec(COARSE_FREQUENCY);
- mGlobalPositionEstimate = global_pos;
- mHaveInfo = true;
- mHaveCoarseInfo = true;
+ mCoarseLocationTimer.setTimerExpirySec(COARSE_FREQUENCY);
+ mGlobalPositionEstimate = global_pos;
+ mHaveInfo = true;
+ mHaveCoarseInfo = true;
}
///----------------------------------------------------------------------------
@@ -875,51 +875,51 @@ void LLTrackingData::setTrackedCoarseLocation(const LLVector3d& global_pos)
bool LLCollectProxyBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy)
{
- if(buddy->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS))
- {
- mProxy.insert(buddy_id);
- }
- return true;
+ if(buddy->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS))
+ {
+ mProxy.insert(buddy_id);
+ }
+ return true;
}
bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy)
{
- LLAvatarName av_name;
- LLAvatarNameCache::get( buddy_id, &av_name);
- buddy_map_t::value_type value(buddy_id, av_name.getDisplayName());
- if(buddy->isOnline() && buddy->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION))
- {
- mMappable.insert(value);
- }
- return true;
+ LLAvatarName av_name;
+ LLAvatarNameCache::get( buddy_id, &av_name);
+ buddy_map_t::value_type value(buddy_id, av_name.getDisplayName());
+ if(buddy->isOnline() && buddy->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION))
+ {
+ mMappable.insert(value);
+ }
+ return true;
}
bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy)
{
- LLAvatarName av_name;
- LLAvatarNameCache::get(buddy_id, &av_name);
- mFullName = av_name.getUserName();
- buddy_map_t::value_type value(buddy_id, mFullName);
- if(buddy->isOnline())
- {
- mOnline.insert(value);
- }
- return true;
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(buddy_id, &av_name);
+ mFullName = av_name.getUserName();
+ buddy_map_t::value_type value(buddy_id, mFullName);
+ if(buddy->isOnline())
+ {
+ mOnline.insert(value);
+ }
+ return true;
}
bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy)
{
- LLAvatarName av_name;
- LLAvatarNameCache::get(buddy_id, &av_name);
- mFullName = av_name.getCompleteName();
- buddy_map_t::value_type value(buddy_id, mFullName);
- if(buddy->isOnline())
- {
- mOnline.insert(value);
- }
- else
- {
- mOffline.insert(value);
- }
- return true;
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(buddy_id, &av_name);
+ mFullName = av_name.getCompleteName();
+ buddy_map_t::value_type value(buddy_id, mFullName);
+ if(buddy->isOnline())
+ {
+ mOnline.insert(value);
+ }
+ else
+ {
+ mOffline.insert(value);
+ }
+ return true;
}
diff --git a/indra/newview/llcallingcard.h b/indra/newview/llcallingcard.h
index 1f819a42fd..07de0ff3ce 100644
--- a/indra/newview/llcallingcard.h
+++ b/indra/newview/llcallingcard.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcallingcard.h
* @brief Definition of the LLPreviewCallingCard class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,28 +43,28 @@ class LLTrackingData;
class LLFriendObserver
{
public:
- // This enumeration is a way to refer to what changed in a more
- // human readable format. You can mask the value provided by
- // changed() to see if the observer is interested in the change.
- enum
- {
- NONE = 0,
- ADD = 1,
- REMOVE = 2,
- ONLINE = 4,
- POWERS = 8,
- ALL = 0xffffffff
- };
- virtual ~LLFriendObserver() {}
- virtual void changed(U32 mask) = 0;
+ // This enumeration is a way to refer to what changed in a more
+ // human readable format. You can mask the value provided by
+ // changed() to see if the observer is interested in the change.
+ enum
+ {
+ NONE = 0,
+ ADD = 1,
+ REMOVE = 2,
+ ONLINE = 4,
+ POWERS = 8,
+ ALL = 0xffffffff
+ };
+ virtual ~LLFriendObserver() {}
+ virtual void changed(U32 mask) = 0;
};
/*
struct LLBuddyInfo
{
- bool mIsOnline;
- bool mIsEmpowered;
- LLBuddyInfo() : mIsOnline(false), mIsEmpowered(false) {}
+ bool mIsOnline;
+ bool mIsEmpowered;
+ LLBuddyInfo() : mIsOnline(false), mIsEmpowered(false) {}
};
*/
@@ -72,185 +72,185 @@ struct LLBuddyInfo
class LLRelationshipFunctor
{
public:
- virtual ~LLRelationshipFunctor() {}
- virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy) = 0;
+ virtual ~LLRelationshipFunctor() {}
+ virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy) = 0;
};
-
+
class LLAvatarTracker
{
public:
- static LLAvatarTracker& instance() { return sInstance; }
-
- void track(const LLUUID& avatar_id, const std::string& name);
- void untrack(const LLUUID& avatar_id);
- bool isTrackedAgentValid() { return mTrackedAgentValid; }
- void setTrackedAgentValid(bool valid) { mTrackedAgentValid = valid; }
- void findAgent();
-
- // coarse update information
- void setTrackedCoarseLocation(const LLVector3d& global_pos);
-
- // dealing with the tracked agent location
- bool haveTrackingInfo();
- void getDegreesAndDist(F32& rot, F64& horiz_dist, F64& vert_dist);
- LLVector3d getGlobalPos();
-
- // Get the name passed in, returns null string if uninitialized.
- const std::string& getName();
-
- // Get the avatar being tracked, returns LLUUID::null if uninitialized
- const LLUUID& getAvatarID();
-
- // Deal with inventory
- //void observe(LLInventoryModel* model);
- //void inventoryChanged();
-
- // add or remove agents from buddy list. Each method takes a set
- // of buddies and returns how many were actually added or removed.
- typedef std::map<LLUUID, LLRelationship*> buddy_map_t;
-
- S32 addBuddyList(const buddy_map_t& buddies);
- //S32 removeBuddyList(const buddy_list_t& exes);
- void copyBuddyList(buddy_map_t& buddies) const;
-
- // deal with termination of friendhsip
- void terminateBuddy(const LLUUID& id);
-
- // get full info
- const LLRelationship* getBuddyInfo(const LLUUID& id) const;
-
- // Is this person a friend/buddy/calling card holder?
- bool isBuddy(const LLUUID& id) const;
-
- // online status
- void setBuddyOnline(const LLUUID& id, bool is_online);
- bool isBuddyOnline(const LLUUID& id) const;
-
- // simple empowered status
- void setBuddyEmpowered(const LLUUID& id, bool is_empowered);
- bool isBuddyEmpowered(const LLUUID& id) const;
-
- // set the empower bit & message the server.
- void empowerList(const buddy_map_t& list, bool grant);
- void empower(const LLUUID& id, bool grant); // wrapper for above
-
- // register callbacks
- void registerCallbacks(LLMessageSystem* msg);
-
- // Add/remove an observer. If the observer is destroyed, be sure
- // to remove it. On destruction of the tracker, it will delete any
- // observers left behind.
- void addObserver(LLFriendObserver* observer);
- void removeObserver(LLFriendObserver* observer);
- void idleNotifyObservers();
- void notifyObservers();
-
- // Observers interested in updates of a particular avatar.
- // On destruction these observers are NOT deleted.
- void addParticularFriendObserver(const LLUUID& buddy_id, LLFriendObserver* observer);
- void removeParticularFriendObserver(const LLUUID& buddy_id, LLFriendObserver* observer);
- void notifyParticularFriendObservers(const LLUUID& buddy_id);
-
- /**
- * Stores flag for change and id of object change applies to
- *
- * This allows outsiders to tell the AvatarTracker if something has
- * been changed 'under the hood',
- * and next notification will have exact avatar IDs have been changed.
- */
- void addChangedMask(U32 mask, const LLUUID& referent);
-
- const std::set<LLUUID>& getChangedIDs() { return mChangedBuddyIDs; }
-
- // Apply the functor to every buddy. Do not actually modify the
- // buddy list in the functor or bad things will happen.
- void applyFunctor(LLRelationshipFunctor& f);
-
- static void formFriendship(const LLUUID& friend_id);
+ static LLAvatarTracker& instance() { return sInstance; }
+
+ void track(const LLUUID& avatar_id, const std::string& name);
+ void untrack(const LLUUID& avatar_id);
+ bool isTrackedAgentValid() { return mTrackedAgentValid; }
+ void setTrackedAgentValid(bool valid) { mTrackedAgentValid = valid; }
+ void findAgent();
+
+ // coarse update information
+ void setTrackedCoarseLocation(const LLVector3d& global_pos);
+
+ // dealing with the tracked agent location
+ bool haveTrackingInfo();
+ void getDegreesAndDist(F32& rot, F64& horiz_dist, F64& vert_dist);
+ LLVector3d getGlobalPos();
+
+ // Get the name passed in, returns null string if uninitialized.
+ const std::string& getName();
+
+ // Get the avatar being tracked, returns LLUUID::null if uninitialized
+ const LLUUID& getAvatarID();
+
+ // Deal with inventory
+ //void observe(LLInventoryModel* model);
+ //void inventoryChanged();
+
+ // add or remove agents from buddy list. Each method takes a set
+ // of buddies and returns how many were actually added or removed.
+ typedef std::map<LLUUID, LLRelationship*> buddy_map_t;
+
+ S32 addBuddyList(const buddy_map_t& buddies);
+ //S32 removeBuddyList(const buddy_list_t& exes);
+ void copyBuddyList(buddy_map_t& buddies) const;
+
+ // deal with termination of friendhsip
+ void terminateBuddy(const LLUUID& id);
+
+ // get full info
+ const LLRelationship* getBuddyInfo(const LLUUID& id) const;
+
+ // Is this person a friend/buddy/calling card holder?
+ bool isBuddy(const LLUUID& id) const;
+
+ // online status
+ void setBuddyOnline(const LLUUID& id, bool is_online);
+ bool isBuddyOnline(const LLUUID& id) const;
+
+ // simple empowered status
+ void setBuddyEmpowered(const LLUUID& id, bool is_empowered);
+ bool isBuddyEmpowered(const LLUUID& id) const;
+
+ // set the empower bit & message the server.
+ void empowerList(const buddy_map_t& list, bool grant);
+ void empower(const LLUUID& id, bool grant); // wrapper for above
+
+ // register callbacks
+ void registerCallbacks(LLMessageSystem* msg);
+
+ // Add/remove an observer. If the observer is destroyed, be sure
+ // to remove it. On destruction of the tracker, it will delete any
+ // observers left behind.
+ void addObserver(LLFriendObserver* observer);
+ void removeObserver(LLFriendObserver* observer);
+ void idleNotifyObservers();
+ void notifyObservers();
+
+ // Observers interested in updates of a particular avatar.
+ // On destruction these observers are NOT deleted.
+ void addParticularFriendObserver(const LLUUID& buddy_id, LLFriendObserver* observer);
+ void removeParticularFriendObserver(const LLUUID& buddy_id, LLFriendObserver* observer);
+ void notifyParticularFriendObservers(const LLUUID& buddy_id);
+
+ /**
+ * Stores flag for change and id of object change applies to
+ *
+ * This allows outsiders to tell the AvatarTracker if something has
+ * been changed 'under the hood',
+ * and next notification will have exact avatar IDs have been changed.
+ */
+ void addChangedMask(U32 mask, const LLUUID& referent);
+
+ const std::set<LLUUID>& getChangedIDs() { return mChangedBuddyIDs; }
+
+ // Apply the functor to every buddy. Do not actually modify the
+ // buddy list in the functor or bad things will happen.
+ void applyFunctor(LLRelationshipFunctor& f);
+
+ static void formFriendship(const LLUUID& friend_id);
protected:
- void deleteTrackingData();
- void agentFound(const LLUUID& prey,
- const LLVector3d& estimated_global_pos);
+ void deleteTrackingData();
+ void agentFound(const LLUUID& prey,
+ const LLVector3d& estimated_global_pos);
- // Message system functionality
- static void processAgentFound(LLMessageSystem* msg, void**);
- static void processOnlineNotification(LLMessageSystem* msg, void**);
- static void processOfflineNotification(LLMessageSystem* msg, void**);
- //static void processGrantedProxies(LLMessageSystem* msg, void**);
- static void processTerminateFriendship(LLMessageSystem* msg, void**);
- static void processChangeUserRights(LLMessageSystem* msg, void**);
+ // Message system functionality
+ static void processAgentFound(LLMessageSystem* msg, void**);
+ static void processOnlineNotification(LLMessageSystem* msg, void**);
+ static void processOfflineNotification(LLMessageSystem* msg, void**);
+ //static void processGrantedProxies(LLMessageSystem* msg, void**);
+ static void processTerminateFriendship(LLMessageSystem* msg, void**);
+ static void processChangeUserRights(LLMessageSystem* msg, void**);
- void processNotify(LLMessageSystem* msg, bool online);
- void processChange(LLMessageSystem* msg);
+ void processNotify(LLMessageSystem* msg, bool online);
+ void processChange(LLMessageSystem* msg);
protected:
- static LLAvatarTracker sInstance;
- LLTrackingData* mTrackingData;
- bool mTrackedAgentValid;
- U32 mModifyMask;
- //LLInventoryModel* mInventory;
- //LLInventoryObserver* mInventoryObserver;
+ static LLAvatarTracker sInstance;
+ LLTrackingData* mTrackingData;
+ bool mTrackedAgentValid;
+ U32 mModifyMask;
+ //LLInventoryModel* mInventory;
+ //LLInventoryObserver* mInventoryObserver;
- buddy_map_t mBuddyInfo;
+ buddy_map_t mBuddyInfo;
- typedef std::set<LLUUID> changed_buddy_t;
- changed_buddy_t mChangedBuddyIDs;
+ typedef std::set<LLUUID> changed_buddy_t;
+ changed_buddy_t mChangedBuddyIDs;
- typedef std::vector<LLFriendObserver*> observer_list_t;
- observer_list_t mObservers;
+ typedef std::vector<LLFriendObserver*> observer_list_t;
+ observer_list_t mObservers;
typedef std::set<LLFriendObserver*> observer_set_t;
typedef std::map<LLUUID, observer_set_t> observer_map_t;
observer_map_t mParticularFriendObserverMap;
private:
- // do not implement
- LLAvatarTracker(const LLAvatarTracker&);
- bool operator==(const LLAvatarTracker&);
+ // do not implement
+ LLAvatarTracker(const LLAvatarTracker&);
+ bool operator==(const LLAvatarTracker&);
- BOOL mIsNotifyObservers;
+ BOOL mIsNotifyObservers;
public:
- // don't you dare create or delete this object
- LLAvatarTracker();
- ~LLAvatarTracker();
+ // don't you dare create or delete this object
+ LLAvatarTracker();
+ ~LLAvatarTracker();
};
// collect set of LLUUIDs we're a proxy for
class LLCollectProxyBuddies : public LLRelationshipFunctor
{
public:
- LLCollectProxyBuddies() {}
- virtual ~LLCollectProxyBuddies() {}
- virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
- typedef std::set<LLUUID> buddy_list_t;
- buddy_list_t mProxy;
+ LLCollectProxyBuddies() {}
+ virtual ~LLCollectProxyBuddies() {}
+ virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
+ typedef std::set<LLUUID> buddy_list_t;
+ buddy_list_t mProxy;
};
// collect dictionary sorted map of name -> agent_id for every online buddy
class LLCollectMappableBuddies : public LLRelationshipFunctor
{
public:
- LLCollectMappableBuddies() {}
- virtual ~LLCollectMappableBuddies() {}
- virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
- typedef std::map<LLUUID, std::string> buddy_map_t;
- buddy_map_t mMappable;
- std::string mFullName;
+ LLCollectMappableBuddies() {}
+ virtual ~LLCollectMappableBuddies() {}
+ virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
+ typedef std::map<LLUUID, std::string> buddy_map_t;
+ buddy_map_t mMappable;
+ std::string mFullName;
};
// collect dictionary sorted map of name -> agent_id for every online buddy
class LLCollectOnlineBuddies : public LLRelationshipFunctor
{
public:
- LLCollectOnlineBuddies() {}
- virtual ~LLCollectOnlineBuddies() {}
- virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
- typedef std::map<LLUUID, std::string> buddy_map_t;
- buddy_map_t mOnline;
- std::string mFullName;
+ LLCollectOnlineBuddies() {}
+ virtual ~LLCollectOnlineBuddies() {}
+ virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
+ typedef std::map<LLUUID, std::string> buddy_map_t;
+ buddy_map_t mOnline;
+ std::string mFullName;
};
// collect dictionary sorted map of name -> agent_id for every buddy,
@@ -258,13 +258,13 @@ public:
class LLCollectAllBuddies : public LLRelationshipFunctor
{
public:
- LLCollectAllBuddies() {}
- virtual ~LLCollectAllBuddies() {}
- virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
- typedef std::map<LLUUID, std::string> buddy_map_t;
- buddy_map_t mOnline;
- buddy_map_t mOffline;
- std::string mFullName;
+ LLCollectAllBuddies() {}
+ virtual ~LLCollectAllBuddies() {}
+ virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
+ typedef std::map<LLUUID, std::string> buddy_map_t;
+ buddy_map_t mOnline;
+ buddy_map_t mOffline;
+ std::string mFullName;
};
#endif // LL_LLCALLINGCARD_H
diff --git a/indra/newview/llcapabilityprovider.h b/indra/newview/llcapabilityprovider.h
index 9d91245597..484bd2ef04 100644
--- a/indra/newview/llcapabilityprovider.h
+++ b/indra/newview/llcapabilityprovider.h
@@ -4,25 +4,25 @@
* @date 2009-01-07
* @brief Interface by which to reference (e.g.) LLViewerRegion to obtain a
* capability.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp
index 9e7a8ba95c..1b2581a03c 100644
--- a/indra/newview/llchannelmanager.cpp
+++ b/indra/newview/llchannelmanager.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchannelmanager.cpp
* @brief This class rules screen notification channels.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,21 +45,21 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLChannelManager::LLChannelManager()
{
- LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLChannelManager::onLoginCompleted, this));
- mChannelList.clear();
- mStartUpChannel = NULL;
-
- if(!gViewerWindow)
- {
- LL_ERRS() << "LLChannelManager::LLChannelManager() - viwer window is not initialized yet" << LL_ENDL;
- }
-
- // We don't actually need this instance right now, but our
- // cleanupSingleton() method deletes LLScreenChannels, which need to
- // unregister from LLUI. Calling LLUI::instance() here establishes the
- // dependency so LLSingletonBase::deleteAll() calls our deleteSingleton()
- // before LLUI::deleteSingleton().
- LLUI::instance();
+ LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLChannelManager::onLoginCompleted, this));
+ mChannelList.clear();
+ mStartUpChannel = NULL;
+
+ if(!gViewerWindow)
+ {
+ LL_ERRS() << "LLChannelManager::LLChannelManager() - viwer window is not initialized yet" << LL_ENDL;
+ }
+
+ // We don't actually need this instance right now, but our
+ // cleanupSingleton() method deletes LLScreenChannels, which need to
+ // unregister from LLUI. Calling LLUI::instance() here establishes the
+ // dependency so LLSingletonBase::deleteAll() calls our deleteSingleton()
+ // before LLUI::deleteSingleton().
+ LLUI::instance();
}
//--------------------------------------------------------------------------
@@ -86,186 +86,186 @@ void LLChannelManager::cleanupSingleton()
//--------------------------------------------------------------------------
LLScreenChannel* LLChannelManager::createNotificationChannel()
{
- // creating params for a channel
- LLScreenChannelBase::Params p;
- p.id = LLUUID(gSavedSettings.getString("NotificationChannelUUID"));
- p.channel_align = CA_RIGHT;
- p.toast_align = NA_TOP;
-
- // Getting a Channel for our notifications
- return dynamic_cast<LLScreenChannel*> (LLChannelManager::getInstance()->getChannel(p));
+ // creating params for a channel
+ LLScreenChannelBase::Params p;
+ p.id = LLUUID(gSavedSettings.getString("NotificationChannelUUID"));
+ p.channel_align = CA_RIGHT;
+ p.toast_align = NA_TOP;
+
+ // Getting a Channel for our notifications
+ return dynamic_cast<LLScreenChannel*> (LLChannelManager::getInstance()->getChannel(p));
}
//--------------------------------------------------------------------------
void LLChannelManager::onLoginCompleted()
{
- S32 away_notifications = 0;
-
- // calc a number of all offline notifications
- for(std::vector<ChannelElem>::iterator it = mChannelList.begin(); it != mChannelList.end(); ++it)
- {
- LLScreenChannelBase* channel = it->channel.get();
- if (!channel) continue;
-
- // don't calc notifications for Nearby Chat
- if(channel->getChannelID() == LLUUID(gSavedSettings.getString("NearByChatChannelUUID")))
- {
- continue;
- }
-
- // don't calc notifications for channels that always show their notifications
- if(!channel->getDisplayToastsAlways())
- {
- away_notifications +=channel->getNumberOfHiddenToasts();
- }
- }
-
- away_notifications += gIMMgr->getNumberOfUnreadIM();
-
- if(!away_notifications)
- {
- onStartUpToastClose();
- }
- else
- {
- // create a channel for the StartUp Toast
- LLScreenChannelBase::Params p;
- p.id = LLUUID(gSavedSettings.getString("StartUpChannelUUID"));
- p.channel_align = CA_RIGHT;
- mStartUpChannel = createChannel(p);
-
- if(!mStartUpChannel)
- {
- onStartUpToastClose();
- }
- else
- {
- gViewerWindow->getRootView()->addChild(mStartUpChannel);
-
- // init channel's position and size
- S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
- S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
- mStartUpChannel->init(channel_right_bound - channel_width, channel_right_bound);
- mStartUpChannel->setMouseDownCallback(boost::bind(&LLFloaterNotificationsTabbed::onStartUpToastClick, LLFloaterNotificationsTabbed::getInstance(), _2, _3, _4));
-
- mStartUpChannel->setCommitCallback(boost::bind(&LLChannelManager::onStartUpToastClose, this));
- mStartUpChannel->createStartUpToast(away_notifications, gSavedSettings.getS32("StartUpToastLifeTime"));
- }
- }
-
- LLPersistentNotificationStorage::getInstance()->loadNotifications();
- LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications();
+ S32 away_notifications = 0;
+
+ // calc a number of all offline notifications
+ for(std::vector<ChannelElem>::iterator it = mChannelList.begin(); it != mChannelList.end(); ++it)
+ {
+ LLScreenChannelBase* channel = it->channel.get();
+ if (!channel) continue;
+
+ // don't calc notifications for Nearby Chat
+ if(channel->getChannelID() == LLUUID(gSavedSettings.getString("NearByChatChannelUUID")))
+ {
+ continue;
+ }
+
+ // don't calc notifications for channels that always show their notifications
+ if(!channel->getDisplayToastsAlways())
+ {
+ away_notifications +=channel->getNumberOfHiddenToasts();
+ }
+ }
+
+ away_notifications += gIMMgr->getNumberOfUnreadIM();
+
+ if(!away_notifications)
+ {
+ onStartUpToastClose();
+ }
+ else
+ {
+ // create a channel for the StartUp Toast
+ LLScreenChannelBase::Params p;
+ p.id = LLUUID(gSavedSettings.getString("StartUpChannelUUID"));
+ p.channel_align = CA_RIGHT;
+ mStartUpChannel = createChannel(p);
+
+ if(!mStartUpChannel)
+ {
+ onStartUpToastClose();
+ }
+ else
+ {
+ gViewerWindow->getRootView()->addChild(mStartUpChannel);
+
+ // init channel's position and size
+ S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
+ S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
+ mStartUpChannel->init(channel_right_bound - channel_width, channel_right_bound);
+ mStartUpChannel->setMouseDownCallback(boost::bind(&LLFloaterNotificationsTabbed::onStartUpToastClick, LLFloaterNotificationsTabbed::getInstance(), _2, _3, _4));
+
+ mStartUpChannel->setCommitCallback(boost::bind(&LLChannelManager::onStartUpToastClose, this));
+ mStartUpChannel->createStartUpToast(away_notifications, gSavedSettings.getS32("StartUpToastLifeTime"));
+ }
+ }
+
+ LLPersistentNotificationStorage::getInstance()->loadNotifications();
+ LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications();
}
//--------------------------------------------------------------------------
void LLChannelManager::onStartUpToastClose()
{
- if(mStartUpChannel)
- {
- mStartUpChannel->setVisible(FALSE);
- mStartUpChannel->closeStartUpToast();
- removeChannelByID(LLUUID(gSavedSettings.getString("StartUpChannelUUID")));
- mStartUpChannel = NULL;
- }
-
- // set StartUp Toast Flag to allow all other channels to show incoming toasts
- LLScreenChannel::setStartUpToastShown();
+ if(mStartUpChannel)
+ {
+ mStartUpChannel->setVisible(FALSE);
+ mStartUpChannel->closeStartUpToast();
+ removeChannelByID(LLUUID(gSavedSettings.getString("StartUpChannelUUID")));
+ mStartUpChannel = NULL;
+ }
+
+ // set StartUp Toast Flag to allow all other channels to show incoming toasts
+ LLScreenChannel::setStartUpToastShown();
}
//--------------------------------------------------------------------------
-LLScreenChannelBase* LLChannelManager::addChannel(LLScreenChannelBase* channel)
+LLScreenChannelBase* LLChannelManager::addChannel(LLScreenChannelBase* channel)
{
- if(!channel)
- return 0;
+ if(!channel)
+ return 0;
- ChannelElem new_elem;
- new_elem.id = channel->getChannelID();
- new_elem.channel = channel->getHandle();
+ ChannelElem new_elem;
+ new_elem.id = channel->getChannelID();
+ new_elem.channel = channel->getHandle();
- mChannelList.push_back(new_elem);
+ mChannelList.push_back(new_elem);
- return channel;
+ return channel;
}
LLScreenChannel* LLChannelManager::createChannel(LLScreenChannelBase::Params& p)
{
- LLScreenChannel* new_channel = new LLScreenChannel(p);
+ LLScreenChannel* new_channel = new LLScreenChannel(p);
- addChannel(new_channel);
- return new_channel;
+ addChannel(new_channel);
+ return new_channel;
}
LLScreenChannelBase* LLChannelManager::getChannel(LLScreenChannelBase::Params& p)
{
- LLScreenChannelBase* new_channel = findChannelByID(p.id);
+ LLScreenChannelBase* new_channel = findChannelByID(p.id);
- if(new_channel)
- return new_channel;
+ if(new_channel)
+ return new_channel;
- return createChannel(p);
+ return createChannel(p);
}
//--------------------------------------------------------------------------
LLScreenChannelBase* LLChannelManager::findChannelByID(const LLUUID& id)
{
- std::vector<ChannelElem>::iterator it = find(mChannelList.begin(), mChannelList.end(), id);
- if(it != mChannelList.end())
- {
- return (*it).channel.get();
- }
+ std::vector<ChannelElem>::iterator it = find(mChannelList.begin(), mChannelList.end(), id);
+ if(it != mChannelList.end())
+ {
+ return (*it).channel.get();
+ }
- return NULL;
+ return NULL;
}
//--------------------------------------------------------------------------
void LLChannelManager::removeChannelByID(const LLUUID& id)
{
- std::vector<ChannelElem>::iterator it = find(mChannelList.begin(), mChannelList.end(), id);
- if(it != mChannelList.end())
- {
- mChannelList.erase(it);
- }
+ std::vector<ChannelElem>::iterator it = find(mChannelList.begin(), mChannelList.end(), id);
+ if(it != mChannelList.end())
+ {
+ mChannelList.erase(it);
+ }
}
//--------------------------------------------------------------------------
void LLChannelManager::muteAllChannels(bool mute)
{
- for (std::vector<ChannelElem>::iterator it = mChannelList.begin();
- it != mChannelList.end(); it++)
- {
- if (it->channel.get())
- {
- it->channel.get()->setShowToasts(!mute);
- }
- }
+ for (std::vector<ChannelElem>::iterator it = mChannelList.begin();
+ it != mChannelList.end(); it++)
+ {
+ if (it->channel.get())
+ {
+ it->channel.get()->setShowToasts(!mute);
+ }
+ }
}
void LLChannelManager::killToastsFromChannel(const LLUUID& channel_id, const LLScreenChannel::Matcher& matcher)
{
- LLScreenChannel
- * screen_channel =
- dynamic_cast<LLScreenChannel*> (findChannelByID(channel_id));
- if (screen_channel != NULL)
- {
- screen_channel->killMatchedToasts(matcher);
- }
+ LLScreenChannel
+ * screen_channel =
+ dynamic_cast<LLScreenChannel*> (findChannelByID(channel_id));
+ if (screen_channel != NULL)
+ {
+ screen_channel->killMatchedToasts(matcher);
+ }
}
// static
LLNotificationsUI::LLScreenChannel* LLChannelManager::getNotificationScreenChannel()
{
- LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
- (LLNotificationsUI::LLChannelManager::getInstance()->
- findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
+ LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
+ (LLNotificationsUI::LLChannelManager::getInstance()->
+ findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
- if (channel == NULL)
- {
- LL_WARNS() << "Can't find screen channel by NotificationChannelUUID" << LL_ENDL;
- llassert(!"Can't find screen channel by NotificationChannelUUID");
- }
+ if (channel == NULL)
+ {
+ LL_WARNS() << "Can't find screen channel by NotificationChannelUUID" << LL_ENDL;
+ llassert(!"Can't find screen channel by NotificationChannelUUID");
+ }
- return channel;
+ return channel;
}
diff --git a/indra/newview/llchannelmanager.h b/indra/newview/llchannelmanager.h
index 22ae595d66..7a4899f1f3 100644
--- a/indra/newview/llchannelmanager.h
+++ b/indra/newview/llchannelmanager.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchannelmanager.h
* @brief This class rules screen notification channels.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,75 +43,75 @@ namespace LLNotificationsUI
*/
class LLChannelManager : public LLSingleton<LLChannelManager>
{
- LLSINGLETON(LLChannelManager);
- virtual ~LLChannelManager();
+ LLSINGLETON(LLChannelManager);
+ virtual ~LLChannelManager();
- void cleanupSingleton() override;
+ void cleanupSingleton() override;
public:
- struct ChannelElem
- {
- LLUUID id;
- LLHandle<LLScreenChannelBase> channel;
+ struct ChannelElem
+ {
+ LLUUID id;
+ LLHandle<LLScreenChannelBase> channel;
- ChannelElem() { }
+ ChannelElem() { }
- ChannelElem(const ChannelElem &elem)
- {
- id = elem.id;
- channel = elem.channel;
- }
+ ChannelElem(const ChannelElem &elem)
+ {
+ id = elem.id;
+ channel = elem.channel;
+ }
- bool operator == (const LLUUID &id_op) const
- {
- return (id == id_op);
- }
- };
+ bool operator == (const LLUUID &id_op) const
+ {
+ return (id == id_op);
+ }
+ };
- // On LoginCompleted - show StartUp toast
- void onLoginCompleted();
- // removes a channel intended for the startup toast and allows other channels to show their toasts
- void onStartUpToastClose();
+ // On LoginCompleted - show StartUp toast
+ void onLoginCompleted();
+ // removes a channel intended for the startup toast and allows other channels to show their toasts
+ void onStartUpToastClose();
- // creates a new ScreenChannel according to the given parameters or returns existing if present
- LLScreenChannelBase* getChannel(LLScreenChannelBase::Params& p);
+ // creates a new ScreenChannel according to the given parameters or returns existing if present
+ LLScreenChannelBase* getChannel(LLScreenChannelBase::Params& p);
- LLScreenChannelBase* addChannel(LLScreenChannelBase* channel);
+ LLScreenChannelBase* addChannel(LLScreenChannelBase* channel);
- // returns a channel by its ID
- LLScreenChannelBase* findChannelByID(const LLUUID& id);
+ // returns a channel by its ID
+ LLScreenChannelBase* findChannelByID(const LLUUID& id);
- // creator of the Notification channel, that is used in more than one handler
- LLScreenChannel* createNotificationChannel();
+ // creator of the Notification channel, that is used in more than one handler
+ LLScreenChannel* createNotificationChannel();
- // remove channel methods
- void removeChannelByID(const LLUUID& id);
+ // remove channel methods
+ void removeChannelByID(const LLUUID& id);
- /**
- * Manages toasts showing for all channels.
- *
- * @param mute Flag to disable/enable toasts showing.
- */
- void muteAllChannels(bool mute);
+ /**
+ * Manages toasts showing for all channels.
+ *
+ * @param mute Flag to disable/enable toasts showing.
+ */
+ void muteAllChannels(bool mute);
- /**
- * Kills matched toasts from specified toast screen channel.
- */
- void killToastsFromChannel(const LLUUID& channel_id, const LLScreenChannel::Matcher& matcher);
+ /**
+ * Kills matched toasts from specified toast screen channel.
+ */
+ void killToastsFromChannel(const LLUUID& channel_id, const LLScreenChannel::Matcher& matcher);
- /**
- * Returns notification screen channel.
- */
- static LLNotificationsUI::LLScreenChannel* getNotificationScreenChannel();
+ /**
+ * Returns notification screen channel.
+ */
+ static LLNotificationsUI::LLScreenChannel* getNotificationScreenChannel();
- std::vector<ChannelElem>& getChannelList() { return mChannelList;}
+ std::vector<ChannelElem>& getChannelList() { return mChannelList;}
private:
- LLScreenChannel* createChannel(LLScreenChannelBase::Params& p);
+ LLScreenChannel* createChannel(LLScreenChannelBase::Params& p);
- LLScreenChannel* mStartUpChannel;
- std::vector<ChannelElem> mChannelList;
+ LLScreenChannel* mStartUpChannel;
+ std::vector<ChannelElem> mChannelList;
};
}
diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp
index 72f667a0b8..705552a5c1 100644
--- a/indra/newview/llchatbar.cpp
+++ b/indra/newview/llchatbar.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchatbar.cpp
* @brief LLChatBar class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,7 +39,7 @@
#include "llagent.h"
#include "llbutton.h"
#include "llcombobox.h"
-#include "llcommandhandler.h" // secondlife:///app/chat/ support
+#include "llcommandhandler.h" // secondlife:///app/chat/ support
#include "llviewercontrol.h"
#include "llgesturemgr.h"
#include "llkeyboard.h"
@@ -47,8 +47,8 @@
#include "llstatusbar.h"
#include "lltextbox.h"
#include "lluiconstants.h"
-#include "llviewergesture.h" // for triggering gestures
-#include "llviewermenu.h" // for deleting object with DEL key
+#include "llviewergesture.h" // for triggering gestures
+#include "llviewermenu.h" // for deleting object with DEL key
#include "llviewerstats.h"
#include "llviewerwindow.h"
#include "llframetimer.h"
@@ -63,18 +63,18 @@
//
// Globals
//
-const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds
+const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds
LLChatBar *gChatBar = NULL;
class LLChatBarGestureObserver : public LLGestureManagerObserver
{
public:
- LLChatBarGestureObserver(LLChatBar* chat_barp) : mChatBar(chat_barp){}
- virtual ~LLChatBarGestureObserver() {}
- virtual void changed() { mChatBar->refreshGestures(); }
+ LLChatBarGestureObserver(LLChatBar* chat_barp) : mChatBar(chat_barp){}
+ virtual ~LLChatBarGestureObserver() {}
+ virtual void changed() { mChatBar->refreshGestures(); }
private:
- LLChatBar* mChatBar;
+ LLChatBar* mChatBar;
};
@@ -84,52 +84,52 @@ extern void send_chat_from_viewer(const std::string& utf8_out_text, EChatType ty
// Functions
//
-LLChatBar::LLChatBar()
-: LLPanel(),
- mInputEditor(NULL),
- mGestureLabelTimer(),
- mLastSpecialChatChannel(0),
- mIsBuilt(FALSE),
- mGestureCombo(NULL),
- mObserver(NULL)
+LLChatBar::LLChatBar()
+: LLPanel(),
+ mInputEditor(NULL),
+ mGestureLabelTimer(),
+ mLastSpecialChatChannel(0),
+ mIsBuilt(FALSE),
+ mGestureCombo(NULL),
+ mObserver(NULL)
{
- //setIsChrome(TRUE);
+ //setIsChrome(TRUE);
}
LLChatBar::~LLChatBar()
{
- LLGestureMgr::instance().removeObserver(mObserver);
- delete mObserver;
- mObserver = NULL;
- // LLView destructor cleans up children
+ LLGestureMgr::instance().removeObserver(mObserver);
+ delete mObserver;
+ mObserver = NULL;
+ // LLView destructor cleans up children
}
BOOL LLChatBar::postBuild()
{
- getChild<LLUICtrl>("Say")->setCommitCallback(boost::bind(&LLChatBar::onClickSay, this, _1));
+ getChild<LLUICtrl>("Say")->setCommitCallback(boost::bind(&LLChatBar::onClickSay, this, _1));
- // * NOTE: mantipov: getChild with default parameters returns dummy widget.
- // Seems this class will be completle removed
- // attempt to bind to an existing combo box named gesture
- setGestureCombo(findChild<LLComboBox>( "Gesture"));
+ // * NOTE: mantipov: getChild with default parameters returns dummy widget.
+ // Seems this class will be completle removed
+ // attempt to bind to an existing combo box named gesture
+ setGestureCombo(findChild<LLComboBox>( "Gesture"));
- mInputEditor = getChild<LLLineEditor>("Chat Editor");
- mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke, this);
- mInputEditor->setFocusLostCallback(boost::bind(&LLChatBar::onInputEditorFocusLost));
- mInputEditor->setFocusReceivedCallback(boost::bind(&LLChatBar::onInputEditorGainFocus));
- mInputEditor->setCommitOnFocusLost( FALSE );
- mInputEditor->setRevertOnEsc( FALSE );
- mInputEditor->setIgnoreTab(TRUE);
- mInputEditor->setPassDelete(TRUE);
- mInputEditor->setReplaceNewlinesWithSpaces(FALSE);
+ mInputEditor = getChild<LLLineEditor>("Chat Editor");
+ mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke, this);
+ mInputEditor->setFocusLostCallback(boost::bind(&LLChatBar::onInputEditorFocusLost));
+ mInputEditor->setFocusReceivedCallback(boost::bind(&LLChatBar::onInputEditorGainFocus));
+ mInputEditor->setCommitOnFocusLost( FALSE );
+ mInputEditor->setRevertOnEsc( FALSE );
+ mInputEditor->setIgnoreTab(TRUE);
+ mInputEditor->setPassDelete(TRUE);
+ mInputEditor->setReplaceNewlinesWithSpaces(FALSE);
- mInputEditor->setMaxTextLength(DB_CHAT_MSG_STR_LEN);
- mInputEditor->setEnableLineHistory(TRUE);
+ mInputEditor->setMaxTextLength(DB_CHAT_MSG_STR_LEN);
+ mInputEditor->setEnableLineHistory(TRUE);
- mIsBuilt = TRUE;
+ mIsBuilt = TRUE;
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------
@@ -139,159 +139,159 @@ BOOL LLChatBar::postBuild()
// virtual
BOOL LLChatBar::handleKeyHere( KEY key, MASK mask )
{
- BOOL handled = FALSE;
-
- if( KEY_RETURN == key )
- {
- if (mask == MASK_CONTROL)
- {
- // shout
- sendChat(CHAT_TYPE_SHOUT);
- handled = TRUE;
- }
- else if (mask == MASK_NONE)
- {
- // say
- sendChat( CHAT_TYPE_NORMAL );
- handled = TRUE;
- }
- }
- // only do this in main chatbar
- else if ( KEY_ESCAPE == key && gChatBar == this)
- {
- stopChat();
-
- handled = TRUE;
- }
-
- return handled;
+ BOOL handled = FALSE;
+
+ if( KEY_RETURN == key )
+ {
+ if (mask == MASK_CONTROL)
+ {
+ // shout
+ sendChat(CHAT_TYPE_SHOUT);
+ handled = TRUE;
+ }
+ else if (mask == MASK_NONE)
+ {
+ // say
+ sendChat( CHAT_TYPE_NORMAL );
+ handled = TRUE;
+ }
+ }
+ // only do this in main chatbar
+ else if ( KEY_ESCAPE == key && gChatBar == this)
+ {
+ stopChat();
+
+ handled = TRUE;
+ }
+
+ return handled;
}
void LLChatBar::refresh()
{
- // HACK: Leave the name of the gesture in place for a few seconds.
- const F32 SHOW_GESTURE_NAME_TIME = 2.f;
- if (mGestureLabelTimer.getStarted() && mGestureLabelTimer.getElapsedTimeF32() > SHOW_GESTURE_NAME_TIME)
- {
- LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL;
- if (gestures) gestures->selectFirstItem();
- mGestureLabelTimer.stop();
- }
-
- if ((gAgent.getTypingTime() > AGENT_TYPING_TIMEOUT) && (gAgent.getRenderState() & AGENT_STATE_TYPING))
- {
- gAgent.stopTyping();
- }
-
- getChildView("Say")->setEnabled(mInputEditor->getText().size() > 0);
+ // HACK: Leave the name of the gesture in place for a few seconds.
+ const F32 SHOW_GESTURE_NAME_TIME = 2.f;
+ if (mGestureLabelTimer.getStarted() && mGestureLabelTimer.getElapsedTimeF32() > SHOW_GESTURE_NAME_TIME)
+ {
+ LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL;
+ if (gestures) gestures->selectFirstItem();
+ mGestureLabelTimer.stop();
+ }
+
+ if ((gAgent.getTypingTime() > AGENT_TYPING_TIMEOUT) && (gAgent.getRenderState() & AGENT_STATE_TYPING))
+ {
+ gAgent.stopTyping();
+ }
+
+ getChildView("Say")->setEnabled(mInputEditor->getText().size() > 0);
}
void LLChatBar::refreshGestures()
{
- if (mGestureCombo)
- {
- //store current selection so we can maintain it
- std::string cur_gesture = mGestureCombo->getValue().asString();
- mGestureCombo->selectFirstItem();
- std::string label = mGestureCombo->getValue().asString();;
- // clear
- mGestureCombo->clearRows();
-
- // collect list of unique gestures
- std::map <std::string, BOOL> unique;
- LLGestureMgr::item_map_t::const_iterator it;
- const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
- for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
- {
- LLMultiGesture* gesture = (*it).second;
- if (gesture)
- {
- if (!gesture->mTrigger.empty())
- {
- unique[gesture->mTrigger] = TRUE;
- }
- }
- }
-
- // add unique gestures
- std::map <std::string, BOOL>::iterator it2;
- for (it2 = unique.begin(); it2 != unique.end(); ++it2)
- {
- mGestureCombo->addSimpleElement((*it2).first);
- }
-
- mGestureCombo->sortByName();
- // Insert label after sorting, at top, with separator below it
- mGestureCombo->addSeparator(ADD_TOP);
- mGestureCombo->addSimpleElement(getString("gesture_label"), ADD_TOP);
-
- if (!cur_gesture.empty())
- {
- mGestureCombo->selectByValue(LLSD(cur_gesture));
- }
- else
- {
- mGestureCombo->selectFirstItem();
- }
- }
+ if (mGestureCombo)
+ {
+ //store current selection so we can maintain it
+ std::string cur_gesture = mGestureCombo->getValue().asString();
+ mGestureCombo->selectFirstItem();
+ std::string label = mGestureCombo->getValue().asString();;
+ // clear
+ mGestureCombo->clearRows();
+
+ // collect list of unique gestures
+ std::map <std::string, BOOL> unique;
+ LLGestureMgr::item_map_t::const_iterator it;
+ const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
+ for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
+ {
+ LLMultiGesture* gesture = (*it).second;
+ if (gesture)
+ {
+ if (!gesture->mTrigger.empty())
+ {
+ unique[gesture->mTrigger] = TRUE;
+ }
+ }
+ }
+
+ // add unique gestures
+ std::map <std::string, BOOL>::iterator it2;
+ for (it2 = unique.begin(); it2 != unique.end(); ++it2)
+ {
+ mGestureCombo->addSimpleElement((*it2).first);
+ }
+
+ mGestureCombo->sortByName();
+ // Insert label after sorting, at top, with separator below it
+ mGestureCombo->addSeparator(ADD_TOP);
+ mGestureCombo->addSimpleElement(getString("gesture_label"), ADD_TOP);
+
+ if (!cur_gesture.empty())
+ {
+ mGestureCombo->selectByValue(LLSD(cur_gesture));
+ }
+ else
+ {
+ mGestureCombo->selectFirstItem();
+ }
+ }
}
// Move the cursor to the correct input field.
void LLChatBar::setKeyboardFocus(BOOL focus)
{
- if (focus)
- {
- if (mInputEditor)
- {
- mInputEditor->setFocus(TRUE);
- mInputEditor->selectAll();
- }
- }
- else if (gFocusMgr.childHasKeyboardFocus(this))
- {
- if (mInputEditor)
- {
- mInputEditor->deselect();
- }
- setFocus(FALSE);
- }
+ if (focus)
+ {
+ if (mInputEditor)
+ {
+ mInputEditor->setFocus(TRUE);
+ mInputEditor->selectAll();
+ }
+ }
+ else if (gFocusMgr.childHasKeyboardFocus(this))
+ {
+ if (mInputEditor)
+ {
+ mInputEditor->deselect();
+ }
+ setFocus(FALSE);
+ }
}
// Ignore arrow keys in chat bar
void LLChatBar::setIgnoreArrowKeys(BOOL b)
{
- if (mInputEditor)
- {
- mInputEditor->setIgnoreArrowKeys(b);
- }
+ if (mInputEditor)
+ {
+ mInputEditor->setIgnoreArrowKeys(b);
+ }
}
BOOL LLChatBar::inputEditorHasFocus()
{
- return mInputEditor && mInputEditor->hasFocus();
+ return mInputEditor && mInputEditor->hasFocus();
}
std::string LLChatBar::getCurrentChat()
{
- return mInputEditor ? mInputEditor->getText() : LLStringUtil::null;
+ return mInputEditor ? mInputEditor->getText() : LLStringUtil::null;
}
void LLChatBar::setGestureCombo(LLComboBox* combo)
{
- mGestureCombo = combo;
- if (mGestureCombo)
- {
- mGestureCombo->setCommitCallback(boost::bind(&LLChatBar::onCommitGesture, this, _1));
-
- // now register observer since we have a place to put the results
- mObserver = new LLChatBarGestureObserver(this);
- LLGestureMgr::instance().addObserver(mObserver);
-
- // refresh list from current active gestures
- refreshGestures();
- }
+ mGestureCombo = combo;
+ if (mGestureCombo)
+ {
+ mGestureCombo->setCommitCallback(boost::bind(&LLChatBar::onCommitGesture, this, _1));
+
+ // now register observer since we have a place to put the results
+ mObserver = new LLChatBarGestureObserver(this);
+ LLGestureMgr::instance().addObserver(mObserver);
+
+ // refresh list from current active gestures
+ refreshGestures();
+ }
}
//-----------------------------------------------------------------------
@@ -302,100 +302,100 @@ void LLChatBar::setGestureCombo(LLComboBox* combo)
// Otherwise returns input and channel 0.
LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel)
{
- if (mesg[0] == '/'
- && mesg[1] == '/')
- {
- // This is a "repeat channel send"
- *channel = mLastSpecialChatChannel;
- return mesg.substr(2, mesg.length() - 2);
- }
- else if (mesg[0] == '/'
- && mesg[1]
- && (LLStringOps::isDigit(mesg[1])
- || (mesg[1] == '-' && mesg[2] && LLStringOps::isDigit(mesg[2]))))
- {
- // This a special "/20" speak on a channel
- S32 pos = 0;
-
- // Copy the channel number into a string
- LLWString channel_string;
- llwchar c;
- do
- {
- c = mesg[pos+1];
- channel_string.push_back(c);
- pos++;
- }
- while(c && pos < 64 && (LLStringOps::isDigit(c) || (pos == 1 && c == '-')));
-
- // Move the pointer forward to the first non-whitespace char
- // Check isspace before looping, so we can handle "/33foo"
- // as well as "/33 foo"
- while(c && iswspace(c))
- {
- c = mesg[pos+1];
- pos++;
- }
-
- mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10);
- *channel = mLastSpecialChatChannel;
- return mesg.substr(pos, mesg.length() - pos);
- }
- else
- {
- // This is normal chat.
- *channel = 0;
- return mesg;
- }
+ if (mesg[0] == '/'
+ && mesg[1] == '/')
+ {
+ // This is a "repeat channel send"
+ *channel = mLastSpecialChatChannel;
+ return mesg.substr(2, mesg.length() - 2);
+ }
+ else if (mesg[0] == '/'
+ && mesg[1]
+ && (LLStringOps::isDigit(mesg[1])
+ || (mesg[1] == '-' && mesg[2] && LLStringOps::isDigit(mesg[2]))))
+ {
+ // This a special "/20" speak on a channel
+ S32 pos = 0;
+
+ // Copy the channel number into a string
+ LLWString channel_string;
+ llwchar c;
+ do
+ {
+ c = mesg[pos+1];
+ channel_string.push_back(c);
+ pos++;
+ }
+ while(c && pos < 64 && (LLStringOps::isDigit(c) || (pos == 1 && c == '-')));
+
+ // Move the pointer forward to the first non-whitespace char
+ // Check isspace before looping, so we can handle "/33foo"
+ // as well as "/33 foo"
+ while(c && iswspace(c))
+ {
+ c = mesg[pos+1];
+ pos++;
+ }
+
+ mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10);
+ *channel = mLastSpecialChatChannel;
+ return mesg.substr(pos, mesg.length() - pos);
+ }
+ else
+ {
+ // This is normal chat.
+ *channel = 0;
+ return mesg;
+ }
}
void LLChatBar::sendChat( EChatType type )
{
- if (mInputEditor)
- {
- LLWString text = mInputEditor->getConvertedText();
- if (!text.empty())
- {
- // store sent line in history, duplicates will get filtered
- if (mInputEditor) mInputEditor->updateHistory();
- // Check if this is destined for another channel
- S32 channel = 0;
- stripChannelNumber(text, &channel);
-
- std::string utf8text = wstring_to_utf8str(text);
- // Try to trigger a gesture, if not chat to a script.
- std::string utf8_revised_text;
- if (0 == channel)
- {
- // discard returned "found" boolean
- LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
- }
- else
- {
- utf8_revised_text = utf8text;
- }
-
- utf8_revised_text = utf8str_trim(utf8_revised_text);
-
- if (!utf8_revised_text.empty())
- {
- // Chat with animation
- sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("PlayChatAnim"));
- }
- }
- }
-
- getChild<LLUICtrl>("Chat Editor")->setValue(LLStringUtil::null);
-
- gAgent.stopTyping();
-
- // If the user wants to stop chatting on hitting return, lose focus
- // and go out of chat mode.
- if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))
- {
- stopChat();
- }
+ if (mInputEditor)
+ {
+ LLWString text = mInputEditor->getConvertedText();
+ if (!text.empty())
+ {
+ // store sent line in history, duplicates will get filtered
+ if (mInputEditor) mInputEditor->updateHistory();
+ // Check if this is destined for another channel
+ S32 channel = 0;
+ stripChannelNumber(text, &channel);
+
+ std::string utf8text = wstring_to_utf8str(text);
+ // Try to trigger a gesture, if not chat to a script.
+ std::string utf8_revised_text;
+ if (0 == channel)
+ {
+ // discard returned "found" boolean
+ LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
+ }
+ else
+ {
+ utf8_revised_text = utf8text;
+ }
+
+ utf8_revised_text = utf8str_trim(utf8_revised_text);
+
+ if (!utf8_revised_text.empty())
+ {
+ // Chat with animation
+ sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("PlayChatAnim"));
+ }
+ }
+ }
+
+ getChild<LLUICtrl>("Chat Editor")->setValue(LLStringUtil::null);
+
+ gAgent.stopTyping();
+
+ // If the user wants to stop chatting on hitting return, lose focus
+ // and go out of chat mode.
+ if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))
+ {
+ stopChat();
+ }
}
@@ -403,29 +403,29 @@ void LLChatBar::sendChat( EChatType type )
// Static functions
//-----------------------------------------------------------------------
-// static
+// static
void LLChatBar::startChat(const char* line)
{
- //TODO* remove DUMMY chat
- //if(gBottomTray && gBottomTray->getChatBox())
- //{
- // gBottomTray->setVisible(TRUE);
- // gBottomTray->getChatBox()->setFocus(TRUE);
- //}
-
- // *TODO Vadim: Why was this code commented out?
-
-// gChatBar->setVisible(TRUE);
-// gChatBar->setKeyboardFocus(TRUE);
-// gSavedSettings.setBOOL("ChatVisible", TRUE);
-//
-// if (line && gChatBar->mInputEditor)
-// {
-// std::string line_string(line);
-// gChatBar->mInputEditor->setText(line_string);
-// }
-// // always move cursor to end so users don't obliterate chat when accidentally hitting WASD
-// gChatBar->mInputEditor->setCursorToEnd();
+ //TODO* remove DUMMY chat
+ //if(gBottomTray && gBottomTray->getChatBox())
+ //{
+ // gBottomTray->setVisible(TRUE);
+ // gBottomTray->getChatBox()->setFocus(TRUE);
+ //}
+
+ // *TODO Vadim: Why was this code commented out?
+
+// gChatBar->setVisible(TRUE);
+// gChatBar->setKeyboardFocus(TRUE);
+// gSavedSettings.setBOOL("ChatVisible", TRUE);
+//
+// if (line && gChatBar->mInputEditor)
+// {
+// std::string line_string(line);
+// gChatBar->mInputEditor->setText(line_string);
+// }
+// // always move cursor to end so users don't obliterate chat when accidentally hitting WASD
+// gChatBar->mInputEditor->setCursorToEnd();
}
@@ -433,221 +433,221 @@ void LLChatBar::startChat(const char* line)
// static
void LLChatBar::stopChat()
{
- //TODO* remove DUMMY chat
- //if(gBottomTray && gBottomTray->getChatBox())
- ///{
- // gBottomTray->getChatBox()->setFocus(FALSE);
- //}
-
- // *TODO Vadim: Why was this code commented out?
-
-// // In simple UI mode, we never release focus from the chat bar
-// gChatBar->setKeyboardFocus(FALSE);
-//
-// // If we typed a movement key and pressed return during the
-// // same frame, the keyboard handlers will see the key as having
-// // gone down this frame and try to move the avatar.
-// gKeyboard->resetKeys();
-// gKeyboard->resetMaskKeys();
-//
-// // stop typing animation
-// gAgent.stopTyping();
-//
-// // hide chat bar so it doesn't grab focus back
-// gChatBar->setVisible(FALSE);
-// gSavedSettings.setBOOL("ChatVisible", FALSE);
+ //TODO* remove DUMMY chat
+ //if(gBottomTray && gBottomTray->getChatBox())
+ ///{
+ // gBottomTray->getChatBox()->setFocus(FALSE);
+ //}
+
+ // *TODO Vadim: Why was this code commented out?
+
+// // In simple UI mode, we never release focus from the chat bar
+// gChatBar->setKeyboardFocus(FALSE);
+//
+// // If we typed a movement key and pressed return during the
+// // same frame, the keyboard handlers will see the key as having
+// // gone down this frame and try to move the avatar.
+// gKeyboard->resetKeys();
+// gKeyboard->resetMaskKeys();
+//
+// // stop typing animation
+// gAgent.stopTyping();
+//
+// // hide chat bar so it doesn't grab focus back
+// gChatBar->setVisible(FALSE);
+// gSavedSettings.setBOOL("ChatVisible", FALSE);
}
// static
void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
{
- LLChatBar* self = (LLChatBar *)userdata;
-
- LLWString raw_text;
- if (self->mInputEditor) raw_text = self->mInputEditor->getWText();
-
- // Can't trim the end, because that will cause autocompletion
- // to eat trailing spaces that might be part of a gesture.
- LLWStringUtil::trimHead(raw_text);
-
- S32 length = raw_text.length();
-
- if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences
- {
- gAgent.startTyping();
- }
- else
- {
- gAgent.stopTyping();
- }
-
- /* Doesn't work -- can't tell the difference between a backspace
- that killed the selection vs. backspace at the end of line.
- if (length > 1
- && text[0] == '/'
- && key == KEY_BACKSPACE)
- {
- // the selection will already be deleted, but we need to trim
- // off the character before
- std::string new_text = raw_text.substr(0, length-1);
- self->mInputEditor->setText( new_text );
- self->mInputEditor->setCursorToEnd();
- length = length - 1;
- }
- */
-
- KEY key = gKeyboard->currentKey();
-
- // Ignore "special" keys, like backspace, arrows, etc.
- if (length > 1
- && raw_text[0] == '/'
- && key < KEY_SPECIAL)
- {
- // we're starting a gesture, attempt to autocomplete
-
- std::string utf8_trigger = wstring_to_utf8str(raw_text);
- std::string utf8_out_str(utf8_trigger);
-
- if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
- {
- if (self->mInputEditor)
- {
- std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
- self->mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
- S32 outlength = self->mInputEditor->getLength(); // in characters
-
- // Select to end of line, starting from the character
- // after the last one the user typed.
- self->mInputEditor->setSelection(length, outlength);
- }
- }
-
- //LL_INFOS() << "GESTUREDEBUG " << trigger
- // << " len " << length
- // << " outlen " << out_str.getLength()
- // << LL_ENDL;
- }
+ LLChatBar* self = (LLChatBar *)userdata;
+
+ LLWString raw_text;
+ if (self->mInputEditor) raw_text = self->mInputEditor->getWText();
+
+ // Can't trim the end, because that will cause autocompletion
+ // to eat trailing spaces that might be part of a gesture.
+ LLWStringUtil::trimHead(raw_text);
+
+ S32 length = raw_text.length();
+
+ if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences
+ {
+ gAgent.startTyping();
+ }
+ else
+ {
+ gAgent.stopTyping();
+ }
+
+ /* Doesn't work -- can't tell the difference between a backspace
+ that killed the selection vs. backspace at the end of line.
+ if (length > 1
+ && text[0] == '/'
+ && key == KEY_BACKSPACE)
+ {
+ // the selection will already be deleted, but we need to trim
+ // off the character before
+ std::string new_text = raw_text.substr(0, length-1);
+ self->mInputEditor->setText( new_text );
+ self->mInputEditor->setCursorToEnd();
+ length = length - 1;
+ }
+ */
+
+ KEY key = gKeyboard->currentKey();
+
+ // Ignore "special" keys, like backspace, arrows, etc.
+ if (length > 1
+ && raw_text[0] == '/'
+ && key < KEY_SPECIAL)
+ {
+ // we're starting a gesture, attempt to autocomplete
+
+ std::string utf8_trigger = wstring_to_utf8str(raw_text);
+ std::string utf8_out_str(utf8_trigger);
+
+ if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
+ {
+ if (self->mInputEditor)
+ {
+ std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
+ self->mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
+ S32 outlength = self->mInputEditor->getLength(); // in characters
+
+ // Select to end of line, starting from the character
+ // after the last one the user typed.
+ self->mInputEditor->setSelection(length, outlength);
+ }
+ }
+
+ //LL_INFOS() << "GESTUREDEBUG " << trigger
+ // << " len " << length
+ // << " outlen " << out_str.getLength()
+ // << LL_ENDL;
+ }
}
// static
void LLChatBar::onInputEditorFocusLost()
{
- // stop typing animation
- gAgent.stopTyping();
+ // stop typing animation
+ gAgent.stopTyping();
}
// static
void LLChatBar::onInputEditorGainFocus()
{
- //LLFloaterChat::setHistoryCursorAndScrollToEnd();
+ //LLFloaterChat::setHistoryCursorAndScrollToEnd();
}
void LLChatBar::onClickSay( LLUICtrl* ctrl )
{
- std::string cmd = ctrl->getValue().asString();
- e_chat_type chat_type = CHAT_TYPE_NORMAL;
- if (cmd == "shout")
- {
- chat_type = CHAT_TYPE_SHOUT;
- }
- else if (cmd == "whisper")
- {
- chat_type = CHAT_TYPE_WHISPER;
- }
- sendChat(chat_type);
+ std::string cmd = ctrl->getValue().asString();
+ e_chat_type chat_type = CHAT_TYPE_NORMAL;
+ if (cmd == "shout")
+ {
+ chat_type = CHAT_TYPE_SHOUT;
+ }
+ else if (cmd == "whisper")
+ {
+ chat_type = CHAT_TYPE_WHISPER;
+ }
+ sendChat(chat_type);
}
void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate)
{
- sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate);
+ sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate);
}
void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate)
{
- // as soon as we say something, we no longer care about teaching the user
- // how to chat
- gWarningSettings.setBOOL("FirstOtherChatBeforeUser", FALSE);
-
- // Look for "/20 foo" channel chats.
- S32 channel = 0;
- LLWString out_text = stripChannelNumber(wtext, &channel);
- std::string utf8_out_text = wstring_to_utf8str(out_text);
- if (!utf8_out_text.empty())
- {
- utf8_out_text = utf8str_truncate(utf8_out_text, MAX_MSG_STR_LEN);
- }
-
- std::string utf8_text = wstring_to_utf8str(wtext);
- utf8_text = utf8str_trim(utf8_text);
- if (!utf8_text.empty())
- {
- utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1);
- }
-
- // Don't animate for chats people can't hear (chat to scripts)
- if (animate && (channel == 0))
- {
- if (type == CHAT_TYPE_WHISPER)
- {
- LL_DEBUGS() << "You whisper " << utf8_text << LL_ENDL;
- gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START);
- }
- else if (type == CHAT_TYPE_NORMAL)
- {
- LL_DEBUGS() << "You say " << utf8_text << LL_ENDL;
- gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START);
- }
- else if (type == CHAT_TYPE_SHOUT)
- {
- LL_DEBUGS() << "You shout " << utf8_text << LL_ENDL;
- gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START);
- }
- else
- {
- LL_INFOS() << "send_chat_from_viewer() - invalid volume" << LL_ENDL;
- return;
- }
- }
- else
- {
- if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP)
- {
- LL_DEBUGS() << "Channel chat: " << utf8_text << LL_ENDL;
- }
- }
-
- send_chat_from_viewer(utf8_out_text, type, channel);
+ // as soon as we say something, we no longer care about teaching the user
+ // how to chat
+ gWarningSettings.setBOOL("FirstOtherChatBeforeUser", FALSE);
+
+ // Look for "/20 foo" channel chats.
+ S32 channel = 0;
+ LLWString out_text = stripChannelNumber(wtext, &channel);
+ std::string utf8_out_text = wstring_to_utf8str(out_text);
+ if (!utf8_out_text.empty())
+ {
+ utf8_out_text = utf8str_truncate(utf8_out_text, MAX_MSG_STR_LEN);
+ }
+
+ std::string utf8_text = wstring_to_utf8str(wtext);
+ utf8_text = utf8str_trim(utf8_text);
+ if (!utf8_text.empty())
+ {
+ utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1);
+ }
+
+ // Don't animate for chats people can't hear (chat to scripts)
+ if (animate && (channel == 0))
+ {
+ if (type == CHAT_TYPE_WHISPER)
+ {
+ LL_DEBUGS() << "You whisper " << utf8_text << LL_ENDL;
+ gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START);
+ }
+ else if (type == CHAT_TYPE_NORMAL)
+ {
+ LL_DEBUGS() << "You say " << utf8_text << LL_ENDL;
+ gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START);
+ }
+ else if (type == CHAT_TYPE_SHOUT)
+ {
+ LL_DEBUGS() << "You shout " << utf8_text << LL_ENDL;
+ gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START);
+ }
+ else
+ {
+ LL_INFOS() << "send_chat_from_viewer() - invalid volume" << LL_ENDL;
+ return;
+ }
+ }
+ else
+ {
+ if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP)
+ {
+ LL_DEBUGS() << "Channel chat: " << utf8_text << LL_ENDL;
+ }
+ }
+
+ send_chat_from_viewer(utf8_out_text, type, channel);
}
void LLChatBar::onCommitGesture(LLUICtrl* ctrl)
{
- LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL;
- if (gestures)
- {
- S32 index = gestures->getFirstSelectedIndex();
- if (index == 0)
- {
- return;
- }
- const std::string& trigger = gestures->getSelectedValue().asString();
-
- // pretend the user chatted the trigger string, to invoke
- // substitution and logging.
- std::string text(trigger);
- std::string revised_text;
- LLGestureMgr::instance().triggerAndReviseString(text, &revised_text);
-
- revised_text = utf8str_trim(revised_text);
- if (!revised_text.empty())
- {
- // Don't play nodding animation
- sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE);
- }
- }
- mGestureLabelTimer.start();
- if (mGestureCombo != NULL)
- {
- // free focus back to chat bar
- mGestureCombo->setFocus(FALSE);
- }
+ LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL;
+ if (gestures)
+ {
+ S32 index = gestures->getFirstSelectedIndex();
+ if (index == 0)
+ {
+ return;
+ }
+ const std::string& trigger = gestures->getSelectedValue().asString();
+
+ // pretend the user chatted the trigger string, to invoke
+ // substitution and logging.
+ std::string text(trigger);
+ std::string revised_text;
+ LLGestureMgr::instance().triggerAndReviseString(text, &revised_text);
+
+ revised_text = utf8str_trim(revised_text);
+ if (!revised_text.empty())
+ {
+ // Don't play nodding animation
+ sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE);
+ }
+ }
+ mGestureLabelTimer.start();
+ if (mGestureCombo != NULL)
+ {
+ // free focus back to chat bar
+ mGestureCombo->setFocus(FALSE);
+ }
}
diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h
index 26ef5f1535..1217976e2e 100644
--- a/indra/newview/llchatbar.h
+++ b/indra/newview/llchatbar.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchatbar.h
* @brief LLChatBar class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,70 +41,70 @@ class LLComboBox;
class LLChatBar
-: public LLPanel
+: public LLPanel
{
public:
- // constructor for inline chat-bars (e.g. hosted in chat history window)
- LLChatBar();
- ~LLChatBar();
- virtual BOOL postBuild();
+ // constructor for inline chat-bars (e.g. hosted in chat history window)
+ LLChatBar();
+ ~LLChatBar();
+ virtual BOOL postBuild();
- virtual BOOL handleKeyHere(KEY key, MASK mask);
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
- void refresh();
- void refreshGestures();
+ void refresh();
+ void refreshGestures();
- // Move cursor into chat input field.
- void setKeyboardFocus(BOOL b);
+ // Move cursor into chat input field.
+ void setKeyboardFocus(BOOL b);
- // Ignore arrow keys for chat bar
- void setIgnoreArrowKeys(BOOL b);
+ // Ignore arrow keys for chat bar
+ void setIgnoreArrowKeys(BOOL b);
- BOOL inputEditorHasFocus();
- std::string getCurrentChat();
+ BOOL inputEditorHasFocus();
+ std::string getCurrentChat();
- // since chat bar logic is reused for chat history
- // gesture combo box might not be a direct child
- void setGestureCombo(LLComboBox* combo);
+ // since chat bar logic is reused for chat history
+ // gesture combo box might not be a direct child
+ void setGestureCombo(LLComboBox* combo);
- // Send a chat (after stripping /20foo channel chats).
- // "Animate" means the nodding animation for regular text.
- void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
- void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate);
+ // Send a chat (after stripping /20foo channel chats).
+ // "Animate" means the nodding animation for regular text.
+ void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
+ void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate);
- // If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20.
- // Otherwise returns input and channel 0.
- LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
+ // If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20.
+ // Otherwise returns input and channel 0.
+ LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
- // callbacks
- void onClickSay(LLUICtrl* ctrl);
+ // callbacks
+ void onClickSay(LLUICtrl* ctrl);
- static void onTabClick( void* userdata );
- static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
- static void onInputEditorFocusLost();
- static void onInputEditorGainFocus();
+ static void onTabClick( void* userdata );
+ static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
+ static void onInputEditorFocusLost();
+ static void onInputEditorGainFocus();
- void onCommitGesture(LLUICtrl* ctrl);
+ void onCommitGesture(LLUICtrl* ctrl);
- static void startChat(const char* line);
- static void stopChat();
+ static void startChat(const char* line);
+ static void stopChat();
protected:
- void sendChat(EChatType type);
- void updateChat();
+ void sendChat(EChatType type);
+ void updateChat();
protected:
- LLLineEditor* mInputEditor;
+ LLLineEditor* mInputEditor;
- LLFrameTimer mGestureLabelTimer;
+ LLFrameTimer mGestureLabelTimer;
- // Which non-zero channel did we last chat on?
- S32 mLastSpecialChatChannel;
+ // Which non-zero channel did we last chat on?
+ S32 mLastSpecialChatChannel;
- BOOL mIsBuilt;
- LLComboBox* mGestureCombo;
+ BOOL mIsBuilt;
+ LLComboBox* mGestureCombo;
- LLChatBarGestureObserver* mObserver;
+ LLChatBarGestureObserver* mObserver;
};
extern LLChatBar *gChatBar;
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index b9bf432581..4a08eace62 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchathistory.cpp
* @brief LLTextEditor base class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -79,118 +79,118 @@ const static std::string SLURL_ABOUT = "/about";
class LLObjectIMHandler : public LLCommandHandler
{
public:
- // requests will be throttled from a non-trusted browser
- LLObjectIMHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) {}
-
- bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- if (params.size() < 1)
- {
- return false;
- }
-
- LLUUID object_id;
- if (!object_id.set(params[0], FALSE))
- {
- return false;
- }
-
- LLSD payload;
- payload["object_id"] = object_id;
- payload["owner_id"] = query_map["owner"];
- payload["name"] = query_map["name"];
- payload["slurl"] = LLWeb::escapeURL(query_map["slurl"]);
- payload["group_owned"] = query_map["groupowned"];
- LLFloaterReg::showInstance("inspect_remote_object", payload);
- return true;
- }
+ // requests will be throttled from a non-trusted browser
+ LLObjectIMHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) {}
+
+ bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ if (params.size() < 1)
+ {
+ return false;
+ }
+
+ LLUUID object_id;
+ if (!object_id.set(params[0], FALSE))
+ {
+ return false;
+ }
+
+ LLSD payload;
+ payload["object_id"] = object_id;
+ payload["owner_id"] = query_map["owner"];
+ payload["name"] = query_map["name"];
+ payload["slurl"] = LLWeb::escapeURL(query_map["slurl"]);
+ payload["group_owned"] = query_map["groupowned"];
+ LLFloaterReg::showInstance("inspect_remote_object", payload);
+ return true;
+ }
};
LLObjectIMHandler gObjectIMHandler;
class LLChatHistoryHeader: public LLPanel
{
public:
- LLChatHistoryHeader()
- : LLPanel(),
- mInfoCtrl(NULL),
- mPopupMenuHandleAvatar(),
- mPopupMenuHandleObject(),
- mAvatarID(),
- mSourceType(CHAT_SOURCE_UNKNOWN),
- mFrom(),
- mSessionID(),
+ LLChatHistoryHeader()
+ : LLPanel(),
+ mInfoCtrl(NULL),
+ mPopupMenuHandleAvatar(),
+ mPopupMenuHandleObject(),
+ mAvatarID(),
+ mSourceType(CHAT_SOURCE_UNKNOWN),
+ mFrom(),
+ mSessionID(),
mCreationTime(time_corrected()),
- mMinUserNameWidth(0),
- mUserNameFont(NULL),
- mUserNameTextBox(NULL),
- mTimeBoxTextBox(NULL),
- mNeedsTimeBox(true),
- mAvatarNameCacheConnection()
- {}
-
- static LLChatHistoryHeader* createInstance(const std::string& file_name)
- {
- LLChatHistoryHeader* pInstance = new LLChatHistoryHeader;
- pInstance->buildFromFile(file_name);
- return pInstance;
- }
-
- ~LLChatHistoryHeader()
- {
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- auto menu = mPopupMenuHandleAvatar.get();
- if (menu)
- {
- menu->die();
- mPopupMenuHandleAvatar.markDead();
- }
- menu = mPopupMenuHandleObject.get();
- if (menu)
- {
- menu->die();
- mPopupMenuHandleObject.markDead();
- }
- }
-
- BOOL handleMouseUp(S32 x, S32 y, MASK mask)
- {
- return LLPanel::handleMouseUp(x,y,mask);
- }
-
- void onObjectIconContextMenuItemClicked(const LLSD& userdata)
- {
- std::string level = userdata.asString();
-
- if (level == "profile")
- {
- LLFloaterReg::showInstance("inspect_remote_object", mObjectData);
- }
- else if (level == "block")
- {
- LLMuteList::getInstance()->add(LLMute(getAvatarId(), mFrom, LLMute::OBJECT));
-
- LLFloaterSidePanelContainer::showPanel("people", "panel_people",
- LLSD().with("people_panel_tab_name", "blocked_panel").with("blocked_to_select", getAvatarId()));
- }
- else if (level == "unblock")
- {
- LLMuteList::getInstance()->remove(LLMute(getAvatarId(), mFrom, LLMute::OBJECT));
- }
- else if (level == "map")
- {
- std::string url = "secondlife://" + mObjectData["slurl"].asString();
- LLUrlAction::showLocationOnMap(url);
- }
- else if (level == "teleport")
- {
- std::string url = "secondlife://" + mObjectData["slurl"].asString();
- LLUrlAction::teleportToLocation(url);
- }
-
- }
+ mMinUserNameWidth(0),
+ mUserNameFont(NULL),
+ mUserNameTextBox(NULL),
+ mTimeBoxTextBox(NULL),
+ mNeedsTimeBox(true),
+ mAvatarNameCacheConnection()
+ {}
+
+ static LLChatHistoryHeader* createInstance(const std::string& file_name)
+ {
+ LLChatHistoryHeader* pInstance = new LLChatHistoryHeader;
+ pInstance->buildFromFile(file_name);
+ return pInstance;
+ }
+
+ ~LLChatHistoryHeader()
+ {
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ auto menu = mPopupMenuHandleAvatar.get();
+ if (menu)
+ {
+ menu->die();
+ mPopupMenuHandleAvatar.markDead();
+ }
+ menu = mPopupMenuHandleObject.get();
+ if (menu)
+ {
+ menu->die();
+ mPopupMenuHandleObject.markDead();
+ }
+ }
+
+ BOOL handleMouseUp(S32 x, S32 y, MASK mask)
+ {
+ return LLPanel::handleMouseUp(x,y,mask);
+ }
+
+ void onObjectIconContextMenuItemClicked(const LLSD& userdata)
+ {
+ std::string level = userdata.asString();
+
+ if (level == "profile")
+ {
+ LLFloaterReg::showInstance("inspect_remote_object", mObjectData);
+ }
+ else if (level == "block")
+ {
+ LLMuteList::getInstance()->add(LLMute(getAvatarId(), mFrom, LLMute::OBJECT));
+
+ LLFloaterSidePanelContainer::showPanel("people", "panel_people",
+ LLSD().with("people_panel_tab_name", "blocked_panel").with("blocked_to_select", getAvatarId()));
+ }
+ else if (level == "unblock")
+ {
+ LLMuteList::getInstance()->remove(LLMute(getAvatarId(), mFrom, LLMute::OBJECT));
+ }
+ else if (level == "map")
+ {
+ std::string url = "secondlife://" + mObjectData["slurl"].asString();
+ LLUrlAction::showLocationOnMap(url);
+ }
+ else if (level == "teleport")
+ {
+ std::string url = "secondlife://" + mObjectData["slurl"].asString();
+ LLUrlAction::teleportToLocation(url);
+ }
+
+ }
bool onObjectIconContextMenuItemVisible(const LLSD& userdata)
{
@@ -206,217 +206,217 @@ public:
return false;
}
- void banGroupMember(const LLUUID& participant_uuid)
- {
- LLUUID group_uuid = mSessionID;
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
- if (!gdatap)
- {
- // Not a group
- return;
- }
-
- gdatap->banMemberById(participant_uuid);
- }
-
- bool canBanInGroup()
- {
- LLUUID group_uuid = mSessionID;
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
- if (!gdatap)
- {
- // Not a group
- return false;
- }
-
- if (gAgent.hasPowerInGroup(group_uuid, GP_ROLE_REMOVE_MEMBER)
- && gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS))
- {
- return true;
- }
-
- return false;
- }
-
- bool canBanGroupMember(const LLUUID& participant_uuid)
- {
- LLUUID group_uuid = mSessionID;
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
- if (!gdatap)
- {
- // Not a group
- return false;
- }
-
- if (gdatap->mPendingBanRequest)
- {
- return false;
- }
-
- if (gAgentID == getAvatarId())
- {
- //Don't ban self
- return false;
- }
-
- if (gdatap->isRoleMemberDataComplete())
- {
- if (gdatap->mMembers.size())
- {
- LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(participant_uuid);
- if (mi != gdatap->mMembers.end())
- {
- LLGroupMemberData* member_data = (*mi).second;
- // Is the member an owner?
- if (member_data && member_data->isInRole(gdatap->mOwnerRole))
- {
- return false;
- }
-
- if (gAgent.hasPowerInGroup(group_uuid, GP_ROLE_REMOVE_MEMBER)
- && gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS))
- {
- return true;
- }
- }
- }
- }
-
- LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (speaker_mgr)
- {
- LLSpeaker * speakerp = speaker_mgr->findSpeaker(participant_uuid).get();
-
- if (speakerp
- && gAgent.hasPowerInGroup(group_uuid, GP_ROLE_REMOVE_MEMBER)
- && gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS))
- {
- return true;
- }
- }
-
- return false;
- }
-
- bool isGroupModerator()
- {
- LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (!speaker_mgr)
- {
- LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
- return false;
- }
-
- // Is session a group call/chat?
- if(gAgent.isInGroup(mSessionID))
- {
- LLSpeaker * speakerp = speaker_mgr->findSpeaker(gAgentID).get();
-
- // Is agent a moderator?
- return speakerp && speakerp->mIsModerator;
- }
-
- return false;
- }
-
- bool canModerate(const std::string& userdata)
- {
- // only group moderators can perform actions related to this "enable callback"
- if (!isGroupModerator() || gAgentID == getAvatarId())
- {
- return false;
- }
-
- LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (!speaker_mgr)
- {
- return false;
- }
-
- LLSpeaker * speakerp = speaker_mgr->findSpeaker(getAvatarId()).get();
- if (!speakerp)
- {
- return false;
- }
-
- bool voice_channel = speakerp->isInVoiceChannel();
-
- if ("can_moderate_voice" == userdata)
- {
- return voice_channel;
- }
- else if ("can_mute" == userdata)
- {
- return voice_channel && (speakerp->mStatus != LLSpeaker::STATUS_MUTED);
- }
- else if ("can_unmute" == userdata)
- {
- return speakerp->mStatus == LLSpeaker::STATUS_MUTED;
- }
- else if ("can_allow_text_chat" == userdata)
- {
- return true;
- }
-
- return false;
- }
-
- void onAvatarIconContextMenuItemClicked(const LLSD& userdata)
- {
- std::string level = userdata.asString();
-
- if (level == "profile")
- {
- LLAvatarActions::showProfile(getAvatarId());
- }
- else if (level == "im")
- {
- LLAvatarActions::startIM(getAvatarId());
- }
- else if (level == "teleport")
- {
- LLAvatarActions::offerTeleport(getAvatarId());
- }
- else if (level == "request_teleport")
- {
- LLAvatarActions::teleportRequest(getAvatarId());
- }
- else if (level == "voice_call")
- {
- LLAvatarActions::startCall(getAvatarId());
- }
- else if (level == "chat_history")
- {
- LLAvatarActions::viewChatHistory(getAvatarId());
- }
- else if (level == "add")
- {
- LLAvatarActions::requestFriendshipDialog(getAvatarId(), mFrom);
- }
- else if (level == "remove")
- {
- LLAvatarActions::removeFriendDialog(getAvatarId());
- }
- else if (level == "invite_to_group")
- {
- LLAvatarActions::inviteToGroup(getAvatarId());
- }
- else if (level == "zoom_in")
- {
- handle_zoom_to_object(getAvatarId());
- }
- else if (level == "map")
- {
- LLAvatarActions::showOnMap(getAvatarId());
- }
- else if (level == "share")
- {
- LLAvatarActions::share(getAvatarId());
- }
- else if (level == "pay")
- {
- LLAvatarActions::pay(getAvatarId());
- }
+ void banGroupMember(const LLUUID& participant_uuid)
+ {
+ LLUUID group_uuid = mSessionID;
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
+ if (!gdatap)
+ {
+ // Not a group
+ return;
+ }
+
+ gdatap->banMemberById(participant_uuid);
+ }
+
+ bool canBanInGroup()
+ {
+ LLUUID group_uuid = mSessionID;
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
+ if (!gdatap)
+ {
+ // Not a group
+ return false;
+ }
+
+ if (gAgent.hasPowerInGroup(group_uuid, GP_ROLE_REMOVE_MEMBER)
+ && gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ bool canBanGroupMember(const LLUUID& participant_uuid)
+ {
+ LLUUID group_uuid = mSessionID;
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
+ if (!gdatap)
+ {
+ // Not a group
+ return false;
+ }
+
+ if (gdatap->mPendingBanRequest)
+ {
+ return false;
+ }
+
+ if (gAgentID == getAvatarId())
+ {
+ //Don't ban self
+ return false;
+ }
+
+ if (gdatap->isRoleMemberDataComplete())
+ {
+ if (gdatap->mMembers.size())
+ {
+ LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(participant_uuid);
+ if (mi != gdatap->mMembers.end())
+ {
+ LLGroupMemberData* member_data = (*mi).second;
+ // Is the member an owner?
+ if (member_data && member_data->isInRole(gdatap->mOwnerRole))
+ {
+ return false;
+ }
+
+ if (gAgent.hasPowerInGroup(group_uuid, GP_ROLE_REMOVE_MEMBER)
+ && gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS))
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (speaker_mgr)
+ {
+ LLSpeaker * speakerp = speaker_mgr->findSpeaker(participant_uuid).get();
+
+ if (speakerp
+ && gAgent.hasPowerInGroup(group_uuid, GP_ROLE_REMOVE_MEMBER)
+ && gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool isGroupModerator()
+ {
+ LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (!speaker_mgr)
+ {
+ LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
+ return false;
+ }
+
+ // Is session a group call/chat?
+ if(gAgent.isInGroup(mSessionID))
+ {
+ LLSpeaker * speakerp = speaker_mgr->findSpeaker(gAgentID).get();
+
+ // Is agent a moderator?
+ return speakerp && speakerp->mIsModerator;
+ }
+
+ return false;
+ }
+
+ bool canModerate(const std::string& userdata)
+ {
+ // only group moderators can perform actions related to this "enable callback"
+ if (!isGroupModerator() || gAgentID == getAvatarId())
+ {
+ return false;
+ }
+
+ LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (!speaker_mgr)
+ {
+ return false;
+ }
+
+ LLSpeaker * speakerp = speaker_mgr->findSpeaker(getAvatarId()).get();
+ if (!speakerp)
+ {
+ return false;
+ }
+
+ bool voice_channel = speakerp->isInVoiceChannel();
+
+ if ("can_moderate_voice" == userdata)
+ {
+ return voice_channel;
+ }
+ else if ("can_mute" == userdata)
+ {
+ return voice_channel && (speakerp->mStatus != LLSpeaker::STATUS_MUTED);
+ }
+ else if ("can_unmute" == userdata)
+ {
+ return speakerp->mStatus == LLSpeaker::STATUS_MUTED;
+ }
+ else if ("can_allow_text_chat" == userdata)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ void onAvatarIconContextMenuItemClicked(const LLSD& userdata)
+ {
+ std::string level = userdata.asString();
+
+ if (level == "profile")
+ {
+ LLAvatarActions::showProfile(getAvatarId());
+ }
+ else if (level == "im")
+ {
+ LLAvatarActions::startIM(getAvatarId());
+ }
+ else if (level == "teleport")
+ {
+ LLAvatarActions::offerTeleport(getAvatarId());
+ }
+ else if (level == "request_teleport")
+ {
+ LLAvatarActions::teleportRequest(getAvatarId());
+ }
+ else if (level == "voice_call")
+ {
+ LLAvatarActions::startCall(getAvatarId());
+ }
+ else if (level == "chat_history")
+ {
+ LLAvatarActions::viewChatHistory(getAvatarId());
+ }
+ else if (level == "add")
+ {
+ LLAvatarActions::requestFriendshipDialog(getAvatarId(), mFrom);
+ }
+ else if (level == "remove")
+ {
+ LLAvatarActions::removeFriendDialog(getAvatarId());
+ }
+ else if (level == "invite_to_group")
+ {
+ LLAvatarActions::inviteToGroup(getAvatarId());
+ }
+ else if (level == "zoom_in")
+ {
+ handle_zoom_to_object(getAvatarId());
+ }
+ else if (level == "map")
+ {
+ LLAvatarActions::showOnMap(getAvatarId());
+ }
+ else if (level == "share")
+ {
+ LLAvatarActions::share(getAvatarId());
+ }
+ else if (level == "pay")
+ {
+ LLAvatarActions::pay(getAvatarId());
+ }
else if (level == "report_abuse")
{
std::string time_string;
@@ -459,135 +459,135 @@ public:
}
LLFloaterReporter::showFromChat(mAvatarID, mFrom, time_string, mText);
}
- else if(level == "block_unblock")
- {
- LLAvatarActions::toggleMute(getAvatarId(), LLMute::flagVoiceChat);
- }
- else if(level == "mute_unmute")
- {
- LLAvatarActions::toggleMute(getAvatarId(), LLMute::flagTextChat);
- }
- else if(level == "toggle_allow_text_chat")
- {
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- speaker_mgr->toggleAllowTextChat(getAvatarId());
- }
- else if(level == "group_mute")
- {
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (speaker_mgr)
- {
- speaker_mgr->moderateVoiceParticipant(getAvatarId(), false);
- }
- }
- else if(level == "group_unmute")
- {
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (speaker_mgr)
- {
- speaker_mgr->moderateVoiceParticipant(getAvatarId(), true);
- }
- }
- else if(level == "ban_member")
- {
- banGroupMember(getAvatarId());
- }
- }
-
- bool onAvatarIconContextMenuItemChecked(const LLSD& userdata)
- {
- std::string level = userdata.asString();
-
- if (level == "is_blocked")
- {
- return LLMuteList::getInstance()->isMuted(getAvatarId(), LLMute::flagVoiceChat);
- }
- if (level == "is_muted")
- {
- return LLMuteList::getInstance()->isMuted(getAvatarId(), LLMute::flagTextChat);
- }
- else if (level == "is_allowed_text_chat")
- {
- if (gAgent.isInGroup(mSessionID))
- {
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if(speaker_mgr)
- {
- const LLSpeaker * speakerp = speaker_mgr->findSpeaker(getAvatarId());
- if (NULL != speakerp)
- {
- return !speakerp->mModeratorMutedText;
- }
- }
- }
- return false;
- }
- return false;
- }
-
- bool onAvatarIconContextMenuItemEnabled(const LLSD& userdata)
- {
- std::string level = userdata.asString();
-
- if (level == "can_allow_text_chat" || level == "can_mute" || level == "can_unmute")
- {
- return canModerate(userdata);
- }
+ else if(level == "block_unblock")
+ {
+ LLAvatarActions::toggleMute(getAvatarId(), LLMute::flagVoiceChat);
+ }
+ else if(level == "mute_unmute")
+ {
+ LLAvatarActions::toggleMute(getAvatarId(), LLMute::flagTextChat);
+ }
+ else if(level == "toggle_allow_text_chat")
+ {
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ speaker_mgr->toggleAllowTextChat(getAvatarId());
+ }
+ else if(level == "group_mute")
+ {
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (speaker_mgr)
+ {
+ speaker_mgr->moderateVoiceParticipant(getAvatarId(), false);
+ }
+ }
+ else if(level == "group_unmute")
+ {
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (speaker_mgr)
+ {
+ speaker_mgr->moderateVoiceParticipant(getAvatarId(), true);
+ }
+ }
+ else if(level == "ban_member")
+ {
+ banGroupMember(getAvatarId());
+ }
+ }
+
+ bool onAvatarIconContextMenuItemChecked(const LLSD& userdata)
+ {
+ std::string level = userdata.asString();
+
+ if (level == "is_blocked")
+ {
+ return LLMuteList::getInstance()->isMuted(getAvatarId(), LLMute::flagVoiceChat);
+ }
+ if (level == "is_muted")
+ {
+ return LLMuteList::getInstance()->isMuted(getAvatarId(), LLMute::flagTextChat);
+ }
+ else if (level == "is_allowed_text_chat")
+ {
+ if (gAgent.isInGroup(mSessionID))
+ {
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if(speaker_mgr)
+ {
+ const LLSpeaker * speakerp = speaker_mgr->findSpeaker(getAvatarId());
+ if (NULL != speakerp)
+ {
+ return !speakerp->mModeratorMutedText;
+ }
+ }
+ }
+ return false;
+ }
+ return false;
+ }
+
+ bool onAvatarIconContextMenuItemEnabled(const LLSD& userdata)
+ {
+ std::string level = userdata.asString();
+
+ if (level == "can_allow_text_chat" || level == "can_mute" || level == "can_unmute")
+ {
+ return canModerate(userdata);
+ }
else if (level == "report_abuse")
{
return gAgentID != mAvatarID;
}
- else if (level == "can_ban_member")
- {
- return canBanGroupMember(getAvatarId());
- }
- return false;
- }
-
- bool onAvatarIconContextMenuItemVisible(const LLSD& userdata)
- {
- std::string level = userdata.asString();
-
- if (level == "show_mute")
- {
- LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (speaker_mgr)
- {
- LLSpeaker * speakerp = speaker_mgr->findSpeaker(getAvatarId()).get();
- if (speakerp)
- {
- return speakerp->isInVoiceChannel() && speakerp->mStatus != LLSpeaker::STATUS_MUTED;
- }
- }
- return false;
- }
- else if (level == "show_unmute")
- {
- LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (speaker_mgr)
- {
- LLSpeaker * speakerp = speaker_mgr->findSpeaker(getAvatarId()).get();
- if (speakerp)
- {
- return speakerp->mStatus == LLSpeaker::STATUS_MUTED;
- }
- }
- return false;
- }
- return false;
- }
-
- BOOL postBuild()
- {
- setDoubleClickCallback(boost::bind(&LLChatHistoryHeader::showInspector, this));
-
- setMouseEnterCallback(boost::bind(&LLChatHistoryHeader::showInfoCtrl, this));
- setMouseLeaveCallback(boost::bind(&LLChatHistoryHeader::hideInfoCtrl, this));
-
- mUserNameTextBox = getChild<LLTextBox>("user_name");
- mTimeBoxTextBox = getChild<LLTextBox>("time_box");
-
- mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance());
+ else if (level == "can_ban_member")
+ {
+ return canBanGroupMember(getAvatarId());
+ }
+ return false;
+ }
+
+ bool onAvatarIconContextMenuItemVisible(const LLSD& userdata)
+ {
+ std::string level = userdata.asString();
+
+ if (level == "show_mute")
+ {
+ LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (speaker_mgr)
+ {
+ LLSpeaker * speakerp = speaker_mgr->findSpeaker(getAvatarId()).get();
+ if (speakerp)
+ {
+ return speakerp->isInVoiceChannel() && speakerp->mStatus != LLSpeaker::STATUS_MUTED;
+ }
+ }
+ return false;
+ }
+ else if (level == "show_unmute")
+ {
+ LLSpeakerMgr * speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (speaker_mgr)
+ {
+ LLSpeaker * speakerp = speaker_mgr->findSpeaker(getAvatarId()).get();
+ if (speakerp)
+ {
+ return speakerp->mStatus == LLSpeaker::STATUS_MUTED;
+ }
+ }
+ return false;
+ }
+ return false;
+ }
+
+ BOOL postBuild()
+ {
+ setDoubleClickCallback(boost::bind(&LLChatHistoryHeader::showInspector, this));
+
+ setMouseEnterCallback(boost::bind(&LLChatHistoryHeader::showInfoCtrl, this));
+ setMouseLeaveCallback(boost::bind(&LLChatHistoryHeader::hideInfoCtrl, this));
+
+ mUserNameTextBox = getChild<LLTextBox>("user_name");
+ mTimeBoxTextBox = getChild<LLTextBox>("time_box");
+
+ mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance());
if (mInfoCtrl)
{
mInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, mInfoCtrl));
@@ -598,71 +598,71 @@ public:
LL_ERRS() << "Failed to create an interface element due to missing or corrupted file inspector_info_ctrl.xml" << LL_ENDL;
}
- return LLPanel::postBuild();
- }
-
- bool pointInChild(const std::string& name,S32 x,S32 y)
- {
- LLUICtrl* child = findChild<LLUICtrl>(name);
- if(!child)
- return false;
-
- LLView* parent = child->getParent();
- if(parent!=this)
- {
- x-=parent->getRect().mLeft;
- y-=parent->getRect().mBottom;
- }
-
- S32 local_x = x - child->getRect().mLeft ;
- S32 local_y = y - child->getRect().mBottom ;
- return child->pointInView(local_x, local_y);
- }
-
- BOOL handleRightMouseDown(S32 x, S32 y, MASK mask)
- {
- if(pointInChild("avatar_icon",x,y) || pointInChild("user_name",x,y))
- {
- showContextMenu(x,y);
- return TRUE;
- }
-
- return LLPanel::handleRightMouseDown(x,y,mask);
- }
-
- void showInspector()
- {
- if (mAvatarID.isNull() && CHAT_SOURCE_SYSTEM != mSourceType && CHAT_SOURCE_REGION != mSourceType) return;
-
- if (mSourceType == CHAT_SOURCE_OBJECT)
- {
- LLFloaterReg::showInstance("inspect_remote_object", mObjectData);
- }
- else if (mSourceType == CHAT_SOURCE_AGENT)
- {
- LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarID));
- }
- //if chat source is system, you may add "else" here to define behaviour.
- }
-
- static void onClickInfoCtrl(LLUICtrl* info_ctrl)
- {
- if (!info_ctrl) return;
-
- LLChatHistoryHeader* header = dynamic_cast<LLChatHistoryHeader*>(info_ctrl->getParent());
- if (!header) return;
-
- header->showInspector();
- }
-
-
- const LLUUID& getAvatarId () const { return mAvatarID;}
-
- void setup(const LLChat& chat, const LLStyle::Params& style_params, const LLSD& args)
- {
- mAvatarID = chat.mFromID;
- mSessionID = chat.mSessionID;
- mSourceType = chat.mSourceType;
+ return LLPanel::postBuild();
+ }
+
+ bool pointInChild(const std::string& name,S32 x,S32 y)
+ {
+ LLUICtrl* child = findChild<LLUICtrl>(name);
+ if(!child)
+ return false;
+
+ LLView* parent = child->getParent();
+ if(parent!=this)
+ {
+ x-=parent->getRect().mLeft;
+ y-=parent->getRect().mBottom;
+ }
+
+ S32 local_x = x - child->getRect().mLeft ;
+ S32 local_y = y - child->getRect().mBottom ;
+ return child->pointInView(local_x, local_y);
+ }
+
+ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask)
+ {
+ if(pointInChild("avatar_icon",x,y) || pointInChild("user_name",x,y))
+ {
+ showContextMenu(x,y);
+ return TRUE;
+ }
+
+ return LLPanel::handleRightMouseDown(x,y,mask);
+ }
+
+ void showInspector()
+ {
+ if (mAvatarID.isNull() && CHAT_SOURCE_SYSTEM != mSourceType && CHAT_SOURCE_REGION != mSourceType) return;
+
+ if (mSourceType == CHAT_SOURCE_OBJECT)
+ {
+ LLFloaterReg::showInstance("inspect_remote_object", mObjectData);
+ }
+ else if (mSourceType == CHAT_SOURCE_AGENT)
+ {
+ LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarID));
+ }
+ //if chat source is system, you may add "else" here to define behaviour.
+ }
+
+ static void onClickInfoCtrl(LLUICtrl* info_ctrl)
+ {
+ if (!info_ctrl) return;
+
+ LLChatHistoryHeader* header = dynamic_cast<LLChatHistoryHeader*>(info_ctrl->getParent());
+ if (!header) return;
+
+ header->showInspector();
+ }
+
+
+ const LLUUID& getAvatarId () const { return mAvatarID;}
+
+ void setup(const LLChat& chat, const LLStyle::Params& style_params, const LLSD& args)
+ {
+ mAvatarID = chat.mFromID;
+ mSessionID = chat.mSessionID;
+ mSourceType = chat.mSourceType;
// To be able to report a message, we need a copy of it's text
// and it's easier to store text directly than trying to get
@@ -670,21 +670,21 @@ public:
mText = chat.mText;
mTime = chat.mTime;
- //*TODO overly defensive thing, source type should be maintained out there
- if((chat.mFromID.isNull() && chat.mFromName.empty()) || (chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull()))
- {
- mSourceType = CHAT_SOURCE_SYSTEM;
- }
-
- mUserNameFont = style_params.font();
- if (!mUserNameTextBox)
- {
- mUserNameTextBox = getChild<LLTextBox>("user_name");
- mTimeBoxTextBox = getChild<LLTextBox>("time_box");
- }
- LLTextBox* user_name = mUserNameTextBox;
- user_name->setReadOnlyColor(style_params.readonly_color());
- user_name->setColor(style_params.color());
+ //*TODO overly defensive thing, source type should be maintained out there
+ if((chat.mFromID.isNull() && chat.mFromName.empty()) || (chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull()))
+ {
+ mSourceType = CHAT_SOURCE_SYSTEM;
+ }
+
+ mUserNameFont = style_params.font();
+ if (!mUserNameTextBox)
+ {
+ mUserNameTextBox = getChild<LLTextBox>("user_name");
+ mTimeBoxTextBox = getChild<LLTextBox>("time_box");
+ }
+ LLTextBox* user_name = mUserNameTextBox;
+ user_name->setReadOnlyColor(style_params.readonly_color());
+ user_name->setColor(style_params.color());
if (mSourceType == CHAT_SOURCE_TELEPORT
&& chat.mChatStyle == CHAT_STYLE_TELEPORT_SEP)
@@ -699,670 +699,670 @@ public:
}
else if (chat.mFromName.empty()
|| mSourceType == CHAT_SOURCE_SYSTEM)
- {
- mFrom = LLTrans::getString("SECOND_LIFE");
- if(!chat.mFromName.empty() && (mFrom != chat.mFromName))
- {
- mFrom += " (" + chat.mFromName + ")";
- }
- user_name->setValue(mFrom);
- updateMinUserNameWidth();
- }
- else if (mSourceType == CHAT_SOURCE_AGENT
- && !mAvatarID.isNull()
- && chat.mChatStyle != CHAT_STYLE_HISTORY)
- {
- // ...from a normal user, lookup the name and fill in later.
- // *NOTE: Do not do this for chat history logs, otherwise the viewer
- // will flood the People API with lookup requests on startup
-
- // Start with blank so sample data from XUI XML doesn't
- // flash on the screen
- user_name->setValue( LLSD() );
- fetchAvatarName();
- }
- else if (chat.mChatStyle == CHAT_STYLE_HISTORY ||
- mSourceType == CHAT_SOURCE_AGENT)
- {
- //if it's an avatar name with a username add formatting
- S32 username_start = chat.mFromName.rfind(" (");
- S32 username_end = chat.mFromName.rfind(')');
-
- if (username_start != std::string::npos &&
- username_end == (chat.mFromName.length() - 1))
- {
- mFrom = chat.mFromName.substr(0, username_start);
- user_name->setValue(mFrom);
-
- if (gSavedSettings.getBOOL("NameTagShowUsernames"))
- {
- std::string username = chat.mFromName.substr(username_start + 2);
- username = username.substr(0, username.length() - 1);
- LLStyle::Params style_params_name;
- LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
- style_params_name.color(userNameColor);
- style_params_name.font.name("SansSerifSmall");
- style_params_name.font.style("NORMAL");
- style_params_name.readonly_color(userNameColor);
- user_name->appendText(" - " + username, FALSE, style_params_name);
- }
- }
- else
- {
- mFrom = chat.mFromName;
- user_name->setValue(mFrom);
- updateMinUserNameWidth();
- }
- }
- else
- {
- // ...from an object, just use name as given
- mFrom = chat.mFromName;
- user_name->setValue(mFrom);
- updateMinUserNameWidth();
- }
-
-
- setTimeField(chat);
-
- // Set up the icon.
- LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
-
- if(mSourceType != CHAT_SOURCE_AGENT || mAvatarID.isNull())
- icon->setDrawTooltip(false);
-
- switch (mSourceType)
- {
- case CHAT_SOURCE_AGENT:
- icon->setValue(chat.mFromID);
- break;
- case CHAT_SOURCE_OBJECT:
- icon->setValue(LLSD("OBJECT_Icon"));
- break;
- case CHAT_SOURCE_SYSTEM:
- case CHAT_SOURCE_REGION:
- icon->setValue(LLSD("SL_Logo"));
- break;
- case CHAT_SOURCE_TELEPORT:
- icon->setValue(LLSD("Command_Destinations_Icon"));
- break;
- case CHAT_SOURCE_UNKNOWN:
- icon->setValue(LLSD("Unknown_Icon"));
- }
-
- // In case the message came from an object, save the object info
- // to be able properly show its profile.
- if ( chat.mSourceType == CHAT_SOURCE_OBJECT)
- {
- std::string slurl = args["slurl"].asString();
- if (slurl.empty() && LLWorld::instanceExists())
- {
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
- if(region)
- {
- LLSLURL region_slurl(region->getName(), chat.mPosAgent);
- slurl = region_slurl.getLocationString();
- }
- }
-
- LLSD payload;
- payload["object_id"] = chat.mFromID;
- payload["name"] = chat.mFromName;
- payload["owner_id"] = chat.mOwnerID;
- payload["slurl"] = LLWeb::escapeURL(slurl);
-
- mObjectData = payload;
- }
- }
-
- /*virtual*/ void draw()
- {
- LLTextBox* user_name = mUserNameTextBox; //getChild<LLTextBox>("user_name");
- LLTextBox* time_box = mTimeBoxTextBox; //getChild<LLTextBox>("time_box");
-
- LLRect user_name_rect = user_name->getRect();
- S32 user_name_width = user_name_rect.getWidth();
- S32 time_box_width = time_box->getRect().getWidth();
-
- if (mNeedsTimeBox && !time_box->getVisible() && user_name_width > mMinUserNameWidth)
- {
- user_name_rect.mRight -= time_box_width;
- user_name->reshape(user_name_rect.getWidth(), user_name_rect.getHeight());
- user_name->setRect(user_name_rect);
-
- time_box->setVisible(TRUE);
- }
-
- LLPanel::draw();
- }
-
- void updateMinUserNameWidth()
- {
- if (mUserNameFont)
- {
- LLTextBox* user_name = getChild<LLTextBox>("user_name");
- const LLWString& text = user_name->getWText();
- mMinUserNameWidth = mUserNameFont->getWidth(text.c_str()) + PADDING;
- }
- }
+ {
+ mFrom = LLTrans::getString("SECOND_LIFE");
+ if(!chat.mFromName.empty() && (mFrom != chat.mFromName))
+ {
+ mFrom += " (" + chat.mFromName + ")";
+ }
+ user_name->setValue(mFrom);
+ updateMinUserNameWidth();
+ }
+ else if (mSourceType == CHAT_SOURCE_AGENT
+ && !mAvatarID.isNull()
+ && chat.mChatStyle != CHAT_STYLE_HISTORY)
+ {
+ // ...from a normal user, lookup the name and fill in later.
+ // *NOTE: Do not do this for chat history logs, otherwise the viewer
+ // will flood the People API with lookup requests on startup
+
+ // Start with blank so sample data from XUI XML doesn't
+ // flash on the screen
+ user_name->setValue( LLSD() );
+ fetchAvatarName();
+ }
+ else if (chat.mChatStyle == CHAT_STYLE_HISTORY ||
+ mSourceType == CHAT_SOURCE_AGENT)
+ {
+ //if it's an avatar name with a username add formatting
+ S32 username_start = chat.mFromName.rfind(" (");
+ S32 username_end = chat.mFromName.rfind(')');
+
+ if (username_start != std::string::npos &&
+ username_end == (chat.mFromName.length() - 1))
+ {
+ mFrom = chat.mFromName.substr(0, username_start);
+ user_name->setValue(mFrom);
+
+ if (gSavedSettings.getBOOL("NameTagShowUsernames"))
+ {
+ std::string username = chat.mFromName.substr(username_start + 2);
+ username = username.substr(0, username.length() - 1);
+ LLStyle::Params style_params_name;
+ LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
+ style_params_name.color(userNameColor);
+ style_params_name.font.name("SansSerifSmall");
+ style_params_name.font.style("NORMAL");
+ style_params_name.readonly_color(userNameColor);
+ user_name->appendText(" - " + username, FALSE, style_params_name);
+ }
+ }
+ else
+ {
+ mFrom = chat.mFromName;
+ user_name->setValue(mFrom);
+ updateMinUserNameWidth();
+ }
+ }
+ else
+ {
+ // ...from an object, just use name as given
+ mFrom = chat.mFromName;
+ user_name->setValue(mFrom);
+ updateMinUserNameWidth();
+ }
+
+
+ setTimeField(chat);
+
+ // Set up the icon.
+ LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
+
+ if(mSourceType != CHAT_SOURCE_AGENT || mAvatarID.isNull())
+ icon->setDrawTooltip(false);
+
+ switch (mSourceType)
+ {
+ case CHAT_SOURCE_AGENT:
+ icon->setValue(chat.mFromID);
+ break;
+ case CHAT_SOURCE_OBJECT:
+ icon->setValue(LLSD("OBJECT_Icon"));
+ break;
+ case CHAT_SOURCE_SYSTEM:
+ case CHAT_SOURCE_REGION:
+ icon->setValue(LLSD("SL_Logo"));
+ break;
+ case CHAT_SOURCE_TELEPORT:
+ icon->setValue(LLSD("Command_Destinations_Icon"));
+ break;
+ case CHAT_SOURCE_UNKNOWN:
+ icon->setValue(LLSD("Unknown_Icon"));
+ }
+
+ // In case the message came from an object, save the object info
+ // to be able properly show its profile.
+ if ( chat.mSourceType == CHAT_SOURCE_OBJECT)
+ {
+ std::string slurl = args["slurl"].asString();
+ if (slurl.empty() && LLWorld::instanceExists())
+ {
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
+ if(region)
+ {
+ LLSLURL region_slurl(region->getName(), chat.mPosAgent);
+ slurl = region_slurl.getLocationString();
+ }
+ }
+
+ LLSD payload;
+ payload["object_id"] = chat.mFromID;
+ payload["name"] = chat.mFromName;
+ payload["owner_id"] = chat.mOwnerID;
+ payload["slurl"] = LLWeb::escapeURL(slurl);
+
+ mObjectData = payload;
+ }
+ }
+
+ /*virtual*/ void draw()
+ {
+ LLTextBox* user_name = mUserNameTextBox; //getChild<LLTextBox>("user_name");
+ LLTextBox* time_box = mTimeBoxTextBox; //getChild<LLTextBox>("time_box");
+
+ LLRect user_name_rect = user_name->getRect();
+ S32 user_name_width = user_name_rect.getWidth();
+ S32 time_box_width = time_box->getRect().getWidth();
+
+ if (mNeedsTimeBox && !time_box->getVisible() && user_name_width > mMinUserNameWidth)
+ {
+ user_name_rect.mRight -= time_box_width;
+ user_name->reshape(user_name_rect.getWidth(), user_name_rect.getHeight());
+ user_name->setRect(user_name_rect);
+
+ time_box->setVisible(TRUE);
+ }
+
+ LLPanel::draw();
+ }
+
+ void updateMinUserNameWidth()
+ {
+ if (mUserNameFont)
+ {
+ LLTextBox* user_name = getChild<LLTextBox>("user_name");
+ const LLWString& text = user_name->getWText();
+ mMinUserNameWidth = mUserNameFont->getWidth(text.c_str()) + PADDING;
+ }
+ }
protected:
- static const S32 PADDING = 20;
-
- void showContextMenu(S32 x,S32 y)
- {
- if(mSourceType == CHAT_SOURCE_SYSTEM)
- showSystemContextMenu(x,y);
- if(mAvatarID.notNull() && mSourceType == CHAT_SOURCE_AGENT)
- showAvatarContextMenu(x,y);
- if(mAvatarID.notNull() && mSourceType == CHAT_SOURCE_OBJECT)
- showObjectContextMenu(x,y);
- }
-
- void showSystemContextMenu(S32 x,S32 y)
- {
- }
-
- void showObjectContextMenu(S32 x,S32 y)
- {
- LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandleObject.get();
- if (!menu)
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar registrar_enable;
- registrar.add("ObjectIcon.Action", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemClicked, this, _2));
- registrar_enable.add("ObjectIcon.Visible", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemVisible, this, _2));
-
- menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_object_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if (menu)
- {
- mPopupMenuHandleObject = menu->getHandle();
- menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(this, menu, x, y);
- }
- else
- {
- LL_WARNS() << " Failed to create menu_object_icon.xml" << LL_ENDL;
- }
- }
- else
- {
- LLMenuGL::showPopup(this, menu, x, y);
- }
- }
-
- void showAvatarContextMenu(S32 x,S32 y)
- {
- LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandleAvatar.get();
- if (!menu)
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar registrar_enable;
- registrar.add("AvatarIcon.Action", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemClicked, this, _2));
- registrar_enable.add("AvatarIcon.Check", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemChecked, this, _2));
- registrar_enable.add("AvatarIcon.Enable", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemEnabled, this, _2));
- registrar_enable.add("AvatarIcon.Visible", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemVisible, this, _2));
-
- menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_avatar_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if (menu)
- {
- mPopupMenuHandleAvatar = menu->getHandle();
- }
- else
- {
- LL_WARNS() << " Failed to create menu_avatar_icon.xml" << LL_ENDL;
- }
- }
-
- if(menu)
- {
- bool is_friend = LLAvatarActions::isFriend(mAvatarID);
- bool is_group_session = gAgent.isInGroup(mSessionID);
-
- menu->setItemEnabled("Add Friend", !is_friend);
- menu->setItemEnabled("Remove Friend", is_friend);
- menu->setItemVisible("Moderator Options Separator", is_group_session && isGroupModerator());
- menu->setItemVisible("Moderator Options", is_group_session && isGroupModerator());
- menu->setItemVisible("Group Ban Separator", is_group_session && canBanInGroup());
- menu->setItemVisible("BanMember", is_group_session && canBanInGroup());
-
- if(gAgentID == mAvatarID)
- {
- menu->setItemEnabled("Add Friend", false);
- menu->setItemEnabled("Send IM", false);
- menu->setItemEnabled("Remove Friend", false);
- menu->setItemEnabled("Offer Teleport",false);
- menu->setItemEnabled("Request Teleport",false);
- menu->setItemEnabled("Voice Call", false);
- menu->setItemEnabled("Chat History", false);
- menu->setItemEnabled("Invite Group", false);
- menu->setItemEnabled("Zoom In", false);
- menu->setItemEnabled("Share", false);
- menu->setItemEnabled("Pay", false);
- menu->setItemEnabled("Block Unblock", false);
- menu->setItemEnabled("Mute Text", false);
- }
- else
- {
- LLUUID currentSessionID = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, mAvatarID);
- if (mSessionID == currentSessionID)
- {
- menu->setItemVisible("Send IM", false);
- }
- menu->setItemEnabled("Offer Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
- menu->setItemEnabled("Request Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
- menu->setItemEnabled("Voice Call", LLAvatarActions::canCall());
-
- // We should only show 'Zoom in' item in a nearby chat
- bool should_show_zoom = !LLIMModel::getInstance()->findIMSession(currentSessionID);
- menu->setItemVisible("Zoom In", should_show_zoom && gObjectList.findObject(mAvatarID));
- menu->setItemEnabled("Block Unblock", LLAvatarActions::canBlock(mAvatarID));
- menu->setItemEnabled("Mute Text", LLAvatarActions::canBlock(mAvatarID));
- menu->setItemEnabled("Chat History", LLLogChat::isTranscriptExist(mAvatarID));
- }
-
- menu->setItemEnabled("Map", (LLAvatarTracker::instance().isBuddyOnline(mAvatarID) && is_agent_mappable(mAvatarID)) || gAgent.isGodlike() );
- menu->buildDrawLabels();
- menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(this, menu, x, y);
- }
- }
-
- void showInfoCtrl()
- {
- const bool isVisible = !mAvatarID.isNull() && !mFrom.empty() && CHAT_SOURCE_SYSTEM != mSourceType && CHAT_SOURCE_REGION != mSourceType;
- if (isVisible)
- {
- const LLRect sticky_rect = mUserNameTextBox->getRect();
- S32 icon_x = llmin(sticky_rect.mLeft + mUserNameTextBox->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3);
- mInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - mInfoCtrl->getRect().getHeight() / 2 ) ;
- }
- mInfoCtrl->setVisible(isVisible);
- }
-
- void hideInfoCtrl()
- {
- mInfoCtrl->setVisible(FALSE);
- }
+ static const S32 PADDING = 20;
+
+ void showContextMenu(S32 x,S32 y)
+ {
+ if(mSourceType == CHAT_SOURCE_SYSTEM)
+ showSystemContextMenu(x,y);
+ if(mAvatarID.notNull() && mSourceType == CHAT_SOURCE_AGENT)
+ showAvatarContextMenu(x,y);
+ if(mAvatarID.notNull() && mSourceType == CHAT_SOURCE_OBJECT)
+ showObjectContextMenu(x,y);
+ }
+
+ void showSystemContextMenu(S32 x,S32 y)
+ {
+ }
+
+ void showObjectContextMenu(S32 x,S32 y)
+ {
+ LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandleObject.get();
+ if (!menu)
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar registrar_enable;
+ registrar.add("ObjectIcon.Action", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemClicked, this, _2));
+ registrar_enable.add("ObjectIcon.Visible", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemVisible, this, _2));
+
+ menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_object_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (menu)
+ {
+ mPopupMenuHandleObject = menu->getHandle();
+ menu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(this, menu, x, y);
+ }
+ else
+ {
+ LL_WARNS() << " Failed to create menu_object_icon.xml" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LLMenuGL::showPopup(this, menu, x, y);
+ }
+ }
+
+ void showAvatarContextMenu(S32 x,S32 y)
+ {
+ LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandleAvatar.get();
+ if (!menu)
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar registrar_enable;
+ registrar.add("AvatarIcon.Action", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemClicked, this, _2));
+ registrar_enable.add("AvatarIcon.Check", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemChecked, this, _2));
+ registrar_enable.add("AvatarIcon.Enable", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemEnabled, this, _2));
+ registrar_enable.add("AvatarIcon.Visible", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemVisible, this, _2));
+
+ menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_avatar_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (menu)
+ {
+ mPopupMenuHandleAvatar = menu->getHandle();
+ }
+ else
+ {
+ LL_WARNS() << " Failed to create menu_avatar_icon.xml" << LL_ENDL;
+ }
+ }
+
+ if(menu)
+ {
+ bool is_friend = LLAvatarActions::isFriend(mAvatarID);
+ bool is_group_session = gAgent.isInGroup(mSessionID);
+
+ menu->setItemEnabled("Add Friend", !is_friend);
+ menu->setItemEnabled("Remove Friend", is_friend);
+ menu->setItemVisible("Moderator Options Separator", is_group_session && isGroupModerator());
+ menu->setItemVisible("Moderator Options", is_group_session && isGroupModerator());
+ menu->setItemVisible("Group Ban Separator", is_group_session && canBanInGroup());
+ menu->setItemVisible("BanMember", is_group_session && canBanInGroup());
+
+ if(gAgentID == mAvatarID)
+ {
+ menu->setItemEnabled("Add Friend", false);
+ menu->setItemEnabled("Send IM", false);
+ menu->setItemEnabled("Remove Friend", false);
+ menu->setItemEnabled("Offer Teleport",false);
+ menu->setItemEnabled("Request Teleport",false);
+ menu->setItemEnabled("Voice Call", false);
+ menu->setItemEnabled("Chat History", false);
+ menu->setItemEnabled("Invite Group", false);
+ menu->setItemEnabled("Zoom In", false);
+ menu->setItemEnabled("Share", false);
+ menu->setItemEnabled("Pay", false);
+ menu->setItemEnabled("Block Unblock", false);
+ menu->setItemEnabled("Mute Text", false);
+ }
+ else
+ {
+ LLUUID currentSessionID = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, mAvatarID);
+ if (mSessionID == currentSessionID)
+ {
+ menu->setItemVisible("Send IM", false);
+ }
+ menu->setItemEnabled("Offer Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
+ menu->setItemEnabled("Request Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
+ menu->setItemEnabled("Voice Call", LLAvatarActions::canCall());
+
+ // We should only show 'Zoom in' item in a nearby chat
+ bool should_show_zoom = !LLIMModel::getInstance()->findIMSession(currentSessionID);
+ menu->setItemVisible("Zoom In", should_show_zoom && gObjectList.findObject(mAvatarID));
+ menu->setItemEnabled("Block Unblock", LLAvatarActions::canBlock(mAvatarID));
+ menu->setItemEnabled("Mute Text", LLAvatarActions::canBlock(mAvatarID));
+ menu->setItemEnabled("Chat History", LLLogChat::isTranscriptExist(mAvatarID));
+ }
+
+ menu->setItemEnabled("Map", (LLAvatarTracker::instance().isBuddyOnline(mAvatarID) && is_agent_mappable(mAvatarID)) || gAgent.isGodlike() );
+ menu->buildDrawLabels();
+ menu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(this, menu, x, y);
+ }
+ }
+
+ void showInfoCtrl()
+ {
+ const bool isVisible = !mAvatarID.isNull() && !mFrom.empty() && CHAT_SOURCE_SYSTEM != mSourceType && CHAT_SOURCE_REGION != mSourceType;
+ if (isVisible)
+ {
+ const LLRect sticky_rect = mUserNameTextBox->getRect();
+ S32 icon_x = llmin(sticky_rect.mLeft + mUserNameTextBox->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3);
+ mInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - mInfoCtrl->getRect().getHeight() / 2 ) ;
+ }
+ mInfoCtrl->setVisible(isVisible);
+ }
+
+ void hideInfoCtrl()
+ {
+ mInfoCtrl->setVisible(FALSE);
+ }
private:
- void setTimeField(const LLChat& chat)
- {
- LLTextBox* time_box = getChild<LLTextBox>("time_box");
-
- LLRect rect_before = time_box->getRect();
-
- time_box->setValue(chat.mTimeStr);
-
- // set necessary textbox width to fit all text
- time_box->reshapeToFitText();
- LLRect rect_after = time_box->getRect();
-
- // move rect to the left to correct position...
- S32 delta_pos_x = rect_before.getWidth() - rect_after.getWidth();
- S32 delta_pos_y = rect_before.getHeight() - rect_after.getHeight();
- time_box->translate(delta_pos_x, delta_pos_y);
-
- //... & change width of the name control
- LLView* user_name = getChild<LLView>("user_name");
- const LLRect& user_rect = user_name->getRect();
- user_name->reshape(user_rect.getWidth() + delta_pos_x, user_rect.getHeight());
- }
-
- void fetchAvatarName()
- {
- if (mAvatarID.notNull())
- {
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarID,
- boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2));
- }
- }
-
- void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
- {
- mAvatarNameCacheConnection.disconnect();
-
- mFrom = av_name.getDisplayName();
-
- LLTextBox* user_name = getChild<LLTextBox>("user_name");
- user_name->setValue( LLSD(av_name.getDisplayName() ) );
- user_name->setToolTip( av_name.getUserName() );
-
- if (gSavedSettings.getBOOL("NameTagShowUsernames") &&
- av_name.useDisplayNames() &&
- !av_name.isDisplayNameDefault())
- {
- LLStyle::Params style_params_name;
- LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
- style_params_name.color(userNameColor);
- style_params_name.font.name("SansSerifSmall");
- style_params_name.font.style("NORMAL");
- style_params_name.readonly_color(userNameColor);
- user_name->appendText(" - " + av_name.getUserName(), FALSE, style_params_name);
- }
- setToolTip( av_name.getUserName() );
- // name might have changed, update width
- updateMinUserNameWidth();
- }
+ void setTimeField(const LLChat& chat)
+ {
+ LLTextBox* time_box = getChild<LLTextBox>("time_box");
+
+ LLRect rect_before = time_box->getRect();
+
+ time_box->setValue(chat.mTimeStr);
+
+ // set necessary textbox width to fit all text
+ time_box->reshapeToFitText();
+ LLRect rect_after = time_box->getRect();
+
+ // move rect to the left to correct position...
+ S32 delta_pos_x = rect_before.getWidth() - rect_after.getWidth();
+ S32 delta_pos_y = rect_before.getHeight() - rect_after.getHeight();
+ time_box->translate(delta_pos_x, delta_pos_y);
+
+ //... & change width of the name control
+ LLView* user_name = getChild<LLView>("user_name");
+ const LLRect& user_rect = user_name->getRect();
+ user_name->reshape(user_rect.getWidth() + delta_pos_x, user_rect.getHeight());
+ }
+
+ void fetchAvatarName()
+ {
+ if (mAvatarID.notNull())
+ {
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarID,
+ boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2));
+ }
+ }
+
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
+ {
+ mAvatarNameCacheConnection.disconnect();
+
+ mFrom = av_name.getDisplayName();
+
+ LLTextBox* user_name = getChild<LLTextBox>("user_name");
+ user_name->setValue( LLSD(av_name.getDisplayName() ) );
+ user_name->setToolTip( av_name.getUserName() );
+
+ if (gSavedSettings.getBOOL("NameTagShowUsernames") &&
+ av_name.useDisplayNames() &&
+ !av_name.isDisplayNameDefault())
+ {
+ LLStyle::Params style_params_name;
+ LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
+ style_params_name.color(userNameColor);
+ style_params_name.font.name("SansSerifSmall");
+ style_params_name.font.style("NORMAL");
+ style_params_name.readonly_color(userNameColor);
+ user_name->appendText(" - " + av_name.getUserName(), FALSE, style_params_name);
+ }
+ setToolTip( av_name.getUserName() );
+ // name might have changed, update width
+ updateMinUserNameWidth();
+ }
protected:
- LLHandle<LLView> mPopupMenuHandleAvatar;
- LLHandle<LLView> mPopupMenuHandleObject;
+ LLHandle<LLView> mPopupMenuHandleAvatar;
+ LLHandle<LLView> mPopupMenuHandleObject;
- LLUICtrl* mInfoCtrl;
+ LLUICtrl* mInfoCtrl;
- LLUUID mAvatarID;
- LLSD mObjectData;
- EChatSourceType mSourceType;
- std::string mFrom;
- LLUUID mSessionID;
- std::string mText;
- F64 mTime; // IM's frame time
- time_t mCreationTime; // Views's time
+ LLUUID mAvatarID;
+ LLSD mObjectData;
+ EChatSourceType mSourceType;
+ std::string mFrom;
+ LLUUID mSessionID;
+ std::string mText;
+ F64 mTime; // IM's frame time
+ time_t mCreationTime; // Views's time
- S32 mMinUserNameWidth;
- const LLFontGL* mUserNameFont;
- LLTextBox* mUserNameTextBox;
- LLTextBox* mTimeBoxTextBox;
+ S32 mMinUserNameWidth;
+ const LLFontGL* mUserNameFont;
+ LLTextBox* mUserNameTextBox;
+ LLTextBox* mTimeBoxTextBox;
- bool mNeedsTimeBox;
+ bool mNeedsTimeBox;
private:
- boost::signals2::connection mAvatarNameCacheConnection;
+ boost::signals2::connection mAvatarNameCacheConnection;
};
LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
-: LLUICtrl(p),
- mMessageHeaderFilename(p.message_header),
- mMessageSeparatorFilename(p.message_separator),
- mLeftTextPad(p.left_text_pad),
- mRightTextPad(p.right_text_pad),
- mLeftWidgetPad(p.left_widget_pad),
- mRightWidgetPad(p.right_widget_pad),
- mTopSeparatorPad(p.top_separator_pad),
- mBottomSeparatorPad(p.bottom_separator_pad),
- mTopHeaderPad(p.top_header_pad),
- mBottomHeaderPad(p.bottom_header_pad),
- mIsLastMessageFromLog(false),
- mNotifyAboutUnreadMsg(p.notify_unread_msg)
+: LLUICtrl(p),
+ mMessageHeaderFilename(p.message_header),
+ mMessageSeparatorFilename(p.message_separator),
+ mLeftTextPad(p.left_text_pad),
+ mRightTextPad(p.right_text_pad),
+ mLeftWidgetPad(p.left_widget_pad),
+ mRightWidgetPad(p.right_widget_pad),
+ mTopSeparatorPad(p.top_separator_pad),
+ mBottomSeparatorPad(p.bottom_separator_pad),
+ mTopHeaderPad(p.top_header_pad),
+ mBottomHeaderPad(p.bottom_header_pad),
+ mIsLastMessageFromLog(false),
+ mNotifyAboutUnreadMsg(p.notify_unread_msg)
{
- LLTextEditor::Params editor_params(p);
- editor_params.rect = getLocalRect();
- editor_params.follows.flags = FOLLOWS_ALL;
- editor_params.enabled = false; // read only
- editor_params.show_context_menu = "true";
- editor_params.trusted_content = false;
- editor_params.text_valign = LLFontGL::VAlign::VCENTER;
- editor_params.use_color = true;
- mEditor = LLUICtrlFactory::create<LLTextEditor>(editor_params, this);
- mEditor->setIsFriendCallback(LLAvatarActions::isFriend);
- mEditor->setIsObjectBlockedCallback(boost::bind(&LLMuteList::isMuted, LLMuteList::getInstance(), _1, _2, 0));
+ LLTextEditor::Params editor_params(p);
+ editor_params.rect = getLocalRect();
+ editor_params.follows.flags = FOLLOWS_ALL;
+ editor_params.enabled = false; // read only
+ editor_params.show_context_menu = "true";
+ editor_params.trusted_content = false;
+ editor_params.text_valign = LLFontGL::VAlign::VCENTER;
+ editor_params.use_color = true;
+ mEditor = LLUICtrlFactory::create<LLTextEditor>(editor_params, this);
+ mEditor->setIsFriendCallback(LLAvatarActions::isFriend);
+ mEditor->setIsObjectBlockedCallback(boost::bind(&LLMuteList::isMuted, LLMuteList::getInstance(), _1, _2, 0));
}
LLSD LLChatHistory::getValue() const
{
- return LLSD(mEditor->getText());
+ return LLSD(mEditor->getText());
}
LLChatHistory::~LLChatHistory()
{
- this->clear();
+ this->clear();
}
void LLChatHistory::initFromParams(const LLChatHistory::Params& p)
{
- static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
-
- LLRect stack_rect = getLocalRect();
- stack_rect.mRight -= scrollbar_size;
- LLLayoutStack::Params layout_p;
- layout_p.rect = stack_rect;
- layout_p.follows.flags = FOLLOWS_ALL;
- layout_p.orientation = LLLayoutStack::VERTICAL;
- layout_p.mouse_opaque = false;
-
- LLLayoutStack* stackp = LLUICtrlFactory::create<LLLayoutStack>(layout_p, this);
-
- const S32 NEW_TEXT_NOTICE_HEIGHT = 20;
-
- LLLayoutPanel::Params panel_p;
- panel_p.name = "spacer";
- panel_p.background_visible = false;
- panel_p.has_border = false;
- panel_p.mouse_opaque = false;
- panel_p.min_dim = 30;
- panel_p.auto_resize = true;
- panel_p.user_resize = false;
-
- stackp->addPanel(LLUICtrlFactory::create<LLLayoutPanel>(panel_p), LLLayoutStack::ANIMATE);
-
- panel_p.name = "new_text_notice_holder";
- LLRect new_text_notice_rect = getLocalRect();
- new_text_notice_rect.mTop = new_text_notice_rect.mBottom + NEW_TEXT_NOTICE_HEIGHT;
- panel_p.rect = new_text_notice_rect;
- panel_p.background_opaque = true;
- panel_p.background_visible = true;
- panel_p.visible = false;
- panel_p.min_dim = 0;
- panel_p.auto_resize = false;
- panel_p.user_resize = false;
- mMoreChatPanel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
-
- LLTextBox::Params text_p(p.more_chat_text);
- text_p.rect = mMoreChatPanel->getLocalRect();
- text_p.follows.flags = FOLLOWS_ALL;
- text_p.name = "more_chat_text";
- mMoreChatText = LLUICtrlFactory::create<LLTextBox>(text_p, mMoreChatPanel);
- mMoreChatText->setClickedCallback(boost::bind(&LLChatHistory::onClickMoreText, this));
-
- stackp->addPanel(mMoreChatPanel, LLLayoutStack::ANIMATE);
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+ LLRect stack_rect = getLocalRect();
+ stack_rect.mRight -= scrollbar_size;
+ LLLayoutStack::Params layout_p;
+ layout_p.rect = stack_rect;
+ layout_p.follows.flags = FOLLOWS_ALL;
+ layout_p.orientation = LLLayoutStack::VERTICAL;
+ layout_p.mouse_opaque = false;
+
+ LLLayoutStack* stackp = LLUICtrlFactory::create<LLLayoutStack>(layout_p, this);
+
+ const S32 NEW_TEXT_NOTICE_HEIGHT = 20;
+
+ LLLayoutPanel::Params panel_p;
+ panel_p.name = "spacer";
+ panel_p.background_visible = false;
+ panel_p.has_border = false;
+ panel_p.mouse_opaque = false;
+ panel_p.min_dim = 30;
+ panel_p.auto_resize = true;
+ panel_p.user_resize = false;
+
+ stackp->addPanel(LLUICtrlFactory::create<LLLayoutPanel>(panel_p), LLLayoutStack::ANIMATE);
+
+ panel_p.name = "new_text_notice_holder";
+ LLRect new_text_notice_rect = getLocalRect();
+ new_text_notice_rect.mTop = new_text_notice_rect.mBottom + NEW_TEXT_NOTICE_HEIGHT;
+ panel_p.rect = new_text_notice_rect;
+ panel_p.background_opaque = true;
+ panel_p.background_visible = true;
+ panel_p.visible = false;
+ panel_p.min_dim = 0;
+ panel_p.auto_resize = false;
+ panel_p.user_resize = false;
+ mMoreChatPanel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
+
+ LLTextBox::Params text_p(p.more_chat_text);
+ text_p.rect = mMoreChatPanel->getLocalRect();
+ text_p.follows.flags = FOLLOWS_ALL;
+ text_p.name = "more_chat_text";
+ mMoreChatText = LLUICtrlFactory::create<LLTextBox>(text_p, mMoreChatPanel);
+ mMoreChatText->setClickedCallback(boost::bind(&LLChatHistory::onClickMoreText, this));
+
+ stackp->addPanel(mMoreChatPanel, LLLayoutStack::ANIMATE);
}
/*void LLChatHistory::updateTextRect()
{
- static LLUICachedControl<S32> texteditor_border ("UITextEditorBorder", 0);
-
- LLRect old_text_rect = mVisibleTextRect;
- mVisibleTextRect = mScroller->getContentWindowRect();
- mVisibleTextRect.stretch(-texteditor_border);
- mVisibleTextRect.mLeft += mLeftTextPad;
- mVisibleTextRect.mRight -= mRightTextPad;
- if (mVisibleTextRect != old_text_rect)
- {
- needsReflow();
- }
+ static LLUICachedControl<S32> texteditor_border ("UITextEditorBorder", 0);
+
+ LLRect old_text_rect = mVisibleTextRect;
+ mVisibleTextRect = mScroller->getContentWindowRect();
+ mVisibleTextRect.stretch(-texteditor_border);
+ mVisibleTextRect.mLeft += mLeftTextPad;
+ mVisibleTextRect.mRight -= mRightTextPad;
+ if (mVisibleTextRect != old_text_rect)
+ {
+ needsReflow();
+ }
}*/
LLView* LLChatHistory::getSeparator()
{
- LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance());
- return separator;
+ LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance());
+ return separator;
}
LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style_params, const LLSD& args)
{
- LLChatHistoryHeader* header = LLChatHistoryHeader::createInstance(mMessageHeaderFilename);
+ LLChatHistoryHeader* header = LLChatHistoryHeader::createInstance(mMessageHeaderFilename);
if (header)
header->setup(chat, style_params, args);
- return header;
+ return header;
}
void LLChatHistory::onClickMoreText()
{
- mEditor->endOfDoc();
+ mEditor->endOfDoc();
}
void LLChatHistory::clear()
{
- mLastFromName.clear();
- mEditor->clear();
- mLastFromID = LLUUID::null;
+ mLastFromName.clear();
+ mEditor->clear();
+ mLastFromID = LLUUID::null;
}
static LLTrace::BlockTimerStatHandle FTM_APPEND_MESSAGE("Append Chat Message");
void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LLStyle::Params& input_append_params)
{
- LL_RECORD_BLOCK_TIME(FTM_APPEND_MESSAGE);
- bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean();
- bool square_brackets = false; // square brackets necessary for a system messages
-
- llassert(mEditor);
- if (!mEditor)
- return;
-
- bool from_me = chat.mFromID == gAgent.getID();
- mEditor->setPlainText(use_plain_text_chat_history);
-
- if (mNotifyAboutUnreadMsg && !mEditor->scrolledToEnd() && !from_me && !chat.mFromName.empty())
- {
- mUnreadChatSources.insert(chat.mFromName);
- mMoreChatPanel->setVisible(TRUE);
- std::string chatters;
- for (const std::string& source : mUnreadChatSources)
- {
- chatters += chatters.size() ? ", " + source : source;
- }
- LLStringUtil::format_map_t args;
- args["SOURCES"] = chatters;
-
- std::string xml_desc = mUnreadChatSources.size() == 1 ?
- "unread_chat_single" : "unread_chat_multiple";
- mMoreChatText->setValue(LLTrans::getString(xml_desc, args));
- S32 height = mMoreChatText->getTextPixelHeight() + 5;
- mMoreChatPanel->reshape(mMoreChatPanel->getRect().getWidth(), height);
- }
-
- LLColor4 txt_color = LLUIColorTable::instance().getColor("White");
- LLColor4 name_color(txt_color);
-
- LLViewerChat::getChatColor(chat,txt_color);
- LLFontGL* fontp = LLViewerChat::getChatFont();
- std::string font_name = LLFontGL::nameFromFont(fontp);
- std::string font_size = LLFontGL::sizeFromFont(fontp);
-
- LLStyle::Params body_message_params;
- body_message_params.color(txt_color);
- body_message_params.readonly_color(txt_color);
- body_message_params.font.name(font_name);
- body_message_params.font.size(font_size);
- body_message_params.font.style(input_append_params.font.style);
-
- LLStyle::Params name_params(body_message_params);
- name_params.color(name_color);
- name_params.readonly_color(name_color);
-
- std::string prefix = chat.mText.substr(0, 4);
-
- //IRC styled /me messages.
- bool irc_me = prefix == "/me " || prefix == "/me'";
-
- // Delimiter after a name in header copy/past and in plain text mode
- std::string delimiter = ": ";
- std::string shout = LLTrans::getString("shout");
- std::string whisper = LLTrans::getString("whisper");
- if (chat.mChatType == CHAT_TYPE_SHOUT ||
- chat.mChatType == CHAT_TYPE_WHISPER ||
- chat.mText.compare(0, shout.length(), shout) == 0 ||
- chat.mText.compare(0, whisper.length(), whisper) == 0)
- {
- delimiter = " ";
- }
-
- // Don't add any delimiter after name in irc styled messages
- if (irc_me || chat.mChatStyle == CHAT_STYLE_IRC)
- {
- delimiter = LLStringUtil::null;
- body_message_params.font.style = "ITALIC";
- }
-
- if (chat.mChatType == CHAT_TYPE_WHISPER)
- {
- body_message_params.font.style = "ITALIC";
- }
- else if (chat.mChatType == CHAT_TYPE_SHOUT)
- {
- body_message_params.font.style = "BOLD";
- }
-
- bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY;
- bool teleport_separator = chat.mSourceType == CHAT_SOURCE_TELEPORT;
- // We graying out chat history by graying out messages that contains full date in a time string
- if (message_from_log)
- {
- txt_color = LLColor4::grey;
- body_message_params.color(txt_color);
- body_message_params.readonly_color(txt_color);
- name_params.color(txt_color);
- name_params.readonly_color(txt_color);
- }
-
- bool prependNewLineState = mEditor->getText().size() != 0;
-
- // compact mode: show a timestamp and name
- if (use_plain_text_chat_history)
- {
- square_brackets = chat.mSourceType == CHAT_SOURCE_SYSTEM;
-
- LLStyle::Params timestamp_style(body_message_params);
-
- // out of the timestamp
- if (args["show_time"].asBoolean() && !teleport_separator)
- {
- if (!message_from_log)
- {
- LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor");
- timestamp_style.color(timestamp_color);
- timestamp_style.readonly_color(timestamp_color);
- }
- mEditor->appendText("[" + chat.mTimeStr + "] ", prependNewLineState, timestamp_style);
- prependNewLineState = false;
- }
+ LL_RECORD_BLOCK_TIME(FTM_APPEND_MESSAGE);
+ bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean();
+ bool square_brackets = false; // square brackets necessary for a system messages
+
+ llassert(mEditor);
+ if (!mEditor)
+ return;
+
+ bool from_me = chat.mFromID == gAgent.getID();
+ mEditor->setPlainText(use_plain_text_chat_history);
+
+ if (mNotifyAboutUnreadMsg && !mEditor->scrolledToEnd() && !from_me && !chat.mFromName.empty())
+ {
+ mUnreadChatSources.insert(chat.mFromName);
+ mMoreChatPanel->setVisible(TRUE);
+ std::string chatters;
+ for (const std::string& source : mUnreadChatSources)
+ {
+ chatters += chatters.size() ? ", " + source : source;
+ }
+ LLStringUtil::format_map_t args;
+ args["SOURCES"] = chatters;
+
+ std::string xml_desc = mUnreadChatSources.size() == 1 ?
+ "unread_chat_single" : "unread_chat_multiple";
+ mMoreChatText->setValue(LLTrans::getString(xml_desc, args));
+ S32 height = mMoreChatText->getTextPixelHeight() + 5;
+ mMoreChatPanel->reshape(mMoreChatPanel->getRect().getWidth(), height);
+ }
+
+ LLColor4 txt_color = LLUIColorTable::instance().getColor("White");
+ LLColor4 name_color(txt_color);
+
+ LLViewerChat::getChatColor(chat,txt_color);
+ LLFontGL* fontp = LLViewerChat::getChatFont();
+ std::string font_name = LLFontGL::nameFromFont(fontp);
+ std::string font_size = LLFontGL::sizeFromFont(fontp);
+
+ LLStyle::Params body_message_params;
+ body_message_params.color(txt_color);
+ body_message_params.readonly_color(txt_color);
+ body_message_params.font.name(font_name);
+ body_message_params.font.size(font_size);
+ body_message_params.font.style(input_append_params.font.style);
+
+ LLStyle::Params name_params(body_message_params);
+ name_params.color(name_color);
+ name_params.readonly_color(name_color);
+
+ std::string prefix = chat.mText.substr(0, 4);
+
+ //IRC styled /me messages.
+ bool irc_me = prefix == "/me " || prefix == "/me'";
+
+ // Delimiter after a name in header copy/past and in plain text mode
+ std::string delimiter = ": ";
+ std::string shout = LLTrans::getString("shout");
+ std::string whisper = LLTrans::getString("whisper");
+ if (chat.mChatType == CHAT_TYPE_SHOUT ||
+ chat.mChatType == CHAT_TYPE_WHISPER ||
+ chat.mText.compare(0, shout.length(), shout) == 0 ||
+ chat.mText.compare(0, whisper.length(), whisper) == 0)
+ {
+ delimiter = " ";
+ }
+
+ // Don't add any delimiter after name in irc styled messages
+ if (irc_me || chat.mChatStyle == CHAT_STYLE_IRC)
+ {
+ delimiter = LLStringUtil::null;
+ body_message_params.font.style = "ITALIC";
+ }
+
+ if (chat.mChatType == CHAT_TYPE_WHISPER)
+ {
+ body_message_params.font.style = "ITALIC";
+ }
+ else if (chat.mChatType == CHAT_TYPE_SHOUT)
+ {
+ body_message_params.font.style = "BOLD";
+ }
+
+ bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY;
+ bool teleport_separator = chat.mSourceType == CHAT_SOURCE_TELEPORT;
+ // We graying out chat history by graying out messages that contains full date in a time string
+ if (message_from_log)
+ {
+ txt_color = LLColor4::grey;
+ body_message_params.color(txt_color);
+ body_message_params.readonly_color(txt_color);
+ name_params.color(txt_color);
+ name_params.readonly_color(txt_color);
+ }
+
+ bool prependNewLineState = mEditor->getText().size() != 0;
+
+ // compact mode: show a timestamp and name
+ if (use_plain_text_chat_history)
+ {
+ square_brackets = chat.mSourceType == CHAT_SOURCE_SYSTEM;
+
+ LLStyle::Params timestamp_style(body_message_params);
+
+ // out of the timestamp
+ if (args["show_time"].asBoolean() && !teleport_separator)
+ {
+ if (!message_from_log)
+ {
+ LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor");
+ timestamp_style.color(timestamp_color);
+ timestamp_style.readonly_color(timestamp_color);
+ }
+ mEditor->appendText("[" + chat.mTimeStr + "] ", prependNewLineState, timestamp_style);
+ prependNewLineState = false;
+ }
// out the opening square bracket (if need)
- if (square_brackets)
- {
- mEditor->appendText("[", prependNewLineState, body_message_params);
- prependNewLineState = false;
- }
-
- // names showing
- if (args["show_names_for_p2p_conv"].asBoolean() && utf8str_trim(chat.mFromName).size())
- {
- // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
- if (chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull())
- {
- // for object IMs, create a secondlife:///app/objectim SLapp
- std::string url = LLViewerChat::getSenderSLURL(chat, args);
-
- // set the link for the object name to be the objectim SLapp
- // (don't let object names with hyperlinks override our objectim Url)
- LLStyle::Params link_params(body_message_params);
- LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
- link_params.color = link_color;
- link_params.readonly_color = link_color;
- link_params.is_link = true;
- link_params.link_href = url;
-
- mEditor->appendText(chat.mFromName + delimiter, prependNewLineState, link_params);
- prependNewLineState = false;
- }
- else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log && chat.mSourceType != CHAT_SOURCE_REGION)
- {
- LLStyle::Params link_params(body_message_params);
- link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID));
-
- // Add link to avatar's inspector and delimiter to message.
- mEditor->appendText(std::string(link_params.link_href) + delimiter,
- prependNewLineState, link_params);
- prependNewLineState = false;
- }
+ if (square_brackets)
+ {
+ mEditor->appendText("[", prependNewLineState, body_message_params);
+ prependNewLineState = false;
+ }
+
+ // names showing
+ if (args["show_names_for_p2p_conv"].asBoolean() && utf8str_trim(chat.mFromName).size())
+ {
+ // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
+ if (chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull())
+ {
+ // for object IMs, create a secondlife:///app/objectim SLapp
+ std::string url = LLViewerChat::getSenderSLURL(chat, args);
+
+ // set the link for the object name to be the objectim SLapp
+ // (don't let object names with hyperlinks override our objectim Url)
+ LLStyle::Params link_params(body_message_params);
+ LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
+ link_params.color = link_color;
+ link_params.readonly_color = link_color;
+ link_params.is_link = true;
+ link_params.link_href = url;
+
+ mEditor->appendText(chat.mFromName + delimiter, prependNewLineState, link_params);
+ prependNewLineState = false;
+ }
+ else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log && chat.mSourceType != CHAT_SOURCE_REGION)
+ {
+ LLStyle::Params link_params(body_message_params);
+ link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID));
+
+ // Add link to avatar's inspector and delimiter to message.
+ mEditor->appendText(std::string(link_params.link_href) + delimiter,
+ prependNewLineState, link_params);
+ prependNewLineState = false;
+ }
else if (teleport_separator)
{
std::string tp_text = LLTrans::getString("teleport_preamble_compact_chat");
@@ -1370,32 +1370,32 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
prependNewLineState, body_message_params);
prependNewLineState = false;
}
- else
- {
- mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter,
- prependNewLineState, body_message_params);
- prependNewLineState = false;
- }
- }
- }
- else // showing timestamp and name in the expanded mode
- {
- prependNewLineState = false;
- LLView* view = NULL;
- LLInlineViewSegment::Params p;
- p.force_newline = true;
- p.left_pad = mLeftWidgetPad;
- p.right_pad = mRightWidgetPad;
-
- LLDate new_message_time = LLDate::now();
- if (!teleport_separator
- && mLastFromName == chat.mFromName
- && mLastFromID == chat.mFromID
- && mLastMessageTime.notNull()
- && (new_message_time.secondsSinceEpoch() - mLastMessageTime.secondsSinceEpoch()) < 60.0
- && mIsLastMessageFromLog == message_from_log) //distinguish between current and previous chat session's histories
- {
- view = getSeparator();
+ else
+ {
+ mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter,
+ prependNewLineState, body_message_params);
+ prependNewLineState = false;
+ }
+ }
+ }
+ else // showing timestamp and name in the expanded mode
+ {
+ prependNewLineState = false;
+ LLView* view = NULL;
+ LLInlineViewSegment::Params p;
+ p.force_newline = true;
+ p.left_pad = mLeftWidgetPad;
+ p.right_pad = mRightWidgetPad;
+
+ LLDate new_message_time = LLDate::now();
+ if (!teleport_separator
+ && mLastFromName == chat.mFromName
+ && mLastFromID == chat.mFromID
+ && mLastMessageTime.notNull()
+ && (new_message_time.secondsSinceEpoch() - mLastMessageTime.secondsSinceEpoch()) < 60.0
+ && mIsLastMessageFromLog == message_from_log) //distinguish between current and previous chat session's histories
+ {
+ view = getSeparator();
if (!view)
{
// Might be wiser to make this LL_ERRS, getSeparator() should work in case of correct instalation.
@@ -1403,146 +1403,146 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
return;
}
- p.top_pad = mTopSeparatorPad;
- p.bottom_pad = mBottomSeparatorPad;
- }
- else
- {
- view = getHeader(chat, name_params, args);
- if (!view)
- {
- LL_WARNS() << "Failed to create header from " << mMessageHeaderFilename << ": can't append to history" << LL_ENDL;
- return;
- }
-
- p.top_pad = mEditor->getLength() ? mTopHeaderPad : 0;
- p.bottom_pad = teleport_separator ? mBottomSeparatorPad : mBottomHeaderPad;
- }
- p.view = view;
-
- //Prepare the rect for the view
- LLRect target_rect = mEditor->getDocumentView()->getRect();
- // squeeze down the widget by subtracting padding off left and right
- target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad();
- target_rect.mRight -= mRightWidgetPad;
- view->reshape(target_rect.getWidth(), view->getRect().getHeight());
- view->setOrigin(target_rect.mLeft, view->getRect().mBottom);
-
- std::string widget_associated_text = "\n[" + chat.mTimeStr + "] ";
- if (utf8str_trim(chat.mFromName).size() != 0 && chat.mFromName != SYSTEM_FROM)
- widget_associated_text += chat.mFromName + delimiter;
-
- mEditor->appendWidget(p, widget_associated_text, false);
- mLastFromName = chat.mFromName;
- mLastFromID = chat.mFromID;
- mLastMessageTime = new_message_time;
- mIsLastMessageFromLog = message_from_log;
- }
-
- // body of the message processing
-
- // notify processing
- if (chat.mNotifId.notNull())
- {
- LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId);
- if (notification != NULL)
- {
- bool create_toast = true;
- if (notification->getName() == "OfferFriendship")
- {
- // We don't want multiple friendship offers to appear, this code checks if there are previous offers
- // by iterating though all panels.
- // Note: it might be better to simply add a "pending offer" flag somewhere
- for (auto& panel : LLToastNotifyPanel::instance_snapshot())
- {
- LLIMToastNotifyPanel * imtoastp = dynamic_cast<LLIMToastNotifyPanel *>(&panel);
- const std::string& notification_name = panel.getNotificationName();
- if (notification_name == "OfferFriendship"
- && panel.isControlPanelEnabled()
- && imtoastp)
- {
- create_toast = false;
- break;
- }
- }
- }
-
- if (create_toast)
- {
- LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel(
- notification, chat.mSessionID, LLRect::null, !use_plain_text_chat_history, mEditor);
-
- //Prepare the rect for the view
- LLRect target_rect = mEditor->getDocumentView()->getRect();
- // squeeze down the widget by subtracting padding off left and right
- target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad();
- target_rect.mRight -= mRightWidgetPad;
- notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight());
- notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom);
-
- LLInlineViewSegment::Params params;
- params.view = notify_box;
- params.left_pad = mLeftWidgetPad;
- params.right_pad = mRightWidgetPad;
- mEditor->appendWidget(params, "\n", false);
- }
- }
- }
- // usual messages showing
- else if (!teleport_separator)
- {
- std::string message = irc_me ? chat.mText.substr(3) : chat.mText;
-
- //MESSAGE TEXT PROCESSING
- //*HACK getting rid of redundant sender names in system notifications sent using sender name (see EXT-5010)
- if (use_plain_text_chat_history && !from_me && chat.mFromID.notNull())
- {
- std::string slurl_about = SLURL_APP_AGENT + chat.mFromID.asString() + SLURL_ABOUT;
- if (message.length() > slurl_about.length() &&
- message.compare(0, slurl_about.length(), slurl_about) == 0)
- {
- message = message.substr(slurl_about.length(), message.length()-1);
- }
- }
-
- if (irc_me && !use_plain_text_chat_history)
- {
- std::string from_name = chat.mFromName;
- LLAvatarName av_name;
- if (!chat.mFromID.isNull() &&
- LLAvatarNameCache::get(chat.mFromID, &av_name) &&
- !av_name.isDisplayNameDefault())
- {
- from_name = av_name.getCompleteName();
- }
- message = from_name + message;
- }
-
- if (square_brackets)
- {
- message += "]";
- }
-
- mEditor->appendText(message, prependNewLineState, body_message_params);
- prependNewLineState = false;
- }
-
- mEditor->blockUndo();
-
- // automatically scroll to end when receiving chat from myself
- if (from_me)
- {
- mEditor->setCursorAndScrollToEnd();
- }
+ p.top_pad = mTopSeparatorPad;
+ p.bottom_pad = mBottomSeparatorPad;
+ }
+ else
+ {
+ view = getHeader(chat, name_params, args);
+ if (!view)
+ {
+ LL_WARNS() << "Failed to create header from " << mMessageHeaderFilename << ": can't append to history" << LL_ENDL;
+ return;
+ }
+
+ p.top_pad = mEditor->getLength() ? mTopHeaderPad : 0;
+ p.bottom_pad = teleport_separator ? mBottomSeparatorPad : mBottomHeaderPad;
+ }
+ p.view = view;
+
+ //Prepare the rect for the view
+ LLRect target_rect = mEditor->getDocumentView()->getRect();
+ // squeeze down the widget by subtracting padding off left and right
+ target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad();
+ target_rect.mRight -= mRightWidgetPad;
+ view->reshape(target_rect.getWidth(), view->getRect().getHeight());
+ view->setOrigin(target_rect.mLeft, view->getRect().mBottom);
+
+ std::string widget_associated_text = "\n[" + chat.mTimeStr + "] ";
+ if (utf8str_trim(chat.mFromName).size() != 0 && chat.mFromName != SYSTEM_FROM)
+ widget_associated_text += chat.mFromName + delimiter;
+
+ mEditor->appendWidget(p, widget_associated_text, false);
+ mLastFromName = chat.mFromName;
+ mLastFromID = chat.mFromID;
+ mLastMessageTime = new_message_time;
+ mIsLastMessageFromLog = message_from_log;
+ }
+
+ // body of the message processing
+
+ // notify processing
+ if (chat.mNotifId.notNull())
+ {
+ LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId);
+ if (notification != NULL)
+ {
+ bool create_toast = true;
+ if (notification->getName() == "OfferFriendship")
+ {
+ // We don't want multiple friendship offers to appear, this code checks if there are previous offers
+ // by iterating though all panels.
+ // Note: it might be better to simply add a "pending offer" flag somewhere
+ for (auto& panel : LLToastNotifyPanel::instance_snapshot())
+ {
+ LLIMToastNotifyPanel * imtoastp = dynamic_cast<LLIMToastNotifyPanel *>(&panel);
+ const std::string& notification_name = panel.getNotificationName();
+ if (notification_name == "OfferFriendship"
+ && panel.isControlPanelEnabled()
+ && imtoastp)
+ {
+ create_toast = false;
+ break;
+ }
+ }
+ }
+
+ if (create_toast)
+ {
+ LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel(
+ notification, chat.mSessionID, LLRect::null, !use_plain_text_chat_history, mEditor);
+
+ //Prepare the rect for the view
+ LLRect target_rect = mEditor->getDocumentView()->getRect();
+ // squeeze down the widget by subtracting padding off left and right
+ target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad();
+ target_rect.mRight -= mRightWidgetPad;
+ notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight());
+ notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom);
+
+ LLInlineViewSegment::Params params;
+ params.view = notify_box;
+ params.left_pad = mLeftWidgetPad;
+ params.right_pad = mRightWidgetPad;
+ mEditor->appendWidget(params, "\n", false);
+ }
+ }
+ }
+ // usual messages showing
+ else if (!teleport_separator)
+ {
+ std::string message = irc_me ? chat.mText.substr(3) : chat.mText;
+
+ //MESSAGE TEXT PROCESSING
+ //*HACK getting rid of redundant sender names in system notifications sent using sender name (see EXT-5010)
+ if (use_plain_text_chat_history && !from_me && chat.mFromID.notNull())
+ {
+ std::string slurl_about = SLURL_APP_AGENT + chat.mFromID.asString() + SLURL_ABOUT;
+ if (message.length() > slurl_about.length() &&
+ message.compare(0, slurl_about.length(), slurl_about) == 0)
+ {
+ message = message.substr(slurl_about.length(), message.length()-1);
+ }
+ }
+
+ if (irc_me && !use_plain_text_chat_history)
+ {
+ std::string from_name = chat.mFromName;
+ LLAvatarName av_name;
+ if (!chat.mFromID.isNull() &&
+ LLAvatarNameCache::get(chat.mFromID, &av_name) &&
+ !av_name.isDisplayNameDefault())
+ {
+ from_name = av_name.getCompleteName();
+ }
+ message = from_name + message;
+ }
+
+ if (square_brackets)
+ {
+ message += "]";
+ }
+
+ mEditor->appendText(message, prependNewLineState, body_message_params);
+ prependNewLineState = false;
+ }
+
+ mEditor->blockUndo();
+
+ // automatically scroll to end when receiving chat from myself
+ if (from_me)
+ {
+ mEditor->setCursorAndScrollToEnd();
+ }
}
void LLChatHistory::draw()
{
- if (mEditor->scrolledToEnd())
- {
- mUnreadChatSources.clear();
- mMoreChatPanel->setVisible(FALSE);
- }
+ if (mEditor->scrolledToEnd())
+ {
+ mUnreadChatSources.clear();
+ mMoreChatPanel->setVisible(FALSE);
+ }
- LLUICtrl::draw();
+ LLUICtrl::draw();
}
diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h
index 44736a0489..b8364ff860 100644
--- a/indra/newview/llchathistory.h
+++ b/indra/newview/llchathistory.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchathistory.h
* @brief LLTextEditor base class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,122 +31,122 @@
#include "lltextbox.h"
#include "llviewerchat.h"
-//Chat log widget allowing addition of a message as a widget
+//Chat log widget allowing addition of a message as a widget
class LLChatHistory : public LLUICtrl
{
- public:
- struct Params : public LLInitParam::Block<Params, LLTextEditor::Params>
- {
- //Message header filename
- Optional<std::string> message_header;
- //Message separator filename
- Optional<std::string> message_separator;
- //Text left padding from the scroll rect
- Optional<S32> left_text_pad;
- //Text right padding from the scroll rect
- Optional<S32> right_text_pad;
- //Widget left padding from the scroll rect
- Optional<S32> left_widget_pad;
- //Widget right padding from the scroll rect
- Optional<S32> right_widget_pad;
- //Separator top padding
- Optional<S32> top_separator_pad;
- //Separator bottom padding
- Optional<S32> bottom_separator_pad;
- //Header top padding
- Optional<S32> top_header_pad;
- //Header bottom padding
- Optional<S32> bottom_header_pad;
-
- Optional<LLTextBox::Params> more_chat_text;
-
- Optional<bool> notify_unread_msg;
-
- Params()
- : message_header("message_header"),
- message_separator("message_separator"),
- left_text_pad("left_text_pad"),
- right_text_pad("right_text_pad"),
- left_widget_pad("left_widget_pad"),
- right_widget_pad("right_widget_pad"),
- top_separator_pad("top_separator_pad"),
- bottom_separator_pad("bottom_separator_pad"),
- top_header_pad("top_header_pad"),
- bottom_header_pad("bottom_header_pad"),
- more_chat_text("more_chat_text"),
- notify_unread_msg("notify_unread_msg", true)
- {}
-
- };
- protected:
- LLChatHistory(const Params&);
- friend class LLUICtrlFactory;
-
- /*virtual*/ void draw();
- /**
- * Redefinition of LLTextEditor::updateTextRect() to considerate text
- * left/right padding params.
- */
- //virtual void updateTextRect();
- /**
- * Builds a message separator.
- * @return pointer to LLView separator object.
- */
- LLView* getSeparator();
-
- void onClickMoreText();
-
- private:
- /**
- * Builds a message header.
- * @return pointer to LLView header object.
- */
- LLView* getHeader(const LLChat& chat,const LLStyle::Params& style_params, const LLSD& args);
- public:
- ~LLChatHistory();
- LLSD getValue() const;
- void initFromParams(const Params&);
-
- /**
- * Appends a widget message.
- * If last user appended message, concurs with current user,
- * separator is added before the message, otherwise header is added.
- * The args LLSD contains:
- * - use_plain_text_chat_history (bool) - whether to add message as plain text.
- * - owner_id (LLUUID) - the owner ID for object chat
- * @param chat - base chat message.
- * @param args - additional arguments
- * @param input_append_params - font style.
- */
- void appendMessage(const LLChat& chat, const LLSD &args = LLSD(), const LLStyle::Params& input_append_params = LLStyle::Params());
- /*virtual*/ void clear();
-
- private:
- std::string mLastFromName;
- LLUUID mLastFromID;
- LLDate mLastMessageTime;
- bool mIsLastMessageFromLog;
- bool mNotifyAboutUnreadMsg;
- //std::string mLastMessageTimeStr;
-
- std::string mMessageHeaderFilename;
- std::string mMessageSeparatorFilename;
-
- S32 mLeftTextPad;
- S32 mRightTextPad;
-
- S32 mLeftWidgetPad;
- S32 mRightWidgetPad;
-
- S32 mTopSeparatorPad;
- S32 mBottomSeparatorPad;
- S32 mTopHeaderPad;
- S32 mBottomHeaderPad;
-
- class LLLayoutPanel* mMoreChatPanel;
- LLTextBox* mMoreChatText;
- LLTextEditor* mEditor;
- typedef std::set<std::string> unread_chat_source_t;
- unread_chat_source_t mUnreadChatSources;
+ public:
+ struct Params : public LLInitParam::Block<Params, LLTextEditor::Params>
+ {
+ //Message header filename
+ Optional<std::string> message_header;
+ //Message separator filename
+ Optional<std::string> message_separator;
+ //Text left padding from the scroll rect
+ Optional<S32> left_text_pad;
+ //Text right padding from the scroll rect
+ Optional<S32> right_text_pad;
+ //Widget left padding from the scroll rect
+ Optional<S32> left_widget_pad;
+ //Widget right padding from the scroll rect
+ Optional<S32> right_widget_pad;
+ //Separator top padding
+ Optional<S32> top_separator_pad;
+ //Separator bottom padding
+ Optional<S32> bottom_separator_pad;
+ //Header top padding
+ Optional<S32> top_header_pad;
+ //Header bottom padding
+ Optional<S32> bottom_header_pad;
+
+ Optional<LLTextBox::Params> more_chat_text;
+
+ Optional<bool> notify_unread_msg;
+
+ Params()
+ : message_header("message_header"),
+ message_separator("message_separator"),
+ left_text_pad("left_text_pad"),
+ right_text_pad("right_text_pad"),
+ left_widget_pad("left_widget_pad"),
+ right_widget_pad("right_widget_pad"),
+ top_separator_pad("top_separator_pad"),
+ bottom_separator_pad("bottom_separator_pad"),
+ top_header_pad("top_header_pad"),
+ bottom_header_pad("bottom_header_pad"),
+ more_chat_text("more_chat_text"),
+ notify_unread_msg("notify_unread_msg", true)
+ {}
+
+ };
+ protected:
+ LLChatHistory(const Params&);
+ friend class LLUICtrlFactory;
+
+ /*virtual*/ void draw();
+ /**
+ * Redefinition of LLTextEditor::updateTextRect() to considerate text
+ * left/right padding params.
+ */
+ //virtual void updateTextRect();
+ /**
+ * Builds a message separator.
+ * @return pointer to LLView separator object.
+ */
+ LLView* getSeparator();
+
+ void onClickMoreText();
+
+ private:
+ /**
+ * Builds a message header.
+ * @return pointer to LLView header object.
+ */
+ LLView* getHeader(const LLChat& chat,const LLStyle::Params& style_params, const LLSD& args);
+ public:
+ ~LLChatHistory();
+ LLSD getValue() const;
+ void initFromParams(const Params&);
+
+ /**
+ * Appends a widget message.
+ * If last user appended message, concurs with current user,
+ * separator is added before the message, otherwise header is added.
+ * The args LLSD contains:
+ * - use_plain_text_chat_history (bool) - whether to add message as plain text.
+ * - owner_id (LLUUID) - the owner ID for object chat
+ * @param chat - base chat message.
+ * @param args - additional arguments
+ * @param input_append_params - font style.
+ */
+ void appendMessage(const LLChat& chat, const LLSD &args = LLSD(), const LLStyle::Params& input_append_params = LLStyle::Params());
+ /*virtual*/ void clear();
+
+ private:
+ std::string mLastFromName;
+ LLUUID mLastFromID;
+ LLDate mLastMessageTime;
+ bool mIsLastMessageFromLog;
+ bool mNotifyAboutUnreadMsg;
+ //std::string mLastMessageTimeStr;
+
+ std::string mMessageHeaderFilename;
+ std::string mMessageSeparatorFilename;
+
+ S32 mLeftTextPad;
+ S32 mRightTextPad;
+
+ S32 mLeftWidgetPad;
+ S32 mRightWidgetPad;
+
+ S32 mTopSeparatorPad;
+ S32 mBottomSeparatorPad;
+ S32 mTopHeaderPad;
+ S32 mBottomHeaderPad;
+
+ class LLLayoutPanel* mMoreChatPanel;
+ LLTextBox* mMoreChatText;
+ LLTextEditor* mEditor;
+ typedef std::set<std::string> unread_chat_source_t;
+ unread_chat_source_t mUnreadChatSources;
};
#endif /* LLCHATHISTORY_H_ */
diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp
index dc2cc57f0f..2b875c708d 100644
--- a/indra/newview/llchatitemscontainerctrl.cpp
+++ b/indra/newview/llchatitemscontainerctrl.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchatitemscontainer.cpp
* @brief chat history scrolling panel implementation
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,28 +55,28 @@ static const S32 msg_height_pad = 5;
class LLObjectHandler : public LLCommandHandler
{
public:
- LLObjectHandler() : LLCommandHandler("object", UNTRUSTED_BLOCK) { }
+ LLObjectHandler() : LLCommandHandler("object", UNTRUSTED_BLOCK) { }
- bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- if (params.size() < 2) return false;
+ bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ if (params.size() < 2) return false;
- LLUUID object_id;
- if (!object_id.set(params[0], FALSE))
- {
- return false;
- }
+ LLUUID object_id;
+ if (!object_id.set(params[0], FALSE))
+ {
+ return false;
+ }
- const std::string verb = params[1].asString();
+ const std::string verb = params[1].asString();
- if (verb == "inspect")
- {
- LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", object_id));
- return true;
- }
+ if (verb == "inspect")
+ {
+ LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", object_id));
+ return true;
+ }
- return false;
- }
+ return false;
+ }
};
LLObjectHandler gObjectHandler;
@@ -87,326 +87,326 @@ LLObjectHandler gObjectHandler;
LLFloaterIMNearbyChatToastPanel* LLFloaterIMNearbyChatToastPanel::createInstance()
{
- LLFloaterIMNearbyChatToastPanel* item = new LLFloaterIMNearbyChatToastPanel();
- item->buildFromFile("panel_chat_item.xml");
- item->setFollows(FOLLOWS_NONE);
- return item;
+ LLFloaterIMNearbyChatToastPanel* item = new LLFloaterIMNearbyChatToastPanel();
+ item->buildFromFile("panel_chat_item.xml");
+ item->setFollows(FOLLOWS_NONE);
+ return item;
}
-void LLFloaterIMNearbyChatToastPanel::reshape (S32 width, S32 height, BOOL called_from_parent )
+void LLFloaterIMNearbyChatToastPanel::reshape (S32 width, S32 height, BOOL called_from_parent )
{
- LLPanel::reshape(width, height,called_from_parent);
-
- // reshape() may be called from LLView::initFromParams() before the children are created.
- // We call findChild() instead of getChild() here to avoid creating dummy controls.
- LLUICtrl* msg_text = findChild<LLUICtrl>("msg_text", false);
- LLUICtrl* icon = findChild<LLUICtrl>("avatar_icon", false);
-
- if (!msg_text || !icon)
- {
- return;
- }
-
- LLRect msg_text_rect = msg_text->getRect();
- LLRect avatar_rect = icon->getRect();
-
- avatar_rect.setLeftTopAndSize(2,height-2,avatar_rect.getWidth(),avatar_rect.getHeight());
- icon->setRect(avatar_rect);
-
-
- msg_text_rect.setLeftTopAndSize( avatar_rect.mRight + msg_left_offset,
- height - msg_height_pad,
- width - avatar_rect.mRight - msg_left_offset - msg_right_offset,
- height - 2*msg_height_pad);
- msg_text->reshape( msg_text_rect.getWidth(), msg_text_rect.getHeight(), 1);
- msg_text->setRect(msg_text_rect);
+ LLPanel::reshape(width, height,called_from_parent);
+
+ // reshape() may be called from LLView::initFromParams() before the children are created.
+ // We call findChild() instead of getChild() here to avoid creating dummy controls.
+ LLUICtrl* msg_text = findChild<LLUICtrl>("msg_text", false);
+ LLUICtrl* icon = findChild<LLUICtrl>("avatar_icon", false);
+
+ if (!msg_text || !icon)
+ {
+ return;
+ }
+
+ LLRect msg_text_rect = msg_text->getRect();
+ LLRect avatar_rect = icon->getRect();
+
+ avatar_rect.setLeftTopAndSize(2,height-2,avatar_rect.getWidth(),avatar_rect.getHeight());
+ icon->setRect(avatar_rect);
+
+
+ msg_text_rect.setLeftTopAndSize( avatar_rect.mRight + msg_left_offset,
+ height - msg_height_pad,
+ width - avatar_rect.mRight - msg_left_offset - msg_right_offset,
+ height - 2*msg_height_pad);
+ msg_text->reshape( msg_text_rect.getWidth(), msg_text_rect.getHeight(), 1);
+ msg_text->setRect(msg_text_rect);
}
BOOL LLFloaterIMNearbyChatToastPanel::postBuild()
{
- return LLPanel::postBuild();
+ return LLPanel::postBuild();
}
void LLFloaterIMNearbyChatToastPanel::addMessage(LLSD& notification)
{
- std::string messageText = notification["message"].asString(); // UTF-8 line of text
-
-
- std::string color_name = notification["text_color"].asString();
-
- LLColor4 textColor = LLUIColorTable::instance().getColor(color_name);
- textColor.mV[VALPHA] =notification["color_alpha"].asReal();
-
- S32 font_size = notification["font_size"].asInteger();
-
- LLFontGL* messageFont;
- switch(font_size)
- {
- case 0: messageFont = LLFontGL::getFontSansSerifSmall(); break;
- default:
- case 1: messageFont = LLFontGL::getFontSansSerif(); break;
- case 2: messageFont = LLFontGL::getFontSansSerifBig(); break;
- }
-
- //append text
- {
- LLStyle::Params style_params;
- style_params.color(textColor);
- std::string font_name = LLFontGL::nameFromFont(messageFont);
- std::string font_style_size = LLFontGL::sizeFromFont(messageFont);
- style_params.font.name(font_name);
- style_params.font.size(font_style_size);
-
- int chat_type = notification["chat_type"].asInteger();
-
- if(notification["chat_style"].asInteger()== CHAT_STYLE_IRC)
- {
- style_params.font.style = "ITALIC";
- }
- else if( chat_type == CHAT_TYPE_SHOUT)
- {
- style_params.font.style = "BOLD";
- }
- else if( chat_type == CHAT_TYPE_WHISPER)
- {
- style_params.font.style = "ITALIC";
- }
- mMsgText->appendText(messageText, TRUE, style_params);
- }
-
- snapToMessageHeight();
+ std::string messageText = notification["message"].asString(); // UTF-8 line of text
+
+
+ std::string color_name = notification["text_color"].asString();
+
+ LLColor4 textColor = LLUIColorTable::instance().getColor(color_name);
+ textColor.mV[VALPHA] =notification["color_alpha"].asReal();
+
+ S32 font_size = notification["font_size"].asInteger();
+
+ LLFontGL* messageFont;
+ switch(font_size)
+ {
+ case 0: messageFont = LLFontGL::getFontSansSerifSmall(); break;
+ default:
+ case 1: messageFont = LLFontGL::getFontSansSerif(); break;
+ case 2: messageFont = LLFontGL::getFontSansSerifBig(); break;
+ }
+
+ //append text
+ {
+ LLStyle::Params style_params;
+ style_params.color(textColor);
+ std::string font_name = LLFontGL::nameFromFont(messageFont);
+ std::string font_style_size = LLFontGL::sizeFromFont(messageFont);
+ style_params.font.name(font_name);
+ style_params.font.size(font_style_size);
+
+ int chat_type = notification["chat_type"].asInteger();
+
+ if(notification["chat_style"].asInteger()== CHAT_STYLE_IRC)
+ {
+ style_params.font.style = "ITALIC";
+ }
+ else if( chat_type == CHAT_TYPE_SHOUT)
+ {
+ style_params.font.style = "BOLD";
+ }
+ else if( chat_type == CHAT_TYPE_WHISPER)
+ {
+ style_params.font.style = "ITALIC";
+ }
+ mMsgText->appendText(messageText, TRUE, style_params);
+ }
+
+ snapToMessageHeight();
}
void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification)
{
- std::string messageText = notification["message"].asString(); // UTF-8 line of text
- std::string fromName = notification["from"].asString(); // agent or object name
- mFromID = notification["from_id"].asUUID(); // agent id or object id
- mFromName = fromName;
-
- int sType = notification["source"].asInteger();
+ std::string messageText = notification["message"].asString(); // UTF-8 line of text
+ std::string fromName = notification["from"].asString(); // agent or object name
+ mFromID = notification["from_id"].asUUID(); // agent id or object id
+ mFromName = fromName;
+
+ int sType = notification["source"].asInteger();
mSourceType = (EChatSourceType)sType;
-
- std::string color_name = notification["text_color"].asString();
-
- LLColor4 textColor = LLUIColorTable::instance().getColor(color_name);
- textColor.mV[VALPHA] =notification["color_alpha"].asReal();
-
- S32 font_size = notification["font_size"].asInteger();
-
- LLFontGL* messageFont;
- switch(font_size)
- {
- case 0: messageFont = LLFontGL::getFontSansSerifSmall(); break;
- default:
- case 1: messageFont = LLFontGL::getFontSansSerif(); break;
- case 2: messageFont = LLFontGL::getFontSansSerifBig(); break;
- }
-
- mMsgText = getChild<LLChatMsgBox>("msg_text", false);
- mMsgText->setContentTrusted(false);
- mMsgText->setIsFriendCallback(LLAvatarActions::isFriend);
-
- mMsgText->setText(std::string(""));
-
- if ( notification["chat_style"].asInteger() != CHAT_STYLE_IRC )
- {
- std::string str_sender;
-
- str_sender = fromName;
-
- str_sender+=" ";
-
- //append sender name
- if (mSourceType == CHAT_SOURCE_AGENT || mSourceType == CHAT_SOURCE_OBJECT)
- {
- LLStyle::Params style_params_name;
-
- LLColor4 user_name_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
- style_params_name.color(user_name_color);
-
- std::string font_name = LLFontGL::nameFromFont(messageFont);
- std::string font_style_size = LLFontGL::sizeFromFont(messageFont);
- style_params_name.font.name(font_name);
- style_params_name.font.size(font_style_size);
-
- style_params_name.link_href = notification["sender_slurl"].asString();
- style_params_name.is_link = true;
-
- mMsgText->appendText(str_sender, FALSE, style_params_name);
-
- }
- else
- {
- mMsgText->appendText(str_sender, false);
- }
- }
-
- S32 chars_in_line = mMsgText->getRect().getWidth() / messageFont->getWidth("c");
- S32 max_lines = notification["available_height"].asInteger() / (mMsgText->getTextPixelHeight() + 4);
- int lines = 0;
- int chars = 0;
-
- //Remove excessive chars if message does not fit in available height. MAINT-6891
- std::string::iterator it;
- for (it = messageText.begin(); it < messageText.end() && lines < max_lines; it++)
- {
- if (*it == '\n')
- ++lines;
- else
- ++chars;
-
- if (chars >= chars_in_line)
- {
- chars = 0;
- ++lines;
- }
- }
-
- if (it < messageText.end())
- {
- messageText.erase(it, messageText.end());
- messageText += " ...";
- }
-
- //append text
- {
- LLStyle::Params style_params;
- style_params.color(textColor);
- std::string font_name = LLFontGL::nameFromFont(messageFont);
- std::string font_style_size = LLFontGL::sizeFromFont(messageFont);
- style_params.font.name(font_name);
- style_params.font.size(font_style_size);
-
- int chat_type = notification["chat_type"].asInteger();
-
- if(notification["chat_style"].asInteger()== CHAT_STYLE_IRC)
- {
- style_params.font.style = "ITALIC";
- }
- else if( chat_type == CHAT_TYPE_SHOUT)
- {
- style_params.font.style = "BOLD";
- }
- else if( chat_type == CHAT_TYPE_WHISPER)
- {
- style_params.font.style = "ITALIC";
- }
- mMsgText->appendText(messageText, FALSE, style_params);
- }
-
-
- snapToMessageHeight();
-
- mIsDirty = true;//will set Avatar Icon in draw
+
+ std::string color_name = notification["text_color"].asString();
+
+ LLColor4 textColor = LLUIColorTable::instance().getColor(color_name);
+ textColor.mV[VALPHA] =notification["color_alpha"].asReal();
+
+ S32 font_size = notification["font_size"].asInteger();
+
+ LLFontGL* messageFont;
+ switch(font_size)
+ {
+ case 0: messageFont = LLFontGL::getFontSansSerifSmall(); break;
+ default:
+ case 1: messageFont = LLFontGL::getFontSansSerif(); break;
+ case 2: messageFont = LLFontGL::getFontSansSerifBig(); break;
+ }
+
+ mMsgText = getChild<LLChatMsgBox>("msg_text", false);
+ mMsgText->setContentTrusted(false);
+ mMsgText->setIsFriendCallback(LLAvatarActions::isFriend);
+
+ mMsgText->setText(std::string(""));
+
+ if ( notification["chat_style"].asInteger() != CHAT_STYLE_IRC )
+ {
+ std::string str_sender;
+
+ str_sender = fromName;
+
+ str_sender+=" ";
+
+ //append sender name
+ if (mSourceType == CHAT_SOURCE_AGENT || mSourceType == CHAT_SOURCE_OBJECT)
+ {
+ LLStyle::Params style_params_name;
+
+ LLColor4 user_name_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
+ style_params_name.color(user_name_color);
+
+ std::string font_name = LLFontGL::nameFromFont(messageFont);
+ std::string font_style_size = LLFontGL::sizeFromFont(messageFont);
+ style_params_name.font.name(font_name);
+ style_params_name.font.size(font_style_size);
+
+ style_params_name.link_href = notification["sender_slurl"].asString();
+ style_params_name.is_link = true;
+
+ mMsgText->appendText(str_sender, FALSE, style_params_name);
+
+ }
+ else
+ {
+ mMsgText->appendText(str_sender, false);
+ }
+ }
+
+ S32 chars_in_line = mMsgText->getRect().getWidth() / messageFont->getWidth("c");
+ S32 max_lines = notification["available_height"].asInteger() / (mMsgText->getTextPixelHeight() + 4);
+ int lines = 0;
+ int chars = 0;
+
+ //Remove excessive chars if message does not fit in available height. MAINT-6891
+ std::string::iterator it;
+ for (it = messageText.begin(); it < messageText.end() && lines < max_lines; it++)
+ {
+ if (*it == '\n')
+ ++lines;
+ else
+ ++chars;
+
+ if (chars >= chars_in_line)
+ {
+ chars = 0;
+ ++lines;
+ }
+ }
+
+ if (it < messageText.end())
+ {
+ messageText.erase(it, messageText.end());
+ messageText += " ...";
+ }
+
+ //append text
+ {
+ LLStyle::Params style_params;
+ style_params.color(textColor);
+ std::string font_name = LLFontGL::nameFromFont(messageFont);
+ std::string font_style_size = LLFontGL::sizeFromFont(messageFont);
+ style_params.font.name(font_name);
+ style_params.font.size(font_style_size);
+
+ int chat_type = notification["chat_type"].asInteger();
+
+ if(notification["chat_style"].asInteger()== CHAT_STYLE_IRC)
+ {
+ style_params.font.style = "ITALIC";
+ }
+ else if( chat_type == CHAT_TYPE_SHOUT)
+ {
+ style_params.font.style = "BOLD";
+ }
+ else if( chat_type == CHAT_TYPE_WHISPER)
+ {
+ style_params.font.style = "ITALIC";
+ }
+ mMsgText->appendText(messageText, FALSE, style_params);
+ }
+
+
+ snapToMessageHeight();
+
+ mIsDirty = true;//will set Avatar Icon in draw
}
-void LLFloaterIMNearbyChatToastPanel::snapToMessageHeight ()
+void LLFloaterIMNearbyChatToastPanel::snapToMessageHeight ()
{
- S32 new_height = llmax (mMsgText->getTextPixelHeight() + 2*mMsgText->getVPad() + 2*msg_height_pad, 25);
-
- LLRect panel_rect = getRect();
+ S32 new_height = llmax (mMsgText->getTextPixelHeight() + 2*mMsgText->getVPad() + 2*msg_height_pad, 25);
- panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth(), new_height);
-
- reshape( getRect().getWidth(), getRect().getHeight(), 1);
-
- setRect(panel_rect);
+ LLRect panel_rect = getRect();
+
+ panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth(), new_height);
+
+ reshape( getRect().getWidth(), getRect().getHeight(), 1);
+
+ setRect(panel_rect);
}
-void LLFloaterIMNearbyChatToastPanel::onMouseLeave (S32 x, S32 y, MASK mask)
+void LLFloaterIMNearbyChatToastPanel::onMouseLeave (S32 x, S32 y, MASK mask)
{
-
+
}
-void LLFloaterIMNearbyChatToastPanel::onMouseEnter (S32 x, S32 y, MASK mask)
+void LLFloaterIMNearbyChatToastPanel::onMouseEnter (S32 x, S32 y, MASK mask)
{
- if(mSourceType != CHAT_SOURCE_AGENT)
- return;
+ if(mSourceType != CHAT_SOURCE_AGENT)
+ return;
}
-BOOL LLFloaterIMNearbyChatToastPanel::handleMouseDown (S32 x, S32 y, MASK mask)
+BOOL LLFloaterIMNearbyChatToastPanel::handleMouseDown (S32 x, S32 y, MASK mask)
{
- return LLPanel::handleMouseDown(x,y,mask);
+ return LLPanel::handleMouseDown(x,y,mask);
}
-BOOL LLFloaterIMNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask)
+BOOL LLFloaterIMNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask)
{
- /*
- fix for request EXT-4780
- leaving this commented since I don't remember why ew block those messages...
- if(mSourceType != CHAT_SOURCE_AGENT)
- return LLPanel::handleMouseUp(x,y,mask);
+ /*
+ fix for request EXT-4780
+ leaving this commented since I don't remember why ew block those messages...
+ if(mSourceType != CHAT_SOURCE_AGENT)
+ return LLPanel::handleMouseUp(x,y,mask);
*/
- S32 local_x = x - mMsgText->getRect().mLeft;
- S32 local_y = y - mMsgText->getRect().mBottom;
-
- //if text_box process mouse up (ussually this is click on url) - we didn't show nearby_chat.
- if (mMsgText->pointInView(local_x, local_y) )
- {
- if (mMsgText->handleMouseUp(local_x,local_y,mask) == TRUE)
- return TRUE;
- else
- {
- LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory();
- return FALSE;
- }
- }
- LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory();
- return LLPanel::handleMouseUp(x,y,mask);
+ S32 local_x = x - mMsgText->getRect().mLeft;
+ S32 local_y = y - mMsgText->getRect().mBottom;
+
+ //if text_box process mouse up (ussually this is click on url) - we didn't show nearby_chat.
+ if (mMsgText->pointInView(local_x, local_y) )
+ {
+ if (mMsgText->handleMouseUp(local_x,local_y,mask) == TRUE)
+ return TRUE;
+ else
+ {
+ LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory();
+ return FALSE;
+ }
+ }
+ LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory();
+ return LLPanel::handleMouseUp(x,y,mask);
}
-void LLFloaterIMNearbyChatToastPanel::setHeaderVisibility(EShowItemHeader e)
+void LLFloaterIMNearbyChatToastPanel::setHeaderVisibility(EShowItemHeader e)
{
- LLUICtrl* icon = getChild<LLUICtrl>("avatar_icon", false);
- if(icon)
- icon->setVisible(e == CHATITEMHEADER_SHOW_ONLY_ICON || e==CHATITEMHEADER_SHOW_BOTH);
+ LLUICtrl* icon = getChild<LLUICtrl>("avatar_icon", false);
+ if(icon)
+ icon->setVisible(e == CHATITEMHEADER_SHOW_ONLY_ICON || e==CHATITEMHEADER_SHOW_BOTH);
}
-bool LLFloaterIMNearbyChatToastPanel::canAddText ()
+bool LLFloaterIMNearbyChatToastPanel::canAddText ()
{
- LLChatMsgBox* msg_text = findChild<LLChatMsgBox>("msg_text");
- if(!msg_text)
- return false;
- return msg_text->getLineCount()<10;
+ LLChatMsgBox* msg_text = findChild<LLChatMsgBox>("msg_text");
+ if(!msg_text)
+ return false;
+ return msg_text->getLineCount()<10;
}
-BOOL LLFloaterIMNearbyChatToastPanel::handleRightMouseDown(S32 x, S32 y, MASK mask)
+BOOL LLFloaterIMNearbyChatToastPanel::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- LLUICtrl* avatar_icon = getChild<LLUICtrl>("avatar_icon", false);
+ LLUICtrl* avatar_icon = getChild<LLUICtrl>("avatar_icon", false);
- S32 local_x = x - avatar_icon->getRect().mLeft;
- S32 local_y = y - avatar_icon->getRect().mBottom;
+ S32 local_x = x - avatar_icon->getRect().mLeft;
+ S32 local_y = y - avatar_icon->getRect().mBottom;
- //eat message for avatar icon if msg was from object
- if(avatar_icon->pointInView(local_x, local_y) && mSourceType != CHAT_SOURCE_AGENT)
- return TRUE;
- return LLPanel::handleRightMouseDown(x,y,mask);
+ //eat message for avatar icon if msg was from object
+ if(avatar_icon->pointInView(local_x, local_y) && mSourceType != CHAT_SOURCE_AGENT)
+ return TRUE;
+ return LLPanel::handleRightMouseDown(x,y,mask);
}
void LLFloaterIMNearbyChatToastPanel::draw()
{
- LLPanel::draw();
-
- if(mIsDirty)
- {
- LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon", false);
- if(icon)
- {
- icon->setDrawTooltip(mSourceType == CHAT_SOURCE_AGENT);
- if(mSourceType == CHAT_SOURCE_OBJECT)
- icon->setValue(LLSD("OBJECT_Icon"));
- else if(mSourceType == CHAT_SOURCE_SYSTEM)
- icon->setValue(LLSD("SL_Logo"));
- else if(mSourceType == CHAT_SOURCE_AGENT)
- icon->setValue(mFromID);
- else if(!mFromID.isNull())
- icon->setValue(mFromID);
- }
- mIsDirty = false;
- }
+ LLPanel::draw();
+
+ if(mIsDirty)
+ {
+ LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon", false);
+ if(icon)
+ {
+ icon->setDrawTooltip(mSourceType == CHAT_SOURCE_AGENT);
+ if(mSourceType == CHAT_SOURCE_OBJECT)
+ icon->setValue(LLSD("OBJECT_Icon"));
+ else if(mSourceType == CHAT_SOURCE_SYSTEM)
+ icon->setValue(LLSD("SL_Logo"));
+ else if(mSourceType == CHAT_SOURCE_AGENT)
+ icon->setValue(mFromID);
+ else if(!mFromID.isNull())
+ icon->setValue(mFromID);
+ }
+ mIsDirty = false;
+ }
}
diff --git a/indra/newview/llchatitemscontainerctrl.h b/indra/newview/llchatitemscontainerctrl.h
index ebff9ca298..d041615060 100644
--- a/indra/newview/llchatitemscontainerctrl.h
+++ b/indra/newview/llchatitemscontainerctrl.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchatitemscontainerctrl.h
* @brief chat history scrolling panel implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,61 +37,61 @@ class LLChatMsgBox;
typedef enum e_show_item_header
{
- CHATITEMHEADER_SHOW_ONLY_NAME = 0,
- CHATITEMHEADER_SHOW_ONLY_ICON = 1,
- CHATITEMHEADER_SHOW_BOTH
+ CHATITEMHEADER_SHOW_ONLY_NAME = 0,
+ CHATITEMHEADER_SHOW_ONLY_ICON = 1,
+ CHATITEMHEADER_SHOW_BOTH
} EShowItemHeader;
class LLFloaterIMNearbyChatToastPanel : public LLPanel
{
protected:
LLFloaterIMNearbyChatToastPanel()
- :
- mIsDirty(false),
- mSourceType(CHAT_SOURCE_OBJECT)
- {};
+ :
+ mIsDirty(false),
+ mSourceType(CHAT_SOURCE_OBJECT)
+ {};
public:
- ~LLFloaterIMNearbyChatToastPanel(){}
-
- static LLFloaterIMNearbyChatToastPanel* createInstance();
+ ~LLFloaterIMNearbyChatToastPanel(){}
- const LLUUID& getFromID() const { return mFromID;}
- const std::string& getFromName() const { return mFromName; }
-
- //void addText (const std::string& message , const LLStyle::Params& input_params = LLStyle::Params());
- //void setMessage (const LLChat& msg);
- void snapToMessageHeight ();
+ static LLFloaterIMNearbyChatToastPanel* createInstance();
- bool canAddText ();
+ const LLUUID& getFromID() const { return mFromID;}
+ const std::string& getFromName() const { return mFromName; }
- void onMouseLeave (S32 x, S32 y, MASK mask);
- void onMouseEnter (S32 x, S32 y, MASK mask);
- BOOL handleMouseDown (S32 x, S32 y, MASK mask);
- BOOL handleMouseUp (S32 x, S32 y, MASK mask);
+ //void addText (const std::string& message , const LLStyle::Params& input_params = LLStyle::Params());
+ //void setMessage (const LLChat& msg);
+ void snapToMessageHeight ();
- virtual BOOL postBuild();
+ bool canAddText ();
- void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE);
+ void onMouseLeave (S32 x, S32 y, MASK mask);
+ void onMouseEnter (S32 x, S32 y, MASK mask);
+ BOOL handleMouseDown (S32 x, S32 y, MASK mask);
+ BOOL handleMouseUp (S32 x, S32 y, MASK mask);
- void setHeaderVisibility(EShowItemHeader e);
- BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL postBuild();
- virtual void init(LLSD& data);
- virtual void addMessage(LLSD& data);
+ void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE);
- virtual void draw();
+ void setHeaderVisibility(EShowItemHeader e);
+ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- //*TODO REMOVE, why a dup of getFromID?
- const LLUUID& messageID() const { return mFromID;}
+ virtual void init(LLSD& data);
+ virtual void addMessage(LLSD& data);
+
+ virtual void draw();
+
+ //*TODO REMOVE, why a dup of getFromID?
+ const LLUUID& messageID() const { return mFromID;}
private:
- LLUUID mFromID; // agent id or object id
- std::string mFromName;
- EChatSourceType mSourceType;
- LLChatMsgBox* mMsgText;
-
+ LLUUID mFromID; // agent id or object id
+ std::string mFromName;
+ EChatSourceType mSourceType;
+ LLChatMsgBox* mMsgText;
+
- bool mIsDirty;
+ bool mIsDirty;
};
diff --git a/indra/newview/llchatmsgbox.cpp b/indra/newview/llchatmsgbox.cpp
index 38f58abba6..b70b3eac95 100644
--- a/indra/newview/llchatmsgbox.cpp
+++ b/indra/newview/llchatmsgbox.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llchatmsgbox.cpp
* @author Martin Reddy
* @brief chat history text box, able to show array of strings with separator
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,57 +36,57 @@ static LLDefaultChildRegistry::Register<LLChatMsgBox> r("text_chat");
class ChatSeparator : public LLTextSegment
{
public:
- ChatSeparator(S32 start, S32 end)
- : LLTextSegment(start, end),
- mEditor(NULL)
- {}
+ ChatSeparator(S32 start, S32 end)
+ : LLTextSegment(start, end),
+ mEditor(NULL)
+ {}
- /*virtual*/ void linkToDocument(class LLTextBase* editor)
- {
- mEditor = editor;
- }
+ /*virtual*/ void linkToDocument(class LLTextBase* editor)
+ {
+ mEditor = editor;
+ }
- /*virtual*/ void unlinkFromDocument(class LLTextBase* editor)
- {
- mEditor = NULL;
- }
+ /*virtual*/ void unlinkFromDocument(class LLTextBase* editor)
+ {
+ mEditor = NULL;
+ }
- /*virtual*/ S32 getWidth(S32 first_char, S32 num_chars) const
- {
- return mEditor->getDocumentView()->getRect().getWidth();
- }
+ /*virtual*/ S32 getWidth(S32 first_char, S32 num_chars) const
+ {
+ return mEditor->getDocumentView()->getRect().getWidth();
+ }
- /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
- {
- gl_line_2d((S32)(draw_rect.mLeft + 5), (S32)draw_rect.getCenterY(), (S32)(draw_rect.mRight - 5), (S32)draw_rect.getCenterY(), LLColor4::grey);
- return draw_rect.getWidth();
- }
+ /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
+ {
+ gl_line_2d((S32)(draw_rect.mLeft + 5), (S32)draw_rect.getCenterY(), (S32)(draw_rect.mRight - 5), (S32)draw_rect.getCenterY(), LLColor4::grey);
+ return draw_rect.getWidth();
+ }
private:
- LLTextBase* mEditor;
+ LLTextBase* mEditor;
};
LLChatMsgBox::Params::Params() :
- block_spacing("block_spacing", 10)
+ block_spacing("block_spacing", 10)
{
- changeDefault(line_spacing.pixels, 4);
+ changeDefault(line_spacing.pixels, 4);
}
LLChatMsgBox::LLChatMsgBox(const Params& p) :
- LLTextBox(p),
- mBlockSpacing(p.block_spacing)
+ LLTextBox(p),
+ mBlockSpacing(p.block_spacing)
{}
void LLChatMsgBox::addText( const LLStringExplicit& text , const LLStyle::Params& input_params )
{
- S32 length = getLength();
- // if there is existing text, add a separator
- if (length > 0)
- {
- // chat separator exists right before the null terminator
- insertSegment(new ChatSeparator(length - 1, length - 1));
- }
- // prepend newline only if there is some existing text
- appendText(text, length > 0, input_params);
+ S32 length = getLength();
+ // if there is existing text, add a separator
+ if (length > 0)
+ {
+ // chat separator exists right before the null terminator
+ insertSegment(new ChatSeparator(length - 1, length - 1));
+ }
+ // prepend newline only if there is some existing text
+ appendText(text, length > 0, input_params);
}
diff --git a/indra/newview/llchatmsgbox.h b/indra/newview/llchatmsgbox.h
index 7e008dba46..9ec9633d75 100644
--- a/indra/newview/llchatmsgbox.h
+++ b/indra/newview/llchatmsgbox.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llchatmsgbox.h
* @author Martin Reddy
* @brief chat history text box, able to show array of strings with separator
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,25 +40,25 @@
/// line).
///
class LLChatMsgBox :
- public LLTextBox
+ public LLTextBox
{
public:
- struct Params : public LLInitParam::Block<Params, LLTextBox::Params>
- {
- Optional<S32> block_spacing;
+ struct Params : public LLInitParam::Block<Params, LLTextBox::Params>
+ {
+ Optional<S32> block_spacing;
- Params();
- };
+ Params();
+ };
protected:
- LLChatMsgBox(const Params&);
- friend class LLUICtrlFactory;
+ LLChatMsgBox(const Params&);
+ friend class LLUICtrlFactory;
public:
- void addText(const LLStringExplicit &text, const LLStyle::Params& input_params = LLStyle::Params());
-
+ void addText(const LLStringExplicit &text, const LLStyle::Params& input_params = LLStyle::Params());
+
private:
- S32 mBlockSpacing;
+ S32 mBlockSpacing;
};
#endif
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index 3444f50e52..3d328e66c8 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchiclet.cpp
* @brief LLChiclet class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,137 +44,137 @@ static LLDefaultChildRegistry::Register<LLScriptChiclet> t6("chiclet_script");
static LLDefaultChildRegistry::Register<LLInvOfferChiclet> t7("chiclet_offer");
boost::signals2::signal<LLChiclet* (const LLUUID&),
- LLIMChiclet::CollectChicletCombiner<std::list<LLChiclet*> > >
- LLIMChiclet::sFindChicletsSignal;
+ LLIMChiclet::CollectChicletCombiner<std::list<LLChiclet*> > >
+ LLIMChiclet::sFindChicletsSignal;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
LLSysWellChiclet::Params::Params()
- : button("button")
- , unread_notifications("unread_notifications")
- , max_displayed_count("max_displayed_count", 99)
+ : button("button")
+ , unread_notifications("unread_notifications")
+ , max_displayed_count("max_displayed_count", 99)
{
- button.name = "button";
- button.tab_stop = FALSE;
- button.label = LLStringUtil::null;
+ button.name = "button";
+ button.tab_stop = FALSE;
+ button.label = LLStringUtil::null;
}
LLSysWellChiclet::LLSysWellChiclet(const Params& p)
- : LLChiclet(p)
- , mButton(NULL)
- , mCounter(0)
- , mMaxDisplayedCount(p.max_displayed_count)
- , mIsNewMessagesState(false)
- , mFlashToLitTimer(NULL)
+ : LLChiclet(p)
+ , mButton(NULL)
+ , mCounter(0)
+ , mMaxDisplayedCount(p.max_displayed_count)
+ , mIsNewMessagesState(false)
+ , mFlashToLitTimer(NULL)
{
- LLButton::Params button_params = p.button;
- mButton = LLUICtrlFactory::create<LLButton>(button_params);
- addChild(mButton);
+ LLButton::Params button_params = p.button;
+ mButton = LLUICtrlFactory::create<LLButton>(button_params);
+ addChild(mButton);
- mFlashToLitTimer = new LLFlashTimer(boost::bind(&LLSysWellChiclet::changeLitState, this, _1));
+ mFlashToLitTimer = new LLFlashTimer(boost::bind(&LLSysWellChiclet::changeLitState, this, _1));
}
LLSysWellChiclet::~LLSysWellChiclet()
{
- mFlashToLitTimer->unset();
- LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get());
- if (menu)
- {
- menu->die();
- mContextMenuHandle.markDead();
- }
+ mFlashToLitTimer->unset();
+ LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get());
+ if (menu)
+ {
+ menu->die();
+ mContextMenuHandle.markDead();
+ }
}
void LLSysWellChiclet::setCounter(S32 counter)
{
- // do nothing if the same counter is coming. EXT-3678.
- if (counter == mCounter) return;
+ // do nothing if the same counter is coming. EXT-3678.
+ if (counter == mCounter) return;
- // note same code in LLChicletNotificationCounterCtrl::setCounter(S32 counter)
- std::string s_count;
- if(counter != 0)
- {
- static std::string more_messages_exist("+");
- std::string more_messages(counter > mMaxDisplayedCount ? more_messages_exist : "");
- s_count = llformat("%d%s"
- , llmin(counter, mMaxDisplayedCount)
- , more_messages.c_str()
- );
- }
+ // note same code in LLChicletNotificationCounterCtrl::setCounter(S32 counter)
+ std::string s_count;
+ if(counter != 0)
+ {
+ static std::string more_messages_exist("+");
+ std::string more_messages(counter > mMaxDisplayedCount ? more_messages_exist : "");
+ s_count = llformat("%d%s"
+ , llmin(counter, mMaxDisplayedCount)
+ , more_messages.c_str()
+ );
+ }
- mButton->setLabel(s_count);
+ mButton->setLabel(s_count);
- mCounter = counter;
+ mCounter = counter;
}
boost::signals2::connection LLSysWellChiclet::setClickCallback(
- const commit_callback_t& cb)
+ const commit_callback_t& cb)
{
- return mButton->setClickedCallback(cb);
+ return mButton->setClickedCallback(cb);
}
void LLSysWellChiclet::setToggleState(BOOL toggled) {
- mButton->setToggleState(toggled);
+ mButton->setToggleState(toggled);
}
void LLSysWellChiclet::changeLitState(bool blink)
{
- setNewMessagesState(!mIsNewMessagesState);
+ setNewMessagesState(!mIsNewMessagesState);
}
void LLSysWellChiclet::setNewMessagesState(bool new_messages)
{
- /*
- Emulate 4 states of button by background images, see detains in EXT-3147
- xml attribute Description
- image_unselected "Unlit" - there are no new messages
- image_selected "Unlit" + "Selected" - there are no new messages and the Well is open
- image_pressed "Lit" - there are new messages
- image_pressed_selected "Lit" + "Selected" - there are new messages and the Well is open
- */
- mButton->setForcePressedState(new_messages);
+ /*
+ Emulate 4 states of button by background images, see detains in EXT-3147
+ xml attribute Description
+ image_unselected "Unlit" - there are no new messages
+ image_selected "Unlit" + "Selected" - there are no new messages and the Well is open
+ image_pressed "Lit" - there are new messages
+ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well is open
+ */
+ mButton->setForcePressedState(new_messages);
- mIsNewMessagesState = new_messages;
+ mIsNewMessagesState = new_messages;
}
void LLSysWellChiclet::updateWidget(bool is_window_empty)
{
- mButton->setEnabled(!is_window_empty);
+ mButton->setEnabled(!is_window_empty);
- if (LLChicletBar::instanceExists())
- {
- LLChicletBar::getInstance()->showWellButton(getName(), !is_window_empty);
- }
+ if (LLChicletBar::instanceExists())
+ {
+ LLChicletBar::getInstance()->showWellButton(getName(), !is_window_empty);
+ }
}
// virtual
BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- LLContextMenu* menu_avatar = mContextMenuHandle.get();
- if(!menu_avatar)
- {
- createMenu();
- menu_avatar = mContextMenuHandle.get();
- }
- if (menu_avatar)
- {
- menu_avatar->show(x, y);
- LLMenuGL::showPopup(this, menu_avatar, x, y);
- }
- return TRUE;
+ LLContextMenu* menu_avatar = mContextMenuHandle.get();
+ if(!menu_avatar)
+ {
+ createMenu();
+ menu_avatar = mContextMenuHandle.get();
+ }
+ if (menu_avatar)
+ {
+ menu_avatar->show(x, y);
+ LLMenuGL::showPopup(this, menu_avatar, x, y);
+ }
+ return TRUE;
}
/************************************************************************/
/* LLNotificationChiclet implementation */
/************************************************************************/
LLNotificationChiclet::LLNotificationChiclet(const Params& p)
-: LLSysWellChiclet(p),
- mUreadSystemNotifications(0)
+: LLSysWellChiclet(p),
+ mUreadSystemNotifications(0)
{
- mNotificationChannel.reset(new ChicletNotificationChannel(this));
- // ensure that notification well window exists, to synchronously
- // handle toast add/delete events.
- LLFloaterNotificationsTabbed::getInstance()->setSysWellChiclet(this);
+ mNotificationChannel.reset(new ChicletNotificationChannel(this));
+ // ensure that notification well window exists, to synchronously
+ // handle toast add/delete events.
+ LLFloaterNotificationsTabbed::getInstance()->setSysWellChiclet(this);
}
LLNotificationChiclet::~LLNotificationChiclet()
@@ -184,81 +184,81 @@ LLNotificationChiclet::~LLNotificationChiclet()
void LLNotificationChiclet::onMenuItemClicked(const LLSD& user_data)
{
- std::string action = user_data.asString();
- if("close all" == action)
- {
- LLFloaterNotificationsTabbed::getInstance()->closeAll();
- LLIMWellWindow::getInstance()->closeAll();
- }
+ std::string action = user_data.asString();
+ if("close all" == action)
+ {
+ LLFloaterNotificationsTabbed::getInstance()->closeAll();
+ LLIMWellWindow::getInstance()->closeAll();
+ }
}
bool LLNotificationChiclet::enableMenuItem(const LLSD& user_data)
{
- std::string item = user_data.asString();
- if (item == "can close all")
- {
- return mUreadSystemNotifications != 0;
- }
- return true;
+ std::string item = user_data.asString();
+ if (item == "can close all")
+ {
+ return mUreadSystemNotifications != 0;
+ }
+ return true;
}
void LLNotificationChiclet::createMenu()
{
- if(mContextMenuHandle.get())
- {
- LL_WARNS() << "Menu already exists" << LL_ENDL;
- return;
- }
+ if(mContextMenuHandle.get())
+ {
+ LL_WARNS() << "Menu already exists" << LL_ENDL;
+ return;
+ }
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- registrar.add("NotificationWellChicletMenu.Action",
- boost::bind(&LLNotificationChiclet::onMenuItemClicked, this, _2));
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ registrar.add("NotificationWellChicletMenu.Action",
+ boost::bind(&LLNotificationChiclet::onMenuItemClicked, this, _2));
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- enable_registrar.add("NotificationWellChicletMenu.EnableItem",
- boost::bind(&LLNotificationChiclet::enableMenuItem, this, _2));
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+ enable_registrar.add("NotificationWellChicletMenu.EnableItem",
+ boost::bind(&LLNotificationChiclet::enableMenuItem, this, _2));
- llassert(LLMenuGL::sMenuContainer != NULL);
- LLContextMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>
- ("menu_notification_well_button.xml",
- LLMenuGL::sMenuContainer,
- LLViewerMenuHolderGL::child_registry_t::instance());
- if (menu)
- {
- mContextMenuHandle = menu->getHandle();
- }
+ llassert(LLMenuGL::sMenuContainer != NULL);
+ LLContextMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>
+ ("menu_notification_well_button.xml",
+ LLMenuGL::sMenuContainer,
+ LLViewerMenuHolderGL::child_registry_t::instance());
+ if (menu)
+ {
+ mContextMenuHandle = menu->getHandle();
+ }
}
/*virtual*/
void LLNotificationChiclet::setCounter(S32 counter)
{
- LLSysWellChiclet::setCounter(counter);
- updateWidget(getCounter() == 0);
-
+ LLSysWellChiclet::setCounter(counter);
+ updateWidget(getCounter() == 0);
+
}
bool LLNotificationChiclet::ChicletNotificationChannel::filterNotification( LLNotificationPtr notification )
{
- bool displayNotification;
- if ( (notification->getName() == "ScriptDialog") // special case for scripts
- // if there is no toast window for the notification, filter it
- //|| (!LLNotificationWellWindow::getInstance()->findItemByID(notification->getID()))
+ bool displayNotification;
+ if ( (notification->getName() == "ScriptDialog") // special case for scripts
+ // if there is no toast window for the notification, filter it
+ //|| (!LLNotificationWellWindow::getInstance()->findItemByID(notification->getID()))
|| (!LLFloaterNotificationsTabbed::getInstance()->findItemByID(notification->getID(), notification->getName()))
- )
- {
- displayNotification = false;
- }
- else if( !(notification->canLogToIM() && notification->hasFormElements())
- && (!notification->getPayload().has("give_inventory_notification")
- || notification->getPayload()["give_inventory_notification"]))
- {
- displayNotification = true;
- }
- else
- {
- displayNotification = false;
- }
- return displayNotification;
+ )
+ {
+ displayNotification = false;
+ }
+ else if( !(notification->canLogToIM() && notification->hasFormElements())
+ && (!notification->getPayload().has("give_inventory_notification")
+ || notification->getPayload()["give_inventory_notification"]))
+ {
+ displayNotification = true;
+ }
+ else
+ {
+ displayNotification = false;
+ }
+ return displayNotification;
}
//////////////////////////////////////////////////////////////////////////
@@ -279,40 +279,40 @@ LLChiclet::LLChiclet(const Params& p)
}
boost::signals2::connection LLChiclet::setLeftButtonClickCallback(
- const commit_callback_t& cb)
+ const commit_callback_t& cb)
{
- return setCommitCallback(cb);
+ return setCommitCallback(cb);
}
BOOL LLChiclet::handleMouseDown(S32 x, S32 y, MASK mask)
{
- onCommit();
- childrenHandleMouseDown(x,y,mask);
- return TRUE;
+ onCommit();
+ childrenHandleMouseDown(x,y,mask);
+ return TRUE;
}
boost::signals2::connection LLChiclet::setChicletSizeChangedCallback(
- const chiclet_size_changed_callback_t& cb)
+ const chiclet_size_changed_callback_t& cb)
{
- return mChicletSizeChangedSignal.connect(cb);
+ return mChicletSizeChangedSignal.connect(cb);
}
void LLChiclet::onChicletSizeChanged()
{
- mChicletSizeChangedSignal(this, getValue());
+ mChicletSizeChangedSignal(this, getValue());
}
LLSD LLChiclet::getValue() const
{
- return LLSD(getSessionId());
+ return LLSD(getSessionId());
}
void LLChiclet::setValue(const LLSD& value)
{
- if(value.isUUID())
- {
- setSessionId(value.asUUID());
- }
+ if(value.isUUID())
+ {
+ setSessionId(value.asUUID());
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -330,103 +330,103 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)
LLIMChiclet::~LLIMChiclet()
{
- auto menu = mPopupMenuHandle.get();
- if (menu)
- {
- menu->die();
- mPopupMenuHandle.markDead();
- }
+ auto menu = mPopupMenuHandle.get();
+ if (menu)
+ {
+ menu->die();
+ mPopupMenuHandle.markDead();
+ }
}
/* virtual*/
BOOL LLIMChiclet::postBuild()
{
- mChicletButton = getChild<LLButton>("chiclet_button");
- mChicletButton->setCommitCallback(boost::bind(&LLIMChiclet::onMouseDown, this));
- mChicletButton->setDoubleClickCallback(boost::bind(&LLIMChiclet::onMouseDown, this));
- return TRUE;
+ mChicletButton = getChild<LLButton>("chiclet_button");
+ mChicletButton->setCommitCallback(boost::bind(&LLIMChiclet::onMouseDown, this));
+ mChicletButton->setDoubleClickCallback(boost::bind(&LLIMChiclet::onMouseDown, this));
+ return TRUE;
}
-void LLIMChiclet::enableCounterControl(bool enable)
+void LLIMChiclet::enableCounterControl(bool enable)
{
- mCounterEnabled = enable;
- if(!enable)
- {
- LLChiclet::setShowCounter(false);
- }
+ mCounterEnabled = enable;
+ if(!enable)
+ {
+ LLChiclet::setShowCounter(false);
+ }
}
void LLIMChiclet::setRequiredWidth()
{
- S32 required_width = mDefaultWidth;
- reshape(required_width, getRect().getHeight());
- onChicletSizeChanged();
+ S32 required_width = mDefaultWidth;
+ reshape(required_width, getRect().getHeight());
+ onChicletSizeChanged();
}
void LLIMChiclet::setShowNewMessagesIcon(bool show)
{
- if(mNewMessagesIcon)
- {
- mNewMessagesIcon->setVisible(show);
- }
- setRequiredWidth();
+ if(mNewMessagesIcon)
+ {
+ mNewMessagesIcon->setVisible(show);
+ }
+ setRequiredWidth();
}
bool LLIMChiclet::getShowNewMessagesIcon()
{
- return mNewMessagesIcon->getVisible();
+ return mNewMessagesIcon->getVisible();
}
void LLIMChiclet::onMouseDown()
{
- LLFloaterIMSession::toggle(getSessionId());
+ LLFloaterIMSession::toggle(getSessionId());
}
void LLIMChiclet::setToggleState(bool toggle)
{
- mChicletButton->setToggleState(toggle);
+ mChicletButton->setToggleState(toggle);
}
BOOL LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get());
- if(!menu)
- {
- createPopupMenu();
- menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get());
- }
+ auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get());
+ if(!menu)
+ {
+ createPopupMenu();
+ menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get());
+ }
- if (menu)
- {
- updateMenuItems();
- menu->arrangeAndClear();
- LLMenuGL::showPopup(this, menu, x, y);
- }
+ if (menu)
+ {
+ updateMenuItems();
+ menu->arrangeAndClear();
+ LLMenuGL::showPopup(this, menu, x, y);
+ }
- return TRUE;
+ return TRUE;
}
void LLIMChiclet::hidePopupMenu()
{
- auto menu = mPopupMenuHandle.get();
- if (menu)
- {
- menu->setVisible(FALSE);
- }
+ auto menu = mPopupMenuHandle.get();
+ if (menu)
+ {
+ menu->setVisible(FALSE);
+ }
}
bool LLIMChiclet::canCreateMenu()
{
- if(mPopupMenuHandle.get())
- {
- LL_WARNS() << "Menu already exists" << LL_ENDL;
- return false;
- }
- if(getSessionId().isNull())
- {
- return false;
- }
- return true;
+ if(mPopupMenuHandle.get())
+ {
+ LL_WARNS() << "Menu already exists" << LL_ENDL;
+ return false;
+ }
+ if(getSessionId().isNull())
+ {
+ return false;
+ }
+ return true;
}
//////////////////////////////////////////////////////////////////////////
@@ -454,23 +454,23 @@ LLChicletPanel::LLChicletPanel(const Params&p)
, mMinWidth(p.min_width)
, mShowControls(true)
{
- LLPanel::Params panel_params;
- panel_params.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT);
- mScrollArea = LLUICtrlFactory::create<LLPanel>(panel_params,this);
+ LLPanel::Params panel_params;
+ panel_params.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT);
+ mScrollArea = LLUICtrlFactory::create<LLPanel>(panel_params,this);
- // important for Show/Hide Camera and Move controls menu in bottom tray to work properly
- mScrollArea->setMouseOpaque(false);
+ // important for Show/Hide Camera and Move controls menu in bottom tray to work properly
+ mScrollArea->setMouseOpaque(false);
- addChild(mScrollArea);
+ addChild(mScrollArea);
}
LLChicletPanel::~LLChicletPanel()
{
- if(LLTransientFloaterMgr::instanceExists())
- {
- LLTransientFloaterMgr::getInstance()->removeControlView(mLeftScrollButton);
- LLTransientFloaterMgr::getInstance()->removeControlView(mRightScrollButton);
- }
+ if(LLTransientFloaterMgr::instanceExists())
+ {
+ LLTransientFloaterMgr::getInstance()->removeControlView(mLeftScrollButton);
+ LLTransientFloaterMgr::getInstance()->removeControlView(mRightScrollButton);
+ }
}
void LLChicletPanel::onMessageCountChanged(const LLSD& data)
@@ -478,564 +478,564 @@ void LLChicletPanel::onMessageCountChanged(const LLSD& data)
// *TODO : we either suppress this method or return a value. Right now, it servers no purpose.
/*
- //LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
- //if (im_floater && im_floater->getVisible() && im_floater->hasFocus())
- //{
- // unread = 0;
- //}
+ //LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
+ //if (im_floater && im_floater->getVisible() && im_floater->hasFocus())
+ //{
+ // unread = 0;
+ //}
*/
}
void LLChicletPanel::objectChicletCallback(const LLSD& data)
{
- LLUUID notification_id = data["notification_id"];
- bool new_message = data["new_message"];
+ LLUUID notification_id = data["notification_id"];
+ bool new_message = data["new_message"];
- std::list<LLChiclet*> chiclets = LLIMChiclet::sFindChicletsSignal(notification_id);
- std::list<LLChiclet *>::iterator iter;
- for (iter = chiclets.begin(); iter != chiclets.end(); iter++)
- {
- LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*iter);
- if (chiclet != NULL)
- {
- chiclet->setShowNewMessagesIcon(new_message);
- }
- }
+ std::list<LLChiclet*> chiclets = LLIMChiclet::sFindChicletsSignal(notification_id);
+ std::list<LLChiclet *>::iterator iter;
+ for (iter = chiclets.begin(); iter != chiclets.end(); iter++)
+ {
+ LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*iter);
+ if (chiclet != NULL)
+ {
+ chiclet->setShowNewMessagesIcon(new_message);
+ }
+ }
}
BOOL LLChicletPanel::postBuild()
{
- LLPanel::postBuild();
- LLIMModel::instance().addNewMsgCallback(boost::bind(&LLChicletPanel::onMessageCountChanged, this, _1));
- LLIMModel::instance().addNoUnreadMsgsCallback(boost::bind(&LLChicletPanel::onMessageCountChanged, this, _1));
- LLScriptFloaterManager::getInstance()->addNewObjectCallback(boost::bind(&LLChicletPanel::objectChicletCallback, this, _1));
- LLScriptFloaterManager::getInstance()->addToggleObjectFloaterCallback(boost::bind(&LLChicletPanel::objectChicletCallback, this, _1));
- LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLChicletPanel::findChiclet<LLChiclet>, this, _1));
- LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLChicletPanel::onCurrentVoiceChannelChanged, this, _1));
+ LLPanel::postBuild();
+ LLIMModel::instance().addNewMsgCallback(boost::bind(&LLChicletPanel::onMessageCountChanged, this, _1));
+ LLIMModel::instance().addNoUnreadMsgsCallback(boost::bind(&LLChicletPanel::onMessageCountChanged, this, _1));
+ LLScriptFloaterManager::getInstance()->addNewObjectCallback(boost::bind(&LLChicletPanel::objectChicletCallback, this, _1));
+ LLScriptFloaterManager::getInstance()->addToggleObjectFloaterCallback(boost::bind(&LLChicletPanel::objectChicletCallback, this, _1));
+ LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLChicletPanel::findChiclet<LLChiclet>, this, _1));
+ LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLChicletPanel::onCurrentVoiceChannelChanged, this, _1));
- mLeftScrollButton=getChild<LLButton>("chicklet_left_scroll_button");
- LLTransientFloaterMgr::getInstance()->addControlView(mLeftScrollButton);
- mLeftScrollButton->setMouseDownCallback(boost::bind(&LLChicletPanel::onLeftScrollClick,this));
- mLeftScrollButton->setHeldDownCallback(boost::bind(&LLChicletPanel::onLeftScrollHeldDown,this));
- mLeftScrollButton->setEnabled(false);
+ mLeftScrollButton=getChild<LLButton>("chicklet_left_scroll_button");
+ LLTransientFloaterMgr::getInstance()->addControlView(mLeftScrollButton);
+ mLeftScrollButton->setMouseDownCallback(boost::bind(&LLChicletPanel::onLeftScrollClick,this));
+ mLeftScrollButton->setHeldDownCallback(boost::bind(&LLChicletPanel::onLeftScrollHeldDown,this));
+ mLeftScrollButton->setEnabled(false);
- mRightScrollButton=getChild<LLButton>("chicklet_right_scroll_button");
- LLTransientFloaterMgr::getInstance()->addControlView(mRightScrollButton);
- mRightScrollButton->setMouseDownCallback(boost::bind(&LLChicletPanel::onRightScrollClick,this));
- mRightScrollButton->setHeldDownCallback(boost::bind(&LLChicletPanel::onRightScrollHeldDown,this));
- mRightScrollButton->setEnabled(false);
+ mRightScrollButton=getChild<LLButton>("chicklet_right_scroll_button");
+ LLTransientFloaterMgr::getInstance()->addControlView(mRightScrollButton);
+ mRightScrollButton->setMouseDownCallback(boost::bind(&LLChicletPanel::onRightScrollClick,this));
+ mRightScrollButton->setHeldDownCallback(boost::bind(&LLChicletPanel::onRightScrollHeldDown,this));
+ mRightScrollButton->setEnabled(false);
- return TRUE;
+ return TRUE;
}
void LLChicletPanel::onCurrentVoiceChannelChanged(const LLUUID& session_id)
{
- static LLUUID s_previous_active_voice_session_id;
+ static LLUUID s_previous_active_voice_session_id;
- std::list<LLChiclet*> chiclets = LLIMChiclet::sFindChicletsSignal(session_id);
+ std::list<LLChiclet*> chiclets = LLIMChiclet::sFindChicletsSignal(session_id);
- for(std::list<LLChiclet *>::iterator it = chiclets.begin(); it != chiclets.end(); ++it)
- {
- LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*it);
- if(chiclet)
- {
- if (gSavedSettings.getBOOL("OpenIMOnVoice"))
- {
- LLFloaterIMContainer::getInstance()->showConversation(session_id);
- }
- }
- }
+ for(std::list<LLChiclet *>::iterator it = chiclets.begin(); it != chiclets.end(); ++it)
+ {
+ LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*it);
+ if(chiclet)
+ {
+ if (gSavedSettings.getBOOL("OpenIMOnVoice"))
+ {
+ LLFloaterIMContainer::getInstance()->showConversation(session_id);
+ }
+ }
+ }
- s_previous_active_voice_session_id = session_id;
+ s_previous_active_voice_session_id = session_id;
}
bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index)
{
- if(mScrollArea->addChild(chiclet))
- {
- // chiclets should be aligned to right edge of scroll panel
- S32 left_shift = 0;
+ if(mScrollArea->addChild(chiclet))
+ {
+ // chiclets should be aligned to right edge of scroll panel
+ S32 left_shift = 0;
- if (!canScrollLeft())
- {
- // init left shift for the first chiclet in the list...
- if (mChicletList.empty())
- {
- // ...start from the right border of the scroll area for the first added chiclet
- left_shift = mScrollArea->getRect().getWidth();
- }
- else
- {
- // ... start from the left border of the first chiclet minus padding
- left_shift = getChiclet(0)->getRect().mLeft - getChicletPadding();
- }
+ if (!canScrollLeft())
+ {
+ // init left shift for the first chiclet in the list...
+ if (mChicletList.empty())
+ {
+ // ...start from the right border of the scroll area for the first added chiclet
+ left_shift = mScrollArea->getRect().getWidth();
+ }
+ else
+ {
+ // ... start from the left border of the first chiclet minus padding
+ left_shift = getChiclet(0)->getRect().mLeft - getChicletPadding();
+ }
- // take into account width of the being added chiclet
- left_shift -= chiclet->getRequiredRect().getWidth();
+ // take into account width of the being added chiclet
+ left_shift -= chiclet->getRequiredRect().getWidth();
- // if we overflow the scroll area we do not need to shift chiclets
- if (left_shift < 0)
- {
- left_shift = 0;
- }
- }
+ // if we overflow the scroll area we do not need to shift chiclets
+ if (left_shift < 0)
+ {
+ left_shift = 0;
+ }
+ }
- mChicletList.insert(mChicletList.begin() + index, chiclet);
+ mChicletList.insert(mChicletList.begin() + index, chiclet);
- // shift first chiclet to place it in correct position.
- // rest ones will be placed in arrange()
- if (!canScrollLeft())
- {
- getChiclet(0)->translate(left_shift - getChiclet(0)->getRect().mLeft, 0);
- }
+ // shift first chiclet to place it in correct position.
+ // rest ones will be placed in arrange()
+ if (!canScrollLeft())
+ {
+ getChiclet(0)->translate(left_shift - getChiclet(0)->getRect().mLeft, 0);
+ }
- chiclet->setLeftButtonClickCallback(boost::bind(&LLChicletPanel::onChicletClick, this, _1, _2));
- chiclet->setChicletSizeChangedCallback(boost::bind(&LLChicletPanel::onChicletSizeChanged, this, _1, index));
+ chiclet->setLeftButtonClickCallback(boost::bind(&LLChicletPanel::onChicletClick, this, _1, _2));
+ chiclet->setChicletSizeChangedCallback(boost::bind(&LLChicletPanel::onChicletSizeChanged, this, _1, index));
- arrange();
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, chiclet);
+ arrange();
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, chiclet);
- return true;
- }
+ return true;
+ }
- return false;
+ return false;
}
void LLChicletPanel::onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param)
{
- arrange();
+ arrange();
}
void LLChicletPanel::onChicletClick(LLUICtrl*ctrl,const LLSD&param)
{
- if (mCommitSignal)
- {
- (*mCommitSignal)(ctrl,param);
- }
+ if (mCommitSignal)
+ {
+ (*mCommitSignal)(ctrl,param);
+ }
}
void LLChicletPanel::removeChiclet(chiclet_list_t::iterator it)
{
- LLChiclet* chiclet = *it;
- mScrollArea->removeChild(chiclet);
- mChicletList.erase(it);
-
- arrange();
- LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, chiclet);
- chiclet->die();
+ LLChiclet* chiclet = *it;
+ mScrollArea->removeChild(chiclet);
+ mChicletList.erase(it);
+
+ arrange();
+ LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, chiclet);
+ chiclet->die();
}
void LLChicletPanel::removeChiclet(S32 index)
{
- if(index >= 0 && index < getChicletCount())
- {
- removeChiclet(mChicletList.begin() + index);
- }
+ if(index >= 0 && index < getChicletCount())
+ {
+ removeChiclet(mChicletList.begin() + index);
+ }
}
S32 LLChicletPanel::getChicletIndex(const LLChiclet* chiclet)
{
- if(mChicletList.empty())
- return -1;
+ if(mChicletList.empty())
+ return -1;
- S32 size = getChicletCount();
- for(int n = 0; n < size; ++n)
- {
- if(chiclet == mChicletList[n])
- return n;
- }
+ S32 size = getChicletCount();
+ for(int n = 0; n < size; ++n)
+ {
+ if(chiclet == mChicletList[n])
+ return n;
+ }
- return -1;
+ return -1;
}
void LLChicletPanel::removeChiclet(LLChiclet*chiclet)
{
- chiclet_list_t::iterator it = mChicletList.begin();
- for( ; mChicletList.end() != it; ++it)
- {
- LLChiclet* temp = *it;
- if(temp == chiclet)
- {
- removeChiclet(it);
- return;
- }
- }
+ chiclet_list_t::iterator it = mChicletList.begin();
+ for( ; mChicletList.end() != it; ++it)
+ {
+ LLChiclet* temp = *it;
+ if(temp == chiclet)
+ {
+ removeChiclet(it);
+ return;
+ }
+ }
}
void LLChicletPanel::removeChiclet(const LLUUID& im_session_id)
{
- chiclet_list_t::iterator it = mChicletList.begin();
- for( ; mChicletList.end() != it; ++it)
- {
- LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*it);
+ chiclet_list_t::iterator it = mChicletList.begin();
+ for( ; mChicletList.end() != it; ++it)
+ {
+ LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*it);
- if(chiclet->getSessionId() == im_session_id)
- {
- removeChiclet(it);
- return;
- }
- }
+ if(chiclet->getSessionId() == im_session_id)
+ {
+ removeChiclet(it);
+ return;
+ }
+ }
}
void LLChicletPanel::removeAll()
{
- S32 size = getChicletCount();
- for(S32 n = 0; n < size; ++n)
- {
- mScrollArea->removeChild(mChicletList[n]);
- }
+ S32 size = getChicletCount();
+ for(S32 n = 0; n < size; ++n)
+ {
+ mScrollArea->removeChild(mChicletList[n]);
+ }
- mChicletList.erase(mChicletList.begin(), mChicletList.end());
+ mChicletList.erase(mChicletList.begin(), mChicletList.end());
- showScrollButtonsIfNeeded();
+ showScrollButtonsIfNeeded();
}
void LLChicletPanel::scrollToChiclet(const LLChiclet* chiclet)
{
- const LLRect& rect = chiclet->getRect();
+ const LLRect& rect = chiclet->getRect();
- if (rect.mLeft < 0)
- {
- scroll(llabs(rect.mLeft));
- showScrollButtonsIfNeeded();
- }
- else
- {
- S32 scrollWidth = mScrollArea->getRect().getWidth();
+ if (rect.mLeft < 0)
+ {
+ scroll(llabs(rect.mLeft));
+ showScrollButtonsIfNeeded();
+ }
+ else
+ {
+ S32 scrollWidth = mScrollArea->getRect().getWidth();
- if (rect.mRight > scrollWidth)
- {
- scroll(-llabs(rect.mRight - scrollWidth));
- showScrollButtonsIfNeeded();
- }
- }
+ if (rect.mRight > scrollWidth)
+ {
+ scroll(-llabs(rect.mRight - scrollWidth));
+ showScrollButtonsIfNeeded();
+ }
+ }
}
void LLChicletPanel::reshape(S32 width, S32 height, BOOL called_from_parent )
{
- LLPanel::reshape(width,height,called_from_parent);
-
- //Needed once- to avoid error at first call of reshape() before postBuild()
- if(!mLeftScrollButton||!mRightScrollButton)
- return;
-
- LLRect scroll_button_rect = mLeftScrollButton->getRect();
- mLeftScrollButton->setRect(LLRect(0,scroll_button_rect.mTop,scroll_button_rect.getWidth(),
- scroll_button_rect.mBottom));
- scroll_button_rect = mRightScrollButton->getRect();
- mRightScrollButton->setRect(LLRect(width - scroll_button_rect.getWidth(),scroll_button_rect.mTop,
- width, scroll_button_rect.mBottom));
-
-
- bool need_show_scroll = needShowScroll();
- if(need_show_scroll)
- {
- mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + mScrollButtonHPad,
- height, width - scroll_button_rect.getWidth() - mScrollButtonHPad, 0));
- }
- else
- {
- mScrollArea->setRect(LLRect(0,height, width, 0));
- }
-
- mShowControls = width >= mMinWidth;
-
- mScrollArea->setVisible(mShowControls);
-
- trimChiclets();
- showScrollButtonsIfNeeded();
-
-}
-
-S32 LLChicletPanel::notifyParent(const LLSD& info)
-{
- if(info.has("notification"))
- {
- std::string str_notification = info["notification"];
- if(str_notification == "size_changes")
- {
- arrange();
- return 1;
- }
- }
- return LLPanel::notifyParent(info);
+ LLPanel::reshape(width,height,called_from_parent);
+
+ //Needed once- to avoid error at first call of reshape() before postBuild()
+ if(!mLeftScrollButton||!mRightScrollButton)
+ return;
+
+ LLRect scroll_button_rect = mLeftScrollButton->getRect();
+ mLeftScrollButton->setRect(LLRect(0,scroll_button_rect.mTop,scroll_button_rect.getWidth(),
+ scroll_button_rect.mBottom));
+ scroll_button_rect = mRightScrollButton->getRect();
+ mRightScrollButton->setRect(LLRect(width - scroll_button_rect.getWidth(),scroll_button_rect.mTop,
+ width, scroll_button_rect.mBottom));
+
+
+ bool need_show_scroll = needShowScroll();
+ if(need_show_scroll)
+ {
+ mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + mScrollButtonHPad,
+ height, width - scroll_button_rect.getWidth() - mScrollButtonHPad, 0));
+ }
+ else
+ {
+ mScrollArea->setRect(LLRect(0,height, width, 0));
+ }
+
+ mShowControls = width >= mMinWidth;
+
+ mScrollArea->setVisible(mShowControls);
+
+ trimChiclets();
+ showScrollButtonsIfNeeded();
+
+}
+
+S32 LLChicletPanel::notifyParent(const LLSD& info)
+{
+ if(info.has("notification"))
+ {
+ std::string str_notification = info["notification"];
+ if(str_notification == "size_changes")
+ {
+ arrange();
+ return 1;
+ }
+ }
+ return LLPanel::notifyParent(info);
}
void LLChicletPanel::setChicletToggleState(const LLUUID& session_id, bool toggle)
{
- if(session_id.isNull())
- {
- LL_WARNS() << "Null Session ID" << LL_ENDL;
- }
-
- // toggle off all chiclets, except specified
- S32 size = getChicletCount();
- for(int n = 0; n < size; ++n)
- {
- LLIMChiclet* chiclet = getChiclet<LLIMChiclet>(n);
- if(chiclet && chiclet->getSessionId() != session_id)
- {
- chiclet->setToggleState(false);
- }
- }
-
- // toggle specified chiclet
- LLIMChiclet* chiclet = findChiclet<LLIMChiclet>(session_id);
- if(chiclet)
- {
- chiclet->setToggleState(toggle);
- }
+ if(session_id.isNull())
+ {
+ LL_WARNS() << "Null Session ID" << LL_ENDL;
+ }
+
+ // toggle off all chiclets, except specified
+ S32 size = getChicletCount();
+ for(int n = 0; n < size; ++n)
+ {
+ LLIMChiclet* chiclet = getChiclet<LLIMChiclet>(n);
+ if(chiclet && chiclet->getSessionId() != session_id)
+ {
+ chiclet->setToggleState(false);
+ }
+ }
+
+ // toggle specified chiclet
+ LLIMChiclet* chiclet = findChiclet<LLIMChiclet>(session_id);
+ if(chiclet)
+ {
+ chiclet->setToggleState(toggle);
+ }
}
void LLChicletPanel::arrange()
{
- if(mChicletList.empty())
- return;
-
- //initial arrange of chicklets positions
- S32 chiclet_left = getChiclet(0)->getRect().mLeft;
- S32 size = getChicletCount();
- for( int n = 0; n < size; ++n)
- {
- LLChiclet* chiclet = getChiclet(n);
-
- S32 chiclet_width = chiclet->getRequiredRect().getWidth();
- LLRect rect = chiclet->getRect();
- rect.set(chiclet_left, rect.mTop, chiclet_left + chiclet_width, rect.mBottom);
-
- chiclet->setRect(rect);
-
- chiclet_left += chiclet_width + getChicletPadding();
- }
-
- //reset size and pos on mScrollArea
- LLRect rect = getRect();
- LLRect scroll_button_rect = mLeftScrollButton->getRect();
-
- bool need_show_scroll = needShowScroll();
- if(need_show_scroll)
- {
- mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + mScrollButtonHPad,
- rect.getHeight(), rect.getWidth() - scroll_button_rect.getWidth() - mScrollButtonHPad, 0));
- }
- else
- {
- mScrollArea->setRect(LLRect(0,rect.getHeight(), rect.getWidth(), 0));
- }
-
- trimChiclets();
- showScrollButtonsIfNeeded();
+ if(mChicletList.empty())
+ return;
+
+ //initial arrange of chicklets positions
+ S32 chiclet_left = getChiclet(0)->getRect().mLeft;
+ S32 size = getChicletCount();
+ for( int n = 0; n < size; ++n)
+ {
+ LLChiclet* chiclet = getChiclet(n);
+
+ S32 chiclet_width = chiclet->getRequiredRect().getWidth();
+ LLRect rect = chiclet->getRect();
+ rect.set(chiclet_left, rect.mTop, chiclet_left + chiclet_width, rect.mBottom);
+
+ chiclet->setRect(rect);
+
+ chiclet_left += chiclet_width + getChicletPadding();
+ }
+
+ //reset size and pos on mScrollArea
+ LLRect rect = getRect();
+ LLRect scroll_button_rect = mLeftScrollButton->getRect();
+
+ bool need_show_scroll = needShowScroll();
+ if(need_show_scroll)
+ {
+ mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + mScrollButtonHPad,
+ rect.getHeight(), rect.getWidth() - scroll_button_rect.getWidth() - mScrollButtonHPad, 0));
+ }
+ else
+ {
+ mScrollArea->setRect(LLRect(0,rect.getHeight(), rect.getWidth(), 0));
+ }
+
+ trimChiclets();
+ showScrollButtonsIfNeeded();
}
void LLChicletPanel::trimChiclets()
{
- // trim right
- if(!mChicletList.empty())
- {
- S32 last_chiclet_right = (*mChicletList.rbegin())->getRect().mRight;
- S32 first_chiclet_left = getChiclet(0)->getRect().mLeft;
- S32 scroll_width = mScrollArea->getRect().getWidth();
- if(last_chiclet_right < scroll_width || first_chiclet_left > 0)
- {
- shiftChiclets(scroll_width - last_chiclet_right);
- }
- }
+ // trim right
+ if(!mChicletList.empty())
+ {
+ S32 last_chiclet_right = (*mChicletList.rbegin())->getRect().mRight;
+ S32 first_chiclet_left = getChiclet(0)->getRect().mLeft;
+ S32 scroll_width = mScrollArea->getRect().getWidth();
+ if(last_chiclet_right < scroll_width || first_chiclet_left > 0)
+ {
+ shiftChiclets(scroll_width - last_chiclet_right);
+ }
+ }
}
bool LLChicletPanel::needShowScroll()
{
- if(mChicletList.empty())
- return false;
-
- S32 chicklet_width = (*mChicletList.rbegin())->getRect().mRight - (*mChicletList.begin())->getRect().mLeft;
+ if(mChicletList.empty())
+ return false;
- return chicklet_width>getRect().getWidth();
+ S32 chicklet_width = (*mChicletList.rbegin())->getRect().mRight - (*mChicletList.begin())->getRect().mLeft;
+
+ return chicklet_width>getRect().getWidth();
}
void LLChicletPanel::showScrollButtonsIfNeeded()
{
- bool can_scroll_left = canScrollLeft();
- bool can_scroll_right = canScrollRight();
+ bool can_scroll_left = canScrollLeft();
+ bool can_scroll_right = canScrollRight();
- mLeftScrollButton->setEnabled(can_scroll_left);
- mRightScrollButton->setEnabled(can_scroll_right);
+ mLeftScrollButton->setEnabled(can_scroll_left);
+ mRightScrollButton->setEnabled(can_scroll_right);
- bool show_scroll_buttons = (can_scroll_left || can_scroll_right) && mShowControls;
+ bool show_scroll_buttons = (can_scroll_left || can_scroll_right) && mShowControls;
- mLeftScrollButton->setVisible(show_scroll_buttons);
- mRightScrollButton->setVisible(show_scroll_buttons);
+ mLeftScrollButton->setVisible(show_scroll_buttons);
+ mRightScrollButton->setVisible(show_scroll_buttons);
}
void LLChicletPanel::draw()
{
- child_list_const_iter_t it = getChildList()->begin();
- for( ; getChildList()->end() != it; ++it)
- {
- LLView* child = *it;
- if(child == dynamic_cast<LLView*>(mScrollArea))
- {
- LLLocalClipRect clip(mScrollArea->getRect());
- drawChild(mScrollArea);
- }
- else
- {
- drawChild(child);
- }
- }
+ child_list_const_iter_t it = getChildList()->begin();
+ for( ; getChildList()->end() != it; ++it)
+ {
+ LLView* child = *it;
+ if(child == dynamic_cast<LLView*>(mScrollArea))
+ {
+ LLLocalClipRect clip(mScrollArea->getRect());
+ drawChild(mScrollArea);
+ }
+ else
+ {
+ drawChild(child);
+ }
+ }
}
bool LLChicletPanel::canScrollRight()
{
- if(mChicletList.empty())
- return false;
+ if(mChicletList.empty())
+ return false;
- S32 scroll_width = mScrollArea->getRect().getWidth();
- S32 last_chiclet_right = (*mChicletList.rbegin())->getRect().mRight;
+ S32 scroll_width = mScrollArea->getRect().getWidth();
+ S32 last_chiclet_right = (*mChicletList.rbegin())->getRect().mRight;
- if(last_chiclet_right > scroll_width)
- return true;
+ if(last_chiclet_right > scroll_width)
+ return true;
- return false;
+ return false;
}
bool LLChicletPanel::canScrollLeft()
{
- if(mChicletList.empty())
- return false;
+ if(mChicletList.empty())
+ return false;
- return getChiclet(0)->getRect().mLeft < 0;
+ return getChiclet(0)->getRect().mLeft < 0;
}
void LLChicletPanel::scroll(S32 offset)
{
- shiftChiclets(offset);
+ shiftChiclets(offset);
}
void LLChicletPanel::shiftChiclets(S32 offset, S32 start_index /* = 0 */)
{
- if(start_index < 0 || start_index >= getChicletCount())
- {
- return;
- }
+ if(start_index < 0 || start_index >= getChicletCount())
+ {
+ return;
+ }
- chiclet_list_t::const_iterator it = mChicletList.begin() + start_index;
- for(;mChicletList.end() != it; ++it)
- {
- LLChiclet* chiclet = *it;
- chiclet->translate(offset,0);
- }
+ chiclet_list_t::const_iterator it = mChicletList.begin() + start_index;
+ for(;mChicletList.end() != it; ++it)
+ {
+ LLChiclet* chiclet = *it;
+ chiclet->translate(offset,0);
+ }
}
void LLChicletPanel::scrollLeft()
{
- if(canScrollLeft())
- {
- S32 offset = getScrollingOffset();
- LLRect first_chiclet_rect = getChiclet(0)->getRect();
+ if(canScrollLeft())
+ {
+ S32 offset = getScrollingOffset();
+ LLRect first_chiclet_rect = getChiclet(0)->getRect();
+
+ // shift chiclets in case first chiclet is partially visible
+ if(first_chiclet_rect.mLeft < 0 && first_chiclet_rect.mRight > 0)
+ {
+ offset = llabs(first_chiclet_rect.mLeft);
+ }
- // shift chiclets in case first chiclet is partially visible
- if(first_chiclet_rect.mLeft < 0 && first_chiclet_rect.mRight > 0)
- {
- offset = llabs(first_chiclet_rect.mLeft);
- }
+ scroll(offset);
- scroll(offset);
-
- showScrollButtonsIfNeeded();
- }
+ showScrollButtonsIfNeeded();
+ }
}
void LLChicletPanel::scrollRight()
{
- if(canScrollRight())
- {
- S32 offset = - getScrollingOffset();
+ if(canScrollRight())
+ {
+ S32 offset = - getScrollingOffset();
+
+ S32 last_chiclet_right = (*mChicletList.rbegin())->getRect().mRight;
+ S32 scroll_rect_width = mScrollArea->getRect().getWidth();
+ // if after scrolling, the last chiclet will not be aligned to
+ // scroll area right side - align it.
+ if( last_chiclet_right + offset < scroll_rect_width )
+ {
+ offset = scroll_rect_width - last_chiclet_right;
+ }
- S32 last_chiclet_right = (*mChicletList.rbegin())->getRect().mRight;
- S32 scroll_rect_width = mScrollArea->getRect().getWidth();
- // if after scrolling, the last chiclet will not be aligned to
- // scroll area right side - align it.
- if( last_chiclet_right + offset < scroll_rect_width )
- {
- offset = scroll_rect_width - last_chiclet_right;
- }
+ scroll(offset);
- scroll(offset);
-
- showScrollButtonsIfNeeded();
- }
+ showScrollButtonsIfNeeded();
+ }
}
void LLChicletPanel::onLeftScrollClick()
{
- scrollLeft();
+ scrollLeft();
}
void LLChicletPanel::onRightScrollClick()
{
- scrollRight();
+ scrollRight();
}
void LLChicletPanel::onLeftScrollHeldDown()
{
- S32 offset = mScrollingOffset;
- mScrollingOffset = mScrollingOffset / mScrollRatio;
- scrollLeft();
- mScrollingOffset = offset;
+ S32 offset = mScrollingOffset;
+ mScrollingOffset = mScrollingOffset / mScrollRatio;
+ scrollLeft();
+ mScrollingOffset = offset;
}
void LLChicletPanel::onRightScrollHeldDown()
{
- S32 offset = mScrollingOffset;
- mScrollingOffset = mScrollingOffset / mScrollRatio;
- scrollRight();
- mScrollingOffset = offset;
+ S32 offset = mScrollingOffset;
+ mScrollingOffset = mScrollingOffset / mScrollRatio;
+ scrollRight();
+ mScrollingOffset = offset;
}
boost::signals2::connection LLChicletPanel::setChicletClickedCallback(
- const commit_callback_t& cb)
+ const commit_callback_t& cb)
{
- return setCommitCallback(cb);
+ return setCommitCallback(cb);
}
BOOL LLChicletPanel::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
- if(clicks > 0)
- {
- scrollRight();
- }
- else
- {
- scrollLeft();
- }
- return TRUE;
+ if(clicks > 0)
+ {
+ scrollRight();
+ }
+ else
+ {
+ scrollLeft();
+ }
+ return TRUE;
}
bool LLChicletPanel::isAnyIMFloaterDoked()
{
- bool res = false;
- for (chiclet_list_t::iterator it = mChicletList.begin(); it
- != mChicletList.end(); it++)
- {
- LLFloaterIMSession* im_floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>(
- "impanel", (*it)->getSessionId());
- if (im_floater != NULL && im_floater->getVisible()
- && !im_floater->isMinimized() && im_floater->isDocked())
- {
- res = true;
- break;
- }
- }
+ bool res = false;
+ for (chiclet_list_t::iterator it = mChicletList.begin(); it
+ != mChicletList.end(); it++)
+ {
+ LLFloaterIMSession* im_floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>(
+ "impanel", (*it)->getSessionId());
+ if (im_floater != NULL && im_floater->getVisible()
+ && !im_floater->isMinimized() && im_floater->isDocked())
+ {
+ res = true;
+ break;
+ }
+ }
- return res;
+ return res;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
LLChicletNotificationCounterCtrl::Params::Params()
- : max_displayed_count("max_displayed_count", 99)
+ : max_displayed_count("max_displayed_count", 99)
{
}
@@ -1059,14 +1059,14 @@ LLChicletInvOfferIconCtrl::LLChicletInvOfferIconCtrl(const Params& p)
void LLChicletInvOfferIconCtrl::setValue(const LLSD& value )
{
- if(value.asUUID().isNull())
- {
- LLIconCtrl::setValue(mDefaultIcon);
- }
- else
- {
- LLChicletAvatarIconCtrl::setValue(value);
- }
+ if(value.asUUID().isNull())
+ {
+ LLIconCtrl::setValue(mDefaultIcon);
+ }
+ else
+ {
+ LLChicletAvatarIconCtrl::setValue(value);
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -1084,63 +1084,63 @@ LLScriptChiclet::LLScriptChiclet(const Params&p)
: LLIMChiclet(p)
, mChicletIconCtrl(NULL)
{
- LLButton::Params button_params = p.chiclet_button;
- mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
- addChild(mChicletButton);
+ LLButton::Params button_params = p.chiclet_button;
+ mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+ addChild(mChicletButton);
- LLIconCtrl::Params new_msg_params = p.new_message_icon;
- mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
- addChild(mNewMessagesIcon);
+ LLIconCtrl::Params new_msg_params = p.new_message_icon;
+ mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
+ addChild(mNewMessagesIcon);
- LLIconCtrl::Params icon_params = p.icon;
- mChicletIconCtrl = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
- addChild(mChicletIconCtrl);
+ LLIconCtrl::Params icon_params = p.icon;
+ mChicletIconCtrl = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+ addChild(mChicletIconCtrl);
- sendChildToFront(mNewMessagesIcon);
+ sendChildToFront(mNewMessagesIcon);
}
void LLScriptChiclet::setSessionId(const LLUUID& session_id)
{
- setShowNewMessagesIcon( getSessionId() != session_id );
+ setShowNewMessagesIcon( getSessionId() != session_id );
- LLIMChiclet::setSessionId(session_id);
+ LLIMChiclet::setSessionId(session_id);
- setToolTip(LLScriptFloaterManager::getObjectName(session_id));
+ setToolTip(LLScriptFloaterManager::getObjectName(session_id));
}
void LLScriptChiclet::onMouseDown()
{
- LLScriptFloaterManager::getInstance()->toggleScriptFloater(getSessionId());
+ LLScriptFloaterManager::getInstance()->toggleScriptFloater(getSessionId());
}
void LLScriptChiclet::onMenuItemClicked(const LLSD& user_data)
{
- std::string action = user_data.asString();
+ std::string action = user_data.asString();
- if("end" == action)
- {
- LLScriptFloaterManager::instance().removeNotification(getSessionId());
- }
- else if ("close all" == action)
- {
- LLIMWellWindow::getInstance()->closeAll();
- }
+ if("end" == action)
+ {
+ LLScriptFloaterManager::instance().removeNotification(getSessionId());
+ }
+ else if ("close all" == action)
+ {
+ LLIMWellWindow::getInstance()->closeAll();
+ }
}
void LLScriptChiclet::createPopupMenu()
{
- if(!canCreateMenu())
- return;
+ if(!canCreateMenu())
+ return;
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- registrar.add("ScriptChiclet.Action", boost::bind(&LLScriptChiclet::onMenuItemClicked, this, _2));
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ registrar.add("ScriptChiclet.Action", boost::bind(&LLScriptChiclet::onMenuItemClicked, this, _2));
- LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>
- ("menu_script_chiclet.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if (menu)
- {
- mPopupMenuHandle = menu->getHandle();
- }
+ LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>
+ ("menu_script_chiclet.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (menu)
+ {
+ mPopupMenuHandle = menu->getHandle();
+ }
}
@@ -1148,7 +1148,7 @@ void LLScriptChiclet::createPopupMenu()
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
-static const std::string INVENTORY_USER_OFFER ("UserGiveItem");
+static const std::string INVENTORY_USER_OFFER ("UserGiveItem");
LLInvOfferChiclet::Params::Params()
: icon("icon")
@@ -1161,69 +1161,69 @@ LLInvOfferChiclet::LLInvOfferChiclet(const Params&p)
: LLIMChiclet(p)
, mChicletIconCtrl(NULL)
{
- LLButton::Params button_params = p.chiclet_button;
- mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
- addChild(mChicletButton);
+ LLButton::Params button_params = p.chiclet_button;
+ mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+ addChild(mChicletButton);
- LLIconCtrl::Params new_msg_params = p.new_message_icon;
- mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
- addChild(mNewMessagesIcon);
+ LLIconCtrl::Params new_msg_params = p.new_message_icon;
+ mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
+ addChild(mNewMessagesIcon);
- LLChicletInvOfferIconCtrl::Params icon_params = p.icon;
- mChicletIconCtrl = LLUICtrlFactory::create<LLChicletInvOfferIconCtrl>(icon_params);
- addChild(mChicletIconCtrl);
+ LLChicletInvOfferIconCtrl::Params icon_params = p.icon;
+ mChicletIconCtrl = LLUICtrlFactory::create<LLChicletInvOfferIconCtrl>(icon_params);
+ addChild(mChicletIconCtrl);
- sendChildToFront(mNewMessagesIcon);
+ sendChildToFront(mNewMessagesIcon);
}
void LLInvOfferChiclet::setSessionId(const LLUUID& session_id)
{
- setShowNewMessagesIcon( getSessionId() != session_id );
+ setShowNewMessagesIcon( getSessionId() != session_id );
- setToolTip(LLScriptFloaterManager::getObjectName(session_id));
+ setToolTip(LLScriptFloaterManager::getObjectName(session_id));
- LLIMChiclet::setSessionId(session_id);
- LLNotificationPtr notification = LLNotifications::getInstance()->find(session_id);
+ LLIMChiclet::setSessionId(session_id);
+ LLNotificationPtr notification = LLNotifications::getInstance()->find(session_id);
- if ( notification && notification->getName() == INVENTORY_USER_OFFER )
- {
- mChicletIconCtrl->setValue(notification->getPayload()["from_id"]);
- }
- else
- {
- mChicletIconCtrl->setValue(LLUUID::null);
- }
+ if ( notification && notification->getName() == INVENTORY_USER_OFFER )
+ {
+ mChicletIconCtrl->setValue(notification->getPayload()["from_id"]);
+ }
+ else
+ {
+ mChicletIconCtrl->setValue(LLUUID::null);
+ }
}
void LLInvOfferChiclet::onMouseDown()
{
- LLScriptFloaterManager::instance().toggleScriptFloater(getSessionId());
+ LLScriptFloaterManager::instance().toggleScriptFloater(getSessionId());
}
void LLInvOfferChiclet::onMenuItemClicked(const LLSD& user_data)
{
- std::string action = user_data.asString();
+ std::string action = user_data.asString();
- if("end" == action)
- {
- LLScriptFloaterManager::instance().removeNotification(getSessionId());
- }
+ if("end" == action)
+ {
+ LLScriptFloaterManager::instance().removeNotification(getSessionId());
+ }
}
void LLInvOfferChiclet::createPopupMenu()
{
- if(!canCreateMenu())
- return;
+ if(!canCreateMenu())
+ return;
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- registrar.add("InvOfferChiclet.Action", boost::bind(&LLInvOfferChiclet::onMenuItemClicked, this, _2));
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ registrar.add("InvOfferChiclet.Action", boost::bind(&LLInvOfferChiclet::onMenuItemClicked, this, _2));
- LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>
- ("menu_inv_offer_chiclet.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if (menu)
- {
- mPopupMenuHandle = menu->getHandle();
- }
+ LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>
+ ("menu_inv_offer_chiclet.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (menu)
+ {
+ mPopupMenuHandle = menu->getHandle();
+ }
}
// EOF
diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h
index 1698fa269a..39b5e01d80 100644
--- a/indra/newview/llchiclet.h
+++ b/indra/newview/llchiclet.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchiclet.h
* @brief LLChiclet class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,55 +42,55 @@ class LLChicletNotificationCounterCtrl : public LLTextBox
{
public:
- struct Params : public LLInitParam::Block<Params, LLTextBox::Params>
- {
- /**
- * Contains maximum displayed count of unread messages. Default value is 9.
- *
- * If count is less than "max_unread_count" will be displayed as is.
- * Otherwise 9+ will be shown (for default value).
- */
- Optional<S32> max_displayed_count;
-
- Params();
- };
-
- /**
- * Sets number of notifications
- */
- virtual void setCounter(S32 counter);
-
- /**
- * Returns number of notifications
- */
- virtual S32 getCounter() const { return mCounter; }
-
- /**
- * Returns width, required to display amount of notifications in text form.
- * Width is the only valid value.
- */
- /*virtual*/ LLRect getRequiredRect();
-
- /**
- * Sets number of notifications using LLSD
- */
- /*virtual*/ void setValue(const LLSD& value);
-
- /**
- * Returns number of notifications wrapped in LLSD
- */
- /*virtual*/ LLSD getValue() const;
+ struct Params : public LLInitParam::Block<Params, LLTextBox::Params>
+ {
+ /**
+ * Contains maximum displayed count of unread messages. Default value is 9.
+ *
+ * If count is less than "max_unread_count" will be displayed as is.
+ * Otherwise 9+ will be shown (for default value).
+ */
+ Optional<S32> max_displayed_count;
+
+ Params();
+ };
+
+ /**
+ * Sets number of notifications
+ */
+ virtual void setCounter(S32 counter);
+
+ /**
+ * Returns number of notifications
+ */
+ virtual S32 getCounter() const { return mCounter; }
+
+ /**
+ * Returns width, required to display amount of notifications in text form.
+ * Width is the only valid value.
+ */
+ /*virtual*/ LLRect getRequiredRect();
+
+ /**
+ * Sets number of notifications using LLSD
+ */
+ /*virtual*/ void setValue(const LLSD& value);
+
+ /**
+ * Returns number of notifications wrapped in LLSD
+ */
+ /*virtual*/ LLSD getValue() const;
protected:
- LLChicletNotificationCounterCtrl(const Params& p);
- friend class LLUICtrlFactory;
+ LLChicletNotificationCounterCtrl(const Params& p);
+ friend class LLUICtrlFactory;
private:
- S32 mCounter;
- S32 mInitialWidth;
- S32 mMaxDisplayedCount;
+ S32 mCounter;
+ S32 mInitialWidth;
+ S32 mMaxDisplayedCount;
};
/**
@@ -100,20 +100,20 @@ class LLChicletAvatarIconCtrl : public LLAvatarIconCtrl
{
public:
- struct Params : public LLInitParam::Block<Params, LLAvatarIconCtrl::Params>
- {
- Params()
- {
- changeDefault(draw_tooltip, FALSE);
- changeDefault(mouse_opaque, FALSE);
- changeDefault(default_icon_name, "Generic_Person");
- };
- };
+ struct Params : public LLInitParam::Block<Params, LLAvatarIconCtrl::Params>
+ {
+ Params()
+ {
+ changeDefault(draw_tooltip, FALSE);
+ changeDefault(mouse_opaque, FALSE);
+ changeDefault(default_icon_name, "Generic_Person");
+ };
+ };
protected:
- LLChicletAvatarIconCtrl(const Params& p);
- friend class LLUICtrlFactory;
+ LLChicletAvatarIconCtrl(const Params& p);
+ friend class LLUICtrlFactory;
};
/**
@@ -123,30 +123,30 @@ class LLChicletInvOfferIconCtrl : public LLChicletAvatarIconCtrl
{
public:
- struct Params :
- public LLInitParam::Block<Params, LLChicletAvatarIconCtrl::Params>
- {
- Optional<std::string> default_icon;
+ struct Params :
+ public LLInitParam::Block<Params, LLChicletAvatarIconCtrl::Params>
+ {
+ Optional<std::string> default_icon;
- Params()
- : default_icon("default_icon", "Generic_Object_Small")
- {
- changeDefault(avatar_id, LLUUID::null);
- };
- };
+ Params()
+ : default_icon("default_icon", "Generic_Object_Small")
+ {
+ changeDefault(avatar_id, LLUUID::null);
+ };
+ };
- /**
- * Sets icon, if value is LLUUID::null - default icon will be set.
- */
- virtual void setValue(const LLSD& value );
+ /**
+ * Sets icon, if value is LLUUID::null - default icon will be set.
+ */
+ virtual void setValue(const LLSD& value );
protected:
- LLChicletInvOfferIconCtrl(const Params& p);
- friend class LLUICtrlFactory;
+ LLChicletInvOfferIconCtrl(const Params& p);
+ friend class LLUICtrlFactory;
private:
- std::string mDefaultIcon;
+ std::string mDefaultIcon;
};
/**
@@ -156,81 +156,81 @@ class LLChiclet : public LLUICtrl
{
public:
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<bool> show_counter,
- enable_counter;
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Optional<bool> show_counter,
+ enable_counter;
- Params();
- };
+ Params();
+ };
- virtual ~LLChiclet() {}
+ virtual ~LLChiclet() {}
- /**
- * Associates chat session id with chiclet.
- */
- virtual void setSessionId(const LLUUID& session_id) { mSessionId = session_id; }
+ /**
+ * Associates chat session id with chiclet.
+ */
+ virtual void setSessionId(const LLUUID& session_id) { mSessionId = session_id; }
- /**
- * Returns associated chat session.
- */
- virtual const LLUUID& getSessionId() const { return mSessionId; }
+ /**
+ * Returns associated chat session.
+ */
+ virtual const LLUUID& getSessionId() const { return mSessionId; }
- /**
- * Sets show counter state.
- */
- virtual void setShowCounter(bool show) { mShowCounter = show; }
+ /**
+ * Sets show counter state.
+ */
+ virtual void setShowCounter(bool show) { mShowCounter = show; }
- /**
- * Connects chiclet clicked event with callback.
- */
- /*virtual*/ boost::signals2::connection setLeftButtonClickCallback(
- const commit_callback_t& cb);
+ /**
+ * Connects chiclet clicked event with callback.
+ */
+ /*virtual*/ boost::signals2::connection setLeftButtonClickCallback(
+ const commit_callback_t& cb);
- typedef boost::function<void (LLChiclet* ctrl, const LLSD& param)>
- chiclet_size_changed_callback_t;
+ typedef boost::function<void (LLChiclet* ctrl, const LLSD& param)>
+ chiclet_size_changed_callback_t;
- /**
- * Connects chiclets size changed event with callback.
- */
- virtual boost::signals2::connection setChicletSizeChangedCallback(
- const chiclet_size_changed_callback_t& cb);
+ /**
+ * Connects chiclets size changed event with callback.
+ */
+ virtual boost::signals2::connection setChicletSizeChangedCallback(
+ const chiclet_size_changed_callback_t& cb);
- /**
- * Sets IM Session id using LLSD
- */
- /*virtual*/ LLSD getValue() const;
+ /**
+ * Sets IM Session id using LLSD
+ */
+ /*virtual*/ LLSD getValue() const;
- /**
- * Returns IM Session id using LLSD
- */
- /*virtual*/ void setValue(const LLSD& value);
+ /**
+ * Returns IM Session id using LLSD
+ */
+ /*virtual*/ void setValue(const LLSD& value);
protected:
- friend class LLUICtrlFactory;
- LLChiclet(const Params& p);
+ friend class LLUICtrlFactory;
+ LLChiclet(const Params& p);
- /**
- * Notifies subscribers about click on chiclet.
- */
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /**
+ * Notifies subscribers about click on chiclet.
+ */
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /**
- * Notifies subscribers about chiclet size changed event.
- */
- virtual void onChicletSizeChanged();
+ /**
+ * Notifies subscribers about chiclet size changed event.
+ */
+ virtual void onChicletSizeChanged();
private:
- LLUUID mSessionId;
+ LLUUID mSessionId;
- bool mShowCounter;
+ bool mShowCounter;
- typedef boost::signals2::signal<void (LLChiclet* ctrl, const LLSD& param)>
- chiclet_size_changed_signal_t;
+ typedef boost::signals2::signal<void (LLChiclet* ctrl, const LLSD& param)>
+ chiclet_size_changed_signal_t;
- chiclet_size_changed_signal_t mChicletSizeChangedSignal;
+ chiclet_size_changed_signal_t mChicletSizeChangedSignal;
};
@@ -242,122 +242,122 @@ private:
class LLIMChiclet : public LLChiclet
{
public:
- enum EType {
- TYPE_UNKNOWN,
- TYPE_IM,
- TYPE_GROUP,
- TYPE_AD_HOC
- };
- struct Params : public LLInitParam::Block<Params, LLChiclet::Params>
- {};
-
-
- virtual ~LLIMChiclet();
-
- /**
- * It is used for default setting up of chicklet:click handler, etc.
- */
- BOOL postBuild();
-
- /**
- * Sets IM session name. This name will be displayed in chiclet tooltip.
- */
- virtual void setIMSessionName(const std::string& name) { setToolTip(name); }
-
- /**
- * Sets id of person/group user is chatting with.
- * Session id should be set before calling this
- */
- virtual void setOtherParticipantId(const LLUUID& other_participant_id) { mOtherParticipantId = other_participant_id; }
-
- /**
- * Enables/disables the counter control for a chiclet.
- */
- virtual void enableCounterControl(bool enable);
-
- /**
- * Sets required width for a chiclet according to visible controls.
- */
- virtual void setRequiredWidth();
-
- /**
- * Shows/hides overlay icon concerning new unread messages.
- */
- virtual void setShowNewMessagesIcon(bool show);
-
- /**
- * Returns visibility of overlay icon concerning new unread messages.
- */
- virtual bool getShowNewMessagesIcon();
-
- /**
- * The action taken on mouse down event.
- *
- * Made public so that it can be triggered from outside
- * (more specifically, from the Active IM window).
- */
- virtual void onMouseDown();
-
- virtual void setToggleState(bool toggle);
-
- /**
- * Displays popup menu.
- */
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
-
- void hidePopupMenu();
+ enum EType {
+ TYPE_UNKNOWN,
+ TYPE_IM,
+ TYPE_GROUP,
+ TYPE_AD_HOC
+ };
+ struct Params : public LLInitParam::Block<Params, LLChiclet::Params>
+ {};
+
+
+ virtual ~LLIMChiclet();
+
+ /**
+ * It is used for default setting up of chicklet:click handler, etc.
+ */
+ BOOL postBuild();
+
+ /**
+ * Sets IM session name. This name will be displayed in chiclet tooltip.
+ */
+ virtual void setIMSessionName(const std::string& name) { setToolTip(name); }
+
+ /**
+ * Sets id of person/group user is chatting with.
+ * Session id should be set before calling this
+ */
+ virtual void setOtherParticipantId(const LLUUID& other_participant_id) { mOtherParticipantId = other_participant_id; }
+
+ /**
+ * Enables/disables the counter control for a chiclet.
+ */
+ virtual void enableCounterControl(bool enable);
+
+ /**
+ * Sets required width for a chiclet according to visible controls.
+ */
+ virtual void setRequiredWidth();
+
+ /**
+ * Shows/hides overlay icon concerning new unread messages.
+ */
+ virtual void setShowNewMessagesIcon(bool show);
+
+ /**
+ * Returns visibility of overlay icon concerning new unread messages.
+ */
+ virtual bool getShowNewMessagesIcon();
+
+ /**
+ * The action taken on mouse down event.
+ *
+ * Made public so that it can be triggered from outside
+ * (more specifically, from the Active IM window).
+ */
+ virtual void onMouseDown();
+
+ virtual void setToggleState(bool toggle);
+
+ /**
+ * Displays popup menu.
+ */
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+
+ void hidePopupMenu();
protected:
- LLIMChiclet(const LLIMChiclet::Params& p);
+ LLIMChiclet(const LLIMChiclet::Params& p);
protected:
- /**
- * Creates chiclet popup menu.
- */
- virtual void createPopupMenu() = 0;
+ /**
+ * Creates chiclet popup menu.
+ */
+ virtual void createPopupMenu() = 0;
- /**
- * Enables/disables menus.
- */
- virtual void updateMenuItems() {};
+ /**
+ * Enables/disables menus.
+ */
+ virtual void updateMenuItems() {};
- bool canCreateMenu();
+ bool canCreateMenu();
- LLHandle<LLUICtrl> mPopupMenuHandle;
+ LLHandle<LLUICtrl> mPopupMenuHandle;
- bool mShowSpeaker;
- bool mCounterEnabled;
- /* initial width of chiclet, should not include counter or speaker width */
- S32 mDefaultWidth;
+ bool mShowSpeaker;
+ bool mCounterEnabled;
+ /* initial width of chiclet, should not include counter or speaker width */
+ S32 mDefaultWidth;
- LLIconCtrl* mNewMessagesIcon;
- LLButton* mChicletButton;
+ LLIconCtrl* mNewMessagesIcon;
+ LLButton* mChicletButton;
- /** the id of another participant, either an avatar id or a group id*/
- LLUUID mOtherParticipantId;
+ /** the id of another participant, either an avatar id or a group id*/
+ LLUUID mOtherParticipantId;
- template<typename Container>
- struct CollectChicletCombiner {
- typedef Container result_type;
+ template<typename Container>
+ struct CollectChicletCombiner {
+ typedef Container result_type;
- template<typename InputIterator>
- Container operator()(InputIterator first, InputIterator last) const {
- Container c = Container();
- for (InputIterator iter = first; iter != last; iter++) {
- if (*iter != NULL) {
- c.push_back(*iter);
- }
- }
- return c;
- }
- };
+ template<typename InputIterator>
+ Container operator()(InputIterator first, InputIterator last) const {
+ Container c = Container();
+ for (InputIterator iter = first; iter != last; iter++) {
+ if (*iter != NULL) {
+ c.push_back(*iter);
+ }
+ }
+ return c;
+ }
+ };
public:
- static boost::signals2::signal<LLChiclet* (const LLUUID&),
- CollectChicletCombiner<std::list<LLChiclet*> > >
- sFindChicletsSignal;
+ static boost::signals2::signal<LLChiclet* (const LLUUID&),
+ CollectChicletCombiner<std::list<LLChiclet*> > >
+ sFindChicletsSignal;
};
@@ -368,42 +368,42 @@ class LLScriptChiclet : public LLIMChiclet
{
public:
- struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
- {
- Optional<LLButton::Params> chiclet_button;
+ struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
+ {
+ Optional<LLButton::Params> chiclet_button;
- Optional<LLIconCtrl::Params> icon;
+ Optional<LLIconCtrl::Params> icon;
- Optional<LLIconCtrl::Params> new_message_icon;
+ Optional<LLIconCtrl::Params> new_message_icon;
- Params();
- };
+ Params();
+ };
- /*virtual*/ void setSessionId(const LLUUID& session_id);
+ /*virtual*/ void setSessionId(const LLUUID& session_id);
- /**
- * Toggle script floater
- */
- /*virtual*/ void onMouseDown();
+ /**
+ * Toggle script floater
+ */
+ /*virtual*/ void onMouseDown();
protected:
- LLScriptChiclet(const Params&);
- friend class LLUICtrlFactory;
+ LLScriptChiclet(const Params&);
+ friend class LLUICtrlFactory;
- /**
- * Creates chiclet popup menu.
- */
- virtual void createPopupMenu();
+ /**
+ * Creates chiclet popup menu.
+ */
+ virtual void createPopupMenu();
- /**
- * Processes clicks on chiclet popup menu.
- */
- virtual void onMenuItemClicked(const LLSD& user_data);
+ /**
+ * Processes clicks on chiclet popup menu.
+ */
+ virtual void onMenuItemClicked(const LLSD& user_data);
private:
- LLIconCtrl* mChicletIconCtrl;
+ LLIconCtrl* mChicletIconCtrl;
};
/**
@@ -413,493 +413,493 @@ class LLInvOfferChiclet: public LLIMChiclet
{
public:
- struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
- {
- Optional<LLButton::Params> chiclet_button;
+ struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
+ {
+ Optional<LLButton::Params> chiclet_button;
- Optional<LLChicletInvOfferIconCtrl::Params> icon;
+ Optional<LLChicletInvOfferIconCtrl::Params> icon;
- Optional<LLIconCtrl::Params> new_message_icon;
+ Optional<LLIconCtrl::Params> new_message_icon;
- Params();
- };
+ Params();
+ };
- /*virtual*/ void setSessionId(const LLUUID& session_id);
+ /*virtual*/ void setSessionId(const LLUUID& session_id);
- /**
- * Toggle script floater
- */
- /*virtual*/ void onMouseDown();
+ /**
+ * Toggle script floater
+ */
+ /*virtual*/ void onMouseDown();
protected:
- LLInvOfferChiclet(const Params&);
- friend class LLUICtrlFactory;
+ LLInvOfferChiclet(const Params&);
+ friend class LLUICtrlFactory;
- /**
- * Creates chiclet popup menu.
- */
- virtual void createPopupMenu();
+ /**
+ * Creates chiclet popup menu.
+ */
+ virtual void createPopupMenu();
- /**
- * Processes clicks on chiclet popup menu.
- */
- virtual void onMenuItemClicked(const LLSD& user_data);
+ /**
+ * Processes clicks on chiclet popup menu.
+ */
+ virtual void onMenuItemClicked(const LLSD& user_data);
private:
- LLChicletInvOfferIconCtrl* mChicletIconCtrl;
+ LLChicletInvOfferIconCtrl* mChicletIconCtrl;
};
/**
- * Implements notification chiclet. Used to display total amount of unread messages
+ * Implements notification chiclet. Used to display total amount of unread messages
* across all IM sessions, total amount of system notifications. See EXT-3147 for details
*/
class LLSysWellChiclet : public LLChiclet
{
public:
-
- struct Params : public LLInitParam::Block<Params, LLChiclet::Params>
- {
- Optional<LLButton::Params> button;
- Optional<LLChicletNotificationCounterCtrl::Params> unread_notifications;
+ struct Params : public LLInitParam::Block<Params, LLChiclet::Params>
+ {
+ Optional<LLButton::Params> button;
+
+ Optional<LLChicletNotificationCounterCtrl::Params> unread_notifications;
- /**
- * Contains maximum displayed count of unread messages. Default value is 9.
- *
- * If count is less than "max_unread_count" will be displayed as is.
- * Otherwise 9+ will be shown (for default value).
- */
- Optional<S32> max_displayed_count;
+ /**
+ * Contains maximum displayed count of unread messages. Default value is 9.
+ *
+ * If count is less than "max_unread_count" will be displayed as is.
+ * Otherwise 9+ will be shown (for default value).
+ */
+ Optional<S32> max_displayed_count;
- Params();
- };
+ Params();
+ };
- /*virtual*/ void setCounter(S32 counter);
+ /*virtual*/ void setCounter(S32 counter);
- // *TODO: mantipov: seems getCounter is not necessary for LLNotificationChiclet
- // but inherited interface requires it to implement.
- // Probably it can be safe removed.
- /*virtual*/S32 getCounter() { return mCounter; }
+ // *TODO: mantipov: seems getCounter is not necessary for LLNotificationChiclet
+ // but inherited interface requires it to implement.
+ // Probably it can be safe removed.
+ /*virtual*/S32 getCounter() { return mCounter; }
- boost::signals2::connection setClickCallback(const commit_callback_t& cb);
+ boost::signals2::connection setClickCallback(const commit_callback_t& cb);
- /*virtual*/ ~LLSysWellChiclet();
+ /*virtual*/ ~LLSysWellChiclet();
- void setToggleState(BOOL toggled);
+ void setToggleState(BOOL toggled);
- void setNewMessagesState(bool new_messages);
- //this method should change a widget according to state of the SysWellWindow
- virtual void updateWidget(bool is_window_empty);
+ void setNewMessagesState(bool new_messages);
+ //this method should change a widget according to state of the SysWellWindow
+ virtual void updateWidget(bool is_window_empty);
protected:
- LLSysWellChiclet(const Params& p);
- friend class LLUICtrlFactory;
+ LLSysWellChiclet(const Params& p);
+ friend class LLUICtrlFactory;
- /**
- * Change Well 'Lit' state from 'Lit' to 'Unlit' and vice-versa.
- *
- * There is an assumption that it will be called 2*N times to do not change its start state.
- * @see FlashToLitTimer
- */
- void changeLitState(bool blink);
+ /**
+ * Change Well 'Lit' state from 'Lit' to 'Unlit' and vice-versa.
+ *
+ * There is an assumption that it will be called 2*N times to do not change its start state.
+ * @see FlashToLitTimer
+ */
+ void changeLitState(bool blink);
- /**
- * Displays menu.
- */
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ /**
+ * Displays menu.
+ */
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- virtual void createMenu() = 0;
+ virtual void createMenu() = 0;
protected:
- class FlashToLitTimer;
- LLButton* mButton;
- S32 mCounter;
- S32 mMaxDisplayedCount;
- bool mIsNewMessagesState;
-
- LLFlashTimer* mFlashToLitTimer;
- LLHandle<LLContextMenu> mContextMenuHandle;
+ class FlashToLitTimer;
+ LLButton* mButton;
+ S32 mCounter;
+ S32 mMaxDisplayedCount;
+ bool mIsNewMessagesState;
+
+ LLFlashTimer* mFlashToLitTimer;
+ LLHandle<LLContextMenu> mContextMenuHandle;
};
class LLNotificationChiclet : public LLSysWellChiclet
{
- LOG_CLASS(LLNotificationChiclet);
-
- friend class LLUICtrlFactory;
+ LOG_CLASS(LLNotificationChiclet);
+
+ friend class LLUICtrlFactory;
public:
- struct Params : public LLInitParam::Block<Params, LLSysWellChiclet::Params>{};
-
+ struct Params : public LLInitParam::Block<Params, LLSysWellChiclet::Params>{};
+
protected:
- class ChicletNotificationChannel : public LLNotificationChannel
- {
+ class ChicletNotificationChannel : public LLNotificationChannel
+ {
public:
- ChicletNotificationChannel(LLNotificationChiclet* chiclet)
- : LLNotificationChannel(LLNotificationChannel::Params().filter(filterNotification).name(chiclet->getSessionId().asString()))
- , mChiclet(chiclet)
- {
- // connect counter handlers to the signals
- connectToChannel("Group Notifications");
- connectToChannel("Offer");
- connectToChannel("Notifications");
- }
+ ChicletNotificationChannel(LLNotificationChiclet* chiclet)
+ : LLNotificationChannel(LLNotificationChannel::Params().filter(filterNotification).name(chiclet->getSessionId().asString()))
+ , mChiclet(chiclet)
+ {
+ // connect counter handlers to the signals
+ connectToChannel("Group Notifications");
+ connectToChannel("Offer");
+ connectToChannel("Notifications");
+ }
virtual ~ChicletNotificationChannel() {}
-
- static bool filterNotification(LLNotificationPtr notify);
- // connect counter updaters to the corresponding signals
- /*virtual*/ void onAdd(LLNotificationPtr p) { mChiclet->setCounter(++mChiclet->mUreadSystemNotifications); }
- /*virtual*/ void onLoad(LLNotificationPtr p) { mChiclet->setCounter(++mChiclet->mUreadSystemNotifications); }
- /*virtual*/ void onDelete(LLNotificationPtr p) { mChiclet->setCounter(--mChiclet->mUreadSystemNotifications); }
-
- LLNotificationChiclet* const mChiclet;
- };
-
- boost::scoped_ptr<ChicletNotificationChannel> mNotificationChannel;
+
+ static bool filterNotification(LLNotificationPtr notify);
+ // connect counter updaters to the corresponding signals
+ /*virtual*/ void onAdd(LLNotificationPtr p) { mChiclet->setCounter(++mChiclet->mUreadSystemNotifications); }
+ /*virtual*/ void onLoad(LLNotificationPtr p) { mChiclet->setCounter(++mChiclet->mUreadSystemNotifications); }
+ /*virtual*/ void onDelete(LLNotificationPtr p) { mChiclet->setCounter(--mChiclet->mUreadSystemNotifications); }
+
+ LLNotificationChiclet* const mChiclet;
+ };
+
+ boost::scoped_ptr<ChicletNotificationChannel> mNotificationChannel;
LLNotificationChiclet(const Params& p);
~LLNotificationChiclet();
- /**
- * Processes clicks on chiclet menu.
- */
- void onMenuItemClicked(const LLSD& user_data);
-
- /**
- * Enables chiclet menu items.
- */
- bool enableMenuItem(const LLSD& user_data);
-
- /**
- * Creates menu.
- */
- /*virtual*/ void createMenu();
-
- /*virtual*/ void setCounter(S32 counter);
- S32 mUreadSystemNotifications;
+ /**
+ * Processes clicks on chiclet menu.
+ */
+ void onMenuItemClicked(const LLSD& user_data);
+
+ /**
+ * Enables chiclet menu items.
+ */
+ bool enableMenuItem(const LLSD& user_data);
+
+ /**
+ * Creates menu.
+ */
+ /*virtual*/ void createMenu();
+
+ /*virtual*/ void setCounter(S32 counter);
+ S32 mUreadSystemNotifications;
};
/**
- * Storage class for all IM chiclets. Provides mechanism to display,
+ * Storage class for all IM chiclets. Provides mechanism to display,
* scroll, create, remove chiclets.
*/
class LLChicletPanel : public LLPanel
{
public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {
- Optional<S32> chiclet_padding,
- scrolling_offset,
- scroll_button_hpad,
- scroll_ratio;
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<S32> chiclet_padding,
+ scrolling_offset,
+ scroll_button_hpad,
+ scroll_ratio;
- Optional<S32> min_width;
+ Optional<S32> min_width;
- Params();
- };
+ Params();
+ };
- virtual ~LLChicletPanel();
+ virtual ~LLChicletPanel();
- /**
- * Creates chiclet and adds it to chiclet list at specified index.
- */
- template<class T> T* createChiclet(const LLUUID& session_id, S32 index);
+ /**
+ * Creates chiclet and adds it to chiclet list at specified index.
+ */
+ template<class T> T* createChiclet(const LLUUID& session_id, S32 index);
- /**
- * Creates chiclet and adds it to chiclet list at right.
- */
- template<class T> T* createChiclet(const LLUUID& session_id);
+ /**
+ * Creates chiclet and adds it to chiclet list at right.
+ */
+ template<class T> T* createChiclet(const LLUUID& session_id);
- /**
- * Returns pointer to chiclet of specified type at specified index.
- */
- template<class T> T* getChiclet(S32 index);
+ /**
+ * Returns pointer to chiclet of specified type at specified index.
+ */
+ template<class T> T* getChiclet(S32 index);
- /**
- * Returns pointer to LLChiclet at specified index.
- */
- LLChiclet* getChiclet(S32 index) { return getChiclet<LLChiclet>(index); }
+ /**
+ * Returns pointer to LLChiclet at specified index.
+ */
+ LLChiclet* getChiclet(S32 index) { return getChiclet<LLChiclet>(index); }
- /**
- * Searches a chiclet using IM session id.
- */
- template<class T> T* findChiclet(const LLUUID& im_session_id);
+ /**
+ * Searches a chiclet using IM session id.
+ */
+ template<class T> T* findChiclet(const LLUUID& im_session_id);
- /**
- * Returns number of hosted chiclets.
- */
- S32 getChicletCount() {return mChicletList.size();};
+ /**
+ * Returns number of hosted chiclets.
+ */
+ S32 getChicletCount() {return mChicletList.size();};
- /**
- * Returns index of chiclet in list.
- */
- S32 getChicletIndex(const LLChiclet* chiclet);
+ /**
+ * Returns index of chiclet in list.
+ */
+ S32 getChicletIndex(const LLChiclet* chiclet);
- /**
- * Removes chiclet by index.
- */
- void removeChiclet(S32 index);
+ /**
+ * Removes chiclet by index.
+ */
+ void removeChiclet(S32 index);
- /**
- * Removes chiclet by pointer.
- */
- void removeChiclet(LLChiclet* chiclet);
+ /**
+ * Removes chiclet by pointer.
+ */
+ void removeChiclet(LLChiclet* chiclet);
- /**
- * Removes chiclet by IM session id.
- */
- void removeChiclet(const LLUUID& im_session_id);
+ /**
+ * Removes chiclet by IM session id.
+ */
+ void removeChiclet(const LLUUID& im_session_id);
- /**
- * Removes all chiclets.
- */
- void removeAll();
+ /**
+ * Removes all chiclets.
+ */
+ void removeAll();
- /**
- * Scrolls the panel to the specified chiclet
- */
- void scrollToChiclet(const LLChiclet* chiclet);
+ /**
+ * Scrolls the panel to the specified chiclet
+ */
+ void scrollToChiclet(const LLChiclet* chiclet);
- boost::signals2::connection setChicletClickedCallback(
- const commit_callback_t& cb);
+ boost::signals2::connection setChicletClickedCallback(
+ const commit_callback_t& cb);
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /**
- * Handler for the Voice Client's signal. Finds a corresponding chiclet and toggles its SpeakerControl
- */
- void onCurrentVoiceChannelChanged(const LLUUID& session_id);
+ /**
+ * Handler for the Voice Client's signal. Finds a corresponding chiclet and toggles its SpeakerControl
+ */
+ void onCurrentVoiceChannelChanged(const LLUUID& session_id);
- /**
- * Reshapes controls and rearranges chiclets if needed.
- */
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE );
+ /**
+ * Reshapes controls and rearranges chiclets if needed.
+ */
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE );
- /*virtual*/ void draw();
+ /*virtual*/ void draw();
- S32 getMinWidth() const { return mMinWidth; }
+ S32 getMinWidth() const { return mMinWidth; }
- /*virtual*/ S32 notifyParent(const LLSD& info);
+ /*virtual*/ S32 notifyParent(const LLSD& info);
- /**
- * Toggle chiclet by session id ON and toggle OFF all other chiclets.
- */
- void setChicletToggleState(const LLUUID& session_id, bool toggle);
+ /**
+ * Toggle chiclet by session id ON and toggle OFF all other chiclets.
+ */
+ void setChicletToggleState(const LLUUID& session_id, bool toggle);
protected:
- LLChicletPanel(const Params&p);
- friend class LLUICtrlFactory;
-
- /**
- * Adds chiclet to list and rearranges all chiclets.
- * They should be right aligned, most recent right. See EXT-1293
- *
- * It calculates position of the first chiclet in the list. Other chiclets are placed in arrange().
- *
- * @see arrange()
- */
- bool addChiclet(LLChiclet*, S32 index);
-
- /**
- * Arranges chiclets to have them in correct positions.
- *
- * Method bases on assumption that first chiclet has correct rect and starts from the its position.
- *
- * @see addChiclet()
- */
- void arrange();
-
- /**
- * Returns true if chiclets can be scrolled right.
- */
- bool canScrollRight();
-
- /**
- * Returns true if we need to show scroll buttons
- */
- bool needShowScroll();
-
- /**
- * Returns true if chiclets can be scrolled left.
- */
- bool canScrollLeft();
-
- /**
- * Shows or hides chiclet scroll buttons if chiclets can or can not be scrolled.
- */
- void showScrollButtonsIfNeeded();
-
- /**
- * Shifts chiclets left or right.
- */
- void shiftChiclets(S32 offset, S32 start_index = 0);
-
- /**
- * Removes gaps between first chiclet and scroll area left side,
- * last chiclet and scroll area right side.
- */
- void trimChiclets();
-
- /**
- * Scrolls chiclets to right or left.
- */
- void scroll(S32 offset);
-
- /**
- * Verifies that chiclets can be scrolled left, then calls scroll()
- */
- void scrollLeft();
-
- /**
- * Verifies that chiclets can be scrolled right, then calls scroll()
- */
- void scrollRight();
-
- /**
- * Callback for left scroll button clicked
- */
- void onLeftScrollClick();
-
- /**
- * Callback for right scroll button clicked
- */
- void onRightScrollClick();
-
- /**
- * Callback for right scroll button held down event
- */
- void onLeftScrollHeldDown();
-
- /**
- * Callback for left scroll button held down event
- */
- void onRightScrollHeldDown();
-
- /**
- * Callback for mouse wheel scrolled, calls scrollRight() or scrollLeft()
- */
- BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
-
- /**
- * Notifies subscribers about click on chiclet.
- * Do not place any code here, instead subscribe on event (see setChicletClickedCallback).
- */
- void onChicletClick(LLUICtrl*ctrl,const LLSD&param);
-
- /**
- * Callback for chiclet size changed event, rearranges chiclets.
- */
- void onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param);
-
- void onMessageCountChanged(const LLSD& data);
-
- void objectChicletCallback(const LLSD& data);
-
- typedef std::vector<LLChiclet*> chiclet_list_t;
-
- /**
- * Removes chiclet from scroll area and chiclet list.
- */
- void removeChiclet(chiclet_list_t::iterator it);
-
- S32 getChicletPadding() { return mChicletPadding; }
-
- S32 getScrollingOffset() { return mScrollingOffset; }
-
- bool isAnyIMFloaterDoked();
+ LLChicletPanel(const Params&p);
+ friend class LLUICtrlFactory;
+
+ /**
+ * Adds chiclet to list and rearranges all chiclets.
+ * They should be right aligned, most recent right. See EXT-1293
+ *
+ * It calculates position of the first chiclet in the list. Other chiclets are placed in arrange().
+ *
+ * @see arrange()
+ */
+ bool addChiclet(LLChiclet*, S32 index);
+
+ /**
+ * Arranges chiclets to have them in correct positions.
+ *
+ * Method bases on assumption that first chiclet has correct rect and starts from the its position.
+ *
+ * @see addChiclet()
+ */
+ void arrange();
+
+ /**
+ * Returns true if chiclets can be scrolled right.
+ */
+ bool canScrollRight();
+
+ /**
+ * Returns true if we need to show scroll buttons
+ */
+ bool needShowScroll();
+
+ /**
+ * Returns true if chiclets can be scrolled left.
+ */
+ bool canScrollLeft();
+
+ /**
+ * Shows or hides chiclet scroll buttons if chiclets can or can not be scrolled.
+ */
+ void showScrollButtonsIfNeeded();
+
+ /**
+ * Shifts chiclets left or right.
+ */
+ void shiftChiclets(S32 offset, S32 start_index = 0);
+
+ /**
+ * Removes gaps between first chiclet and scroll area left side,
+ * last chiclet and scroll area right side.
+ */
+ void trimChiclets();
+
+ /**
+ * Scrolls chiclets to right or left.
+ */
+ void scroll(S32 offset);
+
+ /**
+ * Verifies that chiclets can be scrolled left, then calls scroll()
+ */
+ void scrollLeft();
+
+ /**
+ * Verifies that chiclets can be scrolled right, then calls scroll()
+ */
+ void scrollRight();
+
+ /**
+ * Callback for left scroll button clicked
+ */
+ void onLeftScrollClick();
+
+ /**
+ * Callback for right scroll button clicked
+ */
+ void onRightScrollClick();
+
+ /**
+ * Callback for right scroll button held down event
+ */
+ void onLeftScrollHeldDown();
+
+ /**
+ * Callback for left scroll button held down event
+ */
+ void onRightScrollHeldDown();
+
+ /**
+ * Callback for mouse wheel scrolled, calls scrollRight() or scrollLeft()
+ */
+ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+
+ /**
+ * Notifies subscribers about click on chiclet.
+ * Do not place any code here, instead subscribe on event (see setChicletClickedCallback).
+ */
+ void onChicletClick(LLUICtrl*ctrl,const LLSD&param);
+
+ /**
+ * Callback for chiclet size changed event, rearranges chiclets.
+ */
+ void onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param);
+
+ void onMessageCountChanged(const LLSD& data);
+
+ void objectChicletCallback(const LLSD& data);
+
+ typedef std::vector<LLChiclet*> chiclet_list_t;
+
+ /**
+ * Removes chiclet from scroll area and chiclet list.
+ */
+ void removeChiclet(chiclet_list_t::iterator it);
+
+ S32 getChicletPadding() { return mChicletPadding; }
+
+ S32 getScrollingOffset() { return mScrollingOffset; }
+
+ bool isAnyIMFloaterDoked();
protected:
- chiclet_list_t mChicletList;
- LLButton* mLeftScrollButton;
- LLButton* mRightScrollButton;
- LLPanel* mScrollArea;
-
- S32 mChicletPadding;
- S32 mScrollingOffset;
- S32 mScrollButtonHPad;
- S32 mScrollRatio;
- S32 mMinWidth;
- bool mShowControls;
- static const S32 s_scroll_ratio;
+ chiclet_list_t mChicletList;
+ LLButton* mLeftScrollButton;
+ LLButton* mRightScrollButton;
+ LLPanel* mScrollArea;
+
+ S32 mChicletPadding;
+ S32 mScrollingOffset;
+ S32 mScrollButtonHPad;
+ S32 mScrollRatio;
+ S32 mMinWidth;
+ bool mShowControls;
+ static const S32 s_scroll_ratio;
};
-template<class T>
+template<class T>
T* LLChicletPanel::createChiclet(const LLUUID& session_id, S32 index)
{
- typename T::Params params;
- T* chiclet = LLUICtrlFactory::create<T>(params);
- if(!chiclet)
- {
- LL_WARNS() << "Could not create chiclet" << LL_ENDL;
- return NULL;
- }
- if(!addChiclet(chiclet, index))
- {
- delete chiclet;
- LL_WARNS() << "Could not add chiclet to chiclet panel" << LL_ENDL;
- return NULL;
- }
-
- if (!isAnyIMFloaterDoked())
- {
- scrollToChiclet(chiclet);
- }
-
- chiclet->setSessionId(session_id);
-
- return chiclet;
+ typename T::Params params;
+ T* chiclet = LLUICtrlFactory::create<T>(params);
+ if(!chiclet)
+ {
+ LL_WARNS() << "Could not create chiclet" << LL_ENDL;
+ return NULL;
+ }
+ if(!addChiclet(chiclet, index))
+ {
+ delete chiclet;
+ LL_WARNS() << "Could not add chiclet to chiclet panel" << LL_ENDL;
+ return NULL;
+ }
+
+ if (!isAnyIMFloaterDoked())
+ {
+ scrollToChiclet(chiclet);
+ }
+
+ chiclet->setSessionId(session_id);
+
+ return chiclet;
}
template<class T>
T* LLChicletPanel::createChiclet(const LLUUID& session_id)
{
- return createChiclet<T>(session_id, mChicletList.size());
+ return createChiclet<T>(session_id, mChicletList.size());
}
template<class T>
T* LLChicletPanel::findChiclet(const LLUUID& im_session_id)
{
- if(im_session_id.isNull())
- {
- return NULL;
- }
-
- chiclet_list_t::const_iterator it = mChicletList.begin();
- for( ; mChicletList.end() != it; ++it)
- {
- LLChiclet* chiclet = *it;
-
- llassert(chiclet);
- if (!chiclet) continue;
- if(chiclet->getSessionId() == im_session_id)
- {
- T* result = dynamic_cast<T*>(chiclet);
- if(!result)
- {
- LL_WARNS() << "Found chiclet but of wrong type " << LL_ENDL;
- continue;
- }
- return result;
- }
- }
- return NULL;
+ if(im_session_id.isNull())
+ {
+ return NULL;
+ }
+
+ chiclet_list_t::const_iterator it = mChicletList.begin();
+ for( ; mChicletList.end() != it; ++it)
+ {
+ LLChiclet* chiclet = *it;
+
+ llassert(chiclet);
+ if (!chiclet) continue;
+ if(chiclet->getSessionId() == im_session_id)
+ {
+ T* result = dynamic_cast<T*>(chiclet);
+ if(!result)
+ {
+ LL_WARNS() << "Found chiclet but of wrong type " << LL_ENDL;
+ continue;
+ }
+ return result;
+ }
+ }
+ return NULL;
}
template<class T> T* LLChicletPanel::getChiclet(S32 index)
{
- if(index < 0 || index >= getChicletCount())
- {
- return NULL;
- }
-
- LLChiclet* chiclet = mChicletList[index];
- T*result = dynamic_cast<T*>(chiclet);
- if(!result && chiclet)
- {
- LL_WARNS() << "Found chiclet but of wrong type " << LL_ENDL;
- }
- return result;
+ if(index < 0 || index >= getChicletCount())
+ {
+ return NULL;
+ }
+
+ LLChiclet* chiclet = mChicletList[index];
+ T*result = dynamic_cast<T*>(chiclet);
+ if(!result && chiclet)
+ {
+ LL_WARNS() << "Found chiclet but of wrong type " << LL_ENDL;
+ }
+ return result;
}
#endif // LL_LLCHICLET_H
diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp
index 91b9d68fd2..442176fdf5 100644
--- a/indra/newview/llchicletbar.cpp
+++ b/indra/newview/llchicletbar.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchicletbar.cpp
* @brief LLChicletBar class implementation
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,203 +35,203 @@
namespace
{
- const std::string& PANEL_CHICLET_NAME = "chiclet_list_panel";
+ const std::string& PANEL_CHICLET_NAME = "chiclet_list_panel";
}
LLChicletBar::LLChicletBar()
-: mChicletPanel(NULL),
- mToolbarStack(NULL)
+: mChicletPanel(NULL),
+ mToolbarStack(NULL)
{
- buildFromFile("panel_chiclet_bar.xml");
+ buildFromFile("panel_chiclet_bar.xml");
}
BOOL LLChicletBar::postBuild()
{
- mToolbarStack = getChild<LLLayoutStack>("toolbar_stack");
- mChicletPanel = getChild<LLChicletPanel>("chiclet_list");
+ mToolbarStack = getChild<LLLayoutStack>("toolbar_stack");
+ mChicletPanel = getChild<LLChicletPanel>("chiclet_list");
- showWellButton("notification_well", !LLFloaterNotificationsTabbed::getInstance()->isWindowEmpty());
+ showWellButton("notification_well", !LLFloaterNotificationsTabbed::getInstance()->isWindowEmpty());
- LLPanelTopInfoBar::instance().setResizeCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this));
- LLPanelTopInfoBar::instance().setVisibleCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this));
+ LLPanelTopInfoBar::instance().setResizeCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this));
+ LLPanelTopInfoBar::instance().setVisibleCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this));
- return TRUE;
+ return TRUE;
}
void LLChicletBar::showWellButton(const std::string& well_name, bool visible)
{
- LLView * panel = findChild<LLView>(well_name + "_panel");
- if (!panel) return;
+ LLView * panel = findChild<LLView>(well_name + "_panel");
+ if (!panel) return;
- panel->setVisible(visible);
+ panel->setVisible(visible);
}
void LLChicletBar::log(LLView* panel, const std::string& descr)
{
- if (NULL == panel) return;
- LLView* layout = panel->getParent();
- LL_DEBUGS("ChicletBarRects") << descr << ": "
- << "panel: " << panel->getName()
- << ", rect: " << panel->getRect()
- << " layout: " << layout->getName()
- << ", rect: " << layout->getRect()
- << LL_ENDL;
+ if (NULL == panel) return;
+ LLView* layout = panel->getParent();
+ LL_DEBUGS("ChicletBarRects") << descr << ": "
+ << "panel: " << panel->getName()
+ << ", rect: " << panel->getRect()
+ << " layout: " << layout->getName()
+ << ", rect: " << layout->getRect()
+ << LL_ENDL;
}
void LLChicletBar::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- static S32 debug_calling_number = 0;
- LL_DEBUGS() << "**************************************** " << ++debug_calling_number << LL_ENDL;
-
- S32 current_width = getRect().getWidth();
- S32 delta_width = width - current_width;
- LL_DEBUGS() << "Reshaping: "
- << ", width: " << width
- << ", cur width: " << current_width
- << ", delta_width: " << delta_width
- << ", called_from_parent: " << called_from_parent
- << LL_ENDL;
-
- if (mChicletPanel) log(mChicletPanel, "before");
-
- // Difference between chiclet bar width required to fit its children and the actual width. (see EXT-991)
- // Positive value means that chiclet bar is not wide enough.
- // Negative value means that there is free space.
- static S32 extra_shrink_width = 0;
- bool should_be_reshaped = true;
-
- if (mChicletPanel && mToolbarStack)
- {
- // Firstly, update layout stack to ensure we deal with correct panel sizes.
- {
- // Force the updating of layout to reset panels collapse factor.
- mToolbarStack->updateLayout();
- }
-
- // chiclet bar is narrowed
- if (delta_width < 0)
- {
- if (extra_shrink_width > 0) // not enough space
- {
- extra_shrink_width += llabs(delta_width);
- should_be_reshaped = false;
- }
- else
- {
- extra_shrink_width = processWidthDecreased(delta_width);
-
- // increase new width to extra_shrink_width value to not reshape less than chiclet bar minimum
- width += extra_shrink_width;
- }
- }
- // chiclet bar is widened
- else
- {
- if (extra_shrink_width > delta_width)
- {
- // Still not enough space.
- // Only subtract the delta from the required delta and don't reshape.
- extra_shrink_width -= delta_width;
- should_be_reshaped = false;
- }
- else if (extra_shrink_width > 0)
- {
- // If we have some extra shrink width let's reduce delta_width & width
- delta_width -= extra_shrink_width;
- width -= extra_shrink_width;
- extra_shrink_width = 0;
- }
- }
- }
-
- if (should_be_reshaped)
- {
- LL_DEBUGS() << "Reshape all children with width: " << width << LL_ENDL;
- LLPanel::reshape(width, height, called_from_parent);
- }
-
- if (mChicletPanel) log(mChicletPanel, "after");
+ static S32 debug_calling_number = 0;
+ LL_DEBUGS() << "**************************************** " << ++debug_calling_number << LL_ENDL;
+
+ S32 current_width = getRect().getWidth();
+ S32 delta_width = width - current_width;
+ LL_DEBUGS() << "Reshaping: "
+ << ", width: " << width
+ << ", cur width: " << current_width
+ << ", delta_width: " << delta_width
+ << ", called_from_parent: " << called_from_parent
+ << LL_ENDL;
+
+ if (mChicletPanel) log(mChicletPanel, "before");
+
+ // Difference between chiclet bar width required to fit its children and the actual width. (see EXT-991)
+ // Positive value means that chiclet bar is not wide enough.
+ // Negative value means that there is free space.
+ static S32 extra_shrink_width = 0;
+ bool should_be_reshaped = true;
+
+ if (mChicletPanel && mToolbarStack)
+ {
+ // Firstly, update layout stack to ensure we deal with correct panel sizes.
+ {
+ // Force the updating of layout to reset panels collapse factor.
+ mToolbarStack->updateLayout();
+ }
+
+ // chiclet bar is narrowed
+ if (delta_width < 0)
+ {
+ if (extra_shrink_width > 0) // not enough space
+ {
+ extra_shrink_width += llabs(delta_width);
+ should_be_reshaped = false;
+ }
+ else
+ {
+ extra_shrink_width = processWidthDecreased(delta_width);
+
+ // increase new width to extra_shrink_width value to not reshape less than chiclet bar minimum
+ width += extra_shrink_width;
+ }
+ }
+ // chiclet bar is widened
+ else
+ {
+ if (extra_shrink_width > delta_width)
+ {
+ // Still not enough space.
+ // Only subtract the delta from the required delta and don't reshape.
+ extra_shrink_width -= delta_width;
+ should_be_reshaped = false;
+ }
+ else if (extra_shrink_width > 0)
+ {
+ // If we have some extra shrink width let's reduce delta_width & width
+ delta_width -= extra_shrink_width;
+ width -= extra_shrink_width;
+ extra_shrink_width = 0;
+ }
+ }
+ }
+
+ if (should_be_reshaped)
+ {
+ LL_DEBUGS() << "Reshape all children with width: " << width << LL_ENDL;
+ LLPanel::reshape(width, height, called_from_parent);
+ }
+
+ if (mChicletPanel) log(mChicletPanel, "after");
}
S32 LLChicletBar::processWidthDecreased(S32 delta_width)
{
- bool still_should_be_processed = true;
+ bool still_should_be_processed = true;
- const S32 chiclet_panel_shrink_headroom = getChicletPanelShrinkHeadroom();
+ const S32 chiclet_panel_shrink_headroom = getChicletPanelShrinkHeadroom();
- // Decreasing width of chiclet panel.
- if (chiclet_panel_shrink_headroom > 0)
- {
- // we have some space to decrease chiclet panel
- S32 shrink_by = llmin(-delta_width, chiclet_panel_shrink_headroom);
+ // Decreasing width of chiclet panel.
+ if (chiclet_panel_shrink_headroom > 0)
+ {
+ // we have some space to decrease chiclet panel
+ S32 shrink_by = llmin(-delta_width, chiclet_panel_shrink_headroom);
- LL_DEBUGS() << "delta_width: " << delta_width
- << ", panel_delta_min: " << chiclet_panel_shrink_headroom
- << ", shrink_by: " << shrink_by
- << LL_ENDL;
+ LL_DEBUGS() << "delta_width: " << delta_width
+ << ", panel_delta_min: " << chiclet_panel_shrink_headroom
+ << ", shrink_by: " << shrink_by
+ << LL_ENDL;
- // is chiclet panel wide enough to process resizing?
- delta_width += chiclet_panel_shrink_headroom;
+ // is chiclet panel wide enough to process resizing?
+ delta_width += chiclet_panel_shrink_headroom;
- still_should_be_processed = delta_width < 0;
+ still_should_be_processed = delta_width < 0;
- LL_DEBUGS() << "Shrinking chiclet panel by " << shrink_by << " px" << LL_ENDL;
- mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - shrink_by, mChicletPanel->getParent()->getRect().getHeight());
- log(mChicletPanel, "after processing panel decreasing via chiclet panel");
+ LL_DEBUGS() << "Shrinking chiclet panel by " << shrink_by << " px" << LL_ENDL;
+ mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - shrink_by, mChicletPanel->getParent()->getRect().getHeight());
+ log(mChicletPanel, "after processing panel decreasing via chiclet panel");
- LL_DEBUGS() << "RS_CHICLET_PANEL"
- << ", delta_width: " << delta_width
- << LL_ENDL;
- }
+ LL_DEBUGS() << "RS_CHICLET_PANEL"
+ << ", delta_width: " << delta_width
+ << LL_ENDL;
+ }
- S32 extra_shrink_width = 0;
+ S32 extra_shrink_width = 0;
- if (still_should_be_processed)
- {
- extra_shrink_width = -delta_width;
- LL_WARNS() << "There is no enough width to reshape all children: "
- << extra_shrink_width << LL_ENDL;
- }
+ if (still_should_be_processed)
+ {
+ extra_shrink_width = -delta_width;
+ LL_WARNS() << "There is no enough width to reshape all children: "
+ << extra_shrink_width << LL_ENDL;
+ }
- return extra_shrink_width;
+ return extra_shrink_width;
}
S32 LLChicletBar::getChicletPanelShrinkHeadroom() const
{
- static const S32 min_width = mChicletPanel->getMinWidth();
- const S32 cur_width = mChicletPanel->getParent()->getRect().getWidth();
+ static const S32 min_width = mChicletPanel->getMinWidth();
+ const S32 cur_width = mChicletPanel->getParent()->getRect().getWidth();
- S32 shrink_headroom = cur_width - min_width;
- llassert(shrink_headroom >= 0); // the panel cannot get narrower than the minimum
- return shrink_headroom;
+ S32 shrink_headroom = cur_width - min_width;
+ llassert(shrink_headroom >= 0); // the panel cannot get narrower than the minimum
+ return shrink_headroom;
}
void LLChicletBar::fitWithTopInfoBar()
{
- LLPanelTopInfoBar& top_info_bar = LLPanelTopInfoBar::instance();
-
- LLRect rect = getRect();
- S32 width = rect.getWidth();
-
- if (top_info_bar.getVisible())
- {
- S32 delta = top_info_bar.calcScreenRect().mRight - calcScreenRect().mLeft;
- if (delta < 0 && rect.mLeft < llabs(delta))
- delta = -rect.mLeft;
- rect.setLeftTopAndSize(rect.mLeft + delta, rect.mTop, rect.getWidth(), rect.getHeight());
- width = rect.getWidth() - delta;
- }
- else
- {
- LLView* parent = getParent();
- if (parent)
- {
- LLRect parent_rect = parent->getRect();
- rect.setLeftTopAndSize(0, rect.mTop, rect.getWidth(), rect.getHeight());
- width = parent_rect.getWidth();
- }
- }
-
- setRect(rect);
- LLPanel::reshape(width, rect.getHeight(), false);
+ LLPanelTopInfoBar& top_info_bar = LLPanelTopInfoBar::instance();
+
+ LLRect rect = getRect();
+ S32 width = rect.getWidth();
+
+ if (top_info_bar.getVisible())
+ {
+ S32 delta = top_info_bar.calcScreenRect().mRight - calcScreenRect().mLeft;
+ if (delta < 0 && rect.mLeft < llabs(delta))
+ delta = -rect.mLeft;
+ rect.setLeftTopAndSize(rect.mLeft + delta, rect.mTop, rect.getWidth(), rect.getHeight());
+ width = rect.getWidth() - delta;
+ }
+ else
+ {
+ LLView* parent = getParent();
+ if (parent)
+ {
+ LLRect parent_rect = parent->getRect();
+ rect.setLeftTopAndSize(0, rect.mTop, rect.getWidth(), rect.getHeight());
+ width = parent_rect.getWidth();
+ }
+ }
+
+ setRect(rect);
+ LLPanel::reshape(width, rect.getHeight(), false);
}
diff --git a/indra/newview/llchicletbar.h b/indra/newview/llchicletbar.h
index c295b99962..748245cad6 100644
--- a/indra/newview/llchicletbar.h
+++ b/indra/newview/llchicletbar.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llchicletbar.h
* @brief LLChicletBar class header file
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,56 +35,56 @@ class LLLayoutPanel;
class LLLayoutStack;
class LLChicletBar
- : public LLSingleton<LLChicletBar>
- , public LLPanel
+ : public LLSingleton<LLChicletBar>
+ , public LLPanel
{
- LLSINGLETON(LLChicletBar);
- LOG_CLASS(LLChicletBar);
+ LLSINGLETON(LLChicletBar);
+ LOG_CLASS(LLChicletBar);
public:
- BOOL postBuild() override;
+ BOOL postBuild() override;
- LLChicletPanel* getChicletPanel() { return mChicletPanel; }
+ LLChicletPanel* getChicletPanel() { return mChicletPanel; }
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent) override;
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent) override;
- /**
- * Shows/hides panel with specified well button (IM or Notification)
- *
- * @param well_name - name of the well panel to be processed.
- * @param visible - a flag specifying whether a button should be shown or hidden.
- */
- void showWellButton(const std::string& well_name, bool visible);
+ /**
+ * Shows/hides panel with specified well button (IM or Notification)
+ *
+ * @param well_name - name of the well panel to be processed.
+ * @param visible - a flag specifying whether a button should be shown or hidden.
+ */
+ void showWellButton(const std::string& well_name, bool visible);
private:
- /**
- * Updates child controls size and visibility when it is necessary to reduce total width.
- *
- * @param delta_width - value by which chiclet bar should be shrunk. It is a negative value.
- * @returns positive value which chiclet bar can not process when it reaches its minimal width.
- * Zero if there was enough space to process delta_width.
- */
- S32 processWidthDecreased(S32 delta_width);
-
- /** helper function to log debug messages */
- void log(LLView* panel, const std::string& descr);
-
- /**
- * @return difference between current chiclet panel width and the minimum.
- */
- S32 getChicletPanelShrinkHeadroom() const;
-
- /**
- * function adjusts Chiclet bar width to prevent overlapping with Mini-Location bar
- * EXP-1463
- */
- void fitWithTopInfoBar();
+ /**
+ * Updates child controls size and visibility when it is necessary to reduce total width.
+ *
+ * @param delta_width - value by which chiclet bar should be shrunk. It is a negative value.
+ * @returns positive value which chiclet bar can not process when it reaches its minimal width.
+ * Zero if there was enough space to process delta_width.
+ */
+ S32 processWidthDecreased(S32 delta_width);
+
+ /** helper function to log debug messages */
+ void log(LLView* panel, const std::string& descr);
+
+ /**
+ * @return difference between current chiclet panel width and the minimum.
+ */
+ S32 getChicletPanelShrinkHeadroom() const;
+
+ /**
+ * function adjusts Chiclet bar width to prevent overlapping with Mini-Location bar
+ * EXP-1463
+ */
+ void fitWithTopInfoBar();
protected:
- LLChicletPanel* mChicletPanel;
- LLLayoutStack* mToolbarStack;
+ LLChicletPanel* mChicletPanel;
+ LLLayoutStack* mToolbarStack;
};
#endif // LL_LLCHICLETBAR_H
diff --git a/indra/newview/llclassifiedinfo.cpp b/indra/newview/llclassifiedinfo.cpp
index 800aff149a..a32b1046a9 100644
--- a/indra/newview/llclassifiedinfo.cpp
+++ b/indra/newview/llclassifiedinfo.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llclassifiedinfo.cpp
* @brief LLClassifiedInfo class definition
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,17 +34,17 @@ LLClassifiedInfo::cat_map LLClassifiedInfo::sCategories;
// static
void LLClassifiedInfo::loadCategories(const LLSD& options)
{
- for(LLSD::array_const_iterator resp_it = options.beginArray(),
- end = options.endArray(); resp_it != end; ++resp_it)
- {
- LLSD name = (*resp_it)["category_name"];
- if(name.isDefined())
- {
- LLSD id = (*resp_it)["category_id"];
- if(id.isDefined())
- {
- LLClassifiedInfo::sCategories[id.asInteger()] = name.asString();
- }
- }
- }
+ for(LLSD::array_const_iterator resp_it = options.beginArray(),
+ end = options.endArray(); resp_it != end; ++resp_it)
+ {
+ LLSD name = (*resp_it)["category_name"];
+ if(name.isDefined())
+ {
+ LLSD id = (*resp_it)["category_id"];
+ if(id.isDefined())
+ {
+ LLClassifiedInfo::sCategories[id.asInteger()] = name.asString();
+ }
+ }
+ }
}
diff --git a/indra/newview/llclassifiedinfo.h b/indra/newview/llclassifiedinfo.h
index 3ff793b168..7b5153f1ae 100644
--- a/indra/newview/llclassifiedinfo.h
+++ b/indra/newview/llclassifiedinfo.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llclassifiedinfo.h
* @brief LLClassifiedInfo class definition
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,12 +37,12 @@ class LLMessageSystem;
class LLClassifiedInfo
{
public:
- LLClassifiedInfo() {}
+ LLClassifiedInfo() {}
- static void loadCategories(const LLSD& options);
+ static void loadCategories(const LLSD& options);
- typedef std::map<U32, std::string> cat_map;
- static cat_map sCategories;
+ typedef std::map<U32, std::string> cat_map;
+ static cat_map sCategories;
};
#endif // LL_LLCLASSIFIEDINFO_H
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index aa2ba752b7..67090772fd 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcofwearables.cpp
* @brief LLCOFWearables displayes wearables from the current outfit split into three lists (attachments, clothing and body parts)
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,73 +55,73 @@ static const LLWearableItemNameComparator WEARABLE_NAME_COMPARATOR;
class CofContextMenu : public LLListContextMenu
{
protected:
- CofContextMenu(LLCOFWearables* cof_wearables)
- : mCOFWearables(cof_wearables)
- {
- llassert(mCOFWearables);
- }
-
- void updateCreateWearableLabel(LLMenuGL* menu, const LLUUID& item_id)
- {
- LLMenuItemGL* menu_item = menu->getChild<LLMenuItemGL>("create_new");
- LLWearableType::EType w_type = getWearableType(item_id);
-
- // Hide the "Create new <WEARABLE_TYPE>" if it's irrelevant.
- if (w_type == LLWearableType::WT_NONE)
- {
- menu_item->setVisible(FALSE);
- return;
- }
-
- // Set proper label for the "Create new <WEARABLE_TYPE>" menu item.
- std::string new_label = LLTrans::getString("create_new_" + LLWearableType::getInstance()->getTypeName(w_type));
- menu_item->setLabel(new_label);
- }
-
- void createNew(const LLUUID& item_id)
- {
- LLAgentWearables::createWearable(getWearableType(item_id), true);
- }
-
- // Get wearable type of the given item.
- //
- // There is a special case: so-called "dummy items"
- // (i.e. the ones that are there just to indicate that you're not wearing
- // any wearables of the corresponding type. They are currently grayed out
- // and suffixed with "not worn").
- // Those items don't have an UUID, but they do have an associated wearable type.
- // If the user has invoked context menu for such item,
- // we ignore the passed item_id and retrieve wearable type from the item.
- LLWearableType::EType getWearableType(const LLUUID& item_id)
- {
- if (!isDummyItem(item_id))
- {
- LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id);
- if (item && item->isWearableType())
- {
- return item->getWearableType();
- }
- }
- else if (mCOFWearables) // dummy item selected
- {
- LLPanelDummyClothingListItem* item;
-
- item = dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem());
- if (item)
- {
- return item->getWearableType();
- }
- }
-
- return LLWearableType::WT_NONE;
- }
-
- static bool isDummyItem(const LLUUID& item_id)
- {
- return item_id.isNull();
- }
-
- LLCOFWearables* mCOFWearables;
+ CofContextMenu(LLCOFWearables* cof_wearables)
+ : mCOFWearables(cof_wearables)
+ {
+ llassert(mCOFWearables);
+ }
+
+ void updateCreateWearableLabel(LLMenuGL* menu, const LLUUID& item_id)
+ {
+ LLMenuItemGL* menu_item = menu->getChild<LLMenuItemGL>("create_new");
+ LLWearableType::EType w_type = getWearableType(item_id);
+
+ // Hide the "Create new <WEARABLE_TYPE>" if it's irrelevant.
+ if (w_type == LLWearableType::WT_NONE)
+ {
+ menu_item->setVisible(FALSE);
+ return;
+ }
+
+ // Set proper label for the "Create new <WEARABLE_TYPE>" menu item.
+ std::string new_label = LLTrans::getString("create_new_" + LLWearableType::getInstance()->getTypeName(w_type));
+ menu_item->setLabel(new_label);
+ }
+
+ void createNew(const LLUUID& item_id)
+ {
+ LLAgentWearables::createWearable(getWearableType(item_id), true);
+ }
+
+ // Get wearable type of the given item.
+ //
+ // There is a special case: so-called "dummy items"
+ // (i.e. the ones that are there just to indicate that you're not wearing
+ // any wearables of the corresponding type. They are currently grayed out
+ // and suffixed with "not worn").
+ // Those items don't have an UUID, but they do have an associated wearable type.
+ // If the user has invoked context menu for such item,
+ // we ignore the passed item_id and retrieve wearable type from the item.
+ LLWearableType::EType getWearableType(const LLUUID& item_id)
+ {
+ if (!isDummyItem(item_id))
+ {
+ LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id);
+ if (item && item->isWearableType())
+ {
+ return item->getWearableType();
+ }
+ }
+ else if (mCOFWearables) // dummy item selected
+ {
+ LLPanelDummyClothingListItem* item;
+
+ item = dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem());
+ if (item)
+ {
+ return item->getWearableType();
+ }
+ }
+
+ return LLWearableType::WT_NONE;
+ }
+
+ static bool isDummyItem(const LLUUID& item_id)
+ {
+ return item_id.isNull();
+ }
+
+ LLCOFWearables* mCOFWearables;
};
//////////////////////////////////////////////////////////////////////////
@@ -129,42 +129,42 @@ protected:
class CofAttachmentContextMenu : public CofContextMenu
{
public:
- CofAttachmentContextMenu(LLCOFWearables* cof_wearables)
- : CofContextMenu(cof_wearables)
- {
- }
+ CofAttachmentContextMenu(LLCOFWearables* cof_wearables)
+ : CofContextMenu(cof_wearables)
+ {
+ }
protected:
- /*virtual*/ LLContextMenu* createMenu()
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ /*virtual*/ LLContextMenu* createMenu()
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- registrar.add("Attachment.Touch", boost::bind(handleMultiple, handle_attachment_touch, mUUIDs));
- registrar.add("Attachment.Edit", boost::bind(handleMultiple, handle_item_edit, mUUIDs));
- registrar.add("Attachment.Detach", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
+ registrar.add("Attachment.Touch", boost::bind(handleMultiple, handle_attachment_touch, mUUIDs));
+ registrar.add("Attachment.Edit", boost::bind(handleMultiple, handle_item_edit, mUUIDs));
+ registrar.add("Attachment.Detach", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- enable_registrar.add("Attachment.OnEnable", boost::bind(&CofAttachmentContextMenu::onEnable, this, _2));
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+ enable_registrar.add("Attachment.OnEnable", boost::bind(&CofAttachmentContextMenu::onEnable, this, _2));
- return createFromFile("menu_cof_attachment.xml");
- }
+ return createFromFile("menu_cof_attachment.xml");
+ }
- bool onEnable(const LLSD& userdata)
- {
- const std::string event_name = userdata.asString();
+ bool onEnable(const LLSD& userdata)
+ {
+ const std::string event_name = userdata.asString();
- if ("touch" == event_name)
- {
- return (1 == mUUIDs.size()) && (enable_attachment_touch(mUUIDs.front()));
- }
- else if ("edit" == event_name)
- {
- return (1 == mUUIDs.size()) && (get_is_item_editable(mUUIDs.front()));
- }
+ if ("touch" == event_name)
+ {
+ return (1 == mUUIDs.size()) && (enable_attachment_touch(mUUIDs.front()));
+ }
+ else if ("edit" == event_name)
+ {
+ return (1 == mUUIDs.size()) && (get_is_item_editable(mUUIDs.front()));
+ }
- return true;
- }
+ return true;
+ }
};
//////////////////////////////////////////////////////////////////////////
@@ -172,65 +172,65 @@ protected:
class CofClothingContextMenu : public CofContextMenu
{
public:
- CofClothingContextMenu(LLCOFWearables* cof_wearables)
- : CofContextMenu(cof_wearables)
- {
- }
+ CofClothingContextMenu(LLCOFWearables* cof_wearables)
+ : CofContextMenu(cof_wearables)
+ {
+ }
protected:
- static void replaceWearable(const LLUUID& item_id)
- {
- LLPanelOutfitEdit * panel_outfit_edit =
- dynamic_cast<LLPanelOutfitEdit*> (LLFloaterSidePanelContainer::getPanel("appearance",
- "panel_outfit_edit"));
- if (panel_outfit_edit != NULL)
- {
- panel_outfit_edit->onReplaceMenuItemClicked(item_id);
- }
- }
-
- /*virtual*/ LLContextMenu* createMenu()
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- LLUUID selected_id = mUUIDs.back();
-
- registrar.add("Clothing.TakeOff", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
- registrar.add("Clothing.Replace", boost::bind(replaceWearable, selected_id));
- registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
- registrar.add("Clothing.Create", boost::bind(&CofClothingContextMenu::createNew, this, selected_id));
-
- enable_registrar.add("Clothing.OnEnable", boost::bind(&CofClothingContextMenu::onEnable, this, _2));
-
- LLContextMenu* menu = createFromFile("menu_cof_clothing.xml");
- llassert(menu);
- if (menu)
- {
- updateCreateWearableLabel(menu, selected_id);
- }
- return menu;
- }
-
- bool onEnable(const LLSD& data)
- {
- std::string param = data.asString();
- LLUUID selected_id = mUUIDs.back();
-
- if ("take_off" == param)
- {
- return get_is_item_worn(selected_id);
- }
- else if ("edit" == param)
- {
- return mUUIDs.size() == 1 && gAgentWearables.isWearableModifiable(selected_id);
- }
- else if ("replace" == param)
- {
- return get_is_item_worn(selected_id) && mUUIDs.size() == 1;
- }
-
- return true;
- }
+ static void replaceWearable(const LLUUID& item_id)
+ {
+ LLPanelOutfitEdit * panel_outfit_edit =
+ dynamic_cast<LLPanelOutfitEdit*> (LLFloaterSidePanelContainer::getPanel("appearance",
+ "panel_outfit_edit"));
+ if (panel_outfit_edit != NULL)
+ {
+ panel_outfit_edit->onReplaceMenuItemClicked(item_id);
+ }
+ }
+
+ /*virtual*/ LLContextMenu* createMenu()
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+ LLUUID selected_id = mUUIDs.back();
+
+ registrar.add("Clothing.TakeOff", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
+ registrar.add("Clothing.Replace", boost::bind(replaceWearable, selected_id));
+ registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
+ registrar.add("Clothing.Create", boost::bind(&CofClothingContextMenu::createNew, this, selected_id));
+
+ enable_registrar.add("Clothing.OnEnable", boost::bind(&CofClothingContextMenu::onEnable, this, _2));
+
+ LLContextMenu* menu = createFromFile("menu_cof_clothing.xml");
+ llassert(menu);
+ if (menu)
+ {
+ updateCreateWearableLabel(menu, selected_id);
+ }
+ return menu;
+ }
+
+ bool onEnable(const LLSD& data)
+ {
+ std::string param = data.asString();
+ LLUUID selected_id = mUUIDs.back();
+
+ if ("take_off" == param)
+ {
+ return get_is_item_worn(selected_id);
+ }
+ else if ("edit" == param)
+ {
+ return mUUIDs.size() == 1 && gAgentWearables.isWearableModifiable(selected_id);
+ }
+ else if ("replace" == param)
+ {
+ return get_is_item_worn(selected_id) && mUUIDs.size() == 1;
+ }
+
+ return true;
+ }
};
//////////////////////////////////////////////////////////////////////////
@@ -238,543 +238,543 @@ protected:
class CofBodyPartContextMenu : public CofContextMenu
{
public:
- CofBodyPartContextMenu(LLCOFWearables* cof_wearables)
- : CofContextMenu(cof_wearables)
- {
- }
+ CofBodyPartContextMenu(LLCOFWearables* cof_wearables)
+ : CofContextMenu(cof_wearables)
+ {
+ }
protected:
- /*virtual*/ LLContextMenu* createMenu()
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- LLUUID selected_id = mUUIDs.back();
-
- LLPanelOutfitEdit* panel_oe = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit"));
- registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceMenuItemClicked, panel_oe, selected_id));
- registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
- registrar.add("BodyPart.Create", boost::bind(&CofBodyPartContextMenu::createNew, this, selected_id));
-
- enable_registrar.add("BodyPart.OnEnable", boost::bind(&CofBodyPartContextMenu::onEnable, this, _2));
-
- LLContextMenu* menu = createFromFile("menu_cof_body_part.xml");
- llassert(menu);
- if (menu)
- {
- updateCreateWearableLabel(menu, selected_id);
- }
- return menu;
- }
-
- bool onEnable(const LLSD& data)
- {
- std::string param = data.asString();
- LLUUID selected_id = mUUIDs.back();
-
- if ("edit" == param)
- {
- return mUUIDs.size() == 1 && gAgentWearables.isWearableModifiable(selected_id);
- }
-
- return true;
- }
+ /*virtual*/ LLContextMenu* createMenu()
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+ LLUUID selected_id = mUUIDs.back();
+
+ LLPanelOutfitEdit* panel_oe = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit"));
+ registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceMenuItemClicked, panel_oe, selected_id));
+ registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
+ registrar.add("BodyPart.Create", boost::bind(&CofBodyPartContextMenu::createNew, this, selected_id));
+
+ enable_registrar.add("BodyPart.OnEnable", boost::bind(&CofBodyPartContextMenu::onEnable, this, _2));
+
+ LLContextMenu* menu = createFromFile("menu_cof_body_part.xml");
+ llassert(menu);
+ if (menu)
+ {
+ updateCreateWearableLabel(menu, selected_id);
+ }
+ return menu;
+ }
+
+ bool onEnable(const LLSD& data)
+ {
+ std::string param = data.asString();
+ LLUUID selected_id = mUUIDs.back();
+
+ if ("edit" == param)
+ {
+ return mUUIDs.size() == 1 && gAgentWearables.isWearableModifiable(selected_id);
+ }
+
+ return true;
+ }
};
//////////////////////////////////////////////////////////////////////////
LLCOFWearables::LLCOFWearables() : LLPanel(),
- mAttachments(NULL),
- mClothing(NULL),
- mBodyParts(NULL),
- mLastSelectedList(NULL),
- mClothingTab(NULL),
- mAttachmentsTab(NULL),
- mBodyPartsTab(NULL),
- mLastSelectedTab(NULL),
- mAccordionCtrl(NULL),
- mCOFVersion(-1)
+ mAttachments(NULL),
+ mClothing(NULL),
+ mBodyParts(NULL),
+ mLastSelectedList(NULL),
+ mClothingTab(NULL),
+ mAttachmentsTab(NULL),
+ mBodyPartsTab(NULL),
+ mLastSelectedTab(NULL),
+ mAccordionCtrl(NULL),
+ mCOFVersion(-1)
{
- mClothingMenu = new CofClothingContextMenu(this);
- mAttachmentMenu = new CofAttachmentContextMenu(this);
- mBodyPartMenu = new CofBodyPartContextMenu(this);
+ mClothingMenu = new CofClothingContextMenu(this);
+ mAttachmentMenu = new CofAttachmentContextMenu(this);
+ mBodyPartMenu = new CofBodyPartContextMenu(this);
};
LLCOFWearables::~LLCOFWearables()
{
- delete mClothingMenu;
- delete mAttachmentMenu;
- delete mBodyPartMenu;
+ delete mClothingMenu;
+ delete mAttachmentMenu;
+ delete mBodyPartMenu;
}
// virtual
BOOL LLCOFWearables::postBuild()
{
- mAttachments = getChild<LLFlatListView>("list_attachments");
- mClothing = getChild<LLFlatListView>("list_clothing");
- mBodyParts = getChild<LLFlatListView>("list_body_parts");
+ mAttachments = getChild<LLFlatListView>("list_attachments");
+ mClothing = getChild<LLFlatListView>("list_clothing");
+ mBodyParts = getChild<LLFlatListView>("list_body_parts");
- mClothing->setRightMouseDownCallback(boost::bind(&LLCOFWearables::onListRightClick, this, _1, _2, _3, mClothingMenu));
- mAttachments->setRightMouseDownCallback(boost::bind(&LLCOFWearables::onListRightClick, this, _1, _2, _3, mAttachmentMenu));
- mBodyParts->setRightMouseDownCallback(boost::bind(&LLCOFWearables::onListRightClick, this, _1, _2, _3, mBodyPartMenu));
+ mClothing->setRightMouseDownCallback(boost::bind(&LLCOFWearables::onListRightClick, this, _1, _2, _3, mClothingMenu));
+ mAttachments->setRightMouseDownCallback(boost::bind(&LLCOFWearables::onListRightClick, this, _1, _2, _3, mAttachmentMenu));
+ mBodyParts->setRightMouseDownCallback(boost::bind(&LLCOFWearables::onListRightClick, this, _1, _2, _3, mBodyPartMenu));
- //selection across different list/tabs is not supported
- mAttachments->setCommitCallback(boost::bind(&LLCOFWearables::onSelectionChange, this, mAttachments));
- mClothing->setCommitCallback(boost::bind(&LLCOFWearables::onSelectionChange, this, mClothing));
- mBodyParts->setCommitCallback(boost::bind(&LLCOFWearables::onSelectionChange, this, mBodyParts));
-
- mAttachments->setCommitOnSelectionChange(true);
- mClothing->setCommitOnSelectionChange(true);
- mBodyParts->setCommitOnSelectionChange(true);
+ //selection across different list/tabs is not supported
+ mAttachments->setCommitCallback(boost::bind(&LLCOFWearables::onSelectionChange, this, mAttachments));
+ mClothing->setCommitCallback(boost::bind(&LLCOFWearables::onSelectionChange, this, mClothing));
+ mBodyParts->setCommitCallback(boost::bind(&LLCOFWearables::onSelectionChange, this, mBodyParts));
- //clothing is sorted according to its position relatively to the body
- mAttachments->setComparator(&WEARABLE_NAME_COMPARATOR);
- mBodyParts->setComparator(&WEARABLE_NAME_COMPARATOR);
+ mAttachments->setCommitOnSelectionChange(true);
+ mClothing->setCommitOnSelectionChange(true);
+ mBodyParts->setCommitOnSelectionChange(true);
- mClothingTab = getChild<LLAccordionCtrlTab>("tab_clothing");
- mClothingTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2));
+ //clothing is sorted according to its position relatively to the body
+ mAttachments->setComparator(&WEARABLE_NAME_COMPARATOR);
+ mBodyParts->setComparator(&WEARABLE_NAME_COMPARATOR);
- mAttachmentsTab = getChild<LLAccordionCtrlTab>("tab_attachments");
- mAttachmentsTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2));
+ mClothingTab = getChild<LLAccordionCtrlTab>("tab_clothing");
+ mClothingTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2));
- mBodyPartsTab = getChild<LLAccordionCtrlTab>("tab_body_parts");
- mBodyPartsTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2));
+ mAttachmentsTab = getChild<LLAccordionCtrlTab>("tab_attachments");
+ mAttachmentsTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2));
- mTab2AssetType[mClothingTab] = LLAssetType::AT_CLOTHING;
- mTab2AssetType[mAttachmentsTab] = LLAssetType::AT_OBJECT;
- mTab2AssetType[mBodyPartsTab] = LLAssetType::AT_BODYPART;
+ mBodyPartsTab = getChild<LLAccordionCtrlTab>("tab_body_parts");
+ mBodyPartsTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2));
- mAccordionCtrl = getChild<LLAccordionCtrl>("cof_wearables_accordion");
+ mTab2AssetType[mClothingTab] = LLAssetType::AT_CLOTHING;
+ mTab2AssetType[mAttachmentsTab] = LLAssetType::AT_OBJECT;
+ mTab2AssetType[mBodyPartsTab] = LLAssetType::AT_BODYPART;
- return LLPanel::postBuild();
+ mAccordionCtrl = getChild<LLAccordionCtrl>("cof_wearables_accordion");
+
+ return LLPanel::postBuild();
}
void LLCOFWearables::setAttachmentsTitle()
{
- if (mAttachmentsTab)
- {
- U32 free_slots = gAgentAvatarp->getMaxAttachments() - mAttachments->size();
-
- LLStringUtil::format_map_t args_attachments;
- args_attachments["[COUNT]"] = llformat ("%d", free_slots);
- std::string attachments_title = LLTrans::getString("Attachments remain", args_attachments);
- mAttachmentsTab->setTitle(attachments_title);
- }
+ if (mAttachmentsTab)
+ {
+ U32 free_slots = gAgentAvatarp->getMaxAttachments() - mAttachments->size();
+
+ LLStringUtil::format_map_t args_attachments;
+ args_attachments["[COUNT]"] = llformat ("%d", free_slots);
+ std::string attachments_title = LLTrans::getString("Attachments remain", args_attachments);
+ mAttachmentsTab->setTitle(attachments_title);
+ }
}
void LLCOFWearables::onSelectionChange(LLFlatListView* selected_list)
{
- if (!selected_list) return;
+ if (!selected_list) return;
- if (selected_list != mLastSelectedList)
- {
- if (selected_list != mAttachments) mAttachments->resetSelection(true);
- if (selected_list != mClothing) mClothing->resetSelection(true);
- if (selected_list != mBodyParts) mBodyParts->resetSelection(true);
+ if (selected_list != mLastSelectedList)
+ {
+ if (selected_list != mAttachments) mAttachments->resetSelection(true);
+ if (selected_list != mClothing) mClothing->resetSelection(true);
+ if (selected_list != mBodyParts) mBodyParts->resetSelection(true);
- mLastSelectedList = selected_list;
- }
+ mLastSelectedList = selected_list;
+ }
- onCommit();
+ onCommit();
}
void LLCOFWearables::onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expanded)
{
- bool had_selected_items = mClothing->numSelected() || mAttachments->numSelected() || mBodyParts->numSelected();
- mClothing->resetSelection(true);
- mAttachments->resetSelection(true);
- mBodyParts->resetSelection(true);
-
- bool tab_selection_changed = false;
- LLAccordionCtrlTab* tab = dynamic_cast<LLAccordionCtrlTab*>(ctrl);
- if (tab && tab != mLastSelectedTab)
- {
- mLastSelectedTab = tab;
- tab_selection_changed = true;
- }
-
- if (had_selected_items || tab_selection_changed)
- {
- //sending commit signal to indicate selection changes
- onCommit();
- }
+ bool had_selected_items = mClothing->numSelected() || mAttachments->numSelected() || mBodyParts->numSelected();
+ mClothing->resetSelection(true);
+ mAttachments->resetSelection(true);
+ mBodyParts->resetSelection(true);
+
+ bool tab_selection_changed = false;
+ LLAccordionCtrlTab* tab = dynamic_cast<LLAccordionCtrlTab*>(ctrl);
+ if (tab && tab != mLastSelectedTab)
+ {
+ mLastSelectedTab = tab;
+ tab_selection_changed = true;
+ }
+
+ if (had_selected_items || tab_selection_changed)
+ {
+ //sending commit signal to indicate selection changes
+ onCommit();
+ }
}
void LLCOFWearables::refresh()
{
- const LLUUID cof_id = LLAppearanceMgr::instance().getCOF();
- if (cof_id.isNull())
- {
- LL_WARNS() << "COF ID cannot be NULL" << LL_ENDL;
- return;
- }
-
- LLViewerInventoryCategory* catp = gInventory.getCategory(cof_id);
- if (!catp)
- {
- LL_WARNS() << "COF category cannot be NULL" << LL_ENDL;
- return;
- }
-
- // BAP - this check has to be removed because an item name change does not
- // change cat version - ie, checking version is not a complete way
- // of finding out whether anything has changed in this category.
- //if (mCOFVersion == catp->getVersion()) return;
-
- mCOFVersion = catp->getVersion();
-
- // Save current scrollbar position.
- typedef std::map<LLFlatListView*, LLRect> scroll_pos_map_t;
- scroll_pos_map_t saved_scroll_pos;
-
- saved_scroll_pos[mAttachments] = mAttachments->getVisibleContentRect();
- saved_scroll_pos[mClothing] = mClothing->getVisibleContentRect();
- saved_scroll_pos[mBodyParts] = mBodyParts->getVisibleContentRect();
-
- // Save current selection.
- typedef std::vector<LLSD> values_vector_t;
- typedef std::map<LLFlatListView*, values_vector_t> selection_map_t;
-
- selection_map_t preserve_selection;
-
- mAttachments->getSelectedValues(preserve_selection[mAttachments]);
- mClothing->getSelectedValues(preserve_selection[mClothing]);
- mBodyParts->getSelectedValues(preserve_selection[mBodyParts]);
-
- clear();
-
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t cof_items;
-
- gInventory.collectDescendents(cof_id, cats, cof_items, LLInventoryModel::EXCLUDE_TRASH);
-
- populateAttachmentsAndBodypartsLists(cof_items);
-
-
- LLAppearanceMgr::wearables_by_type_t clothing_by_type(LLWearableType::WT_COUNT);
- LLAppearanceMgr::getInstance()->divvyWearablesByType(cof_items, clothing_by_type);
-
- populateClothingList(clothing_by_type);
-
- // Restore previous selection
- for (selection_map_t::iterator
- iter = preserve_selection.begin(),
- iter_end = preserve_selection.end();
- iter != iter_end; ++iter)
- {
- LLFlatListView* list = iter->first;
- if (!list) continue;
-
- //restoring selection should not fire commit callbacks
- list->setCommitOnSelectionChange(false);
-
- const values_vector_t& values = iter->second;
- for (values_vector_t::const_iterator
- value_it = values.begin(),
- value_it_end = values.end();
- value_it != value_it_end; ++value_it)
- {
- // value_it may be null because of dummy items
- // Dummy items have no ID
- if(value_it->asUUID().notNull())
- {
- list->selectItemByValue(*value_it);
- }
- }
-
- list->setCommitOnSelectionChange(true);
- }
-
- // Restore previous scrollbar position.
- for (scroll_pos_map_t::const_iterator it = saved_scroll_pos.begin(); it != saved_scroll_pos.end(); ++it)
- {
- LLFlatListView* list = it->first;
- LLRect scroll_pos = it->second;
-
- list->scrollToShowRect(scroll_pos);
- }
+ const LLUUID cof_id = LLAppearanceMgr::instance().getCOF();
+ if (cof_id.isNull())
+ {
+ LL_WARNS() << "COF ID cannot be NULL" << LL_ENDL;
+ return;
+ }
+
+ LLViewerInventoryCategory* catp = gInventory.getCategory(cof_id);
+ if (!catp)
+ {
+ LL_WARNS() << "COF category cannot be NULL" << LL_ENDL;
+ return;
+ }
+
+ // BAP - this check has to be removed because an item name change does not
+ // change cat version - ie, checking version is not a complete way
+ // of finding out whether anything has changed in this category.
+ //if (mCOFVersion == catp->getVersion()) return;
+
+ mCOFVersion = catp->getVersion();
+
+ // Save current scrollbar position.
+ typedef std::map<LLFlatListView*, LLRect> scroll_pos_map_t;
+ scroll_pos_map_t saved_scroll_pos;
+
+ saved_scroll_pos[mAttachments] = mAttachments->getVisibleContentRect();
+ saved_scroll_pos[mClothing] = mClothing->getVisibleContentRect();
+ saved_scroll_pos[mBodyParts] = mBodyParts->getVisibleContentRect();
+
+ // Save current selection.
+ typedef std::vector<LLSD> values_vector_t;
+ typedef std::map<LLFlatListView*, values_vector_t> selection_map_t;
+
+ selection_map_t preserve_selection;
+
+ mAttachments->getSelectedValues(preserve_selection[mAttachments]);
+ mClothing->getSelectedValues(preserve_selection[mClothing]);
+ mBodyParts->getSelectedValues(preserve_selection[mBodyParts]);
+
+ clear();
+
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t cof_items;
+
+ gInventory.collectDescendents(cof_id, cats, cof_items, LLInventoryModel::EXCLUDE_TRASH);
+
+ populateAttachmentsAndBodypartsLists(cof_items);
+
+
+ LLAppearanceMgr::wearables_by_type_t clothing_by_type(LLWearableType::WT_COUNT);
+ LLAppearanceMgr::getInstance()->divvyWearablesByType(cof_items, clothing_by_type);
+
+ populateClothingList(clothing_by_type);
+
+ // Restore previous selection
+ for (selection_map_t::iterator
+ iter = preserve_selection.begin(),
+ iter_end = preserve_selection.end();
+ iter != iter_end; ++iter)
+ {
+ LLFlatListView* list = iter->first;
+ if (!list) continue;
+
+ //restoring selection should not fire commit callbacks
+ list->setCommitOnSelectionChange(false);
+
+ const values_vector_t& values = iter->second;
+ for (values_vector_t::const_iterator
+ value_it = values.begin(),
+ value_it_end = values.end();
+ value_it != value_it_end; ++value_it)
+ {
+ // value_it may be null because of dummy items
+ // Dummy items have no ID
+ if(value_it->asUUID().notNull())
+ {
+ list->selectItemByValue(*value_it);
+ }
+ }
+
+ list->setCommitOnSelectionChange(true);
+ }
+
+ // Restore previous scrollbar position.
+ for (scroll_pos_map_t::const_iterator it = saved_scroll_pos.begin(); it != saved_scroll_pos.end(); ++it)
+ {
+ LLFlatListView* list = it->first;
+ LLRect scroll_pos = it->second;
+
+ list->scrollToShowRect(scroll_pos);
+ }
}
void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items)
{
- for (U32 i = 0; i < cof_items.size(); ++i)
- {
- LLViewerInventoryItem* item = cof_items.at(i);
- if (!item) continue;
-
- const LLAssetType::EType item_type = item->getType();
- if (item_type == LLAssetType::AT_CLOTHING) continue;
- LLPanelInventoryListItemBase* item_panel = NULL;
- if (item_type == LLAssetType::AT_OBJECT || item_type == LLAssetType::AT_GESTURE)
- {
- item_panel = buildAttachemntListItem(item);
- mAttachments->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
- }
- else if (item_type == LLAssetType::AT_BODYPART)
- {
- item_panel = buildBodypartListItem(item);
- if (!item_panel) continue;
-
- mBodyParts->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
- }
- }
-
- if (mAttachments->size())
- {
- mAttachments->sort();
- mAttachments->notify(REARRANGE); //notifying the parent about the list's size change (cause items were added with rearrange=false)
- }
- else
- {
- mAttachments->setNoItemsCommentText(LLTrans::getString("no_attachments"));
- }
-
- setAttachmentsTitle();
-
- if (mBodyParts->size())
- {
- mBodyParts->sort();
- mBodyParts->notify(REARRANGE);
- }
+ for (U32 i = 0; i < cof_items.size(); ++i)
+ {
+ LLViewerInventoryItem* item = cof_items.at(i);
+ if (!item) continue;
+
+ const LLAssetType::EType item_type = item->getType();
+ if (item_type == LLAssetType::AT_CLOTHING) continue;
+ LLPanelInventoryListItemBase* item_panel = NULL;
+ if (item_type == LLAssetType::AT_OBJECT || item_type == LLAssetType::AT_GESTURE)
+ {
+ item_panel = buildAttachemntListItem(item);
+ mAttachments->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
+ }
+ else if (item_type == LLAssetType::AT_BODYPART)
+ {
+ item_panel = buildBodypartListItem(item);
+ if (!item_panel) continue;
+
+ mBodyParts->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
+ }
+ }
+
+ if (mAttachments->size())
+ {
+ mAttachments->sort();
+ mAttachments->notify(REARRANGE); //notifying the parent about the list's size change (cause items were added with rearrange=false)
+ }
+ else
+ {
+ mAttachments->setNoItemsCommentText(LLTrans::getString("no_attachments"));
+ }
+
+ setAttachmentsTitle();
+
+ if (mBodyParts->size())
+ {
+ mBodyParts->sort();
+ mBodyParts->notify(REARRANGE);
+ }
}
//create a clothing list item, update verbs and show/hide line separator
LLPanelClothingListItem* LLCOFWearables::buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last)
{
- llassert(item);
- if (!item) return NULL;
- LLPanelClothingListItem* item_panel = LLPanelClothingListItem::create(item);
- if (!item_panel) return NULL;
-
- //updating verbs
- //we don't need to use permissions of a link but of an actual/linked item
- if (item->getLinkedItem()) item = item->getLinkedItem();
- llassert(item);
- if (!item) return NULL;
-
- bool allow_modify = item->getPermissions().allowModifyBy(gAgentID);
-
- item_panel->setShowLockButton(!allow_modify);
- item_panel->setShowEditButton(allow_modify);
-
- item_panel->setShowMoveUpButton(!first);
- item_panel->setShowMoveDownButton(!last);
-
- //setting callbacks
- //*TODO move that item panel's inner structure disclosing stuff into the panels
- item_panel->childSetAction("btn_delete", boost::bind(mCOFCallbacks.mDeleteWearable));
- item_panel->childSetAction("btn_move_up", boost::bind(mCOFCallbacks.mMoveWearableFurther));
- item_panel->childSetAction("btn_move_down", boost::bind(mCOFCallbacks.mMoveWearableCloser));
- item_panel->childSetAction("btn_edit", boost::bind(mCOFCallbacks.mEditWearable));
-
- //turning on gray separator line for the last item in the items group of the same wearable type
- item_panel->setSeparatorVisible(last);
-
- return item_panel;
+ llassert(item);
+ if (!item) return NULL;
+ LLPanelClothingListItem* item_panel = LLPanelClothingListItem::create(item);
+ if (!item_panel) return NULL;
+
+ //updating verbs
+ //we don't need to use permissions of a link but of an actual/linked item
+ if (item->getLinkedItem()) item = item->getLinkedItem();
+ llassert(item);
+ if (!item) return NULL;
+
+ bool allow_modify = item->getPermissions().allowModifyBy(gAgentID);
+
+ item_panel->setShowLockButton(!allow_modify);
+ item_panel->setShowEditButton(allow_modify);
+
+ item_panel->setShowMoveUpButton(!first);
+ item_panel->setShowMoveDownButton(!last);
+
+ //setting callbacks
+ //*TODO move that item panel's inner structure disclosing stuff into the panels
+ item_panel->childSetAction("btn_delete", boost::bind(mCOFCallbacks.mDeleteWearable));
+ item_panel->childSetAction("btn_move_up", boost::bind(mCOFCallbacks.mMoveWearableFurther));
+ item_panel->childSetAction("btn_move_down", boost::bind(mCOFCallbacks.mMoveWearableCloser));
+ item_panel->childSetAction("btn_edit", boost::bind(mCOFCallbacks.mEditWearable));
+
+ //turning on gray separator line for the last item in the items group of the same wearable type
+ item_panel->setSeparatorVisible(last);
+
+ return item_panel;
}
LLPanelBodyPartsListItem* LLCOFWearables::buildBodypartListItem(LLViewerInventoryItem* item)
{
- llassert(item);
- if (!item) return NULL;
- LLPanelBodyPartsListItem* item_panel = LLPanelBodyPartsListItem::create(item);
- if (!item_panel) return NULL;
-
- //updating verbs
- //we don't need to use permissions of a link but of an actual/linked item
- if (item->getLinkedItem()) item = item->getLinkedItem();
- llassert(item);
- if (!item) return NULL;
- bool allow_modify = item->getPermissions().allowModifyBy(gAgentID);
- item_panel->setShowLockButton(!allow_modify);
- item_panel->setShowEditButton(allow_modify);
-
- //setting callbacks
- //*TODO move that item panel's inner structure disclosing stuff into the panels
- item_panel->childSetAction("btn_delete", boost::bind(mCOFCallbacks.mDeleteWearable));
- item_panel->childSetAction("btn_edit", boost::bind(mCOFCallbacks.mEditWearable));
-
- return item_panel;
+ llassert(item);
+ if (!item) return NULL;
+ LLPanelBodyPartsListItem* item_panel = LLPanelBodyPartsListItem::create(item);
+ if (!item_panel) return NULL;
+
+ //updating verbs
+ //we don't need to use permissions of a link but of an actual/linked item
+ if (item->getLinkedItem()) item = item->getLinkedItem();
+ llassert(item);
+ if (!item) return NULL;
+ bool allow_modify = item->getPermissions().allowModifyBy(gAgentID);
+ item_panel->setShowLockButton(!allow_modify);
+ item_panel->setShowEditButton(allow_modify);
+
+ //setting callbacks
+ //*TODO move that item panel's inner structure disclosing stuff into the panels
+ item_panel->childSetAction("btn_delete", boost::bind(mCOFCallbacks.mDeleteWearable));
+ item_panel->childSetAction("btn_edit", boost::bind(mCOFCallbacks.mEditWearable));
+
+ return item_panel;
}
LLPanelDeletableWearableListItem* LLCOFWearables::buildAttachemntListItem(LLViewerInventoryItem* item)
{
- llassert(item);
- if (!item) return NULL;
+ llassert(item);
+ if (!item) return NULL;
- LLPanelAttachmentListItem* item_panel = LLPanelAttachmentListItem::create(item);
- if (!item_panel) return NULL;
+ LLPanelAttachmentListItem* item_panel = LLPanelAttachmentListItem::create(item);
+ if (!item_panel) return NULL;
- //setting callbacks
- //*TODO move that item panel's inner structure disclosing stuff into the panels
- item_panel->childSetAction("btn_delete", boost::bind(mCOFCallbacks.mDeleteWearable));
+ //setting callbacks
+ //*TODO move that item panel's inner structure disclosing stuff into the panels
+ item_panel->childSetAction("btn_delete", boost::bind(mCOFCallbacks.mDeleteWearable));
- return item_panel;
+ return item_panel;
}
void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type)
{
- llassert(clothing_by_type.size() == LLWearableType::WT_COUNT);
+ llassert(clothing_by_type.size() == LLWearableType::WT_COUNT);
- for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; ++type)
- {
- U32 size = clothing_by_type[type].size();
- if (!size) continue;
+ for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; ++type)
+ {
+ U32 size = clothing_by_type[type].size();
+ if (!size) continue;
- LLAppearanceMgr::sortItemsByActualDescription(clothing_by_type[type]);
+ LLAppearanceMgr::sortItemsByActualDescription(clothing_by_type[type]);
- //clothing items are displayed in reverse order, from furthest ones to closest ones (relatively to the body)
- for (U32 i = size; i != 0; --i)
- {
- LLViewerInventoryItem* item = clothing_by_type[type][i-1];
+ //clothing items are displayed in reverse order, from furthest ones to closest ones (relatively to the body)
+ for (U32 i = size; i != 0; --i)
+ {
+ LLViewerInventoryItem* item = clothing_by_type[type][i-1];
- LLPanelClothingListItem* item_panel = buildClothingListItem(item, i == size, i == 1);
- if (!item_panel) continue;
+ LLPanelClothingListItem* item_panel = buildClothingListItem(item, i == size, i == 1);
+ if (!item_panel) continue;
- mClothing->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
- }
- }
+ mClothing->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false);
+ }
+ }
- addClothingTypesDummies(clothing_by_type);
+ addClothingTypesDummies(clothing_by_type);
- mClothing->notify(REARRANGE);
+ mClothing->notify(REARRANGE);
}
//adding dummy items for missing wearable types
void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type)
{
- llassert(clothing_by_type.size() == LLWearableType::WT_COUNT);
-
- for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++)
- {
- U32 size = clothing_by_type[type].size();
- if (size) continue;
-
- LLWearableType::EType w_type = static_cast<LLWearableType::EType>(type);
- LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type);
- if(!item_panel) continue;
- item_panel->childSetAction("btn_add", boost::bind(mCOFCallbacks.mAddWearable));
- mClothing->addItem(item_panel, LLUUID::null, ADD_BOTTOM, false);
- }
+ llassert(clothing_by_type.size() == LLWearableType::WT_COUNT);
+
+ for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++)
+ {
+ U32 size = clothing_by_type[type].size();
+ if (size) continue;
+
+ LLWearableType::EType w_type = static_cast<LLWearableType::EType>(type);
+ LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type);
+ if(!item_panel) continue;
+ item_panel->childSetAction("btn_add", boost::bind(mCOFCallbacks.mAddWearable));
+ mClothing->addItem(item_panel, LLUUID::null, ADD_BOTTOM, false);
+ }
}
LLUUID LLCOFWearables::getSelectedUUID()
{
- if (!mLastSelectedList) return LLUUID::null;
-
- return mLastSelectedList->getSelectedUUID();
+ if (!mLastSelectedList) return LLUUID::null;
+
+ return mLastSelectedList->getSelectedUUID();
}
bool LLCOFWearables::getSelectedUUIDs(uuid_vec_t& selected_ids)
{
- if (!mLastSelectedList) return false;
+ if (!mLastSelectedList) return false;
- mLastSelectedList->getSelectedUUIDs(selected_ids);
- return selected_ids.size() != 0;
+ mLastSelectedList->getSelectedUUIDs(selected_ids);
+ return selected_ids.size() != 0;
}
LLPanel* LLCOFWearables::getSelectedItem()
{
- if (!mLastSelectedList) return NULL;
+ if (!mLastSelectedList) return NULL;
- return mLastSelectedList->getSelectedItem();
+ return mLastSelectedList->getSelectedItem();
}
void LLCOFWearables::getSelectedItems(std::vector<LLPanel*>& selected_items) const
{
- if (mLastSelectedList)
- {
- mLastSelectedList->getSelectedItems(selected_items);
- }
+ if (mLastSelectedList)
+ {
+ mLastSelectedList->getSelectedItems(selected_items);
+ }
}
void LLCOFWearables::clear()
{
- mAttachments->clear();
- mClothing->clear();
- mBodyParts->clear();
+ mAttachments->clear();
+ mClothing->clear();
+ mBodyParts->clear();
}
LLAssetType::EType LLCOFWearables::getExpandedAccordionAssetType()
{
- typedef std::map<std::string, LLAssetType::EType> type_map_t;
+ typedef std::map<std::string, LLAssetType::EType> type_map_t;
- static type_map_t type_map;
+ static type_map_t type_map;
- if (mAccordionCtrl != NULL)
- {
- const LLAccordionCtrlTab* expanded_tab = mAccordionCtrl->getExpandedTab();
+ if (mAccordionCtrl != NULL)
+ {
+ const LLAccordionCtrlTab* expanded_tab = mAccordionCtrl->getExpandedTab();
- return get_if_there(mTab2AssetType, expanded_tab, LLAssetType::AT_NONE);
- }
+ return get_if_there(mTab2AssetType, expanded_tab, LLAssetType::AT_NONE);
+ }
- return LLAssetType::AT_NONE;
+ return LLAssetType::AT_NONE;
}
LLAssetType::EType LLCOFWearables::getSelectedAccordionAssetType()
- {
- if (mAccordionCtrl != NULL)
- {
- const LLAccordionCtrlTab* selected_tab = mAccordionCtrl->getSelectedTab();
+ {
+ if (mAccordionCtrl != NULL)
+ {
+ const LLAccordionCtrlTab* selected_tab = mAccordionCtrl->getSelectedTab();
- return get_if_there(mTab2AssetType, selected_tab, LLAssetType::AT_NONE);
+ return get_if_there(mTab2AssetType, selected_tab, LLAssetType::AT_NONE);
}
- return LLAssetType::AT_NONE;
+ return LLAssetType::AT_NONE;
}
void LLCOFWearables::expandDefaultAccordionTab()
{
- if (mAccordionCtrl != NULL)
- {
- mAccordionCtrl->expandDefaultTab();
- }
+ if (mAccordionCtrl != NULL)
+ {
+ mAccordionCtrl->expandDefaultTab();
+ }
}
void LLCOFWearables::onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu)
{
- if(menu)
- {
- uuid_vec_t selected_uuids;
- if(getSelectedUUIDs(selected_uuids))
- {
- bool show_menu = false;
- for(uuid_vec_t::iterator it = selected_uuids.begin();it!=selected_uuids.end();++it)
- {
- if ((*it).notNull())
- {
- show_menu = true;
- break;
- }
- }
-
- if(show_menu)
- {
- menu->show(ctrl, selected_uuids, x, y);
- }
- }
- }
+ if(menu)
+ {
+ uuid_vec_t selected_uuids;
+ if(getSelectedUUIDs(selected_uuids))
+ {
+ bool show_menu = false;
+ for(uuid_vec_t::iterator it = selected_uuids.begin();it!=selected_uuids.end();++it)
+ {
+ if ((*it).notNull())
+ {
+ show_menu = true;
+ break;
+ }
+ }
+
+ if(show_menu)
+ {
+ menu->show(ctrl, selected_uuids, x, y);
+ }
+ }
+ }
}
void LLCOFWearables::selectClothing(LLWearableType::EType clothing_type)
{
- std::vector<LLPanel*> clothing_items;
+ std::vector<LLPanel*> clothing_items;
- mClothing->getItems(clothing_items);
+ mClothing->getItems(clothing_items);
- std::vector<LLPanel*>::iterator it;
+ std::vector<LLPanel*>::iterator it;
- for (it = clothing_items.begin(); it != clothing_items.end(); ++it )
- {
- LLPanelClothingListItem* clothing_item = dynamic_cast<LLPanelClothingListItem*>(*it);
+ for (it = clothing_items.begin(); it != clothing_items.end(); ++it )
+ {
+ LLPanelClothingListItem* clothing_item = dynamic_cast<LLPanelClothingListItem*>(*it);
- if (clothing_item && clothing_item->getWearableType() == clothing_type)
- { // clothing item has specified LLWearableType::EType. Select it and exit.
+ if (clothing_item && clothing_item->getWearableType() == clothing_type)
+ { // clothing item has specified LLWearableType::EType. Select it and exit.
- mClothing->selectItem(clothing_item);
- break;
- }
- }
+ mClothing->selectItem(clothing_item);
+ break;
+ }
+ }
}
//EOF
diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h
index 9957d6a64e..7a5ddbb16d 100644
--- a/indra/newview/llcofwearables.h
+++ b/indra/newview/llcofwearables.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcofwearables.h
* @brief LLCOFWearables displayes wearables from the current outfit split into three lists (attachments, clothing and body parts)
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,93 +45,93 @@ class LLCOFWearables : public LLPanel
{
public:
- /**
- * Represents a collection of callbacks assigned to inventory panel item's buttons
- */
- class LLCOFCallbacks
- {
- public:
- LLCOFCallbacks() {};
- virtual ~LLCOFCallbacks() {};
-
- typedef boost::function<void ()> cof_callback_t;
+ /**
+ * Represents a collection of callbacks assigned to inventory panel item's buttons
+ */
+ class LLCOFCallbacks
+ {
+ public:
+ LLCOFCallbacks() {};
+ virtual ~LLCOFCallbacks() {};
- cof_callback_t mAddWearable;
- cof_callback_t mMoveWearableCloser;
- cof_callback_t mMoveWearableFurther;
- cof_callback_t mEditWearable;
- cof_callback_t mDeleteWearable;
- };
+ typedef boost::function<void ()> cof_callback_t;
+ cof_callback_t mAddWearable;
+ cof_callback_t mMoveWearableCloser;
+ cof_callback_t mMoveWearableFurther;
+ cof_callback_t mEditWearable;
+ cof_callback_t mDeleteWearable;
+ };
- LLCOFWearables();
- virtual ~LLCOFWearables();
- /*virtual*/ BOOL postBuild();
-
- LLUUID getSelectedUUID();
- bool getSelectedUUIDs(uuid_vec_t& selected_ids);
+ LLCOFWearables();
+ virtual ~LLCOFWearables();
- LLPanel* getSelectedItem();
- void getSelectedItems(std::vector<LLPanel*>& selected_items) const;
+ /*virtual*/ BOOL postBuild();
- /* Repopulate the COF wearables list if the COF category has been changed since the last refresh */
- void refresh();
- void clear();
+ LLUUID getSelectedUUID();
+ bool getSelectedUUIDs(uuid_vec_t& selected_ids);
- LLAssetType::EType getExpandedAccordionAssetType();
- LLAssetType::EType getSelectedAccordionAssetType();
- void expandDefaultAccordionTab();
+ LLPanel* getSelectedItem();
+ void getSelectedItems(std::vector<LLPanel*>& selected_items) const;
- LLCOFCallbacks& getCOFCallbacks() { return mCOFCallbacks; }
+ /* Repopulate the COF wearables list if the COF category has been changed since the last refresh */
+ void refresh();
+ void clear();
- /**
- * Selects first clothing item with specified LLWearableType::EType from clothing list
- */
- void selectClothing(LLWearableType::EType clothing_type);
+ LLAssetType::EType getExpandedAccordionAssetType();
+ LLAssetType::EType getSelectedAccordionAssetType();
+ void expandDefaultAccordionTab();
- void setAttachmentsTitle();
+ LLCOFCallbacks& getCOFCallbacks() { return mCOFCallbacks; }
+
+ /**
+ * Selects first clothing item with specified LLWearableType::EType from clothing list
+ */
+ void selectClothing(LLWearableType::EType clothing_type);
+
+ void setAttachmentsTitle();
protected:
- void populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items);
- void populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type);
-
- void addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type);
- void onSelectionChange(LLFlatListView* selected_list);
- void onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expanded);
+ void populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items);
+ void populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type);
+
+ void addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type);
+ void onSelectionChange(LLFlatListView* selected_list);
+ void onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expanded);
- LLPanelClothingListItem* buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last);
- LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item);
- LLPanelDeletableWearableListItem* buildAttachemntListItem(LLViewerInventoryItem* item);
+ LLPanelClothingListItem* buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last);
+ LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item);
+ LLPanelDeletableWearableListItem* buildAttachemntListItem(LLViewerInventoryItem* item);
- void onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu);
+ void onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu);
- LLFlatListView* mAttachments;
- LLFlatListView* mClothing;
- LLFlatListView* mBodyParts;
+ LLFlatListView* mAttachments;
+ LLFlatListView* mClothing;
+ LLFlatListView* mBodyParts;
- LLFlatListView* mLastSelectedList;
+ LLFlatListView* mLastSelectedList;
- LLAccordionCtrlTab* mClothingTab;
- LLAccordionCtrlTab* mAttachmentsTab;
- LLAccordionCtrlTab* mBodyPartsTab;
+ LLAccordionCtrlTab* mClothingTab;
+ LLAccordionCtrlTab* mAttachmentsTab;
+ LLAccordionCtrlTab* mBodyPartsTab;
- LLAccordionCtrlTab* mLastSelectedTab;
+ LLAccordionCtrlTab* mLastSelectedTab;
- std::map<const LLAccordionCtrlTab*, LLAssetType::EType> mTab2AssetType;
+ std::map<const LLAccordionCtrlTab*, LLAssetType::EType> mTab2AssetType;
- LLCOFCallbacks mCOFCallbacks;
+ LLCOFCallbacks mCOFCallbacks;
- LLListContextMenu* mClothingMenu;
- LLListContextMenu* mAttachmentMenu;
- LLListContextMenu* mBodyPartMenu;
+ LLListContextMenu* mClothingMenu;
+ LLListContextMenu* mAttachmentMenu;
+ LLListContextMenu* mBodyPartMenu;
- LLAccordionCtrl* mAccordionCtrl;
+ LLAccordionCtrl* mAccordionCtrl;
- /* COF category version since last refresh */
- S32 mCOFVersion;
+ /* COF category version since last refresh */
+ S32 mCOFVersion;
};
diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp
index 036ff17074..43e3d0c642 100644
--- a/indra/newview/llcolorswatch.cpp
+++ b/indra/newview/llcolorswatch.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcolorswatch.cpp
* @brief LLColorSwatch class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,7 +31,7 @@
// Linden library includes
#include "v4color.h"
-#include "llwindow.h" // setCursor()
+#include "llwindow.h" // setCursor()
// Project includes
#include "llui.h"
@@ -46,250 +46,250 @@
static LLDefaultChildRegistry::Register<LLColorSwatchCtrl> r("color_swatch");
LLColorSwatchCtrl::Params::Params()
-: color("color", LLColor4::white),
- can_apply_immediately("can_apply_immediately", false),
- alpha_background_image("alpha_background_image"),
- border_color("border_color"),
+: color("color", LLColor4::white),
+ can_apply_immediately("can_apply_immediately", false),
+ alpha_background_image("alpha_background_image"),
+ border_color("border_color"),
label_width("label_width", -1),
- label_height("label_height", -1),
- caption_text("caption_text"),
- border("border")
+ label_height("label_height", -1),
+ caption_text("caption_text"),
+ border("border")
{
}
LLColorSwatchCtrl::LLColorSwatchCtrl(const Params& p)
-: LLUICtrl(p),
- mValid( TRUE ),
- mColor(p.color()),
- mCanApplyImmediately(p.can_apply_immediately),
- mAlphaGradientImage(p.alpha_background_image),
- mOnCancelCallback(p.cancel_callback()),
- mOnSelectCallback(p.select_callback()),
- mBorderColor(p.border_color()),
- mLabelWidth(p.label_width),
- mLabelHeight(p.label_height)
-{
- LLTextBox::Params tp = p.caption_text;
- // use custom label height if it is provided
- mLabelHeight = mLabelHeight != -1 ? mLabelHeight : BTN_HEIGHT_SMALL;
- // label_width is specified, not -1
- if(mLabelWidth!= -1)
- {
- tp.rect(LLRect( 0, mLabelHeight, mLabelWidth, 0 ));
- }
- else
- {
- tp.rect(LLRect( 0, mLabelHeight, getRect().getWidth(), 0 ));
- }
-
- tp.initial_value(p.label());
- mCaption = LLUICtrlFactory::create<LLTextBox>(tp);
- addChild( mCaption );
-
- LLRect border_rect = getLocalRect();
- border_rect.mTop -= 1;
- border_rect.mRight -=1;
- border_rect.mBottom += mLabelHeight;
-
- LLViewBorder::Params params = p.border;
- params.rect(border_rect);
- mBorder = LLUICtrlFactory::create<LLViewBorder> (params);
- addChild(mBorder);
+: LLUICtrl(p),
+ mValid( TRUE ),
+ mColor(p.color()),
+ mCanApplyImmediately(p.can_apply_immediately),
+ mAlphaGradientImage(p.alpha_background_image),
+ mOnCancelCallback(p.cancel_callback()),
+ mOnSelectCallback(p.select_callback()),
+ mBorderColor(p.border_color()),
+ mLabelWidth(p.label_width),
+ mLabelHeight(p.label_height)
+{
+ LLTextBox::Params tp = p.caption_text;
+ // use custom label height if it is provided
+ mLabelHeight = mLabelHeight != -1 ? mLabelHeight : BTN_HEIGHT_SMALL;
+ // label_width is specified, not -1
+ if(mLabelWidth!= -1)
+ {
+ tp.rect(LLRect( 0, mLabelHeight, mLabelWidth, 0 ));
+ }
+ else
+ {
+ tp.rect(LLRect( 0, mLabelHeight, getRect().getWidth(), 0 ));
+ }
+
+ tp.initial_value(p.label());
+ mCaption = LLUICtrlFactory::create<LLTextBox>(tp);
+ addChild( mCaption );
+
+ LLRect border_rect = getLocalRect();
+ border_rect.mTop -= 1;
+ border_rect.mRight -=1;
+ border_rect.mBottom += mLabelHeight;
+
+ LLViewBorder::Params params = p.border;
+ params.rect(border_rect);
+ mBorder = LLUICtrlFactory::create<LLViewBorder> (params);
+ addChild(mBorder);
}
LLColorSwatchCtrl::~LLColorSwatchCtrl ()
{
- // parent dialog is destroyed so we are too and we need to cancel selection
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
- if (pickerp)
- {
- pickerp->cancelSelection();
- pickerp->closeFloater();
- }
+ // parent dialog is destroyed so we are too and we need to cancel selection
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
+ if (pickerp)
+ {
+ pickerp->cancelSelection();
+ pickerp->closeFloater();
+ }
}
BOOL LLColorSwatchCtrl::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- return handleMouseDown(x, y, mask);
+ return handleMouseDown(x, y, mask);
}
BOOL LLColorSwatchCtrl::handleHover(S32 x, S32 y, MASK mask)
{
- getWindow()->setCursor(UI_CURSOR_HAND);
- return TRUE;
+ getWindow()->setCursor(UI_CURSOR_HAND);
+ return TRUE;
}
BOOL LLColorSwatchCtrl::handleUnicodeCharHere(llwchar uni_char)
{
- if( ' ' == uni_char )
- {
- showPicker(TRUE);
- }
- return LLUICtrl::handleUnicodeCharHere(uni_char);
+ if( ' ' == uni_char )
+ {
+ showPicker(TRUE);
+ }
+ return LLUICtrl::handleUnicodeCharHere(uni_char);
}
// forces color of this swatch and any associated floater to the input value, if currently invalid
void LLColorSwatchCtrl::setOriginal(const LLColor4& color)
{
- mColor = color;
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
- if (pickerp)
- {
- pickerp->setOrigRgb(mColor.mV[VRED], mColor.mV[VGREEN], mColor.mV[VBLUE]);
- }
+ mColor = color;
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
+ if (pickerp)
+ {
+ pickerp->setOrigRgb(mColor.mV[VRED], mColor.mV[VGREEN], mColor.mV[VBLUE]);
+ }
}
void LLColorSwatchCtrl::set(const LLColor4& color, BOOL update_picker, BOOL from_event)
{
- mColor = color;
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
- if (pickerp && update_picker)
- {
- pickerp->setCurRgb(mColor.mV[VRED], mColor.mV[VGREEN], mColor.mV[VBLUE]);
- }
- if (!from_event)
- {
- setControlValue(mColor.getValue());
- }
+ mColor = color;
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
+ if (pickerp && update_picker)
+ {
+ pickerp->setCurRgb(mColor.mV[VRED], mColor.mV[VGREEN], mColor.mV[VBLUE]);
+ }
+ if (!from_event)
+ {
+ setControlValue(mColor.getValue());
+ }
}
void LLColorSwatchCtrl::setLabel(const std::string& label)
{
- mCaption->setText(label);
+ mCaption->setText(label);
}
BOOL LLColorSwatchCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
{
- // Route future Mouse messages here preemptively. (Release on mouse up.)
- // No handler is needed for capture lost since this object has no state that depends on it.
- gFocusMgr.setMouseCapture( this );
+ // Route future Mouse messages here preemptively. (Release on mouse up.)
+ // No handler is needed for capture lost since this object has no state that depends on it.
+ gFocusMgr.setMouseCapture( this );
- return TRUE;
+ return TRUE;
}
BOOL LLColorSwatchCtrl::handleMouseUp(S32 x, S32 y, MASK mask)
{
- // We only handle the click if the click both started and ended within us
- if( hasMouseCapture() )
- {
- // Release the mouse
- gFocusMgr.setMouseCapture( NULL );
-
- // If mouseup in the widget, it's been clicked
- if ( pointInView(x, y) )
- {
- llassert(getEnabled());
- llassert(getVisible());
-
- // Focus the widget now in order to return the focus
- // after the color picker is closed.
- setFocus(TRUE);
-
- showPicker(FALSE);
- }
- }
-
- return TRUE;
+ // We only handle the click if the click both started and ended within us
+ if( hasMouseCapture() )
+ {
+ // Release the mouse
+ gFocusMgr.setMouseCapture( NULL );
+
+ // If mouseup in the widget, it's been clicked
+ if ( pointInView(x, y) )
+ {
+ llassert(getEnabled());
+ llassert(getVisible());
+
+ // Focus the widget now in order to return the focus
+ // after the color picker is closed.
+ setFocus(TRUE);
+
+ showPicker(FALSE);
+ }
+ }
+
+ return TRUE;
}
// assumes GL state is set for 2D
void LLColorSwatchCtrl::draw()
{
- // If we're in a focused floater, don't apply the floater's alpha to the color swatch (STORM-676).
- F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
-
- mBorder->setKeyboardFocusHighlight(hasFocus());
- // Draw border
- LLRect border( 0, getRect().getHeight(), getRect().getWidth(), mLabelHeight );
- gl_rect_2d( border, mBorderColor.get(), FALSE );
-
- LLRect interior = border;
- interior.stretch( -1 );
-
- // Check state
- if ( mValid )
- {
- if (!mColor.isOpaque())
- {
- // Draw checker board.
- gl_rect_2d_checkerboard(interior, alpha);
- }
-
- // Draw the color swatch
- gl_rect_2d(interior, mColor % alpha, TRUE);
-
- if (!mColor.isOpaque())
- {
- // Draw semi-transparent center area in filled with mColor.
- LLColor4 opaque_color = mColor;
- opaque_color.mV[VALPHA] = alpha;
- gGL.color4fv(opaque_color.mV);
- if (mAlphaGradientImage.notNull())
- {
- gGL.pushMatrix();
- {
- mAlphaGradientImage->draw(interior, mColor % alpha);
- }
- gGL.popMatrix();
- }
- }
- }
- else
- {
- if (mFallbackImage.notNull())
- {
- mFallbackImage->draw(interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), LLColor4::white % alpha);
- }
- else
- {
- // Draw grey and an X
- gl_rect_2d(interior, LLColor4::grey % alpha, TRUE);
-
- gl_draw_x(interior, LLColor4::black % alpha);
- }
- }
-
- LLUICtrl::draw();
+ // If we're in a focused floater, don't apply the floater's alpha to the color swatch (STORM-676).
+ F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+
+ mBorder->setKeyboardFocusHighlight(hasFocus());
+ // Draw border
+ LLRect border( 0, getRect().getHeight(), getRect().getWidth(), mLabelHeight );
+ gl_rect_2d( border, mBorderColor.get(), FALSE );
+
+ LLRect interior = border;
+ interior.stretch( -1 );
+
+ // Check state
+ if ( mValid )
+ {
+ if (!mColor.isOpaque())
+ {
+ // Draw checker board.
+ gl_rect_2d_checkerboard(interior, alpha);
+ }
+
+ // Draw the color swatch
+ gl_rect_2d(interior, mColor % alpha, TRUE);
+
+ if (!mColor.isOpaque())
+ {
+ // Draw semi-transparent center area in filled with mColor.
+ LLColor4 opaque_color = mColor;
+ opaque_color.mV[VALPHA] = alpha;
+ gGL.color4fv(opaque_color.mV);
+ if (mAlphaGradientImage.notNull())
+ {
+ gGL.pushMatrix();
+ {
+ mAlphaGradientImage->draw(interior, mColor % alpha);
+ }
+ gGL.popMatrix();
+ }
+ }
+ }
+ else
+ {
+ if (mFallbackImage.notNull())
+ {
+ mFallbackImage->draw(interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), LLColor4::white % alpha);
+ }
+ else
+ {
+ // Draw grey and an X
+ gl_rect_2d(interior, LLColor4::grey % alpha, TRUE);
+
+ gl_draw_x(interior, LLColor4::black % alpha);
+ }
+ }
+
+ LLUICtrl::draw();
}
void LLColorSwatchCtrl::setEnabled( BOOL enabled )
{
- mCaption->setEnabled( enabled );
- LLView::setEnabled( enabled );
-
- if (!enabled)
- {
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
- if (pickerp)
- {
- pickerp->cancelSelection();
- pickerp->closeFloater();
- }
- }
+ mCaption->setEnabled( enabled );
+ LLView::setEnabled( enabled );
+
+ if (!enabled)
+ {
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
+ if (pickerp)
+ {
+ pickerp->cancelSelection();
+ pickerp->closeFloater();
+ }
+ }
}
void LLColorSwatchCtrl::setValue(const LLSD& value)
{
- set(LLColor4(value), TRUE, TRUE);
+ set(LLColor4(value), TRUE, TRUE);
}
//////////////////////////////////////////////////////////////////////////////
// called (infrequently) when the color changes so the subject of the swatch can be updated.
void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
{
- LLColorSwatchCtrl* subject = ( LLColorSwatchCtrl* )data;
- if ( subject )
- {
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)subject->mPickerHandle.get();
- if (pickerp)
- {
- // move color across from selector to internal widget storage
- LLColor4 updatedColor ( pickerp->getCurR (),
- pickerp->getCurG (),
- pickerp->getCurB (),
- subject->mColor.mV[VALPHA] ); // keep current alpha
+ LLColorSwatchCtrl* subject = ( LLColorSwatchCtrl* )data;
+ if ( subject )
+ {
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)subject->mPickerHandle.get();
+ if (pickerp)
+ {
+ // move color across from selector to internal widget storage
+ LLColor4 updatedColor ( pickerp->getCurR (),
+ pickerp->getCurG (),
+ pickerp->getCurB (),
+ subject->mColor.mV[VALPHA] ); // keep current alpha
bool color_changed = subject->mColor != updatedColor;
if (color_changed)
@@ -298,19 +298,19 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
subject->setControlValue(updatedColor.getValue());
}
- if (pick_op == COLOR_CANCEL && subject->mOnCancelCallback)
- {
- subject->mOnCancelCallback( subject, LLSD());
- }
- else if (pick_op == COLOR_SELECT && subject->mOnSelectCallback)
- {
- subject->mOnSelectCallback( subject, LLSD() );
- }
- else
- {
- // just commit change
- subject->onCommit ();
- }
+ if (pick_op == COLOR_CANCEL && subject->mOnCancelCallback)
+ {
+ subject->mOnCancelCallback( subject, LLSD());
+ }
+ else if (pick_op == COLOR_SELECT && subject->mOnSelectCallback)
+ {
+ subject->mOnSelectCallback( subject, LLSD() );
+ }
+ else
+ {
+ // just commit change
+ subject->onCommit ();
+ }
if (pick_op == COLOR_CANCEL || pick_op == COLOR_SELECT)
{
@@ -318,8 +318,8 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
// but COLOR_CHANGE does not
subject->setFocus(TRUE);
}
- }
- }
+ }
+ }
}
// This is called when the main floatercustomize panel is closed.
@@ -327,50 +327,50 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
// this class first in order to avoid a crash.
void LLColorSwatchCtrl::closeFloaterColorPicker()
{
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
- if (pickerp)
- {
- pickerp->setSwatch(NULL);
- pickerp->closeFloater();
- }
-
- mPickerHandle.markDead();
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
+ if (pickerp)
+ {
+ pickerp->setSwatch(NULL);
+ pickerp->closeFloater();
+ }
+
+ mPickerHandle.markDead();
}
void LLColorSwatchCtrl::setValid(BOOL valid )
{
- mValid = valid;
+ mValid = valid;
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
- if (pickerp)
- {
- pickerp->setActive(valid);
- }
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
+ if (pickerp)
+ {
+ pickerp->setActive(valid);
+ }
}
void LLColorSwatchCtrl::showPicker(BOOL take_focus)
{
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
- if (!pickerp)
- {
- pickerp = new LLFloaterColorPicker(this, mCanApplyImmediately);
- LLFloater* parent = gFloaterView->getParentFloater(this);
- if (parent)
- {
- parent->addDependentFloater(pickerp);
- }
- mPickerHandle = pickerp->getHandle();
- }
-
- // initialize picker with current color
- pickerp->initUI ( mColor.mV [ VRED ], mColor.mV [ VGREEN ], mColor.mV [ VBLUE ] );
-
- // display it
- pickerp->showUI ();
-
- if (take_focus)
- {
- pickerp->setFocus(TRUE);
- }
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
+ if (!pickerp)
+ {
+ pickerp = new LLFloaterColorPicker(this, mCanApplyImmediately);
+ LLFloater* parent = gFloaterView->getParentFloater(this);
+ if (parent)
+ {
+ parent->addDependentFloater(pickerp);
+ }
+ mPickerHandle = pickerp->getHandle();
+ }
+
+ // initialize picker with current color
+ pickerp->initUI ( mColor.mV [ VRED ], mColor.mV [ VGREEN ], mColor.mV [ VBLUE ] );
+
+ // display it
+ pickerp->showUI ();
+
+ if (take_focus)
+ {
+ pickerp->setFocus(TRUE);
+ }
}
diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h
index a17cab486a..81cf04e7b9 100644
--- a/indra/newview/llcolorswatch.h
+++ b/indra/newview/llcolorswatch.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcolorswatch.h
* @brief LLColorSwatch class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,81 +41,81 @@ class LLColorSwatchCtrl
: public LLUICtrl
{
public:
- typedef enum e_color_pick_op
- {
- COLOR_CHANGE,
- COLOR_SELECT,
- COLOR_CANCEL
- } EColorPickOp;
-
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<LLUIColor> color;
- Optional<bool> can_apply_immediately;
- Optional<LLUIImage*> alpha_background_image;
- Optional<commit_callback_t> cancel_callback;
- Optional<commit_callback_t> select_callback;
- Optional<commit_callback_t> preview_callback;
- Optional<LLUIColor> border_color;
- Optional<S32> label_width;
- Optional<S32> label_height;
-
- Optional<LLTextBox::Params> caption_text;
- Optional<LLViewBorder::Params> border;
- Params();
- };
+ typedef enum e_color_pick_op
+ {
+ COLOR_CHANGE,
+ COLOR_SELECT,
+ COLOR_CANCEL
+ } EColorPickOp;
+
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Optional<LLUIColor> color;
+ Optional<bool> can_apply_immediately;
+ Optional<LLUIImage*> alpha_background_image;
+ Optional<commit_callback_t> cancel_callback;
+ Optional<commit_callback_t> select_callback;
+ Optional<commit_callback_t> preview_callback;
+ Optional<LLUIColor> border_color;
+ Optional<S32> label_width;
+ Optional<S32> label_height;
+
+ Optional<LLTextBox::Params> caption_text;
+ Optional<LLViewBorder::Params> border;
+ Params();
+ };
protected:
- LLColorSwatchCtrl(const Params& p);
- friend class LLUICtrlFactory;
+ LLColorSwatchCtrl(const Params& p);
+ friend class LLUICtrlFactory;
public:
- ~LLColorSwatchCtrl ();
-
- /*virtual*/ void setValue(const LLSD& value);
-
- /*virtual*/ LLSD getValue() const { return mColor.getValue(); }
- const LLColor4& get() { return mColor; }
-
- void set(const LLColor4& color, BOOL update_picker = FALSE, BOOL from_event = FALSE);
- void setOriginal(const LLColor4& color);
- void setValid(BOOL valid);
- void setLabel(const std::string& label);
- void setLabelWidth(S32 label_width) {mLabelWidth =label_width;}
- void setCanApplyImmediately(BOOL apply) { mCanApplyImmediately = apply; }
- void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; }
- void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; }
- void setPreviewCallback(commit_callback_t cb) { mPreviewCallback = cb; }
- void setFallbackImage(LLPointer<LLUIImage> image) { mFallbackImage = image; }
-
- void showPicker(BOOL take_focus);
-
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask);
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char);
- /*virtual*/ void draw();
- /*virtual*/ void setEnabled( BOOL enabled );
-
- static void onColorChanged ( void* data, EColorPickOp pick_op = COLOR_CHANGE );
- void closeFloaterColorPicker();
+ ~LLColorSwatchCtrl ();
+
+ /*virtual*/ void setValue(const LLSD& value);
+
+ /*virtual*/ LLSD getValue() const { return mColor.getValue(); }
+ const LLColor4& get() { return mColor; }
+
+ void set(const LLColor4& color, BOOL update_picker = FALSE, BOOL from_event = FALSE);
+ void setOriginal(const LLColor4& color);
+ void setValid(BOOL valid);
+ void setLabel(const std::string& label);
+ void setLabelWidth(S32 label_width) {mLabelWidth =label_width;}
+ void setCanApplyImmediately(BOOL apply) { mCanApplyImmediately = apply; }
+ void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; }
+ void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; }
+ void setPreviewCallback(commit_callback_t cb) { mPreviewCallback = cb; }
+ void setFallbackImage(LLPointer<LLUIImage> image) { mFallbackImage = image; }
+
+ void showPicker(BOOL take_focus);
+
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask);
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char);
+ /*virtual*/ void draw();
+ /*virtual*/ void setEnabled( BOOL enabled );
+
+ static void onColorChanged ( void* data, EColorPickOp pick_op = COLOR_CHANGE );
+ void closeFloaterColorPicker();
protected:
- bool mValid;
- LLColor4 mColor;
- LLUIColor mBorderColor;
- LLTextBox* mCaption;
- LLHandle<LLFloater> mPickerHandle;
- class LLViewBorder* mBorder;
- bool mCanApplyImmediately;
- commit_callback_t mOnCancelCallback,
- mOnSelectCallback;
- commit_callback_t mPreviewCallback;
- S32 mLabelWidth,
- mLabelHeight;
-
- LLPointer<LLUIImage> mAlphaGradientImage;
- LLPointer<LLUIImage> mFallbackImage;
+ bool mValid;
+ LLColor4 mColor;
+ LLUIColor mBorderColor;
+ LLTextBox* mCaption;
+ LLHandle<LLFloater> mPickerHandle;
+ class LLViewBorder* mBorder;
+ bool mCanApplyImmediately;
+ commit_callback_t mOnCancelCallback,
+ mOnSelectCallback;
+ commit_callback_t mPreviewCallback;
+ S32 mLabelWidth,
+ mLabelHeight;
+
+ LLPointer<LLUIImage> mAlphaGradientImage;
+ LLPointer<LLUIImage> mFallbackImage;
};
#endif // LL_LLBUTTON_H
diff --git a/indra/newview/llcommanddispatcherlistener.cpp b/indra/newview/llcommanddispatcherlistener.cpp
index 46ec97d5c0..4b8d0f870f 100644
--- a/indra/newview/llcommanddispatcherlistener.cpp
+++ b/indra/newview/llcommanddispatcherlistener.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-12-10
* @brief Implementation for llcommanddispatcherlistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llcommanddispatcherlistener.h b/indra/newview/llcommanddispatcherlistener.h
index 024cc1a18d..b24a996050 100644
--- a/indra/newview/llcommanddispatcherlistener.h
+++ b/indra/newview/llcommanddispatcherlistener.h
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-12-10
* @brief LLEventAPI for LLCommandDispatcher
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llcommandhandler.cpp b/indra/newview/llcommandhandler.cpp
index caa27e530b..4038ae8002 100644
--- a/indra/newview/llcommandhandler.cpp
+++ b/indra/newview/llcommandhandler.cpp
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,81 +48,81 @@ const std::string LLCommandHandler::NAV_TYPE_NAVIGATED = "navigated";
//---------------------------------------------------------------------------
struct LLCommandHandlerInfo
{
- LLCommandHandler::EUntrustedAccess mUntrustedBrowserAccess;
- LLCommandHandler* mHandler; // safe, all of these are static objects
+ LLCommandHandler::EUntrustedAccess mUntrustedBrowserAccess;
+ LLCommandHandler* mHandler; // safe, all of these are static objects
};
class LLCommandHandlerRegistry
{
public:
- static LLCommandHandlerRegistry& instance();
- void add(const char* cmd,
- LLCommandHandler::EUntrustedAccess untrusted_access,
- LLCommandHandler* handler);
- bool dispatch(const std::string& cmd,
- const LLSD& params,
- const LLSD& query_map,
+ static LLCommandHandlerRegistry& instance();
+ void add(const char* cmd,
+ LLCommandHandler::EUntrustedAccess untrusted_access,
+ LLCommandHandler* handler);
+ bool dispatch(const std::string& cmd,
+ const LLSD& params,
+ const LLSD& query_map,
const std::string& grid,
- LLMediaCtrl* web,
- const std::string& nav_type,
- bool trusted_browser);
+ LLMediaCtrl* web,
+ const std::string& nav_type,
+ bool trusted_browser);
private:
void notifySlurlBlocked();
void notifySlurlThrottled();
- friend LLSD LLCommandDispatcher::enumerate();
- std::map<std::string, LLCommandHandlerInfo> mMap;
+ friend LLSD LLCommandDispatcher::enumerate();
+ std::map<std::string, LLCommandHandlerInfo> mMap;
};
-// static
+// static
LLCommandHandlerRegistry& LLCommandHandlerRegistry::instance()
{
- // Force this to be initialized on first call, because we're going
- // to be adding items to the std::map before main() and we can't
- // rely on a global being initialized in the right order.
- static LLCommandHandlerRegistry instance;
- return instance;
+ // Force this to be initialized on first call, because we're going
+ // to be adding items to the std::map before main() and we can't
+ // rely on a global being initialized in the right order.
+ static LLCommandHandlerRegistry instance;
+ return instance;
}
void LLCommandHandlerRegistry::add(const char* cmd,
- LLCommandHandler::EUntrustedAccess untrusted_access,
- LLCommandHandler* handler)
+ LLCommandHandler::EUntrustedAccess untrusted_access,
+ LLCommandHandler* handler)
{
- LLCommandHandlerInfo info;
- info.mUntrustedBrowserAccess = untrusted_access;
- info.mHandler = handler;
+ LLCommandHandlerInfo info;
+ info.mUntrustedBrowserAccess = untrusted_access;
+ info.mHandler = handler;
- mMap[cmd] = info;
+ mMap[cmd] = info;
}
bool LLCommandHandlerRegistry::dispatch(const std::string& cmd,
- const LLSD& params,
- const LLSD& query_map,
- const std::string& grid,
- LLMediaCtrl* web,
- const std::string& nav_type,
- bool trusted_browser)
+ const LLSD& params,
+ const LLSD& query_map,
+ const std::string& grid,
+ LLMediaCtrl* web,
+ const std::string& nav_type,
+ bool trusted_browser)
{
- static F64 last_throttle_time = 0.0;
- F64 cur_time = 0.0;
- std::map<std::string, LLCommandHandlerInfo>::iterator it = mMap.find(cmd);
- if (it == mMap.end()) return false;
- const LLCommandHandlerInfo& info = it->second;
- if (!trusted_browser)
- {
- switch (info.mUntrustedBrowserAccess)
- {
- case LLCommandHandler::UNTRUSTED_ALLOW:
- // fall through and let the command be handled
- break;
+ static F64 last_throttle_time = 0.0;
+ F64 cur_time = 0.0;
+ std::map<std::string, LLCommandHandlerInfo>::iterator it = mMap.find(cmd);
+ if (it == mMap.end()) return false;
+ const LLCommandHandlerInfo& info = it->second;
+ if (!trusted_browser)
+ {
+ switch (info.mUntrustedBrowserAccess)
+ {
+ case LLCommandHandler::UNTRUSTED_ALLOW:
+ // fall through and let the command be handled
+ break;
- case LLCommandHandler::UNTRUSTED_BLOCK:
- // block request from external browser, but report as
- // "handled" because it was well formatted.
- LL_WARNS_ONCE("SLURL") << "Blocked SLURL command from untrusted browser" << LL_ENDL;
+ case LLCommandHandler::UNTRUSTED_BLOCK:
+ // block request from external browser, but report as
+ // "handled" because it was well formatted.
+ LL_WARNS_ONCE("SLURL") << "Blocked SLURL command from untrusted browser" << LL_ENDL;
notifySlurlBlocked();
- return true;
+ return true;
case LLCommandHandler::UNTRUSTED_CLICK_ONLY:
if (nav_type == LLCommandHandler::NAV_TYPE_CLICKED
@@ -134,40 +134,40 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd,
notifySlurlBlocked();
return true;
- case LLCommandHandler::UNTRUSTED_THROTTLE:
- //skip initial request from external browser before STATE_BROWSER_INIT
- if (LLStartUp::getStartupState() == STATE_FIRST)
- {
- return true;
- }
+ case LLCommandHandler::UNTRUSTED_THROTTLE:
+ //skip initial request from external browser before STATE_BROWSER_INIT
+ if (LLStartUp::getStartupState() == STATE_FIRST)
+ {
+ return true;
+ }
if (!info.mHandler->canHandleUntrusted(params, query_map, web, nav_type))
{
LL_WARNS_ONCE("SLURL") << "Blocked SLURL command from untrusted browser" << LL_ENDL;
notifySlurlBlocked();
return true;
}
- // if users actually click on a link, we don't need to throttle it
- // (throttling mechanism is used to prevent an avalanche of clicks via
- // javascript
- if (nav_type == LLCommandHandler::NAV_TYPE_CLICKED)
- {
- break;
- }
- cur_time = LLTimer::getElapsedSeconds();
- if (cur_time < last_throttle_time + THROTTLE_PERIOD)
- {
- // block request from external browser if it happened
- // within THROTTLE_PERIOD seconds of the last command
- LL_WARNS_ONCE("SLURL") << "Throttled SLURL command from untrusted browser" << LL_ENDL;
+ // if users actually click on a link, we don't need to throttle it
+ // (throttling mechanism is used to prevent an avalanche of clicks via
+ // javascript
+ if (nav_type == LLCommandHandler::NAV_TYPE_CLICKED)
+ {
+ break;
+ }
+ cur_time = LLTimer::getElapsedSeconds();
+ if (cur_time < last_throttle_time + THROTTLE_PERIOD)
+ {
+ // block request from external browser if it happened
+ // within THROTTLE_PERIOD seconds of the last command
+ LL_WARNS_ONCE("SLURL") << "Throttled SLURL command from untrusted browser" << LL_ENDL;
notifySlurlThrottled();
- return true;
- }
- last_throttle_time = cur_time;
- break;
- }
- }
- if (!info.mHandler) return false;
- return info.mHandler->handle(params, query_map, grid, web);
+ return true;
+ }
+ last_throttle_time = cur_time;
+ break;
+ }
+ }
+ if (!info.mHandler) return false;
+ return info.mHandler->handle(params, query_map, grid, web);
}
void LLCommandHandlerRegistry::notifySlurlBlocked()
@@ -203,15 +203,15 @@ void LLCommandHandlerRegistry::notifySlurlThrottled()
//---------------------------------------------------------------------------
LLCommandHandler::LLCommandHandler(const char* cmd,
- EUntrustedAccess untrusted_access)
+ EUntrustedAccess untrusted_access)
{
- LLCommandHandlerRegistry::instance().add(cmd, untrusted_access, this);
+ LLCommandHandlerRegistry::instance().add(cmd, untrusted_access, this);
}
LLCommandHandler::~LLCommandHandler()
{
- // Don't care about unregistering these, all the handlers
- // should be static objects.
+ // Don't care about unregistering these, all the handlers
+ // should be static objects.
}
//---------------------------------------------------------------------------
@@ -220,67 +220,67 @@ LLCommandHandler::~LLCommandHandler()
// static
bool LLCommandDispatcher::dispatch(const std::string& cmd,
- const LLSD& params,
- const LLSD& query_map,
- const std::string& grid,
- LLMediaCtrl* web,
- const std::string& nav_type,
- bool trusted_browser)
+ const LLSD& params,
+ const LLSD& query_map,
+ const std::string& grid,
+ LLMediaCtrl* web,
+ const std::string& nav_type,
+ bool trusted_browser)
{
- return LLCommandHandlerRegistry::instance().dispatch(
- cmd, params, query_map, grid, web, nav_type, trusted_browser);
+ return LLCommandHandlerRegistry::instance().dispatch(
+ cmd, params, query_map, grid, web, nav_type, trusted_browser);
}
static std::string lookup(LLCommandHandler::EUntrustedAccess value);
LLSD LLCommandDispatcher::enumerate()
{
- LLSD response;
- LLCommandHandlerRegistry& registry(LLCommandHandlerRegistry::instance());
- for (std::map<std::string, LLCommandHandlerInfo>::const_iterator chi(registry.mMap.begin()),
- chend(registry.mMap.end());
- chi != chend; ++chi)
- {
- LLSD info;
- info["untrusted"] = chi->second.mUntrustedBrowserAccess;
- info["untrusted_str"] = lookup(chi->second.mUntrustedBrowserAccess);
- response[chi->first] = info;
- }
- return response;
+ LLSD response;
+ LLCommandHandlerRegistry& registry(LLCommandHandlerRegistry::instance());
+ for (std::map<std::string, LLCommandHandlerInfo>::const_iterator chi(registry.mMap.begin()),
+ chend(registry.mMap.end());
+ chi != chend; ++chi)
+ {
+ LLSD info;
+ info["untrusted"] = chi->second.mUntrustedBrowserAccess;
+ info["untrusted_str"] = lookup(chi->second.mUntrustedBrowserAccess);
+ response[chi->first] = info;
+ }
+ return response;
}
/*------------------------------ lookup stuff ------------------------------*/
struct symbol_info
{
- const char* name;
- LLCommandHandler::EUntrustedAccess value;
+ const char* name;
+ LLCommandHandler::EUntrustedAccess value;
};
-#define ent(SYMBOL) \
- { \
- &#SYMBOL[28], /* skip "LLCommandHandler::UNTRUSTED_" prefix */ \
- SYMBOL \
- }
+#define ent(SYMBOL) \
+ { \
+ &#SYMBOL[28], /* skip "LLCommandHandler::UNTRUSTED_" prefix */ \
+ SYMBOL \
+ }
symbol_info symbols[] =
{
- ent(LLCommandHandler::UNTRUSTED_ALLOW), // allow commands from untrusted browsers
- ent(LLCommandHandler::UNTRUSTED_BLOCK), // ignore commands from untrusted browsers
+ ent(LLCommandHandler::UNTRUSTED_ALLOW), // allow commands from untrusted browsers
+ ent(LLCommandHandler::UNTRUSTED_BLOCK), // ignore commands from untrusted browsers
ent(LLCommandHandler::UNTRUSTED_CLICK_ONLY), // allow untrusted, but only if clicked
- ent(LLCommandHandler::UNTRUSTED_THROTTLE) // allow untrusted, but only a few per min.
+ ent(LLCommandHandler::UNTRUSTED_THROTTLE) // allow untrusted, but only a few per min.
};
#undef ent
static std::string lookup(LLCommandHandler::EUntrustedAccess value)
{
- for (symbol_info *sii(symbols), *siend(symbols + (sizeof(symbols)/sizeof(symbols[0])));
- sii != siend; ++sii)
- {
- if (sii->value == value)
- {
- return sii->name;
- }
- }
- return STRINGIZE("UNTRUSTED_" << value);
+ for (symbol_info *sii(symbols), *siend(symbols + (sizeof(symbols)/sizeof(symbols[0])));
+ sii != siend; ++sii)
+ {
+ if (sii->value == value)
+ {
+ return sii->name;
+ }
+ }
+ return STRINGIZE("UNTRUSTED_" << value);
}
diff --git a/indra/newview/llcommandhandler.h b/indra/newview/llcommandhandler.h
index 1a354b04f7..7ec19d6538 100644
--- a/indra/newview/llcommandhandler.h
+++ b/indra/newview/llcommandhandler.h
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,18 +37,18 @@ class LLFooHandler : public LLCommandHandler
{
public:
// Inform the system you handle commands starting
- // with "foo" and they are only allowed from
- // "trusted" (pointed at Linden content) browsers
- LLFooHandler() : LLCommandHandler("foo", UNTRUSTED_BLOCK) { }
+ // with "foo" and they are only allowed from
+ // "trusted" (pointed at Linden content) browsers
+ LLFooHandler() : LLCommandHandler("foo", UNTRUSTED_BLOCK) { }
// Your code here
- bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid,
- LLMediaCtrl* web)
- {
- if (tokens.size() < 1) return false;
- LLUUID id( tokens[0] );
- return do_foo(id);
- }
+ bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid,
+ LLMediaCtrl* web)
+ {
+ if (tokens.size() < 1) return false;
+ LLUUID id( tokens[0] );
+ return do_foo(id);
+ }
};
// *NOTE: Creating the object registers with the dispatcher.
@@ -61,25 +61,25 @@ class LLMediaCtrl;
class LLCommandHandler
{
public:
- enum EUntrustedAccess
- {
- UNTRUSTED_ALLOW, // allow commands from untrusted browsers
- UNTRUSTED_BLOCK, // ignore commands from untrusted browsers
+ enum EUntrustedAccess
+ {
+ UNTRUSTED_ALLOW, // allow commands from untrusted browsers
+ UNTRUSTED_BLOCK, // ignore commands from untrusted browsers
UNTRUSTED_CLICK_ONLY, // allow untrusted, but only if clicked
- UNTRUSTED_THROTTLE // allow untrusted, but only a few per min.
- };
+ UNTRUSTED_THROTTLE // allow untrusted, but only a few per min.
+ };
static const std::string NAV_TYPE_CLICKED;
static const std::string NAV_TYPE_EXTERNAL;
static const std::string NAV_TYPE_NAVIGATED;
- LLCommandHandler(const char* command, EUntrustedAccess untrusted_access);
- // Automatically registers object to get called when
- // command is executed. All commands can be processed
- // in links from LLMediaCtrl, but some (like teleport)
- // should not be allowed from outside the app.
-
- virtual ~LLCommandHandler();
+ LLCommandHandler(const char* command, EUntrustedAccess untrusted_access);
+ // Automatically registers object to get called when
+ // command is executed. All commands can be processed
+ // in links from LLMediaCtrl, but some (like teleport)
+ // should not be allowed from outside the app.
+
+ virtual ~LLCommandHandler();
virtual bool canHandleUntrusted(
const LLSD& params,
@@ -88,35 +88,35 @@ public:
const std::string& nav_type)
{ return true; }
- virtual bool handle(const LLSD& params,
- const LLSD& query_map,
- const std::string& grid,
- LLMediaCtrl* web) = 0;
- // For URL secondlife:///app/foo/bar/baz?cat=1&dog=2
- // @params - array of "bar", "baz", possibly empty
- // @query_map - map of "cat" -> 1, "dog" -> 2, possibly empty
- // @web - pointer to web browser control, possibly NULL
- // Return true if you did something, false if the parameters
- // are invalid or on error.
+ virtual bool handle(const LLSD& params,
+ const LLSD& query_map,
+ const std::string& grid,
+ LLMediaCtrl* web) = 0;
+ // For URL secondlife:///app/foo/bar/baz?cat=1&dog=2
+ // @params - array of "bar", "baz", possibly empty
+ // @query_map - map of "cat" -> 1, "dog" -> 2, possibly empty
+ // @web - pointer to web browser control, possibly NULL
+ // Return true if you did something, false if the parameters
+ // are invalid or on error.
};
class LLCommandDispatcher
{
public:
- static bool dispatch(const std::string& cmd,
- const LLSD& params,
- const LLSD& query_map,
- const std::string& grid,
- LLMediaCtrl* web,
- const std::string& nav_type,
- bool trusted_browser);
- // Execute a command registered via the above mechanism,
- // passing string parameters.
- // Returns true if command was found and executed correctly.
- /// Return an LLSD::Map of registered LLCommandHandlers and associated
- /// info (e.g. EUntrustedAccess).
- static LLSD enumerate();
+ static bool dispatch(const std::string& cmd,
+ const LLSD& params,
+ const LLSD& query_map,
+ const std::string& grid,
+ LLMediaCtrl* web,
+ const std::string& nav_type,
+ bool trusted_browser);
+ // Execute a command registered via the above mechanism,
+ // passing string parameters.
+ // Returns true if command was found and executed correctly.
+ /// Return an LLSD::Map of registered LLCommandHandlers and associated
+ /// info (e.g. EUntrustedAccess).
+ static LLSD enumerate();
};
#endif
diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp
index 06d959ba3c..2ada35aa60 100644
--- a/indra/newview/llcommandlineparser.cpp
+++ b/indra/newview/llcommandlineparser.cpp
@@ -5,30 +5,30 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#include "llviewerprecompiledheaders.h"
#include "llcommandlineparser.h"
#include "llexception.h"
-// *NOTE: The boost::lexical_cast generates
+// *NOTE: The boost::lexical_cast generates
// the warning C4701(local used with out assignment) in VC7.1.
// Disable the warning for the boost includes.
#if _MSC_VER
@@ -63,14 +63,14 @@
namespace po = boost::program_options;
// *NOTE:MEP - Currently the boost object reside in file scope.
-// This has a couple of negatives, they are always around and
-// there can be only one instance of each.
-// The plus is that the boost-ly-ness of this implementation is
-// hidden from the rest of the world.
-// Its importatnt to realize that multiple LLCommandLineParser objects
+// This has a couple of negatives, they are always around and
+// there can be only one instance of each.
+// The plus is that the boost-ly-ness of this implementation is
+// hidden from the rest of the world.
+// Its importatnt to realize that multiple LLCommandLineParser objects
// will all have this single repository of option escs and parsed options.
// This could be good or bad, and probably won't matter for most use cases.
-namespace
+namespace
{
// List of command-line switches that can't map-to settings variables.
// Going forward, we want every new command-line switch to map-to some
@@ -86,15 +86,15 @@ namespace
po::options_description gOptionsDesc;
po::positional_options_description gPositionalOptions;
- po::variables_map gVariableMap;
+ po::variables_map gVariableMap;
const LLCommandLineParser::token_vector_t gEmptyValue;
void read_file_into_string(std::string& str, const std::basic_istream < char >& file)
{
- std::ostringstream oss;
- oss << file.rdbuf();
- str = oss.str();
+ std::ostringstream oss;
+ oss << file.rdbuf();
+ str = oss.str();
}
bool gPastLastOption = false;
@@ -110,7 +110,7 @@ public:
LLCLPLastOption(const std::string& what) : LLException(what) {}
};
-class LLCLPValue : public po::value_semantic_codecvt_helper<char>
+class LLCLPValue : public po::value_semantic_codecvt_helper<char>
{
unsigned mMinTokens;
unsigned mMaxTokens;
@@ -126,15 +126,15 @@ public:
mIsComposing(false),
mLastOption(false)
{}
-
+
virtual ~LLCLPValue() {};
- void setMinTokens(unsigned c)
+ void setMinTokens(unsigned c)
{
mMinTokens = c;
}
- void setMaxTokens(unsigned c)
+ void setMaxTokens(unsigned c)
{
mMaxTokens = c;
}
@@ -155,11 +155,11 @@ public:
}
// Overrides to support the value_semantic interface.
- virtual std::string name() const
- {
+ virtual std::string name() const
+ {
const std::string arg("arg");
const std::string args("args");
- return (max_tokens() > 1) ? args : arg;
+ return (max_tokens() > 1) ? args : arg;
}
virtual unsigned min_tokens() const
@@ -167,21 +167,21 @@ public:
return mMinTokens;
}
- virtual unsigned max_tokens() const
+ virtual unsigned max_tokens() const
{
return mMaxTokens;
}
- virtual bool is_composing() const
+ virtual bool is_composing() const
{
return mIsComposing;
}
- // Needed for boost 1.42
- virtual bool is_required() const
- {
- return false; // All our command line options are optional.
- }
+ // Needed for boost 1.42
+ virtual bool is_required() const
+ {
+ return false; // All our command line options are optional.
+ }
virtual bool apply_default(boost::any& value_store) const
{
@@ -192,7 +192,7 @@ public:
{
const LLCommandLineParser::token_vector_t* value =
boost::any_cast<const LLCommandLineParser::token_vector_t>(&value_store);
- if(mNotifyCallback)
+ if(mNotifyCallback)
{
mNotifyCallback(*value);
}
@@ -208,7 +208,7 @@ protected:
}
// Error checks. Needed?
- if (!value_store.empty() && !is_composing())
+ if (!value_store.empty() && !is_composing())
{
LLTHROW(LLCLPError("Non composing value with multiple occurences."));
}
@@ -216,14 +216,14 @@ protected:
{
LLTHROW(LLCLPError("Illegal number of tokens specified."));
}
-
+
if(value_store.empty())
{
value_store = boost::any(LLCommandLineParser::token_vector_t());
}
- LLCommandLineParser::token_vector_t* tv =
- boost::any_cast<LLCommandLineParser::token_vector_t>(&value_store);
-
+ LLCommandLineParser::token_vector_t* tv =
+ boost::any_cast<LLCommandLineParser::token_vector_t>(&value_store);
+
for(unsigned i = 0; i < new_tokens.size() && i < mMaxTokens; ++i)
{
tv->push_back(new_tokens[i]);
@@ -239,7 +239,7 @@ protected:
//----------------------------------------------------------------------------
// LLCommandLineParser defintions
//----------------------------------------------------------------------------
-void LLCommandLineParser::addOptionDesc(const std::string& option_name,
+void LLCommandLineParser::addOptionDesc(const std::string& option_name,
boost::function1<void, const token_vector_t&> notify_callback,
unsigned int token_count,
const std::string& description,
@@ -248,7 +248,7 @@ void LLCommandLineParser::addOptionDesc(const std::string& option_name,
bool positional,
bool last_option)
{
- // Compose the name for boost::po.
+ // Compose the name for boost::po.
// It takes the format "long_name, short name"
const std::string comma(",");
std::string boost_option_name = option_name;
@@ -257,7 +257,7 @@ void LLCommandLineParser::addOptionDesc(const std::string& option_name,
boost_option_name += comma;
boost_option_name += short_name;
}
-
+
LLCLPValue* value_desc = new LLCLPValue();
value_desc->setMinTokens(token_count);
value_desc->setMaxTokens(token_count);
@@ -265,8 +265,8 @@ void LLCommandLineParser::addOptionDesc(const std::string& option_name,
value_desc->setLastOption(last_option);
boost::shared_ptr<po::option_description> d(
- new po::option_description(boost_option_name.c_str(),
- value_desc,
+ new po::option_description(boost_option_name.c_str(),
+ value_desc,
description.c_str()));
if(!notify_callback.empty())
@@ -288,43 +288,43 @@ bool LLCommandLineParser::parseAndStoreResults(po::command_line_parser& clp)
{
clp.options(gOptionsDesc);
clp.positional(gPositionalOptions);
- // SNOW-626: Boost 1.42 erroneously added allow_guessing to the default style
- // (see http://groups.google.com/group/boost-list/browse_thread/thread/545d7bf98ff9bb16?fwc=2&pli=1)
- // Remove allow_guessing from the default style, because that is not allowed
- // when we have options that are a prefix of other options (aka, --help and --helperuri).
+ // SNOW-626: Boost 1.42 erroneously added allow_guessing to the default style
+ // (see http://groups.google.com/group/boost-list/browse_thread/thread/545d7bf98ff9bb16?fwc=2&pli=1)
+ // Remove allow_guessing from the default style, because that is not allowed
+ // when we have options that are a prefix of other options (aka, --help and --helperuri).
clp.style((po::command_line_style::default_style & ~po::command_line_style::allow_guessing)
| po::command_line_style::allow_long_disguise);
- if(mExtraParser)
- {
- clp.extra_parser(mExtraParser);
- }
-
+ if(mExtraParser)
+ {
+ clp.extra_parser(mExtraParser);
+ }
+
po::basic_parsed_options<char> opts = clp.run();
po::store(opts, gVariableMap);
}
catch(po::error& e)
{
LL_WARNS() << "Caught Error:" << e.what() << LL_ENDL;
- mErrorMsg = e.what();
+ mErrorMsg = e.what();
return false;
}
catch(LLCLPError& e)
{
LL_WARNS() << "Caught Error:" << e.what() << LL_ENDL;
- mErrorMsg = e.what();
+ mErrorMsg = e.what();
return false;
}
- catch(LLCLPLastOption&)
+ catch(LLCLPLastOption&)
{
- // This exception means a token was read after an option
- // that must be the last option was reached (see url and slurl options)
+ // This exception means a token was read after an option
+ // that must be the last option was reached (see url and slurl options)
- // boost::po will have stored a malformed option.
+ // boost::po will have stored a malformed option.
// All such options will be removed below.
- // The last option read, the last_option option, and its value
- // are put into the error message.
- std::string last_option;
- std::string last_value;
+ // The last option read, the last_option option, and its value
+ // are put into the error message.
+ std::string last_option;
+ std::string last_value;
for(po::variables_map::iterator i = gVariableMap.begin(); i != gVariableMap.end();)
{
po::variables_map::iterator tempI = i++;
@@ -332,28 +332,28 @@ bool LLCommandLineParser::parseAndStoreResults(po::command_line_parser& clp)
{
gVariableMap.erase(tempI);
}
- else
- {
- last_option = tempI->first;
- LLCommandLineParser::token_vector_t* tv =
- boost::any_cast<LLCommandLineParser::token_vector_t>(&(tempI->second.value()));
- if(!tv->empty())
- {
- last_value = (*tv)[tv->size()-1];
- }
- }
+ else
+ {
+ last_option = tempI->first;
+ LLCommandLineParser::token_vector_t* tv =
+ boost::any_cast<LLCommandLineParser::token_vector_t>(&(tempI->second.value()));
+ if(!tv->empty())
+ {
+ last_value = (*tv)[tv->size()-1];
+ }
+ }
}
- // Continue without parsing.
- std::ostringstream msg;
- msg << "Caught Error: Found options after last option: "
- << last_option << " "
- << last_value;
+ // Continue without parsing.
+ std::ostringstream msg;
+ msg << "Caught Error: Found options after last option: "
+ << last_option << " "
+ << last_value;
LL_WARNS() << msg.str() << LL_ENDL;
- mErrorMsg = msg.str();
+ mErrorMsg = msg.str();
return false;
- }
+ }
return true;
}
@@ -429,7 +429,7 @@ bool LLCommandLineParser::parseCommandLineString(const std::string& str)
po::command_line_parser clp(tokens);
return parseAndStoreResults(clp);
-
+
}
bool LLCommandLineParser::parseCommandLineFile(const std::basic_istream < char >& file)
@@ -508,7 +508,7 @@ onevalue(const std::string& option,
else if (value.size() > 1)
{
LL_WARNS() << "Ignoring extra tokens specified for --"
- << option << "." << LL_ENDL;
+ << option << "." << LL_ENDL;
}
return value[0];
}
@@ -543,8 +543,8 @@ T convertTo(const std::string& option,
}
}
-void setControlValueCB(const LLCommandLineParser::token_vector_t& value,
- const std::string& option,
+void setControlValueCB(const LLCommandLineParser::token_vector_t& value,
+ const std::string& option,
LLControlVariable* ctrl)
{
// *FIX: Do semantic conversion here.
@@ -569,7 +569,7 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value,
{
// Only call onevalue() AFTER handling value.empty() case!
std::string token(onevalue(option, value));
-
+
// There's a token. check the string for true/false/1/0 etc.
BOOL result = false;
BOOL gotSet = LLStringUtil::convertToBOOL(token, result);
@@ -654,29 +654,29 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value,
void LLControlGroupCLP::configure(const std::string& config_filename, LLControlGroup* controlGroup)
{
- // This method reads the llsd based config file, and uses it to set
+ // This method reads the llsd based config file, and uses it to set
// members of a control group.
LLSD clpConfigLLSD;
-
+
llifstream input_stream;
input_stream.open(config_filename.c_str(), std::ios::in | std::ios::binary);
if(input_stream.is_open())
{
LLSDSerialize::fromXML(clpConfigLLSD, input_stream);
- for(LLSD::map_iterator option_itr = clpConfigLLSD.beginMap();
- option_itr != clpConfigLLSD.endMap();
+ for(LLSD::map_iterator option_itr = clpConfigLLSD.beginMap();
+ option_itr != clpConfigLLSD.endMap();
++option_itr)
{
LLSD::String long_name = option_itr->first;
LLSD option_params = option_itr->second;
-
+
std::string desc("n/a");
if(option_params.has("desc"))
{
desc = option_params["desc"].asString();
}
-
+
std::string short_name = LLStringUtil::null;
if(option_params.has("short"))
{
@@ -742,11 +742,11 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG
}
this->addOptionDesc(
- long_name,
+ long_name,
callback,
- token_count,
- desc,
- short_name,
+ token_count,
+ desc,
+ short_name,
composing,
positional,
last_option);
diff --git a/indra/newview/llcommandlineparser.h b/indra/newview/llcommandlineparser.h
index 71388b8217..5279d02c0a 100644
--- a/indra/newview/llcommandlineparser.h
+++ b/indra/newview/llcommandlineparser.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcommandlineparser.h
* @brief LLCommandLineParser class declaration
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,105 +29,105 @@
#include <boost/function/function1.hpp>
-// *NOTE:Mani The following is a forward decl of
+// *NOTE:Mani The following is a forward decl of
// boost::program_options::command_line_parser
// "yay" c++!
namespace boost
{
- namespace program_options
- {
- template <class charT> class basic_command_line_parser;
- typedef basic_command_line_parser<char> command_line_parser;
- }
+ namespace program_options
+ {
+ template <class charT> class basic_command_line_parser;
+ typedef basic_command_line_parser<char> command_line_parser;
+ }
}
-/**
+/**
* @class LLCommandLineParser
* @brief Handle defining and parsing the command line.
*/
class LLCommandLineParser
{
public:
- typedef std::vector< std::string > token_vector_t;
-
- /**
- * @brief Add a value-less option to the command line description.
- * @param option_name The long name of the cmd-line option.
- * @param description The text description of the option usage.
- */
- void addOptionDesc(
- const std::string& option_name,
- boost::function1<void, const token_vector_t&> notify_callback = 0,
- unsigned int num_tokens = 0,
- const std::string& description = LLStringUtil::null,
- const std::string& short_name = LLStringUtil::null,
- bool composing = false,
- bool positional = false,
- bool last_option = false);
-
- /**
- * @brief Parse the command line given by argc/argv.
- */
- bool parseCommandLine(int argc, char **argv);
-
- /**
- * @brief Parse the command line contained by the given file.
- */
- bool parseCommandLineString(const std::string& str);
-
- /**
- * @brief Parse the command line contained by the given file.
- */
- bool parseCommandLineFile(const std::basic_istream< char >& file);
-
- /**
- * @brief Call callbacks associated with option descriptions.
- *
- * Use this to handle the results of parsing.
- */
- bool notify();
-
- /** @brief Print a description of the configured options.
- *
- * Use this to print a description of options to the
- * given ostream. Useful for displaying usage info.
- */
- std::ostream& printOptionsDesc(std::ostream& os) const;
-
- /** @brief Manual option setting accessors.
- *
- * Use these to retrieve get the values set for an option.
- * getOption will return an empty value if the option isn't
- * set.
- */
- bool hasOption(const std::string& name) const;
- const token_vector_t& getOption(const std::string& name) const;
-
- /** @brief Print the list of configured options.
- */
- void printOptions() const;
-
- /** @bried Get the error message, if it exists.
- */
- const std::string& getErrorMessage() const { return mErrorMsg; }
-
- /** @brief Add a custom parser func to the parser.
- *
- * Use this method to add a custom parser for parsing values
- * the the simple parser may not handle.
- * it will be applied to each parameter before the
- * default parser gets a chance.
- * The parser_func takes an input string, and should return a
- * name/value pair as the result.
- */
- typedef boost::function1<std::pair<std::string, std::string>, const std::string&> parser_func;
- void setCustomParser(parser_func f) { mExtraParser = f; }
-
+ typedef std::vector< std::string > token_vector_t;
+
+ /**
+ * @brief Add a value-less option to the command line description.
+ * @param option_name The long name of the cmd-line option.
+ * @param description The text description of the option usage.
+ */
+ void addOptionDesc(
+ const std::string& option_name,
+ boost::function1<void, const token_vector_t&> notify_callback = 0,
+ unsigned int num_tokens = 0,
+ const std::string& description = LLStringUtil::null,
+ const std::string& short_name = LLStringUtil::null,
+ bool composing = false,
+ bool positional = false,
+ bool last_option = false);
+
+ /**
+ * @brief Parse the command line given by argc/argv.
+ */
+ bool parseCommandLine(int argc, char **argv);
+
+ /**
+ * @brief Parse the command line contained by the given file.
+ */
+ bool parseCommandLineString(const std::string& str);
+
+ /**
+ * @brief Parse the command line contained by the given file.
+ */
+ bool parseCommandLineFile(const std::basic_istream< char >& file);
+
+ /**
+ * @brief Call callbacks associated with option descriptions.
+ *
+ * Use this to handle the results of parsing.
+ */
+ bool notify();
+
+ /** @brief Print a description of the configured options.
+ *
+ * Use this to print a description of options to the
+ * given ostream. Useful for displaying usage info.
+ */
+ std::ostream& printOptionsDesc(std::ostream& os) const;
+
+ /** @brief Manual option setting accessors.
+ *
+ * Use these to retrieve get the values set for an option.
+ * getOption will return an empty value if the option isn't
+ * set.
+ */
+ bool hasOption(const std::string& name) const;
+ const token_vector_t& getOption(const std::string& name) const;
+
+ /** @brief Print the list of configured options.
+ */
+ void printOptions() const;
+
+ /** @bried Get the error message, if it exists.
+ */
+ const std::string& getErrorMessage() const { return mErrorMsg; }
+
+ /** @brief Add a custom parser func to the parser.
+ *
+ * Use this method to add a custom parser for parsing values
+ * the the simple parser may not handle.
+ * it will be applied to each parameter before the
+ * default parser gets a chance.
+ * The parser_func takes an input string, and should return a
+ * name/value pair as the result.
+ */
+ typedef boost::function1<std::pair<std::string, std::string>, const std::string&> parser_func;
+ void setCustomParser(parser_func f) { mExtraParser = f; }
+
private:
- bool parseAndStoreResults(boost::program_options::command_line_parser& clp);
- std::string mErrorMsg;
- parser_func mExtraParser;
+ bool parseAndStoreResults(boost::program_options::command_line_parser& clp);
+ std::string mErrorMsg;
+ parser_func mExtraParser;
};
inline std::ostream& operator<<(std::ostream& out, const LLCommandLineParser& clp)
@@ -135,27 +135,27 @@ inline std::ostream& operator<<(std::ostream& out, const LLCommandLineParser& cl
return clp.printOptionsDesc(out);
}
-class LLControlGroup;
+class LLControlGroup;
-/**
+/**
* @class LLControlGroupCLP
* @brief Uses the CLP to configure an LLControlGroup
*
- *
+ *
*/
class LLControlGroupCLP : public LLCommandLineParser
{
public:
- /**
- * @brief Configure the command line parser according the given config file.
- *
- * @param config_filename The name of the XML based LLSD config file.
- * @param clp A reference to the command line parser object to configure.
- *
- * *FIX:Mani Specify config file format.
- */
- void configure(const std::string& config_filename,
- LLControlGroup* controlGroup);
+ /**
+ * @brief Configure the command line parser according the given config file.
+ *
+ * @param config_filename The name of the XML based LLSD config file.
+ * @param clp A reference to the command line parser object to configure.
+ *
+ * *FIX:Mani Specify config file format.
+ */
+ void configure(const std::string& config_filename,
+ LLControlGroup* controlGroup);
};
#endif // LL_LLCOMMANDLINEPARSER_H
diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp
index cf98b56b4c..074d60d879 100644
--- a/indra/newview/llcommunicationchannel.cpp
+++ b/indra/newview/llcommunicationchannel.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llcommunicationchannel.cpp
* @brief Implementation of llcommunicationchannel
* @author Stinson@lindenlab.com
@@ -38,8 +38,8 @@
LLCommunicationChannel::LLCommunicationChannel(const std::string& pName, const std::string& pParentName)
- : LLNotificationChannel(pName, pParentName, filterByDoNotDisturbStatus)
- , mHistory()
+ : LLNotificationChannel(pName, pParentName, filterByDoNotDisturbStatus)
+ , mHistory()
{
}
@@ -49,7 +49,7 @@ LLCommunicationChannel::~LLCommunicationChannel()
bool LLCommunicationChannel::filterByDoNotDisturbStatus(LLNotificationPtr)
{
- return !gAgent.isDoNotDisturb();
+ return !gAgent.isDoNotDisturb();
}
S32 LLCommunicationChannel::getHistorySize() const
@@ -59,12 +59,12 @@ S32 LLCommunicationChannel::getHistorySize() const
LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::beginHistory() const
{
- return mHistory.begin();
+ return mHistory.begin();
}
LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::endHistory() const
{
- return mHistory.end();
+ return mHistory.end();
}
LLCommunicationChannel::history_list_t::iterator LLCommunicationChannel::beginHistory()
@@ -79,7 +79,7 @@ LLCommunicationChannel::history_list_t::iterator LLCommunicationChannel::endHist
void LLCommunicationChannel::clearHistory()
{
- mHistory.clear();
+ mHistory.clear();
}
void LLCommunicationChannel::removeItemFromHistory(LLNotificationPtr p)
@@ -95,19 +95,19 @@ void LLCommunicationChannel::removeItemFromHistory(LLNotificationPtr p)
}
}
-void LLCommunicationChannel::onDelete(LLNotificationPtr p)
+void LLCommunicationChannel::onDelete(LLNotificationPtr p)
{
removeItemFromHistory(p);
}
void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr)
{
- std::string notificationType = pNotificationPtr->getType();
- if (((notificationType == "groupnotify")
- || (notificationType == "offer")
- || (notificationType == "notifytoast"))
+ std::string notificationType = pNotificationPtr->getType();
+ if (((notificationType == "groupnotify")
+ || (notificationType == "offer")
+ || (notificationType == "notifytoast"))
&& !pNotificationPtr->isCancelled())
- {
- mHistory.insert(history_list_t::value_type(pNotificationPtr->getDate(), pNotificationPtr));
- }
+ {
+ mHistory.insert(history_list_t::value_type(pNotificationPtr->getDate(), pNotificationPtr));
+ }
}
diff --git a/indra/newview/llcommunicationchannel.h b/indra/newview/llcommunicationchannel.h
index 0d8f7f4387..f601de1dc4 100644
--- a/indra/newview/llcommunicationchannel.h
+++ b/indra/newview/llcommunicationchannel.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llcommunicationchannel.h
* @brief Header file for llcommunicationchannel
* @author Stinson@lindenlab.com
@@ -36,30 +36,30 @@
class LLCommunicationChannel : public LLNotificationChannel
{
- LOG_CLASS(LLCommunicationChannel);
+ LOG_CLASS(LLCommunicationChannel);
public:
- LLCommunicationChannel(const std::string& pName, const std::string& pParentName);
- virtual ~LLCommunicationChannel();
+ LLCommunicationChannel(const std::string& pName, const std::string& pParentName);
+ virtual ~LLCommunicationChannel();
- static bool filterByDoNotDisturbStatus(LLNotificationPtr);
+ static bool filterByDoNotDisturbStatus(LLNotificationPtr);
- typedef std::multimap<LLDate, LLNotificationPtr> history_list_t;
- S32 getHistorySize() const;
- history_list_t::const_iterator beginHistory() const;
- history_list_t::const_iterator endHistory() const;
+ typedef std::multimap<LLDate, LLNotificationPtr> history_list_t;
+ S32 getHistorySize() const;
+ history_list_t::const_iterator beginHistory() const;
+ history_list_t::const_iterator endHistory() const;
history_list_t::iterator beginHistory();
- history_list_t::iterator endHistory();
+ history_list_t::iterator endHistory();
- void clearHistory();
+ void clearHistory();
void removeItemFromHistory(LLNotificationPtr p);
protected:
virtual void onDelete(LLNotificationPtr p);
- virtual void onFilterFail(LLNotificationPtr pNotificationPtr);
+ virtual void onFilterFail(LLNotificationPtr pNotificationPtr);
private:
- history_list_t mHistory;
+ history_list_t mHistory;
};
#endif // LL_LLCOMMUNICATIONCHANNEL_H
diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp
index b11786a451..eebef4cc1c 100644
--- a/indra/newview/llcompilequeue.cpp
+++ b/indra/newview/llcompilequeue.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcompilequeue.cpp
* @brief LLCompileQueueData class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
/**
*
* Implementation of the script queue which keeps an array of object
- * UUIDs and manipulates all of the scripts on each of them.
+ * UUIDs and manipulates all of the scripts on each of them.
*
*/
@@ -67,8 +67,8 @@ namespace
const std::string QUEUE_EVENTPUMP_NAME("ScriptActionQueue");
- // ObjectIventoryFetcher is an adapter between the LLVOInventoryListener::inventoryChanged
- // callback mechanism and the LLEventPump coroutine architecture allowing the
+ // ObjectIventoryFetcher is an adapter between the LLVOInventoryListener::inventoryChanged
+ // callback mechanism and the LLEventPump coroutine architecture allowing the
// coroutine to wait for the inventory event.
class ObjectInventoryFetcher: public LLVOInventoryListener
{
@@ -87,7 +87,7 @@ namespace
S32 serial_num,
void* user_data);
- void fetchInventory()
+ void fetchInventory()
{
requestVOInventory();
}
@@ -115,15 +115,15 @@ namespace
}
-// *NOTE$: A minor specialization of LLScriptAssetUpload, it does not require a buffer
-// (and does not save a buffer to the cache) and it finds the compile queue window and
+// *NOTE$: A minor specialization of LLScriptAssetUpload, it does not require a buffer
+// (and does not save a buffer to the cache) and it finds the compile queue window and
// displays a compiling message.
class LLQueuedScriptAssetUpload : public LLScriptAssetUpload
{
public:
LLQueuedScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLUUID assetId, TargetType_t targetType,
bool isRunning, std::string scriptName, LLUUID queueId, LLUUID exerienceId, taskUploadFinish_f finish) :
- LLScriptAssetUpload(taskId, itemId, targetType, isRunning,
+ LLScriptAssetUpload(taskId, itemId, targetType, isRunning,
exerienceId, std::string(), finish, nullptr),
mScriptName(scriptName),
mQueueId(queueId)
@@ -133,8 +133,8 @@ public:
virtual LLSD prepareUpload()
{
- /* *NOTE$: The parent class (LLScriptAssetUpload will attempt to save
- * the script buffer into to the cache. Since the resource is already in
+ /* *NOTE$: The parent class (LLScriptAssetUpload will attempt to save
+ * the script buffer into to the cache. Since the resource is already in
* the cache we don't want to do that. Just put a compiling message in
* the window and move on
*/
@@ -165,14 +165,14 @@ private:
struct LLScriptQueueData
{
- LLUUID mQueueID;
- LLUUID mTaskId;
- LLPointer<LLInventoryItem> mItem;
- LLHost mHost;
- LLUUID mExperienceId;
- std::string mExperiencename;
- LLScriptQueueData(const LLUUID& q_id, const LLUUID& task_id, LLInventoryItem* item) :
- mQueueID(q_id), mTaskId(task_id), mItem(new LLInventoryItem(item)) {}
+ LLUUID mQueueID;
+ LLUUID mTaskId;
+ LLPointer<LLInventoryItem> mItem;
+ LLHost mHost;
+ LLUUID mExperienceId;
+ std::string mExperiencename;
+ LLScriptQueueData(const LLUUID& q_id, const LLUUID& task_id, LLInventoryItem* item) :
+ mQueueID(q_id), mTaskId(task_id), mItem(new LLInventoryItem(item)) {}
};
@@ -182,11 +182,11 @@ struct LLScriptQueueData
// Default constructor
LLFloaterScriptQueue::LLFloaterScriptQueue(const LLSD& key) :
- LLFloater(key),
- mDone(false),
- mMono(false)
+ LLFloater(key),
+ mDone(false),
+ mMono(false)
{
-
+
}
// Destroys the object
@@ -196,17 +196,17 @@ LLFloaterScriptQueue::~LLFloaterScriptQueue()
BOOL LLFloaterScriptQueue::postBuild()
{
- childSetAction("close",onCloseBtn,this);
- getChildView("close")->setEnabled(FALSE);
- setVisible(true);
- return TRUE;
+ childSetAction("close",onCloseBtn,this);
+ getChildView("close")->setEnabled(FALSE);
+ setVisible(true);
+ return TRUE;
}
// static
void LLFloaterScriptQueue::onCloseBtn(void* user_data)
{
- LLFloaterScriptQueue* self = (LLFloaterScriptQueue*)user_data;
- self->closeFloater();
+ LLFloaterScriptQueue* self = (LLFloaterScriptQueue*)user_data;
+ self->closeFloater();
}
void LLFloaterScriptQueue::addObject(const LLUUID& id, std::string name)
@@ -217,16 +217,16 @@ void LLFloaterScriptQueue::addObject(const LLUUID& id, std::string name)
BOOL LLFloaterScriptQueue::start()
{
- std::string buffer;
+ std::string buffer;
- LLStringUtil::format_map_t args;
- args["[START]"] = mStartString;
- args["[COUNT]"] = llformat ("%d", mObjectList.size());
- buffer = getString ("Starting", args);
-
- getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM);
+ LLStringUtil::format_map_t args;
+ args["[START]"] = mStartString;
+ args["[COUNT]"] = llformat ("%d", mObjectList.size());
+ buffer = getString ("Starting", args);
- return startQueue();
+ getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM);
+
+ return startQueue();
}
void LLFloaterScriptQueue::addProcessingMessage(const std::string &message, const LLSD &args)
@@ -244,7 +244,7 @@ void LLFloaterScriptQueue::addStringMessage(const std::string &message)
BOOL LLFloaterScriptQueue::isDone() const
{
- return (mCurrentObjectID.isNull() && (mObjectList.size() == 0));
+ return (mCurrentObjectID.isNull() && (mObjectList.size() == 0));
}
///----------------------------------------------------------------------------
@@ -253,29 +253,29 @@ BOOL LLFloaterScriptQueue::isDone() const
LLFloaterCompileQueue::LLFloaterCompileQueue(const LLSD& key)
: LLFloaterScriptQueue(key)
{
- setTitle(LLTrans::getString("CompileQueueTitle"));
- setStartString(LLTrans::getString("CompileQueueStart"));
-
+ setTitle(LLTrans::getString("CompileQueueTitle"));
+ setStartString(LLTrans::getString("CompileQueueStart"));
+
}
LLFloaterCompileQueue::~LLFloaterCompileQueue()
-{
+{
}
void LLFloaterCompileQueue::experienceIdsReceived( const LLSD& content )
{
- for(LLSD::array_const_iterator it = content.beginArray(); it != content.endArray(); ++it)
- {
- mExperienceIds.insert(it->asUUID());
- }
+ for(LLSD::array_const_iterator it = content.beginArray(); it != content.endArray(); ++it)
+ {
+ mExperienceIds.insert(it->asUUID());
+ }
}
BOOL LLFloaterCompileQueue::hasExperience( const LLUUID& id ) const
{
- return mExperienceIds.find(id) != mExperienceIds.end();
+ return mExperienceIds.find(id) != mExperienceIds.end();
}
-// //Attempt to record this asset ID. If it can not be inserted into the set
+// //Attempt to record this asset ID. If it can not be inserted into the set
// //then it has already been processed so return false.
void LLFloaterCompileQueue::handleHTTPResponse(std::string pumpName, const LLSD &expresult)
@@ -284,10 +284,10 @@ void LLFloaterCompileQueue::handleHTTPResponse(std::string pumpName, const LLSD
}
// *TODO: handleSCriptRetrieval is passed into the cache via a legacy C function pointer
-// future project would be to convert these to C++ callables (std::function<>) so that
+// future project would be to convert these to C++ callables (std::function<>) so that
// we can use bind and remove the userData parameter.
-//
-void LLFloaterCompileQueue::handleScriptRetrieval(const LLUUID& assetId,
+//
+void LLFloaterCompileQueue::handleScriptRetrieval(const LLUUID& assetId,
LLAssetType::EType type, void* userData, S32 status, LLExtStat extStatus)
{
LLSD result(LLSD::emptyMap());
@@ -296,7 +296,7 @@ void LLFloaterCompileQueue::handleScriptRetrieval(const LLUUID& assetId,
if (status)
{
result["error"] = status;
-
+
if (status == LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE)
{
result["message"] = LLTrans::getString("CompileQueueProblemDownloading") + (":");
@@ -404,7 +404,7 @@ bool LLFloaterCompileQueue::processScript(LLHandle<LLFloaterCompileQueue> hfloat
experienceId = result[LLExperienceCache::EXPERIENCE_ID].asUUID();
if (!floater->hasExperience(experienceId))
{
- floater->addProcessingMessage("CompileNoExperiencePerm",
+ floater->addProcessingMessage("CompileNoExperiencePerm",
LLSDMap("SCRIPT", inventory->getName())
("EXPERIENCE", result[LLExperienceCache::NAME].asString()));
return true;
@@ -468,14 +468,14 @@ bool LLFloaterCompileQueue::processScript(LLHandle<LLFloaterCompileQueue> hfloat
std::string url = object->getRegion()->getCapability("UpdateScriptTask");
{
- LLResourceUploadInfo::ptr_t uploadInfo(new LLQueuedScriptAssetUpload(object->getID(),
- inventory->getUUID(),
- assetId,
+ LLResourceUploadInfo::ptr_t uploadInfo(new LLQueuedScriptAssetUpload(object->getID(),
+ inventory->getUUID(),
+ assetId,
monocompile ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2,
- true,
- inventory->getName(),
- LLUUID(),
- experienceId,
+ true,
+ inventory->getName(),
+ LLUUID(),
+ experienceId,
boost::bind(&LLFloaterCompileQueue::handleHTTPResponse, pump.getName(), _4)));
LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo);
@@ -552,12 +552,12 @@ bool LLFloaterCompileQueue::startQueue()
LLFloaterResetQueue::LLFloaterResetQueue(const LLSD& key)
: LLFloaterScriptQueue(key)
{
- setTitle(LLTrans::getString("ResetQueueTitle"));
- setStartString(LLTrans::getString("ResetQueueStart"));
+ setTitle(LLTrans::getString("ResetQueueTitle"));
+ setStartString(LLTrans::getString("ResetQueueStart"));
}
LLFloaterResetQueue::~LLFloaterResetQueue()
-{
+{
}
/// This is a utility function to be bound and called from objectScriptProcessingQueueCoro.
@@ -572,7 +572,7 @@ bool LLFloaterResetQueue::resetObjectScripts(LLHandle<LLFloaterScriptQueue> hflo
std::string buffer;
buffer = floater->getString("Resetting") + (": ") + inventory->getName();
floater->addStringMessage(buffer);
-
+
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ScriptReset);
msg->nextBlockFast(_PREHASH_AgentData);
@@ -609,12 +609,12 @@ bool LLFloaterResetQueue::startQueue()
LLFloaterRunQueue::LLFloaterRunQueue(const LLSD& key)
: LLFloaterScriptQueue(key)
{
- setTitle(LLTrans::getString("RunQueueTitle"));
- setStartString(LLTrans::getString("RunQueueStart"));
+ setTitle(LLTrans::getString("RunQueueTitle"));
+ setStartString(LLTrans::getString("RunQueueStart"));
}
LLFloaterRunQueue::~LLFloaterRunQueue()
-{
+{
}
/// This is a utility function to be bound and called from objectScriptProcessingQueueCoro.
@@ -666,17 +666,17 @@ bool LLFloaterRunQueue::startQueue()
LLFloaterNotRunQueue::LLFloaterNotRunQueue(const LLSD& key)
: LLFloaterScriptQueue(key)
{
- setTitle(LLTrans::getString("NotRunQueueTitle"));
- setStartString(LLTrans::getString("NotRunQueueStart"));
+ setTitle(LLTrans::getString("NotRunQueueTitle"));
+ setStartString(LLTrans::getString("NotRunQueueStart"));
}
LLFloaterNotRunQueue::~LLFloaterNotRunQueue()
-{
+{
}
/// This is a utility function to be bound and called from objectScriptProcessingQueueCoro.
/// Do not call directly. It may throw a LLCheckedHandle<>::Stale exception.
-bool LLFloaterNotRunQueue::stopObjectScripts(LLHandle<LLFloaterScriptQueue> hfloater,
+bool LLFloaterNotRunQueue::stopObjectScripts(LLHandle<LLFloaterScriptQueue> hfloater,
const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump)
{
LLCheckedHandle<LLFloaterScriptQueue> floater(hfloater);
@@ -732,8 +732,8 @@ void LLFloaterScriptQueue::objectScriptProcessingQueueCoro(std::string action, L
object_data_list_t objectList, fnQueueAction_t func)
{
LLCoros::set_consuming(true);
- LLCheckedHandle<LLFloaterScriptQueue> floater(hfloater);
- // Dereferencing floater may fail. If they do they throw LLExeceptionStaleHandle.
+ LLCheckedHandle<LLFloaterScriptQueue> floater(hfloater);
+ // Dereferencing floater may fail. If they do they throw LLExeceptionStaleHandle.
// This is expected if the dialog closes.
LLEventMailDrop maildrop(QUEUE_EVENTPUMP_NAME, true);
F32 fetch_timeout = gSavedSettings.getF32("QueueInventoryFetchTimeout");
@@ -792,7 +792,7 @@ void LLFloaterScriptQueue::objectScriptProcessingQueueCoro(std::string action, L
{
floater.check();
- // note, we have a smart pointer to the obj above... but if we didn't we'd check that
+ // note, we have a smart pointer to the obj above... but if we didn't we'd check that
// it still exists here.
if (((*itInv)->getType() == LLAssetType::AT_LSL_TEXT))
@@ -822,7 +822,7 @@ void LLFloaterScriptQueue::objectScriptProcessingQueueCoro(std::string action, L
}
catch (LLCheckedHandleBase::Stale &)
{
- // This is expected. It means that floater has been closed before
+ // This is expected. It means that floater has been closed before
// processing was completed.
LL_DEBUGS("SCRIPTQ") << "LLExeceptionStaleHandle caught! Floater has most likely been closed." << LL_ENDL;
}
diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h
index a9bac345b5..ba5e27d75a 100644
--- a/indra/newview/llcompilequeue.h
+++ b/indra/newview/llcompilequeue.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcompilequeue.h
* @brief LLCompileQueue class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,53 +50,53 @@
class LLFloaterScriptQueue : public LLFloater/*, public LLVOInventoryListener*/
{
public:
- LLFloaterScriptQueue(const LLSD& key);
- virtual ~LLFloaterScriptQueue();
-
- /*virtual*/ BOOL postBuild();
-
- void setMono(bool mono) { mMono = mono; }
-
- // addObject() accepts an object id.
- void addObject(const LLUUID& id, std::string name);
-
- // start() returns TRUE if the queue has started, otherwise FALSE.
- BOOL start();
-
+ LLFloaterScriptQueue(const LLSD& key);
+ virtual ~LLFloaterScriptQueue();
+
+ /*virtual*/ BOOL postBuild();
+
+ void setMono(bool mono) { mMono = mono; }
+
+ // addObject() accepts an object id.
+ void addObject(const LLUUID& id, std::string name);
+
+ // start() returns TRUE if the queue has started, otherwise FALSE.
+ BOOL start();
+
void addProcessingMessage(const std::string &message, const LLSD &args);
void addStringMessage(const std::string &message);
std::string getStartString() const { return mStartString; }
protected:
- static void onCloseBtn(void* user_data);
+ static void onCloseBtn(void* user_data);
- // returns true if this is done
- BOOL isDone() const;
+ // returns true if this is done
+ BOOL isDone() const;
- virtual bool startQueue() = 0;
+ virtual bool startQueue() = 0;
- void setStartString(const std::string& s) { mStartString = s; }
+ void setStartString(const std::string& s) { mStartString = s; }
protected:
- // UI
- LLScrollListCtrl* mMessages;
- LLButton* mCloseBtn;
+ // UI
+ LLScrollListCtrl* mMessages;
+ LLButton* mCloseBtn;
- // Object Queue
- struct ObjectData
- {
- LLUUID mObjectId;
- std::string mObjectName;
- };
- typedef std::vector<ObjectData> object_data_list_t;
+ // Object Queue
+ struct ObjectData
+ {
+ LLUUID mObjectId;
+ std::string mObjectName;
+ };
+ typedef std::vector<ObjectData> object_data_list_t;
- object_data_list_t mObjectList;
- LLUUID mCurrentObjectID;
- bool mDone;
+ object_data_list_t mObjectList;
+ LLUUID mCurrentObjectID;
+ bool mDone;
- std::string mStartString;
- bool mMono;
+ std::string mStartString;
+ bool mMono;
typedef boost::function<bool(const LLPointer<LLViewerObject> &, LLInventoryObject*, LLEventPump &)> fnQueueAction_t;
static void objectScriptProcessingQueueCoro(std::string action, LLHandle<LLFloaterScriptQueue> hfloater, object_data_list_t objectList, fnQueueAction_t func);
@@ -111,25 +111,25 @@ protected:
struct LLCompileQueueData
{
- LLUUID mQueueID;
- LLUUID mItemId;
- LLCompileQueueData(const LLUUID& q_id, const LLUUID& item_id) :
- mQueueID(q_id), mItemId(item_id) {}
+ LLUUID mQueueID;
+ LLUUID mItemId;
+ LLCompileQueueData(const LLUUID& q_id, const LLUUID& item_id) :
+ mQueueID(q_id), mItemId(item_id) {}
};
class LLFloaterCompileQueue : public LLFloaterScriptQueue
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
-
- void experienceIdsReceived( const LLSD& content );
- BOOL hasExperience(const LLUUID& id)const;
+
+ void experienceIdsReceived( const LLSD& content );
+ BOOL hasExperience(const LLUUID& id)const;
protected:
- LLFloaterCompileQueue(const LLSD& key);
- virtual ~LLFloaterCompileQueue();
-
- virtual bool startQueue();
+ LLFloaterCompileQueue(const LLSD& key);
+ virtual ~LLFloaterCompileQueue();
+
+ virtual bool startQueue();
static bool processScript(LLHandle<LLFloaterCompileQueue> hfloater, const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump);
@@ -140,7 +140,7 @@ protected:
private:
static void processExperienceIdResults(LLSD result, LLUUID parent);
//uuid_list_t mAssetIds; // list of asset IDs processed.
- uuid_list_t mExperienceIds;
+ uuid_list_t mExperienceIds;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -151,11 +151,11 @@ private:
class LLFloaterResetQueue : public LLFloaterScriptQueue
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
protected:
- LLFloaterResetQueue(const LLSD& key);
- virtual ~LLFloaterResetQueue();
-
+ LLFloaterResetQueue(const LLSD& key);
+ virtual ~LLFloaterResetQueue();
+
static bool resetObjectScripts(LLHandle<LLFloaterScriptQueue> hfloater, const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump);
virtual bool startQueue();
@@ -169,10 +169,10 @@ protected:
class LLFloaterRunQueue : public LLFloaterScriptQueue
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
protected:
- LLFloaterRunQueue(const LLSD& key);
- virtual ~LLFloaterRunQueue();
+ LLFloaterRunQueue(const LLSD& key);
+ virtual ~LLFloaterRunQueue();
static bool runObjectScripts(LLHandle<LLFloaterScriptQueue> hfloater, const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump);
@@ -187,11 +187,11 @@ protected:
class LLFloaterNotRunQueue : public LLFloaterScriptQueue
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
protected:
- LLFloaterNotRunQueue(const LLSD& key);
- virtual ~LLFloaterNotRunQueue();
-
+ LLFloaterNotRunQueue(const LLSD& key);
+ virtual ~LLFloaterNotRunQueue();
+
static bool stopObjectScripts(LLHandle<LLFloaterScriptQueue> hfloater, const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump);
virtual bool startQueue();
diff --git a/indra/newview/llconfirmationmanager.cpp b/indra/newview/llconfirmationmanager.cpp
index 8ea59fdd83..e2735ff6bc 100644
--- a/indra/newview/llconfirmationmanager.cpp
+++ b/indra/newview/llconfirmationmanager.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llconfirmationmanager.cpp
* @brief LLConfirmationManager class implementation
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,71 +42,71 @@ LLConfirmationManager::ListenerBase::~ListenerBase()
static bool onConfirmAlert(const LLSD& notification, const LLSD& response, LLConfirmationManager::ListenerBase* listener)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- listener->confirmed("");
- }
-
- delete listener;
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ listener->confirmed("");
+ }
+
+ delete listener;
+ return false;
}
static bool onConfirmAlertPassword(const LLSD& notification, const LLSD& response, LLConfirmationManager::ListenerBase* listener)
{
- std::string text = response["message"].asString();
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- if (option == 0)
- {
- listener->confirmed(text);
- }
-
- delete listener;
- return false;
+ std::string text = response["message"].asString();
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ if (option == 0)
+ {
+ listener->confirmed(text);
+ }
+
+ delete listener;
+ return false;
}
-
+
void LLConfirmationManager::confirm(Type type,
- const std::string& action,
- ListenerBase* listener)
+ const std::string& action,
+ ListenerBase* listener)
{
- LLSD args;
- args["ACTION"] = action;
-
- switch (type)
- {
- case TYPE_CLICK:
- LLNotificationsUtil::add("ConfirmPurchase", args, LLSD(), boost::bind(onConfirmAlert, _1, _2, listener));
- break;
-
- case TYPE_PASSWORD:
- LLNotificationsUtil::add("ConfirmPurchasePassword", args, LLSD(), boost::bind(onConfirmAlertPassword, _1, _2, listener));
- break;
- case TYPE_NONE:
- default:
- listener->confirmed("");
- break;
- }
+ LLSD args;
+ args["ACTION"] = action;
+
+ switch (type)
+ {
+ case TYPE_CLICK:
+ LLNotificationsUtil::add("ConfirmPurchase", args, LLSD(), boost::bind(onConfirmAlert, _1, _2, listener));
+ break;
+
+ case TYPE_PASSWORD:
+ LLNotificationsUtil::add("ConfirmPurchasePassword", args, LLSD(), boost::bind(onConfirmAlertPassword, _1, _2, listener));
+ break;
+ case TYPE_NONE:
+ default:
+ listener->confirmed("");
+ break;
+ }
}
void LLConfirmationManager::confirm(
- const std::string& type,
- const std::string& action,
- ListenerBase* listener)
+ const std::string& type,
+ const std::string& action,
+ ListenerBase* listener)
{
- Type decodedType = TYPE_NONE;
-
- if (type == "click")
- {
- decodedType = TYPE_CLICK;
- }
- else if (type == "password")
- {
- decodedType = TYPE_PASSWORD;
- }
-
- confirm(decodedType, action, listener);
+ Type decodedType = TYPE_NONE;
+
+ if (type == "click")
+ {
+ decodedType = TYPE_CLICK;
+ }
+ else if (type == "password")
+ {
+ decodedType = TYPE_PASSWORD;
+ }
+
+ confirm(decodedType, action, listener);
}
diff --git a/indra/newview/llconfirmationmanager.h b/indra/newview/llconfirmationmanager.h
index d791a8b41a..10a72a5102 100644
--- a/indra/newview/llconfirmationmanager.h
+++ b/indra/newview/llconfirmationmanager.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llconfirmationmanager.h
* @brief LLConfirmationManager class definition
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,56 +30,56 @@
class LLConfirmationManager
{
public:
- class ListenerBase
- {
- public:
- virtual ~ListenerBase();
- virtual void confirmed(const std::string& password) = 0;
- };
+ class ListenerBase
+ {
+ public:
+ virtual ~ListenerBase();
+ virtual void confirmed(const std::string& password) = 0;
+ };
+
+ enum Type { TYPE_NONE, TYPE_CLICK, TYPE_PASSWORD };
+
+ static void confirm(Type type,
+ const std::string& purchase, ListenerBase* listener);
+ static void confirm(const std::string& type,
+ const std::string& purchase, ListenerBase* listener);
+ // note: these take control of, and delete the listener when done
+
+ template <class T>
+ class Listener : public ListenerBase
+ {
+ public:
+ typedef void (T::*ConfirmationMemberFunction)(const std::string&);
+
+ Listener(T& object, ConfirmationMemberFunction function)
+ : mObject(object), mFunction(function)
+ { }
+
+ void confirmed(const std::string& password)
+ {
+ (mObject.*mFunction)(password);
+ }
- enum Type { TYPE_NONE, TYPE_CLICK, TYPE_PASSWORD };
-
- static void confirm(Type type,
- const std::string& purchase, ListenerBase* listener);
- static void confirm(const std::string& type,
- const std::string& purchase, ListenerBase* listener);
- // note: these take control of, and delete the listener when done
+ private:
+ T& mObject;
+ ConfirmationMemberFunction mFunction;
+ };
- template <class T>
- class Listener : public ListenerBase
- {
- public:
- typedef void (T::*ConfirmationMemberFunction)(const std::string&);
-
- Listener(T& object, ConfirmationMemberFunction function)
- : mObject(object), mFunction(function)
- { }
-
- void confirmed(const std::string& password)
- {
- (mObject.*mFunction)(password);
- }
-
- private:
- T& mObject;
- ConfirmationMemberFunction mFunction;
- };
+ template <class T>
+ static void confirm(Type type,
+ const std::string& action,
+ T& obj, void(T::*func)(const std::string&))
+ {
+ confirm(type, action, new Listener<T>(obj, func));
+ }
- template <class T>
- static void confirm(Type type,
- const std::string& action,
- T& obj, void(T::*func)(const std::string&))
- {
- confirm(type, action, new Listener<T>(obj, func));
- }
-
- template <class T>
- static void confirm(const std::string& type,
- const std::string& action,
- T& obj, void(T::*func)(const std::string&))
- {
- confirm(type, action, new Listener<T>(obj, func));
- }
+ template <class T>
+ static void confirm(const std::string& type,
+ const std::string& action,
+ T& obj, void(T::*func)(const std::string&))
+ {
+ confirm(type, action, new Listener<T>(obj, func));
+ }
};
-#endif
+#endif
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index d764f64c79..d900730e98 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -49,7 +49,7 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer
mRootVolp(NULL),
mControlAVBridge(NULL),
mScaleConstraintFixup(1.0),
- mRegionChanged(false)
+ mRegionChanged(false)
{
mIsDummy = TRUE;
mIsControlAvatar = true;
@@ -59,42 +59,42 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer
// virtual
LLControlAvatar::~LLControlAvatar()
{
- // Should already have been unlinked before destruction
- llassert(!mRootVolp);
+ // Should already have been unlinked before destruction
+ llassert(!mRootVolp);
}
// virtual
void LLControlAvatar::initInstance()
{
- // Potential optimizations here: avoid creating system
- // avatar mesh content since it's not used. For now we just clean some
- // things up after the fact in releaseMeshData().
+ // Potential optimizations here: avoid creating system
+ // avatar mesh content since it's not used. For now we just clean some
+ // things up after the fact in releaseMeshData().
LLVOAvatar::initInstance();
- createDrawable(&gPipeline);
- updateJointLODs();
- updateGeometry(mDrawable);
- hideSkirt();
+ createDrawable(&gPipeline);
+ updateJointLODs();
+ updateGeometry(mDrawable);
+ hideSkirt();
mInitFlags |= 1<<4;
}
const LLVOAvatar *LLControlAvatar::getAttachedAvatar() const
{
- if (mRootVolp && mRootVolp->isAttachment())
- {
- return mRootVolp->getAvatarAncestor();
- }
- return NULL;
+ if (mRootVolp && mRootVolp->isAttachment())
+ {
+ return mRootVolp->getAvatarAncestor();
+ }
+ return NULL;
}
LLVOAvatar *LLControlAvatar::getAttachedAvatar()
{
- if (mRootVolp && mRootVolp->isAttachment())
- {
- return mRootVolp->getAvatarAncestor();
- }
- return NULL;
+ if (mRootVolp && mRootVolp->isAttachment())
+ {
+ return mRootVolp->getAvatarAncestor();
+ }
+ return NULL;
}
void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const
@@ -104,60 +104,60 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
{
max_legal_offset = gSavedSettings.getF32("AnimatedObjectsMaxLegalOffset");
}
- max_legal_offset = llmax(max_legal_offset,0.f);
+ max_legal_offset = llmax(max_legal_offset,0.f);
F32 max_legal_size = MAX_LEGAL_SIZE;
if (gSavedSettings.getControl("AnimatedObjectsMaxLegalSize"))
{
max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize");
}
- max_legal_size = llmax(max_legal_size, 1.f);
-
+ max_legal_size = llmax(max_legal_size, 1.f);
+
new_pos_fixup = LLVector3();
new_scale_fixup = 1.0f;
- LLVector3 vol_pos = mRootVolp->getRenderPosition();
+ LLVector3 vol_pos = mRootVolp->getRenderPosition();
// Fix up position if needed to prevent visual encroachment
if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down
{
- // The goal here is to ensure that the extent of the avatar's
+ // The goal here is to ensure that the extent of the avatar's
// bounding box does not wander too far from the
// official position of the corresponding volume. We
// do this by tracking the distance and applying a
// correction to the control avatar position if
// needed.
const LLVector3 *extents = getLastAnimExtents();
- LLVector3 unshift_extents[2];
- unshift_extents[0] = extents[0] - mPositionConstraintFixup;
- unshift_extents[1] = extents[1] - mPositionConstraintFixup;
+ LLVector3 unshift_extents[2];
+ unshift_extents[0] = extents[0] - mPositionConstraintFixup;
+ unshift_extents[1] = extents[1] - mPositionConstraintFixup;
LLVector3 box_dims = extents[1]-extents[0];
F32 box_size = llmax(box_dims[0],box_dims[1],box_dims[2]);
- if (!mRootVolp->isAttachment())
- {
- LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents);
- F32 offset_dist = pos_box_offset.length();
- if (offset_dist > max_legal_offset && offset_dist > 0.f)
- {
- F32 target_dist = (offset_dist - max_legal_offset);
- new_pos_fixup = (target_dist/offset_dist)*pos_box_offset;
- }
- if (new_pos_fixup != mPositionConstraintFixup)
- {
- LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup "
- << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL;
- LL_DEBUGS("ConstraintFix") << "vol_pos " << vol_pos << LL_ENDL;
- LL_DEBUGS("ConstraintFix") << "extents " << extents[0] << " " << extents[1] << LL_ENDL;
- LL_DEBUGS("ConstraintFix") << "unshift_extents " << unshift_extents[0] << " " << unshift_extents[1] << LL_ENDL;
-
- }
- }
+ if (!mRootVolp->isAttachment())
+ {
+ LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents);
+ F32 offset_dist = pos_box_offset.length();
+ if (offset_dist > max_legal_offset && offset_dist > 0.f)
+ {
+ F32 target_dist = (offset_dist - max_legal_offset);
+ new_pos_fixup = (target_dist/offset_dist)*pos_box_offset;
+ }
+ if (new_pos_fixup != mPositionConstraintFixup)
+ {
+ LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup "
+ << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL;
+ LL_DEBUGS("ConstraintFix") << "vol_pos " << vol_pos << LL_ENDL;
+ LL_DEBUGS("ConstraintFix") << "extents " << extents[0] << " " << extents[1] << LL_ENDL;
+ LL_DEBUGS("ConstraintFix") << "unshift_extents " << unshift_extents[0] << " " << unshift_extents[1] << LL_ENDL;
+
+ }
+ }
if (box_size/mScaleConstraintFixup > max_legal_size)
{
new_scale_fixup = mScaleConstraintFixup*max_legal_size/box_size;
- LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup "
- << mScaleConstraintFixup << " max legal " << max_legal_size
- << " -> new scale " << new_scale_fixup << LL_ENDL;
+ LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup "
+ << mScaleConstraintFixup << " max legal " << max_legal_size
+ << " -> new scale " << new_scale_fixup << LL_ENDL;
}
}
}
@@ -166,20 +166,20 @@ void LLControlAvatar::matchVolumeTransform()
{
if (mRootVolp)
{
- LLVector3 new_pos_fixup;
- F32 new_scale_fixup;
- if (mRegionChanged)
- {
- new_scale_fixup = mScaleConstraintFixup;
- new_pos_fixup = mPositionConstraintFixup;
- mRegionChanged = false;
- }
- else
- {
- getNewConstraintFixups(new_pos_fixup, new_scale_fixup);
- }
- mPositionConstraintFixup = new_pos_fixup;
- mScaleConstraintFixup = new_scale_fixup;
+ LLVector3 new_pos_fixup;
+ F32 new_scale_fixup;
+ if (mRegionChanged)
+ {
+ new_scale_fixup = mScaleConstraintFixup;
+ new_pos_fixup = mPositionConstraintFixup;
+ mRegionChanged = false;
+ }
+ else
+ {
+ getNewConstraintFixups(new_pos_fixup, new_scale_fixup);
+ }
+ mPositionConstraintFixup = new_pos_fixup;
+ mScaleConstraintFixup = new_scale_fixup;
if (mRootVolp->isAttachment())
{
@@ -191,7 +191,7 @@ void LLControlAvatar::matchVolumeTransform()
{
setPositionAgent(mRootVolp->getRenderPosition());
}
- attach->updateWorldPRSParent();
+ attach->updateWorldPRSParent();
LLVector3 joint_pos = attach->getWorldPosition();
LLQuaternion joint_rot = attach->getWorldRotation();
LLVector3 obj_pos = mRootVolp->mDrawable->getPosition();
@@ -201,8 +201,8 @@ void LLControlAvatar::matchVolumeTransform()
mRoot->setWorldRotation(obj_rot * joint_rot);
setRotation(mRoot->getRotation());
- F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale");
- setGlobalScale(global_scale * mScaleConstraintFixup);
+ F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale");
+ setGlobalScale(global_scale * mScaleConstraintFixup);
}
else
{
@@ -230,27 +230,27 @@ void LLControlAvatar::matchVolumeTransform()
{
obj_rot = mRootVolp->getRotation();
}
-
- LLMatrix3 bind_mat;
+
+ LLMatrix3 bind_mat;
LLQuaternion bind_rot;
#define MATCH_BIND_SHAPE
#ifdef MATCH_BIND_SHAPE
// MAINT-8671 - based on a patch from Beq Janus
- const LLMeshSkinInfo* skin_info = mRootVolp->getSkinInfo();
- if (skin_info)
- {
+ const LLMeshSkinInfo* skin_info = mRootVolp->getSkinInfo();
+ if (skin_info)
+ {
LL_DEBUGS("BindShape") << getFullname() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL;
bind_rot = LLSkinningUtil::getUnscaledQuaternion(LLMatrix4(skin_info->mBindShapeMatrix));
- }
+ }
#endif
- setRotation(bind_rot*obj_rot);
+ setRotation(bind_rot*obj_rot);
mRoot->setWorldRotation(bind_rot*obj_rot);
if (getRegion() && !isDead())
{
setPositionAgent(vol_pos);
}
- mRoot->setPosition(vol_pos + mPositionConstraintFixup);
+ mRoot->setPosition(vol_pos + mPositionConstraintFixup);
F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale");
setGlobalScale(global_scale * mScaleConstraintFixup);
@@ -278,37 +278,37 @@ void LLControlAvatar::setGlobalScale(F32 scale)
void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor)
{
joint->setScale(factor * joint->getScale());
-
- for (LLJoint::joints_t::iterator iter = joint->mChildren.begin();
- iter != joint->mChildren.end(); ++iter)
- {
- LLJoint* child = *iter;
- recursiveScaleJoint(child, factor);
- }
+
+ for (LLJoint::joints_t::iterator iter = joint->mChildren.begin();
+ iter != joint->mChildren.end(); ++iter)
+ {
+ LLJoint* child = *iter;
+ recursiveScaleJoint(child, factor);
+ }
}
// Based on LLViewerJointAttachment::setupDrawable(), without the attaching part.
void LLControlAvatar::updateVolumeGeom()
{
- if (!mRootVolp->mDrawable)
- return;
- if (mRootVolp->mDrawable->isActive())
- {
- mRootVolp->mDrawable->makeStatic(FALSE);
- }
- mRootVolp->mDrawable->makeActive();
- gPipeline.markMoved(mRootVolp->mDrawable);
- gPipeline.markTextured(mRootVolp->mDrawable); // face may need to change draw pool to/from POOL_HUD
-
- LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* childp = *iter;
- if (childp && childp->mDrawable.notNull())
- {
- gPipeline.markTextured(childp->mDrawable); // face may need to change draw pool to/from POOL_HUD
- gPipeline.markMoved(childp->mDrawable);
+ if (!mRootVolp->mDrawable)
+ return;
+ if (mRootVolp->mDrawable->isActive())
+ {
+ mRootVolp->mDrawable->makeStatic(FALSE);
+ }
+ mRootVolp->mDrawable->makeActive();
+ gPipeline.markMoved(mRootVolp->mDrawable);
+ gPipeline.markTextured(mRootVolp->mDrawable); // face may need to change draw pool to/from POOL_HUD
+
+ LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* childp = *iter;
+ if (childp && childp->mDrawable.notNull())
+ {
+ gPipeline.markTextured(childp->mDrawable); // face may need to change draw pool to/from POOL_HUD
+ gPipeline.markMoved(childp->mDrawable);
}
}
@@ -337,7 +337,7 @@ void LLControlAvatar::updateVolumeGeom()
// global scale, 3) approximate the original scale by looking at
// the proportions of the skeleton after joint positions have
// been applied
-
+
//LLVector3 obj_scale = obj->getScale();
//F32 obj_scale_z = llmax(obj_scale[2],0.1f);
//setGlobalScale(obj_scale_z/2.0f); // roughly fit avatar height range (2m) into object height
@@ -345,7 +345,7 @@ void LLControlAvatar::updateVolumeGeom()
LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj)
{
- LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR);
+ LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR);
if (cav)
{
@@ -388,29 +388,29 @@ void LLControlAvatar::markDead()
bool LLControlAvatar::computeNeedsUpdate()
{
- computeUpdatePeriod();
-
- // Animesh attachments are a special case. Should have the same update cadence as their attached parent avatar.
- LLVOAvatar *attached_av = getAttachedAvatar();
- if (attached_av)
- {
- // Have to run computeNeedsUpdate() for attached av in
- // case it hasn't run updateCharacter() already this
- // frame. Note this means that the attached av will
- // run computeNeedsUpdate() multiple times per frame
- // if it has animesh attachments. Results will be
- // consistent except for the corner case of exceeding
- // MAX_IMPOSTOR_INTERVAL in one call but not another,
- // which should be rare.
- attached_av->computeNeedsUpdate();
- mNeedsImpostorUpdate = attached_av->mNeedsImpostorUpdate;
- if (mNeedsImpostorUpdate)
- {
- mLastImpostorUpdateReason = 12;
- }
- return mNeedsImpostorUpdate;
- }
- return LLVOAvatar::computeNeedsUpdate();
+ computeUpdatePeriod();
+
+ // Animesh attachments are a special case. Should have the same update cadence as their attached parent avatar.
+ LLVOAvatar *attached_av = getAttachedAvatar();
+ if (attached_av)
+ {
+ // Have to run computeNeedsUpdate() for attached av in
+ // case it hasn't run updateCharacter() already this
+ // frame. Note this means that the attached av will
+ // run computeNeedsUpdate() multiple times per frame
+ // if it has animesh attachments. Results will be
+ // consistent except for the corner case of exceeding
+ // MAX_IMPOSTOR_INTERVAL in one call but not another,
+ // which should be rare.
+ attached_av->computeNeedsUpdate();
+ mNeedsImpostorUpdate = attached_av->mNeedsImpostorUpdate;
+ if (mNeedsImpostorUpdate)
+ {
+ mLastImpostorUpdateReason = 12;
+ }
+ return mNeedsImpostorUpdate;
+ }
+ return LLVOAvatar::computeNeedsUpdate();
}
bool LLControlAvatar::updateCharacter(LLAgent &agent)
@@ -421,7 +421,7 @@ bool LLControlAvatar::updateCharacter(LLAgent &agent)
//virtual
void LLControlAvatar::updateDebugText()
{
- if (gSavedSettings.getBOOL("DebugAnimatedObjects"))
+ if (gSavedSettings.getBOOL("DebugAnimatedObjects"))
{
S32 total_linkset_count = 0;
if (mRootVolp)
@@ -504,7 +504,7 @@ void LLControlAvatar::updateDebugText()
}
}
addDebugText(llformat("CAV obj %d anim %d active %s impost %d upprd %d strcst %f",
- total_linkset_count, animated_volume_count,
+ total_linkset_count, animated_volume_count,
active_string.c_str(), (S32) isImpostor(), getUpdatePeriod(), streaming_cost));
addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str()));
addDebugText(llformat("flags %s", animated_object_flag_string.c_str()));
@@ -513,13 +513,13 @@ void LLControlAvatar::updateDebugText()
addDebugText(llformat("lod_radius %s dists %s", LLStringOps::getReadableNumber(lod_radius).c_str(),cam_dist_string.c_str()));
if (mPositionConstraintFixup.length() > 0.0f || mScaleConstraintFixup != 1.0f)
{
- addDebugText(llformat("pos fix (%.1f %.1f %.1f) scale %f",
- mPositionConstraintFixup[0],
+ addDebugText(llformat("pos fix (%.1f %.1f %.1f) scale %f",
+ mPositionConstraintFixup[0],
mPositionConstraintFixup[1],
mPositionConstraintFixup[2],
mScaleConstraintFixup));
}
-
+
#if 0
std::string region_name = "no region";
if (mRootVolp->getRegion())
@@ -535,7 +535,7 @@ void LLControlAvatar::updateDebugText()
mRootVolp->getRegion(), region_name.c_str(),
getRegion(), skel_region_name.c_str()));
#endif
-
+
}
LLVOAvatar::updateDebugText();
}
@@ -548,12 +548,12 @@ void LLControlAvatar::getAnimatedVolumes(std::vector<LLVOVolume*>& volumes)
}
volumes.push_back(mRootVolp);
-
- LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren();
- for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* childp = *iter;
+
+ LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren();
+ for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* childp = *iter;
LLVOVolume *child_volp = dynamic_cast<LLVOVolume*>(childp);
if (child_volp && child_volp->isAnimatedObject())
{
@@ -575,9 +575,9 @@ void LLControlAvatar::updateAnimations()
std::vector<LLVOVolume*> volumes;
getAnimatedVolumes(volumes);
-
+
// Rebuild mSignaledAnimations from the associated volumes.
- std::map<LLUUID, S32> anims;
+ std::map<LLUUID, S32> anims;
for (std::vector<LLVOVolume*>::iterator vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it)
{
LLVOVolume *volp = *vol_it;
@@ -617,27 +617,27 @@ void LLControlAvatar::updateAnimations()
// virtual
LLViewerObject* LLControlAvatar::lineSegmentIntersectRiggedAttachments(const LLVector4a& start, const LLVector4a& end,
- S32 face,
- BOOL pick_transparent,
- BOOL pick_rigged,
+ S32 face,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
BOOL pick_unselectable,
- S32* face_hit,
- LLVector4a* intersection,
- LLVector2* tex_coord,
- LLVector4a* normal,
- LLVector4a* tangent)
+ S32* face_hit,
+ LLVector4a* intersection,
+ LLVector2* tex_coord,
+ LLVector4a* normal,
+ LLVector4a* tangent)
{
if (!mRootVolp)
{
return NULL;
}
- LLViewerObject* hit = NULL;
+ LLViewerObject* hit = NULL;
- if (lineSegmentBoundingBox(start, end))
- {
- LLVector4a local_end = end;
- LLVector4a local_intersection;
+ if (lineSegmentBoundingBox(start, end))
+ {
+ LLVector4a local_end = end;
+ LLVector4a local_intersection;
if (mRootVolp->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, pick_unselectable, face_hit, &local_intersection, tex_coord, normal, tangent))
{
local_end = local_intersection;
@@ -667,9 +667,9 @@ LLViewerObject* LLControlAvatar::lineSegmentIntersectRiggedAttachments(const LLV
}
}
}
- }
-
- return hit;
+ }
+
+ return hit;
}
// virtual
@@ -688,34 +688,34 @@ std::string LLControlAvatar::getFullname() const
// virtual
bool LLControlAvatar::shouldRenderRigged() const
{
- const LLVOAvatar *attached_av = getAttachedAvatar();
- if (attached_av)
- {
- return attached_av->shouldRenderRigged();
- }
+ const LLVOAvatar *attached_av = getAttachedAvatar();
+ if (attached_av)
+ {
+ return attached_av->shouldRenderRigged();
+ }
return true;
}
// virtual
BOOL LLControlAvatar::isImpostor()
{
- // Attached animated objects should match state of their attached av.
- LLVOAvatar *attached_av = getAttachedAvatar();
- if (attached_av)
- {
- return attached_av->isImpostor();
- }
- return LLVOAvatar::isImpostor();
+ // Attached animated objects should match state of their attached av.
+ LLVOAvatar *attached_av = getAttachedAvatar();
+ if (attached_av)
+ {
+ return attached_av->isImpostor();
+ }
+ return LLVOAvatar::isImpostor();
}
//static
void LLControlAvatar::onRegionChanged()
{
- std::vector<LLCharacter*>::iterator it = LLCharacter::sInstances.begin();
- for ( ; it != LLCharacter::sInstances.end(); ++it)
- {
- LLControlAvatar* cav = dynamic_cast<LLControlAvatar*>(*it);
- if (!cav) continue;
- cav->mRegionChanged = true;
- }
+ std::vector<LLCharacter*>::iterator it = LLCharacter::sInstances.begin();
+ for ( ; it != LLCharacter::sInstances.end(); ++it)
+ {
+ LLControlAvatar* cav = dynamic_cast<LLControlAvatar*>(*it);
+ if (!cav) continue;
+ cav->mRegionChanged = true;
+ }
}
diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h
index 34db285514..ca98659ecd 100644
--- a/indra/newview/llcontrolavatar.h
+++ b/indra/newview/llcontrolavatar.h
@@ -41,12 +41,12 @@ public:
LLControlAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
virtual void initInstance(); // Called after construction to initialize the class.
virtual void markDead();
- virtual ~LLControlAvatar();
+ virtual ~LLControlAvatar();
+
+ // If this is an attachment, return the avatar it is attached to. Otherwise NULL.
+ virtual const LLVOAvatar *getAttachedAvatar() const;
+ virtual LLVOAvatar *getAttachedAvatar();
- // If this is an attachment, return the avatar it is attached to. Otherwise NULL.
- virtual const LLVOAvatar *getAttachedAvatar() const;
- virtual LLVOAvatar *getAttachedAvatar();
-
void getNewConstraintFixups(LLVector3& new_pos_constraint, F32& new_scale_constraint) const;
void matchVolumeTransform();
void updateVolumeGeom();
@@ -60,13 +60,13 @@ public:
void markForDeath();
virtual void idleUpdate(LLAgent &agent, const F64 &time);
- virtual bool computeNeedsUpdate();
- virtual bool updateCharacter(LLAgent &agent);
+ virtual bool computeNeedsUpdate();
+ virtual bool updateCharacter(LLAgent &agent);
void getAnimatedVolumes(std::vector<LLVOVolume*>& volumes);
- void updateAnimations();
-
- virtual LLViewerObject* lineSegmentIntersectRiggedAttachments(
+ void updateAnimations();
+
+ virtual LLViewerObject* lineSegmentIntersectRiggedAttachments(
const LLVector4a& start, const LLVector4a& end,
S32 face = -1, // which face to check, -1 = ALL_SIDES
BOOL pick_transparent = FALSE,
@@ -78,14 +78,14 @@ public:
LLVector4a* normal = NULL, // return the surface normal at the intersection point
LLVector4a* tangent = NULL); // return the surface tangent at the intersection point
- virtual void updateDebugText();
+ virtual void updateDebugText();
virtual std::string getFullname() const;
virtual bool shouldRenderRigged() const;
- virtual BOOL isImpostor();
-
+ virtual BOOL isImpostor();
+
bool mPlaying;
F32 mGlobalScale;
@@ -101,9 +101,9 @@ public:
static const F32 MAX_LEGAL_OFFSET;
static const F32 MAX_LEGAL_SIZE;
- static void onRegionChanged();
- bool mRegionChanged;
- static boost::signals2::connection sRegionChangedSlot;
+ static void onRegionChanged();
+ bool mRegionChanged;
+ static boost::signals2::connection sRegionChangedSlot;
};
typedef std::map<LLUUID, S32> signaled_animation_map_t;
@@ -112,7 +112,7 @@ typedef std::map<LLUUID, signaled_animation_map_t> object_signaled_animation_map
// Stores information about previously requested animations, by object id.
class LLObjectSignaledAnimationMap: public LLSingleton<LLObjectSignaledAnimationMap>
{
- LLSINGLETON_EMPTY_CTOR(LLObjectSignaledAnimationMap);
+ LLSINGLETON_EMPTY_CTOR(LLObjectSignaledAnimationMap);
public:
object_signaled_animation_map_t mMap;
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index 3c59ca046d..dd4ca845a0 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -38,14 +38,14 @@ const S32Days CONVERSATION_LIFETIME = (S32Days)30; // lifetime of LLConversation
struct ConversationParams : public LLInitParam::Block<ConversationParams>
{
- Mandatory<U64Seconds > time;
- Mandatory<std::string> timestamp;
- Mandatory<SessionType> conversation_type;
- Mandatory<std::string> conversation_name,
- history_filename;
- Mandatory<LLUUID> session_id,
- participant_id;
- Mandatory<bool> has_offline_ims;
+ Mandatory<U64Seconds > time;
+ Mandatory<std::string> timestamp;
+ Mandatory<SessionType> conversation_type;
+ Mandatory<std::string> conversation_name,
+ history_filename;
+ Mandatory<LLUUID> session_id,
+ participant_id;
+ Mandatory<bool> has_offline_ims;
};
/************************************************************************/
@@ -53,131 +53,131 @@ struct ConversationParams : public LLInitParam::Block<ConversationParams>
/************************************************************************/
LLConversation::LLConversation(const ConversationParams& params)
-: mTime(params.time),
- mTimestamp(params.timestamp.isProvided() ? params.timestamp : createTimestamp(params.time)),
- mConversationType(params.conversation_type),
- mConversationName(params.conversation_name),
- mHistoryFileName(params.history_filename),
- mSessionID(params.session_id),
- mParticipantID(params.participant_id),
- mHasOfflineIMs(params.has_offline_ims)
+: mTime(params.time),
+ mTimestamp(params.timestamp.isProvided() ? params.timestamp : createTimestamp(params.time)),
+ mConversationType(params.conversation_type),
+ mConversationName(params.conversation_name),
+ mHistoryFileName(params.history_filename),
+ mSessionID(params.session_id),
+ mParticipantID(params.participant_id),
+ mHasOfflineIMs(params.has_offline_ims)
{
- setListenIMFloaterOpened();
+ setListenIMFloaterOpened();
}
LLConversation::LLConversation(const LLIMModel::LLIMSession& session)
-: mTime(time_corrected()),
- mTimestamp(createTimestamp(mTime)),
- mConversationType(session.mSessionType),
- mConversationName(session.mName),
- mHistoryFileName(session.mHistoryFileName),
- mSessionID(session.isOutgoingAdHoc() ? session.generateOutgoingAdHocHash() : session.mSessionID),
- mParticipantID(session.mOtherParticipantID),
- mHasOfflineIMs(session.mHasOfflineMessage)
+: mTime(time_corrected()),
+ mTimestamp(createTimestamp(mTime)),
+ mConversationType(session.mSessionType),
+ mConversationName(session.mName),
+ mHistoryFileName(session.mHistoryFileName),
+ mSessionID(session.isOutgoingAdHoc() ? session.generateOutgoingAdHocHash() : session.mSessionID),
+ mParticipantID(session.mOtherParticipantID),
+ mHasOfflineIMs(session.mHasOfflineMessage)
{
- setListenIMFloaterOpened();
+ setListenIMFloaterOpened();
}
LLConversation::LLConversation(const LLConversation& conversation)
{
- mTime = conversation.getTime();
- mTimestamp = conversation.getTimestamp();
- mConversationType = conversation.getConversationType();
- mConversationName = conversation.getConversationName();
- mHistoryFileName = conversation.getHistoryFileName();
- mSessionID = conversation.getSessionID();
- mParticipantID = conversation.getParticipantID();
- mHasOfflineIMs = conversation.hasOfflineMessages();
+ mTime = conversation.getTime();
+ mTimestamp = conversation.getTimestamp();
+ mConversationType = conversation.getConversationType();
+ mConversationName = conversation.getConversationName();
+ mHistoryFileName = conversation.getHistoryFileName();
+ mSessionID = conversation.getSessionID();
+ mParticipantID = conversation.getParticipantID();
+ mHasOfflineIMs = conversation.hasOfflineMessages();
- setListenIMFloaterOpened();
+ setListenIMFloaterOpened();
}
LLConversation::~LLConversation()
{
- mIMFloaterShowedConnection.disconnect();
+ mIMFloaterShowedConnection.disconnect();
}
void LLConversation::updateTimestamp()
{
- mTime = (U64Seconds)time_corrected();
- mTimestamp = createTimestamp(mTime);
+ mTime = (U64Seconds)time_corrected();
+ mTimestamp = createTimestamp(mTime);
}
void LLConversation::onIMFloaterShown(const LLUUID& session_id)
{
- if (mSessionID == session_id)
- {
- mHasOfflineIMs = false;
- }
+ if (mSessionID == session_id)
+ {
+ mHasOfflineIMs = false;
+ }
}
// static
const std::string LLConversation::createTimestamp(const U64Seconds& utc_time)
{
- std::string timeStr;
- LLSD substitution;
- substitution["datetime"] = (S32)utc_time.value();
+ std::string timeStr;
+ LLSD substitution;
+ substitution["datetime"] = (S32)utc_time.value();
- timeStr = "["+LLTrans::getString ("TimeMonth")+"]/["
- +LLTrans::getString ("TimeDay")+"]/["
- +LLTrans::getString ("TimeYear")+"] ["
- +LLTrans::getString ("TimeHour")+"]:["
- +LLTrans::getString ("TimeMin")+"]";
+ timeStr = "["+LLTrans::getString ("TimeMonth")+"]/["
+ +LLTrans::getString ("TimeDay")+"]/["
+ +LLTrans::getString ("TimeYear")+"] ["
+ +LLTrans::getString ("TimeHour")+"]:["
+ +LLTrans::getString ("TimeMin")+"]";
- LLStringUtil::format (timeStr, substitution);
- return timeStr;
+ LLStringUtil::format (timeStr, substitution);
+ return timeStr;
}
bool LLConversation::isOlderThan(U32Days days) const
{
- U64Seconds now(time_corrected());
- U32Days age = now - mTime;
+ U64Seconds now(time_corrected());
+ U32Days age = now - mTime;
- return age > days;
+ return age > days;
}
void LLConversation::setListenIMFloaterOpened()
{
- LLFloaterIMSession* floater = LLFloaterIMSession::findInstance(mSessionID);
+ LLFloaterIMSession* floater = LLFloaterIMSession::findInstance(mSessionID);
- bool offline_ims_visible = LLFloaterIMSession::isVisible(floater) && floater->hasFocus();
+ bool offline_ims_visible = LLFloaterIMSession::isVisible(floater) && floater->hasFocus();
- // we don't need to listen for im floater with this conversation is opened
- // if floater is already opened or this conversation doesn't have unread offline messages
- if (mHasOfflineIMs && !offline_ims_visible)
- {
- mIMFloaterShowedConnection = LLFloaterIMSession::setIMFloaterShowedCallback(boost::bind(&LLConversation::onIMFloaterShown, this, _1));
- }
- else
- {
- mHasOfflineIMs = false;
- }
+ // we don't need to listen for im floater with this conversation is opened
+ // if floater is already opened or this conversation doesn't have unread offline messages
+ if (mHasOfflineIMs && !offline_ims_visible)
+ {
+ mIMFloaterShowedConnection = LLFloaterIMSession::setIMFloaterShowedCallback(boost::bind(&LLConversation::onIMFloaterShown, this, _1));
+ }
+ else
+ {
+ mHasOfflineIMs = false;
+ }
}
/************************************************************************/
/* LLConversationLogFriendObserver implementation */
/************************************************************************/
-// Note : An LLSingleton like LLConversationLog cannot be an LLFriendObserver
+// Note : An LLSingleton like LLConversationLog cannot be an LLFriendObserver
// at the same time.
-// This is because avatar observers are deleted by the observed object which
+// This is because avatar observers are deleted by the observed object which
// conflicts with the way LLSingleton are deleted.
class LLConversationLogFriendObserver : public LLFriendObserver
{
public:
- LLConversationLogFriendObserver() {}
- virtual ~LLConversationLogFriendObserver() {}
- virtual void changed(U32 mask);
+ LLConversationLogFriendObserver() {}
+ virtual ~LLConversationLogFriendObserver() {}
+ virtual void changed(U32 mask);
};
void LLConversationLogFriendObserver::changed(U32 mask)
{
- if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE))
- {
- LLConversationLog::instance().notifyObservers();
- }
+ if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE))
+ {
+ LLConversationLog::instance().notifyObservers();
+ }
}
/************************************************************************/
@@ -185,216 +185,216 @@ void LLConversationLogFriendObserver::changed(U32 mask)
/************************************************************************/
LLConversationLog::LLConversationLog() :
- mAvatarNameCacheConnection(),
- mLoggingEnabled(false)
+ mAvatarNameCacheConnection(),
+ mLoggingEnabled(false)
{
}
void LLConversationLog::enableLogging(S32 log_mode)
{
- mLoggingEnabled = log_mode > 0;
- if (log_mode > 0)
- {
- mConversations.clear();
- loadFromFile(getFileName());
- LLIMMgr::instance().addSessionObserver(this);
- mNewMessageSignalConnection = LLIMModel::instance().addNewMsgCallback(boost::bind(&LLConversationLog::onNewMessageReceived, this, _1));
+ mLoggingEnabled = log_mode > 0;
+ if (log_mode > 0)
+ {
+ mConversations.clear();
+ loadFromFile(getFileName());
+ LLIMMgr::instance().addSessionObserver(this);
+ mNewMessageSignalConnection = LLIMModel::instance().addNewMsgCallback(boost::bind(&LLConversationLog::onNewMessageReceived, this, _1));
- mFriendObserver = new LLConversationLogFriendObserver;
- LLAvatarTracker::instance().addObserver(mFriendObserver);
- }
- else
- {
- saveToFile(getFileName());
+ mFriendObserver = new LLConversationLogFriendObserver;
+ LLAvatarTracker::instance().addObserver(mFriendObserver);
+ }
+ else
+ {
+ saveToFile(getFileName());
- LLIMMgr::instance().removeSessionObserver(this);
- mNewMessageSignalConnection.disconnect();
- LLAvatarTracker::instance().removeObserver(mFriendObserver);
- }
+ LLIMMgr::instance().removeSessionObserver(this);
+ mNewMessageSignalConnection.disconnect();
+ LLAvatarTracker::instance().removeObserver(mFriendObserver);
+ }
- notifyObservers();
+ notifyObservers();
}
void LLConversationLog::logConversation(const LLUUID& session_id, BOOL has_offline_msg)
{
- const LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
- LLConversation* conversation = findConversation(session);
-
- if (session && session->mOtherParticipantID != gAgentID)
- {
- if (conversation)
- {
- if(has_offline_msg)
- {
- updateOfflineIMs(session, has_offline_msg);
- }
- updateConversationTimestamp(conversation);
- }
- else
- {
- createConversation(session);
- }
- }
+ const LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
+ LLConversation* conversation = findConversation(session);
+
+ if (session && session->mOtherParticipantID != gAgentID)
+ {
+ if (conversation)
+ {
+ if(has_offline_msg)
+ {
+ updateOfflineIMs(session, has_offline_msg);
+ }
+ updateConversationTimestamp(conversation);
+ }
+ else
+ {
+ createConversation(session);
+ }
+ }
}
void LLConversationLog::createConversation(const LLIMModel::LLIMSession* session)
{
- if (session)
- {
- LLConversation conversation(*session);
- mConversations.push_back(conversation);
+ if (session)
+ {
+ LLConversation conversation(*session);
+ mConversations.push_back(conversation);
- if (LLIMModel::LLIMSession::P2P_SESSION == session->mSessionType)
- {
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(session->mOtherParticipantID, boost::bind(&LLConversationLog::onAvatarNameCache, this, _1, _2, session));
- }
+ if (LLIMModel::LLIMSession::P2P_SESSION == session->mSessionType)
+ {
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(session->mOtherParticipantID, boost::bind(&LLConversationLog::onAvatarNameCache, this, _1, _2, session));
+ }
- notifyObservers();
- }
+ notifyObservers();
+ }
}
void LLConversationLog::updateConversationName(const LLIMModel::LLIMSession* session, const std::string& name)
{
- if (!session)
- {
- return;
- }
+ if (!session)
+ {
+ return;
+ }
- LLConversation* conversation = findConversation(session);
- if (conversation)
- {
- conversation->setConversationName(name);
- notifyParticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_NAME);
- }
+ LLConversation* conversation = findConversation(session);
+ if (conversation)
+ {
+ conversation->setConversationName(name);
+ notifyParticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_NAME);
+ }
}
void LLConversationLog::updateOfflineIMs(const LLIMModel::LLIMSession* session, BOOL new_messages)
{
- if (!session)
- {
- return;
- }
+ if (!session)
+ {
+ return;
+ }
- LLConversation* conversation = findConversation(session);
- if (conversation)
- {
- conversation->setOfflineMessages(new_messages);
- notifyParticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_OfflineIMs);
- }
+ LLConversation* conversation = findConversation(session);
+ if (conversation)
+ {
+ conversation->setOfflineMessages(new_messages);
+ notifyParticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_OfflineIMs);
+ }
}
void LLConversationLog::updateConversationTimestamp(LLConversation* conversation)
{
- if (conversation)
- {
- conversation->updateTimestamp();
- notifyParticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_TIME);
- }
+ if (conversation)
+ {
+ conversation->updateTimestamp();
+ notifyParticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_TIME);
+ }
}
LLConversation* LLConversationLog::findConversation(const LLIMModel::LLIMSession* session)
{
- if (session)
- {
- const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgoingAdHocHash() : session->mSessionID;
+ if (session)
+ {
+ const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgoingAdHocHash() : session->mSessionID;
- conversations_vec_t::iterator conv_it = mConversations.begin();
- for(; conv_it != mConversations.end(); ++conv_it)
- {
- if (conv_it->getSessionID() == session_id)
- {
- return &*conv_it;
- }
- }
- }
+ conversations_vec_t::iterator conv_it = mConversations.begin();
+ for(; conv_it != mConversations.end(); ++conv_it)
+ {
+ if (conv_it->getSessionID() == session_id)
+ {
+ return &*conv_it;
+ }
+ }
+ }
- return NULL;
+ return NULL;
}
void LLConversationLog::removeConversation(const LLConversation& conversation)
{
- conversations_vec_t::iterator conv_it = mConversations.begin();
- for(; conv_it != mConversations.end(); ++conv_it)
- {
- if (conv_it->getSessionID() == conversation.getSessionID() && conv_it->getTime() == conversation.getTime())
- {
- mConversations.erase(conv_it);
- notifyObservers();
- cache();
- return;
- }
- }
+ conversations_vec_t::iterator conv_it = mConversations.begin();
+ for(; conv_it != mConversations.end(); ++conv_it)
+ {
+ if (conv_it->getSessionID() == conversation.getSessionID() && conv_it->getTime() == conversation.getTime())
+ {
+ mConversations.erase(conv_it);
+ notifyObservers();
+ cache();
+ return;
+ }
+ }
}
const LLConversation* LLConversationLog::getConversation(const LLUUID& session_id)
{
- conversations_vec_t::const_iterator conv_it = mConversations.begin();
- for(; conv_it != mConversations.end(); ++conv_it)
- {
- if (conv_it->getSessionID() == session_id)
- {
- return &*conv_it;
- }
- }
+ conversations_vec_t::const_iterator conv_it = mConversations.begin();
+ for(; conv_it != mConversations.end(); ++conv_it)
+ {
+ if (conv_it->getSessionID() == session_id)
+ {
+ return &*conv_it;
+ }
+ }
- return NULL;
+ return NULL;
}
void LLConversationLog::addObserver(LLConversationLogObserver* observer)
{
- mObservers.insert(observer);
+ mObservers.insert(observer);
}
void LLConversationLog::removeObserver(LLConversationLogObserver* observer)
{
- mObservers.erase(observer);
+ mObservers.erase(observer);
}
void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg)
{
- logConversation(session_id, has_offline_msg);
+ logConversation(session_id, has_offline_msg);
}
void LLConversationLog::cache()
{
- if (gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 0)
- {
- saveToFile(getFileName());
- }
+ if (gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 0)
+ {
+ saveToFile(getFileName());
+ }
}
void LLConversationLog::getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs)
{
- // get Users log directory
- std::string dirname = gDirUtilp->getPerAccountChatLogsDir();
+ // get Users log directory
+ std::string dirname = gDirUtilp->getPerAccountChatLogsDir();
- // add final OS dependent delimiter
- dirname += gDirUtilp->getDirDelimiter();
+ // add final OS dependent delimiter
+ dirname += gDirUtilp->getDirDelimiter();
- // create search pattern
- std::string pattern = "conversation.log.backup*";
+ // create search pattern
+ std::string pattern = "conversation.log.backup*";
- LLDirIterator iter(dirname, pattern);
- std::string filename;
- while (iter.next(filename))
- {
- list_of_backup_logs.push_back(gDirUtilp->add(dirname, filename));
- }
+ LLDirIterator iter(dirname, pattern);
+ std::string filename;
+ while (iter.next(filename))
+ {
+ list_of_backup_logs.push_back(gDirUtilp->add(dirname, filename));
+ }
}
void LLConversationLog::deleteBackupLogs()
{
- std::vector<std::string> backup_logs;
- getListOfBackupLogs(backup_logs);
+ std::vector<std::string> backup_logs;
+ getListOfBackupLogs(backup_logs);
- for (const std::string& fullpath : backup_logs)
- {
- LLFile::remove(fullpath);
- }
+ for (const std::string& fullpath : backup_logs)
+ {
+ LLFile::remove(fullpath);
+ }
}
void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::string &expected_filename, const std::string &new_session_name)
@@ -418,36 +418,36 @@ void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::stri
bool LLConversationLog::moveLog(const std::string &originDirectory, const std::string &targetDirectory)
{
- std::string backupFileName;
- unsigned backupFileCount = 0;
+ std::string backupFileName;
+ unsigned backupFileCount = 0;
- //Does the file exist in the current path, if it does lets move it
- if(LLFile::isfile(originDirectory))
- {
- //The target directory contains that file already, so lets store it
- if(LLFile::isfile(targetDirectory))
- {
- backupFileName = targetDirectory + ".backup";
+ //Does the file exist in the current path, if it does lets move it
+ if(LLFile::isfile(originDirectory))
+ {
+ //The target directory contains that file already, so lets store it
+ if(LLFile::isfile(targetDirectory))
+ {
+ backupFileName = targetDirectory + ".backup";
- //If needed store backup file as .backup1 etc.
- while(LLFile::isfile(backupFileName))
- {
- ++backupFileCount;
- backupFileName = targetDirectory + ".backup" + std::to_string(backupFileCount);
- }
+ //If needed store backup file as .backup1 etc.
+ while(LLFile::isfile(backupFileName))
+ {
+ ++backupFileCount;
+ backupFileName = targetDirectory + ".backup" + std::to_string(backupFileCount);
+ }
- //Rename the file to its backup name so it is not overwritten
- LLFile::rename(targetDirectory, backupFileName);
- }
+ //Rename the file to its backup name so it is not overwritten
+ LLFile::rename(targetDirectory, backupFileName);
+ }
- //Move the file from the current path to target path
- if(LLFile::rename(originDirectory, targetDirectory) != 0)
- {
- return false;
- }
- }
+ //Move the file from the current path to target path
+ if(LLFile::rename(originDirectory, targetDirectory) != 0)
+ {
+ return false;
+ }
+ }
- return true;
+ return true;
}
void LLConversationLog::initLoggingState()
@@ -466,188 +466,188 @@ void LLConversationLog::initLoggingState()
std::string LLConversationLog::getFileName()
{
- std::string filename = "conversation";
- std::string log_address = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, filename);
- if (!log_address.empty())
- {
- log_address += ".log";
- }
- return log_address;
+ std::string filename = "conversation";
+ std::string log_address = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, filename);
+ if (!log_address.empty())
+ {
+ log_address += ".log";
+ }
+ return log_address;
}
bool LLConversationLog::saveToFile(const std::string& filename)
{
- if (!filename.size())
- {
- LL_WARNS() << "Call log list filename is empty!" << LL_ENDL;
- return false;
- }
-
- LLFILE* fp = LLFile::fopen(filename, "wb");
- if (!fp)
- {
- LL_WARNS() << "Couldn't open call log list" << filename << LL_ENDL;
- return false;
- }
-
- std::string participant_id;
- std::string conversation_id;
-
- conversations_vec_t::const_iterator conv_it = mConversations.begin();
- for (; conv_it != mConversations.end(); ++conv_it)
- {
- conv_it->getSessionID().toString(conversation_id);
- conv_it->getParticipantID().toString(participant_id);
-
- bool is_adhoc = (conv_it->getConversationType() == LLIMModel::LLIMSession::ADHOC_SESSION);
- std::string conv_name = is_adhoc ? conv_it->getConversationName() : LLURI::escape(conv_it->getConversationName());
- std::string file_name = is_adhoc ? conv_it->getHistoryFileName() : LLURI::escape(conv_it->getHistoryFileName());
-
- // examples of two file entries
- // [1343221177] 0 1 0 John Doe| 7e4ec5be-783f-49f5-71dz-16c58c64c145 4ec62a74-c246-0d25-2af6-846beac2aa55 john.doe|
- // [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a|
- fprintf(fp, "[%lld] %d %d %d %s| %s %s %s|\n",
- (S64)conv_it->getTime().value(),
- (S32)conv_it->getConversationType(),
- (S32)0,
- (S32)conv_it->hasOfflineMessages(),
- conv_name.c_str(),
- participant_id.c_str(),
- conversation_id.c_str(),
- file_name.c_str());
- }
- fclose(fp);
- return true;
+ if (!filename.size())
+ {
+ LL_WARNS() << "Call log list filename is empty!" << LL_ENDL;
+ return false;
+ }
+
+ LLFILE* fp = LLFile::fopen(filename, "wb");
+ if (!fp)
+ {
+ LL_WARNS() << "Couldn't open call log list" << filename << LL_ENDL;
+ return false;
+ }
+
+ std::string participant_id;
+ std::string conversation_id;
+
+ conversations_vec_t::const_iterator conv_it = mConversations.begin();
+ for (; conv_it != mConversations.end(); ++conv_it)
+ {
+ conv_it->getSessionID().toString(conversation_id);
+ conv_it->getParticipantID().toString(participant_id);
+
+ bool is_adhoc = (conv_it->getConversationType() == LLIMModel::LLIMSession::ADHOC_SESSION);
+ std::string conv_name = is_adhoc ? conv_it->getConversationName() : LLURI::escape(conv_it->getConversationName());
+ std::string file_name = is_adhoc ? conv_it->getHistoryFileName() : LLURI::escape(conv_it->getHistoryFileName());
+
+ // examples of two file entries
+ // [1343221177] 0 1 0 John Doe| 7e4ec5be-783f-49f5-71dz-16c58c64c145 4ec62a74-c246-0d25-2af6-846beac2aa55 john.doe|
+ // [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a|
+ fprintf(fp, "[%lld] %d %d %d %s| %s %s %s|\n",
+ (S64)conv_it->getTime().value(),
+ (S32)conv_it->getConversationType(),
+ (S32)0,
+ (S32)conv_it->hasOfflineMessages(),
+ conv_name.c_str(),
+ participant_id.c_str(),
+ conversation_id.c_str(),
+ file_name.c_str());
+ }
+ fclose(fp);
+ return true;
}
bool LLConversationLog::loadFromFile(const std::string& filename)
{
- if(!filename.size())
- {
- LL_WARNS() << "Call log list filename is empty!" << LL_ENDL;
- return false;
- }
-
- LLFILE* fp = LLFile::fopen(filename, "rb");
- if (!fp)
- {
- LL_WARNS() << "Couldn't open call log list" << filename << LL_ENDL;
- return false;
- }
- bool purge_required = false;
-
- static constexpr int UTF_BUFFER{ 1024 }; // long enough to handle the most extreme Unicode nonsense and some to spare
-
- char buffer[UTF_BUFFER];
- char conv_name_buffer[MAX_STRING];
- char part_id_buffer[MAX_STRING];
- char conv_id_buffer[MAX_STRING];
- char history_file_name[MAX_STRING];
- S32 has_offline_ims;
- S32 stype;
- S64 time;
- // before CHUI-348 it was a flag of conversation voice state
- int prereserved_unused;
-
- memset(buffer, '\0', UTF_BUFFER);
- while (!feof(fp) && fgets(buffer, UTF_BUFFER, fp))
- {
+ if(!filename.size())
+ {
+ LL_WARNS() << "Call log list filename is empty!" << LL_ENDL;
+ return false;
+ }
+
+ LLFILE* fp = LLFile::fopen(filename, "rb");
+ if (!fp)
+ {
+ LL_WARNS() << "Couldn't open call log list" << filename << LL_ENDL;
+ return false;
+ }
+ bool purge_required = false;
+
+ static constexpr int UTF_BUFFER{ 1024 }; // long enough to handle the most extreme Unicode nonsense and some to spare
+
+ char buffer[UTF_BUFFER];
+ char conv_name_buffer[MAX_STRING];
+ char part_id_buffer[MAX_STRING];
+ char conv_id_buffer[MAX_STRING];
+ char history_file_name[MAX_STRING];
+ S32 has_offline_ims;
+ S32 stype;
+ S64 time;
+ // before CHUI-348 it was a flag of conversation voice state
+ int prereserved_unused;
+
+ memset(buffer, '\0', UTF_BUFFER);
+ while (!feof(fp) && fgets(buffer, UTF_BUFFER, fp))
+ {
// force blank for added safety
memset(conv_name_buffer, '\0', MAX_STRING);
memset(part_id_buffer, '\0', MAX_STRING);
memset(conv_id_buffer, '\0', MAX_STRING);
memset(history_file_name, '\0', MAX_STRING);
- sscanf(buffer, "[%lld] %d %d %d %[^|]| %s %s %[^|]|",
- &time,
- &stype,
- &prereserved_unused,
- &has_offline_ims,
- conv_name_buffer,
- part_id_buffer,
- conv_id_buffer,
- history_file_name);
-
- bool is_adhoc = ((SessionType)stype == LLIMModel::LLIMSession::ADHOC_SESSION);
- std::string conv_name = is_adhoc ? conv_name_buffer : LLURI::unescape(conv_name_buffer);
- std::string file_name = is_adhoc ? history_file_name : LLURI::unescape(history_file_name);
-
- ConversationParams params;
- params.time(LLUnits::Seconds::fromValue(time))
- .conversation_type((SessionType)stype)
- .has_offline_ims(has_offline_ims)
- .conversation_name(conv_name)
- .participant_id(LLUUID(part_id_buffer))
- .session_id(LLUUID(conv_id_buffer))
- .history_filename(file_name);
-
- LLConversation conversation(params);
-
- // CHUI-325
- // The conversation log should be capped to the last 30 days. Conversations with the last utterance
- // being over 30 days old should be purged from the conversation log text file on login.
- if (conversation.isOlderThan(CONVERSATION_LIFETIME))
- {
- purge_required = true;
- continue;
- }
-
- mConversations.push_back(conversation);
- memset(buffer, '\0', UTF_BUFFER);
- }
- fclose(fp);
-
- if(purge_required)
- {
- LLFile::remove(filename);
- cache();
- }
-
- notifyObservers();
- return true;
+ sscanf(buffer, "[%lld] %d %d %d %[^|]| %s %s %[^|]|",
+ &time,
+ &stype,
+ &prereserved_unused,
+ &has_offline_ims,
+ conv_name_buffer,
+ part_id_buffer,
+ conv_id_buffer,
+ history_file_name);
+
+ bool is_adhoc = ((SessionType)stype == LLIMModel::LLIMSession::ADHOC_SESSION);
+ std::string conv_name = is_adhoc ? conv_name_buffer : LLURI::unescape(conv_name_buffer);
+ std::string file_name = is_adhoc ? history_file_name : LLURI::unescape(history_file_name);
+
+ ConversationParams params;
+ params.time(LLUnits::Seconds::fromValue(time))
+ .conversation_type((SessionType)stype)
+ .has_offline_ims(has_offline_ims)
+ .conversation_name(conv_name)
+ .participant_id(LLUUID(part_id_buffer))
+ .session_id(LLUUID(conv_id_buffer))
+ .history_filename(file_name);
+
+ LLConversation conversation(params);
+
+ // CHUI-325
+ // The conversation log should be capped to the last 30 days. Conversations with the last utterance
+ // being over 30 days old should be purged from the conversation log text file on login.
+ if (conversation.isOlderThan(CONVERSATION_LIFETIME))
+ {
+ purge_required = true;
+ continue;
+ }
+
+ mConversations.push_back(conversation);
+ memset(buffer, '\0', UTF_BUFFER);
+ }
+ fclose(fp);
+
+ if(purge_required)
+ {
+ LLFile::remove(filename);
+ cache();
+ }
+
+ notifyObservers();
+ return true;
}
void LLConversationLog::notifyObservers()
{
- std::set<LLConversationLogObserver*>::const_iterator iter = mObservers.begin();
- for (; iter != mObservers.end(); ++iter)
- {
- (*iter)->changed();
- }
+ std::set<LLConversationLogObserver*>::const_iterator iter = mObservers.begin();
+ for (; iter != mObservers.end(); ++iter)
+ {
+ (*iter)->changed();
+ }
}
void LLConversationLog::notifyParticularConversationObservers(const LLUUID& session_id, U32 mask)
{
- std::set<LLConversationLogObserver*>::const_iterator iter = mObservers.begin();
- for (; iter != mObservers.end(); ++iter)
- {
- (*iter)->changed(session_id, mask);
- }
+ std::set<LLConversationLogObserver*>::const_iterator iter = mObservers.begin();
+ for (; iter != mObservers.end(); ++iter)
+ {
+ (*iter)->changed(session_id, mask);
+ }
}
void LLConversationLog::onNewMessageReceived(const LLSD& data)
{
- const LLUUID session_id = data["session_id"].asUUID();
- logConversation(session_id, false);
+ const LLUUID session_id = data["session_id"].asUUID();
+ logConversation(session_id, false);
}
void LLConversationLog::onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, const LLIMModel::LLIMSession* session)
{
- mAvatarNameCacheConnection.disconnect();
- updateConversationName(session, av_name.getCompleteName());
+ mAvatarNameCacheConnection.disconnect();
+ updateConversationName(session, av_name.getCompleteName());
}
void LLConversationLog::onClearLog()
{
- LLNotificationsUtil::add("PreferenceChatClearLog", LLSD(), LLSD(), boost::bind(&LLConversationLog::onClearLogResponse, this, _1, _2));
+ LLNotificationsUtil::add("PreferenceChatClearLog", LLSD(), LLSD(), boost::bind(&LLConversationLog::onClearLogResponse, this, _1, _2));
}
void LLConversationLog::onClearLogResponse(const LLSD& notification, const LLSD& response)
{
- if (0 == LLNotificationsUtil::getSelectedOption(notification, response))
- {
- mConversations.clear();
- notifyObservers();
- cache();
- deleteBackupLogs();
- }
+ if (0 == LLNotificationsUtil::getSelectedOption(notification, response))
+ {
+ mConversations.clear();
+ notifyObservers();
+ cache();
+ deleteBackupLogs();
+ }
}
diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h
index 54aeedcf9a..5d6b57233f 100644
--- a/indra/newview/llconversationlog.h
+++ b/indra/newview/llconversationlog.h
@@ -43,61 +43,61 @@ class LLConversation
{
public:
- LLConversation(const ConversationParams& params);
- LLConversation(const LLIMModel::LLIMSession& session);
- LLConversation(const LLConversation& conversation);
-
- ~LLConversation();
-
- const SessionType& getConversationType() const { return mConversationType; }
- const std::string& getConversationName() const { return mConversationName; }
- const std::string& getHistoryFileName() const { return mHistoryFileName; }
- const LLUUID& getSessionID() const { return mSessionID; }
- const LLUUID& getParticipantID() const { return mParticipantID; }
- const std::string& getTimestamp() const { return mTimestamp; }
- const U64Seconds&
- getTime() const { return mTime; }
- bool hasOfflineMessages() const { return mHasOfflineIMs; }
-
- void setConversationName(const std::string &conv_name) { mConversationName = conv_name; }
- void setOfflineMessages(bool new_messages) { mHasOfflineIMs = new_messages; }
- bool isOlderThan(U32Days days) const;
-
- /*
- * updates last interaction time
- */
- void updateTimestamp();
+ LLConversation(const ConversationParams& params);
+ LLConversation(const LLIMModel::LLIMSession& session);
+ LLConversation(const LLConversation& conversation);
+
+ ~LLConversation();
+
+ const SessionType& getConversationType() const { return mConversationType; }
+ const std::string& getConversationName() const { return mConversationName; }
+ const std::string& getHistoryFileName() const { return mHistoryFileName; }
+ const LLUUID& getSessionID() const { return mSessionID; }
+ const LLUUID& getParticipantID() const { return mParticipantID; }
+ const std::string& getTimestamp() const { return mTimestamp; }
+ const U64Seconds&
+ getTime() const { return mTime; }
+ bool hasOfflineMessages() const { return mHasOfflineIMs; }
+
+ void setConversationName(const std::string &conv_name) { mConversationName = conv_name; }
+ void setOfflineMessages(bool new_messages) { mHasOfflineIMs = new_messages; }
+ bool isOlderThan(U32Days days) const;
+
+ /*
+ * updates last interaction time
+ */
+ void updateTimestamp();
void updateHistoryFileName(const std::string &new_name) { mHistoryFileName = new_name; }
- /*
- * Resets flag of unread offline message to false when im floater with this conversation is opened.
- */
- void onIMFloaterShown(const LLUUID& session_id);
+ /*
+ * Resets flag of unread offline message to false when im floater with this conversation is opened.
+ */
+ void onIMFloaterShown(const LLUUID& session_id);
- /*
- * returns string representation(in form of: mm/dd/yyyy hh:mm) of time when conversation was started
- */
- static const std::string createTimestamp(const U64Seconds& utc_time);
+ /*
+ * returns string representation(in form of: mm/dd/yyyy hh:mm) of time when conversation was started
+ */
+ static const std::string createTimestamp(const U64Seconds& utc_time);
private:
- /*
- * If conversation has unread offline messages sets callback for opening LLFloaterIMSession
- * with this conversation.
- */
- void setListenIMFloaterOpened();
-
- boost::signals2::connection mIMFloaterShowedConnection;
-
- U64Seconds mTime; // last interaction time
- SessionType mConversationType;
- std::string mConversationName;
- std::string mHistoryFileName;
- LLUUID mSessionID;
- LLUUID mParticipantID;
- bool mHasOfflineIMs;
- std::string mTimestamp; // last interaction time in form of: mm/dd/yyyy hh:mm
+ /*
+ * If conversation has unread offline messages sets callback for opening LLFloaterIMSession
+ * with this conversation.
+ */
+ void setListenIMFloaterOpened();
+
+ boost::signals2::connection mIMFloaterShowedConnection;
+
+ U64Seconds mTime; // last interaction time
+ SessionType mConversationType;
+ std::string mConversationName;
+ std::string mHistoryFileName;
+ LLUUID mSessionID;
+ LLUUID mParticipantID;
+ bool mHasOfflineIMs;
+ std::string mTimestamp; // last interaction time in form of: mm/dd/yyyy hh:mm
};
/**
@@ -111,116 +111,116 @@ private:
class LLConversationLog : public LLSingleton<LLConversationLog>, LLIMSessionObserver
{
- LLSINGLETON(LLConversationLog);
+ LLSINGLETON(LLConversationLog);
public:
- void removeConversation(const LLConversation& conversation);
+ void removeConversation(const LLConversation& conversation);
- /**
- * Returns first conversation with matched session_id
- */
- const LLConversation* getConversation(const LLUUID& session_id);
- const std::vector<LLConversation>& getConversations() { return mConversations; }
+ /**
+ * Returns first conversation with matched session_id
+ */
+ const LLConversation* getConversation(const LLUUID& session_id);
+ const std::vector<LLConversation>& getConversations() { return mConversations; }
- void addObserver(LLConversationLogObserver* observer);
- void removeObserver(LLConversationLogObserver* observer);
+ void addObserver(LLConversationLogObserver* observer);
+ void removeObserver(LLConversationLogObserver* observer);
- // LLIMSessionObserver triggers
- virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) override;
+ // LLIMSessionObserver triggers
+ virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) override;
virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) override {}; // Stub
- virtual void sessionRemoved(const LLUUID& session_id) override{} // Stub
- virtual void sessionVoiceOrIMStarted(const LLUUID& session_id) override{}; // Stub
- virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) override{}; // Stub
+ virtual void sessionRemoved(const LLUUID& session_id) override{} // Stub
+ virtual void sessionVoiceOrIMStarted(const LLUUID& session_id) override{}; // Stub
+ virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) override{}; // Stub
- void notifyObservers();
+ void notifyObservers();
- void onNewMessageReceived(const LLSD& data);
+ void onNewMessageReceived(const LLSD& data);
- /**
- * public method which is called on viewer exit to save conversation log
- */
- void cache();
+ /**
+ * public method which is called on viewer exit to save conversation log
+ */
+ void cache();
// will check if current name is edentical with the one on disk and will rename the one on disk if it isn't
- void verifyFilename(const LLUUID& session_id, const std::string &expected_filename, const std::string &new_session_name);
- bool moveLog(const std::string &originDirectory, const std::string &targetDirectory);
- void getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs);
- void deleteBackupLogs();
-
- void onClearLog();
- void onClearLogResponse(const LLSD& notification, const LLSD& response);
-
- bool getIsLoggingEnabled() { return mLoggingEnabled; }
- bool isLogEmpty() { return mConversations.empty(); }
-
- /**
- * inits connection to per account settings,
- * loads saved file and inits enabled state
- */
- void initLoggingState();
-
- /**
- * constructs file name in which conversations log will be saved
- * file name is conversation.log
- */
- std::string getFileName();
- LLConversation* findConversation(const LLIMModel::LLIMSession* session);
+ void verifyFilename(const LLUUID& session_id, const std::string &expected_filename, const std::string &new_session_name);
+ bool moveLog(const std::string &originDirectory, const std::string &targetDirectory);
+ void getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs);
+ void deleteBackupLogs();
+
+ void onClearLog();
+ void onClearLogResponse(const LLSD& notification, const LLSD& response);
+
+ bool getIsLoggingEnabled() { return mLoggingEnabled; }
+ bool isLogEmpty() { return mConversations.empty(); }
+
+ /**
+ * inits connection to per account settings,
+ * loads saved file and inits enabled state
+ */
+ void initLoggingState();
+
+ /**
+ * constructs file name in which conversations log will be saved
+ * file name is conversation.log
+ */
+ std::string getFileName();
+ LLConversation* findConversation(const LLIMModel::LLIMSession* session);
private:
- virtual ~LLConversationLog()
- {
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- }
-
- void enableLogging(S32 log_mode);
+ virtual ~LLConversationLog()
+ {
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ }
- /**
- * adds conversation to the conversation list and notifies observers
- */
- void logConversation(const LLUUID& session_id, BOOL has_offline_msg);
+ void enableLogging(S32 log_mode);
- void notifyParticularConversationObservers(const LLUUID& session_id, U32 mask);
+ /**
+ * adds conversation to the conversation list and notifies observers
+ */
+ void logConversation(const LLUUID& session_id, BOOL has_offline_msg);
- bool saveToFile(const std::string& filename);
- bool loadFromFile(const std::string& filename);
+ void notifyParticularConversationObservers(const LLUUID& session_id, U32 mask);
- void onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, const LLIMModel::LLIMSession* session);
+ bool saveToFile(const std::string& filename);
+ bool loadFromFile(const std::string& filename);
- void createConversation(const LLIMModel::LLIMSession* session);
- void updateConversationTimestamp(LLConversation* conversation);
- void updateConversationName(const LLIMModel::LLIMSession* session, const std::string& name);
- void updateOfflineIMs(const LLIMModel::LLIMSession* session, BOOL new_messages);
+ void onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, const LLIMModel::LLIMSession* session);
+ void createConversation(const LLIMModel::LLIMSession* session);
+ void updateConversationTimestamp(LLConversation* conversation);
+ void updateConversationName(const LLIMModel::LLIMSession* session, const std::string& name);
+ void updateOfflineIMs(const LLIMModel::LLIMSession* session, BOOL new_messages);
- typedef std::vector<LLConversation> conversations_vec_t;
- std::vector<LLConversation> mConversations;
- std::set<LLConversationLogObserver*> mObservers;
- LLFriendObserver* mFriendObserver; // Observer of the LLAvatarTracker instance
+ typedef std::vector<LLConversation> conversations_vec_t;
+ std::vector<LLConversation> mConversations;
+ std::set<LLConversationLogObserver*> mObservers;
- boost::signals2::connection mNewMessageSignalConnection;
- boost::signals2::connection mAvatarNameCacheConnection;
+ LLFriendObserver* mFriendObserver; // Observer of the LLAvatarTracker instance
- bool mLoggingEnabled;
+ boost::signals2::connection mNewMessageSignalConnection;
+ boost::signals2::connection mAvatarNameCacheConnection;
+
+ bool mLoggingEnabled;
};
class LLConversationLogObserver
{
public:
- enum EConversationChange
- {
- CHANGED_TIME = 1, // last interaction time changed
- CHANGED_NAME = 2, // conversation name changed
- CHANGED_OfflineIMs = 3
- };
+ enum EConversationChange
+ {
+ CHANGED_TIME = 1, // last interaction time changed
+ CHANGED_NAME = 2, // conversation name changed
+ CHANGED_OfflineIMs = 3
+ };
- virtual ~LLConversationLogObserver(){}
- virtual void changed() = 0;
- virtual void changed(const LLUUID& session_id, U32 mask){};
+ virtual ~LLConversationLogObserver(){}
+ virtual void changed() = 0;
+ virtual void changed(const LLUUID& session_id, U32 mask){};
};
#endif /* LLCONVERSATIONLOG_H_ */
diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp
index 97b16a5e93..832d4c269b 100644
--- a/indra/newview/llconversationloglist.cpp
+++ b/indra/newview/llconversationloglist.cpp
@@ -41,75 +41,75 @@ static LLConversationLogListNameComparator NAME_COMPARATOR;
static LLConversationLogListDateComparator DATE_COMPARATOR;
LLConversationLogList::LLConversationLogList(const Params& p)
-: LLFlatListViewEx(p),
- mIsDirty(true)
+: LLFlatListViewEx(p),
+ mIsDirty(true)
{
- LLConversationLog::instance().addObserver(this);
-
- // Set up context menu.
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar check_registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
-
- registrar.add ("Calllog.Action", boost::bind(&LLConversationLogList::onCustomAction, this, _2));
- check_registrar.add ("Calllog.Check", boost::bind(&LLConversationLogList::isActionChecked,this, _2));
- enable_registrar.add("Calllog.Enable", boost::bind(&LLConversationLogList::isActionEnabled,this, _2));
-
- LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
- "menu_conversation_log_gear.xml",
- gMenuHolder,
- LLViewerMenuHolderGL::child_registry_t::instance());
- if(context_menu)
- {
- mContextMenu = context_menu->getHandle();
- }
-
- mIsFriendsOnTop = gSavedSettings.getBOOL("SortFriendsFirst");
+ LLConversationLog::instance().addObserver(this);
+
+ // Set up context menu.
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar check_registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+
+ registrar.add ("Calllog.Action", boost::bind(&LLConversationLogList::onCustomAction, this, _2));
+ check_registrar.add ("Calllog.Check", boost::bind(&LLConversationLogList::isActionChecked,this, _2));
+ enable_registrar.add("Calllog.Enable", boost::bind(&LLConversationLogList::isActionEnabled,this, _2));
+
+ LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
+ "menu_conversation_log_gear.xml",
+ gMenuHolder,
+ LLViewerMenuHolderGL::child_registry_t::instance());
+ if(context_menu)
+ {
+ mContextMenu = context_menu->getHandle();
+ }
+
+ mIsFriendsOnTop = gSavedSettings.getBOOL("SortFriendsFirst");
}
LLConversationLogList::~LLConversationLogList()
{
- if (mContextMenu.get())
- {
- mContextMenu.get()->die();
- }
+ if (mContextMenu.get())
+ {
+ mContextMenu.get()->die();
+ }
- LLConversationLog::instance().removeObserver(this);
+ LLConversationLog::instance().removeObserver(this);
}
void LLConversationLogList::draw()
{
- if (mIsDirty)
- {
- refresh();
- }
- LLFlatListViewEx::draw();
+ if (mIsDirty)
+ {
+ refresh();
+ }
+ LLFlatListViewEx::draw();
}
BOOL LLConversationLogList::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
+ BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
- LLToggleableMenu* context_menu = mContextMenu.get();
- {
- context_menu->buildDrawLabels();
- if (context_menu && size())
- context_menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(this, context_menu, x, y);
- }
+ LLToggleableMenu* context_menu = mContextMenu.get();
+ {
+ context_menu->buildDrawLabels();
+ if (context_menu && size())
+ context_menu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(this, context_menu, x, y);
+ }
- return handled;
+ return handled;
}
void LLConversationLogList::setNameFilter(const std::string& filter)
{
- std::string filter_upper = filter;
- LLStringUtil::toUpper(filter_upper);
- if (mNameFilter != filter_upper)
- {
- mNameFilter = filter_upper;
- setDirty();
- }
+ std::string filter_upper = filter;
+ LLStringUtil::toUpper(filter_upper);
+ if (mNameFilter != filter_upper)
+ {
+ mNameFilter = filter_upper;
+ setDirty();
+ }
}
bool LLConversationLogList::findInsensitive(std::string haystack, const std::string& needle_upper)
@@ -120,424 +120,424 @@ bool LLConversationLogList::findInsensitive(std::string haystack, const std::str
void LLConversationLogList::sortByName()
{
- setComparator(&NAME_COMPARATOR);
- sort();
+ setComparator(&NAME_COMPARATOR);
+ sort();
}
void LLConversationLogList::sortByDate()
{
- setComparator(&DATE_COMPARATOR);
- sort();
+ setComparator(&DATE_COMPARATOR);
+ sort();
}
void LLConversationLogList::toggleSortFriendsOnTop()
{
- mIsFriendsOnTop = !mIsFriendsOnTop;
- gSavedSettings.setBOOL("SortFriendsFirst", mIsFriendsOnTop);
- sort();
+ mIsFriendsOnTop = !mIsFriendsOnTop;
+ gSavedSettings.setBOOL("SortFriendsFirst", mIsFriendsOnTop);
+ sort();
}
void LLConversationLogList::changed()
{
- refresh();
+ refresh();
}
void LLConversationLogList::changed(const LLUUID& session_id, U32 mask)
{
- LLConversationLogListItem* item = getConversationLogListItem(session_id);
-
- if (!item)
- {
- return;
- }
-
- if (mask & LLConversationLogObserver::CHANGED_TIME)
- {
- item->updateTimestamp();
-
- // if list is sorted by date and a date of some item has changed,
- // than the whole list should be rebuilt
- if (E_SORT_BY_DATE == getSortOrder())
- {
- mIsDirty = true;
- }
- }
- else if (mask & LLConversationLogObserver::CHANGED_NAME)
- {
- item->updateName();
- // if list is sorted by name and a name of some item has changed,
- // than the whole list should be rebuilt
- if (E_SORT_BY_DATE == getSortOrder())
- {
- mIsDirty = true;
- }
- }
- else if (mask & LLConversationLogObserver::CHANGED_OfflineIMs)
- {
- item->updateOfflineIMs();
- }
+ LLConversationLogListItem* item = getConversationLogListItem(session_id);
+
+ if (!item)
+ {
+ return;
+ }
+
+ if (mask & LLConversationLogObserver::CHANGED_TIME)
+ {
+ item->updateTimestamp();
+
+ // if list is sorted by date and a date of some item has changed,
+ // than the whole list should be rebuilt
+ if (E_SORT_BY_DATE == getSortOrder())
+ {
+ mIsDirty = true;
+ }
+ }
+ else if (mask & LLConversationLogObserver::CHANGED_NAME)
+ {
+ item->updateName();
+ // if list is sorted by name and a name of some item has changed,
+ // than the whole list should be rebuilt
+ if (E_SORT_BY_DATE == getSortOrder())
+ {
+ mIsDirty = true;
+ }
+ }
+ else if (mask & LLConversationLogObserver::CHANGED_OfflineIMs)
+ {
+ item->updateOfflineIMs();
+ }
}
void LLConversationLogList::addNewItem(const LLConversation* conversation)
{
- LLConversationLogListItem* item = new LLConversationLogListItem(&*conversation);
- if (!mNameFilter.empty())
- {
- item->highlightNameDate(mNameFilter);
- }
- addItem(item, conversation->getSessionID(), ADD_TOP);
+ LLConversationLogListItem* item = new LLConversationLogListItem(&*conversation);
+ if (!mNameFilter.empty())
+ {
+ item->highlightNameDate(mNameFilter);
+ }
+ addItem(item, conversation->getSessionID(), ADD_TOP);
}
void LLConversationLogList::refresh()
{
- rebuildList();
- sort();
+ rebuildList();
+ sort();
- mIsDirty = false;
+ mIsDirty = false;
}
void LLConversationLogList::rebuildList()
{
- const LLConversation * selected_conversationp = getSelectedConversation();
-
- clear();
-
- bool have_filter = !mNameFilter.empty();
- LLConversationLog &log_instance = LLConversationLog::instance();
-
- const std::vector<LLConversation>& conversations = log_instance.getConversations();
- std::vector<LLConversation>::const_iterator iter = conversations.begin();
-
- for (; iter != conversations.end(); ++iter)
- {
- bool not_found = have_filter && !findInsensitive(iter->getConversationName(), mNameFilter) && !findInsensitive(iter->getTimestamp(), mNameFilter);
- if (not_found)
- continue;
-
- addNewItem(&*iter);
- }
-
- // try to restore selection of item
- if (NULL != selected_conversationp)
- {
- selectItemByUUID(selected_conversationp->getSessionID());
- }
-
- bool logging_enabled = log_instance.getIsLoggingEnabled();
- bool log_empty = log_instance.isLogEmpty();
- if (!logging_enabled && log_empty)
- {
- setNoItemsCommentText(LLTrans::getString("logging_calls_disabled_log_empty"));
- }
- else if (!logging_enabled && !log_empty)
- {
- setNoItemsCommentText(LLTrans::getString("logging_calls_disabled_log_not_empty"));
- }
- else if (logging_enabled && log_empty)
- {
- setNoItemsCommentText(LLTrans::getString("logging_calls_enabled_log_empty"));
- }
- else if (logging_enabled && !log_empty)
- {
- setNoItemsCommentText("");
- }
+ const LLConversation * selected_conversationp = getSelectedConversation();
+
+ clear();
+
+ bool have_filter = !mNameFilter.empty();
+ LLConversationLog &log_instance = LLConversationLog::instance();
+
+ const std::vector<LLConversation>& conversations = log_instance.getConversations();
+ std::vector<LLConversation>::const_iterator iter = conversations.begin();
+
+ for (; iter != conversations.end(); ++iter)
+ {
+ bool not_found = have_filter && !findInsensitive(iter->getConversationName(), mNameFilter) && !findInsensitive(iter->getTimestamp(), mNameFilter);
+ if (not_found)
+ continue;
+
+ addNewItem(&*iter);
+ }
+
+ // try to restore selection of item
+ if (NULL != selected_conversationp)
+ {
+ selectItemByUUID(selected_conversationp->getSessionID());
+ }
+
+ bool logging_enabled = log_instance.getIsLoggingEnabled();
+ bool log_empty = log_instance.isLogEmpty();
+ if (!logging_enabled && log_empty)
+ {
+ setNoItemsCommentText(LLTrans::getString("logging_calls_disabled_log_empty"));
+ }
+ else if (!logging_enabled && !log_empty)
+ {
+ setNoItemsCommentText(LLTrans::getString("logging_calls_disabled_log_not_empty"));
+ }
+ else if (logging_enabled && log_empty)
+ {
+ setNoItemsCommentText(LLTrans::getString("logging_calls_enabled_log_empty"));
+ }
+ else if (logging_enabled && !log_empty)
+ {
+ setNoItemsCommentText("");
+ }
}
void LLConversationLogList::onCustomAction(const LLSD& userdata)
{
- const LLConversation * selected_conversationp = getSelectedConversation();
-
- if (NULL == selected_conversationp)
- {
- return;
- }
-
- const std::string command_name = userdata.asString();
- const LLUUID& selected_conversation_participant_id = selected_conversationp->getParticipantID();
- const LLUUID& selected_conversation_session_id = selected_conversationp->getSessionID();
- LLIMModel::LLIMSession::SType stype = getSelectedSessionType();
-
- if ("im" == command_name)
- {
- switch (stype)
- {
- case LLIMModel::LLIMSession::P2P_SESSION:
- LLAvatarActions::startIM(selected_conversation_participant_id);
- break;
-
- case LLIMModel::LLIMSession::GROUP_SESSION:
- LLGroupActions::startIM(selected_conversation_session_id);
- break;
-
- default:
- break;
- }
- }
- else if ("call" == command_name)
- {
- switch (stype)
- {
- case LLIMModel::LLIMSession::P2P_SESSION:
- LLAvatarActions::startCall(selected_conversation_participant_id);
- break;
-
- case LLIMModel::LLIMSession::GROUP_SESSION:
- LLGroupActions::startCall(selected_conversation_session_id);
- break;
-
- default:
- break;
- }
- }
- else if ("view_profile" == command_name)
- {
- switch (stype)
- {
- case LLIMModel::LLIMSession::P2P_SESSION:
- LLAvatarActions::showProfile(selected_conversation_participant_id);
- break;
-
- case LLIMModel::LLIMSession::GROUP_SESSION:
- LLGroupActions::show(selected_conversation_session_id);
- break;
-
- default:
- break;
- }
- }
- else if ("chat_history" == command_name)
- {
- LLFloaterReg::showInstance("preview_conversation", selected_conversation_session_id, true);
- }
- else if ("offer_teleport" == command_name)
- {
- LLAvatarActions::offerTeleport(selected_conversation_participant_id);
- }
- else if ("request_teleport" == command_name)
- {
- LLAvatarActions::teleportRequest(selected_conversation_participant_id);
- }
- else if("add_friend" == command_name)
- {
- if (!LLAvatarActions::isFriend(selected_conversation_participant_id))
- {
- LLAvatarActions::requestFriendshipDialog(selected_conversation_participant_id);
- }
- }
- else if("remove_friend" == command_name)
- {
- if (LLAvatarActions::isFriend(selected_conversation_participant_id))
- {
- LLAvatarActions::removeFriendDialog(selected_conversation_participant_id);
- }
- }
- else if ("invite_to_group" == command_name)
- {
- LLAvatarActions::inviteToGroup(selected_conversation_participant_id);
- }
- else if ("show_on_map" == command_name)
- {
- LLAvatarActions::showOnMap(selected_conversation_participant_id);
- }
- else if ("share" == command_name)
- {
- LLAvatarActions::share(selected_conversation_participant_id);
- }
- else if ("pay" == command_name)
- {
- LLAvatarActions::pay(selected_conversation_participant_id);
- }
- else if ("block" == command_name)
- {
- LLAvatarActions::toggleBlock(selected_conversation_participant_id);
- }
+ const LLConversation * selected_conversationp = getSelectedConversation();
+
+ if (NULL == selected_conversationp)
+ {
+ return;
+ }
+
+ const std::string command_name = userdata.asString();
+ const LLUUID& selected_conversation_participant_id = selected_conversationp->getParticipantID();
+ const LLUUID& selected_conversation_session_id = selected_conversationp->getSessionID();
+ LLIMModel::LLIMSession::SType stype = getSelectedSessionType();
+
+ if ("im" == command_name)
+ {
+ switch (stype)
+ {
+ case LLIMModel::LLIMSession::P2P_SESSION:
+ LLAvatarActions::startIM(selected_conversation_participant_id);
+ break;
+
+ case LLIMModel::LLIMSession::GROUP_SESSION:
+ LLGroupActions::startIM(selected_conversation_session_id);
+ break;
+
+ default:
+ break;
+ }
+ }
+ else if ("call" == command_name)
+ {
+ switch (stype)
+ {
+ case LLIMModel::LLIMSession::P2P_SESSION:
+ LLAvatarActions::startCall(selected_conversation_participant_id);
+ break;
+
+ case LLIMModel::LLIMSession::GROUP_SESSION:
+ LLGroupActions::startCall(selected_conversation_session_id);
+ break;
+
+ default:
+ break;
+ }
+ }
+ else if ("view_profile" == command_name)
+ {
+ switch (stype)
+ {
+ case LLIMModel::LLIMSession::P2P_SESSION:
+ LLAvatarActions::showProfile(selected_conversation_participant_id);
+ break;
+
+ case LLIMModel::LLIMSession::GROUP_SESSION:
+ LLGroupActions::show(selected_conversation_session_id);
+ break;
+
+ default:
+ break;
+ }
+ }
+ else if ("chat_history" == command_name)
+ {
+ LLFloaterReg::showInstance("preview_conversation", selected_conversation_session_id, true);
+ }
+ else if ("offer_teleport" == command_name)
+ {
+ LLAvatarActions::offerTeleport(selected_conversation_participant_id);
+ }
+ else if ("request_teleport" == command_name)
+ {
+ LLAvatarActions::teleportRequest(selected_conversation_participant_id);
+ }
+ else if("add_friend" == command_name)
+ {
+ if (!LLAvatarActions::isFriend(selected_conversation_participant_id))
+ {
+ LLAvatarActions::requestFriendshipDialog(selected_conversation_participant_id);
+ }
+ }
+ else if("remove_friend" == command_name)
+ {
+ if (LLAvatarActions::isFriend(selected_conversation_participant_id))
+ {
+ LLAvatarActions::removeFriendDialog(selected_conversation_participant_id);
+ }
+ }
+ else if ("invite_to_group" == command_name)
+ {
+ LLAvatarActions::inviteToGroup(selected_conversation_participant_id);
+ }
+ else if ("show_on_map" == command_name)
+ {
+ LLAvatarActions::showOnMap(selected_conversation_participant_id);
+ }
+ else if ("share" == command_name)
+ {
+ LLAvatarActions::share(selected_conversation_participant_id);
+ }
+ else if ("pay" == command_name)
+ {
+ LLAvatarActions::pay(selected_conversation_participant_id);
+ }
+ else if ("block" == command_name)
+ {
+ LLAvatarActions::toggleBlock(selected_conversation_participant_id);
+ }
}
bool LLConversationLogList::isActionEnabled(const LLSD& userdata)
{
- const LLConversation * selected_conversationp = getSelectedConversation();
-
- if (NULL == selected_conversationp || numSelected() > 1)
- {
- return false;
- }
-
- const std::string command_name = userdata.asString();
-
- LLIMModel::LLIMSession::SType stype = getSelectedSessionType();
- const LLUUID& selected_id = selected_conversationp->getParticipantID();
-
- bool is_p2p = LLIMModel::LLIMSession::P2P_SESSION == stype;
- bool is_group = LLIMModel::LLIMSession::GROUP_SESSION == stype;
- bool is_group_member = is_group && gAgent.isInGroup(selected_id, TRUE);
-
- if ("can_im" == command_name)
- {
- return is_p2p || is_group_member;
- }
- else if ("can_view_profile" == command_name)
- {
- return is_p2p || is_group;
- }
- else if ("can_view_chat_history" == command_name)
- {
- return true;
- }
- else if ("can_call" == command_name)
- {
- return (is_p2p || is_group_member) && LLAvatarActions::canCall();
- }
- else if ("add_rem_friend" == command_name ||
- "can_invite_to_group" == command_name ||
- "can_share" == command_name ||
- "can_block" == command_name ||
- "can_pay" == command_name ||
- "report_abuse" == command_name)
- {
- return is_p2p;
- }
- else if("can_offer_teleport" == command_name)
- {
- return is_p2p && LLAvatarActions::canOfferTeleport(selected_id);
- }
- else if ("can_show_on_map" == command_name)
- {
- return is_p2p && ((LLAvatarTracker::instance().isBuddyOnline(selected_id) && is_agent_mappable(selected_id)) || gAgent.isGodlike());
- }
-
- return false;
+ const LLConversation * selected_conversationp = getSelectedConversation();
+
+ if (NULL == selected_conversationp || numSelected() > 1)
+ {
+ return false;
+ }
+
+ const std::string command_name = userdata.asString();
+
+ LLIMModel::LLIMSession::SType stype = getSelectedSessionType();
+ const LLUUID& selected_id = selected_conversationp->getParticipantID();
+
+ bool is_p2p = LLIMModel::LLIMSession::P2P_SESSION == stype;
+ bool is_group = LLIMModel::LLIMSession::GROUP_SESSION == stype;
+ bool is_group_member = is_group && gAgent.isInGroup(selected_id, TRUE);
+
+ if ("can_im" == command_name)
+ {
+ return is_p2p || is_group_member;
+ }
+ else if ("can_view_profile" == command_name)
+ {
+ return is_p2p || is_group;
+ }
+ else if ("can_view_chat_history" == command_name)
+ {
+ return true;
+ }
+ else if ("can_call" == command_name)
+ {
+ return (is_p2p || is_group_member) && LLAvatarActions::canCall();
+ }
+ else if ("add_rem_friend" == command_name ||
+ "can_invite_to_group" == command_name ||
+ "can_share" == command_name ||
+ "can_block" == command_name ||
+ "can_pay" == command_name ||
+ "report_abuse" == command_name)
+ {
+ return is_p2p;
+ }
+ else if("can_offer_teleport" == command_name)
+ {
+ return is_p2p && LLAvatarActions::canOfferTeleport(selected_id);
+ }
+ else if ("can_show_on_map" == command_name)
+ {
+ return is_p2p && ((LLAvatarTracker::instance().isBuddyOnline(selected_id) && is_agent_mappable(selected_id)) || gAgent.isGodlike());
+ }
+
+ return false;
}
bool LLConversationLogList::isActionChecked(const LLSD& userdata)
{
- const LLConversation * selected_conversationp = getSelectedConversation();
-
- if (NULL == selected_conversationp)
- {
- return false;
- }
-
- const std::string command_name = userdata.asString();
-
- const LLUUID& selected_id = selected_conversationp->getParticipantID();
- bool is_p2p = LLIMModel::LLIMSession::P2P_SESSION == getSelectedSessionType();
-
- if ("is_blocked" == command_name)
- {
- return is_p2p && LLAvatarActions::isBlocked(selected_id);
- }
- else if ("is_friend" == command_name)
- {
- return is_p2p && LLAvatarActions::isFriend(selected_id);
- }
- else if ("is_not_friend" == command_name)
- {
- return is_p2p && !LLAvatarActions::isFriend(selected_id);
- }
-
- return false;
+ const LLConversation * selected_conversationp = getSelectedConversation();
+
+ if (NULL == selected_conversationp)
+ {
+ return false;
+ }
+
+ const std::string command_name = userdata.asString();
+
+ const LLUUID& selected_id = selected_conversationp->getParticipantID();
+ bool is_p2p = LLIMModel::LLIMSession::P2P_SESSION == getSelectedSessionType();
+
+ if ("is_blocked" == command_name)
+ {
+ return is_p2p && LLAvatarActions::isBlocked(selected_id);
+ }
+ else if ("is_friend" == command_name)
+ {
+ return is_p2p && LLAvatarActions::isFriend(selected_id);
+ }
+ else if ("is_not_friend" == command_name)
+ {
+ return is_p2p && !LLAvatarActions::isFriend(selected_id);
+ }
+
+ return false;
}
LLIMModel::LLIMSession::SType LLConversationLogList::getSelectedSessionType()
{
- const LLConversationLogListItem* item = getSelectedConversationPanel();
+ const LLConversationLogListItem* item = getSelectedConversationPanel();
- if (item)
- {
- return item->getConversation()->getConversationType();
- }
+ if (item)
+ {
+ return item->getConversation()->getConversationType();
+ }
- return LLIMModel::LLIMSession::NONE_SESSION;
+ return LLIMModel::LLIMSession::NONE_SESSION;
}
const LLConversationLogListItem* LLConversationLogList::getSelectedConversationPanel()
{
- LLPanel* panel = LLFlatListViewEx::getSelectedItem();
- LLConversationLogListItem* conv_panel = dynamic_cast<LLConversationLogListItem*>(panel);
+ LLPanel* panel = LLFlatListViewEx::getSelectedItem();
+ LLConversationLogListItem* conv_panel = dynamic_cast<LLConversationLogListItem*>(panel);
- return conv_panel;
+ return conv_panel;
}
const LLConversation* LLConversationLogList::getSelectedConversation()
{
- const LLConversationLogListItem* panel = getSelectedConversationPanel();
+ const LLConversationLogListItem* panel = getSelectedConversationPanel();
- if (panel)
- {
- return panel->getConversation();
- }
+ if (panel)
+ {
+ return panel->getConversation();
+ }
- return NULL;
+ return NULL;
}
LLConversationLogListItem* LLConversationLogList::getConversationLogListItem(const LLUUID& session_id)
{
- std::vector<LLPanel*> panels;
- LLFlatListViewEx::getItems(panels);
- std::vector<LLPanel*>::iterator iter = panels.begin();
-
- for (; iter != panels.end(); ++iter)
- {
- LLConversationLogListItem* item = dynamic_cast<LLConversationLogListItem*>(*iter);
- if (item && session_id == item->getConversation()->getSessionID())
- {
- return item;
- }
- }
-
- return NULL;
+ std::vector<LLPanel*> panels;
+ LLFlatListViewEx::getItems(panels);
+ std::vector<LLPanel*>::iterator iter = panels.begin();
+
+ for (; iter != panels.end(); ++iter)
+ {
+ LLConversationLogListItem* item = dynamic_cast<LLConversationLogListItem*>(*iter);
+ if (item && session_id == item->getConversation()->getSessionID())
+ {
+ return item;
+ }
+ }
+
+ return NULL;
}
LLConversationLogList::ESortOrder LLConversationLogList::getSortOrder()
{
- return static_cast<ESortOrder>(gSavedSettings.getU32("CallLogSortOrder"));
+ return static_cast<ESortOrder>(gSavedSettings.getU32("CallLogSortOrder"));
}
bool LLConversationLogListItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const
{
- const LLConversationLogListItem* conversation_item1 = dynamic_cast<const LLConversationLogListItem*>(item1);
- const LLConversationLogListItem* conversation_item2 = dynamic_cast<const LLConversationLogListItem*>(item2);
+ const LLConversationLogListItem* conversation_item1 = dynamic_cast<const LLConversationLogListItem*>(item1);
+ const LLConversationLogListItem* conversation_item2 = dynamic_cast<const LLConversationLogListItem*>(item2);
- if (!conversation_item1 || !conversation_item2)
- {
- LL_ERRS() << "conversation_item1 and conversation_item2 cannot be null" << LL_ENDL;
- return true;
- }
+ if (!conversation_item1 || !conversation_item2)
+ {
+ LL_ERRS() << "conversation_item1 and conversation_item2 cannot be null" << LL_ENDL;
+ return true;
+ }
- return doCompare(conversation_item1, conversation_item2);
+ return doCompare(conversation_item1, conversation_item2);
}
bool LLConversationLogListNameComparator::doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const
{
- std::string name1 = conversation1->getConversation()->getConversationName();
- std::string name2 = conversation2->getConversation()->getConversationName();
- const LLUUID& id1 = conversation1->getConversation()->getParticipantID();
- const LLUUID& id2 = conversation2->getConversation()->getParticipantID();
+ std::string name1 = conversation1->getConversation()->getConversationName();
+ std::string name2 = conversation2->getConversation()->getConversationName();
+ const LLUUID& id1 = conversation1->getConversation()->getParticipantID();
+ const LLUUID& id2 = conversation2->getConversation()->getParticipantID();
- LLStringUtil::toUpper(name1);
- LLStringUtil::toUpper(name2);
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
- bool friends_first = gSavedSettings.getBOOL("SortFriendsFirst");
- if (friends_first && (LLAvatarActions::isFriend(id1) ^ LLAvatarActions::isFriend(id2)))
- {
- return LLAvatarActions::isFriend(id1);
- }
+ bool friends_first = gSavedSettings.getBOOL("SortFriendsFirst");
+ if (friends_first && (LLAvatarActions::isFriend(id1) ^ LLAvatarActions::isFriend(id2)))
+ {
+ return LLAvatarActions::isFriend(id1);
+ }
- return name1 < name2;
+ return name1 < name2;
}
bool LLConversationLogListDateComparator::doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const
{
- U64Seconds date1 = conversation1->getConversation()->getTime();
- U64Seconds date2 = conversation2->getConversation()->getTime();
- const LLUUID& id1 = conversation1->getConversation()->getParticipantID();
- const LLUUID& id2 = conversation2->getConversation()->getParticipantID();
-
- bool friends_first = gSavedSettings.getBOOL("SortFriendsFirst");
- if (friends_first && (LLAvatarActions::isFriend(id1) ^ LLAvatarActions::isFriend(id2)))
- {
- return LLAvatarActions::isFriend(id1);
- }
-
- return date1 > date2;
+ U64Seconds date1 = conversation1->getConversation()->getTime();
+ U64Seconds date2 = conversation2->getConversation()->getTime();
+ const LLUUID& id1 = conversation1->getConversation()->getParticipantID();
+ const LLUUID& id2 = conversation2->getConversation()->getParticipantID();
+
+ bool friends_first = gSavedSettings.getBOOL("SortFriendsFirst");
+ if (friends_first && (LLAvatarActions::isFriend(id1) ^ LLAvatarActions::isFriend(id2)))
+ {
+ return LLAvatarActions::isFriend(id1);
+ }
+
+ return date1 > date2;
}
diff --git a/indra/newview/llconversationloglist.h b/indra/newview/llconversationloglist.h
index 62ec57e09e..6435527b0d 100644
--- a/indra/newview/llconversationloglist.h
+++ b/indra/newview/llconversationloglist.h
@@ -41,69 +41,69 @@ class LLConversationLogListItem;
class LLConversationLogList: public LLFlatListViewEx, public LLConversationLogObserver
{
- LOG_CLASS(LLConversationLogList);
+ LOG_CLASS(LLConversationLogList);
public:
- typedef enum e_sort_oder{
- E_SORT_BY_NAME = 0,
- E_SORT_BY_DATE = 1,
- } ESortOrder;
+ typedef enum e_sort_oder{
+ E_SORT_BY_NAME = 0,
+ E_SORT_BY_DATE = 1,
+ } ESortOrder;
- struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
- {
- Params(){};
- };
+ struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
+ {
+ Params(){};
+ };
- LLConversationLogList(const Params& p);
- virtual ~LLConversationLogList();
+ LLConversationLogList(const Params& p);
+ virtual ~LLConversationLogList();
- virtual void draw();
+ virtual void draw();
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- LLToggleableMenu* getContextMenu() const { return mContextMenu.get(); }
+ LLToggleableMenu* getContextMenu() const { return mContextMenu.get(); }
- void addNewItem(const LLConversation* conversation);
- void setNameFilter(const std::string& filter);
- void sortByName();
- void sortByDate();
- void toggleSortFriendsOnTop();
- bool getSortFriendsOnTop() const { return mIsFriendsOnTop; }
+ void addNewItem(const LLConversation* conversation);
+ void setNameFilter(const std::string& filter);
+ void sortByName();
+ void sortByDate();
+ void toggleSortFriendsOnTop();
+ bool getSortFriendsOnTop() const { return mIsFriendsOnTop; }
- /**
- * Changes from LLConversationLogObserver
- */
- virtual void changed();
- virtual void changed(const LLUUID& session_id, U32 mask);
+ /**
+ * Changes from LLConversationLogObserver
+ */
+ virtual void changed();
+ virtual void changed(const LLUUID& session_id, U32 mask);
private:
- void setDirty(bool dirty = true) { mIsDirty = dirty; }
- void refresh();
+ void setDirty(bool dirty = true) { mIsDirty = dirty; }
+ void refresh();
- /**
- * Clears list and re-adds items from LLConverstationLog
- * If filter is not empty re-adds items which match the filter
- */
- void rebuildList();
+ /**
+ * Clears list and re-adds items from LLConverstationLog
+ * If filter is not empty re-adds items which match the filter
+ */
+ void rebuildList();
- bool findInsensitive(std::string haystack, const std::string& needle_upper);
+ bool findInsensitive(std::string haystack, const std::string& needle_upper);
- void onCustomAction (const LLSD& userdata);
- bool isActionEnabled(const LLSD& userdata);
- bool isActionChecked(const LLSD& userdata);
+ void onCustomAction (const LLSD& userdata);
+ bool isActionEnabled(const LLSD& userdata);
+ bool isActionChecked(const LLSD& userdata);
- LLIMModel::LLIMSession::SType getSelectedSessionType();
- const LLConversationLogListItem* getSelectedConversationPanel();
- const LLConversation* getSelectedConversation();
- LLConversationLogListItem* getConversationLogListItem(const LLUUID& session_id);
+ LLIMModel::LLIMSession::SType getSelectedSessionType();
+ const LLConversationLogListItem* getSelectedConversationPanel();
+ const LLConversation* getSelectedConversation();
+ LLConversationLogListItem* getConversationLogListItem(const LLUUID& session_id);
- ESortOrder getSortOrder();
+ ESortOrder getSortOrder();
- LLHandle<LLToggleableMenu> mContextMenu;
- bool mIsDirty;
- bool mIsFriendsOnTop;
- std::string mNameFilter;
+ LLHandle<LLToggleableMenu> mContextMenu;
+ bool mIsDirty;
+ bool mIsFriendsOnTop;
+ std::string mNameFilter;
};
/**
@@ -111,43 +111,43 @@ private:
*/
class LLConversationLogListItemComparator : public LLFlatListView::ItemComparator
{
- LOG_CLASS(LLConversationLogListItemComparator);
+ LOG_CLASS(LLConversationLogListItemComparator);
public:
- LLConversationLogListItemComparator() {};
- virtual ~LLConversationLogListItemComparator() {};
+ LLConversationLogListItemComparator() {};
+ virtual ~LLConversationLogListItemComparator() {};
- virtual bool compare(const LLPanel* item1, const LLPanel* item2) const;
+ virtual bool compare(const LLPanel* item1, const LLPanel* item2) const;
protected:
- virtual bool doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const = 0;
+ virtual bool doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const = 0;
};
class LLConversationLogListNameComparator : public LLConversationLogListItemComparator
{
- LOG_CLASS(LLConversationLogListNameComparator);
+ LOG_CLASS(LLConversationLogListNameComparator);
public:
- LLConversationLogListNameComparator() {};
- virtual ~LLConversationLogListNameComparator() {};
+ LLConversationLogListNameComparator() {};
+ virtual ~LLConversationLogListNameComparator() {};
protected:
- virtual bool doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const;
+ virtual bool doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const;
};
class LLConversationLogListDateComparator : public LLConversationLogListItemComparator
{
- LOG_CLASS(LLConversationLogListDateComparator);
+ LOG_CLASS(LLConversationLogListDateComparator);
public:
- LLConversationLogListDateComparator() {};
- virtual ~LLConversationLogListDateComparator() {};
+ LLConversationLogListDateComparator() {};
+ virtual ~LLConversationLogListDateComparator() {};
protected:
- virtual bool doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const;
+ virtual bool doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const;
};
#endif /* LLCONVERSATIONLOGLIST_H_ */
diff --git a/indra/newview/llconversationloglistitem.cpp b/indra/newview/llconversationloglistitem.cpp
index 4e984d603b..2c411ef0ef 100644
--- a/indra/newview/llconversationloglistitem.cpp
+++ b/indra/newview/llconversationloglistitem.cpp
@@ -40,145 +40,145 @@
#include "llinventoryicon.h"
LLConversationLogListItem::LLConversationLogListItem(const LLConversation* conversation)
-: LLPanel(),
- mConversation(conversation),
- mConversationName(NULL),
- mConversationDate(NULL)
+: LLPanel(),
+ mConversation(conversation),
+ mConversationName(NULL),
+ mConversationDate(NULL)
{
- buildFromFile("panel_conversation_log_list_item.xml");
+ buildFromFile("panel_conversation_log_list_item.xml");
- LLFloaterIMSession* floater = LLFloaterIMSession::findInstance(mConversation->getSessionID());
+ LLFloaterIMSession* floater = LLFloaterIMSession::findInstance(mConversation->getSessionID());
- bool ims_are_read = LLFloaterIMSession::isVisible(floater) && floater->hasFocus();
+ bool ims_are_read = LLFloaterIMSession::isVisible(floater) && floater->hasFocus();
- if (mConversation->hasOfflineMessages() && !ims_are_read)
- {
- mIMFloaterShowedConnection = LLFloaterIMSession::setIMFloaterShowedCallback(boost::bind(&LLConversationLogListItem::onIMFloaterShown, this, _1));
- }
+ if (mConversation->hasOfflineMessages() && !ims_are_read)
+ {
+ mIMFloaterShowedConnection = LLFloaterIMSession::setIMFloaterShowedCallback(boost::bind(&LLConversationLogListItem::onIMFloaterShown, this, _1));
+ }
}
LLConversationLogListItem::~LLConversationLogListItem()
{
- mIMFloaterShowedConnection.disconnect();
+ mIMFloaterShowedConnection.disconnect();
}
BOOL LLConversationLogListItem::postBuild()
{
- initIcons();
+ initIcons();
- // set conversation name
- mConversationName = getChild<LLTextBox>("conversation_name");
- mConversationName->setValue(mConversation->getConversationName());
+ // set conversation name
+ mConversationName = getChild<LLTextBox>("conversation_name");
+ mConversationName->setValue(mConversation->getConversationName());
- // set conversation date and time
- mConversationDate = getChild<LLTextBox>("date_time");
- mConversationDate->setValue(mConversation->getTimestamp());
+ // set conversation date and time
+ mConversationDate = getChild<LLTextBox>("date_time");
+ mConversationDate->setValue(mConversation->getTimestamp());
- getChild<LLButton>("delete_btn")->setClickedCallback(boost::bind(&LLConversationLogListItem::onRemoveBtnClicked, this));
- setDoubleClickCallback(boost::bind(&LLConversationLogListItem::onDoubleClick, this));
+ getChild<LLButton>("delete_btn")->setClickedCallback(boost::bind(&LLConversationLogListItem::onRemoveBtnClicked, this));
+ setDoubleClickCallback(boost::bind(&LLConversationLogListItem::onDoubleClick, this));
- return TRUE;
+ return TRUE;
}
void LLConversationLogListItem::initIcons()
{
- switch (mConversation->getConversationType())
- {
- case LLIMModel::LLIMSession::P2P_SESSION:
- case LLIMModel::LLIMSession::ADHOC_SESSION:
- {
- LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon");
- avatar_icon->setVisible(TRUE);
- avatar_icon->setValue(mConversation->getParticipantID());
- break;
- }
- case LLIMModel::LLIMSession::GROUP_SESSION:
- {
- LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon");
- group_icon->setVisible(TRUE);
- group_icon->setValue(mConversation->getSessionID());
- break;
- }
- default:
- break;
- }
-
- if (mConversation->hasOfflineMessages())
- {
- getChild<LLIconCtrl>("unread_ims_icon")->setVisible(TRUE);
- }
+ switch (mConversation->getConversationType())
+ {
+ case LLIMModel::LLIMSession::P2P_SESSION:
+ case LLIMModel::LLIMSession::ADHOC_SESSION:
+ {
+ LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon");
+ avatar_icon->setVisible(TRUE);
+ avatar_icon->setValue(mConversation->getParticipantID());
+ break;
+ }
+ case LLIMModel::LLIMSession::GROUP_SESSION:
+ {
+ LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon");
+ group_icon->setVisible(TRUE);
+ group_icon->setValue(mConversation->getSessionID());
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (mConversation->hasOfflineMessages())
+ {
+ getChild<LLIconCtrl>("unread_ims_icon")->setVisible(TRUE);
+ }
}
void LLConversationLogListItem::updateTimestamp()
{
- mConversationDate->setValue(mConversation->getTimestamp());
+ mConversationDate->setValue(mConversation->getTimestamp());
}
void LLConversationLogListItem::updateName()
{
- mConversationName->setValue(mConversation->getConversationName());
+ mConversationName->setValue(mConversation->getConversationName());
}
void LLConversationLogListItem::updateOfflineIMs()
{
- getChild<LLIconCtrl>("unread_ims_icon")->setVisible(mConversation->hasOfflineMessages());
+ getChild<LLIconCtrl>("unread_ims_icon")->setVisible(mConversation->hasOfflineMessages());
}
void LLConversationLogListItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible(true);
- LLPanel::onMouseEnter(x, y, mask);
+ getChildView("hovered_icon")->setVisible(true);
+ LLPanel::onMouseEnter(x, y, mask);
}
void LLConversationLogListItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible(false);
- LLPanel::onMouseLeave(x, y, mask);
+ getChildView("hovered_icon")->setVisible(false);
+ LLPanel::onMouseLeave(x, y, mask);
}
void LLConversationLogListItem::setValue(const LLSD& value)
{
- if (!value.isMap() || !value.has("selected"))
- {
- return;
- }
+ if (!value.isMap() || !value.has("selected"))
+ {
+ return;
+ }
- getChildView("selected_icon")->setVisible(value["selected"]);
+ getChildView("selected_icon")->setVisible(value["selected"]);
}
void LLConversationLogListItem::onIMFloaterShown(const LLUUID& session_id)
{
- if (mConversation->getSessionID() == session_id)
- {
- getChild<LLIconCtrl>("unread_ims_icon")->setVisible(FALSE);
- }
+ if (mConversation->getSessionID() == session_id)
+ {
+ getChild<LLIconCtrl>("unread_ims_icon")->setVisible(FALSE);
+ }
}
void LLConversationLogListItem::onRemoveBtnClicked()
{
- LLConversationLog::instance().removeConversation(*mConversation);
+ LLConversationLog::instance().removeConversation(*mConversation);
}
void LLConversationLogListItem::highlightNameDate(const std::string& highlited_text)
{
- LLStyle::Params params;
- LLTextUtil::textboxSetHighlightedVal(mConversationName, params, mConversation->getConversationName(), highlited_text);
- LLTextUtil::textboxSetHighlightedVal(mConversationDate, params, mConversation->getTimestamp(), highlited_text);
+ LLStyle::Params params;
+ LLTextUtil::textboxSetHighlightedVal(mConversationName, params, mConversation->getConversationName(), highlited_text);
+ LLTextUtil::textboxSetHighlightedVal(mConversationDate, params, mConversation->getTimestamp(), highlited_text);
}
void LLConversationLogListItem::onDoubleClick()
{
- switch (mConversation->getConversationType())
- {
- case LLIMModel::LLIMSession::P2P_SESSION:
- LLAvatarActions::startIM(mConversation->getParticipantID());
- break;
-
- case LLIMModel::LLIMSession::GROUP_SESSION:
- LLGroupActions::startIM(mConversation->getSessionID());
- break;
-
- default:
- break;
- }
+ switch (mConversation->getConversationType())
+ {
+ case LLIMModel::LLIMSession::P2P_SESSION:
+ LLAvatarActions::startIM(mConversation->getParticipantID());
+ break;
+
+ case LLIMModel::LLIMSession::GROUP_SESSION:
+ LLGroupActions::startIM(mConversation->getSessionID());
+ break;
+
+ default:
+ break;
+ }
}
diff --git a/indra/newview/llconversationloglistitem.h b/indra/newview/llconversationloglistitem.h
index ee28456bbb..9c13efc6cb 100644
--- a/indra/newview/llconversationloglistitem.h
+++ b/indra/newview/llconversationloglistitem.h
@@ -36,51 +36,51 @@ class LLConversation;
* This class is a visual representation of LLConversation, each of which is LLConversationLog entry.
* LLConversationLogList consists of these LLConversationLogListItems.
* LLConversationLogListItem consists of:
- * conversaion_type_icon
- * conversaion_name
- * conversaion_date
+ * conversaion_type_icon
+ * conversaion_name
+ * conversaion_date
* Also LLConversationLogListItem holds pointer to its LLConversationLog.
*/
class LLConversationLogListItem : public LLPanel
{
public:
- LLConversationLogListItem(const LLConversation* conversation);
- virtual ~LLConversationLogListItem();
+ LLConversationLogListItem(const LLConversation* conversation);
+ virtual ~LLConversationLogListItem();
- void onMouseEnter(S32 x, S32 y, MASK mask);
- void onMouseLeave(S32 x, S32 y, MASK mask);
+ void onMouseEnter(S32 x, S32 y, MASK mask);
+ void onMouseLeave(S32 x, S32 y, MASK mask);
- virtual void setValue(const LLSD& value);
+ virtual void setValue(const LLSD& value);
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- void onIMFloaterShown(const LLUUID& session_id);
- void onRemoveBtnClicked();
+ void onIMFloaterShown(const LLUUID& session_id);
+ void onRemoveBtnClicked();
- const LLConversation* getConversation() const { return mConversation; }
+ const LLConversation* getConversation() const { return mConversation; }
- void highlightNameDate(const std::string& highlited_text);
+ void highlightNameDate(const std::string& highlited_text);
- void onDoubleClick();
+ void onDoubleClick();
- /**
- * updates string value of last interaction time from conversation
- */
- void updateTimestamp();
- void updateName();
- void updateOfflineIMs();
+ /**
+ * updates string value of last interaction time from conversation
+ */
+ void updateTimestamp();
+ void updateName();
+ void updateOfflineIMs();
private:
- void initIcons();
+ void initIcons();
- const LLConversation* mConversation;
+ const LLConversation* mConversation;
- LLTextBox* mConversationName;
- LLTextBox* mConversationDate;
+ LLTextBox* mConversationName;
+ LLTextBox* mConversationDate;
- boost::signals2::connection mIMFloaterShowedConnection;
+ boost::signals2::connection mIMFloaterShowedConnection;
};
#endif /* LLCONVERSATIONLOGITEM_H_ */
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index f152e36cf5..4335168417 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llconversationmodel.cpp
* @brief Implementation of conversations list
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,52 +42,52 @@
//
LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) :
- LLFolderViewModelItemCommon(root_view_model),
- mName(display_name),
- mUUID(uuid),
- mNeedsRefresh(true),
- mConvType(CONV_UNKNOWN),
- mLastActiveTime(0.0),
- mDisplayModeratorOptions(false),
- mDisplayGroupBanOptions(false),
- mAvatarNameCacheConnection()
+ LLFolderViewModelItemCommon(root_view_model),
+ mName(display_name),
+ mUUID(uuid),
+ mNeedsRefresh(true),
+ mConvType(CONV_UNKNOWN),
+ mLastActiveTime(0.0),
+ mDisplayModeratorOptions(false),
+ mDisplayGroupBanOptions(false),
+ mAvatarNameCacheConnection()
{
}
LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) :
- LLFolderViewModelItemCommon(root_view_model),
- mName(""),
- mUUID(uuid),
- mNeedsRefresh(true),
- mConvType(CONV_UNKNOWN),
- mLastActiveTime(0.0),
- mDisplayModeratorOptions(false),
- mDisplayGroupBanOptions(false),
- mAvatarNameCacheConnection()
+ LLFolderViewModelItemCommon(root_view_model),
+ mName(""),
+ mUUID(uuid),
+ mNeedsRefresh(true),
+ mConvType(CONV_UNKNOWN),
+ mLastActiveTime(0.0),
+ mDisplayModeratorOptions(false),
+ mDisplayGroupBanOptions(false),
+ mAvatarNameCacheConnection()
{
}
LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) :
- LLFolderViewModelItemCommon(root_view_model),
- mName(""),
- mUUID(),
- mNeedsRefresh(true),
- mConvType(CONV_UNKNOWN),
- mLastActiveTime(0.0),
- mDisplayModeratorOptions(false),
- mDisplayGroupBanOptions(false),
- mAvatarNameCacheConnection()
+ LLFolderViewModelItemCommon(root_view_model),
+ mName(""),
+ mUUID(),
+ mNeedsRefresh(true),
+ mConvType(CONV_UNKNOWN),
+ mLastActiveTime(0.0),
+ mDisplayModeratorOptions(false),
+ mDisplayGroupBanOptions(false),
+ mAvatarNameCacheConnection()
{
}
LLConversationItem::~LLConversationItem()
{
- // Disconnect any previous avatar name cache connection to ensure
- // that the callback method is not called after destruction
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ // Disconnect any previous avatar name cache connection to ensure
+ // that the callback method is not called after destruction
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
clearChildren();
}
@@ -111,10 +111,10 @@ void LLConversationItem::addChild(LLFolderViewModelItem* child)
void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemSession* session, LLConversationItemParticipant* participant)
{
- LLUUID session_id = (session ? session->getUUID() : LLUUID());
- LLUUID participant_id = (participant ? participant->getUUID() : LLUUID());
- LLSD event(LLSDMap("type", event_type)("session_uuid", session_id)("participant_uuid", participant_id));
- LLEventPumps::instance().obtain("ConversationsEvents").post(event);
+ LLUUID session_id = (session ? session->getUUID() : LLUUID());
+ LLUUID participant_id = (participant ? participant->getUUID() : LLUUID());
+ LLSD event(LLSDMap("type", event_type)("session_uuid", session_id)("participant_uuid", participant_id));
+ LLEventPumps::instance().obtain("ConversationsEvents").post(event);
}
// Virtual action callbacks
@@ -140,118 +140,118 @@ void LLConversationItem::showProperties(void)
void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items, U32 flags)
{
- if (flags & ITEM_IN_MULTI_SELECTION)
- {
- items.push_back(std::string("im"));
- items.push_back(std::string("offer_teleport"));
- items.push_back(std::string("voice_call"));
- items.push_back(std::string("remove_friends"));
- }
- else
- {
- items.push_back(std::string("view_profile"));
- items.push_back(std::string("im"));
- items.push_back(std::string("offer_teleport"));
- items.push_back(std::string("request_teleport"));
-
- if (getType() != CONV_SESSION_1_ON_1)
- {
- items.push_back(std::string("voice_call"));
- }
- else
- {
- LLVoiceChannel* voice_channel = LLIMModel::getInstance() ? LLIMModel::getInstance()->getVoiceChannel(this->getUUID()) : NULL;
- if(voice_channel != LLVoiceChannel::getCurrentVoiceChannel())
- {
- items.push_back(std::string("voice_call"));
- }
- else
- {
- items.push_back(std::string("disconnect_from_voice"));
- }
- }
-
- items.push_back(std::string("chat_history"));
- items.push_back(std::string("separator_chat_history"));
- items.push_back(std::string("add_friend"));
- items.push_back(std::string("remove_friend"));
- items.push_back(std::string("invite_to_group"));
- items.push_back(std::string("separator_invite_to_group"));
- if (static_cast<LLConversationItem*>(mParent)->getType() == CONV_SESSION_NEARBY)
- items.push_back(std::string("zoom_in"));
- items.push_back(std::string("map"));
- items.push_back(std::string("share"));
- items.push_back(std::string("pay"));
+ if (flags & ITEM_IN_MULTI_SELECTION)
+ {
+ items.push_back(std::string("im"));
+ items.push_back(std::string("offer_teleport"));
+ items.push_back(std::string("voice_call"));
+ items.push_back(std::string("remove_friends"));
+ }
+ else
+ {
+ items.push_back(std::string("view_profile"));
+ items.push_back(std::string("im"));
+ items.push_back(std::string("offer_teleport"));
+ items.push_back(std::string("request_teleport"));
+
+ if (getType() != CONV_SESSION_1_ON_1)
+ {
+ items.push_back(std::string("voice_call"));
+ }
+ else
+ {
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance() ? LLIMModel::getInstance()->getVoiceChannel(this->getUUID()) : NULL;
+ if(voice_channel != LLVoiceChannel::getCurrentVoiceChannel())
+ {
+ items.push_back(std::string("voice_call"));
+ }
+ else
+ {
+ items.push_back(std::string("disconnect_from_voice"));
+ }
+ }
+
+ items.push_back(std::string("chat_history"));
+ items.push_back(std::string("separator_chat_history"));
+ items.push_back(std::string("add_friend"));
+ items.push_back(std::string("remove_friend"));
+ items.push_back(std::string("invite_to_group"));
+ items.push_back(std::string("separator_invite_to_group"));
+ if (static_cast<LLConversationItem*>(mParent)->getType() == CONV_SESSION_NEARBY)
+ items.push_back(std::string("zoom_in"));
+ items.push_back(std::string("map"));
+ items.push_back(std::string("share"));
+ items.push_back(std::string("pay"));
items.push_back(std::string("report_abuse"));
- items.push_back(std::string("block_unblock"));
- items.push_back(std::string("MuteText"));
-
- if ((getType() != CONV_SESSION_1_ON_1) && mDisplayModeratorOptions)
- {
- items.push_back(std::string("Moderator Options Separator"));
- items.push_back(std::string("Moderator Options"));
- items.push_back(std::string("AllowTextChat"));
- items.push_back(std::string("moderate_voice_separator"));
- items.push_back(std::string("ModerateVoiceMuteSelected"));
- items.push_back(std::string("ModerateVoiceUnMuteSelected"));
- items.push_back(std::string("ModerateVoiceMute"));
- items.push_back(std::string("ModerateVoiceUnmute"));
- }
-
- if ((getType() != CONV_SESSION_1_ON_1) && mDisplayGroupBanOptions)
- {
- items.push_back(std::string("Group Ban Separator"));
- items.push_back(std::string("BanMember"));
- }
- }
+ items.push_back(std::string("block_unblock"));
+ items.push_back(std::string("MuteText"));
+
+ if ((getType() != CONV_SESSION_1_ON_1) && mDisplayModeratorOptions)
+ {
+ items.push_back(std::string("Moderator Options Separator"));
+ items.push_back(std::string("Moderator Options"));
+ items.push_back(std::string("AllowTextChat"));
+ items.push_back(std::string("moderate_voice_separator"));
+ items.push_back(std::string("ModerateVoiceMuteSelected"));
+ items.push_back(std::string("ModerateVoiceUnMuteSelected"));
+ items.push_back(std::string("ModerateVoiceMute"));
+ items.push_back(std::string("ModerateVoiceUnmute"));
+ }
+
+ if ((getType() != CONV_SESSION_1_ON_1) && mDisplayGroupBanOptions)
+ {
+ items.push_back(std::string("Group Ban Separator"));
+ items.push_back(std::string("BanMember"));
+ }
+ }
}
// method does subscription to changes in avatar name cache for current session/participant conversation item.
void LLConversationItem::fetchAvatarName(bool isParticipant /*= true*/)
{
- LLUUID item_id = getUUID();
+ LLUUID item_id = getUUID();
- // item should not be null for participants
- if (isParticipant)
- {
- llassert(item_id.notNull());
- }
+ // item should not be null for participants
+ if (isParticipant)
+ {
+ llassert(item_id.notNull());
+ }
- // disconnect any previous avatar name cache connection
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ // disconnect any previous avatar name cache connection
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
- // exclude nearby chat item
- if (item_id.notNull())
- {
- // for P2P session item, override it as item of called agent
- if (CONV_SESSION_1_ON_1 == getType())
- {
- item_id = LLIMModel::getInstance()->getOtherParticipantID(item_id);
- }
+ // exclude nearby chat item
+ if (item_id.notNull())
+ {
+ // for P2P session item, override it as item of called agent
+ if (CONV_SESSION_1_ON_1 == getType())
+ {
+ item_id = LLIMModel::getInstance()->getOtherParticipantID(item_id);
+ }
- // subscribe on avatar name cache changes for participant and session items
- mAvatarNameCacheConnection = LLAvatarNameCache::get(item_id, boost::bind(&LLConversationItem::onAvatarNameCache, this, _2));
- }
+ // subscribe on avatar name cache changes for participant and session items
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(item_id, boost::bind(&LLConversationItem::onAvatarNameCache, this, _2));
+ }
}
//
// LLConversationItemSession
-//
+//
LLConversationItemSession::LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) :
- LLConversationItem(display_name,uuid,root_view_model),
- mIsLoaded(false)
+ LLConversationItem(display_name,uuid,root_view_model),
+ mIsLoaded(false)
{
- mConvType = CONV_SESSION_UNKNOWN;
+ mConvType = CONV_SESSION_UNKNOWN;
}
LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) :
- LLConversationItem(uuid,root_view_model)
+ LLConversationItem(uuid,root_view_model)
{
- mConvType = CONV_SESSION_UNKNOWN;
+ mConvType = CONV_SESSION_UNKNOWN;
}
LLConversationItemSession::~LLConversationItemSession()
@@ -261,87 +261,87 @@ LLConversationItemSession::~LLConversationItemSession()
bool LLConversationItemSession::hasChildren() const
{
- return getChildrenCount() > 0;
+ return getChildrenCount() > 0;
}
void LLConversationItemSession::addParticipant(LLConversationItemParticipant* participant)
{
- addChild(participant);
- mIsLoaded = true;
- mNeedsRefresh = true;
- updateName(participant);
- postEvent("add_participant", this, participant);
+ addChild(participant);
+ mIsLoaded = true;
+ mNeedsRefresh = true;
+ updateName(participant);
+ postEvent("add_participant", this, participant);
}
void LLConversationItemSession::updateName(LLConversationItemParticipant* participant)
{
- EConversationType conversation_type = getType();
- // We modify the session name only in the case of an ad-hoc session or P2P session, exit otherwise (nothing to do)
- if ((conversation_type != CONV_SESSION_AD_HOC) && (conversation_type != CONV_SESSION_1_ON_1))
- {
- return;
- }
-
- // Avoid changing the default name if no participant present yet
- if (mChildren.size() == 0)
- {
- return;
- }
-
- uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string
- if (conversation_type == CONV_SESSION_AD_HOC || conversation_type == CONV_SESSION_1_ON_1)
- {
- // Build a string containing the participants UUIDs (minus own agent) and check if ready for display (we don't want "(waiting)" in there)
- // Note: we don't bind ourselves to the LLAvatarNameCache event as updateParticipantName() is called by
- // onAvatarNameCache() which is itself attached to the same event.
-
- // In the case of a P2P conversation, we need to grab the name of the other participant in the session instance itself
- // as we do not create participants for such a session.
-
- for (auto itemp : mChildren)
- {
- LLConversationItem* current_participant = dynamic_cast<LLConversationItem*>(itemp);
- // Add the avatar uuid to the list (except if it's the own agent uuid)
- if (current_participant->getUUID() != gAgentID)
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(current_participant->getUUID(), &av_name))
- {
- temp_uuids.push_back(current_participant->getUUID());
-
- if (conversation_type == CONV_SESSION_1_ON_1)
- {
- break;
- }
- }
- }
- }
- }
-
- if (temp_uuids.size() != 0)
- {
- std::string new_session_name;
- LLAvatarActions::buildResidentsString(temp_uuids, new_session_name);
- renameItem(new_session_name);
- postEvent("update_session", this, NULL);
- }
+ EConversationType conversation_type = getType();
+ // We modify the session name only in the case of an ad-hoc session or P2P session, exit otherwise (nothing to do)
+ if ((conversation_type != CONV_SESSION_AD_HOC) && (conversation_type != CONV_SESSION_1_ON_1))
+ {
+ return;
+ }
+
+ // Avoid changing the default name if no participant present yet
+ if (mChildren.size() == 0)
+ {
+ return;
+ }
+
+ uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string
+ if (conversation_type == CONV_SESSION_AD_HOC || conversation_type == CONV_SESSION_1_ON_1)
+ {
+ // Build a string containing the participants UUIDs (minus own agent) and check if ready for display (we don't want "(waiting)" in there)
+ // Note: we don't bind ourselves to the LLAvatarNameCache event as updateParticipantName() is called by
+ // onAvatarNameCache() which is itself attached to the same event.
+
+ // In the case of a P2P conversation, we need to grab the name of the other participant in the session instance itself
+ // as we do not create participants for such a session.
+
+ for (auto itemp : mChildren)
+ {
+ LLConversationItem* current_participant = dynamic_cast<LLConversationItem*>(itemp);
+ // Add the avatar uuid to the list (except if it's the own agent uuid)
+ if (current_participant->getUUID() != gAgentID)
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(current_participant->getUUID(), &av_name))
+ {
+ temp_uuids.push_back(current_participant->getUUID());
+
+ if (conversation_type == CONV_SESSION_1_ON_1)
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (temp_uuids.size() != 0)
+ {
+ std::string new_session_name;
+ LLAvatarActions::buildResidentsString(temp_uuids, new_session_name);
+ renameItem(new_session_name);
+ postEvent("update_session", this, NULL);
+ }
}
void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant)
{
- removeChild(participant);
- mNeedsRefresh = true;
- updateName(participant);
- postEvent("remove_participant", this, participant);
+ removeChild(participant);
+ mNeedsRefresh = true;
+ updateName(participant);
+ postEvent("remove_participant", this, participant);
}
void LLConversationItemSession::removeParticipant(const LLUUID& participant_id)
{
- LLConversationItemParticipant* participant = findParticipant(participant_id);
- if (participant)
- {
- removeParticipant(participant);
- }
+ LLConversationItemParticipant* participant = findParticipant(participant_id);
+ if (participant)
+ {
+ removeParticipant(participant);
+ }
}
void LLConversationItemSession::clearParticipants()
@@ -349,9 +349,9 @@ void LLConversationItemSession::clearParticipants()
// clearParticipants function potentially is malfunctioning since it only cleans children of models,
// it does nothing to views that own those models (listeners)
// probably needs to post some kind of 'remove all participants' event
- clearChildren();
- mIsLoaded = false;
- mNeedsRefresh = true;
+ clearChildren();
+ mIsLoaded = false;
+ mNeedsRefresh = true;
}
@@ -378,58 +378,58 @@ void LLConversationItemSession::clearAndDeparentModels()
LLConversationItemParticipant* LLConversationItemSession::findParticipant(const LLUUID& participant_id)
{
- // This is *not* a general tree parsing algorithm. It assumes that a session contains only
- // items (LLConversationItemParticipant) that have themselve no children.
- LLConversationItemParticipant* participant = NULL;
- child_list_t::iterator iter;
- for (iter = mChildren.begin(); iter != mChildren.end(); iter++)
- {
- participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
- if (participant && participant->hasSameValue(participant_id))
- {
- break;
- }
- }
- return (iter == mChildren.end() ? NULL : participant);
+ // This is *not* a general tree parsing algorithm. It assumes that a session contains only
+ // items (LLConversationItemParticipant) that have themselve no children.
+ LLConversationItemParticipant* participant = NULL;
+ child_list_t::iterator iter;
+ for (iter = mChildren.begin(); iter != mChildren.end(); iter++)
+ {
+ participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
+ if (participant && participant->hasSameValue(participant_id))
+ {
+ break;
+ }
+ }
+ return (iter == mChildren.end() ? NULL : participant);
}
void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_id, bool is_muted)
{
- LLConversationItemParticipant* participant = findParticipant(participant_id);
- if (participant)
- {
- participant->moderateVoice(is_muted);
- }
+ LLConversationItemParticipant* participant = findParticipant(participant_id);
+ if (participant)
+ {
+ participant->moderateVoice(is_muted);
+ }
}
void LLConversationItemSession::setParticipantIsModerator(const LLUUID& participant_id, bool is_moderator)
{
- LLConversationItemParticipant* participant = findParticipant(participant_id);
- if (participant)
- {
- participant->setIsModerator(is_moderator);
- }
+ LLConversationItemParticipant* participant = findParticipant(participant_id);
+ if (participant)
+ {
+ participant->setIsModerator(is_moderator);
+ }
}
void LLConversationItemSession::setTimeNow(const LLUUID& participant_id)
{
- mLastActiveTime = LLFrameTimer::getElapsedSeconds();
- mNeedsRefresh = true;
- LLConversationItemParticipant* participant = findParticipant(participant_id);
- if (participant)
- {
- participant->setTimeNow();
- }
+ mLastActiveTime = LLFrameTimer::getElapsedSeconds();
+ mNeedsRefresh = true;
+ LLConversationItemParticipant* participant = findParticipant(participant_id);
+ if (participant)
+ {
+ participant->setTimeNow();
+ }
}
void LLConversationItemSession::setDistance(const LLUUID& participant_id, F64 dist)
{
- LLConversationItemParticipant* participant = findParticipant(participant_id);
- if (participant)
- {
- participant->setDistance(dist);
- mNeedsRefresh = true;
- }
+ LLConversationItemParticipant* participant = findParticipant(participant_id);
+ if (participant)
+ {
+ participant->setDistance(dist);
+ mNeedsRefresh = true;
+ }
}
void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags)
@@ -439,7 +439,7 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags)
menuentry_vec_t disabled_items;
if((flags & ITEM_IN_MULTI_SELECTION) && (this->getType() != CONV_SESSION_NEARBY))
{
- items.push_back(std::string("close_selected_conversations"));
+ items.push_back(std::string("close_selected_conversations"));
}
if(this->getType() == CONV_SESSION_1_ON_1)
{
@@ -488,280 +488,280 @@ void LLConversationItemSession::addVoiceOptions(menuentry_vec_t& items)
// The time of activity of a session is the time of the most recent activity, session and participants included
const bool LLConversationItemSession::getTime(F64& time) const
{
- F64 most_recent_time = mLastActiveTime;
- bool has_time = (most_recent_time > 0.1);
- LLConversationItemParticipant* participant = NULL;
- child_list_t::const_iterator iter;
- for (iter = mChildren.begin(); iter != mChildren.end(); iter++)
- {
- participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
- F64 participant_time;
- if (participant && participant->getTime(participant_time))
- {
- has_time = true;
- most_recent_time = llmax(most_recent_time,participant_time);
- }
- }
- if (has_time)
- {
- time = most_recent_time;
- }
- return has_time;
+ F64 most_recent_time = mLastActiveTime;
+ bool has_time = (most_recent_time > 0.1);
+ LLConversationItemParticipant* participant = NULL;
+ child_list_t::const_iterator iter;
+ for (iter = mChildren.begin(); iter != mChildren.end(); iter++)
+ {
+ participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
+ F64 participant_time;
+ if (participant && participant->getTime(participant_time))
+ {
+ has_time = true;
+ most_recent_time = llmax(most_recent_time,participant_time);
+ }
+ }
+ if (has_time)
+ {
+ time = most_recent_time;
+ }
+ return has_time;
}
void LLConversationItemSession::dumpDebugData(bool dump_children)
{
- // Session info
- LL_INFOS() << "Merov debug : session " << this << ", uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << LL_ENDL;
- // Children info
- if (dump_children)
- {
- for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); iter++)
- {
- LLConversationItemParticipant* participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
- if (participant)
- {
- participant->dumpDebugData();
- }
- }
- }
+ // Session info
+ LL_INFOS() << "Merov debug : session " << this << ", uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << LL_ENDL;
+ // Children info
+ if (dump_children)
+ {
+ for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); iter++)
+ {
+ LLConversationItemParticipant* participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
+ if (participant)
+ {
+ participant->dumpDebugData();
+ }
+ }
+ }
}
// should be invoked only for P2P sessions
void LLConversationItemSession::onAvatarNameCache(const LLAvatarName& av_name)
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
- renameItem(av_name.getDisplayName());
- postEvent("update_session", this, NULL);
+ renameItem(av_name.getDisplayName());
+ postEvent("update_session", this, NULL);
}
//
// LLConversationItemParticipant
-//
+//
LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) :
- LLConversationItem(display_name,uuid,root_view_model),
- mIsModeratorMuted(false),
- mIsModerator(false),
- mDisplayModeratorLabel(false),
- mDistToAgent(-1.0)
+ LLConversationItem(display_name,uuid,root_view_model),
+ mIsModeratorMuted(false),
+ mIsModerator(false),
+ mDisplayModeratorLabel(false),
+ mDistToAgent(-1.0)
{
- mDisplayName = display_name;
- mConvType = CONV_PARTICIPANT;
+ mDisplayName = display_name;
+ mConvType = CONV_PARTICIPANT;
}
LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) :
- LLConversationItem(uuid,root_view_model),
- mIsModeratorMuted(false),
- mIsModerator(false),
- mDisplayModeratorLabel(false),
- mDistToAgent(-1.0)
+ LLConversationItem(uuid,root_view_model),
+ mIsModeratorMuted(false),
+ mIsModerator(false),
+ mDisplayModeratorLabel(false),
+ mDistToAgent(-1.0)
{
- mConvType = CONV_PARTICIPANT;
+ mConvType = CONV_PARTICIPANT;
}
void LLConversationItemParticipant::updateName()
{
- llassert(getUUID().notNull());
- if (getUUID().notNull())
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(getUUID(),&av_name))
- {
- updateName(av_name);
- }
- }
+ llassert(getUUID().notNull());
+ if (getUUID().notNull())
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(getUUID(),&av_name))
+ {
+ updateName(av_name);
+ }
+ }
}
void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name)
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
- updateName(av_name);
+ updateName(av_name);
}
void LLConversationItemParticipant::updateName(const LLAvatarName& av_name)
{
- mName = av_name.getUserName();
- mDisplayName = av_name.getDisplayName();
-
- if (mDisplayModeratorLabel)
- {
- mDisplayName += " " + LLTrans::getString("IM_moderator_label");
- }
-
- renameItem(mDisplayName);
- if (mParent != NULL)
- {
- LLConversationItemSession* parent_session = dynamic_cast<LLConversationItemSession*>(mParent);
- if (parent_session != NULL)
- {
- parent_session->requestSort();
- parent_session->updateName(this);
- postEvent("update_participant", parent_session, this);
- }
- }
+ mName = av_name.getUserName();
+ mDisplayName = av_name.getDisplayName();
+
+ if (mDisplayModeratorLabel)
+ {
+ mDisplayName += " " + LLTrans::getString("IM_moderator_label");
+ }
+
+ renameItem(mDisplayName);
+ if (mParent != NULL)
+ {
+ LLConversationItemSession* parent_session = dynamic_cast<LLConversationItemSession*>(mParent);
+ if (parent_session != NULL)
+ {
+ parent_session->requestSort();
+ parent_session->updateName(this);
+ postEvent("update_participant", parent_session, this);
+ }
+ }
}
void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags)
{
menuentry_vec_t items;
menuentry_vec_t disabled_items;
-
- buildParticipantMenuOptions(items, flags);
-
+
+ buildParticipantMenuOptions(items, flags);
+
hide_context_entries(menu, items, disabled_items);
}
LLConversationItemSession* LLConversationItemParticipant::getParentSession()
{
- LLConversationItemSession* parent_session = NULL;
- if (hasParent())
- {
- parent_session = dynamic_cast<LLConversationItemSession*>(mParent);
- }
- return parent_session;
+ LLConversationItemSession* parent_session = NULL;
+ if (hasParent())
+ {
+ parent_session = dynamic_cast<LLConversationItemSession*>(mParent);
+ }
+ return parent_session;
}
void LLConversationItemParticipant::dumpDebugData()
{
- LL_INFOS() << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << isVoiceMuted() << ", moderator = " << mIsModerator << LL_ENDL;
+ LL_INFOS() << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << isVoiceMuted() << ", moderator = " << mIsModerator << LL_ENDL;
}
void LLConversationItemParticipant::setDisplayModeratorRole(bool displayRole)
-{
- if (displayRole != mDisplayModeratorLabel)
- {
- mDisplayModeratorLabel = displayRole;
- updateName();
- }
+{
+ if (displayRole != mDisplayModeratorLabel)
+ {
+ mDisplayModeratorLabel = displayRole;
+ updateName();
+ }
}
bool LLConversationItemParticipant::isVoiceMuted()
{
- return mIsModeratorMuted || LLMuteList::getInstance()->isMuted(mUUID, LLMute::flagVoiceChat);
+ return mIsModeratorMuted || LLMuteList::getInstance()->isMuted(mUUID, LLMute::flagVoiceChat);
}
//
// LLConversationSort
-//
+//
// Comparison operator: returns "true" is a comes before b, "false" otherwise
bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const
{
- LLConversationItem::EConversationType type_a = a->getType();
- LLConversationItem::EConversationType type_b = b->getType();
-
- if ((type_a == LLConversationItem::CONV_PARTICIPANT) && (type_b == LLConversationItem::CONV_PARTICIPANT))
- {
- // If both items are participants
- U32 sort_order = getSortOrderParticipants();
- if (sort_order == LLConversationFilter::SO_DATE)
- {
- F64 time_a = 0.0;
- F64 time_b = 0.0;
- bool has_time_a = a->getTime(time_a);
- bool has_time_b = b->getTime(time_b);
- if (has_time_a && has_time_b)
- {
- // Most recent comes first
- return (time_a > time_b);
- }
- else if (has_time_a || has_time_b)
- {
- // If we have only one time available, the element with time must come first
- return has_time_a;
- }
- // If no time available, we'll default to sort by name at the end of this method
- }
- else if (sort_order == LLConversationFilter::SO_DISTANCE)
- {
- F64 dist_a = 0.0;
- F64 dist_b = 0.0;
- bool has_dist_a = a->getDistanceToAgent(dist_a);
- bool has_dist_b = b->getDistanceToAgent(dist_b);
- if (has_dist_a && has_dist_b)
- {
- // Closest comes first
- return (dist_a < dist_b);
- }
- else if (has_dist_a || has_dist_b)
- {
- // If we have only one distance available, the element with it must come first
- return has_dist_a;
- }
- // If no distance available, we'll default to sort by name at the end of this method
- }
- }
- else if ((type_a > LLConversationItem::CONV_PARTICIPANT) && (type_b > LLConversationItem::CONV_PARTICIPANT))
- {
- // If both are sessions
- U32 sort_order = getSortOrderSessions();
-
- if (sort_order == LLConversationFilter::SO_DATE)
- {
- // Sort by time
- F64 time_a = 0.0;
- F64 time_b = 0.0;
- bool has_time_a = a->getTime(time_a);
- bool has_time_b = b->getTime(time_b);
- if (has_time_a && has_time_b)
- {
- // Most recent comes first
- return (time_a > time_b);
- }
- else if (has_time_a || has_time_b)
- {
- // If we have only one time available, the element with time must come first
- return has_time_a;
- }
- // If no time available, we'll default to sort by name at the end of this method
- }
- else
- {
- if ((type_a == LLConversationItem::CONV_SESSION_NEARBY) || (type_b == LLConversationItem::CONV_SESSION_NEARBY))
- {
- // If one is the nearby session, put nearby session *always* last
- return (type_b == LLConversationItem::CONV_SESSION_NEARBY);
- }
- else if (sort_order == LLConversationFilter::SO_SESSION_TYPE)
- {
- if (type_a != type_b)
- {
- // Lowest types come first. See LLConversationItem definition of types
- return (type_a < type_b);
- }
- // If types are identical, we'll default to sort by name at the end of this method
- }
- }
- }
- else
- {
- // If one item is a participant and the other a session, the session comes before the participant
- // so we simply compare the type
- // Notes: as a consequence, CONV_UNKNOWN (which should never get created...) always come first
- return (type_a > type_b);
- }
- // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course),
- // we sort by name
- S32 compare = LLStringUtil::compareDict(a->getName(), b->getName());
- return (compare < 0);
+ LLConversationItem::EConversationType type_a = a->getType();
+ LLConversationItem::EConversationType type_b = b->getType();
+
+ if ((type_a == LLConversationItem::CONV_PARTICIPANT) && (type_b == LLConversationItem::CONV_PARTICIPANT))
+ {
+ // If both items are participants
+ U32 sort_order = getSortOrderParticipants();
+ if (sort_order == LLConversationFilter::SO_DATE)
+ {
+ F64 time_a = 0.0;
+ F64 time_b = 0.0;
+ bool has_time_a = a->getTime(time_a);
+ bool has_time_b = b->getTime(time_b);
+ if (has_time_a && has_time_b)
+ {
+ // Most recent comes first
+ return (time_a > time_b);
+ }
+ else if (has_time_a || has_time_b)
+ {
+ // If we have only one time available, the element with time must come first
+ return has_time_a;
+ }
+ // If no time available, we'll default to sort by name at the end of this method
+ }
+ else if (sort_order == LLConversationFilter::SO_DISTANCE)
+ {
+ F64 dist_a = 0.0;
+ F64 dist_b = 0.0;
+ bool has_dist_a = a->getDistanceToAgent(dist_a);
+ bool has_dist_b = b->getDistanceToAgent(dist_b);
+ if (has_dist_a && has_dist_b)
+ {
+ // Closest comes first
+ return (dist_a < dist_b);
+ }
+ else if (has_dist_a || has_dist_b)
+ {
+ // If we have only one distance available, the element with it must come first
+ return has_dist_a;
+ }
+ // If no distance available, we'll default to sort by name at the end of this method
+ }
+ }
+ else if ((type_a > LLConversationItem::CONV_PARTICIPANT) && (type_b > LLConversationItem::CONV_PARTICIPANT))
+ {
+ // If both are sessions
+ U32 sort_order = getSortOrderSessions();
+
+ if (sort_order == LLConversationFilter::SO_DATE)
+ {
+ // Sort by time
+ F64 time_a = 0.0;
+ F64 time_b = 0.0;
+ bool has_time_a = a->getTime(time_a);
+ bool has_time_b = b->getTime(time_b);
+ if (has_time_a && has_time_b)
+ {
+ // Most recent comes first
+ return (time_a > time_b);
+ }
+ else if (has_time_a || has_time_b)
+ {
+ // If we have only one time available, the element with time must come first
+ return has_time_a;
+ }
+ // If no time available, we'll default to sort by name at the end of this method
+ }
+ else
+ {
+ if ((type_a == LLConversationItem::CONV_SESSION_NEARBY) || (type_b == LLConversationItem::CONV_SESSION_NEARBY))
+ {
+ // If one is the nearby session, put nearby session *always* last
+ return (type_b == LLConversationItem::CONV_SESSION_NEARBY);
+ }
+ else if (sort_order == LLConversationFilter::SO_SESSION_TYPE)
+ {
+ if (type_a != type_b)
+ {
+ // Lowest types come first. See LLConversationItem definition of types
+ return (type_a < type_b);
+ }
+ // If types are identical, we'll default to sort by name at the end of this method
+ }
+ }
+ }
+ else
+ {
+ // If one item is a participant and the other a session, the session comes before the participant
+ // so we simply compare the type
+ // Notes: as a consequence, CONV_UNKNOWN (which should never get created...) always come first
+ return (type_a > type_b);
+ }
+ // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course),
+ // we sort by name
+ S32 compare = LLStringUtil::compareDict(a->getName(), b->getName());
+ return (compare < 0);
}
//
// LLConversationViewModel
//
-void LLConversationViewModel::sort(LLFolderViewFolder* folder)
+void LLConversationViewModel::sort(LLFolderViewFolder* folder)
{
- base_t::sort(folder);
+ base_t::sort(folder);
}
// EOF
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index 436c9c00ab..ecd035c23b 100644
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llconversationmodel.h
* @brief Implementation of conversations list
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,188 +45,188 @@ typedef std::map<LLUUID, LLFolderViewItem*> conversations_widgets_map;
typedef std::vector<std::string> menuentry_vec_t;
-// Conversation items: we hold a list of those and create an LLFolderViewItem widget for each
-// that we tuck into the mConversationsListPanel.
+// Conversation items: we hold a list of those and create an LLFolderViewItem widget for each
+// that we tuck into the mConversationsListPanel.
class LLConversationItem : public LLFolderViewModelItemCommon
{
public:
- enum EConversationType
- {
- CONV_UNKNOWN = 0,
- CONV_PARTICIPANT = 1,
- CONV_SESSION_NEARBY = 2, // The order counts here as it is used to sort sessions by type
- CONV_SESSION_1_ON_1 = 3,
- CONV_SESSION_AD_HOC = 4,
- CONV_SESSION_GROUP = 5,
- CONV_SESSION_UNKNOWN = 6
- };
-
- LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
- LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
- LLConversationItem(LLFolderViewModelInterface& root_view_model);
- virtual ~LLConversationItem();
-
- // Stub those things we won't really be using in this conversation context
- virtual const std::string& getName() const { return mName; }
- virtual const std::string& getDisplayName() const { return mName; }
- virtual const std::string& getSearchableName() const { return mName; }
- virtual std::string getSearchableDescription() const { return LLStringUtil::null; }
- virtual std::string getSearchableCreatorName() const { return LLStringUtil::null; }
- virtual std::string getSearchableUUIDString() const {return LLStringUtil::null;}
- virtual const LLUUID& getUUID() const { return mUUID; }
- virtual time_t getCreationDate() const { return 0; }
- virtual LLPointer<LLUIImage> getIcon() const { return NULL; }
- virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }
- virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
- virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
- virtual BOOL isItemRenameable() const { return TRUE; }
- virtual BOOL renameItem(const std::string& new_name) { mName = new_name; mNeedsRefresh = true; return TRUE; }
- virtual BOOL isItemMovable( void ) const { return FALSE; }
- virtual BOOL isItemRemovable( void ) const { return FALSE; }
- virtual BOOL isItemInTrash( void) const { return FALSE; }
- virtual BOOL removeItem() { return FALSE; }
- virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch) { }
- virtual void move( LLFolderViewModelItem* parent_listener ) { }
+ enum EConversationType
+ {
+ CONV_UNKNOWN = 0,
+ CONV_PARTICIPANT = 1,
+ CONV_SESSION_NEARBY = 2, // The order counts here as it is used to sort sessions by type
+ CONV_SESSION_1_ON_1 = 3,
+ CONV_SESSION_AD_HOC = 4,
+ CONV_SESSION_GROUP = 5,
+ CONV_SESSION_UNKNOWN = 6
+ };
+
+ LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
+ LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
+ LLConversationItem(LLFolderViewModelInterface& root_view_model);
+ virtual ~LLConversationItem();
+
+ // Stub those things we won't really be using in this conversation context
+ virtual const std::string& getName() const { return mName; }
+ virtual const std::string& getDisplayName() const { return mName; }
+ virtual const std::string& getSearchableName() const { return mName; }
+ virtual std::string getSearchableDescription() const { return LLStringUtil::null; }
+ virtual std::string getSearchableCreatorName() const { return LLStringUtil::null; }
+ virtual std::string getSearchableUUIDString() const {return LLStringUtil::null;}
+ virtual const LLUUID& getUUID() const { return mUUID; }
+ virtual time_t getCreationDate() const { return 0; }
+ virtual LLPointer<LLUIImage> getIcon() const { return NULL; }
+ virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }
+ virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
+ virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
+ virtual BOOL isItemRenameable() const { return TRUE; }
+ virtual BOOL renameItem(const std::string& new_name) { mName = new_name; mNeedsRefresh = true; return TRUE; }
+ virtual BOOL isItemMovable( void ) const { return FALSE; }
+ virtual BOOL isItemRemovable( void ) const { return FALSE; }
+ virtual BOOL isItemInTrash( void) const { return FALSE; }
+ virtual BOOL removeItem() { return FALSE; }
+ virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch) { }
+ virtual void move( LLFolderViewModelItem* parent_listener ) { }
virtual bool isItemCopyable(bool can_copy_as_link = true) const { return false; }
- virtual BOOL copyToClipboard() const { return FALSE; }
- virtual BOOL cutToClipboard() { return FALSE; }
- virtual BOOL isClipboardPasteable() const { return FALSE; }
- virtual void pasteFromClipboard() { }
- virtual void pasteLinkFromClipboard() { }
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags) { }
- virtual BOOL isUpToDate() const { return TRUE; }
- virtual bool hasChildren() const { return FALSE; }
+ virtual BOOL copyToClipboard() const { return FALSE; }
+ virtual BOOL cutToClipboard() { return FALSE; }
+ virtual BOOL isClipboardPasteable() const { return FALSE; }
+ virtual void pasteFromClipboard() { }
+ virtual void pasteLinkFromClipboard() { }
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags) { }
+ virtual BOOL isUpToDate() const { return TRUE; }
+ virtual bool hasChildren() const { return FALSE; }
virtual void addChild(LLFolderViewModelItem* child);
- virtual bool potentiallyVisible() { return true; }
- virtual bool filter( LLFolderViewFilter& filter) { return false; }
- virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; }
- virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { }
- virtual bool passedFilter(S32 filter_generation = -1) { return true; }
-
- // The action callbacks
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void openItem( void );
- virtual void closeItem( void );
- virtual void previewItem( void );
- virtual void selectItem(void) { }
- virtual void showProperties(void);
+ virtual bool potentiallyVisible() { return true; }
+ virtual bool filter( LLFolderViewFilter& filter) { return false; }
+ virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; }
+ virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { }
+ virtual bool passedFilter(S32 filter_generation = -1) { return true; }
+
+ // The action callbacks
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void openItem( void );
+ virtual void closeItem( void );
+ virtual void previewItem( void );
+ virtual void selectItem(void) { }
+ virtual void showProperties(void);
virtual void navigateToFolder(bool new_window = false, bool change_mode = false) {}
- // Methods used in sorting (see LLConversationSort::operator())
- EConversationType const getType() const { return mConvType; }
- virtual const bool getTime(F64& time) const { time = mLastActiveTime; return (time > 0.1); }
- virtual const bool getDistanceToAgent(F64& distance) const { return false; }
-
- // This method will be called to determine if a drop can be
- // performed, and will set drop to TRUE if a drop is
- // requested.
- // Returns TRUE if a drop is possible/happened, FALSE otherwise.
- virtual BOOL dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg) { return FALSE; }
-
-// bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); }
- bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); }
-
- void resetRefresh() { mNeedsRefresh = false; }
- bool needsRefresh() { return mNeedsRefresh; }
-
- void postEvent(const std::string& event_type, LLConversationItemSession* session, LLConversationItemParticipant* participant);
-
+ // Methods used in sorting (see LLConversationSort::operator())
+ EConversationType const getType() const { return mConvType; }
+ virtual const bool getTime(F64& time) const { time = mLastActiveTime; return (time > 0.1); }
+ virtual const bool getDistanceToAgent(F64& distance) const { return false; }
+
+ // This method will be called to determine if a drop can be
+ // performed, and will set drop to TRUE if a drop is
+ // requested.
+ // Returns TRUE if a drop is possible/happened, FALSE otherwise.
+ virtual BOOL dragOrDrop(MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg) { return FALSE; }
+
+// bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); }
+ bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); }
+
+ void resetRefresh() { mNeedsRefresh = false; }
+ bool needsRefresh() { return mNeedsRefresh; }
+
+ void postEvent(const std::string& event_type, LLConversationItemSession* session, LLConversationItemParticipant* participant);
+
void buildParticipantMenuOptions(menuentry_vec_t& items, U32 flags);
- void fetchAvatarName(bool isParticipant = true); // fetch and update the avatar name
+ void fetchAvatarName(bool isParticipant = true); // fetch and update the avatar name
protected:
- virtual void onAvatarNameCache(const LLAvatarName& av_name) {}
-
- std::string mName; // Name of the session or the participant
- LLUUID mUUID; // UUID of the session or the participant
- EConversationType mConvType; // Type of conversation item
- bool mNeedsRefresh; // Flag signaling to the view that something changed for this item
- F64 mLastActiveTime;
- bool mDisplayModeratorOptions;
- bool mDisplayGroupBanOptions;
- boost::signals2::connection mAvatarNameCacheConnection;
-};
+ virtual void onAvatarNameCache(const LLAvatarName& av_name) {}
+
+ std::string mName; // Name of the session or the participant
+ LLUUID mUUID; // UUID of the session or the participant
+ EConversationType mConvType; // Type of conversation item
+ bool mNeedsRefresh; // Flag signaling to the view that something changed for this item
+ F64 mLastActiveTime;
+ bool mDisplayModeratorOptions;
+ bool mDisplayGroupBanOptions;
+ boost::signals2::connection mAvatarNameCacheConnection;
+};
class LLConversationItemSession : public LLConversationItem
{
public:
- LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
- LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
+ LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
+ LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
~LLConversationItemSession();
-
- /*virtual*/ bool hasChildren() const;
+
+ /*virtual*/ bool hasChildren() const;
LLPointer<LLUIImage> getIcon() const { return NULL; }
- void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; }
- void addParticipant(LLConversationItemParticipant* participant);
- void updateName(LLConversationItemParticipant* participant);
- void removeParticipant(LLConversationItemParticipant* participant);
- void removeParticipant(const LLUUID& participant_id);
- void clearParticipants();
- void clearAndDeparentModels(); // will delete unowned models and deparent owned ones
- LLConversationItemParticipant* findParticipant(const LLUUID& participant_id);
-
- void setParticipantIsMuted(const LLUUID& participant_id, bool is_muted);
- void setParticipantIsModerator(const LLUUID& participant_id, bool is_moderator);
- void setTimeNow(const LLUUID& participant_id);
- void setDistance(const LLUUID& participant_id, F64 dist);
-
- bool isLoaded() { return mIsLoaded; }
-
+ void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; }
+ void addParticipant(LLConversationItemParticipant* participant);
+ void updateName(LLConversationItemParticipant* participant);
+ void removeParticipant(LLConversationItemParticipant* participant);
+ void removeParticipant(const LLUUID& participant_id);
+ void clearParticipants();
+ void clearAndDeparentModels(); // will delete unowned models and deparent owned ones
+ LLConversationItemParticipant* findParticipant(const LLUUID& participant_id);
+
+ void setParticipantIsMuted(const LLUUID& participant_id, bool is_muted);
+ void setParticipantIsModerator(const LLUUID& participant_id, bool is_moderator);
+ void setTimeNow(const LLUUID& participant_id);
+ void setDistance(const LLUUID& participant_id, F64 dist);
+
+ bool isLoaded() { return mIsLoaded; }
+
void buildContextMenu(LLMenuGL& menu, U32 flags);
void addVoiceOptions(menuentry_vec_t& items);
- virtual const bool getTime(F64& time) const;
+ virtual const bool getTime(F64& time) const;
- void dumpDebugData(bool dump_children = false);
+ void dumpDebugData(bool dump_children = false);
private:
- /*virtual*/ void onAvatarNameCache(const LLAvatarName& av_name);
+ /*virtual*/ void onAvatarNameCache(const LLAvatarName& av_name);
- bool mIsLoaded; // true if at least one participant has been added to the session, false otherwise
+ bool mIsLoaded; // true if at least one participant has been added to the session, false otherwise
};
class LLConversationItemParticipant : public LLConversationItem
{
public:
- LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
- LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
-
- virtual const std::string& getDisplayName() const { return mDisplayName; }
-
- bool isVoiceMuted();
- bool isModeratorMuted() { return mIsModeratorMuted; }
- bool isModerator() const { return mIsModerator; }
- void moderateVoice(bool mute_voice) { mIsModeratorMuted = mute_voice; }
- void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; mNeedsRefresh = true; }
- void setTimeNow() { mLastActiveTime = LLFrameTimer::getElapsedSeconds(); mNeedsRefresh = true; }
- void setDistance(F64 dist) { mDistToAgent = dist; mNeedsRefresh = true; }
+ LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
+ LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
+
+ virtual const std::string& getDisplayName() const { return mDisplayName; }
+
+ bool isVoiceMuted();
+ bool isModeratorMuted() { return mIsModeratorMuted; }
+ bool isModerator() const { return mIsModerator; }
+ void moderateVoice(bool mute_voice) { mIsModeratorMuted = mute_voice; }
+ void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; mNeedsRefresh = true; }
+ void setTimeNow() { mLastActiveTime = LLFrameTimer::getElapsedSeconds(); mNeedsRefresh = true; }
+ void setDistance(F64 dist) { mDistToAgent = dist; mNeedsRefresh = true; }
void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual const bool getDistanceToAgent(F64& dist) const { dist = mDistToAgent; return (dist >= 0.0); }
+ virtual const bool getDistanceToAgent(F64& dist) const { dist = mDistToAgent; return (dist >= 0.0); }
- void updateName(); // get from the cache (do *not* fetch) and update the avatar name
- LLConversationItemSession* getParentSession();
+ void updateName(); // get from the cache (do *not* fetch) and update the avatar name
+ LLConversationItemSession* getParentSession();
- void dumpDebugData();
- void setModeratorOptionsVisible(bool visible) { mDisplayModeratorOptions = visible; }
- void setDisplayModeratorRole(bool displayRole);
- void setGroupBanVisible(bool visible) { mDisplayGroupBanOptions = visible; }
+ void dumpDebugData();
+ void setModeratorOptionsVisible(bool visible) { mDisplayModeratorOptions = visible; }
+ void setDisplayModeratorRole(bool displayRole);
+ void setGroupBanVisible(bool visible) { mDisplayGroupBanOptions = visible; }
private:
- void onAvatarNameCache(const LLAvatarName& av_name); // callback used by fetchAvatarName
- void updateName(const LLAvatarName& av_name);
-
- bool mIsModeratorMuted; // default is false
- bool mIsModerator; // default is false
- bool mDisplayModeratorLabel; // default is false
- std::string mDisplayName;
- F64 mDistToAgent; // Distance to the agent. A negative (meaningless) value means the distance has not been set.
- boost::signals2::connection mAvatarNameCacheConnection;
+ void onAvatarNameCache(const LLAvatarName& av_name); // callback used by fetchAvatarName
+ void updateName(const LLAvatarName& av_name);
+
+ bool mIsModeratorMuted; // default is false
+ bool mIsModerator; // default is false
+ bool mDisplayModeratorLabel; // default is false
+ std::string mDisplayName;
+ F64 mDistToAgent; // Distance to the agent. A negative (meaningless) value means the distance has not been set.
+ boost::signals2::connection mAvatarNameCacheConnection;
};
// We don't want to ever filter conversations but we need to declare that class to create a conversation view model.
@@ -234,81 +234,81 @@ private:
class LLConversationFilter : public LLFolderViewFilter
{
public:
-
- enum ESortOrderType
- {
- SO_NAME = 0, // Sort by name
- SO_DATE = 0x1, // Sort by date (most recent)
- SO_SESSION_TYPE = 0x2, // Sort by type (valid only for sessions)
- SO_DISTANCE = 0x3, // Sort by distance (valid only for participants in nearby chat)
- };
- // Default sort order is by type for sessions and by date for participants
- static const U32 SO_DEFAULT = (SO_SESSION_TYPE << 16) | (SO_DATE);
-
- LLConversationFilter() { mEmpty = ""; }
- ~LLConversationFilter() {}
-
- bool check(const LLFolderViewModelItem* item) { return true; }
- bool checkFolder(const LLFolderViewModelItem* folder) const { return true; }
- void setEmptyLookupMessage(const std::string& message) { }
- std::string getEmptyLookupMessage(bool is_empty_folder = false) const { return mEmpty; }
- bool showAllResults() const { return true; }
- std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const { return std::string::npos; }
- std::string::size_type getFilterStringSize() const { return 0; }
-
- bool isActive() const { return false; }
- bool isModified() const { return false; }
- void clearModified() { }
- const std::string& getName() const { return mEmpty; }
- const std::string& getFilterText() { return mEmpty; }
- void setModified(EFilterModified behavior = FILTER_RESTART) { }
-
- void resetTime(S32 timeout) { }
+
+ enum ESortOrderType
+ {
+ SO_NAME = 0, // Sort by name
+ SO_DATE = 0x1, // Sort by date (most recent)
+ SO_SESSION_TYPE = 0x2, // Sort by type (valid only for sessions)
+ SO_DISTANCE = 0x3, // Sort by distance (valid only for participants in nearby chat)
+ };
+ // Default sort order is by type for sessions and by date for participants
+ static const U32 SO_DEFAULT = (SO_SESSION_TYPE << 16) | (SO_DATE);
+
+ LLConversationFilter() { mEmpty = ""; }
+ ~LLConversationFilter() {}
+
+ bool check(const LLFolderViewModelItem* item) { return true; }
+ bool checkFolder(const LLFolderViewModelItem* folder) const { return true; }
+ void setEmptyLookupMessage(const std::string& message) { }
+ std::string getEmptyLookupMessage(bool is_empty_folder = false) const { return mEmpty; }
+ bool showAllResults() const { return true; }
+ std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const { return std::string::npos; }
+ std::string::size_type getFilterStringSize() const { return 0; }
+
+ bool isActive() const { return false; }
+ bool isModified() const { return false; }
+ void clearModified() { }
+ const std::string& getName() const { return mEmpty; }
+ const std::string& getFilterText() { return mEmpty; }
+ void setModified(EFilterModified behavior = FILTER_RESTART) { }
+
+ void resetTime(S32 timeout) { }
bool isTimedOut() { return false; }
-
- bool isDefault() const { return true; }
- bool isNotDefault() const { return false; }
- void markDefault() { }
- void resetDefault() { }
-
- S32 getCurrentGeneration() const { return 0; }
- S32 getFirstSuccessGeneration() const { return 0; }
- S32 getFirstRequiredGeneration() const { return 0; }
+
+ bool isDefault() const { return true; }
+ bool isNotDefault() const { return false; }
+ void markDefault() { }
+ void resetDefault() { }
+
+ S32 getCurrentGeneration() const { return 0; }
+ S32 getFirstSuccessGeneration() const { return 0; }
+ S32 getFirstRequiredGeneration() const { return 0; }
private:
- std::string mEmpty;
+ std::string mEmpty;
};
class LLConversationSort
{
public:
- LLConversationSort(U32 order = LLConversationFilter::SO_DEFAULT) : mSortOrder(order) { }
-
- // 16 LSB bits used for participants, 16 MSB bits for sessions
- U32 getSortOrderSessions() const { return ((mSortOrder >> 16) & 0xFFFF); }
- U32 getSortOrderParticipants() const { return (mSortOrder & 0xFFFF); }
- void setSortOrderSessions(LLConversationFilter::ESortOrderType session) { mSortOrder = ((session & 0xFFFF) << 16) | (mSortOrder & 0xFFFF); }
- void setSortOrderParticipants(LLConversationFilter::ESortOrderType participant) { mSortOrder = (mSortOrder & 0xFFFF0000) | (participant & 0xFFFF); }
-
- bool operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const;
- operator U32() const { return mSortOrder; }
+ LLConversationSort(U32 order = LLConversationFilter::SO_DEFAULT) : mSortOrder(order) { }
+
+ // 16 LSB bits used for participants, 16 MSB bits for sessions
+ U32 getSortOrderSessions() const { return ((mSortOrder >> 16) & 0xFFFF); }
+ U32 getSortOrderParticipants() const { return (mSortOrder & 0xFFFF); }
+ void setSortOrderSessions(LLConversationFilter::ESortOrderType session) { mSortOrder = ((session & 0xFFFF) << 16) | (mSortOrder & 0xFFFF); }
+ void setSortOrderParticipants(LLConversationFilter::ESortOrderType participant) { mSortOrder = (mSortOrder & 0xFFFF0000) | (participant & 0xFFFF); }
+
+ bool operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const;
+ operator U32() const { return mSortOrder; }
private:
- // Note: we're treating this value as a sort order bitmask as done in other places in the code (e.g. inventory)
- U32 mSortOrder;
+ // Note: we're treating this value as a sort order bitmask as done in other places in the code (e.g. inventory)
+ U32 mSortOrder;
};
class LLConversationViewModel
-: public LLFolderViewModel<LLConversationSort, LLConversationItem, LLConversationItem, LLConversationFilter>
+: public LLFolderViewModel<LLConversationSort, LLConversationItem, LLConversationItem, LLConversationFilter>
{
public:
- typedef LLFolderViewModel<LLConversationSort, LLConversationItem, LLConversationItem, LLConversationFilter> base_t;
- LLConversationViewModel()
- : base_t(new LLConversationSort(), new LLConversationFilter())
- {}
-
- void sort(LLFolderViewFolder* folder);
- bool contentsReady() { return true; } // *TODO : we need to check that participants names are available somewhat
- bool startDrag(std::vector<LLFolderViewModelItem*>& items) { return false; } // We do not allow drag of conversation items
-
+ typedef LLFolderViewModel<LLConversationSort, LLConversationItem, LLConversationItem, LLConversationFilter> base_t;
+ LLConversationViewModel()
+ : base_t(new LLConversationSort(), new LLConversationFilter())
+ {}
+
+ void sort(LLFolderViewFolder* folder);
+ bool contentsReady() { return true; } // *TODO : we need to check that participants names are available somewhat
+ bool startDrag(std::vector<LLFolderViewModelItem*>& items) { return false; } // We do not allow drag of conversation items
+
private:
};
@@ -319,8 +319,8 @@ private:
//(defined in inventorybridge.cpp)
//TODO: Gilbert Linden - Refactor to make this function non-global
-void hide_context_entries(LLMenuGL& menu,
- const menuentry_vec_t &entries_to_show,
+void hide_context_entries(LLMenuGL& menu,
+ const menuentry_vec_t &entries_to_show,
const menuentry_vec_t &disabled_entries);
#endif // LL_LLCONVERSATIONMODEL_H
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
index 48c7df40df..217f29bffb 100644
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llconversationview.cpp
* @brief Implementation of conversations list widgets and views
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,48 +53,48 @@ class LLNearbyVoiceClientStatusObserver : public LLVoiceClientStatusObserver
{
public:
- LLNearbyVoiceClientStatusObserver(LLConversationViewSession* conv)
- : conversation(conv)
- {}
+ LLNearbyVoiceClientStatusObserver(LLConversationViewSession* conv)
+ : conversation(conv)
+ {}
- virtual void onChange(EStatusType status, const std::string &channelURI, bool proximal)
- {
- conversation->showVoiceIndicator(conversation
- && status != STATUS_JOINING
- && status != STATUS_LEFT_CHANNEL
- && LLVoiceClient::getInstance()->voiceEnabled()
- && LLVoiceClient::getInstance()->isVoiceWorking());
- }
+ virtual void onChange(EStatusType status, const std::string &channelURI, bool proximal)
+ {
+ conversation->showVoiceIndicator(conversation
+ && status != STATUS_JOINING
+ && status != STATUS_LEFT_CHANNEL
+ && LLVoiceClient::getInstance()->voiceEnabled()
+ && LLVoiceClient::getInstance()->isVoiceWorking());
+ }
private:
- LLConversationViewSession* conversation;
+ LLConversationViewSession* conversation;
};
-LLConversationViewSession::Params::Params() :
- container()
+LLConversationViewSession::Params::Params() :
+ container()
{}
LLConversationViewSession::LLConversationViewSession(const LLConversationViewSession::Params& p):
- LLFolderViewFolder(p),
- mContainer(p.container),
- mItemPanel(NULL),
- mCallIconLayoutPanel(NULL),
- mSessionTitle(NULL),
- mSpeakingIndicator(NULL),
- mVoiceClientObserver(NULL),
- mCollapsedMode(false),
+ LLFolderViewFolder(p),
+ mContainer(p.container),
+ mItemPanel(NULL),
+ mCallIconLayoutPanel(NULL),
+ mSessionTitle(NULL),
+ mSpeakingIndicator(NULL),
+ mVoiceClientObserver(NULL),
+ mCollapsedMode(false),
mHasArrow(true),
- mIsInActiveVoiceChannel(false),
- mFlashStateOn(false),
- mFlashStarted(false)
+ mIsInActiveVoiceChannel(false),
+ mFlashStateOn(false),
+ mFlashStarted(false)
{
- mFlashTimer = new LLFlashTimer();
- mAreChildrenInited = true; // inventory only
+ mFlashTimer = new LLFlashTimer();
+ mAreChildrenInited = true; // inventory only
}
LLConversationViewSession::~LLConversationViewSession()
{
- mActiveVoiceChannelConnection.disconnect();
+ mActiveVoiceChannelConnection.disconnect();
if (mVoiceClientObserver)
{
@@ -105,7 +105,7 @@ LLConversationViewSession::~LLConversationViewSession()
delete mVoiceClientObserver;
}
- mFlashTimer->unset();
+ mFlashTimer->unset();
}
void LLConversationViewSession::destroyView()
@@ -160,216 +160,216 @@ void LLConversationViewSession::destroyView()
void LLConversationViewSession::setFlashState(bool flash_state)
{
- if (flash_state && !mFlashStateOn)
- {
- // flash chat toolbar button if scrolled out of sight (because flashing will not be visible)
- if (mContainer->isScrolledOutOfSight(this))
- {
- gToolBarView->flashCommand(LLCommandId("chat"), true);
- }
- }
+ if (flash_state && !mFlashStateOn)
+ {
+ // flash chat toolbar button if scrolled out of sight (because flashing will not be visible)
+ if (mContainer->isScrolledOutOfSight(this))
+ {
+ gToolBarView->flashCommand(LLCommandId("chat"), true);
+ }
+ }
- mFlashStateOn = flash_state;
- mFlashStarted = false;
- mFlashTimer->stopFlashing();
+ mFlashStateOn = flash_state;
+ mFlashStarted = false;
+ mFlashTimer->stopFlashing();
}
void LLConversationViewSession::setHighlightState(bool hihglight_state)
{
- mFlashStateOn = hihglight_state;
- mFlashStarted = true;
- mFlashTimer->stopFlashing();
+ mFlashStateOn = hihglight_state;
+ mFlashStarted = true;
+ mFlashTimer->stopFlashing();
}
void LLConversationViewSession::startFlashing()
{
- // Need to start flashing only when "Conversations" is opened or brought on top
- if (isInVisibleChain()
- && mFlashStateOn
- && !mFlashStarted
- && ! LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")->isMinimized() )
- {
- mFlashStarted = true;
- mFlashTimer->startFlashing();
- }
+ // Need to start flashing only when "Conversations" is opened or brought on top
+ if (isInVisibleChain()
+ && mFlashStateOn
+ && !mFlashStarted
+ && ! LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")->isMinimized() )
+ {
+ mFlashStarted = true;
+ mFlashTimer->startFlashing();
+ }
}
bool LLConversationViewSession::isHighlightAllowed()
{
- return mFlashStateOn || mIsSelected;
+ return mFlashStateOn || mIsSelected;
}
bool LLConversationViewSession::isHighlightActive()
{
- return (mFlashStateOn ? (mFlashTimer->isFlashingInProgress() ? mFlashTimer->isCurrentlyHighlighted() : true) : mIsCurSelection);
+ return (mFlashStateOn ? (mFlashTimer->isFlashingInProgress() ? mFlashTimer->isCurrentlyHighlighted() : true) : mIsCurSelection);
}
BOOL LLConversationViewSession::postBuild()
{
- LLFolderViewItem::postBuild();
-
- mItemPanel = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>("panel_conversation_list_item.xml", NULL, LLPanel::child_registry_t::instance());
- addChild(mItemPanel);
-
- mCallIconLayoutPanel = mItemPanel->getChild<LLPanel>("call_icon_panel");
- mSessionTitle = mItemPanel->getChild<LLTextBox>("conversation_title");
-
- mActiveVoiceChannelConnection = LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLConversationViewSession::onCurrentVoiceSessionChanged, this, _1));
- mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
-
- LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(getViewModelItem());
- if (vmi)
- {
- switch(vmi->getType())
- {
- case LLConversationItem::CONV_PARTICIPANT:
- case LLConversationItem::CONV_SESSION_1_ON_1:
- {
- LLIMModel::LLIMSession* session= LLIMModel::instance().findIMSession(vmi->getUUID());
- if (session)
- {
- LLAvatarIconCtrl* icon = mItemPanel->getChild<LLAvatarIconCtrl>("avatar_icon");
- icon->setVisible(true);
- icon->setValue(session->mOtherParticipantID);
- mSpeakingIndicator->setSpeakerId(session->mOtherParticipantID, session->mSessionID, true);
+ LLFolderViewItem::postBuild();
+
+ mItemPanel = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>("panel_conversation_list_item.xml", NULL, LLPanel::child_registry_t::instance());
+ addChild(mItemPanel);
+
+ mCallIconLayoutPanel = mItemPanel->getChild<LLPanel>("call_icon_panel");
+ mSessionTitle = mItemPanel->getChild<LLTextBox>("conversation_title");
+
+ mActiveVoiceChannelConnection = LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLConversationViewSession::onCurrentVoiceSessionChanged, this, _1));
+ mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
+
+ LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(getViewModelItem());
+ if (vmi)
+ {
+ switch(vmi->getType())
+ {
+ case LLConversationItem::CONV_PARTICIPANT:
+ case LLConversationItem::CONV_SESSION_1_ON_1:
+ {
+ LLIMModel::LLIMSession* session= LLIMModel::instance().findIMSession(vmi->getUUID());
+ if (session)
+ {
+ LLAvatarIconCtrl* icon = mItemPanel->getChild<LLAvatarIconCtrl>("avatar_icon");
+ icon->setVisible(true);
+ icon->setValue(session->mOtherParticipantID);
+ mSpeakingIndicator->setSpeakerId(session->mOtherParticipantID, session->mSessionID, true);
mHasArrow = false;
- }
- break;
- }
- case LLConversationItem::CONV_SESSION_AD_HOC:
- {
- LLGroupIconCtrl* icon = mItemPanel->getChild<LLGroupIconCtrl>("group_icon");
- icon->setVisible(true);
- mSpeakingIndicator->setSpeakerId(gAgentID, vmi->getUUID(), true);
- break;
- }
- case LLConversationItem::CONV_SESSION_GROUP:
- {
- LLGroupIconCtrl* icon = mItemPanel->getChild<LLGroupIconCtrl>("group_icon");
- icon->setVisible(true);
- icon->setValue(vmi->getUUID());
- mSpeakingIndicator->setSpeakerId(gAgentID, vmi->getUUID(), true);
- break;
- }
- case LLConversationItem::CONV_SESSION_NEARBY:
- {
- LLIconCtrl* icon = mItemPanel->getChild<LLIconCtrl>("nearby_chat_icon");
- icon->setVisible(true);
- mSpeakingIndicator->setSpeakerId(gAgentID, LLUUID::null, true);
- mIsInActiveVoiceChannel = true;
- if(LLVoiceClient::instanceExists())
- {
+ }
+ break;
+ }
+ case LLConversationItem::CONV_SESSION_AD_HOC:
+ {
+ LLGroupIconCtrl* icon = mItemPanel->getChild<LLGroupIconCtrl>("group_icon");
+ icon->setVisible(true);
+ mSpeakingIndicator->setSpeakerId(gAgentID, vmi->getUUID(), true);
+ break;
+ }
+ case LLConversationItem::CONV_SESSION_GROUP:
+ {
+ LLGroupIconCtrl* icon = mItemPanel->getChild<LLGroupIconCtrl>("group_icon");
+ icon->setVisible(true);
+ icon->setValue(vmi->getUUID());
+ mSpeakingIndicator->setSpeakerId(gAgentID, vmi->getUUID(), true);
+ break;
+ }
+ case LLConversationItem::CONV_SESSION_NEARBY:
+ {
+ LLIconCtrl* icon = mItemPanel->getChild<LLIconCtrl>("nearby_chat_icon");
+ icon->setVisible(true);
+ mSpeakingIndicator->setSpeakerId(gAgentID, LLUUID::null, true);
+ mIsInActiveVoiceChannel = true;
+ if(LLVoiceClient::instanceExists())
+ {
if (mVoiceClientObserver)
{
LLVoiceClient::getInstance()->removeObserver(mVoiceClientObserver);
delete mVoiceClientObserver;
}
- mVoiceClientObserver = new LLNearbyVoiceClientStatusObserver(this);
- LLVoiceClient::getInstance()->addObserver(mVoiceClientObserver);
- }
- break;
- }
- default:
- break;
- }
+ mVoiceClientObserver = new LLNearbyVoiceClientStatusObserver(this);
+ LLVoiceClient::getInstance()->addObserver(mVoiceClientObserver);
+ }
+ break;
+ }
+ default:
+ break;
+ }
refresh(); // requires vmi
- }
+ }
- return TRUE;
+ return TRUE;
}
void LLConversationViewSession::draw()
{
- getViewModelItem()->update();
-
- const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
- const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE);
-
- // Indicate that flash can start (moot operation if already started, done or not flashing)
- startFlashing();
-
- // draw highlight for selected items
- drawHighlight(show_context, true, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor);
-
- // Draw children if root folder, or any other folder that is open. Do not draw children when animating to closed state or you get rendering overlap.
- bool draw_children = getRoot() == static_cast<LLFolderViewFolder*>(this) || isOpen();
-
- // Todo/fix this: arrange hides children 'out of bonds', session 'slowly' adjusts container size, unhides children
- // this process repeats until children fit
- for (folders_t::iterator iter = mFolders.begin();
- iter != mFolders.end();)
- {
- folders_t::iterator fit = iter++;
- (*fit)->setVisible(draw_children);
- }
- for (items_t::iterator iter = mItems.begin();
- iter != mItems.end();)
- {
- items_t::iterator iit = iter++;
- (*iit)->setVisible(draw_children);
- }
-
- // we don't draw the open folder arrow in minimized mode
- if (mHasArrow && !mCollapsedMode)
- {
- // update the rotation angle of open folder arrow
- updateLabelRotation();
- drawOpenFolderArrow(default_params, sFgColor);
- }
- LLView::draw();
+ getViewModelItem()->update();
+
+ const LLFolderViewItem::Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
+ const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE);
+
+ // Indicate that flash can start (moot operation if already started, done or not flashing)
+ startFlashing();
+
+ // draw highlight for selected items
+ drawHighlight(show_context, true, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor);
+
+ // Draw children if root folder, or any other folder that is open. Do not draw children when animating to closed state or you get rendering overlap.
+ bool draw_children = getRoot() == static_cast<LLFolderViewFolder*>(this) || isOpen();
+
+ // Todo/fix this: arrange hides children 'out of bonds', session 'slowly' adjusts container size, unhides children
+ // this process repeats until children fit
+ for (folders_t::iterator iter = mFolders.begin();
+ iter != mFolders.end();)
+ {
+ folders_t::iterator fit = iter++;
+ (*fit)->setVisible(draw_children);
+ }
+ for (items_t::iterator iter = mItems.begin();
+ iter != mItems.end();)
+ {
+ items_t::iterator iit = iter++;
+ (*iit)->setVisible(draw_children);
+ }
+
+ // we don't draw the open folder arrow in minimized mode
+ if (mHasArrow && !mCollapsedMode)
+ {
+ // update the rotation angle of open folder arrow
+ updateLabelRotation();
+ drawOpenFolderArrow(default_params, sFgColor);
+ }
+ LLView::draw();
}
BOOL LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask )
{
- //Will try to select a child node and then itself (if a child was not selected)
+ //Will try to select a child node and then itself (if a child was not selected)
BOOL result = LLFolderViewFolder::handleMouseDown(x, y, mask);
//This node (conversation) was selected and a child (participant) was not
if(result && getRoot())
{
- if(getRoot()->getCurSelectedItem() == this)
- {
- LLConversationItem* item = dynamic_cast<LLConversationItem *>(getViewModelItem());
- LLUUID session_id = item? item->getUUID() : LLUUID();
+ if(getRoot()->getCurSelectedItem() == this)
+ {
+ LLConversationItem* item = dynamic_cast<LLConversationItem *>(getViewModelItem());
+ LLUUID session_id = item? item->getUUID() : LLUUID();
- LLFloaterIMContainer *im_container = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- if (im_container->isConversationsPaneCollapsed() && im_container->getSelectedSession() == session_id)
- {
- im_container->collapseMessagesPane(!im_container->isMessagesPaneCollapsed());
- }
- else
- {
- im_container->collapseMessagesPane(false);
- }
- }
- selectConversationItem();
+ LLFloaterIMContainer *im_container = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ if (im_container->isConversationsPaneCollapsed() && im_container->getSelectedSession() == session_id)
+ {
+ im_container->collapseMessagesPane(!im_container->isMessagesPaneCollapsed());
+ }
+ else
+ {
+ im_container->collapseMessagesPane(false);
+ }
+ }
+ selectConversationItem();
}
- return result;
+ return result;
}
BOOL LLConversationViewSession::handleMouseUp( S32 x, S32 y, MASK mask )
{
- BOOL result = LLFolderViewFolder::handleMouseUp(x, y, mask);
+ BOOL result = LLFolderViewFolder::handleMouseUp(x, y, mask);
- LLFloater* volume_floater = LLFloaterReg::findInstance("floater_voice_volume");
- LLFloater* chat_volume_floater = LLFloaterReg::findInstance("chat_voice");
- if (result
- && getRoot() && (getRoot()->getCurSelectedItem() == this)
- && !(volume_floater && volume_floater->isShown() && volume_floater->hasFocus())
- && !(chat_volume_floater && chat_volume_floater->isShown() && chat_volume_floater->hasFocus()))
- {
- LLConversationItem* item = dynamic_cast<LLConversationItem *>(getViewModelItem());
- LLUUID session_id = item? item->getUUID() : LLUUID();
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id);
- if(session_floater && !session_floater->hasFocus())
- {
- session_floater->setFocus(true);
- }
+ LLFloater* volume_floater = LLFloaterReg::findInstance("floater_voice_volume");
+ LLFloater* chat_volume_floater = LLFloaterReg::findInstance("chat_voice");
+ if (result
+ && getRoot() && (getRoot()->getCurSelectedItem() == this)
+ && !(volume_floater && volume_floater->isShown() && volume_floater->hasFocus())
+ && !(chat_volume_floater && chat_volume_floater->isShown() && chat_volume_floater->hasFocus()))
+ {
+ LLConversationItem* item = dynamic_cast<LLConversationItem *>(getViewModelItem());
+ LLUUID session_id = item? item->getUUID() : LLUUID();
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id);
+ if(session_floater && !session_floater->hasFocus())
+ {
+ session_floater->setFocus(true);
+ }
}
- return result;
+ return result;
}
BOOL LLConversationViewSession::handleRightMouseDown( S32 x, S32 y, MASK mask )
@@ -378,23 +378,23 @@ BOOL LLConversationViewSession::handleRightMouseDown( S32 x, S32 y, MASK mask )
if(result)
{
- selectConversationItem();
+ selectConversationItem();
}
- return result;
+ return result;
}
void LLConversationViewSession::selectConversationItem()
{
- if(getRoot()->getCurSelectedItem() == this)
- {
- LLConversationItem* item = dynamic_cast<LLConversationItem *>(getViewModelItem());
- LLUUID session_id = item? item->getUUID() : LLUUID();
+ if(getRoot()->getCurSelectedItem() == this)
+ {
+ LLConversationItem* item = dynamic_cast<LLConversationItem *>(getViewModelItem());
+ LLUUID session_id = item? item->getUUID() : LLUUID();
- LLFloaterIMContainer *im_container = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- im_container->flashConversationItemWidget(session_id,false);
- im_container->selectConversationPair(session_id, false);
- }
+ LLFloaterIMContainer *im_container = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ im_container->flashConversationItemWidget(session_id,false);
+ im_container->selectConversationPair(session_id, false);
+ }
}
// virtual
@@ -404,92 +404,92 @@ S32 LLConversationViewSession::arrange(S32* width, S32* height)
S32 arranged = LLFolderViewFolder::arrange(width, height);
S32 h_pad = mHasArrow ? getIndentation() + mArrowSize : getIndentation();
-
- LLRect rect(mCollapsedMode ? getLocalRect().mLeft : h_pad,
- getLocalRect().mTop,
- getLocalRect().mRight,
- getLocalRect().mTop - getItemHeight());
- mItemPanel->setShape(rect);
- return arranged;
+ LLRect rect(mCollapsedMode ? getLocalRect().mLeft : h_pad,
+ getLocalRect().mTop,
+ getLocalRect().mRight,
+ getLocalRect().mTop - getItemHeight());
+ mItemPanel->setShape(rect);
+
+ return arranged;
}
// virtual
void LLConversationViewSession::toggleOpen()
{
- // conversations should not be opened while in minimized mode
- if (!mCollapsedMode)
- {
- LLFolderViewFolder::toggleOpen();
+ // conversations should not be opened while in minimized mode
+ if (!mCollapsedMode)
+ {
+ LLFolderViewFolder::toggleOpen();
- // do item's selection when opened
- if (LLFolderViewFolder::isOpen())
- {
- getParentFolder()->setSelection(this, true);
- }
- mContainer->reSelectConversation();
- }
+ // do item's selection when opened
+ if (LLFolderViewFolder::isOpen())
+ {
+ getParentFolder()->setSelection(this, true);
+ }
+ mContainer->reSelectConversation();
+ }
}
void LLConversationViewSession::toggleCollapsedMode(bool is_collapsed)
{
- mCollapsedMode = is_collapsed;
+ mCollapsedMode = is_collapsed;
- // hide the layout stack which contains all item's child widgets
- // except for the icon which we display in minimized mode
- getChild<LLView>("conversation_item_stack")->setVisible(!mCollapsedMode);
+ // hide the layout stack which contains all item's child widgets
+ // except for the icon which we display in minimized mode
+ getChild<LLView>("conversation_item_stack")->setVisible(!mCollapsedMode);
S32 h_pad = mHasArrow ? getIndentation() + mArrowSize : getIndentation();
- mItemPanel->translate(mCollapsedMode ? -h_pad : h_pad, 0);
+ mItemPanel->translate(mCollapsedMode ? -h_pad : h_pad, 0);
}
void LLConversationViewSession::setVisibleIfDetached(BOOL visible)
{
- // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized
- // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here
- LLFloater* session_floater = getSessionFloater();
- if (session_floater && session_floater->isDetachedAndNotMinimized())
- {
- session_floater->setVisible(visible);
- }
+ // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized
+ // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here
+ LLFloater* session_floater = getSessionFloater();
+ if (session_floater && session_floater->isDetachedAndNotMinimized())
+ {
+ session_floater->setVisible(visible);
+ }
}
LLFloater* LLConversationViewSession::getSessionFloater()
{
- LLFolderViewModelItem* item = mViewModelItem;
- LLUUID session_uuid = dynamic_cast<LLConversationItem*>(item)->getUUID();
- return LLFloaterIMSessionTab::getConversation(session_uuid);
+ LLFolderViewModelItem* item = mViewModelItem;
+ LLUUID session_uuid = dynamic_cast<LLConversationItem*>(item)->getUUID();
+ return LLFloaterIMSessionTab::getConversation(session_uuid);
}
LLConversationViewParticipant* LLConversationViewSession::findParticipant(const LLUUID& participant_id)
{
- // This is *not* a general tree parsing algorithm. We search only in the mItems list
- // assuming there is no mFolders which makes sense for sessions (sessions don't contain
- // sessions).
- LLConversationViewParticipant* participant = NULL;
- items_t::const_iterator iter;
- for (iter = getItemsBegin(); iter != getItemsEnd(); iter++)
- {
- participant = dynamic_cast<LLConversationViewParticipant*>(*iter);
- if (participant->hasSameValue(participant_id))
- {
- break;
- }
- }
- return (iter == getItemsEnd() ? NULL : participant);
+ // This is *not* a general tree parsing algorithm. We search only in the mItems list
+ // assuming there is no mFolders which makes sense for sessions (sessions don't contain
+ // sessions).
+ LLConversationViewParticipant* participant = NULL;
+ items_t::const_iterator iter;
+ for (iter = getItemsBegin(); iter != getItemsEnd(); iter++)
+ {
+ participant = dynamic_cast<LLConversationViewParticipant*>(*iter);
+ if (participant->hasSameValue(participant_id))
+ {
+ break;
+ }
+ }
+ return (iter == getItemsEnd() ? NULL : participant);
}
void LLConversationViewSession::showVoiceIndicator(bool visible)
{
- mCallIconLayoutPanel->setVisible(visible && LLVoiceChannel::getCurrentVoiceChannel()->getSessionID().isNull());
- requestArrange();
+ mCallIconLayoutPanel->setVisible(visible && LLVoiceChannel::getCurrentVoiceChannel()->getSessionID().isNull());
+ requestArrange();
}
void LLConversationViewSession::refresh()
{
- // Refresh the session view from its model data
- LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(getViewModelItem());
+ // Refresh the session view from its model data
+ LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(getViewModelItem());
if (vmi)
{
vmi->resetRefresh();
@@ -505,28 +505,28 @@ void LLConversationViewSession::refresh()
}
}
- // Update all speaking indicators
- LLSpeakingIndicatorManager::updateSpeakingIndicators();
-
- // we should show indicator for specified voice session only if this is current channel. EXT-5562.
- if (mSpeakingIndicator)
- {
- mSpeakingIndicator->setIsActiveChannel(mIsInActiveVoiceChannel);
- mSpeakingIndicator->setShowParticipantsSpeaking(mIsInActiveVoiceChannel);
- }
-
- LLConversationViewParticipant* participant = NULL;
- items_t::const_iterator iter;
- for (iter = getItemsBegin(); iter != getItemsEnd(); iter++)
- {
- participant = dynamic_cast<LLConversationViewParticipant*>(*iter);
- if (participant)
- {
- participant->allowSpeakingIndicator(mIsInActiveVoiceChannel);
- }
- }
-
- requestArrange();
+ // Update all speaking indicators
+ LLSpeakingIndicatorManager::updateSpeakingIndicators();
+
+ // we should show indicator for specified voice session only if this is current channel. EXT-5562.
+ if (mSpeakingIndicator)
+ {
+ mSpeakingIndicator->setIsActiveChannel(mIsInActiveVoiceChannel);
+ mSpeakingIndicator->setShowParticipantsSpeaking(mIsInActiveVoiceChannel);
+ }
+
+ LLConversationViewParticipant* participant = NULL;
+ items_t::const_iterator iter;
+ for (iter = getItemsBegin(); iter != getItemsEnd(); iter++)
+ {
+ participant = dynamic_cast<LLConversationViewParticipant*>(*iter);
+ if (participant)
+ {
+ participant->allowSpeakingIndicator(mIsInActiveVoiceChannel);
+ }
+ }
+
+ requestArrange();
if (vmi)
{
// Do the regular upstream refresh
@@ -536,34 +536,34 @@ void LLConversationViewSession::refresh()
void LLConversationViewSession::onCurrentVoiceSessionChanged(const LLUUID& session_id)
{
- LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(getViewModelItem());
+ LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(getViewModelItem());
- if (vmi)
- {
- bool old_value = mIsInActiveVoiceChannel;
- mIsInActiveVoiceChannel = vmi->getUUID() == session_id;
- mCallIconLayoutPanel->setVisible(mIsInActiveVoiceChannel);
- if (old_value != mIsInActiveVoiceChannel)
- {
- refresh();
- }
- }
+ if (vmi)
+ {
+ bool old_value = mIsInActiveVoiceChannel;
+ mIsInActiveVoiceChannel = vmi->getUUID() == session_id;
+ mCallIconLayoutPanel->setVisible(mIsInActiveVoiceChannel);
+ if (old_value != mIsInActiveVoiceChannel)
+ {
+ refresh();
+ }
+ }
}
bool LLConversationViewSession::highlightFriendTitle(LLConversationItem* vmi)
{
- if(vmi->getType() == LLConversationItem::CONV_PARTICIPANT || vmi->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
- {
- LLIMModel::LLIMSession* session= LLIMModel::instance().findIMSession(vmi->getUUID());
- if (session && LLAvatarActions::isFriend(session->mOtherParticipantID))
- {
- LLStyle::Params title_style;
- title_style.color = LLUIColorTable::instance().getColor("ConversationFriendColor");
- mSessionTitle->setText(vmi->getDisplayName(), title_style);
- return true;
- }
- }
- return false;
+ if(vmi->getType() == LLConversationItem::CONV_PARTICIPANT || vmi->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
+ {
+ LLIMModel::LLIMSession* session= LLIMModel::instance().findIMSession(vmi->getUUID());
+ if (session && LLAvatarActions::isFriend(session->mOtherParticipantID))
+ {
+ LLStyle::Params title_style;
+ title_style.color = LLUIColorTable::instance().getColor("ConversationFriendColor");
+ mSessionTitle->setText(vmi->getDisplayName(), title_style);
+ return true;
+ }
+ }
+ return false;
}
//
@@ -574,7 +574,7 @@ static LLDefaultChildRegistry::Register<LLConversationViewParticipant> r("conver
bool LLConversationViewParticipant::sStaticInitialized = false;
S32 LLConversationViewParticipant::sChildrenWidths[LLConversationViewParticipant::ALIC_COUNT];
-LLConversationViewParticipant::Params::Params() :
+LLConversationViewParticipant::Params::Params() :
container(),
participant_id(),
avatar_icon("avatar_icon"),
@@ -583,7 +583,7 @@ output_monitor("output_monitor")
{}
LLConversationViewParticipant::LLConversationViewParticipant( const LLConversationViewParticipant::Params& p ):
- LLFolderViewItem(p),
+ LLFolderViewItem(p),
mAvatarIcon(NULL),
mInfoBtn(NULL),
mSpeakingIndicator(NULL),
@@ -593,20 +593,20 @@ LLConversationViewParticipant::LLConversationViewParticipant( const LLConversati
LLConversationViewParticipant::~LLConversationViewParticipant()
{
- mActiveVoiceChannelConnection.disconnect();
+ mActiveVoiceChannelConnection.disconnect();
}
void LLConversationViewParticipant::initFromParams(const LLConversationViewParticipant::Params& params)
-{
+{
LLAvatarIconCtrl::Params avatar_icon_params(params.avatar_icon());
applyXUILayout(avatar_icon_params, this);
LLAvatarIconCtrl * avatarIcon = LLUICtrlFactory::create<LLAvatarIconCtrl>(avatar_icon_params);
- addChild(avatarIcon);
-
- LLButton::Params info_button_params(params.info_button());
+ addChild(avatarIcon);
+
+ LLButton::Params info_button_params(params.info_button());
applyXUILayout(info_button_params, this);
- LLButton * button = LLUICtrlFactory::create<LLButton>(info_button_params);
- addChild(button);
+ LLButton * button = LLUICtrlFactory::create<LLButton>(info_button_params);
+ addChild(button);
LLOutputMonitorCtrl::Params output_monitor_params(params.output_monitor());
applyXUILayout(output_monitor_params, this);
@@ -618,11 +618,11 @@ BOOL LLConversationViewParticipant::postBuild()
{
mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon");
- mInfoBtn = getChild<LLButton>("info_btn");
- mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this));
- mInfoBtn->setVisible(false);
+ mInfoBtn = getChild<LLButton>("info_btn");
+ mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this));
+ mInfoBtn->setVisible(false);
- mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
+ mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
if (!sStaticInitialized)
{
@@ -644,7 +644,7 @@ BOOL LLConversationViewParticipant::postBuild()
void LLConversationViewParticipant::draw()
{
static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
- static LLUIColor sFgDisabledColor = LLUIColorTable::instance().getColor("MenuItemDisabledColor", DEFAULT_WHITE);
+ static LLUIColor sFgDisabledColor = LLUIColorTable::instance().getColor("MenuItemDisabledColor", DEFAULT_WHITE);
static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
static LLUIColor sFlashBgColor = LLUIColorTable::instance().getColor("MenuItemFlashBgColor", DEFAULT_WHITE);
@@ -658,32 +658,32 @@ void LLConversationViewParticipant::draw()
F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad;
F32 text_left = (F32)getLabelXPos();
-
- LLColor4 color;
-
- LLLocalSpeakerMgr *speakerMgr = LLLocalSpeakerMgr::getInstance();
-
- if (speakerMgr && speakerMgr->isSpeakerToBeRemoved(mUUID))
- {
- color = sFgDisabledColor;
- }
- else
- {
- if (LLAvatarActions::isFriend(mUUID))
- {
- color = LLUIColorTable::instance().getColor("ConversationFriendColor");
- }
- else
- {
- color = mIsSelected ? sHighlightFgColor : sFgColor;
- }
- }
-
- LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
- if (participant_model)
- {
- mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted());
- }
+
+ LLColor4 color;
+
+ LLLocalSpeakerMgr *speakerMgr = LLLocalSpeakerMgr::getInstance();
+
+ if (speakerMgr && speakerMgr->isSpeakerToBeRemoved(mUUID))
+ {
+ color = sFgDisabledColor;
+ }
+ else
+ {
+ if (LLAvatarActions::isFriend(mUUID))
+ {
+ color = LLUIColorTable::instance().getColor("ConversationFriendColor");
+ }
+ else
+ {
+ color = mIsSelected ? sHighlightFgColor : sFgColor;
+ }
+ }
+
+ LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
+ if (participant_model)
+ {
+ mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted());
+ }
drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor);
drawLabel(font, text_left, y, color, right_x);
@@ -698,7 +698,7 @@ S32 LLConversationViewParticipant::arrange(S32* width, S32* height)
S32 arranged = LLFolderViewItem::arrange(width, height);
//Adjusts the avatar icon based upon the indentation
- LLRect avatarRect(getIndentation(),
+ LLRect avatarRect(getIndentation(),
mAvatarIcon->getRect().mTop,
getIndentation() + mAvatarIcon->getRect().getWidth(),
mAvatarIcon->getRect().mBottom);
@@ -713,15 +713,15 @@ S32 LLConversationViewParticipant::arrange(S32* width, S32* height)
// virtual
void LLConversationViewParticipant::refresh()
{
- // Refresh the participant view from its model data
- LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
+ // Refresh the participant view from its model data
+ LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
if (participant_model)
{
participant_model->resetRefresh();
// *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat
mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted());
-
+
// Do the regular upstream refresh
LLFolderViewItem::refresh();
}
@@ -731,7 +731,7 @@ void LLConversationViewParticipant::addToFolder(LLFolderViewFolder* folder)
{
// Add the item to the folder (conversation)
LLFolderViewItem::addToFolder(folder);
-
+
// Retrieve the folder (conversation) UUID, which is also the speaker session UUID
LLFolderViewFolder *prnt = getParentFolder();
if (prnt)
@@ -751,36 +751,36 @@ void LLConversationViewParticipant::addToFolder(LLFolderViewFolder* folder)
void LLConversationViewParticipant::addToSession(const LLUUID& session_id)
{
- //Allows speaking icon image to be loaded based on mUUID
- mAvatarIcon->setValue(mUUID);
-
- //Allows the speaker indicator to be activated based on the user and conversation
- mSpeakingIndicator->setSpeakerId(mUUID, session_id);
+ //Allows speaking icon image to be loaded based on mUUID
+ mAvatarIcon->setValue(mUUID);
+
+ //Allows the speaker indicator to be activated based on the user and conversation
+ mSpeakingIndicator->setSpeakerId(mUUID, session_id);
}
void LLConversationViewParticipant::onInfoBtnClick()
{
- LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mUUID));
+ LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mUUID));
}
BOOL LLConversationViewParticipant::handleMouseDown( S32 x, S32 y, MASK mask )
{
- BOOL result = LLFolderViewItem::handleMouseDown(x, y, mask);
+ BOOL result = LLFolderViewItem::handleMouseDown(x, y, mask);
if(result && getRoot())
{
- if(getRoot()->getCurSelectedItem() == this)
- {
- LLConversationItem* vmi = getParentFolder() ? dynamic_cast<LLConversationItem*>(getParentFolder()->getViewModelItem()) : NULL;
- LLUUID session_id = vmi? vmi->getUUID() : LLUUID();
-
- LLFloaterIMContainer *im_container = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id);
- im_container->setSelectedSession(session_id);
- im_container->flashConversationItemWidget(session_id,false);
- im_container->selectFloater(session_floater);
- im_container->collapseMessagesPane(false);
- }
+ if(getRoot()->getCurSelectedItem() == this)
+ {
+ LLConversationItem* vmi = getParentFolder() ? dynamic_cast<LLConversationItem*>(getParentFolder()->getViewModelItem()) : NULL;
+ LLUUID session_id = vmi? vmi->getUUID() : LLUUID();
+
+ LLFloaterIMContainer *im_container = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id);
+ im_container->setSelectedSession(session_id);
+ im_container->flashConversationItemWidget(session_id,false);
+ im_container->selectFloater(session_floater);
+ im_container->collapseMessagesPane(false);
+ }
}
return result;
}
@@ -877,7 +877,7 @@ LLView* LLConversationViewParticipant::getItemChildView(EAvatarListItemChildInde
void LLConversationViewParticipant::allowSpeakingIndicator(bool val)
{
- mSpeakingIndicator->setIsActiveChannel(val);
+ mSpeakingIndicator->setIsActiveChannel(val);
}
// EOF
diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h
index 0932d24dfe..5f3e4bfe64 100644
--- a/indra/newview/llconversationview.h
+++ b/indra/newview/llconversationview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llconversationview.h
* @brief Implementation of conversations list widgets and views
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,79 +47,79 @@ class LLVoiceClientStatusObserver;
class LLConversationViewSession : public LLFolderViewFolder
{
public:
- struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>
- {
- Optional<LLFloaterIMContainer*> container;
+ struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>
+ {
+ Optional<LLFloaterIMContainer*> container;
+
+ Params();
+ };
- Params();
- };
-
protected:
- friend class LLUICtrlFactory;
- LLConversationViewSession( const Params& p );
+ friend class LLUICtrlFactory;
+ LLConversationViewSession( const Params& p );
+
+ /*virtual*/ bool isHighlightAllowed();
+ /*virtual*/ bool isHighlightActive();
+ /*virtual*/ bool isFlashing() { return mFlashStateOn; }
- /*virtual*/ bool isHighlightAllowed();
- /*virtual*/ bool isHighlightActive();
- /*virtual*/ bool isFlashing() { return mFlashStateOn; }
+ LLFloaterIMContainer* mContainer;
- LLFloaterIMContainer* mContainer;
-
public:
- virtual ~LLConversationViewSession();
+ virtual ~LLConversationViewSession();
- /*virtual*/ void destroyView();
+ /*virtual*/ void destroyView();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void draw();
- /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
- /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
- /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask );
- /*virtual*/ S32 arrange(S32* width, S32* height);
+ /*virtual*/ S32 arrange(S32* width, S32* height);
- /*virtual*/ void toggleOpen();
+ /*virtual*/ void toggleOpen();
- /*virtual*/ bool isCollapsed() { return mCollapsedMode; }
+ /*virtual*/ bool isCollapsed() { return mCollapsedMode; }
- void toggleCollapsedMode(bool is_collapsed);
+ void toggleCollapsedMode(bool is_collapsed);
- void setVisibleIfDetached(BOOL visible);
- LLConversationViewParticipant* findParticipant(const LLUUID& participant_id);
+ void setVisibleIfDetached(BOOL visible);
+ LLConversationViewParticipant* findParticipant(const LLUUID& participant_id);
- void showVoiceIndicator(bool visible);
+ void showVoiceIndicator(bool visible);
- virtual void refresh();
+ virtual void refresh();
- /*virtual*/ void setFlashState(bool flash_state);
- void setHighlightState(bool hihglight_state);
+ /*virtual*/ void setFlashState(bool flash_state);
+ void setHighlightState(bool hihglight_state);
- LLFloater* getSessionFloater();
- bool isInActiveVoiceChannel() { return mIsInActiveVoiceChannel; }
+ LLFloater* getSessionFloater();
+ bool isInActiveVoiceChannel() { return mIsInActiveVoiceChannel; }
- bool highlightFriendTitle(LLConversationItem* vmi);
+ bool highlightFriendTitle(LLConversationItem* vmi);
private:
- void onCurrentVoiceSessionChanged(const LLUUID& session_id);
- void startFlashing();
- void selectConversationItem();
+ void onCurrentVoiceSessionChanged(const LLUUID& session_id);
+ void startFlashing();
+ void selectConversationItem();
- LLPanel* mItemPanel;
- LLPanel* mCallIconLayoutPanel;
- LLTextBox* mSessionTitle;
- LLOutputMonitorCtrl* mSpeakingIndicator;
- LLFlashTimer* mFlashTimer;
- bool mFlashStateOn;
- bool mFlashStarted;
+ LLPanel* mItemPanel;
+ LLPanel* mCallIconLayoutPanel;
+ LLTextBox* mSessionTitle;
+ LLOutputMonitorCtrl* mSpeakingIndicator;
+ LLFlashTimer* mFlashTimer;
+ bool mFlashStateOn;
+ bool mFlashStarted;
- bool mCollapsedMode;
+ bool mCollapsedMode;
bool mHasArrow;
- bool mIsInActiveVoiceChannel;
+ bool mIsInActiveVoiceChannel;
- LLVoiceClientStatusObserver* mVoiceClientObserver;
-
- boost::signals2::connection mActiveVoiceChannelConnection;
+ LLVoiceClientStatusObserver* mVoiceClientObserver;
+
+ boost::signals2::connection mActiveVoiceChannelConnection;
};
// Implementation of conversations list participant (avatar) widgets
@@ -129,47 +129,47 @@ class LLConversationViewParticipant : public LLFolderViewItem
public:
- struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>
- {
- Optional<LLFloaterIMContainer*> container;
- Optional<LLUUID> participant_id;
- Optional<LLAvatarIconCtrl::Params> avatar_icon;
- Optional<LLButton::Params> info_button;
+ struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>
+ {
+ Optional<LLFloaterIMContainer*> container;
+ Optional<LLUUID> participant_id;
+ Optional<LLAvatarIconCtrl::Params> avatar_icon;
+ Optional<LLButton::Params> info_button;
Optional<LLOutputMonitorCtrl::Params> output_monitor;
-
- Params();
- };
-
+
+ Params();
+ };
+
virtual ~LLConversationViewParticipant( void );
bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); }
/*virtual*/ void refresh();
void addToFolder(LLFolderViewFolder* folder);
- void addToSession(const LLUUID& session_id);
+ void addToSession(const LLUUID& session_id);
void onMouseEnter(S32 x, S32 y, MASK mask);
void onMouseLeave(S32 x, S32 y, MASK mask);
/*virtual*/ S32 getLabelXPos();
/*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
- void allowSpeakingIndicator(bool val);
+ void allowSpeakingIndicator(bool val);
protected:
- friend class LLUICtrlFactory;
- LLConversationViewParticipant( const Params& p );
- void initFromParams(const Params& params);
- BOOL postBuild();
+ friend class LLUICtrlFactory;
+ LLConversationViewParticipant( const Params& p );
+ void initFromParams(const Params& params);
+ BOOL postBuild();
/*virtual*/ void draw();
/*virtual*/ S32 arrange(S32* width, S32* height);
-
- void onInfoBtnClick();
+
+ void onInfoBtnClick();
private:
LLAvatarIconCtrl* mAvatarIcon;
- LLButton * mInfoBtn;
+ LLButton * mInfoBtn;
LLOutputMonitorCtrl* mSpeakingIndicator;
- LLUUID mUUID; // UUID of the participant
+ LLUUID mUUID; // UUID of the participant
typedef enum e_avatar_item_child {
ALIC_SPEAKER_INDICATOR,
@@ -177,13 +177,13 @@ private:
ALIC_COUNT,
} EAvatarListItemChildIndex;
- static bool sStaticInitialized; // this variable is introduced to improve code readability
+ static bool sStaticInitialized; // this variable is introduced to improve code readability
static S32 sChildrenWidths[ALIC_COUNT];
static void initChildrenWidths(LLConversationViewParticipant* self);
void updateChildren();
LLView* getItemChildView(EAvatarListItemChildIndex child_view_index);
-
- boost::signals2::connection mActiveVoiceChannelConnection;
+
+ boost::signals2::connection mActiveVoiceChannelConnection;
};
#endif // LL_LLCONVERSATIONVIEW_H
diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp
index 4c0a5cf183..6726b6a111 100644
--- a/indra/newview/llcurrencyuimanager.cpp
+++ b/indra/newview/llcurrencyuimanager.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcurrencyuimanager.cpp
* @brief LLCurrencyUIManager class implementation
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,584 +49,584 @@
const F64 CURRENCY_ESTIMATE_FREQUENCY = 2.0;
- // how long of a pause in typing a currency buy amount before an
- // esimate is fetched from the server
+ // how long of a pause in typing a currency buy amount before an
+ // esimate is fetched from the server
class LLCurrencyUIManager::Impl
{
public:
- Impl(LLPanel& dialog);
- virtual ~Impl();
-
- LLPanel& mPanel;
-
- bool mHidden;
-
- bool mError;
- std::string mErrorMessage;
- std::string mErrorURI;
-
- std::string mZeroMessage;
-
- // user's choices
- S32 mUserCurrencyBuy;
- bool mUserEnteredCurrencyBuy;
-
- // from website
-
- // pre-viewer 2.0, the server returned estimates as an
- // integer US cents value, e.g., "1000" for $10.00
- // post-viewer 2.0, the server may also return estimates
- // as a string with currency embedded, e.g., "10.00 Euros"
- bool mUSDCurrencyEstimated;
- S32 mUSDCurrencyEstimatedCost;
- bool mLocalCurrencyEstimated;
- std::string mLocalCurrencyEstimatedCost;
- bool mSupportsInternationalBilling;
- std::string mSiteConfirm;
-
- bool mBought;
-
- enum TransactionType
- {
- TransactionNone,
- TransactionCurrency,
- TransactionBuy
- };
-
- TransactionType mTransactionType;
- LLXMLRPCTransaction* mTransaction;
-
- bool mCurrencyChanged;
- LLFrameTimer mCurrencyKeyTimer;
-
-
- void updateCurrencyInfo();
- void finishCurrencyInfo();
-
- void startCurrencyBuy(const std::string& password);
- void finishCurrencyBuy();
-
- void clearEstimate();
- bool hasEstimate() const;
- std::string getLocalEstimate() const;
-
- void startTransaction(TransactionType type,
- const char* method, LLXMLRPCValue params);
- bool checkTransaction();
- // return true if update needed
-
- void setError(const std::string& message, const std::string& uri);
- void clearError();
-
- bool considerUpdateCurrency();
- // return true if update needed
- void currencyKey(S32);
- static void onCurrencyKey(LLLineEditor* caller, void* data);
-
- void prepare();
- void updateUI();
+ Impl(LLPanel& dialog);
+ virtual ~Impl();
+
+ LLPanel& mPanel;
+
+ bool mHidden;
+
+ bool mError;
+ std::string mErrorMessage;
+ std::string mErrorURI;
+
+ std::string mZeroMessage;
+
+ // user's choices
+ S32 mUserCurrencyBuy;
+ bool mUserEnteredCurrencyBuy;
+
+ // from website
+
+ // pre-viewer 2.0, the server returned estimates as an
+ // integer US cents value, e.g., "1000" for $10.00
+ // post-viewer 2.0, the server may also return estimates
+ // as a string with currency embedded, e.g., "10.00 Euros"
+ bool mUSDCurrencyEstimated;
+ S32 mUSDCurrencyEstimatedCost;
+ bool mLocalCurrencyEstimated;
+ std::string mLocalCurrencyEstimatedCost;
+ bool mSupportsInternationalBilling;
+ std::string mSiteConfirm;
+
+ bool mBought;
+
+ enum TransactionType
+ {
+ TransactionNone,
+ TransactionCurrency,
+ TransactionBuy
+ };
+
+ TransactionType mTransactionType;
+ LLXMLRPCTransaction* mTransaction;
+
+ bool mCurrencyChanged;
+ LLFrameTimer mCurrencyKeyTimer;
+
+
+ void updateCurrencyInfo();
+ void finishCurrencyInfo();
+
+ void startCurrencyBuy(const std::string& password);
+ void finishCurrencyBuy();
+
+ void clearEstimate();
+ bool hasEstimate() const;
+ std::string getLocalEstimate() const;
+
+ void startTransaction(TransactionType type,
+ const char* method, LLXMLRPCValue params);
+ bool checkTransaction();
+ // return true if update needed
+
+ void setError(const std::string& message, const std::string& uri);
+ void clearError();
+
+ bool considerUpdateCurrency();
+ // return true if update needed
+ void currencyKey(S32);
+ static void onCurrencyKey(LLLineEditor* caller, void* data);
+
+ void prepare();
+ void updateUI();
};
// is potentially not fully constructed.
LLCurrencyUIManager::Impl::Impl(LLPanel& dialog)
- : mPanel(dialog),
- mHidden(false),
- mError(false),
- mUserCurrencyBuy(2000), // note, this is a default, real value set in llfloaterbuycurrency.cpp
- mUserEnteredCurrencyBuy(false),
- mSupportsInternationalBilling(false),
- mBought(false),
- mTransactionType(TransactionNone), mTransaction(0),
- mCurrencyChanged(false)
+ : mPanel(dialog),
+ mHidden(false),
+ mError(false),
+ mUserCurrencyBuy(2000), // note, this is a default, real value set in llfloaterbuycurrency.cpp
+ mUserEnteredCurrencyBuy(false),
+ mSupportsInternationalBilling(false),
+ mBought(false),
+ mTransactionType(TransactionNone), mTransaction(0),
+ mCurrencyChanged(false)
{
- clearEstimate();
+ clearEstimate();
}
LLCurrencyUIManager::Impl::~Impl()
{
- delete mTransaction;
+ delete mTransaction;
}
void LLCurrencyUIManager::Impl::updateCurrencyInfo()
{
- clearEstimate();
- mBought = false;
- mCurrencyChanged = false;
-
- if (mUserCurrencyBuy == 0)
- {
- mLocalCurrencyEstimated = true;
- return;
- }
-
- LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct();
- keywordArgs.appendString("agentId", gAgent.getID().asString());
- keywordArgs.appendString(
- "secureSessionId",
- gAgent.getSecureSessionID().asString());
- keywordArgs.appendString("language", LLUI::getLanguage());
- keywordArgs.appendInt("currencyBuy", mUserCurrencyBuy);
- keywordArgs.appendString("viewerChannel", LLVersionInfo::instance().getChannel());
- keywordArgs.appendInt("viewerMajorVersion", LLVersionInfo::instance().getMajor());
- keywordArgs.appendInt("viewerMinorVersion", LLVersionInfo::instance().getMinor());
- keywordArgs.appendInt("viewerPatchVersion", LLVersionInfo::instance().getPatch());
- // With GitHub builds, the build number is too big to fit in a 32-bit int,
- // and XMLRPC_VALUE doesn't deal with integers wider than int. Use string.
- keywordArgs.appendString("viewerBuildVersion", stringize(LLVersionInfo::instance().getBuild()));
-
- LLXMLRPCValue params = LLXMLRPCValue::createArray();
- params.append(keywordArgs);
-
- startTransaction(TransactionCurrency, "getCurrencyQuote", params);
+ clearEstimate();
+ mBought = false;
+ mCurrencyChanged = false;
+
+ if (mUserCurrencyBuy == 0)
+ {
+ mLocalCurrencyEstimated = true;
+ return;
+ }
+
+ LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct();
+ keywordArgs.appendString("agentId", gAgent.getID().asString());
+ keywordArgs.appendString(
+ "secureSessionId",
+ gAgent.getSecureSessionID().asString());
+ keywordArgs.appendString("language", LLUI::getLanguage());
+ keywordArgs.appendInt("currencyBuy", mUserCurrencyBuy);
+ keywordArgs.appendString("viewerChannel", LLVersionInfo::instance().getChannel());
+ keywordArgs.appendInt("viewerMajorVersion", LLVersionInfo::instance().getMajor());
+ keywordArgs.appendInt("viewerMinorVersion", LLVersionInfo::instance().getMinor());
+ keywordArgs.appendInt("viewerPatchVersion", LLVersionInfo::instance().getPatch());
+ // With GitHub builds, the build number is too big to fit in a 32-bit int,
+ // and XMLRPC_VALUE doesn't deal with integers wider than int. Use string.
+ keywordArgs.appendString("viewerBuildVersion", stringize(LLVersionInfo::instance().getBuild()));
+
+ LLXMLRPCValue params = LLXMLRPCValue::createArray();
+ params.append(keywordArgs);
+
+ startTransaction(TransactionCurrency, "getCurrencyQuote", params);
}
void LLCurrencyUIManager::Impl::finishCurrencyInfo()
{
- LLXMLRPCValue result = mTransaction->responseValue();
-
- bool success = result["success"].asBool();
- if (!success)
- {
- setError(
- result["errorMessage"].asString(),
- result["errorURI"].asString()
- );
- return;
- }
-
- LLXMLRPCValue currency = result["currency"];
-
- // old XML-RPC server: estimatedCost = value in US cents
- mUSDCurrencyEstimated = currency["estimatedCost"].isValid();
- if (mUSDCurrencyEstimated)
- {
- mUSDCurrencyEstimatedCost = currency["estimatedCost"].asInt();
- }
-
- // newer XML-RPC server: estimatedLocalCost = local currency string
- mLocalCurrencyEstimated = currency["estimatedLocalCost"].isValid();
- if (mLocalCurrencyEstimated)
- {
- mLocalCurrencyEstimatedCost = currency["estimatedLocalCost"].asString();
- mSupportsInternationalBilling = true;
- }
-
- S32 newCurrencyBuy = currency["currencyBuy"].asInt();
- if (newCurrencyBuy != mUserCurrencyBuy)
- {
- mUserCurrencyBuy = newCurrencyBuy;
- mUserEnteredCurrencyBuy = false;
- }
-
- mSiteConfirm = result["confirm"].asString();
+ LLXMLRPCValue result = mTransaction->responseValue();
+
+ bool success = result["success"].asBool();
+ if (!success)
+ {
+ setError(
+ result["errorMessage"].asString(),
+ result["errorURI"].asString()
+ );
+ return;
+ }
+
+ LLXMLRPCValue currency = result["currency"];
+
+ // old XML-RPC server: estimatedCost = value in US cents
+ mUSDCurrencyEstimated = currency["estimatedCost"].isValid();
+ if (mUSDCurrencyEstimated)
+ {
+ mUSDCurrencyEstimatedCost = currency["estimatedCost"].asInt();
+ }
+
+ // newer XML-RPC server: estimatedLocalCost = local currency string
+ mLocalCurrencyEstimated = currency["estimatedLocalCost"].isValid();
+ if (mLocalCurrencyEstimated)
+ {
+ mLocalCurrencyEstimatedCost = currency["estimatedLocalCost"].asString();
+ mSupportsInternationalBilling = true;
+ }
+
+ S32 newCurrencyBuy = currency["currencyBuy"].asInt();
+ if (newCurrencyBuy != mUserCurrencyBuy)
+ {
+ mUserCurrencyBuy = newCurrencyBuy;
+ mUserEnteredCurrencyBuy = false;
+ }
+
+ mSiteConfirm = result["confirm"].asString();
}
void LLCurrencyUIManager::Impl::startCurrencyBuy(const std::string& password)
{
- LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct();
- keywordArgs.appendString("agentId", gAgent.getID().asString());
- keywordArgs.appendString(
- "secureSessionId",
- gAgent.getSecureSessionID().asString());
- keywordArgs.appendString("language", LLUI::getLanguage());
- keywordArgs.appendInt("currencyBuy", mUserCurrencyBuy);
- if (mUSDCurrencyEstimated)
- {
- keywordArgs.appendInt("estimatedCost", mUSDCurrencyEstimatedCost);
- }
- if (mLocalCurrencyEstimated)
- {
- keywordArgs.appendString("estimatedLocalCost", mLocalCurrencyEstimatedCost);
- }
- keywordArgs.appendString("confirm", mSiteConfirm);
- if (!password.empty())
- {
- keywordArgs.appendString("password", password);
- }
- keywordArgs.appendString("viewerChannel", LLVersionInfo::instance().getChannel());
- keywordArgs.appendInt("viewerMajorVersion", LLVersionInfo::instance().getMajor());
- keywordArgs.appendInt("viewerMinorVersion", LLVersionInfo::instance().getMinor());
- keywordArgs.appendInt("viewerPatchVersion", LLVersionInfo::instance().getPatch());
- // With GitHub builds, the build number is too big to fit in a 32-bit int,
- // and XMLRPC_VALUE doesn't deal with integers wider than int. Use string.
- keywordArgs.appendString("viewerBuildVersion", stringize(LLVersionInfo::instance().getBuild()));
-
- LLXMLRPCValue params = LLXMLRPCValue::createArray();
- params.append(keywordArgs);
-
- startTransaction(TransactionBuy, "buyCurrency", params);
-
- clearEstimate();
- mCurrencyChanged = false;
+ LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct();
+ keywordArgs.appendString("agentId", gAgent.getID().asString());
+ keywordArgs.appendString(
+ "secureSessionId",
+ gAgent.getSecureSessionID().asString());
+ keywordArgs.appendString("language", LLUI::getLanguage());
+ keywordArgs.appendInt("currencyBuy", mUserCurrencyBuy);
+ if (mUSDCurrencyEstimated)
+ {
+ keywordArgs.appendInt("estimatedCost", mUSDCurrencyEstimatedCost);
+ }
+ if (mLocalCurrencyEstimated)
+ {
+ keywordArgs.appendString("estimatedLocalCost", mLocalCurrencyEstimatedCost);
+ }
+ keywordArgs.appendString("confirm", mSiteConfirm);
+ if (!password.empty())
+ {
+ keywordArgs.appendString("password", password);
+ }
+ keywordArgs.appendString("viewerChannel", LLVersionInfo::instance().getChannel());
+ keywordArgs.appendInt("viewerMajorVersion", LLVersionInfo::instance().getMajor());
+ keywordArgs.appendInt("viewerMinorVersion", LLVersionInfo::instance().getMinor());
+ keywordArgs.appendInt("viewerPatchVersion", LLVersionInfo::instance().getPatch());
+ // With GitHub builds, the build number is too big to fit in a 32-bit int,
+ // and XMLRPC_VALUE doesn't deal with integers wider than int. Use string.
+ keywordArgs.appendString("viewerBuildVersion", stringize(LLVersionInfo::instance().getBuild()));
+
+ LLXMLRPCValue params = LLXMLRPCValue::createArray();
+ params.append(keywordArgs);
+
+ startTransaction(TransactionBuy, "buyCurrency", params);
+
+ clearEstimate();
+ mCurrencyChanged = false;
}
void LLCurrencyUIManager::Impl::finishCurrencyBuy()
{
- LLXMLRPCValue result = mTransaction->responseValue();
+ LLXMLRPCValue result = mTransaction->responseValue();
- bool success = result["success"].asBool();
- if (!success)
- {
- setError(
- result["errorMessage"].asString(),
- result["errorURI"].asString()
- );
- }
- else
- {
- mUserCurrencyBuy = 0;
- mUserEnteredCurrencyBuy = false;
- mBought = true;
- }
+ bool success = result["success"].asBool();
+ if (!success)
+ {
+ setError(
+ result["errorMessage"].asString(),
+ result["errorURI"].asString()
+ );
+ }
+ else
+ {
+ mUserCurrencyBuy = 0;
+ mUserEnteredCurrencyBuy = false;
+ mBought = true;
+ }
}
void LLCurrencyUIManager::Impl::startTransaction(TransactionType type,
- const char* method, LLXMLRPCValue params)
+ const char* method, LLXMLRPCValue params)
{
- static std::string transactionURI;
- if (transactionURI.empty())
- {
- transactionURI = LLGridManager::getInstance()->getHelperURI() + "currency.php";
- }
+ static std::string transactionURI;
+ if (transactionURI.empty())
+ {
+ transactionURI = LLGridManager::getInstance()->getHelperURI() + "currency.php";
+ }
- delete mTransaction;
+ delete mTransaction;
- mTransactionType = type;
- mTransaction = new LLXMLRPCTransaction(
- transactionURI,
- method,
- params,
- false /* don't use gzip */
- );
+ mTransactionType = type;
+ mTransaction = new LLXMLRPCTransaction(
+ transactionURI,
+ method,
+ params,
+ false /* don't use gzip */
+ );
- clearError();
+ clearError();
}
void LLCurrencyUIManager::Impl::clearEstimate()
{
- mUSDCurrencyEstimated = false;
- mUSDCurrencyEstimatedCost = 0;
- mLocalCurrencyEstimated = false;
- mLocalCurrencyEstimatedCost = "0";
+ mUSDCurrencyEstimated = false;
+ mUSDCurrencyEstimatedCost = 0;
+ mLocalCurrencyEstimated = false;
+ mLocalCurrencyEstimatedCost = "0";
}
bool LLCurrencyUIManager::Impl::hasEstimate() const
{
- return (mUSDCurrencyEstimated || mLocalCurrencyEstimated);
+ return (mUSDCurrencyEstimated || mLocalCurrencyEstimated);
}
std::string LLCurrencyUIManager::Impl::getLocalEstimate() const
{
- if (mLocalCurrencyEstimated)
- {
- // we have the new-style local currency string
- return mLocalCurrencyEstimatedCost;
- }
- if (mUSDCurrencyEstimated)
- {
- // we have the old-style USD-specific value
- LLStringUtil::format_map_t args;
- {
- LLLocale locale_override(LLStringUtil::getLocale());
- args["[AMOUNT]"] = llformat("%#.2f", mUSDCurrencyEstimatedCost / 100.0);
- }
- return LLTrans::getString("LocalEstimateUSD", args);
- }
- return "";
+ if (mLocalCurrencyEstimated)
+ {
+ // we have the new-style local currency string
+ return mLocalCurrencyEstimatedCost;
+ }
+ if (mUSDCurrencyEstimated)
+ {
+ // we have the old-style USD-specific value
+ LLStringUtil::format_map_t args;
+ {
+ LLLocale locale_override(LLStringUtil::getLocale());
+ args["[AMOUNT]"] = llformat("%#.2f", mUSDCurrencyEstimatedCost / 100.0);
+ }
+ return LLTrans::getString("LocalEstimateUSD", args);
+ }
+ return "";
}
bool LLCurrencyUIManager::Impl::checkTransaction()
{
- if (!mTransaction)
- {
- return false;
- }
-
- if (!mTransaction->process())
- {
- return false;
- }
-
- if (mTransaction->status(NULL) != LLXMLRPCTransaction::StatusComplete)
- {
- setError(mTransaction->statusMessage(), mTransaction->statusURI());
- }
- else {
- switch (mTransactionType)
- {
- case TransactionCurrency: finishCurrencyInfo(); break;
- case TransactionBuy: finishCurrencyBuy(); break;
- default: ;
- }
- }
-
- delete mTransaction;
- mTransaction = NULL;
- mTransactionType = TransactionNone;
-
- return true;
+ if (!mTransaction)
+ {
+ return false;
+ }
+
+ if (!mTransaction->process())
+ {
+ return false;
+ }
+
+ if (mTransaction->status(NULL) != LLXMLRPCTransaction::StatusComplete)
+ {
+ setError(mTransaction->statusMessage(), mTransaction->statusURI());
+ }
+ else {
+ switch (mTransactionType)
+ {
+ case TransactionCurrency: finishCurrencyInfo(); break;
+ case TransactionBuy: finishCurrencyBuy(); break;
+ default: ;
+ }
+ }
+
+ delete mTransaction;
+ mTransaction = NULL;
+ mTransactionType = TransactionNone;
+
+ return true;
}
void LLCurrencyUIManager::Impl::setError(
- const std::string& message, const std::string& uri)
+ const std::string& message, const std::string& uri)
{
- mError = true;
- mErrorMessage = message;
- mErrorURI = uri;
+ mError = true;
+ mErrorMessage = message;
+ mErrorURI = uri;
}
void LLCurrencyUIManager::Impl::clearError()
{
- mError = false;
- mErrorMessage.clear();
- mErrorURI.clear();
+ mError = false;
+ mErrorMessage.clear();
+ mErrorURI.clear();
}
bool LLCurrencyUIManager::Impl::considerUpdateCurrency()
{
- if (mCurrencyChanged
- && !mTransaction
- && mCurrencyKeyTimer.getElapsedTimeF32() >= CURRENCY_ESTIMATE_FREQUENCY)
- {
- updateCurrencyInfo();
- return true;
- }
+ if (mCurrencyChanged
+ && !mTransaction
+ && mCurrencyKeyTimer.getElapsedTimeF32() >= CURRENCY_ESTIMATE_FREQUENCY)
+ {
+ updateCurrencyInfo();
+ return true;
+ }
- return false;
+ return false;
}
void LLCurrencyUIManager::Impl::currencyKey(S32 value)
{
- mUserEnteredCurrencyBuy = true;
- mCurrencyKeyTimer.reset();
+ mUserEnteredCurrencyBuy = true;
+ mCurrencyKeyTimer.reset();
+
+ if (mUserCurrencyBuy == value)
+ {
+ return;
+ }
+
+ mUserCurrencyBuy = value;
+
+ if (hasEstimate()) {
+ clearEstimate();
+ //cannot just simply refresh the whole UI, as the edit field will
+ // get reset and the cursor will change...
- if (mUserCurrencyBuy == value)
- {
- return;
- }
+ mPanel.getChildView("currency_est")->setVisible(FALSE);
+ mPanel.getChildView("getting_data")->setVisible(TRUE);
+ }
- mUserCurrencyBuy = value;
-
- if (hasEstimate()) {
- clearEstimate();
- //cannot just simply refresh the whole UI, as the edit field will
- // get reset and the cursor will change...
-
- mPanel.getChildView("currency_est")->setVisible(FALSE);
- mPanel.getChildView("getting_data")->setVisible(TRUE);
- }
-
- mCurrencyChanged = true;
+ mCurrencyChanged = true;
}
// static
void LLCurrencyUIManager::Impl::onCurrencyKey(
- LLLineEditor* caller, void* data)
+ LLLineEditor* caller, void* data)
{
- S32 value = atoi(caller->getText().c_str());
- LLCurrencyUIManager::Impl* self = (LLCurrencyUIManager::Impl*)data;
- self->currencyKey(value);
+ S32 value = atoi(caller->getText().c_str());
+ LLCurrencyUIManager::Impl* self = (LLCurrencyUIManager::Impl*)data;
+ self->currencyKey(value);
}
void LLCurrencyUIManager::Impl::prepare()
{
- LLLineEditor* lindenAmount = mPanel.getChild<LLLineEditor>("currency_amt");
- if (lindenAmount)
- {
- lindenAmount->setPrevalidate(LLTextValidate::validateNonNegativeS32);
- lindenAmount->setKeystrokeCallback(onCurrencyKey, this);
- }
+ LLLineEditor* lindenAmount = mPanel.getChild<LLLineEditor>("currency_amt");
+ if (lindenAmount)
+ {
+ lindenAmount->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ lindenAmount->setKeystrokeCallback(onCurrencyKey, this);
+ }
}
void LLCurrencyUIManager::Impl::updateUI()
{
- if (mHidden)
- {
- mPanel.getChildView("currency_action")->setVisible(FALSE);
- mPanel.getChildView("currency_amt")->setVisible(FALSE);
- mPanel.getChildView("currency_est")->setVisible(FALSE);
- return;
- }
-
- mPanel.getChildView("currency_action")->setVisible(TRUE);
-
- LLLineEditor* lindenAmount = mPanel.getChild<LLLineEditor>("currency_amt");
- if (lindenAmount)
- {
- lindenAmount->setVisible(true);
- lindenAmount->setLabel(mZeroMessage);
-
- if (!mUserEnteredCurrencyBuy)
- {
- if (mUserCurrencyBuy == 0)
- {
- lindenAmount->setText(LLStringUtil::null);
- }
- else
- {
- lindenAmount->setText(llformat("%d", mUserCurrencyBuy));
- }
-
- lindenAmount->selectAll();
- }
- }
-
- std::string estimated = (mUserCurrencyBuy == 0) ? mPanel.getString("estimated_zero") : getLocalEstimate();
- mPanel.getChild<LLUICtrl>("currency_est")->setTextArg("[LOCALAMOUNT]", estimated);
- mPanel.getChildView("currency_est")->setVisible( hasEstimate() || mUserCurrencyBuy == 0);
-
- mPanel.getChildView("currency_links")->setVisible( mSupportsInternationalBilling);
- mPanel.getChildView("exchange_rate_note")->setVisible( mSupportsInternationalBilling);
-
- if (mPanel.getChildView("buy_btn")->getEnabled()
- ||mPanel.getChildView("currency_est")->getVisible()
- || mPanel.getChildView("error_web")->getVisible())
- {
- mPanel.getChildView("getting_data")->setVisible(FALSE);
- }
+ if (mHidden)
+ {
+ mPanel.getChildView("currency_action")->setVisible(FALSE);
+ mPanel.getChildView("currency_amt")->setVisible(FALSE);
+ mPanel.getChildView("currency_est")->setVisible(FALSE);
+ return;
+ }
+
+ mPanel.getChildView("currency_action")->setVisible(TRUE);
+
+ LLLineEditor* lindenAmount = mPanel.getChild<LLLineEditor>("currency_amt");
+ if (lindenAmount)
+ {
+ lindenAmount->setVisible(true);
+ lindenAmount->setLabel(mZeroMessage);
+
+ if (!mUserEnteredCurrencyBuy)
+ {
+ if (mUserCurrencyBuy == 0)
+ {
+ lindenAmount->setText(LLStringUtil::null);
+ }
+ else
+ {
+ lindenAmount->setText(llformat("%d", mUserCurrencyBuy));
+ }
+
+ lindenAmount->selectAll();
+ }
+ }
+
+ std::string estimated = (mUserCurrencyBuy == 0) ? mPanel.getString("estimated_zero") : getLocalEstimate();
+ mPanel.getChild<LLUICtrl>("currency_est")->setTextArg("[LOCALAMOUNT]", estimated);
+ mPanel.getChildView("currency_est")->setVisible( hasEstimate() || mUserCurrencyBuy == 0);
+
+ mPanel.getChildView("currency_links")->setVisible( mSupportsInternationalBilling);
+ mPanel.getChildView("exchange_rate_note")->setVisible( mSupportsInternationalBilling);
+
+ if (mPanel.getChildView("buy_btn")->getEnabled()
+ ||mPanel.getChildView("currency_est")->getVisible()
+ || mPanel.getChildView("error_web")->getVisible())
+ {
+ mPanel.getChildView("getting_data")->setVisible(FALSE);
+ }
}
LLCurrencyUIManager::LLCurrencyUIManager(LLPanel& dialog)
- : impl(* new Impl(dialog))
+ : impl(* new Impl(dialog))
{
}
LLCurrencyUIManager::~LLCurrencyUIManager()
{
- delete &impl;
+ delete &impl;
}
void LLCurrencyUIManager::setAmount(int amount, bool noEstimate)
{
- impl.mUserCurrencyBuy = amount;
- impl.mUserEnteredCurrencyBuy = false;
- impl.updateUI();
-
- impl.mCurrencyChanged = !noEstimate;
+ impl.mUserCurrencyBuy = amount;
+ impl.mUserEnteredCurrencyBuy = false;
+ impl.updateUI();
+
+ impl.mCurrencyChanged = !noEstimate;
}
int LLCurrencyUIManager::getAmount()
{
- return impl.mUserCurrencyBuy;
+ return impl.mUserCurrencyBuy;
}
void LLCurrencyUIManager::setZeroMessage(const std::string& message)
{
- impl.mZeroMessage = message;
+ impl.mZeroMessage = message;
}
void LLCurrencyUIManager::setUSDEstimate(int amount)
{
- impl.mUSDCurrencyEstimatedCost = amount;
- impl.mUSDCurrencyEstimated = true;
- impl.updateUI();
-
- impl.mCurrencyChanged = false;
+ impl.mUSDCurrencyEstimatedCost = amount;
+ impl.mUSDCurrencyEstimated = true;
+ impl.updateUI();
+
+ impl.mCurrencyChanged = false;
}
int LLCurrencyUIManager::getUSDEstimate()
{
- return impl.mUSDCurrencyEstimated ? impl.mUSDCurrencyEstimatedCost : 0;
+ return impl.mUSDCurrencyEstimated ? impl.mUSDCurrencyEstimatedCost : 0;
}
void LLCurrencyUIManager::setLocalEstimate(const std::string &amount)
{
- impl.mLocalCurrencyEstimatedCost = amount;
- impl.mLocalCurrencyEstimated = true;
- impl.updateUI();
-
- impl.mCurrencyChanged = false;
+ impl.mLocalCurrencyEstimatedCost = amount;
+ impl.mLocalCurrencyEstimated = true;
+ impl.updateUI();
+
+ impl.mCurrencyChanged = false;
}
std::string LLCurrencyUIManager::getLocalEstimate() const
{
- return impl.getLocalEstimate();
+ return impl.getLocalEstimate();
}
void LLCurrencyUIManager::prepare()
{
- impl.prepare();
+ impl.prepare();
}
void LLCurrencyUIManager::updateUI(bool show)
{
- impl.mHidden = !show;
- impl.updateUI();
+ impl.mHidden = !show;
+ impl.updateUI();
}
bool LLCurrencyUIManager::process()
{
- bool changed = false;
- changed |= impl.checkTransaction();
- changed |= impl.considerUpdateCurrency();
- return changed;
+ bool changed = false;
+ changed |= impl.checkTransaction();
+ changed |= impl.considerUpdateCurrency();
+ return changed;
}
void LLCurrencyUIManager::buy(const std::string& buy_msg)
{
- if (!canBuy())
- {
- return;
- }
+ if (!canBuy())
+ {
+ return;
+ }
- LLUIString msg = buy_msg;
- msg.setArg("[LINDENS]", llformat("%d", impl.mUserCurrencyBuy));
- msg.setArg("[LOCALAMOUNT]", getLocalEstimate());
- LLConfirmationManager::confirm(impl.mSiteConfirm,
- msg,
- impl,
- &LLCurrencyUIManager::Impl::startCurrencyBuy);
+ LLUIString msg = buy_msg;
+ msg.setArg("[LINDENS]", llformat("%d", impl.mUserCurrencyBuy));
+ msg.setArg("[LOCALAMOUNT]", getLocalEstimate());
+ LLConfirmationManager::confirm(impl.mSiteConfirm,
+ msg,
+ impl,
+ &LLCurrencyUIManager::Impl::startCurrencyBuy);
}
bool LLCurrencyUIManager::inProcess()
{
- return impl.mTransactionType != Impl::TransactionNone;
+ return impl.mTransactionType != Impl::TransactionNone;
}
bool LLCurrencyUIManager::canCancel()
{
- return impl.mTransactionType != Impl::TransactionBuy;
+ return impl.mTransactionType != Impl::TransactionBuy;
}
bool LLCurrencyUIManager::canBuy()
{
- return impl.mTransactionType == Impl::TransactionNone
- && impl.hasEstimate()
- && impl.mUserCurrencyBuy > 0;
+ return impl.mTransactionType == Impl::TransactionNone
+ && impl.hasEstimate()
+ && impl.mUserCurrencyBuy > 0;
}
bool LLCurrencyUIManager::buying()
{
- return impl.mTransactionType == Impl::TransactionBuy;
+ return impl.mTransactionType == Impl::TransactionBuy;
}
bool LLCurrencyUIManager::bought()
{
- return impl.mBought;
+ return impl.mBought;
}
void LLCurrencyUIManager::clearError()
{
- impl.clearError();
+ impl.clearError();
}
bool LLCurrencyUIManager::hasError()
{
- return impl.mError;
+ return impl.mError;
}
std::string LLCurrencyUIManager::errorMessage()
{
- return impl.mErrorMessage;
+ return impl.mErrorMessage;
}
std::string LLCurrencyUIManager::errorURI()
{
- return impl.mErrorURI;
+ return impl.mErrorURI;
}
diff --git a/indra/newview/llcurrencyuimanager.h b/indra/newview/llcurrencyuimanager.h
index 7c05acbb05..140318b3d9 100644
--- a/indra/newview/llcurrencyuimanager.h
+++ b/indra/newview/llcurrencyuimanager.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcurrencyuimanager.h
* @brief LLCurrencyUIManager class definition
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,68 +31,68 @@ class LLPanel;
class LLCurrencyUIManager
- // manages the currency purchase portion of any dialog
- // takes control of, and assumes repsonsibility for several
- // fields:
- // 'currency_action' - the text "Buy L$" before the entry field
- // 'currency_amt' - the line editor for the entry amount
- // 'currency_est' - the estimated cost from the web site
+ // manages the currency purchase portion of any dialog
+ // takes control of, and assumes repsonsibility for several
+ // fields:
+ // 'currency_action' - the text "Buy L$" before the entry field
+ // 'currency_amt' - the line editor for the entry amount
+ // 'currency_est' - the estimated cost from the web site
{
public:
- LLCurrencyUIManager(LLPanel& parent);
- virtual ~LLCurrencyUIManager();
-
- void setAmount(int, bool noEstimate = false);
- int getAmount();
- // the amount in L$ to purchase
- // setting it overwrites the user's entry
- // if noEstimate is true, than no web request is made
-
- void setZeroMessage(const std::string& message);
- // sets the gray message to show when zero
-
- void setUSDEstimate(int); // deprecated in 2.0
- int getUSDEstimate(); // deprecated in 2.0
- // the amount in US$ * 100 (in otherwords, in cents)
- // use set when you get this information from elsewhere
-
- void setLocalEstimate(const std::string &local_est);
- std::string getLocalEstimate() const;
- // the estimated cost in the user's local currency
- // for example, "US$ 10.00" or "10.00 Euros"
-
- void prepare();
- // call once after dialog is built, from postBuild()
- void updateUI(bool show = true);
- // update all UI elements, if show is false, they are all set not visible
- // normally, this is done automatically, but you can force it
- // the show/hidden state is remembered
- bool process();
- // call periodically, for example, from draw()
- // returns true if the UI needs to be updated
-
- void buy(const std::string& buy_msg);
- // call to initiate the purchase
-
- bool inProcess(); // is a transaction in process
- bool canCancel(); // can we cancel it (by destructing this object)
- bool canBuy(); // can the user choose to buy now?
- bool buying(); // are we in the process of buying?
- bool bought(); // did the buy() transaction complete successfully
-
- void clearError();
-
- bool hasError();
- std::string errorMessage();
- std::string errorURI();
- // error information for the user, the URI may be blank
- // the technical error details will have already been logged
+ LLCurrencyUIManager(LLPanel& parent);
+ virtual ~LLCurrencyUIManager();
+
+ void setAmount(int, bool noEstimate = false);
+ int getAmount();
+ // the amount in L$ to purchase
+ // setting it overwrites the user's entry
+ // if noEstimate is true, than no web request is made
+
+ void setZeroMessage(const std::string& message);
+ // sets the gray message to show when zero
+
+ void setUSDEstimate(int); // deprecated in 2.0
+ int getUSDEstimate(); // deprecated in 2.0
+ // the amount in US$ * 100 (in otherwords, in cents)
+ // use set when you get this information from elsewhere
+
+ void setLocalEstimate(const std::string &local_est);
+ std::string getLocalEstimate() const;
+ // the estimated cost in the user's local currency
+ // for example, "US$ 10.00" or "10.00 Euros"
+
+ void prepare();
+ // call once after dialog is built, from postBuild()
+ void updateUI(bool show = true);
+ // update all UI elements, if show is false, they are all set not visible
+ // normally, this is done automatically, but you can force it
+ // the show/hidden state is remembered
+ bool process();
+ // call periodically, for example, from draw()
+ // returns true if the UI needs to be updated
+
+ void buy(const std::string& buy_msg);
+ // call to initiate the purchase
+
+ bool inProcess(); // is a transaction in process
+ bool canCancel(); // can we cancel it (by destructing this object)
+ bool canBuy(); // can the user choose to buy now?
+ bool buying(); // are we in the process of buying?
+ bool bought(); // did the buy() transaction complete successfully
+
+ void clearError();
+
+ bool hasError();
+ std::string errorMessage();
+ std::string errorURI();
+ // error information for the user, the URI may be blank
+ // the technical error details will have already been logged
private:
- class Impl;
- Impl& impl;
+ class Impl;
+ Impl& impl;
};
-#endif
+#endif
diff --git a/indra/newview/llcylinder.cpp b/indra/newview/llcylinder.cpp
index f353851a25..6e1fd41b87 100644
--- a/indra/newview/llcylinder.cpp
+++ b/indra/newview/llcylinder.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcylinder.cpp
* @brief Draws a cylinder using display lists for speed.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,7 +37,7 @@
#include "llgl.h"
#include "llglheaders.h"
-LLCone gCone;
+LLCone gCone;
//
// Cones
@@ -45,31 +45,31 @@ LLCone gCone;
void LLCone::render(S32 sides)
{
- gGL.begin(LLRender::TRIANGLE_FAN);
- gGL.vertex3f(0,0,0);
+ gGL.begin(LLRender::TRIANGLE_FAN);
+ gGL.vertex3f(0,0,0);
- for (U32 i = 0; i < sides; i++)
- {
- F32 a = (F32) i/sides * F_PI*2.f;
- F32 x = cosf(a)*0.5f;
- F32 y = sinf(a)*0.5f;
- gGL.vertex3f(x,y,-.5f);
- }
- gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
+ for (U32 i = 0; i < sides; i++)
+ {
+ F32 a = (F32) i/sides * F_PI*2.f;
+ F32 x = cosf(a)*0.5f;
+ F32 y = sinf(a)*0.5f;
+ gGL.vertex3f(x,y,-.5f);
+ }
+ gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
- gGL.end();
+ gGL.end();
- gGL.begin(LLRender::TRIANGLE_FAN);
- gGL.vertex3f(0.f, 0.f, 0.5f);
- for (U32 i = 0; i < sides; i++)
- {
- F32 a = (F32) i/sides * F_PI*2.f;
- F32 x = cosf(a)*0.5f;
- F32 y = sinf(a)*0.5f;
- gGL.vertex3f(x,y,-0.5f);
- }
- gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
+ gGL.begin(LLRender::TRIANGLE_FAN);
+ gGL.vertex3f(0.f, 0.f, 0.5f);
+ for (U32 i = 0; i < sides; i++)
+ {
+ F32 a = (F32) i/sides * F_PI*2.f;
+ F32 x = cosf(a)*0.5f;
+ F32 y = sinf(a)*0.5f;
+ gGL.vertex3f(x,y,-0.5f);
+ }
+ gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
- gGL.end();
+ gGL.end();
}
diff --git a/indra/newview/llcylinder.h b/indra/newview/llcylinder.h
index 4369f06659..9967dcff1a 100644
--- a/indra/newview/llcylinder.h
+++ b/indra/newview/llcylinder.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llcylinder.h
* @brief Draws a cylinder, and a cone, which is a special case cylinder
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,9 +37,9 @@
//
class LLCone
-{
+{
public:
- void render(S32 sides = 12);
+ void render(S32 sides = 12);
};
diff --git a/indra/newview/lldateutil.cpp b/indra/newview/lldateutil.cpp
index c7fc45f61e..246e2099f9 100644
--- a/indra/newview/lldateutil.cpp
+++ b/indra/newview/lldateutil.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file lldateutil.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,178 +38,178 @@ using namespace boost::gregorian;
using namespace boost::posix_time;
static S32 DAYS_PER_MONTH_NOLEAP[] =
- { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static S32 DAYS_PER_MONTH_LEAP[] =
- { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static S32 days_from_month(S32 year, S32 month)
{
- llassert_always(1 <= month);
- llassert_always(month <= 12);
-
- if (year % 4 == 0
- && year % 100 != 0)
- {
- // leap year
- return DAYS_PER_MONTH_LEAP[month - 1];
- }
- else
- {
- return DAYS_PER_MONTH_NOLEAP[month - 1];
- }
+ llassert_always(1 <= month);
+ llassert_always(month <= 12);
+
+ if (year % 4 == 0
+ && year % 100 != 0)
+ {
+ // leap year
+ return DAYS_PER_MONTH_LEAP[month - 1];
+ }
+ else
+ {
+ return DAYS_PER_MONTH_NOLEAP[month - 1];
+ }
}
bool LLDateUtil::dateFromPDTString(LLDate& date, const std::string& str)
{
- S32 month, day, year;
- S32 matched = sscanf(str.c_str(), "%d/%d/%d", &month, &day, &year);
- if (matched != 3) return false;
- date.fromYMDHMS(year, month, day);
- F64 secs_since_epoch = date.secondsSinceEpoch();
- // Correct for the fact that specified date is in Pacific time, == UTC - 8
- secs_since_epoch += 8.0 * 60.0 * 60.0;
- date.secondsSinceEpoch(secs_since_epoch);
- return true;
+ S32 month, day, year;
+ S32 matched = sscanf(str.c_str(), "%d/%d/%d", &month, &day, &year);
+ if (matched != 3) return false;
+ date.fromYMDHMS(year, month, day);
+ F64 secs_since_epoch = date.secondsSinceEpoch();
+ // Correct for the fact that specified date is in Pacific time, == UTC - 8
+ secs_since_epoch += 8.0 * 60.0 * 60.0;
+ date.secondsSinceEpoch(secs_since_epoch);
+ return true;
}
std::string LLDateUtil::ageFromDate(const LLDate& born_date, const LLDate& now)
{
- S32 born_month, born_day, born_year;
- // explode out to month/day/year again
- born_date.split(&born_year, &born_month, &born_day);
-
- S32 now_year, now_month, now_day;
- now.split(&now_year, &now_month, &now_day);
-
- // Do grade-school subtraction, from right-to-left, borrowing from the left
- // when things go negative
- S32 age_days = (now_day - born_day);
- if (age_days < 0)
- {
- now_month -= 1;
- if (now_month == 0)
- {
- now_year -= 1;
- now_month = 12;
- }
- age_days += days_from_month(now_year, now_month);
- }
- S32 age_months = (now_month - born_month);
- if (age_months < 0)
- {
- now_year -= 1;
- age_months += 12;
- }
- S32 age_years = (now_year - born_year);
-
- // Noun pluralization depends on language
- std::string lang = LLUI::getLanguage();
-
- // Try for age in round number of years
- LLStringUtil::format_map_t args;
-
- if (age_months > 0 || age_years > 0)
- {
- args["[AGEYEARS]"] =
- LLTrans::getCountString(lang, "AgeYears", age_years);
- args["[AGEMONTHS]"] =
- LLTrans::getCountString(lang, "AgeMonths", age_months);
-
- // We want to display times like:
- // 2 year 2 months
- // 2 years (implicitly 0 months)
- // 11 months
- if (age_years > 0)
- {
- if (age_months > 0)
- {
- return LLTrans::getString("YearsMonthsOld", args);
- }
- else
- {
- return LLTrans::getString("YearsOld", args);
- }
- }
- else // age_years == 0
- {
- return LLTrans::getString("MonthsOld", args);
- }
- }
- // you're 0 months old, display in weeks or days
-
- // Now for age in weeks
- S32 age_weeks = age_days / 7;
- age_days = age_days % 7;
- if (age_weeks > 0)
- {
- args["[AGEWEEKS]"] =
- LLTrans::getCountString(lang, "AgeWeeks", age_weeks);
- return LLTrans::getString("WeeksOld", args);
- }
-
- // Down to days now
- if (age_days > 0)
- {
- args["[AGEDAYS]"] =
- LLTrans::getCountString(lang, "AgeDays", age_days);
- return LLTrans::getString("DaysOld", args);
- }
-
- return LLTrans::getString("TodayOld");
+ S32 born_month, born_day, born_year;
+ // explode out to month/day/year again
+ born_date.split(&born_year, &born_month, &born_day);
+
+ S32 now_year, now_month, now_day;
+ now.split(&now_year, &now_month, &now_day);
+
+ // Do grade-school subtraction, from right-to-left, borrowing from the left
+ // when things go negative
+ S32 age_days = (now_day - born_day);
+ if (age_days < 0)
+ {
+ now_month -= 1;
+ if (now_month == 0)
+ {
+ now_year -= 1;
+ now_month = 12;
+ }
+ age_days += days_from_month(now_year, now_month);
+ }
+ S32 age_months = (now_month - born_month);
+ if (age_months < 0)
+ {
+ now_year -= 1;
+ age_months += 12;
+ }
+ S32 age_years = (now_year - born_year);
+
+ // Noun pluralization depends on language
+ std::string lang = LLUI::getLanguage();
+
+ // Try for age in round number of years
+ LLStringUtil::format_map_t args;
+
+ if (age_months > 0 || age_years > 0)
+ {
+ args["[AGEYEARS]"] =
+ LLTrans::getCountString(lang, "AgeYears", age_years);
+ args["[AGEMONTHS]"] =
+ LLTrans::getCountString(lang, "AgeMonths", age_months);
+
+ // We want to display times like:
+ // 2 year 2 months
+ // 2 years (implicitly 0 months)
+ // 11 months
+ if (age_years > 0)
+ {
+ if (age_months > 0)
+ {
+ return LLTrans::getString("YearsMonthsOld", args);
+ }
+ else
+ {
+ return LLTrans::getString("YearsOld", args);
+ }
+ }
+ else // age_years == 0
+ {
+ return LLTrans::getString("MonthsOld", args);
+ }
+ }
+ // you're 0 months old, display in weeks or days
+
+ // Now for age in weeks
+ S32 age_weeks = age_days / 7;
+ age_days = age_days % 7;
+ if (age_weeks > 0)
+ {
+ args["[AGEWEEKS]"] =
+ LLTrans::getCountString(lang, "AgeWeeks", age_weeks);
+ return LLTrans::getString("WeeksOld", args);
+ }
+
+ // Down to days now
+ if (age_days > 0)
+ {
+ args["[AGEDAYS]"] =
+ LLTrans::getCountString(lang, "AgeDays", age_days);
+ return LLTrans::getString("DaysOld", args);
+ }
+
+ return LLTrans::getString("TodayOld");
}
std::string LLDateUtil::ageFromDate(const std::string& date_string, const LLDate& now)
{
- LLDate born_date;
+ LLDate born_date;
- if (!dateFromPDTString(born_date, date_string))
- return "???";
+ if (!dateFromPDTString(born_date, date_string))
+ return "???";
- return ageFromDate(born_date, now);
+ return ageFromDate(born_date, now);
}
std::string LLDateUtil::ageFromDate(const std::string& date_string)
{
- return ageFromDate(date_string, LLDate::now());
+ return ageFromDate(date_string, LLDate::now());
}
//std::string LLDateUtil::ageFromDateISO(const std::string& date_string,
-// const LLDate& now)
+// const LLDate& now)
//{
-// S32 born_month, born_day, born_year;
-// S32 matched = sscanf(date_string.c_str(), "%d-%d-%d",
-// &born_year, &born_month, &born_day);
-// if (matched != 3) return "???";
-// date.fromYMDHMS(year, month, day);
-// F64 secs_since_epoch = date.secondsSinceEpoch();
-// // Correct for the fact that specified date is in Pacific time, == UTC - 8
-// secs_since_epoch += 8.0 * 60.0 * 60.0;
-// date.secondsSinceEpoch(secs_since_epoch);
-// return ageFromDate(born_year, born_month, born_day, now);
+// S32 born_month, born_day, born_year;
+// S32 matched = sscanf(date_string.c_str(), "%d-%d-%d",
+// &born_year, &born_month, &born_day);
+// if (matched != 3) return "???";
+// date.fromYMDHMS(year, month, day);
+// F64 secs_since_epoch = date.secondsSinceEpoch();
+// // Correct for the fact that specified date is in Pacific time, == UTC - 8
+// secs_since_epoch += 8.0 * 60.0 * 60.0;
+// date.secondsSinceEpoch(secs_since_epoch);
+// return ageFromDate(born_year, born_month, born_day, now);
//}
//
//std::string LLDateUtil::ageFromDateISO(const std::string& date_string)
//{
-// return ageFromDateISO(date_string, LLDate::now());
+// return ageFromDateISO(date_string, LLDate::now());
//}
S32 LLDateUtil::secondsSinceEpochFromString(const std::string& format, const std::string& str)
{
- date_input_facet *facet = new date_input_facet(format);
+ date_input_facet *facet = new date_input_facet(format);
- std::stringstream ss;
- ss << str;
- ss.imbue(std::locale(ss.getloc(), facet));
+ std::stringstream ss;
+ ss << str;
+ ss.imbue(std::locale(ss.getloc(), facet));
- date d;
- ss >> d;
+ date d;
+ ss >> d;
- ptime time_t_date(d);
- ptime time_t_epoch(date(1970,1,1));
+ ptime time_t_date(d);
+ ptime time_t_epoch(date(1970,1,1));
- // We assume that the date defined by str is in UTC, so the difference
- // is calculated with no time zone corrections.
- time_duration diff = time_t_date - time_t_epoch;
+ // We assume that the date defined by str is in UTC, so the difference
+ // is calculated with no time zone corrections.
+ time_duration diff = time_t_date - time_t_epoch;
- return diff.total_seconds();
+ return diff.total_seconds();
}
diff --git a/indra/newview/lldateutil.h b/indra/newview/lldateutil.h
index f027d360f7..0a62a970cf 100644
--- a/indra/newview/lldateutil.h
+++ b/indra/newview/lldateutil.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file lldateutil.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,59 +30,59 @@ class LLDate;
namespace LLDateUtil
{
- /**
- * Convert a date provided by the server into seconds since the Epoch.
- *
- * @param[out] date Number of seconds since 01/01/1970 UTC.
- * @param[in] str Date string (MM/DD/YYYY) in PDT time zone.
- *
- * @return true on success, false on parse error
- */
- bool dateFromPDTString(LLDate& date, const std::string& str);
+ /**
+ * Convert a date provided by the server into seconds since the Epoch.
+ *
+ * @param[out] date Number of seconds since 01/01/1970 UTC.
+ * @param[in] str Date string (MM/DD/YYYY) in PDT time zone.
+ *
+ * @return true on success, false on parse error
+ */
+ bool dateFromPDTString(LLDate& date, const std::string& str);
- /**
- * Get human-readable avatar age.
- *
- * Used for avatar inspectors and profiles.
- *
- * @param born_date Date an avatar was born on.
- * @param now Current date.
- *
- * @return human-readable localized string like "1 year, 2 months",
- * or "???" on error.
- */
- std::string ageFromDate(const LLDate& born_date, const LLDate& now);
+ /**
+ * Get human-readable avatar age.
+ *
+ * Used for avatar inspectors and profiles.
+ *
+ * @param born_date Date an avatar was born on.
+ * @param now Current date.
+ *
+ * @return human-readable localized string like "1 year, 2 months",
+ * or "???" on error.
+ */
+ std::string ageFromDate(const LLDate& born_date, const LLDate& now);
- // Convert a date provided by the server (MM/DD/YYYY) into a localized,
- // human-readable age (1 year, 2 months) using translation strings.
- // Pass LLDate::now() for now.
- // Used for avatar inspectors and profiles.
- std::string ageFromDate(const std::string& date_string, const LLDate& now);
+ // Convert a date provided by the server (MM/DD/YYYY) into a localized,
+ // human-readable age (1 year, 2 months) using translation strings.
+ // Pass LLDate::now() for now.
+ // Used for avatar inspectors and profiles.
+ std::string ageFromDate(const std::string& date_string, const LLDate& now);
- // Calls the above with LLDate::now()
- std::string ageFromDate(const std::string& date_string);
+ // Calls the above with LLDate::now()
+ std::string ageFromDate(const std::string& date_string);
- // As above, for YYYY-MM-DD dates
- //std::string ageFromDateISO(const std::string& date_string, const LLDate& now);
+ // As above, for YYYY-MM-DD dates
+ //std::string ageFromDateISO(const std::string& date_string, const LLDate& now);
- // Calls the above with LLDate::now()
- //std::string ageFromDateISO(const std::string& date_string);
+ // Calls the above with LLDate::now()
+ //std::string ageFromDateISO(const std::string& date_string);
- //std::string ageFromDate(S32 born_year, S32 born_month, S32 born_day, const LLDate& now);
+ //std::string ageFromDate(S32 born_year, S32 born_month, S32 born_day, const LLDate& now);
- /**
- * Convert a string of a specified date format into seconds since the Epoch.
- *
- * Many of the format flags are those used by strftime(...), but not all.
- * For the full list of supported time format specifiers
- * see http://www.boost.org/doc/libs/1_47_0/doc/html/date_time/date_time_io.html#date_time.format_flags
- *
- * @param format Format characters string. Example: "%A %b %d, %Y"
- * @param str Date string containing the time in specified format.
- *
- * @return Number of seconds since 01/01/1970 UTC.
- */
- S32 secondsSinceEpochFromString(const std::string& format, const std::string& str);
+ /**
+ * Convert a string of a specified date format into seconds since the Epoch.
+ *
+ * Many of the format flags are those used by strftime(...), but not all.
+ * For the full list of supported time format specifiers
+ * see http://www.boost.org/doc/libs/1_47_0/doc/html/date_time/date_time_io.html#date_time.format_flags
+ *
+ * @param format Format characters string. Example: "%A %b %d, %Y"
+ * @param str Date string containing the time in specified format.
+ *
+ * @return Number of seconds since 01/01/1970 UTC.
+ */
+ S32 secondsSinceEpochFromString(const std::string& format, const std::string& str);
}
#endif
diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp
index c8b9b1ac63..7d305fe261 100644
--- a/indra/newview/lldebugmessagebox.cpp
+++ b/indra/newview/lldebugmessagebox.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldebugmessagebox.cpp
* @brief Implementation of a simple, non-modal message box.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,249 +43,249 @@
std::map<std::string, LLDebugVarMessageBox*> LLDebugVarMessageBox::sInstances;
-LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var) :
- LLFloater(LLSD()),
- mVarType(var_type), mVarData(var), mAnimate(FALSE)
+LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var) :
+ LLFloater(LLSD()),
+ mVarType(var_type), mVarData(var), mAnimate(FALSE)
{
- setRect(LLRect(10,160,400,10));
-
- LLSliderCtrl::Params slider_p;
- slider_p.label(title);
- slider_p.label_width(70);
- slider_p.text_width(40);
- slider_p.can_edit_text(true);
- slider_p.show_text(true);
+ setRect(LLRect(10,160,400,10));
+
+ LLSliderCtrl::Params slider_p;
+ slider_p.label(title);
+ slider_p.label_width(70);
+ slider_p.text_width(40);
+ slider_p.can_edit_text(true);
+ slider_p.show_text(true);
- mSlider1 = NULL;
- mSlider2 = NULL;
- mSlider3 = NULL;
+ mSlider1 = NULL;
+ mSlider2 = NULL;
+ mSlider3 = NULL;
- switch(var_type)
- {
- case VAR_TYPE_F32:
- slider_p.name("slider 1");
- slider_p.rect(LLRect(20,130,190,110));
- slider_p.initial_value(*((F32*)var));
- slider_p.min_value(-100.f);
- slider_p.max_value(100.f);
- slider_p.increment(0.1f);
- slider_p.decimal_digits(3);
- mSlider1 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
- addChild(mSlider1);
- break;
- case VAR_TYPE_S32:
- slider_p.name("slider 1");
- slider_p.rect(LLRect(20,100,190,80));
- slider_p.initial_value((F32)*((S32*)var));
- slider_p.min_value(-255.f);
- slider_p.max_value(255.f);
- slider_p.increment(1.f);
- slider_p.decimal_digits(0);
- mSlider1 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
- addChild(mSlider1);
- break;
- case VAR_TYPE_VEC3:
- slider_p.name("slider 1");
- slider_p.label("x: ");
- slider_p.rect(LLRect(20,130,190,110));
- slider_p.initial_value(((LLVector3*)var)->mV[VX]);
- slider_p.min_value(-100.f);
- slider_p.max_value(100.f);
- slider_p.increment(0.1f);
- slider_p.decimal_digits(3);
- mSlider1 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
+ switch(var_type)
+ {
+ case VAR_TYPE_F32:
+ slider_p.name("slider 1");
+ slider_p.rect(LLRect(20,130,190,110));
+ slider_p.initial_value(*((F32*)var));
+ slider_p.min_value(-100.f);
+ slider_p.max_value(100.f);
+ slider_p.increment(0.1f);
+ slider_p.decimal_digits(3);
+ mSlider1 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
+ addChild(mSlider1);
+ break;
+ case VAR_TYPE_S32:
+ slider_p.name("slider 1");
+ slider_p.rect(LLRect(20,100,190,80));
+ slider_p.initial_value((F32)*((S32*)var));
+ slider_p.min_value(-255.f);
+ slider_p.max_value(255.f);
+ slider_p.increment(1.f);
+ slider_p.decimal_digits(0);
+ mSlider1 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
+ addChild(mSlider1);
+ break;
+ case VAR_TYPE_VEC3:
+ slider_p.name("slider 1");
+ slider_p.label("x: ");
+ slider_p.rect(LLRect(20,130,190,110));
+ slider_p.initial_value(((LLVector3*)var)->mV[VX]);
+ slider_p.min_value(-100.f);
+ slider_p.max_value(100.f);
+ slider_p.increment(0.1f);
+ slider_p.decimal_digits(3);
+ mSlider1 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
- slider_p.name("slider 2");
- slider_p.label("y: ");
- slider_p.rect(LLRect(20,100,190,80));
- slider_p.initial_value(((LLVector3*)var)->mV[VY]);
- mSlider2 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
+ slider_p.name("slider 2");
+ slider_p.label("y: ");
+ slider_p.rect(LLRect(20,100,190,80));
+ slider_p.initial_value(((LLVector3*)var)->mV[VY]);
+ mSlider2 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
- slider_p.name("slider 3");
- slider_p.label("z: ");
- slider_p.rect(LLRect(20,70,190,50));
- slider_p.initial_value(((LLVector3*)var)->mV[VZ]);
- mSlider2 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
+ slider_p.name("slider 3");
+ slider_p.label("z: ");
+ slider_p.rect(LLRect(20,70,190,50));
+ slider_p.initial_value(((LLVector3*)var)->mV[VZ]);
+ mSlider2 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
- addChild(mSlider1);
- addChild(mSlider2);
- addChild(mSlider3);
- break;
- default:
- LL_WARNS() << "Unhandled var type " << var_type << LL_ENDL;
- break;
- }
+ addChild(mSlider1);
+ addChild(mSlider2);
+ addChild(mSlider3);
+ break;
+ default:
+ LL_WARNS() << "Unhandled var type " << var_type << LL_ENDL;
+ break;
+ }
- LLButton::Params p;
- p.name(std::string("Animate"));
- p.label(std::string("Animate"));
- p.rect(LLRect(20, 45, 180, 25));
- p.click_callback.function(boost::bind(&LLDebugVarMessageBox::onAnimateClicked, this, _2));
- mAnimateButton = LLUICtrlFactory::create<LLButton>(p);
- addChild(mAnimateButton);
+ LLButton::Params p;
+ p.name(std::string("Animate"));
+ p.label(std::string("Animate"));
+ p.rect(LLRect(20, 45, 180, 25));
+ p.click_callback.function(boost::bind(&LLDebugVarMessageBox::onAnimateClicked, this, _2));
+ mAnimateButton = LLUICtrlFactory::create<LLButton>(p);
+ addChild(mAnimateButton);
- LLTextBox::Params params;
- params.name("value");
- params.initial_value(params.name());
- params.rect(LLRect(20,20,190,0));
- mText = LLUICtrlFactory::create<LLTextBox> (params);
- addChild(mText);
+ LLTextBox::Params params;
+ params.name("value");
+ params.initial_value(params.name());
+ params.rect(LLRect(20,20,190,0));
+ mText = LLUICtrlFactory::create<LLTextBox> (params);
+ addChild(mText);
- //disable hitting enter closes dialog
- setDefaultBtn();
+ //disable hitting enter closes dialog
+ setDefaultBtn();
}
LLDebugVarMessageBox::~LLDebugVarMessageBox()
{
- sInstances.erase(mTitle);
+ sInstances.erase(mTitle);
}
void LLDebugVarMessageBox::show(const std::string& title, F32 *var, F32 max_value, F32 increment)
{
#ifndef LL_RELEASE_FOR_DOWNLOAD
- LLDebugVarMessageBox* box = show(title, VAR_TYPE_F32, (void*)var);
- max_value = llabs(max_value);
- box->mSlider1->setMaxValue(max_value);
- box->mSlider1->setMinValue(-max_value);
- box->mSlider1->setIncrement(increment);
- if (!gFocusMgr.childHasKeyboardFocus(box))
- {
- box->mSlider1->setValue(*var);
- }
- box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
+ LLDebugVarMessageBox* box = show(title, VAR_TYPE_F32, (void*)var);
+ max_value = llabs(max_value);
+ box->mSlider1->setMaxValue(max_value);
+ box->mSlider1->setMinValue(-max_value);
+ box->mSlider1->setIncrement(increment);
+ if (!gFocusMgr.childHasKeyboardFocus(box))
+ {
+ box->mSlider1->setValue(*var);
+ }
+ box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
#endif
}
void LLDebugVarMessageBox::show(const std::string& title, S32 *var, S32 max_value, S32 increment)
{
#ifndef LL_RELEASE_FOR_DOWNLOAD
- LLDebugVarMessageBox* box = show(title, VAR_TYPE_S32, (void*)var);
- F32 max_val = llabs((F32)max_value);
- box->mSlider1->setMaxValue(max_val);
- box->mSlider1->setMinValue(-max_val);
- box->mSlider1->setIncrement((F32)increment);
- if (!gFocusMgr.childHasKeyboardFocus(box))
- {
- box->mSlider1->setValue((F32)*var);
- }
- box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
+ LLDebugVarMessageBox* box = show(title, VAR_TYPE_S32, (void*)var);
+ F32 max_val = llabs((F32)max_value);
+ box->mSlider1->setMaxValue(max_val);
+ box->mSlider1->setMinValue(-max_val);
+ box->mSlider1->setIncrement((F32)increment);
+ if (!gFocusMgr.childHasKeyboardFocus(box))
+ {
+ box->mSlider1->setValue((F32)*var);
+ }
+ box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
#endif
}
void LLDebugVarMessageBox::show(const std::string& title, LLVector3 *var, LLVector3 max_value, LLVector3 increment)
{
#ifndef LL_RELEASE_FOR_DOWNLOAD
- LLDebugVarMessageBox* box = show(title, VAR_TYPE_VEC3, (LLVector3*)var);
- max_value.abs();
- box->mSlider1->setMaxValue(max_value.mV[VX]);
- box->mSlider1->setMinValue(-max_value.mV[VX]);
- box->mSlider1->setIncrement(increment.mV[VX]);
- box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
+ LLDebugVarMessageBox* box = show(title, VAR_TYPE_VEC3, (LLVector3*)var);
+ max_value.abs();
+ box->mSlider1->setMaxValue(max_value.mV[VX]);
+ box->mSlider1->setMinValue(-max_value.mV[VX]);
+ box->mSlider1->setIncrement(increment.mV[VX]);
+ box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
- box->mSlider2->setMaxValue(max_value.mV[VX]);
- box->mSlider2->setMinValue(-max_value.mV[VX]);
- box->mSlider2->setIncrement(increment.mV[VX]);
- box->mSlider2->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
+ box->mSlider2->setMaxValue(max_value.mV[VX]);
+ box->mSlider2->setMinValue(-max_value.mV[VX]);
+ box->mSlider2->setIncrement(increment.mV[VX]);
+ box->mSlider2->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
- box->mSlider3->setMaxValue(max_value.mV[VX]);
- box->mSlider3->setMinValue(-max_value.mV[VX]);
- box->mSlider3->setIncrement(increment.mV[VX]);
- box->mSlider3->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
+ box->mSlider3->setMaxValue(max_value.mV[VX]);
+ box->mSlider3->setMinValue(-max_value.mV[VX]);
+ box->mSlider3->setIncrement(increment.mV[VX]);
+ box->mSlider3->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2));
#endif
}
LLDebugVarMessageBox* LLDebugVarMessageBox::show(const std::string& title, EDebugVarType var_type, void *var)
{
- std::string title_string(title);
+ std::string title_string(title);
- LLDebugVarMessageBox *box = sInstances[title_string];
- if (!box)
- {
- box = new LLDebugVarMessageBox(title, var_type, var);
- sInstances[title_string] = box;
- gFloaterView->addChild(box);
- box->reshape(200,150);
- box->openFloater();
- box->mTitle = title_string;
- }
+ LLDebugVarMessageBox *box = sInstances[title_string];
+ if (!box)
+ {
+ box = new LLDebugVarMessageBox(title, var_type, var);
+ sInstances[title_string] = box;
+ gFloaterView->addChild(box);
+ box->reshape(200,150);
+ box->openFloater();
+ box->mTitle = title_string;
+ }
- return box;
+ return box;
}
void LLDebugVarMessageBox::sliderChanged(const LLSD& data)
{
- if (!mVarData)
- return;
+ if (!mVarData)
+ return;
- switch(mVarType)
- {
- case VAR_TYPE_F32:
- *((F32*)mVarData) = (F32)mSlider1->getValue().asReal();
- break;
- case VAR_TYPE_S32:
- *((S32*)mVarData) = (S32)mSlider1->getValue().asInteger();
- break;
- case VAR_TYPE_VEC3:
- {
- LLVector3* vec_p = (LLVector3*)mVarData;
- vec_p->setVec((F32)mSlider1->getValue().asReal(),
- (F32)mSlider2->getValue().asReal(),
- (F32)mSlider3->getValue().asReal());
- break;
- }
- default:
- LL_WARNS() << "Unhandled var type " << mVarType << LL_ENDL;
- break;
- }
+ switch(mVarType)
+ {
+ case VAR_TYPE_F32:
+ *((F32*)mVarData) = (F32)mSlider1->getValue().asReal();
+ break;
+ case VAR_TYPE_S32:
+ *((S32*)mVarData) = (S32)mSlider1->getValue().asInteger();
+ break;
+ case VAR_TYPE_VEC3:
+ {
+ LLVector3* vec_p = (LLVector3*)mVarData;
+ vec_p->setVec((F32)mSlider1->getValue().asReal(),
+ (F32)mSlider2->getValue().asReal(),
+ (F32)mSlider3->getValue().asReal());
+ break;
+ }
+ default:
+ LL_WARNS() << "Unhandled var type " << mVarType << LL_ENDL;
+ break;
+ }
}
void LLDebugVarMessageBox::onAnimateClicked(const LLSD& data)
{
- mAnimate = !mAnimate;
- mAnimateButton->setToggleState(mAnimate);
+ mAnimate = !mAnimate;
+ mAnimateButton->setToggleState(mAnimate);
}
void LLDebugVarMessageBox::draw()
{
- std::string text;
- switch(mVarType)
- {
- case VAR_TYPE_F32:
- text = llformat("%.3f", *((F32*)mVarData));
- break;
- case VAR_TYPE_S32:
- text = llformat("%d", *((S32*)mVarData));
- break;
- case VAR_TYPE_VEC3:
- {
- LLVector3* vec_p = (LLVector3*)mVarData;
- text= llformat("%.3f %.3f %.3f", vec_p->mV[VX], vec_p->mV[VY], vec_p->mV[VZ]);
- break;
- }
- default:
- LL_WARNS() << "Unhandled var type " << mVarType << LL_ENDL;
- break;
- }
- mText->setText(text);
+ std::string text;
+ switch(mVarType)
+ {
+ case VAR_TYPE_F32:
+ text = llformat("%.3f", *((F32*)mVarData));
+ break;
+ case VAR_TYPE_S32:
+ text = llformat("%d", *((S32*)mVarData));
+ break;
+ case VAR_TYPE_VEC3:
+ {
+ LLVector3* vec_p = (LLVector3*)mVarData;
+ text= llformat("%.3f %.3f %.3f", vec_p->mV[VX], vec_p->mV[VY], vec_p->mV[VZ]);
+ break;
+ }
+ default:
+ LL_WARNS() << "Unhandled var type " << mVarType << LL_ENDL;
+ break;
+ }
+ mText->setText(text);
- if(mAnimate)
- {
- if (mSlider1)
- {
- F32 animated_val = clamp_rescale(fmodf((F32)LLFrameTimer::getElapsedSeconds() / 5.f, 1.f), 0.f, 1.f, 0.f, mSlider1->getMaxValue());
- mSlider1->setValue(animated_val);
- sliderChanged(LLSD());
- if (mSlider2)
- {
- mSlider2->setValue(animated_val);
- sliderChanged(LLSD());
- }
- if (mSlider3)
- {
- mSlider3->setValue(animated_val);
- sliderChanged(LLSD());
- }
- }
- }
- LLFloater::draw();
+ if(mAnimate)
+ {
+ if (mSlider1)
+ {
+ F32 animated_val = clamp_rescale(fmodf((F32)LLFrameTimer::getElapsedSeconds() / 5.f, 1.f), 0.f, 1.f, 0.f, mSlider1->getMaxValue());
+ mSlider1->setValue(animated_val);
+ sliderChanged(LLSD());
+ if (mSlider2)
+ {
+ mSlider2->setValue(animated_val);
+ sliderChanged(LLSD());
+ }
+ if (mSlider3)
+ {
+ mSlider3->setValue(animated_val);
+ sliderChanged(LLSD());
+ }
+ }
+ }
+ LLFloater::draw();
}
diff --git a/indra/newview/lldebugmessagebox.h b/indra/newview/lldebugmessagebox.h
index 87a0910662..e95fe5a192 100644
--- a/indra/newview/lldebugmessagebox.h
+++ b/indra/newview/lldebugmessagebox.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldebugmessagebox.h
* @brief Debug message box.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,45 +44,45 @@ class LLSliderCtrl;
typedef enum e_debug_var_type
{
- VAR_TYPE_F32,
- VAR_TYPE_S32,
- VAR_TYPE_VEC2,
- VAR_TYPE_VEC3,
- VAR_TYPE_VEC4,
- VAR_TYPE_COUNT
+ VAR_TYPE_F32,
+ VAR_TYPE_S32,
+ VAR_TYPE_VEC2,
+ VAR_TYPE_VEC3,
+ VAR_TYPE_VEC4,
+ VAR_TYPE_COUNT
} EDebugVarType;
class LLDebugVarMessageBox : public LLFloater
{
protected:
- LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var);
- ~LLDebugVarMessageBox();
+ LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var);
+ ~LLDebugVarMessageBox();
- static LLDebugVarMessageBox* show(const std::string& title, EDebugVarType var_type, void *var);
- void sliderChanged(const LLSD& data);
- void onAnimateClicked(const LLSD& data);
+ static LLDebugVarMessageBox* show(const std::string& title, EDebugVarType var_type, void *var);
+ void sliderChanged(const LLSD& data);
+ void onAnimateClicked(const LLSD& data);
public:
- static void show(const std::string& title, F32 *var, F32 max_value = 100.f, F32 increment = 0.1f);
- static void show(const std::string& title, S32 *var, S32 max_value = 255, S32 increment = 1);
- static void show(const std::string& title, LLVector2 *var, LLVector2 max_value = LLVector2(100.f, 100.f), LLVector2 increment = LLVector2(0.1f, 0.1f));
- static void show(const std::string& title, LLVector3 *var, LLVector3 max_value = LLVector3(100.f, 100.f, 100.f), LLVector3 increment = LLVector3(0.1f, 0.1f, 0.1f));
- //static void show(const std::string& title, LLVector4 *var, LLVector4 max_value = LLVector4(100.f, 100.f, 100.f, 100.f), LLVector4 increment = LLVector4(0.1f, 0.1f, 0.1f, 0.1f));
-
- virtual void draw();
+ static void show(const std::string& title, F32 *var, F32 max_value = 100.f, F32 increment = 0.1f);
+ static void show(const std::string& title, S32 *var, S32 max_value = 255, S32 increment = 1);
+ static void show(const std::string& title, LLVector2 *var, LLVector2 max_value = LLVector2(100.f, 100.f), LLVector2 increment = LLVector2(0.1f, 0.1f));
+ static void show(const std::string& title, LLVector3 *var, LLVector3 max_value = LLVector3(100.f, 100.f, 100.f), LLVector3 increment = LLVector3(0.1f, 0.1f, 0.1f));
+ //static void show(const std::string& title, LLVector4 *var, LLVector4 max_value = LLVector4(100.f, 100.f, 100.f, 100.f), LLVector4 increment = LLVector4(0.1f, 0.1f, 0.1f, 0.1f));
+
+ virtual void draw();
protected:
- EDebugVarType mVarType;
- void* mVarData;
- LLSliderCtrl* mSlider1;
- LLSliderCtrl* mSlider2;
- LLSliderCtrl* mSlider3;
- LLButton* mAnimateButton;
- LLTextBox* mText;
- std::string mTitle;
- BOOL mAnimate;
+ EDebugVarType mVarType;
+ void* mVarData;
+ LLSliderCtrl* mSlider1;
+ LLSliderCtrl* mSlider2;
+ LLSliderCtrl* mSlider3;
+ LLButton* mAnimateButton;
+ LLTextBox* mText;
+ std::string mTitle;
+ BOOL mAnimate;
- static std::map<std::string, LLDebugVarMessageBox*> sInstances;
+ static std::map<std::string, LLDebugVarMessageBox*> sInstances;
};
#endif // LL_LLMESSAGEBOX_H
diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp
index dc1c085c88..12b38458a2 100644
--- a/indra/newview/lldebugview.cpp
+++ b/indra/newview/lldebugview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldebugview.cpp
* @brief A view containing UI elements only visible in build mode.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,83 +52,83 @@ LLDebugView* gDebugView = NULL;
static LLDefaultChildRegistry::Register<LLDebugView> r("debug_view");
LLDebugView::LLDebugView(const LLDebugView::Params& p)
-: LLView(p),
- mFastTimerView(NULL),
- mDebugConsolep(NULL),
- mFloaterSnapRegion(NULL)
+: LLView(p),
+ mFastTimerView(NULL),
+ mDebugConsolep(NULL),
+ mFloaterSnapRegion(NULL)
{}
LLDebugView::~LLDebugView()
{
- // These have already been deleted. Fix the globals appropriately.
- gDebugView = NULL;
- gTextureView = NULL;
- gSceneView = NULL;
- gSceneMonitorView = NULL;
+ // These have already been deleted. Fix the globals appropriately.
+ gDebugView = NULL;
+ gTextureView = NULL;
+ gSceneView = NULL;
+ gSceneMonitorView = NULL;
}
void LLDebugView::init()
{
- LLRect r;
- LLRect rect = getLocalRect();
-
- // Rectangle to draw debug data in (full height, 3/4 width)
- r.set(10, rect.getHeight() - 100, ((rect.getWidth()*3)/4), 100);
- LLConsole::Params cp;
- cp.name("debug console");
- cp.max_lines(20);
- cp.rect(r);
- cp.font(LLFontGL::getFontMonospace());
- cp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_LEFT);
- cp.visible(false);
- mDebugConsolep = LLUICtrlFactory::create<LLConsole>(cp);
- addChild(mDebugConsolep);
-
- r.set(150 - 25, rect.getHeight() - 50, rect.getWidth()/2 - 25, rect.getHeight() - 450);
-
- r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f),
- (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f));
-
- mFastTimerView = dynamic_cast<LLFastTimerView*>(LLFloaterReg::getInstance("block_timers"));
-
- gSceneView = new LLSceneView(r);
- gSceneView->setFollowsTop();
- gSceneView->setFollowsLeft();
- gSceneView->setVisible(FALSE);
- addChild(gSceneView);
- gSceneView->setRect(rect);
-
- gSceneMonitorView = new LLSceneMonitorView(r);
- gSceneMonitorView->setFollowsTop();
- gSceneMonitorView->setFollowsLeft();
- gSceneMonitorView->setVisible(FALSE);
- addChild(gSceneMonitorView);
- gSceneMonitorView->setRect(rect);
-
- r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f),
- (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f));
-
- r.set(150, rect.getHeight() - 50, 820, 100);
- LLTextureView::Params tvp;
- tvp.name("gTextureView");
- tvp.rect(r);
- tvp.follows.flags(FOLLOWS_TOP|FOLLOWS_LEFT);
- tvp.visible(false);
- gTextureView = LLUICtrlFactory::create<LLTextureView>(tvp);
- addChild(gTextureView);
- //gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE);
+ LLRect r;
+ LLRect rect = getLocalRect();
+
+ // Rectangle to draw debug data in (full height, 3/4 width)
+ r.set(10, rect.getHeight() - 100, ((rect.getWidth()*3)/4), 100);
+ LLConsole::Params cp;
+ cp.name("debug console");
+ cp.max_lines(20);
+ cp.rect(r);
+ cp.font(LLFontGL::getFontMonospace());
+ cp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_LEFT);
+ cp.visible(false);
+ mDebugConsolep = LLUICtrlFactory::create<LLConsole>(cp);
+ addChild(mDebugConsolep);
+
+ r.set(150 - 25, rect.getHeight() - 50, rect.getWidth()/2 - 25, rect.getHeight() - 450);
+
+ r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f),
+ (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f));
+
+ mFastTimerView = dynamic_cast<LLFastTimerView*>(LLFloaterReg::getInstance("block_timers"));
+
+ gSceneView = new LLSceneView(r);
+ gSceneView->setFollowsTop();
+ gSceneView->setFollowsLeft();
+ gSceneView->setVisible(FALSE);
+ addChild(gSceneView);
+ gSceneView->setRect(rect);
+
+ gSceneMonitorView = new LLSceneMonitorView(r);
+ gSceneMonitorView->setFollowsTop();
+ gSceneMonitorView->setFollowsLeft();
+ gSceneMonitorView->setVisible(FALSE);
+ addChild(gSceneMonitorView);
+ gSceneMonitorView->setRect(rect);
+
+ r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f),
+ (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f));
+
+ r.set(150, rect.getHeight() - 50, 820, 100);
+ LLTextureView::Params tvp;
+ tvp.name("gTextureView");
+ tvp.rect(r);
+ tvp.follows.flags(FOLLOWS_TOP|FOLLOWS_LEFT);
+ tvp.visible(false);
+ gTextureView = LLUICtrlFactory::create<LLTextureView>(tvp);
+ addChild(gTextureView);
+ //gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE);
}
void LLDebugView::draw()
{
- if (mFloaterSnapRegion == NULL)
- {
- mFloaterSnapRegion = getRootView()->getChildView("floater_snap_region");
- }
+ if (mFloaterSnapRegion == NULL)
+ {
+ mFloaterSnapRegion = getRootView()->getChildView("floater_snap_region");
+ }
- LLRect debug_rect;
- mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &debug_rect, getParent());
+ LLRect debug_rect;
+ mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &debug_rect, getParent());
- setShape(debug_rect);
- LLView::draw();
+ setShape(debug_rect);
+ LLView::draw();
}
diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h
index a6490c876c..0f6da06a6f 100644
--- a/indra/newview/lldebugview.h
+++ b/indra/newview/lldebugview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldebugview.h
* @brief A view containing debug UI elements
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,25 +43,25 @@ class LLFloaterStats;
class LLDebugView : public LLView
{
public:
- struct Params : public LLInitParam::Block<Params, LLView::Params>
- {
- Params()
- {
- changeDefault(mouse_opaque, false);
- }
- };
-
- LLDebugView(const Params&);
- ~LLDebugView();
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ Params()
+ {
+ changeDefault(mouse_opaque, false);
+ }
+ };
+
+ LLDebugView(const Params&);
+ ~LLDebugView();
+
+ void init();
+ void draw();
+
+ void setStatsVisible(BOOL visible);
- void init();
- void draw();
-
- void setStatsVisible(BOOL visible);
-
- LLFastTimerView* mFastTimerView;
- LLConsole* mDebugConsolep;
- LLView* mFloaterSnapRegion;
+ LLFastTimerView* mFastTimerView;
+ LLConsole* mDebugConsolep;
+ LLView* mFloaterSnapRegion;
};
extern LLDebugView* gDebugView;
diff --git a/indra/newview/lldeferredsounds.cpp b/indra/newview/lldeferredsounds.cpp
index e1613e4719..8b7c399af1 100644
--- a/indra/newview/lldeferredsounds.cpp
+++ b/indra/newview/lldeferredsounds.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lldeferredsounds.cpp
* @brief Implementation of lldeferredsounds
* @author Gilbert@lindenlab.com
@@ -33,16 +33,16 @@
void LLDeferredSounds::deferSound(SoundData& sound)
{
- soundVector.push_back(sound);
+ soundVector.push_back(sound);
}
void LLDeferredSounds::playdeferredSounds()
{
- while(soundVector.size())
- {
- if (gAudiop)
- {
- gAudiop->triggerSound(soundVector.back());
- }
- soundVector.pop_back();
- }
+ while(soundVector.size())
+ {
+ if (gAudiop)
+ {
+ gAudiop->triggerSound(soundVector.back());
+ }
+ soundVector.pop_back();
+ }
}
diff --git a/indra/newview/lldeferredsounds.h b/indra/newview/lldeferredsounds.h
index 33f02b3521..e586226184 100644
--- a/indra/newview/lldeferredsounds.h
+++ b/indra/newview/lldeferredsounds.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lldeferredsounds.h
* @brief Header file for lldeferredsounds
* @author Gilbert@lindenlab.com
@@ -33,13 +33,13 @@ struct SoundData;
class LLDeferredSounds : public LLSingleton<LLDeferredSounds>
{
- LLSINGLETON_EMPTY_CTOR(LLDeferredSounds);
- std::vector<SoundData> soundVector;
+ LLSINGLETON_EMPTY_CTOR(LLDeferredSounds);
+ std::vector<SoundData> soundVector;
public:
- //Add sounds to be played once progress bar is hidden (such as after teleport or loading screen)
- void deferSound(SoundData& sound);
+ //Add sounds to be played once progress bar is hidden (such as after teleport or loading screen)
+ void deferSound(SoundData& sound);
- void playdeferredSounds();
+ void playdeferredSounds();
};
#endif // LL_LLDEFERREDSOUNDS_H
diff --git a/indra/newview/lldelayedgestureerror.cpp b/indra/newview/lldelayedgestureerror.cpp
index 934a38bb8e..710e1a33db 100644
--- a/indra/newview/lldelayedgestureerror.cpp
+++ b/indra/newview/lldelayedgestureerror.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lldelayedgestureerror.cpp
* @brief Delayed gesture error message -- try to wait until name has been retrieved
* @author Dale Glass
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,82 +42,82 @@ LLDelayedGestureError::ErrorQueue LLDelayedGestureError::sQueue;
//static
void LLDelayedGestureError::gestureMissing(const LLUUID &id)
{
- LLErrorEntry ent("GestureMissing", id);
- if ( ! doDialog(ent) )
- {
- enqueue(ent);
- }
+ LLErrorEntry ent("GestureMissing", id);
+ if ( ! doDialog(ent) )
+ {
+ enqueue(ent);
+ }
}
//static
void LLDelayedGestureError::gestureFailedToLoad(const LLUUID &id)
{
- LLErrorEntry ent("UnableToLoadGesture", id);
+ LLErrorEntry ent("UnableToLoadGesture", id);
- if ( ! doDialog(ent) )
- {
- enqueue(ent);
- }
+ if ( ! doDialog(ent) )
+ {
+ enqueue(ent);
+ }
}
//static
void LLDelayedGestureError::enqueue(const LLErrorEntry &ent)
{
- if ( sQueue.empty() )
- {
- gIdleCallbacks.addFunction(onIdle, NULL);
- }
+ if ( sQueue.empty() )
+ {
+ gIdleCallbacks.addFunction(onIdle, NULL);
+ }
- sQueue.push_back(ent);
+ sQueue.push_back(ent);
}
-//static
+//static
void LLDelayedGestureError::onIdle(void *userdata)
{
- if ( ! sQueue.empty() )
- {
- LLErrorEntry ent = sQueue.front();
- sQueue.pop_front();
-
- if ( ! doDialog(ent, false ) )
- {
- enqueue(ent);
- }
- }
- else
- {
- // Nothing to do anymore
- gIdleCallbacks.deleteFunction(onIdle, NULL);
- }
+ if ( ! sQueue.empty() )
+ {
+ LLErrorEntry ent = sQueue.front();
+ sQueue.pop_front();
+
+ if ( ! doDialog(ent, false ) )
+ {
+ enqueue(ent);
+ }
+ }
+ else
+ {
+ // Nothing to do anymore
+ gIdleCallbacks.deleteFunction(onIdle, NULL);
+ }
}
-//static
+//static
bool LLDelayedGestureError::doDialog(const LLErrorEntry &ent, bool uuid_ok)
{
- LLSD args;
- LLInventoryItem *item = gInventory.getItem( ent.mItemID );
-
- if ( item )
- {
- args["NAME"] = item->getName();
- }
- else
- {
- if ( uuid_ok || ent.mTimer.getElapsedTimeF32() > MAX_NAME_WAIT_TIME )
- {
- args["NAME"] = ent.mItemID.asString();
- }
- else
- {
- return false;
- }
- }
-
- if(!LLApp::isExiting())
- {
- LLNotificationsUtil::add(ent.mNotifyName, args);
- }
-
- return true;
+ LLSD args;
+ LLInventoryItem *item = gInventory.getItem( ent.mItemID );
+
+ if ( item )
+ {
+ args["NAME"] = item->getName();
+ }
+ else
+ {
+ if ( uuid_ok || ent.mTimer.getElapsedTimeF32() > MAX_NAME_WAIT_TIME )
+ {
+ args["NAME"] = ent.mItemID.asString();
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ if(!LLApp::isExiting())
+ {
+ LLNotificationsUtil::add(ent.mNotifyName, args);
+ }
+
+ return true;
}
diff --git a/indra/newview/lldelayedgestureerror.h b/indra/newview/lldelayedgestureerror.h
index 7ecadb4e7d..8433dbb445 100644
--- a/indra/newview/lldelayedgestureerror.h
+++ b/indra/newview/lldelayedgestureerror.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lldelayedgestureerror.h
* @brief Delayed gesture error message -- try to wait until name has been retrieved
* @author Dale Glass
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,40 +37,40 @@
class LLDelayedGestureError
{
public:
- /**
- * @brief Generates a missing gesture error
- * @param id UUID of missing gesture
- * Delays message for up to 5 seconds if UUID can't be immediately converted to a text description
- */
- static void gestureMissing(const LLUUID &id);
-
- /**
- * @brief Generates a gesture failed to load error
- * @param id UUID of missing gesture
- * Delays message for up to 5 seconds if UUID can't be immediately converted to a text description
- */
- static void gestureFailedToLoad(const LLUUID &id);
+ /**
+ * @brief Generates a missing gesture error
+ * @param id UUID of missing gesture
+ * Delays message for up to 5 seconds if UUID can't be immediately converted to a text description
+ */
+ static void gestureMissing(const LLUUID &id);
+
+ /**
+ * @brief Generates a gesture failed to load error
+ * @param id UUID of missing gesture
+ * Delays message for up to 5 seconds if UUID can't be immediately converted to a text description
+ */
+ static void gestureFailedToLoad(const LLUUID &id);
private:
-
- struct LLErrorEntry
- {
- LLErrorEntry(const std::string& notify, const LLUUID &item) : mTimer(), mNotifyName(notify), mItemID(item) {}
- LLTimer mTimer;
- std::string mNotifyName;
- LLUUID mItemID;
- };
+ struct LLErrorEntry
+ {
+ LLErrorEntry(const std::string& notify, const LLUUID &item) : mTimer(), mNotifyName(notify), mItemID(item) {}
+
+ LLTimer mTimer;
+ std::string mNotifyName;
+ LLUUID mItemID;
+ };
- static bool doDialog(const LLErrorEntry &ent, bool uuid_ok = false);
- static void enqueue(const LLErrorEntry &ent);
- static void onIdle(void *userdata);
+ static bool doDialog(const LLErrorEntry &ent, bool uuid_ok = false);
+ static void enqueue(const LLErrorEntry &ent);
+ static void onIdle(void *userdata);
- typedef std::list<LLErrorEntry> ErrorQueue;
+ typedef std::list<LLErrorEntry> ErrorQueue;
- static ErrorQueue sQueue;
+ static ErrorQueue sQueue;
};
diff --git a/indra/newview/lldensityctrl.cpp b/indra/newview/lldensityctrl.cpp
index 298a309e7c..3997227ef0 100644
--- a/indra/newview/lldensityctrl.cpp
+++ b/indra/newview/lldensityctrl.cpp
@@ -39,7 +39,7 @@ const std::string LLDensityCtrl::DENSITY_MIE("density_mie");
const std::string LLDensityCtrl::DENSITY_ABSORPTION("density_absorption");
namespace
-{
+{
const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL("level_exponential");
const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE("exponential_scale");
const std::string FIELD_SKY_DENSITY_PROFILE_LINEAR("level_linear");
@@ -151,7 +151,7 @@ void LLDensityCtrl::refresh()
getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH]);
if (mProfileType == Mie)
- {
+ {
getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setValue(config[LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR]);
}
}
diff --git a/indra/newview/lldensityctrl.h b/indra/newview/lldensityctrl.h
index 789022803c..1bc0f0ef1a 100644
--- a/indra/newview/lldensityctrl.h
+++ b/indra/newview/lldensityctrl.h
@@ -70,8 +70,8 @@ public:
Params();
};
- virtual BOOL postBuild() override;
- virtual void setEnabled(BOOL enabled) override;
+ virtual BOOL postBuild() override;
+ virtual void setEnabled(BOOL enabled) override;
void setProfileType(DensityProfileType t) { mProfileType = t; }
diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp
index 01790ad19e..bac435ad80 100644
--- a/indra/newview/lldirpicker.cpp
+++ b/indra/newview/lldirpicker.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldirpicker.cpp
* @brief OS-specific file picker
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
#include "lldir.h"
#include "llframetimer.h"
#include "lltrans.h"
-#include "llwindow.h" // beforeDialog()
+#include "llwindow.h" // beforeDialog()
#include "llviewercontrol.h"
#include "llwin32headerslean.h"
@@ -55,100 +55,100 @@ LLDirPicker LLDirPicker::sInstance;
// Implementation
//
-// utility function to check if access to local file system via file browser
+// utility function to check if access to local file system via file browser
// is enabled and if not, tidy up and indicate we're not allowed to do this.
bool LLDirPicker::check_local_file_access_enabled()
{
- // if local file browsing is turned off, return without opening dialog
- bool local_file_system_browsing_enabled = gSavedSettings.getBOOL("LocalFileSystemBrowsingEnabled");
- if ( ! local_file_system_browsing_enabled )
- {
- mDir.clear(); // Windows
- mFileName = NULL; // Mac/Linux
- return false;
- }
-
- return true;
+ // if local file browsing is turned off, return without opening dialog
+ bool local_file_system_browsing_enabled = gSavedSettings.getBOOL("LocalFileSystemBrowsingEnabled");
+ if ( ! local_file_system_browsing_enabled )
+ {
+ mDir.clear(); // Windows
+ mFileName = NULL; // Mac/Linux
+ return false;
+ }
+
+ return true;
}
#if LL_WINDOWS
LLDirPicker::LLDirPicker() :
- mFileName(NULL),
- mLocked(false)
+ mFileName(NULL),
+ mLocked(false)
{
- bi.hwndOwner = NULL;
- bi.pidlRoot = NULL;
- bi.pszDisplayName = NULL;
- bi.lpszTitle = NULL;
- bi.ulFlags = BIF_USENEWUI;
- bi.lpfn = NULL;
- bi.lParam = NULL;
- bi.iImage = 0;
+ bi.hwndOwner = NULL;
+ bi.pidlRoot = NULL;
+ bi.pszDisplayName = NULL;
+ bi.lpszTitle = NULL;
+ bi.ulFlags = BIF_USENEWUI;
+ bi.lpfn = NULL;
+ bi.lParam = NULL;
+ bi.iImage = 0;
}
LLDirPicker::~LLDirPicker()
{
- // nothing
+ // nothing
}
BOOL LLDirPicker::getDir(std::string* filename, bool blocking)
{
- if( mLocked )
- {
- return FALSE;
- }
-
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
- BOOL success = FALSE;
-
-
- if (blocking)
- {
- // Modal, so pause agent
- send_agent_pause();
- }
-
- bi.hwndOwner = (HWND)gViewerWindow->getPlatformWindow();
-
- ::OleInitialize(NULL);
- LPITEMIDLIST pIDL = ::SHBrowseForFolder(&bi);
-
- if(pIDL != NULL)
- {
- WCHAR buffer[_MAX_PATH] = {'\0'};
-
- if(::SHGetPathFromIDList(pIDL, buffer) != 0)
- {
- // Set the string value.
-
- mDir = utf16str_to_utf8str(llutf16string(buffer));
- success = TRUE;
- }
- // free the item id list
- CoTaskMemFree(pIDL);
- }
-
- ::OleUninitialize();
-
- if (blocking)
- {
- send_agent_resume();
- }
-
- // Account for the fact that the app has been stalled.
- LLFrameTimer::updateFrameTime();
- return success;
+ if( mLocked )
+ {
+ return FALSE;
+ }
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ BOOL success = FALSE;
+
+
+ if (blocking)
+ {
+ // Modal, so pause agent
+ send_agent_pause();
+ }
+
+ bi.hwndOwner = (HWND)gViewerWindow->getPlatformWindow();
+
+ ::OleInitialize(NULL);
+ LPITEMIDLIST pIDL = ::SHBrowseForFolder(&bi);
+
+ if(pIDL != NULL)
+ {
+ WCHAR buffer[_MAX_PATH] = {'\0'};
+
+ if(::SHGetPathFromIDList(pIDL, buffer) != 0)
+ {
+ // Set the string value.
+
+ mDir = utf16str_to_utf8str(llutf16string(buffer));
+ success = TRUE;
+ }
+ // free the item id list
+ CoTaskMemFree(pIDL);
+ }
+
+ ::OleUninitialize();
+
+ if (blocking)
+ {
+ send_agent_resume();
+ }
+
+ // Account for the fact that the app has been stalled.
+ LLFrameTimer::updateFrameTime();
+ return success;
}
std::string LLDirPicker::getDirName()
{
- return mDir;
+ return mDir;
}
/////////////////////////////////////////////DARWIN
@@ -158,19 +158,19 @@ LLDirPicker::LLDirPicker() :
mFileName(NULL),
mLocked(false)
{
- mFilePicker = new LLFilePicker();
- reset();
+ mFilePicker = new LLFilePicker();
+ reset();
}
LLDirPicker::~LLDirPicker()
{
- delete mFilePicker;
+ delete mFilePicker;
}
void LLDirPicker::reset()
{
- if (mFilePicker)
- mFilePicker->reset();
+ if (mFilePicker)
+ mFilePicker->reset();
}
@@ -178,81 +178,81 @@ void LLDirPicker::reset()
BOOL LLDirPicker::getDir(std::string* filename, bool blocking)
{
LLFilePicker::ELoadFilter filter=LLFilePicker::FFLOAD_DIRECTORY;
-
+
return mFilePicker->getOpenFile(filter, true);
}
std::string LLDirPicker::getDirName()
{
- return mFilePicker->getFirstFile();
+ return mFilePicker->getFirstFile();
}
#elif LL_LINUX
LLDirPicker::LLDirPicker() :
- mFileName(NULL),
- mLocked(false)
+ mFileName(NULL),
+ mLocked(false)
{
- mFilePicker = new LLFilePicker();
- reset();
+ mFilePicker = new LLFilePicker();
+ reset();
}
LLDirPicker::~LLDirPicker()
{
- delete mFilePicker;
+ delete mFilePicker;
}
void LLDirPicker::reset()
{
- if (mFilePicker)
- mFilePicker->reset();
+ if (mFilePicker)
+ mFilePicker->reset();
}
BOOL LLDirPicker::getDir(std::string* filename, bool blocking)
{
- reset();
+ reset();
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
#if !LL_MESA_HEADLESS
- if (mFilePicker)
- {
- GtkWindow* picker = mFilePicker->buildFilePicker(false, true,
- "dirpicker");
-
- if (picker)
- {
- gtk_window_set_title(GTK_WINDOW(picker), LLTrans::getString("choose_the_directory").c_str());
- gtk_widget_show_all(GTK_WIDGET(picker));
- gtk_main();
- return (!mFilePicker->getFirstFile().empty());
- }
- }
+ if (mFilePicker)
+ {
+ GtkWindow* picker = mFilePicker->buildFilePicker(false, true,
+ "dirpicker");
+
+ if (picker)
+ {
+ gtk_window_set_title(GTK_WINDOW(picker), LLTrans::getString("choose_the_directory").c_str());
+ gtk_widget_show_all(GTK_WIDGET(picker));
+ gtk_main();
+ return (!mFilePicker->getFirstFile().empty());
+ }
+ }
#endif // !LL_MESA_HEADLESS
- return FALSE;
+ return FALSE;
}
std::string LLDirPicker::getDirName()
{
- if (mFilePicker)
- {
- return mFilePicker->getFirstFile();
- }
- return "";
+ if (mFilePicker)
+ {
+ return mFilePicker->getFirstFile();
+ }
+ return "";
}
#else // not implemented
-LLDirPicker::LLDirPicker()
+LLDirPicker::LLDirPicker()
{
- reset();
+ reset();
}
LLDirPicker::~LLDirPicker()
@@ -266,12 +266,12 @@ void LLDirPicker::reset()
BOOL LLDirPicker::getDir(std::string* filename, bool blocking)
{
- return FALSE;
+ return FALSE;
}
std::string LLDirPicker::getDirName()
{
- return "";
+ return "";
}
#endif
@@ -283,86 +283,86 @@ std::queue<LLDirPickerThread*> LLDirPickerThread::sDeadQ;
void LLDirPickerThread::getFile()
{
#if LL_WINDOWS
- start();
+ start();
#else
- run();
+ run();
#endif
}
-//virtual
+//virtual
void LLDirPickerThread::run()
{
#if LL_WINDOWS
- bool blocking = false;
+ bool blocking = false;
#else
- bool blocking = true; // modal
+ bool blocking = true; // modal
#endif
- LLDirPicker picker;
+ LLDirPicker picker;
- if (picker.getDir(&mProposedName, blocking))
- {
- mResponses.push_back(picker.getDirName());
- }
+ if (picker.getDir(&mProposedName, blocking))
+ {
+ mResponses.push_back(picker.getDirName());
+ }
- {
- LLMutexLock lock(sMutex);
- sDeadQ.push(this);
- }
+ {
+ LLMutexLock lock(sMutex);
+ sDeadQ.push(this);
+ }
}
//static
void LLDirPickerThread::initClass()
{
- sMutex = new LLMutex();
+ sMutex = new LLMutex();
}
//static
void LLDirPickerThread::cleanupClass()
{
- clearDead();
+ clearDead();
- delete sMutex;
- sMutex = NULL;
+ delete sMutex;
+ sMutex = NULL;
}
//static
void LLDirPickerThread::clearDead()
{
- if (!sDeadQ.empty())
- {
- LLMutexLock lock(sMutex);
- while (!sDeadQ.empty())
- {
- LLDirPickerThread* thread = sDeadQ.front();
- thread->notify(thread->mResponses);
- delete thread;
- sDeadQ.pop();
- }
- }
+ if (!sDeadQ.empty())
+ {
+ LLMutexLock lock(sMutex);
+ while (!sDeadQ.empty())
+ {
+ LLDirPickerThread* thread = sDeadQ.front();
+ thread->notify(thread->mResponses);
+ delete thread;
+ sDeadQ.pop();
+ }
+ }
}
LLDirPickerThread::LLDirPickerThread(const dir_picked_signal_t::slot_type& cb, const std::string &proposed_name)
- : LLThread("dir picker"),
- mFilePickedSignal(NULL)
+ : LLThread("dir picker"),
+ mFilePickedSignal(NULL)
{
- mFilePickedSignal = new dir_picked_signal_t();
- mFilePickedSignal->connect(cb);
+ mFilePickedSignal = new dir_picked_signal_t();
+ mFilePickedSignal->connect(cb);
}
LLDirPickerThread::~LLDirPickerThread()
{
- delete mFilePickedSignal;
+ delete mFilePickedSignal;
}
void LLDirPickerThread::notify(const std::vector<std::string>& filenames)
{
- if (!filenames.empty())
- {
- if (mFilePickedSignal)
- {
- (*mFilePickedSignal)(filenames, mProposedName);
- }
- }
+ if (!filenames.empty())
+ {
+ if (mFilePickedSignal)
+ {
+ (*mFilePickedSignal)(filenames, mProposedName);
+ }
+ }
}
diff --git a/indra/newview/lldirpicker.h b/indra/newview/lldirpicker.h
index 52febe4523..e76a19dd40 100644
--- a/indra/newview/lldirpicker.h
+++ b/indra/newview/lldirpicker.h
@@ -1,32 +1,32 @@
-/**
+/**
* @dir lldirpicker.h
* @brief OS-specific dir picker
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// OS specific dir selection dialog. This is implemented as a
// singleton class, so call the instance() method to get the working
-// instance.
+// instance.
#ifndef LL_LLDIRPICKER_H
#define LL_LLDIRPICKER_H
@@ -57,75 +57,75 @@ class LLFilePicker;
class LLDirPicker
{
public:
- // calling this before main() is undefined
- static LLDirPicker& instance( void ) { return sInstance; }
+ // calling this before main() is undefined
+ static LLDirPicker& instance( void ) { return sInstance; }
- BOOL getDir(std::string* filename, bool blocking = true);
- std::string getDirName();
+ BOOL getDir(std::string* filename, bool blocking = true);
+ std::string getDirName();
- // clear any lists of buffers or whatever, and make sure the dir
- // picker isn't locked.
- void reset();
+ // clear any lists of buffers or whatever, and make sure the dir
+ // picker isn't locked.
+ void reset();
private:
- enum
- {
- SINGLE_DIRNAME_BUFFER_SIZE = 1024,
- //DIRNAME_BUFFER_SIZE = 65536
- DIRNAME_BUFFER_SIZE = 65000
- };
-
- void buildDirname( void );
- bool check_local_file_access_enabled();
+ enum
+ {
+ SINGLE_DIRNAME_BUFFER_SIZE = 1024,
+ //DIRNAME_BUFFER_SIZE = 65536
+ DIRNAME_BUFFER_SIZE = 65000
+ };
+
+ void buildDirname( void );
+ bool check_local_file_access_enabled();
#if LL_LINUX || LL_DARWIN
- // On Linux we just implement LLDirPicker on top of LLFilePicker
- LLFilePicker *mFilePicker;
+ // On Linux we just implement LLDirPicker on top of LLFilePicker
+ LLFilePicker *mFilePicker;
#endif
- std::string* mFileName;
- std::string mDir;
- bool mLocked;
+ std::string* mFileName;
+ std::string mDir;
+ bool mLocked;
- static LLDirPicker sInstance;
+ static LLDirPicker sInstance;
#if LL_WINDOWS
- BROWSEINFO bi;
+ BROWSEINFO bi;
#endif
-
+
public:
- // don't call these directly please.
- LLDirPicker();
- ~LLDirPicker();
+ // don't call these directly please.
+ LLDirPicker();
+ ~LLDirPicker();
};
class LLDirPickerThread : public LLThread
{
public:
- static std::queue<LLDirPickerThread*> sDeadQ;
- static LLMutex* sMutex;
+ static std::queue<LLDirPickerThread*> sDeadQ;
+ static LLMutex* sMutex;
- static void initClass();
- static void cleanupClass();
- static void clearDead();
+ static void initClass();
+ static void cleanupClass();
+ static void clearDead();
- std::vector<std::string> mResponses;
- std::string mProposedName;
+ std::vector<std::string> mResponses;
+ std::string mProposedName;
- typedef boost::signals2::signal<void(const std::vector<std::string>& filenames, std::string proposed_name)> dir_picked_signal_t;
+ typedef boost::signals2::signal<void(const std::vector<std::string>& filenames, std::string proposed_name)> dir_picked_signal_t;
- LLDirPickerThread(const dir_picked_signal_t::slot_type& cb, const std::string &proposed_name);
- ~LLDirPickerThread();
+ LLDirPickerThread(const dir_picked_signal_t::slot_type& cb, const std::string &proposed_name);
+ ~LLDirPickerThread();
- void getFile();
+ void getFile();
- virtual void run();
+ virtual void run();
- virtual void notify(const std::vector<std::string>& filenames);
+ virtual void notify(const std::vector<std::string>& filenames);
private:
- dir_picked_signal_t* mFilePickedSignal;
+ dir_picked_signal_t* mFilePickedSignal;
};
#endif
diff --git a/indra/newview/lldndbutton.cpp b/indra/newview/lldndbutton.cpp
index 7c9dda6b1d..5f8d02e3aa 100644
--- a/indra/newview/lldndbutton.cpp
+++ b/indra/newview/lldndbutton.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldndbutton.cpp
* @brief Implementation of the drag-n-drop button.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,11 +37,11 @@ LLDragAndDropButton::LLDragAndDropButton(const Params& params)
BOOL LLDragAndDropButton::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg)
{
- if (mDragDropHandler)
- {
- return mDragDropHandler(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
- }
- return false;
+ if (mDragDropHandler)
+ {
+ return mDragDropHandler(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+ }
+ return false;
}
// EOF
diff --git a/indra/newview/lldndbutton.h b/indra/newview/lldndbutton.h
index 53ea2f5ea7..8a790600e9 100644
--- a/indra/newview/lldndbutton.h
+++ b/indra/newview/lldndbutton.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,37 +43,37 @@
class LLDragAndDropButton : public LLButton
{
public:
- struct Params : public LLInitParam::Block<Params, LLButton::Params> {};
+ struct Params : public LLInitParam::Block<Params, LLButton::Params> {};
- LLDragAndDropButton(const Params& params);
+ LLDragAndDropButton(const Params& params);
- typedef boost::function<bool (
- S32 /*x*/, S32 /*y*/, MASK /*mask*/, BOOL /*drop*/,
- EDragAndDropType /*cargo_type*/,
- void* /*cargo_data*/,
- EAcceptance* /*accept*/,
- std::string& /*tooltip_msg*/)> drag_drop_handler_t;
+ typedef boost::function<bool (
+ S32 /*x*/, S32 /*y*/, MASK /*mask*/, BOOL /*drop*/,
+ EDragAndDropType /*cargo_type*/,
+ void* /*cargo_data*/,
+ EAcceptance* /*accept*/,
+ std::string& /*tooltip_msg*/)> drag_drop_handler_t;
- /**
- * Sets a handler which should process Drag-And-Drop.
- */
- void setDragAndDropHandler(drag_drop_handler_t handler) { mDragDropHandler = handler; }
+ /**
+ * Sets a handler which should process Drag-And-Drop.
+ */
+ void setDragAndDropHandler(drag_drop_handler_t handler) { mDragDropHandler = handler; }
- /**
- * Process Drag-And-Drop by delegating the event to drag_drop_handler_t.
- *
- * @return BOOL - value returned by drag_drop_handler_t if it is set, FALSE otherwise.
- */
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
+ /**
+ * Process Drag-And-Drop by delegating the event to drag_drop_handler_t.
+ *
+ * @return BOOL - value returned by drag_drop_handler_t if it is set, FALSE otherwise.
+ */
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
private:
- drag_drop_handler_t mDragDropHandler;
+ drag_drop_handler_t mDragDropHandler;
};
diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp
index 4d9ef99319..18456d132f 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.cpp
+++ b/indra/newview/lldonotdisturbnotificationstorage.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lldonotdisturbnotificationstorage.cpp
* @brief Implementation of lldonotdisturbnotificationstorage
* @author Stinson@lindenlab.com
@@ -68,7 +68,7 @@ BOOL LLDoNotDisturbNotificationStorageTimer::tick()
}
LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage()
- : LLNotificationStorage("")
+ : LLNotificationStorage("")
, mDirty(false)
{
nameToPayloadParameterMap[toastName] = "SESSION_ID";
@@ -88,7 +88,7 @@ void LLDoNotDisturbNotificationStorage::reset()
void LLDoNotDisturbNotificationStorage::initialize()
{
reset();
- getCommunicationChannel()->connectFailedFilter(boost::bind(&LLDoNotDisturbNotificationStorage::onChannelChanged, this, _1));
+ getCommunicationChannel()->connectFailedFilter(boost::bind(&LLDoNotDisturbNotificationStorage::onChannelChanged, this, _1));
}
bool LLDoNotDisturbNotificationStorage::getDirty()
@@ -105,27 +105,27 @@ void LLDoNotDisturbNotificationStorage::saveNotifications()
{
LL_PROFILE_ZONE_SCOPED;
- LLNotificationChannelPtr channelPtr = getCommunicationChannel();
- const LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
- llassert(commChannel != NULL);
+ LLNotificationChannelPtr channelPtr = getCommunicationChannel();
+ const LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
+ llassert(commChannel != NULL);
- LLSD output = LLSD::emptyMap();
- LLSD& data = output["data"];
- data = LLSD::emptyArray();
+ LLSD output = LLSD::emptyMap();
+ LLSD& data = output["data"];
+ data = LLSD::emptyArray();
- for (LLCommunicationChannel::history_list_t::const_iterator historyIter = commChannel->beginHistory();
- historyIter != commChannel->endHistory(); ++historyIter)
- {
- LLNotificationPtr notificationPtr = historyIter->second;
+ for (LLCommunicationChannel::history_list_t::const_iterator historyIter = commChannel->beginHistory();
+ historyIter != commChannel->endHistory(); ++historyIter)
+ {
+ LLNotificationPtr notificationPtr = historyIter->second;
- if (!notificationPtr->isRespondedTo() && !notificationPtr->isCancelled() &&
- !notificationPtr->isExpired() && !notificationPtr->isPersistent())
- {
- data.append(notificationPtr->asLLSD(true));
- }
- }
+ if (!notificationPtr->isRespondedTo() && !notificationPtr->isCancelled() &&
+ !notificationPtr->isExpired() && !notificationPtr->isPersistent())
+ {
+ data.append(notificationPtr->asLLSD(true));
+ }
+ }
- writeNotifications(output);
+ writeNotifications(output);
resetDirty();
}
@@ -134,114 +134,114 @@ static LLTrace::BlockTimerStatHandle FTM_LOAD_DND_NOTIFICATIONS("Load DND Notifi
void LLDoNotDisturbNotificationStorage::loadNotifications()
{
- LL_RECORD_BLOCK_TIME(FTM_LOAD_DND_NOTIFICATIONS);
-
- LL_INFOS("LLDoNotDisturbNotificationStorage") << "start loading notifications" << LL_ENDL;
-
- LLSD input;
- if (!readNotifications(input) ||input.isUndefined())
- {
- return;
- }
-
- LLSD& data = input["data"];
- if (data.isUndefined())
- {
- return;
- }
-
- LLNotifications& instance = LLNotifications::instance();
+ LL_RECORD_BLOCK_TIME(FTM_LOAD_DND_NOTIFICATIONS);
+
+ LL_INFOS("LLDoNotDisturbNotificationStorage") << "start loading notifications" << LL_ENDL;
+
+ LLSD input;
+ if (!readNotifications(input) ||input.isUndefined())
+ {
+ return;
+ }
+
+ LLSD& data = input["data"];
+ if (data.isUndefined())
+ {
+ return;
+ }
+
+ LLNotifications& instance = LLNotifications::instance();
bool imToastExists = false;
- bool group_ad_hoc_toast_exists = false;
- S32 toastSessionType;
+ bool group_ad_hoc_toast_exists = false;
+ S32 toastSessionType;
bool offerExists = false;
-
- for (LLSD::array_const_iterator notification_it = data.beginArray();
- notification_it != data.endArray();
- ++notification_it)
- {
- LLSD notification_params = *notification_it;
+
+ for (LLSD::array_const_iterator notification_it = data.beginArray();
+ notification_it != data.endArray();
+ ++notification_it)
+ {
+ LLSD notification_params = *notification_it;
const LLUUID& notificationID = notification_params["id"];
std::string notificationName = notification_params["name"];
LLNotificationPtr notification = instance.find(notificationID);
if(notificationName == toastName)
{
- toastSessionType = notification_params["payload"]["SESSION_TYPE"];
- if(toastSessionType == LLIMModel::LLIMSession::P2P_SESSION)
- {
- imToastExists = true;
- }
- //Don't add group/ad-hoc messages to the notification system because
- //this means the group/ad-hoc session has to be re-created
- else if(toastSessionType == LLIMModel::LLIMSession::GROUP_SESSION
- || toastSessionType == LLIMModel::LLIMSession::ADHOC_SESSION)
- {
- //Just allows opening the conversation log for group/ad-hoc messages upon startup
- group_ad_hoc_toast_exists = true;
- continue;
- }
+ toastSessionType = notification_params["payload"]["SESSION_TYPE"];
+ if(toastSessionType == LLIMModel::LLIMSession::P2P_SESSION)
+ {
+ imToastExists = true;
+ }
+ //Don't add group/ad-hoc messages to the notification system because
+ //this means the group/ad-hoc session has to be re-created
+ else if(toastSessionType == LLIMModel::LLIMSession::GROUP_SESSION
+ || toastSessionType == LLIMModel::LLIMSession::ADHOC_SESSION)
+ {
+ //Just allows opening the conversation log for group/ad-hoc messages upon startup
+ group_ad_hoc_toast_exists = true;
+ continue;
+ }
}
else if(notificationName == offerName)
{
offerExists = true;
}
-
- //Notification already exists due to persistent storage adding it first into the notification system
- if(notification)
- {
- notification->setDND(true);
- instance.update(instance.find(notificationID));
- }
- //New notification needs to be added
- else
- {
- notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true));
- LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]);
- if (responder == NULL)
- {
- LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '"
- << notification->getType() << "'" << LL_ENDL;
- }
- else
- {
- LLNotificationResponderPtr responderPtr(responder);
- notification->setResponseFunctor(responderPtr);
- }
-
- instance.add(notification);
- }
-
- }
+
+ //Notification already exists due to persistent storage adding it first into the notification system
+ if(notification)
+ {
+ notification->setDND(true);
+ instance.update(instance.find(notificationID));
+ }
+ //New notification needs to be added
+ else
+ {
+ notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true));
+ LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]);
+ if (responder == NULL)
+ {
+ LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '"
+ << notification->getType() << "'" << LL_ENDL;
+ }
+ else
+ {
+ LLNotificationResponderPtr responderPtr(responder);
+ notification->setResponseFunctor(responderPtr);
+ }
+
+ instance.add(notification);
+ }
+
+ }
bool isConversationLoggingAllowed = gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 0;
- if(group_ad_hoc_toast_exists && isConversationLoggingAllowed)
- {
- LLFloaterReg::showInstance("conversation");
- }
+ if(group_ad_hoc_toast_exists && isConversationLoggingAllowed)
+ {
+ LLFloaterReg::showInstance("conversation");
+ }
if(imToastExists || group_ad_hoc_toast_exists || offerExists)
{
- make_ui_sound_deferred("UISndNewIncomingIMSession");
+ make_ui_sound_deferred("UISndNewIncomingIMSession");
}
//writes out empty .xml file (since LLCommunicationChannel::mHistory is empty)
- saveNotifications();
+ saveNotifications();
- LL_INFOS("LLDoNotDisturbNotificationStorage") << "finished loading notifications" << LL_ENDL;
+ LL_INFOS("LLDoNotDisturbNotificationStorage") << "finished loading notifications" << LL_ENDL;
}
void LLDoNotDisturbNotificationStorage::updateNotifications()
{
- LLNotificationChannelPtr channelPtr = getCommunicationChannel();
- LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
- llassert(commChannel != NULL);
+ LLNotificationChannelPtr channelPtr = getCommunicationChannel();
+ LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
+ llassert(commChannel != NULL);
LLNotifications& instance = LLNotifications::instance();
bool imToastExists = false;
bool offerExists = false;
-
+
for (LLCommunicationChannel::history_list_t::const_iterator it = commChannel->beginHistory();
it != commChannel->endHistory();
++it)
@@ -274,16 +274,16 @@ void LLDoNotDisturbNotificationStorage::updateNotifications()
//When exit DND mode, write empty notifications file
if(commChannel->getHistorySize())
{
- commChannel->clearHistory();
- saveNotifications();
+ commChannel->clearHistory();
+ saveNotifications();
}
}
LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChannel() const
{
- LLNotificationChannelPtr channelPtr = LLNotifications::getInstance()->getChannel("Communication");
- llassert(channelPtr);
- return channelPtr;
+ LLNotificationChannelPtr channelPtr = LLNotifications::getInstance()->getChannel("Communication");
+ llassert(channelPtr);
+ return channelPtr;
}
void LLDoNotDisturbNotificationStorage::removeNotification(const char * name, const LLUUID& id)
@@ -301,7 +301,7 @@ void LLDoNotDisturbNotificationStorage::removeNotification(const char * name, co
//Find notification with the matching session id
for (it = commChannel->beginHistory();
- it != commChannel->endHistory();
+ it != commChannel->endHistory();
++it)
{
notification = it->second;
@@ -336,10 +336,10 @@ void LLDoNotDisturbNotificationStorage::removeNotification(const char * name, co
bool LLDoNotDisturbNotificationStorage::onChannelChanged(const LLSD& pPayload)
{
- if (pPayload["sigtype"].asString() != "load")
- {
+ if (pPayload["sigtype"].asString() != "load")
+ {
mDirty = true;
- }
+ }
- return false;
+ return false;
}
diff --git a/indra/newview/lldonotdisturbnotificationstorage.h b/indra/newview/lldonotdisturbnotificationstorage.h
index 237d58b4de..1432d37de6 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.h
+++ b/indra/newview/lldonotdisturbnotificationstorage.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lldonotdisturbnotificationstorage.h
* @brief Header file for lldonotdisturbnotificationstorage
* @author Stinson@lindenlab.com
@@ -47,18 +47,18 @@ public:
class LLDoNotDisturbNotificationStorage : public LLParamSingleton<LLDoNotDisturbNotificationStorage>, public LLNotificationStorage
{
- LLSINGLETON(LLDoNotDisturbNotificationStorage);
- ~LLDoNotDisturbNotificationStorage();
+ LLSINGLETON(LLDoNotDisturbNotificationStorage);
+ ~LLDoNotDisturbNotificationStorage();
- LOG_CLASS(LLDoNotDisturbNotificationStorage);
+ LOG_CLASS(LLDoNotDisturbNotificationStorage);
public:
static const char * toastName;
static const char * offerName;
bool getDirty();
void resetDirty();
- void saveNotifications();
- void loadNotifications();
+ void saveNotifications();
+ void loadNotifications();
void updateNotifications();
void removeNotification(const char * name, const LLUUID& id);
void reset();
@@ -71,8 +71,8 @@ private:
bool mDirty;
LLDoNotDisturbNotificationStorageTimer mTimer;
- LLNotificationChannelPtr getCommunicationChannel() const;
- bool onChannelChanged(const LLSD& pPayload);
+ LLNotificationChannelPtr getCommunicationChannel() const;
+ bool onChannelChanged(const LLSD& pPayload);
std::map<std::string, std::string> nameToPayloadParameterMap;
};
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 710bbf8f52..12a7a22e24 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawable.cpp
* @brief LLDrawable class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -83,73 +83,73 @@ std::vector<LLPointer<LLDrawable> > LLDrawable::sDeadList;
#define FORCE_INVISIBLE_AREA 16.f
// static
-void LLDrawable::incrementVisible()
+void LLDrawable::incrementVisible()
{
- LLViewerOctreeEntryData::incrementVisible();
- sCurPixelAngle = (F32) gViewerWindow->getWindowHeightRaw()/LLViewerCamera::getInstance()->getView();
+ LLViewerOctreeEntryData::incrementVisible();
+ sCurPixelAngle = (F32) gViewerWindow->getWindowHeightRaw()/LLViewerCamera::getInstance()->getView();
}
LLDrawable::LLDrawable(LLViewerObject *vobj, bool new_entry)
-: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLDRAWABLE),
- mVObjp(vobj)
+: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLDRAWABLE),
+ mVObjp(vobj)
{
- init(new_entry);
+ init(new_entry);
}
void LLDrawable::init(bool new_entry)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- // mXform
- mParent = NULL;
- mRenderType = 0;
- mCurrentScale = LLVector3(1,1,1);
- mDistanceWRTCamera = 0.0f;
- mState = 0;
-
- // mFaces
- mRadius = 0.f;
- mGeneration = -1;
- mSpatialBridge = NULL;
-
- LLViewerOctreeEntry* entry = NULL;
- LLVOCacheEntry* vo_entry = NULL;
- if(!new_entry && mVObjp && getRegion() != NULL)
- {
- vo_entry = getRegion()->getCacheEntryForOctree(mVObjp->getLocalID());
- if(vo_entry)
- {
- entry = vo_entry->getEntry();
- }
- }
- setOctreeEntry(entry);
- if(vo_entry)
- {
- if(!entry)
- {
- vo_entry->setOctreeEntry(mEntry);
- }
-
- getRegion()->addActiveCacheEntry(vo_entry);
-
- if(vo_entry->getNumOfChildren() > 0)
- {
- getRegion()->addVisibleChildCacheEntry(vo_entry, NULL); //to load all children.
- }
-
- llassert(!vo_entry->getGroup()); //not in the object cache octree.
- }
-
- llassert(!vo_entry || vo_entry->getEntry() == mEntry);
-
- initVisible(sCurVisible - 2);//invisible for the current frame and the last frame.
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ // mXform
+ mParent = NULL;
+ mRenderType = 0;
+ mCurrentScale = LLVector3(1,1,1);
+ mDistanceWRTCamera = 0.0f;
+ mState = 0;
+
+ // mFaces
+ mRadius = 0.f;
+ mGeneration = -1;
+ mSpatialBridge = NULL;
+
+ LLViewerOctreeEntry* entry = NULL;
+ LLVOCacheEntry* vo_entry = NULL;
+ if(!new_entry && mVObjp && getRegion() != NULL)
+ {
+ vo_entry = getRegion()->getCacheEntryForOctree(mVObjp->getLocalID());
+ if(vo_entry)
+ {
+ entry = vo_entry->getEntry();
+ }
+ }
+ setOctreeEntry(entry);
+ if(vo_entry)
+ {
+ if(!entry)
+ {
+ vo_entry->setOctreeEntry(mEntry);
+ }
+
+ getRegion()->addActiveCacheEntry(vo_entry);
+
+ if(vo_entry->getNumOfChildren() > 0)
+ {
+ getRegion()->addVisibleChildCacheEntry(vo_entry, NULL); //to load all children.
+ }
+
+ llassert(!vo_entry->getGroup()); //not in the object cache octree.
+ }
+
+ llassert(!vo_entry || vo_entry->getEntry() == mEntry);
+
+ initVisible(sCurVisible - 2);//invisible for the current frame and the last frame.
}
void LLDrawable::unload()
{
- LLVOVolume *pVVol = getVOVolume();
- pVVol->setNoLOD();
- pVVol->markForUpdate();
+ LLVOVolume *pVVol = getVOVolume();
+ pVVol->setNoLOD();
+ pVVol->markForUpdate();
}
// static
@@ -160,325 +160,325 @@ void LLDrawable::initClass()
void LLDrawable::destroy()
{
- if (gDebugGL)
- {
- gPipeline.checkReferences(this);
- }
+ if (gDebugGL)
+ {
+ gPipeline.checkReferences(this);
+ }
- if (isDead())
- {
- sNumZombieDrawables--;
- }
+ if (isDead())
+ {
+ sNumZombieDrawables--;
+ }
- // Attempt to catch violations of this in debug,
- // knowing that some false alarms may result
- //
- llassert(!LLSpatialGroup::sNoDelete);
+ // Attempt to catch violations of this in debug,
+ // knowing that some false alarms may result
+ //
+ llassert(!LLSpatialGroup::sNoDelete);
+
+ /* cannot be guaranteed and causes crashes on false alarms
+ if (LLSpatialGroup::sNoDelete)
+ {
+ LL_ERRS() << "Illegal deletion of LLDrawable!" << LL_ENDL;
+ }*/
+
+ std::for_each(mFaces.begin(), mFaces.end(), DeletePointer());
+ mFaces.clear();
- /* cannot be guaranteed and causes crashes on false alarms
- if (LLSpatialGroup::sNoDelete)
- {
- LL_ERRS() << "Illegal deletion of LLDrawable!" << LL_ENDL;
- }*/
- std::for_each(mFaces.begin(), mFaces.end(), DeletePointer());
- mFaces.clear();
-
-
- /*if (!(sNumZombieDrawables % 10))
- {
- LL_INFOS() << "- Zombie drawables: " << sNumZombieDrawables << LL_ENDL;
- }*/
+ /*if (!(sNumZombieDrawables % 10))
+ {
+ LL_INFOS() << "- Zombie drawables: " << sNumZombieDrawables << LL_ENDL;
+ }*/
}
void LLDrawable::markDead()
{
- if (isDead())
- {
- LL_WARNS() << "Warning! Marking dead multiple times!" << LL_ENDL;
- return;
- }
- setState(DEAD);
+ if (isDead())
+ {
+ LL_WARNS() << "Warning! Marking dead multiple times!" << LL_ENDL;
+ return;
+ }
+ setState(DEAD);
- if (mSpatialBridge)
- {
- mSpatialBridge->markDead();
- mSpatialBridge = NULL;
- }
+ if (mSpatialBridge)
+ {
+ mSpatialBridge->markDead();
+ mSpatialBridge = NULL;
+ }
- sNumZombieDrawables++;
+ sNumZombieDrawables++;
- // We're dead. Free up all of our references to other objects
- cleanupReferences();
-// sDeadList.push_back(this);
+ // We're dead. Free up all of our references to other objects
+ cleanupReferences();
+// sDeadList.push_back(this);
}
LLVOVolume* LLDrawable::getVOVolume() const
{
- LLViewerObject* objectp = mVObjp;
- if ( !isDead() && objectp && (objectp->getPCode() == LL_PCODE_VOLUME))
- {
- return ((LLVOVolume*)objectp);
- }
- else
- {
- return NULL;
- }
+ LLViewerObject* objectp = mVObjp;
+ if ( !isDead() && objectp && (objectp->getPCode() == LL_PCODE_VOLUME))
+ {
+ return ((LLVOVolume*)objectp);
+ }
+ else
+ {
+ return NULL;
+ }
}
const LLMatrix4& LLDrawable::getRenderMatrix() const
-{
- return isRoot() ? getWorldMatrix() : getParent()->getWorldMatrix();
+{
+ return isRoot() ? getWorldMatrix() : getParent()->getWorldMatrix();
}
BOOL LLDrawable::isLight() const
{
- LLViewerObject* objectp = mVObjp;
- if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME) && !isDead())
- {
- return ((LLVOVolume*)objectp)->getIsLight();
- }
- else
- {
- return FALSE;
- }
+ LLViewerObject* objectp = mVObjp;
+ if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME) && !isDead())
+ {
+ return ((LLVOVolume*)objectp)->getIsLight();
+ }
+ else
+ {
+ return FALSE;
+ }
}
void LLDrawable::cleanupReferences()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE;
-
- std::for_each(mFaces.begin(), mFaces.end(), DeletePointer());
- mFaces.clear();
- gPipeline.unlinkDrawable(this);
-
- removeFromOctree();
+ std::for_each(mFaces.begin(), mFaces.end(), DeletePointer());
+ mFaces.clear();
+
+ gPipeline.unlinkDrawable(this);
+
+ removeFromOctree();
- // Cleanup references to other objects
- mVObjp = NULL;
- mParent = NULL;
+ // Cleanup references to other objects
+ mVObjp = NULL;
+ mParent = NULL;
}
void LLDrawable::removeFromOctree()
{
- if(!mEntry)
- {
- return;
- }
+ if(!mEntry)
+ {
+ return;
+ }
- mEntry->removeData(this);
- if(mEntry->hasVOCacheEntry())
- {
- getRegion()->removeActiveCacheEntry((LLVOCacheEntry*)mEntry->getVOCacheEntry(), this);
- }
- mEntry = NULL;
+ mEntry->removeData(this);
+ if(mEntry->hasVOCacheEntry())
+ {
+ getRegion()->removeActiveCacheEntry((LLVOCacheEntry*)mEntry->getVOCacheEntry(), this);
+ }
+ mEntry = NULL;
}
void LLDrawable::cleanupDeadDrawables()
{
- /*
- S32 i;
- for (i = 0; i < sDeadList.size(); i++)
- {
- if (sDeadList[i]->getNumRefs() > 1)
- {
- LL_WARNS() << "Dead drawable has " << sDeadList[i]->getNumRefs() << " remaining refs" << LL_ENDL;
- gPipeline.findReferences(sDeadList[i]);
- }
- }
- */
- sDeadList.clear();
+ /*
+ S32 i;
+ for (i = 0; i < sDeadList.size(); i++)
+ {
+ if (sDeadList[i]->getNumRefs() > 1)
+ {
+ LL_WARNS() << "Dead drawable has " << sDeadList[i]->getNumRefs() << " remaining refs" << LL_ENDL;
+ gPipeline.findReferences(sDeadList[i]);
+ }
+ }
+ */
+ sDeadList.clear();
}
S32 LLDrawable::findReferences(LLDrawable *drawablep)
{
- S32 count = 0;
- if (mParent == drawablep)
- {
- LL_INFOS() << this << ": parent reference" << LL_ENDL;
- count++;
- }
- return count;
-}
-
-LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- LLFace *face;
- {
- face = new LLFace(this, mVObjp);
- }
-
- if (!face) LL_ERRS() << "Allocating new Face: " << mFaces.size() << LL_ENDL;
-
- if (face)
- {
- mFaces.push_back(face);
-
- if (poolp)
- {
- face->setPool(poolp, texturep);
- }
-
- if (isState(UNLIT))
- {
- face->setState(LLFace::FULLBRIGHT);
- }
- }
- return face;
-}
-
-LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- LLFace *face;
-
- face = new LLFace(this, mVObjp);
-
- face->setTEOffset(mFaces.size());
- face->setTexture(texturep);
- face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep));
-
- mFaces.push_back(face);
-
- if (isState(UNLIT))
- {
- face->setState(LLFace::FULLBRIGHT);
- }
-
- return face;
-
-}
-
-LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLViewerTexture *normalp)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- LLFace *face;
- face = new LLFace(this, mVObjp);
-
- face->setTEOffset(mFaces.size());
- face->setTexture(texturep);
- face->setNormalMap(normalp);
- face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep));
-
- mFaces.push_back(face);
-
- if (isState(UNLIT))
- {
- face->setState(LLFace::FULLBRIGHT);
- }
-
- return face;
-
-}
-
-LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLViewerTexture *normalp, LLViewerTexture *specularp)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- LLFace *face;
- face = new LLFace(this, mVObjp);
-
- face->setTEOffset(mFaces.size());
- face->setTexture(texturep);
- face->setNormalMap(normalp);
- face->setSpecularMap(specularp);
- face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep));
-
- mFaces.push_back(face);
-
- if (isState(UNLIT))
- {
- face->setState(LLFace::FULLBRIGHT);
- }
-
- return face;
-
+ S32 count = 0;
+ if (mParent == drawablep)
+ {
+ LL_INFOS() << this << ": parent reference" << LL_ENDL;
+ count++;
+ }
+ return count;
+}
+
+LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ LLFace *face;
+ {
+ face = new LLFace(this, mVObjp);
+ }
+
+ if (!face) LL_ERRS() << "Allocating new Face: " << mFaces.size() << LL_ENDL;
+
+ if (face)
+ {
+ mFaces.push_back(face);
+
+ if (poolp)
+ {
+ face->setPool(poolp, texturep);
+ }
+
+ if (isState(UNLIT))
+ {
+ face->setState(LLFace::FULLBRIGHT);
+ }
+ }
+ return face;
+}
+
+LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ LLFace *face;
+
+ face = new LLFace(this, mVObjp);
+
+ face->setTEOffset(mFaces.size());
+ face->setTexture(texturep);
+ face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep));
+
+ mFaces.push_back(face);
+
+ if (isState(UNLIT))
+ {
+ face->setState(LLFace::FULLBRIGHT);
+ }
+
+ return face;
+
+}
+
+LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLViewerTexture *normalp)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ LLFace *face;
+ face = new LLFace(this, mVObjp);
+
+ face->setTEOffset(mFaces.size());
+ face->setTexture(texturep);
+ face->setNormalMap(normalp);
+ face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep));
+
+ mFaces.push_back(face);
+
+ if (isState(UNLIT))
+ {
+ face->setState(LLFace::FULLBRIGHT);
+ }
+
+ return face;
+
+}
+
+LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLViewerTexture *normalp, LLViewerTexture *specularp)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ LLFace *face;
+ face = new LLFace(this, mVObjp);
+
+ face->setTEOffset(mFaces.size());
+ face->setTexture(texturep);
+ face->setNormalMap(normalp);
+ face->setSpecularMap(specularp);
+ face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep));
+
+ mFaces.push_back(face);
+
+ if (isState(UNLIT))
+ {
+ face->setState(LLFace::FULLBRIGHT);
+ }
+
+ return face;
+
}
void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerTexture *texturep)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- if (newFaces == (S32)mFaces.size())
- {
- return;
- }
- else if (newFaces < (S32)mFaces.size())
- {
- std::for_each(mFaces.begin() + newFaces, mFaces.end(), DeletePointer());
- mFaces.erase(mFaces.begin() + newFaces, mFaces.end());
- }
- else // (newFaces > mFaces.size())
- {
- mFaces.reserve(newFaces);
- for (int i = mFaces.size(); i<newFaces; i++)
- {
- addFace(poolp, texturep);
- }
- }
-
- llassert_always(mFaces.size() == newFaces);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ if (newFaces == (S32)mFaces.size())
+ {
+ return;
+ }
+ else if (newFaces < (S32)mFaces.size())
+ {
+ std::for_each(mFaces.begin() + newFaces, mFaces.end(), DeletePointer());
+ mFaces.erase(mFaces.begin() + newFaces, mFaces.end());
+ }
+ else // (newFaces > mFaces.size())
+ {
+ mFaces.reserve(newFaces);
+ for (int i = mFaces.size(); i<newFaces; i++)
+ {
+ addFace(poolp, texturep);
+ }
+ }
+
+ llassert_always(mFaces.size() == newFaces);
}
void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewerTexture *texturep)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- if (newFaces <= (S32)mFaces.size() && newFaces >= (S32)mFaces.size()/2)
- {
- return;
- }
- else if (newFaces < (S32)mFaces.size())
- {
- std::for_each(mFaces.begin() + newFaces, mFaces.end(), DeletePointer());
- mFaces.erase(mFaces.begin() + newFaces, mFaces.end());
- }
- else // (newFaces > mFaces.size())
- {
- mFaces.reserve(newFaces);
- for (int i = mFaces.size(); i<newFaces; i++)
- {
- addFace(poolp, texturep);
- }
- }
-
- llassert_always(mFaces.size() == newFaces) ;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ if (newFaces <= (S32)mFaces.size() && newFaces >= (S32)mFaces.size()/2)
+ {
+ return;
+ }
+ else if (newFaces < (S32)mFaces.size())
+ {
+ std::for_each(mFaces.begin() + newFaces, mFaces.end(), DeletePointer());
+ mFaces.erase(mFaces.begin() + newFaces, mFaces.end());
+ }
+ else // (newFaces > mFaces.size())
+ {
+ mFaces.reserve(newFaces);
+ for (int i = mFaces.size(); i<newFaces; i++)
+ {
+ addFace(poolp, texturep);
+ }
+ }
+
+ llassert_always(mFaces.size() == newFaces) ;
}
void LLDrawable::mergeFaces(LLDrawable* src)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
- U32 face_count = mFaces.size() + src->mFaces.size();
+ U32 face_count = mFaces.size() + src->mFaces.size();
- mFaces.reserve(face_count);
- for (U32 i = 0; i < src->mFaces.size(); i++)
- {
- LLFace* facep = src->mFaces[i];
- facep->setDrawable(this);
- mFaces.push_back(facep);
- }
- src->mFaces.clear();
+ mFaces.reserve(face_count);
+ for (U32 i = 0; i < src->mFaces.size(); i++)
+ {
+ LLFace* facep = src->mFaces[i];
+ facep->setDrawable(this);
+ mFaces.push_back(facep);
+ }
+ src->mFaces.clear();
}
void LLDrawable::deleteFaces(S32 offset, S32 count)
{
- face_list_t::iterator face_begin = mFaces.begin() + offset;
- face_list_t::iterator face_end = face_begin + count;
+ face_list_t::iterator face_begin = mFaces.begin() + offset;
+ face_list_t::iterator face_end = face_begin + count;
- std::for_each(face_begin, face_end, DeletePointer());
- mFaces.erase(face_begin, face_end);
+ std::for_each(face_begin, face_end, DeletePointer());
+ mFaces.erase(face_begin, face_end);
}
void LLDrawable::update()
{
- LL_ERRS() << "Shouldn't be called!" << LL_ENDL;
+ LL_ERRS() << "Shouldn't be called!" << LL_ENDL;
}
@@ -487,416 +487,416 @@ void LLDrawable::updateMaterial()
}
void LLDrawable::makeActive()
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
#if !LL_RELEASE_FOR_DOWNLOAD
- if (mVObjp.notNull())
- {
- U32 pcode = mVObjp->getPCode();
- if (pcode == LLViewerObject::LL_VO_WATER ||
- pcode == LLViewerObject::LL_VO_VOID_WATER ||
- pcode == LLViewerObject::LL_VO_SURFACE_PATCH ||
- pcode == LLViewerObject::LL_VO_PART_GROUP ||
- pcode == LLViewerObject::LL_VO_HUD_PART_GROUP ||
- pcode == LLViewerObject::LL_VO_SKY)
- {
- LL_ERRS() << "Static viewer object has active drawable!" << LL_ENDL;
- }
- }
+ if (mVObjp.notNull())
+ {
+ U32 pcode = mVObjp->getPCode();
+ if (pcode == LLViewerObject::LL_VO_WATER ||
+ pcode == LLViewerObject::LL_VO_VOID_WATER ||
+ pcode == LLViewerObject::LL_VO_SURFACE_PATCH ||
+ pcode == LLViewerObject::LL_VO_PART_GROUP ||
+ pcode == LLViewerObject::LL_VO_HUD_PART_GROUP ||
+ pcode == LLViewerObject::LL_VO_SKY)
+ {
+ LL_ERRS() << "Static viewer object has active drawable!" << LL_ENDL;
+ }
+ }
#endif
- if (!isState(ACTIVE)) // && mGeneration > 0)
- {
- setState(ACTIVE);
-
- //parent must be made active first
- if (!isRoot() && !mParent->isActive())
- {
- mParent->makeActive();
- //NOTE: linked set will now NEVER become static
- mParent->setState(LLDrawable::ACTIVE_CHILD);
- }
-
- //all child objects must also be active
- llassert_always(mVObjp);
-
- LLViewerObject::const_child_list_t& child_list = mVObjp->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- LLDrawable* drawable = child->mDrawable;
- if (drawable)
- {
- drawable->makeActive();
- }
- }
-
- if (mVObjp->getPCode() == LL_PCODE_VOLUME)
- {
- gPipeline.markRebuild(this, LLDrawable::REBUILD_VOLUME);
- }
- updatePartition();
- }
- else if (!isRoot() && !mParent->isActive()) //this should not happen, but occasionally it does...
- {
- mParent->makeActive();
- //NOTE: linked set will now NEVER become static
- mParent->setState(LLDrawable::ACTIVE_CHILD);
- }
-
- llassert(isAvatar() || isRoot() || mParent->isActive());
+ if (!isState(ACTIVE)) // && mGeneration > 0)
+ {
+ setState(ACTIVE);
+
+ //parent must be made active first
+ if (!isRoot() && !mParent->isActive())
+ {
+ mParent->makeActive();
+ //NOTE: linked set will now NEVER become static
+ mParent->setState(LLDrawable::ACTIVE_CHILD);
+ }
+
+ //all child objects must also be active
+ llassert_always(mVObjp);
+
+ LLViewerObject::const_child_list_t& child_list = mVObjp->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ LLDrawable* drawable = child->mDrawable;
+ if (drawable)
+ {
+ drawable->makeActive();
+ }
+ }
+
+ if (mVObjp->getPCode() == LL_PCODE_VOLUME)
+ {
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_VOLUME);
+ }
+ updatePartition();
+ }
+ else if (!isRoot() && !mParent->isActive()) //this should not happen, but occasionally it does...
+ {
+ mParent->makeActive();
+ //NOTE: linked set will now NEVER become static
+ mParent->setState(LLDrawable::ACTIVE_CHILD);
+ }
+
+ llassert(isAvatar() || isRoot() || mParent->isActive());
}
void LLDrawable::makeStatic(BOOL warning_enabled)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
- if (isState(ACTIVE) &&
- !isState(ACTIVE_CHILD) &&
- !mVObjp->isAttachment() &&
- !mVObjp->isFlexible() &&
+ if (isState(ACTIVE) &&
+ !isState(ACTIVE_CHILD) &&
+ !mVObjp->isAttachment() &&
+ !mVObjp->isFlexible() &&
!mVObjp->isAnimatedObject())
- {
- clearState(ACTIVE | ANIMATED_CHILD);
-
- //drawable became static with active parent, not acceptable
- llassert(mParent.isNull() || !mParent->isActive() || !warning_enabled);
-
- LLViewerObject::const_child_list_t& child_list = mVObjp->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- LLDrawable* child_drawable = child->mDrawable;
- if (child_drawable)
- {
- if (child_drawable->getParent() != this)
- {
- LL_WARNS() << "Child drawable has unknown parent." << LL_ENDL;
- }
- child_drawable->makeStatic(warning_enabled);
- }
- }
-
- if (mVObjp->getPCode() == LL_PCODE_VOLUME)
- {
- gPipeline.markRebuild(this, LLDrawable::REBUILD_VOLUME);
- }
-
- if (mSpatialBridge)
- {
- mSpatialBridge->markDead();
- setSpatialBridge(NULL);
- }
- updatePartition();
- }
-
- llassert(isAvatar() || isRoot() || mParent->isStatic());
+ {
+ clearState(ACTIVE | ANIMATED_CHILD);
+
+ //drawable became static with active parent, not acceptable
+ llassert(mParent.isNull() || !mParent->isActive() || !warning_enabled);
+
+ LLViewerObject::const_child_list_t& child_list = mVObjp->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ LLDrawable* child_drawable = child->mDrawable;
+ if (child_drawable)
+ {
+ if (child_drawable->getParent() != this)
+ {
+ LL_WARNS() << "Child drawable has unknown parent." << LL_ENDL;
+ }
+ child_drawable->makeStatic(warning_enabled);
+ }
+ }
+
+ if (mVObjp->getPCode() == LL_PCODE_VOLUME)
+ {
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_VOLUME);
+ }
+
+ if (mSpatialBridge)
+ {
+ mSpatialBridge->markDead();
+ setSpatialBridge(NULL);
+ }
+ updatePartition();
+ }
+
+ llassert(isAvatar() || isRoot() || mParent->isStatic());
}
// Returns "distance" between target destination and resulting xfrom
F32 LLDrawable::updateXform(BOOL undamped)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- BOOL damped = !undamped;
-
- // Position
- const LLVector3 old_pos(mXform.getPosition());
- LLVector3 target_pos;
- if (mXform.isRoot())
- {
- // get root position in your agent's region
- target_pos = mVObjp->getPositionAgent();
- }
- else
- {
- // parent-relative position
- target_pos = mVObjp->getPosition();
- }
-
- // Rotation
- const LLQuaternion old_rot(mXform.getRotation());
- LLQuaternion target_rot = mVObjp->getRotation();
- //scaling
- LLVector3 target_scale = mVObjp->getScale();
- LLVector3 old_scale = mCurrentScale;
-
- // Damping
- F32 dist_squared = 0.f;
- F32 camdist2 = (mDistanceWRTCamera * mDistanceWRTCamera);
-
- if (damped && isVisible())
- {
- F32 lerp_amt = llclamp(LLSmoothInterpolation::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f);
- LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt);
- dist_squared = dist_vec_squared(new_pos, target_pos);
-
- LLQuaternion new_rot = nlerp(lerp_amt, old_rot, target_rot);
- // FIXME: This can be negative! It is be possible for some rots to 'cancel out' pos or size changes.
- dist_squared += (1.f - dot(new_rot, target_rot)) * 10.f;
-
- LLVector3 new_scale = lerp(old_scale, target_scale, lerp_amt);
- dist_squared += dist_vec_squared(new_scale, target_scale);
-
- if ((dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED * camdist2) &&
- (dist_squared <= MAX_INTERPOLATE_DISTANCE_SQUARED))
- {
- // interpolate
- target_pos = new_pos;
- target_rot = new_rot;
- target_scale = new_scale;
- }
- else if (mVObjp->getAngularVelocity().isExactlyZero())
- {
- // snap to final position (only if no target omega is applied)
- dist_squared = 0.0f;
- //set target scale here, because of dist_squared = 0.0f remove object from move list
- mCurrentScale = target_scale;
-
- if (getVOVolume() && !isRoot())
- { //child prim snapping to some position, needs a rebuild
- gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION);
- }
- }
- }
- else
- {
- // The following fixes MAINT-1742 but breaks vehicles similar to MAINT-2275
- // dist_squared = dist_vec_squared(old_pos, target_pos);
-
- // The following fixes MAINT-2247 but causes MAINT-2275
- //dist_squared += (1.f - dot(old_rot, target_rot)) * 10.f;
- //dist_squared += dist_vec_squared(old_scale, target_scale);
- }
-
- const LLVector3 vec = mCurrentScale-target_scale;
-
- //It's a very important on each cycle on Drawable::update form(), when object remained in move
- //, list update the CurrentScale member, because if do not do that, it remained in this list forever
- //or when the delta time between two frames a become a sufficiently large (due to interpolation)
- //for overcome the MIN_INTERPOLATE_DISTANCE_SQUARED.
- mCurrentScale = target_scale;
-
- if (vec*vec > MIN_INTERPOLATE_DISTANCE_SQUARED)
- { //scale change requires immediate rebuild
- gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION);
- }
- else if (!isRoot() &&
- (!mVObjp->getAngularVelocity().isExactlyZero() ||
- dist_squared > 0.f))
- { //child prim moving relative to parent, tag as needing to be rendered atomically and rebuild
- dist_squared = 1.f; //keep this object on the move list
- if (!isState(LLDrawable::ANIMATED_CHILD))
- {
- setState(LLDrawable::ANIMATED_CHILD);
- gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL);
- mVObjp->dirtySpatialGroup();
- }
- }
- else if (!isRoot() &&
- ((dist_vec_squared(old_pos, target_pos) > 0.f)
- || (1.f - dot(old_rot, target_rot)) > 0.f))
- { //fix for BUG-840, MAINT-2275, MAINT-1742, MAINT-2247
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ BOOL damped = !undamped;
+
+ // Position
+ const LLVector3 old_pos(mXform.getPosition());
+ LLVector3 target_pos;
+ if (mXform.isRoot())
+ {
+ // get root position in your agent's region
+ target_pos = mVObjp->getPositionAgent();
+ }
+ else
+ {
+ // parent-relative position
+ target_pos = mVObjp->getPosition();
+ }
+
+ // Rotation
+ const LLQuaternion old_rot(mXform.getRotation());
+ LLQuaternion target_rot = mVObjp->getRotation();
+ //scaling
+ LLVector3 target_scale = mVObjp->getScale();
+ LLVector3 old_scale = mCurrentScale;
+
+ // Damping
+ F32 dist_squared = 0.f;
+ F32 camdist2 = (mDistanceWRTCamera * mDistanceWRTCamera);
+
+ if (damped && isVisible())
+ {
+ F32 lerp_amt = llclamp(LLSmoothInterpolation::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f);
+ LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt);
+ dist_squared = dist_vec_squared(new_pos, target_pos);
+
+ LLQuaternion new_rot = nlerp(lerp_amt, old_rot, target_rot);
+ // FIXME: This can be negative! It is be possible for some rots to 'cancel out' pos or size changes.
+ dist_squared += (1.f - dot(new_rot, target_rot)) * 10.f;
+
+ LLVector3 new_scale = lerp(old_scale, target_scale, lerp_amt);
+ dist_squared += dist_vec_squared(new_scale, target_scale);
+
+ if ((dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED * camdist2) &&
+ (dist_squared <= MAX_INTERPOLATE_DISTANCE_SQUARED))
+ {
+ // interpolate
+ target_pos = new_pos;
+ target_rot = new_rot;
+ target_scale = new_scale;
+ }
+ else if (mVObjp->getAngularVelocity().isExactlyZero())
+ {
+ // snap to final position (only if no target omega is applied)
+ dist_squared = 0.0f;
+ //set target scale here, because of dist_squared = 0.0f remove object from move list
+ mCurrentScale = target_scale;
+
+ if (getVOVolume() && !isRoot())
+ { //child prim snapping to some position, needs a rebuild
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION);
+ }
+ }
+ }
+ else
+ {
+ // The following fixes MAINT-1742 but breaks vehicles similar to MAINT-2275
+ // dist_squared = dist_vec_squared(old_pos, target_pos);
+
+ // The following fixes MAINT-2247 but causes MAINT-2275
+ //dist_squared += (1.f - dot(old_rot, target_rot)) * 10.f;
+ //dist_squared += dist_vec_squared(old_scale, target_scale);
+ }
+
+ const LLVector3 vec = mCurrentScale-target_scale;
+
+ //It's a very important on each cycle on Drawable::update form(), when object remained in move
+ //, list update the CurrentScale member, because if do not do that, it remained in this list forever
+ //or when the delta time between two frames a become a sufficiently large (due to interpolation)
+ //for overcome the MIN_INTERPOLATE_DISTANCE_SQUARED.
+ mCurrentScale = target_scale;
+
+ if (vec*vec > MIN_INTERPOLATE_DISTANCE_SQUARED)
+ { //scale change requires immediate rebuild
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION);
+ }
+ else if (!isRoot() &&
+ (!mVObjp->getAngularVelocity().isExactlyZero() ||
+ dist_squared > 0.f))
+ { //child prim moving relative to parent, tag as needing to be rendered atomically and rebuild
+ dist_squared = 1.f; //keep this object on the move list
+ if (!isState(LLDrawable::ANIMATED_CHILD))
+ {
+ setState(LLDrawable::ANIMATED_CHILD);
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL);
+ mVObjp->dirtySpatialGroup();
+ }
+ }
+ else if (!isRoot() &&
+ ((dist_vec_squared(old_pos, target_pos) > 0.f)
+ || (1.f - dot(old_rot, target_rot)) > 0.f))
+ { //fix for BUG-840, MAINT-2275, MAINT-1742, MAINT-2247
mVObjp->shrinkWrap();
- gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION);
- }
- else if (!getVOVolume() && !isAvatar())
- {
- movePartition();
- }
-
- // Update
- mXform.setPosition(target_pos);
- mXform.setRotation(target_rot);
- mXform.setScale(LLVector3(1,1,1)); //no scale in drawable transforms (IT'S A RULE!)
- mXform.updateMatrix();
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION);
+ }
+ else if (!getVOVolume() && !isAvatar())
+ {
+ movePartition();
+ }
+
+ // Update
+ mXform.setPosition(target_pos);
+ mXform.setRotation(target_rot);
+ mXform.setScale(LLVector3(1,1,1)); //no scale in drawable transforms (IT'S A RULE!)
+ mXform.updateMatrix();
if (isRoot() && mVObjp->isAnimatedObject() && mVObjp->getControlAvatar())
{
mVObjp->getControlAvatar()->matchVolumeTransform();
}
- if (mSpatialBridge)
- {
- gPipeline.markMoved(mSpatialBridge, FALSE);
- }
- return dist_squared;
+ if (mSpatialBridge)
+ {
+ gPipeline.markMoved(mSpatialBridge, FALSE);
+ }
+ return dist_squared;
}
void LLDrawable::setRadius(F32 radius)
{
- if (mRadius != radius)
- {
- mRadius = radius;
- }
+ if (mRadius != radius)
+ {
+ mRadius = radius;
+ }
}
void LLDrawable::moveUpdatePipeline(BOOL moved)
{
- if (moved)
- {
- makeActive();
- }
-
- // Update the face centers.
- for (S32 i = 0; i < getNumFaces(); i++)
- {
- LLFace* face = getFace(i);
- if (face)
- {
- face->updateCenterAgent();
- }
- }
+ if (moved)
+ {
+ makeActive();
+ }
+
+ // Update the face centers.
+ for (S32 i = 0; i < getNumFaces(); i++)
+ {
+ LLFace* face = getFace(i);
+ if (face)
+ {
+ face->updateCenterAgent();
+ }
+ }
}
void LLDrawable::movePartition()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
- LLSpatialPartition* part = getSpatialPartition();
- if (part)
- {
- part->move(this, getSpatialGroup());
- }
+ LLSpatialPartition* part = getSpatialPartition();
+ if (part)
+ {
+ part->move(this, getSpatialGroup());
+ }
}
BOOL LLDrawable::updateMove()
{
- if (isDead())
- {
- LL_WARNS() << "Update move on dead drawable!" << LL_ENDL;
- return TRUE;
- }
-
- if (mVObjp.isNull())
- {
- return FALSE;
- }
-
- makeActive();
+ if (isDead())
+ {
+ LL_WARNS() << "Update move on dead drawable!" << LL_ENDL;
+ return TRUE;
+ }
+
+ if (mVObjp.isNull())
+ {
+ return FALSE;
+ }
- return isState(MOVE_UNDAMPED) ? updateMoveUndamped() : updateMoveDamped();
+ makeActive();
+
+ return isState(MOVE_UNDAMPED) ? updateMoveUndamped() : updateMoveDamped();
}
BOOL LLDrawable::updateMoveUndamped()
{
- F32 dist_squared = updateXform(TRUE);
+ F32 dist_squared = updateXform(TRUE);
- mGeneration++;
+ mGeneration++;
- if (!isState(LLDrawable::INVISIBLE))
- {
- BOOL moved = (dist_squared > 0.001f && dist_squared < 255.99f);
- moveUpdatePipeline(moved);
- mVObjp->updateText();
- }
+ if (!isState(LLDrawable::INVISIBLE))
+ {
+ BOOL moved = (dist_squared > 0.001f && dist_squared < 255.99f);
+ moveUpdatePipeline(moved);
+ mVObjp->updateText();
+ }
- mVObjp->clearChanged(LLXform::MOVED);
- return TRUE;
+ mVObjp->clearChanged(LLXform::MOVED);
+ return TRUE;
}
void LLDrawable::updatePartition()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
- if (!getVOVolume())
- {
- movePartition();
- }
- else if (mSpatialBridge)
- {
- gPipeline.markMoved(mSpatialBridge, FALSE);
- }
- else
- {
- //a child prim moved and needs its verts regenerated
- gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION);
- }
+ if (!getVOVolume())
+ {
+ movePartition();
+ }
+ else if (mSpatialBridge)
+ {
+ gPipeline.markMoved(mSpatialBridge, FALSE);
+ }
+ else
+ {
+ //a child prim moved and needs its verts regenerated
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION);
+ }
}
BOOL LLDrawable::updateMoveDamped()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
- F32 dist_squared = updateXform(FALSE);
+ F32 dist_squared = updateXform(FALSE);
- mGeneration++;
+ mGeneration++;
- if (!isState(LLDrawable::INVISIBLE))
- {
- BOOL moved = (dist_squared > 0.001f && dist_squared < 128.0f);
- moveUpdatePipeline(moved);
- mVObjp->updateText();
- }
+ if (!isState(LLDrawable::INVISIBLE))
+ {
+ BOOL moved = (dist_squared > 0.001f && dist_squared < 128.0f);
+ moveUpdatePipeline(moved);
+ mVObjp->updateText();
+ }
- BOOL done_moving = (dist_squared == 0.0f) ? TRUE : FALSE;
+ BOOL done_moving = (dist_squared == 0.0f) ? TRUE : FALSE;
- if (done_moving)
- {
- mVObjp->clearChanged(LLXform::MOVED);
- }
-
- return done_moving;
+ if (done_moving)
+ {
+ mVObjp->clearChanged(LLXform::MOVED);
+ }
+
+ return done_moving;
}
void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
- {
- LL_WARNS() << "Attempted to update distance for non-world camera." << LL_ENDL;
- return;
- }
-
- if (gShiftFrame)
- {
- return;
- }
-
- //switch LOD with the spatial group to avoid artifacts
- //LLSpatialGroup* sg = getSpatialGroup();
-
- LLVector3 pos;
-
- //if (!sg || sg->changeLOD())
- {
- LLVOVolume* volume = getVOVolume();
- if (volume)
- {
- if (getGroup())
- {
- pos.set(getPositionGroup().getF32ptr());
- }
- else
- {
- pos = getPositionAgent();
- }
-
- if (isState(LLDrawable::HAS_ALPHA))
- {
- for (S32 i = 0; i < getNumFaces(); i++)
- {
- LLFace* facep = getFace(i);
- if (facep &&
- (force_update || facep->isInAlphaPool()))
- {
- LLVector4a box;
- box.setSub(facep->mExtents[1], facep->mExtents[0]);
- box.mul(0.25f);
- LLVector3 v = (facep->mCenterLocal-camera.getOrigin());
- const LLVector3& at = camera.getAtAxis();
- for (U32 j = 0; j < 3; j++)
- {
- v.mV[j] -= box[j] * at.mV[j];
- }
- facep->mDistance = v * camera.getAtAxis();
- }
- }
- }
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
+ {
+ LL_WARNS() << "Attempted to update distance for non-world camera." << LL_ENDL;
+ return;
+ }
+
+ if (gShiftFrame)
+ {
+ return;
+ }
+
+ //switch LOD with the spatial group to avoid artifacts
+ //LLSpatialGroup* sg = getSpatialGroup();
+
+ LLVector3 pos;
+
+ //if (!sg || sg->changeLOD())
+ {
+ LLVOVolume* volume = getVOVolume();
+ if (volume)
+ {
+ if (getGroup())
+ {
+ pos.set(getPositionGroup().getF32ptr());
+ }
+ else
+ {
+ pos = getPositionAgent();
+ }
+
+ if (isState(LLDrawable::HAS_ALPHA))
+ {
+ for (S32 i = 0; i < getNumFaces(); i++)
+ {
+ LLFace* facep = getFace(i);
+ if (facep &&
+ (force_update || facep->isInAlphaPool()))
+ {
+ LLVector4a box;
+ box.setSub(facep->mExtents[1], facep->mExtents[0]);
+ box.mul(0.25f);
+ LLVector3 v = (facep->mCenterLocal-camera.getOrigin());
+ const LLVector3& at = camera.getAtAxis();
+ for (U32 j = 0; j < 3; j++)
+ {
+ v.mV[j] -= box[j] * at.mV[j];
+ }
+ facep->mDistance = v * camera.getAtAxis();
+ }
+ }
+ }
// MAINT-7926 Handle volumes in an animated object as a special case
@@ -911,173 +911,173 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
mVObjp->updateLOD();
return;
}
- }
- else
- {
- pos = LLVector3(getPositionGroup().getF32ptr());
- }
-
- pos -= camera.getOrigin();
- mDistanceWRTCamera = ll_round(pos.magVec(), 0.01f);
- mVObjp->updateLOD();
- }
+ }
+ else
+ {
+ pos = LLVector3(getPositionGroup().getF32ptr());
+ }
+
+ pos -= camera.getOrigin();
+ mDistanceWRTCamera = ll_round(pos.magVec(), 0.01f);
+ mVObjp->updateLOD();
+ }
}
void LLDrawable::updateTexture()
{
- if (isDead())
- {
- LL_WARNS() << "Dead drawable updating texture!" << LL_ENDL;
- return;
- }
-
- if (getNumFaces() != mVObjp->getNumTEs())
- { //drawable is transitioning its face count
- return;
- }
+ if (isDead())
+ {
+ LL_WARNS() << "Dead drawable updating texture!" << LL_ENDL;
+ return;
+ }
- if (getVOVolume())
- {
- gPipeline.markRebuild(this, LLDrawable::REBUILD_MATERIAL);
- }
+ if (getNumFaces() != mVObjp->getNumTEs())
+ { //drawable is transitioning its face count
+ return;
+ }
+
+ if (getVOVolume())
+ {
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_MATERIAL);
+ }
}
BOOL LLDrawable::updateGeometry()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
- llassert(mVObjp.notNull());
- BOOL res = mVObjp && mVObjp->updateGeometry(this);
- return res;
+ llassert(mVObjp.notNull());
+ BOOL res = mVObjp && mVObjp->updateGeometry(this);
+ return res;
}
void LLDrawable::shiftPos(const LLVector4a &shift_vector)
{
- if (isDead())
- {
- LL_WARNS() << "Shifting dead drawable" << LL_ENDL;
- return;
- }
-
- if (mParent)
- {
- mXform.setPosition(mVObjp->getPosition());
- }
- else
- {
- mXform.setPosition(mVObjp->getPositionAgent());
- }
-
- mXform.updateMatrix();
-
- if (isStatic())
- {
- LLVOVolume* volume = getVOVolume();
-
- bool rebuild = (!volume &&
- getRenderType() != LLPipeline::RENDER_TYPE_TREE &&
- getRenderType() != LLPipeline::RENDER_TYPE_TERRAIN &&
- getRenderType() != LLPipeline::RENDER_TYPE_SKY);
-
- if (rebuild)
- {
- gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL);
- }
-
- for (S32 i = 0; i < getNumFaces(); i++)
- {
- LLFace *facep = getFace(i);
- if (facep)
- {
- facep->mCenterAgent += LLVector3(shift_vector.getF32ptr());
- facep->mExtents[0].add(shift_vector);
- facep->mExtents[1].add(shift_vector);
-
- if (rebuild && facep->hasGeometry())
- {
- facep->clearVertexBuffer();
- }
- }
- }
-
- shift(shift_vector);
- }
- else if (mSpatialBridge)
- {
- mSpatialBridge->shiftPos(shift_vector);
- }
- else if (isAvatar())
- {
- shift(shift_vector);
- }
-
- mVObjp->onShift(shift_vector);
+ if (isDead())
+ {
+ LL_WARNS() << "Shifting dead drawable" << LL_ENDL;
+ return;
+ }
+
+ if (mParent)
+ {
+ mXform.setPosition(mVObjp->getPosition());
+ }
+ else
+ {
+ mXform.setPosition(mVObjp->getPositionAgent());
+ }
+
+ mXform.updateMatrix();
+
+ if (isStatic())
+ {
+ LLVOVolume* volume = getVOVolume();
+
+ bool rebuild = (!volume &&
+ getRenderType() != LLPipeline::RENDER_TYPE_TREE &&
+ getRenderType() != LLPipeline::RENDER_TYPE_TERRAIN &&
+ getRenderType() != LLPipeline::RENDER_TYPE_SKY);
+
+ if (rebuild)
+ {
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL);
+ }
+
+ for (S32 i = 0; i < getNumFaces(); i++)
+ {
+ LLFace *facep = getFace(i);
+ if (facep)
+ {
+ facep->mCenterAgent += LLVector3(shift_vector.getF32ptr());
+ facep->mExtents[0].add(shift_vector);
+ facep->mExtents[1].add(shift_vector);
+
+ if (rebuild && facep->hasGeometry())
+ {
+ facep->clearVertexBuffer();
+ }
+ }
+ }
+
+ shift(shift_vector);
+ }
+ else if (mSpatialBridge)
+ {
+ mSpatialBridge->shiftPos(shift_vector);
+ }
+ else if (isAvatar())
+ {
+ shift(shift_vector);
+ }
+
+ mVObjp->onShift(shift_vector);
}
const LLVector3& LLDrawable::getBounds(LLVector3& min, LLVector3& max) const
{
- mXform.getMinMax(min,max);
- return mXform.getPositionW();
+ mXform.getMinMax(min,max);
+ return mXform.getPositionW();
}
void LLDrawable::updateSpatialExtents()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ if (mVObjp)
+ {
+ const LLVector4a* exts = getSpatialExtents();
+ LLVector4a extents[2] = { exts[0], exts[1] };
- if (mVObjp)
- {
- const LLVector4a* exts = getSpatialExtents();
- LLVector4a extents[2] = { exts[0], exts[1] };
+ mVObjp->updateSpatialExtents(extents[0], extents[1]);
+ setSpatialExtents(extents[0], extents[1]);
+ }
- mVObjp->updateSpatialExtents(extents[0], extents[1]);
- setSpatialExtents(extents[0], extents[1]);
- }
-
- updateBinRadius();
-
- if (mSpatialBridge.notNull())
- {
- getGroupPosition().splat(0.f);
- }
+ updateBinRadius();
+
+ if (mSpatialBridge.notNull())
+ {
+ getGroupPosition().splat(0.f);
+ }
}
void LLDrawable::updateBinRadius()
{
- if (mVObjp.notNull())
- {
- setBinRadius(llmin(mVObjp->getBinRadius(), 256.f));
- }
- else
- {
- setBinRadius(llmin(getRadius()*4.f, 256.f));
- }
+ if (mVObjp.notNull())
+ {
+ setBinRadius(llmin(mVObjp->getBinRadius(), 256.f));
+ }
+ else
+ {
+ setBinRadius(llmin(getRadius()*4.f, 256.f));
+ }
}
void LLDrawable::updateSpecialHoverCursor(BOOL enabled)
{
- // TODO: maintain a list of objects that have special
- // hover cursors, then use that list for per-frame
- // hover cursor selection. JC
+ // TODO: maintain a list of objects that have special
+ // hover cursors, then use that list for per-frame
+ // hover cursor selection. JC
}
F32 LLDrawable::getVisibilityRadius() const
{
- if (isDead())
- {
- return 0.f;
- }
- else if (isLight())
- {
- const LLVOVolume *vov = getVOVolume();
- if (vov)
- {
- return llmax(getRadius(), vov->getLightRadius());
- } else {
- // LL_WARNS() ?
- }
- }
- return getRadius();
+ if (isDead())
+ {
+ return 0.f;
+ }
+ else if (isLight())
+ {
+ const LLVOVolume *vov = getVOVolume();
+ if (vov)
+ {
+ return llmax(getRadius(), vov->getLightRadius());
+ } else {
+ // LL_WARNS() ?
+ }
+ }
+ return getRadius();
}
void LLDrawable::updateUVMinMax()
@@ -1087,315 +1087,315 @@ void LLDrawable::updateUVMinMax()
//virtual
bool LLDrawable::isVisible() const
{
- if (LLViewerOctreeEntryData::isVisible())
- {
- return true;
+ if (LLViewerOctreeEntryData::isVisible())
+ {
+ return true;
}
{
- LLViewerOctreeGroup* group = mEntry->getGroup();
- if (group && group->isVisible())
- {
- LLViewerOctreeEntryData::setVisible();
- return true;
- }
- }
+ LLViewerOctreeGroup* group = mEntry->getGroup();
+ if (group && group->isVisible())
+ {
+ LLViewerOctreeEntryData::setVisible();
+ return true;
+ }
+ }
- return false;
+ return false;
}
//virtual
bool LLDrawable::isRecentlyVisible() const
{
- //currently visible or visible in the previous frame.
- bool vis = LLViewerOctreeEntryData::isRecentlyVisible();
+ //currently visible or visible in the previous frame.
+ bool vis = LLViewerOctreeEntryData::isRecentlyVisible();
- if(!vis)
- {
- const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one.
- vis = (sCurVisible - getVisible() < MIN_VIS_FRAME_RANGE);
- }
+ if(!vis)
+ {
+ const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one.
+ vis = (sCurVisible - getVisible() < MIN_VIS_FRAME_RANGE);
+ }
- return vis ;
+ return vis ;
}
void LLDrawable::setGroup(LLViewerOctreeGroup *groupp)
- {
- LLSpatialGroup* cur_groupp = (LLSpatialGroup*)getGroup();
-
- //precondition: mGroupp MUST be null or DEAD or mGroupp MUST NOT contain this
- //llassert(!cur_groupp || cur_groupp->isDead() || !cur_groupp->hasElement(this));
-
- //precondition: groupp MUST be null or groupp MUST contain this
- llassert(!groupp || (LLSpatialGroup*)groupp->hasElement(this));
-
- if (cur_groupp != groupp && getVOVolume())
- {
- //NULL out vertex buffer references for volumes on spatial group change to maintain
- //requirement that every face vertex buffer is either NULL or points to a vertex buffer
- //contained by its drawable's spatial group
- for (S32 i = 0; i < getNumFaces(); ++i)
- {
- LLFace* facep = getFace(i);
- if (facep)
- {
- facep->clearVertexBuffer();
- }
- }
- }
-
- //postcondition: if next group is NULL, previous group must be dead OR NULL OR binIndex must be -1
- //postcondition: if next group is NOT NULL, binIndex must not be -1
- //llassert(groupp == NULL ? (cur_groupp == NULL || cur_groupp->isDead()) || (!getEntry() || getEntry()->getBinIndex() == -1) :
- // (getEntry() && getEntry()->getBinIndex() != -1));
-
- LLViewerOctreeEntryData::setGroup(groupp);
+ {
+ LLSpatialGroup* cur_groupp = (LLSpatialGroup*)getGroup();
+
+ //precondition: mGroupp MUST be null or DEAD or mGroupp MUST NOT contain this
+ //llassert(!cur_groupp || cur_groupp->isDead() || !cur_groupp->hasElement(this));
+
+ //precondition: groupp MUST be null or groupp MUST contain this
+ llassert(!groupp || (LLSpatialGroup*)groupp->hasElement(this));
+
+ if (cur_groupp != groupp && getVOVolume())
+ {
+ //NULL out vertex buffer references for volumes on spatial group change to maintain
+ //requirement that every face vertex buffer is either NULL or points to a vertex buffer
+ //contained by its drawable's spatial group
+ for (S32 i = 0; i < getNumFaces(); ++i)
+ {
+ LLFace* facep = getFace(i);
+ if (facep)
+ {
+ facep->clearVertexBuffer();
+ }
+ }
+ }
+
+ //postcondition: if next group is NULL, previous group must be dead OR NULL OR binIndex must be -1
+ //postcondition: if next group is NOT NULL, binIndex must not be -1
+ //llassert(groupp == NULL ? (cur_groupp == NULL || cur_groupp->isDead()) || (!getEntry() || getEntry()->getBinIndex() == -1) :
+ // (getEntry() && getEntry()->getBinIndex() != -1));
+
+ LLViewerOctreeEntryData::setGroup(groupp);
}
/*
-* Get the SpatialPartition this Drawable should use.
+* Get the SpatialPartition this Drawable should use.
* Checks current SpatialPartition assignment and corrects if it is invalid.
*/
LLSpatialPartition* LLDrawable::getSpatialPartition()
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
- LLSpatialPartition* retval = NULL;
+ LLSpatialPartition* retval = NULL;
- if (!mVObjp ||
- !getVOVolume() ||
- isStatic())
- {
+ if (!mVObjp ||
+ !getVOVolume() ||
+ isStatic())
+ {
retval = gPipeline.getSpatialPartition((LLViewerObject*)mVObjp);
- }
- else if (isRoot())
- {
+ }
+ else if (isRoot())
+ {
// determine if the spatial bridge has changed
if (mSpatialBridge)
- {
- U32 partition_type = mSpatialBridge->asPartition()->mPartitionType;
- bool is_hud = mVObjp->isHUDAttachment();
- bool is_animesh = mVObjp->isAnimatedObject() && mVObjp->getControlAvatar() != NULL;
- bool is_attachment = mVObjp->isAttachment() && !is_hud && !is_animesh;
- if ((partition_type == LLViewerRegion::PARTITION_HUD) != is_hud)
- {
- // Was/became HUD
- // remove obsolete bridge
- mSpatialBridge->markDead();
- setSpatialBridge(NULL);
- }
- else if ((partition_type == LLViewerRegion::PARTITION_CONTROL_AV) != is_animesh)
- {
- // Was/became part of animesh
- // remove obsolete bridge
+ {
+ U32 partition_type = mSpatialBridge->asPartition()->mPartitionType;
+ bool is_hud = mVObjp->isHUDAttachment();
+ bool is_animesh = mVObjp->isAnimatedObject() && mVObjp->getControlAvatar() != NULL;
+ bool is_attachment = mVObjp->isAttachment() && !is_hud && !is_animesh;
+ if ((partition_type == LLViewerRegion::PARTITION_HUD) != is_hud)
+ {
+ // Was/became HUD
+ // remove obsolete bridge
mSpatialBridge->markDead();
- setSpatialBridge(NULL);
- }
- else if ((partition_type == LLViewerRegion::PARTITION_AVATAR) != is_attachment)
- {
- // Was/became part of avatar
- // remove obsolete bridge
+ setSpatialBridge(NULL);
+ }
+ else if ((partition_type == LLViewerRegion::PARTITION_CONTROL_AV) != is_animesh)
+ {
+ // Was/became part of animesh
+ // remove obsolete bridge
mSpatialBridge->markDead();
- setSpatialBridge(NULL);
- }
- }
- //must be an active volume
- if (!mSpatialBridge)
- {
- if (mVObjp->isHUDAttachment())
- {
- setSpatialBridge(new LLHUDBridge(this, getRegion()));
- }
- else if (mVObjp->isAnimatedObject() && mVObjp->getControlAvatar())
- {
- setSpatialBridge(new LLControlAVBridge(this, getRegion()));
- mVObjp->getControlAvatar()->mControlAVBridge = (LLControlAVBridge*)getSpatialBridge();
- }
- // check HUD first, because HUD is also attachment
- else if (mVObjp->isAttachment())
- {
+ setSpatialBridge(NULL);
+ }
+ else if ((partition_type == LLViewerRegion::PARTITION_AVATAR) != is_attachment)
+ {
+ // Was/became part of avatar
+ // remove obsolete bridge
+ mSpatialBridge->markDead();
+ setSpatialBridge(NULL);
+ }
+ }
+ //must be an active volume
+ if (!mSpatialBridge)
+ {
+ if (mVObjp->isHUDAttachment())
+ {
+ setSpatialBridge(new LLHUDBridge(this, getRegion()));
+ }
+ else if (mVObjp->isAnimatedObject() && mVObjp->getControlAvatar())
+ {
+ setSpatialBridge(new LLControlAVBridge(this, getRegion()));
+ mVObjp->getControlAvatar()->mControlAVBridge = (LLControlAVBridge*)getSpatialBridge();
+ }
+ // check HUD first, because HUD is also attachment
+ else if (mVObjp->isAttachment())
+ {
// Attachment
// Use AvatarBridge of root object in attachment linkset
- setSpatialBridge(new LLAvatarBridge(this, getRegion()));
- }
- else
- {
+ setSpatialBridge(new LLAvatarBridge(this, getRegion()));
+ }
+ else
+ {
// Moving linkset, use VolumeBridge of root object in linkset
- setSpatialBridge(new LLVolumeBridge(this, getRegion()));
- }
- }
- return mSpatialBridge->asPartition();
- }
- else
- {
- retval = getParent()->getSpatialPartition();
- }
-
- if (retval && mSpatialBridge.notNull())
- {
- mSpatialBridge->markDead();
- setSpatialBridge(NULL);
- }
-
- return retval;
+ setSpatialBridge(new LLVolumeBridge(this, getRegion()));
+ }
+ }
+ return mSpatialBridge->asPartition();
+ }
+ else
+ {
+ retval = getParent()->getSpatialPartition();
+ }
+
+ if (retval && mSpatialBridge.notNull())
+ {
+ mSpatialBridge->markDead();
+ setSpatialBridge(NULL);
+ }
+
+ return retval;
}
//=======================================
// Spatial Partition Bridging Drawable
//=======================================
-LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp) :
- LLDrawable(root->getVObj(), true),
- LLSpatialPartition(data_mask, render_by_group, regionp)
+LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp) :
+ LLDrawable(root->getVObj(), true),
+ LLSpatialPartition(data_mask, render_by_group, regionp)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE;
mOcclusionEnabled = false;
- mBridge = this;
- mDrawable = root;
- root->setSpatialBridge(this);
-
- mRenderType = mDrawable->mRenderType;
- mDrawableType = mDrawable->mRenderType;
-
- mPartitionType = LLViewerRegion::PARTITION_VOLUME;
-
- mOctree->balance();
-
- llassert(mDrawable);
- llassert(mDrawable->getRegion());
- LLSpatialPartition *part = mDrawable->getRegion()->getSpatialPartition(mPartitionType);
- llassert(part);
-
- if (part)
- {
- part->put(this);
- }
+ mBridge = this;
+ mDrawable = root;
+ root->setSpatialBridge(this);
+
+ mRenderType = mDrawable->mRenderType;
+ mDrawableType = mDrawable->mRenderType;
+
+ mPartitionType = LLViewerRegion::PARTITION_VOLUME;
+
+ mOctree->balance();
+
+ llassert(mDrawable);
+ llassert(mDrawable->getRegion());
+ LLSpatialPartition *part = mDrawable->getRegion()->getSpatialPartition(mPartitionType);
+ llassert(part);
+
+ if (part)
+ {
+ part->put(this);
+ }
}
LLSpatialBridge::~LLSpatialBridge()
-{
- if(mEntry)
- {
- LLSpatialGroup* group = getSpatialGroup();
- if (group)
- {
- group->getSpatialPartition()->remove(this, group);
- }
- }
+{
+ if(mEntry)
+ {
+ LLSpatialGroup* group = getSpatialGroup();
+ if (group)
+ {
+ group->getSpatialPartition()->remove(this, group);
+ }
+ }
- //delete octree here so listeners will still be able to access bridge specific state
- destroyTree();
+ //delete octree here so listeners will still be able to access bridge specific state
+ destroyTree();
}
void LLSpatialBridge::destroyTree()
{
- delete mOctree;
- mOctree = NULL;
+ delete mOctree;
+ mOctree = NULL;
}
void LLSpatialBridge::updateSpatialExtents()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- LLSpatialGroup* root = (LLSpatialGroup*) mOctree->getListener(0);
-
- root->rebound();
-
- const LLVector4a* root_bounds = root->getBounds();
- LLVector4a offset;
- LLVector4a size = root_bounds[1];
-
- //VECTORIZE THIS
- LLMatrix4a mat;
- mat.loadu(mDrawable->getXform()->getWorldMatrix());
-
- LLVector4a t;
- t.splat(0.f);
-
- LLVector4a center;
- mat.affineTransform(t, center);
-
- mat.rotate(root_bounds[0], offset);
- center.add(offset);
-
- LLVector4a v[4];
-
- //get 4 corners of bounding box
- mat.rotate(size,v[0]);
-
- LLVector4a scale;
-
- scale.set(-1.f, -1.f, 1.f);
- scale.mul(size);
- mat.rotate(scale, v[1]);
-
- scale.set(1.f, -1.f, -1.f);
- scale.mul(size);
- mat.rotate(scale, v[2]);
-
- scale.set(-1.f, 1.f, -1.f);
- scale.mul(size);
- mat.rotate(scale, v[3]);
-
- LLVector4a newMin;
- LLVector4a newMax;
- newMin = newMax = center;
- for (U32 i = 0; i < 4; i++)
- {
- LLVector4a delta;
- delta.setAbs(v[i]);
- LLVector4a min;
- min.setSub(center, delta);
- LLVector4a max;
- max.setAdd(center, delta);
-
- newMin.setMin(newMin, min);
- newMax.setMax(newMax, max);
- }
- setSpatialExtents(newMin, newMax);
-
- LLVector4a diagonal;
- diagonal.setSub(newMax, newMin);
- mRadius = diagonal.getLength3().getF32() * 0.5f;
-
- LLVector4a& pos = getGroupPosition();
- pos.setAdd(newMin,newMax);
- pos.mul(0.5f);
- updateBinRadius();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ LLSpatialGroup* root = (LLSpatialGroup*) mOctree->getListener(0);
+
+ root->rebound();
+
+ const LLVector4a* root_bounds = root->getBounds();
+ LLVector4a offset;
+ LLVector4a size = root_bounds[1];
+
+ //VECTORIZE THIS
+ LLMatrix4a mat;
+ mat.loadu(mDrawable->getXform()->getWorldMatrix());
+
+ LLVector4a t;
+ t.splat(0.f);
+
+ LLVector4a center;
+ mat.affineTransform(t, center);
+
+ mat.rotate(root_bounds[0], offset);
+ center.add(offset);
+
+ LLVector4a v[4];
+
+ //get 4 corners of bounding box
+ mat.rotate(size,v[0]);
+
+ LLVector4a scale;
+
+ scale.set(-1.f, -1.f, 1.f);
+ scale.mul(size);
+ mat.rotate(scale, v[1]);
+
+ scale.set(1.f, -1.f, -1.f);
+ scale.mul(size);
+ mat.rotate(scale, v[2]);
+
+ scale.set(-1.f, 1.f, -1.f);
+ scale.mul(size);
+ mat.rotate(scale, v[3]);
+
+ LLVector4a newMin;
+ LLVector4a newMax;
+ newMin = newMax = center;
+ for (U32 i = 0; i < 4; i++)
+ {
+ LLVector4a delta;
+ delta.setAbs(v[i]);
+ LLVector4a min;
+ min.setSub(center, delta);
+ LLVector4a max;
+ max.setAdd(center, delta);
+
+ newMin.setMin(newMin, min);
+ newMax.setMax(newMax, max);
+ }
+ setSpatialExtents(newMin, newMax);
+
+ LLVector4a diagonal;
+ diagonal.setSub(newMax, newMin);
+ mRadius = diagonal.getLength3().getF32() * 0.5f;
+
+ LLVector4a& pos = getGroupPosition();
+ pos.setAdd(newMin,newMax);
+ pos.mul(0.5f);
+ updateBinRadius();
}
void LLSpatialBridge::updateBinRadius()
{
- setBinRadius(llmin( mOctree->getSize()[0]*0.5f, 256.f));
+ setBinRadius(llmin( mOctree->getSize()[0]*0.5f, 256.f));
}
LLCamera LLSpatialBridge::transformCamera(LLCamera& camera)
{
- LLCamera ret = camera;
- LLXformMatrix* mat = mDrawable->getXform();
- LLVector3 center = LLVector3(0,0,0) * mat->getWorldMatrix();
+ LLCamera ret = camera;
+ LLXformMatrix* mat = mDrawable->getXform();
+ LLVector3 center = LLVector3(0,0,0) * mat->getWorldMatrix();
- LLVector3 delta = ret.getOrigin() - center;
- LLQuaternion rot = ~mat->getRotation();
+ LLVector3 delta = ret.getOrigin() - center;
+ LLQuaternion rot = ~mat->getRotation();
- delta *= rot;
- LLVector3 lookAt = ret.getAtAxis();
- LLVector3 up_axis = ret.getUpAxis();
- LLVector3 left_axis = ret.getLeftAxis();
+ delta *= rot;
+ LLVector3 lookAt = ret.getAtAxis();
+ LLVector3 up_axis = ret.getUpAxis();
+ LLVector3 left_axis = ret.getLeftAxis();
- lookAt *= rot;
- up_axis *= rot;
- left_axis *= rot;
+ lookAt *= rot;
+ up_axis *= rot;
+ left_axis *= rot;
- if (!delta.isFinite())
- {
- delta.clearVec();
- }
+ if (!delta.isFinite())
+ {
+ delta.clearVec();
+ }
- ret.setOrigin(delta);
- ret.setAxes(lookAt, left_axis, up_axis);
+ ret.setOrigin(delta);
+ ret.setAxes(lookAt, left_axis, up_axis);
- return ret;
+ return ret;
}
void LLSpatialBridge::transformExtents(const LLVector4a* src, LLVector4a* dst)
@@ -1411,333 +1411,333 @@ void LLSpatialBridge::transformExtents(const LLVector4a* src, LLVector4a* dst)
void LLDrawable::setVisible(LLCamera& camera, std::vector<LLDrawable*>* results, BOOL for_select)
{
- LLViewerOctreeEntryData::setVisible();
-
+ LLViewerOctreeEntryData::setVisible();
+
#if 0 && !LL_RELEASE_FOR_DOWNLOAD
- //crazy paranoid rules checking
- if (getVOVolume())
- {
- if (!isRoot())
- {
- if (isActive() && !mParent->isActive())
- {
- LL_ERRS() << "Active drawable has static parent!" << LL_ENDL;
- }
-
- if (isStatic() && !mParent->isStatic())
- {
- LL_ERRS() << "Static drawable has active parent!" << LL_ENDL;
- }
-
- if (mSpatialBridge)
- {
- LL_ERRS() << "Child drawable has spatial bridge!" << LL_ENDL;
- }
- }
- else if (isActive() && !mSpatialBridge)
- {
- LL_ERRS() << "Active root drawable has no spatial bridge!" << LL_ENDL;
- }
- else if (isStatic() && mSpatialBridge.notNull())
- {
- LL_ERRS() << "Static drawable has spatial bridge!" << LL_ENDL;
- }
- }
+ //crazy paranoid rules checking
+ if (getVOVolume())
+ {
+ if (!isRoot())
+ {
+ if (isActive() && !mParent->isActive())
+ {
+ LL_ERRS() << "Active drawable has static parent!" << LL_ENDL;
+ }
+
+ if (isStatic() && !mParent->isStatic())
+ {
+ LL_ERRS() << "Static drawable has active parent!" << LL_ENDL;
+ }
+
+ if (mSpatialBridge)
+ {
+ LL_ERRS() << "Child drawable has spatial bridge!" << LL_ENDL;
+ }
+ }
+ else if (isActive() && !mSpatialBridge)
+ {
+ LL_ERRS() << "Active root drawable has no spatial bridge!" << LL_ENDL;
+ }
+ else if (isStatic() && mSpatialBridge.notNull())
+ {
+ LL_ERRS() << "Static drawable has spatial bridge!" << LL_ENDL;
+ }
+ }
#endif
}
class LLOctreeMarkNotCulled: public OctreeTraveler
{
public:
- LLCamera* mCamera;
-
- LLOctreeMarkNotCulled(LLCamera* camera_in) : mCamera(camera_in) { }
-
- virtual void traverse(const OctreeNode* node)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
- group->setVisible();
- OctreeTraveler::traverse(node);
- }
-
- void visit(const OctreeNode* branch)
- {
- gPipeline.markNotCulled((LLSpatialGroup*) branch->getListener(0), *mCamera);
- }
+ LLCamera* mCamera;
+
+ LLOctreeMarkNotCulled(LLCamera* camera_in) : mCamera(camera_in) { }
+
+ virtual void traverse(const OctreeNode* node)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
+ group->setVisible();
+ OctreeTraveler::traverse(node);
+ }
+
+ void visit(const OctreeNode* branch)
+ {
+ gPipeline.markNotCulled((LLSpatialGroup*) branch->getListener(0), *mCamera);
+ }
};
void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results, BOOL for_select)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- if (!gPipeline.hasRenderType(mDrawableType))
- {
- return;
- }
-
-
- //HACK don't draw attachments for avatars that haven't been visible in more than a frame
- LLViewerObject *vobj = mDrawable->getVObj();
- if (vobj && vobj->isAttachment() && !vobj->isHUDAttachment())
- {
- LLDrawable* av;
- LLDrawable* parent = mDrawable->getParent();
-
- if (parent)
- {
- LLViewerObject* objparent = parent->getVObj();
- av = objparent->mDrawable;
- LLSpatialGroup* group = av->getSpatialGroup();
-
- BOOL impostor = FALSE;
- BOOL loaded = FALSE;
- if (objparent->isAvatar())
- {
- LLVOAvatar* avatarp = (LLVOAvatar*) objparent;
- if (avatarp->isVisible())
- {
- impostor = objparent->isAvatar() && !LLPipeline::sImpostorRender && ((LLVOAvatar*) objparent)->isImpostor();
- loaded = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isFullyLoaded();
- }
- else
- {
- return;
- }
- }
-
- if (!group ||
- LLDrawable::getCurrentFrame() - av->getVisible() > 1 ||
- impostor ||
- !loaded)
- {
- return;
- }
- }
- }
-
-
- LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0);
- group->rebound();
-
- LLVector4a center;
- const LLVector4a* exts = getSpatialExtents();
- center.setAdd(exts[0], exts[1]);
- center.mul(0.5f);
- LLVector4a size;
- size.setSub(exts[1], exts[0]);
- size.mul(0.5f);
-
- if ((LLPipeline::sShadowRender && camera_in.AABBInFrustum(center, size)) ||
- LLPipeline::sImpostorRender ||
- (camera_in.AABBInFrustumNoFarClip(center, size) &&
- AABBSphereIntersect(exts[0], exts[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist)))
- {
- if (!LLPipeline::sImpostorRender &&
- !LLPipeline::sShadowRender &&
- LLPipeline::calcPixelArea(center, size, camera_in) < FORCE_INVISIBLE_AREA)
- {
- return;
- }
-
- LLDrawable::setVisible(camera_in);
-
- if (for_select)
- {
- results->push_back(mDrawable);
- if (mDrawable->getVObj())
- {
- LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- LLDrawable* drawable = child->mDrawable;
- results->push_back(drawable);
- }
- }
- }
- else
- {
- LLCamera trans_camera = transformCamera(camera_in);
- LLOctreeMarkNotCulled culler(&trans_camera);
- culler.traverse(mOctree);
- }
- }
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ if (!gPipeline.hasRenderType(mDrawableType))
+ {
+ return;
+ }
+
+
+ //HACK don't draw attachments for avatars that haven't been visible in more than a frame
+ LLViewerObject *vobj = mDrawable->getVObj();
+ if (vobj && vobj->isAttachment() && !vobj->isHUDAttachment())
+ {
+ LLDrawable* av;
+ LLDrawable* parent = mDrawable->getParent();
+
+ if (parent)
+ {
+ LLViewerObject* objparent = parent->getVObj();
+ av = objparent->mDrawable;
+ LLSpatialGroup* group = av->getSpatialGroup();
+
+ BOOL impostor = FALSE;
+ BOOL loaded = FALSE;
+ if (objparent->isAvatar())
+ {
+ LLVOAvatar* avatarp = (LLVOAvatar*) objparent;
+ if (avatarp->isVisible())
+ {
+ impostor = objparent->isAvatar() && !LLPipeline::sImpostorRender && ((LLVOAvatar*) objparent)->isImpostor();
+ loaded = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isFullyLoaded();
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ if (!group ||
+ LLDrawable::getCurrentFrame() - av->getVisible() > 1 ||
+ impostor ||
+ !loaded)
+ {
+ return;
+ }
+ }
+ }
+
+
+ LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0);
+ group->rebound();
+
+ LLVector4a center;
+ const LLVector4a* exts = getSpatialExtents();
+ center.setAdd(exts[0], exts[1]);
+ center.mul(0.5f);
+ LLVector4a size;
+ size.setSub(exts[1], exts[0]);
+ size.mul(0.5f);
+
+ if ((LLPipeline::sShadowRender && camera_in.AABBInFrustum(center, size)) ||
+ LLPipeline::sImpostorRender ||
+ (camera_in.AABBInFrustumNoFarClip(center, size) &&
+ AABBSphereIntersect(exts[0], exts[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist)))
+ {
+ if (!LLPipeline::sImpostorRender &&
+ !LLPipeline::sShadowRender &&
+ LLPipeline::calcPixelArea(center, size, camera_in) < FORCE_INVISIBLE_AREA)
+ {
+ return;
+ }
+
+ LLDrawable::setVisible(camera_in);
+
+ if (for_select)
+ {
+ results->push_back(mDrawable);
+ if (mDrawable->getVObj())
+ {
+ LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ LLDrawable* drawable = child->mDrawable;
+ results->push_back(drawable);
+ }
+ }
+ }
+ else
+ {
+ LLCamera trans_camera = transformCamera(camera_in);
+ LLOctreeMarkNotCulled culler(&trans_camera);
+ culler.traverse(mOctree);
+ }
+ }
}
void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
-
- if (mDrawable == NULL)
- {
- markDead();
- return;
- }
-
- if (gShiftFrame)
- {
- return;
- }
-
- if (mDrawable->getVObj())
- {
- // Don't update if we are part of impostor, unles it's an impostor pass
- if (!LLPipeline::sImpostorRender && mDrawable->getVObj()->isAttachment())
- {
- LLDrawable* parent = mDrawable->getParent();
- if (parent && parent->getVObj())
- {
- LLVOAvatar* av = parent->getVObj()->asAvatar();
- if (av && av->isImpostor())
- {
- return;
- }
- }
- }
-
- LLCamera camera = transformCamera(camera_in);
-
- mDrawable->updateDistance(camera, force_update);
-
- LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- LLDrawable* drawable = child->mDrawable;
- if (!drawable)
- {
- continue;
- }
-
- if (!drawable->isAvatar())
- {
- drawable->updateDistance(camera, force_update);
- }
- }
- }
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+
+ if (mDrawable == NULL)
+ {
+ markDead();
+ return;
+ }
+
+ if (gShiftFrame)
+ {
+ return;
+ }
+
+ if (mDrawable->getVObj())
+ {
+ // Don't update if we are part of impostor, unles it's an impostor pass
+ if (!LLPipeline::sImpostorRender && mDrawable->getVObj()->isAttachment())
+ {
+ LLDrawable* parent = mDrawable->getParent();
+ if (parent && parent->getVObj())
+ {
+ LLVOAvatar* av = parent->getVObj()->asAvatar();
+ if (av && av->isImpostor())
+ {
+ return;
+ }
+ }
+ }
+
+ LLCamera camera = transformCamera(camera_in);
+
+ mDrawable->updateDistance(camera, force_update);
+
+ LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ LLDrawable* drawable = child->mDrawable;
+ if (!drawable)
+ {
+ continue;
+ }
+
+ if (!drawable->isAvatar())
+ {
+ drawable->updateDistance(camera, force_update);
+ }
+ }
+ }
}
void LLSpatialBridge::makeActive()
{ //it is an error to make a spatial bridge active (it's already active)
- LL_ERRS() << "makeActive called on spatial bridge" << LL_ENDL;
+ LL_ERRS() << "makeActive called on spatial bridge" << LL_ENDL;
}
void LLSpatialBridge::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate)
{
- LLSpatialPartition::move(drawablep, curp, immediate);
- gPipeline.markMoved(this, FALSE);
+ LLSpatialPartition::move(drawablep, curp, immediate);
+ gPipeline.markMoved(this, FALSE);
}
BOOL LLSpatialBridge::updateMove()
{
- llassert_always(mDrawable);
- llassert_always(mDrawable->mVObjp);
- llassert_always(mDrawable->getRegion());
- LLSpatialPartition* part = mDrawable->getRegion()->getSpatialPartition(mPartitionType);
- llassert_always(part);
+ llassert_always(mDrawable);
+ llassert_always(mDrawable->mVObjp);
+ llassert_always(mDrawable->getRegion());
+ LLSpatialPartition* part = mDrawable->getRegion()->getSpatialPartition(mPartitionType);
+ llassert_always(part);
- mOctree->balance();
- if (part)
- {
- part->move(this, getSpatialGroup(), TRUE);
- }
- return TRUE;
+ mOctree->balance();
+ if (part)
+ {
+ part->move(this, getSpatialGroup(), TRUE);
+ }
+ return TRUE;
}
void LLSpatialBridge::shiftPos(const LLVector4a& vec)
{
- LLDrawable::shift(vec);
+ LLDrawable::shift(vec);
}
void LLSpatialBridge::cleanupReferences()
-{
- LLDrawable::cleanupReferences();
- if (mDrawable)
- {
- mDrawable->setGroup(NULL);
-
- if (mDrawable->getVObj())
- {
- LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- LLDrawable* drawable = child->mDrawable;
- if (drawable)
- {
- drawable->setGroup(NULL);
- }
- }
- }
-
- LLDrawable* drawablep = mDrawable;
- mDrawable = NULL;
- drawablep->setSpatialBridge(NULL);
- }
-}
-
-const LLVector3 LLDrawable::getPositionAgent() const
-{
- if (getVOVolume())
- {
- if (isActive())
- {
- LLVector3 pos(0,0,0);
- if (!isRoot())
- {
- pos = mVObjp->getPosition();
- }
- return pos * getRenderMatrix();
- }
- else
- {
- return mVObjp->getPositionAgent();
- }
- }
- else
- {
- return getWorldPosition();
- }
+{
+ LLDrawable::cleanupReferences();
+ if (mDrawable)
+ {
+ mDrawable->setGroup(NULL);
+
+ if (mDrawable->getVObj())
+ {
+ LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ LLDrawable* drawable = child->mDrawable;
+ if (drawable)
+ {
+ drawable->setGroup(NULL);
+ }
+ }
+ }
+
+ LLDrawable* drawablep = mDrawable;
+ mDrawable = NULL;
+ drawablep->setSpatialBridge(NULL);
+ }
+}
+
+const LLVector3 LLDrawable::getPositionAgent() const
+{
+ if (getVOVolume())
+ {
+ if (isActive())
+ {
+ LLVector3 pos(0,0,0);
+ if (!isRoot())
+ {
+ pos = mVObjp->getPosition();
+ }
+ return pos * getRenderMatrix();
+ }
+ else
+ {
+ return mVObjp->getPositionAgent();
+ }
+ }
+ else
+ {
+ return getWorldPosition();
+ }
}
BOOL LLDrawable::isAnimating() const
{
- if (!getVObj())
- {
- return TRUE;
- }
+ if (!getVObj())
+ {
+ return TRUE;
+ }
- if (getScale() != mVObjp->getScale())
- {
- return TRUE;
- }
+ if (getScale() != mVObjp->getScale())
+ {
+ return TRUE;
+ }
- if (mVObjp->getPCode() == LLViewerObject::LL_VO_PART_GROUP)
- {
- return TRUE;
- }
- if (mVObjp->getPCode() == LLViewerObject::LL_VO_HUD_PART_GROUP)
- {
- return TRUE;
- }
+ if (mVObjp->getPCode() == LLViewerObject::LL_VO_PART_GROUP)
+ {
+ return TRUE;
+ }
+ if (mVObjp->getPCode() == LLViewerObject::LL_VO_HUD_PART_GROUP)
+ {
+ return TRUE;
+ }
- /*if (!isRoot() && !mVObjp->getAngularVelocity().isExactlyZero())
- { //target omega
- return TRUE;
- }*/
+ /*if (!isRoot() && !mVObjp->getAngularVelocity().isExactlyZero())
+ { //target omega
+ return TRUE;
+ }*/
- return FALSE;
+ return FALSE;
}
void LLDrawable::updateFaceSize(S32 idx)
{
- if (mVObjp.notNull())
- {
- mVObjp->updateFaceSize(idx);
- }
+ if (mVObjp.notNull())
+ {
+ mVObjp->updateFaceSize(idx);
+ }
}
LLDrawable* LLDrawable::getRoot()
@@ -1752,44 +1752,44 @@ LLDrawable* LLDrawable::getRoot()
}
LLBridgePartition::LLBridgePartition(LLViewerRegion* regionp)
-: LLSpatialPartition(0, false, regionp)
-{
- mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
- mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
- mLODPeriod = 16;
- mSlopRatio = 0.25f;
+: LLSpatialPartition(0, false, regionp)
+{
+ mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
+ mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
+ mLODPeriod = 16;
+ mSlopRatio = 0.25f;
}
LLAvatarPartition::LLAvatarPartition(LLViewerRegion* regionp)
- : LLBridgePartition(regionp)
+ : LLBridgePartition(regionp)
{
- mDrawableType = LLPipeline::RENDER_TYPE_AVATAR;
- mPartitionType = LLViewerRegion::PARTITION_AVATAR;
+ mDrawableType = LLPipeline::RENDER_TYPE_AVATAR;
+ mPartitionType = LLViewerRegion::PARTITION_AVATAR;
}
LLControlAVPartition::LLControlAVPartition(LLViewerRegion* regionp)
- : LLBridgePartition(regionp)
+ : LLBridgePartition(regionp)
{
- mDrawableType = LLPipeline::RENDER_TYPE_CONTROL_AV;
- mPartitionType = LLViewerRegion::PARTITION_CONTROL_AV;
+ mDrawableType = LLPipeline::RENDER_TYPE_CONTROL_AV;
+ mPartitionType = LLViewerRegion::PARTITION_CONTROL_AV;
}
LLHUDBridge::LLHUDBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
: LLVolumeBridge(drawablep, regionp)
{
- mDrawableType = LLPipeline::RENDER_TYPE_HUD;
- mPartitionType = LLViewerRegion::PARTITION_HUD;
- mSlopRatio = 0.0f;
+ mDrawableType = LLPipeline::RENDER_TYPE_HUD;
+ mPartitionType = LLViewerRegion::PARTITION_HUD;
+ mSlopRatio = 0.0f;
}
F32 LLHUDBridge::calcPixelArea(LLSpatialGroup* group, LLCamera& camera)
{
- return 1024.f;
+ return 1024.f;
}
void LLHUDBridge::shiftPos(const LLVector4a& vec)
{
- //don't shift hud bridges on region crossing
+ //don't shift hud bridges on region crossing
}
diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h
index 970e8c8b2a..e02d62ad45 100644
--- a/indra/newview/lldrawable.h
+++ b/indra/newview/lldrawable.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawable.h
* @brief LLDrawable class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,279 +67,279 @@ class LLDrawable
public:
typedef std::vector<LLFace*> face_list_t;
- LLDrawable(const LLDrawable& rhs)
+ LLDrawable(const LLDrawable& rhs)
: LLViewerOctreeEntryData(rhs)
- {
- *this = rhs;
- }
-
- const LLDrawable& operator=(const LLDrawable& rhs)
- {
- LL_ERRS() << "Illegal operation!" << LL_ENDL;
- return *this;
- }
-
- static void initClass();
-
- LLDrawable(LLViewerObject *vobj, bool new_entry = false);
-
- void markDead(); // Mark this drawable as dead
- BOOL isDead() const { return isState(DEAD); }
- BOOL isNew() const { return !isState(BUILT); }
- BOOL isUnload() const { return isState(FOR_UNLOAD); }
-
- BOOL isLight() const;
-
- virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE);
-
- LLSpatialGroup* getSpatialGroup()const {return (LLSpatialGroup*)getGroup();}
- LLViewerRegion* getRegion() const { return mVObjp->getRegion(); }
- const LLTextureEntry* getTextureEntry(U8 which) const { return mVObjp->getTE(which); }
- LLPointer<LLViewerObject>& getVObj() { return mVObjp; }
- const LLViewerObject *getVObj() const { return mVObjp; }
- LLVOVolume* getVOVolume() const; // cast mVObjp tp LLVOVolume if OK
-
- const LLMatrix4& getWorldMatrix() const { return mXform.getWorldMatrix(); }
- const LLMatrix4& getRenderMatrix() const;
- void setPosition(LLVector3 v) const { }
- const LLVector3& getPosition() const { return mXform.getPosition(); }
- const LLVector3& getWorldPosition() const { return mXform.getPositionW(); }
- const LLVector3 getPositionAgent() const;
- const LLVector3& getScale() const { return mCurrentScale; }
- void setScale(const LLVector3& scale) { mCurrentScale = scale; }
- const LLQuaternion& getWorldRotation() const { return mXform.getWorldRotation(); }
- const LLQuaternion& getRotation() const { return mXform.getRotation(); }
- F32 getIntensity() const { return llmin(mXform.getScale().mV[0], 4.f); }
- S32 getLOD() const { return mVObjp ? mVObjp->getLOD() : 1; }
-
- void getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); }
- LLXformMatrix* getXform() { return &mXform; }
-
- U32 getState() const { return mState; }
- BOOL isState (U32 bits) const { return ((mState & bits) != 0); }
- void setState (U32 bits) { mState |= bits; }
- void clearState(U32 bits) { mState &= ~bits; }
-
- BOOL isAvatar() const { return mVObjp.notNull() && mVObjp->isAvatar(); }
- BOOL isRoot() const { return !mParent || mParent->isAvatar(); }
+ {
+ *this = rhs;
+ }
+
+ const LLDrawable& operator=(const LLDrawable& rhs)
+ {
+ LL_ERRS() << "Illegal operation!" << LL_ENDL;
+ return *this;
+ }
+
+ static void initClass();
+
+ LLDrawable(LLViewerObject *vobj, bool new_entry = false);
+
+ void markDead(); // Mark this drawable as dead
+ BOOL isDead() const { return isState(DEAD); }
+ BOOL isNew() const { return !isState(BUILT); }
+ BOOL isUnload() const { return isState(FOR_UNLOAD); }
+
+ BOOL isLight() const;
+
+ virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE);
+
+ LLSpatialGroup* getSpatialGroup()const {return (LLSpatialGroup*)getGroup();}
+ LLViewerRegion* getRegion() const { return mVObjp->getRegion(); }
+ const LLTextureEntry* getTextureEntry(U8 which) const { return mVObjp->getTE(which); }
+ LLPointer<LLViewerObject>& getVObj() { return mVObjp; }
+ const LLViewerObject *getVObj() const { return mVObjp; }
+ LLVOVolume* getVOVolume() const; // cast mVObjp tp LLVOVolume if OK
+
+ const LLMatrix4& getWorldMatrix() const { return mXform.getWorldMatrix(); }
+ const LLMatrix4& getRenderMatrix() const;
+ void setPosition(LLVector3 v) const { }
+ const LLVector3& getPosition() const { return mXform.getPosition(); }
+ const LLVector3& getWorldPosition() const { return mXform.getPositionW(); }
+ const LLVector3 getPositionAgent() const;
+ const LLVector3& getScale() const { return mCurrentScale; }
+ void setScale(const LLVector3& scale) { mCurrentScale = scale; }
+ const LLQuaternion& getWorldRotation() const { return mXform.getWorldRotation(); }
+ const LLQuaternion& getRotation() const { return mXform.getRotation(); }
+ F32 getIntensity() const { return llmin(mXform.getScale().mV[0], 4.f); }
+ S32 getLOD() const { return mVObjp ? mVObjp->getLOD() : 1; }
+
+ void getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); }
+ LLXformMatrix* getXform() { return &mXform; }
+
+ U32 getState() const { return mState; }
+ BOOL isState (U32 bits) const { return ((mState & bits) != 0); }
+ void setState (U32 bits) { mState |= bits; }
+ void clearState(U32 bits) { mState &= ~bits; }
+
+ BOOL isAvatar() const { return mVObjp.notNull() && mVObjp->isAvatar(); }
+ BOOL isRoot() const { return !mParent || mParent->isAvatar(); }
LLDrawable* getRoot();
- BOOL isSpatialRoot() const { return !mParent || mParent->isAvatar(); }
- virtual BOOL isSpatialBridge() const { return FALSE; }
- virtual LLSpatialPartition* asPartition() { return NULL; }
- LLDrawable* getParent() const { return mParent; }
-
- // must set parent through LLViewerObject:: ()
- //BOOL setParent(LLDrawable *parent);
-
- inline LLFace* getFace(const S32 i) const;
- inline S32 getNumFaces() const;
+ BOOL isSpatialRoot() const { return !mParent || mParent->isAvatar(); }
+ virtual BOOL isSpatialBridge() const { return FALSE; }
+ virtual LLSpatialPartition* asPartition() { return NULL; }
+ LLDrawable* getParent() const { return mParent; }
+
+ // must set parent through LLViewerObject:: ()
+ //BOOL setParent(LLDrawable *parent);
+
+ inline LLFace* getFace(const S32 i) const;
+ inline S32 getNumFaces() const;
face_list_t& getFaces() { return mFaces; }
const face_list_t& getFaces() const { return mFaces; }
- //void removeFace(const S32 i); // SJB: Avoid using this, it's slow
- LLFace* addFace(LLFacePool *poolp, LLViewerTexture *texturep);
- LLFace* addFace(const LLTextureEntry *te, LLViewerTexture *texturep);
- LLFace* addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLViewerTexture *normalp);
- LLFace* addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLViewerTexture *normalp, LLViewerTexture *specularp);
- void deleteFaces(S32 offset, S32 count);
- void setNumFaces(const S32 numFaces, LLFacePool *poolp, LLViewerTexture *texturep);
- void setNumFacesFast(const S32 numFaces, LLFacePool *poolp, LLViewerTexture *texturep);
- void mergeFaces(LLDrawable* src);
-
- void init(bool new_entry);
- void unload();
- void destroy();
-
- void update();
- F32 updateXform(BOOL undamped);
-
- virtual void makeActive();
- /*virtual*/ void makeStatic(BOOL warning_enabled = TRUE);
-
- BOOL isActive() const { return isState(ACTIVE); }
- BOOL isStatic() const { return !isActive(); }
- BOOL isAnimating() const;
-
- virtual BOOL updateMove();
- virtual void movePartition();
-
- void updateTexture();
- void updateMaterial();
- virtual void updateDistance(LLCamera& camera, bool force_update);
- BOOL updateGeometry();
- void updateFaceSize(S32 idx);
-
- void updateSpecialHoverCursor(BOOL enabled);
-
- virtual void shiftPos(const LLVector4a &shift_vector);
-
- S32 getGeneration() const { return mGeneration; }
-
- BOOL getLit() const { return isState(UNLIT) ? FALSE : TRUE; }
- void setLit(BOOL lit) { lit ? clearState(UNLIT) : setState(UNLIT); }
-
- bool isVisible() const;
- bool isRecentlyVisible() const;
-
- virtual void cleanupReferences();
-
- void setGroup(LLViewerOctreeGroup* group);
- void setRadius(const F32 radius);
- F32 getRadius() const { return mRadius; }
- F32 getVisibilityRadius() const;
-
- void updateUVMinMax(); // Updates the cache of sun space bounding box.
-
- const LLVector3& getBounds(LLVector3& min, LLVector3& max) const;
- virtual void updateSpatialExtents();
- virtual void updateBinRadius();
-
- void setRenderType(S32 type) { mRenderType = type; }
- BOOL isRenderType(S32 type) { return mRenderType == type; }
- S32 getRenderType() { return mRenderType; }
-
- // Debugging methods
- S32 findReferences(LLDrawable *drawablep); // Not const because of @#$! iterators...
-
- LLSpatialPartition* getSpatialPartition();
-
- void removeFromOctree();
-
- void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; }
- LLSpatialBridge* getSpatialBridge() { return (LLSpatialBridge*) (LLDrawable*) mSpatialBridge; }
-
- // Statics
- static void incrementVisible();
- static void cleanupDeadDrawables();
+ //void removeFace(const S32 i); // SJB: Avoid using this, it's slow
+ LLFace* addFace(LLFacePool *poolp, LLViewerTexture *texturep);
+ LLFace* addFace(const LLTextureEntry *te, LLViewerTexture *texturep);
+ LLFace* addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLViewerTexture *normalp);
+ LLFace* addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLViewerTexture *normalp, LLViewerTexture *specularp);
+ void deleteFaces(S32 offset, S32 count);
+ void setNumFaces(const S32 numFaces, LLFacePool *poolp, LLViewerTexture *texturep);
+ void setNumFacesFast(const S32 numFaces, LLFacePool *poolp, LLViewerTexture *texturep);
+ void mergeFaces(LLDrawable* src);
+
+ void init(bool new_entry);
+ void unload();
+ void destroy();
+
+ void update();
+ F32 updateXform(BOOL undamped);
+
+ virtual void makeActive();
+ /*virtual*/ void makeStatic(BOOL warning_enabled = TRUE);
+
+ BOOL isActive() const { return isState(ACTIVE); }
+ BOOL isStatic() const { return !isActive(); }
+ BOOL isAnimating() const;
+
+ virtual BOOL updateMove();
+ virtual void movePartition();
+
+ void updateTexture();
+ void updateMaterial();
+ virtual void updateDistance(LLCamera& camera, bool force_update);
+ BOOL updateGeometry();
+ void updateFaceSize(S32 idx);
+
+ void updateSpecialHoverCursor(BOOL enabled);
+
+ virtual void shiftPos(const LLVector4a &shift_vector);
+
+ S32 getGeneration() const { return mGeneration; }
+
+ BOOL getLit() const { return isState(UNLIT) ? FALSE : TRUE; }
+ void setLit(BOOL lit) { lit ? clearState(UNLIT) : setState(UNLIT); }
+
+ bool isVisible() const;
+ bool isRecentlyVisible() const;
+
+ virtual void cleanupReferences();
+
+ void setGroup(LLViewerOctreeGroup* group);
+ void setRadius(const F32 radius);
+ F32 getRadius() const { return mRadius; }
+ F32 getVisibilityRadius() const;
+
+ void updateUVMinMax(); // Updates the cache of sun space bounding box.
+
+ const LLVector3& getBounds(LLVector3& min, LLVector3& max) const;
+ virtual void updateSpatialExtents();
+ virtual void updateBinRadius();
+
+ void setRenderType(S32 type) { mRenderType = type; }
+ BOOL isRenderType(S32 type) { return mRenderType == type; }
+ S32 getRenderType() { return mRenderType; }
+
+ // Debugging methods
+ S32 findReferences(LLDrawable *drawablep); // Not const because of @#$! iterators...
+
+ LLSpatialPartition* getSpatialPartition();
+
+ void removeFromOctree();
+
+ void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; }
+ LLSpatialBridge* getSpatialBridge() { return (LLSpatialBridge*) (LLDrawable*) mSpatialBridge; }
+
+ // Statics
+ static void incrementVisible();
+ static void cleanupDeadDrawables();
protected:
- ~LLDrawable() { destroy(); }
- void moveUpdatePipeline(BOOL moved);
- void updatePartition();
- BOOL updateMoveDamped();
- BOOL updateMoveUndamped();
-
+ ~LLDrawable() { destroy(); }
+ void moveUpdatePipeline(BOOL moved);
+ void updatePartition();
+ BOOL updateMoveDamped();
+ BOOL updateMoveUndamped();
+
public:
- friend class LLPipeline;
- friend class LLDrawPool;
- friend class LLSpatialBridge;
-
- typedef std::unordered_set<LLPointer<LLDrawable> > drawable_set_t;
+ friend class LLPipeline;
+ friend class LLDrawPool;
+ friend class LLSpatialBridge;
+
+ typedef std::unordered_set<LLPointer<LLDrawable> > drawable_set_t;
typedef std::set<LLPointer<LLDrawable> > ordered_drawable_set_t;
- typedef std::vector<LLPointer<LLDrawable> > drawable_vector_t;
- typedef std::list<LLPointer<LLDrawable> > drawable_list_t;
- typedef std::queue<LLPointer<LLDrawable> > drawable_queue_t;
-
- struct CompareDistanceGreater
- {
- bool operator()(const LLDrawable* const& lhs, const LLDrawable* const& rhs)
- {
- return lhs->mDistanceWRTCamera < rhs->mDistanceWRTCamera; // farthest = last
- }
- };
-
- struct CompareDistanceGreaterVisibleFirst
- {
- bool operator()(const LLDrawable* const& lhs, const LLDrawable* const& rhs)
- {
- if (lhs->isVisible() && !rhs->isVisible())
- {
- return TRUE; //visible things come first
- }
- else if (!lhs->isVisible() && rhs->isVisible())
- {
- return FALSE; //rhs is visible, comes first
- }
-
- return lhs->mDistanceWRTCamera < rhs->mDistanceWRTCamera; // farthest = last
- }
- };
-
- typedef enum e_drawable_flags
- {
- IN_REBUILD_Q = 0x00000001,
- EARLY_MOVE = 0x00000004,
- MOVE_UNDAMPED = 0x00000008,
- ON_MOVE_LIST = 0x00000010,
- UV = 0x00000020,
- UNLIT = 0x00000040,
- LIGHT = 0x00000080,
- REBUILD_VOLUME = 0x00000100, //volume changed LOD or parameters, or vertex buffer changed
- REBUILD_TCOORD = 0x00000200, //texture coordinates changed
- REBUILD_COLOR = 0x00000400, //color changed
- REBUILD_POSITION= 0x00000800, //vertex positions/normals changed
- REBUILD_GEOMETRY= REBUILD_POSITION|REBUILD_TCOORD|REBUILD_COLOR,
- REBUILD_MATERIAL= REBUILD_TCOORD|REBUILD_COLOR,
- REBUILD_ALL = REBUILD_GEOMETRY|REBUILD_VOLUME,
- REBUILD_RIGGED = 0x00001000,
- ON_SHIFT_LIST = 0x00002000,
- ACTIVE = 0x00004000,
- DEAD = 0x00008000,
- INVISIBLE = 0x00010000, // stay invisible until flag is cleared
- NEARBY_LIGHT = 0x00020000, // In gPipeline.mNearbyLightSet
- BUILT = 0x00040000,
- FORCE_INVISIBLE = 0x00080000, // stay invis until CLEAR_INVISIBLE is set (set of orphaned)
- HAS_ALPHA = 0x00100000,
- RIGGED = 0x00200000, //has a rigged face
+ typedef std::vector<LLPointer<LLDrawable> > drawable_vector_t;
+ typedef std::list<LLPointer<LLDrawable> > drawable_list_t;
+ typedef std::queue<LLPointer<LLDrawable> > drawable_queue_t;
+
+ struct CompareDistanceGreater
+ {
+ bool operator()(const LLDrawable* const& lhs, const LLDrawable* const& rhs)
+ {
+ return lhs->mDistanceWRTCamera < rhs->mDistanceWRTCamera; // farthest = last
+ }
+ };
+
+ struct CompareDistanceGreaterVisibleFirst
+ {
+ bool operator()(const LLDrawable* const& lhs, const LLDrawable* const& rhs)
+ {
+ if (lhs->isVisible() && !rhs->isVisible())
+ {
+ return TRUE; //visible things come first
+ }
+ else if (!lhs->isVisible() && rhs->isVisible())
+ {
+ return FALSE; //rhs is visible, comes first
+ }
+
+ return lhs->mDistanceWRTCamera < rhs->mDistanceWRTCamera; // farthest = last
+ }
+ };
+
+ typedef enum e_drawable_flags
+ {
+ IN_REBUILD_Q = 0x00000001,
+ EARLY_MOVE = 0x00000004,
+ MOVE_UNDAMPED = 0x00000008,
+ ON_MOVE_LIST = 0x00000010,
+ UV = 0x00000020,
+ UNLIT = 0x00000040,
+ LIGHT = 0x00000080,
+ REBUILD_VOLUME = 0x00000100, //volume changed LOD or parameters, or vertex buffer changed
+ REBUILD_TCOORD = 0x00000200, //texture coordinates changed
+ REBUILD_COLOR = 0x00000400, //color changed
+ REBUILD_POSITION= 0x00000800, //vertex positions/normals changed
+ REBUILD_GEOMETRY= REBUILD_POSITION|REBUILD_TCOORD|REBUILD_COLOR,
+ REBUILD_MATERIAL= REBUILD_TCOORD|REBUILD_COLOR,
+ REBUILD_ALL = REBUILD_GEOMETRY|REBUILD_VOLUME,
+ REBUILD_RIGGED = 0x00001000,
+ ON_SHIFT_LIST = 0x00002000,
+ ACTIVE = 0x00004000,
+ DEAD = 0x00008000,
+ INVISIBLE = 0x00010000, // stay invisible until flag is cleared
+ NEARBY_LIGHT = 0x00020000, // In gPipeline.mNearbyLightSet
+ BUILT = 0x00040000,
+ FORCE_INVISIBLE = 0x00080000, // stay invis until CLEAR_INVISIBLE is set (set of orphaned)
+ HAS_ALPHA = 0x00100000,
+ RIGGED = 0x00200000, //has a rigged face
RIGGED_CHILD = 0x00400000, //has a child with a rigged face
- PARTITION_MOVE = 0x00800000,
- ANIMATED_CHILD = 0x01000000,
- ACTIVE_CHILD = 0x02000000,
- FOR_UNLOAD = 0x04000000, //should be unload from memory
- } EDrawableFlags;
+ PARTITION_MOVE = 0x00800000,
+ ANIMATED_CHILD = 0x01000000,
+ ACTIVE_CHILD = 0x02000000,
+ FOR_UNLOAD = 0x04000000, //should be unload from memory
+ } EDrawableFlags;
public:
- LLXformMatrix mXform;
+ LLXformMatrix mXform;
- // vis data
- LLPointer<LLDrawable> mParent;
+ // vis data
+ LLPointer<LLDrawable> mParent;
- F32 mDistanceWRTCamera;
+ F32 mDistanceWRTCamera;
- static F32 sCurPixelAngle; //current pixels per radian
+ static F32 sCurPixelAngle; //current pixels per radian
private:
- U32 mState;
- S32 mRenderType;
- LLPointer<LLViewerObject> mVObjp;
- face_list_t mFaces;
- LLPointer<LLDrawable> mSpatialBridge;
-
- F32 mRadius;
- S32 mGeneration;
-
- LLVector3 mCurrentScale;
-
- static U32 sNumZombieDrawables;
- static std::vector<LLPointer<LLDrawable> > sDeadList;
+ U32 mState;
+ S32 mRenderType;
+ LLPointer<LLViewerObject> mVObjp;
+ face_list_t mFaces;
+ LLPointer<LLDrawable> mSpatialBridge;
+
+ F32 mRadius;
+ S32 mGeneration;
+
+ LLVector3 mCurrentScale;
+
+ static U32 sNumZombieDrawables;
+ static std::vector<LLPointer<LLDrawable> > sDeadList;
} LL_ALIGN_POSTFIX(16);
inline LLFace* LLDrawable::getFace(const S32 i) const
{
- //switch these asserts to LL_ERRS() -- davep
- //llassert((U32)i < mFaces.size());
- //llassert(mFaces[i]);
-
- if ((U32) i >= mFaces.size())
- {
- LL_WARNS() << "Invalid face index." << LL_ENDL;
- return NULL;
- }
-
- if (!mFaces[i])
- {
- LL_WARNS() << "Null face found." << LL_ENDL;
- return NULL;
- }
-
- return mFaces[i];
+ //switch these asserts to LL_ERRS() -- davep
+ //llassert((U32)i < mFaces.size());
+ //llassert(mFaces[i]);
+
+ if ((U32) i >= mFaces.size())
+ {
+ LL_WARNS() << "Invalid face index." << LL_ENDL;
+ return NULL;
+ }
+
+ if (!mFaces[i])
+ {
+ LL_WARNS() << "Null face found." << LL_ENDL;
+ return NULL;
+ }
+
+ return mFaces[i];
}
inline S32 LLDrawable::getNumFaces()const
{
- return (S32)mFaces.size();
+ return (S32)mFaces.size();
}
#endif
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 50210b06c4..3b415f2b26 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpool.cpp
* @brief LLDrawPool class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -60,81 +60,81 @@ S32 LLDrawPool::sNumDrawPools = 0;
//=============================
LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerTexture *tex0)
{
- LLDrawPool *poolp = NULL;
- switch (type)
- {
- case POOL_SIMPLE:
- poolp = new LLDrawPoolSimple();
- break;
- case POOL_GRASS:
- poolp = new LLDrawPoolGrass();
- break;
- case POOL_ALPHA_MASK:
- poolp = new LLDrawPoolAlphaMask();
- break;
- case POOL_FULLBRIGHT_ALPHA_MASK:
- poolp = new LLDrawPoolFullbrightAlphaMask();
- break;
- case POOL_FULLBRIGHT:
- poolp = new LLDrawPoolFullbright();
- break;
- case POOL_GLOW:
- poolp = new LLDrawPoolGlow();
- break;
- case POOL_ALPHA_PRE_WATER:
- poolp = new LLDrawPoolAlpha(LLDrawPool::POOL_ALPHA_PRE_WATER);
- break;
+ LLDrawPool *poolp = NULL;
+ switch (type)
+ {
+ case POOL_SIMPLE:
+ poolp = new LLDrawPoolSimple();
+ break;
+ case POOL_GRASS:
+ poolp = new LLDrawPoolGrass();
+ break;
+ case POOL_ALPHA_MASK:
+ poolp = new LLDrawPoolAlphaMask();
+ break;
+ case POOL_FULLBRIGHT_ALPHA_MASK:
+ poolp = new LLDrawPoolFullbrightAlphaMask();
+ break;
+ case POOL_FULLBRIGHT:
+ poolp = new LLDrawPoolFullbright();
+ break;
+ case POOL_GLOW:
+ poolp = new LLDrawPoolGlow();
+ break;
+ case POOL_ALPHA_PRE_WATER:
+ poolp = new LLDrawPoolAlpha(LLDrawPool::POOL_ALPHA_PRE_WATER);
+ break;
case POOL_ALPHA_POST_WATER:
poolp = new LLDrawPoolAlpha(LLDrawPool::POOL_ALPHA_POST_WATER);
break;
- case POOL_AVATAR:
- case POOL_CONTROL_AV:
- poolp = new LLDrawPoolAvatar(type);
- break;
- case POOL_TREE:
- poolp = new LLDrawPoolTree(tex0);
- break;
- case POOL_TERRAIN:
- poolp = new LLDrawPoolTerrain(tex0);
- break;
- case POOL_SKY:
- poolp = new LLDrawPoolSky();
- break;
- case POOL_VOIDWATER:
- case POOL_WATER:
- poolp = new LLDrawPoolWater();
- break;
- case POOL_BUMP:
- poolp = new LLDrawPoolBump();
- break;
- case POOL_MATERIALS:
- poolp = new LLDrawPoolMaterials();
- break;
- case POOL_WL_SKY:
- poolp = new LLDrawPoolWLSky();
- break;
- case POOL_GLTF_PBR:
- poolp = new LLDrawPoolGLTFPBR();
+ case POOL_AVATAR:
+ case POOL_CONTROL_AV:
+ poolp = new LLDrawPoolAvatar(type);
+ break;
+ case POOL_TREE:
+ poolp = new LLDrawPoolTree(tex0);
+ break;
+ case POOL_TERRAIN:
+ poolp = new LLDrawPoolTerrain(tex0);
+ break;
+ case POOL_SKY:
+ poolp = new LLDrawPoolSky();
+ break;
+ case POOL_VOIDWATER:
+ case POOL_WATER:
+ poolp = new LLDrawPoolWater();
+ break;
+ case POOL_BUMP:
+ poolp = new LLDrawPoolBump();
+ break;
+ case POOL_MATERIALS:
+ poolp = new LLDrawPoolMaterials();
+ break;
+ case POOL_WL_SKY:
+ poolp = new LLDrawPoolWLSky();
+ break;
+ case POOL_GLTF_PBR:
+ poolp = new LLDrawPoolGLTFPBR();
break;
case POOL_GLTF_PBR_ALPHA_MASK:
poolp = new LLDrawPoolGLTFPBR(LLDrawPool::POOL_GLTF_PBR_ALPHA_MASK);
- break;
- default:
- LL_ERRS() << "Unknown draw pool type!" << LL_ENDL;
- return NULL;
- }
+ break;
+ default:
+ LL_ERRS() << "Unknown draw pool type!" << LL_ENDL;
+ return NULL;
+ }
- llassert(poolp->mType == type);
- return poolp;
+ llassert(poolp->mType == type);
+ return poolp;
}
LLDrawPool::LLDrawPool(const U32 type)
{
- mType = type;
- sNumDrawPools++;
- mId = sNumDrawPools;
- mShaderLevel = 0;
- mSkipRender = false;
+ mType = type;
+ sNumDrawPools++;
+ mId = sNumDrawPools;
+ mShaderLevel = 0;
+ mSkipRender = false;
}
LLDrawPool::~LLDrawPool()
@@ -144,7 +144,7 @@ LLDrawPool::~LLDrawPool()
LLViewerTexture *LLDrawPool::getDebugTexture()
{
- return NULL;
+ return NULL;
}
//virtual
@@ -152,55 +152,55 @@ void LLDrawPool::beginRenderPass( S32 pass )
{
}
-//virtual
-S32 LLDrawPool::getNumPasses()
+//virtual
+S32 LLDrawPool::getNumPasses()
{
- return 1;
+ return 1;
}
-
-//virtual
+
+//virtual
void LLDrawPool::beginDeferredPass(S32 pass)
{
}
-//virtual
+//virtual
void LLDrawPool::endDeferredPass(S32 pass)
{
}
-//virtual
+//virtual
S32 LLDrawPool::getNumDeferredPasses()
{
- return 0;
+ return 0;
}
-//virtual
+//virtual
void LLDrawPool::renderDeferred(S32 pass)
{
}
-//virtual
+//virtual
void LLDrawPool::beginPostDeferredPass(S32 pass)
{
}
-//virtual
+//virtual
void LLDrawPool::endPostDeferredPass(S32 pass)
{
}
-//virtual
+//virtual
S32 LLDrawPool::getNumPostDeferredPasses()
{
- return 0;
+ return 0;
}
-//virtual
+//virtual
void LLDrawPool::renderPostDeferred(S32 pass)
{
@@ -209,29 +209,29 @@ void LLDrawPool::renderPostDeferred(S32 pass)
//virtual
void LLDrawPool::endRenderPass( S32 pass )
{
- //make sure channel 0 is active channel
- gGL.getTexUnit(0)->activate();
+ //make sure channel 0 is active channel
+ gGL.getTexUnit(0)->activate();
}
-//virtual
+//virtual
void LLDrawPool::beginShadowPass(S32 pass)
{
}
-//virtual
+//virtual
void LLDrawPool::endShadowPass(S32 pass)
{
}
-//virtual
+//virtual
S32 LLDrawPool::getNumShadowPasses()
{
- return 0;
+ return 0;
}
-//virtual
+//virtual
void LLDrawPool::renderShadow(S32 pass)
{
@@ -243,20 +243,20 @@ void LLDrawPool::renderShadow(S32 pass)
LLFacePool::LLFacePool(const U32 type)
: LLDrawPool(type)
{
- resetDrawOrders();
+ resetDrawOrders();
}
LLFacePool::~LLFacePool()
{
- destroy();
+ destroy();
}
void LLFacePool::destroy()
{
- if (!mReferences.empty())
- {
- LL_INFOS() << mReferences.size() << " references left on deletion of draw pool!" << LL_ENDL;
- }
+ if (!mReferences.empty())
+ {
+ LL_INFOS() << mReferences.size() << " references left on deletion of draw pool!" << LL_ENDL;
+ }
}
void LLFacePool::dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures)
@@ -265,59 +265,59 @@ void LLFacePool::dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures
void LLFacePool::enqueue(LLFace* facep)
{
- mDrawFace.push_back(facep);
+ mDrawFace.push_back(facep);
}
// virtual
BOOL LLFacePool::addFace(LLFace *facep)
{
- addFaceReference(facep);
- return TRUE;
+ addFaceReference(facep);
+ return TRUE;
}
// virtual
BOOL LLFacePool::removeFace(LLFace *facep)
{
- removeFaceReference(facep);
+ removeFaceReference(facep);
- vector_replace_with_last(mDrawFace, facep);
+ vector_replace_with_last(mDrawFace, facep);
- return TRUE;
+ return TRUE;
}
// Not absolutely sure if we should be resetting all of the chained pools as well - djs
void LLFacePool::resetDrawOrders()
{
- mDrawFace.resize(0);
+ mDrawFace.resize(0);
}
LLViewerTexture *LLFacePool::getTexture()
{
- return NULL;
+ return NULL;
}
void LLFacePool::removeFaceReference(LLFace *facep)
{
- if (facep->getReferenceIndex() != -1)
- {
- if (facep->getReferenceIndex() != (S32)mReferences.size())
- {
- LLFace *back = mReferences.back();
- mReferences[facep->getReferenceIndex()] = back;
- back->setReferenceIndex(facep->getReferenceIndex());
- }
- mReferences.pop_back();
- }
- facep->setReferenceIndex(-1);
+ if (facep->getReferenceIndex() != -1)
+ {
+ if (facep->getReferenceIndex() != (S32)mReferences.size())
+ {
+ LLFace *back = mReferences.back();
+ mReferences[facep->getReferenceIndex()] = back;
+ back->setReferenceIndex(facep->getReferenceIndex());
+ }
+ mReferences.pop_back();
+ }
+ facep->setReferenceIndex(-1);
}
void LLFacePool::addFaceReference(LLFace *facep)
{
- if (-1 == facep->getReferenceIndex())
- {
- facep->setReferenceIndex(mReferences.size());
- mReferences.push_back(facep);
- }
+ if (-1 == facep->getReferenceIndex())
+ {
+ facep->setReferenceIndex(mReferences.size());
+ mReferences.push_back(facep);
+ }
}
void LLFacePool::pushFaceGeometry()
@@ -330,47 +330,47 @@ void LLFacePool::pushFaceGeometry()
BOOL LLFacePool::verify() const
{
- BOOL ok = TRUE;
-
- for (std::vector<LLFace*>::const_iterator iter = mDrawFace.begin();
- iter != mDrawFace.end(); iter++)
- {
- const LLFace* facep = *iter;
- if (facep->getPool() != this)
- {
- LL_INFOS() << "Face in wrong pool!" << LL_ENDL;
- facep->printDebugInfo();
- ok = FALSE;
- }
- else if (!facep->verify())
- {
- ok = FALSE;
- }
- }
-
- return ok;
+ BOOL ok = TRUE;
+
+ for (std::vector<LLFace*>::const_iterator iter = mDrawFace.begin();
+ iter != mDrawFace.end(); iter++)
+ {
+ const LLFace* facep = *iter;
+ if (facep->getPool() != this)
+ {
+ LL_INFOS() << "Face in wrong pool!" << LL_ENDL;
+ facep->printDebugInfo();
+ ok = FALSE;
+ }
+ else if (!facep->verify())
+ {
+ ok = FALSE;
+ }
+ }
+
+ return ok;
}
void LLFacePool::printDebugInfo() const
{
- LL_INFOS() << "Pool " << this << " Type: " << getType() << LL_ENDL;
+ LL_INFOS() << "Pool " << this << " Type: " << getType() << LL_ENDL;
}
BOOL LLFacePool::LLOverrideFaceColor::sOverrideFaceColor = FALSE;
void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4& color)
{
- gGL.diffuseColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
}
void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4U& color)
{
- glColor4ubv(color.mV);
+ glColor4ubv(color.mV);
}
void LLFacePool::LLOverrideFaceColor::setColor(F32 r, F32 g, F32 b, F32 a)
{
- gGL.diffuseColor4f(r,g,b,a);
+ gGL.diffuseColor4f(r,g,b,a);
}
@@ -391,16 +391,16 @@ LLRenderPass::~LLRenderPass()
void LLRenderPass::renderGroup(LLSpatialGroup* group, U32 type, bool texture)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
+ LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
- for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
- {
- LLDrawInfo *pparams = *k;
- if (pparams)
+ for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
+ {
+ LLDrawInfo *pparams = *k;
+ if (pparams)
{
pushBatch(*pparams, texture);
- }
- }
+ }
+ }
}
void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, bool texture)
@@ -409,11 +409,11 @@ void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, bool textu
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
-
+
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
{
LLDrawInfo* pparams = *k;
- if (pparams)
+ if (pparams)
{
if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)
{
@@ -465,7 +465,7 @@ void LLRenderPass::pushUntexturedBatches(U32 type)
void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
-
+
if (texture)
{
LLVOAvatar* lastAvatar = nullptr;
@@ -521,13 +521,13 @@ void LLRenderPass::pushMaskBatches(U32 type, bool texture, bool batch_textures)
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
- for (LLCullResult::drawinfo_iterator i = begin; i != end; )
- {
+ for (LLCullResult::drawinfo_iterator i = begin; i != end; )
+ {
LLDrawInfo* pparams = *i;
LLCullResult::increment_iterator(i, end);
- LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff);
- pushBatch(*pparams, texture, batch_textures);
- }
+ LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff);
+ pushBatch(*pparams, texture, batch_textures);
+ }
}
void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_textures)
@@ -567,17 +567,17 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_text
void LLRenderPass::applyModelMatrix(const LLDrawInfo& params)
{
- if (params.mModelMatrix != gGLLastMatrix)
- {
- gGLLastMatrix = params.mModelMatrix;
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.loadMatrix(gGLModelView);
- if (params.mModelMatrix)
- {
- gGL.multMatrix((GLfloat*) params.mModelMatrix->mMatrix);
- }
- gPipeline.mMatrixOpCount++;
- }
+ if (params.mModelMatrix != gGLLastMatrix)
+ {
+ gGLLastMatrix = params.mModelMatrix;
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.loadMatrix(gGLModelView);
+ if (params.mModelMatrix)
+ {
+ gGL.multMatrix((GLfloat*) params.mModelMatrix->mMatrix);
+ }
+ gPipeline.mMatrixOpCount++;
+ }
}
void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textures)
@@ -590,51 +590,51 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textur
return;
}
- applyModelMatrix(params);
-
- bool tex_setup = false;
-
- {
- if (batch_textures && params.mTextureList.size() > 1)
- {
- for (U32 i = 0; i < params.mTextureList.size(); ++i)
- {
- if (params.mTextureList[i].notNull())
- {
- gGL.getTexUnit(i)->bindFast(params.mTextureList[i]);
- }
- }
- }
- else
- { //not batching textures or batch has only 1 texture -- might need a texture matrix
- if (params.mTexture.notNull())
- {
- gGL.getTexUnit(0)->bindFast(params.mTexture);
- if (params.mTextureMatrix)
- {
- tex_setup = true;
- gGL.getTexUnit(0)->activate();
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
- gPipeline.mTextureMatrixOps++;
- }
- }
- else
- {
- gGL.getTexUnit(0)->unbindFast(LLTexUnit::TT_TEXTURE);
- }
- }
- }
-
+ applyModelMatrix(params);
+
+ bool tex_setup = false;
+
+ {
+ if (batch_textures && params.mTextureList.size() > 1)
+ {
+ for (U32 i = 0; i < params.mTextureList.size(); ++i)
+ {
+ if (params.mTextureList[i].notNull())
+ {
+ gGL.getTexUnit(i)->bindFast(params.mTextureList[i]);
+ }
+ }
+ }
+ else
+ { //not batching textures or batch has only 1 texture -- might need a texture matrix
+ if (params.mTexture.notNull())
+ {
+ gGL.getTexUnit(0)->bindFast(params.mTexture);
+ if (params.mTextureMatrix)
+ {
+ tex_setup = true;
+ gGL.getTexUnit(0)->activate();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
+ gPipeline.mTextureMatrixOps++;
+ }
+ }
+ else
+ {
+ gGL.getTexUnit(0)->unbindFast(LLTexUnit::TT_TEXTURE);
+ }
+ }
+ }
+
params.mVertexBuffer->setBuffer();
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
- if (tex_setup)
- {
+ if (tex_setup)
+ {
gGL.matrixMode(LLRender::MM_TEXTURE0);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- }
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ }
}
void LLRenderPass::pushUntexturedBatch(LLDrawInfo& params)
diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h
index 0925a01439..7e5e6f2b17 100644
--- a/indra/newview/lldrawpool.h
+++ b/indra/newview/lldrawpool.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpool.h
* @brief LLDrawPool class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,87 +43,87 @@ class LLMeshSkinInfo;
class LLDrawPool
{
public:
- static S32 sNumDrawPools;
+ static S32 sNumDrawPools;
- enum
- {
- // Correspond to LLPipeline render type
+ enum
+ {
+ // Correspond to LLPipeline render type
// Also controls render order, so passes that don't use alpha masking/blending should come before
// other passes to preserve hierarchical Z for occlusion queries. Occlusion queries happen just
// before grass, so grass should be the first alpha masked pool. Other ordering should be done
// based on fill rate and likelihood to occlude future passes (faster, large occluders first).
- //
+ //
POOL_SKY = 1,
POOL_WL_SKY,
- POOL_SIMPLE,
- POOL_FULLBRIGHT,
- POOL_BUMP,
- POOL_TERRAIN,
+ POOL_SIMPLE,
+ POOL_FULLBRIGHT,
+ POOL_BUMP,
+ POOL_TERRAIN,
POOL_MATERIALS,
POOL_GLTF_PBR,
POOL_GRASS,
POOL_GLTF_PBR_ALPHA_MASK,
- POOL_TREE,
- POOL_ALPHA_MASK,
- POOL_FULLBRIGHT_ALPHA_MASK,
- POOL_AVATAR,
- POOL_CONTROL_AV, // Animesh
- POOL_GLOW,
- POOL_ALPHA_PRE_WATER,
+ POOL_TREE,
+ POOL_ALPHA_MASK,
+ POOL_FULLBRIGHT_ALPHA_MASK,
+ POOL_AVATAR,
+ POOL_CONTROL_AV, // Animesh
+ POOL_GLOW,
+ POOL_ALPHA_PRE_WATER,
POOL_VOIDWATER,
POOL_WATER,
POOL_ALPHA_POST_WATER,
POOL_ALPHA, // note there is no actual "POOL_ALPHA" but pre-water and post-water pools consume POOL_ALPHA faces
- NUM_POOL_TYPES,
- };
-
- LLDrawPool(const U32 type);
- virtual ~LLDrawPool();
-
- virtual BOOL isDead() = 0;
-
- S32 getId() const { return mId; }
- U32 getType() const { return mType; }
-
- BOOL getSkipRenderFlag() const { return mSkipRender;}
- void setSkipRenderFlag( BOOL flag ) { mSkipRender = flag; }
-
- virtual LLViewerTexture *getDebugTexture();
- virtual void beginRenderPass( S32 pass );
- virtual void endRenderPass( S32 pass );
- virtual S32 getNumPasses();
-
- virtual void beginDeferredPass(S32 pass);
- virtual void endDeferredPass(S32 pass);
- virtual S32 getNumDeferredPasses();
- virtual void renderDeferred(S32 pass = 0);
-
- virtual void beginPostDeferredPass(S32 pass);
- virtual void endPostDeferredPass(S32 pass);
- virtual S32 getNumPostDeferredPasses();
- virtual void renderPostDeferred(S32 pass = 0);
-
- virtual void beginShadowPass(S32 pass);
- virtual void endShadowPass(S32 pass);
- virtual S32 getNumShadowPasses();
- virtual void renderShadow(S32 pass = 0);
+ NUM_POOL_TYPES,
+ };
+
+ LLDrawPool(const U32 type);
+ virtual ~LLDrawPool();
+
+ virtual BOOL isDead() = 0;
+
+ S32 getId() const { return mId; }
+ U32 getType() const { return mType; }
+
+ BOOL getSkipRenderFlag() const { return mSkipRender;}
+ void setSkipRenderFlag( BOOL flag ) { mSkipRender = flag; }
+
+ virtual LLViewerTexture *getDebugTexture();
+ virtual void beginRenderPass( S32 pass );
+ virtual void endRenderPass( S32 pass );
+ virtual S32 getNumPasses();
+
+ virtual void beginDeferredPass(S32 pass);
+ virtual void endDeferredPass(S32 pass);
+ virtual S32 getNumDeferredPasses();
+ virtual void renderDeferred(S32 pass = 0);
+
+ virtual void beginPostDeferredPass(S32 pass);
+ virtual void endPostDeferredPass(S32 pass);
+ virtual S32 getNumPostDeferredPasses();
+ virtual void renderPostDeferred(S32 pass = 0);
+
+ virtual void beginShadowPass(S32 pass);
+ virtual void endShadowPass(S32 pass);
+ virtual S32 getNumShadowPasses();
+ virtual void renderShadow(S32 pass = 0);
virtual void render(S32 pass = 0) {};
virtual void prerender() {};
virtual U32 getVertexDataMask() { return 0; } // DEPRECATED -- draw pool doesn't actually determine vertex data mask any more
- virtual BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct!
- virtual S32 getShaderLevel() const { return mShaderLevel; }
-
- static LLDrawPool* createPool(const U32 type, LLViewerTexture *tex0 = NULL);
- virtual LLViewerTexture* getTexture() = 0;
- virtual BOOL isFacePool() { return FALSE; }
- virtual void resetDrawOrders() = 0;
+ virtual BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct!
+ virtual S32 getShaderLevel() const { return mShaderLevel; }
+
+ static LLDrawPool* createPool(const U32 type, LLViewerTexture *tex0 = NULL);
+ virtual LLViewerTexture* getTexture() = 0;
+ virtual BOOL isFacePool() { return FALSE; }
+ virtual void resetDrawOrders() = 0;
virtual void pushFaceGeometry() {}
- S32 mShaderLevel;
- S32 mId;
- U32 mType; // Type of draw pool
- BOOL mSkipRender;
+ S32 mShaderLevel;
+ S32 mId;
+ U32 mType; // Type of draw pool
+ BOOL mSkipRender;
};
class LLRenderPass : public LLDrawPool
@@ -132,77 +132,77 @@ public:
// list of possible LLRenderPass types to assign a render batch to
// NOTE: "rigged" variant MUST be non-rigged variant + 1
// see LLVolumeGeometryManager::registerFace()
- enum
- {
- PASS_SIMPLE = NUM_POOL_TYPES,
+ enum
+ {
+ PASS_SIMPLE = NUM_POOL_TYPES,
PASS_SIMPLE_RIGGED,
- PASS_GRASS,
- PASS_FULLBRIGHT,
+ PASS_GRASS,
+ PASS_FULLBRIGHT,
PASS_FULLBRIGHT_RIGGED,
- PASS_INVISIBLE,
+ PASS_INVISIBLE,
PASS_INVISIBLE_RIGGED,
- PASS_INVISI_SHINY,
+ PASS_INVISI_SHINY,
PASS_INVISI_SHINY_RIGGED,
- PASS_FULLBRIGHT_SHINY,
+ PASS_FULLBRIGHT_SHINY,
PASS_FULLBRIGHT_SHINY_RIGGED,
- PASS_SHINY,
+ PASS_SHINY,
PASS_SHINY_RIGGED,
- PASS_BUMP,
+ PASS_BUMP,
PASS_BUMP_RIGGED,
- PASS_POST_BUMP,
+ PASS_POST_BUMP,
PASS_POST_BUMP_RIGGED,
- PASS_MATERIAL,
+ PASS_MATERIAL,
PASS_MATERIAL_RIGGED,
- PASS_MATERIAL_ALPHA,
+ PASS_MATERIAL_ALPHA,
PASS_MATERIAL_ALPHA_RIGGED,
- PASS_MATERIAL_ALPHA_MASK, // Diffuse texture used as alpha mask
+ PASS_MATERIAL_ALPHA_MASK, // Diffuse texture used as alpha mask
PASS_MATERIAL_ALPHA_MASK_RIGGED,
- PASS_MATERIAL_ALPHA_EMISSIVE,
+ PASS_MATERIAL_ALPHA_EMISSIVE,
PASS_MATERIAL_ALPHA_EMISSIVE_RIGGED,
- PASS_SPECMAP,
+ PASS_SPECMAP,
PASS_SPECMAP_RIGGED,
- PASS_SPECMAP_BLEND,
+ PASS_SPECMAP_BLEND,
PASS_SPECMAP_BLEND_RIGGED,
- PASS_SPECMAP_MASK, // Diffuse texture used as alpha mask and specular texture(map)
+ PASS_SPECMAP_MASK, // Diffuse texture used as alpha mask and specular texture(map)
PASS_SPECMAP_MASK_RIGGED,
- PASS_SPECMAP_EMISSIVE,
+ PASS_SPECMAP_EMISSIVE,
PASS_SPECMAP_EMISSIVE_RIGGED,
- PASS_NORMMAP,
+ PASS_NORMMAP,
PASS_NORMMAP_RIGGED,
- PASS_NORMMAP_BLEND,
+ PASS_NORMMAP_BLEND,
PASS_NORMMAP_BLEND_RIGGED,
- PASS_NORMMAP_MASK, // Diffuse texture used as alpha mask and normal map
+ PASS_NORMMAP_MASK, // Diffuse texture used as alpha mask and normal map
PASS_NORMMAP_MASK_RIGGED,
- PASS_NORMMAP_EMISSIVE,
+ PASS_NORMMAP_EMISSIVE,
PASS_NORMMAP_EMISSIVE_RIGGED,
- PASS_NORMSPEC,
+ PASS_NORMSPEC,
PASS_NORMSPEC_RIGGED,
- PASS_NORMSPEC_BLEND,
+ PASS_NORMSPEC_BLEND,
PASS_NORMSPEC_BLEND_RIGGED,
- PASS_NORMSPEC_MASK, // Diffuse texture used as alpha mask with normal and specular map
+ PASS_NORMSPEC_MASK, // Diffuse texture used as alpha mask with normal and specular map
PASS_NORMSPEC_MASK_RIGGED,
- PASS_NORMSPEC_EMISSIVE,
+ PASS_NORMSPEC_EMISSIVE,
PASS_NORMSPEC_EMISSIVE_RIGGED,
- PASS_GLOW,
+ PASS_GLOW,
PASS_GLOW_RIGGED,
PASS_GLTF_GLOW,
PASS_GLTF_GLOW_RIGGED,
- PASS_ALPHA,
+ PASS_ALPHA,
PASS_ALPHA_RIGGED,
- PASS_ALPHA_MASK,
+ PASS_ALPHA_MASK,
PASS_ALPHA_MASK_RIGGED,
- PASS_FULLBRIGHT_ALPHA_MASK, // Diffuse texture used as alpha mask and fullbright
+ PASS_FULLBRIGHT_ALPHA_MASK, // Diffuse texture used as alpha mask and fullbright
PASS_FULLBRIGHT_ALPHA_MASK_RIGGED,
- PASS_ALPHA_INVISIBLE,
+ PASS_ALPHA_INVISIBLE,
PASS_ALPHA_INVISIBLE_RIGGED,
PASS_GLTF_PBR,
PASS_GLTF_PBR_RIGGED,
PASS_GLTF_PBR_ALPHA_MASK,
PASS_GLTF_PBR_ALPHA_MASK_RIGGED,
- NUM_RENDER_TYPES,
- };
+ NUM_RENDER_TYPES,
+ };
- #ifdef LL_PROFILER_ENABLE_RENDER_DOC
+ #ifdef LL_PROFILER_ENABLE_RENDER_DOC
static inline const char* lookupPassName(U32 pass)
{
switch (pass)
@@ -336,22 +336,22 @@ public:
default:
return "Unknown pass";
}
- }
- #else
+ }
+ #else
static inline const char* lookupPass(U32 pass) { return ""; }
- #endif
+ #endif
- LLRenderPass(const U32 type);
- virtual ~LLRenderPass();
- /*virtual*/ LLViewerTexture* getDebugTexture() { return NULL; }
- LLViewerTexture* getTexture() { return NULL; }
- BOOL isDead() { return FALSE; }
- void resetDrawOrders() { }
+ LLRenderPass(const U32 type);
+ virtual ~LLRenderPass();
+ /*virtual*/ LLViewerTexture* getDebugTexture() { return NULL; }
+ LLViewerTexture* getTexture() { return NULL; }
+ BOOL isDead() { return FALSE; }
+ void resetDrawOrders() { }
- static void applyModelMatrix(const LLDrawInfo& params);
+ static void applyModelMatrix(const LLDrawInfo& params);
// Use before a non-GLTF batch if it is interleaved with GLTF batches that share the same shader
static void resetGLTFTextureTransform();
- void pushBatches(U32 type, bool texture = true, bool batch_textures = false);
+ void pushBatches(U32 type, bool texture = true, bool batch_textures = false);
void pushUntexturedBatches(U32 type);
void pushRiggedBatches(U32 type, bool texture = true, bool batch_textures = false);
@@ -379,104 +379,104 @@ public:
void pushUntexturedGLTFBatch(LLDrawInfo& params);
void pushUntexturedRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId);
- void pushMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
+ void pushMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
void pushRiggedMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
- void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false);
+ void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false);
void pushUntexturedBatch(LLDrawInfo& params);
- void pushBumpBatch(LLDrawInfo& params, bool texture, bool batch_textures = false);
+ void pushBumpBatch(LLDrawInfo& params, bool texture, bool batch_textures = false);
static bool uploadMatrixPalette(LLDrawInfo& params);
static bool uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo);
- virtual void renderGroup(LLSpatialGroup* group, U32 type, bool texture = true);
+ virtual void renderGroup(LLSpatialGroup* group, U32 type, bool texture = true);
virtual void renderRiggedGroup(LLSpatialGroup* group, U32 type, bool texture = true);
};
class LLFacePool : public LLDrawPool
{
public:
- typedef std::vector<LLFace*> face_array_t;
-
- enum
- {
- SHADER_LEVEL_SCATTERING = 2
- };
+ typedef std::vector<LLFace*> face_array_t;
+
+ enum
+ {
+ SHADER_LEVEL_SCATTERING = 2
+ };
public:
- LLFacePool(const U32 type);
- virtual ~LLFacePool();
-
- BOOL isDead() { return mReferences.empty(); }
-
- virtual LLViewerTexture *getTexture();
- virtual void dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures);
+ LLFacePool(const U32 type);
+ virtual ~LLFacePool();
+
+ BOOL isDead() { return mReferences.empty(); }
+
+ virtual LLViewerTexture *getTexture();
+ virtual void dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures);
+
+ virtual void enqueue(LLFace *face);
+ virtual BOOL addFace(LLFace *face);
+ virtual BOOL removeFace(LLFace *face);
- virtual void enqueue(LLFace *face);
- virtual BOOL addFace(LLFace *face);
- virtual BOOL removeFace(LLFace *face);
+ virtual BOOL verify() const; // Verify that all data in the draw pool is correct!
- virtual BOOL verify() const; // Verify that all data in the draw pool is correct!
-
- virtual void resetDrawOrders();
- void resetAll();
+ virtual void resetDrawOrders();
+ void resetAll();
- void destroy();
+ void destroy();
- void buildEdges();
+ void buildEdges();
- void addFaceReference(LLFace *facep);
- void removeFaceReference(LLFace *facep);
+ void addFaceReference(LLFace *facep);
+ void removeFaceReference(LLFace *facep);
- void printDebugInfo() const;
-
- BOOL isFacePool() { return TRUE; }
+ void printDebugInfo() const;
+
+ BOOL isFacePool() { return TRUE; }
// call drawIndexed on every draw face
void pushFaceGeometry();
- friend class LLFace;
- friend class LLPipeline;
+ friend class LLFace;
+ friend class LLPipeline;
public:
- face_array_t mDrawFace;
- face_array_t mMoveFace;
- face_array_t mReferences;
+ face_array_t mDrawFace;
+ face_array_t mMoveFace;
+ face_array_t mReferences;
public:
- class LLOverrideFaceColor
- {
- public:
- LLOverrideFaceColor(LLDrawPool* pool)
- : mOverride(sOverrideFaceColor), mPool(pool)
- {
- sOverrideFaceColor = TRUE;
- }
- LLOverrideFaceColor(LLDrawPool* pool, const LLColor4& color)
- : mOverride(sOverrideFaceColor), mPool(pool)
- {
- sOverrideFaceColor = TRUE;
- setColor(color);
- }
- LLOverrideFaceColor(LLDrawPool* pool, const LLColor4U& color)
- : mOverride(sOverrideFaceColor), mPool(pool)
- {
- sOverrideFaceColor = TRUE;
- setColor(color);
- }
- LLOverrideFaceColor(LLDrawPool* pool, F32 r, F32 g, F32 b, F32 a)
- : mOverride(sOverrideFaceColor), mPool(pool)
- {
- sOverrideFaceColor = TRUE;
- setColor(r, g, b, a);
- }
- ~LLOverrideFaceColor()
- {
- sOverrideFaceColor = mOverride;
- }
- void setColor(const LLColor4& color);
- void setColor(const LLColor4U& color);
- void setColor(F32 r, F32 g, F32 b, F32 a);
- BOOL mOverride;
- LLDrawPool* mPool;
- static BOOL sOverrideFaceColor;
- };
+ class LLOverrideFaceColor
+ {
+ public:
+ LLOverrideFaceColor(LLDrawPool* pool)
+ : mOverride(sOverrideFaceColor), mPool(pool)
+ {
+ sOverrideFaceColor = TRUE;
+ }
+ LLOverrideFaceColor(LLDrawPool* pool, const LLColor4& color)
+ : mOverride(sOverrideFaceColor), mPool(pool)
+ {
+ sOverrideFaceColor = TRUE;
+ setColor(color);
+ }
+ LLOverrideFaceColor(LLDrawPool* pool, const LLColor4U& color)
+ : mOverride(sOverrideFaceColor), mPool(pool)
+ {
+ sOverrideFaceColor = TRUE;
+ setColor(color);
+ }
+ LLOverrideFaceColor(LLDrawPool* pool, F32 r, F32 g, F32 b, F32 a)
+ : mOverride(sOverrideFaceColor), mPool(pool)
+ {
+ sOverrideFaceColor = TRUE;
+ setColor(r, g, b, a);
+ }
+ ~LLOverrideFaceColor()
+ {
+ sOverrideFaceColor = mOverride;
+ }
+ void setColor(const LLColor4& color);
+ void setColor(const LLColor4U& color);
+ void setColor(F32 r, F32 g, F32 b, F32 a);
+ BOOL mOverride;
+ LLDrawPool* mPool;
+ static BOOL sOverrideFaceColor;
+ };
};
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 41dc95a8cb..bc177ddd99 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolalpha.cpp
* @brief LLDrawPoolAlpha class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,7 +39,7 @@
#include "lldrawable.h"
#include "llface.h"
#include "llviewercamera.h"
-#include "llviewertexturelist.h" // For debugging
+#include "llviewertexturelist.h" // For debugging
#include "llviewerobjectlist.h" // For debugging
#include "llviewerwindow.h"
#include "pipeline.h"
@@ -65,11 +65,11 @@ static const F32 MINIMUM_ALPHA = 0.004f; // ~ 1/255
static const F32 MINIMUM_IMPOSTOR_ALPHA = 0.1f;
LLDrawPoolAlpha::LLDrawPoolAlpha(U32 type) :
- LLRenderPass(type), target_shader(NULL),
- mColorSFactor(LLRender::BF_UNDEF), mColorDFactor(LLRender::BF_UNDEF),
- mAlphaSFactor(LLRender::BF_UNDEF), mAlphaDFactor(LLRender::BF_UNDEF)
+ LLRenderPass(type), target_shader(NULL),
+ mColorSFactor(LLRender::BF_UNDEF), mColorDFactor(LLRender::BF_UNDEF),
+ mAlphaSFactor(LLRender::BF_UNDEF), mAlphaDFactor(LLRender::BF_UNDEF)
{
-
+
}
LLDrawPoolAlpha::~LLDrawPoolAlpha()
@@ -79,15 +79,15 @@ LLDrawPoolAlpha::~LLDrawPoolAlpha()
void LLDrawPoolAlpha::prerender()
{
- mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
+ mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
// TODO: is this even necessay? These are probably set to never discard
LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(1024.f*1024.f);
LLViewerFetchedTexture::sWhiteImagep->addTextureStats(1024.f * 1024.f);
}
-S32 LLDrawPoolAlpha::getNumPostDeferredPasses()
-{
+S32 LLDrawPoolAlpha::getNumPostDeferredPasses()
+{
return 1;
}
@@ -107,7 +107,7 @@ static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma, bool d
{
shader->mCanBindFast = false;
}
-
+
shader->bind();
shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f / 2.2f));
@@ -138,15 +138,15 @@ static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma, bool d
//also prepare rigged variant
if (shader->mRiggedVariant && shader->mRiggedVariant != shader)
- {
+ {
prepare_alpha_shader(shader->mRiggedVariant, textureGamma, deferredEnvironment, water_sign);
}
}
extern BOOL gCubeSnapshot;
-void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
-{
+void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
+{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
if (LLPipeline::isWaterClip() && getType() == LLDrawPool::POOL_ALPHA_PRE_WATER)
@@ -176,13 +176,13 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
prepare_alpha_shader(pbr_emissive_shader, true, false, water_sign);
- fullbright_shader =
+ fullbright_shader =
(LLPipeline::sImpostorRender) ? &gDeferredFullbrightAlphaMaskProgram :
(LLPipeline::sRenderingHUDs) ? &gHUDFullbrightAlphaMaskAlphaProgram :
&gDeferredFullbrightAlphaMaskAlphaProgram;
prepare_alpha_shader(fullbright_shader, true, true, water_sign);
- simple_shader =
+ simple_shader =
(LLPipeline::sImpostorRender) ? &gDeferredAlphaImpostorProgram :
(LLPipeline::sRenderingHUDs) ? &gHUDAlphaProgram :
&gDeferredAlphaProgram;
@@ -195,8 +195,8 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
prepare_alpha_shader(&materialShader[i], false, true, water_sign);
}
- pbr_shader =
- (LLPipeline::sRenderingHUDs) ? &gHUDPBRAlphaProgram :
+ pbr_shader =
+ (LLPipeline::sRenderingHUDs) ? &gHUDPBRAlphaProgram :
&gDeferredPBRAlphaProgram;
prepare_alpha_shader(pbr_shader, false, true, water_sign);
@@ -216,7 +216,7 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
// final pass, render to depth for depth of field effects
if (!LLPipeline::sImpostorRender && gSavedSettings.getBOOL("RenderDepthOfField") && !gCubeSnapshot && !LLPipeline::sRenderingHUDs && getType() == LLDrawPool::POOL_ALPHA_POST_WATER)
- {
+ {
//update depth buffer sampler
simple_shader = fullbright_shader = &gDeferredFullbrightAlphaMaskProgram;
@@ -228,7 +228,7 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
// If the face is more than 90% transparent, then don't update the Depth buffer for Dof
// We don't want the nearly invisible objects to cause of DoF effects
- renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2,
+ renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2,
true); // <--- discard mostly transparent faces
gGL.setColorMask(true, false);
@@ -277,8 +277,8 @@ void LLDrawPoolAlpha::forwardRender(bool rigged)
void LLDrawPoolAlpha::renderDebugAlpha()
{
- if (sShowDebugAlpha)
- {
+ if (sShowDebugAlpha)
+ {
gHighlightProgram.bind();
gGL.diffuseColor4f(1, 0, 0, 1);
gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::getSmokeImage());
@@ -286,19 +286,19 @@ void LLDrawPoolAlpha::renderDebugAlpha()
renderAlphaHighlight();
- pushUntexturedBatches(LLRenderPass::PASS_ALPHA_MASK);
- pushUntexturedBatches(LLRenderPass::PASS_ALPHA_INVISIBLE);
+ pushUntexturedBatches(LLRenderPass::PASS_ALPHA_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_ALPHA_INVISIBLE);
- // Material alpha mask
- gGL.diffuseColor4f(0, 0, 1, 1);
- pushUntexturedBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK);
- pushUntexturedBatches(LLRenderPass::PASS_NORMMAP_MASK);
- pushUntexturedBatches(LLRenderPass::PASS_SPECMAP_MASK);
- pushUntexturedBatches(LLRenderPass::PASS_NORMSPEC_MASK);
- pushUntexturedBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
+ // Material alpha mask
+ gGL.diffuseColor4f(0, 0, 1, 1);
+ pushUntexturedBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_NORMMAP_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_SPECMAP_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_NORMSPEC_MASK);
+ pushUntexturedBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
pushUntexturedBatches(LLRenderPass::PASS_GLTF_PBR_ALPHA_MASK);
- gGL.diffuseColor4f(0, 1, 0, 1);
+ gGL.diffuseColor4f(0, 1, 0, 1);
pushUntexturedBatches(LLRenderPass::PASS_INVISIBLE);
gHighlightProgram.mRiggedVariant->bind();
@@ -319,7 +319,7 @@ void LLDrawPoolAlpha::renderDebugAlpha()
gGL.diffuseColor4f(0, 1, 0, 1);
pushRiggedBatches(LLRenderPass::PASS_INVISIBLE_RIGGED, false);
LLGLSLShader::sCurBoundShaderPtr->unbind();
- }
+ }
}
void LLDrawPoolAlpha::renderAlphaHighlight()
@@ -338,7 +338,7 @@ void LLDrawPoolAlpha::renderAlphaHighlight()
if (group->getSpatialPartition()->mRenderByGroup &&
!group->isDead())
{
- LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA+pass]; // <-- hacky + pass to use PASS_ALPHA_RIGGED on second pass
+ LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA+pass]; // <-- hacky + pass to use PASS_ALPHA_RIGGED on second pass
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
{
@@ -393,7 +393,7 @@ inline void Draw(LLDrawInfo* draw, U32 mask)
{
draw->mVertexBuffer->setBuffer();
LLRenderPass::applyModelMatrix(*draw);
- draw->mVertexBuffer->drawRange(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset);
+ draw->mVertexBuffer->drawRange(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset);
}
bool LLDrawPoolAlpha::TexSetup(LLDrawInfo* draw, bool use_material)
@@ -468,26 +468,26 @@ bool LLDrawPoolAlpha::TexSetup(LLDrawInfo* draw, bool use_material)
}
}
}
-
+
return tex_setup;
}
void LLDrawPoolAlpha::RestoreTexSetup(bool tex_setup)
{
if (tex_setup)
- {
- gGL.getTexUnit(0)->activate();
+ {
+ gGL.getTexUnit(0)->activate();
gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- }
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ }
}
void LLDrawPoolAlpha::drawEmissive(LLDrawInfo* draw)
{
LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, 1.f);
draw->mVertexBuffer->setBuffer();
- draw->mVertexBuffer->drawRange(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset);
+ draw->mVertexBuffer->drawRange(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset);
}
@@ -551,7 +551,7 @@ void LLDrawPoolAlpha::renderRiggedPbrEmissives(std::vector<LLDrawInfo*>& emissiv
{
LLGLDepthTest depth(GL_TRUE, GL_FALSE); //disable depth writes since "emissive" is additive so sorting doesn't matter
pbr_emissive_shader->bind(true);
-
+
LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
@@ -578,7 +578,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
BOOL initialized_lighting = FALSE;
- BOOL light_enabled = TRUE;
+ BOOL light_enabled = TRUE;
LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
@@ -597,7 +597,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
begin = gPipeline.beginAlphaGroups();
end = gPipeline.endAlphaGroups();
}
-
+
LLEnvironment& env = LLEnvironment::instance();
F32 water_height = env.getWaterHeight();
@@ -609,15 +609,15 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
for (LLCullResult::sg_iterator i = begin; i != end; ++i)
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("renderAlpha - group");
- LLSpatialGroup* group = *i;
- llassert(group);
- llassert(group->getSpatialPartition());
+ LLSpatialGroup* group = *i;
+ llassert(group);
+ llassert(group->getSpatialPartition());
- if (group->getSpatialPartition()->mRenderByGroup &&
- !group->isDead())
- {
+ if (group->getSpatialPartition()->mRenderByGroup &&
+ !group->isDead())
+ {
LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge();
const LLVector4a* ext = bridge ? bridge->getSpatialExtents() : group->getExtents();
@@ -650,17 +650,17 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
pbr_emissives.resize(0);
pbr_rigged_emissives.resize(0);
- bool is_particle_or_hud_particle = group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_PARTICLE
- || group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE;
+ bool is_particle_or_hud_particle = group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_PARTICLE
+ || group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE;
- bool disable_cull = is_particle_or_hud_particle;
- LLGLDisable cull(disable_cull ? GL_CULL_FACE : 0);
+ bool disable_cull = is_particle_or_hud_particle;
+ LLGLDisable cull(disable_cull ? GL_CULL_FACE : 0);
- LLSpatialGroup::drawmap_elem_t& draw_info = rigged ? group->mDrawMap[LLRenderPass::PASS_ALPHA_RIGGED] : group->mDrawMap[LLRenderPass::PASS_ALPHA];
+ LLSpatialGroup::drawmap_elem_t& draw_info = rigged ? group->mDrawMap[LLRenderPass::PASS_ALPHA_RIGGED] : group->mDrawMap[LLRenderPass::PASS_ALPHA];
- for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
- {
- LLDrawInfo& params = **k;
+ for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
+ {
+ LLDrawInfo& params = **k;
if ((bool)params.mAvatar != rigged)
{
continue;
@@ -671,7 +671,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
LLRenderPass::applyModelMatrix(params);
LLMaterial* mat = NULL;
- LLGLTFMaterial *gltf_mat = params.mGLTFMaterial;
+ LLGLTFMaterial *gltf_mat = params.mGLTFMaterial;
LLGLDisable cull_face(gltf_mat && gltf_mat->mDoubleSided ? GL_CULL_FACE : 0);
@@ -793,8 +793,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
bool tex_setup = TexSetup(&params, (mat != nullptr));
- {
- gGL.blendFunc((LLRender::eBlendFactor) params.mBlendFuncSrc, (LLRender::eBlendFactor) params.mBlendFuncDst, mAlphaSFactor, mAlphaDFactor);
+ {
+ gGL.blendFunc((LLRender::eBlendFactor) params.mBlendFuncSrc, (LLRender::eBlendFactor) params.mBlendFuncDst, mAlphaSFactor, mAlphaDFactor);
bool reset_minimum_alpha = false;
if (!LLPipeline::sImpostorRender &&
@@ -804,7 +804,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
current_shader->setMinimumAlpha(0.f);
reset_minimum_alpha = true;
}
-
+
params.mVertexBuffer->setBuffer();
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
@@ -812,12 +812,12 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
{
current_shader->setMinimumAlpha(MINIMUM_ALPHA);
}
- }
+ }
- // If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls is expensive, but glow must be drawn Z-sorted with alpha.
- if (getType() != LLDrawPool::POOL_ALPHA_PRE_WATER &&
- params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
- {
+ // If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls is expensive, but glow must be drawn Z-sorted with alpha.
+ if (getType() != LLDrawPool::POOL_ALPHA_PRE_WATER &&
+ params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
+ {
if (params.mAvatar != nullptr)
{
if (params.mGLTFMaterial.isNull())
@@ -840,16 +840,16 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
pbr_emissives.push_back(&params);
}
}
- }
-
- if (tex_setup)
- {
- gGL.getTexUnit(0)->activate();
+ }
+
+ if (tex_setup)
+ {
+ gGL.getTexUnit(0)->activate();
gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- }
- }
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ }
+ }
// render emissive faces into alpha channel for bloom effects
if (!depth_only)
@@ -898,17 +898,17 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
lastShader->bind();
}
}
- }
- }
+ }
+ }
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
- LLVertexBuffer::unbind();
+ LLVertexBuffer::unbind();
- if (!light_enabled)
- {
- gPipeline.enableLightsDynamic();
- }
+ if (!light_enabled)
+ {
+ gPipeline.enableLightsDynamic();
+ }
}
bool LLDrawPoolAlpha::uploadMatrixPalette(const LLDrawInfo& params)
diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h
index 820c4f4e68..a968149a22 100644
--- a/indra/newview/lldrawpoolalpha.h
+++ b/indra/newview/lldrawpoolalpha.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolalpha.h
* @brief LLDrawPoolAlpha class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,36 +42,36 @@ public:
// set by llsettingsvo so lldrawpoolalpha has quick access to the water plane in eye space
static LLVector4 sWaterPlane;
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
- LLVertexBuffer::MAP_COLOR |
- LLVertexBuffer::MAP_TEXCOORD0
- };
- virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_NORMAL |
+ LLVertexBuffer::MAP_COLOR |
+ LLVertexBuffer::MAP_TEXCOORD0
+ };
+ virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
- LLDrawPoolAlpha(U32 type);
- /*virtual*/ ~LLDrawPoolAlpha();
+ LLDrawPoolAlpha(U32 type);
+ /*virtual*/ ~LLDrawPoolAlpha();
- /*virtual*/ S32 getNumPostDeferredPasses();
- /*virtual*/ void renderPostDeferred(S32 pass);
- /*virtual*/ S32 getNumPasses() { return 1; }
+ /*virtual*/ S32 getNumPostDeferredPasses();
+ /*virtual*/ void renderPostDeferred(S32 pass);
+ /*virtual*/ S32 getNumPasses() { return 1; }
void forwardRender(bool write_depth = false);
- /*virtual*/ void prerender();
+ /*virtual*/ void prerender();
void renderDebugAlpha();
- void renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE);
- void renderAlpha(U32 mask, bool depth_only = false, bool rigged = false);
- void renderAlphaHighlight();
+ void renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE);
+ void renderAlpha(U32 mask, bool depth_only = false, bool rigged = false);
+ void renderAlphaHighlight();
bool uploadMatrixPalette(const LLDrawInfo& params);
- static BOOL sShowDebugAlpha;
+ static BOOL sShowDebugAlpha;
private:
- LLGLSLShader* target_shader;
+ LLGLSLShader* target_shader;
// setup by beginFooPass, [0] is static variant, [1] is rigged variant
LLGLSLShader* simple_shader = nullptr;
@@ -88,11 +88,11 @@ private:
bool TexSetup(LLDrawInfo* draw, bool use_material);
void RestoreTexSetup(bool tex_setup);
- // our 'normal' alpha blend function for this pass
- LLRender::eBlendFactor mColorSFactor;
- LLRender::eBlendFactor mColorDFactor;
- LLRender::eBlendFactor mAlphaSFactor;
- LLRender::eBlendFactor mAlphaDFactor;
+ // our 'normal' alpha blend function for this pass
+ LLRender::eBlendFactor mColorSFactor;
+ LLRender::eBlendFactor mColorDFactor;
+ LLRender::eBlendFactor mAlphaSFactor;
+ LLRender::eBlendFactor mAlphaDFactor;
// if true, we're executing a rigged render pass
bool mRigged = false;
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 7f6409dbde..9581ee2e60 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolavatar.cpp
* @brief LLDrawPoolAvatar class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,8 +56,8 @@
static U32 sShaderLevel = 0;
LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL;
-BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE;
-BOOL LLDrawPoolAvatar::sSkipTransparent = FALSE;
+BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE;
+BOOL LLDrawPoolAvatar::sSkipTransparent = FALSE;
S32 LLDrawPoolAvatar::sShadowPass = -1;
S32 LLDrawPoolAvatar::sDiffuseChannel = 0;
F32 LLDrawPoolAvatar::sMinimumAlpha = 0.2f;
@@ -75,18 +75,18 @@ F32 CLOTHING_ACCEL_FORCE_FACTOR = 0.2f;
// Format for gAGPVertices
// vertex format for bumpmapping:
// vertices 12
-// pad 4
+// pad 4
// normals 12
-// pad 4
+// pad 4
// texcoords0 8
// texcoords1 8
// total 48
//
// for no bumpmapping
-// vertices 12
-// texcoords 8
-// normals 12
-// total 32
+// vertices 12
+// texcoords 8
+// normals 12
+// total 32
//
S32 AVATAR_OFFSET_POS = 0;
@@ -101,8 +101,8 @@ S32 normal_channel = -1;
S32 specular_channel = -1;
S32 cube_channel = -1;
-LLDrawPoolAvatar::LLDrawPoolAvatar(U32 type) :
- LLFacePool(type)
+LLDrawPoolAvatar::LLDrawPoolAvatar(U32 type) :
+ LLFacePool(type)
{
}
@@ -123,7 +123,7 @@ BOOL LLDrawPoolAvatar::isDead()
{
return FALSE;
}
-
+
return TRUE;
}
@@ -131,30 +131,30 @@ S32 LLDrawPoolAvatar::getShaderLevel() const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- return (S32) LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR);
+ return (S32) LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR);
}
void LLDrawPoolAvatar::prerender()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR);
-
- sShaderLevel = mShaderLevel;
+ mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR);
+
+ sShaderLevel = mShaderLevel;
}
LLMatrix4& LLDrawPoolAvatar::getModelView()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- static LLMatrix4 ret;
+ static LLMatrix4 ret;
- ret.initRows(LLVector4(gGLModelView+0),
- LLVector4(gGLModelView+4),
- LLVector4(gGLModelView+8),
- LLVector4(gGLModelView+12));
+ ret.initRows(LLVector4(gGLModelView+0),
+ LLVector4(gGLModelView+4),
+ LLVector4(gGLModelView+8),
+ LLVector4(gGLModelView+12));
- return ret;
+ return ret;
}
//-----------------------------------------------------------------------------
@@ -166,93 +166,93 @@ LLMatrix4& LLDrawPoolAvatar::getModelView()
void LLDrawPoolAvatar::beginDeferredPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
-
- sSkipTransparent = TRUE;
- is_deferred_render = true;
-
- if (LLPipeline::sImpostorRender)
- { //impostor pass does not have impostor rendering
- ++pass;
- }
-
- switch (pass)
- {
- case 0:
- beginDeferredImpostor();
- break;
- case 1:
- beginDeferredRigid();
- break;
- case 2:
- beginDeferredSkinned();
- break;
- }
+
+ sSkipTransparent = TRUE;
+ is_deferred_render = true;
+
+ if (LLPipeline::sImpostorRender)
+ { //impostor pass does not have impostor rendering
+ ++pass;
+ }
+
+ switch (pass)
+ {
+ case 0:
+ beginDeferredImpostor();
+ break;
+ case 1:
+ beginDeferredRigid();
+ break;
+ case 2:
+ beginDeferredSkinned();
+ break;
+ }
}
void LLDrawPoolAvatar::endDeferredPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- sSkipTransparent = FALSE;
- is_deferred_render = false;
+ sSkipTransparent = FALSE;
+ is_deferred_render = false;
- if (LLPipeline::sImpostorRender)
- {
- ++pass;
- }
+ if (LLPipeline::sImpostorRender)
+ {
+ ++pass;
+ }
- switch (pass)
- {
- case 0:
- endDeferredImpostor();
- break;
- case 1:
- endDeferredRigid();
- break;
- case 2:
- endDeferredSkinned();
- break;
- }
+ switch (pass)
+ {
+ case 0:
+ endDeferredImpostor();
+ break;
+ case 1:
+ endDeferredRigid();
+ break;
+ case 2:
+ endDeferredSkinned();
+ break;
+ }
}
void LLDrawPoolAvatar::renderDeferred(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- render(pass);
+ render(pass);
}
S32 LLDrawPoolAvatar::getNumPostDeferredPasses()
{
- return 1;
+ return 1;
}
void LLDrawPoolAvatar::beginPostDeferredPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- sSkipOpaque = TRUE;
- sShaderLevel = mShaderLevel;
- sVertexProgram = &gDeferredAvatarAlphaProgram;
- sRenderingSkinned = TRUE;
+ sSkipOpaque = TRUE;
+ sShaderLevel = mShaderLevel;
+ sVertexProgram = &gDeferredAvatarAlphaProgram;
+ sRenderingSkinned = TRUE;
- gPipeline.bindDeferredShader(*sVertexProgram);
+ gPipeline.bindDeferredShader(*sVertexProgram);
- sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
+ sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
- sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
}
void LLDrawPoolAvatar::endPostDeferredPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
- sRenderingSkinned = FALSE;
- sSkipOpaque = FALSE;
-
- gPipeline.unbindDeferredShader(*sVertexProgram);
- sDiffuseChannel = 0;
- sShaderLevel = mShaderLevel;
+ // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
+ sRenderingSkinned = FALSE;
+ sSkipOpaque = FALSE;
+
+ gPipeline.unbindDeferredShader(*sVertexProgram);
+ sDiffuseChannel = 0;
+ sShaderLevel = mShaderLevel;
}
void LLDrawPoolAvatar::renderPostDeferred(S32 pass)
@@ -260,43 +260,43 @@ void LLDrawPoolAvatar::renderPostDeferred(S32 pass)
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
is_post_deferred_render = true;
- if (LLPipeline::sImpostorRender)
- { //HACK for impostors so actual pass ends up being proper pass
+ if (LLPipeline::sImpostorRender)
+ { //HACK for impostors so actual pass ends up being proper pass
render(0);
- }
+ }
else
{
render(2);
- }
- is_post_deferred_render = false;
+ }
+ is_post_deferred_render = false;
}
S32 LLDrawPoolAvatar::getNumShadowPasses()
{
// avatars opaque, avatar alpha, avatar alpha mask, alpha attachments, alpha mask attachments, opaque attachments...
- return NUM_SHADOW_PASSES;
+ return NUM_SHADOW_PASSES;
}
void LLDrawPoolAvatar::beginShadowPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- if (pass == SHADOW_PASS_AVATAR_OPAQUE)
- {
- sVertexProgram = &gDeferredAvatarShadowProgram;
-
- if ((sShaderLevel > 0)) // for hardware blending
- {
- sRenderingSkinned = TRUE;
- sVertexProgram->bind();
- }
+ if (pass == SHADOW_PASS_AVATAR_OPAQUE)
+ {
+ sVertexProgram = &gDeferredAvatarShadowProgram;
+
+ if ((sShaderLevel > 0)) // for hardware blending
+ {
+ sRenderingSkinned = TRUE;
+ sVertexProgram->bind();
+ }
gGL.diffuseColor4f(1, 1, 1, 1);
- }
+ }
else if (pass == SHADOW_PASS_AVATAR_ALPHA_BLEND)
- {
- sVertexProgram = &gDeferredAvatarAlphaShadowProgram;
+ {
+ sVertexProgram = &gDeferredAvatarAlphaShadowProgram;
// bind diffuse tex so we can reference the alpha channel...
S32 loc = sVertexProgram->getUniformLocation(LLViewerShaderMgr::DIFFUSE_MAP);
@@ -304,19 +304,19 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass)
if (loc != -1)
{
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- }
+ }
- if ((sShaderLevel > 0)) // for hardware blending
- {
- sRenderingSkinned = TRUE;
- sVertexProgram->bind();
- }
+ if ((sShaderLevel > 0)) // for hardware blending
+ {
+ sRenderingSkinned = TRUE;
+ sVertexProgram->bind();
+ }
gGL.diffuseColor4f(1, 1, 1, 1);
- }
+ }
else if (pass == SHADOW_PASS_AVATAR_ALPHA_MASK)
- {
- sVertexProgram = &gDeferredAvatarAlphaMaskShadowProgram;
+ {
+ sVertexProgram = &gDeferredAvatarAlphaMaskShadowProgram;
// bind diffuse tex so we can reference the alpha channel...
S32 loc = sVertexProgram->getUniformLocation(LLViewerShaderMgr::DIFFUSE_MAP);
@@ -324,26 +324,26 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass)
if (loc != -1)
{
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- }
+ }
- if ((sShaderLevel > 0)) // for hardware blending
- {
- sRenderingSkinned = TRUE;
- sVertexProgram->bind();
- }
+ if ((sShaderLevel > 0)) // for hardware blending
+ {
+ sRenderingSkinned = TRUE;
+ sVertexProgram->bind();
+ }
gGL.diffuseColor4f(1, 1, 1, 1);
- }
+ }
}
void LLDrawPoolAvatar::endShadowPass(S32 pass)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
if (sShaderLevel > 0)
- {
- sVertexProgram->unbind();
- }
+ {
+ sVertexProgram->unbind();
+ }
sVertexProgram = NULL;
sRenderingSkinned = FALSE;
LLDrawPoolAvatar::sShadowPass = -1;
@@ -353,52 +353,52 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- if (mDrawFace.empty())
- {
- return;
- }
+ if (mDrawFace.empty())
+ {
+ return;
+ }
- const LLFace *facep = mDrawFace[0];
- if (!facep->getDrawable())
- {
- return;
- }
- LLVOAvatar *avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get();
+ const LLFace *facep = mDrawFace[0];
+ if (!facep->getDrawable())
+ {
+ return;
+ }
+ LLVOAvatar *avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get();
- if (avatarp->isDead() || avatarp->isUIAvatar() || avatarp->mDrawable.isNull())
- {
- return;
- }
+ if (avatarp->isDead() || avatarp->isUIAvatar() || avatarp->mDrawable.isNull())
+ {
+ return;
+ }
LLVOAvatar::AvatarOverallAppearance oa = avatarp->getOverallAppearance();
- BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor();
+ BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor();
// no shadows if the shadows are causing this avatar to breach the limit.
if (avatarp->isTooSlow() || impostor || (oa == LLVOAvatar::AOA_INVISIBLE))
- {
+ {
// No shadows for impostored (including jellydolled) or invisible avs.
- return;
- }
-
+ return;
+ }
+
LLDrawPoolAvatar::sShadowPass = pass;
- if (pass == SHADOW_PASS_AVATAR_OPAQUE)
- {
+ if (pass == SHADOW_PASS_AVATAR_OPAQUE)
+ {
LLDrawPoolAvatar::sSkipTransparent = true;
- avatarp->renderSkinned();
+ avatarp->renderSkinned();
LLDrawPoolAvatar::sSkipTransparent = false;
- }
+ }
else if (pass == SHADOW_PASS_AVATAR_ALPHA_BLEND)
- {
+ {
LLDrawPoolAvatar::sSkipOpaque = true;
- avatarp->renderSkinned();
+ avatarp->renderSkinned();
LLDrawPoolAvatar::sSkipOpaque = false;
- }
+ }
else if (pass == SHADOW_PASS_AVATAR_ALPHA_MASK)
- {
+ {
LLDrawPoolAvatar::sSkipOpaque = true;
- avatarp->renderSkinned();
+ avatarp->renderSkinned();
LLDrawPoolAvatar::sSkipOpaque = false;
- }
+ }
}
S32 LLDrawPoolAvatar::getNumPasses()
@@ -416,151 +416,151 @@ S32 LLDrawPoolAvatar::getNumDeferredPasses()
void LLDrawPoolAvatar::render(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- if (LLPipeline::sImpostorRender)
- {
- renderAvatars(NULL, ++pass);
- return;
- }
+ if (LLPipeline::sImpostorRender)
+ {
+ renderAvatars(NULL, ++pass);
+ return;
+ }
- renderAvatars(NULL, pass); // render all avatars
+ renderAvatars(NULL, pass); // render all avatars
}
void LLDrawPoolAvatar::beginRenderPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- //reset vertex buffer mappings
- LLVertexBuffer::unbind();
-
- if (LLPipeline::sImpostorRender)
- { //impostor render does not have impostors or rigid rendering
- ++pass;
- }
-
- switch (pass)
- {
- case 0:
- beginImpostor();
- break;
- case 1:
- beginRigid();
- break;
- case 2:
- beginSkinned();
- break;
- }
-
- if (pass == 0)
- { //make sure no stale colors are left over from a previous render
- gGL.diffuseColor4f(1,1,1,1);
- }
+ //reset vertex buffer mappings
+ LLVertexBuffer::unbind();
+
+ if (LLPipeline::sImpostorRender)
+ { //impostor render does not have impostors or rigid rendering
+ ++pass;
+ }
+
+ switch (pass)
+ {
+ case 0:
+ beginImpostor();
+ break;
+ case 1:
+ beginRigid();
+ break;
+ case 2:
+ beginSkinned();
+ break;
+ }
+
+ if (pass == 0)
+ { //make sure no stale colors are left over from a previous render
+ gGL.diffuseColor4f(1,1,1,1);
+ }
}
void LLDrawPoolAvatar::endRenderPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- if (LLPipeline::sImpostorRender)
- {
- ++pass;
- }
-
- switch (pass)
- {
- case 0:
- endImpostor();
- break;
- case 1:
- endRigid();
- break;
- case 2:
- endSkinned();
- break;
- }
+ if (LLPipeline::sImpostorRender)
+ {
+ ++pass;
+ }
+
+ switch (pass)
+ {
+ case 0:
+ endImpostor();
+ break;
+ case 1:
+ endRigid();
+ break;
+ case 2:
+ endSkinned();
+ break;
+ }
}
void LLDrawPoolAvatar::beginImpostor()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- if (!LLPipeline::sReflectionRender)
- {
- LLVOAvatar::sRenderDistance = llclamp(LLVOAvatar::sRenderDistance, 16.f, 256.f);
- LLVOAvatar::sNumVisibleAvatars = 0;
- }
+ if (!LLPipeline::sReflectionRender)
+ {
+ LLVOAvatar::sRenderDistance = llclamp(LLVOAvatar::sRenderDistance, 16.f, 256.f);
+ LLVOAvatar::sNumVisibleAvatars = 0;
+ }
- gImpostorProgram.bind();
- gImpostorProgram.setMinimumAlpha(0.01f);
+ gImpostorProgram.bind();
+ gImpostorProgram.setMinimumAlpha(0.01f);
- gPipeline.enableLightsFullbright();
- sDiffuseChannel = 0;
+ gPipeline.enableLightsFullbright();
+ sDiffuseChannel = 0;
}
void LLDrawPoolAvatar::endImpostor()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- gImpostorProgram.unbind();
- gPipeline.enableLightsDynamic();
+ gImpostorProgram.unbind();
+ gPipeline.enableLightsDynamic();
}
void LLDrawPoolAvatar::beginRigid()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- if (gPipeline.shadersLoaded())
- {
- sVertexProgram = &gObjectAlphaMaskNoColorProgram;
-
- if (sVertexProgram != NULL)
- { //eyeballs render with the specular shader
- sVertexProgram->bind();
- sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
- }
- }
- else
- {
- sVertexProgram = NULL;
- }
+ if (gPipeline.shadersLoaded())
+ {
+ sVertexProgram = &gObjectAlphaMaskNoColorProgram;
+
+ if (sVertexProgram != NULL)
+ { //eyeballs render with the specular shader
+ sVertexProgram->bind();
+ sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
+ }
+ }
+ else
+ {
+ sVertexProgram = NULL;
+ }
}
void LLDrawPoolAvatar::endRigid()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- sShaderLevel = mShaderLevel;
- if (sVertexProgram != NULL)
- {
- sVertexProgram->unbind();
- }
+ sShaderLevel = mShaderLevel;
+ if (sVertexProgram != NULL)
+ {
+ sVertexProgram->unbind();
+ }
}
void LLDrawPoolAvatar::beginDeferredImpostor()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- if (!LLPipeline::sReflectionRender)
- {
- LLVOAvatar::sRenderDistance = llclamp(LLVOAvatar::sRenderDistance, 16.f, 256.f);
- LLVOAvatar::sNumVisibleAvatars = 0;
- }
+ if (!LLPipeline::sReflectionRender)
+ {
+ LLVOAvatar::sRenderDistance = llclamp(LLVOAvatar::sRenderDistance, 16.f, 256.f);
+ LLVOAvatar::sNumVisibleAvatars = 0;
+ }
- sVertexProgram = &gDeferredImpostorProgram;
- specular_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::SPECULAR_MAP);
- normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL);
- sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- sVertexProgram->bind();
- sVertexProgram->setMinimumAlpha(0.01f);
+ sVertexProgram = &gDeferredImpostorProgram;
+ specular_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::SPECULAR_MAP);
+ normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL);
+ sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ sVertexProgram->bind();
+ sVertexProgram->setMinimumAlpha(0.01f);
}
void LLDrawPoolAvatar::endDeferredImpostor()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- sShaderLevel = mShaderLevel;
- sVertexProgram->disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL);
- sVertexProgram->disableTexture(LLViewerShaderMgr::SPECULAR_MAP);
- sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- gPipeline.unbindDeferredShader(*sVertexProgram);
+ sShaderLevel = mShaderLevel;
+ sVertexProgram->disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL);
+ sVertexProgram->disableTexture(LLViewerShaderMgr::SPECULAR_MAP);
+ sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ gPipeline.unbindDeferredShader(*sVertexProgram);
sVertexProgram = NULL;
sDiffuseChannel = 0;
}
@@ -569,20 +569,20 @@ void LLDrawPoolAvatar::beginDeferredRigid()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- sVertexProgram = &gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
- sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- sVertexProgram->bind();
- sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
+ sVertexProgram = &gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
+ sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ sVertexProgram->bind();
+ sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
}
void LLDrawPoolAvatar::endDeferredRigid()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- sShaderLevel = mShaderLevel;
- sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- sVertexProgram->unbind();
- gGL.getTexUnit(0)->activate();
+ sShaderLevel = mShaderLevel;
+ sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ sVertexProgram->unbind();
+ gGL.getTexUnit(0)->activate();
}
@@ -592,11 +592,11 @@ void LLDrawPoolAvatar::beginSkinned()
// used for preview only
- sVertexProgram = &gAvatarProgram;
-
- sRenderingSkinned = TRUE;
+ sVertexProgram = &gAvatarProgram;
+
+ sRenderingSkinned = TRUE;
- sVertexProgram->bind();
+ sVertexProgram->bind();
sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
}
@@ -604,209 +604,209 @@ void LLDrawPoolAvatar::endSkinned()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
- if (sShaderLevel > 0)
- {
- sRenderingSkinned = FALSE;
- sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP);
- gGL.getTexUnit(0)->activate();
- sVertexProgram->unbind();
- sShaderLevel = mShaderLevel;
- }
- else
- {
- if(gPipeline.shadersLoaded())
- {
- // software skinning, use a basic shader for windlight.
- // TODO: find a better fallback method for software skinning.
- sVertexProgram->unbind();
- }
- }
-
- gGL.getTexUnit(0)->activate();
+ // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
+ if (sShaderLevel > 0)
+ {
+ sRenderingSkinned = FALSE;
+ sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP);
+ gGL.getTexUnit(0)->activate();
+ sVertexProgram->unbind();
+ sShaderLevel = mShaderLevel;
+ }
+ else
+ {
+ if(gPipeline.shadersLoaded())
+ {
+ // software skinning, use a basic shader for windlight.
+ // TODO: find a better fallback method for software skinning.
+ sVertexProgram->unbind();
+ }
+ }
+
+ gGL.getTexUnit(0)->activate();
}
void LLDrawPoolAvatar::beginDeferredSkinned()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- sShaderLevel = mShaderLevel;
- sVertexProgram = &gDeferredAvatarProgram;
- sRenderingSkinned = TRUE;
+ sShaderLevel = mShaderLevel;
+ sVertexProgram = &gDeferredAvatarProgram;
+ sRenderingSkinned = TRUE;
- sVertexProgram->bind();
- sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
- sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- gGL.getTexUnit(0)->activate();
+ sVertexProgram->bind();
+ sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
+ sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ gGL.getTexUnit(0)->activate();
}
void LLDrawPoolAvatar::endDeferredSkinned()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
- sRenderingSkinned = FALSE;
- sVertexProgram->unbind();
+ // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
+ sRenderingSkinned = FALSE;
+ sVertexProgram->unbind();
- sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- sShaderLevel = mShaderLevel;
+ sShaderLevel = mShaderLevel;
- gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->activate();
}
void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; //LL_RECORD_BLOCK_TIME(FTM_RENDER_CHARACTERS);
- if (pass == -1)
- {
- for (S32 i = 1; i < getNumPasses(); i++)
- { //skip impostor pass
- prerender();
- beginRenderPass(i);
- renderAvatars(single_avatar, i);
- endRenderPass(i);
- }
-
- return;
- }
-
- if (mDrawFace.empty() && !single_avatar)
- {
- return;
- }
-
- LLVOAvatar *avatarp = NULL;
-
- if (single_avatar)
- {
- avatarp = single_avatar;
- }
- else
- {
- const LLFace *facep = mDrawFace[0];
- if (!facep->getDrawable())
- {
- return;
- }
- avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get();
- }
+ if (pass == -1)
+ {
+ for (S32 i = 1; i < getNumPasses(); i++)
+ { //skip impostor pass
+ prerender();
+ beginRenderPass(i);
+ renderAvatars(single_avatar, i);
+ endRenderPass(i);
+ }
+
+ return;
+ }
+
+ if (mDrawFace.empty() && !single_avatar)
+ {
+ return;
+ }
+
+ LLVOAvatar *avatarp = NULL;
+
+ if (single_avatar)
+ {
+ avatarp = single_avatar;
+ }
+ else
+ {
+ const LLFace *facep = mDrawFace[0];
+ if (!facep->getDrawable())
+ {
+ return;
+ }
+ avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get();
+ }
if (avatarp->isDead() || avatarp->mDrawable.isNull())
- {
- return;
- }
-
- if (!single_avatar && !avatarp->isFullyLoaded() )
- {
- if (pass==0 && (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) || LLViewerPartSim::getMaxPartCount() <= 0))
- {
- // debug code to draw a sphere in place of avatar
- gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
- gGL.setColorMask(true, true);
- LLVector3 pos = avatarp->getPositionAgent();
- gGL.color4f(1.0f, 1.0f, 1.0f, 0.7f);
-
- gGL.pushMatrix();
- gGL.translatef((F32)(pos.mV[VX]),
- (F32)(pos.mV[VY]),
- (F32)(pos.mV[VZ]));
- gGL.scalef(0.15f, 0.15f, 0.3f);
-
- gSphere.renderGGL();
-
- gGL.popMatrix();
- gGL.setColorMask(true, false);
- }
- // don't render please
- return;
- }
-
- BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor() && !single_avatar;
-
- if (( avatarp->isInMuteList()
- || impostor
- || (LLVOAvatar::AOA_NORMAL != avatarp->getOverallAppearance() && !avatarp->needsImpostorUpdate()) ) && pass != 0)
-// || (LLVOAvatar::AV_DO_NOT_RENDER == avatarp->getVisualMuteSettings() && !avatarp->needsImpostorUpdate()) ) && pass != 0)
- { //don't draw anything but the impostor for impostored avatars
- return;
- }
-
- if (pass == 0 && !impostor && LLPipeline::sUnderWaterRender)
- { //don't draw foot shadows under water
- return;
- }
-
- LLVOAvatar *attached_av = avatarp->getAttachedAvatar();
- if (attached_av && (LLVOAvatar::AOA_NORMAL != attached_av->getOverallAppearance() || !gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR)))
- {
- // Animesh attachment of a jellydolled or invisible parent - don't show
- return;
- }
-
- if (pass == 0)
- {
- if (!LLPipeline::sReflectionRender)
- {
- LLVOAvatar::sNumVisibleAvatars++;
- }
-
-// if (impostor || (LLVOAvatar::AV_DO_NOT_RENDER == avatarp->getVisualMuteSettings() && !avatarp->needsImpostorUpdate()))
- if (impostor || (LLVOAvatar::AOA_NORMAL != avatarp->getOverallAppearance() && !avatarp->needsImpostorUpdate()))
- {
- if (LLPipeline::sRenderDeferred && !LLPipeline::sReflectionRender && avatarp->mImpostor.isComplete())
- {
- if (normal_channel > -1)
- {
- avatarp->mImpostor.bindTexture(2, normal_channel);
- }
- if (specular_channel > -1)
- {
- avatarp->mImpostor.bindTexture(1, specular_channel);
- }
- }
- avatarp->renderImpostor(avatarp->getMutedAVColor(), sDiffuseChannel);
- }
- return;
- }
-
- if (pass == 1)
- {
- // render rigid meshes (eyeballs) first
- avatarp->renderRigid();
- return;
- }
-
- if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
- {
- LLMatrix4 rot_mat;
- LLViewerCamera::getInstance()->getMatrixToLocal(rot_mat);
- LLMatrix4 cfr(OGL_TO_CFR_ROTATION);
- rot_mat *= cfr;
-
- LLVector4 wind;
- wind.setVec(avatarp->mWindVec);
- wind.mV[VW] = 0;
- wind = wind * rot_mat;
- wind.mV[VW] = avatarp->mWindVec.mV[VW];
-
- sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_WIND, 1, wind.mV);
- F32 phase = -1.f * (avatarp->mRipplePhase);
-
- F32 freq = 7.f + (noise1(avatarp->mRipplePhase) * 2.f);
- LLVector4 sin_params(freq, freq, freq, phase);
- sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_SINWAVE, 1, sin_params.mV);
-
- LLVector4 gravity(0.f, 0.f, -CLOTHING_GRAVITY_EFFECT, 0.f);
- gravity = gravity * rot_mat;
- sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_GRAVITY, 1, gravity.mV);
- }
-
- if( !single_avatar || (avatarp == single_avatar) )
- {
- avatarp->renderSkinned();
- }
+ {
+ return;
+ }
+
+ if (!single_avatar && !avatarp->isFullyLoaded() )
+ {
+ if (pass==0 && (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) || LLViewerPartSim::getMaxPartCount() <= 0))
+ {
+ // debug code to draw a sphere in place of avatar
+ gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
+ gGL.setColorMask(true, true);
+ LLVector3 pos = avatarp->getPositionAgent();
+ gGL.color4f(1.0f, 1.0f, 1.0f, 0.7f);
+
+ gGL.pushMatrix();
+ gGL.translatef((F32)(pos.mV[VX]),
+ (F32)(pos.mV[VY]),
+ (F32)(pos.mV[VZ]));
+ gGL.scalef(0.15f, 0.15f, 0.3f);
+
+ gSphere.renderGGL();
+
+ gGL.popMatrix();
+ gGL.setColorMask(true, false);
+ }
+ // don't render please
+ return;
+ }
+
+ BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor() && !single_avatar;
+
+ if (( avatarp->isInMuteList()
+ || impostor
+ || (LLVOAvatar::AOA_NORMAL != avatarp->getOverallAppearance() && !avatarp->needsImpostorUpdate()) ) && pass != 0)
+// || (LLVOAvatar::AV_DO_NOT_RENDER == avatarp->getVisualMuteSettings() && !avatarp->needsImpostorUpdate()) ) && pass != 0)
+ { //don't draw anything but the impostor for impostored avatars
+ return;
+ }
+
+ if (pass == 0 && !impostor && LLPipeline::sUnderWaterRender)
+ { //don't draw foot shadows under water
+ return;
+ }
+
+ LLVOAvatar *attached_av = avatarp->getAttachedAvatar();
+ if (attached_av && (LLVOAvatar::AOA_NORMAL != attached_av->getOverallAppearance() || !gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR)))
+ {
+ // Animesh attachment of a jellydolled or invisible parent - don't show
+ return;
+ }
+
+ if (pass == 0)
+ {
+ if (!LLPipeline::sReflectionRender)
+ {
+ LLVOAvatar::sNumVisibleAvatars++;
+ }
+
+// if (impostor || (LLVOAvatar::AV_DO_NOT_RENDER == avatarp->getVisualMuteSettings() && !avatarp->needsImpostorUpdate()))
+ if (impostor || (LLVOAvatar::AOA_NORMAL != avatarp->getOverallAppearance() && !avatarp->needsImpostorUpdate()))
+ {
+ if (LLPipeline::sRenderDeferred && !LLPipeline::sReflectionRender && avatarp->mImpostor.isComplete())
+ {
+ if (normal_channel > -1)
+ {
+ avatarp->mImpostor.bindTexture(2, normal_channel);
+ }
+ if (specular_channel > -1)
+ {
+ avatarp->mImpostor.bindTexture(1, specular_channel);
+ }
+ }
+ avatarp->renderImpostor(avatarp->getMutedAVColor(), sDiffuseChannel);
+ }
+ return;
+ }
+
+ if (pass == 1)
+ {
+ // render rigid meshes (eyeballs) first
+ avatarp->renderRigid();
+ return;
+ }
+
+ if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
+ {
+ LLMatrix4 rot_mat;
+ LLViewerCamera::getInstance()->getMatrixToLocal(rot_mat);
+ LLMatrix4 cfr(OGL_TO_CFR_ROTATION);
+ rot_mat *= cfr;
+
+ LLVector4 wind;
+ wind.setVec(avatarp->mWindVec);
+ wind.mV[VW] = 0;
+ wind = wind * rot_mat;
+ wind.mV[VW] = avatarp->mWindVec.mV[VW];
+
+ sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_WIND, 1, wind.mV);
+ F32 phase = -1.f * (avatarp->mRipplePhase);
+
+ F32 freq = 7.f + (noise1(avatarp->mRipplePhase) * 2.f);
+ LLVector4 sin_params(freq, freq, freq, phase);
+ sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_SINWAVE, 1, sin_params.mV);
+
+ LLVector4 gravity(0.f, 0.f, -CLOTHING_GRAVITY_EFFECT, 0.f);
+ gravity = gravity * rot_mat;
+ sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_GRAVITY, 1, gravity.mV);
+ }
+
+ if( !single_avatar || (avatarp == single_avatar) )
+ {
+ avatarp->renderSkinned();
+ }
}
static LLTrace::BlockTimerStatHandle FTM_RIGGED_VBO("Rigged VBO");
@@ -818,25 +818,25 @@ LLViewerTexture *LLDrawPoolAvatar::getDebugTexture()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- if (mReferences.empty())
- {
- return NULL;
- }
- LLFace *face = mReferences[0];
- if (!face->getDrawable())
- {
- return NULL;
- }
- const LLViewerObject *objectp = face->getDrawable()->getVObj();
+ if (mReferences.empty())
+ {
+ return NULL;
+ }
+ LLFace *face = mReferences[0];
+ if (!face->getDrawable())
+ {
+ return NULL;
+ }
+ const LLViewerObject *objectp = face->getDrawable()->getVObj();
- // Avatar should always have at least 1 (maybe 3?) TE's.
- return objectp->getTEImage(0);
+ // Avatar should always have at least 1 (maybe 3?) TE's.
+ return objectp->getTEImage(0);
}
LLColor3 LLDrawPoolAvatar::getDebugColor() const
{
- return LLColor3(0.f, 1.f, 0.f);
+ return LLColor3(0.f, 1.f, 0.f);
}
diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h
index ff78c6c60a..3160b9e706 100644
--- a/indra/newview/lldrawpoolavatar.h
+++ b/indra/newview/lldrawpoolavatar.h
@@ -1,25 +1,25 @@
- /**
+ /**
* @file lldrawpoolavatar.h
* @brief LLDrawPoolAvatar class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,68 +44,68 @@ extern U32 gFrameCount;
class LLDrawPoolAvatar : public LLFacePool
{
public:
- enum
- {
- SHADER_LEVEL_BUMP = 2,
- SHADER_LEVEL_CLOTH = 3
- };
-
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_WEIGHT |
- LLVertexBuffer::MAP_CLOTHWEIGHT
- };
+ enum
+ {
+ SHADER_LEVEL_BUMP = 2,
+ SHADER_LEVEL_CLOTH = 3
+ };
+
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_NORMAL |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_WEIGHT |
+ LLVertexBuffer::MAP_CLOTHWEIGHT
+ };
~LLDrawPoolAvatar();
/*virtual*/ BOOL isDead();
typedef enum
- {
- SHADOW_PASS_AVATAR_OPAQUE,
+ {
+ SHADOW_PASS_AVATAR_OPAQUE,
SHADOW_PASS_AVATAR_ALPHA_BLEND,
SHADOW_PASS_AVATAR_ALPHA_MASK,
NUM_SHADOW_PASSES
- } eShadowPass;
+ } eShadowPass;
+
+ virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
+
+ virtual S32 getShaderLevel() const;
- virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
+ LLDrawPoolAvatar(U32 type);
- virtual S32 getShaderLevel() const;
+ static LLMatrix4& getModelView();
- LLDrawPoolAvatar(U32 type);
+ /*virtual*/ S32 getNumPasses();
+ /*virtual*/ void beginRenderPass(S32 pass);
+ /*virtual*/ void endRenderPass(S32 pass);
+ /*virtual*/ void prerender();
+ /*virtual*/ void render(S32 pass = 0);
- static LLMatrix4& getModelView();
+ /*virtual*/ S32 getNumDeferredPasses();
+ /*virtual*/ void beginDeferredPass(S32 pass);
+ /*virtual*/ void endDeferredPass(S32 pass);
+ /*virtual*/ void renderDeferred(S32 pass);
- /*virtual*/ S32 getNumPasses();
- /*virtual*/ void beginRenderPass(S32 pass);
- /*virtual*/ void endRenderPass(S32 pass);
- /*virtual*/ void prerender();
- /*virtual*/ void render(S32 pass = 0);
+ /*virtual*/ S32 getNumPostDeferredPasses();
+ /*virtual*/ void beginPostDeferredPass(S32 pass);
+ /*virtual*/ void endPostDeferredPass(S32 pass);
+ /*virtual*/ void renderPostDeferred(S32 pass);
- /*virtual*/ S32 getNumDeferredPasses();
- /*virtual*/ void beginDeferredPass(S32 pass);
- /*virtual*/ void endDeferredPass(S32 pass);
- /*virtual*/ void renderDeferred(S32 pass);
-
- /*virtual*/ S32 getNumPostDeferredPasses();
- /*virtual*/ void beginPostDeferredPass(S32 pass);
- /*virtual*/ void endPostDeferredPass(S32 pass);
- /*virtual*/ void renderPostDeferred(S32 pass);
+ /*virtual*/ S32 getNumShadowPasses();
+ /*virtual*/ void beginShadowPass(S32 pass);
+ /*virtual*/ void endShadowPass(S32 pass);
+ /*virtual*/ void renderShadow(S32 pass);
- /*virtual*/ S32 getNumShadowPasses();
- /*virtual*/ void beginShadowPass(S32 pass);
- /*virtual*/ void endShadowPass(S32 pass);
- /*virtual*/ void renderShadow(S32 pass);
+ void beginRigid();
+ void beginImpostor();
+ void beginSkinned();
- void beginRigid();
- void beginImpostor();
- void beginSkinned();
-
- void endRigid();
- void endImpostor();
- void endSkinned();
+ void endRigid();
+ void endImpostor();
+ void endSkinned();
void beginDeferredRigid();
void beginDeferredImpostor();
@@ -115,18 +115,18 @@ typedef enum
void endDeferredImpostor();
void endDeferredSkinned();
- /*virtual*/ LLViewerTexture *getDebugTexture();
- /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
+ /*virtual*/ LLViewerTexture *getDebugTexture();
+ /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
- void renderAvatars(LLVOAvatar *single_avatar, S32 pass = -1); // renders only one avatar if single_avatar is not null.
+ void renderAvatars(LLVOAvatar *single_avatar, S32 pass = -1); // renders only one avatar if single_avatar is not null.
- static BOOL sSkipOpaque;
- static BOOL sSkipTransparent;
+ static BOOL sSkipOpaque;
+ static BOOL sSkipTransparent;
static S32 sShadowPass;
- static S32 sDiffuseChannel;
- static F32 sMinimumAlpha;
+ static S32 sDiffuseChannel;
+ static F32 sMinimumAlpha;
- static LLGLSLShader* sVertexProgram;
+ static LLGLSLShader* sVertexProgram;
};
extern S32 AVATAR_OFFSET_POS;
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index a0ce0ef6cf..99d0853ff1 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolbump.cpp
* @brief LLDrawPoolBump class implementation
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,7 +54,7 @@
//#include "../tools/imdebug/imdebug.h"
// static
-LLStandardBumpmap gStandardBumpmapList[TEM_BUMPMAP_COUNT];
+LLStandardBumpmap gStandardBumpmapList[TEM_BUMPMAP_COUNT];
LL::WorkQueue::weak_t LLBumpImageList::sMainQueue;
LL::WorkQueue::weak_t LLBumpImageList::sTexUpdateQueue;
LLRenderTarget LLBumpImageList::sRenderTarget;
@@ -84,13 +84,13 @@ static BOOL shiny = FALSE;
#define LL_BUMPLIST_MULTITHREADED 1
-// static
+// static
void LLStandardBumpmap::shutdown()
{
- LLStandardBumpmap::destroyGL();
+ LLStandardBumpmap::destroyGL();
}
-// static
+// static
void LLStandardBumpmap::restoreGL()
{
addstandard();
@@ -99,12 +99,12 @@ void LLStandardBumpmap::restoreGL()
// static
void LLStandardBumpmap::addstandard()
{
- if(!gTextureList.isInitialized())
- {
- //Note: loading pre-configuration sometimes triggers this call.
- //But it is safe to return here because bump images will be reloaded during initialization later.
- return ;
- }
+ if(!gTextureList.isInitialized())
+ {
+ //Note: loading pre-configuration sometimes triggers this call.
+ //But it is safe to return here because bump images will be reloaded during initialization later.
+ return ;
+ }
if (LLStartUp::getStartupState() < STATE_SEED_CAP_GRANTED)
{
@@ -112,99 +112,99 @@ void LLStandardBumpmap::addstandard()
return;
}
- // can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps.
- //llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 );
- clear();
- LL_INFOS() << "Adding standard bumpmaps." << LL_ENDL;
- gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP
- gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS
- gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS
-
- std::string file_name = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "std_bump.ini" );
- LLFILE* file = LLFile::fopen( file_name, "rt" ); /*Flawfinder: ignore*/
- if( !file )
- {
- LL_WARNS() << "Could not open std_bump <" << file_name << ">" << LL_ENDL;
- return;
- }
-
- S32 file_version = 0;
-
- S32 fields_read = fscanf( file, "LLStandardBumpmap version %d", &file_version );
- if( fields_read != 1 )
- {
- LL_WARNS() << "Bad LLStandardBumpmap header" << LL_ENDL;
- return;
- }
-
- if( file_version > STD_BUMP_LATEST_FILE_VERSION )
- {
- LL_WARNS() << "LLStandardBumpmap has newer version (" << file_version << ") than viewer (" << STD_BUMP_LATEST_FILE_VERSION << ")" << LL_ENDL;
- return;
- }
-
- while( !feof(file) && (LLStandardBumpmap::sStandardBumpmapCount < (U32)TEM_BUMPMAP_COUNT) )
- {
- // *NOTE: This buffer size is hard coded into scanf() below.
- char label[2048] = ""; /* Flawfinder: ignore */
- char bump_image_id[2048] = ""; /* Flawfinder: ignore */
- fields_read = fscanf( /* Flawfinder: ignore */
- file, "\n%2047s %2047s", label, bump_image_id);
- if( EOF == fields_read )
- {
- break;
- }
- if( fields_read != 2 )
- {
- LL_WARNS() << "Bad LLStandardBumpmap entry" << LL_ENDL;
- return;
- }
-
-// LL_INFOS() << "Loading bumpmap: " << bump_image_id << " from viewerart" << LL_ENDL;
- gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label;
- gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage =
- LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id));
- gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::LOCAL) ;
- gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL );
- gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0, 30.f) ;
- LLStandardBumpmap::sStandardBumpmapCount++;
- }
-
- fclose( file );
+ // can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps.
+ //llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 );
+ clear();
+ LL_INFOS() << "Adding standard bumpmaps." << LL_ENDL;
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS
+
+ std::string file_name = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "std_bump.ini" );
+ LLFILE* file = LLFile::fopen( file_name, "rt" ); /*Flawfinder: ignore*/
+ if( !file )
+ {
+ LL_WARNS() << "Could not open std_bump <" << file_name << ">" << LL_ENDL;
+ return;
+ }
+
+ S32 file_version = 0;
+
+ S32 fields_read = fscanf( file, "LLStandardBumpmap version %d", &file_version );
+ if( fields_read != 1 )
+ {
+ LL_WARNS() << "Bad LLStandardBumpmap header" << LL_ENDL;
+ return;
+ }
+
+ if( file_version > STD_BUMP_LATEST_FILE_VERSION )
+ {
+ LL_WARNS() << "LLStandardBumpmap has newer version (" << file_version << ") than viewer (" << STD_BUMP_LATEST_FILE_VERSION << ")" << LL_ENDL;
+ return;
+ }
+
+ while( !feof(file) && (LLStandardBumpmap::sStandardBumpmapCount < (U32)TEM_BUMPMAP_COUNT) )
+ {
+ // *NOTE: This buffer size is hard coded into scanf() below.
+ char label[2048] = ""; /* Flawfinder: ignore */
+ char bump_image_id[2048] = ""; /* Flawfinder: ignore */
+ fields_read = fscanf( /* Flawfinder: ignore */
+ file, "\n%2047s %2047s", label, bump_image_id);
+ if( EOF == fields_read )
+ {
+ break;
+ }
+ if( fields_read != 2 )
+ {
+ LL_WARNS() << "Bad LLStandardBumpmap entry" << LL_ENDL;
+ return;
+ }
+
+// LL_INFOS() << "Loading bumpmap: " << bump_image_id << " from viewerart" << LL_ENDL;
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label;
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage =
+ LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id));
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::LOCAL) ;
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL );
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0, 30.f) ;
+ LLStandardBumpmap::sStandardBumpmapCount++;
+ }
+
+ fclose( file );
}
// static
void LLStandardBumpmap::clear()
{
- LL_INFOS() << "Clearing standard bumpmaps." << LL_ENDL;
- for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ )
- {
- gStandardBumpmapList[i].mLabel.assign("");
- gStandardBumpmapList[i].mImage = NULL;
- }
- sStandardBumpmapCount = 0;
+ LL_INFOS() << "Clearing standard bumpmaps." << LL_ENDL;
+ for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ )
+ {
+ gStandardBumpmapList[i].mLabel.assign("");
+ gStandardBumpmapList[i].mImage = NULL;
+ }
+ sStandardBumpmapCount = 0;
}
// static
void LLStandardBumpmap::destroyGL()
{
- clear();
+ clear();
}
////////////////////////////////////////////////////////////////
-LLDrawPoolBump::LLDrawPoolBump()
+LLDrawPoolBump::LLDrawPoolBump()
: LLRenderPass(LLDrawPool::POOL_BUMP)
{
- shiny = FALSE;
+ shiny = FALSE;
}
void LLDrawPoolBump::prerender()
{
- mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
+ mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
}
// static
@@ -217,88 +217,88 @@ S32 LLDrawPoolBump::numBumpPasses()
//static
void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel)
{
- LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
- if( cube_map && !LLPipeline::sReflectionProbesEnabled )
- {
- if (shader )
- {
- LLMatrix4 mat;
- mat.initRows(LLVector4(gGLModelView+0),
- LLVector4(gGLModelView+4),
- LLVector4(gGLModelView+8),
- LLVector4(gGLModelView+12));
- LLVector3 vec = LLVector3(gShinyOrigin) * mat;
- LLVector4 vec4(vec, gShinyOrigin.mV[3]);
- shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV);
- if (shader_level > 1)
- {
+ LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
+ if( cube_map && !LLPipeline::sReflectionProbesEnabled )
+ {
+ if (shader )
+ {
+ LLMatrix4 mat;
+ mat.initRows(LLVector4(gGLModelView+0),
+ LLVector4(gGLModelView+4),
+ LLVector4(gGLModelView+8),
+ LLVector4(gGLModelView+12));
+ LLVector3 vec = LLVector3(gShinyOrigin) * mat;
+ LLVector4 vec4(vec, gShinyOrigin.mV[3]);
+ shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV);
+ if (shader_level > 1)
+ {
cube_map->setMatrix(1);
- // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for
- // the cube map in the one pass shiny shaders
- cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
- cube_map->enableTexture(cube_channel);
- diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- }
- else
- {
+ // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for
+ // the cube map in the one pass shiny shaders
+ cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
+ cube_map->enableTexture(cube_channel);
+ diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ }
+ else
+ {
cube_map->setMatrix(0);
- cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
- diffuse_channel = -1;
- cube_map->enable(cube_channel);
- }
- gGL.getTexUnit(cube_channel)->bind(cube_map);
- gGL.getTexUnit(0)->activate();
- }
- else
- {
- cube_channel = 0;
- diffuse_channel = -1;
- gGL.getTexUnit(0)->disable();
- cube_map->enable(0);
+ cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
+ diffuse_channel = -1;
+ cube_map->enable(cube_channel);
+ }
+ gGL.getTexUnit(cube_channel)->bind(cube_map);
+ gGL.getTexUnit(0)->activate();
+ }
+ else
+ {
+ cube_channel = 0;
+ diffuse_channel = -1;
+ gGL.getTexUnit(0)->disable();
+ cube_map->enable(0);
cube_map->setMatrix(0);
- gGL.getTexUnit(0)->bind(cube_map);
- }
- }
+ gGL.getTexUnit(0)->bind(cube_map);
+ }
+ }
}
//static
void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel)
{
- LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
- if( cube_map && !LLPipeline::sReflectionProbesEnabled)
- {
- if (shader_level > 1)
- {
- shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
-
- if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0)
- {
- if (diffuse_channel != 0)
- {
- shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- }
- }
- }
+ LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
+ if( cube_map && !LLPipeline::sReflectionProbesEnabled)
+ {
+ if (shader_level > 1)
+ {
+ shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
+
+ if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0)
+ {
+ if (diffuse_channel != 0)
+ {
+ shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ }
+ }
+ }
// Moved below shader->disableTexture call to avoid false alarms from auto-re-enable of textures on stage 0
// MAINT-755
- cube_map->disable();
+ cube_map->disable();
cube_map->restoreMatrix();
- }
+ }
}
void LLDrawPoolBump::beginFullbrightShiny()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY);
-
- sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0;
- // Second pass: environment map
- shader = &gDeferredFullbrightShinyProgram;
+ sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0;
+
+ // Second pass: environment map
+ shader = &gDeferredFullbrightShinyProgram;
if (LLPipeline::sRenderingHUDs)
{
shader = &gHUDFullbrightShinyProgram;
}
-
+
if (mRigged)
{
llassert(shader->mRiggedVariant);
@@ -312,32 +312,32 @@ void LLDrawPoolBump::beginFullbrightShiny()
gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap);
}
- LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
-
+ LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
+
if (cube_map && !LLPipeline::sReflectionProbesEnabled)
{
- // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for
- // the cube map in the one pass shiny shaders
- gGL.getTexUnit(1)->disable();
- cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
- cube_map->enableTexture(cube_channel);
- diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
-
- gGL.getTexUnit(cube_channel)->bind(cube_map);
- gGL.getTexUnit(0)->activate();
+ // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for
+ // the cube map in the one pass shiny shaders
+ gGL.getTexUnit(1)->disable();
+ cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
+ cube_map->enableTexture(cube_channel);
+ diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+
+ gGL.getTexUnit(cube_channel)->bind(cube_map);
+ gGL.getTexUnit(0)->activate();
}
- {
- LLMatrix4 mat;
- mat.initRows(LLVector4(gGLModelView+0),
- LLVector4(gGLModelView+4),
- LLVector4(gGLModelView+8),
- LLVector4(gGLModelView+12));
- shader->bind();
-
- LLVector3 vec = LLVector3(gShinyOrigin) * mat;
- LLVector4 vec4(vec, gShinyOrigin.mV[3]);
- shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV);
+ {
+ LLMatrix4 mat;
+ mat.initRows(LLVector4(gGLModelView+0),
+ LLVector4(gGLModelView+4),
+ LLVector4(gGLModelView+8),
+ LLVector4(gGLModelView+12));
+ shader->bind();
+
+ LLVector3 vec = LLVector3(gShinyOrigin) * mat;
+ LLVector4 vec4(vec, gShinyOrigin.mV[3]);
+ shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV);
if (LLPipeline::sReflectionProbesEnabled)
{
@@ -347,25 +347,25 @@ void LLDrawPoolBump::beginFullbrightShiny()
{
gPipeline.setEnvMat(*shader);
}
- }
+ }
- if (mShaderLevel > 1)
- { //indexed texture rendering, channel 0 is always diffuse
- diffuse_channel = 0;
- }
+ if (mShaderLevel > 1)
+ { //indexed texture rendering, channel 0 is always diffuse
+ diffuse_channel = 0;
+ }
- shiny = TRUE;
+ shiny = TRUE;
}
void LLDrawPoolBump::renderFullbrightShiny()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY);
- {
- LLGLEnable blend_enable(GL_BLEND);
+ {
+ LLGLEnable blend_enable(GL_BLEND);
- if (mShaderLevel > 1)
- {
+ if (mShaderLevel > 1)
+ {
if (mRigged)
{
LLRenderPass::pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY_RIGGED, true, true);
@@ -374,9 +374,9 @@ void LLDrawPoolBump::renderFullbrightShiny()
{
LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, true, true);
}
- }
- else
- {
+ }
+ else
+ {
if (mRigged)
{
LLRenderPass::pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY_RIGGED);
@@ -385,125 +385,125 @@ void LLDrawPoolBump::renderFullbrightShiny()
{
LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY);
}
- }
- }
+ }
+ }
}
void LLDrawPoolBump::endFullbrightShiny()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY);
- LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
- if( cube_map && !LLPipeline::sReflectionProbesEnabled )
- {
- cube_map->disable();
+ LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
+ if( cube_map && !LLPipeline::sReflectionProbesEnabled )
+ {
+ cube_map->disable();
if (shader->mFeatures.hasReflectionProbes)
{
gPipeline.unbindReflectionProbes(*shader);
}
- shader->unbind();
- }
-
- diffuse_channel = -1;
- cube_channel = 0;
- shiny = FALSE;
+ shader->unbind();
+ }
+
+ diffuse_channel = -1;
+ cube_channel = 0;
+ shiny = FALSE;
}
void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, bool texture = true)
-{
- LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
-
- for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
- {
- LLDrawInfo& params = **k;
-
- applyModelMatrix(params);
-
- params.mVertexBuffer->setBuffer();
- params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
- }
+{
+ LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
+
+ for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
+ {
+ LLDrawInfo& params = **k;
+
+ applyModelMatrix(params);
+
+ params.mVertexBuffer->setBuffer();
+ params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
+ }
}
// static
BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel)
{
- U8 bump_code = params.mBump;
+ U8 bump_code = params.mBump;
- return bindBumpMap(bump_code, params.mTexture, channel);
+ return bindBumpMap(bump_code, params.mTexture, channel);
}
//static
BOOL LLDrawPoolBump::bindBumpMap(LLFace* face, S32 channel)
{
- const LLTextureEntry* te = face->getTextureEntry();
- if (te)
- {
- U8 bump_code = te->getBumpmap();
- return bindBumpMap(bump_code, face->getTexture(), channel);
- }
-
- return FALSE;
+ const LLTextureEntry* te = face->getTextureEntry();
+ if (te)
+ {
+ U8 bump_code = te->getBumpmap();
+ return bindBumpMap(bump_code, face->getTexture(), channel);
+ }
+
+ return FALSE;
}
//static
BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 channel)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- //Note: texture atlas does not support bump texture now.
- LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(texture) ;
- if(!tex)
- {
- //if the texture is not a fetched texture
- return FALSE;
- }
-
- LLViewerTexture* bump = NULL;
-
- switch( bump_code )
- {
- case BE_NO_BUMP:
- break;
- case BE_BRIGHTNESS:
- case BE_DARKNESS:
- bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );
- break;
-
- default:
- if( bump_code < LLStandardBumpmap::sStandardBumpmapCount )
- {
- bump = gStandardBumpmapList[bump_code].mImage;
- gBumpImageList.addTextureStats(bump_code, tex->getID(), tex->getMaxVirtualSize());
- }
- break;
- }
-
- if (bump)
- {
- if (channel == -2)
- {
- gGL.getTexUnit(1)->bindFast(bump);
- gGL.getTexUnit(0)->bindFast(bump);
- }
- else
- {
+ //Note: texture atlas does not support bump texture now.
+ LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(texture) ;
+ if(!tex)
+ {
+ //if the texture is not a fetched texture
+ return FALSE;
+ }
+
+ LLViewerTexture* bump = NULL;
+
+ switch( bump_code )
+ {
+ case BE_NO_BUMP:
+ break;
+ case BE_BRIGHTNESS:
+ case BE_DARKNESS:
+ bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );
+ break;
+
+ default:
+ if( bump_code < LLStandardBumpmap::sStandardBumpmapCount )
+ {
+ bump = gStandardBumpmapList[bump_code].mImage;
+ gBumpImageList.addTextureStats(bump_code, tex->getID(), tex->getMaxVirtualSize());
+ }
+ break;
+ }
+
+ if (bump)
+ {
+ if (channel == -2)
+ {
+ gGL.getTexUnit(1)->bindFast(bump);
+ gGL.getTexUnit(0)->bindFast(bump);
+ }
+ else
+ {
// NOTE: do not use bindFast here (see SL-16222)
gGL.getTexUnit(channel)->bind(bump);
- }
+ }
- return TRUE;
- }
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
//static
void LLDrawPoolBump::beginBump()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP);
- sVertexMask = VERTEX_MASK_BUMP;
- // Optional second pass: emboss bump map
- stop_glerror();
+ sVertexMask = VERTEX_MASK_BUMP;
+ // Optional second pass: emboss bump map
+ stop_glerror();
shader = &gObjectBumpProgram;
@@ -515,21 +515,21 @@ void LLDrawPoolBump::beginBump()
shader->bind();
- gGL.setSceneBlendType(LLRender::BT_MULT_X2);
- stop_glerror();
+ gGL.setSceneBlendType(LLRender::BT_MULT_X2);
+ stop_glerror();
}
//static
void LLDrawPoolBump::renderBump(U32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP);
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL);
- LLGLEnable blend(GL_BLEND);
- gGL.diffuseColor4f(1,1,1,1);
- /// Get rid of z-fighting with non-bump pass.
- LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset(-1.0f, -1.0f);
- pushBumpBatches(pass);
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL);
+ LLGLEnable blend(GL_BLEND);
+ gGL.diffuseColor4f(1,1,1,1);
+ /// Get rid of z-fighting with non-bump pass.
+ LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(-1.0f, -1.0f);
+ pushBumpBatches(pass);
}
//static
@@ -541,7 +541,7 @@ void LLDrawPoolBump::endBump(U32 pass)
}
S32 LLDrawPoolBump::getNumDeferredPasses()
-{
+{
return 1;
}
@@ -604,7 +604,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass)
void LLDrawPoolBump::renderPostDeferred(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
-
+
S32 num_passes = LLPipeline::sRenderingHUDs ? 1 : 2; // skip rigged pass when rendering HUDs
for (int i = 0; i < num_passes; ++i)
@@ -632,126 +632,126 @@ void LLDrawPoolBump::renderPostDeferred(S32 pass)
void LLBumpImageList::init()
{
- llassert( mBrightnessEntries.size() == 0 );
- llassert( mDarknessEntries.size() == 0 );
+ llassert( mBrightnessEntries.size() == 0 );
+ llassert( mDarknessEntries.size() == 0 );
- LLStandardBumpmap::restoreGL();
+ LLStandardBumpmap::restoreGL();
sMainQueue = LL::WorkQueue::getInstance("mainloop");
sTexUpdateQueue = LL::WorkQueue::getInstance("LLImageGL"); // Share work queue with tex loader.
}
void LLBumpImageList::clear()
{
- LL_INFOS() << "Clearing dynamic bumpmaps." << LL_ENDL;
- // these will be re-populated on-demand
- mBrightnessEntries.clear();
- mDarknessEntries.clear();
+ LL_INFOS() << "Clearing dynamic bumpmaps." << LL_ENDL;
+ // these will be re-populated on-demand
+ mBrightnessEntries.clear();
+ mDarknessEntries.clear();
sRenderTarget.release();
- LLStandardBumpmap::clear();
+ LLStandardBumpmap::clear();
}
void LLBumpImageList::shutdown()
{
- clear();
- LLStandardBumpmap::shutdown();
+ clear();
+ LLStandardBumpmap::shutdown();
}
void LLBumpImageList::destroyGL()
{
- clear();
- LLStandardBumpmap::destroyGL();
+ clear();
+ LLStandardBumpmap::destroyGL();
}
void LLBumpImageList::restoreGL()
{
- if(!gTextureList.isInitialized())
- {
- //safe to return here because bump images will be reloaded during initialization later.
- return ;
- }
-
- LLStandardBumpmap::restoreGL();
- // Images will be recreated as they are needed.
+ if(!gTextureList.isInitialized())
+ {
+ //safe to return here because bump images will be reloaded during initialization later.
+ return ;
+ }
+
+ LLStandardBumpmap::restoreGL();
+ // Images will be recreated as they are needed.
}
LLBumpImageList::~LLBumpImageList()
{
- // Shutdown should have already been called.
- llassert( mBrightnessEntries.size() == 0 );
- llassert( mDarknessEntries.size() == 0 );
+ // Shutdown should have already been called.
+ llassert( mBrightnessEntries.size() == 0 );
+ llassert( mDarknessEntries.size() == 0 );
}
// Note: Does nothing for entries in gStandardBumpmapList that are not actually standard bump images (e.g. none, brightness, and darkness)
void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 virtual_size)
{
- bump &= TEM_BUMP_MASK;
- LLViewerFetchedTexture* bump_image = gStandardBumpmapList[bump].mImage;
- if( bump_image )
- {
- bump_image->addTextureStats(virtual_size);
- }
+ bump &= TEM_BUMP_MASK;
+ LLViewerFetchedTexture* bump_image = gStandardBumpmapList[bump].mImage;
+ if( bump_image )
+ {
+ bump_image->addTextureStats(virtual_size);
+ }
}
void LLBumpImageList::updateImages()
-{
- for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); )
- {
- bump_image_map_t::iterator curiter = iter++;
- LLViewerTexture* image = curiter->second;
- if( image )
- {
- BOOL destroy = TRUE;
- if( image->hasGLTexture())
- {
- if( image->getBoundRecently() )
- {
- destroy = FALSE;
- }
- else
- {
- image->destroyGLTexture();
- }
- }
-
- if( destroy )
- {
- //LL_INFOS() << "*** Destroying bright " << (void*)image << LL_ENDL;
- mBrightnessEntries.erase(curiter); // deletes the image thanks to reference counting
- }
- }
- }
-
- for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); )
- {
- bump_image_map_t::iterator curiter = iter++;
- LLViewerTexture* image = curiter->second;
- if( image )
- {
- BOOL destroy = TRUE;
- if( image->hasGLTexture())
- {
- if( image->getBoundRecently() )
- {
- destroy = FALSE;
- }
- else
- {
- image->destroyGLTexture();
- }
- }
-
- if( destroy )
- {
- //LL_INFOS() << "*** Destroying dark " << (void*)image << LL_ENDL;;
- mDarknessEntries.erase(curiter); // deletes the image thanks to reference counting
- }
- }
- }
+{
+ for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); )
+ {
+ bump_image_map_t::iterator curiter = iter++;
+ LLViewerTexture* image = curiter->second;
+ if( image )
+ {
+ BOOL destroy = TRUE;
+ if( image->hasGLTexture())
+ {
+ if( image->getBoundRecently() )
+ {
+ destroy = FALSE;
+ }
+ else
+ {
+ image->destroyGLTexture();
+ }
+ }
+
+ if( destroy )
+ {
+ //LL_INFOS() << "*** Destroying bright " << (void*)image << LL_ENDL;
+ mBrightnessEntries.erase(curiter); // deletes the image thanks to reference counting
+ }
+ }
+ }
+
+ for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); )
+ {
+ bump_image_map_t::iterator curiter = iter++;
+ LLViewerTexture* image = curiter->second;
+ if( image )
+ {
+ BOOL destroy = TRUE;
+ if( image->hasGLTexture())
+ {
+ if( image->getBoundRecently() )
+ {
+ destroy = FALSE;
+ }
+ else
+ {
+ image->destroyGLTexture();
+ }
+ }
+
+ if( destroy )
+ {
+ //LL_INFOS() << "*** Destroying dark " << (void*)image << LL_ENDL;;
+ mDarknessEntries.erase(curiter); // deletes the image thanks to reference counting
+ }
+ }
+ }
}
@@ -759,52 +759,52 @@ void LLBumpImageList::updateImages()
LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedTexture* src_image, U8 bump_code )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- llassert( (bump_code == BE_BRIGHTNESS) || (bump_code == BE_DARKNESS) );
-
- LLViewerTexture* bump = NULL;
-
- bump_image_map_t* entries_list = NULL;
- void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL;
-
- switch( bump_code )
- {
- case BE_BRIGHTNESS:
- entries_list = &mBrightnessEntries;
- callback_func = LLBumpImageList::onSourceBrightnessLoaded;
- break;
- case BE_DARKNESS:
- entries_list = &mDarknessEntries;
- callback_func = LLBumpImageList::onSourceDarknessLoaded;
- break;
- default:
- llassert(0);
- return NULL;
- }
-
- bump_image_map_t::iterator iter = entries_list->find(src_image->getID());
- if (iter != entries_list->end() && iter->second.notNull())
- {
- bump = iter->second;
- }
- else
- {
- (*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( TRUE );
- bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image
- }
-
- if (!src_image->hasCallbacks())
- { //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again
- if (src_image->getWidth() != bump->getWidth() ||
- src_image->getHeight() != bump->getHeight())// ||
- //(LLPipeline::sRenderDeferred && bump->getComponents() != 4))
- {
- src_image->setBoostLevel(LLGLTexture::BOOST_BUMP) ;
- src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
- src_image->forceToSaveRawImage(0) ;
- }
- }
-
- return bump;
+ llassert( (bump_code == BE_BRIGHTNESS) || (bump_code == BE_DARKNESS) );
+
+ LLViewerTexture* bump = NULL;
+
+ bump_image_map_t* entries_list = NULL;
+ void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL;
+
+ switch( bump_code )
+ {
+ case BE_BRIGHTNESS:
+ entries_list = &mBrightnessEntries;
+ callback_func = LLBumpImageList::onSourceBrightnessLoaded;
+ break;
+ case BE_DARKNESS:
+ entries_list = &mDarknessEntries;
+ callback_func = LLBumpImageList::onSourceDarknessLoaded;
+ break;
+ default:
+ llassert(0);
+ return NULL;
+ }
+
+ bump_image_map_t::iterator iter = entries_list->find(src_image->getID());
+ if (iter != entries_list->end() && iter->second.notNull())
+ {
+ bump = iter->second;
+ }
+ else
+ {
+ (*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( TRUE );
+ bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image
+ }
+
+ if (!src_image->hasCallbacks())
+ { //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again
+ if (src_image->getWidth() != bump->getWidth() ||
+ src_image->getHeight() != bump->getHeight())// ||
+ //(LLPipeline::sRenderDeferred && bump->getComponents() != 4))
+ {
+ src_image->setBoostLevel(LLGLTexture::BOOST_BUMP) ;
+ src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
+ src_image->forceToSaveRawImage(0) ;
+ }
+ }
+
+ return bump;
}
@@ -812,94 +812,94 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText
void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- LLUUID* source_asset_id = (LLUUID*)userdata;
- LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_BRIGHTNESS );
- if( final )
- {
- delete source_asset_id;
- }
+ LLUUID* source_asset_id = (LLUUID*)userdata;
+ LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_BRIGHTNESS );
+ if( final )
+ {
+ delete source_asset_id;
+ }
}
// static
void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata )
{
- LLUUID* source_asset_id = (LLUUID*)userdata;
- LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_DARKNESS );
- if( final )
- {
- delete source_asset_id;
- }
+ LLUUID* source_asset_id = (LLUUID*)userdata;
+ LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_DARKNESS );
+ if( final )
+ {
+ delete source_asset_id;
+ }
}
void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
{
- if (success && LLPipeline::sRenderDeferred)
- {
+ if (success && LLPipeline::sRenderDeferred)
+ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4);
- {
- generateNormalMapFromAlpha(src, nrm_image);
- }
- src_vi->setExplicitFormat(GL_RGBA, GL_RGBA);
- {
- src_vi->createGLTexture(src_vi->getDiscardLevel(), nrm_image);
- }
- }
+ LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4);
+ {
+ generateNormalMapFromAlpha(src, nrm_image);
+ }
+ src_vi->setExplicitFormat(GL_RGBA, GL_RGBA);
+ {
+ src_vi->createGLTexture(src_vi->getDiscardLevel(), nrm_image);
+ }
+ }
}
void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image)
{
- U8* nrm_data = nrm_image->getData();
- S32 resX = src->getWidth();
- S32 resY = src->getHeight();
-
- U8* src_data = src->getData();
-
- S32 src_cmp = src->getComponents();
-
- F32 norm_scale = gSavedSettings.getF32("RenderNormalMapScale");
-
- U32 idx = 0;
- //generate normal map from pseudo-heightfield
- for (S32 j = 0; j < resY; ++j)
- {
- for (S32 i = 0; i < resX; ++i)
- {
- S32 rX = (i+1)%resX;
- S32 rY = (j+1)%resY;
- S32 lX = (i-1)%resX;
- S32 lY = (j-1)%resY;
-
- if (lX < 0)
- {
- lX += resX;
- }
- if (lY < 0)
- {
- lY += resY;
- }
-
- F32 cH = (F32) src_data[(j*resX+i)*src_cmp+src_cmp-1];
-
- LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH);
- LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH);
- LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH);
- LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH);
-
- LLVector3 norm = right%down + down%left + left%up + up%right;
-
- norm.normVec();
-
- norm *= 0.5f;
- norm += LLVector3(0.5f,0.5f,0.5f);
-
- idx = (j*resX+i)*4;
- nrm_data[idx+0]= (U8) (norm.mV[0]*255);
- nrm_data[idx+1]= (U8) (norm.mV[1]*255);
- nrm_data[idx+2]= (U8) (norm.mV[2]*255);
- nrm_data[idx+3]= src_data[(j*resX+i)*src_cmp+src_cmp-1];
- }
- }
+ U8* nrm_data = nrm_image->getData();
+ S32 resX = src->getWidth();
+ S32 resY = src->getHeight();
+
+ U8* src_data = src->getData();
+
+ S32 src_cmp = src->getComponents();
+
+ F32 norm_scale = gSavedSettings.getF32("RenderNormalMapScale");
+
+ U32 idx = 0;
+ //generate normal map from pseudo-heightfield
+ for (S32 j = 0; j < resY; ++j)
+ {
+ for (S32 i = 0; i < resX; ++i)
+ {
+ S32 rX = (i+1)%resX;
+ S32 rY = (j+1)%resY;
+ S32 lX = (i-1)%resX;
+ S32 lY = (j-1)%resY;
+
+ if (lX < 0)
+ {
+ lX += resX;
+ }
+ if (lY < 0)
+ {
+ lY += resY;
+ }
+
+ F32 cH = (F32) src_data[(j*resX+i)*src_cmp+src_cmp-1];
+
+ LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH);
+ LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH);
+ LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH);
+ LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH);
+
+ LLVector3 norm = right%down + down%left + left%up + up%right;
+
+ norm.normVec();
+
+ norm *= 0.5f;
+ norm += LLVector3(0.5f,0.5f,0.5f);
+
+ idx = (j*resX+i)*4;
+ nrm_data[idx+0]= (U8) (norm.mV[0]*255);
+ nrm_data[idx+1]= (U8) (norm.mV[1]*255);
+ nrm_data[idx+2]= (U8) (norm.mV[2]*255);
+ nrm_data[idx+3]= src_data[(j*resX+i)*src_cmp+src_cmp-1];
+ }
+ }
}
// static
@@ -907,147 +907,147 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
{
LL_PROFILE_ZONE_SCOPED;
- if( success )
- {
+ if( success )
+ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries );
- bump_image_map_t::iterator iter = entries_list.find(source_asset_id);
-
- {
- if (iter == entries_list.end() ||
- iter->second.isNull() ||
- iter->second->getWidth() != src->getWidth() ||
- iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
- { //make sure an entry exists for this image
- entries_list[src_vi->getID()] = LLViewerTextureManager::getLocalTexture(TRUE);
- iter = entries_list.find(src_vi->getID());
- }
- }
-
- if (iter->second->getWidth() != src->getWidth() ||
- iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
- {
- LLPointer<LLImageRaw> dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1);
- U8* dst_data = dst_image->getData();
- S32 dst_data_size = dst_image->getDataSize();
-
- U8* src_data = src->getData();
- S32 src_data_size = src->getDataSize();
-
- S32 src_components = src->getComponents();
-
- // Convert to luminance and then scale and bias that to get ready for
- // embossed bump mapping. (0-255 maps to 127-255)
-
- // Convert to fixed point so we don't have to worry about precision/clamping.
- const S32 FIXED_PT = 8;
- const S32 R_WEIGHT = S32(0.2995f * (1<<FIXED_PT));
- const S32 G_WEIGHT = S32(0.5875f * (1<<FIXED_PT));
- const S32 B_WEIGHT = S32(0.1145f * (1<<FIXED_PT));
-
- S32 minimum = 255;
- S32 maximum = 0;
-
- switch( src_components )
- {
- case 1:
- case 2:
- {
- if( src_data_size == dst_data_size * src_components )
- {
- for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components )
- {
- dst_data[i] = src_data[j];
- if( dst_data[i] < minimum )
- {
- minimum = dst_data[i];
- }
- if( dst_data[i] > maximum )
- {
- maximum = dst_data[i];
- }
- }
- }
- else
- {
- llassert(0);
- dst_image->clear();
- }
- }
- break;
- case 3:
- case 4:
- {
- if( src_data_size == dst_data_size * src_components )
- {
- for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components )
- {
- // RGB to luminance
- dst_data[i] = (R_WEIGHT * src_data[j] + G_WEIGHT * src_data[j+1] + B_WEIGHT * src_data[j+2]) >> FIXED_PT;
- //llassert( dst_data[i] <= 255 );true because it's 8bit
- if( dst_data[i] < minimum )
- {
- minimum = dst_data[i];
- }
- if( dst_data[i] > maximum )
- {
- maximum = dst_data[i];
- }
- }
- }
- else
- {
- llassert(0);
- dst_image->clear();
- }
- }
- break;
- default:
- llassert(0);
- dst_image->clear();
- break;
- }
-
- if( maximum > minimum )
- {
- U8 bias_and_scale_lut[256];
- F32 twice_one_over_range = 2.f / (maximum - minimum);
- S32 i;
-
- const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exaggerates the effect in midrange. Disadvantage: clamps at the extremes.
- if (BE_DARKNESS == bump_code)
- {
- for( i = minimum; i <= maximum; i++ )
- {
- F32 minus_one_to_one = F32(maximum - i) * twice_one_over_range - 1.f;
- bias_and_scale_lut[i] = llclampb(ll_round(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128));
- }
- }
- else
- {
- for( i = minimum; i <= maximum; i++ )
- {
- F32 minus_one_to_one = F32(i - minimum) * twice_one_over_range - 1.f;
- bias_and_scale_lut[i] = llclampb(ll_round(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128));
- }
- }
-
- for( i = 0; i < dst_data_size; i++ )
- {
- dst_data[i] = bias_and_scale_lut[dst_data[i]];
- }
- }
-
- //---------------------------------------------------
- // immediately assign bump to a smart pointer in case some local smart pointer
- // accidentally releases it.
+ bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries );
+ bump_image_map_t::iterator iter = entries_list.find(source_asset_id);
+
+ {
+ if (iter == entries_list.end() ||
+ iter->second.isNull() ||
+ iter->second->getWidth() != src->getWidth() ||
+ iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
+ { //make sure an entry exists for this image
+ entries_list[src_vi->getID()] = LLViewerTextureManager::getLocalTexture(TRUE);
+ iter = entries_list.find(src_vi->getID());
+ }
+ }
+
+ if (iter->second->getWidth() != src->getWidth() ||
+ iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
+ {
+ LLPointer<LLImageRaw> dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1);
+ U8* dst_data = dst_image->getData();
+ S32 dst_data_size = dst_image->getDataSize();
+
+ U8* src_data = src->getData();
+ S32 src_data_size = src->getDataSize();
+
+ S32 src_components = src->getComponents();
+
+ // Convert to luminance and then scale and bias that to get ready for
+ // embossed bump mapping. (0-255 maps to 127-255)
+
+ // Convert to fixed point so we don't have to worry about precision/clamping.
+ const S32 FIXED_PT = 8;
+ const S32 R_WEIGHT = S32(0.2995f * (1<<FIXED_PT));
+ const S32 G_WEIGHT = S32(0.5875f * (1<<FIXED_PT));
+ const S32 B_WEIGHT = S32(0.1145f * (1<<FIXED_PT));
+
+ S32 minimum = 255;
+ S32 maximum = 0;
+
+ switch( src_components )
+ {
+ case 1:
+ case 2:
+ {
+ if( src_data_size == dst_data_size * src_components )
+ {
+ for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components )
+ {
+ dst_data[i] = src_data[j];
+ if( dst_data[i] < minimum )
+ {
+ minimum = dst_data[i];
+ }
+ if( dst_data[i] > maximum )
+ {
+ maximum = dst_data[i];
+ }
+ }
+ }
+ else
+ {
+ llassert(0);
+ dst_image->clear();
+ }
+ }
+ break;
+ case 3:
+ case 4:
+ {
+ if( src_data_size == dst_data_size * src_components )
+ {
+ for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components )
+ {
+ // RGB to luminance
+ dst_data[i] = (R_WEIGHT * src_data[j] + G_WEIGHT * src_data[j+1] + B_WEIGHT * src_data[j+2]) >> FIXED_PT;
+ //llassert( dst_data[i] <= 255 );true because it's 8bit
+ if( dst_data[i] < minimum )
+ {
+ minimum = dst_data[i];
+ }
+ if( dst_data[i] > maximum )
+ {
+ maximum = dst_data[i];
+ }
+ }
+ }
+ else
+ {
+ llassert(0);
+ dst_image->clear();
+ }
+ }
+ break;
+ default:
+ llassert(0);
+ dst_image->clear();
+ break;
+ }
+
+ if( maximum > minimum )
+ {
+ U8 bias_and_scale_lut[256];
+ F32 twice_one_over_range = 2.f / (maximum - minimum);
+ S32 i;
+
+ const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exaggerates the effect in midrange. Disadvantage: clamps at the extremes.
+ if (BE_DARKNESS == bump_code)
+ {
+ for( i = minimum; i <= maximum; i++ )
+ {
+ F32 minus_one_to_one = F32(maximum - i) * twice_one_over_range - 1.f;
+ bias_and_scale_lut[i] = llclampb(ll_round(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128));
+ }
+ }
+ else
+ {
+ for( i = minimum; i <= maximum; i++ )
+ {
+ F32 minus_one_to_one = F32(i - minimum) * twice_one_over_range - 1.f;
+ bias_and_scale_lut[i] = llclampb(ll_round(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128));
+ }
+ }
+
+ for( i = 0; i < dst_data_size; i++ )
+ {
+ dst_data[i] = bias_and_scale_lut[dst_data[i]];
+ }
+ }
+
+ //---------------------------------------------------
+ // immediately assign bump to a smart pointer in case some local smart pointer
+ // accidentally releases it.
LLPointer<LLViewerTexture> bump = iter->second;
- if (!LLPipeline::sRenderDeferred)
- {
- bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
+ if (!LLPipeline::sRenderDeferred)
+ {
+ bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
#if LL_BUMPLIST_MULTITHREADED
auto tex_queue = LLImageGLThread::sEnabledTextures ? sTexUpdateQueue.lock() : nullptr;
@@ -1073,9 +1073,9 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
{
bump->createGLTexture(0, dst_image);
}
- }
- else
- { //convert to normal map
+ }
+ else
+ { //convert to normal map
LL_PROFILE_ZONE_NAMED("bil - create normal map");
LLImageGL* img = bump->getGLTexture();
LLImageRaw* dst_ptr = dst_image.get();
@@ -1179,16 +1179,16 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
}
- }
+ }
- iter->second = bump; // derefs (and deletes) old image
- //---------------------------------------------------
- }
- }
+ iter->second = bump; // derefs (and deletes) old image
+ //---------------------------------------------------
+ }
+ }
}
void LLDrawPoolBump::pushBumpBatches(U32 type)
-{
+{
LLVOAvatar* avatar = nullptr;
U64 skin = 0;
@@ -1200,12 +1200,12 @@ void LLDrawPoolBump::pushBumpBatches(U32 type)
LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type);
LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
- for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i)
- {
- LLDrawInfo& params = **i;
+ for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i)
+ {
+ LLDrawInfo& params = **i;
- if (LLDrawPoolBump::bindBumpMap(params))
- {
+ if (LLDrawPoolBump::bindBumpMap(params))
+ {
if (mRigged)
{
if (avatar != params.mAvatar || skin != params.mSkinInfo->mHash)
@@ -1221,80 +1221,80 @@ void LLDrawPoolBump::pushBumpBatches(U32 type)
}
}
}
- pushBumpBatch(params, false);
- }
- }
+ pushBumpBatch(params, false);
+ }
+ }
}
void LLRenderPass::pushBumpBatch(LLDrawInfo& params, bool texture, bool batch_textures)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- applyModelMatrix(params);
-
- bool tex_setup = false;
-
- if (batch_textures && params.mTextureList.size() > 1)
- {
- for (U32 i = 0; i < params.mTextureList.size(); ++i)
- {
- if (params.mTextureList[i].notNull())
- {
- gGL.getTexUnit(i)->bindFast(params.mTextureList[i]);
- }
- }
- }
- else
- { //not batching textures or batch has only 1 texture -- might need a texture matrix
- if (params.mTextureMatrix)
- {
- if (shiny)
- {
- gGL.getTexUnit(0)->activate();
- gGL.matrixMode(LLRender::MM_TEXTURE);
- }
- else
- {
- gGL.getTexUnit(0)->activate();
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
- gPipeline.mTextureMatrixOps++;
- }
-
- gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
- gPipeline.mTextureMatrixOps++;
-
- tex_setup = true;
- }
-
- if (shiny && mShaderLevel > 1 && texture)
- {
- if (params.mTexture.notNull())
- {
- gGL.getTexUnit(diffuse_channel)->bindFast(params.mTexture);
- }
- else
- {
- gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
- }
- }
- }
-
- params.mVertexBuffer->setBuffer();
- params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
+ applyModelMatrix(params);
+
+ bool tex_setup = false;
+
+ if (batch_textures && params.mTextureList.size() > 1)
+ {
+ for (U32 i = 0; i < params.mTextureList.size(); ++i)
+ {
+ if (params.mTextureList[i].notNull())
+ {
+ gGL.getTexUnit(i)->bindFast(params.mTextureList[i]);
+ }
+ }
+ }
+ else
+ { //not batching textures or batch has only 1 texture -- might need a texture matrix
+ if (params.mTextureMatrix)
+ {
+ if (shiny)
+ {
+ gGL.getTexUnit(0)->activate();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->activate();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
+ gPipeline.mTextureMatrixOps++;
+ }
+
+ gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
+ gPipeline.mTextureMatrixOps++;
+
+ tex_setup = true;
+ }
+
+ if (shiny && mShaderLevel > 1 && texture)
+ {
+ if (params.mTexture.notNull())
+ {
+ gGL.getTexUnit(diffuse_channel)->bindFast(params.mTexture);
+ }
+ else
+ {
+ gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ }
+ }
+
+ params.mVertexBuffer->setBuffer();
+ params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
if (tex_setup)
- {
- if (shiny)
- {
- gGL.getTexUnit(0)->activate();
- }
- else
- {
- gGL.getTexUnit(0)->activate();
- gGL.matrixMode(LLRender::MM_TEXTURE);
- }
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- }
+ {
+ if (shiny)
+ {
+ gGL.getTexUnit(0)->activate();
+ }
+ else
+ {
+ gGL.getTexUnit(0)->activate();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ }
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ }
}
diff --git a/indra/newview/lldrawpoolbump.h b/indra/newview/lldrawpoolbump.h
index b1fe454c72..a1ed555996 100644
--- a/indra/newview/lldrawpoolbump.h
+++ b/indra/newview/lldrawpoolbump.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolbump.h
* @brief LLDrawPoolBump class definition
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,55 +43,55 @@ class LLViewerFetchedTexture;
class LLDrawPoolBump : public LLRenderPass
{
protected :
- LLDrawPoolBump(const U32 type):LLRenderPass(type) { mShiny = FALSE; }
+ LLDrawPoolBump(const U32 type):LLRenderPass(type) { mShiny = FALSE; }
public:
- static U32 sVertexMask;
- BOOL mShiny;
-
- virtual U32 getVertexDataMask() override { return sVertexMask; }
+ static U32 sVertexMask;
+ BOOL mShiny;
+
+ virtual U32 getVertexDataMask() override { return sVertexMask; }
- LLDrawPoolBump();
+ LLDrawPoolBump();
- /*virtual*/ void prerender() override;
+ /*virtual*/ void prerender() override;
- void pushBumpBatches(U32 type);
- void renderGroup(LLSpatialGroup* group, U32 type, bool texture) override;
-
- S32 numBumpPasses();
-
- void beginFullbrightShiny();
- void renderFullbrightShiny();
- void endFullbrightShiny();
+ void pushBumpBatches(U32 type);
+ void renderGroup(LLSpatialGroup* group, U32 type, bool texture) override;
- void beginBump();
- void renderBump(U32 pass = LLRenderPass::PASS_BUMP);
- void endBump(U32 pass = LLRenderPass::PASS_BUMP);
+ S32 numBumpPasses();
- static void bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel);
- static void unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel);
+ void beginFullbrightShiny();
+ void renderFullbrightShiny();
+ void endFullbrightShiny();
- virtual S32 getNumDeferredPasses() override;
- /*virtual*/ void renderDeferred(S32 pass) override;
+ void beginBump();
+ void renderBump(U32 pass = LLRenderPass::PASS_BUMP);
+ void endBump(U32 pass = LLRenderPass::PASS_BUMP);
+
+ static void bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel);
+ static void unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel);
+
+ virtual S32 getNumDeferredPasses() override;
+ /*virtual*/ void renderDeferred(S32 pass) override;
virtual S32 getNumPostDeferredPasses() override { return 1; }
- /*virtual*/ void renderPostDeferred(S32 pass) override;
+ /*virtual*/ void renderPostDeferred(S32 pass) override;
- static BOOL bindBumpMap(LLDrawInfo& params, S32 channel = -2);
- static BOOL bindBumpMap(LLFace* face, S32 channel = -2);
+ static BOOL bindBumpMap(LLDrawInfo& params, S32 channel = -2);
+ static BOOL bindBumpMap(LLFace* face, S32 channel = -2);
private:
- static BOOL bindBumpMap(U8 bump_code, LLViewerTexture* tex, S32 channel);
+ static BOOL bindBumpMap(U8 bump_code, LLViewerTexture* tex, S32 channel);
bool mRigged = false; // if true, doing a rigged pass
};
enum EBumpEffect
{
- BE_NO_BUMP = 0,
- BE_BRIGHTNESS = 1,
- BE_DARKNESS = 2,
- BE_STANDARD_0 = 3, // Standard must always be the last one
- BE_COUNT = 4
+ BE_NO_BUMP = 0,
+ BE_BRIGHTNESS = 1,
+ BE_DARKNESS = 2,
+ BE_STANDARD_0 = 3, // Standard must always be the last one
+ BE_COUNT = 4
};
////////////////////////////////////////////////////////////////
@@ -99,21 +99,21 @@ enum EBumpEffect
class LLStandardBumpmap
{
-public:
- LLStandardBumpmap() : mLabel() {}
- LLStandardBumpmap( const std::string& label ) : mLabel(label) {}
-
- std::string mLabel;
- LLPointer<LLViewerFetchedTexture> mImage;
+public:
+ LLStandardBumpmap() : mLabel() {}
+ LLStandardBumpmap( const std::string& label ) : mLabel(label) {}
+
+ std::string mLabel;
+ LLPointer<LLViewerFetchedTexture> mImage;
- static U32 sStandardBumpmapCount; // Number of valid values in gStandardBumpmapList[]
+ static U32 sStandardBumpmapCount; // Number of valid values in gStandardBumpmapList[]
- static void clear();
- static void addstandard();
+ static void clear();
+ static void addstandard();
- static void shutdown();
- static void restoreGL();
- static void destroyGL();
+ static void shutdown();
+ static void restoreGL();
+ static void destroyGL();
};
extern LLStandardBumpmap gStandardBumpmapList[TEM_BUMPMAP_COUNT];
@@ -126,33 +126,33 @@ struct LLBumpImageEntry;
class LLBumpImageList
{
public:
- LLBumpImageList() {}
- ~LLBumpImageList();
+ LLBumpImageList() {}
+ ~LLBumpImageList();
- void init();
- void shutdown();
- void clear();
- void destroyGL();
- void restoreGL();
- void updateImages();
+ void init();
+ void shutdown();
+ void clear();
+ void destroyGL();
+ void restoreGL();
+ void updateImages();
- LLViewerTexture* getBrightnessDarknessImage(LLViewerFetchedTexture* src_image, U8 bump_code);
- void addTextureStats(U8 bump, const LLUUID& base_image_id, F32 virtual_size);
+ LLViewerTexture* getBrightnessDarknessImage(LLViewerFetchedTexture* src_image, U8 bump_code);
+ void addTextureStats(U8 bump, const LLUUID& base_image_id, F32 virtual_size);
- static void onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
- static void onSourceDarknessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
- static void onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
- static void generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image);
+ static void onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
+ static void onSourceDarknessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
+ static void onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
+ static void generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image);
private:
- static void onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump );
+ static void onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump );
private:
- typedef std::unordered_map<LLUUID, LLPointer<LLViewerTexture> > bump_image_map_t;
- bump_image_map_t mBrightnessEntries;
- bump_image_map_t mDarknessEntries;
+ typedef std::unordered_map<LLUUID, LLPointer<LLViewerTexture> > bump_image_map_t;
+ bump_image_map_t mBrightnessEntries;
+ bump_image_map_t mDarknessEntries;
static LL::WorkQueue::weak_t sMainQueue;
static LL::WorkQueue::weak_t sTexUpdateQueue;
static LLRenderTarget sRenderTarget;
diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp
index c0e4ed38c1..a098230d91 100644
--- a/indra/newview/lldrawpoolmaterials.cpp
+++ b/indra/newview/lldrawpoolmaterials.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lldrawpool.cpp
* @brief LLDrawPoolMaterials class implementation
* @author Jonathan "Geenz" Goodman
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,18 +36,18 @@
LLDrawPoolMaterials::LLDrawPoolMaterials()
: LLRenderPass(LLDrawPool::POOL_MATERIALS)
{
-
+
}
void LLDrawPoolMaterials::prerender()
{
- mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
+ mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
}
S32 LLDrawPoolMaterials::getNumDeferredPasses()
{
// 12 render passes times 2 (one for each rigged and non rigged)
- return 12*2;
+ return 12*2;
}
void LLDrawPoolMaterials::beginDeferredPass(S32 pass)
@@ -56,34 +56,34 @@ void LLDrawPoolMaterials::beginDeferredPass(S32 pass)
bool rigged = false;
if (pass >= 12)
- {
+ {
rigged = true;
pass -= 12;
}
- U32 shader_idx[] =
- {
- 0, //LLRenderPass::PASS_MATERIAL,
- //1, //LLRenderPass::PASS_MATERIAL_ALPHA,
- 2, //LLRenderPass::PASS_MATERIAL_ALPHA_MASK,
- 3, //LLRenderPass::PASS_MATERIAL_ALPHA_GLOW,
- 4, //LLRenderPass::PASS_SPECMAP,
- //5, //LLRenderPass::PASS_SPECMAP_BLEND,
- 6, //LLRenderPass::PASS_SPECMAP_MASK,
- 7, //LLRenderPass::PASS_SPECMAP_GLOW,
- 8, //LLRenderPass::PASS_NORMMAP,
- //9, //LLRenderPass::PASS_NORMMAP_BLEND,
- 10, //LLRenderPass::PASS_NORMMAP_MASK,
- 11, //LLRenderPass::PASS_NORMMAP_GLOW,
- 12, //LLRenderPass::PASS_NORMSPEC,
- //13, //LLRenderPass::PASS_NORMSPEC_BLEND,
- 14, //LLRenderPass::PASS_NORMSPEC_MASK,
- 15, //LLRenderPass::PASS_NORMSPEC_GLOW,
- };
-
+ U32 shader_idx[] =
+ {
+ 0, //LLRenderPass::PASS_MATERIAL,
+ //1, //LLRenderPass::PASS_MATERIAL_ALPHA,
+ 2, //LLRenderPass::PASS_MATERIAL_ALPHA_MASK,
+ 3, //LLRenderPass::PASS_MATERIAL_ALPHA_GLOW,
+ 4, //LLRenderPass::PASS_SPECMAP,
+ //5, //LLRenderPass::PASS_SPECMAP_BLEND,
+ 6, //LLRenderPass::PASS_SPECMAP_MASK,
+ 7, //LLRenderPass::PASS_SPECMAP_GLOW,
+ 8, //LLRenderPass::PASS_NORMMAP,
+ //9, //LLRenderPass::PASS_NORMMAP_BLEND,
+ 10, //LLRenderPass::PASS_NORMMAP_MASK,
+ 11, //LLRenderPass::PASS_NORMMAP_GLOW,
+ 12, //LLRenderPass::PASS_NORMSPEC,
+ //13, //LLRenderPass::PASS_NORMSPEC_BLEND,
+ 14, //LLRenderPass::PASS_NORMSPEC_MASK,
+ 15, //LLRenderPass::PASS_NORMSPEC_GLOW,
+ };
+
U32 idx = shader_idx[pass];
-
+
mShader = &(gDeferredMaterialProgram[idx]);
-
+
if (rigged)
{
llassert(mShader->mRiggedVariant != nullptr);
@@ -95,35 +95,35 @@ void LLDrawPoolMaterials::beginDeferredPass(S32 pass)
void LLDrawPoolMaterials::endDeferredPass(S32 pass)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_MATERIAL;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_MATERIAL;
- mShader->unbind();
+ mShader->unbind();
- LLRenderPass::endRenderPass(pass);
+ LLRenderPass::endRenderPass(pass);
}
void LLDrawPoolMaterials::renderDeferred(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_MATERIAL;
- static const U32 type_list[] =
- {
- LLRenderPass::PASS_MATERIAL,
- //LLRenderPass::PASS_MATERIAL_ALPHA,
- LLRenderPass::PASS_MATERIAL_ALPHA_MASK,
- LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE,
- LLRenderPass::PASS_SPECMAP,
- //LLRenderPass::PASS_SPECMAP_BLEND,
- LLRenderPass::PASS_SPECMAP_MASK,
- LLRenderPass::PASS_SPECMAP_EMISSIVE,
- LLRenderPass::PASS_NORMMAP,
- //LLRenderPass::PASS_NORMMAP_BLEND,
- LLRenderPass::PASS_NORMMAP_MASK,
- LLRenderPass::PASS_NORMMAP_EMISSIVE,
- LLRenderPass::PASS_NORMSPEC,
- //LLRenderPass::PASS_NORMSPEC_BLEND,
- LLRenderPass::PASS_NORMSPEC_MASK,
- LLRenderPass::PASS_NORMSPEC_EMISSIVE,
- };
+ static const U32 type_list[] =
+ {
+ LLRenderPass::PASS_MATERIAL,
+ //LLRenderPass::PASS_MATERIAL_ALPHA,
+ LLRenderPass::PASS_MATERIAL_ALPHA_MASK,
+ LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE,
+ LLRenderPass::PASS_SPECMAP,
+ //LLRenderPass::PASS_SPECMAP_BLEND,
+ LLRenderPass::PASS_SPECMAP_MASK,
+ LLRenderPass::PASS_SPECMAP_EMISSIVE,
+ LLRenderPass::PASS_NORMMAP,
+ //LLRenderPass::PASS_NORMMAP_BLEND,
+ LLRenderPass::PASS_NORMMAP_MASK,
+ LLRenderPass::PASS_NORMMAP_EMISSIVE,
+ LLRenderPass::PASS_NORMSPEC,
+ //LLRenderPass::PASS_NORMSPEC_BLEND,
+ LLRenderPass::PASS_NORMSPEC_MASK,
+ LLRenderPass::PASS_NORMSPEC_EMISSIVE,
+ };
bool rigged = false;
if (pass >= 12)
@@ -132,17 +132,17 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
pass -= 12;
}
- llassert(pass < sizeof(type_list)/sizeof(U32));
+ llassert(pass < sizeof(type_list)/sizeof(U32));
- U32 type = type_list[pass];
+ U32 type = type_list[pass];
if (rigged)
{
type += 1;
}
- LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type);
- LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
-
+ LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type);
+ LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
+
F32 lastIntensity = 0.f;
F32 lastFullbright = 0.f;
F32 lastMinimumAlpha = 0.f;
@@ -185,11 +185,11 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
LLVOAvatar* lastAvatar = nullptr;
- for (LLCullResult::drawinfo_iterator i = begin; i != end; )
- {
+ for (LLCullResult::drawinfo_iterator i = begin; i != end; )
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_MATERIAL("materials draw loop");
- LLDrawInfo& params = **i;
-
+ LLDrawInfo& params = **i;
+
LLCullResult::increment_iterator(i, end);
if (specular > -1 && params.mSpecColor != lastSpecular)
@@ -203,7 +203,7 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
lastIntensity = params.mEnvIntensity;
glUniform1f(intensity, lastIntensity);
}
-
+
if (minAlpha > -1 && lastMinimumAlpha != params.mAlphaMaskCutoff)
{
lastMinimumAlpha = params.mAlphaMaskCutoff;
@@ -295,5 +295,5 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
}
- }
+ }
}
diff --git a/indra/newview/lldrawpoolmaterials.h b/indra/newview/lldrawpoolmaterials.h
index c46c053bd0..345697ffd1 100644
--- a/indra/newview/lldrawpoolmaterials.h
+++ b/indra/newview/lldrawpoolmaterials.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lldrawpoolmaterials.h
* @brief LLDrawPoolMaterials class definition
* @author Jonathan "Geenz" Goodman
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,31 +40,31 @@ class LLGLSLShader;
class LLDrawPoolMaterials : public LLRenderPass
{
- LLGLSLShader *mShader;
+ LLGLSLShader *mShader;
public:
- LLDrawPoolMaterials();
-
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_TEXCOORD1 |
- LLVertexBuffer::MAP_TEXCOORD2 |
- LLVertexBuffer::MAP_COLOR |
- LLVertexBuffer::MAP_TANGENT
- };
-
- U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
-
- void render(S32 pass = 0) override { }
- S32 getNumPasses() override {return 0;}
- void prerender() override;
-
- S32 getNumDeferredPasses() override;
- void beginDeferredPass(S32 pass) override;
- void endDeferredPass(S32 pass) override;
- void renderDeferred(S32 pass) override;
+ LLDrawPoolMaterials();
+
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_NORMAL |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_TEXCOORD1 |
+ LLVertexBuffer::MAP_TEXCOORD2 |
+ LLVertexBuffer::MAP_COLOR |
+ LLVertexBuffer::MAP_TANGENT
+ };
+
+ U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
+
+ void render(S32 pass = 0) override { }
+ S32 getNumPasses() override {return 0;}
+ void prerender() override;
+
+ S32 getNumDeferredPasses() override;
+ void beginDeferredPass(S32 pass) override;
+ void endDeferredPass(S32 pass) override;
+ void renderDeferred(S32 pass) override;
};
#endif //LL_LLDRAWPOOLMATERIALS_H
diff --git a/indra/newview/lldrawpoolpbropaque.cpp b/indra/newview/lldrawpoolpbropaque.cpp
index 86b790e2c5..303afa51db 100644
--- a/indra/newview/lldrawpoolpbropaque.cpp
+++ b/indra/newview/lldrawpoolpbropaque.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolpbropaque.cpp
* @brief LLDrawPoolGLTFPBR class implementation
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/lldrawpoolpbropaque.h b/indra/newview/lldrawpoolpbropaque.h
index c8a28461fa..a029a4ff44 100644
--- a/indra/newview/lldrawpoolpbropaque.h
+++ b/indra/newview/lldrawpoolpbropaque.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolpbropaque.h
* @brief LLDrawPoolPBrOpaque class definition
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index 696618f75b..2b0ae260dc 100644
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolsimple.cpp
* @brief LLDrawPoolSimple class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -78,43 +78,43 @@ void LLDrawPoolGlow::renderPostDeferred(S32 pass)
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLGLSLShader* shader = &gDeferredEmissiveProgram;
- LLGLEnable blend(GL_BLEND);
- gGL.flush();
- /// Get rid of z-fighting with non-glow pass.
- LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset(-1.0f, -1.0f);
- gGL.setSceneBlendType(LLRender::BT_ADD);
-
- LLGLDepthTest depth(GL_TRUE, GL_FALSE);
- gGL.setColorMask(false, true);
+ LLGLEnable blend(GL_BLEND);
+ gGL.flush();
+ /// Get rid of z-fighting with non-glow pass.
+ LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(-1.0f, -1.0f);
+ gGL.setSceneBlendType(LLRender::BT_ADD);
+
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE);
+ gGL.setColorMask(false, true);
//first pass -- static objects
setup_glow_shader(shader);
pushBatches(LLRenderPass::PASS_GLOW, true, true);
-
+
// second pass -- rigged objects
shader = shader->mRiggedVariant;
setup_glow_shader(shader);
pushRiggedBatches(LLRenderPass::PASS_GLOW_RIGGED, true, true);
-
+
gGL.setColorMask(true, false);
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
LLDrawPoolSimple::LLDrawPoolSimple() :
- LLRenderPass(POOL_SIMPLE)
+ LLRenderPass(POOL_SIMPLE)
{
}
static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MASK("Alpha Mask");
LLDrawPoolAlphaMask::LLDrawPoolAlphaMask() :
- LLRenderPass(POOL_ALPHA_MASK)
+ LLRenderPass(POOL_ALPHA_MASK)
{
}
LLDrawPoolFullbrightAlphaMask::LLDrawPoolFullbrightAlphaMask() :
- LLRenderPass(POOL_FULLBRIGHT_ALPHA_MASK)
+ LLRenderPass(POOL_FULLBRIGHT_ALPHA_MASK)
{
}
@@ -130,12 +130,12 @@ S32 LLDrawPoolSimple::getNumDeferredPasses()
void LLDrawPoolSimple::renderDeferred(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED);
- LLGLDisable blend(GL_BLEND);
+ LLGLDisable blend(GL_BLEND);
- //render static
+ //render static
setup_simple_shader(&gDeferredDiffuseProgram);
- pushBatches(LLRenderPass::PASS_SIMPLE, true, true);
-
+ pushBatches(LLRenderPass::PASS_SIMPLE, true, true);
+
//render rigged
setup_simple_shader(gDeferredDiffuseProgram.mRiggedVariant);
pushRiggedBatches(LLRenderPass::PASS_SIMPLE_RIGGED, true, true);
@@ -168,19 +168,19 @@ LLDrawPoolGrass::LLDrawPoolGrass() :
void LLDrawPoolGrass::renderDeferred(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- {
- gDeferredNonIndexedDiffuseAlphaMaskProgram.bind();
- gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f);
+ {
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.bind();
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f);
- //render grass
- LLRenderPass::pushBatches(LLRenderPass::PASS_GRASS, getVertexDataMask());
- }
+ //render grass
+ LLRenderPass::pushBatches(LLRenderPass::PASS_GRASS, getVertexDataMask());
+ }
}
// Fullbright drawpool
LLDrawPoolFullbright::LLDrawPoolFullbright() :
- LLRenderPass(POOL_FULLBRIGHT)
+ LLRenderPass(POOL_FULLBRIGHT)
{
}
@@ -198,12 +198,12 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass)
shader = &gDeferredFullbrightProgram;
}
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
-
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+
// render static
setup_fullbright_shader(shader);
pushBatches(LLRenderPass::PASS_FULLBRIGHT, true, true);
-
+
if (!LLPipeline::sRenderingHUDs)
{
// render rigged
@@ -215,7 +215,7 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass)
void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT);
-
+
LLGLSLShader* shader = nullptr;
if (LLPipeline::sRenderingHUDs)
{
@@ -227,11 +227,11 @@ void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass)
}
LLGLDisable blend(GL_BLEND);
-
+
// render static
setup_fullbright_shader(shader);
pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, true, true);
-
+
if (!LLPipeline::sRenderingHUDs)
{
// render rigged
diff --git a/indra/newview/lldrawpoolsimple.h b/indra/newview/lldrawpoolsimple.h
index a3b93c237e..da7fdaaa44 100644
--- a/indra/newview/lldrawpoolsimple.h
+++ b/indra/newview/lldrawpoolsimple.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolsimple.h
* @brief LLDrawPoolSimple class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,108 +34,108 @@ class LLGLSLShader;
class LLDrawPoolSimple final : public LLRenderPass
{
public:
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_COLOR
- };
- U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
-
- LLDrawPoolSimple();
-
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_NORMAL |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_COLOR
+ };
+ U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
+
+ LLDrawPoolSimple();
+
S32 getNumDeferredPasses() override;
- void renderDeferred(S32 pass) override;
+ void renderDeferred(S32 pass) override;
};
class LLDrawPoolGrass final : public LLRenderPass
{
public:
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_COLOR
- };
- U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
-
- LLDrawPoolGrass();
-
- S32 getNumDeferredPasses() override { return 1; }
- void renderDeferred(S32 pass) override;
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_NORMAL |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_COLOR
+ };
+ U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
+
+ LLDrawPoolGrass();
+
+ S32 getNumDeferredPasses() override { return 1; }
+ void renderDeferred(S32 pass) override;
};
class LLDrawPoolAlphaMask final : public LLRenderPass
{
public:
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_COLOR
- };
- U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_NORMAL |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_COLOR
+ };
+ U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
- LLDrawPoolAlphaMask();
+ LLDrawPoolAlphaMask();
S32 getNumDeferredPasses() override { return 1; }
- void renderDeferred(S32 pass) override;
+ void renderDeferred(S32 pass) override;
};
class LLDrawPoolFullbrightAlphaMask final : public LLRenderPass
{
public:
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_COLOR
- };
- U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
-
- LLDrawPoolFullbrightAlphaMask();
-
- S32 getNumPostDeferredPasses() override { return 1; }
- void renderPostDeferred(S32 pass) override;
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_COLOR
+ };
+ U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
+
+ LLDrawPoolFullbrightAlphaMask();
+
+ S32 getNumPostDeferredPasses() override { return 1; }
+ void renderPostDeferred(S32 pass) override;
};
class LLDrawPoolFullbright final : public LLRenderPass
{
public:
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_COLOR
- };
- U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
-
- LLDrawPoolFullbright();
-
- S32 getNumPostDeferredPasses() override { return 1; }
- void renderPostDeferred(S32 pass) override;
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_COLOR
+ };
+ U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
+
+ LLDrawPoolFullbright();
+
+ S32 getNumPostDeferredPasses() override { return 1; }
+ void renderPostDeferred(S32 pass) override;
};
class LLDrawPoolGlow final : public LLRenderPass
{
public:
- LLDrawPoolGlow(): LLRenderPass(LLDrawPool::POOL_GLOW) { }
-
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_EMISSIVE
- };
-
- U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
-
- S32 getNumPostDeferredPasses() override { return 1; }
- void renderPostDeferred(S32 pass) override;
+ LLDrawPoolGlow(): LLRenderPass(LLDrawPool::POOL_GLOW) { }
+
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_EMISSIVE
+ };
+
+ U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
+
+ S32 getNumPostDeferredPasses() override { return 1; }
+ void renderPostDeferred(S32 pass) override;
};
#endif // LL_LLDRAWPOOLSIMPLE_H
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index 3c5bfe4a1c..1e83426714 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolsky.cpp
* @brief LLDrawPoolSky class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,9 +31,9 @@
// DEPRECATED
LLDrawPoolSky::LLDrawPoolSky()
-: LLFacePool(POOL_SKY),
- mSkyTex(NULL),
- mShader(NULL)
+: LLFacePool(POOL_SKY),
+ mSkyTex(NULL),
+ mShader(NULL)
{
}
diff --git a/indra/newview/lldrawpoolsky.h b/indra/newview/lldrawpoolsky.h
index d1dcd6b22e..574afd0558 100644
--- a/indra/newview/lldrawpoolsky.h
+++ b/indra/newview/lldrawpoolsky.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolsky.h
* @brief LLDrawPoolSky class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,33 +35,33 @@ class LLGLSLShader;
class LLDrawPoolSky : public LLFacePool
{
private:
- LLSkyTex *mSkyTex;
- LLGLSLShader *mShader;
+ LLSkyTex *mSkyTex;
+ LLGLSLShader *mShader;
public:
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0
- };
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_TEXCOORD0
+ };
- virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
+ virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
- LLDrawPoolSky();
+ LLDrawPoolSky();
- /*virtual*/ S32 getNumPostDeferredPasses() { return getNumPasses(); }
- /*virtual*/ void beginPostDeferredPass(S32 pass) { beginRenderPass(pass); }
- /*virtual*/ void endPostDeferredPass(S32 pass) { endRenderPass(pass); }
- /*virtual*/ void renderPostDeferred(S32 pass) { render(pass); }
+ /*virtual*/ S32 getNumPostDeferredPasses() { return getNumPasses(); }
+ /*virtual*/ void beginPostDeferredPass(S32 pass) { beginRenderPass(pass); }
+ /*virtual*/ void endPostDeferredPass(S32 pass) { endRenderPass(pass); }
+ /*virtual*/ void renderPostDeferred(S32 pass) { render(pass); }
- /*virtual*/ void prerender();
- /*virtual*/ void render(S32 pass = 0);
- /*virtual*/ void endRenderPass(S32 pass);
- void setSkyTex(LLSkyTex* const st) { mSkyTex = st; }
+ /*virtual*/ void prerender();
+ /*virtual*/ void render(S32 pass = 0);
+ /*virtual*/ void endRenderPass(S32 pass);
+ void setSkyTex(LLSkyTex* const st) { mSkyTex = st; }
- void renderSkyFace(U8 index);
- void renderHeavenlyBody(U8 hb, LLFace* face);
- void renderSunHalo(LLFace* face);
+ void renderSkyFace(U8 index);
+ void renderHeavenlyBody(U8 hb, LLFace* face);
+ void renderSunHalo(LLFace* face);
};
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 77189dceae..c86c4b3472 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolterrain.cpp
* @brief LLDrawPoolTerrain class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,7 +39,7 @@
#include "llsurfacepatch.h"
#include "llviewerregion.h"
#include "llvlcomposition.h"
-#include "llviewerparcelmgr.h" // for gRenderParcelOwnership
+#include "llviewerparcelmgr.h" // for gRenderParcelOwnership
#include "llviewerparceloverlay.h"
#include "llvosurfacepatch.h"
#include "llviewercamera.h"
@@ -61,114 +61,114 @@ static LLTrace::BlockTimerStatHandle FTM_SHADOW_TERRAIN("Terrain Shadow");
LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
- LLFacePool(POOL_TERRAIN),
- mTexturep(texturep)
+ LLFacePool(POOL_TERRAIN),
+ mTexturep(texturep)
{
- // Hack!
- sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
- sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
- mAlphaRampImagep = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD);
-
- //gGL.getTexUnit(0)->bind(mAlphaRampImagep.get());
- mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
-
- m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD_2D);
-
- //gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
- m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
-
- mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
-
- //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ // Hack!
+ sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
+ sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
+ mAlphaRampImagep = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD);
+
+ //gGL.getTexUnit(0)->bind(mAlphaRampImagep.get());
+ mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
+
+ m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD_2D);
+
+ //gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
+ m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
+
+ mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
+
+ //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
LLDrawPoolTerrain::~LLDrawPoolTerrain()
{
- llassert( gPipeline.findPool( getType(), getTexture() ) == NULL );
+ llassert( gPipeline.findPool( getType(), getTexture() ) == NULL );
}
-U32 LLDrawPoolTerrain::getVertexDataMask()
-{
- if (LLPipeline::sShadowRender)
- {
- return LLVertexBuffer::MAP_VERTEX;
- }
- else if (LLGLSLShader::sCurBoundShaderPtr)
- {
- return VERTEX_DATA_MASK & ~(LLVertexBuffer::MAP_TEXCOORD2 | LLVertexBuffer::MAP_TEXCOORD3);
- }
- else
- {
- return VERTEX_DATA_MASK;
- }
+U32 LLDrawPoolTerrain::getVertexDataMask()
+{
+ if (LLPipeline::sShadowRender)
+ {
+ return LLVertexBuffer::MAP_VERTEX;
+ }
+ else if (LLGLSLShader::sCurBoundShaderPtr)
+ {
+ return VERTEX_DATA_MASK & ~(LLVertexBuffer::MAP_TEXCOORD2 | LLVertexBuffer::MAP_TEXCOORD3);
+ }
+ else
+ {
+ return VERTEX_DATA_MASK;
+ }
}
void LLDrawPoolTerrain::prerender()
{
- sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
+ sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
}
//static
S32 LLDrawPoolTerrain::getDetailMode()
{
- return sDetailMode;
+ return sDetailMode;
}
void LLDrawPoolTerrain::boostTerrainDetailTextures()
{
// Hack! Get the region that this draw pool is rendering from!
- LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
- LLVLComposition *compp = regionp->getComposition();
- for (S32 i = 0; i < 4; i++)
- {
- compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
+ LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
+ LLVLComposition *compp = regionp->getComposition();
+ for (S32 i = 0; i < 4; i++)
+ {
+ compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
compp->mDetailTextures[i]->addTextureStats(1024.f * 1024.f);
- }
+ }
}
void LLDrawPoolTerrain::beginDeferredPass(S32 pass)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
- LLFacePool::beginRenderPass(pass);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
+ LLFacePool::beginRenderPass(pass);
- sShader = &gDeferredTerrainProgram;
+ sShader = &gDeferredTerrainProgram;
- sShader->bind();
+ sShader->bind();
}
void LLDrawPoolTerrain::endDeferredPass(S32 pass)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
- LLFacePool::endRenderPass(pass);
- sShader->unbind();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
+ LLFacePool::endRenderPass(pass);
+ sShader->unbind();
}
void LLDrawPoolTerrain::renderDeferred(S32 pass)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
- if (mDrawFace.empty())
- {
- return;
- }
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
+ if (mDrawFace.empty())
+ {
+ return;
+ }
boostTerrainDetailTextures();
- renderFullShader();
+ renderFullShader();
- // Special-case for land ownership feedback
- if (gSavedSettings.getBOOL("ShowParcelOwners"))
- {
- hilightParcelOwners();
- }
+ // Special-case for land ownership feedback
+ if (gSavedSettings.getBOOL("ShowParcelOwners"))
+ {
+ hilightParcelOwners();
+ }
}
void LLDrawPoolTerrain::beginShadowPass(S32 pass)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN);
- LLFacePool::beginRenderPass(pass);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gDeferredShadowProgram.bind();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN);
+ LLFacePool::beginRenderPass(pass);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gDeferredShadowProgram.bind();
LLEnvironment& environment = LLEnvironment::instance();
gDeferredShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
@@ -176,614 +176,614 @@ void LLDrawPoolTerrain::beginShadowPass(S32 pass)
void LLDrawPoolTerrain::endShadowPass(S32 pass)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN);
- LLFacePool::endRenderPass(pass);
- gDeferredShadowProgram.unbind();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN);
+ LLFacePool::endRenderPass(pass);
+ gDeferredShadowProgram.unbind();
}
void LLDrawPoolTerrain::renderShadow(S32 pass)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN);
- if (mDrawFace.empty())
- {
- return;
- }
- //LLGLEnable offset(GL_POLYGON_OFFSET);
- //glCullFace(GL_FRONT);
- drawLoop();
- //glCullFace(GL_BACK);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN);
+ if (mDrawFace.empty())
+ {
+ return;
+ }
+ //LLGLEnable offset(GL_POLYGON_OFFSET);
+ //glCullFace(GL_FRONT);
+ drawLoop();
+ //glCullFace(GL_BACK);
}
void LLDrawPoolTerrain::drawLoop()
{
- if (!mDrawFace.empty())
- {
- for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
- iter != mDrawFace.end(); iter++)
- {
- LLFace *facep = *iter;
-
- LLMatrix4* model_matrix = &(facep->getDrawable()->getRegion()->mRenderMatrix);
-
- if (model_matrix != gGLLastMatrix)
- {
- llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
- gGLLastMatrix = model_matrix;
- gGL.loadMatrix(gGLModelView);
- if (model_matrix)
- {
- gGL.multMatrix((GLfloat*) model_matrix->mMatrix);
- }
- gPipeline.mMatrixOpCount++;
- }
-
- facep->renderIndexed();
- }
- }
+ if (!mDrawFace.empty())
+ {
+ for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
+ iter != mDrawFace.end(); iter++)
+ {
+ LLFace *facep = *iter;
+
+ LLMatrix4* model_matrix = &(facep->getDrawable()->getRegion()->mRenderMatrix);
+
+ if (model_matrix != gGLLastMatrix)
+ {
+ llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
+ gGLLastMatrix = model_matrix;
+ gGL.loadMatrix(gGLModelView);
+ if (model_matrix)
+ {
+ gGL.multMatrix((GLfloat*) model_matrix->mMatrix);
+ }
+ gPipeline.mMatrixOpCount++;
+ }
+
+ facep->renderIndexed();
+ }
+ }
}
void LLDrawPoolTerrain::renderFullShader()
{
- // Hack! Get the region that this draw pool is rendering from!
- LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
- LLVLComposition *compp = regionp->getComposition();
- LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
- LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
- LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
- LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
-
- LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
- F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
- F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
-
- LLVector4 tp0, tp1;
-
- tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
- tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
-
- //
- // detail texture 0
- //
- S32 detail0 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
- gGL.getTexUnit(detail0)->bind(detail_texture0p);
+ // Hack! Get the region that this draw pool is rendering from!
+ LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
+ LLVLComposition *compp = regionp->getComposition();
+ LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
+ LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
+ LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
+ LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
+
+ LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
+ F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
+ F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
+
+ LLVector4 tp0, tp1;
+
+ tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
+ tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
+
+ //
+ // detail texture 0
+ //
+ S32 detail0 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
+ gGL.getTexUnit(detail0)->bind(detail_texture0p);
gGL.getTexUnit(detail0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
- gGL.getTexUnit(detail0)->activate();
+ gGL.getTexUnit(detail0)->activate();
- LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
- llassert(shader);
-
- shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
- shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ llassert(shader);
+
+ shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
+ shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
- //
- // detail texture 1
- //
- S32 detail1 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
- gGL.getTexUnit(detail1)->bind(detail_texture1p);
- gGL.getTexUnit(detail1)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
- gGL.getTexUnit(detail1)->activate();
-
- // detail texture 2
- //
- S32 detail2 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
- gGL.getTexUnit(detail2)->bind(detail_texture2p);
+ //
+ // detail texture 1
+ //
+ S32 detail1 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
+ gGL.getTexUnit(detail1)->bind(detail_texture1p);
+ gGL.getTexUnit(detail1)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+ gGL.getTexUnit(detail1)->activate();
+
+ // detail texture 2
+ //
+ S32 detail2 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
+ gGL.getTexUnit(detail2)->bind(detail_texture2p);
gGL.getTexUnit(detail2)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
- gGL.getTexUnit(detail2)->activate();
-
-
- // detail texture 3
- //
- S32 detail3 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
- gGL.getTexUnit(detail3)->bind(detail_texture3p);
- gGL.getTexUnit(detail3)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
- gGL.getTexUnit(detail3)->activate();
-
- //
- // Alpha Ramp
- //
- S32 alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
- gGL.getTexUnit(alpha_ramp)->bind(m2DAlphaRampImagep);
+ gGL.getTexUnit(detail2)->activate();
+
+
+ // detail texture 3
+ //
+ S32 detail3 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
+ gGL.getTexUnit(detail3)->bind(detail_texture3p);
+ gGL.getTexUnit(detail3)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+ gGL.getTexUnit(detail3)->activate();
+
+ //
+ // Alpha Ramp
+ //
+ S32 alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
+ gGL.getTexUnit(alpha_ramp)->bind(m2DAlphaRampImagep);
gGL.getTexUnit(alpha_ramp)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- // GL_BLEND disabled by default
- drawLoop();
-
- // Disable multitexture
- sShader->disableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
- sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
- sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
- sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
- sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
-
- gGL.getTexUnit(alpha_ramp)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(alpha_ramp)->disable();
- gGL.getTexUnit(alpha_ramp)->activate();
-
- gGL.getTexUnit(detail3)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(detail3)->disable();
- gGL.getTexUnit(detail3)->activate();
-
- gGL.getTexUnit(detail2)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(detail2)->disable();
- gGL.getTexUnit(detail2)->activate();
-
- gGL.getTexUnit(detail1)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(detail1)->disable();
- gGL.getTexUnit(detail1)->activate();
-
- //----------------------------------------------------------------------------
- // Restore Texture Unit 0 defaults
-
- gGL.getTexUnit(detail0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(detail0)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(detail0)->activate();
+ // GL_BLEND disabled by default
+ drawLoop();
+
+ // Disable multitexture
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
+
+ gGL.getTexUnit(alpha_ramp)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(alpha_ramp)->disable();
+ gGL.getTexUnit(alpha_ramp)->activate();
+
+ gGL.getTexUnit(detail3)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail3)->disable();
+ gGL.getTexUnit(detail3)->activate();
+
+ gGL.getTexUnit(detail2)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail2)->disable();
+ gGL.getTexUnit(detail2)->activate();
+
+ gGL.getTexUnit(detail1)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail1)->disable();
+ gGL.getTexUnit(detail1)->activate();
+
+ //----------------------------------------------------------------------------
+ // Restore Texture Unit 0 defaults
+
+ gGL.getTexUnit(detail0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail0)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail0)->activate();
}
void LLDrawPoolTerrain::hilightParcelOwners()
{
- { //use fullbright shader for highlighting
- LLGLSLShader* old_shader = sShader;
- sShader->unbind();
- sShader = &gDeferredHighlightProgram;
- sShader->bind();
- gGL.diffuseColor4f(1, 1, 1, 1);
- LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset(-1.0f, -1.0f);
- renderOwnership();
- sShader = old_shader;
- sShader->bind();
- }
-
+ { //use fullbright shader for highlighting
+ LLGLSLShader* old_shader = sShader;
+ sShader->unbind();
+ sShader = &gDeferredHighlightProgram;
+ sShader->bind();
+ gGL.diffuseColor4f(1, 1, 1, 1);
+ LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(-1.0f, -1.0f);
+ renderOwnership();
+ sShader = old_shader;
+ sShader->bind();
+ }
+
}
void LLDrawPoolTerrain::renderFull4TU()
{
- // Hack! Get the region that this draw pool is rendering from!
- LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
- LLVLComposition *compp = regionp->getComposition();
- LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
- LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
- LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
- LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
-
- LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
- F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
- F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
-
- LLVector4 tp0, tp1;
-
- tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
- tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
-
- gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA);
-
- //----------------------------------------------------------------------------
- // Pass 1/1
-
- //
- // Stage 0: detail texture 0
- //
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->bind(detail_texture0p);
-
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
-
- glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-
- //
- // Stage 1: Generate alpha ramp for detail0/detail1 transition
- //
-
- gGL.getTexUnit(1)->bind(m2DAlphaRampImagep.get());
- gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(1)->activate();
-
- //
- // Stage 2: Interpolate detail1 with existing based on ramp
- //
- gGL.getTexUnit(2)->bind(detail_texture1p);
- gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(2)->activate();
-
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-
- //
- // Stage 3: Modulate with primary (vertex) color for lighting
- //
- gGL.getTexUnit(3)->bind(detail_texture1p);
- gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(3)->activate();
-
- gGL.getTexUnit(0)->activate();
-
- // GL_BLEND disabled by default
- drawLoop();
-
- //----------------------------------------------------------------------------
- // Second pass
-
- // Stage 0: Write detail3 into base
- //
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->bind(detail_texture3p);
-
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-
- //
- // Stage 1: Generate alpha ramp for detail2/detail3 transition
- //
- gGL.getTexUnit(1)->bind(m2DAlphaRampImagep);
- gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(1)->activate();
-
- // Set the texture matrix
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.translatef(-2.f, 0.f, 0.f);
-
- //
- // Stage 2: Interpolate detail2 with existing based on ramp
- //
- gGL.getTexUnit(2)->bind(detail_texture2p);
- gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(2)->activate();
-
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-
- //
- // Stage 3: Generate alpha ramp for detail1/detail2 transition
- //
- gGL.getTexUnit(3)->bind(m2DAlphaRampImagep);
- gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(3)->activate();
-
- // Set the texture matrix
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.translatef(-1.f, 0.f, 0.f);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- gGL.getTexUnit(0)->activate();
- {
- LLGLEnable blend(GL_BLEND);
- drawLoop();
- }
-
- LLVertexBuffer::unbind();
- // Disable multitexture
- gGL.getTexUnit(3)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(3)->disable();
- gGL.getTexUnit(3)->activate();
-
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(2)->disable();
- gGL.getTexUnit(2)->activate();
-
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(1)->disable();
- gGL.getTexUnit(1)->activate();
-
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- // Restore blend state
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
-
- //----------------------------------------------------------------------------
- // Restore Texture Unit 0 defaults
-
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
-
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
+ // Hack! Get the region that this draw pool is rendering from!
+ LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
+ LLVLComposition *compp = regionp->getComposition();
+ LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
+ LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
+ LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
+ LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
+
+ LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
+ F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
+ F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
+
+ LLVector4 tp0, tp1;
+
+ tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
+ tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
+
+ gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA);
+
+ //----------------------------------------------------------------------------
+ // Pass 1/1
+
+ //
+ // Stage 0: detail texture 0
+ //
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->bind(detail_texture0p);
+
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+
+ glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
+ glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
+
+ //
+ // Stage 1: Generate alpha ramp for detail0/detail1 transition
+ //
+
+ gGL.getTexUnit(1)->bind(m2DAlphaRampImagep.get());
+ gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->activate();
+
+ //
+ // Stage 2: Interpolate detail1 with existing based on ramp
+ //
+ gGL.getTexUnit(2)->bind(detail_texture1p);
+ gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(2)->activate();
+
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
+ glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
+
+ //
+ // Stage 3: Modulate with primary (vertex) color for lighting
+ //
+ gGL.getTexUnit(3)->bind(detail_texture1p);
+ gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(3)->activate();
+
+ gGL.getTexUnit(0)->activate();
+
+ // GL_BLEND disabled by default
+ drawLoop();
+
+ //----------------------------------------------------------------------------
+ // Second pass
+
+ // Stage 0: Write detail3 into base
+ //
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->bind(detail_texture3p);
+
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
+ glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
+
+ //
+ // Stage 1: Generate alpha ramp for detail2/detail3 transition
+ //
+ gGL.getTexUnit(1)->bind(m2DAlphaRampImagep);
+ gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->activate();
+
+ // Set the texture matrix
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-2.f, 0.f, 0.f);
+
+ //
+ // Stage 2: Interpolate detail2 with existing based on ramp
+ //
+ gGL.getTexUnit(2)->bind(detail_texture2p);
+ gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(2)->activate();
+
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
+ glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
+
+ //
+ // Stage 3: Generate alpha ramp for detail1/detail2 transition
+ //
+ gGL.getTexUnit(3)->bind(m2DAlphaRampImagep);
+ gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(3)->activate();
+
+ // Set the texture matrix
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-1.f, 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ gGL.getTexUnit(0)->activate();
+ {
+ LLGLEnable blend(GL_BLEND);
+ drawLoop();
+ }
+
+ LLVertexBuffer::unbind();
+ // Disable multitexture
+ gGL.getTexUnit(3)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(3)->disable();
+ gGL.getTexUnit(3)->activate();
+
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(2)->disable();
+ gGL.getTexUnit(2)->activate();
+
+ glDisable(GL_TEXTURE_GEN_S);
+ glDisable(GL_TEXTURE_GEN_T);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->disable();
+ gGL.getTexUnit(1)->activate();
+
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ // Restore blend state
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+
+ //----------------------------------------------------------------------------
+ // Restore Texture Unit 0 defaults
+
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+
+ glDisable(GL_TEXTURE_GEN_S);
+ glDisable(GL_TEXTURE_GEN_T);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
void LLDrawPoolTerrain::renderFull2TU()
{
- // Hack! Get the region that this draw pool is rendering from!
- LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
- LLVLComposition *compp = regionp->getComposition();
- LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
- LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
- LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
- LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
-
- LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
- F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
- F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
-
- LLVector4 tp0, tp1;
-
- tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
- tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
-
- gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA);
-
- //----------------------------------------------------------------------------
- // Pass 1/4
-
- //
- // Stage 0: Render detail 0 into base
- //
- gGL.getTexUnit(0)->bind(detail_texture0p);
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
-
- glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-
- drawLoop();
-
- //----------------------------------------------------------------------------
- // Pass 2/4
-
- //
- // Stage 0: Generate alpha ramp for detail0/detail1 transition
- //
- gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
-
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
-
- //
- // Stage 1: Write detail1
- //
- gGL.getTexUnit(1)->bind(detail_texture1p);
- gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(1)->activate();
-
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-
- gGL.getTexUnit(0)->activate();
- {
- LLGLEnable blend(GL_BLEND);
- drawLoop();
- }
- //----------------------------------------------------------------------------
- // Pass 3/4
-
- //
- // Stage 0: Generate alpha ramp for detail1/detail2 transition
- //
- gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
-
- // Set the texture matrix
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.translatef(-1.f, 0.f, 0.f);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- //
- // Stage 1: Write detail2
- //
- gGL.getTexUnit(1)->bind(detail_texture2p);
- gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(1)->activate();
-
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-
- {
- LLGLEnable blend(GL_BLEND);
- drawLoop();
- }
-
- //----------------------------------------------------------------------------
- // Pass 4/4
-
- //
- // Stage 0: Generate alpha ramp for detail2/detail3 transition
- //
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
- // Set the texture matrix
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.translatef(-2.f, 0.f, 0.f);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- // Stage 1: Write detail3
- gGL.getTexUnit(1)->bind(detail_texture3p);
- gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(1)->activate();
-
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
-
- gGL.getTexUnit(0)->activate();
- {
- LLGLEnable blend(GL_BLEND);
- drawLoop();
- }
-
- // Restore blend state
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
-
- // Disable multitexture
-
- gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(1)->disable();
- gGL.getTexUnit(1)->activate();
-
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- //----------------------------------------------------------------------------
- // Restore Texture Unit 0 defaults
-
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
+ // Hack! Get the region that this draw pool is rendering from!
+ LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
+ LLVLComposition *compp = regionp->getComposition();
+ LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
+ LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
+ LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
+ LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
+
+ LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
+ F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
+ F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
+
+ LLVector4 tp0, tp1;
+
+ tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
+ tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
+
+ gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA);
+
+ //----------------------------------------------------------------------------
+ // Pass 1/4
+
+ //
+ // Stage 0: Render detail 0 into base
+ //
+ gGL.getTexUnit(0)->bind(detail_texture0p);
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+
+ glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
+ glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
+
+ drawLoop();
+
+ //----------------------------------------------------------------------------
+ // Pass 2/4
+
+ //
+ // Stage 0: Generate alpha ramp for detail0/detail1 transition
+ //
+ gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
+
+ glDisable(GL_TEXTURE_GEN_S);
+ glDisable(GL_TEXTURE_GEN_T);
+
+ //
+ // Stage 1: Write detail1
+ //
+ gGL.getTexUnit(1)->bind(detail_texture1p);
+ gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->activate();
+
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
+ glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
+
+ gGL.getTexUnit(0)->activate();
+ {
+ LLGLEnable blend(GL_BLEND);
+ drawLoop();
+ }
+ //----------------------------------------------------------------------------
+ // Pass 3/4
+
+ //
+ // Stage 0: Generate alpha ramp for detail1/detail2 transition
+ //
+ gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
+
+ // Set the texture matrix
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-1.f, 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ //
+ // Stage 1: Write detail2
+ //
+ gGL.getTexUnit(1)->bind(detail_texture2p);
+ gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->activate();
+
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
+ glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
+
+ {
+ LLGLEnable blend(GL_BLEND);
+ drawLoop();
+ }
+
+ //----------------------------------------------------------------------------
+ // Pass 4/4
+
+ //
+ // Stage 0: Generate alpha ramp for detail2/detail3 transition
+ //
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
+ // Set the texture matrix
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-2.f, 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ // Stage 1: Write detail3
+ gGL.getTexUnit(1)->bind(detail_texture3p);
+ gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->activate();
+
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
+ glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
+
+ gGL.getTexUnit(0)->activate();
+ {
+ LLGLEnable blend(GL_BLEND);
+ drawLoop();
+ }
+
+ // Restore blend state
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+
+ // Disable multitexture
+
+ gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->disable();
+ gGL.getTexUnit(1)->activate();
+
+ glDisable(GL_TEXTURE_GEN_S);
+ glDisable(GL_TEXTURE_GEN_T);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ //----------------------------------------------------------------------------
+ // Restore Texture Unit 0 defaults
+
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ glDisable(GL_TEXTURE_GEN_S);
+ glDisable(GL_TEXTURE_GEN_T);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
void LLDrawPoolTerrain::renderSimple()
{
- LLVector4 tp0, tp1;
-
- //----------------------------------------------------------------------------
- // Pass 1/1
-
- // Stage 0: Base terrain texture pass
- mTexturep->addTextureStats(1024.f*1024.f);
-
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(0)->bind(mTexturep);
-
- LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
- F32 tscale = 1.f/256.f;
- tp0.setVec(tscale, 0.f, 0.0f, -1.f*(origin_agent.mV[0]/256.f));
- tp1.setVec(0.f, tscale, 0.0f, -1.f*(origin_agent.mV[1]/256.f));
-
- sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
- sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
-
- drawLoop();
-
- //----------------------------------------------------------------------------
- // Restore Texture Unit 0 defaults
-
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
+ LLVector4 tp0, tp1;
+
+ //----------------------------------------------------------------------------
+ // Pass 1/1
+
+ // Stage 0: Base terrain texture pass
+ mTexturep->addTextureStats(1024.f*1024.f);
+
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->bind(mTexturep);
+
+ LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
+ F32 tscale = 1.f/256.f;
+ tp0.setVec(tscale, 0.f, 0.0f, -1.f*(origin_agent.mV[0]/256.f));
+ tp1.setVec(0.f, tscale, 0.0f, -1.f*(origin_agent.mV[1]/256.f));
+
+ sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
+ sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
+
+ drawLoop();
+
+ //----------------------------------------------------------------------------
+ // Restore Texture Unit 0 defaults
+
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
//============================================================================
void LLDrawPoolTerrain::renderOwnership()
{
- LLGLSPipelineAlpha gls_pipeline_alpha;
-
- llassert(!mDrawFace.empty());
-
- // Each terrain pool is associated with a single region.
- // We need to peek back into the viewer's data to find out
- // which ownership overlay texture to use.
- LLFace *facep = mDrawFace[0];
- LLDrawable *drawablep = facep->getDrawable();
- const LLViewerObject *objectp = drawablep->getVObj();
- const LLVOSurfacePatch *vo_surface_patchp = (LLVOSurfacePatch *)objectp;
- LLSurfacePatch *surface_patchp = vo_surface_patchp->getPatch();
- LLSurface *surfacep = surface_patchp->getSurface();
- LLViewerRegion *regionp = surfacep->getRegion();
- LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay();
- LLViewerTexture *texturep = overlayp->getTexture();
-
- gGL.getTexUnit(0)->bind(texturep);
-
- // *NOTE: Because the region is 256 meters wide, but has 257 pixels, the
- // texture coordinates for pixel 256x256 is not 1,1. This makes the
- // ownership map not line up with the selection. We address this with
- // a texture matrix multiply.
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.pushMatrix();
-
- const F32 TEXTURE_FUDGE = 257.f / 256.f;
- gGL.scalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f );
- for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
- iter != mDrawFace.end(); iter++)
- {
- LLFace *facep = *iter;
- facep->renderIndexed();
- }
-
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
+ LLGLSPipelineAlpha gls_pipeline_alpha;
+
+ llassert(!mDrawFace.empty());
+
+ // Each terrain pool is associated with a single region.
+ // We need to peek back into the viewer's data to find out
+ // which ownership overlay texture to use.
+ LLFace *facep = mDrawFace[0];
+ LLDrawable *drawablep = facep->getDrawable();
+ const LLViewerObject *objectp = drawablep->getVObj();
+ const LLVOSurfacePatch *vo_surface_patchp = (LLVOSurfacePatch *)objectp;
+ LLSurfacePatch *surface_patchp = vo_surface_patchp->getPatch();
+ LLSurface *surfacep = surface_patchp->getSurface();
+ LLViewerRegion *regionp = surfacep->getRegion();
+ LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay();
+ LLViewerTexture *texturep = overlayp->getTexture();
+
+ gGL.getTexUnit(0)->bind(texturep);
+
+ // *NOTE: Because the region is 256 meters wide, but has 257 pixels, the
+ // texture coordinates for pixel 256x256 is not 1,1. This makes the
+ // ownership map not line up with the selection. We address this with
+ // a texture matrix multiply.
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.pushMatrix();
+
+ const F32 TEXTURE_FUDGE = 257.f / 256.f;
+ gGL.scalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f );
+ for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
+ iter != mDrawFace.end(); iter++)
+ {
+ LLFace *facep = *iter;
+ facep->renderIndexed();
+ }
+
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
void LLDrawPoolTerrain::dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(mTexturep) ;
- if (tex && textures.find(tex) != textures.end())
- {
- for (std::vector<LLFace*>::iterator iter = mReferences.begin();
- iter != mReferences.end(); iter++)
- {
- LLFace *facep = *iter;
- gPipeline.markTextured(facep->getDrawable());
- }
- }
+ LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(mTexturep) ;
+ if (tex && textures.find(tex) != textures.end())
+ {
+ for (std::vector<LLFace*>::iterator iter = mReferences.begin();
+ iter != mReferences.end(); iter++)
+ {
+ LLFace *facep = *iter;
+ gPipeline.markTextured(facep->getDrawable());
+ }
+ }
}
LLViewerTexture *LLDrawPoolTerrain::getTexture()
{
- return mTexturep;
+ return mTexturep;
}
LLViewerTexture *LLDrawPoolTerrain::getDebugTexture()
{
- return mTexturep;
+ return mTexturep;
}
LLColor3 LLDrawPoolTerrain::getDebugColor() const
{
- return LLColor3(0.f, 0.f, 1.f);
+ return LLColor3(0.f, 0.f, 1.f);
}
diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h
index 03bef31541..2c27733f37 100644
--- a/indra/newview/lldrawpoolterrain.h
+++ b/indra/newview/lldrawpoolterrain.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolterrain.h
* @brief LLDrawPoolTerrain class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,7 +31,7 @@
class LLDrawPoolTerrain : public LLFacePool
{
- LLPointer<LLViewerTexture> mTexturep;
+ LLPointer<LLViewerTexture> mTexturep;
public:
enum
{
@@ -39,50 +39,50 @@ public:
LLVertexBuffer::MAP_NORMAL |
LLVertexBuffer::MAP_TEXCOORD0 |
LLVertexBuffer::MAP_TEXCOORD1
- };
+ };
- virtual U32 getVertexDataMask();
- static S32 getDetailMode();
+ virtual U32 getVertexDataMask();
+ static S32 getDetailMode();
- LLDrawPoolTerrain(LLViewerTexture *texturep);
- virtual ~LLDrawPoolTerrain();
+ LLDrawPoolTerrain(LLViewerTexture *texturep);
+ virtual ~LLDrawPoolTerrain();
- /*virtual*/ S32 getNumDeferredPasses() { return 1; }
- /*virtual*/ void beginDeferredPass(S32 pass);
- /*virtual*/ void endDeferredPass(S32 pass);
- /*virtual*/ void renderDeferred(S32 pass);
+ /*virtual*/ S32 getNumDeferredPasses() { return 1; }
+ /*virtual*/ void beginDeferredPass(S32 pass);
+ /*virtual*/ void endDeferredPass(S32 pass);
+ /*virtual*/ void renderDeferred(S32 pass);
- /*virtual*/ S32 getNumShadowPasses() { return 1; }
- /*virtual*/ void beginShadowPass(S32 pass);
- /*virtual*/ void endShadowPass(S32 pass);
- /*virtual*/ void renderShadow(S32 pass);
+ /*virtual*/ S32 getNumShadowPasses() { return 1; }
+ /*virtual*/ void beginShadowPass(S32 pass);
+ /*virtual*/ void endShadowPass(S32 pass);
+ /*virtual*/ void renderShadow(S32 pass);
- /*virtual*/ void prerender();
- /*virtual*/ void dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures);
- /*virtual*/ LLViewerTexture *getTexture();
- /*virtual*/ LLViewerTexture *getDebugTexture();
- /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
+ /*virtual*/ void prerender();
+ /*virtual*/ void dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures);
+ /*virtual*/ LLViewerTexture *getTexture();
+ /*virtual*/ LLViewerTexture *getDebugTexture();
+ /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
- LLPointer<LLViewerTexture> mAlphaRampImagep;
- LLPointer<LLViewerTexture> m2DAlphaRampImagep;
- LLPointer<LLViewerTexture> mAlphaNoiseImagep;
+ LLPointer<LLViewerTexture> mAlphaRampImagep;
+ LLPointer<LLViewerTexture> m2DAlphaRampImagep;
+ LLPointer<LLViewerTexture> mAlphaNoiseImagep;
- static S32 sDetailMode;
- static F32 sDetailScale; // meters per texture
+ static S32 sDetailMode;
+ static F32 sDetailScale; // meters per texture
protected:
void boostTerrainDetailTextures();
- void renderSimple();
- void renderOwnership();
+ void renderSimple();
+ void renderOwnership();
- void renderFull2TU();
- void renderFull4TU();
- void renderFullShader();
- void drawLoop();
+ void renderFull2TU();
+ void renderFull4TU();
+ void renderFullShader();
+ void drawLoop();
private:
- void hilightParcelOwners();
+ void hilightParcelOwners();
};
#endif // LL_LLDRAWPOOLSIMPLE_H
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index 9dcbc48697..7b359c757a 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpooltree.cpp
* @brief LLDrawPoolTree class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,10 +44,10 @@ S32 LLDrawPoolTree::sDiffTex = 0;
static LLGLSLShader* shader = NULL;
LLDrawPoolTree::LLDrawPoolTree(LLViewerTexture *texturep) :
- LLFacePool(POOL_TREE),
- mTexturep(texturep)
+ LLFacePool(POOL_TREE),
+ mTexturep(texturep)
{
- mTexturep->setAddressMode(LLTexUnit::TAM_WRAP);
+ mTexturep->setAddressMode(LLTexUnit::TAM_WRAP);
}
//============================================
@@ -55,11 +55,11 @@ LLDrawPoolTree::LLDrawPoolTree(LLViewerTexture *texturep) :
//============================================
void LLDrawPoolTree::beginDeferredPass(S32 pass)
{
- LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES);
-
- shader = &gDeferredTreeProgram;
- shader->bind();
- shader->setMinimumAlpha(0.5f);
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES);
+
+ shader = &gDeferredTreeProgram;
+ shader->bind();
+ shader->setMinimumAlpha(0.5f);
}
void LLDrawPoolTree::renderDeferred(S32 pass)
@@ -105,9 +105,9 @@ void LLDrawPoolTree::renderDeferred(S32 pass)
void LLDrawPoolTree::endDeferredPass(S32 pass)
{
- LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES);
-
- shader->unbind();
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES);
+
+ shader->unbind();
}
//============================================
@@ -116,49 +116,49 @@ void LLDrawPoolTree::endDeferredPass(S32 pass)
void LLDrawPoolTree::beginShadowPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED;
-
- glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"),
- gSavedSettings.getF32("RenderDeferredTreeShadowBias"));
+
+ glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"),
+ gSavedSettings.getF32("RenderDeferredTreeShadowBias"));
LLEnvironment& environment = LLEnvironment::instance();
- gDeferredTreeShadowProgram.bind();
+ gDeferredTreeShadowProgram.bind();
gDeferredTreeShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
- gDeferredTreeShadowProgram.setMinimumAlpha(0.5f);
+ gDeferredTreeShadowProgram.setMinimumAlpha(0.5f);
}
void LLDrawPoolTree::renderShadow(S32 pass)
{
- renderDeferred(pass);
+ renderDeferred(pass);
}
void LLDrawPoolTree::endShadowPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED;
-
- glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"),
- gSavedSettings.getF32("RenderDeferredSpotShadowBias"));
- gDeferredTreeShadowProgram.unbind();
+
+ glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"),
+ gSavedSettings.getF32("RenderDeferredSpotShadowBias"));
+ gDeferredTreeShadowProgram.unbind();
}
BOOL LLDrawPoolTree::verify() const
{
- return TRUE;
+ return TRUE;
}
LLViewerTexture *LLDrawPoolTree::getTexture()
{
- return mTexturep;
+ return mTexturep;
}
LLViewerTexture *LLDrawPoolTree::getDebugTexture()
{
- return mTexturep;
+ return mTexturep;
}
LLColor3 LLDrawPoolTree::getDebugColor() const
{
- return LLColor3(1.f, 0.f, 1.f);
+ return LLColor3(1.f, 0.f, 1.f);
}
diff --git a/indra/newview/lldrawpooltree.h b/indra/newview/lldrawpooltree.h
index 496445692c..773c28ad66 100644
--- a/indra/newview/lldrawpooltree.h
+++ b/indra/newview/lldrawpooltree.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpooltree.h
* @brief LLDrawPoolTree class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,36 +31,36 @@
class LLDrawPoolTree : public LLFacePool
{
- LLPointer<LLViewerTexture> mTexturep;
+ LLPointer<LLViewerTexture> mTexturep;
public:
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_NORMAL |
LLVertexBuffer::MAP_COLOR |
- LLVertexBuffer::MAP_TEXCOORD0
- };
+ LLVertexBuffer::MAP_TEXCOORD0
+ };
- virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
+ virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
- LLDrawPoolTree(LLViewerTexture *texturep);
+ LLDrawPoolTree(LLViewerTexture *texturep);
- /*virtual*/ S32 getNumDeferredPasses() { return 1; }
- /*virtual*/ void beginDeferredPass(S32 pass);
- /*virtual*/ void endDeferredPass(S32 pass);
- /*virtual*/ void renderDeferred(S32 pass);
+ /*virtual*/ S32 getNumDeferredPasses() { return 1; }
+ /*virtual*/ void beginDeferredPass(S32 pass);
+ /*virtual*/ void endDeferredPass(S32 pass);
+ /*virtual*/ void renderDeferred(S32 pass);
- /*virtual*/ S32 getNumShadowPasses() { return 1; }
- /*virtual*/ void beginShadowPass(S32 pass);
- /*virtual*/ void endShadowPass(S32 pass);
- /*virtual*/ void renderShadow(S32 pass);
+ /*virtual*/ S32 getNumShadowPasses() { return 1; }
+ /*virtual*/ void beginShadowPass(S32 pass);
+ /*virtual*/ void endShadowPass(S32 pass);
+ /*virtual*/ void renderShadow(S32 pass);
- /*virtual*/ BOOL verify() const;
- /*virtual*/ LLViewerTexture *getTexture();
- /*virtual*/ LLViewerTexture *getDebugTexture();
- /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
+ /*virtual*/ BOOL verify() const;
+ /*virtual*/ LLViewerTexture *getTexture();
+ /*virtual*/ LLViewerTexture *getDebugTexture();
+ /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
- static S32 sDiffTex;
+ static S32 sDiffTex;
};
#endif // LL_LLDRAWPOOLTREE_H
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index ca93815de7..938bcc37ff 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolwater.cpp
* @brief LLDrawPoolWater class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,7 +34,7 @@
#include "m3math.h"
#include "llrender.h"
-#include "llagent.h" // for gAgent for getRegion for getWaterHeight
+#include "llagent.h" // for gAgent for getRegion for getWaterHeight
#include "llcubemap.h"
#include "lldrawable.h"
#include "llface.h"
@@ -91,7 +91,7 @@ void LLDrawPoolWater::setNormalMaps(const LLUUID& normalMapId, const LLUUID& nex
void LLDrawPoolWater::prerender()
{
- mShaderLevel = LLCubeMap::sUseCubeMaps ? LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0;
+ mShaderLevel = LLCubeMap::sUseCubeMaps ? LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0;
}
S32 LLDrawPoolWater::getNumPostDeferredPasses()
@@ -135,11 +135,11 @@ void LLDrawPoolWater::beginPostDeferredPass(S32 pass)
}
}
-void LLDrawPoolWater::renderPostDeferred(S32 pass)
+void LLDrawPoolWater::renderPostDeferred(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLGLDisable blend(GL_BLEND);
-
+
gGL.setColorMask(true, true);
LLColor3 light_diffuse(0, 0, 0);
@@ -172,15 +172,15 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass)
F32 ground_proj_sq = light_dir.mV[0] * light_dir.mV[0] + light_dir.mV[1] * light_dir.mV[1];
light_exp = llmax(32.f, 256.f * powf(ground_proj_sq, 16.0f));
if (0.f < light_diffuse.normalize()) // Normalizing a color? Puzzling...
- {
+ {
light_diffuse *= (1.5f + (6.f * ground_proj_sq));
}
// set up normal maps filtering
for (auto norm_map : mWaterNormp)
- {
+ {
if (norm_map) norm_map->setFilteringOption(has_normal_mips ? LLTexUnit::TFO_ANISOTROPIC : LLTexUnit::TFO_POINT);
- }
+ }
LLColor4 specular(sun_up ? psky->getSunlightColor() : psky->getMoonlightColor());
F32 phase_time = (F32) LLFrameTimer::getElapsedSeconds() * 0.5f;
@@ -344,9 +344,9 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass)
gGL.getTexUnit(bumpTex2)->unbind(LLTexUnit::TT_TEXTURE);
}
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
-
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+
gGL.setColorMask(true, false);
}
@@ -357,5 +357,5 @@ LLViewerTexture *LLDrawPoolWater::getDebugTexture()
LLColor3 LLDrawPoolWater::getDebugColor() const
{
- return LLColor3(0.f, 1.f, 1.f);
+ return LLColor3(0.f, 1.f, 1.f);
}
diff --git a/indra/newview/lldrawpoolwater.h b/indra/newview/lldrawpoolwater.h
index 3158b0a59b..a9944e27e6 100644
--- a/indra/newview/lldrawpoolwater.h
+++ b/indra/newview/lldrawpoolwater.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolwater.h
* @brief LLDrawPoolWater class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,44 +38,44 @@ class LLGLSLShader;
class LLDrawPoolWater final: public LLFacePool
{
protected:
- LLPointer<LLViewerTexture> mWaterImagep[2];
- LLPointer<LLViewerTexture> mWaterNormp[2];
+ LLPointer<LLViewerTexture> mWaterImagep[2];
+ LLPointer<LLViewerTexture> mWaterNormp[2];
LLPointer<LLViewerTexture> mOpaqueWaterImagep;
public:
- static BOOL sSkipScreenCopy;
- static BOOL sNeedsReflectionUpdate;
- static BOOL sNeedsDistortionUpdate;
- static F32 sWaterFogEnd;
+ static BOOL sSkipScreenCopy;
+ static BOOL sNeedsReflectionUpdate;
+ static BOOL sNeedsDistortionUpdate;
+ static F32 sWaterFogEnd;
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
- LLVertexBuffer::MAP_TEXCOORD0
- };
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_NORMAL |
+ LLVertexBuffer::MAP_TEXCOORD0
+ };
- virtual U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
+ virtual U32 getVertexDataMask() override { return VERTEX_DATA_MASK; }
- LLDrawPoolWater();
- /*virtual*/ ~LLDrawPoolWater();
+ LLDrawPoolWater();
+ /*virtual*/ ~LLDrawPoolWater();
S32 getNumPostDeferredPasses() override;
void beginPostDeferredPass(S32 pass) override;
void renderPostDeferred(S32 pass) override;
- void prerender() override;
+ void prerender() override;
- LLViewerTexture *getDebugTexture() override;
- LLColor3 getDebugColor() const; // For AGP debug display
+ LLViewerTexture *getDebugTexture() override;
+ LLColor3 getDebugColor() const; // For AGP debug display
void setTransparentTextures(const LLUUID& transparentTextureId, const LLUUID& nextTransparentTextureId);
void setOpaqueTexture(const LLUUID& opaqueTextureId);
void setNormalMaps(const LLUUID& normalMapId, const LLUUID& nextNormalMapId);
protected:
- void renderOpaqueLegacyWater();
+ void renderOpaqueLegacyWater();
};
void cgErrorCallback();
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index b14235f25c..11c47e0d3b 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolwlsky.cpp
* @brief LLDrawPoolWLSky class implementation
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
#include "llimage.h"
#include "llrender.h"
#include "llatmosphere.h"
-#include "llenvironment.h"
+#include "llenvironment.h"
#include "llglslshader.h"
#include "llgl.h"
@@ -58,7 +58,7 @@ static LLGLSLShader* moon_shader = NULL;
static float sStarTime;
LLDrawPoolWLSky::LLDrawPoolWLSky(void) :
- LLDrawPool(POOL_WL_SKY)
+ LLDrawPool(POOL_WL_SKY)
{
}
@@ -68,13 +68,13 @@ LLDrawPoolWLSky::~LLDrawPoolWLSky()
LLViewerTexture *LLDrawPoolWLSky::getDebugTexture()
{
- return NULL;
+ return NULL;
}
void LLDrawPoolWLSky::beginDeferredPass(S32 pass)
{
- sky_shader = &gDeferredWLSkyProgram;
- cloud_shader = &gDeferredWLCloudProgram;
+ sky_shader = &gDeferredWLSkyProgram;
+ cloud_shader = &gDeferredWLCloudProgram;
sun_shader = &gDeferredWLSunProgram;
@@ -97,34 +97,34 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca
llassert_always(NULL != shader);
gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
-
- //chop off translation
- if (LLPipeline::sReflectionRender && camPosLocal.mV[2] > 256.f)
- {
- gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], 256.f-camPosLocal.mV[2]*0.5f);
- }
- else
- {
- gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
- }
-
-
- // the windlight sky dome works most conveniently in a coordinate system
- // where Y is up, so permute our basis vectors accordingly.
- gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3);
-
- gGL.scalef(0.333f, 0.333f, 0.333f);
-
- gGL.translatef(0.f,-camHeightLocal, 0.f);
-
- // Draw WL Sky
- shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f);
+ gGL.pushMatrix();
+
+ //chop off translation
+ if (LLPipeline::sReflectionRender && camPosLocal.mV[2] > 256.f)
+ {
+ gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], 256.f-camPosLocal.mV[2]*0.5f);
+ }
+ else
+ {
+ gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
+ }
+
+
+ // the windlight sky dome works most conveniently in a coordinate system
+ // where Y is up, so permute our basis vectors accordingly.
+ gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3);
+
+ gGL.scalef(0.333f, 0.333f, 0.333f);
+
+ gGL.translatef(0.f,-camHeightLocal, 0.f);
+
+ // Draw WL Sky
+ shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f);
gSky.mVOWLSkyp->drawDome();
gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
+ gGL.popMatrix();
}
void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const
@@ -136,8 +136,8 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
- if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))
- {
+ if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))
+ {
LLGLSPipelineDepthTestSkyBox sky(true, true);
sky_shader->bind();
@@ -172,9 +172,9 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
sky_shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, psky->getIsSunUp() ? 1 : 0);
/// Render the skydome
- renderDome(origin, camHeightLocal, sky_shader);
+ renderDome(origin, camHeightLocal, sky_shader);
- sky_shader->unbind();
+ sky_shader->unbind();
}
}
@@ -185,30 +185,30 @@ void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const
return;
}
- LLGLSPipelineBlendSkyBox gls_sky(true, false);
+ LLGLSPipelineBlendSkyBox gls_sky(true, false);
- gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
+ gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
F32 star_alpha = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / 500.0f;
- // If start_brightness is not set, exit
- if(star_alpha < 0.001f)
- {
- LL_DEBUGS("SKY") << "star_brightness below threshold." << LL_ENDL;
- return;
- }
+ // If start_brightness is not set, exit
+ if(star_alpha < 0.001f)
+ {
+ LL_DEBUGS("SKY") << "star_brightness below threshold." << LL_ENDL;
+ return;
+ }
- gDeferredStarProgram.bind();
+ gDeferredStarProgram.bind();
LLViewerTexture* tex_a = gSky.mVOSkyp->getBloomTex();
LLViewerTexture* tex_b = gSky.mVOSkyp->getBloomTexNext();
F32 blend_factor = LLEnvironment::instance().getCurrentSky()->getBlendFactor();
-
+
if (tex_a && (!tex_b || (tex_a == tex_b)))
{
// Bind current and next sun textures
- gGL.getTexUnit(0)->bind(tex_a);
+ gGL.getTexUnit(0)->bind(tex_a);
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
blend_factor = 0;
}
@@ -224,40 +224,40 @@ void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const
gGL.getTexUnit(1)->bind(tex_b);
}
- gGL.pushMatrix();
- gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
- gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
+ gGL.pushMatrix();
+ gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
+ gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
gDeferredStarProgram.uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
if (LLPipeline::sReflectionRender)
{
star_alpha = 1.0f;
}
- gDeferredStarProgram.uniform1f(sCustomAlpha, star_alpha);
+ gDeferredStarProgram.uniform1f(sCustomAlpha, star_alpha);
sStarTime = (F32)LLFrameTimer::getElapsedSeconds() * 0.5f;
gDeferredStarProgram.uniform1f(LLShaderMgr::WATER_TIME, sStarTime);
- gSky.mVOWLSkyp->drawStars();
+ gSky.mVOWLSkyp->drawStars();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
gDeferredStarProgram.unbind();
- gGL.popMatrix();
+ gGL.popMatrix();
}
void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const
{
- if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp && gSky.mVOSkyp->getCloudNoiseTex())
- {
+ if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp && gSky.mVOSkyp->getCloudNoiseTex())
+ {
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- LLGLSPipelineBlendSkyBox pipeline(true, true);
-
- cloudshader->bind();
+ LLGLSPipelineBlendSkyBox pipeline(true, true);
+
+ cloudshader->bind();
LLPointer<LLViewerTexture> cloud_noise = gSky.mVOSkyp->getCloudNoiseTex();
LLPointer<LLViewerTexture> cloud_noise_next = gSky.mVOSkyp->getCloudNoiseTexNext();
@@ -298,14 +298,14 @@ void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32
cloudshader->uniform1f(LLShaderMgr::CLOUD_VARIANCE, cloud_variance);
cloudshader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, psky->getSunMoonGlowFactor());
- /// Render the skydome
+ /// Render the skydome
renderDome(camPosLocal, camHeightLocal, cloudshader);
- cloudshader->unbind();
+ cloudshader->unbind();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
- }
+ }
}
void LLDrawPoolWLSky::renderHeavenlyBodies()
@@ -315,19 +315,19 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
LLGLSPipelineBlendSkyBox gls_skybox(true, true); // SL-14113 we need moon to write to depth to clip stars behind
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
- gGL.pushMatrix();
- gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
+ gGL.pushMatrix();
+ gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
- LLFace * face = gSky.mVOSkyp->mFace[LLVOSky::FACE_SUN];
+ LLFace * face = gSky.mVOSkyp->mFace[LLVOSky::FACE_SUN];
F32 blend_factor = LLEnvironment::instance().getCurrentSky()->getBlendFactor();
bool can_use_vertex_shaders = gPipeline.shadersLoaded();
bool can_use_windlight_shaders = gPipeline.canUseWindLightShaders();
- if (gSky.mVOSkyp->getSun().getDraw() && face && face->getGeomCount())
- {
- LLPointer<LLViewerTexture> tex_a = face->getTexture(LLRender::DIFFUSE_MAP);
+ if (gSky.mVOSkyp->getSun().getDraw() && face && face->getGeomCount())
+ {
+ LLPointer<LLViewerTexture> tex_a = face->getTexture(LLRender::DIFFUSE_MAP);
LLPointer<LLViewerTexture> tex_b = face->getTexture(LLRender::ALTERNATE_DIFFUSE_MAP);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -371,17 +371,17 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
sun_shader->unbind();
}
}
- }
+ }
- face = gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON];
+ face = gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON];
- if (gSky.mVOSkyp->getMoon().getDraw() && face && face->getTexture(LLRender::DIFFUSE_MAP) && face->getGeomCount() && moon_shader)
- {
+ if (gSky.mVOSkyp->getMoon().getDraw() && face && face->getTexture(LLRender::DIFFUSE_MAP) && face->getGeomCount() && moon_shader)
+ {
LLViewerTexture* tex_a = face->getTexture(LLRender::DIFFUSE_MAP);
LLViewerTexture* tex_b = face->getTexture(LLRender::ALTERNATE_DIFFUSE_MAP);
- LLColor4 color(gSky.mVOSkyp->getMoon().getInterpColor());
-
+ LLColor4 color(gSky.mVOSkyp->getMoon().getInterpColor());
+
if (can_use_vertex_shaders && can_use_windlight_shaders && (tex_a || tex_b))
{
moon_shader->bind();
@@ -428,17 +428,17 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
void LLDrawPoolWLSky::renderDeferred(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_WL_SKY);
- if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY) || gSky.mVOSkyp.isNull())
- {
- return;
- }
+ if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY) || gSky.mVOSkyp.isNull())
+ {
+ return;
+ }
// TODO: remove gSky.mVOSkyp and fold sun/moon into LLVOWLSky
gSky.mVOSkyp->updateGeometry(gSky.mVOSkyp->mDrawable);
const F32 camHeightLocal = LLEnvironment::instance().getCamHeight();
- gGL.setColorMask(true, false);
+ gGL.setColorMask(true, false);
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
@@ -463,7 +463,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
LLViewerTexture* LLDrawPoolWLSky::getTexture()
{
- return NULL;
+ return NULL;
}
void LLDrawPoolWLSky::resetDrawOrders()
diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h
index c26d0a1e23..19e1e060fa 100644
--- a/indra/newview/lldrawpoolwlsky.h
+++ b/indra/newview/lldrawpoolwlsky.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldrawpoolwlsky.h
* @brief LLDrawPoolWLSky class definition
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,43 +34,43 @@ class LLGLSLShader;
class LLDrawPoolWLSky : public LLDrawPool {
public:
- static const U32 SKY_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0;
- static const U32 STAR_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD0;
+ static const U32 SKY_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_TEXCOORD0;
+ static const U32 STAR_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD0;
static const U32 ADV_ATMO_SKY_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX
| LLVertexBuffer::MAP_TEXCOORD0;
- LLDrawPoolWLSky(void);
- /*virtual*/ ~LLDrawPoolWLSky();
+ LLDrawPoolWLSky(void);
+ /*virtual*/ ~LLDrawPoolWLSky();
+
+ /*virtual*/ BOOL isDead() { return FALSE; }
- /*virtual*/ BOOL isDead() { return FALSE; }
+ /*virtual*/ S32 getNumDeferredPasses() { return 1; }
+ /*virtual*/ void beginDeferredPass(S32 pass);
+ /*virtual*/ void endDeferredPass(S32 pass);
+ /*virtual*/ void renderDeferred(S32 pass);
- /*virtual*/ S32 getNumDeferredPasses() { return 1; }
- /*virtual*/ void beginDeferredPass(S32 pass);
- /*virtual*/ void endDeferredPass(S32 pass);
- /*virtual*/ void renderDeferred(S32 pass);
+ /*virtual*/ LLViewerTexture *getDebugTexture();
+ /*virtual*/ U32 getVertexDataMask() { return SKY_VERTEX_DATA_MASK; }
+ /*virtual*/ BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct!
+ /*virtual*/ S32 getShaderLevel() const { return mShaderLevel; }
- /*virtual*/ LLViewerTexture *getDebugTexture();
- /*virtual*/ U32 getVertexDataMask() { return SKY_VERTEX_DATA_MASK; }
- /*virtual*/ BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct!
- /*virtual*/ S32 getShaderLevel() const { return mShaderLevel; }
-
- //static LLDrawPool* createPool(const U32 type, LLViewerTexture *tex0 = NULL);
+ //static LLDrawPool* createPool(const U32 type, LLViewerTexture *tex0 = NULL);
- /*virtual*/ LLViewerTexture* getTexture();
- /*virtual*/ BOOL isFacePool() { return FALSE; }
- /*virtual*/ void resetDrawOrders();
+ /*virtual*/ LLViewerTexture* getTexture();
+ /*virtual*/ BOOL isFacePool() { return FALSE; }
+ /*virtual*/ void resetDrawOrders();
- static void cleanupGL();
- static void restoreGL();
+ static void cleanupGL();
+ static void restoreGL();
private:
- void renderDome(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const;
+ void renderDome(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const;
- void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const;
+ void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const;
void renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const;
void renderStarsDeferred(const LLVector3& camPosLocal) const;
- void renderHeavenlyBodies();
+ void renderHeavenlyBodies();
};
#endif // LL_DRAWPOOLWLSKY_H
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index 425acd3392..a27a98ff2c 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldynamictexture.cpp
* @brief Implementation of LLViewerDynamicTexture class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@
// Linden library includes
#include "llglheaders.h"
-#include "llwindow.h" // getPosition()
+#include "llwindow.h" // getPosition()
// Viewer includes
#include "llviewerwindow.h"
@@ -50,16 +50,16 @@ S32 LLViewerDynamicTexture::sNumRenders = 0;
//-----------------------------------------------------------------------------
// LLViewerDynamicTexture()
//-----------------------------------------------------------------------------
-LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 components, EOrder order, BOOL clamp) :
- LLViewerTexture(width, height, components, FALSE),
- mClamp(clamp)
+LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 components, EOrder order, BOOL clamp) :
+ LLViewerTexture(width, height, components, FALSE),
+ mClamp(clamp)
{
- llassert((1 <= components) && (components <= 4));
+ llassert((1 <= components) && (components <= 4));
- generateGLTexture();
+ generateGLTexture();
- llassert( 0 <= order && order < ORDER_COUNT );
- LLViewerDynamicTexture::sInstances[ order ].insert(this);
+ llassert( 0 <= order && order < ORDER_COUNT );
+ LLViewerDynamicTexture::sInstances[ order ].insert(this);
}
//-----------------------------------------------------------------------------
@@ -67,16 +67,16 @@ LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 compon
//-----------------------------------------------------------------------------
LLViewerDynamicTexture::~LLViewerDynamicTexture()
{
- for( S32 order = 0; order < ORDER_COUNT; order++ )
- {
- LLViewerDynamicTexture::sInstances[order].erase(this); // will fail in all but one case.
- }
+ for( S32 order = 0; order < ORDER_COUNT; order++ )
+ {
+ LLViewerDynamicTexture::sInstances[order].erase(this); // will fail in all but one case.
+ }
}
-//virtual
+//virtual
S8 LLViewerDynamicTexture::getType() const
{
- return LLViewerTexture::DYNAMIC_TEXTURE ;
+ return LLViewerTexture::DYNAMIC_TEXTURE ;
}
//-----------------------------------------------------------------------------
@@ -84,25 +84,25 @@ S8 LLViewerDynamicTexture::getType() const
//-----------------------------------------------------------------------------
void LLViewerDynamicTexture::generateGLTexture()
{
- LLViewerTexture::generateGLTexture() ;
- generateGLTexture(-1, 0, 0, FALSE);
+ LLViewerTexture::generateGLTexture() ;
+ generateGLTexture(-1, 0, 0, FALSE);
}
void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes)
{
- if (mComponents < 1 || mComponents > 4)
- {
- LL_ERRS() << "Bad number of components in dynamic texture: " << mComponents << LL_ENDL;
- }
-
- LLPointer<LLImageRaw> raw_image = new LLImageRaw(mFullWidth, mFullHeight, mComponents);
- if (internal_format >= 0)
- {
- setExplicitFormat(internal_format, primary_format, type_format, swap_bytes);
- }
- createGLTexture(0, raw_image, 0, TRUE, LLGLTexture::DYNAMIC_TEX);
- setAddressMode((mClamp) ? LLTexUnit::TAM_CLAMP : LLTexUnit::TAM_WRAP);
- mGLTexturep->setGLTextureCreated(false);
+ if (mComponents < 1 || mComponents > 4)
+ {
+ LL_ERRS() << "Bad number of components in dynamic texture: " << mComponents << LL_ENDL;
+ }
+
+ LLPointer<LLImageRaw> raw_image = new LLImageRaw(mFullWidth, mFullHeight, mComponents);
+ if (internal_format >= 0)
+ {
+ setExplicitFormat(internal_format, primary_format, type_format, swap_bytes);
+ }
+ createGLTexture(0, raw_image, 0, TRUE, LLGLTexture::DYNAMIC_TEX);
+ setAddressMode((mClamp) ? LLTexUnit::TAM_CLAMP : LLTexUnit::TAM_WRAP);
+ mGLTexturep->setGLTextureCreated(false);
}
//-----------------------------------------------------------------------------
@@ -110,7 +110,7 @@ void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum
//-----------------------------------------------------------------------------
BOOL LLViewerDynamicTexture::render()
{
- return FALSE;
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -119,22 +119,22 @@ BOOL LLViewerDynamicTexture::render()
void LLViewerDynamicTexture::preRender(BOOL clear_depth)
{
//use the bottom left corner
- mOrigin.set(0, 0);
+ mOrigin.set(0, 0);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- // Set up camera
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- mCamera.setOrigin(*camera);
- mCamera.setAxes(*camera);
- mCamera.setAspect(camera->getAspect());
- mCamera.setView(camera->getView());
- mCamera.setNear(camera->getNear());
-
- glViewport(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight);
- if (clear_depth)
- {
- glClear(GL_DEPTH_BUFFER_BIT);
- }
+ // Set up camera
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ mCamera.setOrigin(*camera);
+ mCamera.setAxes(*camera);
+ mCamera.setAspect(camera->getAspect());
+ mCamera.setView(camera->getView());
+ mCamera.setNear(camera->getNear());
+
+ glViewport(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight);
+ if (clear_depth)
+ {
+ glClear(GL_DEPTH_BUFFER_BIT);
+ }
}
//-----------------------------------------------------------------------------
@@ -142,36 +142,36 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth)
//-----------------------------------------------------------------------------
void LLViewerDynamicTexture::postRender(BOOL success)
{
- {
- if (success)
- {
- if(mGLTexturep.isNull())
- {
- generateGLTexture() ;
- }
- else if(!mGLTexturep->getHasGLTexture())
- {
- generateGLTexture() ;
- }
- else if(mGLTexturep->getDiscardLevel() != 0)//do not know how it happens, but regenerate one if it does.
- {
- generateGLTexture() ;
- }
-
- success = mGLTexturep->setSubImageFromFrameBuffer(0, 0, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight);
- }
- }
-
- // restore viewport
- gViewerWindow->setup2DViewport();
-
- // restore camera
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- camera->setOrigin(mCamera);
- camera->setAxes(mCamera);
- camera->setAspect(mCamera.getAspect());
- camera->setViewNoBroadcast(mCamera.getView());
- camera->setNear(mCamera.getNear());
+ {
+ if (success)
+ {
+ if(mGLTexturep.isNull())
+ {
+ generateGLTexture() ;
+ }
+ else if(!mGLTexturep->getHasGLTexture())
+ {
+ generateGLTexture() ;
+ }
+ else if(mGLTexturep->getDiscardLevel() != 0)//do not know how it happens, but regenerate one if it does.
+ {
+ generateGLTexture() ;
+ }
+
+ success = mGLTexturep->setSubImageFromFrameBuffer(0, 0, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight);
+ }
+ }
+
+ // restore viewport
+ gViewerWindow->setup2DViewport();
+
+ // restore camera
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ camera->setOrigin(mCamera);
+ camera->setAxes(mCamera);
+ camera->setAspect(mCamera.getAspect());
+ camera->setViewNoBroadcast(mCamera.getView());
+ camera->setNear(mCamera.getNear());
}
//-----------------------------------------------------------------------------
@@ -181,62 +181,62 @@ void LLViewerDynamicTexture::postRender(BOOL success)
//-----------------------------------------------------------------------------
BOOL LLViewerDynamicTexture::updateAllInstances()
{
- sNumRenders = 0;
- if (gGLManager.mIsDisabled)
- {
- return TRUE;
- }
+ sNumRenders = 0;
+ if (gGLManager.mIsDisabled)
+ {
+ return TRUE;
+ }
- bool use_fbo = gPipeline.mBake.isComplete() && !gGLManager.mIsAMD;
+ bool use_fbo = gPipeline.mBake.isComplete() && !gGLManager.mIsAMD;
- if (use_fbo)
- {
- gPipeline.mBake.bindTarget();
+ if (use_fbo)
+ {
+ gPipeline.mBake.bindTarget();
gPipeline.mBake.clear();
- }
-
- LLGLSLShader::unbind();
- LLVertexBuffer::unbind();
-
- BOOL result = FALSE;
- BOOL ret = FALSE ;
- for( S32 order = 0; order < ORDER_COUNT; order++ )
- {
- for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
- iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
- {
- LLViewerDynamicTexture *dynamicTexture = *iter;
- if (dynamicTexture->needsRender())
- {
- glClear(GL_DEPTH_BUFFER_BIT);
- gDepthDirty = TRUE;
-
- gGL.color4f(1,1,1,1);
+ }
+
+ LLGLSLShader::unbind();
+ LLVertexBuffer::unbind();
+
+ BOOL result = FALSE;
+ BOOL ret = FALSE ;
+ for( S32 order = 0; order < ORDER_COUNT; order++ )
+ {
+ for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
+ iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
+ {
+ LLViewerDynamicTexture *dynamicTexture = *iter;
+ if (dynamicTexture->needsRender())
+ {
+ glClear(GL_DEPTH_BUFFER_BIT);
+ gDepthDirty = TRUE;
+
+ gGL.color4f(1,1,1,1);
dynamicTexture->setBoundTarget(use_fbo ? &gPipeline.mBake : nullptr);
- dynamicTexture->preRender(); // Must be called outside of startRender()
- result = FALSE;
- if (dynamicTexture->render())
- {
- ret = TRUE ;
- result = TRUE;
- sNumRenders++;
- }
- gGL.flush();
- LLVertexBuffer::unbind();
- dynamicTexture->setBoundTarget(nullptr);
- dynamicTexture->postRender(result);
- }
- }
- }
-
- if (use_fbo)
- {
- gPipeline.mBake.flush();
- }
+ dynamicTexture->preRender(); // Must be called outside of startRender()
+ result = FALSE;
+ if (dynamicTexture->render())
+ {
+ ret = TRUE ;
+ result = TRUE;
+ sNumRenders++;
+ }
+ gGL.flush();
+ LLVertexBuffer::unbind();
+ dynamicTexture->setBoundTarget(nullptr);
+ dynamicTexture->postRender(result);
+ }
+ }
+ }
+
+ if (use_fbo)
+ {
+ gPipeline.mBake.flush();
+ }
gGL.flush();
- return ret;
+ return ret;
}
//-----------------------------------------------------------------------------
@@ -245,15 +245,15 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
//-----------------------------------------------------------------------------
void LLViewerDynamicTexture::destroyGL()
{
- for( S32 order = 0; order < ORDER_COUNT; order++ )
- {
- for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
- iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
- {
- LLViewerDynamicTexture *dynamicTexture = *iter;
- dynamicTexture->destroyGLTexture() ;
- }
- }
+ for( S32 order = 0; order < ORDER_COUNT; order++ )
+ {
+ for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
+ iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
+ {
+ LLViewerDynamicTexture *dynamicTexture = *iter;
+ dynamicTexture->destroyGLTexture() ;
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -262,18 +262,18 @@ void LLViewerDynamicTexture::destroyGL()
//-----------------------------------------------------------------------------
void LLViewerDynamicTexture::restoreGL()
{
- if (gGLManager.mIsDisabled)
- {
- return ;
- }
-
- for( S32 order = 0; order < ORDER_COUNT; order++ )
- {
- for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
- iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
- {
- LLViewerDynamicTexture *dynamicTexture = *iter;
- dynamicTexture->restoreGLTexture() ;
- }
- }
+ if (gGLManager.mIsDisabled)
+ {
+ return ;
+ }
+
+ for( S32 order = 0; order < ORDER_COUNT; order++ )
+ {
+ for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
+ iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
+ {
+ LLViewerDynamicTexture *dynamicTexture = *iter;
+ dynamicTexture->restoreGLTexture() ;
+ }
+ }
}
diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h
index caedf928c3..118afb4d5a 100644
--- a/indra/newview/lldynamictexture.h
+++ b/indra/newview/lldynamictexture.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldynamictexture.h
* @brief Implementation of LLViewerDynamicTexture class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,65 +38,65 @@ class LLViewerDynamicTexture : public LLViewerTexture
LL_ALIGN_NEW
public:
- enum
- {
- LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
- LL_TEX_LAYER_SET_BUFFER = LLViewerTexture::INVALID_TEXTURE_TYPE + 1,
- LL_VISUAL_PARAM_HINT,
- LL_VISUAL_PARAM_RESET,
- LL_PREVIEW_ANIMATION,
- LL_IMAGE_PREVIEW_SCULPTED,
- LL_IMAGE_PREVIEW_AVATAR,
- INVALID_DYNAMIC_TEXTURE
- };
+ enum
+ {
+ LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
+ LL_TEX_LAYER_SET_BUFFER = LLViewerTexture::INVALID_TEXTURE_TYPE + 1,
+ LL_VISUAL_PARAM_HINT,
+ LL_VISUAL_PARAM_RESET,
+ LL_PREVIEW_ANIMATION,
+ LL_IMAGE_PREVIEW_SCULPTED,
+ LL_IMAGE_PREVIEW_AVATAR,
+ INVALID_DYNAMIC_TEXTURE
+ };
protected:
- /*virtual*/ ~LLViewerDynamicTexture();
+ /*virtual*/ ~LLViewerDynamicTexture();
public:
- enum EOrder { ORDER_FIRST = 0, ORDER_MIDDLE = 1, ORDER_LAST = 2, ORDER_RESET = 3, ORDER_COUNT = 4 };
+ enum EOrder { ORDER_FIRST = 0, ORDER_MIDDLE = 1, ORDER_LAST = 2, ORDER_RESET = 3, ORDER_COUNT = 4 };
- LLViewerDynamicTexture(S32 width,
- S32 height,
- S32 components, // = 4,
- EOrder order, // = ORDER_MIDDLE,
- BOOL clamp);
-
- /*virtual*/ S8 getType() const ;
+ LLViewerDynamicTexture(S32 width,
+ S32 height,
+ S32 components, // = 4,
+ EOrder order, // = ORDER_MIDDLE,
+ BOOL clamp);
- S32 getOriginX() const { return mOrigin.mX; }
- S32 getOriginY() const { return mOrigin.mY; }
-
- S32 getSize() { return mFullWidth * mFullHeight * mComponents; }
+ /*virtual*/ S8 getType() const ;
- virtual BOOL needsRender() { return TRUE; }
- virtual void preRender(BOOL clear_depth = TRUE);
- virtual BOOL render();
- virtual void postRender(BOOL success);
+ S32 getOriginX() const { return mOrigin.mX; }
+ S32 getOriginY() const { return mOrigin.mY; }
- virtual void restoreGLTexture() {}
- virtual void destroyGLTexture() {}
+ S32 getSize() { return mFullWidth * mFullHeight * mComponents; }
- static BOOL updateAllInstances();
- static void destroyGL() ;
- static void restoreGL() ;
+ virtual BOOL needsRender() { return TRUE; }
+ virtual void preRender(BOOL clear_depth = TRUE);
+ virtual BOOL render();
+ virtual void postRender(BOOL success);
+
+ virtual void restoreGLTexture() {}
+ virtual void destroyGLTexture() {}
+
+ static BOOL updateAllInstances();
+ static void destroyGL() ;
+ static void restoreGL() ;
void setBoundTarget(LLRenderTarget* target) { mBoundTarget = target; }
protected:
- void generateGLTexture();
- void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE);
+ void generateGLTexture();
+ void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE);
protected:
- BOOL mClamp;
- LLCoordGL mOrigin;
- LL_ALIGN_16(LLCamera mCamera);
-
+ BOOL mClamp;
+ LLCoordGL mOrigin;
+ LL_ALIGN_16(LLCamera mCamera);
+
LLRenderTarget* mBoundTarget;
- typedef std::set<LLViewerDynamicTexture*> instance_list_t;
- static instance_list_t sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
- static S32 sNumRenders;
+ typedef std::set<LLViewerDynamicTexture*> instance_list_t;
+ static instance_list_t sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
+ static S32 sNumRenders;
};
#endif
diff --git a/indra/newview/llemote.cpp b/indra/newview/llemote.cpp
index b9ef297c00..95ced2008f 100644
--- a/indra/newview/llemote.cpp
+++ b/indra/newview/llemote.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llemote.cpp
* @brief Implementation of LLEmote class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,12 +44,12 @@
//-----------------------------------------------------------------------------
LLEmote::LLEmote(const LLUUID &id) : LLMotion(id)
{
- mCharacter = NULL;
+ mCharacter = NULL;
- //RN: flag face joint as highest priority for now, until we implement a proper animation track
- mJointSignature[0][LL_FACE_JOINT_NUM] = 0xff;
- mJointSignature[1][LL_FACE_JOINT_NUM] = 0xff;
- mJointSignature[2][LL_FACE_JOINT_NUM] = 0xff;
+ //RN: flag face joint as highest priority for now, until we implement a proper animation track
+ mJointSignature[0][LL_FACE_JOINT_NUM] = 0xff;
+ mJointSignature[1][LL_FACE_JOINT_NUM] = 0xff;
+ mJointSignature[2][LL_FACE_JOINT_NUM] = 0xff;
}
@@ -66,8 +66,8 @@ LLEmote::~LLEmote()
//-----------------------------------------------------------------------------
LLMotion::LLMotionInitStatus LLEmote::onInitialize(LLCharacter *character)
{
- mCharacter = character;
- return STATUS_SUCCESS;
+ mCharacter = character;
+ return STATUS_SUCCESS;
}
@@ -76,20 +76,20 @@ LLMotion::LLMotionInitStatus LLEmote::onInitialize(LLCharacter *character)
//-----------------------------------------------------------------------------
BOOL LLEmote::onActivate()
{
- LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" );
- if( default_param )
- {
- default_param->setWeight( default_param->getMaxWeight());
- }
-
- mParam = mCharacter->getVisualParam(mName.c_str());
- if (mParam)
- {
- mParam->setWeight(0.f);
- mCharacter->updateVisualParams();
- }
-
- return TRUE;
+ LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" );
+ if( default_param )
+ {
+ default_param->setWeight( default_param->getMaxWeight());
+ }
+
+ mParam = mCharacter->getVisualParam(mName.c_str());
+ if (mParam)
+ {
+ mParam->setWeight(0.f);
+ mCharacter->updateVisualParams();
+ }
+
+ return TRUE;
}
@@ -98,25 +98,25 @@ BOOL LLEmote::onActivate()
//-----------------------------------------------------------------------------
BOOL LLEmote::onUpdate(F32 time, U8* joint_mask)
{
- if( mParam )
- {
- F32 weight = mParam->getMinWeight() + mPose.getWeight() * (mParam->getMaxWeight() - mParam->getMinWeight());
- mParam->setWeight(weight);
-
- // Cross fade against the default parameter
- LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" );
- if( default_param )
- {
- F32 default_param_weight = default_param->getMinWeight() +
- (1.f - mPose.getWeight()) * ( default_param->getMaxWeight() - default_param->getMinWeight() );
-
- default_param->setWeight( default_param_weight);
- }
-
- mCharacter->updateVisualParams();
- }
-
- return TRUE;
+ if( mParam )
+ {
+ F32 weight = mParam->getMinWeight() + mPose.getWeight() * (mParam->getMaxWeight() - mParam->getMinWeight());
+ mParam->setWeight(weight);
+
+ // Cross fade against the default parameter
+ LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" );
+ if( default_param )
+ {
+ F32 default_param_weight = default_param->getMinWeight() +
+ (1.f - mPose.getWeight()) * ( default_param->getMaxWeight() - default_param->getMinWeight() );
+
+ default_param->setWeight( default_param_weight);
+ }
+
+ mCharacter->updateVisualParams();
+ }
+
+ return TRUE;
}
@@ -125,18 +125,18 @@ BOOL LLEmote::onUpdate(F32 time, U8* joint_mask)
//-----------------------------------------------------------------------------
void LLEmote::onDeactivate()
{
- if( mParam )
- {
- mParam->setWeight( mParam->getDefaultWeight());
- }
-
- LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" );
- if( default_param )
- {
- default_param->setWeight( default_param->getMaxWeight());
- }
-
- mCharacter->updateVisualParams();
+ if( mParam )
+ {
+ mParam->setWeight( mParam->getDefaultWeight());
+ }
+
+ LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" );
+ if( default_param )
+ {
+ default_param->setWeight( default_param->getMaxWeight());
+ }
+
+ mCharacter->updateVisualParams();
}
diff --git a/indra/newview/llemote.h b/indra/newview/llemote.h
index 4c516998dc..f1b9d4a18d 100644
--- a/indra/newview/llemote.h
+++ b/indra/newview/llemote.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llemote.h
* @brief Definition of LLEmote class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,74 +45,74 @@ class LLVisualParam;
// class LLEmote
//-----------------------------------------------------------------------------
class LLEmote :
- public LLMotion
+ public LLMotion
{
public:
- // Constructor
- LLEmote(const LLUUID &id);
+ // Constructor
+ LLEmote(const LLUUID &id);
- // Destructor
- virtual ~LLEmote();
+ // Destructor
+ virtual ~LLEmote();
public:
- //-------------------------------------------------------------------------
- // functions to support MotionController and MotionRegistry
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ // functions to support MotionController and MotionRegistry
+ //-------------------------------------------------------------------------
- // static constructor
- // all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLEmote(id); }
+ // static constructor
+ // all subclasses must implement such a function and register it
+ static LLMotion *create(const LLUUID &id) { return new LLEmote(id); }
public:
- //-------------------------------------------------------------------------
- // animation callbacks to be implemented by subclasses
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ // animation callbacks to be implemented by subclasses
+ //-------------------------------------------------------------------------
- // motions must specify whether or not they loop
- virtual BOOL getLoop() { return FALSE; }
+ // motions must specify whether or not they loop
+ virtual BOOL getLoop() { return FALSE; }
- // motions must report their total duration
- virtual F32 getDuration() { return EMOTE_MORPH_FADEIN_TIME + EMOTE_MORPH_IN_TIME + EMOTE_MORPH_FADEOUT_TIME; }
+ // motions must report their total duration
+ virtual F32 getDuration() { return EMOTE_MORPH_FADEIN_TIME + EMOTE_MORPH_IN_TIME + EMOTE_MORPH_FADEOUT_TIME; }
- // motions must report their "ease in" duration
- virtual F32 getEaseInDuration() { return EMOTE_MORPH_FADEIN_TIME; }
+ // motions must report their "ease in" duration
+ virtual F32 getEaseInDuration() { return EMOTE_MORPH_FADEIN_TIME; }
- // motions must report their "ease out" duration.
- virtual F32 getEaseOutDuration() { return EMOTE_MORPH_FADEOUT_TIME; }
+ // motions must report their "ease out" duration.
+ virtual F32 getEaseOutDuration() { return EMOTE_MORPH_FADEOUT_TIME; }
- // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
- virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_EMOTE; }
+ // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
+ virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_EMOTE; }
- // motions must report their priority
- virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
+ // motions must report their priority
+ virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
- virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
+ virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
- // run-time (post constructor) initialization,
- // called after parameters have been set
- // must return true to indicate success and be available for activation
- virtual LLMotionInitStatus onInitialize(LLCharacter *character);
+ // run-time (post constructor) initialization,
+ // called after parameters have been set
+ // must return true to indicate success and be available for activation
+ virtual LLMotionInitStatus onInitialize(LLCharacter *character);
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate();
+ // called when a motion is activated
+ // must return TRUE to indicate success, or else
+ // it will be deactivated
+ virtual BOOL onActivate();
- // called per time step
- // must return TRUE while it is active, and
- // must return FALSE when the motion is completed.
- virtual BOOL onUpdate(F32 time, U8* joint_mask);
+ // called per time step
+ // must return TRUE while it is active, and
+ // must return FALSE when the motion is completed.
+ virtual BOOL onUpdate(F32 time, U8* joint_mask);
- // called when a motion is deactivated
- virtual void onDeactivate();
+ // called when a motion is deactivated
+ virtual void onDeactivate();
- virtual BOOL canDeprecate() { return FALSE; }
+ virtual BOOL canDeprecate() { return FALSE; }
protected:
- LLCharacter* mCharacter;
+ LLCharacter* mCharacter;
- LLVisualParam* mParam;
+ LLVisualParam* mParam;
};
diff --git a/indra/newview/llenvadapters.cpp b/indra/newview/llenvadapters.cpp
index fdbcf68fa4..8525b5d51c 100644
--- a/indra/newview/llenvadapters.cpp
+++ b/indra/newview/llenvadapters.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,17 +33,17 @@
LLSkySettingsAdapter::LLSkySettingsAdapter():
mWLGamma(1.0f, LLSettingsSky::SETTING_GAMMA),
-
+
// Lighting
mLightnorm(LLColor4(0.f, 0.707f, -0.707f, 1.f), LLSettingsSky::SETTING_LIGHT_NORMAL),
mSunlight(LLColor4(0.5f, 0.5f, 0.5f, 1.0f), LLSettingsSky::SETTING_SUNLIGHT_COLOR, "WLSunlight"),
-
+
mGlow(LLColor4(18.0f, 0.0f, -0.01f, 1.0f), LLSettingsSky::SETTING_GLOW),
// Clouds
mCloudColor(LLColor4(0.5f, 0.5f, 0.5f, 1.0f), LLSettingsSky::SETTING_CLOUD_COLOR, "WLCloudColor"),
mCloudMain(LLColor4(0.5f, 0.5f, 0.125f, 1.0f), LLSettingsSky::SETTING_CLOUD_POS_DENSITY1),
mCloudCoverage(0.0f, LLSettingsSky::SETTING_CLOUD_SHADOW),
- mCloudDetail(LLColor4(0.0f, 0.0f, 0.0f, 1.0f), LLSettingsSky::SETTING_CLOUD_POS_DENSITY2),
+ mCloudDetail(LLColor4(0.0f, 0.0f, 0.0f, 1.0f), LLSettingsSky::SETTING_CLOUD_POS_DENSITY2),
mCloudScale(0.42f, LLSettingsSky::SETTING_CLOUD_SCALE)
{
diff --git a/indra/newview/llenvadapters.h b/indra/newview/llenvadapters.h
index bd58db0589..8ece685974 100644
--- a/indra/newview/llenvadapters.h
+++ b/indra/newview/llenvadapters.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,12 +33,12 @@
#include "llsettingsbase.h"
#include "llsettingssky.h"
-class WLColorControl
+class WLColorControl
{
public:
inline WLColorControl(LLColor4 color, const std::string& n, const std::string& slider_name = std::string()):
- mColor(color),
- mName(n),
+ mColor(color),
+ mName(n),
mSliderName(slider_name),
mHasSliderName(false),
mIsSunOrAmbientColor(false),
@@ -67,12 +67,12 @@ public:
return mColor;
}
- inline LLColor3 getColor3(void) const
+ inline LLColor3 getColor3(void) const
{
return vec4to3(mColor);
}
- inline void update(const LLSettingsBase::ptr_t &psetting) const
+ inline void update(const LLSettingsBase::ptr_t &psetting) const
{
psetting->setValue(mName, mColor);
}
@@ -139,37 +139,37 @@ public:
private:
LLColor4 mColor; /// [3] is intensity, not alpha
- std::string mName; /// name to use to dereference params
- std::string mSliderName; /// name of the slider in menu
- bool mHasSliderName; /// only set slider name for true color types
- bool mIsSunOrAmbientColor; /// flag for if it's the sun or ambient color controller
- bool mIsBlueHorizonOrDensity; /// flag for if it's the Blue Horizon or Density color controller
+ std::string mName; /// name to use to dereference params
+ std::string mSliderName; /// name of the slider in menu
+ bool mHasSliderName; /// only set slider name for true color types
+ bool mIsSunOrAmbientColor; /// flag for if it's the sun or ambient color controller
+ bool mIsBlueHorizonOrDensity; /// flag for if it's the Blue Horizon or Density color controller
};
// float slider control
-class WLFloatControl
+class WLFloatControl
{
public:
inline WLFloatControl(F32 val, const std::string& n, F32 m = 1.0f):
- x(val),
- mName(n),
+ x(val),
+ mName(n),
mult(m)
{
}
- inline WLFloatControl &operator = (F32 val)
+ inline WLFloatControl &operator = (F32 val)
{
x = val;
return *this;
}
- inline operator F32 (void) const
+ inline operator F32 (void) const
{
return x;
}
- inline void update(const LLSettingsBase::ptr_t &psetting) const
+ inline void update(const LLSettingsBase::ptr_t &psetting) const
{
psetting->setValue(mName, x);
}
@@ -193,7 +193,7 @@ private:
class WLXFloatControl
{
public:
- inline WLXFloatControl(F32 val, const std::string& n, F32 b):
+ inline WLXFloatControl(F32 val, const std::string& n, F32 b):
mExp(val),
mBase(b),
mName(n)
@@ -246,9 +246,9 @@ private:
class WLVect2Control
{
public:
- inline WLVect2Control(LLVector2 val, const std::string& n):
- mU(val.mV[0]),
- mV(val.mV[1]),
+ inline WLVect2Control(LLVector2 val, const std::string& n):
+ mU(val.mV[0]),
+ mV(val.mV[1]),
mName(n)
{
}
@@ -413,21 +413,21 @@ class LLSkySettingsAdapter
{
public:
typedef std::shared_ptr<LLSkySettingsAdapter> ptr_t;
-
+
LLSkySettingsAdapter();
WLFloatControl mWLGamma;
/// Lighting
WLColorControl mLightnorm;
- WLColorControl mSunlight;
+ WLColorControl mSunlight;
WLColorControl mGlow;
/// Clouds
WLColorControl mCloudColor;
WLColorControl mCloudMain;
WLFloatControl mCloudCoverage;
- WLColorControl mCloudDetail;
+ WLColorControl mCloudDetail;
WLFloatControl mCloudScale;
};
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 60c2682078..98260ec149 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -94,7 +94,7 @@ namespace
const std::string KEY_ACTION("action");
const std::string KEY_ACTIONDATA("action_data");
const std::string KEY_EXPERIENCEID("public_id");
- const std::string KEY_OBJECTNAME("ObjectName"); // some of these do not conform to the '_' format.
+ const std::string KEY_OBJECTNAME("ObjectName"); // some of these do not conform to the '_' format.
const std::string KEY_PARCELNAME("ParcelName"); // But changing these would also alter the Experience Log requirements.
const std::string KEY_COUNT("Count");
@@ -370,13 +370,13 @@ namespace
virtual ~LLSettingsInjected() {};
typename SETTINGT::ptr_t getSource() const { return this->mSource; }
- void setSource(const typename SETTINGT::ptr_t &source)
+ void setSource(const typename SETTINGT::ptr_t &source)
{
if (source.get() == this) // do not set a source to itself.
return;
- this->mSource = source;
- this->setDirtyFlag(true);
- this->mLastSourceHash = 0;
+ this->mSource = source;
+ this->setDirtyFlag(true);
+ this->mLastSourceHash = 0;
}
virtual bool isDirty() const override { return SETTINGT::isDirty() || (this->mSource->isDirty()); }
@@ -565,7 +565,7 @@ namespace
if (!this->mSource)
return;
- // clears the dirty flag on this object. Need to prevent triggering
+ // clears the dirty flag on this object. Need to prevent triggering
// more calls into this updateSettings
LLSettingsBase::updateSettings();
@@ -824,7 +824,7 @@ const S32 LLEnvironment::NO_TRACK(-1);
const S32 LLEnvironment::NO_VERSION(-3); // For viewer sided change, like ENV_LOCAL. -3 since -1 and -2 are taken by parcel initial server/viewer version
const S32 LLEnvironment::VERSION_CLEANUP(-4); // for cleanups
-const F32 LLEnvironment::SUN_DELTA_YAW(F_PI); // 180deg
+const F32 LLEnvironment::SUN_DELTA_YAW(F_PI); // 180deg
const U32 LLEnvironment::DayInstance::NO_ANIMATE_SKY(0x01);
@@ -929,9 +929,9 @@ bool LLEnvironment::canEdit() const
return true;
}
-LLSettingsSky::ptr_t LLEnvironment::getCurrentSky() const
-{
- LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
+LLSettingsSky::ptr_t LLEnvironment::getCurrentSky() const
+{
+ LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
if (!psky && mCurrentEnvironment->getEnvironmentSelection() >= ENV_EDIT)
{
@@ -947,9 +947,9 @@ LLSettingsSky::ptr_t LLEnvironment::getCurrentSky() const
return psky;
}
-LLSettingsWater::ptr_t LLEnvironment::getCurrentWater() const
+LLSettingsWater::ptr_t LLEnvironment::getCurrentWater() const
{
- LLSettingsWater::ptr_t pwater = mCurrentEnvironment->getWater();
+ LLSettingsWater::ptr_t pwater = mCurrentEnvironment->getWater();
if (!pwater && mCurrentEnvironment->getEnvironmentSelection() >= ENV_EDIT)
{
@@ -1235,7 +1235,7 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm
}
}
}
-
+
if (fixed.second)
{
logEnvironment(env, fixed.second, env_version);
@@ -1531,12 +1531,12 @@ void LLEnvironment::updateEnvironment(LLSettingsBase::Seconds transition, bool f
{
if (transition != TRANSITION_INSTANT)
{
- DayInstance::ptr_t trans = std::make_shared<DayTransition>(
- mCurrentEnvironment->getSky(), mCurrentEnvironment->getWater(), pinstance, transition);
-
- trans->animate();
-
- mCurrentEnvironment = trans;
+ DayInstance::ptr_t trans = std::make_shared<DayTransition>(
+ mCurrentEnvironment->getSky(), mCurrentEnvironment->getWater(), pinstance, transition);
+
+ trans->animate();
+
+ mCurrentEnvironment = trans;
}
else
{
@@ -1694,12 +1694,12 @@ void LLEnvironment::update(const LLViewerCamera * cam)
void LLEnvironment::updateCloudScroll()
{
- // This is a function of the environment rather than the sky, since it should
+ // This is a function of the environment rather than the sky, since it should
// persist through sky transitions.
static LLTimer s_cloud_timer;
F64 delta_t = s_cloud_timer.getElapsedTimeAndResetF64();
-
+
if (mCurrentEnvironment->getSky() && !mCloudScrollPaused)
{
LLVector2 rate = mCurrentEnvironment->getSky()->getCloudScrollRate();
@@ -1782,7 +1782,7 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
};
switch (it.second.getShaderKey())
- {
+ {
case LLShaderMgr::BLUE_HORIZON:
case LLShaderMgr::BLUE_DENSITY:
vect4 = max_vec(vect4);
@@ -2184,7 +2184,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInf
query << "&";
}
if (track_no != NO_TRACK)
- {
+ {
query << "trackno=" << track_no;
}
url += query.str();
@@ -2267,7 +2267,7 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, S32 track_no, environmen
LLSD result = httpAdapter->deleteAndSuspend(httpRequest, url);
// results that come back may contain the new settings
- LLSD notify;
+ LLSD notify;
LLSD httpResults = result["http_result"];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
@@ -2547,7 +2547,7 @@ void LLEnvironment::onAgentPositionHasChanged(const LLVector3 &localpos)
S32 LLEnvironment::calculateSkyTrackForAltitude(F64 altitude)
{
auto it = std::find_if_not(mTrackAltitudes.begin(), mTrackAltitudes.end(), [altitude](F32 test) { return altitude > test; });
-
+
if (it == mTrackAltitudes.begin())
return 1;
else if (it == mTrackAltitudes.end())
@@ -2571,19 +2571,19 @@ void LLEnvironment::handleEnvironmentPush(LLSD &message)
if (action == ACTION_CLEARENVIRONMENT)
- {
+ {
handleEnvironmentPushClear(experience_id, action_data, transition_time);
}
else if (action == ACTION_PUSHFULLENVIRONMENT)
- {
+ {
handleEnvironmentPushFull(experience_id, action_data, transition_time);
}
else if (action == ACTION_PUSHPARTIALENVIRONMENT)
- {
+ {
handleEnvironmentPushPartial(experience_id, action_data, transition_time);
}
else
- {
+ {
LL_WARNS("ENVIRONMENT", "GENERICMESSAGES") << "Unknown environment push action '" << action << "'" << LL_ENDL;
}
}
@@ -2797,9 +2797,9 @@ bool LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky)
mInitialized = false;
bool changed = psky == nullptr || mSky == nullptr || mSky->getHash() != psky->getHash();
-
+
bool different_sky = mSky != psky;
-
+
mSky = psky;
mSky->mReplaced |= different_sky;
mSky->update();
@@ -2934,7 +2934,7 @@ LLEnvironment::DayTransition::DayTransition(const LLSettingsSky::ptr_t &skystart
mNextInstance(end),
mTransitionTime(time)
{
-
+
}
bool LLEnvironment::DayTransition::applyTimeDelta(const LLSettingsBase::Seconds& delta)
@@ -2946,14 +2946,14 @@ bool LLEnvironment::DayTransition::applyTimeDelta(const LLSettingsBase::Seconds&
return changed;
}
-void LLEnvironment::DayTransition::animate()
+void LLEnvironment::DayTransition::animate()
{
mNextInstance->animate();
mWater = mStartWater->buildClone();
mBlenderWater = std::make_shared<LLSettingsBlenderTimeDelta>(mWater, mStartWater, mNextInstance->getWater(), mTransitionTime);
mBlenderWater->setOnFinished(
- [this](LLSettingsBlender::ptr_t blender) {
+ [this](LLSettingsBlender::ptr_t blender) {
mBlenderWater.reset();
if (!mBlenderSky && !mBlenderWater)
@@ -3362,8 +3362,8 @@ namespace
return changed;
}
- void DayInjection::setBaseDayInstance(const LLEnvironment::DayInstance::ptr_t &baseday)
- {
+ void DayInjection::setBaseDayInstance(const LLEnvironment::DayInstance::ptr_t &baseday)
+ {
mBaseDayInstance = baseday;
if (mSkyExperience.isNull())
@@ -3572,7 +3572,7 @@ namespace
mBlenderSky = std::make_shared<LLSettingsBlenderTimeDelta>(target_sky, start_sky, psky, transition);
mBlenderSky->setOnFinished(
- [this, psky](LLSettingsBlender::ptr_t blender)
+ [this, psky](LLSettingsBlender::ptr_t blender)
{
mBlenderSky.reset();
mInjectedSky->setSource(psky);
@@ -3596,7 +3596,7 @@ namespace
return;
}
if (transition == LLEnvironment::TRANSITION_INSTANT)
- {
+ {
mBlenderWater.reset();
mInjectedWater->setSource(pwater);
}
@@ -3608,7 +3608,7 @@ namespace
mBlenderWater = std::make_shared<LLSettingsBlenderTimeDelta>(scratch_Water, start_Water, pwater, transition);
mBlenderWater->setOnFinished(
- [this, pwater](LLSettingsBlender::ptr_t blender)
+ [this, pwater](LLSettingsBlender::ptr_t blender)
{
mBlenderWater.reset();
mInjectedWater->setSource(pwater);
@@ -3629,7 +3629,7 @@ namespace
LLEnvironment::EnvSelection_t base_env(mBaseDayInstance->getEnvironmentSelection());
LLEnvironment::DayInstance::ptr_t nextbase = LLEnvironment::instance().getSharedEnvironmentInstance();
- if ((base_env == LLEnvironment::ENV_NONE) || (nextbase == mBaseDayInstance) ||
+ if ((base_env == LLEnvironment::ENV_NONE) || (nextbase == mBaseDayInstance) ||
(!mSkyExperience.isNull() && !mWaterExperience.isNull()))
{ // base instance completely overridden, or not changed no transition will happen
return;
@@ -3661,7 +3661,7 @@ namespace
void DayInjection::checkExperience()
{
if ((!mDayExperience.isNull()) && (mSkyExperience != mDayExperience) && (mWaterExperience != mDayExperience))
- { // There was a day experience but we've replaced it with a water and a sky experience.
+ { // There was a day experience but we've replaced it with a water and a sky experience.
mDayExperience.setNull();
mBaseDayInstance = LLEnvironment::instance().getSharedEnvironmentInstance();
}
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index 408952bb5b..f1205a72b7 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -136,7 +136,7 @@ public:
void update(const LLViewerCamera * cam);
static void updateGLVariablesForSettings(LLShaderUniforms* uniforms, const LLSettingsBase::ptr_t &psetting);
-
+
// apply current sky settings to given shader
void updateShaderUniforms(LLGLSLShader *shader);
@@ -440,10 +440,10 @@ private:
mFlags(flags)
{}
- LLSettingsDay::ptr_t mDayp;
- LLUUID mSettingsAsset;
- S32 mDayLength;
- S32 mDayOffset;
+ LLSettingsDay::ptr_t mDayp;
+ LLUUID mSettingsAsset;
+ S32 mDayLength;
+ S32 mDayOffset;
altitudes_vect_t mAltitudes;
std::string mDayName;
U32 mFlags;
diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp
index 5be56660d6..a7d18d85ce 100644
--- a/indra/newview/llestateinfomodel.cpp
+++ b/indra/newview/llestateinfomodel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llestateinfomodel.cpp
* @brief Estate info model
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,79 +40,79 @@
#include "llcorehttputil.h"
LLEstateInfoModel::LLEstateInfoModel()
-: mID(0)
-, mFlags(0)
-, mSunHour(0)
+: mID(0)
+, mFlags(0)
+, mSunHour(0)
{
}
boost::signals2::connection LLEstateInfoModel::setUpdateCallback(const update_signal_t::slot_type& cb)
{
- return mUpdateSignal.connect(cb);
+ return mUpdateSignal.connect(cb);
}
boost::signals2::connection LLEstateInfoModel::setCommitCallback(const update_signal_t::slot_type& cb)
{
- return mCommitSignal.connect(cb);
+ return mCommitSignal.connect(cb);
}
void LLEstateInfoModel::sendEstateInfo()
{
- if (!commitEstateInfoCaps())
- {
- // the caps method failed, try the old way
- LLFloaterRegionInfo::nextInvoice();
- commitEstateInfoDataserver();
- }
+ if (!commitEstateInfoCaps())
+ {
+ // the caps method failed, try the old way
+ LLFloaterRegionInfo::nextInvoice();
+ commitEstateInfoDataserver();
+ }
}
-bool LLEstateInfoModel::getUseFixedSun() const { return getFlag(REGION_FLAGS_SUN_FIXED); }
-bool LLEstateInfoModel::getIsExternallyVisible() const { return getFlag(REGION_FLAGS_EXTERNALLY_VISIBLE); }
-bool LLEstateInfoModel::getAllowDirectTeleport() const { return getFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT); }
-bool LLEstateInfoModel::getDenyAnonymous() const { return getFlag(REGION_FLAGS_DENY_ANONYMOUS); }
-bool LLEstateInfoModel::getDenyAgeUnverified() const { return getFlag(REGION_FLAGS_DENY_AGEUNVERIFIED); }
-bool LLEstateInfoModel::getAllowVoiceChat() const { return getFlag(REGION_FLAGS_ALLOW_VOICE); }
-bool LLEstateInfoModel::getAllowAccessOverride() const { return getFlag(REGION_FLAGS_ALLOW_ACCESS_OVERRIDE); }
+bool LLEstateInfoModel::getUseFixedSun() const { return getFlag(REGION_FLAGS_SUN_FIXED); }
+bool LLEstateInfoModel::getIsExternallyVisible() const { return getFlag(REGION_FLAGS_EXTERNALLY_VISIBLE); }
+bool LLEstateInfoModel::getAllowDirectTeleport() const { return getFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT); }
+bool LLEstateInfoModel::getDenyAnonymous() const { return getFlag(REGION_FLAGS_DENY_ANONYMOUS); }
+bool LLEstateInfoModel::getDenyAgeUnverified() const { return getFlag(REGION_FLAGS_DENY_AGEUNVERIFIED); }
+bool LLEstateInfoModel::getAllowVoiceChat() const { return getFlag(REGION_FLAGS_ALLOW_VOICE); }
+bool LLEstateInfoModel::getAllowAccessOverride() const { return getFlag(REGION_FLAGS_ALLOW_ACCESS_OVERRIDE); }
bool LLEstateInfoModel::getAllowEnvironmentOverride() const { return getFlag(REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE); }
bool LLEstateInfoModel::getDenyScriptedAgents() const { return getFlag(REGION_FLAGS_DENY_BOTS); }
-void LLEstateInfoModel::setUseFixedSun(bool val) { setFlag(REGION_FLAGS_SUN_FIXED, val); }
-void LLEstateInfoModel::setIsExternallyVisible(bool val) { setFlag(REGION_FLAGS_EXTERNALLY_VISIBLE, val); }
-void LLEstateInfoModel::setAllowDirectTeleport(bool val) { setFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, val); }
-void LLEstateInfoModel::setDenyAnonymous(bool val) { setFlag(REGION_FLAGS_DENY_ANONYMOUS, val); }
-void LLEstateInfoModel::setDenyAgeUnverified(bool val) { setFlag(REGION_FLAGS_DENY_AGEUNVERIFIED, val); }
-void LLEstateInfoModel::setAllowVoiceChat(bool val) { setFlag(REGION_FLAGS_ALLOW_VOICE, val); }
+void LLEstateInfoModel::setUseFixedSun(bool val) { setFlag(REGION_FLAGS_SUN_FIXED, val); }
+void LLEstateInfoModel::setIsExternallyVisible(bool val) { setFlag(REGION_FLAGS_EXTERNALLY_VISIBLE, val); }
+void LLEstateInfoModel::setAllowDirectTeleport(bool val) { setFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, val); }
+void LLEstateInfoModel::setDenyAnonymous(bool val) { setFlag(REGION_FLAGS_DENY_ANONYMOUS, val); }
+void LLEstateInfoModel::setDenyAgeUnverified(bool val) { setFlag(REGION_FLAGS_DENY_AGEUNVERIFIED, val); }
+void LLEstateInfoModel::setAllowVoiceChat(bool val) { setFlag(REGION_FLAGS_ALLOW_VOICE, val); }
void LLEstateInfoModel::setAllowAccessOverride(bool val) { setFlag(REGION_FLAGS_ALLOW_ACCESS_OVERRIDE, val); }
void LLEstateInfoModel::setAllowEnvironmentOverride(bool val) { setFlag(REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE, val); }
void LLEstateInfoModel::setDenyScriptedAgents(bool val) { setFlag(REGION_FLAGS_DENY_BOTS, val); }
void LLEstateInfoModel::update(const strings_t& strings)
{
- // NOTE: LLDispatcher extracts strings with an extra \0 at the
- // end. If we pass the std::string direct to the UI/renderer
- // it draws with a weird character at the end of the string.
- mName = strings[0].c_str();
- mOwnerID = LLUUID(strings[1].c_str());
- mID = strtoul(strings[2].c_str(), NULL, 10);
- mFlags = strtoul(strings[3].c_str(), NULL, 10);
- mSunHour = ((F32)(strtod(strings[4].c_str(), NULL)))/1024.0f;
-
- LL_DEBUGS("WindlightSync") << "Received estate info: "
- << "is_sun_fixed = " << getUseFixedSun()
- << ", sun_hour = " << getSunHour() << LL_ENDL;
- LL_DEBUGS() << getInfoDump() << LL_ENDL;
-
- // Update region owner.
- LLViewerRegion* regionp = gAgent.getRegion();
- regionp->setOwner(mOwnerID);
-
- // Let interested parties know that estate info has been updated.
- mUpdateSignal();
+ // NOTE: LLDispatcher extracts strings with an extra \0 at the
+ // end. If we pass the std::string direct to the UI/renderer
+ // it draws with a weird character at the end of the string.
+ mName = strings[0].c_str();
+ mOwnerID = LLUUID(strings[1].c_str());
+ mID = strtoul(strings[2].c_str(), NULL, 10);
+ mFlags = strtoul(strings[3].c_str(), NULL, 10);
+ mSunHour = ((F32)(strtod(strings[4].c_str(), NULL)))/1024.0f;
+
+ LL_DEBUGS("WindlightSync") << "Received estate info: "
+ << "is_sun_fixed = " << getUseFixedSun()
+ << ", sun_hour = " << getSunHour() << LL_ENDL;
+ LL_DEBUGS() << getInfoDump() << LL_ENDL;
+
+ // Update region owner.
+ LLViewerRegion* regionp = gAgent.getRegion();
+ regionp->setOwner(mOwnerID);
+
+ // Let interested parties know that estate info has been updated.
+ mUpdateSignal();
}
void LLEstateInfoModel::notifyCommit()
{
- mCommitSignal();
+ mCommitSignal();
}
//== PRIVATE STUFF ============================================================
@@ -120,13 +120,13 @@ void LLEstateInfoModel::notifyCommit()
// tries to send estate info using a cap; returns true if it succeeded
bool LLEstateInfoModel::commitEstateInfoCaps()
{
- std::string url = gAgent.getRegionCapability("EstateChangeInfo");
+ std::string url = gAgent.getRegionCapability("EstateChangeInfo");
- if (url.empty())
- {
- // whoops, couldn't find the cap, so bail out
- return false;
- }
+ if (url.empty())
+ {
+ // whoops, couldn't find the cap, so bail out
+ return false;
+ }
LLCoros::instance().launch("LLEstateInfoModel::commitEstateInfoCapsCoro",
boost::bind(&LLEstateInfoModel::commitEstateInfoCapsCoro, this, url));
@@ -186,51 +186,51 @@ void LLEstateInfoModel::commitEstateInfoCapsCoro(std::string url)
// strings[3] = str((S32)(sun_hour * 1024.f))
void LLEstateInfoModel::commitEstateInfoDataserver()
{
- LL_DEBUGS("WindlightSync") << "Sending estate info: "
- << "is_sun_fixed = " << getUseFixedSun()
- << ", sun_hour = " << getSunHour() << LL_ENDL;
- LL_DEBUGS() << getInfoDump() << LL_ENDL;
+ LL_DEBUGS("WindlightSync") << "Sending estate info: "
+ << "is_sun_fixed = " << getUseFixedSun()
+ << ", sun_hour = " << getSunHour() << LL_ENDL;
+ LL_DEBUGS() << getInfoDump() << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("EstateOwnerMessage");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("EstateOwnerMessage");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", "estatechangeinfo");
- msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice());
+ msg->nextBlock("MethodData");
+ msg->addString("Method", "estatechangeinfo");
+ msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice());
- msg->nextBlock("ParamList");
- msg->addString("Parameter", getName());
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", getName());
- msg->nextBlock("ParamList");
- msg->addString("Parameter", llformat("%u", getFlags()));
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", llformat("%u", getFlags()));
- msg->nextBlock("ParamList");
- msg->addString("Parameter", llformat("%d", (S32) (getSunHour() * 1024.0f)));
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", llformat("%d", (S32) (getSunHour() * 1024.0f)));
- gAgent.sendMessage();
+ gAgent.sendMessage();
}
std::string LLEstateInfoModel::getInfoDump()
{
- LLSD dump;
- dump["estate_name" ] = getName();
- dump["sun_hour" ] = getSunHour();
-
- dump["is_sun_fixed" ] = getUseFixedSun();
- dump["is_externally_visible"] = getIsExternallyVisible();
- dump["allow_direct_teleport"] = getAllowDirectTeleport();
- dump["deny_anonymous" ] = getDenyAnonymous();
- dump["deny_age_unverified" ] = getDenyAgeUnverified();
+ LLSD dump;
+ dump["estate_name" ] = getName();
+ dump["sun_hour" ] = getSunHour();
+
+ dump["is_sun_fixed" ] = getUseFixedSun();
+ dump["is_externally_visible"] = getIsExternallyVisible();
+ dump["allow_direct_teleport"] = getAllowDirectTeleport();
+ dump["deny_anonymous" ] = getDenyAnonymous();
+ dump["deny_age_unverified" ] = getDenyAgeUnverified();
dump["block_bots" ] = getDenyScriptedAgents();
- dump["allow_voice_chat" ] = getAllowVoiceChat();
+ dump["allow_voice_chat" ] = getAllowVoiceChat();
dump["override_public_access"] = getAllowAccessOverride();
dump["override_environment"] = getAllowEnvironmentOverride();
- std::stringstream dump_str;
- dump_str << dump;
- return dump_str.str();
+ std::stringstream dump_str;
+ dump_str << dump;
+ return dump_str.str();
}
diff --git a/indra/newview/llestateinfomodel.h b/indra/newview/llestateinfomodel.h
index cfe91a2930..11a090352d 100644
--- a/indra/newview/llestateinfomodel.h
+++ b/indra/newview/llestateinfomodel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llestateinfomodel.h
* @brief Estate info model
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,91 +38,91 @@ class LLMessageSystem;
*/
class LLEstateInfoModel : public LLSingleton<LLEstateInfoModel>
{
- LLSINGLETON(LLEstateInfoModel);
- LOG_CLASS(LLEstateInfoModel);
+ LLSINGLETON(LLEstateInfoModel);
+ LOG_CLASS(LLEstateInfoModel);
public:
- typedef boost::signals2::signal<void()> update_signal_t;
- boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb); /// the model has been externally updated
- boost::signals2::connection setCommitCallback(const update_signal_t::slot_type& cb); /// our changes have been applied
-
- void sendEstateInfo(); /// send estate info to the simulator
-
- // getters
- bool getUseFixedSun() const;
- bool getIsExternallyVisible() const;
- bool getAllowDirectTeleport() const;
- bool getDenyAnonymous() const;
- bool getDenyAgeUnverified() const;
- bool getAllowVoiceChat() const;
+ typedef boost::signals2::signal<void()> update_signal_t;
+ boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb); /// the model has been externally updated
+ boost::signals2::connection setCommitCallback(const update_signal_t::slot_type& cb); /// our changes have been applied
+
+ void sendEstateInfo(); /// send estate info to the simulator
+
+ // getters
+ bool getUseFixedSun() const;
+ bool getIsExternallyVisible() const;
+ bool getAllowDirectTeleport() const;
+ bool getDenyAnonymous() const;
+ bool getDenyAgeUnverified() const;
+ bool getAllowVoiceChat() const;
bool getAllowAccessOverride() const;
bool getAllowEnvironmentOverride() const;
bool getDenyScriptedAgents() const;
- const std::string& getName() const { return mName; }
- const LLUUID& getOwnerID() const { return mOwnerID; }
- U32 getID() const { return mID; }
- F32 getSunHour() const { return getUseFixedSun() ? mSunHour : 0.f; }
-
- // setters
- void setUseFixedSun(bool val);
- void setIsExternallyVisible(bool val);
- void setAllowDirectTeleport(bool val);
- void setDenyAnonymous(bool val);
- void setDenyAgeUnverified(bool val);
- void setAllowVoiceChat(bool val);
+ const std::string& getName() const { return mName; }
+ const LLUUID& getOwnerID() const { return mOwnerID; }
+ U32 getID() const { return mID; }
+ F32 getSunHour() const { return getUseFixedSun() ? mSunHour : 0.f; }
+
+ // setters
+ void setUseFixedSun(bool val);
+ void setIsExternallyVisible(bool val);
+ void setAllowDirectTeleport(bool val);
+ void setDenyAnonymous(bool val);
+ void setDenyAgeUnverified(bool val);
+ void setAllowVoiceChat(bool val);
void setAllowAccessOverride(bool val);
void setAllowEnvironmentOverride(bool val);
void setDenyScriptedAgents(bool val);
- void setSunHour(F32 sun_hour) { mSunHour = sun_hour; }
+ void setSunHour(F32 sun_hour) { mSunHour = sun_hour; }
protected:
- typedef std::vector<std::string> strings_t;
+ typedef std::vector<std::string> strings_t;
- friend class LLDispatchEstateUpdateInfo;
+ friend class LLDispatchEstateUpdateInfo;
- /// refresh model with data from the incoming server message
- void update(const strings_t& strings);
+ /// refresh model with data from the incoming server message
+ void update(const strings_t& strings);
- void notifyCommit();
+ void notifyCommit();
private:
- bool commitEstateInfoCaps();
- void commitEstateInfoDataserver();
- inline bool getFlag(U64 flag) const;
- inline void setFlag(U64 flag, bool val);
- U64 getFlags() const { return mFlags; }
- std::string getInfoDump();
-
- // estate info
- std::string mName; /// estate name
- LLUUID mOwnerID; /// estate owner id
- U32 mID; /// estate id
- U64 mFlags; /// estate flags
- F32 mSunHour; /// estate sun hour
-
- update_signal_t mUpdateSignal; /// emitted when we receive update from sim
- update_signal_t mCommitSignal; /// emitted when our update gets applied to sim
+ bool commitEstateInfoCaps();
+ void commitEstateInfoDataserver();
+ inline bool getFlag(U64 flag) const;
+ inline void setFlag(U64 flag, bool val);
+ U64 getFlags() const { return mFlags; }
+ std::string getInfoDump();
+
+ // estate info
+ std::string mName; /// estate name
+ LLUUID mOwnerID; /// estate owner id
+ U32 mID; /// estate id
+ U64 mFlags; /// estate flags
+ F32 mSunHour; /// estate sun hour
+
+ update_signal_t mUpdateSignal; /// emitted when we receive update from sim
+ update_signal_t mCommitSignal; /// emitted when our update gets applied to sim
void commitEstateInfoCapsCoro(std::string url);
};
inline bool LLEstateInfoModel::getFlag(U64 flag) const
{
- return ((mFlags & flag) != 0);
+ return ((mFlags & flag) != 0);
}
inline void LLEstateInfoModel::setFlag(U64 flag, bool val)
{
- if (val)
- {
- mFlags |= flag;
- }
- else
- {
- mFlags &= ~flag;
- }
+ if (val)
+ {
+ mFlags |= flag;
+ }
+ else
+ {
+ mFlags &= ~flag;
+ }
}
diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp
index 788b61b381..d46b49362a 100644
--- a/indra/newview/lleventnotifier.cpp
+++ b/indra/newview/lleventnotifier.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lleventnotifier.cpp
* @brief Viewer code for managing event notifications
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,59 +35,59 @@
#include "llfloaterworldmap.h"
#include "llfloaterevent.h"
#include "llagent.h"
-#include "llcommandhandler.h" // secondlife:///app/... support
+#include "llcommandhandler.h" // secondlife:///app/... support
#include "lltrans.h"
class LLEventHandler : public LLCommandHandler
{
public:
- // requires trusted browser to trigger
- LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { }
- bool handle(const LLSD& params,
+ // requires trusted browser to trigger
+ LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { }
+ bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- if (params.size() < 2)
- {
- return false;
- }
- std::string event_command = params[1].asString();
- S32 event_id = params[0].asInteger();
- if(event_command == "details")
- {
- LLFloaterEvent* floater = LLFloaterReg::getTypedInstance<LLFloaterEvent>("event");
- if (floater)
- {
- floater->setEventID(event_id);
- LLFloaterReg::showTypedInstance<LLFloaterEvent>("event");
- return true;
- }
- }
- else if(event_command == "notify")
- {
- // we're adding or removing a notification, so grab the date, name and notification bool
- if (params.size() < 3)
- {
- return false;
- }
- if(params[2].asString() == "enable")
- {
- gEventNotifier.add(event_id);
- // tell the server to modify the database as this was a slurl event notification command
- gEventNotifier.serverPushRequest(event_id, true);
-
- }
- else
- {
- gEventNotifier.remove(event_id);
- }
- return true;
- }
-
-
- return false;
- }
+ {
+ if (params.size() < 2)
+ {
+ return false;
+ }
+ std::string event_command = params[1].asString();
+ S32 event_id = params[0].asInteger();
+ if(event_command == "details")
+ {
+ LLFloaterEvent* floater = LLFloaterReg::getTypedInstance<LLFloaterEvent>("event");
+ if (floater)
+ {
+ floater->setEventID(event_id);
+ LLFloaterReg::showTypedInstance<LLFloaterEvent>("event");
+ return true;
+ }
+ }
+ else if(event_command == "notify")
+ {
+ // we're adding or removing a notification, so grab the date, name and notification bool
+ if (params.size() < 3)
+ {
+ return false;
+ }
+ if(params[2].asString() == "enable")
+ {
+ gEventNotifier.add(event_id);
+ // tell the server to modify the database as this was a slurl event notification command
+ gEventNotifier.serverPushRequest(event_id, true);
+
+ }
+ else
+ {
+ gEventNotifier.remove(event_id);
+ }
+ return true;
+ }
+
+
+ return false;
+ }
};
LLEventHandler gEventHandler;
@@ -101,126 +101,126 @@ LLEventNotifier::LLEventNotifier()
LLEventNotifier::~LLEventNotifier()
{
- en_map::iterator iter;
-
- for (iter = mEventNotifications.begin();
- iter != mEventNotifications.end();
- iter++)
- {
- delete iter->second;
- }
+ en_map::iterator iter;
+
+ for (iter = mEventNotifications.begin();
+ iter != mEventNotifications.end();
+ iter++)
+ {
+ delete iter->second;
+ }
}
void LLEventNotifier::update()
{
- if (mNotificationTimer.getElapsedTimeF32() > 30.f)
- {
- // Check our notifications again and send out updates
- // if they happen.
-
- F64 alert_time = LLDate::now().secondsSinceEpoch() + 5 * 60;
- en_map::iterator iter;
- for (iter = mEventNotifications.begin();
- iter != mEventNotifications.end();)
- {
- LLEventNotification *np = iter->second;
-
- iter++;
- if (np->getEventDateEpoch() < alert_time)
- {
- LLSD args;
- args["NAME"] = np->getEventName();
-
- args["DATE"] = np->getEventDateStr();
- LLNotificationsUtil::add("EventNotification", args, LLSD(),
- boost::bind(&LLEventNotifier::handleResponse, this, np->getEventID(), _1, _2));
- remove(np->getEventID());
-
- }
- }
- mNotificationTimer.reset();
- }
+ if (mNotificationTimer.getElapsedTimeF32() > 30.f)
+ {
+ // Check our notifications again and send out updates
+ // if they happen.
+
+ F64 alert_time = LLDate::now().secondsSinceEpoch() + 5 * 60;
+ en_map::iterator iter;
+ for (iter = mEventNotifications.begin();
+ iter != mEventNotifications.end();)
+ {
+ LLEventNotification *np = iter->second;
+
+ iter++;
+ if (np->getEventDateEpoch() < alert_time)
+ {
+ LLSD args;
+ args["NAME"] = np->getEventName();
+
+ args["DATE"] = np->getEventDateStr();
+ LLNotificationsUtil::add("EventNotification", args, LLSD(),
+ boost::bind(&LLEventNotifier::handleResponse, this, np->getEventID(), _1, _2));
+ remove(np->getEventID());
+
+ }
+ }
+ mNotificationTimer.reset();
+ }
}
bool LLEventNotifier::handleResponse(U32 eventId, const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch (option)
- {
- case 0:
- {
- LLFloaterEvent* floater = LLFloaterReg::getTypedInstance<LLFloaterEvent>("event");
- if (floater)
- {
- floater->setEventID(eventId);
- LLFloaterReg::showTypedInstance<LLFloaterEvent>("event");
- }
- break;
- }
- case 1:
- break;
- }
- return true;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch (option)
+ {
+ case 0:
+ {
+ LLFloaterEvent* floater = LLFloaterReg::getTypedInstance<LLFloaterEvent>("event");
+ if (floater)
+ {
+ floater->setEventID(eventId);
+ LLFloaterReg::showTypedInstance<LLFloaterEvent>("event");
+ }
+ break;
+ }
+ case 1:
+ break;
+ }
+ return true;
}
bool LLEventNotifier::add(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName)
{
- LLEventNotification *new_enp = new LLEventNotification(eventId, eventEpoch, eventDateStr, eventName);
-
- LL_INFOS() << "Add event " << eventName << " id " << eventId << " date " << eventDateStr << LL_ENDL;
- if(!new_enp->isValid())
- {
- delete new_enp;
- return false;
- }
-
- mEventNotifications[new_enp->getEventID()] = new_enp;
- return true;
-
+ LLEventNotification *new_enp = new LLEventNotification(eventId, eventEpoch, eventDateStr, eventName);
+
+ LL_INFOS() << "Add event " << eventName << " id " << eventId << " date " << eventDateStr << LL_ENDL;
+ if(!new_enp->isValid())
+ {
+ delete new_enp;
+ return false;
+ }
+
+ mEventNotifications[new_enp->getEventID()] = new_enp;
+ return true;
+
}
void LLEventNotifier::add(U32 eventId)
{
-
- gMessageSystem->newMessageFast(_PREHASH_EventInfoRequest);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- gMessageSystem->nextBlockFast(_PREHASH_EventData);
- gMessageSystem->addU32Fast(_PREHASH_EventID, eventId);
- gAgent.sendReliableMessage();
+
+ gMessageSystem->newMessageFast(_PREHASH_EventInfoRequest);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ gMessageSystem->nextBlockFast(_PREHASH_EventData);
+ gMessageSystem->addU32Fast(_PREHASH_EventID, eventId);
+ gAgent.sendReliableMessage();
}
-//static
+//static
void LLEventNotifier::processEventInfoReply(LLMessageSystem *msg, void **)
{
- // extract the agent id
- LLUUID agent_id;
- U32 event_id;
- std::string event_name;
- std::string eventd_date;
- U32 event_time_utc;
-
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- msg->getU32("EventData", "EventID", event_id);
- msg->getString("EventData", "Name", event_name);
- msg->getString("EventData", "Date", eventd_date);
- msg->getU32("EventData", "DateUTC", event_time_utc);
-
- gEventNotifier.add(event_id, (F64)event_time_utc, eventd_date, event_name);
-}
-
-
+ // extract the agent id
+ LLUUID agent_id;
+ U32 event_id;
+ std::string event_name;
+ std::string eventd_date;
+ U32 event_time_utc;
+
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ msg->getU32("EventData", "EventID", event_id);
+ msg->getString("EventData", "Name", event_name);
+ msg->getString("EventData", "Date", eventd_date);
+ msg->getU32("EventData", "DateUTC", event_time_utc);
+
+ gEventNotifier.add(event_id, (F64)event_time_utc, eventd_date, event_name);
+}
+
+
void LLEventNotifier::load(const LLSD& event_options)
{
- for(LLSD::array_const_iterator resp_it = event_options.beginArray(),
- end = event_options.endArray(); resp_it != end; ++resp_it)
- {
- LLSD response = *resp_it;
+ for(LLSD::array_const_iterator resp_it = event_options.beginArray(),
+ end = event_options.endArray(); resp_it != end; ++resp_it)
+ {
+ LLSD response = *resp_it;
LLDate date;
bool is_iso8601_date = false;
@@ -255,55 +255,55 @@ void LLEventNotifier::load(const LLSD& event_options)
{
add(response["event_id"].asInteger(), response["event_date_ut"], response["event_date"].asString(), response["event_name"].asString());
}
- }
+ }
}
BOOL LLEventNotifier::hasNotification(const U32 event_id)
{
- if (mEventNotifications.find(event_id) != mEventNotifications.end())
- {
- return TRUE;
- }
- return FALSE;
+ if (mEventNotifications.find(event_id) != mEventNotifications.end())
+ {
+ return TRUE;
+ }
+ return FALSE;
}
void LLEventNotifier::remove(const U32 event_id)
{
- en_map::iterator iter;
- iter = mEventNotifications.find(event_id);
- if (iter == mEventNotifications.end())
- {
- // We don't have a notification for this event, don't bother.
- return;
- }
-
- serverPushRequest(event_id, false);
- delete iter->second;
- mEventNotifications.erase(iter);
+ en_map::iterator iter;
+ iter = mEventNotifications.find(event_id);
+ if (iter == mEventNotifications.end())
+ {
+ // We don't have a notification for this event, don't bother.
+ return;
+ }
+
+ serverPushRequest(event_id, false);
+ delete iter->second;
+ mEventNotifications.erase(iter);
}
void LLEventNotifier::serverPushRequest(U32 event_id, bool add)
{
- // Push up a message to tell the server we have this notification.
- gMessageSystem->newMessage(add?"EventNotificationAddRequest":"EventNotificationRemoveRequest");
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlock("EventData");
- gMessageSystem->addU32("EventID", event_id);
- gAgent.sendReliableMessage();
+ // Push up a message to tell the server we have this notification.
+ gMessageSystem->newMessage(add?"EventNotificationAddRequest":"EventNotificationRemoveRequest");
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlock("EventData");
+ gMessageSystem->addU32("EventID", event_id);
+ gAgent.sendReliableMessage();
}
LLEventNotification::LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName) :
- mEventID(eventId),
- mEventName(eventName),
- mEventDateEpoch(eventEpoch),
+ mEventID(eventId),
+ mEventName(eventName),
+ mEventDateEpoch(eventEpoch),
mEventDateStr(eventDateStr)
{
-
+
}
diff --git a/indra/newview/lleventnotifier.h b/indra/newview/lleventnotifier.h
index 3fee46c2f6..b928969d2f 100644
--- a/indra/newview/lleventnotifier.h
+++ b/indra/newview/lleventnotifier.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lleventnotifier.h
* @brief Viewer code for managing event notifications
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,49 +37,49 @@ class LLMessageSystem;
class LLEventNotifier
{
public:
- LLEventNotifier();
- virtual ~LLEventNotifier();
+ LLEventNotifier();
+ virtual ~LLEventNotifier();
- void update(); // Notify the user of the event if it's coming up
- bool add(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName);
- void add(U32 eventId);
+ void update(); // Notify the user of the event if it's coming up
+ bool add(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName);
+ void add(U32 eventId);
-
- void load(const LLSD& event_options); // In the format that it comes in from login
- void remove(U32 event_id);
- BOOL hasNotification(const U32 event_id);
- void serverPushRequest(U32 event_id, bool add);
+ void load(const LLSD& event_options); // In the format that it comes in from login
+ void remove(U32 event_id);
- typedef std::map<U32, LLEventNotification *> en_map;
- bool handleResponse(U32 eventId, const LLSD& notification, const LLSD& response);
+ BOOL hasNotification(const U32 event_id);
+ void serverPushRequest(U32 event_id, bool add);
+
+ typedef std::map<U32, LLEventNotification *> en_map;
+ bool handleResponse(U32 eventId, const LLSD& notification, const LLSD& response);
+
+ static void processEventInfoReply(LLMessageSystem *msg, void **);
- static void processEventInfoReply(LLMessageSystem *msg, void **);
-
protected:
- en_map mEventNotifications;
- LLFrameTimer mNotificationTimer;
+ en_map mEventNotifications;
+ LLFrameTimer mNotificationTimer;
};
class LLEventNotification
{
public:
- LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName);
+ LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName);
+
+
+ U32 getEventID() const { return mEventID; }
+ const std::string &getEventName() const { return mEventName; }
+ bool isValid() const { return mEventID > 0 && mEventDateEpoch != 0 && mEventName.size() > 0; }
+ const F64 &getEventDateEpoch() const { return mEventDateEpoch; }
+ const std::string &getEventDateStr() const { return mEventDateStr; }
- U32 getEventID() const { return mEventID; }
- const std::string &getEventName() const { return mEventName; }
- bool isValid() const { return mEventID > 0 && mEventDateEpoch != 0 && mEventName.size() > 0; }
- const F64 &getEventDateEpoch() const { return mEventDateEpoch; }
- const std::string &getEventDateStr() const { return mEventDateStr; }
-
-
protected:
- U32 mEventID; // EventID for this event
- std::string mEventName;
- F64 mEventDateEpoch;
- std::string mEventDateStr;
+ U32 mEventID; // EventID for this event
+ std::string mEventName;
+ F64 mEventDateEpoch;
+ std::string mEventDateStr;
};
extern LLEventNotifier gEventNotifier;
diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp
index 6ffc8f7bdd..471bb6d478 100644
--- a/indra/newview/lleventpoll.cpp
+++ b/indra/newview/lleventpoll.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -103,7 +103,7 @@ namespace Details
void LLEventPollImpl::handleMessage(const LLSD& content)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
- std::string msg_name = content["message"];
+ std::string msg_name = content["message"];
LLSD message;
message["sender"] = mSenderIp;
message["body"] = content["body"];
@@ -144,7 +144,7 @@ namespace Details
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EventPoller", mHttpPolicy));
LLSD acknowledge;
int errorCount = 0;
- int counter = mCounter; // saved on the stack for logging.
+ int counter = mCounter; // saved on the stack for logging.
LL_DEBUGS("LLEventPollImpl") << " <" << counter << "> entering coroutine." << LL_ENDL;
@@ -158,8 +158,8 @@ namespace Details
main_queue = LL::WorkQueue::getInstance("mainloop");
#endif
- // continually poll for a server update until we've been flagged as
- // finished
+ // continually poll for a server update until we've been flagged as
+ // finished
while (!mDone)
{
LLSD request;
@@ -194,10 +194,10 @@ namespace Details
errorCount = 0;
continue;
}
- else if ((status == LLCore::HttpStatus(LLCore::HttpStatus::LLCORE, LLCore::HE_OP_CANCELED)) ||
+ else if ((status == LLCore::HttpStatus(LLCore::HttpStatus::LLCORE, LLCore::HE_OP_CANCELED)) ||
(status == LLCore::HttpStatus(HTTP_NOT_FOUND)))
- { // Event polling for this server has been canceled. In
- // some cases the server gets ahead of the viewer and will
+ { // Event polling for this server has been canceled. In
+ // some cases the server gets ahead of the viewer and will
// return a 404 error (Not Found) before the cancel event
// comes back in the queue
LL_WARNS("LLEventPollImpl") << "Canceling coroutine" << LL_ENDL;
@@ -213,7 +213,7 @@ namespace Details
<< status.toTerseString() << ": '" << httpResults["message"] << "'" << LL_ENDL;
if (errorCount < MAX_EVENT_POLL_HTTP_ERRORS)
- { // An unanticipated error has been received from our poll
+ { // An unanticipated error has been received from our poll
// request. Calculate a timeout and wait for it to expire(sleep)
// before trying again. The sleep time is increased by 5 seconds
// for each consecutive error.
@@ -226,7 +226,7 @@ namespace Details
" seconds, error count is now " << errorCount << LL_ENDL;
llcoro::suspendUntilTimeout(waitToRetry);
-
+
if (mDone || gDisconnected)
break;
LL_INFOS("LLEventPollImpl") << "<" << counter << "> About to retry request." << LL_ENDL;
@@ -242,7 +242,7 @@ namespace Details
// *NOTE:Mani - The following condition check to see if this failing event poll
// is attached to the Agent's main region. If so we disconnect the viewer.
- // Else... its a child region and we just leave the dead event poll stopped and
+ // Else... its a child region and we just leave the dead event poll stopped and
// continue running.
if (gAgent.getRegion() && gAgent.getRegion()->getHost().getIPandPort() == mSenderIp)
{
@@ -287,8 +287,8 @@ namespace Details
// of wherever this coroutine happens to be executing
const LLSD& msg = *i;
main_queue->post([this, msg]()
- {
- handleMessage(msg);
+ {
+ handleMessage(msg);
});
}
else
@@ -304,9 +304,9 @@ namespace Details
}
}
-LLEventPoll::LLEventPoll(const std::string& poll_url, const LLHost& sender):
+LLEventPoll::LLEventPoll(const std::string& poll_url, const LLHost& sender):
mImpl()
-{
+{
mImpl = std::make_shared<LLEventPolling::Details::LLEventPollImpl>(sender);
mImpl->start(poll_url);
}
diff --git a/indra/newview/lleventpoll.h b/indra/newview/lleventpoll.h
index d6da04b281..bb407b3799 100644
--- a/indra/newview/lleventpoll.h
+++ b/indra/newview/lleventpoll.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lleventpoll.h
* @brief LLEvDescription of the LLEventPoll class.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,14 +40,14 @@ namespace Details
class LLEventPoll
- ///< implements the viewer side of server-to-viewer pushed events.
+ ///< implements the viewer side of server-to-viewer pushed events.
{
public:
- LLEventPoll(const std::string& pollURL, const LLHost& sender);
- ///< Start polling the URL.
+ LLEventPoll(const std::string& pollURL, const LLHost& sender);
+ ///< Start polling the URL.
- virtual ~LLEventPoll();
- ///< will stop polling, canceling any poll in progress.
+ virtual ~LLEventPoll();
+ ///< will stop polling, canceling any poll in progress.
private:
diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index 2d332f75f5..9e526f8c52 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llexpandabletextbox.cpp
* @brief LLExpandableTextBox and related class implementations
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,73 +37,73 @@ static LLDefaultChildRegistry::Register<LLExpandableTextBox> t1("expandable_text
class LLExpanderSegment : public LLTextSegment
{
public:
- LLExpanderSegment(const LLStyleSP& style, S32 start, S32 end, const std::string& more_text, LLTextBase& editor )
- : LLTextSegment(start, end),
- mEditor(editor),
- mStyle(style),
- mExpanderLabel(more_text)
- {}
-
- /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
- {
- // more label always spans width of text box
- if (num_chars == 0)
- {
- width = 0;
- height = 0;
- }
- else
- {
- width = mEditor.getDocumentView()->getRect().getWidth() - mEditor.getHPad();
- height = mStyle->getFont()->getLineHeight();
- }
- return true;
- }
- /*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const
- {
- return start_offset;
- }
- /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const
- {
- // require full line to ourselves
- if (line_offset == 0)
- {
- // print all our text
- return getEnd() - getStart();
- }
- else
- {
- // wait for next line
- return 0;
- }
- }
- /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
- {
- F32 right_x;
- mStyle->getFont()->renderUTF8(mExpanderLabel, start,
- draw_rect.mRight, draw_rect.mTop,
- mStyle->getColor(),
- LLFontGL::RIGHT, LLFontGL::TOP,
- 0,
- mStyle->getShadowType(),
- end - start, draw_rect.getWidth(),
- &right_x,
- mEditor.getUseEllipses(), mEditor.getUseColor());
- return right_x;
- }
- /*virtual*/ bool canEdit() const { return false; }
- // eat handleMouseDown event so we get the mouseup event
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return TRUE; }
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) { mEditor.onCommit(); return TRUE; }
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask)
- {
- LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
- return TRUE;
- }
+ LLExpanderSegment(const LLStyleSP& style, S32 start, S32 end, const std::string& more_text, LLTextBase& editor )
+ : LLTextSegment(start, end),
+ mEditor(editor),
+ mStyle(style),
+ mExpanderLabel(more_text)
+ {}
+
+ /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
+ {
+ // more label always spans width of text box
+ if (num_chars == 0)
+ {
+ width = 0;
+ height = 0;
+ }
+ else
+ {
+ width = mEditor.getDocumentView()->getRect().getWidth() - mEditor.getHPad();
+ height = mStyle->getFont()->getLineHeight();
+ }
+ return true;
+ }
+ /*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const
+ {
+ return start_offset;
+ }
+ /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const
+ {
+ // require full line to ourselves
+ if (line_offset == 0)
+ {
+ // print all our text
+ return getEnd() - getStart();
+ }
+ else
+ {
+ // wait for next line
+ return 0;
+ }
+ }
+ /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
+ {
+ F32 right_x;
+ mStyle->getFont()->renderUTF8(mExpanderLabel, start,
+ draw_rect.mRight, draw_rect.mTop,
+ mStyle->getColor(),
+ LLFontGL::RIGHT, LLFontGL::TOP,
+ 0,
+ mStyle->getShadowType(),
+ end - start, draw_rect.getWidth(),
+ &right_x,
+ mEditor.getUseEllipses(), mEditor.getUseColor());
+ return right_x;
+ }
+ /*virtual*/ bool canEdit() const { return false; }
+ // eat handleMouseDown event so we get the mouseup event
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return TRUE; }
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) { mEditor.onCommit(); return TRUE; }
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask)
+ {
+ LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
+ return TRUE;
+ }
private:
- LLTextBase& mEditor;
- LLStyleSP mStyle;
- std::string mExpanderLabel;
+ LLTextBase& mEditor;
+ LLStyleSP mStyle;
+ std::string mExpanderLabel;
};
LLExpandableTextBox::LLTextBoxEx::Params::Params()
@@ -111,94 +111,94 @@ LLExpandableTextBox::LLTextBoxEx::Params::Params()
}
LLExpandableTextBox::LLTextBoxEx::LLTextBoxEx(const Params& p)
-: LLTextEditor(p),
- mExpanderLabel(p.label.isProvided() ? p.label : LLTrans::getString("More")),
- mExpanderVisible(false)
+: LLTextEditor(p),
+ mExpanderLabel(p.label.isProvided() ? p.label : LLTrans::getString("More")),
+ mExpanderVisible(false)
{
- setIsChrome(TRUE);
- setMaxTextLength(p.max_text_length);
+ setIsChrome(TRUE);
+ setMaxTextLength(p.max_text_length);
}
void LLExpandableTextBox::LLTextBoxEx::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- LLTextEditor::reshape(width, height, called_from_parent);
+ LLTextEditor::reshape(width, height, called_from_parent);
}
void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text,const LLStyle::Params& input_params)
{
- // LLTextBox::setText will obliterate the expander segment, so make sure
- // we generate it again by clearing mExpanderVisible
- mExpanderVisible = false;
- LLTextEditor::setText(text, input_params);
+ // LLTextBox::setText will obliterate the expander segment, so make sure
+ // we generate it again by clearing mExpanderVisible
+ mExpanderVisible = false;
+ LLTextEditor::setText(text, input_params);
- hideOrShowExpandTextAsNeeded();
+ hideOrShowExpandTextAsNeeded();
}
void LLExpandableTextBox::LLTextBoxEx::showExpandText()
{
- if (!mExpanderVisible)
- {
- // make sure we're scrolled to top when collapsing
- if (mScroller)
- {
- mScroller->goToTop();
- }
- // get fully visible lines
- std::pair<S32, S32> visible_lines = getVisibleLines(true);
- S32 last_line = visible_lines.second - 1;
-
- LLStyle::Params expander_style(getStyleParams());
- expander_style.font.style = "UNDERLINE";
- expander_style.color = LLUIColorTable::instance().getColor("HTMLLinkColor");
- LLExpanderSegment* expanderp = new LLExpanderSegment(new LLStyle(expander_style), getLineStart(last_line), getLength() + 1, mExpanderLabel, *this);
- insertSegment(expanderp);
- mExpanderVisible = true;
- }
+ if (!mExpanderVisible)
+ {
+ // make sure we're scrolled to top when collapsing
+ if (mScroller)
+ {
+ mScroller->goToTop();
+ }
+ // get fully visible lines
+ std::pair<S32, S32> visible_lines = getVisibleLines(true);
+ S32 last_line = visible_lines.second - 1;
+
+ LLStyle::Params expander_style(getStyleParams());
+ expander_style.font.style = "UNDERLINE";
+ expander_style.color = LLUIColorTable::instance().getColor("HTMLLinkColor");
+ LLExpanderSegment* expanderp = new LLExpanderSegment(new LLStyle(expander_style), getLineStart(last_line), getLength() + 1, mExpanderLabel, *this);
+ insertSegment(expanderp);
+ mExpanderVisible = true;
+ }
}
//NOTE: obliterates existing styles (including hyperlinks)
-void LLExpandableTextBox::LLTextBoxEx::hideExpandText()
-{
- if (mExpanderVisible)
- {
- // this will overwrite the expander segment and all text styling with a single style
- LLStyleConstSP sp(new LLStyle(getStyleParams()));
- LLNormalTextSegment* segmentp = new LLNormalTextSegment(sp, 0, getLength() + 1, *this);
- insertSegment(segmentp);
-
- mExpanderVisible = false;
- }
+void LLExpandableTextBox::LLTextBoxEx::hideExpandText()
+{
+ if (mExpanderVisible)
+ {
+ // this will overwrite the expander segment and all text styling with a single style
+ LLStyleConstSP sp(new LLStyle(getStyleParams()));
+ LLNormalTextSegment* segmentp = new LLNormalTextSegment(sp, 0, getLength() + 1, *this);
+ insertSegment(segmentp);
+
+ mExpanderVisible = false;
+ }
}
S32 LLExpandableTextBox::LLTextBoxEx::getVerticalTextDelta()
{
- S32 text_height = getTextPixelHeight();
- S32 textbox_height = getRect().getHeight();
+ S32 text_height = getTextPixelHeight();
+ S32 textbox_height = getRect().getHeight();
- return text_height - textbox_height;
+ return text_height - textbox_height;
}
S32 LLExpandableTextBox::LLTextBoxEx::getTextPixelHeight()
{
- return getTextBoundingRect().getHeight();
+ return getTextBoundingRect().getHeight();
}
void LLExpandableTextBox::LLTextBoxEx::hideOrShowExpandTextAsNeeded()
{
- // Restore the text box contents to calculate the text height properly,
- // otherwise if a part of the text is hidden under "More" link
- // getTextPixelHeight() returns only the height of currently visible text
- // including the "More" link. See STORM-250.
- hideExpandText();
-
- // Show the expander a.k.a. "More" link if we need it, depending on text
- // contents height. If not, keep it hidden.
- if (getTextPixelHeight() > getRect().getHeight())
- {
- showExpandText();
- }
+ // Restore the text box contents to calculate the text height properly,
+ // otherwise if a part of the text is hidden under "More" link
+ // getTextPixelHeight() returns only the height of currently visible text
+ // including the "More" link. See STORM-250.
+ hideExpandText();
+
+ // Show the expander a.k.a. "More" link if we need it, depending on text
+ // contents height. If not, keep it hidden.
+ if (getTextPixelHeight() > getRect().getHeight())
+ {
+ showExpandText();
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -206,57 +206,57 @@ void LLExpandableTextBox::LLTextBoxEx::hideOrShowExpandTextAsNeeded()
//////////////////////////////////////////////////////////////////////////
LLExpandableTextBox::Params::Params()
-: textbox("textbox"),
- scroll("scroll"),
- max_height("max_height", 0),
- bg_visible("bg_visible", false),
- expanded_bg_visible("expanded_bg_visible", true),
- bg_color("bg_color", LLColor4::black),
- expanded_bg_color("expanded_bg_color", LLColor4::black)
+: textbox("textbox"),
+ scroll("scroll"),
+ max_height("max_height", 0),
+ bg_visible("bg_visible", false),
+ expanded_bg_visible("expanded_bg_visible", true),
+ bg_color("bg_color", LLColor4::black),
+ expanded_bg_color("expanded_bg_color", LLColor4::black)
{
}
LLExpandableTextBox::LLExpandableTextBox(const Params& p)
-: LLUICtrl(p),
- mMaxHeight(p.max_height),
- mBGVisible(p.bg_visible),
- mExpandedBGVisible(p.expanded_bg_visible),
- mBGColor(p.bg_color),
- mExpandedBGColor(p.expanded_bg_color),
- mExpanded(false)
+: LLUICtrl(p),
+ mMaxHeight(p.max_height),
+ mBGVisible(p.bg_visible),
+ mExpandedBGVisible(p.expanded_bg_visible),
+ mBGColor(p.bg_color),
+ mExpandedBGColor(p.expanded_bg_color),
+ mExpanded(false)
{
- LLRect rc = getLocalRect();
+ LLRect rc = getLocalRect();
- LLScrollContainer::Params scroll_params = p.scroll;
- scroll_params.rect(rc);
- mScroll = LLUICtrlFactory::create<LLScrollContainer>(scroll_params);
- addChild(mScroll);
+ LLScrollContainer::Params scroll_params = p.scroll;
+ scroll_params.rect(rc);
+ mScroll = LLUICtrlFactory::create<LLScrollContainer>(scroll_params);
+ addChild(mScroll);
- LLTextBoxEx::Params textbox_params = p.textbox;
- textbox_params.rect(rc);
- mTextBox = LLUICtrlFactory::create<LLTextBoxEx>(textbox_params);
- mTextBox->setContentTrusted(false);
- mScroll->addChild(mTextBox);
+ LLTextBoxEx::Params textbox_params = p.textbox;
+ textbox_params.rect(rc);
+ mTextBox = LLUICtrlFactory::create<LLTextBoxEx>(textbox_params);
+ mTextBox->setContentTrusted(false);
+ mScroll->addChild(mTextBox);
- updateTextBoxRect();
+ updateTextBoxRect();
- mTextBox->setCommitCallback(boost::bind(&LLExpandableTextBox::onExpandClicked, this));
+ mTextBox->setCommitCallback(boost::bind(&LLExpandableTextBox::onExpandClicked, this));
}
void LLExpandableTextBox::draw()
{
- if(mBGVisible && !mExpanded)
- {
- gl_rect_2d(getLocalRect(), mBGColor.get(), TRUE);
- }
- if(mExpandedBGVisible && mExpanded)
- {
- gl_rect_2d(getLocalRect(), mExpandedBGColor.get(), TRUE);
- }
-
- collapseIfPosChanged();
-
- LLUICtrl::draw();
+ if(mBGVisible && !mExpanded)
+ {
+ gl_rect_2d(getLocalRect(), mBGColor.get(), TRUE);
+ }
+ if(mExpandedBGVisible && mExpanded)
+ {
+ gl_rect_2d(getLocalRect(), mExpandedBGColor.get(), TRUE);
+ }
+
+ collapseIfPosChanged();
+
+ LLUICtrl::draw();
}
void LLExpandableTextBox::setContentTrusted(bool trusted_content)
@@ -266,168 +266,168 @@ void LLExpandableTextBox::setContentTrusted(bool trusted_content)
void LLExpandableTextBox::collapseIfPosChanged()
{
- if(mExpanded)
- {
- LLView* parentp = getParent();
- LLRect parent_rect = parentp->getRect();
- parentp->localRectToOtherView(parent_rect, &parent_rect, getRootView());
-
- if(parent_rect.mLeft != mParentRect.mLeft
- || parent_rect.mTop != mParentRect.mTop)
- {
- collapseTextBox();
- }
- }
+ if(mExpanded)
+ {
+ LLView* parentp = getParent();
+ LLRect parent_rect = parentp->getRect();
+ parentp->localRectToOtherView(parent_rect, &parent_rect, getRootView());
+
+ if(parent_rect.mLeft != mParentRect.mLeft
+ || parent_rect.mTop != mParentRect.mTop)
+ {
+ collapseTextBox();
+ }
+ }
}
void LLExpandableTextBox::onExpandClicked()
{
- expandTextBox();
+ expandTextBox();
}
void LLExpandableTextBox::updateTextBoxRect()
{
- LLRect rc = getLocalRect();
-
- rc.mLeft += mScroll->getBorderWidth();
- rc.mRight -= mScroll->getBorderWidth();
- rc.mTop -= mScroll->getBorderWidth();
- rc.mBottom += mScroll->getBorderWidth();
-
- mTextBox->reshape(rc.getWidth(), rc.getHeight());
- mTextBox->setRect(rc);
- // *HACK
- // hideExpandText brakes text styles (replaces hyper-links with plain text), see ticket EXT-3290
- // Also text segments are not removed properly. Same issue at expandTextBox().
- // So set text again to make text box re-apply styles and clear segments.
- // *TODO Find a solution that does not involve text segment.
- mTextBox->setText(mText);
+ LLRect rc = getLocalRect();
+
+ rc.mLeft += mScroll->getBorderWidth();
+ rc.mRight -= mScroll->getBorderWidth();
+ rc.mTop -= mScroll->getBorderWidth();
+ rc.mBottom += mScroll->getBorderWidth();
+
+ mTextBox->reshape(rc.getWidth(), rc.getHeight());
+ mTextBox->setRect(rc);
+ // *HACK
+ // hideExpandText brakes text styles (replaces hyper-links with plain text), see ticket EXT-3290
+ // Also text segments are not removed properly. Same issue at expandTextBox().
+ // So set text again to make text box re-apply styles and clear segments.
+ // *TODO Find a solution that does not involve text segment.
+ mTextBox->setText(mText);
}
S32 LLExpandableTextBox::recalculateTextDelta(S32 text_delta)
{
- LLRect expanded_rect = getLocalRect();
- LLView* root_view = getRootView();
- LLRect window_rect = root_view->getRect();
-
- LLRect expanded_screen_rect;
- localRectToOtherView(expanded_rect, &expanded_screen_rect, root_view);
-
- // don't allow expanded text box bottom go off screen
- if(expanded_screen_rect.mBottom - text_delta < window_rect.mBottom)
- {
- text_delta = expanded_screen_rect.mBottom - window_rect.mBottom;
- }
- // show scroll bar if max_height is valid
- // and expanded size is greater that max_height
- else if(mMaxHeight > 0 && expanded_rect.getHeight() + text_delta > mMaxHeight)
- {
- text_delta = mMaxHeight - expanded_rect.getHeight();
- }
-
- return text_delta;
+ LLRect expanded_rect = getLocalRect();
+ LLView* root_view = getRootView();
+ LLRect window_rect = root_view->getRect();
+
+ LLRect expanded_screen_rect;
+ localRectToOtherView(expanded_rect, &expanded_screen_rect, root_view);
+
+ // don't allow expanded text box bottom go off screen
+ if(expanded_screen_rect.mBottom - text_delta < window_rect.mBottom)
+ {
+ text_delta = expanded_screen_rect.mBottom - window_rect.mBottom;
+ }
+ // show scroll bar if max_height is valid
+ // and expanded size is greater that max_height
+ else if(mMaxHeight > 0 && expanded_rect.getHeight() + text_delta > mMaxHeight)
+ {
+ text_delta = mMaxHeight - expanded_rect.getHeight();
+ }
+
+ return text_delta;
}
void LLExpandableTextBox::expandTextBox()
{
- // hide "more" link, and show full text contents
- mTextBox->hideExpandText();
-
- // *HACK dz
- // hideExpandText brakes text styles (replaces hyper-links with plain text), see ticket EXT-3290
- // Set text again to make text box re-apply styles.
- // *TODO Find proper solution to fix this issue.
- // Maybe add removeSegment to LLTextBase
- mTextBox->setTextBase(mText);
-
- S32 text_delta = mTextBox->getVerticalTextDelta();
- text_delta += mTextBox->getVPad() * 2;
- text_delta += mScroll->getBorderWidth() * 2;
- // no need to expand
- if(text_delta <= 0)
- {
- return;
- }
-
- saveCollapsedState();
-
- LLRect expanded_rect = getLocalRect();
- LLRect expanded_screen_rect;
-
- S32 updated_text_delta = recalculateTextDelta(text_delta);
- // actual expand
- expanded_rect.mBottom -= updated_text_delta;
-
- LLRect text_box_rect = mTextBox->getRect();
-
- // check if we need to show scrollbar
- if(text_delta != updated_text_delta)
- {
- static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
-
- // disable horizontal scrollbar
- text_box_rect.mRight -= scrollbar_size;
-
- // text box size has changed - redo text wrap
- // Should be handled automatically in reshape() below. JC
- //mTextBox->setWrappedText(mText, text_box_rect.getWidth());
-
- // recalculate text delta since text wrap changed text height
- text_delta = mTextBox->getVerticalTextDelta() + mTextBox->getVPad() * 2;
- }
-
- // expand text
- text_box_rect.mBottom -= text_delta;
- mTextBox->reshape(text_box_rect.getWidth(), text_box_rect.getHeight());
- mTextBox->setRect(text_box_rect);
-
- // expand text box
- localRectToOtherView(expanded_rect, &expanded_screen_rect, getParent());
- reshape(expanded_screen_rect.getWidth(), expanded_screen_rect.getHeight(), FALSE);
- setRect(expanded_screen_rect);
-
- setFocus(TRUE);
- // this lets us receive top_lost event(needed to collapse text box)
- // it also draws text box above all other ui elements
- gViewerWindow->addPopup(this);
-
- mExpanded = true;
+ // hide "more" link, and show full text contents
+ mTextBox->hideExpandText();
+
+ // *HACK dz
+ // hideExpandText brakes text styles (replaces hyper-links with plain text), see ticket EXT-3290
+ // Set text again to make text box re-apply styles.
+ // *TODO Find proper solution to fix this issue.
+ // Maybe add removeSegment to LLTextBase
+ mTextBox->setTextBase(mText);
+
+ S32 text_delta = mTextBox->getVerticalTextDelta();
+ text_delta += mTextBox->getVPad() * 2;
+ text_delta += mScroll->getBorderWidth() * 2;
+ // no need to expand
+ if(text_delta <= 0)
+ {
+ return;
+ }
+
+ saveCollapsedState();
+
+ LLRect expanded_rect = getLocalRect();
+ LLRect expanded_screen_rect;
+
+ S32 updated_text_delta = recalculateTextDelta(text_delta);
+ // actual expand
+ expanded_rect.mBottom -= updated_text_delta;
+
+ LLRect text_box_rect = mTextBox->getRect();
+
+ // check if we need to show scrollbar
+ if(text_delta != updated_text_delta)
+ {
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+ // disable horizontal scrollbar
+ text_box_rect.mRight -= scrollbar_size;
+
+ // text box size has changed - redo text wrap
+ // Should be handled automatically in reshape() below. JC
+ //mTextBox->setWrappedText(mText, text_box_rect.getWidth());
+
+ // recalculate text delta since text wrap changed text height
+ text_delta = mTextBox->getVerticalTextDelta() + mTextBox->getVPad() * 2;
+ }
+
+ // expand text
+ text_box_rect.mBottom -= text_delta;
+ mTextBox->reshape(text_box_rect.getWidth(), text_box_rect.getHeight());
+ mTextBox->setRect(text_box_rect);
+
+ // expand text box
+ localRectToOtherView(expanded_rect, &expanded_screen_rect, getParent());
+ reshape(expanded_screen_rect.getWidth(), expanded_screen_rect.getHeight(), FALSE);
+ setRect(expanded_screen_rect);
+
+ setFocus(TRUE);
+ // this lets us receive top_lost event(needed to collapse text box)
+ // it also draws text box above all other ui elements
+ gViewerWindow->addPopup(this);
+
+ mExpanded = true;
}
void LLExpandableTextBox::collapseTextBox()
{
- if(!mExpanded)
- {
- return;
- }
+ if(!mExpanded)
+ {
+ return;
+ }
- mExpanded = false;
+ mExpanded = false;
- reshape(mCollapsedRect.getWidth(), mCollapsedRect.getHeight(), FALSE);
- setRect(mCollapsedRect);
+ reshape(mCollapsedRect.getWidth(), mCollapsedRect.getHeight(), FALSE);
+ setRect(mCollapsedRect);
- updateTextBoxRect();
- gViewerWindow->removePopup(this);
+ updateTextBoxRect();
+ gViewerWindow->removePopup(this);
}
void LLExpandableTextBox::onFocusLost()
{
- collapseTextBox();
+ collapseTextBox();
- LLUICtrl::onFocusLost();
+ LLUICtrl::onFocusLost();
}
void LLExpandableTextBox::onTopLost()
{
- collapseTextBox();
+ collapseTextBox();
- LLUICtrl::onTopLost();
+ LLUICtrl::onTopLost();
}
void LLExpandableTextBox::updateTextShape()
{
- llassert(!mExpanded);
- updateTextBoxRect();
+ llassert(!mExpanded);
+ updateTextBoxRect();
}
void LLExpandableTextBox::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -439,24 +439,24 @@ void LLExpandableTextBox::reshape(S32 width, S32 height, BOOL called_from_parent
void LLExpandableTextBox::setValue(const LLSD& value)
{
- collapseTextBox();
- mText = value.asString();
- mTextBox->setValue(value);
+ collapseTextBox();
+ mText = value.asString();
+ mTextBox->setValue(value);
}
void LLExpandableTextBox::setText(const std::string& str)
{
- collapseTextBox();
- mText = str;
- mTextBox->setText(str);
+ collapseTextBox();
+ mText = str;
+ mTextBox->setText(str);
}
void LLExpandableTextBox::saveCollapsedState()
{
- mCollapsedRect = getRect();
+ mCollapsedRect = getRect();
- mParentRect = getParent()->getRect();
- // convert parent rect to screen coordinates,
- // this will allow to track parent's position change
- getParent()->localRectToOtherView(mParentRect, &mParentRect, getRootView());
+ mParentRect = getParent()->getRect();
+ // convert parent rect to screen coordinates,
+ // this will allow to track parent's position change
+ getParent()->localRectToOtherView(mParentRect, &mParentRect, getRootView());
}
diff --git a/indra/newview/llexpandabletextbox.h b/indra/newview/llexpandabletextbox.h
index aaf393277f..385bb35017 100644
--- a/indra/newview/llexpandabletextbox.h
+++ b/indra/newview/llexpandabletextbox.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llexpandabletextbox.h
* @brief LLExpandableTextBox and related class definitions
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,179 +39,179 @@ class LLExpandableTextBox : public LLUICtrl
{
protected:
- /**
- * Extended text box. "More" link will appear at end of text if
- * text is too long to fit into text box size.
- */
- class LLTextBoxEx : public LLTextEditor
- {
- public:
- struct Params : public LLInitParam::Block<Params, LLTextEditor::Params>
- {
- Params();
- };
-
- // adds or removes "More" link as needed
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- /*virtual*/ void setText(const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params());
- void setTextBase(const std::string& text) { LLTextBase::setText(text); }
-
- /**
- * Returns difference between text box height and text height.
- * Value is positive if text height is greater than text box height.
- */
- virtual S32 getVerticalTextDelta();
-
- /**
- * Returns the height of text rect.
- */
- S32 getTextPixelHeight();
-
- /**
- * Shows "More" link
- */
- void showExpandText();
-
- /**
- * Hides "More" link
- */
- void hideExpandText();
-
- /**
- * Shows the "More" link if the text is too high to be completely
- * visible without expanding the text box. Hides that link otherwise.
- */
- void hideOrShowExpandTextAsNeeded();
-
- protected:
-
- LLTextBoxEx(const Params& p);
- friend class LLUICtrlFactory;
-
- private:
- std::string mExpanderLabel;
-
- bool mExpanderVisible;
- };
+ /**
+ * Extended text box. "More" link will appear at end of text if
+ * text is too long to fit into text box size.
+ */
+ class LLTextBoxEx : public LLTextEditor
+ {
+ public:
+ struct Params : public LLInitParam::Block<Params, LLTextEditor::Params>
+ {
+ Params();
+ };
+
+ // adds or removes "More" link as needed
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ /*virtual*/ void setText(const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params());
+ void setTextBase(const std::string& text) { LLTextBase::setText(text); }
+
+ /**
+ * Returns difference between text box height and text height.
+ * Value is positive if text height is greater than text box height.
+ */
+ virtual S32 getVerticalTextDelta();
+
+ /**
+ * Returns the height of text rect.
+ */
+ S32 getTextPixelHeight();
+
+ /**
+ * Shows "More" link
+ */
+ void showExpandText();
+
+ /**
+ * Hides "More" link
+ */
+ void hideExpandText();
+
+ /**
+ * Shows the "More" link if the text is too high to be completely
+ * visible without expanding the text box. Hides that link otherwise.
+ */
+ void hideOrShowExpandTextAsNeeded();
+
+ protected:
+
+ LLTextBoxEx(const Params& p);
+ friend class LLUICtrlFactory;
+
+ private:
+ std::string mExpanderLabel;
+
+ bool mExpanderVisible;
+ };
public:
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<LLTextBoxEx::Params> textbox;
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Optional<LLTextBoxEx::Params> textbox;
+
+ Optional<LLScrollContainer::Params> scroll;
- Optional<LLScrollContainer::Params> scroll;
+ Optional<S32> max_height;
- Optional<S32> max_height;
-
- Optional<bool> bg_visible,
- expanded_bg_visible;
+ Optional<bool> bg_visible,
+ expanded_bg_visible;
- Optional<LLUIColor> bg_color,
- expanded_bg_color;
+ Optional<LLUIColor> bg_color,
+ expanded_bg_color;
- Params();
- };
+ Params();
+ };
- /**
- * Sets text
- */
- virtual void setText(const std::string& str);
+ /**
+ * Sets text
+ */
+ virtual void setText(const std::string& str);
- /**
- * Returns text
- */
- virtual std::string getText() const { return mText; }
+ /**
+ * Returns text
+ */
+ virtual std::string getText() const { return mText; }
- /**
- * Sets text
- */
- /*virtual*/ void setValue(const LLSD& value);
+ /**
+ * Sets text
+ */
+ /*virtual*/ void setValue(const LLSD& value);
- /**
- * Returns text
- */
- /*virtual*/ LLSD getValue() const { return mText; }
+ /**
+ * Returns text
+ */
+ /*virtual*/ LLSD getValue() const { return mText; }
- /**
- * Collapses text box on focus_lost event
- */
- /*virtual*/ void onFocusLost();
+ /**
+ * Collapses text box on focus_lost event
+ */
+ /*virtual*/ void onFocusLost();
- /**
- * Collapses text box on top_lost event
- */
- /*virtual*/ void onTopLost();
+ /**
+ * Collapses text box on top_lost event
+ */
+ /*virtual*/ void onTopLost();
- /**
- * *HACK: Update the inner textbox shape.
- */
- void updateTextShape();
- virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ /**
+ * *HACK: Update the inner textbox shape.
+ */
+ void updateTextShape();
+ virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- /**
- * Draws text box, collapses text box if its expanded and its parent's position changed
- */
- /*virtual*/ void draw();
+ /**
+ * Draws text box, collapses text box if its expanded and its parent's position changed
+ */
+ /*virtual*/ void draw();
protected:
- LLExpandableTextBox(const Params& p);
- friend class LLUICtrlFactory;
+ LLExpandableTextBox(const Params& p);
+ friend class LLUICtrlFactory;
- /**
- * Expands text box.
- * A scroll bar will appear if expanded height is greater than max_height
- */
- virtual void expandTextBox();
+ /**
+ * Expands text box.
+ * A scroll bar will appear if expanded height is greater than max_height
+ */
+ virtual void expandTextBox();
- /**
- * Collapses text box.
- */
- virtual void collapseTextBox();
+ /**
+ * Collapses text box.
+ */
+ virtual void collapseTextBox();
- /**
- * Collapses text box if it is expanded and its parent's position changed
- */
- virtual void collapseIfPosChanged();
+ /**
+ * Collapses text box if it is expanded and its parent's position changed
+ */
+ virtual void collapseIfPosChanged();
- /**
- * Updates text box rect to avoid horizontal scroll bar
- */
- virtual void updateTextBoxRect();
+ /**
+ * Updates text box rect to avoid horizontal scroll bar
+ */
+ virtual void updateTextBoxRect();
- /**
- * User clicked on "More" link - expand text box
- */
- virtual void onExpandClicked();
+ /**
+ * User clicked on "More" link - expand text box
+ */
+ virtual void onExpandClicked();
- /**
- * Saves collapsed text box's states(rect, parent rect...)
- */
- virtual void saveCollapsedState();
+ /**
+ * Saves collapsed text box's states(rect, parent rect...)
+ */
+ virtual void saveCollapsedState();
- /**
- * Recalculate text delta considering min_height and window rect.
- */
- virtual S32 recalculateTextDelta(S32 text_delta);
+ /**
+ * Recalculate text delta considering min_height and window rect.
+ */
+ virtual S32 recalculateTextDelta(S32 text_delta);
- void setContentTrusted(bool trusted_content);
+ void setContentTrusted(bool trusted_content);
protected:
- std::string mText;
- LLTextBoxEx* mTextBox;
- LLScrollContainer* mScroll;
+ std::string mText;
+ LLTextBoxEx* mTextBox;
+ LLScrollContainer* mScroll;
- S32 mMaxHeight;
- LLRect mCollapsedRect;
- bool mExpanded;
- LLRect mParentRect;
+ S32 mMaxHeight;
+ LLRect mCollapsedRect;
+ bool mExpanded;
+ LLRect mParentRect;
- bool mBGVisible;
- bool mExpandedBGVisible;
- LLUIColor mBGColor;
- LLUIColor mExpandedBGColor;
+ bool mBGVisible;
+ bool mExpandedBGVisible;
+ LLUIColor mBGColor;
+ LLUIColor mExpandedBGColor;
};
#endif //LL_LLEXPANDABLETEXTBOX_H
diff --git a/indra/newview/llexperiencelog.cpp b/indra/newview/llexperiencelog.cpp
index c441fbc09f..ce10fba2ca 100644
--- a/indra/newview/llexperiencelog.cpp
+++ b/indra/newview/llexperiencelog.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llexperiencelog.cpp
* @brief llexperiencelog implementation
*
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,246 +39,246 @@
class LLExperienceLogDispatchHandler : public LLDispatchHandler
{
public:
- virtual bool operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings)
- {
- LLSD message;
-
- sparam_t::const_iterator it = strings.begin();
- if(it != strings.end()){
- const std::string& llsdRaw = *it++;
- std::istringstream llsdData(llsdRaw);
- if (!LLSDSerialize::deserialize(message, llsdData, llsdRaw.length()))
- {
- LL_WARNS() << "LLExperienceLogDispatchHandler: Attempted to read parameter data into LLSD but failed:" << llsdRaw << LL_ENDL;
- }
- }
- message["public_id"] = invoice;
-
- // Object Name
- if(it != strings.end())
- {
- message["ObjectName"] = *it++;
- }
-
- // parcel Name
- if(it != strings.end())
- {
- message["ParcelName"] = *it++;
- }
- message["Count"] = 1;
-
- LLExperienceLog::instance().handleExperienceMessage(message);
- return true;
- }
+ virtual bool operator()(
+ const LLDispatcher* dispatcher,
+ const std::string& key,
+ const LLUUID& invoice,
+ const sparam_t& strings)
+ {
+ LLSD message;
+
+ sparam_t::const_iterator it = strings.begin();
+ if(it != strings.end()){
+ const std::string& llsdRaw = *it++;
+ std::istringstream llsdData(llsdRaw);
+ if (!LLSDSerialize::deserialize(message, llsdData, llsdRaw.length()))
+ {
+ LL_WARNS() << "LLExperienceLogDispatchHandler: Attempted to read parameter data into LLSD but failed:" << llsdRaw << LL_ENDL;
+ }
+ }
+ message["public_id"] = invoice;
+
+ // Object Name
+ if(it != strings.end())
+ {
+ message["ObjectName"] = *it++;
+ }
+
+ // parcel Name
+ if(it != strings.end())
+ {
+ message["ParcelName"] = *it++;
+ }
+ message["Count"] = 1;
+
+ LLExperienceLog::instance().handleExperienceMessage(message);
+ return true;
+ }
};
static LLExperienceLogDispatchHandler experience_log_dispatch_handler;
void LLExperienceLog::handleExperienceMessage(LLSD& message)
{
- time_t now;
- time(&now);
- char daybuf[16];/* Flawfinder: ignore */
- char time_of_day[16];/* Flawfinder: ignore */
- strftime(daybuf, 16, "%Y-%m-%d", localtime(&now));
- strftime(time_of_day, 16, " %H:%M:%S", localtime(&now));
- message["Time"] = time_of_day;
-
- std::string day = daybuf;
-
- if(!mEvents.has(day))
- {
- mEvents[day] = LLSD::emptyArray();
- }
- LLSD& dayEvents = mEvents[day];
- if(dayEvents.size() > 0)
- {
- LLSD& last = *(dayEvents.rbeginArray());
- if( last["public_id"].asUUID() == message["public_id"].asUUID()
- && last["ObjectName"].asString() == message["ObjectName"].asString()
- && last["OwnerID"].asUUID() == message["OwnerID"].asUUID()
- && last["ParcelName"].asString() == message["ParcelName"].asString()
- && last["Permission"].asInteger() == message["Permission"].asInteger())
- {
- last["Count"] = last["Count"].asInteger() + 1;
- last["Time"] = time_of_day;
- mSignals(last);
- return;
- }
- }
- message["Time"] = time_of_day;
- mEvents[day].append(message);
- mEventsToSave[day].append(message);
- mSignals(message);
+ time_t now;
+ time(&now);
+ char daybuf[16];/* Flawfinder: ignore */
+ char time_of_day[16];/* Flawfinder: ignore */
+ strftime(daybuf, 16, "%Y-%m-%d", localtime(&now));
+ strftime(time_of_day, 16, " %H:%M:%S", localtime(&now));
+ message["Time"] = time_of_day;
+
+ std::string day = daybuf;
+
+ if(!mEvents.has(day))
+ {
+ mEvents[day] = LLSD::emptyArray();
+ }
+ LLSD& dayEvents = mEvents[day];
+ if(dayEvents.size() > 0)
+ {
+ LLSD& last = *(dayEvents.rbeginArray());
+ if( last["public_id"].asUUID() == message["public_id"].asUUID()
+ && last["ObjectName"].asString() == message["ObjectName"].asString()
+ && last["OwnerID"].asUUID() == message["OwnerID"].asUUID()
+ && last["ParcelName"].asString() == message["ParcelName"].asString()
+ && last["Permission"].asInteger() == message["Permission"].asInteger())
+ {
+ last["Count"] = last["Count"].asInteger() + 1;
+ last["Time"] = time_of_day;
+ mSignals(last);
+ return;
+ }
+ }
+ message["Time"] = time_of_day;
+ mEvents[day].append(message);
+ mEventsToSave[day].append(message);
+ mSignals(message);
}
LLExperienceLog::LLExperienceLog()
- : mMaxDays(7)
- , mPageSize(25)
- , mNotifyNewEvent(false)
+ : mMaxDays(7)
+ , mPageSize(25)
+ , mNotifyNewEvent(false)
{
}
void LLExperienceLog::initialize()
{
- loadEvents();
- if(!gGenericDispatcher.isHandlerPresent("ExperienceEvent"))
- {
- gGenericDispatcher.addHandler("ExperienceEvent", &experience_log_dispatch_handler);
- }
+ loadEvents();
+ if(!gGenericDispatcher.isHandlerPresent("ExperienceEvent"))
+ {
+ gGenericDispatcher.addHandler("ExperienceEvent", &experience_log_dispatch_handler);
+ }
}
std::string LLExperienceLog::getFilename()
{
- return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "experience_events.xml");
+ return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "experience_events.xml");
}
std::string LLExperienceLog::getPermissionString( const LLSD& message, const std::string& base )
{
- std::ostringstream buf;
- if(message.has("Permission"))
- {
- buf << base << message["Permission"].asInteger();
- std::string entry;
- if(LLTrans::findString(entry, buf.str()))
- {
- buf.str(entry);
- }
- }
-
- if(buf.str().empty())
- {
- buf << base << "Unknown";
-
- buf.str(LLTrans::getString(buf.str(), message));
- }
-
- return buf.str();
+ std::ostringstream buf;
+ if(message.has("Permission"))
+ {
+ buf << base << message["Permission"].asInteger();
+ std::string entry;
+ if(LLTrans::findString(entry, buf.str()))
+ {
+ buf.str(entry);
+ }
+ }
+
+ if(buf.str().empty())
+ {
+ buf << base << "Unknown";
+
+ buf.str(LLTrans::getString(buf.str(), message));
+ }
+
+ return buf.str();
}
void LLExperienceLog::notify( LLSD& message )
{
- message["EventType"] = getPermissionString(message, "ExperiencePermission");
- if(message.has("IsAttachment") && message["IsAttachment"].asBoolean())
- {
- LLNotificationsUtil::add("ExperienceEventAttachment", message);
- }
- else
- {
- LLNotificationsUtil::add("ExperienceEvent", message);
- }
- message.erase("EventType");
+ message["EventType"] = getPermissionString(message, "ExperiencePermission");
+ if(message.has("IsAttachment") && message["IsAttachment"].asBoolean())
+ {
+ LLNotificationsUtil::add("ExperienceEventAttachment", message);
+ }
+ else
+ {
+ LLNotificationsUtil::add("ExperienceEvent", message);
+ }
+ message.erase("EventType");
}
void LLExperienceLog::saveEvents()
{
- std::string filename = getFilename();
- LLSD settings = LLSD::emptyMap().with("Events", mEventsToSave);
+ std::string filename = getFilename();
+ LLSD settings = LLSD::emptyMap().with("Events", mEventsToSave);
- settings["MaxDays"] = (int)mMaxDays;
- settings["Notify"] = mNotifyNewEvent;
- settings["PageSize"] = (int)mPageSize;
+ settings["MaxDays"] = (int)mMaxDays;
+ settings["Notify"] = mNotifyNewEvent;
+ settings["PageSize"] = (int)mPageSize;
- llofstream stream(filename.c_str());
- LLSDSerialize::toPrettyXML(settings, stream);
+ llofstream stream(filename.c_str());
+ LLSDSerialize::toPrettyXML(settings, stream);
}
void LLExperienceLog::loadEvents()
{
- LLSD settings = LLSD::emptyMap();
-
- std::string filename = getFilename();
- llifstream stream(filename.c_str());
- LLSDSerialize::fromXMLDocument(settings, stream);
-
- if(settings.has("MaxDays"))
- {
- setMaxDays((U32)settings["MaxDays"].asInteger());
- }
- if(settings.has("Notify"))
- {
- setNotifyNewEvent(settings["Notify"].asBoolean());
- }
- if(settings.has("PageSize"))
- {
- setPageSize((U32)settings["PageSize"].asInteger());
- }
- mEvents.clear();
- if(mMaxDays > 0 && settings.has("Events"))
- {
- mEvents = settings["Events"];
- mEventsToSave = mEvents;
- }
+ LLSD settings = LLSD::emptyMap();
+
+ std::string filename = getFilename();
+ llifstream stream(filename.c_str());
+ LLSDSerialize::fromXMLDocument(settings, stream);
+
+ if(settings.has("MaxDays"))
+ {
+ setMaxDays((U32)settings["MaxDays"].asInteger());
+ }
+ if(settings.has("Notify"))
+ {
+ setNotifyNewEvent(settings["Notify"].asBoolean());
+ }
+ if(settings.has("PageSize"))
+ {
+ setPageSize((U32)settings["PageSize"].asInteger());
+ }
+ mEvents.clear();
+ if(mMaxDays > 0 && settings.has("Events"))
+ {
+ mEvents = settings["Events"];
+ mEventsToSave = mEvents;
+ }
}
LLExperienceLog::~LLExperienceLog()
{
- saveEvents();
+ saveEvents();
}
void LLExperienceLog::eraseExpired()
{
- while(mEvents.size() > mMaxDays && mMaxDays > 0)
- {
- mEvents.erase(mEvents.beginMap()->first);
- }
+ while(mEvents.size() > mMaxDays && mMaxDays > 0)
+ {
+ mEvents.erase(mEvents.beginMap()->first);
+ }
}
bool LLExperienceLog::isNotExpired(std::string& date)
{
- LLDate event_date;
- S32 month, day, year;
- S32 matched = sscanf(date.c_str(), "%d-%d-%d", &year, &month, &day);
- if (matched != 3) return false;
- event_date.fromYMDHMS(year, month, day);
- const U32 seconds_in_day = 24 * 60 * 60;
- S32 curr_year = 0, curr_month = 0, curr_day = 0;
+ LLDate event_date;
+ S32 month, day, year;
+ S32 matched = sscanf(date.c_str(), "%d-%d-%d", &year, &month, &day);
+ if (matched != 3) return false;
+ event_date.fromYMDHMS(year, month, day);
+ const U32 seconds_in_day = 24 * 60 * 60;
+ S32 curr_year = 0, curr_month = 0, curr_day = 0;
- LLDate curr_date = LLDate::now();
- curr_date.split(&curr_year, &curr_month, &curr_day);
- curr_date.fromYMDHMS(curr_year, curr_month, curr_day); // Set hour, min, and sec to 0
+ LLDate curr_date = LLDate::now();
+ curr_date.split(&curr_year, &curr_month, &curr_day);
+ curr_date.fromYMDHMS(curr_year, curr_month, curr_day); // Set hour, min, and sec to 0
- LLDate boundary_date = LLDate(curr_date.secondsSinceEpoch() - seconds_in_day*getMaxDays());
- return event_date >= boundary_date;
+ LLDate boundary_date = LLDate(curr_date.secondsSinceEpoch() - seconds_in_day*getMaxDays());
+ return event_date >= boundary_date;
}
const LLSD& LLExperienceLog::getEvents() const
{
- return mEvents;
+ return mEvents;
}
void LLExperienceLog::clear()
{
- mEvents.clear();
+ mEvents.clear();
}
void LLExperienceLog::setMaxDays( U32 val )
{
- mMaxDays = val;
+ mMaxDays = val;
}
LLExperienceLog::callback_connection_t LLExperienceLog::addUpdateSignal( const callback_slot_t& cb )
{
- return mSignals.connect(cb);
+ return mSignals.connect(cb);
}
void LLExperienceLog::setNotifyNewEvent( bool val )
{
- mNotifyNewEvent = val;
- if(!val && mNotifyConnection.connected())
- {
- mNotifyConnection.disconnect();
- }
- else if( val && !mNotifyConnection.connected())
- {
- mNotifyConnection = addUpdateSignal(boost::function<void(LLSD&)>(LLExperienceLog::notify));
- }
+ mNotifyNewEvent = val;
+ if(!val && mNotifyConnection.connected())
+ {
+ mNotifyConnection.disconnect();
+ }
+ else if( val && !mNotifyConnection.connected())
+ {
+ mNotifyConnection = addUpdateSignal(boost::function<void(LLSD&)>(LLExperienceLog::notify));
+ }
}
diff --git a/indra/newview/llexperiencelog.h b/indra/newview/llexperiencelog.h
index 5cc5bf685f..cfe80fcaed 100644
--- a/indra/newview/llexperiencelog.h
+++ b/indra/newview/llexperiencelog.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llexperiencelog.h
* @brief llexperiencelog and related class definitions
*
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,53 +33,53 @@
class LLExperienceLog : public LLSingleton<LLExperienceLog>
{
- LLSINGLETON(LLExperienceLog);
+ LLSINGLETON(LLExperienceLog);
public:
- typedef boost::signals2::signal<void(LLSD&)>
- callback_signal_t;
- typedef callback_signal_t::slot_type callback_slot_t;
- typedef boost::signals2::connection callback_connection_t;
- callback_connection_t addUpdateSignal(const callback_slot_t& cb);
+ typedef boost::signals2::signal<void(LLSD&)>
+ callback_signal_t;
+ typedef callback_signal_t::slot_type callback_slot_t;
+ typedef boost::signals2::connection callback_connection_t;
+ callback_connection_t addUpdateSignal(const callback_slot_t& cb);
- void initialize();
+ void initialize();
- U32 getMaxDays() const { return mMaxDays; }
- void setMaxDays(U32 val);
+ U32 getMaxDays() const { return mMaxDays; }
+ void setMaxDays(U32 val);
- bool getNotifyNewEvent() const { return mNotifyNewEvent; }
- void setNotifyNewEvent(bool val);
+ bool getNotifyNewEvent() const { return mNotifyNewEvent; }
+ void setNotifyNewEvent(bool val);
- U32 getPageSize() const { return mPageSize; }
- void setPageSize(U32 val) { mPageSize = val; }
+ U32 getPageSize() const { return mPageSize; }
+ void setPageSize(U32 val) { mPageSize = val; }
- const LLSD& getEvents()const;
- void clear();
+ const LLSD& getEvents()const;
+ void clear();
- virtual ~LLExperienceLog();
+ virtual ~LLExperienceLog();
- static void notify(LLSD& message);
- static std::string getFilename();
- static std::string getPermissionString(const LLSD& message, const std::string& base);
- void setEventsToSave(LLSD new_events){mEventsToSave = new_events; }
- bool isNotExpired(std::string& date);
- void handleExperienceMessage(LLSD& message);
+ static void notify(LLSD& message);
+ static std::string getFilename();
+ static std::string getPermissionString(const LLSD& message, const std::string& base);
+ void setEventsToSave(LLSD new_events){mEventsToSave = new_events; }
+ bool isNotExpired(std::string& date);
+ void handleExperienceMessage(LLSD& message);
protected:
- void loadEvents();
- void saveEvents();
- void eraseExpired();
+ void loadEvents();
+ void saveEvents();
+ void eraseExpired();
- LLSD mEvents;
- LLSD mEventsToSave;
- callback_signal_t mSignals;
- callback_connection_t mNotifyConnection;
- U32 mMaxDays;
- U32 mPageSize;
- bool mNotifyNewEvent;
+ LLSD mEvents;
+ LLSD mEventsToSave;
+ callback_signal_t mSignals;
+ callback_connection_t mNotifyConnection;
+ U32 mMaxDays;
+ U32 mPageSize;
+ bool mNotifyNewEvent;
- friend class LLExperienceLogDispatchHandler;
+ friend class LLExperienceLogDispatchHandler;
};
diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp
index b0d88159c1..f96dd6fe67 100644
--- a/indra/newview/llexternaleditor.cpp
+++ b/indra/newview/llexternaleditor.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llexternaleditor.cpp
* @brief A convenient class to run external editor.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,82 +41,82 @@ const std::string LLExternalEditor::sSetting = "ExternalEditor";
LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env_var, const std::string& override)
{
- std::string cmd = findCommand(env_var, override);
- if (cmd.empty())
- {
- LL_WARNS() << "Editor command is empty or not set" << LL_ENDL;
- return EC_NOT_SPECIFIED;
- }
-
- string_vec_t tokens;
- tokenize(tokens, cmd);
-
- // Check executable for existence.
- std::string bin_path = tokens[0];
- if (!LLFile::isfile(bin_path))
- {
- LL_WARNS() << "Editor binary [" << bin_path << "] not found" << LL_ENDL;
- return EC_BINARY_NOT_FOUND;
- }
-
- // Save command.
- mProcessParams = LLProcess::Params();
- mProcessParams.executable = bin_path;
- for (size_t i = 1; i < tokens.size(); ++i)
- {
- mProcessParams.args.add(tokens[i]);
- }
-
- // Add the filename marker if missing.
- if (cmd.find(sFilenameMarker) == std::string::npos)
- {
- mProcessParams.args.add(sFilenameMarker);
- LL_INFOS() << "Adding the filename marker (" << sFilenameMarker << ")" << LL_ENDL;
- }
-
- LL_INFOS() << "Setting command [" << mProcessParams << "]" << LL_ENDL;
-
- return EC_SUCCESS;
+ std::string cmd = findCommand(env_var, override);
+ if (cmd.empty())
+ {
+ LL_WARNS() << "Editor command is empty or not set" << LL_ENDL;
+ return EC_NOT_SPECIFIED;
+ }
+
+ string_vec_t tokens;
+ tokenize(tokens, cmd);
+
+ // Check executable for existence.
+ std::string bin_path = tokens[0];
+ if (!LLFile::isfile(bin_path))
+ {
+ LL_WARNS() << "Editor binary [" << bin_path << "] not found" << LL_ENDL;
+ return EC_BINARY_NOT_FOUND;
+ }
+
+ // Save command.
+ mProcessParams = LLProcess::Params();
+ mProcessParams.executable = bin_path;
+ for (size_t i = 1; i < tokens.size(); ++i)
+ {
+ mProcessParams.args.add(tokens[i]);
+ }
+
+ // Add the filename marker if missing.
+ if (cmd.find(sFilenameMarker) == std::string::npos)
+ {
+ mProcessParams.args.add(sFilenameMarker);
+ LL_INFOS() << "Adding the filename marker (" << sFilenameMarker << ")" << LL_ENDL;
+ }
+
+ LL_INFOS() << "Setting command [" << mProcessParams << "]" << LL_ENDL;
+
+ return EC_SUCCESS;
}
LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path)
{
- if (std::string(mProcessParams.executable).empty() || mProcessParams.args.empty())
- {
- LL_WARNS() << "Editor command not set" << LL_ENDL;
- return EC_NOT_SPECIFIED;
- }
-
- // Copy params block so we can replace sFilenameMarker
- LLProcess::Params params;
- params.executable = mProcessParams.executable;
-
- // Substitute the filename marker in the command with the actual passed file name.
- for (const std::string& arg : mProcessParams.args)
- {
- std::string fixed(arg);
- LLStringUtil::replaceString(fixed, sFilenameMarker, file_path);
- params.args.add(fixed);
- }
-
- // Run the editor. Prevent killing the process in destructor.
- params.autokill = false;
- return LLProcess::create(params) ? EC_SUCCESS : EC_FAILED_TO_RUN;
+ if (std::string(mProcessParams.executable).empty() || mProcessParams.args.empty())
+ {
+ LL_WARNS() << "Editor command not set" << LL_ENDL;
+ return EC_NOT_SPECIFIED;
+ }
+
+ // Copy params block so we can replace sFilenameMarker
+ LLProcess::Params params;
+ params.executable = mProcessParams.executable;
+
+ // Substitute the filename marker in the command with the actual passed file name.
+ for (const std::string& arg : mProcessParams.args)
+ {
+ std::string fixed(arg);
+ LLStringUtil::replaceString(fixed, sFilenameMarker, file_path);
+ params.args.add(fixed);
+ }
+
+ // Run the editor. Prevent killing the process in destructor.
+ params.autokill = false;
+ return LLProcess::create(params) ? EC_SUCCESS : EC_FAILED_TO_RUN;
}
// static
std::string LLExternalEditor::getErrorMessage(EErrorCode code)
{
- switch (code)
- {
- case EC_SUCCESS: return LLTrans::getString("ok");
- case EC_NOT_SPECIFIED: return LLTrans::getString("ExternalEditorNotSet");
- case EC_PARSE_ERROR: return LLTrans::getString("ExternalEditorCommandParseError");
- case EC_BINARY_NOT_FOUND: return LLTrans::getString("ExternalEditorNotFound");
- case EC_FAILED_TO_RUN: return LLTrans::getString("ExternalEditorFailedToRun");
- }
-
- return LLTrans::getString("Unknown");
+ switch (code)
+ {
+ case EC_SUCCESS: return LLTrans::getString("ok");
+ case EC_NOT_SPECIFIED: return LLTrans::getString("ExternalEditorNotSet");
+ case EC_PARSE_ERROR: return LLTrans::getString("ExternalEditorCommandParseError");
+ case EC_BINARY_NOT_FOUND: return LLTrans::getString("ExternalEditorNotFound");
+ case EC_FAILED_TO_RUN: return LLTrans::getString("ExternalEditorFailedToRun");
+ }
+
+ return LLTrans::getString("Unknown");
}
// TODO:
@@ -128,76 +128,76 @@ std::string LLExternalEditor::getErrorMessage(EErrorCode code)
// static
size_t LLExternalEditor::tokenize(string_vec_t& tokens, const std::string& str)
{
- tokens.clear();
-
- // Split the argument string into separate strings for each argument
- typedef boost::tokenizer< boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep("", "\" ", boost::drop_empty_tokens);
-
- tokenizer tokens_list(str, sep);
- tokenizer::iterator token_iter;
- BOOL inside_quotes = FALSE;
- BOOL last_was_space = FALSE;
- for (token_iter = tokens_list.begin(); token_iter != tokens_list.end(); ++token_iter)
- {
- if (!strncmp("\"",(*token_iter).c_str(),2))
- {
- inside_quotes = !inside_quotes;
- }
- else if (!strncmp(" ",(*token_iter).c_str(),2))
- {
- if(inside_quotes)
- {
- tokens.back().append(std::string(" "));
- last_was_space = TRUE;
- }
- }
- else
- {
- std::string to_push = *token_iter;
- if (last_was_space)
- {
- tokens.back().append(to_push);
- last_was_space = FALSE;
- }
- else
- {
- tokens.push_back(to_push);
- }
- }
- }
-
- return tokens.size();
+ tokens.clear();
+
+ // Split the argument string into separate strings for each argument
+ typedef boost::tokenizer< boost::char_separator<char> > tokenizer;
+ boost::char_separator<char> sep("", "\" ", boost::drop_empty_tokens);
+
+ tokenizer tokens_list(str, sep);
+ tokenizer::iterator token_iter;
+ BOOL inside_quotes = FALSE;
+ BOOL last_was_space = FALSE;
+ for (token_iter = tokens_list.begin(); token_iter != tokens_list.end(); ++token_iter)
+ {
+ if (!strncmp("\"",(*token_iter).c_str(),2))
+ {
+ inside_quotes = !inside_quotes;
+ }
+ else if (!strncmp(" ",(*token_iter).c_str(),2))
+ {
+ if(inside_quotes)
+ {
+ tokens.back().append(std::string(" "));
+ last_was_space = TRUE;
+ }
+ }
+ else
+ {
+ std::string to_push = *token_iter;
+ if (last_was_space)
+ {
+ tokens.back().append(to_push);
+ last_was_space = FALSE;
+ }
+ else
+ {
+ tokens.push_back(to_push);
+ }
+ }
+ }
+
+ return tokens.size();
}
// static
std::string LLExternalEditor::findCommand(
- const std::string& env_var,
- const std::string& override)
+ const std::string& env_var,
+ const std::string& override)
{
- std::string cmd;
-
- // Get executable path.
- if (!override.empty()) // try the supplied override first
- {
- cmd = override;
- LL_INFOS() << "Using override" << LL_ENDL;
- }
- else if (!LLUI::getInstance()->mSettingGroups["config"]->getString(sSetting).empty())
- {
- cmd = LLUI::getInstance()->mSettingGroups["config"]->getString(sSetting);
- LL_INFOS() << "Using setting" << LL_ENDL;
- }
- else // otherwise use the path specified by the environment variable
- {
- auto env_var_val(LLStringUtil::getoptenv(env_var));
- if (env_var_val)
- {
- cmd = *env_var_val;
- LL_INFOS() << "Using env var " << env_var << LL_ENDL;
- }
- }
-
- LL_INFOS() << "Found command [" << cmd << "]" << LL_ENDL;
- return cmd;
+ std::string cmd;
+
+ // Get executable path.
+ if (!override.empty()) // try the supplied override first
+ {
+ cmd = override;
+ LL_INFOS() << "Using override" << LL_ENDL;
+ }
+ else if (!LLUI::getInstance()->mSettingGroups["config"]->getString(sSetting).empty())
+ {
+ cmd = LLUI::getInstance()->mSettingGroups["config"]->getString(sSetting);
+ LL_INFOS() << "Using setting" << LL_ENDL;
+ }
+ else // otherwise use the path specified by the environment variable
+ {
+ auto env_var_val(LLStringUtil::getoptenv(env_var));
+ if (env_var_val)
+ {
+ cmd = *env_var_val;
+ LL_INFOS() << "Using env var " << env_var << LL_ENDL;
+ }
+ }
+
+ LL_INFOS() << "Found command [" << cmd << "]" << LL_ENDL;
+ return cmd;
}
diff --git a/indra/newview/llexternaleditor.h b/indra/newview/llexternaleditor.h
index fd2c25020c..2ccb58a7d9 100644
--- a/indra/newview/llexternaleditor.h
+++ b/indra/newview/llexternaleditor.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llexternaleditor.h
* @brief A convenient class to run external editor.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,66 +38,66 @@
*/
class LLExternalEditor
{
- typedef std::vector<std::string> string_vec_t;
+ typedef std::vector<std::string> string_vec_t;
public:
- typedef enum e_error_code {
- EC_SUCCESS, /// No error.
- EC_NOT_SPECIFIED, /// Editor path not specified.
- EC_PARSE_ERROR, /// Editor command parsing error.
- EC_BINARY_NOT_FOUND, /// Could find the editor binary (missing or not quoted).
- EC_FAILED_TO_RUN, /// Could not execute the editor binary.
- } EErrorCode;
+ typedef enum e_error_code {
+ EC_SUCCESS, /// No error.
+ EC_NOT_SPECIFIED, /// Editor path not specified.
+ EC_PARSE_ERROR, /// Editor command parsing error.
+ EC_BINARY_NOT_FOUND, /// Could find the editor binary (missing or not quoted).
+ EC_FAILED_TO_RUN, /// Could not execute the editor binary.
+ } EErrorCode;
- /**
- * Set editor command.
- *
- * @param env_var Environment variable of the same purpose.
- * @param override Optional override.
- *
- * First tries the override, then a predefined setting (sSetting),
- * then the environment variable.
- *
- * @return EC_SUCCESS if command is valid and refers to an existing executable,
- * EC_NOT_SPECIFIED or EC_FAILED_TO_RUNan on error.
- *
- * @see sSetting
- */
- EErrorCode setCommand(const std::string& env_var, const std::string& override = LLStringUtil::null);
+ /**
+ * Set editor command.
+ *
+ * @param env_var Environment variable of the same purpose.
+ * @param override Optional override.
+ *
+ * First tries the override, then a predefined setting (sSetting),
+ * then the environment variable.
+ *
+ * @return EC_SUCCESS if command is valid and refers to an existing executable,
+ * EC_NOT_SPECIFIED or EC_FAILED_TO_RUNan on error.
+ *
+ * @see sSetting
+ */
+ EErrorCode setCommand(const std::string& env_var, const std::string& override = LLStringUtil::null);
- /**
- * Run the editor with the given file.
- *
- * @param file_path File to edit.
- * @return EC_SUCCESS on success, error code on error.
- */
- EErrorCode run(const std::string& file_path);
+ /**
+ * Run the editor with the given file.
+ *
+ * @param file_path File to edit.
+ * @return EC_SUCCESS on success, error code on error.
+ */
+ EErrorCode run(const std::string& file_path);
- /**
- * Get a meaningful error message for the given status code.
- */
- static std::string getErrorMessage(EErrorCode code);
+ /**
+ * Get a meaningful error message for the given status code.
+ */
+ static std::string getErrorMessage(EErrorCode code);
private:
- static std::string findCommand(
- const std::string& env_var,
- const std::string& override);
+ static std::string findCommand(
+ const std::string& env_var,
+ const std::string& override);
- static size_t tokenize(string_vec_t& tokens, const std::string& str);
+ static size_t tokenize(string_vec_t& tokens, const std::string& str);
- /**
- * Filename placeholder that gets replaced with an actual file name.
- */
- static const std::string sFilenameMarker;
+ /**
+ * Filename placeholder that gets replaced with an actual file name.
+ */
+ static const std::string sFilenameMarker;
- /**
- * Setting that can specify the editor command.
- */
- static const std::string sSetting;
+ /**
+ * Setting that can specify the editor command.
+ */
+ static const std::string sSetting;
- LLProcess::Params mProcessParams;
+ LLProcess::Params mProcessParams;
};
#endif // LL_LLEXTERNALEDITOR_H
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index c1776705f9..5e2d7f70cf 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llface.cpp
* @brief LLFace class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -75,49 +75,49 @@ BOOL LLFace::sSafeRenderSelect = TRUE; // FALSE
/*
For each vertex, given:
- B - binormal
- T - tangent
- N - normal
- P - position
+ B - binormal
+ T - tangent
+ N - normal
+ P - position
The resulting texture coordinate <u,v> is:
- u = 2(B dot P)
- v = 2(T dot P)
+ u = 2(B dot P)
+ v = 2(T dot P)
*/
void planarProjection(LLVector2 &tc, const LLVector4a& normal,
- const LLVector4a &center, const LLVector4a& vec)
-{
- LLVector4a binormal;
- F32 d = normal[0];
-
- if (d >= 0.5f || d <= -0.5f)
- {
- if (d < 0)
- {
- binormal.set(0,-1,0);
- }
- else
- {
- binormal.set(0, 1, 0);
- }
- }
- else
- {
+ const LLVector4a &center, const LLVector4a& vec)
+{
+ LLVector4a binormal;
+ F32 d = normal[0];
+
+ if (d >= 0.5f || d <= -0.5f)
+ {
+ if (d < 0)
+ {
+ binormal.set(0,-1,0);
+ }
+ else
+ {
+ binormal.set(0, 1, 0);
+ }
+ }
+ else
+ {
if (normal[1] > 0)
- {
- binormal.set(-1,0,0);
- }
- else
- {
- binormal.set(1,0,0);
- }
- }
- LLVector4a tangent;
- tangent.setCross3(binormal,normal);
-
- tc.mV[1] = -((tangent.dot3(vec).getF32())*2 - 0.5f);
- tc.mV[0] = 1.0f+((binormal.dot3(vec).getF32())*2 - 0.5f);
+ {
+ binormal.set(-1,0,0);
+ }
+ else
+ {
+ binormal.set(1,0,0);
+ }
+ }
+ LLVector4a tangent;
+ tangent.setCross3(binormal,normal);
+
+ tc.mV[1] = -((tangent.dot3(vec).getF32())*2 - 0.5f);
+ tc.mV[0] = 1.0f+((binormal.dot3(vec).getF32())*2 - 0.5f);
}
////////////////////
@@ -128,174 +128,174 @@ void planarProjection(LLVector2 &tc, const LLVector4a& normal,
void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE;
- mLastUpdateTime = gFrameTimeSeconds;
- mLastMoveTime = 0.f;
- mLastSkinTime = gFrameTimeSeconds;
- mVSize = 0.f;
- mPixelArea = 16.f;
- mState = GLOBAL;
- mDrawPoolp = NULL;
- mPoolType = 0;
- mCenterLocal = objp->getPosition();
- mCenterAgent = drawablep->getPositionAgent();
- mDistance = 0.f;
-
- mGeomCount = 0;
- mGeomIndex = 0;
- mIndicesCount = 0;
-
- //special value to indicate uninitialized position
- mIndicesIndex = 0xFFFFFFFF;
-
- for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
- {
- mIndexInTex[i] = 0;
- mTexture[i] = NULL;
- }
-
- mTEOffset = -1;
- mTextureIndex = FACE_DO_NOT_BATCH_TEXTURES;
-
- setDrawable(drawablep);
- mVObjp = objp;
-
- mReferenceIndex = -1;
-
- mTextureMatrix = NULL;
- mDrawInfo = NULL;
-
- mFaceColor = LLColor4(1,0,0,1);
-
- mImportanceToCamera = 0.f ;
- mBoundingSphereRadius = 0.0f ;
-
- mHasMedia = false ;
- mIsMediaAllowed = true;
+ mLastUpdateTime = gFrameTimeSeconds;
+ mLastMoveTime = 0.f;
+ mLastSkinTime = gFrameTimeSeconds;
+ mVSize = 0.f;
+ mPixelArea = 16.f;
+ mState = GLOBAL;
+ mDrawPoolp = NULL;
+ mPoolType = 0;
+ mCenterLocal = objp->getPosition();
+ mCenterAgent = drawablep->getPositionAgent();
+ mDistance = 0.f;
+
+ mGeomCount = 0;
+ mGeomIndex = 0;
+ mIndicesCount = 0;
+
+ //special value to indicate uninitialized position
+ mIndicesIndex = 0xFFFFFFFF;
+
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
+ {
+ mIndexInTex[i] = 0;
+ mTexture[i] = NULL;
+ }
+
+ mTEOffset = -1;
+ mTextureIndex = FACE_DO_NOT_BATCH_TEXTURES;
+
+ setDrawable(drawablep);
+ mVObjp = objp;
+
+ mReferenceIndex = -1;
+
+ mTextureMatrix = NULL;
+ mDrawInfo = NULL;
+
+ mFaceColor = LLColor4(1,0,0,1);
+
+ mImportanceToCamera = 0.f ;
+ mBoundingSphereRadius = 0.0f ;
+
+ mHasMedia = false ;
+ mIsMediaAllowed = true;
}
void LLFace::destroy()
{
- if (gDebugGL)
- {
- gPipeline.checkReferences(this);
- }
-
- for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
- {
- if(mTexture[i].notNull())
- {
- mTexture[i]->removeFace(i, this) ;
- mTexture[i] = NULL;
- }
- }
-
- if (isState(LLFace::PARTICLE))
- {
- clearState(LLFace::PARTICLE);
- }
-
- if (mDrawPoolp)
- {
- mDrawPoolp->removeFace(this);
- mDrawPoolp = NULL;
- }
-
- if (mTextureMatrix)
- {
- delete mTextureMatrix;
- mTextureMatrix = NULL;
-
- if (mDrawablep)
- {
- LLSpatialGroup* group = mDrawablep->getSpatialGroup();
- if (group)
- {
- group->dirtyGeom();
- gPipeline.markRebuild(group);
- }
- }
- }
-
- setDrawInfo(NULL);
-
- mDrawablep = NULL;
- mVObjp = NULL;
+ if (gDebugGL)
+ {
+ gPipeline.checkReferences(this);
+ }
+
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
+ {
+ if(mTexture[i].notNull())
+ {
+ mTexture[i]->removeFace(i, this) ;
+ mTexture[i] = NULL;
+ }
+ }
+
+ if (isState(LLFace::PARTICLE))
+ {
+ clearState(LLFace::PARTICLE);
+ }
+
+ if (mDrawPoolp)
+ {
+ mDrawPoolp->removeFace(this);
+ mDrawPoolp = NULL;
+ }
+
+ if (mTextureMatrix)
+ {
+ delete mTextureMatrix;
+ mTextureMatrix = NULL;
+
+ if (mDrawablep)
+ {
+ LLSpatialGroup* group = mDrawablep->getSpatialGroup();
+ if (group)
+ {
+ group->dirtyGeom();
+ gPipeline.markRebuild(group);
+ }
+ }
+ }
+
+ setDrawInfo(NULL);
+
+ mDrawablep = NULL;
+ mVObjp = NULL;
}
void LLFace::setWorldMatrix(const LLMatrix4 &mat)
{
- LL_ERRS() << "Faces on this drawable are not independently modifiable\n" << LL_ENDL;
+ LL_ERRS() << "Faces on this drawable are not independently modifiable\n" << LL_ENDL;
}
void LLFace::setPool(LLFacePool* pool)
{
- mDrawPoolp = pool;
+ mDrawPoolp = pool;
}
void LLFace::setPool(LLFacePool* new_pool, LLViewerTexture *texturep)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
-
- if (!new_pool)
- {
- LL_ERRS() << "Setting pool to null!" << LL_ENDL;
- }
-
- if (new_pool != mDrawPoolp)
- {
- // Remove from old pool
- if (mDrawPoolp)
- {
- mDrawPoolp->removeFace(this);
-
- if (mDrawablep)
- {
- gPipeline.markRebuild(mDrawablep, LLDrawable::REBUILD_ALL);
- }
- }
- mGeomIndex = 0;
-
- // Add to new pool
- if (new_pool)
- {
- new_pool->addFace(this);
- }
- mDrawPoolp = new_pool;
- }
-
- setTexture(texturep) ;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
+
+ if (!new_pool)
+ {
+ LL_ERRS() << "Setting pool to null!" << LL_ENDL;
+ }
+
+ if (new_pool != mDrawPoolp)
+ {
+ // Remove from old pool
+ if (mDrawPoolp)
+ {
+ mDrawPoolp->removeFace(this);
+
+ if (mDrawablep)
+ {
+ gPipeline.markRebuild(mDrawablep, LLDrawable::REBUILD_ALL);
+ }
+ }
+ mGeomIndex = 0;
+
+ // Add to new pool
+ if (new_pool)
+ {
+ new_pool->addFace(this);
+ }
+ mDrawPoolp = new_pool;
+ }
+
+ setTexture(texturep) ;
}
-void LLFace::setTexture(U32 ch, LLViewerTexture* tex)
+void LLFace::setTexture(U32 ch, LLViewerTexture* tex)
{
- llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
-
- if(mTexture[ch] == tex)
- {
- return ;
- }
-
- if(mTexture[ch].notNull())
- {
- mTexture[ch]->removeFace(ch, this) ;
- }
-
- if(tex)
- {
- tex->addFace(ch, this) ;
- }
-
- mTexture[ch] = tex ;
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+
+ if(mTexture[ch] == tex)
+ {
+ return ;
+ }
+
+ if(mTexture[ch].notNull())
+ {
+ mTexture[ch]->removeFace(ch, this) ;
+ }
+
+ if(tex)
+ {
+ tex->addFace(ch, this) ;
+ }
+
+ mTexture[ch] = tex ;
}
-void LLFace::setTexture(LLViewerTexture* tex)
+void LLFace::setTexture(LLViewerTexture* tex)
{
- setDiffuseMap(tex);
+ setDiffuseMap(tex);
}
void LLFace::setDiffuseMap(LLViewerTexture* tex)
{
- setTexture(LLRender::DIFFUSE_MAP, tex);
+ setTexture(LLRender::DIFFUSE_MAP, tex);
}
void LLFace::setAlternateDiffuseMap(LLViewerTexture* tex)
@@ -305,278 +305,278 @@ void LLFace::setAlternateDiffuseMap(LLViewerTexture* tex)
void LLFace::setNormalMap(LLViewerTexture* tex)
{
- setTexture(LLRender::NORMAL_MAP, tex);
+ setTexture(LLRender::NORMAL_MAP, tex);
}
void LLFace::setSpecularMap(LLViewerTexture* tex)
{
- setTexture(LLRender::SPECULAR_MAP, tex);
+ setTexture(LLRender::SPECULAR_MAP, tex);
}
void LLFace::dirtyTexture()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
- LLDrawable* drawablep = getDrawable();
+ LLDrawable* drawablep = getDrawable();
- if (mVObjp.notNull() && mVObjp->getVolume())
- {
- for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
- {
- if (mTexture[ch].notNull() && mTexture[ch]->getComponents() == 4)
- { //dirty texture on an alpha object should be treated as an LoD update
- LLVOVolume* vobj = drawablep->getVOVolume();
- if (vobj)
- {
- vobj->mLODChanged = TRUE;
+ if (mVObjp.notNull() && mVObjp->getVolume())
+ {
+ for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
+ {
+ if (mTexture[ch].notNull() && mTexture[ch]->getComponents() == 4)
+ { //dirty texture on an alpha object should be treated as an LoD update
+ LLVOVolume* vobj = drawablep->getVOVolume();
+ if (vobj)
+ {
+ vobj->mLODChanged = TRUE;
vobj->updateVisualComplexity();
- }
- gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
- }
- }
- }
+ }
+ gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
+ }
+ }
+ }
- gPipeline.markTextured(drawablep);
+ gPipeline.markTextured(drawablep);
}
void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture)
{
- llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
- if(mTexture[ch] == new_texture)
- {
- return ;
- }
+ if(mTexture[ch] == new_texture)
+ {
+ return ;
+ }
- if(!new_texture)
- {
- LL_ERRS() << "Can not switch to a null texture." << LL_ENDL;
- return;
- }
+ if(!new_texture)
+ {
+ LL_ERRS() << "Can not switch to a null texture." << LL_ENDL;
+ return;
+ }
- llassert(mTexture[ch].notNull());
+ llassert(mTexture[ch].notNull());
- if (ch == LLRender::DIFFUSE_MAP)
- {
- getViewerObject()->changeTEImage(mTEOffset, new_texture) ;
- }
+ if (ch == LLRender::DIFFUSE_MAP)
+ {
+ getViewerObject()->changeTEImage(mTEOffset, new_texture) ;
+ }
- setTexture(ch, new_texture) ;
- dirtyTexture();
+ setTexture(ch, new_texture) ;
+ dirtyTexture();
}
void LLFace::setTEOffset(const S32 te_offset)
{
- mTEOffset = te_offset;
+ mTEOffset = te_offset;
}
void LLFace::setFaceColor(const LLColor4& color)
{
- mFaceColor = color;
- setState(USE_FACE_COLOR);
+ mFaceColor = color;
+ setState(USE_FACE_COLOR);
}
void LLFace::unsetFaceColor()
{
- clearState(USE_FACE_COLOR);
+ clearState(USE_FACE_COLOR);
}
void LLFace::setDrawable(LLDrawable *drawable)
{
- mDrawablep = drawable;
- mXform = &drawable->mXform;
+ mDrawablep = drawable;
+ mXform = &drawable->mXform;
}
void LLFace::setSize(S32 num_vertices, S32 num_indices, bool align)
{
- if (align)
- {
- //allocate vertices in blocks of 4 for alignment
- num_vertices = (num_vertices + 0x3) & ~0x3;
- }
-
- if (mGeomCount != num_vertices ||
- mIndicesCount != num_indices)
- {
- mGeomCount = num_vertices;
- mIndicesCount = num_indices;
- mVertexBuffer = NULL;
- }
-
- llassert(verify());
+ if (align)
+ {
+ //allocate vertices in blocks of 4 for alignment
+ num_vertices = (num_vertices + 0x3) & ~0x3;
+ }
+
+ if (mGeomCount != num_vertices ||
+ mIndicesCount != num_indices)
+ {
+ mGeomCount = num_vertices;
+ mIndicesCount = num_indices;
+ mVertexBuffer = NULL;
+ }
+
+ llassert(verify());
}
-void LLFace::setGeomIndex(U16 idx)
-{
- if (mGeomIndex != idx)
- {
- mGeomIndex = idx;
- mVertexBuffer = NULL;
- }
+void LLFace::setGeomIndex(U16 idx)
+{
+ if (mGeomIndex != idx)
+ {
+ mGeomIndex = idx;
+ mVertexBuffer = NULL;
+ }
}
void LLFace::setTextureIndex(U8 index)
{
- if (index != mTextureIndex)
- {
- mTextureIndex = index;
-
- if (mTextureIndex != FACE_DO_NOT_BATCH_TEXTURES)
- {
- mDrawablep->setState(LLDrawable::REBUILD_POSITION);
- }
- else
- {
- if (mDrawInfo && !mDrawInfo->mTextureList.empty())
- {
- LL_ERRS() << "Face with no texture index references indexed texture draw info." << LL_ENDL;
- }
- }
- }
+ if (index != mTextureIndex)
+ {
+ mTextureIndex = index;
+
+ if (mTextureIndex != FACE_DO_NOT_BATCH_TEXTURES)
+ {
+ mDrawablep->setState(LLDrawable::REBUILD_POSITION);
+ }
+ else
+ {
+ if (mDrawInfo && !mDrawInfo->mTextureList.empty())
+ {
+ LL_ERRS() << "Face with no texture index references indexed texture draw info." << LL_ENDL;
+ }
+ }
+ }
}
-void LLFace::setIndicesIndex(S32 idx)
-{
- if (mIndicesIndex != idx)
- {
- mIndicesIndex = idx;
- mVertexBuffer = NULL;
- }
+void LLFace::setIndicesIndex(S32 idx)
+{
+ if (mIndicesIndex != idx)
+ {
+ mIndicesIndex = idx;
+ mVertexBuffer = NULL;
+ }
}
-
+
//============================================================================
U16 LLFace::getGeometryAvatar(
- LLStrider<LLVector3> &vertices,
- LLStrider<LLVector3> &normals,
- LLStrider<LLVector2> &tex_coords,
- LLStrider<F32> &vertex_weights,
- LLStrider<LLVector4> &clothing_weights)
+ LLStrider<LLVector3> &vertices,
+ LLStrider<LLVector3> &normals,
+ LLStrider<LLVector2> &tex_coords,
+ LLStrider<F32> &vertex_weights,
+ LLStrider<LLVector4> &clothing_weights)
{
- if (mVertexBuffer.notNull())
- {
- mVertexBuffer->getVertexStrider (vertices, mGeomIndex, mGeomCount);
- mVertexBuffer->getNormalStrider (normals, mGeomIndex, mGeomCount);
- mVertexBuffer->getTexCoord0Strider (tex_coords, mGeomIndex, mGeomCount);
- mVertexBuffer->getWeightStrider(vertex_weights, mGeomIndex, mGeomCount);
- mVertexBuffer->getClothWeightStrider(clothing_weights, mGeomIndex, mGeomCount);
- }
-
- return mGeomIndex;
+ if (mVertexBuffer.notNull())
+ {
+ mVertexBuffer->getVertexStrider (vertices, mGeomIndex, mGeomCount);
+ mVertexBuffer->getNormalStrider (normals, mGeomIndex, mGeomCount);
+ mVertexBuffer->getTexCoord0Strider (tex_coords, mGeomIndex, mGeomCount);
+ mVertexBuffer->getWeightStrider(vertex_weights, mGeomIndex, mGeomCount);
+ mVertexBuffer->getClothWeightStrider(clothing_weights, mGeomIndex, mGeomCount);
+ }
+
+ return mGeomIndex;
}
U16 LLFace::getGeometry(LLStrider<LLVector3> &vertices, LLStrider<LLVector3> &normals,
- LLStrider<LLVector2> &tex_coords, LLStrider<U16> &indicesp)
+ LLStrider<LLVector2> &tex_coords, LLStrider<U16> &indicesp)
{
- if (mVertexBuffer.notNull())
- {
- mVertexBuffer->getVertexStrider(vertices, mGeomIndex, mGeomCount);
- if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL))
- {
- mVertexBuffer->getNormalStrider(normals, mGeomIndex, mGeomCount);
- }
- if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD0))
- {
- mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex, mGeomCount);
- }
-
- mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount);
- }
-
- return mGeomIndex;
+ if (mVertexBuffer.notNull())
+ {
+ mVertexBuffer->getVertexStrider(vertices, mGeomIndex, mGeomCount);
+ if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL))
+ {
+ mVertexBuffer->getNormalStrider(normals, mGeomIndex, mGeomCount);
+ }
+ if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD0))
+ {
+ mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex, mGeomCount);
+ }
+
+ mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount);
+ }
+
+ return mGeomIndex;
}
void LLFace::updateCenterAgent()
{
- if (mDrawablep->isActive())
- {
- mCenterAgent = mCenterLocal * getRenderMatrix();
- }
- else
- {
- mCenterAgent = mCenterLocal;
- }
+ if (mDrawablep->isActive())
+ {
+ mCenterAgent = mCenterLocal * getRenderMatrix();
+ }
+ else
+ {
+ mCenterAgent = mCenterLocal;
+ }
}
void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
-
- if (mDrawablep == NULL || mDrawablep->getSpatialGroup() == NULL)
- {
- return;
- }
-
- mDrawablep->getSpatialGroup()->rebuildGeom();
- mDrawablep->getSpatialGroup()->rebuildMesh();
-
- if(mVertexBuffer.isNull())
- {
- return;
- }
-
- if (mGeomCount > 0 && mIndicesCount > 0)
- {
- gGL.getTexUnit(0)->bind(imagep);
-
- gGL.pushMatrix();
- if (mDrawablep->isActive())
- {
- gGL.multMatrix((GLfloat*)mDrawablep->getRenderMatrix().mMatrix);
- }
- else
- {
- gGL.multMatrix((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix);
- }
-
- gGL.diffuseColor4fv(color.mV);
-
- if (mDrawablep->isState(LLDrawable::RIGGED))
- {
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
+
+ if (mDrawablep == NULL || mDrawablep->getSpatialGroup() == NULL)
+ {
+ return;
+ }
+
+ mDrawablep->getSpatialGroup()->rebuildGeom();
+ mDrawablep->getSpatialGroup()->rebuildMesh();
+
+ if(mVertexBuffer.isNull())
+ {
+ return;
+ }
+
+ if (mGeomCount > 0 && mIndicesCount > 0)
+ {
+ gGL.getTexUnit(0)->bind(imagep);
+
+ gGL.pushMatrix();
+ if (mDrawablep->isActive())
+ {
+ gGL.multMatrix((GLfloat*)mDrawablep->getRenderMatrix().mMatrix);
+ }
+ else
+ {
+ gGL.multMatrix((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix);
+ }
+
+ gGL.diffuseColor4fv(color.mV);
+
+ if (mDrawablep->isState(LLDrawable::RIGGED))
+ {
#if 0 // TODO -- there is no way this won't destroy our GL machine as implemented, rewrite it to not rely on software skinning
- LLVOVolume* volume = mDrawablep->getVOVolume();
- if (volume)
- {
- LLRiggedVolume* rigged = volume->getRiggedVolume();
- if (rigged)
- {
+ LLVOVolume* volume = mDrawablep->getVOVolume();
+ if (volume)
+ {
+ LLRiggedVolume* rigged = volume->getRiggedVolume();
+ if (rigged)
+ {
// called when selecting a face during edit of a mesh object
- LLGLEnable offset(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset(-1.f, -1.f);
- gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix);
- const LLVolumeFace& vol_face = rigged->getVolumeFace(getTEOffset());
- LLVertexBuffer::unbind();
- glVertexPointer(3, GL_FLOAT, 16, vol_face.mPositions);
- if (vol_face.mTexCoords)
- {
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 8, vol_face.mTexCoords);
- }
- gGL.syncMatrices();
- glDrawElements(GL_TRIANGLES, vol_face.mNumIndices, GL_UNSIGNED_SHORT, vol_face.mIndices);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- }
- }
+ LLGLEnable offset(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(-1.f, -1.f);
+ gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix);
+ const LLVolumeFace& vol_face = rigged->getVolumeFace(getTEOffset());
+ LLVertexBuffer::unbind();
+ glVertexPointer(3, GL_FLOAT, 16, vol_face.mPositions);
+ if (vol_face.mTexCoords)
+ {
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(2, GL_FLOAT, 8, vol_face.mTexCoords);
+ }
+ gGL.syncMatrices();
+ glDrawElements(GL_TRIANGLES, vol_face.mNumIndices, GL_UNSIGNED_SHORT, vol_face.mIndices);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ }
+ }
#endif
- }
- else
- {
- // cheaters sometimes prosper...
- //
- mVertexBuffer->setBuffer();
- mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex);
- }
-
- gGL.popMatrix();
- }
+ }
+ else
+ {
+ // cheaters sometimes prosper...
+ //
+ mVertexBuffer->setBuffer();
+ mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex);
+ }
+
+ gGL.popMatrix();
+ }
}
void renderFace(LLDrawable* drawable, LLFace *face)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
LLVOVolume* vobj = drawable->getVOVolume();
if (vobj)
@@ -646,234 +646,234 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram
void LLFace::setDrawInfo(LLDrawInfo* draw_info)
{
- mDrawInfo = draw_info;
+ mDrawInfo = draw_info;
}
void LLFace::printDebugInfo() const
{
- LLFacePool *poolp = getPool();
- LL_INFOS() << "Object: " << getViewerObject()->mID << LL_ENDL;
- if (getDrawable())
- {
- LL_INFOS() << "Type: " << LLPrimitive::pCodeToString(getDrawable()->getVObj()->getPCode()) << LL_ENDL;
- }
- if (getTexture())
- {
- LL_INFOS() << "Texture: " << getTexture() << " Comps: " << (U32)getTexture()->getComponents() << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "No texture: " << LL_ENDL;
- }
-
- LL_INFOS() << "Face: " << this << LL_ENDL;
- LL_INFOS() << "State: " << getState() << LL_ENDL;
- LL_INFOS() << "Geom Index Data:" << LL_ENDL;
- LL_INFOS() << "--------------------" << LL_ENDL;
- LL_INFOS() << "GI: " << mGeomIndex << " Count:" << mGeomCount << LL_ENDL;
- LL_INFOS() << "Face Index Data:" << LL_ENDL;
- LL_INFOS() << "--------------------" << LL_ENDL;
- LL_INFOS() << "II: " << mIndicesIndex << " Count:" << mIndicesCount << LL_ENDL;
- LL_INFOS() << LL_ENDL;
-
- if (poolp)
- {
- poolp->printDebugInfo();
-
- S32 pool_references = 0;
- for (std::vector<LLFace*>::iterator iter = poolp->mReferences.begin();
- iter != poolp->mReferences.end(); iter++)
- {
- LLFace *facep = *iter;
- if (facep == this)
- {
- LL_INFOS() << "Pool reference: " << pool_references << LL_ENDL;
- pool_references++;
- }
- }
-
- if (pool_references != 1)
- {
- LL_INFOS() << "Incorrect number of pool references!" << LL_ENDL;
- }
- }
+ LLFacePool *poolp = getPool();
+ LL_INFOS() << "Object: " << getViewerObject()->mID << LL_ENDL;
+ if (getDrawable())
+ {
+ LL_INFOS() << "Type: " << LLPrimitive::pCodeToString(getDrawable()->getVObj()->getPCode()) << LL_ENDL;
+ }
+ if (getTexture())
+ {
+ LL_INFOS() << "Texture: " << getTexture() << " Comps: " << (U32)getTexture()->getComponents() << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "No texture: " << LL_ENDL;
+ }
+
+ LL_INFOS() << "Face: " << this << LL_ENDL;
+ LL_INFOS() << "State: " << getState() << LL_ENDL;
+ LL_INFOS() << "Geom Index Data:" << LL_ENDL;
+ LL_INFOS() << "--------------------" << LL_ENDL;
+ LL_INFOS() << "GI: " << mGeomIndex << " Count:" << mGeomCount << LL_ENDL;
+ LL_INFOS() << "Face Index Data:" << LL_ENDL;
+ LL_INFOS() << "--------------------" << LL_ENDL;
+ LL_INFOS() << "II: " << mIndicesIndex << " Count:" << mIndicesCount << LL_ENDL;
+ LL_INFOS() << LL_ENDL;
+
+ if (poolp)
+ {
+ poolp->printDebugInfo();
+
+ S32 pool_references = 0;
+ for (std::vector<LLFace*>::iterator iter = poolp->mReferences.begin();
+ iter != poolp->mReferences.end(); iter++)
+ {
+ LLFace *facep = *iter;
+ if (facep == this)
+ {
+ LL_INFOS() << "Pool reference: " << pool_references << LL_ENDL;
+ pool_references++;
+ }
+ }
+
+ if (pool_references != 1)
+ {
+ LL_INFOS() << "Incorrect number of pool references!" << LL_ENDL;
+ }
+ }
#if 0
- LL_INFOS() << "Indices:" << LL_ENDL;
- LL_INFOS() << "--------------------" << LL_ENDL;
-
- const U32 *indicesp = getRawIndices();
- S32 indices_count = getIndicesCount();
- S32 geom_start = getGeomStart();
-
- for (S32 i = 0; i < indices_count; i++)
- {
- LL_INFOS() << i << ":" << indicesp[i] << ":" << (S32)(indicesp[i] - geom_start) << LL_ENDL;
- }
- LL_INFOS() << LL_ENDL;
-
- LL_INFOS() << "Vertices:" << LL_ENDL;
- LL_INFOS() << "--------------------" << LL_ENDL;
- for (S32 i = 0; i < mGeomCount; i++)
- {
- LL_INFOS() << mGeomIndex + i << ":" << poolp->getVertex(mGeomIndex + i) << LL_ENDL;
- }
- LL_INFOS() << LL_ENDL;
+ LL_INFOS() << "Indices:" << LL_ENDL;
+ LL_INFOS() << "--------------------" << LL_ENDL;
+
+ const U32 *indicesp = getRawIndices();
+ S32 indices_count = getIndicesCount();
+ S32 geom_start = getGeomStart();
+
+ for (S32 i = 0; i < indices_count; i++)
+ {
+ LL_INFOS() << i << ":" << indicesp[i] << ":" << (S32)(indicesp[i] - geom_start) << LL_ENDL;
+ }
+ LL_INFOS() << LL_ENDL;
+
+ LL_INFOS() << "Vertices:" << LL_ENDL;
+ LL_INFOS() << "--------------------" << LL_ENDL;
+ for (S32 i = 0; i < mGeomCount; i++)
+ {
+ LL_INFOS() << mGeomIndex + i << ":" << poolp->getVertex(mGeomIndex + i) << LL_ENDL;
+ }
+ LL_INFOS() << LL_ENDL;
#endif
}
// Transform the texture coordinates for this face.
static void xform(LLVector2 &tex_coord, F32 cosAng, F32 sinAng, F32 offS, F32 offT, F32 magS, F32 magT)
{
- // New, good way
- F32 s = tex_coord.mV[0];
- F32 t = tex_coord.mV[1];
+ // New, good way
+ F32 s = tex_coord.mV[0];
+ F32 t = tex_coord.mV[1];
- // Texture transforms are done about the center of the face.
- s -= 0.5;
- t -= 0.5;
+ // Texture transforms are done about the center of the face.
+ s -= 0.5;
+ t -= 0.5;
- // Handle rotation
- F32 temp = s;
- s = s * cosAng + t * sinAng;
- t = -temp * sinAng + t * cosAng;
+ // Handle rotation
+ F32 temp = s;
+ s = s * cosAng + t * sinAng;
+ t = -temp * sinAng + t * cosAng;
- // Then scale
- s *= magS;
- t *= magT;
+ // Then scale
+ s *= magS;
+ t *= magT;
- // Then offset
- s += offS + 0.5f;
- t += offT + 0.5f;
+ // Then offset
+ s += offS + 0.5f;
+ t += offT + 0.5f;
- tex_coord.mV[0] = s;
- tex_coord.mV[1] = t;
+ tex_coord.mV[0] = s;
+ tex_coord.mV[1] = t;
}
// Transform the texture coordinates for this face.
-static void xform4a(LLVector4a &tex_coord, const LLVector4a& trans, const LLVector4Logical& mask, const LLVector4a& rot0, const LLVector4a& rot1, const LLVector4a& offset, const LLVector4a& scale)
+static void xform4a(LLVector4a &tex_coord, const LLVector4a& trans, const LLVector4Logical& mask, const LLVector4a& rot0, const LLVector4a& rot1, const LLVector4a& offset, const LLVector4a& scale)
{
- //tex coord is two coords, <s0, t0, s1, t1>
- LLVector4a st;
-
- // Texture transforms are done about the center of the face.
- st.setAdd(tex_coord, trans);
-
- // Handle rotation
- LLVector4a rot_st;
-
- // <s0 * cosAng, s0*-sinAng, s1*cosAng, s1*-sinAng>
- LLVector4a s0;
- s0.splat(st, 0);
- LLVector4a s1;
- s1.splat(st, 2);
- LLVector4a ss;
- ss.setSelectWithMask(mask, s1, s0);
-
- LLVector4a a;
- a.setMul(rot0, ss);
-
- // <t0*sinAng, t0*cosAng, t1*sinAng, t1*cosAng>
- LLVector4a t0;
- t0.splat(st, 1);
- LLVector4a t1;
- t1.splat(st, 3);
- LLVector4a tt;
- tt.setSelectWithMask(mask, t1, t0);
-
- LLVector4a b;
- b.setMul(rot1, tt);
-
- st.setAdd(a,b);
-
- // Then scale
- st.mul(scale);
-
- // Then offset
- tex_coord.setAdd(st, offset);
+ //tex coord is two coords, <s0, t0, s1, t1>
+ LLVector4a st;
+
+ // Texture transforms are done about the center of the face.
+ st.setAdd(tex_coord, trans);
+
+ // Handle rotation
+ LLVector4a rot_st;
+
+ // <s0 * cosAng, s0*-sinAng, s1*cosAng, s1*-sinAng>
+ LLVector4a s0;
+ s0.splat(st, 0);
+ LLVector4a s1;
+ s1.splat(st, 2);
+ LLVector4a ss;
+ ss.setSelectWithMask(mask, s1, s0);
+
+ LLVector4a a;
+ a.setMul(rot0, ss);
+
+ // <t0*sinAng, t0*cosAng, t1*sinAng, t1*cosAng>
+ LLVector4a t0;
+ t0.splat(st, 1);
+ LLVector4a t1;
+ t1.splat(st, 3);
+ LLVector4a tt;
+ tt.setSelectWithMask(mask, t1, t0);
+
+ LLVector4a b;
+ b.setMul(rot1, tt);
+
+ st.setAdd(a,b);
+
+ // Then scale
+ st.mul(scale);
+
+ // Then offset
+ tex_coord.setAdd(st, offset);
}
bool less_than_max_mag(const LLVector4a& vec)
{
- LLVector4a MAX_MAG;
- MAX_MAG.splat(1024.f*1024.f);
+ LLVector4a MAX_MAG;
+ MAX_MAG.splat(1024.f*1024.f);
+
+ LLVector4a val;
+ val.setAbs(vec);
- LLVector4a val;
- val.setAbs(vec);
+ S32 lt = val.lessThan(MAX_MAG).getGatheredBits() & 0x7;
- S32 lt = val.lessThan(MAX_MAG).getGatheredBits() & 0x7;
-
- return lt == 0x7;
+ return lt == 0x7;
}
BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
const LLMatrix4& mat_vert_in, BOOL global_volume)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
-
- //get bounding box
- if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED))
- {
- if (f >= volume.getNumVolumeFaces())
- {
- LL_WARNS() << "Generating bounding box for invalid face index!" << LL_ENDL;
- f = 0;
- }
-
- const LLVolumeFace &face = volume.getVolumeFace(f);
-
- LL_DEBUGS("RiggedBox") << "updating extents for face " << f
- << " starting extents " << mExtents[0] << ", " << mExtents[1]
- << " starting vf extents " << face.mExtents[0] << ", " << face.mExtents[1]
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
+
+ //get bounding box
+ if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED))
+ {
+ if (f >= volume.getNumVolumeFaces())
+ {
+ LL_WARNS() << "Generating bounding box for invalid face index!" << LL_ENDL;
+ f = 0;
+ }
+
+ const LLVolumeFace &face = volume.getVolumeFace(f);
+
+ LL_DEBUGS("RiggedBox") << "updating extents for face " << f
+ << " starting extents " << mExtents[0] << ", " << mExtents[1]
+ << " starting vf extents " << face.mExtents[0] << ", " << face.mExtents[1]
<< " num verts " << face.mNumVertices << LL_ENDL;
// MAINT-8264 - stray vertices, especially in low LODs, cause bounding box errors.
- if (face.mNumVertices < 3)
+ if (face.mNumVertices < 3)
{
- LL_DEBUGS("RiggedBox") << "skipping face " << f << ", bad num vertices "
+ LL_DEBUGS("RiggedBox") << "skipping face " << f << ", bad num vertices "
<< face.mNumVertices << " " << face.mNumIndices << " " << face.mWeights << LL_ENDL;
return FALSE;
}
-
- //VECTORIZE THIS
- LLMatrix4a mat_vert;
- mat_vert.loadu(mat_vert_in);
+
+ //VECTORIZE THIS
+ LLMatrix4a mat_vert;
+ mat_vert.loadu(mat_vert_in);
LLVector4a new_extents[2];
- llassert(less_than_max_mag(face.mExtents[0]));
- llassert(less_than_max_mag(face.mExtents[1]));
+ llassert(less_than_max_mag(face.mExtents[0]));
+ llassert(less_than_max_mag(face.mExtents[1]));
- matMulBoundBox(mat_vert, face.mExtents, mExtents);
+ matMulBoundBox(mat_vert, face.mExtents, mExtents);
- LL_DEBUGS("RiggedBox") << "updated extents for face " << f
+ LL_DEBUGS("RiggedBox") << "updated extents for face " << f
<< " bbox gave extents " << mExtents[0] << ", " << mExtents[1] << LL_ENDL;
- if (!mDrawablep->isActive())
- { // Shift position for region
- LLVector4a offset;
- offset.load3(mDrawablep->getRegion()->getOriginAgent().mV);
- mExtents[0].add(offset);
- mExtents[1].add(offset);
- LL_DEBUGS("RiggedBox") << "updating extents for face " << f
+ if (!mDrawablep->isActive())
+ { // Shift position for region
+ LLVector4a offset;
+ offset.load3(mDrawablep->getRegion()->getOriginAgent().mV);
+ mExtents[0].add(offset);
+ mExtents[1].add(offset);
+ LL_DEBUGS("RiggedBox") << "updating extents for face " << f
<< " not active, added offset " << offset << LL_ENDL;
- }
+ }
- LL_DEBUGS("RiggedBox") << "updated extents for face " << f
+ LL_DEBUGS("RiggedBox") << "updated extents for face " << f
<< " to " << mExtents[0] << ", " << mExtents[1] << LL_ENDL;
- LLVector4a t;
- t.setAdd(mExtents[0],mExtents[1]);
- t.mul(0.5f);
+ LLVector4a t;
+ t.setAdd(mExtents[0],mExtents[1]);
+ t.mul(0.5f);
- mCenterLocal.set(t.getF32ptr());
+ mCenterLocal.set(t.getF32ptr());
- t.setSub(mExtents[1],mExtents[0]);
- mBoundingSphereRadius = t.getLength3().getF32()*0.5f;
+ t.setSub(mExtents[1],mExtents[0]);
+ mBoundingSphereRadius = t.getLength3().getF32()*0.5f;
- updateCenterAgent();
- }
+ updateCenterAgent();
+ }
- return TRUE;
+ return TRUE;
}
@@ -885,113 +885,113 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
// with the implications.
LLVector2 LLFace::surfaceToTexture(LLVector2 surface_coord, const LLVector4a& position, const LLVector4a& normal)
{
- LLVector2 tc = surface_coord;
-
- const LLTextureEntry *tep = getTextureEntry();
-
- if (tep == NULL)
- {
- // can't do much without the texture entry
- return surface_coord;
- }
-
- //VECTORIZE THIS
- // see if we have a non-default mapping
+ LLVector2 tc = surface_coord;
+
+ const LLTextureEntry *tep = getTextureEntry();
+
+ if (tep == NULL)
+ {
+ // can't do much without the texture entry
+ return surface_coord;
+ }
+
+ //VECTORIZE THIS
+ // see if we have a non-default mapping
U8 texgen = getTextureEntry()->getTexGen();
- if (texgen != LLTextureEntry::TEX_GEN_DEFAULT)
- {
- LLVector4a& center = *(mDrawablep->getVOVolume()->getVolume()->getVolumeFace(mTEOffset).mCenter);
-
- LLVector4a volume_position;
- LLVector3 v_position(position.getF32ptr());
-
- volume_position.load3(mDrawablep->getVOVolume()->agentPositionToVolume(v_position).mV);
-
- if (!mDrawablep->getVOVolume()->isVolumeGlobal())
- {
- LLVector4a scale;
- scale.load3(mVObjp->getScale().mV);
- volume_position.mul(scale);
- }
-
- LLVector4a volume_normal;
- LLVector3 v_normal(normal.getF32ptr());
- volume_normal.load3(mDrawablep->getVOVolume()->agentDirectionToVolume(v_normal).mV);
- volume_normal.normalize3fast();
-
- if (texgen == LLTextureEntry::TEX_GEN_PLANAR)
- {
- planarProjection(tc, volume_normal, center, volume_position);
- }
- }
-
- if (mTextureMatrix) // if we have a texture matrix, use it
- {
- LLVector3 tc3(tc);
- tc3 = tc3 * *mTextureMatrix;
- tc = LLVector2(tc3);
- }
-
- else // otherwise use the texture entry parameters
- {
- xform(tc, cos(tep->getRotation()), sin(tep->getRotation()),
- tep->mOffsetS, tep->mOffsetT, tep->mScaleS, tep->mScaleT);
- }
-
-
- return tc;
+ if (texgen != LLTextureEntry::TEX_GEN_DEFAULT)
+ {
+ LLVector4a& center = *(mDrawablep->getVOVolume()->getVolume()->getVolumeFace(mTEOffset).mCenter);
+
+ LLVector4a volume_position;
+ LLVector3 v_position(position.getF32ptr());
+
+ volume_position.load3(mDrawablep->getVOVolume()->agentPositionToVolume(v_position).mV);
+
+ if (!mDrawablep->getVOVolume()->isVolumeGlobal())
+ {
+ LLVector4a scale;
+ scale.load3(mVObjp->getScale().mV);
+ volume_position.mul(scale);
+ }
+
+ LLVector4a volume_normal;
+ LLVector3 v_normal(normal.getF32ptr());
+ volume_normal.load3(mDrawablep->getVOVolume()->agentDirectionToVolume(v_normal).mV);
+ volume_normal.normalize3fast();
+
+ if (texgen == LLTextureEntry::TEX_GEN_PLANAR)
+ {
+ planarProjection(tc, volume_normal, center, volume_position);
+ }
+ }
+
+ if (mTextureMatrix) // if we have a texture matrix, use it
+ {
+ LLVector3 tc3(tc);
+ tc3 = tc3 * *mTextureMatrix;
+ tc = LLVector2(tc3);
+ }
+
+ else // otherwise use the texture entry parameters
+ {
+ xform(tc, cos(tep->getRotation()), sin(tep->getRotation()),
+ tep->mOffsetS, tep->mOffsetT, tep->mScaleS, tep->mScaleT);
+ }
+
+
+ return tc;
}
// Returns scale compared to default texgen, and face orientation as calculated
// by planarProjection(). This is needed to match planar texgen parameters.
void LLFace::getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_pos, F32* scale) const
{
- const LLMatrix4& vol_mat = getWorldMatrix();
- const LLVolumeFace& vf = getViewerObject()->getVolume()->getVolumeFace(mTEOffset);
- if (! (vf.mNormals && vf.mTangents))
- {
- return;
- }
- const LLVector4a& normal4a = *vf.mNormals;
- const LLVector4a& tangent = *vf.mTangents;
-
- LLVector4a binormal4a;
- binormal4a.setCross3(normal4a, tangent);
- binormal4a.mul(tangent.getF32ptr()[3]);
-
- LLVector2 projected_binormal;
- planarProjection(projected_binormal, normal4a, *vf.mCenter, binormal4a);
- projected_binormal -= LLVector2(0.5f, 0.5f); // this normally happens in xform()
- *scale = projected_binormal.length();
- // rotate binormal to match what planarProjection() thinks it is,
- // then find rotation from that:
- projected_binormal.normalize();
- F32 ang = acos(projected_binormal.mV[VY]);
- ang = (projected_binormal.mV[VX] < 0.f) ? -ang : ang;
-
- //VECTORIZE THIS
- LLVector3 binormal(binormal4a.getF32ptr());
- LLVector3 normal(normal4a.getF32ptr());
- binormal.rotVec(ang, normal);
- LLQuaternion local_rot( binormal % normal, binormal, normal );
- *face_rot = local_rot * vol_mat.quaternion();
- *face_pos = vol_mat.getTranslation();
+ const LLMatrix4& vol_mat = getWorldMatrix();
+ const LLVolumeFace& vf = getViewerObject()->getVolume()->getVolumeFace(mTEOffset);
+ if (! (vf.mNormals && vf.mTangents))
+ {
+ return;
+ }
+ const LLVector4a& normal4a = *vf.mNormals;
+ const LLVector4a& tangent = *vf.mTangents;
+
+ LLVector4a binormal4a;
+ binormal4a.setCross3(normal4a, tangent);
+ binormal4a.mul(tangent.getF32ptr()[3]);
+
+ LLVector2 projected_binormal;
+ planarProjection(projected_binormal, normal4a, *vf.mCenter, binormal4a);
+ projected_binormal -= LLVector2(0.5f, 0.5f); // this normally happens in xform()
+ *scale = projected_binormal.length();
+ // rotate binormal to match what planarProjection() thinks it is,
+ // then find rotation from that:
+ projected_binormal.normalize();
+ F32 ang = acos(projected_binormal.mV[VY]);
+ ang = (projected_binormal.mV[VX] < 0.f) ? -ang : ang;
+
+ //VECTORIZE THIS
+ LLVector3 binormal(binormal4a.getF32ptr());
+ LLVector3 normal(normal4a.getF32ptr());
+ binormal.rotVec(ang, normal);
+ LLQuaternion local_rot( binormal % normal, binormal, normal );
+ *face_rot = local_rot * vol_mat.quaternion();
+ *face_pos = vol_mat.getTranslation();
}
// Returns the necessary texture transform to align this face's TE to align_to's TE
-bool LLFace::calcAlignedPlanarTE(const LLFace* align_to, LLVector2* res_st_offset,
- LLVector2* res_st_scale, F32* res_st_rot, LLRender::eTexIndex map) const
+bool LLFace::calcAlignedPlanarTE(const LLFace* align_to, LLVector2* res_st_offset,
+ LLVector2* res_st_scale, F32* res_st_rot, LLRender::eTexIndex map) const
{
- if (!align_to)
- {
- return false;
- }
- const LLTextureEntry *orig_tep = align_to->getTextureEntry();
- if ((orig_tep->getTexGen() != LLTextureEntry::TEX_GEN_PLANAR) ||
- (getTextureEntry()->getTexGen() != LLTextureEntry::TEX_GEN_PLANAR))
- {
- return false;
- }
+ if (!align_to)
+ {
+ return false;
+ }
+ const LLTextureEntry *orig_tep = align_to->getTextureEntry();
+ if ((orig_tep->getTexGen() != LLTextureEntry::TEX_GEN_PLANAR) ||
+ (getTextureEntry()->getTexGen() != LLTextureEntry::TEX_GEN_PLANAR))
+ {
+ return false;
+ }
F32 map_rot = 0.f, map_scaleS = 0.f, map_scaleT = 0.f, map_offsS = 0.f, map_offsT = 0.f;
@@ -1037,55 +1037,55 @@ bool LLFace::calcAlignedPlanarTE(const LLFace* align_to, LLVector2* res_st_offs
break;
}
- LLVector3 orig_pos, this_pos;
- LLQuaternion orig_face_rot, this_face_rot;
- F32 orig_proj_scale, this_proj_scale;
- align_to->getPlanarProjectedParams(&orig_face_rot, &orig_pos, &orig_proj_scale);
- getPlanarProjectedParams(&this_face_rot, &this_pos, &this_proj_scale);
-
- // The rotation of "this face's" texture:
- LLQuaternion orig_st_rot = LLQuaternion(map_rot, LLVector3::z_axis) * orig_face_rot;
- LLQuaternion this_st_rot = orig_st_rot * ~this_face_rot;
- F32 x_ang, y_ang, z_ang;
- this_st_rot.getEulerAngles(&x_ang, &y_ang, &z_ang);
- *res_st_rot = z_ang;
-
- // Offset and scale of "this face's" texture:
- LLVector3 centers_dist = (this_pos - orig_pos) * ~orig_st_rot;
- LLVector3 st_scale(map_scaleS, map_scaleT, 1.f);
- st_scale *= orig_proj_scale;
- centers_dist.scaleVec(st_scale);
- LLVector2 orig_st_offset(map_offsS, map_offsT);
-
- *res_st_offset = orig_st_offset + (LLVector2)centers_dist;
- res_st_offset->mV[VX] -= (S32)res_st_offset->mV[VX];
- res_st_offset->mV[VY] -= (S32)res_st_offset->mV[VY];
-
- st_scale /= this_proj_scale;
- *res_st_scale = (LLVector2)st_scale;
- return true;
+ LLVector3 orig_pos, this_pos;
+ LLQuaternion orig_face_rot, this_face_rot;
+ F32 orig_proj_scale, this_proj_scale;
+ align_to->getPlanarProjectedParams(&orig_face_rot, &orig_pos, &orig_proj_scale);
+ getPlanarProjectedParams(&this_face_rot, &this_pos, &this_proj_scale);
+
+ // The rotation of "this face's" texture:
+ LLQuaternion orig_st_rot = LLQuaternion(map_rot, LLVector3::z_axis) * orig_face_rot;
+ LLQuaternion this_st_rot = orig_st_rot * ~this_face_rot;
+ F32 x_ang, y_ang, z_ang;
+ this_st_rot.getEulerAngles(&x_ang, &y_ang, &z_ang);
+ *res_st_rot = z_ang;
+
+ // Offset and scale of "this face's" texture:
+ LLVector3 centers_dist = (this_pos - orig_pos) * ~orig_st_rot;
+ LLVector3 st_scale(map_scaleS, map_scaleT, 1.f);
+ st_scale *= orig_proj_scale;
+ centers_dist.scaleVec(st_scale);
+ LLVector2 orig_st_offset(map_offsS, map_offsT);
+
+ *res_st_offset = orig_st_offset + (LLVector2)centers_dist;
+ res_st_offset->mV[VX] -= (S32)res_st_offset->mV[VX];
+ res_st_offset->mV[VY] -= (S32)res_st_offset->mV[VY];
+
+ st_scale /= this_proj_scale;
+ *res_st_scale = (LLVector2)st_scale;
+ return true;
}
void LLFace::updateRebuildFlags()
{
- if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME))
- { //this rebuild is zero overhead (direct consequence of some change that affects this face)
- mLastUpdateTime = gFrameTimeSeconds;
- }
- else
- { //this rebuild is overhead (side effect of some change that does not affect this face)
- mLastMoveTime = gFrameTimeSeconds;
- }
+ if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME))
+ { //this rebuild is zero overhead (direct consequence of some change that affects this face)
+ mLastUpdateTime = gFrameTimeSeconds;
+ }
+ else
+ { //this rebuild is overhead (side effect of some change that does not affect this face)
+ mLastMoveTime = gFrameTimeSeconds;
+ }
}
bool LLFace::canRenderAsMask()
{
- const LLTextureEntry* te = getTextureEntry();
- if( !te || !getViewerObject() || !getTexture() )
- {
- return false;
- }
+ const LLTextureEntry* te = getTextureEntry();
+ if( !te || !getViewerObject() || !getTexture() )
+ {
+ return false;
+ }
if (te->getGLTFRenderMaterial())
{
@@ -1102,45 +1102,45 @@ bool LLFace::canRenderAsMask()
return false;
}
-
- LLMaterial* mat = te->getMaterialParams();
- if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
- {
- return false;
- }
-
- if ((te->getColor().mV[3] == 1.0f) && // can't treat as mask if we have face alpha
- (te->getGlow() == 0.f) && // glowing masks are hard to implement - don't mask
- getTexture()->getIsAlphaMask()) // texture actually qualifies for masking (lazily recalculated but expensive)
- {
- if (getViewerObject()->isHUDAttachment() || te->getFullbright())
- { //hud attachments and fullbright objects are NOT subject to the deferred rendering pipe
- return LLPipeline::sAutoMaskAlphaNonDeferred;
- }
- else
- {
- return LLPipeline::sAutoMaskAlphaDeferred;
- }
- }
-
- return false;
+
+ LLMaterial* mat = te->getMaterialParams();
+ if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
+ {
+ return false;
+ }
+
+ if ((te->getColor().mV[3] == 1.0f) && // can't treat as mask if we have face alpha
+ (te->getGlow() == 0.f) && // glowing masks are hard to implement - don't mask
+ getTexture()->getIsAlphaMask()) // texture actually qualifies for masking (lazily recalculated but expensive)
+ {
+ if (getViewerObject()->isHUDAttachment() || te->getFullbright())
+ { //hud attachments and fullbright objects are NOT subject to the deferred rendering pipe
+ return LLPipeline::sAutoMaskAlphaNonDeferred;
+ }
+ else
+ {
+ return LLPipeline::sAutoMaskAlphaDeferred;
+ }
+ }
+
+ return false;
}
//helper function for pushing primitives for transform shaders and cleaning up
//uninitialized data on the tail, plus tracking number of expected primitives
void push_for_transform(LLVertexBuffer* buff, U32 source_count, U32 dest_count)
{
- if (source_count > 0 && dest_count >= source_count) //protect against possible U32 wrapping
- {
- //push source primitives
- buff->drawArrays(LLRender::POINTS, 0, source_count);
- U32 tail = dest_count-source_count;
- for (U32 i = 0; i < tail; ++i)
- { //copy last source primitive into each element in tail
- buff->drawArrays(LLRender::POINTS, source_count-1, 1);
- }
- gPipeline.mTransformFeedbackPrimitives += dest_count;
- }
+ if (source_count > 0 && dest_count >= source_count) //protect against possible U32 wrapping
+ {
+ //push source primitives
+ buff->drawArrays(LLRender::POINTS, 0, source_count);
+ U32 tail = dest_count-source_count;
+ for (U32 i = 0; i < tail; ++i)
+ { //copy last source primitive into each element in tail
+ buff->drawArrays(LLRender::POINTS, source_count-1, 1);
+ }
+ gPipeline.mTransformFeedbackPrimitives += dest_count;
+ }
}
BOOL LLFace::getGeometryVolume(const LLVolume& volume,
@@ -1152,7 +1152,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
bool no_debug_assert)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE;
- llassert(verify());
+ llassert(verify());
if (face_index < 0 || face_index >= volume.getNumVolumeFaces())
{
@@ -1170,163 +1170,163 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
bool rigged = isState(RIGGED);
const LLVolumeFace &vf = volume.getVolumeFace(face_index);
- S32 num_vertices = (S32)vf.mNumVertices;
- S32 num_indices = (S32) vf.mNumIndices;
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE))
- {
- updateRebuildFlags();
- }
-
- if (mVertexBuffer.notNull())
- {
- if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices())
- {
- if (gDebugGL)
- {
- LL_WARNS() << "Index buffer overflow!" << LL_ENDL;
- LL_WARNS() << "Indices Count: " << mIndicesCount
- << " VF Num Indices: " << num_indices
- << " Indices Index: " << mIndicesIndex
- << " VB Num Indices: " << mVertexBuffer->getNumIndices() << LL_ENDL;
- LL_WARNS() << " Face Index: " << face_index
- << " Pool Type: " << mPoolType << LL_ENDL;
- llassert(no_debug_assert);
- }
- return FALSE;
- }
-
- if (num_vertices + mGeomIndex > mVertexBuffer->getNumVerts())
- {
- if (gDebugGL)
- {
- LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL;
- llassert(no_debug_assert);
- }
- return FALSE;
- }
- }
-
- LLStrider<LLVector3> vert;
- LLStrider<LLVector2> tex_coords0;
- LLStrider<LLVector2> tex_coords1;
- LLStrider<LLVector2> tex_coords2;
- LLStrider<LLVector3> norm;
- LLStrider<LLColor4U> colors;
- LLStrider<LLVector3> tangent;
- LLStrider<U16> indicesp;
- LLStrider<LLVector4> wght;
-
- BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME);
-
- BOOL global_volume = mDrawablep->getVOVolume()->isVolumeGlobal();
- LLVector3 scale;
- if (global_volume)
- {
- scale.setVec(1,1,1);
- }
- else
- {
- scale = mVObjp->getScale();
- }
-
- bool rebuild_pos = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_POSITION);
- bool rebuild_color = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_COLOR);
- bool rebuild_emissive = rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE);
- bool rebuild_tcoord = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_TCOORD);
- bool rebuild_normal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
- bool rebuild_tangent = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TANGENT);
- bool rebuild_weights = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_WEIGHT4);
-
- const LLTextureEntry *tep = mVObjp->getTE(face_index);
- const U8 bump_code = tep ? tep->getBumpmap() : 0;
-
- BOOL is_static = mDrawablep->isStatic();
- BOOL is_global = is_static;
-
- LLVector3 center_sum(0.f, 0.f, 0.f);
-
- if (is_global)
- {
- setState(GLOBAL);
- }
- else
- {
- clearState(GLOBAL);
- }
-
- LLColor4U color = tep->getColor();
+ S32 num_vertices = (S32)vf.mNumVertices;
+ S32 num_indices = (S32) vf.mNumIndices;
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE))
+ {
+ updateRebuildFlags();
+ }
+
+ if (mVertexBuffer.notNull())
+ {
+ if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices())
+ {
+ if (gDebugGL)
+ {
+ LL_WARNS() << "Index buffer overflow!" << LL_ENDL;
+ LL_WARNS() << "Indices Count: " << mIndicesCount
+ << " VF Num Indices: " << num_indices
+ << " Indices Index: " << mIndicesIndex
+ << " VB Num Indices: " << mVertexBuffer->getNumIndices() << LL_ENDL;
+ LL_WARNS() << " Face Index: " << face_index
+ << " Pool Type: " << mPoolType << LL_ENDL;
+ llassert(no_debug_assert);
+ }
+ return FALSE;
+ }
+
+ if (num_vertices + mGeomIndex > mVertexBuffer->getNumVerts())
+ {
+ if (gDebugGL)
+ {
+ LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL;
+ llassert(no_debug_assert);
+ }
+ return FALSE;
+ }
+ }
+
+ LLStrider<LLVector3> vert;
+ LLStrider<LLVector2> tex_coords0;
+ LLStrider<LLVector2> tex_coords1;
+ LLStrider<LLVector2> tex_coords2;
+ LLStrider<LLVector3> norm;
+ LLStrider<LLColor4U> colors;
+ LLStrider<LLVector3> tangent;
+ LLStrider<U16> indicesp;
+ LLStrider<LLVector4> wght;
+
+ BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME);
+
+ BOOL global_volume = mDrawablep->getVOVolume()->isVolumeGlobal();
+ LLVector3 scale;
+ if (global_volume)
+ {
+ scale.setVec(1,1,1);
+ }
+ else
+ {
+ scale = mVObjp->getScale();
+ }
+
+ bool rebuild_pos = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_POSITION);
+ bool rebuild_color = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_COLOR);
+ bool rebuild_emissive = rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE);
+ bool rebuild_tcoord = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_TCOORD);
+ bool rebuild_normal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
+ bool rebuild_tangent = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TANGENT);
+ bool rebuild_weights = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_WEIGHT4);
+
+ const LLTextureEntry *tep = mVObjp->getTE(face_index);
+ const U8 bump_code = tep ? tep->getBumpmap() : 0;
+
+ BOOL is_static = mDrawablep->isStatic();
+ BOOL is_global = is_static;
+
+ LLVector3 center_sum(0.f, 0.f, 0.f);
+
+ if (is_global)
+ {
+ setState(GLOBAL);
+ }
+ else
+ {
+ clearState(GLOBAL);
+ }
+
+ LLColor4U color = tep->getColor();
if (tep->getGLTFRenderMaterial())
{
color = tep->getGLTFRenderMaterial()->mBaseColor;
}
- if (rebuild_color)
- { //decide if shiny goes in alpha channel of color
- if (tep &&
- !isInAlphaPool()) // <--- alpha channel MUST contain transparency, not shiny
- {
- LLMaterial* mat = tep->getMaterialParams().get();
-
- bool shiny_in_alpha = false;
-
- //store shiny in alpha if we don't have a specular map
- if (!mat || mat->getSpecularID().isNull())
- {
- shiny_in_alpha = true;
- }
-
- if (shiny_in_alpha)
- {
- static const GLfloat SHININESS_TO_ALPHA[4] =
- {
- 0.0000f,
- 0.25f,
- 0.5f,
- 0.75f
- };
-
- llassert(tep->getShiny() <= 3);
- color.mV[3] = U8 (SHININESS_TO_ALPHA[tep->getShiny()] * 255);
- }
- }
- }
-
- // INDICES
- if (full_rebuild)
- {
+ if (rebuild_color)
+ { //decide if shiny goes in alpha channel of color
+ if (tep &&
+ !isInAlphaPool()) // <--- alpha channel MUST contain transparency, not shiny
+ {
+ LLMaterial* mat = tep->getMaterialParams().get();
+
+ bool shiny_in_alpha = false;
+
+ //store shiny in alpha if we don't have a specular map
+ if (!mat || mat->getSpecularID().isNull())
+ {
+ shiny_in_alpha = true;
+ }
+
+ if (shiny_in_alpha)
+ {
+ static const GLfloat SHININESS_TO_ALPHA[4] =
+ {
+ 0.0000f,
+ 0.25f,
+ 0.5f,
+ 0.75f
+ };
+
+ llassert(tep->getShiny() <= 3);
+ color.mV[3] = U8 (SHININESS_TO_ALPHA[tep->getShiny()] * 255);
+ }
+ }
+ }
+
+ // INDICES
+ if (full_rebuild)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - indices");
- mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount);
+ mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount);
+
+ volatile __m128i* dst = (__m128i*) indicesp.get();
+ __m128i* src = (__m128i*) vf.mIndices;
+ __m128i offset = _mm_set1_epi16(index_offset);
- volatile __m128i* dst = (__m128i*) indicesp.get();
- __m128i* src = (__m128i*) vf.mIndices;
- __m128i offset = _mm_set1_epi16(index_offset);
+ S32 end = num_indices/8;
- S32 end = num_indices/8;
-
- for (S32 i = 0; i < end; i++)
- {
- __m128i res = _mm_add_epi16(src[i], offset);
- _mm_storeu_si128((__m128i*) dst++, res);
- }
+ for (S32 i = 0; i < end; i++)
+ {
+ __m128i res = _mm_add_epi16(src[i], offset);
+ _mm_storeu_si128((__m128i*) dst++, res);
+ }
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - indices tail");
- U16* idx = (U16*) dst;
+ U16* idx = (U16*) dst;
+
+ for (S32 i = end*8; i < num_indices; ++i)
+ {
+ *idx++ = vf.mIndices[i]+index_offset;
+ }
+ }
+ }
- for (S32 i = end*8; i < num_indices; ++i)
- {
- *idx++ = vf.mIndices[i]+index_offset;
- }
- }
- }
-
LLMaterial* mat = tep->getMaterialParams().get();
LLGLTFMaterial* gltf_mat = tep->getGLTFRenderMaterial();
- F32 r = 0, os = 0, ot = 0, ms = 0, mt = 0, cos_ang = 0, sin_ang = 0;
+ F32 r = 0, os = 0, ot = 0, ms = 0, mt = 0, cos_ang = 0, sin_ang = 0;
constexpr S32 XFORM_NONE = 0;
constexpr S32 XFORM_BLINNPHONG_COLOR = 1;
@@ -1391,7 +1391,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
}
}
}
-
+
const LLMeshSkinInfo* skin = nullptr;
LLMatrix4a mat_vert;
LLMatrix4a mat_normal;
@@ -1431,334 +1431,334 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
}
}
- {
- //if it's not fullbright and has no normals, bake sunlight based on face normal
- //bool bake_sunlight = !getTextureEntry()->getFullbright() &&
- // !mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
+ {
+ //if it's not fullbright and has no normals, bake sunlight based on face normal
+ //bool bake_sunlight = !getTextureEntry()->getFullbright() &&
+ // !mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
- if (rebuild_tcoord)
- {
+ if (rebuild_tcoord)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tcoord");
-
- //bump setup
- LLVector4a binormal_dir( -sin_ang, cos_ang, 0.f );
- LLVector4a bump_s_primary_light_ray(0.f, 0.f, 0.f);
- LLVector4a bump_t_primary_light_ray(0.f, 0.f, 0.f);
-
- LLQuaternion bump_quat;
- if (mDrawablep->isActive())
- {
- bump_quat = LLQuaternion(mDrawablep->getRenderMatrix());
- }
-
- if (bump_code)
- {
- mVObjp->getVolume()->genTangents(face_index);
- F32 offset_multiple;
- switch( bump_code )
- {
- case BE_NO_BUMP:
- offset_multiple = 0.f;
- break;
- case BE_BRIGHTNESS:
- case BE_DARKNESS:
- if( mTexture[LLRender::DIFFUSE_MAP].notNull() && mTexture[LLRender::DIFFUSE_MAP]->hasGLTexture())
- {
- // Offset by approximately one texel
- S32 cur_discard = mTexture[LLRender::DIFFUSE_MAP]->getDiscardLevel();
- S32 max_size = llmax( mTexture[LLRender::DIFFUSE_MAP]->getWidth(), mTexture[LLRender::DIFFUSE_MAP]->getHeight() );
- max_size <<= cur_discard;
- const F32 ARTIFICIAL_OFFSET = 2.f;
- offset_multiple = ARTIFICIAL_OFFSET / (F32)max_size;
- }
- else
- {
- offset_multiple = 1.f/256;
- }
- break;
-
- default: // Standard bumpmap textures. Assumed to be 256x256
- offset_multiple = 1.f / 256;
- break;
- }
-
- F32 s_scale = 1.f;
- F32 t_scale = 1.f;
- if( tep )
- {
- tep->getScale( &s_scale, &t_scale );
- }
- // Use the nudged south when coming from above sun angle, such
- // that emboss mapping always shows up on the upward faces of cubes when
- // it's noon (since a lot of builders build with the sun forced to noon).
- LLVector3 sun_ray = gSky.mVOSkyp->mBumpSunDir;
- LLVector3 moon_ray = gSky.mVOSkyp->getMoon().getDirection();
- LLVector3& primary_light_ray = (sun_ray.mV[VZ] > 0) ? sun_ray : moon_ray;
-
- bump_s_primary_light_ray.load3((offset_multiple * s_scale * primary_light_ray).mV);
- bump_t_primary_light_ray.load3((offset_multiple * t_scale * primary_light_ray).mV);
- }
-
- U8 texgen = getTextureEntry()->getTexGen();
- if (rebuild_tcoord && texgen != LLTextureEntry::TEX_GEN_DEFAULT)
- { //planar texgen needs binormals
- mVObjp->getVolume()->genTangents(face_index);
- }
-
- U8 tex_mode = 0;
-
- bool tex_anim = false;
-
- LLVOVolume* vobj = (LLVOVolume*) (LLViewerObject*) mVObjp;
- tex_mode = vobj->mTexAnimMode;
-
- if (vobj->mTextureAnimp)
- { //texture animation is in play, override specular and normal map tex coords with diffuse texcoords
- tex_anim = true;
- }
-
- if (isState(TEXTURE_ANIM))
- {
- if (!tex_mode)
- {
- clearState(TEXTURE_ANIM);
- }
- else
- {
- os = ot = 0.f;
- r = 0.f;
- cos_ang = 1.f;
- sin_ang = 0.f;
- ms = mt = 1.f;
+
+ //bump setup
+ LLVector4a binormal_dir( -sin_ang, cos_ang, 0.f );
+ LLVector4a bump_s_primary_light_ray(0.f, 0.f, 0.f);
+ LLVector4a bump_t_primary_light_ray(0.f, 0.f, 0.f);
+
+ LLQuaternion bump_quat;
+ if (mDrawablep->isActive())
+ {
+ bump_quat = LLQuaternion(mDrawablep->getRenderMatrix());
+ }
+
+ if (bump_code)
+ {
+ mVObjp->getVolume()->genTangents(face_index);
+ F32 offset_multiple;
+ switch( bump_code )
+ {
+ case BE_NO_BUMP:
+ offset_multiple = 0.f;
+ break;
+ case BE_BRIGHTNESS:
+ case BE_DARKNESS:
+ if( mTexture[LLRender::DIFFUSE_MAP].notNull() && mTexture[LLRender::DIFFUSE_MAP]->hasGLTexture())
+ {
+ // Offset by approximately one texel
+ S32 cur_discard = mTexture[LLRender::DIFFUSE_MAP]->getDiscardLevel();
+ S32 max_size = llmax( mTexture[LLRender::DIFFUSE_MAP]->getWidth(), mTexture[LLRender::DIFFUSE_MAP]->getHeight() );
+ max_size <<= cur_discard;
+ const F32 ARTIFICIAL_OFFSET = 2.f;
+ offset_multiple = ARTIFICIAL_OFFSET / (F32)max_size;
+ }
+ else
+ {
+ offset_multiple = 1.f/256;
+ }
+ break;
+
+ default: // Standard bumpmap textures. Assumed to be 256x256
+ offset_multiple = 1.f / 256;
+ break;
+ }
+
+ F32 s_scale = 1.f;
+ F32 t_scale = 1.f;
+ if( tep )
+ {
+ tep->getScale( &s_scale, &t_scale );
+ }
+ // Use the nudged south when coming from above sun angle, such
+ // that emboss mapping always shows up on the upward faces of cubes when
+ // it's noon (since a lot of builders build with the sun forced to noon).
+ LLVector3 sun_ray = gSky.mVOSkyp->mBumpSunDir;
+ LLVector3 moon_ray = gSky.mVOSkyp->getMoon().getDirection();
+ LLVector3& primary_light_ray = (sun_ray.mV[VZ] > 0) ? sun_ray : moon_ray;
+
+ bump_s_primary_light_ray.load3((offset_multiple * s_scale * primary_light_ray).mV);
+ bump_t_primary_light_ray.load3((offset_multiple * t_scale * primary_light_ray).mV);
+ }
+
+ U8 texgen = getTextureEntry()->getTexGen();
+ if (rebuild_tcoord && texgen != LLTextureEntry::TEX_GEN_DEFAULT)
+ { //planar texgen needs binormals
+ mVObjp->getVolume()->genTangents(face_index);
+ }
+
+ U8 tex_mode = 0;
+
+ bool tex_anim = false;
+
+ LLVOVolume* vobj = (LLVOVolume*) (LLViewerObject*) mVObjp;
+ tex_mode = vobj->mTexAnimMode;
+
+ if (vobj->mTextureAnimp)
+ { //texture animation is in play, override specular and normal map tex coords with diffuse texcoords
+ tex_anim = true;
+ }
+
+ if (isState(TEXTURE_ANIM))
+ {
+ if (!tex_mode)
+ {
+ clearState(TEXTURE_ANIM);
+ }
+ else
+ {
+ os = ot = 0.f;
+ r = 0.f;
+ cos_ang = 1.f;
+ sin_ang = 0.f;
+ ms = mt = 1.f;
xforms = XFORM_NONE;
- }
+ }
- if (getVirtualSize() >= MIN_TEX_ANIM_SIZE) // || isState(LLFace::RIGGED))
- { //don't override texture transform during tc bake
- tex_mode = 0;
- }
- }
+ if (getVirtualSize() >= MIN_TEX_ANIM_SIZE) // || isState(LLFace::RIGGED))
+ { //don't override texture transform during tc bake
+ tex_mode = 0;
+ }
+ }
- LLVector4a scalea;
- scalea.load3(scale.mV);
+ LLVector4a scalea;
+ scalea.load3(scale.mV);
- bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1);
+ bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1);
+
+ if ((mat || gltf_mat) && !do_bump)
+ {
+ do_bump = mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1)
+ || mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2);
+ }
- if ((mat || gltf_mat) && !do_bump)
- {
- do_bump = mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1)
- || mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2);
- }
-
// For GLTF materials: Transforms will be applied later
- bool do_tex_mat = tex_mode && mTextureMatrix && !gltf_mat;
+ bool do_tex_mat = tex_mode && mTextureMatrix && !gltf_mat;
- if (!do_bump)
- { //not bump mapped, might be able to do a cheap update
- mVertexBuffer->getTexCoord0Strider(tex_coords0, mGeomIndex, mGeomCount);
+ if (!do_bump)
+ { //not bump mapped, might be able to do a cheap update
+ mVertexBuffer->getTexCoord0Strider(tex_coords0, mGeomIndex, mGeomCount);
- if (texgen != LLTextureEntry::TEX_GEN_PLANAR)
- {
+ if (texgen != LLTextureEntry::TEX_GEN_PLANAR)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - texgen");
- if (!do_tex_mat)
- {
- if (xforms == XFORM_NONE)
- {
+ if (!do_tex_mat)
+ {
+ if (xforms == XFORM_NONE)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("ggv - texgen 1");
- S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF;
- LLVector4a::memcpyNonAliased16((F32*) tex_coords0.get(), (F32*) vf.mTexCoords, tc_size);
- }
- else
- {
+ S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF;
+ LLVector4a::memcpyNonAliased16((F32*) tex_coords0.get(), (F32*) vf.mTexCoords, tc_size);
+ }
+ else
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("ggv - texgen 2");
- F32* dst = (F32*) tex_coords0.get();
- LLVector4a* src = (LLVector4a*) vf.mTexCoords;
-
- LLVector4a trans;
- trans.splat(-0.5f);
-
- LLVector4a rot0;
- rot0.set(cos_ang, -sin_ang, cos_ang, -sin_ang);
-
- LLVector4a rot1;
- rot1.set(sin_ang, cos_ang, sin_ang, cos_ang);
-
- LLVector4a scale;
- scale.set(ms, mt, ms, mt);
-
- LLVector4a offset;
- offset.set(os+0.5f, ot+0.5f, os+0.5f, ot+0.5f);
-
- LLVector4Logical mask;
- mask.clear();
- mask.setElement<2>();
- mask.setElement<3>();
-
- U32 count = num_vertices/2 + num_vertices%2;
-
- for (S32 i = 0; i < count; i++)
- {
- LLVector4a res = *src++;
- xform4a(res, trans, mask, rot0, rot1, offset, scale);
- res.store4a(dst);
- dst += 4;
- }
- }
- }
- else
- { //do tex mat, no texgen, no bump
- for (S32 i = 0; i < num_vertices; i++)
- {
- LLVector2 tc(vf.mTexCoords[i]);
-
- LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
- tmp = tmp * *mTextureMatrix;
- tc.mV[0] = tmp.mV[0];
- tc.mV[1] = tmp.mV[1];
- *tex_coords0++ = tc;
- }
- }
- }
- else
- { //no bump, tex gen planar
+ F32* dst = (F32*) tex_coords0.get();
+ LLVector4a* src = (LLVector4a*) vf.mTexCoords;
+
+ LLVector4a trans;
+ trans.splat(-0.5f);
+
+ LLVector4a rot0;
+ rot0.set(cos_ang, -sin_ang, cos_ang, -sin_ang);
+
+ LLVector4a rot1;
+ rot1.set(sin_ang, cos_ang, sin_ang, cos_ang);
+
+ LLVector4a scale;
+ scale.set(ms, mt, ms, mt);
+
+ LLVector4a offset;
+ offset.set(os+0.5f, ot+0.5f, os+0.5f, ot+0.5f);
+
+ LLVector4Logical mask;
+ mask.clear();
+ mask.setElement<2>();
+ mask.setElement<3>();
+
+ U32 count = num_vertices/2 + num_vertices%2;
+
+ for (S32 i = 0; i < count; i++)
+ {
+ LLVector4a res = *src++;
+ xform4a(res, trans, mask, rot0, rot1, offset, scale);
+ res.store4a(dst);
+ dst += 4;
+ }
+ }
+ }
+ else
+ { //do tex mat, no texgen, no bump
+ for (S32 i = 0; i < num_vertices; i++)
+ {
+ LLVector2 tc(vf.mTexCoords[i]);
+
+ LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
+ tmp = tmp * *mTextureMatrix;
+ tc.mV[0] = tmp.mV[0];
+ tc.mV[1] = tmp.mV[1];
+ *tex_coords0++ = tc;
+ }
+ }
+ }
+ else
+ { //no bump, tex gen planar
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - texgen planar");
- if (do_tex_mat)
- {
- for (S32 i = 0; i < num_vertices; i++)
- {
- LLVector2 tc(vf.mTexCoords[i]);
- LLVector4a& norm = vf.mNormals[i];
- LLVector4a& center = *(vf.mCenter);
- LLVector4a vec = vf.mPositions[i];
- vec.mul(scalea);
- planarProjection(tc, norm, center, vec);
-
- LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
- tmp = tmp * *mTextureMatrix;
- tc.mV[0] = tmp.mV[0];
- tc.mV[1] = tmp.mV[1];
-
- *tex_coords0++ = tc;
- }
- }
- else if (xforms != XFORM_NONE)
- {
- for (S32 i = 0; i < num_vertices; i++)
- {
- LLVector2 tc(vf.mTexCoords[i]);
- LLVector4a& norm = vf.mNormals[i];
- LLVector4a& center = *(vf.mCenter);
- LLVector4a vec = vf.mPositions[i];
- vec.mul(scalea);
- planarProjection(tc, norm, center, vec);
-
- xform(tc, cos_ang, sin_ang, os, ot, ms, mt);
-
- *tex_coords0++ = tc;
- }
- }
- else
- {
- for (S32 i = 0; i < num_vertices; i++)
- {
- LLVector2 tc(vf.mTexCoords[i]);
- LLVector4a& norm = vf.mNormals[i];
- LLVector4a& center = *(vf.mCenter);
- LLVector4a vec = vf.mPositions[i];
- vec.mul(scalea);
- planarProjection(tc, norm, center, vec);
-
- *tex_coords0++ = tc;
- }
- }
- }
- }
- else
- { //bump mapped or has material, just do the whole expensive loop
+ if (do_tex_mat)
+ {
+ for (S32 i = 0; i < num_vertices; i++)
+ {
+ LLVector2 tc(vf.mTexCoords[i]);
+ LLVector4a& norm = vf.mNormals[i];
+ LLVector4a& center = *(vf.mCenter);
+ LLVector4a vec = vf.mPositions[i];
+ vec.mul(scalea);
+ planarProjection(tc, norm, center, vec);
+
+ LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
+ tmp = tmp * *mTextureMatrix;
+ tc.mV[0] = tmp.mV[0];
+ tc.mV[1] = tmp.mV[1];
+
+ *tex_coords0++ = tc;
+ }
+ }
+ else if (xforms != XFORM_NONE)
+ {
+ for (S32 i = 0; i < num_vertices; i++)
+ {
+ LLVector2 tc(vf.mTexCoords[i]);
+ LLVector4a& norm = vf.mNormals[i];
+ LLVector4a& center = *(vf.mCenter);
+ LLVector4a vec = vf.mPositions[i];
+ vec.mul(scalea);
+ planarProjection(tc, norm, center, vec);
+
+ xform(tc, cos_ang, sin_ang, os, ot, ms, mt);
+
+ *tex_coords0++ = tc;
+ }
+ }
+ else
+ {
+ for (S32 i = 0; i < num_vertices; i++)
+ {
+ LLVector2 tc(vf.mTexCoords[i]);
+ LLVector4a& norm = vf.mNormals[i];
+ LLVector4a& center = *(vf.mCenter);
+ LLVector4a vec = vf.mPositions[i];
+ vec.mul(scalea);
+ planarProjection(tc, norm, center, vec);
+
+ *tex_coords0++ = tc;
+ }
+ }
+ }
+ }
+ else
+ { //bump mapped or has material, just do the whole expensive loop
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - texgen default");
- std::vector<LLVector2> bump_tc;
-
- if (mat && !mat->getNormalID().isNull())
- { //writing out normal and specular texture coordinates, not bump offsets
- do_bump = false;
- }
+ std::vector<LLVector2> bump_tc;
+
+ if (mat && !mat->getNormalID().isNull())
+ { //writing out normal and specular texture coordinates, not bump offsets
+ do_bump = false;
+ }
- LLStrider<LLVector2> dst;
+ LLStrider<LLVector2> dst;
- for (U32 ch = 0; ch < 3; ++ch)
- {
+ for (U32 ch = 0; ch < 3; ++ch)
+ {
S32 xform_channel = XFORM_NONE;
- switch (ch)
- {
- case 0:
+ switch (ch)
+ {
+ case 0:
xform_channel = XFORM_BLINNPHONG_COLOR;
- mVertexBuffer->getTexCoord0Strider(dst, mGeomIndex, mGeomCount);
- break;
- case 1:
+ mVertexBuffer->getTexCoord0Strider(dst, mGeomIndex, mGeomCount);
+ break;
+ case 1:
xform_channel = XFORM_BLINNPHONG_NORMAL;
- if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1))
- {
- mVertexBuffer->getTexCoord1Strider(dst, mGeomIndex, mGeomCount);
- if (mat && !tex_anim)
- {
- r = mat->getNormalRotation();
- mat->getNormalOffset(os, ot);
- mat->getNormalRepeat(ms, mt);
-
- cos_ang = cos(r);
- sin_ang = sin(r);
-
- }
- }
- else
- {
- continue;
- }
- break;
- case 2:
+ if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1))
+ {
+ mVertexBuffer->getTexCoord1Strider(dst, mGeomIndex, mGeomCount);
+ if (mat && !tex_anim)
+ {
+ r = mat->getNormalRotation();
+ mat->getNormalOffset(os, ot);
+ mat->getNormalRepeat(ms, mt);
+
+ cos_ang = cos(r);
+ sin_ang = sin(r);
+
+ }
+ }
+ else
+ {
+ continue;
+ }
+ break;
+ case 2:
xform_channel = XFORM_BLINNPHONG_SPECULAR;
- if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2))
- {
- mVertexBuffer->getTexCoord2Strider(dst, mGeomIndex, mGeomCount);
- if (mat && !tex_anim)
- {
- r = mat->getSpecularRotation();
- mat->getSpecularOffset(os, ot);
- mat->getSpecularRepeat(ms, mt);
-
- cos_ang = cos(r);
- sin_ang = sin(r);
- }
- }
- else
- {
- continue;
- }
- break;
- }
+ if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2))
+ {
+ mVertexBuffer->getTexCoord2Strider(dst, mGeomIndex, mGeomCount);
+ if (mat && !tex_anim)
+ {
+ r = mat->getSpecularRotation();
+ mat->getSpecularOffset(os, ot);
+ mat->getSpecularRepeat(ms, mt);
+
+ cos_ang = cos(r);
+ sin_ang = sin(r);
+ }
+ }
+ else
+ {
+ continue;
+ }
+ break;
+ }
const bool do_xform = (xforms & xform_channel) != XFORM_NONE;
-
+
for (S32 i = 0; i < num_vertices; i++)
- {
+ {
LLVector2 tc(vf.mTexCoords[i]);
-
+
LLVector4a& norm = vf.mNormals[i];
-
+
LLVector4a& center = *(vf.mCenter);
-
+
if (texgen != LLTextureEntry::TEX_GEN_DEFAULT)
{
LLVector4a vec = vf.mPositions[i];
-
+
vec.mul(scalea);
if (texgen == LLTextureEntry::TEX_GEN_PLANAR)
{
planarProjection(tc, norm, center, vec);
- }
+ }
}
if (tex_mode && mTextureMatrix)
@@ -1779,239 +1779,239 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
bump_tc.push_back(tc);
}
}
- }
+ }
+
+ if ((!mat && !gltf_mat) && do_bump)
+ {
+ mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount);
- if ((!mat && !gltf_mat) && do_bump)
- {
- mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount);
-
mVObjp->getVolume()->genTangents(face_index);
- for (S32 i = 0; i < num_vertices; i++)
- {
- LLVector4a tangent = vf.mTangents[i];
-
- LLVector4a binorm;
- binorm.setCross3(vf.mNormals[i], tangent);
- binorm.mul(tangent.getF32ptr()[3]);
-
- LLMatrix4a tangent_to_object;
- tangent_to_object.setRows(tangent, binorm, vf.mNormals[i]);
- LLVector4a t;
- tangent_to_object.rotate(binormal_dir, t);
- LLVector4a binormal;
- mat_normal.rotate(t, binormal);
-
- //VECTORIZE THIS
- if (mDrawablep->isActive())
- {
- LLVector3 t;
- t.set(binormal.getF32ptr());
- t *= bump_quat;
- binormal.load3(t.mV);
- }
-
- binormal.normalize3fast();
-
- LLVector2 tc = bump_tc[i];
- tc += LLVector2( bump_s_primary_light_ray.dot3(tangent).getF32(), bump_t_primary_light_ray.dot3(binormal).getF32() );
-
- *tex_coords1++ = tc;
- }
- }
- }
- }
-
- if (rebuild_pos)
- {
- LLVector4a* src = vf.mPositions;
-
- //_mm_prefetch((char*)src, _MM_HINT_T0);
-
- LLVector4a* end = src+num_vertices;
- //LLVector4a* end_64 = end-4;
-
- llassert(num_vertices > 0);
-
- mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount);
-
-
- F32* dst = (F32*) vert.get();
- F32* end_f32 = dst+mGeomCount*4;
-
- //_mm_prefetch((char*)dst, _MM_HINT_NTA);
- //_mm_prefetch((char*)src, _MM_HINT_NTA);
-
- //_mm_prefetch((char*)dst, _MM_HINT_NTA);
-
-
- LLVector4a res0; //,res1,res2,res3;
-
- LLVector4a texIdx;
-
- S32 index = mTextureIndex < FACE_DO_NOT_BATCH_TEXTURES ? mTextureIndex : 0;
-
- F32 val = 0.f;
- S32* vp = (S32*) &val;
- *vp = index;
-
- llassert(index <= LLGLSLShader::sIndexedTextureChannels-1);
-
- LLVector4Logical mask;
- mask.clear();
- mask.setElement<3>();
-
- texIdx.set(0,0,0,val);
-
- LLVector4a tmp;
-
-
- while (src < end)
- {
- mat_vert.affineTransform(*src++, res0);
- tmp.setSelectWithMask(mask, texIdx, res0);
- tmp.store4a((F32*) dst);
- dst += 4;
- }
-
- while (dst < end_f32)
- {
- res0.store4a((F32*) dst);
- dst += 4;
- }
- }
-
- if (rebuild_normal)
- {
+ for (S32 i = 0; i < num_vertices; i++)
+ {
+ LLVector4a tangent = vf.mTangents[i];
+
+ LLVector4a binorm;
+ binorm.setCross3(vf.mNormals[i], tangent);
+ binorm.mul(tangent.getF32ptr()[3]);
+
+ LLMatrix4a tangent_to_object;
+ tangent_to_object.setRows(tangent, binorm, vf.mNormals[i]);
+ LLVector4a t;
+ tangent_to_object.rotate(binormal_dir, t);
+ LLVector4a binormal;
+ mat_normal.rotate(t, binormal);
+
+ //VECTORIZE THIS
+ if (mDrawablep->isActive())
+ {
+ LLVector3 t;
+ t.set(binormal.getF32ptr());
+ t *= bump_quat;
+ binormal.load3(t.mV);
+ }
+
+ binormal.normalize3fast();
+
+ LLVector2 tc = bump_tc[i];
+ tc += LLVector2( bump_s_primary_light_ray.dot3(tangent).getF32(), bump_t_primary_light_ray.dot3(binormal).getF32() );
+
+ *tex_coords1++ = tc;
+ }
+ }
+ }
+ }
+
+ if (rebuild_pos)
+ {
+ LLVector4a* src = vf.mPositions;
+
+ //_mm_prefetch((char*)src, _MM_HINT_T0);
+
+ LLVector4a* end = src+num_vertices;
+ //LLVector4a* end_64 = end-4;
+
+ llassert(num_vertices > 0);
+
+ mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount);
+
+
+ F32* dst = (F32*) vert.get();
+ F32* end_f32 = dst+mGeomCount*4;
+
+ //_mm_prefetch((char*)dst, _MM_HINT_NTA);
+ //_mm_prefetch((char*)src, _MM_HINT_NTA);
+
+ //_mm_prefetch((char*)dst, _MM_HINT_NTA);
+
+
+ LLVector4a res0; //,res1,res2,res3;
+
+ LLVector4a texIdx;
+
+ S32 index = mTextureIndex < FACE_DO_NOT_BATCH_TEXTURES ? mTextureIndex : 0;
+
+ F32 val = 0.f;
+ S32* vp = (S32*) &val;
+ *vp = index;
+
+ llassert(index <= LLGLSLShader::sIndexedTextureChannels-1);
+
+ LLVector4Logical mask;
+ mask.clear();
+ mask.setElement<3>();
+
+ texIdx.set(0,0,0,val);
+
+ LLVector4a tmp;
+
+
+ while (src < end)
+ {
+ mat_vert.affineTransform(*src++, res0);
+ tmp.setSelectWithMask(mask, texIdx, res0);
+ tmp.store4a((F32*) dst);
+ dst += 4;
+ }
+
+ while (dst < end_f32)
+ {
+ res0.store4a((F32*) dst);
+ dst += 4;
+ }
+ }
+
+ if (rebuild_normal)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - normal");
- mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount);
- F32* normals = (F32*) norm.get();
- LLVector4a* src = vf.mNormals;
- LLVector4a* end = src+num_vertices;
-
- while (src < end)
- {
- LLVector4a normal;
- mat_normal.rotate(*src++, normal);
- normal.store4a(normals);
- normals += 4;
- }
- }
-
- if (rebuild_tangent)
- {
+ mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount);
+ F32* normals = (F32*) norm.get();
+ LLVector4a* src = vf.mNormals;
+ LLVector4a* end = src+num_vertices;
+
+ while (src < end)
+ {
+ LLVector4a normal;
+ mat_normal.rotate(*src++, normal);
+ normal.store4a(normals);
+ normals += 4;
+ }
+ }
+
+ if (rebuild_tangent)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tangent");
- mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount);
- F32* tangents = (F32*) tangent.get();
-
+ mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount);
+ F32* tangents = (F32*) tangent.get();
+
mVObjp->getVolume()->genTangents(face_index);
-
- LLVector4Logical mask;
- mask.clear();
- mask.setElement<3>();
-
- LLVector4a* src = vf.mTangents;
- LLVector4a* end = vf.mTangents +num_vertices;
-
- while (src < end)
- {
- LLVector4a tangent_out;
- mat_normal.rotate(*src, tangent_out);
- tangent_out.setSelectWithMask(mask, *src, tangent_out);
- tangent_out.store4a(tangents);
-
- src++;
- tangents += 4;
- }
- }
-
- if (rebuild_weights && vf.mWeights)
- {
+
+ LLVector4Logical mask;
+ mask.clear();
+ mask.setElement<3>();
+
+ LLVector4a* src = vf.mTangents;
+ LLVector4a* end = vf.mTangents +num_vertices;
+
+ while (src < end)
+ {
+ LLVector4a tangent_out;
+ mat_normal.rotate(*src, tangent_out);
+ tangent_out.setSelectWithMask(mask, *src, tangent_out);
+ tangent_out.store4a(tangents);
+
+ src++;
+ tangents += 4;
+ }
+ }
+
+ if (rebuild_weights && vf.mWeights)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - weight");
- mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount);
- F32* weights = (F32*) wght.get();
- LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32));
- }
+ mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount);
+ F32* weights = (F32*) wght.get();
+ LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32));
+ }
- if (rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_COLOR) )
- {
+ if (rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_COLOR) )
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - color");
- mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount);
-
- LLVector4a src;
-
- U32 vec[4];
- vec[0] = vec[1] = vec[2] = vec[3] = color.asRGBA();
-
- src.loadua((F32*) vec);
-
- F32* dst = (F32*) colors.get();
- S32 num_vecs = num_vertices/4;
- if (num_vertices%4 > 0)
- {
- ++num_vecs;
- }
-
- for (S32 i = 0; i < num_vecs; i++)
- {
- src.store4a(dst);
- dst += 4;
- }
- }
-
- if (rebuild_emissive)
- {
+ mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount);
+
+ LLVector4a src;
+
+ U32 vec[4];
+ vec[0] = vec[1] = vec[2] = vec[3] = color.asRGBA();
+
+ src.loadua((F32*) vec);
+
+ F32* dst = (F32*) colors.get();
+ S32 num_vecs = num_vertices/4;
+ if (num_vertices%4 > 0)
+ {
+ ++num_vecs;
+ }
+
+ for (S32 i = 0; i < num_vecs; i++)
+ {
+ src.store4a(dst);
+ dst += 4;
+ }
+ }
+
+ if (rebuild_emissive)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - emissive");
- LLStrider<LLColor4U> emissive;
- mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount);
-
- U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255);
-
- LLVector4a src;
-
-
- LLColor4U glow4u = LLColor4U(0,0,0,glow);
-
- U32 glow32 = glow4u.asRGBA();
-
- U32 vec[4];
- vec[0] = vec[1] = vec[2] = vec[3] = glow32;
-
- src.loadua((F32*) vec);
-
- F32* dst = (F32*) emissive.get();
- S32 num_vecs = num_vertices/4;
- if (num_vertices%4 > 0)
- {
- ++num_vecs;
- }
-
- for (S32 i = 0; i < num_vecs; i++)
- {
- src.store4a(dst);
- dst += 4;
- }
- }
- }
-
- if (rebuild_tcoord)
- {
- mTexExtents[0].setVec(0,0);
- mTexExtents[1].setVec(1,1);
- xform(mTexExtents[0], cos_ang, sin_ang, os, ot, ms, mt);
- xform(mTexExtents[1], cos_ang, sin_ang, os, ot, ms, mt);
-
- F32 es = vf.mTexCoordExtents[1].mV[0] - vf.mTexCoordExtents[0].mV[0] ;
- F32 et = vf.mTexCoordExtents[1].mV[1] - vf.mTexCoordExtents[0].mV[1] ;
- mTexExtents[0][0] *= es ;
- mTexExtents[1][0] *= es ;
- mTexExtents[0][1] *= et ;
- mTexExtents[1][1] *= et ;
- }
-
-
- return TRUE;
+ LLStrider<LLColor4U> emissive;
+ mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount);
+
+ U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255);
+
+ LLVector4a src;
+
+
+ LLColor4U glow4u = LLColor4U(0,0,0,glow);
+
+ U32 glow32 = glow4u.asRGBA();
+
+ U32 vec[4];
+ vec[0] = vec[1] = vec[2] = vec[3] = glow32;
+
+ src.loadua((F32*) vec);
+
+ F32* dst = (F32*) emissive.get();
+ S32 num_vecs = num_vertices/4;
+ if (num_vertices%4 > 0)
+ {
+ ++num_vecs;
+ }
+
+ for (S32 i = 0; i < num_vecs; i++)
+ {
+ src.store4a(dst);
+ dst += 4;
+ }
+ }
+ }
+
+ if (rebuild_tcoord)
+ {
+ mTexExtents[0].setVec(0,0);
+ mTexExtents[1].setVec(1,1);
+ xform(mTexExtents[0], cos_ang, sin_ang, os, ot, ms, mt);
+ xform(mTexExtents[1], cos_ang, sin_ang, os, ot, ms, mt);
+
+ F32 es = vf.mTexCoordExtents[1].mV[0] - vf.mTexCoordExtents[0].mV[0] ;
+ F32 et = vf.mTexCoordExtents[1].mV[1] - vf.mTexCoordExtents[0].mV[1] ;
+ mTexExtents[0][0] *= es ;
+ mTexExtents[1][0] *= es ;
+ mTexExtents[0][1] *= et ;
+ mTexExtents[1][1] *= et ;
+ }
+
+
+ return TRUE;
}
void LLFace::renderIndexed()
@@ -2024,18 +2024,18 @@ void LLFace::renderIndexed()
}
//check if the face has a media
-BOOL LLFace::hasMedia() const
+BOOL LLFace::hasMedia() const
{
- if(mHasMedia)
- {
- return TRUE ;
- }
- if(mTexture[LLRender::DIFFUSE_MAP].notNull())
- {
- return mTexture[LLRender::DIFFUSE_MAP]->hasParcelMedia() ; //if has a parcel media
- }
-
- return FALSE ; //no media.
+ if(mHasMedia)
+ {
+ return TRUE ;
+ }
+ if(mTexture[LLRender::DIFFUSE_MAP].notNull())
+ {
+ return mTexture[LLRender::DIFFUSE_MAP]->hasParcelMedia() ; //if has a parcel media
+ }
+
+ return FALSE ; //no media.
}
const F32 LEAST_IMPORTANCE = 0.05f ;
@@ -2043,65 +2043,65 @@ const F32 LEAST_IMPORTANCE_FOR_LARGE_IMAGE = 0.3f ;
void LLFace::resetVirtualSize()
{
- setVirtualSize(0.f);
- mImportanceToCamera = 0.f;
+ setVirtualSize(0.f);
+ mImportanceToCamera = 0.f;
}
F32 LLFace::getTextureVirtualSize()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- F32 radius;
- F32 cos_angle_to_view_dir;
- BOOL in_frustum = calcPixelArea(cos_angle_to_view_dir, radius);
-
- if (mPixelArea < F_ALMOST_ZERO || !in_frustum)
- {
- setVirtualSize(0.f) ;
- return 0.f;
- }
-
- //get area of circle in texture space
- LLVector2 tdim = mTexExtents[1] - mTexExtents[0];
- F32 texel_area = (tdim * 0.5f).lengthSquared()*3.14159f;
- if (texel_area <= 0)
- {
- // Probably animated, use default
- texel_area = 1.f;
- }
-
- F32 face_area;
- if (mVObjp->isSculpted() && texel_area > 1.f)
- {
- //sculpts can break assumptions about texel area
- face_area = mPixelArea;
- }
- else
- {
- //apply texel area to face area to get accurate ratio
- //face_area /= llclamp(texel_area, 1.f/64.f, 16.f);
- face_area = mPixelArea / llclamp(texel_area, 0.015625f, 128.f);
- }
-
- face_area = LLFace::adjustPixelArea(mImportanceToCamera, face_area) ;
- if(face_area > LLViewerTexture::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
- {
- if(mImportanceToCamera > LEAST_IMPORTANCE_FOR_LARGE_IMAGE && mTexture[LLRender::DIFFUSE_MAP].notNull() && mTexture[LLRender::DIFFUSE_MAP]->isLargeImage())
- {
- face_area *= adjustPartialOverlapPixelArea(cos_angle_to_view_dir, radius );
- }
- }
-
- setVirtualSize(face_area) ;
-
- return face_area;
+ F32 radius;
+ F32 cos_angle_to_view_dir;
+ BOOL in_frustum = calcPixelArea(cos_angle_to_view_dir, radius);
+
+ if (mPixelArea < F_ALMOST_ZERO || !in_frustum)
+ {
+ setVirtualSize(0.f) ;
+ return 0.f;
+ }
+
+ //get area of circle in texture space
+ LLVector2 tdim = mTexExtents[1] - mTexExtents[0];
+ F32 texel_area = (tdim * 0.5f).lengthSquared()*3.14159f;
+ if (texel_area <= 0)
+ {
+ // Probably animated, use default
+ texel_area = 1.f;
+ }
+
+ F32 face_area;
+ if (mVObjp->isSculpted() && texel_area > 1.f)
+ {
+ //sculpts can break assumptions about texel area
+ face_area = mPixelArea;
+ }
+ else
+ {
+ //apply texel area to face area to get accurate ratio
+ //face_area /= llclamp(texel_area, 1.f/64.f, 16.f);
+ face_area = mPixelArea / llclamp(texel_area, 0.015625f, 128.f);
+ }
+
+ face_area = LLFace::adjustPixelArea(mImportanceToCamera, face_area) ;
+ if(face_area > LLViewerTexture::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
+ {
+ if(mImportanceToCamera > LEAST_IMPORTANCE_FOR_LARGE_IMAGE && mTexture[LLRender::DIFFUSE_MAP].notNull() && mTexture[LLRender::DIFFUSE_MAP]->isLargeImage())
+ {
+ face_area *= adjustPartialOverlapPixelArea(cos_angle_to_view_dir, radius );
+ }
+ }
+
+ setVirtualSize(face_area) ;
+
+ return face_area;
}
BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE;
- //VECTORIZE THIS
- //get area of circle around face
+ //VECTORIZE THIS
+ //get area of circle around face
LLVector4a center;
LLVector4a size;
@@ -2127,237 +2127,237 @@ BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
center.load3(getPositionAgent().mV);
size.setSub(mExtents[1], mExtents[0]);
}
- size.mul(0.5f);
-
- LLViewerCamera* camera = LLViewerCamera::getInstance();
-
- F32 size_squared = size.dot3(size).getF32();
- LLVector4a lookAt;
- LLVector4a t;
- t.load3(camera->getOrigin().mV);
- lookAt.setSub(center, t);
-
- F32 dist = lookAt.getLength3().getF32();
- dist = llmax(dist-size.getLength3().getF32(), 0.001f);
- //ramp down distance for nearby objects
- if (dist < 16.f)
- {
- dist /= 16.f;
- dist *= dist;
- dist *= 16.f;
- }
-
- lookAt.normalize3fast() ;
-
- //get area of circle around node
- F32 app_angle = atanf((F32) sqrt(size_squared) / dist);
- radius = app_angle*LLDrawable::sCurPixelAngle;
- mPixelArea = radius*radius * 3.14159f;
- LLVector4a x_axis;
- x_axis.load3(camera->getXAxis().mV);
- cos_angle_to_view_dir = lookAt.dot3(x_axis).getF32();
-
- //if has media, check if the face is out of the view frustum.
- if(hasMedia())
- {
- if(!camera->AABBInFrustum(center, size))
- {
- mImportanceToCamera = 0.f ;
- return false ;
- }
- if(cos_angle_to_view_dir > camera->getCosHalfFov()) //the center is within the view frustum
- {
- cos_angle_to_view_dir = 1.0f ;
- }
- else
- {
- LLVector4a d;
- d.setSub(lookAt, x_axis);
-
- if(dist * dist * d.dot3(d) < size_squared)
- {
- cos_angle_to_view_dir = 1.0f ;
- }
- }
- }
-
- if(dist < mBoundingSphereRadius) //camera is very close
- {
- cos_angle_to_view_dir = 1.0f ;
- mImportanceToCamera = 1.0f ;
- }
- else
- {
- mImportanceToCamera = LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist) ;
- }
-
- return true ;
+ size.mul(0.5f);
+
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+
+ F32 size_squared = size.dot3(size).getF32();
+ LLVector4a lookAt;
+ LLVector4a t;
+ t.load3(camera->getOrigin().mV);
+ lookAt.setSub(center, t);
+
+ F32 dist = lookAt.getLength3().getF32();
+ dist = llmax(dist-size.getLength3().getF32(), 0.001f);
+ //ramp down distance for nearby objects
+ if (dist < 16.f)
+ {
+ dist /= 16.f;
+ dist *= dist;
+ dist *= 16.f;
+ }
+
+ lookAt.normalize3fast() ;
+
+ //get area of circle around node
+ F32 app_angle = atanf((F32) sqrt(size_squared) / dist);
+ radius = app_angle*LLDrawable::sCurPixelAngle;
+ mPixelArea = radius*radius * 3.14159f;
+ LLVector4a x_axis;
+ x_axis.load3(camera->getXAxis().mV);
+ cos_angle_to_view_dir = lookAt.dot3(x_axis).getF32();
+
+ //if has media, check if the face is out of the view frustum.
+ if(hasMedia())
+ {
+ if(!camera->AABBInFrustum(center, size))
+ {
+ mImportanceToCamera = 0.f ;
+ return false ;
+ }
+ if(cos_angle_to_view_dir > camera->getCosHalfFov()) //the center is within the view frustum
+ {
+ cos_angle_to_view_dir = 1.0f ;
+ }
+ else
+ {
+ LLVector4a d;
+ d.setSub(lookAt, x_axis);
+
+ if(dist * dist * d.dot3(d) < size_squared)
+ {
+ cos_angle_to_view_dir = 1.0f ;
+ }
+ }
+ }
+
+ if(dist < mBoundingSphereRadius) //camera is very close
+ {
+ cos_angle_to_view_dir = 1.0f ;
+ mImportanceToCamera = 1.0f ;
+ }
+ else
+ {
+ mImportanceToCamera = LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist) ;
+ }
+
+ return true ;
}
//the projection of the face partially overlaps with the screen
F32 LLFace::adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius )
{
- F32 screen_radius = (F32)llmax(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()) ;
- F32 center_angle = acosf(cos_angle_to_view_dir) ;
- F32 d = center_angle * LLDrawable::sCurPixelAngle ;
-
- if(d + radius > screen_radius + 5.f)
- {
- //----------------------------------------------
- //calculate the intersection area of two circles
- //F32 radius_square = radius * radius ;
- //F32 d_square = d * d ;
- //F32 screen_radius_square = screen_radius * screen_radius ;
- //face_area =
- // radius_square * acosf((d_square + radius_square - screen_radius_square)/(2 * d * radius)) +
- // screen_radius_square * acosf((d_square + screen_radius_square - radius_square)/(2 * d * screen_radius)) -
- // 0.5f * sqrtf((-d + radius + screen_radius) * (d + radius - screen_radius) * (d - radius + screen_radius) * (d + radius + screen_radius)) ;
- //----------------------------------------------
-
- //the above calculation is too expensive
- //the below is a good estimation: bounding box of the bounding sphere:
- F32 alpha = 0.5f * (radius + screen_radius - d) / radius ;
- alpha = llclamp(alpha, 0.f, 1.f) ;
- return alpha * alpha ;
- }
- return 1.0f ;
+ F32 screen_radius = (F32)llmax(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()) ;
+ F32 center_angle = acosf(cos_angle_to_view_dir) ;
+ F32 d = center_angle * LLDrawable::sCurPixelAngle ;
+
+ if(d + radius > screen_radius + 5.f)
+ {
+ //----------------------------------------------
+ //calculate the intersection area of two circles
+ //F32 radius_square = radius * radius ;
+ //F32 d_square = d * d ;
+ //F32 screen_radius_square = screen_radius * screen_radius ;
+ //face_area =
+ // radius_square * acosf((d_square + radius_square - screen_radius_square)/(2 * d * radius)) +
+ // screen_radius_square * acosf((d_square + screen_radius_square - radius_square)/(2 * d * screen_radius)) -
+ // 0.5f * sqrtf((-d + radius + screen_radius) * (d + radius - screen_radius) * (d - radius + screen_radius) * (d + radius + screen_radius)) ;
+ //----------------------------------------------
+
+ //the above calculation is too expensive
+ //the below is a good estimation: bounding box of the bounding sphere:
+ F32 alpha = 0.5f * (radius + screen_radius - d) / radius ;
+ alpha = llclamp(alpha, 0.f, 1.f) ;
+ return alpha * alpha ;
+ }
+ return 1.0f ;
}
const S8 FACE_IMPORTANCE_LEVEL = 4 ;
const F32 FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[FACE_IMPORTANCE_LEVEL][2] = //{distance, importance_weight}
- {{16.1f, 1.0f}, {32.1f, 0.5f}, {48.1f, 0.2f}, {96.1f, 0.05f} } ;
+ {{16.1f, 1.0f}, {32.1f, 0.5f}, {48.1f, 0.2f}, {96.1f, 0.05f} } ;
const F32 FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[FACE_IMPORTANCE_LEVEL][2] = //{cos(angle), importance_weight}
- {{0.985f /*cos(10 degrees)*/, 1.0f}, {0.94f /*cos(20 degrees)*/, 0.8f}, {0.866f /*cos(30 degrees)*/, 0.64f}, {0.0f, 0.36f}} ;
+ {{0.985f /*cos(10 degrees)*/, 1.0f}, {0.94f /*cos(20 degrees)*/, 0.8f}, {0.866f /*cos(30 degrees)*/, 0.64f}, {0.0f, 0.36f}} ;
-//static
+//static
F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist)
{
- F32 importance = 0.f ;
-
- if(cos_angle_to_view_dir > LLViewerCamera::getInstance()->getCosHalfFov() &&
- dist < FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[FACE_IMPORTANCE_LEVEL - 1][0])
- {
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- F32 camera_moving_speed = camera->getAverageSpeed() ;
- F32 camera_angular_speed = camera->getAverageAngularSpeed();
-
- if(camera_moving_speed > 10.0f || camera_angular_speed > 1.0f)
- {
- //if camera moves or rotates too fast, ignore the importance factor
- return 0.f ;
- }
-
- S32 i = 0 ;
- for(i = 0; i < FACE_IMPORTANCE_LEVEL && dist > FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][0]; ++i);
- i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ;
- F32 dist_factor = FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][1] ;
-
- for(i = 0; i < FACE_IMPORTANCE_LEVEL && cos_angle_to_view_dir < FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[i][0] ; ++i) ;
- i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ;
- importance = dist_factor * FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[i][1] ;
- }
-
- return importance ;
+ F32 importance = 0.f ;
+
+ if(cos_angle_to_view_dir > LLViewerCamera::getInstance()->getCosHalfFov() &&
+ dist < FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[FACE_IMPORTANCE_LEVEL - 1][0])
+ {
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ F32 camera_moving_speed = camera->getAverageSpeed() ;
+ F32 camera_angular_speed = camera->getAverageAngularSpeed();
+
+ if(camera_moving_speed > 10.0f || camera_angular_speed > 1.0f)
+ {
+ //if camera moves or rotates too fast, ignore the importance factor
+ return 0.f ;
+ }
+
+ S32 i = 0 ;
+ for(i = 0; i < FACE_IMPORTANCE_LEVEL && dist > FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][0]; ++i);
+ i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ;
+ F32 dist_factor = FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][1] ;
+
+ for(i = 0; i < FACE_IMPORTANCE_LEVEL && cos_angle_to_view_dir < FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[i][0] ; ++i) ;
+ i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ;
+ importance = dist_factor * FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[i][1] ;
+ }
+
+ return importance ;
}
-//static
+//static
F32 LLFace::adjustPixelArea(F32 importance, F32 pixel_area)
{
- if(pixel_area > LLViewerTexture::sMaxSmallImageSize)
- {
- if(importance < LEAST_IMPORTANCE) //if the face is not important, do not load hi-res.
- {
- static const F32 MAX_LEAST_IMPORTANCE_IMAGE_SIZE = 128.0f * 128.0f ;
- pixel_area = llmin(pixel_area * 0.5f, MAX_LEAST_IMPORTANCE_IMAGE_SIZE) ;
- }
- else if(pixel_area > LLViewerTexture::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
- {
- if(importance < LEAST_IMPORTANCE_FOR_LARGE_IMAGE)//if the face is not important, do not load hi-res.
- {
- pixel_area = LLViewerTexture::sMinLargeImageSize ;
- }
- }
- }
-
- return pixel_area ;
+ if(pixel_area > LLViewerTexture::sMaxSmallImageSize)
+ {
+ if(importance < LEAST_IMPORTANCE) //if the face is not important, do not load hi-res.
+ {
+ static const F32 MAX_LEAST_IMPORTANCE_IMAGE_SIZE = 128.0f * 128.0f ;
+ pixel_area = llmin(pixel_area * 0.5f, MAX_LEAST_IMPORTANCE_IMAGE_SIZE) ;
+ }
+ else if(pixel_area > LLViewerTexture::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
+ {
+ if(importance < LEAST_IMPORTANCE_FOR_LARGE_IMAGE)//if the face is not important, do not load hi-res.
+ {
+ pixel_area = LLViewerTexture::sMinLargeImageSize ;
+ }
+ }
+ }
+
+ return pixel_area ;
}
BOOL LLFace::verify(const U32* indices_array) const
{
- BOOL ok = TRUE;
-
- if( mVertexBuffer.isNull() )
- { //no vertex buffer, face is implicitly valid
- return TRUE;
- }
-
- // First, check whether the face data fits within the pool's range.
- if ((mGeomIndex + mGeomCount) > mVertexBuffer->getNumVerts())
- {
- ok = FALSE;
- LL_INFOS() << "Face references invalid vertices!" << LL_ENDL;
- }
-
- S32 indices_count = (S32)getIndicesCount();
-
- if (!indices_count)
- {
- return TRUE;
- }
-
- if (indices_count > LL_MAX_INDICES_COUNT)
- {
- ok = FALSE;
- LL_INFOS() << "Face has bogus indices count" << LL_ENDL;
- }
-
- if (mIndicesIndex + mIndicesCount > mVertexBuffer->getNumIndices())
- {
- ok = FALSE;
- LL_INFOS() << "Face references invalid indices!" << LL_ENDL;
- }
+ BOOL ok = TRUE;
+
+ if( mVertexBuffer.isNull() )
+ { //no vertex buffer, face is implicitly valid
+ return TRUE;
+ }
+
+ // First, check whether the face data fits within the pool's range.
+ if ((mGeomIndex + mGeomCount) > mVertexBuffer->getNumVerts())
+ {
+ ok = FALSE;
+ LL_INFOS() << "Face references invalid vertices!" << LL_ENDL;
+ }
+
+ S32 indices_count = (S32)getIndicesCount();
+
+ if (!indices_count)
+ {
+ return TRUE;
+ }
+
+ if (indices_count > LL_MAX_INDICES_COUNT)
+ {
+ ok = FALSE;
+ LL_INFOS() << "Face has bogus indices count" << LL_ENDL;
+ }
+
+ if (mIndicesIndex + mIndicesCount > mVertexBuffer->getNumIndices())
+ {
+ ok = FALSE;
+ LL_INFOS() << "Face references invalid indices!" << LL_ENDL;
+ }
#if 0
- S32 geom_start = getGeomStart();
- S32 geom_count = mGeomCount;
-
- const U32 *indicesp = indices_array ? indices_array + mIndicesIndex : getRawIndices();
-
- for (S32 i = 0; i < indices_count; i++)
- {
- S32 delta = indicesp[i] - geom_start;
- if (0 > delta)
- {
- LL_WARNS() << "Face index too low!" << LL_ENDL;
- LL_INFOS() << "i:" << i << " Index:" << indicesp[i] << " GStart: " << geom_start << LL_ENDL;
- ok = FALSE;
- }
- else if (delta >= geom_count)
- {
- LL_WARNS() << "Face index too high!" << LL_ENDL;
- LL_INFOS() << "i:" << i << " Index:" << indicesp[i] << " GEnd: " << geom_start + geom_count << LL_ENDL;
- ok = FALSE;
- }
- }
+ S32 geom_start = getGeomStart();
+ S32 geom_count = mGeomCount;
+
+ const U32 *indicesp = indices_array ? indices_array + mIndicesIndex : getRawIndices();
+
+ for (S32 i = 0; i < indices_count; i++)
+ {
+ S32 delta = indicesp[i] - geom_start;
+ if (0 > delta)
+ {
+ LL_WARNS() << "Face index too low!" << LL_ENDL;
+ LL_INFOS() << "i:" << i << " Index:" << indicesp[i] << " GStart: " << geom_start << LL_ENDL;
+ ok = FALSE;
+ }
+ else if (delta >= geom_count)
+ {
+ LL_WARNS() << "Face index too high!" << LL_ENDL;
+ LL_INFOS() << "i:" << i << " Index:" << indicesp[i] << " GEnd: " << geom_start + geom_count << LL_ENDL;
+ ok = FALSE;
+ }
+ }
#endif
- if (!ok)
- {
- printDebugInfo();
- }
- return ok;
+ if (!ok)
+ {
+ printDebugInfo();
+ }
+ return ok;
}
void LLFace::setViewerObject(LLViewerObject* objp)
{
- mVObjp = objp;
+ mVObjp = objp;
}
const LLMatrix4& LLFace::getRenderMatrix() const
{
- return mDrawablep->getRenderMatrix();
+ return mDrawablep->getRenderMatrix();
}
//============================================================================
@@ -2365,78 +2365,78 @@ const LLMatrix4& LLFace::getRenderMatrix() const
S32 LLFace::getColors(LLStrider<LLColor4U> &colors)
{
- if (!mGeomCount)
- {
- return -1;
- }
-
- // llassert(mGeomIndex >= 0);
- mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount);
- return mGeomIndex;
+ if (!mGeomCount)
+ {
+ return -1;
+ }
+
+ // llassert(mGeomIndex >= 0);
+ mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount);
+ return mGeomIndex;
}
-S32 LLFace::getIndices(LLStrider<U16> &indicesp)
+S32 LLFace::getIndices(LLStrider<U16> &indicesp)
{
- mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount);
- llassert(indicesp[0] != indicesp[1]);
- return mIndicesIndex;
+ mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount);
+ llassert(indicesp[0] != indicesp[1]);
+ return mIndicesIndex;
}
LLVector3 LLFace::getPositionAgent() const
{
- if (mDrawablep->isStatic())
- {
- return mCenterAgent;
- }
- else
- {
- return mCenterLocal * getRenderMatrix();
- }
+ if (mDrawablep->isStatic())
+ {
+ return mCenterAgent;
+ }
+ else
+ {
+ return mCenterLocal * getRenderMatrix();
+ }
}
LLViewerTexture* LLFace::getTexture(U32 ch) const
{
- llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
- return mTexture[ch] ;
+ return mTexture[ch] ;
}
void LLFace::setVertexBuffer(LLVertexBuffer* buffer)
{
- if (buffer)
- {
- LLSculptIDSize::instance().inc(mDrawablep, buffer->getSize() + buffer->getIndicesSize());
- }
-
- if (mVertexBuffer)
- {
- LLSculptIDSize::instance().dec(mDrawablep);
- }
-
- mVertexBuffer = buffer;
- llassert(verify());
+ if (buffer)
+ {
+ LLSculptIDSize::instance().inc(mDrawablep, buffer->getSize() + buffer->getIndicesSize());
+ }
+
+ if (mVertexBuffer)
+ {
+ LLSculptIDSize::instance().dec(mDrawablep);
+ }
+
+ mVertexBuffer = buffer;
+ llassert(verify());
}
void LLFace::clearVertexBuffer()
{
- if (mVertexBuffer)
- {
- LLSculptIDSize::instance().dec(mDrawablep);
- }
+ if (mVertexBuffer)
+ {
+ LLSculptIDSize::instance().dec(mDrawablep);
+ }
- mVertexBuffer = NULL;
+ mVertexBuffer = NULL;
}
S32 LLFace::getRiggedIndex(U32 type) const
{
- if (mRiggedIndex.empty())
- {
- return -1;
- }
+ if (mRiggedIndex.empty())
+ {
+ return -1;
+ }
- llassert(type < mRiggedIndex.size());
+ llassert(type < mRiggedIndex.size());
- return mRiggedIndex[type];
+ return mRiggedIndex[type];
}
U64 LLFace::getSkinHash()
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index eb3b47d6d6..6ee636a6c5 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llface.h
* @brief LLFace class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -58,104 +58,104 @@ class alignas(16) LLFace
{
LL_ALIGN_NEW
public:
- LLFace(const LLFace& rhs)
- {
- *this = rhs;
- }
-
- const LLFace& operator=(const LLFace& rhs)
- {
- LL_ERRS() << "Illegal operation!" << LL_ENDL;
- return *this;
- }
-
- enum EMasks
- {
- LIGHT = 0x0001,
- GLOBAL = 0x0002,
- FULLBRIGHT = 0x0004,
- HUD_RENDER = 0x0008,
- USE_FACE_COLOR = 0x0010,
- TEXTURE_ANIM = 0x0020,
- RIGGED = 0x0040,
- PARTICLE = 0x0080,
- };
+ LLFace(const LLFace& rhs)
+ {
+ *this = rhs;
+ }
+
+ const LLFace& operator=(const LLFace& rhs)
+ {
+ LL_ERRS() << "Illegal operation!" << LL_ENDL;
+ return *this;
+ }
+
+ enum EMasks
+ {
+ LIGHT = 0x0001,
+ GLOBAL = 0x0002,
+ FULLBRIGHT = 0x0004,
+ HUD_RENDER = 0x0008,
+ USE_FACE_COLOR = 0x0010,
+ TEXTURE_ANIM = 0x0020,
+ RIGGED = 0x0040,
+ PARTICLE = 0x0080,
+ };
public:
- LLFace(LLDrawable* drawablep, LLViewerObject* objp)
- {
+ LLFace(LLDrawable* drawablep, LLViewerObject* objp)
+ {
LL_PROFILE_ZONE_SCOPED;
- init(drawablep, objp);
- }
- ~LLFace() { destroy(); }
-
- const LLMatrix4& getWorldMatrix() const { return mVObjp->getWorldMatrix(mXform); }
- const LLMatrix4& getRenderMatrix() const;
- U32 getIndicesCount() const { return mIndicesCount; };
- S32 getIndicesStart() const { return mIndicesIndex; };
- U16 getGeomCount() const { return mGeomCount; } // vertex count for this face
- U16 getGeomIndex() const { return mGeomIndex; } // index into draw pool
- U16 getGeomStart() const { return mGeomIndex; } // index into draw pool
- void setTextureIndex(U8 index);
- U8 getTextureIndex() const { return mTextureIndex; }
- void setTexture(U32 ch, LLViewerTexture* tex);
- void setTexture(LLViewerTexture* tex) ;
- void setDiffuseMap(LLViewerTexture* tex);
- void setNormalMap(LLViewerTexture* tex);
- void setSpecularMap(LLViewerTexture* tex);
- void setAlternateDiffuseMap(LLViewerTexture* tex);
- void switchTexture(U32 ch, LLViewerTexture* new_texture);
- void dirtyTexture();
- LLXformMatrix* getXform() const { return mXform; }
- BOOL hasGeometry() const { return mGeomCount > 0; }
- LLVector3 getPositionAgent() const;
- LLVector2 surfaceToTexture(LLVector2 surface_coord, const LLVector4a& position, const LLVector4a& normal);
- void getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_pos, F32* scale) const;
- bool calcAlignedPlanarTE(const LLFace* align_to, LLVector2* st_offset,
- LLVector2* st_scale, F32* st_rot, LLRender::eTexIndex map = LLRender::DIFFUSE_MAP) const;
-
- U32 getState() const { return mState; }
- void setState(U32 state) { mState |= state; }
- void clearState(U32 state) { mState &= ~state; }
- BOOL isState(U32 state) const { return ((mState & state) != 0) ? TRUE : FALSE; }
- void setVirtualSize(F32 size) { mVSize = size; }
- void setPixelArea(F32 area) { mPixelArea = area; }
- F32 getVirtualSize() const { return mVSize; }
- F32 getPixelArea() const { return mPixelArea; }
-
- S32 getIndexInTex(U32 ch) const {llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); return mIndexInTex[ch];}
- void setIndexInTex(U32 ch, S32 index) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); mIndexInTex[ch] = index ;}
-
- void setWorldMatrix(const LLMatrix4& mat);
- const LLTextureEntry* getTextureEntry() const { return mVObjp->getTE(mTEOffset); }
-
- LLFacePool* getPool() const { return mDrawPoolp; }
- U32 getPoolType() const { return mPoolType; }
- LLDrawable* getDrawable() const { return mDrawablep; }
- LLViewerObject* getViewerObject() const { return mVObjp; }
- S32 getLOD() const { return mVObjp.notNull() ? mVObjp->getLOD() : 0; }
- void setPoolType(U32 type) { mPoolType = type; }
- S32 getTEOffset() const { return mTEOffset; }
- LLViewerTexture* getTexture(U32 ch = LLRender::DIFFUSE_MAP) const;
-
- void setViewerObject(LLViewerObject* object);
- void setPool(LLFacePool *pool, LLViewerTexture *texturep);
- void setPool(LLFacePool* pool);
-
- void setDrawable(LLDrawable *drawable);
- void setTEOffset(const S32 te_offset);
-
+ init(drawablep, objp);
+ }
+ ~LLFace() { destroy(); }
+
+ const LLMatrix4& getWorldMatrix() const { return mVObjp->getWorldMatrix(mXform); }
+ const LLMatrix4& getRenderMatrix() const;
+ U32 getIndicesCount() const { return mIndicesCount; };
+ S32 getIndicesStart() const { return mIndicesIndex; };
+ U16 getGeomCount() const { return mGeomCount; } // vertex count for this face
+ U16 getGeomIndex() const { return mGeomIndex; } // index into draw pool
+ U16 getGeomStart() const { return mGeomIndex; } // index into draw pool
+ void setTextureIndex(U8 index);
+ U8 getTextureIndex() const { return mTextureIndex; }
+ void setTexture(U32 ch, LLViewerTexture* tex);
+ void setTexture(LLViewerTexture* tex) ;
+ void setDiffuseMap(LLViewerTexture* tex);
+ void setNormalMap(LLViewerTexture* tex);
+ void setSpecularMap(LLViewerTexture* tex);
+ void setAlternateDiffuseMap(LLViewerTexture* tex);
+ void switchTexture(U32 ch, LLViewerTexture* new_texture);
+ void dirtyTexture();
+ LLXformMatrix* getXform() const { return mXform; }
+ BOOL hasGeometry() const { return mGeomCount > 0; }
+ LLVector3 getPositionAgent() const;
+ LLVector2 surfaceToTexture(LLVector2 surface_coord, const LLVector4a& position, const LLVector4a& normal);
+ void getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_pos, F32* scale) const;
+ bool calcAlignedPlanarTE(const LLFace* align_to, LLVector2* st_offset,
+ LLVector2* st_scale, F32* st_rot, LLRender::eTexIndex map = LLRender::DIFFUSE_MAP) const;
+
+ U32 getState() const { return mState; }
+ void setState(U32 state) { mState |= state; }
+ void clearState(U32 state) { mState &= ~state; }
+ BOOL isState(U32 state) const { return ((mState & state) != 0) ? TRUE : FALSE; }
+ void setVirtualSize(F32 size) { mVSize = size; }
+ void setPixelArea(F32 area) { mPixelArea = area; }
+ F32 getVirtualSize() const { return mVSize; }
+ F32 getPixelArea() const { return mPixelArea; }
+
+ S32 getIndexInTex(U32 ch) const {llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); return mIndexInTex[ch];}
+ void setIndexInTex(U32 ch, S32 index) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); mIndexInTex[ch] = index ;}
+
+ void setWorldMatrix(const LLMatrix4& mat);
+ const LLTextureEntry* getTextureEntry() const { return mVObjp->getTE(mTEOffset); }
+
+ LLFacePool* getPool() const { return mDrawPoolp; }
+ U32 getPoolType() const { return mPoolType; }
+ LLDrawable* getDrawable() const { return mDrawablep; }
+ LLViewerObject* getViewerObject() const { return mVObjp; }
+ S32 getLOD() const { return mVObjp.notNull() ? mVObjp->getLOD() : 0; }
+ void setPoolType(U32 type) { mPoolType = type; }
+ S32 getTEOffset() const { return mTEOffset; }
+ LLViewerTexture* getTexture(U32 ch = LLRender::DIFFUSE_MAP) const;
+
+ void setViewerObject(LLViewerObject* object);
+ void setPool(LLFacePool *pool, LLViewerTexture *texturep);
+ void setPool(LLFacePool* pool);
+
+ void setDrawable(LLDrawable *drawable);
+ void setTEOffset(const S32 te_offset);
+
void renderIndexed();
- void setFaceColor(const LLColor4& color); // override material color
- void unsetFaceColor(); // switch back to material color
- const LLColor4& getFaceColor() const { return mFaceColor; }
-
+ void setFaceColor(const LLColor4& color); // override material color
+ void unsetFaceColor(); // switch back to material color
+ const LLColor4& getFaceColor() const { return mFaceColor; }
+
- //for volumes
- void updateRebuildFlags();
- bool canRenderAsMask(); // logic helper
- BOOL getGeometryVolume(const LLVolume& volume,
+ //for volumes
+ void updateRebuildFlags();
+ bool canRenderAsMask(); // logic helper
+ BOOL getGeometryVolume(const LLVolume& volume,
S32 face_index,
const LLMatrix4& mat_vert,
const LLMatrix3& mat_normal,
@@ -163,70 +163,70 @@ public:
bool force_rebuild = false,
bool no_debug_assert = false);
- // For avatar
- U16 getGeometryAvatar(
- LLStrider<LLVector3> &vertices,
- LLStrider<LLVector3> &normals,
- LLStrider<LLVector2> &texCoords,
- LLStrider<F32> &vertex_weights,
- LLStrider<LLVector4> &clothing_weights);
+ // For avatar
+ U16 getGeometryAvatar(
+ LLStrider<LLVector3> &vertices,
+ LLStrider<LLVector3> &normals,
+ LLStrider<LLVector2> &texCoords,
+ LLStrider<F32> &vertex_weights,
+ LLStrider<LLVector4> &clothing_weights);
- // For volumes, etc.
- U16 getGeometry(LLStrider<LLVector3> &vertices,
- LLStrider<LLVector3> &normals,
- LLStrider<LLVector2> &texCoords,
- LLStrider<U16> &indices);
+ // For volumes, etc.
+ U16 getGeometry(LLStrider<LLVector3> &vertices,
+ LLStrider<LLVector3> &normals,
+ LLStrider<LLVector2> &texCoords,
+ LLStrider<U16> &indices);
- S32 getColors(LLStrider<LLColor4U> &colors);
- S32 getIndices(LLStrider<U16> &indices);
+ S32 getColors(LLStrider<LLColor4U> &colors);
+ S32 getIndices(LLStrider<U16> &indices);
- void setSize(S32 numVertices, S32 num_indices = 0, bool align = false);
-
- BOOL genVolumeBBoxes(const LLVolume &volume, S32 f,
- const LLMatrix4& mat_vert_in, BOOL global_volume = FALSE);
-
- void init(LLDrawable* drawablep, LLViewerObject* objp);
- void destroy();
- void update();
+ void setSize(S32 numVertices, S32 num_indices = 0, bool align = false);
- void updateCenterAgent(); // Update center when xform has changed.
- void renderSelectedUV();
+ BOOL genVolumeBBoxes(const LLVolume &volume, S32 f,
+ const LLMatrix4& mat_vert_in, BOOL global_volume = FALSE);
- void renderSelected(LLViewerTexture *image, const LLColor4 &color);
- void renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wireframe_selection, bool bRenderHiddenSelections, bool shader);
+ void init(LLDrawable* drawablep, LLViewerObject* objp);
+ void destroy();
+ void update();
- F32 getKey() const { return mDistance; }
+ void updateCenterAgent(); // Update center when xform has changed.
+ void renderSelectedUV();
- S32 getReferenceIndex() const { return mReferenceIndex; }
- void setReferenceIndex(const S32 index) { mReferenceIndex = index; }
+ void renderSelected(LLViewerTexture *image, const LLColor4 &color);
+ void renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wireframe_selection, bool bRenderHiddenSelections, bool shader);
- BOOL verify(const U32* indices_array = NULL) const;
- void printDebugInfo() const;
+ F32 getKey() const { return mDistance; }
- void setGeomIndex(U16 idx);
- void setIndicesIndex(S32 idx);
- void setDrawInfo(LLDrawInfo* draw_info);
+ S32 getReferenceIndex() const { return mReferenceIndex; }
+ void setReferenceIndex(const S32 index) { mReferenceIndex = index; }
- F32 getTextureVirtualSize() ;
- F32 getImportanceToCamera()const {return mImportanceToCamera ;}
- void resetVirtualSize();
+ BOOL verify(const U32* indices_array = NULL) const;
+ void printDebugInfo() const;
- void setHasMedia(bool has_media) { mHasMedia = has_media ;}
- BOOL hasMedia() const ;
+ void setGeomIndex(U16 idx);
+ void setIndicesIndex(S32 idx);
+ void setDrawInfo(LLDrawInfo* draw_info);
+
+ F32 getTextureVirtualSize() ;
+ F32 getImportanceToCamera()const {return mImportanceToCamera ;}
+ void resetVirtualSize();
+
+ void setHasMedia(bool has_media) { mHasMedia = has_media ;}
+ BOOL hasMedia() const ;
void setMediaAllowed(bool is_media_allowed) { mIsMediaAllowed = is_media_allowed; }
BOOL isMediaAllowed() const { return mIsMediaAllowed; }
- BOOL switchTexture() ;
+ BOOL switchTexture() ;
- //vertex buffer tracking
- void setVertexBuffer(LLVertexBuffer* buffer);
- void clearVertexBuffer(); //sets mVertexBuffer to NULL
- LLVertexBuffer* getVertexBuffer() const { return mVertexBuffer; }
- S32 getRiggedIndex(U32 type) const;
+ //vertex buffer tracking
+ void setVertexBuffer(LLVertexBuffer* buffer);
+ void clearVertexBuffer(); //sets mVertexBuffer to NULL
+ LLVertexBuffer* getVertexBuffer() const { return mVertexBuffer; }
+ S32 getRiggedIndex(U32 type) const;
- // used to preserve draw order of faces that are batched together.
- // Allows content creators to manipulate linked sets and face ordering
+ // used to preserve draw order of faces that are batched together.
+ // Allows content creators to manipulate linked sets and face ordering
// for consistent alpha sorting results, particularly for rigged attachments
void setDrawOrderIndex(U32 index) { mDrawOrderIndex = index; }
U32 getDrawOrderIndex() const { return mDrawOrderIndex; }
@@ -234,147 +234,147 @@ public:
// return true if this face is in an alpha draw pool
bool isInAlphaPool() const;
public: //aligned members
- LLVector4a mExtents[2];
+ LLVector4a mExtents[2];
private:
friend class LLViewerTextureList;
- F32 adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius );
- BOOL calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) ;
+ F32 adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius );
+ BOOL calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) ;
public:
- static F32 calcImportanceToCamera(F32 to_view_dir, F32 dist);
- static F32 adjustPixelArea(F32 importance, F32 pixel_area) ;
+ static F32 calcImportanceToCamera(F32 to_view_dir, F32 dist);
+ static F32 adjustPixelArea(F32 importance, F32 pixel_area) ;
public:
-
- LLVector3 mCenterLocal;
- LLVector3 mCenterAgent;
-
- LLVector2 mTexExtents[2];
- F32 mDistance;
- F32 mLastUpdateTime;
- F32 mLastSkinTime;
- F32 mLastMoveTime;
- LLMatrix4* mTextureMatrix;
- LLMatrix4* mSpecMapMatrix;
- LLMatrix4* mNormalMapMatrix;
- LLDrawInfo* mDrawInfo;
+
+ LLVector3 mCenterLocal;
+ LLVector3 mCenterAgent;
+
+ LLVector2 mTexExtents[2];
+ F32 mDistance;
+ F32 mLastUpdateTime;
+ F32 mLastSkinTime;
+ F32 mLastMoveTime;
+ LLMatrix4* mTextureMatrix;
+ LLMatrix4* mSpecMapMatrix;
+ LLMatrix4* mNormalMapMatrix;
+ LLDrawInfo* mDrawInfo;
LLVOAvatar* mAvatar = nullptr;
LLMeshSkinInfo* mSkinInfo = nullptr;
-
+
// return mSkinInfo->mHash or 0 if mSkinInfo is null
U64 getSkinHash();
private:
- LLPointer<LLVertexBuffer> mVertexBuffer;
-
- U32 mState;
- LLFacePool* mDrawPoolp;
- U32 mPoolType;
- LLColor4 mFaceColor; // overrides material color if state |= USE_FACE_COLOR
-
- U16 mGeomCount; // vertex count for this face
- U16 mGeomIndex; // starting index into mVertexBuffer's vertex array
- U8 mTextureIndex; // index of texture channel to use for pseudo-atlasing
- U32 mIndicesCount;
- U32 mIndicesIndex; // index into mVertexBuffer's index array
- S32 mIndexInTex[LLRender::NUM_TEXTURE_CHANNELS];
-
- LLXformMatrix* mXform;
-
- LLPointer<LLViewerTexture> mTexture[LLRender::NUM_TEXTURE_CHANNELS];
-
- // mDrawablep is not supposed to be null, don't use LLPointer because
- // mDrawablep owns LLFace and LLPointer is a good way to either cause a
- // memory leak or a 'delete each other' situation if something deletes
- // drawable wrongly.
- LLDrawable* mDrawablep;
- // LLViewerObject technically owns drawable, but also it should be strictly managed
- LLPointer<LLViewerObject> mVObjp;
- S32 mTEOffset;
-
- S32 mReferenceIndex;
- std::vector<S32> mRiggedIndex;
-
- F32 mVSize;
- F32 mPixelArea;
-
- //importance factor, in the range [0, 1.0].
- //1.0: the most important.
- //based on the distance from the face to the view point and the angle from the face center to the view direction.
- F32 mImportanceToCamera ;
- F32 mBoundingSphereRadius ;
- bool mHasMedia ;
- bool mIsMediaAllowed;
+ LLPointer<LLVertexBuffer> mVertexBuffer;
+
+ U32 mState;
+ LLFacePool* mDrawPoolp;
+ U32 mPoolType;
+ LLColor4 mFaceColor; // overrides material color if state |= USE_FACE_COLOR
+
+ U16 mGeomCount; // vertex count for this face
+ U16 mGeomIndex; // starting index into mVertexBuffer's vertex array
+ U8 mTextureIndex; // index of texture channel to use for pseudo-atlasing
+ U32 mIndicesCount;
+ U32 mIndicesIndex; // index into mVertexBuffer's index array
+ S32 mIndexInTex[LLRender::NUM_TEXTURE_CHANNELS];
+
+ LLXformMatrix* mXform;
+
+ LLPointer<LLViewerTexture> mTexture[LLRender::NUM_TEXTURE_CHANNELS];
+
+ // mDrawablep is not supposed to be null, don't use LLPointer because
+ // mDrawablep owns LLFace and LLPointer is a good way to either cause a
+ // memory leak or a 'delete each other' situation if something deletes
+ // drawable wrongly.
+ LLDrawable* mDrawablep;
+ // LLViewerObject technically owns drawable, but also it should be strictly managed
+ LLPointer<LLViewerObject> mVObjp;
+ S32 mTEOffset;
+
+ S32 mReferenceIndex;
+ std::vector<S32> mRiggedIndex;
+
+ F32 mVSize;
+ F32 mPixelArea;
+
+ //importance factor, in the range [0, 1.0].
+ //1.0: the most important.
+ //based on the distance from the face to the view point and the angle from the face center to the view direction.
+ F32 mImportanceToCamera ;
+ F32 mBoundingSphereRadius ;
+ bool mHasMedia ;
+ bool mIsMediaAllowed;
U32 mDrawOrderIndex = 0; // see setDrawOrderIndex
-
+
protected:
- static BOOL sSafeRenderSelect;
-
+ static BOOL sSafeRenderSelect;
+
public:
- struct CompareDistanceGreater
- {
- bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
- {
- return !lhs || (rhs && (lhs->mDistance > rhs->mDistance)); // farthest = first
- }
- };
-
- struct CompareTexture
- {
- bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
- {
- return lhs->getTexture() < rhs->getTexture();
- }
- };
-
- struct CompareBatchBreaker
- {
- bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
- {
- const LLTextureEntry* lte = lhs->getTextureEntry();
- const LLTextureEntry* rte = rhs->getTextureEntry();
-
- if(lhs->getTexture() != rhs->getTexture())
- {
- return lhs->getTexture() < rhs->getTexture();
- }
- else
- {
- return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright();
- }
- }
- };
-
- struct CompareTextureAndGeomCount
- {
- bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
- {
- return lhs->getTexture() == rhs->getTexture() ?
- lhs->getGeomCount() < rhs->getGeomCount() : //smallest = first
- lhs->getTexture() > rhs->getTexture();
- }
- };
-
- struct CompareTextureAndLOD
- {
- bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
- {
- return lhs->getTexture() == rhs->getTexture() ?
- lhs->getLOD() < rhs->getLOD() :
- lhs->getTexture() < rhs->getTexture();
- }
- };
-
- struct CompareTextureAndTime
- {
- bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
- {
- return lhs->getTexture() == rhs->getTexture() ?
- lhs->mLastUpdateTime < rhs->mLastUpdateTime :
- lhs->getTexture() < rhs->getTexture();
- }
- };
+ struct CompareDistanceGreater
+ {
+ bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
+ {
+ return !lhs || (rhs && (lhs->mDistance > rhs->mDistance)); // farthest = first
+ }
+ };
+
+ struct CompareTexture
+ {
+ bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
+ {
+ return lhs->getTexture() < rhs->getTexture();
+ }
+ };
+
+ struct CompareBatchBreaker
+ {
+ bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
+ {
+ const LLTextureEntry* lte = lhs->getTextureEntry();
+ const LLTextureEntry* rte = rhs->getTextureEntry();
+
+ if(lhs->getTexture() != rhs->getTexture())
+ {
+ return lhs->getTexture() < rhs->getTexture();
+ }
+ else
+ {
+ return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright();
+ }
+ }
+ };
+
+ struct CompareTextureAndGeomCount
+ {
+ bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
+ {
+ return lhs->getTexture() == rhs->getTexture() ?
+ lhs->getGeomCount() < rhs->getGeomCount() : //smallest = first
+ lhs->getTexture() > rhs->getTexture();
+ }
+ };
+
+ struct CompareTextureAndLOD
+ {
+ bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
+ {
+ return lhs->getTexture() == rhs->getTexture() ?
+ lhs->getLOD() < rhs->getLOD() :
+ lhs->getTexture() < rhs->getTexture();
+ }
+ };
+
+ struct CompareTextureAndTime
+ {
+ bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
+ {
+ return lhs->getTexture() == rhs->getTexture() ?
+ lhs->mLastUpdateTime < rhs->mLastUpdateTime :
+ lhs->getTexture() < rhs->getTexture();
+ }
+ };
};
#endif // LL_LLFACE_H
diff --git a/indra/newview/llface.inl b/indra/newview/llface.inl
index c37b77d2cd..566917d800 100644
--- a/indra/newview/llface.inl
+++ b/indra/newview/llface.inl
@@ -1,25 +1,25 @@
-/**
+/**
* @file llface.inl
* @brief Inline functions for LLFace
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,130 +31,130 @@
#include "llrender.h"
inline BOOL LLFace::getDirty() const
-{
- return (mGeneration != mDrawPoolp->mGeneration);
+{
+ return (mGeneration != mDrawPoolp->mGeneration);
}
inline void LLFace::clearDirty()
{
- mGeneration = mDrawPoolp->mGeneration;
+ mGeneration = mDrawPoolp->mGeneration;
}
inline const LLTextureEntry* LLFace::getTextureEntry() const
{
- return mVObjp->getTE(mTEOffset);
+ return mVObjp->getTE(mTEOffset);
}
inline LLDrawPool* LLFace::getPool() const
{
- return mDrawPoolp;
+ return mDrawPoolp;
}
inline S32 LLFace::getStride() const
{
- return mDrawPoolp->getStride();
+ return mDrawPoolp->getStride();
}
inline LLDrawable* LLFace::getDrawable() const
{
- return mDrawablep;
+ return mDrawablep;
}
inline LLViewerObject* LLFace::getViewerObject() const
{
- return mVObjp;
+ return mVObjp;
}
-inline S32 LLFace::getColors (LLStrider<LLColor4U> &colors)
+inline S32 LLFace::getColors (LLStrider<LLColor4U> &colors)
{
- if (!mGeomCount)
- {
- return -1;
- }
- LLColor4U *colorp = NULL;
- if (isState(BACKLIST))
- {
- if (!mBackupMem)
- {
- printDebugInfo();
- LL_ERRS() << "No backup memory for face" << LL_ENDL;
- }
- colorp = (LLColor4U*)(mBackupMem + (4 * mIndicesCount) + (mGeomCount * mDrawPoolp->getStride()));
- colors = colorp;
- return 0;
- }
- else
- {
- llassert(mGeomIndex >= 0);
- if (!mDrawPoolp->getColorStrider(colors, mGeomIndex))
- {
- printDebugInfo();
- LL_ERRS() << "No color pointer for a color strider!" << LL_ENDL;
- }
- mDrawPoolp->setDirtyColors();
- return mGeomIndex;
- }
+ if (!mGeomCount)
+ {
+ return -1;
+ }
+ LLColor4U *colorp = NULL;
+ if (isState(BACKLIST))
+ {
+ if (!mBackupMem)
+ {
+ printDebugInfo();
+ LL_ERRS() << "No backup memory for face" << LL_ENDL;
+ }
+ colorp = (LLColor4U*)(mBackupMem + (4 * mIndicesCount) + (mGeomCount * mDrawPoolp->getStride()));
+ colors = colorp;
+ return 0;
+ }
+ else
+ {
+ llassert(mGeomIndex >= 0);
+ if (!mDrawPoolp->getColorStrider(colors, mGeomIndex))
+ {
+ printDebugInfo();
+ LL_ERRS() << "No color pointer for a color strider!" << LL_ENDL;
+ }
+ mDrawPoolp->setDirtyColors();
+ return mGeomIndex;
+ }
}
-inline S32 LLFace::getTexCoords (LLStrider<LLVector2> &texCoords, S32 pass )
+inline S32 LLFace::getTexCoords (LLStrider<LLVector2> &texCoords, S32 pass )
{
- if (!mGeomCount)
- {
- return -1;
- }
- if (isState(BACKLIST))
- {
- if (!mBackupMem)
- {
- printDebugInfo();
- LL_ERRS() << "No backup memory for face" << LL_ENDL;
- }
- texCoords = (LLVector2*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_TEX_COORDS0 + pass]);
- texCoords.setStride( mDrawPoolp->getStride());
- return 0;
- }
- else
- {
- llassert(mGeomIndex >= 0);
- mDrawPoolp->getTexCoordStrider(texCoords, mGeomIndex, pass );
- mDrawPoolp->setDirty();
- return mGeomIndex;
- }
+ if (!mGeomCount)
+ {
+ return -1;
+ }
+ if (isState(BACKLIST))
+ {
+ if (!mBackupMem)
+ {
+ printDebugInfo();
+ LL_ERRS() << "No backup memory for face" << LL_ENDL;
+ }
+ texCoords = (LLVector2*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_TEX_COORDS0 + pass]);
+ texCoords.setStride( mDrawPoolp->getStride());
+ return 0;
+ }
+ else
+ {
+ llassert(mGeomIndex >= 0);
+ mDrawPoolp->getTexCoordStrider(texCoords, mGeomIndex, pass );
+ mDrawPoolp->setDirty();
+ return mGeomIndex;
+ }
}
-inline S32 LLFace::getIndices (U32* &indicesp)
+inline S32 LLFace::getIndices (U32* &indicesp)
{
- if (isState(BACKLIST))
- {
- indicesp = (U32*)mBackupMem;
- return 0;
- }
- else
- {
- indicesp = mDrawPoolp->getIndices(mIndicesIndex);
- llassert(mGeomIndex >= 0);
- return mGeomIndex;
- }
+ if (isState(BACKLIST))
+ {
+ indicesp = (U32*)mBackupMem;
+ return 0;
+ }
+ else
+ {
+ indicesp = mDrawPoolp->getIndices(mIndicesIndex);
+ llassert(mGeomIndex >= 0);
+ return mGeomIndex;
+ }
}
inline const U32* LLFace::getRawIndices() const
{
- llassert(!isState(BACKLIST));
+ llassert(!isState(BACKLIST));
- return &mDrawPoolp->mIndices[mIndicesIndex];
+ return &mDrawPoolp->mIndices[mIndicesIndex];
}
inline void LLFace::bindTexture(S32 stage) const
{
- if (mTexture)
- {
- mTexture->bindTexture(stage);
- }
- else
- {
- LLImageGL::unbindTexture(stage, GL_TEXTURE_2D);
- }
+ if (mTexture)
+ {
+ mTexture->bindTexture(stage);
+ }
+ else
+ {
+ LLImageGL::unbindTexture(stage, GL_TEXTURE_2D);
+ }
}
#endif
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index a7998f6e9e..843bdfa42d 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfasttimerview.cpp
* @brief LLFastTimerView class implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -71,30 +71,30 @@ BOOL LLFastTimerView::sAnalyzePerformance = FALSE;
S32 get_depth(const BlockTimerStatHandle* blockp)
{
- S32 depth = 0;
- BlockTimerStatHandle* timerp = blockp->getParent();
- while(timerp)
- {
- depth++;
- if (timerp->getParent() == timerp) break;
- timerp = timerp->getParent();
- }
- return depth;
+ S32 depth = 0;
+ BlockTimerStatHandle* timerp = blockp->getParent();
+ while(timerp)
+ {
+ depth++;
+ if (timerp->getParent() == timerp) break;
+ timerp = timerp->getParent();
+ }
+ return depth;
}
LLFastTimerView::LLFastTimerView(const LLSD& key)
-: LLFloater(key),
- mHoverTimer(NULL),
- mDisplayMode(0),
- mDisplayType(DISPLAY_TIME),
- mScrollIndex(0),
- mHoverID(NULL),
- mHoverBarIndex(-1),
- mStatsIndex(-1),
- mPauseHistory(false),
- mRecording(NUM_FRAMES_HISTORY)
+: LLFloater(key),
+ mHoverTimer(NULL),
+ mDisplayMode(0),
+ mDisplayType(DISPLAY_TIME),
+ mScrollIndex(0),
+ mHoverID(NULL),
+ mHoverBarIndex(-1),
+ mStatsIndex(-1),
+ mPauseHistory(false),
+ mRecording(NUM_FRAMES_HISTORY)
{
- mTimerBarRows.resize(NUM_FRAMES_HISTORY);
+ mTimerBarRows.resize(NUM_FRAMES_HISTORY);
}
LLFastTimerView::~LLFastTimerView()
@@ -103,253 +103,253 @@ LLFastTimerView::~LLFastTimerView()
void LLFastTimerView::onPause()
{
- setPauseState(!mPauseHistory);
+ setPauseState(!mPauseHistory);
}
void LLFastTimerView::setPauseState(bool pause_state)
{
- if (pause_state == mPauseHistory) return;
-
- // reset scroll to bottom when unpausing
- if (!pause_state)
- {
-
- getChild<LLButton>("pause_btn")->setLabel(getString("pause"));
- }
- else
- {
- mScrollIndex = 0;
-
- getChild<LLButton>("pause_btn")->setLabel(getString("run"));
- }
-
- mPauseHistory = pause_state;
+ if (pause_state == mPauseHistory) return;
+
+ // reset scroll to bottom when unpausing
+ if (!pause_state)
+ {
+
+ getChild<LLButton>("pause_btn")->setLabel(getString("pause"));
+ }
+ else
+ {
+ mScrollIndex = 0;
+
+ getChild<LLButton>("pause_btn")->setLabel(getString("run"));
+ }
+
+ mPauseHistory = pause_state;
}
BOOL LLFastTimerView::postBuild()
{
- LLButton& pause_btn = getChildRef<LLButton>("pause_btn");
- mScrollBar = getChild<LLScrollbar>("scroll_vert");
-
- pause_btn.setCommitCallback(boost::bind(&LLFastTimerView::onPause, this));
- return TRUE;
+ LLButton& pause_btn = getChildRef<LLButton>("pause_btn");
+ mScrollBar = getChild<LLScrollbar>("scroll_vert");
+
+ pause_btn.setCommitCallback(boost::bind(&LLFastTimerView::onPause, this));
+ return TRUE;
}
BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- if (mHoverTimer )
- {
- // right click collapses timers
- if (!mHoverTimer->getTreeNode().mCollapsed)
- {
- mHoverTimer->getTreeNode().mCollapsed = true;
- }
- else if (mHoverTimer->getParent())
- {
- mHoverTimer->getParent()->getTreeNode().mCollapsed = true;
- }
- return TRUE;
- }
- else if (mBarRect.pointInRect(x, y))
- {
- S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight());
- bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY);
- mStatsIndex = mScrollIndex + bar_idx;
- return TRUE;
- }
- return LLFloater::handleRightMouseDown(x, y, mask);
+ if (mHoverTimer )
+ {
+ // right click collapses timers
+ if (!mHoverTimer->getTreeNode().mCollapsed)
+ {
+ mHoverTimer->getTreeNode().mCollapsed = true;
+ }
+ else if (mHoverTimer->getParent())
+ {
+ mHoverTimer->getParent()->getTreeNode().mCollapsed = true;
+ }
+ return TRUE;
+ }
+ else if (mBarRect.pointInRect(x, y))
+ {
+ S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight());
+ bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY);
+ mStatsIndex = mScrollIndex + bar_idx;
+ return TRUE;
+ }
+ return LLFloater::handleRightMouseDown(x, y, mask);
}
BlockTimerStatHandle* LLFastTimerView::getLegendID(S32 y)
{
- S32 idx = (mLegendRect.mTop - y) / (LLFontGL::getFontMonospace()->getLineHeight() + 2);
-
- if (idx >= 0 && idx < (S32)ft_display_idx.size())
- {
- return ft_display_idx[idx];
- }
-
- return NULL;
+ S32 idx = (mLegendRect.mTop - y) / (LLFontGL::getFontMonospace()->getLineHeight() + 2);
+
+ if (idx >= 0 && idx < (S32)ft_display_idx.size())
+ {
+ return ft_display_idx[idx];
+ }
+
+ return NULL;
}
BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
- it != LLTrace::end_block_timer_tree_df();
- ++it)
- {
- (*it)->getTreeNode().mCollapsed = false;
- }
- return TRUE;
+ for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
+ it != LLTrace::end_block_timer_tree_df();
+ ++it)
+ {
+ (*it)->getTreeNode().mCollapsed = false;
+ }
+ return TRUE;
}
BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if (x < mScrollBar->getRect().mLeft)
- {
- BlockTimerStatHandle* idp = getLegendID(y);
- if (idp)
- {
- idp->getTreeNode().mCollapsed = !idp->getTreeNode().mCollapsed;
- }
- }
- else if (mHoverTimer)
- {
- //left click drills down by expanding timers
- mHoverTimer->getTreeNode().mCollapsed = false;
- }
- else if (mGraphRect.pointInRect(x, y))
- {
- gFocusMgr.setMouseCapture(this);
- return TRUE;
- }
-
- return LLFloater::handleMouseDown(x, y, mask);
+ if (x < mScrollBar->getRect().mLeft)
+ {
+ BlockTimerStatHandle* idp = getLegendID(y);
+ if (idp)
+ {
+ idp->getTreeNode().mCollapsed = !idp->getTreeNode().mCollapsed;
+ }
+ }
+ else if (mHoverTimer)
+ {
+ //left click drills down by expanding timers
+ mHoverTimer->getTreeNode().mCollapsed = false;
+ }
+ else if (mGraphRect.pointInRect(x, y))
+ {
+ gFocusMgr.setMouseCapture(this);
+ return TRUE;
+ }
+
+ return LLFloater::handleMouseDown(x, y, mask);
}
BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask)
{
- if (hasMouseCapture())
- {
- gFocusMgr.setMouseCapture(NULL);
- }
- return LLFloater::handleMouseUp(x, y, mask);;
+ if (hasMouseCapture())
+ {
+ gFocusMgr.setMouseCapture(NULL);
+ }
+ return LLFloater::handleMouseUp(x, y, mask);;
}
BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)
{
- if (hasMouseCapture())
- {
- F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f);
- mScrollIndex = ll_round( lerp * (F32)(mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY));
- mScrollIndex = llclamp( mScrollIndex, 0, (S32)mRecording.getNumRecordedPeriods());
- return TRUE;
- }
- mHoverTimer = NULL;
- mHoverID = NULL;
-
- if(mPauseHistory && mBarRect.pointInRect(x, y))
- {
- //const S32 bars_top = mBarRect.mTop;
- const S32 bars_top = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4);
-
- mHoverBarIndex = llmin((bars_top - y) / (mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2)) - 1,
- (S32)mRecording.getNumRecordedPeriods() - 1,
- MAX_VISIBLE_HISTORY);
- if (mHoverBarIndex == 0)
- {
- return TRUE;
- }
- else if (mHoverBarIndex < 0)
- {
- mHoverBarIndex = 0;
- }
-
- TimerBarRow& row = mHoverBarIndex == 0 ? mAverageTimerRow : mTimerBarRows[mScrollIndex + mHoverBarIndex - 1];
-
- TimerBar* hover_bar = NULL;
- F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay;
- for (int bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount();
- bar_index < end_index;
- ++bar_index)
- {
- TimerBar& bar = row.mBars[bar_index];
- if (bar.mSelfStart > mouse_time_offset)
- {
- break;
- }
- if (bar.mSelfEnd > mouse_time_offset)
- {
- hover_bar = &bar;
- if (bar.mTimeBlock->getTreeNode().mCollapsed)
- {
- // stop on first collapsed BlockTimerStatHandle, since we can't select any children
- break;
- }
- }
- }
-
- if (hover_bar)
- {
- mHoverID = hover_bar->mTimeBlock;
- if (mHoverTimer != mHoverID)
- {
- // could be that existing tooltip is for a parent and is thus
- // covering region for this new timer, go ahead and unblock
- // so we can create a new tooltip
- LLToolTipMgr::instance().unblockToolTips();
- mHoverTimer = mHoverID;
- mToolTipRect.set(mBarRect.mLeft + (hover_bar->mSelfStart / mTotalTimeDisplay) * mBarRect.getWidth(),
- row.mTop,
- mBarRect.mLeft + (hover_bar->mSelfEnd / mTotalTimeDisplay) * mBarRect.getWidth(),
- row.mBottom);
- }
- }
- }
- else if (x < mScrollBar->getRect().mLeft)
- {
- BlockTimerStatHandle* timer_id = getLegendID(y);
- if (timer_id)
- {
- mHoverID = timer_id;
- }
- }
-
- return LLFloater::handleHover(x, y, mask);
+ if (hasMouseCapture())
+ {
+ F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f);
+ mScrollIndex = ll_round( lerp * (F32)(mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY));
+ mScrollIndex = llclamp( mScrollIndex, 0, (S32)mRecording.getNumRecordedPeriods());
+ return TRUE;
+ }
+ mHoverTimer = NULL;
+ mHoverID = NULL;
+
+ if(mPauseHistory && mBarRect.pointInRect(x, y))
+ {
+ //const S32 bars_top = mBarRect.mTop;
+ const S32 bars_top = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4);
+
+ mHoverBarIndex = llmin((bars_top - y) / (mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2)) - 1,
+ (S32)mRecording.getNumRecordedPeriods() - 1,
+ MAX_VISIBLE_HISTORY);
+ if (mHoverBarIndex == 0)
+ {
+ return TRUE;
+ }
+ else if (mHoverBarIndex < 0)
+ {
+ mHoverBarIndex = 0;
+ }
+
+ TimerBarRow& row = mHoverBarIndex == 0 ? mAverageTimerRow : mTimerBarRows[mScrollIndex + mHoverBarIndex - 1];
+
+ TimerBar* hover_bar = NULL;
+ F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay;
+ for (int bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount();
+ bar_index < end_index;
+ ++bar_index)
+ {
+ TimerBar& bar = row.mBars[bar_index];
+ if (bar.mSelfStart > mouse_time_offset)
+ {
+ break;
+ }
+ if (bar.mSelfEnd > mouse_time_offset)
+ {
+ hover_bar = &bar;
+ if (bar.mTimeBlock->getTreeNode().mCollapsed)
+ {
+ // stop on first collapsed BlockTimerStatHandle, since we can't select any children
+ break;
+ }
+ }
+ }
+
+ if (hover_bar)
+ {
+ mHoverID = hover_bar->mTimeBlock;
+ if (mHoverTimer != mHoverID)
+ {
+ // could be that existing tooltip is for a parent and is thus
+ // covering region for this new timer, go ahead and unblock
+ // so we can create a new tooltip
+ LLToolTipMgr::instance().unblockToolTips();
+ mHoverTimer = mHoverID;
+ mToolTipRect.set(mBarRect.mLeft + (hover_bar->mSelfStart / mTotalTimeDisplay) * mBarRect.getWidth(),
+ row.mTop,
+ mBarRect.mLeft + (hover_bar->mSelfEnd / mTotalTimeDisplay) * mBarRect.getWidth(),
+ row.mBottom);
+ }
+ }
+ }
+ else if (x < mScrollBar->getRect().mLeft)
+ {
+ BlockTimerStatHandle* timer_id = getLegendID(y);
+ if (timer_id)
+ {
+ mHoverID = timer_id;
+ }
+ }
+
+ return LLFloater::handleHover(x, y, mask);
}
static std::string get_tooltip(BlockTimerStatHandle& timer, S32 history_index, PeriodicRecording& frame_recording)
{
- std::string tooltip;
- if (history_index == 0)
- {
- // by default, show average number of call
- tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)F64Milliseconds(frame_recording.getPeriodMean (timer, RUNNING_AVERAGE_WIDTH)).value(), (S32)frame_recording.getPeriodMean(timer.callCount(), RUNNING_AVERAGE_WIDTH));
- }
- else
- {
- tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)F64Milliseconds(frame_recording.getPrevRecording(history_index).getSum(timer)).value(), (S32)frame_recording.getPrevRecording(history_index).getSum(timer.callCount()));
- }
- return tooltip;
+ std::string tooltip;
+ if (history_index == 0)
+ {
+ // by default, show average number of call
+ tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)F64Milliseconds(frame_recording.getPeriodMean (timer, RUNNING_AVERAGE_WIDTH)).value(), (S32)frame_recording.getPeriodMean(timer.callCount(), RUNNING_AVERAGE_WIDTH));
+ }
+ else
+ {
+ tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)F64Milliseconds(frame_recording.getPrevRecording(history_index).getSum(timer)).value(), (S32)frame_recording.getPrevRecording(history_index).getSum(timer.callCount()));
+ }
+ return tooltip;
}
BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)
{
- if(mPauseHistory && mBarRect.pointInRect(x, y))
- {
- // tooltips for timer bars
- if (mHoverTimer)
- {
- LLRect screen_rect;
- localRectToScreen(mToolTipRect, &screen_rect);
-
- std::string tooltip = get_tooltip(*mHoverTimer, mHoverBarIndex > 0 ? mScrollIndex + mHoverBarIndex : 0, mRecording);
-
- LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(tooltip)
- .sticky_rect(screen_rect)
- .delay_time(0.f));
-
- return TRUE;
- }
- }
- else
- {
- // tooltips for timer legend
- if (x < mScrollBar->getRect().mLeft)
- {
- BlockTimerStatHandle* idp = getLegendID(y);
- if (idp)
- {
- LLToolTipMgr::instance().show(get_tooltip(*idp, 0, mRecording));
-
- return TRUE;
- }
- }
- }
-
- return LLFloater::handleToolTip(x, y, mask);
+ if(mPauseHistory && mBarRect.pointInRect(x, y))
+ {
+ // tooltips for timer bars
+ if (mHoverTimer)
+ {
+ LLRect screen_rect;
+ localRectToScreen(mToolTipRect, &screen_rect);
+
+ std::string tooltip = get_tooltip(*mHoverTimer, mHoverBarIndex > 0 ? mScrollIndex + mHoverBarIndex : 0, mRecording);
+
+ LLToolTipMgr::instance().show(LLToolTip::Params()
+ .message(tooltip)
+ .sticky_rect(screen_rect)
+ .delay_time(0.f));
+
+ return TRUE;
+ }
+ }
+ else
+ {
+ // tooltips for timer legend
+ if (x < mScrollBar->getRect().mLeft)
+ {
+ BlockTimerStatHandle* idp = getLegendID(y);
+ if (idp)
+ {
+ LLToolTipMgr::instance().show(get_tooltip(*idp, 0, mRecording));
+
+ return TRUE;
+ }
+ }
+ }
+
+ return LLFloater::handleToolTip(x, y, mask);
}
BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks)
@@ -361,12 +361,12 @@ BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks)
}
else
{
- setPauseState(true);
- mScrollIndex = llclamp( mScrollIndex + clicks,
- 0,
- llmin((S32)mRecording.getNumRecordedPeriods(), (S32)mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY));
+ setPauseState(true);
+ mScrollIndex = llclamp( mScrollIndex + clicks,
+ 0,
+ llmin((S32)mRecording.getNumRecordedPeriods(), (S32)mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY));
}
- return TRUE;
+ return TRUE;
}
static BlockTimerStatHandle FTM_RENDER_TIMER("Timers");
@@ -376,1290 +376,1290 @@ static std::vector<LLColor4> sTimerColors;
void LLFastTimerView::draw()
{
- LL_RECORD_BLOCK_TIME(FTM_RENDER_TIMER);
-
- if (!mPauseHistory)
- {
- mRecording.appendRecording(LLTrace::get_frame_recording().getLastRecording());
- mTimerBarRows.pop_back();
- mTimerBarRows.push_front(TimerBarRow());
- }
-
- mDisplayMode = llclamp(getChild<LLComboBox>("time_scale_combo")->getCurrentIndex(), 0, 3);
- mDisplayType = (EDisplayType)llclamp(getChild<LLComboBox>("metric_combo")->getCurrentIndex(), 0, 2);
-
- generateUniqueColors();
-
- LLView::drawChildren();
- //getChild<LLLayoutStack>("timer_bars_stack")->updateLayout();
- //getChild<LLLayoutStack>("legend_stack")->updateLayout();
- LLView* bars_panel = getChildView("bars_panel");
- bars_panel->localRectToOtherView(bars_panel->getLocalRect(), &mBarRect, this);
-
- LLView* lines_panel = getChildView("lines_panel");
- lines_panel->localRectToOtherView(lines_panel->getLocalRect(), &mGraphRect, this);
-
- LLView* legend_panel = getChildView("legend");
- legend_panel->localRectToOtherView(legend_panel->getLocalRect(), &mLegendRect, this);
-
- // Draw the window background
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gl_rect_2d(getLocalRect(), LLColor4(0.f, 0.f, 0.f, 0.25f));
-
- drawHelp(getRect().getHeight() - MARGIN);
- drawLegend();
-
- //mBarRect.mLeft = MARGIN + LEGEND_WIDTH + 8;
- //mBarRect.mTop = y;
- //mBarRect.mRight = getRect().getWidth() - MARGIN;
- //mBarRect.mBottom = MARGIN + LINE_GRAPH_HEIGHT;
-
- drawBars();
- drawLineGraph();
- printLineStats();
- LLView::draw();
-
- mAllTimeMax = llmax(mAllTimeMax, mRecording.getLastRecording().getSum(FTM_FRAME));
- mHoverID = NULL;
- mHoverBarIndex = -1;
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_TIMER);
+
+ if (!mPauseHistory)
+ {
+ mRecording.appendRecording(LLTrace::get_frame_recording().getLastRecording());
+ mTimerBarRows.pop_back();
+ mTimerBarRows.push_front(TimerBarRow());
+ }
+
+ mDisplayMode = llclamp(getChild<LLComboBox>("time_scale_combo")->getCurrentIndex(), 0, 3);
+ mDisplayType = (EDisplayType)llclamp(getChild<LLComboBox>("metric_combo")->getCurrentIndex(), 0, 2);
+
+ generateUniqueColors();
+
+ LLView::drawChildren();
+ //getChild<LLLayoutStack>("timer_bars_stack")->updateLayout();
+ //getChild<LLLayoutStack>("legend_stack")->updateLayout();
+ LLView* bars_panel = getChildView("bars_panel");
+ bars_panel->localRectToOtherView(bars_panel->getLocalRect(), &mBarRect, this);
+
+ LLView* lines_panel = getChildView("lines_panel");
+ lines_panel->localRectToOtherView(lines_panel->getLocalRect(), &mGraphRect, this);
+
+ LLView* legend_panel = getChildView("legend");
+ legend_panel->localRectToOtherView(legend_panel->getLocalRect(), &mLegendRect, this);
+
+ // Draw the window background
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gl_rect_2d(getLocalRect(), LLColor4(0.f, 0.f, 0.f, 0.25f));
+
+ drawHelp(getRect().getHeight() - MARGIN);
+ drawLegend();
+
+ //mBarRect.mLeft = MARGIN + LEGEND_WIDTH + 8;
+ //mBarRect.mTop = y;
+ //mBarRect.mRight = getRect().getWidth() - MARGIN;
+ //mBarRect.mBottom = MARGIN + LINE_GRAPH_HEIGHT;
+
+ drawBars();
+ drawLineGraph();
+ printLineStats();
+ LLView::draw();
+
+ mAllTimeMax = llmax(mAllTimeMax, mRecording.getLastRecording().getSum(FTM_FRAME));
+ mHoverID = NULL;
+ mHoverBarIndex = -1;
}
void LLFastTimerView::onOpen(const LLSD& key)
{
- setPauseState(false);
- mRecording.reset();
- mRecording.appendPeriodicRecording(LLTrace::get_frame_recording());
- for(std::deque<TimerBarRow>::iterator it = mTimerBarRows.begin(), end_it = mTimerBarRows.end();
- it != end_it;
- ++it)
- {
- delete []it->mBars;
- it->mBars = NULL;
- }
+ setPauseState(false);
+ mRecording.reset();
+ mRecording.appendPeriodicRecording(LLTrace::get_frame_recording());
+ for(std::deque<TimerBarRow>::iterator it = mTimerBarRows.begin(), end_it = mTimerBarRows.end();
+ it != end_it;
+ ++it)
+ {
+ delete []it->mBars;
+ it->mBars = NULL;
+ }
}
-
+
void LLFastTimerView::onClose(bool app_quitting)
{
- setVisible(FALSE);
+ setVisible(FALSE);
}
void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch)
{
- // disable use of glReadPixels which messes up nVidia nSight graphics debugging
- if (!LLRender::sNsightDebugSupport)
- {
- //read result back into raw image
- glReadPixels(0, 0, 1024, 512, GL_RGB, GL_UNSIGNED_BYTE, scratch->getData());
-
- //write results to disk
- LLPointer<LLImagePNG> result = new LLImagePNG();
- result->encode(scratch, 0.f);
-
- std::string ext = result->getExtension();
- std::string filename = llformat("%s_%s.%s", label.c_str(), suffix, ext.c_str());
-
- std::string out_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, filename);
- result->save(out_file);
- }
+ // disable use of glReadPixels which messes up nVidia nSight graphics debugging
+ if (!LLRender::sNsightDebugSupport)
+ {
+ //read result back into raw image
+ glReadPixels(0, 0, 1024, 512, GL_RGB, GL_UNSIGNED_BYTE, scratch->getData());
+
+ //write results to disk
+ LLPointer<LLImagePNG> result = new LLImagePNG();
+ result->encode(scratch, 0.f);
+
+ std::string ext = result->getExtension();
+ std::string filename = llformat("%s_%s.%s", label.c_str(), suffix, ext.c_str());
+
+ std::string out_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, filename);
+ result->save(out_file);
+ }
}
//static
void LLFastTimerView::exportCharts(const std::string& base, const std::string& target)
{
- //allocate render target for drawing charts
- LLRenderTarget buffer;
- buffer.allocate(1024,512, GL_RGB);
-
-
- LLSD cur;
-
- LLSD base_data;
-
- { //read base log into memory
- S32 i = 0;
- llifstream is(base.c_str());
- while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
- {
- base_data[i++] = cur;
- }
- is.close();
- }
-
- LLSD cur_data;
- std::set<std::string> chart_names;
-
- { //read current log into memory
- S32 i = 0;
- llifstream is(target.c_str());
- while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
- {
- cur_data[i++] = cur;
-
- for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter)
- {
- std::string label = iter->first;
- chart_names.insert(label);
- }
- }
- is.close();
- }
-
- //allocate raw scratch space
- LLPointer<LLImageRaw> scratch = new LLImageRaw(1024, 512, 3);
-
- gGL.pushMatrix();
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.loadIdentity();
- gGL.ortho(-0.05f, 1.05f, -0.05f, 1.05f, -1.0f, 1.0f);
-
- //render charts
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- buffer.bindTarget();
-
- for (std::set<std::string>::iterator iter = chart_names.begin(); iter != chart_names.end(); ++iter)
- {
- std::string label = *iter;
-
- LLSD::Real max_time = 0.0;
- LLSD::Integer max_calls = 0;
- LLSD::Real max_execution = 0.0;
-
- std::vector<LLSD::Real> cur_execution;
- std::vector<LLSD::Real> cur_times;
- std::vector<LLSD::Integer> cur_calls;
-
- std::vector<LLSD::Real> base_execution;
- std::vector<LLSD::Real> base_times;
- std::vector<LLSD::Integer> base_calls;
-
- for (U32 i = 0; i < cur_data.size(); ++i)
- {
- LLSD::Real time = cur_data[i][label]["Time"].asReal();
- LLSD::Integer calls = cur_data[i][label]["Calls"].asInteger();
-
- LLSD::Real execution = 0.0;
- if (calls > 0)
- {
- execution = time/calls;
- cur_execution.push_back(execution);
- cur_times.push_back(time);
- }
-
- cur_calls.push_back(calls);
- }
-
- for (U32 i = 0; i < base_data.size(); ++i)
- {
- LLSD::Real time = base_data[i][label]["Time"].asReal();
- LLSD::Integer calls = base_data[i][label]["Calls"].asInteger();
-
- LLSD::Real execution = 0.0;
- if (calls > 0)
- {
- execution = time/calls;
- base_execution.push_back(execution);
- base_times.push_back(time);
- }
-
- base_calls.push_back(calls);
- }
-
- std::sort(base_calls.begin(), base_calls.end());
- std::sort(base_times.begin(), base_times.end());
- std::sort(base_execution.begin(), base_execution.end());
-
- std::sort(cur_calls.begin(), cur_calls.end());
- std::sort(cur_times.begin(), cur_times.end());
- std::sort(cur_execution.begin(), cur_execution.end());
-
- //remove outliers
- const U32 OUTLIER_CUTOFF = 512;
- if (base_times.size() > OUTLIER_CUTOFF)
- {
- ll_remove_outliers(base_times, 1.f);
- }
-
- if (base_execution.size() > OUTLIER_CUTOFF)
- {
- ll_remove_outliers(base_execution, 1.f);
- }
-
- if (cur_times.size() > OUTLIER_CUTOFF)
- {
- ll_remove_outliers(cur_times, 1.f);
- }
-
- if (cur_execution.size() > OUTLIER_CUTOFF)
- {
- ll_remove_outliers(cur_execution, 1.f);
- }
-
-
- max_time = llmax(base_times.empty() ? 0.0 : *base_times.rbegin(), cur_times.empty() ? 0.0 : *cur_times.rbegin());
- max_calls = llmax(base_calls.empty() ? 0 : *base_calls.rbegin(), cur_calls.empty() ? 0 : *cur_calls.rbegin());
- max_execution = llmax(base_execution.empty() ? 0.0 : *base_execution.rbegin(), cur_execution.empty() ? 0.0 : *cur_execution.rbegin());
-
-
- LLVector3 last_p;
-
- //====================================
- // basic
- //====================================
- buffer.clear();
-
- last_p.clear();
-
- LLGLDisable cull(GL_CULL_FACE);
-
- LLVector3 base_col(0, 0.7f, 0.f);
- LLVector3 cur_col(1.f, 0.f, 0.f);
-
- gGL.setSceneBlendType(LLRender::BT_ADD);
-
- gGL.color3fv(base_col.mV);
- for (U32 i = 0; i < base_times.size(); ++i)
- {
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3fv(last_p.mV);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- last_p.set((F32)i/(F32) base_times.size(), base_times[i]/max_time, 0.f);
- gGL.vertex3fv(last_p.mV);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- gGL.end();
- }
-
- gGL.flush();
-
-
- last_p.clear();
- {
- LLGLEnable blend(GL_BLEND);
-
- gGL.color3fv(cur_col.mV);
- for (U32 i = 0; i < cur_times.size(); ++i)
- {
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- gGL.vertex3fv(last_p.mV);
- last_p.set((F32) i / (F32) cur_times.size(), cur_times[i]/max_time, 0.f);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- gGL.vertex3fv(last_p.mV);
- gGL.end();
- }
-
- gGL.flush();
- }
-
- saveChart(label, "time", scratch);
-
- //======================================
- // calls
- //======================================
- buffer.clear();
-
- last_p.clear();
-
- gGL.color3fv(base_col.mV);
- for (U32 i = 0; i < base_calls.size(); ++i)
- {
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3fv(last_p.mV);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- last_p.set((F32) i / (F32) base_calls.size(), (F32)base_calls[i]/max_calls, 0.f);
- gGL.vertex3fv(last_p.mV);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- gGL.end();
- }
-
- gGL.flush();
-
- {
- LLGLEnable blend(GL_BLEND);
- gGL.color3fv(cur_col.mV);
- last_p.clear();
-
- for (U32 i = 0; i < cur_calls.size(); ++i)
- {
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- gGL.vertex3fv(last_p.mV);
- last_p.set((F32) i / (F32) cur_calls.size(), (F32) cur_calls[i]/max_calls, 0.f);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- gGL.vertex3fv(last_p.mV);
- gGL.end();
-
- }
-
- gGL.flush();
- }
-
- saveChart(label, "calls", scratch);
-
- //======================================
- // execution
- //======================================
- buffer.clear();
-
- gGL.color3fv(base_col.mV);
- U32 count = 0;
- U32 total_count = base_execution.size();
-
- last_p.clear();
-
- for (std::vector<LLSD::Real>::iterator iter = base_execution.begin(); iter != base_execution.end(); ++iter)
- {
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3fv(last_p.mV);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- last_p.set((F32)count/(F32)total_count, *iter/max_execution, 0.f);
- gGL.vertex3fv(last_p.mV);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- gGL.end();
- count++;
- }
-
- last_p.clear();
-
- {
- LLGLEnable blend(GL_BLEND);
- gGL.color3fv(cur_col.mV);
- count = 0;
- total_count = cur_execution.size();
-
- for (std::vector<LLSD::Real>::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter)
- {
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- gGL.vertex3fv(last_p.mV);
- last_p.set((F32)count/(F32)total_count, *iter/max_execution, 0.f);
- gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
- gGL.vertex3fv(last_p.mV);
- gGL.end();
- count++;
- }
-
- gGL.flush();
- }
-
- saveChart(label, "execution", scratch);
- }
-
- buffer.flush();
-
- gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
+ //allocate render target for drawing charts
+ LLRenderTarget buffer;
+ buffer.allocate(1024,512, GL_RGB);
+
+
+ LLSD cur;
+
+ LLSD base_data;
+
+ { //read base log into memory
+ S32 i = 0;
+ llifstream is(base.c_str());
+ while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
+ {
+ base_data[i++] = cur;
+ }
+ is.close();
+ }
+
+ LLSD cur_data;
+ std::set<std::string> chart_names;
+
+ { //read current log into memory
+ S32 i = 0;
+ llifstream is(target.c_str());
+ while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
+ {
+ cur_data[i++] = cur;
+
+ for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter)
+ {
+ std::string label = iter->first;
+ chart_names.insert(label);
+ }
+ }
+ is.close();
+ }
+
+ //allocate raw scratch space
+ LLPointer<LLImageRaw> scratch = new LLImageRaw(1024, 512, 3);
+
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadIdentity();
+ gGL.ortho(-0.05f, 1.05f, -0.05f, 1.05f, -1.0f, 1.0f);
+
+ //render charts
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ buffer.bindTarget();
+
+ for (std::set<std::string>::iterator iter = chart_names.begin(); iter != chart_names.end(); ++iter)
+ {
+ std::string label = *iter;
+
+ LLSD::Real max_time = 0.0;
+ LLSD::Integer max_calls = 0;
+ LLSD::Real max_execution = 0.0;
+
+ std::vector<LLSD::Real> cur_execution;
+ std::vector<LLSD::Real> cur_times;
+ std::vector<LLSD::Integer> cur_calls;
+
+ std::vector<LLSD::Real> base_execution;
+ std::vector<LLSD::Real> base_times;
+ std::vector<LLSD::Integer> base_calls;
+
+ for (U32 i = 0; i < cur_data.size(); ++i)
+ {
+ LLSD::Real time = cur_data[i][label]["Time"].asReal();
+ LLSD::Integer calls = cur_data[i][label]["Calls"].asInteger();
+
+ LLSD::Real execution = 0.0;
+ if (calls > 0)
+ {
+ execution = time/calls;
+ cur_execution.push_back(execution);
+ cur_times.push_back(time);
+ }
+
+ cur_calls.push_back(calls);
+ }
+
+ for (U32 i = 0; i < base_data.size(); ++i)
+ {
+ LLSD::Real time = base_data[i][label]["Time"].asReal();
+ LLSD::Integer calls = base_data[i][label]["Calls"].asInteger();
+
+ LLSD::Real execution = 0.0;
+ if (calls > 0)
+ {
+ execution = time/calls;
+ base_execution.push_back(execution);
+ base_times.push_back(time);
+ }
+
+ base_calls.push_back(calls);
+ }
+
+ std::sort(base_calls.begin(), base_calls.end());
+ std::sort(base_times.begin(), base_times.end());
+ std::sort(base_execution.begin(), base_execution.end());
+
+ std::sort(cur_calls.begin(), cur_calls.end());
+ std::sort(cur_times.begin(), cur_times.end());
+ std::sort(cur_execution.begin(), cur_execution.end());
+
+ //remove outliers
+ const U32 OUTLIER_CUTOFF = 512;
+ if (base_times.size() > OUTLIER_CUTOFF)
+ {
+ ll_remove_outliers(base_times, 1.f);
+ }
+
+ if (base_execution.size() > OUTLIER_CUTOFF)
+ {
+ ll_remove_outliers(base_execution, 1.f);
+ }
+
+ if (cur_times.size() > OUTLIER_CUTOFF)
+ {
+ ll_remove_outliers(cur_times, 1.f);
+ }
+
+ if (cur_execution.size() > OUTLIER_CUTOFF)
+ {
+ ll_remove_outliers(cur_execution, 1.f);
+ }
+
+
+ max_time = llmax(base_times.empty() ? 0.0 : *base_times.rbegin(), cur_times.empty() ? 0.0 : *cur_times.rbegin());
+ max_calls = llmax(base_calls.empty() ? 0 : *base_calls.rbegin(), cur_calls.empty() ? 0 : *cur_calls.rbegin());
+ max_execution = llmax(base_execution.empty() ? 0.0 : *base_execution.rbegin(), cur_execution.empty() ? 0.0 : *cur_execution.rbegin());
+
+
+ LLVector3 last_p;
+
+ //====================================
+ // basic
+ //====================================
+ buffer.clear();
+
+ last_p.clear();
+
+ LLGLDisable cull(GL_CULL_FACE);
+
+ LLVector3 base_col(0, 0.7f, 0.f);
+ LLVector3 cur_col(1.f, 0.f, 0.f);
+
+ gGL.setSceneBlendType(LLRender::BT_ADD);
+
+ gGL.color3fv(base_col.mV);
+ for (U32 i = 0; i < base_times.size(); ++i)
+ {
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3fv(last_p.mV);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ last_p.set((F32)i/(F32) base_times.size(), base_times[i]/max_time, 0.f);
+ gGL.vertex3fv(last_p.mV);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ gGL.end();
+ }
+
+ gGL.flush();
+
+
+ last_p.clear();
+ {
+ LLGLEnable blend(GL_BLEND);
+
+ gGL.color3fv(cur_col.mV);
+ for (U32 i = 0; i < cur_times.size(); ++i)
+ {
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ gGL.vertex3fv(last_p.mV);
+ last_p.set((F32) i / (F32) cur_times.size(), cur_times[i]/max_time, 0.f);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ gGL.vertex3fv(last_p.mV);
+ gGL.end();
+ }
+
+ gGL.flush();
+ }
+
+ saveChart(label, "time", scratch);
+
+ //======================================
+ // calls
+ //======================================
+ buffer.clear();
+
+ last_p.clear();
+
+ gGL.color3fv(base_col.mV);
+ for (U32 i = 0; i < base_calls.size(); ++i)
+ {
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3fv(last_p.mV);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ last_p.set((F32) i / (F32) base_calls.size(), (F32)base_calls[i]/max_calls, 0.f);
+ gGL.vertex3fv(last_p.mV);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ gGL.end();
+ }
+
+ gGL.flush();
+
+ {
+ LLGLEnable blend(GL_BLEND);
+ gGL.color3fv(cur_col.mV);
+ last_p.clear();
+
+ for (U32 i = 0; i < cur_calls.size(); ++i)
+ {
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ gGL.vertex3fv(last_p.mV);
+ last_p.set((F32) i / (F32) cur_calls.size(), (F32) cur_calls[i]/max_calls, 0.f);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ gGL.vertex3fv(last_p.mV);
+ gGL.end();
+
+ }
+
+ gGL.flush();
+ }
+
+ saveChart(label, "calls", scratch);
+
+ //======================================
+ // execution
+ //======================================
+ buffer.clear();
+
+ gGL.color3fv(base_col.mV);
+ U32 count = 0;
+ U32 total_count = base_execution.size();
+
+ last_p.clear();
+
+ for (std::vector<LLSD::Real>::iterator iter = base_execution.begin(); iter != base_execution.end(); ++iter)
+ {
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3fv(last_p.mV);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ last_p.set((F32)count/(F32)total_count, *iter/max_execution, 0.f);
+ gGL.vertex3fv(last_p.mV);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ gGL.end();
+ count++;
+ }
+
+ last_p.clear();
+
+ {
+ LLGLEnable blend(GL_BLEND);
+ gGL.color3fv(cur_col.mV);
+ count = 0;
+ total_count = cur_execution.size();
+
+ for (std::vector<LLSD::Real>::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter)
+ {
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ gGL.vertex3fv(last_p.mV);
+ last_p.set((F32)count/(F32)total_count, *iter/max_execution, 0.f);
+ gGL.vertex3f(last_p.mV[0], 0.f, 0.f);
+ gGL.vertex3fv(last_p.mV);
+ gGL.end();
+ count++;
+ }
+
+ gGL.flush();
+ }
+
+ saveChart(label, "execution", scratch);
+ }
+
+ buffer.flush();
+
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
}
//static
LLSD LLFastTimerView::analyzePerformanceLogDefault(std::istream& is)
{
- LLSD ret;
-
- LLSD cur;
-
- LLSD::Real total_time = 0.0;
- LLSD::Integer total_frames = 0;
-
- typedef std::map<std::string,LLViewerStats::StatsAccumulator> stats_map_t;
- stats_map_t time_stats;
- stats_map_t sample_stats;
-
- while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
- {
- for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter)
- {
- std::string label = iter->first;
-
- F64 time = iter->second["Time"].asReal();
-
- // Skip the total figure
- if(label.compare("Total") != 0)
- {
- total_time += time;
- }
-
- if (time > 0.0)
- {
- LLSD::Integer samples = iter->second["Calls"].asInteger();
-
- time_stats[label].push(time);
- sample_stats[label].push(samples);
- }
- }
- total_frames++;
- }
-
- for(stats_map_t::iterator it = time_stats.begin(); it != time_stats.end(); ++it)
- {
- std::string label = it->first;
- ret[label]["TotalTime"] = time_stats[label].getSum();
- ret[label]["MeanTime"] = time_stats[label].getMean();
- ret[label]["MaxTime"] = time_stats[label].getMaxValue();
- ret[label]["MinTime"] = time_stats[label].getMinValue();
- ret[label]["StdDevTime"] = time_stats[label].getStdDev();
-
+ LLSD ret;
+
+ LLSD cur;
+
+ LLSD::Real total_time = 0.0;
+ LLSD::Integer total_frames = 0;
+
+ typedef std::map<std::string,LLViewerStats::StatsAccumulator> stats_map_t;
+ stats_map_t time_stats;
+ stats_map_t sample_stats;
+
+ while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
+ {
+ for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter)
+ {
+ std::string label = iter->first;
+
+ F64 time = iter->second["Time"].asReal();
+
+ // Skip the total figure
+ if(label.compare("Total") != 0)
+ {
+ total_time += time;
+ }
+
+ if (time > 0.0)
+ {
+ LLSD::Integer samples = iter->second["Calls"].asInteger();
+
+ time_stats[label].push(time);
+ sample_stats[label].push(samples);
+ }
+ }
+ total_frames++;
+ }
+
+ for(stats_map_t::iterator it = time_stats.begin(); it != time_stats.end(); ++it)
+ {
+ std::string label = it->first;
+ ret[label]["TotalTime"] = time_stats[label].getSum();
+ ret[label]["MeanTime"] = time_stats[label].getMean();
+ ret[label]["MaxTime"] = time_stats[label].getMaxValue();
+ ret[label]["MinTime"] = time_stats[label].getMinValue();
+ ret[label]["StdDevTime"] = time_stats[label].getStdDev();
+
ret[label]["Samples"] = sample_stats[label].getSum();
- ret[label]["MaxSamples"] = sample_stats[label].getMaxValue();
- ret[label]["MinSamples"] = sample_stats[label].getMinValue();
- ret[label]["StdDevSamples"] = sample_stats[label].getStdDev();
+ ret[label]["MaxSamples"] = sample_stats[label].getMaxValue();
+ ret[label]["MinSamples"] = sample_stats[label].getMinValue();
+ ret[label]["StdDevSamples"] = sample_stats[label].getStdDev();
- ret[label]["Frames"] = (LLSD::Integer)time_stats[label].getCount();
- }
-
- ret["SessionTime"] = total_time;
- ret["FrameCount"] = total_frames;
+ ret[label]["Frames"] = (LLSD::Integer)time_stats[label].getCount();
+ }
+
+ ret["SessionTime"] = total_time;
+ ret["FrameCount"] = total_frames;
- return ret;
+ return ret;
}
//static
void LLFastTimerView::doAnalysisDefault(std::string baseline, std::string target, std::string output)
{
- // Open baseline and current target, exit if one is inexistent
- llifstream base_is(baseline.c_str());
- llifstream target_is(target.c_str());
- if (!base_is.is_open() || !target_is.is_open())
- {
- LL_WARNS() << "'-analyzeperformance' error : baseline or current target file inexistent" << LL_ENDL;
- base_is.close();
- target_is.close();
- return;
- }
-
- //analyze baseline
- LLSD base = analyzePerformanceLogDefault(base_is);
- base_is.close();
-
- //analyze current
- LLSD current = analyzePerformanceLogDefault(target_is);
- target_is.close();
-
- //output comparison
- llofstream os(output.c_str());
-
- LLSD::Real session_time = current["SessionTime"].asReal();
- os <<
- "Label, "
- "% Change, "
- "% of Session, "
- "Cur Min, "
- "Cur Max, "
- "Cur Mean/sample, "
- "Cur Mean/frame, "
- "Cur StdDev/frame, "
- "Cur Total, "
- "Cur Frames, "
- "Cur Samples, "
- "Base Min, "
- "Base Max, "
- "Base Mean/sample, "
- "Base Mean/frame, "
- "Base StdDev/frame, "
- "Base Total, "
- "Base Frames, "
- "Base Samples\n";
-
- for (LLSD::map_iterator iter = base.beginMap(); iter != base.endMap(); ++iter)
- {
- LLSD::String label = iter->first;
-
- if (current[label]["Samples"].asInteger() == 0 ||
- base[label]["Samples"].asInteger() == 0)
- {
- //cannot compare
- continue;
- }
- LLSD::Real a = base[label]["TotalTime"].asReal() / base[label]["Samples"].asReal();
- LLSD::Real b = current[label]["TotalTime"].asReal() / current[label]["Samples"].asReal();
-
- LLSD::Real diff = b-a;
-
- LLSD::Real perc = diff/a * 100;
-
- os << llformat("%s, %.2f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d\n",
- label.c_str(),
- (F32) perc,
- (F32) (current[label]["TotalTime"].asReal()/session_time * 100.0),
-
- (F32) current[label]["MinTime"].asReal(),
- (F32) current[label]["MaxTime"].asReal(),
- (F32) b,
- (F32) current[label]["MeanTime"].asReal(),
- (F32) current[label]["StdDevTime"].asReal(),
- (F32) current[label]["TotalTime"].asReal(),
- current[label]["Frames"].asInteger(),
- current[label]["Samples"].asInteger(),
- (F32) base[label]["MinTime"].asReal(),
- (F32) base[label]["MaxTime"].asReal(),
- (F32) a,
- (F32) base[label]["MeanTime"].asReal(),
- (F32) base[label]["StdDevTime"].asReal(),
- (F32) base[label]["TotalTime"].asReal(),
- base[label]["Frames"].asInteger(),
- base[label]["Samples"].asInteger());
- }
-
- exportCharts(baseline, target);
-
- os.flush();
- os.close();
+ // Open baseline and current target, exit if one is inexistent
+ llifstream base_is(baseline.c_str());
+ llifstream target_is(target.c_str());
+ if (!base_is.is_open() || !target_is.is_open())
+ {
+ LL_WARNS() << "'-analyzeperformance' error : baseline or current target file inexistent" << LL_ENDL;
+ base_is.close();
+ target_is.close();
+ return;
+ }
+
+ //analyze baseline
+ LLSD base = analyzePerformanceLogDefault(base_is);
+ base_is.close();
+
+ //analyze current
+ LLSD current = analyzePerformanceLogDefault(target_is);
+ target_is.close();
+
+ //output comparison
+ llofstream os(output.c_str());
+
+ LLSD::Real session_time = current["SessionTime"].asReal();
+ os <<
+ "Label, "
+ "% Change, "
+ "% of Session, "
+ "Cur Min, "
+ "Cur Max, "
+ "Cur Mean/sample, "
+ "Cur Mean/frame, "
+ "Cur StdDev/frame, "
+ "Cur Total, "
+ "Cur Frames, "
+ "Cur Samples, "
+ "Base Min, "
+ "Base Max, "
+ "Base Mean/sample, "
+ "Base Mean/frame, "
+ "Base StdDev/frame, "
+ "Base Total, "
+ "Base Frames, "
+ "Base Samples\n";
+
+ for (LLSD::map_iterator iter = base.beginMap(); iter != base.endMap(); ++iter)
+ {
+ LLSD::String label = iter->first;
+
+ if (current[label]["Samples"].asInteger() == 0 ||
+ base[label]["Samples"].asInteger() == 0)
+ {
+ //cannot compare
+ continue;
+ }
+ LLSD::Real a = base[label]["TotalTime"].asReal() / base[label]["Samples"].asReal();
+ LLSD::Real b = current[label]["TotalTime"].asReal() / current[label]["Samples"].asReal();
+
+ LLSD::Real diff = b-a;
+
+ LLSD::Real perc = diff/a * 100;
+
+ os << llformat("%s, %.2f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d\n",
+ label.c_str(),
+ (F32) perc,
+ (F32) (current[label]["TotalTime"].asReal()/session_time * 100.0),
+
+ (F32) current[label]["MinTime"].asReal(),
+ (F32) current[label]["MaxTime"].asReal(),
+ (F32) b,
+ (F32) current[label]["MeanTime"].asReal(),
+ (F32) current[label]["StdDevTime"].asReal(),
+ (F32) current[label]["TotalTime"].asReal(),
+ current[label]["Frames"].asInteger(),
+ current[label]["Samples"].asInteger(),
+ (F32) base[label]["MinTime"].asReal(),
+ (F32) base[label]["MaxTime"].asReal(),
+ (F32) a,
+ (F32) base[label]["MeanTime"].asReal(),
+ (F32) base[label]["StdDevTime"].asReal(),
+ (F32) base[label]["TotalTime"].asReal(),
+ base[label]["Frames"].asInteger(),
+ base[label]["Samples"].asInteger());
+ }
+
+ exportCharts(baseline, target);
+
+ os.flush();
+ os.close();
}
//static
void LLFastTimerView::outputAllMetrics()
{
- if (LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters())
- {
- for (LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin();
- iter != LLMetricPerformanceTesterBasic::sTesterMap.end(); ++iter)
- {
- LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second);
- tester->outputTestResults();
- }
- }
+ if (LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters())
+ {
+ for (LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin();
+ iter != LLMetricPerformanceTesterBasic::sTesterMap.end(); ++iter)
+ {
+ LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second);
+ tester->outputTestResults();
+ }
+ }
}
//static
void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::string output)
{
- if(BlockTimer::sLog)
- {
- doAnalysisDefault(baseline, target, output) ;
- return ;
- }
-
- if(BlockTimer::sMetricLog)
- {
- LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline, target, output) ;
- return ;
- }
+ if(BlockTimer::sLog)
+ {
+ doAnalysisDefault(baseline, target, output) ;
+ return ;
+ }
+
+ if(BlockTimer::sMetricLog)
+ {
+ LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline, target, output) ;
+ return ;
+ }
}
void LLFastTimerView::printLineStats()
{
- // Output stats for clicked bar to log
- if (mStatsIndex >= 0)
- {
- std::string legend_stat;
- bool first = true;
- for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
- it != LLTrace::end_block_timer_tree_df();
- ++it)
- {
- BlockTimerStatHandle* idp = (*it);
-
- if (!first)
- {
- legend_stat += ", ";
- }
- first = false;
- legend_stat += idp->getName();
-
- //if (idp->getTreeNode().mCollapsed)
- //{
- // it.skipDescendants();
- //}
- }
- LL_INFOS() << legend_stat << LL_ENDL;
-
- std::string timer_stat;
- first = true;
- for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
- it != LLTrace::end_block_timer_tree_df();
- ++it)
- {
- BlockTimerStatHandle* idp = (*it);
-
- if (!first)
- {
- timer_stat += ", ";
- }
- first = false;
-
- F32Seconds ticks;
- if (mStatsIndex == 0)
- {
- ticks = mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH);
- }
- else
- {
- ticks = mRecording.getPrevRecording(mStatsIndex).getSum(*idp);
- }
- F32Milliseconds ms = ticks;
-
- timer_stat += llformat("%.1f",ms.value());
-
- //if (idp->getTreeNode().mCollapsed)
- //{
- // it.skipDescendants();
- //}
- }
- LL_INFOS() << timer_stat << LL_ENDL;
- mStatsIndex = -1;
- }
+ // Output stats for clicked bar to log
+ if (mStatsIndex >= 0)
+ {
+ std::string legend_stat;
+ bool first = true;
+ for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
+ it != LLTrace::end_block_timer_tree_df();
+ ++it)
+ {
+ BlockTimerStatHandle* idp = (*it);
+
+ if (!first)
+ {
+ legend_stat += ", ";
+ }
+ first = false;
+ legend_stat += idp->getName();
+
+ //if (idp->getTreeNode().mCollapsed)
+ //{
+ // it.skipDescendants();
+ //}
+ }
+ LL_INFOS() << legend_stat << LL_ENDL;
+
+ std::string timer_stat;
+ first = true;
+ for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
+ it != LLTrace::end_block_timer_tree_df();
+ ++it)
+ {
+ BlockTimerStatHandle* idp = (*it);
+
+ if (!first)
+ {
+ timer_stat += ", ";
+ }
+ first = false;
+
+ F32Seconds ticks;
+ if (mStatsIndex == 0)
+ {
+ ticks = mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH);
+ }
+ else
+ {
+ ticks = mRecording.getPrevRecording(mStatsIndex).getSum(*idp);
+ }
+ F32Milliseconds ms = ticks;
+
+ timer_stat += llformat("%.1f",ms.value());
+
+ //if (idp->getTreeNode().mCollapsed)
+ //{
+ // it.skipDescendants();
+ //}
+ }
+ LL_INFOS() << timer_stat << LL_ENDL;
+ mStatsIndex = -1;
+ }
}
void LLFastTimerView::drawLineGraph()
{
LL_PROFILE_ZONE_SCOPED;
- //draw line graph history
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLLocalClipRect clip(mGraphRect);
-
- //normalize based on last frame's maximum
- static F32Seconds max_time(0.000001);
- static U32 max_calls = 0;
- static F32 alpha_interp = 0.f;
-
- //highlight visible range
- {
- S32 first_frame = mRecording.getNumRecordedPeriods() - mScrollIndex;
- S32 last_frame = first_frame - MAX_VISIBLE_HISTORY;
-
- F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording.getNumRecordedPeriods()-1);
-
- F32 right = (F32) mGraphRect.mLeft + frame_delta*first_frame;
- F32 left = (F32) mGraphRect.mLeft + frame_delta*last_frame;
-
- gGL.color4f(0.5f,0.5f,0.5f,0.3f);
- gl_rect_2d((S32) left, mGraphRect.mTop, (S32) right, mGraphRect.mBottom);
-
- if (mHoverBarIndex > 0)
- {
- S32 bar_frame = first_frame - (mScrollIndex + mHoverBarIndex) - 1;
- F32 bar = (F32) mGraphRect.mLeft + frame_delta*bar_frame;
-
- gGL.color4f(0.5f,0.5f,0.5f,1);
-
- gGL.begin(LLRender::LINES);
- gGL.vertex2i((S32)bar, mGraphRect.mBottom);
- gGL.vertex2i((S32)bar, mGraphRect.mTop);
- gGL.end();
- }
- }
-
- F32Seconds cur_max(0);
- U32 cur_max_calls = 0;
-
- for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
- it != LLTrace::end_block_timer_tree_df();
- ++it)
- {
- BlockTimerStatHandle* idp = (*it);
-
- //fatten highlighted timer
- if (mHoverID == idp)
- {
- gGL.flush();
- glLineWidth(3);
- }
-
- llassert(idp->getIndex() < sTimerColors.size());
- const F32 * col = sTimerColors[idp->getIndex()].mV;// ft_display_table[idx].color->mV;
-
- F32 alpha = 1.f;
- bool is_hover_timer = true;
-
- if (mHoverID != NULL &&
- mHoverID != idp)
- { //fade out non-highlighted timers
- if (idp->getParent() != mHoverID)
- {
- alpha = alpha_interp;
- is_hover_timer = false;
- }
- }
-
- gGL.color4f(col[0], col[1], col[2], alpha);
- gGL.begin(LLRender::TRIANGLE_STRIP);
- F32 call_scale_factor = (F32)mGraphRect.getHeight() / (F32)max_calls;
- F32 time_scale_factor = (F32)mGraphRect.getHeight() / max_time.value();
- F32 hz_scale_factor = (F32) mGraphRect.getHeight() / (1.f / max_time.value());
-
- for (U32 j = mRecording.getNumRecordedPeriods();
- j > 0;
- j--)
- {
- LLTrace::Recording& recording = mRecording.getPrevRecording(j);
- F32Seconds time = llmax(recording.getSum(*idp), F64Seconds(0.000001));
- U32 calls = recording.getSum(idp->callCount());
-
- if (is_hover_timer)
- {
- //normalize to highlighted timer
- cur_max = llmax(cur_max, time);
- cur_max_calls = llmax(cur_max_calls, calls);
- }
- F32 x = mGraphRect.mRight - j * (F32)(mGraphRect.getWidth())/(mRecording.getNumRecordedPeriods()-1);
- F32 y;
- switch(mDisplayType)
+ //draw line graph history
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLLocalClipRect clip(mGraphRect);
+
+ //normalize based on last frame's maximum
+ static F32Seconds max_time(0.000001);
+ static U32 max_calls = 0;
+ static F32 alpha_interp = 0.f;
+
+ //highlight visible range
+ {
+ S32 first_frame = mRecording.getNumRecordedPeriods() - mScrollIndex;
+ S32 last_frame = first_frame - MAX_VISIBLE_HISTORY;
+
+ F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording.getNumRecordedPeriods()-1);
+
+ F32 right = (F32) mGraphRect.mLeft + frame_delta*first_frame;
+ F32 left = (F32) mGraphRect.mLeft + frame_delta*last_frame;
+
+ gGL.color4f(0.5f,0.5f,0.5f,0.3f);
+ gl_rect_2d((S32) left, mGraphRect.mTop, (S32) right, mGraphRect.mBottom);
+
+ if (mHoverBarIndex > 0)
+ {
+ S32 bar_frame = first_frame - (mScrollIndex + mHoverBarIndex) - 1;
+ F32 bar = (F32) mGraphRect.mLeft + frame_delta*bar_frame;
+
+ gGL.color4f(0.5f,0.5f,0.5f,1);
+
+ gGL.begin(LLRender::LINES);
+ gGL.vertex2i((S32)bar, mGraphRect.mBottom);
+ gGL.vertex2i((S32)bar, mGraphRect.mTop);
+ gGL.end();
+ }
+ }
+
+ F32Seconds cur_max(0);
+ U32 cur_max_calls = 0;
+
+ for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
+ it != LLTrace::end_block_timer_tree_df();
+ ++it)
+ {
+ BlockTimerStatHandle* idp = (*it);
+
+ //fatten highlighted timer
+ if (mHoverID == idp)
+ {
+ gGL.flush();
+ glLineWidth(3);
+ }
+
+ llassert(idp->getIndex() < sTimerColors.size());
+ const F32 * col = sTimerColors[idp->getIndex()].mV;// ft_display_table[idx].color->mV;
+
+ F32 alpha = 1.f;
+ bool is_hover_timer = true;
+
+ if (mHoverID != NULL &&
+ mHoverID != idp)
+ { //fade out non-highlighted timers
+ if (idp->getParent() != mHoverID)
+ {
+ alpha = alpha_interp;
+ is_hover_timer = false;
+ }
+ }
+
+ gGL.color4f(col[0], col[1], col[2], alpha);
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ F32 call_scale_factor = (F32)mGraphRect.getHeight() / (F32)max_calls;
+ F32 time_scale_factor = (F32)mGraphRect.getHeight() / max_time.value();
+ F32 hz_scale_factor = (F32) mGraphRect.getHeight() / (1.f / max_time.value());
+
+ for (U32 j = mRecording.getNumRecordedPeriods();
+ j > 0;
+ j--)
+ {
+ LLTrace::Recording& recording = mRecording.getPrevRecording(j);
+ F32Seconds time = llmax(recording.getSum(*idp), F64Seconds(0.000001));
+ U32 calls = recording.getSum(idp->callCount());
+
+ if (is_hover_timer)
+ {
+ //normalize to highlighted timer
+ cur_max = llmax(cur_max, time);
+ cur_max_calls = llmax(cur_max_calls, calls);
+ }
+ F32 x = mGraphRect.mRight - j * (F32)(mGraphRect.getWidth())/(mRecording.getNumRecordedPeriods()-1);
+ F32 y;
+ switch(mDisplayType)
{
- case DISPLAY_TIME:
- y = mGraphRect.mBottom + time.value() * time_scale_factor;
- break;
- case DISPLAY_CALLS:
- y = mGraphRect.mBottom + (F32)calls * call_scale_factor;
- break;
- case DISPLAY_HZ:
- y = mGraphRect.mBottom + (1.f / time.value()) * hz_scale_factor;
- break;
- }
- gGL.vertex2f(x,y);
- gGL.vertex2f(x,mGraphRect.mBottom);
- }
- gGL.end();
-
- if (mHoverID == idp)
- {
- gGL.flush();
- glLineWidth(1);
- }
-
- if (idp->getTreeNode().mCollapsed)
- {
- //skip hidden timers
- it.skipDescendants();
- }
- }
-
- //interpolate towards new maximum
- max_time = (F32Seconds)lerp(max_time.value(), cur_max.value(), LLSmoothInterpolation::getInterpolant(0.1f));
- if (llabs((max_time - cur_max).value()) <= 1)
- {
- max_time = llmax(F32Microseconds(1.f), F32Microseconds(cur_max));
- }
-
- max_calls = ll_round(lerp((F32)max_calls, (F32) cur_max_calls, LLSmoothInterpolation::getInterpolant(0.1f)));
- if (llabs((S32)(max_calls - cur_max_calls)) <= 1)
- {
- max_calls = cur_max_calls;
- }
-
- // TODO: make sure alpha is correct in DisplayHz mode
- F32 alpha_target = (max_time > cur_max)
- ? llmin(max_time / cur_max - 1.f,1.f)
- : llmin(cur_max/ max_time - 1.f,1.f);
- alpha_interp = lerp(alpha_interp, alpha_target, LLSmoothInterpolation::getInterpolant(0.1f));
-
- if (mHoverID != NULL)
- {
- S32 x = (mGraphRect.mRight + mGraphRect.mLeft)/2;
- S32 y = mGraphRect.mBottom + 8;
-
- LLFontGL::getFontMonospace()->renderUTF8(
- mHoverID->getName(),
- 0,
- x, y,
- LLColor4::white,
- LLFontGL::LEFT, LLFontGL::BOTTOM);
- }
-
- //display y-axis range
- std::string axis_label;
- switch(mDisplayType)
- {
- case DISPLAY_TIME:
- axis_label = llformat("%4.2f ms", F32Milliseconds(max_time).value());
- break;
- case DISPLAY_CALLS:
- axis_label = llformat("%d calls", (int)max_calls);
- break;
- case DISPLAY_HZ:
- axis_label = llformat("%4.2f Hz", max_time.value() ? 1.f / max_time.value() : 0.f);
- break;
- }
-
- LLFontGL* font = LLFontGL::getFontMonospace();
- S32 x = mGraphRect.mRight - font->getWidth(axis_label)-5;
- S32 y = mGraphRect.mTop - font->getLineHeight();;
-
- font->renderUTF8(axis_label, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+ case DISPLAY_TIME:
+ y = mGraphRect.mBottom + time.value() * time_scale_factor;
+ break;
+ case DISPLAY_CALLS:
+ y = mGraphRect.mBottom + (F32)calls * call_scale_factor;
+ break;
+ case DISPLAY_HZ:
+ y = mGraphRect.mBottom + (1.f / time.value()) * hz_scale_factor;
+ break;
+ }
+ gGL.vertex2f(x,y);
+ gGL.vertex2f(x,mGraphRect.mBottom);
+ }
+ gGL.end();
+
+ if (mHoverID == idp)
+ {
+ gGL.flush();
+ glLineWidth(1);
+ }
+
+ if (idp->getTreeNode().mCollapsed)
+ {
+ //skip hidden timers
+ it.skipDescendants();
+ }
+ }
+
+ //interpolate towards new maximum
+ max_time = (F32Seconds)lerp(max_time.value(), cur_max.value(), LLSmoothInterpolation::getInterpolant(0.1f));
+ if (llabs((max_time - cur_max).value()) <= 1)
+ {
+ max_time = llmax(F32Microseconds(1.f), F32Microseconds(cur_max));
+ }
+
+ max_calls = ll_round(lerp((F32)max_calls, (F32) cur_max_calls, LLSmoothInterpolation::getInterpolant(0.1f)));
+ if (llabs((S32)(max_calls - cur_max_calls)) <= 1)
+ {
+ max_calls = cur_max_calls;
+ }
+
+ // TODO: make sure alpha is correct in DisplayHz mode
+ F32 alpha_target = (max_time > cur_max)
+ ? llmin(max_time / cur_max - 1.f,1.f)
+ : llmin(cur_max/ max_time - 1.f,1.f);
+ alpha_interp = lerp(alpha_interp, alpha_target, LLSmoothInterpolation::getInterpolant(0.1f));
+
+ if (mHoverID != NULL)
+ {
+ S32 x = (mGraphRect.mRight + mGraphRect.mLeft)/2;
+ S32 y = mGraphRect.mBottom + 8;
+
+ LLFontGL::getFontMonospace()->renderUTF8(
+ mHoverID->getName(),
+ 0,
+ x, y,
+ LLColor4::white,
+ LLFontGL::LEFT, LLFontGL::BOTTOM);
+ }
+
+ //display y-axis range
+ std::string axis_label;
+ switch(mDisplayType)
+ {
+ case DISPLAY_TIME:
+ axis_label = llformat("%4.2f ms", F32Milliseconds(max_time).value());
+ break;
+ case DISPLAY_CALLS:
+ axis_label = llformat("%d calls", (int)max_calls);
+ break;
+ case DISPLAY_HZ:
+ axis_label = llformat("%4.2f Hz", max_time.value() ? 1.f / max_time.value() : 0.f);
+ break;
+ }
+
+ LLFontGL* font = LLFontGL::getFontMonospace();
+ S32 x = mGraphRect.mRight - font->getWidth(axis_label)-5;
+ S32 y = mGraphRect.mTop - font->getLineHeight();;
+
+ font->renderUTF8(axis_label, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
}
void LLFastTimerView::drawLegend()
{
- // draw legend
- S32 dx;
- S32 x = mLegendRect.mLeft;
- S32 y = mLegendRect.mTop;
- const S32 TEXT_HEIGHT = (S32)LLFontGL::getFontMonospace()->getLineHeight();
-
- {
- LLLocalClipRect clip(mLegendRect);
- S32 cur_line = 0;
- S32 scroll_offset = 0; // element's y offset from top of the inner scroll's rect
- ft_display_idx.clear();
- std::map<BlockTimerStatHandle*, S32> display_line;
- for (LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
- it != LLTrace::end_block_timer_tree_df();
- ++it)
- {
- BlockTimerStatHandle* idp = (*it);
- // Needed to figure out offsets and parenting
- display_line[idp] = cur_line;
- cur_line++;
- if (scroll_offset < mScrollBar->getDocPos())
- {
- // only offset for visible items
- scroll_offset += TEXT_HEIGHT + 2;
- if (idp->getTreeNode().mCollapsed)
- {
- it.skipDescendants();
- }
- continue;
- }
-
- // used for mouse clicks
- ft_display_idx.push_back(idp);
-
- // Actual draw, first bar (square), then text
- x = MARGIN;
-
- LLRect bar_rect(x, y, x + TEXT_HEIGHT, y - TEXT_HEIGHT);
- S32 scale_offset = 0;
- if (idp == mHoverID)
- {
- scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 2.f);
- }
- bar_rect.stretch(scale_offset);
- llassert(idp->getIndex() < sTimerColors.size());
- gl_rect_2d(bar_rect, sTimerColors[idp->getIndex()]);
-
- F32Milliseconds ms(0);
- S32 calls = 0;
- if (mHoverBarIndex > 0 && mHoverID)
- {
- S32 hidx = mScrollIndex + mHoverBarIndex;
- ms = mRecording.getPrevRecording(hidx).getSum(*idp);
- calls = mRecording.getPrevRecording(hidx).getSum(idp->callCount());
- }
- else
- {
- ms = F64Seconds(mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH));
- calls = (S32)mRecording.getPeriodMean(idp->callCount(), RUNNING_AVERAGE_WIDTH);
- }
-
- std::string timer_label;
- switch(mDisplayType)
- {
- case DISPLAY_TIME:
- timer_label = llformat("%s [%.1f]",idp->getName().c_str(),ms.value());
- break;
- case DISPLAY_CALLS:
- timer_label = llformat("%s (%d)",idp->getName().c_str(),calls);
- break;
- case DISPLAY_HZ:
- timer_label = llformat("%.1f", ms.value() ? (1.f / ms.value()) : 0.f);
- break;
- }
- dx = (TEXT_HEIGHT+4) + get_depth(idp)*8;
-
- LLColor4 color = LLColor4::white;
- if (get_depth(idp) > 0)
- {
- S32 line_start_y = bar_rect.getCenterY();
- S32 line_end_y = line_start_y + ((TEXT_HEIGHT + 2) * (cur_line - display_line[idp->getParent()])) - TEXT_HEIGHT;
- gl_line_2d(x + dx - 8, line_start_y, x + dx, line_start_y, color);
- S32 line_x = x + (TEXT_HEIGHT + 4) + ((get_depth(idp) - 1) * 8);
- gl_line_2d(line_x, line_start_y, line_x, line_end_y, color);
- if (idp->getTreeNode().mCollapsed && !idp->getChildren().empty())
- {
- gl_line_2d(line_x+4, line_start_y-3, line_x+4, line_start_y+4, color);
- }
- }
-
- x += dx;
- BOOL is_child_of_hover_item = (idp == mHoverID);
- BlockTimerStatHandle* next_parent = idp->getParent();
- while(!is_child_of_hover_item && next_parent)
- {
- is_child_of_hover_item = (mHoverID == next_parent);
- if (next_parent->getParent() == next_parent) break;
- next_parent = next_parent->getParent();
- }
-
- LLFontGL::getFontMonospace()->renderUTF8(timer_label, 0,
- x, y,
- color,
- LLFontGL::LEFT, LLFontGL::TOP,
- is_child_of_hover_item ? LLFontGL::BOLD : LLFontGL::NORMAL);
-
- y -= (TEXT_HEIGHT + 2);
-
- scroll_offset += TEXT_HEIGHT + 2;
- if (idp->getTreeNode().mCollapsed)
- {
- it.skipDescendants();
- }
- }
- // Recalculate scroll size
- mScrollBar->setDocSize(scroll_offset - mLegendRect.getHeight());
- }
+ // draw legend
+ S32 dx;
+ S32 x = mLegendRect.mLeft;
+ S32 y = mLegendRect.mTop;
+ const S32 TEXT_HEIGHT = (S32)LLFontGL::getFontMonospace()->getLineHeight();
+
+ {
+ LLLocalClipRect clip(mLegendRect);
+ S32 cur_line = 0;
+ S32 scroll_offset = 0; // element's y offset from top of the inner scroll's rect
+ ft_display_idx.clear();
+ std::map<BlockTimerStatHandle*, S32> display_line;
+ for (LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
+ it != LLTrace::end_block_timer_tree_df();
+ ++it)
+ {
+ BlockTimerStatHandle* idp = (*it);
+ // Needed to figure out offsets and parenting
+ display_line[idp] = cur_line;
+ cur_line++;
+ if (scroll_offset < mScrollBar->getDocPos())
+ {
+ // only offset for visible items
+ scroll_offset += TEXT_HEIGHT + 2;
+ if (idp->getTreeNode().mCollapsed)
+ {
+ it.skipDescendants();
+ }
+ continue;
+ }
+
+ // used for mouse clicks
+ ft_display_idx.push_back(idp);
+
+ // Actual draw, first bar (square), then text
+ x = MARGIN;
+
+ LLRect bar_rect(x, y, x + TEXT_HEIGHT, y - TEXT_HEIGHT);
+ S32 scale_offset = 0;
+ if (idp == mHoverID)
+ {
+ scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 2.f);
+ }
+ bar_rect.stretch(scale_offset);
+ llassert(idp->getIndex() < sTimerColors.size());
+ gl_rect_2d(bar_rect, sTimerColors[idp->getIndex()]);
+
+ F32Milliseconds ms(0);
+ S32 calls = 0;
+ if (mHoverBarIndex > 0 && mHoverID)
+ {
+ S32 hidx = mScrollIndex + mHoverBarIndex;
+ ms = mRecording.getPrevRecording(hidx).getSum(*idp);
+ calls = mRecording.getPrevRecording(hidx).getSum(idp->callCount());
+ }
+ else
+ {
+ ms = F64Seconds(mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH));
+ calls = (S32)mRecording.getPeriodMean(idp->callCount(), RUNNING_AVERAGE_WIDTH);
+ }
+
+ std::string timer_label;
+ switch(mDisplayType)
+ {
+ case DISPLAY_TIME:
+ timer_label = llformat("%s [%.1f]",idp->getName().c_str(),ms.value());
+ break;
+ case DISPLAY_CALLS:
+ timer_label = llformat("%s (%d)",idp->getName().c_str(),calls);
+ break;
+ case DISPLAY_HZ:
+ timer_label = llformat("%.1f", ms.value() ? (1.f / ms.value()) : 0.f);
+ break;
+ }
+ dx = (TEXT_HEIGHT+4) + get_depth(idp)*8;
+
+ LLColor4 color = LLColor4::white;
+ if (get_depth(idp) > 0)
+ {
+ S32 line_start_y = bar_rect.getCenterY();
+ S32 line_end_y = line_start_y + ((TEXT_HEIGHT + 2) * (cur_line - display_line[idp->getParent()])) - TEXT_HEIGHT;
+ gl_line_2d(x + dx - 8, line_start_y, x + dx, line_start_y, color);
+ S32 line_x = x + (TEXT_HEIGHT + 4) + ((get_depth(idp) - 1) * 8);
+ gl_line_2d(line_x, line_start_y, line_x, line_end_y, color);
+ if (idp->getTreeNode().mCollapsed && !idp->getChildren().empty())
+ {
+ gl_line_2d(line_x+4, line_start_y-3, line_x+4, line_start_y+4, color);
+ }
+ }
+
+ x += dx;
+ BOOL is_child_of_hover_item = (idp == mHoverID);
+ BlockTimerStatHandle* next_parent = idp->getParent();
+ while(!is_child_of_hover_item && next_parent)
+ {
+ is_child_of_hover_item = (mHoverID == next_parent);
+ if (next_parent->getParent() == next_parent) break;
+ next_parent = next_parent->getParent();
+ }
+
+ LLFontGL::getFontMonospace()->renderUTF8(timer_label, 0,
+ x, y,
+ color,
+ LLFontGL::LEFT, LLFontGL::TOP,
+ is_child_of_hover_item ? LLFontGL::BOLD : LLFontGL::NORMAL);
+
+ y -= (TEXT_HEIGHT + 2);
+
+ scroll_offset += TEXT_HEIGHT + 2;
+ if (idp->getTreeNode().mCollapsed)
+ {
+ it.skipDescendants();
+ }
+ }
+ // Recalculate scroll size
+ mScrollBar->setDocSize(scroll_offset - mLegendRect.getHeight());
+ }
}
void LLFastTimerView::generateUniqueColors()
{
- // generate unique colors
- {
- sTimerColors.resize(LLTrace::BlockTimerStatHandle::getNumIndices());
- sTimerColors[FTM_FRAME.getIndex()] = LLColor4::grey;
-
- F32 hue = 0.f;
-
- for (LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
- it != LLTrace::end_block_timer_tree_df();
- ++it)
- {
- BlockTimerStatHandle* idp = (*it);
-
- const F32 HUE_INCREMENT = 0.23f;
- hue = fmodf(hue + HUE_INCREMENT, 1.f);
- // saturation increases with depth
- F32 saturation = clamp_rescale((F32)get_depth(idp), 0.f, 3.f, 0.f, 1.f);
- // lightness alternates with depth
- F32 lightness = get_depth(idp) % 2 ? 0.5f : 0.6f;
-
- LLColor4 child_color;
- child_color.setHSL(hue, saturation, lightness);
-
- llassert(idp->getIndex() < sTimerColors.size());
- sTimerColors[idp->getIndex()] = child_color;
- }
- }
+ // generate unique colors
+ {
+ sTimerColors.resize(LLTrace::BlockTimerStatHandle::getNumIndices());
+ sTimerColors[FTM_FRAME.getIndex()] = LLColor4::grey;
+
+ F32 hue = 0.f;
+
+ for (LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
+ it != LLTrace::end_block_timer_tree_df();
+ ++it)
+ {
+ BlockTimerStatHandle* idp = (*it);
+
+ const F32 HUE_INCREMENT = 0.23f;
+ hue = fmodf(hue + HUE_INCREMENT, 1.f);
+ // saturation increases with depth
+ F32 saturation = clamp_rescale((F32)get_depth(idp), 0.f, 3.f, 0.f, 1.f);
+ // lightness alternates with depth
+ F32 lightness = get_depth(idp) % 2 ? 0.5f : 0.6f;
+
+ LLColor4 child_color;
+ child_color.setHSL(hue, saturation, lightness);
+
+ llassert(idp->getIndex() < sTimerColors.size());
+ sTimerColors[idp->getIndex()] = child_color;
+ }
+ }
}
void LLFastTimerView::drawHelp( S32 y )
{
- // Draw some help
- const S32 texth = (S32)LLFontGL::getFontMonospace()->getLineHeight();
+ // Draw some help
+ const S32 texth = (S32)LLFontGL::getFontMonospace()->getLineHeight();
- y -= (texth + 2);
- y -= (texth + 2);
+ y -= (texth + 2);
+ y -= (texth + 2);
- LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected]"),
- 0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+ LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected]"),
+ 0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
}
void LLFastTimerView::drawTicks()
{
- // Draw MS ticks
- {
- U32Milliseconds ms = mTotalTimeDisplay;
- std::string tick_label;
- S32 x;
- S32 barw = mBarRect.getWidth();
-
- tick_label = llformat("%.1f ms |", (F32)ms.value()*.25f);
- x = mBarRect.mLeft + barw/4 - LLFontGL::getFontMonospace()->getWidth(tick_label);
- LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white,
- LLFontGL::LEFT, LLFontGL::TOP);
-
- tick_label = llformat("%.1f ms |", (F32)ms.value()*.50f);
- x = mBarRect.mLeft + barw/2 - LLFontGL::getFontMonospace()->getWidth(tick_label);
- LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white,
- LLFontGL::LEFT, LLFontGL::TOP);
-
- tick_label = llformat("%.1f ms |", (F32)ms.value()*.75f);
- x = mBarRect.mLeft + (barw*3)/4 - LLFontGL::getFontMonospace()->getWidth(tick_label);
- LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white,
- LLFontGL::LEFT, LLFontGL::TOP);
-
- tick_label = llformat( "%d ms |", (U32)ms.value());
- x = mBarRect.mLeft + barw - LLFontGL::getFontMonospace()->getWidth(tick_label);
- LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white,
- LLFontGL::LEFT, LLFontGL::TOP);
- }
+ // Draw MS ticks
+ {
+ U32Milliseconds ms = mTotalTimeDisplay;
+ std::string tick_label;
+ S32 x;
+ S32 barw = mBarRect.getWidth();
+
+ tick_label = llformat("%.1f ms |", (F32)ms.value()*.25f);
+ x = mBarRect.mLeft + barw/4 - LLFontGL::getFontMonospace()->getWidth(tick_label);
+ LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white,
+ LLFontGL::LEFT, LLFontGL::TOP);
+
+ tick_label = llformat("%.1f ms |", (F32)ms.value()*.50f);
+ x = mBarRect.mLeft + barw/2 - LLFontGL::getFontMonospace()->getWidth(tick_label);
+ LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white,
+ LLFontGL::LEFT, LLFontGL::TOP);
+
+ tick_label = llformat("%.1f ms |", (F32)ms.value()*.75f);
+ x = mBarRect.mLeft + (barw*3)/4 - LLFontGL::getFontMonospace()->getWidth(tick_label);
+ LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white,
+ LLFontGL::LEFT, LLFontGL::TOP);
+
+ tick_label = llformat( "%d ms |", (U32)ms.value());
+ x = mBarRect.mLeft + barw - LLFontGL::getFontMonospace()->getWidth(tick_label);
+ LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white,
+ LLFontGL::LEFT, LLFontGL::TOP);
+ }
}
void LLFastTimerView::drawBorders( S32 y, const S32 x_start, S32 bar_height, S32 dy )
{
- // Draw borders
- {
- S32 by = y + 6 + (S32)LLFontGL::getFontMonospace()->getLineHeight();
+ // Draw borders
+ {
+ S32 by = y + 6 + (S32)LLFontGL::getFontMonospace()->getLineHeight();
- //heading
- gl_rect_2d(x_start-5, by, getRect().getWidth()-5, y+5, LLColor4::grey, FALSE);
+ //heading
+ gl_rect_2d(x_start-5, by, getRect().getWidth()-5, y+5, LLColor4::grey, FALSE);
- //tree view
- gl_rect_2d(5, by, x_start-10, 5, LLColor4::grey, FALSE);
+ //tree view
+ gl_rect_2d(5, by, x_start-10, 5, LLColor4::grey, FALSE);
- by = y + 5;
- //average bar
- gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-5, LLColor4::grey, FALSE);
+ by = y + 5;
+ //average bar
+ gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-5, LLColor4::grey, FALSE);
- by -= bar_height*2+dy;
+ by -= bar_height*2+dy;
- //current frame bar
- gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-2, LLColor4::grey, FALSE);
+ //current frame bar
+ gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-2, LLColor4::grey, FALSE);
- by -= bar_height+dy+1;
+ by -= bar_height+dy+1;
- //history bars
- gl_rect_2d(x_start-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-bar_height-dy-2, LLColor4::grey, FALSE);
+ //history bars
+ gl_rect_2d(x_start-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-bar_height-dy-2, LLColor4::grey, FALSE);
- by = LINE_GRAPH_HEIGHT-dy;
+ by = LINE_GRAPH_HEIGHT-dy;
- //line graph
- //mGraphRect = LLRect(x_start-5, by, getRect().getWidth()-5, 5);
+ //line graph
+ //mGraphRect = LLRect(x_start-5, by, getRect().getWidth()-5, 5);
- gl_rect_2d(mGraphRect, FALSE);
- }
+ gl_rect_2d(mGraphRect, FALSE);
+ }
}
void LLFastTimerView::updateTotalTime()
{
- switch(mDisplayMode)
- {
- case 0:
- mTotalTimeDisplay = mRecording.getPeriodMean(FTM_FRAME, RUNNING_AVERAGE_WIDTH)*2;
- break;
- case 1:
- mTotalTimeDisplay = mRecording.getPeriodMax(FTM_FRAME);
- break;
- case 2:
- // Calculate the max total ticks for the current history
- mTotalTimeDisplay = mRecording.getPeriodMax(FTM_FRAME, 20);
- break;
- default:
- mTotalTimeDisplay = F64Milliseconds(100);
- break;
- }
-
- mTotalTimeDisplay = LLUnits::Milliseconds::fromValue(llceil(mTotalTimeDisplay.valueInUnits<LLUnits::Milliseconds>() / 20.f) * 20.f);
+ switch(mDisplayMode)
+ {
+ case 0:
+ mTotalTimeDisplay = mRecording.getPeriodMean(FTM_FRAME, RUNNING_AVERAGE_WIDTH)*2;
+ break;
+ case 1:
+ mTotalTimeDisplay = mRecording.getPeriodMax(FTM_FRAME);
+ break;
+ case 2:
+ // Calculate the max total ticks for the current history
+ mTotalTimeDisplay = mRecording.getPeriodMax(FTM_FRAME, 20);
+ break;
+ default:
+ mTotalTimeDisplay = F64Milliseconds(100);
+ break;
+ }
+
+ mTotalTimeDisplay = LLUnits::Milliseconds::fromValue(llceil(mTotalTimeDisplay.valueInUnits<LLUnits::Milliseconds>() / 20.f) * 20.f);
}
void LLFastTimerView::drawBars()
{
LL_PROFILE_ZONE_SCOPED;
- LLLocalClipRect clip(mBarRect);
-
- S32 bar_height = mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2);
- const S32 vpad = llmax(1, bar_height / 4); // spacing between bars
- bar_height -= vpad;
-
- updateTotalTime();
- if (mTotalTimeDisplay <= (F32Seconds)0.0) return;
-
- drawTicks();
- const S32 bars_top = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4);
- drawBorders(bars_top, mBarRect.mLeft, bar_height, vpad);
-
- // Draw bars for each history entry
- // Special: 0 = show running average
- LLPointer<LLUIImage> bar_image = LLUI::getUIImage("Rounded_Square");
-
- const S32 image_width = bar_image->getTextureWidth();
- const S32 image_height = bar_image->getTextureHeight();
-
- gGL.getTexUnit(0)->bind(bar_image->getImage());
- {
- const S32 histmax = (S32)mRecording.getNumRecordedPeriods();
-
- // update widths
- if (!mPauseHistory)
- {
- U32 bar_index = 0;
- if (!mAverageTimerRow.mBars)
- {
- mAverageTimerRow.mBars = new TimerBar[LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount()];
- }
- updateTimerBarWidths(&FTM_FRAME, mAverageTimerRow, -1, bar_index);
- updateTimerBarOffsets(&FTM_FRAME, mAverageTimerRow);
-
- for (S32 history_index = 1; history_index <= histmax; history_index++)
- {
- llassert(history_index <= mTimerBarRows.size());
- TimerBarRow& row = mTimerBarRows[history_index - 1];
- bar_index = 0;
- if (!row.mBars)
- {
- row.mBars = new TimerBar[LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount()];
- updateTimerBarWidths(&FTM_FRAME, row, history_index, bar_index);
- updateTimerBarOffsets(&FTM_FRAME, row);
- }
- }
- }
-
- // draw bars
- LLRect frame_bar_rect;
- frame_bar_rect.setLeftTopAndSize(mBarRect.mLeft,
- bars_top,
- ll_round((mAverageTimerRow.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()),
- bar_height);
- mAverageTimerRow.mTop = frame_bar_rect.mTop;
- mAverageTimerRow.mBottom = frame_bar_rect.mBottom;
- drawBar(frame_bar_rect, mAverageTimerRow, image_width, image_height);
- frame_bar_rect.translate(0, -(bar_height + vpad + bar_height));
-
- for(S32 bar_index = mScrollIndex; bar_index < llmin(histmax, mScrollIndex + MAX_VISIBLE_HISTORY); ++bar_index)
- {
- llassert(bar_index < mTimerBarRows.size());
- TimerBarRow& row = mTimerBarRows[bar_index];
- row.mTop = frame_bar_rect.mTop;
- row.mBottom = frame_bar_rect.mBottom;
- frame_bar_rect.mRight = frame_bar_rect.mLeft
- + ll_round((row.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth());
- drawBar(frame_bar_rect, row, image_width, image_height);
-
- frame_bar_rect.translate(0, -(bar_height + vpad));
- }
-
- }
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLLocalClipRect clip(mBarRect);
+
+ S32 bar_height = mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2);
+ const S32 vpad = llmax(1, bar_height / 4); // spacing between bars
+ bar_height -= vpad;
+
+ updateTotalTime();
+ if (mTotalTimeDisplay <= (F32Seconds)0.0) return;
+
+ drawTicks();
+ const S32 bars_top = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4);
+ drawBorders(bars_top, mBarRect.mLeft, bar_height, vpad);
+
+ // Draw bars for each history entry
+ // Special: 0 = show running average
+ LLPointer<LLUIImage> bar_image = LLUI::getUIImage("Rounded_Square");
+
+ const S32 image_width = bar_image->getTextureWidth();
+ const S32 image_height = bar_image->getTextureHeight();
+
+ gGL.getTexUnit(0)->bind(bar_image->getImage());
+ {
+ const S32 histmax = (S32)mRecording.getNumRecordedPeriods();
+
+ // update widths
+ if (!mPauseHistory)
+ {
+ U32 bar_index = 0;
+ if (!mAverageTimerRow.mBars)
+ {
+ mAverageTimerRow.mBars = new TimerBar[LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount()];
+ }
+ updateTimerBarWidths(&FTM_FRAME, mAverageTimerRow, -1, bar_index);
+ updateTimerBarOffsets(&FTM_FRAME, mAverageTimerRow);
+
+ for (S32 history_index = 1; history_index <= histmax; history_index++)
+ {
+ llassert(history_index <= mTimerBarRows.size());
+ TimerBarRow& row = mTimerBarRows[history_index - 1];
+ bar_index = 0;
+ if (!row.mBars)
+ {
+ row.mBars = new TimerBar[LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount()];
+ updateTimerBarWidths(&FTM_FRAME, row, history_index, bar_index);
+ updateTimerBarOffsets(&FTM_FRAME, row);
+ }
+ }
+ }
+
+ // draw bars
+ LLRect frame_bar_rect;
+ frame_bar_rect.setLeftTopAndSize(mBarRect.mLeft,
+ bars_top,
+ ll_round((mAverageTimerRow.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()),
+ bar_height);
+ mAverageTimerRow.mTop = frame_bar_rect.mTop;
+ mAverageTimerRow.mBottom = frame_bar_rect.mBottom;
+ drawBar(frame_bar_rect, mAverageTimerRow, image_width, image_height);
+ frame_bar_rect.translate(0, -(bar_height + vpad + bar_height));
+
+ for(S32 bar_index = mScrollIndex; bar_index < llmin(histmax, mScrollIndex + MAX_VISIBLE_HISTORY); ++bar_index)
+ {
+ llassert(bar_index < mTimerBarRows.size());
+ TimerBarRow& row = mTimerBarRows[bar_index];
+ row.mTop = frame_bar_rect.mTop;
+ row.mBottom = frame_bar_rect.mBottom;
+ frame_bar_rect.mRight = frame_bar_rect.mLeft
+ + ll_round((row.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth());
+ drawBar(frame_bar_rect, row, image_width, image_height);
+
+ frame_bar_rect.translate(0, -(bar_height + vpad));
+ }
+
+ }
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
F32Seconds LLFastTimerView::updateTimerBarWidths(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 history_index, U32& bar_index)
{
LL_PROFILE_ZONE_SCOPED;
- const F32Seconds self_time = history_index == -1
- ? mRecording.getPeriodMean(time_block->selfTime(), RUNNING_AVERAGE_WIDTH)
- : mRecording.getPrevRecording(history_index).getSum(time_block->selfTime());
-
- F32Seconds full_time = self_time;
-
- // reserve a spot for this bar to be rendered before its children
- // even though we don't know its size yet
- TimerBar& timer_bar = row.mBars[bar_index];
- bar_index++;
-
- for (BlockTimerStatHandle::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren(); it != end_it; ++it)
- {
- full_time += updateTimerBarWidths(*it, row, history_index, bar_index);
- }
-
- timer_bar.mTotalTime = full_time;
- timer_bar.mSelfTime = self_time;
- timer_bar.mTimeBlock = time_block;
-
- return full_time;
+ const F32Seconds self_time = history_index == -1
+ ? mRecording.getPeriodMean(time_block->selfTime(), RUNNING_AVERAGE_WIDTH)
+ : mRecording.getPrevRecording(history_index).getSum(time_block->selfTime());
+
+ F32Seconds full_time = self_time;
+
+ // reserve a spot for this bar to be rendered before its children
+ // even though we don't know its size yet
+ TimerBar& timer_bar = row.mBars[bar_index];
+ bar_index++;
+
+ for (BlockTimerStatHandle::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren(); it != end_it; ++it)
+ {
+ full_time += updateTimerBarWidths(*it, row, history_index, bar_index);
+ }
+
+ timer_bar.mTotalTime = full_time;
+ timer_bar.mSelfTime = self_time;
+ timer_bar.mTimeBlock = time_block;
+
+ return full_time;
}
S32 LLFastTimerView::updateTimerBarOffsets(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 timer_bar_index)
{
LL_PROFILE_ZONE_SCOPED;
- TimerBar& timer_bar = row.mBars[timer_bar_index];
- const F32Seconds bar_time = timer_bar.mTotalTime - timer_bar.mSelfTime;
- timer_bar.mChildrenStart = timer_bar.mSelfStart + timer_bar.mSelfTime / 2;
- timer_bar.mChildrenEnd = timer_bar.mChildrenStart + timer_bar.mTotalTime - timer_bar.mSelfTime;
-
- if (timer_bar_index == 0)
- {
- timer_bar.mSelfStart = F32Seconds(0.f);
- timer_bar.mSelfEnd = bar_time;
- }
-
- //now loop through children and figure out portion of bar image covered by each bar, now that we know the
- //sum of all children
- F32 bar_fraction_start = 0.f;
- TimerBar* last_child_timer_bar = NULL;
-
- bool first_child = true;
- for (BlockTimerStatHandle::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren();
- it != end_it;
- ++it)
- {
- timer_bar_index++;
-
- TimerBar& child_timer_bar = row.mBars[timer_bar_index];
- BlockTimerStatHandle* child_time_block = *it;
-
- if (last_child_timer_bar)
- {
- last_child_timer_bar->mLastChild = false;
- }
- child_timer_bar.mLastChild = true;
- last_child_timer_bar = &child_timer_bar;
-
- child_timer_bar.mFirstChild = first_child;
- if (first_child)
- {
- first_child = false;
- }
-
- child_timer_bar.mStartFraction = bar_fraction_start;
- child_timer_bar.mEndFraction = bar_time > (S32Seconds)0
- ? bar_fraction_start + child_timer_bar.mTotalTime / bar_time
- : 1.f;
- child_timer_bar.mSelfStart = timer_bar.mChildrenStart
- + child_timer_bar.mStartFraction
- * (timer_bar.mChildrenEnd - timer_bar.mChildrenStart);
- child_timer_bar.mSelfEnd = timer_bar.mChildrenStart
- + child_timer_bar.mEndFraction
- * (timer_bar.mChildrenEnd - timer_bar.mChildrenStart);
-
- timer_bar_index = updateTimerBarOffsets(child_time_block, row, timer_bar_index);
-
- bar_fraction_start = child_timer_bar.mEndFraction;
- }
- return timer_bar_index;
+ TimerBar& timer_bar = row.mBars[timer_bar_index];
+ const F32Seconds bar_time = timer_bar.mTotalTime - timer_bar.mSelfTime;
+ timer_bar.mChildrenStart = timer_bar.mSelfStart + timer_bar.mSelfTime / 2;
+ timer_bar.mChildrenEnd = timer_bar.mChildrenStart + timer_bar.mTotalTime - timer_bar.mSelfTime;
+
+ if (timer_bar_index == 0)
+ {
+ timer_bar.mSelfStart = F32Seconds(0.f);
+ timer_bar.mSelfEnd = bar_time;
+ }
+
+ //now loop through children and figure out portion of bar image covered by each bar, now that we know the
+ //sum of all children
+ F32 bar_fraction_start = 0.f;
+ TimerBar* last_child_timer_bar = NULL;
+
+ bool first_child = true;
+ for (BlockTimerStatHandle::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren();
+ it != end_it;
+ ++it)
+ {
+ timer_bar_index++;
+
+ TimerBar& child_timer_bar = row.mBars[timer_bar_index];
+ BlockTimerStatHandle* child_time_block = *it;
+
+ if (last_child_timer_bar)
+ {
+ last_child_timer_bar->mLastChild = false;
+ }
+ child_timer_bar.mLastChild = true;
+ last_child_timer_bar = &child_timer_bar;
+
+ child_timer_bar.mFirstChild = first_child;
+ if (first_child)
+ {
+ first_child = false;
+ }
+
+ child_timer_bar.mStartFraction = bar_fraction_start;
+ child_timer_bar.mEndFraction = bar_time > (S32Seconds)0
+ ? bar_fraction_start + child_timer_bar.mTotalTime / bar_time
+ : 1.f;
+ child_timer_bar.mSelfStart = timer_bar.mChildrenStart
+ + child_timer_bar.mStartFraction
+ * (timer_bar.mChildrenEnd - timer_bar.mChildrenStart);
+ child_timer_bar.mSelfEnd = timer_bar.mChildrenStart
+ + child_timer_bar.mEndFraction
+ * (timer_bar.mChildrenEnd - timer_bar.mChildrenStart);
+
+ timer_bar_index = updateTimerBarOffsets(child_time_block, row, timer_bar_index);
+
+ bar_fraction_start = child_timer_bar.mEndFraction;
+ }
+ return timer_bar_index;
}
S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, S32 image_height, bool hovered, bool visible, S32 bar_index)
{
LL_PROFILE_ZONE_SCOPED;
- TimerBar& timer_bar = row.mBars[bar_index];
- LLTrace::BlockTimerStatHandle* time_block = timer_bar.mTimeBlock;
-
- hovered |= mHoverID == time_block;
-
- // animate scale of bar when hovering over that particular timer
- if (visible && (F32)bar_rect.getWidth() * (timer_bar.mEndFraction - timer_bar.mStartFraction) > 2.f)
- {
- LLRect render_rect(bar_rect);
- S32 scale_offset = 0;
- if (mHoverID == time_block)
- {
- scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 3.f);
- render_rect.mTop += scale_offset;
- render_rect.mBottom -= scale_offset;
- }
-
- llassert(time_block->getIndex() < sTimerColors.size());
- LLColor4 color = sTimerColors[time_block->getIndex()];
- if (!hovered) color = lerp(color, LLColor4::grey, 0.2f);
- gGL.color4fv(color.mV);
- gl_segmented_rect_2d_fragment_tex(render_rect,
- image_width, image_height,
- 16,
- timer_bar.mStartFraction, timer_bar.mEndFraction);
- }
-
- LLRect children_rect;
- children_rect.mLeft = ll_round(timer_bar.mChildrenStart / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft;
- children_rect.mRight = ll_round(timer_bar.mChildrenEnd / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft;
-
- if (bar_rect.getHeight() > MIN_BAR_HEIGHT)
- {
- // shrink as we go down a level
- children_rect.mTop = bar_rect.mTop - 1;
- children_rect.mBottom = bar_rect.mBottom + 1;
- }
- else
- {
- children_rect.mTop = bar_rect.mTop;
- children_rect.mBottom = bar_rect.mBottom;
- }
-
- bool children_visible = visible && !time_block->getTreeNode().mCollapsed;
-
- bar_index++;
- const U32 num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount();
- if (bar_index < num_bars && row.mBars[bar_index].mFirstChild)
- {
- bool is_last = false;
- do
- {
- is_last = row.mBars[bar_index].mLastChild;
- bar_index = drawBar(children_rect, row, image_width, image_height, hovered, children_visible, bar_index);
- }
- while(!is_last && bar_index < num_bars);
- }
-
- return bar_index;
+ TimerBar& timer_bar = row.mBars[bar_index];
+ LLTrace::BlockTimerStatHandle* time_block = timer_bar.mTimeBlock;
+
+ hovered |= mHoverID == time_block;
+
+ // animate scale of bar when hovering over that particular timer
+ if (visible && (F32)bar_rect.getWidth() * (timer_bar.mEndFraction - timer_bar.mStartFraction) > 2.f)
+ {
+ LLRect render_rect(bar_rect);
+ S32 scale_offset = 0;
+ if (mHoverID == time_block)
+ {
+ scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 3.f);
+ render_rect.mTop += scale_offset;
+ render_rect.mBottom -= scale_offset;
+ }
+
+ llassert(time_block->getIndex() < sTimerColors.size());
+ LLColor4 color = sTimerColors[time_block->getIndex()];
+ if (!hovered) color = lerp(color, LLColor4::grey, 0.2f);
+ gGL.color4fv(color.mV);
+ gl_segmented_rect_2d_fragment_tex(render_rect,
+ image_width, image_height,
+ 16,
+ timer_bar.mStartFraction, timer_bar.mEndFraction);
+ }
+
+ LLRect children_rect;
+ children_rect.mLeft = ll_round(timer_bar.mChildrenStart / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft;
+ children_rect.mRight = ll_round(timer_bar.mChildrenEnd / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft;
+
+ if (bar_rect.getHeight() > MIN_BAR_HEIGHT)
+ {
+ // shrink as we go down a level
+ children_rect.mTop = bar_rect.mTop - 1;
+ children_rect.mBottom = bar_rect.mBottom + 1;
+ }
+ else
+ {
+ children_rect.mTop = bar_rect.mTop;
+ children_rect.mBottom = bar_rect.mBottom;
+ }
+
+ bool children_visible = visible && !time_block->getTreeNode().mCollapsed;
+
+ bar_index++;
+ const U32 num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount();
+ if (bar_index < num_bars && row.mBars[bar_index].mFirstChild)
+ {
+ bool is_last = false;
+ do
+ {
+ is_last = row.mBars[bar_index].mLastChild;
+ bar_index = drawBar(children_rect, row, image_width, image_height, hovered, children_visible, bar_index);
+ }
+ while(!is_last && bar_index < num_bars);
+ }
+
+ return bar_index;
}
diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h
index ff65f8da07..f9050bd926 100644
--- a/indra/newview/llfasttimerview.h
+++ b/indra/newview/llfasttimerview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfasttimerview.h
* @brief LLFastTimerView class definition
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,114 +38,114 @@ class LLScrollbar;
class LLFastTimerView : public LLFloater
{
public:
- LLFastTimerView(const LLSD&);
- ~LLFastTimerView();
- BOOL postBuild();
+ LLFastTimerView(const LLSD&);
+ ~LLFastTimerView();
+ BOOL postBuild();
- static BOOL sAnalyzePerformance;
+ static BOOL sAnalyzePerformance;
- static void outputAllMetrics();
- static void doAnalysis(std::string baseline, std::string target, std::string output);
+ static void outputAllMetrics();
+ static void doAnalysis(std::string baseline, std::string target, std::string output);
private:
- static void doAnalysisDefault(std::string baseline, std::string target, std::string output) ;
- static LLSD analyzePerformanceLogDefault(std::istream& is) ;
- static void exportCharts(const std::string& base, const std::string& target);
- void onPause();
+ static void doAnalysisDefault(std::string baseline, std::string target, std::string output) ;
+ static LLSD analyzePerformanceLogDefault(std::istream& is) ;
+ static void exportCharts(const std::string& base, const std::string& target);
+ void onPause();
public:
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
- virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
- virtual void draw();
- virtual void onOpen(const LLSD& key);
- virtual void onClose(bool app_quitting);
- LLTrace::BlockTimerStatHandle* getLegendID(S32 y);
-
-private:
- void drawTicks();
- void drawLineGraph();
- void drawLegend();
- void drawHelp(S32 y);
- void drawBorders( S32 y, const S32 x_start, S32 barh, S32 dy);
- void drawBars();
-
- void printLineStats();
- void generateUniqueColors();
- void updateTotalTime();
-
- struct TimerBar
- {
- TimerBar()
- : mTotalTime(0),
- mSelfTime(0),
- mStartFraction(0.f),
- mEndFraction(1.f),
- mFirstChild(false),
- mLastChild(false)
- {}
- F32Seconds mTotalTime,
- mSelfTime,
- mChildrenStart,
- mChildrenEnd,
- mSelfStart,
- mSelfEnd;
- LLTrace::BlockTimerStatHandle* mTimeBlock;
- bool mVisible,
- mFirstChild,
- mLastChild;
- F32 mStartFraction,
- mEndFraction;
- };
-
- struct TimerBarRow
- {
- TimerBarRow()
- : mBottom(0),
- mTop(0),
- mBars(NULL)
- {}
- S32 mBottom,
- mTop;
- TimerBar* mBars;
- };
-
- F32Seconds updateTimerBarWidths(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 history_index, U32& bar_index);
- S32 updateTimerBarOffsets(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 timer_bar_index = 0);
- S32 drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, S32 image_height, bool hovered = false, bool visible = true, S32 bar_index = 0);
- void setPauseState(bool pause_state);
-
- std::deque<TimerBarRow> mTimerBarRows;
- TimerBarRow mAverageTimerRow;
-
- enum EDisplayType
- {
- DISPLAY_TIME,
- DISPLAY_CALLS,
- DISPLAY_HZ
- } mDisplayType;
- bool mPauseHistory;
- F64Seconds mAllTimeMax,
- mTotalTimeDisplay;
- S32 mScrollIndex,
- mHoverBarIndex,
- mStatsIndex;
- S32 mDisplayMode;
- LLTrace::BlockTimerStatHandle* mHoverID;
- LLTrace::BlockTimerStatHandle* mHoverTimer;
- LLRect mToolTipRect,
- mGraphRect,
- mBarRect,
- mLegendRect;
- LLFrameTimer mHighlightTimer;
- LLTrace::PeriodicRecording mRecording;
-
- LLScrollbar* mScrollBar;
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+ virtual void draw();
+ virtual void onOpen(const LLSD& key);
+ virtual void onClose(bool app_quitting);
+ LLTrace::BlockTimerStatHandle* getLegendID(S32 y);
+
+private:
+ void drawTicks();
+ void drawLineGraph();
+ void drawLegend();
+ void drawHelp(S32 y);
+ void drawBorders( S32 y, const S32 x_start, S32 barh, S32 dy);
+ void drawBars();
+
+ void printLineStats();
+ void generateUniqueColors();
+ void updateTotalTime();
+
+ struct TimerBar
+ {
+ TimerBar()
+ : mTotalTime(0),
+ mSelfTime(0),
+ mStartFraction(0.f),
+ mEndFraction(1.f),
+ mFirstChild(false),
+ mLastChild(false)
+ {}
+ F32Seconds mTotalTime,
+ mSelfTime,
+ mChildrenStart,
+ mChildrenEnd,
+ mSelfStart,
+ mSelfEnd;
+ LLTrace::BlockTimerStatHandle* mTimeBlock;
+ bool mVisible,
+ mFirstChild,
+ mLastChild;
+ F32 mStartFraction,
+ mEndFraction;
+ };
+
+ struct TimerBarRow
+ {
+ TimerBarRow()
+ : mBottom(0),
+ mTop(0),
+ mBars(NULL)
+ {}
+ S32 mBottom,
+ mTop;
+ TimerBar* mBars;
+ };
+
+ F32Seconds updateTimerBarWidths(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 history_index, U32& bar_index);
+ S32 updateTimerBarOffsets(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 timer_bar_index = 0);
+ S32 drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, S32 image_height, bool hovered = false, bool visible = true, S32 bar_index = 0);
+ void setPauseState(bool pause_state);
+
+ std::deque<TimerBarRow> mTimerBarRows;
+ TimerBarRow mAverageTimerRow;
+
+ enum EDisplayType
+ {
+ DISPLAY_TIME,
+ DISPLAY_CALLS,
+ DISPLAY_HZ
+ } mDisplayType;
+ bool mPauseHistory;
+ F64Seconds mAllTimeMax,
+ mTotalTimeDisplay;
+ S32 mScrollIndex,
+ mHoverBarIndex,
+ mStatsIndex;
+ S32 mDisplayMode;
+ LLTrace::BlockTimerStatHandle* mHoverID;
+ LLTrace::BlockTimerStatHandle* mHoverTimer;
+ LLRect mToolTipRect,
+ mGraphRect,
+ mBarRect,
+ mLegendRect;
+ LLFrameTimer mHighlightTimer;
+ LLTrace::PeriodicRecording mRecording;
+
+ LLScrollbar* mScrollBar;
};
#endif
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index c1d8828229..d3c9cd26d7 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfavoritesbar.cpp
* @brief LLFavoritesBarCtrl class implementation
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,86 +67,86 @@ const S32 DROP_DOWN_MENU_TOP_PAD = 13;
class LLLandmarkInfoGetter
{
public:
- LLLandmarkInfoGetter()
- : mLandmarkID(LLUUID::null),
- mName("(Loading...)"),
- mPosX(0),
- mPosY(0),
- mPosZ(0),
- mLoaded(false)
- {
- mHandle.bind(this);
- }
-
- void setLandmarkID(const LLUUID& id) { mLandmarkID = id; }
- const LLUUID& getLandmarkId() const { return mLandmarkID; }
-
- const std::string& getName()
- {
- if(!mLoaded)
- requestNameAndPos();
-
- return mName;
- }
-
- S32 getPosX()
- {
- if (!mLoaded)
- requestNameAndPos();
- return mPosX;
- }
-
- S32 getPosY()
- {
- if (!mLoaded)
- requestNameAndPos();
- return mPosY;
- }
-
- S32 getPosZ()
- {
- if (!mLoaded)
- requestNameAndPos();
- return mPosZ;
- }
+ LLLandmarkInfoGetter()
+ : mLandmarkID(LLUUID::null),
+ mName("(Loading...)"),
+ mPosX(0),
+ mPosY(0),
+ mPosZ(0),
+ mLoaded(false)
+ {
+ mHandle.bind(this);
+ }
+
+ void setLandmarkID(const LLUUID& id) { mLandmarkID = id; }
+ const LLUUID& getLandmarkId() const { return mLandmarkID; }
+
+ const std::string& getName()
+ {
+ if(!mLoaded)
+ requestNameAndPos();
+
+ return mName;
+ }
+
+ S32 getPosX()
+ {
+ if (!mLoaded)
+ requestNameAndPos();
+ return mPosX;
+ }
+
+ S32 getPosY()
+ {
+ if (!mLoaded)
+ requestNameAndPos();
+ return mPosY;
+ }
+
+ S32 getPosZ()
+ {
+ if (!mLoaded)
+ requestNameAndPos();
+ return mPosZ;
+ }
private:
- /**
- * Requests landmark data from server.
- */
- void requestNameAndPos()
- {
- if (mLandmarkID.isNull())
- return;
-
- LLVector3d g_pos;
- if(LLLandmarkActions::getLandmarkGlobalPos(mLandmarkID, g_pos))
- {
- LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(g_pos,
- boost::bind(&LLLandmarkInfoGetter::landmarkNameCallback, static_cast<LLHandle<LLLandmarkInfoGetter> >(mHandle), _1, _2, _3, _4));
- }
- }
-
- static void landmarkNameCallback(LLHandle<LLLandmarkInfoGetter> handle, const std::string& name, S32 x, S32 y, S32 z)
- {
- LLLandmarkInfoGetter* getter = handle.get();
- if (getter)
- {
- getter->mPosX = x;
- getter->mPosY = y;
- getter->mPosZ = z;
- getter->mName = name;
- getter->mLoaded = true;
- }
- }
-
- LLUUID mLandmarkID;
- std::string mName;
- S32 mPosX;
- S32 mPosY;
- S32 mPosZ;
- bool mLoaded;
- LLRootHandle<LLLandmarkInfoGetter> mHandle;
+ /**
+ * Requests landmark data from server.
+ */
+ void requestNameAndPos()
+ {
+ if (mLandmarkID.isNull())
+ return;
+
+ LLVector3d g_pos;
+ if(LLLandmarkActions::getLandmarkGlobalPos(mLandmarkID, g_pos))
+ {
+ LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(g_pos,
+ boost::bind(&LLLandmarkInfoGetter::landmarkNameCallback, static_cast<LLHandle<LLLandmarkInfoGetter> >(mHandle), _1, _2, _3, _4));
+ }
+ }
+
+ static void landmarkNameCallback(LLHandle<LLLandmarkInfoGetter> handle, const std::string& name, S32 x, S32 y, S32 z)
+ {
+ LLLandmarkInfoGetter* getter = handle.get();
+ if (getter)
+ {
+ getter->mPosX = x;
+ getter->mPosY = y;
+ getter->mPosZ = z;
+ getter->mName = name;
+ getter->mLoaded = true;
+ }
+ }
+
+ LLUUID mLandmarkID;
+ std::string mName;
+ S32 mPosX;
+ S32 mPosY;
+ S32 mPosZ;
+ bool mLoaded;
+ LLRootHandle<LLLandmarkInfoGetter> mHandle;
};
/**
@@ -154,64 +154,64 @@ private:
* show SLURL as button tooltip.
* *NOTE: dzaporozhan: This is a workaround. We could set tooltips for buttons
* in createButtons function but landmark data is not available when Favorites Bar is
- * created. Thats why we are requesting landmark data after
+ * created. Thats why we are requesting landmark data after
*/
class LLFavoriteLandmarkButton : public LLButton
{
public:
- BOOL handleToolTip(S32 x, S32 y, MASK mask)
- {
- std::string region_name = mLandmarkInfoGetter.getName();
-
- if (!region_name.empty())
- {
- std::string extra_message = llformat("%s (%d, %d, %d)", region_name.c_str(),
- mLandmarkInfoGetter.getPosX(), mLandmarkInfoGetter.getPosY(), mLandmarkInfoGetter.getPosZ());
-
- LLToolTip::Params params;
- params.message = llformat("%s\n%s", getLabelSelected().c_str(), extra_message.c_str());
- params.max_width = 1000;
- params.sticky_rect = calcScreenRect();
-
- LLToolTipMgr::instance().show(params);
- }
- return TRUE;
- }
-
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask)
- {
- LLFavoritesBarCtrl* fb = dynamic_cast<LLFavoritesBarCtrl*>(getParent());
-
- if (fb)
- {
- fb->handleHover(x, y, mask);
- }
-
- return LLButton::handleHover(x, y, mask);
- }
-
- void setLandmarkID(const LLUUID& id){ mLandmarkInfoGetter.setLandmarkID(id); }
- const LLUUID& getLandmarkId() const { return mLandmarkInfoGetter.getLandmarkId(); }
-
- void onMouseEnter(S32 x, S32 y, MASK mask)
- {
- if (LLToolDragAndDrop::getInstance()->hasMouseCapture())
- {
- LLUICtrl::onMouseEnter(x, y, mask);
- }
- else
- {
- LLButton::onMouseEnter(x, y, mask);
- }
- }
+ BOOL handleToolTip(S32 x, S32 y, MASK mask)
+ {
+ std::string region_name = mLandmarkInfoGetter.getName();
+
+ if (!region_name.empty())
+ {
+ std::string extra_message = llformat("%s (%d, %d, %d)", region_name.c_str(),
+ mLandmarkInfoGetter.getPosX(), mLandmarkInfoGetter.getPosY(), mLandmarkInfoGetter.getPosZ());
+
+ LLToolTip::Params params;
+ params.message = llformat("%s\n%s", getLabelSelected().c_str(), extra_message.c_str());
+ params.max_width = 1000;
+ params.sticky_rect = calcScreenRect();
+
+ LLToolTipMgr::instance().show(params);
+ }
+ return TRUE;
+ }
+
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask)
+ {
+ LLFavoritesBarCtrl* fb = dynamic_cast<LLFavoritesBarCtrl*>(getParent());
+
+ if (fb)
+ {
+ fb->handleHover(x, y, mask);
+ }
+
+ return LLButton::handleHover(x, y, mask);
+ }
+
+ void setLandmarkID(const LLUUID& id){ mLandmarkInfoGetter.setLandmarkID(id); }
+ const LLUUID& getLandmarkId() const { return mLandmarkInfoGetter.getLandmarkId(); }
+
+ void onMouseEnter(S32 x, S32 y, MASK mask)
+ {
+ if (LLToolDragAndDrop::getInstance()->hasMouseCapture())
+ {
+ LLUICtrl::onMouseEnter(x, y, mask);
+ }
+ else
+ {
+ LLButton::onMouseEnter(x, y, mask);
+ }
+ }
protected:
- LLFavoriteLandmarkButton(const LLButton::Params& p) : LLButton(p) {}
- friend class LLUICtrlFactory;
+ LLFavoriteLandmarkButton(const LLButton::Params& p) : LLButton(p) {}
+ friend class LLUICtrlFactory;
private:
- LLLandmarkInfoGetter mLandmarkInfoGetter;
+ LLLandmarkInfoGetter mLandmarkInfoGetter;
};
/**
@@ -219,60 +219,60 @@ private:
* show SLURL as button tooltip.
* *NOTE: dzaporozhan: This is a workaround. We could set tooltips for buttons
* in showDropDownMenu function but landmark data is not available when Favorites Bar is
- * created. Thats why we are requesting landmark data after
+ * created. Thats why we are requesting landmark data after
*/
class LLFavoriteLandmarkMenuItem : public LLMenuItemCallGL
{
public:
- BOOL handleToolTip(S32 x, S32 y, MASK mask)
- {
- std::string region_name = mLandmarkInfoGetter.getName();
- if (!region_name.empty())
- {
- LLToolTip::Params params;
- params.message = llformat("%s\n%s (%d, %d)", getLabel().c_str(), region_name.c_str(), mLandmarkInfoGetter.getPosX(), mLandmarkInfoGetter.getPosY());
- params.sticky_rect = calcScreenRect();
- LLToolTipMgr::instance().show(params);
- }
- return TRUE;
- }
-
- void setLandmarkID(const LLUUID& id){ mLandmarkInfoGetter.setLandmarkID(id); }
-
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask)
- {
- if (mMouseDownSignal)
- (*mMouseDownSignal)(this, x, y, mask);
- return LLMenuItemCallGL::handleMouseDown(x, y, mask);
- }
-
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask)
- {
- if (mMouseUpSignal)
- (*mMouseUpSignal)(this, x, y, mask);
- return LLMenuItemCallGL::handleMouseUp(x, y, mask);
- }
-
- virtual BOOL handleHover(S32 x, S32 y, MASK mask)
- {
- if (fb)
- {
- fb->handleHover(x, y, mask);
- }
-
- return TRUE;
- }
-
- void initFavoritesBarPointer(LLFavoritesBarCtrl* fb) { this->fb = fb; }
+ BOOL handleToolTip(S32 x, S32 y, MASK mask)
+ {
+ std::string region_name = mLandmarkInfoGetter.getName();
+ if (!region_name.empty())
+ {
+ LLToolTip::Params params;
+ params.message = llformat("%s\n%s (%d, %d)", getLabel().c_str(), region_name.c_str(), mLandmarkInfoGetter.getPosX(), mLandmarkInfoGetter.getPosY());
+ params.sticky_rect = calcScreenRect();
+ LLToolTipMgr::instance().show(params);
+ }
+ return TRUE;
+ }
+
+ void setLandmarkID(const LLUUID& id){ mLandmarkInfoGetter.setLandmarkID(id); }
+
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask)
+ {
+ if (mMouseDownSignal)
+ (*mMouseDownSignal)(this, x, y, mask);
+ return LLMenuItemCallGL::handleMouseDown(x, y, mask);
+ }
+
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask)
+ {
+ if (mMouseUpSignal)
+ (*mMouseUpSignal)(this, x, y, mask);
+ return LLMenuItemCallGL::handleMouseUp(x, y, mask);
+ }
+
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask)
+ {
+ if (fb)
+ {
+ fb->handleHover(x, y, mask);
+ }
+
+ return TRUE;
+ }
+
+ void initFavoritesBarPointer(LLFavoritesBarCtrl* fb) { this->fb = fb; }
protected:
- LLFavoriteLandmarkMenuItem(const LLMenuItemCallGL::Params& p) : LLMenuItemCallGL(p) {}
- friend class LLUICtrlFactory;
+ LLFavoriteLandmarkMenuItem(const LLMenuItemCallGL::Params& p) : LLMenuItemCallGL(p) {}
+ friend class LLUICtrlFactory;
private:
- LLLandmarkInfoGetter mLandmarkInfoGetter;
- LLFavoritesBarCtrl* fb;
+ LLLandmarkInfoGetter mLandmarkInfoGetter;
+ LLFavoritesBarCtrl* fb;
};
/**
@@ -285,23 +285,23 @@ private:
class LLFavoriteLandmarkToggleableMenu : public LLToggleableMenu
{
public:
- virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
- {
- *accept = ACCEPT_NO;
- return TRUE;
- }
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
+ {
+ *accept = ACCEPT_NO;
+ return TRUE;
+ }
protected:
- LLFavoriteLandmarkToggleableMenu(const LLToggleableMenu::Params& p):
- LLToggleableMenu(p)
- {
- }
+ LLFavoriteLandmarkToggleableMenu(const LLToggleableMenu::Params& p):
+ LLToggleableMenu(p)
+ {
+ }
- friend class LLUICtrlFactory;
+ friend class LLUICtrlFactory;
};
/**
@@ -312,58 +312,58 @@ protected:
class LLItemCopiedCallback : public LLInventoryCallback
{
public:
- LLItemCopiedCallback(S32 sortField): mSortField(sortField) {}
+ LLItemCopiedCallback(S32 sortField): mSortField(sortField) {}
- virtual void fire(const LLUUID& inv_item)
- {
- LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ virtual void fire(const LLUUID& inv_item)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
- if (item)
- {
+ if (item)
+ {
LLFavoritesBarCtrl::sWaitingForCallabck = 0.f;
- LLFavoritesOrderStorage::instance().setSortIndex(item, mSortField);
+ LLFavoritesOrderStorage::instance().setSortIndex(item, mSortField);
- item->setComplete(TRUE);
- item->updateServer(FALSE);
+ item->setComplete(TRUE);
+ item->updateServer(FALSE);
- gInventory.updateItem(item);
- gInventory.notifyObservers();
- LLFavoritesOrderStorage::instance().saveOrder();
- }
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ LLFavoritesOrderStorage::instance().saveOrder();
+ }
- LLView::getWindow()->setCursor(UI_CURSOR_ARROW);
- }
+ LLView::getWindow()->setCursor(UI_CURSOR_ARROW);
+ }
private:
- S32 mSortField;
+ S32 mSortField;
};
// updateButtons's helper
struct LLFavoritesSort
{
- // Sorting by creation date and name
- // TODO - made it customizible using gSavedSettings
- bool operator()(const LLViewerInventoryItem* const& a, const LLViewerInventoryItem* const& b)
- {
- S32 sortField1 = LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID());
- S32 sortField2 = LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID());
-
- if (!(sortField1 < 0 && sortField2 < 0))
- {
- return sortField2 > sortField1;
- }
-
- time_t first_create = a->getCreationDate();
- time_t second_create = b->getCreationDate();
- if (first_create == second_create)
- {
- return (LLStringUtil::compareDict(a->getName(), b->getName()) < 0);
- }
- else
- {
- return (first_create > second_create);
- }
- }
+ // Sorting by creation date and name
+ // TODO - made it customizible using gSavedSettings
+ bool operator()(const LLViewerInventoryItem* const& a, const LLViewerInventoryItem* const& b)
+ {
+ S32 sortField1 = LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID());
+ S32 sortField2 = LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID());
+
+ if (!(sortField1 < 0 && sortField2 < 0))
+ {
+ return sortField2 > sortField1;
+ }
+
+ time_t first_create = a->getCreationDate();
+ time_t second_create = b->getCreationDate();
+ if (first_create == second_create)
+ {
+ return (LLStringUtil::compareDict(a->getName(), b->getName()) < 0);
+ }
+ else
+ {
+ return (first_create > second_create);
+ }
+ }
};
@@ -377,104 +377,104 @@ LLFavoritesBarCtrl::Params::Params()
}
LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p)
-: LLUICtrl(p),
- mFont(p.font.isProvided() ? p.font() : LLFontGL::getFontSansSerifSmall()),
- mOverflowMenuHandle(),
- mContextMenuHandle(),
- mImageDragIndication(p.image_drag_indication),
- mShowDragMarker(FALSE),
- mLandingTab(NULL),
- mLastTab(NULL),
+: LLUICtrl(p),
+ mFont(p.font.isProvided() ? p.font() : LLFontGL::getFontSansSerifSmall()),
+ mOverflowMenuHandle(),
+ mContextMenuHandle(),
+ mImageDragIndication(p.image_drag_indication),
+ mShowDragMarker(FALSE),
+ mLandingTab(NULL),
+ mLastTab(NULL),
mItemsListDirty(false),
- mUpdateDropDownItems(true),
- mRestoreOverflowMenu(false),
- mGetPrevItems(true),
- mMouseX(0),
- mMouseY(0),
- mItemsChangedTimer()
-{
- // Register callback for menus with current registrar (will be parent panel's registrar)
- LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Favorites.DoToSelected",
- boost::bind(&LLFavoritesBarCtrl::doToSelected, this, _2));
-
- // Add this if we need to selectively enable items
- LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Favorites.EnableSelected",
- boost::bind(&LLFavoritesBarCtrl::enableSelected, this, _2));
-
- gInventory.addObserver(this);
-
- //make chevron button
- LLTextBox::Params more_button_params(p.more_button);
- mMoreTextBox = LLUICtrlFactory::create<LLTextBox> (more_button_params);
- mMoreTextBox->setClickedCallback(boost::bind(&LLFavoritesBarCtrl::onMoreTextBoxClicked, this));
- addChild(mMoreTextBox);
- LLRect rect = mMoreTextBox->getRect();
- mMoreTextBox->setRect(LLRect(rect.mLeft - rect.getWidth(), rect.mTop, rect.mRight, rect.mBottom));
-
- mDropDownItemsCount = 0;
-
- LLTextBox::Params label_param(p.label);
- mBarLabel = LLUICtrlFactory::create<LLTextBox> (label_param);
- addChild(mBarLabel);
+ mUpdateDropDownItems(true),
+ mRestoreOverflowMenu(false),
+ mGetPrevItems(true),
+ mMouseX(0),
+ mMouseY(0),
+ mItemsChangedTimer()
+{
+ // Register callback for menus with current registrar (will be parent panel's registrar)
+ LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Favorites.DoToSelected",
+ boost::bind(&LLFavoritesBarCtrl::doToSelected, this, _2));
+
+ // Add this if we need to selectively enable items
+ LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Favorites.EnableSelected",
+ boost::bind(&LLFavoritesBarCtrl::enableSelected, this, _2));
+
+ gInventory.addObserver(this);
+
+ //make chevron button
+ LLTextBox::Params more_button_params(p.more_button);
+ mMoreTextBox = LLUICtrlFactory::create<LLTextBox> (more_button_params);
+ mMoreTextBox->setClickedCallback(boost::bind(&LLFavoritesBarCtrl::onMoreTextBoxClicked, this));
+ addChild(mMoreTextBox);
+ LLRect rect = mMoreTextBox->getRect();
+ mMoreTextBox->setRect(LLRect(rect.mLeft - rect.getWidth(), rect.mTop, rect.mRight, rect.mBottom));
+
+ mDropDownItemsCount = 0;
+
+ LLTextBox::Params label_param(p.label);
+ mBarLabel = LLUICtrlFactory::create<LLTextBox> (label_param);
+ addChild(mBarLabel);
}
LLFavoritesBarCtrl::~LLFavoritesBarCtrl()
{
- gInventory.removeObserver(this);
+ gInventory.removeObserver(this);
- if (mOverflowMenuHandle.get()) mOverflowMenuHandle.get()->die();
- if (mContextMenuHandle.get()) mContextMenuHandle.get()->die();
+ if (mOverflowMenuHandle.get()) mOverflowMenuHandle.get()->die();
+ if (mContextMenuHandle.get()) mContextMenuHandle.get()->die();
}
BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
-{
- *accept = ACCEPT_NO;
-
- LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
- if (LLToolDragAndDrop::SOURCE_AGENT != source && LLToolDragAndDrop::SOURCE_LIBRARY != source) return FALSE;
-
- switch (cargo_type)
- {
-
- case DAD_LANDMARK:
- {
- /*
- * add a callback to the end drag event.
- * the callback will disconnet itself immediately after execution
- * this is done because LLToolDragAndDrop is a common tool so it shouldn't
- * be overloaded with redundant callbacks.
- */
- if (!mEndDragConnection.connected())
- {
- mEndDragConnection = LLToolDragAndDrop::getInstance()->setEndDragCallback(boost::bind(&LLFavoritesBarCtrl::onEndDrag, this));
- }
-
- // Copy the item into the favorites folder (if it's not already there).
- LLInventoryItem *item = (LLInventoryItem *)cargo_data;
-
- if (LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(findChildByLocalCoords(x, y)))
- {
- setLandingTab(dest);
- }
- else if (mLastTab && (x >= mLastTab->getRect().mRight))
- {
- /*
- * the condition dest == NULL can be satisfied not only in the case
- * of dragging to the right from the last tab of the favbar. there is a
- * small gap between each tab. if the user drags something exactly there
- * then mLandingTab will be set to NULL and the dragged item will be pushed
- * to the end of the favorites bar. this is incorrect behavior. that's why
- * we need an additional check which excludes the case described previously
- * making sure that the mouse pointer is beyond the last tab.
- */
- setLandingTab(NULL);
- }
-
- // check if we are dragging an existing item from the favorites bar
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
+{
+ *accept = ACCEPT_NO;
+
+ LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
+ if (LLToolDragAndDrop::SOURCE_AGENT != source && LLToolDragAndDrop::SOURCE_LIBRARY != source) return FALSE;
+
+ switch (cargo_type)
+ {
+
+ case DAD_LANDMARK:
+ {
+ /*
+ * add a callback to the end drag event.
+ * the callback will disconnet itself immediately after execution
+ * this is done because LLToolDragAndDrop is a common tool so it shouldn't
+ * be overloaded with redundant callbacks.
+ */
+ if (!mEndDragConnection.connected())
+ {
+ mEndDragConnection = LLToolDragAndDrop::getInstance()->setEndDragCallback(boost::bind(&LLFavoritesBarCtrl::onEndDrag, this));
+ }
+
+ // Copy the item into the favorites folder (if it's not already there).
+ LLInventoryItem *item = (LLInventoryItem *)cargo_data;
+
+ if (LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(findChildByLocalCoords(x, y)))
+ {
+ setLandingTab(dest);
+ }
+ else if (mLastTab && (x >= mLastTab->getRect().mRight))
+ {
+ /*
+ * the condition dest == NULL can be satisfied not only in the case
+ * of dragging to the right from the last tab of the favbar. there is a
+ * small gap between each tab. if the user drags something exactly there
+ * then mLandingTab will be set to NULL and the dragged item will be pushed
+ * to the end of the favorites bar. this is incorrect behavior. that's why
+ * we need an additional check which excludes the case described previously
+ * making sure that the mouse pointer is beyond the last tab.
+ */
+ setLandingTab(NULL);
+ }
+
+ // check if we are dragging an existing item from the favorites bar
bool existing_drop = false;
if (item && mDragItemId == item->getUUID())
{
@@ -494,46 +494,46 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
}
if (existing_drop)
- {
- *accept = ACCEPT_YES_SINGLE;
-
- showDragMarker(TRUE);
-
- if (drop)
- {
- handleExistingFavoriteDragAndDrop(x, y);
- }
- }
- else
- {
- const LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- if (item->getParentUUID() == favorites_id)
- {
- LL_WARNS("FavoritesBar") << "Attemt to copy a favorite item into the same folder." << LL_ENDL;
- break;
- }
-
- *accept = ACCEPT_YES_COPY_MULTI;
-
- showDragMarker(TRUE);
-
- if (drop)
- {
- if (mItems.empty())
- {
- setLandingTab(NULL);
+ {
+ *accept = ACCEPT_YES_SINGLE;
+
+ showDragMarker(TRUE);
+
+ if (drop)
+ {
+ handleExistingFavoriteDragAndDrop(x, y);
+ }
+ }
+ else
+ {
+ const LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ if (item->getParentUUID() == favorites_id)
+ {
+ LL_WARNS("FavoritesBar") << "Attemt to copy a favorite item into the same folder." << LL_ENDL;
+ break;
+ }
+
+ *accept = ACCEPT_YES_COPY_MULTI;
+
+ showDragMarker(TRUE);
+
+ if (drop)
+ {
+ if (mItems.empty())
+ {
+ setLandingTab(NULL);
mLastTab = NULL;
- }
- handleNewFavoriteDragAndDrop(item, favorites_id, x, y);
- }
- }
- }
- break;
- default:
- break;
- }
-
- return TRUE;
+ }
+ handleNewFavoriteDragAndDrop(item, favorites_id, x, y);
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return TRUE;
}
void LLFavoritesBarCtrl::handleExistingFavoriteDragAndDrop(S32 x, S32 y)
@@ -544,159 +544,159 @@ void LLFavoritesBarCtrl::handleExistingFavoriteDragAndDrop(S32 x, S32 y)
return;
}
- // Identify the button hovered and the side to drop
- LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab);
- bool insert_before = true;
- if (!dest)
- {
- insert_before = false;
- dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab);
- }
-
- // There is no need to handle if an item was dragged onto itself
- if (dest && dest->getLandmarkId() == mDragItemId)
- {
- return;
- }
-
- // Insert the dragged item in the right place
- if (dest)
- {
- LLInventoryModel::updateItemsOrder(mItems, mDragItemId, dest->getLandmarkId(), insert_before);
- }
- else
- {
- // This can happen when the item list is empty
- mItems.push_back(gInventory.getItem(mDragItemId));
- }
-
- LLFavoritesOrderStorage::instance().saveItemsOrder(mItems);
-
- LLToggleableMenu* menu = (LLToggleableMenu*) mOverflowMenuHandle.get();
-
- if (menu && menu->getVisible())
- {
- menu->setVisible(FALSE);
- showDropDownMenu();
- }
+ // Identify the button hovered and the side to drop
+ LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab);
+ bool insert_before = true;
+ if (!dest)
+ {
+ insert_before = false;
+ dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab);
+ }
+
+ // There is no need to handle if an item was dragged onto itself
+ if (dest && dest->getLandmarkId() == mDragItemId)
+ {
+ return;
+ }
+
+ // Insert the dragged item in the right place
+ if (dest)
+ {
+ LLInventoryModel::updateItemsOrder(mItems, mDragItemId, dest->getLandmarkId(), insert_before);
+ }
+ else
+ {
+ // This can happen when the item list is empty
+ mItems.push_back(gInventory.getItem(mDragItemId));
+ }
+
+ LLFavoritesOrderStorage::instance().saveItemsOrder(mItems);
+
+ LLToggleableMenu* menu = (LLToggleableMenu*) mOverflowMenuHandle.get();
+
+ if (menu && menu->getVisible())
+ {
+ menu->setVisible(FALSE);
+ showDropDownMenu();
+ }
}
void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, const LLUUID& favorites_id, S32 x, S32 y)
{
- // Identify the button hovered and the side to drop
- LLFavoriteLandmarkButton* dest = NULL;
- bool insert_before = true;
- if (!mItems.empty())
- {
- // [MAINT-2386] When multiple landmarks are selected and dragged onto an empty favorites bar,
- // the viewer would crash when casting mLastTab below, as mLastTab is still null when the
- // second landmark is being added.
- // To ensure mLastTab is valid, we need to call updateButtons() at the end of this function
- dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab);
- if (!dest)
- {
- insert_before = false;
- dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab);
- }
- }
-
- // There is no need to handle if an item was dragged onto itself
- if (dest && dest->getLandmarkId() == mDragItemId)
- {
- return;
- }
-
- LLPointer<LLViewerInventoryItem> viewer_item = new LLViewerInventoryItem(item);
-
- // Insert the dragged item in the right place
- if (dest)
- {
- insertItem(mItems, dest->getLandmarkId(), viewer_item, insert_before);
- }
- else
- {
- // This can happen when the item list is empty
- mItems.push_back(viewer_item);
- }
-
- int sortField = 0;
- LLPointer<LLItemCopiedCallback> cb;
+ // Identify the button hovered and the side to drop
+ LLFavoriteLandmarkButton* dest = NULL;
+ bool insert_before = true;
+ if (!mItems.empty())
+ {
+ // [MAINT-2386] When multiple landmarks are selected and dragged onto an empty favorites bar,
+ // the viewer would crash when casting mLastTab below, as mLastTab is still null when the
+ // second landmark is being added.
+ // To ensure mLastTab is valid, we need to call updateButtons() at the end of this function
+ dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab);
+ if (!dest)
+ {
+ insert_before = false;
+ dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab);
+ }
+ }
+
+ // There is no need to handle if an item was dragged onto itself
+ if (dest && dest->getLandmarkId() == mDragItemId)
+ {
+ return;
+ }
+
+ LLPointer<LLViewerInventoryItem> viewer_item = new LLViewerInventoryItem(item);
+
+ // Insert the dragged item in the right place
+ if (dest)
+ {
+ insertItem(mItems, dest->getLandmarkId(), viewer_item, insert_before);
+ }
+ else
+ {
+ // This can happen when the item list is empty
+ mItems.push_back(viewer_item);
+ }
+
+ int sortField = 0;
+ LLPointer<LLItemCopiedCallback> cb;
const F64 CALLBACK_WAIT_TIME = 30.f;
sWaitingForCallabck = LLTimer::getTotalSeconds() + CALLBACK_WAIT_TIME;
- // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
- for (LLInventoryModel::item_array_t::iterator i = mItems.begin(); i != mItems.end(); ++i)
- {
- LLViewerInventoryItem* currItem = *i;
-
- if (currItem->getUUID() == item->getUUID())
- {
- cb = new LLItemCopiedCallback(++sortField);
- }
- else
- {
- LLFavoritesOrderStorage::instance().setSortIndex(currItem, ++sortField);
-
- currItem->setComplete(TRUE);
- currItem->updateServer(FALSE);
-
- gInventory.updateItem(currItem);
- }
- }
-
- LLToolDragAndDrop* tool_dad = LLToolDragAndDrop::getInstance();
- if (tool_dad->getSource() == LLToolDragAndDrop::SOURCE_NOTECARD)
- {
- viewer_item->setType(LLAssetType::AT_LANDMARK);
- copy_inventory_from_notecard(favorites_id,
- tool_dad->getObjectID(),
- tool_dad->getSourceID(),
- viewer_item.get(),
- gInventoryCallbacks.registerCB(cb));
- }
- else
- {
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- favorites_id,
- std::string(),
- cb);
- }
-
- // [MAINT-2386] Ensure the favorite button has been created and is valid.
- // This also ensures that mLastTab will be valid when dropping multiple
- // landmarks to an empty favorites bar.
- updateButtons();
-
- LL_INFOS("FavoritesBar") << "Copied inventory item #" << item->getUUID() << " to favorites." << LL_ENDL;
+ // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
+ for (LLInventoryModel::item_array_t::iterator i = mItems.begin(); i != mItems.end(); ++i)
+ {
+ LLViewerInventoryItem* currItem = *i;
+
+ if (currItem->getUUID() == item->getUUID())
+ {
+ cb = new LLItemCopiedCallback(++sortField);
+ }
+ else
+ {
+ LLFavoritesOrderStorage::instance().setSortIndex(currItem, ++sortField);
+
+ currItem->setComplete(TRUE);
+ currItem->updateServer(FALSE);
+
+ gInventory.updateItem(currItem);
+ }
+ }
+
+ LLToolDragAndDrop* tool_dad = LLToolDragAndDrop::getInstance();
+ if (tool_dad->getSource() == LLToolDragAndDrop::SOURCE_NOTECARD)
+ {
+ viewer_item->setType(LLAssetType::AT_LANDMARK);
+ copy_inventory_from_notecard(favorites_id,
+ tool_dad->getObjectID(),
+ tool_dad->getSourceID(),
+ viewer_item.get(),
+ gInventoryCallbacks.registerCB(cb));
+ }
+ else
+ {
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ favorites_id,
+ std::string(),
+ cb);
+ }
+
+ // [MAINT-2386] Ensure the favorite button has been created and is valid.
+ // This also ensures that mLastTab will be valid when dropping multiple
+ // landmarks to an empty favorites bar.
+ updateButtons();
+
+ LL_INFOS("FavoritesBar") << "Copied inventory item #" << item->getUUID() << " to favorites." << LL_ENDL;
}
//virtual
void LLFavoritesBarCtrl::changed(U32 mask)
{
- if (mFavoriteFolderId.isNull())
- {
- mFavoriteFolderId = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
-
- if (mFavoriteFolderId.notNull())
- {
- gInventory.fetchDescendentsOf(mFavoriteFolderId);
- }
- }
- else
- {
- LLInventoryModel::item_array_t items;
- LLInventoryModel::cat_array_t cats;
- LLIsType is_type(LLAssetType::AT_LANDMARK);
- gInventory.collectDescendentsIf(mFavoriteFolderId, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
-
- for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
- {
- LLFavoritesOrderStorage::instance().getSLURL((*i)->getAssetUUID());
- }
+ if (mFavoriteFolderId.isNull())
+ {
+ mFavoriteFolderId = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+
+ if (mFavoriteFolderId.notNull())
+ {
+ gInventory.fetchDescendentsOf(mFavoriteFolderId);
+ }
+ }
+ else
+ {
+ LLInventoryModel::item_array_t items;
+ LLInventoryModel::cat_array_t cats;
+ LLIsType is_type(LLAssetType::AT_LANDMARK);
+ gInventory.collectDescendentsIf(mFavoriteFolderId, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
+
+ for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
+ {
+ LLFavoritesOrderStorage::instance().getSLURL((*i)->getAssetUUID());
+ }
if (sWaitingForCallabck < LLTimer::getTotalSeconds())
{
@@ -714,7 +714,7 @@ void LLFavoritesBarCtrl::changed(U32 mask)
{
mItemsListDirty = true;
}
- }
+ }
}
//virtual
@@ -724,48 +724,48 @@ void LLFavoritesBarCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
S32 delta_height = height - getRect().getHeight();
bool force_update = delta_width || delta_height || sForceReshape;
- LLUICtrl::reshape(width, height, called_from_parent);
- updateButtons(force_update);
+ LLUICtrl::reshape(width, height, called_from_parent);
+ updateButtons(force_update);
}
void LLFavoritesBarCtrl::draw()
{
- LLUICtrl::draw();
-
- if (mShowDragMarker)
- {
- S32 w = mImageDragIndication->getWidth();
- S32 h = mImageDragIndication->getHeight();
-
- if (mLandingTab)
- {
- // mouse pointer hovers over an existing tab
- LLRect rect = mLandingTab->getRect();
- mImageDragIndication->draw(rect.mLeft, rect.getHeight(), w, h);
- }
- else if (mLastTab)
- {
- // mouse pointer hovers over the favbar empty space (right to the last tab)
- LLRect rect = mLastTab->getRect();
- mImageDragIndication->draw(rect.mRight, rect.getHeight(), w, h);
- }
- // Once drawn, mark this false so we won't draw it again (unless we hit the favorite bar again)
- mShowDragMarker = FALSE;
- }
- if (mItemsChangedTimer.getStarted())
- {
- if (mItemsChangedTimer.getElapsedTimeF32() > 1.f)
- {
- LLFavoritesOrderStorage::instance().saveFavoritesRecord();
- mItemsChangedTimer.stop();
- }
- }
-
- if(!mItemsChangedTimer.getStarted() && LLFavoritesOrderStorage::instance().mUpdateRequired)
- {
- LLFavoritesOrderStorage::instance().mUpdateRequired = false;
- mItemsChangedTimer.start();
- }
+ LLUICtrl::draw();
+
+ if (mShowDragMarker)
+ {
+ S32 w = mImageDragIndication->getWidth();
+ S32 h = mImageDragIndication->getHeight();
+
+ if (mLandingTab)
+ {
+ // mouse pointer hovers over an existing tab
+ LLRect rect = mLandingTab->getRect();
+ mImageDragIndication->draw(rect.mLeft, rect.getHeight(), w, h);
+ }
+ else if (mLastTab)
+ {
+ // mouse pointer hovers over the favbar empty space (right to the last tab)
+ LLRect rect = mLastTab->getRect();
+ mImageDragIndication->draw(rect.mRight, rect.getHeight(), w, h);
+ }
+ // Once drawn, mark this false so we won't draw it again (unless we hit the favorite bar again)
+ mShowDragMarker = FALSE;
+ }
+ if (mItemsChangedTimer.getStarted())
+ {
+ if (mItemsChangedTimer.getElapsedTimeF32() > 1.f)
+ {
+ LLFavoritesOrderStorage::instance().saveFavoritesRecord();
+ mItemsChangedTimer.stop();
+ }
+ }
+
+ if(!mItemsChangedTimer.getStarted() && LLFavoritesOrderStorage::instance().mUpdateRequired)
+ {
+ LLFavoritesOrderStorage::instance().mUpdateRequired = false;
+ mItemsChangedTimer.start();
+ }
if (mItemsListDirty && sWaitingForCallabck < LLTimer::getTotalSeconds())
{
@@ -783,21 +783,21 @@ void LLFavoritesBarCtrl::draw()
const LLButton::Params& LLFavoritesBarCtrl::getButtonParams()
{
- static LLButton::Params button_params;
- static bool params_initialized = false;
-
- if (!params_initialized)
- {
- LLXMLNodePtr button_xml_node;
- if(LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", button_xml_node))
- {
- LLXUIParser parser;
- parser.readXUI(button_xml_node, button_params, "favorites_bar_button.xml");
- }
- params_initialized = true;
- }
-
- return button_params;
+ static LLButton::Params button_params;
+ static bool params_initialized = false;
+
+ if (!params_initialized)
+ {
+ LLXMLNodePtr button_xml_node;
+ if(LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", button_xml_node))
+ {
+ LLXUIParser parser;
+ parser.readXUI(button_xml_node, button_params, "favorites_bar_button.xml");
+ }
+ params_initialized = true;
+ }
+
+ return button_params;
}
void LLFavoritesBarCtrl::updateButtons(bool force_update)
@@ -808,45 +808,45 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update)
}
mItemsListDirty = false;
- mItems.clear();
-
- if (!collectFavoriteItems(mItems))
- {
- return;
- }
-
- if(mGetPrevItems && gInventory.isCategoryComplete(mFavoriteFolderId))
- {
- for (LLInventoryModel::item_array_t::iterator it = mItems.begin(); it != mItems.end(); it++)
- {
- LLFavoritesOrderStorage::instance().mFavoriteNames[(*it)->getUUID()]= (*it)->getName();
- }
- LLFavoritesOrderStorage::instance().mPrevFavorites = mItems;
- mGetPrevItems = false;
-
- if (LLFavoritesOrderStorage::instance().isStorageUpdateNeeded())
- {
- if (!mItemsChangedTimer.getStarted())
- {
- mItemsChangedTimer.start();
- }
- }
- }
-
- const LLButton::Params& button_params = getButtonParams();
-
- if(mItems.empty())
- {
- mBarLabel->setVisible(TRUE);
+ mItems.clear();
+
+ if (!collectFavoriteItems(mItems))
+ {
+ return;
+ }
+
+ if(mGetPrevItems && gInventory.isCategoryComplete(mFavoriteFolderId))
+ {
+ for (LLInventoryModel::item_array_t::iterator it = mItems.begin(); it != mItems.end(); it++)
+ {
+ LLFavoritesOrderStorage::instance().mFavoriteNames[(*it)->getUUID()]= (*it)->getName();
+ }
+ LLFavoritesOrderStorage::instance().mPrevFavorites = mItems;
+ mGetPrevItems = false;
+
+ if (LLFavoritesOrderStorage::instance().isStorageUpdateNeeded())
+ {
+ if (!mItemsChangedTimer.getStarted())
+ {
+ mItemsChangedTimer.start();
+ }
+ }
+ }
+
+ const LLButton::Params& button_params = getButtonParams();
+
+ if(mItems.empty())
+ {
+ mBarLabel->setVisible(TRUE);
mLastTab = NULL;
- }
- else
- {
- mBarLabel->setVisible(FALSE);
- }
- const child_list_t* childs = getChildList();
- child_list_const_iter_t child_it = childs->begin();
- int first_changed_item_index = 0;
+ }
+ else
+ {
+ mBarLabel->setVisible(FALSE);
+ }
+ const child_list_t* childs = getChildList();
+ child_list_const_iter_t child_it = childs->begin();
+ int first_changed_item_index = 0;
if (!force_update)
{
//lets find first changed button
@@ -870,65 +870,65 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update)
child_it++;
}
}
- // now first_changed_item_index should contains a number of button that need to change
-
- if (first_changed_item_index <= mItems.size())
- {
- // Rebuild the buttons only
- // child_list_t is a linked list, so safe to erase from the middle if we pre-increment the iterator
-
- while (child_it != childs->end())
- {
- //lets remove other landmarks button and rebuild it
- child_list_const_iter_t cur_it = child_it++;
- LLFavoriteLandmarkButton* button =
- dynamic_cast<LLFavoriteLandmarkButton*> (*cur_it);
- if (button)
- {
+ // now first_changed_item_index should contains a number of button that need to change
+
+ if (first_changed_item_index <= mItems.size())
+ {
+ // Rebuild the buttons only
+ // child_list_t is a linked list, so safe to erase from the middle if we pre-increment the iterator
+
+ while (child_it != childs->end())
+ {
+ //lets remove other landmarks button and rebuild it
+ child_list_const_iter_t cur_it = child_it++;
+ LLFavoriteLandmarkButton* button =
+ dynamic_cast<LLFavoriteLandmarkButton*> (*cur_it);
+ if (button)
+ {
if (mLastTab == button)
{
mLastTab = NULL;
}
- removeChild(button);
- delete button;
- }
- }
- // we have to remove ChevronButton to make sure that the last item will be LandmarkButton to get the right aligning
- // keep in mind that we are cutting all buttons in space between the last visible child of favbar and ChevronButton
- if (mMoreTextBox->getParent() == this)
- {
- removeChild(mMoreTextBox);
- }
- int last_right_edge = 0;
- //calculate new buttons offset
- if (getChildList()->size() > 0)
- {
- //find last visible child to get the rightest button offset
- child_list_const_reverse_iter_t last_visible_it =
- std::find_if(
- childs->rbegin(), childs->rend(),
- [](const child_list_t::value_type& child)
- { return child->getVisible(); });
- if(last_visible_it != childs->rend())
- {
- last_right_edge = (*last_visible_it)->getRect().mRight;
- }
- }
- //last_right_edge is saving coordinates
- LLButton* last_new_button = NULL;
- int j = first_changed_item_index;
- for (; j < mItems.size(); j++)
- {
- last_new_button = createButton(mItems[j], button_params, last_right_edge);
- if (!last_new_button)
- {
- break;
- }
- sendChildToBack(last_new_button);
- last_right_edge = last_new_button->getRect().mRight;
-
- mLastTab = last_new_button;
- }
+ removeChild(button);
+ delete button;
+ }
+ }
+ // we have to remove ChevronButton to make sure that the last item will be LandmarkButton to get the right aligning
+ // keep in mind that we are cutting all buttons in space between the last visible child of favbar and ChevronButton
+ if (mMoreTextBox->getParent() == this)
+ {
+ removeChild(mMoreTextBox);
+ }
+ int last_right_edge = 0;
+ //calculate new buttons offset
+ if (getChildList()->size() > 0)
+ {
+ //find last visible child to get the rightest button offset
+ child_list_const_reverse_iter_t last_visible_it =
+ std::find_if(
+ childs->rbegin(), childs->rend(),
+ [](const child_list_t::value_type& child)
+ { return child->getVisible(); });
+ if(last_visible_it != childs->rend())
+ {
+ last_right_edge = (*last_visible_it)->getRect().mRight;
+ }
+ }
+ //last_right_edge is saving coordinates
+ LLButton* last_new_button = NULL;
+ int j = first_changed_item_index;
+ for (; j < mItems.size(); j++)
+ {
+ last_new_button = createButton(mItems[j], button_params, last_right_edge);
+ if (!last_new_button)
+ {
+ break;
+ }
+ sendChildToBack(last_new_button);
+ last_right_edge = last_new_button->getRect().mRight;
+
+ mLastTab = last_new_button;
+ }
if (!mLastTab && mItems.size() > 0)
{
// mMoreTextBox was removed, so LLFavoriteLandmarkButtons
@@ -940,348 +940,348 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update)
}
}
- mFirstDropDownItem = j;
- // Chevron button
- if (mFirstDropDownItem < mItems.size())
- {
- // if updateButton had been called it means:
- //or there are some new favorites, or width had been changed
- // so if we need to display chevron button, we must update dropdown items too.
- mUpdateDropDownItems = true;
- S32 buttonHGap = button_params.rect.left; // default value
- LLRect rect;
- // Chevron button should stay right aligned
- rect.setOriginAndSize(getRect().mRight - mMoreTextBox->getRect().getWidth() - buttonHGap, 0,
- mMoreTextBox->getRect().getWidth(),
- mMoreTextBox->getRect().getHeight());
-
- addChild(mMoreTextBox);
- mMoreTextBox->setRect(rect);
- mMoreTextBox->setVisible(TRUE);
- }
- // Update overflow menu
- LLToggleableMenu* overflow_menu = static_cast <LLToggleableMenu*> (mOverflowMenuHandle.get());
- if (overflow_menu && overflow_menu->getVisible() && (overflow_menu->getItemCount() != mDropDownItemsCount))
- {
- overflow_menu->setVisible(FALSE);
- if (mUpdateDropDownItems)
- {
- showDropDownMenu();
- }
- }
- }
- else
- {
- mUpdateDropDownItems = false;
- }
+ mFirstDropDownItem = j;
+ // Chevron button
+ if (mFirstDropDownItem < mItems.size())
+ {
+ // if updateButton had been called it means:
+ //or there are some new favorites, or width had been changed
+ // so if we need to display chevron button, we must update dropdown items too.
+ mUpdateDropDownItems = true;
+ S32 buttonHGap = button_params.rect.left; // default value
+ LLRect rect;
+ // Chevron button should stay right aligned
+ rect.setOriginAndSize(getRect().mRight - mMoreTextBox->getRect().getWidth() - buttonHGap, 0,
+ mMoreTextBox->getRect().getWidth(),
+ mMoreTextBox->getRect().getHeight());
+
+ addChild(mMoreTextBox);
+ mMoreTextBox->setRect(rect);
+ mMoreTextBox->setVisible(TRUE);
+ }
+ // Update overflow menu
+ LLToggleableMenu* overflow_menu = static_cast <LLToggleableMenu*> (mOverflowMenuHandle.get());
+ if (overflow_menu && overflow_menu->getVisible() && (overflow_menu->getItemCount() != mDropDownItemsCount))
+ {
+ overflow_menu->setVisible(FALSE);
+ if (mUpdateDropDownItems)
+ {
+ showDropDownMenu();
+ }
+ }
+ }
+ else
+ {
+ mUpdateDropDownItems = false;
+ }
}
LLButton* LLFavoritesBarCtrl::createButton(const LLPointer<LLViewerInventoryItem> item, const LLButton::Params& button_params, S32 x_offset)
{
- S32 def_button_width = button_params.rect.width;
- S32 button_x_delta = button_params.rect.left; // default value
- S32 curr_x = x_offset;
-
- /**
- * WORKAROUND:
- * There are some problem with displaying of fonts in buttons.
- * Empty space or ellipsis might be displayed instead of last symbols, even though the width of the button is enough.
- * The problem disappears if we pad the button with 20 pixels.
- */
- int required_width = mFont->getWidth(item->getName()) + 20;
- int width = required_width > def_button_width? def_button_width : required_width;
- LLFavoriteLandmarkButton* fav_btn = NULL;
-
- // do we have a place for next button + double buttonHGap + mMoreTextBox ?
- if(curr_x + width + 2*button_x_delta + mMoreTextBox->getRect().getWidth() > getRect().mRight )
- {
- return NULL;
- }
- LLButton::Params fav_btn_params(button_params);
- fav_btn = LLUICtrlFactory::create<LLFavoriteLandmarkButton>(fav_btn_params);
- if (NULL == fav_btn)
- {
- LL_WARNS("FavoritesBar") << "Unable to create LLFavoriteLandmarkButton widget: " << item->getName() << LL_ENDL;
- return NULL;
- }
-
- addChild(fav_btn);
-
- LLRect butt_rect (fav_btn->getRect());
- fav_btn->setLandmarkID(item->getUUID());
- butt_rect.setOriginAndSize(curr_x + button_x_delta, fav_btn->getRect().mBottom, width, fav_btn->getRect().getHeight());
-
- fav_btn->setRect(butt_rect);
- // change only left and save bottom
- fav_btn->setFont(mFont);
- fav_btn->setLabel(item->getName());
- fav_btn->setToolTip(item->getName());
- fav_btn->setCommitCallback(boost::bind(&LLFavoritesBarCtrl::onButtonClick, this, item->getUUID()));
- fav_btn->setRightMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonRightClick, this, item->getUUID(), _1, _2, _3,_4 ));
-
- fav_btn->LLUICtrl::setMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseDown, this, item->getUUID(), _1, _2, _3, _4));
- fav_btn->LLUICtrl::setMouseUpCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseUp, this, item->getUUID(), _1, _2, _3, _4));
-
- return fav_btn;
+ S32 def_button_width = button_params.rect.width;
+ S32 button_x_delta = button_params.rect.left; // default value
+ S32 curr_x = x_offset;
+
+ /**
+ * WORKAROUND:
+ * There are some problem with displaying of fonts in buttons.
+ * Empty space or ellipsis might be displayed instead of last symbols, even though the width of the button is enough.
+ * The problem disappears if we pad the button with 20 pixels.
+ */
+ int required_width = mFont->getWidth(item->getName()) + 20;
+ int width = required_width > def_button_width? def_button_width : required_width;
+ LLFavoriteLandmarkButton* fav_btn = NULL;
+
+ // do we have a place for next button + double buttonHGap + mMoreTextBox ?
+ if(curr_x + width + 2*button_x_delta + mMoreTextBox->getRect().getWidth() > getRect().mRight )
+ {
+ return NULL;
+ }
+ LLButton::Params fav_btn_params(button_params);
+ fav_btn = LLUICtrlFactory::create<LLFavoriteLandmarkButton>(fav_btn_params);
+ if (NULL == fav_btn)
+ {
+ LL_WARNS("FavoritesBar") << "Unable to create LLFavoriteLandmarkButton widget: " << item->getName() << LL_ENDL;
+ return NULL;
+ }
+
+ addChild(fav_btn);
+
+ LLRect butt_rect (fav_btn->getRect());
+ fav_btn->setLandmarkID(item->getUUID());
+ butt_rect.setOriginAndSize(curr_x + button_x_delta, fav_btn->getRect().mBottom, width, fav_btn->getRect().getHeight());
+
+ fav_btn->setRect(butt_rect);
+ // change only left and save bottom
+ fav_btn->setFont(mFont);
+ fav_btn->setLabel(item->getName());
+ fav_btn->setToolTip(item->getName());
+ fav_btn->setCommitCallback(boost::bind(&LLFavoritesBarCtrl::onButtonClick, this, item->getUUID()));
+ fav_btn->setRightMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonRightClick, this, item->getUUID(), _1, _2, _3,_4 ));
+
+ fav_btn->LLUICtrl::setMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseDown, this, item->getUUID(), _1, _2, _3, _4));
+ fav_btn->LLUICtrl::setMouseUpCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseUp, this, item->getUUID(), _1, _2, _3, _4));
+
+ return fav_btn;
}
BOOL LLFavoritesBarCtrl::postBuild()
{
- // make the popup menu available
- LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_favorites.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if (!menu)
- {
- menu = LLUICtrlFactory::getDefaultWidget<LLMenuGL>("inventory_menu");
- }
- menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor"));
- mContextMenuHandle = menu->getHandle();
+ // make the popup menu available
+ LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_favorites.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (!menu)
+ {
+ menu = LLUICtrlFactory::getDefaultWidget<LLMenuGL>("inventory_menu");
+ }
+ menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor"));
+ mContextMenuHandle = menu->getHandle();
- return TRUE;
+ return TRUE;
}
BOOL LLFavoritesBarCtrl::collectFavoriteItems(LLInventoryModel::item_array_t &items)
{
- if (mFavoriteFolderId.isNull())
- return FALSE;
-
+ if (mFavoriteFolderId.isNull())
+ return FALSE;
- LLInventoryModel::cat_array_t cats;
- LLIsType is_type(LLAssetType::AT_LANDMARK);
- gInventory.collectDescendentsIf(mFavoriteFolderId, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
+ LLInventoryModel::cat_array_t cats;
- std::sort(items.begin(), items.end(), LLFavoritesSort());
+ LLIsType is_type(LLAssetType::AT_LANDMARK);
+ gInventory.collectDescendentsIf(mFavoriteFolderId, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
- if (needToSaveItemsOrder(items))
- {
- S32 sortField = 0;
- for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
- {
- LLFavoritesOrderStorage::instance().setSortIndex((*i), ++sortField);
- }
- LLFavoritesOrderStorage::instance().mSaveOnExit = true;
- }
+ std::sort(items.begin(), items.end(), LLFavoritesSort());
- return TRUE;
+ if (needToSaveItemsOrder(items))
+ {
+ S32 sortField = 0;
+ for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
+ {
+ LLFavoritesOrderStorage::instance().setSortIndex((*i), ++sortField);
+ }
+ LLFavoritesOrderStorage::instance().mSaveOnExit = true;
+ }
+
+ return TRUE;
}
void LLFavoritesBarCtrl::onMoreTextBoxClicked()
{
- LLUI::getInstance()->getMousePositionScreen(&mMouseX, &mMouseY);
- showDropDownMenu();
+ LLUI::getInstance()->getMousePositionScreen(&mMouseX, &mMouseY);
+ showDropDownMenu();
}
void LLFavoritesBarCtrl::showDropDownMenu()
{
- if (mOverflowMenuHandle.isDead())
- {
- createOverflowMenu();
- }
-
- LLToggleableMenu* menu = (LLToggleableMenu*)mOverflowMenuHandle.get();
- if (menu && menu->toggleVisibility())
- {
- if (mUpdateDropDownItems)
- {
- updateMenuItems(menu);
- }
-
- menu->buildDrawLabels();
- menu->updateParent(LLMenuGL::sMenuContainer);
- menu->setButtonRect(mMoreTextBox->getRect(), this);
- positionAndShowMenu(menu);
- mDropDownItemsCount = menu->getItemCount();
- }
+ if (mOverflowMenuHandle.isDead())
+ {
+ createOverflowMenu();
+ }
+
+ LLToggleableMenu* menu = (LLToggleableMenu*)mOverflowMenuHandle.get();
+ if (menu && menu->toggleVisibility())
+ {
+ if (mUpdateDropDownItems)
+ {
+ updateMenuItems(menu);
+ }
+
+ menu->buildDrawLabels();
+ menu->updateParent(LLMenuGL::sMenuContainer);
+ menu->setButtonRect(mMoreTextBox->getRect(), this);
+ positionAndShowMenu(menu);
+ mDropDownItemsCount = menu->getItemCount();
+ }
}
void LLFavoritesBarCtrl::createOverflowMenu()
{
- LLToggleableMenu::Params menu_p;
- menu_p.name("favorites menu");
- menu_p.can_tear_off(false);
- menu_p.visible(false);
- menu_p.scrollable(true);
- menu_p.max_scrollable_items = 10;
- menu_p.preferred_width = DROP_DOWN_MENU_WIDTH;
+ LLToggleableMenu::Params menu_p;
+ menu_p.name("favorites menu");
+ menu_p.can_tear_off(false);
+ menu_p.visible(false);
+ menu_p.scrollable(true);
+ menu_p.max_scrollable_items = 10;
+ menu_p.preferred_width = DROP_DOWN_MENU_WIDTH;
- LLToggleableMenu* menu = LLUICtrlFactory::create<LLFavoriteLandmarkToggleableMenu>(menu_p);
- mOverflowMenuHandle = menu->getHandle();
+ LLToggleableMenu* menu = LLUICtrlFactory::create<LLFavoriteLandmarkToggleableMenu>(menu_p);
+ mOverflowMenuHandle = menu->getHandle();
}
void LLFavoritesBarCtrl::updateMenuItems(LLToggleableMenu* menu)
{
- menu->empty();
+ menu->empty();
- U32 widest_item = 0;
+ U32 widest_item = 0;
- for (S32 i = mFirstDropDownItem; i < mItems.size(); i++)
- {
- LLViewerInventoryItem* item = mItems.at(i);
- const std::string& item_name = item->getName();
+ for (S32 i = mFirstDropDownItem; i < mItems.size(); i++)
+ {
+ LLViewerInventoryItem* item = mItems.at(i);
+ const std::string& item_name = item->getName();
- LLFavoriteLandmarkMenuItem::Params item_params;
- item_params.name(item_name);
- item_params.label(item_name);
- item_params.on_click.function(boost::bind(&LLFavoritesBarCtrl::onButtonClick, this, item->getUUID()));
+ LLFavoriteLandmarkMenuItem::Params item_params;
+ item_params.name(item_name);
+ item_params.label(item_name);
+ item_params.on_click.function(boost::bind(&LLFavoritesBarCtrl::onButtonClick, this, item->getUUID()));
- LLFavoriteLandmarkMenuItem *menu_item = LLUICtrlFactory::create<LLFavoriteLandmarkMenuItem>(item_params);
- menu_item->initFavoritesBarPointer(this);
- menu_item->setRightMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonRightClick, this, item->getUUID(), _1, _2, _3, _4));
- menu_item->LLUICtrl::setMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseDown, this, item->getUUID(), _1, _2, _3, _4));
- menu_item->LLUICtrl::setMouseUpCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseUp, this, item->getUUID(), _1, _2, _3, _4));
- menu_item->setLandmarkID(item->getUUID());
+ LLFavoriteLandmarkMenuItem *menu_item = LLUICtrlFactory::create<LLFavoriteLandmarkMenuItem>(item_params);
+ menu_item->initFavoritesBarPointer(this);
+ menu_item->setRightMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonRightClick, this, item->getUUID(), _1, _2, _3, _4));
+ menu_item->LLUICtrl::setMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseDown, this, item->getUUID(), _1, _2, _3, _4));
+ menu_item->LLUICtrl::setMouseUpCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseUp, this, item->getUUID(), _1, _2, _3, _4));
+ menu_item->setLandmarkID(item->getUUID());
- fitLabelWidth(menu_item);
+ fitLabelWidth(menu_item);
- widest_item = llmax(widest_item, menu_item->getNominalWidth());
+ widest_item = llmax(widest_item, menu_item->getNominalWidth());
- menu->addChild(menu_item);
- }
+ menu->addChild(menu_item);
+ }
- addOpenLandmarksMenuItem(menu);
- mUpdateDropDownItems = false;
+ addOpenLandmarksMenuItem(menu);
+ mUpdateDropDownItems = false;
}
void LLFavoritesBarCtrl::fitLabelWidth(LLMenuItemCallGL* menu_item)
{
- U32 max_width = llmin(DROP_DOWN_MENU_WIDTH, getRect().getWidth());
- std::string item_name = menu_item->getName();
-
- // Check whether item name wider than menu
- if (menu_item->getNominalWidth() > max_width)
- {
- S32 chars_total = item_name.length();
- S32 chars_fitted = 1;
- menu_item->setLabel(LLStringExplicit(""));
- S32 label_space = max_width - menu_item->getFont()->getWidth("...") -
- menu_item->getNominalWidth();// This returns width of menu item with empty label (pad pixels)
-
- while (chars_fitted < chars_total
- && menu_item->getFont()->getWidth(item_name, 0, chars_fitted) < label_space)
- {
- chars_fitted++;
- }
- chars_fitted--; // Rolling back one char, that doesn't fit
-
- menu_item->setLabel(item_name.substr(0, chars_fitted) + "...");
- }
+ U32 max_width = llmin(DROP_DOWN_MENU_WIDTH, getRect().getWidth());
+ std::string item_name = menu_item->getName();
+
+ // Check whether item name wider than menu
+ if (menu_item->getNominalWidth() > max_width)
+ {
+ S32 chars_total = item_name.length();
+ S32 chars_fitted = 1;
+ menu_item->setLabel(LLStringExplicit(""));
+ S32 label_space = max_width - menu_item->getFont()->getWidth("...") -
+ menu_item->getNominalWidth();// This returns width of menu item with empty label (pad pixels)
+
+ while (chars_fitted < chars_total
+ && menu_item->getFont()->getWidth(item_name, 0, chars_fitted) < label_space)
+ {
+ chars_fitted++;
+ }
+ chars_fitted--; // Rolling back one char, that doesn't fit
+
+ menu_item->setLabel(item_name.substr(0, chars_fitted) + "...");
+ }
}
void LLFavoritesBarCtrl::addOpenLandmarksMenuItem(LLToggleableMenu* menu)
{
- std::string label_untrans = "Open landmarks";
- std::string label_transl;
- bool translated = LLTrans::findString(label_transl, label_untrans);
-
- LLMenuItemCallGL::Params item_params;
- item_params.name("open_my_landmarks");
- item_params.label(translated ? label_transl: label_untrans);
- LLSD key;
- key["type"] = "open_landmark_tab";
- item_params.on_click.function(boost::bind(&LLFloaterSidePanelContainer::showPanel, "places", key));
- LLMenuItemCallGL* menu_item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
-
- fitLabelWidth(menu_item);
-
- LLMenuItemSeparatorGL::Params sep_params;
- sep_params.enabled_color=LLUIColorTable::instance().getColor("MenuItemEnabledColor");
- sep_params.disabled_color=LLUIColorTable::instance().getColor("MenuItemDisabledColor");
- sep_params.highlight_bg_color=LLUIColorTable::instance().getColor("MenuItemHighlightBgColor");
- sep_params.highlight_fg_color=LLUIColorTable::instance().getColor("MenuItemHighlightFgColor");
- LLMenuItemSeparatorGL* separator = LLUICtrlFactory::create<LLMenuItemSeparatorGL>(sep_params);
-
- menu->addChild(separator);
- menu->addChild(menu_item);
+ std::string label_untrans = "Open landmarks";
+ std::string label_transl;
+ bool translated = LLTrans::findString(label_transl, label_untrans);
+
+ LLMenuItemCallGL::Params item_params;
+ item_params.name("open_my_landmarks");
+ item_params.label(translated ? label_transl: label_untrans);
+ LLSD key;
+ key["type"] = "open_landmark_tab";
+ item_params.on_click.function(boost::bind(&LLFloaterSidePanelContainer::showPanel, "places", key));
+ LLMenuItemCallGL* menu_item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
+
+ fitLabelWidth(menu_item);
+
+ LLMenuItemSeparatorGL::Params sep_params;
+ sep_params.enabled_color=LLUIColorTable::instance().getColor("MenuItemEnabledColor");
+ sep_params.disabled_color=LLUIColorTable::instance().getColor("MenuItemDisabledColor");
+ sep_params.highlight_bg_color=LLUIColorTable::instance().getColor("MenuItemHighlightBgColor");
+ sep_params.highlight_fg_color=LLUIColorTable::instance().getColor("MenuItemHighlightFgColor");
+ LLMenuItemSeparatorGL* separator = LLUICtrlFactory::create<LLMenuItemSeparatorGL>(sep_params);
+
+ menu->addChild(separator);
+ menu->addChild(menu_item);
}
void LLFavoritesBarCtrl::positionAndShowMenu(LLToggleableMenu* menu)
{
- U32 max_width = llmin(DROP_DOWN_MENU_WIDTH, getRect().getWidth());
+ U32 max_width = llmin(DROP_DOWN_MENU_WIDTH, getRect().getWidth());
- S32 menu_x = getRect().getWidth() - max_width;
- S32 menu_y = getParent()->getRect().mBottom - DROP_DOWN_MENU_TOP_PAD;
+ S32 menu_x = getRect().getWidth() - max_width;
+ S32 menu_y = getParent()->getRect().mBottom - DROP_DOWN_MENU_TOP_PAD;
- // the menu should be offset of the right edge of the window
- // so it's no covered by buttons in the right-side toolbar.
- LLToolBar* right_toolbar = gToolBarView->getChild<LLToolBar>("toolbar_right");
- if (right_toolbar && right_toolbar->hasButtons())
- {
- S32 toolbar_top = 0;
+ // the menu should be offset of the right edge of the window
+ // so it's no covered by buttons in the right-side toolbar.
+ LLToolBar* right_toolbar = gToolBarView->getChild<LLToolBar>("toolbar_right");
+ if (right_toolbar && right_toolbar->hasButtons())
+ {
+ S32 toolbar_top = 0;
- if (LLView* top_border_panel = right_toolbar->getChild<LLView>("button_panel"))
- {
- toolbar_top = top_border_panel->calcScreenRect().mTop;
- }
+ if (LLView* top_border_panel = right_toolbar->getChild<LLView>("button_panel"))
+ {
+ toolbar_top = top_border_panel->calcScreenRect().mTop;
+ }
- // Calculating the bottom (in screen coord) of the drop down menu
- S32 menu_top = getParent()->getRect().mBottom - DROP_DOWN_MENU_TOP_PAD;
- S32 menu_bottom = menu_top - menu->getRect().getHeight();
- S32 menu_bottom_screen = 0;
+ // Calculating the bottom (in screen coord) of the drop down menu
+ S32 menu_top = getParent()->getRect().mBottom - DROP_DOWN_MENU_TOP_PAD;
+ S32 menu_bottom = menu_top - menu->getRect().getHeight();
+ S32 menu_bottom_screen = 0;
- localPointToScreen(0, menu_bottom, &menu_top, &menu_bottom_screen);
+ localPointToScreen(0, menu_bottom, &menu_top, &menu_bottom_screen);
- if (menu_bottom_screen < toolbar_top)
- {
- menu_x -= right_toolbar->getRect().getWidth();
- }
- }
+ if (menu_bottom_screen < toolbar_top)
+ {
+ menu_x -= right_toolbar->getRect().getWidth();
+ }
+ }
- LLMenuGL::showPopup(this, menu, menu_x, menu_y, mMouseX, mMouseY);
+ LLMenuGL::showPopup(this, menu, menu_x, menu_y, mMouseX, mMouseY);
}
void LLFavoritesBarCtrl::onButtonClick(LLUUID item_id)
{
- // We only have one Inventory, gInventory. Some day this should be better abstracted.
- LLInvFVBridgeAction::doAction(item_id,&gInventory);
+ // We only have one Inventory, gInventory. Some day this should be better abstracted.
+ LLInvFVBridgeAction::doAction(item_id,&gInventory);
}
void LLFavoritesBarCtrl::onButtonRightClick( LLUUID item_id,LLView* fav_button,S32 x,S32 y,MASK mask)
{
- mSelectedItemID = item_id;
-
- LLMenuGL* menu = (LLMenuGL*)mContextMenuHandle.get();
- if (!menu)
- {
- return;
- }
-
- // Remember that the context menu was shown simultaneously with the overflow menu,
- // so that we can restore the overflow menu when user clicks a context menu item
- // (which hides the overflow menu).
- {
- LLView* overflow_menu = mOverflowMenuHandle.get();
- mRestoreOverflowMenu = overflow_menu && overflow_menu->getVisible();
- }
-
- // Release mouse capture so hover events go to the popup menu
- // because this is happening during a mouse down.
- gFocusMgr.setMouseCapture(NULL);
-
- menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(fav_button, menu, x, y);
+ mSelectedItemID = item_id;
+
+ LLMenuGL* menu = (LLMenuGL*)mContextMenuHandle.get();
+ if (!menu)
+ {
+ return;
+ }
+
+ // Remember that the context menu was shown simultaneously with the overflow menu,
+ // so that we can restore the overflow menu when user clicks a context menu item
+ // (which hides the overflow menu).
+ {
+ LLView* overflow_menu = mOverflowMenuHandle.get();
+ mRestoreOverflowMenu = overflow_menu && overflow_menu->getVisible();
+ }
+
+ // Release mouse capture so hover events go to the popup menu
+ // because this is happening during a mouse down.
+ gFocusMgr.setMouseCapture(NULL);
+
+ menu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(fav_button, menu, x, y);
}
BOOL LLFavoritesBarCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = childrenHandleRightMouseDown( x, y, mask) != NULL;
- if(!handled && !gMenuHolder->hasVisibleMenu())
- {
- show_navbar_context_menu(this,x,y);
- handled = true;
- }
-
- return handled;
+ BOOL handled = childrenHandleRightMouseDown( x, y, mask) != NULL;
+ if(!handled && !gMenuHolder->hasVisibleMenu())
+ {
+ show_navbar_context_menu(this,x,y);
+ handled = true;
+ }
+
+ return handled;
}
void copy_slurl_to_clipboard_cb(std::string& slurl)
{
- LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size());
+ LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size());
- LLSD args;
- args["SLURL"] = slurl;
- LLNotificationsUtil::add("CopySLURL", args);
+ LLSD args;
+ args["SLURL"] = slurl;
+ LLNotificationsUtil::add("CopySLURL", args);
}
@@ -1303,48 +1303,48 @@ bool LLFavoritesBarCtrl::enableSelected(const LLSD& userdata)
void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
{
- std::string action = userdata.asString();
- LL_INFOS("FavoritesBar") << "Action = " << action << " Item = " << mSelectedItemID.asString() << LL_ENDL;
-
- LLViewerInventoryItem* item = gInventory.getItem(mSelectedItemID);
- if (!item)
- return;
-
- if (action == "open")
- {
- onButtonClick(item->getUUID());
- }
- else if (action == "about")
- {
- LLSD key;
- key["type"] = "landmark";
- key["id"] = mSelectedItemID;
-
- LLFloaterSidePanelContainer::showPanel("places", key);
- }
- else if (action == "copy_slurl")
- {
- LLVector3d posGlobal;
- LLLandmarkActions::getLandmarkGlobalPos(mSelectedItemID, posGlobal);
-
- if (!posGlobal.isExactlyZero())
- {
- LLLandmarkActions::getSLURLfromPosGlobal(posGlobal, copy_slurl_to_clipboard_cb);
- }
- }
- else if (action == "show_on_map")
- {
- LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
-
- LLVector3d posGlobal;
- LLLandmarkActions::getLandmarkGlobalPos(mSelectedItemID, posGlobal);
-
- if (!posGlobal.isExactlyZero() && worldmap_instance)
- {
- worldmap_instance->trackLocation(posGlobal);
- LLFloaterReg::showInstance("world_map", "center");
- }
- }
+ std::string action = userdata.asString();
+ LL_INFOS("FavoritesBar") << "Action = " << action << " Item = " << mSelectedItemID.asString() << LL_ENDL;
+
+ LLViewerInventoryItem* item = gInventory.getItem(mSelectedItemID);
+ if (!item)
+ return;
+
+ if (action == "open")
+ {
+ onButtonClick(item->getUUID());
+ }
+ else if (action == "about")
+ {
+ LLSD key;
+ key["type"] = "landmark";
+ key["id"] = mSelectedItemID;
+
+ LLFloaterSidePanelContainer::showPanel("places", key);
+ }
+ else if (action == "copy_slurl")
+ {
+ LLVector3d posGlobal;
+ LLLandmarkActions::getLandmarkGlobalPos(mSelectedItemID, posGlobal);
+
+ if (!posGlobal.isExactlyZero())
+ {
+ LLLandmarkActions::getSLURLfromPosGlobal(posGlobal, copy_slurl_to_clipboard_cb);
+ }
+ }
+ else if (action == "show_on_map")
+ {
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+
+ LLVector3d posGlobal;
+ LLLandmarkActions::getLandmarkGlobalPos(mSelectedItemID, posGlobal);
+
+ if (!posGlobal.isExactlyZero() && worldmap_instance)
+ {
+ worldmap_instance->trackLocation(posGlobal);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
+ }
else if (action == "create_pick")
{
LLSD args;
@@ -1352,21 +1352,21 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
args["item_id"] = item->getUUID();
LLFloaterSidePanelContainer::showPanel("places", args);
}
- else if (action == "cut")
- {
- }
- else if (action == "copy")
- {
- LLClipboard::instance().copyToClipboard(mSelectedItemID, LLAssetType::AT_LANDMARK);
- }
- else if (action == "paste")
- {
- pasteFromClipboard();
- }
- else if (action == "delete")
- {
- gInventory.removeItem(mSelectedItemID);
- }
+ else if (action == "cut")
+ {
+ }
+ else if (action == "copy")
+ {
+ LLClipboard::instance().copyToClipboard(mSelectedItemID, LLAssetType::AT_LANDMARK);
+ }
+ else if (action == "paste")
+ {
+ pasteFromClipboard();
+ }
+ else if (action == "delete")
+ {
+ gInventory.removeItem(mSelectedItemID);
+ }
else if (action == "rename")
{
LLSD args;
@@ -1377,20 +1377,20 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
LLNotificationsUtil::add("RenameLandmark", args, payload, boost::bind(onRenameCommit, _1, _2));
}
- else if (action == "move_to_landmarks")
- {
- change_item_parent(mSelectedItemID, gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));
- }
-
- // Pop-up the overflow menu again (it gets hidden whenever the user clicks a context menu item).
- // See EXT-4217 and STORM-207.
- LLToggleableMenu* menu = (LLToggleableMenu*) mOverflowMenuHandle.get();
- if (mRestoreOverflowMenu && menu && !menu->getVisible())
- {
- menu->resetScrollPositionOnShow(false);
- showDropDownMenu();
- menu->resetScrollPositionOnShow(true);
- }
+ else if (action == "move_to_landmarks")
+ {
+ change_item_parent(mSelectedItemID, gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));
+ }
+
+ // Pop-up the overflow menu again (it gets hidden whenever the user clicks a context menu item).
+ // See EXT-4217 and STORM-207.
+ LLToggleableMenu* menu = (LLToggleableMenu*) mOverflowMenuHandle.get();
+ if (mRestoreOverflowMenu && menu && !menu->getVisible())
+ {
+ menu->resetScrollPositionOnShow(false);
+ showDropDownMenu();
+ menu->resetScrollPositionOnShow(true);
+ }
}
bool LLFavoritesBarCtrl::onRenameCommit(const LLSD& notification, const LLSD& response)
@@ -1417,183 +1417,183 @@ bool LLFavoritesBarCtrl::onRenameCommit(const LLSD& notification, const LLSD& re
BOOL LLFavoritesBarCtrl::isClipboardPasteable() const
{
- if (!LLClipboard::instance().hasContents())
- {
- return FALSE;
- }
-
- std::vector<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
- S32 count = objects.size();
- for(S32 i = 0; i < count; i++)
- {
- const LLUUID &item_id = objects.at(i);
-
- // Can't paste folders
- const LLInventoryCategory *cat = gInventory.getCategory(item_id);
- if (cat)
- {
- return FALSE;
- }
-
- const LLInventoryItem *item = gInventory.getItem(item_id);
- if (item && LLAssetType::AT_LANDMARK != item->getType())
- {
- return FALSE;
- }
- }
- return TRUE;
+ if (!LLClipboard::instance().hasContents())
+ {
+ return FALSE;
+ }
+
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+ S32 count = objects.size();
+ for(S32 i = 0; i < count; i++)
+ {
+ const LLUUID &item_id = objects.at(i);
+
+ // Can't paste folders
+ const LLInventoryCategory *cat = gInventory.getCategory(item_id);
+ if (cat)
+ {
+ return FALSE;
+ }
+
+ const LLInventoryItem *item = gInventory.getItem(item_id);
+ if (item && LLAssetType::AT_LANDMARK != item->getType())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
void LLFavoritesBarCtrl::pasteFromClipboard() const
{
- LLInventoryModel* model = &gInventory;
- if(model && isClipboardPasteable())
- {
- LLInventoryItem* item = NULL;
- std::vector<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
- S32 count = objects.size();
- LLUUID parent_id(mFavoriteFolderId);
- for(S32 i = 0; i < count; i++)
- {
- item = model->getItem(objects.at(i));
- if (item)
- {
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- parent_id,
- std::string(),
- LLPointer<LLInventoryCallback>(NULL));
- }
- }
- }
+ LLInventoryModel* model = &gInventory;
+ if(model && isClipboardPasteable())
+ {
+ LLInventoryItem* item = NULL;
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+ S32 count = objects.size();
+ LLUUID parent_id(mFavoriteFolderId);
+ for(S32 i = 0; i < count; i++)
+ {
+ item = model->getItem(objects.at(i));
+ if (item)
+ {
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ parent_id,
+ std::string(),
+ LLPointer<LLInventoryCallback>(NULL));
+ }
+ }
+ }
}
void LLFavoritesBarCtrl::onButtonMouseDown(LLUUID id, LLUICtrl* ctrl, S32 x, S32 y, MASK mask)
{
- // EXT-6997 (Fav bar: Pop-up menu for LM in overflow dropdown is kept after LM was dragged away)
- // mContextMenuHandle.get() - is a pop-up menu (of items) in already opened dropdown menu.
- // We have to check and set visibility of pop-up menu in such a way instead of using
- // LLMenuHolderGL::hideMenus() because it will close both menus(dropdown and pop-up), but
- // we need to close only pop-up menu while dropdown one should be still opened.
- LLMenuGL* menu = (LLMenuGL*)mContextMenuHandle.get();
- if(menu && menu->getVisible())
- {
- menu->setVisible(FALSE);
- }
+ // EXT-6997 (Fav bar: Pop-up menu for LM in overflow dropdown is kept after LM was dragged away)
+ // mContextMenuHandle.get() - is a pop-up menu (of items) in already opened dropdown menu.
+ // We have to check and set visibility of pop-up menu in such a way instead of using
+ // LLMenuHolderGL::hideMenus() because it will close both menus(dropdown and pop-up), but
+ // we need to close only pop-up menu while dropdown one should be still opened.
+ LLMenuGL* menu = (LLMenuGL*)mContextMenuHandle.get();
+ if(menu && menu->getVisible())
+ {
+ menu->setVisible(FALSE);
+ }
- mDragItemId = id;
- mStartDrag = TRUE;
+ mDragItemId = id;
+ mStartDrag = TRUE;
- S32 screenX, screenY;
- localPointToScreen(x, y, &screenX, &screenY);
+ S32 screenX, screenY;
+ localPointToScreen(x, y, &screenX, &screenY);
- LLToolDragAndDrop::getInstance()->setDragStart(screenX, screenY);
+ LLToolDragAndDrop::getInstance()->setDragStart(screenX, screenY);
}
void LLFavoritesBarCtrl::onButtonMouseUp(LLUUID id, LLUICtrl* ctrl, S32 x, S32 y, MASK mask)
{
- mStartDrag = FALSE;
- mDragItemId = LLUUID::null;
+ mStartDrag = FALSE;
+ mDragItemId = LLUUID::null;
}
void LLFavoritesBarCtrl::onEndDrag()
{
- mEndDragConnection.disconnect();
+ mEndDragConnection.disconnect();
- showDragMarker(FALSE);
- mDragItemId = LLUUID::null;
- LLView::getWindow()->setCursor(UI_CURSOR_ARROW);
+ showDragMarker(FALSE);
+ mDragItemId = LLUUID::null;
+ LLView::getWindow()->setCursor(UI_CURSOR_ARROW);
}
BOOL LLFavoritesBarCtrl::handleHover(S32 x, S32 y, MASK mask)
{
- if (mDragItemId != LLUUID::null && mStartDrag)
- {
- S32 screenX, screenY;
- localPointToScreen(x, y, &screenX, &screenY);
+ if (mDragItemId != LLUUID::null && mStartDrag)
+ {
+ S32 screenX, screenY;
+ localPointToScreen(x, y, &screenX, &screenY);
- if(LLToolDragAndDrop::getInstance()->isOverThreshold(screenX, screenY))
- {
- LLToolDragAndDrop::getInstance()->beginDrag(
- DAD_LANDMARK, mDragItemId,
- LLToolDragAndDrop::SOURCE_LIBRARY);
+ if(LLToolDragAndDrop::getInstance()->isOverThreshold(screenX, screenY))
+ {
+ LLToolDragAndDrop::getInstance()->beginDrag(
+ DAD_LANDMARK, mDragItemId,
+ LLToolDragAndDrop::SOURCE_LIBRARY);
- mStartDrag = FALSE;
+ mStartDrag = FALSE;
- return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask);
- }
- }
+ return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask);
+ }
+ }
- return TRUE;
+ return TRUE;
}
LLUICtrl* LLFavoritesBarCtrl::findChildByLocalCoords(S32 x, S32 y)
{
- LLUICtrl* ctrl = NULL;
- const child_list_t* list = getChildList();
-
- for (child_list_const_iter_t i = list->begin(); i != list->end(); ++i)
- {
- // Look only for children that are favorite buttons
- if ((*i)->getName() == "favorites_bar_btn")
- {
- LLRect rect = (*i)->getRect();
- // We consider a button hit if the cursor is left of the right side
- // This makes the hit a bit less finicky than hitting directly on the button itself
- if (x <= rect.mRight)
- {
- ctrl = dynamic_cast<LLUICtrl*>(*i);
- break;
- }
- }
- }
- return ctrl;
+ LLUICtrl* ctrl = NULL;
+ const child_list_t* list = getChildList();
+
+ for (child_list_const_iter_t i = list->begin(); i != list->end(); ++i)
+ {
+ // Look only for children that are favorite buttons
+ if ((*i)->getName() == "favorites_bar_btn")
+ {
+ LLRect rect = (*i)->getRect();
+ // We consider a button hit if the cursor is left of the right side
+ // This makes the hit a bit less finicky than hitting directly on the button itself
+ if (x <= rect.mRight)
+ {
+ ctrl = dynamic_cast<LLUICtrl*>(*i);
+ break;
+ }
+ }
+ }
+ return ctrl;
}
BOOL LLFavoritesBarCtrl::needToSaveItemsOrder(const LLInventoryModel::item_array_t& items)
{
- BOOL result = FALSE;
+ BOOL result = FALSE;
- // if there is an item without sort order field set, we need to save items order
- for (LLInventoryModel::item_array_t::const_iterator i = items.begin(); i != items.end(); ++i)
- {
- if (LLFavoritesOrderStorage::instance().getSortIndex((*i)->getUUID()) < 0)
- {
- result = TRUE;
- break;
- }
- }
+ // if there is an item without sort order field set, we need to save items order
+ for (LLInventoryModel::item_array_t::const_iterator i = items.begin(); i != items.end(); ++i)
+ {
+ if (LLFavoritesOrderStorage::instance().getSortIndex((*i)->getUUID()) < 0)
+ {
+ result = TRUE;
+ break;
+ }
+ }
- return result;
+ return result;
}
void LLFavoritesBarCtrl::insertItem(LLInventoryModel::item_array_t& items, const LLUUID& dest_item_id, LLViewerInventoryItem* insertedItem, bool insert_before)
{
- // Get the iterator to the destination item
- LLInventoryModel::item_array_t::iterator it_dest = LLInventoryModel::findItemIterByUUID(items, dest_item_id);
- if (it_dest == items.end())
- return;
-
- // Go to the next element if one wishes to insert after the dest element
- if (!insert_before)
- {
- ++it_dest;
- }
-
- // Insert the source item in the right place
- if (it_dest != items.end())
- {
- items.insert(it_dest, insertedItem);
- }
- else
- {
- // Append to the list if it_dest reached the end
- items.push_back(insertedItem);
- }
+ // Get the iterator to the destination item
+ LLInventoryModel::item_array_t::iterator it_dest = LLInventoryModel::findItemIterByUUID(items, dest_item_id);
+ if (it_dest == items.end())
+ return;
+
+ // Go to the next element if one wishes to insert after the dest element
+ if (!insert_before)
+ {
+ ++it_dest;
+ }
+
+ // Insert the source item in the right place
+ if (it_dest != items.end())
+ {
+ items.insert(it_dest, insertedItem);
+ }
+ else
+ {
+ // Append to the list if it_dest reached the end
+ items.push_back(insertedItem);
+ }
}
const std::string LLFavoritesOrderStorage::SORTING_DATA_FILE_NAME = "landmarks_sorting.xml";
@@ -1602,40 +1602,40 @@ bool LLFavoritesOrderStorage::mSaveOnExit = false;
void LLFavoritesOrderStorage::setSortIndex(const LLViewerInventoryItem* inv_item, S32 sort_index)
{
- mSortIndexes[inv_item->getUUID()] = sort_index;
- mIsDirty = true;
- getSLURL(inv_item->getAssetUUID());
+ mSortIndexes[inv_item->getUUID()] = sort_index;
+ mIsDirty = true;
+ getSLURL(inv_item->getAssetUUID());
}
S32 LLFavoritesOrderStorage::getSortIndex(const LLUUID& inv_item_id)
{
- sort_index_map_t::const_iterator it = mSortIndexes.find(inv_item_id);
- if (it != mSortIndexes.end())
- {
- return it->second;
- }
- return NO_INDEX;
+ sort_index_map_t::const_iterator it = mSortIndexes.find(inv_item_id);
+ if (it != mSortIndexes.end())
+ {
+ return it->second;
+ }
+ return NO_INDEX;
}
void LLFavoritesOrderStorage::removeSortIndex(const LLUUID& inv_item_id)
{
- mSortIndexes.erase(inv_item_id);
- mIsDirty = true;
+ mSortIndexes.erase(inv_item_id);
+ mIsDirty = true;
}
void LLFavoritesOrderStorage::getSLURL(const LLUUID& asset_id)
{
- slurls_map_t::iterator slurl_iter = mSLURLs.find(asset_id);
- if (slurl_iter != mSLURLs.end()) return; // SLURL for current landmark is already cached
+ slurls_map_t::iterator slurl_iter = mSLURLs.find(asset_id);
+ if (slurl_iter != mSLURLs.end()) return; // SLURL for current landmark is already cached
- LLLandmark* lm = gLandmarkList.getAsset(asset_id,
- boost::bind(&LLFavoritesOrderStorage::onLandmarkLoaded, this, asset_id, _1));
- if (lm)
- {
+ LLLandmark* lm = gLandmarkList.getAsset(asset_id,
+ boost::bind(&LLFavoritesOrderStorage::onLandmarkLoaded, this, asset_id, _1));
+ if (lm)
+ {
LL_DEBUGS("FavoritesBar") << "landmark for " << asset_id << " already loaded" << LL_ENDL;
- onLandmarkLoaded(asset_id, lm);
- }
- return;
+ onLandmarkLoaded(asset_id, lm);
+ }
+ return;
}
// static
@@ -1660,112 +1660,112 @@ std::string LLFavoritesOrderStorage::getStoredFavoritesFilename()
// static
void LLFavoritesOrderStorage::destroyClass()
{
- LLFavoritesOrderStorage::instance().cleanup();
+ LLFavoritesOrderStorage::instance().cleanup();
- std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
- llifstream file;
- file.open(old_filename.c_str());
- if (file.is_open())
- {
+ std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
+ llifstream file;
+ file.open(old_filename.c_str());
+ if (file.is_open())
+ {
file.close();
- std::string new_filename = getStoredFavoritesFilename();
+ std::string new_filename = getStoredFavoritesFilename();
LL_INFOS("FavoritesBar") << "moving favorites from old name '" << old_filename
<< "' to new name '" << new_filename << "'"
<< LL_ENDL;
- LLFile::copy(old_filename,new_filename);
- LLFile::remove(old_filename);
- }
-
- std::string filename = getSavedOrderFileName();
- file.open(filename.c_str());
- if (file.is_open())
- {
- file.close();
- LLFile::remove(filename);
- }
- if(mSaveOnExit || gSavedSettings.getBOOL("UpdateRememberPasswordSetting"))
- {
- LLFavoritesOrderStorage::instance().saveFavoritesRecord(true);
- }
+ LLFile::copy(old_filename,new_filename);
+ LLFile::remove(old_filename);
+ }
+
+ std::string filename = getSavedOrderFileName();
+ file.open(filename.c_str());
+ if (file.is_open())
+ {
+ file.close();
+ LLFile::remove(filename);
+ }
+ if(mSaveOnExit || gSavedSettings.getBOOL("UpdateRememberPasswordSetting"))
+ {
+ LLFavoritesOrderStorage::instance().saveFavoritesRecord(true);
+ }
}
std::string LLFavoritesOrderStorage::getSavedOrderFileName()
{
- // If we quit from the login screen we will not have an SL account
- // name. Don't try to save, otherwise we'll dump a file in
- // C:\Program Files\SecondLife\ or similar. JC
- std::string user_dir = gDirUtilp->getLindenUserDir();
+ // If we quit from the login screen we will not have an SL account
+ // name. Don't try to save, otherwise we'll dump a file in
+ // C:\Program Files\SecondLife\ or similar. JC
+ std::string user_dir = gDirUtilp->getLindenUserDir();
return (user_dir.empty() ? "" : gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SORTING_DATA_FILE_NAME));
}
void LLFavoritesOrderStorage::load()
{
- std::string filename = getSavedOrderFileName();
- LLSD settings_llsd;
- llifstream file;
- file.open(filename.c_str());
- if (file.is_open())
- {
- LLSDSerialize::fromXML(settings_llsd, file);
- LL_INFOS("FavoritesBar") << "loaded favorites order from '" << filename << "' "
- << (settings_llsd.isMap() ? "" : "un") << "successfully"
- << LL_ENDL;
- file.close();
- mSaveOnExit = true;
-
- for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
- iter != settings_llsd.endMap(); ++iter)
- {
- mSortIndexes.insert(std::make_pair(LLUUID(iter->first), (S32)iter->second.asInteger()));
- }
- }
- else
- {
- filename = getStoredFavoritesFilename();
- if (!filename.empty())
- {
- llifstream in_file;
- in_file.open(filename.c_str());
- LLSD fav_llsd;
- if (in_file.is_open())
- {
- LLSDSerialize::fromXML(fav_llsd, in_file);
- LL_INFOS("FavoritesBar") << "loaded favorites from '" << filename << "' "
- << (fav_llsd.isMap() ? "" : "un") << "successfully"
- << LL_ENDL;
- in_file.close();
- if (fav_llsd.isMap() && fav_llsd.has(gAgentUsername))
- {
- mStorageFavorites = fav_llsd[gAgentUsername];
-
- S32 index = 0;
- bool needs_validation = gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin");
- for (LLSD::array_iterator iter = mStorageFavorites.beginArray();
- iter != mStorageFavorites.endArray(); ++iter)
- {
- // Validation
- LLUUID fv_id = iter->get("id").asUUID();
- if (needs_validation
- && (fv_id.isNull()
- || iter->get("asset_id").asUUID().isNull()
- || iter->get("name").asString().empty()
- || iter->get("slurl").asString().empty()))
- {
- mRecreateFavoriteStorage = true;
- }
-
- mSortIndexes.insert(std::make_pair(fv_id, index));
- index++;
- }
- }
- }
- else
- {
- LL_WARNS("FavoritesBar") << "unable to open favorites from '" << filename << "'" << LL_ENDL;
- }
- }
- }
+ std::string filename = getSavedOrderFileName();
+ LLSD settings_llsd;
+ llifstream file;
+ file.open(filename.c_str());
+ if (file.is_open())
+ {
+ LLSDSerialize::fromXML(settings_llsd, file);
+ LL_INFOS("FavoritesBar") << "loaded favorites order from '" << filename << "' "
+ << (settings_llsd.isMap() ? "" : "un") << "successfully"
+ << LL_ENDL;
+ file.close();
+ mSaveOnExit = true;
+
+ for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
+ iter != settings_llsd.endMap(); ++iter)
+ {
+ mSortIndexes.insert(std::make_pair(LLUUID(iter->first), (S32)iter->second.asInteger()));
+ }
+ }
+ else
+ {
+ filename = getStoredFavoritesFilename();
+ if (!filename.empty())
+ {
+ llifstream in_file;
+ in_file.open(filename.c_str());
+ LLSD fav_llsd;
+ if (in_file.is_open())
+ {
+ LLSDSerialize::fromXML(fav_llsd, in_file);
+ LL_INFOS("FavoritesBar") << "loaded favorites from '" << filename << "' "
+ << (fav_llsd.isMap() ? "" : "un") << "successfully"
+ << LL_ENDL;
+ in_file.close();
+ if (fav_llsd.isMap() && fav_llsd.has(gAgentUsername))
+ {
+ mStorageFavorites = fav_llsd[gAgentUsername];
+
+ S32 index = 0;
+ bool needs_validation = gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin");
+ for (LLSD::array_iterator iter = mStorageFavorites.beginArray();
+ iter != mStorageFavorites.endArray(); ++iter)
+ {
+ // Validation
+ LLUUID fv_id = iter->get("id").asUUID();
+ if (needs_validation
+ && (fv_id.isNull()
+ || iter->get("asset_id").asUUID().isNull()
+ || iter->get("name").asString().empty()
+ || iter->get("slurl").asString().empty()))
+ {
+ mRecreateFavoriteStorage = true;
+ }
+
+ mSortIndexes.insert(std::make_pair(fv_id, index));
+ index++;
+ }
+ }
+ }
+ else
+ {
+ LL_WARNS("FavoritesBar") << "unable to open favorites from '" << filename << "'" << LL_ENDL;
+ }
+ }
+ }
}
// static
@@ -1828,7 +1828,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser(const std::string &use
// static
void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
{
- std::string filename = getStoredFavoritesFilename();
+ std::string filename = getStoredFavoritesFilename();
if (!filename.empty())
{
LLSD fav_llsd;
@@ -1838,39 +1838,39 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
{
LLSDSerialize::fromXML(fav_llsd, file);
file.close();
-
+
LLAvatarName av_name;
LLAvatarNameCache::get( gAgentID, &av_name );
// Note : use the "John Doe" and not the "john.doe" version of the name.
// See saveFavoritesSLURLs() here above for the reason why.
if (fav_llsd.has(av_name.getUserName()))
{
- LLSD user_llsd = fav_llsd[av_name.getUserName()];
-
- if ((user_llsd.beginArray()!= user_llsd.endArray()) && user_llsd.beginArray()->has("id"))
- {
- for (LLSD::array_iterator iter = user_llsd.beginArray();iter != user_llsd.endArray(); ++iter)
- {
- LLSD value;
- value["id"]= iter->get("id").asUUID();
- iter->assign(value);
- }
- fav_llsd[av_name.getUserName()] = user_llsd;
- llofstream file;
- file.open(filename.c_str());
- if ( file.is_open() )
- {
- LLSDSerialize::toPrettyXML(fav_llsd, file);
- file.close();
- }
- }
- else
- {
- LL_INFOS("FavoritesBar") << "Removed favorites for " << av_name.getUserName() << LL_ENDL;
- fav_llsd.erase(av_name.getUserName());
- }
+ LLSD user_llsd = fav_llsd[av_name.getUserName()];
+
+ if ((user_llsd.beginArray()!= user_llsd.endArray()) && user_llsd.beginArray()->has("id"))
+ {
+ for (LLSD::array_iterator iter = user_llsd.beginArray();iter != user_llsd.endArray(); ++iter)
+ {
+ LLSD value;
+ value["id"]= iter->get("id").asUUID();
+ iter->assign(value);
+ }
+ fav_llsd[av_name.getUserName()] = user_llsd;
+ llofstream file;
+ file.open(filename.c_str());
+ if ( file.is_open() )
+ {
+ LLSDSerialize::toPrettyXML(fav_llsd, file);
+ file.close();
+ }
+ }
+ else
+ {
+ LL_INFOS("FavoritesBar") << "Removed favorites for " << av_name.getUserName() << LL_ENDL;
+ fav_llsd.erase(av_name.getUserName());
+ }
}
-
+
llofstream out_file;
out_file.open(filename.c_str());
if ( out_file.is_open() )
@@ -1886,97 +1886,97 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmark* landmark)
{
- if (landmark)
+ if (landmark)
{
LL_DEBUGS("FavoritesBar") << "landmark for " << asset_id << " loaded" << LL_ENDL;
LLVector3d pos_global;
if (!landmark->getGlobalPos(pos_global))
{
- // If global position was unknown on first getGlobalPos() call
- // it should be set for the subsequent calls.
- landmark->getGlobalPos(pos_global);
+ // If global position was unknown on first getGlobalPos() call
+ // it should be set for the subsequent calls.
+ landmark->getGlobalPos(pos_global);
}
if (!pos_global.isExactlyZero())
{
- LL_DEBUGS("FavoritesBar") << "requesting slurl for landmark " << asset_id << LL_ENDL;
- LLLandmarkActions::getSLURLfromPosGlobal(pos_global,
- boost::bind(&LLFavoritesOrderStorage::storeFavoriteSLURL, this, asset_id, _1));
+ LL_DEBUGS("FavoritesBar") << "requesting slurl for landmark " << asset_id << LL_ENDL;
+ LLLandmarkActions::getSLURLfromPosGlobal(pos_global,
+ boost::bind(&LLFavoritesOrderStorage::storeFavoriteSLURL, this, asset_id, _1));
}
}
}
void LLFavoritesOrderStorage::storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl)
{
- LL_DEBUGS("FavoritesBar") << "Saving landmark SLURL '" << slurl << "' for " << asset_id << LL_ENDL;
- mSLURLs[asset_id] = slurl;
+ LL_DEBUGS("FavoritesBar") << "Saving landmark SLURL '" << slurl << "' for " << asset_id << LL_ENDL;
+ mSLURLs[asset_id] = slurl;
}
void LLFavoritesOrderStorage::cleanup()
{
- // nothing to clean
- if (!mIsDirty) return;
+ // nothing to clean
+ if (!mIsDirty) return;
- const LLUUID fav_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(fav_id, cats, items, LLInventoryModel::EXCLUDE_TRASH);
+ const LLUUID fav_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendents(fav_id, cats, items, LLInventoryModel::EXCLUDE_TRASH);
- IsNotInFavorites is_not_in_fav(items);
+ IsNotInFavorites is_not_in_fav(items);
- sort_index_map_t aTempMap;
- //copy unremoved values from mSortIndexes to aTempMap
- std::remove_copy_if(mSortIndexes.begin(), mSortIndexes.end(),
- inserter(aTempMap, aTempMap.begin()),
- is_not_in_fav);
+ sort_index_map_t aTempMap;
+ //copy unremoved values from mSortIndexes to aTempMap
+ std::remove_copy_if(mSortIndexes.begin(), mSortIndexes.end(),
+ inserter(aTempMap, aTempMap.begin()),
+ is_not_in_fav);
- //Swap the contents of mSortIndexes and aTempMap
- mSortIndexes.swap(aTempMap);
+ //Swap the contents of mSortIndexes and aTempMap
+ mSortIndexes.swap(aTempMap);
}
// See also LLInventorySort where landmarks in the Favorites folder are sorted.
class LLViewerInventoryItemSort
{
public:
- bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
- {
- return LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID())
- < LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID());
- }
+ bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
+ {
+ return LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID())
+ < LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID());
+ }
};
void LLFavoritesOrderStorage::saveOrder()
{
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLIsType is_type(LLAssetType::AT_LANDMARK);
- LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- gInventory.collectDescendentsIf(favorites_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
- std::sort(items.begin(), items.end(), LLViewerInventoryItemSort());
- saveItemsOrder(items);
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLIsType is_type(LLAssetType::AT_LANDMARK);
+ LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ gInventory.collectDescendentsIf(favorites_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
+ std::sort(items.begin(), items.end(), LLViewerInventoryItemSort());
+ saveItemsOrder(items);
}
void LLFavoritesOrderStorage::saveItemsOrder( const LLInventoryModel::item_array_t& items )
{
- int sortField = 0;
- // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
- for (LLInventoryModel::item_array_t::const_iterator i = items.begin(); i != items.end(); ++i)
- {
- LLViewerInventoryItem* item = *i;
+ int sortField = 0;
+ // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
+ for (LLInventoryModel::item_array_t::const_iterator i = items.begin(); i != items.end(); ++i)
+ {
+ LLViewerInventoryItem* item = *i;
- setSortIndex(item, ++sortField);
+ setSortIndex(item, ++sortField);
- item->setComplete(TRUE);
- item->updateServer(FALSE);
+ item->setComplete(TRUE);
+ item->updateServer(FALSE);
- gInventory.updateItem(item);
+ gInventory.updateItem(item);
- // Tell the parent folder to refresh its sort order.
- gInventory.addChangedMask(LLInventoryObserver::SORT, item->getParentUUID());
- }
+ // Tell the parent folder to refresh its sort order.
+ gInventory.addChangedMask(LLInventoryObserver::SORT, item->getParentUUID());
+ }
- gInventory.notifyObservers();
+ gInventory.notifyObservers();
}
@@ -1984,184 +1984,184 @@ void LLFavoritesOrderStorage::saveItemsOrder( const LLInventoryModel::item_array
// * @param target_item_id - LLUUID of the target item before which source item should be placed.
void LLFavoritesOrderStorage::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id)
{
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLIsType is_type(LLAssetType::AT_LANDMARK);
- LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- gInventory.collectDescendentsIf(favorites_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLIsType is_type(LLAssetType::AT_LANDMARK);
+ LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ gInventory.collectDescendentsIf(favorites_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
- // ensure items are sorted properly before changing order. EXT-3498
- std::sort(items.begin(), items.end(), LLViewerInventoryItemSort());
+ // ensure items are sorted properly before changing order. EXT-3498
+ std::sort(items.begin(), items.end(), LLViewerInventoryItemSort());
- // update order
- gInventory.updateItemsOrder(items, source_item_id, target_item_id);
+ // update order
+ gInventory.updateItemsOrder(items, source_item_id, target_item_id);
- saveItemsOrder(items);
+ saveItemsOrder(items);
}
BOOL LLFavoritesOrderStorage::saveFavoritesRecord(bool pref_changed)
{
- pref_changed |= mRecreateFavoriteStorage;
- mRecreateFavoriteStorage = false;
-
- // Can get called before inventory is done initializing.
- if (!gInventory.isInventoryUsable())
- {
- return FALSE;
- }
-
- LLUUID favorite_folder= gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- if (favorite_folder.isNull())
- {
- return FALSE;
- }
-
- LLInventoryModel::item_array_t items;
- LLInventoryModel::cat_array_t cats;
-
- LLIsType is_type(LLAssetType::AT_LANDMARK);
- gInventory.collectDescendentsIf(favorite_folder, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
-
- std::sort(items.begin(), items.end(), LLFavoritesSort());
- bool name_changed = false;
-
- for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++)
- {
- if(mFavoriteNames[(*it)->getUUID()] != ((*it)->getName()))
- {
- mFavoriteNames[(*it)->getUUID()] = (*it)->getName();
- name_changed = true;
- }
- }
-
- for (std::set<LLUUID>::iterator it = mMissingSLURLs.begin(); it != mMissingSLURLs.end(); it++)
- {
- slurls_map_t::iterator slurl_iter = mSLURLs.find(*it);
- if (slurl_iter != mSLURLs.end())
- {
- pref_changed = true;
- break;
- }
- }
-
- if((items != mPrevFavorites) || name_changed || pref_changed || gSavedSettings.getBOOL("UpdateRememberPasswordSetting"))
- {
- std::string filename = getStoredFavoritesFilename();
- if (!filename.empty())
- {
- llifstream in_file;
- in_file.open(filename.c_str());
- LLSD fav_llsd;
- if (in_file.is_open())
- {
- LLSDSerialize::fromXML(fav_llsd, in_file);
- in_file.close();
- }
- else
- {
- LL_WARNS("FavoritesBar") << "unable to open favorites from '" << filename << "'" << LL_ENDL;
- }
-
- LLSD user_llsd;
- S32 fav_iter = 0;
- mMissingSLURLs.clear();
+ pref_changed |= mRecreateFavoriteStorage;
+ mRecreateFavoriteStorage = false;
+
+ // Can get called before inventory is done initializing.
+ if (!gInventory.isInventoryUsable())
+ {
+ return FALSE;
+ }
+
+ LLUUID favorite_folder= gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ if (favorite_folder.isNull())
+ {
+ return FALSE;
+ }
+
+ LLInventoryModel::item_array_t items;
+ LLInventoryModel::cat_array_t cats;
+
+ LLIsType is_type(LLAssetType::AT_LANDMARK);
+ gInventory.collectDescendentsIf(favorite_folder, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
+
+ std::sort(items.begin(), items.end(), LLFavoritesSort());
+ bool name_changed = false;
+
+ for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++)
+ {
+ if(mFavoriteNames[(*it)->getUUID()] != ((*it)->getName()))
+ {
+ mFavoriteNames[(*it)->getUUID()] = (*it)->getName();
+ name_changed = true;
+ }
+ }
+
+ for (std::set<LLUUID>::iterator it = mMissingSLURLs.begin(); it != mMissingSLURLs.end(); it++)
+ {
+ slurls_map_t::iterator slurl_iter = mSLURLs.find(*it);
+ if (slurl_iter != mSLURLs.end())
+ {
+ pref_changed = true;
+ break;
+ }
+ }
+
+ if((items != mPrevFavorites) || name_changed || pref_changed || gSavedSettings.getBOOL("UpdateRememberPasswordSetting"))
+ {
+ std::string filename = getStoredFavoritesFilename();
+ if (!filename.empty())
+ {
+ llifstream in_file;
+ in_file.open(filename.c_str());
+ LLSD fav_llsd;
+ if (in_file.is_open())
+ {
+ LLSDSerialize::fromXML(fav_llsd, in_file);
+ in_file.close();
+ }
+ else
+ {
+ LL_WARNS("FavoritesBar") << "unable to open favorites from '" << filename << "'" << LL_ENDL;
+ }
+
+ LLSD user_llsd;
+ S32 fav_iter = 0;
+ mMissingSLURLs.clear();
LLSD save_pass;
save_pass["save_password"] = gSavedSettings.getBOOL("RememberPassword");
user_llsd[fav_iter] = save_pass;
fav_iter++;
- for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++)
- {
- LLSD value;
- if (gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"))
- {
- value["name"] = (*it)->getName();
- value["asset_id"] = (*it)->getAssetUUID();
- value["id"] = (*it)->getUUID();
- slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]);
- if (slurl_iter != mSLURLs.end())
- {
- value["slurl"] = slurl_iter->second;
- user_llsd[fav_iter] = value;
- }
- else
- {
- getSLURL((*it)->getAssetUUID());
- value["slurl"] = "";
- user_llsd[fav_iter] = value;
- mUpdateRequired = true;
- mMissingSLURLs.insert((*it)->getAssetUUID());
- }
- }
- else
- {
- value["id"] = (*it)->getUUID();
- user_llsd[fav_iter] = value;
- }
-
- fav_iter ++;
- }
-
- LLAvatarName av_name;
- LLAvatarNameCache::get( gAgentID, &av_name );
- // Note : use the "John Doe" and not the "john.doe" version of the name
- // as we'll compare it with the stored credentials in the login panel.
- fav_llsd[av_name.getUserName()] = user_llsd;
- llofstream file;
- file.open(filename.c_str());
- if ( file.is_open() )
- {
- LLSDSerialize::toPrettyXML(fav_llsd, file);
- file.close();
- mSaveOnExit = false;
- }
- else
- {
- LL_WARNS("FavoritesBar") << "unable to open favorites storage for '" << av_name.getUserName()
- << "' at '" << filename << "' " << LL_ENDL;
- }
- }
- mPrevFavorites = items;
- }
-
- return TRUE;
+ for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++)
+ {
+ LLSD value;
+ if (gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"))
+ {
+ value["name"] = (*it)->getName();
+ value["asset_id"] = (*it)->getAssetUUID();
+ value["id"] = (*it)->getUUID();
+ slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]);
+ if (slurl_iter != mSLURLs.end())
+ {
+ value["slurl"] = slurl_iter->second;
+ user_llsd[fav_iter] = value;
+ }
+ else
+ {
+ getSLURL((*it)->getAssetUUID());
+ value["slurl"] = "";
+ user_llsd[fav_iter] = value;
+ mUpdateRequired = true;
+ mMissingSLURLs.insert((*it)->getAssetUUID());
+ }
+ }
+ else
+ {
+ value["id"] = (*it)->getUUID();
+ user_llsd[fav_iter] = value;
+ }
+
+ fav_iter ++;
+ }
+
+ LLAvatarName av_name;
+ LLAvatarNameCache::get( gAgentID, &av_name );
+ // Note : use the "John Doe" and not the "john.doe" version of the name
+ // as we'll compare it with the stored credentials in the login panel.
+ fav_llsd[av_name.getUserName()] = user_llsd;
+ llofstream file;
+ file.open(filename.c_str());
+ if ( file.is_open() )
+ {
+ LLSDSerialize::toPrettyXML(fav_llsd, file);
+ file.close();
+ mSaveOnExit = false;
+ }
+ else
+ {
+ LL_WARNS("FavoritesBar") << "unable to open favorites storage for '" << av_name.getUserName()
+ << "' at '" << filename << "' " << LL_ENDL;
+ }
+ }
+ mPrevFavorites = items;
+ }
+
+ return TRUE;
}
void LLFavoritesOrderStorage::showFavoritesOnLoginChanged(BOOL show)
{
- if (show)
- {
- saveFavoritesRecord(true);
- }
- else
- {
- removeFavoritesRecordOfUser();
- }
+ if (show)
+ {
+ saveFavoritesRecord(true);
+ }
+ else
+ {
+ removeFavoritesRecordOfUser();
+ }
}
bool LLFavoritesOrderStorage::isStorageUpdateNeeded()
{
- if (!mRecreateFavoriteStorage)
- {
- for (LLSD::array_iterator iter = mStorageFavorites.beginArray();
- iter != mStorageFavorites.endArray(); ++iter)
- {
- if (mFavoriteNames[iter->get("id").asUUID()] != iter->get("name").asString())
- {
- mRecreateFavoriteStorage = true;
- return true;
- }
- }
- }
- return false;
+ if (!mRecreateFavoriteStorage)
+ {
+ for (LLSD::array_iterator iter = mStorageFavorites.beginArray();
+ iter != mStorageFavorites.endArray(); ++iter)
+ {
+ if (mFavoriteNames[iter->get("id").asUUID()] != iter->get("name").asString())
+ {
+ mRecreateFavoriteStorage = true;
+ return true;
+ }
+ }
+ }
+ return false;
}
void AddFavoriteLandmarkCallback::fire(const LLUUID& inv_item_id)
{
- if (mTargetLandmarkId.isNull()) return;
+ if (mTargetLandmarkId.isNull()) return;
- LLFavoritesOrderStorage::instance().rearrangeFavoriteLandmarks(inv_item_id, mTargetLandmarkId);
+ LLFavoritesOrderStorage::instance().rearrangeFavoriteLandmarks(inv_item_id, mTargetLandmarkId);
}
// EOF
diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h
index 68a679e27f..92f5809b87 100644
--- a/indra/newview/llfavoritesbar.h
+++ b/indra/newview/llfavoritesbar.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfavoritesbar.h
* @brief LLFavoritesBarCtrl base class
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,135 +42,135 @@ class LLToggleableMenu;
class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver
{
public:
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<LLUIImage*> image_drag_indication;
- Optional<LLTextBox::Params> more_button;
- Optional<LLTextBox::Params> label;
- Params();
- };
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Optional<LLUIImage*> image_drag_indication;
+ Optional<LLTextBox::Params> more_button;
+ Optional<LLTextBox::Params> label;
+ Params();
+ };
protected:
- LLFavoritesBarCtrl(const Params&);
- friend class LLUICtrlFactory;
+ LLFavoritesBarCtrl(const Params&);
+ friend class LLUICtrlFactory;
friend class LLItemCopiedCallback;
public:
- virtual ~LLFavoritesBarCtrl();
+ virtual ~LLFavoritesBarCtrl();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- // LLInventoryObserver observer trigger
- virtual void changed(U32 mask);
- virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- virtual void draw();
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ // LLInventoryObserver observer trigger
+ virtual void changed(U32 mask);
+ virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ virtual void draw();
- void showDragMarker(BOOL show) { mShowDragMarker = show; }
- void setLandingTab(LLUICtrl* tab) { mLandingTab = tab; }
+ void showDragMarker(BOOL show) { mShowDragMarker = show; }
+ void setLandingTab(LLUICtrl* tab) { mLandingTab = tab; }
protected:
void updateButtons(bool force_update = false);
- LLButton* createButton(const LLPointer<LLViewerInventoryItem> item, const LLButton::Params& button_params, S32 x_offset );
- const LLButton::Params& getButtonParams();
- BOOL collectFavoriteItems(LLInventoryModel::item_array_t &items);
+ LLButton* createButton(const LLPointer<LLViewerInventoryItem> item, const LLButton::Params& button_params, S32 x_offset );
+ const LLButton::Params& getButtonParams();
+ BOOL collectFavoriteItems(LLInventoryModel::item_array_t &items);
+
+ void onButtonClick(LLUUID id);
+ void onButtonRightClick(LLUUID id,LLView* button,S32 x,S32 y,MASK mask);
+
+ void onButtonMouseDown(LLUUID id, LLUICtrl* button, S32 x, S32 y, MASK mask);
+ void onButtonMouseUp(LLUUID id, LLUICtrl* button, S32 x, S32 y, MASK mask);
- void onButtonClick(LLUUID id);
- void onButtonRightClick(LLUUID id,LLView* button,S32 x,S32 y,MASK mask);
-
- void onButtonMouseDown(LLUUID id, LLUICtrl* button, S32 x, S32 y, MASK mask);
- void onButtonMouseUp(LLUUID id, LLUICtrl* button, S32 x, S32 y, MASK mask);
+ void onEndDrag();
- void onEndDrag();
+ bool enableSelected(const LLSD& userdata);
+ void doToSelected(const LLSD& userdata);
+ static bool onRenameCommit(const LLSD& notification, const LLSD& response);
+ BOOL isClipboardPasteable() const;
+ void pasteFromClipboard() const;
- bool enableSelected(const LLSD& userdata);
- void doToSelected(const LLSD& userdata);
- static bool onRenameCommit(const LLSD& notification, const LLSD& response);
- BOOL isClipboardPasteable() const;
- void pasteFromClipboard() const;
-
- void showDropDownMenu();
+ void showDropDownMenu();
- void onMoreTextBoxClicked();
+ void onMoreTextBoxClicked();
- LLHandle<LLView> mOverflowMenuHandle;
- LLHandle<LLView> mContextMenuHandle;
+ LLHandle<LLView> mOverflowMenuHandle;
+ LLHandle<LLView> mContextMenuHandle;
- LLUUID mFavoriteFolderId;
- const LLFontGL *mFont;
- S32 mFirstDropDownItem;
- S32 mDropDownItemsCount;
- bool mUpdateDropDownItems;
- bool mRestoreOverflowMenu;
+ LLUUID mFavoriteFolderId;
+ const LLFontGL *mFont;
+ S32 mFirstDropDownItem;
+ S32 mDropDownItemsCount;
+ bool mUpdateDropDownItems;
+ bool mRestoreOverflowMenu;
- bool mGetPrevItems;
+ bool mGetPrevItems;
- LLUUID mSelectedItemID;
- LLFrameTimer mItemsChangedTimer;
- LLUIImage* mImageDragIndication;
+ LLUUID mSelectedItemID;
+ LLFrameTimer mItemsChangedTimer;
+ LLUIImage* mImageDragIndication;
private:
- /*
- * Helper function to make code more readable. It handles all drag and drop
- * operations of the existing favorites items on the favorites bar.
- */
- void handleExistingFavoriteDragAndDrop(S32 x, S32 y);
+ /*
+ * Helper function to make code more readable. It handles all drag and drop
+ * operations of the existing favorites items on the favorites bar.
+ */
+ void handleExistingFavoriteDragAndDrop(S32 x, S32 y);
- /*
- * Helper function to make code more readable. It handles all drag and drop
- * operations of the new landmark to the favorites bar.
- */
- void handleNewFavoriteDragAndDrop(LLInventoryItem *item, const LLUUID& favorites_id, S32 x, S32 y);
+ /*
+ * Helper function to make code more readable. It handles all drag and drop
+ * operations of the new landmark to the favorites bar.
+ */
+ void handleNewFavoriteDragAndDrop(LLInventoryItem *item, const LLUUID& favorites_id, S32 x, S32 y);
- // finds a control under the specified LOCAL point
- LLUICtrl* findChildByLocalCoords(S32 x, S32 y);
+ // finds a control under the specified LOCAL point
+ LLUICtrl* findChildByLocalCoords(S32 x, S32 y);
- // checks if the current order of the favorites items must be saved
- BOOL needToSaveItemsOrder(const LLInventoryModel::item_array_t& items);
+ // checks if the current order of the favorites items must be saved
+ BOOL needToSaveItemsOrder(const LLInventoryModel::item_array_t& items);
- /**
- * inserts an item identified by insertedItemId BEFORE an item identified by beforeItemId.
- * this function assumes that an item identified by insertedItemId doesn't exist in items array.
- */
- void insertItem(LLInventoryModel::item_array_t& items, const LLUUID& dest_item_id, LLViewerInventoryItem* insertedItem, bool insert_before);
+ /**
+ * inserts an item identified by insertedItemId BEFORE an item identified by beforeItemId.
+ * this function assumes that an item identified by insertedItemId doesn't exist in items array.
+ */
+ void insertItem(LLInventoryModel::item_array_t& items, const LLUUID& dest_item_id, LLViewerInventoryItem* insertedItem, bool insert_before);
- // finds an item by it's UUID in the items array
- LLInventoryModel::item_array_t::iterator findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id);
+ // finds an item by it's UUID in the items array
+ LLInventoryModel::item_array_t::iterator findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id);
- void createOverflowMenu();
+ void createOverflowMenu();
- void updateMenuItems(LLToggleableMenu* menu);
+ void updateMenuItems(LLToggleableMenu* menu);
- // Fits menu item label width with favorites menu width
- void fitLabelWidth(LLMenuItemCallGL* menu_item);
+ // Fits menu item label width with favorites menu width
+ void fitLabelWidth(LLMenuItemCallGL* menu_item);
- void addOpenLandmarksMenuItem(LLToggleableMenu* menu);
+ void addOpenLandmarksMenuItem(LLToggleableMenu* menu);
- void positionAndShowMenu(LLToggleableMenu* menu);
+ void positionAndShowMenu(LLToggleableMenu* menu);
- BOOL mShowDragMarker;
- LLUICtrl* mLandingTab;
- LLUICtrl* mLastTab;
- LLTextBox* mMoreTextBox;
- LLTextBox* mBarLabel;
+ BOOL mShowDragMarker;
+ LLUICtrl* mLandingTab;
+ LLUICtrl* mLastTab;
+ LLTextBox* mMoreTextBox;
+ LLTextBox* mBarLabel;
- LLUUID mDragItemId;
- BOOL mStartDrag;
- LLInventoryModel::item_array_t mItems;
+ LLUUID mDragItemId;
+ BOOL mStartDrag;
+ LLInventoryModel::item_array_t mItems;
static F64 sWaitingForCallabck;
bool mItemsListDirty;
- S32 mMouseX;
- S32 mMouseY;
+ S32 mMouseX;
+ S32 mMouseY;
- boost::signals2::connection mEndDragConnection;
+ boost::signals2::connection mEndDragConnection;
};
/**
@@ -179,118 +179,118 @@ private:
* Data are stored in user home directory.
*/
class LLFavoritesOrderStorage : public LLSingleton<LLFavoritesOrderStorage>
- , public LLDestroyClass<LLFavoritesOrderStorage>
+ , public LLDestroyClass<LLFavoritesOrderStorage>
{
- LLSINGLETON(LLFavoritesOrderStorage);
- LOG_CLASS(LLFavoritesOrderStorage);
+ LLSINGLETON(LLFavoritesOrderStorage);
+ LOG_CLASS(LLFavoritesOrderStorage);
public:
- /**
- * Sets sort index for specified with LLUUID favorite landmark
- */
- void setSortIndex(const LLViewerInventoryItem* inv_item, S32 sort_index);
-
- /**
- * Gets sort index for specified with LLUUID favorite landmark
- */
- S32 getSortIndex(const LLUUID& inv_item_id);
- void removeSortIndex(const LLUUID& inv_item_id);
-
- void getSLURL(const LLUUID& asset_id);
-
- // Saves current order of the passed items using inventory item sort field.
- // Resets 'items' sort fields and saves them on server.
- // Is used to save order for Favorites folder.
- void saveItemsOrder(const LLInventoryModel::item_array_t& items);
-
- void saveOrder();
-
- void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
-
- /**
- * Implementation of LLDestroyClass. Calls cleanup() instance method.
- *
- * It is important this callback is called before gInventory is cleaned.
- * For now it is called from LLAppViewer::cleanup() -> LLAppViewer::disconnectViewer(),
- * Inventory is cleaned later from LLAppViewer::cleanup() after LLAppViewer::disconnectViewer() is called.
- * @see cleanup()
- */
- static void destroyClass();
- static std::string getStoredFavoritesFilename(const std::string &grid);
- static std::string getStoredFavoritesFilename();
- static std::string getSavedOrderFileName();
-
- // Remove record of specified user's favorites from file on disk.
- static void removeFavoritesRecordOfUser(const std::string &user, const std::string &grid);
- // Remove record of current user's favorites from file on disk.
- static void removeFavoritesRecordOfUser();
-
- BOOL saveFavoritesRecord(bool pref_changed = false);
- void showFavoritesOnLoginChanged(BOOL show);
-
- bool isStorageUpdateNeeded();
-
- LLInventoryModel::item_array_t mPrevFavorites;
- LLSD mStorageFavorites;
- bool mRecreateFavoriteStorage;
-
- const static S32 NO_INDEX;
- static bool mSaveOnExit;
- bool mUpdateRequired;
- std::map<LLUUID,std::string> mFavoriteNames;
+ /**
+ * Sets sort index for specified with LLUUID favorite landmark
+ */
+ void setSortIndex(const LLViewerInventoryItem* inv_item, S32 sort_index);
+
+ /**
+ * Gets sort index for specified with LLUUID favorite landmark
+ */
+ S32 getSortIndex(const LLUUID& inv_item_id);
+ void removeSortIndex(const LLUUID& inv_item_id);
+
+ void getSLURL(const LLUUID& asset_id);
+
+ // Saves current order of the passed items using inventory item sort field.
+ // Resets 'items' sort fields and saves them on server.
+ // Is used to save order for Favorites folder.
+ void saveItemsOrder(const LLInventoryModel::item_array_t& items);
+
+ void saveOrder();
+
+ void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
+
+ /**
+ * Implementation of LLDestroyClass. Calls cleanup() instance method.
+ *
+ * It is important this callback is called before gInventory is cleaned.
+ * For now it is called from LLAppViewer::cleanup() -> LLAppViewer::disconnectViewer(),
+ * Inventory is cleaned later from LLAppViewer::cleanup() after LLAppViewer::disconnectViewer() is called.
+ * @see cleanup()
+ */
+ static void destroyClass();
+ static std::string getStoredFavoritesFilename(const std::string &grid);
+ static std::string getStoredFavoritesFilename();
+ static std::string getSavedOrderFileName();
+
+ // Remove record of specified user's favorites from file on disk.
+ static void removeFavoritesRecordOfUser(const std::string &user, const std::string &grid);
+ // Remove record of current user's favorites from file on disk.
+ static void removeFavoritesRecordOfUser();
+
+ BOOL saveFavoritesRecord(bool pref_changed = false);
+ void showFavoritesOnLoginChanged(BOOL show);
+
+ bool isStorageUpdateNeeded();
+
+ LLInventoryModel::item_array_t mPrevFavorites;
+ LLSD mStorageFavorites;
+ bool mRecreateFavoriteStorage;
+
+ const static S32 NO_INDEX;
+ static bool mSaveOnExit;
+ bool mUpdateRequired;
+ std::map<LLUUID,std::string> mFavoriteNames;
private:
- /**
- * Removes sort indexes for items which are not in Favorites bar for now.
- */
- void cleanup();
+ /**
+ * Removes sort indexes for items which are not in Favorites bar for now.
+ */
+ void cleanup();
- const static std::string SORTING_DATA_FILE_NAME;
+ const static std::string SORTING_DATA_FILE_NAME;
- void load();
+ void load();
- void onLandmarkLoaded(const LLUUID& asset_id, class LLLandmark* landmark);
- void storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl);
+ void onLandmarkLoaded(const LLUUID& asset_id, class LLLandmark* landmark);
+ void storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl);
- typedef std::map<LLUUID, S32> sort_index_map_t;
- sort_index_map_t mSortIndexes;
+ typedef std::map<LLUUID, S32> sort_index_map_t;
+ sort_index_map_t mSortIndexes;
- typedef std::map<LLUUID, std::string> slurls_map_t;
- slurls_map_t mSLURLs;
- std::set<LLUUID> mMissingSLURLs;
- bool mIsDirty;
+ typedef std::map<LLUUID, std::string> slurls_map_t;
+ slurls_map_t mSLURLs;
+ std::set<LLUUID> mMissingSLURLs;
+ bool mIsDirty;
- struct IsNotInFavorites
- {
- IsNotInFavorites(const LLInventoryModel::item_array_t& items)
- : mFavoriteItems(items)
- {
+ struct IsNotInFavorites
+ {
+ IsNotInFavorites(const LLInventoryModel::item_array_t& items)
+ : mFavoriteItems(items)
+ {
- }
+ }
- /**
- * Returns true if specified item is not found among inventory items
- */
- bool operator()(const sort_index_map_t::value_type& id_index_pair) const
- {
- LLPointer<LLViewerInventoryItem> item = gInventory.getItem(id_index_pair.first);
- if (item.isNull()) return true;
+ /**
+ * Returns true if specified item is not found among inventory items
+ */
+ bool operator()(const sort_index_map_t::value_type& id_index_pair) const
+ {
+ LLPointer<LLViewerInventoryItem> item = gInventory.getItem(id_index_pair.first);
+ if (item.isNull()) return true;
- LLInventoryModel::item_array_t::const_iterator found_it =
- std::find(mFavoriteItems.begin(), mFavoriteItems.end(), item);
+ LLInventoryModel::item_array_t::const_iterator found_it =
+ std::find(mFavoriteItems.begin(), mFavoriteItems.end(), item);
- return found_it == mFavoriteItems.end();
- }
- private:
- LLInventoryModel::item_array_t mFavoriteItems;
- };
+ return found_it == mFavoriteItems.end();
+ }
+ private:
+ LLInventoryModel::item_array_t mFavoriteItems;
+ };
};
inline
LLFavoritesOrderStorage::LLFavoritesOrderStorage() :
- mIsDirty(false),
- mUpdateRequired(false),
- mRecreateFavoriteStorage(false)
+ mIsDirty(false),
+ mUpdateRequired(false),
+ mRecreateFavoriteStorage(false)
{ load(); }
#endif // LL_LLFAVORITESBARCTRL_H
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index f482d5a37d..99139e6528 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfeaturemanager.cpp
* @brief LLFeatureManager class implementation
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -71,12 +71,12 @@ const char FEATURE_TABLE_FILENAME[] = "featuretable.txt";
#if 0 // consuming code in #if 0 below
#endif
LLFeatureInfo::LLFeatureInfo(const std::string& name, const BOOL available, const F32 level)
- : mValid(TRUE), mName(name), mAvailable(available), mRecommendedLevel(level)
+ : mValid(TRUE), mName(name), mAvailable(available), mRecommendedLevel(level)
{
}
LLFeatureList::LLFeatureList(const std::string& name)
- : mName(name)
+ : mName(name)
{
}
@@ -86,293 +86,293 @@ LLFeatureList::~LLFeatureList()
void LLFeatureList::addFeature(const std::string& name, const BOOL available, const F32 level)
{
- if (mFeatures.count(name))
- {
- LL_WARNS("RenderInit") << "LLFeatureList::Attempting to add preexisting feature " << name << LL_ENDL;
- }
+ if (mFeatures.count(name))
+ {
+ LL_WARNS("RenderInit") << "LLFeatureList::Attempting to add preexisting feature " << name << LL_ENDL;
+ }
- LLFeatureInfo fi(name, available, level);
+ LLFeatureInfo fi(name, available, level);
LL_DEBUGS_ONCE("RenderInit") << "Feature '" << name << "' "
<< (available ? "" : "not " ) << "available"
<< " at " << level
<< LL_ENDL;
- mFeatures[name] = fi;
+ mFeatures[name] = fi;
}
BOOL LLFeatureList::isFeatureAvailable(const std::string& name)
{
- if (mFeatures.count(name))
- {
- return mFeatures[name].mAvailable;
- }
-
- LL_WARNS_ONCE("RenderInit") << "Feature " << name << " not on feature list!" << LL_ENDL;
-
- // changing this to TRUE so you have to explicitly disable
- // something for it to be disabled
- return TRUE;
+ if (mFeatures.count(name))
+ {
+ return mFeatures[name].mAvailable;
+ }
+
+ LL_WARNS_ONCE("RenderInit") << "Feature " << name << " not on feature list!" << LL_ENDL;
+
+ // changing this to TRUE so you have to explicitly disable
+ // something for it to be disabled
+ return TRUE;
}
F32 LLFeatureList::getRecommendedValue(const std::string& name)
{
- if (mFeatures.count(name) && isFeatureAvailable(name))
- {
+ if (mFeatures.count(name) && isFeatureAvailable(name))
+ {
LL_DEBUGS_ONCE("RenderInit") << "Setting '" << name << "' to recommended value " << mFeatures[name].mRecommendedLevel << LL_ENDL;
- return mFeatures[name].mRecommendedLevel;
- }
+ return mFeatures[name].mRecommendedLevel;
+ }
- LL_WARNS_ONCE("RenderInit") << "Feature " << name << " not on feature list or not available!" << LL_ENDL;
- return 0;
+ LL_WARNS_ONCE("RenderInit") << "Feature " << name << " not on feature list or not available!" << LL_ENDL;
+ return 0;
}
BOOL LLFeatureList::maskList(LLFeatureList &mask)
{
- LL_DEBUGS_ONCE() << "Masking with " << mask.mName << LL_ENDL;
- //
- // Lookup the specified feature mask, and overlay it on top of the
- // current feature mask.
- //
-
- LLFeatureInfo mask_fi;
-
- feature_map_t::iterator feature_it;
- for (feature_it = mask.mFeatures.begin(); feature_it != mask.mFeatures.end(); ++feature_it)
- {
- mask_fi = feature_it->second;
- //
- // Look for the corresponding feature
- //
- if (!mFeatures.count(mask_fi.mName))
- {
- LL_WARNS("RenderInit") << "Feature " << mask_fi.mName << " in mask not in top level!" << LL_ENDL;
- continue;
- }
-
- LLFeatureInfo &cur_fi = mFeatures[mask_fi.mName];
- if (mask_fi.mAvailable && !cur_fi.mAvailable)
- {
- LL_WARNS("RenderInit") << "Mask attempting to reenabling disabled feature, ignoring " << cur_fi.mName << LL_ENDL;
- continue;
- }
- cur_fi.mAvailable = mask_fi.mAvailable;
- cur_fi.mRecommendedLevel = llmin(cur_fi.mRecommendedLevel, mask_fi.mRecommendedLevel);
- LL_DEBUGS("RenderInit") << "Feature mask " << mask.mName
- << " Feature " << mask_fi.mName
- << " Mask: " << mask_fi.mRecommendedLevel
- << " Now: " << cur_fi.mRecommendedLevel << LL_ENDL;
- }
-
- LL_DEBUGS("RenderInit") << "After applying mask " << mask.mName << std::endl;
- // Will conditionally call dump only if the above message will be logged, thanks
- // to it being wrapped by the LL_DEBUGS and LL_ENDL macros.
- dump();
- LL_CONT << LL_ENDL;
-
- return TRUE;
+ LL_DEBUGS_ONCE() << "Masking with " << mask.mName << LL_ENDL;
+ //
+ // Lookup the specified feature mask, and overlay it on top of the
+ // current feature mask.
+ //
+
+ LLFeatureInfo mask_fi;
+
+ feature_map_t::iterator feature_it;
+ for (feature_it = mask.mFeatures.begin(); feature_it != mask.mFeatures.end(); ++feature_it)
+ {
+ mask_fi = feature_it->second;
+ //
+ // Look for the corresponding feature
+ //
+ if (!mFeatures.count(mask_fi.mName))
+ {
+ LL_WARNS("RenderInit") << "Feature " << mask_fi.mName << " in mask not in top level!" << LL_ENDL;
+ continue;
+ }
+
+ LLFeatureInfo &cur_fi = mFeatures[mask_fi.mName];
+ if (mask_fi.mAvailable && !cur_fi.mAvailable)
+ {
+ LL_WARNS("RenderInit") << "Mask attempting to reenabling disabled feature, ignoring " << cur_fi.mName << LL_ENDL;
+ continue;
+ }
+ cur_fi.mAvailable = mask_fi.mAvailable;
+ cur_fi.mRecommendedLevel = llmin(cur_fi.mRecommendedLevel, mask_fi.mRecommendedLevel);
+ LL_DEBUGS("RenderInit") << "Feature mask " << mask.mName
+ << " Feature " << mask_fi.mName
+ << " Mask: " << mask_fi.mRecommendedLevel
+ << " Now: " << cur_fi.mRecommendedLevel << LL_ENDL;
+ }
+
+ LL_DEBUGS("RenderInit") << "After applying mask " << mask.mName << std::endl;
+ // Will conditionally call dump only if the above message will be logged, thanks
+ // to it being wrapped by the LL_DEBUGS and LL_ENDL macros.
+ dump();
+ LL_CONT << LL_ENDL;
+
+ return TRUE;
}
void LLFeatureList::dump()
{
- LL_DEBUGS("RenderInit") << "Feature list: " << mName << LL_ENDL;
-
- LLFeatureInfo fi;
- feature_map_t::iterator feature_it;
- for (feature_it = mFeatures.begin(); feature_it != mFeatures.end(); ++feature_it)
- {
- fi = feature_it->second;
- LL_DEBUGS("RenderInit") << "With " << mName << " feature " << fi.mName << " " << fi.mAvailable << ":" << fi.mRecommendedLevel << LL_ENDL;
- }
+ LL_DEBUGS("RenderInit") << "Feature list: " << mName << LL_ENDL;
+
+ LLFeatureInfo fi;
+ feature_map_t::iterator feature_it;
+ for (feature_it = mFeatures.begin(); feature_it != mFeatures.end(); ++feature_it)
+ {
+ fi = feature_it->second;
+ LL_DEBUGS("RenderInit") << "With " << mName << " feature " << fi.mName << " " << fi.mAvailable << ":" << fi.mRecommendedLevel << LL_ENDL;
+ }
}
static const std::vector<std::string> sGraphicsLevelNames = boost::assign::list_of
- ("Low")
- ("LowMid")
- ("Mid")
- ("MidHigh")
- ("High")
- ("HighUltra")
- ("Ultra")
+ ("Low")
+ ("LowMid")
+ ("Mid")
+ ("MidHigh")
+ ("High")
+ ("HighUltra")
+ ("Ultra")
;
U32 LLFeatureManager::getMaxGraphicsLevel() const
{
- return sGraphicsLevelNames.size() - 1;
+ return sGraphicsLevelNames.size() - 1;
}
bool LLFeatureManager::isValidGraphicsLevel(U32 level) const
{
- return (level <= getMaxGraphicsLevel());
+ return (level <= getMaxGraphicsLevel());
}
std::string LLFeatureManager::getNameForGraphicsLevel(U32 level) const
{
- if (isValidGraphicsLevel(level))
- {
- return sGraphicsLevelNames[level];
- }
- return STRINGIZE("Invalid graphics level " << level << ", valid are 0 .. "
- << getMaxGraphicsLevel());
+ if (isValidGraphicsLevel(level))
+ {
+ return sGraphicsLevelNames[level];
+ }
+ return STRINGIZE("Invalid graphics level " << level << ", valid are 0 .. "
+ << getMaxGraphicsLevel());
}
S32 LLFeatureManager::getGraphicsLevelForName(const std::string& name) const
{
- const std::string FixedFunction("FixedFunction");
- std::string rname(name);
- if (LLStringUtil::endsWith(rname, FixedFunction))
- {
- // chop off any "FixedFunction" suffix
- rname = rname.substr(0, rname.length() - FixedFunction.length());
- }
- for (S32 i(0), iend(getMaxGraphicsLevel()); i <= iend; ++i)
- {
- if (sGraphicsLevelNames[i] == rname)
- {
- return i;
- }
- }
- return -1;
+ const std::string FixedFunction("FixedFunction");
+ std::string rname(name);
+ if (LLStringUtil::endsWith(rname, FixedFunction))
+ {
+ // chop off any "FixedFunction" suffix
+ rname = rname.substr(0, rname.length() - FixedFunction.length());
+ }
+ for (S32 i(0), iend(getMaxGraphicsLevel()); i <= iend; ++i)
+ {
+ if (sGraphicsLevelNames[i] == rname)
+ {
+ return i;
+ }
+ }
+ return -1;
}
LLFeatureList *LLFeatureManager::findMask(const std::string& name)
{
- if (mMaskList.count(name))
- {
- return mMaskList[name];
- }
+ if (mMaskList.count(name))
+ {
+ return mMaskList[name];
+ }
- return NULL;
+ return NULL;
}
BOOL LLFeatureManager::maskFeatures(const std::string& name)
{
- LLFeatureList *maskp = findMask(name);
- if (!maskp)
- {
- LL_DEBUGS("RenderInit") << "Unknown feature mask " << name << LL_ENDL;
- return FALSE;
- }
- LL_INFOS("RenderInit") << "Applying GPU Feature list: " << name << LL_ENDL;
- return maskList(*maskp);
+ LLFeatureList *maskp = findMask(name);
+ if (!maskp)
+ {
+ LL_DEBUGS("RenderInit") << "Unknown feature mask " << name << LL_ENDL;
+ return FALSE;
+ }
+ LL_INFOS("RenderInit") << "Applying GPU Feature list: " << name << LL_ENDL;
+ return maskList(*maskp);
}
bool LLFeatureManager::loadFeatureTables()
{
- // *TODO - if I or anyone else adds something else to the skipped list
- // make this data driven. Put it in the feature table and parse it
- // correctly
- mSkippedFeatures.insert("RenderAnisotropic");
- mSkippedFeatures.insert("RenderGamma");
- mSkippedFeatures.insert("RenderVBOEnable");
- mSkippedFeatures.insert("RenderFogRatio");
+ // *TODO - if I or anyone else adds something else to the skipped list
+ // make this data driven. Put it in the feature table and parse it
+ // correctly
+ mSkippedFeatures.insert("RenderAnisotropic");
+ mSkippedFeatures.insert("RenderGamma");
+ mSkippedFeatures.insert("RenderVBOEnable");
+ mSkippedFeatures.insert("RenderFogRatio");
- // first table is install with app
- std::string app_path = gDirUtilp->getAppRODataDir();
- app_path += gDirUtilp->getDirDelimiter();
+ // first table is install with app
+ std::string app_path = gDirUtilp->getAppRODataDir();
+ app_path += gDirUtilp->getDirDelimiter();
- std::string filename;
- filename = FEATURE_TABLE_FILENAME;
+ std::string filename;
+ filename = FEATURE_TABLE_FILENAME;
- app_path += filename;
+ app_path += filename;
- bool parse_ok = parseFeatureTable(app_path);
+ bool parse_ok = parseFeatureTable(app_path);
- return parse_ok;
+ return parse_ok;
}
bool LLFeatureManager::parseFeatureTable(std::string filename)
{
- LL_INFOS("RenderInit") << "Attempting to parse feature table from " << filename << LL_ENDL;
-
- llifstream file;
- std::string name;
- U32 version;
-
- cleanupFeatureTables(); // in case an earlier attempt left partial results
- file.open(filename.c_str()); /*Flawfinder: ignore*/
-
- if (!file)
- {
- LL_WARNS("RenderInit") << "Unable to open feature table " << filename << LL_ENDL;
- return FALSE;
- }
-
- // Check file version
- file >> name;
- if (name != "version")
- {
- LL_WARNS("RenderInit") << filename << " does not appear to be a valid feature table!" << LL_ENDL;
- return false;
- }
- file >> version;
-
- mTableVersion = version;
- LL_INFOS("RenderInit") << "Found feature table version " << version << LL_ENDL;
-
- LLFeatureList *flp = NULL;
- bool parse_ok = true;
- while (parse_ok && file >> name )
- {
- char buffer[MAX_STRING]; /*Flawfinder: ignore*/
-
- if (name.substr(0,2) == "//")
- {
- // This is a comment.
- file.getline(buffer, MAX_STRING);
- continue;
- }
-
- if (name == "list")
- {
- LL_DEBUGS("RenderInit") << "Before new list" << std::endl;
- if (flp)
- {
- flp->dump();
- }
- else
- {
- LL_CONT << "No current list";
- }
- LL_CONT << LL_ENDL;
-
- // It's a new mask, create it.
- file >> name;
- if (!mMaskList.count(name))
- {
+ LL_INFOS("RenderInit") << "Attempting to parse feature table from " << filename << LL_ENDL;
+
+ llifstream file;
+ std::string name;
+ U32 version;
+
+ cleanupFeatureTables(); // in case an earlier attempt left partial results
+ file.open(filename.c_str()); /*Flawfinder: ignore*/
+
+ if (!file)
+ {
+ LL_WARNS("RenderInit") << "Unable to open feature table " << filename << LL_ENDL;
+ return FALSE;
+ }
+
+ // Check file version
+ file >> name;
+ if (name != "version")
+ {
+ LL_WARNS("RenderInit") << filename << " does not appear to be a valid feature table!" << LL_ENDL;
+ return false;
+ }
+ file >> version;
+
+ mTableVersion = version;
+ LL_INFOS("RenderInit") << "Found feature table version " << version << LL_ENDL;
+
+ LLFeatureList *flp = NULL;
+ bool parse_ok = true;
+ while (parse_ok && file >> name )
+ {
+ char buffer[MAX_STRING]; /*Flawfinder: ignore*/
+
+ if (name.substr(0,2) == "//")
+ {
+ // This is a comment.
+ file.getline(buffer, MAX_STRING);
+ continue;
+ }
+
+ if (name == "list")
+ {
+ LL_DEBUGS("RenderInit") << "Before new list" << std::endl;
+ if (flp)
+ {
+ flp->dump();
+ }
+ else
+ {
+ LL_CONT << "No current list";
+ }
+ LL_CONT << LL_ENDL;
+
+ // It's a new mask, create it.
+ file >> name;
+ if (!mMaskList.count(name))
+ {
flp = new LLFeatureList(name);
mMaskList[name] = flp;
}
else
{
- LL_WARNS("RenderInit") << "Overriding mask '" << name << "'; this is invalid!" << LL_ENDL;
- parse_ok = false;
- }
- }
- else
- {
- if (flp)
- {
+ LL_WARNS("RenderInit") << "Overriding mask '" << name << "'; this is invalid!" << LL_ENDL;
+ parse_ok = false;
+ }
+ }
+ else
+ {
+ if (flp)
+ {
S32 available;
F32 recommended;
file >> available >> recommended;
flp->addFeature(name, available, recommended);
}
- else
- {
- LL_WARNS("RenderInit") << "Specified parameter before <list> keyword!" << LL_ENDL;
- parse_ok = false;
- }
- }
- }
- file.close();
-
- if (!parse_ok)
- {
- LL_WARNS("RenderInit") << "Discarding feature table data from " << filename << LL_ENDL;
- cleanupFeatureTables();
- }
-
- return parse_ok;
+ else
+ {
+ LL_WARNS("RenderInit") << "Specified parameter before <list> keyword!" << LL_ENDL;
+ parse_ok = false;
+ }
+ }
+ }
+ file.close();
+
+ if (!parse_ok)
+ {
+ LL_WARNS("RenderInit") << "Discarding feature table data from " << filename << LL_ENDL;
+ cleanupFeatureTables();
+ }
+
+ return parse_ok;
}
F32 gpu_benchmark();
@@ -382,9 +382,9 @@ F32 gpu_benchmark();
F32 logExceptionBenchmark()
{
// FIXME: gpu_benchmark uses many C++ classes on the stack to control state.
- // SEH exceptions with our current exception handling options do not call
+ // SEH exceptions with our current exception handling options do not call
// destructors for these classes, resulting in an undefined state should
- // this handler be invoked.
+ // this handler be invoked.
F32 gbps = -1;
__try
{
@@ -406,25 +406,25 @@ F32 logExceptionBenchmark()
bool LLFeatureManager::loadGPUClass()
{
- if (!gSavedSettings.getBOOL("SkipBenchmark"))
- {
- F32 class1_gbps = gSavedSettings.getF32("RenderClass1MemoryBandwidth");
- //get memory bandwidth from benchmark
- F32 gbps;
- try
- {
+ if (!gSavedSettings.getBOOL("SkipBenchmark"))
+ {
+ F32 class1_gbps = gSavedSettings.getF32("RenderClass1MemoryBandwidth");
+ //get memory bandwidth from benchmark
+ F32 gbps;
+ try
+ {
#if LL_WINDOWS
- gbps = logExceptionBenchmark();
+ gbps = logExceptionBenchmark();
#else
- gbps = gpu_benchmark();
+ gbps = gpu_benchmark();
#endif
- }
- catch (const std::exception& e)
- {
- gbps = -1.f;
- LL_WARNS("RenderInit") << "GPU benchmark failed: " << e.what() << LL_ENDL;
- }
-
+ }
+ catch (const std::exception& e)
+ {
+ gbps = -1.f;
+ LL_WARNS("RenderInit") << "GPU benchmark failed: " << e.what() << LL_ENDL;
+ }
+
mGPUMemoryBandwidth = gbps;
// bias by CPU speed
@@ -433,36 +433,36 @@ bool LLFeatureManager::loadGPUClass()
F32 cpu_bias = llclamp(cpu_mhz / cpu_basis_mhz, 0.5f, 1.f);
gbps *= cpu_bias;
- if (gbps < 0.f)
- { //couldn't bench, default to Low
- #if LL_DARWIN
- //GLVersion is misleading on OSX, just default to class 3 if we can't bench
- LL_WARNS("RenderInit") << "Unable to get an accurate benchmark; defaulting to class 3" << LL_ENDL;
- mGPUClass = GPU_CLASS_3;
- #else
- mGPUClass = GPU_CLASS_0;
- #endif
- }
- else if (gbps <= class1_gbps)
- {
- mGPUClass = GPU_CLASS_1;
- }
- else if (gbps <= class1_gbps *2.f)
- {
- mGPUClass = GPU_CLASS_2;
- }
- else if (gbps <= class1_gbps*4.f)
- {
- mGPUClass = GPU_CLASS_3;
- }
- else if (gbps <= class1_gbps*8.f)
- {
- mGPUClass = GPU_CLASS_4;
- }
- else
- {
- mGPUClass = GPU_CLASS_5;
- }
+ if (gbps < 0.f)
+ { //couldn't bench, default to Low
+ #if LL_DARWIN
+ //GLVersion is misleading on OSX, just default to class 3 if we can't bench
+ LL_WARNS("RenderInit") << "Unable to get an accurate benchmark; defaulting to class 3" << LL_ENDL;
+ mGPUClass = GPU_CLASS_3;
+ #else
+ mGPUClass = GPU_CLASS_0;
+ #endif
+ }
+ else if (gbps <= class1_gbps)
+ {
+ mGPUClass = GPU_CLASS_1;
+ }
+ else if (gbps <= class1_gbps *2.f)
+ {
+ mGPUClass = GPU_CLASS_2;
+ }
+ else if (gbps <= class1_gbps*4.f)
+ {
+ mGPUClass = GPU_CLASS_3;
+ }
+ else if (gbps <= class1_gbps*8.f)
+ {
+ mGPUClass = GPU_CLASS_4;
+ }
+ else
+ {
+ mGPUClass = GPU_CLASS_5;
+ }
#if LL_WINDOWS
const F32Gigabytes MIN_PHYSICAL_MEMORY(2);
@@ -475,118 +475,118 @@ bool LLFeatureManager::loadGPUClass()
mGPUClass = (EGPUClass)(mGPUClass - 1);
}
#endif //LL_WINDOWS
- } //end if benchmark
- else
- {
- //setting says don't benchmark MAINT-7558
+ } //end if benchmark
+ else
+ {
+ //setting says don't benchmark MAINT-7558
LL_WARNS("RenderInit") << "Setting 'SkipBenchmark' is true; defaulting to class 1 (may be required for some GPUs)" << LL_ENDL;
-
- mGPUClass = GPU_CLASS_1;
- }
- // defaults
- mGPUString = gGLManager.getRawGLString();
- mGPUSupported = TRUE;
+ mGPUClass = GPU_CLASS_1;
+ }
+
+ // defaults
+ mGPUString = gGLManager.getRawGLString();
+ mGPUSupported = TRUE;
- return true; // indicates that a gpu value was established
+ return true; // indicates that a gpu value was established
}
void LLFeatureManager::cleanupFeatureTables()
{
- std::for_each(mMaskList.begin(), mMaskList.end(), DeletePairedPointer());
- mMaskList.clear();
+ std::for_each(mMaskList.begin(), mMaskList.end(), DeletePairedPointer());
+ mMaskList.clear();
}
void LLFeatureManager::initSingleton()
{
- // load the tables
- loadFeatureTables();
+ // load the tables
+ loadFeatureTables();
- // get the gpu class
- loadGPUClass();
+ // get the gpu class
+ loadGPUClass();
- // apply the base masks, so we know if anything is disabled
- applyBaseMasks();
+ // apply the base masks, so we know if anything is disabled
+ applyBaseMasks();
}
void LLFeatureManager::applyRecommendedSettings()
{
- // apply saved settings
- // cap the level at 2 (high)
- U32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_5));
-
- LL_INFOS("RenderInit") << "Applying Recommended Features for level " << level << LL_ENDL;
-
- setGraphicsLevel(level, false);
- gSavedSettings.setU32("RenderQualityPerformance", level);
-
- // now apply the tweaks to draw distance
- // these are double negatives, because feature masks only work by
- // downgrading values, so i needed to make a true value go to false
- // for certain cards, thus the awkward name, "Disregard..."
- if(!gSavedSettings.getBOOL("Disregard96DefaultDrawDistance"))
- {
- gSavedSettings.setF32("RenderFarClip", 96.0f);
- }
- else if(!gSavedSettings.getBOOL("Disregard128DefaultDrawDistance"))
- {
- gSavedSettings.setF32("RenderFarClip", 128.0f);
- }
+ // apply saved settings
+ // cap the level at 2 (high)
+ U32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_5));
+
+ LL_INFOS("RenderInit") << "Applying Recommended Features for level " << level << LL_ENDL;
+
+ setGraphicsLevel(level, false);
+ gSavedSettings.setU32("RenderQualityPerformance", level);
+
+ // now apply the tweaks to draw distance
+ // these are double negatives, because feature masks only work by
+ // downgrading values, so i needed to make a true value go to false
+ // for certain cards, thus the awkward name, "Disregard..."
+ if(!gSavedSettings.getBOOL("Disregard96DefaultDrawDistance"))
+ {
+ gSavedSettings.setF32("RenderFarClip", 96.0f);
+ }
+ else if(!gSavedSettings.getBOOL("Disregard128DefaultDrawDistance"))
+ {
+ gSavedSettings.setF32("RenderFarClip", 128.0f);
+ }
}
void LLFeatureManager::applyFeatures(bool skipFeatures)
{
- // see featuretable.txt / featuretable_linux.txt / featuretable_mac.txt
+ // see featuretable.txt / featuretable_linux.txt / featuretable_mac.txt
#ifndef LL_RELEASE_FOR_DOWNLOAD
- dump();
+ dump();
#endif
- // scroll through all of these and set their corresponding control value
- for(feature_map_t::iterator mIt = mFeatures.begin();
- mIt != mFeatures.end();
- ++mIt)
- {
- // skip features you want to skip
- // do this for when you don't want to change certain settings
- if(skipFeatures)
- {
- if(mSkippedFeatures.find(mIt->first) != mSkippedFeatures.end())
- {
- continue;
- }
- }
-
- // get the control setting
- LLControlVariable* ctrl = gSavedSettings.getControl(mIt->first);
- if(ctrl == NULL)
- {
- LL_WARNS("RenderInit") << "AHHH! Control setting " << mIt->first << " does not exist!" << LL_ENDL;
- continue;
- }
-
- // handle all the different types
- if(ctrl->isType(TYPE_BOOLEAN))
- {
- gSavedSettings.setBOOL(mIt->first, (BOOL)getRecommendedValue(mIt->first));
- }
- else if (ctrl->isType(TYPE_S32))
- {
- gSavedSettings.setS32(mIt->first, (S32)getRecommendedValue(mIt->first));
- }
- else if (ctrl->isType(TYPE_U32))
- {
- gSavedSettings.setU32(mIt->first, (U32)getRecommendedValue(mIt->first));
- }
- else if (ctrl->isType(TYPE_F32))
- {
- gSavedSettings.setF32(mIt->first, (F32)getRecommendedValue(mIt->first));
- }
- else
- {
- LL_WARNS("RenderInit") << "AHHH! Control variable is not a numeric type!" << LL_ENDL;
- }
- }
+ // scroll through all of these and set their corresponding control value
+ for(feature_map_t::iterator mIt = mFeatures.begin();
+ mIt != mFeatures.end();
+ ++mIt)
+ {
+ // skip features you want to skip
+ // do this for when you don't want to change certain settings
+ if(skipFeatures)
+ {
+ if(mSkippedFeatures.find(mIt->first) != mSkippedFeatures.end())
+ {
+ continue;
+ }
+ }
+
+ // get the control setting
+ LLControlVariable* ctrl = gSavedSettings.getControl(mIt->first);
+ if(ctrl == NULL)
+ {
+ LL_WARNS("RenderInit") << "AHHH! Control setting " << mIt->first << " does not exist!" << LL_ENDL;
+ continue;
+ }
+
+ // handle all the different types
+ if(ctrl->isType(TYPE_BOOLEAN))
+ {
+ gSavedSettings.setBOOL(mIt->first, (BOOL)getRecommendedValue(mIt->first));
+ }
+ else if (ctrl->isType(TYPE_S32))
+ {
+ gSavedSettings.setS32(mIt->first, (S32)getRecommendedValue(mIt->first));
+ }
+ else if (ctrl->isType(TYPE_U32))
+ {
+ gSavedSettings.setU32(mIt->first, (U32)getRecommendedValue(mIt->first));
+ }
+ else if (ctrl->isType(TYPE_F32))
+ {
+ gSavedSettings.setF32(mIt->first, (F32)getRecommendedValue(mIt->first));
+ }
+ else
+ {
+ LL_WARNS("RenderInit") << "AHHH! Control variable is not a numeric type!" << LL_ENDL;
+ }
+ }
}
void LLFeatureManager::setGraphicsLevel(U32 level, bool skipFeatures)
@@ -609,65 +609,65 @@ void LLFeatureManager::setGraphicsLevel(U32 level, bool skipFeatures)
void LLFeatureManager::applyBaseMasks()
{
- // reapply masks
- mFeatures.clear();
-
- LLFeatureList* maskp = findMask("all");
- if(maskp == NULL)
- {
- LL_WARNS("RenderInit") << "AHH! No \"all\" in feature table!" << LL_ENDL;
- return;
- }
-
- mFeatures = maskp->getFeatures();
-
- // mask class
- if (mGPUClass >= 0 && mGPUClass < 6)
- {
- const char* class_table[] =
- {
- "Class0",
- "Class1",
- "Class2",
- "Class3",
- "Class4",
- "Class5",
- };
-
- LL_INFOS("RenderInit") << "Setting GPU Class to " << class_table[mGPUClass] << LL_ENDL;
- maskFeatures(class_table[mGPUClass]);
- }
- else
- {
- LL_INFOS("RenderInit") << "Setting GPU Class to Unknown" << LL_ENDL;
- maskFeatures("Unknown");
- }
-
- // now all those wacky ones
- if (gGLManager.mIsNVIDIA)
- {
- maskFeatures("NVIDIA");
- }
- if (gGLManager.mIsAMD)
- {
- maskFeatures("AMD");
- }
- if (gGLManager.mIsIntel)
- {
- maskFeatures("Intel");
- }
- if (gGLManager.mGLVersion < 3.f)
- {
- maskFeatures("OpenGLPre30");
- }
- if (gGLManager.mNumTextureImageUnits <= 8)
- {
- maskFeatures("TexUnit8orLess");
- }
- if (gGLManager.mVRAM > 512)
- {
- maskFeatures("VRAMGT512");
- }
+ // reapply masks
+ mFeatures.clear();
+
+ LLFeatureList* maskp = findMask("all");
+ if(maskp == NULL)
+ {
+ LL_WARNS("RenderInit") << "AHH! No \"all\" in feature table!" << LL_ENDL;
+ return;
+ }
+
+ mFeatures = maskp->getFeatures();
+
+ // mask class
+ if (mGPUClass >= 0 && mGPUClass < 6)
+ {
+ const char* class_table[] =
+ {
+ "Class0",
+ "Class1",
+ "Class2",
+ "Class3",
+ "Class4",
+ "Class5",
+ };
+
+ LL_INFOS("RenderInit") << "Setting GPU Class to " << class_table[mGPUClass] << LL_ENDL;
+ maskFeatures(class_table[mGPUClass]);
+ }
+ else
+ {
+ LL_INFOS("RenderInit") << "Setting GPU Class to Unknown" << LL_ENDL;
+ maskFeatures("Unknown");
+ }
+
+ // now all those wacky ones
+ if (gGLManager.mIsNVIDIA)
+ {
+ maskFeatures("NVIDIA");
+ }
+ if (gGLManager.mIsAMD)
+ {
+ maskFeatures("AMD");
+ }
+ if (gGLManager.mIsIntel)
+ {
+ maskFeatures("Intel");
+ }
+ if (gGLManager.mGLVersion < 3.f)
+ {
+ maskFeatures("OpenGLPre30");
+ }
+ if (gGLManager.mNumTextureImageUnits <= 8)
+ {
+ maskFeatures("TexUnit8orLess");
+ }
+ if (gGLManager.mVRAM > 512)
+ {
+ maskFeatures("VRAMGT512");
+ }
if (gGLManager.mVRAM < 2048)
{
maskFeatures("VRAMLT2GB");
@@ -677,79 +677,79 @@ void LLFeatureManager::applyBaseMasks()
maskFeatures("GL3");
}
- // now mask by gpu string
- // Replaces ' ' with '_' in mGPUString to deal with inability for parser to handle spaces
- std::string gpustr = mGPUString;
- for (std::string::iterator iter = gpustr.begin(); iter != gpustr.end(); ++iter)
- {
- if (*iter == ' ')
- {
- *iter = '_';
- }
- }
-
- //LL_INFOS() << "Masking features from gpu table match: " << gpustr << LL_ENDL;
- maskFeatures(gpustr);
-
- if (isSafe())
- {
- maskFeatures("safe");
- }
+ // now mask by gpu string
+ // Replaces ' ' with '_' in mGPUString to deal with inability for parser to handle spaces
+ std::string gpustr = mGPUString;
+ for (std::string::iterator iter = gpustr.begin(); iter != gpustr.end(); ++iter)
+ {
+ if (*iter == ' ')
+ {
+ *iter = '_';
+ }
+ }
+
+ //LL_INFOS() << "Masking features from gpu table match: " << gpustr << LL_ENDL;
+ maskFeatures(gpustr);
+
+ if (isSafe())
+ {
+ maskFeatures("safe");
+ }
}
LLSD LLFeatureManager::getRecommendedSettingsMap()
{
- // Create the map and fill it with the hardware recommended settings.
- // It's needed to create an initial Default graphics preset (MAINT-6435).
- // The process is similar to the one LLFeatureManager::applyRecommendedSettings() does.
-
- LLSD map(LLSD::emptyMap());
-
- U32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_5));
- LL_INFOS("RenderInit") << "Getting the map of recommended settings for level " << level << LL_ENDL;
-
- std::string features(isValidGraphicsLevel(level) ? getNameForGraphicsLevel(level) : "Low");
-
- maskFeatures(features);
-
- LLControlVariable* ctrl = gSavedSettings.getControl("RenderQualityPerformance"); // include the quality value for correct preset loading
- map["RenderQualityPerformance"]["Value"] = (LLSD::Integer)level;
- map["RenderQualityPerformance"]["Comment"] = ctrl->getComment();;
- map["RenderQualityPerformance"]["Persist"] = 1;
- map["RenderQualityPerformance"]["Type"] = LLControlGroup::typeEnumToString(ctrl->type());
-
-
-
- for (feature_map_t::iterator mIt = mFeatures.begin(); mIt != mFeatures.end(); ++mIt)
- {
- LLControlVariable* ctrl = gSavedSettings.getControl(mIt->first);
- if (ctrl == NULL)
- {
- LL_WARNS("RenderInit") << "AHHH! Control setting " << mIt->first << " does not exist!" << LL_ENDL;
- continue;
- }
-
- if (ctrl->isType(TYPE_BOOLEAN))
- {
- map[mIt->first]["Value"] = (LLSD::Boolean)getRecommendedValue(mIt->first);
- }
- else if (ctrl->isType(TYPE_S32) || ctrl->isType(TYPE_U32))
- {
- map[mIt->first]["Value"] = (LLSD::Integer)getRecommendedValue(mIt->first);
- }
- else if (ctrl->isType(TYPE_F32))
- {
- map[mIt->first]["Value"] = (LLSD::Real)getRecommendedValue(mIt->first);
- }
- else
- {
- LL_WARNS("RenderInit") << "AHHH! Control variable is not a numeric type!" << LL_ENDL;
- continue;
- }
- map[mIt->first]["Comment"] = ctrl->getComment();;
- map[mIt->first]["Persist"] = 1;
- map[mIt->first]["Type"] = LLControlGroup::typeEnumToString(ctrl->type());
- }
-
- return map;
+ // Create the map and fill it with the hardware recommended settings.
+ // It's needed to create an initial Default graphics preset (MAINT-6435).
+ // The process is similar to the one LLFeatureManager::applyRecommendedSettings() does.
+
+ LLSD map(LLSD::emptyMap());
+
+ U32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_5));
+ LL_INFOS("RenderInit") << "Getting the map of recommended settings for level " << level << LL_ENDL;
+
+ std::string features(isValidGraphicsLevel(level) ? getNameForGraphicsLevel(level) : "Low");
+
+ maskFeatures(features);
+
+ LLControlVariable* ctrl = gSavedSettings.getControl("RenderQualityPerformance"); // include the quality value for correct preset loading
+ map["RenderQualityPerformance"]["Value"] = (LLSD::Integer)level;
+ map["RenderQualityPerformance"]["Comment"] = ctrl->getComment();;
+ map["RenderQualityPerformance"]["Persist"] = 1;
+ map["RenderQualityPerformance"]["Type"] = LLControlGroup::typeEnumToString(ctrl->type());
+
+
+
+ for (feature_map_t::iterator mIt = mFeatures.begin(); mIt != mFeatures.end(); ++mIt)
+ {
+ LLControlVariable* ctrl = gSavedSettings.getControl(mIt->first);
+ if (ctrl == NULL)
+ {
+ LL_WARNS("RenderInit") << "AHHH! Control setting " << mIt->first << " does not exist!" << LL_ENDL;
+ continue;
+ }
+
+ if (ctrl->isType(TYPE_BOOLEAN))
+ {
+ map[mIt->first]["Value"] = (LLSD::Boolean)getRecommendedValue(mIt->first);
+ }
+ else if (ctrl->isType(TYPE_S32) || ctrl->isType(TYPE_U32))
+ {
+ map[mIt->first]["Value"] = (LLSD::Integer)getRecommendedValue(mIt->first);
+ }
+ else if (ctrl->isType(TYPE_F32))
+ {
+ map[mIt->first]["Value"] = (LLSD::Real)getRecommendedValue(mIt->first);
+ }
+ else
+ {
+ LL_WARNS("RenderInit") << "AHHH! Control variable is not a numeric type!" << LL_ENDL;
+ continue;
+ }
+ map[mIt->first]["Comment"] = ctrl->getComment();;
+ map[mIt->first]["Persist"] = 1;
+ map[mIt->first]["Type"] = LLControlGroup::typeEnumToString(ctrl->type());
+ }
+
+ return map;
}
diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h
index 70c6c09e0d..c333e2caeb 100644
--- a/indra/newview/llfeaturemanager.h
+++ b/indra/newview/llfeaturemanager.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfeaturemanager.h
* @brief The feature manager is responsible for determining what features are turned on/off in the app.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,151 +37,151 @@
typedef enum EGPUClass
{
- GPU_CLASS_UNKNOWN = -1,
- GPU_CLASS_0 = 0,
- GPU_CLASS_1 = 1,
- GPU_CLASS_2 = 2,
- GPU_CLASS_3 = 3,
- GPU_CLASS_4 = 4,
- GPU_CLASS_5 = 5
-} EGPUClass;
+ GPU_CLASS_UNKNOWN = -1,
+ GPU_CLASS_0 = 0,
+ GPU_CLASS_1 = 1,
+ GPU_CLASS_2 = 2,
+ GPU_CLASS_3 = 3,
+ GPU_CLASS_4 = 4,
+ GPU_CLASS_5 = 5
+} EGPUClass;
class LLFeatureInfo
{
public:
- LLFeatureInfo() : mValid(FALSE), mAvailable(FALSE), mRecommendedLevel(-1) {}
- LLFeatureInfo(const std::string& name, const BOOL available, const F32 level);
+ LLFeatureInfo() : mValid(FALSE), mAvailable(FALSE), mRecommendedLevel(-1) {}
+ LLFeatureInfo(const std::string& name, const BOOL available, const F32 level);
- BOOL isValid() const { return mValid; };
+ BOOL isValid() const { return mValid; };
public:
- BOOL mValid;
- std::string mName;
- BOOL mAvailable;
- F32 mRecommendedLevel;
+ BOOL mValid;
+ std::string mName;
+ BOOL mAvailable;
+ F32 mRecommendedLevel;
};
class LLFeatureList
{
public:
- typedef std::map<std::string, LLFeatureInfo> feature_map_t;
+ typedef std::map<std::string, LLFeatureInfo> feature_map_t;
- LLFeatureList(const std::string& name);
- virtual ~LLFeatureList();
+ LLFeatureList(const std::string& name);
+ virtual ~LLFeatureList();
- BOOL isFeatureAvailable(const std::string& name);
- F32 getRecommendedValue(const std::string& name);
+ BOOL isFeatureAvailable(const std::string& name);
+ F32 getRecommendedValue(const std::string& name);
- void setFeatureAvailable(const std::string& name, const BOOL available);
- void setRecommendedLevel(const std::string& name, const F32 level);
+ void setFeatureAvailable(const std::string& name, const BOOL available);
+ void setRecommendedLevel(const std::string& name, const F32 level);
- bool loadFeatureList(LLFILE *fp);
+ bool loadFeatureList(LLFILE *fp);
- BOOL maskList(LLFeatureList &mask);
+ BOOL maskList(LLFeatureList &mask);
- void addFeature(const std::string& name, const BOOL available, const F32 level);
+ void addFeature(const std::string& name, const BOOL available, const F32 level);
- feature_map_t& getFeatures()
- {
- return mFeatures;
- }
+ feature_map_t& getFeatures()
+ {
+ return mFeatures;
+ }
- void dump();
+ void dump();
protected:
- std::string mName;
- feature_map_t mFeatures;
+ std::string mName;
+ feature_map_t mFeatures;
};
class LLFeatureManager : public LLFeatureList, public LLSingleton<LLFeatureManager>
{
- LLSINGLETON(LLFeatureManager);
- ~LLFeatureManager() {cleanupFeatureTables();}
+ LLSINGLETON(LLFeatureManager);
+ ~LLFeatureManager() {cleanupFeatureTables();}
- // initialize this by loading feature table and gpu table
- void initSingleton() override;
+ // initialize this by loading feature table and gpu table
+ void initSingleton() override;
public:
- void maskCurrentList(const std::string& name); // Mask the current feature list with the named list
+ void maskCurrentList(const std::string& name); // Mask the current feature list with the named list
+
+ bool loadFeatureTables();
- bool loadFeatureTables();
+ EGPUClass getGPUClass() { return mGPUClass; }
+ std::string& getGPUString() { return mGPUString; }
- EGPUClass getGPUClass() { return mGPUClass; }
- std::string& getGPUString() { return mGPUString; }
-
// get the measured GPU memory bandwidth in GB/sec
// may return 0 of benchmark has not been run or failed to run
F32 getGPUMemoryBandwidth() { return mGPUMemoryBandwidth; }
- BOOL isGPUSupported() { return mGPUSupported; }
- F32 getExpectedGLVersion() { return mExpectedGLVersion; }
-
- void cleanupFeatureTables();
+ BOOL isGPUSupported() { return mGPUSupported; }
+ F32 getExpectedGLVersion() { return mExpectedGLVersion; }
+
+ void cleanupFeatureTables();
- S32 getVersion() const { return mTableVersion; }
- void setSafe(const BOOL safe) { mSafe = safe; }
- BOOL isSafe() const { return mSafe; }
+ S32 getVersion() const { return mTableVersion; }
+ void setSafe(const BOOL safe) { mSafe = safe; }
+ BOOL isSafe() const { return mSafe; }
- LLFeatureList *findMask(const std::string& name);
- BOOL maskFeatures(const std::string& name);
+ LLFeatureList *findMask(const std::string& name);
+ BOOL maskFeatures(const std::string& name);
- // set the graphics to low, medium, high, or ultra.
- // skipFeatures forces skipping of mostly hardware settings
- // that we don't want to change when we change graphics
- // settings
- void setGraphicsLevel(U32 level, bool skipFeatures);
+ // set the graphics to low, medium, high, or ultra.
+ // skipFeatures forces skipping of mostly hardware settings
+ // that we don't want to change when we change graphics
+ // settings
+ void setGraphicsLevel(U32 level, bool skipFeatures);
- // What 'level' values are valid to pass to setGraphicsLevel()?
- // 0 is the low end...
- U32 getMaxGraphicsLevel() const;
- bool isValidGraphicsLevel(U32 level) const;
+ // What 'level' values are valid to pass to setGraphicsLevel()?
+ // 0 is the low end...
+ U32 getMaxGraphicsLevel() const;
+ bool isValidGraphicsLevel(U32 level) const;
- // setGraphicsLevel() levels have names.
- std::string getNameForGraphicsLevel(U32 level) const;
- // returns -1 for unrecognized name (hence S32 rather than U32)
- S32 getGraphicsLevelForName(const std::string& name) const;
+ // setGraphicsLevel() levels have names.
+ std::string getNameForGraphicsLevel(U32 level) const;
+ // returns -1 for unrecognized name (hence S32 rather than U32)
+ S32 getGraphicsLevelForName(const std::string& name) const;
- void applyBaseMasks();
- void applyRecommendedSettings();
+ void applyBaseMasks();
+ void applyRecommendedSettings();
- // apply the basic masks. Also, skip one saved
- // in the skip list if true
- void applyFeatures(bool skipFeatures);
+ // apply the basic masks. Also, skip one saved
+ // in the skip list if true
+ void applyFeatures(bool skipFeatures);
- LLSD getRecommendedSettingsMap();
+ LLSD getRecommendedSettingsMap();
protected:
- bool loadGPUClass();
+ bool loadGPUClass();
- bool parseFeatureTable(std::string filename);
- ///< @returns TRUE is file parsed correctly, FALSE if not
+ bool parseFeatureTable(std::string filename);
+ ///< @returns TRUE is file parsed correctly, FALSE if not
- void initBaseMask();
+ void initBaseMask();
- std::map<std::string, LLFeatureList *> mMaskList;
- std::set<std::string> mSkippedFeatures;
- BOOL mInited;
- S32 mTableVersion;
- BOOL mSafe; // Reinitialize everything to the "safe" mask
- EGPUClass mGPUClass;
+ std::map<std::string, LLFeatureList *> mMaskList;
+ std::set<std::string> mSkippedFeatures;
+ BOOL mInited;
+ S32 mTableVersion;
+ BOOL mSafe; // Reinitialize everything to the "safe" mask
+ EGPUClass mGPUClass;
F32 mGPUMemoryBandwidth = 0.f; // measured memory bandwidth of GPU in GB/second
- F32 mExpectedGLVersion; //expected GL version according to gpu table
- std::string mGPUString;
- BOOL mGPUSupported;
+ F32 mExpectedGLVersion; //expected GL version according to gpu table
+ std::string mGPUString;
+ BOOL mGPUSupported;
};
inline
LLFeatureManager::LLFeatureManager()
-: LLFeatureList("default"),
-
- mInited(FALSE),
- mTableVersion(0),
- mSafe(FALSE),
- mGPUClass(GPU_CLASS_UNKNOWN),
- mExpectedGLVersion(0.f),
- mGPUSupported(FALSE)
+: LLFeatureList("default"),
+
+ mInited(FALSE),
+ mTableVersion(0),
+ mSafe(FALSE),
+ mGPUClass(GPU_CLASS_UNKNOWN),
+ mExpectedGLVersion(0.f),
+ mGPUSupported(FALSE)
{
}
diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp
index 46b9dffae9..aa89a19aed 100644
--- a/indra/newview/llfetchedgltfmaterial.cpp
+++ b/indra/newview/llfetchedgltfmaterial.cpp
@@ -45,7 +45,7 @@ LLFetchedGLTFMaterial::LLFetchedGLTFMaterial()
LLFetchedGLTFMaterial::~LLFetchedGLTFMaterial()
{
-
+
}
LLFetchedGLTFMaterial& LLFetchedGLTFMaterial::operator=(const LLFetchedGLTFMaterial& rhs)
diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h
index a9e539633d..3352438660 100644
--- a/indra/newview/llfetchedgltfmaterial.h
+++ b/indra/newview/llfetchedgltfmaterial.h
@@ -70,7 +70,7 @@ public:
protected:
// Lifetime management
-
+
void materialBegin();
void materialComplete();
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index 4ad136e13a..bfdede37bc 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfilepicker.cpp
* @brief OS-specific file picker
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,7 +34,7 @@
#include "llframetimer.h"
#include "lltrans.h"
#include "llviewercontrol.h"
-#include "llwindow.h" // beforeDialog()
+#include "llwindow.h" // beforeDialog()
#if LL_SDL
#include "llwindowsdl.h" // for some X/GTK utils to help with filepickers
@@ -75,149 +75,149 @@ LLFilePicker LLFilePicker::sInstance;
// Implementation
//
LLFilePicker::LLFilePicker()
- : mCurrentFile(0),
- mLocked(false)
+ : mCurrentFile(0),
+ mLocked(false)
{
- reset();
+ reset();
#if LL_WINDOWS
- mOFN.lStructSize = sizeof(OPENFILENAMEW);
- mOFN.hwndOwner = NULL; // Set later
- mOFN.hInstance = NULL;
- mOFN.lpstrCustomFilter = NULL;
- mOFN.nMaxCustFilter = 0;
- mOFN.lpstrFile = NULL; // set in open and close
- mOFN.nMaxFile = LL_MAX_PATH;
- mOFN.lpstrFileTitle = NULL;
- mOFN.nMaxFileTitle = 0;
- mOFN.lpstrInitialDir = NULL;
- mOFN.lpstrTitle = NULL;
- mOFN.Flags = 0; // set in open and close
- mOFN.nFileOffset = 0;
- mOFN.nFileExtension = 0;
- mOFN.lpstrDefExt = NULL;
- mOFN.lCustData = 0L;
- mOFN.lpfnHook = NULL;
- mOFN.lpTemplateName = NULL;
- mFilesW[0] = '\0';
+ mOFN.lStructSize = sizeof(OPENFILENAMEW);
+ mOFN.hwndOwner = NULL; // Set later
+ mOFN.hInstance = NULL;
+ mOFN.lpstrCustomFilter = NULL;
+ mOFN.nMaxCustFilter = 0;
+ mOFN.lpstrFile = NULL; // set in open and close
+ mOFN.nMaxFile = LL_MAX_PATH;
+ mOFN.lpstrFileTitle = NULL;
+ mOFN.nMaxFileTitle = 0;
+ mOFN.lpstrInitialDir = NULL;
+ mOFN.lpstrTitle = NULL;
+ mOFN.Flags = 0; // set in open and close
+ mOFN.nFileOffset = 0;
+ mOFN.nFileExtension = 0;
+ mOFN.lpstrDefExt = NULL;
+ mOFN.lCustData = 0L;
+ mOFN.lpfnHook = NULL;
+ mOFN.lpTemplateName = NULL;
+ mFilesW[0] = '\0';
#elif LL_DARWIN
- mPickOptions = 0;
+ mPickOptions = 0;
#endif
}
LLFilePicker::~LLFilePicker()
{
- // nothing
+ // nothing
}
-// utility function to check if access to local file system via file browser
+// utility function to check if access to local file system via file browser
// is enabled and if not, tidy up and indicate we're not allowed to do this.
bool LLFilePicker::check_local_file_access_enabled()
{
- // if local file browsing is turned off, return without opening dialog
- bool local_file_system_browsing_enabled = gSavedSettings.getBOOL("LocalFileSystemBrowsingEnabled");
- if ( ! local_file_system_browsing_enabled )
- {
- mFiles.clear();
- return false;
- }
-
- return true;
+ // if local file browsing is turned off, return without opening dialog
+ bool local_file_system_browsing_enabled = gSavedSettings.getBOOL("LocalFileSystemBrowsingEnabled");
+ if ( ! local_file_system_browsing_enabled )
+ {
+ mFiles.clear();
+ return false;
+ }
+
+ return true;
}
const std::string LLFilePicker::getFirstFile()
{
- mCurrentFile = 0;
- return getNextFile();
+ mCurrentFile = 0;
+ return getNextFile();
}
const std::string LLFilePicker::getNextFile()
{
- if (mCurrentFile >= getFileCount())
- {
- mLocked = false;
- return std::string();
- }
- else
- {
- return mFiles[mCurrentFile++];
- }
+ if (mCurrentFile >= getFileCount())
+ {
+ mLocked = false;
+ return std::string();
+ }
+ else
+ {
+ return mFiles[mCurrentFile++];
+ }
}
const std::string LLFilePicker::getCurFile()
{
- if (mCurrentFile >= getFileCount())
- {
- mLocked = false;
- return std::string();
- }
- else
- {
- return mFiles[mCurrentFile];
- }
+ if (mCurrentFile >= getFileCount())
+ {
+ mLocked = false;
+ return std::string();
+ }
+ else
+ {
+ return mFiles[mCurrentFile];
+ }
}
void LLFilePicker::reset()
{
- mLocked = false;
- mFiles.clear();
- mCurrentFile = 0;
+ mLocked = false;
+ mFiles.clear();
+ mCurrentFile = 0;
}
#if LL_WINDOWS
BOOL LLFilePicker::setupFilter(ELoadFilter filter)
{
- BOOL res = TRUE;
- switch (filter)
- {
+ BOOL res = TRUE;
+ switch (filter)
+ {
case FFLOAD_ALL:
case FFLOAD_EXE:
- mOFN.lpstrFilter = L"All Files (*.*)\0*.*\0" \
- SOUND_FILTER \
- IMAGE_FILTER \
- ANIM_FILTER \
- MATERIAL_FILTER \
- L"\0";
- break;
- case FFLOAD_WAV:
- mOFN.lpstrFilter = SOUND_FILTER \
- L"\0";
- break;
- case FFLOAD_IMAGE:
- mOFN.lpstrFilter = IMAGE_FILTER \
- L"\0";
- break;
- case FFLOAD_ANIM:
- mOFN.lpstrFilter = ANIM_FILTER \
- L"\0";
- break;
- case FFLOAD_GLTF:
- mOFN.lpstrFilter = GLTF_FILTER \
- L"\0";
- break;
- case FFLOAD_COLLADA:
- mOFN.lpstrFilter = COLLADA_FILTER \
- L"\0";
- break;
- case FFLOAD_XML:
- mOFN.lpstrFilter = XML_FILTER \
- L"\0";
- break;
- case FFLOAD_SLOBJECT:
- mOFN.lpstrFilter = SLOBJECT_FILTER \
- L"\0";
- break;
- case FFLOAD_RAW:
- mOFN.lpstrFilter = RAW_FILTER \
- L"\0";
- break;
- case FFLOAD_MODEL:
- mOFN.lpstrFilter = MODEL_FILTER \
- L"\0";
- break;
+ mOFN.lpstrFilter = L"All Files (*.*)\0*.*\0" \
+ SOUND_FILTER \
+ IMAGE_FILTER \
+ ANIM_FILTER \
+ MATERIAL_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_WAV:
+ mOFN.lpstrFilter = SOUND_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_IMAGE:
+ mOFN.lpstrFilter = IMAGE_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_ANIM:
+ mOFN.lpstrFilter = ANIM_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_GLTF:
+ mOFN.lpstrFilter = GLTF_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_COLLADA:
+ mOFN.lpstrFilter = COLLADA_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_XML:
+ mOFN.lpstrFilter = XML_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_SLOBJECT:
+ mOFN.lpstrFilter = SLOBJECT_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_RAW:
+ mOFN.lpstrFilter = RAW_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_MODEL:
+ mOFN.lpstrFilter = MODEL_FILTER \
+ L"\0";
+ break;
case FFLOAD_MATERIAL:
mOFN.lpstrFilter = MATERIAL_FILTER \
L"\0";
@@ -228,70 +228,70 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter)
IMAGE_FILTER \
L"\0";
break;
- case FFLOAD_SCRIPT:
- mOFN.lpstrFilter = SCRIPT_FILTER \
- L"\0";
- break;
- case FFLOAD_DICTIONARY:
- mOFN.lpstrFilter = DICTIONARY_FILTER \
- L"\0";
- break;
- default:
- res = FALSE;
- break;
- }
- return res;
+ case FFLOAD_SCRIPT:
+ mOFN.lpstrFilter = SCRIPT_FILTER \
+ L"\0";
+ break;
+ case FFLOAD_DICTIONARY:
+ mOFN.lpstrFilter = DICTIONARY_FILTER \
+ L"\0";
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ return res;
}
BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
{
- if( mLocked )
- {
- return FALSE;
- }
- BOOL success = FALSE;
-
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
- // don't provide default file selection
- mFilesW[0] = '\0';
-
- mOFN.hwndOwner = (HWND)gViewerWindow->getPlatformWindow();
- mOFN.lpstrFile = mFilesW;
- mOFN.nMaxFile = SINGLE_FILENAME_BUFFER_SIZE;
- mOFN.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR ;
- mOFN.nFilterIndex = 1;
-
- setupFilter(filter);
-
- if (blocking)
- {
- // Modal, so pause agent
- send_agent_pause();
- }
-
- reset();
-
- // NOTA BENE: hitting the file dialog triggers a window focus event, destroying the selection manager!!
- success = GetOpenFileName(&mOFN);
- if (success)
- {
- std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));
- mFiles.push_back(filename);
- }
-
- if (blocking)
- {
- send_agent_resume();
- // Account for the fact that the app has been stalled.
- LLFrameTimer::updateFrameTime();
- }
-
- return success;
+ if( mLocked )
+ {
+ return FALSE;
+ }
+ BOOL success = FALSE;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ // don't provide default file selection
+ mFilesW[0] = '\0';
+
+ mOFN.hwndOwner = (HWND)gViewerWindow->getPlatformWindow();
+ mOFN.lpstrFile = mFilesW;
+ mOFN.nMaxFile = SINGLE_FILENAME_BUFFER_SIZE;
+ mOFN.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR ;
+ mOFN.nFilterIndex = 1;
+
+ setupFilter(filter);
+
+ if (blocking)
+ {
+ // Modal, so pause agent
+ send_agent_pause();
+ }
+
+ reset();
+
+ // NOTA BENE: hitting the file dialog triggers a window focus event, destroying the selection manager!!
+ success = GetOpenFileName(&mOFN);
+ if (success)
+ {
+ std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));
+ mFiles.push_back(filename);
+ }
+
+ if (blocking)
+ {
+ send_agent_resume();
+ // Account for the fact that the app has been stalled.
+ LLFrameTimer::updateFrameTime();
+ }
+
+ return success;
}
BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
@@ -305,79 +305,79 @@ BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
{
- if( mLocked )
- {
- return FALSE;
- }
- BOOL success = FALSE;
-
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
- // don't provide default file selection
- mFilesW[0] = '\0';
-
- mOFN.hwndOwner = (HWND)gViewerWindow->getPlatformWindow();
- mOFN.lpstrFile = mFilesW;
- mOFN.nFilterIndex = 1;
- mOFN.nMaxFile = FILENAME_BUFFER_SIZE;
- mOFN.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR |
- OFN_EXPLORER | OFN_ALLOWMULTISELECT;
-
- setupFilter(filter);
-
- reset();
-
- if (blocking)
- {
- // Modal, so pause agent
- send_agent_pause();
- }
-
- // NOTA BENE: hitting the file dialog triggers a window focus event, destroying the selection manager!!
- success = GetOpenFileName(&mOFN); // pauses until ok or cancel.
- if( success )
- {
- // The getopenfilename api doesn't tell us if we got more than
- // one file, so we have to test manually by checking string
- // lengths.
- if( wcslen(mOFN.lpstrFile) > mOFN.nFileOffset ) /*Flawfinder: ignore*/
- {
- std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));
- mFiles.push_back(filename);
- }
- else
- {
- mLocked = true;
- WCHAR* tptrw = mFilesW;
- std::string dirname;
- while(1)
- {
- if (*tptrw == 0 && *(tptrw+1) == 0) // double '\0'
- break;
- if (*tptrw == 0)
- tptrw++; // shouldn't happen?
- std::string filename = utf16str_to_utf8str(llutf16string(tptrw));
- if (dirname.empty())
- dirname = filename + "\\";
- else
- mFiles.push_back(dirname + filename);
- tptrw += wcslen(tptrw);
- }
- }
- }
-
- if (blocking)
- {
- send_agent_resume();
- }
-
- // Account for the fact that the app has been stalled.
- LLFrameTimer::updateFrameTime();
- return success;
+ if( mLocked )
+ {
+ return FALSE;
+ }
+ BOOL success = FALSE;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ // don't provide default file selection
+ mFilesW[0] = '\0';
+
+ mOFN.hwndOwner = (HWND)gViewerWindow->getPlatformWindow();
+ mOFN.lpstrFile = mFilesW;
+ mOFN.nFilterIndex = 1;
+ mOFN.nMaxFile = FILENAME_BUFFER_SIZE;
+ mOFN.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR |
+ OFN_EXPLORER | OFN_ALLOWMULTISELECT;
+
+ setupFilter(filter);
+
+ reset();
+
+ if (blocking)
+ {
+ // Modal, so pause agent
+ send_agent_pause();
+ }
+
+ // NOTA BENE: hitting the file dialog triggers a window focus event, destroying the selection manager!!
+ success = GetOpenFileName(&mOFN); // pauses until ok or cancel.
+ if( success )
+ {
+ // The getopenfilename api doesn't tell us if we got more than
+ // one file, so we have to test manually by checking string
+ // lengths.
+ if( wcslen(mOFN.lpstrFile) > mOFN.nFileOffset ) /*Flawfinder: ignore*/
+ {
+ std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));
+ mFiles.push_back(filename);
+ }
+ else
+ {
+ mLocked = true;
+ WCHAR* tptrw = mFilesW;
+ std::string dirname;
+ while(1)
+ {
+ if (*tptrw == 0 && *(tptrw+1) == 0) // double '\0'
+ break;
+ if (*tptrw == 0)
+ tptrw++; // shouldn't happen?
+ std::string filename = utf16str_to_utf8str(llutf16string(tptrw));
+ if (dirname.empty())
+ dirname = filename + "\\";
+ else
+ mFiles.push_back(dirname + filename);
+ tptrw += wcslen(tptrw);
+ }
+ }
+ }
+
+ if (blocking)
+ {
+ send_agent_resume();
+ }
+
+ // Account for the fact that the app has been stalled.
+ LLFrameTimer::updateFrameTime();
+ return success;
}
BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
@@ -391,222 +391,222 @@ BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking)
{
- if( mLocked )
- {
- return FALSE;
- }
- BOOL success = FALSE;
-
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
- mOFN.lpstrFile = mFilesW;
- if (!filename.empty())
- {
- llutf16string tstring = utf8str_to_utf16str(filename);
- wcsncpy(mFilesW, tstring.c_str(), FILENAME_BUFFER_SIZE); } /*Flawfinder: ignore*/
- else
- {
- mFilesW[0] = '\0';
- }
- mOFN.hwndOwner = (HWND)gViewerWindow->getPlatformWindow();
-
- switch( filter )
- {
- case FFSAVE_ALL:
- mOFN.lpstrDefExt = NULL;
- mOFN.lpstrFilter =
- L"All Files (*.*)\0*.*\0" \
- L"WAV Sounds (*.wav)\0*.wav\0" \
- L"Targa, Bitmap Images (*.tga; *.bmp)\0*.tga;*.bmp\0" \
- L"\0";
- break;
- case FFSAVE_WAV:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.wav", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"wav";
- mOFN.lpstrFilter =
- L"WAV Sounds (*.wav)\0*.wav\0" \
- L"\0";
- break;
- case FFSAVE_TGA:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.tga", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"tga";
- mOFN.lpstrFilter =
- L"Targa Images (*.tga)\0*.tga\0" \
- L"\0";
- break;
- case FFSAVE_BMP:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.bmp", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"bmp";
- mOFN.lpstrFilter =
- L"Bitmap Images (*.bmp)\0*.bmp\0" \
- L"\0";
- break;
- case FFSAVE_PNG:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.png", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"png";
- mOFN.lpstrFilter =
- L"PNG Images (*.png)\0*.png\0" \
- L"\0";
- break;
- case FFSAVE_TGAPNG:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.png", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- //PNG by default
- }
- mOFN.lpstrDefExt = L"png";
- mOFN.lpstrFilter =
- L"PNG Images (*.png)\0*.png\0" \
- L"Targa Images (*.tga)\0*.tga\0" \
- L"\0";
- break;
-
- case FFSAVE_JPEG:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.jpeg", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"jpg";
- mOFN.lpstrFilter =
- L"JPEG Images (*.jpg *.jpeg)\0*.jpg;*.jpeg\0" \
- L"\0";
- break;
- case FFSAVE_AVI:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.avi", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"avi";
- mOFN.lpstrFilter =
- L"AVI Movie File (*.avi)\0*.avi\0" \
- L"\0";
- break;
- case FFSAVE_ANIM:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.xaf", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"xaf";
- mOFN.lpstrFilter =
- L"XAF Anim File (*.xaf)\0*.xaf\0" \
- L"\0";
- break;
- case FFSAVE_GLTF:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.glb", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"glb";
- mOFN.lpstrFilter =
- L"glTF Asset File (*.gltf *.glb)\0*.gltf;*.glb\0" \
- L"\0";
- break;
- case FFSAVE_XML:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.xml", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
-
- mOFN.lpstrDefExt = L"xml";
- mOFN.lpstrFilter =
- L"XML File (*.xml)\0*.xml\0" \
- L"\0";
- break;
- case FFSAVE_COLLADA:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.collada", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"collada";
- mOFN.lpstrFilter =
- L"COLLADA File (*.collada)\0*.collada\0" \
- L"\0";
- break;
- case FFSAVE_RAW:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.raw", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
- }
- mOFN.lpstrDefExt = L"raw";
- mOFN.lpstrFilter = RAW_FILTER \
- L"\0";
- break;
- case FFSAVE_J2C:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.j2c", FILENAME_BUFFER_SIZE);
- }
- mOFN.lpstrDefExt = L"j2c";
- mOFN.lpstrFilter =
- L"Compressed Images (*.j2c)\0*.j2c\0" \
- L"\0";
- break;
- case FFSAVE_SCRIPT:
- if (filename.empty())
- {
- wcsncpy( mFilesW,L"untitled.lsl", FILENAME_BUFFER_SIZE);
- }
- mOFN.lpstrDefExt = L"txt";
- mOFN.lpstrFilter = L"LSL Files (*.lsl)\0*.lsl\0" L"\0";
- break;
- default:
- return FALSE;
- }
-
-
- mOFN.nMaxFile = SINGLE_FILENAME_BUFFER_SIZE;
- mOFN.Flags = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST;
-
- reset();
-
- if (blocking)
- {
- // Modal, so pause agent
- send_agent_pause();
- }
-
- {
- // NOTA BENE: hitting the file dialog triggers a window focus event, destroying the selection manager!!
- try
- {
- success = GetSaveFileName(&mOFN);
- if (success)
- {
- std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));
- mFiles.push_back(filename);
- }
- }
- catch (...)
- {
- LOG_UNHANDLED_EXCEPTION("");
- }
- gKeyboard->resetKeys();
- }
-
- if (blocking)
- {
- send_agent_resume();
- }
-
- // Account for the fact that the app has been stalled.
- LLFrameTimer::updateFrameTime();
- return success;
+ if( mLocked )
+ {
+ return FALSE;
+ }
+ BOOL success = FALSE;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ mOFN.lpstrFile = mFilesW;
+ if (!filename.empty())
+ {
+ llutf16string tstring = utf8str_to_utf16str(filename);
+ wcsncpy(mFilesW, tstring.c_str(), FILENAME_BUFFER_SIZE); } /*Flawfinder: ignore*/
+ else
+ {
+ mFilesW[0] = '\0';
+ }
+ mOFN.hwndOwner = (HWND)gViewerWindow->getPlatformWindow();
+
+ switch( filter )
+ {
+ case FFSAVE_ALL:
+ mOFN.lpstrDefExt = NULL;
+ mOFN.lpstrFilter =
+ L"All Files (*.*)\0*.*\0" \
+ L"WAV Sounds (*.wav)\0*.wav\0" \
+ L"Targa, Bitmap Images (*.tga; *.bmp)\0*.tga;*.bmp\0" \
+ L"\0";
+ break;
+ case FFSAVE_WAV:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.wav", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"wav";
+ mOFN.lpstrFilter =
+ L"WAV Sounds (*.wav)\0*.wav\0" \
+ L"\0";
+ break;
+ case FFSAVE_TGA:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.tga", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"tga";
+ mOFN.lpstrFilter =
+ L"Targa Images (*.tga)\0*.tga\0" \
+ L"\0";
+ break;
+ case FFSAVE_BMP:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.bmp", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"bmp";
+ mOFN.lpstrFilter =
+ L"Bitmap Images (*.bmp)\0*.bmp\0" \
+ L"\0";
+ break;
+ case FFSAVE_PNG:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.png", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"png";
+ mOFN.lpstrFilter =
+ L"PNG Images (*.png)\0*.png\0" \
+ L"\0";
+ break;
+ case FFSAVE_TGAPNG:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.png", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ //PNG by default
+ }
+ mOFN.lpstrDefExt = L"png";
+ mOFN.lpstrFilter =
+ L"PNG Images (*.png)\0*.png\0" \
+ L"Targa Images (*.tga)\0*.tga\0" \
+ L"\0";
+ break;
+
+ case FFSAVE_JPEG:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.jpeg", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"jpg";
+ mOFN.lpstrFilter =
+ L"JPEG Images (*.jpg *.jpeg)\0*.jpg;*.jpeg\0" \
+ L"\0";
+ break;
+ case FFSAVE_AVI:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.avi", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"avi";
+ mOFN.lpstrFilter =
+ L"AVI Movie File (*.avi)\0*.avi\0" \
+ L"\0";
+ break;
+ case FFSAVE_ANIM:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.xaf", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"xaf";
+ mOFN.lpstrFilter =
+ L"XAF Anim File (*.xaf)\0*.xaf\0" \
+ L"\0";
+ break;
+ case FFSAVE_GLTF:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.glb", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"glb";
+ mOFN.lpstrFilter =
+ L"glTF Asset File (*.gltf *.glb)\0*.gltf;*.glb\0" \
+ L"\0";
+ break;
+ case FFSAVE_XML:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.xml", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+
+ mOFN.lpstrDefExt = L"xml";
+ mOFN.lpstrFilter =
+ L"XML File (*.xml)\0*.xml\0" \
+ L"\0";
+ break;
+ case FFSAVE_COLLADA:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.collada", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"collada";
+ mOFN.lpstrFilter =
+ L"COLLADA File (*.collada)\0*.collada\0" \
+ L"\0";
+ break;
+ case FFSAVE_RAW:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.raw", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
+ }
+ mOFN.lpstrDefExt = L"raw";
+ mOFN.lpstrFilter = RAW_FILTER \
+ L"\0";
+ break;
+ case FFSAVE_J2C:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.j2c", FILENAME_BUFFER_SIZE);
+ }
+ mOFN.lpstrDefExt = L"j2c";
+ mOFN.lpstrFilter =
+ L"Compressed Images (*.j2c)\0*.j2c\0" \
+ L"\0";
+ break;
+ case FFSAVE_SCRIPT:
+ if (filename.empty())
+ {
+ wcsncpy( mFilesW,L"untitled.lsl", FILENAME_BUFFER_SIZE);
+ }
+ mOFN.lpstrDefExt = L"txt";
+ mOFN.lpstrFilter = L"LSL Files (*.lsl)\0*.lsl\0" L"\0";
+ break;
+ default:
+ return FALSE;
+ }
+
+
+ mOFN.nMaxFile = SINGLE_FILENAME_BUFFER_SIZE;
+ mOFN.Flags = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST;
+
+ reset();
+
+ if (blocking)
+ {
+ // Modal, so pause agent
+ send_agent_pause();
+ }
+
+ {
+ // NOTA BENE: hitting the file dialog triggers a window focus event, destroying the selection manager!!
+ try
+ {
+ success = GetSaveFileName(&mOFN);
+ if (success)
+ {
+ std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));
+ mFiles.push_back(filename);
+ }
+ }
+ catch (...)
+ {
+ LOG_UNHANDLED_EXCEPTION("");
+ }
+ gKeyboard->resetKeys();
+ }
+
+ if (blocking)
+ {
+ send_agent_resume();
+ }
+
+ // Account for the fact that the app has been stalled.
+ LLFrameTimer::updateFrameTime();
+ return success;
}
BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
@@ -685,25 +685,25 @@ std::unique_ptr<std::vector<std::string>> LLFilePicker::navOpenFilterProc(ELoadF
LL_WARNS() << "Unsupported format." << LL_ENDL;
}
- return allowedv;
+ return allowedv;
}
-bool LLFilePicker::doNavChooseDialog(ELoadFilter filter)
+bool LLFilePicker::doNavChooseDialog(ELoadFilter filter)
{
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return false;
- }
-
- gViewerWindow->getWindow()->beforeDialog();
-
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return false;
+ }
+
+ gViewerWindow->getWindow()->beforeDialog();
+
std::unique_ptr<std::vector<std::string>> allowed_types = navOpenFilterProc(filter);
-
+
std::unique_ptr<std::vector<std::string>> filev = doLoadDialog(allowed_types.get(),
mPickOptions);
- gViewerWindow->getWindow()->afterDialog();
+ gViewerWindow->getWindow()->afterDialog();
if (filev && filev->size() > 0)
@@ -711,8 +711,8 @@ bool LLFilePicker::doNavChooseDialog(ELoadFilter filter)
mFiles.insert(mFiles.end(), filev->begin(), filev->end());
return true;
}
-
- return false;
+
+ return false;
}
bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter,
@@ -724,14 +724,14 @@ bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter,
{
return false;
}
-
+
std::unique_ptr<std::vector<std::string>> allowed_types=navOpenFilterProc(filter);
-
+
doLoadDialogModeless(allowed_types.get(),
mPickOptions,
callback,
userdata);
-
+
return true;
}
@@ -785,13 +785,13 @@ void set_nav_save_data(LLFilePicker::ESaveFilter filter, std::string &extension,
creator = "\?\?\?\?";
extension = "glb";
break;
-
+
case LLFilePicker::FFSAVE_XML:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "xml";
break;
-
+
case LLFilePicker::FFSAVE_RAW:
type = "\?\?\?\?";
creator = "\?\?\?\?";
@@ -803,13 +803,13 @@ void set_nav_save_data(LLFilePicker::ESaveFilter filter, std::string &extension,
creator = "prvw";
extension = "j2c";
break;
-
+
case LLFilePicker::FFSAVE_SCRIPT:
type = "LSL ";
creator = "\?\?\?\?";
extension = "lsl";
break;
-
+
case LLFilePicker::FFSAVE_ALL:
default:
type = "\?\?\?\?";
@@ -819,34 +819,34 @@ void set_nav_save_data(LLFilePicker::ESaveFilter filter, std::string &extension,
}
}
-bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename)
+bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename)
{
- // Setup the type, creator, and extension
- std::string extension, type, creator;
-
+ // Setup the type, creator, and extension
+ std::string extension, type, creator;
+
set_nav_save_data(filter, extension, type, creator);
-
+
std::string namestring = filename;
if (namestring.empty()) namestring="Untitled";
-
- gViewerWindow->getWindow()->beforeDialog();
- // Run the dialog
- std::unique_ptr<std::string> filev = doSaveDialog(&namestring,
+ gViewerWindow->getWindow()->beforeDialog();
+
+ // Run the dialog
+ std::unique_ptr<std::string> filev = doSaveDialog(&namestring,
&type,
&creator,
&extension,
mPickOptions);
- gViewerWindow->getWindow()->afterDialog();
+ gViewerWindow->getWindow()->afterDialog();
- if ( filev && !filev->empty() )
- {
+ if ( filev && !filev->empty() )
+ {
mFiles.push_back(*filev);
- return true;
+ return true;
}
-
- return false;
+
+ return false;
}
bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter,
@@ -856,9 +856,9 @@ bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter,
{
// Setup the type, creator, and extension
std::string extension, type, creator;
-
+
set_nav_save_data(filter, extension, type, creator);
-
+
std::string namestring = filename;
if (namestring.empty()) namestring="Untitled";
@@ -875,57 +875,57 @@ bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter,
BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
{
- if( mLocked )
- return FALSE;
+ if( mLocked )
+ return FALSE;
- BOOL success = FALSE;
+ BOOL success = FALSE;
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ reset();
- reset();
-
mPickOptions &= ~F_MULTIPLE;
mPickOptions |= F_FILE;
-
- if (filter == FFLOAD_DIRECTORY) //This should only be called from lldirpicker.
+
+ if (filter == FFLOAD_DIRECTORY) //This should only be called from lldirpicker.
{
mPickOptions |= ( F_NAV_SUPPORT | F_DIRECTORY );
mPickOptions &= ~F_FILE;
}
- if (filter == FFLOAD_ALL) // allow application bundles etc. to be traversed; important for DEV-16869, but generally useful
- {
+ if (filter == FFLOAD_ALL) // allow application bundles etc. to be traversed; important for DEV-16869, but generally useful
+ {
mPickOptions |= F_NAV_SUPPORT;
- }
-
- if (blocking) // always true for linux/mac
- {
- // Modal, so pause agent
- send_agent_pause();
- }
-
-
- success = doNavChooseDialog(filter);
-
- if (success)
- {
- if (!getFileCount())
- success = false;
- }
-
- if (blocking)
- {
- send_agent_resume();
- // Account for the fact that the app has been stalled.
- LLFrameTimer::updateFrameTime();
- }
-
- return success;
+ }
+
+ if (blocking) // always true for linux/mac
+ {
+ // Modal, so pause agent
+ send_agent_pause();
+ }
+
+
+ success = doNavChooseDialog(filter);
+
+ if (success)
+ {
+ if (!getFileCount())
+ success = false;
+ }
+
+ if (blocking)
+ {
+ send_agent_resume();
+ // Account for the fact that the app has been stalled.
+ LLFrameTimer::updateFrameTime();
+ }
+
+ return success;
}
@@ -943,10 +943,10 @@ BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
}
reset();
-
+
mPickOptions &= ~F_MULTIPLE;
mPickOptions |= F_FILE;
-
+
if (filter == FFLOAD_DIRECTORY) //This should only be called from lldirpicker.
{
@@ -964,47 +964,47 @@ BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
{
- if( mLocked )
- return FALSE;
-
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
+ if( mLocked )
+ return FALSE;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
BOOL success = FALSE;
- reset();
-
+ reset();
+
mPickOptions |= F_FILE;
mPickOptions |= F_MULTIPLE;
- if (blocking) // always true for linux/mac
- {
- // Modal, so pause agent
- send_agent_pause();
- }
-
- success = doNavChooseDialog(filter);
-
- if (blocking)
- {
- send_agent_resume();
- }
-
- if (success)
- {
- if (!getFileCount())
- success = false;
- if (getFileCount() > 1)
- mLocked = true;
- }
-
- // Account for the fact that the app has been stalled.
- LLFrameTimer::updateFrameTime();
- return success;
+ if (blocking) // always true for linux/mac
+ {
+ // Modal, so pause agent
+ send_agent_pause();
+ }
+
+ success = doNavChooseDialog(filter);
+
+ if (blocking)
+ {
+ send_agent_resume();
+ }
+
+ if (success)
+ {
+ if (!getFileCount())
+ success = false;
+ if (getFileCount() > 1)
+ mLocked = true;
+ }
+
+ // Account for the fact that the app has been stalled.
+ LLFrameTimer::updateFrameTime();
+ return success;
}
@@ -1022,7 +1022,7 @@ BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
}
reset();
-
+
mPickOptions |= F_FILE;
mPickOptions |= F_MULTIPLE;
@@ -1033,42 +1033,42 @@ BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking)
{
- if( mLocked )
- return false;
- BOOL success = false;
+ if( mLocked )
+ return false;
+ BOOL success = false;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return false;
+ }
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return false;
- }
+ reset();
- reset();
-
mPickOptions &= ~F_MULTIPLE;
- if (blocking)
- {
- // Modal, so pause agent
- send_agent_pause();
- }
+ if (blocking)
+ {
+ // Modal, so pause agent
+ send_agent_pause();
+ }
success = doNavSaveDialog(filter, filename);
if (success)
- {
- if (!getFileCount())
- success = false;
- }
-
- if (blocking)
- {
- send_agent_resume();
- }
-
- // Account for the fact that the app has been stalled.
- LLFrameTimer::updateFrameTime();
- return success;
+ {
+ if (!getFileCount())
+ success = false;
+ }
+
+ if (blocking)
+ {
+ send_agent_resume();
+ }
+
+ // Account for the fact that the app has been stalled.
+ LLFrameTimer::updateFrameTime();
+ return success;
}
BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
@@ -1078,7 +1078,7 @@ BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
{
if( mLocked )
return false;
-
+
// if local file browsing is turned off, return without opening dialog
if ( check_local_file_access_enabled() == false )
{
@@ -1086,7 +1086,7 @@ BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
}
reset();
-
+
mPickOptions &= ~F_MULTIPLE;
return doNavSaveDialogModeless(filter, filename, callback, userdata);
@@ -1100,414 +1100,414 @@ BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
// static
void LLFilePicker::add_to_selectedfiles(gpointer data, gpointer user_data)
{
- // We need to run g_filename_to_utf8 in the user's locale
- std::string saved_locale(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, "");
-
- LLFilePicker* picker = (LLFilePicker*) user_data;
- GError *error = NULL;
- gchar* filename_utf8 = g_filename_to_utf8((gchar*)data,
- -1, NULL, NULL, &error);
- if (error)
- {
- // *FIXME.
- // This condition should really be notified to the user, e.g.
- // through a message box. Just logging it is inappropriate.
-
- // g_filename_display_name is ideal, but >= glib 2.6, so:
- // a hand-rolled hacky makeASCII which disallows control chars
- std::string display_name;
- for (const gchar *str = (const gchar *)data; *str; str++)
- {
- display_name += (char)((*str >= 0x20 && *str <= 0x7E) ? *str : '?');
- }
- LL_WARNS() << "g_filename_to_utf8 failed on \"" << display_name << "\": " << error->message << LL_ENDL;
- }
-
- if (filename_utf8)
- {
- picker->mFiles.push_back(std::string(filename_utf8));
- LL_DEBUGS() << "ADDED FILE " << filename_utf8 << LL_ENDL;
- g_free(filename_utf8);
- }
-
- setlocale(LC_ALL, saved_locale.c_str());
+ // We need to run g_filename_to_utf8 in the user's locale
+ std::string saved_locale(setlocale(LC_ALL, NULL));
+ setlocale(LC_ALL, "");
+
+ LLFilePicker* picker = (LLFilePicker*) user_data;
+ GError *error = NULL;
+ gchar* filename_utf8 = g_filename_to_utf8((gchar*)data,
+ -1, NULL, NULL, &error);
+ if (error)
+ {
+ // *FIXME.
+ // This condition should really be notified to the user, e.g.
+ // through a message box. Just logging it is inappropriate.
+
+ // g_filename_display_name is ideal, but >= glib 2.6, so:
+ // a hand-rolled hacky makeASCII which disallows control chars
+ std::string display_name;
+ for (const gchar *str = (const gchar *)data; *str; str++)
+ {
+ display_name += (char)((*str >= 0x20 && *str <= 0x7E) ? *str : '?');
+ }
+ LL_WARNS() << "g_filename_to_utf8 failed on \"" << display_name << "\": " << error->message << LL_ENDL;
+ }
+
+ if (filename_utf8)
+ {
+ picker->mFiles.push_back(std::string(filename_utf8));
+ LL_DEBUGS() << "ADDED FILE " << filename_utf8 << LL_ENDL;
+ g_free(filename_utf8);
+ }
+
+ setlocale(LC_ALL, saved_locale.c_str());
}
// static
void LLFilePicker::chooser_responder(GtkWidget *widget, gint response, gpointer user_data)
{
- LLFilePicker* picker = (LLFilePicker*)user_data;
-
- LL_DEBUGS() << "GTK DIALOG RESPONSE " << response << LL_ENDL;
-
- if (response == GTK_RESPONSE_ACCEPT)
- {
- GSList *file_list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(widget));
- g_slist_foreach(file_list, (GFunc)add_to_selectedfiles, user_data);
- g_slist_foreach(file_list, (GFunc)g_free, NULL);
- g_slist_free (file_list);
- }
-
- // let's save the extension of the last added file(considering current filter)
- GtkFileFilter *gfilter = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(widget));
- if(gfilter)
- {
- std::string filter = gtk_file_filter_get_name(gfilter);
-
- if(filter == LLTrans::getString("png_image_files"))
- {
- picker->mCurrentExtension = ".png";
- }
- else if(filter == LLTrans::getString("targa_image_files"))
- {
- picker->mCurrentExtension = ".tga";
- }
- }
-
- // set the default path for this usage context.
- const char* cur_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget));
- if (cur_folder != NULL)
- {
- picker->mContextToPathMap[picker->mCurContextName] = cur_folder;
- }
-
- gtk_widget_destroy(widget);
- gtk_main_quit();
+ LLFilePicker* picker = (LLFilePicker*)user_data;
+
+ LL_DEBUGS() << "GTK DIALOG RESPONSE " << response << LL_ENDL;
+
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
+ GSList *file_list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(widget));
+ g_slist_foreach(file_list, (GFunc)add_to_selectedfiles, user_data);
+ g_slist_foreach(file_list, (GFunc)g_free, NULL);
+ g_slist_free (file_list);
+ }
+
+ // let's save the extension of the last added file(considering current filter)
+ GtkFileFilter *gfilter = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(widget));
+ if(gfilter)
+ {
+ std::string filter = gtk_file_filter_get_name(gfilter);
+
+ if(filter == LLTrans::getString("png_image_files"))
+ {
+ picker->mCurrentExtension = ".png";
+ }
+ else if(filter == LLTrans::getString("targa_image_files"))
+ {
+ picker->mCurrentExtension = ".tga";
+ }
+ }
+
+ // set the default path for this usage context.
+ const char* cur_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget));
+ if (cur_folder != NULL)
+ {
+ picker->mContextToPathMap[picker->mCurContextName] = cur_folder;
+ }
+
+ gtk_widget_destroy(widget);
+ gtk_main_quit();
}
GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::string context)
{
#ifndef LL_MESA_HEADLESS
- if (LLWindowSDL::ll_try_gtk_init())
- {
- GtkWidget *win = NULL;
- GtkFileChooserAction pickertype =
- is_save?
- (is_folder?
- GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER :
- GTK_FILE_CHOOSER_ACTION_SAVE) :
- (is_folder?
- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER :
- GTK_FILE_CHOOSER_ACTION_OPEN);
-
- win = gtk_file_chooser_dialog_new(NULL, NULL,
- pickertype,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- is_folder ?
- GTK_STOCK_APPLY :
- (is_save ?
- GTK_STOCK_SAVE :
- GTK_STOCK_OPEN),
- GTK_RESPONSE_ACCEPT,
- (gchar *)NULL);
- mCurContextName = context;
-
- // get the default path for this usage context if it's been
- // seen before.
- std::map<std::string,std::string>::iterator
- this_path = mContextToPathMap.find(context);
- if (this_path != mContextToPathMap.end())
- {
- gtk_file_chooser_set_current_folder
- (GTK_FILE_CHOOSER(win),
- this_path->second.c_str());
- }
+ if (LLWindowSDL::ll_try_gtk_init())
+ {
+ GtkWidget *win = NULL;
+ GtkFileChooserAction pickertype =
+ is_save?
+ (is_folder?
+ GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER :
+ GTK_FILE_CHOOSER_ACTION_SAVE) :
+ (is_folder?
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER :
+ GTK_FILE_CHOOSER_ACTION_OPEN);
+
+ win = gtk_file_chooser_dialog_new(NULL, NULL,
+ pickertype,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ is_folder ?
+ GTK_STOCK_APPLY :
+ (is_save ?
+ GTK_STOCK_SAVE :
+ GTK_STOCK_OPEN),
+ GTK_RESPONSE_ACCEPT,
+ (gchar *)NULL);
+ mCurContextName = context;
+
+ // get the default path for this usage context if it's been
+ // seen before.
+ std::map<std::string,std::string>::iterator
+ this_path = mContextToPathMap.find(context);
+ if (this_path != mContextToPathMap.end())
+ {
+ gtk_file_chooser_set_current_folder
+ (GTK_FILE_CHOOSER(win),
+ this_path->second.c_str());
+ }
# if LL_X11
- // Make GTK tell the window manager to associate this
- // dialog with our non-GTK raw X11 window, which should try
- // to keep it on top etc.
- Window XWindowID = LLWindowSDL::get_SDL_XWindowID();
- if (None != XWindowID)
- {
- gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin
- GdkWindow *gdkwin = gdk_window_foreign_new(XWindowID);
- gdk_window_set_transient_for(GTK_WIDGET(win)->window,
- gdkwin);
- }
- else
- {
- LL_WARNS() << "Hmm, couldn't get xwid to use for transient." << LL_ENDL;
- }
+ // Make GTK tell the window manager to associate this
+ // dialog with our non-GTK raw X11 window, which should try
+ // to keep it on top etc.
+ Window XWindowID = LLWindowSDL::get_SDL_XWindowID();
+ if (None != XWindowID)
+ {
+ gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin
+ GdkWindow *gdkwin = gdk_window_foreign_new(XWindowID);
+ gdk_window_set_transient_for(GTK_WIDGET(win)->window,
+ gdkwin);
+ }
+ else
+ {
+ LL_WARNS() << "Hmm, couldn't get xwid to use for transient." << LL_ENDL;
+ }
# endif //LL_X11
- g_signal_connect (GTK_FILE_CHOOSER(win),
- "response",
- G_CALLBACK(LLFilePicker::chooser_responder),
- this);
+ g_signal_connect (GTK_FILE_CHOOSER(win),
+ "response",
+ G_CALLBACK(LLFilePicker::chooser_responder),
+ this);
- gtk_window_set_modal(GTK_WINDOW(win), TRUE);
+ gtk_window_set_modal(GTK_WINDOW(win), TRUE);
- /* GTK 2.6: if (is_folder)
- gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(win),
- TRUE); */
+ /* GTK 2.6: if (is_folder)
+ gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(win),
+ TRUE); */
- return GTK_WINDOW(win);
- }
- else
- {
- return NULL;
- }
+ return GTK_WINDOW(win);
+ }
+ else
+ {
+ return NULL;
+ }
#else
- return NULL;
+ return NULL;
#endif //LL_MESA_HEADLESS
}
static void add_common_filters_to_gtkchooser(GtkFileFilter *gfilter,
- GtkWindow *picker,
- std::string filtername)
-{
- gtk_file_filter_set_name(gfilter, filtername.c_str());
- gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(picker),
- gfilter);
- GtkFileFilter *allfilter = gtk_file_filter_new();
- gtk_file_filter_add_pattern(allfilter, "*");
- gtk_file_filter_set_name(allfilter, LLTrans::getString("all_files").c_str());
- gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(picker), allfilter);
- gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(picker), gfilter);
+ GtkWindow *picker,
+ std::string filtername)
+{
+ gtk_file_filter_set_name(gfilter, filtername.c_str());
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(picker),
+ gfilter);
+ GtkFileFilter *allfilter = gtk_file_filter_new();
+ gtk_file_filter_add_pattern(allfilter, "*");
+ gtk_file_filter_set_name(allfilter, LLTrans::getString("all_files").c_str());
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(picker), allfilter);
+ gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(picker), gfilter);
}
static std::string add_simple_pattern_filter_to_gtkchooser(GtkWindow *picker,
- std::string pattern,
- std::string filtername)
+ std::string pattern,
+ std::string filtername)
{
- GtkFileFilter *gfilter = gtk_file_filter_new();
- gtk_file_filter_add_pattern(gfilter, pattern.c_str());
- add_common_filters_to_gtkchooser(gfilter, picker, filtername);
- return filtername;
+ GtkFileFilter *gfilter = gtk_file_filter_new();
+ gtk_file_filter_add_pattern(gfilter, pattern.c_str());
+ add_common_filters_to_gtkchooser(gfilter, picker, filtername);
+ return filtername;
}
static std::string add_simple_mime_filter_to_gtkchooser(GtkWindow *picker,
- std::string mime,
- std::string filtername)
+ std::string mime,
+ std::string filtername)
{
- GtkFileFilter *gfilter = gtk_file_filter_new();
- gtk_file_filter_add_mime_type(gfilter, mime.c_str());
- add_common_filters_to_gtkchooser(gfilter, picker, filtername);
- return filtername;
+ GtkFileFilter *gfilter = gtk_file_filter_new();
+ gtk_file_filter_add_mime_type(gfilter, mime.c_str());
+ add_common_filters_to_gtkchooser(gfilter, picker, filtername);
+ return filtername;
}
static std::string add_wav_filter_to_gtkchooser(GtkWindow *picker)
{
- return add_simple_mime_filter_to_gtkchooser(picker, "audio/x-wav",
- LLTrans::getString("sound_files") + " (*.wav)");
+ return add_simple_mime_filter_to_gtkchooser(picker, "audio/x-wav",
+ LLTrans::getString("sound_files") + " (*.wav)");
}
static std::string add_anim_filter_to_gtkchooser(GtkWindow *picker)
{
- GtkFileFilter *gfilter = gtk_file_filter_new();
- gtk_file_filter_add_pattern(gfilter, "*.bvh");
- gtk_file_filter_add_pattern(gfilter, "*.anim");
- std::string filtername = LLTrans::getString("animation_files") + " (*.bvh; *.anim)";
- add_common_filters_to_gtkchooser(gfilter, picker, filtername);
- return filtername;
+ GtkFileFilter *gfilter = gtk_file_filter_new();
+ gtk_file_filter_add_pattern(gfilter, "*.bvh");
+ gtk_file_filter_add_pattern(gfilter, "*.anim");
+ std::string filtername = LLTrans::getString("animation_files") + " (*.bvh; *.anim)";
+ add_common_filters_to_gtkchooser(gfilter, picker, filtername);
+ return filtername;
}
static std::string add_xml_filter_to_gtkchooser(GtkWindow *picker)
{
- return add_simple_pattern_filter_to_gtkchooser(picker, "*.xml",
- LLTrans::getString("xml_files") + " (*.xml)");
+ return add_simple_pattern_filter_to_gtkchooser(picker, "*.xml",
+ LLTrans::getString("xml_files") + " (*.xml)");
}
static std::string add_collada_filter_to_gtkchooser(GtkWindow *picker)
{
- return add_simple_pattern_filter_to_gtkchooser(picker, "*.dae",
- LLTrans::getString("scene_files") + " (*.dae)");
+ return add_simple_pattern_filter_to_gtkchooser(picker, "*.dae",
+ LLTrans::getString("scene_files") + " (*.dae)");
}
static std::string add_imageload_filter_to_gtkchooser(GtkWindow *picker)
{
- GtkFileFilter *gfilter = gtk_file_filter_new();
- gtk_file_filter_add_pattern(gfilter, "*.tga");
- gtk_file_filter_add_mime_type(gfilter, HTTP_CONTENT_IMAGE_JPEG.c_str());
- gtk_file_filter_add_mime_type(gfilter, HTTP_CONTENT_IMAGE_PNG.c_str());
- gtk_file_filter_add_mime_type(gfilter, HTTP_CONTENT_IMAGE_BMP.c_str());
- std::string filtername = LLTrans::getString("image_files") + " (*.tga; *.bmp; *.jpg; *.png)";
- add_common_filters_to_gtkchooser(gfilter, picker, filtername);
- return filtername;
+ GtkFileFilter *gfilter = gtk_file_filter_new();
+ gtk_file_filter_add_pattern(gfilter, "*.tga");
+ gtk_file_filter_add_mime_type(gfilter, HTTP_CONTENT_IMAGE_JPEG.c_str());
+ gtk_file_filter_add_mime_type(gfilter, HTTP_CONTENT_IMAGE_PNG.c_str());
+ gtk_file_filter_add_mime_type(gfilter, HTTP_CONTENT_IMAGE_BMP.c_str());
+ std::string filtername = LLTrans::getString("image_files") + " (*.tga; *.bmp; *.jpg; *.png)";
+ add_common_filters_to_gtkchooser(gfilter, picker, filtername);
+ return filtername;
}
-
+
static std::string add_script_filter_to_gtkchooser(GtkWindow *picker)
{
- return add_simple_mime_filter_to_gtkchooser(picker, HTTP_CONTENT_TEXT_PLAIN,
- LLTrans::getString("script_files") + " (*.lsl)");
+ return add_simple_mime_filter_to_gtkchooser(picker, HTTP_CONTENT_TEXT_PLAIN,
+ LLTrans::getString("script_files") + " (*.lsl)");
}
static std::string add_dictionary_filter_to_gtkchooser(GtkWindow *picker)
{
- return add_simple_mime_filter_to_gtkchooser(picker, HTTP_CONTENT_TEXT_PLAIN,
- LLTrans::getString("dictionary_files") + " (*.dic; *.xcu)");
+ return add_simple_mime_filter_to_gtkchooser(picker, HTTP_CONTENT_TEXT_PLAIN,
+ LLTrans::getString("dictionary_files") + " (*.dic; *.xcu)");
}
static std::string add_save_texture_filter_to_gtkchooser(GtkWindow *picker)
{
- GtkFileFilter *gfilter_tga = gtk_file_filter_new();
- GtkFileFilter *gfilter_png = gtk_file_filter_new();
-
- gtk_file_filter_add_pattern(gfilter_tga, "*.tga");
- gtk_file_filter_add_mime_type(gfilter_png, "image/png");
- std::string caption = LLTrans::getString("save_texture_image_files") + " (*.tga; *.png)";
- gtk_file_filter_set_name(gfilter_tga, LLTrans::getString("targa_image_files").c_str());
- gtk_file_filter_set_name(gfilter_png, LLTrans::getString("png_image_files").c_str());
-
- gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(picker),
- gfilter_png);
- gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(picker),
- gfilter_tga);
- return caption;
+ GtkFileFilter *gfilter_tga = gtk_file_filter_new();
+ GtkFileFilter *gfilter_png = gtk_file_filter_new();
+
+ gtk_file_filter_add_pattern(gfilter_tga, "*.tga");
+ gtk_file_filter_add_mime_type(gfilter_png, "image/png");
+ std::string caption = LLTrans::getString("save_texture_image_files") + " (*.tga; *.png)";
+ gtk_file_filter_set_name(gfilter_tga, LLTrans::getString("targa_image_files").c_str());
+ gtk_file_filter_set_name(gfilter_png, LLTrans::getString("png_image_files").c_str());
+
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(picker),
+ gfilter_png);
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(picker),
+ gfilter_tga);
+ return caption;
}
BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking )
{
- BOOL rtn = FALSE;
-
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
- gViewerWindow->getWindow()->beforeDialog();
-
- reset();
-
- GtkWindow* picker = buildFilePicker(true, false, "savefile");
-
- if (picker)
- {
- std::string suggest_name = "untitled";
- std::string suggest_ext = "";
- std::string caption = LLTrans::getString("save_file_verb") + " ";
- switch (filter)
- {
- case FFSAVE_WAV:
- caption += add_wav_filter_to_gtkchooser(picker);
- suggest_ext = ".wav";
- break;
- case FFSAVE_TGA:
- caption += add_simple_pattern_filter_to_gtkchooser
- (picker, "*.tga", LLTrans::getString("targa_image_files") + " (*.tga)");
- suggest_ext = ".tga";
- break;
- case FFSAVE_BMP:
- caption += add_simple_mime_filter_to_gtkchooser
- (picker, HTTP_CONTENT_IMAGE_BMP, LLTrans::getString("bitmap_image_files") + " (*.bmp)");
- suggest_ext = ".bmp";
- break;
- case FFSAVE_PNG:
- caption += add_simple_mime_filter_to_gtkchooser
- (picker, "image/png", LLTrans::getString("png_image_files") + " (*.png)");
- suggest_ext = ".png";
- break;
- case FFSAVE_TGAPNG:
- caption += add_save_texture_filter_to_gtkchooser(picker);
- suggest_ext = ".png";
- break;
- case FFSAVE_AVI:
- caption += add_simple_mime_filter_to_gtkchooser
- (picker, "video/x-msvideo",
- LLTrans::getString("avi_movie_file") + " (*.avi)");
- suggest_ext = ".avi";
- break;
- case FFSAVE_ANIM:
- caption += add_simple_pattern_filter_to_gtkchooser
- (picker, "*.xaf", LLTrans::getString("xaf_animation_file") + " (*.xaf)");
- suggest_ext = ".xaf";
- break;
- case FFSAVE_XML:
- caption += add_simple_pattern_filter_to_gtkchooser
- (picker, "*.xml", LLTrans::getString("xml_file") + " (*.xml)");
- suggest_ext = ".xml";
- break;
- case FFSAVE_RAW:
- caption += add_simple_pattern_filter_to_gtkchooser
- (picker, "*.raw", LLTrans::getString("raw_file") + " (*.raw)");
- suggest_ext = ".raw";
- break;
- case FFSAVE_J2C:
- // *TODO: Should this be 'image/j2c' ?
- caption += add_simple_mime_filter_to_gtkchooser
- (picker, "images/jp2",
- LLTrans::getString("compressed_image_files") + " (*.j2c)");
- suggest_ext = ".j2c";
- break;
- case FFSAVE_SCRIPT:
- caption += add_script_filter_to_gtkchooser(picker);
- suggest_ext = ".lsl";
- break;
- default:;
- break;
- }
-
- gtk_window_set_title(GTK_WINDOW(picker), caption.c_str());
-
- if (filename.empty())
- {
- suggest_name += suggest_ext;
-
- gtk_file_chooser_set_current_name
- (GTK_FILE_CHOOSER(picker),
- suggest_name.c_str());
- }
- else
- {
- gtk_file_chooser_set_current_name
- (GTK_FILE_CHOOSER(picker), filename.c_str());
- }
-
- gtk_widget_show_all(GTK_WIDGET(picker));
-
- gtk_main();
-
- rtn = (getFileCount() == 1);
-
- if(rtn && filter == FFSAVE_TGAPNG)
- {
- std::string selected_file = mFiles.back();
- mFiles.pop_back();
- mFiles.push_back(selected_file + mCurrentExtension);
- }
- }
-
- gViewerWindow->getWindow()->afterDialog();
-
- return rtn;
+ BOOL rtn = FALSE;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ gViewerWindow->getWindow()->beforeDialog();
+
+ reset();
+
+ GtkWindow* picker = buildFilePicker(true, false, "savefile");
+
+ if (picker)
+ {
+ std::string suggest_name = "untitled";
+ std::string suggest_ext = "";
+ std::string caption = LLTrans::getString("save_file_verb") + " ";
+ switch (filter)
+ {
+ case FFSAVE_WAV:
+ caption += add_wav_filter_to_gtkchooser(picker);
+ suggest_ext = ".wav";
+ break;
+ case FFSAVE_TGA:
+ caption += add_simple_pattern_filter_to_gtkchooser
+ (picker, "*.tga", LLTrans::getString("targa_image_files") + " (*.tga)");
+ suggest_ext = ".tga";
+ break;
+ case FFSAVE_BMP:
+ caption += add_simple_mime_filter_to_gtkchooser
+ (picker, HTTP_CONTENT_IMAGE_BMP, LLTrans::getString("bitmap_image_files") + " (*.bmp)");
+ suggest_ext = ".bmp";
+ break;
+ case FFSAVE_PNG:
+ caption += add_simple_mime_filter_to_gtkchooser
+ (picker, "image/png", LLTrans::getString("png_image_files") + " (*.png)");
+ suggest_ext = ".png";
+ break;
+ case FFSAVE_TGAPNG:
+ caption += add_save_texture_filter_to_gtkchooser(picker);
+ suggest_ext = ".png";
+ break;
+ case FFSAVE_AVI:
+ caption += add_simple_mime_filter_to_gtkchooser
+ (picker, "video/x-msvideo",
+ LLTrans::getString("avi_movie_file") + " (*.avi)");
+ suggest_ext = ".avi";
+ break;
+ case FFSAVE_ANIM:
+ caption += add_simple_pattern_filter_to_gtkchooser
+ (picker, "*.xaf", LLTrans::getString("xaf_animation_file") + " (*.xaf)");
+ suggest_ext = ".xaf";
+ break;
+ case FFSAVE_XML:
+ caption += add_simple_pattern_filter_to_gtkchooser
+ (picker, "*.xml", LLTrans::getString("xml_file") + " (*.xml)");
+ suggest_ext = ".xml";
+ break;
+ case FFSAVE_RAW:
+ caption += add_simple_pattern_filter_to_gtkchooser
+ (picker, "*.raw", LLTrans::getString("raw_file") + " (*.raw)");
+ suggest_ext = ".raw";
+ break;
+ case FFSAVE_J2C:
+ // *TODO: Should this be 'image/j2c' ?
+ caption += add_simple_mime_filter_to_gtkchooser
+ (picker, "images/jp2",
+ LLTrans::getString("compressed_image_files") + " (*.j2c)");
+ suggest_ext = ".j2c";
+ break;
+ case FFSAVE_SCRIPT:
+ caption += add_script_filter_to_gtkchooser(picker);
+ suggest_ext = ".lsl";
+ break;
+ default:;
+ break;
+ }
+
+ gtk_window_set_title(GTK_WINDOW(picker), caption.c_str());
+
+ if (filename.empty())
+ {
+ suggest_name += suggest_ext;
+
+ gtk_file_chooser_set_current_name
+ (GTK_FILE_CHOOSER(picker),
+ suggest_name.c_str());
+ }
+ else
+ {
+ gtk_file_chooser_set_current_name
+ (GTK_FILE_CHOOSER(picker), filename.c_str());
+ }
+
+ gtk_widget_show_all(GTK_WIDGET(picker));
+
+ gtk_main();
+
+ rtn = (getFileCount() == 1);
+
+ if(rtn && filter == FFSAVE_TGAPNG)
+ {
+ std::string selected_file = mFiles.back();
+ mFiles.pop_back();
+ mFiles.push_back(selected_file + mCurrentExtension);
+ }
+ }
+
+ gViewerWindow->getWindow()->afterDialog();
+
+ return rtn;
}
BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
{
- BOOL rtn = FALSE;
-
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
- gViewerWindow->getWindow()->beforeDialog();
-
- reset();
-
- GtkWindow* picker = buildFilePicker(false, false, "openfile");
-
- if (picker)
- {
- std::string caption = LLTrans::getString("load_file_verb") + " ";
- std::string filtername = "";
- switch (filter)
- {
- case FFLOAD_WAV:
- filtername = add_wav_filter_to_gtkchooser(picker);
- break;
- case FFLOAD_ANIM:
- filtername = add_anim_filter_to_gtkchooser(picker);
- break;
- case FFLOAD_XML:
- filtername = add_xml_filter_to_gtkchooser(picker);
- break;
+ BOOL rtn = FALSE;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ gViewerWindow->getWindow()->beforeDialog();
+
+ reset();
+
+ GtkWindow* picker = buildFilePicker(false, false, "openfile");
+
+ if (picker)
+ {
+ std::string caption = LLTrans::getString("load_file_verb") + " ";
+ std::string filtername = "";
+ switch (filter)
+ {
+ case FFLOAD_WAV:
+ filtername = add_wav_filter_to_gtkchooser(picker);
+ break;
+ case FFLOAD_ANIM:
+ filtername = add_anim_filter_to_gtkchooser(picker);
+ break;
+ case FFLOAD_XML:
+ filtername = add_xml_filter_to_gtkchooser(picker);
+ break;
case FFLOAD_GLTF:
filtername = dead_code_should_blow_up_here(picker);
break;
@@ -1515,64 +1515,64 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
filtername = add_collada_filter_to_gtkchooser(picker);
break;
case FFLOAD_IMAGE:
- filtername = add_imageload_filter_to_gtkchooser(picker);
- break;
- case FFLOAD_SCRIPT:
- filtername = add_script_filter_to_gtkchooser(picker);
- break;
- case FFLOAD_DICTIONARY:
- filtername = add_dictionary_filter_to_gtkchooser(picker);
- break;
- default:;
- break;
- }
-
- caption += filtername;
-
- gtk_window_set_title(GTK_WINDOW(picker), caption.c_str());
-
- gtk_widget_show_all(GTK_WIDGET(picker));
- gtk_main();
-
- rtn = (getFileCount() == 1);
- }
-
- gViewerWindow->getWindow()->afterDialog();
-
- return rtn;
+ filtername = add_imageload_filter_to_gtkchooser(picker);
+ break;
+ case FFLOAD_SCRIPT:
+ filtername = add_script_filter_to_gtkchooser(picker);
+ break;
+ case FFLOAD_DICTIONARY:
+ filtername = add_dictionary_filter_to_gtkchooser(picker);
+ break;
+ default:;
+ break;
+ }
+
+ caption += filtername;
+
+ gtk_window_set_title(GTK_WINDOW(picker), caption.c_str());
+
+ gtk_widget_show_all(GTK_WIDGET(picker));
+ gtk_main();
+
+ rtn = (getFileCount() == 1);
+ }
+
+ gViewerWindow->getWindow()->afterDialog();
+
+ return rtn;
}
BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)
{
- BOOL rtn = FALSE;
+ BOOL rtn = FALSE;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
- // if local file browsing is turned off, return without opening dialog
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
+ gViewerWindow->getWindow()->beforeDialog();
- gViewerWindow->getWindow()->beforeDialog();
+ reset();
- reset();
-
- GtkWindow* picker = buildFilePicker(false, false, "openfile");
+ GtkWindow* picker = buildFilePicker(false, false, "openfile");
- if (picker)
- {
- gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(picker),
- TRUE);
+ if (picker)
+ {
+ gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(picker),
+ TRUE);
- gtk_window_set_title(GTK_WINDOW(picker), LLTrans::getString("load_files").c_str());
+ gtk_window_set_title(GTK_WINDOW(picker), LLTrans::getString("load_files").c_str());
- gtk_widget_show_all(GTK_WIDGET(picker));
- gtk_main();
- rtn = !mFiles.empty();
- }
+ gtk_widget_show_all(GTK_WIDGET(picker));
+ gtk_main();
+ rtn = !mFiles.empty();
+ }
- gViewerWindow->getWindow()->afterDialog();
+ gViewerWindow->getWindow()->afterDialog();
- return rtn;
+ return rtn;
}
# else // LL_GTK
@@ -1582,23 +1582,23 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)
BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking )
{
- // if local file browsing is turned off, return without opening dialog
- // (Even though this is a stub, I think we still should not return anything at all)
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
- reset();
-
- LL_INFOS() << "getSaveFile suggested filename is [" << filename
- << "]" << LL_ENDL;
- if (!filename.empty())
- {
- mFiles.push_back(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename);
- return TRUE;
- }
- return FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ // (Even though this is a stub, I think we still should not return anything at all)
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ reset();
+
+ LL_INFOS() << "getSaveFile suggested filename is [" << filename
+ << "]" << LL_ENDL;
+ if (!filename.empty())
+ {
+ mFiles.push_back(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename);
+ return TRUE;
+ }
+ return FALSE;
}
BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
@@ -1612,27 +1612,27 @@ BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
{
- // if local file browsing is turned off, return without opening dialog
- // (Even though this is a stub, I think we still should not return anything at all)
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
- reset();
-
- // HACK: Static filenames for 'open' until we implement filepicker
- std::string filename = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + "upload";
- switch (filter)
- {
- case FFLOAD_WAV: filename += ".wav"; break;
- case FFLOAD_IMAGE: filename += ".tga"; break;
- case FFLOAD_ANIM: filename += ".bvh"; break;
- default: break;
- }
- mFiles.push_back(filename);
- LL_INFOS() << "getOpenFile: Will try to open file: " << filename << LL_ENDL;
- return TRUE;
+ // if local file browsing is turned off, return without opening dialog
+ // (Even though this is a stub, I think we still should not return anything at all)
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ reset();
+
+ // HACK: Static filenames for 'open' until we implement filepicker
+ std::string filename = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + "upload";
+ switch (filter)
+ {
+ case FFLOAD_WAV: filename += ".wav"; break;
+ case FFLOAD_IMAGE: filename += ".tga"; break;
+ case FFLOAD_ANIM: filename += ".bvh"; break;
+ default: break;
+ }
+ mFiles.push_back(filename);
+ LL_INFOS() << "getOpenFile: Will try to open file: " << filename << LL_ENDL;
+ return TRUE;
}
BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
@@ -1645,15 +1645,15 @@ BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)
{
- // if local file browsing is turned off, return without opening dialog
- // (Even though this is a stub, I think we still should not return anything at all)
- if ( check_local_file_access_enabled() == false )
- {
- return FALSE;
- }
-
- reset();
- return FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ // (Even though this is a stub, I think we still should not return anything at all)
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ reset();
+ return FALSE;
}
BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
@@ -1670,20 +1670,20 @@ BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename )
{
- reset();
- return FALSE;
+ reset();
+ return FALSE;
}
BOOL LLFilePicker::getOpenFile( ELoadFilter filter )
{
- reset();
- return FALSE;
+ reset();
+ return FALSE;
}
BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)
{
- reset();
- return FALSE;
+ reset();
+ return FALSE;
}
#endif // LL_LINUX
diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h
index 38daff9937..7149ced34a 100644
--- a/indra/newview/llfilepicker.h
+++ b/indra/newview/llfilepicker.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfilepicker.h
* @brief OS-specific file picker
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -64,118 +64,118 @@ extern "C" {
class LLFilePicker
{
#ifdef LL_GTK
- friend class LLDirPicker;
- friend void chooser_responder(GtkWidget *, gint, gpointer);
+ friend class LLDirPicker;
+ friend void chooser_responder(GtkWidget *, gint, gpointer);
#endif // LL_GTK
public:
- // calling this before main() is undefined
- static LLFilePicker& instance( void ) { return sInstance; }
-
- enum ELoadFilter
- {
- FFLOAD_ALL = 1,
- FFLOAD_WAV = 2,
- FFLOAD_IMAGE = 3,
- FFLOAD_ANIM = 4,
- FFLOAD_GLTF = 5,
- FFLOAD_XML = 6,
- FFLOAD_SLOBJECT = 7,
- FFLOAD_RAW = 8,
- FFLOAD_MODEL = 9,
- FFLOAD_COLLADA = 10,
- FFLOAD_SCRIPT = 11,
- FFLOAD_DICTIONARY = 12,
+ // calling this before main() is undefined
+ static LLFilePicker& instance( void ) { return sInstance; }
+
+ enum ELoadFilter
+ {
+ FFLOAD_ALL = 1,
+ FFLOAD_WAV = 2,
+ FFLOAD_IMAGE = 3,
+ FFLOAD_ANIM = 4,
+ FFLOAD_GLTF = 5,
+ FFLOAD_XML = 6,
+ FFLOAD_SLOBJECT = 7,
+ FFLOAD_RAW = 8,
+ FFLOAD_MODEL = 9,
+ FFLOAD_COLLADA = 10,
+ FFLOAD_SCRIPT = 11,
+ FFLOAD_DICTIONARY = 12,
FFLOAD_DIRECTORY = 13, // To call from lldirpicker.
FFLOAD_EXE = 14, // Note: EXE will be treated as ALL on Windows and Linux but not on Darwin
FFLOAD_MATERIAL = 15,
FFLOAD_MATERIAL_TEXTURE = 16,
- };
-
- enum ESaveFilter
- {
- FFSAVE_ALL = 1,
- FFSAVE_WAV = 3,
- FFSAVE_TGA = 4,
- FFSAVE_BMP = 5,
- FFSAVE_AVI = 6,
- FFSAVE_ANIM = 7,
- FFSAVE_GLTF = 8,
- FFSAVE_XML = 9,
- FFSAVE_COLLADA = 10,
- FFSAVE_RAW = 11,
- FFSAVE_J2C = 12,
- FFSAVE_PNG = 13,
- FFSAVE_JPEG = 14,
- FFSAVE_SCRIPT = 15,
- FFSAVE_TGAPNG = 16
- };
-
- // open the dialog. This is a modal operation
- BOOL getSaveFile( ESaveFilter filter = FFSAVE_ALL, const std::string& filename = LLStringUtil::null, bool blocking = true);
+ };
+
+ enum ESaveFilter
+ {
+ FFSAVE_ALL = 1,
+ FFSAVE_WAV = 3,
+ FFSAVE_TGA = 4,
+ FFSAVE_BMP = 5,
+ FFSAVE_AVI = 6,
+ FFSAVE_ANIM = 7,
+ FFSAVE_GLTF = 8,
+ FFSAVE_XML = 9,
+ FFSAVE_COLLADA = 10,
+ FFSAVE_RAW = 11,
+ FFSAVE_J2C = 12,
+ FFSAVE_PNG = 13,
+ FFSAVE_JPEG = 14,
+ FFSAVE_SCRIPT = 15,
+ FFSAVE_TGAPNG = 16
+ };
+
+ // open the dialog. This is a modal operation
+ BOOL getSaveFile( ESaveFilter filter = FFSAVE_ALL, const std::string& filename = LLStringUtil::null, bool blocking = true);
BOOL getSaveFileModeless(ESaveFilter filter,
const std::string& filename,
void (*callback)(bool, std::string&, void*),
void *userdata);
- BOOL getOpenFile( ELoadFilter filter = FFLOAD_ALL, bool blocking = true );
+ BOOL getOpenFile( ELoadFilter filter = FFLOAD_ALL, bool blocking = true );
// Todo: implement getOpenFileModeless and getMultipleOpenFilesModeless
// for windows and use directly instead of ugly LLFilePickerThread
BOOL getOpenFileModeless( ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata); // MAC only.
- BOOL getMultipleOpenFiles( ELoadFilter filter = FFLOAD_ALL, bool blocking = true );
+ BOOL getMultipleOpenFiles( ELoadFilter filter = FFLOAD_ALL, bool blocking = true );
BOOL getMultipleOpenFilesModeless( ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata ); // MAC only
- // Get the filename(s) found. getFirstFile() sets the pointer to
- // the start of the structure and allows the start of iteration.
- const std::string getFirstFile();
+ // Get the filename(s) found. getFirstFile() sets the pointer to
+ // the start of the structure and allows the start of iteration.
+ const std::string getFirstFile();
+
+ // getNextFile() increments the internal representation and
+ // returns the next file specified by the user. Returns NULL when
+ // no more files are left. Further calls to getNextFile() are
+ // undefined.
+ const std::string getNextFile();
- // getNextFile() increments the internal representation and
- // returns the next file specified by the user. Returns NULL when
- // no more files are left. Further calls to getNextFile() are
- // undefined.
- const std::string getNextFile();
+ // This utility function extracts the current file name without
+ // doing any incrementing.
+ const std::string getCurFile();
- // This utility function extracts the current file name without
- // doing any incrementing.
- const std::string getCurFile();
+ // Returns the index of the current file.
+ S32 getCurFileNum() const { return mCurrentFile; }
- // Returns the index of the current file.
- S32 getCurFileNum() const { return mCurrentFile; }
+ S32 getFileCount() const { return (S32)mFiles.size(); }
- S32 getFileCount() const { return (S32)mFiles.size(); }
+ // see lldir.h : getBaseFileName and getDirName to extract base or directory names
- // see lldir.h : getBaseFileName and getDirName to extract base or directory names
-
- // clear any lists of buffers or whatever, and make sure the file
- // picker isn't locked.
- void reset();
+ // clear any lists of buffers or whatever, and make sure the file
+ // picker isn't locked.
+ void reset();
private:
- enum
- {
- SINGLE_FILENAME_BUFFER_SIZE = 1024,
- //FILENAME_BUFFER_SIZE = 65536
- FILENAME_BUFFER_SIZE = 65000
- };
-
- // utility function to check if access to local file system via file browser
- // is enabled and if not, tidy up and indicate we're not allowed to do this.
- bool check_local_file_access_enabled();
-
+ enum
+ {
+ SINGLE_FILENAME_BUFFER_SIZE = 1024,
+ //FILENAME_BUFFER_SIZE = 65536
+ FILENAME_BUFFER_SIZE = 65000
+ };
+
+ // utility function to check if access to local file system via file browser
+ // is enabled and if not, tidy up and indicate we're not allowed to do this.
+ bool check_local_file_access_enabled();
+
#if LL_WINDOWS
- OPENFILENAMEW mOFN; // for open and save dialogs
- WCHAR mFilesW[FILENAME_BUFFER_SIZE];
+ OPENFILENAMEW mOFN; // for open and save dialogs
+ WCHAR mFilesW[FILENAME_BUFFER_SIZE];
- BOOL setupFilter(ELoadFilter filter);
+ BOOL setupFilter(ELoadFilter filter);
#endif
#if LL_DARWIN
S32 mPickOptions;
- std::vector<std::string> mFileVector;
-
- bool doNavChooseDialog(ELoadFilter filter);
- bool doNavChooseDialogModeless(ELoadFilter filter,
+ std::vector<std::string> mFileVector;
+
+ bool doNavChooseDialog(ELoadFilter filter);
+ bool doNavChooseDialogModeless(ELoadFilter filter,
void (*callback)(bool, std::vector<std::string>&, void*),
void *userdata);
- bool doNavSaveDialog(ESaveFilter filter, const std::string& filename);
+ bool doNavSaveDialog(ESaveFilter filter, const std::string& filename);
std::unique_ptr<std::vector<std::string>> navOpenFilterProc(ELoadFilter filter);
bool doNavSaveDialogModeless(ESaveFilter filter,
const std::string& filename,
@@ -184,31 +184,31 @@ private:
#endif
#if LL_GTK
- static void add_to_selectedfiles(gpointer data, gpointer user_data);
- static void chooser_responder(GtkWidget *widget, gint response, gpointer user_data);
- // we remember the last path that was accessed for a particular usage
- std::map <std::string, std::string> mContextToPathMap;
- std::string mCurContextName;
- // we also remember the extension of the last added file.
- std::string mCurrentExtension;
+ static void add_to_selectedfiles(gpointer data, gpointer user_data);
+ static void chooser_responder(GtkWidget *widget, gint response, gpointer user_data);
+ // we remember the last path that was accessed for a particular usage
+ std::map <std::string, std::string> mContextToPathMap;
+ std::string mCurContextName;
+ // we also remember the extension of the last added file.
+ std::string mCurrentExtension;
#endif
- std::vector<std::string> mFiles;
- S32 mCurrentFile;
- bool mLocked;
+ std::vector<std::string> mFiles;
+ S32 mCurrentFile;
+ bool mLocked;
+
+ static LLFilePicker sInstance;
- static LLFilePicker sInstance;
-
protected:
#if LL_GTK
GtkWindow* buildFilePicker(bool is_save, bool is_folder,
- std::string context = "generic");
+ std::string context = "generic");
#endif
public:
- // don't call these directly please.
- LLFilePicker();
- ~LLFilePicker();
+ // don't call these directly please.
+ LLFilePicker();
+ ~LLFilePicker();
};
#endif
diff --git a/indra/newview/llfilepicker_mac.h b/indra/newview/llfilepicker_mac.h
index 367c792969..77cc8540bc 100644
--- a/indra/newview/llfilepicker_mac.h
+++ b/indra/newview/llfilepicker_mac.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfilepicker_mac.h
* @brief OS-specific file picker
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,7 +47,7 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types,
void (*callback)(bool, std::vector<std::string>&, void*),
void *userdata);
-std::unique_ptr<std::string> doSaveDialog(const std::string* file,
+std::unique_ptr<std::string> doSaveDialog(const std::string* file,
const std::string* type,
const std::string* creator,
const std::string* extension,
diff --git a/indra/newview/llfilteredwearablelist.cpp b/indra/newview/llfilteredwearablelist.cpp
index 2bfaa1e5bc..0f29cbbe3a 100644
--- a/indra/newview/llfilteredwearablelist.cpp
+++ b/indra/newview/llfilteredwearablelist.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,91 +40,91 @@ LLFilteredWearableListManager::LLFilteredWearableListManager(LLInventoryItemsLis
, mCollector(collector)
, mListStale(true)
{
- llassert(mWearableList);
- gInventory.addObserver(this);
- gInventory.fetchDescendentsOf(gInventory.getRootFolderID());
+ llassert(mWearableList);
+ gInventory.addObserver(this);
+ gInventory.fetchDescendentsOf(gInventory.getRootFolderID());
}
LLFilteredWearableListManager::~LLFilteredWearableListManager()
{
- gInventory.removeObserver(this);
+ gInventory.removeObserver(this);
}
void LLFilteredWearableListManager::changed(U32 mask)
{
- if (LLInventoryObserver::CALLING_CARD == mask
- || LLInventoryObserver::GESTURE == mask
- || LLInventoryObserver::SORT == mask
- )
- {
- // skip non-related changes
- return;
- }
-
- if(!gInventory.isInventoryUsable())
- {
- return;
- }
-
- if (mWearableList->isInVisibleChain() || mWearableList->getForceRefresh())
- {
- // Todo: current populateList() is time consuming and changed() is time-sensitive,
- // either move from here or optimize
- populateList();
- }
- else
- {
- mListStale = true;
- }
+ if (LLInventoryObserver::CALLING_CARD == mask
+ || LLInventoryObserver::GESTURE == mask
+ || LLInventoryObserver::SORT == mask
+ )
+ {
+ // skip non-related changes
+ return;
+ }
+
+ if(!gInventory.isInventoryUsable())
+ {
+ return;
+ }
+
+ if (mWearableList->isInVisibleChain() || mWearableList->getForceRefresh())
+ {
+ // Todo: current populateList() is time consuming and changed() is time-sensitive,
+ // either move from here or optimize
+ populateList();
+ }
+ else
+ {
+ mListStale = true;
+ }
}
void LLFilteredWearableListManager::setFilterCollector(LLInventoryCollectFunctor* collector)
{
- mCollector = collector;
- populateList();
+ mCollector = collector;
+ populateList();
}
void LLFilteredWearableListManager::populateIfNeeded()
{
- if (mListStale)
- {
- populateList();
- }
+ if (mListStale)
+ {
+ populateList();
+ }
}
LLTrace::BlockTimerStatHandle FTM_MANAGER_LIST_POPULATION("Manager List Population");
void LLFilteredWearableListManager::populateList()
{
- LL_RECORD_BLOCK_TIME(FTM_MANAGER_LIST_POPULATION);
-
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
-
- if(mCollector)
- {
- // Too slow with large inventory!
- // Consider refactoring into "request once, append ids on changed()", since
- // Inventory observer provides ids of changed items this should be possible,
- // but will likely require modifying LLInventoryItemsList to avoid code-repeats.
- // Or make something like "gather everything and filter manually on idle"
- mListStale = false;
- gInventory.collectDescendentsIf(
- gInventory.getRootFolderID(),
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- *mCollector);
- }
-
- // Probably will also need to get items from Library (waiting for reply in EXT-6724).
-
- if (item_array.empty() && gInventory.isCategoryComplete(gInventory.getRootFolderID()))
- {
- mWearableList->setNoItemsCommentText(LLTrans::getString("NoneFound"));
- }
-
- mWearableList->refreshList(item_array);
+ LL_RECORD_BLOCK_TIME(FTM_MANAGER_LIST_POPULATION);
+
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+
+ if(mCollector)
+ {
+ // Too slow with large inventory!
+ // Consider refactoring into "request once, append ids on changed()", since
+ // Inventory observer provides ids of changed items this should be possible,
+ // but will likely require modifying LLInventoryItemsList to avoid code-repeats.
+ // Or make something like "gather everything and filter manually on idle"
+ mListStale = false;
+ gInventory.collectDescendentsIf(
+ gInventory.getRootFolderID(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ *mCollector);
+ }
+
+ // Probably will also need to get items from Library (waiting for reply in EXT-6724).
+
+ if (item_array.empty() && gInventory.isCategoryComplete(gInventory.getRootFolderID()))
+ {
+ mWearableList->setNoItemsCommentText(LLTrans::getString("NoneFound"));
+ }
+
+ mWearableList->refreshList(item_array);
}
void LLFilteredWearableListManager::holdProgress()
diff --git a/indra/newview/llfilteredwearablelist.h b/indra/newview/llfilteredwearablelist.h
index 197302f41d..cb84e24774 100644
--- a/indra/newview/llfilteredwearablelist.h
+++ b/indra/newview/llfilteredwearablelist.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,41 +35,41 @@ class LLInventoryItemsList;
// Class that fills LLInventoryItemsList with filtered data (original items only (non-links)).
class LLFilteredWearableListManager : public LLInventoryObserver
{
- LOG_CLASS(LLFilteredWearableListManager);
+ LOG_CLASS(LLFilteredWearableListManager);
public:
- LLFilteredWearableListManager(LLInventoryItemsList* list, LLInventoryCollectFunctor* collector);
- ~LLFilteredWearableListManager();
+ LLFilteredWearableListManager(LLInventoryItemsList* list, LLInventoryCollectFunctor* collector);
+ ~LLFilteredWearableListManager();
- /** LLInventoryObserver implementation
- *
- */
- /*virtual*/ void changed(U32 mask);
+ /** LLInventoryObserver implementation
+ *
+ */
+ /*virtual*/ void changed(U32 mask);
- /**
- * Sets new collector and applies it immediately
- */
- void setFilterCollector(LLInventoryCollectFunctor* collector);
+ /**
+ * Sets new collector and applies it immediately
+ */
+ void setFilterCollector(LLInventoryCollectFunctor* collector);
- /**
- * Populates wearable list with filtered data in case there were any updates.
- */
- void populateIfNeeded();
+ /**
+ * Populates wearable list with filtered data in case there were any updates.
+ */
+ void populateIfNeeded();
- /**
- * Drop operation
- */
- void holdProgress();
+ /**
+ * Drop operation
+ */
+ void holdProgress();
private:
- /**
- * Populates wearable list with filtered data.
- */
- void populateList();
+ /**
+ * Populates wearable list with filtered data.
+ */
+ void populateList();
- LLInventoryItemsList* mWearableList;
- LLInventoryCollectFunctor* mCollector;
- bool mListStale;
+ LLInventoryItemsList* mWearableList;
+ LLInventoryCollectFunctor* mCollector;
+ bool mListStale;
};
#endif //LL_LLFILTEREDWEARABLELIST_H
diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp
index 1ce9fe3a7a..8c0aa4b8a5 100644
--- a/indra/newview/llfirstuse.cpp
+++ b/indra/newview/llfirstuse.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfirstuse.cpp
* @brief Methods that spawn "first-use" dialogs
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
#include "llnotifications.h"
// viewer includes
-#include "llagent.h" // for gAgent.inPrelude()
+#include "llagent.h" // for gAgent.inPrelude()
#include "llviewercontrol.h"
#include "llui.h"
#include "llappviewer.h"
@@ -43,26 +43,26 @@
// static
void LLFirstUse::otherAvatarChatFirst(bool enable)
{
- firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "nearby_chat").with("direction", "top_right").with("distance", 24));
+ firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "nearby_chat").with("direction", "top_right").with("distance", 24));
}
// static
void LLFirstUse::speak(bool enable)
{
- firstUseNotification("FirstSpeak", enable, "HintSpeak", LLSD(), LLSD().with("target", "speak_btn").with("direction", "top"));
+ firstUseNotification("FirstSpeak", enable, "HintSpeak", LLSD(), LLSD().with("target", "speak_btn").with("direction", "top"));
}
// static
void LLFirstUse::sit(bool enable)
{
- firstUseNotification("FirstSit", enable, "HintSit", LLSD(), LLSD().with("target", "stand_btn").with("direction", "top"));
+ firstUseNotification("FirstSit", enable, "HintSit", LLSD(), LLSD().with("target", "stand_btn").with("direction", "top"));
}
// static
void LLFirstUse::newInventory(bool enable)
{
- // turning this off until bug EXP-62 can be fixed (inventory hint appears for new users when their initial inventory is acquired)
- // firstUseNotification("FirstInventoryOffer", enable, "HintInventory", LLSD(), LLSD().with("target", "inventory_btn").with("direction", "left"));
+ // turning this off until bug EXP-62 can be fixed (inventory hint appears for new users when their initial inventory is acquired)
+ // firstUseNotification("FirstInventoryOffer", enable, "HintInventory", LLSD(), LLSD().with("target", "inventory_btn").with("direction", "left"));
}
// first clean starts at 3 AM
@@ -73,104 +73,104 @@ const S32 SANDBOX_CLEAN_FREQ = 12;
// static
void LLFirstUse::useSandbox()
{
- firstUseNotification("FirstSandbox", true, "FirstSandbox", LLSD().with("HOURS", SANDBOX_CLEAN_FREQ).with("TIME", SANDBOX_FIRST_CLEAN_HOUR));
+ firstUseNotification("FirstSandbox", true, "FirstSandbox", LLSD().with("HOURS", SANDBOX_CLEAN_FREQ).with("TIME", SANDBOX_FIRST_CLEAN_HOUR));
}
// static
void LLFirstUse::notUsingDestinationGuide(bool enable)
{
- // not doing this yet
- firstUseNotification("FirstNotUseDestinationGuide", enable, "HintDestinationGuide", LLSD(), LLSD().with("target", "dest_guide_btn").with("direction", "top"));
+ // not doing this yet
+ firstUseNotification("FirstNotUseDestinationGuide", enable, "HintDestinationGuide", LLSD(), LLSD().with("target", "dest_guide_btn").with("direction", "top"));
}
// static
void LLFirstUse::notUsingSidePanel(bool enable)
{
- // not doing this yet
- //firstUseNotification("FirstNotUseSidePanel", enable, "HintSidePanel", LLSD(), LLSD().with("target", "side_panel_btn").with("direction", "left"));
+ // not doing this yet
+ //firstUseNotification("FirstNotUseSidePanel", enable, "HintSidePanel", LLSD(), LLSD().with("target", "side_panel_btn").with("direction", "left"));
}
// static
void LLFirstUse::notMoving(bool enable)
{
- // fire off 2 notifications and rely on filtering to select the relevant one
- firstUseNotification("FirstNotMoving", enable, "HintMove", LLSD(), LLSD().with("target", "move_btn").with("direction", "top"));
- firstUseNotification("FirstNotMoving", enable, "HintMoveClick", LLSD(), LLSD()
- .with("target", "nav_bar")
- .with("direction", "bottom")
- .with("hint_image", "click_to_move.png")
- .with("up_arrow", ""));
+ // fire off 2 notifications and rely on filtering to select the relevant one
+ firstUseNotification("FirstNotMoving", enable, "HintMove", LLSD(), LLSD().with("target", "move_btn").with("direction", "top"));
+ firstUseNotification("FirstNotMoving", enable, "HintMoveClick", LLSD(), LLSD()
+ .with("target", "nav_bar")
+ .with("direction", "bottom")
+ .with("hint_image", "click_to_move.png")
+ .with("up_arrow", ""));
}
// static
void LLFirstUse::viewPopup(bool enable)
{
-// firstUseNotification("FirstViewPopup", enable, "HintView", LLSD(), LLSD().with("target", "view_popup").with("direction", "right"));
+// firstUseNotification("FirstViewPopup", enable, "HintView", LLSD(), LLSD().with("target", "view_popup").with("direction", "right"));
}
// static
void LLFirstUse::setDisplayName(bool enable)
{
- firstUseNotification("FirstDisplayName", enable, "HintDisplayName", LLSD(), LLSD().with("target", "set_display_name").with("direction", "left"));
+ firstUseNotification("FirstDisplayName", enable, "HintDisplayName", LLSD(), LLSD().with("target", "set_display_name").with("direction", "left"));
}
// static
void LLFirstUse::receiveLindens(bool enable)
{
- firstUseNotification("FirstReceiveLindens", enable, "HintLindenDollar", LLSD(), LLSD().with("target", "linden_balance").with("direction", "bottom"));
+ firstUseNotification("FirstReceiveLindens", enable, "HintLindenDollar", LLSD(), LLSD().with("target", "linden_balance").with("direction", "bottom"));
}
-//static
+//static
void LLFirstUse::firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args, LLSD payload)
{
- init();
-
- if (enable)
- {
- if (gSavedSettings.getBOOL("EnableUIHints"))
- {
- LL_DEBUGS("LLFirstUse") << "Trigger first use notification " << notification_name << LL_ENDL;
-
- // if notification doesn't already exist and this notification hasn't been disabled...
- if (gWarningSettings.getBOOL(control_var))
- { // create new notification
- LLNotifications::instance().add(LLNotification::Params().name(notification_name).substitutions(args).payload(payload.with("control_var", control_var)));
- }
- }
- }
- else
- {
- LL_DEBUGS("LLFirstUse") << "Disabling first use notification " << notification_name << LL_ENDL;
- LLNotifications::instance().cancelByName(notification_name);
- // redundantly clear settings var here, in case there are no notifications to cancel
- gWarningSettings.setBOOL(control_var, FALSE);
- }
+ init();
+
+ if (enable)
+ {
+ if (gSavedSettings.getBOOL("EnableUIHints"))
+ {
+ LL_DEBUGS("LLFirstUse") << "Trigger first use notification " << notification_name << LL_ENDL;
+
+ // if notification doesn't already exist and this notification hasn't been disabled...
+ if (gWarningSettings.getBOOL(control_var))
+ { // create new notification
+ LLNotifications::instance().add(LLNotification::Params().name(notification_name).substitutions(args).payload(payload.with("control_var", control_var)));
+ }
+ }
+ }
+ else
+ {
+ LL_DEBUGS("LLFirstUse") << "Disabling first use notification " << notification_name << LL_ENDL;
+ LLNotifications::instance().cancelByName(notification_name);
+ // redundantly clear settings var here, in case there are no notifications to cancel
+ gWarningSettings.setBOOL(control_var, FALSE);
+ }
}
// static
void LLFirstUse::init()
{
- static bool initialized = false;
- if (!initialized)
- {
- LLNotifications::instance().getChannel("Hints")->connectChanged(&processNotification);
- }
- initialized = true;
+ static bool initialized = false;
+ if (!initialized)
+ {
+ LLNotifications::instance().getChannel("Hints")->connectChanged(&processNotification);
+ }
+ initialized = true;
}
-//static
+//static
bool LLFirstUse::processNotification(const LLSD& notify)
{
- if (notify["sigtype"].asString() == "delete")
- {
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
- if (notification)
- {
- // disable any future notifications
- gWarningSettings.setBOOL(notification->getPayload()["control_var"], FALSE);
- }
- }
- return false;
+ if (notify["sigtype"].asString() == "delete")
+ {
+ LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
+ if (notification)
+ {
+ // disable any future notifications
+ gWarningSettings.setBOOL(notification->getPayload()["control_var"], FALSE);
+ }
+ }
+ return false;
}
diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h
index 80b83580b3..57bfbf9669 100644
--- a/indra/newview/llfirstuse.h
+++ b/indra/newview/llfirstuse.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfirstuse.h
* @brief Methods that spawn "first-use" dialogs.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,31 +31,31 @@
#include "llstring.h"
/*
-1. On first use of 'sit here', explain how to get up and rotate view.
+1. On first use of 'sit here', explain how to get up and rotate view.
2. On first use of map, explain dbl-click = telport, how hubs/beacons work,
click-drag to move map
-3. First use of pie 'Go To', explain other ways to move around
+3. First use of pie 'Go To', explain other ways to move around
4. First use of 'Create' or 'Edit', explain build toolbar, that you can create
-things if build enabled, edit things you own, and that you can ESC to exit it.
+things if build enabled, edit things you own, and that you can ESC to exit it.
5. First use of 'Talk to' explain difference between that and regular chat,
-reduced range, how to leave conversation, arrow keys to orbit.
+reduced range, how to leave conversation, arrow keys to orbit.
6. First lft-click that does nothing (land,object): Explain that rgt-click
gives menu, lft-click interacts or moves if physical
7. On first receipt of L$ (not rez/derez) explain that objects or people may
-give you L$, and how to give someone or something money ('Pay...').
+give you L$, and how to give someone or something money ('Pay...').
8. After first teleporting and being sent to nearest hub, a dialog explaining
-how to find and move toward the beacon.
+how to find and move toward the beacon.
9. On first accept/auto-accept permissions, explain that some objects may be
activated by entering mouselook 'M', or may override your movement keys with
-other functions.
+other functions.
10. FIrst use of 'wear' or drag object from inventory onto self: 'You can
attach objects to your body by dragging ontl yourelf of rgt-clk->wear from
@@ -78,23 +78,23 @@ class LLNotification;
class LLFirstUse
{
public:
- static void otherAvatarChatFirst(bool enable = true);
- static void speak(bool enable = true);
- static void sit(bool enable = true);
- static void notUsingDestinationGuide(bool enable = true);
- static void notUsingSidePanel(bool enable = true);
- static void notMoving(bool enable = true);
- static void viewPopup(bool enable = true);
- static void newInventory(bool enable = true);
- static void receiveLindens(bool enable = true);
- static void setDisplayName(bool enable = true);
- static void useSandbox();
-
+ static void otherAvatarChatFirst(bool enable = true);
+ static void speak(bool enable = true);
+ static void sit(bool enable = true);
+ static void notUsingDestinationGuide(bool enable = true);
+ static void notUsingSidePanel(bool enable = true);
+ static void notMoving(bool enable = true);
+ static void viewPopup(bool enable = true);
+ static void newInventory(bool enable = true);
+ static void receiveLindens(bool enable = true);
+ static void setDisplayName(bool enable = true);
+ static void useSandbox();
+
protected:
- static void firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args = LLSD(), LLSD payload = LLSD());
+ static void firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args = LLSD(), LLSD payload = LLSD());
- static void init();
- static bool processNotification(const LLSD& notify);
+ static void init();
+ static bool processNotification(const LLSD& notify);
};
#endif
diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp
index e935bc5553..7ed62d68bd 100644
--- a/indra/newview/llflexibleobject.cpp
+++ b/indra/newview/llflexibleobject.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llflexibleobject.cpp
* @brief Flexible object implementation
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,40 +53,40 @@ std::vector<LLVolumeImplFlexible*> LLVolumeImplFlexible::sInstanceList;
// constructor
//-----------------------------------------------
LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectData* attributes) :
- mVO(vo),
- mAttributes(attributes),
- mLastFrameNum(0),
- mLastUpdatePeriod(0)
+ mVO(vo),
+ mAttributes(attributes),
+ mLastFrameNum(0),
+ mLastUpdatePeriod(0)
{
- static U32 seed = 0;
- mID = seed++;
- mInitialized = FALSE;
- mUpdated = FALSE;
- mInitializedRes = -1;
- mSimulateRes = 0;
- mCollisionSphereRadius = 0.f;
- mRenderRes = -1;
-
- if(mVO->mDrawable.notNull())
- {
- mVO->mDrawable->makeActive() ;
- }
-
- mInstanceIndex = sInstanceList.size();
- sInstanceList.push_back(this);
+ static U32 seed = 0;
+ mID = seed++;
+ mInitialized = FALSE;
+ mUpdated = FALSE;
+ mInitializedRes = -1;
+ mSimulateRes = 0;
+ mCollisionSphereRadius = 0.f;
+ mRenderRes = -1;
+
+ if(mVO->mDrawable.notNull())
+ {
+ mVO->mDrawable->makeActive() ;
+ }
+
+ mInstanceIndex = sInstanceList.size();
+ sInstanceList.push_back(this);
}//-----------------------------------------------
LLVolumeImplFlexible::~LLVolumeImplFlexible()
{
- S32 end_idx = sInstanceList.size()-1;
-
- if (end_idx != mInstanceIndex)
- {
- sInstanceList[mInstanceIndex] = sInstanceList[end_idx];
- sInstanceList[mInstanceIndex]->mInstanceIndex = mInstanceIndex;
- }
-
- sInstanceList.pop_back();
+ S32 end_idx = sInstanceList.size()-1;
+
+ if (end_idx != mInstanceIndex)
+ {
+ sInstanceList[mInstanceIndex] = sInstanceList[end_idx];
+ sInstanceList[mInstanceIndex]->mInstanceIndex = mInstanceIndex;
+ }
+
+ sInstanceList.pop_back();
}
//static
@@ -94,194 +94,194 @@ void LLVolumeImplFlexible::updateClass()
{
LL_PROFILE_ZONE_SCOPED;
- U64 virtual_frame_num = LLTimer::getElapsedSeconds() / SEC_PER_FLEXI_FRAME;
- for (std::vector<LLVolumeImplFlexible*>::iterator iter = sInstanceList.begin();
- iter != sInstanceList.end();
- ++iter)
- {
- // Note: by now update period might have changed
- if ((*iter)->mRenderRes == -1
- || (*iter)->mLastFrameNum + (*iter)->mLastUpdatePeriod <= virtual_frame_num
- || (*iter)->mLastFrameNum > virtual_frame_num) //time issues, overflow
- {
- (*iter)->doIdleUpdate();
- }
- }
+ U64 virtual_frame_num = LLTimer::getElapsedSeconds() / SEC_PER_FLEXI_FRAME;
+ for (std::vector<LLVolumeImplFlexible*>::iterator iter = sInstanceList.begin();
+ iter != sInstanceList.end();
+ ++iter)
+ {
+ // Note: by now update period might have changed
+ if ((*iter)->mRenderRes == -1
+ || (*iter)->mLastFrameNum + (*iter)->mLastUpdatePeriod <= virtual_frame_num
+ || (*iter)->mLastFrameNum > virtual_frame_num) //time issues, overflow
+ {
+ (*iter)->doIdleUpdate();
+ }
+ }
}
LLVector3 LLVolumeImplFlexible::getFramePosition() const
{
- return mVO->getRenderPosition();
+ return mVO->getRenderPosition();
}
LLQuaternion LLVolumeImplFlexible::getFrameRotation() const
{
- return mVO->getRenderRotation();
+ return mVO->getRenderRotation();
}
void LLVolumeImplFlexible::onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin)
{
- if (param_type == LLNetworkData::PARAMS_FLEXIBLE)
- {
- mAttributes = (LLFlexibleObjectData*)data;
- setAttributesOfAllSections();
- }
+ if (param_type == LLNetworkData::PARAMS_FLEXIBLE)
+ {
+ mAttributes = (LLFlexibleObjectData*)data;
+ setAttributesOfAllSections();
+ }
}
void LLVolumeImplFlexible::onShift(const LLVector4a &shift_vector)
-{
- //VECTORIZE THIS
- LLVector3 shift(shift_vector.getF32ptr());
- for (int section = 0; section < (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1; ++section)
- {
- mSection[section].mPosition += shift;
- }
+{
+ //VECTORIZE THIS
+ LLVector3 shift(shift_vector.getF32ptr());
+ for (int section = 0; section < (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1; ++section)
+ {
+ mSection[section].mPosition += shift;
+ }
}
//-----------------------------------------------------------------------------------------------
void LLVolumeImplFlexible::setParentPositionAndRotationDirectly( LLVector3 p, LLQuaternion r )
{
- mParentPosition = p;
- mParentRotation = r;
+ mParentPosition = p;
+ mParentRotation = r;
}//-----------------------------------------------------------------------------------------------------
void LLVolumeImplFlexible::remapSections(LLFlexibleObjectSection *source, S32 source_sections,
- LLFlexibleObjectSection *dest, S32 dest_sections)
-{
- S32 num_output_sections = 1<<dest_sections;
- LLVector3 scale = mVO->mDrawable->getScale();
- F32 source_section_length = scale.mV[VZ] / (F32)(1<<source_sections);
- F32 section_length = scale.mV[VZ] / (F32)num_output_sections;
- if (source_sections == -1)
- {
- // Generate all from section 0
- dest[0] = source[0];
- for (S32 section=0; section<num_output_sections; ++section)
- {
- dest[section+1] = dest[section];
- dest[section+1].mPosition += dest[section].mDirection * section_length;
- dest[section+1].mVelocity.setVec( LLVector3::zero );
- }
- }
- else if (source_sections > dest_sections)
- {
- // Copy, skipping sections
-
- S32 num_steps = 1<<(source_sections-dest_sections);
-
- // Copy from left to right since it may be an in-place computation
- for (S32 section=0; section<num_output_sections; ++section)
- {
- dest[section+1] = source[(section+1)*num_steps];
- }
- dest[0] = source[0];
- }
- else if (source_sections < dest_sections)
- {
- // Interpolate section info
- // Iterate from right to left since it may be an in-place computation
- S32 step_shift = dest_sections-source_sections;
- S32 num_steps = 1<<step_shift;
- for (S32 section=num_output_sections-num_steps; section>=0; section -= num_steps)
- {
- LLFlexibleObjectSection *last_source_section = &source[section>>step_shift];
- LLFlexibleObjectSection *source_section = &source[(section>>step_shift)+1];
-
- // Cubic interpolation of position
- // At^3 + Bt^2 + Ct + D = f(t)
- LLVector3 D = last_source_section->mPosition;
- LLVector3 C = last_source_section->mdPosition * source_section_length;
- LLVector3 Y = source_section->mdPosition * source_section_length - C; // Helper var
- LLVector3 X = (source_section->mPosition - D - C); // Helper var
- LLVector3 A = Y - 2*X;
- LLVector3 B = X - A;
-
- F32 t_inc = 1.f/F32(num_steps);
- F32 t = t_inc;
- for (S32 step=1; step<num_steps; ++step)
- {
- dest[section+step].mScale =
- lerp(last_source_section->mScale, source_section->mScale, t);
- dest[section+step].mAxisRotation =
- slerp(t, last_source_section->mAxisRotation, source_section->mAxisRotation);
-
- // Evaluate output interpolated values
- F32 t_sq = t*t;
- dest[section+step].mPosition = t_sq*(t*A + B) + t*C + D;
- dest[section+step].mRotation =
- slerp(t, last_source_section->mRotation, source_section->mRotation);
- dest[section+step].mVelocity = lerp(last_source_section->mVelocity, source_section->mVelocity, t);
- dest[section+step].mDirection = lerp(last_source_section->mDirection, source_section->mDirection, t);
- dest[section+step].mdPosition = lerp(last_source_section->mdPosition, source_section->mdPosition, t);
- dest[section+num_steps] = *source_section;
- t += t_inc;
- }
- }
- dest[0] = source[0];
- }
- else
- {
- // numbers are equal. copy info
- for (S32 section=0; section <= num_output_sections; ++section)
- {
- dest[section] = source[section];
- }
- }
+ LLFlexibleObjectSection *dest, S32 dest_sections)
+{
+ S32 num_output_sections = 1<<dest_sections;
+ LLVector3 scale = mVO->mDrawable->getScale();
+ F32 source_section_length = scale.mV[VZ] / (F32)(1<<source_sections);
+ F32 section_length = scale.mV[VZ] / (F32)num_output_sections;
+ if (source_sections == -1)
+ {
+ // Generate all from section 0
+ dest[0] = source[0];
+ for (S32 section=0; section<num_output_sections; ++section)
+ {
+ dest[section+1] = dest[section];
+ dest[section+1].mPosition += dest[section].mDirection * section_length;
+ dest[section+1].mVelocity.setVec( LLVector3::zero );
+ }
+ }
+ else if (source_sections > dest_sections)
+ {
+ // Copy, skipping sections
+
+ S32 num_steps = 1<<(source_sections-dest_sections);
+
+ // Copy from left to right since it may be an in-place computation
+ for (S32 section=0; section<num_output_sections; ++section)
+ {
+ dest[section+1] = source[(section+1)*num_steps];
+ }
+ dest[0] = source[0];
+ }
+ else if (source_sections < dest_sections)
+ {
+ // Interpolate section info
+ // Iterate from right to left since it may be an in-place computation
+ S32 step_shift = dest_sections-source_sections;
+ S32 num_steps = 1<<step_shift;
+ for (S32 section=num_output_sections-num_steps; section>=0; section -= num_steps)
+ {
+ LLFlexibleObjectSection *last_source_section = &source[section>>step_shift];
+ LLFlexibleObjectSection *source_section = &source[(section>>step_shift)+1];
+
+ // Cubic interpolation of position
+ // At^3 + Bt^2 + Ct + D = f(t)
+ LLVector3 D = last_source_section->mPosition;
+ LLVector3 C = last_source_section->mdPosition * source_section_length;
+ LLVector3 Y = source_section->mdPosition * source_section_length - C; // Helper var
+ LLVector3 X = (source_section->mPosition - D - C); // Helper var
+ LLVector3 A = Y - 2*X;
+ LLVector3 B = X - A;
+
+ F32 t_inc = 1.f/F32(num_steps);
+ F32 t = t_inc;
+ for (S32 step=1; step<num_steps; ++step)
+ {
+ dest[section+step].mScale =
+ lerp(last_source_section->mScale, source_section->mScale, t);
+ dest[section+step].mAxisRotation =
+ slerp(t, last_source_section->mAxisRotation, source_section->mAxisRotation);
+
+ // Evaluate output interpolated values
+ F32 t_sq = t*t;
+ dest[section+step].mPosition = t_sq*(t*A + B) + t*C + D;
+ dest[section+step].mRotation =
+ slerp(t, last_source_section->mRotation, source_section->mRotation);
+ dest[section+step].mVelocity = lerp(last_source_section->mVelocity, source_section->mVelocity, t);
+ dest[section+step].mDirection = lerp(last_source_section->mDirection, source_section->mDirection, t);
+ dest[section+step].mdPosition = lerp(last_source_section->mdPosition, source_section->mdPosition, t);
+ dest[section+num_steps] = *source_section;
+ t += t_inc;
+ }
+ }
+ dest[0] = source[0];
+ }
+ else
+ {
+ // numbers are equal. copy info
+ for (S32 section=0; section <= num_output_sections; ++section)
+ {
+ dest[section] = source[section];
+ }
+ }
}
//-----------------------------------------------------------------------------
void LLVolumeImplFlexible::setAttributesOfAllSections(LLVector3* inScale)
{
- LLVector2 bottom_scale, top_scale;
- F32 begin_rot = 0, end_rot = 0;
- if (mVO->getVolume())
- {
- const LLPathParams &params = mVO->getVolume()->getParams().getPathParams();
- bottom_scale = params.getBeginScale();
- top_scale = params.getEndScale();
- begin_rot = F_PI * params.getTwistBegin();
- end_rot = F_PI * params.getTwist();
- }
-
- if (!mVO->mDrawable)
- {
- return;
- }
-
- S32 num_sections = 1 << mSimulateRes;
-
- LLVector3 scale;
- if (inScale == (LLVector3*)NULL)
- {
- scale = mVO->mDrawable->getScale();
- }
- else
- {
- scale = *inScale;
- }
-
- mSection[0].mPosition = getAnchorPosition();
- mSection[0].mDirection = LLVector3::z_axis * getFrameRotation();
- mSection[0].mdPosition = mSection[0].mDirection;
- mSection[0].mScale.setVec(scale.mV[VX]*bottom_scale.mV[0], scale.mV[VY]*bottom_scale.mV[1]);
- mSection[0].mVelocity.setVec(0,0,0);
- mSection[0].mAxisRotation.setQuat(begin_rot,0,0,1);
-
- remapSections(mSection, mInitializedRes, mSection, mSimulateRes);
- mInitializedRes = mSimulateRes;
-
- F32 t_inc = 1.f/F32(num_sections);
- F32 t = t_inc;
-
- for ( int i=1; i<= num_sections; i++)
- {
- mSection[i].mAxisRotation.setQuat(lerp(begin_rot,end_rot,t),0,0,1);
- mSection[i].mScale = LLVector2(
- scale.mV[VX] * lerp(bottom_scale.mV[0], top_scale.mV[0], t),
- scale.mV[VY] * lerp(bottom_scale.mV[1], top_scale.mV[1], t));
- t += t_inc;
- }
+ LLVector2 bottom_scale, top_scale;
+ F32 begin_rot = 0, end_rot = 0;
+ if (mVO->getVolume())
+ {
+ const LLPathParams &params = mVO->getVolume()->getParams().getPathParams();
+ bottom_scale = params.getBeginScale();
+ top_scale = params.getEndScale();
+ begin_rot = F_PI * params.getTwistBegin();
+ end_rot = F_PI * params.getTwist();
+ }
+
+ if (!mVO->mDrawable)
+ {
+ return;
+ }
+
+ S32 num_sections = 1 << mSimulateRes;
+
+ LLVector3 scale;
+ if (inScale == (LLVector3*)NULL)
+ {
+ scale = mVO->mDrawable->getScale();
+ }
+ else
+ {
+ scale = *inScale;
+ }
+
+ mSection[0].mPosition = getAnchorPosition();
+ mSection[0].mDirection = LLVector3::z_axis * getFrameRotation();
+ mSection[0].mdPosition = mSection[0].mDirection;
+ mSection[0].mScale.setVec(scale.mV[VX]*bottom_scale.mV[0], scale.mV[VY]*bottom_scale.mV[1]);
+ mSection[0].mVelocity.setVec(0,0,0);
+ mSection[0].mAxisRotation.setQuat(begin_rot,0,0,1);
+
+ remapSections(mSection, mInitializedRes, mSection, mSimulateRes);
+ mInitializedRes = mSimulateRes;
+
+ F32 t_inc = 1.f/F32(num_sections);
+ F32 t = t_inc;
+
+ for ( int i=1; i<= num_sections; i++)
+ {
+ mSection[i].mAxisRotation.setQuat(lerp(begin_rot,end_rot,t),0,0,1);
+ mSection[i].mScale = LLVector2(
+ scale.mV[VX] * lerp(bottom_scale.mV[0], top_scale.mV[0], t),
+ scale.mV[VY] * lerp(bottom_scale.mV[1], top_scale.mV[1], t));
+ t += t_inc;
+ }
}//-----------------------------------------------------------------------------------
@@ -292,446 +292,446 @@ void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, cons
void LLVolumeImplFlexible::updateRenderRes()
{
- if (!mAttributes)
- return;
+ if (!mAttributes)
+ return;
- LLDrawable* drawablep = mVO->mDrawable;
+ LLDrawable* drawablep = mVO->mDrawable;
- S32 new_res = mAttributes->getSimulateLOD();
+ S32 new_res = mAttributes->getSimulateLOD();
#if 1 //optimal approximation of previous behavior that doesn't rely on atan2
- F32 app_angle = mVO->getScale().mV[2]/drawablep->mDistanceWRTCamera;
+ F32 app_angle = mVO->getScale().mV[2]/drawablep->mDistanceWRTCamera;
- // Rendering sections increases with visible angle on the screen
- mRenderRes = (S32) (12.f*app_angle);
+ // Rendering sections increases with visible angle on the screen
+ mRenderRes = (S32) (12.f*app_angle);
#else //legacy behavior
- //number of segments only cares about z axis
- F32 app_angle = ll_round((F32) atan2( mVO->getScale().mV[2]*2.f, drawablep->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
+ //number of segments only cares about z axis
+ F32 app_angle = ll_round((F32) atan2( mVO->getScale().mV[2]*2.f, drawablep->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
- // Rendering sections increases with visible angle on the screen
- mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView());
+ // Rendering sections increases with visible angle on the screen
+ mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView());
#endif
-
- mRenderRes = llclamp(mRenderRes, new_res-1, (S32) FLEXIBLE_OBJECT_MAX_SECTIONS);
-
- // Throttle back simulation of segments we're not rendering
- if (mRenderRes < new_res)
- {
- new_res = mRenderRes;
- }
-
- if (!mInitialized || (mSimulateRes != new_res))
- {
- mSimulateRes = new_res;
- setAttributesOfAllSections();
- mInitialized = TRUE;
- }
+
+ mRenderRes = llclamp(mRenderRes, new_res-1, (S32) FLEXIBLE_OBJECT_MAX_SECTIONS);
+
+ // Throttle back simulation of segments we're not rendering
+ if (mRenderRes < new_res)
+ {
+ new_res = mRenderRes;
+ }
+
+ if (!mInitialized || (mSimulateRes != new_res))
+ {
+ mSimulateRes = new_res;
+ setAttributesOfAllSections();
+ mInitialized = TRUE;
+ }
}
//---------------------------------------------------------------------------------
// This calculates the physics of the flexible object. Note that it has to be 0
-// updated every time step. In the future, perhaps there could be an
-// optimization similar to what Havok does for objects that are stationary.
+// updated every time step. In the future, perhaps there could be an
+// optimization similar to what Havok does for objects that are stationary.
//---------------------------------------------------------------------------------
void LLVolumeImplFlexible::doIdleUpdate()
{
- LLDrawable* drawablep = mVO->mDrawable;
-
- if (drawablep)
- {
- //ensure drawable is active
- drawablep->makeActive();
-
- if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE))
- {
- bool visible = drawablep->isVisible();
-
- if (mRenderRes == -1)
- {
- updateRenderRes();
- gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION);
- }
- else
- {
- F32 pixel_area = mVO->getPixelArea();
-
- // Note: Flexies afar will be rarely updated, closer ones will be updated more frequently.
- // But frequency differences are extremely noticeable, so consider modifying update factor,
- // or at least clamping value a bit more from both sides.
- U32 update_period = (U32) (llmax((S32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f))),0)+1);
- // MAINT-1890 Clamp the update period to ensure that the update_period is no greater than 32 frames
- update_period = llclamp(update_period, 1U, 32U);
-
- // We control how fast flexies update, buy splitting updates among frames
- U64 virtual_frame_num = LLTimer::getElapsedSeconds() / SEC_PER_FLEXI_FRAME;
-
- if (visible)
- {
- if (!drawablep->isState(LLDrawable::IN_REBUILD_Q) &&
- pixel_area > 256.f)
- {
- U32 id;
- if (mVO->isRootEdit())
- {
- id = mID;
- }
- else
- {
- LLVOVolume* parent = (LLVOVolume*)mVO->getParent();
- id = parent->getVolumeInterfaceID();
- }
-
-
- // Throttle flexies and spread load by preventing flexies from updating in same frame
- // Shows how many frames we need to wait before next update
- U64 throttling_delay = (virtual_frame_num + id) % update_period;
-
- if ((throttling_delay == 0 && mLastFrameNum < virtual_frame_num) //one or more virtual frames per frame
- || (mLastFrameNum + update_period < virtual_frame_num) // missed virtual frame
- || mLastFrameNum > virtual_frame_num) // overflow
- {
- // We need mLastFrameNum to compensate for 'unreliable time' and to filter 'duplicate' frames
- // If happened too late, subtract throttling_delay (it is zero otherwise)
- mLastFrameNum = virtual_frame_num - throttling_delay;
-
- // Store update period for updateClass()
- // Note: Consider substituting update_period with mLastUpdatePeriod everywhere.
- mLastUpdatePeriod = update_period;
-
- updateRenderRes();
+ LLDrawable* drawablep = mVO->mDrawable;
+
+ if (drawablep)
+ {
+ //ensure drawable is active
+ drawablep->makeActive();
+
+ if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE))
+ {
+ bool visible = drawablep->isVisible();
+
+ if (mRenderRes == -1)
+ {
+ updateRenderRes();
+ gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION);
+ }
+ else
+ {
+ F32 pixel_area = mVO->getPixelArea();
+
+ // Note: Flexies afar will be rarely updated, closer ones will be updated more frequently.
+ // But frequency differences are extremely noticeable, so consider modifying update factor,
+ // or at least clamping value a bit more from both sides.
+ U32 update_period = (U32) (llmax((S32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f))),0)+1);
+ // MAINT-1890 Clamp the update period to ensure that the update_period is no greater than 32 frames
+ update_period = llclamp(update_period, 1U, 32U);
+
+ // We control how fast flexies update, buy splitting updates among frames
+ U64 virtual_frame_num = LLTimer::getElapsedSeconds() / SEC_PER_FLEXI_FRAME;
+
+ if (visible)
+ {
+ if (!drawablep->isState(LLDrawable::IN_REBUILD_Q) &&
+ pixel_area > 256.f)
+ {
+ U32 id;
+ if (mVO->isRootEdit())
+ {
+ id = mID;
+ }
+ else
+ {
+ LLVOVolume* parent = (LLVOVolume*)mVO->getParent();
+ id = parent->getVolumeInterfaceID();
+ }
+
+
+ // Throttle flexies and spread load by preventing flexies from updating in same frame
+ // Shows how many frames we need to wait before next update
+ U64 throttling_delay = (virtual_frame_num + id) % update_period;
+
+ if ((throttling_delay == 0 && mLastFrameNum < virtual_frame_num) //one or more virtual frames per frame
+ || (mLastFrameNum + update_period < virtual_frame_num) // missed virtual frame
+ || mLastFrameNum > virtual_frame_num) // overflow
+ {
+ // We need mLastFrameNum to compensate for 'unreliable time' and to filter 'duplicate' frames
+ // If happened too late, subtract throttling_delay (it is zero otherwise)
+ mLastFrameNum = virtual_frame_num - throttling_delay;
+
+ // Store update period for updateClass()
+ // Note: Consider substituting update_period with mLastUpdatePeriod everywhere.
+ mLastUpdatePeriod = update_period;
+
+ updateRenderRes();
mVO->shrinkWrap();
- gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION);
- }
- }
- }
- else
- {
- mLastFrameNum = virtual_frame_num;
- mLastUpdatePeriod = update_period;
- }
- }
-
- }
- }
+ gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION);
+ }
+ }
+ }
+ else
+ {
+ mLastFrameNum = virtual_frame_num;
+ mLastUpdatePeriod = update_period;
+ }
+ }
+
+ }
+ }
}
inline S32 log2(S32 x)
{
- S32 ret = 0;
- while (x > 1)
- {
- ++ret;
- x >>= 1;
- }
- return ret;
+ S32 ret = 0;
+ while (x > 1)
+ {
+ ++ret;
+ x >>= 1;
+ }
+ return ret;
}
void LLVolumeImplFlexible::doFlexibleUpdate()
{
LL_PROFILE_ZONE_SCOPED;
- LLVolume* volume = mVO->getVolume();
- LLPath *path = &volume->getPath();
- if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible())
- {
- BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE;
- doIdleUpdate();
-
- if (!force_update || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE))
- {
- return; // we did not get updated or initialized, proceeding without can be dangerous
- }
- }
-
- if(!mInitialized || !mAttributes)
- {
- //the object is not visible
- return ;
- }
-
- // Fix for MAINT-1894
- // Skipping the flexible update if render res is negative. If we were to continue with a negative value,
- // the subsequent S32 num_render_sections = 1<<mRenderRes; code will specify a really large number of
- // render sections which will then create a length exception in the std::vector::resize() method.
- if (mRenderRes < 0)
- {
- return;
- }
-
- S32 num_sections = 1 << mSimulateRes;
+ LLVolume* volume = mVO->getVolume();
+ LLPath *path = &volume->getPath();
+ if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible())
+ {
+ BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE;
+ doIdleUpdate();
+
+ if (!force_update || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE))
+ {
+ return; // we did not get updated or initialized, proceeding without can be dangerous
+ }
+ }
+
+ if(!mInitialized || !mAttributes)
+ {
+ //the object is not visible
+ return ;
+ }
+
+ // Fix for MAINT-1894
+ // Skipping the flexible update if render res is negative. If we were to continue with a negative value,
+ // the subsequent S32 num_render_sections = 1<<mRenderRes; code will specify a really large number of
+ // render sections which will then create a length exception in the std::vector::resize() method.
+ if (mRenderRes < 0)
+ {
+ return;
+ }
+
+ S32 num_sections = 1 << mSimulateRes;
F32 secondsThisFrame = mTimer.getElapsedTimeAndResetF32();
- if (secondsThisFrame > 0.2f)
- {
- secondsThisFrame = 0.2f;
- }
-
- LLVector3 BasePosition = getFramePosition();
- LLQuaternion BaseRotation = getFrameRotation();
- LLQuaternion parentSegmentRotation = BaseRotation;
- LLVector3 anchorDirectionRotated = LLVector3::z_axis * parentSegmentRotation;
- LLVector3 anchorScale = mVO->mDrawable->getScale();
-
- F32 section_length = anchorScale.mV[VZ] / (F32)num_sections;
- F32 inv_section_length = 1.f / section_length;
-
- S32 i;
-
- // ANCHOR position is offset from BASE position (centroid) by half the length
- LLVector3 AnchorPosition = BasePosition - (anchorScale.mV[VZ]/2 * anchorDirectionRotated);
-
- mSection[0].mPosition = AnchorPosition;
- mSection[0].mDirection = anchorDirectionRotated;
- mSection[0].mRotation = BaseRotation;
-
- LLQuaternion deltaRotation;
-
- LLVector3 lastPosition;
-
- // Coefficients which are constant across sections
- F32 t_factor = mAttributes->getTension() * 0.1f;
- t_factor = t_factor*(1 - pow(0.85f, secondsThisFrame*30));
- if ( t_factor > FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE )
- {
- t_factor = FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE;
- }
-
- F32 friction_coeff = (mAttributes->getAirFriction()*2+1);
- friction_coeff = pow(10.f, friction_coeff*secondsThisFrame);
- friction_coeff = (friction_coeff > 1) ? friction_coeff : 1;
- F32 momentum = 1.0f / friction_coeff;
-
- F32 wind_factor = (mAttributes->getWindSensitivity()*0.1f) * section_length * secondsThisFrame;
- F32 max_angle = atan(section_length*2.f);
-
- F32 force_factor = section_length * secondsThisFrame;
-
- // Update simulated sections
- for (i=1; i<=num_sections; ++i)
- {
- LLVector3 parentSectionVector;
- LLVector3 parentSectionPosition;
- LLVector3 parentDirection;
-
- //---------------------------------------------------
- // save value of position as lastPosition
- //---------------------------------------------------
- lastPosition = mSection[i].mPosition;
-
- //------------------------------------------------------------------------------------------
- // gravity
- //------------------------------------------------------------------------------------------
- mSection[i].mPosition.mV[2] -= mAttributes->getGravity() * force_factor;
-
- //------------------------------------------------------------------------------------------
- // wind force
- //------------------------------------------------------------------------------------------
- if (mAttributes->getWindSensitivity() > 0.001f)
- {
- mSection[i].mPosition += gAgent.getRegion()->mWind.getVelocity( mSection[i].mPosition ) * wind_factor;
- }
-
- //------------------------------------------------------------------------------------------
- // user-defined force
- //------------------------------------------------------------------------------------------
- mSection[i].mPosition += mAttributes->getUserForce() * force_factor;
-
- //---------------------------------------------------
- // tension (rigidity, stiffness)
- //---------------------------------------------------
- parentSectionPosition = mSection[i-1].mPosition;
- parentDirection = mSection[i-1].mDirection;
-
- if ( i == 1 )
- {
- parentSectionVector = mSection[0].mDirection;
- }
- else
- {
- parentSectionVector = mSection[i-2].mDirection;
- }
-
- LLVector3 currentVector = mSection[i].mPosition - parentSectionPosition;
-
- LLVector3 difference = (parentSectionVector*section_length) - currentVector;
- LLVector3 tensionForce = difference * t_factor;
-
- mSection[i].mPosition += tensionForce;
-
- //------------------------------------------------------------------------------------------
- // sphere collision, currently not used
- //------------------------------------------------------------------------------------------
- /*if ( mAttributes->mUsingCollisionSphere )
- {
- LLVector3 vectorToCenterOfCollisionSphere = mCollisionSpherePosition - mSection[i].mPosition;
- if ( vectorToCenterOfCollisionSphere.magVecSquared() < mCollisionSphereRadius * mCollisionSphereRadius )
- {
- F32 distanceToCenterOfCollisionSphere = vectorToCenterOfCollisionSphere.magVec();
- F32 penetration = mCollisionSphereRadius - distanceToCenterOfCollisionSphere;
-
- LLVector3 normalToCenterOfCollisionSphere;
-
- if ( distanceToCenterOfCollisionSphere > 0.0f )
- {
- normalToCenterOfCollisionSphere = vectorToCenterOfCollisionSphere / distanceToCenterOfCollisionSphere;
- }
- else // rare
- {
- normalToCenterOfCollisionSphere = LLVector3::x_axis; // arbitrary
- }
-
- // push the position out to the surface of the collision sphere
- mSection[i].mPosition -= normalToCenterOfCollisionSphere * penetration;
- }
- }*/
-
- //------------------------------------------------------------------------------------------
- // inertia
- //------------------------------------------------------------------------------------------
- mSection[i].mPosition += mSection[i].mVelocity * momentum;
-
- //------------------------------------------------------------------------------------------
- // clamp length & rotation
- //------------------------------------------------------------------------------------------
- mSection[i].mDirection = mSection[i].mPosition - parentSectionPosition;
- mSection[i].mDirection.normVec();
- deltaRotation.shortestArc( parentDirection, mSection[i].mDirection );
-
- F32 angle;
- LLVector3 axis;
- deltaRotation.getAngleAxis(&angle, axis);
- if (angle > F_PI) angle -= 2.f*F_PI;
- if (angle < -F_PI) angle += 2.f*F_PI;
- if (angle > max_angle)
- {
- //angle = 0.5f*(angle+max_angle);
- deltaRotation.setQuat(max_angle, axis);
- } else if (angle < -max_angle)
- {
- //angle = 0.5f*(angle-max_angle);
- deltaRotation.setQuat(-max_angle, axis);
- }
- LLQuaternion segment_rotation = parentSegmentRotation * deltaRotation;
- parentSegmentRotation = segment_rotation;
-
- mSection[i].mDirection = (parentDirection * deltaRotation);
- mSection[i].mPosition = parentSectionPosition + mSection[i].mDirection * section_length;
- mSection[i].mRotation = segment_rotation;
-
- if (i > 1)
- {
- // Propogate half the rotation up to the parent
- LLQuaternion halfDeltaRotation(angle/2, axis);
- mSection[i-1].mRotation = mSection[i-1].mRotation * halfDeltaRotation;
- }
-
- //------------------------------------------------------------------------------------------
- // calculate velocity
- //------------------------------------------------------------------------------------------
- mSection[i].mVelocity = mSection[i].mPosition - lastPosition;
- if (mSection[i].mVelocity.magVecSquared() > 1.f)
- {
- mSection[i].mVelocity.normVec();
- }
- }
-
- // Calculate derivatives (not necessary until normals are automagically generated)
- mSection[0].mdPosition = (mSection[1].mPosition - mSection[0].mPosition) * inv_section_length;
- // i = 1..NumSections-1
- for (i=1; i<num_sections; ++i)
- {
- // Quadratic numerical derivative of position
-
- // f(-L1) = aL1^2 - bL1 + c = f1
- // f(0) = c = f2
- // f(L2) = aL2^2 + bL2 + c = f3
- // f = ax^2 + bx + c
- // d/dx f = 2ax + b
- // d/dx f(0) = b
-
- // c = f2
- // a = [(f1-c)/L1 + (f3-c)/L2] / (L1+L2)
- // b = (f3-c-aL2^2)/L2
-
- LLVector3 a = (mSection[i-1].mPosition-mSection[i].mPosition +
- mSection[i+1].mPosition-mSection[i].mPosition) * 0.5f * inv_section_length * inv_section_length;
- LLVector3 b = (mSection[i+1].mPosition-mSection[i].mPosition - a*(section_length*section_length));
- b *= inv_section_length;
-
- mSection[i].mdPosition = b;
- }
-
- // i = NumSections
- mSection[i].mdPosition = (mSection[i].mPosition - mSection[i-1].mPosition) * inv_section_length;
-
- // Create points
- llassert(mRenderRes > -1);
- S32 num_render_sections = 1<<mRenderRes;
- if (path->getPathLength() != num_render_sections+1)
- {
- ((LLVOVolume*) mVO)->mVolumeChanged = TRUE;
- volume->resizePath(num_render_sections+1);
- }
-
- LLPath::PathPt *new_point;
-
- LLFlexibleObjectSection newSection[ (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1 ];
- remapSections(mSection, mSimulateRes, newSection, mRenderRes);
-
- //generate transform from global to prim space
- LLVector3 delta_scale = LLVector3(1,1,1);
- LLVector3 delta_pos;
- LLQuaternion delta_rot;
-
- delta_rot = ~getFrameRotation();
- delta_pos = -getFramePosition()*delta_rot;
-
- // Vertex transform (4x4)
- LLVector3 x_axis = LLVector3(delta_scale.mV[VX], 0.f, 0.f) * delta_rot;
- LLVector3 y_axis = LLVector3(0.f, delta_scale.mV[VY], 0.f) * delta_rot;
- LLVector3 z_axis = LLVector3(0.f, 0.f, delta_scale.mV[VZ]) * delta_rot;
-
- LLMatrix4 rel_xform;
- rel_xform.initRows(LLVector4(x_axis, 0.f),
- LLVector4(y_axis, 0.f),
- LLVector4(z_axis, 0.f),
- LLVector4(delta_pos, 1.f));
-
- LL_CHECK_MEMORY
- for (i=0; i<=num_render_sections; ++i)
- {
- new_point = &path->mPath[i];
- LLVector3 pos = newSection[i].mPosition * rel_xform;
- LLQuaternion rot = mSection[i].mAxisRotation * newSection[i].mRotation * delta_rot;
-
- LLVector3 np(new_point->mPos.getF32ptr());
-
- if (!mUpdated || (np-pos).magVec()/mVO->mDrawable->mDistanceWRTCamera > 0.001f)
- {
- new_point->mPos.load3((newSection[i].mPosition * rel_xform).mV);
- mUpdated = FALSE;
- }
-
- new_point->mRot.loadu(LLMatrix3(rot));
- new_point->mScale.set(newSection[i].mScale.mV[0], newSection[i].mScale.mV[1], 0,1);
- new_point->mTexT = ((F32)i)/(num_render_sections);
- }
- LL_CHECK_MEMORY
- mLastSegmentRotation = parentSegmentRotation;
+ if (secondsThisFrame > 0.2f)
+ {
+ secondsThisFrame = 0.2f;
+ }
+
+ LLVector3 BasePosition = getFramePosition();
+ LLQuaternion BaseRotation = getFrameRotation();
+ LLQuaternion parentSegmentRotation = BaseRotation;
+ LLVector3 anchorDirectionRotated = LLVector3::z_axis * parentSegmentRotation;
+ LLVector3 anchorScale = mVO->mDrawable->getScale();
+
+ F32 section_length = anchorScale.mV[VZ] / (F32)num_sections;
+ F32 inv_section_length = 1.f / section_length;
+
+ S32 i;
+
+ // ANCHOR position is offset from BASE position (centroid) by half the length
+ LLVector3 AnchorPosition = BasePosition - (anchorScale.mV[VZ]/2 * anchorDirectionRotated);
+
+ mSection[0].mPosition = AnchorPosition;
+ mSection[0].mDirection = anchorDirectionRotated;
+ mSection[0].mRotation = BaseRotation;
+
+ LLQuaternion deltaRotation;
+
+ LLVector3 lastPosition;
+
+ // Coefficients which are constant across sections
+ F32 t_factor = mAttributes->getTension() * 0.1f;
+ t_factor = t_factor*(1 - pow(0.85f, secondsThisFrame*30));
+ if ( t_factor > FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE )
+ {
+ t_factor = FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE;
+ }
+
+ F32 friction_coeff = (mAttributes->getAirFriction()*2+1);
+ friction_coeff = pow(10.f, friction_coeff*secondsThisFrame);
+ friction_coeff = (friction_coeff > 1) ? friction_coeff : 1;
+ F32 momentum = 1.0f / friction_coeff;
+
+ F32 wind_factor = (mAttributes->getWindSensitivity()*0.1f) * section_length * secondsThisFrame;
+ F32 max_angle = atan(section_length*2.f);
+
+ F32 force_factor = section_length * secondsThisFrame;
+
+ // Update simulated sections
+ for (i=1; i<=num_sections; ++i)
+ {
+ LLVector3 parentSectionVector;
+ LLVector3 parentSectionPosition;
+ LLVector3 parentDirection;
+
+ //---------------------------------------------------
+ // save value of position as lastPosition
+ //---------------------------------------------------
+ lastPosition = mSection[i].mPosition;
+
+ //------------------------------------------------------------------------------------------
+ // gravity
+ //------------------------------------------------------------------------------------------
+ mSection[i].mPosition.mV[2] -= mAttributes->getGravity() * force_factor;
+
+ //------------------------------------------------------------------------------------------
+ // wind force
+ //------------------------------------------------------------------------------------------
+ if (mAttributes->getWindSensitivity() > 0.001f)
+ {
+ mSection[i].mPosition += gAgent.getRegion()->mWind.getVelocity( mSection[i].mPosition ) * wind_factor;
+ }
+
+ //------------------------------------------------------------------------------------------
+ // user-defined force
+ //------------------------------------------------------------------------------------------
+ mSection[i].mPosition += mAttributes->getUserForce() * force_factor;
+
+ //---------------------------------------------------
+ // tension (rigidity, stiffness)
+ //---------------------------------------------------
+ parentSectionPosition = mSection[i-1].mPosition;
+ parentDirection = mSection[i-1].mDirection;
+
+ if ( i == 1 )
+ {
+ parentSectionVector = mSection[0].mDirection;
+ }
+ else
+ {
+ parentSectionVector = mSection[i-2].mDirection;
+ }
+
+ LLVector3 currentVector = mSection[i].mPosition - parentSectionPosition;
+
+ LLVector3 difference = (parentSectionVector*section_length) - currentVector;
+ LLVector3 tensionForce = difference * t_factor;
+
+ mSection[i].mPosition += tensionForce;
+
+ //------------------------------------------------------------------------------------------
+ // sphere collision, currently not used
+ //------------------------------------------------------------------------------------------
+ /*if ( mAttributes->mUsingCollisionSphere )
+ {
+ LLVector3 vectorToCenterOfCollisionSphere = mCollisionSpherePosition - mSection[i].mPosition;
+ if ( vectorToCenterOfCollisionSphere.magVecSquared() < mCollisionSphereRadius * mCollisionSphereRadius )
+ {
+ F32 distanceToCenterOfCollisionSphere = vectorToCenterOfCollisionSphere.magVec();
+ F32 penetration = mCollisionSphereRadius - distanceToCenterOfCollisionSphere;
+
+ LLVector3 normalToCenterOfCollisionSphere;
+
+ if ( distanceToCenterOfCollisionSphere > 0.0f )
+ {
+ normalToCenterOfCollisionSphere = vectorToCenterOfCollisionSphere / distanceToCenterOfCollisionSphere;
+ }
+ else // rare
+ {
+ normalToCenterOfCollisionSphere = LLVector3::x_axis; // arbitrary
+ }
+
+ // push the position out to the surface of the collision sphere
+ mSection[i].mPosition -= normalToCenterOfCollisionSphere * penetration;
+ }
+ }*/
+
+ //------------------------------------------------------------------------------------------
+ // inertia
+ //------------------------------------------------------------------------------------------
+ mSection[i].mPosition += mSection[i].mVelocity * momentum;
+
+ //------------------------------------------------------------------------------------------
+ // clamp length & rotation
+ //------------------------------------------------------------------------------------------
+ mSection[i].mDirection = mSection[i].mPosition - parentSectionPosition;
+ mSection[i].mDirection.normVec();
+ deltaRotation.shortestArc( parentDirection, mSection[i].mDirection );
+
+ F32 angle;
+ LLVector3 axis;
+ deltaRotation.getAngleAxis(&angle, axis);
+ if (angle > F_PI) angle -= 2.f*F_PI;
+ if (angle < -F_PI) angle += 2.f*F_PI;
+ if (angle > max_angle)
+ {
+ //angle = 0.5f*(angle+max_angle);
+ deltaRotation.setQuat(max_angle, axis);
+ } else if (angle < -max_angle)
+ {
+ //angle = 0.5f*(angle-max_angle);
+ deltaRotation.setQuat(-max_angle, axis);
+ }
+ LLQuaternion segment_rotation = parentSegmentRotation * deltaRotation;
+ parentSegmentRotation = segment_rotation;
+
+ mSection[i].mDirection = (parentDirection * deltaRotation);
+ mSection[i].mPosition = parentSectionPosition + mSection[i].mDirection * section_length;
+ mSection[i].mRotation = segment_rotation;
+
+ if (i > 1)
+ {
+ // Propogate half the rotation up to the parent
+ LLQuaternion halfDeltaRotation(angle/2, axis);
+ mSection[i-1].mRotation = mSection[i-1].mRotation * halfDeltaRotation;
+ }
+
+ //------------------------------------------------------------------------------------------
+ // calculate velocity
+ //------------------------------------------------------------------------------------------
+ mSection[i].mVelocity = mSection[i].mPosition - lastPosition;
+ if (mSection[i].mVelocity.magVecSquared() > 1.f)
+ {
+ mSection[i].mVelocity.normVec();
+ }
+ }
+
+ // Calculate derivatives (not necessary until normals are automagically generated)
+ mSection[0].mdPosition = (mSection[1].mPosition - mSection[0].mPosition) * inv_section_length;
+ // i = 1..NumSections-1
+ for (i=1; i<num_sections; ++i)
+ {
+ // Quadratic numerical derivative of position
+
+ // f(-L1) = aL1^2 - bL1 + c = f1
+ // f(0) = c = f2
+ // f(L2) = aL2^2 + bL2 + c = f3
+ // f = ax^2 + bx + c
+ // d/dx f = 2ax + b
+ // d/dx f(0) = b
+
+ // c = f2
+ // a = [(f1-c)/L1 + (f3-c)/L2] / (L1+L2)
+ // b = (f3-c-aL2^2)/L2
+
+ LLVector3 a = (mSection[i-1].mPosition-mSection[i].mPosition +
+ mSection[i+1].mPosition-mSection[i].mPosition) * 0.5f * inv_section_length * inv_section_length;
+ LLVector3 b = (mSection[i+1].mPosition-mSection[i].mPosition - a*(section_length*section_length));
+ b *= inv_section_length;
+
+ mSection[i].mdPosition = b;
+ }
+
+ // i = NumSections
+ mSection[i].mdPosition = (mSection[i].mPosition - mSection[i-1].mPosition) * inv_section_length;
+
+ // Create points
+ llassert(mRenderRes > -1);
+ S32 num_render_sections = 1<<mRenderRes;
+ if (path->getPathLength() != num_render_sections+1)
+ {
+ ((LLVOVolume*) mVO)->mVolumeChanged = TRUE;
+ volume->resizePath(num_render_sections+1);
+ }
+
+ LLPath::PathPt *new_point;
+
+ LLFlexibleObjectSection newSection[ (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1 ];
+ remapSections(mSection, mSimulateRes, newSection, mRenderRes);
+
+ //generate transform from global to prim space
+ LLVector3 delta_scale = LLVector3(1,1,1);
+ LLVector3 delta_pos;
+ LLQuaternion delta_rot;
+
+ delta_rot = ~getFrameRotation();
+ delta_pos = -getFramePosition()*delta_rot;
+
+ // Vertex transform (4x4)
+ LLVector3 x_axis = LLVector3(delta_scale.mV[VX], 0.f, 0.f) * delta_rot;
+ LLVector3 y_axis = LLVector3(0.f, delta_scale.mV[VY], 0.f) * delta_rot;
+ LLVector3 z_axis = LLVector3(0.f, 0.f, delta_scale.mV[VZ]) * delta_rot;
+
+ LLMatrix4 rel_xform;
+ rel_xform.initRows(LLVector4(x_axis, 0.f),
+ LLVector4(y_axis, 0.f),
+ LLVector4(z_axis, 0.f),
+ LLVector4(delta_pos, 1.f));
+
+ LL_CHECK_MEMORY
+ for (i=0; i<=num_render_sections; ++i)
+ {
+ new_point = &path->mPath[i];
+ LLVector3 pos = newSection[i].mPosition * rel_xform;
+ LLQuaternion rot = mSection[i].mAxisRotation * newSection[i].mRotation * delta_rot;
+
+ LLVector3 np(new_point->mPos.getF32ptr());
+
+ if (!mUpdated || (np-pos).magVec()/mVO->mDrawable->mDistanceWRTCamera > 0.001f)
+ {
+ new_point->mPos.load3((newSection[i].mPosition * rel_xform).mV);
+ mUpdated = FALSE;
+ }
+
+ new_point->mRot.loadu(LLMatrix3(rot));
+ new_point->mScale.set(newSection[i].mScale.mV[0], newSection[i].mScale.mV[1], 0,1);
+ new_point->mTexT = ((F32)i)/(num_render_sections);
+ }
+ LL_CHECK_MEMORY
+ mLastSegmentRotation = parentSegmentRotation;
}
void LLVolumeImplFlexible::preRebuild()
{
- if (!mUpdated)
- {
+ if (!mUpdated)
+ {
LL_PROFILE_ZONE_SCOPED;
- doFlexibleRebuild(false);
- }
+ doFlexibleRebuild(false);
+ }
}
void LLVolumeImplFlexible::doFlexibleRebuild(bool rebuild_volume)
{
- LLVolume* volume = mVO->getVolume();
+ LLVolume* volume = mVO->getVolume();
if (volume)
{
if (rebuild_volume)
@@ -740,103 +740,103 @@ void LLVolumeImplFlexible::doFlexibleRebuild(bool rebuild_volume)
}
volume->regen();
}
-
- mUpdated = TRUE;
+
+ mUpdated = TRUE;
}
//------------------------------------------------------------------
void LLVolumeImplFlexible::onSetScale(const LLVector3& scale, BOOL damped)
{
- setAttributesOfAllSections((LLVector3*) &scale);
+ setAttributesOfAllSections((LLVector3*) &scale);
}
BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
{
LL_PROFILE_ZONE_SCOPED;
- LLVOVolume *volume = (LLVOVolume*)mVO;
-
- if (mVO->isAttachment())
- { //don't update flexible attachments for impostored avatars unless the
- //impostor is being updated this frame (w00!)
- LLViewerObject* parent = (LLViewerObject*) mVO->getParent();
- while (parent && !parent->isAvatar())
- {
- parent = (LLViewerObject*) parent->getParent();
- }
-
- if (parent)
- {
- LLVOAvatar* avatar = (LLVOAvatar*) parent;
- if (avatar->isImpostor() && !avatar->needsImpostorUpdate())
- {
- return TRUE;
- }
- }
- }
-
- if (volume->mDrawable.isNull())
- {
- return TRUE; // No update to complete
- }
-
- if (volume->mLODChanged)
- {
- LLVolumeParams volume_params = volume->getVolume()->getParams();
- volume->setVolume(volume_params, 0);
- mUpdated = FALSE;
- }
-
- volume->updateRelativeXform();
-
- doFlexibleUpdate();
-
- // Object may have been rotated, which means it needs a rebuild. See SL-47220
- BOOL rotated = FALSE;
- LLQuaternion cur_rotation = getFrameRotation();
- if ( cur_rotation != mLastFrameRotation )
- {
- mLastFrameRotation = cur_rotation;
- rotated = TRUE;
- }
-
- if (volume->mLODChanged || volume->mFaceMappingChanged ||
- volume->mVolumeChanged || drawable->isState(LLDrawable::REBUILD_MATERIAL))
- {
- volume->regenFaces();
- volume->mDrawable->setState(LLDrawable::REBUILD_VOLUME);
- volume->dirtySpatialGroup();
- {
- doFlexibleRebuild(volume->mVolumeChanged);
- }
- volume->genBBoxes(isVolumeGlobal());
- }
- else if (!mUpdated || rotated)
- {
- volume->mDrawable->setState(LLDrawable::REBUILD_POSITION);
- LLSpatialGroup* group = volume->mDrawable->getSpatialGroup();
- if (group)
- {
- group->dirtyMesh();
- }
- volume->genBBoxes(isVolumeGlobal());
- }
-
- volume->mVolumeChanged = FALSE;
- volume->mLODChanged = FALSE;
- volume->mFaceMappingChanged = FALSE;
-
- // clear UV flag
- drawable->clearState(LLDrawable::UV);
-
- return TRUE;
+ LLVOVolume *volume = (LLVOVolume*)mVO;
+
+ if (mVO->isAttachment())
+ { //don't update flexible attachments for impostored avatars unless the
+ //impostor is being updated this frame (w00!)
+ LLViewerObject* parent = (LLViewerObject*) mVO->getParent();
+ while (parent && !parent->isAvatar())
+ {
+ parent = (LLViewerObject*) parent->getParent();
+ }
+
+ if (parent)
+ {
+ LLVOAvatar* avatar = (LLVOAvatar*) parent;
+ if (avatar->isImpostor() && !avatar->needsImpostorUpdate())
+ {
+ return TRUE;
+ }
+ }
+ }
+
+ if (volume->mDrawable.isNull())
+ {
+ return TRUE; // No update to complete
+ }
+
+ if (volume->mLODChanged)
+ {
+ LLVolumeParams volume_params = volume->getVolume()->getParams();
+ volume->setVolume(volume_params, 0);
+ mUpdated = FALSE;
+ }
+
+ volume->updateRelativeXform();
+
+ doFlexibleUpdate();
+
+ // Object may have been rotated, which means it needs a rebuild. See SL-47220
+ BOOL rotated = FALSE;
+ LLQuaternion cur_rotation = getFrameRotation();
+ if ( cur_rotation != mLastFrameRotation )
+ {
+ mLastFrameRotation = cur_rotation;
+ rotated = TRUE;
+ }
+
+ if (volume->mLODChanged || volume->mFaceMappingChanged ||
+ volume->mVolumeChanged || drawable->isState(LLDrawable::REBUILD_MATERIAL))
+ {
+ volume->regenFaces();
+ volume->mDrawable->setState(LLDrawable::REBUILD_VOLUME);
+ volume->dirtySpatialGroup();
+ {
+ doFlexibleRebuild(volume->mVolumeChanged);
+ }
+ volume->genBBoxes(isVolumeGlobal());
+ }
+ else if (!mUpdated || rotated)
+ {
+ volume->mDrawable->setState(LLDrawable::REBUILD_POSITION);
+ LLSpatialGroup* group = volume->mDrawable->getSpatialGroup();
+ if (group)
+ {
+ group->dirtyMesh();
+ }
+ volume->genBBoxes(isVolumeGlobal());
+ }
+
+ volume->mVolumeChanged = FALSE;
+ volume->mLODChanged = FALSE;
+ volume->mFaceMappingChanged = FALSE;
+
+ // clear UV flag
+ drawable->clearState(LLDrawable::UV);
+
+ return TRUE;
}
//----------------------------------------------------------------------------------
void LLVolumeImplFlexible::setCollisionSphere( LLVector3 p, F32 r )
{
- mCollisionSpherePosition = p;
- mCollisionSphereRadius = r;
+ mCollisionSpherePosition = p;
+ mCollisionSphereRadius = r;
}//------------------------------------------------------------------
@@ -855,8 +855,8 @@ void LLVolumeImplFlexible::setRenderingCollisionSphere( bool r )
//------------------------------------------------------------------
LLVector3 LLVolumeImplFlexible::getEndPosition()
{
- S32 num_sections = 1 << mAttributes->getSimulateLOD();
- return mSection[ num_sections ].mPosition;
+ S32 num_sections = 1 << mAttributes->getSimulateLOD();
+ return mSection[ num_sections ].mPosition;
}//------------------------------------------------------------------
@@ -864,33 +864,33 @@ LLVector3 LLVolumeImplFlexible::getEndPosition()
//------------------------------------------------------------------
LLVector3 LLVolumeImplFlexible::getNodePosition( int nodeIndex )
{
- S32 num_sections = 1 << mAttributes->getSimulateLOD();
- if ( nodeIndex > num_sections - 1 )
- {
- nodeIndex = num_sections - 1;
- }
- else if ( nodeIndex < 0 )
- {
- nodeIndex = 0;
- }
-
- return mSection[ nodeIndex ].mPosition;
+ S32 num_sections = 1 << mAttributes->getSimulateLOD();
+ if ( nodeIndex > num_sections - 1 )
+ {
+ nodeIndex = num_sections - 1;
+ }
+ else if ( nodeIndex < 0 )
+ {
+ nodeIndex = 0;
+ }
+
+ return mSection[ nodeIndex ].mPosition;
}//------------------------------------------------------------------
LLVector3 LLVolumeImplFlexible::getPivotPosition() const
{
- return getAnchorPosition();
+ return getAnchorPosition();
}
//------------------------------------------------------------------
LLVector3 LLVolumeImplFlexible::getAnchorPosition() const
{
- LLVector3 BasePosition = getFramePosition();
- LLQuaternion parentSegmentRotation = getFrameRotation();
- LLVector3 anchorDirectionRotated = LLVector3::z_axis * parentSegmentRotation;
- LLVector3 anchorScale = mVO->mDrawable->getScale();
- return BasePosition - (anchorScale.mV[VZ]/2 * anchorDirectionRotated);
+ LLVector3 BasePosition = getFramePosition();
+ LLQuaternion parentSegmentRotation = getFrameRotation();
+ LLVector3 anchorDirectionRotated = LLVector3::z_axis * parentSegmentRotation;
+ LLVector3 anchorScale = mVO->mDrawable->getScale();
+ return BasePosition - (anchorScale.mV[VZ]/2 * anchorDirectionRotated);
}//------------------------------------------------------------------
@@ -898,42 +898,42 @@ LLVector3 LLVolumeImplFlexible::getAnchorPosition() const
//------------------------------------------------------------------
LLQuaternion LLVolumeImplFlexible::getEndRotation()
{
- return mLastSegmentRotation;
+ return mLastSegmentRotation;
}//------------------------------------------------------------------
void LLVolumeImplFlexible::updateRelativeXform(bool force_identity)
{
- LLQuaternion delta_rot;
- LLVector3 delta_pos, delta_scale;
- LLVOVolume* vo = (LLVOVolume*) mVO;
-
- bool use_identity = vo->mDrawable->isSpatialRoot() || force_identity;
-
- //matrix from local space to parent relative/global space
- delta_rot = use_identity ? LLQuaternion() : vo->mDrawable->getRotation();
- delta_pos = use_identity ? LLVector3(0,0,0) : vo->mDrawable->getPosition();
- delta_scale = LLVector3(1,1,1);
-
- // Vertex transform (4x4)
- LLVector3 x_axis = LLVector3(delta_scale.mV[VX], 0.f, 0.f) * delta_rot;
- LLVector3 y_axis = LLVector3(0.f, delta_scale.mV[VY], 0.f) * delta_rot;
- LLVector3 z_axis = LLVector3(0.f, 0.f, delta_scale.mV[VZ]) * delta_rot;
-
- vo->mRelativeXform.initRows(LLVector4(x_axis, 0.f),
- LLVector4(y_axis, 0.f),
- LLVector4(z_axis, 0.f),
- LLVector4(delta_pos, 1.f));
-
- x_axis.normVec();
- y_axis.normVec();
- z_axis.normVec();
-
- vo->mRelativeXformInvTrans.setRows(x_axis, y_axis, z_axis);
+ LLQuaternion delta_rot;
+ LLVector3 delta_pos, delta_scale;
+ LLVOVolume* vo = (LLVOVolume*) mVO;
+
+ bool use_identity = vo->mDrawable->isSpatialRoot() || force_identity;
+
+ //matrix from local space to parent relative/global space
+ delta_rot = use_identity ? LLQuaternion() : vo->mDrawable->getRotation();
+ delta_pos = use_identity ? LLVector3(0,0,0) : vo->mDrawable->getPosition();
+ delta_scale = LLVector3(1,1,1);
+
+ // Vertex transform (4x4)
+ LLVector3 x_axis = LLVector3(delta_scale.mV[VX], 0.f, 0.f) * delta_rot;
+ LLVector3 y_axis = LLVector3(0.f, delta_scale.mV[VY], 0.f) * delta_rot;
+ LLVector3 z_axis = LLVector3(0.f, 0.f, delta_scale.mV[VZ]) * delta_rot;
+
+ vo->mRelativeXform.initRows(LLVector4(x_axis, 0.f),
+ LLVector4(y_axis, 0.f),
+ LLVector4(z_axis, 0.f),
+ LLVector4(delta_pos, 1.f));
+
+ x_axis.normVec();
+ y_axis.normVec();
+ z_axis.normVec();
+
+ vo->mRelativeXformInvTrans.setRows(x_axis, y_axis, z_axis);
}
const LLMatrix4& LLVolumeImplFlexible::getWorldMatrix(LLXformMatrix* xform) const
{
- return xform->getWorldMatrix();
+ return xform->getWorldMatrix();
}
diff --git a/indra/newview/llflexibleobject.h b/indra/newview/llflexibleobject.h
index 9383ab03ae..b4a8659c41 100644
--- a/indra/newview/llflexibleobject.h
+++ b/indra/newview/llflexibleobject.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llflexibleobject.h
* @author JJ Ventrella, Andrew Meadows, Tom Yedwab
* @brief Flexible object definition
@@ -6,32 +6,32 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/**
- * This is for specifying objects in the world that are animated and
+ * This is for specifying objects in the world that are animated and
* rendered locally - on the viewer. Flexible Objects are linear arrays
- * of positions, which stay at a fixed distance from each other. One
- * position is fixed as an "anchor" and is attached to some other object
- * in the world, determined by the server. All the other positions are
- * updated according to local physics.
+ * of positions, which stay at a fixed distance from each other. One
+ * position is fixed as an "anchor" and is attached to some other object
+ * in the world, determined by the server. All the other positions are
+ * updated according to local physics.
*/
#ifndef LL_LLFLEXIBLEOBJECT_H
@@ -42,113 +42,113 @@
#include "llwind.h"
// 10 ms for the whole thing!
-const F32 FLEXIBLE_OBJECT_TIMESLICE = 0.003f;
-const U32 FLEXIBLE_OBJECT_MAX_LOD = 10;
+const F32 FLEXIBLE_OBJECT_TIMESLICE = 0.003f;
+const U32 FLEXIBLE_OBJECT_MAX_LOD = 10;
-// See llprimitive.h for LLFlexibleObjectData and DEFAULT/MIN/MAX values
+// See llprimitive.h for LLFlexibleObjectData and DEFAULT/MIN/MAX values
//-------------------------------------------------------------------
struct LLFlexibleObjectSection
{
- // Input parameters
- LLVector2 mScale;
- LLQuaternion mAxisRotation;
- // Simulated state
- LLVector3 mPosition;
- LLVector3 mVelocity;
- LLVector3 mDirection;
- LLQuaternion mRotation;
- // Derivatives (Not all currently used, will come back with LLVolume changes to automagically generate normals)
- LLVector3 mdPosition;
- //LLMatrix4 mRotScale;
- //LLMatrix4 mdRotScale;
+ // Input parameters
+ LLVector2 mScale;
+ LLQuaternion mAxisRotation;
+ // Simulated state
+ LLVector3 mPosition;
+ LLVector3 mVelocity;
+ LLVector3 mDirection;
+ LLQuaternion mRotation;
+ // Derivatives (Not all currently used, will come back with LLVolume changes to automagically generate normals)
+ LLVector3 mdPosition;
+ //LLMatrix4 mRotScale;
+ //LLMatrix4 mdRotScale;
};
//---------------------------------------------------------
-// The LLVolumeImplFlexible class
+// The LLVolumeImplFlexible class
//---------------------------------------------------------
class LLVolumeImplFlexible : public LLVolumeInterface
{
private:
- static std::vector<LLVolumeImplFlexible*> sInstanceList;
- S32 mInstanceIndex;
-
- public:
- static void updateClass();
-
- LLVolumeImplFlexible(LLViewerObject* volume, LLFlexibleObjectData* attributes);
- ~LLVolumeImplFlexible();
-
- // Implements LLVolumeInterface
- U32 getID() const { return mID; }
- LLVector3 getFramePosition() const;
- LLQuaternion getFrameRotation() const;
- LLVolumeInterfaceType getInterfaceType() const { return INTERFACE_FLEXIBLE; }
- void updateRenderRes();
- void doIdleUpdate();
- BOOL doUpdateGeometry(LLDrawable *drawable);
- LLVector3 getPivotPosition() const;
- void onSetVolume(const LLVolumeParams &volume_params, const S32 detail);
- void onSetScale(const LLVector3 &scale, BOOL damped);
- void onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin);
- void onShift(const LLVector4a &shift_vector);
- bool isVolumeUnique() const { return true; }
- bool isVolumeGlobal() const { return true; }
- bool isActive() const { return true; }
- const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const;
- void updateRelativeXform(bool force_identity);
- void doFlexibleUpdate(); // Called to update the simulation
- void doFlexibleRebuild(bool rebuild_volume); // Called to rebuild the geometry
- void preRebuild();
-
- //void setAttributes( LLFlexibleObjectData );
- void setParentPositionAndRotationDirectly( LLVector3 p, LLQuaternion r );
- void setUsingCollisionSphere( bool u );
- void setCollisionSphere( LLVector3 position, F32 radius );
- void setRenderingCollisionSphere( bool r);
-
- LLVector3 getEndPosition();
- LLQuaternion getEndRotation();
- LLVector3 getNodePosition( int nodeIndex );
- LLVector3 getAnchorPosition() const;
-
- private:
- //--------------------------------------
- // private members
- //--------------------------------------
- // Backlink only; don't make this an LLPointer.
- LLViewerObject* mVO;
- LLTimer mTimer;
- LLVector3 mAnchorPosition;
- LLVector3 mParentPosition;
- LLQuaternion mParentRotation;
- LLQuaternion mLastFrameRotation;
- LLQuaternion mLastSegmentRotation;
- BOOL mInitialized;
- BOOL mUpdated;
- LLFlexibleObjectData* mAttributes;
- LLFlexibleObjectSection mSection [ (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1 ];
- S32 mInitializedRes;
- S32 mSimulateRes;
- S32 mRenderRes;
- U64 mLastFrameNum;
- U32 mLastUpdatePeriod;
- LLVector3 mCollisionSpherePosition;
- F32 mCollisionSphereRadius;
- U32 mID;
-
- //--------------------------------------
- // private methods
- //--------------------------------------
- void setAttributesOfAllSections (LLVector3* inScale = NULL);
-
- void remapSections(LLFlexibleObjectSection *source, S32 source_sections,
- LLFlexibleObjectSection *dest, S32 dest_sections);
-
+ static std::vector<LLVolumeImplFlexible*> sInstanceList;
+ S32 mInstanceIndex;
+
+ public:
+ static void updateClass();
+
+ LLVolumeImplFlexible(LLViewerObject* volume, LLFlexibleObjectData* attributes);
+ ~LLVolumeImplFlexible();
+
+ // Implements LLVolumeInterface
+ U32 getID() const { return mID; }
+ LLVector3 getFramePosition() const;
+ LLQuaternion getFrameRotation() const;
+ LLVolumeInterfaceType getInterfaceType() const { return INTERFACE_FLEXIBLE; }
+ void updateRenderRes();
+ void doIdleUpdate();
+ BOOL doUpdateGeometry(LLDrawable *drawable);
+ LLVector3 getPivotPosition() const;
+ void onSetVolume(const LLVolumeParams &volume_params, const S32 detail);
+ void onSetScale(const LLVector3 &scale, BOOL damped);
+ void onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin);
+ void onShift(const LLVector4a &shift_vector);
+ bool isVolumeUnique() const { return true; }
+ bool isVolumeGlobal() const { return true; }
+ bool isActive() const { return true; }
+ const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const;
+ void updateRelativeXform(bool force_identity);
+ void doFlexibleUpdate(); // Called to update the simulation
+ void doFlexibleRebuild(bool rebuild_volume); // Called to rebuild the geometry
+ void preRebuild();
+
+ //void setAttributes( LLFlexibleObjectData );
+ void setParentPositionAndRotationDirectly( LLVector3 p, LLQuaternion r );
+ void setUsingCollisionSphere( bool u );
+ void setCollisionSphere( LLVector3 position, F32 radius );
+ void setRenderingCollisionSphere( bool r);
+
+ LLVector3 getEndPosition();
+ LLQuaternion getEndRotation();
+ LLVector3 getNodePosition( int nodeIndex );
+ LLVector3 getAnchorPosition() const;
+
+ private:
+ //--------------------------------------
+ // private members
+ //--------------------------------------
+ // Backlink only; don't make this an LLPointer.
+ LLViewerObject* mVO;
+ LLTimer mTimer;
+ LLVector3 mAnchorPosition;
+ LLVector3 mParentPosition;
+ LLQuaternion mParentRotation;
+ LLQuaternion mLastFrameRotation;
+ LLQuaternion mLastSegmentRotation;
+ BOOL mInitialized;
+ BOOL mUpdated;
+ LLFlexibleObjectData* mAttributes;
+ LLFlexibleObjectSection mSection [ (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1 ];
+ S32 mInitializedRes;
+ S32 mSimulateRes;
+ S32 mRenderRes;
+ U64 mLastFrameNum;
+ U32 mLastUpdatePeriod;
+ LLVector3 mCollisionSpherePosition;
+ F32 mCollisionSphereRadius;
+ U32 mID;
+
+ //--------------------------------------
+ // private methods
+ //--------------------------------------
+ void setAttributesOfAllSections (LLVector3* inScale = NULL);
+
+ void remapSections(LLFlexibleObjectSection *source, S32 source_sections,
+ LLFlexibleObjectSection *dest, S32 dest_sections);
+
public:
- // Global setting for update rate
- static F32 sUpdateFactor;
+ // Global setting for update rate
+ static F32 sUpdateFactor;
};// end of class definition
diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp
index 2c638fa959..f3b924a306 100644
--- a/indra/newview/llfloater360capture.cpp
+++ b/indra/newview/llfloater360capture.cpp
@@ -83,7 +83,7 @@ LLFloater360Capture::~LLFloater360Capture()
// Normally LLFloater360Capture tells the Simulator send everything
// and now reverts to the regular "keyhole" frustum of interest
// list updates.
- if (!LLApp::isExiting() &&
+ if (!LLApp::isExiting() &&
gSavedSettings.getBOOL("360CaptureUseInterestListCap") &&
mStartILMode != gAgent.getInterestListMode())
{
@@ -578,7 +578,7 @@ void LLFloater360Capture::capture360Images()
LLViewerStats::instance().getRecording().resume();
LLAppViewer::instance()->resumeMainloopTimeout();
-
+
// update main loop timeout state
LLAppViewer::instance()->pingMainloopTimeout("LLFloater360Capture::capture360Images");
}
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 1fbd198019..ccedf84073 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterabout.cpp
* @author James Cook
* @brief The about box from Help->About
@@ -6,25 +6,25 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
#include "llviewerprecompiledheaders.h"
#include <iostream>
#include <fstream>
@@ -74,36 +74,36 @@ extern U32 gPacketsIn;
///----------------------------------------------------------------------------
/// Class LLFloaterAbout
///----------------------------------------------------------------------------
-class LLFloaterAbout
- : public LLFloater
+class LLFloaterAbout
+ : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
private:
- LLFloaterAbout(const LLSD& key);
- virtual ~LLFloaterAbout();
+ LLFloaterAbout(const LLSD& key);
+ virtual ~LLFloaterAbout();
public:
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /// Obtain the data used to fill out the contents string. This is
- /// separated so that we can programmatically access the same info.
- static LLSD getInfo();
- void onClickCopyToClipboard();
- void onClickUpdateCheck();
+ /// Obtain the data used to fill out the contents string. This is
+ /// separated so that we can programmatically access the same info.
+ static LLSD getInfo();
+ void onClickCopyToClipboard();
+ void onClickUpdateCheck();
static void setUpdateListener();
private:
- void setSupportText(const std::string& server_release_notes_url);
+ void setSupportText(const std::string& server_release_notes_url);
- // notifications for user requested checks
- static void showCheckUpdateNotification(S32 state);
+ // notifications for user requested checks
+ static void showCheckUpdateNotification(S32 state);
+
+ // callback method for manual checks
+ static bool callbackCheckUpdate(LLSD const & event);
- // callback method for manual checks
- static bool callbackCheckUpdate(LLSD const & event);
-
// listener name for update checks
static const std::string sCheckUpdateListenerName;
-
+
static void startFetchServerReleaseNotes();
static void fetchServerReleaseNotesCoro(const std::string& cap_url);
static void handleServerReleaseNotes(LLSD results);
@@ -111,10 +111,10 @@ private:
// Default constructor
-LLFloaterAbout::LLFloaterAbout(const LLSD& key)
-: LLFloater(key)
+LLFloaterAbout::LLFloaterAbout(const LLSD& key)
+: LLFloater(key)
{
-
+
}
// Destroys the object
@@ -124,89 +124,89 @@ LLFloaterAbout::~LLFloaterAbout()
BOOL LLFloaterAbout::postBuild()
{
- center();
- LLViewerTextEditor *support_widget =
- getChild<LLViewerTextEditor>("support_editor", true);
+ center();
+ LLViewerTextEditor *support_widget =
+ getChild<LLViewerTextEditor>("support_editor", true);
- LLViewerTextEditor *contrib_names_widget =
- getChild<LLViewerTextEditor>("contrib_names", true);
+ LLViewerTextEditor *contrib_names_widget =
+ getChild<LLViewerTextEditor>("contrib_names", true);
- LLViewerTextEditor *licenses_widget =
- getChild<LLViewerTextEditor>("licenses_editor", true);
+ LLViewerTextEditor *licenses_widget =
+ getChild<LLViewerTextEditor>("licenses_editor", true);
+
+ getChild<LLUICtrl>("copy_btn")->setCommitCallback(
+ boost::bind(&LLFloaterAbout::onClickCopyToClipboard, this));
- getChild<LLUICtrl>("copy_btn")->setCommitCallback(
- boost::bind(&LLFloaterAbout::onClickCopyToClipboard, this));
-
getChild<LLUICtrl>("update_btn")->setCommitCallback(
boost::bind(&LLFloaterAbout::onClickUpdateCheck, this));
- static const LLUIColor about_color = LLUIColorTable::instance().getColor("TextFgReadOnlyColor");
+ static const LLUIColor about_color = LLUIColorTable::instance().getColor("TextFgReadOnlyColor");
- if (gAgent.getRegion())
- {
- // start fetching server release notes URL
- setSupportText(LLTrans::getString("RetrievingData"));
+ if (gAgent.getRegion())
+ {
+ // start fetching server release notes URL
+ setSupportText(LLTrans::getString("RetrievingData"));
startFetchServerReleaseNotes();
- }
- else // not logged in
- {
- LL_DEBUGS("ViewerInfo") << "cannot display region info when not connected" << LL_ENDL;
- setSupportText(LLTrans::getString("NotConnected"));
- }
-
- support_widget->blockUndo();
-
- // Fix views
- support_widget->setEnabled(FALSE);
- support_widget->startOfDoc();
-
- // Get the names of contributors, extracted from .../doc/contributions.txt by viewer_manifest.py at build time
- std::string contributors_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"contributors.txt");
- llifstream contrib_file;
- std::string contributors;
- contrib_file.open(contributors_path.c_str()); /* Flawfinder: ignore */
- if (contrib_file.is_open())
- {
- std::getline(contrib_file, contributors); // all names are on a single line
- contrib_file.close();
- }
- else
- {
- LL_WARNS("AboutInit") << "Could not read contributors file at " << contributors_path << LL_ENDL;
- }
- contrib_names_widget->setText(contributors);
- contrib_names_widget->setEnabled(FALSE);
- contrib_names_widget->startOfDoc();
+ }
+ else // not logged in
+ {
+ LL_DEBUGS("ViewerInfo") << "cannot display region info when not connected" << LL_ENDL;
+ setSupportText(LLTrans::getString("NotConnected"));
+ }
+
+ support_widget->blockUndo();
+
+ // Fix views
+ support_widget->setEnabled(FALSE);
+ support_widget->startOfDoc();
+
+ // Get the names of contributors, extracted from .../doc/contributions.txt by viewer_manifest.py at build time
+ std::string contributors_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"contributors.txt");
+ llifstream contrib_file;
+ std::string contributors;
+ contrib_file.open(contributors_path.c_str()); /* Flawfinder: ignore */
+ if (contrib_file.is_open())
+ {
+ std::getline(contrib_file, contributors); // all names are on a single line
+ contrib_file.close();
+ }
+ else
+ {
+ LL_WARNS("AboutInit") << "Could not read contributors file at " << contributors_path << LL_ENDL;
+ }
+ contrib_names_widget->setText(contributors);
+ contrib_names_widget->setEnabled(FALSE);
+ contrib_names_widget->startOfDoc();
// Get the Versions and Copyrights, created at build time
- std::string licenses_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"packages-info.txt");
- llifstream licenses_file;
- licenses_file.open(licenses_path.c_str()); /* Flawfinder: ignore */
- if (licenses_file.is_open())
- {
- std::string license_line;
- licenses_widget->clear();
- while ( std::getline(licenses_file, license_line) )
- {
- licenses_widget->appendText(license_line+"\n", FALSE,
- LLStyle::Params() .color(about_color));
- }
- licenses_file.close();
- }
- else
- {
- // this case will use the (out of date) hard coded value from the XUI
- LL_INFOS("AboutInit") << "Could not read licenses file at " << licenses_path << LL_ENDL;
- }
- licenses_widget->setEnabled(FALSE);
- licenses_widget->startOfDoc();
-
- return TRUE;
+ std::string licenses_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"packages-info.txt");
+ llifstream licenses_file;
+ licenses_file.open(licenses_path.c_str()); /* Flawfinder: ignore */
+ if (licenses_file.is_open())
+ {
+ std::string license_line;
+ licenses_widget->clear();
+ while ( std::getline(licenses_file, license_line) )
+ {
+ licenses_widget->appendText(license_line+"\n", FALSE,
+ LLStyle::Params() .color(about_color));
+ }
+ licenses_file.close();
+ }
+ else
+ {
+ // this case will use the (out of date) hard coded value from the XUI
+ LL_INFOS("AboutInit") << "Could not read licenses file at " << licenses_path << LL_ENDL;
+ }
+ licenses_widget->setEnabled(FALSE);
+ licenses_widget->startOfDoc();
+
+ return TRUE;
}
LLSD LLFloaterAbout::getInfo()
{
- return LLAppViewer::instance()->getViewerInfo();
+ return LLAppViewer::instance()->getViewerInfo();
}
/*static*/
@@ -284,35 +284,35 @@ void LLFloaterAbout::handleServerReleaseNotes(LLSD results)
class LLFloaterAboutListener: public LLEventAPI
{
public:
- LLFloaterAboutListener():
- LLEventAPI("LLFloaterAbout",
+ LLFloaterAboutListener():
+ LLEventAPI("LLFloaterAbout",
"LLFloaterAbout listener to retrieve About box info")
- {
- add("getInfo",
+ {
+ add("getInfo",
"Request an LLSD::Map containing information used to populate About box",
&LLFloaterAboutListener::getInfo,
LLSD().with("reply", LLSD()));
- }
+ }
private:
- void getInfo(const LLSD& request) const
- {
- LLReqID reqid(request);
- LLSD reply(LLFloaterAbout::getInfo());
- reqid.stamp(reply);
- LLEventPumps::instance().obtain(request["reply"]).post(reply);
- }
+ void getInfo(const LLSD& request) const
+ {
+ LLReqID reqid(request);
+ LLSD reply(LLFloaterAbout::getInfo());
+ reqid.stamp(reply);
+ LLEventPumps::instance().obtain(request["reply"]).post(reply);
+ }
};
static LLFloaterAboutListener floaterAboutListener;
void LLFloaterAbout::onClickCopyToClipboard()
{
- LLViewerTextEditor *support_widget =
- getChild<LLViewerTextEditor>("support_editor", true);
- support_widget->selectAll();
- support_widget->copy();
- support_widget->deselect();
+ LLViewerTextEditor *support_widget =
+ getChild<LLViewerTextEditor>("support_editor", true);
+ support_widget->selectAll();
+ support_widget->copy();
+ support_widget->deselect();
}
void LLFloaterAbout::onClickUpdateCheck()
@@ -323,28 +323,28 @@ void LLFloaterAbout::onClickUpdateCheck()
void LLFloaterAbout::setSupportText(const std::string& server_release_notes_url)
{
#if LL_WINDOWS
- getWindow()->incBusyCount();
- getWindow()->setCursor(UI_CURSOR_ARROW);
+ getWindow()->incBusyCount();
+ getWindow()->setCursor(UI_CURSOR_ARROW);
#endif
#if LL_WINDOWS
- getWindow()->decBusyCount();
- getWindow()->setCursor(UI_CURSOR_ARROW);
+ getWindow()->decBusyCount();
+ getWindow()->setCursor(UI_CURSOR_ARROW);
#endif
- LLViewerTextEditor *support_widget =
- getChild<LLViewerTextEditor>("support_editor", true);
+ LLViewerTextEditor *support_widget =
+ getChild<LLViewerTextEditor>("support_editor", true);
- LLUIColor about_color = LLUIColorTable::instance().getColor("TextFgReadOnlyColor");
- support_widget->clear();
- support_widget->appendText(LLAppViewer::instance()->getViewerInfoString(),
- FALSE, LLStyle::Params() .color(about_color));
+ LLUIColor about_color = LLUIColorTable::instance().getColor("TextFgReadOnlyColor");
+ support_widget->clear();
+ support_widget->appendText(LLAppViewer::instance()->getViewerInfoString(),
+ FALSE, LLStyle::Params() .color(about_color));
}
//This is bound as a callback in postBuild()
void LLFloaterAbout::setUpdateListener()
{
typedef std::vector<std::string> vec;
-
+
//There are four possibilities:
//no downloads directory or version directory in "getOSUserAppDir()/downloads"
// => no update
@@ -359,16 +359,16 @@ void LLFloaterAbout::setUpdateListener()
BOOL done = false;
BOOL next = false;
BOOL skip = false;
-
+
LLSD info(LLFloaterAbout::getInfo());
std::string version = info["VIEWER_VERSION_STR"].asString();
std::string appDir = gDirUtilp->getOSUserAppDir();
-
+
//drop down two directory levels so we aren't searching for markers among the log files and crash dumps
//or among other possible viewer upgrade directories if the resident is running multiple viewer versions
//we should end up with a path like ../downloads/1.2.3.456789
vec file_vec = gDirUtilp->getFilesInDir(appDir);
-
+
for(vec::const_iterator iter=file_vec.begin(); iter!=file_vec.end(); ++iter)
{
if ( (iter->rfind("downloads") ) )
@@ -384,7 +384,7 @@ void LLFloaterAbout::setUpdateListener()
}
}
}
-
+
if ( downloads )
{
for(vec::const_iterator iter=file_vec.begin(); iter!=file_vec.end(); ++iter)
@@ -406,7 +406,7 @@ void LLFloaterAbout::setUpdateListener()
}
}
}
-
+
if ( !downloads )
{
LLNotificationsUtil::add("UpdateViewerUpToDate");
@@ -433,8 +433,8 @@ void LLFloaterAbout::setUpdateListener()
///----------------------------------------------------------------------------
void LLFloaterAboutUtil::registerFloater()
{
- LLFloaterReg::add("sl_about", "floater_about.xml",
- &LLFloaterReg::build<LLFloaterAbout>);
+ LLFloaterReg::add("sl_about", "floater_about.xml",
+ &LLFloaterReg::build<LLFloaterAbout>);
}
void LLFloaterAboutUtil::checkUpdatesAndNotify()
diff --git a/indra/newview/llfloaterabout.h b/indra/newview/llfloaterabout.h
index be34b631cc..3e500b306e 100644
--- a/indra/newview/llfloaterabout.h
+++ b/indra/newview/llfloaterabout.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterabout.h
* @brief The about box from Help -> About
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,10 +29,10 @@
namespace LLFloaterAboutUtil
{
- void registerFloater();
+ void registerFloater();
- // Support for user initialized update/state checks
- void checkUpdatesAndNotify();
+ // Support for user initialized update/state checks
+ void checkUpdatesAndNotify();
}
#endif // LL_LLFLOATERABOUT_H
diff --git a/indra/newview/llfloateraddpaymentmethod.cpp b/indra/newview/llfloateraddpaymentmethod.cpp
index 3952b48229..4df993e49f 100644
--- a/indra/newview/llfloateraddpaymentmethod.cpp
+++ b/indra/newview/llfloateraddpaymentmethod.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloateraddpaymentmethod.cpp
* @brief LLFloaterAddPaymentMethod class implementation
*
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
LLFloaterAddPaymentMethod::LLFloaterAddPaymentMethod(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
}
@@ -43,39 +43,39 @@ LLFloaterAddPaymentMethod::~LLFloaterAddPaymentMethod()
BOOL LLFloaterAddPaymentMethod::postBuild()
{
- setCanDrag(FALSE);
- getChild<LLButton>("continue_btn")->setCommitCallback(boost::bind(&LLFloaterAddPaymentMethod::onContinueBtn, this));
- getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterAddPaymentMethod::onCloseBtn, this));
- return TRUE;
+ setCanDrag(FALSE);
+ getChild<LLButton>("continue_btn")->setCommitCallback(boost::bind(&LLFloaterAddPaymentMethod::onContinueBtn, this));
+ getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterAddPaymentMethod::onCloseBtn, this));
+ return TRUE;
}
void LLFloaterAddPaymentMethod::onOpen(const LLSD& key)
{
- centerOnScreen();
+ centerOnScreen();
}
void LLFloaterAddPaymentMethod::onContinueBtn()
{
- closeFloater();
- LLNotificationsUtil::add("AddPaymentMethod", LLSD(), LLSD(),
- [this](const LLSD&notif, const LLSD&resp)
- {
- S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
- if (opt == 0)
- {
- LLWeb::loadURL(this->getString("continue_url"));
- }
- });
+ closeFloater();
+ LLNotificationsUtil::add("AddPaymentMethod", LLSD(), LLSD(),
+ [this](const LLSD&notif, const LLSD&resp)
+ {
+ S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
+ if (opt == 0)
+ {
+ LLWeb::loadURL(this->getString("continue_url"));
+ }
+ });
}
void LLFloaterAddPaymentMethod::onCloseBtn()
{
- closeFloater();
+ closeFloater();
}
void LLFloaterAddPaymentMethod::centerOnScreen()
{
- LLVector2 window_size = LLUI::getInstance()->getWindowSize();
- centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY])));
+ LLVector2 window_size = LLUI::getInstance()->getWindowSize();
+ centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY])));
}
diff --git a/indra/newview/llfloateraddpaymentmethod.h b/indra/newview/llfloateraddpaymentmethod.h
index b3bb624484..a513893d70 100644
--- a/indra/newview/llfloateraddpaymentmethod.h
+++ b/indra/newview/llfloateraddpaymentmethod.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloateraddpaymentmethod.h
* @brief LLFloaterAddPaymentMethod class definition
*
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,22 +30,22 @@
#include "llfloater.h"
class LLFloaterAddPaymentMethod:
- public LLFloater
+ public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
private:
- LLFloaterAddPaymentMethod(const LLSD& key);
+ LLFloaterAddPaymentMethod(const LLSD& key);
+
+ void centerOnScreen();
- void centerOnScreen();
+ void onCloseBtn();
+ void onContinueBtn();
- void onCloseBtn();
- void onContinueBtn();
-
- /*virtual*/ ~LLFloaterAddPaymentMethod();
+ /*virtual*/ ~LLFloaterAddPaymentMethod();
};
diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp
index 9813156bf2..f4a9400120 100644
--- a/indra/newview/llfloaterauction.cpp
+++ b/indra/newview/llfloaterauction.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterauction.cpp
* @author James Cook, Ian Wilkes
* @brief Implementation of the auction floater.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -63,9 +63,9 @@
///----------------------------------------------------------------------------
void auction_j2c_upload_done(const LLUUID& asset_id,
- void* user_data, S32 status, LLExtStat ext_status);
+ void* user_data, S32 status, LLExtStat ext_status);
void auction_tga_upload_done(const LLUUID& asset_id,
- void* user_data, S32 status, LLExtStat ext_status);
+ void* user_data, S32 status, LLExtStat ext_status);
///----------------------------------------------------------------------------
/// Class llfloaterauction
@@ -74,12 +74,12 @@ void auction_tga_upload_done(const LLUUID& asset_id,
// Default constructor
LLFloaterAuction::LLFloaterAuction(const LLSD& key)
: LLFloater(key),
- mParcelID(-1)
+ mParcelID(-1)
{
- mCommitCallbackRegistrar.add("ClickSnapshot", boost::bind(&LLFloaterAuction::onClickSnapshot, this));
- mCommitCallbackRegistrar.add("ClickSellToAnyone", boost::bind(&LLFloaterAuction::onClickSellToAnyone, this));
- mCommitCallbackRegistrar.add("ClickStartAuction", boost::bind(&LLFloaterAuction::onClickStartAuction, this));
- mCommitCallbackRegistrar.add("ClickResetParcel", boost::bind(&LLFloaterAuction::onClickResetParcel, this));
+ mCommitCallbackRegistrar.add("ClickSnapshot", boost::bind(&LLFloaterAuction::onClickSnapshot, this));
+ mCommitCallbackRegistrar.add("ClickSellToAnyone", boost::bind(&LLFloaterAuction::onClickSellToAnyone, this));
+ mCommitCallbackRegistrar.add("ClickStartAuction", boost::bind(&LLFloaterAuction::onClickStartAuction, this));
+ mCommitCallbackRegistrar.add("ClickResetParcel", boost::bind(&LLFloaterAuction::onClickResetParcel, this));
}
// Destroys the object
@@ -89,193 +89,193 @@ LLFloaterAuction::~LLFloaterAuction()
BOOL LLFloaterAuction::postBuild()
{
- return TRUE;
+ return TRUE;
}
void LLFloaterAuction::onOpen(const LLSD& key)
{
- initialize();
+ initialize();
}
void LLFloaterAuction::initialize()
{
- mParcelUpdateCapUrl.clear();
-
- mParcelp = LLViewerParcelMgr::getInstance()->getParcelSelection();
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- LLParcel* parcelp = mParcelp->getParcel();
- if(parcelp && region && !parcelp->getForSale())
- {
- mParcelHost = region->getHost();
- mParcelID = parcelp->getLocalID();
- mParcelUpdateCapUrl = region->getCapability("ParcelPropertiesUpdate");
-
- getChild<LLUICtrl>("parcel_text")->setValue(parcelp->getName());
- getChildView("snapshot_btn")->setEnabled(TRUE);
- getChildView("reset_parcel_btn")->setEnabled(TRUE);
- getChildView("start_auction_btn")->setEnabled(TRUE);
-
- U32 estate_id = LLEstateInfoModel::instance().getID();
- // Only enable "Sell to Anyone" on Teen grid or if we don't know the ID yet
- getChildView("sell_to_anyone_btn")->setEnabled(estate_id == ESTATE_TEEN || estate_id == 0);
- }
- else
- {
- mParcelHost.invalidate();
- if(parcelp && parcelp->getForSale())
- {
- getChild<LLUICtrl>("parcel_text")->setValue(getString("already for sale"));
- }
- else
- {
- getChild<LLUICtrl>("parcel_text")->setValue(LLStringUtil::null);
- }
- mParcelID = -1;
- getChildView("snapshot_btn")->setEnabled(false);
- getChildView("reset_parcel_btn")->setEnabled(false);
- getChildView("sell_to_anyone_btn")->setEnabled(false);
- getChildView("start_auction_btn")->setEnabled(false);
- }
-
- mImageID.setNull();
- mImage = NULL;
+ mParcelUpdateCapUrl.clear();
+
+ mParcelp = LLViewerParcelMgr::getInstance()->getParcelSelection();
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ LLParcel* parcelp = mParcelp->getParcel();
+ if(parcelp && region && !parcelp->getForSale())
+ {
+ mParcelHost = region->getHost();
+ mParcelID = parcelp->getLocalID();
+ mParcelUpdateCapUrl = region->getCapability("ParcelPropertiesUpdate");
+
+ getChild<LLUICtrl>("parcel_text")->setValue(parcelp->getName());
+ getChildView("snapshot_btn")->setEnabled(TRUE);
+ getChildView("reset_parcel_btn")->setEnabled(TRUE);
+ getChildView("start_auction_btn")->setEnabled(TRUE);
+
+ U32 estate_id = LLEstateInfoModel::instance().getID();
+ // Only enable "Sell to Anyone" on Teen grid or if we don't know the ID yet
+ getChildView("sell_to_anyone_btn")->setEnabled(estate_id == ESTATE_TEEN || estate_id == 0);
+ }
+ else
+ {
+ mParcelHost.invalidate();
+ if(parcelp && parcelp->getForSale())
+ {
+ getChild<LLUICtrl>("parcel_text")->setValue(getString("already for sale"));
+ }
+ else
+ {
+ getChild<LLUICtrl>("parcel_text")->setValue(LLStringUtil::null);
+ }
+ mParcelID = -1;
+ getChildView("snapshot_btn")->setEnabled(false);
+ getChildView("reset_parcel_btn")->setEnabled(false);
+ getChildView("sell_to_anyone_btn")->setEnabled(false);
+ getChildView("start_auction_btn")->setEnabled(false);
+ }
+
+ mImageID.setNull();
+ mImage = NULL;
}
void LLFloaterAuction::draw()
{
- LLFloater::draw();
-
- if(!isMinimized() && mImage.notNull())
- {
- LLView* snapshot_icon = findChildView("snapshot_icon");
- if (snapshot_icon)
- {
- LLRect rect = snapshot_icon->getRect();
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gl_rect_2d(rect, LLColor4(0.f, 0.f, 0.f, 1.f));
- rect.stretch(-1);
- }
- {
- LLGLSUIDefault gls_ui;
- gGL.color3f(1.f, 1.f, 1.f);
- gl_draw_scaled_image(rect.mLeft,
- rect.mBottom,
- rect.getWidth(),
- rect.getHeight(),
- mImage);
- }
- }
- }
+ LLFloater::draw();
+
+ if(!isMinimized() && mImage.notNull())
+ {
+ LLView* snapshot_icon = findChildView("snapshot_icon");
+ if (snapshot_icon)
+ {
+ LLRect rect = snapshot_icon->getRect();
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gl_rect_2d(rect, LLColor4(0.f, 0.f, 0.f, 1.f));
+ rect.stretch(-1);
+ }
+ {
+ LLGLSUIDefault gls_ui;
+ gGL.color3f(1.f, 1.f, 1.f);
+ gl_draw_scaled_image(rect.mLeft,
+ rect.mBottom,
+ rect.getWidth(),
+ rect.getHeight(),
+ mImage);
+ }
+ }
+ }
}
// static
void LLFloaterAuction::onClickSnapshot(void* data)
{
- LLFloaterAuction* self = (LLFloaterAuction*)(data);
-
- LLPointer<LLImageRaw> raw = new LLImageRaw;
-
- gForceRenderLandFence = self->getChild<LLUICtrl>("fence_check")->getValue().asBoolean();
- BOOL success = gViewerWindow->rawSnapshot(raw,
- gViewerWindow->getWindowWidthScaled(),
- gViewerWindow->getWindowHeightScaled(),
- TRUE,
- FALSE,
- FALSE, //UI
- FALSE, //HUD
- FALSE);
- gForceRenderLandFence = FALSE;
-
- if (success)
- {
- self->mTransactionID.generate();
- self->mImageID = self->mTransactionID.makeAssetID(gAgent.getSecureSessionID());
-
- if(!gSavedSettings.getBOOL("QuietSnapshotsToDisk"))
- {
- gViewerWindow->playSnapshotAnimAndSound();
- }
- LL_INFOS() << "Writing TGA..." << LL_ENDL;
-
- LLPointer<LLImageTGA> tga = new LLImageTGA;
- tga->encode(raw);
-
- LLFileSystem tga_file(self->mImageID, LLAssetType::AT_IMAGE_TGA, LLFileSystem::WRITE);
- tga_file.write(tga->getData(), tga->getDataSize());
-
- raw->biasedScaleToPowerOfTwo(LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT);
-
- LL_INFOS() << "Writing J2C..." << LL_ENDL;
-
- LLPointer<LLImageJ2C> j2c = new LLImageJ2C;
- j2c->encode(raw, 0.0f);
-
- LLFileSystem j2c_file(self->mImageID, LLAssetType::AT_TEXTURE, LLFileSystem::WRITE);
- j2c_file.write(j2c->getData(), j2c->getDataSize());
-
- self->mImage = LLViewerTextureManager::getLocalTexture((LLImageRaw*)raw, FALSE);
- gGL.getTexUnit(0)->bind(self->mImage);
- self->mImage->setAddressMode(LLTexUnit::TAM_CLAMP);
- }
- else
- {
- LL_WARNS() << "Unable to take snapshot" << LL_ENDL;
- }
+ LLFloaterAuction* self = (LLFloaterAuction*)(data);
+
+ LLPointer<LLImageRaw> raw = new LLImageRaw;
+
+ gForceRenderLandFence = self->getChild<LLUICtrl>("fence_check")->getValue().asBoolean();
+ BOOL success = gViewerWindow->rawSnapshot(raw,
+ gViewerWindow->getWindowWidthScaled(),
+ gViewerWindow->getWindowHeightScaled(),
+ TRUE,
+ FALSE,
+ FALSE, //UI
+ FALSE, //HUD
+ FALSE);
+ gForceRenderLandFence = FALSE;
+
+ if (success)
+ {
+ self->mTransactionID.generate();
+ self->mImageID = self->mTransactionID.makeAssetID(gAgent.getSecureSessionID());
+
+ if(!gSavedSettings.getBOOL("QuietSnapshotsToDisk"))
+ {
+ gViewerWindow->playSnapshotAnimAndSound();
+ }
+ LL_INFOS() << "Writing TGA..." << LL_ENDL;
+
+ LLPointer<LLImageTGA> tga = new LLImageTGA;
+ tga->encode(raw);
+
+ LLFileSystem tga_file(self->mImageID, LLAssetType::AT_IMAGE_TGA, LLFileSystem::WRITE);
+ tga_file.write(tga->getData(), tga->getDataSize());
+
+ raw->biasedScaleToPowerOfTwo(LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT);
+
+ LL_INFOS() << "Writing J2C..." << LL_ENDL;
+
+ LLPointer<LLImageJ2C> j2c = new LLImageJ2C;
+ j2c->encode(raw, 0.0f);
+
+ LLFileSystem j2c_file(self->mImageID, LLAssetType::AT_TEXTURE, LLFileSystem::WRITE);
+ j2c_file.write(j2c->getData(), j2c->getDataSize());
+
+ self->mImage = LLViewerTextureManager::getLocalTexture((LLImageRaw*)raw, FALSE);
+ gGL.getTexUnit(0)->bind(self->mImage);
+ self->mImage->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
+ else
+ {
+ LL_WARNS() << "Unable to take snapshot" << LL_ENDL;
+ }
}
// static
void LLFloaterAuction::onClickStartAuction(void* data)
{
- LLFloaterAuction* self = (LLFloaterAuction*)(data);
-
- if(self->mImageID.notNull())
- {
- LLSD parcel_name = self->getChild<LLUICtrl>("parcel_text")->getValue();
-
- // create the asset
- std::string* name = new std::string(parcel_name.asString());
- gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_IMAGE_TGA,
- &auction_tga_upload_done,
- (void*)name,
- FALSE);
- self->getWindow()->incBusyCount();
-
- std::string* j2c_name = new std::string(parcel_name.asString());
- gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_TEXTURE,
- &auction_j2c_upload_done,
- (void*)j2c_name,
- FALSE);
- self->getWindow()->incBusyCount();
-
- LLNotificationsUtil::add("UploadingAuctionSnapshot");
-
- }
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessage("ViewerStartAuction");
-
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("ParcelData");
- msg->addS32("LocalID", self->mParcelID);
- msg->addUUID("SnapshotID", self->mImageID);
- msg->sendReliable(self->mParcelHost);
-
- // clean up floater, and get out
- self->cleanupAndClose();
+ LLFloaterAuction* self = (LLFloaterAuction*)(data);
+
+ if(self->mImageID.notNull())
+ {
+ LLSD parcel_name = self->getChild<LLUICtrl>("parcel_text")->getValue();
+
+ // create the asset
+ std::string* name = new std::string(parcel_name.asString());
+ gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_IMAGE_TGA,
+ &auction_tga_upload_done,
+ (void*)name,
+ FALSE);
+ self->getWindow()->incBusyCount();
+
+ std::string* j2c_name = new std::string(parcel_name.asString());
+ gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_TEXTURE,
+ &auction_j2c_upload_done,
+ (void*)j2c_name,
+ FALSE);
+ self->getWindow()->incBusyCount();
+
+ LLNotificationsUtil::add("UploadingAuctionSnapshot");
+
+ }
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessage("ViewerStartAuction");
+
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("ParcelData");
+ msg->addS32("LocalID", self->mParcelID);
+ msg->addUUID("SnapshotID", self->mImageID);
+ msg->sendReliable(self->mParcelHost);
+
+ // clean up floater, and get out
+ self->cleanupAndClose();
}
void LLFloaterAuction::cleanupAndClose()
{
- mImageID.setNull();
- mImage = NULL;
- mParcelID = -1;
- mParcelHost.invalidate();
- closeFloater();
+ mImageID.setNull();
+ mImage = NULL;
+ mParcelID = -1;
+ mParcelHost.invalidate();
+ closeFloater();
}
@@ -283,145 +283,145 @@ void LLFloaterAuction::cleanupAndClose()
// static glue
void LLFloaterAuction::onClickResetParcel(void* data)
{
- LLFloaterAuction* self = (LLFloaterAuction*)(data);
- if (self)
- {
- self->doResetParcel();
- }
+ LLFloaterAuction* self = (LLFloaterAuction*)(data);
+ if (self)
+ {
+ self->doResetParcel();
+ }
}
// Reset all the values for the parcel in preparation for a sale
void LLFloaterAuction::doResetParcel()
{
- LLParcel* parcelp = mParcelp->getParcel();
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
-
- if (parcelp
- && region
- && !mParcelUpdateCapUrl.empty())
- {
- LLSD body;
- std::string empty;
-
- // request new properties update from simulator
- U32 message_flags = 0x01;
- body["flags"] = ll_sd_from_U32(message_flags);
-
- // Set all the default parcel properties for auction
- body["local_id"] = parcelp->getLocalID();
-
- U32 parcel_flags = PF_ALLOW_LANDMARK |
- PF_ALLOW_FLY |
- PF_CREATE_GROUP_OBJECTS |
- PF_ALLOW_ALL_OBJECT_ENTRY |
- PF_ALLOW_GROUP_OBJECT_ENTRY |
- PF_ALLOW_GROUP_SCRIPTS |
- PF_RESTRICT_PUSHOBJECT |
- PF_SOUND_LOCAL |
- PF_ALLOW_VOICE_CHAT |
- PF_USE_ESTATE_VOICE_CHAN;
-
- body["parcel_flags"] = ll_sd_from_U32(parcel_flags);
-
- // Build a parcel name like "Ahern (128,128) PG 4032m"
- std::ostringstream parcel_name;
- LLVector3 center_point( parcelp->getCenterpoint() );
- center_point.snap(0); // Get rid of fractions
- parcel_name << region->getName()
- << " ("
- << (S32) center_point.mV[VX]
- << ","
- << (S32) center_point.mV[VY]
- << ") "
- << region->getSimAccessString()
- << " "
- << parcelp->getArea()
- << "m";
-
- std::string new_name(parcel_name.str().c_str());
- body["name"] = new_name;
- getChild<LLUICtrl>("parcel_text")->setValue(new_name); // Set name in dialog as well, since it won't get updated otherwise
-
- body["sale_price"] = (S32) 0;
- body["description"] = empty;
- body["music_url"] = empty;
- body["media_url"] = empty;
- body["media_desc"] = empty;
- body["media_type"] = LLMIMETypes::getDefaultMimeType();
- body["media_width"] = (S32) 0;
- body["media_height"] = (S32) 0;
- body["auto_scale"] = (S32) 0;
- body["media_loop"] = (S32) 0;
- body["obscure_media"] = (S32) 0; // OBSOLETE - no longer used
- body["obscure_music"] = (S32) 0; // OBSOLETE - no longer used
- body["media_id"] = LLUUID::null;
- body["group_id"] = MAINTENANCE_GROUP_ID; // Use maintenance group
- body["pass_price"] = (S32) 10; // Defaults to $10
- body["pass_hours"] = 0.0f;
- body["category"] = (U8) LLParcel::C_NONE;
- body["auth_buyer_id"] = LLUUID::null;
- body["snapshot_id"] = LLUUID::null;
- body["user_location"] = ll_sd_from_vector3( LLVector3::zero );
- body["user_look_at"] = ll_sd_from_vector3( LLVector3::zero );
- body["landing_type"] = (U8) LLParcel::L_DIRECT;
-
- LL_INFOS() << "Sending parcel update to reset for auction via capability to: "
- << mParcelUpdateCapUrl << LL_ENDL;
+ LLParcel* parcelp = mParcelp->getParcel();
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+
+ if (parcelp
+ && region
+ && !mParcelUpdateCapUrl.empty())
+ {
+ LLSD body;
+ std::string empty;
+
+ // request new properties update from simulator
+ U32 message_flags = 0x01;
+ body["flags"] = ll_sd_from_U32(message_flags);
+
+ // Set all the default parcel properties for auction
+ body["local_id"] = parcelp->getLocalID();
+
+ U32 parcel_flags = PF_ALLOW_LANDMARK |
+ PF_ALLOW_FLY |
+ PF_CREATE_GROUP_OBJECTS |
+ PF_ALLOW_ALL_OBJECT_ENTRY |
+ PF_ALLOW_GROUP_OBJECT_ENTRY |
+ PF_ALLOW_GROUP_SCRIPTS |
+ PF_RESTRICT_PUSHOBJECT |
+ PF_SOUND_LOCAL |
+ PF_ALLOW_VOICE_CHAT |
+ PF_USE_ESTATE_VOICE_CHAN;
+
+ body["parcel_flags"] = ll_sd_from_U32(parcel_flags);
+
+ // Build a parcel name like "Ahern (128,128) PG 4032m"
+ std::ostringstream parcel_name;
+ LLVector3 center_point( parcelp->getCenterpoint() );
+ center_point.snap(0); // Get rid of fractions
+ parcel_name << region->getName()
+ << " ("
+ << (S32) center_point.mV[VX]
+ << ","
+ << (S32) center_point.mV[VY]
+ << ") "
+ << region->getSimAccessString()
+ << " "
+ << parcelp->getArea()
+ << "m";
+
+ std::string new_name(parcel_name.str().c_str());
+ body["name"] = new_name;
+ getChild<LLUICtrl>("parcel_text")->setValue(new_name); // Set name in dialog as well, since it won't get updated otherwise
+
+ body["sale_price"] = (S32) 0;
+ body["description"] = empty;
+ body["music_url"] = empty;
+ body["media_url"] = empty;
+ body["media_desc"] = empty;
+ body["media_type"] = LLMIMETypes::getDefaultMimeType();
+ body["media_width"] = (S32) 0;
+ body["media_height"] = (S32) 0;
+ body["auto_scale"] = (S32) 0;
+ body["media_loop"] = (S32) 0;
+ body["obscure_media"] = (S32) 0; // OBSOLETE - no longer used
+ body["obscure_music"] = (S32) 0; // OBSOLETE - no longer used
+ body["media_id"] = LLUUID::null;
+ body["group_id"] = MAINTENANCE_GROUP_ID; // Use maintenance group
+ body["pass_price"] = (S32) 10; // Defaults to $10
+ body["pass_hours"] = 0.0f;
+ body["category"] = (U8) LLParcel::C_NONE;
+ body["auth_buyer_id"] = LLUUID::null;
+ body["snapshot_id"] = LLUUID::null;
+ body["user_location"] = ll_sd_from_vector3( LLVector3::zero );
+ body["user_look_at"] = ll_sd_from_vector3( LLVector3::zero );
+ body["landing_type"] = (U8) LLParcel::L_DIRECT;
+
+ LL_INFOS() << "Sending parcel update to reset for auction via capability to: "
+ << mParcelUpdateCapUrl << LL_ENDL;
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(mParcelUpdateCapUrl, body,
"Parcel reset for auction",
"Parcel not set for auction.");
- // Send a message to clear the object return time
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, parcelp->getLocalID());
- msg->addS32Fast(_PREHASH_OtherCleanTime, 5); // 5 minute object auto-return
-
- msg->sendReliable(region->getHost());
-
- // Clear the access lists
- clearParcelAccessList(parcelp, region, AL_ACCESS);
- clearParcelAccessList(parcelp, region, AL_BAN);
- clearParcelAccessList(parcelp, region, AL_ALLOW_EXPERIENCE);
- clearParcelAccessList(parcelp, region, AL_BLOCK_EXPERIENCE);
- }
+ // Send a message to clear the object return time
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, parcelp->getLocalID());
+ msg->addS32Fast(_PREHASH_OtherCleanTime, 5); // 5 minute object auto-return
+
+ msg->sendReliable(region->getHost());
+
+ // Clear the access lists
+ clearParcelAccessList(parcelp, region, AL_ACCESS);
+ clearParcelAccessList(parcelp, region, AL_BAN);
+ clearParcelAccessList(parcelp, region, AL_ALLOW_EXPERIENCE);
+ clearParcelAccessList(parcelp, region, AL_BLOCK_EXPERIENCE);
+ }
}
void LLFloaterAuction::clearParcelAccessList(LLParcel* parcel, LLViewerRegion* region, U32 list)
{
- if (!region || !parcel) return;
-
- LLUUID transactionUUID;
- transactionUUID.generate();
-
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessageFast(_PREHASH_ParcelAccessListUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- msg->nextBlockFast(_PREHASH_Data);
- msg->addU32Fast(_PREHASH_Flags, list);
- msg->addS32(_PREHASH_LocalID, parcel->getLocalID() );
- msg->addUUIDFast(_PREHASH_TransactionID, transactionUUID);
- msg->addS32Fast(_PREHASH_SequenceID, 1); // sequence_id
- msg->addS32Fast(_PREHASH_Sections, 0); // num_sections
-
- // pack an empty block since there will be no data
- msg->nextBlockFast(_PREHASH_List);
- msg->addUUIDFast(_PREHASH_ID, LLUUID::null );
- msg->addS32Fast(_PREHASH_Time, 0 );
- msg->addU32Fast(_PREHASH_Flags, 0 );
-
- msg->sendReliable( region->getHost() );
+ if (!region || !parcel) return;
+
+ LLUUID transactionUUID;
+ transactionUUID.generate();
+
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_ParcelAccessListUpdate);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->nextBlockFast(_PREHASH_Data);
+ msg->addU32Fast(_PREHASH_Flags, list);
+ msg->addS32(_PREHASH_LocalID, parcel->getLocalID() );
+ msg->addUUIDFast(_PREHASH_TransactionID, transactionUUID);
+ msg->addS32Fast(_PREHASH_SequenceID, 1); // sequence_id
+ msg->addS32Fast(_PREHASH_Sections, 0); // num_sections
+
+ // pack an empty block since there will be no data
+ msg->nextBlockFast(_PREHASH_List);
+ msg->addUUIDFast(_PREHASH_ID, LLUUID::null );
+ msg->addS32Fast(_PREHASH_Time, 0 );
+ msg->addU32Fast(_PREHASH_Flags, 0 );
+
+ msg->sendReliable( region->getHost() );
}
@@ -429,42 +429,42 @@ void LLFloaterAuction::clearParcelAccessList(LLParcel* parcel, LLViewerRegion* r
// static - 'Sell to Anyone' clicked, throw up a confirmation dialog
void LLFloaterAuction::onClickSellToAnyone(void* data)
{
- LLFloaterAuction* self = (LLFloaterAuction*)(data);
- if (self)
- {
- LLParcel* parcelp = self->mParcelp->getParcel();
-
- // Do a confirmation
- S32 sale_price = parcelp->getArea(); // Selling for L$1 per meter
- S32 area = parcelp->getArea();
-
- LLSD args;
- args["LAND_SIZE"] = llformat("%d", area);
- args["SALE_PRICE"] = llformat("%d", sale_price);
- args["NAME"] = LLTrans::getString("Anyone");
-
- LLNotification::Params params("ConfirmLandSaleChange"); // Re-use existing dialog
- params.substitutions(args)
- .functor.function(boost::bind(&LLFloaterAuction::onSellToAnyoneConfirmed, self, _1, _2));
-
- params.name("ConfirmLandSaleToAnyoneChange");
-
- // ask away
- LLNotifications::instance().add(params);
- }
+ LLFloaterAuction* self = (LLFloaterAuction*)(data);
+ if (self)
+ {
+ LLParcel* parcelp = self->mParcelp->getParcel();
+
+ // Do a confirmation
+ S32 sale_price = parcelp->getArea(); // Selling for L$1 per meter
+ S32 area = parcelp->getArea();
+
+ LLSD args;
+ args["LAND_SIZE"] = llformat("%d", area);
+ args["SALE_PRICE"] = llformat("%d", sale_price);
+ args["NAME"] = LLTrans::getString("Anyone");
+
+ LLNotification::Params params("ConfirmLandSaleChange"); // Re-use existing dialog
+ params.substitutions(args)
+ .functor.function(boost::bind(&LLFloaterAuction::onSellToAnyoneConfirmed, self, _1, _2));
+
+ params.name("ConfirmLandSaleToAnyoneChange");
+
+ // ask away
+ LLNotifications::instance().add(params);
+ }
}
// Sell confirmation clicked
-bool LLFloaterAuction::onSellToAnyoneConfirmed(const LLSD& notification, const LLSD& response)
+bool LLFloaterAuction::onSellToAnyoneConfirmed(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- doSellToAnyone();
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ doSellToAnyone();
+ }
- return false;
+ return false;
}
@@ -472,42 +472,42 @@ bool LLFloaterAuction::onSellToAnyoneConfirmed(const LLSD& notification, const L
// Reset all the values for the parcel in preparation for a sale
void LLFloaterAuction::doSellToAnyone()
{
- LLParcel* parcelp = mParcelp->getParcel();
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
-
- if (parcelp
- && region
- && !mParcelUpdateCapUrl.empty())
- {
- LLSD body;
- std::string empty;
-
- // request new properties update from simulator
- U32 message_flags = 0x01;
- body["flags"] = ll_sd_from_U32(message_flags);
-
- // Set all the default parcel properties for auction
- body["local_id"] = parcelp->getLocalID();
-
- // Set 'for sale' flag
- U32 parcel_flags = parcelp->getParcelFlags() | PF_FOR_SALE;
- // Ensure objects not included
- parcel_flags &= ~PF_FOR_SALE_OBJECTS;
- body["parcel_flags"] = ll_sd_from_U32(parcel_flags);
-
- body["sale_price"] = parcelp->getArea(); // Sell for L$1 per square meter
- body["auth_buyer_id"] = LLUUID::null; // To anyone
-
- LL_INFOS() << "Sending parcel update to sell to anyone for L$1 via capability to: "
- << mParcelUpdateCapUrl << LL_ENDL;
+ LLParcel* parcelp = mParcelp->getParcel();
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+
+ if (parcelp
+ && region
+ && !mParcelUpdateCapUrl.empty())
+ {
+ LLSD body;
+ std::string empty;
+
+ // request new properties update from simulator
+ U32 message_flags = 0x01;
+ body["flags"] = ll_sd_from_U32(message_flags);
+
+ // Set all the default parcel properties for auction
+ body["local_id"] = parcelp->getLocalID();
+
+ // Set 'for sale' flag
+ U32 parcel_flags = parcelp->getParcelFlags() | PF_FOR_SALE;
+ // Ensure objects not included
+ parcel_flags &= ~PF_FOR_SALE_OBJECTS;
+ body["parcel_flags"] = ll_sd_from_U32(parcel_flags);
+
+ body["sale_price"] = parcelp->getArea(); // Sell for L$1 per square meter
+ body["auth_buyer_id"] = LLUUID::null; // To anyone
+
+ LL_INFOS() << "Sending parcel update to sell to anyone for L$1 via capability to: "
+ << mParcelUpdateCapUrl << LL_ENDL;
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(mParcelUpdateCapUrl, body,
"Parcel set as sell to everyone.",
"Parcel sell to everyone failed.");
- // clean up floater, and get out
- cleanupAndClose();
- }
+ // clean up floater, and get out
+ cleanupAndClose();
+ }
}
@@ -517,42 +517,42 @@ void LLFloaterAuction::doSellToAnyone()
void auction_tga_upload_done(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
- std::string* name = (std::string*)(user_data);
- LL_INFOS() << "Upload of asset '" << *name << "' " << asset_id
- << " returned " << status << LL_ENDL;
- delete name;
-
- gViewerWindow->getWindow()->decBusyCount();
-
- if (0 == status)
- {
- LLNotificationsUtil::add("UploadWebSnapshotDone");
- }
- else
- {
- LLSD args;
- args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
- LLNotificationsUtil::add("UploadAuctionSnapshotFail", args);
- }
+ std::string* name = (std::string*)(user_data);
+ LL_INFOS() << "Upload of asset '" << *name << "' " << asset_id
+ << " returned " << status << LL_ENDL;
+ delete name;
+
+ gViewerWindow->getWindow()->decBusyCount();
+
+ if (0 == status)
+ {
+ LLNotificationsUtil::add("UploadWebSnapshotDone");
+ }
+ else
+ {
+ LLSD args;
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
+ LLNotificationsUtil::add("UploadAuctionSnapshotFail", args);
+ }
}
void auction_j2c_upload_done(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
- std::string* name = (std::string*)(user_data);
- LL_INFOS() << "Upload of asset '" << *name << "' " << asset_id
- << " returned " << status << LL_ENDL;
- delete name;
-
- gViewerWindow->getWindow()->decBusyCount();
-
- if (0 == status)
- {
- LLNotificationsUtil::add("UploadSnapshotDone");
- }
- else
- {
- LLSD args;
- args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
- LLNotificationsUtil::add("UploadAuctionSnapshotFail", args);
- }
+ std::string* name = (std::string*)(user_data);
+ LL_INFOS() << "Upload of asset '" << *name << "' " << asset_id
+ << " returned " << status << LL_ENDL;
+ delete name;
+
+ gViewerWindow->getWindow()->decBusyCount();
+
+ if (0 == status)
+ {
+ LLNotificationsUtil::add("UploadSnapshotDone");
+ }
+ else
+ {
+ LLSD args;
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
+ LLNotificationsUtil::add("UploadAuctionSnapshotFail", args);
+ }
}
diff --git a/indra/newview/llfloaterauction.h b/indra/newview/llfloaterauction.h
index c83a11ba8b..3514d6cc3c 100644
--- a/indra/newview/llfloaterauction.h
+++ b/indra/newview/llfloaterauction.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterauction.h
* @author James Cook, Ian Wilkes
* @brief llfloaterauction class header file
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,42 +44,42 @@ class LLViewerRegion;
class LLFloaterAuction : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- // LLFloater interface
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void draw();
+ // LLFloater interface
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void draw();
private:
-
- LLFloaterAuction(const LLSD& key);
- ~LLFloaterAuction();
-
- void initialize();
- static void onClickSnapshot(void* data);
- static void onClickResetParcel(void* data);
- static void onClickSellToAnyone(void* data); // Sell to anyone clicked
- bool onSellToAnyoneConfirmed(const LLSD& notification, const LLSD& response); // Sell confirmation clicked
- static void onClickStartAuction(void* data);
+ LLFloaterAuction(const LLSD& key);
+ ~LLFloaterAuction();
+
+ void initialize();
+
+ static void onClickSnapshot(void* data);
+ static void onClickResetParcel(void* data);
+ static void onClickSellToAnyone(void* data); // Sell to anyone clicked
+ bool onSellToAnyoneConfirmed(const LLSD& notification, const LLSD& response); // Sell confirmation clicked
+ static void onClickStartAuction(void* data);
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- void doResetParcel();
- void doSellToAnyone();
- void clearParcelAccessList( LLParcel* parcel, LLViewerRegion* region, U32 list);
- void cleanupAndClose();
+ void doResetParcel();
+ void doSellToAnyone();
+ void clearParcelAccessList( LLParcel* parcel, LLViewerRegion* region, U32 list);
+ void cleanupAndClose();
private:
- LLTransactionID mTransactionID;
- LLAssetID mImageID;
- LLPointer<LLViewerTexture> mImage;
- LLSafeHandle<LLParcelSelection> mParcelp;
- S32 mParcelID;
- LLHost mParcelHost;
+ LLTransactionID mTransactionID;
+ LLAssetID mImageID;
+ LLPointer<LLViewerTexture> mImage;
+ LLSafeHandle<LLParcelSelection> mParcelp;
+ S32 mParcelID;
+ LLHost mParcelHost;
- std::string mParcelUpdateCapUrl; // "ParcelPropertiesUpdate" capability
+ std::string mParcelUpdateCapUrl; // "ParcelPropertiesUpdate" capability
};
diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp
index 0964daa4d5..bdcaf2dc22 100644
--- a/indra/newview/llfloaterautoreplacesettings.cpp
+++ b/indra/newview/llfloaterautoreplacesettings.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterautoreplacesettings.cpp
* @brief Auto Replace List floater
*
@@ -10,12 +10,12 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -79,537 +79,537 @@ LLFloaterAutoReplaceSettings::LLFloaterAutoReplaceSettings(const LLSD& key)
void LLFloaterAutoReplaceSettings::onClose(bool app_quitting)
{
- cleanUp();
+ cleanUp();
}
BOOL LLFloaterAutoReplaceSettings::postBuild(void)
{
- // get copies of the current settings that we will operate on
- mEnabled = gSavedSettings.getBOOL("AutoReplace");
- LL_DEBUGS("AutoReplace") << ( mEnabled ? "enabled" : "disabled") << LL_ENDL;
-
- mSettings = LLAutoReplace::getInstance()->getSettings();
-
- // global checkbox for whether or not autoreplace is active
- LLUICtrl* enabledCheckbox = getChild<LLUICtrl>("autoreplace_enable");
- enabledCheckbox->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onAutoReplaceToggled, this));
- enabledCheckbox->setValue(LLSD(mEnabled));
-
- // top row list creation and deletion
- getChild<LLUICtrl>("autoreplace_import_list")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onImportList,this));
- getChild<LLUICtrl>("autoreplace_export_list")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onExportList,this));
- getChild<LLUICtrl>("autoreplace_new_list")->setCommitCallback( boost::bind(&LLFloaterAutoReplaceSettings::onNewList,this));
- getChild<LLUICtrl>("autoreplace_delete_list")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onDeleteList,this));
-
- // the list of keyword->replacement lists
- mListNames = getChild<LLScrollListCtrl>("autoreplace_list_name");
- mListNames->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onSelectList, this));
- mListNames->setCommitOnSelectionChange(true);
-
- // list ordering
- getChild<LLUICtrl>("autoreplace_list_up")->setCommitCallback( boost::bind(&LLFloaterAutoReplaceSettings::onListUp,this));
- getChild<LLUICtrl>("autoreplace_list_down")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onListDown,this));
-
- // keyword->replacement entry add / delete
- getChild<LLUICtrl>("autoreplace_add_entry")->setCommitCallback( boost::bind(&LLFloaterAutoReplaceSettings::onAddEntry,this));
- getChild<LLUICtrl>("autoreplace_delete_entry")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onDeleteEntry,this));
-
- // entry edits
- mKeyword = getChild<LLLineEditor>("autoreplace_keyword");
- mReplacement = getChild<LLLineEditor>("autoreplace_replacement");
- getChild<LLUICtrl>("autoreplace_save_entry")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onSaveEntry, this));
-
- // dialog termination ( Save Changes / Cancel )
- getChild<LLUICtrl>("autoreplace_save_changes")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onSaveChanges, this));
- getChild<LLUICtrl>("autoreplace_cancel")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onCancel, this));
-
- // the list of keyword->replacement pairs
- mReplacementsList = getChild<LLScrollListCtrl>("autoreplace_list_replacements");
- mReplacementsList->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onSelectEntry, this));
- mReplacementsList->setCommitOnSelectionChange(true);
-
- center();
-
- mSelectedListName.clear();
- updateListNames();
- updateListNamesControls();
- updateReplacementsList();
-
- return true;
+ // get copies of the current settings that we will operate on
+ mEnabled = gSavedSettings.getBOOL("AutoReplace");
+ LL_DEBUGS("AutoReplace") << ( mEnabled ? "enabled" : "disabled") << LL_ENDL;
+
+ mSettings = LLAutoReplace::getInstance()->getSettings();
+
+ // global checkbox for whether or not autoreplace is active
+ LLUICtrl* enabledCheckbox = getChild<LLUICtrl>("autoreplace_enable");
+ enabledCheckbox->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onAutoReplaceToggled, this));
+ enabledCheckbox->setValue(LLSD(mEnabled));
+
+ // top row list creation and deletion
+ getChild<LLUICtrl>("autoreplace_import_list")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onImportList,this));
+ getChild<LLUICtrl>("autoreplace_export_list")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onExportList,this));
+ getChild<LLUICtrl>("autoreplace_new_list")->setCommitCallback( boost::bind(&LLFloaterAutoReplaceSettings::onNewList,this));
+ getChild<LLUICtrl>("autoreplace_delete_list")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onDeleteList,this));
+
+ // the list of keyword->replacement lists
+ mListNames = getChild<LLScrollListCtrl>("autoreplace_list_name");
+ mListNames->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onSelectList, this));
+ mListNames->setCommitOnSelectionChange(true);
+
+ // list ordering
+ getChild<LLUICtrl>("autoreplace_list_up")->setCommitCallback( boost::bind(&LLFloaterAutoReplaceSettings::onListUp,this));
+ getChild<LLUICtrl>("autoreplace_list_down")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onListDown,this));
+
+ // keyword->replacement entry add / delete
+ getChild<LLUICtrl>("autoreplace_add_entry")->setCommitCallback( boost::bind(&LLFloaterAutoReplaceSettings::onAddEntry,this));
+ getChild<LLUICtrl>("autoreplace_delete_entry")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onDeleteEntry,this));
+
+ // entry edits
+ mKeyword = getChild<LLLineEditor>("autoreplace_keyword");
+ mReplacement = getChild<LLLineEditor>("autoreplace_replacement");
+ getChild<LLUICtrl>("autoreplace_save_entry")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onSaveEntry, this));
+
+ // dialog termination ( Save Changes / Cancel )
+ getChild<LLUICtrl>("autoreplace_save_changes")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onSaveChanges, this));
+ getChild<LLUICtrl>("autoreplace_cancel")->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onCancel, this));
+
+ // the list of keyword->replacement pairs
+ mReplacementsList = getChild<LLScrollListCtrl>("autoreplace_list_replacements");
+ mReplacementsList->setCommitCallback(boost::bind(&LLFloaterAutoReplaceSettings::onSelectEntry, this));
+ mReplacementsList->setCommitOnSelectionChange(true);
+
+ center();
+
+ mSelectedListName.clear();
+ updateListNames();
+ updateListNamesControls();
+ updateReplacementsList();
+
+ return true;
}
void LLFloaterAutoReplaceSettings::updateListNames()
{
- mListNames->deleteAllItems(); // start from scratch
-
- LLSD listNames = mSettings.getListNames(); // Array of Strings
-
- for ( LLSD::array_const_iterator entry = listNames.beginArray(), end = listNames.endArray();
- entry != end;
- ++entry
- )
- {
- const std::string& listName = entry->asString();
- mListNames->addSimpleElement(listName);
- }
-
- if (!mSelectedListName.empty())
- {
- mListNames->setSelectedByValue( LLSD(mSelectedListName), true );
- }
+ mListNames->deleteAllItems(); // start from scratch
+
+ LLSD listNames = mSettings.getListNames(); // Array of Strings
+
+ for ( LLSD::array_const_iterator entry = listNames.beginArray(), end = listNames.endArray();
+ entry != end;
+ ++entry
+ )
+ {
+ const std::string& listName = entry->asString();
+ mListNames->addSimpleElement(listName);
+ }
+
+ if (!mSelectedListName.empty())
+ {
+ mListNames->setSelectedByValue( LLSD(mSelectedListName), true );
+ }
}
void LLFloaterAutoReplaceSettings::updateListNamesControls()
{
- if ( mSelectedListName.empty() )
- {
- // There is no selected list
-
- // Disable all controls that operate on the selected list
- getChild<LLButton>("autoreplace_export_list")->setEnabled(false);
- getChild<LLButton>("autoreplace_delete_list")->setEnabled(false);
- getChild<LLButton>("autoreplace_list_up")->setEnabled(false);
- getChild<LLButton>("autoreplace_list_down")->setEnabled(false);
-
- mReplacementsList->deleteAllItems();
- }
- else
- {
- // Enable the controls that operate on the selected list
- getChild<LLButton>("autoreplace_export_list")->setEnabled(true);
- getChild<LLButton>("autoreplace_delete_list")->setEnabled(true);
- getChild<LLButton>("autoreplace_list_up")->setEnabled(!selectedListIsFirst());
- getChild<LLButton>("autoreplace_list_down")->setEnabled(!selectedListIsLast());
- }
+ if ( mSelectedListName.empty() )
+ {
+ // There is no selected list
+
+ // Disable all controls that operate on the selected list
+ getChild<LLButton>("autoreplace_export_list")->setEnabled(false);
+ getChild<LLButton>("autoreplace_delete_list")->setEnabled(false);
+ getChild<LLButton>("autoreplace_list_up")->setEnabled(false);
+ getChild<LLButton>("autoreplace_list_down")->setEnabled(false);
+
+ mReplacementsList->deleteAllItems();
+ }
+ else
+ {
+ // Enable the controls that operate on the selected list
+ getChild<LLButton>("autoreplace_export_list")->setEnabled(true);
+ getChild<LLButton>("autoreplace_delete_list")->setEnabled(true);
+ getChild<LLButton>("autoreplace_list_up")->setEnabled(!selectedListIsFirst());
+ getChild<LLButton>("autoreplace_list_down")->setEnabled(!selectedListIsLast());
+ }
}
void LLFloaterAutoReplaceSettings::onSelectList()
{
- std::string previousSelectedListName = mSelectedListName;
- // only one selection allowed
- LLSD selected = mListNames->getSelectedValue();
- if (selected.isDefined())
- {
- mSelectedListName = selected.asString();
- LL_DEBUGS("AutoReplace")<<"selected list '"<<mSelectedListName<<"'"<<LL_ENDL;
- }
- else
- {
- mSelectedListName.clear();
- LL_DEBUGS("AutoReplace")<<"unselected"<<LL_ENDL;
- }
-
- updateListNamesControls();
-
- if ( previousSelectedListName != mSelectedListName )
- {
- updateReplacementsList();
- }
+ std::string previousSelectedListName = mSelectedListName;
+ // only one selection allowed
+ LLSD selected = mListNames->getSelectedValue();
+ if (selected.isDefined())
+ {
+ mSelectedListName = selected.asString();
+ LL_DEBUGS("AutoReplace")<<"selected list '"<<mSelectedListName<<"'"<<LL_ENDL;
+ }
+ else
+ {
+ mSelectedListName.clear();
+ LL_DEBUGS("AutoReplace")<<"unselected"<<LL_ENDL;
+ }
+
+ updateListNamesControls();
+
+ if ( previousSelectedListName != mSelectedListName )
+ {
+ updateReplacementsList();
+ }
}
void LLFloaterAutoReplaceSettings::onSelectEntry()
{
LLSD selectedRow = mReplacementsList->getSelectedValue();
- if (selectedRow.isDefined())
- {
- mPreviousKeyword = selectedRow.asString();
- LL_DEBUGS("AutoReplace")<<"selected entry '"<<mPreviousKeyword<<"'"<<LL_ENDL;
- mKeyword->setValue(selectedRow);
- std::string replacement = mSettings.replacementFor(mPreviousKeyword, mSelectedListName );
- mReplacement->setValue(replacement);
- enableReplacementEntry();
- mReplacement->setFocus(true);
- }
- else
- {
- // no entry selection, so the entry panel should be off
- disableReplacementEntry();
- LL_DEBUGS("AutoReplace")<<"no row selected"<<LL_ENDL;
- }
+ if (selectedRow.isDefined())
+ {
+ mPreviousKeyword = selectedRow.asString();
+ LL_DEBUGS("AutoReplace")<<"selected entry '"<<mPreviousKeyword<<"'"<<LL_ENDL;
+ mKeyword->setValue(selectedRow);
+ std::string replacement = mSettings.replacementFor(mPreviousKeyword, mSelectedListName );
+ mReplacement->setValue(replacement);
+ enableReplacementEntry();
+ mReplacement->setFocus(true);
+ }
+ else
+ {
+ // no entry selection, so the entry panel should be off
+ disableReplacementEntry();
+ LL_DEBUGS("AutoReplace")<<"no row selected"<<LL_ENDL;
+ }
}
void LLFloaterAutoReplaceSettings::updateReplacementsList()
{
- // start from scratch, since this should only be called when the list changes
- mReplacementsList->deleteAllItems();
-
- if ( mSelectedListName.empty() )
- {
- mReplacementsList->setEnabled(false);
- getChild<LLButton>("autoreplace_add_entry")->setEnabled(false);
- disableReplacementEntry();
- }
- else
- {
- // Populate the keyword->replacement list from the selected list
- const LLSD* mappings = mSettings.getListEntries(mSelectedListName);
- for ( LLSD::map_const_iterator entry = mappings->beginMap(), end = mappings->endMap();
- entry != end;
- entry++
- )
- {
- LLSD row;
- row["id"] = entry->first;
- row["columns"][0]["column"] = "keyword";
- row["columns"][0]["value"] = entry->first;
- row["columns"][1]["column"] = "replacement";
- row["columns"][1]["value"] = entry->second;
-
- mReplacementsList->addElement(row, ADD_BOTTOM);
- }
-
- mReplacementsList->deselectAllItems(false /* don't call commit */);
- mReplacementsList->setEnabled(true);
-
- getChild<LLButton>("autoreplace_add_entry")->setEnabled(true);
- disableReplacementEntry();
- }
+ // start from scratch, since this should only be called when the list changes
+ mReplacementsList->deleteAllItems();
+
+ if ( mSelectedListName.empty() )
+ {
+ mReplacementsList->setEnabled(false);
+ getChild<LLButton>("autoreplace_add_entry")->setEnabled(false);
+ disableReplacementEntry();
+ }
+ else
+ {
+ // Populate the keyword->replacement list from the selected list
+ const LLSD* mappings = mSettings.getListEntries(mSelectedListName);
+ for ( LLSD::map_const_iterator entry = mappings->beginMap(), end = mappings->endMap();
+ entry != end;
+ entry++
+ )
+ {
+ LLSD row;
+ row["id"] = entry->first;
+ row["columns"][0]["column"] = "keyword";
+ row["columns"][0]["value"] = entry->first;
+ row["columns"][1]["column"] = "replacement";
+ row["columns"][1]["value"] = entry->second;
+
+ mReplacementsList->addElement(row, ADD_BOTTOM);
+ }
+
+ mReplacementsList->deselectAllItems(false /* don't call commit */);
+ mReplacementsList->setEnabled(true);
+
+ getChild<LLButton>("autoreplace_add_entry")->setEnabled(true);
+ disableReplacementEntry();
+ }
}
void LLFloaterAutoReplaceSettings::enableReplacementEntry()
{
- LL_DEBUGS("AutoReplace")<<LL_ENDL;
- mKeyword->setEnabled(true);
- mReplacement->setEnabled(true);
- getChild<LLButton>("autoreplace_save_entry")->setEnabled(true);
- getChild<LLButton>("autoreplace_delete_entry")->setEnabled(true);
+ LL_DEBUGS("AutoReplace")<<LL_ENDL;
+ mKeyword->setEnabled(true);
+ mReplacement->setEnabled(true);
+ getChild<LLButton>("autoreplace_save_entry")->setEnabled(true);
+ getChild<LLButton>("autoreplace_delete_entry")->setEnabled(true);
}
void LLFloaterAutoReplaceSettings::disableReplacementEntry()
{
- LL_DEBUGS("AutoReplace")<<LL_ENDL;
- mPreviousKeyword.clear();
- mKeyword->clear();
- mKeyword->setEnabled(false);
- mReplacement->clear();
- mReplacement->setEnabled(false);
- getChild<LLButton>("autoreplace_save_entry")->setEnabled(false);
- getChild<LLButton>("autoreplace_delete_entry")->setEnabled(false);
+ LL_DEBUGS("AutoReplace")<<LL_ENDL;
+ mPreviousKeyword.clear();
+ mKeyword->clear();
+ mKeyword->setEnabled(false);
+ mReplacement->clear();
+ mReplacement->setEnabled(false);
+ getChild<LLButton>("autoreplace_save_entry")->setEnabled(false);
+ getChild<LLButton>("autoreplace_delete_entry")->setEnabled(false);
}
// called when the global settings checkbox is changed
void LLFloaterAutoReplaceSettings::onAutoReplaceToggled()
{
- // set our local copy of the flag, copied to the global preference in onOk
- mEnabled = childGetValue("autoreplace_enable").asBoolean();
- LL_DEBUGS("AutoReplace")<< "autoreplace_enable " << ( mEnabled ? "on" : "off" ) << LL_ENDL;
+ // set our local copy of the flag, copied to the global preference in onOk
+ mEnabled = childGetValue("autoreplace_enable").asBoolean();
+ LL_DEBUGS("AutoReplace")<< "autoreplace_enable " << ( mEnabled ? "on" : "off" ) << LL_ENDL;
}
// called when the List Up button is pressed
void LLFloaterAutoReplaceSettings::onListUp()
{
- S32 selectedRow = mListNames->getFirstSelectedIndex();
- LLSD selectedName = mListNames->getSelectedValue().asString();
-
- if ( mSettings.increaseListPriority(selectedName) )
- {
- updateListNames();
- updateListNamesControls();
- }
- else
- {
- LL_WARNS("AutoReplace")
- << "invalid row ("<<selectedRow<<") selected '"<<selectedName<<"'"
- <<LL_ENDL;
- }
+ S32 selectedRow = mListNames->getFirstSelectedIndex();
+ LLSD selectedName = mListNames->getSelectedValue().asString();
+
+ if ( mSettings.increaseListPriority(selectedName) )
+ {
+ updateListNames();
+ updateListNamesControls();
+ }
+ else
+ {
+ LL_WARNS("AutoReplace")
+ << "invalid row ("<<selectedRow<<") selected '"<<selectedName<<"'"
+ <<LL_ENDL;
+ }
}
// called when the List Down button is pressed
void LLFloaterAutoReplaceSettings::onListDown()
{
- S32 selectedRow = mListNames->getFirstSelectedIndex();
- std::string selectedName = mListNames->getSelectedValue().asString();
-
- if ( mSettings.decreaseListPriority(selectedName) )
- {
- updateListNames();
- updateListNamesControls();
- }
- else
- {
- LL_WARNS("AutoReplace")
- << "invalid row ("<<selectedRow<<") selected '"<<selectedName<<"'"
- <<LL_ENDL;
- }
+ S32 selectedRow = mListNames->getFirstSelectedIndex();
+ std::string selectedName = mListNames->getSelectedValue().asString();
+
+ if ( mSettings.decreaseListPriority(selectedName) )
+ {
+ updateListNames();
+ updateListNamesControls();
+ }
+ else
+ {
+ LL_WARNS("AutoReplace")
+ << "invalid row ("<<selectedRow<<") selected '"<<selectedName<<"'"
+ <<LL_ENDL;
+ }
}
// called when the Delete Entry button is pressed
void LLFloaterAutoReplaceSettings::onDeleteEntry()
{
LLSD selectedRow = mReplacementsList->getSelectedValue();
- if (selectedRow.isDefined())
- {
- std::string keyword = selectedRow.asString();
- mReplacementsList->deleteSelectedItems(); // delete from the control
- mSettings.removeEntryFromList(keyword, mSelectedListName); // delete from the local settings copy
- disableReplacementEntry(); // no selection active, so turn off the buttons
- }
+ if (selectedRow.isDefined())
+ {
+ std::string keyword = selectedRow.asString();
+ mReplacementsList->deleteSelectedItems(); // delete from the control
+ mSettings.removeEntryFromList(keyword, mSelectedListName); // delete from the local settings copy
+ disableReplacementEntry(); // no selection active, so turn off the buttons
+ }
}
// called when the Import List button is pressed
void LLFloaterAutoReplaceSettings::onImportList()
{
- LLFilePickerReplyThread::startPicker(boost::bind(&LLFloaterAutoReplaceSettings::loadListFromFile, this, _1), LLFilePicker::FFLOAD_XML, false);
+ LLFilePickerReplyThread::startPicker(boost::bind(&LLFloaterAutoReplaceSettings::loadListFromFile, this, _1), LLFilePicker::FFLOAD_XML, false);
}
void LLFloaterAutoReplaceSettings::loadListFromFile(const std::vector<std::string>& filenames)
{
- llifstream file;
- file.open(filenames[0].c_str());
- LLSD newList;
- if (file.is_open())
- {
- LLSDSerialize::fromXMLDocument(newList, file);
- }
- file.close();
-
- switch ( mSettings.addList(newList) )
- {
- case LLAutoReplaceSettings::AddListOk:
- mSelectedListName = LLAutoReplaceSettings::getListName(newList);
-
- updateListNames();
- updateListNamesControls();
- updateReplacementsList();
- break;
-
- case LLAutoReplaceSettings::AddListDuplicateName:
- {
- std::string newName = LLAutoReplaceSettings::getListName(newList);
- LL_WARNS("AutoReplace")<<"name '"<<newName<<"' is in use; prompting for new name"<<LL_ENDL;
- LLSD newPayload;
- newPayload["list"] = newList;
- LLSD args;
- args["DUPNAME"] = newName;
-
- LLNotificationsUtil::add("RenameAutoReplaceList", args, newPayload,
- boost::bind(&LLFloaterAutoReplaceSettings::callbackListNameConflict, this, _1, _2));
- }
- break;
-
- case LLAutoReplaceSettings::AddListInvalidList:
- LLNotificationsUtil::add("InvalidAutoReplaceList");
- LL_WARNS("AutoReplace") << "imported list was invalid" << LL_ENDL;
-
- mSelectedListName.clear();
- updateListNames();
- updateListNamesControls();
- updateReplacementsList();
- break;
-
- default:
- LL_ERRS("AutoReplace") << "invalid AddListResult" << LL_ENDL;
-
- }
+ llifstream file;
+ file.open(filenames[0].c_str());
+ LLSD newList;
+ if (file.is_open())
+ {
+ LLSDSerialize::fromXMLDocument(newList, file);
+ }
+ file.close();
+
+ switch ( mSettings.addList(newList) )
+ {
+ case LLAutoReplaceSettings::AddListOk:
+ mSelectedListName = LLAutoReplaceSettings::getListName(newList);
+
+ updateListNames();
+ updateListNamesControls();
+ updateReplacementsList();
+ break;
+
+ case LLAutoReplaceSettings::AddListDuplicateName:
+ {
+ std::string newName = LLAutoReplaceSettings::getListName(newList);
+ LL_WARNS("AutoReplace")<<"name '"<<newName<<"' is in use; prompting for new name"<<LL_ENDL;
+ LLSD newPayload;
+ newPayload["list"] = newList;
+ LLSD args;
+ args["DUPNAME"] = newName;
+
+ LLNotificationsUtil::add("RenameAutoReplaceList", args, newPayload,
+ boost::bind(&LLFloaterAutoReplaceSettings::callbackListNameConflict, this, _1, _2));
+ }
+ break;
+
+ case LLAutoReplaceSettings::AddListInvalidList:
+ LLNotificationsUtil::add("InvalidAutoReplaceList");
+ LL_WARNS("AutoReplace") << "imported list was invalid" << LL_ENDL;
+
+ mSelectedListName.clear();
+ updateListNames();
+ updateListNamesControls();
+ updateReplacementsList();
+ break;
+
+ default:
+ LL_ERRS("AutoReplace") << "invalid AddListResult" << LL_ENDL;
+
+ }
}
void LLFloaterAutoReplaceSettings::onNewList()
{
- LLSD payload;
- LLSD emptyList;
- LLAutoReplaceSettings::createEmptyList(emptyList);
- payload["list"] = emptyList;
+ LLSD payload;
+ LLSD emptyList;
+ LLAutoReplaceSettings::createEmptyList(emptyList);
+ payload["list"] = emptyList;
LLSD args;
-
- LLNotificationsUtil::add("AddAutoReplaceList", args, payload,
- boost::bind(&LLFloaterAutoReplaceSettings::callbackNewListName, this, _1, _2));
+
+ LLNotificationsUtil::add("AddAutoReplaceList", args, payload,
+ boost::bind(&LLFloaterAutoReplaceSettings::callbackNewListName, this, _1, _2));
}
bool LLFloaterAutoReplaceSettings::callbackNewListName(const LLSD& notification, const LLSD& response)
{
- LL_DEBUGS("AutoReplace")<<"called"<<LL_ENDL;
-
- LLSD newList = notification["payload"]["list"];
-
- if ( response.has("listname") && response["listname"].isString() )
- {
- std::string newName = response["listname"].asString();
- LLAutoReplaceSettings::setListName(newList, newName);
-
- switch ( mSettings.addList(newList) )
- {
- case LLAutoReplaceSettings::AddListOk:
- LL_INFOS("AutoReplace") << "added new list '"<<newName<<"'"<<LL_ENDL;
- mSelectedListName = newName;
- updateListNames();
- updateListNamesControls();
- updateReplacementsList();
- break;
-
- case LLAutoReplaceSettings::AddListDuplicateName:
- {
- LL_WARNS("AutoReplace")<<"name '"<<newName<<"' is in use; prompting for new name"<<LL_ENDL;
- LLSD newPayload;
- newPayload["list"] = notification["payload"]["list"];
- LLSD args;
- args["DUPNAME"] = newName;
-
- LLNotificationsUtil::add("RenameAutoReplaceList", args, newPayload,
- boost::bind(&LLFloaterAutoReplaceSettings::callbackListNameConflict, this, _1, _2));
- }
- break;
-
- case LLAutoReplaceSettings::AddListInvalidList:
- LLNotificationsUtil::add("InvalidAutoReplaceList");
-
- mSelectedListName.clear();
- updateListNames();
- updateListNamesControls();
- updateReplacementsList();
- break;
-
- default:
- LL_ERRS("AutoReplace") << "invalid AddListResult" << LL_ENDL;
- }
- }
- else
- {
- LL_ERRS("AutoReplace") << "adding notification response" << LL_ENDL;
- }
- return false;
+ LL_DEBUGS("AutoReplace")<<"called"<<LL_ENDL;
+
+ LLSD newList = notification["payload"]["list"];
+
+ if ( response.has("listname") && response["listname"].isString() )
+ {
+ std::string newName = response["listname"].asString();
+ LLAutoReplaceSettings::setListName(newList, newName);
+
+ switch ( mSettings.addList(newList) )
+ {
+ case LLAutoReplaceSettings::AddListOk:
+ LL_INFOS("AutoReplace") << "added new list '"<<newName<<"'"<<LL_ENDL;
+ mSelectedListName = newName;
+ updateListNames();
+ updateListNamesControls();
+ updateReplacementsList();
+ break;
+
+ case LLAutoReplaceSettings::AddListDuplicateName:
+ {
+ LL_WARNS("AutoReplace")<<"name '"<<newName<<"' is in use; prompting for new name"<<LL_ENDL;
+ LLSD newPayload;
+ newPayload["list"] = notification["payload"]["list"];
+ LLSD args;
+ args["DUPNAME"] = newName;
+
+ LLNotificationsUtil::add("RenameAutoReplaceList", args, newPayload,
+ boost::bind(&LLFloaterAutoReplaceSettings::callbackListNameConflict, this, _1, _2));
+ }
+ break;
+
+ case LLAutoReplaceSettings::AddListInvalidList:
+ LLNotificationsUtil::add("InvalidAutoReplaceList");
+
+ mSelectedListName.clear();
+ updateListNames();
+ updateListNamesControls();
+ updateReplacementsList();
+ break;
+
+ default:
+ LL_ERRS("AutoReplace") << "invalid AddListResult" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_ERRS("AutoReplace") << "adding notification response" << LL_ENDL;
+ }
+ return false;
}
// callback for the RenameAutoReplaceList notification
bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notification, const LLSD& response)
{
- LLSD newList = notification["payload"]["list"];
- std::string listName = LLAutoReplaceSettings::getListName(newList);
-
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch ( option )
- {
- case 0:
- // Replace current list
- if ( LLAutoReplaceSettings::AddListOk == mSettings.replaceList(newList) )
- {
- LL_INFOS("AutoReplace") << "replaced list '"<<listName<<"'"<<LL_ENDL;
- mSelectedListName = listName;
- updateListNames();
- updateListNamesControls();
- updateReplacementsList();
- }
- else
- {
- LL_WARNS("AutoReplace")<<"failed to replace list '"<<listName<<"'"<<LL_ENDL;
- }
- break;
-
- case 1:
- // Use New Name
- LL_INFOS("AutoReplace")<<"option 'use new name' selected"<<LL_ENDL;
- callbackNewListName(notification, response);
- break;
-
- default:
- LL_ERRS("AutoReplace")<<"invalid selected option "<<option<<LL_ENDL;
- }
-
- return false;
+ LLSD newList = notification["payload"]["list"];
+ std::string listName = LLAutoReplaceSettings::getListName(newList);
+
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch ( option )
+ {
+ case 0:
+ // Replace current list
+ if ( LLAutoReplaceSettings::AddListOk == mSettings.replaceList(newList) )
+ {
+ LL_INFOS("AutoReplace") << "replaced list '"<<listName<<"'"<<LL_ENDL;
+ mSelectedListName = listName;
+ updateListNames();
+ updateListNamesControls();
+ updateReplacementsList();
+ }
+ else
+ {
+ LL_WARNS("AutoReplace")<<"failed to replace list '"<<listName<<"'"<<LL_ENDL;
+ }
+ break;
+
+ case 1:
+ // Use New Name
+ LL_INFOS("AutoReplace")<<"option 'use new name' selected"<<LL_ENDL;
+ callbackNewListName(notification, response);
+ break;
+
+ default:
+ LL_ERRS("AutoReplace")<<"invalid selected option "<<option<<LL_ENDL;
+ }
+
+ return false;
}
void LLFloaterAutoReplaceSettings::onDeleteList()
{
- std::string listName = mListNames->getSelectedValue().asString();
- if ( ! listName.empty() )
- {
- if ( mSettings.removeReplacementList(listName) )
- {
- LL_INFOS("AutoReplace")<<"deleted list '"<<listName<<"'"<<LL_ENDL;
- mReplacementsList->deleteSelectedItems(); // remove from the scrolling list
- mSelectedListName.clear();
- updateListNames();
- updateListNamesControls();
- updateReplacementsList();
- }
- else
- {
- LL_WARNS("AutoReplace")<<"failed to delete list '"<<listName<<"'"<<LL_ENDL;
- }
- }
- else
- {
- LL_DEBUGS("AutoReplace")<<"no list selected for delete"<<LL_ENDL;
- }
+ std::string listName = mListNames->getSelectedValue().asString();
+ if ( ! listName.empty() )
+ {
+ if ( mSettings.removeReplacementList(listName) )
+ {
+ LL_INFOS("AutoReplace")<<"deleted list '"<<listName<<"'"<<LL_ENDL;
+ mReplacementsList->deleteSelectedItems(); // remove from the scrolling list
+ mSelectedListName.clear();
+ updateListNames();
+ updateListNamesControls();
+ updateReplacementsList();
+ }
+ else
+ {
+ LL_WARNS("AutoReplace")<<"failed to delete list '"<<listName<<"'"<<LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("AutoReplace")<<"no list selected for delete"<<LL_ENDL;
+ }
}
void LLFloaterAutoReplaceSettings::onExportList()
{
- std::string listName=mListNames->getFirstSelected()->getColumn(0)->getValue().asString();
- std::string listFileName = listName + ".xml";
- LLFilePickerReplyThread::startPicker(boost::bind(&LLFloaterAutoReplaceSettings::saveListToFile, this, _1, listName), LLFilePicker::FFSAVE_XML, listFileName);
+ std::string listName=mListNames->getFirstSelected()->getColumn(0)->getValue().asString();
+ std::string listFileName = listName + ".xml";
+ LLFilePickerReplyThread::startPicker(boost::bind(&LLFloaterAutoReplaceSettings::saveListToFile, this, _1, listName), LLFilePicker::FFSAVE_XML, listFileName);
}
void LLFloaterAutoReplaceSettings::saveListToFile(const std::vector<std::string>& filenames, std::string listName)
{
- llofstream file;
- const LLSD* list = mSettings.exportList(listName);
- file.open(filenames[0].c_str());
- LLSDSerialize::toPrettyXML(*list, file);
- file.close();
+ llofstream file;
+ const LLSD* list = mSettings.exportList(listName);
+ file.open(filenames[0].c_str());
+ LLSDSerialize::toPrettyXML(*list, file);
+ file.close();
}
void LLFloaterAutoReplaceSettings::onAddEntry()
{
- mPreviousKeyword.clear();
- mReplacementsList->deselectAllItems(false /* don't call commit */);
- mKeyword->clear();
- mReplacement->clear();
- enableReplacementEntry();
- mKeyword->setFocus(true);
+ mPreviousKeyword.clear();
+ mReplacementsList->deselectAllItems(false /* don't call commit */);
+ mKeyword->clear();
+ mReplacement->clear();
+ enableReplacementEntry();
+ mKeyword->setFocus(true);
}
void LLFloaterAutoReplaceSettings::onSaveEntry()
{
- LL_DEBUGS("AutoReplace")<<"called"<<LL_ENDL;
-
- if ( ! mPreviousKeyword.empty() )
- {
- // delete any existing value for the key that was editted
- LL_INFOS("AutoReplace")
- << "list '" << mSelectedListName << "' "
- << "removed '" << mPreviousKeyword
- << "'" << LL_ENDL;
- mSettings.removeEntryFromList( mPreviousKeyword, mSelectedListName );
- }
-
- LLWString keyword = mKeyword->getWText();
- LLWString replacement = mReplacement->getWText();
- if ( mSettings.addEntryToList(keyword, replacement, mSelectedListName) )
- {
- // insert the new keyword->replacement pair
- LL_INFOS("AutoReplace")
- << "list '" << mSelectedListName << "' "
- << "added '" << wstring_to_utf8str(keyword)
- << "' -> '" << wstring_to_utf8str(replacement)
- << "'" << LL_ENDL;
-
- updateReplacementsList();
- }
- else
- {
- LLNotificationsUtil::add("InvalidAutoReplaceEntry");
- LL_WARNS("AutoReplace")<<"invalid entry "
- << "keyword '" << wstring_to_utf8str(keyword)
- << "' replacement '" << wstring_to_utf8str(replacement)
- << "'" << LL_ENDL;
- }
+ LL_DEBUGS("AutoReplace")<<"called"<<LL_ENDL;
+
+ if ( ! mPreviousKeyword.empty() )
+ {
+ // delete any existing value for the key that was editted
+ LL_INFOS("AutoReplace")
+ << "list '" << mSelectedListName << "' "
+ << "removed '" << mPreviousKeyword
+ << "'" << LL_ENDL;
+ mSettings.removeEntryFromList( mPreviousKeyword, mSelectedListName );
+ }
+
+ LLWString keyword = mKeyword->getWText();
+ LLWString replacement = mReplacement->getWText();
+ if ( mSettings.addEntryToList(keyword, replacement, mSelectedListName) )
+ {
+ // insert the new keyword->replacement pair
+ LL_INFOS("AutoReplace")
+ << "list '" << mSelectedListName << "' "
+ << "added '" << wstring_to_utf8str(keyword)
+ << "' -> '" << wstring_to_utf8str(replacement)
+ << "'" << LL_ENDL;
+
+ updateReplacementsList();
+ }
+ else
+ {
+ LLNotificationsUtil::add("InvalidAutoReplaceEntry");
+ LL_WARNS("AutoReplace")<<"invalid entry "
+ << "keyword '" << wstring_to_utf8str(keyword)
+ << "' replacement '" << wstring_to_utf8str(replacement)
+ << "'" << LL_ENDL;
+ }
}
void LLFloaterAutoReplaceSettings::onCancel()
{
- cleanUp();
- closeFloater(false /* not quitting */);
+ cleanUp();
+ closeFloater(false /* not quitting */);
}
void LLFloaterAutoReplaceSettings::onSaveChanges()
{
- // put our local copy of the settings into the active copy
- LLAutoReplace::getInstance()->setSettings( mSettings );
- // save our local copy of the global feature enable/disable value
- gSavedSettings.setBOOL("AutoReplace", mEnabled);
- cleanUp();
- closeFloater(false /* not quitting */);
+ // put our local copy of the settings into the active copy
+ LLAutoReplace::getInstance()->setSettings( mSettings );
+ // save our local copy of the global feature enable/disable value
+ gSavedSettings.setBOOL("AutoReplace", mEnabled);
+ cleanUp();
+ closeFloater(false /* not quitting */);
}
void LLFloaterAutoReplaceSettings::cleanUp()
@@ -619,41 +619,41 @@ void LLFloaterAutoReplaceSettings::cleanUp()
bool LLFloaterAutoReplaceSettings::selectedListIsFirst()
{
- bool isFirst = false;
-
- if (!mSelectedListName.empty())
- {
- LLSD lists = mSettings.getListNames(); // an Array of Strings
- LLSD first = lists.get(0);
- if ( first.isString() && first.asString() == mSelectedListName )
- {
- isFirst = true;
- }
- }
- return isFirst;
+ bool isFirst = false;
+
+ if (!mSelectedListName.empty())
+ {
+ LLSD lists = mSettings.getListNames(); // an Array of Strings
+ LLSD first = lists.get(0);
+ if ( first.isString() && first.asString() == mSelectedListName )
+ {
+ isFirst = true;
+ }
+ }
+ return isFirst;
}
bool LLFloaterAutoReplaceSettings::selectedListIsLast()
{
- bool isLast = false;
-
- if (!mSelectedListName.empty())
- {
- LLSD last;
- LLSD lists = mSettings.getListNames(); // an Array of Strings
- for ( LLSD::array_const_iterator list = lists.beginArray(), listEnd = lists.endArray();
- list != listEnd;
- list++
- )
- {
- last = *list;
- }
- if ( last.isString() && last.asString() == mSelectedListName )
- {
- isLast = true;
- }
- }
- return isLast;
+ bool isLast = false;
+
+ if (!mSelectedListName.empty())
+ {
+ LLSD last;
+ LLSD lists = mSettings.getListNames(); // an Array of Strings
+ for ( LLSD::array_const_iterator list = lists.beginArray(), listEnd = lists.endArray();
+ list != listEnd;
+ list++
+ )
+ {
+ last = *list;
+ }
+ if ( last.isString() && last.asString() == mSelectedListName )
+ {
+ isLast = true;
+ }
+ }
+ return isLast;
}
/* TBD
diff --git a/indra/newview/llfloaterautoreplacesettings.h b/indra/newview/llfloaterautoreplacesettings.h
index 2109aa7026..7f1953d485 100644
--- a/indra/newview/llfloaterautoreplacesettings.h
+++ b/indra/newview/llfloaterautoreplacesettings.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterautoreplacesettings.h
* @brief Auto Replace List floater
* @copyright Copyright (c) 2011 LordGregGreg Back
@@ -11,12 +11,12 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -38,83 +38,83 @@
class LLFloaterAutoReplaceSettings : public LLFloater
{
public:
- LLFloaterAutoReplaceSettings(const LLSD& key);
+ LLFloaterAutoReplaceSettings(const LLSD& key);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onClose(bool app_quitting);
- void setData(void * data);
+ void setData(void * data);
private:
- /** @{ @name Local Copies of Settings
- * These are populated in the postBuild method with the values
- * current when the floater is instantiated, and then either
- * discarded when Cancel is pressed, or copied back to the active
- * settings if Ok is pressed.
- */
- bool mEnabled; ///< the global preference for AutoReplace
- LLAutoReplaceSettings mSettings; ///< settings being modified
- /** @} */
-
- /// convenience variable - the name of the currently selected list (if any)
- std::string mSelectedListName;
- /// the scrolling list of list names (one column, no headings, order manually controlled)
- LLScrollListCtrl* mListNames;
- /// the scroling list of keyword->replacement pairs
- LLScrollListCtrl* mReplacementsList;
-
- /// the keyword for the entry editing pane
- LLLineEditor* mKeyword;
- /// saved keyword value
- std::string mPreviousKeyword;
- /// the replacement for the entry editing pane
- LLLineEditor* mReplacement;
-
- /// callback for when the feature enable/disable checkbox changes
- void onAutoReplaceToggled();
- /// callback for when an entry in the list of list names is selected
- void onSelectList();
-
- void onImportList();
- void onExportList();
- void onNewList();
- void onDeleteList();
-
- void onListUp();
- void onListDown();
-
- void onSelectEntry();
- void onAddEntry();
- void onDeleteEntry();
- void onSaveEntry();
-
- void onSaveChanges();
- void onCancel();
-
- /// updates the contents of the mListNames
- void updateListNames();
- /// updates the controls associated with mListNames (depends on whether a name is selected or not)
- void updateListNamesControls();
- /// updates the contents of the mReplacementsList
- void updateReplacementsList();
- /// enables the components that should only be active when a keyword is selected
- void enableReplacementEntry();
- /// disables the components that should only be active when a keyword is selected
- void disableReplacementEntry();
-
- /// called from the AddAutoReplaceList notification dialog
- bool callbackNewListName(const LLSD& notification, const LLSD& response);
- /// called from the RenameAutoReplaceList notification dialog
- bool callbackListNameConflict(const LLSD& notification, const LLSD& response);
-
- bool selectedListIsFirst();
- bool selectedListIsLast();
-
- void cleanUp();
-
- void loadListFromFile(const std::vector<std::string>& filenames);
- void saveListToFile(const std::vector<std::string>& filenames, std::string listName);
+ /** @{ @name Local Copies of Settings
+ * These are populated in the postBuild method with the values
+ * current when the floater is instantiated, and then either
+ * discarded when Cancel is pressed, or copied back to the active
+ * settings if Ok is pressed.
+ */
+ bool mEnabled; ///< the global preference for AutoReplace
+ LLAutoReplaceSettings mSettings; ///< settings being modified
+ /** @} */
+
+ /// convenience variable - the name of the currently selected list (if any)
+ std::string mSelectedListName;
+ /// the scrolling list of list names (one column, no headings, order manually controlled)
+ LLScrollListCtrl* mListNames;
+ /// the scroling list of keyword->replacement pairs
+ LLScrollListCtrl* mReplacementsList;
+
+ /// the keyword for the entry editing pane
+ LLLineEditor* mKeyword;
+ /// saved keyword value
+ std::string mPreviousKeyword;
+ /// the replacement for the entry editing pane
+ LLLineEditor* mReplacement;
+
+ /// callback for when the feature enable/disable checkbox changes
+ void onAutoReplaceToggled();
+ /// callback for when an entry in the list of list names is selected
+ void onSelectList();
+
+ void onImportList();
+ void onExportList();
+ void onNewList();
+ void onDeleteList();
+
+ void onListUp();
+ void onListDown();
+
+ void onSelectEntry();
+ void onAddEntry();
+ void onDeleteEntry();
+ void onSaveEntry();
+
+ void onSaveChanges();
+ void onCancel();
+
+ /// updates the contents of the mListNames
+ void updateListNames();
+ /// updates the controls associated with mListNames (depends on whether a name is selected or not)
+ void updateListNamesControls();
+ /// updates the contents of the mReplacementsList
+ void updateReplacementsList();
+ /// enables the components that should only be active when a keyword is selected
+ void enableReplacementEntry();
+ /// disables the components that should only be active when a keyword is selected
+ void disableReplacementEntry();
+
+ /// called from the AddAutoReplaceList notification dialog
+ bool callbackNewListName(const LLSD& notification, const LLSD& response);
+ /// called from the RenameAutoReplaceList notification dialog
+ bool callbackListNameConflict(const LLSD& notification, const LLSD& response);
+
+ bool selectedListIsFirst();
+ bool selectedListIsLast();
+
+ void cleanUp();
+
+ void loadListFromFile(const std::vector<std::string>& filenames);
+ void saveListToFile(const std::vector<std::string>& filenames, std::string listName);
};
#endif // LLFLOATERAUTOREPLACESETTINGS_H
diff --git a/indra/newview/llfloateravatar.cpp b/indra/newview/llfloateravatar.cpp
index f888d032ae..929a7addb4 100644
--- a/indra/newview/llfloateravatar.cpp
+++ b/indra/newview/llfloateravatar.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloateravatar.h
* @author Leyla Farazha
* @brief floater for the avatar changer
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,18 +38,18 @@
LLFloaterAvatar::LLFloaterAvatar(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
}
LLFloaterAvatar::~LLFloaterAvatar()
{
- if (mAvatarPicker)
- {
- mAvatarPicker->navigateStop();
+ if (mAvatarPicker)
+ {
+ mAvatarPicker->navigateStop();
mAvatarPicker->clearCache(); //images are reloading each time already
mAvatarPicker->unloadMediaSource();
- }
+ }
}
BOOL LLFloaterAvatar::postBuild()
@@ -59,8 +59,8 @@ BOOL LLFloaterAvatar::postBuild()
{
mAvatarPicker->clearCache();
}
- enableResizeCtrls(true, true, false);
- return TRUE;
+ enableResizeCtrls(true, true, false);
+ return TRUE;
}
diff --git a/indra/newview/llfloateravatar.h b/indra/newview/llfloateravatar.h
index 76e9372709..0832eef665 100644
--- a/indra/newview/llfloateravatar.h
+++ b/indra/newview/llfloateravatar.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloateravatar.h
* @author Leyla Farazha
* @brief floater for the avatar changer
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,13 +32,13 @@
class LLMediaCtrl;
class LLFloaterAvatar:
- public LLFloater
+ public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
private:
- LLFloaterAvatar(const LLSD& key);
- /*virtual*/ ~LLFloaterAvatar();
- /*virtual*/ BOOL postBuild();
+ LLFloaterAvatar(const LLSD& key);
+ /*virtual*/ ~LLFloaterAvatar();
+ /*virtual*/ BOOL postBuild();
LLMediaCtrl* mAvatarPicker;
};
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index 42ef41017a..cf665ca87d 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloateravatarpicker.cpp
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,14 +32,14 @@
#include "llcallingcard.h"
#include "llfocusmgr.h"
#include "llfloaterreg.h"
-#include "llimview.h" // for gIMMgr
-#include "lltooldraganddrop.h" // for LLToolDragAndDrop
+#include "llimview.h" // for gIMMgr
+#include "lltooldraganddrop.h" // for LLToolDragAndDrop
#include "llviewercontrol.h"
-#include "llviewerregion.h" // getCapability()
+#include "llviewerregion.h" // getCapability()
#include "llworld.h"
// Linden libraries
-#include "llavatarnamecache.h" // IDEVO
+#include "llavatarnamecache.h" // IDEVO
#include "llbutton.h"
#include "llcachename.h"
#include "lllineeditor.h"
@@ -61,57 +61,57 @@ static const U32 AVATAR_PICKER_SEARCH_TIMEOUT = 180U;
static std::map<LLUUID, LLAvatarName> sAvatarNameMap;
LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback,
- BOOL allow_multiple,
- BOOL closeOnSelect,
- BOOL skip_agent,
+ BOOL allow_multiple,
+ BOOL closeOnSelect,
+ BOOL skip_agent,
const std::string& name,
LLView * frustumOrigin)
{
- // *TODO: Use a key to allow this not to be an effective singleton
- LLFloaterAvatarPicker* floater =
- LLFloaterReg::showTypedInstance<LLFloaterAvatarPicker>("avatar_picker", LLSD(name));
- if (!floater)
- {
- LL_WARNS() << "Cannot instantiate avatar picker" << LL_ENDL;
- return NULL;
- }
-
- floater->mSelectionCallback = callback;
- floater->setAllowMultiple(allow_multiple);
- floater->mNearMeListComplete = FALSE;
- floater->mCloseOnSelect = closeOnSelect;
- floater->mExcludeAgentFromSearchResults = skip_agent;
-
- if (!closeOnSelect)
- {
- // Use Select/Close
- std::string select_string = floater->getString("Select");
- std::string close_string = floater->getString("Close");
- floater->getChild<LLButton>("ok_btn")->setLabel(select_string);
- floater->getChild<LLButton>("cancel_btn")->setLabel(close_string);
- }
+ // *TODO: Use a key to allow this not to be an effective singleton
+ LLFloaterAvatarPicker* floater =
+ LLFloaterReg::showTypedInstance<LLFloaterAvatarPicker>("avatar_picker", LLSD(name));
+ if (!floater)
+ {
+ LL_WARNS() << "Cannot instantiate avatar picker" << LL_ENDL;
+ return NULL;
+ }
+
+ floater->mSelectionCallback = callback;
+ floater->setAllowMultiple(allow_multiple);
+ floater->mNearMeListComplete = FALSE;
+ floater->mCloseOnSelect = closeOnSelect;
+ floater->mExcludeAgentFromSearchResults = skip_agent;
+
+ if (!closeOnSelect)
+ {
+ // Use Select/Close
+ std::string select_string = floater->getString("Select");
+ std::string close_string = floater->getString("Close");
+ floater->getChild<LLButton>("ok_btn")->setLabel(select_string);
+ floater->getChild<LLButton>("cancel_btn")->setLabel(close_string);
+ }
if(frustumOrigin)
{
floater->mFrustumOrigin = frustumOrigin->getHandle();
}
- return floater;
+ return floater;
}
// Default constructor
LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key)
: LLFloater(key),
- mNumResultsReturned(0),
- mNearMeListComplete(FALSE),
- mCloseOnSelect(FALSE),
+ mNumResultsReturned(0),
+ mNearMeListComplete(FALSE),
+ mCloseOnSelect(FALSE),
mExcludeAgentFromSearchResults(FALSE),
- mContextConeOpacity (0.f),
+ mContextConeOpacity (0.f),
mContextConeInAlpha(0.f),
mContextConeOutAlpha(0.f),
mContextConeFadeTime(0.f)
{
- mCommitCallbackRegistrar.add("Refresh.FriendList", boost::bind(&LLFloaterAvatarPicker::populateFriend, this));
+ mCommitCallbackRegistrar.add("Refresh.FriendList", boost::bind(&LLFloaterAvatarPicker::populateFriend, this));
mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha");
mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha");
@@ -120,244 +120,244 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key)
BOOL LLFloaterAvatarPicker::postBuild()
{
- getChild<LLLineEditor>("Edit")->setKeystrokeCallback( boost::bind(&LLFloaterAvatarPicker::editKeystroke, this, _1, _2),NULL);
-
- childSetAction("Find", boost::bind(&LLFloaterAvatarPicker::onBtnFind, this));
- getChildView("Find")->setEnabled(FALSE);
- childSetAction("Refresh", boost::bind(&LLFloaterAvatarPicker::onBtnRefresh, this));
- getChild<LLUICtrl>("near_me_range")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onRangeAdjust, this));
-
- LLScrollListCtrl* searchresults = getChild<LLScrollListCtrl>("SearchResults");
- searchresults->setDoubleClickCallback( boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
- searchresults->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this));
- getChildView("SearchResults")->setEnabled(FALSE);
-
- LLScrollListCtrl* nearme = getChild<LLScrollListCtrl>("NearMe");
- nearme->setDoubleClickCallback(boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
- nearme->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this));
-
- LLScrollListCtrl* friends = getChild<LLScrollListCtrl>("Friends");
- friends->setDoubleClickCallback(boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
- getChild<LLUICtrl>("Friends")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this));
-
- childSetAction("ok_btn", boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
- getChildView("ok_btn")->setEnabled(FALSE);
- childSetAction("cancel_btn", boost::bind(&LLFloaterAvatarPicker::onBtnClose, this));
-
- getChild<LLUICtrl>("Edit")->setFocus(TRUE);
-
- LLPanel* search_panel = getChild<LLPanel>("SearchPanel");
- if (search_panel)
- {
- // Start searching when Return is pressed in the line editor.
- search_panel->setDefaultBtn("Find");
- }
-
- getChild<LLScrollListCtrl>("SearchResults")->setCommentText(getString("no_results"));
-
- getChild<LLTabContainer>("ResidentChooserTabs")->setCommitCallback(
- boost::bind(&LLFloaterAvatarPicker::onTabChanged, this));
-
- setAllowMultiple(FALSE);
-
- center();
-
- populateFriend();
-
- return TRUE;
+ getChild<LLLineEditor>("Edit")->setKeystrokeCallback( boost::bind(&LLFloaterAvatarPicker::editKeystroke, this, _1, _2),NULL);
+
+ childSetAction("Find", boost::bind(&LLFloaterAvatarPicker::onBtnFind, this));
+ getChildView("Find")->setEnabled(FALSE);
+ childSetAction("Refresh", boost::bind(&LLFloaterAvatarPicker::onBtnRefresh, this));
+ getChild<LLUICtrl>("near_me_range")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onRangeAdjust, this));
+
+ LLScrollListCtrl* searchresults = getChild<LLScrollListCtrl>("SearchResults");
+ searchresults->setDoubleClickCallback( boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
+ searchresults->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this));
+ getChildView("SearchResults")->setEnabled(FALSE);
+
+ LLScrollListCtrl* nearme = getChild<LLScrollListCtrl>("NearMe");
+ nearme->setDoubleClickCallback(boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
+ nearme->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this));
+
+ LLScrollListCtrl* friends = getChild<LLScrollListCtrl>("Friends");
+ friends->setDoubleClickCallback(boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
+ getChild<LLUICtrl>("Friends")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this));
+
+ childSetAction("ok_btn", boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
+ getChildView("ok_btn")->setEnabled(FALSE);
+ childSetAction("cancel_btn", boost::bind(&LLFloaterAvatarPicker::onBtnClose, this));
+
+ getChild<LLUICtrl>("Edit")->setFocus(TRUE);
+
+ LLPanel* search_panel = getChild<LLPanel>("SearchPanel");
+ if (search_panel)
+ {
+ // Start searching when Return is pressed in the line editor.
+ search_panel->setDefaultBtn("Find");
+ }
+
+ getChild<LLScrollListCtrl>("SearchResults")->setCommentText(getString("no_results"));
+
+ getChild<LLTabContainer>("ResidentChooserTabs")->setCommitCallback(
+ boost::bind(&LLFloaterAvatarPicker::onTabChanged, this));
+
+ setAllowMultiple(FALSE);
+
+ center();
+
+ populateFriend();
+
+ return TRUE;
}
void LLFloaterAvatarPicker::setOkBtnEnableCb(validate_callback_t cb)
{
- mOkButtonValidateSignal.connect(cb);
+ mOkButtonValidateSignal.connect(cb);
}
void LLFloaterAvatarPicker::onTabChanged()
{
- getChildView("ok_btn")->setEnabled(isSelectBtnEnabled());
+ getChildView("ok_btn")->setEnabled(isSelectBtnEnabled());
}
// Destroys the object
LLFloaterAvatarPicker::~LLFloaterAvatarPicker()
{
- gFocusMgr.releaseFocusIfNeeded( this );
+ gFocusMgr.releaseFocusIfNeeded( this );
}
void LLFloaterAvatarPicker::onBtnFind()
{
- find();
+ find();
}
static void getSelectedAvatarData(const LLScrollListCtrl* from, uuid_vec_t& avatar_ids, std::vector<LLAvatarName>& avatar_names)
{
- std::vector<LLScrollListItem*> items = from->getAllSelected();
- for (std::vector<LLScrollListItem*>::iterator iter = items.begin(); iter != items.end(); ++iter)
- {
- LLScrollListItem* item = *iter;
- if (item->getUUID().notNull())
- {
- avatar_ids.push_back(item->getUUID());
-
- std::map<LLUUID, LLAvatarName>::iterator iter = sAvatarNameMap.find(item->getUUID());
- if (iter != sAvatarNameMap.end())
- {
- avatar_names.push_back(iter->second);
- }
- else
- {
- // the only case where it isn't in the name map is friends
- // but it should be in the name cache
- LLAvatarName av_name;
- LLAvatarNameCache::get(item->getUUID(), &av_name);
- avatar_names.push_back(av_name);
- }
- }
- }
+ std::vector<LLScrollListItem*> items = from->getAllSelected();
+ for (std::vector<LLScrollListItem*>::iterator iter = items.begin(); iter != items.end(); ++iter)
+ {
+ LLScrollListItem* item = *iter;
+ if (item->getUUID().notNull())
+ {
+ avatar_ids.push_back(item->getUUID());
+
+ std::map<LLUUID, LLAvatarName>::iterator iter = sAvatarNameMap.find(item->getUUID());
+ if (iter != sAvatarNameMap.end())
+ {
+ avatar_names.push_back(iter->second);
+ }
+ else
+ {
+ // the only case where it isn't in the name map is friends
+ // but it should be in the name cache
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(item->getUUID(), &av_name);
+ avatar_names.push_back(av_name);
+ }
+ }
+ }
}
void LLFloaterAvatarPicker::onBtnSelect()
{
- // If select btn not enabled then do not callback
- if (!isSelectBtnEnabled())
- return;
-
- if(mSelectionCallback)
- {
- std::string acvtive_panel_name;
- LLScrollListCtrl* list = NULL;
- LLPanel* active_panel = getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel();
- if(active_panel)
- {
- acvtive_panel_name = active_panel->getName();
- }
- if(acvtive_panel_name == "SearchPanel")
- {
- list = getChild<LLScrollListCtrl>("SearchResults");
- }
- else if(acvtive_panel_name == "NearMePanel")
- {
- list = getChild<LLScrollListCtrl>("NearMe");
- }
- else if (acvtive_panel_name == "FriendsPanel")
- {
- list = getChild<LLScrollListCtrl>("Friends");
- }
-
- if(list)
- {
- uuid_vec_t avatar_ids;
- std::vector<LLAvatarName> avatar_names;
- getSelectedAvatarData(list, avatar_ids, avatar_names);
- mSelectionCallback(avatar_ids, avatar_names);
- }
- }
- getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE);
- getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE);
- getChild<LLScrollListCtrl>("Friends")->deselectAllItems(TRUE);
- if(mCloseOnSelect)
- {
- mCloseOnSelect = FALSE;
- closeFloater();
- }
+ // If select btn not enabled then do not callback
+ if (!isSelectBtnEnabled())
+ return;
+
+ if(mSelectionCallback)
+ {
+ std::string acvtive_panel_name;
+ LLScrollListCtrl* list = NULL;
+ LLPanel* active_panel = getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel();
+ if(active_panel)
+ {
+ acvtive_panel_name = active_panel->getName();
+ }
+ if(acvtive_panel_name == "SearchPanel")
+ {
+ list = getChild<LLScrollListCtrl>("SearchResults");
+ }
+ else if(acvtive_panel_name == "NearMePanel")
+ {
+ list = getChild<LLScrollListCtrl>("NearMe");
+ }
+ else if (acvtive_panel_name == "FriendsPanel")
+ {
+ list = getChild<LLScrollListCtrl>("Friends");
+ }
+
+ if(list)
+ {
+ uuid_vec_t avatar_ids;
+ std::vector<LLAvatarName> avatar_names;
+ getSelectedAvatarData(list, avatar_ids, avatar_names);
+ mSelectionCallback(avatar_ids, avatar_names);
+ }
+ }
+ getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE);
+ getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE);
+ getChild<LLScrollListCtrl>("Friends")->deselectAllItems(TRUE);
+ if(mCloseOnSelect)
+ {
+ mCloseOnSelect = FALSE;
+ closeFloater();
+ }
}
void LLFloaterAvatarPicker::onBtnRefresh()
{
- getChild<LLScrollListCtrl>("NearMe")->deleteAllItems();
- getChild<LLScrollListCtrl>("NearMe")->setCommentText(getString("searching"));
- mNearMeListComplete = FALSE;
+ getChild<LLScrollListCtrl>("NearMe")->deleteAllItems();
+ getChild<LLScrollListCtrl>("NearMe")->setCommentText(getString("searching"));
+ mNearMeListComplete = FALSE;
}
void LLFloaterAvatarPicker::onBtnClose()
{
- closeFloater();
+ closeFloater();
}
void LLFloaterAvatarPicker::onRangeAdjust()
{
- onBtnRefresh();
+ onBtnRefresh();
}
void LLFloaterAvatarPicker::onList()
{
- getChildView("ok_btn")->setEnabled(isSelectBtnEnabled());
+ getChildView("ok_btn")->setEnabled(isSelectBtnEnabled());
}
void LLFloaterAvatarPicker::populateNearMe()
{
- BOOL all_loaded = TRUE;
- BOOL empty = TRUE;
- LLScrollListCtrl* near_me_scroller = getChild<LLScrollListCtrl>("NearMe");
- near_me_scroller->deleteAllItems();
-
- uuid_vec_t avatar_ids;
- LLWorld::getInstance()->getAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
- for(U32 i=0; i<avatar_ids.size(); i++)
- {
- LLUUID& av = avatar_ids[i];
- if(mExcludeAgentFromSearchResults && (av == gAgent.getID())) continue;
- LLSD element;
- element["id"] = av; // value
- LLAvatarName av_name;
-
- if (!LLAvatarNameCache::get(av, &av_name))
- {
- element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = LLCacheName::getDefaultName();
- all_loaded = FALSE;
- }
- else
- {
- element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = av_name.getDisplayName();
- element["columns"][1]["column"] = "username";
- element["columns"][1]["value"] = av_name.getUserName();
-
- sAvatarNameMap[av] = av_name;
- }
- near_me_scroller->addElement(element);
- empty = FALSE;
- }
-
- if (empty)
- {
- getChildView("NearMe")->setEnabled(FALSE);
- getChildView("ok_btn")->setEnabled(FALSE);
- near_me_scroller->setCommentText(getString("no_one_near"));
- }
- else
- {
- getChildView("NearMe")->setEnabled(TRUE);
- getChildView("ok_btn")->setEnabled(TRUE);
- near_me_scroller->selectFirstItem();
- onList();
- near_me_scroller->setFocus(TRUE);
- }
-
- if (all_loaded)
- {
- mNearMeListComplete = TRUE;
- }
+ BOOL all_loaded = TRUE;
+ BOOL empty = TRUE;
+ LLScrollListCtrl* near_me_scroller = getChild<LLScrollListCtrl>("NearMe");
+ near_me_scroller->deleteAllItems();
+
+ uuid_vec_t avatar_ids;
+ LLWorld::getInstance()->getAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
+ for(U32 i=0; i<avatar_ids.size(); i++)
+ {
+ LLUUID& av = avatar_ids[i];
+ if(mExcludeAgentFromSearchResults && (av == gAgent.getID())) continue;
+ LLSD element;
+ element["id"] = av; // value
+ LLAvatarName av_name;
+
+ if (!LLAvatarNameCache::get(av, &av_name))
+ {
+ element["columns"][0]["column"] = "name";
+ element["columns"][0]["value"] = LLCacheName::getDefaultName();
+ all_loaded = FALSE;
+ }
+ else
+ {
+ element["columns"][0]["column"] = "name";
+ element["columns"][0]["value"] = av_name.getDisplayName();
+ element["columns"][1]["column"] = "username";
+ element["columns"][1]["value"] = av_name.getUserName();
+
+ sAvatarNameMap[av] = av_name;
+ }
+ near_me_scroller->addElement(element);
+ empty = FALSE;
+ }
+
+ if (empty)
+ {
+ getChildView("NearMe")->setEnabled(FALSE);
+ getChildView("ok_btn")->setEnabled(FALSE);
+ near_me_scroller->setCommentText(getString("no_one_near"));
+ }
+ else
+ {
+ getChildView("NearMe")->setEnabled(TRUE);
+ getChildView("ok_btn")->setEnabled(TRUE);
+ near_me_scroller->selectFirstItem();
+ onList();
+ near_me_scroller->setFocus(TRUE);
+ }
+
+ if (all_loaded)
+ {
+ mNearMeListComplete = TRUE;
+ }
}
void LLFloaterAvatarPicker::populateFriend()
{
- LLScrollListCtrl* friends_scroller = getChild<LLScrollListCtrl>("Friends");
- friends_scroller->deleteAllItems();
- LLCollectAllBuddies collector;
- LLAvatarTracker::instance().applyFunctor(collector);
- LLCollectAllBuddies::buddy_map_t::iterator it;
-
- for(it = collector.mOnline.begin(); it!=collector.mOnline.end(); it++)
- {
- friends_scroller->addStringUUIDItem(it->second, it->first);
- }
- for(it = collector.mOffline.begin(); it!=collector.mOffline.end(); it++)
- {
- friends_scroller->addStringUUIDItem(it->second, it->first);
- }
- friends_scroller->sortByColumnIndex(0, TRUE);
+ LLScrollListCtrl* friends_scroller = getChild<LLScrollListCtrl>("Friends");
+ friends_scroller->deleteAllItems();
+ LLCollectAllBuddies collector;
+ LLAvatarTracker::instance().applyFunctor(collector);
+ LLCollectAllBuddies::buddy_map_t::iterator it;
+
+ for(it = collector.mOnline.begin(); it!=collector.mOnline.end(); it++)
+ {
+ friends_scroller->addStringUUIDItem(it->second, it->first);
+ }
+ for(it = collector.mOffline.begin(); it!=collector.mOffline.end(); it++)
+ {
+ friends_scroller->addStringUUIDItem(it->second, it->first);
+ }
+ friends_scroller->sortByColumnIndex(0, TRUE);
}
void LLFloaterAvatarPicker::drawFrustum()
@@ -370,42 +370,42 @@ void LLFloaterAvatarPicker::draw()
{
drawFrustum();
- // sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars).
- // lets check this via mOkButtonValidateSignal callback periodically.
- static LLFrameTimer timer;
- if (timer.hasExpired())
- {
- timer.setTimerExpirySec(0.33f); // three times per second should be enough.
-
- // simulate list changes.
- onList();
- timer.start();
- }
-
- LLFloater::draw();
- if (!mNearMeListComplete && getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel() == getChild<LLPanel>("NearMePanel"))
- {
- populateNearMe();
- }
+ // sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars).
+ // lets check this via mOkButtonValidateSignal callback periodically.
+ static LLFrameTimer timer;
+ if (timer.hasExpired())
+ {
+ timer.setTimerExpirySec(0.33f); // three times per second should be enough.
+
+ // simulate list changes.
+ onList();
+ timer.start();
+ }
+
+ LLFloater::draw();
+ if (!mNearMeListComplete && getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel() == getChild<LLPanel>("NearMePanel"))
+ {
+ populateNearMe();
+ }
}
BOOL LLFloaterAvatarPicker::visibleItemsSelected() const
{
- LLPanel* active_panel = getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel();
-
- if(active_panel == getChild<LLPanel>("SearchPanel"))
- {
- return getChild<LLScrollListCtrl>("SearchResults")->getFirstSelectedIndex() >= 0;
- }
- else if(active_panel == getChild<LLPanel>("NearMePanel"))
- {
- return getChild<LLScrollListCtrl>("NearMe")->getFirstSelectedIndex() >= 0;
- }
- else if(active_panel == getChild<LLPanel>("FriendsPanel"))
- {
- return getChild<LLScrollListCtrl>("Friends")->getFirstSelectedIndex() >= 0;
- }
- return FALSE;
+ LLPanel* active_panel = getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel();
+
+ if(active_panel == getChild<LLPanel>("SearchPanel"))
+ {
+ return getChild<LLScrollListCtrl>("SearchResults")->getFirstSelectedIndex() >= 0;
+ }
+ else if(active_panel == getChild<LLPanel>("NearMePanel"))
+ {
+ return getChild<LLScrollListCtrl>("NearMe")->getFirstSelectedIndex() >= 0;
+ }
+ else if(active_panel == getChild<LLPanel>("FriendsPanel"))
+ {
+ return getChild<LLScrollListCtrl>("Friends")->getFirstSelectedIndex() >= 0;
+ }
+ return FALSE;
}
/*static*/
@@ -446,236 +446,236 @@ void LLFloaterAvatarPicker::findCoro(std::string url, LLUUID queryID, std::strin
void LLFloaterAvatarPicker::find()
{
- //clear our stored LLAvatarNames
- sAvatarNameMap.clear();
-
- std::string text = getChild<LLUICtrl>("Edit")->getValue().asString();
-
- size_t separator_index = text.find_first_of(" ._");
- if (separator_index != text.npos)
- {
- std::string first = text.substr(0, separator_index);
- std::string last = text.substr(separator_index+1, text.npos);
- LLStringUtil::trim(last);
- if("Resident" == last)
- {
- text = first;
- }
- }
-
- mQueryID.generate();
-
- std::string url;
- url.reserve(128); // avoid a memory allocation or two
-
- LLViewerRegion* region = gAgent.getRegion();
- if(region)
- {
- url = region->getCapability("AvatarPickerSearch");
- // Prefer use of capabilities to search on both SLID and display name
- if (!url.empty())
- {
- // capability urls don't end in '/', but we need one to parse
- // query parameters correctly
- if (url.size() > 0 && url[url.size()-1] != '/')
- {
- url += "/";
- }
- url += "?page_size=100&names=";
- std::replace(text.begin(), text.end(), '.', ' ');
- url += LLURI::escape(text);
- LL_INFOS() << "avatar picker " << url << LL_ENDL;
+ //clear our stored LLAvatarNames
+ sAvatarNameMap.clear();
+
+ std::string text = getChild<LLUICtrl>("Edit")->getValue().asString();
+
+ size_t separator_index = text.find_first_of(" ._");
+ if (separator_index != text.npos)
+ {
+ std::string first = text.substr(0, separator_index);
+ std::string last = text.substr(separator_index+1, text.npos);
+ LLStringUtil::trim(last);
+ if("Resident" == last)
+ {
+ text = first;
+ }
+ }
+
+ mQueryID.generate();
+
+ std::string url;
+ url.reserve(128); // avoid a memory allocation or two
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if(region)
+ {
+ url = region->getCapability("AvatarPickerSearch");
+ // Prefer use of capabilities to search on both SLID and display name
+ if (!url.empty())
+ {
+ // capability urls don't end in '/', but we need one to parse
+ // query parameters correctly
+ if (url.size() > 0 && url[url.size()-1] != '/')
+ {
+ url += "/";
+ }
+ url += "?page_size=100&names=";
+ std::replace(text.begin(), text.end(), '.', ' ');
+ url += LLURI::escape(text);
+ LL_INFOS() << "avatar picker " << url << LL_ENDL;
LLCoros::instance().launch("LLFloaterAvatarPicker::findCoro",
boost::bind(&LLFloaterAvatarPicker::findCoro, url, mQueryID, getKey().asString()));
- }
- else
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("AvatarPickerRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addUUID("QueryID", mQueryID); // not used right now
- msg->nextBlock("Data");
- msg->addString("Name", text);
- gAgent.sendReliableMessage();
- }
- }
- getChild<LLScrollListCtrl>("SearchResults")->deleteAllItems();
- getChild<LLScrollListCtrl>("SearchResults")->setCommentText(getString("searching"));
-
- getChildView("ok_btn")->setEnabled(FALSE);
- mNumResultsReturned = 0;
+ }
+ else
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("AvatarPickerRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->addUUID("QueryID", mQueryID); // not used right now
+ msg->nextBlock("Data");
+ msg->addString("Name", text);
+ gAgent.sendReliableMessage();
+ }
+ }
+ getChild<LLScrollListCtrl>("SearchResults")->deleteAllItems();
+ getChild<LLScrollListCtrl>("SearchResults")->setCommentText(getString("searching"));
+
+ getChildView("ok_btn")->setEnabled(FALSE);
+ mNumResultsReturned = 0;
}
void LLFloaterAvatarPicker::setAllowMultiple(BOOL allow_multiple)
{
- getChild<LLScrollListCtrl>("SearchResults")->setAllowMultipleSelection(allow_multiple);
- getChild<LLScrollListCtrl>("NearMe")->setAllowMultipleSelection(allow_multiple);
- getChild<LLScrollListCtrl>("Friends")->setAllowMultipleSelection(allow_multiple);
+ getChild<LLScrollListCtrl>("SearchResults")->setAllowMultipleSelection(allow_multiple);
+ getChild<LLScrollListCtrl>("NearMe")->setAllowMultipleSelection(allow_multiple);
+ getChild<LLScrollListCtrl>("Friends")->setAllowMultipleSelection(allow_multiple);
}
LLScrollListCtrl* LLFloaterAvatarPicker::getActiveList()
{
- std::string acvtive_panel_name;
- LLScrollListCtrl* list = NULL;
- LLPanel* active_panel = getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel();
- if(active_panel)
- {
- acvtive_panel_name = active_panel->getName();
- }
- if(acvtive_panel_name == "SearchPanel")
- {
- list = getChild<LLScrollListCtrl>("SearchResults");
- }
- else if(acvtive_panel_name == "NearMePanel")
- {
- list = getChild<LLScrollListCtrl>("NearMe");
- }
- else if (acvtive_panel_name == "FriendsPanel")
- {
- list = getChild<LLScrollListCtrl>("Friends");
- }
- return list;
+ std::string acvtive_panel_name;
+ LLScrollListCtrl* list = NULL;
+ LLPanel* active_panel = getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel();
+ if(active_panel)
+ {
+ acvtive_panel_name = active_panel->getName();
+ }
+ if(acvtive_panel_name == "SearchPanel")
+ {
+ list = getChild<LLScrollListCtrl>("SearchResults");
+ }
+ else if(acvtive_panel_name == "NearMePanel")
+ {
+ list = getChild<LLScrollListCtrl>("NearMe");
+ }
+ else if (acvtive_panel_name == "FriendsPanel")
+ {
+ list = getChild<LLScrollListCtrl>("Friends");
+ }
+ return list;
}
BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type,
- void *cargo_data, EAcceptance *accept,
- std::string& tooltip_msg)
+ BOOL drop, EDragAndDropType cargo_type,
+ void *cargo_data, EAcceptance *accept,
+ std::string& tooltip_msg)
{
- LLScrollListCtrl* list = getActiveList();
- if(list)
- {
- LLRect rc_list;
- LLRect rc_point(x,y,x,y);
- if (localRectToOtherView(rc_point, &rc_list, list))
- {
- // Keep selected only one item
- list->deselectAllItems(TRUE);
- list->selectItemAt(rc_list.mLeft, rc_list.mBottom, mask);
- LLScrollListItem* selection = list->getFirstSelected();
- if (selection)
- {
- LLUUID session_id = LLUUID::null;
- LLUUID dest_agent_id = selection->getUUID();
- std::string avatar_name = selection->getColumn(0)->getValue().asString();
- if (dest_agent_id.notNull() && dest_agent_id != gAgentID)
- {
- if (drop)
- {
- // Start up IM before give the item
- session_id = gIMMgr->addSession(avatar_name, IM_NOTHING_SPECIAL, dest_agent_id);
- }
- return LLToolDragAndDrop::handleGiveDragAndDrop(dest_agent_id, session_id, drop,
- cargo_type, cargo_data, accept, getName());
- }
- }
- }
- }
- *accept = ACCEPT_NO;
- return TRUE;
+ LLScrollListCtrl* list = getActiveList();
+ if(list)
+ {
+ LLRect rc_list;
+ LLRect rc_point(x,y,x,y);
+ if (localRectToOtherView(rc_point, &rc_list, list))
+ {
+ // Keep selected only one item
+ list->deselectAllItems(TRUE);
+ list->selectItemAt(rc_list.mLeft, rc_list.mBottom, mask);
+ LLScrollListItem* selection = list->getFirstSelected();
+ if (selection)
+ {
+ LLUUID session_id = LLUUID::null;
+ LLUUID dest_agent_id = selection->getUUID();
+ std::string avatar_name = selection->getColumn(0)->getValue().asString();
+ if (dest_agent_id.notNull() && dest_agent_id != gAgentID)
+ {
+ if (drop)
+ {
+ // Start up IM before give the item
+ session_id = gIMMgr->addSession(avatar_name, IM_NOTHING_SPECIAL, dest_agent_id);
+ }
+ return LLToolDragAndDrop::handleGiveDragAndDrop(dest_agent_id, session_id, drop,
+ cargo_type, cargo_data, accept, getName());
+ }
+ }
+ }
+ }
+ *accept = ACCEPT_NO;
+ return TRUE;
}
void LLFloaterAvatarPicker::openFriendsTab()
{
- LLTabContainer* tab_container = getChild<LLTabContainer>("ResidentChooserTabs");
- if (tab_container == NULL)
- {
- llassert(tab_container != NULL);
- return;
- }
-
- tab_container->selectTabByName("FriendsPanel");
+ LLTabContainer* tab_container = getChild<LLTabContainer>("ResidentChooserTabs");
+ if (tab_container == NULL)
+ {
+ llassert(tab_container != NULL);
+ return;
+ }
+
+ tab_container->selectTabByName("FriendsPanel");
}
-// static
+// static
void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void**)
{
- LLUUID agent_id;
- LLUUID query_id;
- LLUUID avatar_id;
- std::string first_name;
- std::string last_name;
-
- msg->getUUID("AgentData", "AgentID", agent_id);
- msg->getUUID("AgentData", "QueryID", query_id);
-
- // Not for us
- if (agent_id != gAgent.getID()) return;
-
- LLFloaterAvatarPicker* floater = LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker");
-
- // floater is closed or these are not results from our last request
- if (NULL == floater || query_id != floater->mQueryID)
- {
- return;
- }
-
- LLScrollListCtrl* search_results = floater->getChild<LLScrollListCtrl>("SearchResults");
-
- // clear "Searching" label on first results
- if (floater->mNumResultsReturned++ == 0)
- {
- search_results->deleteAllItems();
- }
-
- BOOL found_one = FALSE;
- S32 num_new_rows = msg->getNumberOfBlocks("Data");
- for (S32 i = 0; i < num_new_rows; i++)
- {
- msg->getUUIDFast( _PREHASH_Data,_PREHASH_AvatarID, avatar_id, i);
- msg->getStringFast(_PREHASH_Data,_PREHASH_FirstName, first_name, i);
- msg->getStringFast(_PREHASH_Data,_PREHASH_LastName, last_name, i);
-
- if (avatar_id != agent_id || !floater->isExcludeAgentFromSearchResults()) // exclude agent from search results?
- {
- std::string avatar_name;
- if (avatar_id.isNull())
- {
- LLStringUtil::format_map_t map;
- map["[TEXT]"] = floater->getChild<LLUICtrl>("Edit")->getValue().asString();
- avatar_name = floater->getString("not_found", map);
- search_results->setEnabled(FALSE);
- floater->getChildView("ok_btn")->setEnabled(FALSE);
- }
- else
- {
- avatar_name = LLCacheName::buildFullName(first_name, last_name);
- search_results->setEnabled(TRUE);
- found_one = TRUE;
-
- LLAvatarName av_name;
- av_name.fromString(avatar_name);
- const LLUUID& agent_id = avatar_id;
- sAvatarNameMap[agent_id] = av_name;
-
- }
- LLSD element;
- element["id"] = avatar_id; // value
- element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = avatar_name;
- search_results->addElement(element);
- }
- }
-
- if (found_one)
- {
- floater->getChildView("ok_btn")->setEnabled(TRUE);
- search_results->selectFirstItem();
- floater->onList();
- search_results->setFocus(TRUE);
- }
+ LLUUID agent_id;
+ LLUUID query_id;
+ LLUUID avatar_id;
+ std::string first_name;
+ std::string last_name;
+
+ msg->getUUID("AgentData", "AgentID", agent_id);
+ msg->getUUID("AgentData", "QueryID", query_id);
+
+ // Not for us
+ if (agent_id != gAgent.getID()) return;
+
+ LLFloaterAvatarPicker* floater = LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker");
+
+ // floater is closed or these are not results from our last request
+ if (NULL == floater || query_id != floater->mQueryID)
+ {
+ return;
+ }
+
+ LLScrollListCtrl* search_results = floater->getChild<LLScrollListCtrl>("SearchResults");
+
+ // clear "Searching" label on first results
+ if (floater->mNumResultsReturned++ == 0)
+ {
+ search_results->deleteAllItems();
+ }
+
+ BOOL found_one = FALSE;
+ S32 num_new_rows = msg->getNumberOfBlocks("Data");
+ for (S32 i = 0; i < num_new_rows; i++)
+ {
+ msg->getUUIDFast( _PREHASH_Data,_PREHASH_AvatarID, avatar_id, i);
+ msg->getStringFast(_PREHASH_Data,_PREHASH_FirstName, first_name, i);
+ msg->getStringFast(_PREHASH_Data,_PREHASH_LastName, last_name, i);
+
+ if (avatar_id != agent_id || !floater->isExcludeAgentFromSearchResults()) // exclude agent from search results?
+ {
+ std::string avatar_name;
+ if (avatar_id.isNull())
+ {
+ LLStringUtil::format_map_t map;
+ map["[TEXT]"] = floater->getChild<LLUICtrl>("Edit")->getValue().asString();
+ avatar_name = floater->getString("not_found", map);
+ search_results->setEnabled(FALSE);
+ floater->getChildView("ok_btn")->setEnabled(FALSE);
+ }
+ else
+ {
+ avatar_name = LLCacheName::buildFullName(first_name, last_name);
+ search_results->setEnabled(TRUE);
+ found_one = TRUE;
+
+ LLAvatarName av_name;
+ av_name.fromString(avatar_name);
+ const LLUUID& agent_id = avatar_id;
+ sAvatarNameMap[agent_id] = av_name;
+
+ }
+ LLSD element;
+ element["id"] = avatar_id; // value
+ element["columns"][0]["column"] = "name";
+ element["columns"][0]["value"] = avatar_name;
+ search_results->addElement(element);
+ }
+ }
+
+ if (found_one)
+ {
+ floater->getChildView("ok_btn")->setEnabled(TRUE);
+ search_results->selectFirstItem();
+ floater->onList();
+ search_results->setFocus(TRUE);
+ }
}
void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD& content)
{
- // Check for out-of-date query
- if (query_id == mQueryID)
- {
- LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>("SearchResults");
+ // Check for out-of-date query
+ if (query_id == mQueryID)
+ {
+ LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>("SearchResults");
// clear "Searching" label on first results
search_results->deleteAllItems();
@@ -738,81 +738,81 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD&
search_results->setFocus(TRUE);
}
}
- }
+ }
}
void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller, void* user_data)
{
- getChildView("Find")->setEnabled(caller->getText().size() > 0);
+ getChildView("Find")->setEnabled(caller->getText().size() > 0);
}
// virtual
BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask)
{
- if (key == KEY_RETURN && mask == MASK_NONE)
- {
- if (getChild<LLUICtrl>("Edit")->hasFocus())
- {
- onBtnFind();
- }
- else
- {
- onBtnSelect();
- }
- return TRUE;
- }
- else if (key == KEY_ESCAPE && mask == MASK_NONE)
- {
- closeFloater();
- return TRUE;
- }
-
- return LLFloater::handleKeyHere(key, mask);
+ if (key == KEY_RETURN && mask == MASK_NONE)
+ {
+ if (getChild<LLUICtrl>("Edit")->hasFocus())
+ {
+ onBtnFind();
+ }
+ else
+ {
+ onBtnSelect();
+ }
+ return TRUE;
+ }
+ else if (key == KEY_ESCAPE && mask == MASK_NONE)
+ {
+ closeFloater();
+ return TRUE;
+ }
+
+ return LLFloater::handleKeyHere(key, mask);
}
bool LLFloaterAvatarPicker::isSelectBtnEnabled()
{
- bool ret_val = visibleItemsSelected();
-
- if ( ret_val && !isMinimized())
- {
- std::string acvtive_panel_name;
- LLScrollListCtrl* list = NULL;
- LLPanel* active_panel = getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel();
-
- if(active_panel)
- {
- acvtive_panel_name = active_panel->getName();
- }
-
- if(acvtive_panel_name == "SearchPanel")
- {
- list = getChild<LLScrollListCtrl>("SearchResults");
- }
- else if(acvtive_panel_name == "NearMePanel")
- {
- list = getChild<LLScrollListCtrl>("NearMe");
- }
- else if (acvtive_panel_name == "FriendsPanel")
- {
- list = getChild<LLScrollListCtrl>("Friends");
- }
-
- if(list)
- {
- uuid_vec_t avatar_ids;
- std::vector<LLAvatarName> avatar_names;
- getSelectedAvatarData(list, avatar_ids, avatar_names);
- if (avatar_ids.size() >= 1)
- {
- ret_val = mOkButtonValidateSignal.num_slots()?mOkButtonValidateSignal(avatar_ids):true;
- }
- else
- {
- ret_val = false;
- }
- }
- }
-
- return ret_val;
+ bool ret_val = visibleItemsSelected();
+
+ if ( ret_val && !isMinimized())
+ {
+ std::string acvtive_panel_name;
+ LLScrollListCtrl* list = NULL;
+ LLPanel* active_panel = getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel();
+
+ if(active_panel)
+ {
+ acvtive_panel_name = active_panel->getName();
+ }
+
+ if(acvtive_panel_name == "SearchPanel")
+ {
+ list = getChild<LLScrollListCtrl>("SearchResults");
+ }
+ else if(acvtive_panel_name == "NearMePanel")
+ {
+ list = getChild<LLScrollListCtrl>("NearMe");
+ }
+ else if (acvtive_panel_name == "FriendsPanel")
+ {
+ list = getChild<LLScrollListCtrl>("Friends");
+ }
+
+ if(list)
+ {
+ uuid_vec_t avatar_ids;
+ std::vector<LLAvatarName> avatar_names;
+ getSelectedAvatarData(list, avatar_ids, avatar_names);
+ if (avatar_ids.size() >= 1)
+ {
+ ret_val = mOkButtonValidateSignal.num_slots()?mOkButtonValidateSignal(avatar_ids):true;
+ }
+ else
+ {
+ ret_val = false;
+ }
+ }
+ }
+
+ return ret_val;
}
diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h
index fbee61b054..f50b46f181 100644
--- a/indra/newview/llfloateravatarpicker.h
+++ b/indra/newview/llfloateravatarpicker.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloateravatarpicker.h
* @brief was llavatarpicker.h
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,75 +39,75 @@ class LLScrollListCtrl;
class LLFloaterAvatarPicker :public LLFloater
{
public:
- typedef boost::signals2::signal<bool(const uuid_vec_t&), boost_boolean_combiner> validate_signal_t;
- typedef validate_signal_t::slot_type validate_callback_t;
-
- // The callback function will be called with an avatar name and UUID.
- typedef boost::function<void (const uuid_vec_t&, const std::vector<LLAvatarName>&)> select_callback_t;
- // Call this to select an avatar.
- static LLFloaterAvatarPicker* show(select_callback_t callback,
- BOOL allow_multiple = FALSE,
- BOOL closeOnSelect = FALSE,
- BOOL skip_agent = FALSE,
+ typedef boost::signals2::signal<bool(const uuid_vec_t&), boost_boolean_combiner> validate_signal_t;
+ typedef validate_signal_t::slot_type validate_callback_t;
+
+ // The callback function will be called with an avatar name and UUID.
+ typedef boost::function<void (const uuid_vec_t&, const std::vector<LLAvatarName>&)> select_callback_t;
+ // Call this to select an avatar.
+ static LLFloaterAvatarPicker* show(select_callback_t callback,
+ BOOL allow_multiple = FALSE,
+ BOOL closeOnSelect = FALSE,
+ BOOL skip_agent = FALSE,
const std::string& name = "",
LLView * frustumOrigin = NULL);
- LLFloaterAvatarPicker(const LLSD& key);
- virtual ~LLFloaterAvatarPicker();
-
- virtual BOOL postBuild();
+ LLFloaterAvatarPicker(const LLSD& key);
+ virtual ~LLFloaterAvatarPicker();
+
+ virtual BOOL postBuild();
- void setOkBtnEnableCb(validate_callback_t cb);
+ void setOkBtnEnableCb(validate_callback_t cb);
- static void processAvatarPickerReply(class LLMessageSystem* msg, void**);
- void processResponse(const LLUUID& query_id, const LLSD& content);
+ static void processAvatarPickerReply(class LLMessageSystem* msg, void**);
+ void processResponse(const LLUUID& query_id, const LLSD& content);
- BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type,
- void *cargo_data, EAcceptance *accept,
- std::string& tooltip_msg);
+ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
+ BOOL drop, EDragAndDropType cargo_type,
+ void *cargo_data, EAcceptance *accept,
+ std::string& tooltip_msg);
- void openFriendsTab();
- BOOL isExcludeAgentFromSearchResults() {return mExcludeAgentFromSearchResults;}
+ void openFriendsTab();
+ BOOL isExcludeAgentFromSearchResults() {return mExcludeAgentFromSearchResults;}
private:
- void editKeystroke(class LLLineEditor* caller, void* user_data);
+ void editKeystroke(class LLLineEditor* caller, void* user_data);
- void onBtnFind();
- void onBtnSelect();
- void onBtnRefresh();
- void onRangeAdjust();
- void onBtnClose();
- void onList();
- void onTabChanged();
- bool isSelectBtnEnabled();
+ void onBtnFind();
+ void onBtnSelect();
+ void onBtnRefresh();
+ void onRangeAdjust();
+ void onBtnClose();
+ void onList();
+ void onTabChanged();
+ bool isSelectBtnEnabled();
- void populateNearMe();
- void populateFriend();
- BOOL visibleItemsSelected() const; // Returns true if any items in the current tab are selected.
+ void populateNearMe();
+ void populateFriend();
+ BOOL visibleItemsSelected() const; // Returns true if any items in the current tab are selected.
static void findCoro(std::string url, LLUUID mQueryID, std::string mName);
- void find();
- void setAllowMultiple(BOOL allow_multiple);
- LLScrollListCtrl* getActiveList();
+ void find();
+ void setAllowMultiple(BOOL allow_multiple);
+ LLScrollListCtrl* getActiveList();
void drawFrustum();
- virtual void draw();
- virtual BOOL handleKeyHere(KEY key, MASK mask);
-
- LLUUID mQueryID;
- int mNumResultsReturned;
- BOOL mNearMeListComplete;
- BOOL mCloseOnSelect;
- BOOL mExcludeAgentFromSearchResults;
+ virtual void draw();
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
+
+ LLUUID mQueryID;
+ int mNumResultsReturned;
+ BOOL mNearMeListComplete;
+ BOOL mCloseOnSelect;
+ BOOL mExcludeAgentFromSearchResults;
LLHandle <LLView> mFrustumOrigin;
- F32 mContextConeOpacity;
+ F32 mContextConeOpacity;
F32 mContextConeInAlpha;
F32 mContextConeOutAlpha;
F32 mContextConeFadeTime;
- validate_signal_t mOkButtonValidateSignal;
- select_callback_t mSelectionCallback;
+ validate_signal_t mOkButtonValidateSignal;
+ select_callback_t mSelectionCallback;
};
#endif
diff --git a/indra/newview/llfloateravatarrendersettings.cpp b/indra/newview/llfloateravatarrendersettings.cpp
index 7d098e6c88..bc860308b3 100644
--- a/indra/newview/llfloateravatarrendersettings.cpp
+++ b/indra/newview/llfloateravatarrendersettings.cpp
@@ -70,8 +70,8 @@ static LLAvatarRenderMuteListObserver sAvatarRenderMuteListObserver;
LLFloaterAvatarRenderSettings::LLFloaterAvatarRenderSettings(const LLSD& key)
: LLFloater(key),
- mAvatarSettingsList(NULL),
- mNeedsUpdate(false)
+ mAvatarSettingsList(NULL),
+ mNeedsUpdate(false)
{
mContextMenu = new LLSettingsContextMenu(this);
LLRenderMuteList::getInstance()->addObserver(&sAvatarRenderMuteListObserver);
@@ -90,7 +90,7 @@ BOOL LLFloaterAvatarRenderSettings::postBuild()
mAvatarSettingsList = getChild<LLNameListCtrl>("render_settings_list");
mAvatarSettingsList->setRightMouseDownCallback(boost::bind(&LLFloaterAvatarRenderSettings::onAvatarListRightClick, this, _1, _2, _3));
- return TRUE;
+ return TRUE;
}
void LLFloaterAvatarRenderSettings::draw()
diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp
index ebb73fc1f7..023e1501f6 100644
--- a/indra/newview/llfloateravatartextures.cpp
+++ b/indra/newview/llfloateravatartextures.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloateravatartextures.cpp
* @brief Debugging view showing underlying avatar textures and baked textures.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,7 +43,7 @@ using namespace LLAvatarAppearanceDefines;
LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLSD& id)
: LLFloater(id),
- mID(id.asUUID())
+ mID(id.asUUID())
{
}
@@ -53,151 +53,151 @@ LLFloaterAvatarTextures::~LLFloaterAvatarTextures()
BOOL LLFloaterAvatarTextures::postBuild()
{
- for (U32 i=0; i < TEX_NUM_INDICES; i++)
- {
- const std::string tex_name = LLAvatarAppearance::getDictionary()->getTexture(ETextureIndex(i))->mName;
- mTextures[i] = getChild<LLTextureCtrl>(tex_name);
- }
- mTitle = getTitle();
+ for (U32 i=0; i < TEX_NUM_INDICES; i++)
+ {
+ const std::string tex_name = LLAvatarAppearance::getDictionary()->getTexture(ETextureIndex(i))->mName;
+ mTextures[i] = getChild<LLTextureCtrl>(tex_name);
+ }
+ mTitle = getTitle();
- childSetAction("Dump", onClickDump, this);
+ childSetAction("Dump", onClickDump, this);
- refresh();
- return TRUE;
+ refresh();
+ return TRUE;
}
void LLFloaterAvatarTextures::draw()
{
- refresh();
- LLFloater::draw();
+ refresh();
+ LLFloater::draw();
}
static void update_texture_ctrl(LLVOAvatar* avatarp,
- LLTextureCtrl* ctrl,
- ETextureIndex te)
+ LLTextureCtrl* ctrl,
+ ETextureIndex te)
{
- LLUUID id = IMG_DEFAULT_AVATAR;
- const LLAvatarAppearanceDictionary::TextureEntry* tex_entry = LLAvatarAppearance::getDictionary()->getTexture(te);
- if (tex_entry && tex_entry->mIsLocalTexture)
- {
- if (avatarp->isSelf())
- {
- const LLWearableType::EType wearable_type = tex_entry->mWearableType;
- LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, 0);
- if (wearable)
- {
- LLLocalTextureObject *lto = wearable->getLocalTextureObject(te);
- if (lto)
- {
- id = lto->getID();
- }
- }
- }
- }
- else
- {
- id = tex_entry ? avatarp->getTE(te)->getID() : IMG_DEFAULT_AVATAR;
- }
- //id = avatarp->getTE(te)->getID();
- if (id == IMG_DEFAULT_AVATAR)
- {
- ctrl->setImageAssetID(LLUUID::null);
- ctrl->setToolTip(tex_entry->mName + " : " + std::string("IMG_DEFAULT_AVATAR"));
- }
- else
- {
- ctrl->setImageAssetID(id);
- ctrl->setToolTip(tex_entry->mName + " : " + id.asString());
- }
+ LLUUID id = IMG_DEFAULT_AVATAR;
+ const LLAvatarAppearanceDictionary::TextureEntry* tex_entry = LLAvatarAppearance::getDictionary()->getTexture(te);
+ if (tex_entry && tex_entry->mIsLocalTexture)
+ {
+ if (avatarp->isSelf())
+ {
+ const LLWearableType::EType wearable_type = tex_entry->mWearableType;
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, 0);
+ if (wearable)
+ {
+ LLLocalTextureObject *lto = wearable->getLocalTextureObject(te);
+ if (lto)
+ {
+ id = lto->getID();
+ }
+ }
+ }
+ }
+ else
+ {
+ id = tex_entry ? avatarp->getTE(te)->getID() : IMG_DEFAULT_AVATAR;
+ }
+ //id = avatarp->getTE(te)->getID();
+ if (id == IMG_DEFAULT_AVATAR)
+ {
+ ctrl->setImageAssetID(LLUUID::null);
+ ctrl->setToolTip(tex_entry->mName + " : " + std::string("IMG_DEFAULT_AVATAR"));
+ }
+ else
+ {
+ ctrl->setImageAssetID(id);
+ ctrl->setToolTip(tex_entry->mName + " : " + id.asString());
+ }
}
static LLVOAvatar* find_avatar(const LLUUID& id)
{
- LLViewerObject *obj = gObjectList.findObject(id);
- while (obj && obj->isAttachment())
- {
- obj = (LLViewerObject *)obj->getParent();
- }
-
- if (obj && obj->isAvatar())
- {
- return (LLVOAvatar*)obj;
- }
- else
- {
- return NULL;
- }
+ LLViewerObject *obj = gObjectList.findObject(id);
+ while (obj && obj->isAttachment())
+ {
+ obj = (LLViewerObject *)obj->getParent();
+ }
+
+ if (obj && obj->isAvatar())
+ {
+ return (LLVOAvatar*)obj;
+ }
+ else
+ {
+ return NULL;
+ }
}
void LLFloaterAvatarTextures::refresh()
{
- if (gAgent.isGodlike())
- {
- LLVOAvatar *avatarp = find_avatar(mID);
- if (avatarp)
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(avatarp->getID(), &av_name))
- {
- setTitle(mTitle + ": " + av_name.getCompleteName());
- }
- for (U32 i=0; i < TEX_NUM_INDICES; i++)
- {
- update_texture_ctrl(avatarp, mTextures[i], ETextureIndex(i));
- }
- }
- else
- {
- setTitle(mTitle + ": " + getString("InvalidAvatar") + " (" + mID.asString() + ")");
- }
- }
+ if (gAgent.isGodlike())
+ {
+ LLVOAvatar *avatarp = find_avatar(mID);
+ if (avatarp)
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(avatarp->getID(), &av_name))
+ {
+ setTitle(mTitle + ": " + av_name.getCompleteName());
+ }
+ for (U32 i=0; i < TEX_NUM_INDICES; i++)
+ {
+ update_texture_ctrl(avatarp, mTextures[i], ETextureIndex(i));
+ }
+ }
+ else
+ {
+ setTitle(mTitle + ": " + getString("InvalidAvatar") + " (" + mID.asString() + ")");
+ }
+ }
}
// static
void LLFloaterAvatarTextures::onClickDump(void* data)
{
- if (gAgent.isGodlike())
- {
- const LLVOAvatarSelf* avatarp = gAgentAvatarp;
- if (!avatarp) return;
- for (S32 i = 0; i < avatarp->getNumTEs(); i++)
- {
- const LLTextureEntry* te = avatarp->getTE(i);
- if (!te) continue;
-
- const LLAvatarAppearanceDictionary::TextureEntry* tex_entry = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)(i));
- if (!tex_entry)
- continue;
-
- if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i))
- {
- LLUUID id = IMG_DEFAULT_AVATAR;
- LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex)i);
- if (avatarp->isSelf())
- {
- LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, 0);
- if (wearable)
- {
- LLLocalTextureObject *lto = wearable->getLocalTextureObject(i);
- if (lto)
- {
- id = lto->getID();
- }
- }
- }
- if (id != IMG_DEFAULT_AVATAR)
- {
- LL_INFOS() << "TE " << i << " name:" << tex_entry->mName << " id:" << id << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "TE " << i << " name:" << tex_entry->mName << " id:" << "<DEFAULT>" << LL_ENDL;
- }
- }
- else
- {
- LL_INFOS() << "TE " << i << " name:" << tex_entry->mName << " id:" << te->getID() << LL_ENDL;
- }
- }
- }
+ if (gAgent.isGodlike())
+ {
+ const LLVOAvatarSelf* avatarp = gAgentAvatarp;
+ if (!avatarp) return;
+ for (S32 i = 0; i < avatarp->getNumTEs(); i++)
+ {
+ const LLTextureEntry* te = avatarp->getTE(i);
+ if (!te) continue;
+
+ const LLAvatarAppearanceDictionary::TextureEntry* tex_entry = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)(i));
+ if (!tex_entry)
+ continue;
+
+ if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i))
+ {
+ LLUUID id = IMG_DEFAULT_AVATAR;
+ LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex)i);
+ if (avatarp->isSelf())
+ {
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, 0);
+ if (wearable)
+ {
+ LLLocalTextureObject *lto = wearable->getLocalTextureObject(i);
+ if (lto)
+ {
+ id = lto->getID();
+ }
+ }
+ }
+ if (id != IMG_DEFAULT_AVATAR)
+ {
+ LL_INFOS() << "TE " << i << " name:" << tex_entry->mName << " id:" << id << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "TE " << i << " name:" << tex_entry->mName << " id:" << "<DEFAULT>" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_INFOS() << "TE " << i << " name:" << tex_entry->mName << " id:" << te->getID() << LL_ENDL;
+ }
+ }
+ }
}
diff --git a/indra/newview/llfloateravatartextures.h b/indra/newview/llfloateravatartextures.h
index 02474a10e1..ee94f58cf4 100644
--- a/indra/newview/llfloateravatartextures.h
+++ b/indra/newview/llfloateravatartextures.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloateravatartextures.h
* @brief Debugging view showing underlying avatar textures and baked textures.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,21 +37,21 @@ class LLTextureCtrl;
class LLFloaterAvatarTextures : public LLFloater
{
public:
- LLFloaterAvatarTextures(const LLSD& id);
- virtual ~LLFloaterAvatarTextures();
+ LLFloaterAvatarTextures(const LLSD& id);
+ virtual ~LLFloaterAvatarTextures();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void draw();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
- void refresh();
+ void refresh();
private:
- static void onClickDump(void*);
+ static void onClickDump(void*);
private:
- LLUUID mID;
- std::string mTitle;
- LLTextureCtrl* mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES];
+ LLUUID mID;
+ std::string mTitle;
+ LLTextureCtrl* mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES];
};
#endif
diff --git a/indra/newview/llfloaterbeacons.cpp b/indra/newview/llfloaterbeacons.cpp
index cf38a00499..fb1da84e79 100644
--- a/indra/newview/llfloaterbeacons.cpp
+++ b/indra/newview/llfloaterbeacons.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbeacons.cpp
* @brief Front-end to LLPipeline controls for highlighting various kinds of objects.
* @author Coco
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,27 +34,27 @@
LLFloaterBeacons::LLFloaterBeacons(const LLSD& seed)
-: LLFloater(seed)
+: LLFloater(seed)
{
- // Initialize pipeline states from saved settings.
- // OK to do at floater constructor time because beacons do not display unless the floater is open
- // therefore it is OK to not initialize the pipeline state before needed.
- // Note also that we should replace those pipeline statics with direct lookup of the saved settings
- // eliminating the need to keep these states in sync.
- LLPipeline::setRenderScriptedTouchBeacons(gSavedSettings.getBOOL("scripttouchbeacon"));
- LLPipeline::setRenderScriptedBeacons( gSavedSettings.getBOOL("scriptsbeacon"));
- LLPipeline::setRenderPhysicalBeacons( gSavedSettings.getBOOL("physicalbeacon"));
- LLPipeline::setRenderSoundBeacons( gSavedSettings.getBOOL("soundsbeacon"));
- LLPipeline::setRenderParticleBeacons( gSavedSettings.getBOOL("particlesbeacon"));
- LLPipeline::setRenderHighlights( gSavedSettings.getBOOL("renderhighlights"));
- LLPipeline::setRenderBeacons( gSavedSettings.getBOOL("renderbeacons"));
- LLPipeline::setRenderMOAPBeacons( gSavedSettings.getBOOL("moapbeacon"));
- mCommitCallbackRegistrar.add("Beacons.UICheck", boost::bind(&LLFloaterBeacons::onClickUICheck, this,_1));
+ // Initialize pipeline states from saved settings.
+ // OK to do at floater constructor time because beacons do not display unless the floater is open
+ // therefore it is OK to not initialize the pipeline state before needed.
+ // Note also that we should replace those pipeline statics with direct lookup of the saved settings
+ // eliminating the need to keep these states in sync.
+ LLPipeline::setRenderScriptedTouchBeacons(gSavedSettings.getBOOL("scripttouchbeacon"));
+ LLPipeline::setRenderScriptedBeacons( gSavedSettings.getBOOL("scriptsbeacon"));
+ LLPipeline::setRenderPhysicalBeacons( gSavedSettings.getBOOL("physicalbeacon"));
+ LLPipeline::setRenderSoundBeacons( gSavedSettings.getBOOL("soundsbeacon"));
+ LLPipeline::setRenderParticleBeacons( gSavedSettings.getBOOL("particlesbeacon"));
+ LLPipeline::setRenderHighlights( gSavedSettings.getBOOL("renderhighlights"));
+ LLPipeline::setRenderBeacons( gSavedSettings.getBOOL("renderbeacons"));
+ LLPipeline::setRenderMOAPBeacons( gSavedSettings.getBOOL("moapbeacon"));
+ mCommitCallbackRegistrar.add("Beacons.UICheck", boost::bind(&LLFloaterBeacons::onClickUICheck, this,_1));
}
BOOL LLFloaterBeacons::postBuild()
{
- return TRUE;
+ return TRUE;
}
// Callback attached to each check box control to both affect their main purpose
@@ -62,70 +62,70 @@ BOOL LLFloaterBeacons::postBuild()
void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl)
{
- LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
- std::string name = check->getName();
- if(name == "touch_only")
- {
- LLPipeline::toggleRenderScriptedTouchBeacons();
- // Don't allow both to be ON at the same time. Toggle the other one off if both now on.
- if (
- LLPipeline::getRenderScriptedTouchBeacons() &&
- LLPipeline::getRenderScriptedBeacons() )
- {
- LLPipeline::setRenderScriptedBeacons(false);
- getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(FALSE));
- getChild<LLCheckBoxCtrl>("scripted")->setValue(FALSE);
- getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline
- getChild<LLCheckBoxCtrl>("touch_only")->setValue(TRUE);
- }
- }
- else if(name == "scripted")
- {
- LLPipeline::toggleRenderScriptedBeacons();
- // Don't allow both to be ON at the same time. Toggle the other one off if both now on.
- if (
- LLPipeline::getRenderScriptedTouchBeacons() &&
- LLPipeline::getRenderScriptedBeacons() )
- {
- LLPipeline::setRenderScriptedTouchBeacons(false);
- getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(FALSE));
- getChild<LLCheckBoxCtrl>("touch_only")->setValue(FALSE);
- getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline
- getChild<LLCheckBoxCtrl>("scripted")->setValue(TRUE);
- }
- }
- else if(name == "physical") LLPipeline::setRenderPhysicalBeacons(check->get());
- else if(name == "sounds") LLPipeline::setRenderSoundBeacons(check->get());
- else if(name == "particles") LLPipeline::setRenderParticleBeacons(check->get());
- else if(name == "moapbeacon") LLPipeline::setRenderMOAPBeacons(check->get());
- else if(name == "highlights")
- {
- LLPipeline::toggleRenderHighlights();
- // Don't allow both to be OFF at the same time. Toggle the other one on if both now off.
- if (
- !LLPipeline::getRenderBeacons() &&
- !LLPipeline::getRenderHighlights() )
- {
- LLPipeline::setRenderBeacons(true);
- getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(TRUE));
- getChild<LLCheckBoxCtrl>("beacons")->setValue(TRUE);
- getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline
- getChild<LLCheckBoxCtrl>("highlights")->setValue(FALSE);
- }
- }
- else if(name == "beacons")
- {
- LLPipeline::toggleRenderBeacons();
- // Don't allow both to be OFF at the same time. Toggle the other one on if both now off.
- if (
- !LLPipeline::getRenderBeacons() &&
- !LLPipeline::getRenderHighlights() )
- {
- LLPipeline::setRenderHighlights(true);
- getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(TRUE));
- getChild<LLCheckBoxCtrl>("highlights")->setValue(TRUE);
- getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline
- getChild<LLCheckBoxCtrl>("beacons")->setValue(FALSE);
- }
- }
+ LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
+ std::string name = check->getName();
+ if(name == "touch_only")
+ {
+ LLPipeline::toggleRenderScriptedTouchBeacons();
+ // Don't allow both to be ON at the same time. Toggle the other one off if both now on.
+ if (
+ LLPipeline::getRenderScriptedTouchBeacons() &&
+ LLPipeline::getRenderScriptedBeacons() )
+ {
+ LLPipeline::setRenderScriptedBeacons(false);
+ getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(FALSE));
+ getChild<LLCheckBoxCtrl>("scripted")->setValue(FALSE);
+ getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline
+ getChild<LLCheckBoxCtrl>("touch_only")->setValue(TRUE);
+ }
+ }
+ else if(name == "scripted")
+ {
+ LLPipeline::toggleRenderScriptedBeacons();
+ // Don't allow both to be ON at the same time. Toggle the other one off if both now on.
+ if (
+ LLPipeline::getRenderScriptedTouchBeacons() &&
+ LLPipeline::getRenderScriptedBeacons() )
+ {
+ LLPipeline::setRenderScriptedTouchBeacons(false);
+ getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(FALSE));
+ getChild<LLCheckBoxCtrl>("touch_only")->setValue(FALSE);
+ getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline
+ getChild<LLCheckBoxCtrl>("scripted")->setValue(TRUE);
+ }
+ }
+ else if(name == "physical") LLPipeline::setRenderPhysicalBeacons(check->get());
+ else if(name == "sounds") LLPipeline::setRenderSoundBeacons(check->get());
+ else if(name == "particles") LLPipeline::setRenderParticleBeacons(check->get());
+ else if(name == "moapbeacon") LLPipeline::setRenderMOAPBeacons(check->get());
+ else if(name == "highlights")
+ {
+ LLPipeline::toggleRenderHighlights();
+ // Don't allow both to be OFF at the same time. Toggle the other one on if both now off.
+ if (
+ !LLPipeline::getRenderBeacons() &&
+ !LLPipeline::getRenderHighlights() )
+ {
+ LLPipeline::setRenderBeacons(true);
+ getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(TRUE));
+ getChild<LLCheckBoxCtrl>("beacons")->setValue(TRUE);
+ getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline
+ getChild<LLCheckBoxCtrl>("highlights")->setValue(FALSE);
+ }
+ }
+ else if(name == "beacons")
+ {
+ LLPipeline::toggleRenderBeacons();
+ // Don't allow both to be OFF at the same time. Toggle the other one on if both now off.
+ if (
+ !LLPipeline::getRenderBeacons() &&
+ !LLPipeline::getRenderHighlights() )
+ {
+ LLPipeline::setRenderHighlights(true);
+ getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(TRUE));
+ getChild<LLCheckBoxCtrl>("highlights")->setValue(TRUE);
+ getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline
+ getChild<LLCheckBoxCtrl>("beacons")->setValue(FALSE);
+ }
+ }
}
diff --git a/indra/newview/llfloaterbeacons.h b/indra/newview/llfloaterbeacons.h
index 47d0696296..629934c346 100644
--- a/indra/newview/llfloaterbeacons.h
+++ b/indra/newview/llfloaterbeacons.h
@@ -1,26 +1,26 @@
-/**
+/**
* @file llfloaterbeacons.h
* @brief Front-end to LLPipeline controls for highlighting various kinds of objects.
- * @author Coco
+ * @author Coco
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,18 +32,18 @@
class LLFloaterBeacons : public LLFloater
{
- friend class LLFloaterReg;
-
+ friend class LLFloaterReg;
+
public:
- /*virtual*/ BOOL postBuild();
-
- // Needed to make the floater visibility toggle the beacons.
- // Too bad we can't just add control_name="BeaconAlwaysOn" to the XML.
- void onClickUICheck(LLUICtrl *ctrl);
+ /*virtual*/ BOOL postBuild();
+
+ // Needed to make the floater visibility toggle the beacons.
+ // Too bad we can't just add control_name="BeaconAlwaysOn" to the XML.
+ void onClickUICheck(LLUICtrl *ctrl);
private:
- LLFloaterBeacons(const LLSD& seed);
+ LLFloaterBeacons(const LLSD& seed);
};
#endif
diff --git a/indra/newview/llfloaterbigpreview.cpp b/indra/newview/llfloaterbigpreview.cpp
index b516e9dd01..023607f9ab 100644
--- a/indra/newview/llfloaterbigpreview.cpp
+++ b/indra/newview/llfloaterbigpreview.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbigpreview.cpp
* @brief Display of extended (big) preview for snapshots and SL Share
* @author merov@lindenlab.com
@@ -42,10 +42,10 @@ LLFloaterBigPreview::LLFloaterBigPreview(const LLSD& key) : LLFloater(key),
LLFloaterBigPreview::~LLFloaterBigPreview()
{
- if (mPreviewHandle.get())
- {
- mPreviewHandle.get()->die();
- }
+ if (mPreviewHandle.get())
+ {
+ mPreviewHandle.get()->die();
+ }
}
void LLFloaterBigPreview::onCancel()
@@ -63,48 +63,48 @@ void LLFloaterBigPreview::closeOnFloaterOwnerClosing(LLFloater* floaterp)
BOOL LLFloaterBigPreview::postBuild()
{
- mPreviewPlaceholder = getChild<LLUICtrl>("big_preview_placeholder");
- return LLFloater::postBuild();
+ mPreviewPlaceholder = getChild<LLUICtrl>("big_preview_placeholder");
+ return LLFloater::postBuild();
}
void LLFloaterBigPreview::draw()
{
- LLFloater::draw();
+ LLFloater::draw();
+
+ LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());
- LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());
-
// Display the preview if one is available
- if (previewp && previewp->getBigThumbnailImage())
- {
+ if (previewp && previewp->getBigThumbnailImage())
+ {
// Get the preview rect
- const LLRect& preview_rect = mPreviewPlaceholder->getRect();
-
+ const LLRect& preview_rect = mPreviewPlaceholder->getRect();
+
// Get the preview texture size
- S32 thumbnail_w = previewp->getBigThumbnailWidth();
- S32 thumbnail_h = previewp->getBigThumbnailHeight();
-
+ S32 thumbnail_w = previewp->getBigThumbnailWidth();
+ S32 thumbnail_h = previewp->getBigThumbnailHeight();
+
// Compute the scaling ratio and the size of the final texture in the rect: we want to prevent anisotropic scaling (distorted in x and y)
F32 ratio = llmax((F32)(thumbnail_w)/(F32)(preview_rect.getWidth()), (F32)(thumbnail_h)/(F32)(preview_rect.getHeight()));
thumbnail_w = (S32)((F32)(thumbnail_w)/ratio);
thumbnail_h = (S32)((F32)(thumbnail_h)/ratio);
-
- // Compute the preview offset within the preview rect: we want to center that preview in the available rect
- const S32 local_offset_x = (preview_rect.getWidth() - thumbnail_w) / 2 ;
- const S32 local_offset_y = (preview_rect.getHeight() - thumbnail_h) / 2 ;
-
- // Compute preview offset within the floater rect
- S32 offset_x = preview_rect.mLeft + local_offset_x;
- S32 offset_y = preview_rect.mBottom + local_offset_y;
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- // Apply floater transparency to the texture unless the floater is focused.
- F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
- LLColor4 color = LLColor4::white;
-
+
+ // Compute the preview offset within the preview rect: we want to center that preview in the available rect
+ const S32 local_offset_x = (preview_rect.getWidth() - thumbnail_w) / 2 ;
+ const S32 local_offset_y = (preview_rect.getHeight() - thumbnail_h) / 2 ;
+
+ // Compute preview offset within the floater rect
+ S32 offset_x = preview_rect.mLeft + local_offset_x;
+ S32 offset_y = preview_rect.mBottom + local_offset_y;
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ // Apply floater transparency to the texture unless the floater is focused.
+ F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+ LLColor4 color = LLColor4::white;
+
// Draw the preview texture
- gl_draw_scaled_image(offset_x, offset_y,
+ gl_draw_scaled_image(offset_x, offset_y,
thumbnail_w, thumbnail_h,
previewp->getBigThumbnailImage(), color % alpha);
- }
+ }
}
diff --git a/indra/newview/llfloaterbigpreview.h b/indra/newview/llfloaterbigpreview.h
index 513ed8da6e..62e878233b 100644
--- a/indra/newview/llfloaterbigpreview.h
+++ b/indra/newview/llfloaterbigpreview.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbigpreview.h
* @brief Display of extended (big) preview for snapshots
* @author merov@lindenlab.com
@@ -32,21 +32,21 @@
class LLFloaterBigPreview : public LLFloater
{
public:
- LLFloaterBigPreview(const LLSD& key);
+ LLFloaterBigPreview(const LLSD& key);
~LLFloaterBigPreview();
-
- BOOL postBuild();
- void draw();
- void onCancel();
+
+ BOOL postBuild();
+ void draw();
+ void onCancel();
void setPreview(LLView* previewp) { mPreviewHandle = previewp->getHandle(); }
void setFloaterOwner(LLFloater* floaterp) { mFloaterOwner = floaterp; }
bool isFloaterOwner(LLFloater* floaterp) const { return (mFloaterOwner == floaterp); }
void closeOnFloaterOwnerClosing(LLFloater* floaterp);
-
+
private:
- LLHandle<LLView> mPreviewHandle;
- LLUICtrl* mPreviewPlaceholder;
+ LLHandle<LLView> mPreviewHandle;
+ LLUICtrl* mPreviewPlaceholder;
LLFloater* mFloaterOwner;
};
diff --git a/indra/newview/llfloaterbuildoptions.cpp b/indra/newview/llfloaterbuildoptions.cpp
index 1b65d8d683..51139477a0 100644
--- a/indra/newview/llfloaterbuildoptions.cpp
+++ b/indra/newview/llfloaterbuildoptions.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbuildoptions.cpp
* @brief LLFloaterBuildOptions class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
/**
* Panel for setting global object-editing options, specifically
* grid size and spacing.
- */
+ */
#include "llviewerprecompiledheaders.h"
@@ -51,17 +51,17 @@ LLFloaterBuildOptions::~LLFloaterBuildOptions()
BOOL LLFloaterBuildOptions::postBuild()
{
- return TRUE;
+ return TRUE;
}
// virtual
void LLFloaterBuildOptions::onOpen(const LLSD& key)
{
- mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+ mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
}
// virtual
void LLFloaterBuildOptions::onClose(bool app_quitting)
{
- mObjectSelection = NULL;
+ mObjectSelection = NULL;
}
diff --git a/indra/newview/llfloaterbuildoptions.h b/indra/newview/llfloaterbuildoptions.h
index 02c56cb6a9..7b550a7807 100644
--- a/indra/newview/llfloaterbuildoptions.h
+++ b/indra/newview/llfloaterbuildoptions.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbuildoptions.h
* @brief LLFloaterBuildOptions class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,20 +40,20 @@ class LLObjectSelection;
typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
class LLFloaterBuildOptions
- : public LLFloater
+ : public LLFloater
{
public:
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
private:
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
- LLFloaterBuildOptions(const LLSD& key);
- ~LLFloaterBuildOptions();
+ LLFloaterBuildOptions(const LLSD& key);
+ ~LLFloaterBuildOptions();
- LLObjectSelectionHandle mObjectSelection;
+ LLObjectSelectionHandle mObjectSelection;
};
#endif
diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp
index abc9cdbcc2..243c546169 100644
--- a/indra/newview/llfloaterbulkpermission.cpp
+++ b/indra/newview/llfloaterbulkpermission.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbulkpermissions.cpp
* @author Michelle2 Zenovka
* @brief A floater which allows task inventory item's properties to be changed on mass.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,81 +51,81 @@
#include "roles_constants.h" // for GP_OBJECT_MANIPULATE
-LLFloaterBulkPermission::LLFloaterBulkPermission(const LLSD& seed)
-: LLFloater(seed),
- mDone(FALSE)
+LLFloaterBulkPermission::LLFloaterBulkPermission(const LLSD& seed)
+: LLFloater(seed),
+ mDone(FALSE)
{
- mID.generate();
- mCommitCallbackRegistrar.add("BulkPermission.Ok", boost::bind(&LLFloaterBulkPermission::onOkBtn, this));
- mCommitCallbackRegistrar.add("BulkPermission.Apply", boost::bind(&LLFloaterBulkPermission::onApplyBtn, this));
- mCommitCallbackRegistrar.add("BulkPermission.Close", boost::bind(&LLFloaterBulkPermission::onCloseBtn, this));
- mCommitCallbackRegistrar.add("BulkPermission.CheckAll", boost::bind(&LLFloaterBulkPermission::onCheckAll, this));
- mCommitCallbackRegistrar.add("BulkPermission.UncheckAll", boost::bind(&LLFloaterBulkPermission::onUncheckAll, this));
- mCommitCallbackRegistrar.add("BulkPermission.CommitCopy", boost::bind(&LLFloaterBulkPermission::onCommitCopy, this));
+ mID.generate();
+ mCommitCallbackRegistrar.add("BulkPermission.Ok", boost::bind(&LLFloaterBulkPermission::onOkBtn, this));
+ mCommitCallbackRegistrar.add("BulkPermission.Apply", boost::bind(&LLFloaterBulkPermission::onApplyBtn, this));
+ mCommitCallbackRegistrar.add("BulkPermission.Close", boost::bind(&LLFloaterBulkPermission::onCloseBtn, this));
+ mCommitCallbackRegistrar.add("BulkPermission.CheckAll", boost::bind(&LLFloaterBulkPermission::onCheckAll, this));
+ mCommitCallbackRegistrar.add("BulkPermission.UncheckAll", boost::bind(&LLFloaterBulkPermission::onUncheckAll, this));
+ mCommitCallbackRegistrar.add("BulkPermission.CommitCopy", boost::bind(&LLFloaterBulkPermission::onCommitCopy, this));
}
BOOL LLFloaterBulkPermission::postBuild()
{
- mBulkChangeIncludeAnimations = gSavedSettings.getBOOL("BulkChangeIncludeAnimations");
- mBulkChangeIncludeBodyParts = gSavedSettings.getBOOL("BulkChangeIncludeBodyParts");
- mBulkChangeIncludeClothing = gSavedSettings.getBOOL("BulkChangeIncludeClothing");
- mBulkChangeIncludeGestures = gSavedSettings.getBOOL("BulkChangeIncludeGestures");
- mBulkChangeIncludeNotecards = gSavedSettings.getBOOL("BulkChangeIncludeNotecards");
- mBulkChangeIncludeObjects = gSavedSettings.getBOOL("BulkChangeIncludeObjects");
- mBulkChangeIncludeScripts = gSavedSettings.getBOOL("BulkChangeIncludeScripts");
- mBulkChangeIncludeSounds = gSavedSettings.getBOOL("BulkChangeIncludeSounds");
- mBulkChangeIncludeTextures = gSavedSettings.getBOOL("BulkChangeIncludeTextures");
- mBulkChangeIncludeSettings = gSavedSettings.getBOOL("BulkChangeIncludeSettings");
+ mBulkChangeIncludeAnimations = gSavedSettings.getBOOL("BulkChangeIncludeAnimations");
+ mBulkChangeIncludeBodyParts = gSavedSettings.getBOOL("BulkChangeIncludeBodyParts");
+ mBulkChangeIncludeClothing = gSavedSettings.getBOOL("BulkChangeIncludeClothing");
+ mBulkChangeIncludeGestures = gSavedSettings.getBOOL("BulkChangeIncludeGestures");
+ mBulkChangeIncludeNotecards = gSavedSettings.getBOOL("BulkChangeIncludeNotecards");
+ mBulkChangeIncludeObjects = gSavedSettings.getBOOL("BulkChangeIncludeObjects");
+ mBulkChangeIncludeScripts = gSavedSettings.getBOOL("BulkChangeIncludeScripts");
+ mBulkChangeIncludeSounds = gSavedSettings.getBOOL("BulkChangeIncludeSounds");
+ mBulkChangeIncludeTextures = gSavedSettings.getBOOL("BulkChangeIncludeTextures");
+ mBulkChangeIncludeSettings = gSavedSettings.getBOOL("BulkChangeIncludeSettings");
mBulkChangeIncludeMaterials = gSavedSettings.getBOOL("BulkChangeIncludeMaterials");
- mBulkChangeShareWithGroup = gSavedSettings.getBOOL("BulkChangeShareWithGroup");
- mBulkChangeEveryoneCopy = gSavedSettings.getBOOL("BulkChangeEveryoneCopy");
- mBulkChangeNextOwnerModify = gSavedSettings.getBOOL("BulkChangeNextOwnerModify");
- mBulkChangeNextOwnerCopy = gSavedSettings.getBOOL("BulkChangeNextOwnerCopy");
- mBulkChangeNextOwnerTransfer = gSavedSettings.getBOOL("BulkChangeNextOwnerTransfer");
-
- // fix invalid permissions case (in case initial settings were generated by a viewer affected by MAINT-3339)
- if( !mBulkChangeNextOwnerTransfer && !mBulkChangeEveryoneCopy)
- {
- mBulkChangeNextOwnerTransfer = true;
- }
- return TRUE;
+ mBulkChangeShareWithGroup = gSavedSettings.getBOOL("BulkChangeShareWithGroup");
+ mBulkChangeEveryoneCopy = gSavedSettings.getBOOL("BulkChangeEveryoneCopy");
+ mBulkChangeNextOwnerModify = gSavedSettings.getBOOL("BulkChangeNextOwnerModify");
+ mBulkChangeNextOwnerCopy = gSavedSettings.getBOOL("BulkChangeNextOwnerCopy");
+ mBulkChangeNextOwnerTransfer = gSavedSettings.getBOOL("BulkChangeNextOwnerTransfer");
+
+ // fix invalid permissions case (in case initial settings were generated by a viewer affected by MAINT-3339)
+ if( !mBulkChangeNextOwnerTransfer && !mBulkChangeEveryoneCopy)
+ {
+ mBulkChangeNextOwnerTransfer = true;
+ }
+ return TRUE;
}
void LLFloaterBulkPermission::doApply()
{
- // Inspects a stream of selected object contents and adds modifiable ones to the given array.
- class ModifiableGatherer : public LLSelectedNodeFunctor
- {
- public:
- ModifiableGatherer(std::vector<LLUUID>& q) : mQueue(q) { mQueue.reserve(32); }
- virtual bool apply(LLSelectNode* node)
- {
- if( node->allowOperationOnNode(PERM_MODIFY, GP_OBJECT_MANIPULATE) )
- {
- mQueue.push_back(node->getObject()->getID());
- }
- return true;
- }
- private:
- std::vector<LLUUID>& mQueue;
- };
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
- list->deleteAllItems();
- ModifiableGatherer gatherer(mObjectIDs);
- LLSelectMgr::getInstance()->getSelection()->applyToNodes(&gatherer);
- if(mObjectIDs.empty())
- {
- list->setCommentText(getString("nothing_to_modify_text"));
- }
- else
- {
- mDone = FALSE;
- if (!start())
- {
- LL_WARNS() << "Unexpected bulk permission change failure." << LL_ENDL;
- }
- }
+ // Inspects a stream of selected object contents and adds modifiable ones to the given array.
+ class ModifiableGatherer : public LLSelectedNodeFunctor
+ {
+ public:
+ ModifiableGatherer(std::vector<LLUUID>& q) : mQueue(q) { mQueue.reserve(32); }
+ virtual bool apply(LLSelectNode* node)
+ {
+ if( node->allowOperationOnNode(PERM_MODIFY, GP_OBJECT_MANIPULATE) )
+ {
+ mQueue.push_back(node->getObject()->getID());
+ }
+ return true;
+ }
+ private:
+ std::vector<LLUUID>& mQueue;
+ };
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
+ list->deleteAllItems();
+ ModifiableGatherer gatherer(mObjectIDs);
+ LLSelectMgr::getInstance()->getSelection()->applyToNodes(&gatherer);
+ if(mObjectIDs.empty())
+ {
+ list->setCommentText(getString("nothing_to_modify_text"));
+ }
+ else
+ {
+ mDone = FALSE;
+ if (!start())
+ {
+ LL_WARNS() << "Unexpected bulk permission change failure." << LL_ENDL;
+ }
+ }
}
@@ -133,255 +133,255 @@ void LLFloaterBulkPermission::doApply()
// worked on.
// NOT static, virtual!
void LLFloaterBulkPermission::inventoryChanged(LLViewerObject* viewer_object,
- LLInventoryObject::object_list_t* inv,
- S32,
- void* q_id)
+ LLInventoryObject::object_list_t* inv,
+ S32,
+ void* q_id)
{
- //LL_INFOS() << "changed object: " << viewer_object->getID() << LL_ENDL;
-
- //Remove this listener from the object since its
- //listener callback is now being executed.
-
- //We remove the listener here because the function
- //removeVOInventoryListener removes the listener from a ViewerObject
- //which it internally stores.
-
- //If we call this further down in the function, calls to handleInventory
- //and nextObject may update the interally stored viewer object causing
- //the removal of the incorrect listener from an incorrect object.
-
- //Fixes SL-6119:Recompile scripts fails to complete
- removeVOInventoryListener();
-
- if (viewer_object && inv && (viewer_object->getID() == mCurrentObjectID) )
- {
- handleInventory(viewer_object, inv);
- }
- else
- {
- // something went wrong...
- // note that we're not working on this one, and move onto the
- // next object in the list.
- LL_WARNS() << "No inventory for " << mCurrentObjectID << LL_ENDL;
- nextObject();
- }
+ //LL_INFOS() << "changed object: " << viewer_object->getID() << LL_ENDL;
+
+ //Remove this listener from the object since its
+ //listener callback is now being executed.
+
+ //We remove the listener here because the function
+ //removeVOInventoryListener removes the listener from a ViewerObject
+ //which it internally stores.
+
+ //If we call this further down in the function, calls to handleInventory
+ //and nextObject may update the interally stored viewer object causing
+ //the removal of the incorrect listener from an incorrect object.
+
+ //Fixes SL-6119:Recompile scripts fails to complete
+ removeVOInventoryListener();
+
+ if (viewer_object && inv && (viewer_object->getID() == mCurrentObjectID) )
+ {
+ handleInventory(viewer_object, inv);
+ }
+ else
+ {
+ // something went wrong...
+ // note that we're not working on this one, and move onto the
+ // next object in the list.
+ LL_WARNS() << "No inventory for " << mCurrentObjectID << LL_ENDL;
+ nextObject();
+ }
}
void LLFloaterBulkPermission::onOkBtn()
{
- doApply();
- closeFloater();
+ doApply();
+ closeFloater();
}
void LLFloaterBulkPermission::onApplyBtn()
{
- doApply();
+ doApply();
}
void LLFloaterBulkPermission::onCloseBtn()
{
- gSavedSettings.setBOOL("BulkChangeIncludeAnimations", mBulkChangeIncludeAnimations);
- gSavedSettings.setBOOL("BulkChangeIncludeBodyParts", mBulkChangeIncludeBodyParts);
- gSavedSettings.setBOOL("BulkChangeIncludeClothing", mBulkChangeIncludeClothing);
- gSavedSettings.setBOOL("BulkChangeIncludeGestures", mBulkChangeIncludeGestures);
- gSavedSettings.setBOOL("BulkChangeIncludeNotecards", mBulkChangeIncludeNotecards);
- gSavedSettings.setBOOL("BulkChangeIncludeObjects", mBulkChangeIncludeObjects);
- gSavedSettings.setBOOL("BulkChangeIncludeScripts", mBulkChangeIncludeScripts);
- gSavedSettings.setBOOL("BulkChangeIncludeSounds", mBulkChangeIncludeSounds);
- gSavedSettings.setBOOL("BulkChangeIncludeTextures", mBulkChangeIncludeTextures);
- gSavedSettings.setBOOL("BulkChangeIncludeSettings", mBulkChangeIncludeSettings);
+ gSavedSettings.setBOOL("BulkChangeIncludeAnimations", mBulkChangeIncludeAnimations);
+ gSavedSettings.setBOOL("BulkChangeIncludeBodyParts", mBulkChangeIncludeBodyParts);
+ gSavedSettings.setBOOL("BulkChangeIncludeClothing", mBulkChangeIncludeClothing);
+ gSavedSettings.setBOOL("BulkChangeIncludeGestures", mBulkChangeIncludeGestures);
+ gSavedSettings.setBOOL("BulkChangeIncludeNotecards", mBulkChangeIncludeNotecards);
+ gSavedSettings.setBOOL("BulkChangeIncludeObjects", mBulkChangeIncludeObjects);
+ gSavedSettings.setBOOL("BulkChangeIncludeScripts", mBulkChangeIncludeScripts);
+ gSavedSettings.setBOOL("BulkChangeIncludeSounds", mBulkChangeIncludeSounds);
+ gSavedSettings.setBOOL("BulkChangeIncludeTextures", mBulkChangeIncludeTextures);
+ gSavedSettings.setBOOL("BulkChangeIncludeSettings", mBulkChangeIncludeSettings);
gSavedSettings.setBOOL("BulkChangeIncludeMaterials", mBulkChangeIncludeMaterials);
- gSavedSettings.setBOOL("BulkChangeShareWithGroup", mBulkChangeShareWithGroup);
- gSavedSettings.setBOOL("BulkChangeEveryoneCopy", mBulkChangeEveryoneCopy);
- gSavedSettings.setBOOL("BulkChangeNextOwnerModify", mBulkChangeNextOwnerModify);
- gSavedSettings.setBOOL("BulkChangeNextOwnerCopy", mBulkChangeNextOwnerCopy);
- gSavedSettings.setBOOL("BulkChangeNextOwnerTransfer", mBulkChangeNextOwnerTransfer);
- closeFloater();
+ gSavedSettings.setBOOL("BulkChangeShareWithGroup", mBulkChangeShareWithGroup);
+ gSavedSettings.setBOOL("BulkChangeEveryoneCopy", mBulkChangeEveryoneCopy);
+ gSavedSettings.setBOOL("BulkChangeNextOwnerModify", mBulkChangeNextOwnerModify);
+ gSavedSettings.setBOOL("BulkChangeNextOwnerCopy", mBulkChangeNextOwnerCopy);
+ gSavedSettings.setBOOL("BulkChangeNextOwnerTransfer", mBulkChangeNextOwnerTransfer);
+ closeFloater();
}
-//static
+//static
void LLFloaterBulkPermission::onCommitCopy()
{
- // Implements fair use
- BOOL copyable = gSavedSettings.getBOOL("BulkChangeNextOwnerCopy");
- if(!copyable)
- {
- gSavedSettings.setBOOL("BulkChangeNextOwnerTransfer", TRUE);
- }
- LLCheckBoxCtrl* xfer =getChild<LLCheckBoxCtrl>("next_owner_transfer");
- xfer->setEnabled(copyable);
+ // Implements fair use
+ BOOL copyable = gSavedSettings.getBOOL("BulkChangeNextOwnerCopy");
+ if(!copyable)
+ {
+ gSavedSettings.setBOOL("BulkChangeNextOwnerTransfer", TRUE);
+ }
+ LLCheckBoxCtrl* xfer =getChild<LLCheckBoxCtrl>("next_owner_transfer");
+ xfer->setEnabled(copyable);
}
BOOL LLFloaterBulkPermission::start()
{
- // note: number of top-level objects to modify is mObjectIDs.size().
- getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("start_text"));
- return nextObject();
+ // note: number of top-level objects to modify is mObjectIDs.size().
+ getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("start_text"));
+ return nextObject();
}
// Go to the next object and start if found. Returns false if no objects left, true otherwise.
BOOL LLFloaterBulkPermission::nextObject()
{
- S32 count;
- BOOL successful_start = FALSE;
- do
- {
- count = mObjectIDs.size();
- //LL_INFOS() << "Objects left to process = " << count << LL_ENDL;
- mCurrentObjectID.setNull();
- if(count > 0)
- {
- successful_start = popNext();
- //LL_INFOS() << (successful_start ? "successful" : "unsuccessful") << LL_ENDL;
- }
- } while((mObjectIDs.size() > 0) && !successful_start);
-
- if(isDone() && !mDone)
- {
- getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("done_text"));
- mDone = TRUE;
- }
- return successful_start;
+ S32 count;
+ BOOL successful_start = FALSE;
+ do
+ {
+ count = mObjectIDs.size();
+ //LL_INFOS() << "Objects left to process = " << count << LL_ENDL;
+ mCurrentObjectID.setNull();
+ if(count > 0)
+ {
+ successful_start = popNext();
+ //LL_INFOS() << (successful_start ? "successful" : "unsuccessful") << LL_ENDL;
+ }
+ } while((mObjectIDs.size() > 0) && !successful_start);
+
+ if(isDone() && !mDone)
+ {
+ getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("done_text"));
+ mDone = TRUE;
+ }
+ return successful_start;
}
// Pop the top object off of the queue.
// Return TRUE if the queue has started, otherwise FALSE.
BOOL LLFloaterBulkPermission::popNext()
{
- // get the head element from the container, and attempt to get its inventory.
- BOOL rv = FALSE;
- S32 count = mObjectIDs.size();
- if(mCurrentObjectID.isNull() && (count > 0))
- {
- mCurrentObjectID = mObjectIDs.at(0);
- //LL_INFOS() << "mCurrentID: " << mCurrentObjectID << LL_ENDL;
- mObjectIDs.erase(mObjectIDs.begin());
- LLViewerObject* obj = gObjectList.findObject(mCurrentObjectID);
- if(obj)
- {
- //LL_INFOS() << "requesting inv for " << mCurrentObjectID << LL_ENDL;
- LLUUID* id = new LLUUID(mID);
- registerVOInventoryListener(obj,id);
- requestVOInventory();
- rv = TRUE;
- }
- else
- {
- LL_INFOS()<<"NULL LLViewerObject" <<LL_ENDL;
- }
- }
-
- return rv;
+ // get the head element from the container, and attempt to get its inventory.
+ BOOL rv = FALSE;
+ S32 count = mObjectIDs.size();
+ if(mCurrentObjectID.isNull() && (count > 0))
+ {
+ mCurrentObjectID = mObjectIDs.at(0);
+ //LL_INFOS() << "mCurrentID: " << mCurrentObjectID << LL_ENDL;
+ mObjectIDs.erase(mObjectIDs.begin());
+ LLViewerObject* obj = gObjectList.findObject(mCurrentObjectID);
+ if(obj)
+ {
+ //LL_INFOS() << "requesting inv for " << mCurrentObjectID << LL_ENDL;
+ LLUUID* id = new LLUUID(mID);
+ registerVOInventoryListener(obj,id);
+ requestVOInventory();
+ rv = TRUE;
+ }
+ else
+ {
+ LL_INFOS()<<"NULL LLViewerObject" <<LL_ENDL;
+ }
+ }
+
+ return rv;
}
void LLFloaterBulkPermission::doCheckUncheckAll(BOOL check)
{
- gSavedSettings.setBOOL("BulkChangeIncludeAnimations", check);
- gSavedSettings.setBOOL("BulkChangeIncludeBodyParts" , check);
- gSavedSettings.setBOOL("BulkChangeIncludeClothing" , check);
- gSavedSettings.setBOOL("BulkChangeIncludeGestures" , check);
- gSavedSettings.setBOOL("BulkChangeIncludeNotecards" , check);
- gSavedSettings.setBOOL("BulkChangeIncludeObjects" , check);
- gSavedSettings.setBOOL("BulkChangeIncludeScripts" , check);
- gSavedSettings.setBOOL("BulkChangeIncludeSounds" , check);
- gSavedSettings.setBOOL("BulkChangeIncludeTextures" , check);
- gSavedSettings.setBOOL("BulkChangeIncludeSettings" , check);
+ gSavedSettings.setBOOL("BulkChangeIncludeAnimations", check);
+ gSavedSettings.setBOOL("BulkChangeIncludeBodyParts" , check);
+ gSavedSettings.setBOOL("BulkChangeIncludeClothing" , check);
+ gSavedSettings.setBOOL("BulkChangeIncludeGestures" , check);
+ gSavedSettings.setBOOL("BulkChangeIncludeNotecards" , check);
+ gSavedSettings.setBOOL("BulkChangeIncludeObjects" , check);
+ gSavedSettings.setBOOL("BulkChangeIncludeScripts" , check);
+ gSavedSettings.setBOOL("BulkChangeIncludeSounds" , check);
+ gSavedSettings.setBOOL("BulkChangeIncludeTextures" , check);
+ gSavedSettings.setBOOL("BulkChangeIncludeSettings" , check);
gSavedSettings.setBOOL("BulkChangeIncludeMaterials" , check);
}
void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv)
{
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
-
- LLInventoryObject::object_list_t::const_iterator it = inv->begin();
- LLInventoryObject::object_list_t::const_iterator end = inv->end();
- for ( ; it != end; ++it)
- {
- LLAssetType::EType asstype = (*it)->getType();
- if(
- ( asstype == LLAssetType::AT_ANIMATION && gSavedSettings.getBOOL("BulkChangeIncludeAnimations")) ||
- ( asstype == LLAssetType::AT_BODYPART && gSavedSettings.getBOOL("BulkChangeIncludeBodyParts" )) ||
- ( asstype == LLAssetType::AT_CLOTHING && gSavedSettings.getBOOL("BulkChangeIncludeClothing" )) ||
- ( asstype == LLAssetType::AT_GESTURE && gSavedSettings.getBOOL("BulkChangeIncludeGestures" )) ||
- ( asstype == LLAssetType::AT_NOTECARD && gSavedSettings.getBOOL("BulkChangeIncludeNotecards" )) ||
- ( asstype == LLAssetType::AT_OBJECT && gSavedSettings.getBOOL("BulkChangeIncludeObjects" )) ||
- ( asstype == LLAssetType::AT_LSL_TEXT && gSavedSettings.getBOOL("BulkChangeIncludeScripts" )) ||
- ( asstype == LLAssetType::AT_SOUND && gSavedSettings.getBOOL("BulkChangeIncludeSounds" )) ||
- ( asstype == LLAssetType::AT_SETTINGS && gSavedSettings.getBOOL("BulkChangeIncludeSettings" )) ||
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
+
+ LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+ LLInventoryObject::object_list_t::const_iterator end = inv->end();
+ for ( ; it != end; ++it)
+ {
+ LLAssetType::EType asstype = (*it)->getType();
+ if(
+ ( asstype == LLAssetType::AT_ANIMATION && gSavedSettings.getBOOL("BulkChangeIncludeAnimations")) ||
+ ( asstype == LLAssetType::AT_BODYPART && gSavedSettings.getBOOL("BulkChangeIncludeBodyParts" )) ||
+ ( asstype == LLAssetType::AT_CLOTHING && gSavedSettings.getBOOL("BulkChangeIncludeClothing" )) ||
+ ( asstype == LLAssetType::AT_GESTURE && gSavedSettings.getBOOL("BulkChangeIncludeGestures" )) ||
+ ( asstype == LLAssetType::AT_NOTECARD && gSavedSettings.getBOOL("BulkChangeIncludeNotecards" )) ||
+ ( asstype == LLAssetType::AT_OBJECT && gSavedSettings.getBOOL("BulkChangeIncludeObjects" )) ||
+ ( asstype == LLAssetType::AT_LSL_TEXT && gSavedSettings.getBOOL("BulkChangeIncludeScripts" )) ||
+ ( asstype == LLAssetType::AT_SOUND && gSavedSettings.getBOOL("BulkChangeIncludeSounds" )) ||
+ ( asstype == LLAssetType::AT_SETTINGS && gSavedSettings.getBOOL("BulkChangeIncludeSettings" )) ||
( asstype == LLAssetType::AT_MATERIAL && gSavedSettings.getBOOL("BulkChangeIncludeMaterials")) ||
- ( asstype == LLAssetType::AT_TEXTURE && gSavedSettings.getBOOL("BulkChangeIncludeTextures" )))
- {
- LLViewerObject* object = gObjectList.findObject(viewer_obj->getID());
-
- if (object)
- {
- LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
- LLViewerInventoryItem* new_item = (LLViewerInventoryItem*)item;
- LLPermissions perm(new_item->getPermissions());
-
- // chomp the inventory name so it fits in the scroll window nicely
- // and the user can see the [OK]
- std::string invname;
- invname=item->getName().substr(0,item->getName().size() < 30 ? item->getName().size() : 30 );
-
- LLUIString status_text = getString("status_text");
- status_text.setArg("[NAME]", invname.c_str());
- // Check whether we appear to have the appropriate permissions to change permission on this item.
- // Although the server will disallow any forbidden changes, it is a good idea to guess correctly
- // so that we can warn the user. The risk of getting this check wrong is therefore the possibility
- // of incorrectly choosing to not attempt to make a valid change.
- //
- // Trouble is this is extremely difficult to do and even when we know the results
- // it is difficult to design the best messaging. Therefore in this initial implementation
- // we'll always try to set the requested permissions and consider all cases successful
- // and perhaps later try to implement a smarter, friendlier solution. -MG
- if(true
- //gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE) // for group and everyone masks
- //|| something else // for next owner perms
- )
- {
- U32 mask_next = LLFloaterPerms::getNextOwnerPerms("BulkChange");
- if (asstype == LLAssetType::AT_SETTINGS)
- {
- mask_next |= PERM_COPY;
- }
- perm.setMaskNext(mask_next);
- perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("BulkChange"));
- perm.setMaskGroup(LLFloaterPerms::getGroupPerms("BulkChange"));
- new_item->setPermissions(perm); // here's the beef
- updateInventory(object,new_item,TASK_INVENTORY_ITEM_KEY,FALSE);
- //status_text.setArg("[STATUS]", getString("status_ok_text"));
- status_text.setArg("[STATUS]", "");
- }
- else
- {
- //status_text.setArg("[STATUS]", getString("status_bad_text"));
- status_text.setArg("[STATUS]", "");
- }
-
- list->setCommentText(status_text.getString());
-
- //TODO if we are an object inside an object we should check a recuse flag and if set
- //open the inventory of the object and recurse - Michelle2 Zenovka
-
- // if(recurse && ( (*it)->getType() == LLAssetType::AT_OBJECT && processObject))
- // {
- // I think we need to get the UUID of the object inside the inventory
- // call item->fetchFromServer();
- // we need a call back to say item has arrived *sigh*
- // we then need to do something like
- // LLUUID* id = new LLUUID(mID);
- // registerVOInventoryListener(obj,id);
- // requestVOInventory();
- // }
- }
- }
- }
-
- nextObject();
+ ( asstype == LLAssetType::AT_TEXTURE && gSavedSettings.getBOOL("BulkChangeIncludeTextures" )))
+ {
+ LLViewerObject* object = gObjectList.findObject(viewer_obj->getID());
+
+ if (object)
+ {
+ LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
+ LLViewerInventoryItem* new_item = (LLViewerInventoryItem*)item;
+ LLPermissions perm(new_item->getPermissions());
+
+ // chomp the inventory name so it fits in the scroll window nicely
+ // and the user can see the [OK]
+ std::string invname;
+ invname=item->getName().substr(0,item->getName().size() < 30 ? item->getName().size() : 30 );
+
+ LLUIString status_text = getString("status_text");
+ status_text.setArg("[NAME]", invname.c_str());
+ // Check whether we appear to have the appropriate permissions to change permission on this item.
+ // Although the server will disallow any forbidden changes, it is a good idea to guess correctly
+ // so that we can warn the user. The risk of getting this check wrong is therefore the possibility
+ // of incorrectly choosing to not attempt to make a valid change.
+ //
+ // Trouble is this is extremely difficult to do and even when we know the results
+ // it is difficult to design the best messaging. Therefore in this initial implementation
+ // we'll always try to set the requested permissions and consider all cases successful
+ // and perhaps later try to implement a smarter, friendlier solution. -MG
+ if(true
+ //gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE) // for group and everyone masks
+ //|| something else // for next owner perms
+ )
+ {
+ U32 mask_next = LLFloaterPerms::getNextOwnerPerms("BulkChange");
+ if (asstype == LLAssetType::AT_SETTINGS)
+ {
+ mask_next |= PERM_COPY;
+ }
+ perm.setMaskNext(mask_next);
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("BulkChange"));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms("BulkChange"));
+ new_item->setPermissions(perm); // here's the beef
+ updateInventory(object,new_item,TASK_INVENTORY_ITEM_KEY,FALSE);
+ //status_text.setArg("[STATUS]", getString("status_ok_text"));
+ status_text.setArg("[STATUS]", "");
+ }
+ else
+ {
+ //status_text.setArg("[STATUS]", getString("status_bad_text"));
+ status_text.setArg("[STATUS]", "");
+ }
+
+ list->setCommentText(status_text.getString());
+
+ //TODO if we are an object inside an object we should check a recuse flag and if set
+ //open the inventory of the object and recurse - Michelle2 Zenovka
+
+ // if(recurse && ( (*it)->getType() == LLAssetType::AT_OBJECT && processObject))
+ // {
+ // I think we need to get the UUID of the object inside the inventory
+ // call item->fetchFromServer();
+ // we need a call back to say item has arrived *sigh*
+ // we then need to do something like
+ // LLUUID* id = new LLUUID(mID);
+ // registerVOInventoryListener(obj,id);
+ // requestVOInventory();
+ // }
+ }
+ }
+ }
+
+ nextObject();
}
@@ -391,27 +391,27 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInve
void LLFloaterBulkPermission::updateInventory(LLViewerObject* object, LLViewerInventoryItem* item, U8 key, bool is_new)
{
- // This slices the object into what we're concerned about on the viewer.
- // The simulator will take the permissions and transfer ownership.
- LLPointer<LLViewerInventoryItem> task_item =
- new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(),
- item->getAssetUUID(), item->getType(),
- item->getInventoryType(),
- item->getName(), item->getDescription(),
- item->getSaleInfo(),
- item->getFlags(),
- item->getCreationDate());
- task_item->setTransactionID(item->getTransactionID());
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_UpdateTaskInventory);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_UpdateData);
- msg->addU32Fast(_PREHASH_LocalID, object->mLocalID);
- msg->addU8Fast(_PREHASH_Key, key);
- msg->nextBlockFast(_PREHASH_InventoryData);
- task_item->packMessage(msg);
- msg->sendReliable(object->getRegion()->getHost());
+ // This slices the object into what we're concerned about on the viewer.
+ // The simulator will take the permissions and transfer ownership.
+ LLPointer<LLViewerInventoryItem> task_item =
+ new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(),
+ item->getAssetUUID(), item->getType(),
+ item->getInventoryType(),
+ item->getName(), item->getDescription(),
+ item->getSaleInfo(),
+ item->getFlags(),
+ item->getCreationDate());
+ task_item->setTransactionID(item->getTransactionID());
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_UpdateTaskInventory);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_UpdateData);
+ msg->addU32Fast(_PREHASH_LocalID, object->mLocalID);
+ msg->addU8Fast(_PREHASH_Key, key);
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ task_item->packMessage(msg);
+ msg->sendReliable(object->getRegion()->getHost());
}
diff --git a/indra/newview/llfloaterbulkpermission.h b/indra/newview/llfloaterbulkpermission.h
index ab5d568667..a1f6b3d898 100644
--- a/indra/newview/llfloaterbulkpermission.h
+++ b/indra/newview/llfloaterbulkpermission.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbulkpermissions.h
* @brief Allow multiple task inventory properties to be set in one go.
* @author Michelle2 Zenovka
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,82 +38,82 @@
class LLFloaterBulkPermission : public LLFloater, public LLVOInventoryListener
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- BOOL postBuild();
+ BOOL postBuild();
private:
-
- LLFloaterBulkPermission(const LLSD& seed);
- virtual ~LLFloaterBulkPermission() {}
-
- BOOL start(); // returns TRUE if the queue has started, otherwise FALSE.
- BOOL nextObject();
- BOOL popNext();
-
- // This is the callback method for the viewer object currently
- // being worked on.
- /*virtual*/ void inventoryChanged(LLViewerObject* obj,
- LLInventoryObject::object_list_t* inv,
- S32 serial_num,
- void* queue);
-
- // This is called by inventoryChanged
- void handleInventory(LLViewerObject* viewer_obj,
- LLInventoryObject::object_list_t* inv);
-
-
- void updateInventory(LLViewerObject* object,
- LLViewerInventoryItem* item,
- U8 key,
- bool is_new);
-
- void onCloseBtn();
- void onOkBtn();
- void onApplyBtn();
- void onCommitCopy();
- void onCheckAll() { doCheckUncheckAll(TRUE); }
- void onUncheckAll() { doCheckUncheckAll(FALSE); }
-
- // returns true if this is done
- BOOL isDone() const { return (mCurrentObjectID.isNull() || (mObjectIDs.size() == 0)); }
-
- //Read the settings and Apply the permissions
- void doApply();
- void doCheckUncheckAll(BOOL check);
+
+ LLFloaterBulkPermission(const LLSD& seed);
+ virtual ~LLFloaterBulkPermission() {}
+
+ BOOL start(); // returns TRUE if the queue has started, otherwise FALSE.
+ BOOL nextObject();
+ BOOL popNext();
+
+ // This is the callback method for the viewer object currently
+ // being worked on.
+ /*virtual*/ void inventoryChanged(LLViewerObject* obj,
+ LLInventoryObject::object_list_t* inv,
+ S32 serial_num,
+ void* queue);
+
+ // This is called by inventoryChanged
+ void handleInventory(LLViewerObject* viewer_obj,
+ LLInventoryObject::object_list_t* inv);
+
+
+ void updateInventory(LLViewerObject* object,
+ LLViewerInventoryItem* item,
+ U8 key,
+ bool is_new);
+
+ void onCloseBtn();
+ void onOkBtn();
+ void onApplyBtn();
+ void onCommitCopy();
+ void onCheckAll() { doCheckUncheckAll(TRUE); }
+ void onUncheckAll() { doCheckUncheckAll(FALSE); }
+
+ // returns true if this is done
+ BOOL isDone() const { return (mCurrentObjectID.isNull() || (mObjectIDs.size() == 0)); }
+
+ //Read the settings and Apply the permissions
+ void doApply();
+ void doCheckUncheckAll(BOOL check);
private:
- // UI
- LLScrollListCtrl* mMessages;
- LLButton* mCloseBtn;
-
- // Object Queue
- std::vector<LLUUID> mObjectIDs;
- LLUUID mCurrentObjectID;
- BOOL mDone;
-
- bool mBulkChangeIncludeAnimations;
- bool mBulkChangeIncludeBodyParts;
- bool mBulkChangeIncludeClothing;
- bool mBulkChangeIncludeGestures;
- bool mBulkChangeIncludeNotecards;
- bool mBulkChangeIncludeObjects;
- bool mBulkChangeIncludeScripts;
- bool mBulkChangeIncludeSounds;
- bool mBulkChangeIncludeTextures;
- bool mBulkChangeIncludeSettings;
+ // UI
+ LLScrollListCtrl* mMessages;
+ LLButton* mCloseBtn;
+
+ // Object Queue
+ std::vector<LLUUID> mObjectIDs;
+ LLUUID mCurrentObjectID;
+ BOOL mDone;
+
+ bool mBulkChangeIncludeAnimations;
+ bool mBulkChangeIncludeBodyParts;
+ bool mBulkChangeIncludeClothing;
+ bool mBulkChangeIncludeGestures;
+ bool mBulkChangeIncludeNotecards;
+ bool mBulkChangeIncludeObjects;
+ bool mBulkChangeIncludeScripts;
+ bool mBulkChangeIncludeSounds;
+ bool mBulkChangeIncludeTextures;
+ bool mBulkChangeIncludeSettings;
bool mBulkChangeIncludeMaterials;
- bool mBulkChangeShareWithGroup;
- bool mBulkChangeEveryoneCopy;
- bool mBulkChangeNextOwnerModify;
- bool mBulkChangeNextOwnerCopy;
- bool mBulkChangeNextOwnerTransfer;
+ bool mBulkChangeShareWithGroup;
+ bool mBulkChangeEveryoneCopy;
+ bool mBulkChangeNextOwnerModify;
+ bool mBulkChangeNextOwnerCopy;
+ bool mBulkChangeNextOwnerTransfer;
- LLUUID mID;
+ LLUUID mID;
- const char* mStartString;
+ const char* mStartString;
};
#endif
diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp
index 307ab8c4d1..8138a3c976 100644
--- a/indra/newview/llfloaterbump.cpp
+++ b/indra/newview/llfloaterbump.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbump.cpp
* @brief Floater showing recent bumps, hits with objects, pushes, etc.
* @author Cory Ondrejka, James Cook
@@ -6,25 +6,25 @@
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
#include "llviewerprecompiledheaders.h"
#include "llsd.h"
@@ -48,227 +48,227 @@
///----------------------------------------------------------------------------
// Default constructor
-LLFloaterBump::LLFloaterBump(const LLSD& key)
-: LLFloater(key)
+LLFloaterBump::LLFloaterBump(const LLSD& key)
+: LLFloater(key)
{
- mCommitCallbackRegistrar.add("Avatar.SendIM", boost::bind(&LLFloaterBump::startIM, this));
- mCommitCallbackRegistrar.add("Avatar.ReportAbuse", boost::bind(&LLFloaterBump::reportAbuse, this));
- mCommitCallbackRegistrar.add("ShowAgentProfile", boost::bind(&LLFloaterBump::showProfile, this));
- mCommitCallbackRegistrar.add("Avatar.InviteToGroup", boost::bind(&LLFloaterBump::inviteToGroup, this));
- mCommitCallbackRegistrar.add("Avatar.Call", boost::bind(&LLFloaterBump::startCall, this));
- mEnableCallbackRegistrar.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
- mCommitCallbackRegistrar.add("Avatar.AddFriend", boost::bind(&LLFloaterBump::addFriend, this));
- mEnableCallbackRegistrar.add("Avatar.EnableAddFriend", boost::bind(&LLFloaterBump::enableAddFriend, this));
- mCommitCallbackRegistrar.add("Avatar.Mute", boost::bind(&LLFloaterBump::muteAvatar, this));
- mEnableCallbackRegistrar.add("Avatar.EnableMute", boost::bind(&LLFloaterBump::enableMute, this));
- mCommitCallbackRegistrar.add("PayObject", boost::bind(&LLFloaterBump::payAvatar, this));
- mCommitCallbackRegistrar.add("Tools.LookAtSelection", boost::bind(&LLFloaterBump::zoomInAvatar, this));
+ mCommitCallbackRegistrar.add("Avatar.SendIM", boost::bind(&LLFloaterBump::startIM, this));
+ mCommitCallbackRegistrar.add("Avatar.ReportAbuse", boost::bind(&LLFloaterBump::reportAbuse, this));
+ mCommitCallbackRegistrar.add("ShowAgentProfile", boost::bind(&LLFloaterBump::showProfile, this));
+ mCommitCallbackRegistrar.add("Avatar.InviteToGroup", boost::bind(&LLFloaterBump::inviteToGroup, this));
+ mCommitCallbackRegistrar.add("Avatar.Call", boost::bind(&LLFloaterBump::startCall, this));
+ mEnableCallbackRegistrar.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
+ mCommitCallbackRegistrar.add("Avatar.AddFriend", boost::bind(&LLFloaterBump::addFriend, this));
+ mEnableCallbackRegistrar.add("Avatar.EnableAddFriend", boost::bind(&LLFloaterBump::enableAddFriend, this));
+ mCommitCallbackRegistrar.add("Avatar.Mute", boost::bind(&LLFloaterBump::muteAvatar, this));
+ mEnableCallbackRegistrar.add("Avatar.EnableMute", boost::bind(&LLFloaterBump::enableMute, this));
+ mCommitCallbackRegistrar.add("PayObject", boost::bind(&LLFloaterBump::payAvatar, this));
+ mCommitCallbackRegistrar.add("Tools.LookAtSelection", boost::bind(&LLFloaterBump::zoomInAvatar, this));
}
// Destroys the object
LLFloaterBump::~LLFloaterBump()
{
- auto menu = mPopupMenuHandle.get();
- if (menu)
- {
- menu->die();
- mPopupMenuHandle.markDead();
- }
+ auto menu = mPopupMenuHandle.get();
+ if (menu)
+ {
+ menu->die();
+ mPopupMenuHandle.markDead();
+ }
}
BOOL LLFloaterBump::postBuild()
{
- mList = getChild<LLScrollListCtrl>("bump_list");
- mList->setAllowMultipleSelection(false);
- mList->setRightMouseDownCallback(boost::bind(&LLFloaterBump::onScrollListRightClicked, this, _1, _2, _3));
-
- LLContextMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>("menu_avatar_other.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if (menu)
- {
- mPopupMenuHandle = menu->getHandle();
- menu->setItemVisible(std::string("Normal"), false);
- menu->setItemVisible(std::string("Always use impostor"), false);
- menu->setItemVisible(std::string("Never use impostor"), false);
- menu->setItemVisible(std::string("Impostor seperator"), false);
- }
-
- return TRUE;
+ mList = getChild<LLScrollListCtrl>("bump_list");
+ mList->setAllowMultipleSelection(false);
+ mList->setRightMouseDownCallback(boost::bind(&LLFloaterBump::onScrollListRightClicked, this, _1, _2, _3));
+
+ LLContextMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>("menu_avatar_other.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (menu)
+ {
+ mPopupMenuHandle = menu->getHandle();
+ menu->setItemVisible(std::string("Normal"), false);
+ menu->setItemVisible(std::string("Always use impostor"), false);
+ menu->setItemVisible(std::string("Never use impostor"), false);
+ menu->setItemVisible(std::string("Impostor seperator"), false);
+ }
+
+ return TRUE;
}
// virtual
void LLFloaterBump::onOpen(const LLSD& key)
{
- if (gMeanCollisionList.empty())
- {
- mNames.clear();
- mList->deleteAllItems();
-
- std::string none_detected = getString("none_detected");
- LLSD row;
- row["columns"][0]["value"] = none_detected;
- row["columns"][0]["font"] = "SansSerifBold";
- mList->addElement(row);
- }
- else
- {
- populateCollisionList();
- }
+ if (gMeanCollisionList.empty())
+ {
+ mNames.clear();
+ mList->deleteAllItems();
+
+ std::string none_detected = getString("none_detected");
+ LLSD row;
+ row["columns"][0]["value"] = none_detected;
+ row["columns"][0]["font"] = "SansSerifBold";
+ mList->addElement(row);
+ }
+ else
+ {
+ populateCollisionList();
+ }
}
void LLFloaterBump::populateCollisionList()
{
- mNames.clear();
- mList->deleteAllItems();
-
- for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
- iter != gMeanCollisionList.end(); ++iter)
- {
- LLMeanCollisionData *mcd = *iter;
- add(mList, mcd);
- }
+ mNames.clear();
+ mList->deleteAllItems();
+
+ for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
+ iter != gMeanCollisionList.end(); ++iter)
+ {
+ LLMeanCollisionData *mcd = *iter;
+ add(mList, mcd);
+ }
}
void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd)
{
- if (mcd->mFullName.empty() || list->getItemCount() >= 20)
- {
- return;
- }
-
- std::string timeStr = getString ("timeStr");
- LLSD substitution;
-
- substitution["datetime"] = (S32) mcd->mTime;
- LLStringUtil::format (timeStr, substitution);
-
- std::string action;
- switch(mcd->mType)
- {
- case MEAN_BUMP:
- action = "bump";
- break;
- case MEAN_LLPUSHOBJECT:
- action = "llpushobject";
- break;
- case MEAN_SELECTED_OBJECT_COLLIDE:
- action = "selected_object_collide";
- break;
- case MEAN_SCRIPTED_OBJECT_COLLIDE:
- action = "scripted_object_collide";
- break;
- case MEAN_PHYSICAL_OBJECT_COLLIDE:
- action = "physical_object_collide";
- break;
- default:
- LL_INFOS() << "LLFloaterBump::add unknown mean collision type "
- << mcd->mType << LL_ENDL;
- return;
- }
-
- // All above action strings are in XML file
- LLUIString text = getString(action);
- text.setArg("[TIME]", timeStr);
- text.setArg("[NAME]", mcd->mFullName);
-
- LLSD row;
- row["id"] = mcd->mPerp;
- row["columns"][0]["value"] = text;
- row["columns"][0]["font"] = "SansSerifBold";
- list->addElement(row);
-
-
- mNames[mcd->mPerp] = mcd->mFullName;
+ if (mcd->mFullName.empty() || list->getItemCount() >= 20)
+ {
+ return;
+ }
+
+ std::string timeStr = getString ("timeStr");
+ LLSD substitution;
+
+ substitution["datetime"] = (S32) mcd->mTime;
+ LLStringUtil::format (timeStr, substitution);
+
+ std::string action;
+ switch(mcd->mType)
+ {
+ case MEAN_BUMP:
+ action = "bump";
+ break;
+ case MEAN_LLPUSHOBJECT:
+ action = "llpushobject";
+ break;
+ case MEAN_SELECTED_OBJECT_COLLIDE:
+ action = "selected_object_collide";
+ break;
+ case MEAN_SCRIPTED_OBJECT_COLLIDE:
+ action = "scripted_object_collide";
+ break;
+ case MEAN_PHYSICAL_OBJECT_COLLIDE:
+ action = "physical_object_collide";
+ break;
+ default:
+ LL_INFOS() << "LLFloaterBump::add unknown mean collision type "
+ << mcd->mType << LL_ENDL;
+ return;
+ }
+
+ // All above action strings are in XML file
+ LLUIString text = getString(action);
+ text.setArg("[TIME]", timeStr);
+ text.setArg("[NAME]", mcd->mFullName);
+
+ LLSD row;
+ row["id"] = mcd->mPerp;
+ row["columns"][0]["value"] = text;
+ row["columns"][0]["font"] = "SansSerifBold";
+ list->addElement(row);
+
+
+ mNames[mcd->mPerp] = mcd->mFullName;
}
void LLFloaterBump::onScrollListRightClicked(LLUICtrl* ctrl, S32 x, S32 y)
{
- if (!gMeanCollisionList.empty())
- {
- LLScrollListItem* item = mList->hitItem(x, y);
- auto menu = mPopupMenuHandle.get();
- if (item && menu)
- {
- mItemUUID = item->getUUID();
- menu->buildDrawLabels();
- menu->updateParent(LLMenuGL::sMenuContainer);
-
- std::string mute_msg = (LLMuteList::getInstance()->isMuted(mItemUUID, mNames[mItemUUID])) ? "UnmuteAvatar" : "MuteAvatar";
- menu->getChild<LLUICtrl>("Avatar Mute")->setValue(LLTrans::getString(mute_msg));
- menu->setItemEnabled(std::string("Zoom In"), bool(gObjectList.findObject(mItemUUID)));
-
- menu->show(x, y);
- LLMenuGL::showPopup(ctrl, menu, x, y);
- }
- }
+ if (!gMeanCollisionList.empty())
+ {
+ LLScrollListItem* item = mList->hitItem(x, y);
+ auto menu = mPopupMenuHandle.get();
+ if (item && menu)
+ {
+ mItemUUID = item->getUUID();
+ menu->buildDrawLabels();
+ menu->updateParent(LLMenuGL::sMenuContainer);
+
+ std::string mute_msg = (LLMuteList::getInstance()->isMuted(mItemUUID, mNames[mItemUUID])) ? "UnmuteAvatar" : "MuteAvatar";
+ menu->getChild<LLUICtrl>("Avatar Mute")->setValue(LLTrans::getString(mute_msg));
+ menu->setItemEnabled(std::string("Zoom In"), bool(gObjectList.findObject(mItemUUID)));
+
+ menu->show(x, y);
+ LLMenuGL::showPopup(ctrl, menu, x, y);
+ }
+ }
}
void LLFloaterBump::startIM()
{
- LLAvatarActions::startIM(mItemUUID);
+ LLAvatarActions::startIM(mItemUUID);
}
void LLFloaterBump::startCall()
{
- LLAvatarActions::startCall(mItemUUID);
+ LLAvatarActions::startCall(mItemUUID);
}
void LLFloaterBump::reportAbuse()
{
- LLFloaterReporter::showFromAvatar(mItemUUID, "av_name");
+ LLFloaterReporter::showFromAvatar(mItemUUID, "av_name");
}
void LLFloaterBump::showProfile()
{
- LLAvatarActions::showProfile(mItemUUID);
+ LLAvatarActions::showProfile(mItemUUID);
}
void LLFloaterBump::addFriend()
{
- LLAvatarActions::requestFriendshipDialog(mItemUUID);
+ LLAvatarActions::requestFriendshipDialog(mItemUUID);
}
bool LLFloaterBump::enableAddFriend()
{
- return !LLAvatarActions::isFriend(mItemUUID);
+ return !LLAvatarActions::isFriend(mItemUUID);
}
void LLFloaterBump::muteAvatar()
{
- LLMute mute(mItemUUID, mNames[mItemUUID], LLMute::AGENT);
- if (LLMuteList::getInstance()->isMuted(mute.mID))
- {
- LLMuteList::getInstance()->remove(mute);
- }
- else
- {
- LLMuteList::getInstance()->add(mute);
- LLPanelBlockedList::showPanelAndSelect(mute.mID);
- }
+ LLMute mute(mItemUUID, mNames[mItemUUID], LLMute::AGENT);
+ if (LLMuteList::getInstance()->isMuted(mute.mID))
+ {
+ LLMuteList::getInstance()->remove(mute);
+ }
+ else
+ {
+ LLMuteList::getInstance()->add(mute);
+ LLPanelBlockedList::showPanelAndSelect(mute.mID);
+ }
}
void LLFloaterBump::payAvatar()
{
- LLAvatarActions::pay(mItemUUID);
+ LLAvatarActions::pay(mItemUUID);
}
void LLFloaterBump::zoomInAvatar()
{
- handle_zoom_to_object(mItemUUID);
+ handle_zoom_to_object(mItemUUID);
}
bool LLFloaterBump::enableMute()
{
- return LLAvatarActions::canBlock(mItemUUID);
+ return LLAvatarActions::canBlock(mItemUUID);
}
void LLFloaterBump::inviteToGroup()
{
- LLAvatarActions::inviteToGroup(mItemUUID);
+ LLAvatarActions::inviteToGroup(mItemUUID);
}
LLFloaterBump* LLFloaterBump::getInstance()
{
- return LLFloaterReg::getTypedInstance<LLFloaterBump>("bumps");
+ return LLFloaterReg::getTypedInstance<LLFloaterBump>("bumps");
}
diff --git a/indra/newview/llfloaterbump.h b/indra/newview/llfloaterbump.h
index d2f9fabdd3..0ca7df50dd 100644
--- a/indra/newview/llfloaterbump.h
+++ b/indra/newview/llfloaterbump.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbump.h
* @brief Floater showing recent bumps, hits with objects, pushes, etc.
* @author Cory Ondrejka, James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,45 +34,45 @@
class LLMeanCollisionData;
class LLScrollListCtrl;
-class LLFloaterBump
+class LLFloaterBump
: public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
protected:
- void add(LLScrollListCtrl* list, LLMeanCollisionData *mcd);
- void onScrollListRightClicked(LLUICtrl* ctrl, S32 x, S32 y);
+ void add(LLScrollListCtrl* list, LLMeanCollisionData *mcd);
+ void onScrollListRightClicked(LLUICtrl* ctrl, S32 x, S32 y);
public:
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
-
- static LLFloaterBump* getInstance();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ static LLFloaterBump* getInstance();
- void populateCollisionList();
+ void populateCollisionList();
- void startIM();
- void startCall();
- void reportAbuse();
- void showProfile();
- void addFriend();
- void inviteToGroup();
- bool enableAddFriend();
- void muteAvatar();
- void payAvatar();
- void zoomInAvatar();
- bool enableMute();
+ void startIM();
+ void startCall();
+ void reportAbuse();
+ void showProfile();
+ void addFriend();
+ void inviteToGroup();
+ bool enableAddFriend();
+ void muteAvatar();
+ void payAvatar();
+ void zoomInAvatar();
+ bool enableMute();
private:
-
- LLFloaterBump(const LLSD& key);
- virtual ~LLFloaterBump();
- LLScrollListCtrl* mList;
- LLHandle<LLContextMenu> mPopupMenuHandle;
- LLUUID mItemUUID;
+ LLFloaterBump(const LLSD& key);
+ virtual ~LLFloaterBump();
+
+ LLScrollListCtrl* mList;
+ LLHandle<LLContextMenu> mPopupMenuHandle;
+ LLUUID mItemUUID;
- typedef std::map<LLUUID, std::string> uuid_map_t;
- uuid_map_t mNames;
+ typedef std::map<LLUUID, std::string> uuid_map_t;
+ uuid_map_t mNames;
};
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index ea93d3bfaa..ff2922e2ac 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbuy.cpp
* @author James Cook
* @brief LLFloaterBuy class implementation
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,8 +34,8 @@
#include "llfloaterbuy.h"
-#include "llagent.h" // for agent id
-#include "llinventorymodel.h" // for gInventory
+#include "llagent.h" // for agent id
+#include "llinventorymodel.h" // for gInventory
#include "llfloaterreg.h"
#include "llinventoryicon.h"
#include "llinventorydefines.h"
@@ -49,296 +49,296 @@
#include "lltrans.h"
LLFloaterBuy::LLFloaterBuy(const LLSD& key)
-: LLFloater(key),
- mSelectionUpdateSlot()
+: LLFloater(key),
+ mSelectionUpdateSlot()
{
}
BOOL LLFloaterBuy::postBuild()
{
- getChildView("object_list")->setEnabled(FALSE);
- getChildView("item_list")->setEnabled(FALSE);
+ getChildView("object_list")->setEnabled(FALSE);
+ getChildView("item_list")->setEnabled(FALSE);
+
+ getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickCancel, this));
+ getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickBuy, this));
- getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickCancel, this));
- getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickBuy, this));
+ setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130)
- setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130)
-
- // Always center the dialog. User can change the size,
- // but purchases are important and should be center screen.
- // This also avoids problems where the user resizes the application window
- // mid-session and the saved rect is off-center.
- center();
+ // Always center the dialog. User can change the size,
+ // but purchases are important and should be center screen.
+ // This also avoids problems where the user resizes the application window
+ // mid-session and the saved rect is off-center.
+ center();
- return TRUE;
+ return TRUE;
}
LLFloaterBuy::~LLFloaterBuy()
{
- mObjectSelection = NULL;
+ mObjectSelection = NULL;
}
void LLFloaterBuy::reset()
{
- LLScrollListCtrl* object_list = getChild<LLScrollListCtrl>("object_list");
- if (object_list) object_list->deleteAllItems();
+ LLScrollListCtrl* object_list = getChild<LLScrollListCtrl>("object_list");
+ if (object_list) object_list->deleteAllItems();
- LLScrollListCtrl* item_list = getChild<LLScrollListCtrl>("item_list");
- if (item_list) item_list->deleteAllItems();
+ LLScrollListCtrl* item_list = getChild<LLScrollListCtrl>("item_list");
+ if (item_list) item_list->deleteAllItems();
}
// static
void LLFloaterBuy::show(const LLSaleInfo& sale_info)
{
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
-
- if (selection->getRootObjectCount() != 1)
- {
- LLNotificationsUtil::add("BuyOneObjectOnly");
- return;
- }
-
- LLFloaterBuy* floater = LLFloaterReg::showTypedInstance<LLFloaterBuy>("buy_object");
- if (!floater)
- return;
-
- // Clean up the lists...
- floater->reset();
- floater->mSaleInfo = sale_info;
- floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
-
- LLSelectNode* node = selection->getFirstRootNode();
- if (!node)
- return;
-
- // Set title based on sale type
- LLUIString title;
- switch (sale_info.getSaleType())
- {
- case LLSaleInfo::FS_ORIGINAL:
- title = floater->getString("title_buy_text");
- break;
- case LLSaleInfo::FS_COPY:
- default:
- title = floater->getString("title_buy_copy_text");
- break;
- }
- title.setArg("[NAME]", node->mName);
- floater->setTitle(title);
-
- LLUUID owner_id;
- std::string owner_name;
- BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
- if (!owners_identical)
- {
- LLNotificationsUtil::add("BuyObjectOneOwner");
- return;
- }
-
- LLCtrlListInterface *object_list = floater->childGetListInterface("object_list");
- if (!object_list)
- {
- return;
- }
-
- // Update the display
- // Display next owner permissions
- LLSD row;
-
- // Compute icon for this item
- std::string icon_name = LLInventoryIcon::getIconName(LLAssetType::AT_OBJECT,
- LLInventoryType::IT_OBJECT);
-
- row["columns"][0]["column"] = "icon";
- row["columns"][0]["type"] = "icon";
- row["columns"][0]["value"] = icon_name;
-
- // Append the permissions that you will acquire (not the current
- // permissions).
- U32 next_owner_mask = node->mPermissions->getMaskNextOwner();
- std::string text = node->mName;
- if (!(next_owner_mask & PERM_COPY))
- {
- text.append(floater->getString("no_copy_text"));
- }
- if (!(next_owner_mask & PERM_MODIFY))
- {
- text.append(floater->getString("no_modify_text"));
- }
- if (!(next_owner_mask & PERM_TRANSFER))
- {
- text.append(floater->getString("no_transfer_text"));
- }
-
- row["columns"][1]["column"] = "text";
- row["columns"][1]["value"] = text;
- row["columns"][1]["font"] = "SANSSERIF";
-
- // Add after columns added so appropriate heights are correct.
- object_list->addElement(row);
-
- floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
- floater->getChild<LLUICtrl>("buy_name_text")->setTextArg("[NAME]", owner_name);
-
- floater->showViews(true);
-
- // Must do this after the floater is created, because
- // sometimes the inventory is already there and
- // the callback is called immediately.
- LLViewerObject* obj = selection->getFirstRootObject();
- floater->registerVOInventoryListener(obj,NULL);
- floater->requestVOInventory();
-
- if (!floater->mSelectionUpdateSlot.connected())
- {
- floater->mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterBuy::onSelectionChanged, floater));
- }
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+
+ if (selection->getRootObjectCount() != 1)
+ {
+ LLNotificationsUtil::add("BuyOneObjectOnly");
+ return;
+ }
+
+ LLFloaterBuy* floater = LLFloaterReg::showTypedInstance<LLFloaterBuy>("buy_object");
+ if (!floater)
+ return;
+
+ // Clean up the lists...
+ floater->reset();
+ floater->mSaleInfo = sale_info;
+ floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+
+ LLSelectNode* node = selection->getFirstRootNode();
+ if (!node)
+ return;
+
+ // Set title based on sale type
+ LLUIString title;
+ switch (sale_info.getSaleType())
+ {
+ case LLSaleInfo::FS_ORIGINAL:
+ title = floater->getString("title_buy_text");
+ break;
+ case LLSaleInfo::FS_COPY:
+ default:
+ title = floater->getString("title_buy_copy_text");
+ break;
+ }
+ title.setArg("[NAME]", node->mName);
+ floater->setTitle(title);
+
+ LLUUID owner_id;
+ std::string owner_name;
+ BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
+ if (!owners_identical)
+ {
+ LLNotificationsUtil::add("BuyObjectOneOwner");
+ return;
+ }
+
+ LLCtrlListInterface *object_list = floater->childGetListInterface("object_list");
+ if (!object_list)
+ {
+ return;
+ }
+
+ // Update the display
+ // Display next owner permissions
+ LLSD row;
+
+ // Compute icon for this item
+ std::string icon_name = LLInventoryIcon::getIconName(LLAssetType::AT_OBJECT,
+ LLInventoryType::IT_OBJECT);
+
+ row["columns"][0]["column"] = "icon";
+ row["columns"][0]["type"] = "icon";
+ row["columns"][0]["value"] = icon_name;
+
+ // Append the permissions that you will acquire (not the current
+ // permissions).
+ U32 next_owner_mask = node->mPermissions->getMaskNextOwner();
+ std::string text = node->mName;
+ if (!(next_owner_mask & PERM_COPY))
+ {
+ text.append(floater->getString("no_copy_text"));
+ }
+ if (!(next_owner_mask & PERM_MODIFY))
+ {
+ text.append(floater->getString("no_modify_text"));
+ }
+ if (!(next_owner_mask & PERM_TRANSFER))
+ {
+ text.append(floater->getString("no_transfer_text"));
+ }
+
+ row["columns"][1]["column"] = "text";
+ row["columns"][1]["value"] = text;
+ row["columns"][1]["font"] = "SANSSERIF";
+
+ // Add after columns added so appropriate heights are correct.
+ object_list->addElement(row);
+
+ floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
+ floater->getChild<LLUICtrl>("buy_name_text")->setTextArg("[NAME]", owner_name);
+
+ floater->showViews(true);
+
+ // Must do this after the floater is created, because
+ // sometimes the inventory is already there and
+ // the callback is called immediately.
+ LLViewerObject* obj = selection->getFirstRootObject();
+ floater->registerVOInventoryListener(obj,NULL);
+ floater->requestVOInventory();
+
+ if (!floater->mSelectionUpdateSlot.connected())
+ {
+ floater->mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterBuy::onSelectionChanged, floater));
+ }
}
void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
- LLInventoryObject::object_list_t* inv,
- S32 serial_num,
- void* data)
+ LLInventoryObject::object_list_t* inv,
+ S32 serial_num,
+ void* data)
{
- if (!obj)
- {
- LL_WARNS() << "No object in LLFloaterBuy::inventoryChanged" << LL_ENDL;
- return;
- }
-
- if (!inv)
- {
- LL_WARNS() << "No inventory in LLFloaterBuy::inventoryChanged"
- << LL_ENDL;
- removeVOInventoryListener();
- return;
- }
-
- LLCtrlListInterface *item_list = childGetListInterface("item_list");
- if (!item_list)
- {
- removeVOInventoryListener();
- return;
- }
-
- LLInventoryObject::object_list_t::const_iterator it = inv->begin();
- LLInventoryObject::object_list_t::const_iterator end = inv->end();
- for ( ; it != end; ++it )
- {
- LLInventoryObject* obj = (LLInventoryObject*)(*it);
-
- // Skip folders, so we know we have inventory items only
- if (obj->getType() == LLAssetType::AT_CATEGORY)
- continue;
-
- // Skip the mysterious blank InventoryObject
- if (obj->getType() == LLAssetType::AT_NONE)
- continue;
-
-
- LLInventoryItem* inv_item = (LLInventoryItem*)(obj);
-
- // Skip items we can't transfer
- if (!inv_item->getPermissions().allowTransferTo(gAgent.getID()))
- continue;
-
- // Create the line in the list
- LLSD row;
-
- // Compute icon for this item
- BOOL item_is_multi = FALSE;
- if (( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
- || inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
+ if (!obj)
+ {
+ LL_WARNS() << "No object in LLFloaterBuy::inventoryChanged" << LL_ENDL;
+ return;
+ }
+
+ if (!inv)
+ {
+ LL_WARNS() << "No inventory in LLFloaterBuy::inventoryChanged"
+ << LL_ENDL;
+ removeVOInventoryListener();
+ return;
+ }
+
+ LLCtrlListInterface *item_list = childGetListInterface("item_list");
+ if (!item_list)
+ {
+ removeVOInventoryListener();
+ return;
+ }
+
+ LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+ LLInventoryObject::object_list_t::const_iterator end = inv->end();
+ for ( ; it != end; ++it )
+ {
+ LLInventoryObject* obj = (LLInventoryObject*)(*it);
+
+ // Skip folders, so we know we have inventory items only
+ if (obj->getType() == LLAssetType::AT_CATEGORY)
+ continue;
+
+ // Skip the mysterious blank InventoryObject
+ if (obj->getType() == LLAssetType::AT_NONE)
+ continue;
+
+
+ LLInventoryItem* inv_item = (LLInventoryItem*)(obj);
+
+ // Skip items we can't transfer
+ if (!inv_item->getPermissions().allowTransferTo(gAgent.getID()))
+ continue;
+
+ // Create the line in the list
+ LLSD row;
+
+ // Compute icon for this item
+ BOOL item_is_multi = FALSE;
+ if (( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
+ || inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
&& !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK))
- {
- item_is_multi = TRUE;
- }
-
- std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
- inv_item->getInventoryType(),
- inv_item->getFlags(),
- item_is_multi);
- row["columns"][0]["column"] = "icon";
- row["columns"][0]["type"] = "icon";
- row["columns"][0]["value"] = icon_name;
-
- // Append the permissions that you will acquire (not the current
- // permissions).
- U32 next_owner_mask = inv_item->getPermissions().getMaskNextOwner();
- std::string text = obj->getName();
- if (!(next_owner_mask & PERM_COPY))
- {
- text.append(LLTrans::getString("no_copy"));
- }
- if (!(next_owner_mask & PERM_MODIFY))
- {
- text.append(LLTrans::getString("no_modify"));
- }
- if (!(next_owner_mask & PERM_TRANSFER))
- {
- text.append(LLTrans::getString("no_transfer"));
- }
-
- row["columns"][1]["column"] = "text";
- row["columns"][1]["value"] = text;
- row["columns"][1]["font"] = "SANSSERIF";
-
- item_list->addElement(row);
- }
- removeVOInventoryListener();
+ {
+ item_is_multi = TRUE;
+ }
+
+ std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
+ inv_item->getInventoryType(),
+ inv_item->getFlags(),
+ item_is_multi);
+ row["columns"][0]["column"] = "icon";
+ row["columns"][0]["type"] = "icon";
+ row["columns"][0]["value"] = icon_name;
+
+ // Append the permissions that you will acquire (not the current
+ // permissions).
+ U32 next_owner_mask = inv_item->getPermissions().getMaskNextOwner();
+ std::string text = obj->getName();
+ if (!(next_owner_mask & PERM_COPY))
+ {
+ text.append(LLTrans::getString("no_copy"));
+ }
+ if (!(next_owner_mask & PERM_MODIFY))
+ {
+ text.append(LLTrans::getString("no_modify"));
+ }
+ if (!(next_owner_mask & PERM_TRANSFER))
+ {
+ text.append(LLTrans::getString("no_transfer"));
+ }
+
+ row["columns"][1]["column"] = "text";
+ row["columns"][1]["value"] = text;
+ row["columns"][1]["font"] = "SANSSERIF";
+
+ item_list->addElement(row);
+ }
+ removeVOInventoryListener();
}
void LLFloaterBuy::onSelectionChanged()
{
-
- if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() == 0)
- {
- removeVOInventoryListener();
- closeFloater();
- }
- else if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() > 1)
- {
- removeVOInventoryListener();
- showViews(false);
- reset();
- setTitle(getString("mupliple_selected"));
- }
+
+ if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() == 0)
+ {
+ removeVOInventoryListener();
+ closeFloater();
+ }
+ else if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() > 1)
+ {
+ removeVOInventoryListener();
+ showViews(false);
+ reset();
+ setTitle(getString("mupliple_selected"));
+ }
}
void LLFloaterBuy::showViews(bool show)
{
- getChild<LLUICtrl>("buy_btn")->setEnabled(show);
- getChild<LLUICtrl>("buy_text")->setVisible(show);
- getChild<LLUICtrl>("buy_name_text")->setVisible(show);
+ getChild<LLUICtrl>("buy_btn")->setEnabled(show);
+ getChild<LLUICtrl>("buy_text")->setVisible(show);
+ getChild<LLUICtrl>("buy_name_text")->setVisible(show);
}
void LLFloaterBuy::onClickBuy()
{
- // Put the items where we put new folders.
- LLUUID category_id;
- category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
+ // Put the items where we put new folders.
+ LLUUID category_id;
+ category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
- // *NOTE: doesn't work for multiple object buy, which UI does not
- // currently support sale info is used for verification only, if
- // it doesn't match region info then sale is canceled.
- LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, mSaleInfo );
+ // *NOTE: doesn't work for multiple object buy, which UI does not
+ // currently support sale info is used for verification only, if
+ // it doesn't match region info then sale is canceled.
+ LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, mSaleInfo );
- closeFloater();
+ closeFloater();
}
void LLFloaterBuy::onClickCancel()
{
- closeFloater();
+ closeFloater();
}
// virtual
void LLFloaterBuy::onClose(bool app_quitting)
{
- if (mSelectionUpdateSlot.connected())
- {
- mSelectionUpdateSlot.disconnect();
- }
+ if (mSelectionUpdateSlot.connected())
+ {
+ mSelectionUpdateSlot.disconnect();
+ }
- mObjectSelection.clear();
+ mObjectSelection.clear();
}
diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h
index e83b3c6ba6..41e0161ed5 100644
--- a/indra/newview/llfloaterbuy.h
+++ b/indra/newview/llfloaterbuy.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbuy.h
* @author James Cook
* @brief LLFloaterBuy class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,7 +28,7 @@
/**
* Floater that appears when buying an object, giving a preview
* of its contents and their permissions.
- */
+ */
#ifndef LL_LLFLOATERBUY_H
#define LL_LLFLOATERBUY_H
@@ -46,34 +46,34 @@ class LLFloaterBuy
: public LLFloater, public LLVOInventoryListener
{
public:
- LLFloaterBuy(const LLSD& key);
- ~LLFloaterBuy();
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onClose(bool app_quitting);
-
- static void show(const LLSaleInfo& sale_info);
+ LLFloaterBuy(const LLSD& key);
+ ~LLFloaterBuy();
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onClose(bool app_quitting);
+
+ static void show(const LLSaleInfo& sale_info);
protected:
- void reset();
+ void reset();
- void requestObjectInventories();
- /*virtual*/ void inventoryChanged(LLViewerObject* obj,
- LLInventoryObject::object_list_t* inv,
- S32 serial_num,
- void* data);
+ void requestObjectInventories();
+ /*virtual*/ void inventoryChanged(LLViewerObject* obj,
+ LLInventoryObject::object_list_t* inv,
+ S32 serial_num,
+ void* data);
- void onSelectionChanged();
- void showViews(bool show);
+ void onSelectionChanged();
+ void showViews(bool show);
- void onClickBuy();
- void onClickCancel();
+ void onClickBuy();
+ void onClickCancel();
private:
- LLSafeHandle<LLObjectSelection> mObjectSelection;
- LLSaleInfo mSaleInfo;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
+ LLSaleInfo mSaleInfo;
- boost::signals2::connection mSelectionUpdateSlot;
+ boost::signals2::connection mSelectionUpdateSlot;
};
#endif
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index 440ec06c4e..955dc79f13 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbuycontents.cpp
* @author James Cook
* @brief LLFloaterBuyContents class implementation
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,12 +36,12 @@
#include "llcachename.h"
-#include "llagent.h" // for agent id
+#include "llagent.h" // for agent id
#include "llcheckboxctrl.h"
#include "llinventorydefines.h"
#include "llinventoryfunctions.h"
#include "llinventoryicon.h"
-#include "llinventorymodel.h" // for gInventory
+#include "llinventorymodel.h" // for gInventory
#include "llfirstuse.h"
#include "llfloaterreg.h"
#include "llnotificationsutil.h"
@@ -53,249 +53,249 @@
#include "llviewerwindow.h"
LLFloaterBuyContents::LLFloaterBuyContents(const LLSD& key)
-: LLFloater(key)
+: LLFloater(key)
{
}
BOOL LLFloaterBuyContents::postBuild()
{
- getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickCancel, this));
- getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickBuy, this));
+ getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickCancel, this));
+ getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickBuy, this));
+
+ getChildView("item_list")->setEnabled(FALSE);
+ getChildView("buy_btn")->setEnabled(FALSE);
+ getChildView("wear_check")->setEnabled(FALSE);
- getChildView("item_list")->setEnabled(FALSE);
- getChildView("buy_btn")->setEnabled(FALSE);
- getChildView("wear_check")->setEnabled(FALSE);
+ setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130)
- setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130)
+ // Always center the dialog. User can change the size,
+ // but purchases are important and should be center screen.
+ // This also avoids problems where the user resizes the application window
+ // mid-session and the saved rect is off-center.
+ center();
- // Always center the dialog. User can change the size,
- // but purchases are important and should be center screen.
- // This also avoids problems where the user resizes the application window
- // mid-session and the saved rect is off-center.
- center();
-
- return TRUE;
+ return TRUE;
}
LLFloaterBuyContents::~LLFloaterBuyContents()
{
- removeVOInventoryListener();
+ removeVOInventoryListener();
}
// static
void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
{
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
-
- if (selection->getRootObjectCount() != 1)
- {
- LLNotificationsUtil::add("BuyContentsOneOnly");
- return;
- }
-
- LLFloaterBuyContents* floater = LLFloaterReg::showTypedInstance<LLFloaterBuyContents>("buy_object_contents");
- if (!floater)
- return;
-
- LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("item_list");
- if (list)
- list->deleteAllItems();
-
- floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
-
- LLUUID owner_id;
- std::string owner_name;
- BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
- if (!owners_identical)
- {
- LLNotificationsUtil::add("BuyContentsOneOwner");
- return;
- }
-
- floater->mSaleInfo = sale_info;
-
- // Update the display
- LLSelectNode* node = selection->getFirstRootNode();
- if (!node) return;
- if(node->mPermissions->isGroupOwned())
- {
- gCacheName->getGroupName(owner_id, owner_name);
- }
-
- floater->getChild<LLUICtrl>("contains_text")->setTextArg("[NAME]", node->mName);
- floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
- floater->getChild<LLUICtrl>("buy_text")->setTextArg("[NAME]", owner_name);
-
- // Must do this after the floater is created, because
- // sometimes the inventory is already there and
- // the callback is called immediately.
- LLViewerObject* obj = selection->getFirstRootObject();
- floater->registerVOInventoryListener(obj,NULL);
- floater->requestVOInventory();
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+
+ if (selection->getRootObjectCount() != 1)
+ {
+ LLNotificationsUtil::add("BuyContentsOneOnly");
+ return;
+ }
+
+ LLFloaterBuyContents* floater = LLFloaterReg::showTypedInstance<LLFloaterBuyContents>("buy_object_contents");
+ if (!floater)
+ return;
+
+ LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("item_list");
+ if (list)
+ list->deleteAllItems();
+
+ floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+
+ LLUUID owner_id;
+ std::string owner_name;
+ BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
+ if (!owners_identical)
+ {
+ LLNotificationsUtil::add("BuyContentsOneOwner");
+ return;
+ }
+
+ floater->mSaleInfo = sale_info;
+
+ // Update the display
+ LLSelectNode* node = selection->getFirstRootNode();
+ if (!node) return;
+ if(node->mPermissions->isGroupOwned())
+ {
+ gCacheName->getGroupName(owner_id, owner_name);
+ }
+
+ floater->getChild<LLUICtrl>("contains_text")->setTextArg("[NAME]", node->mName);
+ floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
+ floater->getChild<LLUICtrl>("buy_text")->setTextArg("[NAME]", owner_name);
+
+ // Must do this after the floater is created, because
+ // sometimes the inventory is already there and
+ // the callback is called immediately.
+ LLViewerObject* obj = selection->getFirstRootObject();
+ floater->registerVOInventoryListener(obj,NULL);
+ floater->requestVOInventory();
}
void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
- LLInventoryObject::object_list_t* inv,
- S32 serial_num,
- void* data)
+ LLInventoryObject::object_list_t* inv,
+ S32 serial_num,
+ void* data)
{
- if (!obj)
- {
- LL_WARNS() << "No object in LLFloaterBuyContents::inventoryChanged" << LL_ENDL;
- return;
- }
-
- LLScrollListCtrl* item_list = getChild<LLScrollListCtrl>("item_list");
- if (!item_list)
- {
- removeVOInventoryListener();
- return;
- }
-
- item_list->deleteAllItems();
-
- if (!inv)
- {
- LL_WARNS() << "No inventory in LLFloaterBuyContents::inventoryChanged"
- << LL_ENDL;
-
- return;
- }
-
- // default to turning off the buy button.
- LLView* buy_btn = getChildView("buy_btn");
- buy_btn->setEnabled(FALSE);
-
- LLUUID owner_id;
- BOOL is_group_owned;
- LLAssetType::EType asset_type;
- LLInventoryType::EType inv_type;
- S32 wearable_count = 0;
-
- LLInventoryObject::object_list_t::const_iterator it = inv->begin();
- LLInventoryObject::object_list_t::const_iterator end = inv->end();
-
- for ( ; it != end; ++it )
- {
- asset_type = (*it)->getType();
-
- // Skip folders, so we know we have inventory items only
- if (asset_type == LLAssetType::AT_CATEGORY)
- continue;
-
- LLInventoryItem* inv_item = (LLInventoryItem*)((LLInventoryObject*)(*it));
- inv_type = inv_item->getInventoryType();
-
- // Count clothing items for later
- if (LLInventoryType::IT_WEARABLE == inv_type)
- {
- wearable_count++;
- }
-
- // Skip items the object's owner can't copy (and hence can't sell)
- if (!inv_item->getPermissions().getOwnership(owner_id, is_group_owned))
- continue;
-
- if (!inv_item->getPermissions().allowCopyBy(owner_id, owner_id))
- continue;
-
- // Skip items we can't transfer
- if (!inv_item->getPermissions().allowTransferTo(gAgent.getID()))
- continue;
-
- // There will be at least one item shown in the display, so go
- // ahead and enable the buy button.
- buy_btn->setEnabled(TRUE);
-
- // Create the line in the list
- LLSD row;
-
- BOOL item_is_multi = FALSE;
- if ((inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
- || inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
+ if (!obj)
+ {
+ LL_WARNS() << "No object in LLFloaterBuyContents::inventoryChanged" << LL_ENDL;
+ return;
+ }
+
+ LLScrollListCtrl* item_list = getChild<LLScrollListCtrl>("item_list");
+ if (!item_list)
+ {
+ removeVOInventoryListener();
+ return;
+ }
+
+ item_list->deleteAllItems();
+
+ if (!inv)
+ {
+ LL_WARNS() << "No inventory in LLFloaterBuyContents::inventoryChanged"
+ << LL_ENDL;
+
+ return;
+ }
+
+ // default to turning off the buy button.
+ LLView* buy_btn = getChildView("buy_btn");
+ buy_btn->setEnabled(FALSE);
+
+ LLUUID owner_id;
+ BOOL is_group_owned;
+ LLAssetType::EType asset_type;
+ LLInventoryType::EType inv_type;
+ S32 wearable_count = 0;
+
+ LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+ LLInventoryObject::object_list_t::const_iterator end = inv->end();
+
+ for ( ; it != end; ++it )
+ {
+ asset_type = (*it)->getType();
+
+ // Skip folders, so we know we have inventory items only
+ if (asset_type == LLAssetType::AT_CATEGORY)
+ continue;
+
+ LLInventoryItem* inv_item = (LLInventoryItem*)((LLInventoryObject*)(*it));
+ inv_type = inv_item->getInventoryType();
+
+ // Count clothing items for later
+ if (LLInventoryType::IT_WEARABLE == inv_type)
+ {
+ wearable_count++;
+ }
+
+ // Skip items the object's owner can't copy (and hence can't sell)
+ if (!inv_item->getPermissions().getOwnership(owner_id, is_group_owned))
+ continue;
+
+ if (!inv_item->getPermissions().allowCopyBy(owner_id, owner_id))
+ continue;
+
+ // Skip items we can't transfer
+ if (!inv_item->getPermissions().allowTransferTo(gAgent.getID()))
+ continue;
+
+ // There will be at least one item shown in the display, so go
+ // ahead and enable the buy button.
+ buy_btn->setEnabled(TRUE);
+
+ // Create the line in the list
+ LLSD row;
+
+ BOOL item_is_multi = FALSE;
+ if ((inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
+ || inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
&& !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK))
- {
- item_is_multi = TRUE;
- }
-
- std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
- inv_item->getInventoryType(),
- inv_item->getFlags(),
- item_is_multi);
- row["columns"][0]["column"] = "icon";
- row["columns"][0]["type"] = "icon";
- row["columns"][0]["value"] = icon_name;
-
- // Append the permissions that you will acquire (not the current
- // permissions).
- U32 next_owner_mask = inv_item->getPermissions().getMaskNextOwner();
- std::string text = (*it)->getName();
-
- if (!(next_owner_mask & PERM_COPY))
- {
- text.append(getString("no_copy_text"));
- }
- if (!(next_owner_mask & PERM_MODIFY))
- {
- text.append(getString("no_modify_text"));
- }
- if (!(next_owner_mask & PERM_TRANSFER))
- {
- text.append(getString("no_transfer_text"));
- }
-
- row["columns"][1]["column"] = "text";
- row["columns"][1]["value"] = text;
- row["columns"][1]["font"] = "SANSSERIF";
-
- item_list->addElement(row);
- }
-
- if (wearable_count > 0)
- {
- getChildView("wear_check")->setEnabled(TRUE);
- getChild<LLUICtrl>("wear_check")->setValue(LLSD(false) );
- }
+ {
+ item_is_multi = TRUE;
+ }
+
+ std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
+ inv_item->getInventoryType(),
+ inv_item->getFlags(),
+ item_is_multi);
+ row["columns"][0]["column"] = "icon";
+ row["columns"][0]["type"] = "icon";
+ row["columns"][0]["value"] = icon_name;
+
+ // Append the permissions that you will acquire (not the current
+ // permissions).
+ U32 next_owner_mask = inv_item->getPermissions().getMaskNextOwner();
+ std::string text = (*it)->getName();
+
+ if (!(next_owner_mask & PERM_COPY))
+ {
+ text.append(getString("no_copy_text"));
+ }
+ if (!(next_owner_mask & PERM_MODIFY))
+ {
+ text.append(getString("no_modify_text"));
+ }
+ if (!(next_owner_mask & PERM_TRANSFER))
+ {
+ text.append(getString("no_transfer_text"));
+ }
+
+ row["columns"][1]["column"] = "text";
+ row["columns"][1]["value"] = text;
+ row["columns"][1]["font"] = "SANSSERIF";
+
+ item_list->addElement(row);
+ }
+
+ if (wearable_count > 0)
+ {
+ getChildView("wear_check")->setEnabled(TRUE);
+ getChild<LLUICtrl>("wear_check")->setValue(LLSD(false) );
+ }
}
void LLFloaterBuyContents::onClickBuy()
{
- // Make sure this wasn't selected through other mechanisms
- // (ie, being the default button and pressing enter.
- if(!getChildView("buy_btn")->getEnabled())
- {
- // We shouldn't be enabled. Just close.
- closeFloater();
- return;
- }
-
- // We may want to wear this item
- if (getChild<LLUICtrl>("wear_check")->getValue())
- {
- LLInventoryState::sWearNewClothing = TRUE;
- }
-
- // Put the items where we put new folders.
- LLUUID category_id;
- category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ROOT_INVENTORY);
-
- // *NOTE: doesn't work for multiple object buy, which UI does not
- // currently support sale info is used for verification only, if
- // it doesn't match region info then sale is canceled.
- LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, mSaleInfo);
-
- // NOTE: do this here instead of on receipt of object, since contents are transfered
- // via a generic BulkUpdateInventory message with no way of distinguishing it from
- // other inventory operations
- LLFirstUse::newInventory();
- closeFloater();
+ // Make sure this wasn't selected through other mechanisms
+ // (ie, being the default button and pressing enter.
+ if(!getChildView("buy_btn")->getEnabled())
+ {
+ // We shouldn't be enabled. Just close.
+ closeFloater();
+ return;
+ }
+
+ // We may want to wear this item
+ if (getChild<LLUICtrl>("wear_check")->getValue())
+ {
+ LLInventoryState::sWearNewClothing = TRUE;
+ }
+
+ // Put the items where we put new folders.
+ LLUUID category_id;
+ category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ROOT_INVENTORY);
+
+ // *NOTE: doesn't work for multiple object buy, which UI does not
+ // currently support sale info is used for verification only, if
+ // it doesn't match region info then sale is canceled.
+ LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, mSaleInfo);
+
+ // NOTE: do this here instead of on receipt of object, since contents are transfered
+ // via a generic BulkUpdateInventory message with no way of distinguishing it from
+ // other inventory operations
+ LLFirstUse::newInventory();
+ closeFloater();
}
void LLFloaterBuyContents::onClickCancel()
{
- closeFloater();
+ closeFloater();
}
diff --git a/indra/newview/llfloaterbuycontents.h b/indra/newview/llfloaterbuycontents.h
index 19393fb6af..c397b11400 100644
--- a/indra/newview/llfloaterbuycontents.h
+++ b/indra/newview/llfloaterbuycontents.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterbuycontents.h
* @author James Cook
* @brief LLFloaterBuyContents class header file
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,25 +44,25 @@ class LLFloaterBuyContents
: public LLFloater, public LLVOInventoryListener
{
public:
- static void show(const LLSaleInfo& sale_info);
+ static void show(const LLSaleInfo& sale_info);
+
+ LLFloaterBuyContents(const LLSD& key);
+ ~LLFloaterBuyContents();
+ /*virtual*/ BOOL postBuild();
- LLFloaterBuyContents(const LLSD& key);
- ~LLFloaterBuyContents();
- /*virtual*/ BOOL postBuild();
-
protected:
- void requestObjectInventories();
- /*virtual*/ void inventoryChanged(LLViewerObject* obj,
- LLInventoryObject::object_list_t* inv,
- S32 serial_num,
- void* data);
-
- void onClickBuy();
- void onClickCancel();
+ void requestObjectInventories();
+ /*virtual*/ void inventoryChanged(LLViewerObject* obj,
+ LLInventoryObject::object_list_t* inv,
+ S32 serial_num,
+ void* data);
+
+ void onClickBuy();
+ void onClickCancel();
protected:
- LLSafeHandle<LLObjectSelection> mObjectSelection;
- LLSaleInfo mSaleInfo;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
+ LLSaleInfo mSaleInfo;
};
#endif
diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp
index 0cfac166c7..e1bc110061 100644
--- a/indra/newview/llfloaterbuycurrency.cpp
+++ b/indra/newview/llfloaterbuycurrency.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbuycurrency.cpp
* @brief LLFloaterBuyCurrency class implementation
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,41 +47,41 @@
static const S32 MINIMUM_BALANCE_AMOUNT = 0;
class LLFloaterBuyCurrencyUI
-: public LLFloater
+: public LLFloater
{
public:
- LLFloaterBuyCurrencyUI(const LLSD& key);
- virtual ~LLFloaterBuyCurrencyUI();
+ LLFloaterBuyCurrencyUI(const LLSD& key);
+ virtual ~LLFloaterBuyCurrencyUI();
public:
- LLViewChildren mChildren;
- LLCurrencyUIManager mManager;
-
- bool mHasTarget;
- S32 mTargetPrice;
- S32 mRequiredAmount;
-
+ LLViewChildren mChildren;
+ LLCurrencyUIManager mManager;
+
+ bool mHasTarget;
+ S32 mTargetPrice;
+ S32 mRequiredAmount;
+
public:
- void noTarget();
- void target(const std::string& name, S32 price);
-
- virtual BOOL postBuild();
-
- void updateUI();
- void collapsePanels(bool collapse);
-
- virtual void draw();
- virtual BOOL canClose();
-
- void onClickBuy();
- void onClickCancel();
+ void noTarget();
+ void target(const std::string& name, S32 price);
+
+ virtual BOOL postBuild();
+
+ void updateUI();
+ void collapsePanels(bool collapse);
+
+ virtual void draw();
+ virtual BOOL canClose();
+
+ void onClickBuy();
+ void onClickCancel();
};
LLFloater* LLFloaterBuyCurrency::buildFloater(const LLSD& key)
{
- LLFloaterBuyCurrencyUI* floater = new LLFloaterBuyCurrencyUI(key);
- return floater;
+ LLFloaterBuyCurrencyUI* floater = new LLFloaterBuyCurrencyUI(key);
+ return floater;
}
#if LL_WINDOWS
@@ -90,13 +90,13 @@ LLFloater* LLFloaterBuyCurrency::buildFloater(const LLSD& key)
// already valid, so this call does the correct thing. Disable the
// warning so that we can compile without generating a warning.
#pragma warning(disable : 4355)
-#endif
+#endif
LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI(const LLSD& key)
-: LLFloater(key),
- mChildren(*this),
- mManager(*this),
- mHasTarget(false),
- mTargetPrice(0)
+: LLFloater(key),
+ mChildren(*this),
+ mManager(*this),
+ mHasTarget(false),
+ mTargetPrice(0)
{
}
@@ -107,188 +107,188 @@ LLFloaterBuyCurrencyUI::~LLFloaterBuyCurrencyUI()
void LLFloaterBuyCurrencyUI::noTarget()
{
- mHasTarget = false;
- mTargetPrice = 0;
- mManager.setAmount(0);
+ mHasTarget = false;
+ mTargetPrice = 0;
+ mManager.setAmount(0);
}
void LLFloaterBuyCurrencyUI::target(const std::string& name, S32 price)
{
- mHasTarget = true;
- mTargetPrice = price;
-
- if (!name.empty())
- {
- getChild<LLUICtrl>("target_price_label")->setValue(name);
- }
-
- S32 balance = gStatusBar->getBalance();
- S32 need = price - balance;
- if (need < 0)
- {
- need = 0;
- }
-
- mRequiredAmount = need + MINIMUM_BALANCE_AMOUNT;
- mManager.setAmount(0);
+ mHasTarget = true;
+ mTargetPrice = price;
+
+ if (!name.empty())
+ {
+ getChild<LLUICtrl>("target_price_label")->setValue(name);
+ }
+
+ S32 balance = gStatusBar->getBalance();
+ S32 need = price - balance;
+ if (need < 0)
+ {
+ need = 0;
+ }
+
+ mRequiredAmount = need + MINIMUM_BALANCE_AMOUNT;
+ mManager.setAmount(0);
}
// virtual
BOOL LLFloaterBuyCurrencyUI::postBuild()
{
- mManager.prepare();
-
- getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickBuy, this));
- getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickCancel, this));
-
- center();
-
- updateUI();
-
- return TRUE;
+ mManager.prepare();
+
+ getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickBuy, this));
+ getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickCancel, this));
+
+ center();
+
+ updateUI();
+
+ return TRUE;
}
void LLFloaterBuyCurrencyUI::draw()
{
- if (mManager.process())
- {
- if (mManager.bought())
- {
- LLNotificationsUtil::add("BuyLindenDollarSuccess");
- closeFloater();
- return;
- }
-
- updateUI();
- }
-
- // disable the Buy button when we are not able to buy
- getChildView("buy_btn")->setEnabled(mManager.canBuy());
-
- LLFloater::draw();
+ if (mManager.process())
+ {
+ if (mManager.bought())
+ {
+ LLNotificationsUtil::add("BuyLindenDollarSuccess");
+ closeFloater();
+ return;
+ }
+
+ updateUI();
+ }
+
+ // disable the Buy button when we are not able to buy
+ getChildView("buy_btn")->setEnabled(mManager.canBuy());
+
+ LLFloater::draw();
}
BOOL LLFloaterBuyCurrencyUI::canClose()
{
- return mManager.canCancel();
+ return mManager.canCancel();
}
void LLFloaterBuyCurrencyUI::updateUI()
{
- bool hasError = mManager.hasError();
- mManager.updateUI(!hasError && !mManager.buying());
-
- // hide most widgets - we'll turn them on as needed next
- getChildView("info_buying")->setVisible(FALSE);
- getChildView("info_need_more")->setVisible(FALSE);
- getChildView("purchase_warning_repurchase")->setVisible(FALSE);
- getChildView("purchase_warning_notenough")->setVisible(FALSE);
- getChildView("contacting")->setVisible(FALSE);
-
- if (hasError)
- {
- // display an error from the server
- LLSD args;
- args["TITLE"] = getString("info_cannot_buy");
- args["MESSAGE"] = mManager.errorMessage();
- LLNotificationsUtil::add("CouldNotBuyCurrency", args);
- mManager.clearError();
- closeFloater();
- }
- else
- {
- // display the main Buy L$ interface
- getChildView("normal_background")->setVisible(TRUE);
-
- if (mHasTarget)
- {
- getChildView("info_need_more")->setVisible(TRUE);
- }
- else
- {
- getChildView("info_buying")->setVisible(TRUE);
- }
-
- if (mManager.buying())
- {
- getChildView("contacting")->setVisible( true);
- }
- else
- {
- if (mHasTarget)
- {
- getChild<LLUICtrl>("target_price")->setTextArg("[AMT]", llformat("%d", mTargetPrice));
- getChild<LLUICtrl>("required_amount")->setTextArg("[AMT]", llformat("%d", mRequiredAmount));
- }
- }
-
- S32 balance = gStatusBar->getBalance();
- getChildView("balance_label")->setVisible(TRUE);
- getChildView("balance_amount")->setVisible(TRUE);
- getChild<LLUICtrl>("balance_amount")->setTextArg("[AMT]", llformat("%d", balance));
-
- S32 buying = mManager.getAmount();
- getChildView("buying_label")->setVisible(TRUE);
- getChildView("buying_amount")->setVisible(TRUE);
- getChild<LLUICtrl>("buying_amount")->setTextArg("[AMT]", llformat("%d", buying));
-
- S32 total = balance + buying;
- getChildView("total_label")->setVisible(TRUE);
- getChildView("total_amount")->setVisible(TRUE);
- getChild<LLUICtrl>("total_amount")->setTextArg("[AMT]", llformat("%d", total));
-
- if (mHasTarget)
- {
- getChildView("purchase_warning_repurchase")->setVisible( !getChildView("currency_links")->getVisible());
- }
- }
-
- getChildView("getting_data")->setVisible( !mManager.canBuy() && !hasError && !getChildView("currency_est")->getVisible());
+ bool hasError = mManager.hasError();
+ mManager.updateUI(!hasError && !mManager.buying());
+
+ // hide most widgets - we'll turn them on as needed next
+ getChildView("info_buying")->setVisible(FALSE);
+ getChildView("info_need_more")->setVisible(FALSE);
+ getChildView("purchase_warning_repurchase")->setVisible(FALSE);
+ getChildView("purchase_warning_notenough")->setVisible(FALSE);
+ getChildView("contacting")->setVisible(FALSE);
+
+ if (hasError)
+ {
+ // display an error from the server
+ LLSD args;
+ args["TITLE"] = getString("info_cannot_buy");
+ args["MESSAGE"] = mManager.errorMessage();
+ LLNotificationsUtil::add("CouldNotBuyCurrency", args);
+ mManager.clearError();
+ closeFloater();
+ }
+ else
+ {
+ // display the main Buy L$ interface
+ getChildView("normal_background")->setVisible(TRUE);
+
+ if (mHasTarget)
+ {
+ getChildView("info_need_more")->setVisible(TRUE);
+ }
+ else
+ {
+ getChildView("info_buying")->setVisible(TRUE);
+ }
+
+ if (mManager.buying())
+ {
+ getChildView("contacting")->setVisible( true);
+ }
+ else
+ {
+ if (mHasTarget)
+ {
+ getChild<LLUICtrl>("target_price")->setTextArg("[AMT]", llformat("%d", mTargetPrice));
+ getChild<LLUICtrl>("required_amount")->setTextArg("[AMT]", llformat("%d", mRequiredAmount));
+ }
+ }
+
+ S32 balance = gStatusBar->getBalance();
+ getChildView("balance_label")->setVisible(TRUE);
+ getChildView("balance_amount")->setVisible(TRUE);
+ getChild<LLUICtrl>("balance_amount")->setTextArg("[AMT]", llformat("%d", balance));
+
+ S32 buying = mManager.getAmount();
+ getChildView("buying_label")->setVisible(TRUE);
+ getChildView("buying_amount")->setVisible(TRUE);
+ getChild<LLUICtrl>("buying_amount")->setTextArg("[AMT]", llformat("%d", buying));
+
+ S32 total = balance + buying;
+ getChildView("total_label")->setVisible(TRUE);
+ getChildView("total_amount")->setVisible(TRUE);
+ getChild<LLUICtrl>("total_amount")->setTextArg("[AMT]", llformat("%d", total));
+
+ if (mHasTarget)
+ {
+ getChildView("purchase_warning_repurchase")->setVisible( !getChildView("currency_links")->getVisible());
+ }
+ }
+
+ getChildView("getting_data")->setVisible( !mManager.canBuy() && !hasError && !getChildView("currency_est")->getVisible());
}
void LLFloaterBuyCurrencyUI::collapsePanels(bool collapse)
{
- LLLayoutPanel* price_panel = getChild<LLLayoutPanel>("layout_panel_price");
-
- if (price_panel->isCollapsed() == collapse)
- return;
-
- LLLayoutStack* outer_stack = getChild<LLLayoutStack>("outer_stack");
- LLLayoutPanel* required_panel = getChild<LLLayoutPanel>("layout_panel_required");
- LLLayoutPanel* msg_panel = getChild<LLLayoutPanel>("layout_panel_msg");
-
- S32 delta_height = price_panel->getRect().getHeight() + required_panel->getRect().getHeight() + msg_panel->getRect().getHeight();
- delta_height *= (collapse ? -1 : 1);
-
- LLIconCtrl* icon = getChild<LLIconCtrl>("normal_background");
- LLRect rect = icon->getRect();
- icon->setRect(rect.setOriginAndSize(rect.mLeft, rect.mBottom - delta_height, rect.getWidth(), rect.getHeight() + delta_height));
-
- outer_stack->collapsePanel(price_panel, collapse);
- outer_stack->collapsePanel(required_panel, collapse);
- outer_stack->collapsePanel(msg_panel, collapse);
-
- outer_stack->updateLayout();
-
- LLRect floater_rect = getRect();
- floater_rect.mBottom -= delta_height;
- setShape(floater_rect, false);
+ LLLayoutPanel* price_panel = getChild<LLLayoutPanel>("layout_panel_price");
+
+ if (price_panel->isCollapsed() == collapse)
+ return;
+
+ LLLayoutStack* outer_stack = getChild<LLLayoutStack>("outer_stack");
+ LLLayoutPanel* required_panel = getChild<LLLayoutPanel>("layout_panel_required");
+ LLLayoutPanel* msg_panel = getChild<LLLayoutPanel>("layout_panel_msg");
+
+ S32 delta_height = price_panel->getRect().getHeight() + required_panel->getRect().getHeight() + msg_panel->getRect().getHeight();
+ delta_height *= (collapse ? -1 : 1);
+
+ LLIconCtrl* icon = getChild<LLIconCtrl>("normal_background");
+ LLRect rect = icon->getRect();
+ icon->setRect(rect.setOriginAndSize(rect.mLeft, rect.mBottom - delta_height, rect.getWidth(), rect.getHeight() + delta_height));
+
+ outer_stack->collapsePanel(price_panel, collapse);
+ outer_stack->collapsePanel(required_panel, collapse);
+ outer_stack->collapsePanel(msg_panel, collapse);
+
+ outer_stack->updateLayout();
+
+ LLRect floater_rect = getRect();
+ floater_rect.mBottom -= delta_height;
+ setShape(floater_rect, false);
}
void LLFloaterBuyCurrencyUI::onClickBuy()
{
- mManager.buy(getString("buy_currency"));
- updateUI();
- // Update L$ balance
- LLStatusBar::sendMoneyBalanceRequest();
+ mManager.buy(getString("buy_currency"));
+ updateUI();
+ // Update L$ balance
+ LLStatusBar::sendMoneyBalanceRequest();
}
void LLFloaterBuyCurrencyUI::onClickCancel()
{
- closeFloater();
- // Update L$ balance
- LLStatusBar::sendMoneyBalanceRequest();
+ closeFloater();
+ // Update L$ balance
+ LLStatusBar::sendMoneyBalanceRequest();
}
LLFetchAvatarPaymentInfo* LLFloaterBuyCurrency::sPropertiesRequest = NULL;
@@ -296,67 +296,67 @@ LLFetchAvatarPaymentInfo* LLFloaterBuyCurrency::sPropertiesRequest = NULL;
// static
void LLFloaterBuyCurrency::buyCurrency()
{
- delete sPropertiesRequest;
- sPropertiesRequest = new LLFetchAvatarPaymentInfo(false);
+ delete sPropertiesRequest;
+ sPropertiesRequest = new LLFetchAvatarPaymentInfo(false);
}
// static
void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price)
{
- delete sPropertiesRequest;
- sPropertiesRequest = new LLFetchAvatarPaymentInfo(true, name, price);
+ delete sPropertiesRequest;
+ sPropertiesRequest = new LLFetchAvatarPaymentInfo(true, name, price);
}
// static
void LLFloaterBuyCurrency::handleBuyCurrency(bool has_piof, bool has_target, const std::string name, S32 price)
{
- delete sPropertiesRequest;
- sPropertiesRequest = NULL;
-
- if (has_piof)
- {
- LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency");
- if (has_target)
- {
- ui->target(name, price);
- }
- else
- {
- ui->noTarget();
- }
- ui->updateUI();
- ui->collapsePanels(!has_target);
- }
- else
- {
- LLFloaterReg::showInstance("add_payment_method");
- }
+ delete sPropertiesRequest;
+ sPropertiesRequest = NULL;
+
+ if (has_piof)
+ {
+ LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency");
+ if (has_target)
+ {
+ ui->target(name, price);
+ }
+ else
+ {
+ ui->noTarget();
+ }
+ ui->updateUI();
+ ui->collapsePanels(!has_target);
+ }
+ else
+ {
+ LLFloaterReg::showInstance("add_payment_method");
+ }
}
LLFetchAvatarPaymentInfo::LLFetchAvatarPaymentInfo(bool has_target, const std::string& name, S32 price)
-: mAvatarID(gAgent.getID()),
- mHasTarget(has_target),
- mPrice(price),
- mName(name)
+: mAvatarID(gAgent.getID()),
+ mHasTarget(has_target),
+ mPrice(price),
+ mName(name)
{
- LLAvatarPropertiesProcessor* processor = LLAvatarPropertiesProcessor::getInstance();
- // register ourselves as an observer
- processor->addObserver(mAvatarID, this);
- // send a request (duplicates will be suppressed inside the avatar
- // properties processor)
- processor->sendAvatarPropertiesRequest(mAvatarID);
+ LLAvatarPropertiesProcessor* processor = LLAvatarPropertiesProcessor::getInstance();
+ // register ourselves as an observer
+ processor->addObserver(mAvatarID, this);
+ // send a request (duplicates will be suppressed inside the avatar
+ // properties processor)
+ processor->sendAvatarPropertiesRequest(mAvatarID);
}
LLFetchAvatarPaymentInfo::~LLFetchAvatarPaymentInfo()
{
- LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this);
+ LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this);
}
void LLFetchAvatarPaymentInfo::processProperties(void* data, EAvatarProcessorType type)
{
- if (data && type == APT_PROPERTIES)
- {
- LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
- LLFloaterBuyCurrency::handleBuyCurrency(LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(avatar_data), mHasTarget, mName, mPrice);
- }
+ if (data && type == APT_PROPERTIES)
+ {
+ LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
+ LLFloaterBuyCurrency::handleBuyCurrency(LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(avatar_data), mHasTarget, mName, mPrice);
+ }
}
diff --git a/indra/newview/llfloaterbuycurrency.h b/indra/newview/llfloaterbuycurrency.h
index 88d3d17cd6..1b04c9c6d2 100644
--- a/indra/newview/llfloaterbuycurrency.h
+++ b/indra/newview/llfloaterbuycurrency.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbuycurrency.h
* @brief LLFloaterBuyCurrency class definition
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,15 +35,15 @@ class LLFloater;
class LLFetchAvatarPaymentInfo : public LLAvatarPropertiesObserver
{
public:
- LLFetchAvatarPaymentInfo(bool has_target, const std::string& name = std::string(), S32 price = 0);
- ~LLFetchAvatarPaymentInfo();
+ LLFetchAvatarPaymentInfo(bool has_target, const std::string& name = std::string(), S32 price = 0);
+ ~LLFetchAvatarPaymentInfo();
- void processProperties(void* data, EAvatarProcessorType type);
+ void processProperties(void* data, EAvatarProcessorType type);
private:
- LLUUID mAvatarID;
- bool mHasTarget;
- std::string mName;
+ LLUUID mAvatarID;
+ bool mHasTarget;
+ std::string mName;
S32 mPrice;
};
@@ -51,20 +51,20 @@ private:
class LLFloaterBuyCurrency
{
public:
- static void buyCurrency();
- static void buyCurrency(const std::string& name, S32 price);
+ static void buyCurrency();
+ static void buyCurrency(const std::string& name, S32 price);
+
+ static void handleBuyCurrency(bool has_piof, bool has_target, const std::string name, S32 price);
+ /* name should be a noun phrase of the object or service being bought:
+ "That object costs"
+ "Trying to give"
+ "Uploading costs"
+ a space and the price will be appended
+ */
- static void handleBuyCurrency(bool has_piof, bool has_target, const std::string name, S32 price);
- /* name should be a noun phrase of the object or service being bought:
- "That object costs"
- "Trying to give"
- "Uploading costs"
- a space and the price will be appended
- */
-
- static LLFloater* buildFloater(const LLSD& key);
+ static LLFloater* buildFloater(const LLSD& key);
- static LLFetchAvatarPaymentInfo* sPropertiesRequest;
+ static LLFetchAvatarPaymentInfo* sPropertiesRequest;
};
#endif
diff --git a/indra/newview/llfloaterbuycurrencyhtml.cpp b/indra/newview/llfloaterbuycurrencyhtml.cpp
index a69aa8d227..c138cd5f2e 100644
--- a/indra/newview/llfloaterbuycurrencyhtml.cpp
+++ b/indra/newview/llfloaterbuycurrencyhtml.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbuycurrencyhtml.cpp
* @brief buy currency implemented in HTML floater - uses embedded media browser control
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,10 +33,10 @@
////////////////////////////////////////////////////////////////////////////////
//
LLFloaterBuyCurrencyHTML::LLFloaterBuyCurrencyHTML( const LLSD& key ):
- LLFloater( key ),
- mSpecificSumRequested( false ),
- mMessage( "" ),
- mSum( 0 )
+ LLFloater( key ),
+ mSpecificSumRequested( false ),
+ mMessage( "" ),
+ mSum( 0 )
{
}
@@ -44,80 +44,80 @@ LLFloaterBuyCurrencyHTML::LLFloaterBuyCurrencyHTML( const LLSD& key ):
//
BOOL LLFloaterBuyCurrencyHTML::postBuild()
{
- // observer media events
- mBrowser = getChild<LLMediaCtrl>( "browser" );
- mBrowser->addObserver( this );
+ // observer media events
+ mBrowser = getChild<LLMediaCtrl>( "browser" );
+ mBrowser->addObserver( this );
- return TRUE;
+ return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
void LLFloaterBuyCurrencyHTML::navigateToFinalURL()
{
- // URL for actual currency buy contents is in XUI file
- std::string buy_currency_url = getString( "buy_currency_url" );
+ // URL for actual currency buy contents is in XUI file
+ std::string buy_currency_url = getString( "buy_currency_url" );
- // replace [LANGUAGE] meta-tag with view language
- LLStringUtil::format_map_t replace;
+ // replace [LANGUAGE] meta-tag with view language
+ LLStringUtil::format_map_t replace;
- // viewer language
- replace[ "[LANGUAGE]" ] = LLUI::getLanguage();
+ // viewer language
+ replace[ "[LANGUAGE]" ] = LLUI::getLanguage();
- // flag that specific amount requested
- replace[ "[SPECIFIC_AMOUNT]" ] = ( mSpecificSumRequested ? "y":"n" );
+ // flag that specific amount requested
+ replace[ "[SPECIFIC_AMOUNT]" ] = ( mSpecificSumRequested ? "y":"n" );
- // amount requested
- std::ostringstream codec( "" );
- codec << mSum;
- replace[ "[SUM]" ] = codec.str();
+ // amount requested
+ std::ostringstream codec( "" );
+ codec << mSum;
+ replace[ "[SUM]" ] = codec.str();
- // users' current balance
- codec.clear();
- codec.str( "" );
- codec << gStatusBar->getBalance();
- replace[ "[BAL]" ] = codec.str();
+ // users' current balance
+ codec.clear();
+ codec.str( "" );
+ codec << gStatusBar->getBalance();
+ replace[ "[BAL]" ] = codec.str();
- // message - "This cost L$x,xxx for example
- replace[ "[MSG]" ] = LLURI::escape( mMessage );
- LLStringUtil::format( buy_currency_url, replace );
+ // message - "This cost L$x,xxx for example
+ replace[ "[MSG]" ] = LLURI::escape( mMessage );
+ LLStringUtil::format( buy_currency_url, replace );
- // write final URL to debug console
- LL_INFOS() << "Buy currency HTML parsed URL is " << buy_currency_url << LL_ENDL;
+ // write final URL to debug console
+ LL_INFOS() << "Buy currency HTML parsed URL is " << buy_currency_url << LL_ENDL;
- // kick off the navigation
- mBrowser->navigateTo( buy_currency_url, HTTP_CONTENT_TEXT_HTML );
+ // kick off the navigation
+ mBrowser->navigateTo( buy_currency_url, HTTP_CONTENT_TEXT_HTML );
}
////////////////////////////////////////////////////////////////////////////////
//
void LLFloaterBuyCurrencyHTML::handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event )
{
- // placeholder for now - just in case we want to catch media events
- if ( LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_COMPLETE == event )
- {
- // update currency after we complete a navigation since there are many ways
- // this can result in a different L$ balance
- LLStatusBar::sendMoneyBalanceRequest();
- };
+ // placeholder for now - just in case we want to catch media events
+ if ( LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_COMPLETE == event )
+ {
+ // update currency after we complete a navigation since there are many ways
+ // this can result in a different L$ balance
+ LLStatusBar::sendMoneyBalanceRequest();
+ };
}
////////////////////////////////////////////////////////////////////////////////
//
void LLFloaterBuyCurrencyHTML::onClose( bool app_quitting )
{
- // Update L$ balance one more time
- LLStatusBar::sendMoneyBalanceRequest();
+ // Update L$ balance one more time
+ LLStatusBar::sendMoneyBalanceRequest();
- destroy();
+ destroy();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLFloaterBuyCurrencyHTML::setParams( bool specific_sum_requested, const std::string& message, S32 sum )
{
- // save these away - used to construct URL later
- mSpecificSumRequested = specific_sum_requested;
- mMessage = message;
- mSum = sum;
+ // save these away - used to construct URL later
+ mSpecificSumRequested = specific_sum_requested;
+ mMessage = message;
+ mSum = sum;
}
diff --git a/indra/newview/llfloaterbuycurrencyhtml.h b/indra/newview/llfloaterbuycurrencyhtml.h
index 6b1fc53f1f..23555b261f 100644
--- a/indra/newview/llfloaterbuycurrencyhtml.h
+++ b/indra/newview/llfloaterbuycurrencyhtml.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbuycurrencyhtml.h
* @brief buy currency implemented in HTML floater - uses embedded media browser control
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,30 +30,30 @@
#include "llfloater.h"
#include "llmediactrl.h"
-class LLFloaterBuyCurrencyHTML :
- public LLFloater,
- public LLViewerMediaObserver
+class LLFloaterBuyCurrencyHTML :
+ public LLFloater,
+ public LLViewerMediaObserver
{
- public:
- LLFloaterBuyCurrencyHTML( const LLSD& key );
+ public:
+ LLFloaterBuyCurrencyHTML( const LLSD& key );
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onClose( bool app_quitting );
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onClose( bool app_quitting );
- // inherited from LLViewerMediaObserver
- /*virtual*/ void handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event );
+ // inherited from LLViewerMediaObserver
+ /*virtual*/ void handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event );
- // allow our controlling parent to tell us paramters
- void setParams( bool specific_sum_requested, const std::string& message, S32 sum );
+ // allow our controlling parent to tell us paramters
+ void setParams( bool specific_sum_requested, const std::string& message, S32 sum );
- // parse and construct URL and set browser to navigate there.
- void navigateToFinalURL();
+ // parse and construct URL and set browser to navigate there.
+ void navigateToFinalURL();
- private:
- LLMediaCtrl* mBrowser;
- bool mSpecificSumRequested;
- std::string mMessage;
- S32 mSum;
+ private:
+ LLMediaCtrl* mBrowser;
+ bool mSpecificSumRequested;
+ std::string mMessage;
+ S32 mSum;
};
#endif // LL_LLFLOATERBUYCURRENCYHTML_H
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 464e7ff4a2..ac45e50c08 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbuyland.cpp
* @brief LLFloaterBuyLand class implementation
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,205 +67,205 @@
const F32 GROUP_LAND_BONUS_FACTOR = 1.1f;
class LLFloaterBuyLandUI
-: public LLFloater
+: public LLFloater
{
public:
- LLFloaterBuyLandUI(const LLSD& key);
- virtual ~LLFloaterBuyLandUI();
-
- /*virtual*/ void onClose(bool app_quitting);
+ LLFloaterBuyLandUI(const LLSD& key);
+ virtual ~LLFloaterBuyLandUI();
+
+ /*virtual*/ void onClose(bool app_quitting);
- // Left padding for maturity rating icon.
- static const S32 ICON_PAD = 2;
+ // Left padding for maturity rating icon.
+ static const S32 ICON_PAD = 2;
private:
- class SelectionObserver : public LLParcelObserver
- {
- public:
- SelectionObserver(LLFloaterBuyLandUI* floater) : mFloater(floater) {}
- virtual void changed();
- private:
- LLFloaterBuyLandUI* mFloater;
- };
-
+ class SelectionObserver : public LLParcelObserver
+ {
+ public:
+ SelectionObserver(LLFloaterBuyLandUI* floater) : mFloater(floater) {}
+ virtual void changed();
+ private:
+ LLFloaterBuyLandUI* mFloater;
+ };
+
private:
- SelectionObserver mParcelSelectionObserver;
- LLViewerRegion* mRegion;
- LLParcelSelectionHandle mParcel;
- bool mIsClaim;
- bool mIsForGroup;
-
- bool mCanBuy;
- bool mCannotBuyIsError;
- std::string mCannotBuyReason;
- std::string mCannotBuyURI;
-
- bool mBought;
-
- // information about the agent
- S32 mAgentCommittedTier;
- S32 mAgentCashBalance;
- bool mAgentHasNeverOwnedLand;
-
- // information about the parcel
- bool mParcelValid;
- bool mParcelIsForSale;
- bool mParcelIsGroupLand;
- S32 mParcelGroupContribution;
- S32 mParcelPrice;
- S32 mParcelActualArea;
- S32 mParcelBillableArea;
- S32 mParcelSupportedObjects;
- bool mParcelSoldWithObjects;
- std::string mParcelLocation;
- LLUUID mParcelSnapshot;
- std::string mParcelSellerName;
-
- // user's choices
- S32 mUserPlanChoice;
-
- // from website
- bool mSiteValid;
- bool mSiteMembershipUpgrade;
- std::string mSiteMembershipAction;
- std::vector<std::string>
- mSiteMembershipPlanIDs;
- std::vector<std::string>
- mSiteMembershipPlanNames;
- bool mSiteLandUseUpgrade;
- std::string mSiteLandUseAction;
- std::string mSiteConfirm;
-
- // values in current Preflight transaction... used to avoid extra
- // preflights when the parcel manager goes update crazy
- S32 mPreflightAskBillableArea;
- S32 mPreflightAskCurrencyBuy;
-
- LLViewChildren mChildren;
- LLCurrencyUIManager mCurrency;
-
- enum TransactionType
- {
- TransactionPreflight,
- TransactionCurrency,
- TransactionBuy
- };
- LLXMLRPCTransaction* mTransaction;
- TransactionType mTransactionType;
-
- LLViewerParcelMgr::ParcelBuyInfo* mParcelBuyInfo;
-
+ SelectionObserver mParcelSelectionObserver;
+ LLViewerRegion* mRegion;
+ LLParcelSelectionHandle mParcel;
+ bool mIsClaim;
+ bool mIsForGroup;
+
+ bool mCanBuy;
+ bool mCannotBuyIsError;
+ std::string mCannotBuyReason;
+ std::string mCannotBuyURI;
+
+ bool mBought;
+
+ // information about the agent
+ S32 mAgentCommittedTier;
+ S32 mAgentCashBalance;
+ bool mAgentHasNeverOwnedLand;
+
+ // information about the parcel
+ bool mParcelValid;
+ bool mParcelIsForSale;
+ bool mParcelIsGroupLand;
+ S32 mParcelGroupContribution;
+ S32 mParcelPrice;
+ S32 mParcelActualArea;
+ S32 mParcelBillableArea;
+ S32 mParcelSupportedObjects;
+ bool mParcelSoldWithObjects;
+ std::string mParcelLocation;
+ LLUUID mParcelSnapshot;
+ std::string mParcelSellerName;
+
+ // user's choices
+ S32 mUserPlanChoice;
+
+ // from website
+ bool mSiteValid;
+ bool mSiteMembershipUpgrade;
+ std::string mSiteMembershipAction;
+ std::vector<std::string>
+ mSiteMembershipPlanIDs;
+ std::vector<std::string>
+ mSiteMembershipPlanNames;
+ bool mSiteLandUseUpgrade;
+ std::string mSiteLandUseAction;
+ std::string mSiteConfirm;
+
+ // values in current Preflight transaction... used to avoid extra
+ // preflights when the parcel manager goes update crazy
+ S32 mPreflightAskBillableArea;
+ S32 mPreflightAskCurrencyBuy;
+
+ LLViewChildren mChildren;
+ LLCurrencyUIManager mCurrency;
+
+ enum TransactionType
+ {
+ TransactionPreflight,
+ TransactionCurrency,
+ TransactionBuy
+ };
+ LLXMLRPCTransaction* mTransaction;
+ TransactionType mTransactionType;
+
+ LLViewerParcelMgr::ParcelBuyInfo* mParcelBuyInfo;
+
public:
- void setForGroup(bool is_for_group);
- void setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel);
-
- void updateAgentInfo();
- void updateParcelInfo();
- void updateCovenantInfo();
- static void onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data);
- void updateFloaterCovenantText(const std::string& string, const LLUUID &asset_id);
- void updateFloaterEstateName(const std::string& name);
- void updateFloaterLastModified(const std::string& text);
- void updateFloaterEstateOwnerName(const std::string& name);
- void updateWebSiteInfo();
- void finishWebSiteInfo();
-
- void runWebSitePrep(const std::string& password);
- void finishWebSitePrep();
- void sendBuyLand();
-
- void updateNames();
- // Name cache callback
- void updateGroupName(const LLUUID& id,
- const std::string& name,
- bool is_group);
-
- void refreshUI();
-
- void startTransaction(TransactionType type, const LLXMLRPCValue& params);
- bool checkTransaction();
-
- void tellUserError(const std::string& message, const std::string& uri);
-
- virtual BOOL postBuild();
-
- void startBuyPreConfirm();
- void startBuyPostConfirm(const std::string& password);
-
- void onClickBuy();
- void onClickCancel();
- void onClickErrorWeb();
-
- virtual void draw();
- virtual BOOL canClose();
-
- void onVisibilityChanged ( const LLSD& new_visibility );
-
+ void setForGroup(bool is_for_group);
+ void setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel);
+
+ void updateAgentInfo();
+ void updateParcelInfo();
+ void updateCovenantInfo();
+ static void onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data);
+ void updateFloaterCovenantText(const std::string& string, const LLUUID &asset_id);
+ void updateFloaterEstateName(const std::string& name);
+ void updateFloaterLastModified(const std::string& text);
+ void updateFloaterEstateOwnerName(const std::string& name);
+ void updateWebSiteInfo();
+ void finishWebSiteInfo();
+
+ void runWebSitePrep(const std::string& password);
+ void finishWebSitePrep();
+ void sendBuyLand();
+
+ void updateNames();
+ // Name cache callback
+ void updateGroupName(const LLUUID& id,
+ const std::string& name,
+ bool is_group);
+
+ void refreshUI();
+
+ void startTransaction(TransactionType type, const LLXMLRPCValue& params);
+ bool checkTransaction();
+
+ void tellUserError(const std::string& message, const std::string& uri);
+
+ virtual BOOL postBuild();
+
+ void startBuyPreConfirm();
+ void startBuyPostConfirm(const std::string& password);
+
+ void onClickBuy();
+ void onClickCancel();
+ void onClickErrorWeb();
+
+ virtual void draw();
+ virtual BOOL canClose();
+
+ void onVisibilityChanged ( const LLSD& new_visibility );
+
};
// static
void LLFloaterBuyLand::buyLand(
- LLViewerRegion* region, LLParcelSelectionHandle parcel, bool is_for_group)
+ LLViewerRegion* region, LLParcelSelectionHandle parcel, bool is_for_group)
{
- if(is_for_group && !gAgent.hasPowerInActiveGroup(GP_LAND_DEED))
- {
- LLNotificationsUtil::add("OnlyOfficerCanBuyLand");
- return;
- }
-
- LLFloaterBuyLandUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyLandUI>("buy_land");
- if (ui)
- {
- ui->setForGroup(is_for_group);
- ui->setParcel(region, parcel);
- }
+ if(is_for_group && !gAgent.hasPowerInActiveGroup(GP_LAND_DEED))
+ {
+ LLNotificationsUtil::add("OnlyOfficerCanBuyLand");
+ return;
+ }
+
+ LLFloaterBuyLandUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyLandUI>("buy_land");
+ if (ui)
+ {
+ ui->setForGroup(is_for_group);
+ ui->setParcel(region, parcel);
+ }
}
// static
void LLFloaterBuyLand::updateCovenantText(const std::string& string, const LLUUID &asset_id)
{
- LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
- if (floater)
- {
- floater->updateFloaterCovenantText(string, asset_id);
- }
+ LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
+ if (floater)
+ {
+ floater->updateFloaterCovenantText(string, asset_id);
+ }
}
// static
void LLFloaterBuyLand::updateEstateName(const std::string& name)
{
- LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
- if (floater)
- {
- floater->updateFloaterEstateName(name);
- }
+ LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
+ if (floater)
+ {
+ floater->updateFloaterEstateName(name);
+ }
}
// static
void LLFloaterBuyLand::updateLastModified(const std::string& text)
{
- LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
- if (floater)
- {
- floater->updateFloaterLastModified(text);
- }
+ LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
+ if (floater)
+ {
+ floater->updateFloaterLastModified(text);
+ }
}
// static
void LLFloaterBuyLand::updateEstateOwnerName(const std::string& name)
{
- LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
- if (floater)
- {
- floater->updateFloaterEstateOwnerName(name);
- }
+ LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
+ if (floater)
+ {
+ floater->updateFloaterEstateOwnerName(name);
+ }
}
// static
LLFloater* LLFloaterBuyLand::buildFloater(const LLSD& key)
{
- LLFloaterBuyLandUI* floater = new LLFloaterBuyLandUI(key);
- return floater;
+ LLFloaterBuyLandUI* floater = new LLFloaterBuyLandUI(key);
+ return floater;
}
//----------------------------------------------------------------------------
@@ -278,1101 +278,1101 @@ LLFloater* LLFloaterBuyLand::buildFloater(const LLSD& key)
// already valid, so this call does the correct thing. Disable the
// warning so that we can compile without generating a warning.
#pragma warning(disable : 4355)
-#endif
+#endif
LLFloaterBuyLandUI::LLFloaterBuyLandUI(const LLSD& key)
-: LLFloater(LLSD()),
- mParcelSelectionObserver(this),
- mParcel(0),
- mBought(false),
- mParcelValid(false), mSiteValid(false),
- mChildren(*this), mCurrency(*this), mTransaction(0),
- mParcelBuyInfo(0)
+: LLFloater(LLSD()),
+ mParcelSelectionObserver(this),
+ mParcel(0),
+ mBought(false),
+ mParcelValid(false), mSiteValid(false),
+ mChildren(*this), mCurrency(*this), mTransaction(0),
+ mParcelBuyInfo(0)
{
- LLViewerParcelMgr::getInstance()->addObserver(&mParcelSelectionObserver);
-
+ LLViewerParcelMgr::getInstance()->addObserver(&mParcelSelectionObserver);
+
}
LLFloaterBuyLandUI::~LLFloaterBuyLandUI()
{
- LLViewerParcelMgr::getInstance()->removeObserver(&mParcelSelectionObserver);
- LLViewerParcelMgr::getInstance()->deleteParcelBuy(&mParcelBuyInfo);
-
- delete mTransaction;
+ LLViewerParcelMgr::getInstance()->removeObserver(&mParcelSelectionObserver);
+ LLViewerParcelMgr::getInstance()->deleteParcelBuy(&mParcelBuyInfo);
+
+ delete mTransaction;
}
// virtual
void LLFloaterBuyLandUI::onClose(bool app_quitting)
{
- // This object holds onto observer, transactions, and parcel state.
- // Despite being single_instance, destroy it to call destructors and clean
- // everything up.
- setVisible(FALSE);
- destroy();
+ // This object holds onto observer, transactions, and parcel state.
+ // Despite being single_instance, destroy it to call destructors and clean
+ // everything up.
+ setVisible(FALSE);
+ destroy();
}
void LLFloaterBuyLandUI::SelectionObserver::changed()
{
- if (LLViewerParcelMgr::getInstance()->selectionEmpty())
- {
- mFloater->closeFloater();
- }
- else
- {
- mFloater->setParcel(LLViewerParcelMgr::getInstance()->getSelectionRegion(),
- LLViewerParcelMgr::getInstance()->getParcelSelection());
- }
+ if (LLViewerParcelMgr::getInstance()->selectionEmpty())
+ {
+ mFloater->closeFloater();
+ }
+ else
+ {
+ mFloater->setParcel(LLViewerParcelMgr::getInstance()->getSelectionRegion(),
+ LLViewerParcelMgr::getInstance()->getParcelSelection());
+ }
}
void LLFloaterBuyLandUI::updateAgentInfo()
{
- mAgentCommittedTier = gStatusBar->getSquareMetersCommitted();
- mAgentCashBalance = gStatusBar->getBalance();
+ mAgentCommittedTier = gStatusBar->getSquareMetersCommitted();
+ mAgentCashBalance = gStatusBar->getBalance();
- // *TODO: This is an approximation, we should send this value down
- // to the viewer. See SL-10728 for details.
- mAgentHasNeverOwnedLand = mAgentCommittedTier == 0;
+ // *TODO: This is an approximation, we should send this value down
+ // to the viewer. See SL-10728 for details.
+ mAgentHasNeverOwnedLand = mAgentCommittedTier == 0;
}
void LLFloaterBuyLandUI::updateParcelInfo()
{
- LLParcel* parcel = mParcel->getParcel();
- mParcelValid = parcel && mRegion;
- mParcelIsForSale = false;
- mParcelIsGroupLand = false;
- mParcelGroupContribution = 0;
- mParcelPrice = 0;
- mParcelActualArea = 0;
- mParcelBillableArea = 0;
- mParcelSupportedObjects = 0;
- mParcelSoldWithObjects = false;
- mParcelLocation = "";
- mParcelSnapshot.setNull();
- mParcelSellerName = "";
-
- mCanBuy = false;
- mCannotBuyIsError = false;
-
- if (!mParcelValid)
- {
- mCannotBuyReason = getString("no_land_selected");
- return;
- }
-
- if (mParcel->getMultipleOwners())
- {
- mCannotBuyReason = getString("multiple_parcels_selected");
- return;
- }
-
- const LLUUID& parcelOwner = parcel->getOwnerID();
-
- mIsClaim = parcel->isPublic();
- if (!mIsClaim)
- {
- mParcelActualArea = parcel->getArea();
- mParcelIsForSale = parcel->getForSale();
- mParcelIsGroupLand = parcel->getIsGroupOwned();
- mParcelPrice = mParcelIsForSale ? parcel->getSalePrice() : 0;
-
- if (mParcelIsGroupLand)
- {
- LLUUID group_id = parcel->getGroupID();
- mParcelGroupContribution = gAgent.getGroupContribution(group_id);
- }
- }
- else
- {
- mParcelActualArea = mParcel->getClaimableArea();
- mParcelIsForSale = true;
- mParcelPrice = mParcelActualArea * parcel->getClaimPricePerMeter();
- }
-
- mParcelBillableArea =
- ll_round(mRegion->getBillableFactor() * mParcelActualArea);
-
- mParcelSupportedObjects = ll_round(
- parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus());
- // Can't have more than region max tasks, regardless of parcel
- // object bonus factor.
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if(region)
- {
- S32 max_tasks_per_region = (S32)region->getMaxTasks();
- mParcelSupportedObjects = llmin(
- mParcelSupportedObjects, max_tasks_per_region);
- }
-
- mParcelSoldWithObjects = parcel->getSellWithObjects();
-
-
- LLVector3 center = parcel->getCenterpoint();
- mParcelLocation = llformat("%s %d,%d",
- mRegion->getName().c_str(),
- (int)center[VX], (int)center[VY]
- );
-
- mParcelSnapshot = parcel->getSnapshotID();
-
- updateNames();
-
- bool haveEnoughCash = mParcelPrice <= mAgentCashBalance;
- S32 cashBuy = haveEnoughCash ? 0 : (mParcelPrice - mAgentCashBalance);
- mCurrency.setAmount(cashBuy, true);
- mCurrency.setZeroMessage(haveEnoughCash ? getString("none_needed") : LLStringUtil::null);
-
- // checks that we can buy the land
-
- if(mIsForGroup && !gAgent.hasPowerInActiveGroup(GP_LAND_DEED))
- {
- mCannotBuyReason = getString("cant_buy_for_group");
- return;
- }
-
- if (!mIsClaim)
- {
- const LLUUID& authorizedBuyer = parcel->getAuthorizedBuyerID();
- const LLUUID buyer = gAgent.getID();
- const LLUUID newOwner = mIsForGroup ? gAgent.getGroupID() : buyer;
-
- if (!mParcelIsForSale
- || (mParcelPrice == 0 && authorizedBuyer.isNull()))
- {
-
- mCannotBuyReason = getString("parcel_not_for_sale");
- return;
- }
-
- if (parcelOwner == newOwner)
- {
- if (mIsForGroup)
- {
- mCannotBuyReason = getString("group_already_owns");
- }
- else
- {
- mCannotBuyReason = getString("you_already_own");
- }
- return;
- }
-
- if (!authorizedBuyer.isNull() && buyer != authorizedBuyer)
- {
- // Maybe the parcel is set for sale to a group we are in.
- bool authorized_group =
- gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_DEED)
- && gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_SET_SALE_INFO);
-
- if (!authorized_group)
- {
- mCannotBuyReason = getString("set_to_sell_to_other");
- return;
- }
- }
- }
- else
- {
- if (mParcelActualArea == 0)
- {
- mCannotBuyReason = getString("no_public_land");
- return;
- }
-
- if (mParcel->hasOthersSelected())
- {
- // Policy: Must not have someone else's land selected
- mCannotBuyReason = getString("not_owned_by_you");
- return;
- }
- }
-
- mCanBuy = true;
+ LLParcel* parcel = mParcel->getParcel();
+ mParcelValid = parcel && mRegion;
+ mParcelIsForSale = false;
+ mParcelIsGroupLand = false;
+ mParcelGroupContribution = 0;
+ mParcelPrice = 0;
+ mParcelActualArea = 0;
+ mParcelBillableArea = 0;
+ mParcelSupportedObjects = 0;
+ mParcelSoldWithObjects = false;
+ mParcelLocation = "";
+ mParcelSnapshot.setNull();
+ mParcelSellerName = "";
+
+ mCanBuy = false;
+ mCannotBuyIsError = false;
+
+ if (!mParcelValid)
+ {
+ mCannotBuyReason = getString("no_land_selected");
+ return;
+ }
+
+ if (mParcel->getMultipleOwners())
+ {
+ mCannotBuyReason = getString("multiple_parcels_selected");
+ return;
+ }
+
+ const LLUUID& parcelOwner = parcel->getOwnerID();
+
+ mIsClaim = parcel->isPublic();
+ if (!mIsClaim)
+ {
+ mParcelActualArea = parcel->getArea();
+ mParcelIsForSale = parcel->getForSale();
+ mParcelIsGroupLand = parcel->getIsGroupOwned();
+ mParcelPrice = mParcelIsForSale ? parcel->getSalePrice() : 0;
+
+ if (mParcelIsGroupLand)
+ {
+ LLUUID group_id = parcel->getGroupID();
+ mParcelGroupContribution = gAgent.getGroupContribution(group_id);
+ }
+ }
+ else
+ {
+ mParcelActualArea = mParcel->getClaimableArea();
+ mParcelIsForSale = true;
+ mParcelPrice = mParcelActualArea * parcel->getClaimPricePerMeter();
+ }
+
+ mParcelBillableArea =
+ ll_round(mRegion->getBillableFactor() * mParcelActualArea);
+
+ mParcelSupportedObjects = ll_round(
+ parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus());
+ // Can't have more than region max tasks, regardless of parcel
+ // object bonus factor.
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if(region)
+ {
+ S32 max_tasks_per_region = (S32)region->getMaxTasks();
+ mParcelSupportedObjects = llmin(
+ mParcelSupportedObjects, max_tasks_per_region);
+ }
+
+ mParcelSoldWithObjects = parcel->getSellWithObjects();
+
+
+ LLVector3 center = parcel->getCenterpoint();
+ mParcelLocation = llformat("%s %d,%d",
+ mRegion->getName().c_str(),
+ (int)center[VX], (int)center[VY]
+ );
+
+ mParcelSnapshot = parcel->getSnapshotID();
+
+ updateNames();
+
+ bool haveEnoughCash = mParcelPrice <= mAgentCashBalance;
+ S32 cashBuy = haveEnoughCash ? 0 : (mParcelPrice - mAgentCashBalance);
+ mCurrency.setAmount(cashBuy, true);
+ mCurrency.setZeroMessage(haveEnoughCash ? getString("none_needed") : LLStringUtil::null);
+
+ // checks that we can buy the land
+
+ if(mIsForGroup && !gAgent.hasPowerInActiveGroup(GP_LAND_DEED))
+ {
+ mCannotBuyReason = getString("cant_buy_for_group");
+ return;
+ }
+
+ if (!mIsClaim)
+ {
+ const LLUUID& authorizedBuyer = parcel->getAuthorizedBuyerID();
+ const LLUUID buyer = gAgent.getID();
+ const LLUUID newOwner = mIsForGroup ? gAgent.getGroupID() : buyer;
+
+ if (!mParcelIsForSale
+ || (mParcelPrice == 0 && authorizedBuyer.isNull()))
+ {
+
+ mCannotBuyReason = getString("parcel_not_for_sale");
+ return;
+ }
+
+ if (parcelOwner == newOwner)
+ {
+ if (mIsForGroup)
+ {
+ mCannotBuyReason = getString("group_already_owns");
+ }
+ else
+ {
+ mCannotBuyReason = getString("you_already_own");
+ }
+ return;
+ }
+
+ if (!authorizedBuyer.isNull() && buyer != authorizedBuyer)
+ {
+ // Maybe the parcel is set for sale to a group we are in.
+ bool authorized_group =
+ gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_DEED)
+ && gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_SET_SALE_INFO);
+
+ if (!authorized_group)
+ {
+ mCannotBuyReason = getString("set_to_sell_to_other");
+ return;
+ }
+ }
+ }
+ else
+ {
+ if (mParcelActualArea == 0)
+ {
+ mCannotBuyReason = getString("no_public_land");
+ return;
+ }
+
+ if (mParcel->hasOthersSelected())
+ {
+ // Policy: Must not have someone else's land selected
+ mCannotBuyReason = getString("not_owned_by_you");
+ return;
+ }
+ }
+
+ mCanBuy = true;
}
void LLFloaterBuyLandUI::updateCovenantInfo()
{
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if(!region) return;
-
- U8 sim_access = region->getSimAccess();
- std::string rating = LLViewerRegion::accessToString(sim_access);
-
- LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
- if (region_name)
- {
- std::string region_name_txt = region->getName() + " ("+rating +")";
- region_name->setText(region_name_txt);
-
- LLIconCtrl* rating_icon = getChild<LLIconCtrl>("rating_icon");
- LLRect rect = rating_icon->getRect();
- S32 region_name_width = llmin(region_name->getRect().getWidth(), region_name->getTextBoundingRect().getWidth());
- S32 icon_left_pad = region_name->getRect().mLeft + region_name_width + ICON_PAD;
- region_name->setToolTip(region_name->getText());
- rating_icon->setRect(rect.setOriginAndSize(icon_left_pad, rect.mBottom, rect.getWidth(), rect.getHeight()));
-
- switch(sim_access)
- {
- case SIM_ACCESS_PG:
- rating_icon->setValue(getString("icon_PG"));
- break;
-
- case SIM_ACCESS_ADULT:
- rating_icon->setValue(getString("icon_R"));
- break;
-
- default:
- rating_icon->setValue(getString("icon_M"));
- }
- }
-
- LLTextBox* region_type = getChild<LLTextBox>("region_type_text");
- if (region_type)
- {
- region_type->setText(region->getLocalizedSimProductName());
- region_type->setToolTip(region->getLocalizedSimProductName());
- }
-
- LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
- if (resellable_clause)
- {
- if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
- {
- resellable_clause->setText(getString("can_not_resell"));
- }
- else
- {
- resellable_clause->setText(getString("can_resell"));
- }
- }
-
- LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
- if (changeable_clause)
- {
- if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
- {
- changeable_clause->setText(getString("can_change"));
- }
- else
- {
- changeable_clause->setText(getString("can_not_change"));
- }
- }
-
- LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
- if(check)
- {
- check->set(false);
- check->setEnabled(true);
- check->setCommitCallback(onChangeAgreeCovenant, this);
- }
-
- LLTextBox* box = getChild<LLTextBox>("covenant_text");
- if(box)
- {
- box->setVisible(FALSE);
- }
-
- // send EstateCovenantInfo message
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessage("EstateCovenantRequest");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->sendReliable(region->getHost());
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if(!region) return;
+
+ U8 sim_access = region->getSimAccess();
+ std::string rating = LLViewerRegion::accessToString(sim_access);
+
+ LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
+ if (region_name)
+ {
+ std::string region_name_txt = region->getName() + " ("+rating +")";
+ region_name->setText(region_name_txt);
+
+ LLIconCtrl* rating_icon = getChild<LLIconCtrl>("rating_icon");
+ LLRect rect = rating_icon->getRect();
+ S32 region_name_width = llmin(region_name->getRect().getWidth(), region_name->getTextBoundingRect().getWidth());
+ S32 icon_left_pad = region_name->getRect().mLeft + region_name_width + ICON_PAD;
+ region_name->setToolTip(region_name->getText());
+ rating_icon->setRect(rect.setOriginAndSize(icon_left_pad, rect.mBottom, rect.getWidth(), rect.getHeight()));
+
+ switch(sim_access)
+ {
+ case SIM_ACCESS_PG:
+ rating_icon->setValue(getString("icon_PG"));
+ break;
+
+ case SIM_ACCESS_ADULT:
+ rating_icon->setValue(getString("icon_R"));
+ break;
+
+ default:
+ rating_icon->setValue(getString("icon_M"));
+ }
+ }
+
+ LLTextBox* region_type = getChild<LLTextBox>("region_type_text");
+ if (region_type)
+ {
+ region_type->setText(region->getLocalizedSimProductName());
+ region_type->setToolTip(region->getLocalizedSimProductName());
+ }
+
+ LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
+ if (resellable_clause)
+ {
+ if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
+ {
+ resellable_clause->setText(getString("can_not_resell"));
+ }
+ else
+ {
+ resellable_clause->setText(getString("can_resell"));
+ }
+ }
+
+ LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
+ if (changeable_clause)
+ {
+ if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
+ {
+ changeable_clause->setText(getString("can_change"));
+ }
+ else
+ {
+ changeable_clause->setText(getString("can_not_change"));
+ }
+ }
+
+ LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
+ if(check)
+ {
+ check->set(false);
+ check->setEnabled(true);
+ check->setCommitCallback(onChangeAgreeCovenant, this);
+ }
+
+ LLTextBox* box = getChild<LLTextBox>("covenant_text");
+ if(box)
+ {
+ box->setVisible(FALSE);
+ }
+
+ // send EstateCovenantInfo message
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessage("EstateCovenantRequest");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->sendReliable(region->getHost());
}
// static
void LLFloaterBuyLandUI::onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data)
{
- LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)user_data;
- if(self)
- {
- self->refreshUI();
- }
+ LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)user_data;
+ if(self)
+ {
+ self->refreshUI();
+ }
}
void LLFloaterBuyLandUI::updateFloaterCovenantText(const std::string &string, const LLUUID& asset_id)
{
- LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor");
- editor->setText(string);
-
- LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
- LLTextBox* box = getChild<LLTextBox>("covenant_text");
- if (asset_id.isNull())
- {
- check->set(true);
- check->setEnabled(false);
- refreshUI();
-
- // remove the line stating that you must agree
- box->setVisible(FALSE);
- }
- else
- {
- check->setEnabled(true);
-
- // remove the line stating that you must agree
- box->setVisible(TRUE);
- }
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor");
+ editor->setText(string);
+
+ LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
+ LLTextBox* box = getChild<LLTextBox>("covenant_text");
+ if (asset_id.isNull())
+ {
+ check->set(true);
+ check->setEnabled(false);
+ refreshUI();
+
+ // remove the line stating that you must agree
+ box->setVisible(FALSE);
+ }
+ else
+ {
+ check->setEnabled(true);
+
+ // remove the line stating that you must agree
+ box->setVisible(TRUE);
+ }
}
void LLFloaterBuyLandUI::updateFloaterEstateName(const std::string& name)
{
- LLTextBox* box = getChild<LLTextBox>("estate_name_text");
- box->setText(name);
- box->setToolTip(name);
+ LLTextBox* box = getChild<LLTextBox>("estate_name_text");
+ box->setText(name);
+ box->setToolTip(name);
}
void LLFloaterBuyLandUI::updateFloaterLastModified(const std::string& text)
{
- LLTextBox* editor = getChild<LLTextBox>("covenant_timestamp_text");
- if (editor) editor->setText(text);
+ LLTextBox* editor = getChild<LLTextBox>("covenant_timestamp_text");
+ if (editor) editor->setText(text);
}
void LLFloaterBuyLandUI::updateFloaterEstateOwnerName(const std::string& name)
{
- LLTextBox* box = getChild<LLTextBox>("estate_owner_text");
- if (box) box->setText(name);
+ LLTextBox* box = getChild<LLTextBox>("estate_owner_text");
+ if (box) box->setText(name);
}
void LLFloaterBuyLandUI::updateWebSiteInfo()
{
- S32 askBillableArea = mIsForGroup ? 0 : mParcelBillableArea;
- S32 askCurrencyBuy = mCurrency.getAmount();
-
- if (mTransaction && mTransactionType == TransactionPreflight
- && mPreflightAskBillableArea == askBillableArea
- && mPreflightAskCurrencyBuy == askCurrencyBuy)
- {
- return;
- }
-
- mPreflightAskBillableArea = askBillableArea;
- mPreflightAskCurrencyBuy = askCurrencyBuy;
-
+ S32 askBillableArea = mIsForGroup ? 0 : mParcelBillableArea;
+ S32 askCurrencyBuy = mCurrency.getAmount();
+
+ if (mTransaction && mTransactionType == TransactionPreflight
+ && mPreflightAskBillableArea == askBillableArea
+ && mPreflightAskCurrencyBuy == askCurrencyBuy)
+ {
+ return;
+ }
+
+ mPreflightAskBillableArea = askBillableArea;
+ mPreflightAskCurrencyBuy = askCurrencyBuy;
+
#if 0
- // enable this code if you want the details to blank while we're talking
- // to the web site... it's kind of jarring
- mSiteValid = false;
- mSiteMembershipUpgrade = false;
- mSiteMembershipAction = "(waiting)";
- mSiteMembershipPlanIDs.clear();
- mSiteMembershipPlanNames.clear();
- mSiteLandUseUpgrade = false;
- mSiteLandUseAction = "(waiting)";
- mSiteCurrencyEstimated = false;
- mSiteCurrencyEstimatedCost = 0;
+ // enable this code if you want the details to blank while we're talking
+ // to the web site... it's kind of jarring
+ mSiteValid = false;
+ mSiteMembershipUpgrade = false;
+ mSiteMembershipAction = "(waiting)";
+ mSiteMembershipPlanIDs.clear();
+ mSiteMembershipPlanNames.clear();
+ mSiteLandUseUpgrade = false;
+ mSiteLandUseAction = "(waiting)";
+ mSiteCurrencyEstimated = false;
+ mSiteCurrencyEstimatedCost = 0;
#endif
-
- LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct();
- keywordArgs.appendString("agentId", gAgent.getID().asString());
- keywordArgs.appendString(
- "secureSessionId",
- gAgent.getSecureSessionID().asString());
- keywordArgs.appendString("language", LLUI::getLanguage());
- keywordArgs.appendInt("billableArea", mPreflightAskBillableArea);
- keywordArgs.appendInt("currencyBuy", mPreflightAskCurrencyBuy);
-
- LLXMLRPCValue params = LLXMLRPCValue::createArray();
- params.append(keywordArgs);
-
- startTransaction(TransactionPreflight, params);
+
+ LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct();
+ keywordArgs.appendString("agentId", gAgent.getID().asString());
+ keywordArgs.appendString(
+ "secureSessionId",
+ gAgent.getSecureSessionID().asString());
+ keywordArgs.appendString("language", LLUI::getLanguage());
+ keywordArgs.appendInt("billableArea", mPreflightAskBillableArea);
+ keywordArgs.appendInt("currencyBuy", mPreflightAskCurrencyBuy);
+
+ LLXMLRPCValue params = LLXMLRPCValue::createArray();
+ params.append(keywordArgs);
+
+ startTransaction(TransactionPreflight, params);
}
void LLFloaterBuyLandUI::finishWebSiteInfo()
{
-
- LLXMLRPCValue result = mTransaction->responseValue();
-
- mSiteValid = result["success"].asBool();
- if (!mSiteValid)
- {
- tellUserError(
- result["errorMessage"].asString(),
- result["errorURI"].asString()
- );
- return;
- }
-
- LLXMLRPCValue membership = result["membership"];
- mSiteMembershipUpgrade = membership["upgrade"].asBool();
- mSiteMembershipAction = membership["action"].asString();
- mSiteMembershipPlanIDs.clear();
- mSiteMembershipPlanNames.clear();
- LLXMLRPCValue levels = membership["levels"];
- for (LLXMLRPCValue level = levels.rewind();
- level.isValid();
- level = levels.next())
- {
- mSiteMembershipPlanIDs.push_back(level["id"].asString());
- mSiteMembershipPlanNames.push_back(level["description"].asString());
- }
- mUserPlanChoice = 0;
-
- LLXMLRPCValue landUse = result["landUse"];
- mSiteLandUseUpgrade = landUse["upgrade"].asBool();
- mSiteLandUseAction = landUse["action"].asString();
-
- LLXMLRPCValue currency = result["currency"];
- if (currency["estimatedCost"].isValid())
- {
- mCurrency.setUSDEstimate(currency["estimatedCost"].asInt());
- }
- if (currency["estimatedLocalCost"].isValid())
- {
- mCurrency.setLocalEstimate(currency["estimatedLocalCost"].asString());
- }
-
- mSiteConfirm = result["confirm"].asString();
+
+ LLXMLRPCValue result = mTransaction->responseValue();
+
+ mSiteValid = result["success"].asBool();
+ if (!mSiteValid)
+ {
+ tellUserError(
+ result["errorMessage"].asString(),
+ result["errorURI"].asString()
+ );
+ return;
+ }
+
+ LLXMLRPCValue membership = result["membership"];
+ mSiteMembershipUpgrade = membership["upgrade"].asBool();
+ mSiteMembershipAction = membership["action"].asString();
+ mSiteMembershipPlanIDs.clear();
+ mSiteMembershipPlanNames.clear();
+ LLXMLRPCValue levels = membership["levels"];
+ for (LLXMLRPCValue level = levels.rewind();
+ level.isValid();
+ level = levels.next())
+ {
+ mSiteMembershipPlanIDs.push_back(level["id"].asString());
+ mSiteMembershipPlanNames.push_back(level["description"].asString());
+ }
+ mUserPlanChoice = 0;
+
+ LLXMLRPCValue landUse = result["landUse"];
+ mSiteLandUseUpgrade = landUse["upgrade"].asBool();
+ mSiteLandUseAction = landUse["action"].asString();
+
+ LLXMLRPCValue currency = result["currency"];
+ if (currency["estimatedCost"].isValid())
+ {
+ mCurrency.setUSDEstimate(currency["estimatedCost"].asInt());
+ }
+ if (currency["estimatedLocalCost"].isValid())
+ {
+ mCurrency.setLocalEstimate(currency["estimatedLocalCost"].asString());
+ }
+
+ mSiteConfirm = result["confirm"].asString();
}
void LLFloaterBuyLandUI::runWebSitePrep(const std::string& password)
{
- if (!mCanBuy)
- {
- return;
- }
-
- BOOL remove_contribution = getChild<LLUICtrl>("remove_contribution")->getValue().asBoolean();
- mParcelBuyInfo = LLViewerParcelMgr::getInstance()->setupParcelBuy(gAgent.getID(), gAgent.getSessionID(),
- gAgent.getGroupID(), mIsForGroup, mIsClaim, remove_contribution);
-
- if (mParcelBuyInfo
- && !mSiteMembershipUpgrade
- && !mSiteLandUseUpgrade
- && mCurrency.getAmount() == 0
- && mSiteConfirm != "password")
- {
- sendBuyLand();
- return;
- }
-
-
- std::string newLevel = "noChange";
-
- if (mSiteMembershipUpgrade)
- {
- LLComboBox* levels = getChild<LLComboBox>( "account_level");
- if (levels)
- {
- mUserPlanChoice = levels->getCurrentIndex();
- newLevel = mSiteMembershipPlanIDs[mUserPlanChoice];
- }
- }
-
- LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct();
- keywordArgs.appendString("agentId", gAgent.getID().asString());
- keywordArgs.appendString(
- "secureSessionId",
- gAgent.getSecureSessionID().asString());
- keywordArgs.appendString("language", LLUI::getLanguage());
- keywordArgs.appendString("levelId", newLevel);
- keywordArgs.appendInt("billableArea",
- mIsForGroup ? 0 : mParcelBillableArea);
- keywordArgs.appendInt("currencyBuy", mCurrency.getAmount());
- keywordArgs.appendInt("estimatedCost", mCurrency.getUSDEstimate());
- keywordArgs.appendString("estimatedLocalCost", mCurrency.getLocalEstimate());
- keywordArgs.appendString("confirm", mSiteConfirm);
- if (!password.empty())
- {
- keywordArgs.appendString("password", password);
- }
-
- LLXMLRPCValue params = LLXMLRPCValue::createArray();
- params.append(keywordArgs);
-
- startTransaction(TransactionBuy, params);
+ if (!mCanBuy)
+ {
+ return;
+ }
+
+ BOOL remove_contribution = getChild<LLUICtrl>("remove_contribution")->getValue().asBoolean();
+ mParcelBuyInfo = LLViewerParcelMgr::getInstance()->setupParcelBuy(gAgent.getID(), gAgent.getSessionID(),
+ gAgent.getGroupID(), mIsForGroup, mIsClaim, remove_contribution);
+
+ if (mParcelBuyInfo
+ && !mSiteMembershipUpgrade
+ && !mSiteLandUseUpgrade
+ && mCurrency.getAmount() == 0
+ && mSiteConfirm != "password")
+ {
+ sendBuyLand();
+ return;
+ }
+
+
+ std::string newLevel = "noChange";
+
+ if (mSiteMembershipUpgrade)
+ {
+ LLComboBox* levels = getChild<LLComboBox>( "account_level");
+ if (levels)
+ {
+ mUserPlanChoice = levels->getCurrentIndex();
+ newLevel = mSiteMembershipPlanIDs[mUserPlanChoice];
+ }
+ }
+
+ LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct();
+ keywordArgs.appendString("agentId", gAgent.getID().asString());
+ keywordArgs.appendString(
+ "secureSessionId",
+ gAgent.getSecureSessionID().asString());
+ keywordArgs.appendString("language", LLUI::getLanguage());
+ keywordArgs.appendString("levelId", newLevel);
+ keywordArgs.appendInt("billableArea",
+ mIsForGroup ? 0 : mParcelBillableArea);
+ keywordArgs.appendInt("currencyBuy", mCurrency.getAmount());
+ keywordArgs.appendInt("estimatedCost", mCurrency.getUSDEstimate());
+ keywordArgs.appendString("estimatedLocalCost", mCurrency.getLocalEstimate());
+ keywordArgs.appendString("confirm", mSiteConfirm);
+ if (!password.empty())
+ {
+ keywordArgs.appendString("password", password);
+ }
+
+ LLXMLRPCValue params = LLXMLRPCValue::createArray();
+ params.append(keywordArgs);
+
+ startTransaction(TransactionBuy, params);
}
void LLFloaterBuyLandUI::finishWebSitePrep()
{
- LLXMLRPCValue result = mTransaction->responseValue();
-
- bool success = result["success"].asBool();
- if (!success)
- {
- tellUserError(
- result["errorMessage"].asString(),
- result["errorURI"].asString()
- );
- return;
- }
-
- sendBuyLand();
+ LLXMLRPCValue result = mTransaction->responseValue();
+
+ bool success = result["success"].asBool();
+ if (!success)
+ {
+ tellUserError(
+ result["errorMessage"].asString(),
+ result["errorURI"].asString()
+ );
+ return;
+ }
+
+ sendBuyLand();
}
void LLFloaterBuyLandUI::sendBuyLand()
{
- if (mParcelBuyInfo)
- {
- LLViewerParcelMgr::getInstance()->sendParcelBuy(mParcelBuyInfo);
- LLViewerParcelMgr::getInstance()->deleteParcelBuy(&mParcelBuyInfo);
- mBought = true;
- }
+ if (mParcelBuyInfo)
+ {
+ LLViewerParcelMgr::getInstance()->sendParcelBuy(mParcelBuyInfo);
+ LLViewerParcelMgr::getInstance()->deleteParcelBuy(&mParcelBuyInfo);
+ mBought = true;
+ }
}
void LLFloaterBuyLandUI::updateNames()
{
- LLParcel* parcelp = mParcel->getParcel();
-
- if (!parcelp)
- {
- mParcelSellerName = LLStringUtil::null;
- return;
- }
-
- if (mIsClaim)
- {
- mParcelSellerName = "Linden Lab";
- }
- else if (parcelp->getIsGroupOwned())
- {
- gCacheName->getGroup(parcelp->getGroupID(),
- boost::bind(&LLFloaterBuyLandUI::updateGroupName, this,
- _1, _2, _3));
- }
- else
- {
- mParcelSellerName = LLSLURL("agent", parcelp->getOwnerID(), "completename").getSLURLString();
- }
+ LLParcel* parcelp = mParcel->getParcel();
+
+ if (!parcelp)
+ {
+ mParcelSellerName = LLStringUtil::null;
+ return;
+ }
+
+ if (mIsClaim)
+ {
+ mParcelSellerName = "Linden Lab";
+ }
+ else if (parcelp->getIsGroupOwned())
+ {
+ gCacheName->getGroup(parcelp->getGroupID(),
+ boost::bind(&LLFloaterBuyLandUI::updateGroupName, this,
+ _1, _2, _3));
+ }
+ else
+ {
+ mParcelSellerName = LLSLURL("agent", parcelp->getOwnerID(), "completename").getSLURLString();
+ }
}
void LLFloaterBuyLandUI::updateGroupName(const LLUUID& id,
- const std::string& name,
- bool is_group)
+ const std::string& name,
+ bool is_group)
{
- LLParcel* parcelp = mParcel->getParcel();
- if (parcelp
- && parcelp->getGroupID() == id)
- {
- // request is current
- mParcelSellerName = name;
- }
+ LLParcel* parcelp = mParcel->getParcel();
+ if (parcelp
+ && parcelp->getGroupID() == id)
+ {
+ // request is current
+ mParcelSellerName = name;
+ }
}
void LLFloaterBuyLandUI::startTransaction(TransactionType type, const LLXMLRPCValue& params)
{
- delete mTransaction;
- mTransaction = NULL;
-
- mTransactionType = type;
-
- // Select a URI and method appropriate for the transaction type.
- static std::string transaction_uri;
- if (transaction_uri.empty())
- {
- transaction_uri = LLGridManager::getInstance()->getHelperURI() + "landtool.php";
- }
-
- const char* method;
- switch (mTransactionType)
- {
- case TransactionPreflight:
- method = "preflightBuyLandPrep";
- break;
- case TransactionBuy:
- method = "buyLandPrep";
- break;
- default:
- LL_WARNS() << "LLFloaterBuyLandUI: Unknown transaction type!" << LL_ENDL;
- return;
- }
-
- mTransaction = new LLXMLRPCTransaction(
- transaction_uri,
- method,
- params,
- false /* don't use gzip */
- );
+ delete mTransaction;
+ mTransaction = NULL;
+
+ mTransactionType = type;
+
+ // Select a URI and method appropriate for the transaction type.
+ static std::string transaction_uri;
+ if (transaction_uri.empty())
+ {
+ transaction_uri = LLGridManager::getInstance()->getHelperURI() + "landtool.php";
+ }
+
+ const char* method;
+ switch (mTransactionType)
+ {
+ case TransactionPreflight:
+ method = "preflightBuyLandPrep";
+ break;
+ case TransactionBuy:
+ method = "buyLandPrep";
+ break;
+ default:
+ LL_WARNS() << "LLFloaterBuyLandUI: Unknown transaction type!" << LL_ENDL;
+ return;
+ }
+
+ mTransaction = new LLXMLRPCTransaction(
+ transaction_uri,
+ method,
+ params,
+ false /* don't use gzip */
+ );
}
bool LLFloaterBuyLandUI::checkTransaction()
{
- if (!mTransaction)
- {
- return false;
- }
-
- if (!mTransaction->process())
- {
- return false;
- }
-
- if (mTransaction->status(NULL) != LLXMLRPCTransaction::StatusComplete)
- {
- tellUserError(mTransaction->statusMessage(), mTransaction->statusURI());
- }
- else {
- switch (mTransactionType)
- {
- case TransactionPreflight: finishWebSiteInfo(); break;
- case TransactionBuy: finishWebSitePrep(); break;
- default: ;
- }
- }
-
- delete mTransaction;
- mTransaction = NULL;
-
- return true;
+ if (!mTransaction)
+ {
+ return false;
+ }
+
+ if (!mTransaction->process())
+ {
+ return false;
+ }
+
+ if (mTransaction->status(NULL) != LLXMLRPCTransaction::StatusComplete)
+ {
+ tellUserError(mTransaction->statusMessage(), mTransaction->statusURI());
+ }
+ else {
+ switch (mTransactionType)
+ {
+ case TransactionPreflight: finishWebSiteInfo(); break;
+ case TransactionBuy: finishWebSitePrep(); break;
+ default: ;
+ }
+ }
+
+ delete mTransaction;
+ mTransaction = NULL;
+
+ return true;
}
void LLFloaterBuyLandUI::tellUserError(
- const std::string& message, const std::string& uri)
+ const std::string& message, const std::string& uri)
{
- mCanBuy = false;
- mCannotBuyIsError = true;
- mCannotBuyReason = getString("fetching_error");
- mCannotBuyReason += message;
- mCannotBuyURI = uri;
+ mCanBuy = false;
+ mCannotBuyIsError = true;
+ mCannotBuyReason = getString("fetching_error");
+ mCannotBuyReason += message;
+ mCannotBuyURI = uri;
}
// virtual
BOOL LLFloaterBuyLandUI::postBuild()
{
- setVisibleCallback(boost::bind(&LLFloaterBuyLandUI::onVisibilityChanged, this, _2));
-
- mCurrency.prepare();
-
- getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickBuy, this));
- getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickCancel, this));
- getChild<LLUICtrl>("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickErrorWeb, this));
-
- center();
-
- return TRUE;
+ setVisibleCallback(boost::bind(&LLFloaterBuyLandUI::onVisibilityChanged, this, _2));
+
+ mCurrency.prepare();
+
+ getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickBuy, this));
+ getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickCancel, this));
+ getChild<LLUICtrl>("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickErrorWeb, this));
+
+ center();
+
+ return TRUE;
}
void LLFloaterBuyLandUI::setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel)
{
- if (mTransaction && mTransactionType == TransactionBuy)
- {
- // the user is buying, don't change the selection
- return;
- }
-
- mRegion = region;
- mParcel = parcel;
-
- updateAgentInfo();
- updateParcelInfo();
- updateCovenantInfo();
- if (mCanBuy)
- {
- updateWebSiteInfo();
- }
- refreshUI();
+ if (mTransaction && mTransactionType == TransactionBuy)
+ {
+ // the user is buying, don't change the selection
+ return;
+ }
+
+ mRegion = region;
+ mParcel = parcel;
+
+ updateAgentInfo();
+ updateParcelInfo();
+ updateCovenantInfo();
+ if (mCanBuy)
+ {
+ updateWebSiteInfo();
+ }
+ refreshUI();
}
void LLFloaterBuyLandUI::setForGroup(bool forGroup)
{
- mIsForGroup = forGroup;
+ mIsForGroup = forGroup;
}
void LLFloaterBuyLandUI::draw()
{
- LLFloater::draw();
-
- bool needsUpdate = false;
- needsUpdate |= checkTransaction();
- needsUpdate |= mCurrency.process();
-
- if (mBought)
- {
- closeFloater();
- }
- else if (needsUpdate)
- {
- if (mCanBuy && mCurrency.hasError())
- {
- tellUserError(mCurrency.errorMessage(), mCurrency.errorURI());
- }
-
- refreshUI();
- }
+ LLFloater::draw();
+
+ bool needsUpdate = false;
+ needsUpdate |= checkTransaction();
+ needsUpdate |= mCurrency.process();
+
+ if (mBought)
+ {
+ closeFloater();
+ }
+ else if (needsUpdate)
+ {
+ if (mCanBuy && mCurrency.hasError())
+ {
+ tellUserError(mCurrency.errorMessage(), mCurrency.errorURI());
+ }
+
+ refreshUI();
+ }
}
// virtual
BOOL LLFloaterBuyLandUI::canClose()
{
- // mTransactionType check for pre-buy estimation stage and mCurrency to allow exit after transaction
- bool can_close = !mTransaction && (mTransactionType != TransactionBuy || mCurrency.canCancel());
- if (!can_close)
- {
- // explain to user why they can't do this, see DEV-9605
- LLNotificationsUtil::add("CannotCloseFloaterBuyLand");
- }
- return can_close;
+ // mTransactionType check for pre-buy estimation stage and mCurrency to allow exit after transaction
+ bool can_close = !mTransaction && (mTransactionType != TransactionBuy || mCurrency.canCancel());
+ if (!can_close)
+ {
+ // explain to user why they can't do this, see DEV-9605
+ LLNotificationsUtil::add("CannotCloseFloaterBuyLand");
+ }
+ return can_close;
}
void LLFloaterBuyLandUI::onVisibilityChanged ( const LLSD& new_visibility )
{
- if (new_visibility.asBoolean())
- {
- refreshUI();
- }
+ if (new_visibility.asBoolean())
+ {
+ refreshUI();
+ }
}
void LLFloaterBuyLandUI::refreshUI()
{
- // section zero: title area
- {
- LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image");
- if (snapshot)
- {
- snapshot->setImageAssetID(
- mParcelValid ? mParcelSnapshot : LLUUID::null);
- }
-
- if (mParcelValid)
- {
- getChild<LLUICtrl>("info_parcel")->setValue(mParcelLocation);
-
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea);
- string_args["[AMOUNT2]"] = llformat("%d", mParcelSupportedObjects);
-
- getChild<LLUICtrl>("info_size")->setValue(getString("meters_supports_object", string_args));
-
- F32 cost_per_sqm = 0.0f;
- if (mParcelActualArea > 0)
- {
- cost_per_sqm = (F32)mParcelPrice / (F32)mParcelActualArea;
- }
-
- LLStringUtil::format_map_t info_price_args;
- info_price_args["[PRICE]"] = llformat("%d", mParcelPrice);
- info_price_args["[PRICE_PER_SQM]"] = llformat("%.1f", cost_per_sqm);
- if (mParcelSoldWithObjects)
- {
- info_price_args["[SOLD_WITH_OBJECTS]"] = getString("sold_with_objects");
- }
- else
- {
- info_price_args["[SOLD_WITH_OBJECTS]"] = getString("sold_without_objects");
- }
- getChild<LLUICtrl>("info_price")->setValue(getString("info_price_string", info_price_args));
- getChildView("info_price")->setVisible( mParcelIsForSale);
- }
- else
- {
- getChild<LLUICtrl>("info_parcel")->setValue(getString("no_parcel_selected"));
- getChild<LLUICtrl>("info_size")->setValue(LLStringUtil::null);
- getChild<LLUICtrl>("info_price")->setValue(LLStringUtil::null);
- }
-
- getChild<LLUICtrl>("info_action")->setValue(
- mCanBuy
- ?
- mIsForGroup
- ? getString("buying_for_group")//"Buying land for group:"
- : getString("buying_will")//"Buying this land will:"
- :
- mCannotBuyIsError
- ? getString("cannot_buy_now")//"Cannot buy now:"
- : getString("not_for_sale")//"Not for sale:"
-
- );
- }
-
- bool showingError = !mCanBuy || !mSiteValid;
-
- // error section
- if (showingError)
- {
- mChildren.setBadge(std::string("step_error"),
- mCannotBuyIsError
- ? LLViewChildren::BADGE_ERROR
- : LLViewChildren::BADGE_WARN);
-
- LLTextBox* message = getChild<LLTextBox>("error_message");
- if (message)
- {
- message->setVisible(true);
- message->setValue(LLSD(!mCanBuy ? mCannotBuyReason : "(waiting for data)"));
- }
-
- getChildView("error_web")->setVisible(mCannotBuyIsError && !mCannotBuyURI.empty());
- }
- else
- {
- getChildView("step_error")->setVisible(FALSE);
- getChildView("error_message")->setVisible(FALSE);
- getChildView("error_web")->setVisible(FALSE);
- }
-
-
- // section one: account
- if (!showingError)
- {
- mChildren.setBadge(std::string("step_1"),
- mSiteMembershipUpgrade
- ? LLViewChildren::BADGE_NOTE
- : LLViewChildren::BADGE_OK);
- getChild<LLUICtrl>("account_action")->setValue(mSiteMembershipAction);
- getChild<LLUICtrl>("account_reason")->setValue(
- mSiteMembershipUpgrade
- ? getString("must_upgrade")
- : getString("cant_own_land")
- );
-
- LLComboBox* levels = getChild<LLComboBox>( "account_level");
- if (levels)
- {
- levels->setVisible(mSiteMembershipUpgrade);
-
- levels->removeall();
- for(std::vector<std::string>::const_iterator i
- = mSiteMembershipPlanNames.begin();
- i != mSiteMembershipPlanNames.end();
- ++i)
- {
- levels->add(*i);
- }
-
- levels->setCurrentByIndex(mUserPlanChoice);
- }
-
- getChildView("step_1")->setVisible(TRUE);
- getChildView("account_action")->setVisible(TRUE);
- getChildView("account_reason")->setVisible(TRUE);
- }
- else
- {
- getChildView("step_1")->setVisible(FALSE);
- getChildView("account_action")->setVisible(FALSE);
- getChildView("account_reason")->setVisible(FALSE);
- getChildView("account_level")->setVisible(FALSE);
- }
-
- // section two: land use fees
- if (!showingError)
- {
- mChildren.setBadge(std::string("step_2"),
- mSiteLandUseUpgrade
- ? LLViewChildren::BADGE_NOTE
- : LLViewChildren::BADGE_OK);
- getChild<LLUICtrl>("land_use_action")->setValue(mSiteLandUseAction);
-
- std::string message;
-
- if (mIsForGroup)
- {
- LLStringUtil::format_map_t string_args;
- string_args["[GROUP]"] = std::string(gAgent.getGroupName());
-
- message += getString("insufficient_land_credits", string_args);
-
- }
- else
- {
- LLStringUtil::format_map_t string_args;
- string_args["[BUYER]"] = llformat("%d", mAgentCommittedTier);
- message += getString("land_holdings", string_args);
- }
-
- if (!mParcelValid)
- {
- message += LLTrans::getString("sentences_separator") + getString("no_parcel_selected");
- }
- else if (mParcelBillableArea == mParcelActualArea)
- {
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d ", mParcelActualArea);
- message += LLTrans::getString("sentences_separator") + getString("parcel_meters", string_args);
- }
- else
- {
-
- if (mParcelBillableArea > mParcelActualArea)
- {
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
- message += LLTrans::getString("sentences_separator") + getString("premium_land", string_args);
- }
- else
- {
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
- message += LLTrans::getString("sentences_separator") + getString("discounted_land", string_args);
- }
- }
-
- getChild<LLUICtrl>("land_use_reason")->setValue(message);
-
- getChildView("step_2")->setVisible(TRUE);
- getChildView("land_use_action")->setVisible(TRUE);
- getChildView("land_use_reason")->setVisible(TRUE);
- }
- else
- {
- getChildView("step_2")->setVisible(FALSE);
- getChildView("land_use_action")->setVisible(FALSE);
- getChildView("land_use_reason")->setVisible(FALSE);
- }
-
- // section three: purchase & currency
- S32 finalBalance = mAgentCashBalance + mCurrency.getAmount() - mParcelPrice;
- bool willHaveEnough = finalBalance >= 0;
- bool haveEnough = mAgentCashBalance >= mParcelPrice;
- S32 minContribution = llceil((F32)mParcelBillableArea / GROUP_LAND_BONUS_FACTOR);
- bool groupContributionEnough = mParcelGroupContribution >= minContribution;
-
- mCurrency.updateUI(!showingError && !haveEnough);
-
- if (!showingError)
- {
- mChildren.setBadge(std::string("step_3"),
- !willHaveEnough
- ? LLViewChildren::BADGE_WARN
- : mCurrency.getAmount() > 0
- ? LLViewChildren::BADGE_NOTE
- : LLViewChildren::BADGE_OK);
-
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d", mParcelPrice);
- string_args["[SELLER]"] = mParcelSellerName;
- getChild<LLUICtrl>("purchase_action")->setValue(getString("pay_to_for_land", string_args));
- getChildView("purchase_action")->setVisible( mParcelValid);
-
- std::string reasonString;
-
- if (haveEnough)
- {
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);
-
- getChild<LLUICtrl>("currency_reason")->setValue(getString("have_enough_lindens", string_args));
- }
- else
- {
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);
- string_args["[AMOUNT2]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
-
- getChild<LLUICtrl>("currency_reason")->setValue(getString("not_enough_lindens", string_args));
-
- getChild<LLUICtrl>("currency_est")->setTextArg("[LOCAL_AMOUNT]", mCurrency.getLocalEstimate());
- }
-
- if (willHaveEnough)
- {
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d", finalBalance);
-
- getChild<LLUICtrl>("currency_balance")->setValue(getString("balance_left", string_args));
-
- }
- else
- {
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
-
- getChild<LLUICtrl>("currency_balance")->setValue(getString("balance_needed", string_args));
-
- }
-
- getChild<LLUICtrl>("remove_contribution")->setValue(LLSD(groupContributionEnough));
- getChildView("remove_contribution")->setEnabled(groupContributionEnough);
- bool showRemoveContribution = mParcelIsGroupLand
- && (mParcelGroupContribution > 0);
- getChildView("remove_contribution")->setLabelArg("[AMOUNT]",
- llformat("%d", minContribution));
- getChildView("remove_contribution")->setVisible( showRemoveContribution);
-
- getChildView("step_3")->setVisible(TRUE);
- getChildView("purchase_action")->setVisible(TRUE);
- getChildView("currency_reason")->setVisible(TRUE);
- getChildView("currency_balance")->setVisible(TRUE);
- }
- else
- {
- getChildView("step_3")->setVisible(FALSE);
- getChildView("purchase_action")->setVisible(FALSE);
- getChildView("currency_reason")->setVisible(FALSE);
- getChildView("currency_balance")->setVisible(FALSE);
- getChildView("remove_group_donation")->setVisible(FALSE);
- }
-
-
- bool agrees_to_covenant = false;
- LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
- if (check)
- {
- agrees_to_covenant = check->get();
- }
-
- getChildView("buy_btn")->setEnabled(mCanBuy && mSiteValid && willHaveEnough && !mTransaction && agrees_to_covenant);
+ // section zero: title area
+ {
+ LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image");
+ if (snapshot)
+ {
+ snapshot->setImageAssetID(
+ mParcelValid ? mParcelSnapshot : LLUUID::null);
+ }
+
+ if (mParcelValid)
+ {
+ getChild<LLUICtrl>("info_parcel")->setValue(mParcelLocation);
+
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea);
+ string_args["[AMOUNT2]"] = llformat("%d", mParcelSupportedObjects);
+
+ getChild<LLUICtrl>("info_size")->setValue(getString("meters_supports_object", string_args));
+
+ F32 cost_per_sqm = 0.0f;
+ if (mParcelActualArea > 0)
+ {
+ cost_per_sqm = (F32)mParcelPrice / (F32)mParcelActualArea;
+ }
+
+ LLStringUtil::format_map_t info_price_args;
+ info_price_args["[PRICE]"] = llformat("%d", mParcelPrice);
+ info_price_args["[PRICE_PER_SQM]"] = llformat("%.1f", cost_per_sqm);
+ if (mParcelSoldWithObjects)
+ {
+ info_price_args["[SOLD_WITH_OBJECTS]"] = getString("sold_with_objects");
+ }
+ else
+ {
+ info_price_args["[SOLD_WITH_OBJECTS]"] = getString("sold_without_objects");
+ }
+ getChild<LLUICtrl>("info_price")->setValue(getString("info_price_string", info_price_args));
+ getChildView("info_price")->setVisible( mParcelIsForSale);
+ }
+ else
+ {
+ getChild<LLUICtrl>("info_parcel")->setValue(getString("no_parcel_selected"));
+ getChild<LLUICtrl>("info_size")->setValue(LLStringUtil::null);
+ getChild<LLUICtrl>("info_price")->setValue(LLStringUtil::null);
+ }
+
+ getChild<LLUICtrl>("info_action")->setValue(
+ mCanBuy
+ ?
+ mIsForGroup
+ ? getString("buying_for_group")//"Buying land for group:"
+ : getString("buying_will")//"Buying this land will:"
+ :
+ mCannotBuyIsError
+ ? getString("cannot_buy_now")//"Cannot buy now:"
+ : getString("not_for_sale")//"Not for sale:"
+
+ );
+ }
+
+ bool showingError = !mCanBuy || !mSiteValid;
+
+ // error section
+ if (showingError)
+ {
+ mChildren.setBadge(std::string("step_error"),
+ mCannotBuyIsError
+ ? LLViewChildren::BADGE_ERROR
+ : LLViewChildren::BADGE_WARN);
+
+ LLTextBox* message = getChild<LLTextBox>("error_message");
+ if (message)
+ {
+ message->setVisible(true);
+ message->setValue(LLSD(!mCanBuy ? mCannotBuyReason : "(waiting for data)"));
+ }
+
+ getChildView("error_web")->setVisible(mCannotBuyIsError && !mCannotBuyURI.empty());
+ }
+ else
+ {
+ getChildView("step_error")->setVisible(FALSE);
+ getChildView("error_message")->setVisible(FALSE);
+ getChildView("error_web")->setVisible(FALSE);
+ }
+
+
+ // section one: account
+ if (!showingError)
+ {
+ mChildren.setBadge(std::string("step_1"),
+ mSiteMembershipUpgrade
+ ? LLViewChildren::BADGE_NOTE
+ : LLViewChildren::BADGE_OK);
+ getChild<LLUICtrl>("account_action")->setValue(mSiteMembershipAction);
+ getChild<LLUICtrl>("account_reason")->setValue(
+ mSiteMembershipUpgrade
+ ? getString("must_upgrade")
+ : getString("cant_own_land")
+ );
+
+ LLComboBox* levels = getChild<LLComboBox>( "account_level");
+ if (levels)
+ {
+ levels->setVisible(mSiteMembershipUpgrade);
+
+ levels->removeall();
+ for(std::vector<std::string>::const_iterator i
+ = mSiteMembershipPlanNames.begin();
+ i != mSiteMembershipPlanNames.end();
+ ++i)
+ {
+ levels->add(*i);
+ }
+
+ levels->setCurrentByIndex(mUserPlanChoice);
+ }
+
+ getChildView("step_1")->setVisible(TRUE);
+ getChildView("account_action")->setVisible(TRUE);
+ getChildView("account_reason")->setVisible(TRUE);
+ }
+ else
+ {
+ getChildView("step_1")->setVisible(FALSE);
+ getChildView("account_action")->setVisible(FALSE);
+ getChildView("account_reason")->setVisible(FALSE);
+ getChildView("account_level")->setVisible(FALSE);
+ }
+
+ // section two: land use fees
+ if (!showingError)
+ {
+ mChildren.setBadge(std::string("step_2"),
+ mSiteLandUseUpgrade
+ ? LLViewChildren::BADGE_NOTE
+ : LLViewChildren::BADGE_OK);
+ getChild<LLUICtrl>("land_use_action")->setValue(mSiteLandUseAction);
+
+ std::string message;
+
+ if (mIsForGroup)
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[GROUP]"] = std::string(gAgent.getGroupName());
+
+ message += getString("insufficient_land_credits", string_args);
+
+ }
+ else
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[BUYER]"] = llformat("%d", mAgentCommittedTier);
+ message += getString("land_holdings", string_args);
+ }
+
+ if (!mParcelValid)
+ {
+ message += LLTrans::getString("sentences_separator") + getString("no_parcel_selected");
+ }
+ else if (mParcelBillableArea == mParcelActualArea)
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d ", mParcelActualArea);
+ message += LLTrans::getString("sentences_separator") + getString("parcel_meters", string_args);
+ }
+ else
+ {
+
+ if (mParcelBillableArea > mParcelActualArea)
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
+ message += LLTrans::getString("sentences_separator") + getString("premium_land", string_args);
+ }
+ else
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
+ message += LLTrans::getString("sentences_separator") + getString("discounted_land", string_args);
+ }
+ }
+
+ getChild<LLUICtrl>("land_use_reason")->setValue(message);
+
+ getChildView("step_2")->setVisible(TRUE);
+ getChildView("land_use_action")->setVisible(TRUE);
+ getChildView("land_use_reason")->setVisible(TRUE);
+ }
+ else
+ {
+ getChildView("step_2")->setVisible(FALSE);
+ getChildView("land_use_action")->setVisible(FALSE);
+ getChildView("land_use_reason")->setVisible(FALSE);
+ }
+
+ // section three: purchase & currency
+ S32 finalBalance = mAgentCashBalance + mCurrency.getAmount() - mParcelPrice;
+ bool willHaveEnough = finalBalance >= 0;
+ bool haveEnough = mAgentCashBalance >= mParcelPrice;
+ S32 minContribution = llceil((F32)mParcelBillableArea / GROUP_LAND_BONUS_FACTOR);
+ bool groupContributionEnough = mParcelGroupContribution >= minContribution;
+
+ mCurrency.updateUI(!showingError && !haveEnough);
+
+ if (!showingError)
+ {
+ mChildren.setBadge(std::string("step_3"),
+ !willHaveEnough
+ ? LLViewChildren::BADGE_WARN
+ : mCurrency.getAmount() > 0
+ ? LLViewChildren::BADGE_NOTE
+ : LLViewChildren::BADGE_OK);
+
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelPrice);
+ string_args["[SELLER]"] = mParcelSellerName;
+ getChild<LLUICtrl>("purchase_action")->setValue(getString("pay_to_for_land", string_args));
+ getChildView("purchase_action")->setVisible( mParcelValid);
+
+ std::string reasonString;
+
+ if (haveEnough)
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);
+
+ getChild<LLUICtrl>("currency_reason")->setValue(getString("have_enough_lindens", string_args));
+ }
+ else
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);
+ string_args["[AMOUNT2]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
+
+ getChild<LLUICtrl>("currency_reason")->setValue(getString("not_enough_lindens", string_args));
+
+ getChild<LLUICtrl>("currency_est")->setTextArg("[LOCAL_AMOUNT]", mCurrency.getLocalEstimate());
+ }
+
+ if (willHaveEnough)
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", finalBalance);
+
+ getChild<LLUICtrl>("currency_balance")->setValue(getString("balance_left", string_args));
+
+ }
+ else
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
+
+ getChild<LLUICtrl>("currency_balance")->setValue(getString("balance_needed", string_args));
+
+ }
+
+ getChild<LLUICtrl>("remove_contribution")->setValue(LLSD(groupContributionEnough));
+ getChildView("remove_contribution")->setEnabled(groupContributionEnough);
+ bool showRemoveContribution = mParcelIsGroupLand
+ && (mParcelGroupContribution > 0);
+ getChildView("remove_contribution")->setLabelArg("[AMOUNT]",
+ llformat("%d", minContribution));
+ getChildView("remove_contribution")->setVisible( showRemoveContribution);
+
+ getChildView("step_3")->setVisible(TRUE);
+ getChildView("purchase_action")->setVisible(TRUE);
+ getChildView("currency_reason")->setVisible(TRUE);
+ getChildView("currency_balance")->setVisible(TRUE);
+ }
+ else
+ {
+ getChildView("step_3")->setVisible(FALSE);
+ getChildView("purchase_action")->setVisible(FALSE);
+ getChildView("currency_reason")->setVisible(FALSE);
+ getChildView("currency_balance")->setVisible(FALSE);
+ getChildView("remove_group_donation")->setVisible(FALSE);
+ }
+
+
+ bool agrees_to_covenant = false;
+ LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
+ if (check)
+ {
+ agrees_to_covenant = check->get();
+ }
+
+ getChildView("buy_btn")->setEnabled(mCanBuy && mSiteValid && willHaveEnough && !mTransaction && agrees_to_covenant);
}
void LLFloaterBuyLandUI::startBuyPreConfirm()
{
- std::string action;
-
- if (mSiteMembershipUpgrade)
- {
- action += mSiteMembershipAction;
- action += "\n";
-
- LLComboBox* levels = getChild<LLComboBox>( "account_level");
- if (levels)
- {
- action += " * ";
- action += mSiteMembershipPlanNames[levels->getCurrentIndex()];
- action += "\n";
- }
- }
- if (mSiteLandUseUpgrade)
- {
- action += mSiteLandUseAction;
- action += "\n";
- }
- if (mCurrency.getAmount() > 0)
- {
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d", mCurrency.getAmount());
- string_args["[LOCAL_AMOUNT]"] = mCurrency.getLocalEstimate();
-
- action += getString("buy_for_US", string_args);
- }
-
- LLStringUtil::format_map_t string_args;
- string_args["[AMOUNT]"] = llformat("%d", mParcelPrice);
- string_args["[SELLER]"] = mParcelSellerName;
- action += getString("pay_to_for_land", string_args);
-
-
- LLConfirmationManager::confirm(mSiteConfirm,
- action,
- *this,
- &LLFloaterBuyLandUI::startBuyPostConfirm);
+ std::string action;
+
+ if (mSiteMembershipUpgrade)
+ {
+ action += mSiteMembershipAction;
+ action += "\n";
+
+ LLComboBox* levels = getChild<LLComboBox>( "account_level");
+ if (levels)
+ {
+ action += " * ";
+ action += mSiteMembershipPlanNames[levels->getCurrentIndex()];
+ action += "\n";
+ }
+ }
+ if (mSiteLandUseUpgrade)
+ {
+ action += mSiteLandUseAction;
+ action += "\n";
+ }
+ if (mCurrency.getAmount() > 0)
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mCurrency.getAmount());
+ string_args["[LOCAL_AMOUNT]"] = mCurrency.getLocalEstimate();
+
+ action += getString("buy_for_US", string_args);
+ }
+
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelPrice);
+ string_args["[SELLER]"] = mParcelSellerName;
+ action += getString("pay_to_for_land", string_args);
+
+
+ LLConfirmationManager::confirm(mSiteConfirm,
+ action,
+ *this,
+ &LLFloaterBuyLandUI::startBuyPostConfirm);
}
void LLFloaterBuyLandUI::startBuyPostConfirm(const std::string& password)
{
- runWebSitePrep(password);
-
- mCanBuy = false;
- mCannotBuyReason = getString("processing");
- refreshUI();
+ runWebSitePrep(password);
+
+ mCanBuy = false;
+ mCannotBuyReason = getString("processing");
+ refreshUI();
}
void LLFloaterBuyLandUI::onClickBuy()
{
- startBuyPreConfirm();
+ startBuyPreConfirm();
}
void LLFloaterBuyLandUI::onClickCancel()
{
- closeFloater();
+ closeFloater();
}
void LLFloaterBuyLandUI::onClickErrorWeb()
{
- LLWeb::loadURLExternal(mCannotBuyURI);
- closeFloater();
+ LLWeb::loadURLExternal(mCannotBuyURI);
+ closeFloater();
}
diff --git a/indra/newview/llfloaterbuyland.h b/indra/newview/llfloaterbuyland.h
index 424f6f6616..f750a4017a 100644
--- a/indra/newview/llfloaterbuyland.h
+++ b/indra/newview/llfloaterbuyland.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbuyland.h
* @brief LLFloaterBuyLand class definition
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,15 +34,15 @@ class LLParcelSelection;
class LLFloaterBuyLand
{
public:
- static void buyLand(LLViewerRegion* region,
- LLSafeHandle<LLParcelSelection> parcel,
- bool is_for_group);
- static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
- static void updateEstateName(const std::string& name);
- static void updateLastModified(const std::string& text);
- static void updateEstateOwnerName(const std::string& name);
-
- static LLFloater* buildFloater(const LLSD& key);
+ static void buyLand(LLViewerRegion* region,
+ LLSafeHandle<LLParcelSelection> parcel,
+ bool is_for_group);
+ static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
+ static void updateEstateName(const std::string& name);
+ static void updateLastModified(const std::string& text);
+ static void updateEstateOwnerName(const std::string& name);
+
+ static LLFloater* buildFloater(const LLSD& key);
};
#endif
diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp
index 6e29450ff3..1fb0a72d3e 100644
--- a/indra/newview/llfloaterbvhpreview.cpp
+++ b/indra/newview/llfloaterbvhpreview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbvhpreview.cpp
* @brief LLFloaterBvhPreview class implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -59,7 +59,7 @@
#include "llviewercamera.h"
#include "llviewerobjectlist.h"
#include "llviewerwindow.h"
-#include "llviewermenufile.h" // upload_new_resource()
+#include "llviewermenufile.h" // upload_new_resource()
#include "llvoavatar.h"
#include "pipeline.h"
#include "lluictrlfactory.h"
@@ -81,74 +81,74 @@ const F32 BASE_ANIM_TIME_OFFSET = 5.f;
std::string STATUS[] =
{
- "E_ST_OK",
- "E_ST_EOF",
- "E_ST_NO_CONSTRAINT",
- "E_ST_NO_FILE",
- "E_ST_NO_HIER",
- "E_ST_NO_JOINT",
- "E_ST_NO_NAME",
- "E_ST_NO_OFFSET",
- "E_ST_NO_CHANNELS",
- "E_ST_NO_ROTATION",
- "E_ST_NO_AXIS",
- "E_ST_NO_MOTION",
- "E_ST_NO_FRAMES",
- "E_ST_NO_FRAME_TIME",
- "E_ST_NO_POS",
- "E_ST_NO_ROT",
- "E_ST_NO_XLT_FILE",
- "E_ST_NO_XLT_HEADER",
- "E_ST_NO_XLT_NAME",
- "E_ST_NO_XLT_IGNORE",
- "E_ST_NO_XLT_RELATIVE",
- "E_ST_NO_XLT_OUTNAME",
- "E_ST_NO_XLT_MATRIX",
- "E_ST_NO_XLT_MERGECHILD",
- "E_ST_NO_XLT_MERGEPARENT",
- "E_ST_NO_XLT_PRIORITY",
- "E_ST_NO_XLT_LOOP",
- "E_ST_NO_XLT_EASEIN",
- "E_ST_NO_XLT_EASEOUT",
- "E_ST_NO_XLT_HAND",
- "E_ST_NO_XLT_EMOTE",
+ "E_ST_OK",
+ "E_ST_EOF",
+ "E_ST_NO_CONSTRAINT",
+ "E_ST_NO_FILE",
+ "E_ST_NO_HIER",
+ "E_ST_NO_JOINT",
+ "E_ST_NO_NAME",
+ "E_ST_NO_OFFSET",
+ "E_ST_NO_CHANNELS",
+ "E_ST_NO_ROTATION",
+ "E_ST_NO_AXIS",
+ "E_ST_NO_MOTION",
+ "E_ST_NO_FRAMES",
+ "E_ST_NO_FRAME_TIME",
+ "E_ST_NO_POS",
+ "E_ST_NO_ROT",
+ "E_ST_NO_XLT_FILE",
+ "E_ST_NO_XLT_HEADER",
+ "E_ST_NO_XLT_NAME",
+ "E_ST_NO_XLT_IGNORE",
+ "E_ST_NO_XLT_RELATIVE",
+ "E_ST_NO_XLT_OUTNAME",
+ "E_ST_NO_XLT_MATRIX",
+ "E_ST_NO_XLT_MERGECHILD",
+ "E_ST_NO_XLT_MERGEPARENT",
+ "E_ST_NO_XLT_PRIORITY",
+ "E_ST_NO_XLT_LOOP",
+ "E_ST_NO_XLT_EASEIN",
+ "E_ST_NO_XLT_EASEOUT",
+ "E_ST_NO_XLT_HAND",
+ "E_ST_NO_XLT_EMOTE",
"E_ST_BAD_ROOT"
};
//-----------------------------------------------------------------------------
// LLFloaterBvhPreview()
//-----------------------------------------------------------------------------
-LLFloaterBvhPreview::LLFloaterBvhPreview(const std::string& filename) :
- LLFloaterNameDesc(filename)
+LLFloaterBvhPreview::LLFloaterBvhPreview(const std::string& filename) :
+ LLFloaterNameDesc(filename)
{
- mLastMouseX = 0;
- mLastMouseY = 0;
-
- mIDList["Standing"] = ANIM_AGENT_STAND;
- mIDList["Walking"] = ANIM_AGENT_FEMALE_WALK;
- mIDList["Sitting"] = ANIM_AGENT_SIT_FEMALE;
- mIDList["Flying"] = ANIM_AGENT_HOVER;
-
- mIDList["[None]"] = LLUUID::null;
- mIDList["Aaaaah"] = ANIM_AGENT_EXPRESS_OPEN_MOUTH;
- mIDList["Afraid"] = ANIM_AGENT_EXPRESS_AFRAID;
- mIDList["Angry"] = ANIM_AGENT_EXPRESS_ANGER;
- mIDList["Big Smile"] = ANIM_AGENT_EXPRESS_TOOTHSMILE;
- mIDList["Bored"] = ANIM_AGENT_EXPRESS_BORED;
- mIDList["Cry"] = ANIM_AGENT_EXPRESS_CRY;
- mIDList["Disdain"] = ANIM_AGENT_EXPRESS_DISDAIN;
- mIDList["Embarrassed"] = ANIM_AGENT_EXPRESS_EMBARRASSED;
- mIDList["Frown"] = ANIM_AGENT_EXPRESS_FROWN;
- mIDList["Kiss"] = ANIM_AGENT_EXPRESS_KISS;
- mIDList["Laugh"] = ANIM_AGENT_EXPRESS_LAUGH;
- mIDList["Plllppt"] = ANIM_AGENT_EXPRESS_TONGUE_OUT;
- mIDList["Repulsed"] = ANIM_AGENT_EXPRESS_REPULSED;
- mIDList["Sad"] = ANIM_AGENT_EXPRESS_SAD;
- mIDList["Shrug"] = ANIM_AGENT_EXPRESS_SHRUG;
- mIDList["Smile"] = ANIM_AGENT_EXPRESS_SMILE;
- mIDList["Surprise"] = ANIM_AGENT_EXPRESS_SURPRISE;
- mIDList["Wink"] = ANIM_AGENT_EXPRESS_WINK;
- mIDList["Worry"] = ANIM_AGENT_EXPRESS_WORRY;
+ mLastMouseX = 0;
+ mLastMouseY = 0;
+
+ mIDList["Standing"] = ANIM_AGENT_STAND;
+ mIDList["Walking"] = ANIM_AGENT_FEMALE_WALK;
+ mIDList["Sitting"] = ANIM_AGENT_SIT_FEMALE;
+ mIDList["Flying"] = ANIM_AGENT_HOVER;
+
+ mIDList["[None]"] = LLUUID::null;
+ mIDList["Aaaaah"] = ANIM_AGENT_EXPRESS_OPEN_MOUTH;
+ mIDList["Afraid"] = ANIM_AGENT_EXPRESS_AFRAID;
+ mIDList["Angry"] = ANIM_AGENT_EXPRESS_ANGER;
+ mIDList["Big Smile"] = ANIM_AGENT_EXPRESS_TOOTHSMILE;
+ mIDList["Bored"] = ANIM_AGENT_EXPRESS_BORED;
+ mIDList["Cry"] = ANIM_AGENT_EXPRESS_CRY;
+ mIDList["Disdain"] = ANIM_AGENT_EXPRESS_DISDAIN;
+ mIDList["Embarrassed"] = ANIM_AGENT_EXPRESS_EMBARRASSED;
+ mIDList["Frown"] = ANIM_AGENT_EXPRESS_FROWN;
+ mIDList["Kiss"] = ANIM_AGENT_EXPRESS_KISS;
+ mIDList["Laugh"] = ANIM_AGENT_EXPRESS_LAUGH;
+ mIDList["Plllppt"] = ANIM_AGENT_EXPRESS_TONGUE_OUT;
+ mIDList["Repulsed"] = ANIM_AGENT_EXPRESS_REPULSED;
+ mIDList["Sad"] = ANIM_AGENT_EXPRESS_SAD;
+ mIDList["Shrug"] = ANIM_AGENT_EXPRESS_SHRUG;
+ mIDList["Smile"] = ANIM_AGENT_EXPRESS_SMILE;
+ mIDList["Surprise"] = ANIM_AGENT_EXPRESS_SURPRISE;
+ mIDList["Wink"] = ANIM_AGENT_EXPRESS_WINK;
+ mIDList["Worry"] = ANIM_AGENT_EXPRESS_WORRY;
}
//-----------------------------------------------------------------------------
@@ -156,27 +156,27 @@ LLFloaterBvhPreview::LLFloaterBvhPreview(const std::string& filename) :
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::setAnimCallbacks()
{
- getChild<LLUICtrl>("playback_slider")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onSliderMove, this));
-
- getChild<LLUICtrl>("preview_base_anim")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitBaseAnim, this));
- getChild<LLUICtrl>("preview_base_anim")->setValue("Standing");
-
- getChild<LLUICtrl>("priority")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitPriority, this));
- getChild<LLUICtrl>("loop_check")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoop, this));
- getChild<LLUICtrl>("loop_in_point")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopIn, this));
- getChild<LLUICtrl>("loop_in_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopIn, this, _1));
- getChild<LLUICtrl>("loop_out_point")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopOut, this));
- getChild<LLUICtrl>("loop_out_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopOut, this, _1));
-
- getChild<LLUICtrl>("hand_pose_combo")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitHandPose, this));
-
- getChild<LLUICtrl>("emote_combo")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEmote, this));
- getChild<LLUICtrl>("emote_combo")->setValue("[None]");
-
- getChild<LLUICtrl>("ease_in_time")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEaseIn, this));
- getChild<LLUICtrl>("ease_in_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseIn, this, _1));
- getChild<LLUICtrl>("ease_out_time")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEaseOut, this));
- getChild<LLUICtrl>("ease_out_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseOut, this, _1));
+ getChild<LLUICtrl>("playback_slider")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onSliderMove, this));
+
+ getChild<LLUICtrl>("preview_base_anim")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitBaseAnim, this));
+ getChild<LLUICtrl>("preview_base_anim")->setValue("Standing");
+
+ getChild<LLUICtrl>("priority")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitPriority, this));
+ getChild<LLUICtrl>("loop_check")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoop, this));
+ getChild<LLUICtrl>("loop_in_point")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopIn, this));
+ getChild<LLUICtrl>("loop_in_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopIn, this, _1));
+ getChild<LLUICtrl>("loop_out_point")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopOut, this));
+ getChild<LLUICtrl>("loop_out_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopOut, this, _1));
+
+ getChild<LLUICtrl>("hand_pose_combo")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitHandPose, this));
+
+ getChild<LLUICtrl>("emote_combo")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEmote, this));
+ getChild<LLUICtrl>("emote_combo")->setValue("[None]");
+
+ getChild<LLUICtrl>("ease_in_time")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEaseIn, this));
+ getChild<LLUICtrl>("ease_in_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseIn, this, _1));
+ getChild<LLUICtrl>("ease_out_time")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEaseOut, this));
+ getChild<LLUICtrl>("ease_out_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseOut, this, _1));
}
std::map <std::string, std::string> LLFloaterBvhPreview::getJointAliases()
@@ -190,189 +190,189 @@ std::map <std::string, std::string> LLFloaterBvhPreview::getJointAliases()
//-----------------------------------------------------------------------------
BOOL LLFloaterBvhPreview::postBuild()
{
- LLKeyframeMotion* motionp = NULL;
- LLBVHLoader* loaderp = NULL;
+ LLKeyframeMotion* motionp = NULL;
+ LLBVHLoader* loaderp = NULL;
+
+ if (!LLFloaterNameDesc::postBuild())
+ {
+ return FALSE;
+ }
- if (!LLFloaterNameDesc::postBuild())
- {
- return FALSE;
- }
+ getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitName, this));
- getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitName, this));
+ childSetAction("ok_btn", onBtnOK, this);
+ setDefaultBtn();
- childSetAction("ok_btn", onBtnOK, this);
- setDefaultBtn();
+ mPreviewRect.set(PREVIEW_HPAD,
+ PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD,
+ getRect().getWidth() - PREVIEW_HPAD,
+ PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);
- mPreviewRect.set(PREVIEW_HPAD,
- PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD,
- getRect().getWidth() - PREVIEW_HPAD,
- PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
- mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);
+ mPlayButton = getChild<LLButton>( "play_btn");
+ mPlayButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnPlay, this));
+ mPlayButton->setVisible(true);
- mPlayButton = getChild<LLButton>( "play_btn");
- mPlayButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnPlay, this));
- mPlayButton->setVisible(true);
+ mPauseButton = getChild<LLButton>( "pause_btn");
+ mPauseButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnPause, this));
+ mPauseButton->setVisible(false);
- mPauseButton = getChild<LLButton>( "pause_btn");
- mPauseButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnPause, this));
- mPauseButton->setVisible(false);
-
- mStopButton = getChild<LLButton>( "stop_btn");
- mStopButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnStop, this));
+ mStopButton = getChild<LLButton>( "stop_btn");
+ mStopButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnStop, this));
- getChildView("bad_animation_text")->setVisible(FALSE);
+ getChildView("bad_animation_text")->setVisible(FALSE);
mAnimPreview = new LLPreviewAnimation(256, 256);
-
- std::string exten = gDirUtilp->getExtension(mFilename);
- if (exten == "bvh")
- {
- // loading a bvh file
-
- // now load bvh file
- S32 file_size;
-
- LLAPRFile infile ;
- infile.open(mFilenameAndPath, LL_APR_RB, NULL, &file_size);
-
- if (!infile.getFileHandle())
- {
- LL_WARNS() << "Can't open BVH file:" << mFilename << LL_ENDL;
- }
- else
- {
- char* file_buffer;
-
- file_buffer = new char[file_size + 1];
-
- if (file_size == infile.read(file_buffer, file_size))
- {
- file_buffer[file_size] = '\0';
- LL_INFOS() << "Loading BVH file " << mFilename << LL_ENDL;
- ELoadStatus load_status = E_ST_OK;
- S32 line_number = 0;
+
+ std::string exten = gDirUtilp->getExtension(mFilename);
+ if (exten == "bvh")
+ {
+ // loading a bvh file
+
+ // now load bvh file
+ S32 file_size;
+
+ LLAPRFile infile ;
+ infile.open(mFilenameAndPath, LL_APR_RB, NULL, &file_size);
+
+ if (!infile.getFileHandle())
+ {
+ LL_WARNS() << "Can't open BVH file:" << mFilename << LL_ENDL;
+ }
+ else
+ {
+ char* file_buffer;
+
+ file_buffer = new char[file_size + 1];
+
+ if (file_size == infile.read(file_buffer, file_size))
+ {
+ file_buffer[file_size] = '\0';
+ LL_INFOS() << "Loading BVH file " << mFilename << LL_ENDL;
+ ELoadStatus load_status = E_ST_OK;
+ S32 line_number = 0;
std::map<std::string, std::string> joint_alias_map = getJointAliases();
-
- loaderp = new LLBVHLoader(file_buffer, load_status, line_number, joint_alias_map);
- std::string status = getString(STATUS[load_status]);
-
- if(load_status == E_ST_NO_XLT_FILE)
- {
- LL_WARNS() << "NOTE: No translation table found." << LL_ENDL;
- }
- else
- {
- LL_WARNS() << "ERROR: [line: " << line_number << "] " << status << LL_ENDL;
- }
- }
-
- infile.close() ;
- delete[] file_buffer;
- }
- }
-
- if (loaderp && loaderp->isInitialized() && loaderp->getDuration() <= MAX_ANIM_DURATION)
- {
- // generate unique id for this motion
- mTransactionID.generate();
- mMotionID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
-
- // motion will be returned, but it will be in a load-pending state, as this is a new motion
- // this motion will not request an asset transfer until next update, so we have a chance to
- // load the keyframe data locally
- motionp = (LLKeyframeMotion*)mAnimPreview->getDummyAvatar()->createMotion(mMotionID);
-
- // create data buffer for keyframe initialization
- S32 buffer_size = loaderp->getOutputSize();
- U8* buffer = new U8[buffer_size];
-
- LLDataPackerBinaryBuffer dp(buffer, buffer_size);
-
- // pass animation data through memory buffer
- LL_INFOS("BVH") << "Serializing loaderp" << LL_ENDL;
- loaderp->serialize(dp);
- dp.reset();
- LL_INFOS("BVH") << "Deserializing motionp" << LL_ENDL;
- BOOL success = motionp && motionp->deserialize(dp, mMotionID, false);
- LL_INFOS("BVH") << "Done" << LL_ENDL;
-
- delete []buffer;
-
- if (success)
- {
- setAnimCallbacks() ;
-
- const LLBBoxLocal &pelvis_bbox = motionp->getPelvisBBox();
-
- LLVector3 temp = pelvis_bbox.getCenter();
- // only consider XY?
- //temp.mV[VZ] = 0.f;
- F32 pelvis_offset = temp.magVec();
-
- temp = pelvis_bbox.getExtent();
- //temp.mV[VZ] = 0.f;
- F32 pelvis_max_displacement = pelvis_offset + (temp.magVec() * 0.5f) + 1.f;
-
- F32 camera_zoom = LLViewerCamera::getInstance()->getDefaultFOV() / (2.f * atan(pelvis_max_displacement / PREVIEW_CAMERA_DISTANCE));
-
- mAnimPreview->setZoom(camera_zoom);
-
- motionp->setName(getChild<LLUICtrl>("name_form")->getValue().asString());
- mAnimPreview->getDummyAvatar()->startMotion(mMotionID);
-
- getChild<LLSlider>("playback_slider")->setMinValue(0.0);
- getChild<LLSlider>("playback_slider")->setMaxValue(1.0);
-
- getChild<LLUICtrl>("loop_check")->setValue(LLSD(motionp->getLoop()));
- getChild<LLUICtrl>("loop_in_point")->setValue(LLSD(motionp->getLoopIn() / motionp->getDuration() * 100.f));
- getChild<LLUICtrl>("loop_out_point")->setValue(LLSD(motionp->getLoopOut() / motionp->getDuration() * 100.f));
- getChild<LLUICtrl>("priority")->setValue(LLSD((F32)motionp->getPriority()));
- getChild<LLUICtrl>("hand_pose_combo")->setValue(LLHandMotion::getHandPoseName(motionp->getHandPose()));
- getChild<LLUICtrl>("ease_in_time")->setValue(LLSD(motionp->getEaseInDuration()));
- getChild<LLUICtrl>("ease_out_time")->setValue(LLSD(motionp->getEaseOutDuration()));
- setEnabled(TRUE);
- std::string seconds_string;
- seconds_string = llformat(" - %.2f seconds", motionp->getDuration());
-
- setTitle(mFilename + std::string(seconds_string));
- }
- else
- {
- mAnimPreview = NULL;
- mMotionID.setNull();
- getChild<LLUICtrl>("bad_animation_text")->setValue(getString("failed_to_initialize"));
- }
- }
- else
- {
- if ( loaderp )
- {
- if (loaderp->getDuration() > MAX_ANIM_DURATION)
- {
- LLUIString out_str = getString("anim_too_long");
- out_str.setArg("[LENGTH]", llformat("%.1f", loaderp->getDuration()));
- out_str.setArg("[MAX_LENGTH]", llformat("%.1f", MAX_ANIM_DURATION));
- getChild<LLUICtrl>("bad_animation_text")->setValue(out_str.getString());
- }
- else
- {
- LLUIString out_str = getString("failed_file_read");
- out_str.setArg("[STATUS]", getString(STATUS[loaderp->getStatus()]));
- getChild<LLUICtrl>("bad_animation_text")->setValue(out_str.getString());
- }
- }
-
- //setEnabled(FALSE);
- mMotionID.setNull();
- mAnimPreview = NULL;
- }
-
- refresh();
-
- delete loaderp;
-
- return TRUE;
+
+ loaderp = new LLBVHLoader(file_buffer, load_status, line_number, joint_alias_map);
+ std::string status = getString(STATUS[load_status]);
+
+ if(load_status == E_ST_NO_XLT_FILE)
+ {
+ LL_WARNS() << "NOTE: No translation table found." << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "ERROR: [line: " << line_number << "] " << status << LL_ENDL;
+ }
+ }
+
+ infile.close() ;
+ delete[] file_buffer;
+ }
+ }
+
+ if (loaderp && loaderp->isInitialized() && loaderp->getDuration() <= MAX_ANIM_DURATION)
+ {
+ // generate unique id for this motion
+ mTransactionID.generate();
+ mMotionID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
+
+ // motion will be returned, but it will be in a load-pending state, as this is a new motion
+ // this motion will not request an asset transfer until next update, so we have a chance to
+ // load the keyframe data locally
+ motionp = (LLKeyframeMotion*)mAnimPreview->getDummyAvatar()->createMotion(mMotionID);
+
+ // create data buffer for keyframe initialization
+ S32 buffer_size = loaderp->getOutputSize();
+ U8* buffer = new U8[buffer_size];
+
+ LLDataPackerBinaryBuffer dp(buffer, buffer_size);
+
+ // pass animation data through memory buffer
+ LL_INFOS("BVH") << "Serializing loaderp" << LL_ENDL;
+ loaderp->serialize(dp);
+ dp.reset();
+ LL_INFOS("BVH") << "Deserializing motionp" << LL_ENDL;
+ BOOL success = motionp && motionp->deserialize(dp, mMotionID, false);
+ LL_INFOS("BVH") << "Done" << LL_ENDL;
+
+ delete []buffer;
+
+ if (success)
+ {
+ setAnimCallbacks() ;
+
+ const LLBBoxLocal &pelvis_bbox = motionp->getPelvisBBox();
+
+ LLVector3 temp = pelvis_bbox.getCenter();
+ // only consider XY?
+ //temp.mV[VZ] = 0.f;
+ F32 pelvis_offset = temp.magVec();
+
+ temp = pelvis_bbox.getExtent();
+ //temp.mV[VZ] = 0.f;
+ F32 pelvis_max_displacement = pelvis_offset + (temp.magVec() * 0.5f) + 1.f;
+
+ F32 camera_zoom = LLViewerCamera::getInstance()->getDefaultFOV() / (2.f * atan(pelvis_max_displacement / PREVIEW_CAMERA_DISTANCE));
+
+ mAnimPreview->setZoom(camera_zoom);
+
+ motionp->setName(getChild<LLUICtrl>("name_form")->getValue().asString());
+ mAnimPreview->getDummyAvatar()->startMotion(mMotionID);
+
+ getChild<LLSlider>("playback_slider")->setMinValue(0.0);
+ getChild<LLSlider>("playback_slider")->setMaxValue(1.0);
+
+ getChild<LLUICtrl>("loop_check")->setValue(LLSD(motionp->getLoop()));
+ getChild<LLUICtrl>("loop_in_point")->setValue(LLSD(motionp->getLoopIn() / motionp->getDuration() * 100.f));
+ getChild<LLUICtrl>("loop_out_point")->setValue(LLSD(motionp->getLoopOut() / motionp->getDuration() * 100.f));
+ getChild<LLUICtrl>("priority")->setValue(LLSD((F32)motionp->getPriority()));
+ getChild<LLUICtrl>("hand_pose_combo")->setValue(LLHandMotion::getHandPoseName(motionp->getHandPose()));
+ getChild<LLUICtrl>("ease_in_time")->setValue(LLSD(motionp->getEaseInDuration()));
+ getChild<LLUICtrl>("ease_out_time")->setValue(LLSD(motionp->getEaseOutDuration()));
+ setEnabled(TRUE);
+ std::string seconds_string;
+ seconds_string = llformat(" - %.2f seconds", motionp->getDuration());
+
+ setTitle(mFilename + std::string(seconds_string));
+ }
+ else
+ {
+ mAnimPreview = NULL;
+ mMotionID.setNull();
+ getChild<LLUICtrl>("bad_animation_text")->setValue(getString("failed_to_initialize"));
+ }
+ }
+ else
+ {
+ if ( loaderp )
+ {
+ if (loaderp->getDuration() > MAX_ANIM_DURATION)
+ {
+ LLUIString out_str = getString("anim_too_long");
+ out_str.setArg("[LENGTH]", llformat("%.1f", loaderp->getDuration()));
+ out_str.setArg("[MAX_LENGTH]", llformat("%.1f", MAX_ANIM_DURATION));
+ getChild<LLUICtrl>("bad_animation_text")->setValue(out_str.getString());
+ }
+ else
+ {
+ LLUIString out_str = getString("failed_file_read");
+ out_str.setArg("[STATUS]", getString(STATUS[loaderp->getStatus()]));
+ getChild<LLUICtrl>("bad_animation_text")->setValue(out_str.getString());
+ }
+ }
+
+ //setEnabled(FALSE);
+ mMotionID.setNull();
+ mAnimPreview = NULL;
+ }
+
+ refresh();
+
+ delete loaderp;
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -380,9 +380,9 @@ BOOL LLFloaterBvhPreview::postBuild()
//-----------------------------------------------------------------------------
LLFloaterBvhPreview::~LLFloaterBvhPreview()
{
- mAnimPreview = NULL;
+ mAnimPreview = NULL;
- setEnabled(FALSE);
+ setEnabled(FALSE);
}
//-----------------------------------------------------------------------------
@@ -390,38 +390,38 @@ LLFloaterBvhPreview::~LLFloaterBvhPreview()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::draw()
{
- LLFloater::draw();
- LLRect r = getRect();
-
- refresh();
-
- if (mMotionID.notNull() && mAnimPreview)
- {
- gGL.color3f(1.f, 1.f, 1.f);
-
- gGL.getTexUnit(0)->bind(mAnimPreview);
-
- gGL.begin( LLRender::QUADS );
- {
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
- }
- gGL.end();
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- if (!avatarp->areAnimationsPaused())
- {
- mAnimPreview->requestUpdate();
- }
- }
+ LLFloater::draw();
+ LLRect r = getRect();
+
+ refresh();
+
+ if (mMotionID.notNull() && mAnimPreview)
+ {
+ gGL.color3f(1.f, 1.f, 1.f);
+
+ gGL.getTexUnit(0)->bind(mAnimPreview);
+
+ gGL.begin( LLRender::QUADS );
+ {
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
+ }
+ gGL.end();
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ if (!avatarp->areAnimationsPaused())
+ {
+ mAnimPreview->requestUpdate();
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -429,43 +429,43 @@ void LLFloaterBvhPreview::draw()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::resetMotion()
{
- if (!mAnimPreview)
- return;
-
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- BOOL paused = avatarp->areAnimationsPaused();
-
- LLKeyframeMotion* motionp = dynamic_cast<LLKeyframeMotion*>(avatarp->findMotion(mMotionID));
- if( motionp )
- {
- // Set emotion
- std::string emote = getChild<LLUICtrl>("emote_combo")->getValue().asString();
- motionp->setEmote(mIDList[emote]);
- }
-
- LLUUID base_id = mIDList[getChild<LLUICtrl>("preview_base_anim")->getValue().asString()];
- avatarp->deactivateAllMotions();
- avatarp->startMotion(mMotionID, 0.0f);
- avatarp->startMotion(base_id, BASE_ANIM_TIME_OFFSET);
- getChild<LLUICtrl>("playback_slider")->setValue(0.0f);
-
- // Set pose
- std::string handpose = getChild<LLUICtrl>("hand_pose_combo")->getValue().asString();
- avatarp->startMotion( ANIM_AGENT_HAND_MOTION, 0.0f );
-
- if( motionp )
- {
- motionp->setHandPose(LLHandMotion::getHandPose(handpose));
- }
-
- if (paused)
- {
- mPauseRequest = avatarp->requestPause();
- }
- else
- {
- mPauseRequest = NULL;
- }
+ if (!mAnimPreview)
+ return;
+
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ BOOL paused = avatarp->areAnimationsPaused();
+
+ LLKeyframeMotion* motionp = dynamic_cast<LLKeyframeMotion*>(avatarp->findMotion(mMotionID));
+ if( motionp )
+ {
+ // Set emotion
+ std::string emote = getChild<LLUICtrl>("emote_combo")->getValue().asString();
+ motionp->setEmote(mIDList[emote]);
+ }
+
+ LLUUID base_id = mIDList[getChild<LLUICtrl>("preview_base_anim")->getValue().asString()];
+ avatarp->deactivateAllMotions();
+ avatarp->startMotion(mMotionID, 0.0f);
+ avatarp->startMotion(base_id, BASE_ANIM_TIME_OFFSET);
+ getChild<LLUICtrl>("playback_slider")->setValue(0.0f);
+
+ // Set pose
+ std::string handpose = getChild<LLUICtrl>("hand_pose_combo")->getValue().asString();
+ avatarp->startMotion( ANIM_AGENT_HAND_MOTION, 0.0f );
+
+ if( motionp )
+ {
+ motionp->setHandPose(LLHandMotion::getHandPose(handpose));
+ }
+
+ if (paused)
+ {
+ mPauseRequest = avatarp->requestPause();
+ }
+ else
+ {
+ mPauseRequest = NULL;
+ }
}
//-----------------------------------------------------------------------------
@@ -473,17 +473,17 @@ void LLFloaterBvhPreview::resetMotion()
//-----------------------------------------------------------------------------
BOOL LLFloaterBvhPreview::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if (mPreviewRect.pointInRect(x, y))
- {
- bringToFront( x, y );
- gFocusMgr.setMouseCapture(this);
- gViewerWindow->hideCursor();
- mLastMouseX = x;
- mLastMouseY = y;
- return TRUE;
- }
-
- return LLFloater::handleMouseDown(x, y, mask);
+ if (mPreviewRect.pointInRect(x, y))
+ {
+ bringToFront( x, y );
+ gFocusMgr.setMouseCapture(this);
+ gViewerWindow->hideCursor();
+ mLastMouseX = x;
+ mLastMouseY = y;
+ return TRUE;
+ }
+
+ return LLFloater::handleMouseDown(x, y, mask);
}
//-----------------------------------------------------------------------------
@@ -491,9 +491,9 @@ BOOL LLFloaterBvhPreview::handleMouseDown(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
BOOL LLFloaterBvhPreview::handleMouseUp(S32 x, S32 y, MASK mask)
{
- gFocusMgr.setMouseCapture(FALSE);
- gViewerWindow->showCursor();
- return LLFloater::handleMouseUp(x, y, mask);
+ gFocusMgr.setMouseCapture(FALSE);
+ gViewerWindow->showCursor();
+ return LLFloater::handleMouseUp(x, y, mask);
}
//-----------------------------------------------------------------------------
@@ -501,54 +501,54 @@ BOOL LLFloaterBvhPreview::handleMouseUp(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
BOOL LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask)
{
- MASK local_mask = mask & ~MASK_ALT;
-
- if (mAnimPreview && hasMouseCapture())
- {
- if (local_mask == MASK_PAN)
- {
- // pan here
- mAnimPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f);
- }
- else if (local_mask == MASK_ORBIT)
- {
- F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
- F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f;
-
- mAnimPreview->rotate(yaw_radians, pitch_radians);
- }
- else
- {
- F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
- F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f;
-
- mAnimPreview->rotate(yaw_radians, 0.f);
- mAnimPreview->zoom(zoom_amt);
- }
-
- mAnimPreview->requestUpdate();
-
- LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY);
- }
-
- if (!mPreviewRect.pointInRect(x, y) || !mAnimPreview)
- {
- return LLFloater::handleHover(x, y, mask);
- }
- else if (local_mask == MASK_ORBIT)
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA);
- }
- else if (local_mask == MASK_PAN)
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLPAN);
- }
- else
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
- }
-
- return TRUE;
+ MASK local_mask = mask & ~MASK_ALT;
+
+ if (mAnimPreview && hasMouseCapture())
+ {
+ if (local_mask == MASK_PAN)
+ {
+ // pan here
+ mAnimPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f);
+ }
+ else if (local_mask == MASK_ORBIT)
+ {
+ F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
+ F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f;
+
+ mAnimPreview->rotate(yaw_radians, pitch_radians);
+ }
+ else
+ {
+ F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
+ F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f;
+
+ mAnimPreview->rotate(yaw_radians, 0.f);
+ mAnimPreview->zoom(zoom_amt);
+ }
+
+ mAnimPreview->requestUpdate();
+
+ LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY);
+ }
+
+ if (!mPreviewRect.pointInRect(x, y) || !mAnimPreview)
+ {
+ return LLFloater::handleHover(x, y, mask);
+ }
+ else if (local_mask == MASK_ORBIT)
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA);
+ }
+ else if (local_mask == MASK_PAN)
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLPAN);
+ }
+ else
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
+ }
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -556,13 +556,13 @@ BOOL LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
BOOL LLFloaterBvhPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
- if (!mAnimPreview)
- return false;
+ if (!mAnimPreview)
+ return false;
- mAnimPreview->zoom((F32)clicks * -0.2f);
- mAnimPreview->requestUpdate();
+ mAnimPreview->zoom((F32)clicks * -0.2f);
+ mAnimPreview->requestUpdate();
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -570,7 +570,7 @@ BOOL LLFloaterBvhPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onMouseCaptureLost()
{
- gViewerWindow->showCursor();
+ gViewerWindow->showCursor();
}
//-----------------------------------------------------------------------------
@@ -578,23 +578,23 @@ void LLFloaterBvhPreview::onMouseCaptureLost()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onBtnPlay()
{
- if (!getEnabled())
- return;
-
- if (mMotionID.notNull() && mAnimPreview)
- {
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
-
- if (!avatarp->isMotionActive(mMotionID))
- {
- resetMotion();
- mPauseRequest = NULL;
- }
- else if (avatarp->areAnimationsPaused())
- {
- mPauseRequest = NULL;
- }
- }
+ if (!getEnabled())
+ return;
+
+ if (mMotionID.notNull() && mAnimPreview)
+ {
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+
+ if (!avatarp->isMotionActive(mMotionID))
+ {
+ resetMotion();
+ mPauseRequest = NULL;
+ }
+ else if (avatarp->areAnimationsPaused())
+ {
+ mPauseRequest = NULL;
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -602,21 +602,21 @@ void LLFloaterBvhPreview::onBtnPlay()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onBtnPause()
{
- if (!getEnabled())
- return;
-
- if (mMotionID.notNull() && mAnimPreview)
- {
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
-
- if (avatarp->isMotionActive(mMotionID))
- {
- if (!avatarp->areAnimationsPaused())
- {
- mPauseRequest = avatarp->requestPause();
- }
- }
- }
+ if (!getEnabled())
+ return;
+
+ if (mMotionID.notNull() && mAnimPreview)
+ {
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+
+ if (avatarp->isMotionActive(mMotionID))
+ {
+ if (!avatarp->areAnimationsPaused())
+ {
+ mPauseRequest = avatarp->requestPause();
+ }
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -624,15 +624,15 @@ void LLFloaterBvhPreview::onBtnPause()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onBtnStop()
{
- if (!getEnabled())
- return;
-
- if (mMotionID.notNull() && mAnimPreview)
- {
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- resetMotion();
- mPauseRequest = avatarp->requestPause();
- }
+ if (!getEnabled())
+ return;
+
+ if (mMotionID.notNull() && mAnimPreview)
+ {
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ resetMotion();
+ mPauseRequest = avatarp->requestPause();
+ }
}
//-----------------------------------------------------------------------------
@@ -640,23 +640,23 @@ void LLFloaterBvhPreview::onBtnStop()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onSliderMove()
{
- if (!getEnabled())
- return;
-
- if (mAnimPreview)
- {
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- F32 slider_value = (F32)getChild<LLUICtrl>("playback_slider")->getValue().asReal();
- LLUUID base_id = mIDList[getChild<LLUICtrl>("preview_base_anim")->getValue().asString()];
- LLMotion* motionp = avatarp->findMotion(mMotionID);
- F32 duration = motionp->getDuration();// + motionp->getEaseOutDuration();
- F32 delta_time = duration * slider_value;
- avatarp->deactivateAllMotions();
- avatarp->startMotion(base_id, delta_time + BASE_ANIM_TIME_OFFSET);
- avatarp->startMotion(mMotionID, delta_time);
- mPauseRequest = avatarp->requestPause();
- refresh();
- }
+ if (!getEnabled())
+ return;
+
+ if (mAnimPreview)
+ {
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ F32 slider_value = (F32)getChild<LLUICtrl>("playback_slider")->getValue().asReal();
+ LLUUID base_id = mIDList[getChild<LLUICtrl>("preview_base_anim")->getValue().asString()];
+ LLMotion* motionp = avatarp->findMotion(mMotionID);
+ F32 duration = motionp->getDuration();// + motionp->getEaseOutDuration();
+ F32 delta_time = duration * slider_value;
+ avatarp->deactivateAllMotions();
+ avatarp->startMotion(base_id, delta_time + BASE_ANIM_TIME_OFFSET);
+ avatarp->startMotion(mMotionID, delta_time);
+ mPauseRequest = avatarp->requestPause();
+ refresh();
+ }
}
@@ -665,28 +665,28 @@ void LLFloaterBvhPreview::onSliderMove()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitBaseAnim()
{
- if (!getEnabled())
- return;
+ if (!getEnabled())
+ return;
- if (mAnimPreview)
- {
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ if (mAnimPreview)
+ {
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- BOOL paused = avatarp->areAnimationsPaused();
+ BOOL paused = avatarp->areAnimationsPaused();
- // stop all other possible base motions
- avatarp->stopMotion(mIDList["Standing"], TRUE);
- avatarp->stopMotion(mIDList["Walking"], TRUE);
- avatarp->stopMotion(mIDList["Sitting"], TRUE);
- avatarp->stopMotion(mIDList["Flying"], TRUE);
+ // stop all other possible base motions
+ avatarp->stopMotion(mIDList["Standing"], TRUE);
+ avatarp->stopMotion(mIDList["Walking"], TRUE);
+ avatarp->stopMotion(mIDList["Sitting"], TRUE);
+ avatarp->stopMotion(mIDList["Flying"], TRUE);
- resetMotion();
+ resetMotion();
- if (!paused)
- {
- mPauseRequest = NULL;
- }
- }
+ if (!paused)
+ {
+ mPauseRequest = NULL;
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -694,18 +694,18 @@ void LLFloaterBvhPreview::onCommitBaseAnim()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitLoop()
{
- if (!getEnabled() || !mAnimPreview)
- return;
-
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
-
- if (motionp)
- {
- motionp->setLoop(getChild<LLUICtrl>("loop_check")->getValue().asBoolean());
- motionp->setLoopIn((F32)getChild<LLUICtrl>("loop_in_point")->getValue().asReal() * 0.01f * motionp->getDuration());
- motionp->setLoopOut((F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration());
- }
+ if (!getEnabled() || !mAnimPreview)
+ return;
+
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+
+ if (motionp)
+ {
+ motionp->setLoop(getChild<LLUICtrl>("loop_check")->getValue().asBoolean());
+ motionp->setLoopIn((F32)getChild<LLUICtrl>("loop_in_point")->getValue().asReal() * 0.01f * motionp->getDuration());
+ motionp->setLoopOut((F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration());
+ }
}
//-----------------------------------------------------------------------------
@@ -713,19 +713,19 @@ void LLFloaterBvhPreview::onCommitLoop()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitLoopIn()
{
- if (!getEnabled() || !mAnimPreview)
- return;
-
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
-
- if (motionp)
- {
- motionp->setLoopIn((F32)getChild<LLUICtrl>("loop_in_point")->getValue().asReal() / 100.f);
- resetMotion();
- getChild<LLUICtrl>("loop_check")->setValue(LLSD(TRUE));
- onCommitLoop();
- }
+ if (!getEnabled() || !mAnimPreview)
+ return;
+
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+
+ if (motionp)
+ {
+ motionp->setLoopIn((F32)getChild<LLUICtrl>("loop_in_point")->getValue().asReal() / 100.f);
+ resetMotion();
+ getChild<LLUICtrl>("loop_check")->setValue(LLSD(TRUE));
+ onCommitLoop();
+ }
}
//-----------------------------------------------------------------------------
@@ -733,19 +733,19 @@ void LLFloaterBvhPreview::onCommitLoopIn()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitLoopOut()
{
- if (!getEnabled() || !mAnimPreview)
- return;
-
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
-
- if (motionp)
- {
- motionp->setLoopOut((F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration());
- resetMotion();
- getChild<LLUICtrl>("loop_check")->setValue(LLSD(TRUE));
- onCommitLoop();
- }
+ if (!getEnabled() || !mAnimPreview)
+ return;
+
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+
+ if (motionp)
+ {
+ motionp->setLoopOut((F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration());
+ resetMotion();
+ getChild<LLUICtrl>("loop_check")->setValue(LLSD(TRUE));
+ onCommitLoop();
+ }
}
//-----------------------------------------------------------------------------
@@ -753,18 +753,18 @@ void LLFloaterBvhPreview::onCommitLoopOut()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitName()
{
- if (!getEnabled() || !mAnimPreview)
- return;
+ if (!getEnabled() || !mAnimPreview)
+ return;
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
- if (motionp)
- {
- motionp->setName(getChild<LLUICtrl>("name_form")->getValue().asString());
- }
+ if (motionp)
+ {
+ motionp->setName(getChild<LLUICtrl>("name_form")->getValue().asString());
+ }
- doCommit();
+ doCommit();
}
//-----------------------------------------------------------------------------
@@ -772,10 +772,10 @@ void LLFloaterBvhPreview::onCommitName()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitHandPose()
{
- if (!getEnabled())
- return;
+ if (!getEnabled())
+ return;
- resetMotion(); // sets hand pose
+ resetMotion(); // sets hand pose
}
//-----------------------------------------------------------------------------
@@ -783,10 +783,10 @@ void LLFloaterBvhPreview::onCommitHandPose()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitEmote()
{
- if (!getEnabled())
- return;
+ if (!getEnabled())
+ return;
- resetMotion(); // ssts emote
+ resetMotion(); // ssts emote
}
//-----------------------------------------------------------------------------
@@ -794,13 +794,13 @@ void LLFloaterBvhPreview::onCommitEmote()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitPriority()
{
- if (!getEnabled() || !mAnimPreview)
- return;
+ if (!getEnabled() || !mAnimPreview)
+ return;
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
- motionp->setPriority(llfloor((F32)getChild<LLUICtrl>("priority")->getValue().asReal()));
+ motionp->setPriority(llfloor((F32)getChild<LLUICtrl>("priority")->getValue().asReal()));
}
//-----------------------------------------------------------------------------
@@ -808,14 +808,14 @@ void LLFloaterBvhPreview::onCommitPriority()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitEaseIn()
{
- if (!getEnabled() || !mAnimPreview)
- return;
+ if (!getEnabled() || !mAnimPreview)
+ return;
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
- motionp->setEaseIn((F32)getChild<LLUICtrl>("ease_in_time")->getValue().asReal());
- resetMotion();
+ motionp->setEaseIn((F32)getChild<LLUICtrl>("ease_in_time")->getValue().asReal());
+ resetMotion();
}
//-----------------------------------------------------------------------------
@@ -823,14 +823,14 @@ void LLFloaterBvhPreview::onCommitEaseIn()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onCommitEaseOut()
{
- if (!getEnabled() || !mAnimPreview)
- return;
+ if (!getEnabled() || !mAnimPreview)
+ return;
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
- motionp->setEaseOut((F32)getChild<LLUICtrl>("ease_out_time")->getValue().asReal());
- resetMotion();
+ motionp->setEaseOut((F32)getChild<LLUICtrl>("ease_out_time")->getValue().asReal());
+ resetMotion();
}
//-----------------------------------------------------------------------------
@@ -838,19 +838,19 @@ void LLFloaterBvhPreview::onCommitEaseOut()
//-----------------------------------------------------------------------------
bool LLFloaterBvhPreview::validateEaseIn(const LLSD& data)
{
- if (!getEnabled() || !mAnimPreview)
- return false;
-
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
-
- if (!motionp->getLoop())
- {
- F32 new_ease_in = llclamp((F32)getChild<LLUICtrl>("ease_in_time")->getValue().asReal(), 0.f, motionp->getDuration() - motionp->getEaseOutDuration());
- getChild<LLUICtrl>("ease_in_time")->setValue(LLSD(new_ease_in));
- }
-
- return true;
+ if (!getEnabled() || !mAnimPreview)
+ return false;
+
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+
+ if (!motionp->getLoop())
+ {
+ F32 new_ease_in = llclamp((F32)getChild<LLUICtrl>("ease_in_time")->getValue().asReal(), 0.f, motionp->getDuration() - motionp->getEaseOutDuration());
+ getChild<LLUICtrl>("ease_in_time")->setValue(LLSD(new_ease_in));
+ }
+
+ return true;
}
//-----------------------------------------------------------------------------
@@ -858,19 +858,19 @@ bool LLFloaterBvhPreview::validateEaseIn(const LLSD& data)
//-----------------------------------------------------------------------------
bool LLFloaterBvhPreview::validateEaseOut(const LLSD& data)
{
- if (!getEnabled() || !mAnimPreview)
- return false;
-
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
-
- if (!motionp->getLoop())
- {
- F32 new_ease_out = llclamp((F32)getChild<LLUICtrl>("ease_out_time")->getValue().asReal(), 0.f, motionp->getDuration() - motionp->getEaseInDuration());
- getChild<LLUICtrl>("ease_out_time")->setValue(LLSD(new_ease_out));
- }
-
- return true;
+ if (!getEnabled() || !mAnimPreview)
+ return false;
+
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+
+ if (!motionp->getLoop())
+ {
+ F32 new_ease_out = llclamp((F32)getChild<LLUICtrl>("ease_out_time")->getValue().asReal(), 0.f, motionp->getDuration() - motionp->getEaseInDuration());
+ getChild<LLUICtrl>("ease_out_time")->setValue(LLSD(new_ease_out));
+ }
+
+ return true;
}
//-----------------------------------------------------------------------------
@@ -878,27 +878,27 @@ bool LLFloaterBvhPreview::validateEaseOut(const LLSD& data)
//-----------------------------------------------------------------------------
bool LLFloaterBvhPreview::validateLoopIn(const LLSD& data)
{
- if (!getEnabled())
- return false;
-
- F32 loop_in_value = (F32)getChild<LLUICtrl>("loop_in_point")->getValue().asReal();
- F32 loop_out_value = (F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal();
-
- if (loop_in_value < 0.f)
- {
- loop_in_value = 0.f;
- }
- else if (loop_in_value > 100.f)
- {
- loop_in_value = 100.f;
- }
- else if (loop_in_value > loop_out_value)
- {
- loop_in_value = loop_out_value;
- }
-
- getChild<LLUICtrl>("loop_in_point")->setValue(LLSD(loop_in_value));
- return true;
+ if (!getEnabled())
+ return false;
+
+ F32 loop_in_value = (F32)getChild<LLUICtrl>("loop_in_point")->getValue().asReal();
+ F32 loop_out_value = (F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal();
+
+ if (loop_in_value < 0.f)
+ {
+ loop_in_value = 0.f;
+ }
+ else if (loop_in_value > 100.f)
+ {
+ loop_in_value = 100.f;
+ }
+ else if (loop_in_value > loop_out_value)
+ {
+ loop_in_value = loop_out_value;
+ }
+
+ getChild<LLUICtrl>("loop_in_point")->setValue(LLSD(loop_in_value));
+ return true;
}
//-----------------------------------------------------------------------------
@@ -906,27 +906,27 @@ bool LLFloaterBvhPreview::validateLoopIn(const LLSD& data)
//-----------------------------------------------------------------------------
bool LLFloaterBvhPreview::validateLoopOut(const LLSD& data)
{
- if (!getEnabled())
- return false;
-
- F32 loop_out_value = (F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal();
- F32 loop_in_value = (F32)getChild<LLUICtrl>("loop_in_point")->getValue().asReal();
-
- if (loop_out_value < 0.f)
- {
- loop_out_value = 0.f;
- }
- else if (loop_out_value > 100.f)
- {
- loop_out_value = 100.f;
- }
- else if (loop_out_value < loop_in_value)
- {
- loop_out_value = loop_in_value;
- }
-
- getChild<LLUICtrl>("loop_out_point")->setValue(LLSD(loop_out_value));
- return true;
+ if (!getEnabled())
+ return false;
+
+ F32 loop_out_value = (F32)getChild<LLUICtrl>("loop_out_point")->getValue().asReal();
+ F32 loop_in_value = (F32)getChild<LLUICtrl>("loop_in_point")->getValue().asReal();
+
+ if (loop_out_value < 0.f)
+ {
+ loop_out_value = 0.f;
+ }
+ else if (loop_out_value > 100.f)
+ {
+ loop_out_value = 100.f;
+ }
+ else if (loop_out_value < loop_in_value)
+ {
+ loop_out_value = loop_in_value;
+ }
+
+ getChild<LLUICtrl>("loop_out_point")->setValue(LLSD(loop_out_value));
+ return true;
}
@@ -935,48 +935,48 @@ bool LLFloaterBvhPreview::validateLoopOut(const LLSD& data)
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::refresh()
{
- // Are we showing the play button (default) or the pause button?
- bool show_play = true;
- if (!mAnimPreview)
- {
- getChildView("bad_animation_text")->setVisible(TRUE);
- // play button visible but disabled
- mPlayButton->setEnabled(FALSE);
- mStopButton->setEnabled(FALSE);
- getChildView("ok_btn")->setEnabled(FALSE);
- }
- else
- {
- getChildView("bad_animation_text")->setVisible(FALSE);
- // re-enabled in case previous animation was bad
- mPlayButton->setEnabled(TRUE);
- mStopButton->setEnabled(TRUE);
- LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
- if (avatarp->isMotionActive(mMotionID))
- {
- mStopButton->setEnabled(TRUE);
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
- if (!avatarp->areAnimationsPaused())
- {
- // animation is playing
- if (motionp)
- {
- F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration();
- getChild<LLUICtrl>("playback_slider")->setValue(fraction_complete);
- }
- show_play = false;
- }
- }
- else
- {
- // Motion just finished playing
- mPauseRequest = avatarp->requestPause();
- }
- getChildView("ok_btn")->setEnabled(TRUE);
- mAnimPreview->requestUpdate();
- }
- mPlayButton->setVisible(show_play);
- mPauseButton->setVisible(!show_play);
+ // Are we showing the play button (default) or the pause button?
+ bool show_play = true;
+ if (!mAnimPreview)
+ {
+ getChildView("bad_animation_text")->setVisible(TRUE);
+ // play button visible but disabled
+ mPlayButton->setEnabled(FALSE);
+ mStopButton->setEnabled(FALSE);
+ getChildView("ok_btn")->setEnabled(FALSE);
+ }
+ else
+ {
+ getChildView("bad_animation_text")->setVisible(FALSE);
+ // re-enabled in case previous animation was bad
+ mPlayButton->setEnabled(TRUE);
+ mStopButton->setEnabled(TRUE);
+ LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
+ if (avatarp->isMotionActive(mMotionID))
+ {
+ mStopButton->setEnabled(TRUE);
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
+ if (!avatarp->areAnimationsPaused())
+ {
+ // animation is playing
+ if (motionp)
+ {
+ F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration();
+ getChild<LLUICtrl>("playback_slider")->setValue(fraction_complete);
+ }
+ show_play = false;
+ }
+ }
+ else
+ {
+ // Motion just finished playing
+ mPauseRequest = avatarp->requestPause();
+ }
+ getChildView("ok_btn")->setEnabled(TRUE);
+ mAnimPreview->requestUpdate();
+ }
+ mPlayButton->setVisible(show_play);
+ mPauseButton->setVisible(!show_play);
}
//-----------------------------------------------------------------------------
@@ -984,53 +984,53 @@ void LLFloaterBvhPreview::refresh()
//-----------------------------------------------------------------------------
void LLFloaterBvhPreview::onBtnOK(void* userdata)
{
- LLFloaterBvhPreview* floaterp = (LLFloaterBvhPreview*)userdata;
- if (!floaterp->getEnabled()) return;
+ LLFloaterBvhPreview* floaterp = (LLFloaterBvhPreview*)userdata;
+ if (!floaterp->getEnabled()) return;
- if (floaterp->mAnimPreview)
- {
- LLKeyframeMotion* motionp = (LLKeyframeMotion*)floaterp->mAnimPreview->getDummyAvatar()->findMotion(floaterp->mMotionID);
+ if (floaterp->mAnimPreview)
+ {
+ LLKeyframeMotion* motionp = (LLKeyframeMotion*)floaterp->mAnimPreview->getDummyAvatar()->findMotion(floaterp->mMotionID);
- S32 file_size = motionp->getFileSize();
- U8* buffer = new U8[file_size];
+ S32 file_size = motionp->getFileSize();
+ U8* buffer = new U8[file_size];
- LLDataPackerBinaryBuffer dp(buffer, file_size);
- if (motionp->serialize(dp))
- {
- LLFileSystem file(motionp->getID(), LLAssetType::AT_ANIMATION, LLFileSystem::APPEND);
+ LLDataPackerBinaryBuffer dp(buffer, file_size);
+ if (motionp->serialize(dp))
+ {
+ LLFileSystem file(motionp->getID(), LLAssetType::AT_ANIMATION, LLFileSystem::APPEND);
- S32 size = dp.getCurrentSize();
- if (file.write((U8*)buffer, size))
- {
- std::string name = floaterp->getChild<LLUICtrl>("name_form")->getValue().asString();
- std::string desc = floaterp->getChild<LLUICtrl>("description_form")->getValue().asString();
- S32 expected_upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost();
+ S32 size = dp.getCurrentSize();
+ if (file.write((U8*)buffer, size))
+ {
+ std::string name = floaterp->getChild<LLUICtrl>("name_form")->getValue().asString();
+ std::string desc = floaterp->getChild<LLUICtrl>("description_form")->getValue().asString();
+ S32 expected_upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost();
LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo(
floaterp->mTransactionID, LLAssetType::AT_ANIMATION,
name, desc, 0,
LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION,
LLFloaterPerms::getNextOwnerPerms("Uploads"),
- LLFloaterPerms::getGroupPerms("Uploads"),
- LLFloaterPerms::getEveryonePerms("Uploads"),
+ LLFloaterPerms::getGroupPerms("Uploads"),
+ LLFloaterPerms::getEveryonePerms("Uploads"),
expected_upload_cost));
upload_new_resource(assetUploadInfo);
- }
- else
- {
- LL_WARNS() << "Failure writing animation data." << LL_ENDL;
- LLNotificationsUtil::add("WriteAnimationFail");
- }
- }
-
- delete [] buffer;
- // clear out cache for motion data
- floaterp->mAnimPreview->getDummyAvatar()->removeMotion(floaterp->mMotionID);
- LLKeyframeDataCache::removeKeyframeData(floaterp->mMotionID);
- }
-
- floaterp->closeFloater(false);
+ }
+ else
+ {
+ LL_WARNS() << "Failure writing animation data." << LL_ENDL;
+ LLNotificationsUtil::add("WriteAnimationFail");
+ }
+ }
+
+ delete [] buffer;
+ // clear out cache for motion data
+ floaterp->mAnimPreview->getDummyAvatar()->removeMotion(floaterp->mMotionID);
+ LLKeyframeDataCache::removeKeyframeData(floaterp->mMotionID);
+ }
+
+ floaterp->closeFloater(false);
}
//-----------------------------------------------------------------------------
@@ -1038,15 +1038,15 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata)
//-----------------------------------------------------------------------------
LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
{
- mNeedsUpdate = TRUE;
- mCameraDistance = PREVIEW_CAMERA_DISTANCE;
- mCameraYaw = 0.f;
- mCameraPitch = 0.f;
- mCameraZoom = 1.f;
+ mNeedsUpdate = TRUE;
+ mCameraDistance = PREVIEW_CAMERA_DISTANCE;
+ mCameraYaw = 0.f;
+ mCameraPitch = 0.f;
+ mCameraZoom = 1.f;
- mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), LLViewerObject::CO_FLAG_UI_AVATAR);
- mDummyAvatar->mSpecialRenderMode = 1;
- mDummyAvatar->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET);
+ mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), LLViewerObject::CO_FLAG_UI_AVATAR);
+ mDummyAvatar->mSpecialRenderMode = 1;
+ mDummyAvatar->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET);
// on idle overall apperance update will set skirt to visible, so either
// call early or account for mSpecialRenderMode in updateMeshVisibility
@@ -1054,11 +1054,11 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicT
mDummyAvatar->hideHair();
mDummyAvatar->hideSkirt();
- // stop extraneous animations
- mDummyAvatar->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE );
- mDummyAvatar->stopMotion( ANIM_AGENT_EYE, TRUE );
- mDummyAvatar->stopMotion( ANIM_AGENT_BODY_NOISE, TRUE );
- mDummyAvatar->stopMotion( ANIM_AGENT_BREATHE_ROT, TRUE );
+ // stop extraneous animations
+ mDummyAvatar->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE );
+ mDummyAvatar->stopMotion( ANIM_AGENT_EYE, TRUE );
+ mDummyAvatar->stopMotion( ANIM_AGENT_BODY_NOISE, TRUE );
+ mDummyAvatar->stopMotion( ANIM_AGENT_BREATHE_ROT, TRUE );
}
//-----------------------------------------------------------------------------
@@ -1066,94 +1066,94 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicT
//-----------------------------------------------------------------------------
LLPreviewAnimation::~LLPreviewAnimation()
{
- mDummyAvatar->markDead();
+ mDummyAvatar->markDead();
}
//virtual
S8 LLPreviewAnimation::getType() const
{
- return LLViewerDynamicTexture::LL_PREVIEW_ANIMATION ;
+ return LLViewerDynamicTexture::LL_PREVIEW_ANIMATION ;
}
//-----------------------------------------------------------------------------
// update()
//-----------------------------------------------------------------------------
-BOOL LLPreviewAnimation::render()
+BOOL LLPreviewAnimation::render()
{
- mNeedsUpdate = FALSE;
- LLVOAvatar* avatarp = mDummyAvatar;
-
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadIdentity();
- gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+ mNeedsUpdate = FALSE;
+ LLVOAvatar* avatarp = mDummyAvatar;
+
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
- gUIProgram.bind();
+ gUIProgram.bind();
- LLGLSUIDefault def;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
+ LLGLSUIDefault def;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
- gl_rect_2d_simple( mFullWidth, mFullHeight );
+ gl_rect_2d_simple( mFullWidth, mFullHeight );
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
- gGL.flush();
+ gGL.flush();
- LLVector3 target_pos = avatarp->mRoot->getWorldPosition();
+ LLVector3 target_pos = avatarp->mRoot->getWorldPosition();
- LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
- LLQuaternion(mCameraYaw, LLVector3::z_axis);
+ LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
+ LLQuaternion(mCameraYaw, LLVector3::z_axis);
LLViewerCamera* camera = LLViewerCamera::getInstance();
- LLQuaternion av_rot = avatarp->mRoot->getWorldRotation() * camera_rot;
- camera->setOriginAndLookAt(
- target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera
- LLVector3::z_axis, // up
- target_pos + (mCameraOffset * av_rot) ); // point of interest
+ LLQuaternion av_rot = avatarp->mRoot->getWorldRotation() * camera_rot;
+ camera->setOriginAndLookAt(
+ target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera
+ LLVector3::z_axis, // up
+ target_pos + (mCameraOffset * av_rot) ); // point of interest
- camera->setViewNoBroadcast(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
+ camera->setViewNoBroadcast(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
camera->setAspect((F32) mFullWidth / (F32) mFullHeight);
- camera->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
-
- //SJB: Animation is updated in LLVOAvatar::updateCharacter
-
- if (avatarp->mDrawable.notNull())
- {
- avatarp->updateLOD();
-
- LLVertexBuffer::unbind();
- LLGLDepthTest gls_depth(GL_TRUE);
-
- LLFace* face = avatarp->mDrawable->getFace(0);
- if (face)
- {
- LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)face->getPool();
- avatarp->dirtyMesh();
+ camera->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
+
+ //SJB: Animation is updated in LLVOAvatar::updateCharacter
+
+ if (avatarp->mDrawable.notNull())
+ {
+ avatarp->updateLOD();
+
+ LLVertexBuffer::unbind();
+ LLGLDepthTest gls_depth(GL_TRUE);
+
+ LLFace* face = avatarp->mDrawable->getFace(0);
+ if (face)
+ {
+ LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)face->getPool();
+ avatarp->dirtyMesh();
gPipeline.enableLightsPreview();
- avatarPoolp->renderAvatars(avatarp); // renders only one avatar
- }
- }
+ avatarPoolp->renderAvatars(avatarp); // renders only one avatar
+ }
+ }
- gGL.color4f(1,1,1,1);
- return TRUE;
+ gGL.color4f(1,1,1,1);
+ return TRUE;
}
//-----------------------------------------------------------------------------
// requestUpdate()
//-----------------------------------------------------------------------------
void LLPreviewAnimation::requestUpdate()
-{
- mNeedsUpdate = TRUE;
+{
+ mNeedsUpdate = TRUE;
}
//-----------------------------------------------------------------------------
@@ -1161,9 +1161,9 @@ void LLPreviewAnimation::requestUpdate()
//-----------------------------------------------------------------------------
void LLPreviewAnimation::rotate(F32 yaw_radians, F32 pitch_radians)
{
- mCameraYaw = mCameraYaw + yaw_radians;
+ mCameraYaw = mCameraYaw + yaw_radians;
- mCameraPitch = llclamp(mCameraPitch + pitch_radians, F_PI_BY_TWO * -0.8f, F_PI_BY_TWO * 0.8f);
+ mCameraPitch = llclamp(mCameraPitch + pitch_radians, F_PI_BY_TWO * -0.8f, F_PI_BY_TWO * 0.8f);
}
//-----------------------------------------------------------------------------
@@ -1171,7 +1171,7 @@ void LLPreviewAnimation::rotate(F32 yaw_radians, F32 pitch_radians)
//-----------------------------------------------------------------------------
void LLPreviewAnimation::zoom(F32 zoom_delta)
{
- setZoom(mCameraZoom + zoom_delta);
+ setZoom(mCameraZoom + zoom_delta);
}
//-----------------------------------------------------------------------------
@@ -1179,7 +1179,7 @@ void LLPreviewAnimation::zoom(F32 zoom_delta)
//-----------------------------------------------------------------------------
void LLPreviewAnimation::setZoom(F32 zoom_amt)
{
- mCameraZoom = llclamp(zoom_amt, MIN_CAMERA_ZOOM, MAX_CAMERA_ZOOM);
+ mCameraZoom = llclamp(zoom_amt, MIN_CAMERA_ZOOM, MAX_CAMERA_ZOOM);
}
//-----------------------------------------------------------------------------
@@ -1187,8 +1187,8 @@ void LLPreviewAnimation::setZoom(F32 zoom_amt)
//-----------------------------------------------------------------------------
void LLPreviewAnimation::pan(F32 right, F32 up)
{
- mCameraOffset.mV[VY] = llclamp(mCameraOffset.mV[VY] + right * mCameraDistance / mCameraZoom, -1.f, 1.f);
- mCameraOffset.mV[VZ] = llclamp(mCameraOffset.mV[VZ] + up * mCameraDistance / mCameraZoom, -1.f, 1.f);
+ mCameraOffset.mV[VY] = llclamp(mCameraOffset.mV[VY] + right * mCameraDistance / mCameraZoom, -1.f, 1.f);
+ mCameraOffset.mV[VZ] = llclamp(mCameraOffset.mV[VZ] + up * mCameraDistance / mCameraZoom, -1.f, 1.f);
}
diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h
index 9dfefc5a5f..9de74c39cd 100644
--- a/indra/newview/llfloaterbvhpreview.h
+++ b/indra/newview/llfloaterbvhpreview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterbvhpreview.h
* @brief LLFloaterBvhPreview class definition
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,94 +40,94 @@ class LLViewerJointMesh;
class LLPreviewAnimation : public LLViewerDynamicTexture
{
protected:
- virtual ~LLPreviewAnimation();
+ virtual ~LLPreviewAnimation();
public:
- LLPreviewAnimation(S32 width, S32 height);
+ LLPreviewAnimation(S32 width, S32 height);
- /*virtual*/ S8 getType() const ;
+ /*virtual*/ S8 getType() const ;
- BOOL render();
- void requestUpdate();
- void rotate(F32 yaw_radians, F32 pitch_radians);
- void zoom(F32 zoom_delta);
- void setZoom(F32 zoom_amt);
- void pan(F32 right, F32 up);
- virtual BOOL needsUpdate() { return mNeedsUpdate; }
+ BOOL render();
+ void requestUpdate();
+ void rotate(F32 yaw_radians, F32 pitch_radians);
+ void zoom(F32 zoom_delta);
+ void setZoom(F32 zoom_amt);
+ void pan(F32 right, F32 up);
+ virtual BOOL needsUpdate() { return mNeedsUpdate; }
- LLVOAvatar* getDummyAvatar() { return mDummyAvatar; }
+ LLVOAvatar* getDummyAvatar() { return mDummyAvatar; }
protected:
- BOOL mNeedsUpdate;
- F32 mCameraDistance;
- F32 mCameraYaw;
- F32 mCameraPitch;
- F32 mCameraZoom;
- LLVector3 mCameraOffset;
- LLPointer<LLVOAvatar> mDummyAvatar;
+ BOOL mNeedsUpdate;
+ F32 mCameraDistance;
+ F32 mCameraYaw;
+ F32 mCameraPitch;
+ F32 mCameraZoom;
+ LLVector3 mCameraOffset;
+ LLPointer<LLVOAvatar> mDummyAvatar;
};
class LLFloaterBvhPreview : public LLFloaterNameDesc
{
public:
- LLFloaterBvhPreview(const std::string& filename);
- virtual ~LLFloaterBvhPreview();
-
- BOOL postBuild();
-
- BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- BOOL handleHover(S32 x, S32 y, MASK mask);
- BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
- void onMouseCaptureLost();
-
- void refresh();
-
- void onBtnPlay();
- void onBtnPause();
- void onBtnStop();
- void onSliderMove();
- void onCommitBaseAnim();
- void onCommitLoop();
- void onCommitLoopIn();
- void onCommitLoopOut();
- bool validateLoopIn(const LLSD& data);
- bool validateLoopOut(const LLSD& data);
- void onCommitName();
- void onCommitHandPose();
- void onCommitEmote();
- void onCommitPriority();
- void onCommitEaseIn();
- void onCommitEaseOut();
- bool validateEaseIn(const LLSD& data);
- bool validateEaseOut(const LLSD& data);
- static void onBtnOK(void*);
- static void onSaveComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data,
- S32 status, LLExtStat ext_status);
+ LLFloaterBvhPreview(const std::string& filename);
+ virtual ~LLFloaterBvhPreview();
+
+ BOOL postBuild();
+
+ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ BOOL handleHover(S32 x, S32 y, MASK mask);
+ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+ void onMouseCaptureLost();
+
+ void refresh();
+
+ void onBtnPlay();
+ void onBtnPause();
+ void onBtnStop();
+ void onSliderMove();
+ void onCommitBaseAnim();
+ void onCommitLoop();
+ void onCommitLoopIn();
+ void onCommitLoopOut();
+ bool validateLoopIn(const LLSD& data);
+ bool validateLoopOut(const LLSD& data);
+ void onCommitName();
+ void onCommitHandPose();
+ void onCommitEmote();
+ void onCommitPriority();
+ void onCommitEaseIn();
+ void onCommitEaseOut();
+ bool validateEaseIn(const LLSD& data);
+ bool validateEaseOut(const LLSD& data);
+ static void onBtnOK(void*);
+ static void onSaveComplete(const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ void* user_data,
+ S32 status, LLExtStat ext_status);
private:
- void setAnimCallbacks() ;
+ void setAnimCallbacks() ;
std::map <std::string, std::string> getJointAliases();
protected:
- void draw();
- void resetMotion();
-
- LLPointer< LLPreviewAnimation > mAnimPreview;
- S32 mLastMouseX;
- S32 mLastMouseY;
- LLButton* mPlayButton;
- LLButton* mPauseButton;
- LLButton* mStopButton;
- LLRect mPreviewRect;
- LLRectf mPreviewImageRect;
- LLAssetID mMotionID;
- LLTransactionID mTransactionID;
- LLAnimPauseRequest mPauseRequest;
-
- std::map<std::string, LLUUID> mIDList;
+ void draw();
+ void resetMotion();
+
+ LLPointer< LLPreviewAnimation > mAnimPreview;
+ S32 mLastMouseX;
+ S32 mLastMouseY;
+ LLButton* mPlayButton;
+ LLButton* mPauseButton;
+ LLButton* mStopButton;
+ LLRect mPreviewRect;
+ LLRectf mPreviewImageRect;
+ LLAssetID mMotionID;
+ LLTransactionID mTransactionID;
+ LLAnimPauseRequest mPauseRequest;
+
+ std::map<std::string, LLUUID> mIDList;
};
#endif // LL_LLFLOATERBVHPREVIEW_H
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index 7985ce447f..4b91ff6881 100644
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatercamera.cpp
* @brief Container for camera control buttons (zoom, pan, orbit)
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,7 +49,7 @@
static LLDefaultChildRegistry::Register<LLPanelCameraItem> r("panel_camera_item");
-const F32 NUDGE_TIME = 0.25f; // in seconds
+const F32 NUDGE_TIME = 0.25f; // in seconds
const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed
// constants
@@ -63,102 +63,102 @@ bool LLFloaterCamera::sAppearanceEditing = false;
// Zoom the camera in and out
class LLPanelCameraZoom
-: public LLPanel
+: public LLPanel
{
- LOG_CLASS(LLPanelCameraZoom);
+ LOG_CLASS(LLPanelCameraZoom);
public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params> {};
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params> {};
- LLPanelCameraZoom() { onCreate(); }
+ LLPanelCameraZoom() { onCreate(); }
- /* virtual */ BOOL postBuild();
- /* virtual */ void draw();
+ /* virtual */ BOOL postBuild();
+ /* virtual */ void draw();
protected:
- LLPanelCameraZoom(const Params& p) { onCreate(); }
+ LLPanelCameraZoom(const Params& p) { onCreate(); }
- void onCreate();
- void onZoomPlusHeldDown();
- void onZoomMinusHeldDown();
- void onSliderValueChanged();
- void onCameraTrack();
- void onCameraRotate();
- F32 getOrbitRate(F32 time);
+ void onCreate();
+ void onZoomPlusHeldDown();
+ void onZoomMinusHeldDown();
+ void onSliderValueChanged();
+ void onCameraTrack();
+ void onCameraRotate();
+ F32 getOrbitRate(F32 time);
private:
- LLButton* mPlusBtn { nullptr };
- LLButton* mMinusBtn{ nullptr };
- LLSlider* mSlider{ nullptr };
+ LLButton* mPlusBtn { nullptr };
+ LLButton* mMinusBtn{ nullptr };
+ LLSlider* mSlider{ nullptr };
- friend class LLUICtrlFactory;
+ friend class LLUICtrlFactory;
};
LLPanelCameraItem::Params::Params()
-: icon_over("icon_over"),
- icon_selected("icon_selected"),
- picture("picture"),
- text("text"),
- selected_picture("selected_picture"),
- mousedown_callback("mousedown_callback")
+: icon_over("icon_over"),
+ icon_selected("icon_selected"),
+ picture("picture"),
+ text("text"),
+ selected_picture("selected_picture"),
+ mousedown_callback("mousedown_callback")
{
}
LLPanelCameraItem::LLPanelCameraItem(const LLPanelCameraItem::Params& p)
-: LLPanel(p)
+: LLPanel(p)
{
- LLIconCtrl::Params icon_params = p.picture;
- mPicture = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
- addChild(mPicture);
+ LLIconCtrl::Params icon_params = p.picture;
+ mPicture = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+ addChild(mPicture);
- icon_params = p.icon_over;
- mIconOver = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
- addChild(mIconOver);
+ icon_params = p.icon_over;
+ mIconOver = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+ addChild(mIconOver);
- icon_params = p.icon_selected;
- mIconSelected = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
- addChild(mIconSelected);
+ icon_params = p.icon_selected;
+ mIconSelected = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+ addChild(mIconSelected);
- icon_params = p.selected_picture;
- mPictureSelected = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
- addChild(mPictureSelected);
+ icon_params = p.selected_picture;
+ mPictureSelected = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+ addChild(mPictureSelected);
- LLTextBox::Params text_params = p.text;
- mText = LLUICtrlFactory::create<LLTextBox>(text_params);
- addChild(mText);
+ LLTextBox::Params text_params = p.text;
+ mText = LLUICtrlFactory::create<LLTextBox>(text_params);
+ addChild(mText);
- if (p.mousedown_callback.isProvided())
- {
- setCommitCallback(initCommitCallback(p.mousedown_callback));
- }
+ if (p.mousedown_callback.isProvided())
+ {
+ setCommitCallback(initCommitCallback(p.mousedown_callback));
+ }
}
void set_view_visible(LLView* parent, const std::string& name, bool visible)
{
- parent->getChildView(name)->setVisible(visible);
+ parent->getChildView(name)->setVisible(visible);
}
BOOL LLPanelCameraItem::postBuild()
{
- setMouseEnterCallback(boost::bind(set_view_visible, this, "hovered_icon", true));
- setMouseLeaveCallback(boost::bind(set_view_visible, this, "hovered_icon", false));
- setMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this));
- setRightMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this));
- return TRUE;
+ setMouseEnterCallback(boost::bind(set_view_visible, this, "hovered_icon", true));
+ setMouseLeaveCallback(boost::bind(set_view_visible, this, "hovered_icon", false));
+ setMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this));
+ setRightMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this));
+ return TRUE;
}
void LLPanelCameraItem::onAnyMouseClick()
{
- if (mCommitSignal) (*mCommitSignal)(this, LLSD());
+ if (mCommitSignal) (*mCommitSignal)(this, LLSD());
}
void LLPanelCameraItem::setValue(const LLSD& value)
{
- if (!value.isMap()) return;;
- if (!value.has("selected")) return;
- getChildView("selected_icon")->setVisible( value["selected"]);
- getChildView("picture")->setVisible( !value["selected"]);
- getChildView("selected_picture")->setVisible( value["selected"]);
+ if (!value.isMap()) return;;
+ if (!value.has("selected")) return;
+ getChildView("selected_icon")->setVisible( value["selected"]);
+ getChildView("picture")->setVisible( !value["selected"]);
+ getChildView("selected_picture")->setVisible( value["selected"]);
}
static LLPanelInjector<LLPanelCameraZoom> t_camera_zoom_panel("camera_zoom_panel");
@@ -169,81 +169,81 @@ static LLPanelInjector<LLPanelCameraZoom> t_camera_zoom_panel("camera_zoom_panel
void LLPanelCameraZoom::onCreate()
{
- mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this));
- mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this));
- mCommitCallbackRegistrar.add("Slider.value_changed", boost::bind(&LLPanelCameraZoom::onSliderValueChanged, this));
- mCommitCallbackRegistrar.add("Camera.track", boost::bind(&LLPanelCameraZoom::onCameraTrack, this));
- mCommitCallbackRegistrar.add("Camera.rotate", boost::bind(&LLPanelCameraZoom::onCameraRotate, this));
+ mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this));
+ mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this));
+ mCommitCallbackRegistrar.add("Slider.value_changed", boost::bind(&LLPanelCameraZoom::onSliderValueChanged, this));
+ mCommitCallbackRegistrar.add("Camera.track", boost::bind(&LLPanelCameraZoom::onCameraTrack, this));
+ mCommitCallbackRegistrar.add("Camera.rotate", boost::bind(&LLPanelCameraZoom::onCameraRotate, this));
}
BOOL LLPanelCameraZoom::postBuild()
{
- mPlusBtn = getChild<LLButton>("zoom_plus_btn");
- mMinusBtn = getChild<LLButton>("zoom_minus_btn");
- mSlider = getChild<LLSlider>("zoom_slider");
- return LLPanel::postBuild();
+ mPlusBtn = getChild<LLButton>("zoom_plus_btn");
+ mMinusBtn = getChild<LLButton>("zoom_minus_btn");
+ mSlider = getChild<LLSlider>("zoom_slider");
+ return LLPanel::postBuild();
}
void LLPanelCameraZoom::draw()
{
- mSlider->setValue(gAgentCamera.getCameraZoomFraction());
- LLPanel::draw();
+ mSlider->setValue(gAgentCamera.getCameraZoomFraction());
+ LLPanel::draw();
}
void LLPanelCameraZoom::onZoomPlusHeldDown()
{
- F32 val = mSlider->getValueF32();
- F32 inc = mSlider->getIncrement();
- mSlider->setValue(val - inc);
- F32 time = mPlusBtn->getHeldDownTime();
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitInKey(getOrbitRate(time));
+ F32 val = mSlider->getValueF32();
+ F32 inc = mSlider->getIncrement();
+ mSlider->setValue(val - inc);
+ F32 time = mPlusBtn->getHeldDownTime();
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitInKey(getOrbitRate(time));
}
void LLPanelCameraZoom::onZoomMinusHeldDown()
{
- F32 val = mSlider->getValueF32();
- F32 inc = mSlider->getIncrement();
- mSlider->setValue(val + inc);
- F32 time = mMinusBtn->getHeldDownTime();
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitOutKey(getOrbitRate(time));
+ F32 val = mSlider->getValueF32();
+ F32 inc = mSlider->getIncrement();
+ mSlider->setValue(val + inc);
+ F32 time = mMinusBtn->getHeldDownTime();
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitOutKey(getOrbitRate(time));
}
void LLPanelCameraZoom::onCameraTrack()
{
- // EXP-202 when camera panning activated, remove the hint
- LLFirstUse::viewPopup( false );
+ // EXP-202 when camera panning activated, remove the hint
+ LLFirstUse::viewPopup( false );
}
void LLPanelCameraZoom::onCameraRotate()
{
- // EXP-202 when camera rotation activated, remove the hint
- LLFirstUse::viewPopup( false );
+ // EXP-202 when camera rotation activated, remove the hint
+ LLFirstUse::viewPopup( false );
}
F32 LLPanelCameraZoom::getOrbitRate(F32 time)
{
- if( time < NUDGE_TIME )
- {
- F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME;
- return rate;
- }
- else
- {
- return 1;
- }
+ if( time < NUDGE_TIME )
+ {
+ F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME;
+ return rate;
+ }
+ else
+ {
+ return 1;
+ }
}
void LLPanelCameraZoom::onSliderValueChanged()
{
- F32 zoom_level = mSlider->getValueF32();
- gAgentCamera.setCameraZoomFraction(zoom_level);
+ F32 zoom_level = mSlider->getValueF32();
+ gAgentCamera.setCameraZoomFraction(zoom_level);
}
void activate_camera_tool()
{
- LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
+ LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
};
class LLCameraInfoPanel : public LLPanel
@@ -321,29 +321,29 @@ private:
// static
bool LLFloaterCamera::inFreeCameraMode()
{
- LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
- if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
- {
- return true;
- }
- return false;
+ LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
+ if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
+ {
+ return true;
+ }
+ return false;
}
// static
void LLFloaterCamera::resetCameraMode()
{
- LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
- if (!floater_camera) return;
- floater_camera->switchMode(CAMERA_CTRL_MODE_PAN);
+ LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
+ if (!floater_camera) return;
+ floater_camera->switchMode(CAMERA_CTRL_MODE_PAN);
}
// static
void LLFloaterCamera::onAvatarEditingAppearance(bool editing)
{
- sAppearanceEditing = editing;
- LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
- if (!floater_camera) return;
- floater_camera->handleAvatarEditingAppearance(editing);
+ sAppearanceEditing = editing;
+ LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
+ if (!floater_camera) return;
+ floater_camera->handleAvatarEditingAppearance(editing);
}
// static
@@ -381,358 +381,358 @@ void LLFloaterCamera::handleAvatarEditingAppearance(bool editing)
void LLFloaterCamera::update()
{
- ECameraControlMode mode = determineMode();
- if (mode != mCurrMode)
- {
- setMode(mode);
- }
+ ECameraControlMode mode = determineMode();
+ if (mode != mCurrMode)
+ {
+ setMode(mode);
+ }
}
void LLFloaterCamera::toPrevMode()
{
- switchMode(mPrevMode);
+ switchMode(mPrevMode);
}
// static
void LLFloaterCamera::onLeavingMouseLook()
{
- LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
- if (floater_camera)
- {
- floater_camera->updateItemsSelection();
- if(floater_camera->inFreeCameraMode())
- {
- activate_camera_tool();
- }
- }
+ LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
+ if (floater_camera)
+ {
+ floater_camera->updateItemsSelection();
+ if(floater_camera->inFreeCameraMode())
+ {
+ activate_camera_tool();
+ }
+ }
}
LLFloaterCamera* LLFloaterCamera::findInstance()
{
- return LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera");
+ return LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera");
}
void LLFloaterCamera::onOpen(const LLSD& key)
{
- LLFirstUse::viewPopup();
+ LLFirstUse::viewPopup();
- mZoom->onOpen(key);
+ mZoom->onOpen(key);
- // Returns to previous mode, see EXT-2727(View tool should remember state).
- // In case floater was just hidden and it isn't reset the mode
- // just update state to current one. Else go to previous.
- if ( !mClosed )
- updateState();
- else
- toPrevMode();
- mClosed = FALSE;
+ // Returns to previous mode, see EXT-2727(View tool should remember state).
+ // In case floater was just hidden and it isn't reset the mode
+ // just update state to current one. Else go to previous.
+ if ( !mClosed )
+ updateState();
+ else
+ toPrevMode();
+ mClosed = FALSE;
- populatePresetCombo();
+ populatePresetCombo();
- showDebugInfo(LLView::sDebugCamera);
+ showDebugInfo(LLView::sDebugCamera);
}
void LLFloaterCamera::onClose(bool app_quitting)
{
- //We don't care of camera mode if app is quitting
- if (app_quitting)
- return;
- // It is necessary to reset mCurrMode to CAMERA_CTRL_MODE_PAN so
- // to avoid seeing an empty floater when reopening the control.
- if (mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA)
- mCurrMode = CAMERA_CTRL_MODE_PAN;
- // When mCurrMode is in CAMERA_CTRL_MODE_PAN
- // switchMode won't modify mPrevMode, so force it here.
- // It is needed to correctly return to previous mode on open, see EXT-2727.
- if (mCurrMode == CAMERA_CTRL_MODE_PAN)
- mPrevMode = CAMERA_CTRL_MODE_PAN;
+ //We don't care of camera mode if app is quitting
+ if (app_quitting)
+ return;
+ // It is necessary to reset mCurrMode to CAMERA_CTRL_MODE_PAN so
+ // to avoid seeing an empty floater when reopening the control.
+ if (mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA)
+ mCurrMode = CAMERA_CTRL_MODE_PAN;
+ // When mCurrMode is in CAMERA_CTRL_MODE_PAN
+ // switchMode won't modify mPrevMode, so force it here.
+ // It is needed to correctly return to previous mode on open, see EXT-2727.
+ if (mCurrMode == CAMERA_CTRL_MODE_PAN)
+ mPrevMode = CAMERA_CTRL_MODE_PAN;
- switchMode(CAMERA_CTRL_MODE_PAN);
- mClosed = TRUE;
+ switchMode(CAMERA_CTRL_MODE_PAN);
+ mClosed = TRUE;
- gAgent.setMovementLocked(FALSE);
+ gAgent.setMovementLocked(FALSE);
}
LLFloaterCamera::LLFloaterCamera(const LLSD& val)
-: LLFloater(val),
- mClosed(FALSE),
- mCurrMode(CAMERA_CTRL_MODE_PAN),
- mPrevMode(CAMERA_CTRL_MODE_PAN)
+: LLFloater(val),
+ mClosed(FALSE),
+ mCurrMode(CAMERA_CTRL_MODE_PAN),
+ mPrevMode(CAMERA_CTRL_MODE_PAN)
{
- LLHints::getInstance()->registerHintTarget("view_popup", getHandle());
- mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
- mCommitCallbackRegistrar.add("CameraPresets.Save", boost::bind(&LLFloaterCamera::onSavePreset, this));
- mCommitCallbackRegistrar.add("CameraPresets.ShowPresetsList", boost::bind(&LLFloaterReg::showInstance, "camera_presets", LLSD(), FALSE));
+ LLHints::getInstance()->registerHintTarget("view_popup", getHandle());
+ mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
+ mCommitCallbackRegistrar.add("CameraPresets.Save", boost::bind(&LLFloaterCamera::onSavePreset, this));
+ mCommitCallbackRegistrar.add("CameraPresets.ShowPresetsList", boost::bind(&LLFloaterReg::showInstance, "camera_presets", LLSD(), FALSE));
}
// virtual
BOOL LLFloaterCamera::postBuild()
{
- updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
+ updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
- mControls = getChild<LLPanel>("controls");
- mAgentCameraInfo = getChild<LLPanel>("agent_camera_info");
- mViewerCameraInfo = getChild<LLPanel>("viewer_camera_info");
- mRotate = getChild<LLJoystickCameraRotate>(ORBIT);
- mZoom = getChild<LLPanelCameraZoom>(ZOOM);
- mTrack = getChild<LLJoystickCameraTrack>(PAN);
- mPresetCombo = getChild<LLComboBox>("preset_combo");
- mPreciseCtrls = getChild<LLTextBox>("precise_ctrs_label");
+ mControls = getChild<LLPanel>("controls");
+ mAgentCameraInfo = getChild<LLPanel>("agent_camera_info");
+ mViewerCameraInfo = getChild<LLPanel>("viewer_camera_info");
+ mRotate = getChild<LLJoystickCameraRotate>(ORBIT);
+ mZoom = getChild<LLPanelCameraZoom>(ZOOM);
+ mTrack = getChild<LLJoystickCameraTrack>(PAN);
+ mPresetCombo = getChild<LLComboBox>("preset_combo");
+ mPreciseCtrls = getChild<LLTextBox>("precise_ctrs_label");
- mPreciseCtrls->setShowCursorHand(false);
- mPreciseCtrls->setSoundFlags(LLView::MOUSE_UP);
- mPreciseCtrls->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), FALSE));
+ mPreciseCtrls->setShowCursorHand(false);
+ mPreciseCtrls->setSoundFlags(LLView::MOUSE_UP);
+ mPreciseCtrls->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), FALSE));
- mPresetCombo->setCommitCallback(boost::bind(&LLFloaterCamera::onCustomPresetSelected, this));
- LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCamera::populatePresetCombo, this));
+ mPresetCombo->setCommitCallback(boost::bind(&LLFloaterCamera::onCustomPresetSelected, this));
+ LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCamera::populatePresetCombo, this));
- update();
+ update();
- // ensure that appearance mode is handled while building. See EXT-7796.
- handleAvatarEditingAppearance(sAppearanceEditing);
+ // ensure that appearance mode is handled while building. See EXT-7796.
+ handleAvatarEditingAppearance(sAppearanceEditing);
- return LLFloater::postBuild();
+ return LLFloater::postBuild();
}
-F32 LLFloaterCamera::getCurrentTransparency()
+F32 LLFloaterCamera::getCurrentTransparency()
{
- static LLCachedControl<F32> camera_opacity(gSavedSettings, "CameraOpacity");
- static LLCachedControl<F32> active_floater_transparency(gSavedSettings, "ActiveFloaterTransparency");
- return llmin(camera_opacity(), active_floater_transparency());
+ static LLCachedControl<F32> camera_opacity(gSavedSettings, "CameraOpacity");
+ static LLCachedControl<F32> active_floater_transparency(gSavedSettings, "ActiveFloaterTransparency");
+ return llmin(camera_opacity(), active_floater_transparency());
}
void LLFloaterCamera::fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel)
{
- // copying child list and then iterating over a copy, because list itself
- // is changed in process
- const child_list_t child_list = *panel->getChildList();
- child_list_t::const_reverse_iterator iter = child_list.rbegin();
- child_list_t::const_reverse_iterator end = child_list.rend();
- for ( ; iter != end; ++iter)
- {
- LLView* view = *iter;
- LLPanel* item = dynamic_cast<LLPanel*>(view);
- if (panel)
- list->addItem(item);
- }
+ // copying child list and then iterating over a copy, because list itself
+ // is changed in process
+ const child_list_t child_list = *panel->getChildList();
+ child_list_t::const_reverse_iterator iter = child_list.rbegin();
+ child_list_t::const_reverse_iterator end = child_list.rend();
+ for ( ; iter != end; ++iter)
+ {
+ LLView* view = *iter;
+ LLPanel* item = dynamic_cast<LLPanel*>(view);
+ if (panel)
+ list->addItem(item);
+ }
}
ECameraControlMode LLFloaterCamera::determineMode()
{
- if (sAppearanceEditing)
- {
- // this is the only enabled camera mode while editing agent appearance.
- return CAMERA_CTRL_MODE_PAN;
- }
+ if (sAppearanceEditing)
+ {
+ // this is the only enabled camera mode while editing agent appearance.
+ return CAMERA_CTRL_MODE_PAN;
+ }
- LLTool* curr_tool = LLToolMgr::getInstance()->getCurrentTool();
- if (curr_tool == LLToolCamera::getInstance())
- {
- return CAMERA_CTRL_MODE_FREE_CAMERA;
- }
+ LLTool* curr_tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (curr_tool == LLToolCamera::getInstance())
+ {
+ return CAMERA_CTRL_MODE_FREE_CAMERA;
+ }
- if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
- {
- return CAMERA_CTRL_MODE_PRESETS;
- }
+ if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
+ {
+ return CAMERA_CTRL_MODE_PRESETS;
+ }
- return CAMERA_CTRL_MODE_PAN;
+ return CAMERA_CTRL_MODE_PAN;
}
void clear_camera_tool()
{
- LLToolMgr* tool_mgr = LLToolMgr::getInstance();
- if (tool_mgr->usingTransientTool() &&
- tool_mgr->getCurrentTool() == LLToolCamera::getInstance())
- {
- tool_mgr->clearTransientTool();
- }
+ LLToolMgr* tool_mgr = LLToolMgr::getInstance();
+ if (tool_mgr->usingTransientTool() &&
+ tool_mgr->getCurrentTool() == LLToolCamera::getInstance())
+ {
+ tool_mgr->clearTransientTool();
+ }
}
void LLFloaterCamera::setMode(ECameraControlMode mode)
{
- if (mode != mCurrMode)
- {
- mPrevMode = mCurrMode;
- mCurrMode = mode;
- }
-
- updateState();
+ if (mode != mCurrMode)
+ {
+ mPrevMode = mCurrMode;
+ mCurrMode = mode;
+ }
+
+ updateState();
}
void LLFloaterCamera::switchMode(ECameraControlMode mode)
{
- switch (mode)
- {
- case CAMERA_CTRL_MODE_PRESETS:
- case CAMERA_CTRL_MODE_PAN:
- sFreeCamera = false;
- setMode(mode); // depends onto sFreeCamera
- clear_camera_tool();
- break;
-
- case CAMERA_CTRL_MODE_FREE_CAMERA:
- sFreeCamera = true;
- setMode(mode);
- activate_camera_tool();
- break;
-
- default:
- //normally we won't occur here
- llassert_always(FALSE);
- }
+ switch (mode)
+ {
+ case CAMERA_CTRL_MODE_PRESETS:
+ case CAMERA_CTRL_MODE_PAN:
+ sFreeCamera = false;
+ setMode(mode); // depends onto sFreeCamera
+ clear_camera_tool();
+ break;
+
+ case CAMERA_CTRL_MODE_FREE_CAMERA:
+ sFreeCamera = true;
+ setMode(mode);
+ activate_camera_tool();
+ break;
+
+ default:
+ //normally we won't occur here
+ llassert_always(FALSE);
+ }
}
void LLFloaterCamera::updateState()
{
- updateItemsSelection();
+ updateItemsSelection();
- if (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode)
- {
- return;
- }
+ if (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode)
+ {
+ return;
+ }
- //updating buttons
- std::map<ECameraControlMode, LLButton*>::const_iterator iter = mMode2Button.begin();
- for (; iter != mMode2Button.end(); ++iter)
- {
- iter->second->setToggleState(iter->first == mCurrMode);
- }
+ //updating buttons
+ std::map<ECameraControlMode, LLButton*>::const_iterator iter = mMode2Button.begin();
+ for (; iter != mMode2Button.end(); ++iter)
+ {
+ iter->second->setToggleState(iter->first == mCurrMode);
+ }
}
void LLFloaterCamera::updateItemsSelection()
{
- ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPresetType");
- LLSD argument;
- argument["selected"] = (preset == CAMERA_PRESET_REAR_VIEW) && !sFreeCamera;
- getChild<LLPanelCameraItem>("rear_view")->setValue(argument);
- argument["selected"] = (preset == CAMERA_PRESET_GROUP_VIEW) && !sFreeCamera;
- getChild<LLPanelCameraItem>("group_view")->setValue(argument);
- argument["selected"] = (preset == CAMERA_PRESET_FRONT_VIEW) && !sFreeCamera;
- getChild<LLPanelCameraItem>("front_view")->setValue(argument);
- argument["selected"] = gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK;
- getChild<LLPanelCameraItem>("mouselook_view")->setValue(argument);
- argument["selected"] = mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA;
- getChild<LLPanelCameraItem>("object_view")->setValue(argument);
+ ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPresetType");
+ LLSD argument;
+ argument["selected"] = (preset == CAMERA_PRESET_REAR_VIEW) && !sFreeCamera;
+ getChild<LLPanelCameraItem>("rear_view")->setValue(argument);
+ argument["selected"] = (preset == CAMERA_PRESET_GROUP_VIEW) && !sFreeCamera;
+ getChild<LLPanelCameraItem>("group_view")->setValue(argument);
+ argument["selected"] = (preset == CAMERA_PRESET_FRONT_VIEW) && !sFreeCamera;
+ getChild<LLPanelCameraItem>("front_view")->setValue(argument);
+ argument["selected"] = gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK;
+ getChild<LLPanelCameraItem>("mouselook_view")->setValue(argument);
+ argument["selected"] = mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA;
+ getChild<LLPanelCameraItem>("object_view")->setValue(argument);
}
// static
void LLFloaterCamera::onClickCameraItem(const LLSD& param)
{
- std::string name = param.asString();
-
- if ("mouselook_view" == name)
- {
- gAgentCamera.changeCameraToMouselook();
- }
- else if ("object_view" == name)
- {
- LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance();
- if (camera_floater)
- {
- camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA);
- camera_floater->updateItemsSelection();
- }
- }
- else
- {
- LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance();
- if (camera_floater)
- camera_floater->switchMode(CAMERA_CTRL_MODE_PAN);
- switchToPreset(name);
- }
+ std::string name = param.asString();
+
+ if ("mouselook_view" == name)
+ {
+ gAgentCamera.changeCameraToMouselook();
+ }
+ else if ("object_view" == name)
+ {
+ LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance();
+ if (camera_floater)
+ {
+ camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA);
+ camera_floater->updateItemsSelection();
+ }
+ }
+ else
+ {
+ LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance();
+ if (camera_floater)
+ camera_floater->switchMode(CAMERA_CTRL_MODE_PAN);
+ switchToPreset(name);
+ }
}
// static
void LLFloaterCamera::switchToPreset(const std::string& name)
{
- sFreeCamera = false;
- clear_camera_tool();
- if (PRESETS_REAR_VIEW == name)
- {
- gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW);
- }
- else if (PRESETS_SIDE_VIEW == name)
- {
- gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW);
- }
- else if (PRESETS_FRONT_VIEW == name)
- {
- gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW);
- }
- else
- {
- gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM);
- }
-
- if (gSavedSettings.getString("PresetCameraActive") != name)
- {
- LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name);
- }
-
- if (isAgentAvatarValid() && gAgentAvatarp->getParent())
- {
- LLQuaternion sit_rot(gSavedSettings.getLLSD("AvatarSitRotation"));
- if (sit_rot != LLQuaternion())
- {
- gAgent.rotate(~gAgent.getFrameAgent().getQuaternion());
- gAgent.rotate(sit_rot);
- }
- else
- {
- gAgentCamera.rotateToInitSitRot();
- }
- }
- gAgentCamera.resetCameraZoomFraction();
-
- LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance();
- if (camera_floater)
- {
- camera_floater->updateItemsSelection();
- camera_floater->switchMode(CAMERA_CTRL_MODE_PRESETS);
- }
+ sFreeCamera = false;
+ clear_camera_tool();
+ if (PRESETS_REAR_VIEW == name)
+ {
+ gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW);
+ }
+ else if (PRESETS_SIDE_VIEW == name)
+ {
+ gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW);
+ }
+ else if (PRESETS_FRONT_VIEW == name)
+ {
+ gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW);
+ }
+ else
+ {
+ gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM);
+ }
+
+ if (gSavedSettings.getString("PresetCameraActive") != name)
+ {
+ LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name);
+ }
+
+ if (isAgentAvatarValid() && gAgentAvatarp->getParent())
+ {
+ LLQuaternion sit_rot(gSavedSettings.getLLSD("AvatarSitRotation"));
+ if (sit_rot != LLQuaternion())
+ {
+ gAgent.rotate(~gAgent.getFrameAgent().getQuaternion());
+ gAgent.rotate(sit_rot);
+ }
+ else
+ {
+ gAgentCamera.rotateToInitSitRot();
+ }
+ }
+ gAgentCamera.resetCameraZoomFraction();
+
+ LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance();
+ if (camera_floater)
+ {
+ camera_floater->updateItemsSelection();
+ camera_floater->switchMode(CAMERA_CTRL_MODE_PRESETS);
+ }
}
void LLFloaterCamera::populatePresetCombo()
{
- LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, EDefaultOptions::DEFAULT_HIDE);
- std::string active_preset_name = gSavedSettings.getString("PresetCameraActive");
- if (active_preset_name.empty())
- {
- gSavedSettings.setU32("CameraPresetType", CAMERA_PRESET_CUSTOM);
- updateItemsSelection();
- mPresetCombo->setLabel(getString("inactive_combo_text"));
- }
- else if ((ECameraPreset)gSavedSettings.getU32("CameraPresetType") == CAMERA_PRESET_CUSTOM)
- {
- mPresetCombo->selectByValue(active_preset_name);
- }
- else
- {
- mPresetCombo->setLabel(getString("inactive_combo_text"));
- }
- updateItemsSelection();
+ LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, EDefaultOptions::DEFAULT_HIDE);
+ std::string active_preset_name = gSavedSettings.getString("PresetCameraActive");
+ if (active_preset_name.empty())
+ {
+ gSavedSettings.setU32("CameraPresetType", CAMERA_PRESET_CUSTOM);
+ updateItemsSelection();
+ mPresetCombo->setLabel(getString("inactive_combo_text"));
+ }
+ else if ((ECameraPreset)gSavedSettings.getU32("CameraPresetType") == CAMERA_PRESET_CUSTOM)
+ {
+ mPresetCombo->selectByValue(active_preset_name);
+ }
+ else
+ {
+ mPresetCombo->setLabel(getString("inactive_combo_text"));
+ }
+ updateItemsSelection();
}
void LLFloaterCamera::onSavePreset()
{
- LLFloaterReg::hideInstance("delete_pref_preset", PRESETS_CAMERA);
- LLFloaterReg::hideInstance("load_pref_preset", PRESETS_CAMERA);
-
- LLFloaterReg::showInstance("save_camera_preset");
+ LLFloaterReg::hideInstance("delete_pref_preset", PRESETS_CAMERA);
+ LLFloaterReg::hideInstance("load_pref_preset", PRESETS_CAMERA);
+
+ LLFloaterReg::showInstance("save_camera_preset");
}
void LLFloaterCamera::onCustomPresetSelected()
{
- std::string selected_preset = mPresetCombo->getSelectedItemLabel();
- if (getString("inactive_combo_text") != selected_preset)
- {
- switchToPreset(selected_preset);
- }
+ std::string selected_preset = mPresetCombo->getSelectedItemLabel();
+ if (getString("inactive_combo_text") != selected_preset)
+ {
+ switchToPreset(selected_preset);
+ }
}
diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h
index f31bc5486b..038ce8f173 100644
--- a/indra/newview/llfloatercamera.h
+++ b/indra/newview/llfloatercamera.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatercamera.h
* @brief Container for camera control buttons (zoom, pan, orbit)
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,139 +40,139 @@ class LLComboBox;
enum ECameraControlMode
{
- CAMERA_CTRL_MODE_PAN,
- CAMERA_CTRL_MODE_FREE_CAMERA,
- CAMERA_CTRL_MODE_PRESETS
+ CAMERA_CTRL_MODE_PAN,
+ CAMERA_CTRL_MODE_FREE_CAMERA,
+ CAMERA_CTRL_MODE_PRESETS
};
class LLFloaterCamera : public LLFloater
{
- friend class LLFloaterReg;
-
+ friend class LLFloaterReg;
+
public:
- /* whether in free camera mode */
- static bool inFreeCameraMode();
- /* callback for camera items selection changing */
- static void onClickCameraItem(const LLSD& param);
+ /* whether in free camera mode */
+ static bool inFreeCameraMode();
+ /* callback for camera items selection changing */
+ static void onClickCameraItem(const LLSD& param);
- static void onLeavingMouseLook();
+ static void onLeavingMouseLook();
- /** resets current camera mode to orbit mode */
- static void resetCameraMode();
+ /** resets current camera mode to orbit mode */
+ static void resetCameraMode();
- /** Called when Avatar is entered/exited editing appearance mode */
- static void onAvatarEditingAppearance(bool editing);
+ /** Called when Avatar is entered/exited editing appearance mode */
+ static void onAvatarEditingAppearance(bool editing);
- /** Called when opening and when "Advanced | Debug Camera" menu item is toggled */
- static void onDebugCameraToggled();
+ /** Called when opening and when "Advanced | Debug Camera" menu item is toggled */
+ static void onDebugCameraToggled();
- /* determines actual mode and updates ui */
- void update();
+ /* determines actual mode and updates ui */
+ void update();
- /*switch to one of the camera presets (front, rear, side)*/
- static void switchToPreset(const std::string& name);
+ /*switch to one of the camera presets (front, rear, side)*/
+ static void switchToPreset(const std::string& name);
- virtual void onOpen(const LLSD& key);
- virtual void onClose(bool app_quitting);
+ virtual void onOpen(const LLSD& key);
+ virtual void onClose(bool app_quitting);
- void onSavePreset();
- void onCustomPresetSelected();
+ void onSavePreset();
+ void onCustomPresetSelected();
- void populatePresetCombo();
+ void populatePresetCombo();
- LLJoystickCameraRotate* mRotate { nullptr };
- LLPanelCameraZoom* mZoom { nullptr };
- LLJoystickCameraTrack* mTrack { nullptr };
+ LLJoystickCameraRotate* mRotate { nullptr };
+ LLPanelCameraZoom* mZoom { nullptr };
+ LLJoystickCameraTrack* mTrack { nullptr };
private:
- LLFloaterCamera(const LLSD& val);
- ~LLFloaterCamera() {};
+ LLFloaterCamera(const LLSD& val);
+ ~LLFloaterCamera() {};
- /* return instance if it exists - created by LLFloaterReg */
- static LLFloaterCamera* findInstance();
+ /* return instance if it exists - created by LLFloaterReg */
+ static LLFloaterCamera* findInstance();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- F32 getCurrentTransparency();
+ F32 getCurrentTransparency();
- void onViewButtonClick(const LLSD& user_data);
+ void onViewButtonClick(const LLSD& user_data);
- ECameraControlMode determineMode();
+ ECameraControlMode determineMode();
- /* resets to the previous mode */
- void toPrevMode();
+ /* resets to the previous mode */
+ void toPrevMode();
- /* sets a new mode and performs related actions */
- void switchMode(ECameraControlMode mode);
+ /* sets a new mode and performs related actions */
+ void switchMode(ECameraControlMode mode);
- /* sets a new mode preserving previous one and updates ui*/
- void setMode(ECameraControlMode mode);
+ /* sets a new mode preserving previous one and updates ui*/
+ void setMode(ECameraControlMode mode);
- /* updates the state (UI) according to the current mode */
- void updateState();
+ /* updates the state (UI) according to the current mode */
+ void updateState();
- /* update camera modes items selection and camera preset items selection according to the currently selected preset */
- void updateItemsSelection();
+ /* update camera modes items selection and camera preset items selection according to the currently selected preset */
+ void updateItemsSelection();
- // fills flatlist with items from given panel
- void fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel);
+ // fills flatlist with items from given panel
+ void fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel);
- void handleAvatarEditingAppearance(bool editing);
+ void handleAvatarEditingAppearance(bool editing);
- void showDebugInfo(bool show);
+ void showDebugInfo(bool show);
- // set to true when free camera mode is selected in modes list
- // remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed
- static bool sFreeCamera;
- static bool sAppearanceEditing;
- BOOL mClosed;
- ECameraControlMode mPrevMode;
- ECameraControlMode mCurrMode;
- std::map<ECameraControlMode, LLButton*> mMode2Button;
+ // set to true when free camera mode is selected in modes list
+ // remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed
+ static bool sFreeCamera;
+ static bool sAppearanceEditing;
+ BOOL mClosed;
+ ECameraControlMode mPrevMode;
+ ECameraControlMode mCurrMode;
+ std::map<ECameraControlMode, LLButton*> mMode2Button;
- LLPanel* mControls { nullptr };
- LLPanel* mViewerCameraInfo { nullptr };
- LLPanel* mAgentCameraInfo { nullptr };
- LLComboBox* mPresetCombo { nullptr };
- LLTextBox* mPreciseCtrls { nullptr };
+ LLPanel* mControls { nullptr };
+ LLPanel* mViewerCameraInfo { nullptr };
+ LLPanel* mAgentCameraInfo { nullptr };
+ LLComboBox* mPresetCombo { nullptr };
+ LLTextBox* mPreciseCtrls { nullptr };
};
/**
- * Class used to represent widgets from panel_camera_item.xml-
+ * Class used to represent widgets from panel_camera_item.xml-
* panels that contain pictures and text. Pictures are different
* for selected and unselected state (this state is nor stored- icons
* are changed in setValue()). This class doesn't implement selection logic-
* it's items are used inside of flatlist.
*/
-class LLPanelCameraItem
- : public LLPanel
+class LLPanelCameraItem
+ : public LLPanel
{
public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {
- Optional<LLIconCtrl::Params> icon_over;
- Optional<LLIconCtrl::Params> icon_selected;
- Optional<LLIconCtrl::Params> picture;
- Optional<LLIconCtrl::Params> selected_picture;
-
- Optional<LLTextBox::Params> text;
- Optional<CommitCallbackParam> mousedown_callback;
- Params();
- };
- /*virtual*/ BOOL postBuild();
- /** setting on/off background icon to indicate selected state */
- /*virtual*/ void setValue(const LLSD& value);
- // sends commit signal
- void onAnyMouseClick();
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<LLIconCtrl::Params> icon_over;
+ Optional<LLIconCtrl::Params> icon_selected;
+ Optional<LLIconCtrl::Params> picture;
+ Optional<LLIconCtrl::Params> selected_picture;
+
+ Optional<LLTextBox::Params> text;
+ Optional<CommitCallbackParam> mousedown_callback;
+ Params();
+ };
+ /*virtual*/ BOOL postBuild();
+ /** setting on/off background icon to indicate selected state */
+ /*virtual*/ void setValue(const LLSD& value);
+ // sends commit signal
+ void onAnyMouseClick();
protected:
- friend class LLUICtrlFactory;
- LLPanelCameraItem(const Params&);
- LLIconCtrl* mIconOver;
- LLIconCtrl* mIconSelected;
- LLIconCtrl* mPicture;
- LLIconCtrl* mPictureSelected;
- LLTextBox* mText;
+ friend class LLUICtrlFactory;
+ LLPanelCameraItem(const Params&);
+ LLIconCtrl* mIconOver;
+ LLIconCtrl* mIconSelected;
+ LLIconCtrl* mPicture;
+ LLIconCtrl* mPictureSelected;
+ LLTextBox* mText;
};
#endif
diff --git a/indra/newview/llfloatercamerapresets.cpp b/indra/newview/llfloatercamerapresets.cpp
index a1cbffd094..eaf03dea81 100644
--- a/indra/newview/llfloatercamerapresets.cpp
+++ b/indra/newview/llfloatercamerapresets.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloatercamerapresets.cpp
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,7 +32,7 @@
#include "llviewercontrol.h"
LLFloaterCameraPresets::LLFloaterCameraPresets(const LLSD& key)
-: LLFloater(key)
+: LLFloater(key)
{}
LLFloaterCameraPresets::~LLFloaterCameraPresets()
@@ -59,7 +59,7 @@ void LLFloaterCameraPresets::populateList()
LLPresetsManager* presetsMgr = LLPresetsManager::getInstance();
std::list<std::string> preset_names;
- presetsMgr->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_BOTTOM);
+ presetsMgr->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_BOTTOM);
std::string active_preset = gSavedSettings.getString("PresetCameraActive");
for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it)
@@ -149,7 +149,7 @@ void LLCameraPresetFlatItem::onDeleteBtnClick()
args["NAME"] = mPresetName;
LLNotificationsUtil::add("PresetNotDeleted", args);
}
- else if (gSavedSettings.getString("PresetCameraActive") == mPresetName)
+ else if (gSavedSettings.getString("PresetCameraActive") == mPresetName)
{
gSavedSettings.setString("PresetCameraActive", "");
}
diff --git a/indra/newview/llfloatercamerapresets.h b/indra/newview/llfloatercamerapresets.h
index 4430a4209e..082cb4c4dd 100644
--- a/indra/newview/llfloatercamerapresets.h
+++ b/indra/newview/llfloatercamerapresets.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloatercamerapresets.h
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp
index 776f8dc785..ec01571e32 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.cpp
+++ b/indra/newview/llfloaterchangeitemthumbnail.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterchangeitemthumbnail.cpp
* @brief LLFloaterChangeItemThumbnail class implementation
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -90,7 +90,7 @@ void LLThumbnailImagePicker::notify(const std::vector<std::string>& filenames)
{
return;
}
-
+
LLFloaterSimpleSnapshot::uploadThumbnail(file_path, mInventoryId, mTaskId);
}
@@ -537,7 +537,7 @@ void LLFloaterChangeItemThumbnail::onRemove(void *userdata)
LLNotificationsUtil::add("DeleteThumbnail", LLSD(), payload, boost::bind(&LLFloaterChangeItemThumbnail::onRemovalConfirmation, _1, _2, self->getHandle()));
}
-// static
+// static
void LLFloaterChangeItemThumbnail::onRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFloater> handle)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
diff --git a/indra/newview/llfloaterchangeitemthumbnail.h b/indra/newview/llfloaterchangeitemthumbnail.h
index a91e9b8ee9..bad5342e73 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.h
+++ b/indra/newview/llfloaterchangeitemthumbnail.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterchangeitemthumbnail.h
* @brief LLFloaterChangeItemThumbnail class definition
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,7 +43,7 @@ class LLFloaterChangeItemThumbnail : public LLFloater, public LLInventoryObserve
{
public:
LLFloaterChangeItemThumbnail(const LLSD& key);
- ~LLFloaterChangeItemThumbnail();
+ ~LLFloaterChangeItemThumbnail();
BOOL postBuild() override;
void onOpen(const LLSD& key) override;
diff --git a/indra/newview/llfloaterchatvoicevolume.cpp b/indra/newview/llfloaterchatvoicevolume.cpp
index 67c412dfa6..9d70eb5739 100644
--- a/indra/newview/llfloaterchatvoicevolume.cpp
+++ b/indra/newview/llfloaterchatvoicevolume.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloaterchatvoicevolume.cpp
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,11 +34,11 @@ LLFloaterChatVoiceVolume::LLFloaterChatVoiceVolume(const LLSD& key)
void LLFloaterChatVoiceVolume::onOpen(const LLSD& key)
{
- LLInspect::onOpen(key);
- LLInspect::repositionInspector(key);
+ LLInspect::onOpen(key);
+ LLInspect::repositionInspector(key);
}
LLFloaterChatVoiceVolume::~LLFloaterChatVoiceVolume()
{
- LLTransientFloaterMgr::getInstance()->removeControlView(this);
+ LLTransientFloaterMgr::getInstance()->removeControlView(this);
};
diff --git a/indra/newview/llfloaterchatvoicevolume.h b/indra/newview/llfloaterchatvoicevolume.h
index 61ad92b6da..7b70260548 100644
--- a/indra/newview/llfloaterchatvoicevolume.h
+++ b/indra/newview/llfloaterchatvoicevolume.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloaterchatvoicevolume.h
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,12 +33,12 @@ class LLFloaterChatVoiceVolume : public LLInspect, LLTransientFloater
{
public:
- LLFloaterChatVoiceVolume(const LLSD& key);
- virtual ~LLFloaterChatVoiceVolume();
+ LLFloaterChatVoiceVolume(const LLSD& key);
+ virtual ~LLFloaterChatVoiceVolume();
- virtual void onOpen(const LLSD& key);
+ virtual void onOpen(const LLSD& key);
- /*virtual*/ LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; }
+ /*virtual*/ LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; }
};
#endif /* LLFLOATERCHATVOICEVOLUME_H_ */
diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp
index ba91277c79..7e413e35d6 100644
--- a/indra/newview/llfloatercolorpicker.cpp
+++ b/indra/newview/llfloatercolorpicker.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatercolorpicker.cpp
* @brief Generic system color picker
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -69,53 +69,53 @@
//////////////////////////////////////////////////////////////////////////////
LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate )
- : LLFloater(LLSD()),
- mComponents ( 3 ),
- mMouseDownInLumRegion ( FALSE ),
- mMouseDownInHueRegion ( FALSE ),
- mMouseDownInSwatch ( FALSE ),
- // *TODO: Specify this in XML
- mRGBViewerImageLeft ( 140 ),
- mRGBViewerImageTop ( 356 ),
- mRGBViewerImageWidth ( 256 ),
- mRGBViewerImageHeight ( 256 ),
- mLumRegionLeft ( mRGBViewerImageLeft + mRGBViewerImageWidth + 16 ),
- mLumRegionTop ( mRGBViewerImageTop ),
- mLumRegionWidth ( 16 ),
- mLumRegionHeight ( mRGBViewerImageHeight ),
- mLumMarkerSize ( 6 ),
- // *TODO: Specify this in XML
- mSwatchRegionLeft ( 12 ),
- mSwatchRegionTop ( 190 ),
- mSwatchRegionWidth ( 116 ),
- mSwatchRegionHeight ( 60 ),
- mSwatchView ( NULL ),
- // *TODO: Specify this in XML
- numPaletteColumns ( 16 ),
- numPaletteRows ( 2 ),
- highlightEntry ( -1 ),
- mPaletteRegionLeft ( 11 ),
- mPaletteRegionTop ( 100 - 8 ),
- mPaletteRegionWidth ( mLumRegionLeft + mLumRegionWidth - 10 ),
- mPaletteRegionHeight ( 40 ),
- mSwatch ( swatch ),
- mActive ( TRUE ),
- mCanApplyImmediately ( show_apply_immediate ),
- mContextConeOpacity ( 0.f ),
+ : LLFloater(LLSD()),
+ mComponents ( 3 ),
+ mMouseDownInLumRegion ( FALSE ),
+ mMouseDownInHueRegion ( FALSE ),
+ mMouseDownInSwatch ( FALSE ),
+ // *TODO: Specify this in XML
+ mRGBViewerImageLeft ( 140 ),
+ mRGBViewerImageTop ( 356 ),
+ mRGBViewerImageWidth ( 256 ),
+ mRGBViewerImageHeight ( 256 ),
+ mLumRegionLeft ( mRGBViewerImageLeft + mRGBViewerImageWidth + 16 ),
+ mLumRegionTop ( mRGBViewerImageTop ),
+ mLumRegionWidth ( 16 ),
+ mLumRegionHeight ( mRGBViewerImageHeight ),
+ mLumMarkerSize ( 6 ),
+ // *TODO: Specify this in XML
+ mSwatchRegionLeft ( 12 ),
+ mSwatchRegionTop ( 190 ),
+ mSwatchRegionWidth ( 116 ),
+ mSwatchRegionHeight ( 60 ),
+ mSwatchView ( NULL ),
+ // *TODO: Specify this in XML
+ numPaletteColumns ( 16 ),
+ numPaletteRows ( 2 ),
+ highlightEntry ( -1 ),
+ mPaletteRegionLeft ( 11 ),
+ mPaletteRegionTop ( 100 - 8 ),
+ mPaletteRegionWidth ( mLumRegionLeft + mLumRegionWidth - 10 ),
+ mPaletteRegionHeight ( 40 ),
+ mSwatch ( swatch ),
+ mActive ( TRUE ),
+ mCanApplyImmediately ( show_apply_immediate ),
+ mContextConeOpacity ( 0.f ),
mContextConeInAlpha ( 0.f ),
mContextConeOutAlpha ( 0.f ),
mContextConeFadeTime ( 0.f )
{
- buildFromFile ( "floater_color_picker.xml");
+ buildFromFile ( "floater_color_picker.xml");
- // create user interface for this picker
- createUI ();
+ // create user interface for this picker
+ createUI ();
- if (!mCanApplyImmediately)
- {
- mApplyImmediateCheck->setEnabled(FALSE);
- mApplyImmediateCheck->set(FALSE);
- }
+ if (!mCanApplyImmediately)
+ {
+ mApplyImmediateCheck->setEnabled(FALSE);
+ mApplyImmediateCheck->set(FALSE);
+ }
mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha");
mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha");
@@ -124,71 +124,71 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show
LLFloaterColorPicker::~LLFloaterColorPicker()
{
- // destroy the UI we created
- destroyUI ();
+ // destroy the UI we created
+ destroyUI ();
}
//////////////////////////////////////////////////////////////////////////////
//
void LLFloaterColorPicker::createUI ()
{
- // create RGB type area (not really RGB but it's got R,G & B in it.,..
-
- LLPointer<LLImageRaw> raw = new LLImageRaw ( mRGBViewerImageWidth, mRGBViewerImageHeight, mComponents );
- U8* bits = raw->getData();
- S32 linesize = mRGBViewerImageWidth * mComponents;
- for ( S32 y = 0; y < mRGBViewerImageHeight; ++y )
- {
- for ( S32 x = 0; x < linesize; x += mComponents )
- {
- F32 rVal, gVal, bVal;
-
- hslToRgb ( (F32)x / (F32) ( linesize - 1 ),
- (F32)y / (F32) ( mRGBViewerImageHeight - 1 ),
- 0.5f,
- rVal,
- gVal,
- bVal );
-
- * ( bits + x + y * linesize + 0 ) = ( U8 )( rVal * 255.0f );
- * ( bits + x + y * linesize + 1 ) = ( U8 )( gVal * 255.0f );
- * ( bits + x + y * linesize + 2 ) = ( U8 )( bVal * 255.0f );
- }
- }
- mRGBImage = LLViewerTextureManager::getLocalTexture( (LLImageRaw*)raw, FALSE );
- gGL.getTexUnit(0)->bind(mRGBImage);
- mRGBImage->setAddressMode(LLTexUnit::TAM_CLAMP);
-
- // create palette
- for ( S32 each = 0; each < numPaletteColumns * numPaletteRows; ++each )
- {
- mPalette.push_back(new LLColor4(LLUIColorTable::instance().getColor(llformat("ColorPaletteEntry%02d", each + 1))));
- }
+ // create RGB type area (not really RGB but it's got R,G & B in it.,..
+
+ LLPointer<LLImageRaw> raw = new LLImageRaw ( mRGBViewerImageWidth, mRGBViewerImageHeight, mComponents );
+ U8* bits = raw->getData();
+ S32 linesize = mRGBViewerImageWidth * mComponents;
+ for ( S32 y = 0; y < mRGBViewerImageHeight; ++y )
+ {
+ for ( S32 x = 0; x < linesize; x += mComponents )
+ {
+ F32 rVal, gVal, bVal;
+
+ hslToRgb ( (F32)x / (F32) ( linesize - 1 ),
+ (F32)y / (F32) ( mRGBViewerImageHeight - 1 ),
+ 0.5f,
+ rVal,
+ gVal,
+ bVal );
+
+ * ( bits + x + y * linesize + 0 ) = ( U8 )( rVal * 255.0f );
+ * ( bits + x + y * linesize + 1 ) = ( U8 )( gVal * 255.0f );
+ * ( bits + x + y * linesize + 2 ) = ( U8 )( bVal * 255.0f );
+ }
+ }
+ mRGBImage = LLViewerTextureManager::getLocalTexture( (LLImageRaw*)raw, FALSE );
+ gGL.getTexUnit(0)->bind(mRGBImage);
+ mRGBImage->setAddressMode(LLTexUnit::TAM_CLAMP);
+
+ // create palette
+ for ( S32 each = 0; each < numPaletteColumns * numPaletteRows; ++each )
+ {
+ mPalette.push_back(new LLColor4(LLUIColorTable::instance().getColor(llformat("ColorPaletteEntry%02d", each + 1))));
+ }
}
//////////////////////////////////////////////////////////////////////////////
//
void LLFloaterColorPicker::showUI ()
{
- openFloater(getKey());
- setVisible ( TRUE );
- setFocus ( TRUE );
+ openFloater(getKey());
+ setVisible ( TRUE );
+ setFocus ( TRUE );
- // HACK: if system color picker is required - close the SL one we made and use default system dialog
- if ( gSavedSettings.getBOOL ( "UseDefaultColorPicker" ) )
- {
- LLColorSwatchCtrl* swatch = getSwatch ();
+ // HACK: if system color picker is required - close the SL one we made and use default system dialog
+ if ( gSavedSettings.getBOOL ( "UseDefaultColorPicker" ) )
+ {
+ LLColorSwatchCtrl* swatch = getSwatch ();
- setVisible ( FALSE );
+ setVisible ( FALSE );
- // code that will get switched in for default system color picker
- if ( swatch )
- {
+ // code that will get switched in for default system color picker
+ if ( swatch )
+ {
// Todo: this needs to be threaded for viewer not to timeout
- LLColor4 curCol = swatch->get ();
- send_agent_pause();
- bool commit = getWindow()->dialogColorPicker( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] );
- send_agent_resume();
+ LLColor4 curCol = swatch->get ();
+ send_agent_pause();
+ bool commit = getWindow()->dialogColorPicker( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] );
+ send_agent_resume();
if (commit)
{
@@ -201,41 +201,41 @@ void LLFloaterColorPicker::showUI ()
{
LLColorSwatchCtrl::onColorChanged(swatch, LLColorSwatchCtrl::COLOR_CANCEL);
}
- }
+ }
- closeFloater();
- }
+ closeFloater();
+ }
}
//////////////////////////////////////////////////////////////////////////////
// called after the dialog is rendered
BOOL LLFloaterColorPicker::postBuild()
{
- mCancelBtn = getChild<LLButton>( "cancel_btn" );
+ mCancelBtn = getChild<LLButton>( "cancel_btn" );
mCancelBtn->setClickedCallback ( onClickCancel, this );
- mSelectBtn = getChild<LLButton>( "select_btn");
+ mSelectBtn = getChild<LLButton>( "select_btn");
mSelectBtn->setClickedCallback ( onClickSelect, this );
- mSelectBtn->setFocus ( TRUE );
+ mSelectBtn->setFocus ( TRUE );
- mPipetteBtn = getChild<LLButton>("color_pipette" );
+ mPipetteBtn = getChild<LLButton>("color_pipette" );
- mPipetteBtn->setImages(std::string("eye_button_inactive.tga"), std::string("eye_button_active.tga"));
+ mPipetteBtn->setImages(std::string("eye_button_inactive.tga"), std::string("eye_button_active.tga"));
- mPipetteBtn->setCommitCallback( boost::bind(&LLFloaterColorPicker::onClickPipette, this ));
+ mPipetteBtn->setCommitCallback( boost::bind(&LLFloaterColorPicker::onClickPipette, this ));
- mApplyImmediateCheck = getChild<LLCheckBoxCtrl>("apply_immediate");
- mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately"));
- mApplyImmediateCheck->setCommitCallback(onImmediateCheck, this);
+ mApplyImmediateCheck = getChild<LLCheckBoxCtrl>("apply_immediate");
+ mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately"));
+ mApplyImmediateCheck->setCommitCallback(onImmediateCheck, this);
- childSetCommitCallback("rspin", onTextCommit, (void*)this );
- childSetCommitCallback("gspin", onTextCommit, (void*)this );
- childSetCommitCallback("bspin", onTextCommit, (void*)this );
- childSetCommitCallback("hspin", onTextCommit, (void*)this );
- childSetCommitCallback("sspin", onTextCommit, (void*)this );
- childSetCommitCallback("lspin", onTextCommit, (void*)this );
+ childSetCommitCallback("rspin", onTextCommit, (void*)this );
+ childSetCommitCallback("gspin", onTextCommit, (void*)this );
+ childSetCommitCallback("bspin", onTextCommit, (void*)this );
+ childSetCommitCallback("hspin", onTextCommit, (void*)this );
+ childSetCommitCallback("sspin", onTextCommit, (void*)this );
+ childSetCommitCallback("lspin", onTextCommit, (void*)this );
- LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterColorPicker::onColorSelect, this, _1));
+ LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterColorPicker::onColorSelect, this, _1));
return TRUE;
}
@@ -244,42 +244,42 @@ BOOL LLFloaterColorPicker::postBuild()
//
void LLFloaterColorPicker::initUI ( F32 rValIn, F32 gValIn, F32 bValIn )
{
- // under some circumstances, we get rogue values that can be calmed by clamping...
- rValIn = llclamp ( rValIn, 0.0f, 1.0f );
- gValIn = llclamp ( gValIn, 0.0f, 1.0f );
- bValIn = llclamp ( bValIn, 0.0f, 1.0f );
+ // under some circumstances, we get rogue values that can be calmed by clamping...
+ rValIn = llclamp ( rValIn, 0.0f, 1.0f );
+ gValIn = llclamp ( gValIn, 0.0f, 1.0f );
+ bValIn = llclamp ( bValIn, 0.0f, 1.0f );
- // store initial value in case cancel or revert is selected
- setOrigRgb ( rValIn, gValIn, bValIn );
+ // store initial value in case cancel or revert is selected
+ setOrigRgb ( rValIn, gValIn, bValIn );
- // starting point for current value to
- setCurRgb ( rValIn, gValIn, bValIn );
+ // starting point for current value to
+ setCurRgb ( rValIn, gValIn, bValIn );
- // unpdate text entry fields
- updateTextEntry ();
+ // unpdate text entry fields
+ updateTextEntry ();
}
//////////////////////////////////////////////////////////////////////////////
//
void LLFloaterColorPicker::destroyUI ()
{
- // shut down pipette tool if active
- stopUsingPipette();
-
- // delete palette we created
- std::vector < LLColor4* >::iterator iter = mPalette.begin ();
- while ( iter != mPalette.end () )
- {
- delete ( *iter );
- ++iter;
- }
-
- if ( mSwatchView )
- {
- this->removeChild ( mSwatchView );
- mSwatchView->die();;
- mSwatchView = NULL;
- }
+ // shut down pipette tool if active
+ stopUsingPipette();
+
+ // delete palette we created
+ std::vector < LLColor4* >::iterator iter = mPalette.begin ();
+ while ( iter != mPalette.end () )
+ {
+ delete ( *iter );
+ ++iter;
+ }
+
+ if ( mSwatchView )
+ {
+ this->removeChild ( mSwatchView );
+ mSwatchView->die();;
+ mSwatchView = NULL;
+ }
}
@@ -287,73 +287,73 @@ void LLFloaterColorPicker::destroyUI ()
//
F32 LLFloaterColorPicker::hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn )
{
- if ( valHUeIn < 0.0f ) valHUeIn += 1.0f;
- if ( valHUeIn > 1.0f ) valHUeIn -= 1.0f;
- if ( ( 6.0f * valHUeIn ) < 1.0f ) return ( val1In + ( val2In - val1In ) * 6.0f * valHUeIn );
- if ( ( 2.0f * valHUeIn ) < 1.0f ) return ( val2In );
- if ( ( 3.0f * valHUeIn ) < 2.0f ) return ( val1In + ( val2In - val1In ) * ( ( 2.0f / 3.0f ) - valHUeIn ) * 6.0f );
- return ( val1In );
+ if ( valHUeIn < 0.0f ) valHUeIn += 1.0f;
+ if ( valHUeIn > 1.0f ) valHUeIn -= 1.0f;
+ if ( ( 6.0f * valHUeIn ) < 1.0f ) return ( val1In + ( val2In - val1In ) * 6.0f * valHUeIn );
+ if ( ( 2.0f * valHUeIn ) < 1.0f ) return ( val2In );
+ if ( ( 3.0f * valHUeIn ) < 2.0f ) return ( val1In + ( val2In - val1In ) * ( ( 2.0f / 3.0f ) - valHUeIn ) * 6.0f );
+ return ( val1In );
}
//////////////////////////////////////////////////////////////////////////////
//
void LLFloaterColorPicker::hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32& bValOut )
{
- if ( sValIn < 0.00001f )
- {
- rValOut = lValIn;
- gValOut = lValIn;
- bValOut = lValIn;
- }
- else
- {
- F32 interVal1;
- F32 interVal2;
-
- if ( lValIn < 0.5f )
- interVal2 = lValIn * ( 1.0f + sValIn );
- else
- interVal2 = ( lValIn + sValIn ) - ( sValIn * lValIn );
-
- interVal1 = 2.0f * lValIn - interVal2;
-
- rValOut = hueToRgb ( interVal1, interVal2, hValIn + ( 1.f / 3.f ) );
- gValOut = hueToRgb ( interVal1, interVal2, hValIn );
- bValOut = hueToRgb ( interVal1, interVal2, hValIn - ( 1.f / 3.f ) );
- }
+ if ( sValIn < 0.00001f )
+ {
+ rValOut = lValIn;
+ gValOut = lValIn;
+ bValOut = lValIn;
+ }
+ else
+ {
+ F32 interVal1;
+ F32 interVal2;
+
+ if ( lValIn < 0.5f )
+ interVal2 = lValIn * ( 1.0f + sValIn );
+ else
+ interVal2 = ( lValIn + sValIn ) - ( sValIn * lValIn );
+
+ interVal1 = 2.0f * lValIn - interVal2;
+
+ rValOut = hueToRgb ( interVal1, interVal2, hValIn + ( 1.f / 3.f ) );
+ gValOut = hueToRgb ( interVal1, interVal2, hValIn );
+ bValOut = hueToRgb ( interVal1, interVal2, hValIn - ( 1.f / 3.f ) );
+ }
}
//////////////////////////////////////////////////////////////////////////////
// mutator for original RGB value
void LLFloaterColorPicker::setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn )
{
- origR = origRIn;
- origG = origGIn;
- origB = origBIn;
+ origR = origRIn;
+ origG = origGIn;
+ origB = origBIn;
}
//////////////////////////////////////////////////////////////////////////////
// accessor for original RGB value
void LLFloaterColorPicker::getOrigRgb ( F32& origROut, F32& origGOut, F32& origBOut )
{
- origROut = origR;
- origGOut = origG;
- origBOut = origB;
+ origROut = origR;
+ origGOut = origG;
+ origBOut = origB;
}
//////////////////////////////////////////////////////////////////////////////
// mutator for current RGB value
void LLFloaterColorPicker::setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn )
{
- // save current RGB
- curR = curRIn;
- curG = curGIn;
- curB = curBIn;
+ // save current RGB
+ curR = curRIn;
+ curG = curGIn;
+ curB = curBIn;
- // update corresponding HSL values and
- LLColor3(curRIn, curGIn, curBIn).calcHSL(&curH, &curS, &curL);
+ // update corresponding HSL values and
+ LLColor3(curRIn, curGIn, curBIn).calcHSL(&curH, &curS, &curL);
- // color changed so update text fields
+ // color changed so update text fields
updateTextEntry();
}
@@ -361,123 +361,123 @@ void LLFloaterColorPicker::setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn )
// accessor for current RGB value
void LLFloaterColorPicker::getCurRgb ( F32& curROut, F32& curGOut, F32& curBOut )
{
- curROut = curR;
- curGOut = curG;
- curBOut = curB;
+ curROut = curR;
+ curGOut = curG;
+ curBOut = curB;
}
//////////////////////////////////////////////////////////////////////////////
// mutator for current HSL value
void LLFloaterColorPicker::setCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn )
{
- // save current HSL
- curH = curHIn;
- curS = curSIn;
- curL = curLIn;
+ // save current HSL
+ curH = curHIn;
+ curS = curSIn;
+ curL = curLIn;
- // update corresponding RGB values and
- hslToRgb ( curH, curS, curL, curR, curG, curB );
+ // update corresponding RGB values and
+ hslToRgb ( curH, curS, curL, curR, curG, curB );
}
//////////////////////////////////////////////////////////////////////////////
// accessor for current HSL value
void LLFloaterColorPicker::getCurHsl ( F32& curHOut, F32& curSOut, F32& curLOut )
{
- curHOut = curH;
- curSOut = curS;
- curLOut = curL;
+ curHOut = curH;
+ curSOut = curS;
+ curLOut = curL;
}
//////////////////////////////////////////////////////////////////////////////
// called when 'cancel' clicked
void LLFloaterColorPicker::onClickCancel ( void* data )
{
- if (data)
- {
- LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data;
-
- if ( self )
- {
- self->cancelSelection();
- self->closeFloater();
- }
- }
+ if (data)
+ {
+ LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data;
+
+ if ( self )
+ {
+ self->cancelSelection();
+ self->closeFloater();
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////
// called when 'select' clicked
void LLFloaterColorPicker::onClickSelect ( void* data )
{
- if (data)
- {
- LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data;
-
- if ( self )
- {
- // apply to selection
- LLColorSwatchCtrl::onColorChanged ( self->getSwatch (), LLColorSwatchCtrl::COLOR_SELECT );
- self->closeFloater();
- }
- }
+ if (data)
+ {
+ LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data;
+
+ if ( self )
+ {
+ // apply to selection
+ LLColorSwatchCtrl::onColorChanged ( self->getSwatch (), LLColorSwatchCtrl::COLOR_SELECT );
+ self->closeFloater();
+ }
+ }
}
void LLFloaterColorPicker::onClickPipette( )
{
- BOOL pipette_active = mPipetteBtn->getToggleState();
- pipette_active = !pipette_active;
- if (pipette_active)
- {
- LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance());
- }
- else
- {
- LLToolMgr::getInstance()->clearTransientTool();
- }
+ BOOL pipette_active = mPipetteBtn->getToggleState();
+ pipette_active = !pipette_active;
+ if (pipette_active)
+ {
+ LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance());
+ }
+ else
+ {
+ LLToolMgr::getInstance()->clearTransientTool();
+ }
}
//////////////////////////////////////////////////////////////////////////////
// called when 'text is committed' - i,e. focus moves from a text field
void LLFloaterColorPicker::onTextCommit ( LLUICtrl* ctrl, void* data )
{
- if ( data )
- {
- LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data;
- if ( self )
- {
- self->onTextEntryChanged ( ctrl );
- }
- }
+ if ( data )
+ {
+ LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data;
+ if ( self )
+ {
+ self->onTextEntryChanged ( ctrl );
+ }
+ }
}
void LLFloaterColorPicker::onImmediateCheck( LLUICtrl* ctrl, void* data)
{
- LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data;
- if (self)
- {
- gSavedSettings.setBOOL("ApplyColorImmediately", self->mApplyImmediateCheck->get());
- if (self->mApplyImmediateCheck->get() && self->isColorChanged())
- {
- LLColorSwatchCtrl::onColorChanged ( self->getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
- }
- }
+ LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data;
+ if (self)
+ {
+ gSavedSettings.setBOOL("ApplyColorImmediately", self->mApplyImmediateCheck->get());
+ if (self->mApplyImmediateCheck->get() && self->isColorChanged())
+ {
+ LLColorSwatchCtrl::onColorChanged ( self->getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
+ }
+ }
}
void LLFloaterColorPicker::onColorSelect( const LLTextureEntry& te )
{
- // Pipete
- selectCurRgb(te.getColor().mV[VRED], te.getColor().mV[VGREEN], te.getColor().mV[VBLUE]);
+ // Pipete
+ selectCurRgb(te.getColor().mV[VRED], te.getColor().mV[VGREEN], te.getColor().mV[VBLUE]);
}
void LLFloaterColorPicker::onMouseCaptureLost()
{
- setMouseDownInHueRegion(FALSE);
- setMouseDownInLumRegion(FALSE);
+ setMouseDownInHueRegion(FALSE);
+ setMouseDownInLumRegion(FALSE);
}
F32 LLFloaterColorPicker::getSwatchTransparency()
{
- // If the floater is focused, don't apply its alpha to the color swatch (STORM-676).
- return getTransparencyType() == TT_ACTIVE ? 1.f : LLFloater::getCurrentTransparency();
+ // If the floater is focused, don't apply its alpha to the color swatch (STORM-676).
+ return getTransparencyType() == TT_ACTIVE ? 1.f : LLFloater::getCurrentTransparency();
}
BOOL LLFloaterColorPicker::isColorChanged()
@@ -489,604 +489,604 @@ BOOL LLFloaterColorPicker::isColorChanged()
//
void LLFloaterColorPicker::draw()
{
- static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f);
- drawConeToOwner(mContextConeOpacity, max_opacity, mSwatch, mContextConeFadeTime, mContextConeInAlpha, mContextConeOutAlpha);
-
- mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
- mApplyImmediateCheck->setEnabled(mActive && mCanApplyImmediately);
- mSelectBtn->setEnabled(mActive);
-
- // base floater stuff
- LLFloater::draw ();
-
- const F32 alpha = getSwatchTransparency();
-
- // draw image for RGB area (not really RGB but you'll see what I mean...
- gl_draw_image ( mRGBViewerImageLeft, mRGBViewerImageTop - mRGBViewerImageHeight, mRGBImage, LLColor4::white % alpha);
-
- // update 'cursor' into RGB Section
- S32 xPos = ( S32 ) ( ( F32 )mRGBViewerImageWidth * getCurH () ) - 8;
- S32 yPos = ( S32 ) ( ( F32 )mRGBViewerImageHeight * getCurS () ) - 8;
- gl_line_2d ( mRGBViewerImageLeft + xPos,
- mRGBViewerImageTop - mRGBViewerImageHeight + yPos + 8,
- mRGBViewerImageLeft + xPos + 16,
- mRGBViewerImageTop - mRGBViewerImageHeight + yPos + 8,
- LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ) );
-
- gl_line_2d ( mRGBViewerImageLeft + xPos + 8,
- mRGBViewerImageTop - mRGBViewerImageHeight + yPos,
- mRGBViewerImageLeft + xPos + 8,
- mRGBViewerImageTop - mRGBViewerImageHeight + yPos + 16,
- LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ) );
-
- // create rgb area outline
- gl_rect_2d ( mRGBViewerImageLeft,
- mRGBViewerImageTop - mRGBViewerImageHeight,
- mRGBViewerImageLeft + mRGBViewerImageWidth + 1,
- mRGBViewerImageTop,
- LLColor4 ( 0.0f, 0.0f, 0.0f, alpha ),
- FALSE );
-
- // draw luminance slider
- for ( S32 y = 0; y < mLumRegionHeight; ++y )
- {
- F32 rValSlider, gValSlider, bValSlider;
- hslToRgb ( getCurH (), getCurS (), ( F32 )y / ( F32 )mLumRegionHeight, rValSlider, gValSlider, bValSlider );
-
- gl_rect_2d( mLumRegionLeft,
- mLumRegionTop - mLumRegionHeight + y,
- mLumRegionLeft + mLumRegionWidth,
- mLumRegionTop - mLumRegionHeight + y - 1,
- LLColor4 ( rValSlider, gValSlider, bValSlider, alpha ) );
- }
-
-
- // draw luninance marker
- S32 startX = mLumRegionLeft + mLumRegionWidth;
- S32 startY = mLumRegionTop - mLumRegionHeight + ( S32 ) ( mLumRegionHeight * getCurL () );
- gl_triangle_2d ( startX, startY,
- startX + mLumMarkerSize, startY - mLumMarkerSize,
- startX + mLumMarkerSize, startY + mLumMarkerSize,
- LLColor4 ( 0.75f, 0.75f, 0.75f, 1.0f ), TRUE );
-
- // draw luminance slider outline
- gl_rect_2d ( mLumRegionLeft,
- mLumRegionTop - mLumRegionHeight,
- mLumRegionLeft + mLumRegionWidth + 1,
- mLumRegionTop,
- LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ),
- FALSE );
-
- // draw selected color swatch
- gl_rect_2d ( mSwatchRegionLeft,
- mSwatchRegionTop - mSwatchRegionHeight,
- mSwatchRegionLeft + mSwatchRegionWidth,
- mSwatchRegionTop,
- LLColor4 ( getCurR (), getCurG (), getCurB (), alpha ),
- TRUE );
-
- // draw selected color swatch outline
- gl_rect_2d ( mSwatchRegionLeft,
- mSwatchRegionTop - mSwatchRegionHeight,
- mSwatchRegionLeft + mSwatchRegionWidth + 1,
- mSwatchRegionTop,
- LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ),
- FALSE );
-
- // color palette code is a little more involved so break it out into its' own method
- drawPalette ();
+ static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f);
+ drawConeToOwner(mContextConeOpacity, max_opacity, mSwatch, mContextConeFadeTime, mContextConeInAlpha, mContextConeOutAlpha);
+
+ mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
+ mApplyImmediateCheck->setEnabled(mActive && mCanApplyImmediately);
+ mSelectBtn->setEnabled(mActive);
+
+ // base floater stuff
+ LLFloater::draw ();
+
+ const F32 alpha = getSwatchTransparency();
+
+ // draw image for RGB area (not really RGB but you'll see what I mean...
+ gl_draw_image ( mRGBViewerImageLeft, mRGBViewerImageTop - mRGBViewerImageHeight, mRGBImage, LLColor4::white % alpha);
+
+ // update 'cursor' into RGB Section
+ S32 xPos = ( S32 ) ( ( F32 )mRGBViewerImageWidth * getCurH () ) - 8;
+ S32 yPos = ( S32 ) ( ( F32 )mRGBViewerImageHeight * getCurS () ) - 8;
+ gl_line_2d ( mRGBViewerImageLeft + xPos,
+ mRGBViewerImageTop - mRGBViewerImageHeight + yPos + 8,
+ mRGBViewerImageLeft + xPos + 16,
+ mRGBViewerImageTop - mRGBViewerImageHeight + yPos + 8,
+ LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ) );
+
+ gl_line_2d ( mRGBViewerImageLeft + xPos + 8,
+ mRGBViewerImageTop - mRGBViewerImageHeight + yPos,
+ mRGBViewerImageLeft + xPos + 8,
+ mRGBViewerImageTop - mRGBViewerImageHeight + yPos + 16,
+ LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ) );
+
+ // create rgb area outline
+ gl_rect_2d ( mRGBViewerImageLeft,
+ mRGBViewerImageTop - mRGBViewerImageHeight,
+ mRGBViewerImageLeft + mRGBViewerImageWidth + 1,
+ mRGBViewerImageTop,
+ LLColor4 ( 0.0f, 0.0f, 0.0f, alpha ),
+ FALSE );
+
+ // draw luminance slider
+ for ( S32 y = 0; y < mLumRegionHeight; ++y )
+ {
+ F32 rValSlider, gValSlider, bValSlider;
+ hslToRgb ( getCurH (), getCurS (), ( F32 )y / ( F32 )mLumRegionHeight, rValSlider, gValSlider, bValSlider );
+
+ gl_rect_2d( mLumRegionLeft,
+ mLumRegionTop - mLumRegionHeight + y,
+ mLumRegionLeft + mLumRegionWidth,
+ mLumRegionTop - mLumRegionHeight + y - 1,
+ LLColor4 ( rValSlider, gValSlider, bValSlider, alpha ) );
+ }
+
+
+ // draw luninance marker
+ S32 startX = mLumRegionLeft + mLumRegionWidth;
+ S32 startY = mLumRegionTop - mLumRegionHeight + ( S32 ) ( mLumRegionHeight * getCurL () );
+ gl_triangle_2d ( startX, startY,
+ startX + mLumMarkerSize, startY - mLumMarkerSize,
+ startX + mLumMarkerSize, startY + mLumMarkerSize,
+ LLColor4 ( 0.75f, 0.75f, 0.75f, 1.0f ), TRUE );
+
+ // draw luminance slider outline
+ gl_rect_2d ( mLumRegionLeft,
+ mLumRegionTop - mLumRegionHeight,
+ mLumRegionLeft + mLumRegionWidth + 1,
+ mLumRegionTop,
+ LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ),
+ FALSE );
+
+ // draw selected color swatch
+ gl_rect_2d ( mSwatchRegionLeft,
+ mSwatchRegionTop - mSwatchRegionHeight,
+ mSwatchRegionLeft + mSwatchRegionWidth,
+ mSwatchRegionTop,
+ LLColor4 ( getCurR (), getCurG (), getCurB (), alpha ),
+ TRUE );
+
+ // draw selected color swatch outline
+ gl_rect_2d ( mSwatchRegionLeft,
+ mSwatchRegionTop - mSwatchRegionHeight,
+ mSwatchRegionLeft + mSwatchRegionWidth + 1,
+ mSwatchRegionTop,
+ LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ),
+ FALSE );
+
+ // color palette code is a little more involved so break it out into its' own method
+ drawPalette ();
}
//////////////////////////////////////////////////////////////////////////////
// find a complimentary color to the one passed in that can be used to highlight
const LLColor4& LLFloaterColorPicker::getComplimentaryColor ( const LLColor4& backgroundColor )
{
- // going to base calculation on luminance
- F32 hVal, sVal, lVal;
- backgroundColor.calcHSL(&hVal, &sVal, &lVal);
- hVal *= 360.f;
- sVal *= 100.f;
- lVal *= 100.f;
-
- // fairly simple heuristic for now...!
- if ( lVal < 0.5f )
- {
- return LLColor4::white;
- }
-
- return LLColor4::black;
+ // going to base calculation on luminance
+ F32 hVal, sVal, lVal;
+ backgroundColor.calcHSL(&hVal, &sVal, &lVal);
+ hVal *= 360.f;
+ sVal *= 100.f;
+ lVal *= 100.f;
+
+ // fairly simple heuristic for now...!
+ if ( lVal < 0.5f )
+ {
+ return LLColor4::white;
+ }
+
+ return LLColor4::black;
}
//////////////////////////////////////////////////////////////////////////////
// set current RGB and rise change event if needed.
void LLFloaterColorPicker::selectCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn )
{
- setCurRgb(curRIn, curGIn, curBIn);
- if (mApplyImmediateCheck->get())
- {
- LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
- }
+ setCurRgb(curRIn, curGIn, curBIn);
+ if (mApplyImmediateCheck->get())
+ {
+ LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
+ }
}
//////////////////////////////////////////////////////////////////////////////
// set current HSL and rise change event if needed.
void LLFloaterColorPicker::selectCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn )
{
- setCurHsl(curHIn, curSIn, curLIn);
- if (mApplyImmediateCheck->get())
- {
- LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
- }
+ setCurHsl(curHIn, curSIn, curLIn);
+ if (mApplyImmediateCheck->get())
+ {
+ LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
+ }
}
//////////////////////////////////////////////////////////////////////////////
// draw color palette
void LLFloaterColorPicker::drawPalette ()
{
- S32 curEntry = 0;
- const F32 alpha = getSwatchTransparency();
-
- for ( S32 y = 0; y < numPaletteRows; ++y )
- {
- for ( S32 x = 0; x < numPaletteColumns; ++x )
- {
- // calculate position
- S32 x1 = mPaletteRegionLeft + ( mPaletteRegionWidth * x ) / numPaletteColumns;
- S32 y1 = mPaletteRegionTop - ( mPaletteRegionHeight * y ) / numPaletteRows;
- S32 x2 = ( mPaletteRegionLeft + ( mPaletteRegionWidth * ( x + 1 ) ) / numPaletteColumns );
- S32 y2 = ( mPaletteRegionTop - ( mPaletteRegionHeight * ( y + 1 ) ) / numPaletteRows );
-
- // draw palette entry color
- if ( mPalette [ curEntry ] )
- {
- gl_rect_2d ( x1 + 2, y1 - 2, x2 - 2, y2 + 2, *mPalette [ curEntry++ ] % alpha, TRUE );
- gl_rect_2d ( x1 + 1, y1 - 1, x2 - 1, y2 + 1, LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), FALSE );
- }
- }
- }
-
- // if there is something to highlight (mouse down in swatch & hovering over palette)
- if ( highlightEntry >= 0 )
- {
- // extract row/column from palette index
- S32 entryColumn = highlightEntry % numPaletteColumns;
- S32 entryRow = highlightEntry / numPaletteColumns;
-
- // calculate position of this entry
- S32 x1 = mPaletteRegionLeft + ( mPaletteRegionWidth * entryColumn ) / numPaletteColumns;
- S32 y1 = mPaletteRegionTop - ( mPaletteRegionHeight * entryRow ) / numPaletteRows;
- S32 x2 = ( mPaletteRegionLeft + ( mPaletteRegionWidth * ( entryColumn + 1 ) ) / numPaletteColumns );
- S32 y2 = ( mPaletteRegionTop - ( mPaletteRegionHeight * ( entryRow + 1 ) ) / numPaletteRows );
-
- // center position of entry
- S32 xCenter = x1 + ( x2 - x1 ) / 2;
- S32 yCenter = y1 - ( y1 - y2 ) / 2;
-
- // find a color that works well as a highlight color
- LLColor4 hlColor ( getComplimentaryColor ( *mPalette [ highlightEntry ] ) );
-
- // mark a cross for entry that is being hovered
- gl_line_2d ( xCenter - 4, yCenter - 4, xCenter + 4, yCenter + 4, hlColor );
- gl_line_2d ( xCenter + 4, yCenter - 4, xCenter - 4, yCenter + 4, hlColor );
- }
+ S32 curEntry = 0;
+ const F32 alpha = getSwatchTransparency();
+
+ for ( S32 y = 0; y < numPaletteRows; ++y )
+ {
+ for ( S32 x = 0; x < numPaletteColumns; ++x )
+ {
+ // calculate position
+ S32 x1 = mPaletteRegionLeft + ( mPaletteRegionWidth * x ) / numPaletteColumns;
+ S32 y1 = mPaletteRegionTop - ( mPaletteRegionHeight * y ) / numPaletteRows;
+ S32 x2 = ( mPaletteRegionLeft + ( mPaletteRegionWidth * ( x + 1 ) ) / numPaletteColumns );
+ S32 y2 = ( mPaletteRegionTop - ( mPaletteRegionHeight * ( y + 1 ) ) / numPaletteRows );
+
+ // draw palette entry color
+ if ( mPalette [ curEntry ] )
+ {
+ gl_rect_2d ( x1 + 2, y1 - 2, x2 - 2, y2 + 2, *mPalette [ curEntry++ ] % alpha, TRUE );
+ gl_rect_2d ( x1 + 1, y1 - 1, x2 - 1, y2 + 1, LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), FALSE );
+ }
+ }
+ }
+
+ // if there is something to highlight (mouse down in swatch & hovering over palette)
+ if ( highlightEntry >= 0 )
+ {
+ // extract row/column from palette index
+ S32 entryColumn = highlightEntry % numPaletteColumns;
+ S32 entryRow = highlightEntry / numPaletteColumns;
+
+ // calculate position of this entry
+ S32 x1 = mPaletteRegionLeft + ( mPaletteRegionWidth * entryColumn ) / numPaletteColumns;
+ S32 y1 = mPaletteRegionTop - ( mPaletteRegionHeight * entryRow ) / numPaletteRows;
+ S32 x2 = ( mPaletteRegionLeft + ( mPaletteRegionWidth * ( entryColumn + 1 ) ) / numPaletteColumns );
+ S32 y2 = ( mPaletteRegionTop - ( mPaletteRegionHeight * ( entryRow + 1 ) ) / numPaletteRows );
+
+ // center position of entry
+ S32 xCenter = x1 + ( x2 - x1 ) / 2;
+ S32 yCenter = y1 - ( y1 - y2 ) / 2;
+
+ // find a color that works well as a highlight color
+ LLColor4 hlColor ( getComplimentaryColor ( *mPalette [ highlightEntry ] ) );
+
+ // mark a cross for entry that is being hovered
+ gl_line_2d ( xCenter - 4, yCenter - 4, xCenter + 4, yCenter + 4, hlColor );
+ gl_line_2d ( xCenter + 4, yCenter - 4, xCenter - 4, yCenter + 4, hlColor );
+ }
}
//////////////////////////////////////////////////////////////////////////////
// update text entry values for RGB/HSL (can't be done in ::draw () since this overwrites input
void LLFloaterColorPicker::updateTextEntry ()
{
- // set values in spinners
- getChild<LLUICtrl>("rspin")->setValue(( getCurR () * 255.0f ) );
- getChild<LLUICtrl>("gspin")->setValue(( getCurG () * 255.0f ) );
- getChild<LLUICtrl>("bspin")->setValue(( getCurB () * 255.0f ) );
- getChild<LLUICtrl>("hspin")->setValue(( getCurH () * 360.0f ) );
- getChild<LLUICtrl>("sspin")->setValue(( getCurS () * 100.0f ) );
- getChild<LLUICtrl>("lspin")->setValue(( getCurL () * 100.0f ) );
+ // set values in spinners
+ getChild<LLUICtrl>("rspin")->setValue(( getCurR () * 255.0f ) );
+ getChild<LLUICtrl>("gspin")->setValue(( getCurG () * 255.0f ) );
+ getChild<LLUICtrl>("bspin")->setValue(( getCurB () * 255.0f ) );
+ getChild<LLUICtrl>("hspin")->setValue(( getCurH () * 360.0f ) );
+ getChild<LLUICtrl>("sspin")->setValue(( getCurS () * 100.0f ) );
+ getChild<LLUICtrl>("lspin")->setValue(( getCurL () * 100.0f ) );
}
//////////////////////////////////////////////////////////////////////////////
//
void LLFloaterColorPicker::onTextEntryChanged ( LLUICtrl* ctrl )
{
- // value in RGB boxes changed
- std::string name = ctrl->getName();
- if ( ( name == "rspin" ) || ( name == "gspin" ) || ( name == "bspin" ) )
- {
- // get current RGB
- F32 rVal, gVal, bVal;
- getCurRgb ( rVal, gVal, bVal );
-
- // update component value with new value from text
- if ( name == "rspin" )
- {
- rVal = (F32)ctrl->getValue().asReal() / 255.0f;
- }
- else
- if ( name == "gspin" )
- {
- gVal = (F32)ctrl->getValue().asReal() / 255.0f;
- }
- else
- if ( name == "bspin" )
- {
- bVal = (F32)ctrl->getValue().asReal() / 255.0f;
- }
-
- // update current RGB (and implicitly HSL)
- selectCurRgb ( rVal, gVal, bVal );
-
- updateTextEntry ();
- }
- else
- // value in HSL boxes changed
- if ( ( name == "hspin" ) || ( name == "sspin" ) || ( name == "lspin" ) )
- {
- // get current HSL
- F32 hVal, sVal, lVal;
- getCurHsl ( hVal, sVal, lVal );
-
- // update component value with new value from text
- if ( name == "hspin" )
- hVal = (F32)ctrl->getValue().asReal() / 360.0f;
- else
- if ( name == "sspin" )
- sVal = (F32)ctrl->getValue().asReal() / 100.0f;
- else
- if ( name == "lspin" )
- lVal = (F32)ctrl->getValue().asReal() / 100.0f;
-
- // update current HSL (and implicitly RGB)
- selectCurHsl ( hVal, sVal, lVal );
-
- updateTextEntry ();
- }
+ // value in RGB boxes changed
+ std::string name = ctrl->getName();
+ if ( ( name == "rspin" ) || ( name == "gspin" ) || ( name == "bspin" ) )
+ {
+ // get current RGB
+ F32 rVal, gVal, bVal;
+ getCurRgb ( rVal, gVal, bVal );
+
+ // update component value with new value from text
+ if ( name == "rspin" )
+ {
+ rVal = (F32)ctrl->getValue().asReal() / 255.0f;
+ }
+ else
+ if ( name == "gspin" )
+ {
+ gVal = (F32)ctrl->getValue().asReal() / 255.0f;
+ }
+ else
+ if ( name == "bspin" )
+ {
+ bVal = (F32)ctrl->getValue().asReal() / 255.0f;
+ }
+
+ // update current RGB (and implicitly HSL)
+ selectCurRgb ( rVal, gVal, bVal );
+
+ updateTextEntry ();
+ }
+ else
+ // value in HSL boxes changed
+ if ( ( name == "hspin" ) || ( name == "sspin" ) || ( name == "lspin" ) )
+ {
+ // get current HSL
+ F32 hVal, sVal, lVal;
+ getCurHsl ( hVal, sVal, lVal );
+
+ // update component value with new value from text
+ if ( name == "hspin" )
+ hVal = (F32)ctrl->getValue().asReal() / 360.0f;
+ else
+ if ( name == "sspin" )
+ sVal = (F32)ctrl->getValue().asReal() / 100.0f;
+ else
+ if ( name == "lspin" )
+ lVal = (F32)ctrl->getValue().asReal() / 100.0f;
+
+ // update current HSL (and implicitly RGB)
+ selectCurHsl ( hVal, sVal, lVal );
+
+ updateTextEntry ();
+ }
}
//////////////////////////////////////////////////////////////////////////////
//
BOOL LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn )
{
- if ( xPosIn >= mRGBViewerImageLeft &&
- xPosIn <= mRGBViewerImageLeft + mRGBViewerImageWidth &&
- yPosIn <= mRGBViewerImageTop &&
- yPosIn >= mRGBViewerImageTop - mRGBViewerImageHeight )
- {
- // update HSL (and therefore RGB) based on new H & S and current L
- selectCurHsl ( ( ( F32 )xPosIn - ( F32 )mRGBViewerImageLeft ) / ( F32 )mRGBViewerImageWidth,
- ( ( F32 )yPosIn - ( ( F32 )mRGBViewerImageTop - ( F32 )mRGBViewerImageHeight ) ) / ( F32 )mRGBViewerImageHeight,
- getCurL () );
-
- // indicate a value changed
- return TRUE;
- }
- else
- if ( xPosIn >= mLumRegionLeft &&
- xPosIn <= mLumRegionLeft + mLumRegionWidth &&
- yPosIn <= mLumRegionTop &&
- yPosIn >= mLumRegionTop - mLumRegionHeight )
- {
-
- // update HSL (and therefore RGB) based on current HS and new L
- selectCurHsl ( getCurH (),
- getCurS (),
- ( ( F32 )yPosIn - ( ( F32 )mRGBViewerImageTop - ( F32 )mRGBViewerImageHeight ) ) / ( F32 )mRGBViewerImageHeight );
-
- // indicate a value changed
- return TRUE;
- }
-
- return FALSE;
+ if ( xPosIn >= mRGBViewerImageLeft &&
+ xPosIn <= mRGBViewerImageLeft + mRGBViewerImageWidth &&
+ yPosIn <= mRGBViewerImageTop &&
+ yPosIn >= mRGBViewerImageTop - mRGBViewerImageHeight )
+ {
+ // update HSL (and therefore RGB) based on new H & S and current L
+ selectCurHsl ( ( ( F32 )xPosIn - ( F32 )mRGBViewerImageLeft ) / ( F32 )mRGBViewerImageWidth,
+ ( ( F32 )yPosIn - ( ( F32 )mRGBViewerImageTop - ( F32 )mRGBViewerImageHeight ) ) / ( F32 )mRGBViewerImageHeight,
+ getCurL () );
+
+ // indicate a value changed
+ return TRUE;
+ }
+ else
+ if ( xPosIn >= mLumRegionLeft &&
+ xPosIn <= mLumRegionLeft + mLumRegionWidth &&
+ yPosIn <= mLumRegionTop &&
+ yPosIn >= mLumRegionTop - mLumRegionHeight )
+ {
+
+ // update HSL (and therefore RGB) based on current HS and new L
+ selectCurHsl ( getCurH (),
+ getCurS (),
+ ( ( F32 )yPosIn - ( ( F32 )mRGBViewerImageTop - ( F32 )mRGBViewerImageHeight ) ) / ( F32 )mRGBViewerImageHeight );
+
+ // indicate a value changed
+ return TRUE;
+ }
+
+ return FALSE;
}
//////////////////////////////////////////////////////////////////////////////
//
BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
{
- // make it the frontmost
- gFloaterView->bringToFront(this);
-
- // rect containing RGB area
- LLRect rgbAreaRect ( mRGBViewerImageLeft,
- mRGBViewerImageTop,
- mRGBViewerImageLeft + mRGBViewerImageWidth,
- mRGBViewerImageTop - mRGBViewerImageHeight );
-
- if ( rgbAreaRect.pointInRect ( x, y ) )
- {
- gFocusMgr.setMouseCapture(this);
- // mouse button down
- setMouseDownInHueRegion ( TRUE );
-
- // update all values based on initial click
- updateRgbHslFromPoint ( x, y );
-
- // required by base class
- return TRUE;
- }
-
- // rect containing RGB area
- LLRect lumAreaRect ( mLumRegionLeft,
- mLumRegionTop,
- mLumRegionLeft + mLumRegionWidth + mLumMarkerSize,
- mLumRegionTop - mLumRegionHeight );
-
- if ( lumAreaRect.pointInRect ( x, y ) )
- {
- gFocusMgr.setMouseCapture(this);
- // mouse button down
- setMouseDownInLumRegion ( TRUE );
-
- // required by base class
- return TRUE;
- }
-
- // rect containing swatch area
- LLRect swatchRect ( mSwatchRegionLeft,
- mSwatchRegionTop,
- mSwatchRegionLeft + mSwatchRegionWidth,
- mSwatchRegionTop - mSwatchRegionHeight );
-
- setMouseDownInSwatch( FALSE );
- if ( swatchRect.pointInRect ( x, y ) )
- {
- setMouseDownInSwatch( TRUE );
-
- // required - dont drag windows here.
- return TRUE;
- }
-
- // rect containing palette area
- LLRect paletteRect ( mPaletteRegionLeft,
- mPaletteRegionTop,
- mPaletteRegionLeft + mPaletteRegionWidth,
- mPaletteRegionTop - mPaletteRegionHeight );
-
- if ( paletteRect.pointInRect ( x, y ) )
- {
- // release keyboard focus so we can change text values
- if (gFocusMgr.childHasKeyboardFocus(this))
- {
- mSelectBtn->setFocus(TRUE);
- }
-
- // calculate which palette index we selected
- S32 c = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth;
- S32 r = ( ( y - ( mPaletteRegionTop - mPaletteRegionHeight ) ) * numPaletteRows ) / mPaletteRegionHeight;
-
- U32 index = ( numPaletteRows - r - 1 ) * numPaletteColumns + c;
-
- if ( index <= mPalette.size () )
- {
- LLColor4 selected = *mPalette [ index ];
-
- selectCurRgb ( selected [ 0 ], selected [ 1 ], selected [ 2 ] );
-
- if (mApplyImmediateCheck->get())
- {
- LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
- }
-
- updateTextEntry ();
- }
-
- return TRUE;
- }
-
- // dispatch to base class for the rest of things
-
- return LLFloater::handleMouseDown ( x, y, mask );
+ // make it the frontmost
+ gFloaterView->bringToFront(this);
+
+ // rect containing RGB area
+ LLRect rgbAreaRect ( mRGBViewerImageLeft,
+ mRGBViewerImageTop,
+ mRGBViewerImageLeft + mRGBViewerImageWidth,
+ mRGBViewerImageTop - mRGBViewerImageHeight );
+
+ if ( rgbAreaRect.pointInRect ( x, y ) )
+ {
+ gFocusMgr.setMouseCapture(this);
+ // mouse button down
+ setMouseDownInHueRegion ( TRUE );
+
+ // update all values based on initial click
+ updateRgbHslFromPoint ( x, y );
+
+ // required by base class
+ return TRUE;
+ }
+
+ // rect containing RGB area
+ LLRect lumAreaRect ( mLumRegionLeft,
+ mLumRegionTop,
+ mLumRegionLeft + mLumRegionWidth + mLumMarkerSize,
+ mLumRegionTop - mLumRegionHeight );
+
+ if ( lumAreaRect.pointInRect ( x, y ) )
+ {
+ gFocusMgr.setMouseCapture(this);
+ // mouse button down
+ setMouseDownInLumRegion ( TRUE );
+
+ // required by base class
+ return TRUE;
+ }
+
+ // rect containing swatch area
+ LLRect swatchRect ( mSwatchRegionLeft,
+ mSwatchRegionTop,
+ mSwatchRegionLeft + mSwatchRegionWidth,
+ mSwatchRegionTop - mSwatchRegionHeight );
+
+ setMouseDownInSwatch( FALSE );
+ if ( swatchRect.pointInRect ( x, y ) )
+ {
+ setMouseDownInSwatch( TRUE );
+
+ // required - dont drag windows here.
+ return TRUE;
+ }
+
+ // rect containing palette area
+ LLRect paletteRect ( mPaletteRegionLeft,
+ mPaletteRegionTop,
+ mPaletteRegionLeft + mPaletteRegionWidth,
+ mPaletteRegionTop - mPaletteRegionHeight );
+
+ if ( paletteRect.pointInRect ( x, y ) )
+ {
+ // release keyboard focus so we can change text values
+ if (gFocusMgr.childHasKeyboardFocus(this))
+ {
+ mSelectBtn->setFocus(TRUE);
+ }
+
+ // calculate which palette index we selected
+ S32 c = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth;
+ S32 r = ( ( y - ( mPaletteRegionTop - mPaletteRegionHeight ) ) * numPaletteRows ) / mPaletteRegionHeight;
+
+ U32 index = ( numPaletteRows - r - 1 ) * numPaletteColumns + c;
+
+ if ( index <= mPalette.size () )
+ {
+ LLColor4 selected = *mPalette [ index ];
+
+ selectCurRgb ( selected [ 0 ], selected [ 1 ], selected [ 2 ] );
+
+ if (mApplyImmediateCheck->get())
+ {
+ LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
+ }
+
+ updateTextEntry ();
+ }
+
+ return TRUE;
+ }
+
+ // dispatch to base class for the rest of things
+
+ return LLFloater::handleMouseDown ( x, y, mask );
}
//////////////////////////////////////////////////////////////////////////////
//
BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask )
{
- // if we're the front most window
- if ( isFrontmost () )
- {
- // mouse was pressed within region
- if ( getMouseDownInHueRegion() || getMouseDownInLumRegion())
- {
- S32 clamped_x, clamped_y;
- if (getMouseDownInHueRegion())
- {
- clamped_x = llclamp(x, mRGBViewerImageLeft, mRGBViewerImageLeft + mRGBViewerImageWidth);
- clamped_y = llclamp(y, mRGBViewerImageTop - mRGBViewerImageHeight, mRGBViewerImageTop);
- }
- else
- {
- clamped_x = llclamp(x, mLumRegionLeft, mLumRegionLeft + mLumRegionWidth);
- clamped_y = llclamp(y, mLumRegionTop - mLumRegionHeight, mLumRegionTop);
- }
-
- // update the stored RGB/HSL values using the mouse position - returns TRUE if RGB was updated
- if ( updateRgbHslFromPoint ( clamped_x, clamped_y ) )
- {
- // update text entry fields
- updateTextEntry ();
-
- // RN: apparently changing color when dragging generates too much traffic and results in sporadic updates
- //// commit changed color to swatch subject
- //// REVIEW: this gets sent each time a color changes - is this okay ?
- //if (mApplyImmediateCheck->get())
- //{
- // LLColorSwatchCtrl::onColorChanged ( getSwatch () );
- //}
- }
- }
-
- highlightEntry = -1;
-
- if ( mMouseDownInSwatch )
- {
- getWindow()->setCursor ( UI_CURSOR_ARROWDRAG );
-
- // if cursor if over a palette entry
- LLRect paletteRect ( mPaletteRegionLeft,
- mPaletteRegionTop,
- mPaletteRegionLeft + mPaletteRegionWidth,
- mPaletteRegionTop - mPaletteRegionHeight );
-
- if ( paletteRect.pointInRect ( x, y ) )
- {
- // find row/column in palette
- S32 xOffset = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth;
- S32 yOffset = ( ( mPaletteRegionTop - y - 1 ) * numPaletteRows ) / mPaletteRegionHeight;
-
- // calculate the entry 0..n-1 to highlight and set variable to next draw() picks it up
- highlightEntry = xOffset + yOffset * numPaletteColumns;
- }
-
- return TRUE;
- }
- }
-
- // dispatch to base class for the rest of things
- return LLFloater::handleHover ( x, y, mask );
+ // if we're the front most window
+ if ( isFrontmost () )
+ {
+ // mouse was pressed within region
+ if ( getMouseDownInHueRegion() || getMouseDownInLumRegion())
+ {
+ S32 clamped_x, clamped_y;
+ if (getMouseDownInHueRegion())
+ {
+ clamped_x = llclamp(x, mRGBViewerImageLeft, mRGBViewerImageLeft + mRGBViewerImageWidth);
+ clamped_y = llclamp(y, mRGBViewerImageTop - mRGBViewerImageHeight, mRGBViewerImageTop);
+ }
+ else
+ {
+ clamped_x = llclamp(x, mLumRegionLeft, mLumRegionLeft + mLumRegionWidth);
+ clamped_y = llclamp(y, mLumRegionTop - mLumRegionHeight, mLumRegionTop);
+ }
+
+ // update the stored RGB/HSL values using the mouse position - returns TRUE if RGB was updated
+ if ( updateRgbHslFromPoint ( clamped_x, clamped_y ) )
+ {
+ // update text entry fields
+ updateTextEntry ();
+
+ // RN: apparently changing color when dragging generates too much traffic and results in sporadic updates
+ //// commit changed color to swatch subject
+ //// REVIEW: this gets sent each time a color changes - is this okay ?
+ //if (mApplyImmediateCheck->get())
+ //{
+ // LLColorSwatchCtrl::onColorChanged ( getSwatch () );
+ //}
+ }
+ }
+
+ highlightEntry = -1;
+
+ if ( mMouseDownInSwatch )
+ {
+ getWindow()->setCursor ( UI_CURSOR_ARROWDRAG );
+
+ // if cursor if over a palette entry
+ LLRect paletteRect ( mPaletteRegionLeft,
+ mPaletteRegionTop,
+ mPaletteRegionLeft + mPaletteRegionWidth,
+ mPaletteRegionTop - mPaletteRegionHeight );
+
+ if ( paletteRect.pointInRect ( x, y ) )
+ {
+ // find row/column in palette
+ S32 xOffset = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth;
+ S32 yOffset = ( ( mPaletteRegionTop - y - 1 ) * numPaletteRows ) / mPaletteRegionHeight;
+
+ // calculate the entry 0..n-1 to highlight and set variable to next draw() picks it up
+ highlightEntry = xOffset + yOffset * numPaletteColumns;
+ }
+
+ return TRUE;
+ }
+ }
+
+ // dispatch to base class for the rest of things
+ return LLFloater::handleHover ( x, y, mask );
}
//////////////////////////////////////////////////////////////////////////////
// reverts state once mouse button is released
BOOL LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask )
{
- getWindow()->setCursor ( UI_CURSOR_ARROW );
-
- if (getMouseDownInHueRegion() || getMouseDownInLumRegion())
- {
- if (mApplyImmediateCheck->get())
- {
- LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
- }
- }
-
- // rect containing palette area
- LLRect paletteRect ( mPaletteRegionLeft,
- mPaletteRegionTop,
- mPaletteRegionLeft + mPaletteRegionWidth,
- mPaletteRegionTop - mPaletteRegionHeight );
-
- if ( paletteRect.pointInRect ( x, y ) )
- {
- if ( mMouseDownInSwatch )
- {
- S32 curEntry = 0;
- for ( S32 row = 0; row < numPaletteRows; ++row )
- {
- for ( S32 column = 0; column < numPaletteColumns; ++column )
- {
- S32 left = mPaletteRegionLeft + ( mPaletteRegionWidth * column ) / numPaletteColumns;
- S32 top = mPaletteRegionTop - ( mPaletteRegionHeight * row ) / numPaletteRows;
- S32 right = ( mPaletteRegionLeft + ( mPaletteRegionWidth * ( column + 1 ) ) / numPaletteColumns );
- S32 bottom = ( mPaletteRegionTop - ( mPaletteRegionHeight * ( row + 1 ) ) / numPaletteRows );
-
- // rect is flipped vertically when testing here
- LLRect dropRect ( left, top, right, bottom );
-
- if ( dropRect.pointInRect ( x, y ) )
- {
- if ( mPalette [ curEntry ] )
- {
- delete mPalette [ curEntry ];
-
- mPalette [ curEntry ] = new LLColor4 ( getCurR (), getCurG (), getCurB (), 1.0f );
-
- // save off color
- std::ostringstream codec;
- codec << "ColorPaletteEntry" << std::setfill ( '0' ) << std::setw ( 2 ) << curEntry + 1;
- const std::string s ( codec.str () );
- LLUIColorTable::instance().setColor(s, *mPalette [ curEntry ] );
- }
- }
-
- ++curEntry;
- }
- }
- }
- }
-
- // mouse button not down anymore
- setMouseDownInHueRegion ( FALSE );
- setMouseDownInLumRegion ( FALSE );
-
- // mouse button not down in color swatch anymore
- mMouseDownInSwatch = false;
-
- if (hasMouseCapture())
- {
- gFocusMgr.setMouseCapture(NULL);
- }
-
- // dispatch to base class for the rest of things
- return LLFloater::handleMouseUp ( x, y, mask );
+ getWindow()->setCursor ( UI_CURSOR_ARROW );
+
+ if (getMouseDownInHueRegion() || getMouseDownInLumRegion())
+ {
+ if (mApplyImmediateCheck->get())
+ {
+ LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
+ }
+ }
+
+ // rect containing palette area
+ LLRect paletteRect ( mPaletteRegionLeft,
+ mPaletteRegionTop,
+ mPaletteRegionLeft + mPaletteRegionWidth,
+ mPaletteRegionTop - mPaletteRegionHeight );
+
+ if ( paletteRect.pointInRect ( x, y ) )
+ {
+ if ( mMouseDownInSwatch )
+ {
+ S32 curEntry = 0;
+ for ( S32 row = 0; row < numPaletteRows; ++row )
+ {
+ for ( S32 column = 0; column < numPaletteColumns; ++column )
+ {
+ S32 left = mPaletteRegionLeft + ( mPaletteRegionWidth * column ) / numPaletteColumns;
+ S32 top = mPaletteRegionTop - ( mPaletteRegionHeight * row ) / numPaletteRows;
+ S32 right = ( mPaletteRegionLeft + ( mPaletteRegionWidth * ( column + 1 ) ) / numPaletteColumns );
+ S32 bottom = ( mPaletteRegionTop - ( mPaletteRegionHeight * ( row + 1 ) ) / numPaletteRows );
+
+ // rect is flipped vertically when testing here
+ LLRect dropRect ( left, top, right, bottom );
+
+ if ( dropRect.pointInRect ( x, y ) )
+ {
+ if ( mPalette [ curEntry ] )
+ {
+ delete mPalette [ curEntry ];
+
+ mPalette [ curEntry ] = new LLColor4 ( getCurR (), getCurG (), getCurB (), 1.0f );
+
+ // save off color
+ std::ostringstream codec;
+ codec << "ColorPaletteEntry" << std::setfill ( '0' ) << std::setw ( 2 ) << curEntry + 1;
+ const std::string s ( codec.str () );
+ LLUIColorTable::instance().setColor(s, *mPalette [ curEntry ] );
+ }
+ }
+
+ ++curEntry;
+ }
+ }
+ }
+ }
+
+ // mouse button not down anymore
+ setMouseDownInHueRegion ( FALSE );
+ setMouseDownInLumRegion ( FALSE );
+
+ // mouse button not down in color swatch anymore
+ mMouseDownInSwatch = false;
+
+ if (hasMouseCapture())
+ {
+ gFocusMgr.setMouseCapture(NULL);
+ }
+
+ // dispatch to base class for the rest of things
+ return LLFloater::handleMouseUp ( x, y, mask );
}
//////////////////////////////////////////////////////////////////////////////
// cancel current color selection, revert to original and close picker
void LLFloaterColorPicker::cancelSelection ()
{
- // restore the previous color selection
- setCurRgb ( getOrigR (), getOrigG (), getOrigB () );
+ // restore the previous color selection
+ setCurRgb ( getOrigR (), getOrigG (), getOrigB () );
- // update in world item with original color via current swatch
- LLColorSwatchCtrl::onColorChanged( getSwatch(), LLColorSwatchCtrl::COLOR_CANCEL );
+ // update in world item with original color via current swatch
+ LLColorSwatchCtrl::onColorChanged( getSwatch(), LLColorSwatchCtrl::COLOR_CANCEL );
- // hide picker dialog
- this->setVisible ( FALSE );
+ // hide picker dialog
+ this->setVisible ( FALSE );
}
void LLFloaterColorPicker::setMouseDownInHueRegion ( BOOL mouse_down_in_region )
{
- mMouseDownInHueRegion = mouse_down_in_region;
- if (mouse_down_in_region)
- {
- if (gFocusMgr.childHasKeyboardFocus(this))
- {
- // get focus out of spinners so that they can update freely
- mSelectBtn->setFocus(TRUE);
- }
- }
+ mMouseDownInHueRegion = mouse_down_in_region;
+ if (mouse_down_in_region)
+ {
+ if (gFocusMgr.childHasKeyboardFocus(this))
+ {
+ // get focus out of spinners so that they can update freely
+ mSelectBtn->setFocus(TRUE);
+ }
+ }
}
void LLFloaterColorPicker::setMouseDownInLumRegion ( BOOL mouse_down_in_region )
{
- mMouseDownInLumRegion = mouse_down_in_region;
- if (mouse_down_in_region)
- {
- if (gFocusMgr.childHasKeyboardFocus(this))
- {
- // get focus out of spinners so that they can update freely
- mSelectBtn->setFocus(TRUE);
- }
- }
+ mMouseDownInLumRegion = mouse_down_in_region;
+ if (mouse_down_in_region)
+ {
+ if (gFocusMgr.childHasKeyboardFocus(this))
+ {
+ // get focus out of spinners so that they can update freely
+ mSelectBtn->setFocus(TRUE);
+ }
+ }
}
void LLFloaterColorPicker::setMouseDownInSwatch (BOOL mouse_down_in_swatch)
{
- mMouseDownInSwatch = mouse_down_in_swatch;
- if (mouse_down_in_swatch)
- {
- if (gFocusMgr.childHasKeyboardFocus(this))
- {
- // get focus out of spinners so that they can update freely
- mSelectBtn->setFocus(TRUE);
- }
- }
+ mMouseDownInSwatch = mouse_down_in_swatch;
+ if (mouse_down_in_swatch)
+ {
+ if (gFocusMgr.childHasKeyboardFocus(this))
+ {
+ // get focus out of spinners so that they can update freely
+ mSelectBtn->setFocus(TRUE);
+ }
+ }
}
-void LLFloaterColorPicker::setActive(BOOL active)
-{
- // shut down pipette tool if active
- if (!active && mPipetteBtn->getToggleState())
- {
- stopUsingPipette();
- }
- mActive = active;
+void LLFloaterColorPicker::setActive(BOOL active)
+{
+ // shut down pipette tool if active
+ if (!active && mPipetteBtn->getToggleState())
+ {
+ stopUsingPipette();
+ }
+ mActive = active;
}
void LLFloaterColorPicker::stopUsingPipette()
{
- if (LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance())
- {
- LLToolMgr::getInstance()->clearTransientTool();
- }
+ if (LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance())
+ {
+ LLToolMgr::getInstance()->clearTransientTool();
+ }
}
diff --git a/indra/newview/llfloatercolorpicker.h b/indra/newview/llfloatercolorpicker.h
index 39dbc5b763..ab7c6e3a43 100644
--- a/indra/newview/llfloatercolorpicker.h
+++ b/indra/newview/llfloatercolorpicker.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatercolorpicker.h
* @brief Generic system color picker
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,159 +40,159 @@ class LLCheckBoxCtrl;
//////////////////////////////////////////////////////////////////////////////
// floater class
-class LLFloaterColorPicker
- : public LLFloater
+class LLFloaterColorPicker
+ : public LLFloater
{
- public:
- LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate = FALSE);
- virtual ~LLFloaterColorPicker ();
-
- // overrides
- virtual BOOL postBuild ();
- virtual void draw ();
- virtual BOOL handleMouseDown ( S32 x, S32 y, MASK mask );
- virtual BOOL handleMouseUp ( S32 x, S32 y, MASK mask );
- virtual BOOL handleHover ( S32 x, S32 y, MASK mask );
- virtual void onMouseCaptureLost();
- virtual F32 getSwatchTransparency();
-
- // implicit methods
- void createUI ();
- void initUI ( F32 rValIn, F32 gValIn, F32 bValIn );
- void showUI ();
- void destroyUI ();
- void cancelSelection ();
- LLColorSwatchCtrl* getSwatch () { return mSwatch; };
- void setSwatch( LLColorSwatchCtrl* swatch) { mSwatch = swatch; }
-
- // mutator / accessor for original RGB value
- void setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn );
- void getOrigRgb ( F32& origROut, F32& origGOut, F32& origBOut );
- F32 getOrigR () { return origR; };
- F32 getOrigG () { return origG; };
- F32 getOrigB () { return origB; };
-
- // mutator / accessors for currernt RGB value
- void setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn );
- void getCurRgb ( F32& curROut, F32& curGOut, F32& curBOut );
- F32 getCurR () { return curR; };
- F32 getCurG () { return curG; };
- F32 getCurB () { return curB; };
-
- // mutator / accessors for currernt HSL value
- void setCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn );
- void getCurHsl ( F32& curHOut, F32& curSOut, F32& curLOut );
- F32 getCurH () { return curH; };
- F32 getCurS () { return curS; };
- F32 getCurL () { return curL; };
-
- // updates current RGB/HSL values based on point in picker
- BOOL updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn );
-
- // updates text entry fields with current RGB/HSL
- void updateTextEntry ();
-
- void stopUsingPipette();
-
- // mutator / accessor for mouse button pressed in region
- void setMouseDownInHueRegion ( BOOL mouse_down_in_region );
- BOOL getMouseDownInHueRegion () { return mMouseDownInHueRegion; };
-
- void setMouseDownInLumRegion ( BOOL mouse_down_in_region );
- BOOL getMouseDownInLumRegion () { return mMouseDownInLumRegion; };
-
- void setMouseDownInSwatch (BOOL mouse_down_in_swatch);
- BOOL getMouseDownInSwatch () { return mMouseDownInSwatch; }
-
- BOOL isColorChanged ();
-
- // called when text entries (RGB/HSL etc.) are changed by user
- void onTextEntryChanged ( LLUICtrl* ctrl );
-
- // convert RGB to HSL and vice-versa
- void hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32& bValOut );
- F32 hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn );
-
- void setActive(BOOL active);
-
- protected:
- // callbacks
- static void onClickCancel ( void* data );
- static void onClickSelect ( void* data );
- void onClickPipette ( );
- static void onTextCommit ( LLUICtrl* ctrl, void* data );
- static void onImmediateCheck ( LLUICtrl* ctrl, void* data );
- void onColorSelect( const class LLTextureEntry& te );
- private:
- // mutators for color values, can raise event to preview changes at object
- void selectCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn );
- void selectCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn );
- // draws color selection palette
- void drawPalette ();
-
- // find a complimentary color to the one passed in that can be used to highlight
- const LLColor4& getComplimentaryColor ( const LLColor4& backgroundColor );
-
- // original RGB values
- F32 origR, origG, origB;
-
- // current RGB/HSL values
- F32 curR, curG, curB;
- F32 curH, curS, curL;
-
- const S32 mComponents;
-
- BOOL mMouseDownInLumRegion;
- BOOL mMouseDownInHueRegion;
- BOOL mMouseDownInSwatch;
-
- const S32 mRGBViewerImageLeft;
- const S32 mRGBViewerImageTop;
- const S32 mRGBViewerImageWidth;
- const S32 mRGBViewerImageHeight;
-
- const S32 mLumRegionLeft;
- const S32 mLumRegionTop;
- const S32 mLumRegionWidth;
- const S32 mLumRegionHeight;
- const S32 mLumMarkerSize;
-
- // Preview of the current color.
- const S32 mSwatchRegionLeft;
- const S32 mSwatchRegionTop;
- const S32 mSwatchRegionWidth;
- const S32 mSwatchRegionHeight;
-
- LLView* mSwatchView;
-
- const S32 numPaletteColumns;
- const S32 numPaletteRows;
+ public:
+ LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate = FALSE);
+ virtual ~LLFloaterColorPicker ();
+
+ // overrides
+ virtual BOOL postBuild ();
+ virtual void draw ();
+ virtual BOOL handleMouseDown ( S32 x, S32 y, MASK mask );
+ virtual BOOL handleMouseUp ( S32 x, S32 y, MASK mask );
+ virtual BOOL handleHover ( S32 x, S32 y, MASK mask );
+ virtual void onMouseCaptureLost();
+ virtual F32 getSwatchTransparency();
+
+ // implicit methods
+ void createUI ();
+ void initUI ( F32 rValIn, F32 gValIn, F32 bValIn );
+ void showUI ();
+ void destroyUI ();
+ void cancelSelection ();
+ LLColorSwatchCtrl* getSwatch () { return mSwatch; };
+ void setSwatch( LLColorSwatchCtrl* swatch) { mSwatch = swatch; }
+
+ // mutator / accessor for original RGB value
+ void setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn );
+ void getOrigRgb ( F32& origROut, F32& origGOut, F32& origBOut );
+ F32 getOrigR () { return origR; };
+ F32 getOrigG () { return origG; };
+ F32 getOrigB () { return origB; };
+
+ // mutator / accessors for currernt RGB value
+ void setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn );
+ void getCurRgb ( F32& curROut, F32& curGOut, F32& curBOut );
+ F32 getCurR () { return curR; };
+ F32 getCurG () { return curG; };
+ F32 getCurB () { return curB; };
+
+ // mutator / accessors for currernt HSL value
+ void setCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn );
+ void getCurHsl ( F32& curHOut, F32& curSOut, F32& curLOut );
+ F32 getCurH () { return curH; };
+ F32 getCurS () { return curS; };
+ F32 getCurL () { return curL; };
+
+ // updates current RGB/HSL values based on point in picker
+ BOOL updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn );
+
+ // updates text entry fields with current RGB/HSL
+ void updateTextEntry ();
+
+ void stopUsingPipette();
+
+ // mutator / accessor for mouse button pressed in region
+ void setMouseDownInHueRegion ( BOOL mouse_down_in_region );
+ BOOL getMouseDownInHueRegion () { return mMouseDownInHueRegion; };
+
+ void setMouseDownInLumRegion ( BOOL mouse_down_in_region );
+ BOOL getMouseDownInLumRegion () { return mMouseDownInLumRegion; };
+
+ void setMouseDownInSwatch (BOOL mouse_down_in_swatch);
+ BOOL getMouseDownInSwatch () { return mMouseDownInSwatch; }
+
+ BOOL isColorChanged ();
+
+ // called when text entries (RGB/HSL etc.) are changed by user
+ void onTextEntryChanged ( LLUICtrl* ctrl );
+
+ // convert RGB to HSL and vice-versa
+ void hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32& bValOut );
+ F32 hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn );
+
+ void setActive(BOOL active);
+
+ protected:
+ // callbacks
+ static void onClickCancel ( void* data );
+ static void onClickSelect ( void* data );
+ void onClickPipette ( );
+ static void onTextCommit ( LLUICtrl* ctrl, void* data );
+ static void onImmediateCheck ( LLUICtrl* ctrl, void* data );
+ void onColorSelect( const class LLTextureEntry& te );
+ private:
+ // mutators for color values, can raise event to preview changes at object
+ void selectCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn );
+ void selectCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn );
+ // draws color selection palette
+ void drawPalette ();
+
+ // find a complimentary color to the one passed in that can be used to highlight
+ const LLColor4& getComplimentaryColor ( const LLColor4& backgroundColor );
+
+ // original RGB values
+ F32 origR, origG, origB;
+
+ // current RGB/HSL values
+ F32 curR, curG, curB;
+ F32 curH, curS, curL;
+
+ const S32 mComponents;
+
+ BOOL mMouseDownInLumRegion;
+ BOOL mMouseDownInHueRegion;
+ BOOL mMouseDownInSwatch;
+
+ const S32 mRGBViewerImageLeft;
+ const S32 mRGBViewerImageTop;
+ const S32 mRGBViewerImageWidth;
+ const S32 mRGBViewerImageHeight;
+
+ const S32 mLumRegionLeft;
+ const S32 mLumRegionTop;
+ const S32 mLumRegionWidth;
+ const S32 mLumRegionHeight;
+ const S32 mLumMarkerSize;
+
+ // Preview of the current color.
+ const S32 mSwatchRegionLeft;
+ const S32 mSwatchRegionTop;
+ const S32 mSwatchRegionWidth;
+ const S32 mSwatchRegionHeight;
+
+ LLView* mSwatchView;
+
+ const S32 numPaletteColumns;
+ const S32 numPaletteRows;
std::vector < LLColor4* > mPalette;
- S32 highlightEntry;
- const S32 mPaletteRegionLeft;
- const S32 mPaletteRegionTop;
- const S32 mPaletteRegionWidth;
- const S32 mPaletteRegionHeight;
+ S32 highlightEntry;
+ const S32 mPaletteRegionLeft;
+ const S32 mPaletteRegionTop;
+ const S32 mPaletteRegionWidth;
+ const S32 mPaletteRegionHeight;
- // image used to compose color grid
- LLPointer<class LLViewerTexture> mRGBImage;
+ // image used to compose color grid
+ LLPointer<class LLViewerTexture> mRGBImage;
- // current swatch in use
- LLColorSwatchCtrl* mSwatch;
+ // current swatch in use
+ LLColorSwatchCtrl* mSwatch;
- // are we actively tied to some output?
- BOOL mActive;
+ // are we actively tied to some output?
+ BOOL mActive;
- // enable/disable immediate updates
- LLCheckBoxCtrl* mApplyImmediateCheck;
- BOOL mCanApplyImmediately;
+ // enable/disable immediate updates
+ LLCheckBoxCtrl* mApplyImmediateCheck;
+ BOOL mCanApplyImmediately;
- LLButton* mSelectBtn;
- LLButton* mCancelBtn;
+ LLButton* mSelectBtn;
+ LLButton* mCancelBtn;
- LLButton* mPipetteBtn;
+ LLButton* mPipetteBtn;
- F32 mContextConeOpacity;
+ F32 mContextConeOpacity;
F32 mContextConeInAlpha;
F32 mContextConeOutAlpha;
F32 mContextConeFadeTime;
diff --git a/indra/newview/llfloaterconversationlog.cpp b/indra/newview/llfloaterconversationlog.cpp
index 4c910c5655..23f5c1e96d 100644
--- a/indra/newview/llfloaterconversationlog.cpp
+++ b/indra/newview/llfloaterconversationlog.cpp
@@ -32,103 +32,103 @@
#include "llmenubutton.h"
LLFloaterConversationLog::LLFloaterConversationLog(const LLSD& key)
-: LLFloater(key),
- mConversationLogList(NULL)
+: LLFloater(key),
+ mConversationLogList(NULL)
{
- mCommitCallbackRegistrar.add("CallLog.Action", boost::bind(&LLFloaterConversationLog::onCustomAction, this, _2));
- mEnableCallbackRegistrar.add("CallLog.Check", boost::bind(&LLFloaterConversationLog::isActionChecked, this, _2));
+ mCommitCallbackRegistrar.add("CallLog.Action", boost::bind(&LLFloaterConversationLog::onCustomAction, this, _2));
+ mEnableCallbackRegistrar.add("CallLog.Check", boost::bind(&LLFloaterConversationLog::isActionChecked, this, _2));
}
BOOL LLFloaterConversationLog::postBuild()
{
- mConversationLogList = getChild<LLConversationLogList>("conversation_log_list");
+ mConversationLogList = getChild<LLConversationLogList>("conversation_log_list");
- switch (gSavedSettings.getU32("CallLogSortOrder"))
- {
- case LLConversationLogList::E_SORT_BY_NAME:
- mConversationLogList->sortByName();
- break;
+ switch (gSavedSettings.getU32("CallLogSortOrder"))
+ {
+ case LLConversationLogList::E_SORT_BY_NAME:
+ mConversationLogList->sortByName();
+ break;
- case LLConversationLogList::E_SORT_BY_DATE:
- mConversationLogList->sortByDate();
- break;
- }
+ case LLConversationLogList::E_SORT_BY_DATE:
+ mConversationLogList->sortByDate();
+ break;
+ }
- // Use the context menu of the Conversation list for the Conversation tab gear menu.
- LLToggleableMenu* conversations_gear_menu = mConversationLogList->getContextMenu();
- if (conversations_gear_menu)
- {
- getChild<LLMenuButton>("conversations_gear_btn")->setMenu(conversations_gear_menu, LLMenuButton::MP_BOTTOM_LEFT);
- }
+ // Use the context menu of the Conversation list for the Conversation tab gear menu.
+ LLToggleableMenu* conversations_gear_menu = mConversationLogList->getContextMenu();
+ if (conversations_gear_menu)
+ {
+ getChild<LLMenuButton>("conversations_gear_btn")->setMenu(conversations_gear_menu, LLMenuButton::MP_BOTTOM_LEFT);
+ }
- getChild<LLFilterEditor>("people_filter_input")->setCommitCallback(boost::bind(&LLFloaterConversationLog::onFilterEdit, this, _2));
+ getChild<LLFilterEditor>("people_filter_input")->setCommitCallback(boost::bind(&LLFloaterConversationLog::onFilterEdit, this, _2));
- return LLFloater::postBuild();
+ return LLFloater::postBuild();
}
void LLFloaterConversationLog::draw()
{
- getChild<LLMenuButton>("conversations_gear_btn")->setEnabled(mConversationLogList->getSelectedItem() != NULL);
- LLFloater::draw();
+ getChild<LLMenuButton>("conversations_gear_btn")->setEnabled(mConversationLogList->getSelectedItem() != NULL);
+ LLFloater::draw();
}
void LLFloaterConversationLog::onFilterEdit(const std::string& search_string)
{
- std::string filter = search_string;
- LLStringUtil::trimHead(filter);
+ std::string filter = search_string;
+ LLStringUtil::trimHead(filter);
- mConversationLogList->setNameFilter(filter);
+ mConversationLogList->setNameFilter(filter);
}
void LLFloaterConversationLog::onCustomAction (const LLSD& userdata)
{
- const std::string command_name = userdata.asString();
-
- if ("sort_by_name" == command_name)
- {
- mConversationLogList->sortByName();
- gSavedSettings.setU32("CallLogSortOrder", LLConversationLogList::E_SORT_BY_NAME);
- }
- else if ("sort_by_date" == command_name)
- {
- mConversationLogList->sortByDate();
- gSavedSettings.setU32("CallLogSortOrder", LLConversationLogList::E_SORT_BY_DATE);
- }
- else if ("sort_friends_on_top" == command_name)
- {
- mConversationLogList->toggleSortFriendsOnTop();
- }
- else if ("view_nearby_chat_history" == command_name)
- {
- LLFloaterReg::showInstance("preview_conversation", LLSD(LLUUID::null), true);
- }
+ const std::string command_name = userdata.asString();
+
+ if ("sort_by_name" == command_name)
+ {
+ mConversationLogList->sortByName();
+ gSavedSettings.setU32("CallLogSortOrder", LLConversationLogList::E_SORT_BY_NAME);
+ }
+ else if ("sort_by_date" == command_name)
+ {
+ mConversationLogList->sortByDate();
+ gSavedSettings.setU32("CallLogSortOrder", LLConversationLogList::E_SORT_BY_DATE);
+ }
+ else if ("sort_friends_on_top" == command_name)
+ {
+ mConversationLogList->toggleSortFriendsOnTop();
+ }
+ else if ("view_nearby_chat_history" == command_name)
+ {
+ LLFloaterReg::showInstance("preview_conversation", LLSD(LLUUID::null), true);
+ }
}
bool LLFloaterConversationLog::isActionEnabled(const LLSD& userdata)
{
- return true;
+ return true;
}
bool LLFloaterConversationLog::isActionChecked(const LLSD& userdata)
{
- const std::string command_name = userdata.asString();
-
- U32 sort_order = gSavedSettings.getU32("CallLogSortOrder");
-
- if ("sort_by_name" == command_name)
- {
- return sort_order == LLConversationLogList::E_SORT_BY_NAME;
- }
- else if ("sort_by_date" == command_name)
- {
- return sort_order == LLConversationLogList::E_SORT_BY_DATE;
- }
- else if ("sort_friends_on_top" == command_name)
- {
- return gSavedSettings.getBOOL("SortFriendsFirst");
- }
-
- return false;
+ const std::string command_name = userdata.asString();
+
+ U32 sort_order = gSavedSettings.getU32("CallLogSortOrder");
+
+ if ("sort_by_name" == command_name)
+ {
+ return sort_order == LLConversationLogList::E_SORT_BY_NAME;
+ }
+ else if ("sort_by_date" == command_name)
+ {
+ return sort_order == LLConversationLogList::E_SORT_BY_DATE;
+ }
+ else if ("sort_friends_on_top" == command_name)
+ {
+ return gSavedSettings.getBOOL("SortFriendsFirst");
+ }
+
+ return false;
}
diff --git a/indra/newview/llfloaterconversationlog.h b/indra/newview/llfloaterconversationlog.h
index e971330f3d..9327fae227 100644
--- a/indra/newview/llfloaterconversationlog.h
+++ b/indra/newview/llfloaterconversationlog.h
@@ -34,22 +34,22 @@ class LLFloaterConversationLog : public LLFloater
{
public:
- LLFloaterConversationLog(const LLSD& key);
- virtual ~LLFloaterConversationLog(){};
+ LLFloaterConversationLog(const LLSD& key);
+ virtual ~LLFloaterConversationLog(){};
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- virtual void draw();
+ virtual void draw();
- void onFilterEdit(const std::string& search_string);
+ void onFilterEdit(const std::string& search_string);
private:
- void onCustomAction (const LLSD& userdata);
- bool isActionEnabled(const LLSD& userdata);
- bool isActionChecked(const LLSD& userdata);
+ void onCustomAction (const LLSD& userdata);
+ bool isActionEnabled(const LLSD& userdata);
+ bool isActionChecked(const LLSD& userdata);
- LLConversationLogList* mConversationLogList;
+ LLConversationLogList* mConversationLogList;
};
diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp
index 580a3f2610..9960864a60 100644
--- a/indra/newview/llfloaterconversationpreview.cpp
+++ b/indra/newview/llfloaterconversationpreview.cpp
@@ -39,19 +39,19 @@ const std::string LL_FCP_COMPLETE_NAME("complete_name");
const std::string LL_FCP_ACCOUNT_NAME("user_name");
LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_id)
-: LLFloater(session_id),
- mChatHistory(NULL),
- mSessionID(session_id.asUUID()),
- mCurrentPage(0),
- mPageSize(gSavedSettings.getS32("ConversationHistoryPageSize")),
- mAccountName(session_id[LL_FCP_ACCOUNT_NAME]),
- mCompleteName(session_id[LL_FCP_COMPLETE_NAME]),
- mMutex(),
- mShowHistory(false),
- mMessages(NULL),
- mHistoryThreadsBusy(false),
- mIsGroup(false),
- mOpened(false)
+: LLFloater(session_id),
+ mChatHistory(NULL),
+ mSessionID(session_id.asUUID()),
+ mCurrentPage(0),
+ mPageSize(gSavedSettings.getS32("ConversationHistoryPageSize")),
+ mAccountName(session_id[LL_FCP_ACCOUNT_NAME]),
+ mCompleteName(session_id[LL_FCP_COMPLETE_NAME]),
+ mMutex(),
+ mShowHistory(false),
+ mMessages(NULL),
+ mHistoryThreadsBusy(false),
+ mIsGroup(false),
+ mOpened(false)
{
}
@@ -61,213 +61,213 @@ LLFloaterConversationPreview::~LLFloaterConversationPreview()
BOOL LLFloaterConversationPreview::postBuild()
{
- mChatHistory = getChild<LLChatHistory>("chat_history");
-
- const LLConversation* conv = LLConversationLog::instance().getConversation(mSessionID);
- std::string name;
- std::string file;
-
- if (mAccountName != "")
- {
- name = mCompleteName;
- file = mAccountName;
- }
- else if (mSessionID != LLUUID::null && conv)
- {
- name = conv->getConversationName();
- file = conv->getHistoryFileName();
- mIsGroup = (LLIMModel::LLIMSession::GROUP_SESSION == conv->getConversationType());
- }
- else
- {
- name = LLTrans::getString("NearbyChatTitle");
- file = "chat";
- }
- mChatHistoryFileName = file;
- if (mIsGroup && !LLStringUtil::endsWith(mChatHistoryFileName, GROUP_CHAT_SUFFIX))
- {
- mChatHistoryFileName += GROUP_CHAT_SUFFIX;
- }
- LLStringUtil::format_map_t args;
- args["[NAME]"] = name;
- std::string title = getString("Title", args);
- setTitle(title);
-
- return LLFloater::postBuild();
+ mChatHistory = getChild<LLChatHistory>("chat_history");
+
+ const LLConversation* conv = LLConversationLog::instance().getConversation(mSessionID);
+ std::string name;
+ std::string file;
+
+ if (mAccountName != "")
+ {
+ name = mCompleteName;
+ file = mAccountName;
+ }
+ else if (mSessionID != LLUUID::null && conv)
+ {
+ name = conv->getConversationName();
+ file = conv->getHistoryFileName();
+ mIsGroup = (LLIMModel::LLIMSession::GROUP_SESSION == conv->getConversationType());
+ }
+ else
+ {
+ name = LLTrans::getString("NearbyChatTitle");
+ file = "chat";
+ }
+ mChatHistoryFileName = file;
+ if (mIsGroup && !LLStringUtil::endsWith(mChatHistoryFileName, GROUP_CHAT_SUFFIX))
+ {
+ mChatHistoryFileName += GROUP_CHAT_SUFFIX;
+ }
+ LLStringUtil::format_map_t args;
+ args["[NAME]"] = name;
+ std::string title = getString("Title", args);
+ setTitle(title);
+
+ return LLFloater::postBuild();
}
void LLFloaterConversationPreview::setPages(std::list<LLSD>* messages, const std::string& file_name)
{
- if(file_name == mChatHistoryFileName && messages)
- {
- // additional protection to avoid changes of mMessages in setPages()
- LLMutexLock lock(&mMutex);
- if (mMessages)
- {
- delete mMessages; // Clean up temporary message list with "Loading..." text
- }
- mMessages = messages;
- mCurrentPage = (mMessages->size() ? (mMessages->size() - 1) / mPageSize : 0);
-
- mPageSpinner->setEnabled(true);
- mPageSpinner->setMaxValue(mCurrentPage+1);
- mPageSpinner->set(mCurrentPage+1);
-
- std::string total_page_num = llformat("/ %d", mCurrentPage+1);
- getChild<LLTextBox>("page_num_label")->setValue(total_page_num);
- mShowHistory = true;
- }
- LLLoadHistoryThread* loadThread = LLLogChat::getInstance()->getLoadHistoryThread(mSessionID);
- if (loadThread)
- {
- loadThread->removeLoadEndSignal(boost::bind(&LLFloaterConversationPreview::setPages, this, _1, _2));
- }
+ if(file_name == mChatHistoryFileName && messages)
+ {
+ // additional protection to avoid changes of mMessages in setPages()
+ LLMutexLock lock(&mMutex);
+ if (mMessages)
+ {
+ delete mMessages; // Clean up temporary message list with "Loading..." text
+ }
+ mMessages = messages;
+ mCurrentPage = (mMessages->size() ? (mMessages->size() - 1) / mPageSize : 0);
+
+ mPageSpinner->setEnabled(true);
+ mPageSpinner->setMaxValue(mCurrentPage+1);
+ mPageSpinner->set(mCurrentPage+1);
+
+ std::string total_page_num = llformat("/ %d", mCurrentPage+1);
+ getChild<LLTextBox>("page_num_label")->setValue(total_page_num);
+ mShowHistory = true;
+ }
+ LLLoadHistoryThread* loadThread = LLLogChat::getInstance()->getLoadHistoryThread(mSessionID);
+ if (loadThread)
+ {
+ loadThread->removeLoadEndSignal(boost::bind(&LLFloaterConversationPreview::setPages, this, _1, _2));
+ }
}
void LLFloaterConversationPreview::draw()
{
- if(mShowHistory)
- {
- showHistory();
- mShowHistory = false;
- }
- LLFloater::draw();
+ if(mShowHistory)
+ {
+ showHistory();
+ mShowHistory = false;
+ }
+ LLFloater::draw();
}
void LLFloaterConversationPreview::onOpen(const LLSD& key)
{
- if (mOpened)
- {
- return;
- }
- mOpened = true;
- if (!LLLogChat::getInstance()->historyThreadsFinished(mSessionID))
- {
- LLNotificationsUtil::add("ChatHistoryIsBusyAlert");
- mHistoryThreadsBusy = true;
- closeFloater();
- return;
- }
- LLSD load_params;
- load_params["load_all_history"] = true;
- load_params["cut_off_todays_date"] = false;
- load_params["is_group"] = mIsGroup;
-
- // The temporary message list with "Loading..." text
- // Will be deleted upon loading completion in setPages() method
- mMessages = new std::list<LLSD>();
-
-
- LLSD loading;
- loading[LL_IM_TEXT] = LLTrans::getString("loading_chat_logs");
- mMessages->push_back(loading);
- mPageSpinner = getChild<LLSpinCtrl>("history_page_spin");
- mPageSpinner->setCommitCallback(boost::bind(&LLFloaterConversationPreview::onMoreHistoryBtnClick, this));
- mPageSpinner->setMinValue(1);
- mPageSpinner->set(1);
- mPageSpinner->setEnabled(false);
-
- // The actual message list to load from file
- // Will be deleted in a separate thread LLDeleteHistoryThread not to freeze UI
- // LLDeleteHistoryThread is started in destructor
- std::list<LLSD>* messages = new std::list<LLSD>();
-
- LLLogChat *log_chat_inst = LLLogChat::getInstance();
- log_chat_inst->cleanupHistoryThreads();
-
- LLLoadHistoryThread* loadThread = new LLLoadHistoryThread(mChatHistoryFileName, messages, load_params);
- loadThread->setLoadEndSignal(boost::bind(&LLFloaterConversationPreview::setPages, this, _1, _2));
- loadThread->start();
- log_chat_inst->addLoadHistoryThread(mSessionID, loadThread);
-
- LLDeleteHistoryThread* deleteThread = new LLDeleteHistoryThread(messages, loadThread);
- log_chat_inst->addDeleteHistoryThread(mSessionID, deleteThread);
-
- mShowHistory = true;
+ if (mOpened)
+ {
+ return;
+ }
+ mOpened = true;
+ if (!LLLogChat::getInstance()->historyThreadsFinished(mSessionID))
+ {
+ LLNotificationsUtil::add("ChatHistoryIsBusyAlert");
+ mHistoryThreadsBusy = true;
+ closeFloater();
+ return;
+ }
+ LLSD load_params;
+ load_params["load_all_history"] = true;
+ load_params["cut_off_todays_date"] = false;
+ load_params["is_group"] = mIsGroup;
+
+ // The temporary message list with "Loading..." text
+ // Will be deleted upon loading completion in setPages() method
+ mMessages = new std::list<LLSD>();
+
+
+ LLSD loading;
+ loading[LL_IM_TEXT] = LLTrans::getString("loading_chat_logs");
+ mMessages->push_back(loading);
+ mPageSpinner = getChild<LLSpinCtrl>("history_page_spin");
+ mPageSpinner->setCommitCallback(boost::bind(&LLFloaterConversationPreview::onMoreHistoryBtnClick, this));
+ mPageSpinner->setMinValue(1);
+ mPageSpinner->set(1);
+ mPageSpinner->setEnabled(false);
+
+ // The actual message list to load from file
+ // Will be deleted in a separate thread LLDeleteHistoryThread not to freeze UI
+ // LLDeleteHistoryThread is started in destructor
+ std::list<LLSD>* messages = new std::list<LLSD>();
+
+ LLLogChat *log_chat_inst = LLLogChat::getInstance();
+ log_chat_inst->cleanupHistoryThreads();
+
+ LLLoadHistoryThread* loadThread = new LLLoadHistoryThread(mChatHistoryFileName, messages, load_params);
+ loadThread->setLoadEndSignal(boost::bind(&LLFloaterConversationPreview::setPages, this, _1, _2));
+ loadThread->start();
+ log_chat_inst->addLoadHistoryThread(mSessionID, loadThread);
+
+ LLDeleteHistoryThread* deleteThread = new LLDeleteHistoryThread(messages, loadThread);
+ log_chat_inst->addDeleteHistoryThread(mSessionID, deleteThread);
+
+ mShowHistory = true;
}
void LLFloaterConversationPreview::onClose(bool app_quitting)
{
- mOpened = false;
- if (!mHistoryThreadsBusy)
- {
- LLDeleteHistoryThread* deleteThread = LLLogChat::getInstance()->getDeleteHistoryThread(mSessionID);
- if (deleteThread)
- {
- deleteThread->start();
- }
- }
+ mOpened = false;
+ if (!mHistoryThreadsBusy)
+ {
+ LLDeleteHistoryThread* deleteThread = LLLogChat::getInstance()->getDeleteHistoryThread(mSessionID);
+ if (deleteThread)
+ {
+ deleteThread->start();
+ }
+ }
}
void LLFloaterConversationPreview::showHistory()
{
- // additional protection to avoid changes of mMessages in setPages
- LLMutexLock lock(&mMutex);
- if(mMessages == NULL || !mMessages->size() || mCurrentPage * mPageSize >= mMessages->size())
- {
- return;
- }
-
- mChatHistory->clear();
- std::ostringstream message;
- std::list<LLSD>::const_iterator iter = mMessages->begin();
- std::advance(iter, mCurrentPage * mPageSize);
-
- for (int msg_num = 0; iter != mMessages->end() && msg_num < mPageSize; ++iter, ++msg_num)
- {
- LLSD msg = *iter;
-
- LLUUID from_id = LLUUID::null;
- std::string time = msg["time"].asString();
- std::string from = msg["from"].asString();
- std::string message = msg["message"].asString();
-
- if (msg["from_id"].isDefined())
- {
- from_id = msg["from_id"].asUUID();
- }
- else
- {
- std::string legacy_name = gCacheName->buildLegacyName(from);
- from_id = LLAvatarNameCache::getInstance()->findIdByName(legacy_name);
- }
-
- LLChat chat;
- chat.mFromID = from_id;
- chat.mSessionID = mSessionID;
- chat.mFromName = from;
- chat.mTimeStr = time;
- chat.mChatStyle = CHAT_STYLE_HISTORY;
- chat.mText = message;
-
- if (from_id.isNull() && SYSTEM_FROM == from)
- {
- chat.mSourceType = CHAT_SOURCE_SYSTEM;
-
- }
- else if (from_id.isNull())
- {
- chat.mSourceType = LLFloaterIMNearbyChat::isWordsName(from) ? CHAT_SOURCE_UNKNOWN : CHAT_SOURCE_OBJECT;
- }
-
- LLSD chat_args;
- chat_args["use_plain_text_chat_history"] =
- gSavedSettings.getBOOL("PlainTextChatHistory");
- chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
- chat_args["show_names_for_p2p_conv"] = gSavedSettings.getBOOL("IMShowNamesForP2PConv");
-
- mChatHistory->appendMessage(chat,chat_args);
- }
+ // additional protection to avoid changes of mMessages in setPages
+ LLMutexLock lock(&mMutex);
+ if(mMessages == NULL || !mMessages->size() || mCurrentPage * mPageSize >= mMessages->size())
+ {
+ return;
+ }
+
+ mChatHistory->clear();
+ std::ostringstream message;
+ std::list<LLSD>::const_iterator iter = mMessages->begin();
+ std::advance(iter, mCurrentPage * mPageSize);
+
+ for (int msg_num = 0; iter != mMessages->end() && msg_num < mPageSize; ++iter, ++msg_num)
+ {
+ LLSD msg = *iter;
+
+ LLUUID from_id = LLUUID::null;
+ std::string time = msg["time"].asString();
+ std::string from = msg["from"].asString();
+ std::string message = msg["message"].asString();
+
+ if (msg["from_id"].isDefined())
+ {
+ from_id = msg["from_id"].asUUID();
+ }
+ else
+ {
+ std::string legacy_name = gCacheName->buildLegacyName(from);
+ from_id = LLAvatarNameCache::getInstance()->findIdByName(legacy_name);
+ }
+
+ LLChat chat;
+ chat.mFromID = from_id;
+ chat.mSessionID = mSessionID;
+ chat.mFromName = from;
+ chat.mTimeStr = time;
+ chat.mChatStyle = CHAT_STYLE_HISTORY;
+ chat.mText = message;
+
+ if (from_id.isNull() && SYSTEM_FROM == from)
+ {
+ chat.mSourceType = CHAT_SOURCE_SYSTEM;
+
+ }
+ else if (from_id.isNull())
+ {
+ chat.mSourceType = LLFloaterIMNearbyChat::isWordsName(from) ? CHAT_SOURCE_UNKNOWN : CHAT_SOURCE_OBJECT;
+ }
+
+ LLSD chat_args;
+ chat_args["use_plain_text_chat_history"] =
+ gSavedSettings.getBOOL("PlainTextChatHistory");
+ chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
+ chat_args["show_names_for_p2p_conv"] = gSavedSettings.getBOOL("IMShowNamesForP2PConv");
+
+ mChatHistory->appendMessage(chat,chat_args);
+ }
}
void LLFloaterConversationPreview::onMoreHistoryBtnClick()
{
- mCurrentPage = (int)(mPageSpinner->getValueF32());
- if (!mCurrentPage)
- {
- return;
- }
-
- mCurrentPage--;
- mShowHistory = true;
+ mCurrentPage = (int)(mPageSpinner->getValueF32());
+ if (!mCurrentPage)
+ {
+ return;
+ }
+
+ mCurrentPage--;
+ mShowHistory = true;
}
diff --git a/indra/newview/llfloaterconversationpreview.h b/indra/newview/llfloaterconversationpreview.h
index 7ca4ee6945..f7f54a318d 100644
--- a/indra/newview/llfloaterconversationpreview.h
+++ b/indra/newview/llfloaterconversationpreview.h
@@ -29,8 +29,8 @@
#include "llchathistory.h"
#include "llfloater.h"
-extern const std::string LL_FCP_COMPLETE_NAME; //"complete_name"
-extern const std::string LL_FCP_ACCOUNT_NAME; //"user_name"
+extern const std::string LL_FCP_COMPLETE_NAME; //"complete_name"
+extern const std::string LL_FCP_ACCOUNT_NAME; //"user_name"
class LLSpinCtrl;
@@ -38,35 +38,35 @@ class LLFloaterConversationPreview : public LLFloater
{
public:
- LLFloaterConversationPreview(const LLSD& session_id);
- virtual ~LLFloaterConversationPreview();
+ LLFloaterConversationPreview(const LLSD& session_id);
+ virtual ~LLFloaterConversationPreview();
- virtual BOOL postBuild();
- void setPages(std::list<LLSD>* messages,const std::string& file_name);
+ virtual BOOL postBuild();
+ void setPages(std::list<LLSD>* messages,const std::string& file_name);
- virtual void draw();
- virtual void onOpen(const LLSD& key);
- virtual void onClose(bool app_quitting);
+ virtual void draw();
+ virtual void onOpen(const LLSD& key);
+ virtual void onClose(bool app_quitting);
private:
- void onMoreHistoryBtnClick();
- void showHistory();
+ void onMoreHistoryBtnClick();
+ void showHistory();
- LLMutex mMutex;
- LLSpinCtrl* mPageSpinner;
- LLChatHistory* mChatHistory;
- LLUUID mSessionID;
- int mCurrentPage;
- int mPageSize;
+ LLMutex mMutex;
+ LLSpinCtrl* mPageSpinner;
+ LLChatHistory* mChatHistory;
+ LLUUID mSessionID;
+ int mCurrentPage;
+ int mPageSize;
- std::list<LLSD>* mMessages;
- std::string mAccountName;
- std::string mCompleteName;
- std::string mChatHistoryFileName;
- bool mShowHistory;
- bool mHistoryThreadsBusy;
- bool mOpened;
- bool mIsGroup;
+ std::list<LLSD>* mMessages;
+ std::string mAccountName;
+ std::string mCompleteName;
+ std::string mChatHistoryFileName;
+ bool mShowHistory;
+ bool mHistoryThreadsBusy;
+ bool mOpened;
+ bool mIsGroup;
};
#endif /* LLFLOATERCONVERSATIONPREVIEW_H_ */
diff --git a/indra/newview/llfloatercreatelandmark.cpp b/indra/newview/llfloatercreatelandmark.cpp
index b82d8a29ba..d2ca0aaf69 100644
--- a/indra/newview/llfloatercreatelandmark.cpp
+++ b/indra/newview/llfloatercreatelandmark.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatercreatelandmark.cpp
* @brief LLFloaterCreateLandmark class implementation
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,9 +49,9 @@ typedef std::pair<LLUUID, std::string> folder_pair_t;
class LLLandmarksInventoryObserver : public LLInventoryObserver
{
public:
- LLLandmarksInventoryObserver(LLFloaterCreateLandmark* create_landmark_floater) :
- mFloater(create_landmark_floater)
- {}
+ LLLandmarksInventoryObserver(LLFloaterCreateLandmark* create_landmark_floater) :
+ mFloater(create_landmark_floater)
+ {}
void changed(U32 mask) override
{
@@ -66,8 +66,8 @@ public:
}
protected:
- void checkCreated(U32 mask)
- {
+ void checkCreated(U32 mask)
+ {
if (gInventory.getAddedIDs().empty())
{
return;
@@ -80,8 +80,8 @@ protected:
return;
}
- mFloater->setItem(gInventory.getAddedIDs());
- }
+ mFloater->setItem(gInventory.getAddedIDs());
+ }
void checkChanged(U32 mask)
{
@@ -101,151 +101,151 @@ protected:
}
private:
- LLFloaterCreateLandmark* mFloater;
+ LLFloaterCreateLandmark* mFloater;
};
LLFloaterCreateLandmark::LLFloaterCreateLandmark(const LLSD& key)
- : LLFloater("add_landmark"),
- mItem(NULL)
+ : LLFloater("add_landmark"),
+ mItem(NULL)
{
- mInventoryObserver = new LLLandmarksInventoryObserver(this);
+ mInventoryObserver = new LLLandmarksInventoryObserver(this);
}
LLFloaterCreateLandmark::~LLFloaterCreateLandmark()
{
- removeObserver();
+ removeObserver();
}
BOOL LLFloaterCreateLandmark::postBuild()
{
- mFolderCombo = getChild<LLComboBox>("folder_combo");
- mLandmarkTitleEditor = getChild<LLLineEditor>("title_editor");
- mNotesEditor = getChild<LLTextEditor>("notes_editor");
+ mFolderCombo = getChild<LLComboBox>("folder_combo");
+ mLandmarkTitleEditor = getChild<LLLineEditor>("title_editor");
+ mNotesEditor = getChild<LLTextEditor>("notes_editor");
- getChild<LLTextBox>("new_folder_textbox")->setURLClickedCallback(boost::bind(&LLFloaterCreateLandmark::onCreateFolderClicked, this));
- getChild<LLButton>("ok_btn")->setClickedCallback(boost::bind(&LLFloaterCreateLandmark::onSaveClicked, this));
- getChild<LLButton>("cancel_btn")->setClickedCallback(boost::bind(&LLFloaterCreateLandmark::onCancelClicked, this));
+ getChild<LLTextBox>("new_folder_textbox")->setURLClickedCallback(boost::bind(&LLFloaterCreateLandmark::onCreateFolderClicked, this));
+ getChild<LLButton>("ok_btn")->setClickedCallback(boost::bind(&LLFloaterCreateLandmark::onSaveClicked, this));
+ getChild<LLButton>("cancel_btn")->setClickedCallback(boost::bind(&LLFloaterCreateLandmark::onCancelClicked, this));
mLandmarkTitleEditor->setCommitCallback([this](LLUICtrl* ctrl, const LLSD& param) { onCommitTextChanges(); });
mNotesEditor->setCommitCallback([this](LLUICtrl* ctrl, const LLSD& param) { onCommitTextChanges(); });
- mLandmarksID = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ mLandmarksID = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
- return TRUE;
+ return TRUE;
}
void LLFloaterCreateLandmark::removeObserver()
{
- if (gInventory.containsObserver(mInventoryObserver))
- gInventory.removeObserver(mInventoryObserver);
+ if (gInventory.containsObserver(mInventoryObserver))
+ gInventory.removeObserver(mInventoryObserver);
}
void LLFloaterCreateLandmark::onOpen(const LLSD& key)
{
- LLUUID dest_folder = LLUUID();
- if (key.has("dest_folder"))
- {
- dest_folder = key["dest_folder"].asUUID();
- }
- mItem = NULL;
- gInventory.addObserver(mInventoryObserver);
- setLandmarkInfo(dest_folder);
- populateFoldersList(dest_folder);
+ LLUUID dest_folder = LLUUID();
+ if (key.has("dest_folder"))
+ {
+ dest_folder = key["dest_folder"].asUUID();
+ }
+ mItem = NULL;
+ gInventory.addObserver(mInventoryObserver);
+ setLandmarkInfo(dest_folder);
+ populateFoldersList(dest_folder);
}
void LLFloaterCreateLandmark::setLandmarkInfo(const LLUUID &folder_id)
{
- LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
- LLParcel* parcel = parcel_mgr->getAgentParcel();
- std::string name = parcel->getName();
- LLVector3 agent_pos = gAgent.getPositionAgent();
-
- if (name.empty())
- {
- S32 region_x = ll_round(agent_pos.mV[VX]);
- S32 region_y = ll_round(agent_pos.mV[VY]);
- S32 region_z = ll_round(agent_pos.mV[VZ]);
-
- std::string region_name;
- LLViewerRegion* region = parcel_mgr->getSelectionRegion();
- if (region)
- {
- region_name = region->getName();
- }
- else
- {
- std::string desc;
- LLAgentUI::buildLocationString(desc, LLAgentUI::LOCATION_FORMAT_NORMAL, agent_pos);
- region_name = desc;
- }
-
- mLandmarkTitleEditor->setText(llformat("%s (%d, %d, %d)",
- region_name.c_str(), region_x, region_y, region_z));
- }
- else
- {
- mLandmarkTitleEditor->setText(name);
- }
-
- LLLandmarkActions::createLandmarkHere(name, "", folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE));
+ LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+ LLParcel* parcel = parcel_mgr->getAgentParcel();
+ std::string name = parcel->getName();
+ LLVector3 agent_pos = gAgent.getPositionAgent();
+
+ if (name.empty())
+ {
+ S32 region_x = ll_round(agent_pos.mV[VX]);
+ S32 region_y = ll_round(agent_pos.mV[VY]);
+ S32 region_z = ll_round(agent_pos.mV[VZ]);
+
+ std::string region_name;
+ LLViewerRegion* region = parcel_mgr->getSelectionRegion();
+ if (region)
+ {
+ region_name = region->getName();
+ }
+ else
+ {
+ std::string desc;
+ LLAgentUI::buildLocationString(desc, LLAgentUI::LOCATION_FORMAT_NORMAL, agent_pos);
+ region_name = desc;
+ }
+
+ mLandmarkTitleEditor->setText(llformat("%s (%d, %d, %d)",
+ region_name.c_str(), region_x, region_y, region_z));
+ }
+ else
+ {
+ mLandmarkTitleEditor->setText(name);
+ }
+
+ LLLandmarkActions::createLandmarkHere(name, "", folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE));
}
bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right)
{
- return left.second < right.second;
+ return left.second < right.second;
}
void LLFloaterCreateLandmark::populateFoldersList(const LLUUID &folder_id)
{
- // Collect all folders that can contain landmarks.
- LLInventoryModel::cat_array_t cats;
- LLPanelLandmarkInfo::collectLandmarkFolders(cats);
-
- mFolderCombo->removeall();
-
- // Put the "My Favorites" folder first in list.
- LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- LLViewerInventoryCategory* favorites_cat = gInventory.getCategory(favorites_id);
- if (!favorites_cat)
- {
- LL_WARNS() << "Cannot find the favorites folder" << LL_ENDL;
- }
- else
- {
- mFolderCombo->add(getString("favorites_bar"), favorites_cat->getUUID());
- }
-
- // Add the "Landmarks" category.
- const LLViewerInventoryCategory* lmcat = gInventory.getCategory(mLandmarksID);
- if (!lmcat)
- {
- LL_WARNS() << "Cannot find the landmarks folder" << LL_ENDL;
- }
- else
- {
- std::string cat_full_name = LLPanelLandmarkInfo::getFullFolderName(lmcat);
- mFolderCombo->add(cat_full_name, lmcat->getUUID());
- }
-
- typedef std::vector<folder_pair_t> folder_vec_t;
- folder_vec_t folders;
- // Sort the folders by their full name.
- for (S32 i = 0; i < cats.size(); i++)
- {
- const LLViewerInventoryCategory* cat = cats.at(i);
- std::string cat_full_name = LLPanelLandmarkInfo::getFullFolderName(cat);
- folders.push_back(folder_pair_t(cat->getUUID(), cat_full_name));
- }
- sort(folders.begin(), folders.end(), cmp_folders);
-
- // Finally, populate the combobox.
- for (folder_vec_t::const_iterator it = folders.begin(); it != folders.end(); it++)
- mFolderCombo->add(it->second, LLSD(it->first));
-
- if (folder_id.notNull())
- {
- mFolderCombo->setCurrentByID(folder_id);
- }
+ // Collect all folders that can contain landmarks.
+ LLInventoryModel::cat_array_t cats;
+ LLPanelLandmarkInfo::collectLandmarkFolders(cats);
+
+ mFolderCombo->removeall();
+
+ // Put the "My Favorites" folder first in list.
+ LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ LLViewerInventoryCategory* favorites_cat = gInventory.getCategory(favorites_id);
+ if (!favorites_cat)
+ {
+ LL_WARNS() << "Cannot find the favorites folder" << LL_ENDL;
+ }
+ else
+ {
+ mFolderCombo->add(getString("favorites_bar"), favorites_cat->getUUID());
+ }
+
+ // Add the "Landmarks" category.
+ const LLViewerInventoryCategory* lmcat = gInventory.getCategory(mLandmarksID);
+ if (!lmcat)
+ {
+ LL_WARNS() << "Cannot find the landmarks folder" << LL_ENDL;
+ }
+ else
+ {
+ std::string cat_full_name = LLPanelLandmarkInfo::getFullFolderName(lmcat);
+ mFolderCombo->add(cat_full_name, lmcat->getUUID());
+ }
+
+ typedef std::vector<folder_pair_t> folder_vec_t;
+ folder_vec_t folders;
+ // Sort the folders by their full name.
+ for (S32 i = 0; i < cats.size(); i++)
+ {
+ const LLViewerInventoryCategory* cat = cats.at(i);
+ std::string cat_full_name = LLPanelLandmarkInfo::getFullFolderName(cat);
+ folders.push_back(folder_pair_t(cat->getUUID(), cat_full_name));
+ }
+ sort(folders.begin(), folders.end(), cmp_folders);
+
+ // Finally, populate the combobox.
+ for (folder_vec_t::const_iterator it = folders.begin(); it != folders.end(); it++)
+ mFolderCombo->add(it->second, LLSD(it->first));
+
+ if (folder_id.notNull())
+ {
+ mFolderCombo->setCurrentByID(folder_id);
+ }
}
void LLFloaterCreateLandmark::onCommitTextChanges()
@@ -277,123 +277,123 @@ void LLFloaterCreateLandmark::onCommitTextChanges()
void LLFloaterCreateLandmark::onCreateFolderClicked()
{
- LLNotificationsUtil::add("CreateLandmarkFolder", LLSD(), LLSD(),
- [this](const LLSD&notif, const LLSD&resp)
- {
- S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
- if (opt == 0)
- {
- std::string folder_name = resp["message"].asString();
- if (!folder_name.empty())
- {
- inventory_func_type func = boost::bind(&LLFloaterCreateLandmark::folderCreatedCallback, this, _1);
- gInventory.createNewCategory(mLandmarksID, LLFolderType::FT_NONE, folder_name, func);
- gInventory.notifyObservers();
- }
- }
- });
+ LLNotificationsUtil::add("CreateLandmarkFolder", LLSD(), LLSD(),
+ [this](const LLSD&notif, const LLSD&resp)
+ {
+ S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
+ if (opt == 0)
+ {
+ std::string folder_name = resp["message"].asString();
+ if (!folder_name.empty())
+ {
+ inventory_func_type func = boost::bind(&LLFloaterCreateLandmark::folderCreatedCallback, this, _1);
+ gInventory.createNewCategory(mLandmarksID, LLFolderType::FT_NONE, folder_name, func);
+ gInventory.notifyObservers();
+ }
+ }
+ });
}
void LLFloaterCreateLandmark::folderCreatedCallback(LLUUID folder_id)
{
- populateFoldersList(folder_id);
+ populateFoldersList(folder_id);
}
void LLFloaterCreateLandmark::onSaveClicked()
{
- if (mItem.isNull())
- {
- closeFloater();
- return;
- }
-
-
- std::string current_title_value = mLandmarkTitleEditor->getText();
- std::string item_title_value = mItem->getName();
- std::string current_notes_value = mNotesEditor->getText();
- std::string item_notes_value = mItem->getDescription();
-
- LLStringUtil::trim(current_title_value);
- LLStringUtil::trim(current_notes_value);
-
- LLUUID folder_id = mFolderCombo->getValue().asUUID();
- bool change_parent = folder_id != mItem->getParentUUID();
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(mItem);
-
- if (!current_title_value.empty() &&
- (item_title_value != current_title_value || item_notes_value != current_notes_value))
- {
- new_item->rename(current_title_value);
- new_item->setDescription(current_notes_value);
- LLPointer<LLInventoryCallback> cb;
- if (change_parent)
- {
- cb = new LLUpdateLandmarkParent(new_item, folder_id);
- }
- LLInventoryModel::LLCategoryUpdate up(mItem->getParentUUID(), 0);
- gInventory.accountForUpdate(up);
- update_inventory_item(new_item, cb);
- }
- else if (change_parent)
- {
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(),-1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(folder_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
-
- new_item->setParent(folder_id);
- new_item->updateParentOnServer(FALSE);
- }
+ if (mItem.isNull())
+ {
+ closeFloater();
+ return;
+ }
+
+
+ std::string current_title_value = mLandmarkTitleEditor->getText();
+ std::string item_title_value = mItem->getName();
+ std::string current_notes_value = mNotesEditor->getText();
+ std::string item_notes_value = mItem->getDescription();
+
+ LLStringUtil::trim(current_title_value);
+ LLStringUtil::trim(current_notes_value);
+
+ LLUUID folder_id = mFolderCombo->getValue().asUUID();
+ bool change_parent = folder_id != mItem->getParentUUID();
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(mItem);
+
+ if (!current_title_value.empty() &&
+ (item_title_value != current_title_value || item_notes_value != current_notes_value))
+ {
+ new_item->rename(current_title_value);
+ new_item->setDescription(current_notes_value);
+ LLPointer<LLInventoryCallback> cb;
+ if (change_parent)
+ {
+ cb = new LLUpdateLandmarkParent(new_item, folder_id);
+ }
+ LLInventoryModel::LLCategoryUpdate up(mItem->getParentUUID(), 0);
+ gInventory.accountForUpdate(up);
+ update_inventory_item(new_item, cb);
+ }
+ else if (change_parent)
+ {
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(),-1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(folder_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ new_item->setParent(folder_id);
+ new_item->updateParentOnServer(FALSE);
+ }
removeObserver();
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
- closeFloater();
+ closeFloater();
}
void LLFloaterCreateLandmark::onCancelClicked()
{
removeObserver();
- if (!mItem.isNull())
- {
- LLUUID item_id = mItem->getUUID();
- remove_inventory_item(item_id, NULL);
- }
- closeFloater();
+ if (!mItem.isNull())
+ {
+ LLUUID item_id = mItem->getUUID();
+ remove_inventory_item(item_id, NULL);
+ }
+ closeFloater();
}
void LLFloaterCreateLandmark::setItem(const uuid_set_t& items)
{
- for (uuid_set_t::const_iterator item_iter = items.begin();
- item_iter != items.end();
- ++item_iter)
- {
- const LLUUID& item_id = (*item_iter);
- if(!highlight_offered_object(item_id))
- {
- continue;
- }
-
- LLInventoryItem* item = gInventory.getItem(item_id);
-
- llassert(item);
- if (item && (LLAssetType::AT_LANDMARK == item->getType()) )
- {
- if(!getItem())
- {
- mItem = item;
+ for (uuid_set_t::const_iterator item_iter = items.begin();
+ item_iter != items.end();
+ ++item_iter)
+ {
+ const LLUUID& item_id = (*item_iter);
+ if(!highlight_offered_object(item_id))
+ {
+ continue;
+ }
+
+ LLInventoryItem* item = gInventory.getItem(item_id);
+
+ llassert(item);
+ if (item && (LLAssetType::AT_LANDMARK == item->getType()) )
+ {
+ if(!getItem())
+ {
+ mItem = item;
mAssetID = mItem->getAssetUUID();
setVisibleAndFrontmost(true);
- break;
- }
- }
- }
+ break;
+ }
+ }
+ }
}
void LLFloaterCreateLandmark::updateItem(const uuid_set_t& items, U32 mask)
diff --git a/indra/newview/llfloatercreatelandmark.h b/indra/newview/llfloatercreatelandmark.h
index d84f5ae1fc..dc121677a4 100644
--- a/indra/newview/llfloatercreatelandmark.h
+++ b/indra/newview/llfloatercreatelandmark.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatercreatelandmark.h
* @brief LLFloaterCreateLandmark class definition
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,42 +36,42 @@ class LLTextEditor;
class LLLandmarksInventoryObserver;
class LLFloaterCreateLandmark:
- public LLFloater
+ public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- LLFloaterCreateLandmark(const LLSD& key);
- ~LLFloaterCreateLandmark();
+ LLFloaterCreateLandmark(const LLSD& key);
+ ~LLFloaterCreateLandmark();
- BOOL postBuild();
- void onOpen(const LLSD& key);
+ BOOL postBuild();
+ void onOpen(const LLSD& key);
- void setItem(const uuid_set_t& items);
+ void setItem(const uuid_set_t& items);
void updateItem(const uuid_set_t& items, U32 mask);
- LLInventoryItem* getItem() { return mItem; }
+ LLInventoryItem* getItem() { return mItem; }
private:
- void setLandmarkInfo(const LLUUID &folder_id);
- void removeObserver();
- void populateFoldersList(const LLUUID &folder_id = LLUUID::null);
+ void setLandmarkInfo(const LLUUID &folder_id);
+ void removeObserver();
+ void populateFoldersList(const LLUUID &folder_id = LLUUID::null);
void onCommitTextChanges();
- void onCreateFolderClicked();
- void onSaveClicked();
- void onCancelClicked();
+ void onCreateFolderClicked();
+ void onSaveClicked();
+ void onCancelClicked();
- void folderCreatedCallback(LLUUID folder_id);
+ void folderCreatedCallback(LLUUID folder_id);
- LLComboBox* mFolderCombo;
- LLLineEditor* mLandmarkTitleEditor;
- LLTextEditor* mNotesEditor;
- LLUUID mLandmarksID;
- LLUUID mAssetID;
+ LLComboBox* mFolderCombo;
+ LLLineEditor* mLandmarkTitleEditor;
+ LLTextEditor* mNotesEditor;
+ LLUUID mLandmarksID;
+ LLUUID mAssetID;
- LLLandmarksInventoryObserver* mInventoryObserver;
- LLPointer<LLInventoryItem> mItem;
+ LLLandmarksInventoryObserver* mInventoryObserver;
+ LLPointer<LLInventoryItem> mItem;
};
#endif
diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp
index 819b2bcee2..6b87ec2f98 100644
--- a/indra/newview/llfloaterdeleteprefpreset.cpp
+++ b/indra/newview/llfloaterdeleteprefpreset.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterdeleteprefpreset.cpp
* @brief Floater to delete a graphics / camera preset
*
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,29 +37,29 @@
#include "llfloaterreg.h"
LLFloaterDeletePrefPreset::LLFloaterDeletePrefPreset(const LLSD &key)
-: LLFloater(key)
+: LLFloater(key)
{
}
// virtual
BOOL LLFloaterDeletePrefPreset::postBuild()
{
- LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences");
- if (preferences)
- {
- preferences->addDependentFloater(this);
- }
- getChild<LLButton>("delete")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnDelete, this));
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnCancel, this));
- LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeletePrefPreset::onPresetsListChange, this));
-
- return TRUE;
+ LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences");
+ if (preferences)
+ {
+ preferences->addDependentFloater(this);
+ }
+ getChild<LLButton>("delete")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnDelete, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnCancel, this));
+ LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeletePrefPreset::onPresetsListChange, this));
+
+ return TRUE;
}
void LLFloaterDeletePrefPreset::onOpen(const LLSD& key)
{
- mSubdirectory = key.asString();
- std::string title_type = std::string("title_") + mSubdirectory;
+ mSubdirectory = key.asString();
+ std::string title_type = std::string("title_") + mSubdirectory;
if (hasString(title_type))
{
std::string floater_title = getString(title_type);
@@ -71,47 +71,47 @@ void LLFloaterDeletePrefPreset::onOpen(const LLSD& key)
setTitle(title_type);
}
- LLComboBox* combo = getChild<LLComboBox>("preset_combo");
- EDefaultOptions option = DEFAULT_HIDE;
- bool action;
- action = LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option);
+ LLComboBox* combo = getChild<LLComboBox>("preset_combo");
+ EDefaultOptions option = DEFAULT_HIDE;
+ bool action;
+ action = LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option);
- LLButton* delete_btn = getChild<LLButton>("delete");
- delete_btn->setEnabled(action);
+ LLButton* delete_btn = getChild<LLButton>("delete");
+ delete_btn->setEnabled(action);
}
void LLFloaterDeletePrefPreset::onBtnDelete()
{
- LLComboBox* combo = getChild<LLComboBox>("preset_combo");
- std::string name = combo->getSimple();
-
- if (!LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name))
- {
- LLSD args;
- args["NAME"] = name;
- LLNotificationsUtil::add("PresetNotDeleted", args);
- }
- else if (mSubdirectory == PRESETS_CAMERA)
- {
- if (gSavedSettings.getString("PresetCameraActive") == name)
- {
- gSavedSettings.setString("PresetCameraActive", "");
- }
- }
-
- closeFloater();
+ LLComboBox* combo = getChild<LLComboBox>("preset_combo");
+ std::string name = combo->getSimple();
+
+ if (!LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name))
+ {
+ LLSD args;
+ args["NAME"] = name;
+ LLNotificationsUtil::add("PresetNotDeleted", args);
+ }
+ else if (mSubdirectory == PRESETS_CAMERA)
+ {
+ if (gSavedSettings.getString("PresetCameraActive") == name)
+ {
+ gSavedSettings.setString("PresetCameraActive", "");
+ }
+ }
+
+ closeFloater();
}
void LLFloaterDeletePrefPreset::onPresetsListChange()
{
- LLComboBox* combo = getChild<LLComboBox>("preset_combo");
+ LLComboBox* combo = getChild<LLComboBox>("preset_combo");
- EDefaultOptions option = DEFAULT_HIDE;
+ EDefaultOptions option = DEFAULT_HIDE;
- LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option);
+ LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option);
}
void LLFloaterDeletePrefPreset::onBtnCancel()
{
- closeFloater();
+ closeFloater();
}
diff --git a/indra/newview/llfloaterdeleteprefpreset.h b/indra/newview/llfloaterdeleteprefpreset.h
index 0ab3da7139..f94374edc4 100644
--- a/indra/newview/llfloaterdeleteprefpreset.h
+++ b/indra/newview/llfloaterdeleteprefpreset.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterdeleteprefpreset.h
* @brief Floater to delete a graphics / camera preset
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,18 +36,18 @@ class LLFloaterDeletePrefPreset : public LLFloater
{
public:
- LLFloaterDeletePrefPreset(const LLSD &key);
+ LLFloaterDeletePrefPreset(const LLSD &key);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- void onBtnDelete();
- void onBtnCancel();
+ void onBtnDelete();
+ void onBtnCancel();
private:
- void onPresetsListChange();
+ void onPresetsListChange();
- std::string mSubdirectory;
+ std::string mSubdirectory;
};
#endif // LL_LLFLOATERDELETEPREFPRESET_H
diff --git a/indra/newview/llfloaterdestinations.cpp b/indra/newview/llfloaterdestinations.cpp
index af21cb593f..81d7d0078b 100644
--- a/indra/newview/llfloaterdestinations.cpp
+++ b/indra/newview/llfloaterdestinations.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterdestinations.h
* @author Leyla Farazha
* @brief floater for the destinations guide
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,7 +37,7 @@
LLFloaterDestinations::LLFloaterDestinations(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
}
@@ -47,8 +47,8 @@ LLFloaterDestinations::~LLFloaterDestinations()
BOOL LLFloaterDestinations::postBuild()
{
- enableResizeCtrls(true, true, false);
- return TRUE;
+ enableResizeCtrls(true, true, false);
+ return TRUE;
}
diff --git a/indra/newview/llfloaterdestinations.h b/indra/newview/llfloaterdestinations.h
index 85d9b3391e..3b88f5cc60 100644
--- a/indra/newview/llfloaterdestinations.h
+++ b/indra/newview/llfloaterdestinations.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterdestinations.h
* @author Leyla Farazha
* @brief floater for the destinations guide
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,13 +31,13 @@
#include "llfloater.h"
class LLFloaterDestinations:
- public LLFloater
+ public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
private:
- LLFloaterDestinations(const LLSD& key);
- /*virtual*/ ~LLFloaterDestinations();
- /*virtual*/ BOOL postBuild();
+ LLFloaterDestinations(const LLSD& key);
+ /*virtual*/ ~LLFloaterDestinations();
+ /*virtual*/ BOOL postBuild();
};
#endif
diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp
index ad2533debc..261dc86e59 100644
--- a/indra/newview/llfloaterdisplayname.cpp
+++ b/indra/newview/llfloaterdisplayname.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterdisplayname.cpp
* @author Leyla Farazha
* @brief Implementation of the LLFloaterDisplayName class.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,119 +43,119 @@
class LLFloaterDisplayName : public LLFloater
{
public:
- LLFloaterDisplayName(const LLSD& key);
- virtual ~LLFloaterDisplayName() { }
- /*virtual*/ BOOL postBuild();
- void onSave();
- void onReset();
- void onCancel();
- /*virtual*/ void onOpen(const LLSD& key);
-
+ LLFloaterDisplayName(const LLSD& key);
+ virtual ~LLFloaterDisplayName() { }
+ /*virtual*/ BOOL postBuild();
+ void onSave();
+ void onReset();
+ void onCancel();
+ /*virtual*/ void onOpen(const LLSD& key);
+
private:
-
- void onCacheSetName(bool success,
- const std::string& reason,
- const LLSD& content);
+
+ void onCacheSetName(bool success,
+ const std::string& reason,
+ const LLSD& content);
};
LLFloaterDisplayName::LLFloaterDisplayName(const LLSD& key) :
- LLFloater(key)
+ LLFloater(key)
{
}
void LLFloaterDisplayName::onOpen(const LLSD& key)
{
- getChild<LLUICtrl>("display_name_editor")->clear();
- getChild<LLUICtrl>("display_name_confirm")->clear();
-
- LLAvatarName av_name;
- LLAvatarNameCache::get(gAgent.getID(), &av_name);
-
- F64 now_secs = LLDate::now().secondsSinceEpoch();
-
- if (now_secs < av_name.mNextUpdate)
- {
- // ...can't update until some time in the future
- F64 next_update_local_secs =
- av_name.mNextUpdate - LLStringOps::getLocalTimeOffset();
- LLDate next_update_local(next_update_local_secs);
- // display as "July 18 12:17 PM"
- std::string next_update_string =
- next_update_local.toHTTPDateString("%B %d %I:%M %p");
- getChild<LLUICtrl>("lockout_text")->setTextArg("[TIME]", next_update_string);
- getChild<LLUICtrl>("lockout_text")->setVisible(true);
- getChild<LLUICtrl>("save_btn")->setEnabled(false);
- getChild<LLUICtrl>("display_name_editor")->setEnabled(false);
- getChild<LLUICtrl>("display_name_confirm")->setEnabled(false);
- getChild<LLUICtrl>("cancel_btn")->setFocus(TRUE);
-
- }
- else
- {
- getChild<LLUICtrl>("lockout_text")->setVisible(false);
- getChild<LLUICtrl>("save_btn")->setEnabled(true);
- getChild<LLUICtrl>("display_name_editor")->setEnabled(true);
- getChild<LLUICtrl>("display_name_confirm")->setEnabled(true);
-
- }
+ getChild<LLUICtrl>("display_name_editor")->clear();
+ getChild<LLUICtrl>("display_name_confirm")->clear();
+
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(gAgent.getID(), &av_name);
+
+ F64 now_secs = LLDate::now().secondsSinceEpoch();
+
+ if (now_secs < av_name.mNextUpdate)
+ {
+ // ...can't update until some time in the future
+ F64 next_update_local_secs =
+ av_name.mNextUpdate - LLStringOps::getLocalTimeOffset();
+ LLDate next_update_local(next_update_local_secs);
+ // display as "July 18 12:17 PM"
+ std::string next_update_string =
+ next_update_local.toHTTPDateString("%B %d %I:%M %p");
+ getChild<LLUICtrl>("lockout_text")->setTextArg("[TIME]", next_update_string);
+ getChild<LLUICtrl>("lockout_text")->setVisible(true);
+ getChild<LLUICtrl>("save_btn")->setEnabled(false);
+ getChild<LLUICtrl>("display_name_editor")->setEnabled(false);
+ getChild<LLUICtrl>("display_name_confirm")->setEnabled(false);
+ getChild<LLUICtrl>("cancel_btn")->setFocus(TRUE);
+
+ }
+ else
+ {
+ getChild<LLUICtrl>("lockout_text")->setVisible(false);
+ getChild<LLUICtrl>("save_btn")->setEnabled(true);
+ getChild<LLUICtrl>("display_name_editor")->setEnabled(true);
+ getChild<LLUICtrl>("display_name_confirm")->setEnabled(true);
+
+ }
}
BOOL LLFloaterDisplayName::postBuild()
{
- getChild<LLUICtrl>("reset_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onReset, this));
- getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onCancel, this));
- getChild<LLUICtrl>("save_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onSave, this));
-
- center();
+ getChild<LLUICtrl>("reset_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onReset, this));
+ getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onCancel, this));
+ getChild<LLUICtrl>("save_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onSave, this));
- return TRUE;
+ center();
+
+ return TRUE;
}
void LLFloaterDisplayName::onCacheSetName(bool success,
- const std::string& reason,
- const LLSD& content)
+ const std::string& reason,
+ const LLSD& content)
{
- if (success)
- {
- // Inform the user that the change took place, but will take a while
- // to percolate.
- LLSD args;
- args["DISPLAY_NAME"] = content["display_name"];
- LLNotificationsUtil::add("SetDisplayNameSuccess", args);
- return;
- }
-
- // Request failed, notify the user
- std::string error_tag = content["error_tag"].asString();
- LL_INFOS() << "set name failure error_tag " << error_tag << LL_ENDL;
-
- // We might have a localized string for this message
- // error_args will usually be empty from the server.
- if (!error_tag.empty()
- && LLNotifications::getInstance()->templateExists(error_tag))
- {
- LLNotificationsUtil::add(error_tag);
- return;
- }
-
- // The server error might have a localized message for us
- std::string lang_code = LLUI::getLanguage();
- LLSD error_desc = content["error_description"];
- if (error_desc.has( lang_code ))
- {
- LLSD args;
- args["MESSAGE"] = error_desc[lang_code].asString();
- LLNotificationsUtil::add("GenericAlert", args);
- return;
- }
-
- // No specific error, throw a generic one
- LLNotificationsUtil::add("SetDisplayNameFailedGeneric");
+ if (success)
+ {
+ // Inform the user that the change took place, but will take a while
+ // to percolate.
+ LLSD args;
+ args["DISPLAY_NAME"] = content["display_name"];
+ LLNotificationsUtil::add("SetDisplayNameSuccess", args);
+ return;
+ }
+
+ // Request failed, notify the user
+ std::string error_tag = content["error_tag"].asString();
+ LL_INFOS() << "set name failure error_tag " << error_tag << LL_ENDL;
+
+ // We might have a localized string for this message
+ // error_args will usually be empty from the server.
+ if (!error_tag.empty()
+ && LLNotifications::getInstance()->templateExists(error_tag))
+ {
+ LLNotificationsUtil::add(error_tag);
+ return;
+ }
+
+ // The server error might have a localized message for us
+ std::string lang_code = LLUI::getLanguage();
+ LLSD error_desc = content["error_description"];
+ if (error_desc.has( lang_code ))
+ {
+ LLSD args;
+ args["MESSAGE"] = error_desc[lang_code].asString();
+ LLNotificationsUtil::add("GenericAlert", args);
+ return;
+ }
+
+ // No specific error, throw a generic one
+ LLNotificationsUtil::add("SetDisplayNameFailedGeneric");
}
void LLFloaterDisplayName::onCancel()
{
- setVisible(false);
+ setVisible(false);
}
void LLFloaterDisplayName::onReset()
@@ -185,14 +185,14 @@ void LLFloaterDisplayName::onReset()
void LLFloaterDisplayName::onSave()
{
- std::string display_name_utf8 = getChild<LLUICtrl>("display_name_editor")->getValue().asString();
- std::string display_name_confirm = getChild<LLUICtrl>("display_name_confirm")->getValue().asString();
+ std::string display_name_utf8 = getChild<LLUICtrl>("display_name_editor")->getValue().asString();
+ std::string display_name_confirm = getChild<LLUICtrl>("display_name_confirm")->getValue().asString();
- if (display_name_utf8.compare(display_name_confirm))
- {
- LLNotificationsUtil::add("SetDisplayNameMismatch");
- return;
- }
+ if (display_name_utf8.compare(display_name_confirm))
+ {
+ LLNotificationsUtil::add("SetDisplayNameMismatch");
+ return;
+ }
LLAvatarName av_name;
if (!LLAvatarNameCache::get(gAgent.getID(), &av_name))
@@ -209,26 +209,26 @@ void LLFloaterDisplayName::onSave()
return;
}
- const U32 DISPLAY_NAME_MAX_LENGTH = 31; // characters, not bytes
- LLWString display_name_wstr = utf8string_to_wstring(display_name_utf8);
- if (display_name_wstr.size() > DISPLAY_NAME_MAX_LENGTH)
- {
- LLSD args;
- args["LENGTH"] = llformat("%d", DISPLAY_NAME_MAX_LENGTH);
- LLNotificationsUtil::add("SetDisplayNameFailedLength", args);
- return;
- }
-
+ const U32 DISPLAY_NAME_MAX_LENGTH = 31; // characters, not bytes
+ LLWString display_name_wstr = utf8string_to_wstring(display_name_utf8);
+ if (display_name_wstr.size() > DISPLAY_NAME_MAX_LENGTH)
+ {
+ LLSD args;
+ args["LENGTH"] = llformat("%d", DISPLAY_NAME_MAX_LENGTH);
+ LLNotificationsUtil::add("SetDisplayNameFailedLength", args);
+ return;
+ }
+
if (LLAvatarNameCache::getInstance()->hasNameLookupURL())
- {
- LLViewerDisplayName::set(display_name_utf8,boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3));
- }
- else
- {
- LLNotificationsUtil::add("SetDisplayNameFailedGeneric");
- }
-
- setVisible(false);
+ {
+ LLViewerDisplayName::set(display_name_utf8,boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3));
+ }
+ else
+ {
+ LLNotificationsUtil::add("SetDisplayNameFailedGeneric");
+ }
+
+ setVisible(false);
}
@@ -237,6 +237,6 @@ void LLFloaterDisplayName::onSave()
//////////////////////////////////////////////////////////////////////////////
void LLFloaterDisplayNameUtil::registerFloater()
{
- LLFloaterReg::add("display_name", "floater_display_name.xml",
- &LLFloaterReg::build<LLFloaterDisplayName>);
+ LLFloaterReg::add("display_name", "floater_display_name.xml",
+ &LLFloaterReg::build<LLFloaterDisplayName>);
}
diff --git a/indra/newview/llfloaterdisplayname.h b/indra/newview/llfloaterdisplayname.h
index a00bf56712..0c9a5b7e75 100644
--- a/indra/newview/llfloaterdisplayname.h
+++ b/indra/newview/llfloaterdisplayname.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloaterdisplayname.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,8 +29,8 @@
namespace LLFloaterDisplayNameUtil
{
- // Register with LLFloaterReg
- void registerFloater();
+ // Register with LLFloaterReg
+ void registerFloater();
}
diff --git a/indra/newview/llfloatereditenvironmentbase.cpp b/indra/newview/llfloatereditenvironmentbase.cpp
index e7e0ff717e..109c7a286c 100644
--- a/indra/newview/llfloatereditenvironmentbase.cpp
+++ b/indra/newview/llfloatereditenvironmentbase.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatereditenvironmentbase.cpp
* @brief Floaters to create and edit fixed settings for sky and water.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llfloatereditenvironmentbase.h b/indra/newview/llfloatereditenvironmentbase.h
index d900d7f003..1b7771fe94 100644
--- a/indra/newview/llfloatereditenvironmentbase.h
+++ b/indra/newview/llfloatereditenvironmentbase.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatereditenvironmentbase.h
* @brief Floaters to create and edit fixed settings for sky and water.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,7 +54,7 @@ public:
virtual void onFocusReceived() override;
virtual void onFocusLost() override;
-
+
virtual LLSettingsBase::ptr_t getEditSettings() const = 0;
virtual BOOL isDirty() const override { return getIsDirty(); }
@@ -141,7 +141,7 @@ private:
bool mIsDirty;
bool mCanEdit;
-
+
on_dirty_charged_sg mOnDirtyChanged;
};
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 4e764674e5..2db1ef381d 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatereditextdaycycle.cpp
* @brief Floater to create or edit a day cycle
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -242,11 +242,11 @@ BOOL LLFloaterEditExtDayCycle::postBuild()
mTimeSlider->addSlider(0);
- LLTabContainer* tab_container = mSkyTabLayoutContainer->getChild<LLTabContainer>("sky_tabs");
+ LLTabContainer* tab_container = mSkyTabLayoutContainer->getChild<LLTabContainer>("sky_tabs");
S32 tab_count = tab_container->getTabCount();
LLSettingsEditPanel *panel = nullptr;
-
+
for (S32 idx = 0; idx < tab_count; ++idx)
{
panel = static_cast<LLSettingsEditPanel *>(tab_container->getPanelByIndex(idx));
@@ -264,7 +264,7 @@ BOOL LLFloaterEditExtDayCycle::postBuild()
panel->setOnDirtyFlagChanged([this](LLPanel *, bool val) { onPanelDirtyFlagChanged(val); });
}
- return TRUE;
+ return TRUE;
}
void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
@@ -327,7 +327,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
LLUIString formatted_label = getString("time_label");
for (int i = 0; i < max_elm; i++)
{
- total = ((mDayLength / (max_elm - 1)) * i);
+ total = ((mDayLength / (max_elm - 1)) * i);
hrs = total;
minutes = total - hrs;
@@ -1017,7 +1017,7 @@ void LLFloaterEditExtDayCycle::cloneTrack(const LLSettingsDay::ptr_t &source_day
// don't use replaceCycleTrack because we will end up with references, but we need to clone
- // hold on to a backup of the
+ // hold on to a backup of the
LLSettingsDay::CycleTrack_t backup_track = mEditDay->getCycleTrack(dest_index);
mEditDay->clearCycleTrack(dest_index); // because source can be empty
@@ -1098,7 +1098,7 @@ void LLFloaterEditExtDayCycle::selectFrame(F32 frame, F32 slop_factor)
}
}
mFramesSlider->setCurSlider(iter->first);
- frame = iter->second.mFrame;
+ frame = iter->second.mFrame;
break;
}
iter++;
@@ -1269,7 +1269,7 @@ void LLFloaterEditExtDayCycle::updateTimeAndLabel()
{
LLUIString formatted_label = getString("time_label");
- LLSettingsDay::Seconds total = (mDayLength * time);
+ LLSettingsDay::Seconds total = (mDayLength * time);
S32Hours hrs = total;
S32Minutes minutes = total - hrs;
@@ -1327,7 +1327,7 @@ void LLFloaterEditExtDayCycle::removeCurrentSliderFrame()
void LLFloaterEditExtDayCycle::removeSliderFrame(F32 frame)
{
- keymap_t::iterator it = std::find_if(mSliderKeyMap.begin(), mSliderKeyMap.end(),
+ keymap_t::iterator it = std::find_if(mSliderKeyMap.begin(), mSliderKeyMap.end(),
[frame](const keymap_t::value_type &value) { return fabs(value.second.mFrame - frame) < LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR; });
if (it != mSliderKeyMap.end())
@@ -1401,7 +1401,7 @@ void LLFloaterEditExtDayCycle::synchronizeTabs()
getChild<LLUICtrl>(ICN_LOCK_EDIT)->setVisible(!canedit);
}
- else
+ else
{
psettingW = mScratchWater;
}
@@ -1538,7 +1538,7 @@ void LLFloaterEditExtDayCycle::loadSettingFromFile(const std::vector<std::string
LLSettingsDay::ptr_t legacyday = LLEnvironment::createDayCycleFromLegacyPreset(filename, messages);
if (!legacyday)
- {
+ {
LLNotificationsUtil::add("WLImportFail", messages);
return;
}
@@ -1726,7 +1726,7 @@ void LLFloaterEditExtDayCycle::showHDRNotification(const LLSettingsDay::ptr_t &p
LLSettingsSky::ptr_t sky = std::static_pointer_cast<LLSettingsSky>(iter->second);
if (sky
&& sky->canAutoAdjust()
- && sky->getReflectionProbeAmbiance(true) != 0.f)
+ && sky->getReflectionProbeAmbiance(true) != 0.f)
{
LLNotificationsUtil::add("AutoAdjustHDRSky");
return;
@@ -1849,6 +1849,6 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForInsertion(LLUUID item_id, LLUUID
return;
}
}
-
+
cb();
}
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index 025a2ee5d1..0f32a1b5e2 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatereditextdaycycle.h
* @brief Floater to create or edit a day cycle
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,7 +53,7 @@ typedef std::shared_ptr<LLSettingsBase> LLSettingsBasePtr_t;
*/
class LLFloaterEditExtDayCycle : public LLFloaterEditEnvironmentBase
{
- LOG_CLASS(LLFloaterEditExtDayCycle);
+ LOG_CLASS(LLFloaterEditExtDayCycle);
friend class LLDaySettingCopiedCallback;
@@ -100,7 +100,7 @@ public:
virtual LLSettingsBase::ptr_t getEditSettings() const override { return mEditDay; }
- BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override;
+ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override;
protected:
virtual void setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) override;
@@ -109,40 +109,40 @@ private:
typedef std::function<void()> on_confirm_fn;
F32 getCurrentFrame() const;
- // flyout response/click
- void onButtonApply(LLUICtrl *ctrl, const LLSD &data);
+ // flyout response/click
+ void onButtonApply(LLUICtrl *ctrl, const LLSD &data);
//virtual void onClickCloseBtn(bool app_quitting = false) override;
//void onButtonImport();
void onButtonLoadFrame();
void onAddFrame();
- void onRemoveFrame();
+ void onRemoveFrame();
void onCloneTrack();
void onLoadTrack();
void onClearTrack();
- void onCommitName(class LLLineEditor* caller, void* user_data);
- void onTrackSelectionCallback(const LLSD& user_data);
- void onPlayActionCallback(const LLSD& user_data);
- // time slider clicked
- void onTimeSliderCallback();
- // a frame moved or frame selection changed
- void onFrameSliderCallback(const LLSD &);
+ void onCommitName(class LLLineEditor* caller, void* user_data);
+ void onTrackSelectionCallback(const LLSD& user_data);
+ void onPlayActionCallback(const LLSD& user_data);
+ // time slider clicked
+ void onTimeSliderCallback();
+ // a frame moved or frame selection changed
+ void onFrameSliderCallback(const LLSD &);
void onFrameSliderDoubleClick(S32 x, S32 y, MASK mask);
void onFrameSliderMouseDown(S32 x, S32 y, MASK mask);
void onFrameSliderMouseUp(S32 x, S32 y, MASK mask);
void cloneTrack(U32 source_index, U32 dest_index);
void cloneTrack(const LLSettingsDay::ptr_t &source_day, U32 source_index, U32 dest_index);
- void selectTrack(U32 track_index, bool force = false);
- void selectFrame(F32 frame, F32 slop_factor);
- void clearTabs();
- void updateTabs();
- void updateWaterTabs(const LLSettingsWaterPtr_t &p_water);
- void updateSkyTabs(const LLSettingsSkyPtr_t &p_sky);
- void updateButtons();
- void updateLabels();
- void updateSlider(); //generate sliders from current track
- void updateTimeAndLabel();
- void addSliderFrame(F32 frame, const LLSettingsBase::ptr_t &setting, bool update_ui = true);
+ void selectTrack(U32 track_index, bool force = false);
+ void selectFrame(F32 frame, F32 slop_factor);
+ void clearTabs();
+ void updateTabs();
+ void updateWaterTabs(const LLSettingsWaterPtr_t &p_water);
+ void updateSkyTabs(const LLSettingsSkyPtr_t &p_sky);
+ void updateButtons();
+ void updateLabels();
+ void updateSlider(); //generate sliders from current track
+ void updateTimeAndLabel();
+ void addSliderFrame(F32 frame, const LLSettingsBase::ptr_t &setting, bool update_ui = true);
void removeCurrentSliderFrame();
void removeSliderFrame(F32 frame);
@@ -203,7 +203,7 @@ private:
LLButton * mCloneTrack;
LLButton * mLoadTrack;
LLButton * mClearTrack;
- LLMultiSliderCtrl* mTimeSlider;
+ LLMultiSliderCtrl* mTimeSlider;
LLMultiSliderCtrl* mFramesSlider;
LLView* mSkyTabLayoutContainer;
LLView* mWaterTabLayoutContainer;
diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp
index fa51143f3a..58e58cfc5d 100644
--- a/indra/newview/llfloatereditsky.cpp
+++ b/indra/newview/llfloatereditsky.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatereditsky.cpp
* @brief Floater to create or edit a sky preset
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -62,16 +62,16 @@ namespace
static F32 time24_to_sun_pos(F32 time24)
{
- F32 sun_pos = fmodf((time24 - 6) / 24.0f, 1.0f);
- if (sun_pos < 0) ++sun_pos;
- return sun_pos;
+ F32 sun_pos = fmodf((time24 - 6) / 24.0f, 1.0f);
+ if (sun_pos < 0) ++sun_pos;
+ return sun_pos;
}
-LLFloaterEditSky::LLFloaterEditSky(const LLSD &key):
- LLFloater(key),
- mSkyPresetNameEditor(NULL),
- mSkyPresetCombo(NULL),
- mMakeDefaultCheckBox(NULL),
+LLFloaterEditSky::LLFloaterEditSky(const LLSD &key):
+ LLFloater(key),
+ mSkyPresetNameEditor(NULL),
+ mSkyPresetCombo(NULL),
+ mMakeDefaultCheckBox(NULL),
mSaveButton(NULL),
mSkyAdapter()
{
@@ -80,116 +80,116 @@ LLFloaterEditSky::LLFloaterEditSky(const LLSD &key):
// virtual
BOOL LLFloaterEditSky::postBuild()
{
- mSkyPresetNameEditor = getChild<LLLineEditor>("sky_preset_name");
- mSkyPresetCombo = getChild<LLComboBox>("sky_preset_combo");
- mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
- mSaveButton = getChild<LLButton>("save");
+ mSkyPresetNameEditor = getChild<LLLineEditor>("sky_preset_name");
+ mSkyPresetCombo = getChild<LLComboBox>("sky_preset_combo");
+ mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
+ mSaveButton = getChild<LLButton>("save");
mSkyAdapter = std::make_shared<LLSkySettingsAdapter>();
LLEnvironment::instance().setSkyListChange(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this));
- initCallbacks();
+ initCallbacks();
-// // Create the sun position scrubber on the slider.
-// getChild<LLMultiSliderCtrl>("WLSunPos")->addSlider(12.f);
+// // Create the sun position scrubber on the slider.
+// getChild<LLMultiSliderCtrl>("WLSunPos")->addSlider(12.f);
- return TRUE;
+ return TRUE;
}
// virtual
void LLFloaterEditSky::onOpen(const LLSD& key)
{
- bool new_preset = isNewPreset();
- std::string param = key.asString();
- std::string floater_title = getString(std::string("title_") + param);
- std::string hint = getString(std::string("hint_" + param));
+ bool new_preset = isNewPreset();
+ std::string param = key.asString();
+ std::string floater_title = getString(std::string("title_") + param);
+ std::string hint = getString(std::string("hint_" + param));
- // Update floater title.
- setTitle(floater_title);
+ // Update floater title.
+ setTitle(floater_title);
- // Update the hint at the top.
- getChild<LLUICtrl>("hint")->setValue(hint);
+ // Update the hint at the top.
+ getChild<LLUICtrl>("hint")->setValue(hint);
- // Hide the hint to the right of the combo if we're invoked to create a new preset.
- getChildView("note")->setVisible(!new_preset);
+ // Hide the hint to the right of the combo if we're invoked to create a new preset.
+ getChildView("note")->setVisible(!new_preset);
- // Switch between the sky presets combobox and preset name input field.
- mSkyPresetCombo->setVisible(!new_preset);
- mSkyPresetNameEditor->setVisible(new_preset);
+ // Switch between the sky presets combobox and preset name input field.
+ mSkyPresetCombo->setVisible(!new_preset);
+ mSkyPresetNameEditor->setVisible(new_preset);
- reset();
+ reset();
}
// virtual
void LLFloaterEditSky::onClose(bool app_quitting)
{
- if (!app_quitting) // there's no point to change environment if we're quitting
- {
+ if (!app_quitting) // there's no point to change environment if we're quitting
+ {
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
- }
+ }
}
// virtual
void LLFloaterEditSky::draw()
{
- syncControls();
- LLFloater::draw();
+ syncControls();
+ LLFloater::draw();
}
void LLFloaterEditSky::initCallbacks(void)
{
- // *TODO: warn user if a region environment update comes while we're editing a region sky preset.
+ // *TODO: warn user if a region environment update comes while we're editing a region sky preset.
- mSkyPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this), NULL);
- mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditSky::onSkyPresetSelected, this));
- mSkyPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this));
+ mSkyPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this), NULL);
+ mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditSky::onSkyPresetSelected, this));
+ mSkyPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this));
- mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this));
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this));
+ mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this));
- // Connect to region info updates.
- LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this));
+ // Connect to region info updates.
+ LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this));
- // sunlight
+ // sunlight
getChild<LLUICtrl>("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mSunlight));
- // glow
+ // glow
getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &mSkyAdapter->mGlow));
getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &mSkyAdapter->mGlow));
- // time of day
+ // time of day
// getChild<LLUICtrl>("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); // multi-slider
-// getChild<LLTimeCtrl>("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl
+// getChild<LLTimeCtrl>("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl
// getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm));
getChild<LLJoystickQuaternion>("WLSunRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunRotationChanged, this));
getChild<LLJoystickQuaternion>("WLMoonRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onMoonRotationChanged, this));
- // Clouds
+ // Clouds
- // Cloud Color
+ // Cloud Color
getChild<LLUICtrl>("WLCloudColor")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mCloudColor));
- // Cloud
+ // Cloud
getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudMain));
getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudMain));
getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudMain));
- // Cloud Detail
+ // Cloud Detail
getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudDetail));
getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudDetail));
getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudDetail));
- // Cloud extras
+ // Cloud extras
getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudCoverage));
getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudScale));
- getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1));
- getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1));
-
+ getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1));
+ getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1));
+
- // Dome
+ // Dome
getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mWLGamma));
- getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1));
+ getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1));
}
//=================================================================================================
@@ -204,123 +204,123 @@ void LLFloaterEditSky::syncControls()
mSkyPresetNameEditor->setText(name);
mSkyPresetCombo->setValue(name);
- // Lighting
+ // Lighting
- // sunlight
+ // sunlight
mSkyAdapter->mSunlight.setColor3( psky->getSunlightColor() );
- setColorSwatch("WLSunlight", mSkyAdapter->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE);
+ setColorSwatch("WLSunlight", mSkyAdapter->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE);
- // glow
+ // glow
mSkyAdapter->mGlow.setColor3( psky->getGlow() );
- childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f);
- childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f);
+ childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f);
+ childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f);
// LLSettingsSky::azimalt_t azal = psky->getSunRotationAzAl();
-//
-// F32 time24 = sun_pos_to_time24(azal.second / F_TWO_PI);
-// getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
-// getChild<LLTimeCtrl>("WLDayTime")->setTime24(time24);
-// childSetValue("WLEastAngle", azal.first / F_TWO_PI);
+//
+// F32 time24 = sun_pos_to_time24(azal.second / F_TWO_PI);
+// getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
+// getChild<LLTimeCtrl>("WLDayTime")->setTime24(time24);
+// childSetValue("WLEastAngle", azal.first / F_TWO_PI);
getChild<LLJoystickQuaternion>("WLSunRotation")->setRotation(psky->getSunRotation());
getChild<LLJoystickQuaternion>("WLMoonRotation")->setRotation(psky->getMoonRotation());
- // Clouds
+ // Clouds
- // Cloud Color
+ // Cloud Color
mSkyAdapter->mCloudColor.setColor3( psky->getCloudColor() );
- setColorSwatch("WLCloudColor", mSkyAdapter->mCloudColor, WL_CLOUD_SLIDER_SCALE);
+ setColorSwatch("WLCloudColor", mSkyAdapter->mCloudColor, WL_CLOUD_SLIDER_SCALE);
- // Cloud
+ // Cloud
mSkyAdapter->mCloudMain.setColor3( psky->getCloudPosDensity1() );
- childSetValue("WLCloudX", mSkyAdapter->mCloudMain.getRed());
- childSetValue("WLCloudY", mSkyAdapter->mCloudMain.getGreen());
- childSetValue("WLCloudDensity", mSkyAdapter->mCloudMain.getBlue());
+ childSetValue("WLCloudX", mSkyAdapter->mCloudMain.getRed());
+ childSetValue("WLCloudY", mSkyAdapter->mCloudMain.getGreen());
+ childSetValue("WLCloudDensity", mSkyAdapter->mCloudMain.getBlue());
- // Cloud Detail
- mSkyAdapter->mCloudDetail.setColor3( psky->getCloudPosDensity2() );
- childSetValue("WLCloudDetailX", mSkyAdapter->mCloudDetail.getRed());
- childSetValue("WLCloudDetailY", mSkyAdapter->mCloudDetail.getGreen());
- childSetValue("WLCloudDetailDensity", mSkyAdapter->mCloudDetail.getBlue());
+ // Cloud Detail
+ mSkyAdapter->mCloudDetail.setColor3( psky->getCloudPosDensity2() );
+ childSetValue("WLCloudDetailX", mSkyAdapter->mCloudDetail.getRed());
+ childSetValue("WLCloudDetailY", mSkyAdapter->mCloudDetail.getGreen());
+ childSetValue("WLCloudDetailDensity", mSkyAdapter->mCloudDetail.getBlue());
- // Cloud extras
+ // Cloud extras
mSkyAdapter->mCloudCoverage = psky->getCloudShadow();
mSkyAdapter->mCloudScale = psky->getCloudScale();
- childSetValue("WLCloudCoverage", (F32) mSkyAdapter->mCloudCoverage);
- childSetValue("WLCloudScale", (F32) mSkyAdapter->mCloudScale);
+ childSetValue("WLCloudCoverage", (F32) mSkyAdapter->mCloudCoverage);
+ childSetValue("WLCloudScale", (F32) mSkyAdapter->mCloudScale);
- // cloud scrolling
+ // cloud scrolling
LLVector2 scroll_rate = psky->getCloudScrollRate();
// LAPRAS: These should go away...
childDisable("WLCloudLockX");
- childDisable("WLCloudLockY");
+ childDisable("WLCloudLockY");
- // disable if locked, enable if not
- childEnable("WLCloudScrollX");
- childEnable("WLCloudScrollY");
+ // disable if locked, enable if not
+ childEnable("WLCloudScrollX");
+ childEnable("WLCloudScrollY");
- // *HACK cloud scrolling is off my an additive of 10
- childSetValue("WLCloudScrollX", scroll_rate[0] - 10.0f);
- childSetValue("WLCloudScrollY", scroll_rate[1] - 10.0f);
+ // *HACK cloud scrolling is off my an additive of 10
+ childSetValue("WLCloudScrollX", scroll_rate[0] - 10.0f);
+ childSetValue("WLCloudScrollY", scroll_rate[1] - 10.0f);
- // Tweak extras
+ // Tweak extras
mSkyAdapter->mWLGamma = psky->getGamma();
- childSetValue("WLGamma", (F32) mSkyAdapter->mWLGamma);
+ childSetValue("WLGamma", (F32) mSkyAdapter->mWLGamma);
- childSetValue("WLStarAlpha", psky->getStarBrightness());
+ childSetValue("WLStarAlpha", psky->getStarBrightness());
}
void LLFloaterEditSky::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k)
{
- // Set the value, dividing it by <k> first.
- LLColor4 color = from_ctrl.getColor4();
- getChild<LLColorSwatchCtrl>(name)->set(color / k);
+ // Set the value, dividing it by <k> first.
+ LLColor4 color = from_ctrl.getColor4();
+ getChild<LLColorSwatchCtrl>(name)->set(color / k);
}
// color control callbacks
void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl)
{
- LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
- LLColor4 color_vec(swatch->get().mV);
+ LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
+ LLColor4 color_vec(swatch->get().mV);
- // Multiply RGB values by the appropriate factor.
- F32 k = WL_CLOUD_SLIDER_SCALE;
- if (color_ctrl->getIsSunOrAmbientColor())
- {
- k = WL_SUN_AMBIENT_SLIDER_SCALE;
- }
- else if (color_ctrl->getIsBlueHorizonOrDensity())
- {
- k = WL_BLUE_HORIZON_DENSITY_SCALE;
- }
+ // Multiply RGB values by the appropriate factor.
+ F32 k = WL_CLOUD_SLIDER_SCALE;
+ if (color_ctrl->getIsSunOrAmbientColor())
+ {
+ k = WL_SUN_AMBIENT_SLIDER_SCALE;
+ }
+ else if (color_ctrl->getIsBlueHorizonOrDensity())
+ {
+ k = WL_BLUE_HORIZON_DENSITY_SCALE;
+ }
- color_vec *= k; // intensity isn't affected by the multiplication
+ color_vec *= k; // intensity isn't affected by the multiplication
// Set intensity to maximum of the RGB values.
color_vec.mV[3] = color_max(color_vec);
- // Apply the new RGBI value.
- color_ctrl->setColor4(color_vec);
- color_ctrl->update(mEditSettings);
+ // Apply the new RGBI value.
+ color_ctrl->setColor4(color_vec);
+ color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onColorControlRMoved(LLUICtrl* ctrl, void* userdata)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
F32 red_value = sldr_ctrl->getValueF32();
F32 k = 1.0f;
- if (color_ctrl->getIsSunOrAmbientColor())
- {
- k = WL_SUN_AMBIENT_SLIDER_SCALE;
- }
- if (color_ctrl->getIsBlueHorizonOrDensity())
- {
- k = WL_BLUE_HORIZON_DENSITY_SCALE;
- }
+ if (color_ctrl->getIsSunOrAmbientColor())
+ {
+ k = WL_SUN_AMBIENT_SLIDER_SCALE;
+ }
+ if (color_ctrl->getIsBlueHorizonOrDensity())
+ {
+ k = WL_BLUE_HORIZON_DENSITY_SCALE;
+ }
color_ctrl->setRed(red_value * k);
adjustIntensity(color_ctrl, red_value, k);
@@ -390,35 +390,35 @@ void LLFloaterEditSky::adjustIntensity(WLColorControl *ctrl, F32 val, F32 scale)
void LLFloaterEditSky::onGlowRMoved(LLUICtrl* ctrl, void* userdata)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
- // scaled by 20
- color_ctrl->setRed((2 - sldr_ctrl->getValueF32()) * 20);
+ // scaled by 20
+ color_ctrl->setRed((2 - sldr_ctrl->getValueF32()) * 20);
- color_ctrl->update(mEditSettings);
+ color_ctrl->update(mEditSettings);
}
/// \NOTE that we want NEGATIVE (-) B
void LLFloaterEditSky::onGlowBMoved(LLUICtrl* ctrl, void* userdata)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
- /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big
- color_ctrl->setBlue(-sldr_ctrl->getValueF32() * 5);
+ /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big
+ color_ctrl->setBlue(-sldr_ctrl->getValueF32() * 5);
- color_ctrl->update(mEditSettings);
+ color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLFloatControl * floatControl = static_cast<WLFloatControl *>(userdata);
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ WLFloatControl * floatControl = static_cast<WLFloatControl *>(userdata);
- floatControl->setValue(sldr_ctrl->getValueF32() / floatControl->getMult());
+ floatControl->setValue(sldr_ctrl->getValueF32() / floatControl->getMult());
- floatControl->update(mEditSettings);
+ floatControl->update(mEditSettings);
}
@@ -427,15 +427,15 @@ void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata)
// time of day
void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata)
{
- LLMultiSliderCtrl* sun_msldr = getChild<LLMultiSliderCtrl>("WLSunPos");
- LLSliderCtrl* east_sldr = getChild<LLSliderCtrl>("WLEastAngle");
- LLTimeCtrl* time_ctrl = getChild<LLTimeCtrl>("WLDayTime");
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
+ LLMultiSliderCtrl* sun_msldr = getChild<LLMultiSliderCtrl>("WLSunPos");
+ LLSliderCtrl* east_sldr = getChild<LLSliderCtrl>("WLEastAngle");
+ LLTimeCtrl* time_ctrl = getChild<LLTimeCtrl>("WLDayTime");
+ WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
- F32 time24 = sun_msldr->getCurSliderValue();
- time_ctrl->setTime24(time24); // sync the time ctrl with the new sun position
+ F32 time24 = sun_msldr->getCurSliderValue();
+ time_ctrl->setTime24(time24); // sync the time ctrl with the new sun position
- // get the two angles
+ // get the two angles
F32 azimuth = F_TWO_PI * east_sldr->getValueF32();
F32 altitude = F_TWO_PI * time24_to_sun_pos(time24);
mEditSettings->setSunRotation(azimuth, altitude);
@@ -443,13 +443,13 @@ void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata)
LLVector4 sunnorm( mEditSettings->getSunDirection(), 1.f );
- color_ctrl->update(mEditSettings);
+ color_ctrl->update(mEditSettings);
}
void LLFloaterEditSky::onTimeChanged()
{
- F32 time24 = getChild<LLTimeCtrl>("WLDayTime")->getTime24();
- getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
+ F32 time24 = getChild<LLTimeCtrl>("WLDayTime")->getTime24();
+ getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
onSunMoved(getChild<LLUICtrl>("WLSunPos"), &(mSkyAdapter->mLightnorm));
}
@@ -471,7 +471,7 @@ void LLFloaterEditSky::onMoonRotationChanged()
void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
mEditSettings->setStarBrightness(sldr_ctrl->getValueF32());
}
@@ -479,16 +479,16 @@ void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl)
// Clouds
void LLFloaterEditSky::onCloudScrollXMoved(LLUICtrl* ctrl)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- // *HACK all cloud scrolling is off by an additive of 10.
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ // *HACK all cloud scrolling is off by an additive of 10.
mEditSettings->setCloudScrollRateX(sldr_ctrl->getValueF32() + 10.0f);
}
void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- // *HACK all cloud scrolling is off by an additive of 10.
+ // *HACK all cloud scrolling is off by an additive of 10.
mEditSettings->setCloudScrollRateY(sldr_ctrl->getValueF32() + 10.0f);
}
@@ -496,28 +496,28 @@ void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl)
void LLFloaterEditSky::reset()
{
- if (isNewPreset())
- {
- mSkyPresetNameEditor->setValue(LLSD());
- mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
- }
- else
- {
- refreshSkyPresetsList();
+ if (isNewPreset())
+ {
+ mSkyPresetNameEditor->setValue(LLSD());
+ mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
+ }
+ else
+ {
+ refreshSkyPresetsList();
- // Disable controls until a sky preset to edit is selected.
- enableEditing(false);
- }
+ // Disable controls until a sky preset to edit is selected.
+ enableEditing(false);
+ }
}
bool LLFloaterEditSky::isNewPreset() const
{
- return mKey.asString() == "new";
+ return mKey.asString() == "new";
}
void LLFloaterEditSky::refreshSkyPresetsList()
{
- mSkyPresetCombo->removeall();
+ mSkyPresetCombo->removeall();
LLEnvironment::list_name_id_t list = LLEnvironment::instance().getSkyList();
@@ -526,38 +526,38 @@ void LLFloaterEditSky::refreshSkyPresetsList()
mSkyPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second));
}
- mSkyPresetCombo->setLabel(getString("combo_label"));
+ mSkyPresetCombo->setLabel(getString("combo_label"));
}
void LLFloaterEditSky::enableEditing(bool enable)
{
- // Enable/disable the tab and their contents.
- LLTabContainer* tab_container = getChild<LLTabContainer>("WindLight Tabs");
- tab_container->setEnabled(enable);
- for (S32 i = 0; i < tab_container->getTabCount(); ++i)
- {
- tab_container->enableTabButton(i, enable);
- tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable);
- }
+ // Enable/disable the tab and their contents.
+ LLTabContainer* tab_container = getChild<LLTabContainer>("WindLight Tabs");
+ tab_container->setEnabled(enable);
+ for (S32 i = 0; i < tab_container->getTabCount(); ++i)
+ {
+ tab_container->enableTabButton(i, enable);
+ tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable);
+ }
- // Enable/disable saving.
- mSaveButton->setEnabled(enable);
- mMakeDefaultCheckBox->setEnabled(enable);
+ // Enable/disable saving.
+ mSaveButton->setEnabled(enable);
+ mMakeDefaultCheckBox->setEnabled(enable);
}
void LLFloaterEditSky::saveRegionSky()
{
#if 0
- LLWLParamKey key(getSelectedSkyPreset());
- llassert(key.scope == LLEnvKey::SCOPE_REGION);
+ LLWLParamKey key(getSelectedSkyPreset());
+ llassert(key.scope == LLEnvKey::SCOPE_REGION);
- LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << LL_ENDL;
- LLWLParamManager& wl_mgr = LLWLParamManager::instance();
- wl_mgr.mCurParams.mName = key.name;
- wl_mgr.setParamSet(key, wl_mgr.mCurParams);
+ LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << LL_ENDL;
+ LLWLParamManager& wl_mgr = LLWLParamManager::instance();
+ wl_mgr.mCurParams.mName = key.name;
+ wl_mgr.setParamSet(key, wl_mgr.mCurParams);
- // *TODO: save to cached region settings.
- LL_WARNS("Windlight") << "Saving region sky is not fully implemented yet" << LL_ENDL;
+ // *TODO: save to cached region settings.
+ LL_WARNS("Windlight") << "Saving region sky is not fully implemented yet" << LL_ENDL;
#endif
}
@@ -611,15 +611,15 @@ void LLFloaterEditSky::onSkyPresetSelected()
bool LLFloaterEditSky::onSaveAnswer(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- // If they choose save, do it. Otherwise, don't do anything
- if (option == 0)
- {
- onSaveConfirmed();
- }
+ // If they choose save, do it. Otherwise, don't do anything
+ if (option == 0)
+ {
+ onSaveConfirmed();
+ }
- return false;
+ return false;
}
void LLFloaterEditSky::onSaveConfirmed()
@@ -651,7 +651,7 @@ void LLFloaterEditSky::onBtnSave()
void LLFloaterEditSky::onBtnCancel()
{
- closeFloater();
+ closeFloater();
}
void LLFloaterEditSky::onSkyPresetListChange()
@@ -662,38 +662,38 @@ void LLFloaterEditSky::onSkyPresetListChange()
void LLFloaterEditSky::onRegionSettingsChange()
{
#if 0
- // If creating a new sky, don't bother.
- if (isNewPreset())
- {
- return;
- }
-
- if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) // if editing a region sky
- {
- // reset the floater to its initial state
- reset();
-
- // *TODO: Notify user?
- }
- else // editing a local sky
- {
- refreshSkyPresetsList();
- }
+ // If creating a new sky, don't bother.
+ if (isNewPreset())
+ {
+ return;
+ }
+
+ if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) // if editing a region sky
+ {
+ // reset the floater to its initial state
+ reset();
+
+ // *TODO: Notify user?
+ }
+ else // editing a local sky
+ {
+ refreshSkyPresetsList();
+ }
#endif
}
void LLFloaterEditSky::onRegionInfoUpdate()
{
#if 0
- bool can_edit = true;
+ bool can_edit = true;
- // If we've selected a region sky preset for editing.
- if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION)
- {
- // check whether we have the access
- can_edit = LLEnvManagerNew::canEditRegionSettings();
- }
+ // If we've selected a region sky preset for editing.
+ if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION)
+ {
+ // check whether we have the access
+ can_edit = LLEnvManagerNew::canEditRegionSettings();
+ }
- enableEditing(can_edit);
+ enableEditing(can_edit);
#endif
}
diff --git a/indra/newview/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp
index 4a6268435b..9333967b8e 100644
--- a/indra/newview/llfloatereditwater.cpp
+++ b/indra/newview/llfloatereditwater.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatereditwater.cpp
* @brief Floater to create or edit a water preset
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,8 +53,8 @@
#undef max // Fixes a Windows compiler error
-LLFloaterEditWater::LLFloaterEditWater(const LLSD &key):
- LLFloater(key),
+LLFloaterEditWater::LLFloaterEditWater(const LLSD &key):
+ LLFloater(key),
mWaterPresetNameEditor(NULL),
mWaterPresetCombo(NULL),
mMakeDefaultCheckBox(NULL),
@@ -66,115 +66,115 @@ LLFloaterEditWater::LLFloaterEditWater(const LLSD &key):
// virtual
BOOL LLFloaterEditWater::postBuild()
{
- mWaterPresetNameEditor = getChild<LLLineEditor>("water_preset_name");
- mWaterPresetCombo = getChild<LLComboBox>("water_preset_combo");
- mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
- mSaveButton = getChild<LLButton>("save");
+ mWaterPresetNameEditor = getChild<LLLineEditor>("water_preset_name");
+ mWaterPresetCombo = getChild<LLComboBox>("water_preset_combo");
+ mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
+ mSaveButton = getChild<LLButton>("save");
mWaterAdapter = std::make_shared<LLWatterSettingsAdapter>();
LLEnvironment::instance().setWaterListChange(boost::bind(&LLFloaterEditWater::onWaterPresetListChange, this));
- initCallbacks();
- refreshWaterPresetsList();
- syncControls();
+ initCallbacks();
+ refreshWaterPresetsList();
+ syncControls();
- return TRUE;
+ return TRUE;
}
// virtual
void LLFloaterEditWater::onOpen(const LLSD& key)
{
- bool new_preset = isNewPreset();
- std::string param = key.asString();
- std::string floater_title = getString(std::string("title_") + param);
- std::string hint = getString(std::string("hint_" + param));
+ bool new_preset = isNewPreset();
+ std::string param = key.asString();
+ std::string floater_title = getString(std::string("title_") + param);
+ std::string hint = getString(std::string("hint_" + param));
- // Update floater title.
- setTitle(floater_title);
+ // Update floater title.
+ setTitle(floater_title);
- // Update the hint at the top.
- getChild<LLUICtrl>("hint")->setValue(hint);
+ // Update the hint at the top.
+ getChild<LLUICtrl>("hint")->setValue(hint);
- // Hide the hint to the right of the combo if we're invoked to create a new preset.
- getChildView("note")->setVisible(!new_preset);
+ // Hide the hint to the right of the combo if we're invoked to create a new preset.
+ getChildView("note")->setVisible(!new_preset);
- // Switch between the water presets combobox and preset name input field.
- mWaterPresetCombo->setVisible(!new_preset);
- mWaterPresetNameEditor->setVisible(new_preset);
+ // Switch between the water presets combobox and preset name input field.
+ mWaterPresetCombo->setVisible(!new_preset);
+ mWaterPresetNameEditor->setVisible(new_preset);
- reset();
+ reset();
}
// virtual
void LLFloaterEditWater::onClose(bool app_quitting)
{
- if (!app_quitting) // there's no point to change environment if we're quitting
- {
+ if (!app_quitting) // there's no point to change environment if we're quitting
+ {
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
- }
+ }
}
// virtual
void LLFloaterEditWater::draw()
{
- syncControls();
- LLFloater::draw();
+ syncControls();
+ LLFloater::draw();
}
void LLFloaterEditWater::initCallbacks(void)
{
- mWaterPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this), NULL);
- mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterPresetSelected, this));
- mWaterPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this));
+ mWaterPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this), NULL);
+ mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterPresetSelected, this));
+ mWaterPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this));
- mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnSave, this));
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnCancel, this));
+ mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnSave, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnCancel, this));
- // Connect to region info updates.
- LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this));
+ // Connect to region info updates.
+ LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this));
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterEditWater::onColorControlMoved, this, _1, &mWaterAdapter->mFogColor));
- // fog density
+ // fog density
getChild<LLUICtrl>("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterEditWater::onExpFloatControlMoved, this, _1, &mWaterAdapter->mFogDensity));
getChild<LLUICtrl>("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mUnderWaterFogMod));
- // blue density
+ // blue density
getChild<LLUICtrl>("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlXMoved, this, _1, &mWaterAdapter->mNormalScale));
getChild<LLUICtrl>("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlYMoved, this, _1, &mWaterAdapter->mNormalScale));
getChild<LLUICtrl>("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlZMoved, this, _1, &mWaterAdapter->mNormalScale));
- // fresnel
+ // fresnel
getChild<LLUICtrl>("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelScale));
getChild<LLUICtrl>("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelOffset));
- // scale above/below
+ // scale above/below
getChild<LLUICtrl>("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleAbove));
getChild<LLUICtrl>("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleBelow));
- // blur mult
+ // blur mult
getChild<LLUICtrl>("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mBlurMultiplier));
- // wave direction
+ // wave direction
getChild<LLUICtrl>("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave1Dir));
getChild<LLUICtrl>("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave1Dir));
getChild<LLUICtrl>("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave2Dir));
getChild<LLUICtrl>("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave2Dir));
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("WaterNormalMap");
- texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL);
- texture_ctrl->setCommitCallback(boost::bind(&LLFloaterEditWater::onNormalMapPicked, this, _1));
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("WaterNormalMap");
+ texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL);
+ texture_ctrl->setCommitCallback(boost::bind(&LLFloaterEditWater::onNormalMapPicked, this, _1));
}
//=============================================================================
void LLFloaterEditWater::syncControls()
{
- // *TODO: Eliminate slow getChild() calls.
+ // *TODO: Eliminate slow getChild() calls.
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
mEditSettings = pwater;
@@ -183,64 +183,64 @@ void LLFloaterEditWater::syncControls()
mWaterPresetNameEditor->setText(name);
mWaterPresetCombo->setValue(name);
- //getChild<LLUICtrl>("WaterGlow")->setValue(col.mV[3]);
+ //getChild<LLUICtrl>("WaterGlow")->setValue(col.mV[3]);
getChild<LLColorSwatchCtrl>("WaterFogColor")->set(LLColor4(pwater->getWaterFogColor()));
- // fog and wavelets
+ // fog and wavelets
mWaterAdapter->mFogDensity = pwater->getWaterFogDensity();
getChild<LLUICtrl>("WaterFogDensity")->setValue(mWaterAdapter->mFogDensity.getExp());
mWaterAdapter->mUnderWaterFogMod = pwater->getFogMod();
- getChild<LLUICtrl>("WaterUnderWaterFogMod")->setValue(static_cast<F32>(mWaterAdapter->mUnderWaterFogMod));
+ getChild<LLUICtrl>("WaterUnderWaterFogMod")->setValue(static_cast<F32>(mWaterAdapter->mUnderWaterFogMod));
mWaterAdapter->mNormalScale = pwater->getNormalScale();
getChild<LLUICtrl>("WaterNormalScaleX")->setValue(mWaterAdapter->mNormalScale.getX());
- getChild<LLUICtrl>("WaterNormalScaleY")->setValue(mWaterAdapter->mNormalScale.getY());
- getChild<LLUICtrl>("WaterNormalScaleZ")->setValue(mWaterAdapter->mNormalScale.getZ());
+ getChild<LLUICtrl>("WaterNormalScaleY")->setValue(mWaterAdapter->mNormalScale.getY());
+ getChild<LLUICtrl>("WaterNormalScaleZ")->setValue(mWaterAdapter->mNormalScale.getZ());
- // Fresnel
+ // Fresnel
mWaterAdapter->mFresnelScale = pwater->getFresnelScale();
- getChild<LLUICtrl>("WaterFresnelScale")->setValue(static_cast<F32>(mWaterAdapter->mFresnelScale));
+ getChild<LLUICtrl>("WaterFresnelScale")->setValue(static_cast<F32>(mWaterAdapter->mFresnelScale));
mWaterAdapter->mFresnelOffset = pwater->getFresnelOffset();
getChild<LLUICtrl>("WaterFresnelOffset")->setValue(static_cast<F32>(mWaterAdapter->mFresnelOffset));
- // Scale Above/Below
+ // Scale Above/Below
mWaterAdapter->mScaleAbove = pwater->getScaleAbove();
getChild<LLUICtrl>("WaterScaleAbove")->setValue(static_cast<F32>(mWaterAdapter->mScaleAbove));
mWaterAdapter->mScaleBelow = pwater->getScaleBelow();
getChild<LLUICtrl>("WaterScaleBelow")->setValue(static_cast<F32>(mWaterAdapter->mScaleBelow));
- // blur mult
+ // blur mult
mWaterAdapter->mBlurMultiplier = pwater->getBlurMultiplier();
getChild<LLUICtrl>("WaterBlurMult")->setValue(static_cast<F32>(mWaterAdapter->mBlurMultiplier));
- // wave directions
+ // wave directions
mWaterAdapter->mWave1Dir = pwater->getWave1Dir();
- getChild<LLUICtrl>("WaterWave1DirX")->setValue(mWaterAdapter->mWave1Dir.getU());
- getChild<LLUICtrl>("WaterWave1DirY")->setValue(mWaterAdapter->mWave1Dir.getV());
+ getChild<LLUICtrl>("WaterWave1DirX")->setValue(mWaterAdapter->mWave1Dir.getU());
+ getChild<LLUICtrl>("WaterWave1DirY")->setValue(mWaterAdapter->mWave1Dir.getV());
mWaterAdapter->mWave2Dir = pwater->getWave2Dir();
- getChild<LLUICtrl>("WaterWave2DirX")->setValue(mWaterAdapter->mWave2Dir.getU());
+ getChild<LLUICtrl>("WaterWave2DirX")->setValue(mWaterAdapter->mWave2Dir.getU());
getChild<LLUICtrl>("WaterWave2DirY")->setValue(mWaterAdapter->mWave2Dir.getV());
- LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap");
- textCtrl->setImageAssetID(pwater->getNormalMapID());
+ LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap");
+ textCtrl->setImageAssetID(pwater->getNormalMapID());
}
// vector control callbacks
void LLFloaterEditWater::onVector3ControlXMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- vector_ctrl->setX( sldr_ctrl->getValueF32() );
- vector_ctrl->update(mEditSettings);
+ vector_ctrl->setX( sldr_ctrl->getValueF32() );
+ vector_ctrl->update(mEditSettings);
}
// vector control callbacks
void LLFloaterEditWater::onVector3ControlYMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
vector_ctrl->setY(sldr_ctrl->getValueF32());
vector_ctrl->update(mEditSettings);
@@ -284,7 +284,7 @@ void LLFloaterEditWater::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* flo
void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* expFloatControl)
{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
+ LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
expFloatControl->setExp(sldr_ctrl->getValueF32());
expFloatControl->update(mEditSettings);
@@ -292,15 +292,15 @@ void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl*
void LLFloaterEditWater::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl)
{
- LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
- color_ctrl->setColor4( swatch->get() );
- color_ctrl->update(mEditSettings);
+ LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
+ color_ctrl->setColor4( swatch->get() );
+ color_ctrl->update(mEditSettings);
}
void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl)
{
- LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl);
- LLUUID textID = textCtrl->getImageAssetID();
+ LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl);
+ LLUUID textID = textCtrl->getImageAssetID();
mEditSettings->setNormalMapID(textID);
}
@@ -308,28 +308,28 @@ void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl)
void LLFloaterEditWater::reset()
{
- if (isNewPreset())
- {
- mWaterPresetNameEditor->setValue(LLSD());
- mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
- }
- else
- {
- refreshWaterPresetsList();
+ if (isNewPreset())
+ {
+ mWaterPresetNameEditor->setValue(LLSD());
+ mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
+ }
+ else
+ {
+ refreshWaterPresetsList();
- // Disable controls until a water preset to edit is selected.
- enableEditing(false);
- }
+ // Disable controls until a water preset to edit is selected.
+ enableEditing(false);
+ }
}
bool LLFloaterEditWater::isNewPreset() const
{
- return mKey.asString() == "new";
+ return mKey.asString() == "new";
}
void LLFloaterEditWater::refreshWaterPresetsList()
{
- mWaterPresetCombo->removeall();
+ mWaterPresetCombo->removeall();
LLEnvironment::list_name_id_t list = LLEnvironment::instance().getWaterList();
@@ -338,65 +338,65 @@ void LLFloaterEditWater::refreshWaterPresetsList()
mWaterPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second));
}
- mWaterPresetCombo->setLabel(getString("combo_label"));
+ mWaterPresetCombo->setLabel(getString("combo_label"));
}
void LLFloaterEditWater::enableEditing(bool enable)
{
- // Enable/disable water controls.
- getChild<LLPanel>("panel_water_preset")->setCtrlsEnabled(enable);
+ // Enable/disable water controls.
+ getChild<LLPanel>("panel_water_preset")->setCtrlsEnabled(enable);
- // Enable/disable saving.
- mSaveButton->setEnabled(enable);
- mMakeDefaultCheckBox->setEnabled(enable);
+ // Enable/disable saving.
+ mSaveButton->setEnabled(enable);
+ mMakeDefaultCheckBox->setEnabled(enable);
}
void LLFloaterEditWater::saveRegionWater()
{
#if 0
- llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water
+ llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water
- LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL;
+ LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL;
- //LLWaterParamSet region_water = water_mgr.mCurParams;
+ //LLWaterParamSet region_water = water_mgr.mCurParams;
- // *TODO: save to cached region settings.
- LL_WARNS("Windlight") << "Saving region water is not fully implemented yet" << LL_ENDL;
+ // *TODO: save to cached region settings.
+ LL_WARNS("Windlight") << "Saving region water is not fully implemented yet" << LL_ENDL;
#endif
}
#if 0
std::string LLFloaterEditWater::getCurrentPresetName() const
{
- std::string name;
- LLEnvKey::EScope scope;
- getSelectedPreset(name, scope);
- return name;
+ std::string name;
+ LLEnvKey::EScope scope;
+ getSelectedPreset(name, scope);
+ return name;
}
#endif
#if 0
LLEnvKey::EScope LLFloaterEditWater::getCurrentScope() const
{
- std::string name;
- LLEnvKey::EScope scope;
- getSelectedPreset(name, scope);
- return scope;
+ std::string name;
+ LLEnvKey::EScope scope;
+ getSelectedPreset(name, scope);
+ return scope;
}
#endif
std::string LLFloaterEditWater::getSelectedPresetName() const
{
std::string name;
- if (mWaterPresetNameEditor->getVisible())
- {
- name = mWaterPresetNameEditor->getText();
- }
- else
- {
- LLSD combo_val = mWaterPresetCombo->getValue();
- name = combo_val[0].asString();
- }
+ if (mWaterPresetNameEditor->getVisible())
+ {
+ name = mWaterPresetNameEditor->getText();
+ }
+ else
+ {
+ LLSD combo_val = mWaterPresetCombo->getValue();
+ name = combo_val[0].asString();
+ }
return name;
}
@@ -408,16 +408,16 @@ void LLFloaterEditWater::onWaterPresetNameEdited()
pwater->setName(name);
#if 0
- // Disable saving a water preset having empty name.
- mSaveButton->setEnabled(!getCurrentPresetName().empty());
+ // Disable saving a water preset having empty name.
+ mSaveButton->setEnabled(!getCurrentPresetName().empty());
#endif
}
void LLFloaterEditWater::onWaterPresetSelected()
{
- std::string name;
+ std::string name;
- name = getSelectedPresetName();
+ name = getSelectedPresetName();
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName(name);
@@ -438,34 +438,34 @@ void LLFloaterEditWater::onWaterPresetSelected()
bool LLFloaterEditWater::onSaveAnswer(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- // If they choose save, do it. Otherwise, don't do anything
- if (option == 0)
- {
- onSaveConfirmed();
- }
+ // If they choose save, do it. Otherwise, don't do anything
+ if (option == 0)
+ {
+ onSaveConfirmed();
+ }
return false;
}
void LLFloaterEditWater::onSaveConfirmed()
{
- // Save currently displayed water params to the selected preset.
+ // Save currently displayed water params to the selected preset.
std::string name = mEditSettings->getName();
- LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL;
+ LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL;
LLEnvironment::instance().addWater(mEditSettings);
- // Change preference if requested.
- if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue())
- {
- LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL;
+ // Change preference if requested.
+ if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue())
+ {
+ LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL;
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings);
- }
+ }
- closeFloater();
+ closeFloater();
}
void LLFloaterEditWater::onBtnSave()
@@ -478,7 +478,7 @@ void LLFloaterEditWater::onBtnSave()
void LLFloaterEditWater::onBtnCancel()
{
- closeFloater();
+ closeFloater();
}
void LLFloaterEditWater::onWaterPresetListChange()
@@ -489,38 +489,38 @@ void LLFloaterEditWater::onWaterPresetListChange()
void LLFloaterEditWater::onRegionSettingsChange()
{
#if 0
- // If creating a new preset, don't bother.
- if (isNewPreset())
- {
- return;
- }
-
- if (getCurrentScope() == LLEnvKey::SCOPE_REGION) // if editing region water
- {
- // reset the floater to its initial state
- reset();
-
- // *TODO: Notify user?
- }
- else // editing a local preset
- {
- refreshWaterPresetsList();
- }
+ // If creating a new preset, don't bother.
+ if (isNewPreset())
+ {
+ return;
+ }
+
+ if (getCurrentScope() == LLEnvKey::SCOPE_REGION) // if editing region water
+ {
+ // reset the floater to its initial state
+ reset();
+
+ // *TODO: Notify user?
+ }
+ else // editing a local preset
+ {
+ refreshWaterPresetsList();
+ }
#endif
}
void LLFloaterEditWater::onRegionInfoUpdate()
{
#if 0
- bool can_edit = true;
+ bool can_edit = true;
- // If we've selected the region water for editing.
- if (getCurrentScope() == LLEnvKey::SCOPE_REGION)
- {
- // check whether we have the access
- can_edit = LLEnvManagerNew::canEditRegionSettings();
- }
+ // If we've selected the region water for editing.
+ if (getCurrentScope() == LLEnvKey::SCOPE_REGION)
+ {
+ // check whether we have the access
+ can_edit = LLEnvManagerNew::canEditRegionSettings();
+ }
- enableEditing(can_edit);
+ enableEditing(can_edit);
#endif
}
diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp
index 1578caa39c..0abc14262e 100644
--- a/indra/newview/llfloateremojipicker.cpp
+++ b/indra/newview/llfloateremojipicker.cpp
@@ -39,8 +39,8 @@
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llsdserialize.h"
-#include "lltextbox.h"
-#include "llviewerchat.h"
+#include "lltextbox.h"
+#include "llviewerchat.h"
namespace {
// The following variables and constants are used for storing the floater state
diff --git a/indra/newview/llfloateremojipicker.h b/indra/newview/llfloateremojipicker.h
index 5d0402ca83..82faaf821b 100644
--- a/indra/newview/llfloateremojipicker.h
+++ b/indra/newview/llfloateremojipicker.h
@@ -45,7 +45,7 @@ public:
LLFloaterEmojiPicker(const LLSD& key);
- virtual BOOL postBuild() override;
+ virtual BOOL postBuild() override;
virtual void dirtyRect() override;
virtual void goneFromFront() override;
diff --git a/indra/newview/llfloaterenvironmentadjust.cpp b/indra/newview/llfloaterenvironmentadjust.cpp
index c98afefa65..242655b0b6 100644
--- a/indra/newview/llfloaterenvironmentadjust.cpp
+++ b/indra/newview/llfloaterenvironmentadjust.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterfixedenvironment.cpp
* @brief Floaters to create and edit fixed settings for sky and water.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -260,7 +260,7 @@ void LLFloaterEnvironmentAdjust::onButtonReset()
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().updateEnvironment();
}
- });
+ });
}
//-------------------------------------------------------------------------
diff --git a/indra/newview/llfloaterenvironmentadjust.h b/indra/newview/llfloaterenvironmentadjust.h
index db893cca12..20ab2138b0 100644
--- a/indra/newview/llfloaterenvironmentadjust.h
+++ b/indra/newview/llfloaterenvironmentadjust.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterenvironmentadjust.h
* @brief Floaters to create and edit fixed settings for sky and water.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp
index a3504ac6ee..b07f2963b2 100644
--- a/indra/newview/llfloaterevent.cpp
+++ b/indra/newview/llfloaterevent.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterevent.cpp
* @brief Display for events in the finder
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,7 +36,7 @@
#include "llviewerwindow.h"
#include "llbutton.h"
#include "llcachename.h"
-#include "llcommandhandler.h" // secondlife:///app/chat/ support
+#include "llcommandhandler.h" // secondlife:///app/chat/ support
#include "lleventflags.h"
#include "llmediactrl.h"
#include "llexpandabletextbox.h"
@@ -58,10 +58,10 @@
LLFloaterEvent::LLFloaterEvent(const LLSD& key)
- : LLFloater(key),
+ : LLFloater(key),
LLViewerMediaObserver(),
mBrowser(NULL),
- mEventID(0)
+ mEventID(0)
{
}
@@ -73,47 +73,47 @@ LLFloaterEvent::~LLFloaterEvent()
BOOL LLFloaterEvent::postBuild()
{
- mBrowser = getChild<LLMediaCtrl>("browser");
- if (mBrowser)
- {
- mBrowser->addObserver(this);
- }
+ mBrowser = getChild<LLMediaCtrl>("browser");
+ if (mBrowser)
+ {
+ mBrowser->addObserver(this);
+ }
- return TRUE;
+ return TRUE;
}
void LLFloaterEvent::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event)
{
- switch (event)
- {
- case MEDIA_EVENT_NAVIGATE_BEGIN:
- getChild<LLUICtrl>("status_text")->setValue(getString("loading_text"));
- break;
-
- case MEDIA_EVENT_NAVIGATE_COMPLETE:
- getChild<LLUICtrl>("status_text")->setValue(getString("done_text"));
- break;
-
- default:
- break;
- }
+ switch (event)
+ {
+ case MEDIA_EVENT_NAVIGATE_BEGIN:
+ getChild<LLUICtrl>("status_text")->setValue(getString("loading_text"));
+ break;
+
+ case MEDIA_EVENT_NAVIGATE_COMPLETE:
+ getChild<LLUICtrl>("status_text")->setValue(getString("done_text"));
+ break;
+
+ default:
+ break;
+ }
}
void LLFloaterEvent::setEventID(const U32 event_id)
{
- mEventID = event_id;
+ mEventID = event_id;
- if (event_id != 0)
- {
- LLSD subs;
- subs["EVENT_ID"] = (S32)event_id;
- // get the search URL and expand all of the substitutions
- // (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
+ if (event_id != 0)
+ {
+ LLSD subs;
+ subs["EVENT_ID"] = (S32)event_id;
+ // get the search URL and expand all of the substitutions
+ // (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
std::string expanded_url = LLWeb::expandURLSubstitutions(gSavedSettings.getString("EventURL"), subs);
- // and load the URL in the web view
+ // and load the URL in the web view
mBrowser->navigateTo(expanded_url);
-
- }
+
+ }
}
diff --git a/indra/newview/llfloaterevent.h b/indra/newview/llfloaterevent.h
index ed90055d95..071b907cd9 100644
--- a/indra/newview/llfloaterevent.h
+++ b/indra/newview/llfloaterevent.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterevent.h
* @brief Display for events in the finder
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,23 +39,23 @@ class LLFloaterEvent : public LLFloater,
{
public:
- LLFloaterEvent(const LLSD& key);
- /*virtual*/ ~LLFloaterEvent();
+ LLFloaterEvent(const LLSD& key);
+ /*virtual*/ ~LLFloaterEvent();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- void setEventID(const U32 event_id);
+ void setEventID(const U32 event_id);
- U32 getEventID() { return mEventID; }
+ U32 getEventID() { return mEventID; }
protected:
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event);
-
- U32 mEventID;
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event);
+
+ U32 mEventID;
- LLMediaCtrl* mBrowser;
+ LLMediaCtrl* mBrowser;
};
diff --git a/indra/newview/llfloaterexperiencepicker.cpp b/indra/newview/llfloaterexperiencepicker.cpp
index c642da7b83..668143933c 100644
--- a/indra/newview/llfloaterexperiencepicker.cpp
+++ b/indra/newview/llfloaterexperiencepicker.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterexperiencepicker.cpp
* @brief Implementation of llfloaterexperiencepicker
* @author dolphin@lindenlab.com
@@ -46,30 +46,30 @@
LLFloaterExperiencePicker* LLFloaterExperiencePicker::show( select_callback_t callback, const LLUUID& key, BOOL allow_multiple, BOOL close_on_select, filter_list filters, LLView * frustumOrigin )
{
- LLFloaterExperiencePicker* floater =
- LLFloaterReg::showTypedInstance<LLFloaterExperiencePicker>("experience_search", key);
- if (!floater)
- {
- LL_WARNS() << "Cannot instantiate experience picker" << LL_ENDL;
- return NULL;
- }
+ LLFloaterExperiencePicker* floater =
+ LLFloaterReg::showTypedInstance<LLFloaterExperiencePicker>("experience_search", key);
+ if (!floater)
+ {
+ LL_WARNS() << "Cannot instantiate experience picker" << LL_ENDL;
+ return NULL;
+ }
- if (floater->mSearchPanel)
- {
- floater->mSearchPanel->mSelectionCallback = callback;
- floater->mSearchPanel->mCloseOnSelect = close_on_select;
- floater->mSearchPanel->setAllowMultiple(allow_multiple);
- floater->mSearchPanel->setDefaultFilters();
- floater->mSearchPanel->addFilters(filters.begin(), filters.end());
- floater->mSearchPanel->filterContent();
- }
+ if (floater->mSearchPanel)
+ {
+ floater->mSearchPanel->mSelectionCallback = callback;
+ floater->mSearchPanel->mCloseOnSelect = close_on_select;
+ floater->mSearchPanel->setAllowMultiple(allow_multiple);
+ floater->mSearchPanel->setDefaultFilters();
+ floater->mSearchPanel->addFilters(filters.begin(), filters.end());
+ floater->mSearchPanel->filterContent();
+ }
- if(frustumOrigin)
- {
- floater->mFrustumOrigin = frustumOrigin->getHandle();
- }
+ if(frustumOrigin)
+ {
+ floater->mFrustumOrigin = frustumOrigin->getHandle();
+ }
- return floater;
+ return floater;
}
void LLFloaterExperiencePicker::drawFrustum()
@@ -80,32 +80,32 @@ void LLFloaterExperiencePicker::drawFrustum()
void LLFloaterExperiencePicker::draw()
{
- drawFrustum();
- LLFloater::draw();
+ drawFrustum();
+ LLFloater::draw();
}
LLFloaterExperiencePicker::LLFloaterExperiencePicker( const LLSD& key )
- :LLFloater(key)
- ,mSearchPanel(NULL)
- ,mContextConeOpacity(0.f)
- ,mContextConeInAlpha(0.f)
- ,mContextConeOutAlpha(0.f)
- ,mContextConeFadeTime(0.f)
+ :LLFloater(key)
+ ,mSearchPanel(NULL)
+ ,mContextConeOpacity(0.f)
+ ,mContextConeInAlpha(0.f)
+ ,mContextConeOutAlpha(0.f)
+ ,mContextConeFadeTime(0.f)
{
- mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha");
- mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha");
- mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime");
+ mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha");
+ mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha");
+ mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime");
}
LLFloaterExperiencePicker::~LLFloaterExperiencePicker()
{
- gFocusMgr.releaseFocusIfNeeded( this );
+ gFocusMgr.releaseFocusIfNeeded( this );
}
BOOL LLFloaterExperiencePicker::postBuild()
{
- mSearchPanel = new LLPanelExperiencePicker();
- addChild(mSearchPanel);
- mSearchPanel->setOrigin(0, 0);
- return LLFloater::postBuild();
+ mSearchPanel = new LLPanelExperiencePicker();
+ addChild(mSearchPanel);
+ mSearchPanel->setOrigin(0, 0);
+ return LLFloater::postBuild();
}
diff --git a/indra/newview/llfloaterexperiencepicker.h b/indra/newview/llfloaterexperiencepicker.h
index 29054a57db..49f96dfea0 100644
--- a/indra/newview/llfloaterexperiencepicker.h
+++ b/indra/newview/llfloaterexperiencepicker.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterexperiencepicker.h
* @brief Header file for llfloaterexperiencepicker
* @author dolphin@lindenlab.com
@@ -38,29 +38,29 @@ class LLFloaterExperiencePicker : public LLFloater
{
public:
- typedef boost::function<void (const uuid_vec_t&)> select_callback_t;
- // filter function for experiences, return true if the experience should be hidden.
- typedef boost::function<bool (const LLSD&)> filter_function;
- typedef std::vector<filter_function> filter_list;
+ typedef boost::function<void (const uuid_vec_t&)> select_callback_t;
+ // filter function for experiences, return true if the experience should be hidden.
+ typedef boost::function<bool (const LLSD&)> filter_function;
+ typedef std::vector<filter_function> filter_list;
- static LLFloaterExperiencePicker* show( select_callback_t callback, const LLUUID& key, BOOL allow_multiple, BOOL close_on_select, filter_list filters, LLView * frustumOrigin);
+ static LLFloaterExperiencePicker* show( select_callback_t callback, const LLUUID& key, BOOL allow_multiple, BOOL close_on_select, filter_list filters, LLView * frustumOrigin);
- LLFloaterExperiencePicker(const LLSD& key);
- virtual ~LLFloaterExperiencePicker();
+ LLFloaterExperiencePicker(const LLSD& key);
+ virtual ~LLFloaterExperiencePicker();
- BOOL postBuild();
-
- virtual void draw();
+ BOOL postBuild();
+
+ virtual void draw();
private:
- LLPanelExperiencePicker* mSearchPanel;
+ LLPanelExperiencePicker* mSearchPanel;
- void drawFrustum();
- LLHandle <LLView> mFrustumOrigin;
- F32 mContextConeOpacity;
- F32 mContextConeInAlpha;
- F32 mContextConeOutAlpha;
- F32 mContextConeFadeTime;
+ void drawFrustum();
+ LLHandle <LLView> mFrustumOrigin;
+ F32 mContextConeOpacity;
+ F32 mContextConeInAlpha;
+ F32 mContextConeOutAlpha;
+ F32 mContextConeFadeTime;
};
#endif // LL_LLFLOATEREXPERIENCEPICKER_H
diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp
index f6afdd29fb..0966eaa1bf 100644
--- a/indra/newview/llfloaterexperienceprofile.cpp
+++ b/indra/newview/llfloaterexperienceprofile.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterexperienceprofile.cpp
* @brief llfloaterexperienceprofile and related class definitions
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -147,8 +147,8 @@ BOOL LLFloaterExperienceProfile::postBuild()
{
LLExperienceCache::instance().fetch(mExperienceId, true);
LLExperienceCache::instance().get(mExperienceId, boost::bind(&LLFloaterExperienceProfile::experienceCallback,
- getDerivedHandle<LLFloaterExperienceProfile>(), _1));
-
+ getDerivedHandle<LLFloaterExperienceProfile>(), _1));
+
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
@@ -162,17 +162,17 @@ BOOL LLFloaterExperienceProfile::postBuild()
childSetAction(BTN_FORGET, boost::bind(&LLFloaterExperienceProfile::onClickForget, this));
childSetAction(BTN_BLOCK, boost::bind(&LLFloaterExperienceProfile::onClickPermission, this, "Block"));
childSetAction(BTN_CANCEL, boost::bind(&LLFloaterExperienceProfile::onClickCancel, this));
- childSetAction(BTN_SAVE, boost::bind(&LLFloaterExperienceProfile::onClickSave, this));
- childSetAction(BTN_SET_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickLocation, this));
- childSetAction(BTN_CLEAR_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickClear, this));
- childSetAction(BTN_SET_GROUP, boost::bind(&LLFloaterExperienceProfile::onPickGroup, this));
- childSetAction(BTN_REPORT, boost::bind(&LLFloaterExperienceProfile::onReportExperience, this));
+ childSetAction(BTN_SAVE, boost::bind(&LLFloaterExperienceProfile::onClickSave, this));
+ childSetAction(BTN_SET_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickLocation, this));
+ childSetAction(BTN_CLEAR_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickClear, this));
+ childSetAction(BTN_SET_GROUP, boost::bind(&LLFloaterExperienceProfile::onPickGroup, this));
+ childSetAction(BTN_REPORT, boost::bind(&LLFloaterExperienceProfile::onReportExperience, this));
getChild<LLTextEditor>(EDIT TF_DESC)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this));
getChild<LLUICtrl>(EDIT TF_MATURITY)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this));
getChild<LLLineEditor>(EDIT TF_MRKT)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL);
getChild<LLLineEditor>(EDIT TF_NAME)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL);
-
+
childSetCommitCallback(EDIT BTN_ENABLE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL);
childSetCommitCallback(EDIT BTN_PRIVATE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL);
@@ -181,7 +181,7 @@ BOOL LLFloaterExperienceProfile::postBuild()
getChild<LLTextEditor>(EDIT TF_DESC)->setCommitOnFocusLost(TRUE);
- LLEventPumps::instance().obtain("experience_permission").listen(mExperienceId.asString()+"-profile",
+ LLEventPumps::instance().obtain("experience_permission").listen(mExperienceId.asString()+"-profile",
boost::bind(&LLFloaterExperienceProfile::experiencePermission, getDerivedHandle<LLFloaterExperienceProfile>(this), _1));
if (mPostEdit && mExperienceId.notNull())
@@ -296,7 +296,7 @@ bool LLFloaterExperienceProfile::setMaturityString( U8 maturity, LLTextBox* chil
child->appendImageSegment(style);
child->appendText(access, false);
-
+
return true;
}
@@ -310,8 +310,8 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
LLLayoutPanel* imagePanel = getChild<LLLayoutPanel>(PNL_IMAGE);
LLLayoutPanel* descriptionPanel = getChild<LLLayoutPanel>(PNL_DESC);
LLLayoutPanel* locationPanel = getChild<LLLayoutPanel>(PNL_LOC);
- LLLayoutPanel* marketplacePanel = getChild<LLLayoutPanel>(PNL_MRKT);
- LLLayoutPanel* topPanel = getChild<LLLayoutPanel>(PNL_TOP);
+ LLLayoutPanel* marketplacePanel = getChild<LLLayoutPanel>(PNL_MRKT);
+ LLLayoutPanel* topPanel = getChild<LLLayoutPanel>(PNL_TOP);
imagePanel->setVisible(FALSE);
@@ -323,11 +323,11 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
LLTextBox* child = getChild<LLTextBox>(TF_NAME);
//child->setText(experience[LLExperienceCache::NAME].asString());
- child->setText(LLSLURL("experience", experience[LLExperienceCache::EXPERIENCE_ID], "profile").getSLURLString());
-
+ child->setText(LLSLURL("experience", experience[LLExperienceCache::EXPERIENCE_ID], "profile").getSLURLString());
+
LLLineEditor* linechild = getChild<LLLineEditor>(EDIT TF_NAME);
linechild->setText(experience[LLExperienceCache::NAME].asString());
-
+
std::string value = experience[LLExperienceCache::DESCRIPTION].asString();
LLExpandableTextBox* exchild = getChild<LLExpandableTextBox>(TF_DESC);
exchild->setText(value);
@@ -335,7 +335,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
LLTextEditor* edit_child = getChild<LLTextEditor>(EDIT TF_DESC);
edit_child->setText(value);
-
+
mLocationSLURL = experience[LLExperienceCache::SLURL].asString();
child = getChild<LLTextBox>(TF_SLURL);
bool has_slurl = mLocationSLURL.length()>0;
@@ -353,7 +353,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
{
child->setText(getString("empty_slurl"));
}
-
+
setMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()), getChild<LLTextBox>(TF_MATURITY), getChild<LLComboBox>(EDIT TF_MATURITY));
LLUUID id = experience[LLExperienceCache::AGENT_ID].asUUID();
@@ -363,22 +363,22 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
id = experience[LLExperienceCache::GROUP_ID].asUUID();
- bool id_null = id.isNull();
+ bool id_null = id.isNull();
child = getChild<LLTextBox>(TF_GROUP);
value = LLSLURL("group", id, "inspect").getSLURLString();
child->setText(value);
getChild<LLLayoutPanel>(PNL_GROUP)->setVisible(!id_null);
- setEditGroup(id);
+ setEditGroup(id);
+
+ getChild<LLButton>(BTN_SET_GROUP)->setEnabled(experience[LLExperienceCache::AGENT_ID].asUUID() == gAgent.getID());
- getChild<LLButton>(BTN_SET_GROUP)->setEnabled(experience[LLExperienceCache::AGENT_ID].asUUID() == gAgent.getID());
-
LLCheckBoxCtrl* enable = getChild<LLCheckBoxCtrl>(EDIT BTN_ENABLE);
S32 properties = mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger();
- enable->set(!(properties & LLExperienceCache::PROPERTY_DISABLED));
+ enable->set(!(properties & LLExperienceCache::PROPERTY_DISABLED));
enable = getChild<LLCheckBoxCtrl>(EDIT BTN_PRIVATE);
- enable->set(properties & LLExperienceCache::PROPERTY_PRIVATE);
+ enable->set(properties & LLExperienceCache::PROPERTY_PRIVATE);
topPanel->setVisible(TRUE);
child=getChild<LLTextBox>(TF_GRID_WIDE);
@@ -388,15 +388,15 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
{
child->setText(LLTrans::getString("Grid-Scope"));
}
- else
- {
+ else
+ {
child->setText(LLTrans::getString("Land-Scope"));
- }
+ }
- if(getChild<LLButton>(BTN_EDIT)->getVisible())
- {
- topPanel->setVisible(TRUE);
- }
+ if(getChild<LLButton>(BTN_EDIT)->getVisible())
+ {
+ topPanel->setVisible(TRUE);
+ }
if(properties & LLExperienceCache::PROPERTY_PRIVILEGED)
{
@@ -412,11 +412,11 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
&LLFloaterExperienceProfile::experiencePermissionResults, mExperienceId, _1));
}
}
-
+
value=experience[LLExperienceCache::METADATA].asString();
if(value.empty())
return;
-
+
LLPointer<LLSDParser> parser = new LLSDXMLParser();
LLSD data;
@@ -444,7 +444,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
{
marketplacePanel->setVisible(FALSE);
}
-
+
linechild = getChild<LLLineEditor>(EDIT TF_MRKT);
linechild->setText(value);
@@ -510,10 +510,10 @@ void LLFloaterExperienceProfile::onFieldChanged()
{
updatePackage();
- if(!getChild<LLButton>(BTN_EDIT)->getVisible())
- {
- return;
- }
+ if(!getChild<LLButton>(BTN_EDIT)->getVisible())
+ {
+ return;
+ }
LLSD::map_const_iterator st = mExperienceDetails.beginMap();
LLSD::map_const_iterator dt = mPackage.beginMap();
@@ -590,7 +590,7 @@ void LLFloaterExperienceProfile::doSave( int success_action )
return;
LLExperienceCache::instance().updateExperience(mPackage, boost::bind(
- &LLFloaterExperienceProfile::experienceUpdateResult,
+ &LLFloaterExperienceProfile::experienceUpdateResult,
getDerivedHandle<LLFloaterExperienceProfile>(), _1));
}
@@ -598,34 +598,34 @@ void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content )
{
LLUUID id = getExperienceId();
- if(content.has("removed"))
- {
- const LLSD& removed = content["removed"];
- LLSD::map_const_iterator it = removed.beginMap();
- for(/**/; it != removed.endMap(); ++it)
- {
- const std::string& field = it->first;
- if(field == LLExperienceCache::EXPERIENCE_ID)
- {
- //this message should be removed by the experience api
- continue;
- }
- const LLSD& data = it->second;
- std::string error_tag = data["error_tag"].asString()+ "ExperienceProfileMessage";
- LLSD fields;
- if( LLNotifications::instance().getTemplate(error_tag))
- {
- fields["field"] = field;
- fields["extra_info"] = data["extra_info"];
- LLNotificationsUtil::add(error_tag, fields);
- }
- else
- {
- fields["MESSAGE"]=data["en"];
- LLNotificationsUtil::add("GenericAlert", fields);
- }
- }
- }
+ if(content.has("removed"))
+ {
+ const LLSD& removed = content["removed"];
+ LLSD::map_const_iterator it = removed.beginMap();
+ for(/**/; it != removed.endMap(); ++it)
+ {
+ const std::string& field = it->first;
+ if(field == LLExperienceCache::EXPERIENCE_ID)
+ {
+ //this message should be removed by the experience api
+ continue;
+ }
+ const LLSD& data = it->second;
+ std::string error_tag = data["error_tag"].asString()+ "ExperienceProfileMessage";
+ LLSD fields;
+ if( LLNotifications::instance().getTemplate(error_tag))
+ {
+ fields["field"] = field;
+ fields["extra_info"] = data["extra_info"];
+ LLNotificationsUtil::add(error_tag, fields);
+ }
+ else
+ {
+ fields["MESSAGE"]=data["en"];
+ LLNotificationsUtil::add("GenericAlert", fields);
+ }
+ }
+ }
if(!content.has("experience_keys"))
{
@@ -647,7 +647,7 @@ void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content )
LL_WARNS() << "LLFloaterExperienceProfile::onSaveComplete called with unexpected experience id" << LL_ENDL;
return;
}
-
+
refreshExperience(*it);
LLExperienceCache::instance().insert(*it);
LLExperienceCache::instance().fetch(id, true);
@@ -660,7 +660,7 @@ void LLFloaterExperienceProfile::onSaveComplete( const LLSD& content )
else if(mSaveCompleteAction == CLOSE)
{
closeFloater();
- }
+ }
}
void LLFloaterExperienceProfile::changeToView()
@@ -692,7 +692,7 @@ void LLFloaterExperienceProfile::onClickLocation()
if(region)
{
LLTextBox* child = getChild<LLTextBox>(EDIT TF_SLURL);
- mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString();
+ mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString();
child->setText(mLocationSLURL);
onFieldChanged();
}
@@ -701,7 +701,7 @@ void LLFloaterExperienceProfile::onClickLocation()
void LLFloaterExperienceProfile::onClickClear()
{
LLTextBox* child = getChild<LLTextBox>(EDIT TF_SLURL);
- mLocationSLURL = "";
+ mLocationSLURL = "";
child->setText(getString("empty_slurl"));
onFieldChanged();
}
@@ -781,7 +781,7 @@ void LLFloaterExperienceProfile::updatePackage()
{
mPackage[LLExperienceCache::NAME] = getChild<LLLineEditor>(EDIT TF_NAME)->getText();
mPackage[LLExperienceCache::DESCRIPTION] = getChild<LLTextEditor>(EDIT TF_DESC)->getText();
- if(mLocationSLURL.empty())
+ if(mLocationSLURL.empty())
{
mPackage[LLExperienceCache::SLURL] = LLStringUtil::null;
}
@@ -831,33 +831,33 @@ void LLFloaterExperienceProfile::updatePackage()
void LLFloaterExperienceProfile::onPickGroup()
{
- LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
- LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
- if (widget)
- {
- widget->setSelectGroupCallback(boost::bind(&LLFloaterExperienceProfile::setEditGroup, this, _1));
- if (parent_floater)
- {
- LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, widget);
- widget->setOrigin(new_rect.mLeft, new_rect.mBottom);
- parent_floater->addDependentFloater(widget);
- }
- }
+ LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
+ if (widget)
+ {
+ widget->setSelectGroupCallback(boost::bind(&LLFloaterExperienceProfile::setEditGroup, this, _1));
+ if (parent_floater)
+ {
+ LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, widget);
+ widget->setOrigin(new_rect.mLeft, new_rect.mBottom);
+ parent_floater->addDependentFloater(widget);
+ }
+ }
}
void LLFloaterExperienceProfile::setEditGroup( LLUUID group_id )
{
- LLTextBox* child = getChild<LLTextBox>(EDIT TF_GROUP);
- std::string value = LLSLURL("group", group_id, "inspect").getSLURLString();
- child->setText(value);
- mPackage[LLExperienceCache::GROUP_ID] = group_id;
- onFieldChanged();
+ LLTextBox* child = getChild<LLTextBox>(EDIT TF_GROUP);
+ std::string value = LLSLURL("group", group_id, "inspect").getSLURLString();
+ child->setText(value);
+ mPackage[LLExperienceCache::GROUP_ID] = group_id;
+ onFieldChanged();
}
void LLFloaterExperienceProfile::onReportExperience()
{
- LLFloaterReporter::showFromExperience(mExperienceId);
+ LLFloaterReporter::showFromExperience(mExperienceId);
}
/*static*/
diff --git a/indra/newview/llfloaterexperienceprofile.h b/indra/newview/llfloaterexperienceprofile.h
index f9b6e2e2eb..16bda14cbf 100644
--- a/indra/newview/llfloaterexperienceprofile.h
+++ b/indra/newview/llfloaterexperienceprofile.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterexperienceprofile.h
* @brief llfloaterexperienceprofile and related class definitions
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,7 +51,7 @@ public:
LLFloaterExperienceProfile(const LLSD& data);
virtual ~LLFloaterExperienceProfile();
-
+
/* virtual */ bool matchesKey(const LLSD& key);
LLUUID getExperienceId() const { return mExperienceId; }
@@ -70,12 +70,12 @@ protected:
void onClickCancel();
void onClickSave();
void onClickLocation();
- void onClickClear();
- void onPickGroup();
- void onFieldChanged();
- void onReportExperience();
+ void onClickClear();
+ void onPickGroup();
+ void onFieldChanged();
+ void onReportExperience();
- void setEditGroup(LLUUID group_id);
+ void setEditGroup(LLUUID group_id);
void changeToView();
void changeToEdit();
@@ -98,7 +98,7 @@ protected:
LLUUID mExperienceId;
LLSD mExperienceDetails;
LLSD mPackage;
- std::string mLocationSLURL;
+ std::string mLocationSLURL;
int mSaveCompleteAction;
bool mDirty;
bool mForceClose;
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp
index 184e39402a..8fc1d88cc9 100644
--- a/indra/newview/llfloaterexperiences.cpp
+++ b/indra/newview/llfloaterexperiences.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterexperiences.cpp
* @brief LLFloaterExperiences class implementation
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,38 +43,38 @@
#define SHOW_RECENT_TAB (0)
LLFloaterExperiences::LLFloaterExperiences(const LLSD& data)
- :LLFloater(data)
+ :LLFloater(data)
{
}
LLPanelExperiences* LLFloaterExperiences::addTab(const std::string& name, bool select)
{
- LLPanelExperiences* newPanel = LLPanelExperiences::create(name);
+ LLPanelExperiences* newPanel = LLPanelExperiences::create(name);
getChild<LLTabContainer>("xp_tabs")->addTabPanel(LLTabContainer::TabPanelParams().
panel(newPanel).
label(LLTrans::getString(name)).
select_tab(select));
- return newPanel;
+ return newPanel;
}
BOOL LLFloaterExperiences::postBuild()
{
- getChild<LLTabContainer>("xp_tabs")->addTabPanel(new LLPanelExperiencePicker());
+ getChild<LLTabContainer>("xp_tabs")->addTabPanel(new LLPanelExperiencePicker());
addTab("Allowed_Experiences_Tab", true);
addTab("Blocked_Experiences_Tab", false);
addTab("Admin_Experiences_Tab", false);
addTab("Contrib_Experiences_Tab", false);
- LLPanelExperiences* owned = addTab("Owned_Experiences_Tab", false);
- owned->setButtonAction("acquire", boost::bind(&LLFloaterExperiences::sendPurchaseRequest, this));
- owned->enableButton(false);
+ LLPanelExperiences* owned = addTab("Owned_Experiences_Tab", false);
+ owned->setButtonAction("acquire", boost::bind(&LLFloaterExperiences::sendPurchaseRequest, this));
+ owned->enableButton(false);
#if SHOW_RECENT_TAB
- addTab("Recent_Experiences_Tab", false);
+ addTab("Recent_Experiences_Tab", false);
#endif //SHOW_RECENT_TAB
- getChild<LLTabContainer>("xp_tabs")->addTabPanel(new LLPanelExperienceLog());
+ getChild<LLTabContainer>("xp_tabs")->addTabPanel(new LLPanelExperienceLog());
resizeToTabs();
- return TRUE;
+ return TRUE;
}
@@ -152,7 +152,7 @@ void LLFloaterExperiences::refreshContents()
updateInfo("GetAdminExperiences","Admin_Experiences_Tab");
updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab");
- retrieveExperienceList(region->getCapability("AgentExperiences"), handle, tabMap,
+ retrieveExperienceList(region->getCapability("AgentExperiences"), handle, tabMap,
"ExperienceAcquireFailed", boost::bind(&LLFloaterExperiences::checkPurchaseInfo, this, _1, _2));
}
}
@@ -206,7 +206,7 @@ bool LLFloaterExperiences::updatePermissions( const LLSD& permission )
}
}
}
-
+
tab = (LLPanelExperiences*)tabs->getPanelByName("Blocked_Experiences_Tab");
if(tab)
{
@@ -237,10 +237,10 @@ void LLFloaterExperiences::onClose( bool app_quitting )
void LLFloaterExperiences::checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content) const
{
- panel->enableButton(content.has("purchase"));
+ panel->enableButton(content.has("purchase"));
- LLFloaterExperiences::findInstance()->updateInfo("GetAdminExperiences","Admin_Experiences_Tab");
- LLFloaterExperiences::findInstance()->updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab");
+ LLFloaterExperiences::findInstance()->updateInfo("GetAdminExperiences","Admin_Experiences_Tab");
+ LLFloaterExperiences::findInstance()->updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab");
}
void LLFloaterExperiences::checkAndOpen(LLPanelExperiences* panel, const LLSD& content) const
@@ -271,9 +271,9 @@ void LLFloaterExperiences::checkAndOpen(LLPanelExperiences* panel, const LLSD& c
void LLFloaterExperiences::updateInfo(std::string experienceCap, std::string tab)
{
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
NameMap_t tabMap;
LLHandle<LLFloaterExperiences> handle = getDerivedHandle<LLFloaterExperiences>();
@@ -283,7 +283,7 @@ void LLFloaterExperiences::updateInfo(std::string experienceCap, std::string tab
}
}
-void LLFloaterExperiences::sendPurchaseRequest()
+void LLFloaterExperiences::sendPurchaseRequest()
{
LLViewerRegion* region = gAgent.getRegion();
@@ -311,7 +311,7 @@ void LLFloaterExperiences::sendPurchaseRequest()
LLFloaterExperiences* LLFloaterExperiences::findInstance()
{
- return LLFloaterReg::findTypedInstance<LLFloaterExperiences>("experiences");
+ return LLFloaterReg::findTypedInstance<LLFloaterExperiences>("experiences");
}
@@ -359,8 +359,8 @@ void LLFloaterExperiences::requestNewExperience(const std::string &url,
}
-void LLFloaterExperiences::retrieveExperienceListCoro(std::string url,
- LLHandle<LLFloaterExperiences> hparent, NameMap_t tabMapping,
+void LLFloaterExperiences::retrieveExperienceListCoro(std::string url,
+ LLHandle<LLFloaterExperiences> hparent, NameMap_t tabMapping,
std::string errorNotify, Callback_t cback, invokationFn_t invoker)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
diff --git a/indra/newview/llfloaterexperiences.h b/indra/newview/llfloaterexperiences.h
index 6d0559af7c..6fb77c5935 100644
--- a/indra/newview/llfloaterexperiences.h
+++ b/indra/newview/llfloaterexperiences.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterexperiences.h
* @brief LLFloaterExperiences class definition
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
class LLPanelExperiences;
class LLFloaterExperiences :
- public LLFloater
+ public LLFloater
{
public:
LLFloaterExperiences(const LLSD& data);
@@ -47,16 +47,16 @@ protected:
void clearFromRecent(const LLSD& ids);
void resizeToTabs();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
void refreshContents();
void setupRecentTabs();
LLPanelExperiences* addTab(const std::string& name, bool select);
bool updatePermissions(const LLSD& permission);
- void sendPurchaseRequest();
- void checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content)const;
+ void sendPurchaseRequest();
+ void checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content)const;
void checkAndOpen(LLPanelExperiences* panel, const LLSD& content) const;
- void updateInfo(std::string experiences, std::string tab);
+ void updateInfo(std::string experiences, std::string tab);
void retrieveExperienceList(const std::string &url, const LLHandle<LLFloaterExperiences> &hparent, const NameMap_t &tabMapping,
const std::string &errorNotify = std::string("ErrorMessage"), Callback_t cback = Callback_t());
@@ -68,7 +68,7 @@ private:
typedef boost::function < LLSD(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t, LLCore::HttpRequest::ptr_t,
const std::string, LLCore::HttpOptions::ptr_t, LLCore::HttpHeaders::ptr_t) > invokationFn_t;
- static void retrieveExperienceListCoro(std::string url, LLHandle<LLFloaterExperiences> hparent,
+ static void retrieveExperienceListCoro(std::string url, LLHandle<LLFloaterExperiences> hparent,
NameMap_t tabMapping, std::string errorNotify, Callback_t cback, invokationFn_t invoker);
std::vector<LLUUID> mPrepurchaseIds;
};
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index 3e8bad3ef5..ad9f83701c 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterfixedenvironment.cpp
* @brief Floaters to create and edit fixed settings for sky and water.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -429,7 +429,7 @@ BOOL LLFloaterFixedEnvironmentWater::postBuild()
void LLFloaterFixedEnvironmentWater::updateEditEnvironment(void)
{
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT,
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT,
std::static_pointer_cast<LLSettingsWater>(mSettings));
}
@@ -437,7 +437,7 @@ void LLFloaterFixedEnvironmentWater::onOpen(const LLSD& key)
{
if (!mSettings)
{
- // Initialize the settings, take a snapshot of the current water.
+ // Initialize the settings, take a snapshot of the current water.
mSettings = LLEnvironment::instance().getEnvironmentFixedWater(LLEnvironment::ENV_CURRENT)->buildClone();
mSettings->setName("Snapshot water (new)");
@@ -461,7 +461,7 @@ void LLFloaterFixedEnvironmentWater::loadWaterSettingFromFile(const std::vector<
LLSettingsWater::ptr_t legacywater = LLEnvironment::createWaterFromLegacyPreset(filename, messages);
if (!legacywater)
- {
+ {
LLNotificationsUtil::add("WLImportFail", messages);
return;
}
@@ -508,7 +508,7 @@ BOOL LLFloaterFixedEnvironmentSky::postBuild()
void LLFloaterFixedEnvironmentSky::updateEditEnvironment(void)
{
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT,
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT,
std::static_pointer_cast<LLSettingsSky>(mSettings));
}
@@ -516,7 +516,7 @@ void LLFloaterFixedEnvironmentSky::onOpen(const LLSD& key)
{
if (!mSettings)
{
- // Initialize the settings, take a snapshot of the current water.
+ // Initialize the settings, take a snapshot of the current water.
mSettings = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_CURRENT)->buildClone();
mSettings->setName("Snapshot sky (new)");
LLEnvironment::instance().saveBeaconsState();
@@ -548,7 +548,7 @@ void LLFloaterFixedEnvironmentSky::loadSkySettingFromFile(const std::vector<std:
LLSettingsSky::ptr_t legacysky = LLEnvironment::createSkyFromLegacyPreset(filename, messages);
if (!legacysky)
- {
+ {
LLNotificationsUtil::add("WLImportFail", messages);
return;
diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h
index f35f4a4368..c616cc64bf 100644
--- a/indra/newview/llfloaterfixedenvironment.h
+++ b/indra/newview/llfloaterfixedenvironment.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterfixedenvironment.h
* @brief Floaters to create and edit fixed settings for sky and water.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,7 +50,7 @@ public:
LLFloaterFixedEnvironment(const LLSD &key);
~LLFloaterFixedEnvironment();
- virtual BOOL postBuild() override;
+ virtual BOOL postBuild() override;
virtual void onOpen(const LLSD& key) override;
virtual void onClose(bool app_quitting) override;
@@ -101,7 +101,7 @@ class LLFloaterFixedEnvironmentWater : public LLFloaterFixedEnvironment
public:
LLFloaterFixedEnvironmentWater(const LLSD &key);
- BOOL postBuild() override;
+ BOOL postBuild() override;
virtual void onOpen(const LLSD& key) override;
@@ -121,7 +121,7 @@ class LLFloaterFixedEnvironmentSky : public LLFloaterFixedEnvironment
public:
LLFloaterFixedEnvironmentSky(const LLSD &key);
- BOOL postBuild() override;
+ BOOL postBuild() override;
virtual void onOpen(const LLSD& key) override;
virtual void onClose(bool app_quitting) override;
diff --git a/indra/newview/llfloaterfonttest.cpp b/indra/newview/llfloaterfonttest.cpp
index ff27b683b7..95d08cb9ce 100644
--- a/indra/newview/llfloaterfonttest.cpp
+++ b/indra/newview/llfloaterfonttest.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterfonttest.cpp
* @author Brad Payne
* @brief LLFloaterFontTest class implementation
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,7 +37,7 @@
LLFloaterFontTest::LLFloaterFontTest(const LLSD& key)
- : LLFloater("floater_font_test")
+ : LLFloater("floater_font_test")
{
}
diff --git a/indra/newview/llfloaterfonttest.h b/indra/newview/llfloaterfonttest.h
index fc82d7ef51..dfad25c6e9 100644
--- a/indra/newview/llfloaterfonttest.h
+++ b/indra/newview/llfloaterfonttest.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterfonttest.h
* @author Brad Payne
* @brief floater to exercise standard fonts
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,12 +31,12 @@
#include "llfloater.h"
class LLFloaterFontTest:
- public LLFloater
+ public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
private:
- LLFloaterFontTest(const LLSD& key);
- ~LLFloaterFontTest();
+ LLFloaterFontTest(const LLSD& key);
+ ~LLFloaterFontTest();
};
#endif
diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp
index f576ce7a76..13787c4435 100644
--- a/indra/newview/llfloaterforgetuser.cpp
+++ b/indra/newview/llfloaterforgetuser.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterforgetuser.cpp
* @brief LLFloaterForgetUser class definition.
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -157,7 +157,7 @@ bool LLFloaterForgetUser::onConfirmForget(const LLSD& notification, const LLSD&
return false;
}
-// static
+// static
bool LLFloaterForgetUser::onConfirmLogout(const LLSD& notification, const LLSD& response, const std::string &fav_id, const std::string &grid)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
diff --git a/indra/newview/llfloaterforgetuser.h b/indra/newview/llfloaterforgetuser.h
index 801fcbb412..039b24c783 100644
--- a/indra/newview/llfloaterforgetuser.h
+++ b/indra/newview/llfloaterforgetuser.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterforgetuser.h
* @brief LLFloaterForgetUser class declaration.
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index f29046c513..3b2132d4b1 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergesture.cpp
* @brief Read-only list of gestures from your inventory.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,25 +46,25 @@
#include "llscrolllistctrl.h"
#include "lltrans.h"
#include "llviewergesture.h"
-#include "llviewermenu.h"
+#include "llviewermenu.h"
#include "llviewerinventory.h"
#include "llviewercontrol.h"
#include "llfloaterperms.h"
BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b )
{
- return LLStringUtil::precedesDict( a->getName(), b->getName() );
+ return LLStringUtil::precedesDict( a->getName(), b->getName() );
}
class LLFloaterGestureObserver : public LLGestureManagerObserver
{
public:
- LLFloaterGestureObserver(LLFloaterGesture* floater) : mFloater(floater) {}
- virtual ~LLFloaterGestureObserver() {}
- virtual void changed() { mFloater->refreshAll(); }
+ LLFloaterGestureObserver(LLFloaterGesture* floater) : mFloater(floater) {}
+ virtual ~LLFloaterGestureObserver() {}
+ virtual void changed() { mFloater->refreshAll(); }
private:
- LLFloaterGesture* mFloater;
+ LLFloaterGesture* mFloater;
};
//-----------------------------
// GestureCallback
@@ -73,641 +73,641 @@ private:
class GestureShowCallback : public LLInventoryCallback
{
public:
- void fire(const LLUUID &inv_item)
- {
- LLPreviewGesture::show(inv_item, LLUUID::null);
-
- LLInventoryItem* item = gInventory.getItem(inv_item);
- if (item)
- {
- LLPermissions perm = item->getPermissions();
- perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Gestures"));
- perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures"));
- perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures"));
- item->setPermissions(perm);
- item->updateServer(FALSE);
- }
- }
+ void fire(const LLUUID &inv_item)
+ {
+ LLPreviewGesture::show(inv_item, LLUUID::null);
+
+ LLInventoryItem* item = gInventory.getItem(inv_item);
+ if (item)
+ {
+ LLPermissions perm = item->getPermissions();
+ perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Gestures"));
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures"));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures"));
+ item->setPermissions(perm);
+ item->updateServer(FALSE);
+ }
+ }
};
class GestureCopiedCallback : public LLInventoryCallback
{
private:
- LLFloaterGesture* mFloater;
-
+ LLFloaterGesture* mFloater;
+
public:
- GestureCopiedCallback(LLFloaterGesture* floater): mFloater(floater)
- {}
- void fire(const LLUUID &inv_item)
- {
- if(mFloater)
- {
- mFloater->addGesture(inv_item,NULL,mFloater->getChild<LLScrollListCtrl>("gesture_list"));
-
- // EXP-1909 (Pasted gesture displayed twice)
- // The problem is that addGesture is called here for the second time for the same item (which is copied)
- // First time addGesture is called from LLFloaterGestureObserver::changed(), which is a callback for inventory
- // change. So we need to refresh the gesture list to avoid duplicates.
- mFloater->refreshAll();
- }
- }
+ GestureCopiedCallback(LLFloaterGesture* floater): mFloater(floater)
+ {}
+ void fire(const LLUUID &inv_item)
+ {
+ if(mFloater)
+ {
+ mFloater->addGesture(inv_item,NULL,mFloater->getChild<LLScrollListCtrl>("gesture_list"));
+
+ // EXP-1909 (Pasted gesture displayed twice)
+ // The problem is that addGesture is called here for the second time for the same item (which is copied)
+ // First time addGesture is called from LLFloaterGestureObserver::changed(), which is a callback for inventory
+ // change. So we need to refresh the gesture list to avoid duplicates.
+ mFloater->refreshAll();
+ }
+ }
};
//---------------------------------------------------------------------------
// LLFloaterGesture
//---------------------------------------------------------------------------
LLFloaterGesture::LLFloaterGesture(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
- mObserver = new LLFloaterGestureObserver(this);
- LLGestureMgr::instance().addObserver(mObserver);
+ mObserver = new LLFloaterGestureObserver(this);
+ LLGestureMgr::instance().addObserver(mObserver);
- mCommitCallbackRegistrar.add("Gesture.Action.ToggleActiveState", boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
- mCommitCallbackRegistrar.add("Gesture.Action.ShowPreview", boost::bind(&LLFloaterGesture::onClickEdit, this));
- mCommitCallbackRegistrar.add("Gesture.Action.CopyPaste", boost::bind(&LLFloaterGesture::onCopyPasteAction, this, _2));
- mCommitCallbackRegistrar.add("Gesture.Action.SaveToCOF", boost::bind(&LLFloaterGesture::addToCurrentOutFit, this));
- mCommitCallbackRegistrar.add("Gesture.Action.Rename", boost::bind(&LLFloaterGesture::onRenameSelected, this));
+ mCommitCallbackRegistrar.add("Gesture.Action.ToggleActiveState", boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
+ mCommitCallbackRegistrar.add("Gesture.Action.ShowPreview", boost::bind(&LLFloaterGesture::onClickEdit, this));
+ mCommitCallbackRegistrar.add("Gesture.Action.CopyPaste", boost::bind(&LLFloaterGesture::onCopyPasteAction, this, _2));
+ mCommitCallbackRegistrar.add("Gesture.Action.SaveToCOF", boost::bind(&LLFloaterGesture::addToCurrentOutFit, this));
+ mCommitCallbackRegistrar.add("Gesture.Action.Rename", boost::bind(&LLFloaterGesture::onRenameSelected, this));
- mEnableCallbackRegistrar.add("Gesture.EnableAction", boost::bind(&LLFloaterGesture::isActionEnabled, this, _2));
+ mEnableCallbackRegistrar.add("Gesture.EnableAction", boost::bind(&LLFloaterGesture::isActionEnabled, this, _2));
}
void LLFloaterGesture::done()
{
- //this method can be called twice: for GestureFolder and once after loading all sudir of GestureFolder
- if (gInventory.isCategoryComplete(mGestureFolderID))
- {
- LL_DEBUGS("Gesture")<< "mGestureFolderID loaded" << LL_ENDL;
- // we load only gesture folder without childred.
- LLInventoryModel::cat_array_t* categories;
- LLInventoryModel::item_array_t* items;
- uuid_vec_t unloaded_folders;
- LL_DEBUGS("Gesture")<< "Get subdirs of Gesture Folder...." << LL_ENDL;
- gInventory.getDirectDescendentsOf(mGestureFolderID, categories, items);
- if (categories->empty())
- {
- gInventory.removeObserver(this);
- LL_INFOS("Gesture")<< "Gesture dos NOT contains sub-directories."<< LL_ENDL;
- return;
- }
- LL_DEBUGS("Gesture")<< "There are " << categories->size() << " Folders "<< LL_ENDL;
- for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); it != categories->end(); it++)
- {
- if (!gInventory.isCategoryComplete(it->get()->getUUID()))
- {
- unloaded_folders.push_back(it->get()->getUUID());
- LL_DEBUGS("Gesture")<< it->get()->getName()<< " Folder added to fetchlist"<< LL_ENDL;
- }
-
- }
- if (!unloaded_folders.empty())
- {
- LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL;
- setFetchIDs(unloaded_folders);
- startFetch();
- }
- else
- {
- LL_DEBUGS("Gesture")<< "All Gesture subdirectories have been loaded."<< LL_ENDL;
- gInventory.removeObserver(this);
- buildGestureList();
- }
- }
- else
- {
- LL_WARNS("Gesture")<< "Gesture list was NOT loaded"<< LL_ENDL;
- }
+ //this method can be called twice: for GestureFolder and once after loading all sudir of GestureFolder
+ if (gInventory.isCategoryComplete(mGestureFolderID))
+ {
+ LL_DEBUGS("Gesture")<< "mGestureFolderID loaded" << LL_ENDL;
+ // we load only gesture folder without childred.
+ LLInventoryModel::cat_array_t* categories;
+ LLInventoryModel::item_array_t* items;
+ uuid_vec_t unloaded_folders;
+ LL_DEBUGS("Gesture")<< "Get subdirs of Gesture Folder...." << LL_ENDL;
+ gInventory.getDirectDescendentsOf(mGestureFolderID, categories, items);
+ if (categories->empty())
+ {
+ gInventory.removeObserver(this);
+ LL_INFOS("Gesture")<< "Gesture dos NOT contains sub-directories."<< LL_ENDL;
+ return;
+ }
+ LL_DEBUGS("Gesture")<< "There are " << categories->size() << " Folders "<< LL_ENDL;
+ for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); it != categories->end(); it++)
+ {
+ if (!gInventory.isCategoryComplete(it->get()->getUUID()))
+ {
+ unloaded_folders.push_back(it->get()->getUUID());
+ LL_DEBUGS("Gesture")<< it->get()->getName()<< " Folder added to fetchlist"<< LL_ENDL;
+ }
+
+ }
+ if (!unloaded_folders.empty())
+ {
+ LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL;
+ setFetchIDs(unloaded_folders);
+ startFetch();
+ }
+ else
+ {
+ LL_DEBUGS("Gesture")<< "All Gesture subdirectories have been loaded."<< LL_ENDL;
+ gInventory.removeObserver(this);
+ buildGestureList();
+ }
+ }
+ else
+ {
+ LL_WARNS("Gesture")<< "Gesture list was NOT loaded"<< LL_ENDL;
+ }
}
// virtual
LLFloaterGesture::~LLFloaterGesture()
{
- LLGestureMgr::instance().removeObserver(mObserver);
- delete mObserver;
- mObserver = NULL;
- gInventory.removeObserver(this);
+ LLGestureMgr::instance().removeObserver(mObserver);
+ delete mObserver;
+ mObserver = NULL;
+ gInventory.removeObserver(this);
}
// virtual
BOOL LLFloaterGesture::postBuild()
{
- std::string label;
-
- label = getTitle();
-
- setTitle(label);
- mGestureList = getChild<LLScrollListCtrl>("gesture_list");
- mGestureList->setCommitCallback(boost::bind(&LLFloaterGesture::onCommitList, this));
- mGestureList->setDoubleClickCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
-
- getChild<LLUICtrl>("edit_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickEdit, this));
-
- getChild<LLUICtrl>("play_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
- getChild<LLUICtrl>("stop_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
- getChild<LLButton>("activate_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
-
- getChild<LLUICtrl>("new_gesture_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickNew, this));
- getChild<LLButton>("del_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onDeleteSelected, this));
-
- getChildView("play_btn")->setVisible( true);
- getChildView("stop_btn")->setVisible( false);
- setDefaultBtn("play_btn");
- mGestureFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
-
- uuid_vec_t folders;
- folders.push_back(mGestureFolderID);
- //perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details.
- gInventory.addObserver(this);
- setFetchIDs(folders);
- startFetch();
-
- if (mGestureList)
- {
- buildGestureList();
-
- mGestureList->setFocus(TRUE);
-
- const BOOL ascending = TRUE;
- mGestureList->sortByColumn(std::string("name"), ascending);
- mGestureList->selectFirstItem();
- }
-
- // Update button labels
- onCommitList();
-
- return TRUE;
+ std::string label;
+
+ label = getTitle();
+
+ setTitle(label);
+ mGestureList = getChild<LLScrollListCtrl>("gesture_list");
+ mGestureList->setCommitCallback(boost::bind(&LLFloaterGesture::onCommitList, this));
+ mGestureList->setDoubleClickCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
+
+ getChild<LLUICtrl>("edit_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickEdit, this));
+
+ getChild<LLUICtrl>("play_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
+ getChild<LLUICtrl>("stop_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
+ getChild<LLButton>("activate_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
+
+ getChild<LLUICtrl>("new_gesture_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickNew, this));
+ getChild<LLButton>("del_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onDeleteSelected, this));
+
+ getChildView("play_btn")->setVisible( true);
+ getChildView("stop_btn")->setVisible( false);
+ setDefaultBtn("play_btn");
+ mGestureFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
+
+ uuid_vec_t folders;
+ folders.push_back(mGestureFolderID);
+ //perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details.
+ gInventory.addObserver(this);
+ setFetchIDs(folders);
+ startFetch();
+
+ if (mGestureList)
+ {
+ buildGestureList();
+
+ mGestureList->setFocus(TRUE);
+
+ const BOOL ascending = TRUE;
+ mGestureList->sortByColumn(std::string("name"), ascending);
+ mGestureList->selectFirstItem();
+ }
+
+ // Update button labels
+ onCommitList();
+
+ return TRUE;
}
void LLFloaterGesture::refreshAll()
{
- if (!mGestureList) return;
-
- buildGestureList();
-
- if (mSelectedID.isNull())
- {
- mGestureList->selectFirstItem();
- }
- else
- {
- if (! mGestureList->setCurrentByID(mSelectedID))
- {
- mGestureList->selectFirstItem();
- }
- }
-
- // Update button labels
- onCommitList();
+ if (!mGestureList) return;
+
+ buildGestureList();
+
+ if (mSelectedID.isNull())
+ {
+ mGestureList->selectFirstItem();
+ }
+ else
+ {
+ if (! mGestureList->setCurrentByID(mSelectedID))
+ {
+ mGestureList->selectFirstItem();
+ }
+ }
+
+ // Update button labels
+ onCommitList();
}
void LLFloaterGesture::buildGestureList()
{
- S32 scroll_pos = mGestureList->getScrollPos();
- uuid_vec_t selected_items;
- getSelectedIds(selected_items);
- LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL;
- mGestureList->deleteAllItems();
-
- LLGestureMgr::item_map_t::const_iterator it;
- const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
- for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
- {
- addGesture(it->first,it->second, mGestureList);
- }
- if (gInventory.isCategoryComplete(mGestureFolderID))
- {
- LLIsType is_gesture(LLAssetType::AT_GESTURE);
- LLInventoryModel::cat_array_t categories;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendentsIf(mGestureFolderID, categories, items,
- LLInventoryModel::EXCLUDE_TRASH, is_gesture);
-
- for (LLInventoryModel::item_array_t::iterator it = items.begin(); it!= items.end(); ++it)
- {
- LLInventoryItem* item = it->get();
- if (active_gestures.find(item->getUUID()) == active_gestures.end())
- {
- // if gesture wasn't loaded yet, we can display only name
- addGesture(item->getUUID(), NULL, mGestureList);
- }
- }
- }
-
- // attempt to preserve scroll position through re-builds
- // since we do re-build whenever something gets dirty
- for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++)
- {
- mGestureList->selectByID(*it);
- }
- mGestureList->setScrollPos(scroll_pos);
+ S32 scroll_pos = mGestureList->getScrollPos();
+ uuid_vec_t selected_items;
+ getSelectedIds(selected_items);
+ LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL;
+ mGestureList->deleteAllItems();
+
+ LLGestureMgr::item_map_t::const_iterator it;
+ const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
+ for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
+ {
+ addGesture(it->first,it->second, mGestureList);
+ }
+ if (gInventory.isCategoryComplete(mGestureFolderID))
+ {
+ LLIsType is_gesture(LLAssetType::AT_GESTURE);
+ LLInventoryModel::cat_array_t categories;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendentsIf(mGestureFolderID, categories, items,
+ LLInventoryModel::EXCLUDE_TRASH, is_gesture);
+
+ for (LLInventoryModel::item_array_t::iterator it = items.begin(); it!= items.end(); ++it)
+ {
+ LLInventoryItem* item = it->get();
+ if (active_gestures.find(item->getUUID()) == active_gestures.end())
+ {
+ // if gesture wasn't loaded yet, we can display only name
+ addGesture(item->getUUID(), NULL, mGestureList);
+ }
+ }
+ }
+
+ // attempt to preserve scroll position through re-builds
+ // since we do re-build whenever something gets dirty
+ for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++)
+ {
+ mGestureList->selectByID(*it);
+ }
+ mGestureList->setScrollPos(scroll_pos);
}
void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gesture,LLCtrlListInterface * list )
{
- // Note: Can have NULL item if inventory hasn't arrived yet.
- static std::string item_name = getString("loading");
- LLInventoryItem* item = gInventory.getItem(item_id);
- if (item)
- {
- item_name = item->getName();
- }
-
- static std::string font_style = "NORMAL";
- // If gesture is playing, bold it
-
- LLSD element;
- element["id"] = item_id;
-
- if (gesture)
- {
- if (gesture->mPlaying)
- {
- font_style = "BOLD";
- }
- item_name = gesture->mName;
- element["columns"][0]["column"] = "trigger";
- element["columns"][0]["value"] = gesture->mTrigger;
- element["columns"][0]["font"]["name"] = "SANSSERIF";
- element["columns"][0]["font"]["style"] = font_style;
-
- std::string key_string;
- std::string buffer;
-
- if (gesture->mKey == KEY_NONE)
- {
- buffer = "---";
- key_string = "~~~"; // alphabetize to end
- }
- else
- {
- key_string = LLKeyboard::stringFromKey(gesture->mKey);
- buffer = LLKeyboard::stringFromAccelerator(gesture->mMask,
- gesture->mKey);
- }
-
- element["columns"][1]["column"] = "shortcut";
- element["columns"][1]["value"] = buffer;
- element["columns"][1]["font"]["name"] = "SANSSERIF";
- element["columns"][1]["font"]["style"] = font_style;
-
- // hidden column for sorting
- element["columns"][2]["column"] = "key";
- element["columns"][2]["value"] = key_string;
- element["columns"][2]["font"]["name"] = "SANSSERIF";
- element["columns"][2]["font"]["style"] = font_style;
-
- // Only add "playing" if we've got the name, less confusing. JC
- if (item && gesture->mPlaying)
- {
- item_name += " " + getString("playing");
- }
- element["columns"][3]["column"] = "name";
- element["columns"][3]["value"] = item_name;
- element["columns"][3]["font"]["name"] = "SANSSERIF";
- element["columns"][3]["font"]["style"] = font_style;
- }
- else
- {
- element["columns"][0]["column"] = "trigger";
- element["columns"][0]["value"] = "";
- element["columns"][0]["font"]["name"] = "SANSSERIF";
- element["columns"][0]["font"]["style"] = font_style;
- element["columns"][1]["column"] = "shortcut";
- element["columns"][1]["value"] = "---";
- element["columns"][1]["font"]["name"] = "SANSSERIF";
- element["columns"][1]["font"]["style"] = font_style;
- element["columns"][2]["column"] = "key";
- element["columns"][2]["value"] = "~~~";
- element["columns"][2]["font"]["name"] = "SANSSERIF";
- element["columns"][2]["font"]["style"] = font_style;
- element["columns"][3]["column"] = "name";
- element["columns"][3]["value"] = item_name;
- element["columns"][3]["font"]["name"] = "SANSSERIF";
- element["columns"][3]["font"]["style"] = font_style;
- }
-
- LL_DEBUGS("Gesture") << "Added gesture [" << item_name << "]" << LL_ENDL;
-
- LLScrollListItem* sl_item = list->addElement(element, ADD_BOTTOM);
- if(sl_item)
- {
- LLFontGL::StyleFlags style = LLGestureMgr::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL;
- // *TODO find out why ["font"]["style"] does not affect font style
- ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style);
- }
+ // Note: Can have NULL item if inventory hasn't arrived yet.
+ static std::string item_name = getString("loading");
+ LLInventoryItem* item = gInventory.getItem(item_id);
+ if (item)
+ {
+ item_name = item->getName();
+ }
+
+ static std::string font_style = "NORMAL";
+ // If gesture is playing, bold it
+
+ LLSD element;
+ element["id"] = item_id;
+
+ if (gesture)
+ {
+ if (gesture->mPlaying)
+ {
+ font_style = "BOLD";
+ }
+ item_name = gesture->mName;
+ element["columns"][0]["column"] = "trigger";
+ element["columns"][0]["value"] = gesture->mTrigger;
+ element["columns"][0]["font"]["name"] = "SANSSERIF";
+ element["columns"][0]["font"]["style"] = font_style;
+
+ std::string key_string;
+ std::string buffer;
+
+ if (gesture->mKey == KEY_NONE)
+ {
+ buffer = "---";
+ key_string = "~~~"; // alphabetize to end
+ }
+ else
+ {
+ key_string = LLKeyboard::stringFromKey(gesture->mKey);
+ buffer = LLKeyboard::stringFromAccelerator(gesture->mMask,
+ gesture->mKey);
+ }
+
+ element["columns"][1]["column"] = "shortcut";
+ element["columns"][1]["value"] = buffer;
+ element["columns"][1]["font"]["name"] = "SANSSERIF";
+ element["columns"][1]["font"]["style"] = font_style;
+
+ // hidden column for sorting
+ element["columns"][2]["column"] = "key";
+ element["columns"][2]["value"] = key_string;
+ element["columns"][2]["font"]["name"] = "SANSSERIF";
+ element["columns"][2]["font"]["style"] = font_style;
+
+ // Only add "playing" if we've got the name, less confusing. JC
+ if (item && gesture->mPlaying)
+ {
+ item_name += " " + getString("playing");
+ }
+ element["columns"][3]["column"] = "name";
+ element["columns"][3]["value"] = item_name;
+ element["columns"][3]["font"]["name"] = "SANSSERIF";
+ element["columns"][3]["font"]["style"] = font_style;
+ }
+ else
+ {
+ element["columns"][0]["column"] = "trigger";
+ element["columns"][0]["value"] = "";
+ element["columns"][0]["font"]["name"] = "SANSSERIF";
+ element["columns"][0]["font"]["style"] = font_style;
+ element["columns"][1]["column"] = "shortcut";
+ element["columns"][1]["value"] = "---";
+ element["columns"][1]["font"]["name"] = "SANSSERIF";
+ element["columns"][1]["font"]["style"] = font_style;
+ element["columns"][2]["column"] = "key";
+ element["columns"][2]["value"] = "~~~";
+ element["columns"][2]["font"]["name"] = "SANSSERIF";
+ element["columns"][2]["font"]["style"] = font_style;
+ element["columns"][3]["column"] = "name";
+ element["columns"][3]["value"] = item_name;
+ element["columns"][3]["font"]["name"] = "SANSSERIF";
+ element["columns"][3]["font"]["style"] = font_style;
+ }
+
+ LL_DEBUGS("Gesture") << "Added gesture [" << item_name << "]" << LL_ENDL;
+
+ LLScrollListItem* sl_item = list->addElement(element, ADD_BOTTOM);
+ if(sl_item)
+ {
+ LLFontGL::StyleFlags style = LLGestureMgr::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL;
+ // *TODO find out why ["font"]["style"] does not affect font style
+ ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style);
+ }
}
void LLFloaterGesture::getSelectedIds(uuid_vec_t& ids)
{
- std::vector<LLScrollListItem*> items = mGestureList->getAllSelected();
- for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++)
- {
- ids.push_back((*it)->getUUID());
- }
+ std::vector<LLScrollListItem*> items = mGestureList->getAllSelected();
+ for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++)
+ {
+ ids.push_back((*it)->getUUID());
+ }
}
bool LLFloaterGesture::isActionEnabled(const LLSD& command)
{
- // paste copy_uuid edit_gesture
- std::string command_name = command.asString();
- if("paste" == command_name)
- {
- if(!LLClipboard::instance().hasContents())
- return false;
-
- std::vector<LLUUID> ids;
- LLClipboard::instance().pasteFromClipboard(ids);
- for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
- {
- LLInventoryItem* item = gInventory.getItem(*it);
-
- if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
- {
- return true;
- }
- }
- return false;
- }
- else if("copy_uuid" == command_name || "edit_gesture" == command_name)
- {
- return mGestureList->getAllSelected().size() == 1;
- }
- else if ("rename_gesture" == command_name)
- {
- if (mGestureList->getAllSelected().size() == 1)
- {
- LLViewerInventoryItem* item = gInventory.getItem(mGestureList->getCurrentID());
-
- if (item && item->getPermissions().allowModifyBy(gAgentID))
- {
- return true;
- }
- }
- return false;
- }
- return true;
+ // paste copy_uuid edit_gesture
+ std::string command_name = command.asString();
+ if("paste" == command_name)
+ {
+ if(!LLClipboard::instance().hasContents())
+ return false;
+
+ std::vector<LLUUID> ids;
+ LLClipboard::instance().pasteFromClipboard(ids);
+ for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
+ {
+ LLInventoryItem* item = gInventory.getItem(*it);
+
+ if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ else if("copy_uuid" == command_name || "edit_gesture" == command_name)
+ {
+ return mGestureList->getAllSelected().size() == 1;
+ }
+ else if ("rename_gesture" == command_name)
+ {
+ if (mGestureList->getAllSelected().size() == 1)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(mGestureList->getCurrentID());
+
+ if (item && item->getPermissions().allowModifyBy(gAgentID))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
}
void LLFloaterGesture::onClickPlay()
{
- const LLUUID& item_id = mGestureList->getCurrentID();
- if(item_id.isNull()) return;
-
- LL_DEBUGS("Gesture")<<" Trying to play gesture id: "<< item_id <<LL_ENDL;
- if(!LLGestureMgr::instance().isGestureActive(item_id))
- {
- // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList.
- BOOL inform_server = TRUE;
- BOOL deactivate_similar = FALSE;
- LLGestureMgr::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id));
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- llassert(item);
- if (item)
- {
- LLGestureMgr::instance().activateGestureWithAsset(item_id, item->getAssetUUID(), inform_server, deactivate_similar);
- LL_DEBUGS("Gesture")<< "Activating gesture with inventory ID: " << item_id <<LL_ENDL;
- }
- }
- else
- {
- playGesture(item_id);
- }
+ const LLUUID& item_id = mGestureList->getCurrentID();
+ if(item_id.isNull()) return;
+
+ LL_DEBUGS("Gesture")<<" Trying to play gesture id: "<< item_id <<LL_ENDL;
+ if(!LLGestureMgr::instance().isGestureActive(item_id))
+ {
+ // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList.
+ BOOL inform_server = TRUE;
+ BOOL deactivate_similar = FALSE;
+ LLGestureMgr::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id));
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ llassert(item);
+ if (item)
+ {
+ LLGestureMgr::instance().activateGestureWithAsset(item_id, item->getAssetUUID(), inform_server, deactivate_similar);
+ LL_DEBUGS("Gesture")<< "Activating gesture with inventory ID: " << item_id <<LL_ENDL;
+ }
+ }
+ else
+ {
+ playGesture(item_id);
+ }
}
void LLFloaterGesture::onClickNew()
{
- LLPointer<LLInventoryCallback> cb = new GestureShowCallback();
- create_inventory_item(gAgent.getID(),
- gAgent.getSessionID(),
- LLUUID::null,
- LLTransactionID::tnull,
- "New Gesture",
- "",
- LLAssetType::AT_GESTURE,
- LLInventoryType::IT_GESTURE,
+ LLPointer<LLInventoryCallback> cb = new GestureShowCallback();
+ create_inventory_item(gAgent.getID(),
+ gAgent.getSessionID(),
+ LLUUID::null,
+ LLTransactionID::tnull,
+ "New Gesture",
+ "",
+ LLAssetType::AT_GESTURE,
+ LLInventoryType::IT_GESTURE,
NO_INV_SUBTYPE,
- PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Gestures"),
- cb);
+ PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Gestures"),
+ cb);
}
void LLFloaterGesture::onActivateBtnClick()
{
- uuid_vec_t ids;
- getSelectedIds(ids);
- if(ids.empty())
- return;
-
- LLGestureMgr* gm = LLGestureMgr::getInstance();
- uuid_vec_t::const_iterator it = ids.begin();
- BOOL first_gesture_state = gm->isGestureActive(*it);
- BOOL is_mixed = FALSE;
- while( ++it != ids.end() )
- {
- if(first_gesture_state != gm->isGestureActive(*it))
- {
- is_mixed = TRUE;
- break;
- }
- }
- for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++)
- {
- if(is_mixed)
- {
- gm->activateGesture(*it);
- }
- else
- {
- if(first_gesture_state)
- {
- gm->deactivateGesture(*it);
- }
- else
- {
- gm->activateGesture(*it);
- }
- }
- }
+ uuid_vec_t ids;
+ getSelectedIds(ids);
+ if(ids.empty())
+ return;
+
+ LLGestureMgr* gm = LLGestureMgr::getInstance();
+ uuid_vec_t::const_iterator it = ids.begin();
+ BOOL first_gesture_state = gm->isGestureActive(*it);
+ BOOL is_mixed = FALSE;
+ while( ++it != ids.end() )
+ {
+ if(first_gesture_state != gm->isGestureActive(*it))
+ {
+ is_mixed = TRUE;
+ break;
+ }
+ }
+ for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++)
+ {
+ if(is_mixed)
+ {
+ gm->activateGesture(*it);
+ }
+ else
+ {
+ if(first_gesture_state)
+ {
+ gm->deactivateGesture(*it);
+ }
+ else
+ {
+ gm->activateGesture(*it);
+ }
+ }
+ }
}
void LLFloaterGesture::onRenameSelected()
{
- LLViewerInventoryItem* gesture = gInventory.getItem(mGestureList->getCurrentID());
- if (!gesture)
- {
- return;
- }
+ LLViewerInventoryItem* gesture = gInventory.getItem(mGestureList->getCurrentID());
+ if (!gesture)
+ {
+ return;
+ }
- LLSD args;
- args["NAME"] = gesture->getName();
+ LLSD args;
+ args["NAME"] = gesture->getName();
- LLSD payload;
- payload["gesture_id"] = mGestureList->getCurrentID();
+ LLSD payload;
+ payload["gesture_id"] = mGestureList->getCurrentID();
- LLNotificationsUtil::add("RenameGesture", args, payload, boost::bind(onGestureRename, _1, _2));
+ LLNotificationsUtil::add("RenameGesture", args, payload, boost::bind(onGestureRename, _1, _2));
}
void LLFloaterGesture::onGestureRename(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return; // canceled
-
- std::string new_name = response["new_name"].asString();
- LLInventoryObject::correctInventoryName(new_name);
- if (!new_name.empty())
- {
- LLUUID item_id = notification["payload"]["gesture_id"].asUUID();
- LLViewerInventoryItem* gesture = gInventory.getItem(item_id);
- if (gesture && (gesture->getName() != new_name))
- {
- LLSD updates;
- updates["name"] = new_name;
- update_inventory_item(item_id, updates, NULL);
- }
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return; // canceled
+
+ std::string new_name = response["new_name"].asString();
+ LLInventoryObject::correctInventoryName(new_name);
+ if (!new_name.empty())
+ {
+ LLUUID item_id = notification["payload"]["gesture_id"].asUUID();
+ LLViewerInventoryItem* gesture = gInventory.getItem(item_id);
+ if (gesture && (gesture->getName() != new_name))
+ {
+ LLSD updates;
+ updates["name"] = new_name;
+ update_inventory_item(item_id, updates, NULL);
+ }
+ }
}
void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
{
- std::string command_name = command.asString();
- // Since we select this command, the inventory items must have already arrived
- if("copy_gesture" == command_name)
- {
- uuid_vec_t ids;
- getSelectedIds(ids);
- // Make sure the clipboard is empty
- LLClipboard::instance().reset();
- for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++)
- {
- LLInventoryItem* item = gInventory.getItem(*it);
- if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
- {
- LLClipboard::instance().addToClipboard(*it);
- }
- }
- }
- else if ("paste" == command_name)
- {
- std::vector<LLUUID> ids;
- LLClipboard::instance().pasteFromClipboard(ids);
- if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID))
- return;
- LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID);
- llassert(gesture_dir);
- LLPointer<GestureCopiedCallback> cb = new GestureCopiedCallback(this);
-
- for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
- {
- LLInventoryItem* item = gInventory.getItem(*it);
- if(gesture_dir && item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
- {
- LLStringUtil::format_map_t string_args;
- string_args["[COPY_NAME]"] = item->getName();
- LL_DEBUGS("Gesture")<< "Copying gesture " << item->getName() << " "<< item->getUUID() << " into "
- << gesture_dir->getName() << " "<< gesture_dir->getUUID() << LL_ENDL;
- copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(),
- gesture_dir->getUUID(), getString("copy_name", string_args), cb);
- }
- }
- LLClipboard::instance().reset();
- }
- else if ("copy_uuid" == command_name)
- {
- LLClipboard::instance().copyToClipboard(mGestureList->getCurrentID(),LLAssetType::AT_GESTURE);
- }
+ std::string command_name = command.asString();
+ // Since we select this command, the inventory items must have already arrived
+ if("copy_gesture" == command_name)
+ {
+ uuid_vec_t ids;
+ getSelectedIds(ids);
+ // Make sure the clipboard is empty
+ LLClipboard::instance().reset();
+ for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++)
+ {
+ LLInventoryItem* item = gInventory.getItem(*it);
+ if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
+ {
+ LLClipboard::instance().addToClipboard(*it);
+ }
+ }
+ }
+ else if ("paste" == command_name)
+ {
+ std::vector<LLUUID> ids;
+ LLClipboard::instance().pasteFromClipboard(ids);
+ if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID))
+ return;
+ LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID);
+ llassert(gesture_dir);
+ LLPointer<GestureCopiedCallback> cb = new GestureCopiedCallback(this);
+
+ for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
+ {
+ LLInventoryItem* item = gInventory.getItem(*it);
+ if(gesture_dir && item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[COPY_NAME]"] = item->getName();
+ LL_DEBUGS("Gesture")<< "Copying gesture " << item->getName() << " "<< item->getUUID() << " into "
+ << gesture_dir->getName() << " "<< gesture_dir->getUUID() << LL_ENDL;
+ copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(),
+ gesture_dir->getUUID(), getString("copy_name", string_args), cb);
+ }
+ }
+ LLClipboard::instance().reset();
+ }
+ else if ("copy_uuid" == command_name)
+ {
+ LLClipboard::instance().copyToClipboard(mGestureList->getCurrentID(),LLAssetType::AT_GESTURE);
+ }
}
void LLFloaterGesture::onClickEdit()
{
- const LLUUID& item_id = mGestureList->getCurrentID();
+ const LLUUID& item_id = mGestureList->getCurrentID();
- LLInventoryItem* item = gInventory.getItem(item_id);
- if (!item) return;
+ LLInventoryItem* item = gInventory.getItem(item_id);
+ if (!item) return;
- LLPreviewGesture* previewp = LLPreviewGesture::show(item_id, LLUUID::null);
- if (!previewp->getHost())
- {
- previewp->setRect(gFloaterView->findNeighboringPosition(this, previewp));
- }
+ LLPreviewGesture* previewp = LLPreviewGesture::show(item_id, LLUUID::null);
+ if (!previewp->getHost())
+ {
+ previewp->setRect(gFloaterView->findNeighboringPosition(this, previewp));
+ }
}
void LLFloaterGesture::onCommitList()
{
- const LLUUID& item_id = mGestureList->getCurrentID();
-
- mSelectedID = item_id;
- if (LLGestureMgr::instance().isGesturePlaying(item_id))
- {
- getChildView("play_btn")->setVisible( false);
- getChildView("stop_btn")->setVisible( true);
- }
- else
- {
- getChildView("play_btn")->setVisible( true);
- getChildView("stop_btn")->setVisible( false);
- }
+ const LLUUID& item_id = mGestureList->getCurrentID();
+
+ mSelectedID = item_id;
+ if (LLGestureMgr::instance().isGesturePlaying(item_id))
+ {
+ getChildView("play_btn")->setVisible( false);
+ getChildView("stop_btn")->setVisible( true);
+ }
+ else
+ {
+ getChildView("play_btn")->setVisible( true);
+ getChildView("stop_btn")->setVisible( false);
+ }
}
void LLFloaterGesture::onDeleteSelected()
{
- uuid_vec_t ids;
- getSelectedIds(ids);
- if(ids.empty())
- return;
-
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- LLGestureMgr* gm = LLGestureMgr::getInstance();
- for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++)
- {
- const LLUUID& selected_item = *it;
- LLInventoryItem* inv_item = gInventory.getItem(selected_item);
- if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_GESTURE)
- {
- if(gm->isGestureActive(selected_item))
- {
- gm->deactivateGesture(selected_item);
- }
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
- new_item->setParent(trash_id);
- // no need to restamp it though it's a move into trash because
- // it's a brand new item already.
- new_item->updateParentOnServer(FALSE);
- gInventory.updateItem(new_item);
- }
- }
- gInventory.notifyObservers();
- buildGestureList();
+ uuid_vec_t ids;
+ getSelectedIds(ids);
+ if(ids.empty())
+ return;
+
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLGestureMgr* gm = LLGestureMgr::getInstance();
+ for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++)
+ {
+ const LLUUID& selected_item = *it;
+ LLInventoryItem* inv_item = gInventory.getItem(selected_item);
+ if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_GESTURE)
+ {
+ if(gm->isGestureActive(selected_item))
+ {
+ gm->deactivateGesture(selected_item);
+ }
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
+ new_item->setParent(trash_id);
+ // no need to restamp it though it's a move into trash because
+ // it's a brand new item already.
+ new_item->updateParentOnServer(FALSE);
+ gInventory.updateItem(new_item);
+ }
+ }
+ gInventory.notifyObservers();
+ buildGestureList();
}
void LLFloaterGesture::addToCurrentOutFit()
{
- uuid_vec_t ids;
- getSelectedIds(ids);
- LLAppearanceMgr* am = LLAppearanceMgr::getInstance();
- LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
- for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++)
- {
- am->addCOFItemLink(*it, cb);
- }
+ uuid_vec_t ids;
+ getSelectedIds(ids);
+ LLAppearanceMgr* am = LLAppearanceMgr::getInstance();
+ LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
+ for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++)
+ {
+ am->addCOFItemLink(*it, cb);
+ }
}
void LLFloaterGesture::playGesture(LLUUID item_id)
{
- LL_DEBUGS("Gesture")<<"Playing gesture "<< item_id<<LL_ENDL;
-
- if (LLGestureMgr::instance().isGesturePlaying(item_id))
- {
- LLGestureMgr::instance().stopGesture(item_id);
- }
- else
- {
- LLGestureMgr::instance().playGesture(item_id);
- }
+ LL_DEBUGS("Gesture")<<"Playing gesture "<< item_id<<LL_ENDL;
+
+ if (LLGestureMgr::instance().isGesturePlaying(item_id))
+ {
+ LLGestureMgr::instance().stopGesture(item_id);
+ }
+ else
+ {
+ LLGestureMgr::instance().playGesture(item_id);
+ }
}
diff --git a/indra/newview/llfloatergesture.h b/indra/newview/llfloatergesture.h
index 1d702c6704..ae329da4d1 100644
--- a/indra/newview/llfloatergesture.h
+++ b/indra/newview/llfloatergesture.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergesture.h
* @brief Read-only list of gestures from your inventory.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@
#ifndef LL_LLFLOATERGESTURE_H
#define LL_LLFLOATERGESTURE_H
-#include <vector>
+#include <vector>
#include "llfloater.h"
#include "llinventoryobserver.h"
@@ -49,61 +49,61 @@ class LLMultiGesture;
class LLMenuGL;
class LLFloaterGesture
-: public LLFloater, LLInventoryFetchDescendentsObserver
+: public LLFloater, LLInventoryFetchDescendentsObserver
{
- LOG_CLASS(LLFloaterGesture);
+ LOG_CLASS(LLFloaterGesture);
public:
- LLFloaterGesture(const LLSD& key);
- virtual ~LLFloaterGesture();
+ LLFloaterGesture(const LLSD& key);
+ virtual ~LLFloaterGesture();
- virtual BOOL postBuild();
- virtual void done ();
- void refreshAll();
- /**
- * @brief Add new scrolllistitem into gesture_list.
- * @param item_id inventory id of gesture
- * @param gesture can be NULL , if item was not loaded yet
- */
- void addGesture(const LLUUID& item_id, LLMultiGesture* gesture, LLCtrlListInterface * list);
+ virtual BOOL postBuild();
+ virtual void done ();
+ void refreshAll();
+ /**
+ * @brief Add new scrolllistitem into gesture_list.
+ * @param item_id inventory id of gesture
+ * @param gesture can be NULL , if item was not loaded yet
+ */
+ void addGesture(const LLUUID& item_id, LLMultiGesture* gesture, LLCtrlListInterface * list);
protected:
- // Reads from the gesture manager's list of active gestures
- // and puts them in this list.
- void buildGestureList();
- void playGesture(LLUUID item_id);
+ // Reads from the gesture manager's list of active gestures
+ // and puts them in this list.
+ void buildGestureList();
+ void playGesture(LLUUID item_id);
private:
- void addToCurrentOutFit();
- /**
- * @brief This method is using to collect selected items.
- * In some places gesture_list can be rebuilt by gestureObservers during iterating data from LLScrollListCtrl::getAllSelected().
- * Therefore we have to copy these items to avoid viewer crash.
- * @see LLFloaterGesture::onActivateBtnClick
- */
- void getSelectedIds(uuid_vec_t& ids);
- bool isActionEnabled(const LLSD& command);
- /**
- * @brief Activation rules:
- * According to Gesture Spec:
- * 1. If all selected gestures are active: set to inactive
- * 2. If all selected gestures are inactive: set to active
- * 3. If selected gestures are in a mixed state: set all to active
- */
- void onActivateBtnClick();
- void onClickEdit();
- void onClickPlay();
- void onClickNew();
- void onCommitList();
- void onCopyPasteAction(const LLSD& command);
- void onDeleteSelected();
- void onRenameSelected();
+ void addToCurrentOutFit();
+ /**
+ * @brief This method is using to collect selected items.
+ * In some places gesture_list can be rebuilt by gestureObservers during iterating data from LLScrollListCtrl::getAllSelected().
+ * Therefore we have to copy these items to avoid viewer crash.
+ * @see LLFloaterGesture::onActivateBtnClick
+ */
+ void getSelectedIds(uuid_vec_t& ids);
+ bool isActionEnabled(const LLSD& command);
+ /**
+ * @brief Activation rules:
+ * According to Gesture Spec:
+ * 1. If all selected gestures are active: set to inactive
+ * 2. If all selected gestures are inactive: set to active
+ * 3. If selected gestures are in a mixed state: set all to active
+ */
+ void onActivateBtnClick();
+ void onClickEdit();
+ void onClickPlay();
+ void onClickNew();
+ void onCommitList();
+ void onCopyPasteAction(const LLSD& command);
+ void onDeleteSelected();
+ void onRenameSelected();
- static void onGestureRename(const LLSD& notification, const LLSD& response);
+ static void onGestureRename(const LLSD& notification, const LLSD& response);
- LLUUID mSelectedID;
- LLUUID mGestureFolderID;
- LLScrollListCtrl* mGestureList;
+ LLUUID mSelectedID;
+ LLUUID mGestureFolderID;
+ LLScrollListCtrl* mGestureList;
- LLFloaterGestureObserver* mObserver;
+ LLFloaterGestureObserver* mObserver;
};
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index 4b22f7427b..3b99139aba 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergodtools.cpp
* @brief The on-screen rectangle with tool options.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -81,95 +81,95 @@ const F32 SECONDS_BETWEEN_UPDATE_REQUESTS = 5.0f;
void LLFloaterGodTools::onOpen(const LLSD& key)
{
- center();
- setFocus(TRUE);
-// LLPanel *panel = getChild<LLTabContainer>("GodTools Tabs")->getCurrentPanel();
-// if (panel)
-// panel->setFocus(TRUE);
- if (mPanelObjectTools)
- mPanelObjectTools->setTargetAvatar(LLUUID::null);
+ center();
+ setFocus(TRUE);
+// LLPanel *panel = getChild<LLTabContainer>("GodTools Tabs")->getCurrentPanel();
+// if (panel)
+// panel->setFocus(TRUE);
+ if (mPanelObjectTools)
+ mPanelObjectTools->setTargetAvatar(LLUUID::null);
- if (gAgent.getRegionHost() != mCurrentHost)
- {
- // we're in a new region
- sendRegionInfoRequest();
- }
+ if (gAgent.getRegionHost() != mCurrentHost)
+ {
+ // we're in a new region
+ sendRegionInfoRequest();
+ }
}
-
+
// static
void LLFloaterGodTools::refreshAll()
{
- LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
- if (god_tools)
- {
- if (gAgent.getRegionHost() != god_tools->mCurrentHost)
- {
- // we're in a new region
- god_tools->sendRegionInfoRequest();
- }
- }
+ LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
+ if (god_tools)
+ {
+ if (gAgent.getRegionHost() != god_tools->mCurrentHost)
+ {
+ // we're in a new region
+ god_tools->sendRegionInfoRequest();
+ }
+ }
}
LLFloaterGodTools::LLFloaterGodTools(const LLSD& key)
-: LLFloater(key),
- mCurrentHost(LLHost()),
- mUpdateTimer()
+: LLFloater(key),
+ mCurrentHost(LLHost()),
+ mUpdateTimer()
{
- mFactoryMap["grid"] = LLCallbackMap(createPanelGrid, this);
- mFactoryMap["region"] = LLCallbackMap(createPanelRegion, this);
- mFactoryMap["objects"] = LLCallbackMap(createPanelObjects, this);
- mFactoryMap["request"] = LLCallbackMap(createPanelRequest, this);
+ mFactoryMap["grid"] = LLCallbackMap(createPanelGrid, this);
+ mFactoryMap["region"] = LLCallbackMap(createPanelRegion, this);
+ mFactoryMap["objects"] = LLCallbackMap(createPanelObjects, this);
+ mFactoryMap["request"] = LLCallbackMap(createPanelRequest, this);
}
BOOL LLFloaterGodTools::postBuild()
{
- sendRegionInfoRequest();
- getChild<LLTabContainer>("GodTools Tabs")->selectTabByName("region");
- return TRUE;
+ sendRegionInfoRequest();
+ getChild<LLTabContainer>("GodTools Tabs")->selectTabByName("region");
+ return TRUE;
}
// static
void* LLFloaterGodTools::createPanelGrid(void *userdata)
{
- return new LLPanelGridTools();
+ return new LLPanelGridTools();
}
// static
void* LLFloaterGodTools::createPanelRegion(void *userdata)
{
- LLFloaterGodTools* self = (LLFloaterGodTools*)userdata;
- self->mPanelRegionTools = new LLPanelRegionTools();
- return self->mPanelRegionTools;
+ LLFloaterGodTools* self = (LLFloaterGodTools*)userdata;
+ self->mPanelRegionTools = new LLPanelRegionTools();
+ return self->mPanelRegionTools;
}
// static
void* LLFloaterGodTools::createPanelObjects(void *userdata)
{
- LLFloaterGodTools* self = (LLFloaterGodTools*)userdata;
- self->mPanelObjectTools = new LLPanelObjectTools();
- return self->mPanelObjectTools;
+ LLFloaterGodTools* self = (LLFloaterGodTools*)userdata;
+ self->mPanelObjectTools = new LLPanelObjectTools();
+ return self->mPanelObjectTools;
}
// static
void* LLFloaterGodTools::createPanelRequest(void *userdata)
{
- return new LLPanelRequestTools();
+ return new LLPanelRequestTools();
}
LLFloaterGodTools::~LLFloaterGodTools()
{
- // children automatically deleted
+ // children automatically deleted
}
U64 LLFloaterGodTools::computeRegionFlags() const
{
- U64 flags = gAgent.getRegion()->getRegionFlags();
- if (mPanelRegionTools) flags = mPanelRegionTools->computeRegionFlags(flags);
- if (mPanelObjectTools) flags = mPanelObjectTools->computeRegionFlags(flags);
- return flags;
+ U64 flags = gAgent.getRegion()->getRegionFlags();
+ if (mPanelRegionTools) flags = mPanelRegionTools->computeRegionFlags(flags);
+ if (mPanelObjectTools) flags = mPanelObjectTools->computeRegionFlags(flags);
+ return flags;
}
@@ -180,220 +180,220 @@ void LLFloaterGodTools::updatePopup(LLCoordGL center, MASK mask)
// virtual
void LLFloaterGodTools::draw()
{
- if (mCurrentHost == LLHost())
- {
- if (mUpdateTimer.getElapsedTimeF32() > SECONDS_BETWEEN_UPDATE_REQUESTS)
- {
- sendRegionInfoRequest();
- }
- }
- else if (gAgent.getRegionHost() != mCurrentHost)
- {
- sendRegionInfoRequest();
- }
- LLFloater::draw();
+ if (mCurrentHost == LLHost())
+ {
+ if (mUpdateTimer.getElapsedTimeF32() > SECONDS_BETWEEN_UPDATE_REQUESTS)
+ {
+ sendRegionInfoRequest();
+ }
+ }
+ else if (gAgent.getRegionHost() != mCurrentHost)
+ {
+ sendRegionInfoRequest();
+ }
+ LLFloater::draw();
}
void LLFloaterGodTools::showPanel(const std::string& panel_name)
{
- getChild<LLTabContainer>("GodTools Tabs")->selectTabByName(panel_name);
- openFloater();
- LLPanel *panel = getChild<LLTabContainer>("GodTools Tabs")->getCurrentPanel();
- if (panel)
- panel->setFocus(TRUE);
+ getChild<LLTabContainer>("GodTools Tabs")->selectTabByName(panel_name);
+ openFloater();
+ LLPanel *panel = getChild<LLTabContainer>("GodTools Tabs")->getCurrentPanel();
+ if (panel)
+ panel->setFocus(TRUE);
}
// static
void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg)
{
- llassert(msg);
- if (!msg) return;
-
- //const S32 SIM_NAME_BUF = 256;
- U64 region_flags;
- U8 sim_access;
- U8 agent_limit;
- std::string sim_name;
- U32 estate_id;
- U32 parent_estate_id;
- F32 water_height;
- F32 billable_factor;
- F32 object_bonus_factor;
- F32 terrain_raise_limit;
- F32 terrain_lower_limit;
- S32 price_per_meter;
- S32 redirect_grid_x;
- S32 redirect_grid_y;
- LLUUID cache_id;
-
- LLHost host = msg->getSender();
-
- msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, sim_name);
- msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, estate_id);
- msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, parent_estate_id);
- msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, sim_access);
- msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, agent_limit);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, object_bonus_factor);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_BillableFactor, billable_factor);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, water_height);
-
- if (msg->has(_PREHASH_RegionInfo3))
- {
- msg->getU64Fast(_PREHASH_RegionInfo3, _PREHASH_RegionFlagsExtended, region_flags);
- }
- else
- {
- U32 flags = 0;
- msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags);
- region_flags = flags;
- }
-
- if (msg->has(_PREHASH_RegionInfo5))
- {
- F32 chat_whisper_range;
- F32 chat_normal_range;
- F32 chat_shout_range;
- F32 chat_whisper_offset;
- F32 chat_normal_offset;
- F32 chat_shout_offset;
- U32 chat_flags;
-
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperRange, chat_whisper_range);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalRange, chat_normal_range);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutRange, chat_shout_range);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperOffset, chat_whisper_offset);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalOffset, chat_normal_offset);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutOffset, chat_shout_offset);
- msg->getU32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatFlags, chat_flags);
-
- LL_INFOS() << "Whisper range: " << chat_whisper_range << " normal range: " << chat_normal_range << " shout range: " << chat_shout_range
- << " whisper offset: " << chat_whisper_offset << " normal offset: " << chat_normal_offset << " shout offset: " << chat_shout_offset
- << " chat flags: " << chat_flags << LL_ENDL;
- }
-
- if (host != gAgent.getRegionHost())
- {
- // Update is for a different region than the one we're in.
- // Just check for a waterheight change.
- LLWorld::getInstance()->waterHeightRegionInfo(sim_name, water_height);
- return;
- }
-
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, terrain_raise_limit);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, terrain_lower_limit);
- msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_PricePerMeter, price_per_meter);
- msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridX, redirect_grid_x);
- msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridY, redirect_grid_y);
-
- // push values to the current LLViewerRegion
- LLViewerRegion *regionp = gAgent.getRegion();
- if (regionp)
- {
- regionp->setRegionNameAndZone(sim_name);
- regionp->setRegionFlags(region_flags);
- regionp->setSimAccess(sim_access);
- regionp->setWaterHeight(water_height);
- regionp->setBillableFactor(billable_factor);
- }
-
- LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
- if (!god_tools) return;
-
- // push values to god tools, if available
- if ( gAgent.isGodlike()
- && LLFloaterReg::instanceVisible("god_tools")
- && god_tools->mPanelRegionTools
- && god_tools->mPanelObjectTools)
- {
- LLPanelRegionTools* rtool = god_tools->mPanelRegionTools;
- god_tools->mCurrentHost = host;
-
- // store locally
- rtool->setSimName(sim_name);
- rtool->setEstateID(estate_id);
- rtool->setParentEstateID(parent_estate_id);
- rtool->setCheckFlags(region_flags);
- rtool->setBillableFactor(billable_factor);
- rtool->setPricePerMeter(price_per_meter);
- rtool->setRedirectGridX(redirect_grid_x);
- rtool->setRedirectGridY(redirect_grid_y);
- rtool->enableAllWidgets();
-
- LLPanelObjectTools *otool = god_tools->mPanelObjectTools;
- otool->setCheckFlags(region_flags);
- otool->enableAllWidgets();
-
- LLViewerRegion *regionp = gAgent.getRegion();
- if ( !regionp )
- {
- // -1 implies non-existent
- rtool->setGridPosX(-1);
- rtool->setGridPosY(-1);
- }
- else
- {
- //compute the grid position of the region
- LLVector3d global_pos = regionp->getPosGlobalFromRegion(LLVector3::zero);
- S32 grid_pos_x = (S32) (global_pos.mdV[VX] / 256.0f);
- S32 grid_pos_y = (S32) (global_pos.mdV[VY] / 256.0f);
-
- rtool->setGridPosX(grid_pos_x);
- rtool->setGridPosY(grid_pos_y);
- }
- }
+ llassert(msg);
+ if (!msg) return;
+
+ //const S32 SIM_NAME_BUF = 256;
+ U64 region_flags;
+ U8 sim_access;
+ U8 agent_limit;
+ std::string sim_name;
+ U32 estate_id;
+ U32 parent_estate_id;
+ F32 water_height;
+ F32 billable_factor;
+ F32 object_bonus_factor;
+ F32 terrain_raise_limit;
+ F32 terrain_lower_limit;
+ S32 price_per_meter;
+ S32 redirect_grid_x;
+ S32 redirect_grid_y;
+ LLUUID cache_id;
+
+ LLHost host = msg->getSender();
+
+ msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, sim_name);
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, estate_id);
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, parent_estate_id);
+ msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, sim_access);
+ msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, agent_limit);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, object_bonus_factor);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_BillableFactor, billable_factor);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, water_height);
+
+ if (msg->has(_PREHASH_RegionInfo3))
+ {
+ msg->getU64Fast(_PREHASH_RegionInfo3, _PREHASH_RegionFlagsExtended, region_flags);
+ }
+ else
+ {
+ U32 flags = 0;
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags);
+ region_flags = flags;
+ }
+
+ if (msg->has(_PREHASH_RegionInfo5))
+ {
+ F32 chat_whisper_range;
+ F32 chat_normal_range;
+ F32 chat_shout_range;
+ F32 chat_whisper_offset;
+ F32 chat_normal_offset;
+ F32 chat_shout_offset;
+ U32 chat_flags;
+
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperRange, chat_whisper_range);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalRange, chat_normal_range);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutRange, chat_shout_range);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperOffset, chat_whisper_offset);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalOffset, chat_normal_offset);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutOffset, chat_shout_offset);
+ msg->getU32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatFlags, chat_flags);
+
+ LL_INFOS() << "Whisper range: " << chat_whisper_range << " normal range: " << chat_normal_range << " shout range: " << chat_shout_range
+ << " whisper offset: " << chat_whisper_offset << " normal offset: " << chat_normal_offset << " shout offset: " << chat_shout_offset
+ << " chat flags: " << chat_flags << LL_ENDL;
+ }
+
+ if (host != gAgent.getRegionHost())
+ {
+ // Update is for a different region than the one we're in.
+ // Just check for a waterheight change.
+ LLWorld::getInstance()->waterHeightRegionInfo(sim_name, water_height);
+ return;
+ }
+
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, terrain_raise_limit);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, terrain_lower_limit);
+ msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_PricePerMeter, price_per_meter);
+ msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridX, redirect_grid_x);
+ msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridY, redirect_grid_y);
+
+ // push values to the current LLViewerRegion
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ regionp->setRegionNameAndZone(sim_name);
+ regionp->setRegionFlags(region_flags);
+ regionp->setSimAccess(sim_access);
+ regionp->setWaterHeight(water_height);
+ regionp->setBillableFactor(billable_factor);
+ }
+
+ LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
+ if (!god_tools) return;
+
+ // push values to god tools, if available
+ if ( gAgent.isGodlike()
+ && LLFloaterReg::instanceVisible("god_tools")
+ && god_tools->mPanelRegionTools
+ && god_tools->mPanelObjectTools)
+ {
+ LLPanelRegionTools* rtool = god_tools->mPanelRegionTools;
+ god_tools->mCurrentHost = host;
+
+ // store locally
+ rtool->setSimName(sim_name);
+ rtool->setEstateID(estate_id);
+ rtool->setParentEstateID(parent_estate_id);
+ rtool->setCheckFlags(region_flags);
+ rtool->setBillableFactor(billable_factor);
+ rtool->setPricePerMeter(price_per_meter);
+ rtool->setRedirectGridX(redirect_grid_x);
+ rtool->setRedirectGridY(redirect_grid_y);
+ rtool->enableAllWidgets();
+
+ LLPanelObjectTools *otool = god_tools->mPanelObjectTools;
+ otool->setCheckFlags(region_flags);
+ otool->enableAllWidgets();
+
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if ( !regionp )
+ {
+ // -1 implies non-existent
+ rtool->setGridPosX(-1);
+ rtool->setGridPosY(-1);
+ }
+ else
+ {
+ //compute the grid position of the region
+ LLVector3d global_pos = regionp->getPosGlobalFromRegion(LLVector3::zero);
+ S32 grid_pos_x = (S32) (global_pos.mdV[VX] / 256.0f);
+ S32 grid_pos_y = (S32) (global_pos.mdV[VY] / 256.0f);
+
+ rtool->setGridPosX(grid_pos_x);
+ rtool->setGridPosY(grid_pos_y);
+ }
+ }
}
void LLFloaterGodTools::sendRegionInfoRequest()
{
- if (mPanelRegionTools) mPanelRegionTools->clearAllWidgets();
- if (mPanelObjectTools) mPanelObjectTools->clearAllWidgets();
- mCurrentHost = LLHost();
- mUpdateTimer.reset();
+ if (mPanelRegionTools) mPanelRegionTools->clearAllWidgets();
+ if (mPanelObjectTools) mPanelObjectTools->clearAllWidgets();
+ mCurrentHost = LLHost();
+ mUpdateTimer.reset();
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("RequestRegionInfo");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("RequestRegionInfo");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ gAgent.sendReliableMessage();
}
void LLFloaterGodTools::sendGodUpdateRegionInfo()
{
- LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
- if (!god_tools) return;
-
- LLViewerRegion *regionp = gAgent.getRegion();
- if (gAgent.isGodlike()
- && god_tools->mPanelRegionTools
- && regionp
- && gAgent.getRegionHost() == mCurrentHost)
- {
- LLMessageSystem *msg = gMessageSystem;
- LLPanelRegionTools *rtool = god_tools->mPanelRegionTools;
-
- U64 region_flags = computeRegionFlags();
- msg->newMessage("GodUpdateRegionInfo");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_RegionInfo);
- msg->addStringFast(_PREHASH_SimName, rtool->getSimName());
- msg->addU32Fast(_PREHASH_EstateID, rtool->getEstateID());
- msg->addU32Fast(_PREHASH_ParentEstateID, rtool->getParentEstateID());
- // Legacy flags
- msg->addU32Fast(_PREHASH_RegionFlags, U32(region_flags));
- msg->addF32Fast(_PREHASH_BillableFactor, rtool->getBillableFactor());
- msg->addS32Fast(_PREHASH_PricePerMeter, rtool->getPricePerMeter());
- msg->addS32Fast(_PREHASH_RedirectGridX, rtool->getRedirectGridX());
- msg->addS32Fast(_PREHASH_RedirectGridY, rtool->getRedirectGridY());
- msg->nextBlockFast(_PREHASH_RegionInfo2);
- msg->addU64Fast(_PREHASH_RegionFlagsExtended, region_flags);
-
- gAgent.sendReliableMessage();
- }
+ LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
+ if (!god_tools) return;
+
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if (gAgent.isGodlike()
+ && god_tools->mPanelRegionTools
+ && regionp
+ && gAgent.getRegionHost() == mCurrentHost)
+ {
+ LLMessageSystem *msg = gMessageSystem;
+ LLPanelRegionTools *rtool = god_tools->mPanelRegionTools;
+
+ U64 region_flags = computeRegionFlags();
+ msg->newMessage("GodUpdateRegionInfo");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_RegionInfo);
+ msg->addStringFast(_PREHASH_SimName, rtool->getSimName());
+ msg->addU32Fast(_PREHASH_EstateID, rtool->getEstateID());
+ msg->addU32Fast(_PREHASH_ParentEstateID, rtool->getParentEstateID());
+ // Legacy flags
+ msg->addU32Fast(_PREHASH_RegionFlags, U32(region_flags));
+ msg->addF32Fast(_PREHASH_BillableFactor, rtool->getBillableFactor());
+ msg->addS32Fast(_PREHASH_PricePerMeter, rtool->getPricePerMeter());
+ msg->addS32Fast(_PREHASH_RedirectGridX, rtool->getRedirectGridX());
+ msg->addS32Fast(_PREHASH_RedirectGridY, rtool->getRedirectGridY());
+ msg->nextBlockFast(_PREHASH_RegionInfo2);
+ msg->addU64Fast(_PREHASH_RegionFlagsExtended, region_flags);
+
+ gAgent.sendReliableMessage();
+ }
}
//*****************************************************************************
@@ -415,8 +415,8 @@ void LLFloaterGodTools::sendGodUpdateRegionInfo()
// | |
// | [Bake Terrain] [Select Region] |
// | [Revert Terrain] [Autosave Now] |
-// | [Swap Terrain] |
-// | |
+// | [Swap Terrain] |
+// | |
// |________________________________________________|
// ^ ^ ^
// LEFT R2 RIGHT
@@ -429,48 +429,48 @@ const F32 BILLABLE_FACTOR_DEFAULT = 1;
const F32 PRICE_PER_METER_DEFAULT = 1.f;
LLPanelRegionTools::LLPanelRegionTools()
-: LLPanel()
+: LLPanel()
{
- mCommitCallbackRegistrar.add("RegionTools.ChangeAnything", boost::bind(&LLPanelRegionTools::onChangeAnything, this));
- mCommitCallbackRegistrar.add("RegionTools.ChangePrelude", boost::bind(&LLPanelRegionTools::onChangePrelude, this));
- mCommitCallbackRegistrar.add("RegionTools.BakeTerrain", boost::bind(&LLPanelRegionTools::onBakeTerrain, this));
- mCommitCallbackRegistrar.add("RegionTools.RevertTerrain", boost::bind(&LLPanelRegionTools::onRevertTerrain, this));
- mCommitCallbackRegistrar.add("RegionTools.SwapTerrain", boost::bind(&LLPanelRegionTools::onSwapTerrain, this));
- mCommitCallbackRegistrar.add("RegionTools.Refresh", boost::bind(&LLPanelRegionTools::onRefresh, this));
- mCommitCallbackRegistrar.add("RegionTools.ApplyChanges", boost::bind(&LLPanelRegionTools::onApplyChanges, this));
- mCommitCallbackRegistrar.add("RegionTools.SelectRegion", boost::bind(&LLPanelRegionTools::onSelectRegion, this));
- mCommitCallbackRegistrar.add("RegionTools.SaveState", boost::bind(&LLPanelRegionTools::onSaveState, this));
+ mCommitCallbackRegistrar.add("RegionTools.ChangeAnything", boost::bind(&LLPanelRegionTools::onChangeAnything, this));
+ mCommitCallbackRegistrar.add("RegionTools.ChangePrelude", boost::bind(&LLPanelRegionTools::onChangePrelude, this));
+ mCommitCallbackRegistrar.add("RegionTools.BakeTerrain", boost::bind(&LLPanelRegionTools::onBakeTerrain, this));
+ mCommitCallbackRegistrar.add("RegionTools.RevertTerrain", boost::bind(&LLPanelRegionTools::onRevertTerrain, this));
+ mCommitCallbackRegistrar.add("RegionTools.SwapTerrain", boost::bind(&LLPanelRegionTools::onSwapTerrain, this));
+ mCommitCallbackRegistrar.add("RegionTools.Refresh", boost::bind(&LLPanelRegionTools::onRefresh, this));
+ mCommitCallbackRegistrar.add("RegionTools.ApplyChanges", boost::bind(&LLPanelRegionTools::onApplyChanges, this));
+ mCommitCallbackRegistrar.add("RegionTools.SelectRegion", boost::bind(&LLPanelRegionTools::onSelectRegion, this));
+ mCommitCallbackRegistrar.add("RegionTools.SaveState", boost::bind(&LLPanelRegionTools::onSaveState, this));
}
BOOL LLPanelRegionTools::postBuild()
{
- getChild<LLLineEditor>("region name")->setKeystrokeCallback(onChangeSimName, this);
- getChild<LLLineEditor>("region name")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
- getChild<LLLineEditor>("estate")->setPrevalidate(&LLTextValidate::validatePositiveS32);
- getChild<LLLineEditor>("parentestate")->setPrevalidate(&LLTextValidate::validatePositiveS32);
- getChildView("parentestate")->setEnabled(FALSE);
- getChild<LLLineEditor>("gridposx")->setPrevalidate(&LLTextValidate::validatePositiveS32);
- getChildView("gridposx")->setEnabled(FALSE);
- getChild<LLLineEditor>("gridposy")->setPrevalidate(&LLTextValidate::validatePositiveS32);
- getChildView("gridposy")->setEnabled(FALSE);
-
- getChild<LLLineEditor>("redirectx")->setPrevalidate(&LLTextValidate::validatePositiveS32);
- getChild<LLLineEditor>("redirecty")->setPrevalidate(&LLTextValidate::validatePositiveS32);
-
- return TRUE;
+ getChild<LLLineEditor>("region name")->setKeystrokeCallback(onChangeSimName, this);
+ getChild<LLLineEditor>("region name")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ getChild<LLLineEditor>("estate")->setPrevalidate(&LLTextValidate::validatePositiveS32);
+ getChild<LLLineEditor>("parentestate")->setPrevalidate(&LLTextValidate::validatePositiveS32);
+ getChildView("parentestate")->setEnabled(FALSE);
+ getChild<LLLineEditor>("gridposx")->setPrevalidate(&LLTextValidate::validatePositiveS32);
+ getChildView("gridposx")->setEnabled(FALSE);
+ getChild<LLLineEditor>("gridposy")->setPrevalidate(&LLTextValidate::validatePositiveS32);
+ getChildView("gridposy")->setEnabled(FALSE);
+
+ getChild<LLLineEditor>("redirectx")->setPrevalidate(&LLTextValidate::validatePositiveS32);
+ getChild<LLLineEditor>("redirecty")->setPrevalidate(&LLTextValidate::validatePositiveS32);
+
+ return TRUE;
}
// Destroys the object
LLPanelRegionTools::~LLPanelRegionTools()
{
- // base class will take care of everything
+ // base class will take care of everything
}
U64 LLPanelRegionTools::computeRegionFlags(U64 flags) const
{
- flags &= getRegionFlagsMask();
- flags |= getRegionFlags();
- return flags;
+ flags &= getRegionFlagsMask();
+ flags |= getRegionFlags();
+ return flags;
}
@@ -481,351 +481,351 @@ void LLPanelRegionTools::refresh()
void LLPanelRegionTools::clearAllWidgets()
{
- // clear all widgets
- getChild<LLUICtrl>("region name")->setValue("unknown");
- getChild<LLUICtrl>("region name")->setFocus( FALSE);
+ // clear all widgets
+ getChild<LLUICtrl>("region name")->setValue("unknown");
+ getChild<LLUICtrl>("region name")->setFocus( FALSE);
- getChild<LLUICtrl>("check prelude")->setValue(FALSE);
- getChildView("check prelude")->setEnabled(FALSE);
+ getChild<LLUICtrl>("check prelude")->setValue(FALSE);
+ getChildView("check prelude")->setEnabled(FALSE);
- getChild<LLUICtrl>("check fixed sun")->setValue(FALSE);
- getChildView("check fixed sun")->setEnabled(FALSE);
+ getChild<LLUICtrl>("check fixed sun")->setValue(FALSE);
+ getChildView("check fixed sun")->setEnabled(FALSE);
- getChild<LLUICtrl>("check reset home")->setValue(FALSE);
- getChildView("check reset home")->setEnabled(FALSE);
+ getChild<LLUICtrl>("check reset home")->setValue(FALSE);
+ getChildView("check reset home")->setEnabled(FALSE);
- getChild<LLUICtrl>("check damage")->setValue(FALSE);
- getChildView("check damage")->setEnabled(FALSE);
+ getChild<LLUICtrl>("check damage")->setValue(FALSE);
+ getChildView("check damage")->setEnabled(FALSE);
- getChild<LLUICtrl>("check visible")->setValue(FALSE);
- getChildView("check visible")->setEnabled(FALSE);
+ getChild<LLUICtrl>("check visible")->setValue(FALSE);
+ getChildView("check visible")->setEnabled(FALSE);
- getChild<LLUICtrl>("block terraform")->setValue(FALSE);
- getChildView("block terraform")->setEnabled(FALSE);
+ getChild<LLUICtrl>("block terraform")->setValue(FALSE);
+ getChildView("block terraform")->setEnabled(FALSE);
- getChild<LLUICtrl>("block dwell")->setValue(FALSE);
- getChildView("block dwell")->setEnabled(FALSE);
+ getChild<LLUICtrl>("block dwell")->setValue(FALSE);
+ getChildView("block dwell")->setEnabled(FALSE);
- getChild<LLUICtrl>("is sandbox")->setValue(FALSE);
- getChildView("is sandbox")->setEnabled(FALSE);
+ getChild<LLUICtrl>("is sandbox")->setValue(FALSE);
+ getChildView("is sandbox")->setEnabled(FALSE);
- getChild<LLUICtrl>("billable factor")->setValue(BILLABLE_FACTOR_DEFAULT);
- getChildView("billable factor")->setEnabled(FALSE);
+ getChild<LLUICtrl>("billable factor")->setValue(BILLABLE_FACTOR_DEFAULT);
+ getChildView("billable factor")->setEnabled(FALSE);
- getChild<LLUICtrl>("land cost")->setValue(PRICE_PER_METER_DEFAULT);
- getChildView("land cost")->setEnabled(FALSE);
+ getChild<LLUICtrl>("land cost")->setValue(PRICE_PER_METER_DEFAULT);
+ getChildView("land cost")->setEnabled(FALSE);
- getChildView("Apply")->setEnabled(FALSE);
- getChildView("Bake Terrain")->setEnabled(FALSE);
- getChildView("Autosave now")->setEnabled(FALSE);
+ getChildView("Apply")->setEnabled(FALSE);
+ getChildView("Bake Terrain")->setEnabled(FALSE);
+ getChildView("Autosave now")->setEnabled(FALSE);
}
void LLPanelRegionTools::enableAllWidgets()
{
- // enable all of the widgets
-
- getChildView("check prelude")->setEnabled(TRUE);
- getChildView("check fixed sun")->setEnabled(TRUE);
- getChildView("check reset home")->setEnabled(TRUE);
- getChildView("check damage")->setEnabled(TRUE);
- getChildView("check visible")->setEnabled(FALSE); // use estates to update...
- getChildView("block terraform")->setEnabled(TRUE);
- getChildView("block dwell")->setEnabled(TRUE);
- getChildView("is sandbox")->setEnabled(TRUE);
-
- getChildView("billable factor")->setEnabled(TRUE);
- getChildView("land cost")->setEnabled(TRUE);
-
- getChildView("Apply")->setEnabled(FALSE); // don't enable this one
- getChildView("Bake Terrain")->setEnabled(TRUE);
- getChildView("Autosave now")->setEnabled(TRUE);
+ // enable all of the widgets
+
+ getChildView("check prelude")->setEnabled(TRUE);
+ getChildView("check fixed sun")->setEnabled(TRUE);
+ getChildView("check reset home")->setEnabled(TRUE);
+ getChildView("check damage")->setEnabled(TRUE);
+ getChildView("check visible")->setEnabled(FALSE); // use estates to update...
+ getChildView("block terraform")->setEnabled(TRUE);
+ getChildView("block dwell")->setEnabled(TRUE);
+ getChildView("is sandbox")->setEnabled(TRUE);
+
+ getChildView("billable factor")->setEnabled(TRUE);
+ getChildView("land cost")->setEnabled(TRUE);
+
+ getChildView("Apply")->setEnabled(FALSE); // don't enable this one
+ getChildView("Bake Terrain")->setEnabled(TRUE);
+ getChildView("Autosave now")->setEnabled(TRUE);
}
void LLPanelRegionTools::onSaveState(void* userdata)
{
- if (gAgent.isGodlike())
- {
- // Send message to save world state
- gMessageSystem->newMessageFast(_PREHASH_StateSave);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_DataBlock);
- gMessageSystem->addStringFast(_PREHASH_Filename, NULL);
- gAgent.sendReliableMessage();
- }
+ if (gAgent.isGodlike())
+ {
+ // Send message to save world state
+ gMessageSystem->newMessageFast(_PREHASH_StateSave);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_DataBlock);
+ gMessageSystem->addStringFast(_PREHASH_Filename, NULL);
+ gAgent.sendReliableMessage();
+ }
}
const std::string LLPanelRegionTools::getSimName() const
{
- return getChild<LLUICtrl>("region name")->getValue();
+ return getChild<LLUICtrl>("region name")->getValue();
}
U32 LLPanelRegionTools::getEstateID() const
{
- U32 id = (U32)getChild<LLUICtrl>("estate")->getValue().asInteger();
- return id;
+ U32 id = (U32)getChild<LLUICtrl>("estate")->getValue().asInteger();
+ return id;
}
U32 LLPanelRegionTools::getParentEstateID() const
{
- U32 id = (U32)getChild<LLUICtrl>("parentestate")->getValue().asInteger();
- return id;
+ U32 id = (U32)getChild<LLUICtrl>("parentestate")->getValue().asInteger();
+ return id;
}
S32 LLPanelRegionTools::getRedirectGridX() const
{
- return getChild<LLUICtrl>("redirectx")->getValue().asInteger();
+ return getChild<LLUICtrl>("redirectx")->getValue().asInteger();
}
S32 LLPanelRegionTools::getRedirectGridY() const
{
- return getChild<LLUICtrl>("redirecty")->getValue().asInteger();
+ return getChild<LLUICtrl>("redirecty")->getValue().asInteger();
}
S32 LLPanelRegionTools::getGridPosX() const
{
- return getChild<LLUICtrl>("gridposx")->getValue().asInteger();
+ return getChild<LLUICtrl>("gridposx")->getValue().asInteger();
}
S32 LLPanelRegionTools::getGridPosY() const
{
- return getChild<LLUICtrl>("gridposy")->getValue().asInteger();
+ return getChild<LLUICtrl>("gridposy")->getValue().asInteger();
}
U64 LLPanelRegionTools::getRegionFlags() const
{
- U64 flags = 0x0;
- flags = getChild<LLUICtrl>("check prelude")->getValue().asBoolean()
- ? set_prelude_flags(flags)
- : unset_prelude_flags(flags);
-
- // override prelude
- if (getChild<LLUICtrl>("check fixed sun")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_SUN_FIXED;
- }
- if (getChild<LLUICtrl>("check reset home")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_RESET_HOME_ON_TELEPORT;
- }
- if (getChild<LLUICtrl>("check visible")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_EXTERNALLY_VISIBLE;
- }
- if (getChild<LLUICtrl>("check damage")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_ALLOW_DAMAGE;
- }
- if (getChild<LLUICtrl>("block terraform")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_BLOCK_TERRAFORM;
- }
- if (getChild<LLUICtrl>("block dwell")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_BLOCK_DWELL;
- }
- if (getChild<LLUICtrl>("is sandbox")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_SANDBOX;
- }
- return flags;
+ U64 flags = 0x0;
+ flags = getChild<LLUICtrl>("check prelude")->getValue().asBoolean()
+ ? set_prelude_flags(flags)
+ : unset_prelude_flags(flags);
+
+ // override prelude
+ if (getChild<LLUICtrl>("check fixed sun")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_SUN_FIXED;
+ }
+ if (getChild<LLUICtrl>("check reset home")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_RESET_HOME_ON_TELEPORT;
+ }
+ if (getChild<LLUICtrl>("check visible")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_EXTERNALLY_VISIBLE;
+ }
+ if (getChild<LLUICtrl>("check damage")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_ALLOW_DAMAGE;
+ }
+ if (getChild<LLUICtrl>("block terraform")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_BLOCK_TERRAFORM;
+ }
+ if (getChild<LLUICtrl>("block dwell")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_BLOCK_DWELL;
+ }
+ if (getChild<LLUICtrl>("is sandbox")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_SANDBOX;
+ }
+ return flags;
}
U64 LLPanelRegionTools::getRegionFlagsMask() const
{
- U64 flags = 0xFFFFFFFFFFFFFFFFULL;
- flags = getChild<LLUICtrl>("check prelude")->getValue().asBoolean()
- ? set_prelude_flags(flags)
- : unset_prelude_flags(flags);
-
- if (!getChild<LLUICtrl>("check fixed sun")->getValue().asBoolean())
- {
- flags &= ~REGION_FLAGS_SUN_FIXED;
- }
- if (!getChild<LLUICtrl>("check reset home")->getValue().asBoolean())
- {
- flags &= ~REGION_FLAGS_RESET_HOME_ON_TELEPORT;
- }
- if (!getChild<LLUICtrl>("check visible")->getValue().asBoolean())
- {
- flags &= ~REGION_FLAGS_EXTERNALLY_VISIBLE;
- }
- if (!getChild<LLUICtrl>("check damage")->getValue().asBoolean())
- {
- flags &= ~REGION_FLAGS_ALLOW_DAMAGE;
- }
- if (!getChild<LLUICtrl>("block terraform")->getValue().asBoolean())
- {
- flags &= ~REGION_FLAGS_BLOCK_TERRAFORM;
- }
- if (!getChild<LLUICtrl>("block dwell")->getValue().asBoolean())
- {
- flags &= ~REGION_FLAGS_BLOCK_DWELL;
- }
- if (!getChild<LLUICtrl>("is sandbox")->getValue().asBoolean())
- {
- flags &= ~REGION_FLAGS_SANDBOX;
- }
- return flags;
+ U64 flags = 0xFFFFFFFFFFFFFFFFULL;
+ flags = getChild<LLUICtrl>("check prelude")->getValue().asBoolean()
+ ? set_prelude_flags(flags)
+ : unset_prelude_flags(flags);
+
+ if (!getChild<LLUICtrl>("check fixed sun")->getValue().asBoolean())
+ {
+ flags &= ~REGION_FLAGS_SUN_FIXED;
+ }
+ if (!getChild<LLUICtrl>("check reset home")->getValue().asBoolean())
+ {
+ flags &= ~REGION_FLAGS_RESET_HOME_ON_TELEPORT;
+ }
+ if (!getChild<LLUICtrl>("check visible")->getValue().asBoolean())
+ {
+ flags &= ~REGION_FLAGS_EXTERNALLY_VISIBLE;
+ }
+ if (!getChild<LLUICtrl>("check damage")->getValue().asBoolean())
+ {
+ flags &= ~REGION_FLAGS_ALLOW_DAMAGE;
+ }
+ if (!getChild<LLUICtrl>("block terraform")->getValue().asBoolean())
+ {
+ flags &= ~REGION_FLAGS_BLOCK_TERRAFORM;
+ }
+ if (!getChild<LLUICtrl>("block dwell")->getValue().asBoolean())
+ {
+ flags &= ~REGION_FLAGS_BLOCK_DWELL;
+ }
+ if (!getChild<LLUICtrl>("is sandbox")->getValue().asBoolean())
+ {
+ flags &= ~REGION_FLAGS_SANDBOX;
+ }
+ return flags;
}
F32 LLPanelRegionTools::getBillableFactor() const
{
- return (F32)getChild<LLUICtrl>("billable factor")->getValue().asReal();
+ return (F32)getChild<LLUICtrl>("billable factor")->getValue().asReal();
}
S32 LLPanelRegionTools::getPricePerMeter() const
{
- return getChild<LLUICtrl>("land cost")->getValue();
+ return getChild<LLUICtrl>("land cost")->getValue();
}
void LLPanelRegionTools::setSimName(const std::string& name)
{
- getChild<LLUICtrl>("region name")->setValue(name);
+ getChild<LLUICtrl>("region name")->setValue(name);
}
void LLPanelRegionTools::setEstateID(U32 id)
{
- getChild<LLUICtrl>("estate")->setValue((S32)id);
+ getChild<LLUICtrl>("estate")->setValue((S32)id);
}
void LLPanelRegionTools::setGridPosX(S32 pos)
{
- getChild<LLUICtrl>("gridposx")->setValue(pos);
+ getChild<LLUICtrl>("gridposx")->setValue(pos);
}
void LLPanelRegionTools::setGridPosY(S32 pos)
{
- getChild<LLUICtrl>("gridposy")->setValue(pos);
+ getChild<LLUICtrl>("gridposy")->setValue(pos);
}
void LLPanelRegionTools::setRedirectGridX(S32 pos)
{
- getChild<LLUICtrl>("redirectx")->setValue(pos);
+ getChild<LLUICtrl>("redirectx")->setValue(pos);
}
void LLPanelRegionTools::setRedirectGridY(S32 pos)
{
- getChild<LLUICtrl>("redirecty")->setValue(pos);
+ getChild<LLUICtrl>("redirecty")->setValue(pos);
}
void LLPanelRegionTools::setParentEstateID(U32 id)
{
- getChild<LLUICtrl>("parentestate")->setValue((S32)id);
+ getChild<LLUICtrl>("parentestate")->setValue((S32)id);
}
void LLPanelRegionTools::setCheckFlags(U64 flags)
{
- getChild<LLUICtrl>("check prelude")->setValue(is_prelude(flags) ? TRUE : FALSE);
- getChild<LLUICtrl>("check fixed sun")->setValue(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE);
- getChild<LLUICtrl>("check reset home")->setValue(flags & REGION_FLAGS_RESET_HOME_ON_TELEPORT ? TRUE : FALSE);
- getChild<LLUICtrl>("check damage")->setValue(flags & REGION_FLAGS_ALLOW_DAMAGE ? TRUE : FALSE);
- getChild<LLUICtrl>("check visible")->setValue(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? TRUE : FALSE);
- getChild<LLUICtrl>("block terraform")->setValue(flags & REGION_FLAGS_BLOCK_TERRAFORM ? TRUE : FALSE);
- getChild<LLUICtrl>("block dwell")->setValue(flags & REGION_FLAGS_BLOCK_DWELL ? TRUE : FALSE);
- getChild<LLUICtrl>("is sandbox")->setValue(flags & REGION_FLAGS_SANDBOX ? TRUE : FALSE );
+ getChild<LLUICtrl>("check prelude")->setValue(is_prelude(flags) ? TRUE : FALSE);
+ getChild<LLUICtrl>("check fixed sun")->setValue(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE);
+ getChild<LLUICtrl>("check reset home")->setValue(flags & REGION_FLAGS_RESET_HOME_ON_TELEPORT ? TRUE : FALSE);
+ getChild<LLUICtrl>("check damage")->setValue(flags & REGION_FLAGS_ALLOW_DAMAGE ? TRUE : FALSE);
+ getChild<LLUICtrl>("check visible")->setValue(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? TRUE : FALSE);
+ getChild<LLUICtrl>("block terraform")->setValue(flags & REGION_FLAGS_BLOCK_TERRAFORM ? TRUE : FALSE);
+ getChild<LLUICtrl>("block dwell")->setValue(flags & REGION_FLAGS_BLOCK_DWELL ? TRUE : FALSE);
+ getChild<LLUICtrl>("is sandbox")->setValue(flags & REGION_FLAGS_SANDBOX ? TRUE : FALSE );
}
void LLPanelRegionTools::setBillableFactor(F32 billable_factor)
{
- getChild<LLUICtrl>("billable factor")->setValue(billable_factor);
+ getChild<LLUICtrl>("billable factor")->setValue(billable_factor);
}
void LLPanelRegionTools::setPricePerMeter(S32 price)
{
- getChild<LLUICtrl>("land cost")->setValue(price);
+ getChild<LLUICtrl>("land cost")->setValue(price);
}
void LLPanelRegionTools::onChangeAnything()
{
- if (gAgent.isGodlike())
- {
- getChildView("Apply")->setEnabled(TRUE);
- }
+ if (gAgent.isGodlike())
+ {
+ getChildView("Apply")->setEnabled(TRUE);
+ }
}
void LLPanelRegionTools::onChangePrelude()
{
- // checking prelude auto-checks fixed sun
- if (getChild<LLUICtrl>("check prelude")->getValue().asBoolean())
- {
- getChild<LLUICtrl>("check fixed sun")->setValue(TRUE);
- getChild<LLUICtrl>("check reset home")->setValue(TRUE);
- onChangeAnything();
- }
- // pass on to default onChange handler
+ // checking prelude auto-checks fixed sun
+ if (getChild<LLUICtrl>("check prelude")->getValue().asBoolean())
+ {
+ getChild<LLUICtrl>("check fixed sun")->setValue(TRUE);
+ getChild<LLUICtrl>("check reset home")->setValue(TRUE);
+ onChangeAnything();
+ }
+ // pass on to default onChange handler
}
// static
void LLPanelRegionTools::onChangeSimName(LLLineEditor* caller, void* userdata )
{
- if (userdata && gAgent.isGodlike())
- {
- LLPanelRegionTools* region_tools = (LLPanelRegionTools*) userdata;
- region_tools->getChildView("Apply")->setEnabled(TRUE);
- }
+ if (userdata && gAgent.isGodlike())
+ {
+ LLPanelRegionTools* region_tools = (LLPanelRegionTools*) userdata;
+ region_tools->getChildView("Apply")->setEnabled(TRUE);
+ }
}
void LLPanelRegionTools::onRefresh()
{
- LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
- if(!god_tools) return;
- LLViewerRegion *region = gAgent.getRegion();
- if (region && gAgent.isGodlike())
- {
- god_tools->sendRegionInfoRequest();
- //LLFloaterGodTools::getInstance()->sendRegionInfoRequest();
- //LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools")->sendRegionInfoRequest();
- }
+ LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
+ if(!god_tools) return;
+ LLViewerRegion *region = gAgent.getRegion();
+ if (region && gAgent.isGodlike())
+ {
+ god_tools->sendRegionInfoRequest();
+ //LLFloaterGodTools::getInstance()->sendRegionInfoRequest();
+ //LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools")->sendRegionInfoRequest();
+ }
}
void LLPanelRegionTools::onApplyChanges()
{
- LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
- if(!god_tools) return;
- LLViewerRegion *region = gAgent.getRegion();
- if (region && gAgent.isGodlike())
- {
- getChildView("Apply")->setEnabled(FALSE);
- god_tools->sendGodUpdateRegionInfo();
- //LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools")->sendGodUpdateRegionInfo();
- }
+ LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
+ if(!god_tools) return;
+ LLViewerRegion *region = gAgent.getRegion();
+ if (region && gAgent.isGodlike())
+ {
+ getChildView("Apply")->setEnabled(FALSE);
+ god_tools->sendGodUpdateRegionInfo();
+ //LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools")->sendGodUpdateRegionInfo();
+ }
}
void LLPanelRegionTools::onBakeTerrain()
{
- LLPanelRequestTools::sendRequest("terrain", "bake", gAgent.getRegionHost());
+ LLPanelRequestTools::sendRequest("terrain", "bake", gAgent.getRegionHost());
}
void LLPanelRegionTools::onRevertTerrain()
{
- LLPanelRequestTools::sendRequest("terrain", "revert", gAgent.getRegionHost());
+ LLPanelRequestTools::sendRequest("terrain", "revert", gAgent.getRegionHost());
}
void LLPanelRegionTools::onSwapTerrain()
{
- LLPanelRequestTools::sendRequest("terrain", "swap", gAgent.getRegionHost());
+ LLPanelRequestTools::sendRequest("terrain", "swap", gAgent.getRegionHost());
}
void LLPanelRegionTools::onSelectRegion()
{
- LL_INFOS() << "LLPanelRegionTools::onSelectRegion" << LL_ENDL;
+ LL_INFOS() << "LLPanelRegionTools::onSelectRegion" << LL_ENDL;
+
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(gAgent.getPositionGlobal());
+ if (!regionp)
+ {
+ return;
+ }
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(gAgent.getPositionGlobal());
- if (!regionp)
- {
- return;
- }
+ LLVector3d north_east(REGION_WIDTH_METERS, REGION_WIDTH_METERS, 0);
+ LLViewerParcelMgr::getInstance()->selectLand(regionp->getOriginGlobal(),
+ regionp->getOriginGlobal() + north_east, FALSE);
- LLVector3d north_east(REGION_WIDTH_METERS, REGION_WIDTH_METERS, 0);
- LLViewerParcelMgr::getInstance()->selectLand(regionp->getOriginGlobal(),
- regionp->getOriginGlobal() + north_east, FALSE);
-
}
@@ -841,7 +841,7 @@ void LLPanelRegionTools::onSelectRegion()
// | ^ ^ |
// | LEFT R1 |
// | |
-// | [Kick all users] |
+// | [Kick all users] |
// | |
// | |
// | |
@@ -852,9 +852,9 @@ void LLPanelRegionTools::onSelectRegion()
// LEFT R2 RIGHT
LLPanelGridTools::LLPanelGridTools() :
- LLPanel()
+ LLPanel()
{
- mCommitCallbackRegistrar.add("GridTools.FlushMapVisibilityCaches", boost::bind(&LLPanelGridTools::onClickFlushMapVisibilityCaches, this));
+ mCommitCallbackRegistrar.add("GridTools.FlushMapVisibilityCaches", boost::bind(&LLPanelGridTools::onClickFlushMapVisibilityCaches, this));
}
// Destroys the object
@@ -864,7 +864,7 @@ LLPanelGridTools::~LLPanelGridTools()
BOOL LLPanelGridTools::postBuild()
{
- return TRUE;
+ return TRUE;
}
void LLPanelGridTools::refresh()
@@ -873,30 +873,30 @@ void LLPanelGridTools::refresh()
void LLPanelGridTools::onClickFlushMapVisibilityCaches()
{
- LLNotificationsUtil::add("FlushMapVisibilityCaches", LLSD(), LLSD(), flushMapVisibilityCachesConfirm);
+ LLNotificationsUtil::add("FlushMapVisibilityCaches", LLSD(), LLSD(), flushMapVisibilityCachesConfirm);
}
// static
bool LLPanelGridTools::flushMapVisibilityCachesConfirm(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return false;
- // HACK: Send this as an EstateOwnerRequest so it gets routed
- // correctly by the spaceserver. JC
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("EstateOwnerMessage");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", "refreshmapvisibility");
- msg->addUUID("Invoice", LLUUID::null);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", gAgent.getID().asString());
- gAgent.sendReliableMessage();
- return false;
+ // HACK: Send this as an EstateOwnerRequest so it gets routed
+ // correctly by the spaceserver. JC
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("EstateOwnerMessage");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ msg->nextBlock("MethodData");
+ msg->addString("Method", "refreshmapvisibility");
+ msg->addUUID("Invoice", LLUUID::null);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", gAgent.getID().asString());
+ gAgent.sendReliableMessage();
+ return false;
}
@@ -914,9 +914,9 @@ bool LLPanelGridTools::flushMapVisibilityCachesConfirm(const LLSD& notification,
// | [X] Disable Scripts [X] Disable Collisions [X] Disable Physics |
// | [ Apply ] |
// | |
-// | [Set Target Avatar] Avatar Name |
-// | [Delete Target's Objects on Public Land ] |
-// | [Delete All Target's Objects ] |
+// | [Set Target Avatar] Avatar Name |
+// | [Delete Target's Objects on Public Land ] |
+// | [Delete All Target's Objects ] |
// | [Delete All Scripted Objects on Public Land] |
// | [Get Top Colliders ] |
// | [Get Top Scripts ] |
@@ -925,292 +925,292 @@ bool LLPanelGridTools::flushMapVisibilityCachesConfirm(const LLSD& notification,
// LEFT RIGHT
// Default constructor
-LLPanelObjectTools::LLPanelObjectTools()
- : LLPanel(),
- mTargetAvatar()
+LLPanelObjectTools::LLPanelObjectTools()
+ : LLPanel(),
+ mTargetAvatar()
{
- mCommitCallbackRegistrar.add("ObjectTools.ChangeAnything", boost::bind(&LLPanelObjectTools::onChangeAnything, this));
- mCommitCallbackRegistrar.add("ObjectTools.DeletePublicOwnedBy", boost::bind(&LLPanelObjectTools::onClickDeletePublicOwnedBy, this));
- mCommitCallbackRegistrar.add("ObjectTools.DeleteAllScriptedOwnedBy", boost::bind(&LLPanelObjectTools::onClickDeleteAllScriptedOwnedBy, this));
- mCommitCallbackRegistrar.add("ObjectTools.DeleteAllOwnedBy", boost::bind(&LLPanelObjectTools::onClickDeleteAllOwnedBy, this));
- mCommitCallbackRegistrar.add("ObjectTools.ApplyChanges", boost::bind(&LLPanelObjectTools::onApplyChanges, this));
- mCommitCallbackRegistrar.add("ObjectTools.Set", boost::bind(&LLPanelObjectTools::onClickSet, this));
- mCommitCallbackRegistrar.add("ObjectTools.GetTopColliders", boost::bind(&LLPanelObjectTools::onGetTopColliders, this));
- mCommitCallbackRegistrar.add("ObjectTools.GetTopScripts", boost::bind(&LLPanelObjectTools::onGetTopScripts, this));
- mCommitCallbackRegistrar.add("ObjectTools.GetScriptDigest", boost::bind(&LLPanelObjectTools::onGetScriptDigest, this));
+ mCommitCallbackRegistrar.add("ObjectTools.ChangeAnything", boost::bind(&LLPanelObjectTools::onChangeAnything, this));
+ mCommitCallbackRegistrar.add("ObjectTools.DeletePublicOwnedBy", boost::bind(&LLPanelObjectTools::onClickDeletePublicOwnedBy, this));
+ mCommitCallbackRegistrar.add("ObjectTools.DeleteAllScriptedOwnedBy", boost::bind(&LLPanelObjectTools::onClickDeleteAllScriptedOwnedBy, this));
+ mCommitCallbackRegistrar.add("ObjectTools.DeleteAllOwnedBy", boost::bind(&LLPanelObjectTools::onClickDeleteAllOwnedBy, this));
+ mCommitCallbackRegistrar.add("ObjectTools.ApplyChanges", boost::bind(&LLPanelObjectTools::onApplyChanges, this));
+ mCommitCallbackRegistrar.add("ObjectTools.Set", boost::bind(&LLPanelObjectTools::onClickSet, this));
+ mCommitCallbackRegistrar.add("ObjectTools.GetTopColliders", boost::bind(&LLPanelObjectTools::onGetTopColliders, this));
+ mCommitCallbackRegistrar.add("ObjectTools.GetTopScripts", boost::bind(&LLPanelObjectTools::onGetTopScripts, this));
+ mCommitCallbackRegistrar.add("ObjectTools.GetScriptDigest", boost::bind(&LLPanelObjectTools::onGetScriptDigest, this));
}
// Destroys the object
LLPanelObjectTools::~LLPanelObjectTools()
{
- // base class will take care of everything
+ // base class will take care of everything
}
BOOL LLPanelObjectTools::postBuild()
{
- refresh();
- return TRUE;
+ refresh();
+ return TRUE;
}
void LLPanelObjectTools::setTargetAvatar(const LLUUID &target_id)
{
- mTargetAvatar = target_id;
- if (target_id.isNull())
- {
- getChild<LLUICtrl>("target_avatar_name")->setValue(getString("no_target"));
- }
-}
+ mTargetAvatar = target_id;
+ if (target_id.isNull())
+ {
+ getChild<LLUICtrl>("target_avatar_name")->setValue(getString("no_target"));
+ }
+}
void LLPanelObjectTools::refresh()
{
- LLViewerRegion *regionp = gAgent.getRegion();
- if (regionp)
- {
- getChild<LLUICtrl>("region name")->setValue(regionp->getName());
- }
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ getChild<LLUICtrl>("region name")->setValue(regionp->getName());
+ }
}
U64 LLPanelObjectTools::computeRegionFlags(U64 flags) const
{
- if (getChild<LLUICtrl>("disable scripts")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_SKIP_SCRIPTS;
- }
- else
- {
- flags &= ~REGION_FLAGS_SKIP_SCRIPTS;
- }
- if (getChild<LLUICtrl>("disable collisions")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_SKIP_COLLISIONS;
- }
- else
- {
- flags &= ~REGION_FLAGS_SKIP_COLLISIONS;
- }
- if (getChild<LLUICtrl>("disable physics")->getValue().asBoolean())
- {
- flags |= REGION_FLAGS_SKIP_PHYSICS;
- }
- else
- {
- flags &= ~REGION_FLAGS_SKIP_PHYSICS;
- }
- return flags;
+ if (getChild<LLUICtrl>("disable scripts")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_SKIP_SCRIPTS;
+ }
+ else
+ {
+ flags &= ~REGION_FLAGS_SKIP_SCRIPTS;
+ }
+ if (getChild<LLUICtrl>("disable collisions")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_SKIP_COLLISIONS;
+ }
+ else
+ {
+ flags &= ~REGION_FLAGS_SKIP_COLLISIONS;
+ }
+ if (getChild<LLUICtrl>("disable physics")->getValue().asBoolean())
+ {
+ flags |= REGION_FLAGS_SKIP_PHYSICS;
+ }
+ else
+ {
+ flags &= ~REGION_FLAGS_SKIP_PHYSICS;
+ }
+ return flags;
}
void LLPanelObjectTools::setCheckFlags(U64 flags)
{
- getChild<LLUICtrl>("disable scripts")->setValue(flags & REGION_FLAGS_SKIP_SCRIPTS ? TRUE : FALSE);
- getChild<LLUICtrl>("disable collisions")->setValue(flags & REGION_FLAGS_SKIP_COLLISIONS ? TRUE : FALSE);
- getChild<LLUICtrl>("disable physics")->setValue(flags & REGION_FLAGS_SKIP_PHYSICS ? TRUE : FALSE);
+ getChild<LLUICtrl>("disable scripts")->setValue(flags & REGION_FLAGS_SKIP_SCRIPTS ? TRUE : FALSE);
+ getChild<LLUICtrl>("disable collisions")->setValue(flags & REGION_FLAGS_SKIP_COLLISIONS ? TRUE : FALSE);
+ getChild<LLUICtrl>("disable physics")->setValue(flags & REGION_FLAGS_SKIP_PHYSICS ? TRUE : FALSE);
}
void LLPanelObjectTools::clearAllWidgets()
{
- getChild<LLUICtrl>("disable scripts")->setValue(FALSE);
- getChildView("disable scripts")->setEnabled(FALSE);
+ getChild<LLUICtrl>("disable scripts")->setValue(FALSE);
+ getChildView("disable scripts")->setEnabled(FALSE);
- getChildView("Apply")->setEnabled(FALSE);
- getChildView("Set Target")->setEnabled(FALSE);
- getChildView("Delete Target's Scripted Objects On Others Land")->setEnabled(FALSE);
- getChildView("Delete Target's Scripted Objects On *Any* Land")->setEnabled(FALSE);
- getChildView("Delete *ALL* Of Target's Objects")->setEnabled(FALSE);
+ getChildView("Apply")->setEnabled(FALSE);
+ getChildView("Set Target")->setEnabled(FALSE);
+ getChildView("Delete Target's Scripted Objects On Others Land")->setEnabled(FALSE);
+ getChildView("Delete Target's Scripted Objects On *Any* Land")->setEnabled(FALSE);
+ getChildView("Delete *ALL* Of Target's Objects")->setEnabled(FALSE);
}
void LLPanelObjectTools::enableAllWidgets()
{
- getChildView("disable scripts")->setEnabled(TRUE);
+ getChildView("disable scripts")->setEnabled(TRUE);
- getChildView("Apply")->setEnabled(FALSE); // don't enable this one
- getChildView("Set Target")->setEnabled(TRUE);
- getChildView("Delete Target's Scripted Objects On Others Land")->setEnabled(TRUE);
- getChildView("Delete Target's Scripted Objects On *Any* Land")->setEnabled(TRUE);
- getChildView("Delete *ALL* Of Target's Objects")->setEnabled(TRUE);
- getChildView("Get Top Colliders")->setEnabled(TRUE);
- getChildView("Get Top Scripts")->setEnabled(TRUE);
+ getChildView("Apply")->setEnabled(FALSE); // don't enable this one
+ getChildView("Set Target")->setEnabled(TRUE);
+ getChildView("Delete Target's Scripted Objects On Others Land")->setEnabled(TRUE);
+ getChildView("Delete Target's Scripted Objects On *Any* Land")->setEnabled(TRUE);
+ getChildView("Delete *ALL* Of Target's Objects")->setEnabled(TRUE);
+ getChildView("Get Top Colliders")->setEnabled(TRUE);
+ getChildView("Get Top Scripts")->setEnabled(TRUE);
}
void LLPanelObjectTools::onGetTopColliders()
{
- LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
- if(!instance) return;
-
- if (gAgent.isGodlike())
- {
- LLFloaterReg::showInstance("top_objects");
- LLFloaterTopObjects::setMode(STAT_REPORT_TOP_COLLIDERS);
- instance->onRefresh();
- }
+ LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
+ if(!instance) return;
+
+ if (gAgent.isGodlike())
+ {
+ LLFloaterReg::showInstance("top_objects");
+ LLFloaterTopObjects::setMode(STAT_REPORT_TOP_COLLIDERS);
+ instance->onRefresh();
+ }
}
void LLPanelObjectTools::onGetTopScripts()
{
- LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
- if(!instance) return;
-
- if (gAgent.isGodlike())
- {
- LLFloaterReg::showInstance("top_objects");
- LLFloaterTopObjects::setMode(STAT_REPORT_TOP_SCRIPTS);
- instance->onRefresh();
- }
+ LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
+ if(!instance) return;
+
+ if (gAgent.isGodlike())
+ {
+ LLFloaterReg::showInstance("top_objects");
+ LLFloaterTopObjects::setMode(STAT_REPORT_TOP_SCRIPTS);
+ instance->onRefresh();
+ }
}
void LLPanelObjectTools::onGetScriptDigest()
{
- if (gAgent.isGodlike())
- {
- // get the list of scripts and number of occurences of each
- // (useful for finding self-replicating objects)
- LLPanelRequestTools::sendRequest("scriptdigest","0",gAgent.getRegionHost());
- }
+ if (gAgent.isGodlike())
+ {
+ // get the list of scripts and number of occurences of each
+ // (useful for finding self-replicating objects)
+ LLPanelRequestTools::sendRequest("scriptdigest","0",gAgent.getRegionHost());
+ }
}
void LLPanelObjectTools::onClickDeletePublicOwnedBy()
{
- // Bring up view-modal dialog
+ // Bring up view-modal dialog
- if (!mTargetAvatar.isNull())
- {
- mSimWideDeletesFlags =
- SWD_SCRIPTED_ONLY | SWD_OTHERS_LAND_ONLY;
+ if (!mTargetAvatar.isNull())
+ {
+ mSimWideDeletesFlags =
+ SWD_SCRIPTED_ONLY | SWD_OTHERS_LAND_ONLY;
- LLSD args;
- args["AVATAR_NAME"] = getChild<LLUICtrl>("target_avatar_name")->getValue().asString();
- LLSD payload;
- payload["avatar_id"] = mTargetAvatar;
- payload["flags"] = (S32)mSimWideDeletesFlags;
+ LLSD args;
+ args["AVATAR_NAME"] = getChild<LLUICtrl>("target_avatar_name")->getValue().asString();
+ LLSD payload;
+ payload["avatar_id"] = mTargetAvatar;
+ payload["flags"] = (S32)mSimWideDeletesFlags;
- LLNotificationsUtil::add( "GodDeleteAllScriptedPublicObjectsByUser",
- args,
- payload,
- callbackSimWideDeletes);
- }
+ LLNotificationsUtil::add( "GodDeleteAllScriptedPublicObjectsByUser",
+ args,
+ payload,
+ callbackSimWideDeletes);
+ }
}
void LLPanelObjectTools::onClickDeleteAllScriptedOwnedBy()
{
- // Bring up view-modal dialog
- if (!mTargetAvatar.isNull())
- {
- mSimWideDeletesFlags = SWD_SCRIPTED_ONLY;
+ // Bring up view-modal dialog
+ if (!mTargetAvatar.isNull())
+ {
+ mSimWideDeletesFlags = SWD_SCRIPTED_ONLY;
- LLSD args;
- args["AVATAR_NAME"] = getChild<LLUICtrl>("target_avatar_name")->getValue().asString();
- LLSD payload;
- payload["avatar_id"] = mTargetAvatar;
- payload["flags"] = (S32)mSimWideDeletesFlags;
+ LLSD args;
+ args["AVATAR_NAME"] = getChild<LLUICtrl>("target_avatar_name")->getValue().asString();
+ LLSD payload;
+ payload["avatar_id"] = mTargetAvatar;
+ payload["flags"] = (S32)mSimWideDeletesFlags;
- LLNotificationsUtil::add( "GodDeleteAllScriptedObjectsByUser",
- args,
- payload,
- callbackSimWideDeletes);
- }
+ LLNotificationsUtil::add( "GodDeleteAllScriptedObjectsByUser",
+ args,
+ payload,
+ callbackSimWideDeletes);
+ }
}
void LLPanelObjectTools::onClickDeleteAllOwnedBy()
{
- // Bring up view-modal dialog
- if (!mTargetAvatar.isNull())
- {
- mSimWideDeletesFlags = 0;
+ // Bring up view-modal dialog
+ if (!mTargetAvatar.isNull())
+ {
+ mSimWideDeletesFlags = 0;
- LLSD args;
- args["AVATAR_NAME"] = getChild<LLUICtrl>("target_avatar_name")->getValue().asString();
- LLSD payload;
- payload["avatar_id"] = mTargetAvatar;
- payload["flags"] = (S32)mSimWideDeletesFlags;
+ LLSD args;
+ args["AVATAR_NAME"] = getChild<LLUICtrl>("target_avatar_name")->getValue().asString();
+ LLSD payload;
+ payload["avatar_id"] = mTargetAvatar;
+ payload["flags"] = (S32)mSimWideDeletesFlags;
- LLNotificationsUtil::add( "GodDeleteAllObjectsByUser",
- args,
- payload,
- callbackSimWideDeletes);
- }
+ LLNotificationsUtil::add( "GodDeleteAllObjectsByUser",
+ args,
+ payload,
+ callbackSimWideDeletes);
+ }
}
// static
bool LLPanelObjectTools::callbackSimWideDeletes( const LLSD& notification, const LLSD& response )
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- if (!notification["payload"]["avatar_id"].asUUID().isNull())
- {
- send_sim_wide_deletes(notification["payload"]["avatar_id"].asUUID(),
- notification["payload"]["flags"].asInteger());
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ if (!notification["payload"]["avatar_id"].asUUID().isNull())
+ {
+ send_sim_wide_deletes(notification["payload"]["avatar_id"].asUUID(),
+ notification["payload"]["flags"].asInteger());
+ }
+ }
+ return false;
}
void LLPanelObjectTools::onClickSet()
{
LLView * button = findChild<LLButton>("Set Target");
LLFloater * root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2), FALSE, FALSE, FALSE, root_floater->getName(), button);
- // grandparent is a floater, which can have a dependent
- if (picker)
- {
- root_floater->addDependentFloater(picker);
- }
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2), FALSE, FALSE, FALSE, root_floater->getName(), button);
+ // grandparent is a floater, which can have a dependent
+ if (picker)
+ {
+ root_floater->addDependentFloater(picker);
+ }
}
void LLPanelObjectTools::onClickSetBySelection(void* data)
{
- LLPanelObjectTools* panelp = (LLPanelObjectTools*) data;
- if (!panelp) return;
+ LLPanelObjectTools* panelp = (LLPanelObjectTools*) data;
+ if (!panelp) return;
- const BOOL non_root_ok = TRUE;
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, non_root_ok);
- if (!node) return;
+ const BOOL non_root_ok = TRUE;
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, non_root_ok);
+ if (!node) return;
- std::string owner_name;
- LLUUID owner_id;
- LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
+ std::string owner_name;
+ LLUUID owner_id;
+ LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
- panelp->mTargetAvatar = owner_id;
- LLStringUtil::format_map_t args;
- args["[OBJECT]"] = node->mName;
- args["[OWNER]"] = owner_name;
- std::string name = LLTrans::getString("GodToolsObjectOwnedBy", args);
- panelp->getChild<LLUICtrl>("target_avatar_name")->setValue(name);
+ panelp->mTargetAvatar = owner_id;
+ LLStringUtil::format_map_t args;
+ args["[OBJECT]"] = node->mName;
+ args["[OWNER]"] = owner_name;
+ std::string name = LLTrans::getString("GodToolsObjectOwnedBy", args);
+ panelp->getChild<LLUICtrl>("target_avatar_name")->setValue(name);
}
void LLPanelObjectTools::callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
{
- if (ids.empty() || names.empty()) return;
- mTargetAvatar = ids[0];
- getChild<LLUICtrl>("target_avatar_name")->setValue(names[0].getCompleteName());
- refresh();
+ if (ids.empty() || names.empty()) return;
+ mTargetAvatar = ids[0];
+ getChild<LLUICtrl>("target_avatar_name")->setValue(names[0].getCompleteName());
+ refresh();
}
void LLPanelObjectTools::onChangeAnything()
{
- if (gAgent.isGodlike())
- {
- getChildView("Apply")->setEnabled(TRUE);
- }
+ if (gAgent.isGodlike())
+ {
+ getChildView("Apply")->setEnabled(TRUE);
+ }
}
void LLPanelObjectTools::onApplyChanges()
{
- LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
- if(!god_tools) return;
- LLViewerRegion *region = gAgent.getRegion();
- if (region && gAgent.isGodlike())
- {
- // TODO -- implement this
- getChildView("Apply")->setEnabled(FALSE);
- god_tools->sendGodUpdateRegionInfo();
- //LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools")->sendGodUpdateRegionInfo();
- }
+ LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
+ if(!god_tools) return;
+ LLViewerRegion *region = gAgent.getRegion();
+ if (region && gAgent.isGodlike())
+ {
+ // TODO -- implement this
+ getChildView("Apply")->setEnabled(FALSE);
+ god_tools->sendGodUpdateRegionInfo();
+ //LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools")->sendGodUpdateRegionInfo();
+ }
}
@@ -1222,9 +1222,9 @@ const std::string SELECTION = "Selection";
const std::string AGENT_REGION = "Agent Region";
LLPanelRequestTools::LLPanelRequestTools():
- LLPanel()
+ LLPanel()
{
- mCommitCallbackRegistrar.add("GodTools.Request", boost::bind(&LLPanelRequestTools::onClickRequest, this));
+ mCommitCallbackRegistrar.add("GodTools.Request", boost::bind(&LLPanelRequestTools::onClickRequest, this));
}
LLPanelRequestTools::~LLPanelRequestTools()
@@ -1233,138 +1233,138 @@ LLPanelRequestTools::~LLPanelRequestTools()
BOOL LLPanelRequestTools::postBuild()
{
- refresh();
+ refresh();
- return TRUE;
+ return TRUE;
}
void LLPanelRequestTools::refresh()
{
- std::string buffer = getChild<LLUICtrl>("destination")->getValue();
- LLCtrlListInterface *list = childGetListInterface("destination");
- if (!list) return;
-
- S32 last_item = list->getItemCount();
-
- if (last_item >=3)
- {
- list->selectItemRange(2,last_item);
- list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
- }
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- std::string name = regionp->getName();
- if (!name.empty())
- {
- list->addSimpleElement(name);
- }
- }
- if(!buffer.empty())
- {
- list->selectByValue(buffer);
- }
- else
- {
- list->operateOnSelection(LLCtrlListInterface::OP_DESELECT);
- }
+ std::string buffer = getChild<LLUICtrl>("destination")->getValue();
+ LLCtrlListInterface *list = childGetListInterface("destination");
+ if (!list) return;
+
+ S32 last_item = list->getItemCount();
+
+ if (last_item >=3)
+ {
+ list->selectItemRange(2,last_item);
+ list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
+ }
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ std::string name = regionp->getName();
+ if (!name.empty())
+ {
+ list->addSimpleElement(name);
+ }
+ }
+ if(!buffer.empty())
+ {
+ list->selectByValue(buffer);
+ }
+ else
+ {
+ list->operateOnSelection(LLCtrlListInterface::OP_DESELECT);
+ }
}
// static
-void LLPanelRequestTools::sendRequest(const std::string& request,
- const std::string& parameter,
- const LLHost& host)
-{
- LL_INFOS() << "Sending request '" << request << "', '"
- << parameter << "' to " << host << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GodlikeMessage");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", request);
- msg->addUUID("Invoice", LLUUID::null);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", parameter);
- msg->sendReliable(host);
+void LLPanelRequestTools::sendRequest(const std::string& request,
+ const std::string& parameter,
+ const LLHost& host)
+{
+ LL_INFOS() << "Sending request '" << request << "', '"
+ << parameter << "' to " << host << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GodlikeMessage");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ msg->nextBlock("MethodData");
+ msg->addString("Method", request);
+ msg->addUUID("Invoice", LLUUID::null);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", parameter);
+ msg->sendReliable(host);
}
void LLPanelRequestTools::onClickRequest()
{
- const std::string dest = getChild<LLUICtrl>("destination")->getValue().asString();
- if(dest == SELECTION)
- {
- std::string req =getChild<LLUICtrl>("request")->getValue();
- req = req.substr(0, req.find_first_of(" "));
- std::string param = getChild<LLUICtrl>("parameter")->getValue();
- LLSelectMgr::getInstance()->sendGodlikeRequest(req, param);
- }
- else if(dest == AGENT_REGION)
- {
- sendRequest(gAgent.getRegionHost());
- }
- else
- {
- // find region by name
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if(dest == regionp->getName())
- {
- // found it
- sendRequest(regionp->getHost());
- }
- }
- }
+ const std::string dest = getChild<LLUICtrl>("destination")->getValue().asString();
+ if(dest == SELECTION)
+ {
+ std::string req =getChild<LLUICtrl>("request")->getValue();
+ req = req.substr(0, req.find_first_of(" "));
+ std::string param = getChild<LLUICtrl>("parameter")->getValue();
+ LLSelectMgr::getInstance()->sendGodlikeRequest(req, param);
+ }
+ else if(dest == AGENT_REGION)
+ {
+ sendRequest(gAgent.getRegionHost());
+ }
+ else
+ {
+ // find region by name
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if(dest == regionp->getName())
+ {
+ // found it
+ sendRequest(regionp->getHost());
+ }
+ }
+ }
}
void terrain_download_done(void** data, S32 status, LLExtStat ext_status)
{
- LLNotificationsUtil::add("TerrainDownloaded");
+ LLNotificationsUtil::add("TerrainDownloaded");
}
void test_callback(const LLTSCode status)
{
- LL_INFOS() << "Test transfer callback returned!" << LL_ENDL;
+ LL_INFOS() << "Test transfer callback returned!" << LL_ENDL;
}
void LLPanelRequestTools::sendRequest(const LLHost& host)
{
- // intercept viewer local actions here
- std::string req = getChild<LLUICtrl>("request")->getValue();
- if (req == "terrain download")
- {
- gXferManager->requestFile(std::string("terrain.raw"), std::string("terrain.raw"), LL_PATH_NONE,
- host,
- FALSE,
- terrain_download_done,
- NULL);
- }
- else
- {
- req = req.substr(0, req.find_first_of(" "));
- sendRequest(req, getChild<LLUICtrl>("parameter")->getValue().asString(), host);
- }
+ // intercept viewer local actions here
+ std::string req = getChild<LLUICtrl>("request")->getValue();
+ if (req == "terrain download")
+ {
+ gXferManager->requestFile(std::string("terrain.raw"), std::string("terrain.raw"), LL_PATH_NONE,
+ host,
+ FALSE,
+ terrain_download_done,
+ NULL);
+ }
+ else
+ {
+ req = req.substr(0, req.find_first_of(" "));
+ sendRequest(req, getChild<LLUICtrl>("parameter")->getValue().asString(), host);
+ }
}
// Flags are SWD_ flags.
void send_sim_wide_deletes(const LLUUID& owner_id, U32 flags)
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_SimWideDeletes);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_DataBlock);
- msg->addUUIDFast(_PREHASH_TargetID, owner_id);
- msg->addU32Fast(_PREHASH_Flags, flags);
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_SimWideDeletes);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_DataBlock);
+ msg->addUUIDFast(_PREHASH_TargetID, owner_id);
+ msg->addU32Fast(_PREHASH_Flags, flags);
+ gAgent.sendReliableMessage();
}
diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h
index cbaeee7051..3bf5f15b89 100644
--- a/indra/newview/llfloatergodtools.h
+++ b/indra/newview/llfloatergodtools.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergodtools.h
* @brief The on-screen rectangle with tool options.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,67 +52,67 @@ class LLTextBox;
class LLMessageSystem;
class LLFloaterGodTools
- : public LLFloater
+ : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- enum EGodPanel
- {
- PANEL_GRID,
- PANEL_REGION,
- PANEL_OBJECT,
- PANEL_REQUEST,
- PANEL_COUNT
- };
+ enum EGodPanel
+ {
+ PANEL_GRID,
+ PANEL_REGION,
+ PANEL_OBJECT,
+ PANEL_REQUEST,
+ PANEL_COUNT
+ };
- static void* createPanelGrid(void *userdata);
- static void* createPanelRegion(void *userdata);
- static void* createPanelObjects(void *userdata);
- static void* createPanelRequest(void *userdata);
+ static void* createPanelGrid(void *userdata);
+ static void* createPanelRegion(void *userdata);
+ static void* createPanelObjects(void *userdata);
+ static void* createPanelRequest(void *userdata);
- static void refreshAll();
+ static void refreshAll();
- void showPanel(const std::string& panel_name);
+ void showPanel(const std::string& panel_name);
- virtual void onOpen(const LLSD& key);
+ virtual void onOpen(const LLSD& key);
- virtual void draw();
+ virtual void draw();
- // call this once per frame to handle visibility, rect location,
- // button highlights, etc.
- void updatePopup(LLCoordGL center, MASK mask);
+ // call this once per frame to handle visibility, rect location,
+ // button highlights, etc.
+ void updatePopup(LLCoordGL center, MASK mask);
- // Get data to populate UI.
- void sendRegionInfoRequest();
+ // Get data to populate UI.
+ void sendRegionInfoRequest();
- // get and process region info if necessary.
- static void processRegionInfo(LLMessageSystem* msg);
+ // get and process region info if necessary.
+ static void processRegionInfo(LLMessageSystem* msg);
- // Send possibly changed values to simulator.
- void sendGodUpdateRegionInfo();
+ // Send possibly changed values to simulator.
+ void sendGodUpdateRegionInfo();
private:
-
- LLFloaterGodTools(const LLSD& key);
- ~LLFloaterGodTools();
-
+
+ LLFloaterGodTools(const LLSD& key);
+ ~LLFloaterGodTools();
+
protected:
- U64 computeRegionFlags() const;
+ U64 computeRegionFlags() const;
protected:
- /*virtual*/ BOOL postBuild();
- // When the floater is going away, reset any options that need to be
- // cleared.
- void resetToolState();
+ /*virtual*/ BOOL postBuild();
+ // When the floater is going away, reset any options that need to be
+ // cleared.
+ void resetToolState();
public:
- LLPanelRegionTools *mPanelRegionTools;
- LLPanelObjectTools *mPanelObjectTools;
+ LLPanelRegionTools *mPanelRegionTools;
+ LLPanelObjectTools *mPanelObjectTools;
- LLHost mCurrentHost;
- LLFrameTimer mUpdateTimer;
+ LLHost mCurrentHost;
+ LLFrameTimer mUpdateTimer;
};
@@ -120,61 +120,61 @@ public:
// LLPanelRegionTools
//-----------------------------------------------------------------------------
-class LLPanelRegionTools
+class LLPanelRegionTools
: public LLPanel
{
public:
- LLPanelRegionTools();
- /*virtual*/ ~LLPanelRegionTools();
-
- BOOL postBuild();
-
- /*virtual*/ void refresh();
-
- static void onSaveState(void* userdata);
- static void onChangeSimName(LLLineEditor* caller, void* userdata);
-
- void onChangeAnything();
- void onChangePrelude();
- void onApplyChanges();
- void onBakeTerrain();
- void onRevertTerrain();
- void onSwapTerrain();
- void onSelectRegion();
- void onRefresh();
-
- // set internal checkboxes/spinners/combos
- const std::string getSimName() const;
- U32 getEstateID() const;
- U32 getParentEstateID() const;
- U64 getRegionFlags() const;
- U64 getRegionFlagsMask() const;
- F32 getBillableFactor() const;
- S32 getPricePerMeter() const;
- S32 getGridPosX() const;
- S32 getGridPosY() const;
- S32 getRedirectGridX() const;
- S32 getRedirectGridY() const;
-
- // set internal checkboxes/spinners/combos
- void setSimName(const std::string& name);
- void setEstateID(U32 id);
- void setParentEstateID(U32 id);
- void setCheckFlags(U64 flags);
- void setBillableFactor(F32 billable_factor);
- void setPricePerMeter(S32 price);
- void setGridPosX(S32 pos);
- void setGridPosY(S32 pos);
- void setRedirectGridX(S32 pos);
- void setRedirectGridY(S32 pos);
-
- U64 computeRegionFlags(U64 initial_flags) const;
- void clearAllWidgets();
- void enableAllWidgets();
+ LLPanelRegionTools();
+ /*virtual*/ ~LLPanelRegionTools();
+
+ BOOL postBuild();
+
+ /*virtual*/ void refresh();
+
+ static void onSaveState(void* userdata);
+ static void onChangeSimName(LLLineEditor* caller, void* userdata);
+
+ void onChangeAnything();
+ void onChangePrelude();
+ void onApplyChanges();
+ void onBakeTerrain();
+ void onRevertTerrain();
+ void onSwapTerrain();
+ void onSelectRegion();
+ void onRefresh();
+
+ // set internal checkboxes/spinners/combos
+ const std::string getSimName() const;
+ U32 getEstateID() const;
+ U32 getParentEstateID() const;
+ U64 getRegionFlags() const;
+ U64 getRegionFlagsMask() const;
+ F32 getBillableFactor() const;
+ S32 getPricePerMeter() const;
+ S32 getGridPosX() const;
+ S32 getGridPosY() const;
+ S32 getRedirectGridX() const;
+ S32 getRedirectGridY() const;
+
+ // set internal checkboxes/spinners/combos
+ void setSimName(const std::string& name);
+ void setEstateID(U32 id);
+ void setParentEstateID(U32 id);
+ void setCheckFlags(U64 flags);
+ void setBillableFactor(F32 billable_factor);
+ void setPricePerMeter(S32 price);
+ void setGridPosX(S32 pos);
+ void setGridPosY(S32 pos);
+ void setRedirectGridX(S32 pos);
+ void setRedirectGridY(S32 pos);
+
+ U64 computeRegionFlags(U64 initial_flags) const;
+ void clearAllWidgets();
+ void enableAllWidgets();
protected:
- // gets from internal checkboxes/spinners/combos
- void updateCurrentRegion() const;
+ // gets from internal checkboxes/spinners/combos
+ void updateCurrentRegion() const;
};
@@ -186,19 +186,19 @@ class LLPanelGridTools
: public LLPanel
{
public:
- LLPanelGridTools();
- virtual ~LLPanelGridTools();
+ LLPanelGridTools();
+ virtual ~LLPanelGridTools();
- BOOL postBuild();
+ BOOL postBuild();
- void refresh();
+ void refresh();
- static void onDragSunPhase(LLUICtrl *ctrl, void *userdata);
- void onClickFlushMapVisibilityCaches();
- static bool flushMapVisibilityCachesConfirm(const LLSD& notification, const LLSD& response);
+ static void onDragSunPhase(LLUICtrl *ctrl, void *userdata);
+ void onClickFlushMapVisibilityCaches();
+ static bool flushMapVisibilityCachesConfirm(const LLSD& notification, const LLSD& response);
protected:
- std::string mKickMessage; // Message to send on kick
+ std::string mKickMessage; // Message to send on kick
};
@@ -206,42 +206,42 @@ protected:
// LLPanelObjectTools
//-----------------------------------------------------------------------------
-class LLPanelObjectTools
+class LLPanelObjectTools
: public LLPanel
{
public:
- LLPanelObjectTools();
- /*virtual*/ ~LLPanelObjectTools();
-
- BOOL postBuild();
-
- /*virtual*/ void refresh();
-
- void setTargetAvatar(const LLUUID& target_id);
- U64 computeRegionFlags(U64 initial_flags) const;
- void clearAllWidgets();
- void enableAllWidgets();
- void setCheckFlags(U64 flags);
-
- void onChangeAnything();
- void onApplyChanges();
- void onClickSet();
- void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
- void onClickDeletePublicOwnedBy();
- void onClickDeleteAllScriptedOwnedBy();
- void onClickDeleteAllOwnedBy();
- static bool callbackSimWideDeletes(const LLSD& notification, const LLSD& response);
- void onGetTopColliders();
- void onGetTopScripts();
- void onGetScriptDigest();
- static void onClickSetBySelection(void* data);
+ LLPanelObjectTools();
+ /*virtual*/ ~LLPanelObjectTools();
+
+ BOOL postBuild();
+
+ /*virtual*/ void refresh();
+
+ void setTargetAvatar(const LLUUID& target_id);
+ U64 computeRegionFlags(U64 initial_flags) const;
+ void clearAllWidgets();
+ void enableAllWidgets();
+ void setCheckFlags(U64 flags);
+
+ void onChangeAnything();
+ void onApplyChanges();
+ void onClickSet();
+ void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
+ void onClickDeletePublicOwnedBy();
+ void onClickDeleteAllScriptedOwnedBy();
+ void onClickDeleteAllOwnedBy();
+ static bool callbackSimWideDeletes(const LLSD& notification, const LLSD& response);
+ void onGetTopColliders();
+ void onGetTopScripts();
+ void onGetScriptDigest();
+ static void onClickSetBySelection(void* data);
protected:
- LLUUID mTargetAvatar;
+ LLUUID mTargetAvatar;
- // For all delete dialogs, store flags here for message.
- U32 mSimWideDeletesFlags;
-};
+ // For all delete dialogs, store flags here for message.
+ U32 mSimWideDeletesFlags;
+};
//-----------------------------------------------------------------------------
@@ -251,20 +251,20 @@ protected:
class LLPanelRequestTools : public LLPanel
{
public:
- LLPanelRequestTools();
- /*virtual*/ ~LLPanelRequestTools();
+ LLPanelRequestTools();
+ /*virtual*/ ~LLPanelRequestTools();
- BOOL postBuild();
+ BOOL postBuild();
- void refresh();
+ void refresh();
- static void sendRequest(const std::string& request,
- const std::string& parameter,
- const LLHost& host);
+ static void sendRequest(const std::string& request,
+ const std::string& parameter,
+ const LLHost& host);
protected:
- void onClickRequest();
- void sendRequest(const LLHost& host);
+ void onClickRequest();
+ void sendRequest(const LLHost& host);
};
// Flags are SWD_ flags.
diff --git a/indra/newview/llfloatergotoline.cpp b/indra/newview/llfloatergotoline.cpp
index 3b34f03532..005a7b3d4a 100644
--- a/indra/newview/llfloatergotoline.cpp
+++ b/indra/newview/llfloatergotoline.cpp
@@ -43,7 +43,7 @@ LLFloaterGotoLine::LLFloaterGotoLine(LLScriptEdCore* editor_core)
buildFromFile("floater_goto_line.xml");
sInstance = this;
-
+
// find floater in which script panel is embedded
LLView* viewp = (LLView*)editor_core;
while(viewp)
@@ -60,9 +60,9 @@ LLFloaterGotoLine::LLFloaterGotoLine(LLScriptEdCore* editor_core)
BOOL LLFloaterGotoLine::postBuild()
{
- mGotoBox = getChild<LLLineEditor>("goto_line");
- mGotoBox->setCommitCallback(boost::bind(&LLFloaterGotoLine::onGotoBoxCommit, this));
- mGotoBox->setCommitOnFocusLost(FALSE);
+ mGotoBox = getChild<LLLineEditor>("goto_line");
+ mGotoBox->setCommitCallback(boost::bind(&LLFloaterGotoLine::onGotoBoxCommit, this));
+ mGotoBox->setCommitOnFocusLost(FALSE);
getChild<LLLineEditor>("goto_line")->setPrevalidate(LLTextValidate::validateNonNegativeS32);
childSetAction("goto_btn", onBtnGoto,this);
setDefaultBtn("goto_btn");
@@ -70,7 +70,7 @@ BOOL LLFloaterGotoLine::postBuild()
return TRUE;
}
-//static
+//static
void LLFloaterGotoLine::show(LLScriptEdCore* editor_core)
{
if (sInstance && sInstance->mEditorCore && sInstance->mEditorCore != editor_core)
@@ -93,7 +93,7 @@ LLFloaterGotoLine::~LLFloaterGotoLine()
sInstance = NULL;
}
-// static
+// static
void LLFloaterGotoLine::onBtnGoto(void *userdata)
{
LLFloaterGotoLine* self = (LLFloaterGotoLine*)userdata;
@@ -109,9 +109,9 @@ void LLFloaterGotoLine::handleBtnGoto()
{
if (mEditorCore && mEditorCore->mEditor)
{
- mEditorCore->mEditor->deselect();
- mEditorCore->mEditor->setCursor(row, column);
- mEditorCore->mEditor->setFocus(TRUE);
+ mEditorCore->mEditor->deselect();
+ mEditorCore->mEditor->setCursor(row, column);
+ mEditorCore->mEditor->setFocus(TRUE);
}
}
}
@@ -144,17 +144,17 @@ void LLFloaterGotoLine::onGotoBoxCommit()
{
if (mEditorCore && mEditorCore->mEditor)
{
- mEditorCore->mEditor->setCursor(row, column);
-
- S32 rownew = 0;
- S32 columnnew = 0;
- mEditorCore->mEditor->getCurrentLineAndColumn( &rownew, &columnnew, FALSE ); // don't include wordwrap
- if (rownew == row && columnnew == column)
- {
- mEditorCore->mEditor->deselect();
- mEditorCore->mEditor->setFocus(TRUE);
- sInstance->closeFloater();
- } //else do nothing (if the cursor-position didn't change)
+ mEditorCore->mEditor->setCursor(row, column);
+
+ S32 rownew = 0;
+ S32 columnnew = 0;
+ mEditorCore->mEditor->getCurrentLineAndColumn( &rownew, &columnnew, FALSE ); // don't include wordwrap
+ if (rownew == row && columnnew == column)
+ {
+ mEditorCore->mEditor->deselect();
+ mEditorCore->mEditor->setFocus(TRUE);
+ sInstance->closeFloater();
+ } //else do nothing (if the cursor-position didn't change)
}
}
}
diff --git a/indra/newview/llfloatergotoline.h b/indra/newview/llfloatergotoline.h
index 058d601752..04618ba881 100644
--- a/indra/newview/llfloatergotoline.h
+++ b/indra/newview/llfloatergotoline.h
@@ -59,7 +59,7 @@ private:
static LLFloaterGotoLine* sInstance;
protected:
- LLLineEditor* mGotoBox;
+ LLLineEditor* mGotoBox;
void onGotoBoxCommit();
};
diff --git a/indra/newview/llfloatergridstatus.cpp b/indra/newview/llfloatergridstatus.cpp
index 9745e17bbb..cfb0f7c20b 100644
--- a/indra/newview/llfloatergridstatus.cpp
+++ b/indra/newview/llfloatergridstatus.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergridstatus.cpp
* @brief Grid status floater - uses an embedded web browser to show Grid status info
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2017, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llfloatergridstatus.h b/indra/newview/llfloatergridstatus.h
index 0c3deb7d4c..51fc397574 100644
--- a/indra/newview/llfloatergridstatus.h
+++ b/indra/newview/llfloatergridstatus.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergridstatus.h
* @brief Grid status floater - uses an embedded web browser to show Grid status info
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2017, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llfloatergroupbulkban.cpp b/indra/newview/llfloatergroupbulkban.cpp
index 44074047a7..f0d91fc89b 100644
--- a/indra/newview/llfloatergroupbulkban.cpp
+++ b/indra/newview/llfloatergroupbulkban.cpp
@@ -1,7 +1,7 @@
-/**
+/**
* @file llfloatergroupbulkban.cpp
* @brief Floater to ban Residents from a group.
-*
+*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
@@ -35,16 +35,16 @@
class LLFloaterGroupBulkBan::impl
{
public:
- impl(const LLUUID& group_id) : mGroupID(group_id), mBulkBanPanelp(NULL) {}
- ~impl() {}
+ impl(const LLUUID& group_id) : mGroupID(group_id), mBulkBanPanelp(NULL) {}
+ ~impl() {}
- static void closeFloater(void* data);
+ static void closeFloater(void* data);
public:
- LLUUID mGroupID;
- LLPanelGroupBulkBan* mBulkBanPanelp;
+ LLUUID mGroupID;
+ LLPanelGroupBulkBan* mBulkBanPanelp;
- static std::map<LLUUID, LLFloaterGroupBulkBan*> sInstances;
+ static std::map<LLUUID, LLFloaterGroupBulkBan*> sInstances;
};
//
@@ -54,81 +54,81 @@ std::map<LLUUID, LLFloaterGroupBulkBan*> LLFloaterGroupBulkBan::impl::sInstances
void LLFloaterGroupBulkBan::impl::closeFloater(void* data)
{
- LLFloaterGroupBulkBan* floaterp = (LLFloaterGroupBulkBan*)data;
- if(floaterp)
- floaterp->closeFloater();
+ LLFloaterGroupBulkBan* floaterp = (LLFloaterGroupBulkBan*)data;
+ if(floaterp)
+ floaterp->closeFloater();
}
//-----------------------------------------------------------------------------
// Implementation
//-----------------------------------------------------------------------------
LLFloaterGroupBulkBan::LLFloaterGroupBulkBan(const LLUUID& group_id/*=LLUUID::null*/)
- : LLFloater(group_id)
+ : LLFloater(group_id)
{
- S32 floater_header_size = getHeaderHeight();
- LLRect contents;
+ S32 floater_header_size = getHeaderHeight();
+ LLRect contents;
- mImpl = new impl(group_id);
- mImpl->mBulkBanPanelp = new LLPanelGroupBulkBan(group_id);
+ mImpl = new impl(group_id);
+ mImpl->mBulkBanPanelp = new LLPanelGroupBulkBan(group_id);
- contents = mImpl->mBulkBanPanelp->getRect();
- contents.mTop -= floater_header_size;
+ contents = mImpl->mBulkBanPanelp->getRect();
+ contents.mTop -= floater_header_size;
- setTitle(mImpl->mBulkBanPanelp->getString("GroupBulkBan"));
- mImpl->mBulkBanPanelp->setCloseCallback(impl::closeFloater, this);
- mImpl->mBulkBanPanelp->setRect(contents);
+ setTitle(mImpl->mBulkBanPanelp->getString("GroupBulkBan"));
+ mImpl->mBulkBanPanelp->setCloseCallback(impl::closeFloater, this);
+ mImpl->mBulkBanPanelp->setRect(contents);
- addChild(mImpl->mBulkBanPanelp);
+ addChild(mImpl->mBulkBanPanelp);
}
LLFloaterGroupBulkBan::~LLFloaterGroupBulkBan()
{
- if(mImpl->mGroupID.notNull())
- {
- impl::sInstances.erase(mImpl->mGroupID);
- }
+ if(mImpl->mGroupID.notNull())
+ {
+ impl::sInstances.erase(mImpl->mGroupID);
+ }
- delete mImpl->mBulkBanPanelp;
- delete mImpl;
+ delete mImpl->mBulkBanPanelp;
+ delete mImpl;
}
void LLFloaterGroupBulkBan::showForGroup(const LLUUID& group_id, uuid_vec_t* agent_ids)
{
- const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
- S32 floater_header_size = floater_params.header_height;
- LLRect contents;
-
- // Make sure group_id isn't null
- if (group_id.isNull())
- {
- LL_WARNS() << "LLFloaterGroupInvite::showForGroup with null group_id!" << LL_ENDL;
- return;
- }
-
- // If we don't have a floater for this group, create one.
- LLFloaterGroupBulkBan* fgb = get_if_there(impl::sInstances,
- group_id,
- (LLFloaterGroupBulkBan*)NULL);
- if (!fgb)
- {
- fgb = new LLFloaterGroupBulkBan(group_id);
- contents = fgb->mImpl->mBulkBanPanelp->getRect();
- contents.mTop += floater_header_size;
- fgb->setRect(contents);
- fgb->getDragHandle()->setRect(contents);
- fgb->getDragHandle()->setTitle(fgb->mImpl->mBulkBanPanelp->getString("GroupBulkBan"));
-
- impl::sInstances[group_id] = fgb;
-
- fgb->mImpl->mBulkBanPanelp->clear();
- }
-
- if (agent_ids != NULL)
- {
- fgb->mImpl->mBulkBanPanelp->addUsers(*agent_ids);
- }
-
- fgb->center();
- fgb->openFloater();
- fgb->mImpl->mBulkBanPanelp->update();
+ const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
+ S32 floater_header_size = floater_params.header_height;
+ LLRect contents;
+
+ // Make sure group_id isn't null
+ if (group_id.isNull())
+ {
+ LL_WARNS() << "LLFloaterGroupInvite::showForGroup with null group_id!" << LL_ENDL;
+ return;
+ }
+
+ // If we don't have a floater for this group, create one.
+ LLFloaterGroupBulkBan* fgb = get_if_there(impl::sInstances,
+ group_id,
+ (LLFloaterGroupBulkBan*)NULL);
+ if (!fgb)
+ {
+ fgb = new LLFloaterGroupBulkBan(group_id);
+ contents = fgb->mImpl->mBulkBanPanelp->getRect();
+ contents.mTop += floater_header_size;
+ fgb->setRect(contents);
+ fgb->getDragHandle()->setRect(contents);
+ fgb->getDragHandle()->setTitle(fgb->mImpl->mBulkBanPanelp->getString("GroupBulkBan"));
+
+ impl::sInstances[group_id] = fgb;
+
+ fgb->mImpl->mBulkBanPanelp->clear();
+ }
+
+ if (agent_ids != NULL)
+ {
+ fgb->mImpl->mBulkBanPanelp->addUsers(*agent_ids);
+ }
+
+ fgb->center();
+ fgb->openFloater();
+ fgb->mImpl->mBulkBanPanelp->update();
}
diff --git a/indra/newview/llfloatergroupbulkban.h b/indra/newview/llfloatergroupbulkban.h
index 5b680a1ba4..2a2cced03b 100644
--- a/indra/newview/llfloatergroupbulkban.h
+++ b/indra/newview/llfloatergroupbulkban.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatergroupbulkban.h
* @brief This floater is a wrapper for LLPanelGroupBulkBan, which
* is used to ban Residents from a specific group.
@@ -34,15 +34,15 @@
class LLFloaterGroupBulkBan : public LLFloater
{
public:
- virtual ~LLFloaterGroupBulkBan();
+ virtual ~LLFloaterGroupBulkBan();
- static void showForGroup(const LLUUID& group_id, uuid_vec_t* agent_ids = NULL);
+ static void showForGroup(const LLUUID& group_id, uuid_vec_t* agent_ids = NULL);
protected:
- LLFloaterGroupBulkBan(const LLUUID& group_id = LLUUID::null);
+ LLFloaterGroupBulkBan(const LLUUID& group_id = LLUUID::null);
- class impl;
- impl* mImpl;
+ class impl;
+ impl* mImpl;
};
#endif // LL_LLFLOATERGROUPBULKBAN_H
diff --git a/indra/newview/llfloatergroupinvite.cpp b/indra/newview/llfloatergroupinvite.cpp
index 30c90ac184..78a5b4376f 100644
--- a/indra/newview/llfloatergroupinvite.cpp
+++ b/indra/newview/llfloatergroupinvite.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergroupinvite.cpp
* @brief Floater to invite new members into a group.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,16 +36,16 @@
class LLFloaterGroupInvite::impl
{
public:
- impl(const LLUUID& group_id);
- ~impl();
+ impl(const LLUUID& group_id);
+ ~impl();
- static void closeFloater(void* data);
+ static void closeFloater(void* data);
public:
- LLUUID mGroupID;
- LLPanelGroupInvite* mInvitePanelp;
+ LLUUID mGroupID;
+ LLPanelGroupInvite* mInvitePanelp;
- static std::map<LLUUID, LLFloaterGroupInvite*> sInstances;
+ static std::map<LLUUID, LLFloaterGroupInvite*> sInstances;
};
//
@@ -54,8 +54,8 @@ public:
std::map<LLUUID, LLFloaterGroupInvite*> LLFloaterGroupInvite::impl::sInstances;
LLFloaterGroupInvite::impl::impl(const LLUUID& group_id) :
- mGroupID(group_id),
- mInvitePanelp(NULL)
+ mGroupID(group_id),
+ mInvitePanelp(NULL)
{
}
@@ -66,94 +66,94 @@ LLFloaterGroupInvite::impl::~impl()
//static
void LLFloaterGroupInvite::impl::closeFloater(void* data)
{
- LLFloaterGroupInvite* floaterp = (LLFloaterGroupInvite*) data;
+ LLFloaterGroupInvite* floaterp = (LLFloaterGroupInvite*) data;
- if ( floaterp ) floaterp->closeFloater();
+ if ( floaterp ) floaterp->closeFloater();
}
//-----------------------------------------------------------------------------
// Implementation
//-----------------------------------------------------------------------------
LLFloaterGroupInvite::LLFloaterGroupInvite(const LLUUID& group_id)
-: LLFloater(group_id)
+: LLFloater(group_id)
{
- S32 floater_header_size = getHeaderHeight();
- LLRect contents;
+ S32 floater_header_size = getHeaderHeight();
+ LLRect contents;
- mImpl = new impl(group_id);
+ mImpl = new impl(group_id);
- mImpl->mInvitePanelp = new LLPanelGroupInvite(group_id);
+ mImpl->mInvitePanelp = new LLPanelGroupInvite(group_id);
- contents = mImpl->mInvitePanelp->getRect();
- contents.mTop -= floater_header_size;
+ contents = mImpl->mInvitePanelp->getRect();
+ contents.mTop -= floater_header_size;
- setTitle (mImpl->mInvitePanelp->getString("GroupInvitation"));
+ setTitle (mImpl->mInvitePanelp->getString("GroupInvitation"));
- mImpl->mInvitePanelp->setCloseCallback(impl::closeFloater, this);
+ mImpl->mInvitePanelp->setCloseCallback(impl::closeFloater, this);
- mImpl->mInvitePanelp->setRect(contents);
- addChild(mImpl->mInvitePanelp);
+ mImpl->mInvitePanelp->setRect(contents);
+ addChild(mImpl->mInvitePanelp);
}
// virtual
LLFloaterGroupInvite::~LLFloaterGroupInvite()
{
- if (mImpl->mGroupID.notNull())
- {
- impl::sInstances.erase(mImpl->mGroupID);
- }
+ if (mImpl->mGroupID.notNull())
+ {
+ impl::sInstances.erase(mImpl->mGroupID);
+ }
- delete mImpl->mInvitePanelp;
- delete mImpl;
+ delete mImpl->mInvitePanelp;
+ delete mImpl;
}
// static
void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, uuid_vec_t *agent_ids, bool request_update)
{
- const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
- S32 floater_header_size = floater_params.header_height;
- LLRect contents;
-
- // Make sure group_id isn't null
- if (group_id.isNull())
- {
- LL_WARNS() << "LLFloaterGroupInvite::showForGroup with null group_id!" << LL_ENDL;
- return;
- }
-
- // If we don't have a floater for this group, create one.
- LLFloaterGroupInvite *fgi = get_if_there(impl::sInstances,
- group_id,
- (LLFloaterGroupInvite*)NULL);
-
- if (request_update)
- {
- // refresh group information
- gAgent.sendAgentDataUpdateRequest();
- LLGroupMgr::getInstance()->clearGroupData(group_id);
- }
-
-
- if (!fgi)
- {
- fgi = new LLFloaterGroupInvite(group_id);
- contents = fgi->mImpl->mInvitePanelp->getRect();
- contents.mTop += floater_header_size;
- fgi->setRect(contents);
- fgi->getDragHandle()->setRect(contents);
- fgi->getDragHandle()->setTitle(fgi->mImpl->mInvitePanelp->getString("GroupInvitation"));
-
- impl::sInstances[group_id] = fgi;
-
- fgi->mImpl->mInvitePanelp->clear();
- }
-
- if (agent_ids != NULL)
- {
- fgi->mImpl->mInvitePanelp->addUsers(*agent_ids);
- }
-
- fgi->center();
- fgi->openFloater();
- fgi->mImpl->mInvitePanelp->update();
+ const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
+ S32 floater_header_size = floater_params.header_height;
+ LLRect contents;
+
+ // Make sure group_id isn't null
+ if (group_id.isNull())
+ {
+ LL_WARNS() << "LLFloaterGroupInvite::showForGroup with null group_id!" << LL_ENDL;
+ return;
+ }
+
+ // If we don't have a floater for this group, create one.
+ LLFloaterGroupInvite *fgi = get_if_there(impl::sInstances,
+ group_id,
+ (LLFloaterGroupInvite*)NULL);
+
+ if (request_update)
+ {
+ // refresh group information
+ gAgent.sendAgentDataUpdateRequest();
+ LLGroupMgr::getInstance()->clearGroupData(group_id);
+ }
+
+
+ if (!fgi)
+ {
+ fgi = new LLFloaterGroupInvite(group_id);
+ contents = fgi->mImpl->mInvitePanelp->getRect();
+ contents.mTop += floater_header_size;
+ fgi->setRect(contents);
+ fgi->getDragHandle()->setRect(contents);
+ fgi->getDragHandle()->setTitle(fgi->mImpl->mInvitePanelp->getString("GroupInvitation"));
+
+ impl::sInstances[group_id] = fgi;
+
+ fgi->mImpl->mInvitePanelp->clear();
+ }
+
+ if (agent_ids != NULL)
+ {
+ fgi->mImpl->mInvitePanelp->addUsers(*agent_ids);
+ }
+
+ fgi->center();
+ fgi->openFloater();
+ fgi->mImpl->mInvitePanelp->update();
}
diff --git a/indra/newview/llfloatergroupinvite.h b/indra/newview/llfloatergroupinvite.h
index 657e5711f0..f898816881 100644
--- a/indra/newview/llfloatergroupinvite.h
+++ b/indra/newview/llfloatergroupinvite.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatergroupinvite.h
* @brief This floater is just a wrapper for LLPanelGroupInvite, which
* is used to invite members to a specific group
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,15 +35,15 @@ class LLFloaterGroupInvite
: public LLFloater
{
public:
- virtual ~LLFloaterGroupInvite();
+ virtual ~LLFloaterGroupInvite();
- static void showForGroup(const LLUUID &group_id, uuid_vec_t *agent_ids = NULL, bool request_update = true);
+ static void showForGroup(const LLUUID &group_id, uuid_vec_t *agent_ids = NULL, bool request_update = true);
protected:
- LLFloaterGroupInvite(const LLUUID& group_id = LLUUID::null);
+ LLFloaterGroupInvite(const LLUUID& group_id = LLUUID::null);
- class impl;
- impl* mImpl;
+ class impl;
+ impl* mImpl;
};
#endif
diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp
index f341e2ebcb..0444927d07 100644
--- a/indra/newview/llfloatergroups.cpp
+++ b/indra/newview/llfloatergroups.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergroups.cpp
* @brief LLPanelGroups class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
/*
* Shown from Edit -> Groups...
* Shows the agent's groups and allows the edit window to be invoked.
- * Also overloaded to allow picking of a single group for assigning
+ * Also overloaded to allow picking of a single group for assigning
* objects and land to groups.
*/
@@ -57,11 +57,11 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow
///----------------------------------------------------------------------------
LLFloaterGroupPicker::LLFloaterGroupPicker(const LLSD& seed)
-: LLFloater(seed),
- mPowersMask(GP_ALL_POWERS),
- mID(seed.asUUID())
+: LLFloater(seed),
+ mPowersMask(GP_ALL_POWERS),
+ mID(seed.asUUID())
{
-// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_choose_group.xml");
+// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_choose_group.xml");
}
LLFloaterGroupPicker::~LLFloaterGroupPicker()
@@ -70,70 +70,70 @@ LLFloaterGroupPicker::~LLFloaterGroupPicker()
void LLFloaterGroupPicker::setPowersMask(U64 powers_mask)
{
- mPowersMask = powers_mask;
- init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID(), mPowersMask);
+ mPowersMask = powers_mask;
+ init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID(), mPowersMask);
}
BOOL LLFloaterGroupPicker::postBuild()
{
- LLScrollListCtrl* list_ctrl = getChild<LLScrollListCtrl>("group list");
- if (list_ctrl)
- {
- init_group_list(list_ctrl, gAgent.getGroupID(), mPowersMask);
- list_ctrl->setDoubleClickCallback(onBtnOK, this);
- list_ctrl->setContextMenu(LLScrollListCtrl::MENU_GROUP);
- }
-
- childSetAction("OK", onBtnOK, this);
+ LLScrollListCtrl* list_ctrl = getChild<LLScrollListCtrl>("group list");
+ if (list_ctrl)
+ {
+ init_group_list(list_ctrl, gAgent.getGroupID(), mPowersMask);
+ list_ctrl->setDoubleClickCallback(onBtnOK, this);
+ list_ctrl->setContextMenu(LLScrollListCtrl::MENU_GROUP);
+ }
+
+ childSetAction("OK", onBtnOK, this);
- childSetAction("Cancel", onBtnCancel, this);
+ childSetAction("Cancel", onBtnCancel, this);
- setDefaultBtn("OK");
+ setDefaultBtn("OK");
- getChildView("OK")->setEnabled(TRUE);
+ getChildView("OK")->setEnabled(TRUE);
- return TRUE;
+ return TRUE;
}
void LLFloaterGroupPicker::removeNoneOption()
{
- // Remove group "none" from list. Group "none" is added in init_group_list().
- // Some UI elements use group "none", we need to manually delete it here.
- // Group "none" ID is LLUUID:null.
- LLCtrlListInterface* group_list = getChild<LLScrollListCtrl>("group list")->getListInterface();
- if(group_list)
- {
- group_list->selectByValue(LLUUID::null);
- group_list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
- }
+ // Remove group "none" from list. Group "none" is added in init_group_list().
+ // Some UI elements use group "none", we need to manually delete it here.
+ // Group "none" ID is LLUUID:null.
+ LLCtrlListInterface* group_list = getChild<LLScrollListCtrl>("group list")->getListInterface();
+ if(group_list)
+ {
+ group_list->selectByValue(LLUUID::null);
+ group_list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
+ }
}
void LLFloaterGroupPicker::onBtnOK(void* userdata)
{
- LLFloaterGroupPicker* self = (LLFloaterGroupPicker*)userdata;
- if(self) self->ok();
+ LLFloaterGroupPicker* self = (LLFloaterGroupPicker*)userdata;
+ if(self) self->ok();
}
void LLFloaterGroupPicker::onBtnCancel(void* userdata)
{
- LLFloaterGroupPicker* self = (LLFloaterGroupPicker*)userdata;
- if(self) self->closeFloater();
+ LLFloaterGroupPicker* self = (LLFloaterGroupPicker*)userdata;
+ if(self) self->closeFloater();
}
void LLFloaterGroupPicker::ok()
{
- LLCtrlListInterface *group_list = childGetListInterface("group list");
- LLUUID group_id;
- if (group_list)
- {
- group_id = group_list->getCurrentID();
- }
- mGroupSelectSignal(group_id);
-
- closeFloater();
+ LLCtrlListInterface *group_list = childGetListInterface("group list");
+ LLUUID group_id;
+ if (group_list)
+ {
+ group_id = group_list->getCurrentID();
+ }
+ mGroupSelectSignal(group_id);
+
+ closeFloater();
}
///----------------------------------------------------------------------------
@@ -144,252 +144,252 @@ void LLFloaterGroupPicker::ok()
//virtual
bool LLPanelGroups::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- if (event->desc() == "new group")
- {
- reset();
- return true;
- }
- return false;
+ if (event->desc() == "new group")
+ {
+ reset();
+ return true;
+ }
+ return false;
}
// Default constructor
LLPanelGroups::LLPanelGroups() :
- LLPanel()
+ LLPanel()
{
- gAgent.addListener(this, "new group");
+ gAgent.addListener(this, "new group");
}
LLPanelGroups::~LLPanelGroups()
{
- gAgent.removeListener(this);
+ gAgent.removeListener(this);
}
// clear the group list, and get a fresh set of info.
void LLPanelGroups::reset()
{
- LLCtrlListInterface *group_list = childGetListInterface("group list");
- if (group_list)
- {
- group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
- }
- getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size()));
- getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit()));
-
- init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID());
- enableButtons();
+ LLCtrlListInterface *group_list = childGetListInterface("group list");
+ if (group_list)
+ {
+ group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+ }
+ getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size()));
+ getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit()));
+
+ init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID());
+ enableButtons();
}
BOOL LLPanelGroups::postBuild()
{
- childSetCommitCallback("group list", onGroupList, this);
+ childSetCommitCallback("group list", onGroupList, this);
- getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size()));
- getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit()));
+ getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size()));
+ getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit()));
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("group list");
- if (list)
- {
- init_group_list(list, gAgent.getGroupID());
- list->setDoubleClickCallback(onBtnIM, this);
- list->setContextMenu(LLScrollListCtrl::MENU_GROUP);
- }
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("group list");
+ if (list)
+ {
+ init_group_list(list, gAgent.getGroupID());
+ list->setDoubleClickCallback(onBtnIM, this);
+ list->setContextMenu(LLScrollListCtrl::MENU_GROUP);
+ }
- childSetAction("Activate", onBtnActivate, this);
+ childSetAction("Activate", onBtnActivate, this);
- childSetAction("Info", onBtnInfo, this);
+ childSetAction("Info", onBtnInfo, this);
- childSetAction("IM", onBtnIM, this);
+ childSetAction("IM", onBtnIM, this);
- childSetAction("Leave", onBtnLeave, this);
+ childSetAction("Leave", onBtnLeave, this);
- childSetAction("Create", onBtnCreate, this);
+ childSetAction("Create", onBtnCreate, this);
- childSetAction("Search...", onBtnSearch, this);
+ childSetAction("Search...", onBtnSearch, this);
- setDefaultBtn("IM");
+ setDefaultBtn("IM");
- reset();
+ reset();
- return TRUE;
+ return TRUE;
}
void LLPanelGroups::enableButtons()
{
- LLCtrlListInterface *group_list = childGetListInterface("group list");
- LLUUID group_id;
- if (group_list)
- {
- group_id = group_list->getCurrentID();
- }
-
- if(group_id != gAgent.getGroupID())
- {
- getChildView("Activate")->setEnabled(TRUE);
- }
- else
- {
- getChildView("Activate")->setEnabled(FALSE);
- }
- if (group_id.notNull())
- {
- getChildView("Info")->setEnabled(TRUE);
- getChildView("IM")->setEnabled(TRUE);
- getChildView("Leave")->setEnabled(TRUE);
- }
- else
- {
- getChildView("Info")->setEnabled(FALSE);
- getChildView("IM")->setEnabled(FALSE);
- getChildView("Leave")->setEnabled(FALSE);
- }
- getChildView("Create")->setEnabled(gAgent.canJoinGroups());
+ LLCtrlListInterface *group_list = childGetListInterface("group list");
+ LLUUID group_id;
+ if (group_list)
+ {
+ group_id = group_list->getCurrentID();
+ }
+
+ if(group_id != gAgent.getGroupID())
+ {
+ getChildView("Activate")->setEnabled(TRUE);
+ }
+ else
+ {
+ getChildView("Activate")->setEnabled(FALSE);
+ }
+ if (group_id.notNull())
+ {
+ getChildView("Info")->setEnabled(TRUE);
+ getChildView("IM")->setEnabled(TRUE);
+ getChildView("Leave")->setEnabled(TRUE);
+ }
+ else
+ {
+ getChildView("Info")->setEnabled(FALSE);
+ getChildView("IM")->setEnabled(FALSE);
+ getChildView("Leave")->setEnabled(FALSE);
+ }
+ getChildView("Create")->setEnabled(gAgent.canJoinGroups());
}
void LLPanelGroups::onBtnCreate(void* userdata)
{
- LLPanelGroups* self = (LLPanelGroups*)userdata;
- if(self) self->create();
+ LLPanelGroups* self = (LLPanelGroups*)userdata;
+ if(self) self->create();
}
void LLPanelGroups::onBtnActivate(void* userdata)
{
- LLPanelGroups* self = (LLPanelGroups*)userdata;
- if(self) self->activate();
+ LLPanelGroups* self = (LLPanelGroups*)userdata;
+ if(self) self->activate();
}
void LLPanelGroups::onBtnInfo(void* userdata)
{
- LLPanelGroups* self = (LLPanelGroups*)userdata;
- if(self) self->info();
+ LLPanelGroups* self = (LLPanelGroups*)userdata;
+ if(self) self->info();
}
void LLPanelGroups::onBtnIM(void* userdata)
{
- LLPanelGroups* self = (LLPanelGroups*)userdata;
- if(self) self->startIM();
+ LLPanelGroups* self = (LLPanelGroups*)userdata;
+ if(self) self->startIM();
}
void LLPanelGroups::onBtnLeave(void* userdata)
{
- LLPanelGroups* self = (LLPanelGroups*)userdata;
- if(self) self->leave();
+ LLPanelGroups* self = (LLPanelGroups*)userdata;
+ if(self) self->leave();
}
void LLPanelGroups::onBtnSearch(void* userdata)
{
- LLPanelGroups* self = (LLPanelGroups*)userdata;
- if(self) self->search();
+ LLPanelGroups* self = (LLPanelGroups*)userdata;
+ if(self) self->search();
}
void LLPanelGroups::create()
{
- LLGroupActions::createGroup();
+ LLGroupActions::createGroup();
}
void LLPanelGroups::activate()
{
- LLCtrlListInterface *group_list = childGetListInterface("group list");
- LLUUID group_id;
- if (group_list)
- {
- group_id = group_list->getCurrentID();
- }
- LLGroupActions::activate(group_id);
+ LLCtrlListInterface *group_list = childGetListInterface("group list");
+ LLUUID group_id;
+ if (group_list)
+ {
+ group_id = group_list->getCurrentID();
+ }
+ LLGroupActions::activate(group_id);
}
void LLPanelGroups::info()
{
- LLCtrlListInterface *group_list = childGetListInterface("group list");
- LLUUID group_id;
- if (group_list && (group_id = group_list->getCurrentID()).notNull())
- {
- LLGroupActions::show(group_id);
- }
+ LLCtrlListInterface *group_list = childGetListInterface("group list");
+ LLUUID group_id;
+ if (group_list && (group_id = group_list->getCurrentID()).notNull())
+ {
+ LLGroupActions::show(group_id);
+ }
}
void LLPanelGroups::startIM()
{
- LLCtrlListInterface *group_list = childGetListInterface("group list");
- LLUUID group_id;
+ LLCtrlListInterface *group_list = childGetListInterface("group list");
+ LLUUID group_id;
- if (group_list && (group_id = group_list->getCurrentID()).notNull())
- {
- LLGroupActions::startIM(group_id);
- }
+ if (group_list && (group_id = group_list->getCurrentID()).notNull())
+ {
+ LLGroupActions::startIM(group_id);
+ }
}
void LLPanelGroups::leave()
{
- LLCtrlListInterface *group_list = childGetListInterface("group list");
- LLUUID group_id;
- if (group_list && (group_id = group_list->getCurrentID()).notNull())
- {
- LLGroupActions::leave(group_id);
- }
+ LLCtrlListInterface *group_list = childGetListInterface("group list");
+ LLUUID group_id;
+ if (group_list && (group_id = group_list->getCurrentID()).notNull())
+ {
+ LLGroupActions::leave(group_id);
+ }
}
void LLPanelGroups::search()
{
- LLGroupActions::search();
+ LLGroupActions::search();
}
void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata)
{
- LLPanelGroups* self = (LLPanelGroups*)userdata;
- if(self) self->enableButtons();
+ LLPanelGroups* self = (LLPanelGroups*)userdata;
+ if(self) self->enableButtons();
}
void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U64 powers_mask)
{
- S32 count = gAgent.mGroups.size();
- LLUUID id;
- if (!group_list) return;
-
- group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
-
- for(S32 i = 0; i < count; ++i)
- {
- id = gAgent.mGroups.at(i).mID;
- LLGroupData* group_datap = &gAgent.mGroups.at(i);
- if ((powers_mask == GP_ALL_POWERS) || ((group_datap->mPowers & powers_mask) != 0))
- {
- std::string style = "NORMAL";
- if(highlight_id == id)
- {
- style = "BOLD";
- }
-
- LLSD element;
- element["id"] = id;
- element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = group_datap->mName;
- element["columns"][0]["font"]["name"] = "SANSSERIF";
- element["columns"][0]["font"]["style"] = style;
-
- group_list->addElement(element);
- }
- }
-
- group_list->sortOnce(0, TRUE);
-
- // add "none" to list at top
- {
- std::string style = "NORMAL";
- if (highlight_id.isNull())
- {
- style = "BOLD";
- }
- LLSD element;
- element["id"] = LLUUID::null;
- element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = LLTrans::getString("GroupsNone");
- element["columns"][0]["font"]["name"] = "SANSSERIF";
- element["columns"][0]["font"]["style"] = style;
-
- group_list->addElement(element, ADD_TOP);
- }
-
- group_list->selectByValue(highlight_id);
+ S32 count = gAgent.mGroups.size();
+ LLUUID id;
+ if (!group_list) return;
+
+ group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+
+ for(S32 i = 0; i < count; ++i)
+ {
+ id = gAgent.mGroups.at(i).mID;
+ LLGroupData* group_datap = &gAgent.mGroups.at(i);
+ if ((powers_mask == GP_ALL_POWERS) || ((group_datap->mPowers & powers_mask) != 0))
+ {
+ std::string style = "NORMAL";
+ if(highlight_id == id)
+ {
+ style = "BOLD";
+ }
+
+ LLSD element;
+ element["id"] = id;
+ element["columns"][0]["column"] = "name";
+ element["columns"][0]["value"] = group_datap->mName;
+ element["columns"][0]["font"]["name"] = "SANSSERIF";
+ element["columns"][0]["font"]["style"] = style;
+
+ group_list->addElement(element);
+ }
+ }
+
+ group_list->sortOnce(0, TRUE);
+
+ // add "none" to list at top
+ {
+ std::string style = "NORMAL";
+ if (highlight_id.isNull())
+ {
+ style = "BOLD";
+ }
+ LLSD element;
+ element["id"] = LLUUID::null;
+ element["columns"][0]["column"] = "name";
+ element["columns"][0]["value"] = LLTrans::getString("GroupsNone");
+ element["columns"][0]["font"]["name"] = "SANSSERIF";
+ element["columns"][0]["font"]["style"] = style;
+
+ group_list->addElement(element, ADD_TOP);
+ }
+
+ group_list->selectByValue(highlight_id);
}
diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h
index 1ad27cea19..1e3d7dd630 100644
--- a/indra/newview/llfloatergroups.h
+++ b/indra/newview/llfloatergroups.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergroups.h
* @brief LLFloaterGroups class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
/*
* Shown from Edit -> Groups...
* Shows the agent's groups and allows the edit window to be invoked.
- * Also overloaded to allow picking of a single group for assigning
+ * Also overloaded to allow picking of a single group for assigning
* objects and land to groups.
*/
@@ -53,74 +53,74 @@ class LLFloaterGroupPicker;
class LLFloaterGroupPicker : public LLFloater
{
public:
- LLFloaterGroupPicker(const LLSD& seed);
- ~LLFloaterGroupPicker();
-
- // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots
- typedef boost::signals2::signal<void (LLUUID id)> signal_t;
- void setSelectGroupCallback(const signal_t::slot_type& cb) { mGroupSelectSignal.connect(cb); }
- void setPowersMask(U64 powers_mask);
- BOOL postBuild();
-
- // implementation of factory policy
- static LLFloaterGroupPicker* findInstance(const LLSD& seed);
- static LLFloaterGroupPicker* createInstance(const LLSD& seed);
-
- // for cases like inviting avatar to group we don't want the none option
- void removeNoneOption();
+ LLFloaterGroupPicker(const LLSD& seed);
+ ~LLFloaterGroupPicker();
+
+ // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots
+ typedef boost::signals2::signal<void (LLUUID id)> signal_t;
+ void setSelectGroupCallback(const signal_t::slot_type& cb) { mGroupSelectSignal.connect(cb); }
+ void setPowersMask(U64 powers_mask);
+ BOOL postBuild();
+
+ // implementation of factory policy
+ static LLFloaterGroupPicker* findInstance(const LLSD& seed);
+ static LLFloaterGroupPicker* createInstance(const LLSD& seed);
+
+ // for cases like inviting avatar to group we don't want the none option
+ void removeNoneOption();
protected:
- void ok();
- static void onBtnOK(void* userdata);
- static void onBtnCancel(void* userdata);
+ void ok();
+ static void onBtnOK(void* userdata);
+ static void onBtnCancel(void* userdata);
protected:
- LLUUID mID;
- U64 mPowersMask;
- signal_t mGroupSelectSignal;
+ LLUUID mID;
+ U64 mPowersMask;
+ signal_t mGroupSelectSignal;
- typedef std::map<const LLUUID, LLFloaterGroupPicker*> instance_map_t;
- static instance_map_t sInstances;
+ typedef std::map<const LLUUID, LLFloaterGroupPicker*> instance_map_t;
+ static instance_map_t sInstances;
};
class LLPanelGroups : public LLPanel, public LLOldEvents::LLSimpleListener
{
public:
- LLPanelGroups();
- virtual ~LLPanelGroups();
+ LLPanelGroups();
+ virtual ~LLPanelGroups();
+
+ //LLEventListener
+ /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- //LLEventListener
- /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-
- // clear the group list, and get a fresh set of info.
- void reset();
+ // clear the group list, and get a fresh set of info.
+ void reset();
protected:
- // initialize based on the type
- BOOL postBuild();
-
- // highlight_id is a group id to highlight
- void enableButtons();
-
- static void onGroupList(LLUICtrl* ctrl, void* userdata);
- static void onBtnCreate(void* userdata);
- static void onBtnActivate(void* userdata);
- static void onBtnInfo(void* userdata);
- static void onBtnIM(void* userdata);
- static void onBtnLeave(void* userdata);
- static void onBtnSearch(void* userdata);
- static void onBtnVote(void* userdata);
- static void onDoubleClickGroup(void* userdata);
-
- void create();
- void activate();
- void info();
- void startIM();
- void leave();
- void search();
- void callVote();
-
- static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response);
+ // initialize based on the type
+ BOOL postBuild();
+
+ // highlight_id is a group id to highlight
+ void enableButtons();
+
+ static void onGroupList(LLUICtrl* ctrl, void* userdata);
+ static void onBtnCreate(void* userdata);
+ static void onBtnActivate(void* userdata);
+ static void onBtnInfo(void* userdata);
+ static void onBtnIM(void* userdata);
+ static void onBtnLeave(void* userdata);
+ static void onBtnSearch(void* userdata);
+ static void onBtnVote(void* userdata);
+ static void onDoubleClickGroup(void* userdata);
+
+ void create();
+ void activate();
+ void info();
+ void startIM();
+ void leave();
+ void search();
+ void callVote();
+
+ static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response);
};
diff --git a/indra/newview/llfloaterhandler.cpp b/indra/newview/llfloaterhandler.cpp
index b66049de7f..5823ad3e41 100644
--- a/indra/newview/llfloaterhandler.cpp
+++ b/indra/newview/llfloaterhandler.cpp
@@ -1,22 +1,22 @@
-/**
+/**
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,46 +34,46 @@ LLFloaterHandler gFloaterHandler;
LLFloater* get_parent_floater(LLView* view)
{
- LLFloater* floater = NULL;
- LLView* parent = view->getParent();
- while (parent)
- {
- floater = dynamic_cast<LLFloater*>(parent);
- if (floater)
- {
- break;
- }
- parent = parent->getParent();
- }
- return floater;
+ LLFloater* floater = NULL;
+ LLView* parent = view->getParent();
+ while (parent)
+ {
+ floater = dynamic_cast<LLFloater*>(parent);
+ if (floater)
+ {
+ break;
+ }
+ parent = parent->getParent();
+ }
+ return floater;
}
bool LLFloaterHandler::handle(const LLSD &params, const LLSD &query_map, const std::string& grid, LLMediaCtrl *web)
{
- if (params.size() < 1) return false;
- LLFloater* floater = NULL;
- // *TODO: implement floater lookup by name
+ if (params.size() < 1) return false;
+ LLFloater* floater = NULL;
+ // *TODO: implement floater lookup by name
- if (params[0].asString() == "destinations")
- {
- LLFloaterReg::toggleInstanceOrBringToFront("destinations");
- return true;
- }
- if (params[0].asString() == "self")
- {
- if (web)
- {
- floater = get_parent_floater(web);
- }
- }
- if (params[1].asString() == "close")
- {
- if (floater)
- {
- floater->closeFloater();
- return true;
- }
- }
- return false;
+ if (params[0].asString() == "destinations")
+ {
+ LLFloaterReg::toggleInstanceOrBringToFront("destinations");
+ return true;
+ }
+ if (params[0].asString() == "self")
+ {
+ if (web)
+ {
+ floater = get_parent_floater(web);
+ }
+ }
+ if (params[1].asString() == "close")
+ {
+ if (floater)
+ {
+ floater->closeFloater();
+ return true;
+ }
+ }
+ return false;
}
diff --git a/indra/newview/llfloaterhandler.h b/indra/newview/llfloaterhandler.h
index 959c972275..41e8d5269c 100644
--- a/indra/newview/llfloaterhandler.h
+++ b/indra/newview/llfloaterhandler.h
@@ -1,22 +1,22 @@
-/**
+/**
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,11 +29,11 @@
#include "llcommandhandler.h"
class LLFloaterHandler
-: public LLCommandHandler
+: public LLCommandHandler
{
public:
- LLFloaterHandler() : LLCommandHandler("floater", UNTRUSTED_BLOCK) { }
- bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web);
+ LLFloaterHandler() : LLCommandHandler("floater", UNTRUSTED_BLOCK) { }
+ bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web);
};
#endif
diff --git a/indra/newview/llfloaterhelpbrowser.cpp b/indra/newview/llfloaterhelpbrowser.cpp
index c0bb213540..f651342018 100644
--- a/indra/newview/llfloaterhelpbrowser.cpp
+++ b/indra/newview/llfloaterhelpbrowser.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterhelpbrowser.cpp
* @brief HTML Help floater - uses embedded web browser control
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,112 +43,112 @@
LLFloaterHelpBrowser::LLFloaterHelpBrowser(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
}
BOOL LLFloaterHelpBrowser::postBuild()
{
- mBrowser = getChild<LLMediaCtrl>("browser");
- mBrowser->addObserver(this);
- mBrowser->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
+ mBrowser = getChild<LLMediaCtrl>("browser");
+ mBrowser->addObserver(this);
+ mBrowser->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
- childSetAction("open_browser", onClickOpenWebBrowser, this);
+ childSetAction("open_browser", onClickOpenWebBrowser, this);
- buildURLHistory();
- return TRUE;
+ buildURLHistory();
+ return TRUE;
}
void LLFloaterHelpBrowser::buildURLHistory()
{
- // Get all of the entries in the "browser" collection
- LLSD browser_history = LLURLHistory::getURLHistory("browser");
-
- // initialize URL history in the plugin
- LLPluginClassMedia *plugin = mBrowser->getMediaPlugin();
- if (plugin)
- {
- plugin->initializeUrlHistory(browser_history);
- }
+ // Get all of the entries in the "browser" collection
+ LLSD browser_history = LLURLHistory::getURLHistory("browser");
+
+ // initialize URL history in the plugin
+ LLPluginClassMedia *plugin = mBrowser->getMediaPlugin();
+ if (plugin)
+ {
+ plugin->initializeUrlHistory(browser_history);
+ }
}
void LLFloaterHelpBrowser::onOpen(const LLSD& key)
{
- gSavedSettings.setBOOL("HelpFloaterOpen", TRUE);
+ gSavedSettings.setBOOL("HelpFloaterOpen", TRUE);
- std::string topic = key.asString();
- mBrowser->navigateTo(LLViewerHelp::instance().getURL(topic));
+ std::string topic = key.asString();
+ mBrowser->navigateTo(LLViewerHelp::instance().getURL(topic));
}
//virtual
void LLFloaterHelpBrowser::onClose(bool app_quitting)
{
- if (!app_quitting)
- {
- gSavedSettings.setBOOL("HelpFloaterOpen", FALSE);
- }
- // really really destroy the help browser when it's closed, it'll be recreated.
- destroy(); // really destroy this dialog on closure, it's relatively heavyweight.
+ if (!app_quitting)
+ {
+ gSavedSettings.setBOOL("HelpFloaterOpen", FALSE);
+ }
+ // really really destroy the help browser when it's closed, it'll be recreated.
+ destroy(); // really destroy this dialog on closure, it's relatively heavyweight.
}
void LLFloaterHelpBrowser::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
{
- switch (event)
- {
- case MEDIA_EVENT_LOCATION_CHANGED:
- setCurrentURL(self->getLocation());
- break;
-
- case MEDIA_EVENT_NAVIGATE_BEGIN:
- getChild<LLUICtrl>("status_text")->setValue(getString("loading_text"));
- break;
-
- case MEDIA_EVENT_NAVIGATE_COMPLETE:
- getChild<LLUICtrl>("status_text")->setValue(getString("done_text"));
- break;
-
- default:
- break;
- }
+ switch (event)
+ {
+ case MEDIA_EVENT_LOCATION_CHANGED:
+ setCurrentURL(self->getLocation());
+ break;
+
+ case MEDIA_EVENT_NAVIGATE_BEGIN:
+ getChild<LLUICtrl>("status_text")->setValue(getString("loading_text"));
+ break;
+
+ case MEDIA_EVENT_NAVIGATE_COMPLETE:
+ getChild<LLUICtrl>("status_text")->setValue(getString("done_text"));
+ break;
+
+ default:
+ break;
+ }
}
void LLFloaterHelpBrowser::setCurrentURL(const std::string& url)
{
- mCurrentURL = url;
-
- // redirects will navigate momentarily to about:blank, don't add to history
- if (mCurrentURL != "about:blank")
- {
- // Serialize url history
- LLURLHistory::removeURL("browser", mCurrentURL);
- LLURLHistory::addURL("browser", mCurrentURL);
- }
+ mCurrentURL = url;
+
+ // redirects will navigate momentarily to about:blank, don't add to history
+ if (mCurrentURL != "about:blank")
+ {
+ // Serialize url history
+ LLURLHistory::removeURL("browser", mCurrentURL);
+ LLURLHistory::addURL("browser", mCurrentURL);
+ }
}
-//static
+//static
void LLFloaterHelpBrowser::onClickClose(void* user_data)
{
- LLFloaterHelpBrowser* self = (LLFloaterHelpBrowser*)user_data;
+ LLFloaterHelpBrowser* self = (LLFloaterHelpBrowser*)user_data;
- self->closeFloater();
+ self->closeFloater();
}
-//static
+//static
void LLFloaterHelpBrowser::onClickOpenWebBrowser(void* user_data)
{
- LLFloaterHelpBrowser* self = (LLFloaterHelpBrowser*)user_data;
+ LLFloaterHelpBrowser* self = (LLFloaterHelpBrowser*)user_data;
- std::string url = self->mCurrentURL.empty() ?
- self->mBrowser->getHomePageUrl() :
- self->mCurrentURL;
- LLWeb::loadURLExternal(url);
+ std::string url = self->mCurrentURL.empty() ?
+ self->mBrowser->getHomePageUrl() :
+ self->mCurrentURL;
+ LLWeb::loadURLExternal(url);
}
void LLFloaterHelpBrowser::openMedia(const std::string& media_url)
{
- // explicitly make the media mime type for this floater since it will
- // only ever display one type of content (Web).
- mBrowser->setHomePageUrl(media_url, HTTP_CONTENT_TEXT_HTML);
- mBrowser->navigateTo(media_url, HTTP_CONTENT_TEXT_HTML);
- setCurrentURL(media_url);
+ // explicitly make the media mime type for this floater since it will
+ // only ever display one type of content (Web).
+ mBrowser->setHomePageUrl(media_url, HTTP_CONTENT_TEXT_HTML);
+ mBrowser->navigateTo(media_url, HTTP_CONTENT_TEXT_HTML);
+ setCurrentURL(media_url);
}
diff --git a/indra/newview/llfloaterhelpbrowser.h b/indra/newview/llfloaterhelpbrowser.h
index bf4f544a14..0dd944bf92 100644
--- a/indra/newview/llfloaterhelpbrowser.h
+++ b/indra/newview/llfloaterhelpbrowser.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterhelpbrowser.h
* @brief HTML Help floater - uses embedded web browser control
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,32 +33,32 @@
class LLMediaCtrl;
-class LLFloaterHelpBrowser :
- public LLFloater,
- public LLViewerMediaObserver
+class LLFloaterHelpBrowser :
+ public LLFloater,
+ public LLViewerMediaObserver
{
public:
- LLFloaterHelpBrowser(const LLSD& key);
+ LLFloaterHelpBrowser(const LLSD& key);
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onClose(bool app_quitting);
- /*virtual*/ void onOpen(const LLSD& key);
+ // inherited from LLViewerMediaObserver
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
- // inherited from LLViewerMediaObserver
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+ void openMedia(const std::string& media_url);
- void openMedia(const std::string& media_url);
-
private:
- void buildURLHistory();
- void setCurrentURL(const std::string& url);
+ void buildURLHistory();
+ void setCurrentURL(const std::string& url);
- static void onClickClose(void* user_data);
- static void onClickOpenWebBrowser(void* user_data);
+ static void onClickClose(void* user_data);
+ static void onClickOpenWebBrowser(void* user_data);
private:
- LLMediaCtrl* mBrowser;
- std::string mCurrentURL;
+ LLMediaCtrl* mBrowser;
+ std::string mCurrentURL;
};
#endif // LL_LLFLOATERHELPBROWSER_H
diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp
index a00fc4aa84..2d9bb61dc1 100644
--- a/indra/newview/llfloaterhoverheight.cpp
+++ b/indra/newview/llfloaterhoverheight.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterhoverheight.cpp
* @brief Controller for self avatar hover height
* @author vir@lindenlab.com
@@ -41,60 +41,60 @@ LLFloaterHoverHeight::LLFloaterHoverHeight(const LLSD& key) : LLFloater(key)
void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data, bool update_offset)
{
- F32 value = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ");
-
- LLFloaterHoverHeight *self = static_cast<LLFloaterHoverHeight*>(user_data);
- LLSliderCtrl* sldrCtrl = self->getChild<LLSliderCtrl>("HoverHeightSlider");
- sldrCtrl->setValue(value,FALSE);
-
- if (isAgentAvatarValid() && update_offset)
- {
- LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z));
- LL_INFOS("Avatar") << "setting hover from preference setting " << offset[2] << LL_ENDL;
- gAgentAvatarp->setHoverOffset(offset);
- //gAgentAvatarp->sendHoverHeight();
- }
+ F32 value = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ");
+
+ LLFloaterHoverHeight *self = static_cast<LLFloaterHoverHeight*>(user_data);
+ LLSliderCtrl* sldrCtrl = self->getChild<LLSliderCtrl>("HoverHeightSlider");
+ sldrCtrl->setValue(value,FALSE);
+
+ if (isAgentAvatarValid() && update_offset)
+ {
+ LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z));
+ LL_INFOS("Avatar") << "setting hover from preference setting " << offset[2] << LL_ENDL;
+ gAgentAvatarp->setHoverOffset(offset);
+ //gAgentAvatarp->sendHoverHeight();
+ }
}
BOOL LLFloaterHoverHeight::postBuild()
{
- LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
- sldrCtrl->setMinValue(MIN_HOVER_Z);
- sldrCtrl->setMaxValue(MAX_HOVER_Z);
- sldrCtrl->setSliderMouseUpCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this));
- sldrCtrl->setSliderEditorCommitCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this));
- childSetCommitCallback("HoverHeightSlider", &LLFloaterHoverHeight::onSliderMoved, NULL);
-
- // Initialize slider from pref setting.
- syncFromPreferenceSetting(this);
- // Update slider on future pref changes.
- if (gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ"))
- {
- gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")->getCommitSignal()->connect(boost::bind(&syncFromPreferenceSetting, this, false));
- }
- else
- {
- LL_WARNS() << "Control not found for AvatarHoverOffsetZ" << LL_ENDL;
- }
-
- updateEditEnabled();
-
- if (!mRegionChangedSlot.connected())
- {
- mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterHoverHeight::onRegionChanged,this));
- }
- // Set up based on initial region.
- onRegionChanged();
-
- return TRUE;
+ LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
+ sldrCtrl->setMinValue(MIN_HOVER_Z);
+ sldrCtrl->setMaxValue(MAX_HOVER_Z);
+ sldrCtrl->setSliderMouseUpCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this));
+ sldrCtrl->setSliderEditorCommitCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this));
+ childSetCommitCallback("HoverHeightSlider", &LLFloaterHoverHeight::onSliderMoved, NULL);
+
+ // Initialize slider from pref setting.
+ syncFromPreferenceSetting(this);
+ // Update slider on future pref changes.
+ if (gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ"))
+ {
+ gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")->getCommitSignal()->connect(boost::bind(&syncFromPreferenceSetting, this, false));
+ }
+ else
+ {
+ LL_WARNS() << "Control not found for AvatarHoverOffsetZ" << LL_ENDL;
+ }
+
+ updateEditEnabled();
+
+ if (!mRegionChangedSlot.connected())
+ {
+ mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterHoverHeight::onRegionChanged,this));
+ }
+ // Set up based on initial region.
+ onRegionChanged();
+
+ return TRUE;
}
void LLFloaterHoverHeight::onClose(bool app_quitting)
{
- if (mRegionChangedSlot.connected())
- {
- mRegionChangedSlot.disconnect();
- }
+ if (mRegionChangedSlot.connected())
+ {
+ mRegionChangedSlot.disconnect();
+ }
}
// static
@@ -114,42 +114,42 @@ void LLFloaterHoverHeight::onSliderMoved(LLUICtrl* ctrl, void* userData)
// value entered as text.
void LLFloaterHoverHeight::onFinalCommit()
{
- LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
- F32 value = sldrCtrl->getValueF32();
- gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value);
+ LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
+ F32 value = sldrCtrl->getValueF32();
+ gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value);
}
void LLFloaterHoverHeight::onRegionChanged()
{
- LLViewerRegion *region = gAgent.getRegion();
- if (region && region->simulatorFeaturesReceived())
- {
- updateEditEnabled();
- }
- else if (region)
- {
- region->setSimulatorFeaturesReceivedCallback(boost::bind(&LLFloaterHoverHeight::onSimulatorFeaturesReceived,this,_1));
- }
+ LLViewerRegion *region = gAgent.getRegion();
+ if (region && region->simulatorFeaturesReceived())
+ {
+ updateEditEnabled();
+ }
+ else if (region)
+ {
+ region->setSimulatorFeaturesReceivedCallback(boost::bind(&LLFloaterHoverHeight::onSimulatorFeaturesReceived,this,_1));
+ }
}
void LLFloaterHoverHeight::onSimulatorFeaturesReceived(const LLUUID &region_id)
{
- LLViewerRegion *region = gAgent.getRegion();
- if (region && (region->getRegionID()==region_id))
- {
- updateEditEnabled();
- }
+ LLViewerRegion *region = gAgent.getRegion();
+ if (region && (region->getRegionID()==region_id))
+ {
+ updateEditEnabled();
+ }
}
void LLFloaterHoverHeight::updateEditEnabled()
{
- bool enabled = gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled();
- LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
- sldrCtrl->setEnabled(enabled);
- if (enabled)
- {
- syncFromPreferenceSetting(this);
- }
+ bool enabled = gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled();
+ LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
+ sldrCtrl->setEnabled(enabled);
+ if (enabled)
+ {
+ syncFromPreferenceSetting(this);
+ }
}
diff --git a/indra/newview/llfloaterhoverheight.h b/indra/newview/llfloaterhoverheight.h
index a643fa2516..778df644ef 100644
--- a/indra/newview/llfloaterhoverheight.h
+++ b/indra/newview/llfloaterhoverheight.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterhoverheight.h
* @brief Controller for self avatar hover height.
* @author vir@lindenlab.com
@@ -32,21 +32,21 @@
class LLFloaterHoverHeight: public LLFloater
{
public:
- LLFloaterHoverHeight(const LLSD& key);
- BOOL postBuild();
+ LLFloaterHoverHeight(const LLSD& key);
+ BOOL postBuild();
- static void onSliderMoved(LLUICtrl* ctrl, void* userData);
+ static void onSliderMoved(LLUICtrl* ctrl, void* userData);
- void onFinalCommit();
+ void onFinalCommit();
- static void syncFromPreferenceSetting(void *user_data, bool update_offset = true);
+ static void syncFromPreferenceSetting(void *user_data, bool update_offset = true);
- void onRegionChanged();
- void onSimulatorFeaturesReceived(const LLUUID &region_id);
- void updateEditEnabled();
+ void onRegionChanged();
+ void onSimulatorFeaturesReceived(const LLUUID &region_id);
+ void updateEditEnabled();
- /*virtual*/ void onClose(bool app_quitting);
- boost::signals2::connection mRegionChangedSlot;
+ /*virtual*/ void onClose(bool app_quitting);
+ boost::signals2::connection mRegionChangedSlot;
};
#endif
diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp
index a359fb7c7d..b414db6fc5 100644
--- a/indra/newview/llfloaterhowto.cpp
+++ b/indra/newview/llfloaterhowto.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterhowto.cpp
* @brief A variant of web floater meant to open guidebook
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -80,13 +80,13 @@ LLFloaterHowTo* LLFloaterHowTo::getInstance()
BOOL LLFloaterHowTo::handleKeyHere(KEY key, MASK mask)
{
- BOOL handled = FALSE;
+ BOOL handled = FALSE;
- if (KEY_F1 == key )
- {
- closeFloater();
- handled = TRUE;
- }
+ if (KEY_F1 == key )
+ {
+ closeFloater();
+ handled = TRUE;
+ }
- return handled;
+ return handled;
}
diff --git a/indra/newview/llfloaterhowto.h b/indra/newview/llfloaterhowto.h
index d8da355600..566e5454ad 100644
--- a/indra/newview/llfloaterhowto.h
+++ b/indra/newview/llfloaterhowto.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterhowto.h
* @brief A variant of web floater meant to open guidebook
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp
index 58c76a0b85..6c9535d9ad 100644
--- a/indra/newview/llfloaterhud.cpp
+++ b/indra/newview/llfloaterhud.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterhud.cpp
* @brief Implementation of HUD floater
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,42 +40,42 @@
///----------------------------------------------------------------------------
/// Class LLFloaterHUD
///----------------------------------------------------------------------------
-#define super LLFloater /* superclass */
+#define super LLFloater /* superclass */
// Default constructor
LLFloaterHUD::LLFloaterHUD(const LLSD& key)
-: LLFloater(key),
- mWebBrowser(0)
+: LLFloater(key),
+ mWebBrowser(0)
{
- // do not build the floater if there the url is empty
- if (gSavedSettings.getString("TutorialURL") == "")
- {
- LLNotificationsUtil::add("TutorialNotFound");
- return;
- }
-
- // Opaque background since we never get the focus
- setBackgroundOpaque(TRUE);
+ // do not build the floater if there the url is empty
+ if (gSavedSettings.getString("TutorialURL") == "")
+ {
+ LLNotificationsUtil::add("TutorialNotFound");
+ return;
+ }
+
+ // Opaque background since we never get the focus
+ setBackgroundOpaque(TRUE);
}
BOOL LLFloaterHUD::postBuild()
{
- mWebBrowser = getChild<LLMediaCtrl>("floater_hud_browser" );
- if (mWebBrowser)
- {
- // This is a "chrome" floater, so we don't want anything to
- // take focus (as the user needs to be able to walk with
- // arrow keys during tutorial).
- mWebBrowser->setTakeFocusOnClick(false);
-
- std::string language = LLUI::getLanguage();
- std::string base_url = gSavedSettings.getString("TutorialURL");
-
- std::string url = base_url + language + "/";
- mWebBrowser->navigateTo(url);
- }
-
- return TRUE;
+ mWebBrowser = getChild<LLMediaCtrl>("floater_hud_browser" );
+ if (mWebBrowser)
+ {
+ // This is a "chrome" floater, so we don't want anything to
+ // take focus (as the user needs to be able to walk with
+ // arrow keys during tutorial).
+ mWebBrowser->setTakeFocusOnClick(false);
+
+ std::string language = LLUI::getLanguage();
+ std::string base_url = gSavedSettings.getString("TutorialURL");
+
+ std::string url = base_url + language + "/";
+ mWebBrowser->navigateTo(url);
+ }
+
+ return TRUE;
}
// Destructor
diff --git a/indra/newview/llfloaterhud.h b/indra/newview/llfloaterhud.h
index e560d6320b..b761794295 100644
--- a/indra/newview/llfloaterhud.h
+++ b/indra/newview/llfloaterhud.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterhud.h
* @brief A floater showing the HUD tutorial
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,18 +33,18 @@ class LLMediaCtrl;
class LLFloaterHUD : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- BOOL postBuild();
-
+ BOOL postBuild();
+
private:
- // Handles its own construction and destruction, so private.
- LLFloaterHUD(const LLSD& key);
- /*virtual*/ ~LLFloaterHUD();
+ // Handles its own construction and destruction, so private.
+ LLFloaterHUD(const LLSD& key);
+ /*virtual*/ ~LLFloaterHUD();
private:
- LLMediaCtrl* mWebBrowser; ///< the actual web browser control
+ LLMediaCtrl* mWebBrowser; ///< the actual web browser control
};
#endif // LL_LLFLOATERHUD_H
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index ba0f97e2e1..8f83c39520 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterimagepreview.cpp
* @brief LLFloaterImagePreview class implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -64,23 +64,23 @@
const S32 PREVIEW_BORDER_WIDTH = 2;
const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH;
const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
-const S32 PREVIEW_VPAD = -24 + 35; // yuk, hard coded
+const S32 PREVIEW_VPAD = -24 + 35; // yuk, hard coded
const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16 + 35;
const S32 PREVIEW_TEXTURE_HEIGHT = 320;
//-----------------------------------------------------------------------------
// LLFloaterImagePreview()
//-----------------------------------------------------------------------------
-LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) :
- LLFloaterNameDesc(filename),
+LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) :
+ LLFloaterNameDesc(filename),
- mAvatarPreview(NULL),
- mSculptedPreview(NULL),
- mLastMouseX(0),
- mLastMouseY(0),
- mImagep(NULL)
+ mAvatarPreview(NULL),
+ mSculptedPreview(NULL),
+ mLastMouseX(0),
+ mLastMouseY(0),
+ mImagep(NULL)
{
- loadImage(mFilenameAndPath);
+ loadImage(mFilenameAndPath);
}
//-----------------------------------------------------------------------------
@@ -88,33 +88,33 @@ LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) :
//-----------------------------------------------------------------------------
BOOL LLFloaterImagePreview::postBuild()
{
- if (!LLFloaterNameDesc::postBuild())
- {
- return FALSE;
- }
-
- LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
- if (iface)
- {
- iface->selectFirstItem();
- }
- childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this);
-
- mPreviewRect.set(PREVIEW_HPAD,
- PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD,
- getRect().getWidth() - PREVIEW_HPAD,
- PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
- mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);
-
- getChildView("bad_image_text")->setVisible(FALSE);
-
- if (mRawImagep.notNull() && gAgent.getRegion() != NULL)
- {
- mAvatarPreview = new LLImagePreviewAvatar(256, 256);
- mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE);
-
- mSculptedPreview = new LLImagePreviewSculpted(256, 256);
- mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f);
+ if (!LLFloaterNameDesc::postBuild())
+ {
+ return FALSE;
+ }
+
+ LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
+ if (iface)
+ {
+ iface->selectFirstItem();
+ }
+ childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this);
+
+ mPreviewRect.set(PREVIEW_HPAD,
+ PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD,
+ getRect().getWidth() - PREVIEW_HPAD,
+ PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);
+
+ getChildView("bad_image_text")->setVisible(FALSE);
+
+ if (mRawImagep.notNull() && gAgent.getRegion() != NULL)
+ {
+ mAvatarPreview = new LLImagePreviewAvatar(256, 256);
+ mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE);
+
+ mSculptedPreview = new LLImagePreviewSculpted(256, 256);
+ mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f);
if (mRawImagep->getWidth() * mRawImagep->getHeight() <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF)
{
@@ -124,24 +124,24 @@ BOOL LLFloaterImagePreview::postBuild()
check_box->setEnabled(TRUE);
check_box->setControlVariable(gSavedSettings.getControl("LosslessJ2CUpload"));
}
- }
- else
- {
- mAvatarPreview = NULL;
- mSculptedPreview = NULL;
- getChildView("bad_image_text")->setVisible(TRUE);
- getChildView("clothing_type_combo")->setEnabled(FALSE);
- getChildView("ok_btn")->setEnabled(FALSE);
-
- if(!mImageLoadError.empty())
- {
- getChild<LLUICtrl>("bad_image_text")->setValue(mImageLoadError.c_str());
- }
- }
-
- getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
-
- return TRUE;
+ }
+ else
+ {
+ mAvatarPreview = NULL;
+ mSculptedPreview = NULL;
+ getChildView("bad_image_text")->setVisible(TRUE);
+ getChildView("clothing_type_combo")->setEnabled(FALSE);
+ getChildView("ok_btn")->setEnabled(FALSE);
+
+ if(!mImageLoadError.empty())
+ {
+ getChild<LLUICtrl>("bad_image_text")->setValue(mImageLoadError.c_str());
+ }
+ }
+
+ getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -149,70 +149,70 @@ BOOL LLFloaterImagePreview::postBuild()
//-----------------------------------------------------------------------------
LLFloaterImagePreview::~LLFloaterImagePreview()
{
- clearAllPreviewTextures();
+ clearAllPreviewTextures();
- mRawImagep = NULL;
- mImagep = NULL ;
+ mRawImagep = NULL;
+ mImagep = NULL ;
}
-//static
+//static
//-----------------------------------------------------------------------------
// onPreviewTypeCommit()
//-----------------------------------------------------------------------------
-void LLFloaterImagePreview::onPreviewTypeCommit(LLUICtrl* ctrl, void* userdata)
+void LLFloaterImagePreview::onPreviewTypeCommit(LLUICtrl* ctrl, void* userdata)
{
- LLFloaterImagePreview *fp =(LLFloaterImagePreview *)userdata;
-
- if (!fp->mAvatarPreview || !fp->mSculptedPreview)
- {
- return;
- }
-
- S32 which_mode = 0;
-
- LLCtrlSelectionInterface* iface = fp->childGetSelectionInterface("clothing_type_combo");
- if (iface)
- {
- which_mode = iface->getFirstSelectedIndex();
- }
-
- switch(which_mode)
- {
- case 0:
- break;
- case 1:
- fp->mAvatarPreview->setPreviewTarget("mSkull", "mHairMesh0", fp->mRawImagep, 0.4f, FALSE);
- break;
- case 2:
- fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, FALSE);
- break;
- case 3:
- fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.0f, FALSE);
- break;
- case 4:
- fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, FALSE);
- break;
- case 5:
- fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, TRUE);
- break;
- case 6:
- fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.2f, TRUE);
- break;
- case 7:
- fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, TRUE);
- break;
- case 8:
- fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mSkirtMesh0", fp->mRawImagep, 1.3f, FALSE);
- break;
- case 9:
- fp->mSculptedPreview->setPreviewTarget(fp->mRawImagep, 2.0f);
- break;
- default:
- break;
- }
-
- fp->mAvatarPreview->refresh();
- fp->mSculptedPreview->refresh();
+ LLFloaterImagePreview *fp =(LLFloaterImagePreview *)userdata;
+
+ if (!fp->mAvatarPreview || !fp->mSculptedPreview)
+ {
+ return;
+ }
+
+ S32 which_mode = 0;
+
+ LLCtrlSelectionInterface* iface = fp->childGetSelectionInterface("clothing_type_combo");
+ if (iface)
+ {
+ which_mode = iface->getFirstSelectedIndex();
+ }
+
+ switch(which_mode)
+ {
+ case 0:
+ break;
+ case 1:
+ fp->mAvatarPreview->setPreviewTarget("mSkull", "mHairMesh0", fp->mRawImagep, 0.4f, FALSE);
+ break;
+ case 2:
+ fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, FALSE);
+ break;
+ case 3:
+ fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.0f, FALSE);
+ break;
+ case 4:
+ fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, FALSE);
+ break;
+ case 5:
+ fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, TRUE);
+ break;
+ case 6:
+ fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.2f, TRUE);
+ break;
+ case 7:
+ fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, TRUE);
+ break;
+ case 8:
+ fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mSkirtMesh0", fp->mRawImagep, 1.3f, FALSE);
+ break;
+ case 9:
+ fp->mSculptedPreview->setPreviewTarget(fp->mRawImagep, 2.0f);
+ break;
+ default:
+ break;
+ }
+
+ fp->mAvatarPreview->refresh();
+ fp->mSculptedPreview->refresh();
}
@@ -221,16 +221,16 @@ void LLFloaterImagePreview::onPreviewTypeCommit(LLUICtrl* ctrl, void* userdata)
//-----------------------------------------------------------------------------
void LLFloaterImagePreview::clearAllPreviewTextures()
{
- if (mAvatarPreview)
- {
- mAvatarPreview->clearPreviewTexture("mHairMesh0");
- mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0");
- mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0");
- mAvatarPreview->clearPreviewTexture("mHeadMesh0");
- mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0");
- mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0");
- mAvatarPreview->clearPreviewTexture("mSkirtMesh0");
- }
+ if (mAvatarPreview)
+ {
+ mAvatarPreview->clearPreviewTexture("mHairMesh0");
+ mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0");
+ mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0");
+ mAvatarPreview->clearPreviewTexture("mHeadMesh0");
+ mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0");
+ mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0");
+ mAvatarPreview->clearPreviewTexture("mSkirtMesh0");
+ }
}
//-----------------------------------------------------------------------------
@@ -238,92 +238,92 @@ void LLFloaterImagePreview::clearAllPreviewTextures()
//-----------------------------------------------------------------------------
void LLFloaterImagePreview::draw()
{
- LLFloater::draw();
- LLRect r = getRect();
-
- if (mRawImagep.notNull())
- {
- LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
- U32 selected = 0;
- if (iface)
- selected = iface->getFirstSelectedIndex();
-
- if (selected <= 0)
- {
- gl_rect_2d_checkerboard(mPreviewRect);
-
- if(mImagep.notNull())
- {
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName());
- }
- else
- {
- mImagep = LLViewerTextureManager::getLocalTexture(mRawImagep.get(), FALSE) ;
-
- gGL.getTexUnit(0)->unbind(mImagep->getTarget()) ;
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName());
- stop_glerror();
-
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-
- gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- if (mAvatarPreview)
- {
- mAvatarPreview->setTexture(mImagep->getTexName());
- mSculptedPreview->setTexture(mImagep->getTexName());
- }
- }
-
- gGL.color3f(1.f, 1.f, 1.f);
- gGL.begin( LLRender::QUADS );
- {
- gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop);
- gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
- gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mBottom);
- gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
- gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mBottom);
- gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
- gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mTop);
- gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
- }
- gGL.end();
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- stop_glerror();
- }
- else
- {
- if ((mAvatarPreview) && (mSculptedPreview))
- {
- gGL.color3f(1.f, 1.f, 1.f);
-
- if (selected == 9)
- {
- gGL.getTexUnit(0)->bind(mSculptedPreview);
- }
- else
- {
- gGL.getTexUnit(0)->bind(mAvatarPreview);
- }
-
- gGL.begin( LLRender::QUADS );
- {
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
- }
- gGL.end();
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- }
- }
- }
+ LLFloater::draw();
+ LLRect r = getRect();
+
+ if (mRawImagep.notNull())
+ {
+ LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
+ U32 selected = 0;
+ if (iface)
+ selected = iface->getFirstSelectedIndex();
+
+ if (selected <= 0)
+ {
+ gl_rect_2d_checkerboard(mPreviewRect);
+
+ if(mImagep.notNull())
+ {
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName());
+ }
+ else
+ {
+ mImagep = LLViewerTextureManager::getLocalTexture(mRawImagep.get(), FALSE) ;
+
+ gGL.getTexUnit(0)->unbind(mImagep->getTarget()) ;
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName());
+ stop_glerror();
+
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
+
+ gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
+ if (mAvatarPreview)
+ {
+ mAvatarPreview->setTexture(mImagep->getTexName());
+ mSculptedPreview->setTexture(mImagep->getTexName());
+ }
+ }
+
+ gGL.color3f(1.f, 1.f, 1.f);
+ gGL.begin( LLRender::QUADS );
+ {
+ gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop);
+ gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
+ gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mBottom);
+ gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mBottom);
+ gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mTop);
+ gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
+ }
+ gGL.end();
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ stop_glerror();
+ }
+ else
+ {
+ if ((mAvatarPreview) && (mSculptedPreview))
+ {
+ gGL.color3f(1.f, 1.f, 1.f);
+
+ if (selected == 9)
+ {
+ gGL.getTexUnit(0)->bind(mSculptedPreview);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->bind(mAvatarPreview);
+ }
+
+ gGL.begin( LLRender::QUADS );
+ {
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
+ }
+ gGL.end();
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ }
+ }
}
@@ -332,56 +332,56 @@ void LLFloaterImagePreview::draw()
//-----------------------------------------------------------------------------
bool LLFloaterImagePreview::loadImage(const std::string& src_filename)
{
- std::string exten = gDirUtilp->getExtension(src_filename);
- U32 codec = LLImageBase::getCodecFromExtension(exten);
-
- LLImageDimensionsInfo image_info;
- if (!image_info.load(src_filename,codec))
- {
- mImageLoadError = image_info.getLastError();
- return false;
- }
-
- S32 max_width = gSavedSettings.getS32("max_texture_dimension_X");
- S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y");
-
- if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height))
- {
- LLStringUtil::format_map_t args;
- args["WIDTH"] = llformat("%d", max_width);
- args["HEIGHT"] = llformat("%d", max_height);
-
- mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args);
- return false;
- }
-
- // Load the image
- LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
- if (image.isNull())
- {
- return false;
- }
- if (!image->load(src_filename))
- {
- return false;
- }
- // Decompress or expand it in a raw image structure
- LLPointer<LLImageRaw> raw_image = new LLImageRaw;
- if (!image->decode(raw_image, 0.0f))
- {
- return false;
- }
- // Check the image constraints
- if ((image->getComponents() != 3) && (image->getComponents() != 4))
- {
- image->setLastError("Image files with less than 3 or more than 4 components are not supported.");
- return false;
- }
-
- raw_image->biasedScaleToPowerOfTwo(1024);
- mRawImagep = raw_image;
-
- return true;
+ std::string exten = gDirUtilp->getExtension(src_filename);
+ U32 codec = LLImageBase::getCodecFromExtension(exten);
+
+ LLImageDimensionsInfo image_info;
+ if (!image_info.load(src_filename,codec))
+ {
+ mImageLoadError = image_info.getLastError();
+ return false;
+ }
+
+ S32 max_width = gSavedSettings.getS32("max_texture_dimension_X");
+ S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y");
+
+ if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height))
+ {
+ LLStringUtil::format_map_t args;
+ args["WIDTH"] = llformat("%d", max_width);
+ args["HEIGHT"] = llformat("%d", max_height);
+
+ mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args);
+ return false;
+ }
+
+ // Load the image
+ LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
+ if (image.isNull())
+ {
+ return false;
+ }
+ if (!image->load(src_filename))
+ {
+ return false;
+ }
+ // Decompress or expand it in a raw image structure
+ LLPointer<LLImageRaw> raw_image = new LLImageRaw;
+ if (!image->decode(raw_image, 0.0f))
+ {
+ return false;
+ }
+ // Check the image constraints
+ if ((image->getComponents() != 3) && (image->getComponents() != 4))
+ {
+ image->setLastError("Image files with less than 3 or more than 4 components are not supported.");
+ return false;
+ }
+
+ raw_image->biasedScaleToPowerOfTwo(1024);
+ mRawImagep = raw_image;
+
+ return true;
}
//-----------------------------------------------------------------------------
@@ -389,17 +389,17 @@ bool LLFloaterImagePreview::loadImage(const std::string& src_filename)
//-----------------------------------------------------------------------------
BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if (mPreviewRect.pointInRect(x, y))
- {
- bringToFront( x, y );
- gFocusMgr.setMouseCapture(this);
- gViewerWindow->hideCursor();
- mLastMouseX = x;
- mLastMouseY = y;
- return TRUE;
- }
-
- return LLFloater::handleMouseDown(x, y, mask);
+ if (mPreviewRect.pointInRect(x, y))
+ {
+ bringToFront( x, y );
+ gFocusMgr.setMouseCapture(this);
+ gViewerWindow->hideCursor();
+ mLastMouseX = x;
+ mLastMouseY = y;
+ return TRUE;
+ }
+
+ return LLFloater::handleMouseDown(x, y, mask);
}
//-----------------------------------------------------------------------------
@@ -407,9 +407,9 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask)
{
- gFocusMgr.setMouseCapture(FALSE);
- gViewerWindow->showCursor();
- return LLFloater::handleMouseUp(x, y, mask);
+ gFocusMgr.setMouseCapture(FALSE);
+ gViewerWindow->showCursor();
+ return LLFloater::handleMouseUp(x, y, mask);
}
//-----------------------------------------------------------------------------
@@ -417,119 +417,119 @@ BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask)
{
- MASK local_mask = mask & ~MASK_ALT;
-
- if (mAvatarPreview && hasMouseCapture())
- {
- if (local_mask == MASK_PAN)
- {
- // pan here
- LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
- if (iface && iface->getFirstSelectedIndex() <= 0)
- {
- mPreviewImageRect.translate((F32)(x - mLastMouseX) * -0.005f * mPreviewImageRect.getWidth(),
- (F32)(y - mLastMouseY) * -0.005f * mPreviewImageRect.getHeight());
- }
- else
- {
- mAvatarPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f);
- mSculptedPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f);
- }
- }
- else if (local_mask == MASK_ORBIT)
- {
- F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
- F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f;
-
- mAvatarPreview->rotate(yaw_radians, pitch_radians);
- mSculptedPreview->rotate(yaw_radians, pitch_radians);
- }
- else
- {
- LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
- if (iface && iface->getFirstSelectedIndex() <= 0)
- {
- F32 zoom_amt = (F32)(y - mLastMouseY) * -0.002f;
- mPreviewImageRect.stretch(zoom_amt);
- }
- else
- {
- F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
- F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f;
-
- mAvatarPreview->rotate(yaw_radians, 0.f);
- mAvatarPreview->zoom(zoom_amt);
- mSculptedPreview->rotate(yaw_radians, 0.f);
- mSculptedPreview->zoom(zoom_amt);
- }
- }
-
- LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
- if (iface && iface->getFirstSelectedIndex() <= 0)
- {
- if (mPreviewImageRect.getWidth() > 1.f)
- {
- mPreviewImageRect.stretch((1.f - mPreviewImageRect.getWidth()) * 0.5f);
- }
- else if (mPreviewImageRect.getWidth() < 0.1f)
- {
- mPreviewImageRect.stretch((0.1f - mPreviewImageRect.getWidth()) * 0.5f);
- }
-
- if (mPreviewImageRect.getHeight() > 1.f)
- {
- mPreviewImageRect.stretch((1.f - mPreviewImageRect.getHeight()) * 0.5f);
- }
- else if (mPreviewImageRect.getHeight() < 0.1f)
- {
- mPreviewImageRect.stretch((0.1f - mPreviewImageRect.getHeight()) * 0.5f);
- }
-
- if (mPreviewImageRect.mLeft < 0.f)
- {
- mPreviewImageRect.translate(-mPreviewImageRect.mLeft, 0.f);
- }
- else if (mPreviewImageRect.mRight > 1.f)
- {
- mPreviewImageRect.translate(1.f - mPreviewImageRect.mRight, 0.f);
- }
-
- if (mPreviewImageRect.mBottom < 0.f)
- {
- mPreviewImageRect.translate(0.f, -mPreviewImageRect.mBottom);
- }
- else if (mPreviewImageRect.mTop > 1.f)
- {
- mPreviewImageRect.translate(0.f, 1.f - mPreviewImageRect.mTop);
- }
- }
- else
- {
- mAvatarPreview->refresh();
- mSculptedPreview->refresh();
- }
-
- LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY);
- }
-
- if (!mPreviewRect.pointInRect(x, y) || !mAvatarPreview || !mSculptedPreview)
- {
- return LLFloater::handleHover(x, y, mask);
- }
- else if (local_mask == MASK_ORBIT)
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA);
- }
- else if (local_mask == MASK_PAN)
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLPAN);
- }
- else
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
- }
-
- return TRUE;
+ MASK local_mask = mask & ~MASK_ALT;
+
+ if (mAvatarPreview && hasMouseCapture())
+ {
+ if (local_mask == MASK_PAN)
+ {
+ // pan here
+ LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
+ if (iface && iface->getFirstSelectedIndex() <= 0)
+ {
+ mPreviewImageRect.translate((F32)(x - mLastMouseX) * -0.005f * mPreviewImageRect.getWidth(),
+ (F32)(y - mLastMouseY) * -0.005f * mPreviewImageRect.getHeight());
+ }
+ else
+ {
+ mAvatarPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f);
+ mSculptedPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f);
+ }
+ }
+ else if (local_mask == MASK_ORBIT)
+ {
+ F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
+ F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f;
+
+ mAvatarPreview->rotate(yaw_radians, pitch_radians);
+ mSculptedPreview->rotate(yaw_radians, pitch_radians);
+ }
+ else
+ {
+ LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
+ if (iface && iface->getFirstSelectedIndex() <= 0)
+ {
+ F32 zoom_amt = (F32)(y - mLastMouseY) * -0.002f;
+ mPreviewImageRect.stretch(zoom_amt);
+ }
+ else
+ {
+ F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
+ F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f;
+
+ mAvatarPreview->rotate(yaw_radians, 0.f);
+ mAvatarPreview->zoom(zoom_amt);
+ mSculptedPreview->rotate(yaw_radians, 0.f);
+ mSculptedPreview->zoom(zoom_amt);
+ }
+ }
+
+ LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
+ if (iface && iface->getFirstSelectedIndex() <= 0)
+ {
+ if (mPreviewImageRect.getWidth() > 1.f)
+ {
+ mPreviewImageRect.stretch((1.f - mPreviewImageRect.getWidth()) * 0.5f);
+ }
+ else if (mPreviewImageRect.getWidth() < 0.1f)
+ {
+ mPreviewImageRect.stretch((0.1f - mPreviewImageRect.getWidth()) * 0.5f);
+ }
+
+ if (mPreviewImageRect.getHeight() > 1.f)
+ {
+ mPreviewImageRect.stretch((1.f - mPreviewImageRect.getHeight()) * 0.5f);
+ }
+ else if (mPreviewImageRect.getHeight() < 0.1f)
+ {
+ mPreviewImageRect.stretch((0.1f - mPreviewImageRect.getHeight()) * 0.5f);
+ }
+
+ if (mPreviewImageRect.mLeft < 0.f)
+ {
+ mPreviewImageRect.translate(-mPreviewImageRect.mLeft, 0.f);
+ }
+ else if (mPreviewImageRect.mRight > 1.f)
+ {
+ mPreviewImageRect.translate(1.f - mPreviewImageRect.mRight, 0.f);
+ }
+
+ if (mPreviewImageRect.mBottom < 0.f)
+ {
+ mPreviewImageRect.translate(0.f, -mPreviewImageRect.mBottom);
+ }
+ else if (mPreviewImageRect.mTop > 1.f)
+ {
+ mPreviewImageRect.translate(0.f, 1.f - mPreviewImageRect.mTop);
+ }
+ }
+ else
+ {
+ mAvatarPreview->refresh();
+ mSculptedPreview->refresh();
+ }
+
+ LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY);
+ }
+
+ if (!mPreviewRect.pointInRect(x, y) || !mAvatarPreview || !mSculptedPreview)
+ {
+ return LLFloater::handleHover(x, y, mask);
+ }
+ else if (local_mask == MASK_ORBIT)
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA);
+ }
+ else if (local_mask == MASK_PAN)
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLPAN);
+ }
+ else
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
+ }
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -537,16 +537,16 @@ BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
BOOL LLFloaterImagePreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
- if (mPreviewRect.pointInRect(x, y) && mAvatarPreview)
- {
- mAvatarPreview->zoom((F32)clicks * -0.2f);
- mAvatarPreview->refresh();
+ if (mPreviewRect.pointInRect(x, y) && mAvatarPreview)
+ {
+ mAvatarPreview->zoom((F32)clicks * -0.2f);
+ mAvatarPreview->refresh();
- mSculptedPreview->zoom((F32)clicks * -0.2f);
- mSculptedPreview->refresh();
- }
+ mSculptedPreview->zoom((F32)clicks * -0.2f);
+ mSculptedPreview->refresh();
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -555,7 +555,7 @@ BOOL LLFloaterImagePreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
// static
void LLFloaterImagePreview::onMouseCaptureLostImagePreview(LLMouseHandler* handler)
{
- gViewerWindow->showCursor();
+ gViewerWindow->showCursor();
}
@@ -564,63 +564,63 @@ void LLFloaterImagePreview::onMouseCaptureLostImagePreview(LLMouseHandler* handl
//-----------------------------------------------------------------------------
LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
{
- mNeedsUpdate = TRUE;
- mTargetJoint = NULL;
- mTargetMesh = NULL;
- mCameraDistance = 0.f;
- mCameraYaw = 0.f;
- mCameraPitch = 0.f;
- mCameraZoom = 1.f;
-
- mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), LLViewerObject::CO_FLAG_UI_AVATAR);
- mDummyAvatar->mSpecialRenderMode = 2;
-
- mTextureName = 0;
+ mNeedsUpdate = TRUE;
+ mTargetJoint = NULL;
+ mTargetMesh = NULL;
+ mCameraDistance = 0.f;
+ mCameraYaw = 0.f;
+ mCameraPitch = 0.f;
+ mCameraZoom = 1.f;
+
+ mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), LLViewerObject::CO_FLAG_UI_AVATAR);
+ mDummyAvatar->mSpecialRenderMode = 2;
+
+ mTextureName = 0;
}
LLImagePreviewAvatar::~LLImagePreviewAvatar()
{
- mDummyAvatar->markDead();
+ mDummyAvatar->markDead();
}
//virtual
S8 LLImagePreviewAvatar::getType() const
{
- return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_AVATAR ;
+ return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_AVATAR ;
}
-void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male)
-{
- mTargetJoint = mDummyAvatar->mRoot->findJoint(joint_name);
- // clear out existing test mesh
- if (mTargetMesh)
- {
- mTargetMesh->setTestTexture(0);
- }
-
- if (male)
- {
- mDummyAvatar->setVisualParamWeight( "male", 1.f );
- mDummyAvatar->updateVisualParams();
- mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
- }
- else
- {
- mDummyAvatar->setVisualParamWeight( "male", 0.f );
- mDummyAvatar->updateVisualParams();
- mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
- }
- mDummyAvatar->mRoot->setVisible(FALSE, TRUE);
-
- mTargetMesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name));
- mTargetMesh->setTestTexture(mTextureName);
- mTargetMesh->setVisible(TRUE, FALSE);
- mCameraDistance = distance;
- mCameraZoom = 1.f;
- mCameraPitch = 0.f;
- mCameraYaw = 0.f;
- mCameraOffset.clearVec();
+void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male)
+{
+ mTargetJoint = mDummyAvatar->mRoot->findJoint(joint_name);
+ // clear out existing test mesh
+ if (mTargetMesh)
+ {
+ mTargetMesh->setTestTexture(0);
+ }
+
+ if (male)
+ {
+ mDummyAvatar->setVisualParamWeight( "male", 1.f );
+ mDummyAvatar->updateVisualParams();
+ mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
+ }
+ else
+ {
+ mDummyAvatar->setVisualParamWeight( "male", 0.f );
+ mDummyAvatar->updateVisualParams();
+ mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
+ }
+ mDummyAvatar->mRoot->setVisible(FALSE, TRUE);
+
+ mTargetMesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name));
+ mTargetMesh->setTestTexture(mTextureName);
+ mTargetMesh->setVisible(TRUE, FALSE);
+ mCameraDistance = distance;
+ mCameraZoom = 1.f;
+ mCameraPitch = 0.f;
+ mCameraYaw = 0.f;
+ mCameraOffset.clearVec();
}
//-----------------------------------------------------------------------------
@@ -628,15 +628,15 @@ void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const
//-----------------------------------------------------------------------------
void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name)
{
- if (mDummyAvatar)
- {
- LLViewerJointMesh *mesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name));
- // clear out existing test mesh
- if (mesh)
- {
- mesh->setTestTexture(0);
- }
- }
+ if (mDummyAvatar)
+ {
+ LLViewerJointMesh *mesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name));
+ // clear out existing test mesh
+ if (mesh)
+ {
+ mesh->setTestTexture(0);
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -644,82 +644,82 @@ void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name)
//-----------------------------------------------------------------------------
BOOL LLImagePreviewAvatar::render()
{
- mNeedsUpdate = FALSE;
- LLVOAvatar* avatarp = mDummyAvatar;
-
- gGL.pushUIMatrix();
- gGL.loadUIIdentity();
-
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadIdentity();
- gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.loadIdentity();
-
-
- LLGLSUIDefault def;
- gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
-
- gUIProgram.bind();
-
- gl_rect_2d_simple( mFullWidth, mFullHeight );
-
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
-
- gGL.flush();
- LLVector3 target_pos = mTargetJoint->getWorldPosition();
-
- LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
- LLQuaternion(mCameraYaw, LLVector3::z_axis);
-
- LLQuaternion av_rot = avatarp->mPelvisp->getWorldRotation() * camera_rot;
- LLViewerCamera::getInstance()->setOriginAndLookAt(
- target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera
- LLVector3::z_axis, // up
- target_pos + (mCameraOffset * av_rot) ); // point of interest
-
- stop_glerror();
-
- LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / mFullHeight);
- LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
- LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
-
- LLVertexBuffer::unbind();
- avatarp->updateLOD();
-
- if (avatarp->mDrawable.notNull())
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
- // make sure alpha=0 shows avatar material color
- LLGLDisable no_blend(GL_BLEND);
-
- LLFace* face = avatarp->mDrawable->getFace(0);
- if (face)
- {
- LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)face->getPool();
- gPipeline.enableLightsPreview();
- avatarPoolp->renderAvatars(avatarp); // renders only one avatar
- }
- }
-
- gGL.popUIMatrix();
- gGL.color4f(1,1,1,1);
- return TRUE;
+ mNeedsUpdate = FALSE;
+ LLVOAvatar* avatarp = mDummyAvatar;
+
+ gGL.pushUIMatrix();
+ gGL.loadUIIdentity();
+
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+
+
+ LLGLSUIDefault def;
+ gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
+
+ gUIProgram.bind();
+
+ gl_rect_2d_simple( mFullWidth, mFullHeight );
+
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+
+ gGL.flush();
+ LLVector3 target_pos = mTargetJoint->getWorldPosition();
+
+ LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
+ LLQuaternion(mCameraYaw, LLVector3::z_axis);
+
+ LLQuaternion av_rot = avatarp->mPelvisp->getWorldRotation() * camera_rot;
+ LLViewerCamera::getInstance()->setOriginAndLookAt(
+ target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera
+ LLVector3::z_axis, // up
+ target_pos + (mCameraOffset * av_rot) ); // point of interest
+
+ stop_glerror();
+
+ LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / mFullHeight);
+ LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
+ LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
+
+ LLVertexBuffer::unbind();
+ avatarp->updateLOD();
+
+ if (avatarp->mDrawable.notNull())
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
+ // make sure alpha=0 shows avatar material color
+ LLGLDisable no_blend(GL_BLEND);
+
+ LLFace* face = avatarp->mDrawable->getFace(0);
+ if (face)
+ {
+ LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)face->getPool();
+ gPipeline.enableLightsPreview();
+ avatarPoolp->renderAvatars(avatarp); // renders only one avatar
+ }
+ }
+
+ gGL.popUIMatrix();
+ gGL.color4f(1,1,1,1);
+ return TRUE;
}
//-----------------------------------------------------------------------------
// refresh()
//-----------------------------------------------------------------------------
void LLImagePreviewAvatar::refresh()
-{
- mNeedsUpdate = TRUE;
+{
+ mNeedsUpdate = TRUE;
}
//-----------------------------------------------------------------------------
@@ -727,9 +727,9 @@ void LLImagePreviewAvatar::refresh()
//-----------------------------------------------------------------------------
void LLImagePreviewAvatar::rotate(F32 yaw_radians, F32 pitch_radians)
{
- mCameraYaw = mCameraYaw + yaw_radians;
+ mCameraYaw = mCameraYaw + yaw_radians;
- mCameraPitch = llclamp(mCameraPitch + pitch_radians, F_PI_BY_TWO * -0.8f, F_PI_BY_TWO * 0.8f);
+ mCameraPitch = llclamp(mCameraPitch + pitch_radians, F_PI_BY_TWO * -0.8f, F_PI_BY_TWO * 0.8f);
}
//-----------------------------------------------------------------------------
@@ -737,13 +737,13 @@ void LLImagePreviewAvatar::rotate(F32 yaw_radians, F32 pitch_radians)
//-----------------------------------------------------------------------------
void LLImagePreviewAvatar::zoom(F32 zoom_amt)
{
- mCameraZoom = llclamp(mCameraZoom + zoom_amt, 1.f, 10.f);
+ mCameraZoom = llclamp(mCameraZoom + zoom_amt, 1.f, 10.f);
}
void LLImagePreviewAvatar::pan(F32 right, F32 up)
{
- mCameraOffset.mV[VY] = llclamp(mCameraOffset.mV[VY] + right * mCameraDistance / mCameraZoom, -1.f, 1.f);
- mCameraOffset.mV[VZ] = llclamp(mCameraOffset.mV[VZ] + up * mCameraDistance / mCameraZoom, -1.f, 1.f);
+ mCameraOffset.mV[VY] = llclamp(mCameraOffset.mV[VY] + right * mCameraDistance / mCameraZoom, -1.f, 1.f);
+ mCameraOffset.mV[VZ] = llclamp(mCameraOffset.mV[VZ] + up * mCameraDistance / mCameraZoom, -1.f, 1.f);
}
@@ -753,19 +753,19 @@ void LLImagePreviewAvatar::pan(F32 right, F32 up)
LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
{
- mNeedsUpdate = TRUE;
- mCameraDistance = 0.f;
- mCameraYaw = 0.f;
- mCameraPitch = 0.f;
- mCameraZoom = 1.f;
- mTextureName = 0;
-
- LLVolumeParams volume_params;
- volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE);
- volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_SPHERE);
-
- F32 const HIGHEST_LOD = 4.0f;
- mVolume = new LLVolume(volume_params, HIGHEST_LOD);
+ mNeedsUpdate = TRUE;
+ mCameraDistance = 0.f;
+ mCameraYaw = 0.f;
+ mCameraPitch = 0.f;
+ mCameraZoom = 1.f;
+ mTextureName = 0;
+
+ LLVolumeParams volume_params;
+ volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE);
+ volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_SPHERE);
+
+ F32 const HIGHEST_LOD = 4.0f;
+ mVolume = new LLVolume(volume_params, HIGHEST_LOD);
}
@@ -776,67 +776,67 @@ LLImagePreviewSculpted::~LLImagePreviewSculpted()
//virtual
S8 LLImagePreviewSculpted::getType() const
{
- return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_SCULPTED ;
+ return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_SCULPTED ;
}
void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
-{
- mCameraDistance = distance;
- mCameraZoom = 1.f;
- mCameraPitch = 0.f;
- mCameraYaw = 0.f;
- mCameraOffset.clearVec();
-
- if (imagep)
- {
- mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0, false);
- }
-
- const LLVolumeFace &vf = mVolume->getVolumeFace(0);
- U32 num_indices = vf.mNumIndices;
- U32 num_vertices = vf.mNumVertices;
-
- mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0);
- if (!mVertexBuffer->allocateBuffer(num_vertices, num_indices))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer for image preview to"
- << num_vertices << " vertices and "
- << num_indices << " indices" << LL_ENDL;
- // We are likely to crash on getTexCoord0Strider()
- }
-
- LLStrider<LLVector3> vertex_strider;
- LLStrider<LLVector3> normal_strider;
- LLStrider<LLVector2> tc_strider;
- LLStrider<U16> index_strider;
-
- mVertexBuffer->getVertexStrider(vertex_strider);
- mVertexBuffer->getNormalStrider(normal_strider);
- mVertexBuffer->getTexCoord0Strider(tc_strider);
- mVertexBuffer->getIndexStrider(index_strider);
-
- // build vertices and normals
- LLStrider<LLVector3> pos;
- pos = (LLVector3*) vf.mPositions; pos.setStride(16);
- LLStrider<LLVector3> norm;
- norm = (LLVector3*) vf.mNormals; norm.setStride(16);
- LLStrider<LLVector2> tc;
- tc = (LLVector2*) vf.mTexCoords; tc.setStride(8);
-
- for (U32 i = 0; i < num_vertices; i++)
- {
- *(vertex_strider++) = *pos++;
- LLVector3 normal = *norm++;
- normal.normalize();
- *(normal_strider++) = normal;
- *(tc_strider++) = *tc++;
- }
-
- // build indices
- for (U16 i = 0; i < num_indices; i++)
- {
- *(index_strider++) = vf.mIndices[i];
- }
+{
+ mCameraDistance = distance;
+ mCameraZoom = 1.f;
+ mCameraPitch = 0.f;
+ mCameraYaw = 0.f;
+ mCameraOffset.clearVec();
+
+ if (imagep)
+ {
+ mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0, false);
+ }
+
+ const LLVolumeFace &vf = mVolume->getVolumeFace(0);
+ U32 num_indices = vf.mNumIndices;
+ U32 num_vertices = vf.mNumVertices;
+
+ mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0);
+ if (!mVertexBuffer->allocateBuffer(num_vertices, num_indices))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer for image preview to"
+ << num_vertices << " vertices and "
+ << num_indices << " indices" << LL_ENDL;
+ // We are likely to crash on getTexCoord0Strider()
+ }
+
+ LLStrider<LLVector3> vertex_strider;
+ LLStrider<LLVector3> normal_strider;
+ LLStrider<LLVector2> tc_strider;
+ LLStrider<U16> index_strider;
+
+ mVertexBuffer->getVertexStrider(vertex_strider);
+ mVertexBuffer->getNormalStrider(normal_strider);
+ mVertexBuffer->getTexCoord0Strider(tc_strider);
+ mVertexBuffer->getIndexStrider(index_strider);
+
+ // build vertices and normals
+ LLStrider<LLVector3> pos;
+ pos = (LLVector3*) vf.mPositions; pos.setStride(16);
+ LLStrider<LLVector3> norm;
+ norm = (LLVector3*) vf.mNormals; norm.setStride(16);
+ LLStrider<LLVector2> tc;
+ tc = (LLVector2*) vf.mTexCoords; tc.setStride(8);
+
+ for (U32 i = 0; i < num_vertices; i++)
+ {
+ *(vertex_strider++) = *pos++;
+ LLVector3 normal = *norm++;
+ normal.normalize();
+ *(normal_strider++) = normal;
+ *(tc_strider++) = *tc++;
+ }
+
+ // build indices
+ for (U16 i = 0; i < num_indices; i++)
+ {
+ *(index_strider++) = vf.mIndices[i];
+ }
mVertexBuffer->unmapBuffer();
}
@@ -847,82 +847,82 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
//-----------------------------------------------------------------------------
BOOL LLImagePreviewSculpted::render()
{
- mNeedsUpdate = FALSE;
- LLGLSUIDefault def;
- LLGLDisable no_blend(GL_BLEND);
- LLGLEnable cull(GL_CULL_FACE);
- LLGLDepthTest depth(GL_TRUE);
+ mNeedsUpdate = FALSE;
+ LLGLSUIDefault def;
+ LLGLDisable no_blend(GL_BLEND);
+ LLGLEnable cull(GL_CULL_FACE);
+ LLGLDepthTest depth(GL_TRUE);
+
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadIdentity();
- gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+ gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.loadIdentity();
-
- gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
+ gUIProgram.bind();
- gUIProgram.bind();
+ gl_rect_2d_simple( mFullWidth, mFullHeight );
- gl_rect_2d_simple( mFullWidth, mFullHeight );
-
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
- glClear(GL_DEPTH_BUFFER_BIT);
-
- LLVector3 target_pos(0, 0, 0);
+ glClear(GL_DEPTH_BUFFER_BIT);
- LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
- LLQuaternion(mCameraYaw, LLVector3::z_axis);
+ LLVector3 target_pos(0, 0, 0);
- LLQuaternion av_rot = camera_rot;
- LLViewerCamera::getInstance()->setOriginAndLookAt(
- target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera
- LLVector3::z_axis, // up
- target_pos + (mCameraOffset * av_rot) ); // point of interest
+ LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
+ LLQuaternion(mCameraYaw, LLVector3::z_axis);
- stop_glerror();
+ LLQuaternion av_rot = camera_rot;
+ LLViewerCamera::getInstance()->setOriginAndLookAt(
+ target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera
+ LLVector3::z_axis, // up
+ target_pos + (mCameraOffset * av_rot) ); // point of interest
- LLViewerCamera::getInstance()->setAspect((F32) mFullWidth / mFullHeight);
- LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
- LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
+ stop_glerror();
- const LLVolumeFace &vf = mVolume->getVolumeFace(0);
- U32 num_indices = vf.mNumIndices;
-
- gPipeline.enableLightsAvatar();
+ LLViewerCamera::getInstance()->setAspect((F32) mFullWidth / mFullHeight);
+ LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
+ LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
- gObjectPreviewProgram.bind();
- gPipeline.enableLightsPreview();
+ const LLVolumeFace &vf = mVolume->getVolumeFace(0);
+ U32 num_indices = vf.mNumIndices;
- gGL.pushMatrix();
- const F32 SCALE = 1.25f;
- gGL.scalef(SCALE, SCALE, SCALE);
- const F32 BRIGHTNESS = 0.9f;
- gGL.diffuseColor3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
+ gPipeline.enableLightsAvatar();
- mVertexBuffer->setBuffer();
- mVertexBuffer->draw(LLRender::TRIANGLES, num_indices, 0);
+ gObjectPreviewProgram.bind();
+ gPipeline.enableLightsPreview();
- gGL.popMatrix();
+ gGL.pushMatrix();
+ const F32 SCALE = 1.25f;
+ gGL.scalef(SCALE, SCALE, SCALE);
+ const F32 BRIGHTNESS = 0.9f;
+ gGL.diffuseColor3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
- gObjectPreviewProgram.unbind();
+ mVertexBuffer->setBuffer();
+ mVertexBuffer->draw(LLRender::TRIANGLES, num_indices, 0);
- return TRUE;
+ gGL.popMatrix();
+
+ gObjectPreviewProgram.unbind();
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
// refresh()
//-----------------------------------------------------------------------------
void LLImagePreviewSculpted::refresh()
-{
- mNeedsUpdate = TRUE;
+{
+ mNeedsUpdate = TRUE;
}
//-----------------------------------------------------------------------------
@@ -930,9 +930,9 @@ void LLImagePreviewSculpted::refresh()
//-----------------------------------------------------------------------------
void LLImagePreviewSculpted::rotate(F32 yaw_radians, F32 pitch_radians)
{
- mCameraYaw = mCameraYaw + yaw_radians;
+ mCameraYaw = mCameraYaw + yaw_radians;
- mCameraPitch = llclamp(mCameraPitch + pitch_radians, F_PI_BY_TWO * -0.8f, F_PI_BY_TWO * 0.8f);
+ mCameraPitch = llclamp(mCameraPitch + pitch_radians, F_PI_BY_TWO * -0.8f, F_PI_BY_TWO * 0.8f);
}
//-----------------------------------------------------------------------------
@@ -940,11 +940,11 @@ void LLImagePreviewSculpted::rotate(F32 yaw_radians, F32 pitch_radians)
//-----------------------------------------------------------------------------
void LLImagePreviewSculpted::zoom(F32 zoom_amt)
{
- mCameraZoom = llclamp(mCameraZoom + zoom_amt, 1.f, 10.f);
+ mCameraZoom = llclamp(mCameraZoom + zoom_amt, 1.f, 10.f);
}
void LLImagePreviewSculpted::pan(F32 right, F32 up)
{
- mCameraOffset.mV[VY] = llclamp(mCameraOffset.mV[VY] + right * mCameraDistance / mCameraZoom, -1.f, 1.f);
- mCameraOffset.mV[VZ] = llclamp(mCameraOffset.mV[VZ] + up * mCameraDistance / mCameraZoom, -1.f, 1.f);
+ mCameraOffset.mV[VY] = llclamp(mCameraOffset.mV[VY] + right * mCameraDistance / mCameraZoom, -1.f, 1.f);
+ mCameraOffset.mV[VZ] = llclamp(mCameraOffset.mV[VZ] + up * mCameraDistance / mCameraZoom, -1.f, 1.f);
}
diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h
index d034622c35..9e764e4972 100644
--- a/indra/newview/llfloaterimagepreview.h
+++ b/indra/newview/llfloaterimagepreview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterimagepreview.h
* @brief LLFloaterImagePreview class definition
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,102 +43,102 @@ class LLVolume;
class LLImagePreviewSculpted : public LLViewerDynamicTexture
{
protected:
- virtual ~LLImagePreviewSculpted();
+ virtual ~LLImagePreviewSculpted();
public:
- LLImagePreviewSculpted(S32 width, S32 height);
+ LLImagePreviewSculpted(S32 width, S32 height);
- /*virtual*/ S8 getType() const ;
+ /*virtual*/ S8 getType() const ;
- void setPreviewTarget(LLImageRaw *imagep, F32 distance);
- void setTexture(U32 name) { mTextureName = name; }
+ void setPreviewTarget(LLImageRaw *imagep, F32 distance);
+ void setTexture(U32 name) { mTextureName = name; }
- BOOL render();
- void refresh();
- void rotate(F32 yaw_radians, F32 pitch_radians);
- void zoom(F32 zoom_amt);
- void pan(F32 right, F32 up);
- virtual BOOL needsRender() { return mNeedsUpdate; }
+ BOOL render();
+ void refresh();
+ void rotate(F32 yaw_radians, F32 pitch_radians);
+ void zoom(F32 zoom_amt);
+ void pan(F32 right, F32 up);
+ virtual BOOL needsRender() { return mNeedsUpdate; }
protected:
- BOOL mNeedsUpdate;
- U32 mTextureName;
- F32 mCameraDistance;
- F32 mCameraYaw;
- F32 mCameraPitch;
- F32 mCameraZoom;
- LLVector3 mCameraOffset;
- LLPointer<LLVolume> mVolume;
- LLPointer<LLVertexBuffer> mVertexBuffer;
+ BOOL mNeedsUpdate;
+ U32 mTextureName;
+ F32 mCameraDistance;
+ F32 mCameraYaw;
+ F32 mCameraPitch;
+ F32 mCameraZoom;
+ LLVector3 mCameraOffset;
+ LLPointer<LLVolume> mVolume;
+ LLPointer<LLVertexBuffer> mVertexBuffer;
};
class LLImagePreviewAvatar : public LLViewerDynamicTexture
{
protected:
- virtual ~LLImagePreviewAvatar();
+ virtual ~LLImagePreviewAvatar();
public:
- LLImagePreviewAvatar(S32 width, S32 height);
+ LLImagePreviewAvatar(S32 width, S32 height);
- /*virtual*/ S8 getType() const ;
+ /*virtual*/ S8 getType() const ;
- void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male);
- void setTexture(U32 name) { mTextureName = name; }
- void clearPreviewTexture(const std::string& mesh_name);
+ void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male);
+ void setTexture(U32 name) { mTextureName = name; }
+ void clearPreviewTexture(const std::string& mesh_name);
- BOOL render();
- void refresh();
- void rotate(F32 yaw_radians, F32 pitch_radians);
- void zoom(F32 zoom_amt);
- void pan(F32 right, F32 up);
- virtual BOOL needsRender() { return mNeedsUpdate; }
+ BOOL render();
+ void refresh();
+ void rotate(F32 yaw_radians, F32 pitch_radians);
+ void zoom(F32 zoom_amt);
+ void pan(F32 right, F32 up);
+ virtual BOOL needsRender() { return mNeedsUpdate; }
protected:
- BOOL mNeedsUpdate;
- LLJoint* mTargetJoint;
- LLViewerJointMesh* mTargetMesh;
- F32 mCameraDistance;
- F32 mCameraYaw;
- F32 mCameraPitch;
- F32 mCameraZoom;
- LLVector3 mCameraOffset;
- LLPointer<LLVOAvatar> mDummyAvatar;
- U32 mTextureName;
+ BOOL mNeedsUpdate;
+ LLJoint* mTargetJoint;
+ LLViewerJointMesh* mTargetMesh;
+ F32 mCameraDistance;
+ F32 mCameraYaw;
+ F32 mCameraPitch;
+ F32 mCameraZoom;
+ LLVector3 mCameraOffset;
+ LLPointer<LLVOAvatar> mDummyAvatar;
+ U32 mTextureName;
};
class LLFloaterImagePreview : public LLFloaterNameDesc
{
public:
- LLFloaterImagePreview(const std::string& filename);
- virtual ~LLFloaterImagePreview();
+ LLFloaterImagePreview(const std::string& filename);
+ virtual ~LLFloaterImagePreview();
+
+ virtual BOOL postBuild();
- virtual BOOL postBuild();
-
- BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- BOOL handleHover(S32 x, S32 y, MASK mask);
- BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ BOOL handleHover(S32 x, S32 y, MASK mask);
+ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
- static void onMouseCaptureLostImagePreview(LLMouseHandler*);
+ static void onMouseCaptureLostImagePreview(LLMouseHandler*);
- void clearAllPreviewTextures();
+ void clearAllPreviewTextures();
protected:
- static void onPreviewTypeCommit(LLUICtrl*,void*);
- void draw();
- bool loadImage(const std::string& filename);
-
- LLPointer<LLImageRaw> mRawImagep;
- LLPointer<LLImagePreviewAvatar> mAvatarPreview;
- LLPointer<LLImagePreviewSculpted> mSculptedPreview;
- S32 mLastMouseX;
- S32 mLastMouseY;
- LLRect mPreviewRect;
- LLRectf mPreviewImageRect;
- LLPointer<LLViewerTexture> mImagep ;
-
- std::string mImageLoadError;
+ static void onPreviewTypeCommit(LLUICtrl*,void*);
+ void draw();
+ bool loadImage(const std::string& filename);
+
+ LLPointer<LLImageRaw> mRawImagep;
+ LLPointer<LLImagePreviewAvatar> mAvatarPreview;
+ LLPointer<LLImagePreviewSculpted> mSculptedPreview;
+ S32 mLastMouseX;
+ S32 mLastMouseY;
+ LLRect mPreviewRect;
+ LLRectf mPreviewImageRect;
+ LLPointer<LLViewerTexture> mImagep ;
+
+ std::string mImageLoadError;
};
#endif // LL_LLFLOATERIMAGEPREVIEW_H
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 44938d5509..8d0f0a0e57 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterimcontainer.cpp
* @brief Multifloater containing active IM sessions in separate tab container tabs
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,91 +67,91 @@ const F32 EVENTS_PER_IDLE_LOOP_MIN_PERCENTAGE = 0.01f; // process a minimum of 1
// LLFloaterIMContainer
//
LLFloaterIMContainer::LLFloaterIMContainer(const LLSD& seed, const Params& params /*= getDefaultParams()*/)
-: LLMultiFloater(seed, params),
- mExpandCollapseBtn(NULL),
- mConversationsRoot(NULL),
- mConversationsEventStream("ConversationsEvents"),
- mInitialized(false),
- mIsFirstLaunch(true),
- mConversationEventQueue()
+: LLMultiFloater(seed, params),
+ mExpandCollapseBtn(NULL),
+ mConversationsRoot(NULL),
+ mConversationsEventStream("ConversationsEvents"),
+ mInitialized(false),
+ mIsFirstLaunch(true),
+ mConversationEventQueue()
{
mEnableCallbackRegistrar.add("IMFloaterContainer.Check", boost::bind(&LLFloaterIMContainer::isActionChecked, this, _2));
- mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLFloaterIMContainer::onCustomAction, this, _2));
-
- mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLFloaterIMContainer::checkContextMenuItem, this, _2));
- mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLFloaterIMContainer::enableContextMenuItem, this, _2));
- mEnableCallbackRegistrar.add("Avatar.VisibleItem", boost::bind(&LLFloaterIMContainer::visibleContextMenuItem, this, _2));
+ mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLFloaterIMContainer::onCustomAction, this, _2));
+
+ mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLFloaterIMContainer::checkContextMenuItem, this, _2));
+ mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLFloaterIMContainer::enableContextMenuItem, this, _2));
+ mEnableCallbackRegistrar.add("Avatar.VisibleItem", boost::bind(&LLFloaterIMContainer::visibleContextMenuItem, this, _2));
mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLFloaterIMContainer::doToSelected, this, _2));
-
+
mCommitCallbackRegistrar.add("Group.DoToSelected", boost::bind(&LLFloaterIMContainer::doToSelectedGroup, this, _2));
- // Firstly add our self to IMSession observers, so we catch session events
+ // Firstly add our self to IMSession observers, so we catch session events
LLIMMgr::getInstance()->addSessionObserver(this);
- mAutoResize = FALSE;
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this);
+ mAutoResize = FALSE;
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this);
}
LLFloaterIMContainer::~LLFloaterIMContainer()
{
- mConversationsEventStream.stopListening("ConversationsRefresh");
- gIdleCallbacks.deleteFunction(idle, this);
- mNewMessageConnection.disconnect();
- LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
-
- if (mMicroChangedSignal.connected())
- {
- mMicroChangedSignal.disconnect();
- }
+ mConversationsEventStream.stopListening("ConversationsRefresh");
+ gIdleCallbacks.deleteFunction(idle, this);
+ mNewMessageConnection.disconnect();
+ LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
+
+ if (mMicroChangedSignal.connected())
+ {
+ mMicroChangedSignal.disconnect();
+ }
- gSavedPerAccountSettings.setBOOL("ConversationsListPaneCollapsed", mConversationsPane->isCollapsed());
- gSavedPerAccountSettings.setBOOL("ConversationsMessagePaneCollapsed", mMessagesPane->isCollapsed());
- gSavedPerAccountSettings.setBOOL("ConversationsParticipantListCollapsed", !isParticipantListExpanded());
+ gSavedPerAccountSettings.setBOOL("ConversationsListPaneCollapsed", mConversationsPane->isCollapsed());
+ gSavedPerAccountSettings.setBOOL("ConversationsMessagePaneCollapsed", mMessagesPane->isCollapsed());
+ gSavedPerAccountSettings.setBOOL("ConversationsParticipantListCollapsed", !isParticipantListExpanded());
- if (LLIMMgr::instanceExists())
- {
- LLIMMgr::getInstance()->removeSessionObserver(this);
- }
+ if (LLIMMgr::instanceExists())
+ {
+ LLIMMgr::getInstance()->removeSessionObserver(this);
+ }
}
void LLFloaterIMContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg)
{
- addConversationListItem(session_id);
- LLFloaterIMSessionTab::addToHost(session_id);
+ addConversationListItem(session_id);
+ LLFloaterIMSessionTab::addToHost(session_id);
}
void LLFloaterIMContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id)
{
- if(!isInVisibleChain())
- {
- setVisibleAndFrontmost(false);
- }
- selectConversationPair(session_id, true);
- collapseMessagesPane(false);
+ if(!isInVisibleChain())
+ {
+ setVisibleAndFrontmost(false);
+ }
+ selectConversationPair(session_id, true);
+ collapseMessagesPane(false);
}
void LLFloaterIMContainer::sessionVoiceOrIMStarted(const LLUUID& session_id)
{
- addConversationListItem(session_id);
- LLFloaterIMSessionTab::addToHost(session_id);
+ addConversationListItem(session_id);
+ LLFloaterIMSessionTab::addToHost(session_id);
}
void LLFloaterIMContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id)
{
- // The general strategy when a session id is modified is to delete all related objects and create them anew.
-
- // Note however that the LLFloaterIMSession has its session id updated through a call to sessionInitReplyReceived()
- // and do not need to be deleted and recreated (trying this creates loads of problems). We do need however to suppress
- // its related mSessions record as it's indexed with the wrong id.
- // Grabbing the updated LLFloaterIMSession and readding it in mSessions will eventually be done by addConversationListItem().
- mSessions.erase(old_session_id);
+ // The general strategy when a session id is modified is to delete all related objects and create them anew.
- // Delete the model and participants related to the old session
- bool change_focus = removeConversationListItem(old_session_id);
+ // Note however that the LLFloaterIMSession has its session id updated through a call to sessionInitReplyReceived()
+ // and do not need to be deleted and recreated (trying this creates loads of problems). We do need however to suppress
+ // its related mSessions record as it's indexed with the wrong id.
+ // Grabbing the updated LLFloaterIMSession and readding it in mSessions will eventually be done by addConversationListItem().
+ mSessions.erase(old_session_id);
- // Create a new conversation with the new id
- addConversationListItem(new_session_id, change_focus);
- LLFloaterIMSessionTab::addToHost(new_session_id);
+ // Delete the model and participants related to the old session
+ bool change_focus = removeConversationListItem(old_session_id);
+
+ // Create a new conversation with the new id
+ addConversationListItem(new_session_id, change_focus);
+ LLFloaterIMSessionTab::addToHost(new_session_id);
}
@@ -170,7 +170,7 @@ LLConversationItem* LLFloaterIMContainer::getSessionModel(const LLUUID& session_
void LLFloaterIMContainer::sessionRemoved(const LLUUID& session_id)
{
- removeConversationListItem(session_id);
+ removeConversationListItem(session_id);
}
// static
@@ -178,38 +178,38 @@ void LLFloaterIMContainer::onCurrentChannelChanged(const LLUUID& session_id)
{
if (session_id != LLUUID::null)
{
- LLFloaterIMContainer::getInstance()->showConversation(session_id);
+ LLFloaterIMContainer::getInstance()->showConversation(session_id);
}
}
BOOL LLFloaterIMContainer::postBuild()
{
- mOrigMinWidth = getMinWidth();
- mOrigMinHeight = getMinHeight();
+ mOrigMinWidth = getMinWidth();
+ mOrigMinHeight = getMinHeight();
+
+ mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLFloaterIMContainer::onNewMessageReceived, this, _1));
+ // Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button
+ // mTabContainer will be initialized in LLMultiFloater::addChild()
- mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLFloaterIMContainer::onNewMessageReceived, this, _1));
- // Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button
- // mTabContainer will be initialized in LLMultiFloater::addChild()
-
- setTabContainer(getChild<LLTabContainer>("im_box_tab_container"));
- mStubPanel = getChild<LLPanel>("stub_panel");
+ setTabContainer(getChild<LLTabContainer>("im_box_tab_container"));
+ mStubPanel = getChild<LLPanel>("stub_panel");
mStubTextBox = getChild<LLTextBox>("stub_textbox");
mStubTextBox->setURLClickedCallback(boost::bind(&LLFloaterIMContainer::returnFloaterToHost, this));
- mConversationsStack = getChild<LLLayoutStack>("conversations_stack");
- mConversationsPane = getChild<LLLayoutPanel>("conversations_layout_panel");
- mMessagesPane = getChild<LLLayoutPanel>("messages_layout_panel");
-
- mConversationsListPanel = getChild<LLPanel>("conversations_list_panel");
+ mConversationsStack = getChild<LLLayoutStack>("conversations_stack");
+ mConversationsPane = getChild<LLLayoutPanel>("conversations_layout_panel");
+ mMessagesPane = getChild<LLLayoutPanel>("messages_layout_panel");
- // Open IM session with selected participant on double click event
- mConversationsListPanel->setDoubleClickCallback(boost::bind(&LLFloaterIMContainer::doToSelected, this, LLSD("im")));
+ mConversationsListPanel = getChild<LLPanel>("conversations_list_panel");
- // The resize limits for LLFloaterIMContainer should be updated, based on current values of width of conversation and message panels
- mConversationsPane->getResizeBar()->setResizeListener(boost::bind(&LLFloaterIMContainer::assignResizeLimits, this));
+ // Open IM session with selected participant on double click event
+ mConversationsListPanel->setDoubleClickCallback(boost::bind(&LLFloaterIMContainer::doToSelected, this, LLSD("im")));
- // Create the root model and view for all conversation sessions
- LLConversationItem* base_item = new LLConversationItem(getRootViewModel());
+ // The resize limits for LLFloaterIMContainer should be updated, based on current values of width of conversation and message panels
+ mConversationsPane->getResizeBar()->setResizeListener(boost::bind(&LLFloaterIMContainer::assignResizeLimits, this));
+
+ // Create the root model and view for all conversation sessions
+ LLConversationItem* base_item = new LLConversationItem(getRootViewModel());
LLFolderView::Params p(LLUICtrlFactory::getDefaultParams<LLFolderView>());
p.name = getName();
@@ -222,249 +222,249 @@ BOOL LLFloaterIMContainer::postBuild()
p.root = NULL;
p.use_ellipses = true;
p.options_menu = "menu_conversation.xml";
- mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p);
+ mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p);
mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar);
- mConversationsRoot->setEnableRegistrar(&mEnableCallbackRegistrar);
-
- // Add listener to conversation model events
- mConversationsEventStream.listen("ConversationsRefresh", boost::bind(&LLFloaterIMContainer::onConversationModelEvent, this, _1));
-
- // a scroller for folder view
- LLRect scroller_view_rect = mConversationsListPanel->getRect();
- scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
- scroller_view_rect.mBottom += getChild<LLLayoutStack>("conversations_pane_buttons_stack")->getRect().getHeight();
- LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams<LLFolderViewScrollContainer>());
- scroller_params.rect(scroller_view_rect);
-
- LLScrollContainer* scroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
- scroller->setFollowsAll();
- mConversationsListPanel->addChild(scroller);
- scroller->addChild(mConversationsRoot);
- mConversationsRoot->setScrollContainer(scroller);
- mConversationsRoot->setFollowsAll();
- mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox);
-
- addConversationListItem(LLUUID()); // manually add nearby chat
-
- mExpandCollapseBtn = getChild<LLButton>("expand_collapse_btn");
- mExpandCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onExpandCollapseButtonClicked, this));
- mStubCollapseBtn = getChild<LLButton>("stub_collapse_btn");
- mStubCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onStubCollapseButtonClicked, this));
+ mConversationsRoot->setEnableRegistrar(&mEnableCallbackRegistrar);
+
+ // Add listener to conversation model events
+ mConversationsEventStream.listen("ConversationsRefresh", boost::bind(&LLFloaterIMContainer::onConversationModelEvent, this, _1));
+
+ // a scroller for folder view
+ LLRect scroller_view_rect = mConversationsListPanel->getRect();
+ scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
+ scroller_view_rect.mBottom += getChild<LLLayoutStack>("conversations_pane_buttons_stack")->getRect().getHeight();
+ LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams<LLFolderViewScrollContainer>());
+ scroller_params.rect(scroller_view_rect);
+
+ LLScrollContainer* scroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
+ scroller->setFollowsAll();
+ mConversationsListPanel->addChild(scroller);
+ scroller->addChild(mConversationsRoot);
+ mConversationsRoot->setScrollContainer(scroller);
+ mConversationsRoot->setFollowsAll();
+ mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox);
+
+ addConversationListItem(LLUUID()); // manually add nearby chat
+
+ mExpandCollapseBtn = getChild<LLButton>("expand_collapse_btn");
+ mExpandCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onExpandCollapseButtonClicked, this));
+ mStubCollapseBtn = getChild<LLButton>("stub_collapse_btn");
+ mStubCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onStubCollapseButtonClicked, this));
mSpeakBtn = getChild<LLButton>("speak_btn");
- mSpeakBtn->setMouseDownCallback(boost::bind(&LLFloaterIMContainer::onSpeakButtonPressed, this));
- mSpeakBtn->setMouseUpCallback(boost::bind(&LLFloaterIMContainer::onSpeakButtonReleased, this));
+ mSpeakBtn->setMouseDownCallback(boost::bind(&LLFloaterIMContainer::onSpeakButtonPressed, this));
+ mSpeakBtn->setMouseUpCallback(boost::bind(&LLFloaterIMContainer::onSpeakButtonReleased, this));
- childSetAction("add_btn", boost::bind(&LLFloaterIMContainer::onAddButtonClicked, this));
+ childSetAction("add_btn", boost::bind(&LLFloaterIMContainer::onAddButtonClicked, this));
- collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed"));
- collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed"), false);
- LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false));
- mMicroChangedSignal = LLVoiceClient::getInstance()->MicroChangedCallback(boost::bind(&LLFloaterIMContainer::updateSpeakBtnState, this));
+ collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed"));
+ collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed"), false);
+ LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false));
+ mMicroChangedSignal = LLVoiceClient::getInstance()->MicroChangedCallback(boost::bind(&LLFloaterIMContainer::updateSpeakBtnState, this));
- if (! mMessagesPane->isCollapsed() && ! mConversationsPane->isCollapsed())
- {
- S32 conversations_panel_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth");
- LLRect conversations_panel_rect = mConversationsPane->getRect();
- conversations_panel_rect.mRight = conversations_panel_rect.mLeft + conversations_panel_width;
+ if (! mMessagesPane->isCollapsed() && ! mConversationsPane->isCollapsed())
+ {
+ S32 conversations_panel_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth");
+ LLRect conversations_panel_rect = mConversationsPane->getRect();
+ conversations_panel_rect.mRight = conversations_panel_rect.mLeft + conversations_panel_width;
mConversationsPane->handleReshape(conversations_panel_rect, TRUE);
- }
-
- // Init the sort order now that the root had been created
- setSortOrder(LLConversationSort(gSavedSettings.getU32("ConversationSortOrder")));
-
- //We should expand nearby chat participants list for the new user
- if(gAgent.isFirstLogin() || !gSavedPerAccountSettings.getBOOL("ConversationsParticipantListCollapsed"))
- {
- expandConversation();
- }
- // Keep the xml set title around for when we have to overwrite it
- mGeneralTitle = getTitle();
-
- mInitialized = true;
-
- mIsFirstOpen = true;
-
- // Add callbacks:
- // We'll take care of view updates on idle
- gIdleCallbacks.addFunction(idle, this);
- // When display name option change, we need to reload all participant names
- LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&LLFloaterIMContainer::processParticipantsStyleUpdate, this));
+ }
+
+ // Init the sort order now that the root had been created
+ setSortOrder(LLConversationSort(gSavedSettings.getU32("ConversationSortOrder")));
+
+ //We should expand nearby chat participants list for the new user
+ if(gAgent.isFirstLogin() || !gSavedPerAccountSettings.getBOOL("ConversationsParticipantListCollapsed"))
+ {
+ expandConversation();
+ }
+ // Keep the xml set title around for when we have to overwrite it
+ mGeneralTitle = getTitle();
+
+ mInitialized = true;
+
+ mIsFirstOpen = true;
+
+ // Add callbacks:
+ // We'll take care of view updates on idle
+ gIdleCallbacks.addFunction(idle, this);
+ // When display name option change, we need to reload all participant names
+ LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&LLFloaterIMContainer::processParticipantsStyleUpdate, this));
mParticipantRefreshTimer.setTimerExpirySec(0);
mParticipantRefreshTimer.start();
- return TRUE;
+ return TRUE;
}
void LLFloaterIMContainer::onOpen(const LLSD& key)
{
- LLMultiFloater::onOpen(key);
- reSelectConversation();
- assignResizeLimits();
+ LLMultiFloater::onOpen(key);
+ reSelectConversation();
+ assignResizeLimits();
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession);
- session_floater->onOpen(key);
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession);
+ session_floater->onOpen(key);
}
// virtual
void LLFloaterIMContainer::addFloater(LLFloater* floaterp,
- BOOL select_added_floater,
- LLTabContainer::eInsertionPoint insertion_point)
+ BOOL select_added_floater,
+ LLTabContainer::eInsertionPoint insertion_point)
{
- if(!floaterp) return;
+ if(!floaterp) return;
- // already here
- if (floaterp->getHost() == this)
- {
- openFloater(floaterp->getKey());
- return;
- }
+ // already here
+ if (floaterp->getHost() == this)
+ {
+ openFloater(floaterp->getKey());
+ return;
+ }
- LLUUID session_id = floaterp->getKey();
-
- // Add the floater
- LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point);
+ LLUUID session_id = floaterp->getKey();
+ // Add the floater
+ LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point);
-
- LLIconCtrl* icon = 0;
- bool is_in_group = gAgent.isInGroup(session_id, TRUE);
- LLUUID icon_id;
- if (is_in_group)
- {
- LLGroupIconCtrl::Params icon_params;
- icon_params.group_id = session_id;
- icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params);
- icon_id = session_id;
- mSessions[session_id] = floaterp;
- floaterp->mCloseSignal.connect(boost::bind(&LLFloaterIMContainer::onCloseFloater, this, session_id));
- }
- else
- { LLUUID avatar_id = session_id.notNull()?
- LLIMModel::getInstance()->getOtherParticipantID(session_id) : LLUUID();
+ LLIconCtrl* icon = 0;
+ bool is_in_group = gAgent.isInGroup(session_id, TRUE);
+ LLUUID icon_id;
- LLAvatarIconCtrl::Params icon_params;
- icon_params.avatar_id = avatar_id;
- icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params);
- icon_id = avatar_id;
+ if (is_in_group)
+ {
+ LLGroupIconCtrl::Params icon_params;
+ icon_params.group_id = session_id;
+ icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params);
+ icon_id = session_id;
- mSessions[session_id] = floaterp;
- floaterp->mCloseSignal.connect(boost::bind(&LLFloaterIMContainer::onCloseFloater, this, session_id));
- }
+ mSessions[session_id] = floaterp;
+ floaterp->mCloseSignal.connect(boost::bind(&LLFloaterIMContainer::onCloseFloater, this, session_id));
+ }
+ else
+ { LLUUID avatar_id = session_id.notNull()?
+ LLIMModel::getInstance()->getOtherParticipantID(session_id) : LLUUID();
- LLFloaterIMSessionTab* floater = LLFloaterIMSessionTab::getConversation(session_id);
- if (floater)
- {
- floater->updateChatIcon(icon_id);
- }
+ LLAvatarIconCtrl::Params icon_params;
+ icon_params.avatar_id = avatar_id;
+ icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params);
+ icon_id = avatar_id;
- // forced resize of the floater
- LLRect wrapper_rect = this->mTabContainer->getLocalRect();
- floaterp->setRect(wrapper_rect);
+ mSessions[session_id] = floaterp;
+ floaterp->mCloseSignal.connect(boost::bind(&LLFloaterIMContainer::onCloseFloater, this, session_id));
+ }
- mTabContainer->setTabImage(floaterp, icon);
+ LLFloaterIMSessionTab* floater = LLFloaterIMSessionTab::getConversation(session_id);
+ if (floater)
+ {
+ floater->updateChatIcon(icon_id);
+ }
+
+ // forced resize of the floater
+ LLRect wrapper_rect = this->mTabContainer->getLocalRect();
+ floaterp->setRect(wrapper_rect);
+
+ mTabContainer->setTabImage(floaterp, icon);
}
void LLFloaterIMContainer::onCloseFloater(LLUUID& id)
{
- mSessions.erase(id);
- setFocus(TRUE);
+ mSessions.erase(id);
+ setFocus(TRUE);
}
void LLFloaterIMContainer::onNewMessageReceived(const LLSD& data)
{
- LLUUID session_id = data["session_id"].asUUID();
- LLFloater* floaterp = get_ptr_in_map(mSessions, session_id);
- LLFloater* current_floater = LLMultiFloater::getActiveFloater();
+ LLUUID session_id = data["session_id"].asUUID();
+ LLFloater* floaterp = get_ptr_in_map(mSessions, session_id);
+ LLFloater* current_floater = LLMultiFloater::getActiveFloater();
- if(floaterp && current_floater && floaterp != current_floater)
- {
- if(LLMultiFloater::isFloaterFlashing(floaterp))
- LLMultiFloater::setFloaterFlashing(floaterp, FALSE);
- LLMultiFloater::setFloaterFlashing(floaterp, TRUE);
- }
+ if(floaterp && current_floater && floaterp != current_floater)
+ {
+ if(LLMultiFloater::isFloaterFlashing(floaterp))
+ LLMultiFloater::setFloaterFlashing(floaterp, FALSE);
+ LLMultiFloater::setFloaterFlashing(floaterp, TRUE);
+ }
}
void LLFloaterIMContainer::onStubCollapseButtonClicked()
{
- collapseMessagesPane(true);
+ collapseMessagesPane(true);
}
void LLFloaterIMContainer::onSpeakButtonPressed()
{
- LLVoiceClient::getInstance()->inputUserControlState(true);
- updateSpeakBtnState();
+ LLVoiceClient::getInstance()->inputUserControlState(true);
+ updateSpeakBtnState();
}
void LLFloaterIMContainer::onSpeakButtonReleased()
{
- LLVoiceClient::getInstance()->inputUserControlState(false);
- updateSpeakBtnState();
+ LLVoiceClient::getInstance()->inputUserControlState(false);
+ updateSpeakBtnState();
}
void LLFloaterIMContainer::onExpandCollapseButtonClicked()
{
- if (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed()
- && gSavedPerAccountSettings.getBOOL("ConversationsExpandMessagePaneFirst"))
- {
- // Expand the messages pane from ultra minimized state
- // if it was collapsed last in order.
- collapseMessagesPane(false);
- }
- else
- {
- collapseConversationsPane(!mConversationsPane->isCollapsed());
- }
- reSelectConversation();
+ if (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed()
+ && gSavedPerAccountSettings.getBOOL("ConversationsExpandMessagePaneFirst"))
+ {
+ // Expand the messages pane from ultra minimized state
+ // if it was collapsed last in order.
+ collapseMessagesPane(false);
+ }
+ else
+ {
+ collapseConversationsPane(!mConversationsPane->isCollapsed());
+ }
+ reSelectConversation();
}
LLFloaterIMContainer* LLFloaterIMContainer::findInstance()
{
- return LLFloaterReg::findTypedInstance<LLFloaterIMContainer>("im_container");
+ return LLFloaterReg::findTypedInstance<LLFloaterIMContainer>("im_container");
}
LLFloaterIMContainer* LLFloaterIMContainer::getInstance()
{
- return LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ return LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
}
// Update all participants in the conversation lists
void LLFloaterIMContainer::processParticipantsStyleUpdate()
{
- // On each session in mConversationsItems
- for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++)
- {
- // Get the current session descriptors
- LLConversationItem* session_model = it_session->second;
- // Iterate through each model participant child
- LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = session_model->getChildrenBegin();
- LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = session_model->getChildrenEnd();
- while (current_participant_model != end_participant_model)
- {
- LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
+ // On each session in mConversationsItems
+ for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++)
+ {
+ // Get the current session descriptors
+ LLConversationItem* session_model = it_session->second;
+ // Iterate through each model participant child
+ LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = session_model->getChildrenBegin();
+ LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = session_model->getChildrenEnd();
+ while (current_participant_model != end_participant_model)
+ {
+ LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
if (participant_model)
{
// Get the avatar name for this participant id from the cache and update the model
participant_model->updateName();
}
- // Next participant
- current_participant_model++;
- }
- }
+ // Next participant
+ current_participant_model++;
+ }
+ }
}
// static
void LLFloaterIMContainer::idle(void* user_data)
{
- LLFloaterIMContainer* self = static_cast<LLFloaterIMContainer*>(user_data);
+ LLFloaterIMContainer* self = static_cast<LLFloaterIMContainer*>(user_data);
- self->idleProcessEvents();
+ self->idleProcessEvents();
- if (!self->getVisible() || self->isMinimized())
+ if (!self->getVisible() || self->isMinimized())
{
return;
}
@@ -575,110 +575,110 @@ void LLFloaterIMContainer::idleProcessEvents()
bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event)
{
- LLUUID id = event.get("session_uuid").asUUID();
- mConversationEventQueue[id].push_front(event);
- return true;
+ LLUUID id = event.get("session_uuid").asUUID();
+ mConversationEventQueue[id].push_front(event);
+ return true;
}
void LLFloaterIMContainer::handleConversationModelEvent(const LLSD& event)
{
-
- // Note: In conversations, the model is not responsible for creating the view, which is a good thing. This means that
- // the model could change substantially and the view could echo only a portion of this model (though currently the
- // conversation view does echo the conversation model 1 to 1).
- // Consequently, the participant views need to be created either by the session view or by the container panel.
- // For the moment, we create them here, at the container level, to conform to the pattern implemented in llinventorypanel.cpp
- // (see LLInventoryPanel::buildNewViews()).
-
- std::string type = event.get("type").asString();
- LLUUID session_id = event.get("session_uuid").asUUID();
- LLUUID participant_id = event.get("participant_uuid").asUUID();
-
- LLConversationViewSession* session_view = dynamic_cast<LLConversationViewSession*>(get_ptr_in_map(mConversationsWidgets,session_id));
- if (!session_view)
- {
- // We skip events that are not associated with a session
- return;
- }
- LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id);
+
+ // Note: In conversations, the model is not responsible for creating the view, which is a good thing. This means that
+ // the model could change substantially and the view could echo only a portion of this model (though currently the
+ // conversation view does echo the conversation model 1 to 1).
+ // Consequently, the participant views need to be created either by the session view or by the container panel.
+ // For the moment, we create them here, at the container level, to conform to the pattern implemented in llinventorypanel.cpp
+ // (see LLInventoryPanel::buildNewViews()).
+
+ std::string type = event.get("type").asString();
+ LLUUID session_id = event.get("session_uuid").asUUID();
+ LLUUID participant_id = event.get("participant_uuid").asUUID();
+
+ LLConversationViewSession* session_view = dynamic_cast<LLConversationViewSession*>(get_ptr_in_map(mConversationsWidgets,session_id));
+ if (!session_view)
+ {
+ // We skip events that are not associated with a session
+ return;
+ }
+ LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id);
LLFloaterIMSessionTab *conversation_floater = (session_id.isNull() ?
- (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))
- : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(session_id)));
-
- if (type == "remove_participant")
- {
- // Remove a participant view from the hierarchical conversation list
- if (participant_view)
- {
- session_view->extractItem(participant_view);
- delete participant_view;
- session_view->refresh();
- mConversationsRoot->arrangeAll();
- }
- // Remove a participant view from the conversation floater
- if (conversation_floater)
- {
- conversation_floater->removeConversationViewParticipant(participant_id);
- }
- }
- else if (type == "add_participant")
- {
+ (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))
+ : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(session_id)));
+
+ if (type == "remove_participant")
+ {
+ // Remove a participant view from the hierarchical conversation list
+ if (participant_view)
+ {
+ session_view->extractItem(participant_view);
+ delete participant_view;
+ session_view->refresh();
+ mConversationsRoot->arrangeAll();
+ }
+ // Remove a participant view from the conversation floater
+ if (conversation_floater)
+ {
+ conversation_floater->removeConversationViewParticipant(participant_id);
+ }
+ }
+ else if (type == "add_participant")
+ {
LLConversationItem* item = getSessionModel(session_id);
- LLConversationItemSession* session_model = dynamic_cast<LLConversationItemSession*>(item);
- LLConversationItemParticipant* participant_model = (session_model ? session_model->findParticipant(participant_id) : NULL);
- LLIMModel::LLIMSession * im_sessionp = LLIMModel::getInstance()->findIMSession(session_id);
- if (!participant_view && session_model && participant_model)
- {
- if (session_id.isNull() || (im_sessionp && !im_sessionp->isP2PSessionType()))
- {
- participant_view = createConversationViewParticipant(participant_model);
- participant_view->addToFolder(session_view);
- participant_view->setVisible(TRUE);
- }
- }
- // Add a participant view to the conversation floater
- if (conversation_floater && participant_model)
- {
- bool skip_updating = im_sessionp && im_sessionp->isGroupChat();
- conversation_floater->addConversationViewParticipant(participant_model, !skip_updating);
- }
- }
- else if (type == "update_participant")
- {
- // Update the participant view in the hierarchical conversation list
- if (participant_view)
- {
- participant_view->refresh();
- }
- // Update the participant view in the conversation floater
- if (conversation_floater)
- {
- conversation_floater->updateConversationViewParticipant(participant_id);
- }
- }
- else if (type == "update_session")
- {
- session_view->refresh();
- }
-
- mConversationViewModel.requestSortAll();
- mConversationsRoot->arrangeAll();
+ LLConversationItemSession* session_model = dynamic_cast<LLConversationItemSession*>(item);
+ LLConversationItemParticipant* participant_model = (session_model ? session_model->findParticipant(participant_id) : NULL);
+ LLIMModel::LLIMSession * im_sessionp = LLIMModel::getInstance()->findIMSession(session_id);
+ if (!participant_view && session_model && participant_model)
+ {
+ if (session_id.isNull() || (im_sessionp && !im_sessionp->isP2PSessionType()))
+ {
+ participant_view = createConversationViewParticipant(participant_model);
+ participant_view->addToFolder(session_view);
+ participant_view->setVisible(TRUE);
+ }
+ }
+ // Add a participant view to the conversation floater
+ if (conversation_floater && participant_model)
+ {
+ bool skip_updating = im_sessionp && im_sessionp->isGroupChat();
+ conversation_floater->addConversationViewParticipant(participant_model, !skip_updating);
+ }
+ }
+ else if (type == "update_participant")
+ {
+ // Update the participant view in the hierarchical conversation list
+ if (participant_view)
+ {
+ participant_view->refresh();
+ }
+ // Update the participant view in the conversation floater
+ if (conversation_floater)
+ {
+ conversation_floater->updateConversationViewParticipant(participant_id);
+ }
+ }
+ else if (type == "update_session")
+ {
+ session_view->refresh();
+ }
+
+ mConversationViewModel.requestSortAll();
+ mConversationsRoot->arrangeAll();
}
void LLFloaterIMContainer::draw()
{
- LLFloater::draw();
+ LLFloater::draw();
}
void LLFloaterIMContainer::tabClose()
{
- if (mTabContainer->getTabCount() == 0)
- {
- // Do not close the container when every conversation is torn off because the user
- // still needs the conversation list. Simply collapse the message pane in that case.
- collapseMessagesPane(true);
- }
+ if (mTabContainer->getTabCount() == 0)
+ {
+ // Do not close the container when every conversation is torn off because the user
+ // still needs the conversation list. Simply collapse the message pane in that case.
+ collapseMessagesPane(true);
+ }
}
//Shows/hides the stub panel when a conversation floater is torn off
@@ -707,76 +707,76 @@ void LLFloaterIMContainer::showStub(bool stub_is_visible)
}
//Now show/hide the stub
- mStubPanel->setVisible(stub_is_visible);
+ mStubPanel->setVisible(stub_is_visible);
}
// listener for click on mStubTextBox2
void LLFloaterIMContainer::returnFloaterToHost()
{
- LLUUID session_id = this->getSelectedSession();
- LLFloaterIMSessionTab* floater = LLFloaterIMSessionTab::getConversation(session_id);
- floater->onTearOffClicked();
+ LLUUID session_id = this->getSelectedSession();
+ LLFloaterIMSessionTab* floater = LLFloaterIMSessionTab::getConversation(session_id);
+ floater->onTearOffClicked();
}
void LLFloaterIMContainer::setMinimized(BOOL b)
{
- bool was_minimized = isMinimized();
- LLMultiFloater::setMinimized(b);
+ bool was_minimized = isMinimized();
+ LLMultiFloater::setMinimized(b);
- //Switching from minimized to un-minimized
- if(was_minimized && !b)
- {
- gToolBarView->flashCommand(LLCommandId("chat"), false);
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(mSelectedSession);
+ //Switching from minimized to un-minimized
+ if(was_minimized && !b)
+ {
+ gToolBarView->flashCommand(LLCommandId("chat"), false);
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(mSelectedSession);
- if(session_floater && !session_floater->isTornOff())
- {
- //When in DND mode, remove stored IM notifications
- //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
- if(gAgent.isDoNotDisturb() && mSelectedSession.notNull())
- {
- LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSelectedSession);
- }
- }
- }
+ if(session_floater && !session_floater->isTornOff())
+ {
+ //When in DND mode, remove stored IM notifications
+ //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
+ if(gAgent.isDoNotDisturb() && mSelectedSession.notNull())
+ {
+ LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSelectedSession);
+ }
+ }
+ }
}
void LLFloaterIMContainer::setVisible(BOOL visible)
{
LLFloaterIMNearbyChat* nearby_chat;
- if (visible)
- {
- // Make sure we have the Nearby Chat present when showing the conversation container
- nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if ((nearby_chat == NULL) || mIsFirstOpen)
- {
- mIsFirstOpen = false;
- // If not found, force the creation of the nearby chat conversation panel
- // *TODO: find a way to move this to XML as a default panel or something like that
- LLSD name("nearby_chat");
- LLFloaterReg::toggleInstanceOrBringToFront(name);
+ if (visible)
+ {
+ // Make sure we have the Nearby Chat present when showing the conversation container
+ nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ if ((nearby_chat == NULL) || mIsFirstOpen)
+ {
+ mIsFirstOpen = false;
+ // If not found, force the creation of the nearby chat conversation panel
+ // *TODO: find a way to move this to XML as a default panel or something like that
+ LLSD name("nearby_chat");
+ LLFloaterReg::toggleInstanceOrBringToFront(name);
selectConversationPair(LLUUID(NULL), false, false);
- }
-
- flashConversationItemWidget(mSelectedSession,false);
-
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(mSelectedSession);
- if(session_floater && !session_floater->isMinimized())
- {
- //When in DND mode, remove stored IM notifications
- //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
- if(gAgent.isDoNotDisturb() && mSelectedSession.notNull())
- {
- LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSelectedSession);
- }
- }
- }
-
- nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if (nearby_chat)
- {
- LLFloaterIMSessionTab::addToHost(LLUUID());
- }
+ }
+
+ flashConversationItemWidget(mSelectedSession,false);
+
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(mSelectedSession);
+ if(session_floater && !session_floater->isMinimized())
+ {
+ //When in DND mode, remove stored IM notifications
+ //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
+ if(gAgent.isDoNotDisturb() && mSelectedSession.notNull())
+ {
+ LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSelectedSession);
+ }
+ }
+ }
+
+ nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ if (nearby_chat)
+ {
+ LLFloaterIMSessionTab::addToHost(LLUUID());
+ }
if (!LLFloater::isQuitRequested())
{
@@ -797,191 +797,191 @@ void LLFloaterIMContainer::setVisible(BOOL visible)
}
}
}
-
- // Now, do the normal multifloater show/hide
- LLMultiFloater::setVisible(visible);
+
+ // Now, do the normal multifloater show/hide
+ LLMultiFloater::setVisible(visible);
}
void LLFloaterIMContainer::getDetachedConversationFloaters(floater_list_t& floaters)
{
- LLFloaterIMNearbyChat *nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ LLFloaterIMNearbyChat *nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- for (const auto& [key, fvi] : mConversationsWidgets)
- {
- LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(fvi);
- if (widget)
- {
- LLFloater* session_floater = widget->getSessionFloater();
+ for (const auto& [key, fvi] : mConversationsWidgets)
+ {
+ LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(fvi);
+ if (widget)
+ {
+ LLFloater* session_floater = widget->getSessionFloater();
- // Exclude nearby chat from output, as it should be handled separately
- if (session_floater && session_floater->isDetachedAndNotMinimized()
- && session_floater != nearby_chat)
- {
- floaters.push_back(session_floater);
- }
- }
- }
+ // Exclude nearby chat from output, as it should be handled separately
+ if (session_floater && session_floater->isDetachedAndNotMinimized()
+ && session_floater != nearby_chat)
+ {
+ floaters.push_back(session_floater);
+ }
+ }
+ }
}
void LLFloaterIMContainer::setVisibleAndFrontmost(BOOL take_focus, const LLSD& key)
{
- LLMultiFloater::setVisibleAndFrontmost(take_focus, key);
- // Do not select "Nearby Chat" conversation, since it will bring its window to front
- // Only select other sessions
- if (!getSelectedSession().isNull())
- {
+ LLMultiFloater::setVisibleAndFrontmost(take_focus, key);
+ // Do not select "Nearby Chat" conversation, since it will bring its window to front
+ // Only select other sessions
+ if (!getSelectedSession().isNull())
+ {
selectConversationPair(getSelectedSession(), false, take_focus);
- }
- if (mInitialized && mIsFirstLaunch)
- {
- collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed"));
- mIsFirstLaunch = false;
+ }
+ if (mInitialized && mIsFirstLaunch)
+ {
+ collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed"));
+ mIsFirstLaunch = false;
}
}
void LLFloaterIMContainer::updateResizeLimits()
{
- LLMultiFloater::updateResizeLimits();
- assignResizeLimits();
+ LLMultiFloater::updateResizeLimits();
+ assignResizeLimits();
}
bool LLFloaterIMContainer::isMessagesPaneCollapsed()
{
- return mMessagesPane->isCollapsed();
+ return mMessagesPane->isCollapsed();
}
bool LLFloaterIMContainer::isConversationsPaneCollapsed()
{
- return mConversationsPane->isCollapsed();
+ return mConversationsPane->isCollapsed();
}
void LLFloaterIMContainer::collapseMessagesPane(bool collapse)
{
- if (mMessagesPane->isCollapsed() == collapse)
- {
- return;
- }
+ if (mMessagesPane->isCollapsed() == collapse)
+ {
+ return;
+ }
- // Save current width of panels before collapsing/expanding right pane.
- S32 conv_pane_width = mConversationsPane->getRect().getWidth();
+ // Save current width of panels before collapsing/expanding right pane.
+ S32 conv_pane_width = mConversationsPane->getRect().getWidth();
S32 msg_pane_width = mMessagesPane->getRect().getWidth();
- if (collapse)
- {
- // Save the messages pane width before collapsing it.
- gSavedPerAccountSettings.setS32("ConversationsMessagePaneWidth", msg_pane_width);
+ if (collapse)
+ {
+ // Save the messages pane width before collapsing it.
+ gSavedPerAccountSettings.setS32("ConversationsMessagePaneWidth", msg_pane_width);
- // Save the order in which the panels are closed to reverse user's last action.
- gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", mConversationsPane->isCollapsed());
- }
+ // Save the order in which the panels are closed to reverse user's last action.
+ gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", mConversationsPane->isCollapsed());
+ }
- mConversationsPane->setIgnoreReshape(collapse);
+ mConversationsPane->setIgnoreReshape(collapse);
- // Show/hide the messages pane.
- mConversationsStack->collapsePanel(mMessagesPane, collapse);
+ // Show/hide the messages pane.
+ mConversationsStack->collapsePanel(mMessagesPane, collapse);
- // Make sure layout is updated before resizing conversation pane.
- mConversationsStack->updateLayout();
+ // Make sure layout is updated before resizing conversation pane.
+ mConversationsStack->updateLayout();
- reshapeFloaterAndSetResizeLimits(collapse, gSavedPerAccountSettings.getS32("ConversationsMessagePaneWidth"));
+ reshapeFloaterAndSetResizeLimits(collapse, gSavedPerAccountSettings.getS32("ConversationsMessagePaneWidth"));
- if (!collapse)
- {
- // Restore conversation's pane previous width after expanding messages pane.
- mConversationsPane->setTargetDim(conv_pane_width);
- }
+ if (!collapse)
+ {
+ // Restore conversation's pane previous width after expanding messages pane.
+ mConversationsPane->setTargetDim(conv_pane_width);
+ }
}
void LLFloaterIMContainer::collapseConversationsPane(bool collapse, bool save_is_allowed /*=true*/)
{
- if (mConversationsPane->isCollapsed() == collapse)
- {
- return;
- }
+ if (mConversationsPane->isCollapsed() == collapse)
+ {
+ return;
+ }
- LLView* button_panel = getChild<LLView>("conversations_pane_buttons_expanded");
- button_panel->setVisible(!collapse);
- mExpandCollapseBtn->setImageOverlay(getString(collapse ? "expand_icon" : "collapse_icon"));
+ LLView* button_panel = getChild<LLView>("conversations_pane_buttons_expanded");
+ button_panel->setVisible(!collapse);
+ mExpandCollapseBtn->setImageOverlay(getString(collapse ? "expand_icon" : "collapse_icon"));
- // Save current width of Conversation panel before collapsing/expanding right pane.
- S32 conv_pane_width = mConversationsPane->getRect().getWidth();
+ // Save current width of Conversation panel before collapsing/expanding right pane.
+ S32 conv_pane_width = mConversationsPane->getRect().getWidth();
- if (collapse && save_is_allowed)
- {
- // Save the conversations pane width before collapsing it.
- gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", conv_pane_width);
+ if (collapse && save_is_allowed)
+ {
+ // Save the conversations pane width before collapsing it.
+ gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", conv_pane_width);
- // Save the order in which the panels are closed to reverse user's last action.
- gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", !mMessagesPane->isCollapsed());
- }
+ // Save the order in which the panels are closed to reverse user's last action.
+ gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", !mMessagesPane->isCollapsed());
+ }
- mConversationsStack->collapsePanel(mConversationsPane, collapse);
- if (!collapse)
- {
- // Make sure layout is updated before resizing conversation pane.
- mConversationsStack->updateLayout();
- // Restore conversation's pane previous width.
- mConversationsPane->setTargetDim(gSavedPerAccountSettings.getS32("ConversationsListPaneWidth"));
- }
+ mConversationsStack->collapsePanel(mConversationsPane, collapse);
+ if (!collapse)
+ {
+ // Make sure layout is updated before resizing conversation pane.
+ mConversationsStack->updateLayout();
+ // Restore conversation's pane previous width.
+ mConversationsPane->setTargetDim(gSavedPerAccountSettings.getS32("ConversationsListPaneWidth"));
+ }
- S32 delta_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth")
- - mConversationsPane->getMinDim() - mConversationsStack->getPanelSpacing() + 1;
+ S32 delta_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth")
+ - mConversationsPane->getMinDim() - mConversationsStack->getPanelSpacing() + 1;
- reshapeFloaterAndSetResizeLimits(collapse, delta_width);
+ reshapeFloaterAndSetResizeLimits(collapse, delta_width);
- for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
- widget_it != mConversationsWidgets.end(); ++widget_it)
- {
- LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(widget_it->second);
- if (widget)
- {
- widget->toggleCollapsedMode(collapse);
+ for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
+ widget_it != mConversationsWidgets.end(); ++widget_it)
+ {
+ LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(widget_it->second);
+ if (widget)
+ {
+ widget->toggleCollapsedMode(collapse);
- // force closing all open conversations when collapsing to minimized state
- if (collapse)
- {
- widget->setOpen(false);
- }
- widget->requestArrange();
+ // force closing all open conversations when collapsing to minimized state
+ if (collapse)
+ {
+ widget->setOpen(false);
+ }
+ widget->requestArrange();
}
- }
+ }
}
void LLFloaterIMContainer::reshapeFloaterAndSetResizeLimits(bool collapse, S32 delta_width)
{
- LLRect floater_rect = getRect();
- floater_rect.mRight += ((collapse ? -1 : 1) * delta_width);
+ LLRect floater_rect = getRect();
+ floater_rect.mRight += ((collapse ? -1 : 1) * delta_width);
- // Set by_user = true so that reshaped rect is saved in user_settings.
- setShape(floater_rect, true);
- updateResizeLimits();
+ // Set by_user = true so that reshaped rect is saved in user_settings.
+ setShape(floater_rect, true);
+ updateResizeLimits();
- bool at_least_one_panel_is_expanded =
- ! (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed());
+ bool at_least_one_panel_is_expanded =
+ ! (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed());
- setCanResize(at_least_one_panel_is_expanded);
- setCanMinimize(at_least_one_panel_is_expanded);
+ setCanResize(at_least_one_panel_is_expanded);
+ setCanMinimize(at_least_one_panel_is_expanded);
assignResizeLimits();
}
void LLFloaterIMContainer::assignResizeLimits()
{
- bool is_conv_pane_expanded = !mConversationsPane->isCollapsed();
- bool is_msg_pane_expanded = !mMessagesPane->isCollapsed();
+ bool is_conv_pane_expanded = !mConversationsPane->isCollapsed();
+ bool is_msg_pane_expanded = !mMessagesPane->isCollapsed();
S32 summary_width_of_visible_borders = (is_msg_pane_expanded ? mConversationsStack->getPanelSpacing() : 0) + 1;
- S32 conv_pane_target_width = is_conv_pane_expanded
- ? ( is_msg_pane_expanded?mConversationsPane->getRect().getWidth():mConversationsPane->getExpandedMinDim() )
- : mConversationsPane->getMinDim();
+ S32 conv_pane_target_width = is_conv_pane_expanded
+ ? ( is_msg_pane_expanded?mConversationsPane->getRect().getWidth():mConversationsPane->getExpandedMinDim() )
+ : mConversationsPane->getMinDim();
- S32 msg_pane_min_width = is_msg_pane_expanded ? mMessagesPane->getExpandedMinDim() : 0;
- S32 new_min_width = conv_pane_target_width + msg_pane_min_width + summary_width_of_visible_borders;
+ S32 msg_pane_min_width = is_msg_pane_expanded ? mMessagesPane->getExpandedMinDim() : 0;
+ S32 new_min_width = conv_pane_target_width + msg_pane_min_width + summary_width_of_visible_borders;
- setResizeLimits(new_min_width, getMinHeight());
+ setResizeLimits(new_min_width, getMinHeight());
- mConversationsStack->updateLayout();
+ mConversationsStack->updateLayout();
}
void LLFloaterIMContainer::onAddButtonClicked()
@@ -989,7 +989,7 @@ void LLFloaterIMContainer::onAddButtonClicked()
LLView * button = findChild<LLView>("conversations_pane_buttons_expanded")->findChild<LLButton>("add_btn");
LLFloater* root_floater = gFloaterView->getParentFloater(this);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE, root_floater->getName(), button);
-
+
if (picker && root_floater)
{
root_floater->addDependentFloater(picker);
@@ -1010,133 +1010,133 @@ void LLFloaterIMContainer::onAvatarPicked(const uuid_vec_t& ids)
void LLFloaterIMContainer::onCustomAction(const LLSD& userdata)
{
- std::string command = userdata.asString();
-
- if ("sort_sessions_by_type" == command)
- {
- setSortOrderSessions(LLConversationFilter::SO_SESSION_TYPE);
- }
- if ("sort_sessions_by_name" == command)
- {
- setSortOrderSessions(LLConversationFilter::SO_NAME);
- }
- if ("sort_sessions_by_recent" == command)
- {
- setSortOrderSessions(LLConversationFilter::SO_DATE);
- }
- if ("sort_participants_by_name" == command)
- {
- setSortOrderParticipants(LLConversationFilter::SO_NAME);
- }
- if ("sort_participants_by_recent" == command)
- {
- setSortOrderParticipants(LLConversationFilter::SO_DATE);
- }
- if ("sort_participants_by_distance" == command)
- {
- setSortOrderParticipants(LLConversationFilter::SO_DISTANCE);
- }
- if ("chat_preferences" == command)
- {
- LLFloaterPreference * floater_prefp = LLFloaterReg::showTypedInstance<LLFloaterPreference>("preferences");
- if (floater_prefp)
- {
- floater_prefp->selectChatPanel();
- }
- }
- if ("privacy_preferences" == command)
- {
- LLFloaterPreference * floater_prefp = LLFloaterReg::showTypedInstance<LLFloaterPreference>("preferences");
- if (floater_prefp)
- {
- floater_prefp->selectPrivacyPanel();
- }
- }
- if ("Translating.Toggle" == command)
- {
- gSavedSettings.setBOOL("TranslateChat", !gSavedSettings.getBOOL("TranslateChat"));
- }
+ std::string command = userdata.asString();
+
+ if ("sort_sessions_by_type" == command)
+ {
+ setSortOrderSessions(LLConversationFilter::SO_SESSION_TYPE);
+ }
+ if ("sort_sessions_by_name" == command)
+ {
+ setSortOrderSessions(LLConversationFilter::SO_NAME);
+ }
+ if ("sort_sessions_by_recent" == command)
+ {
+ setSortOrderSessions(LLConversationFilter::SO_DATE);
+ }
+ if ("sort_participants_by_name" == command)
+ {
+ setSortOrderParticipants(LLConversationFilter::SO_NAME);
+ }
+ if ("sort_participants_by_recent" == command)
+ {
+ setSortOrderParticipants(LLConversationFilter::SO_DATE);
+ }
+ if ("sort_participants_by_distance" == command)
+ {
+ setSortOrderParticipants(LLConversationFilter::SO_DISTANCE);
+ }
+ if ("chat_preferences" == command)
+ {
+ LLFloaterPreference * floater_prefp = LLFloaterReg::showTypedInstance<LLFloaterPreference>("preferences");
+ if (floater_prefp)
+ {
+ floater_prefp->selectChatPanel();
+ }
+ }
+ if ("privacy_preferences" == command)
+ {
+ LLFloaterPreference * floater_prefp = LLFloaterReg::showTypedInstance<LLFloaterPreference>("preferences");
+ if (floater_prefp)
+ {
+ floater_prefp->selectPrivacyPanel();
+ }
+ }
+ if ("Translating.Toggle" == command)
+ {
+ gSavedSettings.setBOOL("TranslateChat", !gSavedSettings.getBOOL("TranslateChat"));
+ }
}
BOOL LLFloaterIMContainer::isActionChecked(const LLSD& userdata)
{
- LLConversationSort order = mConversationViewModel.getSorter();
- std::string command = userdata.asString();
- if ("sort_sessions_by_type" == command)
- {
- return (order.getSortOrderSessions() == LLConversationFilter::SO_SESSION_TYPE);
- }
- if ("sort_sessions_by_name" == command)
- {
- return (order.getSortOrderSessions() == LLConversationFilter::SO_NAME);
- }
- if ("sort_sessions_by_recent" == command)
- {
- return (order.getSortOrderSessions() == LLConversationFilter::SO_DATE);
- }
- if ("sort_participants_by_name" == command)
- {
- return (order.getSortOrderParticipants() == LLConversationFilter::SO_NAME);
- }
- if ("sort_participants_by_recent" == command)
- {
- return (order.getSortOrderParticipants() == LLConversationFilter::SO_DATE);
- }
- if ("sort_participants_by_distance" == command)
- {
- return (order.getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE);
- }
- if ("Translating.Enabled" == command)
- {
- return gSavedPerAccountSettings.getBOOL("TranslatingEnabled");
- }
- if ("Translating.On" == command)
- {
- return gSavedSettings.getBOOL("TranslateChat");
- }
- return FALSE;
+ LLConversationSort order = mConversationViewModel.getSorter();
+ std::string command = userdata.asString();
+ if ("sort_sessions_by_type" == command)
+ {
+ return (order.getSortOrderSessions() == LLConversationFilter::SO_SESSION_TYPE);
+ }
+ if ("sort_sessions_by_name" == command)
+ {
+ return (order.getSortOrderSessions() == LLConversationFilter::SO_NAME);
+ }
+ if ("sort_sessions_by_recent" == command)
+ {
+ return (order.getSortOrderSessions() == LLConversationFilter::SO_DATE);
+ }
+ if ("sort_participants_by_name" == command)
+ {
+ return (order.getSortOrderParticipants() == LLConversationFilter::SO_NAME);
+ }
+ if ("sort_participants_by_recent" == command)
+ {
+ return (order.getSortOrderParticipants() == LLConversationFilter::SO_DATE);
+ }
+ if ("sort_participants_by_distance" == command)
+ {
+ return (order.getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE);
+ }
+ if ("Translating.Enabled" == command)
+ {
+ return gSavedPerAccountSettings.getBOOL("TranslatingEnabled");
+ }
+ if ("Translating.On" == command)
+ {
+ return gSavedSettings.getBOOL("TranslateChat");
+ }
+ return FALSE;
}
void LLFloaterIMContainer::setSortOrderSessions(const LLConversationFilter::ESortOrderType order)
{
- LLConversationSort old_order = mConversationViewModel.getSorter();
- if (order != old_order.getSortOrderSessions())
- {
- old_order.setSortOrderSessions(order);
- setSortOrder(old_order);
- }
+ LLConversationSort old_order = mConversationViewModel.getSorter();
+ if (order != old_order.getSortOrderSessions())
+ {
+ old_order.setSortOrderSessions(order);
+ setSortOrder(old_order);
+ }
}
void LLFloaterIMContainer::setSortOrderParticipants(const LLConversationFilter::ESortOrderType order)
{
- LLConversationSort old_order = mConversationViewModel.getSorter();
- if (order != old_order.getSortOrderParticipants())
- {
- old_order.setSortOrderParticipants(order);
- setSortOrder(old_order);
- }
+ LLConversationSort old_order = mConversationViewModel.getSorter();
+ if (order != old_order.getSortOrderParticipants())
+ {
+ old_order.setSortOrderParticipants(order);
+ setSortOrder(old_order);
+ }
}
void LLFloaterIMContainer::setSortOrder(const LLConversationSort& order)
{
- mConversationViewModel.setSorter(order);
- mConversationsRoot->arrangeAll();
- // try to keep selection onscreen, even if it wasn't to start with
- mConversationsRoot->scrollToShowSelection();
-
- // Notify all conversation (torn off or not) of the change to the sort order
- // Note: For the moment, the sort order is *unique* across all conversations. That might change in the future.
- for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++)
- {
- LLUUID session_id = it_session->first;
- LLFloaterIMSessionTab *conversation_floater = (session_id.isNull() ? (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")) : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(session_id)));
- if (conversation_floater)
- {
- conversation_floater->setSortOrder(order);
- }
- }
-
- gSavedSettings.setU32("ConversationSortOrder", (U32)order);
+ mConversationViewModel.setSorter(order);
+ mConversationsRoot->arrangeAll();
+ // try to keep selection onscreen, even if it wasn't to start with
+ mConversationsRoot->scrollToShowSelection();
+
+ // Notify all conversation (torn off or not) of the change to the sort order
+ // Note: For the moment, the sort order is *unique* across all conversations. That might change in the future.
+ for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++)
+ {
+ LLUUID session_id = it_session->first;
+ LLFloaterIMSessionTab *conversation_floater = (session_id.isNull() ? (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")) : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(session_id)));
+ if (conversation_floater)
+ {
+ conversation_floater->setSortOrder(order);
+ }
+ }
+
+ gSavedSettings.setU32("ConversationSortOrder", (U32)order);
}
void LLFloaterIMContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids, bool participant_uuids/* = true*/)
@@ -1150,18 +1150,18 @@ void LLFloaterIMContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids, bool par
for (; it != it_end; ++it)
{
conversationItem = static_cast<LLConversationItem *>((*it)->getViewModelItem());
-
- //When a one-on-one conversation exists, retrieve the participant id from the conversation floater
- if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1 && participant_uuids)
- {
- LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(conversationItem->getUUID());
- LLUUID participant_id = conversation_floaterp->getOtherParticipantUUID();
- selected_uuids.push_back(participant_id);
- }
- else
- {
- selected_uuids.push_back(conversationItem->getUUID());
- }
+
+ //When a one-on-one conversation exists, retrieve the participant id from the conversation floater
+ if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1 && participant_uuids)
+ {
+ LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(conversationItem->getUUID());
+ LLUUID participant_id = conversation_floaterp->getOtherParticipantUUID();
+ selected_uuids.push_back(participant_id);
+ }
+ else
+ {
+ selected_uuids.push_back(conversationItem->getUUID());
+ }
}
}
@@ -1169,20 +1169,20 @@ const LLConversationItem * LLFloaterIMContainer::getCurSelectedViewModelItem()
{
LLConversationItem * conversation_item = NULL;
- if(mConversationsRoot &&
- mConversationsRoot->getCurSelectedItem() &&
+ if(mConversationsRoot &&
+ mConversationsRoot->getCurSelectedItem() &&
mConversationsRoot->getCurSelectedItem()->getViewModelItem())
{
- LLFloaterIMSessionTab *selected_session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession);
- if (selected_session_floater && !selected_session_floater->getHost() && selected_session_floater->getCurSelectedViewModelItem())
- {
- conversation_item = selected_session_floater->getCurSelectedViewModelItem();
- }
- else
- {
- conversation_item = static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem());
- }
- }
+ LLFloaterIMSessionTab *selected_session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession);
+ if (selected_session_floater && !selected_session_floater->getHost() && selected_session_floater->getCurSelectedViewModelItem())
+ {
+ conversation_item = selected_session_floater->getCurSelectedViewModelItem();
+ }
+ else
+ {
+ conversation_item = static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem());
+ }
+ }
return conversation_item;
}
@@ -1192,74 +1192,74 @@ void LLFloaterIMContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids)
//Find the conversation floater associated with the selected id
const LLConversationItem * conversation_item = getCurSelectedViewModelItem();
- if (NULL == conversation_item)
- {
- return;
- }
+ if (NULL == conversation_item)
+ {
+ return;
+ }
- getSelectedUUIDs(selected_uuids);
+ getSelectedUUIDs(selected_uuids);
}
void LLFloaterIMContainer::doToParticipants(const std::string& command, uuid_vec_t& selectedIDS)
{
- if (selectedIDS.size() == 1)
- {
- const LLUUID& userID = selectedIDS.front();
- if ("view_profile" == command)
- {
- LLAvatarActions::showProfile(userID);
- }
- else if ("im" == command)
- {
- if (gAgent.getID() != userID)
- {
- LLAvatarActions::startIM(userID);
- }
- }
- else if ("offer_teleport" == command)
- {
- LLAvatarActions::offerTeleport(selectedIDS);
- }
- else if ("request_teleport" == command)
- {
- LLAvatarActions::teleportRequest(selectedIDS.front());
- }
- else if ("voice_call" == command)
- {
- LLAvatarActions::startCall(userID);
- }
- else if ("chat_history" == command)
- {
- LLAvatarActions::viewChatHistory(userID);
- }
- else if ("add_friend" == command)
- {
- LLAvatarActions::requestFriendshipDialog(userID);
- }
- else if ("remove_friend" == command)
- {
- LLAvatarActions::removeFriendDialog(userID);
- }
- else if ("invite_to_group" == command)
- {
- LLAvatarActions::inviteToGroup(userID);
- }
- else if ("zoom_in" == command)
- {
- handle_zoom_to_object(userID);
- }
- else if ("map" == command)
- {
- LLAvatarActions::showOnMap(userID);
- }
- else if ("share" == command)
- {
- LLAvatarActions::share(userID);
- }
- else if ("pay" == command)
- {
- LLAvatarActions::pay(userID);
- }
+ if (selectedIDS.size() == 1)
+ {
+ const LLUUID& userID = selectedIDS.front();
+ if ("view_profile" == command)
+ {
+ LLAvatarActions::showProfile(userID);
+ }
+ else if ("im" == command)
+ {
+ if (gAgent.getID() != userID)
+ {
+ LLAvatarActions::startIM(userID);
+ }
+ }
+ else if ("offer_teleport" == command)
+ {
+ LLAvatarActions::offerTeleport(selectedIDS);
+ }
+ else if ("request_teleport" == command)
+ {
+ LLAvatarActions::teleportRequest(selectedIDS.front());
+ }
+ else if ("voice_call" == command)
+ {
+ LLAvatarActions::startCall(userID);
+ }
+ else if ("chat_history" == command)
+ {
+ LLAvatarActions::viewChatHistory(userID);
+ }
+ else if ("add_friend" == command)
+ {
+ LLAvatarActions::requestFriendshipDialog(userID);
+ }
+ else if ("remove_friend" == command)
+ {
+ LLAvatarActions::removeFriendDialog(userID);
+ }
+ else if ("invite_to_group" == command)
+ {
+ LLAvatarActions::inviteToGroup(userID);
+ }
+ else if ("zoom_in" == command)
+ {
+ handle_zoom_to_object(userID);
+ }
+ else if ("map" == command)
+ {
+ LLAvatarActions::showOnMap(userID);
+ }
+ else if ("share" == command)
+ {
+ LLAvatarActions::share(userID);
+ }
+ else if ("pay" == command)
+ {
+ LLAvatarActions::pay(userID);
+ }
else if ("report_abuse" == command)
{
LLAvatarName av_name;
@@ -1272,46 +1272,46 @@ void LLFloaterIMContainer::doToParticipants(const std::string& command, uuid_vec
LLFloaterReporter::showFromAvatar(userID, "not avaliable");
}
}
- else if ("block_unblock" == command)
- {
- LLAvatarActions::toggleMute(userID, LLMute::flagVoiceChat);
- }
- else if ("mute_unmute" == command)
- {
- LLAvatarActions::toggleMute(userID, LLMute::flagTextChat);
- }
- else if ("selected" == command || "mute_all" == command || "unmute_all" == command)
- {
- moderateVoice(command, userID);
- }
- else if ("toggle_allow_text_chat" == command)
- {
- toggleAllowTextChat(userID);
- }
- else if ("ban_member" == command)
- {
- banSelectedMember(userID);
- }
- }
- else if (selectedIDS.size() > 1)
- {
- if ("im" == command)
- {
- LLAvatarActions::startConference(selectedIDS);
- }
- else if ("offer_teleport" == command)
- {
- LLAvatarActions::offerTeleport(selectedIDS);
- }
- else if ("voice_call" == command)
- {
- LLAvatarActions::startAdhocCall(selectedIDS);
- }
- else if ("remove_friend" == command)
- {
- LLAvatarActions::removeFriendsDialog(selectedIDS);
- }
- }
+ else if ("block_unblock" == command)
+ {
+ LLAvatarActions::toggleMute(userID, LLMute::flagVoiceChat);
+ }
+ else if ("mute_unmute" == command)
+ {
+ LLAvatarActions::toggleMute(userID, LLMute::flagTextChat);
+ }
+ else if ("selected" == command || "mute_all" == command || "unmute_all" == command)
+ {
+ moderateVoice(command, userID);
+ }
+ else if ("toggle_allow_text_chat" == command)
+ {
+ toggleAllowTextChat(userID);
+ }
+ else if ("ban_member" == command)
+ {
+ banSelectedMember(userID);
+ }
+ }
+ else if (selectedIDS.size() > 1)
+ {
+ if ("im" == command)
+ {
+ LLAvatarActions::startConference(selectedIDS);
+ }
+ else if ("offer_teleport" == command)
+ {
+ LLAvatarActions::offerTeleport(selectedIDS);
+ }
+ else if ("voice_call" == command)
+ {
+ LLAvatarActions::startAdhocCall(selectedIDS);
+ }
+ else if ("remove_friend" == command)
+ {
+ LLAvatarActions::removeFriendsDialog(selectedIDS);
+ }
+ }
}
void LLFloaterIMContainer::doToSelectedConversation(const std::string& command, uuid_vec_t& selectedIDS)
@@ -1329,8 +1329,8 @@ void LLFloaterIMContainer::doToSelectedConversation(const std::string& command,
}
else if("close_selected_conversations" == command)
{
- getSelectedUUIDs(selectedIDS,false);
- closeSelectedConversations(selectedIDS);
+ getSelectedUUIDs(selectedIDS,false);
+ closeSelectedConversations(selectedIDS);
}
else if("open_voice_conversation" == command)
{
@@ -1342,43 +1342,43 @@ void LLFloaterIMContainer::doToSelectedConversation(const std::string& command,
}
else if("chat_history" == command)
{
- if (selectedIDS.size() > 0)
- {
- if(conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP)
- {
- LLFloaterReg::showInstance("preview_conversation", conversationItem->getUUID(), true);
- }
- else if(conversationItem->getType() == LLConversationItem::CONV_SESSION_AD_HOC)
- {
- LLConversation* conv = LLConversationLog::instance().findConversation(LLIMModel::getInstance()->findIMSession(conversationItem->getUUID()));
- if(conv)
- {
- LLFloaterReg::showInstance("preview_conversation", conv->getSessionID(), true);
- }
- }
- else
- {
- LLAvatarActions::viewChatHistory(selectedIDS.front());
- }
- }
+ if (selectedIDS.size() > 0)
+ {
+ if(conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP)
+ {
+ LLFloaterReg::showInstance("preview_conversation", conversationItem->getUUID(), true);
+ }
+ else if(conversationItem->getType() == LLConversationItem::CONV_SESSION_AD_HOC)
+ {
+ LLConversation* conv = LLConversationLog::instance().findConversation(LLIMModel::getInstance()->findIMSession(conversationItem->getUUID()));
+ if(conv)
+ {
+ LLFloaterReg::showInstance("preview_conversation", conv->getSessionID(), true);
+ }
+ }
+ else
+ {
+ LLAvatarActions::viewChatHistory(selectedIDS.front());
+ }
+ }
}
else
{
- if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
- {
- doToParticipants(command, selectedIDS);
- }
+ if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
+ {
+ doToParticipants(command, selectedIDS);
+ }
}
}
//if there is no LLFloaterIMSession* instance for selected conversation it might be Nearby chat
else
{
- if(conversationItem->getType() == LLConversationItem::CONV_SESSION_NEARBY)
- {
- if("chat_history" == command)
- {
- LLFloaterReg::showInstance("preview_conversation", LLSD(LLUUID::null), true);
- }
+ if(conversationItem->getType() == LLConversationItem::CONV_SESSION_NEARBY)
+ {
+ if("chat_history" == command)
+ {
+ LLFloaterReg::showInstance("preview_conversation", LLSD(LLUUID::null), true);
+ }
}
}
}
@@ -1391,16 +1391,16 @@ void LLFloaterIMContainer::doToSelected(const LLSD& userdata)
if(conversationItem != NULL)
{
- getParticipantUUIDs(selected_uuids);
-
- if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT)
- {
- doToParticipants(command, selected_uuids);
- }
- else
- {
- doToSelectedConversation(command, selected_uuids);
- }
+ getParticipantUUIDs(selected_uuids);
+
+ if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT)
+ {
+ doToParticipants(command, selected_uuids);
+ }
+ else
+ {
+ doToSelectedConversation(command, selected_uuids);
+ }
}
}
@@ -1425,92 +1425,92 @@ void LLFloaterIMContainer::doToSelectedGroup(const LLSD& userdata)
bool LLFloaterIMContainer::enableContextMenuItem(const LLSD& userdata)
{
const std::string& item = userdata.asString();
- uuid_vec_t uuids;
- getParticipantUUIDs(uuids);
-
-
- //If there is group or ad-hoc chat in multiselection, everything needs to be disabled
- if(uuids.size() > 1)
- {
- const std::set<LLFolderViewItem*> selectedItems = mConversationsRoot->getSelectionList();
- LLConversationItem * conversationItem;
- for(std::set<LLFolderViewItem*>::const_iterator it = selectedItems.begin(); it != selectedItems.end(); ++it)
- {
- conversationItem = static_cast<LLConversationItem *>((*it)->getViewModelItem());
- if((conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP) || (conversationItem->getType() == LLConversationItem::CONV_SESSION_AD_HOC))
- {
- return false;
- }
- }
- }
-
- if ("conversation_log" == item)
- {
- return gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 0;
- }
-
- //Enable Chat history item for ad-hoc and group conversations
- if ("can_chat_history" == item && uuids.size() > 0)
- {
- //Disable menu item if selected participant is user agent
- if(uuids.front() != gAgentID)
- {
- if (getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_NEARBY)
- {
- return LLLogChat::isNearbyTranscriptExist();
- }
- else if (getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_AD_HOC)
- {
- const LLConversation* conv = LLConversationLog::instance().findConversation(LLIMModel::getInstance()->findIMSession(uuids.front()));
- if(conv)
- {
- return LLLogChat::isAdHocTranscriptExist(conv->getHistoryFileName());
- }
- return false;
- }
- else
- {
- bool is_group = (getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP);
- return LLLogChat::isTranscriptExist(uuids.front(),is_group);
- }
- }
- }
-
- // If nothing is selected(and selected item is not group chat), everything needs to be disabled
- if (uuids.size() <= 0)
- {
- if(getCurSelectedViewModelItem())
- {
- return getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP;
- }
- return false;
- }
-
- if("can_activate_group" == item)
- {
- LLUUID selected_group_id = getCurSelectedViewModelItem()->getUUID();
- return gAgent.getGroupID() != selected_group_id;
- }
-
- return enableContextMenuItem(item, uuids);
+ uuid_vec_t uuids;
+ getParticipantUUIDs(uuids);
+
+
+ //If there is group or ad-hoc chat in multiselection, everything needs to be disabled
+ if(uuids.size() > 1)
+ {
+ const std::set<LLFolderViewItem*> selectedItems = mConversationsRoot->getSelectionList();
+ LLConversationItem * conversationItem;
+ for(std::set<LLFolderViewItem*>::const_iterator it = selectedItems.begin(); it != selectedItems.end(); ++it)
+ {
+ conversationItem = static_cast<LLConversationItem *>((*it)->getViewModelItem());
+ if((conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP) || (conversationItem->getType() == LLConversationItem::CONV_SESSION_AD_HOC))
+ {
+ return false;
+ }
+ }
+ }
+
+ if ("conversation_log" == item)
+ {
+ return gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 0;
+ }
+
+ //Enable Chat history item for ad-hoc and group conversations
+ if ("can_chat_history" == item && uuids.size() > 0)
+ {
+ //Disable menu item if selected participant is user agent
+ if(uuids.front() != gAgentID)
+ {
+ if (getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_NEARBY)
+ {
+ return LLLogChat::isNearbyTranscriptExist();
+ }
+ else if (getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_AD_HOC)
+ {
+ const LLConversation* conv = LLConversationLog::instance().findConversation(LLIMModel::getInstance()->findIMSession(uuids.front()));
+ if(conv)
+ {
+ return LLLogChat::isAdHocTranscriptExist(conv->getHistoryFileName());
+ }
+ return false;
+ }
+ else
+ {
+ bool is_group = (getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP);
+ return LLLogChat::isTranscriptExist(uuids.front(),is_group);
+ }
+ }
+ }
+
+ // If nothing is selected(and selected item is not group chat), everything needs to be disabled
+ if (uuids.size() <= 0)
+ {
+ if(getCurSelectedViewModelItem())
+ {
+ return getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP;
+ }
+ return false;
+ }
+
+ if("can_activate_group" == item)
+ {
+ LLUUID selected_group_id = getCurSelectedViewModelItem()->getUUID();
+ return gAgent.getGroupID() != selected_group_id;
+ }
+
+ return enableContextMenuItem(item, uuids);
}
bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_vec_t& uuids)
{
- // Extract the single select info
- bool is_single_select = (uuids.size() == 1);
- const LLUUID& single_id = uuids.front();
+ // Extract the single select info
+ bool is_single_select = (uuids.size() == 1);
+ const LLUUID& single_id = uuids.front();
- if ("can_chat_history" == item && is_single_select)
- {
- return LLLogChat::isTranscriptExist(uuids.front(),false);
- }
+ if ("can_chat_history" == item && is_single_select)
+ {
+ return LLLogChat::isTranscriptExist(uuids.front(),false);
+ }
- // Handle options that are applicable to all including the user agent
+ // Handle options that are applicable to all including the user agent
if ("can_view_profile" == item)
{
- return is_single_select;
- }
+ return is_single_select;
+ }
bool is_moderator_option = ("can_moderate_voice" == item) || ("can_allow_text_chat" == item) || ("can_mute" == item) || ("can_unmute" == item);
@@ -1527,25 +1527,25 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
}
}
- // If the user agent is selected with others, everything is disabled
- for (uuid_vec_t::const_iterator id = uuids.begin(); id != uuids.end(); ++id)
- {
- if (gAgent.getID() == *id)
- {
- return false;
- }
- }
+ // If the user agent is selected with others, everything is disabled
+ for (uuid_vec_t::const_iterator id = uuids.begin(); id != uuids.end(); ++id)
+ {
+ if (gAgent.getID() == *id)
+ {
+ return false;
+ }
+ }
- // Handle all other options
- if (("can_invite" == item)
+ // Handle all other options
+ if (("can_invite" == item)
|| ("can_chat_history" == item)
|| ("can_share" == item)
|| ("can_pay" == item)
|| ("report_abuse" == item))
- {
- // Those menu items are enable only if a single avatar is selected
- return is_single_select;
- }
+ {
+ // Those menu items are enable only if a single avatar is selected
+ return is_single_select;
+ }
else if ("can_block" == item)
{
return (is_single_select ? LLAvatarActions::canBlock(single_id) : false);
@@ -1563,7 +1563,7 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
bool result = true;
for (uuid_vec_t::const_iterator id = uuids.begin(); id != uuids.end(); ++id)
{
- result &= LLAvatarActions::isFriend(*id);
+ result &= LLAvatarActions::isFriend(*id);
}
return result;
}
@@ -1573,27 +1573,27 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
}
else if ("can_open_voice_conversation" == item)
{
- return is_single_select && LLAvatarActions::canCall();
+ return is_single_select && LLAvatarActions::canCall();
}
else if ("can_open_voice_conversation" == item)
{
- return is_single_select && LLAvatarActions::canCall();
+ return is_single_select && LLAvatarActions::canCall();
+ }
+ else if ("can_zoom_in" == item)
+ {
+ return is_single_select && gObjectList.findObject(single_id);
}
- else if ("can_zoom_in" == item)
- {
- return is_single_select && gObjectList.findObject(single_id);
- }
else if ("can_show_on_map" == item)
{
return (is_single_select ? (LLAvatarTracker::instance().isBuddyOnline(single_id) && is_agent_mappable(single_id)) || gAgent.isGodlike() : false);
}
else if ("can_offer_teleport" == item)
{
- return LLAvatarActions::canOfferTeleport(uuids);
+ return LLAvatarActions::canOfferTeleport(uuids);
}
else if ("can_ban_member" == item)
{
- return canBanSelectedMember(single_id);
+ return canBanSelectedMember(single_id);
}
else if (is_moderator_option)
{
@@ -1601,40 +1601,40 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
return enableModerateContextMenuItem(item);
}
- // By default, options that not explicitely disabled are enabled
+ // By default, options that not explicitely disabled are enabled
return true;
}
bool LLFloaterIMContainer::checkContextMenuItem(const LLSD& userdata)
{
std::string item = userdata.asString();
- uuid_vec_t uuids;
- getParticipantUUIDs(uuids);
-
- return checkContextMenuItem(item, uuids);
+ uuid_vec_t uuids;
+ getParticipantUUIDs(uuids);
+
+ return checkContextMenuItem(item, uuids);
}
bool LLFloaterIMContainer::checkContextMenuItem(const std::string& item, uuid_vec_t& uuids)
{
if (uuids.size() == 1)
{
- if ("is_blocked" == item)
- {
- return LLMuteList::getInstance()->isMuted(uuids.front(), LLMute::flagVoiceChat);
- }
- else if (item == "is_muted")
- {
- return LLMuteList::getInstance()->isMuted(uuids.front(), LLMute::flagTextChat);
- }
- else if ("is_allowed_text_chat" == item)
- {
- const LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant());
-
- if (NULL != speakerp)
- {
- return !speakerp->mModeratorMutedText;
- }
- }
+ if ("is_blocked" == item)
+ {
+ return LLMuteList::getInstance()->isMuted(uuids.front(), LLMute::flagVoiceChat);
+ }
+ else if (item == "is_muted")
+ {
+ return LLMuteList::getInstance()->isMuted(uuids.front(), LLMute::flagTextChat);
+ }
+ else if ("is_allowed_text_chat" == item)
+ {
+ const LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant());
+
+ if (NULL != speakerp)
+ {
+ return !speakerp->mModeratorMutedText;
+ }
+ }
}
return false;
@@ -1642,24 +1642,24 @@ bool LLFloaterIMContainer::checkContextMenuItem(const std::string& item, uuid_ve
bool LLFloaterIMContainer::visibleContextMenuItem(const LLSD& userdata)
{
- const LLConversationItem *conversation_item = getCurSelectedViewModelItem();
- if(!conversation_item)
- {
- return false;
- }
+ const LLConversationItem *conversation_item = getCurSelectedViewModelItem();
+ if(!conversation_item)
+ {
+ return false;
+ }
- const std::string& item = userdata.asString();
+ const std::string& item = userdata.asString();
- if ("show_mute" == item)
- {
- return !isMuted(conversation_item->getUUID());
- }
- else if ("show_unmute" == item)
- {
- return isMuted(conversation_item->getUUID());
- }
+ if ("show_mute" == item)
+ {
+ return !isMuted(conversation_item->getUUID());
+ }
+ else if ("show_unmute" == item)
+ {
+ return isMuted(conversation_item->getUUID());
+ }
- return true;
+ return true;
}
void LLFloaterIMContainer::showConversation(const LLUUID& session_id)
@@ -1676,15 +1676,15 @@ void LLFloaterIMContainer::showConversation(const LLUUID& session_id)
void LLFloaterIMContainer::clearAllFlashStates()
{
- conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
- for (;widget_it != mConversationsWidgets.end(); ++widget_it)
- {
- LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(widget_it->second);
- if (widget)
- {
- widget->setFlashState(false);
- }
- }
+ conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
+ for (;widget_it != mConversationsWidgets.end(); ++widget_it)
+ {
+ LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(widget_it->second);
+ if (widget)
+ {
+ widget->setFlashState(false);
+ }
+ }
}
void LLFloaterIMContainer::selectConversation(const LLUUID& session_id)
@@ -1696,13 +1696,13 @@ void LLFloaterIMContainer::selectConversation(const LLUUID& session_id)
// Used to change the selection on key hits
void LLFloaterIMContainer::selectNextConversationByID(const LLUUID& uuid)
{
- bool new_selection = false;
- selectConversation(uuid);
- new_selection = selectNextorPreviousConversation(true);
- if (!new_selection)
- {
- selectNextorPreviousConversation(false);
- }
+ bool new_selection = false;
+ selectConversation(uuid);
+ new_selection = selectNextorPreviousConversation(true);
+ if (!new_selection)
+ {
+ selectNextorPreviousConversation(false);
+ }
}
// Synchronous select the conversation item and the conversation floater
@@ -1710,192 +1710,192 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool
{
BOOL handled = TRUE;
LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id);
-
+
/* widget processing */
if (select_widget && mConversationsRoot->getSelectedCount() <= 1)
{
- LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id);
- if (widget && widget->getParentFolder())
- {
- widget->getParentFolder()->setSelection(widget, FALSE, FALSE);
- mConversationsRoot->scrollToShowSelection();
- }
+ LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id);
+ if (widget && widget->getParentFolder())
+ {
+ widget->getParentFolder()->setSelection(widget, FALSE, FALSE);
+ mConversationsRoot->scrollToShowSelection();
+ }
}
/* floater processing */
- if (NULL != session_floater && !session_floater->isDead())
- {
- if (session_id != getSelectedSession())
- {
- // Store the active session
- setSelectedSession(session_id);
-
-
-
- if (session_floater->getHost())
- {
- // Always expand the message pane if the panel is hosted by the container
- collapseMessagesPane(false);
- // Switch to the conversation floater that is being selected
- selectFloater(session_floater);
- }
- else
- {
- showStub(true);
- }
-
- //When in DND mode, remove stored IM notifications
- //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
- if(gAgent.isDoNotDisturb() && session_id.notNull())
- {
- LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, session_id);
- }
- }
-
- // Set the focus on the selected floater
- if (!session_floater->hasFocus() && !session_floater->isMinimized())
- {
- session_floater->setFocus(focus_floater);
- }
- }
- flashConversationItemWidget(session_id,false);
+ if (NULL != session_floater && !session_floater->isDead())
+ {
+ if (session_id != getSelectedSession())
+ {
+ // Store the active session
+ setSelectedSession(session_id);
+
+
+
+ if (session_floater->getHost())
+ {
+ // Always expand the message pane if the panel is hosted by the container
+ collapseMessagesPane(false);
+ // Switch to the conversation floater that is being selected
+ selectFloater(session_floater);
+ }
+ else
+ {
+ showStub(true);
+ }
+
+ //When in DND mode, remove stored IM notifications
+ //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
+ if(gAgent.isDoNotDisturb() && session_id.notNull())
+ {
+ LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, session_id);
+ }
+ }
+
+ // Set the focus on the selected floater
+ if (!session_floater->hasFocus() && !session_floater->isMinimized())
+ {
+ session_floater->setFocus(focus_floater);
+ }
+ }
+ flashConversationItemWidget(session_id,false);
return handled;
}
void LLFloaterIMContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id)
{
- LLConversationItemSession* item = dynamic_cast<LLConversationItemSession*>(getSessionModel(session_id));
- if (item)
- {
+ LLConversationItemSession* item = dynamic_cast<LLConversationItemSession*>(getSessionModel(session_id));
+ if (item)
+ {
item->setTimeNow(participant_id);
- mConversationViewModel.requestSortAll();
- mConversationsRoot->arrangeAll();
- }
+ mConversationViewModel.requestSortAll();
+ mConversationsRoot->arrangeAll();
+ }
}
void LLFloaterIMContainer::setNearbyDistances()
{
- // Get the nearby chat session: that's the one with uuid nul
+ // Get the nearby chat session: that's the one with uuid nul
LLConversationItemSession* item = dynamic_cast<LLConversationItemSession*>(getSessionModel(LLUUID()));
- if (item)
- {
- // Get the positions of the nearby avatars and their ids
- std::vector<LLVector3d> positions;
- uuid_vec_t avatar_ids;
- LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
- // Get the position of the agent
- const LLVector3d& me_pos = gAgent.getPositionGlobal();
- // For each nearby avatar, compute and update the distance
- int avatar_count = positions.size();
- for (int i = 0; i < avatar_count; i++)
- {
- F64 dist = dist_vec_squared(positions[i], me_pos);
- item->setDistance(avatar_ids[i],dist);
- }
- // Also does it for the agent itself
- item->setDistance(gAgent.getID(),0.0f);
- // Request resort
- mConversationViewModel.requestSortAll();
- mConversationsRoot->arrangeAll();
- }
+ if (item)
+ {
+ // Get the positions of the nearby avatars and their ids
+ std::vector<LLVector3d> positions;
+ uuid_vec_t avatar_ids;
+ LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
+ // Get the position of the agent
+ const LLVector3d& me_pos = gAgent.getPositionGlobal();
+ // For each nearby avatar, compute and update the distance
+ int avatar_count = positions.size();
+ for (int i = 0; i < avatar_count; i++)
+ {
+ F64 dist = dist_vec_squared(positions[i], me_pos);
+ item->setDistance(avatar_ids[i],dist);
+ }
+ // Also does it for the agent itself
+ item->setDistance(gAgent.getID(),0.0f);
+ // Request resort
+ mConversationViewModel.requestSortAll();
+ mConversationsRoot->arrangeAll();
+ }
}
LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& uuid, bool isWidgetSelected /*= false*/)
{
- bool is_nearby_chat = uuid.isNull();
+ bool is_nearby_chat = uuid.isNull();
// Stores the display name for the conversation line item
- std::string display_name = is_nearby_chat ? LLTrans::getString("NearbyChatLabel") : LLIMModel::instance().getName(uuid);
-
- // Check if the item is not already in the list, exit (nothing to do)
- // Note: this happens often, when reattaching a torn off conversation for instance
- conversations_items_map::iterator item_it = mConversationsItems.find(uuid);
- if (item_it != mConversationsItems.end())
- {
- return item_it->second;
- }
-
- // Create a conversation session model
- LLConversationItemSession* item = NULL;
- LLSpeakerMgr* speaker_manager = (is_nearby_chat ? (LLSpeakerMgr*)(LLLocalSpeakerMgr::getInstance()) : LLIMModel::getInstance()->getSpeakerManager(uuid));
- if (speaker_manager)
- {
- item = new LLParticipantList(speaker_manager, getRootViewModel());
- }
- if (!item)
- {
- LL_WARNS() << "Couldn't create conversation session item : " << display_name << LL_ENDL;
- return NULL;
- }
- item->renameItem(display_name);
- item->updateName(NULL);
-
- mConversationsItems[uuid] = item;
-
- // Create a widget from it
- LLConversationViewSession* widget = createConversationItemWidget(item);
- mConversationsWidgets[uuid] = widget;
-
- // Add a new conversation widget to the root folder of the folder view
- widget->addToFolder(mConversationsRoot);
- widget->requestArrange();
-
- LLIMModel::LLIMSession * im_sessionp = LLIMModel::getInstance()->findIMSession(uuid);
-
- // Create the participants widgets now
- // Note: usually, we do not get an updated avatar list at that point
- if (uuid.isNull() || (im_sessionp && !im_sessionp->isP2PSessionType()))
- {
- LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin();
- LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd();
- while (current_participant_model != end_participant_model)
- {
- LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model);
- LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model);
- participant_view->addToFolder(widget);
- current_participant_model++;
- }
- }
-
- if (uuid.notNull() && im_sessionp->isP2PSessionType())
- {
- item->fetchAvatarName(false);
- }
-
- // Do that too for the conversation dialog
+ std::string display_name = is_nearby_chat ? LLTrans::getString("NearbyChatLabel") : LLIMModel::instance().getName(uuid);
+
+ // Check if the item is not already in the list, exit (nothing to do)
+ // Note: this happens often, when reattaching a torn off conversation for instance
+ conversations_items_map::iterator item_it = mConversationsItems.find(uuid);
+ if (item_it != mConversationsItems.end())
+ {
+ return item_it->second;
+ }
+
+ // Create a conversation session model
+ LLConversationItemSession* item = NULL;
+ LLSpeakerMgr* speaker_manager = (is_nearby_chat ? (LLSpeakerMgr*)(LLLocalSpeakerMgr::getInstance()) : LLIMModel::getInstance()->getSpeakerManager(uuid));
+ if (speaker_manager)
+ {
+ item = new LLParticipantList(speaker_manager, getRootViewModel());
+ }
+ if (!item)
+ {
+ LL_WARNS() << "Couldn't create conversation session item : " << display_name << LL_ENDL;
+ return NULL;
+ }
+ item->renameItem(display_name);
+ item->updateName(NULL);
+
+ mConversationsItems[uuid] = item;
+
+ // Create a widget from it
+ LLConversationViewSession* widget = createConversationItemWidget(item);
+ mConversationsWidgets[uuid] = widget;
+
+ // Add a new conversation widget to the root folder of the folder view
+ widget->addToFolder(mConversationsRoot);
+ widget->requestArrange();
+
+ LLIMModel::LLIMSession * im_sessionp = LLIMModel::getInstance()->findIMSession(uuid);
+
+ // Create the participants widgets now
+ // Note: usually, we do not get an updated avatar list at that point
+ if (uuid.isNull() || (im_sessionp && !im_sessionp->isP2PSessionType()))
+ {
+ LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin();
+ LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd();
+ while (current_participant_model != end_participant_model)
+ {
+ LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model);
+ LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model);
+ participant_view->addToFolder(widget);
+ current_participant_model++;
+ }
+ }
+
+ if (uuid.notNull() && im_sessionp->isP2PSessionType())
+ {
+ item->fetchAvatarName(false);
+ }
+
+ // Do that too for the conversation dialog
LLFloaterIMSessionTab *conversation_floater = (uuid.isNull() ? (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")) : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(uuid)));
- if (conversation_floater)
- {
- conversation_floater->buildConversationViewParticipant();
- }
+ if (conversation_floater)
+ {
+ conversation_floater->buildConversationViewParticipant();
+ }
- // set the widget to minimized mode if conversations pane is collapsed
- widget->toggleCollapsedMode(mConversationsPane->isCollapsed());
+ // set the widget to minimized mode if conversations pane is collapsed
+ widget->toggleCollapsedMode(mConversationsPane->isCollapsed());
- if (isWidgetSelected || 0 == mConversationsRoot->getSelectedCount())
- {
- selectConversationPair(uuid, true);
- widget->requestArrange();
+ if (isWidgetSelected || 0 == mConversationsRoot->getSelectedCount())
+ {
+ selectConversationPair(uuid, true);
+ widget->requestArrange();
- // scroll to newly added item
- mConversationsRoot->scrollToShowSelection();
- }
+ // scroll to newly added item
+ mConversationsRoot->scrollToShowSelection();
+ }
- return item;
+ return item;
}
bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool change_focus)
{
- // Delete the widget and the associated conversation item
- // Note : since the mConversationsItems is also the listener to the widget, deleting
- // the widget will also delete its listener
- bool is_widget_selected = false;
- LLFolderViewItem* new_selection = NULL;
- LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid);
- if (widget)
- {
- is_widget_selected = widget->isSelected();
+ // Delete the widget and the associated conversation item
+ // Note : since the mConversationsItems is also the listener to the widget, deleting
+ // the widget will also delete its listener
+ bool is_widget_selected = false;
+ LLFolderViewItem* new_selection = NULL;
+ LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid);
+ if (widget)
+ {
+ is_widget_selected = widget->isSelected();
if (mConversationsRoot)
{
new_selection = mConversationsRoot->getNextFromChild(widget, FALSE);
@@ -1905,502 +1905,502 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c
}
}
- // Will destroy views and delete models that are not assigned to any views
- widget->destroyView();
- }
-
- // Suppress the conversation items and widgets from their respective maps
- mConversationsItems.erase(uuid);
- mConversationsWidgets.erase(uuid);
- // Clear event query (otherwise reopening session in some way can bombard session with stale data)
- mConversationEventQueue.erase(uuid);
-
- // Don't let the focus fall IW, select and refocus on the first conversation in the list
- if (change_focus)
- {
- setFocus(TRUE);
- if (new_selection)
- {
- if (mConversationsWidgets.size() == 1)
- {
- // If only one widget is left, it has to be the Nearby Chat. Select it directly.
- selectConversationPair(LLUUID(NULL), true);
- }
- else
- {
- LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem());
- if (vmi)
- {
- selectConversationPair(vmi->getUUID(), true);
- }
- }
- }
- }
- return is_widget_selected;
+ // Will destroy views and delete models that are not assigned to any views
+ widget->destroyView();
+ }
+
+ // Suppress the conversation items and widgets from their respective maps
+ mConversationsItems.erase(uuid);
+ mConversationsWidgets.erase(uuid);
+ // Clear event query (otherwise reopening session in some way can bombard session with stale data)
+ mConversationEventQueue.erase(uuid);
+
+ // Don't let the focus fall IW, select and refocus on the first conversation in the list
+ if (change_focus)
+ {
+ setFocus(TRUE);
+ if (new_selection)
+ {
+ if (mConversationsWidgets.size() == 1)
+ {
+ // If only one widget is left, it has to be the Nearby Chat. Select it directly.
+ selectConversationPair(LLUUID(NULL), true);
+ }
+ else
+ {
+ LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem());
+ if (vmi)
+ {
+ selectConversationPair(vmi->getUUID(), true);
+ }
+ }
+ }
+ }
+ return is_widget_selected;
}
LLConversationViewSession* LLFloaterIMContainer::createConversationItemWidget(LLConversationItem* item)
{
- LLConversationViewSession::Params params;
-
- params.name = item->getDisplayName();
- params.root = mConversationsRoot;
- params.listener = item;
- params.tool_tip = params.name;
- params.container = this;
-
+ LLConversationViewSession::Params params;
+
+ params.name = item->getDisplayName();
+ params.root = mConversationsRoot;
+ params.listener = item;
+ params.tool_tip = params.name;
+ params.container = this;
+
//Indentation for aligning the p2p converstation image with the nearby chat arrow
if(item->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
{
params.folder_indentation = 3;
}
- return LLUICtrlFactory::create<LLConversationViewSession>(params);
+ return LLUICtrlFactory::create<LLConversationViewSession>(params);
}
LLConversationViewParticipant* LLFloaterIMContainer::createConversationViewParticipant(LLConversationItem* item)
{
- LLConversationViewParticipant::Params params;
+ LLConversationViewParticipant::Params params;
LLRect panel_rect = mConversationsListPanel->getRect();
-
- params.name = item->getDisplayName();
- params.root = mConversationsRoot;
- params.listener = item;
+
+ params.name = item->getDisplayName();
+ params.root = mConversationsRoot;
+ params.listener = item;
//24 is the the current hight of an item (itemHeight) loaded from conversation_view_participant.xml.
- params.rect = LLRect (0, 24, panel_rect.getWidth(), 0);
- params.tool_tip = params.name;
- params.participant_id = item->getUUID();
+ params.rect = LLRect (0, 24, panel_rect.getWidth(), 0);
+ params.tool_tip = params.name;
+ params.participant_id = item->getUUID();
params.folder_indentation = 27;
- return LLUICtrlFactory::create<LLConversationViewParticipant>(params);
+ return LLUICtrlFactory::create<LLConversationViewParticipant>(params);
}
bool LLFloaterIMContainer::enableModerateContextMenuItem(const std::string& userdata, bool is_self)
{
- // only group moderators can perform actions related to this "enable callback"
- if (!isGroupModerator())
- {
- return false;
- }
-
- LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant());
- if (NULL == speakerp)
- {
- return false;
- }
-
- bool voice_channel = speakerp->isInVoiceChannel();
-
- if ("can_moderate_voice" == userdata)
- {
- return voice_channel;
- }
- else if (("can_mute" == userdata) && !is_self)
- {
- return voice_channel && !isMuted(getCurSelectedViewModelItem()->getUUID());
- }
- else if ("can_unmute" == userdata)
- {
- return voice_channel && isMuted(getCurSelectedViewModelItem()->getUUID());
- }
-
- // The last invoke is used to check whether the "can_allow_text_chat" will enabled
- return LLVoiceClient::getInstance()->isParticipantAvatar(getCurSelectedViewModelItem()->getUUID()) && !is_self;
+ // only group moderators can perform actions related to this "enable callback"
+ if (!isGroupModerator())
+ {
+ return false;
+ }
+
+ LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant());
+ if (NULL == speakerp)
+ {
+ return false;
+ }
+
+ bool voice_channel = speakerp->isInVoiceChannel();
+
+ if ("can_moderate_voice" == userdata)
+ {
+ return voice_channel;
+ }
+ else if (("can_mute" == userdata) && !is_self)
+ {
+ return voice_channel && !isMuted(getCurSelectedViewModelItem()->getUUID());
+ }
+ else if ("can_unmute" == userdata)
+ {
+ return voice_channel && isMuted(getCurSelectedViewModelItem()->getUUID());
+ }
+
+ // The last invoke is used to check whether the "can_allow_text_chat" will enabled
+ return LLVoiceClient::getInstance()->isParticipantAvatar(getCurSelectedViewModelItem()->getUUID()) && !is_self;
}
bool LLFloaterIMContainer::isGroupModerator()
{
- LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant();
- if (NULL == speaker_manager)
- {
- LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
- return false;
- }
+ LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant();
+ if (NULL == speaker_manager)
+ {
+ LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
+ return false;
+ }
- // Is session a group call/chat?
- if(gAgent.isInGroup(speaker_manager->getSessionID()))
- {
- LLSpeaker * speaker = speaker_manager->findSpeaker(gAgentID).get();
+ // Is session a group call/chat?
+ if(gAgent.isInGroup(speaker_manager->getSessionID()))
+ {
+ LLSpeaker * speaker = speaker_manager->findSpeaker(gAgentID).get();
- // Is agent a moderator?
- return speaker && speaker->mIsModerator;
- }
+ // Is agent a moderator?
+ return speaker && speaker->mIsModerator;
+ }
- return false;
+ return false;
}
bool LLFloaterIMContainer::haveAbilityToBan()
{
- LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant();
- if (NULL == speaker_manager)
- {
- LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
- return false;
- }
- LLUUID group_uuid = speaker_manager->getSessionID();
+ LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant();
+ if (NULL == speaker_manager)
+ {
+ LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
+ return false;
+ }
+ LLUUID group_uuid = speaker_manager->getSessionID();
- return gAgent.isInGroup(group_uuid) && gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS);
+ return gAgent.isInGroup(group_uuid) && gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS);
}
bool LLFloaterIMContainer::canBanSelectedMember(const LLUUID& participant_uuid)
{
- LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant();
- if (NULL == speaker_manager)
- {
- LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
- return false;
- }
- LLUUID group_uuid = speaker_manager->getSessionID();
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
- if(!gdatap)
- {
- LL_WARNS("Groups") << "Unable to get group data for group " << group_uuid << LL_ENDL;
- return false;
- }
-
- if (gdatap->mPendingBanRequest)
- {
- return false;
- }
-
- if (gdatap->isRoleMemberDataComplete())
- {
- if (gdatap->mMembers.size())
- {
- LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find((participant_uuid));
- if (mi != gdatap->mMembers.end())
- {
- LLGroupMemberData* member_data = (*mi).second;
- // Is the member an owner?
- if (member_data && member_data->isInRole(gdatap->mOwnerRole))
- {
- return false;
- }
- }
- }
- }
-
- if( gAgent.hasPowerInGroup(group_uuid, GP_ROLE_REMOVE_MEMBER) &&
- gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS) )
- {
- return true;
- }
-
- return false;
+ LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant();
+ if (NULL == speaker_manager)
+ {
+ LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
+ return false;
+ }
+ LLUUID group_uuid = speaker_manager->getSessionID();
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
+ if(!gdatap)
+ {
+ LL_WARNS("Groups") << "Unable to get group data for group " << group_uuid << LL_ENDL;
+ return false;
+ }
+
+ if (gdatap->mPendingBanRequest)
+ {
+ return false;
+ }
+
+ if (gdatap->isRoleMemberDataComplete())
+ {
+ if (gdatap->mMembers.size())
+ {
+ LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find((participant_uuid));
+ if (mi != gdatap->mMembers.end())
+ {
+ LLGroupMemberData* member_data = (*mi).second;
+ // Is the member an owner?
+ if (member_data && member_data->isInRole(gdatap->mOwnerRole))
+ {
+ return false;
+ }
+ }
+ }
+ }
+
+ if( gAgent.hasPowerInGroup(group_uuid, GP_ROLE_REMOVE_MEMBER) &&
+ gAgent.hasPowerInGroup(group_uuid, GP_GROUP_BAN_ACCESS) )
+ {
+ return true;
+ }
+
+ return false;
}
void LLFloaterIMContainer::banSelectedMember(const LLUUID& participant_uuid)
{
- LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant();
- if (NULL == speaker_manager)
- {
- LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
- return;
- }
+ LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant();
+ if (NULL == speaker_manager)
+ {
+ LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
+ return;
+ }
- LLUUID group_uuid = speaker_manager->getSessionID();
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
- if(!gdatap)
- {
- LL_WARNS("Groups") << "Unable to get group data for group " << group_uuid << LL_ENDL;
- return;
- }
+ LLUUID group_uuid = speaker_manager->getSessionID();
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_uuid);
+ if(!gdatap)
+ {
+ LL_WARNS("Groups") << "Unable to get group data for group " << group_uuid << LL_ENDL;
+ return;
+ }
- gdatap->banMemberById(participant_uuid);
+ gdatap->banMemberById(participant_uuid);
}
void LLFloaterIMContainer::moderateVoice(const std::string& command, const LLUUID& userID)
{
- if (!gAgent.getRegion()) return;
+ if (!gAgent.getRegion()) return;
- if (command.compare("selected"))
- {
- moderateVoiceAllParticipants(command.compare("mute_all"));
- }
- else
- {
- moderateVoiceParticipant(userID, isMuted(userID));
- }
+ if (command.compare("selected"))
+ {
+ moderateVoiceAllParticipants(command.compare("mute_all"));
+ }
+ else
+ {
+ moderateVoiceParticipant(userID, isMuted(userID));
+ }
}
bool LLFloaterIMContainer::isMuted(const LLUUID& avatar_id)
{
- const LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant());
- return NULL == speakerp ? true : speakerp->mStatus == LLSpeaker::STATUS_MUTED;
+ const LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant());
+ return NULL == speakerp ? true : speakerp->mStatus == LLSpeaker::STATUS_MUTED;
}
void LLFloaterIMContainer::moderateVoiceAllParticipants(bool unmute)
{
- LLIMSpeakerMgr * speaker_managerp = dynamic_cast<LLIMSpeakerMgr*>(getSpeakerMgrForSelectedParticipant());
+ LLIMSpeakerMgr * speaker_managerp = dynamic_cast<LLIMSpeakerMgr*>(getSpeakerMgrForSelectedParticipant());
- if (NULL != speaker_managerp)
- {
- if (!unmute)
- {
- LLSD payload;
- payload["session_id"] = speaker_managerp->getSessionID();
- LLNotificationsUtil::add("ConfirmMuteAll", LLSD(), payload, confirmMuteAllCallback);
- return;
- }
+ if (NULL != speaker_managerp)
+ {
+ if (!unmute)
+ {
+ LLSD payload;
+ payload["session_id"] = speaker_managerp->getSessionID();
+ LLNotificationsUtil::add("ConfirmMuteAll", LLSD(), payload, confirmMuteAllCallback);
+ return;
+ }
- speaker_managerp->moderateVoiceAllParticipants(unmute);
- }
+ speaker_managerp->moderateVoiceAllParticipants(unmute);
+ }
}
// static
void LLFloaterIMContainer::confirmMuteAllCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- // if Cancel pressed
- if (option == 1)
- {
- return;
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ // if Cancel pressed
+ if (option == 1)
+ {
+ return;
+ }
- const LLSD& payload = notification["payload"];
- const LLUUID& session_id = payload["session_id"];
+ const LLSD& payload = notification["payload"];
+ const LLUUID& session_id = payload["session_id"];
- LLIMSpeakerMgr * speaker_manager = dynamic_cast<LLIMSpeakerMgr*> (
- LLIMModel::getInstance()->getSpeakerManager(session_id));
- if (speaker_manager)
- {
- speaker_manager->moderateVoiceAllParticipants(false);
- }
+ LLIMSpeakerMgr * speaker_manager = dynamic_cast<LLIMSpeakerMgr*> (
+ LLIMModel::getInstance()->getSpeakerManager(session_id));
+ if (speaker_manager)
+ {
+ speaker_manager->moderateVoiceAllParticipants(false);
+ }
- return;
+ return;
}
void LLFloaterIMContainer::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute)
{
- LLIMSpeakerMgr * speaker_managerp = dynamic_cast<LLIMSpeakerMgr *>(getSpeakerMgrForSelectedParticipant());
+ LLIMSpeakerMgr * speaker_managerp = dynamic_cast<LLIMSpeakerMgr *>(getSpeakerMgrForSelectedParticipant());
- if (NULL != speaker_managerp)
- {
- speaker_managerp->moderateVoiceParticipant(avatar_id, unmute);
- }
+ if (NULL != speaker_managerp)
+ {
+ speaker_managerp->moderateVoiceParticipant(avatar_id, unmute);
+ }
}
LLSpeakerMgr * LLFloaterIMContainer::getSpeakerMgrForSelectedParticipant()
{
- LLFolderViewItem *selectedItem = mConversationsRoot->getCurSelectedItem();
- if (NULL == selectedItem)
- {
- LL_WARNS() << "Current selected item is null" << LL_ENDL;
- return NULL;
- }
-
- conversations_widgets_map::const_iterator iter = mConversationsWidgets.begin();
- conversations_widgets_map::const_iterator end = mConversationsWidgets.end();
- const LLUUID * conversation_uuidp = NULL;
- while(iter != end)
- {
- if (iter->second == selectedItem || iter->second == selectedItem->getParentFolder())
- {
- conversation_uuidp = &iter->first;
- break;
- }
- ++iter;
- }
- if (NULL == conversation_uuidp)
- {
- LL_WARNS() << "Cannot find conversation item widget" << LL_ENDL;
- return NULL;
- }
-
- return conversation_uuidp->isNull() ? (LLSpeakerMgr *)LLLocalSpeakerMgr::getInstance()
- : LLIMModel::getInstance()->getSpeakerManager(*conversation_uuidp);
+ LLFolderViewItem *selectedItem = mConversationsRoot->getCurSelectedItem();
+ if (NULL == selectedItem)
+ {
+ LL_WARNS() << "Current selected item is null" << LL_ENDL;
+ return NULL;
+ }
+
+ conversations_widgets_map::const_iterator iter = mConversationsWidgets.begin();
+ conversations_widgets_map::const_iterator end = mConversationsWidgets.end();
+ const LLUUID * conversation_uuidp = NULL;
+ while(iter != end)
+ {
+ if (iter->second == selectedItem || iter->second == selectedItem->getParentFolder())
+ {
+ conversation_uuidp = &iter->first;
+ break;
+ }
+ ++iter;
+ }
+ if (NULL == conversation_uuidp)
+ {
+ LL_WARNS() << "Cannot find conversation item widget" << LL_ENDL;
+ return NULL;
+ }
+
+ return conversation_uuidp->isNull() ? (LLSpeakerMgr *)LLLocalSpeakerMgr::getInstance()
+ : LLIMModel::getInstance()->getSpeakerManager(*conversation_uuidp);
}
LLSpeaker * LLFloaterIMContainer::getSpeakerOfSelectedParticipant(LLSpeakerMgr * speaker_managerp)
{
- if (NULL == speaker_managerp)
- {
- LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
- return NULL;
- }
+ if (NULL == speaker_managerp)
+ {
+ LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
+ return NULL;
+ }
- const LLConversationItem * participant_itemp = getCurSelectedViewModelItem();
- if (NULL == participant_itemp)
- {
- LL_WARNS() << "Cannot evaluate current selected view model item" << LL_ENDL;
- return NULL;
- }
+ const LLConversationItem * participant_itemp = getCurSelectedViewModelItem();
+ if (NULL == participant_itemp)
+ {
+ LL_WARNS() << "Cannot evaluate current selected view model item" << LL_ENDL;
+ return NULL;
+ }
- return speaker_managerp->findSpeaker(participant_itemp->getUUID());
+ return speaker_managerp->findSpeaker(participant_itemp->getUUID());
}
void LLFloaterIMContainer::toggleAllowTextChat(const LLUUID& participant_uuid)
{
- LLIMSpeakerMgr * speaker_managerp = dynamic_cast<LLIMSpeakerMgr*>(getSpeakerMgrForSelectedParticipant());
- if (NULL != speaker_managerp)
- {
- speaker_managerp->toggleAllowTextChat(participant_uuid);
- }
+ LLIMSpeakerMgr * speaker_managerp = dynamic_cast<LLIMSpeakerMgr*>(getSpeakerMgrForSelectedParticipant());
+ if (NULL != speaker_managerp)
+ {
+ speaker_managerp->toggleAllowTextChat(participant_uuid);
+ }
}
void LLFloaterIMContainer::openNearbyChat()
{
- // If there's only one conversation in the container and that conversation is the nearby chat
- //(which it should be...), open it so to make the list of participants visible. This happens to be the most common case when opening the Chat floater.
- if((mConversationsItems.size() == 1)&&(!mConversationsPane->isCollapsed()))
- {
- LLConversationViewSession* nearby_chat = dynamic_cast<LLConversationViewSession*>(get_ptr_in_map(mConversationsWidgets,LLUUID()));
- if (nearby_chat)
- {
- reSelectConversation();
- nearby_chat->setOpen(TRUE);
- }
- }
+ // If there's only one conversation in the container and that conversation is the nearby chat
+ //(which it should be...), open it so to make the list of participants visible. This happens to be the most common case when opening the Chat floater.
+ if((mConversationsItems.size() == 1)&&(!mConversationsPane->isCollapsed()))
+ {
+ LLConversationViewSession* nearby_chat = dynamic_cast<LLConversationViewSession*>(get_ptr_in_map(mConversationsWidgets,LLUUID()));
+ if (nearby_chat)
+ {
+ reSelectConversation();
+ nearby_chat->setOpen(TRUE);
+ }
+ }
}
void LLFloaterIMContainer::reSelectConversation()
{
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession);
- if (session_floater->getHost())
- {
- selectFloater(session_floater);
- }
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession);
+ if (session_floater->getHost())
+ {
+ selectFloater(session_floater);
+ }
}
void LLFloaterIMContainer::updateSpeakBtnState()
{
- mSpeakBtn->setToggleState(LLVoiceClient::getInstance()->getUserPTTState());
- mSpeakBtn->setEnabled(LLAgent::isActionAllowed("speak"));
+ mSpeakBtn->setToggleState(LLVoiceClient::getInstance()->getUserPTTState());
+ mSpeakBtn->setEnabled(LLAgent::isActionAllowed("speak"));
}
bool LLFloaterIMContainer::isConversationLoggingAllowed()
{
- return gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 0;
+ return gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 0;
}
void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id, bool is_flashes)
{
//Finds the conversation line item to flash using the session_id
- LLConversationViewSession * widget = dynamic_cast<LLConversationViewSession *>(get_ptr_in_map(mConversationsWidgets,session_id));
+ LLConversationViewSession * widget = dynamic_cast<LLConversationViewSession *>(get_ptr_in_map(mConversationsWidgets,session_id));
- if (widget)
- {
- widget->setFlashState(is_flashes);
- }
+ if (widget)
+ {
+ widget->setFlashState(is_flashes);
+ }
}
void LLFloaterIMContainer::highlightConversationItemWidget(const LLUUID& session_id, bool is_highlighted)
{
- //Finds the conversation line item to highlight using the session_id
- LLConversationViewSession * widget = dynamic_cast<LLConversationViewSession *>(get_ptr_in_map(mConversationsWidgets,session_id));
+ //Finds the conversation line item to highlight using the session_id
+ LLConversationViewSession * widget = dynamic_cast<LLConversationViewSession *>(get_ptr_in_map(mConversationsWidgets,session_id));
- if (widget)
- {
- widget->setHighlightState(is_highlighted);
- }
+ if (widget)
+ {
+ widget->setHighlightState(is_highlighted);
+ }
}
bool LLFloaterIMContainer::isScrolledOutOfSight(LLConversationViewSession* conversation_item_widget)
{
- llassert(conversation_item_widget != NULL);
+ llassert(conversation_item_widget != NULL);
- // make sure the widget is actually in the right spot first
- mConversationsRoot->arrange(NULL, NULL);
+ // make sure the widget is actually in the right spot first
+ mConversationsRoot->arrange(NULL, NULL);
- // check whether the widget is in the visible portion of the scroll container
- LLRect widget_rect;
- conversation_item_widget->localRectToOtherView(conversation_item_widget->getLocalRect(), &widget_rect, mConversationsRoot);
- return !mConversationsRoot->getVisibleRect().overlaps(widget_rect);
+ // check whether the widget is in the visible portion of the scroll container
+ LLRect widget_rect;
+ conversation_item_widget->localRectToOtherView(conversation_item_widget->getLocalRect(), &widget_rect, mConversationsRoot);
+ return !mConversationsRoot->getVisibleRect().overlaps(widget_rect);
}
BOOL LLFloaterIMContainer::handleKeyHere(KEY key, MASK mask )
{
- BOOL handled = FALSE;
-
- if(mask == MASK_ALT)
- {
- if (KEY_RETURN == key )
- {
- expandConversation();
- handled = TRUE;
- }
-
- if ((KEY_DOWN == key ) || (KEY_RIGHT == key))
- {
- selectNextorPreviousConversation(true);
- handled = TRUE;
- }
- if ((KEY_UP == key) || (KEY_LEFT == key))
- {
- selectNextorPreviousConversation(false);
- handled = TRUE;
- }
- }
- return handled;
+ BOOL handled = FALSE;
+
+ if(mask == MASK_ALT)
+ {
+ if (KEY_RETURN == key )
+ {
+ expandConversation();
+ handled = TRUE;
+ }
+
+ if ((KEY_DOWN == key ) || (KEY_RIGHT == key))
+ {
+ selectNextorPreviousConversation(true);
+ handled = TRUE;
+ }
+ if ((KEY_UP == key) || (KEY_LEFT == key))
+ {
+ selectNextorPreviousConversation(false);
+ handled = TRUE;
+ }
+ }
+ return handled;
}
bool LLFloaterIMContainer::selectAdjacentConversation(bool focus_selected)
{
- bool selectedAdjacentConversation = selectNextorPreviousConversation(true, focus_selected);
+ bool selectedAdjacentConversation = selectNextorPreviousConversation(true, focus_selected);
- if(!selectedAdjacentConversation)
- {
- selectedAdjacentConversation = selectNextorPreviousConversation(false, focus_selected);
- }
+ if(!selectedAdjacentConversation)
+ {
+ selectedAdjacentConversation = selectNextorPreviousConversation(false, focus_selected);
+ }
- return selectedAdjacentConversation;
+ return selectedAdjacentConversation;
}
bool LLFloaterIMContainer::selectNextorPreviousConversation(bool select_next, bool focus_selected)
{
- if (mConversationsWidgets.size() > 1)
- {
- LLFolderViewItem* new_selection = NULL;
- LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,getSelectedSession());
- if (widget)
- {
- if(select_next)
- {
- new_selection = mConversationsRoot->getNextFromChild(widget, FALSE);
- }
- else
- {
- new_selection = mConversationsRoot->getPreviousFromChild(widget, FALSE);
- }
- if (new_selection)
- {
- LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem());
- if (vmi)
- {
- selectConversationPair(vmi->getUUID(), true, focus_selected);
- return true;
- }
- }
- }
- }
- return false;
+ if (mConversationsWidgets.size() > 1)
+ {
+ LLFolderViewItem* new_selection = NULL;
+ LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,getSelectedSession());
+ if (widget)
+ {
+ if(select_next)
+ {
+ new_selection = mConversationsRoot->getNextFromChild(widget, FALSE);
+ }
+ else
+ {
+ new_selection = mConversationsRoot->getPreviousFromChild(widget, FALSE);
+ }
+ if (new_selection)
+ {
+ LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem());
+ if (vmi)
+ {
+ selectConversationPair(vmi->getUUID(), true, focus_selected);
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
void LLFloaterIMContainer::expandConversation()
{
- if(!mConversationsPane->isCollapsed())
- {
- LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(get_ptr_in_map(mConversationsWidgets,getSelectedSession()));
- if (widget)
- {
- widget->setOpen(!widget->isOpen());
- }
- }
+ if(!mConversationsPane->isCollapsed())
+ {
+ LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(get_ptr_in_map(mConversationsWidgets,getSelectedSession()));
+ if (widget)
+ {
+ widget->setOpen(!widget->isOpen());
+ }
+ }
}
bool LLFloaterIMContainer::isParticipantListExpanded()
{
- bool is_expanded = false;
- if(!mConversationsPane->isCollapsed())
- {
- LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(get_ptr_in_map(mConversationsWidgets,getSelectedSession()));
- if (widget)
- {
- is_expanded = widget->isOpen();
- }
- }
- return is_expanded;
+ bool is_expanded = false;
+ if(!mConversationsPane->isCollapsed())
+ {
+ LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(get_ptr_in_map(mConversationsWidgets,getSelectedSession()));
+ if (widget)
+ {
+ is_expanded = widget->isOpen();
+ }
+ }
+ return is_expanded;
}
// By default, if torn off session is currently frontmost, LLFloater::isFrontmost() will return FALSE, which can lead to some bugs
@@ -2410,91 +2410,91 @@ bool LLFloaterIMContainer::isParticipantListExpanded()
/*virtual*/
BOOL LLFloaterIMContainer::isFrontmost()
{
- LLFloaterIMSessionTab* selected_session = LLFloaterIMSessionTab::getConversation(mSelectedSession);
- LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- return (selected_session && selected_session->isFrontmost() && (selected_session != nearby_chat))
- || LLFloater::isFrontmost();
+ LLFloaterIMSessionTab* selected_session = LLFloaterIMSessionTab::getConversation(mSelectedSession);
+ LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ return (selected_session && selected_session->isFrontmost() && (selected_session != nearby_chat))
+ || LLFloater::isFrontmost();
}
// For conversations, closeFloater() (linked to Ctrl-W) does not actually close the floater but the active conversation.
// This is intentional so it doesn't confuse the user. onClickCloseBtn() closes the whole floater.
void LLFloaterIMContainer::onClickCloseBtn(bool app_quitting/* = false*/)
{
- gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", mConversationsPane->getRect().getWidth());
- LLMultiFloater::closeFloater(app_quitting);
+ gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", mConversationsPane->getRect().getWidth());
+ LLMultiFloater::closeFloater(app_quitting);
}
void LLFloaterIMContainer::closeHostedFloater()
{
- onClickCloseBtn();
+ onClickCloseBtn();
}
void LLFloaterIMContainer::closeAllConversations()
{
- std::vector<LLUUID> ids;
- for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++)
- {
- LLUUID session_id = it_session->first;
- if (session_id != LLUUID())
- {
- ids.push_back(session_id);
- }
- }
+ std::vector<LLUUID> ids;
+ for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++)
+ {
+ LLUUID session_id = it_session->first;
+ if (session_id != LLUUID())
+ {
+ ids.push_back(session_id);
+ }
+ }
- for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(*it);
- LLFloater::onClickClose(conversationFloater);
- }
+ for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(*it);
+ LLFloater::onClickClose(conversationFloater);
+ }
}
void LLFloaterIMContainer::closeSelectedConversations(const uuid_vec_t& ids)
{
- for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- //We don't need to close Nearby chat, so skip it
- if (*it != LLUUID())
- {
- LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(*it);
- if(conversationFloater)
- {
- LLFloater::onClickClose(conversationFloater);
- }
- }
- }
+ for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ //We don't need to close Nearby chat, so skip it
+ if (*it != LLUUID())
+ {
+ LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(*it);
+ if(conversationFloater)
+ {
+ LLFloater::onClickClose(conversationFloater);
+ }
+ }
+ }
}
void LLFloaterIMContainer::closeFloater(bool app_quitting/* = false*/)
{
- if(app_quitting)
- {
- closeAllConversations();
- onClickCloseBtn(app_quitting);
- }
- else
- {
- // Check for currently active session
- LLUUID session_id = getSelectedSession();
- // If current session is Nearby Chat or there is only one session remaining, close the floater
- if (mConversationsItems.size() == 1 || session_id == LLUUID() || app_quitting)
- {
- onClickCloseBtn();
- }
- else
- {
- // Otherwise, close current conversation
- LLFloaterIMSessionTab* active_conversation = LLFloaterIMSessionTab::getConversation(session_id);
- if (active_conversation)
- {
- active_conversation->closeFloater();
- }
- }
- }
+ if(app_quitting)
+ {
+ closeAllConversations();
+ onClickCloseBtn(app_quitting);
+ }
+ else
+ {
+ // Check for currently active session
+ LLUUID session_id = getSelectedSession();
+ // If current session is Nearby Chat or there is only one session remaining, close the floater
+ if (mConversationsItems.size() == 1 || session_id == LLUUID() || app_quitting)
+ {
+ onClickCloseBtn();
+ }
+ else
+ {
+ // Otherwise, close current conversation
+ LLFloaterIMSessionTab* active_conversation = LLFloaterIMSessionTab::getConversation(session_id);
+ if (active_conversation)
+ {
+ active_conversation->closeFloater();
+ }
+ }
+ }
}
void LLFloaterIMContainer::handleReshape(const LLRect& rect, bool by_user)
{
- LLMultiFloater::handleReshape(rect, by_user);
- storeRectControl();
+ LLMultiFloater::handleReshape(rect, by_user);
+ storeRectControl();
}
// EOF
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index 82f3b00ebc..71fe2bd204 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterimcontainer.h
* @brief Multifloater containing active IM sessions in separate tab container tabs
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,192 +49,192 @@ class LLSpeaker;
class LLSpeakerMgr;
class LLFloaterIMContainer
- : public LLMultiFloater
- , public LLIMSessionObserver
+ : public LLMultiFloater
+ , public LLIMSessionObserver
{
public:
- LLFloaterIMContainer(const LLSD& seed, const Params& params = getDefaultParams());
- virtual ~LLFloaterIMContainer();
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void draw();
- /*virtual*/ void setMinimized(BOOL b);
- /*virtual*/ void setVisible(BOOL visible);
- /*virtual*/ void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD());
- /*virtual*/ void updateResizeLimits();
- /*virtual*/ void handleReshape(const LLRect& rect, bool by_user);
-
- void onCloseFloater(LLUUID& id);
-
- /*virtual*/ void addFloater(LLFloater* floaterp,
- BOOL select_added_floater,
- LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
- void returnFloaterToHost();
+ LLFloaterIMContainer(const LLSD& seed, const Params& params = getDefaultParams());
+ virtual ~LLFloaterIMContainer();
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void draw();
+ /*virtual*/ void setMinimized(BOOL b);
+ /*virtual*/ void setVisible(BOOL visible);
+ /*virtual*/ void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD());
+ /*virtual*/ void updateResizeLimits();
+ /*virtual*/ void handleReshape(const LLRect& rect, bool by_user);
+
+ void onCloseFloater(LLUUID& id);
+
+ /*virtual*/ void addFloater(LLFloater* floaterp,
+ BOOL select_added_floater,
+ LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
+ void returnFloaterToHost();
void showConversation(const LLUUID& session_id);
void selectConversation(const LLUUID& session_id);
- void selectNextConversationByID(const LLUUID& session_id);
+ void selectNextConversationByID(const LLUUID& session_id);
BOOL selectConversationPair(const LLUUID& session_id, bool select_widget, bool focus_floater = true);
void clearAllFlashStates();
- bool selectAdjacentConversation(bool focus_selected);
+ bool selectAdjacentConversation(bool focus_selected);
bool selectNextorPreviousConversation(bool select_next, bool focus_selected = true);
void expandConversation();
- /*virtual*/ void tabClose();
- void showStub(bool visible);
+ /*virtual*/ void tabClose();
+ void showStub(bool visible);
+
+ static LLFloater* getCurrentVoiceFloater();
+ static LLFloaterIMContainer* findInstance();
+ static LLFloaterIMContainer* getInstance();
- static LLFloater* getCurrentVoiceFloater();
- static LLFloaterIMContainer* findInstance();
- static LLFloaterIMContainer* getInstance();
+ static void onCurrentChannelChanged(const LLUUID& session_id);
- static void onCurrentChannelChanged(const LLUUID& session_id);
+ void collapseMessagesPane(bool collapse);
+ bool isMessagesPaneCollapsed();
+ bool isConversationsPaneCollapsed();
- void collapseMessagesPane(bool collapse);
- bool isMessagesPaneCollapsed();
- bool isConversationsPaneCollapsed();
-
- // Callbacks
- static void idle(void* user_data);
+ // Callbacks
+ static void idle(void* user_data);
- // LLIMSessionObserver observe triggers
- /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg);
+ // LLIMSessionObserver observe triggers
+ /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg);
/*virtual*/ void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id);
- /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id);
- /*virtual*/ void sessionRemoved(const LLUUID& session_id);
- /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id);
+ /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id);
+ /*virtual*/ void sessionRemoved(const LLUUID& session_id);
+ /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id);
- LLConversationViewModel& getRootViewModel() { return mConversationViewModel; }
+ LLConversationViewModel& getRootViewModel() { return mConversationViewModel; }
LLUUID getSelectedSession() { return mSelectedSession; }
void setSelectedSession(LLUUID sessionID) { mSelectedSession = sessionID; }
- LLConversationItem* getSessionModel(const LLUUID& session_id);
- LLConversationSort& getSortOrder() { return mConversationViewModel.getSorter(); }
+ LLConversationItem* getSessionModel(const LLUUID& session_id);
+ LLConversationSort& getSortOrder() { return mConversationViewModel.getSorter(); }
- // Handling of lists of participants is public so to be common with llfloatersessiontab
- // *TODO : Find a better place for this.
+ // Handling of lists of participants is public so to be common with llfloatersessiontab
+ // *TODO : Find a better place for this.
bool checkContextMenuItem(const std::string& item, uuid_vec_t& selectedIDS);
bool enableContextMenuItem(const std::string& item, uuid_vec_t& selectedIDS);
void doToParticipants(const std::string& item, uuid_vec_t& selectedIDS);
- void assignResizeLimits();
- virtual BOOL handleKeyHere(KEY key, MASK mask );
- /*virtual*/ void closeFloater(bool app_quitting = false);
+ void assignResizeLimits();
+ virtual BOOL handleKeyHere(KEY key, MASK mask );
+ /*virtual*/ void closeFloater(bool app_quitting = false);
void closeAllConversations();
void closeSelectedConversations(const uuid_vec_t& ids);
- /*virtual*/ BOOL isFrontmost();
+ /*virtual*/ BOOL isFrontmost();
private:
- typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t;
- avatarID_panel_map_t mSessions;
- boost::signals2::connection mNewMessageConnection;
+ typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t;
+ avatarID_panel_map_t mSessions;
+ boost::signals2::connection mNewMessageConnection;
- /*virtual*/ void computeResizeLimits(S32& new_min_width, S32& new_min_height) {}
+ /*virtual*/ void computeResizeLimits(S32& new_min_width, S32& new_min_height) {}
- void onNewMessageReceived(const LLSD& data);
+ void onNewMessageReceived(const LLSD& data);
- void onExpandCollapseButtonClicked();
- void onStubCollapseButtonClicked();
- void processParticipantsStyleUpdate();
- void onSpeakButtonPressed();
- void onSpeakButtonReleased();
- /*virtual*/ void onClickCloseBtn(bool app_quitting = false);
- /*virtual*/ void closeHostedFloater();
+ void onExpandCollapseButtonClicked();
+ void onStubCollapseButtonClicked();
+ void processParticipantsStyleUpdate();
+ void onSpeakButtonPressed();
+ void onSpeakButtonReleased();
+ /*virtual*/ void onClickCloseBtn(bool app_quitting = false);
+ /*virtual*/ void closeHostedFloater();
- void collapseConversationsPane(bool collapse, bool save_is_allowed=true);
+ void collapseConversationsPane(bool collapse, bool save_is_allowed=true);
- void reshapeFloaterAndSetResizeLimits(bool collapse, S32 delta_width);
+ void reshapeFloaterAndSetResizeLimits(bool collapse, S32 delta_width);
- void onAddButtonClicked();
- void onAvatarPicked(const uuid_vec_t& ids);
+ void onAddButtonClicked();
+ void onAvatarPicked(const uuid_vec_t& ids);
- BOOL isActionChecked(const LLSD& userdata);
- void onCustomAction (const LLSD& userdata);
- void setSortOrderSessions(const LLConversationFilter::ESortOrderType order);
- void setSortOrderParticipants(const LLConversationFilter::ESortOrderType order);
- void setSortOrder(const LLConversationSort& order);
+ BOOL isActionChecked(const LLSD& userdata);
+ void onCustomAction (const LLSD& userdata);
+ void setSortOrderSessions(const LLConversationFilter::ESortOrderType order);
+ void setSortOrderParticipants(const LLConversationFilter::ESortOrderType order);
+ void setSortOrder(const LLConversationSort& order);
void getSelectedUUIDs(uuid_vec_t& selected_uuids, bool participant_uuids = true);
const LLConversationItem * getCurSelectedViewModelItem();
void getParticipantUUIDs(uuid_vec_t& selected_uuids);
void doToSelected(const LLSD& userdata);
- bool checkContextMenuItem(const LLSD& userdata);
- bool enableContextMenuItem(const LLSD& userdata);
- bool visibleContextMenuItem(const LLSD& userdata);
+ bool checkContextMenuItem(const LLSD& userdata);
+ bool enableContextMenuItem(const LLSD& userdata);
+ bool visibleContextMenuItem(const LLSD& userdata);
void doToSelectedConversation(const std::string& command, uuid_vec_t& selectedIDS);
void doToSelectedGroup(const LLSD& userdata);
- static void confirmMuteAllCallback(const LLSD& notification, const LLSD& response);
- bool enableModerateContextMenuItem(const std::string& userdata, bool is_self = false);
- LLSpeaker * getSpeakerOfSelectedParticipant(LLSpeakerMgr * speaker_managerp);
- LLSpeakerMgr * getSpeakerMgrForSelectedParticipant();
- bool isGroupModerator();
- bool haveAbilityToBan();
- bool canBanSelectedMember(const LLUUID& participant_uuid);
- LLUUID getGroupUIIDForSelectedParticipant();
- bool isMuted(const LLUUID& avatar_id);
- void moderateVoice(const std::string& command, const LLUUID& userID);
- void moderateVoiceAllParticipants(bool unmute);
- void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute);
- void toggleAllowTextChat(const LLUUID& participant_uuid);
- void banSelectedMember(const LLUUID& participant_uuid);
- void openNearbyChat();
- bool isParticipantListExpanded();
-
- void idleUpdate(); // for convenience (self) from static idle
- void idleProcessEvents();
-
- LLButton* mExpandCollapseBtn;
- LLButton* mStubCollapseBtn;
+ static void confirmMuteAllCallback(const LLSD& notification, const LLSD& response);
+ bool enableModerateContextMenuItem(const std::string& userdata, bool is_self = false);
+ LLSpeaker * getSpeakerOfSelectedParticipant(LLSpeakerMgr * speaker_managerp);
+ LLSpeakerMgr * getSpeakerMgrForSelectedParticipant();
+ bool isGroupModerator();
+ bool haveAbilityToBan();
+ bool canBanSelectedMember(const LLUUID& participant_uuid);
+ LLUUID getGroupUIIDForSelectedParticipant();
+ bool isMuted(const LLUUID& avatar_id);
+ void moderateVoice(const std::string& command, const LLUUID& userID);
+ void moderateVoiceAllParticipants(bool unmute);
+ void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute);
+ void toggleAllowTextChat(const LLUUID& participant_uuid);
+ void banSelectedMember(const LLUUID& participant_uuid);
+ void openNearbyChat();
+ bool isParticipantListExpanded();
+
+ void idleUpdate(); // for convenience (self) from static idle
+ void idleProcessEvents();
+
+ LLButton* mExpandCollapseBtn;
+ LLButton* mStubCollapseBtn;
LLButton* mSpeakBtn;
- LLPanel* mStubPanel;
- LLTextBox* mStubTextBox;
- LLLayoutPanel* mMessagesPane;
- LLLayoutPanel* mConversationsPane;
- LLLayoutStack* mConversationsStack;
-
- bool mInitialized;
- bool mIsFirstLaunch;
+ LLPanel* mStubPanel;
+ LLTextBox* mStubTextBox;
+ LLLayoutPanel* mMessagesPane;
+ LLLayoutPanel* mConversationsPane;
+ LLLayoutStack* mConversationsStack;
+
+ bool mInitialized;
+ bool mIsFirstLaunch;
- bool mIsFirstOpen;
+ bool mIsFirstOpen;
- LLUUID mSelectedSession;
- std::string mGeneralTitle;
+ LLUUID mSelectedSession;
+ std::string mGeneralTitle;
- // Conversation list implementation
+ // Conversation list implementation
public:
- bool removeConversationListItem(const LLUUID& uuid, bool change_focus = true);
- LLConversationItem* addConversationListItem(const LLUUID& uuid, bool isWidgetSelected = false);
- void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id);
- void setNearbyDistances();
- void reSelectConversation();
- void updateSpeakBtnState();
- static bool isConversationLoggingAllowed();
- void flashConversationItemWidget(const LLUUID& session_id, bool is_flashes);
- void highlightConversationItemWidget(const LLUUID& session_id, bool is_highlighted);
- bool isScrolledOutOfSight(LLConversationViewSession* conversation_item_widget);
- boost::signals2::connection mMicroChangedSignal;
- S32 getConversationListItemSize() { return mConversationsWidgets.size(); }
- typedef std::list<LLFloater*> floater_list_t;
- void getDetachedConversationFloaters(floater_list_t& floaters);
+ bool removeConversationListItem(const LLUUID& uuid, bool change_focus = true);
+ LLConversationItem* addConversationListItem(const LLUUID& uuid, bool isWidgetSelected = false);
+ void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id);
+ void setNearbyDistances();
+ void reSelectConversation();
+ void updateSpeakBtnState();
+ static bool isConversationLoggingAllowed();
+ void flashConversationItemWidget(const LLUUID& session_id, bool is_flashes);
+ void highlightConversationItemWidget(const LLUUID& session_id, bool is_highlighted);
+ bool isScrolledOutOfSight(LLConversationViewSession* conversation_item_widget);
+ boost::signals2::connection mMicroChangedSignal;
+ S32 getConversationListItemSize() { return mConversationsWidgets.size(); }
+ typedef std::list<LLFloater*> floater_list_t;
+ void getDetachedConversationFloaters(floater_list_t& floaters);
private:
- LLConversationViewSession* createConversationItemWidget(LLConversationItem* item);
- LLConversationViewParticipant* createConversationViewParticipant(LLConversationItem* item);
- bool onConversationModelEvent(const LLSD& event);
- void handleConversationModelEvent(const LLSD& event);
-
- // Conversation list data
- LLPanel* mConversationsListPanel; // This is the main widget we add conversation widget to
- conversations_items_map mConversationsItems;
- conversations_widgets_map mConversationsWidgets;
- LLConversationViewModel mConversationViewModel;
- LLFolderView* mConversationsRoot;
- LLEventStream mConversationsEventStream;
-
- typedef std::map<LLUUID, std::deque<LLSD> > conversations_items_deque;
- conversations_items_deque mConversationEventQueue;
-
- LLTimer mParticipantRefreshTimer;
+ LLConversationViewSession* createConversationItemWidget(LLConversationItem* item);
+ LLConversationViewParticipant* createConversationViewParticipant(LLConversationItem* item);
+ bool onConversationModelEvent(const LLSD& event);
+ void handleConversationModelEvent(const LLSD& event);
+
+ // Conversation list data
+ LLPanel* mConversationsListPanel; // This is the main widget we add conversation widget to
+ conversations_items_map mConversationsItems;
+ conversations_widgets_map mConversationsWidgets;
+ LLConversationViewModel mConversationViewModel;
+ LLFolderView* mConversationsRoot;
+ LLEventStream mConversationsEventStream;
+
+ typedef std::map<LLUUID, std::deque<LLSD> > conversations_items_deque;
+ conversations_items_deque mConversationEventQueue;
+
+ LLTimer mParticipantRefreshTimer;
};
#endif // LL_LLFLOATERIMCONTAINER_H
diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index 40bdf14deb..002dc4fa1a 100644
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file LLFloaterIMNearbyChat.cpp
* @brief LLFloaterIMNearbyChat class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -79,35 +79,35 @@ const S32 EXPANDED_MIN_HEIGHT = 150;
void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
struct LLChatTypeTrigger {
- std::string name;
- EChatType type;
+ std::string name;
+ EChatType type;
};
static LLChatTypeTrigger sChatTypeTriggers[] = {
- { "/whisper" , CHAT_TYPE_WHISPER},
- { "/shout" , CHAT_TYPE_SHOUT}
+ { "/whisper" , CHAT_TYPE_WHISPER},
+ { "/shout" , CHAT_TYPE_SHOUT}
};
bool cb_do_nothing()
{
- return false;
+ return false;
}
LLFloaterIMNearbyChat::LLFloaterIMNearbyChat(const LLSD& llsd)
-: LLFloaterIMSessionTab(LLSD(LLUUID::null)),
- //mOutputMonitor(NULL),
- mSpeakerMgr(NULL),
- mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
+: LLFloaterIMSessionTab(LLSD(LLUUID::null)),
+ //mOutputMonitor(NULL),
+ mSpeakerMgr(NULL),
+ mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
{
mIsP2PChat = false;
- mIsNearbyChat = true;
- mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
+ mIsNearbyChat = true;
+ mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
- // Required by LLFloaterIMSessionTab::mGearBtn
- // But nearby floater has no 'per agent' menu items,
- mEnableCallbackRegistrar.add("Avatar.EnableGearItem", boost::bind(&cb_do_nothing));
- mCommitCallbackRegistrar.add("Avatar.GearDoToSelected", boost::bind(&cb_do_nothing));
- mEnableCallbackRegistrar.add("Avatar.CheckGearItem", boost::bind(&cb_do_nothing));
+ // Required by LLFloaterIMSessionTab::mGearBtn
+ // But nearby floater has no 'per agent' menu items,
+ mEnableCallbackRegistrar.add("Avatar.EnableGearItem", boost::bind(&cb_do_nothing));
+ mCommitCallbackRegistrar.add("Avatar.GearDoToSelected", boost::bind(&cb_do_nothing));
+ mEnableCallbackRegistrar.add("Avatar.CheckGearItem", boost::bind(&cb_do_nothing));
mMinFloaterHeight = EXPANDED_MIN_HEIGHT;
}
@@ -125,747 +125,747 @@ BOOL LLFloaterIMNearbyChat::postBuild()
setIsSingleInstance(TRUE);
BOOL result = LLFloaterIMSessionTab::postBuild();
- mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5));
- mInputEditor->setCommitCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxCommit, this));
- mInputEditor->setKeystrokeCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxKeystroke, this));
- mInputEditor->setFocusLostCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusLost, this));
- mInputEditor->setFocusReceivedCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusReceived, this));
- std::string nearbyChatTitle(LLTrans::getString("NearbyChatTitle"));
- mInputEditor->setLabel(nearbyChatTitle);
+ mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5));
+ mInputEditor->setCommitCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxCommit, this));
+ mInputEditor->setKeystrokeCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxKeystroke, this));
+ mInputEditor->setFocusLostCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusLost, this));
+ mInputEditor->setFocusReceivedCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusReceived, this));
+ std::string nearbyChatTitle(LLTrans::getString("NearbyChatTitle"));
+ mInputEditor->setLabel(nearbyChatTitle);
- // Title must be defined BEFORE call to addConversationListItem() because
- // it is used to show the item's name in the conversations list
- setTitle(nearbyChatTitle);
+ // Title must be defined BEFORE call to addConversationListItem() because
+ // it is used to show the item's name in the conversations list
+ setTitle(nearbyChatTitle);
- // obsolete, but may be needed for backward compatibility?
- gSavedSettings.declareS32("nearbychat_showicons_and_names", 2, "NearByChat header settings", LLControlVariable::PERSIST_NONDFT);
+ // obsolete, but may be needed for backward compatibility?
+ gSavedSettings.declareS32("nearbychat_showicons_and_names", 2, "NearByChat header settings", LLControlVariable::PERSIST_NONDFT);
- if (gSavedPerAccountSettings.getBOOL("LogShowHistory"))
- {
- loadHistory();
- }
+ if (gSavedPerAccountSettings.getBOOL("LogShowHistory"))
+ {
+ loadHistory();
+ }
- return result;
+ return result;
}
// virtual
void LLFloaterIMNearbyChat::closeHostedFloater()
{
- // If detached from conversations window close anyway
- if (!getHost())
- {
- setVisible(FALSE);
- }
-
- // Should check how many conversations are ongoing. Select next to "Nearby Chat" in case there are some other besides.
- // Close conversations window in case "Nearby Chat" is attached and the only conversation
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- if (floater_container->getConversationListItemSize() == 1)
- {
- if (getHost())
- {
- floater_container->closeFloater();
- }
- }
- else
- {
- if (!getHost())
- {
- floater_container->selectNextConversationByID(LLUUID());
- }
- }
+ // If detached from conversations window close anyway
+ if (!getHost())
+ {
+ setVisible(FALSE);
+ }
+
+ // Should check how many conversations are ongoing. Select next to "Nearby Chat" in case there are some other besides.
+ // Close conversations window in case "Nearby Chat" is attached and the only conversation
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ if (floater_container->getConversationListItemSize() == 1)
+ {
+ if (getHost())
+ {
+ floater_container->closeFloater();
+ }
+ }
+ else
+ {
+ if (!getHost())
+ {
+ floater_container->selectNextConversationByID(LLUUID());
+ }
+ }
}
// virtual
void LLFloaterIMNearbyChat::refresh()
{
- displaySpeakingIndicator();
- updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState());
+ displaySpeakingIndicator();
+ updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState());
- // *HACK: Update transparency type depending on whether our children have focus.
- // This is needed because this floater is chrome and thus cannot accept focus, so
- // the transparency type setting code from LLFloater::setFocus() isn't reached.
- if (getTransparencyType() != TT_DEFAULT)
- {
- setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE);
- }
+ // *HACK: Update transparency type depending on whether our children have focus.
+ // This is needed because this floater is chrome and thus cannot accept focus, so
+ // the transparency type setting code from LLFloater::setFocus() isn't reached.
+ if (getTransparencyType() != TT_DEFAULT)
+ {
+ setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE);
+ }
}
void LLFloaterIMNearbyChat::reloadMessages(bool clean_messages/* = false*/)
{
- if (clean_messages)
- {
- mMessageArchive.clear();
- loadHistory();
- }
+ if (clean_messages)
+ {
+ mMessageArchive.clear();
+ loadHistory();
+ }
- mChatHistory->clear();
+ mChatHistory->clear();
- LLSD do_not_log;
- do_not_log["do_not_log"] = true;
- for(std::vector<LLChat>::iterator it = mMessageArchive.begin();it!=mMessageArchive.end();++it)
- {
- // Update the messages without re-writing them to a log file.
- addMessage(*it,false, do_not_log);
- }
+ LLSD do_not_log;
+ do_not_log["do_not_log"] = true;
+ for(std::vector<LLChat>::iterator it = mMessageArchive.begin();it!=mMessageArchive.end();++it)
+ {
+ // Update the messages without re-writing them to a log file.
+ addMessage(*it,false, do_not_log);
+ }
}
void LLFloaterIMNearbyChat::loadHistory()
{
- LLSD do_not_log;
- do_not_log["do_not_log"] = true;
-
- std::list<LLSD> history;
- LLLogChat::loadChatHistory("chat", history);
-
- std::list<LLSD>::const_iterator it = history.begin();
- while (it != history.end())
- {
- const LLSD& msg = *it;
-
- std::string from = msg[LL_IM_FROM];
- LLUUID from_id;
- if (msg[LL_IM_FROM_ID].isDefined())
- {
- from_id = msg[LL_IM_FROM_ID].asUUID();
- }
- else
- {
- std::string legacy_name = gCacheName->buildLegacyName(from);
- from_id = LLAvatarNameCache::getInstance()->findIdByName(legacy_name);
- }
-
- LLChat chat;
- chat.mFromName = from;
- chat.mFromID = from_id;
- chat.mText = msg[LL_IM_TEXT].asString();
- chat.mTimeStr = msg[LL_IM_TIME].asString();
- chat.mChatStyle = CHAT_STYLE_HISTORY;
-
- chat.mSourceType = CHAT_SOURCE_AGENT;
- if (from_id.isNull() && SYSTEM_FROM == from)
- {
- chat.mSourceType = CHAT_SOURCE_SYSTEM;
-
- }
- else if (from_id.isNull())
- {
- chat.mSourceType = isWordsName(from) ? CHAT_SOURCE_UNKNOWN : CHAT_SOURCE_OBJECT;
- }
-
- addMessage(chat, true, do_not_log);
-
- it++;
- }
+ LLSD do_not_log;
+ do_not_log["do_not_log"] = true;
+
+ std::list<LLSD> history;
+ LLLogChat::loadChatHistory("chat", history);
+
+ std::list<LLSD>::const_iterator it = history.begin();
+ while (it != history.end())
+ {
+ const LLSD& msg = *it;
+
+ std::string from = msg[LL_IM_FROM];
+ LLUUID from_id;
+ if (msg[LL_IM_FROM_ID].isDefined())
+ {
+ from_id = msg[LL_IM_FROM_ID].asUUID();
+ }
+ else
+ {
+ std::string legacy_name = gCacheName->buildLegacyName(from);
+ from_id = LLAvatarNameCache::getInstance()->findIdByName(legacy_name);
+ }
+
+ LLChat chat;
+ chat.mFromName = from;
+ chat.mFromID = from_id;
+ chat.mText = msg[LL_IM_TEXT].asString();
+ chat.mTimeStr = msg[LL_IM_TIME].asString();
+ chat.mChatStyle = CHAT_STYLE_HISTORY;
+
+ chat.mSourceType = CHAT_SOURCE_AGENT;
+ if (from_id.isNull() && SYSTEM_FROM == from)
+ {
+ chat.mSourceType = CHAT_SOURCE_SYSTEM;
+
+ }
+ else if (from_id.isNull())
+ {
+ chat.mSourceType = isWordsName(from) ? CHAT_SOURCE_UNKNOWN : CHAT_SOURCE_OBJECT;
+ }
+
+ addMessage(chat, true, do_not_log);
+
+ it++;
+ }
}
void LLFloaterIMNearbyChat::removeScreenChat()
{
- LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID")));
- if(chat_channel)
- {
- chat_channel->removeToastsFromChannel();
- }
+ LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID")));
+ if(chat_channel)
+ {
+ chat_channel->removeToastsFromChannel();
+ }
}
void LLFloaterIMNearbyChat::setVisible(BOOL visible)
{
- LLFloaterIMSessionTab::setVisible(visible);
+ LLFloaterIMSessionTab::setVisible(visible);
- if(visible)
- {
- removeScreenChat();
- }
+ if(visible)
+ {
+ removeScreenChat();
+ }
}
void LLFloaterIMNearbyChat::setVisibleAndFrontmost(BOOL take_focus, const LLSD& key)
{
- LLFloaterIMSessionTab::setVisibleAndFrontmost(take_focus, key);
+ LLFloaterIMSessionTab::setVisibleAndFrontmost(take_focus, key);
- if(matchesKey(key))
- {
- LLFloaterIMContainer::getInstance()->selectConversationPair(mSessionID, true, take_focus);
- }
+ if(matchesKey(key))
+ {
+ LLFloaterIMContainer::getInstance()->selectConversationPair(mSessionID, true, take_focus);
+ }
}
// virtual
void LLFloaterIMNearbyChat::onTearOffClicked()
{
- LLFloaterIMSessionTab::onTearOffClicked();
+ LLFloaterIMSessionTab::onTearOffClicked();
- // see CHUI-170: Save torn-off state of the nearby chat between sessions
- bool in_the_multifloater(getHost());
- gSavedPerAccountSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater);
+ // see CHUI-170: Save torn-off state of the nearby chat between sessions
+ bool in_the_multifloater(getHost());
+ gSavedPerAccountSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater);
}
// virtual
void LLFloaterIMNearbyChat::onOpen(const LLSD& key)
{
- LLFloaterIMSessionTab::onOpen(key);
- if(!isMessagePaneExpanded())
- {
- restoreFloater();
- onCollapseToLine(this);
- }
+ LLFloaterIMSessionTab::onOpen(key);
+ if(!isMessagePaneExpanded())
+ {
+ restoreFloater();
+ onCollapseToLine(this);
+ }
}
// virtual
void LLFloaterIMNearbyChat::onClose(bool app_quitting)
{
- // Override LLFloaterIMSessionTab::onClose() so that Nearby Chat is not removed from the conversation floater
- LLFloaterIMSessionTab::restoreFloater();
- if (app_quitting)
- {
- // We are starting and closing floater in "expanded" state
- // Update expanded (restored) rect and position for use in next session
- forceReshape();
- storeRectControl();
- }
+ // Override LLFloaterIMSessionTab::onClose() so that Nearby Chat is not removed from the conversation floater
+ LLFloaterIMSessionTab::restoreFloater();
+ if (app_quitting)
+ {
+ // We are starting and closing floater in "expanded" state
+ // Update expanded (restored) rect and position for use in next session
+ forceReshape();
+ storeRectControl();
+ }
}
// virtual
void LLFloaterIMNearbyChat::onClickCloseBtn(bool)
{
- if (!isTornOff())
- {
- return;
- }
- closeHostedFloater();
+ if (!isTornOff())
+ {
+ return;
+ }
+ closeHostedFloater();
}
void LLFloaterIMNearbyChat::onChatFontChange(LLFontGL* fontp)
{
- // Update things with the new font whohoo
- if (mInputEditor)
- {
- mInputEditor->setFont(fontp);
- }
+ // Update things with the new font whohoo
+ if (mInputEditor)
+ {
+ mInputEditor->setFont(fontp);
+ }
}
void LLFloaterIMNearbyChat::show()
{
- openFloater(getKey());
+ openFloater(getKey());
}
bool LLFloaterIMNearbyChat::isChatVisible() const
{
- bool isVisible = false;
- LLFloaterIMContainer* im_box = LLFloaterIMContainer::getInstance();
- // Is the IM floater container ever null?
- llassert(im_box != NULL);
- if (im_box != NULL)
- {
- isVisible =
- isChatMultiTab() && gSavedPerAccountSettings.getBOOL("NearbyChatIsNotTornOff")?
- im_box->getVisible() && !im_box->isMinimized() :
- getVisible() && !isMinimized();
- }
+ bool isVisible = false;
+ LLFloaterIMContainer* im_box = LLFloaterIMContainer::getInstance();
+ // Is the IM floater container ever null?
+ llassert(im_box != NULL);
+ if (im_box != NULL)
+ {
+ isVisible =
+ isChatMultiTab() && gSavedPerAccountSettings.getBOOL("NearbyChatIsNotTornOff")?
+ im_box->getVisible() && !im_box->isMinimized() :
+ getVisible() && !isMinimized();
+ }
- return isVisible;
+ return isVisible;
}
void LLFloaterIMNearbyChat::showHistory()
{
- openFloater();
- LLFloaterIMContainer::getInstance()->selectConversation(LLUUID(NULL));
+ openFloater();
+ LLFloaterIMContainer::getInstance()->selectConversation(LLUUID(NULL));
- if(!isMessagePaneExpanded())
- {
- restoreFloater();
- setFocus(true);
- }
- else
- {
- LLFloaterIMContainer::getInstance()->setFocus(TRUE);
- }
- setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT);
+ if(!isMessagePaneExpanded())
+ {
+ restoreFloater();
+ setFocus(true);
+ }
+ else
+ {
+ LLFloaterIMContainer::getInstance()->setFocus(TRUE);
+ }
+ setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT);
}
std::string LLFloaterIMNearbyChat::getCurrentChat()
{
- return mInputEditor ? mInputEditor->getText() : LLStringUtil::null;
+ return mInputEditor ? mInputEditor->getText() : LLStringUtil::null;
}
// virtual
BOOL LLFloaterIMNearbyChat::handleKeyHere( KEY key, MASK mask )
{
- BOOL handled = FALSE;
-
- if( KEY_RETURN == key && mask == MASK_CONTROL)
- {
- // shout
- sendChat(CHAT_TYPE_SHOUT);
- handled = TRUE;
- }
- else if (KEY_RETURN == key && mask == MASK_SHIFT)
- {
- // whisper
- sendChat(CHAT_TYPE_WHISPER);
- handled = TRUE;
- }
-
-
- if((mask == MASK_ALT) && isTornOff())
- {
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- if ((KEY_UP == key) || (KEY_LEFT == key))
- {
- floater_container->selectNextorPreviousConversation(false);
- handled = TRUE;
- }
- if ((KEY_DOWN == key ) || (KEY_RIGHT == key))
- {
- floater_container->selectNextorPreviousConversation(true);
- handled = TRUE;
- }
- }
-
- return handled;
+ BOOL handled = FALSE;
+
+ if( KEY_RETURN == key && mask == MASK_CONTROL)
+ {
+ // shout
+ sendChat(CHAT_TYPE_SHOUT);
+ handled = TRUE;
+ }
+ else if (KEY_RETURN == key && mask == MASK_SHIFT)
+ {
+ // whisper
+ sendChat(CHAT_TYPE_WHISPER);
+ handled = TRUE;
+ }
+
+
+ if((mask == MASK_ALT) && isTornOff())
+ {
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ if ((KEY_UP == key) || (KEY_LEFT == key))
+ {
+ floater_container->selectNextorPreviousConversation(false);
+ handled = TRUE;
+ }
+ if ((KEY_DOWN == key ) || (KEY_RIGHT == key))
+ {
+ floater_container->selectNextorPreviousConversation(true);
+ handled = TRUE;
+ }
+ }
+
+ return handled;
}
BOOL LLFloaterIMNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* out_str)
{
- U32 in_len = in_str.length();
- S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers);
-
- bool string_was_found = false;
+ U32 in_len = in_str.length();
+ S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers);
- for (S32 n = 0; n < cnt && !string_was_found; n++)
- {
- if (in_len <= sChatTypeTriggers[n].name.length())
- {
- std::string trigger_trunc = sChatTypeTriggers[n].name;
- LLStringUtil::truncate(trigger_trunc, in_len);
+ bool string_was_found = false;
- if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc))
- {
- *out_str = sChatTypeTriggers[n].name;
- string_was_found = true;
- }
- }
- }
+ for (S32 n = 0; n < cnt && !string_was_found; n++)
+ {
+ if (in_len <= sChatTypeTriggers[n].name.length())
+ {
+ std::string trigger_trunc = sChatTypeTriggers[n].name;
+ LLStringUtil::truncate(trigger_trunc, in_len);
+
+ if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc))
+ {
+ *out_str = sChatTypeTriggers[n].name;
+ string_was_found = true;
+ }
+ }
+ }
- return string_was_found;
+ return string_was_found;
}
void LLFloaterIMNearbyChat::onChatBoxKeystroke()
{
- LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
- if (im_box)
- {
- im_box->flashConversationItemWidget(mSessionID,false);
- }
-
- LLFirstUse::otherAvatarChatFirst(false);
-
- LLWString raw_text = mInputEditor->getWText();
-
- // Can't trim the end, because that will cause autocompletion
- // to eat trailing spaces that might be part of a gesture.
- LLWStringUtil::trimHead(raw_text);
-
- S32 length = raw_text.length();
-
- if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences
- {
- gAgent.startTyping();
- }
- else
- {
- gAgent.stopTyping();
- }
-
- /* Doesn't work -- can't tell the difference between a backspace
- that killed the selection vs. backspace at the end of line.
- if (length > 1
- && text[0] == '/'
- && key == KEY_BACKSPACE)
- {
- // the selection will already be deleted, but we need to trim
- // off the character before
- std::string new_text = raw_text.substr(0, length-1);
- mInputEditor->setText( new_text );
- mInputEditor->setCursorToEnd();
- length = length - 1;
- }
- */
-
- KEY key = gKeyboard->currentKey();
-
- // Ignore "special" keys, like backspace, arrows, etc.
- if (gSavedSettings.getBOOL("ChatAutocompleteGestures")
- && length > 1
- && raw_text[0] == '/'
- && key < KEY_SPECIAL)
- {
- // we're starting a gesture, attempt to autocomplete
-
- std::string utf8_trigger = wstring_to_utf8str(raw_text);
- std::string utf8_out_str(utf8_trigger);
-
- if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
- {
- std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
- if (!rest_of_match.empty())
- {
- mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
- // Select to end of line, starting from the character
- // after the last one the user typed.
- mInputEditor->selectByCursorPosition(utf8_out_str.size()-rest_of_match.size(),utf8_out_str.size());
- }
-
- }
- else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str))
- {
- std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
- mInputEditor->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part
- mInputEditor->endOfDoc();
- }
-
- //LL_INFOS() << "GESTUREDEBUG " << trigger
- // << " len " << length
- // << " outlen " << out_str.getLength()
- // << LL_ENDL;
- }
+ LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
+ if (im_box)
+ {
+ im_box->flashConversationItemWidget(mSessionID,false);
+ }
+
+ LLFirstUse::otherAvatarChatFirst(false);
+
+ LLWString raw_text = mInputEditor->getWText();
+
+ // Can't trim the end, because that will cause autocompletion
+ // to eat trailing spaces that might be part of a gesture.
+ LLWStringUtil::trimHead(raw_text);
+
+ S32 length = raw_text.length();
+
+ if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences
+ {
+ gAgent.startTyping();
+ }
+ else
+ {
+ gAgent.stopTyping();
+ }
+
+ /* Doesn't work -- can't tell the difference between a backspace
+ that killed the selection vs. backspace at the end of line.
+ if (length > 1
+ && text[0] == '/'
+ && key == KEY_BACKSPACE)
+ {
+ // the selection will already be deleted, but we need to trim
+ // off the character before
+ std::string new_text = raw_text.substr(0, length-1);
+ mInputEditor->setText( new_text );
+ mInputEditor->setCursorToEnd();
+ length = length - 1;
+ }
+ */
+
+ KEY key = gKeyboard->currentKey();
+
+ // Ignore "special" keys, like backspace, arrows, etc.
+ if (gSavedSettings.getBOOL("ChatAutocompleteGestures")
+ && length > 1
+ && raw_text[0] == '/'
+ && key < KEY_SPECIAL)
+ {
+ // we're starting a gesture, attempt to autocomplete
+
+ std::string utf8_trigger = wstring_to_utf8str(raw_text);
+ std::string utf8_out_str(utf8_trigger);
+
+ if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
+ {
+ std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
+ if (!rest_of_match.empty())
+ {
+ mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
+ // Select to end of line, starting from the character
+ // after the last one the user typed.
+ mInputEditor->selectByCursorPosition(utf8_out_str.size()-rest_of_match.size(),utf8_out_str.size());
+ }
+
+ }
+ else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str))
+ {
+ std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
+ mInputEditor->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part
+ mInputEditor->endOfDoc();
+ }
+
+ //LL_INFOS() << "GESTUREDEBUG " << trigger
+ // << " len " << length
+ // << " outlen " << out_str.getLength()
+ // << LL_ENDL;
+ }
}
// static
void LLFloaterIMNearbyChat::onChatBoxFocusLost()
{
- // stop typing animation
- gAgent.stopTyping();
+ // stop typing animation
+ gAgent.stopTyping();
}
void LLFloaterIMNearbyChat::onChatBoxFocusReceived()
{
- mInputEditor->setEnabled(!gDisconnected);
+ mInputEditor->setEnabled(!gDisconnected);
}
EChatType LLFloaterIMNearbyChat::processChatTypeTriggers(EChatType type, std::string &str)
{
- U32 length = str.length();
- S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers);
-
- for (S32 n = 0; n < cnt; n++)
- {
- if (length >= sChatTypeTriggers[n].name.length())
- {
- std::string trigger = str.substr(0, sChatTypeTriggers[n].name.length());
+ U32 length = str.length();
+ S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers);
- if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name))
- {
- U32 trigger_length = sChatTypeTriggers[n].name.length();
-
- // It's to remove space after trigger name
- if (length > trigger_length && str[trigger_length] == ' ')
- trigger_length++;
-
- str = str.substr(trigger_length, length);
-
- if (CHAT_TYPE_NORMAL == type)
- return sChatTypeTriggers[n].type;
- else
- break;
- }
- }
- }
+ for (S32 n = 0; n < cnt; n++)
+ {
+ if (length >= sChatTypeTriggers[n].name.length())
+ {
+ std::string trigger = str.substr(0, sChatTypeTriggers[n].name.length());
+
+ if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name))
+ {
+ U32 trigger_length = sChatTypeTriggers[n].name.length();
+
+ // It's to remove space after trigger name
+ if (length > trigger_length && str[trigger_length] == ' ')
+ trigger_length++;
+
+ str = str.substr(trigger_length, length);
+
+ if (CHAT_TYPE_NORMAL == type)
+ return sChatTypeTriggers[n].type;
+ else
+ break;
+ }
+ }
+ }
- return type;
+ return type;
}
void LLFloaterIMNearbyChat::sendChat( EChatType type )
{
- if (mInputEditor)
- {
- LLWString text = mInputEditor->getWText();
- LLWStringUtil::trim(text);
- LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines.
- if (!text.empty())
- {
- // Check if this is destined for another channel
- S32 channel = 0;
- stripChannelNumber(text, &channel);
-
- updateUsedEmojis(text);
-
- std::string utf8text = wstring_to_utf8str(text);
- // Try to trigger a gesture, if not chat to a script.
- std::string utf8_revised_text;
- if (0 == channel)
- {
- // discard returned "found" boolean
- if(!LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text))
- {
- utf8_revised_text = utf8text;
- }
- }
- else
- {
- utf8_revised_text = utf8text;
- }
-
- utf8_revised_text = utf8str_trim(utf8_revised_text);
-
- type = processChatTypeTriggers(type, utf8_revised_text);
-
- if (!utf8_revised_text.empty())
- {
- // Chat with animation
- sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("PlayChatAnim"));
- }
- }
-
- mInputEditor->setText(LLStringExplicit(""));
- }
-
- gAgent.stopTyping();
-
- // If the user wants to stop chatting on hitting return, lose focus
- // and go out of chat mode.
- if (gSavedSettings.getBOOL("CloseChatOnReturn"))
- {
- stopChat();
- }
+ if (mInputEditor)
+ {
+ LLWString text = mInputEditor->getWText();
+ LLWStringUtil::trim(text);
+ LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines.
+ if (!text.empty())
+ {
+ // Check if this is destined for another channel
+ S32 channel = 0;
+ stripChannelNumber(text, &channel);
+
+ updateUsedEmojis(text);
+
+ std::string utf8text = wstring_to_utf8str(text);
+ // Try to trigger a gesture, if not chat to a script.
+ std::string utf8_revised_text;
+ if (0 == channel)
+ {
+ // discard returned "found" boolean
+ if(!LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text))
+ {
+ utf8_revised_text = utf8text;
+ }
+ }
+ else
+ {
+ utf8_revised_text = utf8text;
+ }
+
+ utf8_revised_text = utf8str_trim(utf8_revised_text);
+
+ type = processChatTypeTriggers(type, utf8_revised_text);
+
+ if (!utf8_revised_text.empty())
+ {
+ // Chat with animation
+ sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("PlayChatAnim"));
+ }
+ }
+
+ mInputEditor->setText(LLStringExplicit(""));
+ }
+
+ gAgent.stopTyping();
+
+ // If the user wants to stop chatting on hitting return, lose focus
+ // and go out of chat mode.
+ if (gSavedSettings.getBOOL("CloseChatOnReturn"))
+ {
+ stopChat();
+ }
}
void LLFloaterIMNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
{
- appendMessage(chat, args);
+ appendMessage(chat, args);
- if(archive)
- {
- mMessageArchive.push_back(chat);
- if(mMessageArchive.size() > 200)
- {
- mMessageArchive.erase(mMessageArchive.begin());
- }
- }
+ if(archive)
+ {
+ mMessageArchive.push_back(chat);
+ if(mMessageArchive.size() > 200)
+ {
+ mMessageArchive.erase(mMessageArchive.begin());
+ }
+ }
- // logging
- if (!args["do_not_log"].asBoolean() && gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 1)
- {
- std::string from_name = chat.mFromName;
+ // logging
+ if (!args["do_not_log"].asBoolean() && gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 1)
+ {
+ std::string from_name = chat.mFromName;
- if (chat.mSourceType == CHAT_SOURCE_AGENT)
- {
- // if the chat is coming from an agent, log the complete name
- LLAvatarName av_name;
- LLAvatarNameCache::get(chat.mFromID, &av_name);
+ if (chat.mSourceType == CHAT_SOURCE_AGENT)
+ {
+ // if the chat is coming from an agent, log the complete name
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(chat.mFromID, &av_name);
- if (!av_name.isDisplayNameDefault())
- {
- from_name = av_name.getCompleteName();
- }
- }
+ if (!av_name.isDisplayNameDefault())
+ {
+ from_name = av_name.getCompleteName();
+ }
+ }
- LLLogChat::saveHistory("chat", from_name, chat.mFromID, chat.mText);
- }
+ LLLogChat::saveHistory("chat", from_name, chat.mFromID, chat.mText);
+ }
}
void LLFloaterIMNearbyChat::onChatBoxCommit()
{
- sendChat(CHAT_TYPE_NORMAL);
+ sendChat(CHAT_TYPE_NORMAL);
- gAgent.stopTyping();
+ gAgent.stopTyping();
}
void LLFloaterIMNearbyChat::displaySpeakingIndicator()
{
- LLSpeakerMgr::speaker_list_t speaker_list;
- LLUUID id;
+ LLSpeakerMgr::speaker_list_t speaker_list;
+ LLUUID id;
- id.setNull();
- mSpeakerMgr->update(FALSE);
- mSpeakerMgr->getSpeakerList(&speaker_list, FALSE);
+ id.setNull();
+ mSpeakerMgr->update(FALSE);
+ mSpeakerMgr->getSpeakerList(&speaker_list, FALSE);
- for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i)
- {
- LLPointer<LLSpeaker> s = *i;
- if (s->mSpeechVolume > 0 || s->mStatus == LLSpeaker::STATUS_SPEAKING)
- {
- id = s->mID;
- break;
- }
- }
+ for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i)
+ {
+ LLPointer<LLSpeaker> s = *i;
+ if (s->mSpeechVolume > 0 || s->mStatus == LLSpeaker::STATUS_SPEAKING)
+ {
+ id = s->mID;
+ break;
+ }
+ }
}
void LLFloaterIMNearbyChat::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate)
{
- sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate);
+ sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate);
}
void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate)
{
- // Look for "/20 foo" channel chats.
- S32 channel = 0;
- LLWString out_text = stripChannelNumber(wtext, &channel);
- std::string utf8_out_text = wstring_to_utf8str(out_text);
- std::string utf8_text = wstring_to_utf8str(wtext);
-
- utf8_text = utf8str_trim(utf8_text);
- if (!utf8_text.empty())
- {
- utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1);
- }
-
- // Don't animate for chats people can't hear (chat to scripts)
- if (animate && (channel == 0))
- {
- if (type == CHAT_TYPE_WHISPER)
- {
- LL_DEBUGS() << "You whisper " << utf8_text << LL_ENDL;
- gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START);
- }
- else if (type == CHAT_TYPE_NORMAL)
- {
- LL_DEBUGS() << "You say " << utf8_text << LL_ENDL;
- gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START);
- }
- else if (type == CHAT_TYPE_SHOUT)
- {
- LL_DEBUGS() << "You shout " << utf8_text << LL_ENDL;
- gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START);
- }
- else
- {
- LL_INFOS() << "send_chat_from_viewer() - invalid volume" << LL_ENDL;
- return;
- }
- }
- else
- {
- if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP)
- {
- LL_DEBUGS() << "Channel chat: " << utf8_text << LL_ENDL;
- }
- }
-
- send_chat_from_viewer(utf8_out_text, type, channel);
-}
-
-// static
+ // Look for "/20 foo" channel chats.
+ S32 channel = 0;
+ LLWString out_text = stripChannelNumber(wtext, &channel);
+ std::string utf8_out_text = wstring_to_utf8str(out_text);
+ std::string utf8_text = wstring_to_utf8str(wtext);
+
+ utf8_text = utf8str_trim(utf8_text);
+ if (!utf8_text.empty())
+ {
+ utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1);
+ }
+
+ // Don't animate for chats people can't hear (chat to scripts)
+ if (animate && (channel == 0))
+ {
+ if (type == CHAT_TYPE_WHISPER)
+ {
+ LL_DEBUGS() << "You whisper " << utf8_text << LL_ENDL;
+ gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START);
+ }
+ else if (type == CHAT_TYPE_NORMAL)
+ {
+ LL_DEBUGS() << "You say " << utf8_text << LL_ENDL;
+ gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START);
+ }
+ else if (type == CHAT_TYPE_SHOUT)
+ {
+ LL_DEBUGS() << "You shout " << utf8_text << LL_ENDL;
+ gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START);
+ }
+ else
+ {
+ LL_INFOS() << "send_chat_from_viewer() - invalid volume" << LL_ENDL;
+ return;
+ }
+ }
+ else
+ {
+ if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP)
+ {
+ LL_DEBUGS() << "Channel chat: " << utf8_text << LL_ENDL;
+ }
+ }
+
+ send_chat_from_viewer(utf8_out_text, type, channel);
+}
+
+// static
bool LLFloaterIMNearbyChat::isWordsName(const std::string& name)
{
- // checking to see if it's display name plus username in parentheses
- S32 open_paren = name.find(" (", 0);
- S32 close_paren = name.find(')', 0);
+ // checking to see if it's display name plus username in parentheses
+ S32 open_paren = name.find(" (", 0);
+ S32 close_paren = name.find(')', 0);
- if (open_paren != std::string::npos &&
- close_paren == name.length()-1)
- {
- return true;
- }
- else
- {
- //checking for a single space
- S32 pos = name.find(' ', 0);
- return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos;
- }
+ if (open_paren != std::string::npos &&
+ close_paren == name.length()-1)
+ {
+ return true;
+ }
+ else
+ {
+ //checking for a single space
+ S32 pos = name.find(' ', 0);
+ return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos;
+ }
}
-// static
+// static
void LLFloaterIMNearbyChat::startChat(const char* line)
{
- LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if (nearby_chat)
- {
- if(!nearby_chat->isTornOff())
- {
- LLFloaterIMContainer::getInstance()->selectConversation(LLUUID(NULL));
- }
- if(nearby_chat->isMinimized())
- {
- nearby_chat->setMinimized(false);
- }
- nearby_chat->show();
- nearby_chat->setFocus(TRUE);
-
- if (line)
- {
- std::string line_string(line);
- nearby_chat->mInputEditor->setText(line_string);
- }
-
- nearby_chat->mInputEditor->endOfDoc();
- }
+ LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ if (nearby_chat)
+ {
+ if(!nearby_chat->isTornOff())
+ {
+ LLFloaterIMContainer::getInstance()->selectConversation(LLUUID(NULL));
+ }
+ if(nearby_chat->isMinimized())
+ {
+ nearby_chat->setMinimized(false);
+ }
+ nearby_chat->show();
+ nearby_chat->setFocus(TRUE);
+
+ if (line)
+ {
+ std::string line_string(line);
+ nearby_chat->mInputEditor->setText(line_string);
+ }
+
+ nearby_chat->mInputEditor->endOfDoc();
+ }
}
// Exit "chat mode" and do the appropriate focus changes
// static
void LLFloaterIMNearbyChat::stopChat()
{
- LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if (nearby_chat)
- {
- nearby_chat->mInputEditor->setFocus(FALSE);
- gAgent.stopTyping();
- }
+ LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ if (nearby_chat)
+ {
+ nearby_chat->mInputEditor->setFocus(FALSE);
+ gAgent.stopTyping();
+ }
}
// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20.
// Otherwise returns input and channel 0.
LLWString LLFloaterIMNearbyChat::stripChannelNumber(const LLWString &mesg, S32* channel)
{
- if (mesg[0] == '/'
- && mesg[1] == '/')
- {
- // This is a "repeat channel send"
- *channel = sLastSpecialChatChannel;
- return mesg.substr(2, mesg.length() - 2);
- }
- else if (mesg[0] == '/'
- && mesg[1]
- && (LLStringOps::isDigit(mesg[1])
- || (mesg[1] == '-' && mesg[2] && LLStringOps::isDigit(mesg[2]))))
- {
- // This a special "/20" speak on a channel
- S32 pos = 0;
-
- // Copy the channel number into a string
- LLWString channel_string;
- llwchar c;
- do
- {
- c = mesg[pos+1];
- channel_string.push_back(c);
- pos++;
- }
- while(c && pos < 64 && (LLStringOps::isDigit(c) || (pos==1 && c =='-')));
-
- // Move the pointer forward to the first non-whitespace char
- // Check isspace before looping, so we can handle "/33foo"
- // as well as "/33 foo"
- while(c && iswspace(c))
- {
- c = mesg[pos+1];
- pos++;
- }
-
- sLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10);
- *channel = sLastSpecialChatChannel;
- return mesg.substr(pos, mesg.length() - pos);
- }
- else
- {
- // This is normal chat.
- *channel = 0;
- return mesg;
- }
+ if (mesg[0] == '/'
+ && mesg[1] == '/')
+ {
+ // This is a "repeat channel send"
+ *channel = sLastSpecialChatChannel;
+ return mesg.substr(2, mesg.length() - 2);
+ }
+ else if (mesg[0] == '/'
+ && mesg[1]
+ && (LLStringOps::isDigit(mesg[1])
+ || (mesg[1] == '-' && mesg[2] && LLStringOps::isDigit(mesg[2]))))
+ {
+ // This a special "/20" speak on a channel
+ S32 pos = 0;
+
+ // Copy the channel number into a string
+ LLWString channel_string;
+ llwchar c;
+ do
+ {
+ c = mesg[pos+1];
+ channel_string.push_back(c);
+ pos++;
+ }
+ while(c && pos < 64 && (LLStringOps::isDigit(c) || (pos==1 && c =='-')));
+
+ // Move the pointer forward to the first non-whitespace char
+ // Check isspace before looping, so we can handle "/33foo"
+ // as well as "/33 foo"
+ while(c && iswspace(c))
+ {
+ c = mesg[pos+1];
+ pos++;
+ }
+
+ sLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10);
+ *channel = sLastSpecialChatChannel;
+ return mesg.substr(pos, mesg.length() - pos);
+ }
+ else
+ {
+ // This is normal chat.
+ *channel = 0;
+ return mesg;
+ }
}
void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel)
{
- LL_DEBUGS("UIUsage") << "Nearby chat, text " << utf8_out_text << " type " << type << " channel " << channel << LL_ENDL;
- if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) // prune back some redundant logging
- {
- LLUIUsage::instance().logCommand("Chat.SendNearby"); // pseuo-command
- }
+ LL_DEBUGS("UIUsage") << "Nearby chat, text " << utf8_out_text << " type " << type << " channel " << channel << LL_ENDL;
+ if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) // prune back some redundant logging
+ {
+ LLUIUsage::instance().logCommand("Chat.SendNearby"); // pseuo-command
+ }
LLMessageSystem* msg = gMessageSystem;
@@ -902,40 +902,40 @@ void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32
class LLChatCommandHandler : public LLCommandHandler
{
public:
- // not allowed from outside the app
- LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_BLOCK) { }
+ // not allowed from outside the app
+ LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_BLOCK) { }
// Your code here
- bool handle(const LLSD& tokens,
+ bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- bool retval = false;
- // Need at least 2 tokens to have a valid message.
- if (tokens.size() < 2)
- {
- retval = false;
- }
- else
- {
- S32 channel = tokens[0].asInteger();
- // VWR-19499 Restrict function to chat channels greater than 0.
- if ((channel > 0) && (channel < CHAT_CHANNEL_DEBUG))
- {
- retval = true;
- // Send unescaped message, see EXT-6353.
- std::string unescaped_mesg (LLURI::unescape(tokens[1].asString()));
- send_chat_from_viewer(unescaped_mesg, CHAT_TYPE_NORMAL, channel);
- }
- else
- {
- retval = false;
- // Tell us this is an unsupported SLurl.
- }
- }
- return retval;
- }
+ {
+ bool retval = false;
+ // Need at least 2 tokens to have a valid message.
+ if (tokens.size() < 2)
+ {
+ retval = false;
+ }
+ else
+ {
+ S32 channel = tokens[0].asInteger();
+ // VWR-19499 Restrict function to chat channels greater than 0.
+ if ((channel > 0) && (channel < CHAT_CHANNEL_DEBUG))
+ {
+ retval = true;
+ // Send unescaped message, see EXT-6353.
+ std::string unescaped_mesg (LLURI::unescape(tokens[1].asString()));
+ send_chat_from_viewer(unescaped_mesg, CHAT_TYPE_NORMAL, channel);
+ }
+ else
+ {
+ retval = false;
+ // Tell us this is an unsupported SLurl.
+ }
+ }
+ return retval;
+ }
};
// Creating the object registers with the dispatcher.
diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h
index f0daacd6a9..2c2e19e9ca 100644
--- a/indra/newview/llfloaterimnearbychat.h
+++ b/indra/newview/llfloaterimnearbychat.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterimnearbychat.h
* @brief LLFloaterIMNearbyChat class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,79 +41,79 @@
class LLResizeBar;
class LLFloaterIMNearbyChat
- : public LLFloaterIMSessionTab
+ : public LLFloaterIMSessionTab
{
public:
- // constructor for inline chat-bars (e.g. hosted in chat history window)
- LLFloaterIMNearbyChat(const LLSD& key = LLSD(LLUUID()));
- ~LLFloaterIMNearbyChat() {}
+ // constructor for inline chat-bars (e.g. hosted in chat history window)
+ LLFloaterIMNearbyChat(const LLSD& key = LLSD(LLUUID()));
+ ~LLFloaterIMNearbyChat() {}
- static LLFloaterIMNearbyChat* buildFloater(const LLSD& key);
+ static LLFloaterIMNearbyChat* buildFloater(const LLSD& key);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
- /*virtual*/ void setVisible(BOOL visible);
- /*virtual*/ void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD());
- /*virtual*/ void closeHostedFloater();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void setVisible(BOOL visible);
+ /*virtual*/ void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD());
+ /*virtual*/ void closeHostedFloater();
- void loadHistory();
+ void loadHistory();
void reloadMessages(bool clean_messages = false);
- void removeScreenChat();
+ void removeScreenChat();
- void show();
- bool isChatVisible() const;
+ void show();
+ bool isChatVisible() const;
- /** @param archive true - to save a message to the chat history log */
- void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD());
+ /** @param archive true - to save a message to the chat history log */
+ void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD());
- LLChatEntry* getChatBox() { return mInputEditor; }
+ LLChatEntry* getChatBox() { return mInputEditor; }
- std::string getCurrentChat();
- S32 getMessageArchiveLength() {return mMessageArchive.size();}
+ std::string getCurrentChat();
+ S32 getMessageArchiveLength() {return mMessageArchive.size();}
- virtual BOOL handleKeyHere( KEY key, MASK mask );
+ virtual BOOL handleKeyHere( KEY key, MASK mask );
- static void startChat(const char* line);
- static void stopChat();
+ static void startChat(const char* line);
+ static void stopChat();
- static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate);
- static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
+ static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate);
+ static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
- static bool isWordsName(const std::string& name);
+ static bool isWordsName(const std::string& name);
- void showHistory();
+ void showHistory();
protected:
- static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
- void onChatBoxKeystroke();
- void onChatBoxFocusLost();
- void onChatBoxFocusReceived();
+ static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
+ void onChatBoxKeystroke();
+ void onChatBoxFocusLost();
+ void onChatBoxFocusReceived();
- void sendChat( EChatType type );
- void onChatBoxCommit();
- void onChatFontChange(LLFontGL* fontp);
+ void sendChat( EChatType type );
+ void onChatBoxCommit();
+ void onChatFontChange(LLFontGL* fontp);
- /*virtual*/ void onTearOffClicked();
- /*virtual*/ void onClickCloseBtn(bool app_qutting = false);
+ /*virtual*/ void onTearOffClicked();
+ /*virtual*/ void onClickCloseBtn(bool app_qutting = false);
- static LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
- EChatType processChatTypeTriggers(EChatType type, std::string &str);
+ static LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
+ EChatType processChatTypeTriggers(EChatType type, std::string &str);
- void displaySpeakingIndicator();
+ void displaySpeakingIndicator();
- // Which non-zero channel did we last chat on?
- static S32 sLastSpecialChatChannel;
+ // Which non-zero channel did we last chat on?
+ static S32 sLastSpecialChatChannel;
- LLOutputMonitorCtrl* mOutputMonitor;
- LLLocalSpeakerMgr* mSpeakerMgr;
+ LLOutputMonitorCtrl* mOutputMonitor;
+ LLLocalSpeakerMgr* mSpeakerMgr;
- S32 mExpandedHeight;
+ S32 mExpandedHeight;
private:
- /*virtual*/ void refresh();
+ /*virtual*/ void refresh();
- std::vector<LLChat> mMessageArchive;
+ std::vector<LLChat> mMessageArchive;
};
#endif // LL_LLFLOATERIMNEARBYCHAT_H
diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp
index dfee4096fe..9337a9b51b 100644
--- a/indra/newview/llfloaterimnearbychathandler.cpp
+++ b/indra/newview/llfloaterimnearbychathandler.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file LLFloaterIMNearbyChatHandler.cpp
* @brief Nearby chat chat managment
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,109 +50,109 @@ using namespace LLNotificationsUI;
static LLFloaterIMNearbyChatToastPanel* createToastPanel()
{
- LLFloaterIMNearbyChatToastPanel* item = LLFloaterIMNearbyChatToastPanel::createInstance();
- return item;
+ LLFloaterIMNearbyChatToastPanel* item = LLFloaterIMNearbyChatToastPanel::createInstance();
+ return item;
}
//-----------------------------------------------------------------------------------------------
//LLFloaterIMNearbyChatScreenChannel
-//-----------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------
class LLFloaterIMNearbyChatScreenChannel: public LLScreenChannelBase
{
- LOG_CLASS(LLFloaterIMNearbyChatScreenChannel);
+ LOG_CLASS(LLFloaterIMNearbyChatScreenChannel);
public:
- typedef std::vector<LLHandle<LLToast> > toast_vec_t;
- typedef std::list<LLHandle<LLToast> > toast_list_t;
-
- LLFloaterIMNearbyChatScreenChannel(const Params& p)
- : LLScreenChannelBase(p)
- {
- mStopProcessing = false;
-
- LLControlVariable* ctrl = gSavedSettings.getControl("NearbyToastLifeTime").get();
- if (ctrl)
- {
- ctrl->getSignal()->connect(boost::bind(&LLFloaterIMNearbyChatScreenChannel::updateToastsLifetime, this));
- }
-
- ctrl = gSavedSettings.getControl("NearbyToastFadingTime").get();
- if (ctrl)
- {
- ctrl->getSignal()->connect(boost::bind(&LLFloaterIMNearbyChatScreenChannel::updateToastFadingTime, this));
- }
- }
-
- void addChat (LLSD& chat);
- void arrangeToasts ();
-
- typedef boost::function<LLFloaterIMNearbyChatToastPanel* (void )> create_toast_panel_callback_t;
- void setCreatePanelCallback(create_toast_panel_callback_t value) { m_create_toast_panel_callback_t = value;}
-
- void onToastDestroyed (LLToast* toast, bool app_quitting);
- void onToastFade (LLToast* toast);
-
- void redrawToasts()
- {
- arrangeToasts();
- }
-
- // hide all toasts from screen, but not remove them from a channel
- // removes all toasts from a channel
- virtual void removeToastsFromChannel()
- {
- for(toast_vec_t::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it)
- {
- addToToastPool(it->get());
- }
- m_active_toasts.clear();
- };
-
- virtual void deleteAllChildren()
- {
- LL_DEBUGS("NearbyChat") << "Clearing toast pool" << LL_ENDL;
- m_toast_pool.clear();
- m_active_toasts.clear();
- LLScreenChannelBase::deleteAllChildren();
- }
+ typedef std::vector<LLHandle<LLToast> > toast_vec_t;
+ typedef std::list<LLHandle<LLToast> > toast_list_t;
+
+ LLFloaterIMNearbyChatScreenChannel(const Params& p)
+ : LLScreenChannelBase(p)
+ {
+ mStopProcessing = false;
+
+ LLControlVariable* ctrl = gSavedSettings.getControl("NearbyToastLifeTime").get();
+ if (ctrl)
+ {
+ ctrl->getSignal()->connect(boost::bind(&LLFloaterIMNearbyChatScreenChannel::updateToastsLifetime, this));
+ }
+
+ ctrl = gSavedSettings.getControl("NearbyToastFadingTime").get();
+ if (ctrl)
+ {
+ ctrl->getSignal()->connect(boost::bind(&LLFloaterIMNearbyChatScreenChannel::updateToastFadingTime, this));
+ }
+ }
+
+ void addChat (LLSD& chat);
+ void arrangeToasts ();
+
+ typedef boost::function<LLFloaterIMNearbyChatToastPanel* (void )> create_toast_panel_callback_t;
+ void setCreatePanelCallback(create_toast_panel_callback_t value) { m_create_toast_panel_callback_t = value;}
+
+ void onToastDestroyed (LLToast* toast, bool app_quitting);
+ void onToastFade (LLToast* toast);
+
+ void redrawToasts()
+ {
+ arrangeToasts();
+ }
+
+ // hide all toasts from screen, but not remove them from a channel
+ // removes all toasts from a channel
+ virtual void removeToastsFromChannel()
+ {
+ for(toast_vec_t::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it)
+ {
+ addToToastPool(it->get());
+ }
+ m_active_toasts.clear();
+ };
+
+ virtual void deleteAllChildren()
+ {
+ LL_DEBUGS("NearbyChat") << "Clearing toast pool" << LL_ENDL;
+ m_toast_pool.clear();
+ m_active_toasts.clear();
+ LLScreenChannelBase::deleteAllChildren();
+ }
protected:
- void deactivateToast(LLToast* toast);
- void addToToastPool(LLToast* toast)
- {
- if (!toast) return;
- LL_DEBUGS("NearbyChat") << "Pooling toast" << LL_ENDL;
- toast->setVisible(FALSE);
- toast->stopTimer();
- toast->setIsHidden(true);
-
- // Nearby chat toasts that are hidden, not destroyed. They are collected to the toast pool, so that
- // they can be used next time, this is done for performance. But if the toast lifetime was changed
- // (from preferences floater (STORY-36)) while it was shown (at this moment toast isn't in the pool yet)
- // changes don't take affect.
- // So toast's lifetime should be updated each time it's added to the pool. Otherwise viewer would have
- // to be restarted so that changes take effect.
- toast->setLifetime(gSavedSettings.getS32("NearbyToastLifeTime"));
- toast->setFadingTime(gSavedSettings.getS32("NearbyToastFadingTime"));
- m_toast_pool.push_back(toast->getHandle());
- }
-
- void createOverflowToast(S32 bottom, F32 timer);
-
- void updateToastsLifetime();
-
- void updateToastFadingTime();
-
- create_toast_panel_callback_t m_create_toast_panel_callback_t;
-
- bool createPoolToast();
-
- toast_vec_t m_active_toasts;
- toast_list_t m_toast_pool;
-
- bool mStopProcessing;
- bool mChannelRect;
+ void deactivateToast(LLToast* toast);
+ void addToToastPool(LLToast* toast)
+ {
+ if (!toast) return;
+ LL_DEBUGS("NearbyChat") << "Pooling toast" << LL_ENDL;
+ toast->setVisible(FALSE);
+ toast->stopTimer();
+ toast->setIsHidden(true);
+
+ // Nearby chat toasts that are hidden, not destroyed. They are collected to the toast pool, so that
+ // they can be used next time, this is done for performance. But if the toast lifetime was changed
+ // (from preferences floater (STORY-36)) while it was shown (at this moment toast isn't in the pool yet)
+ // changes don't take affect.
+ // So toast's lifetime should be updated each time it's added to the pool. Otherwise viewer would have
+ // to be restarted so that changes take effect.
+ toast->setLifetime(gSavedSettings.getS32("NearbyToastLifeTime"));
+ toast->setFadingTime(gSavedSettings.getS32("NearbyToastFadingTime"));
+ m_toast_pool.push_back(toast->getHandle());
+ }
+
+ void createOverflowToast(S32 bottom, F32 timer);
+
+ void updateToastsLifetime();
+
+ void updateToastFadingTime();
+
+ create_toast_panel_callback_t m_create_toast_panel_callback_t;
+
+ bool createPoolToast();
+
+ toast_vec_t m_active_toasts;
+ toast_list_t m_toast_pool;
+
+ bool mStopProcessing;
+ bool mChannelRect;
};
@@ -165,18 +165,18 @@ protected:
// in order to handle closing nearby chat toasts properly.
class LLFloaterIMNearbyChatToast : public LLToast
{
- LOG_CLASS(LLFloaterIMNearbyChatToast);
+ LOG_CLASS(LLFloaterIMNearbyChatToast);
public:
- LLFloaterIMNearbyChatToast(const LLToast::Params& p, LLFloaterIMNearbyChatScreenChannel* nc_channelp)
- : LLToast(p),
- mNearbyChatScreenChannelp(nc_channelp)
- {
- }
+ LLFloaterIMNearbyChatToast(const LLToast::Params& p, LLFloaterIMNearbyChatScreenChannel* nc_channelp)
+ : LLToast(p),
+ mNearbyChatScreenChannelp(nc_channelp)
+ {
+ }
- /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void onClose(bool app_quitting);
private:
- LLFloaterIMNearbyChatScreenChannel* mNearbyChatScreenChannelp;
+ LLFloaterIMNearbyChatScreenChannel* mNearbyChatScreenChannelp;
};
//-----------------------------------------------------------------------------------------------
@@ -185,266 +185,266 @@ private:
void LLFloaterIMNearbyChatScreenChannel::deactivateToast(LLToast* toast)
{
- toast_vec_t::iterator pos = std::find(m_active_toasts.begin(), m_active_toasts.end(), toast->getHandle());
+ toast_vec_t::iterator pos = std::find(m_active_toasts.begin(), m_active_toasts.end(), toast->getHandle());
- if (pos != m_active_toasts.end())
- {
- LL_DEBUGS("NearbyChat") << "Deactivating toast" << LL_ENDL;
- m_active_toasts.erase(pos);
- }
+ if (pos != m_active_toasts.end())
+ {
+ LL_DEBUGS("NearbyChat") << "Deactivating toast" << LL_ENDL;
+ m_active_toasts.erase(pos);
+ }
}
-void LLFloaterIMNearbyChatScreenChannel::createOverflowToast(S32 bottom, F32 timer)
+void LLFloaterIMNearbyChatScreenChannel::createOverflowToast(S32 bottom, F32 timer)
{
- //we don't need overflow toast in nearby chat
+ //we don't need overflow toast in nearby chat
}
void LLFloaterIMNearbyChatScreenChannel::onToastDestroyed(LLToast* toast, bool app_quitting)
-{
- LL_DEBUGS("NearbyChat") << "Toast destroyed (app_quitting=" << app_quitting << ")" << LL_ENDL;
-
- if (app_quitting)
- {
- // Viewer is quitting.
- // Immediately stop processing chat messages (EXT-1419).
- mStopProcessing = true;
- }
- else
- {
- // The toast is being closed by user (STORM-192).
- // Remove it from the list of active toasts to prevent
- // further references to the invalid pointer.
- deactivateToast(toast);
- }
+{
+ LL_DEBUGS("NearbyChat") << "Toast destroyed (app_quitting=" << app_quitting << ")" << LL_ENDL;
+
+ if (app_quitting)
+ {
+ // Viewer is quitting.
+ // Immediately stop processing chat messages (EXT-1419).
+ mStopProcessing = true;
+ }
+ else
+ {
+ // The toast is being closed by user (STORM-192).
+ // Remove it from the list of active toasts to prevent
+ // further references to the invalid pointer.
+ deactivateToast(toast);
+ }
}
void LLFloaterIMNearbyChatScreenChannel::onToastFade(LLToast* toast)
-{
- LL_DEBUGS("NearbyChat") << "Toast fading" << LL_ENDL;
+{
+ LL_DEBUGS("NearbyChat") << "Toast fading" << LL_ENDL;
+
+ //fade mean we put toast to toast pool
+ if(!toast)
+ return;
- //fade mean we put toast to toast pool
- if(!toast)
- return;
+ deactivateToast(toast);
- deactivateToast(toast);
+ addToToastPool(toast);
- addToToastPool(toast);
-
- arrangeToasts();
+ arrangeToasts();
}
void LLFloaterIMNearbyChatScreenChannel::updateToastsLifetime()
{
- S32 seconds = gSavedSettings.getS32("NearbyToastLifeTime");
- toast_list_t::iterator it;
+ S32 seconds = gSavedSettings.getS32("NearbyToastLifeTime");
+ toast_list_t::iterator it;
- for(it = m_toast_pool.begin(); it != m_toast_pool.end(); ++it)
- {
- (*it).get()->setLifetime(seconds);
- }
+ for(it = m_toast_pool.begin(); it != m_toast_pool.end(); ++it)
+ {
+ (*it).get()->setLifetime(seconds);
+ }
}
void LLFloaterIMNearbyChatScreenChannel::updateToastFadingTime()
{
- S32 seconds = gSavedSettings.getS32("NearbyToastFadingTime");
- toast_list_t::iterator it;
+ S32 seconds = gSavedSettings.getS32("NearbyToastFadingTime");
+ toast_list_t::iterator it;
- for(it = m_toast_pool.begin(); it != m_toast_pool.end(); ++it)
- {
- (*it).get()->setFadingTime(seconds);
- }
+ for(it = m_toast_pool.begin(); it != m_toast_pool.end(); ++it)
+ {
+ (*it).get()->setFadingTime(seconds);
+ }
}
-bool LLFloaterIMNearbyChatScreenChannel::createPoolToast()
+bool LLFloaterIMNearbyChatScreenChannel::createPoolToast()
{
- LLFloaterIMNearbyChatToastPanel* panel= m_create_toast_panel_callback_t();
- if(!panel)
- return false;
-
- LLToast::Params p;
- p.panel = panel;
- p.lifetime_secs = gSavedSettings.getS32("NearbyToastLifeTime");
- p.fading_time_secs = gSavedSettings.getS32("NearbyToastFadingTime");
-
- LLToast* toast = new LLFloaterIMNearbyChatToast(p, this);
-
-
- toast->setOnFadeCallback(boost::bind(&LLFloaterIMNearbyChatScreenChannel::onToastFade, this, _1));
-
- // If the toast gets somehow prematurely destroyed, deactivate it to prevent crash (STORM-1352).
- toast->setOnToastDestroyedCallback(boost::bind(&LLFloaterIMNearbyChatScreenChannel::onToastDestroyed, this, _1, false));
-
- LL_DEBUGS("NearbyChat") << "Creating and pooling toast" << LL_ENDL;
- m_toast_pool.push_back(toast->getHandle());
- return true;
+ LLFloaterIMNearbyChatToastPanel* panel= m_create_toast_panel_callback_t();
+ if(!panel)
+ return false;
+
+ LLToast::Params p;
+ p.panel = panel;
+ p.lifetime_secs = gSavedSettings.getS32("NearbyToastLifeTime");
+ p.fading_time_secs = gSavedSettings.getS32("NearbyToastFadingTime");
+
+ LLToast* toast = new LLFloaterIMNearbyChatToast(p, this);
+
+
+ toast->setOnFadeCallback(boost::bind(&LLFloaterIMNearbyChatScreenChannel::onToastFade, this, _1));
+
+ // If the toast gets somehow prematurely destroyed, deactivate it to prevent crash (STORM-1352).
+ toast->setOnToastDestroyedCallback(boost::bind(&LLFloaterIMNearbyChatScreenChannel::onToastDestroyed, this, _1, false));
+
+ LL_DEBUGS("NearbyChat") << "Creating and pooling toast" << LL_ENDL;
+ m_toast_pool.push_back(toast->getHandle());
+ return true;
}
void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat)
{
- //look in pool. if there is any message
- if(mStopProcessing)
- return;
-
- if (mFloaterSnapRegion == NULL)
- {
- mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
- }
- LLRect channel_rect;
- mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView);
- chat["available_height"] = channel_rect.getHeight() - channel_rect.mBottom - gSavedSettings.getS32("ToastGap") - 110;;
-
- /*
+ //look in pool. if there is any message
+ if(mStopProcessing)
+ return;
+
+ if (mFloaterSnapRegion == NULL)
+ {
+ mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+ }
+ LLRect channel_rect;
+ mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView);
+ chat["available_height"] = channel_rect.getHeight() - channel_rect.mBottom - gSavedSettings.getS32("ToastGap") - 110;;
+
+ /*
find last toast and check ID
- */
-
- if(m_active_toasts.size())
- {
- LLUUID fromID = chat["from_id"].asUUID(); // agent id or object id
- std::string from = chat["from"].asString();
- LLToast* toast = m_active_toasts[0].get();
- if (toast)
- {
- LLFloaterIMNearbyChatToastPanel* panel = dynamic_cast<LLFloaterIMNearbyChatToastPanel*>(toast->getPanel());
-
- if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText())
- {
- panel->addMessage(chat);
- toast->reshapeToPanel();
- toast->startTimer();
-
- arrangeToasts();
- return;
- }
- }
- }
-
-
-
- if(m_toast_pool.empty())
- {
- //"pool" is empty - create one more panel
- LL_DEBUGS("NearbyChat") << "Empty pool" << LL_ENDL;
- if(!createPoolToast())//created toast will go to pool. so next call will find it
- return;
- addChat(chat);
- return;
- }
-
- int chat_type = chat["chat_type"].asInteger();
-
- if( ((EChatType)chat_type == CHAT_TYPE_DEBUG_MSG))
- {
- if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE)
- return;
- if(gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)
- return;
- }
-
-
- //take 1st element from pool, (re)initialize it, put it in active toasts
-
- LL_DEBUGS("NearbyChat") << "Getting toast from pool" << LL_ENDL;
- LLToast* toast = m_toast_pool.back().get();
-
- m_toast_pool.pop_back();
-
-
- LLFloaterIMNearbyChatToastPanel* panel = dynamic_cast<LLFloaterIMNearbyChatToastPanel*>(toast->getPanel());
- if(!panel)
- return;
- panel->init(chat);
-
- toast->reshapeToPanel();
- toast->startTimer();
-
- m_active_toasts.push_back(toast->getHandle());
-
- arrangeToasts();
+ */
+
+ if(m_active_toasts.size())
+ {
+ LLUUID fromID = chat["from_id"].asUUID(); // agent id or object id
+ std::string from = chat["from"].asString();
+ LLToast* toast = m_active_toasts[0].get();
+ if (toast)
+ {
+ LLFloaterIMNearbyChatToastPanel* panel = dynamic_cast<LLFloaterIMNearbyChatToastPanel*>(toast->getPanel());
+
+ if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText())
+ {
+ panel->addMessage(chat);
+ toast->reshapeToPanel();
+ toast->startTimer();
+
+ arrangeToasts();
+ return;
+ }
+ }
+ }
+
+
+
+ if(m_toast_pool.empty())
+ {
+ //"pool" is empty - create one more panel
+ LL_DEBUGS("NearbyChat") << "Empty pool" << LL_ENDL;
+ if(!createPoolToast())//created toast will go to pool. so next call will find it
+ return;
+ addChat(chat);
+ return;
+ }
+
+ int chat_type = chat["chat_type"].asInteger();
+
+ if( ((EChatType)chat_type == CHAT_TYPE_DEBUG_MSG))
+ {
+ if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE)
+ return;
+ if(gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)
+ return;
+ }
+
+
+ //take 1st element from pool, (re)initialize it, put it in active toasts
+
+ LL_DEBUGS("NearbyChat") << "Getting toast from pool" << LL_ENDL;
+ LLToast* toast = m_toast_pool.back().get();
+
+ m_toast_pool.pop_back();
+
+
+ LLFloaterIMNearbyChatToastPanel* panel = dynamic_cast<LLFloaterIMNearbyChatToastPanel*>(toast->getPanel());
+ if(!panel)
+ return;
+ panel->init(chat);
+
+ toast->reshapeToPanel();
+ toast->startTimer();
+
+ m_active_toasts.push_back(toast->getHandle());
+
+ arrangeToasts();
}
static bool sort_toasts_predicate(LLHandle<LLToast> first, LLHandle<LLToast> second)
{
- if (!first.get() || !second.get()) return false; // STORM-1352
+ if (!first.get() || !second.get()) return false; // STORM-1352
- F32 v1 = first.get()->getTimeLeftToLive();
- F32 v2 = second.get()->getTimeLeftToLive();
- return v1 > v2;
+ F32 v1 = first.get()->getTimeLeftToLive();
+ F32 v2 = second.get()->getTimeLeftToLive();
+ return v1 > v2;
}
void LLFloaterIMNearbyChatScreenChannel::arrangeToasts()
{
- if(mStopProcessing || isHovering())
- return;
-
- if (mFloaterSnapRegion == NULL)
- {
- mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
- }
-
- if (!getParent())
- {
- // connect to floater snap region just to get resize events, we don't care about being a proper widget
- mFloaterSnapRegion->addChild(this);
- setFollows(FOLLOWS_ALL);
- }
-
- LLRect toast_rect;
- updateRect();
-
- LLRect channel_rect;
- mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView);
- channel_rect.mLeft += 10;
- channel_rect.mRight = channel_rect.mLeft + 300;
-
- S32 channel_bottom = channel_rect.mBottom;
-
- S32 bottom = channel_bottom + 80;
- S32 margin = gSavedSettings.getS32("ToastGap");
-
- //sort active toasts
- std::sort(m_active_toasts.begin(),m_active_toasts.end(),sort_toasts_predicate);
-
- //calc max visible item and hide other toasts.
-
- for(toast_vec_t::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it)
- {
- LLToast* toast = it->get();
- if (!toast)
- {
- LL_WARNS() << "NULL found in the active chat toasts list!" << LL_ENDL;
- continue;
- }
-
- S32 toast_top = bottom + toast->getRect().getHeight() + margin;
-
- if(toast_top > channel_rect.getHeight())
- {
- while(it!=m_active_toasts.end())
- {
- addToToastPool(it->get());
- it=m_active_toasts.erase(it);
- }
- break;
- }
-
- toast_rect = toast->getRect();
- toast_rect.setLeftTopAndSize(channel_rect.mLeft , bottom + toast_rect.getHeight(), toast_rect.getWidth() ,toast_rect.getHeight());
-
- toast->setRect(toast_rect);
- bottom += toast_rect.getHeight() - toast->getTopPad() + margin;
- }
-
- // use reverse order to provide correct z-order and avoid toast blinking
-
- for(toast_vec_t::reverse_iterator it = m_active_toasts.rbegin(); it != m_active_toasts.rend(); ++it)
- {
- LLToast* toast = it->get();
- if (toast)
- {
- toast->setIsHidden(false);
- toast->setVisible(TRUE);
- }
- }
+ if(mStopProcessing || isHovering())
+ return;
+
+ if (mFloaterSnapRegion == NULL)
+ {
+ mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+ }
+
+ if (!getParent())
+ {
+ // connect to floater snap region just to get resize events, we don't care about being a proper widget
+ mFloaterSnapRegion->addChild(this);
+ setFollows(FOLLOWS_ALL);
+ }
+
+ LLRect toast_rect;
+ updateRect();
+
+ LLRect channel_rect;
+ mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView);
+ channel_rect.mLeft += 10;
+ channel_rect.mRight = channel_rect.mLeft + 300;
+
+ S32 channel_bottom = channel_rect.mBottom;
+
+ S32 bottom = channel_bottom + 80;
+ S32 margin = gSavedSettings.getS32("ToastGap");
+
+ //sort active toasts
+ std::sort(m_active_toasts.begin(),m_active_toasts.end(),sort_toasts_predicate);
+
+ //calc max visible item and hide other toasts.
+
+ for(toast_vec_t::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it)
+ {
+ LLToast* toast = it->get();
+ if (!toast)
+ {
+ LL_WARNS() << "NULL found in the active chat toasts list!" << LL_ENDL;
+ continue;
+ }
+
+ S32 toast_top = bottom + toast->getRect().getHeight() + margin;
+
+ if(toast_top > channel_rect.getHeight())
+ {
+ while(it!=m_active_toasts.end())
+ {
+ addToToastPool(it->get());
+ it=m_active_toasts.erase(it);
+ }
+ break;
+ }
+
+ toast_rect = toast->getRect();
+ toast_rect.setLeftTopAndSize(channel_rect.mLeft , bottom + toast_rect.getHeight(), toast_rect.getWidth() ,toast_rect.getHeight());
+
+ toast->setRect(toast_rect);
+ bottom += toast_rect.getHeight() - toast->getTopPad() + margin;
+ }
+
+ // use reverse order to provide correct z-order and avoid toast blinking
+
+ for(toast_vec_t::reverse_iterator it = m_active_toasts.rbegin(); it != m_active_toasts.rend(); ++it)
+ {
+ LLToast* toast = it->get();
+ if (toast)
+ {
+ toast->setIsHidden(false);
+ toast->setVisible(TRUE);
+ }
+ }
}
@@ -457,18 +457,18 @@ std::unique_ptr<LLEventPump> LLFloaterIMNearbyChatHandler::sChatWatcher(new LLEv
LLFloaterIMNearbyChatHandler::LLFloaterIMNearbyChatHandler()
{
- // Getting a Channel for our notifications
- LLFloaterIMNearbyChatScreenChannel::Params p;
- p.id = LLUUID(gSavedSettings.getString("NearByChatChannelUUID"));
- LLFloaterIMNearbyChatScreenChannel* channel = new LLFloaterIMNearbyChatScreenChannel(p);
-
- LLFloaterIMNearbyChatScreenChannel::create_toast_panel_callback_t callback = createToastPanel;
+ // Getting a Channel for our notifications
+ LLFloaterIMNearbyChatScreenChannel::Params p;
+ p.id = LLUUID(gSavedSettings.getString("NearByChatChannelUUID"));
+ LLFloaterIMNearbyChatScreenChannel* channel = new LLFloaterIMNearbyChatScreenChannel(p);
+
+ LLFloaterIMNearbyChatScreenChannel::create_toast_panel_callback_t callback = createToastPanel;
- channel->setCreatePanelCallback(callback);
+ channel->setCreatePanelCallback(callback);
- LLChannelManager::getInstance()->addChannel(channel);
+ LLChannelManager::getInstance()->addChannel(channel);
- mChannel = channel->getHandle();
+ mChannel = channel->getHandle();
}
LLFloaterIMNearbyChatHandler::~LLFloaterIMNearbyChatHandler()
@@ -478,172 +478,172 @@ LLFloaterIMNearbyChatHandler::~LLFloaterIMNearbyChatHandler()
void LLFloaterIMNearbyChatHandler::initChannel()
{
- //LLRect snap_rect = gFloaterView->getSnapRect();
- //mChannel->init(snap_rect.mLeft, snap_rect.mLeft + 200);
+ //LLRect snap_rect = gFloaterView->getSnapRect();
+ //mChannel->init(snap_rect.mLeft, snap_rect.mLeft + 200);
}
void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg,
- const LLSD &args)
+ const LLSD &args)
{
- if(chat_msg.mMuted == TRUE)
- return;
+ if(chat_msg.mMuted == TRUE)
+ return;
- if(chat_msg.mText.empty())
- return;//don't process empty messages
+ if(chat_msg.mText.empty())
+ return;//don't process empty messages
LLFloaterReg::getInstance("im_container");
- LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
-
- // Build notification data
- LLSD chat;
- chat["message"] = chat_msg.mText;
- chat["from"] = chat_msg.mFromName;
- chat["from_id"] = chat_msg.mFromID;
- chat["time"] = chat_msg.mTime;
- chat["source"] = (S32)chat_msg.mSourceType;
- chat["chat_type"] = (S32)chat_msg.mChatType;
- chat["chat_style"] = (S32)chat_msg.mChatStyle;
- // Pass sender info so that it can be rendered properly (STORM-1021).
- chat["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args);
-
- if (chat_msg.mChatType == CHAT_TYPE_DIRECT &&
- chat_msg.mText.length() > 0 &&
- chat_msg.mText[0] == '@')
- {
- // Send event on to LLEventStream and exit
- sChatWatcher->post(chat);
- return;
- }
-
- // don't show toast and add message to chat history on receive debug message
- // with disabled setting showing script errors or enabled setting to show script
- // errors in separate window.
- if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG)
- {
+ LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+
+ // Build notification data
+ LLSD chat;
+ chat["message"] = chat_msg.mText;
+ chat["from"] = chat_msg.mFromName;
+ chat["from_id"] = chat_msg.mFromID;
+ chat["time"] = chat_msg.mTime;
+ chat["source"] = (S32)chat_msg.mSourceType;
+ chat["chat_type"] = (S32)chat_msg.mChatType;
+ chat["chat_style"] = (S32)chat_msg.mChatStyle;
+ // Pass sender info so that it can be rendered properly (STORM-1021).
+ chat["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args);
+
+ if (chat_msg.mChatType == CHAT_TYPE_DIRECT &&
+ chat_msg.mText.length() > 0 &&
+ chat_msg.mText[0] == '@')
+ {
+ // Send event on to LLEventStream and exit
+ sChatWatcher->post(chat);
+ return;
+ }
+
+ // don't show toast and add message to chat history on receive debug message
+ // with disabled setting showing script errors or enabled setting to show script
+ // errors in separate window.
+ if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG)
+ {
if (LLFloater::isQuitRequested()) return;
- if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE)
- return;
+ if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE)
+ return;
- // don't process debug messages from not owned objects, see EXT-7762
- if (gAgentID != chat_msg.mOwnerID)
- {
- return;
- }
+ // don't process debug messages from not owned objects, see EXT-7762
+ if (gAgentID != chat_msg.mOwnerID)
+ {
+ return;
+ }
- if (gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)// show error in window //("ScriptErrorsAsChat"))
- {
+ if (gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)// show error in window //("ScriptErrorsAsChat"))
+ {
- LLColor4 txt_color;
+ LLColor4 txt_color;
- LLViewerChat::getChatColor(chat_msg,txt_color);
+ LLViewerChat::getChatColor(chat_msg,txt_color);
- LLFloaterScriptDebug::addScriptLine(chat_msg.mText,
- chat_msg.mFromName,
- txt_color,
- chat_msg.mFromID);
- return;
- }
- }
+ LLFloaterScriptDebug::addScriptLine(chat_msg.mText,
+ chat_msg.mFromName,
+ txt_color,
+ chat_msg.mFromID);
+ return;
+ }
+ }
- nearby_chat->addMessage(chat_msg, true, args);
+ nearby_chat->addMessage(chat_msg, true, args);
- if(chat_msg.mSourceType == CHAT_SOURCE_AGENT
- && chat_msg.mFromID.notNull()
- && chat_msg.mFromID != gAgentID)
- {
- LLFirstUse::otherAvatarChatFirst();
+ if(chat_msg.mSourceType == CHAT_SOURCE_AGENT
+ && chat_msg.mFromID.notNull()
+ && chat_msg.mFromID != gAgentID)
+ {
+ LLFirstUse::otherAvatarChatFirst();
- // Add sender to the recent people list.
- LLRecentPeople::instance().add(chat_msg.mFromID);
+ // Add sender to the recent people list.
+ LLRecentPeople::instance().add(chat_msg.mFromID);
- }
+ }
- // Send event on to LLEventStream
- sChatWatcher->post(chat);
+ // Send event on to LLEventStream
+ sChatWatcher->post(chat);
LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- if(( ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
- && gSavedSettings.getBOOL("UseChatBubbles") )
- || mChannel.isDead()
- || !mChannel.get()->getShowToasts() )
- && nearby_chat->isMessagePaneExpanded())
- // to prevent toasts in Do Not Disturb mode
- return;//no need in toast if chat is visible or if bubble chat is enabled
-
- // arrange a channel on a screen
- if(!mChannel.get()->getVisible())
- {
- initChannel();
- }
-
- /*
- //comment all this due to EXT-4432
- ..may clean up after some time...
-
- //only messages from AGENTS
- if(CHAT_SOURCE_OBJECT == chat_msg.mSourceType)
- {
- if(chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG)
- return;//ok for now we don't skip messeges from object, so skip only debug messages
- }
- */
-
- LLFloaterIMNearbyChatScreenChannel* channel = dynamic_cast<LLFloaterIMNearbyChatScreenChannel*>(mChannel.get());
-
- if(channel)
- {
- // Handle IRC styled messages.
- std::string toast_msg;
- if (chat_msg.mChatStyle == CHAT_STYLE_IRC)
- {
- if (!chat_msg.mFromName.empty())
- {
- toast_msg += chat_msg.mFromName;
- }
- toast_msg += chat_msg.mText.substr(3);
- }
- else
- {
- toast_msg = chat_msg.mText;
- }
-
- bool chat_overlaps = false;
- if(nearby_chat->getChatHistory())
- {
- LLRect chat_rect = nearby_chat->getChatHistory()->calcScreenRect();
- for (std::list<LLView*>::const_iterator child_iter = gFloaterView->getChildList()->begin();
- child_iter != gFloaterView->getChildList()->end(); ++child_iter)
- {
- LLView *view = *child_iter;
- const LLRect& rect = view->getRect();
- if(view->isInVisibleChain() && (rect.overlaps(chat_rect)))
- {
- if(!nearby_chat->getChatHistory()->hasAncestor(view))
- {
- chat_overlaps = true;
- }
- break;
- }
- }
- }
- //Don't show nearby toast, if conversation is visible and selected
- if ((nearby_chat->hasFocus()) ||
- (LLFloater::isVisible(nearby_chat) && nearby_chat->isTornOff() && !nearby_chat->isMinimized()) ||
- ((im_box->getSelectedSession().isNull() && !chat_overlaps &&
- ((LLFloater::isVisible(im_box) && !nearby_chat->isTornOff() && !im_box->isMinimized())
- || (LLFloater::isVisible(nearby_chat) && nearby_chat->isTornOff() && !nearby_chat->isMinimized())))))
- {
- if(nearby_chat->isMessagePaneExpanded())
- {
- return;
- }
- }
-
- //Will show toast when chat preference is set
+ if(( ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
+ && gSavedSettings.getBOOL("UseChatBubbles") )
+ || mChannel.isDead()
+ || !mChannel.get()->getShowToasts() )
+ && nearby_chat->isMessagePaneExpanded())
+ // to prevent toasts in Do Not Disturb mode
+ return;//no need in toast if chat is visible or if bubble chat is enabled
+
+ // arrange a channel on a screen
+ if(!mChannel.get()->getVisible())
+ {
+ initChannel();
+ }
+
+ /*
+ //comment all this due to EXT-4432
+ ..may clean up after some time...
+
+ //only messages from AGENTS
+ if(CHAT_SOURCE_OBJECT == chat_msg.mSourceType)
+ {
+ if(chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG)
+ return;//ok for now we don't skip messeges from object, so skip only debug messages
+ }
+ */
+
+ LLFloaterIMNearbyChatScreenChannel* channel = dynamic_cast<LLFloaterIMNearbyChatScreenChannel*>(mChannel.get());
+
+ if(channel)
+ {
+ // Handle IRC styled messages.
+ std::string toast_msg;
+ if (chat_msg.mChatStyle == CHAT_STYLE_IRC)
+ {
+ if (!chat_msg.mFromName.empty())
+ {
+ toast_msg += chat_msg.mFromName;
+ }
+ toast_msg += chat_msg.mText.substr(3);
+ }
+ else
+ {
+ toast_msg = chat_msg.mText;
+ }
+
+ bool chat_overlaps = false;
+ if(nearby_chat->getChatHistory())
+ {
+ LLRect chat_rect = nearby_chat->getChatHistory()->calcScreenRect();
+ for (std::list<LLView*>::const_iterator child_iter = gFloaterView->getChildList()->begin();
+ child_iter != gFloaterView->getChildList()->end(); ++child_iter)
+ {
+ LLView *view = *child_iter;
+ const LLRect& rect = view->getRect();
+ if(view->isInVisibleChain() && (rect.overlaps(chat_rect)))
+ {
+ if(!nearby_chat->getChatHistory()->hasAncestor(view))
+ {
+ chat_overlaps = true;
+ }
+ break;
+ }
+ }
+ }
+ //Don't show nearby toast, if conversation is visible and selected
+ if ((nearby_chat->hasFocus()) ||
+ (LLFloater::isVisible(nearby_chat) && nearby_chat->isTornOff() && !nearby_chat->isMinimized()) ||
+ ((im_box->getSelectedSession().isNull() && !chat_overlaps &&
+ ((LLFloater::isVisible(im_box) && !nearby_chat->isTornOff() && !im_box->isMinimized())
+ || (LLFloater::isVisible(nearby_chat) && nearby_chat->isTornOff() && !nearby_chat->isMinimized())))))
+ {
+ if(nearby_chat->isMessagePaneExpanded())
+ {
+ return;
+ }
+ }
+
+ //Will show toast when chat preference is set
if((gSavedSettings.getString("NotificationNearbyChatOptions") == "toast") || !nearby_chat->isMessagePaneExpanded())
{
// Add a nearby chat toast.
@@ -651,17 +651,17 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg,
id.generate();
chat["id"] = id;
std::string r_color_name = "White";
- F32 r_color_alpha = 1.0f;
+ F32 r_color_alpha = 1.0f;
LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha);
chat["text_color"] = r_color_name;
chat["color_alpha"] = r_color_alpha;
chat["font_size"] = (S32)LLViewerChat::getChatFontSize() ;
chat["message"] = toast_msg;
- channel->addChat(chat);
+ channel->addChat(chat);
}
- }
+ }
}
@@ -672,7 +672,7 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg,
// virtual
void LLFloaterIMNearbyChatToast::onClose(bool app_quitting)
{
- mNearbyChatScreenChannelp->onToastDestroyed(this, app_quitting);
+ mNearbyChatScreenChannelp->onToastDestroyed(this, app_quitting);
}
// EOF
diff --git a/indra/newview/llfloaterimnearbychathandler.h b/indra/newview/llfloaterimnearbychathandler.h
index 1849604470..412a18726d 100644
--- a/indra/newview/llfloaterimnearbychathandler.h
+++ b/indra/newview/llfloaterimnearbychathandler.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterimnearbychathandler.h
* @brief nearby chat notify
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,16 +37,16 @@ namespace LLNotificationsUI{
class LLFloaterIMNearbyChatHandler : public LLChatHandler
{
public:
- LLFloaterIMNearbyChatHandler();
- virtual ~LLFloaterIMNearbyChatHandler();
+ LLFloaterIMNearbyChatHandler();
+ virtual ~LLFloaterIMNearbyChatHandler();
- virtual void processChat(const LLChat& chat_msg, const LLSD &args);
+ virtual void processChat(const LLChat& chat_msg, const LLSD &args);
protected:
- virtual void initChannel();
+ virtual void initChannel();
- static std::unique_ptr<LLEventPump> sChatWatcher;
+ static std::unique_ptr<LLEventPump> sChatWatcher;
};
}
diff --git a/indra/newview/llfloaterimnearbychatlistener.cpp b/indra/newview/llfloaterimnearbychatlistener.cpp
index 5a5f6c72c8..616acf0eae 100644
--- a/indra/newview/llfloaterimnearbychatlistener.cpp
+++ b/indra/newview/llfloaterimnearbychatlistener.cpp
@@ -39,13 +39,13 @@
LLFloaterIMNearbyChatListener::LLFloaterIMNearbyChatListener(LLFloaterIMNearbyChat & chatbar)
: LLEventAPI("LLChatBar",
"LLChatBar listener to (e.g.) sendChat, etc."),
- mChatbar(chatbar)
+ mChatbar(chatbar)
{
add("sendChat",
"Send chat to the simulator:\n"
"[\"message\"] chat message text [required]\n"
"[\"channel\"] chat channel number [default = 0]\n"
- "[\"type\"] chat type \"whisper\", \"normal\", \"shout\" [default = \"normal\"]",
+ "[\"type\"] chat type \"whisper\", \"normal\", \"shout\" [default = \"normal\"]",
&LLFloaterIMNearbyChatListener::sendChat);
}
@@ -53,48 +53,48 @@ LLFloaterIMNearbyChatListener::LLFloaterIMNearbyChatListener(LLFloaterIMNearbyCh
// "sendChat" command
void LLFloaterIMNearbyChatListener::sendChat(LLSD const & chat_data) const
{
- // Extract the data
- std::string chat_text = chat_data["message"].asString();
+ // Extract the data
+ std::string chat_text = chat_data["message"].asString();
- S32 channel = 0;
- if (chat_data.has("channel"))
- {
- channel = chat_data["channel"].asInteger();
- if (channel < 0 || channel >= CHAT_CHANNEL_DEBUG)
- { // Use 0 up to (but not including) CHAT_CHANNEL_DEBUG
- channel = 0;
- }
- }
+ S32 channel = 0;
+ if (chat_data.has("channel"))
+ {
+ channel = chat_data["channel"].asInteger();
+ if (channel < 0 || channel >= CHAT_CHANNEL_DEBUG)
+ { // Use 0 up to (but not including) CHAT_CHANNEL_DEBUG
+ channel = 0;
+ }
+ }
- EChatType type_o_chat = CHAT_TYPE_NORMAL;
- if (chat_data.has("type"))
- {
- std::string type_string = chat_data["type"].asString();
- if (type_string == "whisper")
- {
- type_o_chat = CHAT_TYPE_WHISPER;
- }
- else if (type_string == "shout")
- {
- type_o_chat = CHAT_TYPE_SHOUT;
- }
- }
+ EChatType type_o_chat = CHAT_TYPE_NORMAL;
+ if (chat_data.has("type"))
+ {
+ std::string type_string = chat_data["type"].asString();
+ if (type_string == "whisper")
+ {
+ type_o_chat = CHAT_TYPE_WHISPER;
+ }
+ else if (type_string == "shout")
+ {
+ type_o_chat = CHAT_TYPE_SHOUT;
+ }
+ }
- // Have to prepend /42 style channel numbers
- std::string chat_to_send;
- if (channel == 0)
- {
- chat_to_send = chat_text;
- }
- else
- {
- chat_to_send += "/";
- chat_to_send += chat_data["channel"].asString();
- chat_to_send += " ";
- chat_to_send += chat_text;
- }
+ // Have to prepend /42 style channel numbers
+ std::string chat_to_send;
+ if (channel == 0)
+ {
+ chat_to_send = chat_text;
+ }
+ else
+ {
+ chat_to_send += "/";
+ chat_to_send += chat_data["channel"].asString();
+ chat_to_send += " ";
+ chat_to_send += chat_text;
+ }
- // Send it as if it was typed in
- mChatbar.sendChatFromViewer(chat_to_send, type_o_chat, ((BOOL)(channel == 0)) && gSavedSettings.getBOOL("PlayChatAnim"));
+ // Send it as if it was typed in
+ mChatbar.sendChatFromViewer(chat_to_send, type_o_chat, ((BOOL)(channel == 0)) && gSavedSettings.getBOOL("PlayChatAnim"));
}
diff --git a/indra/newview/llfloaterimnearbychatlistener.h b/indra/newview/llfloaterimnearbychatlistener.h
index 1470a6dc1e..96184d95b3 100644
--- a/indra/newview/llfloaterimnearbychatlistener.h
+++ b/indra/newview/llfloaterimnearbychatlistener.h
@@ -38,12 +38,12 @@ class LLFloaterIMNearbyChat;
class LLFloaterIMNearbyChatListener : public LLEventAPI
{
public:
- LLFloaterIMNearbyChatListener(LLFloaterIMNearbyChat & chatbar);
+ LLFloaterIMNearbyChatListener(LLFloaterIMNearbyChat & chatbar);
private:
void sendChat(LLSD const & chat_data) const;
- LLFloaterIMNearbyChat & mChatbar;
+ LLFloaterIMNearbyChat & mChatbar;
};
#endif // LL_LLFLOATERIMNEARBYCHATLISTENER_H
diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp
index ed2a2807b5..ffa23df8d8 100644
--- a/indra/newview/llfloaterimsession.cpp
+++ b/indra/newview/llfloaterimsession.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterimsession.cpp
* @brief LLFloaterIMSession class definition
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -70,27 +70,27 @@ floater_showed_signal_t LLFloaterIMSession::sIMFloaterShowedSignal;
LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id)
: LLFloaterIMSessionTab(session_id),
- mLastMessageIndex(-1),
- mDialog(IM_NOTHING_SPECIAL),
- mTypingStart(),
- mShouldSendTypingState(false),
- mMeTyping(false),
- mOtherTyping(false),
- mSessionNameUpdatedForTyping(false),
- mTypingTimer(),
- mTypingTimeoutTimer(),
- mPositioned(false),
- mSessionInitialized(false),
- mMeTypingTimer(),
- mOtherTypingTimer()
+ mLastMessageIndex(-1),
+ mDialog(IM_NOTHING_SPECIAL),
+ mTypingStart(),
+ mShouldSendTypingState(false),
+ mMeTyping(false),
+ mOtherTyping(false),
+ mSessionNameUpdatedForTyping(false),
+ mTypingTimer(),
+ mTypingTimeoutTimer(),
+ mPositioned(false),
+ mSessionInitialized(false),
+ mMeTypingTimer(),
+ mOtherTypingTimer()
{
- mIsNearbyChat = false;
+ mIsNearbyChat = false;
+
+ initIMSession(session_id);
- initIMSession(session_id);
-
- setOverlapsScreenChannel(true);
+ setOverlapsScreenChannel(true);
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this);
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this);
mEnableCallbackRegistrar.add("Avatar.EnableGearItem", boost::bind(&LLFloaterIMSession::enableGearMenuItem, this, _2));
mCommitCallbackRegistrar.add("Avatar.GearDoToSelected", boost::bind(&LLFloaterIMSession::GearDoToSelected, this, _2));
mEnableCallbackRegistrar.add("Avatar.CheckGearItem", boost::bind(&LLFloaterIMSession::checkGearMenuItem, this, _2));
@@ -102,31 +102,31 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id)
// virtual
void LLFloaterIMSession::refresh()
{
- if (mMeTyping)
+ if (mMeTyping)
{
- // Send an additional Start Typing packet every ME_TYPING_TIMEOUT seconds
- if (mMeTypingTimer.getElapsedTimeF32() > ME_TYPING_TIMEOUT && false == mShouldSendTypingState)
- {
- LL_DEBUGS("TypingMsgs") << "Send additional Start Typing packet" << LL_ENDL;
- LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE);
- mMeTypingTimer.reset();
- }
-
- // Time out if user hasn't typed for a while.
- if (mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS)
- {
- setTyping(false);
- LL_DEBUGS("TypingMsgs") << "Send stop typing due to timeout" << LL_ENDL;
- }
- }
-
- // Clear <name is typing> message if no data received for OTHER_TYPING_TIMEOUT seconds
- if (mOtherTyping && mOtherTypingTimer.getElapsedTimeF32() > OTHER_TYPING_TIMEOUT)
- {
- LL_DEBUGS("TypingMsgs") << "Received: is typing cleared due to timeout" << LL_ENDL;
- removeTypingIndicator(mImFromId);
- mOtherTyping = false;
- }
+ // Send an additional Start Typing packet every ME_TYPING_TIMEOUT seconds
+ if (mMeTypingTimer.getElapsedTimeF32() > ME_TYPING_TIMEOUT && false == mShouldSendTypingState)
+ {
+ LL_DEBUGS("TypingMsgs") << "Send additional Start Typing packet" << LL_ENDL;
+ LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE);
+ mMeTypingTimer.reset();
+ }
+
+ // Time out if user hasn't typed for a while.
+ if (mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS)
+ {
+ setTyping(false);
+ LL_DEBUGS("TypingMsgs") << "Send stop typing due to timeout" << LL_ENDL;
+ }
+ }
+
+ // Clear <name is typing> message if no data received for OTHER_TYPING_TIMEOUT seconds
+ if (mOtherTyping && mOtherTypingTimer.getElapsedTimeF32() > OTHER_TYPING_TIMEOUT)
+ {
+ LL_DEBUGS("TypingMsgs") << "Received: is typing cleared due to timeout" << LL_ENDL;
+ removeTypingIndicator(mImFromId);
+ mOtherTyping = false;
+ }
}
@@ -139,71 +139,71 @@ void LLFloaterIMSession::onTearOffClicked()
// virtual
void LLFloaterIMSession::onClickCloseBtn(bool)
{
- LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID);
-
- if (session != NULL)
- {
- bool is_call_with_chat = session->isGroupSessionType()
- || session->isAdHocSessionType() || session->isP2PSessionType();
-
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
-
- if (is_call_with_chat && voice_channel != NULL
- && voice_channel->isActive())
- {
- LLSD payload;
- payload["session_id"] = mSessionID;
- LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback);
- return;
- }
- }
- else
- {
- LL_WARNS() << "Empty session with id: " << (mSessionID.asString()) << LL_ENDL;
- }
-
- LLFloaterIMSessionTab::onClickCloseBtn();
+ LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID);
+
+ if (session != NULL)
+ {
+ bool is_call_with_chat = session->isGroupSessionType()
+ || session->isAdHocSessionType() || session->isP2PSessionType();
+
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
+
+ if (is_call_with_chat && voice_channel != NULL
+ && voice_channel->isActive())
+ {
+ LLSD payload;
+ payload["session_id"] = mSessionID;
+ LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback);
+ return;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Empty session with id: " << (mSessionID.asString()) << LL_ENDL;
+ }
+
+ LLFloaterIMSessionTab::onClickCloseBtn();
}
/* static */
void LLFloaterIMSession::newIMCallback(const LLSD& data)
{
- if (data["num_unread"].asInteger() > 0 || data["from_id"].asUUID().isNull())
- {
- LLUUID session_id = data["session_id"].asUUID();
+ if (data["num_unread"].asInteger() > 0 || data["from_id"].asUUID().isNull())
+ {
+ LLUUID session_id = data["session_id"].asUUID();
- LLFloaterIMSession* floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id);
+ LLFloaterIMSession* floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id);
// update if visible, otherwise will be updated when opened
- if (floater && floater->isInVisibleChain())
- {
- floater->updateMessages();
- }
- }
+ if (floater && floater->isInVisibleChain())
+ {
+ floater->updateMessages();
+ }
+ }
}
void LLFloaterIMSession::onVisibilityChanged(const LLSD& new_visibility)
{
- bool visible = new_visibility.asBoolean();
-
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
-
- if (visible && voice_channel &&
- voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED)
- {
- LLFloaterReg::showInstance("voice_call", mSessionID);
- }
- else
- {
- LLFloaterReg::hideInstance("voice_call", mSessionID);
- }
+ bool visible = new_visibility.asBoolean();
+
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
+
+ if (visible && voice_channel &&
+ voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED)
+ {
+ LLFloaterReg::showInstance("voice_call", mSessionID);
+ }
+ else
+ {
+ LLFloaterReg::hideInstance("voice_call", mSessionID);
+ }
}
void LLFloaterIMSession::onSendMsg( LLUICtrl* ctrl, void* userdata )
{
- LLFloaterIMSession* self = (LLFloaterIMSession*) userdata;
- self->sendMsgFromInputEditor();
- self->setTyping(false);
+ LLFloaterIMSession* self = (LLFloaterIMSession*) userdata;
+ self->sendMsgFromInputEditor();
+ self->setTyping(false);
}
bool LLFloaterIMSession::enableGearMenuItem(const LLSD& userdata)
@@ -212,1015 +212,1015 @@ bool LLFloaterIMSession::enableGearMenuItem(const LLSD& userdata)
uuid_vec_t selected_uuids;
selected_uuids.push_back(mOtherParticipantUUID);
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- return floater_container->enableContextMenuItem(command, selected_uuids);
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ return floater_container->enableContextMenuItem(command, selected_uuids);
}
void LLFloaterIMSession::GearDoToSelected(const LLSD& userdata)
{
- std::string command = userdata.asString();
+ std::string command = userdata.asString();
uuid_vec_t selected_uuids;
selected_uuids.push_back(mOtherParticipantUUID);
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- floater_container->doToParticipants(command, selected_uuids);
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ floater_container->doToParticipants(command, selected_uuids);
}
bool LLFloaterIMSession::checkGearMenuItem(const LLSD& userdata)
{
- std::string command = userdata.asString();
- uuid_vec_t selected_uuids;
- selected_uuids.push_back(mOtherParticipantUUID);
+ std::string command = userdata.asString();
+ uuid_vec_t selected_uuids;
+ selected_uuids.push_back(mOtherParticipantUUID);
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- return floater_container->checkContextMenuItem(command, selected_uuids);
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ return floater_container->checkContextMenuItem(command, selected_uuids);
}
void LLFloaterIMSession::sendMsgFromInputEditor()
{
- if (gAgent.isGodlike()
- || (mDialog != IM_NOTHING_SPECIAL)
- || !mOtherParticipantUUID.isNull())
- {
- if (mInputEditor)
- {
- LLWString text = mInputEditor->getWText();
- LLWStringUtil::trim(text);
- LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines.
- if(!text.empty())
- {
- updateUsedEmojis(text);
-
- // Truncate and convert to UTF8 for transport
- std::string utf8_text = wstring_to_utf8str(text);
-
- sendMsg(utf8_text);
-
- mInputEditor->setText(LLStringUtil::null);
- }
- }
- }
- else
- {
- LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL;
- }
+ if (gAgent.isGodlike()
+ || (mDialog != IM_NOTHING_SPECIAL)
+ || !mOtherParticipantUUID.isNull())
+ {
+ if (mInputEditor)
+ {
+ LLWString text = mInputEditor->getWText();
+ LLWStringUtil::trim(text);
+ LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines.
+ if(!text.empty())
+ {
+ updateUsedEmojis(text);
+
+ // Truncate and convert to UTF8 for transport
+ std::string utf8_text = wstring_to_utf8str(text);
+
+ sendMsg(utf8_text);
+
+ mInputEditor->setText(LLStringUtil::null);
+ }
+ }
+ }
+ else
+ {
+ LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL;
+ }
}
void LLFloaterIMSession::sendMsg(const std::string& msg)
{
- const std::string utf8_text = utf8str_truncate(msg, MAX_MSG_BUF_SIZE - 1);
-
- if (mSessionInitialized)
- {
- LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog);
- }
- else
- {
- //queue up the message to send once the session is initialized
- mQueuedMsgsForInit.append(utf8_text);
- }
-
- updateMessages();
+ const std::string utf8_text = utf8str_truncate(msg, MAX_MSG_BUF_SIZE - 1);
+
+ if (mSessionInitialized)
+ {
+ LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog);
+ }
+ else
+ {
+ //queue up the message to send once the session is initialized
+ mQueuedMsgsForInit.append(utf8_text);
+ }
+
+ updateMessages();
}
LLFloaterIMSession::~LLFloaterIMSession()
{
- mVoiceChannelStateChangeConnection.disconnect();
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->removeObserver(this);
- }
+ mVoiceChannelStateChangeConnection.disconnect();
+ if(LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->removeObserver(this);
+ }
- LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
+ LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
}
void LLFloaterIMSession::initIMSession(const LLUUID& session_id)
{
- // Change the floater key to bind it to a new session.
- setKey(session_id);
-
- mSessionID = session_id;
- mSession = LLIMModel::getInstance()->findIMSession(mSessionID);
-
- if (mSession)
- {
- mIsP2PChat = mSession->isP2PSessionType();
- mSessionInitialized = mSession->mSessionInitialized;
- mDialog = mSession->mType;
- }
+ // Change the floater key to bind it to a new session.
+ setKey(session_id);
+
+ mSessionID = session_id;
+ mSession = LLIMModel::getInstance()->findIMSession(mSessionID);
+
+ if (mSession)
+ {
+ mIsP2PChat = mSession->isP2PSessionType();
+ mSessionInitialized = mSession->mSessionInitialized;
+ mDialog = mSession->mType;
+ }
}
void LLFloaterIMSession::initIMFloater()
{
- const LLUUID& other_party_id =
- LLIMModel::getInstance()->getOtherParticipantID(mSessionID);
- if (other_party_id.notNull())
- {
- mOtherParticipantUUID = other_party_id;
- }
-
- boundVoiceChannel();
-
- mTypingStart = LLTrans::getString("IM_typing_start_string");
-
- // Show control panel in torn off floaters only.
- mParticipantListPanel->setVisible(!getHost() && gSavedSettings.getBOOL("IMShowControlPanel"));
-
- // Disable input editor if session cannot accept text
- if ( mSession && !mSession->mTextIMPossible )
- {
- mInputEditor->setEnabled(FALSE);
- mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label"));
- }
-
- if (!mIsP2PChat)
- {
- std::string session_name(LLIMModel::instance().getName(mSessionID));
- updateSessionName(session_name);
- }
+ const LLUUID& other_party_id =
+ LLIMModel::getInstance()->getOtherParticipantID(mSessionID);
+ if (other_party_id.notNull())
+ {
+ mOtherParticipantUUID = other_party_id;
+ }
+
+ boundVoiceChannel();
+
+ mTypingStart = LLTrans::getString("IM_typing_start_string");
+
+ // Show control panel in torn off floaters only.
+ mParticipantListPanel->setVisible(!getHost() && gSavedSettings.getBOOL("IMShowControlPanel"));
+
+ // Disable input editor if session cannot accept text
+ if ( mSession && !mSession->mTextIMPossible )
+ {
+ mInputEditor->setEnabled(FALSE);
+ mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label"));
+ }
+
+ if (!mIsP2PChat)
+ {
+ std::string session_name(LLIMModel::instance().getName(mSessionID));
+ updateSessionName(session_name);
+ }
}
//virtual
BOOL LLFloaterIMSession::postBuild()
{
- BOOL result = LLFloaterIMSessionTab::postBuild();
+ BOOL result = LLFloaterIMSessionTab::postBuild();
- mInputEditor->setMaxTextLength(1023);
- mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5));
- mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
- mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) );
- mInputEditor->setKeystrokeCallback( boost::bind(onInputEditorKeystroke, _1, this) );
- mInputEditor->setCommitCallback(boost::bind(onSendMsg, _1, this));
+ mInputEditor->setMaxTextLength(1023);
+ mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5));
+ mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
+ mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) );
+ mInputEditor->setKeystrokeCallback( boost::bind(onInputEditorKeystroke, _1, this) );
+ mInputEditor->setCommitCallback(boost::bind(onSendMsg, _1, this));
+
+ setDocked(true);
- setDocked(true);
+ LLButton* add_btn = getChild<LLButton>("add_btn");
- LLButton* add_btn = getChild<LLButton>("add_btn");
+ // Allow to add chat participants depending on the session type
+ add_btn->setEnabled(isInviteAllowed());
+ add_btn->setClickedCallback(boost::bind(&LLFloaterIMSession::onAddButtonClicked, this));
- // Allow to add chat participants depending on the session type
- add_btn->setEnabled(isInviteAllowed());
- add_btn->setClickedCallback(boost::bind(&LLFloaterIMSession::onAddButtonClicked, this));
+ childSetAction("voice_call_btn", boost::bind(&LLFloaterIMSession::onCallButtonClicked, this));
- childSetAction("voice_call_btn", boost::bind(&LLFloaterIMSession::onCallButtonClicked, this));
+ LLVoiceClient::getInstance()->addObserver(this);
- LLVoiceClient::getInstance()->addObserver(this);
-
- //*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
- //see LLFloaterIMPanel for how it is done (IB)
+ //*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
+ //see LLFloaterIMPanel for how it is done (IB)
- initIMFloater();
+ initIMFloater();
- return result;
+ return result;
}
void LLFloaterIMSession::onAddButtonClicked()
{
LLView * button = findChild<LLView>("toolbar_panel")->findChild<LLButton>("add_btn");
LLFloater* root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMSession::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button);
- if (!picker)
- {
- return;
- }
-
- // Need to disable 'ok' button when selected users are already in conversation.
- picker->setOkBtnEnableCb(boost::bind(&LLFloaterIMSession::canAddSelectedToChat, this, _1));
-
- if (root_floater)
- {
- root_floater->addDependentFloater(picker);
- }
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMSession::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button);
+ if (!picker)
+ {
+ return;
+ }
+
+ // Need to disable 'ok' button when selected users are already in conversation.
+ picker->setOkBtnEnableCb(boost::bind(&LLFloaterIMSession::canAddSelectedToChat, this, _1));
+
+ if (root_floater)
+ {
+ root_floater->addDependentFloater(picker);
+ }
}
bool LLFloaterIMSession::canAddSelectedToChat(const uuid_vec_t& uuids)
{
- if (!mSession
- || mDialog == IM_SESSION_GROUP_START
- || (mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)))
- {
- return false;
- }
-
- if (mIsP2PChat)
- {
- // For a P2P session just check if we are not adding the other participant.
-
- for (uuid_vec_t::const_iterator id = uuids.begin();
- id != uuids.end(); ++id)
- {
- if (*id == mOtherParticipantUUID)
- {
- return false;
- }
- }
- }
- else
- {
- // For a conference session we need to check against the list from LLSpeakerMgr,
- // because this list may change when participants join or leave the session.
-
- LLSpeakerMgr::speaker_list_t speaker_list;
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (speaker_mgr)
- {
- speaker_mgr->getSpeakerList(&speaker_list, true);
- }
-
- for (uuid_vec_t::const_iterator id = uuids.begin();
- id != uuids.end(); ++id)
- {
- for (LLSpeakerMgr::speaker_list_t::const_iterator it = speaker_list.begin();
- it != speaker_list.end(); ++it)
- {
- const LLPointer<LLSpeaker>& speaker = *it;
- if (*id == speaker->mID)
- {
- return false;
- }
- }
- }
- }
-
- return true;
+ if (!mSession
+ || mDialog == IM_SESSION_GROUP_START
+ || (mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)))
+ {
+ return false;
+ }
+
+ if (mIsP2PChat)
+ {
+ // For a P2P session just check if we are not adding the other participant.
+
+ for (uuid_vec_t::const_iterator id = uuids.begin();
+ id != uuids.end(); ++id)
+ {
+ if (*id == mOtherParticipantUUID)
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ // For a conference session we need to check against the list from LLSpeakerMgr,
+ // because this list may change when participants join or leave the session.
+
+ LLSpeakerMgr::speaker_list_t speaker_list;
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (speaker_mgr)
+ {
+ speaker_mgr->getSpeakerList(&speaker_list, true);
+ }
+
+ for (uuid_vec_t::const_iterator id = uuids.begin();
+ id != uuids.end(); ++id)
+ {
+ for (LLSpeakerMgr::speaker_list_t::const_iterator it = speaker_list.begin();
+ it != speaker_list.end(); ++it)
+ {
+ const LLPointer<LLSpeaker>& speaker = *it;
+ if (*id == speaker->mID)
+ {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
}
void LLFloaterIMSession::addSessionParticipants(const uuid_vec_t& uuids)
{
- if (mIsP2PChat)
- {
- LLSD payload;
- LLSD args;
-
- LLNotificationsUtil::add("ConfirmAddingChatParticipants", args, payload,
- boost::bind(&LLFloaterIMSession::addP2PSessionParticipants, this, _1, _2, uuids));
- }
- else
- {
- if(findInstance(mSessionID))
- {
- // remember whom we have invited, to notify others later, when the invited ones actually join
- mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end());
- }
-
- inviteToSession(uuids);
- }
+ if (mIsP2PChat)
+ {
+ LLSD payload;
+ LLSD args;
+
+ LLNotificationsUtil::add("ConfirmAddingChatParticipants", args, payload,
+ boost::bind(&LLFloaterIMSession::addP2PSessionParticipants, this, _1, _2, uuids));
+ }
+ else
+ {
+ if(findInstance(mSessionID))
+ {
+ // remember whom we have invited, to notify others later, when the invited ones actually join
+ mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end());
+ }
+
+ inviteToSession(uuids);
+ }
}
void LLFloaterIMSession::addP2PSessionParticipants(const LLSD& notification, const LLSD& response, const uuid_vec_t& uuids)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0)
- {
- return;
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0)
+ {
+ return;
+ }
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
- // first check whether this is a voice session
- bool is_voice_call = voice_channel != NULL && voice_channel->isActive();
+ // first check whether this is a voice session
+ bool is_voice_call = voice_channel != NULL && voice_channel->isActive();
- uuid_vec_t temp_ids;
+ uuid_vec_t temp_ids;
- // Add the initial participant of a P2P session
- temp_ids.push_back(mOtherParticipantUUID);
- temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end());
+ // Add the initial participant of a P2P session
+ temp_ids.push_back(mOtherParticipantUUID);
+ temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end());
- // then we can close the current session
- if(findInstance(mSessionID))
- {
- onClose(false);
+ // then we can close the current session
+ if(findInstance(mSessionID))
+ {
+ onClose(false);
- // remember whom we have invited, to notify others later, when the invited ones actually join
- mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end());
- }
+ // remember whom we have invited, to notify others later, when the invited ones actually join
+ mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end());
+ }
- // we start a new session so reset the initialization flag
- mSessionInitialized = false;
+ // we start a new session so reset the initialization flag
+ mSessionInitialized = false;
- // Start a new ad hoc voice call if we invite new participants to a P2P call,
- // or start a text chat otherwise.
- if (is_voice_call)
- {
- LLAvatarActions::startAdhocCall(temp_ids, mSessionID);
- }
- else
- {
- LLAvatarActions::startConference(temp_ids, mSessionID);
- }
+ // Start a new ad hoc voice call if we invite new participants to a P2P call,
+ // or start a text chat otherwise.
+ if (is_voice_call)
+ {
+ LLAvatarActions::startAdhocCall(temp_ids, mSessionID);
+ }
+ else
+ {
+ LLAvatarActions::startConference(temp_ids, mSessionID);
+ }
}
void LLFloaterIMSession::sendParticipantsAddedNotification(const uuid_vec_t& uuids)
{
- std::string names_string;
- LLAvatarActions::buildResidentsString(uuids, names_string);
- LLStringUtil::format_map_t args;
- args["[NAME]"] = names_string;
+ std::string names_string;
+ LLAvatarActions::buildResidentsString(uuids, names_string);
+ LLStringUtil::format_map_t args;
+ args["[NAME]"] = names_string;
- sendMsg(getString(uuids.size() > 1 ? "multiple_participants_added" : "participant_added", args));
+ sendMsg(getString(uuids.size() > 1 ? "multiple_participants_added" : "participant_added", args));
}
void LLFloaterIMSession::boundVoiceChannel()
{
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
- if(voice_channel)
- {
- mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback(
- boost::bind(&LLFloaterIMSession::onVoiceChannelStateChanged, this, _1, _2));
-
- //call (either p2p, group or ad-hoc) can be already in started state
- bool callIsActive = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED;
- updateCallBtnState(callIsActive);
- }
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
+ if(voice_channel)
+ {
+ mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback(
+ boost::bind(&LLFloaterIMSession::onVoiceChannelStateChanged, this, _1, _2));
+
+ //call (either p2p, group or ad-hoc) can be already in started state
+ bool callIsActive = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED;
+ updateCallBtnState(callIsActive);
+ }
}
void LLFloaterIMSession::onCallButtonClicked()
{
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
- if (voice_channel)
- {
- bool is_call_active = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED;
- if (is_call_active)
- {
- gIMMgr->endCall(mSessionID);
- }
- else
- {
- gIMMgr->startCall(mSessionID);
- }
- }
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
+ if (voice_channel)
+ {
+ bool is_call_active = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED;
+ if (is_call_active)
+ {
+ gIMMgr->endCall(mSessionID);
+ }
+ else
+ {
+ gIMMgr->startCall(mSessionID);
+ }
+ }
}
void LLFloaterIMSession::onChange(EStatusType status, const std::string &channelURI, bool proximal)
{
- if(status != STATUS_JOINING && status != STATUS_LEFT_CHANNEL)
- {
- enableDisableCallBtn();
- }
+ if(status != STATUS_JOINING && status != STATUS_LEFT_CHANNEL)
+ {
+ enableDisableCallBtn();
+ }
}
void LLFloaterIMSession::onVoiceChannelStateChanged(
- const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
+ const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
{
- bool callIsActive = new_state >= LLVoiceChannel::STATE_CALL_STARTED;
- updateCallBtnState(callIsActive);
+ bool callIsActive = new_state >= LLVoiceChannel::STATE_CALL_STARTED;
+ updateCallBtnState(callIsActive);
}
void LLFloaterIMSession::updateSessionName(const std::string& name)
{
- if (!name.empty())
- {
- LLFloaterIMSessionTab::updateSessionName(name);
- mTypingStart.setArg("[NAME]", name);
- setTitle (mOtherTyping ? mTypingStart.getString() : name);
- mSessionNameUpdatedForTyping = mOtherTyping;
- }
+ if (!name.empty())
+ {
+ LLFloaterIMSessionTab::updateSessionName(name);
+ mTypingStart.setArg("[NAME]", name);
+ setTitle (mOtherTyping ? mTypingStart.getString() : name);
+ mSessionNameUpdatedForTyping = mOtherTyping;
+ }
}
//static
LLFloaterIMSession* LLFloaterIMSession::show(const LLUUID& session_id)
{
- closeHiddenIMToasts();
+ closeHiddenIMToasts();
- if (!gIMMgr->hasSession(session_id))
- return NULL;
+ if (!gIMMgr->hasSession(session_id))
+ return NULL;
- // Test the existence of the floater before we try to create it
- bool exist = findInstance(session_id);
+ // Test the existence of the floater before we try to create it
+ bool exist = findInstance(session_id);
- // Get the floater: this will create the instance if it didn't exist
- LLFloaterIMSession* floater = getInstance(session_id);
- if (!floater)
- return NULL;
+ // Get the floater: this will create the instance if it didn't exist
+ LLFloaterIMSession* floater = getInstance(session_id);
+ if (!floater)
+ return NULL;
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- // Do not add again existing floaters
- if (!exist)
- {
- // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END;
- // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists
- LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END;
- if (floater_container)
- {
- floater_container->addFloater(floater, TRUE, i_pt);
- }
- }
+ // Do not add again existing floaters
+ if (!exist)
+ {
+ // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END;
+ // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists
+ LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END;
+ if (floater_container)
+ {
+ floater_container->addFloater(floater, TRUE, i_pt);
+ }
+ }
- floater->openFloater(floater->getKey());
+ floater->openFloater(floater->getKey());
- floater->setVisible(TRUE);
+ floater->setVisible(TRUE);
- return floater;
+ return floater;
}
//static
LLFloaterIMSession* LLFloaterIMSession::findInstance(const LLUUID& session_id)
{
LLFloaterIMSession* conversation =
- LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id);
+ LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id);
- return conversation;
+ return conversation;
}
LLFloaterIMSession* LLFloaterIMSession::getInstance(const LLUUID& session_id)
{
- LLFloaterIMSession* conversation =
- LLFloaterReg::getTypedInstance<LLFloaterIMSession>("impanel", session_id);
+ LLFloaterIMSession* conversation =
+ LLFloaterReg::getTypedInstance<LLFloaterIMSession>("impanel", session_id);
- return conversation;
+ return conversation;
}
void LLFloaterIMSession::onClose(bool app_quitting)
{
- setTyping(false);
-
- // The source of much argument and design thrashing
- // Should the window hide or the session close when the X is clicked?
- //
- // Last change:
- // EXT-3516 X Button should end IM session, _ button should hide
- gIMMgr->leaveSession(mSessionID);
+ setTyping(false);
+
+ // The source of much argument and design thrashing
+ // Should the window hide or the session close when the X is clicked?
+ //
+ // Last change:
+ // EXT-3516 X Button should end IM session, _ button should hide
+ gIMMgr->leaveSession(mSessionID);
// *TODO: Study why we need to restore the floater before we close it.
// Might be because we want to save some state data in some clean open state.
- LLFloaterIMSessionTab::restoreFloater();
- // Clean up the conversation *after* the session has been ended
- LLFloaterIMSessionTab::onClose(app_quitting);
+ LLFloaterIMSessionTab::restoreFloater();
+ // Clean up the conversation *after* the session has been ended
+ LLFloaterIMSessionTab::onClose(app_quitting);
}
void LLFloaterIMSession::setDocked(bool docked, bool pop_on_undock)
{
- // update notification channel state
- LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
- (LLNotificationsUI::LLChannelManager::getInstance()->
- findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
-
- if(!isChatMultiTab())
- {
- LLTransientDockableFloater::setDocked(docked, pop_on_undock);
- }
-
- // update notification channel state
- if(channel)
- {
- channel->updateShowToastsState();
- channel->redrawToasts();
- }
+ // update notification channel state
+ LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
+ (LLNotificationsUI::LLChannelManager::getInstance()->
+ findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
+
+ if(!isChatMultiTab())
+ {
+ LLTransientDockableFloater::setDocked(docked, pop_on_undock);
+ }
+
+ // update notification channel state
+ if(channel)
+ {
+ channel->updateShowToastsState();
+ channel->redrawToasts();
+ }
}
void LLFloaterIMSession::setMinimized(BOOL b)
{
- bool wasMinimized = isMinimized();
- LLFloaterIMSessionTab::setMinimized(b);
-
- //Switching from minimized state to un-minimized state
- if(wasMinimized && !b)
- {
- //When in DND mode, remove stored IM notifications
- //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
- if(gAgent.isDoNotDisturb())
- {
- LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSessionID);
- }
- }
+ bool wasMinimized = isMinimized();
+ LLFloaterIMSessionTab::setMinimized(b);
+
+ //Switching from minimized state to un-minimized state
+ if(wasMinimized && !b)
+ {
+ //When in DND mode, remove stored IM notifications
+ //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
+ if(gAgent.isDoNotDisturb())
+ {
+ LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSessionID);
+ }
+ }
}
void LLFloaterIMSession::setVisible(BOOL visible)
{
- LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
- (LLNotificationsUI::LLChannelManager::getInstance()->
- findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
-
- LLFloaterIMSessionTab::setVisible(visible);
-
- // update notification channel state
- if(channel)
- {
- channel->updateShowToastsState();
- channel->redrawToasts();
- }
-
- if(!visible)
- {
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(mSessionID);
- if(NULL != chicletp)
- {
- chicletp->setToggleState(false);
- }
- }
- }
-
- if (visible && isInVisibleChain())
- {
- sIMFloaterShowedSignal(mSessionID);
+ LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
+ (LLNotificationsUI::LLChannelManager::getInstance()->
+ findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
+
+ LLFloaterIMSessionTab::setVisible(visible);
+
+ // update notification channel state
+ if(channel)
+ {
+ channel->updateShowToastsState();
+ channel->redrawToasts();
+ }
+
+ if(!visible)
+ {
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(mSessionID);
+ if(NULL != chicletp)
+ {
+ chicletp->setToggleState(false);
+ }
+ }
+ }
+
+ if (visible && isInVisibleChain())
+ {
+ sIMFloaterShowedSignal(mSessionID);
updateMessages();
- }
+ }
}
BOOL LLFloaterIMSession::getVisible()
{
- bool visible;
-
- if(isChatMultiTab())
- {
- LLFloaterIMContainer* im_container =
- LLFloaterIMContainer::getInstance();
-
- // Treat inactive floater as invisible.
- bool is_active = im_container->getActiveFloater() == this;
-
- //torn off floater is always inactive
- if (!is_active && getHost() != im_container)
- {
- visible = LLTransientDockableFloater::getVisible();
- }
- else
- {
- // getVisible() returns TRUE when Tabbed IM window is minimized.
- visible = is_active && !im_container->isMinimized()
- && im_container->getVisible();
- }
- }
- else
- {
- visible = LLTransientDockableFloater::getVisible();
- }
-
- return visible;
+ bool visible;
+
+ if(isChatMultiTab())
+ {
+ LLFloaterIMContainer* im_container =
+ LLFloaterIMContainer::getInstance();
+
+ // Treat inactive floater as invisible.
+ bool is_active = im_container->getActiveFloater() == this;
+
+ //torn off floater is always inactive
+ if (!is_active && getHost() != im_container)
+ {
+ visible = LLTransientDockableFloater::getVisible();
+ }
+ else
+ {
+ // getVisible() returns TRUE when Tabbed IM window is minimized.
+ visible = is_active && !im_container->isMinimized()
+ && im_container->getVisible();
+ }
+ }
+ else
+ {
+ visible = LLTransientDockableFloater::getVisible();
+ }
+
+ return visible;
}
void LLFloaterIMSession::setFocus(BOOL focus)
{
- LLFloaterIMSessionTab::setFocus(focus);
-
- //When in DND mode, remove stored IM notifications
- //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
- if(focus && gAgent.isDoNotDisturb())
- {
- LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSessionID);
- }
+ LLFloaterIMSessionTab::setFocus(focus);
+
+ //When in DND mode, remove stored IM notifications
+ //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
+ if(focus && gAgent.isDoNotDisturb())
+ {
+ LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, mSessionID);
+ }
}
//static
bool LLFloaterIMSession::toggle(const LLUUID& session_id)
{
- if(!isChatMultiTab())
- {
- LLFloaterIMSession* floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>(
- "impanel", session_id);
- if (floater && floater->getVisible() && floater->hasFocus())
- {
- // clicking on chiclet to close floater just hides it to maintain existing
- // scroll/text entry state
- floater->setVisible(false);
- return false;
- }
- else if(floater && ((!floater->isDocked() || floater->getVisible()) && !floater->hasFocus()))
- {
- floater->setVisible(TRUE);
- floater->setFocus(TRUE);
- return true;
- }
- }
-
- // ensure the list of messages is updated when floater is made visible
- show(session_id);
- return true;
+ if(!isChatMultiTab())
+ {
+ LLFloaterIMSession* floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>(
+ "impanel", session_id);
+ if (floater && floater->getVisible() && floater->hasFocus())
+ {
+ // clicking on chiclet to close floater just hides it to maintain existing
+ // scroll/text entry state
+ floater->setVisible(false);
+ return false;
+ }
+ else if(floater && ((!floater->isDocked() || floater->getVisible()) && !floater->hasFocus()))
+ {
+ floater->setVisible(TRUE);
+ floater->setFocus(TRUE);
+ return true;
+ }
+ }
+
+ // ensure the list of messages is updated when floater is made visible
+ show(session_id);
+ return true;
}
void LLFloaterIMSession::sessionInitReplyReceived(const LLUUID& im_session_id)
{
- mSessionInitialized = true;
-
- //will be different only for an ad-hoc im session
- if (mSessionID != im_session_id)
- {
- initIMSession(im_session_id);
- buildConversationViewParticipant();
- }
-
- initIMFloater();
- LLFloaterIMSessionTab::updateGearBtn();
- //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB)
-
- //need to send delayed messages collected while waiting for session initialization
- if (mQueuedMsgsForInit.size())
- {
- LLSD::array_iterator iter;
- for ( iter = mQueuedMsgsForInit.beginArray();
- iter != mQueuedMsgsForInit.endArray(); ++iter)
- {
- LLIMModel::sendMessage(iter->asString(), mSessionID,
- mOtherParticipantUUID, mDialog);
- }
-
- mQueuedMsgsForInit.clear();
- }
+ mSessionInitialized = true;
+
+ //will be different only for an ad-hoc im session
+ if (mSessionID != im_session_id)
+ {
+ initIMSession(im_session_id);
+ buildConversationViewParticipant();
+ }
+
+ initIMFloater();
+ LLFloaterIMSessionTab::updateGearBtn();
+ //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB)
+
+ //need to send delayed messages collected while waiting for session initialization
+ if (mQueuedMsgsForInit.size())
+ {
+ LLSD::array_iterator iter;
+ for ( iter = mQueuedMsgsForInit.beginArray();
+ iter != mQueuedMsgsForInit.endArray(); ++iter)
+ {
+ LLIMModel::sendMessage(iter->asString(), mSessionID,
+ mOtherParticipantUUID, mDialog);
+ }
+
+ mQueuedMsgsForInit.clear();
+ }
}
void LLFloaterIMSession::updateMessages()
{
- std::list<LLSD> messages;
+ std::list<LLSD> messages;
- // we shouldn't reset unread message counters if IM floater doesn't have focus
+ // we shouldn't reset unread message counters if IM floater doesn't have focus
LLIMModel::instance().getMessages(
- mSessionID, messages, mLastMessageIndex + 1, hasFocus());
-
- if (messages.size())
- {
- std::ostringstream message;
- std::list<LLSD>::const_reverse_iterator iter = messages.rbegin();
- std::list<LLSD>::const_reverse_iterator iter_end = messages.rend();
- for (; iter != iter_end; ++iter)
- {
- LLSD msg = *iter;
-
- std::string time = msg["time"].asString();
- LLUUID from_id = msg["from_id"].asUUID();
- std::string from = msg["from"].asString();
- std::string message = msg["message"].asString();
- bool is_history = msg["is_history"].asBoolean();
- bool is_region_msg = msg["is_region_msg"].asBoolean();
-
- LLChat chat;
- chat.mFromID = from_id;
- chat.mSessionID = mSessionID;
- chat.mFromName = from;
- chat.mTimeStr = time;
- chat.mChatStyle = is_history ? CHAT_STYLE_HISTORY : chat.mChatStyle;
+ mSessionID, messages, mLastMessageIndex + 1, hasFocus());
+
+ if (messages.size())
+ {
+ std::ostringstream message;
+ std::list<LLSD>::const_reverse_iterator iter = messages.rbegin();
+ std::list<LLSD>::const_reverse_iterator iter_end = messages.rend();
+ for (; iter != iter_end; ++iter)
+ {
+ LLSD msg = *iter;
+
+ std::string time = msg["time"].asString();
+ LLUUID from_id = msg["from_id"].asUUID();
+ std::string from = msg["from"].asString();
+ std::string message = msg["message"].asString();
+ bool is_history = msg["is_history"].asBoolean();
+ bool is_region_msg = msg["is_region_msg"].asBoolean();
+
+ LLChat chat;
+ chat.mFromID = from_id;
+ chat.mSessionID = mSessionID;
+ chat.mFromName = from;
+ chat.mTimeStr = time;
+ chat.mChatStyle = is_history ? CHAT_STYLE_HISTORY : chat.mChatStyle;
if (is_region_msg)
{
chat.mSourceType = CHAT_SOURCE_REGION;
}
- // process offer notification
- if (msg.has("notification_id"))
- {
- chat.mNotifId = msg["notification_id"].asUUID();
- // if notification exists - embed it
- if (LLNotificationsUtil::find(chat.mNotifId) != NULL)
- {
- // remove embedded notification from channel
- LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
- (LLNotificationsUI::LLChannelManager::getInstance()->
- findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
- if (getVisible())
- {
- // toast will be automatically closed since it is not storable toast
- channel->hideToast(chat.mNotifId);
- }
- }
- // if notification doesn't exist - try to use next message which should be log entry
- else
- {
- continue;
- }
- }
- //process text message
- else
- {
- chat.mText = message;
- }
-
- // Add the message to the chat log
- appendMessage(chat);
- mLastMessageIndex = msg["index"].asInteger();
-
- // if it is a notification - next message is a notification history log, so skip it
- if (chat.mNotifId.notNull() && LLNotificationsUtil::find(chat.mNotifId) != NULL)
- {
- if (++iter == iter_end)
- {
- break;
- }
- else
- {
- mLastMessageIndex++;
- }
- }
- }
- }
+ // process offer notification
+ if (msg.has("notification_id"))
+ {
+ chat.mNotifId = msg["notification_id"].asUUID();
+ // if notification exists - embed it
+ if (LLNotificationsUtil::find(chat.mNotifId) != NULL)
+ {
+ // remove embedded notification from channel
+ LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
+ (LLNotificationsUI::LLChannelManager::getInstance()->
+ findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
+ if (getVisible())
+ {
+ // toast will be automatically closed since it is not storable toast
+ channel->hideToast(chat.mNotifId);
+ }
+ }
+ // if notification doesn't exist - try to use next message which should be log entry
+ else
+ {
+ continue;
+ }
+ }
+ //process text message
+ else
+ {
+ chat.mText = message;
+ }
+
+ // Add the message to the chat log
+ appendMessage(chat);
+ mLastMessageIndex = msg["index"].asInteger();
+
+ // if it is a notification - next message is a notification history log, so skip it
+ if (chat.mNotifId.notNull() && LLNotificationsUtil::find(chat.mNotifId) != NULL)
+ {
+ if (++iter == iter_end)
+ {
+ break;
+ }
+ else
+ {
+ mLastMessageIndex++;
+ }
+ }
+ }
+ }
}
void LLFloaterIMSession::reloadMessages(bool clean_messages/* = false*/)
{
- if (clean_messages)
- {
- LLIMModel::LLIMSession * sessionp = LLIMModel::instance().findIMSession(mSessionID);
-
- if (NULL != sessionp)
- {
- sessionp->loadHistory();
- }
- }
-
- mChatHistory->clear();
- mLastMessageIndex = -1;
- updateMessages();
- mInputEditor->setFont(LLViewerChat::getChatFont());
+ if (clean_messages)
+ {
+ LLIMModel::LLIMSession * sessionp = LLIMModel::instance().findIMSession(mSessionID);
+
+ if (NULL != sessionp)
+ {
+ sessionp->loadHistory();
+ }
+ }
+
+ mChatHistory->clear();
+ mLastMessageIndex = -1;
+ updateMessages();
+ mInputEditor->setFont(LLViewerChat::getChatFont());
}
// static
void LLFloaterIMSession::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata )
{
- LLFloaterIMSession* self= (LLFloaterIMSession*) userdata;
-
- // Allow enabling the LLFloaterIMSession input editor only if session can accept text
- LLIMModel::LLIMSession* im_session =
- LLIMModel::instance().findIMSession(self->mSessionID);
- if( im_session && im_session->mTextIMPossible && !self->mInputEditor->getReadOnly())
- {
- //in disconnected state IM input editor should be disabled
- self->mInputEditor->setEnabled(!gDisconnected);
- }
+ LLFloaterIMSession* self= (LLFloaterIMSession*) userdata;
+
+ // Allow enabling the LLFloaterIMSession input editor only if session can accept text
+ LLIMModel::LLIMSession* im_session =
+ LLIMModel::instance().findIMSession(self->mSessionID);
+ if( im_session && im_session->mTextIMPossible && !self->mInputEditor->getReadOnly())
+ {
+ //in disconnected state IM input editor should be disabled
+ self->mInputEditor->setEnabled(!gDisconnected);
+ }
}
// static
void LLFloaterIMSession::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata)
{
- LLFloaterIMSession* self = (LLFloaterIMSession*) userdata;
- self->setTyping(false);
+ LLFloaterIMSession* self = (LLFloaterIMSession*) userdata;
+ self->setTyping(false);
}
// static
void LLFloaterIMSession::onInputEditorKeystroke(LLTextEditor* caller, void* userdata)
{
- LLFloaterIMSession* self = (LLFloaterIMSession*)userdata;
- LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
- if (im_box)
- {
- im_box->flashConversationItemWidget(self->mSessionID,false);
- }
- std::string text = self->mInputEditor->getText();
-
- // Deleting all text counts as stopping typing.
- self->setTyping(!text.empty());
+ LLFloaterIMSession* self = (LLFloaterIMSession*)userdata;
+ LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
+ if (im_box)
+ {
+ im_box->flashConversationItemWidget(self->mSessionID,false);
+ }
+ std::string text = self->mInputEditor->getText();
+
+ // Deleting all text counts as stopping typing.
+ self->setTyping(!text.empty());
}
void LLFloaterIMSession::setTyping(bool typing)
{
- if ( typing )
- {
- // Started or proceeded typing, reset the typing timeout timer
- mTypingTimeoutTimer.reset();
- }
-
- if ( mMeTyping != typing )
- {
- // Typing state is changed
- mMeTyping = typing;
- // So, should send current state
- mShouldSendTypingState = true;
- // In case typing is started, send state after some delay
- mTypingTimer.reset();
- }
-
- // Don't want to send typing indicators to multiple people, potentially too
- // much network traffic. Only send in person-to-person IMs.
- if ( mShouldSendTypingState && mDialog == IM_NOTHING_SPECIAL )
- {
- if ( mMeTyping )
- {
- if ( mTypingTimer.getElapsedTimeF32() > 1.f )
- {
- // Still typing, send 'start typing' notification
- LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE);
- mShouldSendTypingState = false;
- mMeTypingTimer.reset();
- }
- }
- else
- {
- // Send 'stop typing' notification immediately
- LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, FALSE);
- mShouldSendTypingState = false;
- }
- }
-
- if (!mIsNearbyChat)
- {
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (speaker_mgr)
- {
- speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE);
- }
- }
+ if ( typing )
+ {
+ // Started or proceeded typing, reset the typing timeout timer
+ mTypingTimeoutTimer.reset();
+ }
+
+ if ( mMeTyping != typing )
+ {
+ // Typing state is changed
+ mMeTyping = typing;
+ // So, should send current state
+ mShouldSendTypingState = true;
+ // In case typing is started, send state after some delay
+ mTypingTimer.reset();
+ }
+
+ // Don't want to send typing indicators to multiple people, potentially too
+ // much network traffic. Only send in person-to-person IMs.
+ if ( mShouldSendTypingState && mDialog == IM_NOTHING_SPECIAL )
+ {
+ if ( mMeTyping )
+ {
+ if ( mTypingTimer.getElapsedTimeF32() > 1.f )
+ {
+ // Still typing, send 'start typing' notification
+ LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE);
+ mShouldSendTypingState = false;
+ mMeTypingTimer.reset();
+ }
+ }
+ else
+ {
+ // Send 'stop typing' notification immediately
+ LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, FALSE);
+ mShouldSendTypingState = false;
+ }
+ }
+
+ if (!mIsNearbyChat)
+ {
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (speaker_mgr)
+ {
+ speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE);
+ }
+ }
}
void LLFloaterIMSession::processIMTyping(const LLUUID& from_id, BOOL typing)
{
- LL_DEBUGS("TypingMsgs") << "typing=" << typing << LL_ENDL;
- if ( typing )
- {
- // other user started typing
- addTypingIndicator(from_id);
- mOtherTypingTimer.reset();
- }
- else
- {
- // other user stopped typing
- removeTypingIndicator(from_id);
- }
+ LL_DEBUGS("TypingMsgs") << "typing=" << typing << LL_ENDL;
+ if ( typing )
+ {
+ // other user started typing
+ addTypingIndicator(from_id);
+ mOtherTypingTimer.reset();
+ }
+ else
+ {
+ // other user stopped typing
+ removeTypingIndicator(from_id);
+ }
}
void LLFloaterIMSession::processAgentListUpdates(const LLSD& body)
{
- uuid_vec_t joined_uuids;
-
- if (body.isMap() && body.has("agent_updates") && body["agent_updates"].isMap())
- {
- LLSD::map_const_iterator update_it;
- for(update_it = body["agent_updates"].beginMap();
- update_it != body["agent_updates"].endMap();
- ++update_it)
- {
- LLUUID agent_id(update_it->first);
- LLSD agent_data = update_it->second;
-
- if (agent_data.isMap())
- {
- // store the new participants in joined_uuids
- if (agent_data.has("transition") && agent_data["transition"].asString() == "ENTER")
- {
- joined_uuids.push_back(agent_id);
- }
-
- // process the moderator mutes
- if (agent_id == gAgentID && agent_data.has("info") && agent_data["info"].has("mutes"))
- {
- BOOL moderator_muted_text = agent_data["info"]["mutes"]["text"].asBoolean();
- mInputEditor->setEnabled(!moderator_muted_text);
- std::string label;
- if (moderator_muted_text)
- label = LLTrans::getString("IM_muted_text_label");
- else
- label = LLTrans::getString("IM_to_label") + " " + LLIMModel::instance().getName(mSessionID);
- mInputEditor->setLabel(label);
-
- if (moderator_muted_text)
- LLNotificationsUtil::add("TextChatIsMutedByModerator");
- }
- }
- }
- }
-
- // the vectors need to be sorted for computing the intersection and difference
- std::sort(mInvitedParticipants.begin(), mInvitedParticipants.end());
+ uuid_vec_t joined_uuids;
+
+ if (body.isMap() && body.has("agent_updates") && body["agent_updates"].isMap())
+ {
+ LLSD::map_const_iterator update_it;
+ for(update_it = body["agent_updates"].beginMap();
+ update_it != body["agent_updates"].endMap();
+ ++update_it)
+ {
+ LLUUID agent_id(update_it->first);
+ LLSD agent_data = update_it->second;
+
+ if (agent_data.isMap())
+ {
+ // store the new participants in joined_uuids
+ if (agent_data.has("transition") && agent_data["transition"].asString() == "ENTER")
+ {
+ joined_uuids.push_back(agent_id);
+ }
+
+ // process the moderator mutes
+ if (agent_id == gAgentID && agent_data.has("info") && agent_data["info"].has("mutes"))
+ {
+ BOOL moderator_muted_text = agent_data["info"]["mutes"]["text"].asBoolean();
+ mInputEditor->setEnabled(!moderator_muted_text);
+ std::string label;
+ if (moderator_muted_text)
+ label = LLTrans::getString("IM_muted_text_label");
+ else
+ label = LLTrans::getString("IM_to_label") + " " + LLIMModel::instance().getName(mSessionID);
+ mInputEditor->setLabel(label);
+
+ if (moderator_muted_text)
+ LLNotificationsUtil::add("TextChatIsMutedByModerator");
+ }
+ }
+ }
+ }
+
+ // the vectors need to be sorted for computing the intersection and difference
+ std::sort(mInvitedParticipants.begin(), mInvitedParticipants.end());
std::sort(joined_uuids.begin(), joined_uuids.end());
uuid_vec_t intersection; // uuids of invited residents who have joined the conversation
- std::set_intersection(mInvitedParticipants.begin(), mInvitedParticipants.end(),
- joined_uuids.begin(), joined_uuids.end(),
- std::back_inserter(intersection));
-
- if (intersection.size() > 0)
- {
- sendParticipantsAddedNotification(intersection);
- }
-
- // Remove all joined participants from invited array.
- // The difference between the two vectors (the elements in mInvitedParticipants which are not in joined_uuids)
- // is placed at the beginning of mInvitedParticipants, then all other elements are erased.
- mInvitedParticipants.erase(std::set_difference(mInvitedParticipants.begin(), mInvitedParticipants.end(),
- joined_uuids.begin(), joined_uuids.end(),
- mInvitedParticipants.begin()),
- mInvitedParticipants.end());
+ std::set_intersection(mInvitedParticipants.begin(), mInvitedParticipants.end(),
+ joined_uuids.begin(), joined_uuids.end(),
+ std::back_inserter(intersection));
+
+ if (intersection.size() > 0)
+ {
+ sendParticipantsAddedNotification(intersection);
+ }
+
+ // Remove all joined participants from invited array.
+ // The difference between the two vectors (the elements in mInvitedParticipants which are not in joined_uuids)
+ // is placed at the beginning of mInvitedParticipants, then all other elements are erased.
+ mInvitedParticipants.erase(std::set_difference(mInvitedParticipants.begin(), mInvitedParticipants.end(),
+ joined_uuids.begin(), joined_uuids.end(),
+ mInvitedParticipants.begin()),
+ mInvitedParticipants.end());
}
void LLFloaterIMSession::processSessionUpdate(const LLSD& session_update)
{
- // *TODO : verify following code when moderated mode will be implemented
- if ( false && session_update.has("moderated_mode") &&
- session_update["moderated_mode"].has("voice") )
- {
- BOOL voice_moderated = session_update["moderated_mode"]["voice"];
- const std::string session_label = LLIMModel::instance().getName(mSessionID);
-
- if (voice_moderated)
- {
- setTitle(session_label + std::string(" ")
- + LLTrans::getString("IM_moderated_chat_label"));
- }
- else
- {
- setTitle(session_label);
- }
-
- // *TODO : uncomment this when/if LLPanelActiveSpeakers panel will be added
- //update the speakers dropdown too
- //mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated);
- }
+ // *TODO : verify following code when moderated mode will be implemented
+ if ( false && session_update.has("moderated_mode") &&
+ session_update["moderated_mode"].has("voice") )
+ {
+ BOOL voice_moderated = session_update["moderated_mode"]["voice"];
+ const std::string session_label = LLIMModel::instance().getName(mSessionID);
+
+ if (voice_moderated)
+ {
+ setTitle(session_label + std::string(" ")
+ + LLTrans::getString("IM_moderated_chat_label"));
+ }
+ else
+ {
+ setTitle(session_label);
+ }
+
+ // *TODO : uncomment this when/if LLPanelActiveSpeakers panel will be added
+ //update the speakers dropdown too
+ //mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated);
+ }
}
// virtual
void LLFloaterIMSession::draw()
{
- // add people who were added via dropPerson()
- if (!mPendingParticipants.empty())
- {
- addSessionParticipants(mPendingParticipants);
- mPendingParticipants.clear();
- }
-
- LLFloaterIMSessionTab::draw();
+ // add people who were added via dropPerson()
+ if (!mPendingParticipants.empty())
+ {
+ addSessionParticipants(mPendingParticipants);
+ mPendingParticipants.clear();
+ }
+
+ LLFloaterIMSessionTab::draw();
}
// virtual
BOOL LLFloaterIMSession::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
{
- if (cargo_type == DAD_PERSON)
- {
- if (dropPerson(static_cast<LLUUID*>(cargo_data), drop))
- {
- *accept = ACCEPT_YES_MULTI;
- }
- else
- {
- *accept = ACCEPT_NO;
- }
- }
- else if (mDialog == IM_NOTHING_SPECIAL)
- {
- LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop,
- cargo_type, cargo_data, accept);
- }
-
- return TRUE;
+ if (cargo_type == DAD_PERSON)
+ {
+ if (dropPerson(static_cast<LLUUID*>(cargo_data), drop))
+ {
+ *accept = ACCEPT_YES_MULTI;
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ }
+ }
+ else if (mDialog == IM_NOTHING_SPECIAL)
+ {
+ LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop,
+ cargo_type, cargo_data, accept);
+ }
+
+ return TRUE;
}
bool LLFloaterIMSession::dropPerson(LLUUID* person_id, bool drop)
{
- bool res = person_id && person_id->notNull();
- if(res)
- {
- uuid_vec_t ids;
- ids.push_back(*person_id);
-
- res = canAddSelectedToChat(ids);
- if(res && drop)
- {
- // these people will be added during the next draw() call
- // (so they can be added all at once)
- mPendingParticipants.push_back(*person_id);
- }
- }
-
- return res;
+ bool res = person_id && person_id->notNull();
+ if(res)
+ {
+ uuid_vec_t ids;
+ ids.push_back(*person_id);
+
+ res = canAddSelectedToChat(ids);
+ if(res && drop)
+ {
+ // these people will be added during the next draw() call
+ // (so they can be added all at once)
+ mPendingParticipants.push_back(*person_id);
+ }
+ }
+
+ return res;
}
BOOL LLFloaterIMSession::isInviteAllowed() const
{
- return ( (IM_SESSION_CONFERENCE_START == mDialog)
- || (IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID))
- || mIsP2PChat);
+ return ( (IM_SESSION_CONFERENCE_START == mDialog)
+ || (IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID))
+ || mIsP2PChat);
}
BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids)
{
- LLViewerRegion* region = gAgent.getRegion();
- bool is_region_exist = region != NULL;
+ LLViewerRegion* region = gAgent.getRegion();
+ bool is_region_exist = region != NULL;
- if (is_region_exist)
- {
- S32 count = ids.size();
+ if (is_region_exist)
+ {
+ S32 count = ids.size();
- if( isInviteAllowed() && (count > 0) )
- {
- LL_INFOS() << "LLFloaterIMSession::inviteToSession() - inviting participants" << LL_ENDL;
+ if( isInviteAllowed() && (count > 0) )
+ {
+ LL_INFOS() << "LLFloaterIMSession::inviteToSession() - inviting participants" << LL_ENDL;
- std::string url = region->getCapability("ChatSessionRequest");
+ std::string url = region->getCapability("ChatSessionRequest");
- LLSD data;
- data["params"] = LLSD::emptyArray();
- for (int i = 0; i < count; i++)
- {
- data["params"].append(ids[i]);
- }
- data["method"] = "invite";
- data["session-id"] = mSessionID;
+ LLSD data;
+ data["params"] = LLSD::emptyArray();
+ for (int i = 0; i < count; i++)
+ {
+ data["params"].append(ids[i]);
+ }
+ data["method"] = "invite";
+ data["session-id"] = mSessionID;
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data,
"Session invite sent", "Session invite failed");
- }
- else
- {
- LL_INFOS() << "LLFloaterIMSession::inviteToSession -"
- << " no need to invite agents for "
- << mDialog << LL_ENDL;
- // successful add, because everyone that needed to get added
- // was added.
- }
- }
-
- return is_region_exist;
+ }
+ else
+ {
+ LL_INFOS() << "LLFloaterIMSession::inviteToSession -"
+ << " no need to invite agents for "
+ << mDialog << LL_ENDL;
+ // successful add, because everyone that needed to get added
+ // was added.
+ }
+ }
+
+ return is_region_exist;
}
void LLFloaterIMSession::addTypingIndicator(const LLUUID& from_id)
@@ -1252,105 +1252,105 @@ Note: OTHER_TYPING_TIMEOUT must be > ME_TYPING_TIMEOUT for proper operation of t
*/
- // We may have lost a "stop-typing" packet, don't add it twice
- if (from_id.notNull() && !mOtherTyping)
- {
- mOtherTyping = true;
- mOtherTypingTimer.reset();
- // Save im_info so that removeTypingIndicator can be properly called because a timeout has occurred
- mImFromId = from_id;
-
- // Update speaker
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if ( speaker_mgr )
- {
- speaker_mgr->setSpeakerTyping(from_id, TRUE);
- }
- }
+ // We may have lost a "stop-typing" packet, don't add it twice
+ if (from_id.notNull() && !mOtherTyping)
+ {
+ mOtherTyping = true;
+ mOtherTypingTimer.reset();
+ // Save im_info so that removeTypingIndicator can be properly called because a timeout has occurred
+ mImFromId = from_id;
+
+ // Update speaker
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if ( speaker_mgr )
+ {
+ speaker_mgr->setSpeakerTyping(from_id, TRUE);
+ }
+ }
}
void LLFloaterIMSession::removeTypingIndicator(const LLUUID& from_id)
{
- if (mOtherTyping)
- {
- mOtherTyping = false;
-
- if (from_id.notNull())
- {
- // Update speaker
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- if (speaker_mgr)
- {
- speaker_mgr->setSpeakerTyping(from_id, FALSE);
- }
- }
- }
+ if (mOtherTyping)
+ {
+ mOtherTyping = false;
+
+ if (from_id.notNull())
+ {
+ // Update speaker
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ if (speaker_mgr)
+ {
+ speaker_mgr->setSpeakerTyping(from_id, FALSE);
+ }
+ }
+ }
}
// static
void LLFloaterIMSession::closeHiddenIMToasts()
{
- class IMToastMatcher: public LLNotificationsUI::LLScreenChannel::Matcher
- {
- public:
- bool matches(const LLNotificationPtr notification) const
- {
- // "notifytoast" type of notifications is reserved for IM notifications
- return "notifytoast" == notification->getType();
- }
- };
-
- LLNotificationsUI::LLScreenChannel* channel =
- LLNotificationsUI::LLChannelManager::getNotificationScreenChannel();
- if (channel != NULL)
- {
- channel->closeHiddenToasts(IMToastMatcher());
- }
+ class IMToastMatcher: public LLNotificationsUI::LLScreenChannel::Matcher
+ {
+ public:
+ bool matches(const LLNotificationPtr notification) const
+ {
+ // "notifytoast" type of notifications is reserved for IM notifications
+ return "notifytoast" == notification->getType();
+ }
+ };
+
+ LLNotificationsUI::LLScreenChannel* channel =
+ LLNotificationsUI::LLChannelManager::getNotificationScreenChannel();
+ if (channel != NULL)
+ {
+ channel->closeHiddenToasts(IMToastMatcher());
+ }
}
// static
void LLFloaterIMSession::confirmLeaveCallCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- const LLSD& payload = notification["payload"];
- LLUUID session_id = payload["session_id"];
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ const LLSD& payload = notification["payload"];
+ LLUUID session_id = payload["session_id"];
- LLFloater* im_floater = findInstance(session_id);
- if (option == 0 && im_floater != NULL)
- {
- im_floater->closeFloater();
- }
+ LLFloater* im_floater = findInstance(session_id);
+ if (option == 0 && im_floater != NULL)
+ {
+ im_floater->closeFloater();
+ }
- return;
+ return;
}
// static
void LLFloaterIMSession::sRemoveTypingIndicator(const LLSD& data)
{
- LLUUID session_id = data["session_id"];
- if (session_id.isNull())
- return;
+ LLUUID session_id = data["session_id"];
+ if (session_id.isNull())
+ return;
- LLUUID from_id = data["from_id"];
- if (gAgentID == from_id || LLUUID::null == from_id)
- return;
+ LLUUID from_id = data["from_id"];
+ if (gAgentID == from_id || LLUUID::null == from_id)
+ return;
- LLFloaterIMSession* floater = LLFloaterIMSession::findInstance(session_id);
- if (!floater)
- return;
+ LLFloaterIMSession* floater = LLFloaterIMSession::findInstance(session_id);
+ if (!floater)
+ return;
- if (IM_NOTHING_SPECIAL != floater->mDialog)
- return;
+ if (IM_NOTHING_SPECIAL != floater->mDialog)
+ return;
- floater->removeTypingIndicator();
+ floater->removeTypingIndicator();
}
// static
void LLFloaterIMSession::onIMChicletCreated( const LLUUID& session_id )
{
- LLFloaterIMSession::addToHost(session_id);
+ LLFloaterIMSession::addToHost(session_id);
}
boost::signals2::connection LLFloaterIMSession::setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb)
{
- return LLFloaterIMSession::sIMFloaterShowedSignal.connect(cb);
+ return LLFloaterIMSession::sIMFloaterShowedSignal.connect(cb);
}
diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h
index 28464fc14b..7be68ccfc7 100644
--- a/indra/newview/llfloaterimsession.h
+++ b/indra/newview/llfloaterimsession.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterimsession.h
* @brief LLFloaterIMSession class definition
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,152 +54,152 @@ class LLFloaterIMSession
: public LLVoiceClientStatusObserver
, public LLFloaterIMSessionTab
{
- LOG_CLASS(LLFloaterIMSession);
+ LOG_CLASS(LLFloaterIMSession);
public:
- LLFloaterIMSession(const LLUUID& session_id);
-
- virtual ~LLFloaterIMSession();
-
- void initIMSession(const LLUUID& session_id);
- void initIMFloater();
-
- // LLView overrides
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void setMinimized(BOOL b);
- /*virtual*/ void setVisible(BOOL visible);
- /*virtual*/ BOOL getVisible();
- /*virtual*/ void setFocus(BOOL focus);
- // Check typing timeout timer.
-
- /*virtual*/ void draw();
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
-
- static LLFloaterIMSession* findInstance(const LLUUID& session_id);
- static LLFloaterIMSession* getInstance(const LLUUID& session_id);
-
- // LLFloater overrides
- /*virtual*/ void onClose(bool app_quitting);
- /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
- // Make IM conversion visible and update the message history
- static LLFloaterIMSession* show(const LLUUID& session_id);
-
- // Toggle panel specified by session_id
- // Returns true iff panel became visible
- static bool toggle(const LLUUID& session_id);
-
- void sessionInitReplyReceived(const LLUUID& im_session_id);
-
- // get new messages from LLIMModel
- /*virtual*/ void updateMessages();
- void reloadMessages(bool clean_messages = false);
- static void onSendMsg(LLUICtrl*, void*);
- void sendMsgFromInputEditor();
- void sendMsg(const std::string& msg);
-
- // callback for LLIMModel on new messages
- // route to specific floater if it is visible
- static void newIMCallback(const LLSD& data);
-
- // called when docked floater's position has been set by chiclet
- void setPositioned(bool b) { mPositioned = b; };
-
- void onVisibilityChanged(const LLSD& new_visibility);
- bool enableGearMenuItem(const LLSD& userdata);
- void GearDoToSelected(const LLSD& userdata);
- bool checkGearMenuItem(const LLSD& userdata);
-
- // Implements LLVoiceClientStatusObserver::onChange() to enable the call
- // button when voice is available
- void onChange(EStatusType status, const std::string &channelURI,
- bool proximal);
-
- virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::IM; }
- virtual void onVoiceChannelStateChanged(
- const LLVoiceChannel::EState& old_state,
- const LLVoiceChannel::EState& new_state);
-
- void processIMTyping(const LLUUID& from_id, BOOL typing);
- void processAgentListUpdates(const LLSD& body);
- void processSessionUpdate(const LLSD& session_update);
-
- //used as a callback on receiving new IM message
- static void sRemoveTypingIndicator(const LLSD& data);
- static void onIMChicletCreated(const LLUUID& session_id);
+ LLFloaterIMSession(const LLUUID& session_id);
+
+ virtual ~LLFloaterIMSession();
+
+ void initIMSession(const LLUUID& session_id);
+ void initIMFloater();
+
+ // LLView overrides
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void setMinimized(BOOL b);
+ /*virtual*/ void setVisible(BOOL visible);
+ /*virtual*/ BOOL getVisible();
+ /*virtual*/ void setFocus(BOOL focus);
+ // Check typing timeout timer.
+
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+
+ static LLFloaterIMSession* findInstance(const LLUUID& session_id);
+ static LLFloaterIMSession* getInstance(const LLUUID& session_id);
+
+ // LLFloater overrides
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
+ // Make IM conversion visible and update the message history
+ static LLFloaterIMSession* show(const LLUUID& session_id);
+
+ // Toggle panel specified by session_id
+ // Returns true iff panel became visible
+ static bool toggle(const LLUUID& session_id);
+
+ void sessionInitReplyReceived(const LLUUID& im_session_id);
+
+ // get new messages from LLIMModel
+ /*virtual*/ void updateMessages();
+ void reloadMessages(bool clean_messages = false);
+ static void onSendMsg(LLUICtrl*, void*);
+ void sendMsgFromInputEditor();
+ void sendMsg(const std::string& msg);
+
+ // callback for LLIMModel on new messages
+ // route to specific floater if it is visible
+ static void newIMCallback(const LLSD& data);
+
+ // called when docked floater's position has been set by chiclet
+ void setPositioned(bool b) { mPositioned = b; };
+
+ void onVisibilityChanged(const LLSD& new_visibility);
+ bool enableGearMenuItem(const LLSD& userdata);
+ void GearDoToSelected(const LLSD& userdata);
+ bool checkGearMenuItem(const LLSD& userdata);
+
+ // Implements LLVoiceClientStatusObserver::onChange() to enable the call
+ // button when voice is available
+ void onChange(EStatusType status, const std::string &channelURI,
+ bool proximal);
+
+ virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::IM; }
+ virtual void onVoiceChannelStateChanged(
+ const LLVoiceChannel::EState& old_state,
+ const LLVoiceChannel::EState& new_state);
+
+ void processIMTyping(const LLUUID& from_id, BOOL typing);
+ void processAgentListUpdates(const LLSD& body);
+ void processSessionUpdate(const LLSD& session_update);
+
+ //used as a callback on receiving new IM message
+ static void sRemoveTypingIndicator(const LLSD& data);
+ static void onIMChicletCreated(const LLUUID& session_id);
const LLUUID& getOtherParticipantUUID() {return mOtherParticipantUUID;}
- static boost::signals2::connection setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb);
- static floater_showed_signal_t sIMFloaterShowedSignal;
+ static boost::signals2::connection setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb);
+ static floater_showed_signal_t sIMFloaterShowedSignal;
- bool needsTitleOverwrite() { return mSessionNameUpdatedForTyping && mOtherTyping; }
- S32 getLastChatMessageIndex() {return mLastMessageIndex;}
+ bool needsTitleOverwrite() { return mSessionNameUpdatedForTyping && mOtherTyping; }
+ S32 getLastChatMessageIndex() {return mLastMessageIndex;}
private:
- /*virtual*/ void refresh();
+ /*virtual*/ void refresh();
/*virtual*/ void onTearOffClicked();
- /*virtual*/ void onClickCloseBtn(bool app_qutting);
+ /*virtual*/ void onClickCloseBtn(bool app_qutting);
- // Update the window title and input field help text
- /*virtual*/ void updateSessionName(const std::string& name);
+ // Update the window title and input field help text
+ /*virtual*/ void updateSessionName(const std::string& name);
- bool dropPerson(LLUUID* person_id, bool drop);
+ bool dropPerson(LLUUID* person_id, bool drop);
- BOOL isInviteAllowed() const;
- BOOL inviteToSession(const uuid_vec_t& agent_ids);
- static void onInputEditorFocusReceived( LLFocusableElement* caller,void* userdata );
- static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
- static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata);
- void setTyping(bool typing);
- void onAddButtonClicked();
- void addSessionParticipants(const uuid_vec_t& uuids);
- void addP2PSessionParticipants(const LLSD& notification, const LLSD& response, const uuid_vec_t& uuids);
- void sendParticipantsAddedNotification(const uuid_vec_t& uuids);
- bool canAddSelectedToChat(const uuid_vec_t& uuids);
+ BOOL isInviteAllowed() const;
+ BOOL inviteToSession(const uuid_vec_t& agent_ids);
+ static void onInputEditorFocusReceived( LLFocusableElement* caller,void* userdata );
+ static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
+ static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata);
+ void setTyping(bool typing);
+ void onAddButtonClicked();
+ void addSessionParticipants(const uuid_vec_t& uuids);
+ void addP2PSessionParticipants(const LLSD& notification, const LLSD& response, const uuid_vec_t& uuids);
+ void sendParticipantsAddedNotification(const uuid_vec_t& uuids);
+ bool canAddSelectedToChat(const uuid_vec_t& uuids);
- void onCallButtonClicked();
+ void onCallButtonClicked();
- void boundVoiceChannel();
+ void boundVoiceChannel();
- // Add the "User is typing..." indicator.
- void addTypingIndicator(const LLUUID& from_id);
+ // Add the "User is typing..." indicator.
+ void addTypingIndicator(const LLUUID& from_id);
- // Remove the "User is typing..." indicator.
- void removeTypingIndicator(const LLUUID& from_id = LLUUID::null);
+ // Remove the "User is typing..." indicator.
+ void removeTypingIndicator(const LLUUID& from_id = LLUUID::null);
- static void closeHiddenIMToasts();
+ static void closeHiddenIMToasts();
- static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response);
+ static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response);
- S32 mLastMessageIndex;
+ S32 mLastMessageIndex;
- EInstantMessage mDialog;
- LLUUID mOtherParticipantUUID;
- bool mPositioned;
+ EInstantMessage mDialog;
+ LLUUID mOtherParticipantUUID;
+ bool mPositioned;
- LLUIString mTypingStart;
- bool mMeTyping;
- bool mOtherTyping;
- bool mShouldSendTypingState;
- LLFrameTimer mTypingTimer;
- LLFrameTimer mTypingTimeoutTimer;
- bool mSessionNameUpdatedForTyping;
- LLFrameTimer mMeTypingTimer;
- LLFrameTimer mOtherTypingTimer;
+ LLUIString mTypingStart;
+ bool mMeTyping;
+ bool mOtherTyping;
+ bool mShouldSendTypingState;
+ LLFrameTimer mTypingTimer;
+ LLFrameTimer mTypingTimeoutTimer;
+ bool mSessionNameUpdatedForTyping;
+ LLFrameTimer mMeTypingTimer;
+ LLFrameTimer mOtherTypingTimer;
- bool mSessionInitialized;
- LLSD mQueuedMsgsForInit;
+ bool mSessionInitialized;
+ LLSD mQueuedMsgsForInit;
- uuid_vec_t mInvitedParticipants;
- uuid_vec_t mPendingParticipants;
+ uuid_vec_t mInvitedParticipants;
+ uuid_vec_t mPendingParticipants;
- // connection to voice channel state change signal
- boost::signals2::connection mVoiceChannelStateChangeConnection;
+ // connection to voice channel state change signal
+ boost::signals2::connection mVoiceChannelStateChangeConnection;
- LLUUID mImFromId;
+ LLUUID mImFromId;
};
#endif // LL_FLOATERIMSESSION_H
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index 24cc398f3b..f7cc6c495e 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -59,396 +59,396 @@ void cb_group_do_nothing()
}
LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id)
-: super(NULL, false, session_id),
- mIsP2PChat(false),
- mExpandCollapseBtn(NULL),
- mTearOffBtn(NULL),
- mCloseBtn(NULL),
- mSessionID(session_id.asUUID()),
- mConversationsRoot(NULL),
- mScroller(NULL),
- mChatHistory(NULL),
- mInputEditor(NULL),
- mInputEditorPad(0),
- mRefreshTimer(new LLTimer()),
- mIsHostAttached(false),
- mHasVisibleBeenInitialized(false),
- mIsParticipantListExpanded(true),
- mChatLayoutPanel(NULL),
- mInputPanels(NULL),
- mChatLayoutPanelHeight(0)
+: super(NULL, false, session_id),
+ mIsP2PChat(false),
+ mExpandCollapseBtn(NULL),
+ mTearOffBtn(NULL),
+ mCloseBtn(NULL),
+ mSessionID(session_id.asUUID()),
+ mConversationsRoot(NULL),
+ mScroller(NULL),
+ mChatHistory(NULL),
+ mInputEditor(NULL),
+ mInputEditorPad(0),
+ mRefreshTimer(new LLTimer()),
+ mIsHostAttached(false),
+ mHasVisibleBeenInitialized(false),
+ mIsParticipantListExpanded(true),
+ mChatLayoutPanel(NULL),
+ mInputPanels(NULL),
+ mChatLayoutPanelHeight(0)
{
- setAutoFocus(FALSE);
- mSession = LLIMModel::getInstance()->findIMSession(mSessionID);
-
- mCommitCallbackRegistrar.add("IMSession.Menu.Action",
- boost::bind(&LLFloaterIMSessionTab::onIMSessionMenuItemClicked, this, _2));
- mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem",
- boost::bind(&LLFloaterIMSessionTab::onIMCompactExpandedMenuItemCheck, this, _2));
- mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.CheckItem",
- boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemCheck, this, _2));
- mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable",
- boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemEnable, this, _2));
-
- // Right click menu handling
- mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLFloaterIMSessionTab::checkContextMenuItem, this, _2));
- mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLFloaterIMSessionTab::enableContextMenuItem, this, _2));
- mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLFloaterIMSessionTab::doToSelected, this, _2));
- mCommitCallbackRegistrar.add("Group.DoToSelected", boost::bind(&cb_group_do_nothing));
-
- mMinFloaterHeight = getMinHeight();
+ setAutoFocus(FALSE);
+ mSession = LLIMModel::getInstance()->findIMSession(mSessionID);
+
+ mCommitCallbackRegistrar.add("IMSession.Menu.Action",
+ boost::bind(&LLFloaterIMSessionTab::onIMSessionMenuItemClicked, this, _2));
+ mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem",
+ boost::bind(&LLFloaterIMSessionTab::onIMCompactExpandedMenuItemCheck, this, _2));
+ mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.CheckItem",
+ boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemCheck, this, _2));
+ mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable",
+ boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemEnable, this, _2));
+
+ // Right click menu handling
+ mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLFloaterIMSessionTab::checkContextMenuItem, this, _2));
+ mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLFloaterIMSessionTab::enableContextMenuItem, this, _2));
+ mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLFloaterIMSessionTab::doToSelected, this, _2));
+ mCommitCallbackRegistrar.add("Group.DoToSelected", boost::bind(&cb_group_do_nothing));
+
+ mMinFloaterHeight = getMinHeight();
}
LLFloaterIMSessionTab::~LLFloaterIMSessionTab()
{
- delete mRefreshTimer;
+ delete mRefreshTimer;
}
// static
LLFloaterIMSessionTab* LLFloaterIMSessionTab::findConversation(const LLUUID& uuid)
{
- LLFloaterIMSessionTab* conv;
-
- if (uuid.isNull())
- {
- conv = LLFloaterReg::findTypedInstance<LLFloaterIMSessionTab>("nearby_chat");
- }
- else
- {
- conv = LLFloaterReg::findTypedInstance<LLFloaterIMSessionTab>("impanel", LLSD(uuid));
- }
-
- return conv;
+ LLFloaterIMSessionTab* conv;
+
+ if (uuid.isNull())
+ {
+ conv = LLFloaterReg::findTypedInstance<LLFloaterIMSessionTab>("nearby_chat");
+ }
+ else
+ {
+ conv = LLFloaterReg::findTypedInstance<LLFloaterIMSessionTab>("impanel", LLSD(uuid));
+ }
+
+ return conv;
};
// static
LLFloaterIMSessionTab* LLFloaterIMSessionTab::getConversation(const LLUUID& uuid)
{
- LLFloaterIMSessionTab* conv;
+ LLFloaterIMSessionTab* conv;
- if (uuid.isNull())
- {
- conv = LLFloaterReg::getTypedInstance<LLFloaterIMSessionTab>("nearby_chat");
- }
- else
- {
- conv = LLFloaterReg::getTypedInstance<LLFloaterIMSessionTab>("impanel", LLSD(uuid));
- conv->setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
- }
+ if (uuid.isNull())
+ {
+ conv = LLFloaterReg::getTypedInstance<LLFloaterIMSessionTab>("nearby_chat");
+ }
+ else
+ {
+ conv = LLFloaterReg::getTypedInstance<LLFloaterIMSessionTab>("impanel", LLSD(uuid));
+ conv->setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
+ }
- return conv;
+ return conv;
};
// virtual
void LLFloaterIMSessionTab::setVisible(BOOL visible)
{
- if (visible && !mHasVisibleBeenInitialized)
- {
- mHasVisibleBeenInitialized = true;
- if (!gAgentCamera.cameraMouselook())
- {
- LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")->setVisible(true);
- }
- LLFloaterIMSessionTab::addToHost(mSessionID);
- LLFloaterIMSessionTab* conversp = LLFloaterIMSessionTab::getConversation(mSessionID);
-
- if (conversp && conversp->isNearbyChat() && gSavedPerAccountSettings.getBOOL("NearbyChatIsNotCollapsed"))
- {
- onCollapseToLine(this);
- }
- mInputButtonPanel->setVisible(isTornOff());
- }
-
- super::setVisible(visible);
+ if (visible && !mHasVisibleBeenInitialized)
+ {
+ mHasVisibleBeenInitialized = true;
+ if (!gAgentCamera.cameraMouselook())
+ {
+ LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")->setVisible(true);
+ }
+ LLFloaterIMSessionTab::addToHost(mSessionID);
+ LLFloaterIMSessionTab* conversp = LLFloaterIMSessionTab::getConversation(mSessionID);
+
+ if (conversp && conversp->isNearbyChat() && gSavedPerAccountSettings.getBOOL("NearbyChatIsNotCollapsed"))
+ {
+ onCollapseToLine(this);
+ }
+ mInputButtonPanel->setVisible(isTornOff());
+ }
+
+ super::setVisible(visible);
}
// virtual
void LLFloaterIMSessionTab::setFocus(BOOL focus)
{
- super::setFocus(focus);
-
- // Redirect focus to input editor
- if (focus)
- {
- updateMessages();
-
- if (mInputEditor)
- {
- mInputEditor->setFocus(TRUE);
- }
- }
+ super::setFocus(focus);
+
+ // Redirect focus to input editor
+ if (focus)
+ {
+ updateMessages();
+
+ if (mInputEditor)
+ {
+ mInputEditor->setFocus(TRUE);
+ }
+ }
}
void LLFloaterIMSessionTab::addToHost(const LLUUID& session_id)
{
- if ((session_id.notNull() && !gIMMgr->hasSession(session_id))
- || !LLFloaterIMSessionTab::isChatMultiTab())
- {
- return;
- }
-
- // Get the floater: this will create the instance if it didn't exist
- LLFloaterIMSessionTab* conversp = LLFloaterIMSessionTab::getConversation(session_id);
- if (conversp)
- {
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
-
- // Do not add again existing floaters
- if (floater_container && !conversp->isHostAttached())
- {
- conversp->setHostAttached(true);
-
- if (!conversp->isNearbyChat()
- || gSavedPerAccountSettings.getBOOL("NearbyChatIsNotTornOff"))
- {
- floater_container->addFloater(conversp, false, LLTabContainer::RIGHT_OF_CURRENT);
- }
- else
- {
- // setting of the "potential" host for Nearby Chat: this sequence sets
- // LLFloater::mHostHandle = NULL (a current host), but
- // LLFloater::mLastHostHandle = floater_container (a "future" host)
- conversp->setHost(floater_container);
- conversp->setHost(NULL);
-
- conversp->forceReshape();
- }
- // Added floaters share some state (like sort order) with their host
- conversp->setSortOrder(floater_container->getSortOrder());
- }
- }
+ if ((session_id.notNull() && !gIMMgr->hasSession(session_id))
+ || !LLFloaterIMSessionTab::isChatMultiTab())
+ {
+ return;
+ }
+
+ // Get the floater: this will create the instance if it didn't exist
+ LLFloaterIMSessionTab* conversp = LLFloaterIMSessionTab::getConversation(session_id);
+ if (conversp)
+ {
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+
+ // Do not add again existing floaters
+ if (floater_container && !conversp->isHostAttached())
+ {
+ conversp->setHostAttached(true);
+
+ if (!conversp->isNearbyChat()
+ || gSavedPerAccountSettings.getBOOL("NearbyChatIsNotTornOff"))
+ {
+ floater_container->addFloater(conversp, false, LLTabContainer::RIGHT_OF_CURRENT);
+ }
+ else
+ {
+ // setting of the "potential" host for Nearby Chat: this sequence sets
+ // LLFloater::mHostHandle = NULL (a current host), but
+ // LLFloater::mLastHostHandle = floater_container (a "future" host)
+ conversp->setHost(floater_container);
+ conversp->setHost(NULL);
+
+ conversp->forceReshape();
+ }
+ // Added floaters share some state (like sort order) with their host
+ conversp->setSortOrder(floater_container->getSortOrder());
+ }
+ }
}
void LLFloaterIMSessionTab::assignResizeLimits()
{
- bool is_participants_pane_collapsed = mParticipantListPanel->isCollapsed();
+ bool is_participants_pane_collapsed = mParticipantListPanel->isCollapsed();
- // disable a layoutstack's functionality when participant list panel is collapsed
- mRightPartPanel->setIgnoreReshape(is_participants_pane_collapsed);
+ // disable a layoutstack's functionality when participant list panel is collapsed
+ mRightPartPanel->setIgnoreReshape(is_participants_pane_collapsed);
- S32 participants_pane_target_width = is_participants_pane_collapsed?
- 0 : (mParticipantListPanel->getRect().getWidth() + mParticipantListAndHistoryStack->getPanelSpacing());
+ S32 participants_pane_target_width = is_participants_pane_collapsed?
+ 0 : (mParticipantListPanel->getRect().getWidth() + mParticipantListAndHistoryStack->getPanelSpacing());
- S32 new_min_width = participants_pane_target_width + mRightPartPanel->getExpandedMinDim() + mFloaterExtraWidth;
+ S32 new_min_width = participants_pane_target_width + mRightPartPanel->getExpandedMinDim() + mFloaterExtraWidth;
- setResizeLimits(new_min_width, getMinHeight());
+ setResizeLimits(new_min_width, getMinHeight());
- this->mParticipantListAndHistoryStack->updateLayout();
+ this->mParticipantListAndHistoryStack->updateLayout();
}
// virtual
BOOL LLFloaterIMSessionTab::postBuild()
{
- BOOL result;
-
- mBodyStack = getChild<LLLayoutStack>("main_stack");
- mParticipantListAndHistoryStack = getChild<LLLayoutStack>("im_panels");
-
- mCloseBtn = getChild<LLButton>("close_btn");
- mCloseBtn->setCommitCallback([this](LLUICtrl*, const LLSD&) { onClickClose(this); });
-
- mExpandCollapseBtn = getChild<LLButton>("expand_collapse_btn");
- mExpandCollapseBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onSlide(this); });
-
- mExpandCollapseLineBtn = getChild<LLButton>("minz_btn");
- mExpandCollapseLineBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onCollapseToLine(this); });
-
- mTearOffBtn = getChild<LLButton>("tear_off_btn");
- mTearOffBtn->setCommitCallback(boost::bind(&LLFloaterIMSessionTab::onTearOffClicked, this));
-
- mEmojiRecentPanelToggleBtn = getChild<LLButton>("emoji_recent_panel_toggle_btn");
- mEmojiRecentPanelToggleBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiRecentPanelToggleBtnClicked(); });
-
- mEmojiRecentPanel = getChild<LLLayoutPanel>("emoji_recent_layout_panel");
- mEmojiRecentPanel->setVisible(false);
-
- mEmojiRecentEmptyText = getChild<LLTextBox>("emoji_recent_empty_text");
- mEmojiRecentEmptyText->setToolTip(mEmojiRecentEmptyText->getText());
- mEmojiRecentEmptyText->setVisible(false);
-
- mEmojiRecentIconsCtrl = getChild<LLPanelEmojiComplete>("emoji_recent_icons_ctrl");
- mEmojiRecentIconsCtrl->setCommitCallback([this](LLUICtrl*, const LLSD& value) { onRecentEmojiPicked(value); });
- mEmojiRecentIconsCtrl->setVisible(false);
-
- mEmojiPickerShowBtn = getChild<LLButton>("emoji_picker_show_btn");
- mEmojiPickerShowBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerShowBtnClicked(); });
-
- mGearBtn = getChild<LLButton>("gear_btn");
- mAddBtn = getChild<LLButton>("add_btn");
- mVoiceButton = getChild<LLButton>("voice_call_btn");
-
- mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel");
- mRightPartPanel = getChild<LLLayoutPanel>("right_part_holder");
-
- mToolbarPanel = getChild<LLLayoutPanel>("toolbar_panel");
- mContentPanel = getChild<LLLayoutPanel>("body_panel");
- mInputButtonPanel = getChild<LLLayoutPanel>("input_button_layout_panel");
- mInputButtonPanel->setVisible(false);
- // Add a scroller for the folder (participant) view
- LLRect scroller_view_rect = mParticipantListPanel->getRect();
- scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
- LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams<LLFolderViewScrollContainer>());
- scroller_params.rect(scroller_view_rect);
- mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
- mScroller->setFollowsAll();
-
- // Insert that scroller into the panel widgets hierarchy
- mParticipantListPanel->addChild(mScroller);
-
- mChatHistory = getChild<LLChatHistory>("chat_history");
-
- mInputEditor = getChild<LLChatEntry>("chat_editor");
-
- mChatLayoutPanel = getChild<LLLayoutPanel>("chat_layout_panel");
- mInputPanels = getChild<LLLayoutStack>("input_panels");
-
- mInputEditor->setTextExpandedCallback(boost::bind(&LLFloaterIMSessionTab::reshapeChatLayoutPanel, this));
- mInputEditor->setMouseUpCallback(boost::bind(&LLFloaterIMSessionTab::onInputEditorClicked, this));
- mInputEditor->setCommitOnFocusLost( FALSE );
- mInputEditor->setPassDelete(TRUE);
- mInputEditor->setFont(LLViewerChat::getChatFont());
-
- mChatLayoutPanelHeight = mChatLayoutPanel->getRect().getHeight();
- mInputEditorPad = mChatLayoutPanelHeight - mInputEditor->getRect().getHeight();
-
- setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
-
- mSaveRect = isNearbyChat()
- && !gSavedPerAccountSettings.getBOOL("NearbyChatIsNotTornOff");
- initRectControl();
-
- if (isChatMultiTab())
- {
- result = LLFloater::postBuild();
- }
- else
- {
- result = LLDockableFloater::postBuild();
- }
-
- // Create the root using an ad-hoc base item
- LLConversationItem* base_item = new LLConversationItem(mSessionID, mConversationViewModel);
- LLFolderView::Params p(LLUICtrlFactory::getDefaultParams<LLFolderView>());
- p.rect = LLRect(0, 0, getRect().getWidth(), 0);
- p.parent_panel = mParticipantListPanel;
- p.listener = base_item;
- p.view_model = &mConversationViewModel;
- p.root = NULL;
- p.use_ellipses = true;
- p.options_menu = "menu_conversation.xml";
- p.name = "root";
- mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p);
- mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar);
- mConversationsRoot->setEnableRegistrar(&mEnableCallbackRegistrar);
- // Attach that root to the scroller
- mScroller->addChild(mConversationsRoot);
- mConversationsRoot->setScrollContainer(mScroller);
- mConversationsRoot->setFollowsAll();
- mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox);
-
- setMessagePaneExpanded(true);
-
- buildConversationViewParticipant();
- refreshConversation();
-
- // Zero expiry time is set only once to allow initial update.
- mRefreshTimer->setTimerExpirySec(0);
- mRefreshTimer->start();
- initBtns();
-
- if (mIsParticipantListExpanded != (bool)gSavedSettings.getBOOL("IMShowControlPanel"))
- {
- LLFloaterIMSessionTab::onSlide(this);
- }
-
- // The resize limits for LLFloaterIMSessionTab should be updated, based on current values of width of conversation and message panels
- mParticipantListPanel->getResizeBar()->setResizeListener(boost::bind(&LLFloaterIMSessionTab::assignResizeLimits, this));
- mFloaterExtraWidth =
- getRect().getWidth()
- - mParticipantListAndHistoryStack->getRect().getWidth()
- - (mParticipantListPanel->isCollapsed()? 0 : LLPANEL_BORDER_WIDTH);
-
- assignResizeLimits();
-
- return result;
+ BOOL result;
+
+ mBodyStack = getChild<LLLayoutStack>("main_stack");
+ mParticipantListAndHistoryStack = getChild<LLLayoutStack>("im_panels");
+
+ mCloseBtn = getChild<LLButton>("close_btn");
+ mCloseBtn->setCommitCallback([this](LLUICtrl*, const LLSD&) { onClickClose(this); });
+
+ mExpandCollapseBtn = getChild<LLButton>("expand_collapse_btn");
+ mExpandCollapseBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onSlide(this); });
+
+ mExpandCollapseLineBtn = getChild<LLButton>("minz_btn");
+ mExpandCollapseLineBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onCollapseToLine(this); });
+
+ mTearOffBtn = getChild<LLButton>("tear_off_btn");
+ mTearOffBtn->setCommitCallback(boost::bind(&LLFloaterIMSessionTab::onTearOffClicked, this));
+
+ mEmojiRecentPanelToggleBtn = getChild<LLButton>("emoji_recent_panel_toggle_btn");
+ mEmojiRecentPanelToggleBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiRecentPanelToggleBtnClicked(); });
+
+ mEmojiRecentPanel = getChild<LLLayoutPanel>("emoji_recent_layout_panel");
+ mEmojiRecentPanel->setVisible(false);
+
+ mEmojiRecentEmptyText = getChild<LLTextBox>("emoji_recent_empty_text");
+ mEmojiRecentEmptyText->setToolTip(mEmojiRecentEmptyText->getText());
+ mEmojiRecentEmptyText->setVisible(false);
+
+ mEmojiRecentIconsCtrl = getChild<LLPanelEmojiComplete>("emoji_recent_icons_ctrl");
+ mEmojiRecentIconsCtrl->setCommitCallback([this](LLUICtrl*, const LLSD& value) { onRecentEmojiPicked(value); });
+ mEmojiRecentIconsCtrl->setVisible(false);
+
+ mEmojiPickerShowBtn = getChild<LLButton>("emoji_picker_show_btn");
+ mEmojiPickerShowBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerShowBtnClicked(); });
+
+ mGearBtn = getChild<LLButton>("gear_btn");
+ mAddBtn = getChild<LLButton>("add_btn");
+ mVoiceButton = getChild<LLButton>("voice_call_btn");
+
+ mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel");
+ mRightPartPanel = getChild<LLLayoutPanel>("right_part_holder");
+
+ mToolbarPanel = getChild<LLLayoutPanel>("toolbar_panel");
+ mContentPanel = getChild<LLLayoutPanel>("body_panel");
+ mInputButtonPanel = getChild<LLLayoutPanel>("input_button_layout_panel");
+ mInputButtonPanel->setVisible(false);
+ // Add a scroller for the folder (participant) view
+ LLRect scroller_view_rect = mParticipantListPanel->getRect();
+ scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
+ LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams<LLFolderViewScrollContainer>());
+ scroller_params.rect(scroller_view_rect);
+ mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
+ mScroller->setFollowsAll();
+
+ // Insert that scroller into the panel widgets hierarchy
+ mParticipantListPanel->addChild(mScroller);
+
+ mChatHistory = getChild<LLChatHistory>("chat_history");
+
+ mInputEditor = getChild<LLChatEntry>("chat_editor");
+
+ mChatLayoutPanel = getChild<LLLayoutPanel>("chat_layout_panel");
+ mInputPanels = getChild<LLLayoutStack>("input_panels");
+
+ mInputEditor->setTextExpandedCallback(boost::bind(&LLFloaterIMSessionTab::reshapeChatLayoutPanel, this));
+ mInputEditor->setMouseUpCallback(boost::bind(&LLFloaterIMSessionTab::onInputEditorClicked, this));
+ mInputEditor->setCommitOnFocusLost( FALSE );
+ mInputEditor->setPassDelete(TRUE);
+ mInputEditor->setFont(LLViewerChat::getChatFont());
+
+ mChatLayoutPanelHeight = mChatLayoutPanel->getRect().getHeight();
+ mInputEditorPad = mChatLayoutPanelHeight - mInputEditor->getRect().getHeight();
+
+ setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
+
+ mSaveRect = isNearbyChat()
+ && !gSavedPerAccountSettings.getBOOL("NearbyChatIsNotTornOff");
+ initRectControl();
+
+ if (isChatMultiTab())
+ {
+ result = LLFloater::postBuild();
+ }
+ else
+ {
+ result = LLDockableFloater::postBuild();
+ }
+
+ // Create the root using an ad-hoc base item
+ LLConversationItem* base_item = new LLConversationItem(mSessionID, mConversationViewModel);
+ LLFolderView::Params p(LLUICtrlFactory::getDefaultParams<LLFolderView>());
+ p.rect = LLRect(0, 0, getRect().getWidth(), 0);
+ p.parent_panel = mParticipantListPanel;
+ p.listener = base_item;
+ p.view_model = &mConversationViewModel;
+ p.root = NULL;
+ p.use_ellipses = true;
+ p.options_menu = "menu_conversation.xml";
+ p.name = "root";
+ mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p);
+ mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar);
+ mConversationsRoot->setEnableRegistrar(&mEnableCallbackRegistrar);
+ // Attach that root to the scroller
+ mScroller->addChild(mConversationsRoot);
+ mConversationsRoot->setScrollContainer(mScroller);
+ mConversationsRoot->setFollowsAll();
+ mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox);
+
+ setMessagePaneExpanded(true);
+
+ buildConversationViewParticipant();
+ refreshConversation();
+
+ // Zero expiry time is set only once to allow initial update.
+ mRefreshTimer->setTimerExpirySec(0);
+ mRefreshTimer->start();
+ initBtns();
+
+ if (mIsParticipantListExpanded != (bool)gSavedSettings.getBOOL("IMShowControlPanel"))
+ {
+ LLFloaterIMSessionTab::onSlide(this);
+ }
+
+ // The resize limits for LLFloaterIMSessionTab should be updated, based on current values of width of conversation and message panels
+ mParticipantListPanel->getResizeBar()->setResizeListener(boost::bind(&LLFloaterIMSessionTab::assignResizeLimits, this));
+ mFloaterExtraWidth =
+ getRect().getWidth()
+ - mParticipantListAndHistoryStack->getRect().getWidth()
+ - (mParticipantListPanel->isCollapsed()? 0 : LLPANEL_BORDER_WIDTH);
+
+ assignResizeLimits();
+
+ return result;
}
LLParticipantList* LLFloaterIMSessionTab::getParticipantList()
{
- return dynamic_cast<LLParticipantList*>(LLFloaterIMContainer::getInstance()->getSessionModel(mSessionID));
+ return dynamic_cast<LLParticipantList*>(LLFloaterIMContainer::getInstance()->getSessionModel(mSessionID));
}
// virtual
void LLFloaterIMSessionTab::draw()
{
- if (mRefreshTimer->hasExpired())
- {
- LLParticipantList* item = getParticipantList();
- if (item)
- {
- // Update all model items
- item->update();
- // If the model and view list diverge in count, rebuild
- // Note: this happens sometimes right around init (add participant events fire but get dropped) and is the cause
- // of missing participants, often, the user agent itself. As there will be no other event fired, there's
- // no other choice but get those inconsistencies regularly (and lightly) checked and scrubbed.
- if (item->getChildrenCount() != mConversationsWidgets.size())
- {
- buildConversationViewParticipant();
- }
- refreshConversation();
- }
-
- // Restart the refresh timer
- mRefreshTimer->setTimerExpirySec(REFRESH_INTERVAL);
- }
-
- super::draw();
+ if (mRefreshTimer->hasExpired())
+ {
+ LLParticipantList* item = getParticipantList();
+ if (item)
+ {
+ // Update all model items
+ item->update();
+ // If the model and view list diverge in count, rebuild
+ // Note: this happens sometimes right around init (add participant events fire but get dropped) and is the cause
+ // of missing participants, often, the user agent itself. As there will be no other event fired, there's
+ // no other choice but get those inconsistencies regularly (and lightly) checked and scrubbed.
+ if (item->getChildrenCount() != mConversationsWidgets.size())
+ {
+ buildConversationViewParticipant();
+ }
+ refreshConversation();
+ }
+
+ // Restart the refresh timer
+ mRefreshTimer->setTimerExpirySec(REFRESH_INTERVAL);
+ }
+
+ super::draw();
}
void LLFloaterIMSessionTab::enableDisableCallBtn()
{
- if (LLVoiceClient::instanceExists() && mVoiceButton)
- {
- mVoiceButton->setEnabled(
- mSessionID.notNull()
- && mSession
- && mSession->mSessionInitialized
- && LLVoiceClient::getInstance()->voiceEnabled()
- && LLVoiceClient::getInstance()->isVoiceWorking()
- && mSession->mCallBackEnabled);
- }
+ if (LLVoiceClient::instanceExists() && mVoiceButton)
+ {
+ mVoiceButton->setEnabled(
+ mSessionID.notNull()
+ && mSession
+ && mSession->mSessionInitialized
+ && LLVoiceClient::getInstance()->voiceEnabled()
+ && LLVoiceClient::getInstance()->isVoiceWorking()
+ && mSession->mCallBackEnabled);
+ }
}
// virtual
void LLFloaterIMSessionTab::onFocusReceived()
{
- setBackgroundOpaque(true);
+ setBackgroundOpaque(true);
- if (mSessionID.notNull() && isInVisibleChain())
- {
- LLIMModel::instance().sendNoUnreadMessages(mSessionID);
- }
+ if (mSessionID.notNull() && isInVisibleChain())
+ {
+ LLIMModel::instance().sendNoUnreadMessages(mSessionID);
+ }
- super::onFocusReceived();
+ super::onFocusReceived();
}
// virtual
void LLFloaterIMSessionTab::onFocusLost()
{
- setBackgroundOpaque(false);
- super::onFocusLost();
+ setBackgroundOpaque(false);
+ super::onFocusLost();
}
void LLFloaterIMSessionTab::onInputEditorClicked()
{
- LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
- if (im_box)
- {
- im_box->flashConversationItemWidget(mSessionID,false);
- }
- gToolBarView->flashCommand(LLCommandId("chat"), false);
+ LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
+ if (im_box)
+ {
+ im_box->flashConversationItemWidget(mSessionID,false);
+ }
+ gToolBarView->flashCommand(LLCommandId("chat"), false);
}
void LLFloaterIMSessionTab::onEmojiRecentPanelToggleBtnClicked()
@@ -492,63 +492,63 @@ void LLFloaterIMSessionTab::initEmojiRecentPanel()
void LLFloaterIMSessionTab::onRecentEmojiPicked(const LLSD& value)
{
- LLSD::String str = value.asString();
- if (str.size())
- {
- LLWString wstr = utf8string_to_wstring(str);
- if (wstr.size())
- {
- llwchar emoji = wstr[0];
- mInputEditor->insertEmoji(emoji);
- }
- }
+ LLSD::String str = value.asString();
+ if (str.size())
+ {
+ LLWString wstr = utf8string_to_wstring(str);
+ if (wstr.size())
+ {
+ llwchar emoji = wstr[0];
+ mInputEditor->insertEmoji(emoji);
+ }
+ }
}
void LLFloaterIMSessionTab::closeFloater(bool app_quitting)
{
- LLFloaterEmojiPicker::saveState();
- super::closeFloater(app_quitting);
+ LLFloaterEmojiPicker::saveState();
+ super::closeFloater(app_quitting);
}
std::string LLFloaterIMSessionTab::appendTime()
{
- std::string timeStr = "[" + LLTrans::getString("TimeHour") + "]:"
- "[" + LLTrans::getString("TimeMin") + "]";
+ std::string timeStr = "[" + LLTrans::getString("TimeHour") + "]:"
+ "[" + LLTrans::getString("TimeMin") + "]";
- LLSD substitution;
- substitution["datetime"] = (S32)time_corrected();
- LLStringUtil::format(timeStr, substitution);
+ LLSD substitution;
+ substitution["datetime"] = (S32)time_corrected();
+ LLStringUtil::format(timeStr, substitution);
- return timeStr;
+ return timeStr;
}
void LLFloaterIMSessionTab::appendMessage(const LLChat& chat, const LLSD& args)
{
- if (chat.mMuted || !mChatHistory)
- return;
-
- // Update the participant activity time
- LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
- if (im_box)
- {
- im_box->setTimeNow(mSessionID, chat.mFromID);
- }
-
- LLChat& tmp_chat = const_cast<LLChat&>(chat);
-
- if (tmp_chat.mTimeStr.empty())
- tmp_chat.mTimeStr = appendTime();
-
- tmp_chat.mFromName = chat.mFromName;
-
- LLSD chat_args = args;
- chat_args["use_plain_text_chat_history"] =
- gSavedSettings.getBOOL("PlainTextChatHistory");
- chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
- chat_args["show_names_for_p2p_conv"] = !mIsP2PChat ||
- gSavedSettings.getBOOL("IMShowNamesForP2PConv");
-
- mChatHistory->appendMessage(chat, chat_args);
+ if (chat.mMuted || !mChatHistory)
+ return;
+
+ // Update the participant activity time
+ LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
+ if (im_box)
+ {
+ im_box->setTimeNow(mSessionID, chat.mFromID);
+ }
+
+ LLChat& tmp_chat = const_cast<LLChat&>(chat);
+
+ if (tmp_chat.mTimeStr.empty())
+ tmp_chat.mTimeStr = appendTime();
+
+ tmp_chat.mFromName = chat.mFromName;
+
+ LLSD chat_args = args;
+ chat_args["use_plain_text_chat_history"] =
+ gSavedSettings.getBOOL("PlainTextChatHistory");
+ chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
+ chat_args["show_names_for_p2p_conv"] = !mIsP2PChat ||
+ gSavedSettings.getBOOL("IMShowNamesForP2PConv");
+
+ mChatHistory->appendMessage(chat, chat_args);
}
void LLFloaterIMSessionTab::updateUsedEmojis(LLWString text)
@@ -580,715 +580,715 @@ void LLFloaterIMSessionTab::updateUsedEmojis(LLWString text)
static LLTrace::BlockTimerStatHandle FTM_BUILD_CONVERSATION_VIEW_PARTICIPANT("Build Conversation View");
void LLFloaterIMSessionTab::buildConversationViewParticipant()
{
- LL_RECORD_BLOCK_TIME(FTM_BUILD_CONVERSATION_VIEW_PARTICIPANT);
- // Clear the widget list since we are rebuilding afresh from the model
- conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
- while (widget_it != mConversationsWidgets.end())
- {
- removeConversationViewParticipant(widget_it->first);
- // Iterators are invalidated by erase so we need to pick begin again
- widget_it = mConversationsWidgets.begin();
- }
-
- // Get the model list
- LLParticipantList* item = getParticipantList();
- if (!item)
- {
- // Nothing to do if the model list is inexistent
- return;
- }
-
- // Create the participants widgets now
- LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin();
- LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd();
- while (current_participant_model != end_participant_model)
- {
- LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model);
- if (participant_model)
- {
- addConversationViewParticipant(participant_model);
- }
- current_participant_model++;
- }
+ LL_RECORD_BLOCK_TIME(FTM_BUILD_CONVERSATION_VIEW_PARTICIPANT);
+ // Clear the widget list since we are rebuilding afresh from the model
+ conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
+ while (widget_it != mConversationsWidgets.end())
+ {
+ removeConversationViewParticipant(widget_it->first);
+ // Iterators are invalidated by erase so we need to pick begin again
+ widget_it = mConversationsWidgets.begin();
+ }
+
+ // Get the model list
+ LLParticipantList* item = getParticipantList();
+ if (!item)
+ {
+ // Nothing to do if the model list is inexistent
+ return;
+ }
+
+ // Create the participants widgets now
+ LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin();
+ LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd();
+ while (current_participant_model != end_participant_model)
+ {
+ LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model);
+ if (participant_model)
+ {
+ addConversationViewParticipant(participant_model);
+ }
+ current_participant_model++;
+ }
}
void LLFloaterIMSessionTab::addConversationViewParticipant(LLConversationItem* participant_model, bool update_view)
{
- if (!participant_model)
- {
- // Nothing to do if the model is inexistent
- return;
- }
-
- // Check if the model already has an associated view
- LLUUID uuid = participant_model->getUUID();
- LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid);
-
- // If not already present, create the participant view and attach it to the root, otherwise, just refresh it
- if (widget)
- {
- if (update_view)
- {
- updateConversationViewParticipant(uuid); // overkill?
- }
- }
- else
- {
- LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model);
- mConversationsWidgets[uuid] = participant_view;
- participant_view->addToFolder(mConversationsRoot);
- participant_view->addToSession(mSessionID);
- participant_view->setVisible(TRUE);
- }
+ if (!participant_model)
+ {
+ // Nothing to do if the model is inexistent
+ return;
+ }
+
+ // Check if the model already has an associated view
+ LLUUID uuid = participant_model->getUUID();
+ LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid);
+
+ // If not already present, create the participant view and attach it to the root, otherwise, just refresh it
+ if (widget)
+ {
+ if (update_view)
+ {
+ updateConversationViewParticipant(uuid); // overkill?
+ }
+ }
+ else
+ {
+ LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model);
+ mConversationsWidgets[uuid] = participant_view;
+ participant_view->addToFolder(mConversationsRoot);
+ participant_view->addToSession(mSessionID);
+ participant_view->setVisible(TRUE);
+ }
}
void LLFloaterIMSessionTab::removeConversationViewParticipant(const LLUUID& participant_id)
{
- LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,participant_id);
- if (widget)
- {
- widget->destroyView();
- }
- mConversationsWidgets.erase(participant_id);
+ LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,participant_id);
+ if (widget)
+ {
+ widget->destroyView();
+ }
+ mConversationsWidgets.erase(participant_id);
}
void LLFloaterIMSessionTab::updateConversationViewParticipant(const LLUUID& participant_id)
{
- LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,participant_id);
- if (widget && widget->getViewModelItem())
- {
- widget->refresh();
- }
+ LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,participant_id);
+ if (widget && widget->getViewModelItem())
+ {
+ widget->refresh();
+ }
}
void LLFloaterIMSessionTab::refreshConversation()
{
- // Note: We collect participants names to change the session name only in the case of ad-hoc conversations
- bool is_ad_hoc = (mSession ? mSession->isAdHocSessionType() : false);
- uuid_vec_t participants_uuids; // uuids vector for building the added participants name string
- // For P2P chat, we still need to update the session name who may have changed (switch display name for instance)
- if (mIsP2PChat && mSession)
- {
- participants_uuids.push_back(mSession->mOtherParticipantID);
- }
-
- conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
- while (widget_it != mConversationsWidgets.end())
- {
- // Add the participant to the list except if it's the agent itself (redundant)
- if (is_ad_hoc && (widget_it->first != gAgentID))
- {
- participants_uuids.push_back(widget_it->first);
- }
- if (widget_it->second->getViewModelItem())
- {
- widget_it->second->refresh();
- widget_it->second->setVisible(TRUE);
- }
- ++widget_it;
- }
- if (is_ad_hoc || mIsP2PChat)
- {
- // Build the session name and update it
- std::string session_name;
- if (participants_uuids.size() != 0)
- {
- LLAvatarActions::buildResidentsString(participants_uuids, session_name);
- }
- else
- {
- session_name = LLIMModel::instance().getName(mSessionID);
- }
- updateSessionName(session_name);
- }
-
- if (mSessionID.notNull())
- {
- LLParticipantList* participant_list = getParticipantList();
- if (participant_list)
- {
- LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = participant_list->getChildrenBegin();
- LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = participant_list->getChildrenEnd();
- LLIMSpeakerMgr *speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
- while (current_participant_model != end_participant_model)
- {
- LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
- if (speaker_mgr && participant_model)
- {
- LLSpeaker *participant_speaker = speaker_mgr->findSpeaker(participant_model->getUUID());
- LLSpeaker *agent_speaker = speaker_mgr->findSpeaker(gAgentID);
- if (participant_speaker && agent_speaker)
- {
- participant_model->setDisplayModeratorRole(agent_speaker->mIsModerator && participant_speaker->mIsModerator);
- }
- }
- current_participant_model++;
- }
- }
- }
-
- mConversationViewModel.requestSortAll();
- if(mConversationsRoot != NULL)
- {
- mConversationsRoot->arrangeAll();
- mConversationsRoot->update();
- }
- updateHeaderAndToolbar();
- refresh();
+ // Note: We collect participants names to change the session name only in the case of ad-hoc conversations
+ bool is_ad_hoc = (mSession ? mSession->isAdHocSessionType() : false);
+ uuid_vec_t participants_uuids; // uuids vector for building the added participants name string
+ // For P2P chat, we still need to update the session name who may have changed (switch display name for instance)
+ if (mIsP2PChat && mSession)
+ {
+ participants_uuids.push_back(mSession->mOtherParticipantID);
+ }
+
+ conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
+ while (widget_it != mConversationsWidgets.end())
+ {
+ // Add the participant to the list except if it's the agent itself (redundant)
+ if (is_ad_hoc && (widget_it->first != gAgentID))
+ {
+ participants_uuids.push_back(widget_it->first);
+ }
+ if (widget_it->second->getViewModelItem())
+ {
+ widget_it->second->refresh();
+ widget_it->second->setVisible(TRUE);
+ }
+ ++widget_it;
+ }
+ if (is_ad_hoc || mIsP2PChat)
+ {
+ // Build the session name and update it
+ std::string session_name;
+ if (participants_uuids.size() != 0)
+ {
+ LLAvatarActions::buildResidentsString(participants_uuids, session_name);
+ }
+ else
+ {
+ session_name = LLIMModel::instance().getName(mSessionID);
+ }
+ updateSessionName(session_name);
+ }
+
+ if (mSessionID.notNull())
+ {
+ LLParticipantList* participant_list = getParticipantList();
+ if (participant_list)
+ {
+ LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = participant_list->getChildrenBegin();
+ LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = participant_list->getChildrenEnd();
+ LLIMSpeakerMgr *speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
+ while (current_participant_model != end_participant_model)
+ {
+ LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
+ if (speaker_mgr && participant_model)
+ {
+ LLSpeaker *participant_speaker = speaker_mgr->findSpeaker(participant_model->getUUID());
+ LLSpeaker *agent_speaker = speaker_mgr->findSpeaker(gAgentID);
+ if (participant_speaker && agent_speaker)
+ {
+ participant_model->setDisplayModeratorRole(agent_speaker->mIsModerator && participant_speaker->mIsModerator);
+ }
+ }
+ current_participant_model++;
+ }
+ }
+ }
+
+ mConversationViewModel.requestSortAll();
+ if(mConversationsRoot != NULL)
+ {
+ mConversationsRoot->arrangeAll();
+ mConversationsRoot->update();
+ }
+ updateHeaderAndToolbar();
+ refresh();
}
// Copied from LLFloaterIMContainer::createConversationViewParticipant(). Refactor opportunity!
LLConversationViewParticipant* LLFloaterIMSessionTab::createConversationViewParticipant(LLConversationItem* item)
{
- LLRect panel_rect = mParticipantListPanel->getRect();
-
- LLConversationViewParticipant::Params params;
- params.name = item->getDisplayName();
- params.root = mConversationsRoot;
- params.listener = item;
- params.rect = LLRect (0, 24, panel_rect.getWidth(), 0); // *TODO: use conversation_view_participant.xml itemHeight value in lieu of 24
- params.tool_tip = params.name;
- params.participant_id = item->getUUID();
-
- return LLUICtrlFactory::create<LLConversationViewParticipant>(params);
+ LLRect panel_rect = mParticipantListPanel->getRect();
+
+ LLConversationViewParticipant::Params params;
+ params.name = item->getDisplayName();
+ params.root = mConversationsRoot;
+ params.listener = item;
+ params.rect = LLRect (0, 24, panel_rect.getWidth(), 0); // *TODO: use conversation_view_participant.xml itemHeight value in lieu of 24
+ params.tool_tip = params.name;
+ params.participant_id = item->getUUID();
+
+ return LLUICtrlFactory::create<LLConversationViewParticipant>(params);
}
void LLFloaterIMSessionTab::setSortOrder(const LLConversationSort& order)
{
- mConversationViewModel.setSorter(order);
- mConversationsRoot->arrangeAll();
- refreshConversation();
+ mConversationViewModel.setSorter(order);
+ mConversationsRoot->arrangeAll();
+ refreshConversation();
}
void LLFloaterIMSessionTab::onIMSessionMenuItemClicked(const LLSD& userdata)
{
- std::string item = userdata.asString();
-
- if (item == "compact_view" || item == "expanded_view")
- {
- gSavedSettings.setBOOL("PlainTextChatHistory", item == "compact_view");
- }
- else
- {
- bool prev_value = gSavedSettings.getBOOL(item);
- gSavedSettings.setBOOL(item, !prev_value);
- }
-
- LLFloaterIMSessionTab::processChatHistoryStyleUpdate();
+ std::string item = userdata.asString();
+
+ if (item == "compact_view" || item == "expanded_view")
+ {
+ gSavedSettings.setBOOL("PlainTextChatHistory", item == "compact_view");
+ }
+ else
+ {
+ bool prev_value = gSavedSettings.getBOOL(item);
+ gSavedSettings.setBOOL(item, !prev_value);
+ }
+
+ LLFloaterIMSessionTab::processChatHistoryStyleUpdate();
}
bool LLFloaterIMSessionTab::onIMCompactExpandedMenuItemCheck(const LLSD& userdata)
{
- std::string item = userdata.asString();
- bool is_plain_text_mode = gSavedSettings.getBOOL("PlainTextChatHistory");
+ std::string item = userdata.asString();
+ bool is_plain_text_mode = gSavedSettings.getBOOL("PlainTextChatHistory");
- return is_plain_text_mode? item == "compact_view" : item == "expanded_view";
+ return is_plain_text_mode? item == "compact_view" : item == "expanded_view";
}
bool LLFloaterIMSessionTab::onIMShowModesMenuItemCheck(const LLSD& userdata)
{
- return gSavedSettings.getBOOL(userdata.asString());
+ return gSavedSettings.getBOOL(userdata.asString());
}
// enable/disable states for the "show time" and "show names" items of the show-modes menu
bool LLFloaterIMSessionTab::onIMShowModesMenuItemEnable(const LLSD& userdata)
{
- std::string item = userdata.asString();
- bool plain_text = gSavedSettings.getBOOL("PlainTextChatHistory");
- bool is_not_names = (item != "IMShowNamesForP2PConv");
- return (plain_text && (is_not_names || mIsP2PChat));
+ std::string item = userdata.asString();
+ bool plain_text = gSavedSettings.getBOOL("PlainTextChatHistory");
+ bool is_not_names = (item != "IMShowNamesForP2PConv");
+ return (plain_text && (is_not_names || mIsP2PChat));
}
void LLFloaterIMSessionTab::hideOrShowTitle()
{
- const LLFloater::Params& default_params = LLFloater::getDefaultParams();
- S32 floater_header_size = default_params.header_height;
- LLView* floater_contents = getChild<LLView>("contents_view");
-
- LLRect floater_rect = getLocalRect();
- S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0);
- LLRect handle_rect (0, floater_rect.mTop, floater_rect.mRight, top_border_of_contents);
- LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom);
- mDragHandle->setShape(handle_rect);
- mDragHandle->setVisible(isTornOff());
- floater_contents->setShape(contents_rect);
+ const LLFloater::Params& default_params = LLFloater::getDefaultParams();
+ S32 floater_header_size = default_params.header_height;
+ LLView* floater_contents = getChild<LLView>("contents_view");
+
+ LLRect floater_rect = getLocalRect();
+ S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0);
+ LLRect handle_rect (0, floater_rect.mTop, floater_rect.mRight, top_border_of_contents);
+ LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom);
+ mDragHandle->setShape(handle_rect);
+ mDragHandle->setVisible(isTornOff());
+ floater_contents->setShape(contents_rect);
}
void LLFloaterIMSessionTab::updateSessionName(const std::string& name)
{
- mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + name);
+ mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + name);
}
void LLFloaterIMSessionTab::updateChatIcon(const LLUUID& id)
{
- if (mSession)
- {
- if (mSession->isP2PSessionType())
- {
- LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>(ICN_AVATAR);
- icon->setVisible(true);
- icon->setValue(id);
- }
- if (mSession->isAdHocSessionType())
- {
- LLGroupIconCtrl* icon = getChild<LLGroupIconCtrl>(ICN_GROUP);
- icon->setVisible(true);
- }
- if (mSession->isGroupSessionType())
- {
- LLGroupIconCtrl* icon = getChild<LLGroupIconCtrl>(ICN_GROUP);
- icon->setVisible(true);
- icon->setValue(id);
- }
- }
- else
- {
- if (mIsNearbyChat)
- {
- LLIconCtrl* icon = getChild<LLIconCtrl>(ICN_NEARBY);
- icon->setVisible(true);
- }
- }
+ if (mSession)
+ {
+ if (mSession->isP2PSessionType())
+ {
+ LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>(ICN_AVATAR);
+ icon->setVisible(true);
+ icon->setValue(id);
+ }
+ if (mSession->isAdHocSessionType())
+ {
+ LLGroupIconCtrl* icon = getChild<LLGroupIconCtrl>(ICN_GROUP);
+ icon->setVisible(true);
+ }
+ if (mSession->isGroupSessionType())
+ {
+ LLGroupIconCtrl* icon = getChild<LLGroupIconCtrl>(ICN_GROUP);
+ icon->setVisible(true);
+ icon->setValue(id);
+ }
+ }
+ else
+ {
+ if (mIsNearbyChat)
+ {
+ LLIconCtrl* icon = getChild<LLIconCtrl>(ICN_NEARBY);
+ icon->setVisible(true);
+ }
+ }
}
void LLFloaterIMSessionTab::hideAllStandardButtons()
{
- for (S32 i = 0; i < BUTTON_COUNT; i++)
- {
- if (mButtons[i])
- {
- // Hide the standard header buttons in a docked IM floater.
- mButtons[i]->setVisible(false);
- }
- }
+ for (S32 i = 0; i < BUTTON_COUNT; i++)
+ {
+ if (mButtons[i])
+ {
+ // Hide the standard header buttons in a docked IM floater.
+ mButtons[i]->setVisible(false);
+ }
+ }
}
void LLFloaterIMSessionTab::updateHeaderAndToolbar()
{
- // prevent start conversation before its container
- LLFloaterIMContainer::getInstance();
-
- bool is_not_torn_off = !checkIfTornOff();
- if (is_not_torn_off)
- {
- hideAllStandardButtons();
- }
-
- hideOrShowTitle();
-
- // Participant list should be visible only in torn off floaters.
- bool is_participant_list_visible =
- !is_not_torn_off
- && mIsParticipantListExpanded
- && !mIsP2PChat;
-
- mParticipantListAndHistoryStack->collapsePanel(mParticipantListPanel, !is_participant_list_visible);
- mParticipantListPanel->setVisible(is_participant_list_visible);
-
- // Display collapse image (<<) if the floater is hosted
- // or if it is torn off but has an open control panel.
- bool is_expanded = is_not_torn_off || is_participant_list_visible;
-
- mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon"));
- mExpandCollapseBtn->setToolTip(
- is_not_torn_off?
- getString("expcol_button_not_tearoff_tooltip") :
- (is_expanded?
- getString("expcol_button_tearoff_and_expanded_tooltip") :
- getString("expcol_button_tearoff_and_collapsed_tooltip")));
-
- // toggle floater's drag handle and title visibility
- if (mDragHandle)
- {
- mDragHandle->setTitleVisible(!is_not_torn_off);
- }
-
- // The button (>>) should be disabled for torn off P2P conversations.
- mExpandCollapseBtn->setEnabled(is_not_torn_off || !mIsP2PChat);
-
- mTearOffBtn->setImageOverlay(getString(is_not_torn_off? "tear_off_icon" : "return_icon"));
- mTearOffBtn->setToolTip(getString(is_not_torn_off? "tooltip_to_separate_window" : "tooltip_to_main_window"));
-
-
- mCloseBtn->setVisible(is_not_torn_off && !mIsNearbyChat);
-
- enableDisableCallBtn();
+ // prevent start conversation before its container
+ LLFloaterIMContainer::getInstance();
+
+ bool is_not_torn_off = !checkIfTornOff();
+ if (is_not_torn_off)
+ {
+ hideAllStandardButtons();
+ }
+
+ hideOrShowTitle();
+
+ // Participant list should be visible only in torn off floaters.
+ bool is_participant_list_visible =
+ !is_not_torn_off
+ && mIsParticipantListExpanded
+ && !mIsP2PChat;
+
+ mParticipantListAndHistoryStack->collapsePanel(mParticipantListPanel, !is_participant_list_visible);
+ mParticipantListPanel->setVisible(is_participant_list_visible);
+
+ // Display collapse image (<<) if the floater is hosted
+ // or if it is torn off but has an open control panel.
+ bool is_expanded = is_not_torn_off || is_participant_list_visible;
+
+ mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon"));
+ mExpandCollapseBtn->setToolTip(
+ is_not_torn_off?
+ getString("expcol_button_not_tearoff_tooltip") :
+ (is_expanded?
+ getString("expcol_button_tearoff_and_expanded_tooltip") :
+ getString("expcol_button_tearoff_and_collapsed_tooltip")));
+
+ // toggle floater's drag handle and title visibility
+ if (mDragHandle)
+ {
+ mDragHandle->setTitleVisible(!is_not_torn_off);
+ }
+
+ // The button (>>) should be disabled for torn off P2P conversations.
+ mExpandCollapseBtn->setEnabled(is_not_torn_off || !mIsP2PChat);
+
+ mTearOffBtn->setImageOverlay(getString(is_not_torn_off? "tear_off_icon" : "return_icon"));
+ mTearOffBtn->setToolTip(getString(is_not_torn_off? "tooltip_to_separate_window" : "tooltip_to_main_window"));
+
+
+ mCloseBtn->setVisible(is_not_torn_off && !mIsNearbyChat);
+
+ enableDisableCallBtn();
}
-
+
void LLFloaterIMSessionTab::forceReshape()
{
- LLRect floater_rect = getRect();
- reshape(llmax(floater_rect.getWidth(), this->getMinWidth()),
- llmax(floater_rect.getHeight(), this->getMinHeight()),
- true);
+ LLRect floater_rect = getRect();
+ reshape(llmax(floater_rect.getWidth(), this->getMinWidth()),
+ llmax(floater_rect.getHeight(), this->getMinHeight()),
+ true);
}
void LLFloaterIMSessionTab::reshapeChatLayoutPanel()
{
- mChatLayoutPanel->reshape(mChatLayoutPanel->getRect().getWidth(), mInputEditor->getRect().getHeight() + mInputEditorPad, FALSE);
+ mChatLayoutPanel->reshape(mChatLayoutPanel->getRect().getWidth(), mInputEditor->getRect().getHeight() + mInputEditorPad, FALSE);
}
// static
void LLFloaterIMSessionTab::processChatHistoryStyleUpdate(bool clean_messages/* = false*/)
{
- LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
- for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin();
- iter != inst_list.end(); ++iter)
- {
- LLFloaterIMSession* floater = dynamic_cast<LLFloaterIMSession*>(*iter);
- if (floater)
- {
- floater->reloadMessages(clean_messages);
- }
- }
-
- LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if (nearby_chat)
- {
- nearby_chat->reloadMessages(clean_messages);
- }
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin();
+ iter != inst_list.end(); ++iter)
+ {
+ LLFloaterIMSession* floater = dynamic_cast<LLFloaterIMSession*>(*iter);
+ if (floater)
+ {
+ floater->reloadMessages(clean_messages);
+ }
+ }
+
+ LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ if (nearby_chat)
+ {
+ nearby_chat->reloadMessages(clean_messages);
+ }
}
// static
void LLFloaterIMSessionTab::reloadEmptyFloaters()
{
- LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
- for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin();
- iter != inst_list.end(); ++iter)
- {
- LLFloaterIMSession* floater = dynamic_cast<LLFloaterIMSession*>(*iter);
- if (floater && floater->getLastChatMessageIndex() == -1)
- {
- floater->reloadMessages(true);
- }
- }
-
- LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if (nearby_chat && nearby_chat->getMessageArchiveLength() == 0)
- {
- nearby_chat->reloadMessages(true);
- }
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin();
+ iter != inst_list.end(); ++iter)
+ {
+ LLFloaterIMSession* floater = dynamic_cast<LLFloaterIMSession*>(*iter);
+ if (floater && floater->getLastChatMessageIndex() == -1)
+ {
+ floater->reloadMessages(true);
+ }
+ }
+
+ LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ if (nearby_chat && nearby_chat->getMessageArchiveLength() == 0)
+ {
+ nearby_chat->reloadMessages(true);
+ }
}
void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive)
{
- mVoiceButton->setImageOverlay(callIsActive? getString("call_btn_stop") : getString("call_btn_start"));
- mVoiceButton->setToolTip(callIsActive? getString("end_call_button_tooltip") : getString("start_call_button_tooltip"));
+ mVoiceButton->setImageOverlay(callIsActive? getString("call_btn_stop") : getString("call_btn_start"));
+ mVoiceButton->setToolTip(callIsActive? getString("end_call_button_tooltip") : getString("start_call_button_tooltip"));
- enableDisableCallBtn();
+ enableDisableCallBtn();
}
void LLFloaterIMSessionTab::onSlide(LLFloaterIMSessionTab* self)
{
- LLFloaterIMContainer* host_floater = dynamic_cast<LLFloaterIMContainer*>(self->getHost());
- bool should_be_expanded = false;
- if (host_floater)
- {
- // Hide the messages pane if a floater is hosted in the Conversations
- host_floater->collapseMessagesPane(true);
- }
- else ///< floater is torn off
- {
- if (!self->mIsP2PChat)
- {
- // The state must toggle the collapsed state of the panel
- should_be_expanded = self->mParticipantListPanel->isCollapsed();
-
- // Update the expand/collapse flag of the participant list panel and save it
- gSavedSettings.setBOOL("IMShowControlPanel", should_be_expanded);
- self->mIsParticipantListExpanded = should_be_expanded;
-
- // Refresh for immediate feedback
- self->refreshConversation();
- }
- }
-
- self->assignResizeLimits();
- if (should_be_expanded)
- {
- self->forceReshape();
- }
+ LLFloaterIMContainer* host_floater = dynamic_cast<LLFloaterIMContainer*>(self->getHost());
+ bool should_be_expanded = false;
+ if (host_floater)
+ {
+ // Hide the messages pane if a floater is hosted in the Conversations
+ host_floater->collapseMessagesPane(true);
+ }
+ else ///< floater is torn off
+ {
+ if (!self->mIsP2PChat)
+ {
+ // The state must toggle the collapsed state of the panel
+ should_be_expanded = self->mParticipantListPanel->isCollapsed();
+
+ // Update the expand/collapse flag of the participant list panel and save it
+ gSavedSettings.setBOOL("IMShowControlPanel", should_be_expanded);
+ self->mIsParticipantListExpanded = should_be_expanded;
+
+ // Refresh for immediate feedback
+ self->refreshConversation();
+ }
+ }
+
+ self->assignResizeLimits();
+ if (should_be_expanded)
+ {
+ self->forceReshape();
+ }
}
void LLFloaterIMSessionTab::onCollapseToLine(LLFloaterIMSessionTab* self)
{
- LLFloaterIMContainer* host_floater = dynamic_cast<LLFloaterIMContainer*>(self->getHost());
- if (!host_floater)
- {
- bool expand = self->isMessagePaneExpanded();
- self->mExpandCollapseLineBtn->setImageOverlay(self->getString(expand ? "collapseline_icon" : "expandline_icon"));
- self->mContentPanel->setVisible(!expand);
- self->mToolbarPanel->setVisible(!expand);
- self->mInputEditor->enableSingleLineMode(expand);
- self->reshapeFloater(expand);
- self->setMessagePaneExpanded(!expand);
- }
+ LLFloaterIMContainer* host_floater = dynamic_cast<LLFloaterIMContainer*>(self->getHost());
+ if (!host_floater)
+ {
+ bool expand = self->isMessagePaneExpanded();
+ self->mExpandCollapseLineBtn->setImageOverlay(self->getString(expand ? "collapseline_icon" : "expandline_icon"));
+ self->mContentPanel->setVisible(!expand);
+ self->mToolbarPanel->setVisible(!expand);
+ self->mInputEditor->enableSingleLineMode(expand);
+ self->reshapeFloater(expand);
+ self->setMessagePaneExpanded(!expand);
+ }
}
void LLFloaterIMSessionTab::reshapeFloater(bool collapse)
{
- LLRect floater_rect = getRect();
-
- if(collapse)
- {
- mFloaterHeight = floater_rect.getHeight();
- S32 height = mContentPanel->getRect().getHeight() + mToolbarPanel->getRect().getHeight()
- + mChatLayoutPanel->getRect().getHeight() - mChatLayoutPanelHeight + 2;
- floater_rect.mTop -= height;
-
- setResizeLimits(getMinWidth(), floater_rect.getHeight());
- }
- else
- {
- floater_rect.mTop = floater_rect.mBottom + mFloaterHeight;
- setResizeLimits(getMinWidth(), mMinFloaterHeight);
- }
-
- enableResizeCtrls(true, true, !collapse);
-
- saveCollapsedState();
- setShape(floater_rect, true);
- mBodyStack->updateLayout();
+ LLRect floater_rect = getRect();
+
+ if(collapse)
+ {
+ mFloaterHeight = floater_rect.getHeight();
+ S32 height = mContentPanel->getRect().getHeight() + mToolbarPanel->getRect().getHeight()
+ + mChatLayoutPanel->getRect().getHeight() - mChatLayoutPanelHeight + 2;
+ floater_rect.mTop -= height;
+
+ setResizeLimits(getMinWidth(), floater_rect.getHeight());
+ }
+ else
+ {
+ floater_rect.mTop = floater_rect.mBottom + mFloaterHeight;
+ setResizeLimits(getMinWidth(), mMinFloaterHeight);
+ }
+
+ enableResizeCtrls(true, true, !collapse);
+
+ saveCollapsedState();
+ setShape(floater_rect, true);
+ mBodyStack->updateLayout();
}
void LLFloaterIMSessionTab::restoreFloater()
{
- if(!isMessagePaneExpanded())
- {
- if(isMinimized())
- {
- setMinimized(false);
- }
- mContentPanel->setVisible(true);
- mToolbarPanel->setVisible(true);
- LLRect floater_rect = getRect();
- floater_rect.mTop = floater_rect.mBottom + mFloaterHeight;
- setShape(floater_rect, true);
- mBodyStack->updateLayout();
- mExpandCollapseLineBtn->setImageOverlay(getString("expandline_icon"));
- setResizeLimits(getMinWidth(), mMinFloaterHeight);
- setMessagePaneExpanded(true);
- saveCollapsedState();
- mInputEditor->enableSingleLineMode(false);
- enableResizeCtrls(true, true, true);
- }
+ if(!isMessagePaneExpanded())
+ {
+ if(isMinimized())
+ {
+ setMinimized(false);
+ }
+ mContentPanel->setVisible(true);
+ mToolbarPanel->setVisible(true);
+ LLRect floater_rect = getRect();
+ floater_rect.mTop = floater_rect.mBottom + mFloaterHeight;
+ setShape(floater_rect, true);
+ mBodyStack->updateLayout();
+ mExpandCollapseLineBtn->setImageOverlay(getString("expandline_icon"));
+ setResizeLimits(getMinWidth(), mMinFloaterHeight);
+ setMessagePaneExpanded(true);
+ saveCollapsedState();
+ mInputEditor->enableSingleLineMode(false);
+ enableResizeCtrls(true, true, true);
+ }
}
/*virtual*/
void LLFloaterIMSessionTab::onOpen(const LLSD& key)
{
- if (!checkIfTornOff())
- {
- LLFloaterIMContainer* host_floater = dynamic_cast<LLFloaterIMContainer*>(getHost());
- // Show the messages pane when opening a floater hosted in the Conversations
- host_floater->collapseMessagesPane(false);
- }
+ if (!checkIfTornOff())
+ {
+ LLFloaterIMContainer* host_floater = dynamic_cast<LLFloaterIMContainer*>(getHost());
+ // Show the messages pane when opening a floater hosted in the Conversations
+ host_floater->collapseMessagesPane(false);
+ }
- mInputButtonPanel->setVisible(isTornOff());
+ mInputButtonPanel->setVisible(isTornOff());
- setFocus(TRUE);
+ setFocus(TRUE);
}
void LLFloaterIMSessionTab::onTearOffClicked()
{
- restoreFloater();
- setFollows(isTornOff()? FOLLOWS_ALL : FOLLOWS_NONE);
- mSaveRect = isTornOff();
- initRectControl();
- LLFloater::onClickTearOff(this);
- LLFloaterIMContainer* container = LLFloaterReg::findTypedInstance<LLFloaterIMContainer>("im_container");
-
- if (isTornOff())
- {
- container->selectAdjacentConversation(false);
- forceReshape();
- }
- //Upon re-docking the torn off floater, select the corresponding conversation line item
- else
- {
- container->selectConversation(mSessionID);
-
- }
- mInputButtonPanel->setVisible(isTornOff());
-
- refreshConversation();
- updateGearBtn();
+ restoreFloater();
+ setFollows(isTornOff()? FOLLOWS_ALL : FOLLOWS_NONE);
+ mSaveRect = isTornOff();
+ initRectControl();
+ LLFloater::onClickTearOff(this);
+ LLFloaterIMContainer* container = LLFloaterReg::findTypedInstance<LLFloaterIMContainer>("im_container");
+
+ if (isTornOff())
+ {
+ container->selectAdjacentConversation(false);
+ forceReshape();
+ }
+ //Upon re-docking the torn off floater, select the corresponding conversation line item
+ else
+ {
+ container->selectConversation(mSessionID);
+
+ }
+ mInputButtonPanel->setVisible(isTornOff());
+
+ refreshConversation();
+ updateGearBtn();
}
void LLFloaterIMSessionTab::updateGearBtn()
{
- BOOL prevVisibility = mGearBtn->getVisible();
- mGearBtn->setVisible(checkIfTornOff() && mIsP2PChat);
-
-
- // Move buttons if Gear button changed visibility
- if(prevVisibility != mGearBtn->getVisible())
- {
- LLRect gear_btn_rect = mGearBtn->getRect();
- LLRect add_btn_rect = mAddBtn->getRect();
- LLRect call_btn_rect = mVoiceButton->getRect();
- S32 gap_width = call_btn_rect.mLeft - add_btn_rect.mRight;
- S32 right_shift = gear_btn_rect.getWidth() + gap_width;
- if(mGearBtn->getVisible())
- {
- // Move buttons to the right to give space for Gear button
- add_btn_rect.translate(right_shift,0);
- call_btn_rect.translate(right_shift,0);
- }
- else
- {
- add_btn_rect.translate(-right_shift,0);
- call_btn_rect.translate(-right_shift,0);
- }
- mAddBtn->setRect(add_btn_rect);
- mVoiceButton->setRect(call_btn_rect);
- }
+ BOOL prevVisibility = mGearBtn->getVisible();
+ mGearBtn->setVisible(checkIfTornOff() && mIsP2PChat);
+
+
+ // Move buttons if Gear button changed visibility
+ if(prevVisibility != mGearBtn->getVisible())
+ {
+ LLRect gear_btn_rect = mGearBtn->getRect();
+ LLRect add_btn_rect = mAddBtn->getRect();
+ LLRect call_btn_rect = mVoiceButton->getRect();
+ S32 gap_width = call_btn_rect.mLeft - add_btn_rect.mRight;
+ S32 right_shift = gear_btn_rect.getWidth() + gap_width;
+ if(mGearBtn->getVisible())
+ {
+ // Move buttons to the right to give space for Gear button
+ add_btn_rect.translate(right_shift,0);
+ call_btn_rect.translate(right_shift,0);
+ }
+ else
+ {
+ add_btn_rect.translate(-right_shift,0);
+ call_btn_rect.translate(-right_shift,0);
+ }
+ mAddBtn->setRect(add_btn_rect);
+ mVoiceButton->setRect(call_btn_rect);
+ }
}
void LLFloaterIMSessionTab::initBtns()
{
- LLRect gear_btn_rect = mGearBtn->getRect();
- LLRect add_btn_rect = mAddBtn->getRect();
- LLRect call_btn_rect = mVoiceButton->getRect();
- S32 gap_width = call_btn_rect.mLeft - add_btn_rect.mRight;
- S32 right_shift = gear_btn_rect.getWidth() + gap_width;
+ LLRect gear_btn_rect = mGearBtn->getRect();
+ LLRect add_btn_rect = mAddBtn->getRect();
+ LLRect call_btn_rect = mVoiceButton->getRect();
+ S32 gap_width = call_btn_rect.mLeft - add_btn_rect.mRight;
+ S32 right_shift = gear_btn_rect.getWidth() + gap_width;
- add_btn_rect.translate(-right_shift,0);
- call_btn_rect.translate(-right_shift,0);
+ add_btn_rect.translate(-right_shift,0);
+ call_btn_rect.translate(-right_shift,0);
- mAddBtn->setRect(add_btn_rect);
- mVoiceButton->setRect(call_btn_rect);
+ mAddBtn->setRect(add_btn_rect);
+ mVoiceButton->setRect(call_btn_rect);
}
// static
bool LLFloaterIMSessionTab::isChatMultiTab()
{
- // Restart is required in order to change chat window type.
- return true;
+ // Restart is required in order to change chat window type.
+ return true;
}
bool LLFloaterIMSessionTab::checkIfTornOff()
{
- bool isTorn = !getHost();
-
- if (isTorn != isTornOff())
- {
- setTornOff(isTorn);
- refreshConversation();
- }
-
- return isTorn;
+ bool isTorn = !getHost();
+
+ if (isTorn != isTornOff())
+ {
+ setTornOff(isTorn);
+ refreshConversation();
+ }
+
+ return isTorn;
}
void LLFloaterIMSessionTab::doToSelected(const LLSD& userdata)
{
- // Get the list of selected items in the tab
- std::string command = userdata.asString();
- uuid_vec_t selected_uuids;
- getSelectedUUIDs(selected_uuids);
-
- // Perform the command (IM, profile, etc...) on the list using the general conversation container method
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- // Note: By construction, those can only be participants so we can call doToParticipants() directly
- floater_container->doToParticipants(command, selected_uuids);
+ // Get the list of selected items in the tab
+ std::string command = userdata.asString();
+ uuid_vec_t selected_uuids;
+ getSelectedUUIDs(selected_uuids);
+
+ // Perform the command (IM, profile, etc...) on the list using the general conversation container method
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ // Note: By construction, those can only be participants so we can call doToParticipants() directly
+ floater_container->doToParticipants(command, selected_uuids);
}
bool LLFloaterIMSessionTab::enableContextMenuItem(const LLSD& userdata)
{
- // Get the list of selected items in the tab
- std::string command = userdata.asString();
- uuid_vec_t selected_uuids;
- getSelectedUUIDs(selected_uuids);
-
- // Perform the item enable test on the list using the general conversation container method
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- return floater_container->enableContextMenuItem(command, selected_uuids);
+ // Get the list of selected items in the tab
+ std::string command = userdata.asString();
+ uuid_vec_t selected_uuids;
+ getSelectedUUIDs(selected_uuids);
+
+ // Perform the item enable test on the list using the general conversation container method
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ return floater_container->enableContextMenuItem(command, selected_uuids);
}
bool LLFloaterIMSessionTab::checkContextMenuItem(const LLSD& userdata)
{
- // Get the list of selected items in the tab
- std::string command = userdata.asString();
- uuid_vec_t selected_uuids;
- getSelectedUUIDs(selected_uuids);
-
- // Perform the item check on the list using the general conversation container method
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- return floater_container->checkContextMenuItem(command, selected_uuids);
+ // Get the list of selected items in the tab
+ std::string command = userdata.asString();
+ uuid_vec_t selected_uuids;
+ getSelectedUUIDs(selected_uuids);
+
+ // Perform the item check on the list using the general conversation container method
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ return floater_container->checkContextMenuItem(command, selected_uuids);
}
void LLFloaterIMSessionTab::getSelectedUUIDs(uuid_vec_t& selected_uuids)
{
- const std::set<LLFolderViewItem*> selected_items = mConversationsRoot->getSelectionList();
-
- std::set<LLFolderViewItem*>::const_iterator it = selected_items.begin();
- const std::set<LLFolderViewItem*>::const_iterator it_end = selected_items.end();
-
- for (; it != it_end; ++it)
- {
- LLConversationItem* conversation_item = static_cast<LLConversationItem *>((*it)->getViewModelItem());
- if (conversation_item)
- {
- selected_uuids.push_back(conversation_item->getUUID());
- }
- }
+ const std::set<LLFolderViewItem*> selected_items = mConversationsRoot->getSelectionList();
+
+ std::set<LLFolderViewItem*>::const_iterator it = selected_items.begin();
+ const std::set<LLFolderViewItem*>::const_iterator it_end = selected_items.end();
+
+ for (; it != it_end; ++it)
+ {
+ LLConversationItem* conversation_item = static_cast<LLConversationItem *>((*it)->getViewModelItem());
+ if (conversation_item)
+ {
+ selected_uuids.push_back(conversation_item->getUUID());
+ }
+ }
}
LLConversationItem* LLFloaterIMSessionTab::getCurSelectedViewModelItem()
{
- LLConversationItem *conversationItem = NULL;
+ LLConversationItem *conversationItem = NULL;
- if(mConversationsRoot &&
- mConversationsRoot->getCurSelectedItem() &&
- mConversationsRoot->getCurSelectedItem()->getViewModelItem())
- {
- conversationItem = static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem()) ;
- }
+ if(mConversationsRoot &&
+ mConversationsRoot->getCurSelectedItem() &&
+ mConversationsRoot->getCurSelectedItem()->getViewModelItem())
+ {
+ conversationItem = static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem()) ;
+ }
- return conversationItem;
+ return conversationItem;
}
void LLFloaterIMSessionTab::saveCollapsedState()
{
- LLFloaterIMSessionTab* conversp = LLFloaterIMSessionTab::getConversation(mSessionID);
- if(conversp->isNearbyChat())
- {
- gSavedPerAccountSettings.setBOOL("NearbyChatIsNotCollapsed", isMessagePaneExpanded());
- }
+ LLFloaterIMSessionTab* conversp = LLFloaterIMSessionTab::getConversation(mSessionID);
+ if(conversp->isNearbyChat())
+ {
+ gSavedPerAccountSettings.setBOOL("NearbyChatIsNotCollapsed", isMessagePaneExpanded());
+ }
}
LLView* LLFloaterIMSessionTab::getChatHistory()
{
- return mChatHistory;
+ return mChatHistory;
}
BOOL LLFloaterIMSessionTab::handleKeyHere(KEY key, MASK mask )
{
- BOOL handled = FALSE;
-
- if(mask == MASK_ALT)
- {
- LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
- if (KEY_RETURN == key && !isTornOff())
- {
- floater_container->expandConversation();
- handled = TRUE;
- }
- if ((KEY_UP == key) || (KEY_LEFT == key))
- {
- floater_container->selectNextorPreviousConversation(false);
- handled = TRUE;
- }
- if ((KEY_DOWN == key ) || (KEY_RIGHT == key))
- {
- floater_container->selectNextorPreviousConversation(true);
- handled = TRUE;
- }
- }
- return handled;
+ BOOL handled = FALSE;
+
+ if(mask == MASK_ALT)
+ {
+ LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
+ if (KEY_RETURN == key && !isTornOff())
+ {
+ floater_container->expandConversation();
+ handled = TRUE;
+ }
+ if ((KEY_UP == key) || (KEY_LEFT == key))
+ {
+ floater_container->selectNextorPreviousConversation(false);
+ handled = TRUE;
+ }
+ if ((KEY_DOWN == key ) || (KEY_RIGHT == key))
+ {
+ floater_container->selectNextorPreviousConversation(true);
+ handled = TRUE;
+ }
+ }
+ return handled;
}
diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h
index cc985b2753..d378b2ea6b 100644
--- a/indra/newview/llfloaterimsessiontab.h
+++ b/indra/newview/llfloaterimsessiontab.h
@@ -44,191 +44,191 @@ class LLChatHistory;
class LLPanelEmojiComplete;
class LLFloaterIMSessionTab
- : public LLTransientDockableFloater
+ : public LLTransientDockableFloater
{
- using super = LLTransientDockableFloater;
+ using super = LLTransientDockableFloater;
public:
- LOG_CLASS(LLFloaterIMSessionTab);
-
- LLFloaterIMSessionTab(const LLSD& session_id);
- ~LLFloaterIMSessionTab();
-
- // reload all message with new settings of visual modes
- static void processChatHistoryStyleUpdate(bool clean_messages = false);
- static void reloadEmptyFloaters();
-
- /**
- * Returns true if chat is displayed in multi tabbed floater
- * false if chat is displayed in multiple windows
- */
- static bool isChatMultiTab();
-
- // add conversation to container
- static void addToHost(const LLUUID& session_id);
-
- bool isHostAttached() {return mIsHostAttached;}
- void setHostAttached(bool is_attached) {mIsHostAttached = is_attached;}
-
- static LLFloaterIMSessionTab* findConversation(const LLUUID& uuid);
- static LLFloaterIMSessionTab* getConversation(const LLUUID& uuid);
-
- bool isNearbyChat() {return mIsNearbyChat;}
-
- // LLFloater overrides
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void draw();
- /*virtual*/ void setVisible(BOOL visible);
- /*virtual*/ void setFocus(BOOL focus);
- /*virtual*/ void closeFloater(bool app_quitting = false);
-
- // Handle the left hand participant list widgets
- void addConversationViewParticipant(LLConversationItem* item, bool update_view = true);
- void removeConversationViewParticipant(const LLUUID& participant_id);
- void updateConversationViewParticipant(const LLUUID& participant_id);
- void refreshConversation();
- void buildConversationViewParticipant();
-
- void setSortOrder(const LLConversationSort& order);
- virtual void onTearOffClicked();
- void updateGearBtn();
- void initBtns();
- virtual void updateMessages() {}
- LLConversationItem* getCurSelectedViewModelItem();
- void forceReshape();
- virtual BOOL handleKeyHere( KEY key, MASK mask );
- bool isMessagePaneExpanded(){return mMessagePaneExpanded;}
- void setMessagePaneExpanded(bool expanded){mMessagePaneExpanded = expanded;}
- void restoreFloater();
- void saveCollapsedState();
-
- void updateChatIcon(const LLUUID& id);
-
- LLView* getChatHistory();
+ LOG_CLASS(LLFloaterIMSessionTab);
+
+ LLFloaterIMSessionTab(const LLSD& session_id);
+ ~LLFloaterIMSessionTab();
+
+ // reload all message with new settings of visual modes
+ static void processChatHistoryStyleUpdate(bool clean_messages = false);
+ static void reloadEmptyFloaters();
+
+ /**
+ * Returns true if chat is displayed in multi tabbed floater
+ * false if chat is displayed in multiple windows
+ */
+ static bool isChatMultiTab();
+
+ // add conversation to container
+ static void addToHost(const LLUUID& session_id);
+
+ bool isHostAttached() {return mIsHostAttached;}
+ void setHostAttached(bool is_attached) {mIsHostAttached = is_attached;}
+
+ static LLFloaterIMSessionTab* findConversation(const LLUUID& uuid);
+ static LLFloaterIMSessionTab* getConversation(const LLUUID& uuid);
+
+ bool isNearbyChat() {return mIsNearbyChat;}
+
+ // LLFloater overrides
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
+ /*virtual*/ void setVisible(BOOL visible);
+ /*virtual*/ void setFocus(BOOL focus);
+ /*virtual*/ void closeFloater(bool app_quitting = false);
+
+ // Handle the left hand participant list widgets
+ void addConversationViewParticipant(LLConversationItem* item, bool update_view = true);
+ void removeConversationViewParticipant(const LLUUID& participant_id);
+ void updateConversationViewParticipant(const LLUUID& participant_id);
+ void refreshConversation();
+ void buildConversationViewParticipant();
+
+ void setSortOrder(const LLConversationSort& order);
+ virtual void onTearOffClicked();
+ void updateGearBtn();
+ void initBtns();
+ virtual void updateMessages() {}
+ LLConversationItem* getCurSelectedViewModelItem();
+ void forceReshape();
+ virtual BOOL handleKeyHere( KEY key, MASK mask );
+ bool isMessagePaneExpanded(){return mMessagePaneExpanded;}
+ void setMessagePaneExpanded(bool expanded){mMessagePaneExpanded = expanded;}
+ void restoreFloater();
+ void saveCollapsedState();
+
+ void updateChatIcon(const LLUUID& id);
+
+ LLView* getChatHistory();
protected:
- // callback for click on any items of the visual states menu
- void onIMSessionMenuItemClicked(const LLSD& userdata);
-
- // callback for check/uncheck of the expanded/collapse mode's switcher
- bool onIMCompactExpandedMenuItemCheck(const LLSD& userdata);
-
- //
- bool onIMShowModesMenuItemCheck(const LLSD& userdata);
- bool onIMShowModesMenuItemEnable(const LLSD& userdata);
- static void onSlide(LLFloaterIMSessionTab *self);
- static void onCollapseToLine(LLFloaterIMSessionTab *self);
- void reshapeFloater(bool collapse);
-
- // refresh a visual state of the Call button
- void updateCallBtnState(bool callIsActive);
-
- void hideOrShowTitle(); // toggle the floater's drag handle
- void hideAllStandardButtons();
-
- /// Update floater header and toolbar buttons when hosted/torn off state is toggled.
- void updateHeaderAndToolbar();
-
- // Update the input field help text and other places that need the session name
- virtual void updateSessionName(const std::string& name);
-
- // set the enable/disable state for the Call button
- virtual void enableDisableCallBtn();
-
- // process focus events to set a currently active session
- /* virtual */ void onFocusReceived();
- /* virtual */ void onFocusLost();
-
- // prepare chat's params and out one message to chatHistory
- void appendMessage(const LLChat& chat, const LLSD& args = LLSD());
-
- std::string appendTime();
- void assignResizeLimits();
-
- void updateUsedEmojis(LLWString text);
-
- S32 mFloaterExtraWidth;
-
- bool mIsNearbyChat;
- bool mIsP2PChat;
-
- bool mMessagePaneExpanded;
- bool mIsParticipantListExpanded;
- S32 mMinFloaterHeight;
-
- LLIMModel::LLIMSession* mSession;
-
- // Participants list: model and view
- LLConversationViewParticipant* createConversationViewParticipant(LLConversationItem* item);
-
- LLUUID mSessionID;
- LLLayoutStack* mBodyStack;
- LLLayoutStack* mParticipantListAndHistoryStack;
- LLLayoutPanel* mParticipantListPanel; // add the widgets to that see mConversationsListPanel
- LLLayoutPanel* mRightPartPanel;
- LLLayoutPanel* mContentPanel;
- LLLayoutPanel* mToolbarPanel;
- LLLayoutPanel* mInputButtonPanel;
- LLLayoutPanel* mEmojiRecentPanel;
- LLTextBox* mEmojiRecentEmptyText;
- LLPanelEmojiComplete* mEmojiRecentIconsCtrl;
- LLParticipantList* getParticipantList();
- conversations_widgets_map mConversationsWidgets;
- LLConversationViewModel mConversationViewModel;
- LLFolderView* mConversationsRoot;
- LLScrollContainer* mScroller;
-
- LLChatHistory* mChatHistory;
- LLChatEntry* mInputEditor;
- LLLayoutPanel* mChatLayoutPanel;
- LLLayoutStack* mInputPanels;
-
- LLButton* mExpandCollapseLineBtn;
- LLButton* mExpandCollapseBtn;
- LLButton* mTearOffBtn;
- LLButton* mEmojiRecentPanelToggleBtn;
- LLButton* mEmojiPickerShowBtn;
- LLButton* mCloseBtn;
- LLButton* mGearBtn;
- LLButton* mAddBtn;
- LLButton* mVoiceButton;
+ // callback for click on any items of the visual states menu
+ void onIMSessionMenuItemClicked(const LLSD& userdata);
+
+ // callback for check/uncheck of the expanded/collapse mode's switcher
+ bool onIMCompactExpandedMenuItemCheck(const LLSD& userdata);
+
+ //
+ bool onIMShowModesMenuItemCheck(const LLSD& userdata);
+ bool onIMShowModesMenuItemEnable(const LLSD& userdata);
+ static void onSlide(LLFloaterIMSessionTab *self);
+ static void onCollapseToLine(LLFloaterIMSessionTab *self);
+ void reshapeFloater(bool collapse);
+
+ // refresh a visual state of the Call button
+ void updateCallBtnState(bool callIsActive);
+
+ void hideOrShowTitle(); // toggle the floater's drag handle
+ void hideAllStandardButtons();
+
+ /// Update floater header and toolbar buttons when hosted/torn off state is toggled.
+ void updateHeaderAndToolbar();
+
+ // Update the input field help text and other places that need the session name
+ virtual void updateSessionName(const std::string& name);
+
+ // set the enable/disable state for the Call button
+ virtual void enableDisableCallBtn();
+
+ // process focus events to set a currently active session
+ /* virtual */ void onFocusReceived();
+ /* virtual */ void onFocusLost();
+
+ // prepare chat's params and out one message to chatHistory
+ void appendMessage(const LLChat& chat, const LLSD& args = LLSD());
+
+ std::string appendTime();
+ void assignResizeLimits();
+
+ void updateUsedEmojis(LLWString text);
+
+ S32 mFloaterExtraWidth;
+
+ bool mIsNearbyChat;
+ bool mIsP2PChat;
+
+ bool mMessagePaneExpanded;
+ bool mIsParticipantListExpanded;
+ S32 mMinFloaterHeight;
+
+ LLIMModel::LLIMSession* mSession;
+
+ // Participants list: model and view
+ LLConversationViewParticipant* createConversationViewParticipant(LLConversationItem* item);
+
+ LLUUID mSessionID;
+ LLLayoutStack* mBodyStack;
+ LLLayoutStack* mParticipantListAndHistoryStack;
+ LLLayoutPanel* mParticipantListPanel; // add the widgets to that see mConversationsListPanel
+ LLLayoutPanel* mRightPartPanel;
+ LLLayoutPanel* mContentPanel;
+ LLLayoutPanel* mToolbarPanel;
+ LLLayoutPanel* mInputButtonPanel;
+ LLLayoutPanel* mEmojiRecentPanel;
+ LLTextBox* mEmojiRecentEmptyText;
+ LLPanelEmojiComplete* mEmojiRecentIconsCtrl;
+ LLParticipantList* getParticipantList();
+ conversations_widgets_map mConversationsWidgets;
+ LLConversationViewModel mConversationViewModel;
+ LLFolderView* mConversationsRoot;
+ LLScrollContainer* mScroller;
+
+ LLChatHistory* mChatHistory;
+ LLChatEntry* mInputEditor;
+ LLLayoutPanel* mChatLayoutPanel;
+ LLLayoutStack* mInputPanels;
+
+ LLButton* mExpandCollapseLineBtn;
+ LLButton* mExpandCollapseBtn;
+ LLButton* mTearOffBtn;
+ LLButton* mEmojiRecentPanelToggleBtn;
+ LLButton* mEmojiPickerShowBtn;
+ LLButton* mCloseBtn;
+ LLButton* mGearBtn;
+ LLButton* mAddBtn;
+ LLButton* mVoiceButton;
private:
- // Handling selection and contextual menu
- void doToSelected(const LLSD& userdata);
- bool enableContextMenuItem(const LLSD& userdata);
- bool checkContextMenuItem(const LLSD& userdata);
-
- void getSelectedUUIDs(uuid_vec_t& selected_uuids);
-
- /// Refreshes the floater at a constant rate.
- virtual void refresh() = 0;
-
- /**
- * Adjusts chat history height to fit vertically with input chat field
- * and avoid overlapping, since input chat field can be vertically expanded.
- * Implementation: chat history bottom "follows" top+top_pad of input chat field
- */
- void reshapeChatLayoutPanel();
-
- void onInputEditorClicked();
-
- void onEmojiRecentPanelToggleBtnClicked();
- void onEmojiPickerShowBtnClicked();
- void initEmojiRecentPanel();
- void onRecentEmojiPicked(const LLSD& value);
-
- bool checkIfTornOff();
- bool mIsHostAttached;
- bool mHasVisibleBeenInitialized;
-
- LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called.
-
- S32 mInputEditorPad;
- S32 mChatLayoutPanelHeight;
- S32 mFloaterHeight;
+ // Handling selection and contextual menu
+ void doToSelected(const LLSD& userdata);
+ bool enableContextMenuItem(const LLSD& userdata);
+ bool checkContextMenuItem(const LLSD& userdata);
+
+ void getSelectedUUIDs(uuid_vec_t& selected_uuids);
+
+ /// Refreshes the floater at a constant rate.
+ virtual void refresh() = 0;
+
+ /**
+ * Adjusts chat history height to fit vertically with input chat field
+ * and avoid overlapping, since input chat field can be vertically expanded.
+ * Implementation: chat history bottom "follows" top+top_pad of input chat field
+ */
+ void reshapeChatLayoutPanel();
+
+ void onInputEditorClicked();
+
+ void onEmojiRecentPanelToggleBtnClicked();
+ void onEmojiPickerShowBtnClicked();
+ void initEmojiRecentPanel();
+ void onRecentEmojiPicked(const LLSD& value);
+
+ bool checkIfTornOff();
+ bool mIsHostAttached;
+ bool mHasVisibleBeenInitialized;
+
+ LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called.
+
+ S32 mInputEditorPad;
+ S32 mChatLayoutPanelHeight;
+ S32 mFloaterHeight;
};
diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp
index 10088d20c2..7190bccb81 100644
--- a/indra/newview/llfloaterinspect.cpp
+++ b/indra/newview/llfloaterinspect.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterinspect.cpp
* @brief Floater for object inspection tool
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,306 +47,306 @@
LLFloaterInspect::LLFloaterInspect(const LLSD& key)
: LLFloater(key),
- mDirty(FALSE),
- mOwnerNameCacheConnection(),
- mCreatorNameCacheConnection()
+ mDirty(FALSE),
+ mOwnerNameCacheConnection(),
+ mCreatorNameCacheConnection()
{
- mCommitCallbackRegistrar.add("Inspect.OwnerProfile", boost::bind(&LLFloaterInspect::onClickOwnerProfile, this));
- mCommitCallbackRegistrar.add("Inspect.CreatorProfile", boost::bind(&LLFloaterInspect::onClickCreatorProfile, this));
- mCommitCallbackRegistrar.add("Inspect.SelectObject", boost::bind(&LLFloaterInspect::onSelectObject, this));
+ mCommitCallbackRegistrar.add("Inspect.OwnerProfile", boost::bind(&LLFloaterInspect::onClickOwnerProfile, this));
+ mCommitCallbackRegistrar.add("Inspect.CreatorProfile", boost::bind(&LLFloaterInspect::onClickCreatorProfile, this));
+ mCommitCallbackRegistrar.add("Inspect.SelectObject", boost::bind(&LLFloaterInspect::onSelectObject, this));
}
BOOL LLFloaterInspect::postBuild()
{
- mObjectList = getChild<LLScrollListCtrl>("object_list");
-// childSetAction("button owner",onClickOwnerProfile, this);
-// childSetAction("button creator",onClickCreatorProfile, this);
-// childSetCommitCallback("object_list", onSelectObject, NULL);
-
- refresh();
-
- return TRUE;
+ mObjectList = getChild<LLScrollListCtrl>("object_list");
+// childSetAction("button owner",onClickOwnerProfile, this);
+// childSetAction("button creator",onClickCreatorProfile, this);
+// childSetCommitCallback("object_list", onSelectObject, NULL);
+
+ refresh();
+
+ return TRUE;
}
LLFloaterInspect::~LLFloaterInspect(void)
{
- if (mOwnerNameCacheConnection.connected())
- {
- mOwnerNameCacheConnection.disconnect();
- }
- if (mCreatorNameCacheConnection.connected())
- {
- mCreatorNameCacheConnection.disconnect();
- }
- if(!LLFloaterReg::instanceVisible("build"))
- {
- if(LLToolMgr::getInstance()->getBaseTool() == LLToolCompInspect::getInstance())
- {
- LLToolMgr::getInstance()->clearTransientTool();
- }
- // Switch back to basic toolset
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- }
- else
- {
- LLFloaterReg::showInstance("build", LLSD(), TRUE);
- }
+ if (mOwnerNameCacheConnection.connected())
+ {
+ mOwnerNameCacheConnection.disconnect();
+ }
+ if (mCreatorNameCacheConnection.connected())
+ {
+ mCreatorNameCacheConnection.disconnect();
+ }
+ if(!LLFloaterReg::instanceVisible("build"))
+ {
+ if(LLToolMgr::getInstance()->getBaseTool() == LLToolCompInspect::getInstance())
+ {
+ LLToolMgr::getInstance()->clearTransientTool();
+ }
+ // Switch back to basic toolset
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ }
+ else
+ {
+ LLFloaterReg::showInstance("build", LLSD(), TRUE);
+ }
}
void LLFloaterInspect::onOpen(const LLSD& key)
{
- BOOL forcesel = LLSelectMgr::getInstance()->setForceSelection(TRUE);
- LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance());
- LLSelectMgr::getInstance()->setForceSelection(forcesel); // restore previouis value
- mObjectSelection = LLSelectMgr::getInstance()->getSelection();
- refresh();
+ BOOL forcesel = LLSelectMgr::getInstance()->setForceSelection(TRUE);
+ LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance());
+ LLSelectMgr::getInstance()->setForceSelection(forcesel); // restore previouis value
+ mObjectSelection = LLSelectMgr::getInstance()->getSelection();
+ refresh();
}
void LLFloaterInspect::onClickCreatorProfile()
{
- if(mObjectList->getAllSelected().size() == 0)
- {
- return;
- }
- LLScrollListItem* first_selected =mObjectList->getFirstSelected();
+ if(mObjectList->getAllSelected().size() == 0)
+ {
+ return;
+ }
+ LLScrollListItem* first_selected =mObjectList->getFirstSelected();
- if (first_selected)
- {
- struct f : public LLSelectedNodeFunctor
- {
- LLUUID obj_id;
- f(const LLUUID& id) : obj_id(id) {}
- virtual bool apply(LLSelectNode* node)
- {
- return (obj_id == node->getObject()->getID());
- }
- } func(first_selected->getUUID());
- LLSelectNode* node = mObjectSelection->getFirstNode(&func);
- if(node)
- {
- LLAvatarActions::showProfile(node->mPermissions->getCreator());
- }
- }
+ if (first_selected)
+ {
+ struct f : public LLSelectedNodeFunctor
+ {
+ LLUUID obj_id;
+ f(const LLUUID& id) : obj_id(id) {}
+ virtual bool apply(LLSelectNode* node)
+ {
+ return (obj_id == node->getObject()->getID());
+ }
+ } func(first_selected->getUUID());
+ LLSelectNode* node = mObjectSelection->getFirstNode(&func);
+ if(node)
+ {
+ LLAvatarActions::showProfile(node->mPermissions->getCreator());
+ }
+ }
}
void LLFloaterInspect::onClickOwnerProfile()
{
- if(mObjectList->getAllSelected().size() == 0) return;
- LLScrollListItem* first_selected =mObjectList->getFirstSelected();
+ if(mObjectList->getAllSelected().size() == 0) return;
+ LLScrollListItem* first_selected =mObjectList->getFirstSelected();
- if (first_selected)
- {
- LLUUID selected_id = first_selected->getUUID();
- struct f : public LLSelectedNodeFunctor
- {
- LLUUID obj_id;
- f(const LLUUID& id) : obj_id(id) {}
- virtual bool apply(LLSelectNode* node)
- {
- return (obj_id == node->getObject()->getID());
- }
- } func(selected_id);
- LLSelectNode* node = mObjectSelection->getFirstNode(&func);
- if(node)
- {
- if(node->mPermissions->isGroupOwned())
- {
- const LLUUID& idGroup = node->mPermissions->getGroup();
- LLGroupActions::show(idGroup);
- }
- else
- {
- const LLUUID& owner_id = node->mPermissions->getOwner();
- LLAvatarActions::showProfile(owner_id);
- }
+ if (first_selected)
+ {
+ LLUUID selected_id = first_selected->getUUID();
+ struct f : public LLSelectedNodeFunctor
+ {
+ LLUUID obj_id;
+ f(const LLUUID& id) : obj_id(id) {}
+ virtual bool apply(LLSelectNode* node)
+ {
+ return (obj_id == node->getObject()->getID());
+ }
+ } func(selected_id);
+ LLSelectNode* node = mObjectSelection->getFirstNode(&func);
+ if(node)
+ {
+ if(node->mPermissions->isGroupOwned())
+ {
+ const LLUUID& idGroup = node->mPermissions->getGroup();
+ LLGroupActions::show(idGroup);
+ }
+ else
+ {
+ const LLUUID& owner_id = node->mPermissions->getOwner();
+ LLAvatarActions::showProfile(owner_id);
+ }
- }
- }
+ }
+ }
}
void LLFloaterInspect::onSelectObject()
{
- if(LLFloaterInspect::getSelectedUUID() != LLUUID::null)
- {
- getChildView("button owner")->setEnabled(true);
- getChildView("button creator")->setEnabled(true);
- }
+ if(LLFloaterInspect::getSelectedUUID() != LLUUID::null)
+ {
+ getChildView("button owner")->setEnabled(true);
+ getChildView("button creator")->setEnabled(true);
+ }
}
LLUUID LLFloaterInspect::getSelectedUUID()
{
- if(mObjectList->getAllSelected().size() > 0)
- {
- LLScrollListItem* first_selected =mObjectList->getFirstSelected();
- if (first_selected)
- {
- return first_selected->getUUID();
- }
-
- }
- return LLUUID::null;
+ if(mObjectList->getAllSelected().size() > 0)
+ {
+ LLScrollListItem* first_selected =mObjectList->getFirstSelected();
+ if (first_selected)
+ {
+ return first_selected->getUUID();
+ }
+
+ }
+ return LLUUID::null;
}
void LLFloaterInspect::refresh()
{
- LLUUID creator_id;
- std::string creator_name;
- S32 pos = mObjectList->getScrollPos();
- getChildView("button owner")->setEnabled(false);
- getChildView("button creator")->setEnabled(false);
- LLUUID selected_uuid;
- S32 selected_index = mObjectList->getFirstSelectedIndex();
- if(selected_index > -1)
- {
- LLScrollListItem* first_selected =
- mObjectList->getFirstSelected();
- if (first_selected)
- {
- selected_uuid = first_selected->getUUID();
- }
- }
- mObjectList->operateOnAll(LLScrollListCtrl::OP_DELETE);
- //List all transient objects, then all linked objects
+ LLUUID creator_id;
+ std::string creator_name;
+ S32 pos = mObjectList->getScrollPos();
+ getChildView("button owner")->setEnabled(false);
+ getChildView("button creator")->setEnabled(false);
+ LLUUID selected_uuid;
+ S32 selected_index = mObjectList->getFirstSelectedIndex();
+ if(selected_index > -1)
+ {
+ LLScrollListItem* first_selected =
+ mObjectList->getFirstSelected();
+ if (first_selected)
+ {
+ selected_uuid = first_selected->getUUID();
+ }
+ }
+ mObjectList->operateOnAll(LLScrollListCtrl::OP_DELETE);
+ //List all transient objects, then all linked objects
+
+ for (LLObjectSelection::valid_iterator iter = mObjectSelection->valid_begin();
+ iter != mObjectSelection->valid_end(); iter++)
+ {
+ LLSelectNode* obj = *iter;
+ LLSD row;
+ std::string owner_name, creator_name;
- for (LLObjectSelection::valid_iterator iter = mObjectSelection->valid_begin();
- iter != mObjectSelection->valid_end(); iter++)
- {
- LLSelectNode* obj = *iter;
- LLSD row;
- std::string owner_name, creator_name;
+ if (obj->mCreationDate == 0)
+ { // Don't have valid information from the server, so skip this one
+ continue;
+ }
- if (obj->mCreationDate == 0)
- { // Don't have valid information from the server, so skip this one
- continue;
- }
+ time_t timestamp = (time_t) (obj->mCreationDate/1000000);
+ std::string timeStr = getString("timeStamp");
+ LLSD substitution;
+ substitution["datetime"] = (S32) timestamp;
+ LLStringUtil::format (timeStr, substitution);
- time_t timestamp = (time_t) (obj->mCreationDate/1000000);
- std::string timeStr = getString("timeStamp");
- LLSD substitution;
- substitution["datetime"] = (S32) timestamp;
- LLStringUtil::format (timeStr, substitution);
+ const LLUUID& idOwner = obj->mPermissions->getOwner();
+ const LLUUID& idCreator = obj->mPermissions->getCreator();
+ LLAvatarName av_name;
- const LLUUID& idOwner = obj->mPermissions->getOwner();
- const LLUUID& idCreator = obj->mPermissions->getCreator();
- LLAvatarName av_name;
+ if(obj->mPermissions->isGroupOwned())
+ {
+ std::string group_name;
+ const LLUUID& idGroup = obj->mPermissions->getGroup();
+ if(gCacheName->getGroupName(idGroup, group_name))
+ {
+ owner_name = "[" + group_name + "] (group)";
+ }
+ else
+ {
+ owner_name = LLTrans::getString("RetrievingData");
+ if (mOwnerNameCacheConnection.connected())
+ {
+ mOwnerNameCacheConnection.disconnect();
+ }
+ mOwnerNameCacheConnection = gCacheName->getGroup(idGroup, boost::bind(&LLFloaterInspect::onGetOwnerNameCallback, this));
+ }
+ }
+ else
+ {
+ // Only work with the names if we actually get a result
+ // from the name cache. If not, defer setting the
+ // actual name and set a placeholder.
+ if (LLAvatarNameCache::get(idOwner, &av_name))
+ {
+ owner_name = av_name.getCompleteName();
+ }
+ else
+ {
+ owner_name = LLTrans::getString("RetrievingData");
+ if (mOwnerNameCacheConnection.connected())
+ {
+ mOwnerNameCacheConnection.disconnect();
+ }
+ mOwnerNameCacheConnection = LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetOwnerNameCallback, this));
+ }
+ }
- if(obj->mPermissions->isGroupOwned())
- {
- std::string group_name;
- const LLUUID& idGroup = obj->mPermissions->getGroup();
- if(gCacheName->getGroupName(idGroup, group_name))
- {
- owner_name = "[" + group_name + "] (group)";
- }
- else
- {
- owner_name = LLTrans::getString("RetrievingData");
- if (mOwnerNameCacheConnection.connected())
- {
- mOwnerNameCacheConnection.disconnect();
- }
- mOwnerNameCacheConnection = gCacheName->getGroup(idGroup, boost::bind(&LLFloaterInspect::onGetOwnerNameCallback, this));
- }
- }
- else
- {
- // Only work with the names if we actually get a result
- // from the name cache. If not, defer setting the
- // actual name and set a placeholder.
- if (LLAvatarNameCache::get(idOwner, &av_name))
- {
- owner_name = av_name.getCompleteName();
- }
- else
- {
- owner_name = LLTrans::getString("RetrievingData");
- if (mOwnerNameCacheConnection.connected())
- {
- mOwnerNameCacheConnection.disconnect();
- }
- mOwnerNameCacheConnection = LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetOwnerNameCallback, this));
- }
- }
+ if (LLAvatarNameCache::get(idCreator, &av_name))
+ {
+ creator_name = av_name.getCompleteName();
+ }
+ else
+ {
+ creator_name = LLTrans::getString("RetrievingData");
+ if (mCreatorNameCacheConnection.connected())
+ {
+ mCreatorNameCacheConnection.disconnect();
+ }
+ mCreatorNameCacheConnection = LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetCreatorNameCallback, this));
+ }
- if (LLAvatarNameCache::get(idCreator, &av_name))
- {
- creator_name = av_name.getCompleteName();
- }
- else
- {
- creator_name = LLTrans::getString("RetrievingData");
- if (mCreatorNameCacheConnection.connected())
- {
- mCreatorNameCacheConnection.disconnect();
- }
- mCreatorNameCacheConnection = LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetCreatorNameCallback, this));
- }
-
- row["id"] = obj->getObject()->getID();
- row["columns"][0]["column"] = "object_name";
- row["columns"][0]["type"] = "text";
- // make sure we're either at the top of the link chain
- // or top of the editable chain, for attachments
- if(!(obj->getObject()->isRoot() || obj->getObject()->isRootEdit()))
- {
- row["columns"][0]["value"] = std::string(" ") + obj->mName;
- }
- else
- {
- row["columns"][0]["value"] = obj->mName;
- }
- row["columns"][1]["column"] = "owner_name";
- row["columns"][1]["type"] = "text";
- row["columns"][1]["value"] = owner_name;
- row["columns"][2]["column"] = "creator_name";
- row["columns"][2]["type"] = "text";
- row["columns"][2]["value"] = creator_name;
- row["columns"][3]["column"] = "creation_date";
- row["columns"][3]["type"] = "text";
- row["columns"][3]["value"] = timeStr;
- mObjectList->addElement(row, ADD_TOP);
- }
- if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index)
- {
- mObjectList->selectNthItem(selected_index);
- }
- else
- {
- mObjectList->selectNthItem(0);
- }
- onSelectObject();
- mObjectList->setScrollPos(pos);
+ row["id"] = obj->getObject()->getID();
+ row["columns"][0]["column"] = "object_name";
+ row["columns"][0]["type"] = "text";
+ // make sure we're either at the top of the link chain
+ // or top of the editable chain, for attachments
+ if(!(obj->getObject()->isRoot() || obj->getObject()->isRootEdit()))
+ {
+ row["columns"][0]["value"] = std::string(" ") + obj->mName;
+ }
+ else
+ {
+ row["columns"][0]["value"] = obj->mName;
+ }
+ row["columns"][1]["column"] = "owner_name";
+ row["columns"][1]["type"] = "text";
+ row["columns"][1]["value"] = owner_name;
+ row["columns"][2]["column"] = "creator_name";
+ row["columns"][2]["type"] = "text";
+ row["columns"][2]["value"] = creator_name;
+ row["columns"][3]["column"] = "creation_date";
+ row["columns"][3]["type"] = "text";
+ row["columns"][3]["value"] = timeStr;
+ mObjectList->addElement(row, ADD_TOP);
+ }
+ if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index)
+ {
+ mObjectList->selectNthItem(selected_index);
+ }
+ else
+ {
+ mObjectList->selectNthItem(0);
+ }
+ onSelectObject();
+ mObjectList->setScrollPos(pos);
}
void LLFloaterInspect::onFocusReceived()
{
- LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance());
- LLFloater::onFocusReceived();
+ LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance());
+ LLFloater::onFocusReceived();
}
void LLFloaterInspect::dirty()
{
- setDirty();
+ setDirty();
}
void LLFloaterInspect::onGetOwnerNameCallback()
{
- mOwnerNameCacheConnection.disconnect();
- setDirty();
+ mOwnerNameCacheConnection.disconnect();
+ setDirty();
}
void LLFloaterInspect::onGetCreatorNameCallback()
{
- mCreatorNameCacheConnection.disconnect();
- setDirty();
+ mCreatorNameCacheConnection.disconnect();
+ setDirty();
}
void LLFloaterInspect::draw()
{
- if (mDirty)
- {
- refresh();
- mDirty = FALSE;
- }
+ if (mDirty)
+ {
+ refresh();
+ mDirty = FALSE;
+ }
- LLFloater::draw();
+ LLFloater::draw();
}
diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h
index 44381eac96..a18aba1155 100644
--- a/indra/newview/llfloaterinspect.h
+++ b/indra/newview/llfloaterinspect.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterinspect.h
* @author Cube
* @date 2006-12-16
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,38 +39,38 @@ class LLUICtrl;
class LLFloaterInspect : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
-// static void show(void* ignored = NULL);
- void onOpen(const LLSD& key);
- virtual BOOL postBuild();
- void dirty();
- LLUUID getSelectedUUID();
- virtual void draw();
- virtual void refresh();
-// static BOOL isVisible();
- virtual void onFocusReceived();
- void onClickCreatorProfile();
- void onClickOwnerProfile();
- void onSelectObject();
+// static void show(void* ignored = NULL);
+ void onOpen(const LLSD& key);
+ virtual BOOL postBuild();
+ void dirty();
+ LLUUID getSelectedUUID();
+ virtual void draw();
+ virtual void refresh();
+// static BOOL isVisible();
+ virtual void onFocusReceived();
+ void onClickCreatorProfile();
+ void onClickOwnerProfile();
+ void onSelectObject();
- LLScrollListCtrl* mObjectList;
+ LLScrollListCtrl* mObjectList;
protected:
- // protected members
- void setDirty() { mDirty = TRUE; }
- bool mDirty;
+ // protected members
+ void setDirty() { mDirty = TRUE; }
+ bool mDirty;
private:
- void onGetOwnerNameCallback();
- void onGetCreatorNameCallback();
-
- LLFloaterInspect(const LLSD& key);
- virtual ~LLFloaterInspect(void);
+ void onGetOwnerNameCallback();
+ void onGetCreatorNameCallback();
+
+ LLFloaterInspect(const LLSD& key);
+ virtual ~LLFloaterInspect(void);
- LLSafeHandle<LLObjectSelection> mObjectSelection;
- boost::signals2::connection mOwnerNameCacheConnection;
- boost::signals2::connection mCreatorNameCacheConnection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
+ boost::signals2::connection mOwnerNameCacheConnection;
+ boost::signals2::connection mCreatorNameCacheConnection;
};
#endif //LL_LLFLOATERINSPECT_H
diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp
index 558b14bba7..ca0a506802 100644
--- a/indra/newview/llfloaterjoystick.cpp
+++ b/indra/newview/llfloaterjoystick.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterjoystick.cpp
* @brief Joystick preferences panel
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,20 +52,20 @@
#include <dinput.h>
#endif
-static LLTrace::SampleStatHandle<> sJoystickAxis0("Joystick axis 0"),
- sJoystickAxis1("Joystick axis 1"),
- sJoystickAxis2("Joystick axis 2"),
- sJoystickAxis3("Joystick axis 3"),
- sJoystickAxis4("Joystick axis 4"),
- sJoystickAxis5("Joystick axis 5");
-static LLTrace::SampleStatHandle<>* sJoystickAxes[6] =
+static LLTrace::SampleStatHandle<> sJoystickAxis0("Joystick axis 0"),
+ sJoystickAxis1("Joystick axis 1"),
+ sJoystickAxis2("Joystick axis 2"),
+ sJoystickAxis3("Joystick axis 3"),
+ sJoystickAxis4("Joystick axis 4"),
+ sJoystickAxis5("Joystick axis 5");
+static LLTrace::SampleStatHandle<>* sJoystickAxes[6] =
{
- &sJoystickAxis0,
- &sJoystickAxis1,
- &sJoystickAxis2,
- &sJoystickAxis3,
- &sJoystickAxis4,
- &sJoystickAxis5
+ &sJoystickAxis0,
+ &sJoystickAxis1,
+ &sJoystickAxis2,
+ &sJoystickAxis3,
+ &sJoystickAxis4,
+ &sJoystickAxis5
};
@@ -93,7 +93,7 @@ BOOL CALLBACK di8_list_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr,
#endif
LLFloaterJoystick::LLFloaterJoystick(const LLSD& data)
- : LLFloater(data),
+ : LLFloater(data),
mHasDeviceList(false)
{
if (!LLViewerJoystick::getInstance()->isJoystickInitialized())
@@ -101,7 +101,7 @@ LLFloaterJoystick::LLFloaterJoystick(const LLSD& data)
LLViewerJoystick::getInstance()->init(false);
}
- initFromSettings();
+ initFromSettings();
}
void LLFloaterJoystick::draw()
@@ -113,59 +113,59 @@ void LLFloaterJoystick::draw()
refreshListOfDevices();
}
- for (U32 i = 0; i < 6; i++)
- {
- F32 value = joystick->getJoystickAxis(i);
- sample(*sJoystickAxes[i], value * gFrameIntervalSeconds.value());
- if (mAxisStatsBar[i])
- {
- F32 minbar, maxbar;
- mAxisStatsBar[i]->getRange(minbar, maxbar);
- if (llabs(value) > maxbar)
- {
- F32 range = llabs(value);
- mAxisStatsBar[i]->setRange(-range, range);
- }
- }
- }
-
- LLFloater::draw();
+ for (U32 i = 0; i < 6; i++)
+ {
+ F32 value = joystick->getJoystickAxis(i);
+ sample(*sJoystickAxes[i], value * gFrameIntervalSeconds.value());
+ if (mAxisStatsBar[i])
+ {
+ F32 minbar, maxbar;
+ mAxisStatsBar[i]->getRange(minbar, maxbar);
+ if (llabs(value) > maxbar)
+ {
+ F32 range = llabs(value);
+ mAxisStatsBar[i]->setRange(-range, range);
+ }
+ }
+ }
+
+ LLFloater::draw();
}
BOOL LLFloaterJoystick::postBuild()
-{
- center();
- F32 range = gSavedSettings.getBOOL("Cursor3D") ? 128.f : 2.f;
-
- for (U32 i = 0; i < 6; i++)
- {
- std::string stat_name(llformat("Joystick axis %d", i));
- std::string axisname = llformat("axis%d", i);
- mAxisStatsBar[i] = getChild<LLStatBar>(axisname);
- if (mAxisStatsBar[i])
- {
- mAxisStatsBar[i]->setStat(stat_name);
- mAxisStatsBar[i]->setRange(-range, range);
- }
- }
-
- mJoysticksCombo = getChild<LLComboBox>("joystick_combo");
- childSetCommitCallback("joystick_combo",onCommitJoystickEnabled,this);
- mCheckFlycamEnabled = getChild<LLCheckBoxCtrl>("JoystickFlycamEnabled");
- childSetCommitCallback("JoystickFlycamEnabled",onCommitJoystickEnabled,this);
-
- childSetAction("SpaceNavigatorDefaults", onClickRestoreSNDefaults, this);
- childSetAction("cancel_btn", onClickCancel, this);
- childSetAction("ok_btn", onClickOK, this);
-
- refresh();
- refreshListOfDevices();
- return TRUE;
+{
+ center();
+ F32 range = gSavedSettings.getBOOL("Cursor3D") ? 128.f : 2.f;
+
+ for (U32 i = 0; i < 6; i++)
+ {
+ std::string stat_name(llformat("Joystick axis %d", i));
+ std::string axisname = llformat("axis%d", i);
+ mAxisStatsBar[i] = getChild<LLStatBar>(axisname);
+ if (mAxisStatsBar[i])
+ {
+ mAxisStatsBar[i]->setStat(stat_name);
+ mAxisStatsBar[i]->setRange(-range, range);
+ }
+ }
+
+ mJoysticksCombo = getChild<LLComboBox>("joystick_combo");
+ childSetCommitCallback("joystick_combo",onCommitJoystickEnabled,this);
+ mCheckFlycamEnabled = getChild<LLCheckBoxCtrl>("JoystickFlycamEnabled");
+ childSetCommitCallback("JoystickFlycamEnabled",onCommitJoystickEnabled,this);
+
+ childSetAction("SpaceNavigatorDefaults", onClickRestoreSNDefaults, this);
+ childSetAction("cancel_btn", onClickCancel, this);
+ childSetAction("ok_btn", onClickOK, this);
+
+ refresh();
+ refreshListOfDevices();
+ return TRUE;
}
LLFloaterJoystick::~LLFloaterJoystick()
{
- // Children all cleaned up by default view destructor.
+ // Children all cleaned up by default view destructor.
}
@@ -175,79 +175,79 @@ void LLFloaterJoystick::apply()
void LLFloaterJoystick::initFromSettings()
{
- mJoystickEnabled = gSavedSettings.getBOOL("JoystickEnabled");
- mJoystickId = gSavedSettings.getLLSD("JoystickDeviceUUID");
-
- mJoystickAxis[0] = gSavedSettings.getS32("JoystickAxis0");
- mJoystickAxis[1] = gSavedSettings.getS32("JoystickAxis1");
- mJoystickAxis[2] = gSavedSettings.getS32("JoystickAxis2");
- mJoystickAxis[3] = gSavedSettings.getS32("JoystickAxis3");
- mJoystickAxis[4] = gSavedSettings.getS32("JoystickAxis4");
- mJoystickAxis[5] = gSavedSettings.getS32("JoystickAxis5");
- mJoystickAxis[6] = gSavedSettings.getS32("JoystickAxis6");
-
- m3DCursor = gSavedSettings.getBOOL("Cursor3D");
- mAutoLeveling = gSavedSettings.getBOOL("AutoLeveling");
- mZoomDirect = gSavedSettings.getBOOL("ZoomDirect");
-
- mAvatarEnabled = gSavedSettings.getBOOL("JoystickAvatarEnabled");
- mBuildEnabled = gSavedSettings.getBOOL("JoystickBuildEnabled");
- mFlycamEnabled = gSavedSettings.getBOOL("JoystickFlycamEnabled");
-
- mAvatarAxisScale[0] = gSavedSettings.getF32("AvatarAxisScale0");
- mAvatarAxisScale[1] = gSavedSettings.getF32("AvatarAxisScale1");
- mAvatarAxisScale[2] = gSavedSettings.getF32("AvatarAxisScale2");
- mAvatarAxisScale[3] = gSavedSettings.getF32("AvatarAxisScale3");
- mAvatarAxisScale[4] = gSavedSettings.getF32("AvatarAxisScale4");
- mAvatarAxisScale[5] = gSavedSettings.getF32("AvatarAxisScale5");
-
- mBuildAxisScale[0] = gSavedSettings.getF32("BuildAxisScale0");
- mBuildAxisScale[1] = gSavedSettings.getF32("BuildAxisScale1");
- mBuildAxisScale[2] = gSavedSettings.getF32("BuildAxisScale2");
- mBuildAxisScale[3] = gSavedSettings.getF32("BuildAxisScale3");
- mBuildAxisScale[4] = gSavedSettings.getF32("BuildAxisScale4");
- mBuildAxisScale[5] = gSavedSettings.getF32("BuildAxisScale5");
-
- mFlycamAxisScale[0] = gSavedSettings.getF32("FlycamAxisScale0");
- mFlycamAxisScale[1] = gSavedSettings.getF32("FlycamAxisScale1");
- mFlycamAxisScale[2] = gSavedSettings.getF32("FlycamAxisScale2");
- mFlycamAxisScale[3] = gSavedSettings.getF32("FlycamAxisScale3");
- mFlycamAxisScale[4] = gSavedSettings.getF32("FlycamAxisScale4");
- mFlycamAxisScale[5] = gSavedSettings.getF32("FlycamAxisScale5");
- mFlycamAxisScale[6] = gSavedSettings.getF32("FlycamAxisScale6");
-
- mAvatarAxisDeadZone[0] = gSavedSettings.getF32("AvatarAxisDeadZone0");
- mAvatarAxisDeadZone[1] = gSavedSettings.getF32("AvatarAxisDeadZone1");
- mAvatarAxisDeadZone[2] = gSavedSettings.getF32("AvatarAxisDeadZone2");
- mAvatarAxisDeadZone[3] = gSavedSettings.getF32("AvatarAxisDeadZone3");
- mAvatarAxisDeadZone[4] = gSavedSettings.getF32("AvatarAxisDeadZone4");
- mAvatarAxisDeadZone[5] = gSavedSettings.getF32("AvatarAxisDeadZone5");
-
- mBuildAxisDeadZone[0] = gSavedSettings.getF32("BuildAxisDeadZone0");
- mBuildAxisDeadZone[1] = gSavedSettings.getF32("BuildAxisDeadZone1");
- mBuildAxisDeadZone[2] = gSavedSettings.getF32("BuildAxisDeadZone2");
- mBuildAxisDeadZone[3] = gSavedSettings.getF32("BuildAxisDeadZone3");
- mBuildAxisDeadZone[4] = gSavedSettings.getF32("BuildAxisDeadZone4");
- mBuildAxisDeadZone[5] = gSavedSettings.getF32("BuildAxisDeadZone5");
-
- mFlycamAxisDeadZone[0] = gSavedSettings.getF32("FlycamAxisDeadZone0");
- mFlycamAxisDeadZone[1] = gSavedSettings.getF32("FlycamAxisDeadZone1");
- mFlycamAxisDeadZone[2] = gSavedSettings.getF32("FlycamAxisDeadZone2");
- mFlycamAxisDeadZone[3] = gSavedSettings.getF32("FlycamAxisDeadZone3");
- mFlycamAxisDeadZone[4] = gSavedSettings.getF32("FlycamAxisDeadZone4");
- mFlycamAxisDeadZone[5] = gSavedSettings.getF32("FlycamAxisDeadZone5");
- mFlycamAxisDeadZone[6] = gSavedSettings.getF32("FlycamAxisDeadZone6");
-
- mAvatarFeathering = gSavedSettings.getF32("AvatarFeathering");
- mBuildFeathering = gSavedSettings.getF32("BuildFeathering");
- mFlycamFeathering = gSavedSettings.getF32("FlycamFeathering");
+ mJoystickEnabled = gSavedSettings.getBOOL("JoystickEnabled");
+ mJoystickId = gSavedSettings.getLLSD("JoystickDeviceUUID");
+
+ mJoystickAxis[0] = gSavedSettings.getS32("JoystickAxis0");
+ mJoystickAxis[1] = gSavedSettings.getS32("JoystickAxis1");
+ mJoystickAxis[2] = gSavedSettings.getS32("JoystickAxis2");
+ mJoystickAxis[3] = gSavedSettings.getS32("JoystickAxis3");
+ mJoystickAxis[4] = gSavedSettings.getS32("JoystickAxis4");
+ mJoystickAxis[5] = gSavedSettings.getS32("JoystickAxis5");
+ mJoystickAxis[6] = gSavedSettings.getS32("JoystickAxis6");
+
+ m3DCursor = gSavedSettings.getBOOL("Cursor3D");
+ mAutoLeveling = gSavedSettings.getBOOL("AutoLeveling");
+ mZoomDirect = gSavedSettings.getBOOL("ZoomDirect");
+
+ mAvatarEnabled = gSavedSettings.getBOOL("JoystickAvatarEnabled");
+ mBuildEnabled = gSavedSettings.getBOOL("JoystickBuildEnabled");
+ mFlycamEnabled = gSavedSettings.getBOOL("JoystickFlycamEnabled");
+
+ mAvatarAxisScale[0] = gSavedSettings.getF32("AvatarAxisScale0");
+ mAvatarAxisScale[1] = gSavedSettings.getF32("AvatarAxisScale1");
+ mAvatarAxisScale[2] = gSavedSettings.getF32("AvatarAxisScale2");
+ mAvatarAxisScale[3] = gSavedSettings.getF32("AvatarAxisScale3");
+ mAvatarAxisScale[4] = gSavedSettings.getF32("AvatarAxisScale4");
+ mAvatarAxisScale[5] = gSavedSettings.getF32("AvatarAxisScale5");
+
+ mBuildAxisScale[0] = gSavedSettings.getF32("BuildAxisScale0");
+ mBuildAxisScale[1] = gSavedSettings.getF32("BuildAxisScale1");
+ mBuildAxisScale[2] = gSavedSettings.getF32("BuildAxisScale2");
+ mBuildAxisScale[3] = gSavedSettings.getF32("BuildAxisScale3");
+ mBuildAxisScale[4] = gSavedSettings.getF32("BuildAxisScale4");
+ mBuildAxisScale[5] = gSavedSettings.getF32("BuildAxisScale5");
+
+ mFlycamAxisScale[0] = gSavedSettings.getF32("FlycamAxisScale0");
+ mFlycamAxisScale[1] = gSavedSettings.getF32("FlycamAxisScale1");
+ mFlycamAxisScale[2] = gSavedSettings.getF32("FlycamAxisScale2");
+ mFlycamAxisScale[3] = gSavedSettings.getF32("FlycamAxisScale3");
+ mFlycamAxisScale[4] = gSavedSettings.getF32("FlycamAxisScale4");
+ mFlycamAxisScale[5] = gSavedSettings.getF32("FlycamAxisScale5");
+ mFlycamAxisScale[6] = gSavedSettings.getF32("FlycamAxisScale6");
+
+ mAvatarAxisDeadZone[0] = gSavedSettings.getF32("AvatarAxisDeadZone0");
+ mAvatarAxisDeadZone[1] = gSavedSettings.getF32("AvatarAxisDeadZone1");
+ mAvatarAxisDeadZone[2] = gSavedSettings.getF32("AvatarAxisDeadZone2");
+ mAvatarAxisDeadZone[3] = gSavedSettings.getF32("AvatarAxisDeadZone3");
+ mAvatarAxisDeadZone[4] = gSavedSettings.getF32("AvatarAxisDeadZone4");
+ mAvatarAxisDeadZone[5] = gSavedSettings.getF32("AvatarAxisDeadZone5");
+
+ mBuildAxisDeadZone[0] = gSavedSettings.getF32("BuildAxisDeadZone0");
+ mBuildAxisDeadZone[1] = gSavedSettings.getF32("BuildAxisDeadZone1");
+ mBuildAxisDeadZone[2] = gSavedSettings.getF32("BuildAxisDeadZone2");
+ mBuildAxisDeadZone[3] = gSavedSettings.getF32("BuildAxisDeadZone3");
+ mBuildAxisDeadZone[4] = gSavedSettings.getF32("BuildAxisDeadZone4");
+ mBuildAxisDeadZone[5] = gSavedSettings.getF32("BuildAxisDeadZone5");
+
+ mFlycamAxisDeadZone[0] = gSavedSettings.getF32("FlycamAxisDeadZone0");
+ mFlycamAxisDeadZone[1] = gSavedSettings.getF32("FlycamAxisDeadZone1");
+ mFlycamAxisDeadZone[2] = gSavedSettings.getF32("FlycamAxisDeadZone2");
+ mFlycamAxisDeadZone[3] = gSavedSettings.getF32("FlycamAxisDeadZone3");
+ mFlycamAxisDeadZone[4] = gSavedSettings.getF32("FlycamAxisDeadZone4");
+ mFlycamAxisDeadZone[5] = gSavedSettings.getF32("FlycamAxisDeadZone5");
+ mFlycamAxisDeadZone[6] = gSavedSettings.getF32("FlycamAxisDeadZone6");
+
+ mAvatarFeathering = gSavedSettings.getF32("AvatarFeathering");
+ mBuildFeathering = gSavedSettings.getF32("BuildFeathering");
+ mFlycamFeathering = gSavedSettings.getF32("FlycamFeathering");
}
void LLFloaterJoystick::refresh()
{
- LLFloater::refresh();
+ LLFloater::refresh();
- initFromSettings();
+ initFromSettings();
}
void LLFloaterJoystick::addDevice(std::string &name, LLSD& value)
@@ -263,7 +263,7 @@ void LLFloaterJoystick::refreshListOfDevices()
addDevice(no_device, value);
mHasDeviceList = false;
-
+
// di8_devices_callback callback is immediate and happens in scope of getInputDevices()
#if LL_WINDOWS && !LL_MESA_HEADLESS
// space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib
@@ -318,77 +318,77 @@ void LLFloaterJoystick::refreshListOfDevices()
void LLFloaterJoystick::cancel()
{
- gSavedSettings.setBOOL("JoystickEnabled", mJoystickEnabled);
- gSavedSettings.setLLSD("JoystickDeviceUUID", mJoystickId);
-
- gSavedSettings.setS32("JoystickAxis0", mJoystickAxis[0]);
- gSavedSettings.setS32("JoystickAxis1", mJoystickAxis[1]);
- gSavedSettings.setS32("JoystickAxis2", mJoystickAxis[2]);
- gSavedSettings.setS32("JoystickAxis3", mJoystickAxis[3]);
- gSavedSettings.setS32("JoystickAxis4", mJoystickAxis[4]);
- gSavedSettings.setS32("JoystickAxis5", mJoystickAxis[5]);
- gSavedSettings.setS32("JoystickAxis6", mJoystickAxis[6]);
-
- gSavedSettings.setBOOL("Cursor3D", m3DCursor);
- gSavedSettings.setBOOL("AutoLeveling", mAutoLeveling);
- gSavedSettings.setBOOL("ZoomDirect", mZoomDirect );
-
- gSavedSettings.setBOOL("JoystickAvatarEnabled", mAvatarEnabled);
- gSavedSettings.setBOOL("JoystickBuildEnabled", mBuildEnabled);
- gSavedSettings.setBOOL("JoystickFlycamEnabled", mFlycamEnabled);
-
- gSavedSettings.setF32("AvatarAxisScale0", mAvatarAxisScale[0]);
- gSavedSettings.setF32("AvatarAxisScale1", mAvatarAxisScale[1]);
- gSavedSettings.setF32("AvatarAxisScale2", mAvatarAxisScale[2]);
- gSavedSettings.setF32("AvatarAxisScale3", mAvatarAxisScale[3]);
- gSavedSettings.setF32("AvatarAxisScale4", mAvatarAxisScale[4]);
- gSavedSettings.setF32("AvatarAxisScale5", mAvatarAxisScale[5]);
-
- gSavedSettings.setF32("BuildAxisScale0", mBuildAxisScale[0]);
- gSavedSettings.setF32("BuildAxisScale1", mBuildAxisScale[1]);
- gSavedSettings.setF32("BuildAxisScale2", mBuildAxisScale[2]);
- gSavedSettings.setF32("BuildAxisScale3", mBuildAxisScale[3]);
- gSavedSettings.setF32("BuildAxisScale4", mBuildAxisScale[4]);
- gSavedSettings.setF32("BuildAxisScale5", mBuildAxisScale[5]);
-
- gSavedSettings.setF32("FlycamAxisScale0", mFlycamAxisScale[0]);
- gSavedSettings.setF32("FlycamAxisScale1", mFlycamAxisScale[1]);
- gSavedSettings.setF32("FlycamAxisScale2", mFlycamAxisScale[2]);
- gSavedSettings.setF32("FlycamAxisScale3", mFlycamAxisScale[3]);
- gSavedSettings.setF32("FlycamAxisScale4", mFlycamAxisScale[4]);
- gSavedSettings.setF32("FlycamAxisScale5", mFlycamAxisScale[5]);
- gSavedSettings.setF32("FlycamAxisScale6", mFlycamAxisScale[6]);
-
- gSavedSettings.setF32("AvatarAxisDeadZone0", mAvatarAxisDeadZone[0]);
- gSavedSettings.setF32("AvatarAxisDeadZone1", mAvatarAxisDeadZone[1]);
- gSavedSettings.setF32("AvatarAxisDeadZone2", mAvatarAxisDeadZone[2]);
- gSavedSettings.setF32("AvatarAxisDeadZone3", mAvatarAxisDeadZone[3]);
- gSavedSettings.setF32("AvatarAxisDeadZone4", mAvatarAxisDeadZone[4]);
- gSavedSettings.setF32("AvatarAxisDeadZone5", mAvatarAxisDeadZone[5]);
-
- gSavedSettings.setF32("BuildAxisDeadZone0", mBuildAxisDeadZone[0]);
- gSavedSettings.setF32("BuildAxisDeadZone1", mBuildAxisDeadZone[1]);
- gSavedSettings.setF32("BuildAxisDeadZone2", mBuildAxisDeadZone[2]);
- gSavedSettings.setF32("BuildAxisDeadZone3", mBuildAxisDeadZone[3]);
- gSavedSettings.setF32("BuildAxisDeadZone4", mBuildAxisDeadZone[4]);
- gSavedSettings.setF32("BuildAxisDeadZone5", mBuildAxisDeadZone[5]);
-
- gSavedSettings.setF32("FlycamAxisDeadZone0", mFlycamAxisDeadZone[0]);
- gSavedSettings.setF32("FlycamAxisDeadZone1", mFlycamAxisDeadZone[1]);
- gSavedSettings.setF32("FlycamAxisDeadZone2", mFlycamAxisDeadZone[2]);
- gSavedSettings.setF32("FlycamAxisDeadZone3", mFlycamAxisDeadZone[3]);
- gSavedSettings.setF32("FlycamAxisDeadZone4", mFlycamAxisDeadZone[4]);
- gSavedSettings.setF32("FlycamAxisDeadZone5", mFlycamAxisDeadZone[5]);
- gSavedSettings.setF32("FlycamAxisDeadZone6", mFlycamAxisDeadZone[6]);
-
- gSavedSettings.setF32("AvatarFeathering", mAvatarFeathering);
- gSavedSettings.setF32("BuildFeathering", mBuildFeathering);
- gSavedSettings.setF32("FlycamFeathering", mFlycamFeathering);
+ gSavedSettings.setBOOL("JoystickEnabled", mJoystickEnabled);
+ gSavedSettings.setLLSD("JoystickDeviceUUID", mJoystickId);
+
+ gSavedSettings.setS32("JoystickAxis0", mJoystickAxis[0]);
+ gSavedSettings.setS32("JoystickAxis1", mJoystickAxis[1]);
+ gSavedSettings.setS32("JoystickAxis2", mJoystickAxis[2]);
+ gSavedSettings.setS32("JoystickAxis3", mJoystickAxis[3]);
+ gSavedSettings.setS32("JoystickAxis4", mJoystickAxis[4]);
+ gSavedSettings.setS32("JoystickAxis5", mJoystickAxis[5]);
+ gSavedSettings.setS32("JoystickAxis6", mJoystickAxis[6]);
+
+ gSavedSettings.setBOOL("Cursor3D", m3DCursor);
+ gSavedSettings.setBOOL("AutoLeveling", mAutoLeveling);
+ gSavedSettings.setBOOL("ZoomDirect", mZoomDirect );
+
+ gSavedSettings.setBOOL("JoystickAvatarEnabled", mAvatarEnabled);
+ gSavedSettings.setBOOL("JoystickBuildEnabled", mBuildEnabled);
+ gSavedSettings.setBOOL("JoystickFlycamEnabled", mFlycamEnabled);
+
+ gSavedSettings.setF32("AvatarAxisScale0", mAvatarAxisScale[0]);
+ gSavedSettings.setF32("AvatarAxisScale1", mAvatarAxisScale[1]);
+ gSavedSettings.setF32("AvatarAxisScale2", mAvatarAxisScale[2]);
+ gSavedSettings.setF32("AvatarAxisScale3", mAvatarAxisScale[3]);
+ gSavedSettings.setF32("AvatarAxisScale4", mAvatarAxisScale[4]);
+ gSavedSettings.setF32("AvatarAxisScale5", mAvatarAxisScale[5]);
+
+ gSavedSettings.setF32("BuildAxisScale0", mBuildAxisScale[0]);
+ gSavedSettings.setF32("BuildAxisScale1", mBuildAxisScale[1]);
+ gSavedSettings.setF32("BuildAxisScale2", mBuildAxisScale[2]);
+ gSavedSettings.setF32("BuildAxisScale3", mBuildAxisScale[3]);
+ gSavedSettings.setF32("BuildAxisScale4", mBuildAxisScale[4]);
+ gSavedSettings.setF32("BuildAxisScale5", mBuildAxisScale[5]);
+
+ gSavedSettings.setF32("FlycamAxisScale0", mFlycamAxisScale[0]);
+ gSavedSettings.setF32("FlycamAxisScale1", mFlycamAxisScale[1]);
+ gSavedSettings.setF32("FlycamAxisScale2", mFlycamAxisScale[2]);
+ gSavedSettings.setF32("FlycamAxisScale3", mFlycamAxisScale[3]);
+ gSavedSettings.setF32("FlycamAxisScale4", mFlycamAxisScale[4]);
+ gSavedSettings.setF32("FlycamAxisScale5", mFlycamAxisScale[5]);
+ gSavedSettings.setF32("FlycamAxisScale6", mFlycamAxisScale[6]);
+
+ gSavedSettings.setF32("AvatarAxisDeadZone0", mAvatarAxisDeadZone[0]);
+ gSavedSettings.setF32("AvatarAxisDeadZone1", mAvatarAxisDeadZone[1]);
+ gSavedSettings.setF32("AvatarAxisDeadZone2", mAvatarAxisDeadZone[2]);
+ gSavedSettings.setF32("AvatarAxisDeadZone3", mAvatarAxisDeadZone[3]);
+ gSavedSettings.setF32("AvatarAxisDeadZone4", mAvatarAxisDeadZone[4]);
+ gSavedSettings.setF32("AvatarAxisDeadZone5", mAvatarAxisDeadZone[5]);
+
+ gSavedSettings.setF32("BuildAxisDeadZone0", mBuildAxisDeadZone[0]);
+ gSavedSettings.setF32("BuildAxisDeadZone1", mBuildAxisDeadZone[1]);
+ gSavedSettings.setF32("BuildAxisDeadZone2", mBuildAxisDeadZone[2]);
+ gSavedSettings.setF32("BuildAxisDeadZone3", mBuildAxisDeadZone[3]);
+ gSavedSettings.setF32("BuildAxisDeadZone4", mBuildAxisDeadZone[4]);
+ gSavedSettings.setF32("BuildAxisDeadZone5", mBuildAxisDeadZone[5]);
+
+ gSavedSettings.setF32("FlycamAxisDeadZone0", mFlycamAxisDeadZone[0]);
+ gSavedSettings.setF32("FlycamAxisDeadZone1", mFlycamAxisDeadZone[1]);
+ gSavedSettings.setF32("FlycamAxisDeadZone2", mFlycamAxisDeadZone[2]);
+ gSavedSettings.setF32("FlycamAxisDeadZone3", mFlycamAxisDeadZone[3]);
+ gSavedSettings.setF32("FlycamAxisDeadZone4", mFlycamAxisDeadZone[4]);
+ gSavedSettings.setF32("FlycamAxisDeadZone5", mFlycamAxisDeadZone[5]);
+ gSavedSettings.setF32("FlycamAxisDeadZone6", mFlycamAxisDeadZone[6]);
+
+ gSavedSettings.setF32("AvatarFeathering", mAvatarFeathering);
+ gSavedSettings.setF32("BuildFeathering", mBuildFeathering);
+ gSavedSettings.setF32("FlycamFeathering", mFlycamFeathering);
}
void LLFloaterJoystick::onCommitJoystickEnabled(LLUICtrl*, void *joy_panel)
{
- LLFloaterJoystick* self = (LLFloaterJoystick*)joy_panel;
+ LLFloaterJoystick* self = (LLFloaterJoystick*)joy_panel;
LLSD value = self->mJoysticksCombo->getValue();
bool joystick_enabled = true;
@@ -407,17 +407,17 @@ void LLFloaterJoystick::onCommitJoystickEnabled(LLUICtrl*, void *joy_panel)
joystick_enabled = true;
}
gSavedSettings.setBOOL("JoystickEnabled", joystick_enabled);
- BOOL flycam_enabled = self->mCheckFlycamEnabled->get();
-
- if (!joystick_enabled || !flycam_enabled)
- {
- // Turn off flycam
- LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
- if (joystick->getOverrideCamera())
- {
- joystick->toggleFlycam();
- }
- }
+ BOOL flycam_enabled = self->mCheckFlycamEnabled->get();
+
+ if (!joystick_enabled || !flycam_enabled)
+ {
+ // Turn off flycam
+ LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
+ if (joystick->getOverrideCamera())
+ {
+ joystick->toggleFlycam();
+ }
+ }
std::string device_id = LLViewerJoystick::getInstance()->getDeviceUUIDString();
gSavedSettings.setString("JoystickDeviceUUID", device_id);
@@ -428,51 +428,51 @@ void LLFloaterJoystick::onCommitJoystickEnabled(LLUICtrl*, void *joy_panel)
void LLFloaterJoystick::onClickRestoreSNDefaults(void *joy_panel)
{
- setSNDefaults();
+ setSNDefaults();
}
void LLFloaterJoystick::onClickCancel(void *joy_panel)
{
- if (joy_panel)
- {
- LLFloaterJoystick* self = (LLFloaterJoystick*)joy_panel;
-
- if (self)
- {
- self->cancel();
- self->closeFloater();
- }
- }
+ if (joy_panel)
+ {
+ LLFloaterJoystick* self = (LLFloaterJoystick*)joy_panel;
+
+ if (self)
+ {
+ self->cancel();
+ self->closeFloater();
+ }
+ }
}
void LLFloaterJoystick::onClickOK(void *joy_panel)
{
- if (joy_panel)
- {
- LLFloaterJoystick* self = (LLFloaterJoystick*)joy_panel;
-
- if (self)
- {
- self->closeFloater();
- }
- }
+ if (joy_panel)
+ {
+ LLFloaterJoystick* self = (LLFloaterJoystick*)joy_panel;
+
+ if (self)
+ {
+ self->closeFloater();
+ }
+ }
}
void LLFloaterJoystick::onClickCloseBtn(bool app_quitting)
{
- cancel();
- closeFloater(app_quitting);
+ cancel();
+ closeFloater(app_quitting);
}
void LLFloaterJoystick::setSNDefaults()
{
- LLViewerJoystick::getInstance()->setSNDefaults();
+ LLViewerJoystick::getInstance()->setSNDefaults();
}
void LLFloaterJoystick::onClose(bool app_quitting)
{
- if (app_quitting)
- {
- cancel();
- }
+ if (app_quitting)
+ {
+ cancel();
+ }
}
diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h
index 1d46efd3f6..2ed4018670 100644
--- a/indra/newview/llfloaterjoystick.h
+++ b/indra/newview/llfloaterjoystick.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterjoystick.h
* @brief Joystick preferences panel
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,68 +35,68 @@ class LLComboBox;
class LLFloaterJoystick : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- virtual BOOL postBuild();
- virtual void refresh();
- virtual void apply(); // Apply the changed values.
- virtual void cancel(); // Cancel the changed values.
- virtual void draw();
- static void setSNDefaults();
+ virtual BOOL postBuild();
+ virtual void refresh();
+ virtual void apply(); // Apply the changed values.
+ virtual void cancel(); // Cancel the changed values.
+ virtual void draw();
+ static void setSNDefaults();
void addDevice(std::string &name, LLSD& value);
protected:
- void refreshListOfDevices();
- void onClose(bool app_quitting);
- void onClickCloseBtn(bool app_quitting);
+ void refreshListOfDevices();
+ void onClose(bool app_quitting);
+ void onClickCloseBtn(bool app_quitting);
private:
- LLFloaterJoystick(const LLSD& data);
- virtual ~LLFloaterJoystick();
+ LLFloaterJoystick(const LLSD& data);
+ virtual ~LLFloaterJoystick();
+
+ void initFromSettings();
- void initFromSettings();
-
- static void onCommitJoystickEnabled(LLUICtrl*, void*);
- static void onClickRestoreSNDefaults(void*);
- static void onClickCancel(void*);
- static void onClickOK(void*);
+ static void onCommitJoystickEnabled(LLUICtrl*, void*);
+ static void onClickRestoreSNDefaults(void*);
+ static void onClickCancel(void*);
+ static void onClickOK(void*);
private:
- // Device prefs
- bool mJoystickEnabled;
- LLSD mJoystickId;
- S32 mJoystickAxis[7];
- bool m3DCursor;
- bool mAutoLeveling;
- bool mZoomDirect;
-
- // Modes prefs
- bool mAvatarEnabled;
- bool mBuildEnabled;
- bool mFlycamEnabled;
- F32 mAvatarAxisScale[6];
- F32 mBuildAxisScale[6];
- F32 mFlycamAxisScale[7];
- F32 mAvatarAxisDeadZone[6];
- F32 mBuildAxisDeadZone[6];
- F32 mFlycamAxisDeadZone[7];
- F32 mAvatarFeathering;
- F32 mBuildFeathering;
- F32 mFlycamFeathering;
-
- // Controls that can disable the flycam
- LLCheckBoxCtrl *mCheckFlycamEnabled;
- LLComboBox *mJoysticksCombo;
+ // Device prefs
+ bool mJoystickEnabled;
+ LLSD mJoystickId;
+ S32 mJoystickAxis[7];
+ bool m3DCursor;
+ bool mAutoLeveling;
+ bool mZoomDirect;
+
+ // Modes prefs
+ bool mAvatarEnabled;
+ bool mBuildEnabled;
+ bool mFlycamEnabled;
+ F32 mAvatarAxisScale[6];
+ F32 mBuildAxisScale[6];
+ F32 mFlycamAxisScale[7];
+ F32 mAvatarAxisDeadZone[6];
+ F32 mBuildAxisDeadZone[6];
+ F32 mFlycamAxisDeadZone[7];
+ F32 mAvatarFeathering;
+ F32 mBuildFeathering;
+ F32 mFlycamFeathering;
+
+ // Controls that can disable the flycam
+ LLCheckBoxCtrl *mCheckFlycamEnabled;
+ LLComboBox *mJoysticksCombo;
bool mHasDeviceList;
- // stats view
- LLStatBar* mAxisStatsBar[6];
+ // stats view
+ LLStatBar* mAxisStatsBar[6];
};
#endif
diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp
index db00f69f03..3d4d0e55d4 100644
--- a/indra/newview/llfloaterlagmeter.cpp
+++ b/indra/newview/llfloaterlagmeter.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterlagmeter.cpp
* @brief The "Lag-o-Meter" floater used to tell users what is causing lag.
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,334 +45,334 @@ const std::string LAG_WARNING_IMAGE_NAME = "lag_status_warning.tga";
const std::string LAG_GOOD_IMAGE_NAME = "lag_status_good.tga";
LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
- mCommitCallbackRegistrar.add("LagMeter.ClickShrink", boost::bind(&LLFloaterLagMeter::onClickShrink, this));
+ mCommitCallbackRegistrar.add("LagMeter.ClickShrink", boost::bind(&LLFloaterLagMeter::onClickShrink, this));
}
BOOL LLFloaterLagMeter::postBuild()
{
- // Don't let this window take keyboard focus -- it's confusing to
- // lose arrow-key driving when testing lag.
- setIsChrome(TRUE);
-
- // were we shrunk last time?
- if (isShrunk())
- {
- onClickShrink();
- }
-
- mClientButton = getChild<LLButton>("client_lagmeter");
- mClientText = getChild<LLTextBox>("client_text");
- mClientCause = getChild<LLTextBox>("client_lag_cause");
-
- mNetworkButton = getChild<LLButton>("network_lagmeter");
- mNetworkText = getChild<LLTextBox>("network_text");
- mNetworkCause = getChild<LLTextBox>("network_lag_cause");
-
- mServerButton = getChild<LLButton>("server_lagmeter");
- mServerText = getChild<LLTextBox>("server_text");
- mServerCause = getChild<LLTextBox>("server_lag_cause");
-
- std::string config_string = getString("client_frame_rate_critical_fps", mStringArgs);
- mClientFrameTimeCritical = F32Seconds(1.0f / (float)atof( config_string.c_str() ));
- config_string = getString("client_frame_rate_warning_fps", mStringArgs);
- mClientFrameTimeWarning = F32Seconds(1.0f / (float)atof( config_string.c_str() ));
-
- config_string = getString("network_packet_loss_critical_pct", mStringArgs);
- mNetworkPacketLossCritical = F32Percent((float)atof( config_string.c_str() ));
- config_string = getString("network_packet_loss_warning_pct", mStringArgs);
- mNetworkPacketLossWarning = F32Percent((float)atof( config_string.c_str() ));
-
- config_string = getString("network_ping_critical_ms", mStringArgs);
- mNetworkPingCritical = F32Milliseconds((float)atof( config_string.c_str() ));
- config_string = getString("network_ping_warning_ms", mStringArgs);
- mNetworkPingWarning = F32Milliseconds((float)atof( config_string.c_str() ));
- config_string = getString("server_frame_rate_critical_fps", mStringArgs);
-
- mServerFrameTimeCritical = F32Seconds(1.0f / (float)atof( config_string.c_str() ));
- config_string = getString("server_frame_rate_warning_fps", mStringArgs);
- mServerFrameTimeWarning = F32Seconds(1.0f / (float)atof( config_string.c_str() ));
- config_string = getString("server_single_process_max_time_ms", mStringArgs);
- mServerSingleProcessMaxTime = F32Seconds((float)atof( config_string.c_str() ));
-
-// mShrunk = false;
- config_string = getString("max_width_px", mStringArgs);
- mMaxWidth = atoi( config_string.c_str() );
- config_string = getString("min_width_px", mStringArgs);
- mMinWidth = atoi( config_string.c_str() );
-
- mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps");
- mStringArgs["[CLIENT_FRAME_RATE_WARNING]"] = getString("client_frame_rate_warning_fps");
-
- mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct");
- mStringArgs["[NETWORK_PACKET_LOSS_WARNING]"] = getString("network_packet_loss_warning_pct");
-
- mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms");
- mStringArgs["[NETWORK_PING_WARNING]"] = getString("network_ping_warning_ms");
-
- mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps");
- mStringArgs["[SERVER_FRAME_RATE_WARNING]"] = getString("server_frame_rate_warning_fps");
-
-// childSetAction("minimize", onClickShrink, this);
- updateControls(isShrunk()); // if expanded append colon to the labels (EXT-4079)
-
- return TRUE;
+ // Don't let this window take keyboard focus -- it's confusing to
+ // lose arrow-key driving when testing lag.
+ setIsChrome(TRUE);
+
+ // were we shrunk last time?
+ if (isShrunk())
+ {
+ onClickShrink();
+ }
+
+ mClientButton = getChild<LLButton>("client_lagmeter");
+ mClientText = getChild<LLTextBox>("client_text");
+ mClientCause = getChild<LLTextBox>("client_lag_cause");
+
+ mNetworkButton = getChild<LLButton>("network_lagmeter");
+ mNetworkText = getChild<LLTextBox>("network_text");
+ mNetworkCause = getChild<LLTextBox>("network_lag_cause");
+
+ mServerButton = getChild<LLButton>("server_lagmeter");
+ mServerText = getChild<LLTextBox>("server_text");
+ mServerCause = getChild<LLTextBox>("server_lag_cause");
+
+ std::string config_string = getString("client_frame_rate_critical_fps", mStringArgs);
+ mClientFrameTimeCritical = F32Seconds(1.0f / (float)atof( config_string.c_str() ));
+ config_string = getString("client_frame_rate_warning_fps", mStringArgs);
+ mClientFrameTimeWarning = F32Seconds(1.0f / (float)atof( config_string.c_str() ));
+
+ config_string = getString("network_packet_loss_critical_pct", mStringArgs);
+ mNetworkPacketLossCritical = F32Percent((float)atof( config_string.c_str() ));
+ config_string = getString("network_packet_loss_warning_pct", mStringArgs);
+ mNetworkPacketLossWarning = F32Percent((float)atof( config_string.c_str() ));
+
+ config_string = getString("network_ping_critical_ms", mStringArgs);
+ mNetworkPingCritical = F32Milliseconds((float)atof( config_string.c_str() ));
+ config_string = getString("network_ping_warning_ms", mStringArgs);
+ mNetworkPingWarning = F32Milliseconds((float)atof( config_string.c_str() ));
+ config_string = getString("server_frame_rate_critical_fps", mStringArgs);
+
+ mServerFrameTimeCritical = F32Seconds(1.0f / (float)atof( config_string.c_str() ));
+ config_string = getString("server_frame_rate_warning_fps", mStringArgs);
+ mServerFrameTimeWarning = F32Seconds(1.0f / (float)atof( config_string.c_str() ));
+ config_string = getString("server_single_process_max_time_ms", mStringArgs);
+ mServerSingleProcessMaxTime = F32Seconds((float)atof( config_string.c_str() ));
+
+// mShrunk = false;
+ config_string = getString("max_width_px", mStringArgs);
+ mMaxWidth = atoi( config_string.c_str() );
+ config_string = getString("min_width_px", mStringArgs);
+ mMinWidth = atoi( config_string.c_str() );
+
+ mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps");
+ mStringArgs["[CLIENT_FRAME_RATE_WARNING]"] = getString("client_frame_rate_warning_fps");
+
+ mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct");
+ mStringArgs["[NETWORK_PACKET_LOSS_WARNING]"] = getString("network_packet_loss_warning_pct");
+
+ mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms");
+ mStringArgs["[NETWORK_PING_WARNING]"] = getString("network_ping_warning_ms");
+
+ mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps");
+ mStringArgs["[SERVER_FRAME_RATE_WARNING]"] = getString("server_frame_rate_warning_fps");
+
+// childSetAction("minimize", onClickShrink, this);
+ updateControls(isShrunk()); // if expanded append colon to the labels (EXT-4079)
+
+ return TRUE;
}
LLFloaterLagMeter::~LLFloaterLagMeter()
{
- // save shrunk status for next time
-// gSavedSettings.setBOOL("LagMeterShrunk", mShrunk);
- // expand so we save the large window rectangle
- if (isShrunk())
- {
- onClickShrink();
- }
+ // save shrunk status for next time
+// gSavedSettings.setBOOL("LagMeterShrunk", mShrunk);
+ // expand so we save the large window rectangle
+ if (isShrunk())
+ {
+ onClickShrink();
+ }
}
void LLFloaterLagMeter::draw()
{
- determineClient();
- determineNetwork();
- determineServer();
+ determineClient();
+ determineNetwork();
+ determineServer();
- LLFloater::draw();
+ LLFloater::draw();
}
void LLFloaterLagMeter::determineClient()
{
- F32Milliseconds client_frame_time = LLTrace::get_frame_recording().getPeriodMean(LLStatViewer::FRAME_STACKTIME);
- bool find_cause = false;
-
- if (!gFocusMgr.getAppHasFocus())
- {
- mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
- mClientText->setText( getString("client_frame_time_window_bg_msg", mStringArgs) );
- mClientCause->setText( LLStringUtil::null );
- }
- else if(client_frame_time >= mClientFrameTimeCritical)
- {
- mClientButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
- mClientText->setText( getString("client_frame_time_critical_msg", mStringArgs) );
- find_cause = true;
- }
- else if(client_frame_time >= mClientFrameTimeWarning)
- {
- mClientButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
- mClientText->setText( getString("client_frame_time_warning_msg", mStringArgs) );
- find_cause = true;
- }
- else
- {
- mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
- mClientText->setText( getString("client_frame_time_normal_msg", mStringArgs) );
- mClientCause->setText( LLStringUtil::null );
- }
-
- if(find_cause)
- {
- if(gSavedSettings.getF32("RenderFarClip") > 128)
- {
- mClientCause->setText( getString("client_draw_distance_cause_msg", mStringArgs) );
- }
- else if(LLAppViewer::instance()->getTextureFetch()->getNumRequests() > 2)
- {
- mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) );
- }
- else if(LLViewerTexture::isMemoryForTextureLow())
- {
- mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) );
- }
- else
- {
- mClientCause->setText( getString("client_complex_objects_cause_msg", mStringArgs) );
- }
- }
+ F32Milliseconds client_frame_time = LLTrace::get_frame_recording().getPeriodMean(LLStatViewer::FRAME_STACKTIME);
+ bool find_cause = false;
+
+ if (!gFocusMgr.getAppHasFocus())
+ {
+ mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
+ mClientText->setText( getString("client_frame_time_window_bg_msg", mStringArgs) );
+ mClientCause->setText( LLStringUtil::null );
+ }
+ else if(client_frame_time >= mClientFrameTimeCritical)
+ {
+ mClientButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
+ mClientText->setText( getString("client_frame_time_critical_msg", mStringArgs) );
+ find_cause = true;
+ }
+ else if(client_frame_time >= mClientFrameTimeWarning)
+ {
+ mClientButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
+ mClientText->setText( getString("client_frame_time_warning_msg", mStringArgs) );
+ find_cause = true;
+ }
+ else
+ {
+ mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
+ mClientText->setText( getString("client_frame_time_normal_msg", mStringArgs) );
+ mClientCause->setText( LLStringUtil::null );
+ }
+
+ if(find_cause)
+ {
+ if(gSavedSettings.getF32("RenderFarClip") > 128)
+ {
+ mClientCause->setText( getString("client_draw_distance_cause_msg", mStringArgs) );
+ }
+ else if(LLAppViewer::instance()->getTextureFetch()->getNumRequests() > 2)
+ {
+ mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) );
+ }
+ else if(LLViewerTexture::isMemoryForTextureLow())
+ {
+ mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) );
+ }
+ else
+ {
+ mClientCause->setText( getString("client_complex_objects_cause_msg", mStringArgs) );
+ }
+ }
}
void LLFloaterLagMeter::determineNetwork()
{
- LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
- F32Percent packet_loss = frame_recording.getPeriodMean(LLStatViewer::PACKETS_LOST_PERCENT);
- F32Milliseconds ping_time = frame_recording.getPeriodMean(LLStatViewer::SIM_PING);
- bool find_cause_loss = false;
- bool find_cause_ping = false;
-
- // *FIXME: We can't blame a large ping time on anything in
- // particular if the frame rate is low, because a low frame
- // rate is a sure recipe for bad ping times right now until
- // the network handlers are de-synched from the rendering.
- F32Milliseconds client_frame_time = frame_recording.getPeriodMean(LLStatViewer::FRAME_STACKTIME);
-
- if(packet_loss >= mNetworkPacketLossCritical)
- {
- mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
- mNetworkText->setText( getString("network_packet_loss_critical_msg", mStringArgs) );
- find_cause_loss = true;
- }
- else if(ping_time >= mNetworkPingCritical)
- {
- mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
- if (client_frame_time < mNetworkPingCritical)
- {
- mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) );
- find_cause_ping = true;
- }
- }
- else if(packet_loss >= mNetworkPacketLossWarning)
- {
- mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
- mNetworkText->setText( getString("network_packet_loss_warning_msg", mStringArgs) );
- find_cause_loss = true;
- }
- else if(ping_time >= mNetworkPingWarning)
- {
- mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
- if (client_frame_time < mNetworkPingWarning)
- {
- mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) );
- find_cause_ping = true;
- }
- }
- else
- {
- mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
- mNetworkText->setText( getString("network_performance_normal_msg", mStringArgs) );
- }
-
- if(find_cause_loss)
- {
- mNetworkCause->setText( getString("network_packet_loss_cause_msg", mStringArgs) );
- }
- else if(find_cause_ping)
- {
- mNetworkCause->setText( getString("network_ping_cause_msg", mStringArgs) );
- }
- else
- {
- mNetworkCause->setText( LLStringUtil::null );
- }
+ LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
+ F32Percent packet_loss = frame_recording.getPeriodMean(LLStatViewer::PACKETS_LOST_PERCENT);
+ F32Milliseconds ping_time = frame_recording.getPeriodMean(LLStatViewer::SIM_PING);
+ bool find_cause_loss = false;
+ bool find_cause_ping = false;
+
+ // *FIXME: We can't blame a large ping time on anything in
+ // particular if the frame rate is low, because a low frame
+ // rate is a sure recipe for bad ping times right now until
+ // the network handlers are de-synched from the rendering.
+ F32Milliseconds client_frame_time = frame_recording.getPeriodMean(LLStatViewer::FRAME_STACKTIME);
+
+ if(packet_loss >= mNetworkPacketLossCritical)
+ {
+ mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
+ mNetworkText->setText( getString("network_packet_loss_critical_msg", mStringArgs) );
+ find_cause_loss = true;
+ }
+ else if(ping_time >= mNetworkPingCritical)
+ {
+ mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
+ if (client_frame_time < mNetworkPingCritical)
+ {
+ mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) );
+ find_cause_ping = true;
+ }
+ }
+ else if(packet_loss >= mNetworkPacketLossWarning)
+ {
+ mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
+ mNetworkText->setText( getString("network_packet_loss_warning_msg", mStringArgs) );
+ find_cause_loss = true;
+ }
+ else if(ping_time >= mNetworkPingWarning)
+ {
+ mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
+ if (client_frame_time < mNetworkPingWarning)
+ {
+ mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) );
+ find_cause_ping = true;
+ }
+ }
+ else
+ {
+ mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
+ mNetworkText->setText( getString("network_performance_normal_msg", mStringArgs) );
+ }
+
+ if(find_cause_loss)
+ {
+ mNetworkCause->setText( getString("network_packet_loss_cause_msg", mStringArgs) );
+ }
+ else if(find_cause_ping)
+ {
+ mNetworkCause->setText( getString("network_ping_cause_msg", mStringArgs) );
+ }
+ else
+ {
+ mNetworkCause->setText( LLStringUtil::null );
+ }
}
void LLFloaterLagMeter::determineServer()
{
- F32Milliseconds sim_frame_time = LLTrace::get_frame_recording().getLastRecording().getLastValue(LLStatViewer::SIM_FRAME_TIME);
- bool find_cause = false;
-
- if(sim_frame_time >= mServerFrameTimeCritical)
- {
- mServerButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
- mServerText->setText( getString("server_frame_time_critical_msg", mStringArgs) );
- find_cause = true;
- }
- else if(sim_frame_time >= mServerFrameTimeWarning)
- {
- mServerButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
- mServerText->setText( getString("server_frame_time_warning_msg", mStringArgs) );
- find_cause = true;
- }
- else
- {
- mServerButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
- mServerText->setText( getString("server_frame_time_normal_msg", mStringArgs) );
- mServerCause->setText( LLStringUtil::null );
- }
-
- if(find_cause)
- {
- LLTrace::Recording& last_recording = LLTrace::get_frame_recording().getLastRecording();
-
- if(last_recording.getLastValue(LLStatViewer::SIM_PHYSICS_TIME) > mServerSingleProcessMaxTime)
- {
- mServerCause->setText( getString("server_physics_cause_msg", mStringArgs) );
- }
- else if(last_recording.getLastValue(LLStatViewer::SIM_SCRIPTS_TIME) > mServerSingleProcessMaxTime)
- {
- mServerCause->setText( getString("server_scripts_cause_msg", mStringArgs) );
- }
- else if(last_recording.getLastValue(LLStatViewer::SIM_NET_TIME) > mServerSingleProcessMaxTime)
- {
- mServerCause->setText( getString("server_net_cause_msg", mStringArgs) );
- }
- else if(last_recording.getLastValue(LLStatViewer::SIM_AGENTS_TIME) > mServerSingleProcessMaxTime)
- {
- mServerCause->setText( getString("server_agent_cause_msg", mStringArgs) );
- }
- else if(last_recording.getLastValue(LLStatViewer::SIM_IMAGES_TIME) > mServerSingleProcessMaxTime)
- {
- mServerCause->setText( getString("server_images_cause_msg", mStringArgs) );
- }
- else
- {
- mServerCause->setText( getString("server_generic_cause_msg", mStringArgs) );
- }
- }
+ F32Milliseconds sim_frame_time = LLTrace::get_frame_recording().getLastRecording().getLastValue(LLStatViewer::SIM_FRAME_TIME);
+ bool find_cause = false;
+
+ if(sim_frame_time >= mServerFrameTimeCritical)
+ {
+ mServerButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
+ mServerText->setText( getString("server_frame_time_critical_msg", mStringArgs) );
+ find_cause = true;
+ }
+ else if(sim_frame_time >= mServerFrameTimeWarning)
+ {
+ mServerButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
+ mServerText->setText( getString("server_frame_time_warning_msg", mStringArgs) );
+ find_cause = true;
+ }
+ else
+ {
+ mServerButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
+ mServerText->setText( getString("server_frame_time_normal_msg", mStringArgs) );
+ mServerCause->setText( LLStringUtil::null );
+ }
+
+ if(find_cause)
+ {
+ LLTrace::Recording& last_recording = LLTrace::get_frame_recording().getLastRecording();
+
+ if(last_recording.getLastValue(LLStatViewer::SIM_PHYSICS_TIME) > mServerSingleProcessMaxTime)
+ {
+ mServerCause->setText( getString("server_physics_cause_msg", mStringArgs) );
+ }
+ else if(last_recording.getLastValue(LLStatViewer::SIM_SCRIPTS_TIME) > mServerSingleProcessMaxTime)
+ {
+ mServerCause->setText( getString("server_scripts_cause_msg", mStringArgs) );
+ }
+ else if(last_recording.getLastValue(LLStatViewer::SIM_NET_TIME) > mServerSingleProcessMaxTime)
+ {
+ mServerCause->setText( getString("server_net_cause_msg", mStringArgs) );
+ }
+ else if(last_recording.getLastValue(LLStatViewer::SIM_AGENTS_TIME) > mServerSingleProcessMaxTime)
+ {
+ mServerCause->setText( getString("server_agent_cause_msg", mStringArgs) );
+ }
+ else if(last_recording.getLastValue(LLStatViewer::SIM_IMAGES_TIME) > mServerSingleProcessMaxTime)
+ {
+ mServerCause->setText( getString("server_images_cause_msg", mStringArgs) );
+ }
+ else
+ {
+ mServerCause->setText( getString("server_generic_cause_msg", mStringArgs) );
+ }
+ }
}
void LLFloaterLagMeter::updateControls(bool shrink)
{
-// LLFloaterLagMeter * self = (LLFloaterLagMeter*)data;
-
- LLButton * button = getChild<LLButton>("minimize");
- S32 delta_width = mMaxWidth -mMinWidth;
- LLRect r = getRect();
-
- if(!shrink)
- {
- setTitle(getString("max_title_msg", mStringArgs) );
- // make left edge appear to expand
- r.translate(-delta_width, 0);
- setRect(r);
- reshape(mMaxWidth, getRect().getHeight());
-
- getChild<LLUICtrl>("client")->setValue(getString("client_text_msg", mStringArgs) + ":");
- getChild<LLUICtrl>("network")->setValue(getString("network_text_msg",mStringArgs) + ":");
- getChild<LLUICtrl>("server")->setValue(getString("server_text_msg", mStringArgs) + ":");
-
- // usually "<<"
- button->setLabel( getString("smaller_label", mStringArgs) );
- }
- else
- {
- setTitle( getString("min_title_msg", mStringArgs) );
- // make left edge appear to collapse
- r.translate(delta_width, 0);
- setRect(r);
- reshape(mMinWidth, getRect().getHeight());
-
- getChild<LLUICtrl>("client")->setValue(getString("client_text_msg", mStringArgs) );
- getChild<LLUICtrl>("network")->setValue(getString("network_text_msg",mStringArgs) );
- getChild<LLUICtrl>("server")->setValue(getString("server_text_msg", mStringArgs) );
-
- // usually ">>"
- button->setLabel( getString("bigger_label", mStringArgs) );
- }
- // Don't put keyboard focus on the button
- button->setFocus(FALSE);
-
-// self->mClientText->setVisible(self->mShrunk);
-// self->mClientCause->setVisible(self->mShrunk);
-// self->getChildView("client_help")->setVisible( self->mShrunk);
-
-// self->mNetworkText->setVisible(self->mShrunk);
-// self->mNetworkCause->setVisible(self->mShrunk);
-// self->getChildView("network_help")->setVisible( self->mShrunk);
-
-// self->mServerText->setVisible(self->mShrunk);
-// self->mServerCause->setVisible(self->mShrunk);
-// self->getChildView("server_help")->setVisible( self->mShrunk);
-
-// self->mShrunk = !self->mShrunk;
+// LLFloaterLagMeter * self = (LLFloaterLagMeter*)data;
+
+ LLButton * button = getChild<LLButton>("minimize");
+ S32 delta_width = mMaxWidth -mMinWidth;
+ LLRect r = getRect();
+
+ if(!shrink)
+ {
+ setTitle(getString("max_title_msg", mStringArgs) );
+ // make left edge appear to expand
+ r.translate(-delta_width, 0);
+ setRect(r);
+ reshape(mMaxWidth, getRect().getHeight());
+
+ getChild<LLUICtrl>("client")->setValue(getString("client_text_msg", mStringArgs) + ":");
+ getChild<LLUICtrl>("network")->setValue(getString("network_text_msg",mStringArgs) + ":");
+ getChild<LLUICtrl>("server")->setValue(getString("server_text_msg", mStringArgs) + ":");
+
+ // usually "<<"
+ button->setLabel( getString("smaller_label", mStringArgs) );
+ }
+ else
+ {
+ setTitle( getString("min_title_msg", mStringArgs) );
+ // make left edge appear to collapse
+ r.translate(delta_width, 0);
+ setRect(r);
+ reshape(mMinWidth, getRect().getHeight());
+
+ getChild<LLUICtrl>("client")->setValue(getString("client_text_msg", mStringArgs) );
+ getChild<LLUICtrl>("network")->setValue(getString("network_text_msg",mStringArgs) );
+ getChild<LLUICtrl>("server")->setValue(getString("server_text_msg", mStringArgs) );
+
+ // usually ">>"
+ button->setLabel( getString("bigger_label", mStringArgs) );
+ }
+ // Don't put keyboard focus on the button
+ button->setFocus(FALSE);
+
+// self->mClientText->setVisible(self->mShrunk);
+// self->mClientCause->setVisible(self->mShrunk);
+// self->getChildView("client_help")->setVisible( self->mShrunk);
+
+// self->mNetworkText->setVisible(self->mShrunk);
+// self->mNetworkCause->setVisible(self->mShrunk);
+// self->getChildView("network_help")->setVisible( self->mShrunk);
+
+// self->mServerText->setVisible(self->mShrunk);
+// self->mServerCause->setVisible(self->mShrunk);
+// self->getChildView("server_help")->setVisible( self->mShrunk);
+
+// self->mShrunk = !self->mShrunk;
}
BOOL LLFloaterLagMeter::isShrunk()
{
- return gSavedSettings.getBOOL("LagMeterShrunk");
+ return gSavedSettings.getBOOL("LagMeterShrunk");
}
void LLFloaterLagMeter::onClickShrink() // toggle "LagMeterShrunk"
{
- bool shrunk = isShrunk();
- updateControls(!shrunk);
- gSavedSettings.setBOOL("LagMeterShrunk", !shrunk);
+ bool shrunk = isShrunk();
+ updateControls(!shrunk);
+ gSavedSettings.setBOOL("LagMeterShrunk", !shrunk);
}
diff --git a/indra/newview/llfloaterlagmeter.h b/indra/newview/llfloaterlagmeter.h
index 929ea40629..774a42b2d3 100644
--- a/indra/newview/llfloaterlagmeter.h
+++ b/indra/newview/llfloaterlagmeter.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterlagmeter.h
* @brief The "Lag-o-Meter" floater used to tell users what is causing lag.
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,48 +33,48 @@ class LLTextBox;
class LLFloaterLagMeter : public LLFloater
{
- friend class LLFloaterReg;
-
+ friend class LLFloaterReg;
+
public:
- /*virtual*/ void draw();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL postBuild();
private:
-
- LLFloaterLagMeter(const LLSD& key);
- /*virtual*/ ~LLFloaterLagMeter();
- void determineClient();
- void determineNetwork();
- void determineServer();
- void updateControls(bool shrink);
- BOOL isShrunk();
- void onClickShrink();
+ LLFloaterLagMeter(const LLSD& key);
+ /*virtual*/ ~LLFloaterLagMeter();
+ void determineClient();
+ void determineNetwork();
+ void determineServer();
+ void updateControls(bool shrink);
+ BOOL isShrunk();
+
+ void onClickShrink();
- bool mShrunk;
- S32 mMaxWidth, mMinWidth;
+ bool mShrunk;
+ S32 mMaxWidth, mMinWidth;
- F32Milliseconds mClientFrameTimeCritical;
- F32Milliseconds mClientFrameTimeWarning;
- LLButton* mClientButton;
- LLTextBox* mClientText;
- LLTextBox* mClientCause;
+ F32Milliseconds mClientFrameTimeCritical;
+ F32Milliseconds mClientFrameTimeWarning;
+ LLButton* mClientButton;
+ LLTextBox* mClientText;
+ LLTextBox* mClientCause;
- F32Percent mNetworkPacketLossCritical;
- F32Percent mNetworkPacketLossWarning;
- F32Milliseconds mNetworkPingCritical;
- F32Milliseconds mNetworkPingWarning;
- LLButton* mNetworkButton;
- LLTextBox* mNetworkText;
- LLTextBox* mNetworkCause;
+ F32Percent mNetworkPacketLossCritical;
+ F32Percent mNetworkPacketLossWarning;
+ F32Milliseconds mNetworkPingCritical;
+ F32Milliseconds mNetworkPingWarning;
+ LLButton* mNetworkButton;
+ LLTextBox* mNetworkText;
+ LLTextBox* mNetworkCause;
- F32Milliseconds mServerFrameTimeCritical;
- F32Milliseconds mServerFrameTimeWarning;
- F32Milliseconds mServerSingleProcessMaxTime;
- LLButton* mServerButton;
- LLTextBox* mServerText;
- LLTextBox* mServerCause;
+ F32Milliseconds mServerFrameTimeCritical;
+ F32Milliseconds mServerFrameTimeWarning;
+ F32Milliseconds mServerSingleProcessMaxTime;
+ LLButton* mServerButton;
+ LLTextBox* mServerText;
+ LLTextBox* mServerCause;
- LLStringUtil::format_map_t mStringArgs;
+ LLStringUtil::format_map_t mStringArgs;
};
#endif
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 9c4c9b3e59..a6afa03e6a 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterland.cpp
* @brief "About Land" floater, allowing display and editing of land parcel properties.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,7 +55,7 @@
#include "llpanellandaudio.h"
#include "llpanellandmedia.h"
#include "llradiogroup.h"
-#include "llresmgr.h" // getMonetaryString
+#include "llresmgr.h" // getMonetaryString
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llscrolllistcell.h"
@@ -67,7 +67,7 @@
#include "lltexturectrl.h"
#include "lluiconstants.h"
#include "lluictrlfactory.h"
-#include "llviewertexturelist.h" // LLUIImageList
+#include "llviewertexturelist.h" // LLUIImageList
#include "llviewermessage.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
@@ -87,10 +87,10 @@
const F64 COVENANT_REFRESH_TIME_SEC = 60.0f;
-static std::string OWNER_ONLINE = "0";
-static std::string OWNER_OFFLINE = "1";
-static std::string OWNER_GROUP = "2";
-static std::string MATURITY = "[MATURITY]";
+static std::string OWNER_ONLINE = "0";
+static std::string OWNER_OFFLINE = "1";
+static std::string OWNER_GROUP = "2";
+static std::string MATURITY = "[MATURITY]";
// constants used in callbacks below - syntactic sugar.
static const BOOL BUY_GROUP_LAND = TRUE;
@@ -105,40 +105,40 @@ S32 LLFloaterLand::sLastTab = 0;
class LLParcelSelectionObserver : public LLParcelObserver
{
public:
- virtual void changed() { LLFloaterLand::refreshAll(); }
+ virtual void changed() { LLFloaterLand::refreshAll(); }
};
// class needed to get full access to textbox inside checkbox, because LLCheckBoxCtrl::setLabel() has string as its argument.
// It was introduced while implementing EXT-4706
-class LLCheckBoxWithTBAcess : public LLCheckBoxCtrl
+class LLCheckBoxWithTBAcess : public LLCheckBoxCtrl
{
public:
- LLTextBox* getTextBox()
- {
- return mLabel;
- }
+ LLTextBox* getTextBox()
+ {
+ return mLabel;
+ }
};
class LLPanelLandExperiences
- : public LLPanel
+ : public LLPanel
{
-public:
- LLPanelLandExperiences(LLSafeHandle<LLParcelSelection>& parcelp);
- virtual BOOL postBuild();
- void refresh();
+public:
+ LLPanelLandExperiences(LLSafeHandle<LLParcelSelection>& parcelp);
+ virtual BOOL postBuild();
+ void refresh();
- void experienceAdded(const LLUUID& id, U32 xp_type, U32 access_type);
- void experienceRemoved(const LLUUID& id, U32 access_type);
+ void experienceAdded(const LLUUID& id, U32 xp_type, U32 access_type);
+ void experienceRemoved(const LLUUID& id, U32 access_type);
protected:
- LLPanelExperienceListEditor* setupList( const char* control_name, U32 xp_type, U32 access_type );
- void refreshPanel(LLPanelExperienceListEditor* panel, U32 xp_type);
+ LLPanelExperienceListEditor* setupList( const char* control_name, U32 xp_type, U32 access_type );
+ void refreshPanel(LLPanelExperienceListEditor* panel, U32 xp_type);
- LLSafeHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
- LLPanelExperienceListEditor* mAllowed;
- LLPanelExperienceListEditor* mBlocked;
+ LLPanelExperienceListEditor* mAllowed;
+ LLPanelExperienceListEditor* mBlocked;
};
@@ -147,13 +147,13 @@ class LLPanelLandEnvironment
{
public:
LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp);
-
+
virtual bool isRegion() const override { return false; }
- virtual bool isLargeEnough() override
- {
+ virtual bool isLargeEnough() override
+ {
LLParcel *parcelp = mParcel->getParcel();
return ((parcelp) ? (parcelp->getArea() >= MINIMUM_PARCEL_SIZE) : false);
- }
+ }
virtual BOOL postBuild() override;
virtual void refresh() override;
@@ -161,7 +161,7 @@ public:
virtual LLParcel * getParcel() override;
virtual bool canEdit() override;
- virtual S32 getParcelId() override;
+ virtual S32 getParcelId() override;
protected:
virtual void refreshFromSource() override;
@@ -173,7 +173,7 @@ protected:
};
-// inserts maturity info(icon and text) into target textbox
+// inserts maturity info(icon and text) into target textbox
// names_floater - pointer to floater which contains strings with maturity icons filenames
// str_to_parse is string in format "txt1[MATURITY]txt2" where maturity icon and text will be inserted instead of [MATURITY]
void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_floater, std::string str_to_parse);
@@ -183,177 +183,177 @@ void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_fl
//---------------------------------------------------------------------------
void send_parcel_select_objects(S32 parcel_local_id, U32 return_type,
- uuid_list_t* return_ids = NULL)
-{
- LLMessageSystem *msg = gMessageSystem;
-
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (!region) return;
-
- // Since new highlight will be coming in, drop any highlights
- // that exist right now.
- LLSelectMgr::getInstance()->unhighlightAll();
-
- msg->newMessageFast(_PREHASH_ParcelSelectObjects);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
- msg->addU32Fast(_PREHASH_ReturnType, return_type);
-
- // Throw all return ids into the packet.
- // TODO: Check for too many ids.
- if (return_ids)
- {
- uuid_list_t::iterator end = return_ids->end();
- for (uuid_list_t::iterator it = return_ids->begin();
- it != end;
- ++it)
- {
- msg->nextBlockFast(_PREHASH_ReturnIDs);
- msg->addUUIDFast(_PREHASH_ReturnID, (*it));
- }
- }
- else
- {
- // Put in a null key so that the message is complete.
- msg->nextBlockFast(_PREHASH_ReturnIDs);
- msg->addUUIDFast(_PREHASH_ReturnID, LLUUID::null);
- }
-
- msg->sendReliable(region->getHost());
+ uuid_list_t* return_ids = NULL)
+{
+ LLMessageSystem *msg = gMessageSystem;
+
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (!region) return;
+
+ // Since new highlight will be coming in, drop any highlights
+ // that exist right now.
+ LLSelectMgr::getInstance()->unhighlightAll();
+
+ msg->newMessageFast(_PREHASH_ParcelSelectObjects);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
+ msg->addU32Fast(_PREHASH_ReturnType, return_type);
+
+ // Throw all return ids into the packet.
+ // TODO: Check for too many ids.
+ if (return_ids)
+ {
+ uuid_list_t::iterator end = return_ids->end();
+ for (uuid_list_t::iterator it = return_ids->begin();
+ it != end;
+ ++it)
+ {
+ msg->nextBlockFast(_PREHASH_ReturnIDs);
+ msg->addUUIDFast(_PREHASH_ReturnID, (*it));
+ }
+ }
+ else
+ {
+ // Put in a null key so that the message is complete.
+ msg->nextBlockFast(_PREHASH_ReturnIDs);
+ msg->addUUIDFast(_PREHASH_ReturnID, LLUUID::null);
+ }
+
+ msg->sendReliable(region->getHost());
}
LLParcel* LLFloaterLand::getCurrentSelectedParcel()
{
- return mParcel->getParcel();
+ return mParcel->getParcel();
};
//static
LLPanelLandObjects* LLFloaterLand::getCurrentPanelLandObjects()
{
- LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
- if(land_instance)
- {
- return land_instance->mPanelObjects;
- }
- else
- {
- return NULL;
- }
+ LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
+ if(land_instance)
+ {
+ return land_instance->mPanelObjects;
+ }
+ else
+ {
+ return NULL;
+ }
}
//static
LLPanelLandCovenant* LLFloaterLand::getCurrentPanelLandCovenant()
{
- LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
- if(land_instance)
- {
- return land_instance->mPanelCovenant;
- }
- else
- {
- return NULL;
- }
+ LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
+ if(land_instance)
+ {
+ return land_instance->mPanelCovenant;
+ }
+ else
+ {
+ return NULL;
+ }
}
// static
void LLFloaterLand::refreshAll()
{
- LLFloaterLand* land_instance = LLFloaterReg::findTypedInstance<LLFloaterLand>("about_land");
- if(land_instance)
- {
- land_instance->refresh();
- }
+ LLFloaterLand* land_instance = LLFloaterReg::findTypedInstance<LLFloaterLand>("about_land");
+ if(land_instance)
+ {
+ land_instance->refresh();
+ }
}
void LLFloaterLand::onOpen(const LLSD& key)
{
- // moved from triggering show instance in llviwermenu.cpp
-
- if (LLViewerParcelMgr::getInstance()->selectionEmpty())
- {
- LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal());
- }
-
- // Done automatically when the selected parcel's properties arrive
- // (and hence we have the local id).
- // LLViewerParcelMgr::getInstance()->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER);
+ // moved from triggering show instance in llviwermenu.cpp
+
+ if (LLViewerParcelMgr::getInstance()->selectionEmpty())
+ {
+ LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal());
+ }
+
+ // Done automatically when the selected parcel's properties arrive
+ // (and hence we have the local id).
+ // LLViewerParcelMgr::getInstance()->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER);
+
+ mParcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection();
- mParcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection();
-
- // Refresh even if not over a region so we don't get an
- // uninitialized dialog. The dialog is 0-region aware.
- refresh();
+ // Refresh even if not over a region so we don't get an
+ // uninitialized dialog. The dialog is 0-region aware.
+ refresh();
}
void LLFloaterLand::onVisibilityChanged(const LLSD& visible)
{
- if (!visible.asBoolean())
- {
- // Might have been showing owned objects
- LLSelectMgr::getInstance()->unhighlightAll();
+ if (!visible.asBoolean())
+ {
+ // Might have been showing owned objects
+ LLSelectMgr::getInstance()->unhighlightAll();
- // Save which panel we had open
- sLastTab = mTabLand->getCurrentPanelIndex();
- }
+ // Save which panel we had open
+ sLastTab = mTabLand->getCurrentPanelIndex();
+ }
}
LLFloaterLand::LLFloaterLand(const LLSD& seed)
-: LLFloater(seed)
-{
- mFactoryMap["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this);
- mFactoryMap["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this);
- mFactoryMap["land_objects_panel"] = LLCallbackMap(createPanelLandObjects, this);
- mFactoryMap["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this);
- mFactoryMap["land_audio_panel"] = LLCallbackMap(createPanelLandAudio, this);
- mFactoryMap["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this);
- mFactoryMap["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this);
- mFactoryMap["land_experiences_panel"] = LLCallbackMap(createPanelLandExperiences, this);
+: LLFloater(seed)
+{
+ mFactoryMap["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this);
+ mFactoryMap["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this);
+ mFactoryMap["land_objects_panel"] = LLCallbackMap(createPanelLandObjects, this);
+ mFactoryMap["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this);
+ mFactoryMap["land_audio_panel"] = LLCallbackMap(createPanelLandAudio, this);
+ mFactoryMap["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this);
+ mFactoryMap["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this);
+ mFactoryMap["land_experiences_panel"] = LLCallbackMap(createPanelLandExperiences, this);
mFactoryMap["land_environment_panel"] = LLCallbackMap(createPanelLandEnvironment, this);
- sObserver = new LLParcelSelectionObserver();
- LLViewerParcelMgr::getInstance()->addObserver( sObserver );
+ sObserver = new LLParcelSelectionObserver();
+ LLViewerParcelMgr::getInstance()->addObserver( sObserver );
}
BOOL LLFloaterLand::postBuild()
-{
- setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChanged, this, _2));
-
- LLTabContainer* tab = getChild<LLTabContainer>("landtab");
+{
+ setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChanged, this, _2));
- mTabLand = (LLTabContainer*) tab;
+ LLTabContainer* tab = getChild<LLTabContainer>("landtab");
- if (tab)
- {
- tab->selectTab(sLastTab);
- }
+ mTabLand = (LLTabContainer*) tab;
+
+ if (tab)
+ {
+ tab->selectTab(sLastTab);
+ }
- return TRUE;
+ return TRUE;
}
// virtual
LLFloaterLand::~LLFloaterLand()
{
- LLViewerParcelMgr::getInstance()->removeObserver( sObserver );
- delete sObserver;
- sObserver = NULL;
+ LLViewerParcelMgr::getInstance()->removeObserver( sObserver );
+ delete sObserver;
+ sObserver = NULL;
}
// public
void LLFloaterLand::refresh()
{
- mPanelGeneral->refresh();
- mPanelObjects->refresh();
- mPanelOptions->refresh();
- mPanelAudio->refresh();
- mPanelMedia->refresh();
- mPanelAccess->refresh();
- mPanelCovenant->refresh();
- mPanelExperiences->refresh();
+ mPanelGeneral->refresh();
+ mPanelObjects->refresh();
+ mPanelOptions->refresh();
+ mPanelAudio->refresh();
+ mPanelMedia->refresh();
+ mPanelAccess->refresh();
+ mPanelCovenant->refresh();
+ mPanelExperiences->refresh();
mPanelEnvironment->refresh();
}
@@ -361,69 +361,69 @@ void LLFloaterLand::refresh()
void* LLFloaterLand::createPanelLandGeneral(void* data)
{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelGeneral = new LLPanelLandGeneral(self->mParcel);
- return self->mPanelGeneral;
+ LLFloaterLand* self = (LLFloaterLand*)data;
+ self->mPanelGeneral = new LLPanelLandGeneral(self->mParcel);
+ return self->mPanelGeneral;
}
// static
void* LLFloaterLand::createPanelLandCovenant(void* data)
{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelCovenant = new LLPanelLandCovenant(self->mParcel);
- return self->mPanelCovenant;
+ LLFloaterLand* self = (LLFloaterLand*)data;
+ self->mPanelCovenant = new LLPanelLandCovenant(self->mParcel);
+ return self->mPanelCovenant;
}
// static
void* LLFloaterLand::createPanelLandObjects(void* data)
{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelObjects = new LLPanelLandObjects(self->mParcel);
- return self->mPanelObjects;
+ LLFloaterLand* self = (LLFloaterLand*)data;
+ self->mPanelObjects = new LLPanelLandObjects(self->mParcel);
+ return self->mPanelObjects;
}
// static
void* LLFloaterLand::createPanelLandOptions(void* data)
{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelOptions = new LLPanelLandOptions(self->mParcel);
- return self->mPanelOptions;
+ LLFloaterLand* self = (LLFloaterLand*)data;
+ self->mPanelOptions = new LLPanelLandOptions(self->mParcel);
+ return self->mPanelOptions;
}
// static
void* LLFloaterLand::createPanelLandAudio(void* data)
{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelAudio = new LLPanelLandAudio(self->mParcel);
- return self->mPanelAudio;
+ LLFloaterLand* self = (LLFloaterLand*)data;
+ self->mPanelAudio = new LLPanelLandAudio(self->mParcel);
+ return self->mPanelAudio;
}
// static
void* LLFloaterLand::createPanelLandMedia(void* data)
{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelMedia = new LLPanelLandMedia(self->mParcel);
- return self->mPanelMedia;
+ LLFloaterLand* self = (LLFloaterLand*)data;
+ self->mPanelMedia = new LLPanelLandMedia(self->mParcel);
+ return self->mPanelMedia;
}
// static
void* LLFloaterLand::createPanelLandAccess(void* data)
{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelAccess = new LLPanelLandAccess(self->mParcel);
- return self->mPanelAccess;
+ LLFloaterLand* self = (LLFloaterLand*)data;
+ self->mPanelAccess = new LLPanelLandAccess(self->mParcel);
+ return self->mPanelAccess;
}
// static
void* LLFloaterLand::createPanelLandExperiences(void* data)
{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelExperiences = new LLPanelLandExperiences(self->mParcel);
- return self->mPanelExperiences;
+ LLFloaterLand* self = (LLFloaterLand*)data;
+ self->mPanelExperiences = new LLPanelLandExperiences(self->mParcel);
+ return self->mPanelExperiences;
}
-//static
+//static
void* LLFloaterLand::createPanelLandEnvironment(void* data)
{
LLFloaterLand* self = (LLFloaterLand*)data;
@@ -438,135 +438,135 @@ void* LLFloaterLand::createPanelLandEnvironment(void* data)
LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel)
-: LLPanel(),
- mUncheckedSell(FALSE),
- mParcel(parcel)
+: LLPanel(),
+ mUncheckedSell(FALSE),
+ mParcel(parcel)
{
}
BOOL LLPanelLandGeneral::postBuild()
{
- mEditName = getChild<LLLineEditor>("Name");
- mEditName->setCommitCallback(onCommitAny, this);
- getChild<LLLineEditor>("Name")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
+ mEditName = getChild<LLLineEditor>("Name");
+ mEditName->setCommitCallback(onCommitAny, this);
+ getChild<LLLineEditor>("Name")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
- mEditDesc = getChild<LLTextEditor>("Description");
- mEditDesc->setCommitOnFocusLost(TRUE);
- mEditDesc->setCommitCallback(onCommitAny, this);
+ mEditDesc = getChild<LLTextEditor>("Description");
+ mEditDesc->setCommitOnFocusLost(TRUE);
+ mEditDesc->setCommitCallback(onCommitAny, this);
mEditDesc->setContentTrusted(false);
- // No prevalidate function - historically the prevalidate function was broken,
- // allowing residents to put in characters like U+2661 WHITE HEART SUIT, so
- // preserve that ability.
-
- mTextSalePending = getChild<LLTextBox>("SalePending");
- mTextOwnerLabel = getChild<LLTextBox>("Owner:");
- mTextOwner = getChild<LLTextBox>("OwnerText");
- mTextOwner->setIsFriendCallback(LLAvatarActions::isFriend);
-
- mContentRating = getChild<LLTextBox>("ContentRatingText");
- mLandType = getChild<LLTextBox>("LandTypeText");
-
- mBtnProfile = getChild<LLButton>("Profile...");
- mBtnProfile->setClickedCallback(boost::bind(&LLPanelLandGeneral::onClickProfile, this));
-
-
- mTextGroupLabel = getChild<LLTextBox>("Group:");
- mTextGroup = getChild<LLTextBox>("GroupText");
-
-
- mBtnSetGroup = getChild<LLButton>("Set...");
- mBtnSetGroup->setCommitCallback(boost::bind(&LLPanelLandGeneral::onClickSetGroup, this));
-
-
- mCheckDeedToGroup = getChild<LLCheckBoxCtrl>( "check deed");
- childSetCommitCallback("check deed", onCommitAny, this);
-
-
- mBtnDeedToGroup = getChild<LLButton>("Deed...");
- mBtnDeedToGroup->setClickedCallback(onClickDeed, this);
-
-
- mCheckContributeWithDeed = getChild<LLCheckBoxCtrl>( "check contrib");
- childSetCommitCallback("check contrib", onCommitAny, this);
-
-
-
- mSaleInfoNotForSale = getChild<LLTextBox>("Not for sale.");
-
- mSaleInfoForSale1 = getChild<LLTextBox>("For Sale: Price L$[PRICE].");
-
-
- mBtnSellLand = getChild<LLButton>("Sell Land...");
- mBtnSellLand->setClickedCallback(onClickSellLand, this);
-
- mSaleInfoForSale2 = getChild<LLTextBox>("For sale to");
-
- mSaleInfoForSaleObjects = getChild<LLTextBox>("Sell with landowners objects in parcel.");
-
- mSaleInfoForSaleNoObjects = getChild<LLTextBox>("Selling with no objects in parcel.");
-
-
- mBtnStopSellLand = getChild<LLButton>("Cancel Land Sale");
- mBtnStopSellLand->setClickedCallback(onClickStopSellLand, this);
-
-
- mTextClaimDateLabel = getChild<LLTextBox>("Claimed:");
- mTextClaimDate = getChild<LLTextBox>("DateClaimText");
-
-
- mTextPriceLabel = getChild<LLTextBox>("PriceLabel");
- mTextPrice = getChild<LLTextBox>("PriceText");
-
-
- mTextDwell = getChild<LLTextBox>("DwellText");
-
- mBtnBuyLand = getChild<LLButton>("Buy Land...");
- mBtnBuyLand->setClickedCallback(onClickBuyLand, (void*)&BUY_PERSONAL_LAND);
-
-
- mBtnBuyGroupLand = getChild<LLButton>("Buy For Group...");
- mBtnBuyGroupLand->setClickedCallback(onClickBuyLand, (void*)&BUY_GROUP_LAND);
-
-
- mBtnBuyPass = getChild<LLButton>("Buy Pass...");
- mBtnBuyPass->setClickedCallback(onClickBuyPass, this);
-
- mBtnReleaseLand = getChild<LLButton>("Abandon Land...");
- mBtnReleaseLand->setClickedCallback(onClickRelease, NULL);
-
- mBtnReclaimLand = getChild<LLButton>("Reclaim Land...");
- mBtnReclaimLand->setClickedCallback(onClickReclaim, NULL);
-
- mBtnStartAuction = getChild<LLButton>("Linden Sale...");
- mBtnStartAuction->setClickedCallback(onClickStartAuction, this);
-
- mBtnScriptLimits = getChild<LLButton>("Scripts...");
-
- if(gDisconnected)
- {
- return TRUE;
- }
-
- // note: on region change this will not be re checked, should not matter on Agni as
- // 99% of the time all regions will return the same caps. In case of an erroneous setting
- // to enabled the floater will just throw an error when trying to get it's cap
- std::string url = gAgent.getRegionCapability("LandResources");
- if (!url.empty())
- {
- if(mBtnScriptLimits)
- {
- mBtnScriptLimits->setClickedCallback(onClickScriptLimits, this);
- }
- }
- else
- {
- if(mBtnScriptLimits)
- {
- mBtnScriptLimits->setVisible(false);
- }
- }
-
- return TRUE;
+ // No prevalidate function - historically the prevalidate function was broken,
+ // allowing residents to put in characters like U+2661 WHITE HEART SUIT, so
+ // preserve that ability.
+
+ mTextSalePending = getChild<LLTextBox>("SalePending");
+ mTextOwnerLabel = getChild<LLTextBox>("Owner:");
+ mTextOwner = getChild<LLTextBox>("OwnerText");
+ mTextOwner->setIsFriendCallback(LLAvatarActions::isFriend);
+
+ mContentRating = getChild<LLTextBox>("ContentRatingText");
+ mLandType = getChild<LLTextBox>("LandTypeText");
+
+ mBtnProfile = getChild<LLButton>("Profile...");
+ mBtnProfile->setClickedCallback(boost::bind(&LLPanelLandGeneral::onClickProfile, this));
+
+
+ mTextGroupLabel = getChild<LLTextBox>("Group:");
+ mTextGroup = getChild<LLTextBox>("GroupText");
+
+
+ mBtnSetGroup = getChild<LLButton>("Set...");
+ mBtnSetGroup->setCommitCallback(boost::bind(&LLPanelLandGeneral::onClickSetGroup, this));
+
+
+ mCheckDeedToGroup = getChild<LLCheckBoxCtrl>( "check deed");
+ childSetCommitCallback("check deed", onCommitAny, this);
+
+
+ mBtnDeedToGroup = getChild<LLButton>("Deed...");
+ mBtnDeedToGroup->setClickedCallback(onClickDeed, this);
+
+
+ mCheckContributeWithDeed = getChild<LLCheckBoxCtrl>( "check contrib");
+ childSetCommitCallback("check contrib", onCommitAny, this);
+
+
+
+ mSaleInfoNotForSale = getChild<LLTextBox>("Not for sale.");
+
+ mSaleInfoForSale1 = getChild<LLTextBox>("For Sale: Price L$[PRICE].");
+
+
+ mBtnSellLand = getChild<LLButton>("Sell Land...");
+ mBtnSellLand->setClickedCallback(onClickSellLand, this);
+
+ mSaleInfoForSale2 = getChild<LLTextBox>("For sale to");
+
+ mSaleInfoForSaleObjects = getChild<LLTextBox>("Sell with landowners objects in parcel.");
+
+ mSaleInfoForSaleNoObjects = getChild<LLTextBox>("Selling with no objects in parcel.");
+
+
+ mBtnStopSellLand = getChild<LLButton>("Cancel Land Sale");
+ mBtnStopSellLand->setClickedCallback(onClickStopSellLand, this);
+
+
+ mTextClaimDateLabel = getChild<LLTextBox>("Claimed:");
+ mTextClaimDate = getChild<LLTextBox>("DateClaimText");
+
+
+ mTextPriceLabel = getChild<LLTextBox>("PriceLabel");
+ mTextPrice = getChild<LLTextBox>("PriceText");
+
+
+ mTextDwell = getChild<LLTextBox>("DwellText");
+
+ mBtnBuyLand = getChild<LLButton>("Buy Land...");
+ mBtnBuyLand->setClickedCallback(onClickBuyLand, (void*)&BUY_PERSONAL_LAND);
+
+
+ mBtnBuyGroupLand = getChild<LLButton>("Buy For Group...");
+ mBtnBuyGroupLand->setClickedCallback(onClickBuyLand, (void*)&BUY_GROUP_LAND);
+
+
+ mBtnBuyPass = getChild<LLButton>("Buy Pass...");
+ mBtnBuyPass->setClickedCallback(onClickBuyPass, this);
+
+ mBtnReleaseLand = getChild<LLButton>("Abandon Land...");
+ mBtnReleaseLand->setClickedCallback(onClickRelease, NULL);
+
+ mBtnReclaimLand = getChild<LLButton>("Reclaim Land...");
+ mBtnReclaimLand->setClickedCallback(onClickReclaim, NULL);
+
+ mBtnStartAuction = getChild<LLButton>("Linden Sale...");
+ mBtnStartAuction->setClickedCallback(onClickStartAuction, this);
+
+ mBtnScriptLimits = getChild<LLButton>("Scripts...");
+
+ if(gDisconnected)
+ {
+ return TRUE;
+ }
+
+ // note: on region change this will not be re checked, should not matter on Agni as
+ // 99% of the time all regions will return the same caps. In case of an erroneous setting
+ // to enabled the floater will just throw an error when trying to get it's cap
+ std::string url = gAgent.getRegionCapability("LandResources");
+ if (!url.empty())
+ {
+ if(mBtnScriptLimits)
+ {
+ mBtnScriptLimits->setClickedCallback(onClickScriptLimits, this);
+ }
+ }
+ else
+ {
+ if(mBtnScriptLimits)
+ {
+ mBtnScriptLimits->setVisible(false);
+ }
+ }
+
+ return TRUE;
}
@@ -578,614 +578,614 @@ LLPanelLandGeneral::~LLPanelLandGeneral()
// public
void LLPanelLandGeneral::refresh()
{
- mEditName->setEnabled(FALSE);
- mEditName->setText(LLStringUtil::null);
-
- mEditDesc->setEnabled(FALSE);
- mEditDesc->setText(getString("no_selection_text"));
-
- mTextSalePending->setText(LLStringUtil::null);
- mTextSalePending->setEnabled(FALSE);
-
- mBtnDeedToGroup->setEnabled(FALSE);
- mBtnSetGroup->setEnabled(FALSE);
- mBtnStartAuction->setEnabled(FALSE);
-
- mCheckDeedToGroup ->set(FALSE);
- mCheckDeedToGroup ->setEnabled(FALSE);
- mCheckContributeWithDeed->set(FALSE);
- mCheckContributeWithDeed->setEnabled(FALSE);
-
- mTextOwner->setText(LLStringUtil::null);
- mContentRating->setText(LLStringUtil::null);
- mLandType->setText(LLStringUtil::null);
- mBtnProfile->setLabel(getString("profile_text"));
- mBtnProfile->setEnabled(FALSE);
-
- mTextClaimDate->setText(LLStringUtil::null);
- mTextGroup->setText(LLStringUtil::null);
- mTextPrice->setText(LLStringUtil::null);
-
- mSaleInfoForSale1->setVisible(FALSE);
- mSaleInfoForSale2->setVisible(FALSE);
- mSaleInfoForSaleObjects->setVisible(FALSE);
- mSaleInfoForSaleNoObjects->setVisible(FALSE);
- mSaleInfoNotForSale->setVisible(FALSE);
- mBtnSellLand->setVisible(FALSE);
- mBtnStopSellLand->setVisible(FALSE);
-
- mTextPriceLabel->setText(LLStringUtil::null);
- mTextDwell->setText(LLStringUtil::null);
-
- mBtnBuyLand->setEnabled(FALSE);
- mBtnScriptLimits->setEnabled(FALSE);
- mBtnBuyGroupLand->setEnabled(FALSE);
- mBtnReleaseLand->setEnabled(FALSE);
- mBtnReclaimLand->setEnabled(FALSE);
- mBtnBuyPass->setEnabled(FALSE);
-
- if(gDisconnected)
- {
- return;
- }
-
- mBtnStartAuction->setVisible(gAgent.isGodlike());
- bool region_owner = false;
- LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if(regionp && (regionp->getOwner() == gAgent.getID()))
- {
- region_owner = true;
- mBtnReleaseLand->setVisible(FALSE);
- mBtnReclaimLand->setVisible(TRUE);
- }
- else
- {
- mBtnReleaseLand->setVisible(TRUE);
- mBtnReclaimLand->setVisible(FALSE);
- }
- LLParcel *parcel = mParcel->getParcel();
- if (parcel)
- {
- // something selected, hooray!
- BOOL is_leased = (LLParcel::OS_LEASED == parcel->getOwnershipStatus());
- BOOL region_xfer = FALSE;
- if(regionp
- && !(regionp->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)))
- {
- region_xfer = TRUE;
- }
-
- if (regionp)
- {
- insert_maturity_into_textbox(mContentRating, gFloaterView->getParentFloater(this), MATURITY);
- mLandType->setText(regionp->getLocalizedSimProductName());
- }
-
- // estate owner/manager cannot edit other parts of the parcel
- BOOL estate_manager_sellable = !parcel->getAuctionID()
- && gAgent.canManageEstate()
- // estate manager/owner can only sell parcels owned by estate owner
- && regionp
- && (parcel->getOwnerID() == regionp->getOwner());
- BOOL owner_sellable = region_xfer && !parcel->getAuctionID()
- && LLViewerParcelMgr::isParcelModifiableByAgent(
- parcel, GP_LAND_SET_SALE_INFO);
- BOOL can_be_sold = owner_sellable || estate_manager_sellable;
-
- const LLUUID &owner_id = parcel->getOwnerID();
- BOOL is_public = parcel->isPublic();
-
- // Is it owned?
- if (is_public)
- {
- mTextSalePending->setText(LLStringUtil::null);
- mTextSalePending->setEnabled(FALSE);
- mTextOwner->setText(getString("public_text"));
- mTextOwner->setEnabled(FALSE);
- mBtnProfile->setEnabled(FALSE);
- mTextClaimDate->setText(LLStringUtil::null);
- mTextClaimDate->setEnabled(FALSE);
- mTextGroup->setText(getString("none_text"));
- mTextGroup->setEnabled(FALSE);
- mBtnStartAuction->setEnabled(FALSE);
- }
- else
- {
- if(!is_leased && (owner_id == gAgent.getID()))
- {
- mTextSalePending->setText(getString("need_tier_to_modify"));
- mTextSalePending->setEnabled(TRUE);
- }
- else if(parcel->getAuctionID())
- {
- mTextSalePending->setText(getString("auction_id_text"));
- mTextSalePending->setTextArg("[ID]", llformat("%u", parcel->getAuctionID()));
- mTextSalePending->setEnabled(TRUE);
- }
- else
- {
- // not the owner, or it is leased
- mTextSalePending->setText(LLStringUtil::null);
- mTextSalePending->setEnabled(FALSE);
- }
- //refreshNames();
- mTextOwner->setEnabled(TRUE);
-
- // We support both group and personal profiles
- mBtnProfile->setEnabled(TRUE);
-
- if (parcel->getGroupID().isNull())
- {
- // Not group owned, so "Profile"
- mBtnProfile->setLabel(getString("profile_text"));
-
- mTextGroup->setText(getString("none_text"));
- mTextGroup->setEnabled(FALSE);
- }
- else
- {
- // Group owned, so "Info"
- mBtnProfile->setLabel(getString("info_text"));
-
- //mTextGroup->setText("HIPPOS!");//parcel->getGroupName());
- mTextGroup->setEnabled(TRUE);
- }
-
- // Display claim date
- time_t claim_date = parcel->getClaimDate();
- std::string claim_date_str = getString("time_stamp_template");
- LLSD substitution;
- substitution["datetime"] = (S32) claim_date;
- LLStringUtil::format (claim_date_str, substitution);
- mTextClaimDate->setText(claim_date_str);
- mTextClaimDate->setEnabled(is_leased);
-
- BOOL enable_auction = (gAgent.getGodLevel() >= GOD_LIAISON)
- && (owner_id == GOVERNOR_LINDEN_ID)
- && (parcel->getAuctionID() == 0);
- mBtnStartAuction->setEnabled(enable_auction);
- }
-
- // Display options
- BOOL can_edit_identity = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY);
- mEditName->setEnabled(can_edit_identity);
- mEditDesc->setEnabled(can_edit_identity);
+ mEditName->setEnabled(FALSE);
+ mEditName->setText(LLStringUtil::null);
+
+ mEditDesc->setEnabled(FALSE);
+ mEditDesc->setText(getString("no_selection_text"));
+
+ mTextSalePending->setText(LLStringUtil::null);
+ mTextSalePending->setEnabled(FALSE);
+
+ mBtnDeedToGroup->setEnabled(FALSE);
+ mBtnSetGroup->setEnabled(FALSE);
+ mBtnStartAuction->setEnabled(FALSE);
+
+ mCheckDeedToGroup ->set(FALSE);
+ mCheckDeedToGroup ->setEnabled(FALSE);
+ mCheckContributeWithDeed->set(FALSE);
+ mCheckContributeWithDeed->setEnabled(FALSE);
+
+ mTextOwner->setText(LLStringUtil::null);
+ mContentRating->setText(LLStringUtil::null);
+ mLandType->setText(LLStringUtil::null);
+ mBtnProfile->setLabel(getString("profile_text"));
+ mBtnProfile->setEnabled(FALSE);
+
+ mTextClaimDate->setText(LLStringUtil::null);
+ mTextGroup->setText(LLStringUtil::null);
+ mTextPrice->setText(LLStringUtil::null);
+
+ mSaleInfoForSale1->setVisible(FALSE);
+ mSaleInfoForSale2->setVisible(FALSE);
+ mSaleInfoForSaleObjects->setVisible(FALSE);
+ mSaleInfoForSaleNoObjects->setVisible(FALSE);
+ mSaleInfoNotForSale->setVisible(FALSE);
+ mBtnSellLand->setVisible(FALSE);
+ mBtnStopSellLand->setVisible(FALSE);
+
+ mTextPriceLabel->setText(LLStringUtil::null);
+ mTextDwell->setText(LLStringUtil::null);
+
+ mBtnBuyLand->setEnabled(FALSE);
+ mBtnScriptLimits->setEnabled(FALSE);
+ mBtnBuyGroupLand->setEnabled(FALSE);
+ mBtnReleaseLand->setEnabled(FALSE);
+ mBtnReclaimLand->setEnabled(FALSE);
+ mBtnBuyPass->setEnabled(FALSE);
+
+ if(gDisconnected)
+ {
+ return;
+ }
+
+ mBtnStartAuction->setVisible(gAgent.isGodlike());
+ bool region_owner = false;
+ LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if(regionp && (regionp->getOwner() == gAgent.getID()))
+ {
+ region_owner = true;
+ mBtnReleaseLand->setVisible(FALSE);
+ mBtnReclaimLand->setVisible(TRUE);
+ }
+ else
+ {
+ mBtnReleaseLand->setVisible(TRUE);
+ mBtnReclaimLand->setVisible(FALSE);
+ }
+ LLParcel *parcel = mParcel->getParcel();
+ if (parcel)
+ {
+ // something selected, hooray!
+ BOOL is_leased = (LLParcel::OS_LEASED == parcel->getOwnershipStatus());
+ BOOL region_xfer = FALSE;
+ if(regionp
+ && !(regionp->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)))
+ {
+ region_xfer = TRUE;
+ }
+
+ if (regionp)
+ {
+ insert_maturity_into_textbox(mContentRating, gFloaterView->getParentFloater(this), MATURITY);
+ mLandType->setText(regionp->getLocalizedSimProductName());
+ }
+
+ // estate owner/manager cannot edit other parts of the parcel
+ BOOL estate_manager_sellable = !parcel->getAuctionID()
+ && gAgent.canManageEstate()
+ // estate manager/owner can only sell parcels owned by estate owner
+ && regionp
+ && (parcel->getOwnerID() == regionp->getOwner());
+ BOOL owner_sellable = region_xfer && !parcel->getAuctionID()
+ && LLViewerParcelMgr::isParcelModifiableByAgent(
+ parcel, GP_LAND_SET_SALE_INFO);
+ BOOL can_be_sold = owner_sellable || estate_manager_sellable;
+
+ const LLUUID &owner_id = parcel->getOwnerID();
+ BOOL is_public = parcel->isPublic();
+
+ // Is it owned?
+ if (is_public)
+ {
+ mTextSalePending->setText(LLStringUtil::null);
+ mTextSalePending->setEnabled(FALSE);
+ mTextOwner->setText(getString("public_text"));
+ mTextOwner->setEnabled(FALSE);
+ mBtnProfile->setEnabled(FALSE);
+ mTextClaimDate->setText(LLStringUtil::null);
+ mTextClaimDate->setEnabled(FALSE);
+ mTextGroup->setText(getString("none_text"));
+ mTextGroup->setEnabled(FALSE);
+ mBtnStartAuction->setEnabled(FALSE);
+ }
+ else
+ {
+ if(!is_leased && (owner_id == gAgent.getID()))
+ {
+ mTextSalePending->setText(getString("need_tier_to_modify"));
+ mTextSalePending->setEnabled(TRUE);
+ }
+ else if(parcel->getAuctionID())
+ {
+ mTextSalePending->setText(getString("auction_id_text"));
+ mTextSalePending->setTextArg("[ID]", llformat("%u", parcel->getAuctionID()));
+ mTextSalePending->setEnabled(TRUE);
+ }
+ else
+ {
+ // not the owner, or it is leased
+ mTextSalePending->setText(LLStringUtil::null);
+ mTextSalePending->setEnabled(FALSE);
+ }
+ //refreshNames();
+ mTextOwner->setEnabled(TRUE);
+
+ // We support both group and personal profiles
+ mBtnProfile->setEnabled(TRUE);
+
+ if (parcel->getGroupID().isNull())
+ {
+ // Not group owned, so "Profile"
+ mBtnProfile->setLabel(getString("profile_text"));
+
+ mTextGroup->setText(getString("none_text"));
+ mTextGroup->setEnabled(FALSE);
+ }
+ else
+ {
+ // Group owned, so "Info"
+ mBtnProfile->setLabel(getString("info_text"));
+
+ //mTextGroup->setText("HIPPOS!");//parcel->getGroupName());
+ mTextGroup->setEnabled(TRUE);
+ }
+
+ // Display claim date
+ time_t claim_date = parcel->getClaimDate();
+ std::string claim_date_str = getString("time_stamp_template");
+ LLSD substitution;
+ substitution["datetime"] = (S32) claim_date;
+ LLStringUtil::format (claim_date_str, substitution);
+ mTextClaimDate->setText(claim_date_str);
+ mTextClaimDate->setEnabled(is_leased);
+
+ BOOL enable_auction = (gAgent.getGodLevel() >= GOD_LIAISON)
+ && (owner_id == GOVERNOR_LINDEN_ID)
+ && (parcel->getAuctionID() == 0);
+ mBtnStartAuction->setEnabled(enable_auction);
+ }
+
+ // Display options
+ BOOL can_edit_identity = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY);
+ mEditName->setEnabled(can_edit_identity);
+ mEditDesc->setEnabled(can_edit_identity);
mEditDesc->setParseURLs(!can_edit_identity);
- BOOL can_edit_agent_only = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_NO_POWERS);
- mBtnSetGroup->setEnabled(can_edit_agent_only && !parcel->getIsGroupOwned());
-
- const LLUUID& group_id = parcel->getGroupID();
-
- // Can only allow deeding if you own it and it's got a group.
- BOOL enable_deed = (owner_id == gAgent.getID()
- && group_id.notNull()
- && gAgent.isInGroup(group_id));
- // You don't need special powers to allow your object to
- // be deeded to the group.
- mCheckDeedToGroup->setEnabled(enable_deed);
- mCheckDeedToGroup->set( parcel->getAllowDeedToGroup() );
- mCheckContributeWithDeed->setEnabled(enable_deed && parcel->getAllowDeedToGroup());
- mCheckContributeWithDeed->set(parcel->getContributeWithDeed());
-
- // Actually doing the deeding requires you to have GP_LAND_DEED
- // powers in the group.
- BOOL can_deed = gAgent.hasPowerInGroup(group_id, GP_LAND_DEED);
- mBtnDeedToGroup->setEnabled( parcel->getAllowDeedToGroup()
- && group_id.notNull()
- && can_deed
- && !parcel->getIsGroupOwned()
- );
-
- mEditName->setText( parcel->getName() );
- mEditDesc->setText( parcel->getDesc() );
-
- BOOL for_sale = parcel->getForSale();
-
- mBtnSellLand->setVisible(FALSE);
- mBtnStopSellLand->setVisible(FALSE);
-
- // show pricing information
- S32 area;
- S32 claim_price;
- S32 rent_price;
- F32 dwell = DWELL_NAN;
- LLViewerParcelMgr::getInstance()->getDisplayInfo(&area,
- &claim_price,
- &rent_price,
- &for_sale,
- &dwell);
- // Area
- LLUIString price = getString("area_size_text");
- price.setArg("[AREA]", llformat("%d",area));
- mTextPriceLabel->setText(getString("area_text"));
- mTextPrice->setText(price.getString());
-
- if (dwell == DWELL_NAN)
- {
- mTextDwell->setText(LLTrans::getString("LoadingData"));
- }
- else
- {
- mTextDwell->setText(llformat("%.0f", dwell));
- }
-
- if (for_sale)
- {
- mSaleInfoForSale1->setVisible(TRUE);
- mSaleInfoForSale2->setVisible(TRUE);
- if (parcel->getSellWithObjects())
- {
- mSaleInfoForSaleObjects->setVisible(TRUE);
- mSaleInfoForSaleNoObjects->setVisible(FALSE);
- }
- else
- {
- mSaleInfoForSaleObjects->setVisible(FALSE);
- mSaleInfoForSaleNoObjects->setVisible(TRUE);
- }
- mSaleInfoNotForSale->setVisible(FALSE);
-
- F32 cost_per_sqm = 0.0f;
- if (area > 0)
- {
- cost_per_sqm = (F32)parcel->getSalePrice() / (F32)area;
- }
-
- S32 price = parcel->getSalePrice();
- mSaleInfoForSale1->setTextArg("[PRICE]", LLResMgr::getInstance()->getMonetaryString(price));
- mSaleInfoForSale1->setTextArg("[PRICE_PER_SQM]", llformat("%.1f", cost_per_sqm));
- if (can_be_sold)
- {
- mBtnStopSellLand->setVisible(TRUE);
- }
- }
- else
- {
- mSaleInfoForSale1->setVisible(FALSE);
- mSaleInfoForSale2->setVisible(FALSE);
- mSaleInfoForSaleObjects->setVisible(FALSE);
- mSaleInfoForSaleNoObjects->setVisible(FALSE);
- mSaleInfoNotForSale->setVisible(TRUE);
- if (can_be_sold)
- {
- mBtnSellLand->setVisible(TRUE);
- }
- }
-
- refreshNames();
-
- mBtnBuyLand->setEnabled(
- LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false));
- mBtnScriptLimits->setEnabled(true);
-// LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false));
- mBtnBuyGroupLand->setEnabled(
- LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, true));
-
- if(region_owner)
- {
- mBtnReclaimLand->setEnabled(
- !is_public && (parcel->getOwnerID() != gAgent.getID()));
- }
- else
- {
- BOOL is_owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE);
- BOOL is_manager_release = (gAgent.canManageEstate() &&
- regionp &&
- (parcel->getOwnerID() != regionp->getOwner()));
- BOOL can_release = is_owner_release || is_manager_release;
- mBtnReleaseLand->setEnabled( can_release );
- }
-
- BOOL use_pass = parcel->getOwnerID()!= gAgent.getID() && parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned();;
- mBtnBuyPass->setEnabled(use_pass);
-
- }
+ BOOL can_edit_agent_only = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_NO_POWERS);
+ mBtnSetGroup->setEnabled(can_edit_agent_only && !parcel->getIsGroupOwned());
+
+ const LLUUID& group_id = parcel->getGroupID();
+
+ // Can only allow deeding if you own it and it's got a group.
+ BOOL enable_deed = (owner_id == gAgent.getID()
+ && group_id.notNull()
+ && gAgent.isInGroup(group_id));
+ // You don't need special powers to allow your object to
+ // be deeded to the group.
+ mCheckDeedToGroup->setEnabled(enable_deed);
+ mCheckDeedToGroup->set( parcel->getAllowDeedToGroup() );
+ mCheckContributeWithDeed->setEnabled(enable_deed && parcel->getAllowDeedToGroup());
+ mCheckContributeWithDeed->set(parcel->getContributeWithDeed());
+
+ // Actually doing the deeding requires you to have GP_LAND_DEED
+ // powers in the group.
+ BOOL can_deed = gAgent.hasPowerInGroup(group_id, GP_LAND_DEED);
+ mBtnDeedToGroup->setEnabled( parcel->getAllowDeedToGroup()
+ && group_id.notNull()
+ && can_deed
+ && !parcel->getIsGroupOwned()
+ );
+
+ mEditName->setText( parcel->getName() );
+ mEditDesc->setText( parcel->getDesc() );
+
+ BOOL for_sale = parcel->getForSale();
+
+ mBtnSellLand->setVisible(FALSE);
+ mBtnStopSellLand->setVisible(FALSE);
+
+ // show pricing information
+ S32 area;
+ S32 claim_price;
+ S32 rent_price;
+ F32 dwell = DWELL_NAN;
+ LLViewerParcelMgr::getInstance()->getDisplayInfo(&area,
+ &claim_price,
+ &rent_price,
+ &for_sale,
+ &dwell);
+ // Area
+ LLUIString price = getString("area_size_text");
+ price.setArg("[AREA]", llformat("%d",area));
+ mTextPriceLabel->setText(getString("area_text"));
+ mTextPrice->setText(price.getString());
+
+ if (dwell == DWELL_NAN)
+ {
+ mTextDwell->setText(LLTrans::getString("LoadingData"));
+ }
+ else
+ {
+ mTextDwell->setText(llformat("%.0f", dwell));
+ }
+
+ if (for_sale)
+ {
+ mSaleInfoForSale1->setVisible(TRUE);
+ mSaleInfoForSale2->setVisible(TRUE);
+ if (parcel->getSellWithObjects())
+ {
+ mSaleInfoForSaleObjects->setVisible(TRUE);
+ mSaleInfoForSaleNoObjects->setVisible(FALSE);
+ }
+ else
+ {
+ mSaleInfoForSaleObjects->setVisible(FALSE);
+ mSaleInfoForSaleNoObjects->setVisible(TRUE);
+ }
+ mSaleInfoNotForSale->setVisible(FALSE);
+
+ F32 cost_per_sqm = 0.0f;
+ if (area > 0)
+ {
+ cost_per_sqm = (F32)parcel->getSalePrice() / (F32)area;
+ }
+
+ S32 price = parcel->getSalePrice();
+ mSaleInfoForSale1->setTextArg("[PRICE]", LLResMgr::getInstance()->getMonetaryString(price));
+ mSaleInfoForSale1->setTextArg("[PRICE_PER_SQM]", llformat("%.1f", cost_per_sqm));
+ if (can_be_sold)
+ {
+ mBtnStopSellLand->setVisible(TRUE);
+ }
+ }
+ else
+ {
+ mSaleInfoForSale1->setVisible(FALSE);
+ mSaleInfoForSale2->setVisible(FALSE);
+ mSaleInfoForSaleObjects->setVisible(FALSE);
+ mSaleInfoForSaleNoObjects->setVisible(FALSE);
+ mSaleInfoNotForSale->setVisible(TRUE);
+ if (can_be_sold)
+ {
+ mBtnSellLand->setVisible(TRUE);
+ }
+ }
+
+ refreshNames();
+
+ mBtnBuyLand->setEnabled(
+ LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false));
+ mBtnScriptLimits->setEnabled(true);
+// LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false));
+ mBtnBuyGroupLand->setEnabled(
+ LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, true));
+
+ if(region_owner)
+ {
+ mBtnReclaimLand->setEnabled(
+ !is_public && (parcel->getOwnerID() != gAgent.getID()));
+ }
+ else
+ {
+ BOOL is_owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE);
+ BOOL is_manager_release = (gAgent.canManageEstate() &&
+ regionp &&
+ (parcel->getOwnerID() != regionp->getOwner()));
+ BOOL can_release = is_owner_release || is_manager_release;
+ mBtnReleaseLand->setEnabled( can_release );
+ }
+
+ BOOL use_pass = parcel->getOwnerID()!= gAgent.getID() && parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned();;
+ mBtnBuyPass->setEnabled(use_pass);
+
+ }
}
// public
void LLPanelLandGeneral::refreshNames()
{
- LLParcel *parcel = mParcel->getParcel();
- if (!parcel)
- {
- mTextOwner->setText(LLStringUtil::null);
- mTextGroup->setText(LLStringUtil::null);
- return;
- }
-
- std::string owner;
- if (parcel->getIsGroupOwned())
- {
- owner = getString("group_owned_text");
- }
- else
- {
- // Figure out the owner's name
- owner = LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
- }
-
- if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
- {
- owner += getString("sale_pending_text");
- }
- mTextOwner->setText(owner);
-
- std::string group;
- if (!parcel->getGroupID().isNull())
- {
- group = LLSLURL("group", parcel->getGroupID(), "inspect").getSLURLString();
- }
- mTextGroup->setText(group);
-
- if (parcel->getForSale())
- {
- const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
- if(auth_buyer_id.notNull())
- {
- std::string name;
- name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString();
- mSaleInfoForSale2->setTextArg("[BUYER]", name);
- }
- else
- {
- mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone"));
- }
- }
+ LLParcel *parcel = mParcel->getParcel();
+ if (!parcel)
+ {
+ mTextOwner->setText(LLStringUtil::null);
+ mTextGroup->setText(LLStringUtil::null);
+ return;
+ }
+
+ std::string owner;
+ if (parcel->getIsGroupOwned())
+ {
+ owner = getString("group_owned_text");
+ }
+ else
+ {
+ // Figure out the owner's name
+ owner = LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
+ }
+
+ if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
+ {
+ owner += getString("sale_pending_text");
+ }
+ mTextOwner->setText(owner);
+
+ std::string group;
+ if (!parcel->getGroupID().isNull())
+ {
+ group = LLSLURL("group", parcel->getGroupID(), "inspect").getSLURLString();
+ }
+ mTextGroup->setText(group);
+
+ if (parcel->getForSale())
+ {
+ const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
+ if(auth_buyer_id.notNull())
+ {
+ std::string name;
+ name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString();
+ mSaleInfoForSale2->setTextArg("[BUYER]", name);
+ }
+ else
+ {
+ mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone"));
+ }
+ }
}
// virtual
void LLPanelLandGeneral::draw()
{
- LLPanel::draw();
+ LLPanel::draw();
}
void LLPanelLandGeneral::onClickSetGroup()
{
- LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
- LLFloaterGroupPicker* fg = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
- if (fg)
- {
- fg->setSelectGroupCallback( boost::bind(&LLPanelLandGeneral::setGroup, this, _1 ));
- if (parent_floater)
- {
- LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg);
- fg->setOrigin(new_rect.mLeft, new_rect.mBottom);
- parent_floater->addDependentFloater(fg);
- }
- }
+ LLFloaterGroupPicker* fg = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
+ if (fg)
+ {
+ fg->setSelectGroupCallback( boost::bind(&LLPanelLandGeneral::setGroup, this, _1 ));
+ if (parent_floater)
+ {
+ LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg);
+ fg->setOrigin(new_rect.mLeft, new_rect.mBottom);
+ parent_floater->addDependentFloater(fg);
+ }
+ }
}
void LLPanelLandGeneral::onClickProfile()
{
- LLParcel* parcel = mParcel->getParcel();
- if (!parcel) return;
+ LLParcel* parcel = mParcel->getParcel();
+ if (!parcel) return;
- if (parcel->getIsGroupOwned())
- {
- const LLUUID& group_id = parcel->getGroupID();
- LLGroupActions::show(group_id);
- }
- else
- {
- const LLUUID& avatar_id = parcel->getOwnerID();
- LLAvatarActions::showProfile(avatar_id);
- }
+ if (parcel->getIsGroupOwned())
+ {
+ const LLUUID& group_id = parcel->getGroupID();
+ LLGroupActions::show(group_id);
+ }
+ else
+ {
+ const LLUUID& avatar_id = parcel->getOwnerID();
+ LLAvatarActions::showProfile(avatar_id);
+ }
}
// public
void LLPanelLandGeneral::setGroup(const LLUUID& group_id)
{
- LLParcel* parcel = mParcel->getParcel();
- if (!parcel) return;
+ LLParcel* parcel = mParcel->getParcel();
+ if (!parcel) return;
- // Set parcel properties and send message
- parcel->setGroupID(group_id);
- //parcel->setGroupName(group_name);
- //mTextGroup->setText(group_name);
+ // Set parcel properties and send message
+ parcel->setGroupID(group_id);
+ //parcel->setGroupName(group_name);
+ //mTextGroup->setText(group_name);
- // Send update
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(parcel);
+ // Send update
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(parcel);
- // Update UI
- refresh();
+ // Update UI
+ refresh();
}
// static
void LLPanelLandGeneral::onClickBuyLand(void* data)
{
- BOOL* for_group = (BOOL*)data;
- LLViewerParcelMgr::getInstance()->startBuyLand(*for_group);
+ BOOL* for_group = (BOOL*)data;
+ LLViewerParcelMgr::getInstance()->startBuyLand(*for_group);
}
// static
void LLPanelLandGeneral::onClickScriptLimits(void* data)
{
- LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
- LLParcel* parcel = panelp->mParcel->getParcel();
- if(parcel != NULL)
- {
- LLFloaterReg::showInstance("script_limits");
- }
+ LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
+ LLParcel* parcel = panelp->mParcel->getParcel();
+ if(parcel != NULL)
+ {
+ LLFloaterReg::showInstance("script_limits");
+ }
}
// static
void LLPanelLandGeneral::onClickDeed(void*)
{
- //LLParcel* parcel = mParcel->getParcel();
- //if (parcel)
- //{
- LLViewerParcelMgr::getInstance()->startDeedLandToGroup();
- //}
+ //LLParcel* parcel = mParcel->getParcel();
+ //if (parcel)
+ //{
+ LLViewerParcelMgr::getInstance()->startDeedLandToGroup();
+ //}
}
// static
void LLPanelLandGeneral::onClickRelease(void*)
{
- LLViewerParcelMgr::getInstance()->startReleaseLand();
+ LLViewerParcelMgr::getInstance()->startReleaseLand();
}
// static
void LLPanelLandGeneral::onClickReclaim(void*)
{
- LL_DEBUGS() << "LLPanelLandGeneral::onClickReclaim()" << LL_ENDL;
- LLViewerParcelMgr::getInstance()->reclaimParcel();
+ LL_DEBUGS() << "LLPanelLandGeneral::onClickReclaim()" << LL_ENDL;
+ LLViewerParcelMgr::getInstance()->reclaimParcel();
}
// static
BOOL LLPanelLandGeneral::enableBuyPass(void* data)
{
- LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
- LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
- return (parcel != NULL) && (parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned());
+ LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
+ LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+ return (parcel != NULL) && (parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned());
}
// static
void LLPanelLandGeneral::onClickBuyPass(void* data)
{
- LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
- LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+ LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
+ LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+
+ if (!parcel) return;
- if (!parcel) return;
+ S32 pass_price = parcel->getPassPrice();
+ std::string parcel_name = parcel->getName();
+ F32 pass_hours = parcel->getPassHours();
- S32 pass_price = parcel->getPassPrice();
- std::string parcel_name = parcel->getName();
- F32 pass_hours = parcel->getPassHours();
+ std::string cost, time;
+ cost = llformat("%d", pass_price);
+ time = llformat("%.2f", pass_hours);
- std::string cost, time;
- cost = llformat("%d", pass_price);
- time = llformat("%.2f", pass_hours);
+ LLSD args;
+ args["COST"] = cost;
+ args["PARCEL_NAME"] = parcel_name;
+ args["TIME"] = time;
- LLSD args;
- args["COST"] = cost;
- args["PARCEL_NAME"] = parcel_name;
- args["TIME"] = time;
-
- // creating pointer on selection to avoid deselection of parcel until we are done with buying pass (EXT-6464)
- sSelectionForBuyPass = LLViewerParcelMgr::getInstance()->getParcelSelection();
- LLNotificationsUtil::add("LandBuyPass", args, LLSD(), cbBuyPass);
+ // creating pointer on selection to avoid deselection of parcel until we are done with buying pass (EXT-6464)
+ sSelectionForBuyPass = LLViewerParcelMgr::getInstance()->getParcelSelection();
+ LLNotificationsUtil::add("LandBuyPass", args, LLSD(), cbBuyPass);
}
// static
void LLPanelLandGeneral::onClickStartAuction(void* data)
{
- LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
- LLParcel* parcelp = panelp->mParcel->getParcel();
- if(parcelp)
- {
- if(parcelp->getForSale())
- {
- LLNotificationsUtil::add("CannotStartAuctionAlreadyForSale");
- }
- else
- {
- //LLFloaterAuction::showInstance();
- LLFloaterReg::showInstance("auction");
- }
- }
+ LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
+ LLParcel* parcelp = panelp->mParcel->getParcel();
+ if(parcelp)
+ {
+ if(parcelp->getForSale())
+ {
+ LLNotificationsUtil::add("CannotStartAuctionAlreadyForSale");
+ }
+ else
+ {
+ //LLFloaterAuction::showInstance();
+ LLFloaterReg::showInstance("auction");
+ }
+ }
}
// static
bool LLPanelLandGeneral::cbBuyPass(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- // User clicked OK
- LLViewerParcelMgr::getInstance()->buyPass();
- }
- // we are done with buying pass, additional selection is no longer needed
- sSelectionForBuyPass = NULL;
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ // User clicked OK
+ LLViewerParcelMgr::getInstance()->buyPass();
+ }
+ // we are done with buying pass, additional selection is no longer needed
+ sSelectionForBuyPass = NULL;
+ return false;
}
// static
void LLPanelLandGeneral::onCommitAny(LLUICtrl *ctrl, void *userdata)
{
- LLPanelLandGeneral *panelp = (LLPanelLandGeneral *)userdata;
+ LLPanelLandGeneral *panelp = (LLPanelLandGeneral *)userdata;
- LLParcel* parcel = panelp->mParcel->getParcel();
- if (!parcel)
- {
- return;
- }
+ LLParcel* parcel = panelp->mParcel->getParcel();
+ if (!parcel)
+ {
+ return;
+ }
- // Extract data from UI
- std::string name = panelp->mEditName->getText();
- std::string desc = panelp->mEditDesc->getText();
+ // Extract data from UI
+ std::string name = panelp->mEditName->getText();
+ std::string desc = panelp->mEditDesc->getText();
- // Valid data from UI
+ // Valid data from UI
- // Stuff data into selected parcel
- parcel->setName(name);
- parcel->setDesc(desc);
+ // Stuff data into selected parcel
+ parcel->setName(name);
+ parcel->setDesc(desc);
- BOOL allow_deed_to_group= panelp->mCheckDeedToGroup->get();
- BOOL contribute_with_deed = panelp->mCheckContributeWithDeed->get();
+ BOOL allow_deed_to_group= panelp->mCheckDeedToGroup->get();
+ BOOL contribute_with_deed = panelp->mCheckContributeWithDeed->get();
- parcel->setParcelFlag(PF_ALLOW_DEED_TO_GROUP, allow_deed_to_group);
- parcel->setContributeWithDeed(contribute_with_deed);
+ parcel->setParcelFlag(PF_ALLOW_DEED_TO_GROUP, allow_deed_to_group);
+ parcel->setContributeWithDeed(contribute_with_deed);
- // Send update to server
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+ // Send update to server
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
- // Might have changed properties, so let's redraw!
- panelp->refresh();
+ // Might have changed properties, so let's redraw!
+ panelp->refresh();
}
// static
void LLPanelLandGeneral::onClickSellLand(void* data)
{
- LLViewerParcelMgr::getInstance()->startSellLand();
- LLPanelLandGeneral *panelp = (LLPanelLandGeneral *)data;
- panelp->refresh();
+ LLViewerParcelMgr::getInstance()->startSellLand();
+ LLPanelLandGeneral *panelp = (LLPanelLandGeneral *)data;
+ panelp->refresh();
}
// static
void LLPanelLandGeneral::onClickStopSellLand(void* data)
{
- LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
- LLParcel* parcel = panelp->mParcel->getParcel();
+ LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
+ LLParcel* parcel = panelp->mParcel->getParcel();
- parcel->setParcelFlag(PF_FOR_SALE, FALSE);
- parcel->setSalePrice(0);
- parcel->setAuthorizedBuyerID(LLUUID::null);
+ parcel->setParcelFlag(PF_FOR_SALE, FALSE);
+ parcel->setSalePrice(0);
+ parcel->setAuthorizedBuyerID(LLUUID::null);
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(parcel);
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(parcel);
}
//---------------------------------------------------------------------------
// LLPanelLandObjects
//---------------------------------------------------------------------------
LLPanelLandObjects::LLPanelLandObjects(LLParcelSelectionHandle& parcel)
- : LLPanel(),
-
- mParcel(parcel),
- mParcelObjectBonus(NULL),
- mSWTotalObjects(NULL),
- mObjectContribution(NULL),
- mTotalObjects(NULL),
- mOwnerObjects(NULL),
- mBtnShowOwnerObjects(NULL),
- mBtnReturnOwnerObjects(NULL),
- mGroupObjects(NULL),
- mBtnShowGroupObjects(NULL),
- mBtnReturnGroupObjects(NULL),
- mOtherObjects(NULL),
- mBtnShowOtherObjects(NULL),
- mBtnReturnOtherObjects(NULL),
- mSelectedObjects(NULL),
- mCleanOtherObjectsTime(NULL),
- mOtherTime(0),
- mBtnRefresh(NULL),
- mBtnReturnOwnerList(NULL),
- mOwnerList(NULL),
- mFirstReply(TRUE),
- mSelectedCount(0),
- mSelectedIsGroup(FALSE)
+ : LLPanel(),
+
+ mParcel(parcel),
+ mParcelObjectBonus(NULL),
+ mSWTotalObjects(NULL),
+ mObjectContribution(NULL),
+ mTotalObjects(NULL),
+ mOwnerObjects(NULL),
+ mBtnShowOwnerObjects(NULL),
+ mBtnReturnOwnerObjects(NULL),
+ mGroupObjects(NULL),
+ mBtnShowGroupObjects(NULL),
+ mBtnReturnGroupObjects(NULL),
+ mOtherObjects(NULL),
+ mBtnShowOtherObjects(NULL),
+ mBtnReturnOtherObjects(NULL),
+ mSelectedObjects(NULL),
+ mCleanOtherObjectsTime(NULL),
+ mOtherTime(0),
+ mBtnRefresh(NULL),
+ mBtnReturnOwnerList(NULL),
+ mOwnerList(NULL),
+ mFirstReply(TRUE),
+ mSelectedCount(0),
+ mSelectedIsGroup(FALSE)
{
}
@@ -1193,59 +1193,59 @@ LLPanelLandObjects::LLPanelLandObjects(LLParcelSelectionHandle& parcel)
BOOL LLPanelLandObjects::postBuild()
{
-
- mFirstReply = TRUE;
- mParcelObjectBonus = getChild<LLTextBox>("parcel_object_bonus");
- mSWTotalObjects = getChild<LLTextBox>("objects_available");
- mObjectContribution = getChild<LLTextBox>("object_contrib_text");
- mTotalObjects = getChild<LLTextBox>("total_objects_text");
- mOwnerObjects = getChild<LLTextBox>("owner_objects_text");
-
- mBtnShowOwnerObjects = getChild<LLButton>("ShowOwner");
- mBtnShowOwnerObjects->setClickedCallback(onClickShowOwnerObjects, this);
-
- mBtnReturnOwnerObjects = getChild<LLButton>("ReturnOwner...");
- mBtnReturnOwnerObjects->setClickedCallback(onClickReturnOwnerObjects, this);
-
- mGroupObjects = getChild<LLTextBox>("group_objects_text");
- mBtnShowGroupObjects = getChild<LLButton>("ShowGroup");
- mBtnShowGroupObjects->setClickedCallback(onClickShowGroupObjects, this);
-
- mBtnReturnGroupObjects = getChild<LLButton>("ReturnGroup...");
- mBtnReturnGroupObjects->setClickedCallback(onClickReturnGroupObjects, this);
-
- mOtherObjects = getChild<LLTextBox>("other_objects_text");
- mBtnShowOtherObjects = getChild<LLButton>("ShowOther");
- mBtnShowOtherObjects->setClickedCallback(onClickShowOtherObjects, this);
-
- mBtnReturnOtherObjects = getChild<LLButton>("ReturnOther...");
- mBtnReturnOtherObjects->setClickedCallback(onClickReturnOtherObjects, this);
-
- mSelectedObjects = getChild<LLTextBox>("selected_objects_text");
- mCleanOtherObjectsTime = getChild<LLLineEditor>("clean other time");
-
- mCleanOtherObjectsTime->setFocusLostCallback(boost::bind(onLostFocus, _1, this));
- mCleanOtherObjectsTime->setCommitCallback(onCommitClean, this);
- getChild<LLLineEditor>("clean other time")->setPrevalidate(LLTextValidate::validateNonNegativeS32);
-
- mBtnRefresh = getChild<LLButton>("Refresh List");
- mBtnRefresh->setClickedCallback(onClickRefresh, this);
-
- mBtnReturnOwnerList = getChild<LLButton>("Return objects...");
- mBtnReturnOwnerList->setClickedCallback(onClickReturnOwnerList, this);
-
- mIconAvatarOnline = LLUIImageList::getInstance()->getUIImage("icon_avatar_online.tga", 0);
- mIconAvatarOffline = LLUIImageList::getInstance()->getUIImage("icon_avatar_offline.tga", 0);
- mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga", 0);
-
- mOwnerList = getChild<LLNameListCtrl>("owner list");
- mOwnerList->setIsFriendCallback(LLAvatarActions::isFriend);
- mOwnerList->sortByColumnIndex(3, FALSE);
- childSetCommitCallback("owner list", onCommitList, this);
- mOwnerList->setDoubleClickCallback(onDoubleClickOwner, this);
- mOwnerList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
-
- return TRUE;
+
+ mFirstReply = TRUE;
+ mParcelObjectBonus = getChild<LLTextBox>("parcel_object_bonus");
+ mSWTotalObjects = getChild<LLTextBox>("objects_available");
+ mObjectContribution = getChild<LLTextBox>("object_contrib_text");
+ mTotalObjects = getChild<LLTextBox>("total_objects_text");
+ mOwnerObjects = getChild<LLTextBox>("owner_objects_text");
+
+ mBtnShowOwnerObjects = getChild<LLButton>("ShowOwner");
+ mBtnShowOwnerObjects->setClickedCallback(onClickShowOwnerObjects, this);
+
+ mBtnReturnOwnerObjects = getChild<LLButton>("ReturnOwner...");
+ mBtnReturnOwnerObjects->setClickedCallback(onClickReturnOwnerObjects, this);
+
+ mGroupObjects = getChild<LLTextBox>("group_objects_text");
+ mBtnShowGroupObjects = getChild<LLButton>("ShowGroup");
+ mBtnShowGroupObjects->setClickedCallback(onClickShowGroupObjects, this);
+
+ mBtnReturnGroupObjects = getChild<LLButton>("ReturnGroup...");
+ mBtnReturnGroupObjects->setClickedCallback(onClickReturnGroupObjects, this);
+
+ mOtherObjects = getChild<LLTextBox>("other_objects_text");
+ mBtnShowOtherObjects = getChild<LLButton>("ShowOther");
+ mBtnShowOtherObjects->setClickedCallback(onClickShowOtherObjects, this);
+
+ mBtnReturnOtherObjects = getChild<LLButton>("ReturnOther...");
+ mBtnReturnOtherObjects->setClickedCallback(onClickReturnOtherObjects, this);
+
+ mSelectedObjects = getChild<LLTextBox>("selected_objects_text");
+ mCleanOtherObjectsTime = getChild<LLLineEditor>("clean other time");
+
+ mCleanOtherObjectsTime->setFocusLostCallback(boost::bind(onLostFocus, _1, this));
+ mCleanOtherObjectsTime->setCommitCallback(onCommitClean, this);
+ getChild<LLLineEditor>("clean other time")->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+
+ mBtnRefresh = getChild<LLButton>("Refresh List");
+ mBtnRefresh->setClickedCallback(onClickRefresh, this);
+
+ mBtnReturnOwnerList = getChild<LLButton>("Return objects...");
+ mBtnReturnOwnerList->setClickedCallback(onClickReturnOwnerList, this);
+
+ mIconAvatarOnline = LLUIImageList::getInstance()->getUIImage("icon_avatar_online.tga", 0);
+ mIconAvatarOffline = LLUIImageList::getInstance()->getUIImage("icon_avatar_offline.tga", 0);
+ mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga", 0);
+
+ mOwnerList = getChild<LLNameListCtrl>("owner list");
+ mOwnerList->setIsFriendCallback(LLAvatarActions::isFriend);
+ mOwnerList->sortByColumnIndex(3, FALSE);
+ childSetCommitCallback("owner list", onCommitList, this);
+ mOwnerList->setDoubleClickCallback(onDoubleClickOwner, this);
+ mOwnerList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+
+ return TRUE;
}
@@ -1258,648 +1258,648 @@ LLPanelLandObjects::~LLPanelLandObjects()
// static
void LLPanelLandObjects::onDoubleClickOwner(void *userdata)
{
- LLPanelLandObjects *self = (LLPanelLandObjects *)userdata;
-
- LLScrollListItem* item = self->mOwnerList->getFirstSelected();
- if (item)
- {
- LLUUID owner_id = item->getUUID();
- // Look up the selected name, for future dialog box use.
- const LLScrollListCell* cell;
- cell = item->getColumn(1);
- if (!cell)
- {
- return;
- }
- // Is this a group?
- BOOL is_group = cell->getValue().asString() == OWNER_GROUP;
- if (is_group)
- {
- LLGroupActions::show(owner_id);
- }
- else
- {
- LLAvatarActions::showProfile(owner_id);
- }
- }
+ LLPanelLandObjects *self = (LLPanelLandObjects *)userdata;
+
+ LLScrollListItem* item = self->mOwnerList->getFirstSelected();
+ if (item)
+ {
+ LLUUID owner_id = item->getUUID();
+ // Look up the selected name, for future dialog box use.
+ const LLScrollListCell* cell;
+ cell = item->getColumn(1);
+ if (!cell)
+ {
+ return;
+ }
+ // Is this a group?
+ BOOL is_group = cell->getValue().asString() == OWNER_GROUP;
+ if (is_group)
+ {
+ LLGroupActions::show(owner_id);
+ }
+ else
+ {
+ LLAvatarActions::showProfile(owner_id);
+ }
+ }
}
// public
void LLPanelLandObjects::refresh()
{
- LLParcel *parcel = mParcel->getParcel();
-
- mBtnShowOwnerObjects->setEnabled(FALSE);
- mBtnShowGroupObjects->setEnabled(FALSE);
- mBtnShowOtherObjects->setEnabled(FALSE);
- mBtnReturnOwnerObjects->setEnabled(FALSE);
- mBtnReturnGroupObjects->setEnabled(FALSE);
- mBtnReturnOtherObjects->setEnabled(FALSE);
- mCleanOtherObjectsTime->setEnabled(FALSE);
- mBtnRefresh-> setEnabled(FALSE);
- mBtnReturnOwnerList-> setEnabled(FALSE);
-
- mSelectedOwners.clear();
- mOwnerList->deleteAllItems();
- mOwnerList->setEnabled(FALSE);
-
- if (!parcel || gDisconnected)
- {
- mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", 0));
- mSWTotalObjects->setTextArg("[TOTAL]", llformat("%d", 0));
- mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", 0));
- mObjectContribution->setTextArg("[COUNT]", llformat("%d", 0));
- mTotalObjects->setTextArg("[COUNT]", llformat("%d", 0));
- mOwnerObjects->setTextArg("[COUNT]", llformat("%d", 0));
- mGroupObjects->setTextArg("[COUNT]", llformat("%d", 0));
- mOtherObjects->setTextArg("[COUNT]", llformat("%d", 0));
- mSelectedObjects->setTextArg("[COUNT]", llformat("%d", 0));
- }
- else
- {
- S32 sw_max = parcel->getSimWideMaxPrimCapacity();
- S32 sw_total = parcel->getSimWidePrimCount();
- S32 max = ll_round(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus());
- S32 total = parcel->getPrimCount();
- S32 owned = parcel->getOwnerPrimCount();
- S32 group = parcel->getGroupPrimCount();
- S32 other = parcel->getOtherPrimCount();
- S32 selected = parcel->getSelectedPrimCount();
- F32 parcel_object_bonus = parcel->getParcelPrimBonus();
- mOtherTime = parcel->getCleanOtherTime();
-
- // Can't have more than region max tasks, regardless of parcel
- // object bonus factor.
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (region)
- {
- S32 max_tasks_per_region = (S32)region->getMaxTasks();
- sw_max = llmin(sw_max, max_tasks_per_region);
- max = llmin(max, max_tasks_per_region);
- }
-
- if (parcel_object_bonus != 1.0f)
- {
- mParcelObjectBonus->setVisible(TRUE);
- mParcelObjectBonus->setTextArg("[BONUS]", llformat("%.2f", parcel_object_bonus));
- }
- else
- {
- mParcelObjectBonus->setVisible(FALSE);
- }
-
- if (sw_total > sw_max)
- {
- mSWTotalObjects->setText(getString("objects_deleted_text"));
- mSWTotalObjects->setTextArg("[DELETED]", llformat("%d", sw_total - sw_max));
- }
- else
- {
- mSWTotalObjects->setText(getString("objects_available_text"));
- mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", sw_max - sw_total));
- }
- mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", sw_total));
- mSWTotalObjects->setTextArg("[MAX]", llformat("%d", sw_max));
-
- mObjectContribution->setTextArg("[COUNT]", llformat("%d", max));
- mTotalObjects->setTextArg("[COUNT]", llformat("%d", total));
- mOwnerObjects->setTextArg("[COUNT]", llformat("%d", owned));
- mGroupObjects->setTextArg("[COUNT]", llformat("%d", group));
- mOtherObjects->setTextArg("[COUNT]", llformat("%d", other));
- mSelectedObjects->setTextArg("[COUNT]", llformat("%d", selected));
- mCleanOtherObjectsTime->setText(llformat("%d", mOtherTime));
-
- BOOL can_return_owned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_OWNED);
- BOOL can_return_group_set = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_SET);
- BOOL can_return_other = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_NON_GROUP);
-
- if (can_return_owned || can_return_group_set || can_return_other)
- {
- if (owned && can_return_owned)
- {
- mBtnShowOwnerObjects->setEnabled(TRUE);
- mBtnReturnOwnerObjects->setEnabled(TRUE);
- }
- if (group && can_return_group_set)
- {
- mBtnShowGroupObjects->setEnabled(TRUE);
- mBtnReturnGroupObjects->setEnabled(TRUE);
- }
- if (other && can_return_other)
- {
- mBtnShowOtherObjects->setEnabled(TRUE);
- mBtnReturnOtherObjects->setEnabled(TRUE);
- }
-
- mCleanOtherObjectsTime->setEnabled(TRUE);
- mBtnRefresh->setEnabled(TRUE);
- }
- }
+ LLParcel *parcel = mParcel->getParcel();
+
+ mBtnShowOwnerObjects->setEnabled(FALSE);
+ mBtnShowGroupObjects->setEnabled(FALSE);
+ mBtnShowOtherObjects->setEnabled(FALSE);
+ mBtnReturnOwnerObjects->setEnabled(FALSE);
+ mBtnReturnGroupObjects->setEnabled(FALSE);
+ mBtnReturnOtherObjects->setEnabled(FALSE);
+ mCleanOtherObjectsTime->setEnabled(FALSE);
+ mBtnRefresh-> setEnabled(FALSE);
+ mBtnReturnOwnerList-> setEnabled(FALSE);
+
+ mSelectedOwners.clear();
+ mOwnerList->deleteAllItems();
+ mOwnerList->setEnabled(FALSE);
+
+ if (!parcel || gDisconnected)
+ {
+ mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mSWTotalObjects->setTextArg("[TOTAL]", llformat("%d", 0));
+ mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", 0));
+ mObjectContribution->setTextArg("[COUNT]", llformat("%d", 0));
+ mTotalObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mOwnerObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mGroupObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mOtherObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mSelectedObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ }
+ else
+ {
+ S32 sw_max = parcel->getSimWideMaxPrimCapacity();
+ S32 sw_total = parcel->getSimWidePrimCount();
+ S32 max = ll_round(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus());
+ S32 total = parcel->getPrimCount();
+ S32 owned = parcel->getOwnerPrimCount();
+ S32 group = parcel->getGroupPrimCount();
+ S32 other = parcel->getOtherPrimCount();
+ S32 selected = parcel->getSelectedPrimCount();
+ F32 parcel_object_bonus = parcel->getParcelPrimBonus();
+ mOtherTime = parcel->getCleanOtherTime();
+
+ // Can't have more than region max tasks, regardless of parcel
+ // object bonus factor.
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (region)
+ {
+ S32 max_tasks_per_region = (S32)region->getMaxTasks();
+ sw_max = llmin(sw_max, max_tasks_per_region);
+ max = llmin(max, max_tasks_per_region);
+ }
+
+ if (parcel_object_bonus != 1.0f)
+ {
+ mParcelObjectBonus->setVisible(TRUE);
+ mParcelObjectBonus->setTextArg("[BONUS]", llformat("%.2f", parcel_object_bonus));
+ }
+ else
+ {
+ mParcelObjectBonus->setVisible(FALSE);
+ }
+
+ if (sw_total > sw_max)
+ {
+ mSWTotalObjects->setText(getString("objects_deleted_text"));
+ mSWTotalObjects->setTextArg("[DELETED]", llformat("%d", sw_total - sw_max));
+ }
+ else
+ {
+ mSWTotalObjects->setText(getString("objects_available_text"));
+ mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", sw_max - sw_total));
+ }
+ mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", sw_total));
+ mSWTotalObjects->setTextArg("[MAX]", llformat("%d", sw_max));
+
+ mObjectContribution->setTextArg("[COUNT]", llformat("%d", max));
+ mTotalObjects->setTextArg("[COUNT]", llformat("%d", total));
+ mOwnerObjects->setTextArg("[COUNT]", llformat("%d", owned));
+ mGroupObjects->setTextArg("[COUNT]", llformat("%d", group));
+ mOtherObjects->setTextArg("[COUNT]", llformat("%d", other));
+ mSelectedObjects->setTextArg("[COUNT]", llformat("%d", selected));
+ mCleanOtherObjectsTime->setText(llformat("%d", mOtherTime));
+
+ BOOL can_return_owned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_OWNED);
+ BOOL can_return_group_set = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_SET);
+ BOOL can_return_other = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_NON_GROUP);
+
+ if (can_return_owned || can_return_group_set || can_return_other)
+ {
+ if (owned && can_return_owned)
+ {
+ mBtnShowOwnerObjects->setEnabled(TRUE);
+ mBtnReturnOwnerObjects->setEnabled(TRUE);
+ }
+ if (group && can_return_group_set)
+ {
+ mBtnShowGroupObjects->setEnabled(TRUE);
+ mBtnReturnGroupObjects->setEnabled(TRUE);
+ }
+ if (other && can_return_other)
+ {
+ mBtnShowOtherObjects->setEnabled(TRUE);
+ mBtnReturnOtherObjects->setEnabled(TRUE);
+ }
+
+ mCleanOtherObjectsTime->setEnabled(TRUE);
+ mBtnRefresh->setEnabled(TRUE);
+ }
+ }
}
// virtual
void LLPanelLandObjects::draw()
{
- LLPanel::draw();
+ LLPanel::draw();
}
void send_other_clean_time_message(S32 parcel_local_id, S32 other_clean_time)
{
- LLMessageSystem *msg = gMessageSystem;
+ LLMessageSystem *msg = gMessageSystem;
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (!region) return;
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (!region) return;
- msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
- msg->addS32Fast(_PREHASH_OtherCleanTime, other_clean_time);
+ msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
+ msg->addS32Fast(_PREHASH_OtherCleanTime, other_clean_time);
- msg->sendReliable(region->getHost());
+ msg->sendReliable(region->getHost());
}
-void send_return_objects_message(S32 parcel_local_id, S32 return_type,
- uuid_list_t* owner_ids = NULL)
+void send_return_objects_message(S32 parcel_local_id, S32 return_type,
+ uuid_list_t* owner_ids = NULL)
{
- LLMessageSystem *msg = gMessageSystem;
+ LLMessageSystem *msg = gMessageSystem;
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (!region) return;
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (!region) return;
- msg->newMessageFast(_PREHASH_ParcelReturnObjects);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
- msg->addU32Fast(_PREHASH_ReturnType, (U32) return_type);
+ msg->newMessageFast(_PREHASH_ParcelReturnObjects);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
+ msg->addU32Fast(_PREHASH_ReturnType, (U32) return_type);
- // Dummy task id, not used
- msg->nextBlock("TaskIDs");
- msg->addUUID("TaskID", LLUUID::null);
+ // Dummy task id, not used
+ msg->nextBlock("TaskIDs");
+ msg->addUUID("TaskID", LLUUID::null);
- // Throw all return ids into the packet.
- // TODO: Check for too many ids.
- if (owner_ids)
- {
- uuid_list_t::iterator end = owner_ids->end();
- for (uuid_list_t::iterator it = owner_ids->begin();
- it != end;
- ++it)
- {
- msg->nextBlockFast(_PREHASH_OwnerIDs);
- msg->addUUIDFast(_PREHASH_OwnerID, (*it));
- }
- }
- else
- {
- msg->nextBlockFast(_PREHASH_OwnerIDs);
- msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null);
- }
+ // Throw all return ids into the packet.
+ // TODO: Check for too many ids.
+ if (owner_ids)
+ {
+ uuid_list_t::iterator end = owner_ids->end();
+ for (uuid_list_t::iterator it = owner_ids->begin();
+ it != end;
+ ++it)
+ {
+ msg->nextBlockFast(_PREHASH_OwnerIDs);
+ msg->addUUIDFast(_PREHASH_OwnerID, (*it));
+ }
+ }
+ else
+ {
+ msg->nextBlockFast(_PREHASH_OwnerIDs);
+ msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null);
+ }
- msg->sendReliable(region->getHost());
+ msg->sendReliable(region->getHost());
}
bool LLPanelLandObjects::callbackReturnOwnerObjects(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLParcel *parcel = mParcel->getParcel();
- if (0 == option)
- {
- if (parcel)
- {
- LLUUID owner_id = parcel->getOwnerID();
- LLSD args;
- if (owner_id == gAgentID)
- {
- LLNotificationsUtil::add("OwnedObjectsReturned");
- }
- else
- {
- args["NAME"] = LLSLURL("agent", owner_id, "completename").getSLURLString();
- LLNotificationsUtil::add("OtherObjectsReturned", args);
- }
- send_return_objects_message(parcel->getLocalID(), RT_OWNER);
- }
- }
-
- LLSelectMgr::getInstance()->unhighlightAll();
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
- refresh();
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLParcel *parcel = mParcel->getParcel();
+ if (0 == option)
+ {
+ if (parcel)
+ {
+ LLUUID owner_id = parcel->getOwnerID();
+ LLSD args;
+ if (owner_id == gAgentID)
+ {
+ LLNotificationsUtil::add("OwnedObjectsReturned");
+ }
+ else
+ {
+ args["NAME"] = LLSLURL("agent", owner_id, "completename").getSLURLString();
+ LLNotificationsUtil::add("OtherObjectsReturned", args);
+ }
+ send_return_objects_message(parcel->getLocalID(), RT_OWNER);
+ }
+ }
+
+ LLSelectMgr::getInstance()->unhighlightAll();
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+ refresh();
+ return false;
}
bool LLPanelLandObjects::callbackReturnGroupObjects(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLParcel *parcel = mParcel->getParcel();
- if (0 == option)
- {
- if (parcel)
- {
- std::string group_name;
- gCacheName->getGroupName(parcel->getGroupID(), group_name);
- LLSD args;
- args["GROUPNAME"] = group_name;
- LLNotificationsUtil::add("GroupObjectsReturned", args);
- send_return_objects_message(parcel->getLocalID(), RT_GROUP);
- }
- }
- LLSelectMgr::getInstance()->unhighlightAll();
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
- refresh();
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLParcel *parcel = mParcel->getParcel();
+ if (0 == option)
+ {
+ if (parcel)
+ {
+ std::string group_name;
+ gCacheName->getGroupName(parcel->getGroupID(), group_name);
+ LLSD args;
+ args["GROUPNAME"] = group_name;
+ LLNotificationsUtil::add("GroupObjectsReturned", args);
+ send_return_objects_message(parcel->getLocalID(), RT_GROUP);
+ }
+ }
+ LLSelectMgr::getInstance()->unhighlightAll();
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+ refresh();
+ return false;
}
bool LLPanelLandObjects::callbackReturnOtherObjects(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLParcel *parcel = mParcel->getParcel();
- if (0 == option)
- {
- if (parcel)
- {
- LLNotificationsUtil::add("UnOwnedObjectsReturned");
- send_return_objects_message(parcel->getLocalID(), RT_OTHER);
- }
- }
- LLSelectMgr::getInstance()->unhighlightAll();
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
- refresh();
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLParcel *parcel = mParcel->getParcel();
+ if (0 == option)
+ {
+ if (parcel)
+ {
+ LLNotificationsUtil::add("UnOwnedObjectsReturned");
+ send_return_objects_message(parcel->getLocalID(), RT_OTHER);
+ }
+ }
+ LLSelectMgr::getInstance()->unhighlightAll();
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+ refresh();
+ return false;
}
bool LLPanelLandObjects::callbackReturnOwnerList(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLParcel *parcel = mParcel->getParcel();
- if (0 == option)
- {
- if (parcel)
- {
- // Make sure we have something selected.
- uuid_list_t::iterator selected = mSelectedOwners.begin();
- if (selected != mSelectedOwners.end())
- {
- LLSD args;
- if (mSelectedIsGroup)
- {
- args["GROUPNAME"] = mSelectedName;
- LLNotificationsUtil::add("GroupObjectsReturned", args);
- }
- else
- {
- args["NAME"] = mSelectedName;
- LLNotificationsUtil::add("OtherObjectsReturned2", args);
- }
-
- send_return_objects_message(parcel->getLocalID(), RT_LIST, &(mSelectedOwners));
- }
- }
- }
- LLSelectMgr::getInstance()->unhighlightAll();
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
- refresh();
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLParcel *parcel = mParcel->getParcel();
+ if (0 == option)
+ {
+ if (parcel)
+ {
+ // Make sure we have something selected.
+ uuid_list_t::iterator selected = mSelectedOwners.begin();
+ if (selected != mSelectedOwners.end())
+ {
+ LLSD args;
+ if (mSelectedIsGroup)
+ {
+ args["GROUPNAME"] = mSelectedName;
+ LLNotificationsUtil::add("GroupObjectsReturned", args);
+ }
+ else
+ {
+ args["NAME"] = mSelectedName;
+ LLNotificationsUtil::add("OtherObjectsReturned2", args);
+ }
+
+ send_return_objects_message(parcel->getLocalID(), RT_LIST, &(mSelectedOwners));
+ }
+ }
+ }
+ LLSelectMgr::getInstance()->unhighlightAll();
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+ refresh();
+ return false;
}
// static
void LLPanelLandObjects::onClickReturnOwnerList(void* userdata)
{
- LLPanelLandObjects *self = (LLPanelLandObjects *)userdata;
+ LLPanelLandObjects *self = (LLPanelLandObjects *)userdata;
- LLParcel* parcelp = self->mParcel->getParcel();
- if (!parcelp) return;
+ LLParcel* parcelp = self->mParcel->getParcel();
+ if (!parcelp) return;
- // Make sure we have something selected.
- if (self->mSelectedOwners.empty())
- {
- return;
- }
- //uuid_list_t::iterator selected_itr = self->mSelectedOwners.begin();
- //if (selected_itr == self->mSelectedOwners.end()) return;
+ // Make sure we have something selected.
+ if (self->mSelectedOwners.empty())
+ {
+ return;
+ }
+ //uuid_list_t::iterator selected_itr = self->mSelectedOwners.begin();
+ //if (selected_itr == self->mSelectedOwners.end()) return;
- send_parcel_select_objects(parcelp->getLocalID(), RT_LIST, &(self->mSelectedOwners));
+ send_parcel_select_objects(parcelp->getLocalID(), RT_LIST, &(self->mSelectedOwners));
- LLSD args;
- args["NAME"] = self->mSelectedName;
- args["N"] = llformat("%d",self->mSelectedCount);
- if (self->mSelectedIsGroup)
- {
- LLNotificationsUtil::add("ReturnObjectsDeededToGroup", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerList, self, _1, _2));
- }
- else
- {
- LLNotificationsUtil::add("ReturnObjectsOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerList, self, _1, _2));
- }
+ LLSD args;
+ args["NAME"] = self->mSelectedName;
+ args["N"] = llformat("%d",self->mSelectedCount);
+ if (self->mSelectedIsGroup)
+ {
+ LLNotificationsUtil::add("ReturnObjectsDeededToGroup", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerList, self, _1, _2));
+ }
+ else
+ {
+ LLNotificationsUtil::add("ReturnObjectsOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerList, self, _1, _2));
+ }
}
// static
void LLPanelLandObjects::onClickRefresh(void* userdata)
{
- LLPanelLandObjects *self = (LLPanelLandObjects*)userdata;
+ LLPanelLandObjects *self = (LLPanelLandObjects*)userdata;
- LLMessageSystem *msg = gMessageSystem;
+ LLMessageSystem *msg = gMessageSystem;
- LLParcel* parcel = self->mParcel->getParcel();
- if (!parcel) return;
+ LLParcel* parcel = self->mParcel->getParcel();
+ if (!parcel) return;
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (!region) return;
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (!region) return;
- self->mBtnRefresh->setEnabled(false);
+ self->mBtnRefresh->setEnabled(false);
- // ready the list for results
- self->mOwnerList->deleteAllItems();
- self->mOwnerList->setCommentText(LLTrans::getString("Searching"));
- self->mOwnerList->setEnabled(FALSE);
- self->mFirstReply = TRUE;
+ // ready the list for results
+ self->mOwnerList->deleteAllItems();
+ self->mOwnerList->setCommentText(LLTrans::getString("Searching"));
+ self->mOwnerList->setEnabled(FALSE);
+ self->mFirstReply = TRUE;
- // send the message
- msg->newMessageFast(_PREHASH_ParcelObjectOwnersRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID());
+ // send the message
+ msg->newMessageFast(_PREHASH_ParcelObjectOwnersRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID());
- msg->sendReliable(region->getHost());
+ msg->sendReliable(region->getHost());
}
// static
void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, void **)
{
- LLPanelLandObjects* self = LLFloaterLand::getCurrentPanelLandObjects();
-
- if (!self)
- {
- LL_WARNS() << "Received message for nonexistent LLPanelLandObject"
- << LL_ENDL;
- return;
- }
-
- const LLFontGL* FONT = LLFontGL::getFontSansSerif();
-
- // Extract all of the owners.
- S32 rows = msg->getNumberOfBlocksFast(_PREHASH_Data);
- //uuid_list_t return_ids;
- LLUUID owner_id;
- BOOL is_group_owned;
- S32 object_count;
- U32 most_recent_time = 0;
- BOOL is_online;
- std::string object_count_str;
- //BOOL b_need_refresh = FALSE;
-
- // If we were waiting for the first reply, clear the "Searching..." text.
- if (self->mFirstReply)
- {
- self->mOwnerList->deleteAllItems();
- self->mFirstReply = FALSE;
- }
-
- for(S32 i = 0; i < rows; ++i)
- {
- msg->getUUIDFast(_PREHASH_Data, _PREHASH_OwnerID, owner_id, i);
- msg->getBOOLFast(_PREHASH_Data, _PREHASH_IsGroupOwned, is_group_owned, i);
- msg->getS32Fast (_PREHASH_Data, _PREHASH_Count, object_count, i);
- msg->getBOOLFast(_PREHASH_Data, _PREHASH_OnlineStatus, is_online, i);
- if(msg->has("DataExtended"))
- {
- msg->getU32("DataExtended", "TimeStamp", most_recent_time, i);
- }
-
- if (owner_id.isNull())
- {
- continue;
- }
-
- LLNameListCtrl::NameItem item_params;
- item_params.value = owner_id;
- item_params.target = is_group_owned ? LLNameListCtrl::GROUP : LLNameListCtrl::INDIVIDUAL;
-
- if (is_group_owned)
- {
- item_params.columns.add().type("icon").value(self->mIconGroup->getName()).column("type");
- item_params.columns.add().value(OWNER_GROUP).font(FONT).column("online_status");
- }
- else if (is_online)
- {
- item_params.columns.add().type("icon").value(self->mIconAvatarOnline->getName()).column("type");
- item_params.columns.add().value(OWNER_ONLINE).font(FONT).column("online_status");
- }
- else // offline
- {
- item_params.columns.add().type("icon").value(self->mIconAvatarOffline->getName()).column("type");
- item_params.columns.add().value(OWNER_OFFLINE).font(FONT).column("online_status");
- }
-
- // Placeholder for name.
- LLAvatarName av_name;
- LLAvatarNameCache::get(owner_id, &av_name);
- item_params.columns.add().value(av_name.getCompleteName()).font(FONT).column("name");
-
- object_count_str = llformat("%d", object_count);
- item_params.columns.add().value(object_count_str).font(FONT).column("count");
- item_params.columns.add().value(LLDate((time_t)most_recent_time)).font(FONT).column("mostrecent").type("date");
-
- self->mOwnerList->addNameItemRow(item_params);
- LL_DEBUGS() << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent")
- << ") owns " << object_count << " objects." << LL_ENDL;
- }
-
- // check for no results
- if (0 == self->mOwnerList->getItemCount())
- {
- self->mOwnerList->setCommentText(LLTrans::getString("NoneFound"));
- }
- else
- {
- self->mOwnerList->setEnabled(TRUE);
- }
-
- self->mBtnRefresh->setEnabled(true);
+ LLPanelLandObjects* self = LLFloaterLand::getCurrentPanelLandObjects();
+
+ if (!self)
+ {
+ LL_WARNS() << "Received message for nonexistent LLPanelLandObject"
+ << LL_ENDL;
+ return;
+ }
+
+ const LLFontGL* FONT = LLFontGL::getFontSansSerif();
+
+ // Extract all of the owners.
+ S32 rows = msg->getNumberOfBlocksFast(_PREHASH_Data);
+ //uuid_list_t return_ids;
+ LLUUID owner_id;
+ BOOL is_group_owned;
+ S32 object_count;
+ U32 most_recent_time = 0;
+ BOOL is_online;
+ std::string object_count_str;
+ //BOOL b_need_refresh = FALSE;
+
+ // If we were waiting for the first reply, clear the "Searching..." text.
+ if (self->mFirstReply)
+ {
+ self->mOwnerList->deleteAllItems();
+ self->mFirstReply = FALSE;
+ }
+
+ for(S32 i = 0; i < rows; ++i)
+ {
+ msg->getUUIDFast(_PREHASH_Data, _PREHASH_OwnerID, owner_id, i);
+ msg->getBOOLFast(_PREHASH_Data, _PREHASH_IsGroupOwned, is_group_owned, i);
+ msg->getS32Fast (_PREHASH_Data, _PREHASH_Count, object_count, i);
+ msg->getBOOLFast(_PREHASH_Data, _PREHASH_OnlineStatus, is_online, i);
+ if(msg->has("DataExtended"))
+ {
+ msg->getU32("DataExtended", "TimeStamp", most_recent_time, i);
+ }
+
+ if (owner_id.isNull())
+ {
+ continue;
+ }
+
+ LLNameListCtrl::NameItem item_params;
+ item_params.value = owner_id;
+ item_params.target = is_group_owned ? LLNameListCtrl::GROUP : LLNameListCtrl::INDIVIDUAL;
+
+ if (is_group_owned)
+ {
+ item_params.columns.add().type("icon").value(self->mIconGroup->getName()).column("type");
+ item_params.columns.add().value(OWNER_GROUP).font(FONT).column("online_status");
+ }
+ else if (is_online)
+ {
+ item_params.columns.add().type("icon").value(self->mIconAvatarOnline->getName()).column("type");
+ item_params.columns.add().value(OWNER_ONLINE).font(FONT).column("online_status");
+ }
+ else // offline
+ {
+ item_params.columns.add().type("icon").value(self->mIconAvatarOffline->getName()).column("type");
+ item_params.columns.add().value(OWNER_OFFLINE).font(FONT).column("online_status");
+ }
+
+ // Placeholder for name.
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(owner_id, &av_name);
+ item_params.columns.add().value(av_name.getCompleteName()).font(FONT).column("name");
+
+ object_count_str = llformat("%d", object_count);
+ item_params.columns.add().value(object_count_str).font(FONT).column("count");
+ item_params.columns.add().value(LLDate((time_t)most_recent_time)).font(FONT).column("mostrecent").type("date");
+
+ self->mOwnerList->addNameItemRow(item_params);
+ LL_DEBUGS() << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent")
+ << ") owns " << object_count << " objects." << LL_ENDL;
+ }
+
+ // check for no results
+ if (0 == self->mOwnerList->getItemCount())
+ {
+ self->mOwnerList->setCommentText(LLTrans::getString("NoneFound"));
+ }
+ else
+ {
+ self->mOwnerList->setEnabled(TRUE);
+ }
+
+ self->mBtnRefresh->setEnabled(true);
}
// static
void LLPanelLandObjects::onCommitList(LLUICtrl* ctrl, void* data)
{
- LLPanelLandObjects* self = (LLPanelLandObjects*)data;
-
- if (FALSE == self->mOwnerList->getCanSelect())
- {
- return;
- }
- LLScrollListItem *item = self->mOwnerList->getFirstSelected();
- if (item)
- {
- // Look up the selected name, for future dialog box use.
- const LLScrollListCell* cell;
- cell = item->getColumn(1);
- if (!cell)
- {
- return;
- }
- // Is this a group?
- self->mSelectedIsGroup = cell->getValue().asString() == OWNER_GROUP;
- cell = item->getColumn(2);
- self->mSelectedName = cell->getValue().asString();
- cell = item->getColumn(3);
- self->mSelectedCount = atoi(cell->getValue().asString().c_str());
-
- // Set the selection, and enable the return button.
- self->mSelectedOwners.clear();
- self->mSelectedOwners.insert(item->getUUID());
- self->mBtnReturnOwnerList->setEnabled(TRUE);
-
- // Highlight this user's objects
- clickShowCore(self, RT_LIST, &(self->mSelectedOwners));
- }
+ LLPanelLandObjects* self = (LLPanelLandObjects*)data;
+
+ if (FALSE == self->mOwnerList->getCanSelect())
+ {
+ return;
+ }
+ LLScrollListItem *item = self->mOwnerList->getFirstSelected();
+ if (item)
+ {
+ // Look up the selected name, for future dialog box use.
+ const LLScrollListCell* cell;
+ cell = item->getColumn(1);
+ if (!cell)
+ {
+ return;
+ }
+ // Is this a group?
+ self->mSelectedIsGroup = cell->getValue().asString() == OWNER_GROUP;
+ cell = item->getColumn(2);
+ self->mSelectedName = cell->getValue().asString();
+ cell = item->getColumn(3);
+ self->mSelectedCount = atoi(cell->getValue().asString().c_str());
+
+ // Set the selection, and enable the return button.
+ self->mSelectedOwners.clear();
+ self->mSelectedOwners.insert(item->getUUID());
+ self->mBtnReturnOwnerList->setEnabled(TRUE);
+
+ // Highlight this user's objects
+ clickShowCore(self, RT_LIST, &(self->mSelectedOwners));
+ }
}
// static
void LLPanelLandObjects::clickShowCore(LLPanelLandObjects* self, S32 return_type, uuid_list_t* list)
{
- LLParcel* parcel = self->mParcel->getParcel();
- if (!parcel) return;
+ LLParcel* parcel = self->mParcel->getParcel();
+ if (!parcel) return;
- send_parcel_select_objects(parcel->getLocalID(), return_type, list);
+ send_parcel_select_objects(parcel->getLocalID(), return_type, list);
}
// static
void LLPanelLandObjects::onClickShowOwnerObjects(void* userdata)
{
- clickShowCore((LLPanelLandObjects*)userdata, RT_OWNER);
+ clickShowCore((LLPanelLandObjects*)userdata, RT_OWNER);
}
// static
void LLPanelLandObjects::onClickShowGroupObjects(void* userdata)
{
- clickShowCore((LLPanelLandObjects*)userdata, (RT_GROUP));
+ clickShowCore((LLPanelLandObjects*)userdata, (RT_GROUP));
}
// static
void LLPanelLandObjects::onClickShowOtherObjects(void* userdata)
{
- clickShowCore((LLPanelLandObjects*)userdata, RT_OTHER);
+ clickShowCore((LLPanelLandObjects*)userdata, RT_OTHER);
}
// static
void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata)
{
- S32 owned = 0;
+ S32 owned = 0;
- LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
- LLParcel* parcel = panelp->mParcel->getParcel();
- if (!parcel) return;
+ LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
+ LLParcel* parcel = panelp->mParcel->getParcel();
+ if (!parcel) return;
- owned = parcel->getOwnerPrimCount();
+ owned = parcel->getOwnerPrimCount();
- send_parcel_select_objects(parcel->getLocalID(), RT_OWNER);
+ send_parcel_select_objects(parcel->getLocalID(), RT_OWNER);
- LLUUID owner_id = parcel->getOwnerID();
-
- LLSD args;
- args["N"] = llformat("%d",owned);
+ LLUUID owner_id = parcel->getOwnerID();
- if (owner_id == gAgent.getID())
- {
- LLNotificationsUtil::add("ReturnObjectsOwnedBySelf", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerObjects, panelp, _1, _2));
- }
- else
- {
- args["NAME"] = LLSLURL("agent", owner_id, "completename").getSLURLString();
- LLNotificationsUtil::add("ReturnObjectsOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerObjects, panelp, _1, _2));
- }
+ LLSD args;
+ args["N"] = llformat("%d",owned);
+
+ if (owner_id == gAgent.getID())
+ {
+ LLNotificationsUtil::add("ReturnObjectsOwnedBySelf", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerObjects, panelp, _1, _2));
+ }
+ else
+ {
+ args["NAME"] = LLSLURL("agent", owner_id, "completename").getSLURLString();
+ LLNotificationsUtil::add("ReturnObjectsOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerObjects, panelp, _1, _2));
+ }
}
// static
void LLPanelLandObjects::onClickReturnGroupObjects(void* userdata)
{
- LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
- LLParcel* parcel = panelp->mParcel->getParcel();
- if (!parcel) return;
+ LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
+ LLParcel* parcel = panelp->mParcel->getParcel();
+ if (!parcel) return;
- send_parcel_select_objects(parcel->getLocalID(), RT_GROUP);
+ send_parcel_select_objects(parcel->getLocalID(), RT_GROUP);
- std::string group_name;
- gCacheName->getGroupName(parcel->getGroupID(), group_name);
-
- LLSD args;
- args["NAME"] = group_name;
- args["N"] = llformat("%d", parcel->getGroupPrimCount());
+ std::string group_name;
+ gCacheName->getGroupName(parcel->getGroupID(), group_name);
- // create and show confirmation textbox
- LLNotificationsUtil::add("ReturnObjectsDeededToGroup", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnGroupObjects, panelp, _1, _2));
+ LLSD args;
+ args["NAME"] = group_name;
+ args["N"] = llformat("%d", parcel->getGroupPrimCount());
+
+ // create and show confirmation textbox
+ LLNotificationsUtil::add("ReturnObjectsDeededToGroup", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnGroupObjects, panelp, _1, _2));
}
// static
void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata)
{
- S32 other = 0;
-
- LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
- LLParcel* parcel = panelp->mParcel->getParcel();
- if (!parcel) return;
-
- other = parcel->getOtherPrimCount();
-
- send_parcel_select_objects(parcel->getLocalID(), RT_OTHER);
-
- LLSD args;
- args["N"] = llformat("%d", other);
-
- if (parcel->getIsGroupOwned())
- {
- std::string group_name;
- gCacheName->getGroupName(parcel->getGroupID(), group_name);
- args["NAME"] = group_name;
-
- LLNotificationsUtil::add("ReturnObjectsNotOwnedByGroup", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOtherObjects, panelp, _1, _2));
- }
- else
- {
- LLUUID owner_id = parcel->getOwnerID();
-
- if (owner_id == gAgent.getID())
- {
- LLNotificationsUtil::add("ReturnObjectsNotOwnedBySelf", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOtherObjects, panelp, _1, _2));
- }
- else
- {
- args["NAME"] = LLSLURL("agent", owner_id, "completename").getSLURLString();
- LLNotificationsUtil::add("ReturnObjectsNotOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOtherObjects, panelp, _1, _2));
- }
- }
+ S32 other = 0;
+
+ LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
+ LLParcel* parcel = panelp->mParcel->getParcel();
+ if (!parcel) return;
+
+ other = parcel->getOtherPrimCount();
+
+ send_parcel_select_objects(parcel->getLocalID(), RT_OTHER);
+
+ LLSD args;
+ args["N"] = llformat("%d", other);
+
+ if (parcel->getIsGroupOwned())
+ {
+ std::string group_name;
+ gCacheName->getGroupName(parcel->getGroupID(), group_name);
+ args["NAME"] = group_name;
+
+ LLNotificationsUtil::add("ReturnObjectsNotOwnedByGroup", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOtherObjects, panelp, _1, _2));
+ }
+ else
+ {
+ LLUUID owner_id = parcel->getOwnerID();
+
+ if (owner_id == gAgent.getID())
+ {
+ LLNotificationsUtil::add("ReturnObjectsNotOwnedBySelf", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOtherObjects, panelp, _1, _2));
+ }
+ else
+ {
+ args["NAME"] = LLSLURL("agent", owner_id, "completename").getSLURLString();
+ LLNotificationsUtil::add("ReturnObjectsNotOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOtherObjects, panelp, _1, _2));
+ }
+ }
}
// static
void LLPanelLandObjects::onLostFocus(LLFocusableElement* caller, void* user_data)
{
- onCommitClean((LLUICtrl*)caller, user_data);
+ onCommitClean((LLUICtrl*)caller, user_data);
}
// static
void LLPanelLandObjects::onCommitClean(LLUICtrl *caller, void* user_data)
{
- LLPanelLandObjects *lop = (LLPanelLandObjects *)user_data;
- LLParcel* parcel = lop->mParcel->getParcel();
- if (parcel)
- {
- S32 return_time = atoi(lop->mCleanOtherObjectsTime->getText().c_str());
- // Only send return time if it has changed
- if (return_time != lop->mOtherTime)
- {
- lop->mOtherTime = return_time;
+ LLPanelLandObjects *lop = (LLPanelLandObjects *)user_data;
+ LLParcel* parcel = lop->mParcel->getParcel();
+ if (parcel)
+ {
+ S32 return_time = atoi(lop->mCleanOtherObjectsTime->getText().c_str());
+ // Only send return time if it has changed
+ if (return_time != lop->mOtherTime)
+ {
+ lop->mOtherTime = return_time;
- parcel->setCleanOtherTime(lop->mOtherTime);
- send_other_clean_time_message(parcel->getLocalID(), lop->mOtherTime);
- }
+ parcel->setCleanOtherTime(lop->mOtherTime);
+ send_other_clean_time_message(parcel->getLocalID(), lop->mOtherTime);
+ }
}
}
@@ -1909,122 +1909,122 @@ void LLPanelLandObjects::onCommitClean(LLUICtrl *caller, void* user_data)
//---------------------------------------------------------------------------
LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel)
-: LLPanel(),
- mCheckEditObjects(NULL),
- mCheckEditGroupObjects(NULL),
- mCheckAllObjectEntry(NULL),
- mCheckGroupObjectEntry(NULL),
- mCheckSafe(NULL),
- mCheckFly(NULL),
- mCheckGroupScripts(NULL),
- mCheckOtherScripts(NULL),
- mCheckShowDirectory(NULL),
- mCategoryCombo(NULL),
- mLandingTypeCombo(NULL),
- mSnapshotCtrl(NULL),
- mLocationText(NULL),
- mSeeAvatarsText(NULL),
- mSetBtn(NULL),
- mClearBtn(NULL),
- mMatureCtrl(NULL),
- mPushRestrictionCtrl(NULL),
- mSeeAvatarsCtrl(NULL),
- mParcel(parcel)
+: LLPanel(),
+ mCheckEditObjects(NULL),
+ mCheckEditGroupObjects(NULL),
+ mCheckAllObjectEntry(NULL),
+ mCheckGroupObjectEntry(NULL),
+ mCheckSafe(NULL),
+ mCheckFly(NULL),
+ mCheckGroupScripts(NULL),
+ mCheckOtherScripts(NULL),
+ mCheckShowDirectory(NULL),
+ mCategoryCombo(NULL),
+ mLandingTypeCombo(NULL),
+ mSnapshotCtrl(NULL),
+ mLocationText(NULL),
+ mSeeAvatarsText(NULL),
+ mSetBtn(NULL),
+ mClearBtn(NULL),
+ mMatureCtrl(NULL),
+ mPushRestrictionCtrl(NULL),
+ mSeeAvatarsCtrl(NULL),
+ mParcel(parcel)
{
}
BOOL LLPanelLandOptions::postBuild()
{
- mCheckEditObjects = getChild<LLCheckBoxCtrl>( "edit objects check");
- childSetCommitCallback("edit objects check", onCommitAny, this);
-
- mCheckEditGroupObjects = getChild<LLCheckBoxCtrl>( "edit group objects check");
- childSetCommitCallback("edit group objects check", onCommitAny, this);
-
- mCheckAllObjectEntry = getChild<LLCheckBoxCtrl>( "all object entry check");
- childSetCommitCallback("all object entry check", onCommitAny, this);
-
- mCheckGroupObjectEntry = getChild<LLCheckBoxCtrl>( "group object entry check");
- childSetCommitCallback("group object entry check", onCommitAny, this);
-
- mCheckGroupScripts = getChild<LLCheckBoxCtrl>( "check group scripts");
- childSetCommitCallback("check group scripts", onCommitAny, this);
-
-
- mCheckFly = getChild<LLCheckBoxCtrl>( "check fly");
- childSetCommitCallback("check fly", onCommitAny, this);
-
-
- mCheckOtherScripts = getChild<LLCheckBoxCtrl>( "check other scripts");
- childSetCommitCallback("check other scripts", onCommitAny, this);
-
-
- mCheckSafe = getChild<LLCheckBoxCtrl>( "check safe");
- childSetCommitCallback("check safe", onCommitAny, this);
-
-
- mPushRestrictionCtrl = getChild<LLCheckBoxCtrl>( "PushRestrictCheck");
- childSetCommitCallback("PushRestrictCheck", onCommitAny, this);
-
- mSeeAvatarsCtrl = getChild<LLCheckBoxCtrl>( "SeeAvatarsCheck");
- childSetCommitCallback("SeeAvatarsCheck", onCommitAny, this);
-
- mSeeAvatarsText = getChild<LLTextBox>("allow_see_label");
- if (mSeeAvatarsText)
- {
- mSeeAvatarsText->setShowCursorHand(false);
- mSeeAvatarsText->setSoundFlags(LLView::MOUSE_UP);
- mSeeAvatarsText->setClickedCallback(boost::bind(&toggleSeeAvatars, this));
- }
-
- mCheckShowDirectory = getChild<LLCheckBoxCtrl>( "ShowDirectoryCheck");
- childSetCommitCallback("ShowDirectoryCheck", onCommitAny, this);
-
-
- mCategoryCombo = getChild<LLComboBox>( "land category");
- childSetCommitCallback("land category", onCommitAny, this);
-
-
- mMatureCtrl = getChild<LLCheckBoxCtrl>( "MatureCheck");
- childSetCommitCallback("MatureCheck", onCommitAny, this);
-
- if (gAgent.wantsPGOnly())
- {
- // Disable these buttons if they are PG (Teen) users
- mMatureCtrl->setVisible(FALSE);
- mMatureCtrl->setEnabled(FALSE);
- }
-
-
- mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl");
- if (mSnapshotCtrl)
- {
- mSnapshotCtrl->setCommitCallback( onCommitAny, this );
- mSnapshotCtrl->setAllowNoTexture ( TRUE );
- mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
- mSnapshotCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
- }
- else
- {
- LL_WARNS() << "LLUICtrlFactory::getTexturePickerByName() returned NULL for 'snapshot_ctrl'" << LL_ENDL;
- }
-
-
- mLocationText = getChild<LLTextBox>("landing_point");
-
- mSetBtn = getChild<LLButton>("Set");
- mSetBtn->setClickedCallback(onClickSet, this);
-
-
- mClearBtn = getChild<LLButton>("Clear");
- mClearBtn->setClickedCallback(onClickClear, this);
-
-
- mLandingTypeCombo = getChild<LLComboBox>( "landing type");
- childSetCommitCallback("landing type", onCommitAny, this);
-
- return TRUE;
+ mCheckEditObjects = getChild<LLCheckBoxCtrl>( "edit objects check");
+ childSetCommitCallback("edit objects check", onCommitAny, this);
+
+ mCheckEditGroupObjects = getChild<LLCheckBoxCtrl>( "edit group objects check");
+ childSetCommitCallback("edit group objects check", onCommitAny, this);
+
+ mCheckAllObjectEntry = getChild<LLCheckBoxCtrl>( "all object entry check");
+ childSetCommitCallback("all object entry check", onCommitAny, this);
+
+ mCheckGroupObjectEntry = getChild<LLCheckBoxCtrl>( "group object entry check");
+ childSetCommitCallback("group object entry check", onCommitAny, this);
+
+ mCheckGroupScripts = getChild<LLCheckBoxCtrl>( "check group scripts");
+ childSetCommitCallback("check group scripts", onCommitAny, this);
+
+
+ mCheckFly = getChild<LLCheckBoxCtrl>( "check fly");
+ childSetCommitCallback("check fly", onCommitAny, this);
+
+
+ mCheckOtherScripts = getChild<LLCheckBoxCtrl>( "check other scripts");
+ childSetCommitCallback("check other scripts", onCommitAny, this);
+
+
+ mCheckSafe = getChild<LLCheckBoxCtrl>( "check safe");
+ childSetCommitCallback("check safe", onCommitAny, this);
+
+
+ mPushRestrictionCtrl = getChild<LLCheckBoxCtrl>( "PushRestrictCheck");
+ childSetCommitCallback("PushRestrictCheck", onCommitAny, this);
+
+ mSeeAvatarsCtrl = getChild<LLCheckBoxCtrl>( "SeeAvatarsCheck");
+ childSetCommitCallback("SeeAvatarsCheck", onCommitAny, this);
+
+ mSeeAvatarsText = getChild<LLTextBox>("allow_see_label");
+ if (mSeeAvatarsText)
+ {
+ mSeeAvatarsText->setShowCursorHand(false);
+ mSeeAvatarsText->setSoundFlags(LLView::MOUSE_UP);
+ mSeeAvatarsText->setClickedCallback(boost::bind(&toggleSeeAvatars, this));
+ }
+
+ mCheckShowDirectory = getChild<LLCheckBoxCtrl>( "ShowDirectoryCheck");
+ childSetCommitCallback("ShowDirectoryCheck", onCommitAny, this);
+
+
+ mCategoryCombo = getChild<LLComboBox>( "land category");
+ childSetCommitCallback("land category", onCommitAny, this);
+
+
+ mMatureCtrl = getChild<LLCheckBoxCtrl>( "MatureCheck");
+ childSetCommitCallback("MatureCheck", onCommitAny, this);
+
+ if (gAgent.wantsPGOnly())
+ {
+ // Disable these buttons if they are PG (Teen) users
+ mMatureCtrl->setVisible(FALSE);
+ mMatureCtrl->setEnabled(FALSE);
+ }
+
+
+ mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl");
+ if (mSnapshotCtrl)
+ {
+ mSnapshotCtrl->setCommitCallback( onCommitAny, this );
+ mSnapshotCtrl->setAllowNoTexture ( TRUE );
+ mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ mSnapshotCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ }
+ else
+ {
+ LL_WARNS() << "LLUICtrlFactory::getTexturePickerByName() returned NULL for 'snapshot_ctrl'" << LL_ENDL;
+ }
+
+
+ mLocationText = getChild<LLTextBox>("landing_point");
+
+ mSetBtn = getChild<LLButton>("Set");
+ mSetBtn->setClickedCallback(onClickSet, this);
+
+
+ mClearBtn = getChild<LLButton>("Clear");
+ mClearBtn->setClickedCallback(onClickClear, this);
+
+
+ mLandingTypeCombo = getChild<LLComboBox>( "landing type");
+ childSetCommitCallback("landing type", onCommitAny, this);
+
+ return TRUE;
}
@@ -2036,462 +2036,462 @@ LLPanelLandOptions::~LLPanelLandOptions()
// virtual
void LLPanelLandOptions::refresh()
{
- refreshSearch();
+ refreshSearch();
+
+ LLParcel *parcel = mParcel->getParcel();
+ if (!parcel || gDisconnected)
+ {
+ mCheckEditObjects ->set(FALSE);
+ mCheckEditObjects ->setEnabled(FALSE);
+
+ mCheckEditGroupObjects ->set(FALSE);
+ mCheckEditGroupObjects ->setEnabled(FALSE);
+
+ mCheckAllObjectEntry ->set(FALSE);
+ mCheckAllObjectEntry ->setEnabled(FALSE);
+
+ mCheckGroupObjectEntry ->set(FALSE);
+ mCheckGroupObjectEntry ->setEnabled(FALSE);
- LLParcel *parcel = mParcel->getParcel();
- if (!parcel || gDisconnected)
- {
- mCheckEditObjects ->set(FALSE);
- mCheckEditObjects ->setEnabled(FALSE);
-
- mCheckEditGroupObjects ->set(FALSE);
- mCheckEditGroupObjects ->setEnabled(FALSE);
-
- mCheckAllObjectEntry ->set(FALSE);
- mCheckAllObjectEntry ->setEnabled(FALSE);
-
- mCheckGroupObjectEntry ->set(FALSE);
- mCheckGroupObjectEntry ->setEnabled(FALSE);
-
- mCheckSafe ->set(FALSE);
- mCheckSafe ->setEnabled(FALSE);
-
- mCheckFly ->set(FALSE);
- mCheckFly ->setEnabled(FALSE);
-
- mCheckGroupScripts ->set(FALSE);
- mCheckGroupScripts ->setEnabled(FALSE);
-
- mCheckOtherScripts ->set(FALSE);
- mCheckOtherScripts ->setEnabled(FALSE);
-
- mPushRestrictionCtrl->set(FALSE);
- mPushRestrictionCtrl->setEnabled(FALSE);
-
- mSeeAvatarsCtrl->set(TRUE);
- mSeeAvatarsCtrl->setEnabled(FALSE);
- mSeeAvatarsText->setEnabled(FALSE);
-
- mLandingTypeCombo->setCurrentByIndex(0);
- mLandingTypeCombo->setEnabled(FALSE);
-
- mSnapshotCtrl->setImageAssetID(LLUUID::null);
- mSnapshotCtrl->setEnabled(FALSE);
-
- mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
- mSetBtn->setEnabled(FALSE);
- mClearBtn->setEnabled(FALSE);
-
- mMatureCtrl->setEnabled(FALSE);
- }
- else
- {
- // something selected, hooray!
-
- // Display options
- BOOL can_change_options = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS);
- mCheckEditObjects ->set( parcel->getAllowModify() );
- mCheckEditObjects ->setEnabled( can_change_options );
-
- mCheckEditGroupObjects ->set( parcel->getAllowGroupModify() || parcel->getAllowModify());
- mCheckEditGroupObjects ->setEnabled( can_change_options && !parcel->getAllowModify() ); // If others edit is enabled, then this is explicitly enabled.
-
- mCheckAllObjectEntry ->set( parcel->getAllowAllObjectEntry() );
- mCheckAllObjectEntry ->setEnabled( can_change_options );
-
- mCheckGroupObjectEntry ->set( parcel->getAllowGroupObjectEntry() || parcel->getAllowAllObjectEntry());
- mCheckGroupObjectEntry ->setEnabled( can_change_options && !parcel->getAllowAllObjectEntry() );
-
- mCheckSafe ->set( !parcel->getAllowDamage() );
- mCheckSafe ->setEnabled( can_change_options );
-
- mCheckFly ->set( parcel->getAllowFly() );
- mCheckFly ->setEnabled( can_change_options );
-
- mCheckGroupScripts ->set( parcel->getAllowGroupScripts() || parcel->getAllowOtherScripts());
- mCheckGroupScripts ->setEnabled( can_change_options && !parcel->getAllowOtherScripts());
-
- mCheckOtherScripts ->set( parcel->getAllowOtherScripts() );
- mCheckOtherScripts ->setEnabled( can_change_options );
-
- mPushRestrictionCtrl->set( parcel->getRestrictPushObject() );
- if(parcel->getRegionPushOverride())
- {
- mPushRestrictionCtrl->setLabel(getString("push_restrict_region_text"));
- mPushRestrictionCtrl->setEnabled(false);
- mPushRestrictionCtrl->set(TRUE);
- }
- else
- {
- mPushRestrictionCtrl->setLabel(getString("push_restrict_text"));
- mPushRestrictionCtrl->setEnabled(can_change_options);
- }
-
- mSeeAvatarsCtrl->set(parcel->getSeeAVs());
- mSeeAvatarsCtrl->setEnabled(can_change_options && parcel->getHaveNewParcelLimitData());
- mSeeAvatarsText->setEnabled(can_change_options && parcel->getHaveNewParcelLimitData());
-
- BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel,
- GP_LAND_SET_LANDING_POINT);
- mLandingTypeCombo->setCurrentByIndex((S32)parcel->getLandingType());
- mLandingTypeCombo->setEnabled( can_change_landing_point );
-
- bool can_change_identity =
- LLViewerParcelMgr::isParcelModifiableByAgent(
- parcel, GP_LAND_CHANGE_IDENTITY);
- mSnapshotCtrl->setImageAssetID(parcel->getSnapshotID());
- mSnapshotCtrl->setEnabled( can_change_identity );
-
- // find out where we're looking and convert that to an angle in degrees on a regular compass (not the internal representation)
- LLVector3 user_look_at = parcel->getUserLookAt();
- U32 user_look_at_angle = ( (U32)( ( atan2(user_look_at[1], -user_look_at[0]) + F_PI * 2 ) * RAD_TO_DEG + 0.5) - 90) % 360;
-
- LLVector3 pos = parcel->getUserLocation();
- if (pos.isExactlyZero())
- {
- mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
- }
- else
- {
- mLocationText->setTextArg("[LANDING]",llformat("%d, %d, %d (%d\xC2\xB0)",
- ll_round(pos.mV[VX]),
- ll_round(pos.mV[VY]),
- ll_round(pos.mV[VZ]),
- user_look_at_angle));
- }
-
- mSetBtn->setEnabled( can_change_landing_point );
- mClearBtn->setEnabled( can_change_landing_point );
-
- if (gAgent.wantsPGOnly())
- {
- // Disable these buttons if they are PG (Teen) users
- mMatureCtrl->setVisible(FALSE);
- mMatureCtrl->setEnabled(FALSE);
- }
- else
- {
- // not teen so fill in the data for the maturity control
- mMatureCtrl->setVisible(TRUE);
- LLStyle::Params style;
- style.image(LLUI::getUIImage(gFloaterView->getParentFloater(this)->getString("maturity_icon_moderate")));
- LLCheckBoxWithTBAcess* fullaccess_mature_ctrl = (LLCheckBoxWithTBAcess*)mMatureCtrl;
- fullaccess_mature_ctrl->getTextBox()->setText(LLStringExplicit(""));
- fullaccess_mature_ctrl->getTextBox()->appendImageSegment(style);
- fullaccess_mature_ctrl->getTextBox()->appendText(getString("mature_check_mature"), false);
- fullaccess_mature_ctrl->setToolTip(getString("mature_check_mature_tooltip"));
- fullaccess_mature_ctrl->reshape(fullaccess_mature_ctrl->getRect().getWidth(), fullaccess_mature_ctrl->getRect().getHeight(), FALSE);
-
- // they can see the checkbox, but its disposition depends on the
- // state of the region
- LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (regionp)
- {
- if (regionp->getSimAccess() == SIM_ACCESS_PG)
- {
- mMatureCtrl->setEnabled(FALSE);
- mMatureCtrl->set(FALSE);
- }
- else if (regionp->getSimAccess() == SIM_ACCESS_MATURE)
- {
- mMatureCtrl->setEnabled(can_change_identity);
- mMatureCtrl->set(parcel->getMaturePublish());
- }
- else if (regionp->getSimAccess() == SIM_ACCESS_ADULT)
- {
- mMatureCtrl->setEnabled(FALSE);
- mMatureCtrl->set(TRUE);
- mMatureCtrl->setLabel(getString("mature_check_adult"));
- mMatureCtrl->setToolTip(getString("mature_check_adult_tooltip"));
- }
- }
- }
- }
+ mCheckSafe ->set(FALSE);
+ mCheckSafe ->setEnabled(FALSE);
+
+ mCheckFly ->set(FALSE);
+ mCheckFly ->setEnabled(FALSE);
+
+ mCheckGroupScripts ->set(FALSE);
+ mCheckGroupScripts ->setEnabled(FALSE);
+
+ mCheckOtherScripts ->set(FALSE);
+ mCheckOtherScripts ->setEnabled(FALSE);
+
+ mPushRestrictionCtrl->set(FALSE);
+ mPushRestrictionCtrl->setEnabled(FALSE);
+
+ mSeeAvatarsCtrl->set(TRUE);
+ mSeeAvatarsCtrl->setEnabled(FALSE);
+ mSeeAvatarsText->setEnabled(FALSE);
+
+ mLandingTypeCombo->setCurrentByIndex(0);
+ mLandingTypeCombo->setEnabled(FALSE);
+
+ mSnapshotCtrl->setImageAssetID(LLUUID::null);
+ mSnapshotCtrl->setEnabled(FALSE);
+
+ mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
+ mSetBtn->setEnabled(FALSE);
+ mClearBtn->setEnabled(FALSE);
+
+ mMatureCtrl->setEnabled(FALSE);
+ }
+ else
+ {
+ // something selected, hooray!
+
+ // Display options
+ BOOL can_change_options = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS);
+ mCheckEditObjects ->set( parcel->getAllowModify() );
+ mCheckEditObjects ->setEnabled( can_change_options );
+
+ mCheckEditGroupObjects ->set( parcel->getAllowGroupModify() || parcel->getAllowModify());
+ mCheckEditGroupObjects ->setEnabled( can_change_options && !parcel->getAllowModify() ); // If others edit is enabled, then this is explicitly enabled.
+
+ mCheckAllObjectEntry ->set( parcel->getAllowAllObjectEntry() );
+ mCheckAllObjectEntry ->setEnabled( can_change_options );
+
+ mCheckGroupObjectEntry ->set( parcel->getAllowGroupObjectEntry() || parcel->getAllowAllObjectEntry());
+ mCheckGroupObjectEntry ->setEnabled( can_change_options && !parcel->getAllowAllObjectEntry() );
+
+ mCheckSafe ->set( !parcel->getAllowDamage() );
+ mCheckSafe ->setEnabled( can_change_options );
+
+ mCheckFly ->set( parcel->getAllowFly() );
+ mCheckFly ->setEnabled( can_change_options );
+
+ mCheckGroupScripts ->set( parcel->getAllowGroupScripts() || parcel->getAllowOtherScripts());
+ mCheckGroupScripts ->setEnabled( can_change_options && !parcel->getAllowOtherScripts());
+
+ mCheckOtherScripts ->set( parcel->getAllowOtherScripts() );
+ mCheckOtherScripts ->setEnabled( can_change_options );
+
+ mPushRestrictionCtrl->set( parcel->getRestrictPushObject() );
+ if(parcel->getRegionPushOverride())
+ {
+ mPushRestrictionCtrl->setLabel(getString("push_restrict_region_text"));
+ mPushRestrictionCtrl->setEnabled(false);
+ mPushRestrictionCtrl->set(TRUE);
+ }
+ else
+ {
+ mPushRestrictionCtrl->setLabel(getString("push_restrict_text"));
+ mPushRestrictionCtrl->setEnabled(can_change_options);
+ }
+
+ mSeeAvatarsCtrl->set(parcel->getSeeAVs());
+ mSeeAvatarsCtrl->setEnabled(can_change_options && parcel->getHaveNewParcelLimitData());
+ mSeeAvatarsText->setEnabled(can_change_options && parcel->getHaveNewParcelLimitData());
+
+ BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel,
+ GP_LAND_SET_LANDING_POINT);
+ mLandingTypeCombo->setCurrentByIndex((S32)parcel->getLandingType());
+ mLandingTypeCombo->setEnabled( can_change_landing_point );
+
+ bool can_change_identity =
+ LLViewerParcelMgr::isParcelModifiableByAgent(
+ parcel, GP_LAND_CHANGE_IDENTITY);
+ mSnapshotCtrl->setImageAssetID(parcel->getSnapshotID());
+ mSnapshotCtrl->setEnabled( can_change_identity );
+
+ // find out where we're looking and convert that to an angle in degrees on a regular compass (not the internal representation)
+ LLVector3 user_look_at = parcel->getUserLookAt();
+ U32 user_look_at_angle = ( (U32)( ( atan2(user_look_at[1], -user_look_at[0]) + F_PI * 2 ) * RAD_TO_DEG + 0.5) - 90) % 360;
+
+ LLVector3 pos = parcel->getUserLocation();
+ if (pos.isExactlyZero())
+ {
+ mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
+ }
+ else
+ {
+ mLocationText->setTextArg("[LANDING]",llformat("%d, %d, %d (%d\xC2\xB0)",
+ ll_round(pos.mV[VX]),
+ ll_round(pos.mV[VY]),
+ ll_round(pos.mV[VZ]),
+ user_look_at_angle));
+ }
+
+ mSetBtn->setEnabled( can_change_landing_point );
+ mClearBtn->setEnabled( can_change_landing_point );
+
+ if (gAgent.wantsPGOnly())
+ {
+ // Disable these buttons if they are PG (Teen) users
+ mMatureCtrl->setVisible(FALSE);
+ mMatureCtrl->setEnabled(FALSE);
+ }
+ else
+ {
+ // not teen so fill in the data for the maturity control
+ mMatureCtrl->setVisible(TRUE);
+ LLStyle::Params style;
+ style.image(LLUI::getUIImage(gFloaterView->getParentFloater(this)->getString("maturity_icon_moderate")));
+ LLCheckBoxWithTBAcess* fullaccess_mature_ctrl = (LLCheckBoxWithTBAcess*)mMatureCtrl;
+ fullaccess_mature_ctrl->getTextBox()->setText(LLStringExplicit(""));
+ fullaccess_mature_ctrl->getTextBox()->appendImageSegment(style);
+ fullaccess_mature_ctrl->getTextBox()->appendText(getString("mature_check_mature"), false);
+ fullaccess_mature_ctrl->setToolTip(getString("mature_check_mature_tooltip"));
+ fullaccess_mature_ctrl->reshape(fullaccess_mature_ctrl->getRect().getWidth(), fullaccess_mature_ctrl->getRect().getHeight(), FALSE);
+
+ // they can see the checkbox, but its disposition depends on the
+ // state of the region
+ LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (regionp)
+ {
+ if (regionp->getSimAccess() == SIM_ACCESS_PG)
+ {
+ mMatureCtrl->setEnabled(FALSE);
+ mMatureCtrl->set(FALSE);
+ }
+ else if (regionp->getSimAccess() == SIM_ACCESS_MATURE)
+ {
+ mMatureCtrl->setEnabled(can_change_identity);
+ mMatureCtrl->set(parcel->getMaturePublish());
+ }
+ else if (regionp->getSimAccess() == SIM_ACCESS_ADULT)
+ {
+ mMatureCtrl->setEnabled(FALSE);
+ mMatureCtrl->set(TRUE);
+ mMatureCtrl->setLabel(getString("mature_check_adult"));
+ mMatureCtrl->setToolTip(getString("mature_check_adult_tooltip"));
+ }
+ }
+ }
+ }
}
// virtual
void LLPanelLandOptions::draw()
{
- LLPanel::draw();
+ LLPanel::draw();
}
// private
void LLPanelLandOptions::refreshSearch()
{
- LLParcel *parcel = mParcel->getParcel();
- if (!parcel || gDisconnected)
- {
- mCheckShowDirectory->set(FALSE);
- mCheckShowDirectory->setEnabled(FALSE);
-
- const std::string& none_string = LLParcel::getCategoryString(LLParcel::C_NONE);
- mCategoryCombo->setValue(none_string);
- mCategoryCombo->setEnabled(FALSE);
- return;
- }
-
- LLViewerRegion* region =
- LLViewerParcelMgr::getInstance()->getSelectionRegion();
-
- bool can_change =
- LLViewerParcelMgr::isParcelModifiableByAgent(
- parcel, GP_LAND_FIND_PLACES)
- && region
- && !(region->getRegionFlag(REGION_FLAGS_BLOCK_PARCEL_SEARCH));
-
- BOOL show_directory = parcel->getParcelFlag(PF_SHOW_DIRECTORY);
- mCheckShowDirectory->set(show_directory);
-
- // Set by string in case the order in UI doesn't match the order by index.
- LLParcel::ECategory cat = parcel->getCategory();
- const std::string& category_string = LLParcel::getCategoryString(cat);
- mCategoryCombo->setValue(category_string);
-
- std::string tooltip;
- bool enable_show_directory = false;
- // Parcels <= 128 square meters cannot be listed in search, in an
- // effort to reduce search spam from small parcels. See also
- // the search crawler "grid-crawl.py" in secondlife.com/doc/app/search/ JC
- const S32 MIN_PARCEL_AREA_FOR_SEARCH = 128;
- bool large_enough = parcel->getArea() >= MIN_PARCEL_AREA_FOR_SEARCH;
- if (large_enough)
- {
- if (can_change)
- {
- tooltip = getString("search_enabled_tooltip");
- enable_show_directory = true;
- }
- else
- {
- tooltip = getString("search_disabled_permissions_tooltip");
- enable_show_directory = false;
- }
- }
- else
- {
- // not large enough to include in search
- if (can_change)
- {
- if (show_directory)
- {
- // parcels that are too small, but are still in search for
- // legacy reasons, need to have the check box enabled so
- // the owner can delist the parcel. JC
- tooltip = getString("search_enabled_tooltip");
- enable_show_directory = true;
- }
- else
- {
- tooltip = getString("search_disabled_small_tooltip");
- enable_show_directory = false;
- }
- }
- else
- {
- // both too small and don't have permission, so just
- // show the permissions as the reason (which is probably
- // the more common case) JC
- tooltip = getString("search_disabled_permissions_tooltip");
- enable_show_directory = false;
- }
- }
- mCheckShowDirectory->setToolTip(tooltip);
- mCategoryCombo->setToolTip(tooltip);
- mCheckShowDirectory->setEnabled(enable_show_directory);
- mCategoryCombo->setEnabled(enable_show_directory);
+ LLParcel *parcel = mParcel->getParcel();
+ if (!parcel || gDisconnected)
+ {
+ mCheckShowDirectory->set(FALSE);
+ mCheckShowDirectory->setEnabled(FALSE);
+
+ const std::string& none_string = LLParcel::getCategoryString(LLParcel::C_NONE);
+ mCategoryCombo->setValue(none_string);
+ mCategoryCombo->setEnabled(FALSE);
+ return;
+ }
+
+ LLViewerRegion* region =
+ LLViewerParcelMgr::getInstance()->getSelectionRegion();
+
+ bool can_change =
+ LLViewerParcelMgr::isParcelModifiableByAgent(
+ parcel, GP_LAND_FIND_PLACES)
+ && region
+ && !(region->getRegionFlag(REGION_FLAGS_BLOCK_PARCEL_SEARCH));
+
+ BOOL show_directory = parcel->getParcelFlag(PF_SHOW_DIRECTORY);
+ mCheckShowDirectory->set(show_directory);
+
+ // Set by string in case the order in UI doesn't match the order by index.
+ LLParcel::ECategory cat = parcel->getCategory();
+ const std::string& category_string = LLParcel::getCategoryString(cat);
+ mCategoryCombo->setValue(category_string);
+
+ std::string tooltip;
+ bool enable_show_directory = false;
+ // Parcels <= 128 square meters cannot be listed in search, in an
+ // effort to reduce search spam from small parcels. See also
+ // the search crawler "grid-crawl.py" in secondlife.com/doc/app/search/ JC
+ const S32 MIN_PARCEL_AREA_FOR_SEARCH = 128;
+ bool large_enough = parcel->getArea() >= MIN_PARCEL_AREA_FOR_SEARCH;
+ if (large_enough)
+ {
+ if (can_change)
+ {
+ tooltip = getString("search_enabled_tooltip");
+ enable_show_directory = true;
+ }
+ else
+ {
+ tooltip = getString("search_disabled_permissions_tooltip");
+ enable_show_directory = false;
+ }
+ }
+ else
+ {
+ // not large enough to include in search
+ if (can_change)
+ {
+ if (show_directory)
+ {
+ // parcels that are too small, but are still in search for
+ // legacy reasons, need to have the check box enabled so
+ // the owner can delist the parcel. JC
+ tooltip = getString("search_enabled_tooltip");
+ enable_show_directory = true;
+ }
+ else
+ {
+ tooltip = getString("search_disabled_small_tooltip");
+ enable_show_directory = false;
+ }
+ }
+ else
+ {
+ // both too small and don't have permission, so just
+ // show the permissions as the reason (which is probably
+ // the more common case) JC
+ tooltip = getString("search_disabled_permissions_tooltip");
+ enable_show_directory = false;
+ }
+ }
+ mCheckShowDirectory->setToolTip(tooltip);
+ mCategoryCombo->setToolTip(tooltip);
+ mCheckShowDirectory->setEnabled(enable_show_directory);
+ mCategoryCombo->setEnabled(enable_show_directory);
}
// static
void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)
{
- LLPanelLandOptions *self = (LLPanelLandOptions *)userdata;
-
- LLParcel* parcel = self->mParcel->getParcel();
- if (!parcel)
- {
- return;
- }
-
- // Extract data from UI
- BOOL create_objects = self->mCheckEditObjects->get();
- BOOL create_group_objects = self->mCheckEditGroupObjects->get() || self->mCheckEditObjects->get();
- BOOL all_object_entry = self->mCheckAllObjectEntry->get();
- BOOL group_object_entry = self->mCheckGroupObjectEntry->get() || self->mCheckAllObjectEntry->get();
- BOOL allow_terraform = false; // removed from UI so always off now - self->mCheckEditLand->get();
- BOOL allow_damage = !self->mCheckSafe->get();
- BOOL allow_fly = self->mCheckFly->get();
- BOOL allow_landmark = TRUE; // cannot restrict landmark creation
- BOOL allow_other_scripts = self->mCheckOtherScripts->get();
- BOOL allow_group_scripts = self->mCheckGroupScripts->get() || allow_other_scripts;
- BOOL allow_publish = FALSE;
- BOOL mature_publish = self->mMatureCtrl->get();
- BOOL push_restriction = self->mPushRestrictionCtrl->get();
- BOOL see_avs = self->mSeeAvatarsCtrl->get();
- BOOL show_directory = self->mCheckShowDirectory->get();
- // we have to get the index from a lookup, not from the position in the dropdown!
- S32 category_index = LLParcel::getCategoryFromString(self->mCategoryCombo->getSelectedValue());
- S32 landing_type_index = self->mLandingTypeCombo->getCurrentIndex();
- LLUUID snapshot_id = self->mSnapshotCtrl->getImageAssetID();
- LLViewerRegion* region;
- region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
-
- if (region && region->getAllowDamage())
- { // Damage is allowed on the region - server will always allow scripts
- if ( (!allow_other_scripts && parcel->getParcelFlag(PF_ALLOW_OTHER_SCRIPTS)) ||
- (!allow_group_scripts && parcel->getParcelFlag(PF_ALLOW_GROUP_SCRIPTS)) )
- { // Don't allow turning off "Run Scripts" if damage is allowed in the region
- self->mCheckOtherScripts->set(parcel->getParcelFlag(PF_ALLOW_OTHER_SCRIPTS)); // Restore UI to actual settings
- self->mCheckGroupScripts->set(parcel->getParcelFlag(PF_ALLOW_GROUP_SCRIPTS));
- LLNotificationsUtil::add("UnableToDisableOutsideScripts");
- return;
- }
- }
-
- // Push data into current parcel
- parcel->setParcelFlag(PF_CREATE_OBJECTS, create_objects);
- parcel->setParcelFlag(PF_CREATE_GROUP_OBJECTS, create_group_objects);
- parcel->setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, all_object_entry);
- parcel->setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, group_object_entry);
- parcel->setParcelFlag(PF_ALLOW_TERRAFORM, allow_terraform);
- parcel->setParcelFlag(PF_ALLOW_DAMAGE, allow_damage);
- parcel->setParcelFlag(PF_ALLOW_FLY, allow_fly);
- parcel->setParcelFlag(PF_ALLOW_LANDMARK, allow_landmark);
- parcel->setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, allow_group_scripts);
- parcel->setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, allow_other_scripts);
- parcel->setParcelFlag(PF_SHOW_DIRECTORY, show_directory);
- parcel->setParcelFlag(PF_ALLOW_PUBLISH, allow_publish);
- parcel->setParcelFlag(PF_MATURE_PUBLISH, mature_publish);
- parcel->setParcelFlag(PF_RESTRICT_PUSHOBJECT, push_restriction);
- parcel->setCategory((LLParcel::ECategory)category_index);
- parcel->setLandingType((LLParcel::ELandingType)landing_type_index);
- parcel->setSnapshotID(snapshot_id);
- parcel->setSeeAVs(see_avs);
-
- // Send current parcel data upstream to server
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
-
- // Might have changed properties, so let's redraw!
- self->refresh();
+ LLPanelLandOptions *self = (LLPanelLandOptions *)userdata;
+
+ LLParcel* parcel = self->mParcel->getParcel();
+ if (!parcel)
+ {
+ return;
+ }
+
+ // Extract data from UI
+ BOOL create_objects = self->mCheckEditObjects->get();
+ BOOL create_group_objects = self->mCheckEditGroupObjects->get() || self->mCheckEditObjects->get();
+ BOOL all_object_entry = self->mCheckAllObjectEntry->get();
+ BOOL group_object_entry = self->mCheckGroupObjectEntry->get() || self->mCheckAllObjectEntry->get();
+ BOOL allow_terraform = false; // removed from UI so always off now - self->mCheckEditLand->get();
+ BOOL allow_damage = !self->mCheckSafe->get();
+ BOOL allow_fly = self->mCheckFly->get();
+ BOOL allow_landmark = TRUE; // cannot restrict landmark creation
+ BOOL allow_other_scripts = self->mCheckOtherScripts->get();
+ BOOL allow_group_scripts = self->mCheckGroupScripts->get() || allow_other_scripts;
+ BOOL allow_publish = FALSE;
+ BOOL mature_publish = self->mMatureCtrl->get();
+ BOOL push_restriction = self->mPushRestrictionCtrl->get();
+ BOOL see_avs = self->mSeeAvatarsCtrl->get();
+ BOOL show_directory = self->mCheckShowDirectory->get();
+ // we have to get the index from a lookup, not from the position in the dropdown!
+ S32 category_index = LLParcel::getCategoryFromString(self->mCategoryCombo->getSelectedValue());
+ S32 landing_type_index = self->mLandingTypeCombo->getCurrentIndex();
+ LLUUID snapshot_id = self->mSnapshotCtrl->getImageAssetID();
+ LLViewerRegion* region;
+ region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+
+ if (region && region->getAllowDamage())
+ { // Damage is allowed on the region - server will always allow scripts
+ if ( (!allow_other_scripts && parcel->getParcelFlag(PF_ALLOW_OTHER_SCRIPTS)) ||
+ (!allow_group_scripts && parcel->getParcelFlag(PF_ALLOW_GROUP_SCRIPTS)) )
+ { // Don't allow turning off "Run Scripts" if damage is allowed in the region
+ self->mCheckOtherScripts->set(parcel->getParcelFlag(PF_ALLOW_OTHER_SCRIPTS)); // Restore UI to actual settings
+ self->mCheckGroupScripts->set(parcel->getParcelFlag(PF_ALLOW_GROUP_SCRIPTS));
+ LLNotificationsUtil::add("UnableToDisableOutsideScripts");
+ return;
+ }
+ }
+
+ // Push data into current parcel
+ parcel->setParcelFlag(PF_CREATE_OBJECTS, create_objects);
+ parcel->setParcelFlag(PF_CREATE_GROUP_OBJECTS, create_group_objects);
+ parcel->setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, all_object_entry);
+ parcel->setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, group_object_entry);
+ parcel->setParcelFlag(PF_ALLOW_TERRAFORM, allow_terraform);
+ parcel->setParcelFlag(PF_ALLOW_DAMAGE, allow_damage);
+ parcel->setParcelFlag(PF_ALLOW_FLY, allow_fly);
+ parcel->setParcelFlag(PF_ALLOW_LANDMARK, allow_landmark);
+ parcel->setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, allow_group_scripts);
+ parcel->setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, allow_other_scripts);
+ parcel->setParcelFlag(PF_SHOW_DIRECTORY, show_directory);
+ parcel->setParcelFlag(PF_ALLOW_PUBLISH, allow_publish);
+ parcel->setParcelFlag(PF_MATURE_PUBLISH, mature_publish);
+ parcel->setParcelFlag(PF_RESTRICT_PUSHOBJECT, push_restriction);
+ parcel->setCategory((LLParcel::ECategory)category_index);
+ parcel->setLandingType((LLParcel::ELandingType)landing_type_index);
+ parcel->setSnapshotID(snapshot_id);
+ parcel->setSeeAVs(see_avs);
+
+ // Send current parcel data upstream to server
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+
+ // Might have changed properties, so let's redraw!
+ self->refresh();
}
// static
void LLPanelLandOptions::onClickSet(void* userdata)
{
- LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
+ LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
- LLParcel* selected_parcel = self->mParcel->getParcel();
- if (!selected_parcel) return;
+ LLParcel* selected_parcel = self->mParcel->getParcel();
+ if (!selected_parcel) return;
- LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!agent_parcel) return;
+ LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!agent_parcel) return;
- if (agent_parcel->getLocalID() != selected_parcel->getLocalID())
- {
- LLNotificationsUtil::add("MustBeInParcel");
- return;
- }
+ if (agent_parcel->getLocalID() != selected_parcel->getLocalID())
+ {
+ LLNotificationsUtil::add("MustBeInParcel");
+ return;
+ }
- LLVector3 pos_region = gAgent.getPositionAgent();
- selected_parcel->setUserLocation(pos_region);
- selected_parcel->setUserLookAt(gAgent.getFrameAgent().getAtAxis());
+ LLVector3 pos_region = gAgent.getPositionAgent();
+ selected_parcel->setUserLocation(pos_region);
+ selected_parcel->setUserLookAt(gAgent.getFrameAgent().getAtAxis());
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(selected_parcel);
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(selected_parcel);
- self->refresh();
+ self->refresh();
}
void LLPanelLandOptions::onClickClear(void* userdata)
{
- LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
+ LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
- LLParcel* selected_parcel = self->mParcel->getParcel();
- if (!selected_parcel) return;
+ LLParcel* selected_parcel = self->mParcel->getParcel();
+ if (!selected_parcel) return;
- // yes, this magic number of 0,0,0 means that it is clear
- LLVector3 zero_vec(0.f, 0.f, 0.f);
- selected_parcel->setUserLocation(zero_vec);
- selected_parcel->setUserLookAt(zero_vec);
+ // yes, this magic number of 0,0,0 means that it is clear
+ LLVector3 zero_vec(0.f, 0.f, 0.f);
+ selected_parcel->setUserLocation(zero_vec);
+ selected_parcel->setUserLookAt(zero_vec);
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(selected_parcel);
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(selected_parcel);
- self->refresh();
+ self->refresh();
}
void LLPanelLandOptions::toggleSeeAvatars(void* userdata)
{
- LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
- if (self)
- {
- self->getChild<LLCheckBoxCtrl>("SeeAvatarsCheck")->toggle();
- self->getChild<LLCheckBoxCtrl>("SeeAvatarsCheck")->setBtnFocus();
- self->onCommitAny(NULL, userdata);
- }
+ LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
+ if (self)
+ {
+ self->getChild<LLCheckBoxCtrl>("SeeAvatarsCheck")->toggle();
+ self->getChild<LLCheckBoxCtrl>("SeeAvatarsCheck")->setBtnFocus();
+ self->onCommitAny(NULL, userdata);
+ }
}
//---------------------------------------------------------------------------
// LLPanelLandAccess
//---------------------------------------------------------------------------
LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel)
- : LLPanel(),
- mParcel(parcel)
+ : LLPanel(),
+ mParcel(parcel)
{
}
BOOL LLPanelLandAccess::postBuild()
{
- childSetCommitCallback("public_access", onCommitPublicAccess, this);
- childSetCommitCallback("limit_payment", onCommitAny, this);
- childSetCommitCallback("limit_age_verified", onCommitAny, this);
- childSetCommitCallback("GroupCheck", onCommitGroupCheck, this);
- childSetCommitCallback("PassCheck", onCommitAny, this);
- childSetCommitCallback("pass_combo", onCommitAny, this);
- childSetCommitCallback("PriceSpin", onCommitAny, this);
- childSetCommitCallback("HoursSpin", onCommitAny, this);
-
- childSetAction("add_allowed", boost::bind(&LLPanelLandAccess::onClickAddAccess, this));
- childSetAction("remove_allowed", onClickRemoveAccess, this);
- childSetAction("add_banned", boost::bind(&LLPanelLandAccess::onClickAddBanned, this));
- childSetAction("remove_banned", onClickRemoveBanned, this);
-
- mListAccess = getChild<LLNameListCtrl>("AccessList");
- if (mListAccess)
- {
- mListAccess->sortByColumnIndex(0, TRUE); // ascending
- mListAccess->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
- }
-
- mListBanned = getChild<LLNameListCtrl>("BannedList");
- if (mListBanned)
- {
- mListBanned->sortByColumnIndex(0, TRUE); // ascending
- mListBanned->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
- mListBanned->setAlternateSort();
- }
-
- return TRUE;
+ childSetCommitCallback("public_access", onCommitPublicAccess, this);
+ childSetCommitCallback("limit_payment", onCommitAny, this);
+ childSetCommitCallback("limit_age_verified", onCommitAny, this);
+ childSetCommitCallback("GroupCheck", onCommitGroupCheck, this);
+ childSetCommitCallback("PassCheck", onCommitAny, this);
+ childSetCommitCallback("pass_combo", onCommitAny, this);
+ childSetCommitCallback("PriceSpin", onCommitAny, this);
+ childSetCommitCallback("HoursSpin", onCommitAny, this);
+
+ childSetAction("add_allowed", boost::bind(&LLPanelLandAccess::onClickAddAccess, this));
+ childSetAction("remove_allowed", onClickRemoveAccess, this);
+ childSetAction("add_banned", boost::bind(&LLPanelLandAccess::onClickAddBanned, this));
+ childSetAction("remove_banned", onClickRemoveBanned, this);
+
+ mListAccess = getChild<LLNameListCtrl>("AccessList");
+ if (mListAccess)
+ {
+ mListAccess->sortByColumnIndex(0, TRUE); // ascending
+ mListAccess->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+ }
+
+ mListBanned = getChild<LLNameListCtrl>("BannedList");
+ if (mListBanned)
+ {
+ mListBanned->sortByColumnIndex(0, TRUE); // ascending
+ mListBanned->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+ mListBanned->setAlternateSort();
+ }
+
+ return TRUE;
}
LLPanelLandAccess::~LLPanelLandAccess()
-{
+{
}
void LLPanelLandAccess::refresh()
{
- LLFloater* parent_floater = gFloaterView->getParentFloater(this);
- LLParcel *parcel = mParcel->getParcel();
-
- // Display options
- if (parcel && !gDisconnected)
- {
- BOOL use_access_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST);
- BOOL use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP);
- BOOL public_access = !use_access_list;
-
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+ LLParcel *parcel = mParcel->getParcel();
+
+ // Display options
+ if (parcel && !gDisconnected)
+ {
+ BOOL use_access_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST);
+ BOOL use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP);
+ BOOL public_access = !use_access_list;
+
if (parcel->getRegionAllowAccessOverride())
{
getChild<LLUICtrl>("public_access")->setValue(public_access);
@@ -2502,463 +2502,463 @@ void LLPanelLandAccess::refresh()
getChild<LLUICtrl>("public_access")->setValue(TRUE);
getChild<LLUICtrl>("GroupCheck")->setValue(FALSE);
}
- std::string group_name;
- gCacheName->getGroupName(parcel->getGroupID(), group_name);
- getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name );
-
- // Allow list
- if (mListAccess)
- {
- // Clear the sort order so we don't re-sort on every add.
- mListAccess->clearSortOrder();
- mListAccess->deleteAllItems();
- S32 count = parcel->mAccessList.size();
- getChild<LLUICtrl>("AllowedText")->setTextArg("[COUNT]", llformat("%d",count));
- getChild<LLUICtrl>("AllowedText")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST));
-
- getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count));
- getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST));
-
- for (LLAccessEntry::map::const_iterator cit = parcel->mAccessList.begin();
- cit != parcel->mAccessList.end(); ++cit)
- {
- const LLAccessEntry& entry = (*cit).second;
- std::string prefix;
- if (entry.mTime != 0)
- {
- LLStringUtil::format_map_t args;
- S32 now = time(NULL);
- S32 seconds = entry.mTime - now;
- if (seconds < 0) seconds = 0;
- prefix.assign(" (");
- if (seconds >= 120)
- {
- args["[MINUTES]"] = llformat("%d", (seconds/60));
- std::string buf = parent_floater->getString ("Minutes", args);
- prefix.append(buf);
- }
- else if (seconds >= 60)
- {
- prefix.append("1 " + parent_floater->getString("Minute"));
- }
- else
- {
- args["[SECONDS]"] = llformat("%d", seconds);
- std::string buf = parent_floater->getString ("Seconds", args);
- prefix.append(buf);
- }
- prefix.append(" " + parent_floater->getString("Remaining") + ") ");
- }
- mListAccess->addNameItem(entry.mID, ADD_DEFAULT, TRUE, "", prefix);
- }
- mListAccess->sortByName(TRUE);
- }
-
- // Ban List
- if(mListBanned)
- {
- // Clear the sort order so we don't re-sort on every add.
- mListBanned->clearSortOrder();
- mListBanned->deleteAllItems();
- S32 count = parcel->mBanList.size();
- getChild<LLUICtrl>("BanCheck")->setTextArg("[COUNT]", llformat("%d",count));
- getChild<LLUICtrl>("BanCheck")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST));
-
- getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count));
- getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST));
-
- for (LLAccessEntry::map::const_iterator cit = parcel->mBanList.begin();
- cit != parcel->mBanList.end(); ++cit)
- {
- const LLAccessEntry& entry = (*cit).second;
- std::string duration;
- S32 seconds = -1;
- if (entry.mTime != 0)
- {
- LLStringUtil::format_map_t args;
- S32 now = time(NULL);
- seconds = entry.mTime - now;
- if (seconds < 0) seconds = 0;
-
- if (seconds >= 7200)
- {
- args["[HOURS]"] = llformat("%d", (seconds / 3600));
- duration = parent_floater->getString("Hours", args);
- }
- else if (seconds >= 3600)
- {
- duration = "1 " + parent_floater->getString("Hour");
- }
- else if (seconds >= 120)
- {
- args["[MINUTES]"] = llformat("%d", (seconds / 60));
- duration = parent_floater->getString("Minutes", args);
- }
- else if (seconds >= 60)
- {
- duration = "1 " + parent_floater->getString("Minute");
- }
- else
- {
- args["[SECONDS]"] = llformat("%d", seconds);
- duration = parent_floater->getString("Seconds", args);
- }
- }
- else
- {
- duration = parent_floater->getString("Always");
- }
- LLSD item;
- item["id"] = entry.mID;
- LLSD& columns = item["columns"];
- columns[0]["column"] = "name"; // to be populated later
- columns[1]["column"] = "duration";
- columns[1]["value"] = duration;
- columns[1]["alt_value"] = entry.mTime != 0 ? std::to_string(seconds) : "Always";
- mListBanned->addElement(item);
- }
- mListBanned->sortByName(TRUE);
- }
-
- if(parcel->getRegionDenyAnonymousOverride())
- {
- getChild<LLUICtrl>("limit_payment")->setValue(TRUE);
- getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") );
- }
- else
- {
- getChild<LLUICtrl>("limit_payment")->setValue((parcel->getParcelFlag(PF_DENY_ANONYMOUS)));
- getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", std::string() );
- }
- if(parcel->getRegionDenyAgeUnverifiedOverride())
- {
- getChild<LLUICtrl>("limit_age_verified")->setValue(TRUE);
- getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", getString("access_estate_defined") );
- }
- else
- {
- getChild<LLUICtrl>("limit_age_verified")->setValue((parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED)));
- getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", std::string() );
- }
-
- BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST);
- getChild<LLUICtrl>("PassCheck")->setValue(use_pass);
- LLCtrlSelectionInterface* passcombo = childGetSelectionInterface("pass_combo");
- if (passcombo)
- {
- if (public_access || !use_pass)
- {
- passcombo->selectByValue("anyone");
- }
- }
-
- S32 pass_price = parcel->getPassPrice();
- getChild<LLUICtrl>("PriceSpin")->setValue((F32)pass_price );
-
- F32 pass_hours = parcel->getPassHours();
- getChild<LLUICtrl>("HoursSpin")->setValue(pass_hours );
- }
- else
- {
- getChild<LLUICtrl>("public_access")->setValue(FALSE);
- getChild<LLUICtrl>("limit_payment")->setValue(FALSE);
- getChild<LLUICtrl>("limit_age_verified")->setValue(FALSE);
- getChild<LLUICtrl>("GroupCheck")->setValue(FALSE);
- getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", LLStringUtil::null );
- getChild<LLUICtrl>("PassCheck")->setValue(FALSE);
- getChild<LLUICtrl>("PriceSpin")->setValue((F32)PARCEL_PASS_PRICE_DEFAULT);
- getChild<LLUICtrl>("HoursSpin")->setValue(PARCEL_PASS_HOURS_DEFAULT );
- getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0));
- getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0));
- getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0));
- getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0));
- }
+ std::string group_name;
+ gCacheName->getGroupName(parcel->getGroupID(), group_name);
+ getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name );
+
+ // Allow list
+ if (mListAccess)
+ {
+ // Clear the sort order so we don't re-sort on every add.
+ mListAccess->clearSortOrder();
+ mListAccess->deleteAllItems();
+ S32 count = parcel->mAccessList.size();
+ getChild<LLUICtrl>("AllowedText")->setTextArg("[COUNT]", llformat("%d",count));
+ getChild<LLUICtrl>("AllowedText")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST));
+
+ getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count));
+ getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST));
+
+ for (LLAccessEntry::map::const_iterator cit = parcel->mAccessList.begin();
+ cit != parcel->mAccessList.end(); ++cit)
+ {
+ const LLAccessEntry& entry = (*cit).second;
+ std::string prefix;
+ if (entry.mTime != 0)
+ {
+ LLStringUtil::format_map_t args;
+ S32 now = time(NULL);
+ S32 seconds = entry.mTime - now;
+ if (seconds < 0) seconds = 0;
+ prefix.assign(" (");
+ if (seconds >= 120)
+ {
+ args["[MINUTES]"] = llformat("%d", (seconds/60));
+ std::string buf = parent_floater->getString ("Minutes", args);
+ prefix.append(buf);
+ }
+ else if (seconds >= 60)
+ {
+ prefix.append("1 " + parent_floater->getString("Minute"));
+ }
+ else
+ {
+ args["[SECONDS]"] = llformat("%d", seconds);
+ std::string buf = parent_floater->getString ("Seconds", args);
+ prefix.append(buf);
+ }
+ prefix.append(" " + parent_floater->getString("Remaining") + ") ");
+ }
+ mListAccess->addNameItem(entry.mID, ADD_DEFAULT, TRUE, "", prefix);
+ }
+ mListAccess->sortByName(TRUE);
+ }
+
+ // Ban List
+ if(mListBanned)
+ {
+ // Clear the sort order so we don't re-sort on every add.
+ mListBanned->clearSortOrder();
+ mListBanned->deleteAllItems();
+ S32 count = parcel->mBanList.size();
+ getChild<LLUICtrl>("BanCheck")->setTextArg("[COUNT]", llformat("%d",count));
+ getChild<LLUICtrl>("BanCheck")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST));
+
+ getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count));
+ getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST));
+
+ for (LLAccessEntry::map::const_iterator cit = parcel->mBanList.begin();
+ cit != parcel->mBanList.end(); ++cit)
+ {
+ const LLAccessEntry& entry = (*cit).second;
+ std::string duration;
+ S32 seconds = -1;
+ if (entry.mTime != 0)
+ {
+ LLStringUtil::format_map_t args;
+ S32 now = time(NULL);
+ seconds = entry.mTime - now;
+ if (seconds < 0) seconds = 0;
+
+ if (seconds >= 7200)
+ {
+ args["[HOURS]"] = llformat("%d", (seconds / 3600));
+ duration = parent_floater->getString("Hours", args);
+ }
+ else if (seconds >= 3600)
+ {
+ duration = "1 " + parent_floater->getString("Hour");
+ }
+ else if (seconds >= 120)
+ {
+ args["[MINUTES]"] = llformat("%d", (seconds / 60));
+ duration = parent_floater->getString("Minutes", args);
+ }
+ else if (seconds >= 60)
+ {
+ duration = "1 " + parent_floater->getString("Minute");
+ }
+ else
+ {
+ args["[SECONDS]"] = llformat("%d", seconds);
+ duration = parent_floater->getString("Seconds", args);
+ }
+ }
+ else
+ {
+ duration = parent_floater->getString("Always");
+ }
+ LLSD item;
+ item["id"] = entry.mID;
+ LLSD& columns = item["columns"];
+ columns[0]["column"] = "name"; // to be populated later
+ columns[1]["column"] = "duration";
+ columns[1]["value"] = duration;
+ columns[1]["alt_value"] = entry.mTime != 0 ? std::to_string(seconds) : "Always";
+ mListBanned->addElement(item);
+ }
+ mListBanned->sortByName(TRUE);
+ }
+
+ if(parcel->getRegionDenyAnonymousOverride())
+ {
+ getChild<LLUICtrl>("limit_payment")->setValue(TRUE);
+ getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") );
+ }
+ else
+ {
+ getChild<LLUICtrl>("limit_payment")->setValue((parcel->getParcelFlag(PF_DENY_ANONYMOUS)));
+ getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", std::string() );
+ }
+ if(parcel->getRegionDenyAgeUnverifiedOverride())
+ {
+ getChild<LLUICtrl>("limit_age_verified")->setValue(TRUE);
+ getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", getString("access_estate_defined") );
+ }
+ else
+ {
+ getChild<LLUICtrl>("limit_age_verified")->setValue((parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED)));
+ getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", std::string() );
+ }
+
+ BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST);
+ getChild<LLUICtrl>("PassCheck")->setValue(use_pass);
+ LLCtrlSelectionInterface* passcombo = childGetSelectionInterface("pass_combo");
+ if (passcombo)
+ {
+ if (public_access || !use_pass)
+ {
+ passcombo->selectByValue("anyone");
+ }
+ }
+
+ S32 pass_price = parcel->getPassPrice();
+ getChild<LLUICtrl>("PriceSpin")->setValue((F32)pass_price );
+
+ F32 pass_hours = parcel->getPassHours();
+ getChild<LLUICtrl>("HoursSpin")->setValue(pass_hours );
+ }
+ else
+ {
+ getChild<LLUICtrl>("public_access")->setValue(FALSE);
+ getChild<LLUICtrl>("limit_payment")->setValue(FALSE);
+ getChild<LLUICtrl>("limit_age_verified")->setValue(FALSE);
+ getChild<LLUICtrl>("GroupCheck")->setValue(FALSE);
+ getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", LLStringUtil::null );
+ getChild<LLUICtrl>("PassCheck")->setValue(FALSE);
+ getChild<LLUICtrl>("PriceSpin")->setValue((F32)PARCEL_PASS_PRICE_DEFAULT);
+ getChild<LLUICtrl>("HoursSpin")->setValue(PARCEL_PASS_HOURS_DEFAULT );
+ getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0));
+ getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0));
+ getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0));
+ getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0));
+ }
}
void LLPanelLandAccess::refresh_ui()
{
- getChildView("public_access")->setEnabled(FALSE);
- getChildView("limit_payment")->setEnabled(FALSE);
- getChildView("limit_age_verified")->setEnabled(FALSE);
- getChildView("GroupCheck")->setEnabled(FALSE);
- getChildView("PassCheck")->setEnabled(FALSE);
- getChildView("pass_combo")->setEnabled(FALSE);
- getChildView("PriceSpin")->setEnabled(FALSE);
- getChildView("HoursSpin")->setEnabled(FALSE);
- getChildView("AccessList")->setEnabled(FALSE);
- getChildView("BannedList")->setEnabled(FALSE);
- getChildView("add_allowed")->setEnabled(FALSE);
- getChildView("remove_allowed")->setEnabled(FALSE);
- getChildView("add_banned")->setEnabled(FALSE);
- getChildView("remove_banned")->setEnabled(FALSE);
-
- LLParcel *parcel = mParcel->getParcel();
- if (parcel && !gDisconnected)
- {
+ getChildView("public_access")->setEnabled(FALSE);
+ getChildView("limit_payment")->setEnabled(FALSE);
+ getChildView("limit_age_verified")->setEnabled(FALSE);
+ getChildView("GroupCheck")->setEnabled(FALSE);
+ getChildView("PassCheck")->setEnabled(FALSE);
+ getChildView("pass_combo")->setEnabled(FALSE);
+ getChildView("PriceSpin")->setEnabled(FALSE);
+ getChildView("HoursSpin")->setEnabled(FALSE);
+ getChildView("AccessList")->setEnabled(FALSE);
+ getChildView("BannedList")->setEnabled(FALSE);
+ getChildView("add_allowed")->setEnabled(FALSE);
+ getChildView("remove_allowed")->setEnabled(FALSE);
+ getChildView("add_banned")->setEnabled(FALSE);
+ getChildView("remove_banned")->setEnabled(FALSE);
+
+ LLParcel *parcel = mParcel->getParcel();
+ if (parcel && !gDisconnected)
+ {
BOOL can_manage_allowed = false;
- BOOL can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED);
-
+ BOOL can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED);
+
if (parcel->getRegionAllowAccessOverride())
{ // Estate owner may have disabled allowing the parcel owner from managing access.
can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED);
}
- getChildView("public_access")->setEnabled(can_manage_allowed);
- BOOL public_access = getChild<LLUICtrl>("public_access")->getValue().asBoolean();
- if (public_access)
- {
- bool override = false;
- if(parcel->getRegionDenyAnonymousOverride())
- {
- override = true;
- getChildView("limit_payment")->setEnabled(FALSE);
- }
- else
- {
- getChildView("limit_payment")->setEnabled(can_manage_allowed);
- }
- if(parcel->getRegionDenyAgeUnverifiedOverride())
- {
- override = true;
- getChildView("limit_age_verified")->setEnabled(FALSE);
- }
- else
- {
- getChildView("limit_age_verified")->setEnabled(can_manage_allowed);
- }
- if (override)
- {
- getChildView("Only Allow")->setToolTip(getString("estate_override"));
- }
- else
- {
- getChildView("Only Allow")->setToolTip(std::string());
- }
- getChildView("PassCheck")->setEnabled(FALSE);
- getChildView("pass_combo")->setEnabled(FALSE);
- getChildView("AccessList")->setEnabled(FALSE);
- }
- else
- {
- getChildView("limit_payment")->setEnabled(FALSE);
- getChildView("limit_age_verified")->setEnabled(FALSE);
-
-
- BOOL sell_passes = getChild<LLUICtrl>("PassCheck")->getValue().asBoolean();
- getChildView("PassCheck")->setEnabled(can_manage_allowed);
- if (sell_passes)
- {
- getChildView("pass_combo")->setEnabled(can_manage_allowed);
- getChildView("PriceSpin")->setEnabled(can_manage_allowed);
- getChildView("HoursSpin")->setEnabled(can_manage_allowed);
- }
- }
- std::string group_name;
- if (gCacheName->getGroupName(parcel->getGroupID(), group_name))
- {
- bool can_allow_groups = !public_access || (public_access && (getChild<LLUICtrl>("limit_payment")->getValue().asBoolean() ^ getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean()));
- getChildView("GroupCheck")->setEnabled(can_manage_allowed && can_allow_groups);
- }
- getChildView("AccessList")->setEnabled(can_manage_allowed);
- S32 allowed_list_count = parcel->mAccessList.size();
- getChildView("add_allowed")->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST);
- BOOL has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0);
- getChildView("remove_allowed")->setEnabled(can_manage_allowed && has_selected);
-
- getChildView("BannedList")->setEnabled(can_manage_banned);
- S32 banned_list_count = parcel->mBanList.size();
- getChildView("add_banned")->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST);
- has_selected = (mListBanned && mListBanned->getSelectionInterface()->getFirstSelectedIndex() >= 0);
- getChildView("remove_banned")->setEnabled(can_manage_banned && has_selected);
- }
-}
-
+ getChildView("public_access")->setEnabled(can_manage_allowed);
+ BOOL public_access = getChild<LLUICtrl>("public_access")->getValue().asBoolean();
+ if (public_access)
+ {
+ bool override = false;
+ if(parcel->getRegionDenyAnonymousOverride())
+ {
+ override = true;
+ getChildView("limit_payment")->setEnabled(FALSE);
+ }
+ else
+ {
+ getChildView("limit_payment")->setEnabled(can_manage_allowed);
+ }
+ if(parcel->getRegionDenyAgeUnverifiedOverride())
+ {
+ override = true;
+ getChildView("limit_age_verified")->setEnabled(FALSE);
+ }
+ else
+ {
+ getChildView("limit_age_verified")->setEnabled(can_manage_allowed);
+ }
+ if (override)
+ {
+ getChildView("Only Allow")->setToolTip(getString("estate_override"));
+ }
+ else
+ {
+ getChildView("Only Allow")->setToolTip(std::string());
+ }
+ getChildView("PassCheck")->setEnabled(FALSE);
+ getChildView("pass_combo")->setEnabled(FALSE);
+ getChildView("AccessList")->setEnabled(FALSE);
+ }
+ else
+ {
+ getChildView("limit_payment")->setEnabled(FALSE);
+ getChildView("limit_age_verified")->setEnabled(FALSE);
+
+
+ BOOL sell_passes = getChild<LLUICtrl>("PassCheck")->getValue().asBoolean();
+ getChildView("PassCheck")->setEnabled(can_manage_allowed);
+ if (sell_passes)
+ {
+ getChildView("pass_combo")->setEnabled(can_manage_allowed);
+ getChildView("PriceSpin")->setEnabled(can_manage_allowed);
+ getChildView("HoursSpin")->setEnabled(can_manage_allowed);
+ }
+ }
+ std::string group_name;
+ if (gCacheName->getGroupName(parcel->getGroupID(), group_name))
+ {
+ bool can_allow_groups = !public_access || (public_access && (getChild<LLUICtrl>("limit_payment")->getValue().asBoolean() ^ getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean()));
+ getChildView("GroupCheck")->setEnabled(can_manage_allowed && can_allow_groups);
+ }
+ getChildView("AccessList")->setEnabled(can_manage_allowed);
+ S32 allowed_list_count = parcel->mAccessList.size();
+ getChildView("add_allowed")->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST);
+ BOOL has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0);
+ getChildView("remove_allowed")->setEnabled(can_manage_allowed && has_selected);
+
+ getChildView("BannedList")->setEnabled(can_manage_banned);
+ S32 banned_list_count = parcel->mBanList.size();
+ getChildView("add_banned")->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST);
+ has_selected = (mListBanned && mListBanned->getSelectionInterface()->getFirstSelectedIndex() >= 0);
+ getChildView("remove_banned")->setEnabled(can_manage_banned && has_selected);
+ }
+}
+
// public
void LLPanelLandAccess::refreshNames()
{
- LLParcel* parcel = mParcel->getParcel();
- std::string group_name;
- if(parcel)
- {
- gCacheName->getGroupName(parcel->getGroupID(), group_name);
- }
- getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name);
+ LLParcel* parcel = mParcel->getParcel();
+ std::string group_name;
+ if(parcel)
+ {
+ gCacheName->getGroupName(parcel->getGroupID(), group_name);
+ }
+ getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name);
}
// virtual
void LLPanelLandAccess::draw()
{
- refresh_ui();
- refreshNames();
- LLPanel::draw();
+ refresh_ui();
+ refreshNames();
+ LLPanel::draw();
}
// static
void LLPanelLandAccess::onCommitPublicAccess(LLUICtrl *ctrl, void *userdata)
{
- LLPanelLandAccess *self = (LLPanelLandAccess *)userdata;
- LLParcel* parcel = self->mParcel->getParcel();
- if (!parcel)
- {
- return;
- }
+ LLPanelLandAccess *self = (LLPanelLandAccess *)userdata;
+ LLParcel* parcel = self->mParcel->getParcel();
+ if (!parcel)
+ {
+ return;
+ }
- onCommitAny(ctrl, userdata);
+ onCommitAny(ctrl, userdata);
}
void LLPanelLandAccess::onCommitGroupCheck(LLUICtrl *ctrl, void *userdata)
{
- LLPanelLandAccess *self = (LLPanelLandAccess *)userdata;
- LLParcel* parcel = self->mParcel->getParcel();
- if (!parcel)
- {
- return;
- }
-
- BOOL use_pass_list = !self->getChild<LLUICtrl>("public_access")->getValue().asBoolean();
- BOOL use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean();
- LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo");
- if (passcombo)
- {
- if (use_access_group && use_pass_list)
- {
- if (passcombo->getSelectedValue().asString() == "group")
- {
- passcombo->selectByValue("anyone");
- }
- }
- }
-
- onCommitAny(ctrl, userdata);
+ LLPanelLandAccess *self = (LLPanelLandAccess *)userdata;
+ LLParcel* parcel = self->mParcel->getParcel();
+ if (!parcel)
+ {
+ return;
+ }
+
+ BOOL use_pass_list = !self->getChild<LLUICtrl>("public_access")->getValue().asBoolean();
+ BOOL use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean();
+ LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo");
+ if (passcombo)
+ {
+ if (use_access_group && use_pass_list)
+ {
+ if (passcombo->getSelectedValue().asString() == "group")
+ {
+ passcombo->selectByValue("anyone");
+ }
+ }
+ }
+
+ onCommitAny(ctrl, userdata);
}
// static
void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata)
{
- LLPanelLandAccess *self = (LLPanelLandAccess *)userdata;
-
- LLParcel* parcel = self->mParcel->getParcel();
- if (!parcel)
- {
- return;
- }
-
- // Extract data from UI
- BOOL public_access = self->getChild<LLUICtrl>("public_access")->getValue().asBoolean();
- BOOL use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean();
- if (use_access_group)
- {
- std::string group_name;
- if (!gCacheName->getGroupName(parcel->getGroupID(), group_name))
- {
- use_access_group = FALSE;
- }
- }
-
- BOOL limit_payment = FALSE, limit_age_verified = FALSE;
- BOOL use_access_list = FALSE;
- BOOL use_pass_list = FALSE;
-
- if (public_access)
- {
- use_access_list = FALSE;
- limit_payment = self->getChild<LLUICtrl>("limit_payment")->getValue().asBoolean();
- limit_age_verified = self->getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean();
- }
- else
- {
- use_access_list = TRUE;
- use_pass_list = self->getChild<LLUICtrl>("PassCheck")->getValue().asBoolean();
- LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo");
- if (passcombo)
- {
- if (use_access_group && use_pass_list)
- {
- if (passcombo->getSelectedValue().asString() == "group")
- {
- use_access_group = FALSE;
- }
- }
- }
- }
-
- S32 pass_price = llfloor((F32)self->getChild<LLUICtrl>("PriceSpin")->getValue().asReal());
- F32 pass_hours = (F32)self->getChild<LLUICtrl>("HoursSpin")->getValue().asReal();
-
- // Push data into current parcel
- parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group);
- parcel->setParcelFlag(PF_USE_ACCESS_LIST, use_access_list);
- parcel->setParcelFlag(PF_USE_PASS_LIST, use_pass_list);
- parcel->setParcelFlag(PF_USE_BAN_LIST, TRUE);
- parcel->setParcelFlag(PF_DENY_ANONYMOUS, limit_payment);
- parcel->setParcelFlag(PF_DENY_AGEUNVERIFIED, limit_age_verified);
-
- parcel->setPassPrice( pass_price );
- parcel->setPassHours( pass_hours );
-
- // Send current parcel data upstream to server
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
-
- // Might have changed properties, so let's redraw!
- self->refresh();
+ LLPanelLandAccess *self = (LLPanelLandAccess *)userdata;
+
+ LLParcel* parcel = self->mParcel->getParcel();
+ if (!parcel)
+ {
+ return;
+ }
+
+ // Extract data from UI
+ BOOL public_access = self->getChild<LLUICtrl>("public_access")->getValue().asBoolean();
+ BOOL use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean();
+ if (use_access_group)
+ {
+ std::string group_name;
+ if (!gCacheName->getGroupName(parcel->getGroupID(), group_name))
+ {
+ use_access_group = FALSE;
+ }
+ }
+
+ BOOL limit_payment = FALSE, limit_age_verified = FALSE;
+ BOOL use_access_list = FALSE;
+ BOOL use_pass_list = FALSE;
+
+ if (public_access)
+ {
+ use_access_list = FALSE;
+ limit_payment = self->getChild<LLUICtrl>("limit_payment")->getValue().asBoolean();
+ limit_age_verified = self->getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean();
+ }
+ else
+ {
+ use_access_list = TRUE;
+ use_pass_list = self->getChild<LLUICtrl>("PassCheck")->getValue().asBoolean();
+ LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo");
+ if (passcombo)
+ {
+ if (use_access_group && use_pass_list)
+ {
+ if (passcombo->getSelectedValue().asString() == "group")
+ {
+ use_access_group = FALSE;
+ }
+ }
+ }
+ }
+
+ S32 pass_price = llfloor((F32)self->getChild<LLUICtrl>("PriceSpin")->getValue().asReal());
+ F32 pass_hours = (F32)self->getChild<LLUICtrl>("HoursSpin")->getValue().asReal();
+
+ // Push data into current parcel
+ parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group);
+ parcel->setParcelFlag(PF_USE_ACCESS_LIST, use_access_list);
+ parcel->setParcelFlag(PF_USE_PASS_LIST, use_pass_list);
+ parcel->setParcelFlag(PF_USE_BAN_LIST, TRUE);
+ parcel->setParcelFlag(PF_DENY_ANONYMOUS, limit_payment);
+ parcel->setParcelFlag(PF_DENY_AGEUNVERIFIED, limit_age_verified);
+
+ parcel->setPassPrice( pass_price );
+ parcel->setPassHours( pass_hours );
+
+ // Send current parcel data upstream to server
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+
+ // Might have changed properties, so let's redraw!
+ self->refresh();
}
void LLPanelLandAccess::onClickAddAccess()
{
LLView * button = findChild<LLButton>("add_allowed");
LLFloater * root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
- boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button);
- if (picker)
- {
- root_floater->addDependentFloater(picker);
- }
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+ boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button);
+ if (picker)
+ {
+ root_floater->addDependentFloater(picker);
+ }
}
void LLPanelLandAccess::callbackAvatarCBAccess(const uuid_vec_t& ids)
{
- if (!ids.empty())
- {
- LLUUID id = ids[0];
- LLParcel* parcel = mParcel->getParcel();
- if (parcel && parcel->addToAccessList(id, 0))
- {
- U32 lists_to_update = AL_ACCESS;
- // agent was successfully added to access list
- // but we also need to check ban list to ensure that agent will not be in two lists simultaneously
- if(parcel->removeFromBanList(id))
- {
- lists_to_update |= AL_BAN;
- }
- LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
- refresh();
- }
- }
+ if (!ids.empty())
+ {
+ LLUUID id = ids[0];
+ LLParcel* parcel = mParcel->getParcel();
+ if (parcel && parcel->addToAccessList(id, 0))
+ {
+ U32 lists_to_update = AL_ACCESS;
+ // agent was successfully added to access list
+ // but we also need to check ban list to ensure that agent will not be in two lists simultaneously
+ if(parcel->removeFromBanList(id))
+ {
+ lists_to_update |= AL_BAN;
+ }
+ LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
+ refresh();
+ }
+ }
}
// static
void LLPanelLandAccess::onClickRemoveAccess(void* data)
{
- LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
- if (panelp && panelp->mListAccess)
- {
- LLParcel* parcel = panelp->mParcel->getParcel();
- if (parcel)
- {
- std::vector<LLScrollListItem*> names = panelp->mListAccess->getAllSelected();
- for (std::vector<LLScrollListItem*>::iterator iter = names.begin();
- iter != names.end(); )
- {
- LLScrollListItem* item = *iter++;
- const LLUUID& agent_id = item->getUUID();
- parcel->removeFromAccessList(agent_id);
- }
- LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS);
- panelp->refresh();
- }
- }
+ LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
+ if (panelp && panelp->mListAccess)
+ {
+ LLParcel* parcel = panelp->mParcel->getParcel();
+ if (parcel)
+ {
+ std::vector<LLScrollListItem*> names = panelp->mListAccess->getAllSelected();
+ for (std::vector<LLScrollListItem*>::iterator iter = names.begin();
+ iter != names.end(); )
+ {
+ LLScrollListItem* item = *iter++;
+ const LLUUID& agent_id = item->getUUID();
+ parcel->removeFromAccessList(agent_id);
+ }
+ LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS);
+ panelp->refresh();
+ }
+ }
}
// static
@@ -2966,84 +2966,84 @@ void LLPanelLandAccess::onClickAddBanned()
{
LLView * button = findChild<LLButton>("add_banned");
LLFloater * root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
- boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), TRUE, FALSE, FALSE, root_floater->getName(), button);
- if (picker)
- {
- root_floater->addDependentFloater(picker);
- }
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+ boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), TRUE, FALSE, FALSE, root_floater->getName(), button);
+ if (picker)
+ {
+ root_floater->addDependentFloater(picker);
+ }
}
// static
void LLPanelLandAccess::callbackAvatarCBBanned(const uuid_vec_t& ids)
{
- LLFloater * root_floater = gFloaterView->getParentFloater(this);
- LLFloaterBanDuration* duration_floater = LLFloaterBanDuration::show(
- boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned2, this, _1, _2), ids);
- if (duration_floater)
- {
- root_floater->addDependentFloater(duration_floater);
- }
+ LLFloater * root_floater = gFloaterView->getParentFloater(this);
+ LLFloaterBanDuration* duration_floater = LLFloaterBanDuration::show(
+ boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned2, this, _1, _2), ids);
+ if (duration_floater)
+ {
+ root_floater->addDependentFloater(duration_floater);
+ }
}
void LLPanelLandAccess::callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration)
{
- LLParcel* parcel = mParcel->getParcel();
- if (!parcel) return;
-
- U32 lists_to_update = 0;
-
- for (uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); it++)
- {
- LLUUID id = *it;
- if (parcel->addToBanList(id, duration))
- {
- lists_to_update |= AL_BAN;
- // agent was successfully added to ban list
- // but we also need to check access list to ensure that agent will not be in two lists simultaneously
- if (parcel->removeFromAccessList(id))
- {
- lists_to_update |= AL_ACCESS;
- }
- }
- }
- if (lists_to_update > 0)
- {
- LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
- refresh();
- }
+ LLParcel* parcel = mParcel->getParcel();
+ if (!parcel) return;
+
+ U32 lists_to_update = 0;
+
+ for (uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); it++)
+ {
+ LLUUID id = *it;
+ if (parcel->addToBanList(id, duration))
+ {
+ lists_to_update |= AL_BAN;
+ // agent was successfully added to ban list
+ // but we also need to check access list to ensure that agent will not be in two lists simultaneously
+ if (parcel->removeFromAccessList(id))
+ {
+ lists_to_update |= AL_ACCESS;
+ }
+ }
+ }
+ if (lists_to_update > 0)
+ {
+ LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
+ refresh();
+ }
}
// static
void LLPanelLandAccess::onClickRemoveBanned(void* data)
{
- LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
- if (panelp && panelp->mListBanned)
- {
- LLParcel* parcel = panelp->mParcel->getParcel();
- if (parcel)
- {
- std::vector<LLScrollListItem*> names = panelp->mListBanned->getAllSelected();
- for (std::vector<LLScrollListItem*>::iterator iter = names.begin();
- iter != names.end(); )
- {
- LLScrollListItem* item = *iter++;
- const LLUUID& agent_id = item->getUUID();
- parcel->removeFromBanList(agent_id);
- }
- LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN);
- panelp->refresh();
- }
- }
+ LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
+ if (panelp && panelp->mListBanned)
+ {
+ LLParcel* parcel = panelp->mParcel->getParcel();
+ if (parcel)
+ {
+ std::vector<LLScrollListItem*> names = panelp->mListBanned->getAllSelected();
+ for (std::vector<LLScrollListItem*>::iterator iter = names.begin();
+ iter != names.end(); )
+ {
+ LLScrollListItem* item = *iter++;
+ const LLUUID& agent_id = item->getUUID();
+ parcel->removeFromBanList(agent_id);
+ }
+ LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN);
+ panelp->refresh();
+ }
+ }
}
//---------------------------------------------------------------------------
// LLPanelLandCovenant
//---------------------------------------------------------------------------
LLPanelLandCovenant::LLPanelLandCovenant(LLParcelSelectionHandle& parcel)
- : LLPanel(),
- mParcel(parcel),
- mNextUpdateTime(0)
+ : LLPanel(),
+ mParcel(parcel),
+ mNextUpdateTime(0)
{
}
@@ -3053,172 +3053,172 @@ LLPanelLandCovenant::~LLPanelLandCovenant()
BOOL LLPanelLandCovenant::postBuild()
{
- mLastRegionID = LLUUID::null;
- mNextUpdateTime = 0;
+ mLastRegionID = LLUUID::null;
+ mNextUpdateTime = 0;
mTextEstateOwner = getChild<LLTextBox>("estate_owner_text");
mTextEstateOwner->setIsFriendCallback(LLAvatarActions::isFriend);
- return TRUE;
+ return TRUE;
}
// virtual
void LLPanelLandCovenant::refresh()
{
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if(!region || gDisconnected) return;
-
- LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
- if (region_name)
- {
- region_name->setText(region->getName());
- }
-
- LLTextBox* region_landtype = getChild<LLTextBox>("region_landtype_text");
- region_landtype->setText(region->getLocalizedSimProductName());
-
- LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text");
- if (region_maturity)
- {
- insert_maturity_into_textbox(region_maturity, gFloaterView->getParentFloater(this), MATURITY);
- }
-
- LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
- if (resellable_clause)
- {
- if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
- {
- resellable_clause->setText(getString("can_not_resell"));
- }
- else
- {
- resellable_clause->setText(getString("can_resell"));
- }
- }
-
- LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
- if (changeable_clause)
- {
- if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
- {
- changeable_clause->setText(getString("can_change"));
- }
- else
- {
- changeable_clause->setText(getString("can_not_change"));
- }
- }
-
- if (mLastRegionID != region->getRegionID()
- || mNextUpdateTime < LLTimer::getElapsedSeconds())
- {
- // Request Covenant Info
- // Note: LLPanelLandCovenant doesn't change Covenant's content and any
- // changes made by Estate floater should be requested by Estate floater
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessage("EstateCovenantRequest");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->sendReliable(region->getHost());
-
- mLastRegionID = region->getRegionID();
- mNextUpdateTime = LLTimer::getElapsedSeconds() + COVENANT_REFRESH_TIME_SEC;
- }
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if(!region || gDisconnected) return;
+
+ LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
+ if (region_name)
+ {
+ region_name->setText(region->getName());
+ }
+
+ LLTextBox* region_landtype = getChild<LLTextBox>("region_landtype_text");
+ region_landtype->setText(region->getLocalizedSimProductName());
+
+ LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text");
+ if (region_maturity)
+ {
+ insert_maturity_into_textbox(region_maturity, gFloaterView->getParentFloater(this), MATURITY);
+ }
+
+ LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
+ if (resellable_clause)
+ {
+ if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
+ {
+ resellable_clause->setText(getString("can_not_resell"));
+ }
+ else
+ {
+ resellable_clause->setText(getString("can_resell"));
+ }
+ }
+
+ LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
+ if (changeable_clause)
+ {
+ if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
+ {
+ changeable_clause->setText(getString("can_change"));
+ }
+ else
+ {
+ changeable_clause->setText(getString("can_not_change"));
+ }
+ }
+
+ if (mLastRegionID != region->getRegionID()
+ || mNextUpdateTime < LLTimer::getElapsedSeconds())
+ {
+ // Request Covenant Info
+ // Note: LLPanelLandCovenant doesn't change Covenant's content and any
+ // changes made by Estate floater should be requested by Estate floater
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessage("EstateCovenantRequest");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->sendReliable(region->getHost());
+
+ mLastRegionID = region->getRegionID();
+ mNextUpdateTime = LLTimer::getElapsedSeconds() + COVENANT_REFRESH_TIME_SEC;
+ }
}
// static
void LLPanelLandCovenant::updateCovenantText(const std::string &string)
{
- LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
- if (self)
- {
- LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("covenant_editor");
- editor->setText(string);
- }
+ LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
+ if (self)
+ {
+ LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("covenant_editor");
+ editor->setText(string);
+ }
}
// static
void LLPanelLandCovenant::updateEstateName(const std::string& name)
{
- LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
- if (self)
- {
- LLTextBox* editor = self->getChild<LLTextBox>("estate_name_text");
- if (editor) editor->setText(name);
- }
+ LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
+ if (self)
+ {
+ LLTextBox* editor = self->getChild<LLTextBox>("estate_name_text");
+ if (editor) editor->setText(name);
+ }
}
// static
void LLPanelLandCovenant::updateLastModified(const std::string& text)
{
- LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
- if (self)
- {
- LLTextBox* editor = self->getChild<LLTextBox>("covenant_timestamp_text");
- if (editor) editor->setText(text);
- }
+ LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
+ if (self)
+ {
+ LLTextBox* editor = self->getChild<LLTextBox>("covenant_timestamp_text");
+ if (editor) editor->setText(text);
+ }
}
// static
void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name)
{
- LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
- if (self)
- {
- self->mTextEstateOwner->setText(name);
- }
+ LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
+ if (self)
+ {
+ self->mTextEstateOwner->setText(name);
+ }
}
-// inserts maturity info(icon and text) into target textbox
+// inserts maturity info(icon and text) into target textbox
// names_floater - pointer to floater which contains strings with maturity icons filenames
// str_to_parse is string in format "txt1[MATURITY]txt2" where maturity icon and text will be inserted instead of [MATURITY]
void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_floater, std::string str_to_parse)
{
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (!region)
- return;
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (!region)
+ return;
- LLStyle::Params style;
+ LLStyle::Params style;
- U8 sim_access = region->getSimAccess();
+ U8 sim_access = region->getSimAccess();
- switch(sim_access)
- {
- case SIM_ACCESS_PG:
- style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_general")));
- break;
+ switch(sim_access)
+ {
+ case SIM_ACCESS_PG:
+ style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_general")));
+ break;
- case SIM_ACCESS_ADULT:
- style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_adult")));
- break;
+ case SIM_ACCESS_ADULT:
+ style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_adult")));
+ break;
- case SIM_ACCESS_MATURE:
- style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_moderate")));
- break;
+ case SIM_ACCESS_MATURE:
+ style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_moderate")));
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- size_t maturity_pos = str_to_parse.find(MATURITY);
-
- if (maturity_pos == std::string::npos)
- {
- return;
- }
+ size_t maturity_pos = str_to_parse.find(MATURITY);
+
+ if (maturity_pos == std::string::npos)
+ {
+ return;
+ }
- std::string text_before_rating = str_to_parse.substr(0, maturity_pos);
- std::string text_after_rating = str_to_parse.substr(maturity_pos + MATURITY.length());
+ std::string text_before_rating = str_to_parse.substr(0, maturity_pos);
+ std::string text_after_rating = str_to_parse.substr(maturity_pos + MATURITY.length());
- target_textbox->setText(text_before_rating);
+ target_textbox->setText(text_before_rating);
- target_textbox->appendImageSegment(style);
+ target_textbox->appendImageSegment(style);
- target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false);
- target_textbox->appendText(text_after_rating, false);
+ target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false);
+ target_textbox->appendText(text_after_rating, false);
}
-LLPanelLandExperiences::LLPanelLandExperiences( LLSafeHandle<LLParcelSelection>& parcelp )
- : mParcel(parcelp)
+LLPanelLandExperiences::LLPanelLandExperiences( LLSafeHandle<LLParcelSelection>& parcelp )
+ : mParcel(parcelp)
{
}
@@ -3226,95 +3226,95 @@ LLPanelLandExperiences::LLPanelLandExperiences( LLSafeHandle<LLParcelSelection>&
BOOL LLPanelLandExperiences::postBuild()
{
- mAllowed = setupList("panel_allowed", EXPERIENCE_KEY_TYPE_ALLOWED, AL_ALLOW_EXPERIENCE);
- mBlocked = setupList("panel_blocked", EXPERIENCE_KEY_TYPE_BLOCKED, AL_BLOCK_EXPERIENCE);
+ mAllowed = setupList("panel_allowed", EXPERIENCE_KEY_TYPE_ALLOWED, AL_ALLOW_EXPERIENCE);
+ mBlocked = setupList("panel_blocked", EXPERIENCE_KEY_TYPE_BLOCKED, AL_BLOCK_EXPERIENCE);
+
+ // only non-grid-wide experiences
+ mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_GRID));
- // only non-grid-wide experiences
- mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_GRID));
+ // no privileged ones
+ mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithoutProperties, _1, LLExperienceCache::PROPERTY_PRIVILEGED|LLExperienceCache::PROPERTY_GRID));
- // no privileged ones
- mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithoutProperties, _1, LLExperienceCache::PROPERTY_PRIVILEGED|LLExperienceCache::PROPERTY_GRID));
+ getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(FALSE);
+ getChild<LLTextBox>("experiences_help_text")->setVisible(FALSE);
+ getChild<LLTextBox>("allowed_text_help")->setText(getString("allowed_parcel_text"));
+ getChild<LLTextBox>("blocked_text_help")->setText(getString("blocked_parcel_text"));
- getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(FALSE);
- getChild<LLTextBox>("experiences_help_text")->setVisible(FALSE);
- getChild<LLTextBox>("allowed_text_help")->setText(getString("allowed_parcel_text"));
- getChild<LLTextBox>("blocked_text_help")->setText(getString("blocked_parcel_text"));
-
- return LLPanel::postBuild();
+ return LLPanel::postBuild();
}
LLPanelExperienceListEditor* LLPanelLandExperiences::setupList( const char* control_name, U32 xp_type, U32 access_type )
{
- LLPanelExperienceListEditor* child = findChild<LLPanelExperienceListEditor>(control_name);
- if(child)
- {
- child->getChild<LLTextBox>("text_name")->setText(child->getString(control_name));
- child->setMaxExperienceIDs(PARCEL_MAX_EXPERIENCE_LIST);
- child->setAddedCallback(boost::bind(&LLPanelLandExperiences::experienceAdded, this, _1, xp_type, access_type));
- child->setRemovedCallback(boost::bind(&LLPanelLandExperiences::experienceRemoved, this, _1, access_type));
- }
+ LLPanelExperienceListEditor* child = findChild<LLPanelExperienceListEditor>(control_name);
+ if(child)
+ {
+ child->getChild<LLTextBox>("text_name")->setText(child->getString(control_name));
+ child->setMaxExperienceIDs(PARCEL_MAX_EXPERIENCE_LIST);
+ child->setAddedCallback(boost::bind(&LLPanelLandExperiences::experienceAdded, this, _1, xp_type, access_type));
+ child->setRemovedCallback(boost::bind(&LLPanelLandExperiences::experienceRemoved, this, _1, access_type));
+ }
- return child;
+ return child;
}
void LLPanelLandExperiences::experienceAdded( const LLUUID& id, U32 xp_type, U32 access_type )
{
- LLParcel* parcel = mParcel->getParcel();
- if (parcel)
- {
- parcel->setExperienceKeyType(id, xp_type);
- LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(access_type);
- refresh();
- }
+ LLParcel* parcel = mParcel->getParcel();
+ if (parcel)
+ {
+ parcel->setExperienceKeyType(id, xp_type);
+ LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(access_type);
+ refresh();
+ }
}
void LLPanelLandExperiences::experienceRemoved( const LLUUID& id, U32 access_type )
{
- LLParcel* parcel = mParcel->getParcel();
- if (parcel)
- {
- parcel->setExperienceKeyType(id, EXPERIENCE_KEY_TYPE_NONE);
- LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(access_type);
- refresh();
- }
+ LLParcel* parcel = mParcel->getParcel();
+ if (parcel)
+ {
+ parcel->setExperienceKeyType(id, EXPERIENCE_KEY_TYPE_NONE);
+ LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(access_type);
+ refresh();
+ }
}
void LLPanelLandExperiences::refreshPanel(LLPanelExperienceListEditor* panel, U32 xp_type)
{
- LLParcel *parcel = mParcel->getParcel();
-
- // Display options
- if (panel == NULL)
- {
- return;
- }
- if (!parcel || gDisconnected)
- {
- // disable the panel
- panel->setEnabled(FALSE);
- panel->setExperienceIds(LLSD::emptyArray());
- }
- else
- {
- // enable the panel
- panel->setEnabled(TRUE);
- LLAccessEntry::map entries = parcel->getExperienceKeysByType(xp_type);
- LLAccessEntry::map::iterator it = entries.begin();
- LLSD ids = LLSD::emptyArray();
- for (/**/; it != entries.end(); ++it)
- {
- ids.append(it->second.mID);
- }
- panel->setExperienceIds(ids);
- panel->setReadonly(!LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS));
- panel->refreshExperienceCounter();
- }
+ LLParcel *parcel = mParcel->getParcel();
+
+ // Display options
+ if (panel == NULL)
+ {
+ return;
+ }
+ if (!parcel || gDisconnected)
+ {
+ // disable the panel
+ panel->setEnabled(FALSE);
+ panel->setExperienceIds(LLSD::emptyArray());
+ }
+ else
+ {
+ // enable the panel
+ panel->setEnabled(TRUE);
+ LLAccessEntry::map entries = parcel->getExperienceKeysByType(xp_type);
+ LLAccessEntry::map::iterator it = entries.begin();
+ LLSD ids = LLSD::emptyArray();
+ for (/**/; it != entries.end(); ++it)
+ {
+ ids.append(it->second.mID);
+ }
+ panel->setExperienceIds(ids);
+ panel->setReadonly(!LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS));
+ panel->refreshExperienceCounter();
+ }
}
void LLPanelLandExperiences::refresh()
{
- refreshPanel(mAllowed, EXPERIENCE_KEY_TYPE_ALLOWED);
- refreshPanel(mBlocked, EXPERIENCE_KEY_TYPE_BLOCKED);
+ refreshPanel(mAllowed, EXPERIENCE_KEY_TYPE_ALLOWED);
+ refreshPanel(mBlocked, EXPERIENCE_KEY_TYPE_BLOCKED);
}
//=========================================================================
@@ -3408,12 +3408,12 @@ void LLPanelLandEnvironment::refreshFromSource()
mLastParcelId = parcel->getLocalID();
LLEnvironment::instance().requestParcel(parcel->getLocalID(),
- [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo)
- {
+ [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo)
+ {
LLPanelLandEnvironment *that = (LLPanelLandEnvironment*)that_h.get();
if (!that) return;
- that->mLastParcelId = parcel_id;
- that->onEnvironmentReceived(parcel_id, envifo);
+ that->mLastParcelId = parcel_id;
+ that->onEnvironmentReceived(parcel_id, envifo);
});
}
else
@@ -3449,7 +3449,7 @@ bool LLPanelLandEnvironment::canEdit()
return LLEnvironment::instance().canAgentUpdateParcelEnvironment(parcel) && mAllowOverride;
}
-S32 LLPanelLandEnvironment::getParcelId()
+S32 LLPanelLandEnvironment::getParcelId()
{
LLParcel *parcel = getParcel();
if (!parcel)
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index 684950d88b..d024de199f 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterland.h
* @author James Cook
* @brief "About Land" floater, allowing display and editing of land parcel properties.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,12 +32,12 @@
#include <vector>
#include "llfloater.h"
-#include "llpointer.h" // LLPointer<>
+#include "llpointer.h" // LLPointer<>
//#include "llviewertexturelist.h"
#include "llsafehandle.h"
typedef std::set<LLUUID, lluuid_less> uuid_list_t;
-const F32 CACHE_REFRESH_TIME = 2.5f;
+const F32 CACHE_REFRESH_TIME = 2.5f;
class LLButton;
class LLCheckBoxCtrl;
@@ -70,349 +70,349 @@ class LLPanelLandExperiences;
class LLPanelLandEnvironment;
class LLFloaterLand
-: public LLFloater
+: public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- static void refreshAll();
+ static void refreshAll();
- static LLPanelLandObjects* getCurrentPanelLandObjects();
- static LLPanelLandCovenant* getCurrentPanelLandCovenant();
-
- LLParcel* getCurrentSelectedParcel();
-
- virtual void onOpen(const LLSD& key);
- virtual BOOL postBuild();
+ static LLPanelLandObjects* getCurrentPanelLandObjects();
+ static LLPanelLandCovenant* getCurrentPanelLandCovenant();
+
+ LLParcel* getCurrentSelectedParcel();
+
+ virtual void onOpen(const LLSD& key);
+ virtual BOOL postBuild();
private:
- // Does its own instance management, so clients not allowed
- // to allocate or destroy.
- LLFloaterLand(const LLSD& seed);
- virtual ~LLFloaterLand();
-
- void onVisibilityChanged(const LLSD& visible);
+ // Does its own instance management, so clients not allowed
+ // to allocate or destroy.
+ LLFloaterLand(const LLSD& seed);
+ virtual ~LLFloaterLand();
+
+ void onVisibilityChanged(const LLSD& visible);
protected:
- /*virtual*/ void refresh();
+ /*virtual*/ void refresh();
- static void* createPanelLandGeneral(void* data);
- static void* createPanelLandCovenant(void* data);
- static void* createPanelLandObjects(void* data);
- static void* createPanelLandOptions(void* data);
- static void* createPanelLandAudio(void* data);
- static void* createPanelLandMedia(void* data);
- static void* createPanelLandAccess(void* data);
- static void* createPanelLandExperiences(void* data);
+ static void* createPanelLandGeneral(void* data);
+ static void* createPanelLandCovenant(void* data);
+ static void* createPanelLandObjects(void* data);
+ static void* createPanelLandOptions(void* data);
+ static void* createPanelLandAudio(void* data);
+ static void* createPanelLandMedia(void* data);
+ static void* createPanelLandAccess(void* data);
+ static void* createPanelLandExperiences(void* data);
static void* createPanelLandEnvironment(void* data);
- static void* createPanelLandBan(void* data);
+ static void* createPanelLandBan(void* data);
protected:
- static LLParcelSelectionObserver* sObserver;
- static S32 sLastTab;
-
- LLTabContainer* mTabLand;
- LLPanelLandGeneral* mPanelGeneral;
- LLPanelLandObjects* mPanelObjects;
- LLPanelLandOptions* mPanelOptions;
- LLPanelLandAudio* mPanelAudio;
- LLPanelLandMedia* mPanelMedia;
- LLPanelLandAccess* mPanelAccess;
- LLPanelLandCovenant* mPanelCovenant;
- LLPanelLandExperiences* mPanelExperiences;
+ static LLParcelSelectionObserver* sObserver;
+ static S32 sLastTab;
+
+ LLTabContainer* mTabLand;
+ LLPanelLandGeneral* mPanelGeneral;
+ LLPanelLandObjects* mPanelObjects;
+ LLPanelLandOptions* mPanelOptions;
+ LLPanelLandAudio* mPanelAudio;
+ LLPanelLandMedia* mPanelMedia;
+ LLPanelLandAccess* mPanelAccess;
+ LLPanelLandCovenant* mPanelCovenant;
+ LLPanelLandExperiences* mPanelExperiences;
LLPanelLandEnvironment *mPanelEnvironment;
- LLSafeHandle<LLParcelSelection> mParcel;
+ LLSafeHandle<LLParcelSelection> mParcel;
public:
- // When closing the dialog, we want to deselect the land. But when
- // we send an update to the simulator, it usually replies with the
- // parcel information, causing the land to be reselected. This allows
- // us to suppress that behavior.
- static BOOL sRequestReplyOnUpdate;
+ // When closing the dialog, we want to deselect the land. But when
+ // we send an update to the simulator, it usually replies with the
+ // parcel information, causing the land to be reselected. This allows
+ // us to suppress that behavior.
+ static BOOL sRequestReplyOnUpdate;
};
class LLPanelLandGeneral
-: public LLPanel
+: public LLPanel
{
public:
- LLPanelLandGeneral(LLSafeHandle<LLParcelSelection>& parcelp);
- virtual ~LLPanelLandGeneral();
- /*virtual*/ void refresh();
- void refreshNames();
- virtual void draw();
-
- void setGroup(const LLUUID& group_id);
- void onClickProfile();
- void onClickSetGroup();
- static void onClickDeed(void*);
- static void onClickBuyLand(void* data);
- static void onClickScriptLimits(void* data);
- static void onClickRelease(void*);
- static void onClickReclaim(void*);
- static void onClickBuyPass(void* deselect_when_done);
- static BOOL enableBuyPass(void*);
- static void onCommitAny(LLUICtrl* ctrl, void *userdata);
- static void finalizeCommit(void * userdata);
- static void onForSaleChange(LLUICtrl *ctrl, void * userdata);
- static void finalizeSetSellChange(void * userdata);
- static void onSalePriceChange(LLUICtrl *ctrl, void * userdata);
-
- static bool cbBuyPass(const LLSD& notification, const LLSD& response);
-
- static void onClickSellLand(void* data);
- static void onClickStopSellLand(void* data);
- static void onClickSet(void* data);
- static void onClickClear(void* data);
- static void onClickShow(void* data);
- static void callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids, void* data);
- static void finalizeAvatarPick(void* data);
- static void callbackHighlightTransferable(S32 option, void* userdata);
- static void onClickStartAuction(void*);
- // sale change confirmed when "is for sale", "sale price", "sell to whom" fields are changed
- static void confirmSaleChange(S32 landSize, S32 salePrice, std::string authorizedName, void(*callback)(void*), void* userdata);
- static void callbackConfirmSaleChange(S32 option, void* userdata);
-
- virtual BOOL postBuild();
+ LLPanelLandGeneral(LLSafeHandle<LLParcelSelection>& parcelp);
+ virtual ~LLPanelLandGeneral();
+ /*virtual*/ void refresh();
+ void refreshNames();
+ virtual void draw();
+
+ void setGroup(const LLUUID& group_id);
+ void onClickProfile();
+ void onClickSetGroup();
+ static void onClickDeed(void*);
+ static void onClickBuyLand(void* data);
+ static void onClickScriptLimits(void* data);
+ static void onClickRelease(void*);
+ static void onClickReclaim(void*);
+ static void onClickBuyPass(void* deselect_when_done);
+ static BOOL enableBuyPass(void*);
+ static void onCommitAny(LLUICtrl* ctrl, void *userdata);
+ static void finalizeCommit(void * userdata);
+ static void onForSaleChange(LLUICtrl *ctrl, void * userdata);
+ static void finalizeSetSellChange(void * userdata);
+ static void onSalePriceChange(LLUICtrl *ctrl, void * userdata);
+
+ static bool cbBuyPass(const LLSD& notification, const LLSD& response);
+
+ static void onClickSellLand(void* data);
+ static void onClickStopSellLand(void* data);
+ static void onClickSet(void* data);
+ static void onClickClear(void* data);
+ static void onClickShow(void* data);
+ static void callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids, void* data);
+ static void finalizeAvatarPick(void* data);
+ static void callbackHighlightTransferable(S32 option, void* userdata);
+ static void onClickStartAuction(void*);
+ // sale change confirmed when "is for sale", "sale price", "sell to whom" fields are changed
+ static void confirmSaleChange(S32 landSize, S32 salePrice, std::string authorizedName, void(*callback)(void*), void* userdata);
+ static void callbackConfirmSaleChange(S32 option, void* userdata);
+
+ virtual BOOL postBuild();
protected:
- BOOL mUncheckedSell; // True only when verifying land information when land is for sale on sale info change
-
- LLTextBox* mLabelName;
- LLLineEditor* mEditName;
- LLTextBox* mLabelDesc;
- LLTextEditor* mEditDesc;
-
- LLTextBox* mTextSalePending;
-
- LLButton* mBtnDeedToGroup;
- LLButton* mBtnSetGroup;
-
- LLTextBox* mTextOwnerLabel;
- LLTextBox* mTextOwner;
- LLButton* mBtnProfile;
-
- LLTextBox* mContentRating;
- LLTextBox* mLandType;
-
- LLTextBox* mTextGroup;
- LLTextBox* mTextGroupLabel;
- LLTextBox* mTextClaimDateLabel;
- LLTextBox* mTextClaimDate;
-
- LLTextBox* mTextPriceLabel;
- LLTextBox* mTextPrice;
-
- LLCheckBoxCtrl* mCheckDeedToGroup;
- LLCheckBoxCtrl* mCheckContributeWithDeed;
-
- LLTextBox* mSaleInfoForSale1;
- LLTextBox* mSaleInfoForSale2;
- LLTextBox* mSaleInfoForSaleObjects;
- LLTextBox* mSaleInfoForSaleNoObjects;
- LLTextBox* mSaleInfoNotForSale;
- LLButton* mBtnSellLand;
- LLButton* mBtnStopSellLand;
-
- LLTextBox* mTextDwell;
-
- LLButton* mBtnBuyLand;
- LLButton* mBtnScriptLimits;
- LLButton* mBtnBuyGroupLand;
-
- // these buttons share the same location, but
- // reclaim is in exactly the same visual place,
- // ond is only shown for estate owners on their
- // estate since they cannot release land.
- LLButton* mBtnReleaseLand;
- LLButton* mBtnReclaimLand;
-
- LLButton* mBtnBuyPass;
- LLButton* mBtnStartAuction;
-
- LLSafeHandle<LLParcelSelection>& mParcel;
-
- // This pointer is needed to avoid parcel deselection until buying pass is completed or canceled.
- // Deselection happened because of zero references to parcel selection, which took place when
- // "Buy Pass" was called from popup menu(EXT-6464)
- static LLPointer<LLParcelSelection> sSelectionForBuyPass;
-
- static LLHandle<LLFloater> sBuyPassDialogHandle;
+ BOOL mUncheckedSell; // True only when verifying land information when land is for sale on sale info change
+
+ LLTextBox* mLabelName;
+ LLLineEditor* mEditName;
+ LLTextBox* mLabelDesc;
+ LLTextEditor* mEditDesc;
+
+ LLTextBox* mTextSalePending;
+
+ LLButton* mBtnDeedToGroup;
+ LLButton* mBtnSetGroup;
+
+ LLTextBox* mTextOwnerLabel;
+ LLTextBox* mTextOwner;
+ LLButton* mBtnProfile;
+
+ LLTextBox* mContentRating;
+ LLTextBox* mLandType;
+
+ LLTextBox* mTextGroup;
+ LLTextBox* mTextGroupLabel;
+ LLTextBox* mTextClaimDateLabel;
+ LLTextBox* mTextClaimDate;
+
+ LLTextBox* mTextPriceLabel;
+ LLTextBox* mTextPrice;
+
+ LLCheckBoxCtrl* mCheckDeedToGroup;
+ LLCheckBoxCtrl* mCheckContributeWithDeed;
+
+ LLTextBox* mSaleInfoForSale1;
+ LLTextBox* mSaleInfoForSale2;
+ LLTextBox* mSaleInfoForSaleObjects;
+ LLTextBox* mSaleInfoForSaleNoObjects;
+ LLTextBox* mSaleInfoNotForSale;
+ LLButton* mBtnSellLand;
+ LLButton* mBtnStopSellLand;
+
+ LLTextBox* mTextDwell;
+
+ LLButton* mBtnBuyLand;
+ LLButton* mBtnScriptLimits;
+ LLButton* mBtnBuyGroupLand;
+
+ // these buttons share the same location, but
+ // reclaim is in exactly the same visual place,
+ // ond is only shown for estate owners on their
+ // estate since they cannot release land.
+ LLButton* mBtnReleaseLand;
+ LLButton* mBtnReclaimLand;
+
+ LLButton* mBtnBuyPass;
+ LLButton* mBtnStartAuction;
+
+ LLSafeHandle<LLParcelSelection>& mParcel;
+
+ // This pointer is needed to avoid parcel deselection until buying pass is completed or canceled.
+ // Deselection happened because of zero references to parcel selection, which took place when
+ // "Buy Pass" was called from popup menu(EXT-6464)
+ static LLPointer<LLParcelSelection> sSelectionForBuyPass;
+
+ static LLHandle<LLFloater> sBuyPassDialogHandle;
};
class LLPanelLandObjects
-: public LLPanel
+: public LLPanel
{
public:
- LLPanelLandObjects(LLSafeHandle<LLParcelSelection>& parcelp);
- virtual ~LLPanelLandObjects();
- /*virtual*/ void refresh();
- virtual void draw();
-
- bool callbackReturnOwnerObjects(const LLSD& notification, const LLSD& response);
- bool callbackReturnGroupObjects(const LLSD& notification, const LLSD& response);
- bool callbackReturnOtherObjects(const LLSD& notification, const LLSD& response);
- bool callbackReturnOwnerList(const LLSD& notification, const LLSD& response);
-
- static void clickShowCore(LLPanelLandObjects* panelp, S32 return_type, uuid_list_t* list = 0);
- static void onClickShowOwnerObjects(void*);
- static void onClickShowGroupObjects(void*);
- static void onClickShowOtherObjects(void*);
-
- static void onClickReturnOwnerObjects(void*);
- static void onClickReturnGroupObjects(void*);
- static void onClickReturnOtherObjects(void*);
- static void onClickReturnOwnerList(void*);
- static void onClickRefresh(void*);
-
- static void onDoubleClickOwner(void*);
-
- static void onCommitList(LLUICtrl* ctrl, void* data);
- static void onLostFocus(LLFocusableElement* caller, void* user_data);
- static void onCommitClean(LLUICtrl* caller, void* user_data);
- static void processParcelObjectOwnersReply(LLMessageSystem *msg, void **);
-
- virtual BOOL postBuild();
+ LLPanelLandObjects(LLSafeHandle<LLParcelSelection>& parcelp);
+ virtual ~LLPanelLandObjects();
+ /*virtual*/ void refresh();
+ virtual void draw();
+
+ bool callbackReturnOwnerObjects(const LLSD& notification, const LLSD& response);
+ bool callbackReturnGroupObjects(const LLSD& notification, const LLSD& response);
+ bool callbackReturnOtherObjects(const LLSD& notification, const LLSD& response);
+ bool callbackReturnOwnerList(const LLSD& notification, const LLSD& response);
+
+ static void clickShowCore(LLPanelLandObjects* panelp, S32 return_type, uuid_list_t* list = 0);
+ static void onClickShowOwnerObjects(void*);
+ static void onClickShowGroupObjects(void*);
+ static void onClickShowOtherObjects(void*);
+
+ static void onClickReturnOwnerObjects(void*);
+ static void onClickReturnGroupObjects(void*);
+ static void onClickReturnOtherObjects(void*);
+ static void onClickReturnOwnerList(void*);
+ static void onClickRefresh(void*);
+
+ static void onDoubleClickOwner(void*);
+
+ static void onCommitList(LLUICtrl* ctrl, void* data);
+ static void onLostFocus(LLFocusableElement* caller, void* user_data);
+ static void onCommitClean(LLUICtrl* caller, void* user_data);
+ static void processParcelObjectOwnersReply(LLMessageSystem *msg, void **);
+
+ virtual BOOL postBuild();
protected:
- LLTextBox *mParcelObjectBonus;
- LLTextBox *mSWTotalObjects;
- LLTextBox *mObjectContribution;
- LLTextBox *mTotalObjects;
- LLTextBox *mOwnerObjects;
- LLButton *mBtnShowOwnerObjects;
- LLButton *mBtnReturnOwnerObjects;
- LLTextBox *mGroupObjects;
- LLButton *mBtnShowGroupObjects;
- LLButton *mBtnReturnGroupObjects;
- LLTextBox *mOtherObjects;
- LLButton *mBtnShowOtherObjects;
- LLButton *mBtnReturnOtherObjects;
- LLTextBox *mSelectedObjects;
- LLLineEditor *mCleanOtherObjectsTime;
- S32 mOtherTime;
- LLButton *mBtnRefresh;
- LLButton *mBtnReturnOwnerList;
- LLNameListCtrl *mOwnerList;
-
- LLPointer<LLUIImage> mIconAvatarOnline;
- LLPointer<LLUIImage> mIconAvatarOffline;
- LLPointer<LLUIImage> mIconGroup;
-
- BOOL mFirstReply;
-
- uuid_list_t mSelectedOwners;
- std::string mSelectedName;
- S32 mSelectedCount;
- BOOL mSelectedIsGroup;
-
- LLSafeHandle<LLParcelSelection>& mParcel;
+ LLTextBox *mParcelObjectBonus;
+ LLTextBox *mSWTotalObjects;
+ LLTextBox *mObjectContribution;
+ LLTextBox *mTotalObjects;
+ LLTextBox *mOwnerObjects;
+ LLButton *mBtnShowOwnerObjects;
+ LLButton *mBtnReturnOwnerObjects;
+ LLTextBox *mGroupObjects;
+ LLButton *mBtnShowGroupObjects;
+ LLButton *mBtnReturnGroupObjects;
+ LLTextBox *mOtherObjects;
+ LLButton *mBtnShowOtherObjects;
+ LLButton *mBtnReturnOtherObjects;
+ LLTextBox *mSelectedObjects;
+ LLLineEditor *mCleanOtherObjectsTime;
+ S32 mOtherTime;
+ LLButton *mBtnRefresh;
+ LLButton *mBtnReturnOwnerList;
+ LLNameListCtrl *mOwnerList;
+
+ LLPointer<LLUIImage> mIconAvatarOnline;
+ LLPointer<LLUIImage> mIconAvatarOffline;
+ LLPointer<LLUIImage> mIconGroup;
+
+ BOOL mFirstReply;
+
+ uuid_list_t mSelectedOwners;
+ std::string mSelectedName;
+ S32 mSelectedCount;
+ BOOL mSelectedIsGroup;
+
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
class LLPanelLandOptions
-: public LLPanel
+: public LLPanel
{
public:
- LLPanelLandOptions(LLSafeHandle<LLParcelSelection>& parcelp);
- virtual ~LLPanelLandOptions();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void draw();
- /*virtual*/ void refresh();
+ LLPanelLandOptions(LLSafeHandle<LLParcelSelection>& parcelp);
+ virtual ~LLPanelLandOptions();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
+ /*virtual*/ void refresh();
private:
- // Refresh the "show in search" checkbox and category selector.
- void refreshSearch();
+ // Refresh the "show in search" checkbox and category selector.
+ void refreshSearch();
- static void onCommitAny(LLUICtrl* ctrl, void *userdata);
- static void onClickSet(void* userdata);
- static void onClickClear(void* userdata);
- static void toggleSeeAvatars(void* userdata);
+ static void onCommitAny(LLUICtrl* ctrl, void *userdata);
+ static void onClickSet(void* userdata);
+ static void onClickClear(void* userdata);
+ static void toggleSeeAvatars(void* userdata);
private:
- LLCheckBoxCtrl* mCheckEditObjects;
- LLCheckBoxCtrl* mCheckEditGroupObjects;
- LLCheckBoxCtrl* mCheckAllObjectEntry;
- LLCheckBoxCtrl* mCheckGroupObjectEntry;
- LLCheckBoxCtrl* mCheckSafe;
- LLCheckBoxCtrl* mCheckFly;
- LLCheckBoxCtrl* mCheckGroupScripts;
- LLCheckBoxCtrl* mCheckOtherScripts;
-
- LLCheckBoxCtrl* mCheckShowDirectory;
- LLComboBox* mCategoryCombo;
- LLComboBox* mLandingTypeCombo;
-
- LLTextureCtrl* mSnapshotCtrl;
-
- LLTextBox* mLocationText;
- LLTextBox* mSeeAvatarsText;
- LLButton* mSetBtn;
- LLButton* mClearBtn;
-
- LLCheckBoxCtrl *mMatureCtrl;
- LLCheckBoxCtrl *mPushRestrictionCtrl;
- LLCheckBoxCtrl *mSeeAvatarsCtrl;
-
- LLSafeHandle<LLParcelSelection>& mParcel;
+ LLCheckBoxCtrl* mCheckEditObjects;
+ LLCheckBoxCtrl* mCheckEditGroupObjects;
+ LLCheckBoxCtrl* mCheckAllObjectEntry;
+ LLCheckBoxCtrl* mCheckGroupObjectEntry;
+ LLCheckBoxCtrl* mCheckSafe;
+ LLCheckBoxCtrl* mCheckFly;
+ LLCheckBoxCtrl* mCheckGroupScripts;
+ LLCheckBoxCtrl* mCheckOtherScripts;
+
+ LLCheckBoxCtrl* mCheckShowDirectory;
+ LLComboBox* mCategoryCombo;
+ LLComboBox* mLandingTypeCombo;
+
+ LLTextureCtrl* mSnapshotCtrl;
+
+ LLTextBox* mLocationText;
+ LLTextBox* mSeeAvatarsText;
+ LLButton* mSetBtn;
+ LLButton* mClearBtn;
+
+ LLCheckBoxCtrl *mMatureCtrl;
+ LLCheckBoxCtrl *mPushRestrictionCtrl;
+ LLCheckBoxCtrl *mSeeAvatarsCtrl;
+
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
class LLPanelLandAccess
-: public LLPanel
+: public LLPanel
{
public:
- LLPanelLandAccess(LLSafeHandle<LLParcelSelection>& parcelp);
- virtual ~LLPanelLandAccess();
- void refresh();
- void refresh_ui();
- void refreshNames();
- virtual void draw();
-
- static void onCommitPublicAccess(LLUICtrl* ctrl, void *userdata);
- static void onCommitAny(LLUICtrl* ctrl, void *userdata);
- static void onCommitGroupCheck(LLUICtrl* ctrl, void *userdata);
- static void onClickRemoveAccess(void*);
- static void onClickRemoveBanned(void*);
-
- virtual BOOL postBuild();
-
- void onClickAddAccess();
- void onClickAddBanned();
- void callbackAvatarCBBanned(const uuid_vec_t& ids);
- void callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration);
- void callbackAvatarCBAccess(const uuid_vec_t& ids);
+ LLPanelLandAccess(LLSafeHandle<LLParcelSelection>& parcelp);
+ virtual ~LLPanelLandAccess();
+ void refresh();
+ void refresh_ui();
+ void refreshNames();
+ virtual void draw();
+
+ static void onCommitPublicAccess(LLUICtrl* ctrl, void *userdata);
+ static void onCommitAny(LLUICtrl* ctrl, void *userdata);
+ static void onCommitGroupCheck(LLUICtrl* ctrl, void *userdata);
+ static void onClickRemoveAccess(void*);
+ static void onClickRemoveBanned(void*);
+
+ virtual BOOL postBuild();
+
+ void onClickAddAccess();
+ void onClickAddBanned();
+ void callbackAvatarCBBanned(const uuid_vec_t& ids);
+ void callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration);
+ void callbackAvatarCBAccess(const uuid_vec_t& ids);
protected:
- LLNameListCtrl* mListAccess;
- LLNameListCtrl* mListBanned;
+ LLNameListCtrl* mListAccess;
+ LLNameListCtrl* mListBanned;
- LLSafeHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
class LLPanelLandCovenant
-: public LLPanel
+: public LLPanel
{
public:
- LLPanelLandCovenant(LLSafeHandle<LLParcelSelection>& parcelp);
- virtual ~LLPanelLandCovenant();
- virtual BOOL postBuild();
- void refresh();
- static void updateCovenantText(const std::string& string);
- static void updateEstateName(const std::string& name);
- static void updateLastModified(const std::string& text);
- static void updateEstateOwnerName(const std::string& name);
+ LLPanelLandCovenant(LLSafeHandle<LLParcelSelection>& parcelp);
+ virtual ~LLPanelLandCovenant();
+ virtual BOOL postBuild();
+ void refresh();
+ static void updateCovenantText(const std::string& string);
+ static void updateEstateName(const std::string& name);
+ static void updateLastModified(const std::string& text);
+ static void updateEstateOwnerName(const std::string& name);
protected:
- LLSafeHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
private:
- LLUUID mLastRegionID;
- F64 mNextUpdateTime; //seconds since client start
+ LLUUID mLastRegionID;
+ F64 mNextUpdateTime; //seconds since client start
LLTextBox* mTextEstateOwner;
};
diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp
index a3222d622f..d33756c53b 100644
--- a/indra/newview/llfloaterlandholdings.cpp
+++ b/indra/newview/llfloaterlandholdings.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterlandholdings.cpp
* @brief "My Land" floater showing all your land parcels.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,49 +57,49 @@ bool LLFloaterLandHoldings::sHasLindenHome = false;
// protected
LLFloaterLandHoldings::LLFloaterLandHoldings(const LLSD& key)
-: LLFloater(key),
- mActualArea(0),
- mBillableArea(0),
- mFirstPacketReceived(FALSE),
- mSortColumn(""),
- mSortAscending(TRUE)
+: LLFloater(key),
+ mActualArea(0),
+ mBillableArea(0),
+ mFirstPacketReceived(FALSE),
+ mSortColumn(""),
+ mSortAscending(TRUE)
{
}
BOOL LLFloaterLandHoldings::postBuild()
{
- childSetAction("Teleport", onClickTeleport, this);
- childSetAction("Show on Map", onClickMap, this);
-
- // Grant list
- LLScrollListCtrl* grant_list = getChild<LLScrollListCtrl>("grant list");
- grant_list->sortByColumnIndex(0, TRUE);
- grant_list->setDoubleClickCallback(onGrantList, this);
-
- S32 count = gAgent.mGroups.size();
- for(S32 i = 0; i < count; ++i)
- {
- LLUUID id(gAgent.mGroups.at(i).mID);
- LLUIString areastr = getString("area_string");
- areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.at(i).mContribution));
-
- grant_list->addElement(
- llsd::map(
- "id", id,
- "columns", llsd::array(
- llsd::map(
- "column", "group",
- "value", gAgent.mGroups.at(i).mName,
- "font", "SANSSERIF"),
- llsd::map(
- "column", "area",
- "value", areastr,
- "font", "SANSSERIF"))));
- }
-
- center();
-
- return TRUE;
+ childSetAction("Teleport", onClickTeleport, this);
+ childSetAction("Show on Map", onClickMap, this);
+
+ // Grant list
+ LLScrollListCtrl* grant_list = getChild<LLScrollListCtrl>("grant list");
+ grant_list->sortByColumnIndex(0, TRUE);
+ grant_list->setDoubleClickCallback(onGrantList, this);
+
+ S32 count = gAgent.mGroups.size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ LLUUID id(gAgent.mGroups.at(i).mID);
+ LLUIString areastr = getString("area_string");
+ areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.at(i).mContribution));
+
+ grant_list->addElement(
+ llsd::map(
+ "id", id,
+ "columns", llsd::array(
+ llsd::map(
+ "column", "group",
+ "value", gAgent.mGroups.at(i).mName,
+ "font", "SANSSERIF"),
+ llsd::map(
+ "column", "area",
+ "value", areastr,
+ "font", "SANSSERIF"))));
+ }
+
+ center();
+
+ return TRUE;
}
@@ -110,246 +110,246 @@ LLFloaterLandHoldings::~LLFloaterLandHoldings()
void LLFloaterLandHoldings::onOpen(const LLSD& key)
{
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("parcel list");
- list->clearRows();
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("parcel list");
+ list->clearRows();
- // query_id null is known to be us
- const LLUUID& query_id = LLUUID::null;
+ // query_id null is known to be us
+ const LLUUID& query_id = LLUUID::null;
- // look only for parcels we own
- U32 query_flags = DFQ_AGENT_OWNED;
+ // look only for parcels we own
+ U32 query_flags = DFQ_AGENT_OWNED;
- send_places_query(query_id,
- LLUUID::null,
- "",
- query_flags,
- LLParcel::C_ANY,
- "");
+ send_places_query(query_id,
+ LLUUID::null,
+ "",
+ query_flags,
+ LLParcel::C_ANY,
+ "");
}
void LLFloaterLandHoldings::draw()
{
- refresh();
+ refresh();
- LLFloater::draw();
+ LLFloater::draw();
}
// public
void LLFloaterLandHoldings::refresh()
{
- LLCtrlSelectionInterface *list = childGetSelectionInterface("parcel list");
- BOOL enable_btns = FALSE;
- if (list && list->getFirstSelectedIndex()> -1)
- {
- enable_btns = TRUE;
- }
+ LLCtrlSelectionInterface *list = childGetSelectionInterface("parcel list");
+ BOOL enable_btns = FALSE;
+ if (list && list->getFirstSelectedIndex()> -1)
+ {
+ enable_btns = TRUE;
+ }
- getChildView("Teleport")->setEnabled(enable_btns);
- getChildView("Show on Map")->setEnabled(enable_btns);
+ getChildView("Teleport")->setEnabled(enable_btns);
+ getChildView("Show on Map")->setEnabled(enable_btns);
- refreshAggregates();
+ refreshAggregates();
}
// static
void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**)
{
- LLFloaterLandHoldings* self = LLFloaterReg::findTypedInstance<LLFloaterLandHoldings>("land_holdings");
- S32 count = msg->getNumberOfBlocks("QueryData");
- std::string land_sku;
- sHasLindenHome = false;
- if (!self)
- {
- for (S32 i = 0; i < count; i++)
- {
- if ( msg->getSizeFast(_PREHASH_QueryData, i, _PREHASH_ProductSKU) > 0 )
- {
- msg->getStringFast( _PREHASH_QueryData, _PREHASH_ProductSKU, land_sku, i);
-
- if (LINDEN_HOMES_SKU == land_sku)
- {
- sHasLindenHome = true;
- return;
- }
- }
- }
- return;
- }
-
- LLCtrlListInterface *list = self->childGetListInterface("parcel list");
- if (!list) return;
-
- // If this is the first packet, clear out the "loading..." indicator
- if (!self->mFirstPacketReceived)
- {
- self->mFirstPacketReceived = TRUE;
- list->operateOnAll(LLCtrlSelectionInterface::OP_DELETE);
- }
-
- LLUUID owner_id;
- std::string name;
- std::string desc;
- S32 actual_area;
- S32 billable_area;
- U8 flags;
- F32 global_x;
- F32 global_y;
- std::string sim_name;
- std::string land_type;
-
- for (S32 i = 0; i < count; i++)
- {
- msg->getUUID("QueryData", "OwnerID", owner_id, i);
- msg->getString("QueryData", "Name", name, i);
- msg->getString("QueryData", "Desc", desc, i);
- msg->getS32("QueryData", "ActualArea", actual_area, i);
- msg->getS32("QueryData", "BillableArea", billable_area, i);
- msg->getU8("QueryData", "Flags", flags, i);
- msg->getF32("QueryData", "GlobalX", global_x, i);
- msg->getF32("QueryData", "GlobalY", global_y, i);
- msg->getString("QueryData", "SimName", sim_name, i);
-
- if ( msg->getSizeFast(_PREHASH_QueryData, i, _PREHASH_ProductSKU) > 0 )
- {
- msg->getStringFast( _PREHASH_QueryData, _PREHASH_ProductSKU, land_sku, i);
- LL_INFOS() << "Land sku: " << land_sku << LL_ENDL;
- land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku);
- if (LINDEN_HOMES_SKU == land_sku)
- {
- sHasLindenHome = true;
- }
- }
- else
- {
- land_sku.clear();
- land_type = LLTrans::getString("land_type_unknown");
- }
-
- if(owner_id.notNull())
- {
- self->mActualArea += actual_area;
- self->mBillableArea += billable_area;
-
- S32 region_x = ll_round(global_x) % REGION_WIDTH_UNITS;
- S32 region_y = ll_round(global_y) % REGION_WIDTH_UNITS;
-
- std::string location;
- location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y);
-
- std::string area;
- if(billable_area == actual_area)
- {
- area = llformat("%d", billable_area);
- }
- else
- {
- area = llformat("%d / %d", billable_area, actual_area);
- }
-
- std::string hidden;
- hidden = llformat("%f %f", global_x, global_y);
-
- LLSD element;
- element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = name;
- element["columns"][0]["font"] = "SANSSERIF";
-
- element["columns"][1]["column"] = "location";
- element["columns"][1]["value"] = location;
- element["columns"][1]["font"] = "SANSSERIF";
-
- element["columns"][2]["column"] = "area";
- element["columns"][2]["value"] = area;
- element["columns"][2]["font"] = "SANSSERIF";
-
- element["columns"][3]["column"] = "type";
- element["columns"][3]["value"] = land_type;
- element["columns"][3]["font"] = "SANSSERIF";
-
- // hidden is always last column
- element["columns"][4]["column"] = "hidden";
- element["columns"][4]["value"] = hidden;
-
- list->addElement(element);
- }
- }
-
- self->refreshAggregates();
+ LLFloaterLandHoldings* self = LLFloaterReg::findTypedInstance<LLFloaterLandHoldings>("land_holdings");
+ S32 count = msg->getNumberOfBlocks("QueryData");
+ std::string land_sku;
+ sHasLindenHome = false;
+ if (!self)
+ {
+ for (S32 i = 0; i < count; i++)
+ {
+ if ( msg->getSizeFast(_PREHASH_QueryData, i, _PREHASH_ProductSKU) > 0 )
+ {
+ msg->getStringFast( _PREHASH_QueryData, _PREHASH_ProductSKU, land_sku, i);
+
+ if (LINDEN_HOMES_SKU == land_sku)
+ {
+ sHasLindenHome = true;
+ return;
+ }
+ }
+ }
+ return;
+ }
+
+ LLCtrlListInterface *list = self->childGetListInterface("parcel list");
+ if (!list) return;
+
+ // If this is the first packet, clear out the "loading..." indicator
+ if (!self->mFirstPacketReceived)
+ {
+ self->mFirstPacketReceived = TRUE;
+ list->operateOnAll(LLCtrlSelectionInterface::OP_DELETE);
+ }
+
+ LLUUID owner_id;
+ std::string name;
+ std::string desc;
+ S32 actual_area;
+ S32 billable_area;
+ U8 flags;
+ F32 global_x;
+ F32 global_y;
+ std::string sim_name;
+ std::string land_type;
+
+ for (S32 i = 0; i < count; i++)
+ {
+ msg->getUUID("QueryData", "OwnerID", owner_id, i);
+ msg->getString("QueryData", "Name", name, i);
+ msg->getString("QueryData", "Desc", desc, i);
+ msg->getS32("QueryData", "ActualArea", actual_area, i);
+ msg->getS32("QueryData", "BillableArea", billable_area, i);
+ msg->getU8("QueryData", "Flags", flags, i);
+ msg->getF32("QueryData", "GlobalX", global_x, i);
+ msg->getF32("QueryData", "GlobalY", global_y, i);
+ msg->getString("QueryData", "SimName", sim_name, i);
+
+ if ( msg->getSizeFast(_PREHASH_QueryData, i, _PREHASH_ProductSKU) > 0 )
+ {
+ msg->getStringFast( _PREHASH_QueryData, _PREHASH_ProductSKU, land_sku, i);
+ LL_INFOS() << "Land sku: " << land_sku << LL_ENDL;
+ land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku);
+ if (LINDEN_HOMES_SKU == land_sku)
+ {
+ sHasLindenHome = true;
+ }
+ }
+ else
+ {
+ land_sku.clear();
+ land_type = LLTrans::getString("land_type_unknown");
+ }
+
+ if(owner_id.notNull())
+ {
+ self->mActualArea += actual_area;
+ self->mBillableArea += billable_area;
+
+ S32 region_x = ll_round(global_x) % REGION_WIDTH_UNITS;
+ S32 region_y = ll_round(global_y) % REGION_WIDTH_UNITS;
+
+ std::string location;
+ location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y);
+
+ std::string area;
+ if(billable_area == actual_area)
+ {
+ area = llformat("%d", billable_area);
+ }
+ else
+ {
+ area = llformat("%d / %d", billable_area, actual_area);
+ }
+
+ std::string hidden;
+ hidden = llformat("%f %f", global_x, global_y);
+
+ LLSD element;
+ element["columns"][0]["column"] = "name";
+ element["columns"][0]["value"] = name;
+ element["columns"][0]["font"] = "SANSSERIF";
+
+ element["columns"][1]["column"] = "location";
+ element["columns"][1]["value"] = location;
+ element["columns"][1]["font"] = "SANSSERIF";
+
+ element["columns"][2]["column"] = "area";
+ element["columns"][2]["value"] = area;
+ element["columns"][2]["font"] = "SANSSERIF";
+
+ element["columns"][3]["column"] = "type";
+ element["columns"][3]["value"] = land_type;
+ element["columns"][3]["font"] = "SANSSERIF";
+
+ // hidden is always last column
+ element["columns"][4]["column"] = "hidden";
+ element["columns"][4]["value"] = hidden;
+
+ list->addElement(element);
+ }
+ }
+
+ self->refreshAggregates();
}
void LLFloaterLandHoldings::buttonCore(S32 which)
{
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("parcel list");
- if (!list) return;
-
- S32 index = list->getFirstSelectedIndex();
- if (index < 0) return;
-
- // hidden is always last column
- std::string location = list->getSelectedItemLabel(list->getNumColumns()-1);
-
- F32 global_x = 0.f;
- F32 global_y = 0.f;
- sscanf(location.c_str(), "%f %f", &global_x, &global_y);
-
- // Hack: Use the agent's z-height
- F64 global_z = gAgent.getPositionGlobal().mdV[VZ];
-
- LLVector3d pos_global(global_x, global_y, global_z);
- LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
-
- switch(which)
- {
- case 0:
- gAgent.teleportViaLocation(pos_global);
- if(floater_world_map) floater_world_map->trackLocation(pos_global);
- break;
- case 1:
- if(floater_world_map) floater_world_map->trackLocation(pos_global);
- LLFloaterReg::showInstance("world_map", "center");
- break;
- default:
- break;
- }
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("parcel list");
+ if (!list) return;
+
+ S32 index = list->getFirstSelectedIndex();
+ if (index < 0) return;
+
+ // hidden is always last column
+ std::string location = list->getSelectedItemLabel(list->getNumColumns()-1);
+
+ F32 global_x = 0.f;
+ F32 global_y = 0.f;
+ sscanf(location.c_str(), "%f %f", &global_x, &global_y);
+
+ // Hack: Use the agent's z-height
+ F64 global_z = gAgent.getPositionGlobal().mdV[VZ];
+
+ LLVector3d pos_global(global_x, global_y, global_z);
+ LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
+
+ switch(which)
+ {
+ case 0:
+ gAgent.teleportViaLocation(pos_global);
+ if(floater_world_map) floater_world_map->trackLocation(pos_global);
+ break;
+ case 1:
+ if(floater_world_map) floater_world_map->trackLocation(pos_global);
+ LLFloaterReg::showInstance("world_map", "center");
+ break;
+ default:
+ break;
+ }
}
// static
void LLFloaterLandHoldings::onClickTeleport(void* data)
{
- LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data;
- self->buttonCore(0);
- self->closeFloater();
+ LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data;
+ self->buttonCore(0);
+ self->closeFloater();
}
// static
void LLFloaterLandHoldings::onClickMap(void* data)
{
- LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data;
- self->buttonCore(1);
+ LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data;
+ self->buttonCore(1);
}
// static
void LLFloaterLandHoldings::onGrantList(void* data)
{
- LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data;
- LLCtrlSelectionInterface *list = self->childGetSelectionInterface("grant list");
- if (!list) return;
- LLUUID group_id = list->getCurrentID();
- if (group_id.notNull())
- {
- LLGroupActions::show(group_id);
- }
+ LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data;
+ LLCtrlSelectionInterface *list = self->childGetSelectionInterface("grant list");
+ if (!list) return;
+ LLUUID group_id = list->getCurrentID();
+ if (group_id.notNull())
+ {
+ LLGroupActions::show(group_id);
+ }
}
void LLFloaterLandHoldings::refreshAggregates()
{
- S32 allowed_area = gStatusBar->getSquareMetersCredit();
- S32 current_area = gStatusBar->getSquareMetersCommitted();
- S32 available_area = gStatusBar->getSquareMetersLeft();
+ S32 allowed_area = gStatusBar->getSquareMetersCredit();
+ S32 current_area = gStatusBar->getSquareMetersCommitted();
+ S32 available_area = gStatusBar->getSquareMetersLeft();
- getChild<LLUICtrl>("allowed_text")->setTextArg("[AREA]", llformat("%d",allowed_area));
- getChild<LLUICtrl>("current_text")->setTextArg("[AREA]", llformat("%d",current_area));
- getChild<LLUICtrl>("available_text")->setTextArg("[AREA]", llformat("%d",available_area));
+ getChild<LLUICtrl>("allowed_text")->setTextArg("[AREA]", llformat("%d",allowed_area));
+ getChild<LLUICtrl>("current_text")->setTextArg("[AREA]", llformat("%d",current_area));
+ getChild<LLUICtrl>("available_text")->setTextArg("[AREA]", llformat("%d",available_area));
}
diff --git a/indra/newview/llfloaterlandholdings.h b/indra/newview/llfloaterlandholdings.h
index 90e75b1062..7e99c9e671 100644
--- a/indra/newview/llfloaterlandholdings.h
+++ b/indra/newview/llfloaterlandholdings.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterlandholdings.h
* @brief "My Land" floater showing all your land parcels.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,44 +35,44 @@ class LLScrollListCtrl;
class LLButton;
class LLFloaterLandHoldings
-: public LLFloater
+: public LLFloater
{
public:
- LLFloaterLandHoldings(const LLSD& key);
- virtual ~LLFloaterLandHoldings();
-
- virtual BOOL postBuild();
- virtual void onOpen(const LLSD& key);
- virtual void draw();
+ LLFloaterLandHoldings(const LLSD& key);
+ virtual ~LLFloaterLandHoldings();
+
+ virtual BOOL postBuild();
+ virtual void onOpen(const LLSD& key);
+ virtual void draw();
- void refresh();
+ void refresh();
- void buttonCore(S32 which);
+ void buttonCore(S32 which);
- static void processPlacesReply(LLMessageSystem* msg, void**);
+ static void processPlacesReply(LLMessageSystem* msg, void**);
- static void onClickTeleport(void*);
- static void onClickMap(void*);
- static void onClickLandmark(void*);
+ static void onClickTeleport(void*);
+ static void onClickMap(void*);
+ static void onClickLandmark(void*);
- static void onGrantList(void* data);
+ static void onGrantList(void* data);
- static bool sHasLindenHome;
+ static bool sHasLindenHome;
protected:
- void refreshAggregates();
+ void refreshAggregates();
protected:
- // Sum up as packets arrive the total holdings
- S32 mActualArea;
- S32 mBillableArea;
+ // Sum up as packets arrive the total holdings
+ S32 mActualArea;
+ S32 mBillableArea;
- // Has a packet of data been received?
- // Used to clear out the mParcelList's "Loading..." indicator
- BOOL mFirstPacketReceived;
+ // Has a packet of data been received?
+ // Used to clear out the mParcelList's "Loading..." indicator
+ BOOL mFirstPacketReceived;
- std::string mSortColumn;
- BOOL mSortAscending;
+ std::string mSortColumn;
+ BOOL mSortAscending;
};
#endif
diff --git a/indra/newview/llfloaterlinkreplace.cpp b/indra/newview/llfloaterlinkreplace.cpp
index b42c49c607..bd1d8ddae8 100644
--- a/indra/newview/llfloaterlinkreplace.cpp
+++ b/indra/newview/llfloaterlinkreplace.cpp
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2017&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2017, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,14 +38,14 @@
#include "llviewercontrol.h"
LLFloaterLinkReplace::LLFloaterLinkReplace(const LLSD& key)
- : LLFloater(key),
- LLEventTimer(gSavedSettings.getF32("LinkReplaceBatchPauseTime")),
- mRemainingItems(0),
- mSourceUUID(LLUUID::null),
- mTargetUUID(LLUUID::null),
- mBatchSize(gSavedSettings.getU32("LinkReplaceBatchSize"))
+ : LLFloater(key),
+ LLEventTimer(gSavedSettings.getF32("LinkReplaceBatchPauseTime")),
+ mRemainingItems(0),
+ mSourceUUID(LLUUID::null),
+ mTargetUUID(LLUUID::null),
+ mBatchSize(gSavedSettings.getU32("LinkReplaceBatchSize"))
{
- mEventTimer.stop();
+ mEventTimer.stop();
}
LLFloaterLinkReplace::~LLFloaterLinkReplace()
@@ -54,322 +54,322 @@ LLFloaterLinkReplace::~LLFloaterLinkReplace()
BOOL LLFloaterLinkReplace::postBuild()
{
- mStartBtn = getChild<LLButton>("btn_start");
- mStartBtn->setCommitCallback(boost::bind(&LLFloaterLinkReplace::onStartClicked, this));
+ mStartBtn = getChild<LLButton>("btn_start");
+ mStartBtn->setCommitCallback(boost::bind(&LLFloaterLinkReplace::onStartClicked, this));
- mRefreshBtn = getChild<LLButton>("btn_refresh");
- mRefreshBtn->setCommitCallback(boost::bind(&LLFloaterLinkReplace::checkEnableStart, this));
+ mRefreshBtn = getChild<LLButton>("btn_refresh");
+ mRefreshBtn->setCommitCallback(boost::bind(&LLFloaterLinkReplace::checkEnableStart, this));
- mSourceEditor = getChild<LLInventoryLinkReplaceDropTarget>("source_uuid_editor");
- mTargetEditor = getChild<LLInventoryLinkReplaceDropTarget>("target_uuid_editor");
+ mSourceEditor = getChild<LLInventoryLinkReplaceDropTarget>("source_uuid_editor");
+ mTargetEditor = getChild<LLInventoryLinkReplaceDropTarget>("target_uuid_editor");
- mSourceEditor->setDADCallback(boost::bind(&LLFloaterLinkReplace::onSourceItemDrop, this, _1));
- mTargetEditor->setDADCallback(boost::bind(&LLFloaterLinkReplace::onTargetItemDrop, this, _1));
+ mSourceEditor->setDADCallback(boost::bind(&LLFloaterLinkReplace::onSourceItemDrop, this, _1));
+ mTargetEditor->setDADCallback(boost::bind(&LLFloaterLinkReplace::onTargetItemDrop, this, _1));
- mStatusText = getChild<LLTextBox>("status_text");
+ mStatusText = getChild<LLTextBox>("status_text");
- return TRUE;
+ return TRUE;
}
void LLFloaterLinkReplace::onOpen(const LLSD& key)
{
- if (key.asUUID().notNull())
- {
- LLUUID item_id = key.asUUID();
- LLViewerInventoryItem* item = gInventory.getItem(item_id);
- mSourceEditor->setItem(item);
- onSourceItemDrop(item->getLinkedUUID());
- }
- else
- {
- checkEnableStart();
- }
+ if (key.asUUID().notNull())
+ {
+ LLUUID item_id = key.asUUID();
+ LLViewerInventoryItem* item = gInventory.getItem(item_id);
+ mSourceEditor->setItem(item);
+ onSourceItemDrop(item->getLinkedUUID());
+ }
+ else
+ {
+ checkEnableStart();
+ }
}
void LLFloaterLinkReplace::onSourceItemDrop(const LLUUID& source_item_id)
{
- mSourceUUID = source_item_id;
- checkEnableStart();
+ mSourceUUID = source_item_id;
+ checkEnableStart();
}
void LLFloaterLinkReplace::onTargetItemDrop(const LLUUID& target_item_id)
{
- mTargetUUID = target_item_id;
- checkEnableStart();
+ mTargetUUID = target_item_id;
+ checkEnableStart();
}
void LLFloaterLinkReplace::updateFoundLinks()
{
- LLInventoryModel::item_array_t items;
- LLInventoryModel::cat_array_t cat_array;
- LLLinkedItemIDMatches is_linked_item_match(mSourceUUID);
- gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
- cat_array,
- items,
- LLInventoryModel::INCLUDE_TRASH,
- is_linked_item_match);
- mRemainingItems = (U32)items.size();
-
- LLStringUtil::format_map_t args;
- args["NUM"] = llformat("%d", mRemainingItems);
- mStatusText->setText(getString("ItemsFound", args));
+ LLInventoryModel::item_array_t items;
+ LLInventoryModel::cat_array_t cat_array;
+ LLLinkedItemIDMatches is_linked_item_match(mSourceUUID);
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cat_array,
+ items,
+ LLInventoryModel::INCLUDE_TRASH,
+ is_linked_item_match);
+ mRemainingItems = (U32)items.size();
+
+ LLStringUtil::format_map_t args;
+ args["NUM"] = llformat("%d", mRemainingItems);
+ mStatusText->setText(getString("ItemsFound", args));
}
void LLFloaterLinkReplace::checkEnableStart()
{
- if (mSourceUUID.notNull() && mTargetUUID.notNull() && mSourceUUID == mTargetUUID)
- {
- mStatusText->setText(getString("ItemsIdentical"));
- }
- else if (mSourceUUID.notNull())
- {
- updateFoundLinks();
- }
-
- mStartBtn->setEnabled(mRemainingItems > 0 && mSourceUUID.notNull() && mTargetUUID.notNull() && mSourceUUID != mTargetUUID);
+ if (mSourceUUID.notNull() && mTargetUUID.notNull() && mSourceUUID == mTargetUUID)
+ {
+ mStatusText->setText(getString("ItemsIdentical"));
+ }
+ else if (mSourceUUID.notNull())
+ {
+ updateFoundLinks();
+ }
+
+ mStartBtn->setEnabled(mRemainingItems > 0 && mSourceUUID.notNull() && mTargetUUID.notNull() && mSourceUUID != mTargetUUID);
}
void LLFloaterLinkReplace::onStartClicked()
{
- LL_INFOS() << "Starting inventory link replace" << LL_ENDL;
-
- if (mSourceUUID.isNull() || mTargetUUID.isNull())
- {
- LL_WARNS() << "Cannot replace. Either source or target UUID is null." << LL_ENDL;
- return;
- }
-
- if (mSourceUUID == mTargetUUID)
- {
- LL_WARNS() << "Cannot replace. Source and target are identical." << LL_ENDL;
- return;
- }
-
- const LLUUID& source_item_id = gInventory.getLinkedItemID(mSourceUUID);
- LLViewerInventoryItem *source_item = gInventory.getItem(source_item_id);
- const LLUUID& target_item_id = gInventory.getLinkedItemID(mTargetUUID);
- LLViewerInventoryItem *target_item = gInventory.getItem(target_item_id);
-
-
- LLNotification::Params params("ConfirmReplaceLink");
- params.functor.function(boost::bind(&LLFloaterLinkReplace::onStartClickedResponse, this, _1, _2));
- if (source_item && source_item->isWearableType() && source_item->getWearableType() <= LLWearableType::WT_EYES)
- {
- if(target_item && target_item->isWearableType() && source_item->getWearableType() == target_item->getWearableType())
- {
- LLNotifications::instance().forceResponse(params, 0);
- }
- else
- {
- LLSD args;
- args["TYPE"] = LLWearableType::getInstance()->getTypeName(source_item->getWearableType());
- params.substitutions(args);
- LLNotifications::instance().add(params);
- }
- }
- else
- {
- LLNotifications::instance().forceResponse(params, 0);
- }
+ LL_INFOS() << "Starting inventory link replace" << LL_ENDL;
+
+ if (mSourceUUID.isNull() || mTargetUUID.isNull())
+ {
+ LL_WARNS() << "Cannot replace. Either source or target UUID is null." << LL_ENDL;
+ return;
+ }
+
+ if (mSourceUUID == mTargetUUID)
+ {
+ LL_WARNS() << "Cannot replace. Source and target are identical." << LL_ENDL;
+ return;
+ }
+
+ const LLUUID& source_item_id = gInventory.getLinkedItemID(mSourceUUID);
+ LLViewerInventoryItem *source_item = gInventory.getItem(source_item_id);
+ const LLUUID& target_item_id = gInventory.getLinkedItemID(mTargetUUID);
+ LLViewerInventoryItem *target_item = gInventory.getItem(target_item_id);
+
+
+ LLNotification::Params params("ConfirmReplaceLink");
+ params.functor.function(boost::bind(&LLFloaterLinkReplace::onStartClickedResponse, this, _1, _2));
+ if (source_item && source_item->isWearableType() && source_item->getWearableType() <= LLWearableType::WT_EYES)
+ {
+ if(target_item && target_item->isWearableType() && source_item->getWearableType() == target_item->getWearableType())
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ else
+ {
+ LLSD args;
+ args["TYPE"] = LLWearableType::getInstance()->getTypeName(source_item->getWearableType());
+ params.substitutions(args);
+ LLNotifications::instance().add(params);
+ }
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
}
void LLFloaterLinkReplace::onStartClickedResponse(const LLSD& notification, const LLSD& response)
{
- if (LLNotificationsUtil::getSelectedOption(notification, response) == 0)
- {
-
- LLInventoryModel::cat_array_t cat_array;
- LLLinkedItemIDMatches is_linked_item_match(mSourceUUID);
- gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
- cat_array,
- mRemainingInventoryItems,
- LLInventoryModel::INCLUDE_TRASH,
- is_linked_item_match);
- LL_INFOS() << "Found " << mRemainingInventoryItems.size() << " inventory links that need to be replaced." << LL_ENDL;
-
- if (mRemainingInventoryItems.size() > 0)
- {
- LLViewerInventoryItem* target_item = gInventory.getItem(mTargetUUID);
- if (target_item)
- {
- mRemainingItems = (U32)mRemainingInventoryItems.size();
-
- LLStringUtil::format_map_t args;
- args["NUM"] = llformat("%d", mRemainingItems);
- mStatusText->setText(getString("ItemsRemaining", args));
-
- mStartBtn->setEnabled(FALSE);
- mRefreshBtn->setEnabled(FALSE);
-
- mEventTimer.start();
- tick();
- }
- else
- {
- mStatusText->setText(getString("TargetNotFound"));
- LL_WARNS() << "Link replace target not found." << LL_ENDL;
- }
- }
- }
+ if (LLNotificationsUtil::getSelectedOption(notification, response) == 0)
+ {
+
+ LLInventoryModel::cat_array_t cat_array;
+ LLLinkedItemIDMatches is_linked_item_match(mSourceUUID);
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cat_array,
+ mRemainingInventoryItems,
+ LLInventoryModel::INCLUDE_TRASH,
+ is_linked_item_match);
+ LL_INFOS() << "Found " << mRemainingInventoryItems.size() << " inventory links that need to be replaced." << LL_ENDL;
+
+ if (mRemainingInventoryItems.size() > 0)
+ {
+ LLViewerInventoryItem* target_item = gInventory.getItem(mTargetUUID);
+ if (target_item)
+ {
+ mRemainingItems = (U32)mRemainingInventoryItems.size();
+
+ LLStringUtil::format_map_t args;
+ args["NUM"] = llformat("%d", mRemainingItems);
+ mStatusText->setText(getString("ItemsRemaining", args));
+
+ mStartBtn->setEnabled(FALSE);
+ mRefreshBtn->setEnabled(FALSE);
+
+ mEventTimer.start();
+ tick();
+ }
+ else
+ {
+ mStatusText->setText(getString("TargetNotFound"));
+ LL_WARNS() << "Link replace target not found." << LL_ENDL;
+ }
+ }
+ }
}
// static
void LLFloaterLinkReplace::linkCreatedCallback(LLHandle<LLFloaterLinkReplace> floater_handle, const LLUUID& old_item_id, const LLUUID& target_item_id,
- bool needs_wearable_ordering_update, bool needs_description_update, const LLUUID& outfit_folder_id)
+ bool needs_wearable_ordering_update, bool needs_description_update, const LLUUID& outfit_folder_id)
{
- LL_DEBUGS() << "Inventory link replace:" << LL_NEWLINE
- << " - old_item_id = " << old_item_id.asString() << LL_NEWLINE
- << " - target_item_id = " << target_item_id.asString() << LL_NEWLINE
- << " - order update = " << (needs_wearable_ordering_update ? "true" : "false") << LL_NEWLINE
- << " - description update = " << (needs_description_update ? "true" : "false") << LL_NEWLINE
- << " - outfit_folder_id = " << outfit_folder_id.asString() << LL_ENDL;
-
- // If we are replacing an object, bodypart or gesture link within an outfit folder,
- // we need to change the actual description of the link itself. LLAppearanceMgr *should*
- // have created COF links that will be used to save the outfit with an empty description.
- // Since link_inventory_array() will set the description of the linked item for the link
- // itself, this will lead to a dirty outfit state when the outfit with the replaced
- // link is worn. So we have to correct this.
- if (needs_description_update && outfit_folder_id.notNull())
- {
- LLInventoryModel::item_array_t items;
- LLInventoryModel::cat_array_t cats;
- LLLinkedItemIDMatches is_target_link(target_item_id);
- gInventory.collectDescendentsIf(outfit_folder_id,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_target_link);
-
- for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
- {
- LLPointer<LLViewerInventoryItem> item = *it;
-
- if ((item->getType() == LLAssetType::AT_BODYPART ||
- item->getType() == LLAssetType::AT_OBJECT ||
- item->getType() == LLAssetType::AT_GESTURE)
- && !item->getActualDescription().empty())
- {
- LL_DEBUGS() << "Updating description for " << item->getName() << LL_ENDL;
-
- LLSD updates;
- updates["desc"] = "";
- update_inventory_item(item->getUUID(), updates, LLPointer<LLInventoryCallback>(NULL));
- }
- }
- }
-
- LLUUID outfit_update_folder = LLUUID::null;
- if (needs_wearable_ordering_update && outfit_folder_id.notNull())
- {
- // If a wearable item was involved in the link replace operation and replaced
- // a link in an outfit folder, we need to update the clothing ordering information
- // *after* the original link has been removed. LLAppearanceMgr abuses the actual link
- // description to store the clothing ordering information it. We will have to update
- // the clothing ordering information or the outfit will be in dirty state when worn.
- outfit_update_folder = outfit_folder_id;
- }
-
- LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&LLFloaterLinkReplace::itemRemovedCallback, floater_handle, outfit_update_folder));
- remove_inventory_object(old_item_id, cb);
+ LL_DEBUGS() << "Inventory link replace:" << LL_NEWLINE
+ << " - old_item_id = " << old_item_id.asString() << LL_NEWLINE
+ << " - target_item_id = " << target_item_id.asString() << LL_NEWLINE
+ << " - order update = " << (needs_wearable_ordering_update ? "true" : "false") << LL_NEWLINE
+ << " - description update = " << (needs_description_update ? "true" : "false") << LL_NEWLINE
+ << " - outfit_folder_id = " << outfit_folder_id.asString() << LL_ENDL;
+
+ // If we are replacing an object, bodypart or gesture link within an outfit folder,
+ // we need to change the actual description of the link itself. LLAppearanceMgr *should*
+ // have created COF links that will be used to save the outfit with an empty description.
+ // Since link_inventory_array() will set the description of the linked item for the link
+ // itself, this will lead to a dirty outfit state when the outfit with the replaced
+ // link is worn. So we have to correct this.
+ if (needs_description_update && outfit_folder_id.notNull())
+ {
+ LLInventoryModel::item_array_t items;
+ LLInventoryModel::cat_array_t cats;
+ LLLinkedItemIDMatches is_target_link(target_item_id);
+ gInventory.collectDescendentsIf(outfit_folder_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_target_link);
+
+ for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
+ {
+ LLPointer<LLViewerInventoryItem> item = *it;
+
+ if ((item->getType() == LLAssetType::AT_BODYPART ||
+ item->getType() == LLAssetType::AT_OBJECT ||
+ item->getType() == LLAssetType::AT_GESTURE)
+ && !item->getActualDescription().empty())
+ {
+ LL_DEBUGS() << "Updating description for " << item->getName() << LL_ENDL;
+
+ LLSD updates;
+ updates["desc"] = "";
+ update_inventory_item(item->getUUID(), updates, LLPointer<LLInventoryCallback>(NULL));
+ }
+ }
+ }
+
+ LLUUID outfit_update_folder = LLUUID::null;
+ if (needs_wearable_ordering_update && outfit_folder_id.notNull())
+ {
+ // If a wearable item was involved in the link replace operation and replaced
+ // a link in an outfit folder, we need to update the clothing ordering information
+ // *after* the original link has been removed. LLAppearanceMgr abuses the actual link
+ // description to store the clothing ordering information it. We will have to update
+ // the clothing ordering information or the outfit will be in dirty state when worn.
+ outfit_update_folder = outfit_folder_id;
+ }
+
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&LLFloaterLinkReplace::itemRemovedCallback, floater_handle, outfit_update_folder));
+ remove_inventory_object(old_item_id, cb);
}
// static
void LLFloaterLinkReplace::itemRemovedCallback(LLHandle<LLFloaterLinkReplace> floater_handle, const LLUUID& outfit_folder_id)
{
- if (outfit_folder_id.notNull())
- {
- LLAppearanceMgr::getInstance()->updateClothingOrderingInfo(outfit_folder_id);
- }
-
- if (!floater_handle.isDead())
- {
- floater_handle.get()->decreaseOpenItemCount();
- }
+ if (outfit_folder_id.notNull())
+ {
+ LLAppearanceMgr::getInstance()->updateClothingOrderingInfo(outfit_folder_id);
+ }
+
+ if (!floater_handle.isDead())
+ {
+ floater_handle.get()->decreaseOpenItemCount();
+ }
}
void LLFloaterLinkReplace::decreaseOpenItemCount()
{
- mRemainingItems--;
-
- if (mRemainingItems == 0)
- {
- mStatusText->setText(getString("ReplaceFinished"));
- mStartBtn->setEnabled(TRUE);
- mRefreshBtn->setEnabled(TRUE);
- mEventTimer.stop();
- LL_INFOS() << "Inventory link replace finished." << LL_ENDL;
- }
- else
- {
- LLStringUtil::format_map_t args;
- args["NUM"] = llformat("%d", mRemainingItems);
- mStatusText->setText(getString("ItemsRemaining", args));
- LL_DEBUGS() << "Inventory link replace: " << mRemainingItems << " links remaining..." << LL_ENDL;
- }
+ mRemainingItems--;
+
+ if (mRemainingItems == 0)
+ {
+ mStatusText->setText(getString("ReplaceFinished"));
+ mStartBtn->setEnabled(TRUE);
+ mRefreshBtn->setEnabled(TRUE);
+ mEventTimer.stop();
+ LL_INFOS() << "Inventory link replace finished." << LL_ENDL;
+ }
+ else
+ {
+ LLStringUtil::format_map_t args;
+ args["NUM"] = llformat("%d", mRemainingItems);
+ mStatusText->setText(getString("ItemsRemaining", args));
+ LL_DEBUGS() << "Inventory link replace: " << mRemainingItems << " links remaining..." << LL_ENDL;
+ }
}
BOOL LLFloaterLinkReplace::tick()
{
- LL_DEBUGS() << "Calling tick - remaining items = " << mRemainingInventoryItems.size() << LL_ENDL;
+ LL_DEBUGS() << "Calling tick - remaining items = " << mRemainingInventoryItems.size() << LL_ENDL;
- LLInventoryModel::item_array_t current_batch;
+ LLInventoryModel::item_array_t current_batch;
- for (U32 i = 0; i < mBatchSize; ++i)
- {
- if (!mRemainingInventoryItems.size())
- {
- mEventTimer.stop();
- break;
- }
+ for (U32 i = 0; i < mBatchSize; ++i)
+ {
+ if (!mRemainingInventoryItems.size())
+ {
+ mEventTimer.stop();
+ break;
+ }
- current_batch.push_back(mRemainingInventoryItems.back());
- mRemainingInventoryItems.pop_back();
- }
- processBatch(current_batch);
+ current_batch.push_back(mRemainingInventoryItems.back());
+ mRemainingInventoryItems.pop_back();
+ }
+ processBatch(current_batch);
- return FALSE;
+ return FALSE;
}
void LLFloaterLinkReplace::processBatch(LLInventoryModel::item_array_t items)
{
- const LLViewerInventoryItem* target_item = gInventory.getItem(mTargetUUID);
- const LLUUID cof_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
- const LLUUID outfit_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
-
- for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
- {
- LLPointer<LLInventoryItem> source_item = *it;
-
- if (source_item->getParentUUID() != cof_folder_id)
- {
- bool is_outfit_folder = gInventory.isObjectDescendentOf(source_item->getParentUUID(), outfit_folder_id);
- // If either the new or old item in the COF is a wearable, we need to update wearable ordering after the link has been replaced
- bool needs_wearable_ordering_update = (is_outfit_folder && source_item->getType() == LLAssetType::AT_CLOTHING) || target_item->getType() == LLAssetType::AT_CLOTHING;
- // Other items in the COF need a description update (description of the actual link item must be empty)
- bool needs_description_update = is_outfit_folder && target_item->getType() != LLAssetType::AT_CLOTHING;
-
- LL_DEBUGS() << "is_outfit_folder = " << (is_outfit_folder ? "true" : "false") << LL_NEWLINE
- << "needs_wearable_ordering_update = " << (needs_wearable_ordering_update ? "true" : "false") << LL_NEWLINE
- << "needs_description_update = " << (needs_description_update ? "true" : "false") << LL_ENDL;
-
- LLInventoryObject::const_object_list_t obj_array;
- obj_array.push_back(LLConstPointer<LLInventoryObject>(target_item));
- LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&LLFloaterLinkReplace::linkCreatedCallback,
- getDerivedHandle<LLFloaterLinkReplace>(),
- source_item->getUUID(),
- target_item->getUUID(),
- needs_wearable_ordering_update,
- needs_description_update,
- (is_outfit_folder ? source_item->getParentUUID() : LLUUID::null) ));
- link_inventory_array(source_item->getParentUUID(), obj_array, cb);
- }
- else
- {
- decreaseOpenItemCount();
- }
- }
+ const LLViewerInventoryItem* target_item = gInventory.getItem(mTargetUUID);
+ const LLUUID cof_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ const LLUUID outfit_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+
+ for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
+ {
+ LLPointer<LLInventoryItem> source_item = *it;
+
+ if (source_item->getParentUUID() != cof_folder_id)
+ {
+ bool is_outfit_folder = gInventory.isObjectDescendentOf(source_item->getParentUUID(), outfit_folder_id);
+ // If either the new or old item in the COF is a wearable, we need to update wearable ordering after the link has been replaced
+ bool needs_wearable_ordering_update = (is_outfit_folder && source_item->getType() == LLAssetType::AT_CLOTHING) || target_item->getType() == LLAssetType::AT_CLOTHING;
+ // Other items in the COF need a description update (description of the actual link item must be empty)
+ bool needs_description_update = is_outfit_folder && target_item->getType() != LLAssetType::AT_CLOTHING;
+
+ LL_DEBUGS() << "is_outfit_folder = " << (is_outfit_folder ? "true" : "false") << LL_NEWLINE
+ << "needs_wearable_ordering_update = " << (needs_wearable_ordering_update ? "true" : "false") << LL_NEWLINE
+ << "needs_description_update = " << (needs_description_update ? "true" : "false") << LL_ENDL;
+
+ LLInventoryObject::const_object_list_t obj_array;
+ obj_array.push_back(LLConstPointer<LLInventoryObject>(target_item));
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&LLFloaterLinkReplace::linkCreatedCallback,
+ getDerivedHandle<LLFloaterLinkReplace>(),
+ source_item->getUUID(),
+ target_item->getUUID(),
+ needs_wearable_ordering_update,
+ needs_description_update,
+ (is_outfit_folder ? source_item->getParentUUID() : LLUUID::null) ));
+ link_inventory_array(source_item->getParentUUID(), obj_array, cb);
+ }
+ else
+ {
+ decreaseOpenItemCount();
+ }
+ }
}
@@ -379,51 +379,51 @@ void LLFloaterLinkReplace::processBatch(LLInventoryModel::item_array_t items)
static LLDefaultChildRegistry::Register<LLInventoryLinkReplaceDropTarget> r("inventory_link_replace_drop_target");
BOOL LLInventoryLinkReplaceDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
{
- LLInventoryItem* item = (LLInventoryItem*)cargo_data;
-
- if (cargo_type >= DAD_TEXTURE && cargo_type <= DAD_LINK &&
- item && item->getActualType() != LLAssetType::AT_LINK_FOLDER && item->getType() != LLAssetType::AT_CATEGORY &&
- (
- LLAssetType::lookupCanLink(item->getType()) ||
- (item->getType() == LLAssetType::AT_LINK && !gInventory.getObject(item->getLinkedUUID())) // Broken Link!
- ))
- {
- if (drop)
- {
- setItem(item);
- if (!mDADSignal.empty())
- {
- mDADSignal(mItemID);
- }
- }
- else
- {
- *accept = ACCEPT_YES_SINGLE;
- }
- }
- else
- {
- *accept = ACCEPT_NO;
- }
-
- return TRUE;
+ LLInventoryItem* item = (LLInventoryItem*)cargo_data;
+
+ if (cargo_type >= DAD_TEXTURE && cargo_type <= DAD_LINK &&
+ item && item->getActualType() != LLAssetType::AT_LINK_FOLDER && item->getType() != LLAssetType::AT_CATEGORY &&
+ (
+ LLAssetType::lookupCanLink(item->getType()) ||
+ (item->getType() == LLAssetType::AT_LINK && !gInventory.getObject(item->getLinkedUUID())) // Broken Link!
+ ))
+ {
+ if (drop)
+ {
+ setItem(item);
+ if (!mDADSignal.empty())
+ {
+ mDADSignal(mItemID);
+ }
+ }
+ else
+ {
+ *accept = ACCEPT_YES_SINGLE;
+ }
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ }
+
+ return TRUE;
}
void LLInventoryLinkReplaceDropTarget::setItem(LLInventoryItem* item)
{
- if (item)
- {
- mItemID = item->getLinkedUUID();
- setText(item->getName());
- }
- else
- {
- mItemID.setNull();
- setText(LLStringExplicit(""));
- }
+ if (item)
+ {
+ mItemID = item->getLinkedUUID();
+ setText(item->getName());
+ }
+ else
+ {
+ mItemID.setNull();
+ setText(LLStringExplicit(""));
+ }
}
diff --git a/indra/newview/llfloaterlinkreplace.h b/indra/newview/llfloaterlinkreplace.h
index 060773f93e..0eee0d6935 100644
--- a/indra/newview/llfloaterlinkreplace.h
+++ b/indra/newview/llfloaterlinkreplace.h
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2017&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2017, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,84 +40,84 @@ class LLTextBox;
class LLInventoryLinkReplaceDropTarget : public LLLineEditor
{
public:
- struct Params : public LLInitParam::Block<Params, LLLineEditor::Params>
- {
- Params()
- {}
- };
-
- LLInventoryLinkReplaceDropTarget(const Params& p)
- : LLLineEditor(p) {}
- ~LLInventoryLinkReplaceDropTarget() {}
-
- typedef boost::signals2::signal<void(const LLUUID& id)> item_dad_callback_t;
- boost::signals2::connection setDADCallback(const item_dad_callback_t::slot_type& cb)
- {
- return mDADSignal.connect(cb);
- }
-
- virtual BOOL postBuild()
- {
- setEnabled(FALSE);
- return LLLineEditor::postBuild();
- }
-
- virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
-
- LLUUID getItemID() const { return mItemID; }
- void setItem(LLInventoryItem* item);
+ struct Params : public LLInitParam::Block<Params, LLLineEditor::Params>
+ {
+ Params()
+ {}
+ };
+
+ LLInventoryLinkReplaceDropTarget(const Params& p)
+ : LLLineEditor(p) {}
+ ~LLInventoryLinkReplaceDropTarget() {}
+
+ typedef boost::signals2::signal<void(const LLUUID& id)> item_dad_callback_t;
+ boost::signals2::connection setDADCallback(const item_dad_callback_t::slot_type& cb)
+ {
+ return mDADSignal.connect(cb);
+ }
+
+ virtual BOOL postBuild()
+ {
+ setEnabled(FALSE);
+ return LLLineEditor::postBuild();
+ }
+
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+
+ LLUUID getItemID() const { return mItemID; }
+ void setItem(LLInventoryItem* item);
private:
- LLUUID mItemID;
+ LLUUID mItemID;
- item_dad_callback_t mDADSignal;
+ item_dad_callback_t mDADSignal;
};
class LLFloaterLinkReplace : public LLFloater, LLEventTimer
{
- LOG_CLASS(LLFloaterLinkReplace);
+ LOG_CLASS(LLFloaterLinkReplace);
public:
- LLFloaterLinkReplace(const LLSD& key);
- virtual ~LLFloaterLinkReplace();
+ LLFloaterLinkReplace(const LLSD& key);
+ virtual ~LLFloaterLinkReplace();
- BOOL postBuild();
- virtual void onOpen(const LLSD& key);
+ BOOL postBuild();
+ virtual void onOpen(const LLSD& key);
- virtual BOOL tick();
+ virtual BOOL tick();
private:
- void checkEnableStart();
- void onStartClicked();
- void onStartClickedResponse(const LLSD& notification, const LLSD& response);
- void decreaseOpenItemCount();
- void updateFoundLinks();
- void processBatch(LLInventoryModel::item_array_t items);
-
- static void linkCreatedCallback(LLHandle<LLFloaterLinkReplace> floater_handle, const LLUUID& old_item_id, const LLUUID& target_item_id,
- bool needs_wearable_ordering_update, bool needs_description_update, const LLUUID& outfit_folder_id);
- static void itemRemovedCallback(LLHandle<LLFloaterLinkReplace> floater_handle, const LLUUID& outfit_folder_id);
-
- void onSourceItemDrop(const LLUUID& source_item_id);
- void onTargetItemDrop(const LLUUID& target_item_id);
-
- LLInventoryLinkReplaceDropTarget* mSourceEditor;
- LLInventoryLinkReplaceDropTarget* mTargetEditor;
- LLButton* mStartBtn;
- LLButton* mRefreshBtn;
- LLTextBox* mStatusText;
-
- LLUUID mSourceUUID;
- LLUUID mTargetUUID;
- U32 mRemainingItems;
- U32 mBatchSize;
-
- LLInventoryModel::item_array_t mRemainingInventoryItems;
+ void checkEnableStart();
+ void onStartClicked();
+ void onStartClickedResponse(const LLSD& notification, const LLSD& response);
+ void decreaseOpenItemCount();
+ void updateFoundLinks();
+ void processBatch(LLInventoryModel::item_array_t items);
+
+ static void linkCreatedCallback(LLHandle<LLFloaterLinkReplace> floater_handle, const LLUUID& old_item_id, const LLUUID& target_item_id,
+ bool needs_wearable_ordering_update, bool needs_description_update, const LLUUID& outfit_folder_id);
+ static void itemRemovedCallback(LLHandle<LLFloaterLinkReplace> floater_handle, const LLUUID& outfit_folder_id);
+
+ void onSourceItemDrop(const LLUUID& source_item_id);
+ void onTargetItemDrop(const LLUUID& target_item_id);
+
+ LLInventoryLinkReplaceDropTarget* mSourceEditor;
+ LLInventoryLinkReplaceDropTarget* mTargetEditor;
+ LLButton* mStartBtn;
+ LLButton* mRefreshBtn;
+ LLTextBox* mStatusText;
+
+ LLUUID mSourceUUID;
+ LLUUID mTargetUUID;
+ U32 mRemainingItems;
+ U32 mBatchSize;
+
+ LLInventoryModel::item_array_t mRemainingInventoryItems;
};
#endif // LL_FLOATERLINKREPLACE_H
diff --git a/indra/newview/llfloaterloadprefpreset.cpp b/indra/newview/llfloaterloadprefpreset.cpp
index 8ed76b1df4..77fd37c741 100644
--- a/indra/newview/llfloaterloadprefpreset.cpp
+++ b/indra/newview/llfloaterloadprefpreset.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloateloadprefpreset.cpp
* @brief Floater to load a graphics / camera preset
*
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,28 +36,28 @@
#include "llviewercontrol.h"
LLFloaterLoadPrefPreset::LLFloaterLoadPrefPreset(const LLSD &key)
-: LLFloater(key)
+: LLFloater(key)
{
}
// virtual
BOOL LLFloaterLoadPrefPreset::postBuild()
{
- LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences");
- if (preferences)
- {
- preferences->addDependentFloater(this);
- }
- getChild<LLButton>("ok")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnOk, this));
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnCancel, this));
- LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterLoadPrefPreset::onPresetsListChange, this));
+ LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences");
+ if (preferences)
+ {
+ preferences->addDependentFloater(this);
+ }
+ getChild<LLButton>("ok")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnOk, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnCancel, this));
+ LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterLoadPrefPreset::onPresetsListChange, this));
- return TRUE;
+ return TRUE;
}
void LLFloaterLoadPrefPreset::onOpen(const LLSD& key)
{
- mSubdirectory = key.asString();
+ mSubdirectory = key.asString();
std::string title_type = std::string("title_") + mSubdirectory;
if (hasString(title_type))
{
@@ -70,41 +70,41 @@ void LLFloaterLoadPrefPreset::onOpen(const LLSD& key)
setTitle(title_type);
}
- LLComboBox* combo = getChild<LLComboBox>("preset_combo");
+ LLComboBox* combo = getChild<LLComboBox>("preset_combo");
- EDefaultOptions option = DEFAULT_TOP;
- LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option);
- std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
- if (!preset_graphic_active.empty())
- {
- combo->setSimple(preset_graphic_active);
- }
+ EDefaultOptions option = DEFAULT_TOP;
+ LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option);
+ std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
+ if (!preset_graphic_active.empty())
+ {
+ combo->setSimple(preset_graphic_active);
+ }
}
void LLFloaterLoadPrefPreset::onPresetsListChange()
{
- LLComboBox* combo = getChild<LLComboBox>("preset_combo");
+ LLComboBox* combo = getChild<LLComboBox>("preset_combo");
- EDefaultOptions option = DEFAULT_TOP;
- LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option);
- std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
- if (!preset_graphic_active.empty())
- {
- combo->setSimple(preset_graphic_active);
- }
+ EDefaultOptions option = DEFAULT_TOP;
+ LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option);
+ std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
+ if (!preset_graphic_active.empty())
+ {
+ combo->setSimple(preset_graphic_active);
+ }
}
void LLFloaterLoadPrefPreset::onBtnCancel()
{
- closeFloater();
+ closeFloater();
}
void LLFloaterLoadPrefPreset::onBtnOk()
{
- LLComboBox* combo = getChild<LLComboBox>("preset_combo");
- std::string name = combo->getSimple();
+ LLComboBox* combo = getChild<LLComboBox>("preset_combo");
+ std::string name = combo->getSimple();
- LLPresetsManager::getInstance()->loadPreset(mSubdirectory, name);
+ LLPresetsManager::getInstance()->loadPreset(mSubdirectory, name);
- closeFloater();
+ closeFloater();
}
diff --git a/indra/newview/llfloaterloadprefpreset.h b/indra/newview/llfloaterloadprefpreset.h
index 9471f6f1e1..e0b5b4979e 100644
--- a/indra/newview/llfloaterloadprefpreset.h
+++ b/indra/newview/llfloaterloadprefpreset.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterloadprefpreset.h
* @brief Floater to load a graphics / camera preset
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,18 +36,18 @@ class LLFloaterLoadPrefPreset : public LLFloater
{
public:
- LLFloaterLoadPrefPreset(const LLSD &key);
+ LLFloaterLoadPrefPreset(const LLSD &key);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- void onBtnOk();
- void onBtnCancel();
+ void onBtnOk();
+ void onBtnCancel();
private:
- void onPresetsListChange();
+ void onPresetsListChange();
- std::string mSubdirectory;
+ std::string mSubdirectory;
};
#endif // LL_LLFLOATERLOADPREFPRESET_H
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index fd1af7ccc0..6b7f52b0d0 100755
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatermap.cpp
* @brief The "mini-map" or radar in the upper right part of the screen.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,17 +57,17 @@ const F32 MAP_MINOR_DIR_THRESHOLD = 0.035f;
// Member functions
//
-LLFloaterMap::LLFloaterMap(const LLSD& key)
- : LLFloater(key),
- mTextBoxEast(NULL),
- mTextBoxNorth(NULL),
- mTextBoxWest(NULL),
- mTextBoxSouth(NULL),
- mTextBoxSouthEast(NULL),
- mTextBoxNorthEast(NULL),
- mTextBoxNorthWest(NULL),
- mTextBoxSouthWest(NULL),
- mMap(NULL)
+LLFloaterMap::LLFloaterMap(const LLSD& key)
+ : LLFloater(key),
+ mTextBoxEast(NULL),
+ mTextBoxNorth(NULL),
+ mTextBoxWest(NULL),
+ mTextBoxSouth(NULL),
+ mTextBoxSouthEast(NULL),
+ mTextBoxNorthEast(NULL),
+ mTextBoxNorthWest(NULL),
+ mTextBoxSouthWest(NULL),
+ mMap(NULL)
{
}
@@ -119,32 +119,32 @@ BOOL LLFloaterMap::postBuild()
BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- // If floater is minimized, minimap should be shown on doubleclick (STORM-299)
- if (isMinimized())
- {
- setMinimized(FALSE);
- return TRUE;
- }
-
- LLVector3d pos_global = mMap->viewPosToGlobal(x, y);
-
- LLTracker::stopTracking(false);
- LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance();
- if (world_map)
- {
- world_map->trackLocation(pos_global);
- }
-
- if (gSavedSettings.getBOOL("DoubleClickTeleport"))
- {
- // If DoubleClickTeleport is on, double clicking the minimap will teleport there
- gAgent.teleportViaLocationLookAt(pos_global);
- }
- else if (gSavedSettings.getBOOL("DoubleClickShowWorldMap"))
- {
- LLFloaterReg::showInstance("world_map");
- }
- return TRUE;
+ // If floater is minimized, minimap should be shown on doubleclick (STORM-299)
+ if (isMinimized())
+ {
+ setMinimized(FALSE);
+ return TRUE;
+ }
+
+ LLVector3d pos_global = mMap->viewPosToGlobal(x, y);
+
+ LLTracker::stopTracking(false);
+ LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance();
+ if (world_map)
+ {
+ world_map->trackLocation(pos_global);
+ }
+
+ if (gSavedSettings.getBOOL("DoubleClickTeleport"))
+ {
+ // If DoubleClickTeleport is on, double clicking the minimap will teleport there
+ gAgent.teleportViaLocationLookAt(pos_global);
+ }
+ else if (gSavedSettings.getBOOL("DoubleClickShowWorldMap"))
+ {
+ LLFloaterReg::showInstance("world_map");
+ }
+ return TRUE;
}
void LLFloaterMap::setDirectionPos(LLTextBox *text_box, F32 rotation)
@@ -189,66 +189,66 @@ void LLFloaterMap::setDirectionPos(LLTextBox *text_box, F32 rotation)
void LLFloaterMap::updateMinorDirections()
{
- if (mTextBoxNorthEast == NULL)
- {
- return;
- }
-
- // Hide minor directions if they cover too much of the map
- bool show_minors = mTextBoxNorthEast->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD *
- llmin(getRect().getWidth(), getRect().getHeight());
-
- mTextBoxNorthEast->setVisible(show_minors);
- mTextBoxNorthWest->setVisible(show_minors);
- mTextBoxSouthWest->setVisible(show_minors);
- mTextBoxSouthEast->setVisible(show_minors);
+ if (mTextBoxNorthEast == NULL)
+ {
+ return;
+ }
+
+ // Hide minor directions if they cover too much of the map
+ bool show_minors = mTextBoxNorthEast->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD *
+ llmin(getRect().getWidth(), getRect().getHeight());
+
+ mTextBoxNorthEast->setVisible(show_minors);
+ mTextBoxNorthWest->setVisible(show_minors);
+ mTextBoxSouthWest->setVisible(show_minors);
+ mTextBoxSouthEast->setVisible(show_minors);
}
// virtual
void LLFloaterMap::draw()
{
- F32 rotation = 0;
-
- static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
- if( rotate_map )
- {
- // rotate subsequent draws to agent rotation
- rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
- }
-
- setDirectionPos( mTextBoxEast, rotation );
- setDirectionPos( mTextBoxNorth, rotation + F_PI_BY_TWO );
- setDirectionPos( mTextBoxWest, rotation + F_PI );
- setDirectionPos( mTextBoxSouth, rotation + F_PI + F_PI_BY_TWO );
-
- setDirectionPos( mTextBoxNorthEast, rotation + F_PI_BY_TWO / 2);
- setDirectionPos( mTextBoxNorthWest, rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2);
- setDirectionPos( mTextBoxSouthWest, rotation + F_PI + F_PI_BY_TWO / 2);
- setDirectionPos( mTextBoxSouthEast, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2);
-
- // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong.
- if(gAgentCamera.cameraMouselook())
- {
- setMouseOpaque(FALSE);
- getDragHandle()->setMouseOpaque(FALSE);
- }
- else
- {
- setMouseOpaque(TRUE);
- getDragHandle()->setMouseOpaque(TRUE);
- }
-
- LLFloater::draw();
+ F32 rotation = 0;
+
+ static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
+ if( rotate_map )
+ {
+ // rotate subsequent draws to agent rotation
+ rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
+ }
+
+ setDirectionPos( mTextBoxEast, rotation );
+ setDirectionPos( mTextBoxNorth, rotation + F_PI_BY_TWO );
+ setDirectionPos( mTextBoxWest, rotation + F_PI );
+ setDirectionPos( mTextBoxSouth, rotation + F_PI + F_PI_BY_TWO );
+
+ setDirectionPos( mTextBoxNorthEast, rotation + F_PI_BY_TWO / 2);
+ setDirectionPos( mTextBoxNorthWest, rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2);
+ setDirectionPos( mTextBoxSouthWest, rotation + F_PI + F_PI_BY_TWO / 2);
+ setDirectionPos( mTextBoxSouthEast, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2);
+
+ // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong.
+ if(gAgentCamera.cameraMouselook())
+ {
+ setMouseOpaque(FALSE);
+ getDragHandle()->setMouseOpaque(FALSE);
+ }
+ else
+ {
+ setMouseOpaque(TRUE);
+ getDragHandle()->setMouseOpaque(TRUE);
+ }
+
+ LLFloater::draw();
}
void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- LLFloater::reshape(width, height, called_from_parent);
-
- updateMinorDirections();
+ LLFloater::reshape(width, height, called_from_parent);
+
+ updateMinorDirections();
}
LLFloaterMap* LLFloaterMap::getInstance()
{
- return LLFloaterReg::getTypedInstance<LLFloaterMap>("mini_map");
+ return LLFloaterReg::getTypedInstance<LLFloaterMap>("mini_map");
}
diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h
index 929b1795aa..333424ba71 100644
--- a/indra/newview/llfloatermap.h
+++ b/indra/newview/llfloatermap.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatermap.h
* @brief The "mini-map" or radar in the upper right part of the screen.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,30 +38,30 @@ class LLTextBox;
class LLFloaterMap : public LLFloater
{
public:
- LLFloaterMap(const LLSD& key);
- static LLFloaterMap* getInstance();
- virtual ~LLFloaterMap();
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- /*virtual*/ void draw();
+ LLFloaterMap(const LLSD& key);
+ static LLFloaterMap* getInstance();
+ virtual ~LLFloaterMap();
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ /*virtual*/ void draw();
private:
- void setDirectionPos( LLTextBox* text_box, F32 rotation );
- void updateMinorDirections();
+ void setDirectionPos( LLTextBox* text_box, F32 rotation );
+ void updateMinorDirections();
+
+ LLTextBox* mTextBoxEast;
+ LLTextBox* mTextBoxNorth;
+ LLTextBox* mTextBoxWest;
+ LLTextBox* mTextBoxSouth;
- LLTextBox* mTextBoxEast;
- LLTextBox* mTextBoxNorth;
- LLTextBox* mTextBoxWest;
- LLTextBox* mTextBoxSouth;
+ LLTextBox* mTextBoxSouthEast;
+ LLTextBox* mTextBoxNorthEast;
+ LLTextBox* mTextBoxNorthWest;
+ LLTextBox* mTextBoxSouthWest;
- LLTextBox* mTextBoxSouthEast;
- LLTextBox* mTextBoxNorthEast;
- LLTextBox* mTextBoxNorthWest;
- LLTextBox* mTextBoxSouthWest;
-
- LLNetMap* mMap;
+ LLNetMap* mMap;
};
#endif // LL_LLFLOATERMAP_H
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp
index 6216f4e39a..266648bc54 100644
--- a/indra/newview/llfloatermarketplacelistings.cpp
+++ b/indra/newview/llfloatermarketplacelistings.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatermarketplacelistings.cpp
* @brief Implementation of the marketplace listings floater and panels
* @author merov@lindenlab.com
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -58,21 +58,21 @@ LLPanelMarketplaceListings::LLPanelMarketplaceListings()
, mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME)
, mFilterListingFoldersOnly(false)
{
- mCommitCallbackRegistrar.add("Marketplace.ViewSort.Action", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemClicked, this, _2));
- mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemCheck, this, _2));
+ mCommitCallbackRegistrar.add("Marketplace.ViewSort.Action", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemClicked, this, _2));
+ mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemCheck, this, _2));
}
BOOL LLPanelMarketplaceListings::postBuild()
{
- childSetAction("add_btn", boost::bind(&LLPanelMarketplaceListings::onAddButtonClicked, this));
- childSetAction("audit_btn", boost::bind(&LLPanelMarketplaceListings::onAuditButtonClicked, this));
+ childSetAction("add_btn", boost::bind(&LLPanelMarketplaceListings::onAddButtonClicked, this));
+ childSetAction("audit_btn", boost::bind(&LLPanelMarketplaceListings::onAuditButtonClicked, this));
- mFilterEditor = getChild<LLFilterEditor>("filter_editor");
+ mFilterEditor = getChild<LLFilterEditor>("filter_editor");
mFilterEditor->setCommitCallback(boost::bind(&LLPanelMarketplaceListings::onFilterEdit, this, _2));
-
+
mAuditBtn = getChild<LLButton>("audit_btn");
mAuditBtn->setEnabled(FALSE);
-
+
return LLPanel::postBuild();
}
@@ -98,48 +98,48 @@ void LLPanelMarketplaceListings::buildAllPanels()
// Build the All panel first
LLInventoryPanel* panel_all_items;
panel_all_items = buildInventoryPanel("All Items", "panel_marketplace_listings_inventory.xml");
- panel_all_items->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems");
- panel_all_items->getFilter().markDefault();
-
+ panel_all_items->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems");
+ panel_all_items->getFilter().markDefault();
+
// Build the other panels
LLInventoryPanel* panel;
panel = buildInventoryPanel("Active Items", "panel_marketplace_listings_listed.xml");
- panel->getFilter().setFilterMarketplaceActiveFolders();
- panel->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems");
- panel->getFilter().setDefaultEmptyLookupMessage("MarketplaceNoListing");
- panel->getFilter().markDefault();
+ panel->getFilter().setFilterMarketplaceActiveFolders();
+ panel->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems");
+ panel->getFilter().setDefaultEmptyLookupMessage("MarketplaceNoListing");
+ panel->getFilter().markDefault();
panel = buildInventoryPanel("Inactive Items", "panel_marketplace_listings_unlisted.xml");
- panel->getFilter().setFilterMarketplaceInactiveFolders();
- panel->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems");
- panel->getFilter().setDefaultEmptyLookupMessage("MarketplaceNoListing");
- panel->getFilter().markDefault();
+ panel->getFilter().setFilterMarketplaceInactiveFolders();
+ panel->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems");
+ panel->getFilter().setDefaultEmptyLookupMessage("MarketplaceNoListing");
+ panel->getFilter().markDefault();
panel = buildInventoryPanel("Unassociated Items", "panel_marketplace_listings_unassociated.xml");
- panel->getFilter().setFilterMarketplaceUnassociatedFolders();
- panel->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems");
- panel->getFilter().setDefaultEmptyLookupMessage("MarketplaceNoListing");
- panel->getFilter().markDefault();
+ panel->getFilter().setFilterMarketplaceUnassociatedFolders();
+ panel->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems");
+ panel->getFilter().setDefaultEmptyLookupMessage("MarketplaceNoListing");
+ panel->getFilter().markDefault();
// Set the tab panel
- LLTabContainer* tabs_panel = getChild<LLTabContainer>("marketplace_filter_tabs");
- tabs_panel->setCommitCallback(boost::bind(&LLPanelMarketplaceListings::onTabChange, this));
+ LLTabContainer* tabs_panel = getChild<LLTabContainer>("marketplace_filter_tabs");
+ tabs_panel->setCommitCallback(boost::bind(&LLPanelMarketplaceListings::onTabChange, this));
tabs_panel->selectTabPanel(panel_all_items); // All panel selected by default
mRootFolder = panel_all_items->getRootFolder(); // Keep the root of the all panel
-
+
// Set the default sort order
setSortOrder(gSavedSettings.getU32("MarketplaceListingsSortOrder"));
}
LLInventoryPanel* LLPanelMarketplaceListings::buildInventoryPanel(const std::string& childname, const std::string& filename)
{
- LLTabContainer* tabs_panel = getChild<LLTabContainer>("marketplace_filter_tabs");
+ LLTabContainer* tabs_panel = getChild<LLTabContainer>("marketplace_filter_tabs");
LLInventoryPanel* panel = LLUICtrlFactory::createFromFile<LLInventoryPanel>(filename, tabs_panel, LLInventoryPanel::child_registry_t::instance());
- llassert(panel != NULL);
-
- // Set sort order and callbacks
- panel = getChild<LLInventoryPanel>(childname);
- panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
+ llassert(panel != NULL);
+
+ // Set sort order and callbacks
+ panel = getChild<LLInventoryPanel>(childname);
+ panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2));
-
+
return panel;
}
@@ -147,7 +147,7 @@ void LLPanelMarketplaceListings::setSortOrder(U32 sort_order)
{
mSortOrder = sort_order;
gSavedSettings.setU32("MarketplaceListingsSortOrder", sort_order);
-
+
// Set each panel with that sort order
LLTabContainer* tabs_panel = getChild<LLTabContainer>("marketplace_filter_tabs");
LLInventoryPanel* panel = (LLInventoryPanel*)tabs_panel->getPanelByName("All Items");
@@ -162,15 +162,15 @@ void LLPanelMarketplaceListings::setSortOrder(U32 sort_order)
void LLPanelMarketplaceListings::onFilterEdit(const std::string& search_string)
{
- // Find active panel
- LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel();
- if (panel)
- {
+ // Find active panel
+ LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel();
+ if (panel)
+ {
// Save filter string (needed when switching tabs)
mFilterSubString = search_string;
// Set filter string on active panel
panel->setFilterSubString(mFilterSubString);
- }
+ }
}
void LLPanelMarketplaceListings::draw()
@@ -186,34 +186,34 @@ void LLPanelMarketplaceListings::draw()
LLInventoryModelBackgroundFetch* inst = LLInventoryModelBackgroundFetch::getInstance();
mAuditBtn->setEnabled(inst->isEverythingFetched() && !inst->folderFetchActive());
}
-
- LLPanel::draw();
+
+ LLPanel::draw();
}
void LLPanelMarketplaceListings::onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action)
{
- panel->onSelectionChange(items, user_action);
+ panel->onSelectionChange(items, user_action);
}
bool LLPanelMarketplaceListings::allowDropOnRoot()
{
- LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel();
+ LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel();
return (panel ? panel->getAllowDropOnRoot() : false);
}
void LLPanelMarketplaceListings::onTabChange()
{
- // Find active panel
- LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel();
- if (panel)
- {
+ // Find active panel
+ LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel();
+ if (panel)
+ {
// If the panel doesn't allow drop on root, it doesn't allow the creation of new folder on root either
LLButton* add_btn = getChild<LLButton>("add_btn");
add_btn->setEnabled(panel->getAllowDropOnRoot());
-
+
// Set filter string on active panel
panel->setFilterSubString(mFilterSubString);
-
+
// Show/hide the drop zone and resize the inventory tabs panel accordingly
LLPanel* drop_zone = (LLPanel*)getChild<LLPanel>("marketplace_drop_zone");
bool drop_zone_visible = drop_zone->getVisible();
@@ -226,7 +226,7 @@ void LLPanelMarketplaceListings::onTabChange()
tabs->translate(0,-delta_height);
}
drop_zone->setVisible(panel->getAllowDropOnRoot());
- }
+ }
}
void LLPanelMarketplaceListings::onAddButtonClicked()
@@ -266,11 +266,11 @@ void LLPanelMarketplaceListings::onAuditButtonClicked()
void LLPanelMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata)
{
- std::string chosen_item = userdata.asString();
-
+ std::string chosen_item = userdata.asString();
+
// Sort options
- if ((chosen_item == "sort_by_stock_amount") || (chosen_item == "sort_by_name") || (chosen_item == "sort_by_recent"))
- {
+ if ((chosen_item == "sort_by_stock_amount") || (chosen_item == "sort_by_name") || (chosen_item == "sort_by_recent"))
+ {
// We're making sort options exclusive, default is SO_FOLDERS_BY_NAME
if (chosen_item == "sort_by_stock_amount")
{
@@ -284,7 +284,7 @@ void LLPanelMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata)
{
setSortOrder(LLInventoryFilter::SO_DATE);
}
- }
+ }
// Filter option
else if (chosen_item == "show_only_listing_folders")
{
@@ -304,8 +304,8 @@ void LLPanelMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata)
bool LLPanelMarketplaceListings::onViewSortMenuItemCheck(const LLSD& userdata)
{
- std::string chosen_item = userdata.asString();
-
+ std::string chosen_item = userdata.asString();
+
if ((chosen_item == "sort_by_stock_amount") || (chosen_item == "sort_by_name") || (chosen_item == "sort_by_recent"))
{
if (chosen_item == "sort_by_stock_amount")
@@ -325,7 +325,7 @@ bool LLPanelMarketplaceListings::onViewSortMenuItemCheck(const LLSD& userdata)
{
return mFilterListingFoldersOnly;
}
- return false;
+ return false;
}
///----------------------------------------------------------------------------
@@ -335,29 +335,29 @@ bool LLPanelMarketplaceListings::onViewSortMenuItemCheck(const LLSD& userdata)
class LLMarketplaceListingsAddedObserver : public LLInventoryCategoryAddedObserver
{
public:
- LLMarketplaceListingsAddedObserver(LLFloaterMarketplaceListings * marketplace_listings_floater)
+ LLMarketplaceListingsAddedObserver(LLFloaterMarketplaceListings * marketplace_listings_floater)
: LLInventoryCategoryAddedObserver()
, mMarketplaceListingsFloater(marketplace_listings_floater)
- {
- }
-
- void done()
- {
- for (cat_vec_t::iterator it = mAddedCategories.begin(); it != mAddedCategories.end(); ++it)
- {
- LLViewerInventoryCategory* added_category = *it;
-
- LLFolderType::EType added_category_type = added_category->getPreferredType();
-
- if (added_category_type == LLFolderType::FT_MARKETPLACE_LISTINGS)
- {
- mMarketplaceListingsFloater->initializeMarketPlace();
- }
- }
- }
-
+ {
+ }
+
+ void done()
+ {
+ for (cat_vec_t::iterator it = mAddedCategories.begin(); it != mAddedCategories.end(); ++it)
+ {
+ LLViewerInventoryCategory* added_category = *it;
+
+ LLFolderType::EType added_category_type = added_category->getPreferredType();
+
+ if (added_category_type == LLFolderType::FT_MARKETPLACE_LISTINGS)
+ {
+ mMarketplaceListingsFloater->initializeMarketPlace();
+ }
+ }
+ }
+
private:
- LLFloaterMarketplaceListings * mMarketplaceListingsFloater;
+ LLFloaterMarketplaceListings * mMarketplaceListingsFloater;
};
///----------------------------------------------------------------------------
@@ -382,35 +382,35 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key)
LLFloaterMarketplaceListings::~LLFloaterMarketplaceListings()
{
- if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver))
- {
- gInventory.removeObserver(mCategoriesObserver);
- }
- delete mCategoriesObserver;
-
- if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
- {
- gInventory.removeObserver(mCategoryAddedObserver);
- }
- delete mCategoryAddedObserver;
+ if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver))
+ {
+ gInventory.removeObserver(mCategoriesObserver);
+ }
+ delete mCategoriesObserver;
+
+ if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
+ {
+ gInventory.removeObserver(mCategoryAddedObserver);
+ }
+ delete mCategoryAddedObserver;
}
BOOL LLFloaterMarketplaceListings::postBuild()
{
- mInventoryStatus = getChild<LLTextBox>("marketplace_status");
- mInventoryInitializationInProgress = getChild<LLView>("initialization_progress_indicator");
- mInventoryPlaceholder = getChild<LLView>("marketplace_listings_inventory_placeholder_panel");
- mInventoryText = mInventoryPlaceholder->getChild<LLTextBox>("marketplace_listings_inventory_placeholder_text");
- mInventoryTitle = mInventoryPlaceholder->getChild<LLTextBox>("marketplace_listings_inventory_placeholder_title");
+ mInventoryStatus = getChild<LLTextBox>("marketplace_status");
+ mInventoryInitializationInProgress = getChild<LLView>("initialization_progress_indicator");
+ mInventoryPlaceholder = getChild<LLView>("marketplace_listings_inventory_placeholder_panel");
+ mInventoryText = mInventoryPlaceholder->getChild<LLTextBox>("marketplace_listings_inventory_placeholder_text");
+ mInventoryTitle = mInventoryPlaceholder->getChild<LLTextBox>("marketplace_listings_inventory_placeholder_title");
- mPanelListings = static_cast<LLPanelMarketplaceListings*>(getChild<LLUICtrl>("panel_marketplace_listing"));
+ mPanelListings = static_cast<LLPanelMarketplaceListings*>(getChild<LLUICtrl>("panel_marketplace_listing"));
+
+ LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMarketplaceListings::onFocusReceived, this));
+
+ // Observe category creation to catch marketplace listings creation (moot if already existing)
+ mCategoryAddedObserver = new LLMarketplaceListingsAddedObserver(this);
+ gInventory.addObserver(mCategoryAddedObserver);
- LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMarketplaceListings::onFocusReceived, this));
-
- // Observe category creation to catch marketplace listings creation (moot if already existing)
- mCategoryAddedObserver = new LLMarketplaceListingsAddedObserver(this);
- gInventory.addObserver(mCategoryAddedObserver);
-
// Fetch aggressively so we can interact with listings as soon as possible
if (!fetchContents())
@@ -418,9 +418,9 @@ BOOL LLFloaterMarketplaceListings::postBuild()
const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
LLInventoryModelBackgroundFetch::instance().start(marketplacelistings_id, true);
}
-
- return TRUE;
+
+ return TRUE;
}
void LLFloaterMarketplaceListings::onClose(bool app_quitting)
@@ -429,22 +429,22 @@ void LLFloaterMarketplaceListings::onClose(bool app_quitting)
void LLFloaterMarketplaceListings::onOpen(const LLSD& key)
{
- //
- // Initialize the Market Place or go update the marketplace listings
- //
+ //
+ // Initialize the Market Place or go update the marketplace listings
+ //
if (LLMarketplaceData::instance().getSLMStatus() <= MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE)
- {
- initializeMarketPlace();
- }
+ {
+ initializeMarketPlace();
+ }
else
{
updateView();
- }
+ }
}
void LLFloaterMarketplaceListings::onFocusReceived()
{
- updateView();
+ updateView();
}
bool LLFloaterMarketplaceListings::fetchContents()
@@ -466,18 +466,18 @@ void LLFloaterMarketplaceListings::setRootFolder()
{
if ((LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) &&
(LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_PLACE_MIGRATED_MERCHANT))
- {
- // If we are *not* a merchant or we have no market place connection established yet, do nothing
- return;
- }
+ {
+ // If we are *not* a merchant or we have no market place connection established yet, do nothing
+ return;
+ }
if (!gInventory.isInventoryUsable())
{
return;
}
-
+
LLFolderType::EType preferred_type = LLFolderType::FT_MARKETPLACE_LISTINGS;
- // We are a merchant. Get the Marketplace listings folder, create it if needs be.
- LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(preferred_type);
+ // We are a merchant. Get the Marketplace listings folder, create it if needs be.
+ LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(preferred_type);
if (marketplacelistings_id.isNull())
{
@@ -514,22 +514,22 @@ void LLFloaterMarketplaceListings::setRootFolder()
}
mRootFolderCreating = false;
-
- // No longer need to observe new category creation
- if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
- {
- gInventory.removeObserver(mCategoryAddedObserver);
- delete mCategoryAddedObserver;
- mCategoryAddedObserver = NULL;
- }
- llassert(!mCategoryAddedObserver);
-
+
+ // No longer need to observe new category creation
+ if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
+ {
+ gInventory.removeObserver(mCategoryAddedObserver);
+ delete mCategoryAddedObserver;
+ mCategoryAddedObserver = NULL;
+ }
+ llassert(!mCategoryAddedObserver);
+
if (marketplacelistings_id == mRootFolderId)
{
LL_WARNS("SLM") << "Inventory warning: Marketplace listings folder already set" << LL_ENDL;
return;
}
-
+
mRootFolderId = marketplacelistings_id;
}
@@ -539,16 +539,16 @@ void LLFloaterMarketplaceListings::setPanels()
{
return;
}
-
+
// Consolidate Marketplace listings
// We shouldn't have to do that but with a client/server system relying on a "well known folder" convention,
// things get messy and conventions get broken down eventually
gInventory.consolidateForType(mRootFolderId, LLFolderType::FT_MARKETPLACE_LISTINGS);
-
+
// Now that we do have a non NULL root, we can build the inventory panels
mPanelListings->buildAllPanels();
-
- // Create observer for marketplace listings modifications
+
+ // Create observer for marketplace listings modifications
if (!mCategoriesObserver)
{
mCategoriesObserver = new LLInventoryCategoriesObserver();
@@ -556,10 +556,10 @@ void LLFloaterMarketplaceListings::setPanels()
gInventory.addObserver(mCategoriesObserver);
mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMarketplaceListings::onChanged, this));
}
-
- // Get the content of the marketplace listings folder
- fetchContents();
-
+
+ // Get the content of the marketplace listings folder
+ fetchContents();
+
// Flag that this is done
mPanelListingsSet = true;
}
@@ -571,12 +571,12 @@ void LLFloaterMarketplaceListings::initializeMarketPlace()
S32 LLFloaterMarketplaceListings::getFolderCount()
{
- if (mPanelListings && mRootFolderId.notNull())
- {
+ if (mPanelListings && mRootFolderId.notNull())
+ {
LLInventoryModel::cat_array_t * cats;
LLInventoryModel::item_array_t * items;
gInventory.getDirectDescendentsOf(mRootFolderId, cats, items);
-
+
return (cats->size() + items->size());
}
else
@@ -587,7 +587,7 @@ S32 LLFloaterMarketplaceListings::getFolderCount()
void LLFloaterMarketplaceListings::setStatusString(const std::string& statusString)
{
- mInventoryStatus->setText(statusString);
+ mInventoryStatus->setText(statusString);
}
void LLFloaterMarketplaceListings::updateView()
@@ -595,7 +595,7 @@ void LLFloaterMarketplaceListings::updateView()
U32 mkt_status = LLMarketplaceData::instance().getSLMStatus();
bool is_merchant = (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) || (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MIGRATED_MERCHANT);
U32 data_fetched = LLMarketplaceData::instance().getSLMDataFetched();
-
+
// Get or create the root folder if we are a merchant and it hasn't been done already
if (mRootFolderId.isNull() && is_merchant)
{
@@ -620,27 +620,27 @@ void LLFloaterMarketplaceListings::updateView()
{
mInventoryInitializationInProgress->setVisible(false);
}
-
+
// Update the middle portion : tabs or messages
- if (getFolderCount() > 0)
- {
+ if (getFolderCount() > 0)
+ {
if (!mPanelListingsSet)
{
// We need to rebuild the tabs cleanly the first time we make them visible
setPanels();
}
- mPanelListings->setVisible(TRUE);
- mInventoryPlaceholder->setVisible(FALSE);
- }
- else
- {
+ mPanelListings->setVisible(TRUE);
+ mInventoryPlaceholder->setVisible(FALSE);
+ }
+ else
+ {
mPanelListings->setVisible(FALSE);
- mInventoryPlaceholder->setVisible(TRUE);
-
+ mInventoryPlaceholder->setVisible(TRUE);
+
std::string text;
std::string title;
std::string tooltip;
-
+
const LLSD& subs = LLMarketplaceData::getMarketplaceStringSubstitutions();
// Update the top message or flip to the tabs and folders view
@@ -692,7 +692,7 @@ void LLFloaterMarketplaceListings::updateView()
tooltip = LLTrans::getString("InventoryOutboxErrorTooltip");
LL_WARNS() << "Marketplace status code: " << mkt_status << LL_ENDL;
}
-
+
mInventoryText->setValue(text);
mInventoryTitle->setValue(title);
mInventoryPlaceholder->getParent()->setToolTip(tooltip);
@@ -705,24 +705,24 @@ bool LLFloaterMarketplaceListings::isAccepted(EAcceptance accept)
}
BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
{
// If there's no panel to accept drops or no existing marketplace listings folder, we refuse all drop
- if (!mPanelListings || mRootFolderId.isNull())
- {
- return FALSE;
- }
-
+ if (!mPanelListings || mRootFolderId.isNull())
+ {
+ return FALSE;
+ }
+
tooltip_msg = "";
-
+
// Pass to the children
- LLView * handled_view = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
- BOOL handled = (handled_view != NULL);
-
- // If no one handled it or it was not accepted and we drop on an empty panel, we try to accept it at the floater level
+ LLView * handled_view = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+ BOOL handled = (handled_view != NULL);
+
+ // If no one handled it or it was not accepted and we drop on an empty panel, we try to accept it at the floater level
// as if it was dropped on the marketplace listings root folder
if ((!handled || !isAccepted(*accept)) && !mPanelListings->getVisible() && mRootFolderId.notNull())
{
@@ -733,24 +733,24 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO
LLFolderView* root_folder = mPanelListings->getRootFolder();
handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
}
-
- return handled;
+
+ return handled;
}
BOOL LLFloaterMarketplaceListings::handleHover(S32 x, S32 y, MASK mask)
{
- return LLFloater::handleHover(x, y, mask);
+ return LLFloater::handleHover(x, y, mask);
}
void LLFloaterMarketplaceListings::onMouseLeave(S32 x, S32 y, MASK mask)
{
- LLFloater::onMouseLeave(x, y, mask);
+ LLFloater::onMouseLeave(x, y, mask);
}
void LLFloaterMarketplaceListings::onChanged()
{
LLViewerInventoryCategory* category = gInventory.getCategory(mRootFolderId);
- if (mRootFolderId.notNull() && category)
+ if (mRootFolderId.notNull() && category)
{
updateView();
}
@@ -768,9 +768,9 @@ void LLFloaterMarketplaceListings::onChanged()
// Tell if a listing has one only version folder
bool hasUniqueVersionFolder(const LLUUID& folder_id)
{
- LLInventoryModel::cat_array_t* categories;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(folder_id, categories, items);
+ LLInventoryModel::cat_array_t* categories;
+ LLInventoryModel::item_array_t* items;
+ gInventory.getDirectDescendentsOf(folder_id, categories, items);
return (categories->size() == 1);
}
@@ -782,43 +782,43 @@ LLFloaterAssociateListing::LLFloaterAssociateListing(const LLSD& key)
LLFloaterAssociateListing::~LLFloaterAssociateListing()
{
- gFocusMgr.releaseFocusIfNeeded( this );
+ gFocusMgr.releaseFocusIfNeeded( this );
}
BOOL LLFloaterAssociateListing::postBuild()
{
- getChild<LLButton>("OK")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::apply, this, TRUE));
- getChild<LLButton>("Cancel")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::cancel, this));
- getChild<LLLineEditor>("listing_id")->setPrevalidate(&LLTextValidate::validateNonNegativeS32);
- center();
-
- return LLFloater::postBuild();
+ getChild<LLButton>("OK")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::apply, this, TRUE));
+ getChild<LLButton>("Cancel")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::cancel, this));
+ getChild<LLLineEditor>("listing_id")->setPrevalidate(&LLTextValidate::validateNonNegativeS32);
+ center();
+
+ return LLFloater::postBuild();
}
BOOL LLFloaterAssociateListing::handleKeyHere(KEY key, MASK mask)
{
- if (key == KEY_RETURN && mask == MASK_NONE)
- {
- apply();
- return TRUE;
- }
- else if (key == KEY_ESCAPE && mask == MASK_NONE)
- {
- cancel();
- return TRUE;
- }
-
- return LLFloater::handleKeyHere(key, mask);
+ if (key == KEY_RETURN && mask == MASK_NONE)
+ {
+ apply();
+ return TRUE;
+ }
+ else if (key == KEY_ESCAPE && mask == MASK_NONE)
+ {
+ cancel();
+ return TRUE;
+ }
+
+ return LLFloater::handleKeyHere(key, mask);
}
// static
LLFloaterAssociateListing* LLFloaterAssociateListing::show(const LLUUID& folder_id)
{
- LLFloaterAssociateListing* floater = LLFloaterReg::showTypedInstance<LLFloaterAssociateListing>("associate_listing");
-
- floater->mUUID = folder_id;
-
- return floater;
+ LLFloaterAssociateListing* floater = LLFloaterReg::showTypedInstance<LLFloaterAssociateListing>("associate_listing");
+
+ floater->mUUID = folder_id;
+
+ return floater;
}
// Callback for apply if DAMA required...
@@ -833,8 +833,8 @@ void LLFloaterAssociateListing::callback_apply(const LLSD& notification, const L
void LLFloaterAssociateListing::apply(BOOL user_confirm)
{
- if (mUUID.notNull())
- {
+ if (mUUID.notNull())
+ {
S32 id = (S32)getChild<LLUICtrl>("listing_id")->getValue().asInteger();
if (id > 0)
{
@@ -854,13 +854,13 @@ void LLFloaterAssociateListing::apply(BOOL user_confirm)
{
LLNotificationsUtil::add("AlertMerchantListingInvalidID");
}
- }
- closeFloater();
+ }
+ closeFloater();
}
void LLFloaterAssociateListing::cancel()
{
- closeFloater();
+ closeFloater();
}
//-----------------------------------------------------------------------------
@@ -871,22 +871,22 @@ void LLFloaterAssociateListing::cancel()
// Validates the whole marketplace listings content if UUID is null.
LLFloaterMarketplaceValidation::LLFloaterMarketplaceValidation(const LLSD& key)
-: LLFloater(key),
+: LLFloater(key),
mEditor(NULL)
{
}
BOOL LLFloaterMarketplaceValidation::postBuild()
{
- childSetAction("OK", onOK, this);
-
+ childSetAction("OK", onOK, this);
+
// This widget displays the validation messages
mEditor = getChild<LLTextEditor>("validation_text");
mEditor->setEnabled(FALSE);
mEditor->setFocus(TRUE);
mEditor->setValue(LLSD());
-
- return TRUE;
+
+ return TRUE;
}
LLFloaterMarketplaceValidation::~LLFloaterMarketplaceValidation()
@@ -896,15 +896,15 @@ LLFloaterMarketplaceValidation::~LLFloaterMarketplaceValidation()
// virtual
void LLFloaterMarketplaceValidation::draw()
{
- // draw children
- LLFloater::draw();
+ // draw children
+ LLFloater::draw();
}
void LLFloaterMarketplaceValidation::onOpen(const LLSD& key)
{
// Clear the messages
clearMessages();
-
+
// Get the folder UUID to validate. Use the whole marketplace listing if none provided.
LLUUID cat_id(key.asUUID());
if (cat_id.isNull())
@@ -921,10 +921,10 @@ void LLFloaterMarketplaceValidation::onOpen(const LLSD& key)
boost::bind(&LLFloaterMarketplaceValidation::appendMessage, this, _1, _2, _3),
false);
}
-
+
// Handle the listing folder being processed
handleCurrentListing();
-
+
// Dump result to the editor panel
if (mEditor)
{
@@ -960,10 +960,10 @@ void LLFloaterMarketplaceValidation::onOpen(const LLSD& key)
// static
void LLFloaterMarketplaceValidation::onOK( void* userdata )
{
- // destroys this object
- LLFloaterMarketplaceValidation* self = (LLFloaterMarketplaceValidation*) userdata;
+ // destroys this object
+ LLFloaterMarketplaceValidation* self = (LLFloaterMarketplaceValidation*) userdata;
self->clearMessages();
- self->closeFloater();
+ self->closeFloater();
}
void LLFloaterMarketplaceValidation::appendMessage(std::string& message, S32 depth, LLError::ELevel log_level)
@@ -973,7 +973,7 @@ void LLFloaterMarketplaceValidation::appendMessage(std::string& message, S32 dep
{
handleCurrentListing();
}
-
+
// Store the message in the current listing message list
Message current_message;
current_message.mErrorLevel = log_level;
@@ -995,7 +995,7 @@ void LLFloaterMarketplaceValidation::handleCurrentListing()
mCurrentLine++;
}
}
-
+
// Reset the current listing
mCurrentListingMessages.clear();
mCurrentListingErrorLevel = LLError::LEVEL_INFO;
@@ -1013,7 +1013,7 @@ void LLFloaterMarketplaceValidation::clearMessages()
//-----------------------------------------------------------------------------
LLFloaterItemProperties::LLFloaterItemProperties(const LLSD& key)
-: LLFloater(key)
+: LLFloater(key)
{
}
@@ -1023,14 +1023,14 @@ LLFloaterItemProperties::~LLFloaterItemProperties()
BOOL LLFloaterItemProperties::postBuild()
{
- return LLFloater::postBuild();
+ return LLFloater::postBuild();
}
void LLFloaterItemProperties::onOpen(const LLSD& key)
{
// Tell the panel which item it needs to visualize
LLPanel* panel = findChild<LLPanel>("sidepanel");
-
+
LLSidepanelItemInfo* item_panel = dynamic_cast<LLSidepanelItemInfo*>(panel);
if (item_panel)
{
@@ -1041,7 +1041,7 @@ void LLFloaterItemProperties::onOpen(const LLSD& key)
}
item_panel->setParentFloater(this);
}
-
+
LLSidepanelTaskInfo* task_panel = dynamic_cast<LLSidepanelTaskInfo*>(panel);
if (task_panel)
{
@@ -1050,17 +1050,17 @@ void LLFloaterItemProperties::onOpen(const LLSD& key)
}
LLMultiItemProperties::LLMultiItemProperties(const LLSD& key)
- : LLMultiFloater(LLSD())
+ : LLMultiFloater(LLSD())
{
- // start with a small rect in the top-left corner ; will get resized
- LLRect rect;
- rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 350, 350);
- setRect(rect);
- LLFloater* last_floater = LLFloaterReg::getLastFloaterInGroup(key.asString());
- if (last_floater)
- {
- stackWith(*last_floater);
- }
- setTitle(LLTrans::getString("MultiPropertiesTitle"));
- buildTabContainer();
+ // start with a small rect in the top-left corner ; will get resized
+ LLRect rect;
+ rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 350, 350);
+ setRect(rect);
+ LLFloater* last_floater = LLFloaterReg::getLastFloaterInGroup(key.asString());
+ if (last_floater)
+ {
+ stackWith(*last_floater);
+ }
+ setTitle(LLTrans::getString("MultiPropertiesTitle"));
+ buildTabContainer();
}
diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h
index 78d43f97a9..e7bd5031e9 100644
--- a/indra/newview/llfloatermarketplacelistings.h
+++ b/indra/newview/llfloatermarketplacelistings.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatermarketplacelistings.h
* @brief Implementation of the marketplace listings floater and panels
* @author merov@lindenlab.com
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,36 +52,36 @@ class LLPanelMarketplaceListings : public LLPanel
{
public:
LLPanelMarketplaceListings();
- BOOL postBuild();
- BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
- void draw();
- LLFolderView* getRootFolder() { return mRootFolder; }
+ BOOL postBuild();
+ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+ void draw();
+ LLFolderView* getRootFolder() { return mRootFolder; }
bool allowDropOnRoot();
-
+
void buildAllPanels();
-
+
private:
LLInventoryPanel* buildInventoryPanel(const std::string& childname, const std::string& filename);
// UI callbacks
- void onViewSortMenuItemClicked(const LLSD& userdata);
- bool onViewSortMenuItemCheck(const LLSD& userdata);
- void onAddButtonClicked();
+ void onViewSortMenuItemClicked(const LLSD& userdata);
+ bool onViewSortMenuItemCheck(const LLSD& userdata);
+ void onAddButtonClicked();
void onAuditButtonClicked();
- void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action);
+ void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action);
void onTabChange();
void onFilterEdit(const std::string& search_string);
-
+
void setSortOrder(U32 sort_order);
-
+
LLFolderView* mRootFolder;
LLButton* mAuditBtn;
- LLFilterEditor* mFilterEditor;
- std::string mFilterSubString;
+ LLFilterEditor* mFilterEditor;
+ std::string mFilterSubString;
bool mFilterListingFoldersOnly;
U32 mSortOrder;
};
@@ -93,55 +93,55 @@ private:
class LLFloaterMarketplaceListings : public LLFloater
{
public:
- LLFloaterMarketplaceListings(const LLSD& key);
- ~LLFloaterMarketplaceListings();
-
- void initializeMarketPlace();
-
- // virtuals
- BOOL postBuild();
- BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
-
- void showNotification(const LLNotificationPtr& notification);
-
- BOOL handleHover(S32 x, S32 y, MASK mask);
- void onMouseLeave(S32 x, S32 y, MASK mask);
-
+ LLFloaterMarketplaceListings(const LLSD& key);
+ ~LLFloaterMarketplaceListings();
+
+ void initializeMarketPlace();
+
+ // virtuals
+ BOOL postBuild();
+ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+
+ void showNotification(const LLNotificationPtr& notification);
+
+ BOOL handleHover(S32 x, S32 y, MASK mask);
+ void onMouseLeave(S32 x, S32 y, MASK mask);
+
protected:
- void setRootFolder();
- void setPanels();
+ void setRootFolder();
+ void setPanels();
bool fetchContents();
- void setStatusString(const std::string& statusString);
+ void setStatusString(const std::string& statusString);
+
+ void onClose(bool app_quitting);
+ void onOpen(const LLSD& key);
+ void onFocusReceived();
+ void onChanged();
- void onClose(bool app_quitting);
- void onOpen(const LLSD& key);
- void onFocusReceived();
- void onChanged();
-
bool isAccepted(EAcceptance accept);
-
- void updateView();
-
+
+ void updateView();
+
private:
S32 getFolderCount();
- LLInventoryCategoriesObserver * mCategoriesObserver;
- LLInventoryCategoryAddedObserver * mCategoryAddedObserver;
-
- LLTextBox * mInventoryStatus;
- LLView * mInventoryInitializationInProgress;
- LLView * mInventoryPlaceholder;
- LLTextBox * mInventoryText;
- LLTextBox * mInventoryTitle;
+ LLInventoryCategoriesObserver * mCategoriesObserver;
+ LLInventoryCategoryAddedObserver * mCategoryAddedObserver;
- LLUUID mRootFolderId;
+ LLTextBox * mInventoryStatus;
+ LLView * mInventoryInitializationInProgress;
+ LLView * mInventoryPlaceholder;
+ LLTextBox * mInventoryText;
+ LLTextBox * mInventoryTitle;
+
+ LLUUID mRootFolderId;
bool mRootFolderCreating;
- LLPanelMarketplaceListings * mPanelListings;
+ LLPanelMarketplaceListings * mPanelListings;
bool mPanelListingsSet;
};
@@ -150,23 +150,23 @@ private:
//-----------------------------------------------------------------------------
class LLFloaterAssociateListing : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- virtual BOOL postBuild();
- virtual BOOL handleKeyHere(KEY key, MASK mask);
-
- static LLFloaterAssociateListing* show(const LLUUID& folder_id);
-
+ virtual BOOL postBuild();
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
+
+ static LLFloaterAssociateListing* show(const LLUUID& folder_id);
+
private:
- LLFloaterAssociateListing(const LLSD& key);
- virtual ~LLFloaterAssociateListing();
-
- // UI Callbacks
- void apply(BOOL user_confirm = TRUE);
- void cancel();
+ LLFloaterAssociateListing(const LLSD& key);
+ virtual ~LLFloaterAssociateListing();
+
+ // UI Callbacks
+ void apply(BOOL user_confirm = TRUE);
+ void cancel();
void callback_apply(const LLSD& notification, const LLSD& response);
-
- LLUUID mUUID;
+
+ LLUUID mUUID;
};
//-----------------------------------------------------------------------------
@@ -181,24 +181,24 @@ private:
class LLFloaterMarketplaceValidation : public LLFloater
{
public:
- LLFloaterMarketplaceValidation(const LLSD& key);
- virtual ~LLFloaterMarketplaceValidation();
-
- virtual BOOL postBuild();
- virtual void draw();
- virtual void onOpen(const LLSD& key);
-
+ LLFloaterMarketplaceValidation(const LLSD& key);
+ virtual ~LLFloaterMarketplaceValidation();
+
+ virtual BOOL postBuild();
+ virtual void draw();
+ virtual void onOpen(const LLSD& key);
+
void clearMessages();
void appendMessage(std::string& message, S32 depth, LLError::ELevel log_level);
- static void onOK( void* userdata );
-
+ static void onOK( void* userdata );
+
private:
struct Message {
LLError::ELevel mErrorLevel;
std::string mMessage;
};
- typedef std::vector<Message> message_list_t;
-
+ typedef std::vector<Message> message_list_t;
+
void handleCurrentListing();
message_list_t mCurrentListingMessages;
@@ -206,7 +206,7 @@ private:
message_list_t mMessages;
- LLTextEditor* mEditor;
+ LLTextEditor* mEditor;
};
//-----------------------------------------------------------------------------
@@ -216,19 +216,19 @@ private:
class LLFloaterItemProperties : public LLFloater
{
public:
- LLFloaterItemProperties(const LLSD& key);
- virtual ~LLFloaterItemProperties();
-
- BOOL postBuild();
- virtual void onOpen(const LLSD& key);
-
+ LLFloaterItemProperties(const LLSD& key);
+ virtual ~LLFloaterItemProperties();
+
+ BOOL postBuild();
+ virtual void onOpen(const LLSD& key);
+
private:
};
class LLMultiItemProperties : public LLMultiFloater
{
public:
- LLMultiItemProperties(const LLSD& key);
+ LLMultiItemProperties(const LLSD& key);
};
#endif // LL_LLFLOATERMARKETPLACELISTINGS_H
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp
index b34961e8a2..c1bbbf29be 100644
--- a/indra/newview/llfloatermediasettings.cpp
+++ b/indra/newview/llfloatermediasettings.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatermediasettings.cpp
* @brief Tabbed dialog for media settings - class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,16 +40,16 @@
LLFloaterMediaSettings* LLFloaterMediaSettings::sInstance = NULL;
////////////////////////////////////////////////////////////////////////////////
-//
+//
LLFloaterMediaSettings::LLFloaterMediaSettings(const LLSD& key)
- : LLFloater(key),
- mTabContainer(NULL),
- mPanelMediaSettingsGeneral(NULL),
- mPanelMediaSettingsSecurity(NULL),
- mPanelMediaSettingsPermissions(NULL),
- mIdenticalHasMediaInfo( true ),
- mMultipleMedia(false),
- mMultipleValidMedia(false)
+ : LLFloater(key),
+ mTabContainer(NULL),
+ mPanelMediaSettingsGeneral(NULL),
+ mPanelMediaSettingsSecurity(NULL),
+ mPanelMediaSettingsPermissions(NULL),
+ mIdenticalHasMediaInfo( true ),
+ mMultipleMedia(false),
+ mMultipleValidMedia(false)
{
}
@@ -57,103 +57,103 @@ LLFloaterMediaSettings::LLFloaterMediaSettings(const LLSD& key)
//
LLFloaterMediaSettings::~LLFloaterMediaSettings()
{
- if ( mPanelMediaSettingsGeneral )
- {
- delete mPanelMediaSettingsGeneral;
- mPanelMediaSettingsGeneral = NULL;
- }
-
- if ( mPanelMediaSettingsSecurity )
- {
- delete mPanelMediaSettingsSecurity;
- mPanelMediaSettingsSecurity = NULL;
- }
-
- if ( mPanelMediaSettingsPermissions )
- {
- delete mPanelMediaSettingsPermissions;
- mPanelMediaSettingsPermissions = NULL;
- }
-
- sInstance = NULL;
+ if ( mPanelMediaSettingsGeneral )
+ {
+ delete mPanelMediaSettingsGeneral;
+ mPanelMediaSettingsGeneral = NULL;
+ }
+
+ if ( mPanelMediaSettingsSecurity )
+ {
+ delete mPanelMediaSettingsSecurity;
+ mPanelMediaSettingsSecurity = NULL;
+ }
+
+ if ( mPanelMediaSettingsPermissions )
+ {
+ delete mPanelMediaSettingsPermissions;
+ mPanelMediaSettingsPermissions = NULL;
+ }
+
+ sInstance = NULL;
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLFloaterMediaSettings::postBuild()
{
- mApplyBtn = getChild<LLButton>("Apply");
- mApplyBtn->setClickedCallback(onBtnApply, this);
-
- mCancelBtn = getChild<LLButton>("Cancel");
- mCancelBtn->setClickedCallback(onBtnCancel, this);
-
- mOKBtn = getChild<LLButton>("OK");
- mOKBtn->setClickedCallback(onBtnOK, this);
-
- mTabContainer = getChild<LLTabContainer>( "tab_container" );
-
- mPanelMediaSettingsGeneral = new LLPanelMediaSettingsGeneral();
- mTabContainer->addTabPanel(
- LLTabContainer::TabPanelParams().
- panel(mPanelMediaSettingsGeneral));
- mPanelMediaSettingsGeneral->setParent( this );
-
- // note that "permissions" tab is really "Controls" tab - refs to 'perms' and
- // 'permissions' not changed to 'controls' since we don't want to change
- // shared files in server code and keeping everything the same seemed best.
- mPanelMediaSettingsPermissions = new LLPanelMediaSettingsPermissions();
- mTabContainer->addTabPanel(
- LLTabContainer::TabPanelParams().
- panel(mPanelMediaSettingsPermissions));
-
- mPanelMediaSettingsSecurity = new LLPanelMediaSettingsSecurity();
- mTabContainer->addTabPanel(
- LLTabContainer::TabPanelParams().
- panel(mPanelMediaSettingsSecurity));
- mPanelMediaSettingsSecurity->setParent( this );
-
- // restore the last tab viewed from persistance variable storage
- if (!mTabContainer->selectTab(gSavedSettings.getS32("LastMediaSettingsTab")))
- {
- mTabContainer->selectFirstTab();
- };
-
- sInstance = this;
-
- return TRUE;
+ mApplyBtn = getChild<LLButton>("Apply");
+ mApplyBtn->setClickedCallback(onBtnApply, this);
+
+ mCancelBtn = getChild<LLButton>("Cancel");
+ mCancelBtn->setClickedCallback(onBtnCancel, this);
+
+ mOKBtn = getChild<LLButton>("OK");
+ mOKBtn->setClickedCallback(onBtnOK, this);
+
+ mTabContainer = getChild<LLTabContainer>( "tab_container" );
+
+ mPanelMediaSettingsGeneral = new LLPanelMediaSettingsGeneral();
+ mTabContainer->addTabPanel(
+ LLTabContainer::TabPanelParams().
+ panel(mPanelMediaSettingsGeneral));
+ mPanelMediaSettingsGeneral->setParent( this );
+
+ // note that "permissions" tab is really "Controls" tab - refs to 'perms' and
+ // 'permissions' not changed to 'controls' since we don't want to change
+ // shared files in server code and keeping everything the same seemed best.
+ mPanelMediaSettingsPermissions = new LLPanelMediaSettingsPermissions();
+ mTabContainer->addTabPanel(
+ LLTabContainer::TabPanelParams().
+ panel(mPanelMediaSettingsPermissions));
+
+ mPanelMediaSettingsSecurity = new LLPanelMediaSettingsSecurity();
+ mTabContainer->addTabPanel(
+ LLTabContainer::TabPanelParams().
+ panel(mPanelMediaSettingsSecurity));
+ mPanelMediaSettingsSecurity->setParent( this );
+
+ // restore the last tab viewed from persistance variable storage
+ if (!mTabContainer->selectTab(gSavedSettings.getS32("LastMediaSettingsTab")))
+ {
+ mTabContainer->selectFirstTab();
+ };
+
+ sInstance = this;
+
+ return TRUE;
}
-//static
+//static
LLFloaterMediaSettings* LLFloaterMediaSettings::getInstance()
{
- if ( !sInstance )
- {
- sInstance = (LLFloaterReg::getTypedInstance<LLFloaterMediaSettings>("media_settings"));
- }
-
- return sInstance;
+ if ( !sInstance )
+ {
+ sInstance = (LLFloaterReg::getTypedInstance<LLFloaterMediaSettings>("media_settings"));
+ }
+
+ return sInstance;
}
-//static
+//static
void LLFloaterMediaSettings::apply()
{
- if (sInstance->haveValuesChanged())
- {
- LLSD settings;
- sInstance->mPanelMediaSettingsGeneral->preApply();
- sInstance->mPanelMediaSettingsGeneral->getValues( settings, false );
- sInstance->mPanelMediaSettingsSecurity->preApply();
- sInstance->mPanelMediaSettingsSecurity->getValues( settings, false );
- sInstance->mPanelMediaSettingsPermissions->preApply();
- sInstance->mPanelMediaSettingsPermissions->getValues( settings, false );
-
- LLSelectMgr::getInstance()->selectionSetMedia( LLTextureEntry::MF_HAS_MEDIA, settings );
-
- sInstance->mPanelMediaSettingsGeneral->postApply();
- sInstance->mPanelMediaSettingsSecurity->postApply();
- sInstance->mPanelMediaSettingsPermissions->postApply();
- }
+ if (sInstance->haveValuesChanged())
+ {
+ LLSD settings;
+ sInstance->mPanelMediaSettingsGeneral->preApply();
+ sInstance->mPanelMediaSettingsGeneral->getValues( settings, false );
+ sInstance->mPanelMediaSettingsSecurity->preApply();
+ sInstance->mPanelMediaSettingsSecurity->getValues( settings, false );
+ sInstance->mPanelMediaSettingsPermissions->preApply();
+ sInstance->mPanelMediaSettingsPermissions->getValues( settings, false );
+
+ LLSelectMgr::getInstance()->selectionSetMedia( LLTextureEntry::MF_HAS_MEDIA, settings );
+
+ sInstance->mPanelMediaSettingsGeneral->postApply();
+ sInstance->mPanelMediaSettingsSecurity->postApply();
+ sInstance->mPanelMediaSettingsPermissions->postApply();
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -171,94 +171,94 @@ void LLFloaterMediaSettings::onOpen(const LLSD& key)
////////////////////////////////////////////////////////////////////////////////
void LLFloaterMediaSettings::onClose(bool app_quitting)
{
- if(mPanelMediaSettingsGeneral)
- {
- mPanelMediaSettingsGeneral->onClose(app_quitting);
- }
- LLFloaterReg::hideInstance("whitelist_entry");
+ if(mPanelMediaSettingsGeneral)
+ {
+ mPanelMediaSettingsGeneral->onClose(app_quitting);
+ }
+ LLFloaterReg::hideInstance("whitelist_entry");
}
////////////////////////////////////////////////////////////////////////////////
-//static
+//static
void LLFloaterMediaSettings::initValues( const LLSD& media_settings, bool editable )
{
- if (sInstance->hasFocus()) return;
-
- // Clear values
- sInstance->mPanelMediaSettingsGeneral->clearValues(sInstance->mPanelMediaSettingsGeneral, editable, false /*don't update preview*/);
- sInstance->mPanelMediaSettingsSecurity->clearValues(sInstance->mPanelMediaSettingsSecurity, editable);
- sInstance->mPanelMediaSettingsPermissions->clearValues(sInstance->mPanelMediaSettingsPermissions, editable);
-
- // update all panels with values from simulator
- sInstance->mPanelMediaSettingsGeneral->
- initValues( sInstance->mPanelMediaSettingsGeneral, media_settings, editable );
-
- sInstance->mPanelMediaSettingsSecurity->
- initValues( sInstance->mPanelMediaSettingsSecurity, media_settings, editable );
-
- sInstance->mPanelMediaSettingsPermissions->
- initValues( sInstance->mPanelMediaSettingsPermissions, media_settings, editable );
-
- // Squirrel away initial values
- sInstance->mInitialValues.clear();
- sInstance->mPanelMediaSettingsGeneral->getValues( sInstance->mInitialValues );
- sInstance->mPanelMediaSettingsSecurity->getValues( sInstance->mInitialValues );
- sInstance->mPanelMediaSettingsPermissions->getValues( sInstance->mInitialValues );
-
- sInstance->mApplyBtn->setEnabled(editable);
- sInstance->mOKBtn->setEnabled(editable);
+ if (sInstance->hasFocus()) return;
+
+ // Clear values
+ sInstance->mPanelMediaSettingsGeneral->clearValues(sInstance->mPanelMediaSettingsGeneral, editable, false /*don't update preview*/);
+ sInstance->mPanelMediaSettingsSecurity->clearValues(sInstance->mPanelMediaSettingsSecurity, editable);
+ sInstance->mPanelMediaSettingsPermissions->clearValues(sInstance->mPanelMediaSettingsPermissions, editable);
+
+ // update all panels with values from simulator
+ sInstance->mPanelMediaSettingsGeneral->
+ initValues( sInstance->mPanelMediaSettingsGeneral, media_settings, editable );
+
+ sInstance->mPanelMediaSettingsSecurity->
+ initValues( sInstance->mPanelMediaSettingsSecurity, media_settings, editable );
+
+ sInstance->mPanelMediaSettingsPermissions->
+ initValues( sInstance->mPanelMediaSettingsPermissions, media_settings, editable );
+
+ // Squirrel away initial values
+ sInstance->mInitialValues.clear();
+ sInstance->mPanelMediaSettingsGeneral->getValues( sInstance->mInitialValues );
+ sInstance->mPanelMediaSettingsSecurity->getValues( sInstance->mInitialValues );
+ sInstance->mPanelMediaSettingsPermissions->getValues( sInstance->mInitialValues );
+
+ sInstance->mApplyBtn->setEnabled(editable);
+ sInstance->mOKBtn->setEnabled(editable);
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
void LLFloaterMediaSettings::commitFields()
{
- if (hasFocus())
- {
- LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- if (cur_focus && cur_focus->acceptsTextInput())
- {
- cur_focus->onCommit();
- };
- };
+ if (hasFocus())
+ {
+ LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
+ if (cur_focus && cur_focus->acceptsTextInput())
+ {
+ cur_focus->onCommit();
+ };
+ };
}
////////////////////////////////////////////////////////////////////////////////
-//static
+//static
void LLFloaterMediaSettings::clearValues( bool editable)
{
- if (sInstance)
- {
- // clean up all panels before updating
- sInstance->mPanelMediaSettingsGeneral ->clearValues(sInstance->mPanelMediaSettingsGeneral, editable);
- sInstance->mPanelMediaSettingsSecurity ->clearValues(sInstance->mPanelMediaSettingsSecurity, editable);
- sInstance->mPanelMediaSettingsPermissions->clearValues(sInstance->mPanelMediaSettingsPermissions, editable);
- }
+ if (sInstance)
+ {
+ // clean up all panels before updating
+ sInstance->mPanelMediaSettingsGeneral ->clearValues(sInstance->mPanelMediaSettingsGeneral, editable);
+ sInstance->mPanelMediaSettingsSecurity ->clearValues(sInstance->mPanelMediaSettingsSecurity, editable);
+ sInstance->mPanelMediaSettingsPermissions->clearValues(sInstance->mPanelMediaSettingsPermissions, editable);
+ }
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLFloaterMediaSettings::onBtnOK( void* userdata )
{
- sInstance->commitFields();
+ sInstance->commitFields();
- sInstance->apply();
+ sInstance->apply();
- sInstance->closeFloater();
+ sInstance->closeFloater();
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLFloaterMediaSettings::onBtnApply( void* userdata )
{
- sInstance->commitFields();
+ sInstance->commitFields();
- sInstance->apply();
+ sInstance->apply();
- sInstance->mInitialValues.clear();
- sInstance->mPanelMediaSettingsGeneral->getValues( sInstance->mInitialValues );
- sInstance->mPanelMediaSettingsSecurity->getValues( sInstance->mInitialValues );
- sInstance->mPanelMediaSettingsPermissions->getValues( sInstance->mInitialValues );
+ sInstance->mInitialValues.clear();
+ sInstance->mPanelMediaSettingsGeneral->getValues( sInstance->mInitialValues );
+ sInstance->mPanelMediaSettingsSecurity->getValues( sInstance->mInitialValues );
+ sInstance->mPanelMediaSettingsPermissions->getValues( sInstance->mInitialValues );
}
@@ -266,70 +266,70 @@ void LLFloaterMediaSettings::onBtnApply( void* userdata )
// static
void LLFloaterMediaSettings::onBtnCancel( void* userdata )
{
- sInstance->closeFloater();
+ sInstance->closeFloater();
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLFloaterMediaSettings::onTabChanged(void* user_data, bool from_click)
{
- LLTabContainer* self = (LLTabContainer*)user_data;
- gSavedSettings.setS32("LastMediaSettingsTab", self->getCurrentPanelIndex());
+ LLTabContainer* self = (LLTabContainer*)user_data;
+ gSavedSettings.setS32("LastMediaSettingsTab", self->getCurrentPanelIndex());
}
////////////////////////////////////////////////////////////////////////////////
//
const std::string LLFloaterMediaSettings::getHomeUrl()
{
- if ( mPanelMediaSettingsGeneral )
- return mPanelMediaSettingsGeneral->getHomeUrl();
- else
- return std::string( "" );
+ if ( mPanelMediaSettingsGeneral )
+ return mPanelMediaSettingsGeneral->getHomeUrl();
+ else
+ return std::string( "" );
}
////////////////////////////////////////////////////////////////////////////////
-// virtual
+// virtual
void LLFloaterMediaSettings::draw()
{
- if (NULL != mApplyBtn)
- {
- // Set the enabled state of the "Apply" button if values changed
- mApplyBtn->setEnabled( haveValuesChanged() );
- }
-
- LLFloater::draw();
+ if (NULL != mApplyBtn)
+ {
+ // Set the enabled state of the "Apply" button if values changed
+ mApplyBtn->setEnabled( haveValuesChanged() );
+ }
+
+ LLFloater::draw();
}
//private
bool LLFloaterMediaSettings::haveValuesChanged() const
{
- bool values_changed = false;
- // *NOTE: The code below is very inefficient. Better to do this
- // only when data change.
- // Every frame, check to see what the values are. If they are not
- // the same as the initial media data, enable the OK/Apply buttons
- LLSD settings;
- sInstance->mPanelMediaSettingsGeneral->getValues( settings );
- sInstance->mPanelMediaSettingsSecurity->getValues( settings );
- sInstance->mPanelMediaSettingsPermissions->getValues( settings );
- LLSD::map_const_iterator iter = settings.beginMap();
- LLSD::map_const_iterator end = settings.endMap();
- for ( ; iter != end; ++iter )
- {
- const std::string &current_key = iter->first;
- const LLSD &current_value = iter->second;
- if ( ! llsd_equals(current_value, mInitialValues[current_key]))
- {
- values_changed = true;
- break;
- }
- }
- return values_changed;
+ bool values_changed = false;
+ // *NOTE: The code below is very inefficient. Better to do this
+ // only when data change.
+ // Every frame, check to see what the values are. If they are not
+ // the same as the initial media data, enable the OK/Apply buttons
+ LLSD settings;
+ sInstance->mPanelMediaSettingsGeneral->getValues( settings );
+ sInstance->mPanelMediaSettingsSecurity->getValues( settings );
+ sInstance->mPanelMediaSettingsPermissions->getValues( settings );
+ LLSD::map_const_iterator iter = settings.beginMap();
+ LLSD::map_const_iterator end = settings.endMap();
+ for ( ; iter != end; ++iter )
+ {
+ const std::string &current_key = iter->first;
+ const LLSD &current_value = iter->second;
+ if ( ! llsd_equals(current_value, mInitialValues[current_key]))
+ {
+ values_changed = true;
+ break;
+ }
+ }
+ return values_changed;
}
bool LLFloaterMediaSettings::instanceExists()
{
- return LLFloaterReg::findTypedInstance<LLFloaterMediaSettings>("media_settings");
+ return LLFloaterReg::findTypedInstance<LLFloaterMediaSettings>("media_settings");
}
diff --git a/indra/newview/llfloatermediasettings.h b/indra/newview/llfloatermediasettings.h
index 151e43e6b9..ceaea91d23 100644
--- a/indra/newview/llfloatermediasettings.h
+++ b/indra/newview/llfloatermediasettings.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatermediasettings.cpp
* @brief Tabbed dialog for media settings - class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,56 +34,56 @@ class LLPanelMediaSettingsGeneral;
class LLPanelMediaSettingsSecurity;
class LLPanelMediaSettingsPermissions;
-class LLFloaterMediaSettings :
- public LLFloater
+class LLFloaterMediaSettings :
+ public LLFloater
{
-public:
- LLFloaterMediaSettings(const LLSD& key);
- ~LLFloaterMediaSettings();
+public:
+ LLFloaterMediaSettings(const LLSD& key);
+ ~LLFloaterMediaSettings();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void onClose(bool app_quitting);
+
+ static LLFloaterMediaSettings* getInstance();
+ static bool instanceExists();
+ static void apply();
+ static void initValues( const LLSD& media_settings , bool editable);
+ static void clearValues( bool editable);
- static LLFloaterMediaSettings* getInstance();
- static bool instanceExists();
- static void apply();
- static void initValues( const LLSD& media_settings , bool editable);
- static void clearValues( bool editable);
+ LLPanelMediaSettingsSecurity* getPanelSecurity(){return mPanelMediaSettingsSecurity;};
+ const std::string getHomeUrl();
+ //bool passesWhiteList( const std::string& test_url );
- LLPanelMediaSettingsSecurity* getPanelSecurity(){return mPanelMediaSettingsSecurity;};
- const std::string getHomeUrl();
- //bool passesWhiteList( const std::string& test_url );
+ virtual void draw();
- virtual void draw();
+ bool mIdenticalHasMediaInfo;
+ bool mMultipleMedia;
+ bool mMultipleValidMedia;
- bool mIdenticalHasMediaInfo;
- bool mMultipleMedia;
- bool mMultipleValidMedia;
-
protected:
- LLButton *mOKBtn;
- LLButton *mCancelBtn;
- LLButton *mApplyBtn;
+ LLButton *mOKBtn;
+ LLButton *mCancelBtn;
+ LLButton *mApplyBtn;
- LLTabContainer *mTabContainer;
- LLPanelMediaSettingsGeneral* mPanelMediaSettingsGeneral;
- LLPanelMediaSettingsSecurity* mPanelMediaSettingsSecurity;
- LLPanelMediaSettingsPermissions* mPanelMediaSettingsPermissions;
+ LLTabContainer *mTabContainer;
+ LLPanelMediaSettingsGeneral* mPanelMediaSettingsGeneral;
+ LLPanelMediaSettingsSecurity* mPanelMediaSettingsSecurity;
+ LLPanelMediaSettingsPermissions* mPanelMediaSettingsPermissions;
- static void onBtnOK(void*);
- static void onBtnCancel(void*);
- static void onBtnApply(void*);
- static void onTabChanged(void* user_data, bool from_click);
- void commitFields();
+ static void onBtnOK(void*);
+ static void onBtnCancel(void*);
+ static void onBtnApply(void*);
+ static void onTabChanged(void* user_data, bool from_click);
+ void commitFields();
- static LLFloaterMediaSettings* sInstance;
+ static LLFloaterMediaSettings* sInstance;
private:
- bool haveValuesChanged() const;
-
- LLSD mInitialValues;
+ bool haveValuesChanged() const;
+
+ LLSD mInitialValues;
};
#endif // LL_LLFLOATERMEDIASETTINGS_H
diff --git a/indra/newview/llfloatermemleak.cpp b/indra/newview/llfloatermemleak.cpp
index c43526acaf..fda9eeca51 100644
--- a/indra/newview/llfloatermemleak.cpp
+++ b/indra/newview/llfloatermemleak.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatermemleak.cpp
* @brief LLFloatermemleak class definition
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,186 +45,186 @@ BOOL LLFloaterMemLeak::sbAllocationFailed = FALSE ;
extern BOOL gSimulateMemLeak;
LLFloaterMemLeak::LLFloaterMemLeak(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
- setTitle("Memory Leaking Simulation Floater");
- mCommitCallbackRegistrar.add("MemLeak.ChangeLeakingSpeed", boost::bind(&LLFloaterMemLeak::onChangeLeakingSpeed, this));
- mCommitCallbackRegistrar.add("MemLeak.ChangeMaxMemLeaking", boost::bind(&LLFloaterMemLeak::onChangeMaxMemLeaking, this));
- mCommitCallbackRegistrar.add("MemLeak.Start", boost::bind(&LLFloaterMemLeak::onClickStart, this));
- mCommitCallbackRegistrar.add("MemLeak.Stop", boost::bind(&LLFloaterMemLeak::onClickStop, this));
- mCommitCallbackRegistrar.add("MemLeak.Release", boost::bind(&LLFloaterMemLeak::onClickRelease, this));
- mCommitCallbackRegistrar.add("MemLeak.Close", boost::bind(&LLFloaterMemLeak::onClickClose, this));
+ setTitle("Memory Leaking Simulation Floater");
+ mCommitCallbackRegistrar.add("MemLeak.ChangeLeakingSpeed", boost::bind(&LLFloaterMemLeak::onChangeLeakingSpeed, this));
+ mCommitCallbackRegistrar.add("MemLeak.ChangeMaxMemLeaking", boost::bind(&LLFloaterMemLeak::onChangeMaxMemLeaking, this));
+ mCommitCallbackRegistrar.add("MemLeak.Start", boost::bind(&LLFloaterMemLeak::onClickStart, this));
+ mCommitCallbackRegistrar.add("MemLeak.Stop", boost::bind(&LLFloaterMemLeak::onClickStop, this));
+ mCommitCallbackRegistrar.add("MemLeak.Release", boost::bind(&LLFloaterMemLeak::onClickRelease, this));
+ mCommitCallbackRegistrar.add("MemLeak.Close", boost::bind(&LLFloaterMemLeak::onClickClose, this));
}
//----------------------------------------------
-BOOL LLFloaterMemLeak::postBuild(void)
-{
- F32 a, b ;
- a = getChild<LLUICtrl>("leak_speed")->getValue().asReal();
- if(a > (F32)(0xFFFFFFFF))
- {
- sMemLeakingSpeed = 0xFFFFFFFF ;
- }
- else
- {
- sMemLeakingSpeed = (U32)a ;
- }
- b = getChild<LLUICtrl>("max_leak")->getValue().asReal();
- if(b > (F32)0xFFF)
- {
- sMaxLeakedMem = 0xFFFFFFFF ;
- }
- else
- {
- sMaxLeakedMem = ((U32)b) << 20 ;
- }
-
- sbAllocationFailed = FALSE ;
- return TRUE ;
+BOOL LLFloaterMemLeak::postBuild(void)
+{
+ F32 a, b ;
+ a = getChild<LLUICtrl>("leak_speed")->getValue().asReal();
+ if(a > (F32)(0xFFFFFFFF))
+ {
+ sMemLeakingSpeed = 0xFFFFFFFF ;
+ }
+ else
+ {
+ sMemLeakingSpeed = (U32)a ;
+ }
+ b = getChild<LLUICtrl>("max_leak")->getValue().asReal();
+ if(b > (F32)0xFFF)
+ {
+ sMaxLeakedMem = 0xFFFFFFFF ;
+ }
+ else
+ {
+ sMaxLeakedMem = ((U32)b) << 20 ;
+ }
+
+ sbAllocationFailed = FALSE ;
+ return TRUE ;
}
LLFloaterMemLeak::~LLFloaterMemLeak()
{
- release() ;
-
- sMemLeakingSpeed = 0 ; //bytes leaked per frame
- sMaxLeakedMem = 0 ; //maximum allowed leaked memory
+ release() ;
+
+ sMemLeakingSpeed = 0 ; //bytes leaked per frame
+ sMaxLeakedMem = 0 ; //maximum allowed leaked memory
}
void LLFloaterMemLeak::release()
{
- if(mLeakedMem.empty())
- {
- return ;
- }
-
- for(S32 i = 0 ; i < (S32)mLeakedMem.size() ; i++)
- {
- delete[] mLeakedMem[i] ;
- }
- mLeakedMem.clear() ;
-
- sStatus = STOP ;
- sTotalLeaked = 0 ;
- sbAllocationFailed = FALSE ;
- gSimulateMemLeak = FALSE;
+ if(mLeakedMem.empty())
+ {
+ return ;
+ }
+
+ for(S32 i = 0 ; i < (S32)mLeakedMem.size() ; i++)
+ {
+ delete[] mLeakedMem[i] ;
+ }
+ mLeakedMem.clear() ;
+
+ sStatus = STOP ;
+ sTotalLeaked = 0 ;
+ sbAllocationFailed = FALSE ;
+ gSimulateMemLeak = FALSE;
}
void LLFloaterMemLeak::stop()
{
- sStatus = STOP ;
- sbAllocationFailed = TRUE ;
+ sStatus = STOP ;
+ sbAllocationFailed = TRUE ;
}
void LLFloaterMemLeak::idle()
{
- if(STOP == sStatus)
- {
- return ;
- }
-
- sbAllocationFailed = FALSE ;
-
- if(RELEASE == sStatus)
- {
- release() ;
- return ;
- }
-
- char* p = NULL ;
- if(sMemLeakingSpeed > 0 && sTotalLeaked < sMaxLeakedMem)
- {
- p = new char[sMemLeakingSpeed] ;
-
- if(p)
- {
- mLeakedMem.push_back(p) ;
- sTotalLeaked += sMemLeakingSpeed ;
- }
- }
- if(!p)
- {
- stop();
- }
+ if(STOP == sStatus)
+ {
+ return ;
+ }
+
+ sbAllocationFailed = FALSE ;
+
+ if(RELEASE == sStatus)
+ {
+ release() ;
+ return ;
+ }
+
+ char* p = NULL ;
+ if(sMemLeakingSpeed > 0 && sTotalLeaked < sMaxLeakedMem)
+ {
+ p = new char[sMemLeakingSpeed] ;
+
+ if(p)
+ {
+ mLeakedMem.push_back(p) ;
+ sTotalLeaked += sMemLeakingSpeed ;
+ }
+ }
+ if(!p)
+ {
+ stop();
+ }
}
//----------------------
void LLFloaterMemLeak::onChangeLeakingSpeed()
{
- F32 tmp ;
- tmp =getChild<LLUICtrl>("leak_speed")->getValue().asReal();
-
- if(tmp > (F32)0xFFFFFFFF)
- {
- sMemLeakingSpeed = 0xFFFFFFFF ;
- }
- else
- {
- sMemLeakingSpeed = (U32)tmp ;
- }
+ F32 tmp ;
+ tmp =getChild<LLUICtrl>("leak_speed")->getValue().asReal();
+
+ if(tmp > (F32)0xFFFFFFFF)
+ {
+ sMemLeakingSpeed = 0xFFFFFFFF ;
+ }
+ else
+ {
+ sMemLeakingSpeed = (U32)tmp ;
+ }
}
void LLFloaterMemLeak::onChangeMaxMemLeaking()
{
- F32 tmp ;
- tmp =getChild<LLUICtrl>("max_leak")->getValue().asReal();
- if(tmp > (F32)0xFFF)
- {
- sMaxLeakedMem = 0xFFFFFFFF ;
- }
- else
- {
- sMaxLeakedMem = ((U32)tmp) << 20 ;
- }
-
+ F32 tmp ;
+ tmp =getChild<LLUICtrl>("max_leak")->getValue().asReal();
+ if(tmp > (F32)0xFFF)
+ {
+ sMaxLeakedMem = 0xFFFFFFFF ;
+ }
+ else
+ {
+ sMaxLeakedMem = ((U32)tmp) << 20 ;
+ }
+
}
void LLFloaterMemLeak::onClickStart()
{
- sStatus = START ;
- gSimulateMemLeak = TRUE;
+ sStatus = START ;
+ gSimulateMemLeak = TRUE;
}
void LLFloaterMemLeak::onClickStop()
{
- sStatus = STOP ;
+ sStatus = STOP ;
}
void LLFloaterMemLeak::onClickRelease()
{
- sStatus = RELEASE ;
+ sStatus = RELEASE ;
}
void LLFloaterMemLeak::onClickClose()
{
- setVisible(FALSE);
+ setVisible(FALSE);
}
void LLFloaterMemLeak::draw()
{
- //show total memory leaked
- if(sTotalLeaked > 0)
- {
- std::string bytes_string;
- LLResMgr::getInstance()->getIntegerString(bytes_string, sTotalLeaked >> 10 );
- getChild<LLUICtrl>("total_leaked_label")->setTextArg("[SIZE]", bytes_string);
- }
- else
- {
- getChild<LLUICtrl>("total_leaked_label")->setTextArg("[SIZE]", LLStringExplicit("0"));
- }
-
- if(sbAllocationFailed)
- {
- getChild<LLUICtrl>("note_label_1")->setTextArg("[NOTE1]", LLStringExplicit("Memory leaking simulation stops. Reduce leaking speed or"));
- getChild<LLUICtrl>("note_label_2")->setTextArg("[NOTE2]", LLStringExplicit("increase max leaked memory, then press Start to continue."));
- }
- else
- {
- getChild<LLUICtrl>("note_label_1")->setTextArg("[NOTE1]", LLStringExplicit(""));
- getChild<LLUICtrl>("note_label_2")->setTextArg("[NOTE2]", LLStringExplicit(""));
- }
-
- LLFloater::draw();
+ //show total memory leaked
+ if(sTotalLeaked > 0)
+ {
+ std::string bytes_string;
+ LLResMgr::getInstance()->getIntegerString(bytes_string, sTotalLeaked >> 10 );
+ getChild<LLUICtrl>("total_leaked_label")->setTextArg("[SIZE]", bytes_string);
+ }
+ else
+ {
+ getChild<LLUICtrl>("total_leaked_label")->setTextArg("[SIZE]", LLStringExplicit("0"));
+ }
+
+ if(sbAllocationFailed)
+ {
+ getChild<LLUICtrl>("note_label_1")->setTextArg("[NOTE1]", LLStringExplicit("Memory leaking simulation stops. Reduce leaking speed or"));
+ getChild<LLUICtrl>("note_label_2")->setTextArg("[NOTE2]", LLStringExplicit("increase max leaked memory, then press Start to continue."));
+ }
+ else
+ {
+ getChild<LLUICtrl>("note_label_1")->setTextArg("[NOTE1]", LLStringExplicit(""));
+ getChild<LLUICtrl>("note_label_2")->setTextArg("[NOTE2]", LLStringExplicit(""));
+ }
+
+ LLFloater::draw();
}
diff --git a/indra/newview/llfloatermemleak.h b/indra/newview/llfloatermemleak.h
index 86416eaa07..6b760cc236 100644
--- a/indra/newview/llfloatermemleak.h
+++ b/indra/newview/llfloatermemleak.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatermemleak.h
* @brief memory leaking simulation window, debug use only
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,45 +31,45 @@
class LLFloaterMemLeak : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- /// initialize all the callbacks for the menu
+ /// initialize all the callbacks for the menu
+
+ virtual BOOL postBuild() ;
+ virtual void draw() ;
- virtual BOOL postBuild() ;
- virtual void draw() ;
-
- void onChangeLeakingSpeed();
- void onChangeMaxMemLeaking();
- void onClickStart();
- void onClickStop();
- void onClickRelease();
- void onClickClose();
+ void onChangeLeakingSpeed();
+ void onChangeMaxMemLeaking();
+ void onClickStart();
+ void onClickStop();
+ void onClickRelease();
+ void onClickClose();
public:
- void idle() ;
- void stop() ;
+ void idle() ;
+ void stop() ;
private:
-
- LLFloaterMemLeak(const LLSD& key);
- virtual ~LLFloaterMemLeak();
- void release() ;
+
+ LLFloaterMemLeak(const LLSD& key);
+ virtual ~LLFloaterMemLeak();
+ void release() ;
private:
- enum
- {
- RELEASE = -1 ,
- STOP,
- START
- } ;
+ enum
+ {
+ RELEASE = -1 ,
+ STOP,
+ START
+ } ;
- static U32 sMemLeakingSpeed ; //bytes leaked per frame
- static U32 sMaxLeakedMem ; //maximum allowed leaked memory
- static U32 sTotalLeaked ;
- static S32 sStatus ; //0: stop ; >0: start ; <0: release
- static BOOL sbAllocationFailed ;
+ static U32 sMemLeakingSpeed ; //bytes leaked per frame
+ static U32 sMaxLeakedMem ; //maximum allowed leaked memory
+ static U32 sTotalLeaked ;
+ static S32 sStatus ; //0: stop ; >0: start ; <0: release
+ static BOOL sbAllocationFailed ;
- std::vector<char*> mLeakedMem ;
+ std::vector<char*> mLeakedMem ;
};
#endif // LL_LLFLOATERMEMLEAK_H
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index c37d8fae53..0ef7353eac 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -98,27 +98,27 @@ private:
LLMeshFilePicker::LLMeshFilePicker(LLModelPreview* mp, S32 lod)
: LLFilePickerThread(LLFilePicker::FFLOAD_MODEL)
- {
- mMP = mp;
- mLOD = lod;
- }
+ {
+ mMP = mp;
+ mLOD = lod;
+ }
void LLMeshFilePicker::notify(const std::vector<std::string>& filenames)
{
- if(LLAppViewer::instance()->quitRequested())
- {
- return;
- }
-
- if (filenames.size() > 0)
- {
- mMP->loadModel(filenames[0], mLOD);
- }
- else
- {
- //closes floater
- mMP->loadModel(std::string(), mLOD);
- }
+ if(LLAppViewer::instance()->quitRequested())
+ {
+ return;
+ }
+
+ if (filenames.size() > 0)
+ {
+ mMP->loadModel(filenames[0], mLOD);
+ }
+ else
+ {
+ //closes floater
+ mMP->loadModel(std::string(), mLOD);
+ }
}
//-----------------------------------------------------------------------------
@@ -132,17 +132,17 @@ mUploadLogText(NULL),
mTabContainer(NULL),
mAvatarTabIndex(0)
{
- sInstance = this;
- mLastMouseX = 0;
- mLastMouseY = 0;
- mStatusLock = new LLMutex();
- mModelPreview = NULL;
+ sInstance = this;
+ mLastMouseX = 0;
+ mLastMouseY = 0;
+ mStatusLock = new LLMutex();
+ mModelPreview = NULL;
- mLODMode[LLModel::LOD_HIGH] = LLModelPreview::LOD_FROM_FILE;
- for (U32 i = 0; i < LLModel::LOD_HIGH; i++)
- {
- mLODMode[i] = LLModelPreview::MESH_OPTIMIZER_AUTO;
- }
+ mLODMode[LLModel::LOD_HIGH] = LLModelPreview::LOD_FROM_FILE;
+ for (U32 i = 0; i < LLModel::LOD_HIGH; i++)
+ {
+ mLODMode[i] = LLModelPreview::MESH_OPTIMIZER_AUTO;
+ }
}
//-----------------------------------------------------------------------------
@@ -150,140 +150,140 @@ mAvatarTabIndex(0)
//-----------------------------------------------------------------------------
BOOL LLFloaterModelPreview::postBuild()
{
- if (!LLFloater::postBuild())
- {
- return FALSE;
- }
-
- childSetCommitCallback("cancel_btn", onCancel, this);
- childSetCommitCallback("crease_angle", onGenerateNormalsCommit, this);
- getChild<LLCheckBoxCtrl>("gen_normals")->setCommitCallback(boost::bind(&LLFloaterModelPreview::toggleGenarateNormals, this));
+ if (!LLFloater::postBuild())
+ {
+ return FALSE;
+ }
- childSetCommitCallback("lod_generate", onAutoFillCommit, this);
+ childSetCommitCallback("cancel_btn", onCancel, this);
+ childSetCommitCallback("crease_angle", onGenerateNormalsCommit, this);
+ getChild<LLCheckBoxCtrl>("gen_normals")->setCommitCallback(boost::bind(&LLFloaterModelPreview::toggleGenarateNormals, this));
- for (S32 lod = 0; lod <= LLModel::LOD_HIGH; ++lod)
- {
- LLComboBox* lod_source_combo = getChild<LLComboBox>("lod_source_" + lod_name[lod]);
- lod_source_combo->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLoDSourceCommit, this, lod));
- lod_source_combo->setCurrentByIndex(mLODMode[lod]);
+ childSetCommitCallback("lod_generate", onAutoFillCommit, this);
- getChild<LLButton>("lod_browse_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onBrowseLOD, this, lod));
- getChild<LLComboBox>("lod_mode_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, false));
- getChild<LLSpinCtrl>("lod_error_threshold_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, false));
- getChild<LLSpinCtrl>("lod_triangle_limit_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, true));
- }
+ for (S32 lod = 0; lod <= LLModel::LOD_HIGH; ++lod)
+ {
+ LLComboBox* lod_source_combo = getChild<LLComboBox>("lod_source_" + lod_name[lod]);
+ lod_source_combo->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLoDSourceCommit, this, lod));
+ lod_source_combo->setCurrentByIndex(mLODMode[lod]);
+
+ getChild<LLButton>("lod_browse_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onBrowseLOD, this, lod));
+ getChild<LLComboBox>("lod_mode_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, false));
+ getChild<LLSpinCtrl>("lod_error_threshold_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, false));
+ getChild<LLSpinCtrl>("lod_triangle_limit_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, true));
+ }
- // Upload/avatar options, they need to refresh errors/notifications
- childSetCommitCallback("upload_skin", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
- childSetCommitCallback("upload_joints", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
- childSetCommitCallback("lock_scale_if_joint_position", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
- childSetCommitCallback("upload_textures", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
+ // Upload/avatar options, they need to refresh errors/notifications
+ childSetCommitCallback("upload_skin", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
+ childSetCommitCallback("upload_joints", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
+ childSetCommitCallback("lock_scale_if_joint_position", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
+ childSetCommitCallback("upload_textures", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
- childSetTextArg("status", "[STATUS]", getString("status_idle"));
+ childSetTextArg("status", "[STATUS]", getString("status_idle"));
- childSetAction("ok_btn", onUpload, this);
- childDisable("ok_btn");
+ childSetAction("ok_btn", onUpload, this);
+ childDisable("ok_btn");
- childSetAction("reset_btn", onReset, this);
+ childSetAction("reset_btn", onReset, this);
- childSetCommitCallback("preview_lod_combo", onPreviewLODCommit, this);
+ childSetCommitCallback("preview_lod_combo", onPreviewLODCommit, this);
- childSetCommitCallback("import_scale", onImportScaleCommit, this);
- childSetCommitCallback("pelvis_offset", onPelvisOffsetCommit, this);
+ childSetCommitCallback("import_scale", onImportScaleCommit, this);
+ childSetCommitCallback("pelvis_offset", onPelvisOffsetCommit, this);
- getChild<LLLineEditor>("description_form")->setKeystrokeCallback(boost::bind(&LLFloaterModelPreview::onDescriptionKeystroke, this, _1), NULL);
+ getChild<LLLineEditor>("description_form")->setKeystrokeCallback(boost::bind(&LLFloaterModelPreview::onDescriptionKeystroke, this, _1), NULL);
- getChild<LLCheckBoxCtrl>("show_edges")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
- getChild<LLCheckBoxCtrl>("show_physics")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
- getChild<LLCheckBoxCtrl>("show_textures")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
- getChild<LLCheckBoxCtrl>("show_skin_weight")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onShowSkinWeightChecked, this, _1));
- getChild<LLCheckBoxCtrl>("show_joint_overrides")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
- getChild<LLCheckBoxCtrl>("show_joint_positions")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
+ getChild<LLCheckBoxCtrl>("show_edges")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
+ getChild<LLCheckBoxCtrl>("show_physics")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
+ getChild<LLCheckBoxCtrl>("show_textures")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
+ getChild<LLCheckBoxCtrl>("show_skin_weight")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onShowSkinWeightChecked, this, _1));
+ getChild<LLCheckBoxCtrl>("show_joint_overrides")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
+ getChild<LLCheckBoxCtrl>("show_joint_positions")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
- childDisable("upload_skin");
- childDisable("upload_joints");
- childDisable("lock_scale_if_joint_position");
+ childDisable("upload_skin");
+ childDisable("upload_joints");
+ childDisable("lock_scale_if_joint_position");
- childSetVisible("skin_too_many_joints", false);
- childSetVisible("skin_unknown_joint", false);
+ childSetVisible("skin_too_many_joints", false);
+ childSetVisible("skin_unknown_joint", false);
childSetVisible("warning_title", false);
childSetVisible("warning_message", false);
- initDecompControls();
-
- LLView* preview_panel = getChild<LLView>("preview_panel");
-
- mPreviewRect = preview_panel->getRect();
-
- initModelPreview();
-
- //set callbacks for left click on line editor rows
- for (U32 i = 0; i <= LLModel::LOD_HIGH; i++)
- {
- LLTextBox* text = getChild<LLTextBox>(lod_label_name[i]);
- if (text)
- {
- text->setMouseDownCallback(boost::bind(&LLFloaterModelPreview::setPreviewLOD, this, i));
- }
-
- text = getChild<LLTextBox>(lod_triangles_name[i]);
- if (text)
- {
- text->setMouseDownCallback(boost::bind(&LLFloaterModelPreview::setPreviewLOD, this, i));
- }
-
- text = getChild<LLTextBox>(lod_vertices_name[i]);
- if (text)
- {
- text->setMouseDownCallback(boost::bind(&LLFloaterModelPreview::setPreviewLOD, this, i));
- }
-
- text = getChild<LLTextBox>(lod_status_name[i]);
- if (text)
- {
- text->setMouseDownCallback(boost::bind(&LLFloaterModelPreview::setPreviewLOD, this, i));
- }
- }
- std::string current_grid = LLGridManager::getInstance()->getGridId();
- std::transform(current_grid.begin(),current_grid.end(),current_grid.begin(),::tolower);
- std::string validate_url;
- if (current_grid == "agni")
- {
- validate_url = "http://secondlife.com/my/account/mesh.php";
- }
- else if (current_grid == "damballah")
- {
- // Staging grid has its own naming scheme.
- validate_url = "http://secondlife-staging.com/my/account/mesh.php";
- }
- else
- {
- validate_url = llformat("http://secondlife.%s.lindenlab.com/my/account/mesh.php",current_grid.c_str());
- }
- getChild<LLTextBox>("warning_message")->setTextArg("[VURL]", validate_url);
-
- mUploadBtn = getChild<LLButton>("ok_btn");
- mCalculateBtn = getChild<LLButton>("calculate_btn");
- mUploadLogText = getChild<LLViewerTextEditor>("log_text");
- mTabContainer = getChild<LLTabContainer>("import_tab");
+ initDecompControls();
+
+ LLView* preview_panel = getChild<LLView>("preview_panel");
+
+ mPreviewRect = preview_panel->getRect();
+
+ initModelPreview();
+
+ //set callbacks for left click on line editor rows
+ for (U32 i = 0; i <= LLModel::LOD_HIGH; i++)
+ {
+ LLTextBox* text = getChild<LLTextBox>(lod_label_name[i]);
+ if (text)
+ {
+ text->setMouseDownCallback(boost::bind(&LLFloaterModelPreview::setPreviewLOD, this, i));
+ }
+
+ text = getChild<LLTextBox>(lod_triangles_name[i]);
+ if (text)
+ {
+ text->setMouseDownCallback(boost::bind(&LLFloaterModelPreview::setPreviewLOD, this, i));
+ }
+
+ text = getChild<LLTextBox>(lod_vertices_name[i]);
+ if (text)
+ {
+ text->setMouseDownCallback(boost::bind(&LLFloaterModelPreview::setPreviewLOD, this, i));
+ }
+
+ text = getChild<LLTextBox>(lod_status_name[i]);
+ if (text)
+ {
+ text->setMouseDownCallback(boost::bind(&LLFloaterModelPreview::setPreviewLOD, this, i));
+ }
+ }
+ std::string current_grid = LLGridManager::getInstance()->getGridId();
+ std::transform(current_grid.begin(),current_grid.end(),current_grid.begin(),::tolower);
+ std::string validate_url;
+ if (current_grid == "agni")
+ {
+ validate_url = "http://secondlife.com/my/account/mesh.php";
+ }
+ else if (current_grid == "damballah")
+ {
+ // Staging grid has its own naming scheme.
+ validate_url = "http://secondlife-staging.com/my/account/mesh.php";
+ }
+ else
+ {
+ validate_url = llformat("http://secondlife.%s.lindenlab.com/my/account/mesh.php",current_grid.c_str());
+ }
+ getChild<LLTextBox>("warning_message")->setTextArg("[VURL]", validate_url);
+
+ mUploadBtn = getChild<LLButton>("ok_btn");
+ mCalculateBtn = getChild<LLButton>("calculate_btn");
+ mUploadLogText = getChild<LLViewerTextEditor>("log_text");
+ mTabContainer = getChild<LLTabContainer>("import_tab");
LLPanel *panel = mTabContainer->getPanelByName("rigging_panel");
mAvatarTabIndex = mTabContainer->getIndexForPanel(panel);
panel->getChild<LLScrollListCtrl>("joints_list")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onJointListSelection, this));
- if (LLConvexDecomposition::getInstance() != NULL)
- {
- mCalculateBtn->setClickedCallback(boost::bind(&LLFloaterModelPreview::onClickCalculateBtn, this));
+ if (LLConvexDecomposition::getInstance() != NULL)
+ {
+ mCalculateBtn->setClickedCallback(boost::bind(&LLFloaterModelPreview::onClickCalculateBtn, this));
- toggleCalculateButton(true);
- }
- else
- {
- mCalculateBtn->setEnabled(false);
- }
+ toggleCalculateButton(true);
+ }
+ else
+ {
+ mCalculateBtn->setEnabled(false);
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -309,43 +309,43 @@ void LLFloaterModelPreview::reshape(S32 width, S32 height, BOOL called_from_pare
//-----------------------------------------------------------------------------
LLFloaterModelPreview::~LLFloaterModelPreview()
{
- sInstance = NULL;
-
- if ( mModelPreview )
- {
- delete mModelPreview;
- }
+ sInstance = NULL;
+
+ if ( mModelPreview )
+ {
+ delete mModelPreview;
+ }
- delete mStatusLock;
- mStatusLock = NULL;
+ delete mStatusLock;
+ mStatusLock = NULL;
}
void LLFloaterModelPreview::initModelPreview()
{
- if (mModelPreview)
- {
- delete mModelPreview;
- }
+ if (mModelPreview)
+ {
+ delete mModelPreview;
+ }
- S32 tex_width = 512;
- S32 tex_height = 512;
+ S32 tex_width = 512;
+ S32 tex_height = 512;
- S32 max_width = llmin(PREVIEW_RENDER_SIZE, (S32)gPipeline.mRT->width);
- S32 max_height = llmin(PREVIEW_RENDER_SIZE, (S32)gPipeline.mRT->height);
+ S32 max_width = llmin(PREVIEW_RENDER_SIZE, (S32)gPipeline.mRT->width);
+ S32 max_height = llmin(PREVIEW_RENDER_SIZE, (S32)gPipeline.mRT->height);
- while ((tex_width << 1) < max_width)
- {
- tex_width <<= 1;
- }
- while ((tex_height << 1) < max_height)
- {
- tex_height <<= 1;
- }
+ while ((tex_width << 1) < max_width)
+ {
+ tex_width <<= 1;
+ }
+ while ((tex_height << 1) < max_height)
+ {
+ tex_height <<= 1;
+ }
- mModelPreview = new LLModelPreview(tex_width, tex_height, this);
+ mModelPreview = new LLModelPreview(tex_width, tex_height, this);
mModelPreview->setPreviewTarget(PREVIEW_CAMERA_DISTANCE);
- mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3));
- mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::modelUpdated, this, _1));
+ mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3));
+ mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::modelUpdated, this, _1));
}
//static
@@ -361,9 +361,9 @@ bool LLFloaterModelPreview::showModelPreview()
void LLFloaterModelPreview::onUploadOptionChecked(LLUICtrl* ctrl)
{
- if (mModelPreview)
- {
- auto name = ctrl->getName();
+ if (mModelPreview)
+ {
+ auto name = ctrl->getName();
bool value = ctrl->getValue().asBoolean();
// update the option and notifications
// (this is a bit convoluted, because of the current structure of mModelPreview)
@@ -398,119 +398,119 @@ void LLFloaterModelPreview::onUploadOptionChecked(LLUICtrl* ctrl)
}
mModelPreview->refresh(); // a 'dirty' flag for render
- mModelPreview->resetPreviewTarget();
+ mModelPreview->resetPreviewTarget();
mModelPreview->clearBuffers();
mModelPreview->mDirty = true;
}
// set the button visible, it will be refreshed later
- toggleCalculateButton(true);
+ toggleCalculateButton(true);
}
void LLFloaterModelPreview::onShowSkinWeightChecked(LLUICtrl* ctrl)
{
- if (mModelPreview)
- {
- mModelPreview->mCameraOffset.clearVec();
- onViewOptionChecked(ctrl);
- }
+ if (mModelPreview)
+ {
+ mModelPreview->mCameraOffset.clearVec();
+ onViewOptionChecked(ctrl);
+ }
}
void LLFloaterModelPreview::onViewOptionChecked(LLUICtrl* ctrl)
{
- if (mModelPreview)
- {
- auto name = ctrl->getName();
- mModelPreview->mViewOption[name] = !mModelPreview->mViewOption[name];
- if (name == "show_physics")
- {
- auto enabled = mModelPreview->mViewOption[name];
- childSetEnabled("physics_explode", enabled);
- childSetVisible("physics_explode", enabled);
- }
- mModelPreview->refresh();
- }
+ if (mModelPreview)
+ {
+ auto name = ctrl->getName();
+ mModelPreview->mViewOption[name] = !mModelPreview->mViewOption[name];
+ if (name == "show_physics")
+ {
+ auto enabled = mModelPreview->mViewOption[name];
+ childSetEnabled("physics_explode", enabled);
+ childSetVisible("physics_explode", enabled);
+ }
+ mModelPreview->refresh();
+ }
}
bool LLFloaterModelPreview::isViewOptionChecked(const LLSD& userdata)
{
- if (mModelPreview)
- {
- return mModelPreview->mViewOption[userdata.asString()];
- }
+ if (mModelPreview)
+ {
+ return mModelPreview->mViewOption[userdata.asString()];
+ }
- return false;
+ return false;
}
bool LLFloaterModelPreview::isViewOptionEnabled(const LLSD& userdata)
{
- return getChildView(userdata.asString())->getEnabled();
+ return getChildView(userdata.asString())->getEnabled();
}
void LLFloaterModelPreview::setViewOptionEnabled(const std::string& option, bool enabled)
{
- childSetEnabled(option, enabled);
+ childSetEnabled(option, enabled);
}
void LLFloaterModelPreview::enableViewOption(const std::string& option)
{
- setViewOptionEnabled(option, true);
+ setViewOptionEnabled(option, true);
}
void LLFloaterModelPreview::disableViewOption(const std::string& option)
{
- setViewOptionEnabled(option, false);
+ setViewOptionEnabled(option, false);
}
void LLFloaterModelPreview::loadHighLodModel()
{
- mModelPreview->mLookUpLodFiles = true;
- loadModel(3);
+ mModelPreview->mLookUpLodFiles = true;
+ loadModel(3);
}
void LLFloaterModelPreview::prepareToLoadModel(S32 lod)
{
- mModelPreview->mLoading = true;
- if (lod == LLModel::LOD_PHYSICS)
- {
- // loading physics from file
- mModelPreview->mPhysicsSearchLOD = lod;
- mModelPreview->mWarnOfUnmatchedPhyicsMeshes = false;
- }
+ mModelPreview->mLoading = true;
+ if (lod == LLModel::LOD_PHYSICS)
+ {
+ // loading physics from file
+ mModelPreview->mPhysicsSearchLOD = lod;
+ mModelPreview->mWarnOfUnmatchedPhyicsMeshes = false;
+ }
}
void LLFloaterModelPreview::loadModel(S32 lod)
{
- prepareToLoadModel(lod);
- (new LLMeshFilePicker(mModelPreview, lod))->getFile();
+ prepareToLoadModel(lod);
+ (new LLMeshFilePicker(mModelPreview, lod))->getFile();
}
void LLFloaterModelPreview::loadModel(S32 lod, const std::string& file_name, bool force_disable_slm)
{
- prepareToLoadModel(lod);
- mModelPreview->loadModel(file_name, lod, force_disable_slm);
+ prepareToLoadModel(lod);
+ mModelPreview->loadModel(file_name, lod, force_disable_slm);
}
void LLFloaterModelPreview::onClickCalculateBtn()
{
- clearLogTab();
- addStringToLog("Calculating model data.", false);
- mModelPreview->rebuildUploadData();
+ clearLogTab();
+ addStringToLog("Calculating model data.", false);
+ mModelPreview->rebuildUploadData();
- bool upload_skinweights = childGetValue("upload_skin").asBoolean();
- bool upload_joint_positions = childGetValue("upload_joints").asBoolean();
+ bool upload_skinweights = childGetValue("upload_skin").asBoolean();
+ bool upload_joint_positions = childGetValue("upload_joints").asBoolean();
bool lock_scale_if_joint_position = childGetValue("lock_scale_if_joint_position").asBoolean();
mUploadModelUrl.clear();
mModelPhysicsFee.clear();
- gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale,
- childGetValue("upload_textures").asBoolean(),
+ gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale,
+ childGetValue("upload_textures").asBoolean(),
upload_skinweights, upload_joint_positions, lock_scale_if_joint_position,
mUploadModelUrl, false,
- getWholeModelFeeObserverHandle());
+ getWholeModelFeeObserverHandle());
+
+ toggleCalculateButton(false);
+ mUploadBtn->setEnabled(false);
- toggleCalculateButton(false);
- mUploadBtn->setEnabled(false);
-
//disable "simplification" UI
LLPanel* simplification_panel = getChild<LLPanel>("physics simplification");
LLView* child = simplification_panel->getFirstChild();
@@ -649,98 +649,98 @@ void LLFloaterModelPreview::onJointListSelection()
void LLFloaterModelPreview::onDescriptionKeystroke(LLUICtrl* ctrl)
{
- // Workaround for SL-4186, server doesn't allow name changes after 'calculate' stage
- LLLineEditor* input = static_cast<LLLineEditor*>(ctrl);
- if (input->isDirty()) // dirty will be reset after commit
- {
- toggleCalculateButton(true);
- }
+ // Workaround for SL-4186, server doesn't allow name changes after 'calculate' stage
+ LLLineEditor* input = static_cast<LLLineEditor*>(ctrl);
+ if (input->isDirty()) // dirty will be reset after commit
+ {
+ toggleCalculateButton(true);
+ }
}
//static
void LLFloaterModelPreview::onImportScaleCommit(LLUICtrl*,void* userdata)
{
- LLFloaterModelPreview *fp =(LLFloaterModelPreview *)userdata;
+ LLFloaterModelPreview *fp =(LLFloaterModelPreview *)userdata;
- if (!fp->mModelPreview)
- {
- return;
- }
+ if (!fp->mModelPreview)
+ {
+ return;
+ }
- fp->mModelPreview->mDirty = true;
+ fp->mModelPreview->mDirty = true;
- fp->toggleCalculateButton(true);
+ fp->toggleCalculateButton(true);
- fp->mModelPreview->refresh();
+ fp->mModelPreview->refresh();
}
//static
void LLFloaterModelPreview::onPelvisOffsetCommit( LLUICtrl*, void* userdata )
{
- LLFloaterModelPreview *fp =(LLFloaterModelPreview*)userdata;
+ LLFloaterModelPreview *fp =(LLFloaterModelPreview*)userdata;
- if (!fp->mModelPreview)
- {
- return;
- }
+ if (!fp->mModelPreview)
+ {
+ return;
+ }
- fp->mModelPreview->mDirty = true;
+ fp->mModelPreview->mDirty = true;
- fp->toggleCalculateButton(true);
+ fp->toggleCalculateButton(true);
- fp->mModelPreview->refresh();
+ fp->mModelPreview->refresh();
}
//static
void LLFloaterModelPreview::onPreviewLODCommit(LLUICtrl* ctrl, void* userdata)
{
- LLFloaterModelPreview *fp =(LLFloaterModelPreview *)userdata;
+ LLFloaterModelPreview *fp =(LLFloaterModelPreview *)userdata;
- if (!fp->mModelPreview)
- {
- return;
- }
+ if (!fp->mModelPreview)
+ {
+ return;
+ }
- S32 which_mode = 0;
+ S32 which_mode = 0;
- LLComboBox* combo = (LLComboBox*) ctrl;
+ LLComboBox* combo = (LLComboBox*) ctrl;
- which_mode = (NUM_LOD-1)-combo->getFirstSelectedIndex(); // combo box list of lods is in reverse order
+ which_mode = (NUM_LOD-1)-combo->getFirstSelectedIndex(); // combo box list of lods is in reverse order
- fp->mModelPreview->setPreviewLOD(which_mode);
+ fp->mModelPreview->setPreviewLOD(which_mode);
}
//static
void LLFloaterModelPreview::onGenerateNormalsCommit(LLUICtrl* ctrl, void* userdata)
{
- LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata;
+ LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata;
- fp->mModelPreview->generateNormals();
+ fp->mModelPreview->generateNormals();
}
void LLFloaterModelPreview::toggleGenarateNormals()
{
- bool enabled = childGetValue("gen_normals").asBoolean();
- mModelPreview->mViewOption["gen_normals"] = enabled;
- childSetEnabled("crease_angle", enabled);
- if(enabled) {
- mModelPreview->generateNormals();
- } else {
- mModelPreview->restoreNormals();
- }
+ bool enabled = childGetValue("gen_normals").asBoolean();
+ mModelPreview->mViewOption["gen_normals"] = enabled;
+ childSetEnabled("crease_angle", enabled);
+ if(enabled) {
+ mModelPreview->generateNormals();
+ } else {
+ mModelPreview->restoreNormals();
+ }
}
//static
void LLFloaterModelPreview::onExplodeCommit(LLUICtrl* ctrl, void* userdata)
{
- LLFloaterModelPreview* fp = LLFloaterModelPreview::sInstance;
+ LLFloaterModelPreview* fp = LLFloaterModelPreview::sInstance;
- fp->mModelPreview->refresh();
+ fp->mModelPreview->refresh();
}
//static
void LLFloaterModelPreview::onAutoFillCommit(LLUICtrl* ctrl, void* userdata)
{
- LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata;
+ LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata;
fp->mModelPreview->queryLODs();
}
@@ -761,41 +761,41 @@ void LLFloaterModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit)
break;
}
- //refresh LoDs that reference this one
- for (S32 i = lod - 1; i >= 0; --i)
- {
- LLComboBox* lod_source_combo = getChild<LLComboBox>("lod_source_" + lod_name[i]);
- if (lod_source_combo->getCurrentIndex() == LLModelPreview::USE_LOD_ABOVE)
- {
- onLoDSourceCommit(i);
- }
- else
- {
- break;
- }
- }
+ //refresh LoDs that reference this one
+ for (S32 i = lod - 1; i >= 0; --i)
+ {
+ LLComboBox* lod_source_combo = getChild<LLComboBox>("lod_source_" + lod_name[i]);
+ if (lod_source_combo->getCurrentIndex() == LLModelPreview::USE_LOD_ABOVE)
+ {
+ onLoDSourceCommit(i);
+ }
+ else
+ {
+ break;
+ }
+ }
}
void LLFloaterModelPreview::draw3dPreview()
{
- gGL.color3f(1.f, 1.f, 1.f);
+ gGL.color3f(1.f, 1.f, 1.f);
- gGL.getTexUnit(0)->bind(mModelPreview);
+ gGL.getTexUnit(0)->bind(mModelPreview);
- gGL.begin( LLRender::QUADS );
- {
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex2i(mPreviewRect.mLeft+1, mPreviewRect.mTop-1);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2i(mPreviewRect.mLeft+1, mPreviewRect.mBottom+1);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mBottom+1);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mTop-1);
- }
- gGL.end();
+ gGL.begin( LLRender::QUADS );
+ {
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2i(mPreviewRect.mLeft+1, mPreviewRect.mTop-1);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(mPreviewRect.mLeft+1, mPreviewRect.mBottom+1);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mBottom+1);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mTop-1);
+ }
+ gGL.end();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
//-----------------------------------------------------------------------------
@@ -810,40 +810,40 @@ void LLFloaterModelPreview::draw()
return;
}
- mModelPreview->update();
-
- if (!mModelPreview->mLoading)
- {
- if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_MATERIALS )
- {
- childSetTextArg("status", "[STATUS]", getString("status_material_mismatch"));
- }
- else
- if ( mModelPreview->getLoadState() > LLModelLoader::ERROR_MODEL )
- {
- childSetTextArg("status", "[STATUS]", getString(LLModel::getStatusString(mModelPreview->getLoadState() - LLModelLoader::ERROR_MODEL)));
- }
- else
- if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_PARSING )
- {
- childSetTextArg("status", "[STATUS]", getString("status_parse_error"));
- toggleCalculateButton(false);
- }
+ mModelPreview->update();
+
+ if (!mModelPreview->mLoading)
+ {
+ if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_MATERIALS )
+ {
+ childSetTextArg("status", "[STATUS]", getString("status_material_mismatch"));
+ }
+ else
+ if ( mModelPreview->getLoadState() > LLModelLoader::ERROR_MODEL )
+ {
+ childSetTextArg("status", "[STATUS]", getString(LLModel::getStatusString(mModelPreview->getLoadState() - LLModelLoader::ERROR_MODEL)));
+ }
+ else
+ if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_PARSING )
+ {
+ childSetTextArg("status", "[STATUS]", getString("status_parse_error"));
+ toggleCalculateButton(false);
+ }
else
if (mModelPreview->getLoadState() == LLModelLoader::WARNING_BIND_SHAPE_ORIENTATION)
{
- childSetTextArg("status", "[STATUS]", getString("status_bind_shape_orientation"));
+ childSetTextArg("status", "[STATUS]", getString("status_bind_shape_orientation"));
+ }
+ else
+ {
+ childSetTextArg("status", "[STATUS]", getString("status_idle"));
}
- else
- {
- childSetTextArg("status", "[STATUS]", getString("status_idle"));
- }
- }
+ }
if (!isMinimized() && mModelPreview->lodsReady())
- {
- draw3dPreview();
- }
+ {
+ draw3dPreview();
+ }
}
//-----------------------------------------------------------------------------
@@ -851,17 +851,17 @@ void LLFloaterModelPreview::draw()
//-----------------------------------------------------------------------------
BOOL LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if (mPreviewRect.pointInRect(x, y))
- {
- bringToFront( x, y );
- gFocusMgr.setMouseCapture(this);
- gViewerWindow->hideCursor();
- mLastMouseX = x;
- mLastMouseY = y;
- return TRUE;
- }
+ if (mPreviewRect.pointInRect(x, y))
+ {
+ bringToFront( x, y );
+ gFocusMgr.setMouseCapture(this);
+ gViewerWindow->hideCursor();
+ mLastMouseX = x;
+ mLastMouseY = y;
+ return TRUE;
+ }
- return LLFloater::handleMouseDown(x, y, mask);
+ return LLFloater::handleMouseDown(x, y, mask);
}
//-----------------------------------------------------------------------------
@@ -869,66 +869,66 @@ BOOL LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
BOOL LLFloaterModelPreview::handleMouseUp(S32 x, S32 y, MASK mask)
{
- gFocusMgr.setMouseCapture(FALSE);
- gViewerWindow->showCursor();
- return LLFloater::handleMouseUp(x, y, mask);
+ gFocusMgr.setMouseCapture(FALSE);
+ gViewerWindow->showCursor();
+ return LLFloater::handleMouseUp(x, y, mask);
}
//-----------------------------------------------------------------------------
// handleHover()
//-----------------------------------------------------------------------------
-BOOL LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask)
-{
- MASK local_mask = mask & ~MASK_ALT;
-
- if (mModelPreview && hasMouseCapture())
- {
- if (local_mask == MASK_PAN)
- {
- // pan here
- mModelPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f);
- }
- else if (local_mask == MASK_ORBIT)
- {
- F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
- F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f;
-
- mModelPreview->rotate(yaw_radians, pitch_radians);
- }
- else
- {
-
- F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
- F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f;
-
- mModelPreview->rotate(yaw_radians, 0.f);
- mModelPreview->zoom(zoom_amt);
- }
-
-
- mModelPreview->refresh();
-
- LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY);
- }
-
- if (!mPreviewRect.pointInRect(x, y) || !mModelPreview)
- {
- return LLFloater::handleHover(x, y, mask);
- }
- else if (local_mask == MASK_ORBIT)
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA);
- }
- else if (local_mask == MASK_PAN)
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLPAN);
- }
- else
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
- }
-
- return TRUE;
+BOOL LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask)
+{
+ MASK local_mask = mask & ~MASK_ALT;
+
+ if (mModelPreview && hasMouseCapture())
+ {
+ if (local_mask == MASK_PAN)
+ {
+ // pan here
+ mModelPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f);
+ }
+ else if (local_mask == MASK_ORBIT)
+ {
+ F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
+ F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f;
+
+ mModelPreview->rotate(yaw_radians, pitch_radians);
+ }
+ else
+ {
+
+ F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
+ F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f;
+
+ mModelPreview->rotate(yaw_radians, 0.f);
+ mModelPreview->zoom(zoom_amt);
+ }
+
+
+ mModelPreview->refresh();
+
+ LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY);
+ }
+
+ if (!mPreviewRect.pointInRect(x, y) || !mModelPreview)
+ {
+ return LLFloater::handleHover(x, y, mask);
+ }
+ else if (local_mask == MASK_ORBIT)
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA);
+ }
+ else if (local_mask == MASK_PAN)
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLPAN);
+ }
+ else
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
+ }
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -936,383 +936,383 @@ BOOL LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
- if (mPreviewRect.pointInRect(x, y) && mModelPreview)
- {
- mModelPreview->zoom((F32)clicks * -0.2f);
- mModelPreview->refresh();
- }
+ if (mPreviewRect.pointInRect(x, y) && mModelPreview)
+ {
+ mModelPreview->zoom((F32)clicks * -0.2f);
+ mModelPreview->refresh();
+ }
else
{
LLFloaterModelUploadBase::handleScrollWheel(x, y, clicks);
}
- return TRUE;
+ return TRUE;
}
/*virtual*/
void LLFloaterModelPreview::onOpen(const LLSD& key)
{
- LLModelPreview::sIgnoreLoadedCallback = false;
- requestAgentUploadPermissions();
+ LLModelPreview::sIgnoreLoadedCallback = false;
+ requestAgentUploadPermissions();
}
/*virtual*/
void LLFloaterModelPreview::onClose(bool app_quitting)
{
- LLModelPreview::sIgnoreLoadedCallback = true;
+ LLModelPreview::sIgnoreLoadedCallback = true;
}
//static
void LLFloaterModelPreview::onPhysicsParamCommit(LLUICtrl* ctrl, void* data)
{
- if (LLConvexDecomposition::getInstance() == NULL)
- {
- LL_INFOS() << "convex decomposition tool is a stub on this platform. cannot get decomp." << LL_ENDL;
- return;
- }
+ if (LLConvexDecomposition::getInstance() == NULL)
+ {
+ LL_INFOS() << "convex decomposition tool is a stub on this platform. cannot get decomp." << LL_ENDL;
+ return;
+ }
- if (sInstance)
- {
- LLCDParam* param = (LLCDParam*) data;
- std::string name(param->mName);
+ if (sInstance)
+ {
+ LLCDParam* param = (LLCDParam*) data;
+ std::string name(param->mName);
- LLSD value = ctrl->getValue();
+ LLSD value = ctrl->getValue();
- if("Retain%" == name)
- {
- value = ctrl->getValue().asReal() / RETAIN_COEFFICIENT;
- }
+ if("Retain%" == name)
+ {
+ value = ctrl->getValue().asReal() / RETAIN_COEFFICIENT;
+ }
- sInstance->mDecompParams[name] = value;
+ sInstance->mDecompParams[name] = value;
- if (name == "Simplify Method")
- {
- bool show_retain = false;
- bool show_detail = true;
+ if (name == "Simplify Method")
+ {
+ bool show_retain = false;
+ bool show_detail = true;
- if (ctrl->getValue().asInteger() == 0)
- {
- show_retain = true;
- show_detail = false;
- }
+ if (ctrl->getValue().asInteger() == 0)
+ {
+ show_retain = true;
+ show_detail = false;
+ }
- sInstance->childSetVisible("Retain%", show_retain);
- sInstance->childSetVisible("Retain%_label", show_retain);
+ sInstance->childSetVisible("Retain%", show_retain);
+ sInstance->childSetVisible("Retain%_label", show_retain);
- sInstance->childSetVisible("Detail Scale", show_detail);
- sInstance->childSetVisible("Detail Scale label", show_detail);
- }
- }
+ sInstance->childSetVisible("Detail Scale", show_detail);
+ sInstance->childSetVisible("Detail Scale label", show_detail);
+ }
+ }
}
//static
void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data)
{
- LLCDStageData* stage_data = (LLCDStageData*) data;
- std::string stage = stage_data->mName;
-
- if (sInstance)
- {
- if (!sInstance->mCurRequest.empty())
- {
- LL_INFOS() << "Decomposition request still pending." << LL_ENDL;
- return;
- }
-
- if (sInstance->mModelPreview)
- {
- for (S32 i = 0; i < sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS].size(); ++i)
- {
- LLModel* mdl = sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS][i];
- DecompRequest* request = new DecompRequest(stage, mdl);
- sInstance->mCurRequest.insert(request);
- gMeshRepo.mDecompThread->submitRequest(request);
- }
- }
-
- if (stage == "Decompose")
- {
- sInstance->setStatusMessage(sInstance->getString("decomposing"));
- sInstance->childSetVisible("Decompose", false);
- sInstance->childSetVisible("decompose_cancel", true);
- sInstance->childDisable("Simplify");
- }
- else if (stage == "Simplify")
- {
- sInstance->setStatusMessage(sInstance->getString("simplifying"));
- sInstance->childSetVisible("Simplify", false);
- sInstance->childSetVisible("simplify_cancel", true);
- sInstance->childDisable("Decompose");
- }
- }
+ LLCDStageData* stage_data = (LLCDStageData*) data;
+ std::string stage = stage_data->mName;
+
+ if (sInstance)
+ {
+ if (!sInstance->mCurRequest.empty())
+ {
+ LL_INFOS() << "Decomposition request still pending." << LL_ENDL;
+ return;
+ }
+
+ if (sInstance->mModelPreview)
+ {
+ for (S32 i = 0; i < sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS].size(); ++i)
+ {
+ LLModel* mdl = sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS][i];
+ DecompRequest* request = new DecompRequest(stage, mdl);
+ sInstance->mCurRequest.insert(request);
+ gMeshRepo.mDecompThread->submitRequest(request);
+ }
+ }
+
+ if (stage == "Decompose")
+ {
+ sInstance->setStatusMessage(sInstance->getString("decomposing"));
+ sInstance->childSetVisible("Decompose", false);
+ sInstance->childSetVisible("decompose_cancel", true);
+ sInstance->childDisable("Simplify");
+ }
+ else if (stage == "Simplify")
+ {
+ sInstance->setStatusMessage(sInstance->getString("simplifying"));
+ sInstance->childSetVisible("Simplify", false);
+ sInstance->childSetVisible("simplify_cancel", true);
+ sInstance->childDisable("Decompose");
+ }
+ }
}
//static
void LLFloaterModelPreview::onPhysicsBrowse(LLUICtrl* ctrl, void* userdata)
{
- sInstance->loadModel(LLModel::LOD_PHYSICS);
+ sInstance->loadModel(LLModel::LOD_PHYSICS);
}
//static
void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata)
{
- S32 num_lods = 4;
- S32 which_mode;
-
- LLCtrlSelectionInterface* iface = sInstance->childGetSelectionInterface("physics_lod_combo");
- if (iface)
- {
- which_mode = iface->getFirstSelectedIndex();
- }
- else
- {
- LL_WARNS() << "no iface" << LL_ENDL;
- return;
- }
-
- if (which_mode <= 0)
- {
- LL_WARNS() << "which_mode out of range, " << which_mode << LL_ENDL;
- }
-
- S32 file_mode = iface->getItemCount() - 1;
- S32 cube_mode = file_mode - 1;
- if (which_mode < cube_mode)
- {
- S32 which_lod = num_lods - which_mode;
- sInstance->mModelPreview->setPhysicsFromLOD(which_lod);
- }
- else if (which_mode == cube_mode)
- {
- std::string path = gDirUtilp->getAppRODataDir();
- gDirUtilp->append(path, "cube.dae");
- sInstance->loadModel(LLModel::LOD_PHYSICS, path);
- }
-
- LLModelPreview *model_preview = sInstance->mModelPreview;
- if (model_preview)
- {
- model_preview->refresh();
- model_preview->updateStatusMessages();
- }
-}
-
-//static
+ S32 num_lods = 4;
+ S32 which_mode;
+
+ LLCtrlSelectionInterface* iface = sInstance->childGetSelectionInterface("physics_lod_combo");
+ if (iface)
+ {
+ which_mode = iface->getFirstSelectedIndex();
+ }
+ else
+ {
+ LL_WARNS() << "no iface" << LL_ENDL;
+ return;
+ }
+
+ if (which_mode <= 0)
+ {
+ LL_WARNS() << "which_mode out of range, " << which_mode << LL_ENDL;
+ }
+
+ S32 file_mode = iface->getItemCount() - 1;
+ S32 cube_mode = file_mode - 1;
+ if (which_mode < cube_mode)
+ {
+ S32 which_lod = num_lods - which_mode;
+ sInstance->mModelPreview->setPhysicsFromLOD(which_lod);
+ }
+ else if (which_mode == cube_mode)
+ {
+ std::string path = gDirUtilp->getAppRODataDir();
+ gDirUtilp->append(path, "cube.dae");
+ sInstance->loadModel(LLModel::LOD_PHYSICS, path);
+ }
+
+ LLModelPreview *model_preview = sInstance->mModelPreview;
+ if (model_preview)
+ {
+ model_preview->refresh();
+ model_preview->updateStatusMessages();
+ }
+}
+
+//static
void LLFloaterModelPreview::onCancel(LLUICtrl* ctrl, void* data)
{
- if (sInstance)
- {
- sInstance->closeFloater(false);
- }
+ if (sInstance)
+ {
+ sInstance->closeFloater(false);
+ }
}
//static
void LLFloaterModelPreview::onPhysicsStageCancel(LLUICtrl* ctrl, void*data)
{
- if (sInstance)
- {
- for (std::set<LLPointer<DecompRequest> >::iterator iter = sInstance->mCurRequest.begin();
- iter != sInstance->mCurRequest.end(); ++iter)
- {
- DecompRequest* req = *iter;
- req->mContinue = 0;
- }
+ if (sInstance)
+ {
+ for (std::set<LLPointer<DecompRequest> >::iterator iter = sInstance->mCurRequest.begin();
+ iter != sInstance->mCurRequest.end(); ++iter)
+ {
+ DecompRequest* req = *iter;
+ req->mContinue = 0;
+ }
- sInstance->mCurRequest.clear();
+ sInstance->mCurRequest.clear();
- if (sInstance->mModelPreview)
- {
- sInstance->mModelPreview->updateStatusMessages();
- }
- }
+ if (sInstance->mModelPreview)
+ {
+ sInstance->mModelPreview->updateStatusMessages();
+ }
+ }
}
void LLFloaterModelPreview::initDecompControls()
{
- LLSD key;
-
- childSetCommitCallback("simplify_cancel", onPhysicsStageCancel, NULL);
- childSetCommitCallback("decompose_cancel", onPhysicsStageCancel, NULL);
-
- childSetCommitCallback("physics_lod_combo", onPhysicsUseLOD, NULL);
- childSetCommitCallback("physics_browse", onPhysicsBrowse, NULL);
-
- static const LLCDStageData* stage = NULL;
- static S32 stage_count = 0;
-
- if (!stage && LLConvexDecomposition::getInstance() != NULL)
- {
- stage_count = LLConvexDecomposition::getInstance()->getStages(&stage);
- }
-
- static const LLCDParam* param = NULL;
- static S32 param_count = 0;
- if (!param && LLConvexDecomposition::getInstance() != NULL)
- {
- param_count = LLConvexDecomposition::getInstance()->getParameters(&param);
- }
-
- for (S32 j = stage_count-1; j >= 0; --j)
- {
- LLButton* button = getChild<LLButton>(stage[j].mName);
- if (button)
- {
- button->setCommitCallback(onPhysicsStageExecute, (void*) &stage[j]);
- }
-
- gMeshRepo.mDecompThread->mStageID[stage[j].mName] = j;
- // protected against stub by stage_count being 0 for stub above
- LLConvexDecomposition::getInstance()->registerCallback(j, LLPhysicsDecomp::llcdCallback);
-
- //LL_INFOS() << "Physics decomp stage " << stage[j].mName << " (" << j << ") parameters:" << LL_ENDL;
- //LL_INFOS() << "------------------------------------" << LL_ENDL;
-
- for (S32 i = 0; i < param_count; ++i)
- {
- if (param[i].mStage != j)
- {
- continue;
- }
-
- std::string name(param[i].mName ? param[i].mName : "");
- std::string description(param[i].mDescription ? param[i].mDescription : "");
-
- std::string type = "unknown";
-
- LL_INFOS() << name << " - " << description << LL_ENDL;
-
- if (param[i].mType == LLCDParam::LLCD_FLOAT)
- {
- mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mFloat);
- //LL_INFOS() << "Type: float, Default: " << param[i].mDefault.mFloat << LL_ENDL;
-
-
- LLUICtrl* ctrl = getChild<LLUICtrl>(name);
- if (LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(ctrl))
- {
- slider->setMinValue(param[i].mDetails.mRange.mLow.mFloat);
- slider->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat);
- slider->setIncrement(param[i].mDetails.mRange.mDelta.mFloat);
- slider->setValue(param[i].mDefault.mFloat);
- slider->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
- }
- else if (LLSpinCtrl* spinner = dynamic_cast<LLSpinCtrl*>(ctrl))
- {
- bool is_retain_ctrl = "Retain%" == name;
- double coefficient = is_retain_ctrl ? RETAIN_COEFFICIENT : 1.f;
-
- spinner->setMinValue(param[i].mDetails.mRange.mLow.mFloat * coefficient);
- spinner->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat * coefficient);
- spinner->setIncrement(param[i].mDetails.mRange.mDelta.mFloat * coefficient);
- spinner->setValue(param[i].mDefault.mFloat * coefficient);
- spinner->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
- }
- else if (LLComboBox* combo_box = dynamic_cast<LLComboBox*>(ctrl))
- {
- float min = param[i].mDetails.mRange.mLow.mFloat;
- float max = param[i].mDetails.mRange.mHigh.mFloat;
- float delta = param[i].mDetails.mRange.mDelta.mFloat;
-
- bool is_smooth_cb = ("Cosine%" == name);
- if (is_smooth_cb)
- {
- createSmoothComboBox(combo_box, min, max);
- }
- else
- {
- for(float value = min; value <= max; value += delta)
- {
- std::string label = llformat("%.1f", value);
- combo_box->add(label, value, ADD_BOTTOM, true);
- }
- }
- combo_box->setValue(is_smooth_cb ? 0: param[i].mDefault.mFloat);
- combo_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
- }
- }
- else if (param[i].mType == LLCDParam::LLCD_INTEGER)
- {
- mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue);
- //LL_INFOS() << "Type: integer, Default: " << param[i].mDefault.mIntOrEnumValue << LL_ENDL;
-
-
- LLUICtrl* ctrl = getChild<LLUICtrl>(name);
- if (LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(ctrl))
- {
- slider->setMinValue(param[i].mDetails.mRange.mLow.mIntOrEnumValue);
- slider->setMaxValue(param[i].mDetails.mRange.mHigh.mIntOrEnumValue);
- slider->setIncrement(param[i].mDetails.mRange.mDelta.mIntOrEnumValue);
- slider->setValue(param[i].mDefault.mIntOrEnumValue);
- slider->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
- }
- else if (LLComboBox* combo_box = dynamic_cast<LLComboBox*>(ctrl))
- {
- for(int k = param[i].mDetails.mRange.mLow.mIntOrEnumValue; k<=param[i].mDetails.mRange.mHigh.mIntOrEnumValue; k+=param[i].mDetails.mRange.mDelta.mIntOrEnumValue)
- {
- std::string name = llformat("%.1d", k);
- combo_box->add(name, k, ADD_BOTTOM, true);
- }
- combo_box->setValue(param[i].mDefault.mIntOrEnumValue);
- combo_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
- }
- }
- else if (param[i].mType == LLCDParam::LLCD_BOOLEAN)
- {
- mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mBool);
- //LL_INFOS() << "Type: boolean, Default: " << (param[i].mDefault.mBool ? "True" : "False") << LL_ENDL;
-
- LLCheckBoxCtrl* check_box = getChild<LLCheckBoxCtrl>(name);
- if (check_box)
- {
- check_box->setValue(param[i].mDefault.mBool);
- check_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
- }
- }
- else if (param[i].mType == LLCDParam::LLCD_ENUM)
- {
- mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue);
- //LL_INFOS() << "Type: enum, Default: " << param[i].mDefault.mIntOrEnumValue << LL_ENDL;
-
- { //plug into combo box
-
- //LL_INFOS() << "Accepted values: " << LL_ENDL;
- LLComboBox* combo_box = getChild<LLComboBox>(name);
- for (S32 k = 0; k < param[i].mDetails.mEnumValues.mNumEnums; ++k)
- {
- //LL_INFOS() << param[i].mDetails.mEnumValues.mEnumsArray[k].mValue
- // << " - " << param[i].mDetails.mEnumValues.mEnumsArray[k].mName << LL_ENDL;
-
- std::string name(param[i].mDetails.mEnumValues.mEnumsArray[k].mName);
- std::string localized_name;
- bool is_localized = LLTrans::findString(localized_name, name);
-
- combo_box->add(is_localized ? localized_name : name,
- LLSD::Integer(param[i].mDetails.mEnumValues.mEnumsArray[k].mValue));
- }
- combo_box->setValue(param[i].mDefault.mIntOrEnumValue);
- combo_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
- }
-
- //LL_INFOS() << "----" << LL_ENDL;
- }
- //LL_INFOS() << "-----------------------------" << LL_ENDL;
- }
- }
- mDefaultDecompParams = mDecompParams;
- childSetCommitCallback("physics_explode", LLFloaterModelPreview::onExplodeCommit, this);
+ LLSD key;
+
+ childSetCommitCallback("simplify_cancel", onPhysicsStageCancel, NULL);
+ childSetCommitCallback("decompose_cancel", onPhysicsStageCancel, NULL);
+
+ childSetCommitCallback("physics_lod_combo", onPhysicsUseLOD, NULL);
+ childSetCommitCallback("physics_browse", onPhysicsBrowse, NULL);
+
+ static const LLCDStageData* stage = NULL;
+ static S32 stage_count = 0;
+
+ if (!stage && LLConvexDecomposition::getInstance() != NULL)
+ {
+ stage_count = LLConvexDecomposition::getInstance()->getStages(&stage);
+ }
+
+ static const LLCDParam* param = NULL;
+ static S32 param_count = 0;
+ if (!param && LLConvexDecomposition::getInstance() != NULL)
+ {
+ param_count = LLConvexDecomposition::getInstance()->getParameters(&param);
+ }
+
+ for (S32 j = stage_count-1; j >= 0; --j)
+ {
+ LLButton* button = getChild<LLButton>(stage[j].mName);
+ if (button)
+ {
+ button->setCommitCallback(onPhysicsStageExecute, (void*) &stage[j]);
+ }
+
+ gMeshRepo.mDecompThread->mStageID[stage[j].mName] = j;
+ // protected against stub by stage_count being 0 for stub above
+ LLConvexDecomposition::getInstance()->registerCallback(j, LLPhysicsDecomp::llcdCallback);
+
+ //LL_INFOS() << "Physics decomp stage " << stage[j].mName << " (" << j << ") parameters:" << LL_ENDL;
+ //LL_INFOS() << "------------------------------------" << LL_ENDL;
+
+ for (S32 i = 0; i < param_count; ++i)
+ {
+ if (param[i].mStage != j)
+ {
+ continue;
+ }
+
+ std::string name(param[i].mName ? param[i].mName : "");
+ std::string description(param[i].mDescription ? param[i].mDescription : "");
+
+ std::string type = "unknown";
+
+ LL_INFOS() << name << " - " << description << LL_ENDL;
+
+ if (param[i].mType == LLCDParam::LLCD_FLOAT)
+ {
+ mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mFloat);
+ //LL_INFOS() << "Type: float, Default: " << param[i].mDefault.mFloat << LL_ENDL;
+
+
+ LLUICtrl* ctrl = getChild<LLUICtrl>(name);
+ if (LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(ctrl))
+ {
+ slider->setMinValue(param[i].mDetails.mRange.mLow.mFloat);
+ slider->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat);
+ slider->setIncrement(param[i].mDetails.mRange.mDelta.mFloat);
+ slider->setValue(param[i].mDefault.mFloat);
+ slider->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
+ }
+ else if (LLSpinCtrl* spinner = dynamic_cast<LLSpinCtrl*>(ctrl))
+ {
+ bool is_retain_ctrl = "Retain%" == name;
+ double coefficient = is_retain_ctrl ? RETAIN_COEFFICIENT : 1.f;
+
+ spinner->setMinValue(param[i].mDetails.mRange.mLow.mFloat * coefficient);
+ spinner->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat * coefficient);
+ spinner->setIncrement(param[i].mDetails.mRange.mDelta.mFloat * coefficient);
+ spinner->setValue(param[i].mDefault.mFloat * coefficient);
+ spinner->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
+ }
+ else if (LLComboBox* combo_box = dynamic_cast<LLComboBox*>(ctrl))
+ {
+ float min = param[i].mDetails.mRange.mLow.mFloat;
+ float max = param[i].mDetails.mRange.mHigh.mFloat;
+ float delta = param[i].mDetails.mRange.mDelta.mFloat;
+
+ bool is_smooth_cb = ("Cosine%" == name);
+ if (is_smooth_cb)
+ {
+ createSmoothComboBox(combo_box, min, max);
+ }
+ else
+ {
+ for(float value = min; value <= max; value += delta)
+ {
+ std::string label = llformat("%.1f", value);
+ combo_box->add(label, value, ADD_BOTTOM, true);
+ }
+ }
+ combo_box->setValue(is_smooth_cb ? 0: param[i].mDefault.mFloat);
+ combo_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
+ }
+ }
+ else if (param[i].mType == LLCDParam::LLCD_INTEGER)
+ {
+ mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue);
+ //LL_INFOS() << "Type: integer, Default: " << param[i].mDefault.mIntOrEnumValue << LL_ENDL;
+
+
+ LLUICtrl* ctrl = getChild<LLUICtrl>(name);
+ if (LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(ctrl))
+ {
+ slider->setMinValue(param[i].mDetails.mRange.mLow.mIntOrEnumValue);
+ slider->setMaxValue(param[i].mDetails.mRange.mHigh.mIntOrEnumValue);
+ slider->setIncrement(param[i].mDetails.mRange.mDelta.mIntOrEnumValue);
+ slider->setValue(param[i].mDefault.mIntOrEnumValue);
+ slider->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
+ }
+ else if (LLComboBox* combo_box = dynamic_cast<LLComboBox*>(ctrl))
+ {
+ for(int k = param[i].mDetails.mRange.mLow.mIntOrEnumValue; k<=param[i].mDetails.mRange.mHigh.mIntOrEnumValue; k+=param[i].mDetails.mRange.mDelta.mIntOrEnumValue)
+ {
+ std::string name = llformat("%.1d", k);
+ combo_box->add(name, k, ADD_BOTTOM, true);
+ }
+ combo_box->setValue(param[i].mDefault.mIntOrEnumValue);
+ combo_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
+ }
+ }
+ else if (param[i].mType == LLCDParam::LLCD_BOOLEAN)
+ {
+ mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mBool);
+ //LL_INFOS() << "Type: boolean, Default: " << (param[i].mDefault.mBool ? "True" : "False") << LL_ENDL;
+
+ LLCheckBoxCtrl* check_box = getChild<LLCheckBoxCtrl>(name);
+ if (check_box)
+ {
+ check_box->setValue(param[i].mDefault.mBool);
+ check_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
+ }
+ }
+ else if (param[i].mType == LLCDParam::LLCD_ENUM)
+ {
+ mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue);
+ //LL_INFOS() << "Type: enum, Default: " << param[i].mDefault.mIntOrEnumValue << LL_ENDL;
+
+ { //plug into combo box
+
+ //LL_INFOS() << "Accepted values: " << LL_ENDL;
+ LLComboBox* combo_box = getChild<LLComboBox>(name);
+ for (S32 k = 0; k < param[i].mDetails.mEnumValues.mNumEnums; ++k)
+ {
+ //LL_INFOS() << param[i].mDetails.mEnumValues.mEnumsArray[k].mValue
+ // << " - " << param[i].mDetails.mEnumValues.mEnumsArray[k].mName << LL_ENDL;
+
+ std::string name(param[i].mDetails.mEnumValues.mEnumsArray[k].mName);
+ std::string localized_name;
+ bool is_localized = LLTrans::findString(localized_name, name);
+
+ combo_box->add(is_localized ? localized_name : name,
+ LLSD::Integer(param[i].mDetails.mEnumValues.mEnumsArray[k].mValue));
+ }
+ combo_box->setValue(param[i].mDefault.mIntOrEnumValue);
+ combo_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
+ }
+
+ //LL_INFOS() << "----" << LL_ENDL;
+ }
+ //LL_INFOS() << "-----------------------------" << LL_ENDL;
+ }
+ }
+ mDefaultDecompParams = mDecompParams;
+ childSetCommitCallback("physics_explode", LLFloaterModelPreview::onExplodeCommit, this);
}
void LLFloaterModelPreview::createSmoothComboBox(LLComboBox* combo_box, float min, float max)
{
- float delta = (max - min) / SMOOTH_VALUES_NUMBER;
- int ilabel = 0;
+ float delta = (max - min) / SMOOTH_VALUES_NUMBER;
+ int ilabel = 0;
- combo_box->add("0 (none)", ADD_BOTTOM, true);
+ combo_box->add("0 (none)", ADD_BOTTOM, true);
- for(float value = min + delta; value < max; value += delta)
- {
- std::string label = (++ilabel == SMOOTH_VALUES_NUMBER) ? "10 (max)" : llformat("%.1d", ilabel);
- combo_box->add(label, value, ADD_BOTTOM, true);
- }
+ for(float value = min + delta; value < max; value += delta)
+ {
+ std::string label = (++ilabel == SMOOTH_VALUES_NUMBER) ? "10 (max)" : llformat("%.1d", ilabel);
+ combo_box->add(label, value, ADD_BOTTOM, true);
+ }
}
@@ -1323,7 +1323,7 @@ void LLFloaterModelPreview::createSmoothComboBox(LLComboBox* combo_box, float mi
// static
void LLFloaterModelPreview::onMouseCaptureLostModelPreview(LLMouseHandler* handler)
{
- gViewerWindow->showCursor();
+ gViewerWindow->showCursor();
}
//-----------------------------------------------------------------------------
@@ -1333,7 +1333,7 @@ void LLFloaterModelPreview::onMouseCaptureLostModelPreview(LLMouseHandler* handl
void LLFloaterModelPreview::addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod)
{
if (sInstance && sInstance->hasString(message))
- {
+ {
std::string str;
switch (lod)
{
@@ -1351,29 +1351,29 @@ void LLFloaterModelPreview::addStringToLog(const std::string& message, const LLS
for (; iter != end; ++iter)
{
args_msg[iter->first] = iter->second.asString();
- }
+ }
str += sInstance->getString(message, args_msg);
sInstance->addStringToLogTab(str, flash);
- }
- }
+ }
+ }
// static
void LLFloaterModelPreview::addStringToLog(const std::string& str, bool flash)
- {
+ {
if (sInstance)
- {
+ {
sInstance->addStringToLogTab(str, flash);
- }
- }
+ }
+ }
// static
void LLFloaterModelPreview::addStringToLog(const std::ostringstream& strm, bool flash)
- {
+ {
if (sInstance)
{
sInstance->addStringToLogTab(strm.str(), flash);
}
- }
+ }
void LLFloaterModelPreview::clearAvatarTab()
{
@@ -1386,7 +1386,7 @@ void LLFloaterModelPreview::clearAvatarTab()
for (U32 i = 0; i < LLModel::NUM_LODS; ++i)
{
mJointOverrides[i].clear();
- }
+ }
LLTextBox *joint_total_descr = panel->getChild<LLTextBox>("conflicts_description");
joint_total_descr->setTextArg("[CONFLICTS]", llformat("%d", 0));
@@ -1395,7 +1395,7 @@ void LLFloaterModelPreview::clearAvatarTab()
LLTextBox *joint_pos_descr = panel->getChild<LLTextBox>("pos_overrides_descr");
joint_pos_descr->setTextArg("[JOINT]", std::string("mPelvis")); // Might be better to hide it
- }
+ }
void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
{
@@ -1539,149 +1539,149 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash)
{
if (str.empty())
- {
- return;
- }
+ {
+ return;
+ }
LLWString text = utf8str_to_wstring(str);
S32 add_text_len = text.length() + 1; // newline
S32 editor_max_len = mUploadLogText->getMaxTextLength();
if (add_text_len > editor_max_len)
- {
- return;
- }
+ {
+ return;
+ }
// Make sure we have space for new string
S32 editor_text_len = mUploadLogText->getLength();
if (editor_max_len < (editor_text_len + add_text_len)
&& mUploadLogText->getLineCount() <= 0)
- {
+ {
mUploadLogText->getTextBoundingRect();// forces a reflow() to fix line count
- }
+ }
while (editor_max_len < (editor_text_len + add_text_len))
- {
+ {
S32 shift = mUploadLogText->removeFirstLine();
if (shift > 0)
- {
+ {
// removed a line
editor_text_len -= shift;
}
- else
- {
+ else
+ {
//nothing to remove?
LL_WARNS() << "Failed to clear log lines" << LL_ENDL;
- break;
- }
- }
+ break;
+ }
+ }
mUploadLogText->appendText(str, true);
if (flash)
- {
+ {
LLPanel* panel = mTabContainer->getPanelByName("logs_panel");
if (mTabContainer->getCurrentPanel() != panel)
- {
+ {
mTabContainer->setTabPanelFlashing(panel, true);
- }
- }
- }
+ }
+ }
+ }
void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z)
{
- assert_main_thread();
- childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x));
- childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y));
- childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z));
- }
+ assert_main_thread();
+ childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x));
+ childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y));
+ childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z));
+ }
void LLFloaterModelPreview::setPreviewLOD(S32 lod)
- {
- if (mModelPreview)
- {
- mModelPreview->setPreviewLOD(lod);
- }
- }
+ {
+ if (mModelPreview)
+ {
+ mModelPreview->setPreviewLOD(lod);
+ }
+ }
void LLFloaterModelPreview::onBrowseLOD(S32 lod)
{
- assert_main_thread();
+ assert_main_thread();
- loadModel(lod);
+ loadModel(lod);
}
//static
void LLFloaterModelPreview::onReset(void* user_data)
{
- assert_main_thread();
+ assert_main_thread();
- LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) user_data;
- fmp->childDisable("reset_btn");
- fmp->clearLogTab();
- fmp->clearAvatarTab();
- LLModelPreview* mp = fmp->mModelPreview;
- std::string filename = mp->mLODFile[LLModel::LOD_HIGH];
+ LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) user_data;
+ fmp->childDisable("reset_btn");
+ fmp->clearLogTab();
+ fmp->clearAvatarTab();
+ LLModelPreview* mp = fmp->mModelPreview;
+ std::string filename = mp->mLODFile[LLModel::LOD_HIGH];
- fmp->resetDisplayOptions();
- fmp->resetUploadOptions();
- //reset model preview
- fmp->initModelPreview();
+ fmp->resetDisplayOptions();
+ fmp->resetUploadOptions();
+ //reset model preview
+ fmp->initModelPreview();
- mp = fmp->mModelPreview;
- mp->loadModel(filename,LLModel::LOD_HIGH,true);
+ mp = fmp->mModelPreview;
+ mp->loadModel(filename,LLModel::LOD_HIGH,true);
}
//static
void LLFloaterModelPreview::onUpload(void* user_data)
{
- assert_main_thread();
+ assert_main_thread();
- LLFloaterModelPreview* mp = (LLFloaterModelPreview*) user_data;
- mp->clearLogTab();
+ LLFloaterModelPreview* mp = (LLFloaterModelPreview*) user_data;
+ mp->clearLogTab();
- mp->mUploadBtn->setEnabled(false);
+ mp->mUploadBtn->setEnabled(false);
- mp->mModelPreview->rebuildUploadData();
+ mp->mModelPreview->rebuildUploadData();
- bool upload_skinweights = mp->childGetValue("upload_skin").asBoolean();
- bool upload_joint_positions = mp->childGetValue("upload_joints").asBoolean();
+ bool upload_skinweights = mp->childGetValue("upload_skin").asBoolean();
+ bool upload_joint_positions = mp->childGetValue("upload_joints").asBoolean();
bool lock_scale_if_joint_position = mp->childGetValue("lock_scale_if_joint_position").asBoolean();
- if (gSavedSettings.getBOOL("MeshImportUseSLM"))
- {
+ if (gSavedSettings.getBOOL("MeshImportUseSLM"))
+ {
mp->mModelPreview->saveUploadData(upload_skinweights, upload_joint_positions, lock_scale_if_joint_position);
}
- gMeshRepo.uploadModel(mp->mModelPreview->mUploadData, mp->mModelPreview->mPreviewScale,
- mp->childGetValue("upload_textures").asBoolean(),
- upload_skinweights, upload_joint_positions, lock_scale_if_joint_position,
+ gMeshRepo.uploadModel(mp->mModelPreview->mUploadData, mp->mModelPreview->mPreviewScale,
+ mp->childGetValue("upload_textures").asBoolean(),
+ upload_skinweights, upload_joint_positions, lock_scale_if_joint_position,
mp->mUploadModelUrl,
- true, LLHandle<LLWholeModelFeeObserver>(), mp->getWholeModelUploadObserverHandle());
+ true, LLHandle<LLWholeModelFeeObserver>(), mp->getWholeModelUploadObserverHandle());
}
void LLFloaterModelPreview::refresh()
{
- sInstance->toggleCalculateButton(true);
- sInstance->mModelPreview->mDirty = true;
+ sInstance->toggleCalculateButton(true);
+ sInstance->mModelPreview->mDirty = true;
}
LLFloaterModelPreview::DecompRequest::DecompRequest(const std::string& stage, LLModel* mdl)
{
- mStage = stage;
- mContinue = 1;
- mModel = mdl;
- mDecompID = &mdl->mDecompID;
- mParams = sInstance->mDecompParams;
+ mStage = stage;
+ mContinue = 1;
+ mModel = mdl;
+ mDecompID = &mdl->mDecompID;
+ mParams = sInstance->mDecompParams;
- //copy out positions and indices
- assignData(mdl) ;
+ //copy out positions and indices
+ assignData(mdl) ;
}
void LLFloaterModelPreview::setCtrlLoadFromFile(S32 lod)
{
if (lod == LLModel::LOD_PHYSICS)
- {
+ {
LLComboBox* lod_combo = findChild<LLComboBox>("physics_lod_combo");
if (lod_combo)
{
@@ -1689,24 +1689,24 @@ void LLFloaterModelPreview::setCtrlLoadFromFile(S32 lod)
}
}
else
- {
+ {
LLComboBox* lod_combo = findChild<LLComboBox>("lod_source_" + lod_name[lod]);
if (lod_combo)
- {
+ {
lod_combo->setCurrentByIndex(0);
- }
+ }
}
}
void LLFloaterModelPreview::setStatusMessage(const std::string& msg)
{
- LLMutexLock lock(mStatusLock);
- mStatusMessage = msg;
+ LLMutexLock lock(mStatusLock);
+ mStatusMessage = msg;
}
void LLFloaterModelPreview::toggleCalculateButton()
{
- toggleCalculateButton(true);
+ toggleCalculateButton(true);
}
void LLFloaterModelPreview::modelUpdated(bool calculate_visible)
@@ -1717,99 +1717,99 @@ void LLFloaterModelPreview::modelUpdated(bool calculate_visible)
void LLFloaterModelPreview::toggleCalculateButton(bool visible)
{
- mCalculateBtn->setVisible(visible);
-
- bool uploadingSkin = childGetValue("upload_skin").asBoolean();
- bool uploadingJointPositions = childGetValue("upload_joints").asBoolean();
- if ( uploadingSkin )
- {
- //Disable the calculate button *if* the rig is invalid - which is determined during the critiquing process
- if ( uploadingJointPositions && !mModelPreview->isRigValidForJointPositionUpload() )
- {
- mCalculateBtn->setVisible( false );
- }
- }
-
- mUploadBtn->setVisible(!visible);
- mUploadBtn->setEnabled(isModelUploadAllowed());
-
- if (visible)
- {
- std::string tbd = getString("tbd");
- childSetTextArg("prim_weight", "[EQ]", tbd);
- childSetTextArg("download_weight", "[ST]", tbd);
- childSetTextArg("server_weight", "[SIM]", tbd);
- childSetTextArg("physics_weight", "[PH]", tbd);
- if (!mModelPhysicsFee.isMap() || (mModelPhysicsFee.size() == 0))
- {
- childSetTextArg("upload_fee", "[FEE]", tbd);
- }
- std::string dashes = hasString("--") ? getString("--") : "--";
- childSetTextArg("price_breakdown", "[STREAMING]", dashes);
- childSetTextArg("price_breakdown", "[PHYSICS]", dashes);
- childSetTextArg("price_breakdown", "[INSTANCES]", dashes);
- childSetTextArg("price_breakdown", "[TEXTURES]", dashes);
- childSetTextArg("price_breakdown", "[MODEL]", dashes);
- childSetTextArg("physics_breakdown", "[PCH]", dashes);
- childSetTextArg("physics_breakdown", "[PM]", dashes);
- childSetTextArg("physics_breakdown", "[PHU]", dashes);
- }
+ mCalculateBtn->setVisible(visible);
+
+ bool uploadingSkin = childGetValue("upload_skin").asBoolean();
+ bool uploadingJointPositions = childGetValue("upload_joints").asBoolean();
+ if ( uploadingSkin )
+ {
+ //Disable the calculate button *if* the rig is invalid - which is determined during the critiquing process
+ if ( uploadingJointPositions && !mModelPreview->isRigValidForJointPositionUpload() )
+ {
+ mCalculateBtn->setVisible( false );
+ }
+ }
+
+ mUploadBtn->setVisible(!visible);
+ mUploadBtn->setEnabled(isModelUploadAllowed());
+
+ if (visible)
+ {
+ std::string tbd = getString("tbd");
+ childSetTextArg("prim_weight", "[EQ]", tbd);
+ childSetTextArg("download_weight", "[ST]", tbd);
+ childSetTextArg("server_weight", "[SIM]", tbd);
+ childSetTextArg("physics_weight", "[PH]", tbd);
+ if (!mModelPhysicsFee.isMap() || (mModelPhysicsFee.size() == 0))
+ {
+ childSetTextArg("upload_fee", "[FEE]", tbd);
+ }
+ std::string dashes = hasString("--") ? getString("--") : "--";
+ childSetTextArg("price_breakdown", "[STREAMING]", dashes);
+ childSetTextArg("price_breakdown", "[PHYSICS]", dashes);
+ childSetTextArg("price_breakdown", "[INSTANCES]", dashes);
+ childSetTextArg("price_breakdown", "[TEXTURES]", dashes);
+ childSetTextArg("price_breakdown", "[MODEL]", dashes);
+ childSetTextArg("physics_breakdown", "[PCH]", dashes);
+ childSetTextArg("physics_breakdown", "[PM]", dashes);
+ childSetTextArg("physics_breakdown", "[PHU]", dashes);
+ }
}
void LLFloaterModelPreview::onLoDSourceCommit(S32 lod)
{
- mModelPreview->updateLodControls(lod);
+ mModelPreview->updateLodControls(lod);
- LLComboBox* lod_source_combo = getChild<LLComboBox>("lod_source_" + lod_name[lod]);
+ LLComboBox* lod_source_combo = getChild<LLComboBox>("lod_source_" + lod_name[lod]);
S32 index = lod_source_combo->getCurrentIndex();
- if (index == LLModelPreview::MESH_OPTIMIZER_AUTO
+ if (index == LLModelPreview::MESH_OPTIMIZER_AUTO
|| index == LLModelPreview::MESH_OPTIMIZER_SLOPPY
|| index == LLModelPreview::MESH_OPTIMIZER_PRECISE)
- { //rebuild LoD to update triangle counts
- onLODParamCommit(lod, true);
- }
+ { //rebuild LoD to update triangle counts
+ onLODParamCommit(lod, true);
+ }
}
void LLFloaterModelPreview::resetDisplayOptions()
{
- std::map<std::string,bool>::iterator option_it = mModelPreview->mViewOption.begin();
+ std::map<std::string,bool>::iterator option_it = mModelPreview->mViewOption.begin();
- for(;option_it != mModelPreview->mViewOption.end(); ++option_it)
- {
- LLUICtrl* ctrl = getChild<LLUICtrl>(option_it->first);
- ctrl->setValue(false);
- }
+ for(;option_it != mModelPreview->mViewOption.end(); ++option_it)
+ {
+ LLUICtrl* ctrl = getChild<LLUICtrl>(option_it->first);
+ ctrl->setValue(false);
+ }
}
void LLFloaterModelPreview::resetUploadOptions()
{
- childSetValue("import_scale", 1);
- childSetValue("pelvis_offset", 0);
- childSetValue("physics_explode", 0);
- childSetValue("physics_file", "");
- childSetVisible("Retain%", false);
- childSetVisible("Retain%_label", false);
- childSetVisible("Detail Scale", true);
- childSetVisible("Detail Scale label", true);
-
- getChild<LLComboBox>("lod_source_" + lod_name[NUM_LOD - 1])->setCurrentByIndex(LLModelPreview::LOD_FROM_FILE);
- for (S32 lod = 0; lod < NUM_LOD - 1; ++lod)
- {
- getChild<LLComboBox>("lod_source_" + lod_name[lod])->setCurrentByIndex(LLModelPreview::MESH_OPTIMIZER_AUTO);
- childSetValue("lod_file_" + lod_name[lod], "");
- }
-
- for(auto& p : mDefaultDecompParams)
- {
- std::string ctrl_name(p.first);
- LLUICtrl* ctrl = getChild<LLUICtrl>(ctrl_name);
- if (ctrl)
- {
- ctrl->setValue(p.second);
- }
- }
- getChild<LLComboBox>("physics_lod_combo")->setCurrentByIndex(0);
- getChild<LLComboBox>("Cosine%")->setCurrentByIndex(0);
+ childSetValue("import_scale", 1);
+ childSetValue("pelvis_offset", 0);
+ childSetValue("physics_explode", 0);
+ childSetValue("physics_file", "");
+ childSetVisible("Retain%", false);
+ childSetVisible("Retain%_label", false);
+ childSetVisible("Detail Scale", true);
+ childSetVisible("Detail Scale label", true);
+
+ getChild<LLComboBox>("lod_source_" + lod_name[NUM_LOD - 1])->setCurrentByIndex(LLModelPreview::LOD_FROM_FILE);
+ for (S32 lod = 0; lod < NUM_LOD - 1; ++lod)
+ {
+ getChild<LLComboBox>("lod_source_" + lod_name[lod])->setCurrentByIndex(LLModelPreview::MESH_OPTIMIZER_AUTO);
+ childSetValue("lod_file_" + lod_name[lod], "");
+ }
+
+ for(auto& p : mDefaultDecompParams)
+ {
+ std::string ctrl_name(p.first);
+ LLUICtrl* ctrl = getChild<LLUICtrl>(ctrl_name);
+ if (ctrl)
+ {
+ ctrl->setValue(p.second);
+ }
+ }
+ getChild<LLComboBox>("physics_lod_combo")->setCurrentByIndex(0);
+ getChild<LLComboBox>("Cosine%")->setCurrentByIndex(0);
}
void LLFloaterModelPreview::clearLogTab()
@@ -1821,50 +1821,50 @@ void LLFloaterModelPreview::clearLogTab()
void LLFloaterModelPreview::onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url)
{
- mModelPhysicsFee = result;
- mModelPhysicsFee["url"] = upload_url;
+ mModelPhysicsFee = result;
+ mModelPhysicsFee["url"] = upload_url;
- doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::handleModelPhysicsFeeReceived,this));
+ doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::handleModelPhysicsFeeReceived,this));
}
void LLFloaterModelPreview::handleModelPhysicsFeeReceived()
{
- const LLSD& result = mModelPhysicsFee;
- mUploadModelUrl = result["url"].asString();
-
- childSetTextArg("prim_weight", "[EQ]", llformat("%0.3f", result["resource_cost"].asReal()));
- childSetTextArg("download_weight", "[ST]", llformat("%0.3f", result["model_streaming_cost"].asReal()));
- childSetTextArg("server_weight", "[SIM]", llformat("%0.3f", result["simulation_cost"].asReal()));
- childSetTextArg("physics_weight", "[PH]", llformat("%0.3f", result["physics_cost"].asReal()));
- childSetTextArg("upload_fee", "[FEE]", llformat("%d", result["upload_price"].asInteger()));
- childSetTextArg("price_breakdown", "[STREAMING]", llformat("%d", result["upload_price_breakdown"]["mesh_streaming"].asInteger()));
- childSetTextArg("price_breakdown", "[PHYSICS]", llformat("%d", result["upload_price_breakdown"]["mesh_physics"].asInteger()));
- childSetTextArg("price_breakdown", "[INSTANCES]", llformat("%d", result["upload_price_breakdown"]["mesh_instance"].asInteger()));
- childSetTextArg("price_breakdown", "[TEXTURES]", llformat("%d", result["upload_price_breakdown"]["texture"].asInteger()));
- childSetTextArg("price_breakdown", "[MODEL]", llformat("%d", result["upload_price_breakdown"]["model"].asInteger()));
-
- childSetTextArg("physics_breakdown", "[PCH]", llformat("%0.3f", result["model_physics_cost"]["hull"].asReal()));
- childSetTextArg("physics_breakdown", "[PM]", llformat("%0.3f", result["model_physics_cost"]["mesh"].asReal()));
- childSetTextArg("physics_breakdown", "[PHU]", llformat("%0.3f", result["model_physics_cost"]["decomposition"].asReal()));
- childSetTextArg("streaming_breakdown", "[STR_TOTAL]", llformat("%d", result["streaming_cost"].asInteger()));
- childSetTextArg("streaming_breakdown", "[STR_HIGH]", llformat("%d", result["streaming_params"]["high_lod"].asInteger()));
- childSetTextArg("streaming_breakdown", "[STR_MED]", llformat("%d", result["streaming_params"]["medium_lod"].asInteger()));
- childSetTextArg("streaming_breakdown", "[STR_LOW]", llformat("%d", result["streaming_params"]["low_lod"].asInteger()));
- childSetTextArg("streaming_breakdown", "[STR_LOWEST]", llformat("%d", result["streaming_params"]["lowest_lod"].asInteger()));
-
- childSetVisible("upload_fee", true);
- childSetVisible("price_breakdown", true);
- mUploadBtn->setEnabled(isModelUploadAllowed());
+ const LLSD& result = mModelPhysicsFee;
+ mUploadModelUrl = result["url"].asString();
+
+ childSetTextArg("prim_weight", "[EQ]", llformat("%0.3f", result["resource_cost"].asReal()));
+ childSetTextArg("download_weight", "[ST]", llformat("%0.3f", result["model_streaming_cost"].asReal()));
+ childSetTextArg("server_weight", "[SIM]", llformat("%0.3f", result["simulation_cost"].asReal()));
+ childSetTextArg("physics_weight", "[PH]", llformat("%0.3f", result["physics_cost"].asReal()));
+ childSetTextArg("upload_fee", "[FEE]", llformat("%d", result["upload_price"].asInteger()));
+ childSetTextArg("price_breakdown", "[STREAMING]", llformat("%d", result["upload_price_breakdown"]["mesh_streaming"].asInteger()));
+ childSetTextArg("price_breakdown", "[PHYSICS]", llformat("%d", result["upload_price_breakdown"]["mesh_physics"].asInteger()));
+ childSetTextArg("price_breakdown", "[INSTANCES]", llformat("%d", result["upload_price_breakdown"]["mesh_instance"].asInteger()));
+ childSetTextArg("price_breakdown", "[TEXTURES]", llformat("%d", result["upload_price_breakdown"]["texture"].asInteger()));
+ childSetTextArg("price_breakdown", "[MODEL]", llformat("%d", result["upload_price_breakdown"]["model"].asInteger()));
+
+ childSetTextArg("physics_breakdown", "[PCH]", llformat("%0.3f", result["model_physics_cost"]["hull"].asReal()));
+ childSetTextArg("physics_breakdown", "[PM]", llformat("%0.3f", result["model_physics_cost"]["mesh"].asReal()));
+ childSetTextArg("physics_breakdown", "[PHU]", llformat("%0.3f", result["model_physics_cost"]["decomposition"].asReal()));
+ childSetTextArg("streaming_breakdown", "[STR_TOTAL]", llformat("%d", result["streaming_cost"].asInteger()));
+ childSetTextArg("streaming_breakdown", "[STR_HIGH]", llformat("%d", result["streaming_params"]["high_lod"].asInteger()));
+ childSetTextArg("streaming_breakdown", "[STR_MED]", llformat("%d", result["streaming_params"]["medium_lod"].asInteger()));
+ childSetTextArg("streaming_breakdown", "[STR_LOW]", llformat("%d", result["streaming_params"]["low_lod"].asInteger()));
+ childSetTextArg("streaming_breakdown", "[STR_LOWEST]", llformat("%d", result["streaming_params"]["lowest_lod"].asInteger()));
+
+ childSetVisible("upload_fee", true);
+ childSetVisible("price_breakdown", true);
+ mUploadBtn->setEnabled(isModelUploadAllowed());
}
void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(S32 status, const std::string& reason, const LLSD& result)
{
- std::ostringstream out;
- out << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status;
- out << " : " << reason << ")";
- LL_WARNS() << out.str() << LL_ENDL;
- LLFloaterModelPreview::addStringToLog(out, false);
- doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, true));
+ std::ostringstream out;
+ out << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status;
+ out << " : " << reason << ")";
+ LL_WARNS() << out.str() << LL_ENDL;
+ LLFloaterModelPreview::addStringToLog(out, false);
+ doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, true));
if (result.has("upload_price"))
{
@@ -1878,81 +1878,81 @@ void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(S32 status, const std:
}
}
-/*virtual*/
+/*virtual*/
void LLFloaterModelPreview::onModelUploadSuccess()
{
- assert_main_thread();
- closeFloater(false);
+ assert_main_thread();
+ closeFloater(false);
}
-/*virtual*/
+/*virtual*/
void LLFloaterModelPreview::onModelUploadFailure()
{
- assert_main_thread();
- toggleCalculateButton(true);
- mUploadBtn->setEnabled(true);
+ assert_main_thread();
+ toggleCalculateButton(true);
+ mUploadBtn->setEnabled(true);
}
bool LLFloaterModelPreview::isModelUploadAllowed()
{
- bool allow_upload = mHasUploadPerm && !mUploadModelUrl.empty();
- if (mModelPreview)
- {
- allow_upload &= mModelPreview->mModelNoErrors;
- }
- return allow_upload;
+ bool allow_upload = mHasUploadPerm && !mUploadModelUrl.empty();
+ if (mModelPreview)
+ {
+ allow_upload &= mModelPreview->mModelNoErrors;
+ }
+ return allow_upload;
}
S32 LLFloaterModelPreview::DecompRequest::statusCallback(const char* status, S32 p1, S32 p2)
{
- if (mContinue)
- {
- setStatusMessage(llformat("%s: %d/%d", status, p1, p2));
- if (LLFloaterModelPreview::sInstance)
- {
- LLFloaterModelPreview::sInstance->setStatusMessage(mStatusMessage);
- }
- }
+ if (mContinue)
+ {
+ setStatusMessage(llformat("%s: %d/%d", status, p1, p2));
+ if (LLFloaterModelPreview::sInstance)
+ {
+ LLFloaterModelPreview::sInstance->setStatusMessage(mStatusMessage);
+ }
+ }
- return mContinue;
+ return mContinue;
}
void LLFloaterModelPreview::DecompRequest::completed()
{ //called from the main thread
- if (mContinue)
- {
- mModel->setConvexHullDecomposition(mHull);
-
- if (sInstance)
- {
- if (mContinue)
- {
- if (sInstance->mModelPreview)
- {
- sInstance->mModelPreview->mDirty = true;
- LLFloaterModelPreview::sInstance->mModelPreview->refresh();
- }
- }
-
- sInstance->mCurRequest.erase(this);
- }
- }
- else if (sInstance)
- {
- llassert(sInstance->mCurRequest.find(this) == sInstance->mCurRequest.end());
- }
+ if (mContinue)
+ {
+ mModel->setConvexHullDecomposition(mHull);
+
+ if (sInstance)
+ {
+ if (mContinue)
+ {
+ if (sInstance->mModelPreview)
+ {
+ sInstance->mModelPreview->mDirty = true;
+ LLFloaterModelPreview::sInstance->mModelPreview->refresh();
+ }
+ }
+
+ sInstance->mCurRequest.erase(this);
+ }
+ }
+ else if (sInstance)
+ {
+ llassert(sInstance->mCurRequest.find(this) == sInstance->mCurRequest.end());
+ }
}
void dump_llsd_to_file(const LLSD& content, std::string filename);
void LLFloaterModelPreview::onPermissionsReceived(const LLSD& result)
{
- dump_llsd_to_file(result,"perm_received.xml");
- std::string upload_status = result["mesh_upload_status"].asString();
- // BAP HACK: handle "" for case that MeshUploadFlag cap is broken.
- mHasUploadPerm = (("" == upload_status) || ("valid" == upload_status));
+ dump_llsd_to_file(result,"perm_received.xml");
+ std::string upload_status = result["mesh_upload_status"].asString();
+ // BAP HACK: handle "" for case that MeshUploadFlag cap is broken.
+ mHasUploadPerm = (("" == upload_status) || ("valid" == upload_status));
- if (!mHasUploadPerm)
+ if (!mHasUploadPerm)
{
LL_WARNS() << "Upload permission set to false because upload_status=\"" << upload_status << "\"" << LL_ENDL;
}
@@ -1961,25 +1961,25 @@ void LLFloaterModelPreview::onPermissionsReceived(const LLSD& result)
LL_WARNS() << "Upload permission set to true but uploadModelUrl is empty!" << LL_ENDL;
}
- // isModelUploadAllowed() includes mHasUploadPerm
- mUploadBtn->setEnabled(isModelUploadAllowed());
- getChild<LLTextBox>("warning_title")->setVisible(!mHasUploadPerm);
- getChild<LLTextBox>("warning_message")->setVisible(!mHasUploadPerm);
+ // isModelUploadAllowed() includes mHasUploadPerm
+ mUploadBtn->setEnabled(isModelUploadAllowed());
+ getChild<LLTextBox>("warning_title")->setVisible(!mHasUploadPerm);
+ getChild<LLTextBox>("warning_message")->setVisible(!mHasUploadPerm);
}
void LLFloaterModelPreview::setPermissonsErrorStatus(S32 status, const std::string& reason)
{
- LL_WARNS() << "LLFloaterModelPreview::setPermissonsErrorStatus(" << status << " : " << reason << ")" << LL_ENDL;
+ LL_WARNS() << "LLFloaterModelPreview::setPermissonsErrorStatus(" << status << " : " << reason << ")" << LL_ENDL;
- LLNotificationsUtil::add("MeshUploadPermError");
+ LLNotificationsUtil::add("MeshUploadPermError");
}
bool LLFloaterModelPreview::isModelLoading()
{
- if(mModelPreview)
- {
- return mModelPreview->mLoading;
- }
- return false;
+ if(mModelPreview)
+ {
+ return mModelPreview->mLoading;
+ }
+ return false;
}
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index bda042186b..20e645532b 100644
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,125 +52,125 @@ typedef std::map<std::string, LLJointOverrideData> joint_override_data_map_t;
class LLFloaterModelPreview : public LLFloaterModelUploadBase
{
public:
-
- class DecompRequest : public LLPhysicsDecomp::Request
- {
- public:
- S32 mContinue;
- LLPointer<LLModel> mModel;
-
- DecompRequest(const std::string& stage, LLModel* mdl);
- virtual S32 statusCallback(const char* status, S32 p1, S32 p2);
- virtual void completed();
-
- };
- static LLFloaterModelPreview* sInstance;
-
- LLFloaterModelPreview(const LLSD& key);
- virtual ~LLFloaterModelPreview();
-
- virtual BOOL postBuild();
+
+ class DecompRequest : public LLPhysicsDecomp::Request
+ {
+ public:
+ S32 mContinue;
+ LLPointer<LLModel> mModel;
+
+ DecompRequest(const std::string& stage, LLModel* mdl);
+ virtual S32 statusCallback(const char* status, S32 p1, S32 p2);
+ virtual void completed();
+
+ };
+ static LLFloaterModelPreview* sInstance;
+
+ LLFloaterModelPreview(const LLSD& key);
+ virtual ~LLFloaterModelPreview();
+
+ virtual BOOL postBuild();
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
-
- void initModelPreview();
- static bool showModelPreview();
-
- BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- BOOL handleHover(S32 x, S32 y, MASK mask);
- BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
-
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
-
- static void onMouseCaptureLostModelPreview(LLMouseHandler*);
- static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
- static void addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod = -1);
- static void addStringToLog(const std::string& str, bool flash);
- static void addStringToLog(const std::ostringstream& strm, bool flash);
- void clearAvatarTab(); // clears table
- void updateAvatarTab(bool highlight_overrides); // populates table and data as nessesary
-
- void setDetails(F32 x, F32 y, F32 z);
- void setPreviewLOD(S32 lod);
-
- void onBrowseLOD(S32 lod);
-
- static void onReset(void* data);
-
- static void onUpload(void* data);
-
- void refresh();
-
- void loadModel(S32 lod);
- void loadModel(S32 lod, const std::string& file_name, bool force_disable_slm = false);
-
- void loadHighLodModel();
-
- void onViewOptionChecked(LLUICtrl* ctrl);
- void onUploadOptionChecked(LLUICtrl* ctrl);
- bool isViewOptionChecked(const LLSD& userdata);
- bool isViewOptionEnabled(const LLSD& userdata);
- void setViewOptionEnabled(const std::string& option, bool enabled);
- void enableViewOption(const std::string& option);
- void disableViewOption(const std::string& option);
- void onShowSkinWeightChecked(LLUICtrl* ctrl);
-
- bool isModelLoading();
-
- // shows warning message if agent has no permissions to upload model
- /*virtual*/ void onPermissionsReceived(const LLSD& result);
-
- // called when error occurs during permissions request
- /*virtual*/ void setPermissonsErrorStatus(S32 status, const std::string& reason);
-
- /*virtual*/ void onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url);
- void handleModelPhysicsFeeReceived();
- /*virtual*/ void setModelPhysicsFeeErrorStatus(S32 status, const std::string& reason, const LLSD& result);
-
- /*virtual*/ void onModelUploadSuccess();
-
- /*virtual*/ void onModelUploadFailure();
-
- bool isModelUploadAllowed();
+
+ void initModelPreview();
+ static bool showModelPreview();
+
+ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ BOOL handleHover(S32 x, S32 y, MASK mask);
+ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
+
+ static void onMouseCaptureLostModelPreview(LLMouseHandler*);
+ static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
+ static void addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod = -1);
+ static void addStringToLog(const std::string& str, bool flash);
+ static void addStringToLog(const std::ostringstream& strm, bool flash);
+ void clearAvatarTab(); // clears table
+ void updateAvatarTab(bool highlight_overrides); // populates table and data as nessesary
+
+ void setDetails(F32 x, F32 y, F32 z);
+ void setPreviewLOD(S32 lod);
+
+ void onBrowseLOD(S32 lod);
+
+ static void onReset(void* data);
+
+ static void onUpload(void* data);
+
+ void refresh();
+
+ void loadModel(S32 lod);
+ void loadModel(S32 lod, const std::string& file_name, bool force_disable_slm = false);
+
+ void loadHighLodModel();
+
+ void onViewOptionChecked(LLUICtrl* ctrl);
+ void onUploadOptionChecked(LLUICtrl* ctrl);
+ bool isViewOptionChecked(const LLSD& userdata);
+ bool isViewOptionEnabled(const LLSD& userdata);
+ void setViewOptionEnabled(const std::string& option, bool enabled);
+ void enableViewOption(const std::string& option);
+ void disableViewOption(const std::string& option);
+ void onShowSkinWeightChecked(LLUICtrl* ctrl);
+
+ bool isModelLoading();
+
+ // shows warning message if agent has no permissions to upload model
+ /*virtual*/ void onPermissionsReceived(const LLSD& result);
+
+ // called when error occurs during permissions request
+ /*virtual*/ void setPermissonsErrorStatus(S32 status, const std::string& reason);
+
+ /*virtual*/ void onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url);
+ void handleModelPhysicsFeeReceived();
+ /*virtual*/ void setModelPhysicsFeeErrorStatus(S32 status, const std::string& reason, const LLSD& result);
+
+ /*virtual*/ void onModelUploadSuccess();
+
+ /*virtual*/ void onModelUploadFailure();
+
+ bool isModelUploadAllowed();
protected:
- friend class LLModelPreview;
- friend class LLMeshFilePicker;
- friend class LLPhysicsDecomp;
-
- void onDescriptionKeystroke(LLUICtrl*);
-
- static void onImportScaleCommit(LLUICtrl*, void*);
- static void onPelvisOffsetCommit(LLUICtrl*, void*);
-
- static void onPreviewLODCommit(LLUICtrl*,void*);
-
- static void onGenerateNormalsCommit(LLUICtrl*,void*);
-
- void toggleGenarateNormals();
-
- static void onAutoFillCommit(LLUICtrl*,void*);
-
- void onLODParamCommit(S32 lod, bool enforce_tri_limit);
- void draw3dPreview();
-
- static void onExplodeCommit(LLUICtrl*, void*);
-
- static void onPhysicsParamCommit(LLUICtrl* ctrl, void* userdata);
- static void onPhysicsStageExecute(LLUICtrl* ctrl, void* userdata);
- static void onCancel(LLUICtrl* ctrl, void* userdata);
- static void onPhysicsStageCancel(LLUICtrl* ctrl, void* userdata);
-
- static void onPhysicsBrowse(LLUICtrl* ctrl, void* userdata);
- static void onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata);
- static void onPhysicsOptimize(LLUICtrl* ctrl, void* userdata);
- static void onPhysicsDecomposeBack(LLUICtrl* ctrl, void* userdata);
- static void onPhysicsSimplifyBack(LLUICtrl* ctrl, void* userdata);
-
- void draw();
-
- void initDecompControls();
+ friend class LLModelPreview;
+ friend class LLMeshFilePicker;
+ friend class LLPhysicsDecomp;
+
+ void onDescriptionKeystroke(LLUICtrl*);
+
+ static void onImportScaleCommit(LLUICtrl*, void*);
+ static void onPelvisOffsetCommit(LLUICtrl*, void*);
+
+ static void onPreviewLODCommit(LLUICtrl*,void*);
+
+ static void onGenerateNormalsCommit(LLUICtrl*,void*);
+
+ void toggleGenarateNormals();
+
+ static void onAutoFillCommit(LLUICtrl*,void*);
+
+ void onLODParamCommit(S32 lod, bool enforce_tri_limit);
+ void draw3dPreview();
+
+ static void onExplodeCommit(LLUICtrl*, void*);
+
+ static void onPhysicsParamCommit(LLUICtrl* ctrl, void* userdata);
+ static void onPhysicsStageExecute(LLUICtrl* ctrl, void* userdata);
+ static void onCancel(LLUICtrl* ctrl, void* userdata);
+ static void onPhysicsStageCancel(LLUICtrl* ctrl, void* userdata);
+
+ static void onPhysicsBrowse(LLUICtrl* ctrl, void* userdata);
+ static void onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata);
+ static void onPhysicsOptimize(LLUICtrl* ctrl, void* userdata);
+ static void onPhysicsDecomposeBack(LLUICtrl* ctrl, void* userdata);
+ static void onPhysicsSimplifyBack(LLUICtrl* ctrl, void* userdata);
+
+ void draw();
+
+ void initDecompControls();
// FIXME - this function and mStatusMessage have no visible effect, and the
// actual status messages are managed by directly manipulation of
@@ -180,60 +180,60 @@ protected:
void setCtrlLoadFromFile(S32 lod);
- LLModelPreview* mModelPreview;
-
- LLPhysicsDecomp::decomp_params mDecompParams;
- LLPhysicsDecomp::decomp_params mDefaultDecompParams;
-
- S32 mLastMouseX;
- S32 mLastMouseY;
- LLRect mPreviewRect;
- static S32 sUploadAmount;
-
- std::set<LLPointer<DecompRequest> > mCurRequest;
- std::string mStatusMessage;
-
- //use "disabled" as false by default
- std::map<std::string, bool> mViewOptionDisabled;
-
- //store which lod mode each LOD is using
- // See eLoDMode
- S32 mLODMode[4];
-
- LLMutex* mStatusLock;
-
- LLSD mModelPhysicsFee;
+ LLModelPreview* mModelPreview;
+
+ LLPhysicsDecomp::decomp_params mDecompParams;
+ LLPhysicsDecomp::decomp_params mDefaultDecompParams;
+
+ S32 mLastMouseX;
+ S32 mLastMouseY;
+ LLRect mPreviewRect;
+ static S32 sUploadAmount;
+
+ std::set<LLPointer<DecompRequest> > mCurRequest;
+ std::string mStatusMessage;
+
+ //use "disabled" as false by default
+ std::map<std::string, bool> mViewOptionDisabled;
+
+ //store which lod mode each LOD is using
+ // See eLoDMode
+ S32 mLODMode[4];
+
+ LLMutex* mStatusLock;
+
+ LLSD mModelPhysicsFee;
private:
void onClickCalculateBtn();
void onJointListSelection();
- void onLoDSourceCommit(S32 lod);
+ void onLoDSourceCommit(S32 lod);
- void modelUpdated(bool calculate_visible);
+ void modelUpdated(bool calculate_visible);
- // Toggles between "Calculate weights & fee" and "Upload" buttons.
+ // Toggles between "Calculate weights & fee" and "Upload" buttons.
void toggleCalculateButton();
- void toggleCalculateButton(bool visible);
+ void toggleCalculateButton(bool visible);
- // resets display options of model preview to their defaults.
- void resetDisplayOptions();
+ // resets display options of model preview to their defaults.
+ void resetDisplayOptions();
- void resetUploadOptions();
- void clearLogTab();
- void prepareToLoadModel(S32 lod);
+ void resetUploadOptions();
+ void clearLogTab();
+ void prepareToLoadModel(S32 lod);
- void createSmoothComboBox(LLComboBox* combo_box, float min, float max);
+ void createSmoothComboBox(LLComboBox* combo_box, float min, float max);
- LLButton* mUploadBtn;
- LLButton* mCalculateBtn;
- LLViewerTextEditor* mUploadLogText;
- LLTabContainer* mTabContainer;
+ LLButton* mUploadBtn;
+ LLButton* mCalculateBtn;
+ LLViewerTextEditor* mUploadLogText;
+ LLTabContainer* mTabContainer;
- S32 mAvatarTabIndex; // just to avoid any issues in case of xml changes
- std::string mSelectedJointName;
+ S32 mAvatarTabIndex; // just to avoid any issues in case of xml changes
+ std::string mSelectedJointName;
- joint_override_data_map_t mJointOverrides[LLModel::NUM_LODS];
+ joint_override_data_map_t mJointOverrides[LLModel::NUM_LODS];
};
#endif // LL_LLFLOATERMODELPREVIEW_H
diff --git a/indra/newview/llfloatermodeluploadbase.cpp b/indra/newview/llfloatermodeluploadbase.cpp
index 4427e913e3..ec4f7593ca 100644
--- a/indra/newview/llfloatermodeluploadbase.cpp
+++ b/indra/newview/llfloatermodeluploadbase.cpp
@@ -40,25 +40,25 @@ LLFloaterModelUploadBase::LLFloaterModelUploadBase(const LLSD& key)
void LLFloaterModelUploadBase::requestAgentUploadPermissions()
{
- std::string capability = "MeshUploadFlag";
- std::string url = gAgent.getRegionCapability(capability);
+ std::string capability = "MeshUploadFlag";
+ std::string url = gAgent.getRegionCapability(capability);
- if (!url.empty())
- {
- LL_INFOS()<< typeid(*this).name()
- << "::requestAgentUploadPermissions() requesting for upload model permissions from: "
- << url << LL_ENDL;
+ if (!url.empty())
+ {
+ LL_INFOS()<< typeid(*this).name()
+ << "::requestAgentUploadPermissions() requesting for upload model permissions from: "
+ << url << LL_ENDL;
LLCoros::instance().launch("LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro",
boost::bind(&LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro, this, url, getPermObserverHandle()));
- }
- else
- {
- LLSD args;
- args["CAPABILITY"] = capability;
- LLNotificationsUtil::add("RegionCapabilityRequestError", args);
- // BAP HACK avoid being blocked by broken server side stuff
- mHasUploadPerm = true;
- }
+ }
+ else
+ {
+ LLSD args;
+ args["CAPABILITY"] = capability;
+ LLNotificationsUtil::add("RegionCapabilityRequestError", args);
+ // BAP HACK avoid being blocked by broken server side stuff
+ mHasUploadPerm = true;
+ }
}
void LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro(std::string url,
@@ -78,7 +78,7 @@ void LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro(std::string url
LLUploadPermissionsObserver* observer = observerHandle.get();
if (!observer)
- {
+ {
LL_WARNS("MeshUploadFlag") << "Unable to get observer after call to '" << url << "' aborting." << LL_ENDL;
return;
}
diff --git a/indra/newview/llfloatermodeluploadbase.h b/indra/newview/llfloatermodeluploadbase.h
index 721fce059e..67d950e7f1 100644
--- a/indra/newview/llfloatermodeluploadbase.h
+++ b/indra/newview/llfloatermodeluploadbase.h
@@ -35,31 +35,31 @@ class LLFloaterModelUploadBase : public LLFloater, public LLUploadPermissionsObs
{
public:
- LLFloaterModelUploadBase(const LLSD& key);
+ LLFloaterModelUploadBase(const LLSD& key);
- virtual ~LLFloaterModelUploadBase(){};
+ virtual ~LLFloaterModelUploadBase(){};
- virtual void setPermissonsErrorStatus(S32 status, const std::string& reason) = 0;
+ virtual void setPermissonsErrorStatus(S32 status, const std::string& reason) = 0;
- virtual void onPermissionsReceived(const LLSD& result) = 0;
+ virtual void onPermissionsReceived(const LLSD& result) = 0;
- virtual void onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url) = 0;
+ virtual void onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url) = 0;
- virtual void setModelPhysicsFeeErrorStatus(S32 status, const std::string& reason, const LLSD& result) = 0;
+ virtual void setModelPhysicsFeeErrorStatus(S32 status, const std::string& reason, const LLSD& result) = 0;
- virtual void onModelUploadSuccess() {};
+ virtual void onModelUploadSuccess() {};
- virtual void onModelUploadFailure() {};
+ virtual void onModelUploadFailure() {};
protected:
- // requests agent's permissions to upload model
- void requestAgentUploadPermissions();
+ // requests agent's permissions to upload model
+ void requestAgentUploadPermissions();
void requestAgentUploadPermissionsCoro(std::string url, LLHandle<LLUploadPermissionsObserver> observerHandle);
- std::string mUploadModelUrl;
- bool mHasUploadPerm;
+ std::string mUploadModelUrl;
+ bool mHasUploadPerm;
};
#endif /* LL_LLFLOATERMODELUPLOADBASE_H */
diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp
index 21d106c8b1..f93af9c312 100644
--- a/indra/newview/llfloatermyenvironment.cpp
+++ b/indra/newview/llfloatermyenvironment.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatergesture.cpp
* @brief LLFloaterMyEnvironment class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -278,7 +278,7 @@ void LLFloaterMyEnvironment::onDoApply(const std::string &context)
std::string name = itemp->getName();
U32 flags(0);
-
+
if (!itemp->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID()))
flags |= LLSettingsBase::FLAG_NOMOD;
if (!itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
@@ -317,7 +317,7 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context)
return false;
if (context == PARAMETER_EDIT)
- {
+ {
return (selected.size() == 1) && isSettingSelected(selected.front());
}
else if (context == PARAMETER_COPY)
@@ -364,11 +364,11 @@ bool LLFloaterMyEnvironment::canApply(const std::string &context)
return false;
if (context == PARAMETER_REGION)
- {
+ {
return LLEnvironment::instance().canAgentUpdateRegionEnvironment();
}
else if (context == PARAMETER_PARCEL)
- {
+ {
return LLEnvironment::instance().canAgentUpdateParcelEnvironment();
}
else
diff --git a/indra/newview/llfloatermyenvironment.h b/indra/newview/llfloatermyenvironment.h
index fea0981590..54e23c4f6e 100644
--- a/indra/newview/llfloatermyenvironment.h
+++ b/indra/newview/llfloatermyenvironment.h
@@ -1,32 +1,32 @@
-/**
+/**
* @file llfloatermyenvironment.h
* @brief LLFloaterMyEnvironment class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATERMYENVIRONMENT_H
#define LL_LLFLOATERMYENVIRONMENT_H
-#include <vector>
+#include <vector>
#include "llfloater.h"
#include "llinventoryobserver.h"
@@ -36,7 +36,7 @@
class LLInventoryPanel;
class LLFloaterMyEnvironment
-: public LLFloater, LLInventoryFetchDescendentsObserver
+: public LLFloater, LLInventoryFetchDescendentsObserver
{
LOG_CLASS(LLFloaterMyEnvironment);
public:
diff --git a/indra/newview/llfloatermyscripts.cpp b/indra/newview/llfloatermyscripts.cpp
index 6f9a6c9066..5426629430 100644
--- a/indra/newview/llfloatermyscripts.cpp
+++ b/indra/newview/llfloatermyscripts.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatermyscripts.cpp
* @brief LLFloaterMyScripts class implementation.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,25 +39,25 @@
const S32 SIZE_OF_ONE_KB = 1024;
LLFloaterMyScripts::LLFloaterMyScripts(const LLSD& seed)
- : LLFloater(seed),
- mGotAttachmentMemoryUsed(false),
- mAttachmentDetailsRequested(false),
- mAttachmentMemoryMax(0),
- mAttachmentMemoryUsed(0),
- mGotAttachmentURLsUsed(false),
- mAttachmentURLsMax(0),
- mAttachmentURLsUsed(0)
+ : LLFloater(seed),
+ mGotAttachmentMemoryUsed(false),
+ mAttachmentDetailsRequested(false),
+ mAttachmentMemoryMax(0),
+ mAttachmentMemoryUsed(0),
+ mGotAttachmentURLsUsed(false),
+ mAttachmentURLsMax(0),
+ mAttachmentURLsUsed(0)
{
}
BOOL LLFloaterMyScripts::postBuild()
{
- childSetAction("refresh_list_btn", onClickRefresh, this);
+ childSetAction("refresh_list_btn", onClickRefresh, this);
- std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
- mAttachmentDetailsRequested = requestAttachmentDetails();
- return TRUE;
+ std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
+ mAttachmentDetailsRequested = requestAttachmentDetails();
+ return TRUE;
}
// virtual
@@ -73,20 +73,20 @@ void LLFloaterMyScripts::onOpen(const LLSD& key)
bool LLFloaterMyScripts::requestAttachmentDetails()
{
- if (!gAgent.getRegion()) return false;
-
- LLSD body;
- std::string url = gAgent.getRegion()->getCapability("AttachmentResources");
- if (!url.empty())
- {
- LLCoros::instance().launch("LLFloaterMyScripts::getAttachmentLimitsCoro",
- boost::bind(&LLFloaterMyScripts::getAttachmentLimitsCoro, this, url));
- return true;
- }
- else
- {
- return false;
- }
+ if (!gAgent.getRegion()) return false;
+
+ LLSD body;
+ std::string url = gAgent.getRegion()->getCapability("AttachmentResources");
+ if (!url.empty())
+ {
+ LLCoros::instance().launch("LLFloaterMyScripts::getAttachmentLimitsCoro",
+ boost::bind(&LLFloaterMyScripts::getAttachmentLimitsCoro, this, url));
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
void LLFloaterMyScripts::getAttachmentLimitsCoro(std::string url)
@@ -115,193 +115,193 @@ void LLFloaterMyScripts::getAttachmentLimitsCoro(std::string url)
return;
}
- instance->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
+ instance->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
- LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
+ LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
if (btn)
{
btn->setEnabled(true);
}
result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
- instance->setAttachmentDetails(result);
+ instance->setAttachmentDetails(result);
}
void LLFloaterMyScripts::setAttachmentDetails(LLSD content)
{
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
-
- if(!list)
- {
- return;
- }
-
- S32 number_attachments = content["attachments"].size();
-
- for(int i = 0; i < number_attachments; i++)
- {
- std::string humanReadableLocation = "";
- if(content["attachments"][i].has("location"))
- {
- std::string actualLocation = content["attachments"][i]["location"];
- humanReadableLocation = LLTrans::getString(actualLocation.c_str());
- }
-
- S32 number_objects = content["attachments"][i]["objects"].size();
- for(int j = 0; j < number_objects; j++)
- {
- LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID();
- S32 size = 0;
- if(content["attachments"][i]["objects"][j]["resources"].has("memory"))
- {
- size = content["attachments"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
- }
- S32 urls = 0;
- if(content["attachments"][i]["objects"][j]["resources"].has("urls"))
- {
- urls = content["attachments"][i]["objects"][j]["resources"]["urls"].asInteger();
- }
- std::string name = content["attachments"][i]["objects"][j]["name"].asString();
-
- LLSD element;
-
- element["id"] = task_id;
- element["columns"][0]["column"] = "size";
- element["columns"][0]["value"] = llformat("%d", size);
- element["columns"][0]["font"] = "SANSSERIF";
- element["columns"][0]["halign"] = LLFontGL::RIGHT;
-
- element["columns"][1]["column"] = "urls";
- element["columns"][1]["value"] = llformat("%d", urls);
- element["columns"][1]["font"] = "SANSSERIF";
- element["columns"][1]["halign"] = LLFontGL::RIGHT;
-
- element["columns"][2]["column"] = "name";
- element["columns"][2]["value"] = name;
- element["columns"][2]["font"] = "SANSSERIF";
-
- element["columns"][3]["column"] = "location";
- element["columns"][3]["value"] = humanReadableLocation;
- element["columns"][3]["font"] = "SANSSERIF";
-
- list->addElement(element);
- }
- }
-
- setAttachmentSummary(content);
-
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
-
- LLButton* btn = getChild<LLButton>("refresh_list_btn");
- if(btn)
- {
- btn->setEnabled(true);
- }
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
+
+ if(!list)
+ {
+ return;
+ }
+
+ S32 number_attachments = content["attachments"].size();
+
+ for(int i = 0; i < number_attachments; i++)
+ {
+ std::string humanReadableLocation = "";
+ if(content["attachments"][i].has("location"))
+ {
+ std::string actualLocation = content["attachments"][i]["location"];
+ humanReadableLocation = LLTrans::getString(actualLocation.c_str());
+ }
+
+ S32 number_objects = content["attachments"][i]["objects"].size();
+ for(int j = 0; j < number_objects; j++)
+ {
+ LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID();
+ S32 size = 0;
+ if(content["attachments"][i]["objects"][j]["resources"].has("memory"))
+ {
+ size = content["attachments"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
+ }
+ S32 urls = 0;
+ if(content["attachments"][i]["objects"][j]["resources"].has("urls"))
+ {
+ urls = content["attachments"][i]["objects"][j]["resources"]["urls"].asInteger();
+ }
+ std::string name = content["attachments"][i]["objects"][j]["name"].asString();
+
+ LLSD element;
+
+ element["id"] = task_id;
+ element["columns"][0]["column"] = "size";
+ element["columns"][0]["value"] = llformat("%d", size);
+ element["columns"][0]["font"] = "SANSSERIF";
+ element["columns"][0]["halign"] = LLFontGL::RIGHT;
+
+ element["columns"][1]["column"] = "urls";
+ element["columns"][1]["value"] = llformat("%d", urls);
+ element["columns"][1]["font"] = "SANSSERIF";
+ element["columns"][1]["halign"] = LLFontGL::RIGHT;
+
+ element["columns"][2]["column"] = "name";
+ element["columns"][2]["value"] = name;
+ element["columns"][2]["font"] = "SANSSERIF";
+
+ element["columns"][3]["column"] = "location";
+ element["columns"][3]["value"] = humanReadableLocation;
+ element["columns"][3]["font"] = "SANSSERIF";
+
+ list->addElement(element);
+ }
+ }
+
+ setAttachmentSummary(content);
+
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
+
+ LLButton* btn = getChild<LLButton>("refresh_list_btn");
+ if(btn)
+ {
+ btn->setEnabled(true);
+ }
}
void LLFloaterMyScripts::clearList()
{
- LLCtrlListInterface *list = childGetListInterface("scripts_list");
+ LLCtrlListInterface *list = childGetListInterface("scripts_list");
- if (list)
- {
- list->operateOnAll(LLCtrlListInterface::OP_DELETE);
- }
+ if (list)
+ {
+ list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+ }
- std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
+ std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
}
void LLFloaterMyScripts::setAttachmentSummary(LLSD content)
{
- if(content["summary"]["used"][0]["type"].asString() == std::string("memory"))
- {
- mAttachmentMemoryUsed = content["summary"]["used"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mAttachmentMemoryMax = content["summary"]["available"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mGotAttachmentMemoryUsed = true;
- }
- else if(content["summary"]["used"][1]["type"].asString() == std::string("memory"))
- {
- mAttachmentMemoryUsed = content["summary"]["used"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mAttachmentMemoryMax = content["summary"]["available"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mGotAttachmentMemoryUsed = true;
- }
- else
- {
- LL_WARNS() << "attachment details don't contain memory summary info" << LL_ENDL;
- return;
- }
-
- if(content["summary"]["used"][0]["type"].asString() == std::string("urls"))
- {
- mAttachmentURLsUsed = content["summary"]["used"][0]["amount"].asInteger();
- mAttachmentURLsMax = content["summary"]["available"][0]["amount"].asInteger();
- mGotAttachmentURLsUsed = true;
- }
- else if(content["summary"]["used"][1]["type"].asString() == std::string("urls"))
- {
- mAttachmentURLsUsed = content["summary"]["used"][1]["amount"].asInteger();
- mAttachmentURLsMax = content["summary"]["available"][1]["amount"].asInteger();
- mGotAttachmentURLsUsed = true;
- }
- else
- {
- LL_WARNS() << "attachment details don't contain urls summary info" << LL_ENDL;
- return;
- }
-
- if((mAttachmentMemoryUsed >= 0) && (mAttachmentMemoryMax >= 0))
- {
- LLStringUtil::format_map_t args_attachment_memory;
- args_attachment_memory["[COUNT]"] = llformat ("%d", mAttachmentMemoryUsed);
- std::string translate_message = "ScriptLimitsMemoryUsedSimple";
-
- if (0 < mAttachmentMemoryMax)
- {
- S32 attachment_memory_available = mAttachmentMemoryMax - mAttachmentMemoryUsed;
-
- args_attachment_memory["[MAX]"] = llformat ("%d", mAttachmentMemoryMax);
- args_attachment_memory["[AVAILABLE]"] = llformat ("%d", attachment_memory_available);
- translate_message = "ScriptLimitsMemoryUsed";
- }
-
- getChild<LLUICtrl>("memory_used")->setValue(LLTrans::getString(translate_message, args_attachment_memory));
- }
-
- if((mAttachmentURLsUsed >= 0) && (mAttachmentURLsMax >= 0))
- {
- S32 attachment_urls_available = mAttachmentURLsMax - mAttachmentURLsUsed;
-
- LLStringUtil::format_map_t args_attachment_urls;
- args_attachment_urls["[COUNT]"] = llformat ("%d", mAttachmentURLsUsed);
- args_attachment_urls["[MAX]"] = llformat ("%d", mAttachmentURLsMax);
- args_attachment_urls["[AVAILABLE]"] = llformat ("%d", attachment_urls_available);
- std::string msg_attachment_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_attachment_urls);
- getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_attachment_urls));
- }
+ if(content["summary"]["used"][0]["type"].asString() == std::string("memory"))
+ {
+ mAttachmentMemoryUsed = content["summary"]["used"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mAttachmentMemoryMax = content["summary"]["available"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mGotAttachmentMemoryUsed = true;
+ }
+ else if(content["summary"]["used"][1]["type"].asString() == std::string("memory"))
+ {
+ mAttachmentMemoryUsed = content["summary"]["used"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mAttachmentMemoryMax = content["summary"]["available"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mGotAttachmentMemoryUsed = true;
+ }
+ else
+ {
+ LL_WARNS() << "attachment details don't contain memory summary info" << LL_ENDL;
+ return;
+ }
+
+ if(content["summary"]["used"][0]["type"].asString() == std::string("urls"))
+ {
+ mAttachmentURLsUsed = content["summary"]["used"][0]["amount"].asInteger();
+ mAttachmentURLsMax = content["summary"]["available"][0]["amount"].asInteger();
+ mGotAttachmentURLsUsed = true;
+ }
+ else if(content["summary"]["used"][1]["type"].asString() == std::string("urls"))
+ {
+ mAttachmentURLsUsed = content["summary"]["used"][1]["amount"].asInteger();
+ mAttachmentURLsMax = content["summary"]["available"][1]["amount"].asInteger();
+ mGotAttachmentURLsUsed = true;
+ }
+ else
+ {
+ LL_WARNS() << "attachment details don't contain urls summary info" << LL_ENDL;
+ return;
+ }
+
+ if((mAttachmentMemoryUsed >= 0) && (mAttachmentMemoryMax >= 0))
+ {
+ LLStringUtil::format_map_t args_attachment_memory;
+ args_attachment_memory["[COUNT]"] = llformat ("%d", mAttachmentMemoryUsed);
+ std::string translate_message = "ScriptLimitsMemoryUsedSimple";
+
+ if (0 < mAttachmentMemoryMax)
+ {
+ S32 attachment_memory_available = mAttachmentMemoryMax - mAttachmentMemoryUsed;
+
+ args_attachment_memory["[MAX]"] = llformat ("%d", mAttachmentMemoryMax);
+ args_attachment_memory["[AVAILABLE]"] = llformat ("%d", attachment_memory_available);
+ translate_message = "ScriptLimitsMemoryUsed";
+ }
+
+ getChild<LLUICtrl>("memory_used")->setValue(LLTrans::getString(translate_message, args_attachment_memory));
+ }
+
+ if((mAttachmentURLsUsed >= 0) && (mAttachmentURLsMax >= 0))
+ {
+ S32 attachment_urls_available = mAttachmentURLsMax - mAttachmentURLsUsed;
+
+ LLStringUtil::format_map_t args_attachment_urls;
+ args_attachment_urls["[COUNT]"] = llformat ("%d", mAttachmentURLsUsed);
+ args_attachment_urls["[MAX]"] = llformat ("%d", mAttachmentURLsMax);
+ args_attachment_urls["[AVAILABLE]"] = llformat ("%d", attachment_urls_available);
+ std::string msg_attachment_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_attachment_urls);
+ getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_attachment_urls));
+ }
}
// static
void LLFloaterMyScripts::onClickRefresh(void* userdata)
{
- LLFloaterMyScripts* instance = LLFloaterReg::getTypedInstance<LLFloaterMyScripts>("my_scripts");
- if(instance)
- {
- LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
-
- //To stop people from hammering the refesh button and accidentally dosing themselves - enough requests can crash the viewer!
- //turn the button off, then turn it on when we get a response
- if(btn)
- {
- btn->setEnabled(false);
- }
- instance->clearList();
- instance->mAttachmentDetailsRequested = instance->requestAttachmentDetails();
- }
- else
- {
- LL_WARNS() << "could not find LLFloaterMyScripts instance after refresh button clicked" << LL_ENDL;
- }
+ LLFloaterMyScripts* instance = LLFloaterReg::getTypedInstance<LLFloaterMyScripts>("my_scripts");
+ if(instance)
+ {
+ LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
+
+ //To stop people from hammering the refesh button and accidentally dosing themselves - enough requests can crash the viewer!
+ //turn the button off, then turn it on when we get a response
+ if(btn)
+ {
+ btn->setEnabled(false);
+ }
+ instance->clearList();
+ instance->mAttachmentDetailsRequested = instance->requestAttachmentDetails();
+ }
+ else
+ {
+ LL_WARNS() << "could not find LLFloaterMyScripts instance after refresh button clicked" << LL_ENDL;
+ }
}
diff --git a/indra/newview/llfloatermyscripts.h b/indra/newview/llfloatermyscripts.h
index 3c053a0223..857a2d72f2 100644
--- a/indra/newview/llfloatermyscripts.h
+++ b/indra/newview/llfloatermyscripts.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatermyscripts.h
* @brief LLFloaterMyScripts class definition.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,30 +33,30 @@
class LLFloaterMyScripts : public LLFloater
{
public:
- LLFloaterMyScripts(const LLSD& seed);
+ LLFloaterMyScripts(const LLSD& seed);
- BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- void setAttachmentDetails(LLSD content);
- void setAttachmentSummary(LLSD content);
- bool requestAttachmentDetails();
- void clearList();
+ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ void setAttachmentDetails(LLSD content);
+ void setAttachmentSummary(LLSD content);
+ bool requestAttachmentDetails();
+ void clearList();
private:
- void getAttachmentLimitsCoro(std::string url);
+ void getAttachmentLimitsCoro(std::string url);
- bool mGotAttachmentMemoryUsed;
- bool mAttachmentDetailsRequested;
- S32 mAttachmentMemoryMax;
- S32 mAttachmentMemoryUsed;
+ bool mGotAttachmentMemoryUsed;
+ bool mAttachmentDetailsRequested;
+ S32 mAttachmentMemoryMax;
+ S32 mAttachmentMemoryUsed;
- bool mGotAttachmentURLsUsed;
- S32 mAttachmentURLsMax;
- S32 mAttachmentURLsUsed;
+ bool mGotAttachmentURLsUsed;
+ S32 mAttachmentURLsMax;
+ S32 mAttachmentURLsUsed;
protected:
-
- static void onClickRefresh(void* userdata);
+
+ static void onClickRefresh(void* userdata);
};
#endif
diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp
index 1e9549a04e..b47deb838b 100644
--- a/indra/newview/llfloaternamedesc.cpp
+++ b/indra/newview/llfloaternamedesc.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaternamedesc.cpp
* @brief LLFloaterNameDesc class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,8 +41,8 @@
#include "lldir.h"
#include "llfloaterperms.h"
#include "llviewercontrol.h"
-#include "llviewermenufile.h" // upload_new_resource()
-#include "llstatusbar.h" // can_afford_transaction()
+#include "llviewermenufile.h" // upload_new_resource()
+#include "llstatusbar.h" // can_afford_transaction()
#include "llnotificationsutil.h"
#include "lluictrlfactory.h"
#include "llstring.h"
@@ -63,11 +63,11 @@ const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
// LLFloaterNameDesc()
//-----------------------------------------------------------------------------
LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename )
- : LLFloater(filename),
- mIsAudio(FALSE)
+ : LLFloater(filename),
+ mIsAudio(FALSE)
{
- mFilenameAndPath = filename.asString();
- mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false);
+ mFilenameAndPath = filename.asString();
+ mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false);
}
//-----------------------------------------------------------------------------
@@ -75,86 +75,86 @@ LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename )
//-----------------------------------------------------------------------------
BOOL LLFloaterNameDesc::postBuild()
{
- LLRect r;
+ LLRect r;
+
+ std::string asset_name = mFilename;
+ LLStringUtil::replaceNonstandardASCII( asset_name, '?' );
+ LLStringUtil::replaceChar(asset_name, '|', '?');
+ LLStringUtil::stripNonprintable(asset_name);
+ LLStringUtil::trim(asset_name);
+
+ asset_name = gDirUtilp->getBaseFileName(asset_name, true); // no extsntion
- std::string asset_name = mFilename;
- LLStringUtil::replaceNonstandardASCII( asset_name, '?' );
- LLStringUtil::replaceChar(asset_name, '|', '?');
- LLStringUtil::stripNonprintable(asset_name);
- LLStringUtil::trim(asset_name);
+ setTitle(mFilename);
- asset_name = gDirUtilp->getBaseFileName(asset_name, true); // no extsntion
+ centerWithin(gViewerWindow->getRootView()->getRect());
- setTitle(mFilename);
+ S32 line_width = getRect().getWidth() - 2 * PREVIEW_HPAD;
+ S32 y = getRect().getHeight() - PREVIEW_LINE_HEIGHT;
- centerWithin(gViewerWindow->getRootView()->getRect());
+ r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
+ y -= PREVIEW_LINE_HEIGHT;
- S32 line_width = getRect().getWidth() - 2 * PREVIEW_HPAD;
- S32 y = getRect().getHeight() - PREVIEW_LINE_HEIGHT;
+ r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
- r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
- y -= PREVIEW_LINE_HEIGHT;
+ getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
+ getChild<LLUICtrl>("name_form")->setValue(LLSD(asset_name));
- r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
+ LLLineEditor *NameEditor = getChild<LLLineEditor>("name_form");
+ if (NameEditor)
+ {
+ NameEditor->setMaxTextLength(DB_INV_ITEM_NAME_STR_LEN);
+ NameEditor->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ }
- getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
- getChild<LLUICtrl>("name_form")->setValue(LLSD(asset_name));
+ y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
+ y -= PREVIEW_LINE_HEIGHT;
- LLLineEditor *NameEditor = getChild<LLLineEditor>("name_form");
- if (NameEditor)
- {
- NameEditor->setMaxTextLength(DB_INV_ITEM_NAME_STR_LEN);
- NameEditor->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
- }
+ r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
+ getChild<LLUICtrl>("description_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
+ LLLineEditor *DescEditor = getChild<LLLineEditor>("description_form");
+ if (DescEditor)
+ {
+ DescEditor->setMaxTextLength(DB_INV_ITEM_DESC_STR_LEN);
+ DescEditor->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ }
- y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
- y -= PREVIEW_LINE_HEIGHT;
+ y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
- r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
- getChild<LLUICtrl>("description_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
- LLLineEditor *DescEditor = getChild<LLLineEditor>("description_form");
- if (DescEditor)
- {
- DescEditor->setMaxTextLength(DB_INV_ITEM_DESC_STR_LEN);
- DescEditor->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
- }
+ // Cancel button
+ getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this));
- y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
+ S32 expected_upload_cost = getExpectedUploadCost();
+ getChild<LLUICtrl>("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", expected_upload_cost));
- // Cancel button
- getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this));
+ LLTextBox* info_text = getChild<LLTextBox>("info_text");
+ if (info_text)
+ {
+ info_text->setValue(LLTrans::getString("UploadFeeInfo"));
+ }
- S32 expected_upload_cost = getExpectedUploadCost();
- getChild<LLUICtrl>("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", expected_upload_cost));
+ setDefaultBtn("ok_btn");
- LLTextBox* info_text = getChild<LLTextBox>("info_text");
- if (info_text)
- {
- info_text->setValue(LLTrans::getString("UploadFeeInfo"));
- }
-
- setDefaultBtn("ok_btn");
-
- return TRUE;
+ return TRUE;
}
S32 LLFloaterNameDesc::getExpectedUploadCost() const
{
std::string exten = gDirUtilp->getExtension(mFilename);
- LLAssetType::EType asset_type;
- S32 upload_cost = -1;
- if (LLResourceUploadInfo::findAssetTypeOfExtension(exten, asset_type))
- {
- if (!LLAgentBenefitsMgr::current().findUploadCost(asset_type, upload_cost))
- {
- LL_WARNS() << "Unable to find upload cost for asset type " << asset_type << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS() << "Unable to find upload cost for " << mFilename << LL_ENDL;
- }
- return upload_cost;
+ LLAssetType::EType asset_type;
+ S32 upload_cost = -1;
+ if (LLResourceUploadInfo::findAssetTypeOfExtension(exten, asset_type))
+ {
+ if (!LLAgentBenefitsMgr::current().findUploadCost(asset_type, upload_cost))
+ {
+ LL_WARNS() << "Unable to find upload cost for asset type " << asset_type << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Unable to find upload cost for " << mFilename << LL_ENDL;
+ }
+ return upload_cost;
}
//-----------------------------------------------------------------------------
@@ -162,7 +162,7 @@ S32 LLFloaterNameDesc::getExpectedUploadCost() const
//-----------------------------------------------------------------------------
LLFloaterNameDesc::~LLFloaterNameDesc()
{
- gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
+ gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
}
// Sub-classes should override this function if they allow editing
@@ -178,7 +178,7 @@ void LLFloaterNameDesc::onCommit()
//-----------------------------------------------------------------------------
void LLFloaterNameDesc::doCommit()
{
- onCommit();
+ onCommit();
}
//-----------------------------------------------------------------------------
@@ -186,10 +186,10 @@ void LLFloaterNameDesc::doCommit()
//-----------------------------------------------------------------------------
void LLFloaterNameDesc::onBtnOK( )
{
- getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads
-
- LLAssetStorage::LLStoreAssetCallback callback;
- S32 expected_upload_cost = getExpectedUploadCost();
+ getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads
+
+ LLAssetStorage::LLStoreAssetCallback callback;
+ S32 expected_upload_cost = getExpectedUploadCost();
if (can_afford_transaction(expected_upload_cost))
{
void *nruserdata = NULL;
@@ -214,7 +214,7 @@ void LLFloaterNameDesc::onBtnOK( )
LLNotificationsUtil::add("ErrorCannotAffordUpload", args);
}
- closeFloater(false);
+ closeFloater(false);
}
//-----------------------------------------------------------------------------
@@ -222,7 +222,7 @@ void LLFloaterNameDesc::onBtnOK( )
//-----------------------------------------------------------------------------
void LLFloaterNameDesc::onBtnCancel()
{
- closeFloater(false);
+ closeFloater(false);
}
@@ -231,19 +231,19 @@ void LLFloaterNameDesc::onBtnCancel()
//-----------------------------------------------------------------------------
LLFloaterSoundPreview::LLFloaterSoundPreview(const LLSD& filename )
- : LLFloaterNameDesc(filename)
+ : LLFloaterNameDesc(filename)
{
- mIsAudio = TRUE;
+ mIsAudio = TRUE;
}
BOOL LLFloaterSoundPreview::postBuild()
{
- if (!LLFloaterNameDesc::postBuild())
- {
- return FALSE;
- }
- getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
- return TRUE;
+ if (!LLFloaterNameDesc::postBuild())
+ {
+ return FALSE;
+ }
+ getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
+ return TRUE;
}
@@ -252,18 +252,18 @@ BOOL LLFloaterSoundPreview::postBuild()
//-----------------------------------------------------------------------------
LLFloaterAnimPreview::LLFloaterAnimPreview(const LLSD& filename )
- : LLFloaterNameDesc(filename)
+ : LLFloaterNameDesc(filename)
{
}
BOOL LLFloaterAnimPreview::postBuild()
{
- if (!LLFloaterNameDesc::postBuild())
- {
- return FALSE;
- }
- getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
- return TRUE;
+ if (!LLFloaterNameDesc::postBuild())
+ {
+ return FALSE;
+ }
+ getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -271,17 +271,17 @@ BOOL LLFloaterAnimPreview::postBuild()
//-----------------------------------------------------------------------------
LLFloaterScriptPreview::LLFloaterScriptPreview(const LLSD& filename )
- : LLFloaterNameDesc(filename)
+ : LLFloaterNameDesc(filename)
{
- mIsText = TRUE;
+ mIsText = TRUE;
}
BOOL LLFloaterScriptPreview::postBuild()
{
- if (!LLFloaterNameDesc::postBuild())
- {
- return FALSE;
- }
- getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
- return TRUE;
+ if (!LLFloaterNameDesc::postBuild())
+ {
+ return FALSE;
+ }
+ getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
+ return TRUE;
}
diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h
index 589f470e82..148da6912a 100644
--- a/indra/newview/llfloaternamedesc.h
+++ b/indra/newview/llfloaternamedesc.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaternamedesc.h
* @brief LLFloaterNameDesc class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,46 +39,46 @@ class LLRadioGroup;
class LLFloaterNameDesc : public LLFloater
{
public:
- LLFloaterNameDesc(const LLSD& filename);
- virtual ~LLFloaterNameDesc();
- virtual BOOL postBuild();
-
- void onBtnOK();
- void onBtnCancel();
- void doCommit();
+ LLFloaterNameDesc(const LLSD& filename);
+ virtual ~LLFloaterNameDesc();
+ virtual BOOL postBuild();
+
+ void onBtnOK();
+ void onBtnCancel();
+ void doCommit();
+
+ S32 getExpectedUploadCost() const;
- S32 getExpectedUploadCost() const;
-
protected:
- virtual void onCommit();
+ virtual void onCommit();
protected:
- BOOL mIsAudio;
- bool mIsText;
+ BOOL mIsAudio;
+ bool mIsText;
- std::string mFilenameAndPath;
- std::string mFilename;
+ std::string mFilenameAndPath;
+ std::string mFilename;
};
class LLFloaterSoundPreview : public LLFloaterNameDesc
{
public:
- LLFloaterSoundPreview(const LLSD& filename );
- virtual BOOL postBuild();
+ LLFloaterSoundPreview(const LLSD& filename );
+ virtual BOOL postBuild();
};
class LLFloaterAnimPreview : public LLFloaterNameDesc
{
public:
- LLFloaterAnimPreview(const LLSD& filename );
- virtual BOOL postBuild();
+ LLFloaterAnimPreview(const LLSD& filename );
+ virtual BOOL postBuild();
};
class LLFloaterScriptPreview : public LLFloaterNameDesc
{
public:
- LLFloaterScriptPreview(const LLSD& filename );
- virtual BOOL postBuild();
+ LLFloaterScriptPreview(const LLSD& filename );
+ virtual BOOL postBuild();
};
#endif // LL_LLFLOATERNAMEDESC_H
diff --git a/indra/newview/llfloaternewfeaturenotification.cpp b/indra/newview/llfloaternewfeaturenotification.cpp
index 1e50024967..989b9c3b44 100644
--- a/indra/newview/llfloaternewfeaturenotification.cpp
+++ b/indra/newview/llfloaternewfeaturenotification.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaternewfeaturenotification.cpp
* @brief LLFloaterNewFeatureNotification class implementation
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,7 +46,7 @@ BOOL LLFloaterNewFeatureNotification::postBuild()
const std::string title_txt = "title_txt";
const std::string dsc_txt = "description_txt";
std::string feature = "_" + getKey().asString();
-
+
getChild<LLUICtrl>(title_txt)->setValue(getString(title_txt + feature));
getChild<LLUICtrl>(dsc_txt)->setValue(getString(dsc_txt + feature));
diff --git a/indra/newview/llfloaternewfeaturenotification.h b/indra/newview/llfloaternewfeaturenotification.h
index 95501451dc..42f624a04a 100644
--- a/indra/newview/llfloaternewfeaturenotification.h
+++ b/indra/newview/llfloaternewfeaturenotification.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaternewfeaturenotification.h
* @brief LLFloaterNewFeatureNotification class definition
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,11 +39,11 @@ public:
private:
LLFloaterNewFeatureNotification(const LLSD& key);
- /*virtual*/ ~LLFloaterNewFeatureNotification();
+ /*virtual*/ ~LLFloaterNewFeatureNotification();
void centerOnScreen();
- void onCloseBtn();
+ void onCloseBtn();
};
#endif
diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp
index fd03efa061..dbeb5ca573 100644
--- a/indra/newview/llfloaternotificationsconsole.cpp
+++ b/indra/newview/llfloaternotificationsconsole.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationsconsole.cpp
* @brief Debugging console for unified notifications.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,109 +40,109 @@ const S32 HEADER_PADDING = 38;
class LLNotificationChannelPanel : public LLLayoutPanel
{
public:
- LLNotificationChannelPanel(const Params& p);
- ~LLNotificationChannelPanel();
- BOOL postBuild();
+ LLNotificationChannelPanel(const Params& p);
+ ~LLNotificationChannelPanel();
+ BOOL postBuild();
private:
- bool update(const LLSD& payload);
- static void toggleClick(void* user_data);
- static void onClickNotification(void* user_data);
- LLNotificationChannelPtr mChannelPtr;
+ bool update(const LLSD& payload);
+ static void toggleClick(void* user_data);
+ static void onClickNotification(void* user_data);
+ LLNotificationChannelPtr mChannelPtr;
};
-LLNotificationChannelPanel::LLNotificationChannelPanel(const LLNotificationChannelPanel::Params& p)
-: LLLayoutPanel(p)
+LLNotificationChannelPanel::LLNotificationChannelPanel(const LLNotificationChannelPanel::Params& p)
+: LLLayoutPanel(p)
{
- mChannelPtr = LLNotifications::instance().getChannel(p.name);
- buildFromFile( "panel_notifications_channel.xml");
+ mChannelPtr = LLNotifications::instance().getChannel(p.name);
+ buildFromFile( "panel_notifications_channel.xml");
}
LLNotificationChannelPanel::~LLNotificationChannelPanel()
{
- // Userdata for all records is a LLNotification* we need to clean up
- std::vector<LLScrollListItem*> data_list = getChild<LLScrollListCtrl>("notifications_list")->getAllData();
- std::vector<LLScrollListItem*>::iterator data_itor;
- for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor)
- {
- LLScrollListItem* item = *data_itor;
- LLNotification* notification = (LLNotification*)item->getUserdata();
- delete notification;
- notification = NULL;
- }
+ // Userdata for all records is a LLNotification* we need to clean up
+ std::vector<LLScrollListItem*> data_list = getChild<LLScrollListCtrl>("notifications_list")->getAllData();
+ std::vector<LLScrollListItem*>::iterator data_itor;
+ for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor)
+ {
+ LLScrollListItem* item = *data_itor;
+ LLNotification* notification = (LLNotification*)item->getUserdata();
+ delete notification;
+ notification = NULL;
+ }
}
BOOL LLNotificationChannelPanel::postBuild()
{
- LLButton* header_button = getChild<LLButton>("header");
- header_button->setLabel(mChannelPtr->getName());
- header_button->setClickedCallback(toggleClick, this);
+ LLButton* header_button = getChild<LLButton>("header");
+ header_button->setLabel(mChannelPtr->getName());
+ header_button->setClickedCallback(toggleClick, this);
- mChannelPtr->connectChanged(boost::bind(&LLNotificationChannelPanel::update, this, _1));
+ mChannelPtr->connectChanged(boost::bind(&LLNotificationChannelPanel::update, this, _1));
- LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("notifications_list");
- scroll->setDoubleClickCallback(onClickNotification, this);
- scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0));
- return TRUE;
+ LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("notifications_list");
+ scroll->setDoubleClickCallback(onClickNotification, this);
+ scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0));
+ return TRUE;
}
//static
void LLNotificationChannelPanel::toggleClick(void *user_data)
{
- LLNotificationChannelPanel* self = (LLNotificationChannelPanel*)user_data;
- if (!self) return;
-
- LLButton* header_button = self->getChild<LLButton>("header");
-
- LLLayoutStack* stack = dynamic_cast<LLLayoutStack*>(self->getParent());
- if (stack)
- {
- stack->collapsePanel(self, header_button->getToggleState());
- }
-
- // turn off tab stop for collapsed panel
- self->getChild<LLScrollListCtrl>("notifications_list")->setTabStop(!header_button->getToggleState());
- self->getChild<LLScrollListCtrl>("notifications_list")->setVisible(!header_button->getToggleState());
+ LLNotificationChannelPanel* self = (LLNotificationChannelPanel*)user_data;
+ if (!self) return;
+
+ LLButton* header_button = self->getChild<LLButton>("header");
+
+ LLLayoutStack* stack = dynamic_cast<LLLayoutStack*>(self->getParent());
+ if (stack)
+ {
+ stack->collapsePanel(self, header_button->getToggleState());
+ }
+
+ // turn off tab stop for collapsed panel
+ self->getChild<LLScrollListCtrl>("notifications_list")->setTabStop(!header_button->getToggleState());
+ self->getChild<LLScrollListCtrl>("notifications_list")->setVisible(!header_button->getToggleState());
}
/*static*/
void LLNotificationChannelPanel::onClickNotification(void* user_data)
{
- LLNotificationChannelPanel* self = (LLNotificationChannelPanel*)user_data;
- if (!self) return;
- LLScrollListItem* firstselected = self->getChild<LLScrollListCtrl>("notifications_list")->getFirstSelected();
- llassert(firstselected);
- if (firstselected)
- {
- void* data = firstselected->getUserdata();
- if (data)
- {
- gFloaterView->getParentFloater(self)->addDependentFloater(new LLFloaterNotification((LLNotification*)data), TRUE);
- }
- }
+ LLNotificationChannelPanel* self = (LLNotificationChannelPanel*)user_data;
+ if (!self) return;
+ LLScrollListItem* firstselected = self->getChild<LLScrollListCtrl>("notifications_list")->getFirstSelected();
+ llassert(firstselected);
+ if (firstselected)
+ {
+ void* data = firstselected->getUserdata();
+ if (data)
+ {
+ gFloaterView->getParentFloater(self)->addDependentFloater(new LLFloaterNotification((LLNotification*)data), TRUE);
+ }
+ }
}
bool LLNotificationChannelPanel::update(const LLSD& payload)
{
- LLNotificationPtr notification = LLNotifications::instance().find(payload["id"].asUUID());
- if (notification)
- {
- LLSD row;
- row["columns"][0]["value"] = notification->getName();
- row["columns"][0]["column"] = "name";
+ LLNotificationPtr notification = LLNotifications::instance().find(payload["id"].asUUID());
+ if (notification)
+ {
+ LLSD row;
+ row["columns"][0]["value"] = notification->getName();
+ row["columns"][0]["column"] = "name";
- row["columns"][1]["value"] = notification->getMessage();
- row["columns"][1]["column"] = "content";
+ row["columns"][1]["value"] = notification->getMessage();
+ row["columns"][1]["column"] = "content";
- row["columns"][2]["value"] = notification->getDate();
- row["columns"][2]["column"] = "date";
- row["columns"][2]["type"] = "date";
+ row["columns"][2]["value"] = notification->getDate();
+ row["columns"][2]["column"] = "date";
+ row["columns"][2]["type"] = "date";
- LLScrollListItem* sli = getChild<LLScrollListCtrl>("notifications_list")->addElement(row);
- sli->setUserdata(new LLNotification(notification->asLLSD()));
- }
+ LLScrollListItem* sli = getChild<LLScrollListCtrl>("notifications_list")->addElement(row);
+ sli->setUserdata(new LLNotification(notification->asLLSD()));
+ }
- return false;
+ return false;
}
//
@@ -151,130 +151,130 @@ bool LLNotificationChannelPanel::update(const LLSD& payload)
LLFloaterNotificationConsole::LLFloaterNotificationConsole(const LLSD& key)
: LLFloater(key)
{
- mCommitCallbackRegistrar.add("ClickAdd", boost::bind(&LLFloaterNotificationConsole::onClickAdd, this));
+ mCommitCallbackRegistrar.add("ClickAdd", boost::bind(&LLFloaterNotificationConsole::onClickAdd, this));
}
BOOL LLFloaterNotificationConsole::postBuild()
{
- // these are in the order of processing
- addChannel("Unexpired");
- addChannel("Ignore");
- addChannel("VisibilityRules");
- addChannel("Visible", true);
- // all the ones below attach to the Visible channel
- addChannel("Persistent");
- addChannel("Alerts");
- addChannel("AlertModal");
- addChannel("Group Notifications");
- addChannel("Notifications");
- addChannel("NotificationTips");
-
-// getChild<LLButton>("add_notification")->setClickedCallback(onClickAdd, this);
-
- LLComboBox* notifications = getChild<LLComboBox>("notification_types");
- LLNotifications::TemplateNames names = LLNotifications::instance().getTemplateNames();
- for (LLNotifications::TemplateNames::iterator template_it = names.begin();
- template_it != names.end();
- ++template_it)
- {
- notifications->add(*template_it);
- }
- notifications->sortByName();
-
- return TRUE;
+ // these are in the order of processing
+ addChannel("Unexpired");
+ addChannel("Ignore");
+ addChannel("VisibilityRules");
+ addChannel("Visible", true);
+ // all the ones below attach to the Visible channel
+ addChannel("Persistent");
+ addChannel("Alerts");
+ addChannel("AlertModal");
+ addChannel("Group Notifications");
+ addChannel("Notifications");
+ addChannel("NotificationTips");
+
+// getChild<LLButton>("add_notification")->setClickedCallback(onClickAdd, this);
+
+ LLComboBox* notifications = getChild<LLComboBox>("notification_types");
+ LLNotifications::TemplateNames names = LLNotifications::instance().getTemplateNames();
+ for (LLNotifications::TemplateNames::iterator template_it = names.begin();
+ template_it != names.end();
+ ++template_it)
+ {
+ notifications->add(*template_it);
+ }
+ notifications->sortByName();
+
+ return TRUE;
}
void LLFloaterNotificationConsole::addChannel(const std::string& name, bool open)
{
- LLLayoutStack& stack = getChildRef<LLLayoutStack>("notification_channels");
- LLNotificationChannelPanel::Params p;
- p.min_dim = NOTIFICATION_PANEL_HEADER_HEIGHT;
- p.auto_resize = true;
- p.user_resize = true;
- p.name = name;
- LLNotificationChannelPanel* panelp = new LLNotificationChannelPanel(p);
- stack.addPanel(panelp, LLLayoutStack::ANIMATE);
-
- LLButton& header_button = panelp->getChildRef<LLButton>("header");
- header_button.setToggleState(!open);
- stack.collapsePanel(panelp, !open);
-
- updateResizeLimits();
+ LLLayoutStack& stack = getChildRef<LLLayoutStack>("notification_channels");
+ LLNotificationChannelPanel::Params p;
+ p.min_dim = NOTIFICATION_PANEL_HEADER_HEIGHT;
+ p.auto_resize = true;
+ p.user_resize = true;
+ p.name = name;
+ LLNotificationChannelPanel* panelp = new LLNotificationChannelPanel(p);
+ stack.addPanel(panelp, LLLayoutStack::ANIMATE);
+
+ LLButton& header_button = panelp->getChildRef<LLButton>("header");
+ header_button.setToggleState(!open);
+ stack.collapsePanel(panelp, !open);
+
+ updateResizeLimits();
}
void LLFloaterNotificationConsole::removeChannel(const std::string& name)
{
- LLPanel* panelp = getChild<LLPanel>(name);
- getChildRef<LLView>("notification_channels").removeChild(panelp);
- delete panelp;
+ LLPanel* panelp = getChild<LLPanel>(name);
+ getChildRef<LLView>("notification_channels").removeChild(panelp);
+ delete panelp;
- updateResizeLimits();
+ updateResizeLimits();
}
-//static
+//static
void LLFloaterNotificationConsole::updateResizeLimits()
{
- const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
- S32 floater_header_size = floater_params.header_height;
+ const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
+ S32 floater_header_size = floater_params.header_height;
- LLLayoutStack& stack = getChildRef<LLLayoutStack>("notification_channels");
- setResizeLimits(getMinWidth(), floater_header_size + HEADER_PADDING + ((NOTIFICATION_PANEL_HEADER_HEIGHT + 3) * stack.getNumPanels()));
+ LLLayoutStack& stack = getChildRef<LLLayoutStack>("notification_channels");
+ setResizeLimits(getMinWidth(), floater_header_size + HEADER_PADDING + ((NOTIFICATION_PANEL_HEADER_HEIGHT + 3) * stack.getNumPanels()));
}
void LLFloaterNotificationConsole::onClickAdd()
{
- std::string message_name = getChild<LLComboBox>("notification_types")->getValue().asString();
- if (!message_name.empty())
- {
- LLNotifications::instance().add(message_name, LLSD(), LLSD());
- }
+ std::string message_name = getChild<LLComboBox>("notification_types")->getValue().asString();
+ if (!message_name.empty())
+ {
+ LLNotifications::instance().add(message_name, LLSD(), LLSD());
+ }
}
//=============== LLFloaterNotification ================
-LLFloaterNotification::LLFloaterNotification(LLNotification* note)
-: LLFloater(LLSD()),
- mNote(note)
+LLFloaterNotification::LLFloaterNotification(LLNotification* note)
+: LLFloater(LLSD()),
+ mNote(note)
{
- buildFromFile("floater_notification.xml");
+ buildFromFile("floater_notification.xml");
}
BOOL LLFloaterNotification::postBuild()
{
- setTitle(mNote->getName());
- getChild<LLUICtrl>("payload")->setValue(mNote->getMessage());
+ setTitle(mNote->getName());
+ getChild<LLUICtrl>("payload")->setValue(mNote->getMessage());
- LLComboBox* responses_combo = getChild<LLComboBox>("response");
- LLCtrlListInterface* response_list = responses_combo->getListInterface();
- LLNotificationFormPtr form(mNote->getForm());
- if(!form)
- {
- return TRUE;
- }
+ LLComboBox* responses_combo = getChild<LLComboBox>("response");
+ LLCtrlListInterface* response_list = responses_combo->getListInterface();
+ LLNotificationFormPtr form(mNote->getForm());
+ if(!form)
+ {
+ return TRUE;
+ }
- responses_combo->setCommitCallback(onCommitResponse, this);
+ responses_combo->setCommitCallback(onCommitResponse, this);
- LLSD form_sd = form->asLLSD();
+ LLSD form_sd = form->asLLSD();
- for (LLSD::array_const_iterator form_item = form_sd.beginArray(); form_item != form_sd.endArray(); ++form_item)
- {
- if ( (*form_item)["type"].asString() != "button") continue;
- std::string text = (*form_item)["text"].asString();
- response_list->addSimpleElement(text);
- }
+ for (LLSD::array_const_iterator form_item = form_sd.beginArray(); form_item != form_sd.endArray(); ++form_item)
+ {
+ if ( (*form_item)["type"].asString() != "button") continue;
+ std::string text = (*form_item)["text"].asString();
+ response_list->addSimpleElement(text);
+ }
- return TRUE;
+ return TRUE;
}
void LLFloaterNotification::respond()
{
- LLComboBox* responses_combo = getChild<LLComboBox>("response");
- LLCtrlListInterface* response_list = responses_combo->getListInterface();
- const std::string& trigger = response_list->getSelectedValue().asString();
- //LL_INFOS() << trigger << LL_ENDL;
-
- LLSD response = mNote->getResponseTemplate();
- response[trigger] = true;
- mNote->respond(response);
+ LLComboBox* responses_combo = getChild<LLComboBox>("response");
+ LLCtrlListInterface* response_list = responses_combo->getListInterface();
+ const std::string& trigger = response_list->getSelectedValue().asString();
+ //LL_INFOS() << trigger << LL_ENDL;
+
+ LLSD response = mNote->getResponseTemplate();
+ response[trigger] = true;
+ mNote->respond(response);
}
diff --git a/indra/newview/llfloaternotificationsconsole.h b/indra/newview/llfloaternotificationsconsole.h
index 4e92b7d857..75161f8096 100644
--- a/indra/newview/llfloaternotificationsconsole.h
+++ b/indra/newview/llfloaternotificationsconsole.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaternotificationsconsole.h
* @brief Debugging console for unified notifications.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,25 +33,25 @@
class LLNotification;
-class LLFloaterNotificationConsole :
- public LLFloater
+class LLFloaterNotificationConsole :
+ public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- // LLPanel
- BOOL postBuild();
+ // LLPanel
+ BOOL postBuild();
- void addChannel(const std::string& type, bool open = false);
- void updateResizeLimits(LLLayoutStack &stack);
+ void addChannel(const std::string& type, bool open = false);
+ void updateResizeLimits(LLLayoutStack &stack);
- void removeChannel(const std::string& type);
- void updateResizeLimits();
+ void removeChannel(const std::string& type);
+ void updateResizeLimits();
private:
- LLFloaterNotificationConsole(const LLSD& key);
- void onClickAdd();
+ LLFloaterNotificationConsole(const LLSD& key);
+ void onClickAdd();
};
@@ -61,15 +61,15 @@ private:
class LLFloaterNotification : public LLFloater
{
public:
- LLFloaterNotification(LLNotification* note);
+ LLFloaterNotification(LLNotification* note);
- // LLPanel
- BOOL postBuild();
- void respond();
+ // LLPanel
+ BOOL postBuild();
+ void respond();
private:
- static void onCommitResponse(LLUICtrl* ctrl, void* data) { ((LLFloaterNotification*)data)->respond(); }
- LLNotification* mNote;
+ static void onCommitResponse(LLUICtrl* ctrl, void* data) { ((LLFloaterNotification*)data)->respond(); }
+ LLNotification* mNote;
};
#endif
diff --git a/indra/newview/llfloaternotificationstabbed.cpp b/indra/newview/llfloaternotificationstabbed.cpp
index d1679fd936..94d650ddbe 100644
--- a/indra/newview/llfloaternotificationstabbed.cpp
+++ b/indra/newview/llfloaternotificationstabbed.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloaternotificationstabbed.cpp
- * @brief
+ * @brief
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -79,7 +79,7 @@ BOOL LLFloaterNotificationsTabbed::postBuild()
// get a corresponding channel
initChannel();
BOOL rv = LLTransientDockableFloater::postBuild();
-
+
setTitle(getString("title_notification_tabbed_window"));
return rv;
}
@@ -105,8 +105,8 @@ void LLFloaterNotificationsTabbed::onStartUpToastClick(S32 x, S32 y, MASK mask)
}
//---------------------------------------------------------------------------------
-void LLFloaterNotificationsTabbed::setSysWellChiclet(LLSysWellChiclet* chiclet)
-{
+void LLFloaterNotificationsTabbed::setSysWellChiclet(LLSysWellChiclet* chiclet)
+{
mSysWellChiclet = chiclet;
if(NULL != mSysWellChiclet)
{
@@ -151,7 +151,7 @@ LLPanel * LLFloaterNotificationsTabbed::findItemByID(const LLUUID& id, std::stri
}
//---------------------------------------------------------------------------------
-void LLFloaterNotificationsTabbed::initChannel()
+void LLFloaterNotificationsTabbed::initChannel()
{
LLNotificationsUI::LLScreenChannelBase* channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(
LLUUID(gSavedSettings.getString("NotificationChannelUUID")));
@@ -190,7 +190,7 @@ void LLFloaterNotificationsTabbed::setVisible(BOOL visible)
LLTransientDockableFloater::setVisible(visible);
- // update notification channel state
+ // update notification channel state
initChannel(); // make sure the channel still exists
if(mChannel)
{
@@ -379,7 +379,7 @@ void LLFloaterNotificationsTabbed::clearScreenChannels()
//---------------------------------------------------------------------------------
void LLFloaterNotificationsTabbed::onStoreToast(LLPanel* info_panel, LLUUID id)
{
- LLNotificationListItem::Params p;
+ LLNotificationListItem::Params p;
p.notification_id = id;
p.title = static_cast<LLToastPanel*>(info_panel)->getTitle();
LLNotificationPtr notify = mChannel->getToastByNotificationID(id)->getNotification();
@@ -533,7 +533,7 @@ LLPanel* LLNotificationSeparator::findItemByID(std::string& tag, const LLUUID& i
return mUnTaggedList->getItemByValue(id);
}
- return NULL;
+ return NULL;
}
//static
diff --git a/indra/newview/llfloaternotificationstabbed.h b/indra/newview/llfloaternotificationstabbed.h
index 8dd20b18c4..4cdcce82c1 100644
--- a/indra/newview/llfloaternotificationstabbed.h
+++ b/indra/newview/llfloaternotificationstabbed.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaternotificationstabbed.h
- * @brief
+ * @brief
*
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -115,7 +115,7 @@ private:
void reshapeWindow();
// pointer to a corresponding channel's instance
- LLNotificationsUI::LLScreenChannel* mChannel;
+ LLNotificationsUI::LLScreenChannel* mChannel;
/**
* Reference to an appropriate Well chiclet to release "new message" state. EXT-3147
@@ -130,7 +130,7 @@ private:
void onDelete(LLNotificationPtr notify)
{
mNotificationsTabbedWindow->removeItemByID(notify->getID(), notify->getName());
- }
+ }
LLFloaterNotificationsTabbed* mNotificationsTabbedWindow;
};
@@ -158,14 +158,14 @@ private:
// ID of a toast loaded by user (by clicking notification well item)
LLUUID mLoadedToastId;
- LLNotificationListView* mGroupInviteMessageList;
- LLNotificationListView* mGroupNoticeMessageList;
- LLNotificationListView* mTransactionMessageList;
- LLNotificationListView* mSystemMessageList;
+ LLNotificationListView* mGroupInviteMessageList;
+ LLNotificationListView* mGroupNoticeMessageList;
+ LLNotificationListView* mTransactionMessageList;
+ LLNotificationListView* mSystemMessageList;
LLNotificationSeparator* mNotificationsSeparator;
LLTabContainer* mNotificationsTabContainer;
- LLButton* mDeleteAllBtn;
- LLButton* mCollapseAllBtn;
+ LLButton* mDeleteAllBtn;
+ LLButton* mCollapseAllBtn;
};
#endif // LL_FLOATERNOTIFICATIONSTABBED_H
diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp
index ed1ad4426f..090b0657d1 100644
--- a/indra/newview/llfloaterobjectweights.cpp
+++ b/indra/newview/llfloaterobjectweights.cpp
@@ -39,43 +39,43 @@
// virtual
bool LLCrossParcelFunctor::apply(LLViewerObject* obj)
{
- // Add the root object box.
- mBoundingBox.addBBoxAgent(LLBBox(obj->getPositionRegion(), obj->getRotationRegion(), obj->getScale() * -0.5f, obj->getScale() * 0.5f).getAxisAligned());
-
- // Extend the bounding box across all the children.
- LLViewerObject::const_child_list_t children = obj->getChildren();
- for (LLViewerObject::const_child_list_t::const_iterator iter = children.begin();
- iter != children.end(); iter++)
- {
- LLViewerObject* child = *iter;
- mBoundingBox.addBBoxAgent(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned());
- }
-
- bool result = false;
-
- LLViewerRegion* region = obj->getRegion();
- if (region)
- {
- std::vector<LLBBox> boxes;
- boxes.push_back(mBoundingBox);
- result = region->objectsCrossParcel(boxes);
- }
-
- return result;
+ // Add the root object box.
+ mBoundingBox.addBBoxAgent(LLBBox(obj->getPositionRegion(), obj->getRotationRegion(), obj->getScale() * -0.5f, obj->getScale() * 0.5f).getAxisAligned());
+
+ // Extend the bounding box across all the children.
+ LLViewerObject::const_child_list_t children = obj->getChildren();
+ for (LLViewerObject::const_child_list_t::const_iterator iter = children.begin();
+ iter != children.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ mBoundingBox.addBBoxAgent(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned());
+ }
+
+ bool result = false;
+
+ LLViewerRegion* region = obj->getRegion();
+ if (region)
+ {
+ std::vector<LLBBox> boxes;
+ boxes.push_back(mBoundingBox);
+ result = region->objectsCrossParcel(boxes);
+ }
+
+ return result;
}
LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key)
-: LLFloater(key),
- mSelectedObjects(NULL),
- mSelectedPrims(NULL),
- mSelectedDownloadWeight(NULL),
- mSelectedPhysicsWeight(NULL),
- mSelectedServerWeight(NULL),
- mSelectedDisplayWeight(NULL),
- mSelectedOnLand(NULL),
- mRezzedOnLand(NULL),
- mRemainingCapacity(NULL),
- mTotalCapacity(NULL)
+: LLFloater(key),
+ mSelectedObjects(NULL),
+ mSelectedPrims(NULL),
+ mSelectedDownloadWeight(NULL),
+ mSelectedPhysicsWeight(NULL),
+ mSelectedServerWeight(NULL),
+ mSelectedDisplayWeight(NULL),
+ mSelectedOnLand(NULL),
+ mRezzedOnLand(NULL),
+ mRemainingCapacity(NULL),
+ mTotalCapacity(NULL)
{
}
@@ -86,189 +86,189 @@ LLFloaterObjectWeights::~LLFloaterObjectWeights()
// virtual
BOOL LLFloaterObjectWeights::postBuild()
{
- mSelectedObjects = getChild<LLTextBox>("objects");
- mSelectedPrims = getChild<LLTextBox>("prims");
+ mSelectedObjects = getChild<LLTextBox>("objects");
+ mSelectedPrims = getChild<LLTextBox>("prims");
- mSelectedDownloadWeight = getChild<LLTextBox>("download");
- mSelectedPhysicsWeight = getChild<LLTextBox>("physics");
- mSelectedServerWeight = getChild<LLTextBox>("server");
- mSelectedDisplayWeight = getChild<LLTextBox>("display");
+ mSelectedDownloadWeight = getChild<LLTextBox>("download");
+ mSelectedPhysicsWeight = getChild<LLTextBox>("physics");
+ mSelectedServerWeight = getChild<LLTextBox>("server");
+ mSelectedDisplayWeight = getChild<LLTextBox>("display");
- mSelectedOnLand = getChild<LLTextBox>("selected");
- mRezzedOnLand = getChild<LLTextBox>("rezzed_on_land");
- mRemainingCapacity = getChild<LLTextBox>("remaining_capacity");
- mTotalCapacity = getChild<LLTextBox>("total_capacity");
+ mSelectedOnLand = getChild<LLTextBox>("selected");
+ mRezzedOnLand = getChild<LLTextBox>("rezzed_on_land");
+ mRemainingCapacity = getChild<LLTextBox>("remaining_capacity");
+ mTotalCapacity = getChild<LLTextBox>("total_capacity");
- return TRUE;
+ return TRUE;
}
// virtual
void LLFloaterObjectWeights::onOpen(const LLSD& key)
{
- refresh();
- updateLandImpacts(LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel());
+ refresh();
+ updateLandImpacts(LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel());
}
// virtual
void LLFloaterObjectWeights::onWeightsUpdate(const SelectionCost& selection_cost)
{
- mSelectedDownloadWeight->setText(llformat("%.1f", selection_cost.mNetworkCost));
- mSelectedPhysicsWeight->setText(llformat("%.1f", selection_cost.mPhysicsCost));
- mSelectedServerWeight->setText(llformat("%.1f", selection_cost.mSimulationCost));
+ mSelectedDownloadWeight->setText(llformat("%.1f", selection_cost.mNetworkCost));
+ mSelectedPhysicsWeight->setText(llformat("%.1f", selection_cost.mPhysicsCost));
+ mSelectedServerWeight->setText(llformat("%.1f", selection_cost.mSimulationCost));
- S32 render_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost();
- mSelectedDisplayWeight->setText(llformat("%d", render_cost));
+ S32 render_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost();
+ mSelectedDisplayWeight->setText(llformat("%d", render_cost));
- toggleWeightsLoadingIndicators(false);
+ toggleWeightsLoadingIndicators(false);
}
//virtual
void LLFloaterObjectWeights::setErrorStatus(S32 status, const std::string& reason)
{
- const std::string text = getString("nothing_selected");
+ const std::string text = getString("nothing_selected");
- mSelectedDownloadWeight->setText(text);
- mSelectedPhysicsWeight->setText(text);
- mSelectedServerWeight->setText(text);
- mSelectedDisplayWeight->setText(text);
+ mSelectedDownloadWeight->setText(text);
+ mSelectedPhysicsWeight->setText(text);
+ mSelectedServerWeight->setText(text);
+ mSelectedDisplayWeight->setText(text);
- toggleWeightsLoadingIndicators(false);
+ toggleWeightsLoadingIndicators(false);
}
void LLFloaterObjectWeights::updateLandImpacts(const LLParcel* parcel)
{
- if (!parcel || LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- updateIfNothingSelected();
- }
- else
- {
- S32 rezzed_prims = parcel->getSimWidePrimCount();
- S32 total_capacity = parcel->getSimWideMaxPrimCapacity();
- // Can't have more than region max tasks, regardless of parcel
- // object bonus factor.
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (region)
- {
- S32 max_tasks_per_region = (S32)region->getMaxTasks();
- total_capacity = llmin(total_capacity, max_tasks_per_region);
- }
-
- mRezzedOnLand->setText(llformat("%d", rezzed_prims));
- mRemainingCapacity->setText(llformat("%d", total_capacity - rezzed_prims));
- mTotalCapacity->setText(llformat("%d", total_capacity));
-
- toggleLandImpactsLoadingIndicators(false);
- }
+ if (!parcel || LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ updateIfNothingSelected();
+ }
+ else
+ {
+ S32 rezzed_prims = parcel->getSimWidePrimCount();
+ S32 total_capacity = parcel->getSimWideMaxPrimCapacity();
+ // Can't have more than region max tasks, regardless of parcel
+ // object bonus factor.
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (region)
+ {
+ S32 max_tasks_per_region = (S32)region->getMaxTasks();
+ total_capacity = llmin(total_capacity, max_tasks_per_region);
+ }
+
+ mRezzedOnLand->setText(llformat("%d", rezzed_prims));
+ mRemainingCapacity->setText(llformat("%d", total_capacity - rezzed_prims));
+ mTotalCapacity->setText(llformat("%d", total_capacity));
+
+ toggleLandImpactsLoadingIndicators(false);
+ }
}
void LLFloaterObjectWeights::refresh()
{
- LLSelectMgr* sel_mgr = LLSelectMgr::getInstance();
-
- if (sel_mgr->getSelection()->isEmpty())
- {
- updateIfNothingSelected();
- }
- else
- {
- S32 prim_count = sel_mgr->getSelection()->getObjectCount();
- S32 link_count = sel_mgr->getSelection()->getRootObjectCount();
- F32 prim_equiv = sel_mgr->getSelection()->getSelectedLinksetCost();
-
- mSelectedObjects->setText(llformat("%d", link_count));
- mSelectedPrims->setText(llformat("%d", prim_count));
- mSelectedOnLand->setText(llformat("%.1d", (S32)prim_equiv));
-
- LLCrossParcelFunctor func;
- if (sel_mgr->getSelection()->applyToRootObjects(&func, true))
- {
- // Some of the selected objects cross parcel bounds.
- // We don't display object weights and land impacts in this case.
- const std::string text = getString("nothing_selected");
-
- mRezzedOnLand->setText(text);
- mRemainingCapacity->setText(text);
- mTotalCapacity->setText(text);
-
- toggleLandImpactsLoadingIndicators(false);
- }
-
- LLViewerRegion* region = gAgent.getRegion();
- if (region && region->capabilitiesReceived())
- {
- for (LLObjectSelection::valid_root_iterator iter = sel_mgr->getSelection()->valid_root_begin();
- iter != sel_mgr->getSelection()->valid_root_end(); ++iter)
- {
- LLAccountingCostManager::getInstance()->addObject((*iter)->getObject()->getID());
- }
-
- std::string url = region->getCapability("ResourceCostSelected");
- if (!url.empty())
- {
- // Update the transaction id before the new fetch request
- generateTransactionID();
-
- LLAccountingCostManager::getInstance()->fetchCosts(Roots, url, getObserverHandle());
- toggleWeightsLoadingIndicators(true);
- }
- }
- else
- {
- LL_WARNS() << "Failed to get region capabilities" << LL_ENDL;
- }
- }
+ LLSelectMgr* sel_mgr = LLSelectMgr::getInstance();
+
+ if (sel_mgr->getSelection()->isEmpty())
+ {
+ updateIfNothingSelected();
+ }
+ else
+ {
+ S32 prim_count = sel_mgr->getSelection()->getObjectCount();
+ S32 link_count = sel_mgr->getSelection()->getRootObjectCount();
+ F32 prim_equiv = sel_mgr->getSelection()->getSelectedLinksetCost();
+
+ mSelectedObjects->setText(llformat("%d", link_count));
+ mSelectedPrims->setText(llformat("%d", prim_count));
+ mSelectedOnLand->setText(llformat("%.1d", (S32)prim_equiv));
+
+ LLCrossParcelFunctor func;
+ if (sel_mgr->getSelection()->applyToRootObjects(&func, true))
+ {
+ // Some of the selected objects cross parcel bounds.
+ // We don't display object weights and land impacts in this case.
+ const std::string text = getString("nothing_selected");
+
+ mRezzedOnLand->setText(text);
+ mRemainingCapacity->setText(text);
+ mTotalCapacity->setText(text);
+
+ toggleLandImpactsLoadingIndicators(false);
+ }
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region && region->capabilitiesReceived())
+ {
+ for (LLObjectSelection::valid_root_iterator iter = sel_mgr->getSelection()->valid_root_begin();
+ iter != sel_mgr->getSelection()->valid_root_end(); ++iter)
+ {
+ LLAccountingCostManager::getInstance()->addObject((*iter)->getObject()->getID());
+ }
+
+ std::string url = region->getCapability("ResourceCostSelected");
+ if (!url.empty())
+ {
+ // Update the transaction id before the new fetch request
+ generateTransactionID();
+
+ LLAccountingCostManager::getInstance()->fetchCosts(Roots, url, getObserverHandle());
+ toggleWeightsLoadingIndicators(true);
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Failed to get region capabilities" << LL_ENDL;
+ }
+ }
}
// virtual
void LLFloaterObjectWeights::generateTransactionID()
{
- mTransactionID.generate();
+ mTransactionID.generate();
}
void LLFloaterObjectWeights::toggleWeightsLoadingIndicators(bool visible)
{
- childSetVisible("download_loading_indicator", visible);
- childSetVisible("physics_loading_indicator", visible);
- childSetVisible("server_loading_indicator", visible);
- childSetVisible("display_loading_indicator", visible);
-
- mSelectedDownloadWeight->setVisible(!visible);
- mSelectedPhysicsWeight->setVisible(!visible);
- mSelectedServerWeight->setVisible(!visible);
- mSelectedDisplayWeight->setVisible(!visible);
+ childSetVisible("download_loading_indicator", visible);
+ childSetVisible("physics_loading_indicator", visible);
+ childSetVisible("server_loading_indicator", visible);
+ childSetVisible("display_loading_indicator", visible);
+
+ mSelectedDownloadWeight->setVisible(!visible);
+ mSelectedPhysicsWeight->setVisible(!visible);
+ mSelectedServerWeight->setVisible(!visible);
+ mSelectedDisplayWeight->setVisible(!visible);
}
void LLFloaterObjectWeights::toggleLandImpactsLoadingIndicators(bool visible)
{
- childSetVisible("selected_loading_indicator", visible);
- childSetVisible("rezzed_on_land_loading_indicator", visible);
- childSetVisible("remaining_capacity_loading_indicator", visible);
- childSetVisible("total_capacity_loading_indicator", visible);
-
- mSelectedOnLand->setVisible(!visible);
- mRezzedOnLand->setVisible(!visible);
- mRemainingCapacity->setVisible(!visible);
- mTotalCapacity->setVisible(!visible);
+ childSetVisible("selected_loading_indicator", visible);
+ childSetVisible("rezzed_on_land_loading_indicator", visible);
+ childSetVisible("remaining_capacity_loading_indicator", visible);
+ childSetVisible("total_capacity_loading_indicator", visible);
+
+ mSelectedOnLand->setVisible(!visible);
+ mRezzedOnLand->setVisible(!visible);
+ mRemainingCapacity->setVisible(!visible);
+ mTotalCapacity->setVisible(!visible);
}
void LLFloaterObjectWeights::updateIfNothingSelected()
{
- const std::string text = getString("nothing_selected");
+ const std::string text = getString("nothing_selected");
- mSelectedObjects->setText(text);
- mSelectedPrims->setText(text);
+ mSelectedObjects->setText(text);
+ mSelectedPrims->setText(text);
- mSelectedDownloadWeight->setText(text);
- mSelectedPhysicsWeight->setText(text);
- mSelectedServerWeight->setText(text);
- mSelectedDisplayWeight->setText(text);
+ mSelectedDownloadWeight->setText(text);
+ mSelectedPhysicsWeight->setText(text);
+ mSelectedServerWeight->setText(text);
+ mSelectedDisplayWeight->setText(text);
- mSelectedOnLand->setText(text);
- mRezzedOnLand->setText(text);
- mRemainingCapacity->setText(text);
- mTotalCapacity->setText(text);
+ mSelectedOnLand->setText(text);
+ mRezzedOnLand->setText(text);
+ mRemainingCapacity->setText(text);
+ mTotalCapacity->setText(text);
- toggleWeightsLoadingIndicators(false);
- toggleLandImpactsLoadingIndicators(false);
+ toggleWeightsLoadingIndicators(false);
+ toggleLandImpactsLoadingIndicators(false);
}
diff --git a/indra/newview/llfloaterobjectweights.h b/indra/newview/llfloaterobjectweights.h
index 1a2c317bad..10e790f5aa 100644
--- a/indra/newview/llfloaterobjectweights.h
+++ b/indra/newview/llfloaterobjectweights.h
@@ -43,51 +43,51 @@ class LLTextBox;
*/
struct LLCrossParcelFunctor : public LLSelectedObjectFunctor
{
- /*virtual*/ bool apply(LLViewerObject* obj);
+ /*virtual*/ bool apply(LLViewerObject* obj);
private:
- LLBBox mBoundingBox;
+ LLBBox mBoundingBox;
};
class LLFloaterObjectWeights : public LLFloater, LLAccountingCostObserver
{
public:
- LOG_CLASS(LLFloaterObjectWeights);
+ LOG_CLASS(LLFloaterObjectWeights);
- LLFloaterObjectWeights(const LLSD& key);
- ~LLFloaterObjectWeights();
+ LLFloaterObjectWeights(const LLSD& key);
+ ~LLFloaterObjectWeights();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onWeightsUpdate(const SelectionCost& selection_cost);
- /*virtual*/ void setErrorStatus(S32 status, const std::string& reason);
+ /*virtual*/ void onWeightsUpdate(const SelectionCost& selection_cost);
+ /*virtual*/ void setErrorStatus(S32 status, const std::string& reason);
- void updateLandImpacts(const LLParcel* parcel);
- void refresh();
+ void updateLandImpacts(const LLParcel* parcel);
+ void refresh();
private:
- /*virtual*/ void generateTransactionID();
+ /*virtual*/ void generateTransactionID();
- void toggleWeightsLoadingIndicators(bool visible);
- void toggleLandImpactsLoadingIndicators(bool visible);
+ void toggleWeightsLoadingIndicators(bool visible);
+ void toggleLandImpactsLoadingIndicators(bool visible);
- void updateIfNothingSelected();
+ void updateIfNothingSelected();
- LLTextBox *mSelectedObjects;
- LLTextBox *mSelectedPrims;
+ LLTextBox *mSelectedObjects;
+ LLTextBox *mSelectedPrims;
- LLTextBox *mSelectedDownloadWeight;
- LLTextBox *mSelectedPhysicsWeight;
- LLTextBox *mSelectedServerWeight;
- LLTextBox *mSelectedDisplayWeight;
+ LLTextBox *mSelectedDownloadWeight;
+ LLTextBox *mSelectedPhysicsWeight;
+ LLTextBox *mSelectedServerWeight;
+ LLTextBox *mSelectedDisplayWeight;
- LLTextBox *mSelectedOnLand;
- LLTextBox *mRezzedOnLand;
- LLTextBox *mRemainingCapacity;
- LLTextBox *mTotalCapacity;
+ LLTextBox *mSelectedOnLand;
+ LLTextBox *mRezzedOnLand;
+ LLTextBox *mRemainingCapacity;
+ LLTextBox *mTotalCapacity;
};
#endif //LL_LLFLOATEROBJECTWEIGHTS_H
diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp
index d3ab22f792..408eac6289 100644
--- a/indra/newview/llfloateropenobject.cpp
+++ b/indra/newview/llfloateropenobject.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloateropenobject.cpp
* @brief LLFloaterOpenObject class implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,121 +51,121 @@
LLFloaterOpenObject::LLFloaterOpenObject(const LLSD& key)
-: LLFloater(key),
- mPanelInventoryObject(NULL),
- mDirty(TRUE)
+: LLFloater(key),
+ mPanelInventoryObject(NULL),
+ mDirty(TRUE)
{
- mCommitCallbackRegistrar.add("OpenObject.MoveToInventory", boost::bind(&LLFloaterOpenObject::onClickMoveToInventory, this));
- mCommitCallbackRegistrar.add("OpenObject.Cancel", boost::bind(&LLFloaterOpenObject::onClickCancel, this));
+ mCommitCallbackRegistrar.add("OpenObject.MoveToInventory", boost::bind(&LLFloaterOpenObject::onClickMoveToInventory, this));
+ mCommitCallbackRegistrar.add("OpenObject.Cancel", boost::bind(&LLFloaterOpenObject::onClickCancel, this));
}
LLFloaterOpenObject::~LLFloaterOpenObject()
{
-// sInstance = NULL;
+// sInstance = NULL;
}
// virtual
BOOL LLFloaterOpenObject::postBuild()
{
- getChild<LLUICtrl>("object_name")->setTextArg("[DESC]", std::string("Object") ); // *Note: probably do not want to translate this
- mPanelInventoryObject = getChild<LLPanelObjectInventory>("object_contents");
-
- refresh();
- return TRUE;
+ getChild<LLUICtrl>("object_name")->setTextArg("[DESC]", std::string("Object") ); // *Note: probably do not want to translate this
+ mPanelInventoryObject = getChild<LLPanelObjectInventory>("object_contents");
+
+ refresh();
+ return TRUE;
}
void LLFloaterOpenObject::onOpen(const LLSD& key)
{
- LLObjectSelectionHandle object_selection = LLSelectMgr::getInstance()->getSelection();
- if (object_selection->getRootObjectCount() != 1)
- {
- LLNotificationsUtil::add("UnableToViewContentsMoreThanOne");
- closeFloater();
- return;
- }
- if(!(object_selection->getPrimaryObject()))
- {
- closeFloater();
- return;
- }
- mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
- refresh();
+ LLObjectSelectionHandle object_selection = LLSelectMgr::getInstance()->getSelection();
+ if (object_selection->getRootObjectCount() != 1)
+ {
+ LLNotificationsUtil::add("UnableToViewContentsMoreThanOne");
+ closeFloater();
+ return;
+ }
+ if(!(object_selection->getPrimaryObject()))
+ {
+ closeFloater();
+ return;
+ }
+ mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+ refresh();
}
void LLFloaterOpenObject::refresh()
{
- mPanelInventoryObject->refresh();
-
- std::string name = "";
- BOOL enabled = FALSE;
-
- LLSelectNode* node = mObjectSelection->getFirstRootNode();
- if (node)
- {
- name = node->mName;
- enabled = TRUE;
- }
- else
- {
- name = "";
- enabled = FALSE;
- }
-
- getChild<LLUICtrl>("object_name")->setTextArg("[DESC]", name);
- getChildView("copy_to_inventory_button")->setEnabled(enabled);
- getChildView("copy_and_wear_button")->setEnabled(enabled);
- getChildView("copy_and_replace_button")->setEnabled(enabled);
+ mPanelInventoryObject->refresh();
+
+ std::string name = "";
+ BOOL enabled = FALSE;
+
+ LLSelectNode* node = mObjectSelection->getFirstRootNode();
+ if (node)
+ {
+ name = node->mName;
+ enabled = TRUE;
+ }
+ else
+ {
+ name = "";
+ enabled = FALSE;
+ }
+
+ getChild<LLUICtrl>("object_name")->setTextArg("[DESC]", name);
+ getChildView("copy_to_inventory_button")->setEnabled(enabled);
+ getChildView("copy_and_wear_button")->setEnabled(enabled);
+ getChildView("copy_and_replace_button")->setEnabled(enabled);
}
void LLFloaterOpenObject::draw()
{
- if (mDirty)
- {
- refresh();
- mDirty = FALSE;
- }
- LLFloater::draw();
+ if (mDirty)
+ {
+ refresh();
+ mDirty = FALSE;
+ }
+ LLFloater::draw();
}
void LLFloaterOpenObject::dirty()
{
- mDirty = TRUE;
+ mDirty = TRUE;
}
void LLFloaterOpenObject::moveToInventory(bool wear, bool replace)
{
- if (mObjectSelection->getRootObjectCount() != 1)
- {
- LLNotificationsUtil::add("OnlyCopyContentsOfSingleItem");
- return;
- }
-
- LLSelectNode* node = mObjectSelection->getFirstRootNode();
- if (!node) return;
- LLViewerObject* object = node->getObject();
- if (!object) return;
-
- LLUUID object_id = object->getID();
- std::string name = node->mName;
-
- // Either create a sub-folder of clothing, or of the root folder.
- LLUUID parent_category_id;
- if (wear)
- {
- parent_category_id = gInventory.findCategoryUUIDForType(
- LLFolderType::FT_CLOTHING);
- }
- else
- {
- parent_category_id = gInventory.getRootFolderID();
- }
-
- inventory_func_type func = boost::bind(LLFloaterOpenObject::callbackCreateInventoryCategory,_1,object_id,wear,replace);
- // D567 copy thumbnail info
- gInventory.createNewCategory(
+ if (mObjectSelection->getRootObjectCount() != 1)
+ {
+ LLNotificationsUtil::add("OnlyCopyContentsOfSingleItem");
+ return;
+ }
+
+ LLSelectNode* node = mObjectSelection->getFirstRootNode();
+ if (!node) return;
+ LLViewerObject* object = node->getObject();
+ if (!object) return;
+
+ LLUUID object_id = object->getID();
+ std::string name = node->mName;
+
+ // Either create a sub-folder of clothing, or of the root folder.
+ LLUUID parent_category_id;
+ if (wear)
+ {
+ parent_category_id = gInventory.findCategoryUUIDForType(
+ LLFolderType::FT_CLOTHING);
+ }
+ else
+ {
+ parent_category_id = gInventory.getRootFolderID();
+ }
+
+ inventory_func_type func = boost::bind(LLFloaterOpenObject::callbackCreateInventoryCategory,_1,object_id,wear,replace);
+ // D567 copy thumbnail info
+ gInventory.createNewCategory(
parent_category_id,
LLFolderType::FT_NONE,
name,
@@ -175,16 +175,16 @@ void LLFloaterOpenObject::moveToInventory(bool wear, bool replace)
// static
void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLUUID& category_id, LLUUID object_id, bool wear, bool replace)
{
- LLCatAndWear* wear_data = new LLCatAndWear;
-
- wear_data->mCatID = category_id;
- wear_data->mWear = wear;
- wear_data->mFolderResponded = true;
- wear_data->mReplace = replace;
-
- // Copy and/or move the items into the newly created folder.
- // Ignore any "you're going to break this item" messages.
- BOOL success = move_inv_category_world_to_agent(object_id,
+ LLCatAndWear* wear_data = new LLCatAndWear;
+
+ wear_data->mCatID = category_id;
+ wear_data->mWear = wear;
+ wear_data->mFolderResponded = true;
+ wear_data->mReplace = replace;
+
+ // Copy and/or move the items into the newly created folder.
+ // Ignore any "you're going to break this item" messages.
+ BOOL success = move_inv_category_world_to_agent(object_id,
category_id,
TRUE,
[](S32 result, void* data, const LLMoveInv*)
@@ -192,39 +192,39 @@ void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLUUID& category
callbackMoveInventory(result, data);
},
(void*)wear_data);
- if (!success)
- {
- delete wear_data;
- wear_data = NULL;
-
- LLNotificationsUtil::add("OpenObjectCannotCopy");
- }
+ if (!success)
+ {
+ delete wear_data;
+ wear_data = NULL;
+
+ LLNotificationsUtil::add("OpenObjectCannotCopy");
+ }
}
// static
void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data)
{
- LLCatAndWear* cat = (LLCatAndWear*)data;
-
- if (result == 0)
- {
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
- if (active_panel)
- {
- active_panel->setSelection(cat->mCatID, TAKE_FOCUS_NO);
- }
- }
-
- delete cat;
+ LLCatAndWear* cat = (LLCatAndWear*)data;
+
+ if (result == 0)
+ {
+ LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
+ if (active_panel)
+ {
+ active_panel->setSelection(cat->mCatID, TAKE_FOCUS_NO);
+ }
+ }
+
+ delete cat;
}
void LLFloaterOpenObject::onClickMoveToInventory()
{
- moveToInventory(false);
- closeFloater();
+ moveToInventory(false);
+ closeFloater();
}
void LLFloaterOpenObject::onClickCancel()
{
- closeFloater();
+ closeFloater();
}
diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h
index 745753316b..58d491a5d7 100644
--- a/indra/newview/llfloateropenobject.h
+++ b/indra/newview/llfloateropenobject.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloateropenobject.h
* @brief LLFloaterOpenObject class definition
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,43 +40,43 @@ class LLPanelObjectInventory;
class LLFloaterOpenObject
: public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
-
- void dirty();
-
- struct LLCatAndWear
- {
- LLUUID mCatID;
- bool mWear;
- bool mFolderResponded;
- bool mReplace;
- };
+
+ void dirty();
+
+ struct LLCatAndWear
+ {
+ LLUUID mCatID;
+ bool mWear;
+ bool mFolderResponded;
+ bool mReplace;
+ };
protected:
- /*virtual*/ BOOL postBuild();
- void refresh();
- void draw();
- virtual void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ void refresh();
+ void draw();
+ virtual void onOpen(const LLSD& key);
- void moveToInventory(bool wear, bool replace = false);
+ void moveToInventory(bool wear, bool replace = false);
- void onClickMoveToInventory();
- void onClickCancel();
- static void callbackCreateInventoryCategory(const LLUUID& category_id, LLUUID object_id, bool wear, bool replace = false);
- static void callbackMoveInventory(S32 result, void* data);
+ void onClickMoveToInventory();
+ void onClickCancel();
+ static void callbackCreateInventoryCategory(const LLUUID& category_id, LLUUID object_id, bool wear, bool replace = false);
+ static void callbackMoveInventory(S32 result, void* data);
private:
-
- LLFloaterOpenObject(const LLSD& key);
- ~LLFloaterOpenObject();
-
+
+ LLFloaterOpenObject(const LLSD& key);
+ ~LLFloaterOpenObject();
+
protected:
- LLPanelObjectInventory* mPanelInventoryObject;
- LLSafeHandle<LLObjectSelection> mObjectSelection;
- BOOL mDirty;
+ LLPanelObjectInventory* mPanelInventoryObject;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
+ BOOL mDirty;
};
#endif
diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp
index 87f927ff65..b6775f3061 100644
--- a/indra/newview/llfloaterpathfindingcharacters.cpp
+++ b/indra/newview/llfloaterpathfindingcharacters.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpathfindingcharacters.cpp
* @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage.
* @author Stinson@lindenlab.com
@@ -60,57 +60,57 @@ LLHandle<LLFloaterPathfindingCharacters> LLFloaterPathfindingCharacters::sInstan
void LLFloaterPathfindingCharacters::onClose(bool pIsAppQuitting)
{
- // Hide any capsule that might be showing on floater close
- hideCapsule();
- LLFloaterPathfindingObjects::onClose( pIsAppQuitting );
+ // Hide any capsule that might be showing on floater close
+ hideCapsule();
+ LLFloaterPathfindingObjects::onClose( pIsAppQuitting );
}
BOOL LLFloaterPathfindingCharacters::isShowPhysicsCapsule() const
{
- return mShowPhysicsCapsuleCheckBox->get();
+ return mShowPhysicsCapsuleCheckBox->get();
}
void LLFloaterPathfindingCharacters::setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule)
{
- mShowPhysicsCapsuleCheckBox->set(pIsShowPhysicsCapsule && (LLPathingLib::getInstance() != NULL));
+ mShowPhysicsCapsuleCheckBox->set(pIsShowPhysicsCapsule && (LLPathingLib::getInstance() != NULL));
}
BOOL LLFloaterPathfindingCharacters::isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const
{
- id = mSelectedCharacterId;
- // Physics capsule is enable if the checkbox is enabled and if we can get the required render
- // parameters for any selected object
- return (isShowPhysicsCapsule() && getCapsuleRenderData(pos, rot ));
+ id = mSelectedCharacterId;
+ // Physics capsule is enable if the checkbox is enabled and if we can get the required render
+ // parameters for any selected object
+ return (isShowPhysicsCapsule() && getCapsuleRenderData(pos, rot ));
}
void LLFloaterPathfindingCharacters::openCharactersWithSelectedObjects()
{
- LLFloaterPathfindingCharacters *charactersFloater = LLFloaterReg::getTypedInstance<LLFloaterPathfindingCharacters>("pathfinding_characters");
- charactersFloater->showFloaterWithSelectionObjects();
+ LLFloaterPathfindingCharacters *charactersFloater = LLFloaterReg::getTypedInstance<LLFloaterPathfindingCharacters>("pathfinding_characters");
+ charactersFloater->showFloaterWithSelectionObjects();
}
LLHandle<LLFloaterPathfindingCharacters> LLFloaterPathfindingCharacters::getInstanceHandle()
{
- if ( sInstanceHandle.isDead() )
- {
- LLFloaterPathfindingCharacters *floaterInstance = LLFloaterReg::findTypedInstance<LLFloaterPathfindingCharacters>("pathfinding_characters");
- if (floaterInstance != NULL)
- {
- sInstanceHandle = floaterInstance->mSelfHandle;
- }
- }
-
- return sInstanceHandle;
+ if ( sInstanceHandle.isDead() )
+ {
+ LLFloaterPathfindingCharacters *floaterInstance = LLFloaterReg::findTypedInstance<LLFloaterPathfindingCharacters>("pathfinding_characters");
+ if (floaterInstance != NULL)
+ {
+ sInstanceHandle = floaterInstance->mSelfHandle;
+ }
+ }
+
+ return sInstanceHandle;
}
LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed)
- : LLFloaterPathfindingObjects(pSeed),
- mShowPhysicsCapsuleCheckBox(NULL),
- mSelectedCharacterId(),
- mBeaconColor(),
- mSelfHandle()
+ : LLFloaterPathfindingObjects(pSeed),
+ mShowPhysicsCapsuleCheckBox(NULL),
+ mSelectedCharacterId(),
+ mBeaconColor(),
+ mSelfHandle()
{
- mSelfHandle.bind(this);
+ mSelfHandle.bind(this);
}
LLFloaterPathfindingCharacters::~LLFloaterPathfindingCharacters()
@@ -119,208 +119,208 @@ LLFloaterPathfindingCharacters::~LLFloaterPathfindingCharacters()
BOOL LLFloaterPathfindingCharacters::postBuild()
{
- mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingCharacterBeaconColor");
+ mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingCharacterBeaconColor");
- mShowPhysicsCapsuleCheckBox = findChild<LLCheckBoxCtrl>("show_physics_capsule");
- llassert(mShowPhysicsCapsuleCheckBox != NULL);
- mShowPhysicsCapsuleCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked, this));
- mShowPhysicsCapsuleCheckBox->setEnabled(LLPathingLib::getInstance() != NULL);
+ mShowPhysicsCapsuleCheckBox = findChild<LLCheckBoxCtrl>("show_physics_capsule");
+ llassert(mShowPhysicsCapsuleCheckBox != NULL);
+ mShowPhysicsCapsuleCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked, this));
+ mShowPhysicsCapsuleCheckBox->setEnabled(LLPathingLib::getInstance() != NULL);
- return LLFloaterPathfindingObjects::postBuild();
+ return LLFloaterPathfindingObjects::postBuild();
}
void LLFloaterPathfindingCharacters::requestGetObjects()
{
- LLPathfindingManager::getInstance()->requestGetCharacters(getNewRequestId(), boost::bind(&LLFloaterPathfindingCharacters::handleNewObjectList, this, _1, _2, _3));
+ LLPathfindingManager::getInstance()->requestGetCharacters(getNewRequestId(), boost::bind(&LLFloaterPathfindingCharacters::handleNewObjectList, this, _1, _2, _3));
}
void LLFloaterPathfindingCharacters::buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr)
{
- llassert(pObjectListPtr != NULL);
- llassert(!pObjectListPtr->isEmpty());
-
- for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter)
- {
- const LLPathfindingObjectPtr objectPtr = objectIter->second;
- const LLPathfindingCharacter *characterPtr = dynamic_cast<const LLPathfindingCharacter *>(objectPtr.get());
- llassert(characterPtr != NULL);
-
- LLSD scrollListItemData = buildCharacterScrollListItemData(characterPtr);
- addObjectToScrollList(objectPtr, scrollListItemData);
- }
+ llassert(pObjectListPtr != NULL);
+ llassert(!pObjectListPtr->isEmpty());
+
+ for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter)
+ {
+ const LLPathfindingObjectPtr objectPtr = objectIter->second;
+ const LLPathfindingCharacter *characterPtr = dynamic_cast<const LLPathfindingCharacter *>(objectPtr.get());
+ llassert(characterPtr != NULL);
+
+ LLSD scrollListItemData = buildCharacterScrollListItemData(characterPtr);
+ addObjectToScrollList(objectPtr, scrollListItemData);
+ }
}
void LLFloaterPathfindingCharacters::updateControlsOnScrollListChange()
{
- LLFloaterPathfindingObjects::updateControlsOnScrollListChange();
- updateStateOnDisplayControls();
- showSelectedCharacterCapsules();
+ LLFloaterPathfindingObjects::updateControlsOnScrollListChange();
+ updateStateOnDisplayControls();
+ showSelectedCharacterCapsules();
}
S32 LLFloaterPathfindingCharacters::getNameColumnIndex() const
{
- return 0;
+ return 0;
}
S32 LLFloaterPathfindingCharacters::getOwnerNameColumnIndex() const
{
- return 2;
+ return 2;
}
std::string LLFloaterPathfindingCharacters::getOwnerName(const LLPathfindingObject *pObject) const
{
- return (pObject->hasOwner()
- ? (pObject->hasOwnerName()
- ? (pObject->isGroupOwned()
- ? (pObject->getOwnerName() + " " + getString("character_owner_group"))
- : pObject->getOwnerName())
- : getString("character_owner_loading"))
- : getString("character_owner_unknown"));
+ return (pObject->hasOwner()
+ ? (pObject->hasOwnerName()
+ ? (pObject->isGroupOwned()
+ ? (pObject->getOwnerName() + " " + getString("character_owner_group"))
+ : pObject->getOwnerName())
+ : getString("character_owner_loading"))
+ : getString("character_owner_unknown"));
}
const LLColor4 &LLFloaterPathfindingCharacters::getBeaconColor() const
{
- return mBeaconColor;
+ return mBeaconColor;
}
LLPathfindingObjectListPtr LLFloaterPathfindingCharacters::getEmptyObjectList() const
{
- LLPathfindingObjectListPtr objectListPtr(new LLPathfindingCharacterList());
- return objectListPtr;
+ LLPathfindingObjectListPtr objectListPtr(new LLPathfindingCharacterList());
+ return objectListPtr;
}
void LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked()
{
- if (LLPathingLib::getInstance() == NULL)
- {
- if (isShowPhysicsCapsule())
- {
- setShowPhysicsCapsule(FALSE);
- }
- }
- else
- {
- if (mSelectedCharacterId.notNull() && isShowPhysicsCapsule())
- {
- showCapsule();
- }
- else
- {
- hideCapsule();
- }
- }
+ if (LLPathingLib::getInstance() == NULL)
+ {
+ if (isShowPhysicsCapsule())
+ {
+ setShowPhysicsCapsule(FALSE);
+ }
+ }
+ else
+ {
+ if (mSelectedCharacterId.notNull() && isShowPhysicsCapsule())
+ {
+ showCapsule();
+ }
+ else
+ {
+ hideCapsule();
+ }
+ }
}
LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListItemData(const LLPathfindingCharacter *pCharacterPtr) const
{
- LLSD columns = LLSD::emptyArray();
+ LLSD columns = LLSD::emptyArray();
- columns[0]["column"] = "name";
- columns[0]["value"] = pCharacterPtr->getName();
+ columns[0]["column"] = "name";
+ columns[0]["value"] = pCharacterPtr->getName();
- columns[1]["column"] = "description";
- columns[1]["value"] = pCharacterPtr->getDescription();
+ columns[1]["column"] = "description";
+ columns[1]["value"] = pCharacterPtr->getDescription();
- columns[2]["column"] = "owner";
- columns[2]["value"] = getOwnerName(pCharacterPtr);
+ columns[2]["column"] = "owner";
+ columns[2]["value"] = getOwnerName(pCharacterPtr);
- S32 cpuTime = ll_round(pCharacterPtr->getCPUTime());
- std::string cpuTimeString = llformat("%d", cpuTime);
- LLStringUtil::format_map_t string_args;
- string_args["[CPU_TIME]"] = cpuTimeString;
+ S32 cpuTime = ll_round(pCharacterPtr->getCPUTime());
+ std::string cpuTimeString = llformat("%d", cpuTime);
+ LLStringUtil::format_map_t string_args;
+ string_args["[CPU_TIME]"] = cpuTimeString;
- columns[3]["column"] = "cpu_time";
- columns[3]["value"] = getString("character_cpu_time", string_args);
+ columns[3]["column"] = "cpu_time";
+ columns[3]["value"] = getString("character_cpu_time", string_args);
- columns[4]["column"] = "altitude";
- columns[4]["value"] = llformat("%1.0f m", pCharacterPtr->getLocation()[2]);
+ columns[4]["column"] = "altitude";
+ columns[4]["value"] = llformat("%1.0f m", pCharacterPtr->getLocation()[2]);
- return columns;
+ return columns;
}
void LLFloaterPathfindingCharacters::updateStateOnDisplayControls()
{
- int numSelectedItems = getNumSelectedObjects();;
- bool isEditEnabled = ((numSelectedItems == 1) && (LLPathingLib::getInstance() != NULL));
-
- mShowPhysicsCapsuleCheckBox->setEnabled(isEditEnabled);
- if (!isEditEnabled)
- {
- setShowPhysicsCapsule(FALSE);
- }
+ int numSelectedItems = getNumSelectedObjects();;
+ bool isEditEnabled = ((numSelectedItems == 1) && (LLPathingLib::getInstance() != NULL));
+
+ mShowPhysicsCapsuleCheckBox->setEnabled(isEditEnabled);
+ if (!isEditEnabled)
+ {
+ setShowPhysicsCapsule(FALSE);
+ }
}
void LLFloaterPathfindingCharacters::showSelectedCharacterCapsules()
{
- // Hide any previous capsule
- hideCapsule();
-
- // Get the only selected object, or set the selected object to null if we do not have exactly
- // one object selected
- if (getNumSelectedObjects() == 1)
- {
- LLPathfindingObjectPtr selectedObjectPtr = getFirstSelectedObject();
- mSelectedCharacterId = selectedObjectPtr->getUUID();
- }
- else
- {
- mSelectedCharacterId.setNull();
- }
-
- // Show any capsule if enabled
- showCapsule();
+ // Hide any previous capsule
+ hideCapsule();
+
+ // Get the only selected object, or set the selected object to null if we do not have exactly
+ // one object selected
+ if (getNumSelectedObjects() == 1)
+ {
+ LLPathfindingObjectPtr selectedObjectPtr = getFirstSelectedObject();
+ mSelectedCharacterId = selectedObjectPtr->getUUID();
+ }
+ else
+ {
+ mSelectedCharacterId.setNull();
+ }
+
+ // Show any capsule if enabled
+ showCapsule();
}
void LLFloaterPathfindingCharacters::showCapsule() const
{
- if (mSelectedCharacterId.notNull() && isShowPhysicsCapsule())
- {
- LLPathfindingObjectPtr objectPtr = getFirstSelectedObject();
- llassert(objectPtr != NULL);
- if (objectPtr != NULL)
- {
- const LLPathfindingCharacter *character = dynamic_cast<const LLPathfindingCharacter *>(objectPtr.get());
- llassert(mSelectedCharacterId == character->getUUID());
- if (LLPathingLib::getInstance() != NULL)
- {
- LLPathingLib::getInstance()->createPhysicsCapsuleRep(character->getLength(), character->getRadius(),
- character->isHorizontal(), character->getUUID());
- }
- }
-
- gPipeline.hideObject(mSelectedCharacterId);
- }
+ if (mSelectedCharacterId.notNull() && isShowPhysicsCapsule())
+ {
+ LLPathfindingObjectPtr objectPtr = getFirstSelectedObject();
+ llassert(objectPtr != NULL);
+ if (objectPtr != NULL)
+ {
+ const LLPathfindingCharacter *character = dynamic_cast<const LLPathfindingCharacter *>(objectPtr.get());
+ llassert(mSelectedCharacterId == character->getUUID());
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->createPhysicsCapsuleRep(character->getLength(), character->getRadius(),
+ character->isHorizontal(), character->getUUID());
+ }
+ }
+
+ gPipeline.hideObject(mSelectedCharacterId);
+ }
}
void LLFloaterPathfindingCharacters::hideCapsule() const
{
- if (mSelectedCharacterId.notNull())
- {
- gPipeline.restoreHiddenObject(mSelectedCharacterId);
- }
- if (LLPathingLib::getInstance() != NULL)
- {
- LLPathingLib::getInstance()->cleanupPhysicsCapsuleRepResiduals();
- }
+ if (mSelectedCharacterId.notNull())
+ {
+ gPipeline.restoreHiddenObject(mSelectedCharacterId);
+ }
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->cleanupPhysicsCapsuleRepResiduals();
+ }
}
bool LLFloaterPathfindingCharacters::getCapsuleRenderData(LLVector3& pPosition, LLQuaternion& rot) const
{
- bool result = false;
-
- // If we have a selected object, find the object on the viewer object list and return its
- // position. Else, return false indicating that we either do not have a selected object
- // or we cannot find the selected object on the viewer object list
- if (mSelectedCharacterId.notNull())
- {
- LLViewerObject *viewerObject = gObjectList.findObject(mSelectedCharacterId);
- if ( viewerObject != NULL )
- {
- rot = viewerObject->getRotation() ;
- pPosition = viewerObject->getRenderPosition();
- result = true;
- }
- }
-
- return result;
+ bool result = false;
+
+ // If we have a selected object, find the object on the viewer object list and return its
+ // position. Else, return false indicating that we either do not have a selected object
+ // or we cannot find the selected object on the viewer object list
+ if (mSelectedCharacterId.notNull())
+ {
+ LLViewerObject *viewerObject = gObjectList.findObject(mSelectedCharacterId);
+ if ( viewerObject != NULL )
+ {
+ rot = viewerObject->getRotation() ;
+ pPosition = viewerObject->getRenderPosition();
+ result = true;
+ }
+ }
+
+ return result;
}
diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h
index 4021f4f119..4f9c7aadc0 100644
--- a/indra/newview/llfloaterpathfindingcharacters.h
+++ b/indra/newview/llfloaterpathfindingcharacters.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpathfindingcharacters.h
* @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage.
* @author Stinson@lindenlab.com
@@ -42,58 +42,58 @@ class LLVector3;
class LLFloaterPathfindingCharacters : public LLFloaterPathfindingObjects
{
public:
- virtual void onClose(bool pIsAppQuitting);
+ virtual void onClose(bool pIsAppQuitting);
- BOOL isShowPhysicsCapsule() const;
- void setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule);
+ BOOL isShowPhysicsCapsule() const;
+ void setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule);
- BOOL isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const;
+ BOOL isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const;
- static void openCharactersWithSelectedObjects();
- static LLHandle<LLFloaterPathfindingCharacters> getInstanceHandle();
+ static void openCharactersWithSelectedObjects();
+ static LLHandle<LLFloaterPathfindingCharacters> getInstanceHandle();
protected:
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
- LLFloaterPathfindingCharacters(const LLSD& pSeed);
- virtual ~LLFloaterPathfindingCharacters();
+ LLFloaterPathfindingCharacters(const LLSD& pSeed);
+ virtual ~LLFloaterPathfindingCharacters();
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- virtual void requestGetObjects();
+ virtual void requestGetObjects();
- virtual void buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr);
+ virtual void buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr);
- virtual void updateControlsOnScrollListChange();
+ virtual void updateControlsOnScrollListChange();
- virtual S32 getNameColumnIndex() const;
- virtual S32 getOwnerNameColumnIndex() const;
- virtual std::string getOwnerName(const LLPathfindingObject *pObject) const;
- virtual const LLColor4 &getBeaconColor() const;
+ virtual S32 getNameColumnIndex() const;
+ virtual S32 getOwnerNameColumnIndex() const;
+ virtual std::string getOwnerName(const LLPathfindingObject *pObject) const;
+ virtual const LLColor4 &getBeaconColor() const;
- virtual LLPathfindingObjectListPtr getEmptyObjectList() const;
+ virtual LLPathfindingObjectListPtr getEmptyObjectList() const;
private:
- void onShowPhysicsCapsuleClicked();
+ void onShowPhysicsCapsuleClicked();
- LLSD buildCharacterScrollListItemData(const LLPathfindingCharacter *pCharacterPtr) const;
+ LLSD buildCharacterScrollListItemData(const LLPathfindingCharacter *pCharacterPtr) const;
- void updateStateOnDisplayControls();
- void showSelectedCharacterCapsules();
+ void updateStateOnDisplayControls();
+ void showSelectedCharacterCapsules();
- void showCapsule() const;
- void hideCapsule() const;
+ void showCapsule() const;
+ void hideCapsule() const;
- bool getCapsuleRenderData(LLVector3& pPosition, LLQuaternion& rot) const;
+ bool getCapsuleRenderData(LLVector3& pPosition, LLQuaternion& rot) const;
- LLCheckBoxCtrl *mShowPhysicsCapsuleCheckBox;
+ LLCheckBoxCtrl *mShowPhysicsCapsuleCheckBox;
- LLUUID mSelectedCharacterId;
+ LLUUID mSelectedCharacterId;
- LLColor4 mBeaconColor;
+ LLColor4 mBeaconColor;
- LLRootHandle<LLFloaterPathfindingCharacters> mSelfHandle;
- static LLHandle<LLFloaterPathfindingCharacters> sInstanceHandle;
+ LLRootHandle<LLFloaterPathfindingCharacters> mSelfHandle;
+ static LLHandle<LLFloaterPathfindingCharacters> sInstanceHandle;
};
#endif // LL_LLFLOATERPATHFINDINGCHARACTERS_H
diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp
index ccf3e723fd..f2dffb2b67 100644
--- a/indra/newview/llfloaterpathfindingconsole.cpp
+++ b/indra/newview/llfloaterpathfindingconsole.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpathfindingconsole.cpp
* @brief "Pathfinding console" floater, allowing for viewing and testing of the pathfinding navmesh through Havok AI utilities.
* @author Stinson@lindenlab.com
@@ -87,7 +87,7 @@
#define CONTROL_NAME_TEST_PATH_VALID_END "PathfindingTestPathValidEndColor"
#define CONTROL_NAME_TEST_PATH_INVALID_END "PathfindingTestPathInvalidEndColor"
#define CONTROL_NAME_TEST_PATH "PathfindingTestPathColor"
-#define CONTROL_NAME_WATER "PathfindingWaterColor"
+#define CONTROL_NAME_WATER "PathfindingWaterColor"
LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::sInstanceHandle;
@@ -97,415 +97,415 @@ LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::sInstanceHand
BOOL LLFloaterPathfindingConsole::postBuild()
{
- mViewTestTabContainer = findChild<LLTabContainer>("view_test_tab_container");
- llassert(mViewTestTabContainer != NULL);
- mViewTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this));
+ mViewTestTabContainer = findChild<LLTabContainer>("view_test_tab_container");
+ llassert(mViewTestTabContainer != NULL);
+ mViewTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this));
- mViewTab = findChild<LLPanel>("view_panel");
- llassert(mViewTab != NULL);
+ mViewTab = findChild<LLPanel>("view_panel");
+ llassert(mViewTab != NULL);
- mShowLabel = findChild<LLTextBase>("show_label");
- llassert(mShowLabel != NULL);
+ mShowLabel = findChild<LLTextBase>("show_label");
+ llassert(mShowLabel != NULL);
- mShowWorldCheckBox = findChild<LLCheckBoxCtrl>("show_world");
- llassert(mShowWorldCheckBox != NULL);
- mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this));
-
- mShowWorldMovablesOnlyCheckBox = findChild<LLCheckBoxCtrl>("show_world_movables_only");
- llassert(mShowWorldMovablesOnlyCheckBox != NULL);
- mShowWorldMovablesOnlyCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldMovablesOnlySet, this));
+ mShowWorldCheckBox = findChild<LLCheckBoxCtrl>("show_world");
+ llassert(mShowWorldCheckBox != NULL);
+ mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this));
- mShowNavMeshCheckBox = findChild<LLCheckBoxCtrl>("show_navmesh");
- llassert(mShowNavMeshCheckBox != NULL);
- mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshSet, this));
+ mShowWorldMovablesOnlyCheckBox = findChild<LLCheckBoxCtrl>("show_world_movables_only");
+ llassert(mShowWorldMovablesOnlyCheckBox != NULL);
+ mShowWorldMovablesOnlyCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldMovablesOnlySet, this));
- mShowNavMeshWalkabilityLabel = findChild<LLTextBase>("show_walkability_label");
- llassert(mShowNavMeshWalkabilityLabel != NULL);
+ mShowNavMeshCheckBox = findChild<LLCheckBoxCtrl>("show_navmesh");
+ llassert(mShowNavMeshCheckBox != NULL);
+ mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshSet, this));
- mShowNavMeshWalkabilityComboBox = findChild<LLComboBox>("show_heatmap_mode");
- llassert(mShowNavMeshWalkabilityComboBox != NULL);
- mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this));
+ mShowNavMeshWalkabilityLabel = findChild<LLTextBase>("show_walkability_label");
+ llassert(mShowNavMeshWalkabilityLabel != NULL);
- mShowWalkablesCheckBox = findChild<LLCheckBoxCtrl>("show_walkables");
- llassert(mShowWalkablesCheckBox != NULL);
+ mShowNavMeshWalkabilityComboBox = findChild<LLComboBox>("show_heatmap_mode");
+ llassert(mShowNavMeshWalkabilityComboBox != NULL);
+ mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this));
- mShowStaticObstaclesCheckBox = findChild<LLCheckBoxCtrl>("show_static_obstacles");
- llassert(mShowStaticObstaclesCheckBox != NULL);
+ mShowWalkablesCheckBox = findChild<LLCheckBoxCtrl>("show_walkables");
+ llassert(mShowWalkablesCheckBox != NULL);
- mShowMaterialVolumesCheckBox = findChild<LLCheckBoxCtrl>("show_material_volumes");
- llassert(mShowMaterialVolumesCheckBox != NULL);
+ mShowStaticObstaclesCheckBox = findChild<LLCheckBoxCtrl>("show_static_obstacles");
+ llassert(mShowStaticObstaclesCheckBox != NULL);
- mShowExclusionVolumesCheckBox = findChild<LLCheckBoxCtrl>("show_exclusion_volumes");
- llassert(mShowExclusionVolumesCheckBox != NULL);
+ mShowMaterialVolumesCheckBox = findChild<LLCheckBoxCtrl>("show_material_volumes");
+ llassert(mShowMaterialVolumesCheckBox != NULL);
- mShowRenderWaterPlaneCheckBox = findChild<LLCheckBoxCtrl>("show_water_plane");
- llassert(mShowRenderWaterPlaneCheckBox != NULL);
+ mShowExclusionVolumesCheckBox = findChild<LLCheckBoxCtrl>("show_exclusion_volumes");
+ llassert(mShowExclusionVolumesCheckBox != NULL);
- mShowXRayCheckBox = findChild<LLCheckBoxCtrl>("show_xray");
- llassert(mShowXRayCheckBox != NULL);
+ mShowRenderWaterPlaneCheckBox = findChild<LLCheckBoxCtrl>("show_water_plane");
+ llassert(mShowRenderWaterPlaneCheckBox != NULL);
- mTestTab = findChild<LLPanel>("test_panel");
- llassert(mTestTab != NULL);
+ mShowXRayCheckBox = findChild<LLCheckBoxCtrl>("show_xray");
+ llassert(mShowXRayCheckBox != NULL);
- mPathfindingViewerStatus = findChild<LLTextBase>("pathfinding_viewer_status");
- llassert(mPathfindingViewerStatus != NULL);
+ mTestTab = findChild<LLPanel>("test_panel");
+ llassert(mTestTab != NULL);
- mPathfindingSimulatorStatus = findChild<LLTextBase>("pathfinding_simulator_status");
- llassert(mPathfindingSimulatorStatus != NULL);
+ mPathfindingViewerStatus = findChild<LLTextBase>("pathfinding_viewer_status");
+ llassert(mPathfindingViewerStatus != NULL);
- mCtrlClickLabel = findChild<LLTextBase>("ctrl_click_label");
- llassert(mCtrlClickLabel != NULL);
+ mPathfindingSimulatorStatus = findChild<LLTextBase>("pathfinding_simulator_status");
+ llassert(mPathfindingSimulatorStatus != NULL);
- mShiftClickLabel = findChild<LLTextBase>("shift_click_label");
- llassert(mShiftClickLabel != NULL);
+ mCtrlClickLabel = findChild<LLTextBase>("ctrl_click_label");
+ llassert(mCtrlClickLabel != NULL);
- mCharacterWidthLabel = findChild<LLTextBase>("character_width_label");
- llassert(mCharacterWidthLabel != NULL);
+ mShiftClickLabel = findChild<LLTextBase>("shift_click_label");
+ llassert(mShiftClickLabel != NULL);
- mCharacterWidthSlider = findChild<LLSliderCtrl>("character_width");
- llassert(mCharacterWidthSlider != NULL);
- mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this));
+ mCharacterWidthLabel = findChild<LLTextBase>("character_width_label");
+ llassert(mCharacterWidthLabel != NULL);
- mCharacterWidthUnitLabel = findChild<LLTextBase>("character_width_unit_label");
- llassert(mCharacterWidthUnitLabel != NULL);
+ mCharacterWidthSlider = findChild<LLSliderCtrl>("character_width");
+ llassert(mCharacterWidthSlider != NULL);
+ mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this));
- mCharacterTypeLabel = findChild<LLTextBase>("character_type_label");
- llassert(mCharacterTypeLabel != NULL);
+ mCharacterWidthUnitLabel = findChild<LLTextBase>("character_width_unit_label");
+ llassert(mCharacterWidthUnitLabel != NULL);
- mCharacterTypeComboBox = findChild<LLComboBox>("path_character_type");
- llassert(mCharacterTypeComboBox != NULL);
- mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this));
+ mCharacterTypeLabel = findChild<LLTextBase>("character_type_label");
+ llassert(mCharacterTypeLabel != NULL);
- mPathTestingStatus = findChild<LLTextBase>("path_test_status");
- llassert(mPathTestingStatus != NULL);
+ mCharacterTypeComboBox = findChild<LLComboBox>("path_character_type");
+ llassert(mCharacterTypeComboBox != NULL);
+ mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this));
- mClearPathButton = findChild<LLButton>("clear_path");
- llassert(mClearPathButton != NULL);
- mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this));
+ mPathTestingStatus = findChild<LLTextBase>("path_test_status");
+ llassert(mPathTestingStatus != NULL);
- mErrorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor");
- mWarningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor");
+ mClearPathButton = findChild<LLButton>("clear_path");
+ llassert(mClearPathButton != NULL);
+ mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this));
- if (LLPathingLib::getInstance() != NULL)
- {
- mPathfindingToolset = new LLToolset();
- mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance());
- mPathfindingToolset->addTool(LLToolCamera::getInstance());
- mPathfindingToolset->setShowFloaterTools(false);
- }
+ mErrorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor");
+ mWarningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor");
- updateCharacterWidth();
- updateCharacterType();
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ mPathfindingToolset = new LLToolset();
+ mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance());
+ mPathfindingToolset->addTool(LLToolCamera::getInstance());
+ mPathfindingToolset->setShowFloaterTools(false);
+ }
- return LLFloater::postBuild();
+ updateCharacterWidth();
+ updateCharacterType();
+
+ return LLFloater::postBuild();
}
void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey)
{
- LLFloater::onOpen(pKey);
- //make sure we have a pathing system
- if ( LLPathingLib::getInstance() == NULL )
- {
- setConsoleState(kConsoleStateLibraryNotImplemented);
- LL_WARNS() <<"Errror: cannot find pathing library implementation."<<LL_ENDL;
- }
- else
- {
- if (!mNavMeshZoneSlot.connected())
- {
- mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshZoneStatus, this, _1));
- }
-
- mIsNavMeshUpdating = false;
- initializeNavMeshZoneForCurrentRegion();
- registerSavedSettingsListeners();
- fillInColorsForNavMeshVisualization();
- }
-
- if (!mRegionBoundarySlot.connected())
- {
- mRegionBoundarySlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this));
- }
-
- if (!mTeleportFailedSlot.connected())
- {
- mTeleportFailedSlot = LLViewerParcelMgr::getInstance()->setTeleportFailedCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this));
- }
-
- if (!mPathEventSlot.connected())
- {
- mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this));
- }
-
- setDefaultInputs();
- updatePathTestStatus();
-
- if (mViewTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX)
- {
- switchIntoTestPathMode();
- }
+ LLFloater::onOpen(pKey);
+ //make sure we have a pathing system
+ if ( LLPathingLib::getInstance() == NULL )
+ {
+ setConsoleState(kConsoleStateLibraryNotImplemented);
+ LL_WARNS() <<"Errror: cannot find pathing library implementation."<<LL_ENDL;
+ }
+ else
+ {
+ if (!mNavMeshZoneSlot.connected())
+ {
+ mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshZoneStatus, this, _1));
+ }
+
+ mIsNavMeshUpdating = false;
+ initializeNavMeshZoneForCurrentRegion();
+ registerSavedSettingsListeners();
+ fillInColorsForNavMeshVisualization();
+ }
+
+ if (!mRegionBoundarySlot.connected())
+ {
+ mRegionBoundarySlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this));
+ }
+
+ if (!mTeleportFailedSlot.connected())
+ {
+ mTeleportFailedSlot = LLViewerParcelMgr::getInstance()->setTeleportFailedCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this));
+ }
+
+ if (!mPathEventSlot.connected())
+ {
+ mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this));
+ }
+
+ setDefaultInputs();
+ updatePathTestStatus();
+
+ if (mViewTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX)
+ {
+ switchIntoTestPathMode();
+ }
}
void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting)
{
- switchOutOfTestPathMode();
-
- if (mPathEventSlot.connected())
- {
- mPathEventSlot.disconnect();
- }
-
- if (mTeleportFailedSlot.connected())
- {
- mTeleportFailedSlot.disconnect();
- }
-
- if (mRegionBoundarySlot.connected())
- {
- mRegionBoundarySlot.disconnect();
- }
-
- if (mNavMeshZoneSlot.connected())
- {
- mNavMeshZoneSlot.disconnect();
- }
-
- if (LLPathingLib::getInstance() != NULL)
- {
- mNavMeshZone.disable();
- }
- deregisterSavedSettingsListeners();
-
- setDefaultInputs();
- setConsoleState(kConsoleStateUnknown);
- cleanupRenderableRestoreItems();
-
- LLFloater::onClose(pIsAppQuitting);
+ switchOutOfTestPathMode();
+
+ if (mPathEventSlot.connected())
+ {
+ mPathEventSlot.disconnect();
+ }
+
+ if (mTeleportFailedSlot.connected())
+ {
+ mTeleportFailedSlot.disconnect();
+ }
+
+ if (mRegionBoundarySlot.connected())
+ {
+ mRegionBoundarySlot.disconnect();
+ }
+
+ if (mNavMeshZoneSlot.connected())
+ {
+ mNavMeshZoneSlot.disconnect();
+ }
+
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ mNavMeshZone.disable();
+ }
+ deregisterSavedSettingsListeners();
+
+ setDefaultInputs();
+ setConsoleState(kConsoleStateUnknown);
+ cleanupRenderableRestoreItems();
+
+ LLFloater::onClose(pIsAppQuitting);
}
LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::getInstanceHandle()
{
- if (sInstanceHandle.isDead())
- {
- LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::findTypedInstance<LLFloaterPathfindingConsole>("pathfinding_console");
- if (floaterInstance != NULL)
- {
- sInstanceHandle = floaterInstance->mSelfHandle;
- }
- }
-
- return sInstanceHandle;
+ if (sInstanceHandle.isDead())
+ {
+ LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::findTypedInstance<LLFloaterPathfindingConsole>("pathfinding_console");
+ if (floaterInstance != NULL)
+ {
+ sInstanceHandle = floaterInstance->mSelfHandle;
+ }
+ }
+
+ return sInstanceHandle;
}
BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const
{
- return mShowNavMeshCheckBox->get();
+ return mShowNavMeshCheckBox->get();
}
void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh)
{
- mShowNavMeshCheckBox->set(pIsRenderNavMesh);
- setNavMeshRenderState();
+ mShowNavMeshCheckBox->set(pIsRenderNavMesh);
+ setNavMeshRenderState();
}
BOOL LLFloaterPathfindingConsole::isRenderWalkables() const
{
- return mShowWalkablesCheckBox->get();
+ return mShowWalkablesCheckBox->get();
}
void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables)
{
- mShowWalkablesCheckBox->set(pIsRenderWalkables);
+ mShowWalkablesCheckBox->set(pIsRenderWalkables);
}
BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const
{
- return mShowStaticObstaclesCheckBox->get();
+ return mShowStaticObstaclesCheckBox->get();
}
void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles)
{
- mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles);
+ mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles);
}
BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const
{
- return mShowMaterialVolumesCheckBox->get();
+ return mShowMaterialVolumesCheckBox->get();
}
void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes)
{
- mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes);
+ mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes);
}
BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const
{
- return mShowExclusionVolumesCheckBox->get();
+ return mShowExclusionVolumesCheckBox->get();
}
void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes)
{
- mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes);
+ mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes);
}
BOOL LLFloaterPathfindingConsole::isRenderWorld() const
{
- return mShowWorldCheckBox->get();
+ return mShowWorldCheckBox->get();
}
void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld)
{
- mShowWorldCheckBox->set(pIsRenderWorld);
- setWorldRenderState();
+ mShowWorldCheckBox->set(pIsRenderWorld);
+ setWorldRenderState();
}
BOOL LLFloaterPathfindingConsole::isRenderWorldMovablesOnly() const
{
- return (mShowWorldCheckBox->get() && mShowWorldMovablesOnlyCheckBox->get());
+ return (mShowWorldCheckBox->get() && mShowWorldMovablesOnlyCheckBox->get());
}
void LLFloaterPathfindingConsole::setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly)
{
- mShowWorldMovablesOnlyCheckBox->set(pIsRenderWorldMovablesOnly);
+ mShowWorldMovablesOnlyCheckBox->set(pIsRenderWorldMovablesOnly);
}
BOOL LLFloaterPathfindingConsole::isRenderWaterPlane() const
{
- return mShowRenderWaterPlaneCheckBox->get();
+ return mShowRenderWaterPlaneCheckBox->get();
}
void LLFloaterPathfindingConsole::setRenderWaterPlane(BOOL pIsRenderWaterPlane)
{
- mShowRenderWaterPlaneCheckBox->set(pIsRenderWaterPlane);
+ mShowRenderWaterPlaneCheckBox->set(pIsRenderWaterPlane);
}
BOOL LLFloaterPathfindingConsole::isRenderXRay() const
{
- return mShowXRayCheckBox->get();
+ return mShowXRayCheckBox->get();
}
void LLFloaterPathfindingConsole::setRenderXRay(BOOL pIsRenderXRay)
{
- mShowXRayCheckBox->set(pIsRenderXRay);
+ mShowXRayCheckBox->set(pIsRenderXRay);
}
LLPathingLib::LLPLCharacterType LLFloaterPathfindingConsole::getRenderHeatmapType() const
{
- LLPathingLib::LLPLCharacterType renderHeatmapType;
-
- switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger())
- {
- case XUI_RENDER_HEATMAP_NONE :
- renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
- break;
- case XUI_RENDER_HEATMAP_A :
- renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_A;
- break;
- case XUI_RENDER_HEATMAP_B :
- renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_B;
- break;
- case XUI_RENDER_HEATMAP_C :
- renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_C;
- break;
- case XUI_RENDER_HEATMAP_D :
- renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_D;
- break;
- default :
- renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
- llassert(0);
- break;
- }
-
- return renderHeatmapType;
+ LLPathingLib::LLPLCharacterType renderHeatmapType;
+
+ switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger())
+ {
+ case XUI_RENDER_HEATMAP_NONE :
+ renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
+ break;
+ case XUI_RENDER_HEATMAP_A :
+ renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_A;
+ break;
+ case XUI_RENDER_HEATMAP_B :
+ renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_B;
+ break;
+ case XUI_RENDER_HEATMAP_C :
+ renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_C;
+ break;
+ case XUI_RENDER_HEATMAP_D :
+ renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_D;
+ break;
+ default :
+ renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
+ llassert(0);
+ break;
+ }
+
+ return renderHeatmapType;
}
void LLFloaterPathfindingConsole::setRenderHeatmapType(LLPathingLib::LLPLCharacterType pRenderHeatmapType)
{
- LLSD comboBoxValue;
-
- switch (pRenderHeatmapType)
- {
- case LLPathingLib::LLPL_CHARACTER_TYPE_NONE :
- comboBoxValue = XUI_RENDER_HEATMAP_NONE;
- break;
- case LLPathingLib::LLPL_CHARACTER_TYPE_A :
- comboBoxValue = XUI_RENDER_HEATMAP_A;
- break;
- case LLPathingLib::LLPL_CHARACTER_TYPE_B :
- comboBoxValue = XUI_RENDER_HEATMAP_B;
- break;
- case LLPathingLib::LLPL_CHARACTER_TYPE_C :
- comboBoxValue = XUI_RENDER_HEATMAP_C;
- break;
- case LLPathingLib::LLPL_CHARACTER_TYPE_D :
- comboBoxValue = XUI_RENDER_HEATMAP_D;
- break;
- default :
- comboBoxValue = XUI_RENDER_HEATMAP_NONE;
- llassert(0);
- break;
- }
-
- mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue);
+ LLSD comboBoxValue;
+
+ switch (pRenderHeatmapType)
+ {
+ case LLPathingLib::LLPL_CHARACTER_TYPE_NONE :
+ comboBoxValue = XUI_RENDER_HEATMAP_NONE;
+ break;
+ case LLPathingLib::LLPL_CHARACTER_TYPE_A :
+ comboBoxValue = XUI_RENDER_HEATMAP_A;
+ break;
+ case LLPathingLib::LLPL_CHARACTER_TYPE_B :
+ comboBoxValue = XUI_RENDER_HEATMAP_B;
+ break;
+ case LLPathingLib::LLPL_CHARACTER_TYPE_C :
+ comboBoxValue = XUI_RENDER_HEATMAP_C;
+ break;
+ case LLPathingLib::LLPL_CHARACTER_TYPE_D :
+ comboBoxValue = XUI_RENDER_HEATMAP_D;
+ break;
+ default :
+ comboBoxValue = XUI_RENDER_HEATMAP_NONE;
+ llassert(0);
+ break;
+ }
+
+ mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue);
}
LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
- : LLFloater(pSeed),
- mSelfHandle(),
- mViewTestTabContainer(NULL),
- mViewTab(NULL),
- mShowLabel(NULL),
- mShowWorldCheckBox(NULL),
- mShowWorldMovablesOnlyCheckBox(NULL),
- mShowNavMeshCheckBox(NULL),
- mShowNavMeshWalkabilityLabel(NULL),
- mShowNavMeshWalkabilityComboBox(NULL),
- mShowWalkablesCheckBox(NULL),
- mShowStaticObstaclesCheckBox(NULL),
- mShowMaterialVolumesCheckBox(NULL),
- mShowExclusionVolumesCheckBox(NULL),
- mShowRenderWaterPlaneCheckBox(NULL),
- mShowXRayCheckBox(NULL),
- mPathfindingViewerStatus(NULL),
- mPathfindingSimulatorStatus(NULL),
- mTestTab(NULL),
- mCtrlClickLabel(),
- mShiftClickLabel(),
- mCharacterWidthLabel(),
- mCharacterWidthUnitLabel(),
- mCharacterWidthSlider(NULL),
- mCharacterTypeLabel(),
- mCharacterTypeComboBox(NULL),
- mPathTestingStatus(NULL),
- mClearPathButton(NULL),
- mErrorColor(),
- mWarningColor(),
- mNavMeshZoneSlot(),
- mNavMeshZone(),
- mIsNavMeshUpdating(false),
- mRegionBoundarySlot(),
- mTeleportFailedSlot(),
- mPathEventSlot(),
- mPathfindingToolset(NULL),
- mSavedToolset(NULL),
- mSavedSettingRetrieveNeighborSlot(),
- mSavedSettingWalkableSlot(),
- mSavedSettingStaticObstacleSlot(),
- mSavedSettingMaterialVolumeSlot(),
- mSavedSettingExclusionVolumeSlot(),
- mSavedSettingInteriorEdgeSlot(),
- mSavedSettingExteriorEdgeSlot(),
- mSavedSettingHeatmapMinSlot(),
- mSavedSettingHeatmapMaxSlot(),
- mSavedSettingNavMeshFaceSlot(),
- mSavedSettingTestPathValidEndSlot(),
- mSavedSettingTestPathInvalidEndSlot(),
- mSavedSettingTestPathSlot(),
- mSavedSettingWaterSlot(),
- mConsoleState(kConsoleStateUnknown),
- mRenderableRestoreList()
+ : LLFloater(pSeed),
+ mSelfHandle(),
+ mViewTestTabContainer(NULL),
+ mViewTab(NULL),
+ mShowLabel(NULL),
+ mShowWorldCheckBox(NULL),
+ mShowWorldMovablesOnlyCheckBox(NULL),
+ mShowNavMeshCheckBox(NULL),
+ mShowNavMeshWalkabilityLabel(NULL),
+ mShowNavMeshWalkabilityComboBox(NULL),
+ mShowWalkablesCheckBox(NULL),
+ mShowStaticObstaclesCheckBox(NULL),
+ mShowMaterialVolumesCheckBox(NULL),
+ mShowExclusionVolumesCheckBox(NULL),
+ mShowRenderWaterPlaneCheckBox(NULL),
+ mShowXRayCheckBox(NULL),
+ mPathfindingViewerStatus(NULL),
+ mPathfindingSimulatorStatus(NULL),
+ mTestTab(NULL),
+ mCtrlClickLabel(),
+ mShiftClickLabel(),
+ mCharacterWidthLabel(),
+ mCharacterWidthUnitLabel(),
+ mCharacterWidthSlider(NULL),
+ mCharacterTypeLabel(),
+ mCharacterTypeComboBox(NULL),
+ mPathTestingStatus(NULL),
+ mClearPathButton(NULL),
+ mErrorColor(),
+ mWarningColor(),
+ mNavMeshZoneSlot(),
+ mNavMeshZone(),
+ mIsNavMeshUpdating(false),
+ mRegionBoundarySlot(),
+ mTeleportFailedSlot(),
+ mPathEventSlot(),
+ mPathfindingToolset(NULL),
+ mSavedToolset(NULL),
+ mSavedSettingRetrieveNeighborSlot(),
+ mSavedSettingWalkableSlot(),
+ mSavedSettingStaticObstacleSlot(),
+ mSavedSettingMaterialVolumeSlot(),
+ mSavedSettingExclusionVolumeSlot(),
+ mSavedSettingInteriorEdgeSlot(),
+ mSavedSettingExteriorEdgeSlot(),
+ mSavedSettingHeatmapMinSlot(),
+ mSavedSettingHeatmapMaxSlot(),
+ mSavedSettingNavMeshFaceSlot(),
+ mSavedSettingTestPathValidEndSlot(),
+ mSavedSettingTestPathInvalidEndSlot(),
+ mSavedSettingTestPathSlot(),
+ mSavedSettingWaterSlot(),
+ mConsoleState(kConsoleStateUnknown),
+ mRenderableRestoreList()
{
- mSelfHandle.bind(this);
+ mSelfHandle.bind(this);
}
LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole()
@@ -514,760 +514,760 @@ LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole()
void LLFloaterPathfindingConsole::onTabSwitch()
{
- if (mViewTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX)
- {
- switchIntoTestPathMode();
- }
- else
- {
- switchOutOfTestPathMode();
- }
+ if (mViewTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX)
+ {
+ switchIntoTestPathMode();
+ }
+ else
+ {
+ switchOutOfTestPathMode();
+ }
}
void LLFloaterPathfindingConsole::onShowWorldSet()
{
- setWorldRenderState();
- updateRenderablesObjects();
+ setWorldRenderState();
+ updateRenderablesObjects();
}
void LLFloaterPathfindingConsole::onShowWorldMovablesOnlySet()
{
- updateRenderablesObjects();
+ updateRenderablesObjects();
}
void LLFloaterPathfindingConsole::onShowNavMeshSet()
{
- setNavMeshRenderState();
+ setNavMeshRenderState();
}
void LLFloaterPathfindingConsole::onShowWalkabilitySet()
{
- if (LLPathingLib::getInstance() != NULL)
- {
- LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType());
- }
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType());
+ }
}
void LLFloaterPathfindingConsole::onCharacterWidthSet()
{
- updateCharacterWidth();
+ updateCharacterWidth();
}
void LLFloaterPathfindingConsole::onCharacterTypeSwitch()
{
- updateCharacterType();
+ updateCharacterType();
}
void LLFloaterPathfindingConsole::onClearPathClicked()
{
- clearPath();
+ clearPath();
}
void LLFloaterPathfindingConsole::handleNavMeshZoneStatus(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus)
{
- switch (pNavMeshZoneRequestStatus)
- {
- case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown :
- setConsoleState(kConsoleStateUnknown);
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneRequestWaiting :
- setConsoleState(kConsoleStateRegionLoading);
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking :
- setConsoleState(kConsoleStateCheckingVersion);
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate :
- mIsNavMeshUpdating = true;
- mNavMeshZone.refresh();
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted :
- setConsoleState(kConsoleStateDownloading);
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted :
- mIsNavMeshUpdating = false;
- setConsoleState(kConsoleStateHasNavMesh);
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled :
- setConsoleState(kConsoleStateRegionNotEnabled);
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneRequestError :
- setConsoleState(kConsoleStateError);
- break;
- default:
- setConsoleState(kConsoleStateUnknown);
- llassert(0);
- break;
- }
+ switch (pNavMeshZoneRequestStatus)
+ {
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown :
+ setConsoleState(kConsoleStateUnknown);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestWaiting :
+ setConsoleState(kConsoleStateRegionLoading);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking :
+ setConsoleState(kConsoleStateCheckingVersion);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate :
+ mIsNavMeshUpdating = true;
+ mNavMeshZone.refresh();
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted :
+ setConsoleState(kConsoleStateDownloading);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted :
+ mIsNavMeshUpdating = false;
+ setConsoleState(kConsoleStateHasNavMesh);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled :
+ setConsoleState(kConsoleStateRegionNotEnabled);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestError :
+ setConsoleState(kConsoleStateError);
+ break;
+ default:
+ setConsoleState(kConsoleStateUnknown);
+ llassert(0);
+ break;
+ }
}
void LLFloaterPathfindingConsole::onRegionBoundaryCross()
-{
- initializeNavMeshZoneForCurrentRegion();
- setRenderWorld(TRUE);
- setRenderWorldMovablesOnly(FALSE);
+{
+ initializeNavMeshZoneForCurrentRegion();
+ setRenderWorld(TRUE);
+ setRenderWorldMovablesOnly(FALSE);
}
void LLFloaterPathfindingConsole::onPathEvent()
{
- const LLPathfindingPathTool *pathToolInstance = LLPathfindingPathTool::getInstance();
-
- mCharacterWidthSlider->setValue(LLSD(pathToolInstance->getCharacterWidth()));
-
- LLSD characterType;
- switch (pathToolInstance->getCharacterType())
- {
- case LLPathfindingPathTool::kCharacterTypeNone :
- characterType = XUI_CHARACTER_TYPE_NONE;
- break;
- case LLPathfindingPathTool::kCharacterTypeA :
- characterType = XUI_CHARACTER_TYPE_A;
- break;
- case LLPathfindingPathTool::kCharacterTypeB :
- characterType = XUI_CHARACTER_TYPE_B;
- break;
- case LLPathfindingPathTool::kCharacterTypeC :
- characterType = XUI_CHARACTER_TYPE_C;
- break;
- case LLPathfindingPathTool::kCharacterTypeD :
- characterType = XUI_CHARACTER_TYPE_D;
- break;
- default :
- characterType = XUI_CHARACTER_TYPE_NONE;
- llassert(0);
- break;
- }
- mCharacterTypeComboBox->setValue(characterType);
-
- updatePathTestStatus();
+ const LLPathfindingPathTool *pathToolInstance = LLPathfindingPathTool::getInstance();
+
+ mCharacterWidthSlider->setValue(LLSD(pathToolInstance->getCharacterWidth()));
+
+ LLSD characterType;
+ switch (pathToolInstance->getCharacterType())
+ {
+ case LLPathfindingPathTool::kCharacterTypeNone :
+ characterType = XUI_CHARACTER_TYPE_NONE;
+ break;
+ case LLPathfindingPathTool::kCharacterTypeA :
+ characterType = XUI_CHARACTER_TYPE_A;
+ break;
+ case LLPathfindingPathTool::kCharacterTypeB :
+ characterType = XUI_CHARACTER_TYPE_B;
+ break;
+ case LLPathfindingPathTool::kCharacterTypeC :
+ characterType = XUI_CHARACTER_TYPE_C;
+ break;
+ case LLPathfindingPathTool::kCharacterTypeD :
+ characterType = XUI_CHARACTER_TYPE_D;
+ break;
+ default :
+ characterType = XUI_CHARACTER_TYPE_NONE;
+ llassert(0);
+ break;
+ }
+ mCharacterTypeComboBox->setValue(characterType);
+
+ updatePathTestStatus();
}
void LLFloaterPathfindingConsole::setDefaultInputs()
{
- mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX);
- setRenderWorld(TRUE);
- setRenderWorldMovablesOnly(FALSE);
- setRenderNavMesh(FALSE);
- setRenderWalkables(FALSE);
- setRenderMaterialVolumes(FALSE);
- setRenderStaticObstacles(FALSE);
- setRenderExclusionVolumes(FALSE);
- setRenderWaterPlane(FALSE);
- setRenderXRay(FALSE);
+ mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX);
+ setRenderWorld(TRUE);
+ setRenderWorldMovablesOnly(FALSE);
+ setRenderNavMesh(FALSE);
+ setRenderWalkables(FALSE);
+ setRenderMaterialVolumes(FALSE);
+ setRenderStaticObstacles(FALSE);
+ setRenderExclusionVolumes(FALSE);
+ setRenderWaterPlane(FALSE);
+ setRenderXRay(FALSE);
}
void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState)
{
- mConsoleState = pConsoleState;
- updateControlsOnConsoleState();
- updateViewerStatusOnConsoleState();
- updateSimulatorStatusOnConsoleState();
+ mConsoleState = pConsoleState;
+ updateControlsOnConsoleState();
+ updateViewerStatusOnConsoleState();
+ updateSimulatorStatusOnConsoleState();
}
void LLFloaterPathfindingConsole::setWorldRenderState()
{
- BOOL renderWorld = isRenderWorld();
+ BOOL renderWorld = isRenderWorld();
- mShowWorldMovablesOnlyCheckBox->setEnabled(renderWorld && mShowWorldCheckBox->getEnabled());
- if (!renderWorld)
- {
- mShowWorldMovablesOnlyCheckBox->set(FALSE);
- }
+ mShowWorldMovablesOnlyCheckBox->setEnabled(renderWorld && mShowWorldCheckBox->getEnabled());
+ if (!renderWorld)
+ {
+ mShowWorldMovablesOnlyCheckBox->set(FALSE);
+ }
}
void LLFloaterPathfindingConsole::setNavMeshRenderState()
{
- BOOL renderNavMesh = isRenderNavMesh();
+ BOOL renderNavMesh = isRenderNavMesh();
- mShowNavMeshWalkabilityLabel->setEnabled(renderNavMesh);
- mShowNavMeshWalkabilityComboBox->setEnabled(renderNavMesh);
+ mShowNavMeshWalkabilityLabel->setEnabled(renderNavMesh);
+ mShowNavMeshWalkabilityComboBox->setEnabled(renderNavMesh);
}
void LLFloaterPathfindingConsole::updateRenderablesObjects()
{
- if ( isRenderWorldMovablesOnly() )
- {
- gPipeline.hidePermanentObjects( mRenderableRestoreList );
- }
- else
- {
- cleanupRenderableRestoreItems();
- }
+ if ( isRenderWorldMovablesOnly() )
+ {
+ gPipeline.hidePermanentObjects( mRenderableRestoreList );
+ }
+ else
+ {
+ cleanupRenderableRestoreItems();
+ }
}
void LLFloaterPathfindingConsole::updateControlsOnConsoleState()
{
- switch (mConsoleState)
- {
- case kConsoleStateUnknown :
- case kConsoleStateRegionNotEnabled :
- case kConsoleStateRegionLoading :
- mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX);
- mViewTab->setEnabled(FALSE);
- mShowLabel->setEnabled(FALSE);
- mShowWorldCheckBox->setEnabled(FALSE);
- mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE);
- mShowNavMeshCheckBox->setEnabled(FALSE);
- mShowNavMeshWalkabilityLabel->setEnabled(FALSE);
- mShowNavMeshWalkabilityComboBox->setEnabled(FALSE);
- mShowWalkablesCheckBox->setEnabled(FALSE);
- mShowStaticObstaclesCheckBox->setEnabled(FALSE);
- mShowMaterialVolumesCheckBox->setEnabled(FALSE);
- mShowExclusionVolumesCheckBox->setEnabled(FALSE);
- mShowRenderWaterPlaneCheckBox->setEnabled(FALSE);
- mShowXRayCheckBox->setEnabled(FALSE);
- mTestTab->setEnabled(FALSE);
- mCtrlClickLabel->setEnabled(FALSE);
- mShiftClickLabel->setEnabled(FALSE);
- mCharacterWidthLabel->setEnabled(FALSE);
- mCharacterWidthUnitLabel->setEnabled(FALSE);
- mCharacterWidthSlider->setEnabled(FALSE);
- mCharacterTypeLabel->setEnabled(FALSE);
- mCharacterTypeComboBox->setEnabled(FALSE);
- mClearPathButton->setEnabled(FALSE);
- clearPath();
- break;
- case kConsoleStateLibraryNotImplemented :
- mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX);
- mViewTab->setEnabled(FALSE);
- mShowLabel->setEnabled(FALSE);
- mShowWorldCheckBox->setEnabled(FALSE);
- mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE);
- mShowNavMeshCheckBox->setEnabled(FALSE);
- mShowNavMeshWalkabilityLabel->setEnabled(FALSE);
- mShowNavMeshWalkabilityComboBox->setEnabled(FALSE);
- mShowWalkablesCheckBox->setEnabled(FALSE);
- mShowStaticObstaclesCheckBox->setEnabled(FALSE);
- mShowMaterialVolumesCheckBox->setEnabled(FALSE);
- mShowExclusionVolumesCheckBox->setEnabled(FALSE);
- mShowRenderWaterPlaneCheckBox->setEnabled(FALSE);
- mShowXRayCheckBox->setEnabled(FALSE);
- mTestTab->setEnabled(FALSE);
- mCtrlClickLabel->setEnabled(FALSE);
- mShiftClickLabel->setEnabled(FALSE);
- mCharacterWidthLabel->setEnabled(FALSE);
- mCharacterWidthUnitLabel->setEnabled(FALSE);
- mCharacterWidthSlider->setEnabled(FALSE);
- mCharacterTypeLabel->setEnabled(FALSE);
- mCharacterTypeComboBox->setEnabled(FALSE);
- mClearPathButton->setEnabled(FALSE);
- clearPath();
- break;
- case kConsoleStateCheckingVersion :
- case kConsoleStateDownloading :
- case kConsoleStateError :
- mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX);
- mViewTab->setEnabled(FALSE);
- mShowLabel->setEnabled(FALSE);
- mShowWorldCheckBox->setEnabled(FALSE);
- mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE);
- mShowNavMeshCheckBox->setEnabled(FALSE);
- mShowNavMeshWalkabilityLabel->setEnabled(FALSE);
- mShowNavMeshWalkabilityComboBox->setEnabled(FALSE);
- mShowWalkablesCheckBox->setEnabled(FALSE);
- mShowStaticObstaclesCheckBox->setEnabled(FALSE);
- mShowMaterialVolumesCheckBox->setEnabled(FALSE);
- mShowExclusionVolumesCheckBox->setEnabled(FALSE);
- mShowRenderWaterPlaneCheckBox->setEnabled(FALSE);
- mShowXRayCheckBox->setEnabled(FALSE);
- mTestTab->setEnabled(FALSE);
- mCtrlClickLabel->setEnabled(FALSE);
- mShiftClickLabel->setEnabled(FALSE);
- mCharacterWidthLabel->setEnabled(FALSE);
- mCharacterWidthUnitLabel->setEnabled(FALSE);
- mCharacterWidthSlider->setEnabled(FALSE);
- mCharacterTypeLabel->setEnabled(FALSE);
- mCharacterTypeComboBox->setEnabled(FALSE);
- mClearPathButton->setEnabled(FALSE);
- clearPath();
- break;
- case kConsoleStateHasNavMesh :
- mViewTab->setEnabled(TRUE);
- mShowLabel->setEnabled(TRUE);
- mShowWorldCheckBox->setEnabled(TRUE);
- setWorldRenderState();
- mShowNavMeshCheckBox->setEnabled(TRUE);
- setNavMeshRenderState();
- mShowWalkablesCheckBox->setEnabled(TRUE);
- mShowStaticObstaclesCheckBox->setEnabled(TRUE);
- mShowMaterialVolumesCheckBox->setEnabled(TRUE);
- mShowExclusionVolumesCheckBox->setEnabled(TRUE);
- mShowRenderWaterPlaneCheckBox->setEnabled(TRUE);
- mShowXRayCheckBox->setEnabled(TRUE);
- mTestTab->setEnabled(TRUE);
- mCtrlClickLabel->setEnabled(TRUE);
- mShiftClickLabel->setEnabled(TRUE);
- mCharacterWidthLabel->setEnabled(TRUE);
- mCharacterWidthUnitLabel->setEnabled(TRUE);
- mCharacterWidthSlider->setEnabled(TRUE);
- mCharacterTypeLabel->setEnabled(TRUE);
- mCharacterTypeComboBox->setEnabled(TRUE);
- mClearPathButton->setEnabled(TRUE);
- break;
- default :
- llassert(0);
- break;
- }
+ switch (mConsoleState)
+ {
+ case kConsoleStateUnknown :
+ case kConsoleStateRegionNotEnabled :
+ case kConsoleStateRegionLoading :
+ mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX);
+ mViewTab->setEnabled(FALSE);
+ mShowLabel->setEnabled(FALSE);
+ mShowWorldCheckBox->setEnabled(FALSE);
+ mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE);
+ mShowNavMeshCheckBox->setEnabled(FALSE);
+ mShowNavMeshWalkabilityLabel->setEnabled(FALSE);
+ mShowNavMeshWalkabilityComboBox->setEnabled(FALSE);
+ mShowWalkablesCheckBox->setEnabled(FALSE);
+ mShowStaticObstaclesCheckBox->setEnabled(FALSE);
+ mShowMaterialVolumesCheckBox->setEnabled(FALSE);
+ mShowExclusionVolumesCheckBox->setEnabled(FALSE);
+ mShowRenderWaterPlaneCheckBox->setEnabled(FALSE);
+ mShowXRayCheckBox->setEnabled(FALSE);
+ mTestTab->setEnabled(FALSE);
+ mCtrlClickLabel->setEnabled(FALSE);
+ mShiftClickLabel->setEnabled(FALSE);
+ mCharacterWidthLabel->setEnabled(FALSE);
+ mCharacterWidthUnitLabel->setEnabled(FALSE);
+ mCharacterWidthSlider->setEnabled(FALSE);
+ mCharacterTypeLabel->setEnabled(FALSE);
+ mCharacterTypeComboBox->setEnabled(FALSE);
+ mClearPathButton->setEnabled(FALSE);
+ clearPath();
+ break;
+ case kConsoleStateLibraryNotImplemented :
+ mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX);
+ mViewTab->setEnabled(FALSE);
+ mShowLabel->setEnabled(FALSE);
+ mShowWorldCheckBox->setEnabled(FALSE);
+ mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE);
+ mShowNavMeshCheckBox->setEnabled(FALSE);
+ mShowNavMeshWalkabilityLabel->setEnabled(FALSE);
+ mShowNavMeshWalkabilityComboBox->setEnabled(FALSE);
+ mShowWalkablesCheckBox->setEnabled(FALSE);
+ mShowStaticObstaclesCheckBox->setEnabled(FALSE);
+ mShowMaterialVolumesCheckBox->setEnabled(FALSE);
+ mShowExclusionVolumesCheckBox->setEnabled(FALSE);
+ mShowRenderWaterPlaneCheckBox->setEnabled(FALSE);
+ mShowXRayCheckBox->setEnabled(FALSE);
+ mTestTab->setEnabled(FALSE);
+ mCtrlClickLabel->setEnabled(FALSE);
+ mShiftClickLabel->setEnabled(FALSE);
+ mCharacterWidthLabel->setEnabled(FALSE);
+ mCharacterWidthUnitLabel->setEnabled(FALSE);
+ mCharacterWidthSlider->setEnabled(FALSE);
+ mCharacterTypeLabel->setEnabled(FALSE);
+ mCharacterTypeComboBox->setEnabled(FALSE);
+ mClearPathButton->setEnabled(FALSE);
+ clearPath();
+ break;
+ case kConsoleStateCheckingVersion :
+ case kConsoleStateDownloading :
+ case kConsoleStateError :
+ mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX);
+ mViewTab->setEnabled(FALSE);
+ mShowLabel->setEnabled(FALSE);
+ mShowWorldCheckBox->setEnabled(FALSE);
+ mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE);
+ mShowNavMeshCheckBox->setEnabled(FALSE);
+ mShowNavMeshWalkabilityLabel->setEnabled(FALSE);
+ mShowNavMeshWalkabilityComboBox->setEnabled(FALSE);
+ mShowWalkablesCheckBox->setEnabled(FALSE);
+ mShowStaticObstaclesCheckBox->setEnabled(FALSE);
+ mShowMaterialVolumesCheckBox->setEnabled(FALSE);
+ mShowExclusionVolumesCheckBox->setEnabled(FALSE);
+ mShowRenderWaterPlaneCheckBox->setEnabled(FALSE);
+ mShowXRayCheckBox->setEnabled(FALSE);
+ mTestTab->setEnabled(FALSE);
+ mCtrlClickLabel->setEnabled(FALSE);
+ mShiftClickLabel->setEnabled(FALSE);
+ mCharacterWidthLabel->setEnabled(FALSE);
+ mCharacterWidthUnitLabel->setEnabled(FALSE);
+ mCharacterWidthSlider->setEnabled(FALSE);
+ mCharacterTypeLabel->setEnabled(FALSE);
+ mCharacterTypeComboBox->setEnabled(FALSE);
+ mClearPathButton->setEnabled(FALSE);
+ clearPath();
+ break;
+ case kConsoleStateHasNavMesh :
+ mViewTab->setEnabled(TRUE);
+ mShowLabel->setEnabled(TRUE);
+ mShowWorldCheckBox->setEnabled(TRUE);
+ setWorldRenderState();
+ mShowNavMeshCheckBox->setEnabled(TRUE);
+ setNavMeshRenderState();
+ mShowWalkablesCheckBox->setEnabled(TRUE);
+ mShowStaticObstaclesCheckBox->setEnabled(TRUE);
+ mShowMaterialVolumesCheckBox->setEnabled(TRUE);
+ mShowExclusionVolumesCheckBox->setEnabled(TRUE);
+ mShowRenderWaterPlaneCheckBox->setEnabled(TRUE);
+ mShowXRayCheckBox->setEnabled(TRUE);
+ mTestTab->setEnabled(TRUE);
+ mCtrlClickLabel->setEnabled(TRUE);
+ mShiftClickLabel->setEnabled(TRUE);
+ mCharacterWidthLabel->setEnabled(TRUE);
+ mCharacterWidthUnitLabel->setEnabled(TRUE);
+ mCharacterWidthSlider->setEnabled(TRUE);
+ mCharacterTypeLabel->setEnabled(TRUE);
+ mCharacterTypeComboBox->setEnabled(TRUE);
+ mClearPathButton->setEnabled(TRUE);
+ break;
+ default :
+ llassert(0);
+ break;
+ }
}
void LLFloaterPathfindingConsole::updateViewerStatusOnConsoleState()
{
- std::string viewerStatusText("");
- LLStyle::Params viewerStyleParams;
-
- switch (mConsoleState)
- {
- case kConsoleStateUnknown :
- viewerStatusText = getString("navmesh_viewer_status_unknown");
- viewerStyleParams.color = mErrorColor;
- break;
- case kConsoleStateLibraryNotImplemented :
- viewerStatusText = getString("navmesh_viewer_status_library_not_implemented");
- viewerStyleParams.color = mErrorColor;
- break;
- case kConsoleStateRegionNotEnabled :
- viewerStatusText = getString("navmesh_viewer_status_region_not_enabled");
- viewerStyleParams.color = mErrorColor;
- break;
- case kConsoleStateRegionLoading :
- viewerStatusText = getString("navmesh_viewer_status_region_loading");
- viewerStyleParams.color = mWarningColor;
- break;
- case kConsoleStateCheckingVersion :
- viewerStatusText = getString("navmesh_viewer_status_checking_version");
- viewerStyleParams.color = mWarningColor;
- break;
- case kConsoleStateDownloading :
- if (mIsNavMeshUpdating)
- {
- viewerStatusText = getString("navmesh_viewer_status_updating");
- }
- else
- {
- viewerStatusText = getString("navmesh_viewer_status_downloading");
- }
- viewerStyleParams.color = mWarningColor;
- break;
- case kConsoleStateHasNavMesh :
- viewerStatusText = getString("navmesh_viewer_status_has_navmesh");
- break;
- case kConsoleStateError :
- viewerStatusText = getString("navmesh_viewer_status_error");
- viewerStyleParams.color = mErrorColor;
- break;
- default :
- viewerStatusText = getString("navmesh_viewer_status_unknown");
- viewerStyleParams.color = mErrorColor;
- llassert(0);
- break;
- }
-
- mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams);
+ std::string viewerStatusText("");
+ LLStyle::Params viewerStyleParams;
+
+ switch (mConsoleState)
+ {
+ case kConsoleStateUnknown :
+ viewerStatusText = getString("navmesh_viewer_status_unknown");
+ viewerStyleParams.color = mErrorColor;
+ break;
+ case kConsoleStateLibraryNotImplemented :
+ viewerStatusText = getString("navmesh_viewer_status_library_not_implemented");
+ viewerStyleParams.color = mErrorColor;
+ break;
+ case kConsoleStateRegionNotEnabled :
+ viewerStatusText = getString("navmesh_viewer_status_region_not_enabled");
+ viewerStyleParams.color = mErrorColor;
+ break;
+ case kConsoleStateRegionLoading :
+ viewerStatusText = getString("navmesh_viewer_status_region_loading");
+ viewerStyleParams.color = mWarningColor;
+ break;
+ case kConsoleStateCheckingVersion :
+ viewerStatusText = getString("navmesh_viewer_status_checking_version");
+ viewerStyleParams.color = mWarningColor;
+ break;
+ case kConsoleStateDownloading :
+ if (mIsNavMeshUpdating)
+ {
+ viewerStatusText = getString("navmesh_viewer_status_updating");
+ }
+ else
+ {
+ viewerStatusText = getString("navmesh_viewer_status_downloading");
+ }
+ viewerStyleParams.color = mWarningColor;
+ break;
+ case kConsoleStateHasNavMesh :
+ viewerStatusText = getString("navmesh_viewer_status_has_navmesh");
+ break;
+ case kConsoleStateError :
+ viewerStatusText = getString("navmesh_viewer_status_error");
+ viewerStyleParams.color = mErrorColor;
+ break;
+ default :
+ viewerStatusText = getString("navmesh_viewer_status_unknown");
+ viewerStyleParams.color = mErrorColor;
+ llassert(0);
+ break;
+ }
+
+ mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams);
}
void LLFloaterPathfindingConsole::updateSimulatorStatusOnConsoleState()
{
- std::string simulatorStatusText("");
- LLStyle::Params simulatorStyleParams;
-
- switch (mConsoleState)
- {
- case kConsoleStateUnknown :
- case kConsoleStateLibraryNotImplemented :
- case kConsoleStateRegionNotEnabled :
- case kConsoleStateRegionLoading :
- case kConsoleStateCheckingVersion :
- case kConsoleStateError :
- simulatorStatusText = getString("navmesh_simulator_status_unknown");
- simulatorStyleParams.color = mErrorColor;
- break;
- case kConsoleStateDownloading :
- case kConsoleStateHasNavMesh :
- switch (mNavMeshZone.getNavMeshZoneStatus())
- {
- case LLPathfindingNavMeshZone::kNavMeshZonePending :
- simulatorStatusText = getString("navmesh_simulator_status_pending");
- simulatorStyleParams.color = mWarningColor;
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneBuilding :
- simulatorStatusText = getString("navmesh_simulator_status_building");
- simulatorStyleParams.color = mWarningColor;
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneSomePending :
- simulatorStatusText = getString("navmesh_simulator_status_some_pending");
- simulatorStyleParams.color = mWarningColor;
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding :
- simulatorStatusText = getString("navmesh_simulator_status_some_building");
- simulatorStyleParams.color = mWarningColor;
- break;
- case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding :
- simulatorStatusText = getString("navmesh_simulator_status_pending_and_building");
- simulatorStyleParams.color = mWarningColor;
- break;
- case LLPathfindingNavMeshZone::kNavMeshZoneComplete :
- simulatorStatusText = getString("navmesh_simulator_status_complete");
- break;
- default :
- simulatorStatusText = getString("navmesh_simulator_status_unknown");
- simulatorStyleParams.color = mErrorColor;
- break;
- }
- break;
- default :
- simulatorStatusText = getString("navmesh_simulator_status_unknown");
- simulatorStyleParams.color = mErrorColor;
- llassert(0);
- break;
- }
-
- mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText, simulatorStyleParams);
+ std::string simulatorStatusText("");
+ LLStyle::Params simulatorStyleParams;
+
+ switch (mConsoleState)
+ {
+ case kConsoleStateUnknown :
+ case kConsoleStateLibraryNotImplemented :
+ case kConsoleStateRegionNotEnabled :
+ case kConsoleStateRegionLoading :
+ case kConsoleStateCheckingVersion :
+ case kConsoleStateError :
+ simulatorStatusText = getString("navmesh_simulator_status_unknown");
+ simulatorStyleParams.color = mErrorColor;
+ break;
+ case kConsoleStateDownloading :
+ case kConsoleStateHasNavMesh :
+ switch (mNavMeshZone.getNavMeshZoneStatus())
+ {
+ case LLPathfindingNavMeshZone::kNavMeshZonePending :
+ simulatorStatusText = getString("navmesh_simulator_status_pending");
+ simulatorStyleParams.color = mWarningColor;
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneBuilding :
+ simulatorStatusText = getString("navmesh_simulator_status_building");
+ simulatorStyleParams.color = mWarningColor;
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneSomePending :
+ simulatorStatusText = getString("navmesh_simulator_status_some_pending");
+ simulatorStyleParams.color = mWarningColor;
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding :
+ simulatorStatusText = getString("navmesh_simulator_status_some_building");
+ simulatorStyleParams.color = mWarningColor;
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding :
+ simulatorStatusText = getString("navmesh_simulator_status_pending_and_building");
+ simulatorStyleParams.color = mWarningColor;
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneComplete :
+ simulatorStatusText = getString("navmesh_simulator_status_complete");
+ break;
+ default :
+ simulatorStatusText = getString("navmesh_simulator_status_unknown");
+ simulatorStyleParams.color = mErrorColor;
+ break;
+ }
+ break;
+ default :
+ simulatorStatusText = getString("navmesh_simulator_status_unknown");
+ simulatorStyleParams.color = mErrorColor;
+ llassert(0);
+ break;
+ }
+
+ mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText, simulatorStyleParams);
}
void LLFloaterPathfindingConsole::initializeNavMeshZoneForCurrentRegion()
{
- mNavMeshZone.disable();
- mNavMeshZone.initialize();
- mNavMeshZone.enable();
- mNavMeshZone.refresh();
- cleanupRenderableRestoreItems();
+ mNavMeshZone.disable();
+ mNavMeshZone.initialize();
+ mNavMeshZone.enable();
+ mNavMeshZone.refresh();
+ cleanupRenderableRestoreItems();
}
void LLFloaterPathfindingConsole::cleanupRenderableRestoreItems()
{
- if ( !mRenderableRestoreList.empty() )
- {
- gPipeline.restorePermanentObjects( mRenderableRestoreList );
- mRenderableRestoreList.clear();
- }
- else
- {
- gPipeline.skipRenderingOfTerrain( false );
- }
+ if ( !mRenderableRestoreList.empty() )
+ {
+ gPipeline.restorePermanentObjects( mRenderableRestoreList );
+ mRenderableRestoreList.clear();
+ }
+ else
+ {
+ gPipeline.skipRenderingOfTerrain( false );
+ }
}
void LLFloaterPathfindingConsole::switchIntoTestPathMode()
{
- if (LLPathingLib::getInstance() != NULL)
- {
- llassert(mPathfindingToolset != NULL);
- LLToolMgr *toolMgrInstance = LLToolMgr::getInstance();
- if (toolMgrInstance->getCurrentToolset() != mPathfindingToolset)
- {
- mSavedToolset = toolMgrInstance->getCurrentToolset();
- toolMgrInstance->setCurrentToolset(mPathfindingToolset);
- }
- }
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ llassert(mPathfindingToolset != NULL);
+ LLToolMgr *toolMgrInstance = LLToolMgr::getInstance();
+ if (toolMgrInstance->getCurrentToolset() != mPathfindingToolset)
+ {
+ mSavedToolset = toolMgrInstance->getCurrentToolset();
+ toolMgrInstance->setCurrentToolset(mPathfindingToolset);
+ }
+ }
}
void LLFloaterPathfindingConsole::switchOutOfTestPathMode()
{
- if (LLPathingLib::getInstance() != NULL)
- {
- llassert(mPathfindingToolset != NULL);
- LLToolMgr *toolMgrInstance = LLToolMgr::getInstance();
- if (toolMgrInstance->getCurrentToolset() == mPathfindingToolset)
- {
- toolMgrInstance->setCurrentToolset(mSavedToolset);
- mSavedToolset = NULL;
- }
- }
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ llassert(mPathfindingToolset != NULL);
+ LLToolMgr *toolMgrInstance = LLToolMgr::getInstance();
+ if (toolMgrInstance->getCurrentToolset() == mPathfindingToolset)
+ {
+ toolMgrInstance->setCurrentToolset(mSavedToolset);
+ mSavedToolset = NULL;
+ }
+ }
}
void LLFloaterPathfindingConsole::updateCharacterWidth()
{
- LLPathfindingPathTool::getInstance()->setCharacterWidth(mCharacterWidthSlider->getValueF32());
+ LLPathfindingPathTool::getInstance()->setCharacterWidth(mCharacterWidthSlider->getValueF32());
}
void LLFloaterPathfindingConsole::updateCharacterType()
{
- LLPathfindingPathTool::ECharacterType characterType;
-
- switch (mCharacterTypeComboBox->getValue().asInteger())
- {
- case XUI_CHARACTER_TYPE_NONE :
- characterType = LLPathfindingPathTool::kCharacterTypeNone;
- break;
- case XUI_CHARACTER_TYPE_A :
- characterType = LLPathfindingPathTool::kCharacterTypeA;
- break;
- case XUI_CHARACTER_TYPE_B :
- characterType = LLPathfindingPathTool::kCharacterTypeB;
- break;
- case XUI_CHARACTER_TYPE_C :
- characterType = LLPathfindingPathTool::kCharacterTypeC;
- break;
- case XUI_CHARACTER_TYPE_D :
- characterType = LLPathfindingPathTool::kCharacterTypeD;
- break;
- default :
- characterType = LLPathfindingPathTool::kCharacterTypeNone;
- llassert(0);
- break;
- }
-
- LLPathfindingPathTool::getInstance()->setCharacterType(characterType);
+ LLPathfindingPathTool::ECharacterType characterType;
+
+ switch (mCharacterTypeComboBox->getValue().asInteger())
+ {
+ case XUI_CHARACTER_TYPE_NONE :
+ characterType = LLPathfindingPathTool::kCharacterTypeNone;
+ break;
+ case XUI_CHARACTER_TYPE_A :
+ characterType = LLPathfindingPathTool::kCharacterTypeA;
+ break;
+ case XUI_CHARACTER_TYPE_B :
+ characterType = LLPathfindingPathTool::kCharacterTypeB;
+ break;
+ case XUI_CHARACTER_TYPE_C :
+ characterType = LLPathfindingPathTool::kCharacterTypeC;
+ break;
+ case XUI_CHARACTER_TYPE_D :
+ characterType = LLPathfindingPathTool::kCharacterTypeD;
+ break;
+ default :
+ characterType = LLPathfindingPathTool::kCharacterTypeNone;
+ llassert(0);
+ break;
+ }
+
+ LLPathfindingPathTool::getInstance()->setCharacterType(characterType);
}
void LLFloaterPathfindingConsole::clearPath()
{
- LLPathfindingPathTool::getInstance()->clearPath();
+ LLPathfindingPathTool::getInstance()->clearPath();
}
void LLFloaterPathfindingConsole::updatePathTestStatus()
{
- std::string statusText("");
- LLStyle::Params styleParams;
-
- switch (LLPathfindingPathTool::getInstance()->getPathStatus())
- {
- case LLPathfindingPathTool::kPathStatusUnknown :
- statusText = getString("pathing_unknown");
- styleParams.color = mErrorColor;
- break;
- case LLPathfindingPathTool::kPathStatusChooseStartAndEndPoints :
- statusText = getString("pathing_choose_start_and_end_points");
- styleParams.color = mWarningColor;
- break;
- case LLPathfindingPathTool::kPathStatusChooseStartPoint :
- statusText = getString("pathing_choose_start_point");
- styleParams.color = mWarningColor;
- break;
- case LLPathfindingPathTool::kPathStatusChooseEndPoint :
- statusText = getString("pathing_choose_end_point");
- styleParams.color = mWarningColor;
- break;
- case LLPathfindingPathTool::kPathStatusHasValidPath :
- statusText = getString("pathing_path_valid");
- break;
- case LLPathfindingPathTool::kPathStatusHasInvalidPath :
- statusText = getString("pathing_path_invalid");
- styleParams.color = mErrorColor;
- break;
- case LLPathfindingPathTool::kPathStatusNotEnabled :
- statusText = getString("pathing_region_not_enabled");
- styleParams.color = mErrorColor;
- break;
- case LLPathfindingPathTool::kPathStatusNotImplemented :
- statusText = getString("pathing_library_not_implemented");
- styleParams.color = mErrorColor;
- break;
- case LLPathfindingPathTool::kPathStatusError :
- statusText = getString("pathing_error");
- styleParams.color = mErrorColor;
- break;
- default :
- statusText = getString("pathing_unknown");
- styleParams.color = mErrorColor;
- break;
- }
-
- mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams);
+ std::string statusText("");
+ LLStyle::Params styleParams;
+
+ switch (LLPathfindingPathTool::getInstance()->getPathStatus())
+ {
+ case LLPathfindingPathTool::kPathStatusUnknown :
+ statusText = getString("pathing_unknown");
+ styleParams.color = mErrorColor;
+ break;
+ case LLPathfindingPathTool::kPathStatusChooseStartAndEndPoints :
+ statusText = getString("pathing_choose_start_and_end_points");
+ styleParams.color = mWarningColor;
+ break;
+ case LLPathfindingPathTool::kPathStatusChooseStartPoint :
+ statusText = getString("pathing_choose_start_point");
+ styleParams.color = mWarningColor;
+ break;
+ case LLPathfindingPathTool::kPathStatusChooseEndPoint :
+ statusText = getString("pathing_choose_end_point");
+ styleParams.color = mWarningColor;
+ break;
+ case LLPathfindingPathTool::kPathStatusHasValidPath :
+ statusText = getString("pathing_path_valid");
+ break;
+ case LLPathfindingPathTool::kPathStatusHasInvalidPath :
+ statusText = getString("pathing_path_invalid");
+ styleParams.color = mErrorColor;
+ break;
+ case LLPathfindingPathTool::kPathStatusNotEnabled :
+ statusText = getString("pathing_region_not_enabled");
+ styleParams.color = mErrorColor;
+ break;
+ case LLPathfindingPathTool::kPathStatusNotImplemented :
+ statusText = getString("pathing_library_not_implemented");
+ styleParams.color = mErrorColor;
+ break;
+ case LLPathfindingPathTool::kPathStatusError :
+ statusText = getString("pathing_error");
+ styleParams.color = mErrorColor;
+ break;
+ default :
+ statusText = getString("pathing_unknown");
+ styleParams.color = mErrorColor;
+ break;
+ }
+
+ mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams);
}
BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const
{
- return (isRenderWalkables() || isRenderStaticObstacles() ||
- isRenderMaterialVolumes() || isRenderExclusionVolumes());
+ return (isRenderWalkables() || isRenderStaticObstacles() ||
+ isRenderMaterialVolumes() || isRenderExclusionVolumes());
}
U32 LLFloaterPathfindingConsole::getRenderShapeFlags()
{
- U32 shapeRenderFlag = 0U;
-
- if (isRenderWalkables())
- {
- SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_WalkableObjects);
- }
- if (isRenderStaticObstacles())
- {
- SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ObstacleObjects);
- }
- if (isRenderMaterialVolumes())
- {
- SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_MaterialPhantoms);
- }
- if (isRenderExclusionVolumes())
- {
- SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ExclusionPhantoms);
- }
-
- return shapeRenderFlag;
+ U32 shapeRenderFlag = 0U;
+
+ if (isRenderWalkables())
+ {
+ SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_WalkableObjects);
+ }
+ if (isRenderStaticObstacles())
+ {
+ SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ObstacleObjects);
+ }
+ if (isRenderMaterialVolumes())
+ {
+ SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_MaterialPhantoms);
+ }
+ if (isRenderExclusionVolumes())
+ {
+ SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ExclusionPhantoms);
+ }
+
+ return shapeRenderFlag;
}
void LLFloaterPathfindingConsole::registerSavedSettingsListeners()
{
- if (!mSavedSettingRetrieveNeighborSlot.connected())
- {
- mSavedSettingRetrieveNeighborSlot = gSavedSettings.getControl(CONTROL_NAME_RETRIEVE_NEIGHBOR)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleRetrieveNeighborChange, this, _1, _2));
- }
- if (!mSavedSettingWalkableSlot.connected())
- {
- mSavedSettingWalkableSlot = gSavedSettings.getControl(CONTROL_NAME_WALKABLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingStaticObstacleSlot.connected())
- {
- mSavedSettingStaticObstacleSlot = gSavedSettings.getControl(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingMaterialVolumeSlot.connected())
- {
- mSavedSettingMaterialVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_MATERIAL_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingExclusionVolumeSlot.connected())
- {
- mSavedSettingExclusionVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_EXCLUSION_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingInteriorEdgeSlot.connected())
- {
- mSavedSettingInteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_INTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingExteriorEdgeSlot.connected())
- {
- mSavedSettingExteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_EXTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingHeatmapMinSlot.connected())
- {
- mSavedSettingHeatmapMinSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MIN)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingHeatmapMaxSlot.connected())
- {
- mSavedSettingHeatmapMaxSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MAX)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingNavMeshFaceSlot.connected())
- {
- mSavedSettingNavMeshFaceSlot = gSavedSettings.getControl(CONTROL_NAME_NAVMESH_FACE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingTestPathValidEndSlot.connected())
- {
- mSavedSettingTestPathValidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_VALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingTestPathInvalidEndSlot.connected())
- {
- mSavedSettingTestPathInvalidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_INVALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingTestPathSlot.connected())
- {
- mSavedSettingTestPathSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
- if (!mSavedSettingWaterSlot.connected())
- {
- mSavedSettingWaterSlot = gSavedSettings.getControl(CONTROL_NAME_WATER)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
- }
+ if (!mSavedSettingRetrieveNeighborSlot.connected())
+ {
+ mSavedSettingRetrieveNeighborSlot = gSavedSettings.getControl(CONTROL_NAME_RETRIEVE_NEIGHBOR)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleRetrieveNeighborChange, this, _1, _2));
+ }
+ if (!mSavedSettingWalkableSlot.connected())
+ {
+ mSavedSettingWalkableSlot = gSavedSettings.getControl(CONTROL_NAME_WALKABLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingStaticObstacleSlot.connected())
+ {
+ mSavedSettingStaticObstacleSlot = gSavedSettings.getControl(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingMaterialVolumeSlot.connected())
+ {
+ mSavedSettingMaterialVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_MATERIAL_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingExclusionVolumeSlot.connected())
+ {
+ mSavedSettingExclusionVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_EXCLUSION_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingInteriorEdgeSlot.connected())
+ {
+ mSavedSettingInteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_INTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingExteriorEdgeSlot.connected())
+ {
+ mSavedSettingExteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_EXTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingHeatmapMinSlot.connected())
+ {
+ mSavedSettingHeatmapMinSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MIN)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingHeatmapMaxSlot.connected())
+ {
+ mSavedSettingHeatmapMaxSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MAX)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingNavMeshFaceSlot.connected())
+ {
+ mSavedSettingNavMeshFaceSlot = gSavedSettings.getControl(CONTROL_NAME_NAVMESH_FACE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingTestPathValidEndSlot.connected())
+ {
+ mSavedSettingTestPathValidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_VALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingTestPathInvalidEndSlot.connected())
+ {
+ mSavedSettingTestPathInvalidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_INVALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingTestPathSlot.connected())
+ {
+ mSavedSettingTestPathSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
+ if (!mSavedSettingWaterSlot.connected())
+ {
+ mSavedSettingWaterSlot = gSavedSettings.getControl(CONTROL_NAME_WATER)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
+ }
}
void LLFloaterPathfindingConsole::deregisterSavedSettingsListeners()
{
- if (mSavedSettingRetrieveNeighborSlot.connected())
- {
- mSavedSettingRetrieveNeighborSlot.disconnect();
- }
- if (mSavedSettingWalkableSlot.connected())
- {
- mSavedSettingWalkableSlot.disconnect();
- }
- if (mSavedSettingStaticObstacleSlot.connected())
- {
- mSavedSettingStaticObstacleSlot.disconnect();
- }
- if (mSavedSettingMaterialVolumeSlot.connected())
- {
- mSavedSettingMaterialVolumeSlot.disconnect();
- }
- if (mSavedSettingExclusionVolumeSlot.connected())
- {
- mSavedSettingExclusionVolumeSlot.disconnect();
- }
- if (mSavedSettingInteriorEdgeSlot.connected())
- {
- mSavedSettingInteriorEdgeSlot.disconnect();
- }
- if (mSavedSettingExteriorEdgeSlot.connected())
- {
- mSavedSettingExteriorEdgeSlot.disconnect();
- }
- if (mSavedSettingHeatmapMinSlot.connected())
- {
- mSavedSettingHeatmapMinSlot.disconnect();
- }
- if (mSavedSettingHeatmapMaxSlot.connected())
- {
- mSavedSettingHeatmapMaxSlot.disconnect();
- }
- if (mSavedSettingNavMeshFaceSlot.connected())
- {
- mSavedSettingNavMeshFaceSlot.disconnect();
- }
- if (mSavedSettingTestPathValidEndSlot.connected())
- {
- mSavedSettingTestPathValidEndSlot.disconnect();
- }
- if (mSavedSettingTestPathInvalidEndSlot.connected())
- {
- mSavedSettingTestPathInvalidEndSlot.disconnect();
- }
- if (mSavedSettingTestPathSlot.connected())
- {
- mSavedSettingTestPathSlot.disconnect();
- }
- if (mSavedSettingWaterSlot.connected())
- {
- mSavedSettingWaterSlot.disconnect();
- }
+ if (mSavedSettingRetrieveNeighborSlot.connected())
+ {
+ mSavedSettingRetrieveNeighborSlot.disconnect();
+ }
+ if (mSavedSettingWalkableSlot.connected())
+ {
+ mSavedSettingWalkableSlot.disconnect();
+ }
+ if (mSavedSettingStaticObstacleSlot.connected())
+ {
+ mSavedSettingStaticObstacleSlot.disconnect();
+ }
+ if (mSavedSettingMaterialVolumeSlot.connected())
+ {
+ mSavedSettingMaterialVolumeSlot.disconnect();
+ }
+ if (mSavedSettingExclusionVolumeSlot.connected())
+ {
+ mSavedSettingExclusionVolumeSlot.disconnect();
+ }
+ if (mSavedSettingInteriorEdgeSlot.connected())
+ {
+ mSavedSettingInteriorEdgeSlot.disconnect();
+ }
+ if (mSavedSettingExteriorEdgeSlot.connected())
+ {
+ mSavedSettingExteriorEdgeSlot.disconnect();
+ }
+ if (mSavedSettingHeatmapMinSlot.connected())
+ {
+ mSavedSettingHeatmapMinSlot.disconnect();
+ }
+ if (mSavedSettingHeatmapMaxSlot.connected())
+ {
+ mSavedSettingHeatmapMaxSlot.disconnect();
+ }
+ if (mSavedSettingNavMeshFaceSlot.connected())
+ {
+ mSavedSettingNavMeshFaceSlot.disconnect();
+ }
+ if (mSavedSettingTestPathValidEndSlot.connected())
+ {
+ mSavedSettingTestPathValidEndSlot.disconnect();
+ }
+ if (mSavedSettingTestPathInvalidEndSlot.connected())
+ {
+ mSavedSettingTestPathInvalidEndSlot.disconnect();
+ }
+ if (mSavedSettingTestPathSlot.connected())
+ {
+ mSavedSettingTestPathSlot.disconnect();
+ }
+ if (mSavedSettingWaterSlot.connected())
+ {
+ mSavedSettingWaterSlot.disconnect();
+ }
}
void LLFloaterPathfindingConsole::handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue)
{
- initializeNavMeshZoneForCurrentRegion();
+ initializeNavMeshZoneForCurrentRegion();
}
void LLFloaterPathfindingConsole::handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue)
{
- fillInColorsForNavMeshVisualization();
+ fillInColorsForNavMeshVisualization();
}
void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization()
{
- if (LLPathingLib::getInstance() != NULL)
- {
- LLPathingLib::NavMeshColors navMeshColors;
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::NavMeshColors navMeshColors;
- LLColor4 in = gSavedSettings.getColor4(CONTROL_NAME_WALKABLE_OBJECTS);
- navMeshColors.mWalkable= LLColor4U(in);
+ LLColor4 in = gSavedSettings.getColor4(CONTROL_NAME_WALKABLE_OBJECTS);
+ navMeshColors.mWalkable= LLColor4U(in);
- in = gSavedSettings.getColor4(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS);
- navMeshColors.mObstacle= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS);
+ navMeshColors.mObstacle= LLColor4U(in);
- in = gSavedSettings.getColor4(CONTROL_NAME_MATERIAL_VOLUMES);
- navMeshColors.mMaterial= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_MATERIAL_VOLUMES);
+ navMeshColors.mMaterial= LLColor4U(in);
- in = gSavedSettings.getColor4(CONTROL_NAME_EXCLUSION_VOLUMES);
- navMeshColors.mExclusion= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_EXCLUSION_VOLUMES);
+ navMeshColors.mExclusion= LLColor4U(in);
- in = gSavedSettings.getColor4(CONTROL_NAME_INTERIOR_EDGE);
- navMeshColors.mConnectedEdge= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_INTERIOR_EDGE);
+ navMeshColors.mConnectedEdge= LLColor4U(in);
- in = gSavedSettings.getColor4(CONTROL_NAME_EXTERIOR_EDGE);
- navMeshColors.mBoundaryEdge= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_EXTERIOR_EDGE);
+ navMeshColors.mBoundaryEdge= LLColor4U(in);
- navMeshColors.mHeatColorBase = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MIN);
+ navMeshColors.mHeatColorBase = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MIN);
- navMeshColors.mHeatColorMax = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MAX);
+ navMeshColors.mHeatColorMax = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MAX);
- in = gSavedSettings.getColor4(CONTROL_NAME_NAVMESH_FACE);
- navMeshColors.mFaceColor= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_NAVMESH_FACE);
+ navMeshColors.mFaceColor= LLColor4U(in);
- in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_VALID_END);
- navMeshColors.mStarValid= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_VALID_END);
+ navMeshColors.mStarValid= LLColor4U(in);
- in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_INVALID_END);
- navMeshColors.mStarInvalid= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_INVALID_END);
+ navMeshColors.mStarInvalid= LLColor4U(in);
- in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH);
- navMeshColors.mTestPath= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH);
+ navMeshColors.mTestPath= LLColor4U(in);
- in = gSavedSettings.getColor4(CONTROL_NAME_WATER);
- navMeshColors.mWaterColor= LLColor4U(in);
+ in = gSavedSettings.getColor4(CONTROL_NAME_WATER);
+ navMeshColors.mWaterColor= LLColor4U(in);
- LLPathingLib::getInstance()->setNavMeshColors(navMeshColors);
- }
+ LLPathingLib::getInstance()->setNavMeshColors(navMeshColors);
+ }
}
diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h
index e999e57741..42aee1ec46 100644
--- a/indra/newview/llfloaterpathfindingconsole.h
+++ b/indra/newview/llfloaterpathfindingconsole.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpathfindingconsole.h
* @brief "Pathfinding console" floater, allowing for viewing and testing of the pathfinding navmesh through Havok AI utilities.
* @author Stinson@lindenlab.com
@@ -50,171 +50,171 @@ class LLTextBase;
class LLToolset;
class LLFloaterPathfindingConsole
-: public LLFloater
+: public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- virtual BOOL postBuild();
- virtual void onOpen(const LLSD& pKey);
- virtual void onClose(bool pIsAppQuitting);
+ virtual BOOL postBuild();
+ virtual void onOpen(const LLSD& pKey);
+ virtual void onClose(bool pIsAppQuitting);
- static LLHandle<LLFloaterPathfindingConsole> getInstanceHandle();
+ static LLHandle<LLFloaterPathfindingConsole> getInstanceHandle();
- BOOL isRenderNavMesh() const;
- void setRenderNavMesh(BOOL pIsRenderNavMesh);
+ BOOL isRenderNavMesh() const;
+ void setRenderNavMesh(BOOL pIsRenderNavMesh);
- BOOL isRenderWalkables() const;
- void setRenderWalkables(BOOL pIsRenderWalkables);
+ BOOL isRenderWalkables() const;
+ void setRenderWalkables(BOOL pIsRenderWalkables);
- BOOL isRenderStaticObstacles() const;
- void setRenderStaticObstacles(BOOL pIsRenderStaticObstacles);
+ BOOL isRenderStaticObstacles() const;
+ void setRenderStaticObstacles(BOOL pIsRenderStaticObstacles);
- BOOL isRenderMaterialVolumes() const;
- void setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes);
+ BOOL isRenderMaterialVolumes() const;
+ void setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes);
- BOOL isRenderExclusionVolumes() const;
- void setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes);
+ BOOL isRenderExclusionVolumes() const;
+ void setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes);
- BOOL isRenderWorld() const;
- void setRenderWorld(BOOL pIsRenderWorld);
-
- BOOL isRenderWorldMovablesOnly() const;
- void setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly);
+ BOOL isRenderWorld() const;
+ void setRenderWorld(BOOL pIsRenderWorld);
- BOOL isRenderWaterPlane() const;
- void setRenderWaterPlane(BOOL pIsRenderWaterPlane);
-
- BOOL isRenderXRay() const;
- void setRenderXRay(BOOL pIsRenderXRay);
-
- BOOL isRenderAnyShapes() const;
- U32 getRenderShapeFlags();
+ BOOL isRenderWorldMovablesOnly() const;
+ void setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly);
- LLPathingLib::LLPLCharacterType getRenderHeatmapType() const;
- void setRenderHeatmapType(LLPathingLib::LLPLCharacterType pRenderHeatmapType);
- void onRegionBoundaryCross();
+ BOOL isRenderWaterPlane() const;
+ void setRenderWaterPlane(BOOL pIsRenderWaterPlane);
+
+ BOOL isRenderXRay() const;
+ void setRenderXRay(BOOL pIsRenderXRay);
+
+ BOOL isRenderAnyShapes() const;
+ U32 getRenderShapeFlags();
+
+ LLPathingLib::LLPLCharacterType getRenderHeatmapType() const;
+ void setRenderHeatmapType(LLPathingLib::LLPLCharacterType pRenderHeatmapType);
+ void onRegionBoundaryCross();
protected:
private:
- typedef enum
- {
- kConsoleStateUnknown,
- kConsoleStateLibraryNotImplemented,
- kConsoleStateRegionNotEnabled,
- kConsoleStateRegionLoading,
- kConsoleStateCheckingVersion,
- kConsoleStateDownloading,
- kConsoleStateHasNavMesh,
- kConsoleStateError
- } EConsoleState;
-
- // Does its own instance management, so clients not allowed
- // to allocate or destroy.
- LLFloaterPathfindingConsole(const LLSD& pSeed);
- virtual ~LLFloaterPathfindingConsole();
-
- void onTabSwitch();
- void onShowWorldSet();
- void onShowWorldMovablesOnlySet();
- void onShowNavMeshSet();
- void onShowWalkabilitySet();
- void onCharacterWidthSet();
- void onCharacterTypeSwitch();
- void onClearPathClicked();
-
- void handleNavMeshZoneStatus(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus);
-
- void onPathEvent();
-
- void setDefaultInputs();
- void setConsoleState(EConsoleState pConsoleState);
- void setWorldRenderState();
- void setNavMeshRenderState();
- void updateRenderablesObjects();
-
- void updateControlsOnConsoleState();
- void updateViewerStatusOnConsoleState();
- void updateSimulatorStatusOnConsoleState();
-
- void initializeNavMeshZoneForCurrentRegion();
-
- void switchIntoTestPathMode();
- void switchOutOfTestPathMode();
- void updateCharacterWidth();
- void updateCharacterType();
- void clearPath();
- void updatePathTestStatus();
-
- void registerSavedSettingsListeners();
- void deregisterSavedSettingsListeners();
- void handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue);
- void handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue);
- void fillInColorsForNavMeshVisualization();
- void cleanupRenderableRestoreItems();
-
- LLRootHandle<LLFloaterPathfindingConsole> mSelfHandle;
- LLTabContainer *mViewTestTabContainer;
- LLPanel *mViewTab;
- LLTextBase *mShowLabel;
- LLCheckBoxCtrl *mShowWorldCheckBox;
- LLCheckBoxCtrl *mShowWorldMovablesOnlyCheckBox;
- LLCheckBoxCtrl *mShowNavMeshCheckBox;
- LLTextBase *mShowNavMeshWalkabilityLabel;
- LLComboBox *mShowNavMeshWalkabilityComboBox;
- LLCheckBoxCtrl *mShowWalkablesCheckBox;
- LLCheckBoxCtrl *mShowStaticObstaclesCheckBox;
- LLCheckBoxCtrl *mShowMaterialVolumesCheckBox;
- LLCheckBoxCtrl *mShowExclusionVolumesCheckBox;
- LLCheckBoxCtrl *mShowRenderWaterPlaneCheckBox;
- LLCheckBoxCtrl *mShowXRayCheckBox;
- LLTextBase *mPathfindingViewerStatus;
- LLTextBase *mPathfindingSimulatorStatus;
- LLPanel *mTestTab;
- LLTextBase *mCtrlClickLabel;
- LLTextBase *mShiftClickLabel;
- LLTextBase *mCharacterWidthLabel;
- LLTextBase *mCharacterWidthUnitLabel;
- LLSliderCtrl *mCharacterWidthSlider;
- LLTextBase *mCharacterTypeLabel;
- LLComboBox *mCharacterTypeComboBox;
- LLTextBase *mPathTestingStatus;
- LLButton *mClearPathButton;
-
- LLColor4 mErrorColor;
- LLColor4 mWarningColor;
-
- LLPathfindingNavMeshZone::navmesh_zone_slot_t mNavMeshZoneSlot;
- LLPathfindingNavMeshZone mNavMeshZone;
- bool mIsNavMeshUpdating;
-
- boost::signals2::connection mRegionBoundarySlot;
- boost::signals2::connection mTeleportFailedSlot;
- LLPathfindingPathTool::path_event_slot_t mPathEventSlot;
-
- LLToolset *mPathfindingToolset;
- LLToolset *mSavedToolset;
-
- boost::signals2::connection mSavedSettingRetrieveNeighborSlot;
- boost::signals2::connection mSavedSettingWalkableSlot;
- boost::signals2::connection mSavedSettingStaticObstacleSlot;
- boost::signals2::connection mSavedSettingMaterialVolumeSlot;
- boost::signals2::connection mSavedSettingExclusionVolumeSlot;
- boost::signals2::connection mSavedSettingInteriorEdgeSlot;
- boost::signals2::connection mSavedSettingExteriorEdgeSlot;
- boost::signals2::connection mSavedSettingHeatmapMinSlot;
- boost::signals2::connection mSavedSettingHeatmapMaxSlot;
- boost::signals2::connection mSavedSettingNavMeshFaceSlot;
- boost::signals2::connection mSavedSettingTestPathValidEndSlot;
- boost::signals2::connection mSavedSettingTestPathInvalidEndSlot;
- boost::signals2::connection mSavedSettingTestPathSlot;
- boost::signals2::connection mSavedSettingWaterSlot;
-
- EConsoleState mConsoleState;
-
- std::vector<U32> mRenderableRestoreList;
-
- static LLHandle<LLFloaterPathfindingConsole> sInstanceHandle;
+ typedef enum
+ {
+ kConsoleStateUnknown,
+ kConsoleStateLibraryNotImplemented,
+ kConsoleStateRegionNotEnabled,
+ kConsoleStateRegionLoading,
+ kConsoleStateCheckingVersion,
+ kConsoleStateDownloading,
+ kConsoleStateHasNavMesh,
+ kConsoleStateError
+ } EConsoleState;
+
+ // Does its own instance management, so clients not allowed
+ // to allocate or destroy.
+ LLFloaterPathfindingConsole(const LLSD& pSeed);
+ virtual ~LLFloaterPathfindingConsole();
+
+ void onTabSwitch();
+ void onShowWorldSet();
+ void onShowWorldMovablesOnlySet();
+ void onShowNavMeshSet();
+ void onShowWalkabilitySet();
+ void onCharacterWidthSet();
+ void onCharacterTypeSwitch();
+ void onClearPathClicked();
+
+ void handleNavMeshZoneStatus(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus);
+
+ void onPathEvent();
+
+ void setDefaultInputs();
+ void setConsoleState(EConsoleState pConsoleState);
+ void setWorldRenderState();
+ void setNavMeshRenderState();
+ void updateRenderablesObjects();
+
+ void updateControlsOnConsoleState();
+ void updateViewerStatusOnConsoleState();
+ void updateSimulatorStatusOnConsoleState();
+
+ void initializeNavMeshZoneForCurrentRegion();
+
+ void switchIntoTestPathMode();
+ void switchOutOfTestPathMode();
+ void updateCharacterWidth();
+ void updateCharacterType();
+ void clearPath();
+ void updatePathTestStatus();
+
+ void registerSavedSettingsListeners();
+ void deregisterSavedSettingsListeners();
+ void handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue);
+ void handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue);
+ void fillInColorsForNavMeshVisualization();
+ void cleanupRenderableRestoreItems();
+
+ LLRootHandle<LLFloaterPathfindingConsole> mSelfHandle;
+ LLTabContainer *mViewTestTabContainer;
+ LLPanel *mViewTab;
+ LLTextBase *mShowLabel;
+ LLCheckBoxCtrl *mShowWorldCheckBox;
+ LLCheckBoxCtrl *mShowWorldMovablesOnlyCheckBox;
+ LLCheckBoxCtrl *mShowNavMeshCheckBox;
+ LLTextBase *mShowNavMeshWalkabilityLabel;
+ LLComboBox *mShowNavMeshWalkabilityComboBox;
+ LLCheckBoxCtrl *mShowWalkablesCheckBox;
+ LLCheckBoxCtrl *mShowStaticObstaclesCheckBox;
+ LLCheckBoxCtrl *mShowMaterialVolumesCheckBox;
+ LLCheckBoxCtrl *mShowExclusionVolumesCheckBox;
+ LLCheckBoxCtrl *mShowRenderWaterPlaneCheckBox;
+ LLCheckBoxCtrl *mShowXRayCheckBox;
+ LLTextBase *mPathfindingViewerStatus;
+ LLTextBase *mPathfindingSimulatorStatus;
+ LLPanel *mTestTab;
+ LLTextBase *mCtrlClickLabel;
+ LLTextBase *mShiftClickLabel;
+ LLTextBase *mCharacterWidthLabel;
+ LLTextBase *mCharacterWidthUnitLabel;
+ LLSliderCtrl *mCharacterWidthSlider;
+ LLTextBase *mCharacterTypeLabel;
+ LLComboBox *mCharacterTypeComboBox;
+ LLTextBase *mPathTestingStatus;
+ LLButton *mClearPathButton;
+
+ LLColor4 mErrorColor;
+ LLColor4 mWarningColor;
+
+ LLPathfindingNavMeshZone::navmesh_zone_slot_t mNavMeshZoneSlot;
+ LLPathfindingNavMeshZone mNavMeshZone;
+ bool mIsNavMeshUpdating;
+
+ boost::signals2::connection mRegionBoundarySlot;
+ boost::signals2::connection mTeleportFailedSlot;
+ LLPathfindingPathTool::path_event_slot_t mPathEventSlot;
+
+ LLToolset *mPathfindingToolset;
+ LLToolset *mSavedToolset;
+
+ boost::signals2::connection mSavedSettingRetrieveNeighborSlot;
+ boost::signals2::connection mSavedSettingWalkableSlot;
+ boost::signals2::connection mSavedSettingStaticObstacleSlot;
+ boost::signals2::connection mSavedSettingMaterialVolumeSlot;
+ boost::signals2::connection mSavedSettingExclusionVolumeSlot;
+ boost::signals2::connection mSavedSettingInteriorEdgeSlot;
+ boost::signals2::connection mSavedSettingExteriorEdgeSlot;
+ boost::signals2::connection mSavedSettingHeatmapMinSlot;
+ boost::signals2::connection mSavedSettingHeatmapMaxSlot;
+ boost::signals2::connection mSavedSettingNavMeshFaceSlot;
+ boost::signals2::connection mSavedSettingTestPathValidEndSlot;
+ boost::signals2::connection mSavedSettingTestPathInvalidEndSlot;
+ boost::signals2::connection mSavedSettingTestPathSlot;
+ boost::signals2::connection mSavedSettingWaterSlot;
+
+ EConsoleState mConsoleState;
+
+ std::vector<U32> mRenderableRestoreList;
+
+ static LLHandle<LLFloaterPathfindingConsole> sInstanceHandle;
};
#endif // LL_LLFLOATERPATHFINDINGCONSOLE_H
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp
index 03aede94c6..66e756720c 100644
--- a/indra/newview/llfloaterpathfindinglinksets.cpp
+++ b/indra/newview/llfloaterpathfindinglinksets.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpathfindinglinksets.cpp
* @brief "Pathfinding linksets" floater, allowing manipulation of the linksets on the current region.
* @author Stinson@lindenlab.com
@@ -68,42 +68,42 @@
void LLFloaterPathfindingLinksets::openLinksetsWithSelectedObjects()
{
- LLFloaterPathfindingLinksets *linksetsFloater = LLFloaterReg::getTypedInstance<LLFloaterPathfindingLinksets>("pathfinding_linksets");
- linksetsFloater->clearFilters();
- linksetsFloater->showFloaterWithSelectionObjects();
+ LLFloaterPathfindingLinksets *linksetsFloater = LLFloaterReg::getTypedInstance<LLFloaterPathfindingLinksets>("pathfinding_linksets");
+ linksetsFloater->clearFilters();
+ linksetsFloater->showFloaterWithSelectionObjects();
}
LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed)
- : LLFloaterPathfindingObjects(pSeed),
- mFilterByName(NULL),
- mFilterByDescription(NULL),
- mFilterByLinksetUse(NULL),
- mEditLinksetUse(NULL),
- mEditLinksetUseWalkable(NULL),
- mEditLinksetUseStaticObstacle(NULL),
- mEditLinksetUseDynamicObstacle(NULL),
- mEditLinksetUseMaterialVolume(NULL),
- mEditLinksetUseExclusionVolume(NULL),
- mEditLinksetUseDynamicPhantom(NULL),
- mLabelWalkabilityCoefficients(NULL),
- mLabelEditA(NULL),
- mLabelSuggestedUseA(NULL),
- mEditA(NULL),
- mLabelEditB(NULL),
- mLabelSuggestedUseB(NULL),
- mEditB(NULL),
- mLabelEditC(NULL),
- mLabelSuggestedUseC(NULL),
- mEditC(NULL),
- mLabelEditD(NULL),
- mLabelSuggestedUseD(NULL),
- mEditD(NULL),
- mApplyEditsButton(NULL),
- mBeaconColor(),
- mPreviousValueA(LLPathfindingLinkset::MAX_WALKABILITY_VALUE),
- mPreviousValueB(LLPathfindingLinkset::MAX_WALKABILITY_VALUE),
- mPreviousValueC(LLPathfindingLinkset::MAX_WALKABILITY_VALUE),
- mPreviousValueD(LLPathfindingLinkset::MAX_WALKABILITY_VALUE)
+ : LLFloaterPathfindingObjects(pSeed),
+ mFilterByName(NULL),
+ mFilterByDescription(NULL),
+ mFilterByLinksetUse(NULL),
+ mEditLinksetUse(NULL),
+ mEditLinksetUseWalkable(NULL),
+ mEditLinksetUseStaticObstacle(NULL),
+ mEditLinksetUseDynamicObstacle(NULL),
+ mEditLinksetUseMaterialVolume(NULL),
+ mEditLinksetUseExclusionVolume(NULL),
+ mEditLinksetUseDynamicPhantom(NULL),
+ mLabelWalkabilityCoefficients(NULL),
+ mLabelEditA(NULL),
+ mLabelSuggestedUseA(NULL),
+ mEditA(NULL),
+ mLabelEditB(NULL),
+ mLabelSuggestedUseB(NULL),
+ mEditB(NULL),
+ mLabelEditC(NULL),
+ mLabelSuggestedUseC(NULL),
+ mEditC(NULL),
+ mLabelEditD(NULL),
+ mLabelSuggestedUseD(NULL),
+ mEditD(NULL),
+ mApplyEditsButton(NULL),
+ mBeaconColor(),
+ mPreviousValueA(LLPathfindingLinkset::MAX_WALKABILITY_VALUE),
+ mPreviousValueB(LLPathfindingLinkset::MAX_WALKABILITY_VALUE),
+ mPreviousValueC(LLPathfindingLinkset::MAX_WALKABILITY_VALUE),
+ mPreviousValueD(LLPathfindingLinkset::MAX_WALKABILITY_VALUE)
{
}
@@ -113,7 +113,7 @@ LLFloaterPathfindingLinksets::~LLFloaterPathfindingLinksets()
BOOL LLFloaterPathfindingLinksets::postBuild()
{
- mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingLinksetBeaconColor");
+ mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingLinksetBeaconColor");
mFilterByName = getChild<LLSearchEditor>("filter_by_name");
mFilterByName->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this));
@@ -123,679 +123,679 @@ BOOL LLFloaterPathfindingLinksets::postBuild()
mFilterByDescription->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this));
mFilterByDescription->setCommitOnFocusLost(true);
- mFilterByLinksetUse = findChild<LLComboBox>("filter_by_linkset_use");
- llassert(mFilterByLinksetUse != NULL);
- mFilterByLinksetUse->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this));
+ mFilterByLinksetUse = findChild<LLComboBox>("filter_by_linkset_use");
+ llassert(mFilterByLinksetUse != NULL);
+ mFilterByLinksetUse->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this));
- childSetAction("apply_filters", boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this));
- childSetAction("clear_filters", boost::bind(&LLFloaterPathfindingLinksets::onClearFiltersClicked, this));
+ childSetAction("apply_filters", boost::bind(&LLFloaterPathfindingLinksets::onApplyAllFilters, this));
+ childSetAction("clear_filters", boost::bind(&LLFloaterPathfindingLinksets::onClearFiltersClicked, this));
- mEditLinksetUse = findChild<LLComboBox>("edit_linkset_use");
- llassert(mEditLinksetUse != NULL);
- mEditLinksetUse->clearRows();
+ mEditLinksetUse = findChild<LLComboBox>("edit_linkset_use");
+ llassert(mEditLinksetUse != NULL);
+ mEditLinksetUse->clearRows();
- mEditLinksetUseUnset = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getString("linkset_choose_use"), XUI_LINKSET_USE_NONE));
- llassert(mEditLinksetUseUnset != NULL);
+ mEditLinksetUseUnset = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getString("linkset_choose_use"), XUI_LINKSET_USE_NONE));
+ llassert(mEditLinksetUseUnset != NULL);
- mEditLinksetUseWalkable = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kWalkable), XUI_LINKSET_USE_WALKABLE));
- llassert(mEditLinksetUseWalkable != NULL);
+ mEditLinksetUseWalkable = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kWalkable), XUI_LINKSET_USE_WALKABLE));
+ llassert(mEditLinksetUseWalkable != NULL);
- mEditLinksetUseStaticObstacle = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kStaticObstacle), XUI_LINKSET_USE_STATIC_OBSTACLE));
- llassert(mEditLinksetUseStaticObstacle != NULL);
+ mEditLinksetUseStaticObstacle = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kStaticObstacle), XUI_LINKSET_USE_STATIC_OBSTACLE));
+ llassert(mEditLinksetUseStaticObstacle != NULL);
- mEditLinksetUseDynamicObstacle = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kDynamicObstacle), XUI_LINKSET_USE_DYNAMIC_OBSTACLE));
- llassert(mEditLinksetUseDynamicObstacle != NULL);
+ mEditLinksetUseDynamicObstacle = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kDynamicObstacle), XUI_LINKSET_USE_DYNAMIC_OBSTACLE));
+ llassert(mEditLinksetUseDynamicObstacle != NULL);
- mEditLinksetUseMaterialVolume = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kMaterialVolume), XUI_LINKSET_USE_MATERIAL_VOLUME));
- llassert(mEditLinksetUseMaterialVolume != NULL);
+ mEditLinksetUseMaterialVolume = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kMaterialVolume), XUI_LINKSET_USE_MATERIAL_VOLUME));
+ llassert(mEditLinksetUseMaterialVolume != NULL);
- mEditLinksetUseExclusionVolume = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kExclusionVolume), XUI_LINKSET_USE_EXCLUSION_VOLUME));
- llassert(mEditLinksetUseExclusionVolume != NULL);
+ mEditLinksetUseExclusionVolume = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kExclusionVolume), XUI_LINKSET_USE_EXCLUSION_VOLUME));
+ llassert(mEditLinksetUseExclusionVolume != NULL);
- mEditLinksetUseDynamicPhantom = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kDynamicPhantom), XUI_LINKSET_USE_DYNAMIC_PHANTOM));
- llassert(mEditLinksetUseDynamicPhantom != NULL);
+ mEditLinksetUseDynamicPhantom = mEditLinksetUse->addElement(buildLinksetUseScrollListData(getLinksetUseString(LLPathfindingLinkset::kDynamicPhantom), XUI_LINKSET_USE_DYNAMIC_PHANTOM));
+ llassert(mEditLinksetUseDynamicPhantom != NULL);
- mEditLinksetUse->selectFirstItem();
+ mEditLinksetUse->selectFirstItem();
- mLabelWalkabilityCoefficients = findChild<LLTextBase>("walkability_coefficients_label");
- llassert(mLabelWalkabilityCoefficients != NULL);
+ mLabelWalkabilityCoefficients = findChild<LLTextBase>("walkability_coefficients_label");
+ llassert(mLabelWalkabilityCoefficients != NULL);
- mLabelEditA = findChild<LLTextBase>("edit_a_label");
- llassert(mLabelEditA != NULL);
+ mLabelEditA = findChild<LLTextBase>("edit_a_label");
+ llassert(mLabelEditA != NULL);
- mLabelSuggestedUseA = findChild<LLTextBase>("suggested_use_a_label");
- llassert(mLabelSuggestedUseA != NULL);
+ mLabelSuggestedUseA = findChild<LLTextBase>("suggested_use_a_label");
+ llassert(mLabelSuggestedUseA != NULL);
- mEditA = findChild<LLLineEditor>("edit_a_value");
- llassert(mEditA != NULL);
- mEditA->setPrevalidate(LLTextValidate::validateNonNegativeS32);
- mEditA->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueA));
+ mEditA = findChild<LLLineEditor>("edit_a_value");
+ llassert(mEditA != NULL);
+ mEditA->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ mEditA->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueA));
- mLabelEditB = findChild<LLTextBase>("edit_b_label");
- llassert(mLabelEditB != NULL);
+ mLabelEditB = findChild<LLTextBase>("edit_b_label");
+ llassert(mLabelEditB != NULL);
- mLabelSuggestedUseB = findChild<LLTextBase>("suggested_use_b_label");
- llassert(mLabelSuggestedUseB != NULL);
+ mLabelSuggestedUseB = findChild<LLTextBase>("suggested_use_b_label");
+ llassert(mLabelSuggestedUseB != NULL);
- mEditB = findChild<LLLineEditor>("edit_b_value");
- llassert(mEditB != NULL);
- mEditB->setPrevalidate(LLTextValidate::validateNonNegativeS32);
- mEditB->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueB));
+ mEditB = findChild<LLLineEditor>("edit_b_value");
+ llassert(mEditB != NULL);
+ mEditB->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ mEditB->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueB));
- mLabelEditC = findChild<LLTextBase>("edit_c_label");
- llassert(mLabelEditC != NULL);
+ mLabelEditC = findChild<LLTextBase>("edit_c_label");
+ llassert(mLabelEditC != NULL);
- mLabelSuggestedUseC = findChild<LLTextBase>("suggested_use_c_label");
- llassert(mLabelSuggestedUseC != NULL);
+ mLabelSuggestedUseC = findChild<LLTextBase>("suggested_use_c_label");
+ llassert(mLabelSuggestedUseC != NULL);
- mEditC = findChild<LLLineEditor>("edit_c_value");
- llassert(mEditC != NULL);
- mEditC->setPrevalidate(LLTextValidate::validateNonNegativeS32);
- mEditC->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueC));
+ mEditC = findChild<LLLineEditor>("edit_c_value");
+ llassert(mEditC != NULL);
+ mEditC->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ mEditC->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueC));
- mLabelEditD = findChild<LLTextBase>("edit_d_label");
- llassert(mLabelEditD != NULL);
+ mLabelEditD = findChild<LLTextBase>("edit_d_label");
+ llassert(mLabelEditD != NULL);
- mLabelSuggestedUseD = findChild<LLTextBase>("suggested_use_d_label");
- llassert(mLabelSuggestedUseD != NULL);
+ mLabelSuggestedUseD = findChild<LLTextBase>("suggested_use_d_label");
+ llassert(mLabelSuggestedUseD != NULL);
- mEditD = findChild<LLLineEditor>("edit_d_value");
- llassert(mEditD != NULL);
- mEditD->setPrevalidate(LLTextValidate::validateNonNegativeS32);
- mEditD->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueD));
+ mEditD = findChild<LLLineEditor>("edit_d_value");
+ llassert(mEditD != NULL);
+ mEditD->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ mEditD->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1, mPreviousValueD));
- mApplyEditsButton = findChild<LLButton>("apply_edit_values");
- llassert(mApplyEditsButton != NULL);
- mApplyEditsButton->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyChangesClicked, this));
+ mApplyEditsButton = findChild<LLButton>("apply_edit_values");
+ llassert(mApplyEditsButton != NULL);
+ mApplyEditsButton->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyChangesClicked, this));
- return LLFloaterPathfindingObjects::postBuild();
+ return LLFloaterPathfindingObjects::postBuild();
}
void LLFloaterPathfindingLinksets::requestGetObjects()
{
- LLPathfindingManager::getInstance()->requestGetLinksets(getNewRequestId(), boost::bind(&LLFloaterPathfindingLinksets::handleNewObjectList, this, _1, _2, _3));
+ LLPathfindingManager::getInstance()->requestGetLinksets(getNewRequestId(), boost::bind(&LLFloaterPathfindingLinksets::handleNewObjectList, this, _1, _2, _3));
}
void LLFloaterPathfindingLinksets::buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr)
{
- llassert(pObjectListPtr != NULL);
- llassert(!pObjectListPtr->isEmpty());
-
- std::string nameFilter = mFilterByName->getText();
- std::string descriptionFilter = mFilterByDescription->getText();
- LLPathfindingLinkset::ELinksetUse linksetUseFilter = getFilterLinksetUse();
- bool isFilteringName = !nameFilter.empty();
- bool isFilteringDescription = !descriptionFilter.empty();
- bool isFilteringLinksetUse = (linksetUseFilter != LLPathfindingLinkset::kUnknown);
-
- const LLVector3& avatarPosition = gAgent.getPositionAgent();
-
- if (isFilteringName || isFilteringDescription || isFilteringLinksetUse)
- {
- LLStringUtil::toUpper(nameFilter);
- LLStringUtil::toUpper(descriptionFilter);
- for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter)
- {
- const LLPathfindingObjectPtr objectPtr = objectIter->second;
- const LLPathfindingLinkset *linksetPtr = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
- llassert(linksetPtr != NULL);
-
- std::string linksetName = (linksetPtr->isTerrain() ? getString("linkset_terrain_name") : linksetPtr->getName());
- std::string linksetDescription = linksetPtr->getDescription();
- LLStringUtil::toUpper(linksetName);
- LLStringUtil::toUpper(linksetDescription);
-
- if ((!isFilteringName || (linksetName.find(nameFilter) != std::string::npos)) &&
- (!isFilteringDescription || (linksetDescription.find(descriptionFilter) != std::string::npos)) &&
- (!isFilteringLinksetUse || (linksetPtr->getLinksetUse() == linksetUseFilter)))
- {
- LLSD scrollListItemData = buildLinksetScrollListItemData(linksetPtr, avatarPosition);
- addObjectToScrollList(objectPtr, scrollListItemData);
- }
- }
- }
- else
- {
- for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter)
- {
- const LLPathfindingObjectPtr objectPtr = objectIter->second;
- const LLPathfindingLinkset *linksetPtr = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
- llassert(linksetPtr != NULL);
-
- LLSD scrollListItemData = buildLinksetScrollListItemData(linksetPtr, avatarPosition);
- addObjectToScrollList(objectPtr, scrollListItemData);
- }
- }
+ llassert(pObjectListPtr != NULL);
+ llassert(!pObjectListPtr->isEmpty());
+
+ std::string nameFilter = mFilterByName->getText();
+ std::string descriptionFilter = mFilterByDescription->getText();
+ LLPathfindingLinkset::ELinksetUse linksetUseFilter = getFilterLinksetUse();
+ bool isFilteringName = !nameFilter.empty();
+ bool isFilteringDescription = !descriptionFilter.empty();
+ bool isFilteringLinksetUse = (linksetUseFilter != LLPathfindingLinkset::kUnknown);
+
+ const LLVector3& avatarPosition = gAgent.getPositionAgent();
+
+ if (isFilteringName || isFilteringDescription || isFilteringLinksetUse)
+ {
+ LLStringUtil::toUpper(nameFilter);
+ LLStringUtil::toUpper(descriptionFilter);
+ for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter)
+ {
+ const LLPathfindingObjectPtr objectPtr = objectIter->second;
+ const LLPathfindingLinkset *linksetPtr = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
+ llassert(linksetPtr != NULL);
+
+ std::string linksetName = (linksetPtr->isTerrain() ? getString("linkset_terrain_name") : linksetPtr->getName());
+ std::string linksetDescription = linksetPtr->getDescription();
+ LLStringUtil::toUpper(linksetName);
+ LLStringUtil::toUpper(linksetDescription);
+
+ if ((!isFilteringName || (linksetName.find(nameFilter) != std::string::npos)) &&
+ (!isFilteringDescription || (linksetDescription.find(descriptionFilter) != std::string::npos)) &&
+ (!isFilteringLinksetUse || (linksetPtr->getLinksetUse() == linksetUseFilter)))
+ {
+ LLSD scrollListItemData = buildLinksetScrollListItemData(linksetPtr, avatarPosition);
+ addObjectToScrollList(objectPtr, scrollListItemData);
+ }
+ }
+ }
+ else
+ {
+ for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter)
+ {
+ const LLPathfindingObjectPtr objectPtr = objectIter->second;
+ const LLPathfindingLinkset *linksetPtr = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
+ llassert(linksetPtr != NULL);
+
+ LLSD scrollListItemData = buildLinksetScrollListItemData(linksetPtr, avatarPosition);
+ addObjectToScrollList(objectPtr, scrollListItemData);
+ }
+ }
}
void LLFloaterPathfindingLinksets::updateControlsOnScrollListChange()
{
- LLFloaterPathfindingObjects::updateControlsOnScrollListChange();
- updateEditFieldValues();
- updateStateOnEditFields();
- updateStateOnEditLinksetUse();
+ LLFloaterPathfindingObjects::updateControlsOnScrollListChange();
+ updateEditFieldValues();
+ updateStateOnEditFields();
+ updateStateOnEditLinksetUse();
}
S32 LLFloaterPathfindingLinksets::getNameColumnIndex() const
{
- return 0;
+ return 0;
}
S32 LLFloaterPathfindingLinksets::getOwnerNameColumnIndex() const
{
- return 2;
+ return 2;
}
std::string LLFloaterPathfindingLinksets::getOwnerName(const LLPathfindingObject *pObject) const
{
- return (pObject->hasOwner()
- ? (pObject->hasOwnerName()
- ? (pObject->isGroupOwned()
- ? (pObject->getOwnerName() + " " + getString("linkset_owner_group"))
- : pObject->getOwnerName())
- : getString("linkset_owner_loading"))
- : getString("linkset_owner_unknown"));
+ return (pObject->hasOwner()
+ ? (pObject->hasOwnerName()
+ ? (pObject->isGroupOwned()
+ ? (pObject->getOwnerName() + " " + getString("linkset_owner_group"))
+ : pObject->getOwnerName())
+ : getString("linkset_owner_loading"))
+ : getString("linkset_owner_unknown"));
}
const LLColor4 &LLFloaterPathfindingLinksets::getBeaconColor() const
{
- return mBeaconColor;
+ return mBeaconColor;
}
LLPathfindingObjectListPtr LLFloaterPathfindingLinksets::getEmptyObjectList() const
{
- LLPathfindingObjectListPtr objectListPtr(new LLPathfindingLinksetList());
- return objectListPtr;
+ LLPathfindingObjectListPtr objectListPtr(new LLPathfindingLinksetList());
+ return objectListPtr;
}
void LLFloaterPathfindingLinksets::requestSetLinksets(LLPathfindingObjectListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD)
{
- LLPathfindingManager::getInstance()->requestSetLinksets(getNewRequestId(), pLinksetList, pLinksetUse, pA, pB, pC, pD, boost::bind(&LLFloaterPathfindingLinksets::handleUpdateObjectList, this, _1, _2, _3));
+ LLPathfindingManager::getInstance()->requestSetLinksets(getNewRequestId(), pLinksetList, pLinksetUse, pA, pB, pC, pD, boost::bind(&LLFloaterPathfindingLinksets::handleUpdateObjectList, this, _1, _2, _3));
}
void LLFloaterPathfindingLinksets::onApplyAllFilters()
{
- rebuildObjectsScrollList();
+ rebuildObjectsScrollList();
}
void LLFloaterPathfindingLinksets::onClearFiltersClicked()
{
- clearFilters();
- rebuildObjectsScrollList();
+ clearFilters();
+ rebuildObjectsScrollList();
}
void LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl, LLSD &pPreviousValue)
{
- LLLineEditor *pLineEditor = static_cast<LLLineEditor *>(pUICtrl);
- llassert(pLineEditor != NULL);
-
- const std::string &valueString = pLineEditor->getText();
-
- S32 intValue;
- LLSD value;
- bool doResetValue = false;
-
- if (valueString.empty())
- {
- value = pPreviousValue;
- doResetValue = true;
- }
- else if (LLStringUtil::convertToS32(valueString, intValue))
- {
- doResetValue = ((intValue < LLPathfindingLinkset::MIN_WALKABILITY_VALUE) || (intValue > LLPathfindingLinkset::MAX_WALKABILITY_VALUE));
- value = LLSD(llclamp(intValue, LLPathfindingLinkset::MIN_WALKABILITY_VALUE, LLPathfindingLinkset::MAX_WALKABILITY_VALUE));
- }
- else
- {
- value = LLSD(LLPathfindingLinkset::MAX_WALKABILITY_VALUE);
- doResetValue = true;
- }
-
- if (doResetValue)
- {
- pLineEditor->setValue(value);
- }
- pPreviousValue = value;
+ LLLineEditor *pLineEditor = static_cast<LLLineEditor *>(pUICtrl);
+ llassert(pLineEditor != NULL);
+
+ const std::string &valueString = pLineEditor->getText();
+
+ S32 intValue;
+ LLSD value;
+ bool doResetValue = false;
+
+ if (valueString.empty())
+ {
+ value = pPreviousValue;
+ doResetValue = true;
+ }
+ else if (LLStringUtil::convertToS32(valueString, intValue))
+ {
+ doResetValue = ((intValue < LLPathfindingLinkset::MIN_WALKABILITY_VALUE) || (intValue > LLPathfindingLinkset::MAX_WALKABILITY_VALUE));
+ value = LLSD(llclamp(intValue, LLPathfindingLinkset::MIN_WALKABILITY_VALUE, LLPathfindingLinkset::MAX_WALKABILITY_VALUE));
+ }
+ else
+ {
+ value = LLSD(LLPathfindingLinkset::MAX_WALKABILITY_VALUE);
+ doResetValue = true;
+ }
+
+ if (doResetValue)
+ {
+ pLineEditor->setValue(value);
+ }
+ pPreviousValue = value;
}
void LLFloaterPathfindingLinksets::onApplyChangesClicked()
{
- applyEdit();
+ applyEdit();
}
void LLFloaterPathfindingLinksets::clearFilters()
{
- mFilterByName->clear();
- mFilterByDescription->clear();
- setFilterLinksetUse(LLPathfindingLinkset::kUnknown);
+ mFilterByName->clear();
+ mFilterByDescription->clear();
+ setFilterLinksetUse(LLPathfindingLinkset::kUnknown);
}
void LLFloaterPathfindingLinksets::updateEditFieldValues()
{
- int numSelectedObjects = getNumSelectedObjects();
- if (numSelectedObjects <= 0)
- {
- mEditLinksetUse->selectFirstItem();
- mEditA->clear();
- mEditB->clear();
- mEditC->clear();
- mEditD->clear();
- }
- else
- {
- LLPathfindingObjectPtr firstSelectedObjectPtr = getFirstSelectedObject();
- llassert(firstSelectedObjectPtr != NULL);
-
- const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(firstSelectedObjectPtr.get());
-
- setEditLinksetUse(linkset->getLinksetUse());
- mPreviousValueA = LLSD(linkset->getWalkabilityCoefficientA());
- mPreviousValueB = LLSD(linkset->getWalkabilityCoefficientB());
- mPreviousValueC = LLSD(linkset->getWalkabilityCoefficientC());
- mPreviousValueD = LLSD(linkset->getWalkabilityCoefficientD());
- mEditA->setValue(mPreviousValueA);
- mEditB->setValue(mPreviousValueB);
- mEditC->setValue(mPreviousValueC);
- mEditD->setValue(mPreviousValueD);
- }
+ int numSelectedObjects = getNumSelectedObjects();
+ if (numSelectedObjects <= 0)
+ {
+ mEditLinksetUse->selectFirstItem();
+ mEditA->clear();
+ mEditB->clear();
+ mEditC->clear();
+ mEditD->clear();
+ }
+ else
+ {
+ LLPathfindingObjectPtr firstSelectedObjectPtr = getFirstSelectedObject();
+ llassert(firstSelectedObjectPtr != NULL);
+
+ const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(firstSelectedObjectPtr.get());
+
+ setEditLinksetUse(linkset->getLinksetUse());
+ mPreviousValueA = LLSD(linkset->getWalkabilityCoefficientA());
+ mPreviousValueB = LLSD(linkset->getWalkabilityCoefficientB());
+ mPreviousValueC = LLSD(linkset->getWalkabilityCoefficientC());
+ mPreviousValueD = LLSD(linkset->getWalkabilityCoefficientD());
+ mEditA->setValue(mPreviousValueA);
+ mEditB->setValue(mPreviousValueB);
+ mEditC->setValue(mPreviousValueC);
+ mEditD->setValue(mPreviousValueD);
+ }
}
LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListItemData(const LLPathfindingLinkset *pLinksetPtr, const LLVector3 &pAvatarPosition) const
{
- llassert(pLinksetPtr != NULL);
- LLSD columns = LLSD::emptyArray();
-
- if (pLinksetPtr->isTerrain())
- {
- columns[0]["column"] = "name";
- columns[0]["value"] = getString("linkset_terrain_name");
-
- columns[1]["column"] = "description";
- columns[1]["value"] = getString("linkset_terrain_description");
-
- columns[2]["column"] = "owner";
- columns[2]["value"] = getString("linkset_terrain_owner");
-
- columns[3]["column"] = "scripted";
- columns[3]["value"] = getString("linkset_terrain_scripted");
-
- columns[4]["column"] = "land_impact";
- columns[4]["value"] = getString("linkset_terrain_land_impact");
-
- columns[5]["column"] = "dist_from_you";
- columns[5]["value"] = getString("linkset_terrain_dist_from_you");
- }
- else
- {
- columns[0]["column"] = "name";
- columns[0]["value"] = pLinksetPtr->getName();
-
- columns[1]["column"] = "description";
- columns[1]["value"] = pLinksetPtr->getDescription();
-
- columns[2]["column"] = "owner";
- columns[2]["value"] = getOwnerName(pLinksetPtr);
-
- columns[3]["column"] = "scripted";
- columns[3]["value"] = (pLinksetPtr->hasIsScripted()
- ? (pLinksetPtr->isScripted()
- ? getString("linkset_is_scripted")
- : getString("linkset_is_not_scripted"))
- : getString("linkset_is_unknown_scripted"));
-
- columns[4]["column"] = "land_impact";
- columns[4]["value"] = llformat("%1d", pLinksetPtr->getLandImpact());
-
- columns[5]["column"] = "dist_from_you";
- columns[5]["value"] = llformat("%1.0f m", dist_vec(pAvatarPosition, pLinksetPtr->getLocation()));
- }
-
- columns[6]["column"] = "linkset_use";
- std::string linksetUse = getLinksetUseString(pLinksetPtr->getLinksetUse());
- if (pLinksetPtr->isTerrain())
- {
- linksetUse += (" " + getString("linkset_is_terrain"));
- }
- else if (!pLinksetPtr->isModifiable() && pLinksetPtr->canBeVolume())
- {
- linksetUse += (" " + getString("linkset_is_restricted_state"));
- }
- else if (pLinksetPtr->isModifiable() && !pLinksetPtr->canBeVolume())
- {
- linksetUse += (" " + getString("linkset_is_non_volume_state"));
- }
- else if (!pLinksetPtr->isModifiable() && !pLinksetPtr->canBeVolume())
- {
- linksetUse += (" " + getString("linkset_is_restricted_non_volume_state"));
- }
- columns[6]["value"] = linksetUse;
-
- columns[7]["column"] = "a_percent";
- columns[7]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientA());
-
- columns[8]["column"] = "b_percent";
- columns[8]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientB());
-
- columns[9]["column"] = "c_percent";
- columns[9]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientC());
-
- columns[10]["column"] = "d_percent";
- columns[10]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientD());
-
- return columns;
+ llassert(pLinksetPtr != NULL);
+ LLSD columns = LLSD::emptyArray();
+
+ if (pLinksetPtr->isTerrain())
+ {
+ columns[0]["column"] = "name";
+ columns[0]["value"] = getString("linkset_terrain_name");
+
+ columns[1]["column"] = "description";
+ columns[1]["value"] = getString("linkset_terrain_description");
+
+ columns[2]["column"] = "owner";
+ columns[2]["value"] = getString("linkset_terrain_owner");
+
+ columns[3]["column"] = "scripted";
+ columns[3]["value"] = getString("linkset_terrain_scripted");
+
+ columns[4]["column"] = "land_impact";
+ columns[4]["value"] = getString("linkset_terrain_land_impact");
+
+ columns[5]["column"] = "dist_from_you";
+ columns[5]["value"] = getString("linkset_terrain_dist_from_you");
+ }
+ else
+ {
+ columns[0]["column"] = "name";
+ columns[0]["value"] = pLinksetPtr->getName();
+
+ columns[1]["column"] = "description";
+ columns[1]["value"] = pLinksetPtr->getDescription();
+
+ columns[2]["column"] = "owner";
+ columns[2]["value"] = getOwnerName(pLinksetPtr);
+
+ columns[3]["column"] = "scripted";
+ columns[3]["value"] = (pLinksetPtr->hasIsScripted()
+ ? (pLinksetPtr->isScripted()
+ ? getString("linkset_is_scripted")
+ : getString("linkset_is_not_scripted"))
+ : getString("linkset_is_unknown_scripted"));
+
+ columns[4]["column"] = "land_impact";
+ columns[4]["value"] = llformat("%1d", pLinksetPtr->getLandImpact());
+
+ columns[5]["column"] = "dist_from_you";
+ columns[5]["value"] = llformat("%1.0f m", dist_vec(pAvatarPosition, pLinksetPtr->getLocation()));
+ }
+
+ columns[6]["column"] = "linkset_use";
+ std::string linksetUse = getLinksetUseString(pLinksetPtr->getLinksetUse());
+ if (pLinksetPtr->isTerrain())
+ {
+ linksetUse += (" " + getString("linkset_is_terrain"));
+ }
+ else if (!pLinksetPtr->isModifiable() && pLinksetPtr->canBeVolume())
+ {
+ linksetUse += (" " + getString("linkset_is_restricted_state"));
+ }
+ else if (pLinksetPtr->isModifiable() && !pLinksetPtr->canBeVolume())
+ {
+ linksetUse += (" " + getString("linkset_is_non_volume_state"));
+ }
+ else if (!pLinksetPtr->isModifiable() && !pLinksetPtr->canBeVolume())
+ {
+ linksetUse += (" " + getString("linkset_is_restricted_non_volume_state"));
+ }
+ columns[6]["value"] = linksetUse;
+
+ columns[7]["column"] = "a_percent";
+ columns[7]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientA());
+
+ columns[8]["column"] = "b_percent";
+ columns[8]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientB());
+
+ columns[9]["column"] = "c_percent";
+ columns[9]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientC());
+
+ columns[10]["column"] = "d_percent";
+ columns[10]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientD());
+
+ return columns;
}
LLSD LLFloaterPathfindingLinksets::buildLinksetUseScrollListData(const std::string &pLabel, S32 pValue) const
{
- LLSD columns;
+ LLSD columns;
- columns[0]["column"] = "name";
- columns[0]["value"] = pLabel;
- columns[0]["font"] = "SANSSERIF";
+ columns[0]["column"] = "name";
+ columns[0]["value"] = pLabel;
+ columns[0]["font"] = "SANSSERIF";
- LLSD element;
- element["value"] = pValue;
- element["column"] = columns;
+ LLSD element;
+ element["value"] = pValue;
+ element["column"] = columns;
- return element;
+ return element;
}
bool LLFloaterPathfindingLinksets::isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
- bool isShowWarning = false;
+ bool isShowWarning = false;
- if (pLinksetUse != LLPathfindingLinkset::kUnknown)
- {
- LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
- if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
- {
- const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get());
- isShowWarning = linksetList->isShowUnmodifiablePhantomWarning(pLinksetUse);
- }
- }
+ if (pLinksetUse != LLPathfindingLinkset::kUnknown)
+ {
+ LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
+ if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
+ {
+ const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get());
+ isShowWarning = linksetList->isShowUnmodifiablePhantomWarning(pLinksetUse);
+ }
+ }
- return isShowWarning;
+ return isShowWarning;
}
bool LLFloaterPathfindingLinksets::isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
- bool isShowWarning = false;
+ bool isShowWarning = false;
- if (pLinksetUse != LLPathfindingLinkset::kUnknown)
- {
- LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
- if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
- {
- const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get());
- isShowWarning = linksetList->isShowPhantomToggleWarning(pLinksetUse);
- }
- }
+ if (pLinksetUse != LLPathfindingLinkset::kUnknown)
+ {
+ LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
+ if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
+ {
+ const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get());
+ isShowWarning = linksetList->isShowPhantomToggleWarning(pLinksetUse);
+ }
+ }
- return isShowWarning;
+ return isShowWarning;
}
bool LLFloaterPathfindingLinksets::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
- bool isShowWarning = false;
+ bool isShowWarning = false;
- if (pLinksetUse != LLPathfindingLinkset::kUnknown)
- {
- LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
- if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
- {
- const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get());
- isShowWarning = linksetList->isShowCannotBeVolumeWarning(pLinksetUse);
- }
- }
+ if (pLinksetUse != LLPathfindingLinkset::kUnknown)
+ {
+ LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
+ if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
+ {
+ const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get());
+ isShowWarning = linksetList->isShowCannotBeVolumeWarning(pLinksetUse);
+ }
+ }
- return isShowWarning;
+ return isShowWarning;
}
void LLFloaterPathfindingLinksets::updateStateOnEditFields()
{
- int numSelectedItems = getNumSelectedObjects();
- bool isEditEnabled = (numSelectedItems > 0);
+ int numSelectedItems = getNumSelectedObjects();
+ bool isEditEnabled = (numSelectedItems > 0);
- mEditLinksetUse->setEnabled(isEditEnabled);
+ mEditLinksetUse->setEnabled(isEditEnabled);
- mLabelWalkabilityCoefficients->setEnabled(isEditEnabled);
- mLabelEditA->setEnabled(isEditEnabled);
- mLabelEditB->setEnabled(isEditEnabled);
- mLabelEditC->setEnabled(isEditEnabled);
- mLabelEditD->setEnabled(isEditEnabled);
- mLabelSuggestedUseA->setEnabled(isEditEnabled);
- mLabelSuggestedUseB->setEnabled(isEditEnabled);
- mLabelSuggestedUseC->setEnabled(isEditEnabled);
- mLabelSuggestedUseD->setEnabled(isEditEnabled);
- mEditA->setEnabled(isEditEnabled);
- mEditB->setEnabled(isEditEnabled);
- mEditC->setEnabled(isEditEnabled);
- mEditD->setEnabled(isEditEnabled);
+ mLabelWalkabilityCoefficients->setEnabled(isEditEnabled);
+ mLabelEditA->setEnabled(isEditEnabled);
+ mLabelEditB->setEnabled(isEditEnabled);
+ mLabelEditC->setEnabled(isEditEnabled);
+ mLabelEditD->setEnabled(isEditEnabled);
+ mLabelSuggestedUseA->setEnabled(isEditEnabled);
+ mLabelSuggestedUseB->setEnabled(isEditEnabled);
+ mLabelSuggestedUseC->setEnabled(isEditEnabled);
+ mLabelSuggestedUseD->setEnabled(isEditEnabled);
+ mEditA->setEnabled(isEditEnabled);
+ mEditB->setEnabled(isEditEnabled);
+ mEditC->setEnabled(isEditEnabled);
+ mEditD->setEnabled(isEditEnabled);
- mApplyEditsButton->setEnabled(isEditEnabled && (getMessagingState() == kMessagingComplete));
+ mApplyEditsButton->setEnabled(isEditEnabled && (getMessagingState() == kMessagingComplete));
}
void LLFloaterPathfindingLinksets::updateStateOnEditLinksetUse()
{
- BOOL useWalkable = FALSE;
- BOOL useStaticObstacle = FALSE;
- BOOL useDynamicObstacle = FALSE;
- BOOL useMaterialVolume = FALSE;
- BOOL useExclusionVolume = FALSE;
- BOOL useDynamicPhantom = FALSE;
+ BOOL useWalkable = FALSE;
+ BOOL useStaticObstacle = FALSE;
+ BOOL useDynamicObstacle = FALSE;
+ BOOL useMaterialVolume = FALSE;
+ BOOL useExclusionVolume = FALSE;
+ BOOL useDynamicPhantom = FALSE;
- LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
- if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
- {
- const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get());
- linksetList->determinePossibleStates(useWalkable, useStaticObstacle, useDynamicObstacle, useMaterialVolume, useExclusionVolume, useDynamicPhantom);
- }
+ LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
+ if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
+ {
+ const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get());
+ linksetList->determinePossibleStates(useWalkable, useStaticObstacle, useDynamicObstacle, useMaterialVolume, useExclusionVolume, useDynamicPhantom);
+ }
- mEditLinksetUseWalkable->setEnabled(useWalkable);
- mEditLinksetUseStaticObstacle->setEnabled(useStaticObstacle);
- mEditLinksetUseDynamicObstacle->setEnabled(useDynamicObstacle);
- mEditLinksetUseMaterialVolume->setEnabled(useMaterialVolume);
- mEditLinksetUseExclusionVolume->setEnabled(useExclusionVolume);
- mEditLinksetUseDynamicPhantom->setEnabled(useDynamicPhantom);
+ mEditLinksetUseWalkable->setEnabled(useWalkable);
+ mEditLinksetUseStaticObstacle->setEnabled(useStaticObstacle);
+ mEditLinksetUseDynamicObstacle->setEnabled(useDynamicObstacle);
+ mEditLinksetUseMaterialVolume->setEnabled(useMaterialVolume);
+ mEditLinksetUseExclusionVolume->setEnabled(useExclusionVolume);
+ mEditLinksetUseDynamicPhantom->setEnabled(useDynamicPhantom);
}
void LLFloaterPathfindingLinksets::applyEdit()
{
- LLPathfindingLinkset::ELinksetUse linksetUse = getEditLinksetUse();
-
- bool showPhantomToggleWarning = isShowPhantomToggleWarning(linksetUse);
- bool showUnmodifiablePhantomWarning = isShowUnmodifiablePhantomWarning(linksetUse);
- bool showCannotBeVolumeWarning = isShowCannotBeVolumeWarning(linksetUse);
-
- if (showPhantomToggleWarning || showUnmodifiablePhantomWarning || showCannotBeVolumeWarning)
- {
- LLPathfindingLinkset::ELinksetUse restrictedLinksetUse = LLPathfindingLinkset::getLinksetUseWithToggledPhantom(linksetUse);
- LLSD substitutions;
- substitutions["REQUESTED_TYPE"] = getLinksetUseString(linksetUse);
- substitutions["RESTRICTED_TYPE"] = getLinksetUseString(restrictedLinksetUse);
-
- // Build one of the following notifications names
- // - PathfindingLinksets_WarnOnPhantom
- // - PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted
- // - PathfindingLinksets_WarnOnPhantom_MismatchOnVolume
- // - PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted_MismatchOnVolume
- // - PathfindingLinksets_MismatchOnRestricted
- // - PathfindingLinksets_MismatchOnVolume
- // - PathfindingLinksets_MismatchOnRestricted_MismatchOnVolume
-
- std::string notificationName = "PathfindingLinksets";
-
- if (showPhantomToggleWarning)
- {
- notificationName += "_WarnOnPhantom";
- }
- if (showUnmodifiablePhantomWarning)
- {
- notificationName += "_MismatchOnRestricted";
- }
- if (showCannotBeVolumeWarning)
- {
- notificationName += "_MismatchOnVolume";
- }
-
- LLNotificationsUtil::add(notificationName, substitutions, LLSD(), boost::bind(&LLFloaterPathfindingLinksets::handleApplyEdit, this, _1, _2));
- }
- else
- {
- doApplyEdit();
- }
+ LLPathfindingLinkset::ELinksetUse linksetUse = getEditLinksetUse();
+
+ bool showPhantomToggleWarning = isShowPhantomToggleWarning(linksetUse);
+ bool showUnmodifiablePhantomWarning = isShowUnmodifiablePhantomWarning(linksetUse);
+ bool showCannotBeVolumeWarning = isShowCannotBeVolumeWarning(linksetUse);
+
+ if (showPhantomToggleWarning || showUnmodifiablePhantomWarning || showCannotBeVolumeWarning)
+ {
+ LLPathfindingLinkset::ELinksetUse restrictedLinksetUse = LLPathfindingLinkset::getLinksetUseWithToggledPhantom(linksetUse);
+ LLSD substitutions;
+ substitutions["REQUESTED_TYPE"] = getLinksetUseString(linksetUse);
+ substitutions["RESTRICTED_TYPE"] = getLinksetUseString(restrictedLinksetUse);
+
+ // Build one of the following notifications names
+ // - PathfindingLinksets_WarnOnPhantom
+ // - PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted
+ // - PathfindingLinksets_WarnOnPhantom_MismatchOnVolume
+ // - PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted_MismatchOnVolume
+ // - PathfindingLinksets_MismatchOnRestricted
+ // - PathfindingLinksets_MismatchOnVolume
+ // - PathfindingLinksets_MismatchOnRestricted_MismatchOnVolume
+
+ std::string notificationName = "PathfindingLinksets";
+
+ if (showPhantomToggleWarning)
+ {
+ notificationName += "_WarnOnPhantom";
+ }
+ if (showUnmodifiablePhantomWarning)
+ {
+ notificationName += "_MismatchOnRestricted";
+ }
+ if (showCannotBeVolumeWarning)
+ {
+ notificationName += "_MismatchOnVolume";
+ }
+
+ LLNotificationsUtil::add(notificationName, substitutions, LLSD(), boost::bind(&LLFloaterPathfindingLinksets::handleApplyEdit, this, _1, _2));
+ }
+ else
+ {
+ doApplyEdit();
+ }
}
void LLFloaterPathfindingLinksets::handleApplyEdit(const LLSD &pNotification, const LLSD &pResponse)
{
- if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
- {
- doApplyEdit();
- }
+ if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
+ {
+ doApplyEdit();
+ }
}
void LLFloaterPathfindingLinksets::doApplyEdit()
{
- LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
- if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
- {
- LLPathfindingLinkset::ELinksetUse linksetUse = getEditLinksetUse();
- const std::string &aString = mEditA->getText();
- const std::string &bString = mEditB->getText();
- const std::string &cString = mEditC->getText();
- const std::string &dString = mEditD->getText();
- S32 aValue = static_cast<S32>(atoi(aString.c_str()));
- S32 bValue = static_cast<S32>(atoi(bString.c_str()));
- S32 cValue = static_cast<S32>(atoi(cString.c_str()));
- S32 dValue = static_cast<S32>(atoi(dString.c_str()));
+ LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
+ if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
+ {
+ LLPathfindingLinkset::ELinksetUse linksetUse = getEditLinksetUse();
+ const std::string &aString = mEditA->getText();
+ const std::string &bString = mEditB->getText();
+ const std::string &cString = mEditC->getText();
+ const std::string &dString = mEditD->getText();
+ S32 aValue = static_cast<S32>(atoi(aString.c_str()));
+ S32 bValue = static_cast<S32>(atoi(bString.c_str()));
+ S32 cValue = static_cast<S32>(atoi(cString.c_str()));
+ S32 dValue = static_cast<S32>(atoi(dString.c_str()));
- requestSetLinksets(selectedObjects, linksetUse, aValue, bValue, cValue, dValue);
- }
+ requestSetLinksets(selectedObjects, linksetUse, aValue, bValue, cValue, dValue);
+ }
}
std::string LLFloaterPathfindingLinksets::getLinksetUseString(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
- std::string linksetUse;
-
- switch (pLinksetUse)
- {
- case LLPathfindingLinkset::kWalkable :
- linksetUse = getString("linkset_use_walkable");
- break;
- case LLPathfindingLinkset::kStaticObstacle :
- linksetUse = getString("linkset_use_static_obstacle");
- break;
- case LLPathfindingLinkset::kDynamicObstacle :
- linksetUse = getString("linkset_use_dynamic_obstacle");
- break;
- case LLPathfindingLinkset::kMaterialVolume :
- linksetUse = getString("linkset_use_material_volume");
- break;
- case LLPathfindingLinkset::kExclusionVolume :
- linksetUse = getString("linkset_use_exclusion_volume");
- break;
- case LLPathfindingLinkset::kDynamicPhantom :
- linksetUse = getString("linkset_use_dynamic_phantom");
- break;
- case LLPathfindingLinkset::kUnknown :
- default :
- linksetUse = getString("linkset_use_dynamic_obstacle");
- llassert(0);
- break;
- }
-
- return linksetUse;
+ std::string linksetUse;
+
+ switch (pLinksetUse)
+ {
+ case LLPathfindingLinkset::kWalkable :
+ linksetUse = getString("linkset_use_walkable");
+ break;
+ case LLPathfindingLinkset::kStaticObstacle :
+ linksetUse = getString("linkset_use_static_obstacle");
+ break;
+ case LLPathfindingLinkset::kDynamicObstacle :
+ linksetUse = getString("linkset_use_dynamic_obstacle");
+ break;
+ case LLPathfindingLinkset::kMaterialVolume :
+ linksetUse = getString("linkset_use_material_volume");
+ break;
+ case LLPathfindingLinkset::kExclusionVolume :
+ linksetUse = getString("linkset_use_exclusion_volume");
+ break;
+ case LLPathfindingLinkset::kDynamicPhantom :
+ linksetUse = getString("linkset_use_dynamic_phantom");
+ break;
+ case LLPathfindingLinkset::kUnknown :
+ default :
+ linksetUse = getString("linkset_use_dynamic_obstacle");
+ llassert(0);
+ break;
+ }
+
+ return linksetUse;
}
LLPathfindingLinkset::ELinksetUse LLFloaterPathfindingLinksets::getFilterLinksetUse() const
{
- return convertToLinksetUse(mFilterByLinksetUse->getValue());
+ return convertToLinksetUse(mFilterByLinksetUse->getValue());
}
void LLFloaterPathfindingLinksets::setFilterLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse)
{
- mFilterByLinksetUse->setValue(convertToXuiValue(pLinksetUse));
+ mFilterByLinksetUse->setValue(convertToXuiValue(pLinksetUse));
}
LLPathfindingLinkset::ELinksetUse LLFloaterPathfindingLinksets::getEditLinksetUse() const
{
- return convertToLinksetUse(mEditLinksetUse->getValue());
+ return convertToLinksetUse(mEditLinksetUse->getValue());
}
void LLFloaterPathfindingLinksets::setEditLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse)
{
- mEditLinksetUse->setValue(convertToXuiValue(pLinksetUse));
+ mEditLinksetUse->setValue(convertToXuiValue(pLinksetUse));
}
LLPathfindingLinkset::ELinksetUse LLFloaterPathfindingLinksets::convertToLinksetUse(LLSD pXuiValue) const
{
- LLPathfindingLinkset::ELinksetUse linkUse;
-
- switch (pXuiValue.asInteger())
- {
- case XUI_LINKSET_USE_NONE :
- linkUse = LLPathfindingLinkset::kUnknown;
- break;
- case XUI_LINKSET_USE_WALKABLE :
- linkUse = LLPathfindingLinkset::kWalkable;
- break;
- case XUI_LINKSET_USE_STATIC_OBSTACLE :
- linkUse = LLPathfindingLinkset::kStaticObstacle;
- break;
- case XUI_LINKSET_USE_DYNAMIC_OBSTACLE :
- linkUse = LLPathfindingLinkset::kDynamicObstacle;
- break;
- case XUI_LINKSET_USE_MATERIAL_VOLUME :
- linkUse = LLPathfindingLinkset::kMaterialVolume;
- break;
- case XUI_LINKSET_USE_EXCLUSION_VOLUME :
- linkUse = LLPathfindingLinkset::kExclusionVolume;
- break;
- case XUI_LINKSET_USE_DYNAMIC_PHANTOM :
- linkUse = LLPathfindingLinkset::kDynamicPhantom;
- break;
- default :
- linkUse = LLPathfindingLinkset::kUnknown;
- llassert(0);
- break;
- }
-
- return linkUse;
+ LLPathfindingLinkset::ELinksetUse linkUse;
+
+ switch (pXuiValue.asInteger())
+ {
+ case XUI_LINKSET_USE_NONE :
+ linkUse = LLPathfindingLinkset::kUnknown;
+ break;
+ case XUI_LINKSET_USE_WALKABLE :
+ linkUse = LLPathfindingLinkset::kWalkable;
+ break;
+ case XUI_LINKSET_USE_STATIC_OBSTACLE :
+ linkUse = LLPathfindingLinkset::kStaticObstacle;
+ break;
+ case XUI_LINKSET_USE_DYNAMIC_OBSTACLE :
+ linkUse = LLPathfindingLinkset::kDynamicObstacle;
+ break;
+ case XUI_LINKSET_USE_MATERIAL_VOLUME :
+ linkUse = LLPathfindingLinkset::kMaterialVolume;
+ break;
+ case XUI_LINKSET_USE_EXCLUSION_VOLUME :
+ linkUse = LLPathfindingLinkset::kExclusionVolume;
+ break;
+ case XUI_LINKSET_USE_DYNAMIC_PHANTOM :
+ linkUse = LLPathfindingLinkset::kDynamicPhantom;
+ break;
+ default :
+ linkUse = LLPathfindingLinkset::kUnknown;
+ llassert(0);
+ break;
+ }
+
+ return linkUse;
}
LLSD LLFloaterPathfindingLinksets::convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
- LLSD xuiValue;
-
- switch (pLinksetUse)
- {
- case LLPathfindingLinkset::kUnknown :
- xuiValue = XUI_LINKSET_USE_NONE;
- break;
- case LLPathfindingLinkset::kWalkable :
- xuiValue = XUI_LINKSET_USE_WALKABLE;
- break;
- case LLPathfindingLinkset::kStaticObstacle :
- xuiValue = XUI_LINKSET_USE_STATIC_OBSTACLE;
- break;
- case LLPathfindingLinkset::kDynamicObstacle :
- xuiValue = XUI_LINKSET_USE_DYNAMIC_OBSTACLE;
- break;
- case LLPathfindingLinkset::kMaterialVolume :
- xuiValue = XUI_LINKSET_USE_MATERIAL_VOLUME;
- break;
- case LLPathfindingLinkset::kExclusionVolume :
- xuiValue = XUI_LINKSET_USE_EXCLUSION_VOLUME;
- break;
- case LLPathfindingLinkset::kDynamicPhantom :
- xuiValue = XUI_LINKSET_USE_DYNAMIC_PHANTOM;
- break;
- default :
- xuiValue = XUI_LINKSET_USE_NONE;
- llassert(0);
- break;
- }
-
- return xuiValue;
+ LLSD xuiValue;
+
+ switch (pLinksetUse)
+ {
+ case LLPathfindingLinkset::kUnknown :
+ xuiValue = XUI_LINKSET_USE_NONE;
+ break;
+ case LLPathfindingLinkset::kWalkable :
+ xuiValue = XUI_LINKSET_USE_WALKABLE;
+ break;
+ case LLPathfindingLinkset::kStaticObstacle :
+ xuiValue = XUI_LINKSET_USE_STATIC_OBSTACLE;
+ break;
+ case LLPathfindingLinkset::kDynamicObstacle :
+ xuiValue = XUI_LINKSET_USE_DYNAMIC_OBSTACLE;
+ break;
+ case LLPathfindingLinkset::kMaterialVolume :
+ xuiValue = XUI_LINKSET_USE_MATERIAL_VOLUME;
+ break;
+ case LLPathfindingLinkset::kExclusionVolume :
+ xuiValue = XUI_LINKSET_USE_EXCLUSION_VOLUME;
+ break;
+ case LLPathfindingLinkset::kDynamicPhantom :
+ xuiValue = XUI_LINKSET_USE_DYNAMIC_PHANTOM;
+ break;
+ default :
+ xuiValue = XUI_LINKSET_USE_NONE;
+ llassert(0);
+ break;
+ }
+
+ return xuiValue;
}
diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h
index a954d8a8ec..e14f5c5663 100644
--- a/indra/newview/llfloaterpathfindinglinksets.h
+++ b/indra/newview/llfloaterpathfindinglinksets.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpathfindinglinksets.h
* @brief "Pathfinding linksets" floater, allowing manipulation of the linksets on the current region.
* @author Stinson@lindenlab.com
@@ -47,97 +47,97 @@ class LLSearchEditor;
class LLFloaterPathfindingLinksets : public LLFloaterPathfindingObjects
{
public:
- static void openLinksetsWithSelectedObjects();
+ static void openLinksetsWithSelectedObjects();
protected:
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
- LLFloaterPathfindingLinksets(const LLSD& pSeed);
- virtual ~LLFloaterPathfindingLinksets();
+ LLFloaterPathfindingLinksets(const LLSD& pSeed);
+ virtual ~LLFloaterPathfindingLinksets();
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- virtual void requestGetObjects();
+ virtual void requestGetObjects();
- virtual void buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr);
+ virtual void buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr);
- virtual void updateControlsOnScrollListChange();
+ virtual void updateControlsOnScrollListChange();
- virtual S32 getNameColumnIndex() const;
- virtual S32 getOwnerNameColumnIndex() const;
- virtual std::string getOwnerName(const LLPathfindingObject *pObject) const;
- virtual const LLColor4 &getBeaconColor() const;
+ virtual S32 getNameColumnIndex() const;
+ virtual S32 getOwnerNameColumnIndex() const;
+ virtual std::string getOwnerName(const LLPathfindingObject *pObject) const;
+ virtual const LLColor4 &getBeaconColor() const;
- virtual LLPathfindingObjectListPtr getEmptyObjectList() const;
+ virtual LLPathfindingObjectListPtr getEmptyObjectList() const;
private:
- void requestSetLinksets(LLPathfindingObjectListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD);
+ void requestSetLinksets(LLPathfindingObjectListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD);
- void onApplyAllFilters();
- void onClearFiltersClicked();
- void onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl, LLSD &pPreviousValue);
- void onApplyChangesClicked();
+ void onApplyAllFilters();
+ void onClearFiltersClicked();
+ void onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl, LLSD &pPreviousValue);
+ void onApplyChangesClicked();
- void clearFilters();
+ void clearFilters();
- void updateEditFieldValues();
- LLSD buildLinksetScrollListItemData(const LLPathfindingLinkset *pLinksetPtr, const LLVector3 &pAvatarPosition) const;
- LLSD buildLinksetUseScrollListData(const std::string &pLabel, S32 pValue) const;
+ void updateEditFieldValues();
+ LLSD buildLinksetScrollListItemData(const LLPathfindingLinkset *pLinksetPtr, const LLVector3 &pAvatarPosition) const;
+ LLSD buildLinksetUseScrollListData(const std::string &pLabel, S32 pValue) const;
- bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
- bool isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
- bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
+ bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
+ bool isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
+ bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
- void updateStateOnEditFields();
- void updateStateOnEditLinksetUse();
+ void updateStateOnEditFields();
+ void updateStateOnEditLinksetUse();
- void applyEdit();
- void handleApplyEdit(const LLSD &pNotification, const LLSD &pResponse);
- void doApplyEdit();
+ void applyEdit();
+ void handleApplyEdit(const LLSD &pNotification, const LLSD &pResponse);
+ void doApplyEdit();
- std::string getLinksetUseString(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
+ std::string getLinksetUseString(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
- LLPathfindingLinkset::ELinksetUse getFilterLinksetUse() const;
- void setFilterLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse);
+ LLPathfindingLinkset::ELinksetUse getFilterLinksetUse() const;
+ void setFilterLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse);
- LLPathfindingLinkset::ELinksetUse getEditLinksetUse() const;
- void setEditLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse);
+ LLPathfindingLinkset::ELinksetUse getEditLinksetUse() const;
+ void setEditLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse);
- LLPathfindingLinkset::ELinksetUse convertToLinksetUse(LLSD pXuiValue) const;
- LLSD convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
+ LLPathfindingLinkset::ELinksetUse convertToLinksetUse(LLSD pXuiValue) const;
+ LLSD convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
LLSearchEditor *mFilterByName;
LLSearchEditor *mFilterByDescription;
- LLComboBox *mFilterByLinksetUse;
- LLComboBox *mEditLinksetUse;
- LLScrollListItem *mEditLinksetUseUnset;
- LLScrollListItem *mEditLinksetUseWalkable;
- LLScrollListItem *mEditLinksetUseStaticObstacle;
- LLScrollListItem *mEditLinksetUseDynamicObstacle;
- LLScrollListItem *mEditLinksetUseMaterialVolume;
- LLScrollListItem *mEditLinksetUseExclusionVolume;
- LLScrollListItem *mEditLinksetUseDynamicPhantom;
- LLTextBase *mLabelWalkabilityCoefficients;
- LLTextBase *mLabelEditA;
- LLTextBase *mLabelSuggestedUseA;
- LLLineEditor *mEditA;
- LLTextBase *mLabelEditB;
- LLTextBase *mLabelSuggestedUseB;
- LLLineEditor *mEditB;
- LLTextBase *mLabelEditC;
- LLTextBase *mLabelSuggestedUseC;
- LLLineEditor *mEditC;
- LLTextBase *mLabelEditD;
- LLTextBase *mLabelSuggestedUseD;
- LLLineEditor *mEditD;
- LLButton *mApplyEditsButton;
-
- LLColor4 mBeaconColor;
-
- LLSD mPreviousValueA;
- LLSD mPreviousValueB;
- LLSD mPreviousValueC;
- LLSD mPreviousValueD;
+ LLComboBox *mFilterByLinksetUse;
+ LLComboBox *mEditLinksetUse;
+ LLScrollListItem *mEditLinksetUseUnset;
+ LLScrollListItem *mEditLinksetUseWalkable;
+ LLScrollListItem *mEditLinksetUseStaticObstacle;
+ LLScrollListItem *mEditLinksetUseDynamicObstacle;
+ LLScrollListItem *mEditLinksetUseMaterialVolume;
+ LLScrollListItem *mEditLinksetUseExclusionVolume;
+ LLScrollListItem *mEditLinksetUseDynamicPhantom;
+ LLTextBase *mLabelWalkabilityCoefficients;
+ LLTextBase *mLabelEditA;
+ LLTextBase *mLabelSuggestedUseA;
+ LLLineEditor *mEditA;
+ LLTextBase *mLabelEditB;
+ LLTextBase *mLabelSuggestedUseB;
+ LLLineEditor *mEditB;
+ LLTextBase *mLabelEditC;
+ LLTextBase *mLabelSuggestedUseC;
+ LLLineEditor *mEditC;
+ LLTextBase *mLabelEditD;
+ LLTextBase *mLabelSuggestedUseD;
+ LLLineEditor *mEditD;
+ LLButton *mApplyEditsButton;
+
+ LLColor4 mBeaconColor;
+
+ LLSD mPreviousValueA;
+ LLSD mPreviousValueB;
+ LLSD mPreviousValueC;
+ LLSD mPreviousValueD;
};
#endif // LL_LLFLOATERPATHFINDINGLINKSETS_H
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp
index 5cf16f3ad6..b264df085a 100644
--- a/indra/newview/llfloaterpathfindingobjects.cpp
+++ b/indra/newview/llfloaterpathfindingobjects.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpathfindingobjects.cpp
* @brief Base class for both the pathfinding linksets and characters floater.
* @author Stinson@lindenlab.com
@@ -72,819 +72,819 @@
void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey)
{
- LLFloater::onOpen(pKey);
+ LLFloater::onOpen(pKey);
- selectNoneObjects();
- mObjectsScrollList->setCommitOnSelectionChange(TRUE);
+ selectNoneObjects();
+ mObjectsScrollList->setCommitOnSelectionChange(TRUE);
- if (!mSelectionUpdateSlot.connected())
- {
- mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterPathfindingObjects::onInWorldSelectionListChanged, this));
- }
+ if (!mSelectionUpdateSlot.connected())
+ {
+ mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterPathfindingObjects::onInWorldSelectionListChanged, this));
+ }
- if (!mRegionBoundaryCrossingSlot.connected())
- {
- mRegionBoundaryCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterPathfindingObjects::onRegionBoundaryCrossed, this));
- }
+ if (!mRegionBoundaryCrossingSlot.connected())
+ {
+ mRegionBoundaryCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterPathfindingObjects::onRegionBoundaryCrossed, this));
+ }
- if (!mGodLevelChangeSlot.connected())
- {
- mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLFloaterPathfindingObjects::onGodLevelChange, this, _1));
- }
+ if (!mGodLevelChangeSlot.connected())
+ {
+ mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLFloaterPathfindingObjects::onGodLevelChange, this, _1));
+ }
- requestGetObjects();
+ requestGetObjects();
}
void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting)
{
- if (mGodLevelChangeSlot.connected())
- {
- mGodLevelChangeSlot.disconnect();
- }
+ if (mGodLevelChangeSlot.connected())
+ {
+ mGodLevelChangeSlot.disconnect();
+ }
- if (mRegionBoundaryCrossingSlot.connected())
- {
- mRegionBoundaryCrossingSlot.disconnect();
- }
+ if (mRegionBoundaryCrossingSlot.connected())
+ {
+ mRegionBoundaryCrossingSlot.disconnect();
+ }
- if (mSelectionUpdateSlot.connected())
- {
- mSelectionUpdateSlot.disconnect();
- }
+ if (mSelectionUpdateSlot.connected())
+ {
+ mSelectionUpdateSlot.disconnect();
+ }
- mObjectsScrollList->setCommitOnSelectionChange(FALSE);
- selectNoneObjects();
+ mObjectsScrollList->setCommitOnSelectionChange(FALSE);
+ selectNoneObjects();
- if (mObjectsSelection.notNull())
- {
- mObjectsSelection.clear();
- }
+ if (mObjectsSelection.notNull())
+ {
+ mObjectsSelection.clear();
+ }
- if (pIsAppQuitting)
- {
- clearAllObjects();
- }
+ if (pIsAppQuitting)
+ {
+ clearAllObjects();
+ }
}
void LLFloaterPathfindingObjects::draw()
{
- LLFloater::draw();
-
- if (isShowBeacons())
- {
- std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected();
- if (!selectedItems.empty())
- {
- int numSelectedItems = selectedItems.size();
- S32 nameColumnIndex = getNameColumnIndex();
- const LLColor4 &beaconColor = getBeaconColor();
- const LLColor4 &beaconTextColor = getBeaconTextColor();
- S32 beaconWidth = getBeaconWidth();
-
- std::vector<LLViewerObject *> viewerObjects;
- viewerObjects.reserve(numSelectedItems);
-
- for (std::vector<LLScrollListItem *>::const_iterator selectedItemIter = selectedItems.begin();
- selectedItemIter != selectedItems.end(); ++selectedItemIter)
- {
- const LLScrollListItem *selectedItem = *selectedItemIter;
-
- LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
- if (viewerObject != NULL)
- {
- const std::string &objectName = selectedItem->getColumn(nameColumnIndex)->getValue().asString();
- gObjectList.addDebugBeacon(viewerObject->getPositionAgent(), objectName, beaconColor, beaconTextColor, beaconWidth);
- }
- }
- }
- }
+ LLFloater::draw();
+
+ if (isShowBeacons())
+ {
+ std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected();
+ if (!selectedItems.empty())
+ {
+ int numSelectedItems = selectedItems.size();
+ S32 nameColumnIndex = getNameColumnIndex();
+ const LLColor4 &beaconColor = getBeaconColor();
+ const LLColor4 &beaconTextColor = getBeaconTextColor();
+ S32 beaconWidth = getBeaconWidth();
+
+ std::vector<LLViewerObject *> viewerObjects;
+ viewerObjects.reserve(numSelectedItems);
+
+ for (std::vector<LLScrollListItem *>::const_iterator selectedItemIter = selectedItems.begin();
+ selectedItemIter != selectedItems.end(); ++selectedItemIter)
+ {
+ const LLScrollListItem *selectedItem = *selectedItemIter;
+
+ LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
+ if (viewerObject != NULL)
+ {
+ const std::string &objectName = selectedItem->getColumn(nameColumnIndex)->getValue().asString();
+ gObjectList.addDebugBeacon(viewerObject->getPositionAgent(), objectName, beaconColor, beaconTextColor, beaconWidth);
+ }
+ }
+ }
+ }
}
LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed)
- : LLFloater(pSeed),
- mObjectsScrollList(NULL),
- mMessagingStatus(NULL),
- mRefreshListButton(NULL),
- mSelectAllButton(NULL),
- mSelectNoneButton(NULL),
- mShowBeaconCheckBox(NULL),
- mTakeButton(NULL),
- mTakeCopyButton(NULL),
- mReturnButton(NULL),
- mDeleteButton(NULL),
- mTeleportButton(NULL),
- mDefaultBeaconColor(),
- mDefaultBeaconTextColor(),
- mErrorTextColor(),
- mWarningTextColor(),
- mMessagingState(kMessagingUnknown),
- mMessagingRequestId(0U),
- mMissingNameObjectsScrollListItems(),
- mObjectList(),
- mObjectsSelection(),
- mHasObjectsToBeSelected(false),
- mObjectsToBeSelected(),
- mSelectionUpdateSlot(),
- mRegionBoundaryCrossingSlot()
+ : LLFloater(pSeed),
+ mObjectsScrollList(NULL),
+ mMessagingStatus(NULL),
+ mRefreshListButton(NULL),
+ mSelectAllButton(NULL),
+ mSelectNoneButton(NULL),
+ mShowBeaconCheckBox(NULL),
+ mTakeButton(NULL),
+ mTakeCopyButton(NULL),
+ mReturnButton(NULL),
+ mDeleteButton(NULL),
+ mTeleportButton(NULL),
+ mDefaultBeaconColor(),
+ mDefaultBeaconTextColor(),
+ mErrorTextColor(),
+ mWarningTextColor(),
+ mMessagingState(kMessagingUnknown),
+ mMessagingRequestId(0U),
+ mMissingNameObjectsScrollListItems(),
+ mObjectList(),
+ mObjectsSelection(),
+ mHasObjectsToBeSelected(false),
+ mObjectsToBeSelected(),
+ mSelectionUpdateSlot(),
+ mRegionBoundaryCrossingSlot()
{
}
LLFloaterPathfindingObjects::~LLFloaterPathfindingObjects()
{
- clearAllObjects();
+ clearAllObjects();
}
BOOL LLFloaterPathfindingObjects::postBuild()
{
- mDefaultBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingDefaultBeaconColor");
- mDefaultBeaconTextColor = LLUIColorTable::getInstance()->getColor("PathfindingDefaultBeaconTextColor");
- mErrorTextColor = LLUIColorTable::getInstance()->getColor("PathfindingErrorColor");
- mWarningTextColor = LLUIColorTable::getInstance()->getColor("PathfindingWarningColor");
+ mDefaultBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingDefaultBeaconColor");
+ mDefaultBeaconTextColor = LLUIColorTable::getInstance()->getColor("PathfindingDefaultBeaconTextColor");
+ mErrorTextColor = LLUIColorTable::getInstance()->getColor("PathfindingErrorColor");
+ mWarningTextColor = LLUIColorTable::getInstance()->getColor("PathfindingWarningColor");
- mObjectsScrollList = findChild<LLScrollListCtrl>("objects_scroll_list");
- llassert(mObjectsScrollList != NULL);
- mObjectsScrollList->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onScrollListSelectionChanged, this));
- mObjectsScrollList->sortByColumnIndex(static_cast<U32>(getNameColumnIndex()), TRUE);
+ mObjectsScrollList = findChild<LLScrollListCtrl>("objects_scroll_list");
+ llassert(mObjectsScrollList != NULL);
+ mObjectsScrollList->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onScrollListSelectionChanged, this));
+ mObjectsScrollList->sortByColumnIndex(static_cast<U32>(getNameColumnIndex()), TRUE);
- mMessagingStatus = findChild<LLTextBase>("messaging_status");
- llassert(mMessagingStatus != NULL);
+ mMessagingStatus = findChild<LLTextBase>("messaging_status");
+ llassert(mMessagingStatus != NULL);
- mRefreshListButton = findChild<LLButton>("refresh_objects_list");
- llassert(mRefreshListButton != NULL);
- mRefreshListButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onRefreshObjectsClicked, this));
+ mRefreshListButton = findChild<LLButton>("refresh_objects_list");
+ llassert(mRefreshListButton != NULL);
+ mRefreshListButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onRefreshObjectsClicked, this));
- mSelectAllButton = findChild<LLButton>("select_all_objects");
- llassert(mSelectAllButton != NULL);
- mSelectAllButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onSelectAllObjectsClicked, this));
+ mSelectAllButton = findChild<LLButton>("select_all_objects");
+ llassert(mSelectAllButton != NULL);
+ mSelectAllButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onSelectAllObjectsClicked, this));
- mSelectNoneButton = findChild<LLButton>("select_none_objects");
- llassert(mSelectNoneButton != NULL);
- mSelectNoneButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onSelectNoneObjectsClicked, this));
+ mSelectNoneButton = findChild<LLButton>("select_none_objects");
+ llassert(mSelectNoneButton != NULL);
+ mSelectNoneButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onSelectNoneObjectsClicked, this));
- mShowBeaconCheckBox = findChild<LLCheckBoxCtrl>("show_beacon");
- llassert(mShowBeaconCheckBox != NULL);
+ mShowBeaconCheckBox = findChild<LLCheckBoxCtrl>("show_beacon");
+ llassert(mShowBeaconCheckBox != NULL);
- mTakeButton = findChild<LLButton>("take_objects");
- llassert(mTakeButton != NULL);
- mTakeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeClicked, this));
+ mTakeButton = findChild<LLButton>("take_objects");
+ llassert(mTakeButton != NULL);
+ mTakeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeClicked, this));
- mTakeCopyButton = findChild<LLButton>("take_copy_objects");
- llassert(mTakeCopyButton != NULL);
- mTakeCopyButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeCopyClicked, this));
+ mTakeCopyButton = findChild<LLButton>("take_copy_objects");
+ llassert(mTakeCopyButton != NULL);
+ mTakeCopyButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeCopyClicked, this));
- mReturnButton = findChild<LLButton>("return_objects");
- llassert(mReturnButton != NULL);
- mReturnButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onReturnClicked, this));
+ mReturnButton = findChild<LLButton>("return_objects");
+ llassert(mReturnButton != NULL);
+ mReturnButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onReturnClicked, this));
- mDeleteButton = findChild<LLButton>("delete_objects");
- llassert(mDeleteButton != NULL);
- mDeleteButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onDeleteClicked, this));
+ mDeleteButton = findChild<LLButton>("delete_objects");
+ llassert(mDeleteButton != NULL);
+ mDeleteButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onDeleteClicked, this));
- mTeleportButton = findChild<LLButton>("teleport_me_to_object");
- llassert(mTeleportButton != NULL);
- mTeleportButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTeleportClicked, this));
+ mTeleportButton = findChild<LLButton>("teleport_me_to_object");
+ llassert(mTeleportButton != NULL);
+ mTeleportButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTeleportClicked, this));
- return LLFloater::postBuild();
+ return LLFloater::postBuild();
}
void LLFloaterPathfindingObjects::requestGetObjects()
{
- llassert(0);
+ llassert(0);
}
LLPathfindingManager::request_id_t LLFloaterPathfindingObjects::getNewRequestId()
{
- return ++mMessagingRequestId;
+ return ++mMessagingRequestId;
}
void LLFloaterPathfindingObjects::handleNewObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList)
{
- llassert(pRequestId <= mMessagingRequestId);
- if (pRequestId == mMessagingRequestId)
- {
- switch (pRequestStatus)
- {
- case LLPathfindingManager::kRequestStarted :
- setMessagingState(kMessagingGetRequestSent);
- break;
- case LLPathfindingManager::kRequestCompleted :
- mObjectList = pObjectList;
- rebuildObjectsScrollList();
- setMessagingState(kMessagingComplete);
- break;
- case LLPathfindingManager::kRequestNotEnabled :
- clearAllObjects();
- setMessagingState(kMessagingNotEnabled);
- break;
- case LLPathfindingManager::kRequestError :
- clearAllObjects();
- setMessagingState(kMessagingGetError);
- break;
- default :
- clearAllObjects();
- setMessagingState(kMessagingGetError);
- llassert(0);
- break;
- }
- }
+ llassert(pRequestId <= mMessagingRequestId);
+ if (pRequestId == mMessagingRequestId)
+ {
+ switch (pRequestStatus)
+ {
+ case LLPathfindingManager::kRequestStarted :
+ setMessagingState(kMessagingGetRequestSent);
+ break;
+ case LLPathfindingManager::kRequestCompleted :
+ mObjectList = pObjectList;
+ rebuildObjectsScrollList();
+ setMessagingState(kMessagingComplete);
+ break;
+ case LLPathfindingManager::kRequestNotEnabled :
+ clearAllObjects();
+ setMessagingState(kMessagingNotEnabled);
+ break;
+ case LLPathfindingManager::kRequestError :
+ clearAllObjects();
+ setMessagingState(kMessagingGetError);
+ break;
+ default :
+ clearAllObjects();
+ setMessagingState(kMessagingGetError);
+ llassert(0);
+ break;
+ }
+ }
}
void LLFloaterPathfindingObjects::handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList)
{
- // We current assume that handleUpdateObjectList is called only when objects are being SET
- llassert(pRequestId <= mMessagingRequestId);
- if (pRequestId == mMessagingRequestId)
- {
- switch (pRequestStatus)
- {
- case LLPathfindingManager::kRequestStarted :
- setMessagingState(kMessagingSetRequestSent);
- break;
- case LLPathfindingManager::kRequestCompleted :
- if (mObjectList == NULL)
- {
- mObjectList = pObjectList;
- }
- else
- {
- mObjectList->update(pObjectList);
- }
- rebuildObjectsScrollList();
- setMessagingState(kMessagingComplete);
- break;
- case LLPathfindingManager::kRequestNotEnabled :
- clearAllObjects();
- setMessagingState(kMessagingNotEnabled);
- break;
- case LLPathfindingManager::kRequestError :
- clearAllObjects();
- setMessagingState(kMessagingSetError);
- break;
- default :
- clearAllObjects();
- setMessagingState(kMessagingSetError);
- llassert(0);
- break;
- }
- }
+ // We current assume that handleUpdateObjectList is called only when objects are being SET
+ llassert(pRequestId <= mMessagingRequestId);
+ if (pRequestId == mMessagingRequestId)
+ {
+ switch (pRequestStatus)
+ {
+ case LLPathfindingManager::kRequestStarted :
+ setMessagingState(kMessagingSetRequestSent);
+ break;
+ case LLPathfindingManager::kRequestCompleted :
+ if (mObjectList == NULL)
+ {
+ mObjectList = pObjectList;
+ }
+ else
+ {
+ mObjectList->update(pObjectList);
+ }
+ rebuildObjectsScrollList();
+ setMessagingState(kMessagingComplete);
+ break;
+ case LLPathfindingManager::kRequestNotEnabled :
+ clearAllObjects();
+ setMessagingState(kMessagingNotEnabled);
+ break;
+ case LLPathfindingManager::kRequestError :
+ clearAllObjects();
+ setMessagingState(kMessagingSetError);
+ break;
+ default :
+ clearAllObjects();
+ setMessagingState(kMessagingSetError);
+ llassert(0);
+ break;
+ }
+ }
}
void LLFloaterPathfindingObjects::rebuildObjectsScrollList(bool update_if_needed)
{
- if (!mHasObjectsToBeSelected)
- {
- std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
- int numSelectedItems = selectedItems.size();
- if (numSelectedItems > 0)
- {
- mObjectsToBeSelected.reserve(selectedItems.size());
- for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin();
- itemIter != selectedItems.end(); ++itemIter)
- {
- const LLScrollListItem *listItem = *itemIter;
- mObjectsToBeSelected.push_back(listItem->getUUID());
- }
- }
- }
-
- S32 origScrollPosition = mObjectsScrollList->getScrollPos();
- mObjectsScrollList->deleteAllItems();
- mMissingNameObjectsScrollListItems.clear();
-
- if ((mObjectList != NULL) && !mObjectList->isEmpty())
- {
- buildObjectsScrollList(mObjectList);
-
- if(mObjectsScrollList->selectMultiple(mObjectsToBeSelected) == 0)
- {
- if(update_if_needed && mRefreshListButton->getEnabled())
- {
- requestGetObjects();
- return;
- }
- }
- if (mHasObjectsToBeSelected)
- {
- mObjectsScrollList->scrollToShowSelected();
- }
- else
- {
- mObjectsScrollList->setScrollPos(origScrollPosition);
- }
- }
-
- mObjectsToBeSelected.clear();
- mHasObjectsToBeSelected = false;
-
- updateControlsOnScrollListChange();
+ if (!mHasObjectsToBeSelected)
+ {
+ std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
+ int numSelectedItems = selectedItems.size();
+ if (numSelectedItems > 0)
+ {
+ mObjectsToBeSelected.reserve(selectedItems.size());
+ for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin();
+ itemIter != selectedItems.end(); ++itemIter)
+ {
+ const LLScrollListItem *listItem = *itemIter;
+ mObjectsToBeSelected.push_back(listItem->getUUID());
+ }
+ }
+ }
+
+ S32 origScrollPosition = mObjectsScrollList->getScrollPos();
+ mObjectsScrollList->deleteAllItems();
+ mMissingNameObjectsScrollListItems.clear();
+
+ if ((mObjectList != NULL) && !mObjectList->isEmpty())
+ {
+ buildObjectsScrollList(mObjectList);
+
+ if(mObjectsScrollList->selectMultiple(mObjectsToBeSelected) == 0)
+ {
+ if(update_if_needed && mRefreshListButton->getEnabled())
+ {
+ requestGetObjects();
+ return;
+ }
+ }
+ if (mHasObjectsToBeSelected)
+ {
+ mObjectsScrollList->scrollToShowSelected();
+ }
+ else
+ {
+ mObjectsScrollList->setScrollPos(origScrollPosition);
+ }
+ }
+
+ mObjectsToBeSelected.clear();
+ mHasObjectsToBeSelected = false;
+
+ updateControlsOnScrollListChange();
}
void LLFloaterPathfindingObjects::buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr)
{
- llassert(0);
+ llassert(0);
}
void LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjectPtr pObjectPtr, const LLSD &pScrollListItemData)
{
- LLScrollListCell::Params cellParams;
- cellParams.font = LLFontGL::getFontSansSerif();
+ LLScrollListCell::Params cellParams;
+ cellParams.font = LLFontGL::getFontSansSerif();
- LLScrollListItem::Params rowParams;
- rowParams.value = pObjectPtr->getUUID().asString();
+ LLScrollListItem::Params rowParams;
+ rowParams.value = pObjectPtr->getUUID().asString();
- llassert(pScrollListItemData.isArray());
- for (LLSD::array_const_iterator cellIter = pScrollListItemData.beginArray();
- cellIter != pScrollListItemData.endArray(); ++cellIter)
- {
- const LLSD &cellElement = *cellIter;
+ llassert(pScrollListItemData.isArray());
+ for (LLSD::array_const_iterator cellIter = pScrollListItemData.beginArray();
+ cellIter != pScrollListItemData.endArray(); ++cellIter)
+ {
+ const LLSD &cellElement = *cellIter;
- llassert(cellElement.has("column"));
- llassert(cellElement.get("column").isString());
- cellParams.column = cellElement.get("column").asString();
+ llassert(cellElement.has("column"));
+ llassert(cellElement.get("column").isString());
+ cellParams.column = cellElement.get("column").asString();
- llassert(cellElement.has("value"));
- llassert(cellElement.get("value").isString());
- cellParams.value = cellElement.get("value").asString();
+ llassert(cellElement.has("value"));
+ llassert(cellElement.get("value").isString());
+ cellParams.value = cellElement.get("value").asString();
- rowParams.columns.add(cellParams);
- }
+ rowParams.columns.add(cellParams);
+ }
- LLScrollListItem *scrollListItem = mObjectsScrollList->addRow(rowParams);
+ LLScrollListItem *scrollListItem = mObjectsScrollList->addRow(rowParams);
- if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName())
- {
- mMissingNameObjectsScrollListItems.insert(scroll_list_item_map::value_type(pObjectPtr->getUUID().asString(), scrollListItem));
- pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1));
- }
+ if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName())
+ {
+ mMissingNameObjectsScrollListItems.insert(scroll_list_item_map::value_type(pObjectPtr->getUUID().asString(), scrollListItem));
+ pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1));
+ }
}
void LLFloaterPathfindingObjects::updateControlsOnScrollListChange()
{
- updateMessagingStatus();
- updateStateOnListControls();
- selectScrollListItemsInWorld();
- updateStateOnActionControls();
+ updateMessagingStatus();
+ updateStateOnListControls();
+ selectScrollListItemsInWorld();
+ updateStateOnActionControls();
}
void LLFloaterPathfindingObjects::updateControlsOnInWorldSelectionChange()
{
- updateStateOnActionControls();
+ updateStateOnActionControls();
}
S32 LLFloaterPathfindingObjects::getNameColumnIndex() const
{
- return 0;
+ return 0;
}
S32 LLFloaterPathfindingObjects::getOwnerNameColumnIndex() const
{
- return 2;
+ return 2;
}
std::string LLFloaterPathfindingObjects::getOwnerName(const LLPathfindingObject *pObject) const
{
- llassert(0);
- std::string returnVal;
- return returnVal;
+ llassert(0);
+ std::string returnVal;
+ return returnVal;
}
const LLColor4 &LLFloaterPathfindingObjects::getBeaconColor() const
{
- return mDefaultBeaconColor;
+ return mDefaultBeaconColor;
}
const LLColor4 &LLFloaterPathfindingObjects::getBeaconTextColor() const
{
- return mDefaultBeaconTextColor;
+ return mDefaultBeaconTextColor;
}
S32 LLFloaterPathfindingObjects::getBeaconWidth() const
{
- return DEFAULT_BEACON_WIDTH;
+ return DEFAULT_BEACON_WIDTH;
}
void LLFloaterPathfindingObjects::showFloaterWithSelectionObjects()
{
- mObjectsToBeSelected.clear();
-
- LLObjectSelectionHandle selectedObjectsHandle = LLSelectMgr::getInstance()->getSelection();
- if (selectedObjectsHandle.notNull())
- {
- LLObjectSelection *selectedObjects = selectedObjectsHandle.get();
- if (!selectedObjects->isEmpty())
- {
- for (LLObjectSelection::valid_iterator objectIter = selectedObjects->valid_begin();
- objectIter != selectedObjects->valid_end(); ++objectIter)
- {
- LLSelectNode *object = *objectIter;
- LLViewerObject *viewerObject = object->getObject();
- mObjectsToBeSelected.push_back(viewerObject->getID());
- }
- }
- }
- mHasObjectsToBeSelected = true;
-
- if (!isShown())
- {
- openFloater();
- setVisibleAndFrontmost();
- }
- else
- {
- rebuildObjectsScrollList(true);
- if (isMinimized())
- {
- setMinimized(FALSE);
- }
- setVisibleAndFrontmost();
- }
- setFocus(TRUE);
+ mObjectsToBeSelected.clear();
+
+ LLObjectSelectionHandle selectedObjectsHandle = LLSelectMgr::getInstance()->getSelection();
+ if (selectedObjectsHandle.notNull())
+ {
+ LLObjectSelection *selectedObjects = selectedObjectsHandle.get();
+ if (!selectedObjects->isEmpty())
+ {
+ for (LLObjectSelection::valid_iterator objectIter = selectedObjects->valid_begin();
+ objectIter != selectedObjects->valid_end(); ++objectIter)
+ {
+ LLSelectNode *object = *objectIter;
+ LLViewerObject *viewerObject = object->getObject();
+ mObjectsToBeSelected.push_back(viewerObject->getID());
+ }
+ }
+ }
+ mHasObjectsToBeSelected = true;
+
+ if (!isShown())
+ {
+ openFloater();
+ setVisibleAndFrontmost();
+ }
+ else
+ {
+ rebuildObjectsScrollList(true);
+ if (isMinimized())
+ {
+ setMinimized(FALSE);
+ }
+ setVisibleAndFrontmost();
+ }
+ setFocus(TRUE);
}
BOOL LLFloaterPathfindingObjects::isShowBeacons() const
{
- return mShowBeaconCheckBox->get();
+ return mShowBeaconCheckBox->get();
}
void LLFloaterPathfindingObjects::clearAllObjects()
{
- selectNoneObjects();
- mObjectsScrollList->deleteAllItems();
- mMissingNameObjectsScrollListItems.clear();
- mObjectList.reset();
+ selectNoneObjects();
+ mObjectsScrollList->deleteAllItems();
+ mMissingNameObjectsScrollListItems.clear();
+ mObjectList.reset();
}
void LLFloaterPathfindingObjects::selectAllObjects()
{
- mObjectsScrollList->selectAll();
+ mObjectsScrollList->selectAll();
}
void LLFloaterPathfindingObjects::selectNoneObjects()
{
- mObjectsScrollList->deselectAllItems();
+ mObjectsScrollList->deselectAllItems();
}
void LLFloaterPathfindingObjects::teleportToSelectedObject()
{
- std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
- llassert(selectedItems.size() == 1);
- if (selectedItems.size() == 1)
- {
- std::vector<LLScrollListItem*>::const_reference selectedItemRef = selectedItems.front();
- const LLScrollListItem *selectedItem = selectedItemRef;
- llassert(mObjectList != NULL);
- LLVector3d teleportLocation;
- LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
- if (viewerObject == NULL)
- {
- // If we cannot find the object in the viewer list, teleport to the last reported position
- const LLPathfindingObjectPtr objectPtr = mObjectList->find(selectedItem->getUUID().asString());
- teleportLocation = gAgent.getPosGlobalFromAgent(objectPtr->getLocation());
- }
- else
- {
- // If we can find the object in the viewer list, teleport to the known current position
- teleportLocation = viewerObject->getPositionGlobal();
- }
- gAgent.teleportViaLocationLookAt(teleportLocation);
- }
+ std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
+ llassert(selectedItems.size() == 1);
+ if (selectedItems.size() == 1)
+ {
+ std::vector<LLScrollListItem*>::const_reference selectedItemRef = selectedItems.front();
+ const LLScrollListItem *selectedItem = selectedItemRef;
+ llassert(mObjectList != NULL);
+ LLVector3d teleportLocation;
+ LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
+ if (viewerObject == NULL)
+ {
+ // If we cannot find the object in the viewer list, teleport to the last reported position
+ const LLPathfindingObjectPtr objectPtr = mObjectList->find(selectedItem->getUUID().asString());
+ teleportLocation = gAgent.getPosGlobalFromAgent(objectPtr->getLocation());
+ }
+ else
+ {
+ // If we can find the object in the viewer list, teleport to the known current position
+ teleportLocation = viewerObject->getPositionGlobal();
+ }
+ gAgent.teleportViaLocationLookAt(teleportLocation);
+ }
}
LLPathfindingObjectListPtr LLFloaterPathfindingObjects::getEmptyObjectList() const
{
- llassert(0);
- LLPathfindingObjectListPtr objectListPtr(new LLPathfindingObjectList());
- return objectListPtr;
+ llassert(0);
+ LLPathfindingObjectListPtr objectListPtr(new LLPathfindingObjectList());
+ return objectListPtr;
}
int LLFloaterPathfindingObjects::getNumSelectedObjects() const
{
- return mObjectsScrollList->getNumSelected();
+ return mObjectsScrollList->getNumSelected();
}
LLPathfindingObjectListPtr LLFloaterPathfindingObjects::getSelectedObjects() const
{
- LLPathfindingObjectListPtr selectedObjects = getEmptyObjectList();
+ LLPathfindingObjectListPtr selectedObjects = getEmptyObjectList();
- std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
- if (!selectedItems.empty())
- {
- for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin();
- itemIter != selectedItems.end(); ++itemIter)
- {
- LLPathfindingObjectPtr objectPtr = findObject(*itemIter);
- if (objectPtr != NULL)
- {
- selectedObjects->update(objectPtr);
- }
- }
- }
+ std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
+ if (!selectedItems.empty())
+ {
+ for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin();
+ itemIter != selectedItems.end(); ++itemIter)
+ {
+ LLPathfindingObjectPtr objectPtr = findObject(*itemIter);
+ if (objectPtr != NULL)
+ {
+ selectedObjects->update(objectPtr);
+ }
+ }
+ }
- return selectedObjects;
+ return selectedObjects;
}
LLPathfindingObjectPtr LLFloaterPathfindingObjects::getFirstSelectedObject() const
{
- LLPathfindingObjectPtr objectPtr;
+ LLPathfindingObjectPtr objectPtr;
- std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
- if (!selectedItems.empty())
- {
- objectPtr = findObject(selectedItems.front());
- }
+ std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
+ if (!selectedItems.empty())
+ {
+ objectPtr = findObject(selectedItems.front());
+ }
- return objectPtr;
+ return objectPtr;
}
LLFloaterPathfindingObjects::EMessagingState LLFloaterPathfindingObjects::getMessagingState() const
{
- return mMessagingState;
+ return mMessagingState;
}
void LLFloaterPathfindingObjects::setMessagingState(EMessagingState pMessagingState)
{
- mMessagingState = pMessagingState;
- updateControlsOnScrollListChange();
+ mMessagingState = pMessagingState;
+ updateControlsOnScrollListChange();
}
void LLFloaterPathfindingObjects::onRefreshObjectsClicked()
{
- requestGetObjects();
+ requestGetObjects();
}
void LLFloaterPathfindingObjects::onSelectAllObjectsClicked()
{
- selectAllObjects();
+ selectAllObjects();
}
void LLFloaterPathfindingObjects::onSelectNoneObjectsClicked()
{
- selectNoneObjects();
+ selectNoneObjects();
}
void LLFloaterPathfindingObjects::onTakeClicked()
{
- handle_take();
- requestGetObjects();
+ handle_take();
+ requestGetObjects();
}
void LLFloaterPathfindingObjects::onTakeCopyClicked()
{
- handle_take_copy();
+ handle_take_copy();
}
void LLFloaterPathfindingObjects::onReturnClicked()
{
- LLNotification::Params params("PathfindingReturnMultipleItems");
- params.functor.function(boost::bind(&LLFloaterPathfindingObjects::handleReturnItemsResponse, this, _1, _2));
+ LLNotification::Params params("PathfindingReturnMultipleItems");
+ params.functor.function(boost::bind(&LLFloaterPathfindingObjects::handleReturnItemsResponse, this, _1, _2));
- LLSD substitutions;
- int numItems = getNumSelectedObjects();
- substitutions["NUM_ITEMS"] = static_cast<LLSD::Integer>(numItems);
- params.substitutions = substitutions;
+ LLSD substitutions;
+ int numItems = getNumSelectedObjects();
+ substitutions["NUM_ITEMS"] = static_cast<LLSD::Integer>(numItems);
+ params.substitutions = substitutions;
- if (numItems == 1)
- {
- LLNotifications::getInstance()->forceResponse(params, 0);
- }
- else if (numItems > 1)
- {
- LLNotifications::getInstance()->add(params);
- }
+ if (numItems == 1)
+ {
+ LLNotifications::getInstance()->forceResponse(params, 0);
+ }
+ else if (numItems > 1)
+ {
+ LLNotifications::getInstance()->add(params);
+ }
}
void LLFloaterPathfindingObjects::onDeleteClicked()
{
- LLNotification::Params params("PathfindingDeleteMultipleItems");
- params.functor.function(boost::bind(&LLFloaterPathfindingObjects::handleDeleteItemsResponse, this, _1, _2));
+ LLNotification::Params params("PathfindingDeleteMultipleItems");
+ params.functor.function(boost::bind(&LLFloaterPathfindingObjects::handleDeleteItemsResponse, this, _1, _2));
- LLSD substitutions;
- int numItems = getNumSelectedObjects();
- substitutions["NUM_ITEMS"] = static_cast<LLSD::Integer>(numItems);
- params.substitutions = substitutions;
+ LLSD substitutions;
+ int numItems = getNumSelectedObjects();
+ substitutions["NUM_ITEMS"] = static_cast<LLSD::Integer>(numItems);
+ params.substitutions = substitutions;
- if (numItems == 1)
- {
- LLNotifications::getInstance()->forceResponse(params, 0);
- }
- else if (numItems > 1)
- {
- LLNotifications::getInstance()->add(params);
- }
+ if (numItems == 1)
+ {
+ LLNotifications::getInstance()->forceResponse(params, 0);
+ }
+ else if (numItems > 1)
+ {
+ LLNotifications::getInstance()->add(params);
+ }
}
void LLFloaterPathfindingObjects::onTeleportClicked()
{
- teleportToSelectedObject();
+ teleportToSelectedObject();
}
void LLFloaterPathfindingObjects::onScrollListSelectionChanged()
{
- updateControlsOnScrollListChange();
+ updateControlsOnScrollListChange();
}
void LLFloaterPathfindingObjects::onInWorldSelectionListChanged()
{
- updateControlsOnInWorldSelectionChange();
+ updateControlsOnInWorldSelectionChange();
}
void LLFloaterPathfindingObjects::onRegionBoundaryCrossed()
{
- requestGetObjects();
+ requestGetObjects();
}
void LLFloaterPathfindingObjects::onGodLevelChange(U8 pGodLevel)
{
- requestGetObjects();
+ requestGetObjects();
}
void LLFloaterPathfindingObjects::handleObjectNameResponse(const LLPathfindingObject *pObject)
{
- llassert(pObject != NULL);
- const std::string uuid = pObject->getUUID().asString();
- scroll_list_item_map::iterator scrollListItemIter = mMissingNameObjectsScrollListItems.find(uuid);
- if (scrollListItemIter != mMissingNameObjectsScrollListItems.end())
- {
- LLScrollListItem *scrollListItem = scrollListItemIter->second;
- llassert(scrollListItem != NULL);
+ llassert(pObject != NULL);
+ const std::string uuid = pObject->getUUID().asString();
+ scroll_list_item_map::iterator scrollListItemIter = mMissingNameObjectsScrollListItems.find(uuid);
+ if (scrollListItemIter != mMissingNameObjectsScrollListItems.end())
+ {
+ LLScrollListItem *scrollListItem = scrollListItemIter->second;
+ llassert(scrollListItem != NULL);
- LLScrollListCell *scrollListCell = scrollListItem->getColumn(getOwnerNameColumnIndex());
- LLSD ownerName = getOwnerName(pObject);
+ LLScrollListCell *scrollListCell = scrollListItem->getColumn(getOwnerNameColumnIndex());
+ LLSD ownerName = getOwnerName(pObject);
- scrollListCell->setValue(ownerName);
+ scrollListCell->setValue(ownerName);
- mMissingNameObjectsScrollListItems.erase(scrollListItemIter);
- }
+ mMissingNameObjectsScrollListItems.erase(scrollListItemIter);
+ }
}
void LLFloaterPathfindingObjects::updateMessagingStatus()
{
- std::string statusText("");
- LLStyle::Params styleParams;
-
- switch (getMessagingState())
- {
- case kMessagingUnknown:
- statusText = getString("messaging_initial");
- styleParams.color = mErrorTextColor;
- break;
- case kMessagingGetRequestSent :
- statusText = getString("messaging_get_inprogress");
- styleParams.color = mWarningTextColor;
- break;
- case kMessagingGetError :
- statusText = getString("messaging_get_error");
- styleParams.color = mErrorTextColor;
- break;
- case kMessagingSetRequestSent :
- statusText = getString("messaging_set_inprogress");
- styleParams.color = mWarningTextColor;
- break;
- case kMessagingSetError :
- statusText = getString("messaging_set_error");
- styleParams.color = mErrorTextColor;
- break;
- case kMessagingComplete :
- if (mObjectsScrollList->isEmpty())
- {
- statusText = getString("messaging_complete_none_found");
- }
- else
- {
- S32 numItems = mObjectsScrollList->getItemCount();
- S32 numSelectedItems = mObjectsScrollList->getNumSelected();
-
- LLLocale locale(LLStringUtil::getLocale());
- std::string numItemsString;
- LLResMgr::getInstance()->getIntegerString(numItemsString, numItems);
-
- std::string numSelectedItemsString;
- LLResMgr::getInstance()->getIntegerString(numSelectedItemsString, numSelectedItems);
-
- LLStringUtil::format_map_t string_args;
- string_args["[NUM_SELECTED]"] = numSelectedItemsString;
- string_args["[NUM_TOTAL]"] = numItemsString;
- statusText = getString("messaging_complete_available", string_args);
- }
- break;
- case kMessagingNotEnabled :
- statusText = getString("messaging_not_enabled");
- styleParams.color = mErrorTextColor;
- break;
- default:
- statusText = getString("messaging_initial");
- styleParams.color = mErrorTextColor;
- llassert(0);
- break;
- }
-
- mMessagingStatus->setText((LLStringExplicit)statusText, styleParams);
+ std::string statusText("");
+ LLStyle::Params styleParams;
+
+ switch (getMessagingState())
+ {
+ case kMessagingUnknown:
+ statusText = getString("messaging_initial");
+ styleParams.color = mErrorTextColor;
+ break;
+ case kMessagingGetRequestSent :
+ statusText = getString("messaging_get_inprogress");
+ styleParams.color = mWarningTextColor;
+ break;
+ case kMessagingGetError :
+ statusText = getString("messaging_get_error");
+ styleParams.color = mErrorTextColor;
+ break;
+ case kMessagingSetRequestSent :
+ statusText = getString("messaging_set_inprogress");
+ styleParams.color = mWarningTextColor;
+ break;
+ case kMessagingSetError :
+ statusText = getString("messaging_set_error");
+ styleParams.color = mErrorTextColor;
+ break;
+ case kMessagingComplete :
+ if (mObjectsScrollList->isEmpty())
+ {
+ statusText = getString("messaging_complete_none_found");
+ }
+ else
+ {
+ S32 numItems = mObjectsScrollList->getItemCount();
+ S32 numSelectedItems = mObjectsScrollList->getNumSelected();
+
+ LLLocale locale(LLStringUtil::getLocale());
+ std::string numItemsString;
+ LLResMgr::getInstance()->getIntegerString(numItemsString, numItems);
+
+ std::string numSelectedItemsString;
+ LLResMgr::getInstance()->getIntegerString(numSelectedItemsString, numSelectedItems);
+
+ LLStringUtil::format_map_t string_args;
+ string_args["[NUM_SELECTED]"] = numSelectedItemsString;
+ string_args["[NUM_TOTAL]"] = numItemsString;
+ statusText = getString("messaging_complete_available", string_args);
+ }
+ break;
+ case kMessagingNotEnabled :
+ statusText = getString("messaging_not_enabled");
+ styleParams.color = mErrorTextColor;
+ break;
+ default:
+ statusText = getString("messaging_initial");
+ styleParams.color = mErrorTextColor;
+ llassert(0);
+ break;
+ }
+
+ mMessagingStatus->setText((LLStringExplicit)statusText, styleParams);
}
void LLFloaterPathfindingObjects::updateStateOnListControls()
{
- switch (getMessagingState())
- {
- case kMessagingUnknown:
- case kMessagingGetRequestSent :
- case kMessagingSetRequestSent :
- mRefreshListButton->setEnabled(FALSE);
- mSelectAllButton->setEnabled(FALSE);
- mSelectNoneButton->setEnabled(FALSE);
- break;
- case kMessagingGetError :
- case kMessagingSetError :
- case kMessagingNotEnabled :
- mRefreshListButton->setEnabled(TRUE);
- mSelectAllButton->setEnabled(FALSE);
- mSelectNoneButton->setEnabled(FALSE);
- break;
- case kMessagingComplete :
- {
- int numItems = mObjectsScrollList->getItemCount();
- int numSelectedItems = mObjectsScrollList->getNumSelected();
- mRefreshListButton->setEnabled(TRUE);
- mSelectAllButton->setEnabled(numSelectedItems < numItems);
- mSelectNoneButton->setEnabled(numSelectedItems > 0);
- }
- break;
- default:
- llassert(0);
- break;
- }
+ switch (getMessagingState())
+ {
+ case kMessagingUnknown:
+ case kMessagingGetRequestSent :
+ case kMessagingSetRequestSent :
+ mRefreshListButton->setEnabled(FALSE);
+ mSelectAllButton->setEnabled(FALSE);
+ mSelectNoneButton->setEnabled(FALSE);
+ break;
+ case kMessagingGetError :
+ case kMessagingSetError :
+ case kMessagingNotEnabled :
+ mRefreshListButton->setEnabled(TRUE);
+ mSelectAllButton->setEnabled(FALSE);
+ mSelectNoneButton->setEnabled(FALSE);
+ break;
+ case kMessagingComplete :
+ {
+ int numItems = mObjectsScrollList->getItemCount();
+ int numSelectedItems = mObjectsScrollList->getNumSelected();
+ mRefreshListButton->setEnabled(TRUE);
+ mSelectAllButton->setEnabled(numSelectedItems < numItems);
+ mSelectNoneButton->setEnabled(numSelectedItems > 0);
+ }
+ break;
+ default:
+ llassert(0);
+ break;
+ }
}
void LLFloaterPathfindingObjects::updateStateOnActionControls()
{
- int numSelectedItems = mObjectsScrollList->getNumSelected();
- bool isEditEnabled = (numSelectedItems > 0);
+ int numSelectedItems = mObjectsScrollList->getNumSelected();
+ bool isEditEnabled = (numSelectedItems > 0);
- mShowBeaconCheckBox->setEnabled(isEditEnabled);
- mTakeButton->setEnabled(isEditEnabled && visible_take_object());
- mTakeCopyButton->setEnabled(isEditEnabled && enable_object_take_copy());
- mReturnButton->setEnabled(isEditEnabled && enable_object_return());
- mDeleteButton->setEnabled(isEditEnabled && enable_object_delete());
- mTeleportButton->setEnabled(numSelectedItems == 1);
+ mShowBeaconCheckBox->setEnabled(isEditEnabled);
+ mTakeButton->setEnabled(isEditEnabled && visible_take_object());
+ mTakeCopyButton->setEnabled(isEditEnabled && enable_object_take_copy());
+ mReturnButton->setEnabled(isEditEnabled && enable_object_return());
+ mDeleteButton->setEnabled(isEditEnabled && enable_object_delete());
+ mTeleportButton->setEnabled(numSelectedItems == 1);
}
void LLFloaterPathfindingObjects::selectScrollListItemsInWorld()
{
- mObjectsSelection.clear();
- LLSelectMgr::getInstance()->deselectAll();
+ mObjectsSelection.clear();
+ LLSelectMgr::getInstance()->deselectAll();
- std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected();
- if (!selectedItems.empty())
- {
- int numSelectedItems = selectedItems.size();
+ std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected();
+ if (!selectedItems.empty())
+ {
+ int numSelectedItems = selectedItems.size();
- std::vector<LLViewerObject *>viewerObjects;
- viewerObjects.reserve(numSelectedItems);
+ std::vector<LLViewerObject *>viewerObjects;
+ viewerObjects.reserve(numSelectedItems);
- for (std::vector<LLScrollListItem *>::const_iterator selectedItemIter = selectedItems.begin();
- selectedItemIter != selectedItems.end(); ++selectedItemIter)
- {
- const LLScrollListItem *selectedItem = *selectedItemIter;
+ for (std::vector<LLScrollListItem *>::const_iterator selectedItemIter = selectedItems.begin();
+ selectedItemIter != selectedItems.end(); ++selectedItemIter)
+ {
+ const LLScrollListItem *selectedItem = *selectedItemIter;
- LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
- if (viewerObject != NULL)
- {
- viewerObjects.push_back(viewerObject);
- }
- }
+ LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
+ if (viewerObject != NULL)
+ {
+ viewerObjects.push_back(viewerObject);
+ }
+ }
- if (!viewerObjects.empty())
- {
- mObjectsSelection = LLSelectMgr::getInstance()->selectObjectAndFamily(viewerObjects);
- }
- }
+ if (!viewerObjects.empty())
+ {
+ mObjectsSelection = LLSelectMgr::getInstance()->selectObjectAndFamily(viewerObjects);
+ }
+ }
}
void LLFloaterPathfindingObjects::handleReturnItemsResponse(const LLSD &pNotification, const LLSD &pResponse)
{
- if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
- {
- handle_object_return();
- requestGetObjects();
- }
+ if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
+ {
+ handle_object_return();
+ requestGetObjects();
+ }
}
void LLFloaterPathfindingObjects::handleDeleteItemsResponse(const LLSD &pNotification, const LLSD &pResponse)
{
- if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
- {
- handle_object_delete();
- requestGetObjects();
- }
+ if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
+ {
+ handle_object_delete();
+ requestGetObjects();
+ }
}
LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollListItem *pListItem) const
{
- LLPathfindingObjectPtr objectPtr;
+ LLPathfindingObjectPtr objectPtr;
- LLUUID uuid = pListItem->getUUID();
- const std::string &uuidString = uuid.asString();
- llassert(mObjectList != NULL);
- objectPtr = mObjectList->find(uuidString);
+ LLUUID uuid = pListItem->getUUID();
+ const std::string &uuidString = uuid.asString();
+ llassert(mObjectList != NULL);
+ objectPtr = mObjectList->find(uuidString);
- return objectPtr;
+ return objectPtr;
}
diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h
index 752f741959..3174a47f65 100644
--- a/indra/newview/llfloaterpathfindingobjects.h
+++ b/indra/newview/llfloaterpathfindingobjects.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpathfindingobjects.h
* @brief Base class for both the pathfinding linksets and characters floater.
* @author Stinson@lindenlab.com
@@ -52,128 +52,128 @@ class LLTextBase;
class LLFloaterPathfindingObjects : public LLFloater
{
public:
- virtual void onOpen(const LLSD &pKey);
- virtual void onClose(bool pIsAppQuitting);
- virtual void draw();
+ virtual void onOpen(const LLSD &pKey);
+ virtual void onClose(bool pIsAppQuitting);
+ virtual void draw();
protected:
- friend class LLFloaterReg;
-
- typedef enum
- {
- kMessagingUnknown,
- kMessagingGetRequestSent,
- kMessagingGetError,
- kMessagingSetRequestSent,
- kMessagingSetError,
- kMessagingComplete,
- kMessagingNotEnabled
- } EMessagingState;
-
- LLFloaterPathfindingObjects(const LLSD &pSeed);
- virtual ~LLFloaterPathfindingObjects();
-
- virtual BOOL postBuild();
-
- virtual void requestGetObjects();
- LLPathfindingManager::request_id_t getNewRequestId();
- void handleNewObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList);
- void handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList);
-
- void rebuildObjectsScrollList(bool update_if_needed = false);
- virtual void buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr);
- void addObjectToScrollList(const LLPathfindingObjectPtr pObjectPr, const LLSD &pScrollListItemData);
-
- virtual void updateControlsOnScrollListChange();
- virtual void updateControlsOnInWorldSelectionChange();
-
- virtual S32 getNameColumnIndex() const;
- virtual S32 getOwnerNameColumnIndex() const;
- virtual std::string getOwnerName(const LLPathfindingObject *pObject) const;
- virtual const LLColor4 &getBeaconColor() const;
- virtual const LLColor4 &getBeaconTextColor() const;
- virtual S32 getBeaconWidth() const;
-
- void showFloaterWithSelectionObjects();
-
- BOOL isShowBeacons() const;
- void clearAllObjects();
- void selectAllObjects();
- void selectNoneObjects();
- void teleportToSelectedObject();
-
- virtual LLPathfindingObjectListPtr getEmptyObjectList() const;
- int getNumSelectedObjects() const;
- LLPathfindingObjectListPtr getSelectedObjects() const;
- LLPathfindingObjectPtr getFirstSelectedObject() const;
-
- EMessagingState getMessagingState() const;
+ friend class LLFloaterReg;
+
+ typedef enum
+ {
+ kMessagingUnknown,
+ kMessagingGetRequestSent,
+ kMessagingGetError,
+ kMessagingSetRequestSent,
+ kMessagingSetError,
+ kMessagingComplete,
+ kMessagingNotEnabled
+ } EMessagingState;
+
+ LLFloaterPathfindingObjects(const LLSD &pSeed);
+ virtual ~LLFloaterPathfindingObjects();
+
+ virtual BOOL postBuild();
+
+ virtual void requestGetObjects();
+ LLPathfindingManager::request_id_t getNewRequestId();
+ void handleNewObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList);
+ void handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList);
+
+ void rebuildObjectsScrollList(bool update_if_needed = false);
+ virtual void buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr);
+ void addObjectToScrollList(const LLPathfindingObjectPtr pObjectPr, const LLSD &pScrollListItemData);
+
+ virtual void updateControlsOnScrollListChange();
+ virtual void updateControlsOnInWorldSelectionChange();
+
+ virtual S32 getNameColumnIndex() const;
+ virtual S32 getOwnerNameColumnIndex() const;
+ virtual std::string getOwnerName(const LLPathfindingObject *pObject) const;
+ virtual const LLColor4 &getBeaconColor() const;
+ virtual const LLColor4 &getBeaconTextColor() const;
+ virtual S32 getBeaconWidth() const;
+
+ void showFloaterWithSelectionObjects();
+
+ BOOL isShowBeacons() const;
+ void clearAllObjects();
+ void selectAllObjects();
+ void selectNoneObjects();
+ void teleportToSelectedObject();
+
+ virtual LLPathfindingObjectListPtr getEmptyObjectList() const;
+ int getNumSelectedObjects() const;
+ LLPathfindingObjectListPtr getSelectedObjects() const;
+ LLPathfindingObjectPtr getFirstSelectedObject() const;
+
+ EMessagingState getMessagingState() const;
private:
- LLFloaterPathfindingObjects(const LLFloaterPathfindingObjects &pOther);
+ LLFloaterPathfindingObjects(const LLFloaterPathfindingObjects &pOther);
- void setMessagingState(EMessagingState pMessagingState);
+ void setMessagingState(EMessagingState pMessagingState);
- void onRefreshObjectsClicked();
- void onSelectAllObjectsClicked();
- void onSelectNoneObjectsClicked();
- void onTakeClicked();
- void onTakeCopyClicked();
- void onReturnClicked();
- void onDeleteClicked();
- void onTeleportClicked();
+ void onRefreshObjectsClicked();
+ void onSelectAllObjectsClicked();
+ void onSelectNoneObjectsClicked();
+ void onTakeClicked();
+ void onTakeCopyClicked();
+ void onReturnClicked();
+ void onDeleteClicked();
+ void onTeleportClicked();
- void onScrollListSelectionChanged();
- void onInWorldSelectionListChanged();
- void onRegionBoundaryCrossed();
- void onGodLevelChange(U8 pGodLevel);
+ void onScrollListSelectionChanged();
+ void onInWorldSelectionListChanged();
+ void onRegionBoundaryCrossed();
+ void onGodLevelChange(U8 pGodLevel);
- void handleObjectNameResponse(const LLPathfindingObject *pObject);
+ void handleObjectNameResponse(const LLPathfindingObject *pObject);
- void updateMessagingStatus();
- void updateStateOnListControls();
- void updateStateOnActionControls();
- void selectScrollListItemsInWorld();
+ void updateMessagingStatus();
+ void updateStateOnListControls();
+ void updateStateOnActionControls();
+ void selectScrollListItemsInWorld();
- void handleReturnItemsResponse(const LLSD &pNotification, const LLSD &pResponse);
- void handleDeleteItemsResponse(const LLSD &pNotification, const LLSD &pResponse);
+ void handleReturnItemsResponse(const LLSD &pNotification, const LLSD &pResponse);
+ void handleDeleteItemsResponse(const LLSD &pNotification, const LLSD &pResponse);
- LLPathfindingObjectPtr findObject(const LLScrollListItem *pListItem) const;
+ LLPathfindingObjectPtr findObject(const LLScrollListItem *pListItem) const;
- LLScrollListCtrl *mObjectsScrollList;
- LLTextBase *mMessagingStatus;
- LLButton *mRefreshListButton;
- LLButton *mSelectAllButton;
- LLButton *mSelectNoneButton;
- LLCheckBoxCtrl *mShowBeaconCheckBox;
+ LLScrollListCtrl *mObjectsScrollList;
+ LLTextBase *mMessagingStatus;
+ LLButton *mRefreshListButton;
+ LLButton *mSelectAllButton;
+ LLButton *mSelectNoneButton;
+ LLCheckBoxCtrl *mShowBeaconCheckBox;
- LLButton *mTakeButton;
- LLButton *mTakeCopyButton;
- LLButton *mReturnButton;
- LLButton *mDeleteButton;
- LLButton *mTeleportButton;
+ LLButton *mTakeButton;
+ LLButton *mTakeCopyButton;
+ LLButton *mReturnButton;
+ LLButton *mDeleteButton;
+ LLButton *mTeleportButton;
- LLColor4 mDefaultBeaconColor;
- LLColor4 mDefaultBeaconTextColor;
- LLColor4 mErrorTextColor;
- LLColor4 mWarningTextColor;
+ LLColor4 mDefaultBeaconColor;
+ LLColor4 mDefaultBeaconTextColor;
+ LLColor4 mErrorTextColor;
+ LLColor4 mWarningTextColor;
- EMessagingState mMessagingState;
- LLPathfindingManager::request_id_t mMessagingRequestId;
+ EMessagingState mMessagingState;
+ LLPathfindingManager::request_id_t mMessagingRequestId;
- typedef std::map<std::string, LLScrollListItem *> scroll_list_item_map;
- scroll_list_item_map mMissingNameObjectsScrollListItems;
+ typedef std::map<std::string, LLScrollListItem *> scroll_list_item_map;
+ scroll_list_item_map mMissingNameObjectsScrollListItems;
- LLPathfindingObjectListPtr mObjectList;
+ LLPathfindingObjectListPtr mObjectList;
- LLObjectSelectionHandle mObjectsSelection;
+ LLObjectSelectionHandle mObjectsSelection;
- bool mHasObjectsToBeSelected;
- uuid_vec_t mObjectsToBeSelected;
+ bool mHasObjectsToBeSelected;
+ uuid_vec_t mObjectsToBeSelected;
- boost::signals2::connection mSelectionUpdateSlot;
- boost::signals2::connection mRegionBoundaryCrossingSlot;
- LLAgent::god_level_change_slot_t mGodLevelChangeSlot;
+ boost::signals2::connection mSelectionUpdateSlot;
+ boost::signals2::connection mRegionBoundaryCrossingSlot;
+ LLAgent::god_level_change_slot_t mGodLevelChangeSlot;
};
#endif // LL_LLFLOATERPATHFINDINGOBJECTS_H
diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp
index 94261b2e4e..d607f2361a 100644
--- a/indra/newview/llfloaterpay.cpp
+++ b/indra/newview/llfloaterpay.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpay.cpp
* @author Aaron Brashears, Kelly Washington, James Cook
* @brief Implementation of the LLFloaterPay class.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,7 +31,7 @@
#include "message.h"
#include "llfloater.h"
-#include "lllslconstants.h" // MAX_PAY_BUTTONS
+#include "lllslconstants.h" // MAX_PAY_BUTTONS
#include "lluuid.h"
#include "llagent.h"
@@ -66,10 +66,10 @@ class LLFloaterPay;
struct LLGiveMoneyInfo
{
- LLFloaterPay* mFloater;
- S32 mAmount;
- LLGiveMoneyInfo(LLFloaterPay* floater, S32 amount) :
- mFloater(floater), mAmount(amount){}
+ LLFloaterPay* mFloater;
+ S32 mAmount;
+ LLGiveMoneyInfo(LLFloaterPay* floater, S32 amount) :
+ mFloater(floater), mAmount(amount){}
};
typedef std::shared_ptr<LLGiveMoneyInfo> give_money_ptr;
@@ -81,43 +81,43 @@ typedef std::shared_ptr<LLGiveMoneyInfo> give_money_ptr;
class LLFloaterPay : public LLFloater
{
public:
- LLFloaterPay(const LLSD& key);
- virtual ~LLFloaterPay();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onClose(bool app_quitting);
-
- void setCallback(money_callback callback) { mCallback = callback; }
-
-
- static void payViaObject(money_callback callback, LLSafeHandle<LLObjectSelection> selection);
-
- static void payDirectly(money_callback callback,
- const LLUUID& target_id,
- bool is_group);
- static bool payConfirmationCallback(const LLSD& notification,
- const LLSD& response,
- give_money_ptr info);
+ LLFloaterPay(const LLSD& key);
+ virtual ~LLFloaterPay();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onClose(bool app_quitting);
+
+ void setCallback(money_callback callback) { mCallback = callback; }
+
+
+ static void payViaObject(money_callback callback, LLSafeHandle<LLObjectSelection> selection);
+
+ static void payDirectly(money_callback callback,
+ const LLUUID& target_id,
+ bool is_group);
+ static bool payConfirmationCallback(const LLSD& notification,
+ const LLSD& response,
+ give_money_ptr info);
private:
- static void onCancel(void* data);
- static void onKeystroke(LLLineEditor* editor, void* data);
- static void onGive(give_money_ptr info);
- void give(S32 amount);
- static void processPayPriceReply(LLMessageSystem* msg, void **userdata);
- void finishPayUI(const LLUUID& target_id, BOOL is_group);
+ static void onCancel(void* data);
+ static void onKeystroke(LLLineEditor* editor, void* data);
+ static void onGive(give_money_ptr info);
+ void give(S32 amount);
+ static void processPayPriceReply(LLMessageSystem* msg, void **userdata);
+ void finishPayUI(const LLUUID& target_id, BOOL is_group);
protected:
- std::vector<give_money_ptr> mCallbackData;
- money_callback mCallback;
- LLTextBox* mObjectNameText;
- LLUUID mTargetUUID;
- BOOL mTargetIsGroup;
- BOOL mHaveName;
+ std::vector<give_money_ptr> mCallbackData;
+ money_callback mCallback;
+ LLTextBox* mObjectNameText;
+ LLUUID mTargetUUID;
+ BOOL mTargetIsGroup;
+ BOOL mHaveName;
- LLButton* mQuickPayButton[MAX_PAY_BUTTONS];
- give_money_ptr mQuickPayInfo[MAX_PAY_BUTTONS];
+ LLButton* mQuickPayButton[MAX_PAY_BUTTONS];
+ give_money_ptr mQuickPayInfo[MAX_PAY_BUTTONS];
- LLSafeHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
};
@@ -125,13 +125,13 @@ const S32 FASTPAY_BUTTON_WIDTH = 80;
const S32 PAY_AMOUNT_NOTIFICATION = 200;
LLFloaterPay::LLFloaterPay(const LLSD& key)
- : LLFloater(key),
- mCallbackData(),
- mCallback(NULL),
- mObjectNameText(NULL),
- mTargetUUID(key.asUUID()),
- mTargetIsGroup(FALSE),
- mHaveName(FALSE)
+ : LLFloater(key),
+ mCallbackData(),
+ mCallback(NULL),
+ mObjectNameText(NULL),
+ mTargetUUID(key.asUUID()),
+ mTargetIsGroup(FALSE),
+ mHaveName(FALSE)
{
}
@@ -143,343 +143,343 @@ LLFloaterPay::~LLFloaterPay()
{
(*iter)->mFloater = NULL;
}
- mCallbackData.clear();
- // Name callbacks will be automatically disconnected since LLFloater is trackable
-
- // In case this floater is currently waiting for a reply.
- gMessageSystem->setHandlerFuncFast(_PREHASH_PayPriceReply, 0, 0);
+ mCallbackData.clear();
+ // Name callbacks will be automatically disconnected since LLFloater is trackable
+
+ // In case this floater is currently waiting for a reply.
+ gMessageSystem->setHandlerFuncFast(_PREHASH_PayPriceReply, 0, 0);
}
BOOL LLFloaterPay::postBuild()
{
- S32 i = 0;
-
- give_money_ptr info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_0));
- mCallbackData.push_back(info);
+ S32 i = 0;
- childSetAction("fastpay 1", boost::bind(LLFloaterPay::onGive, info));
- getChildView("fastpay 1")->setVisible(FALSE);
+ give_money_ptr info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_0));
+ mCallbackData.push_back(info);
- mQuickPayButton[i] = getChild<LLButton>("fastpay 1");
- mQuickPayInfo[i] = info;
- ++i;
+ childSetAction("fastpay 1", boost::bind(LLFloaterPay::onGive, info));
+ getChildView("fastpay 1")->setVisible(FALSE);
- info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_1));
- mCallbackData.push_back(info);
+ mQuickPayButton[i] = getChild<LLButton>("fastpay 1");
+ mQuickPayInfo[i] = info;
+ ++i;
- childSetAction("fastpay 5", boost::bind(LLFloaterPay::onGive, info));
- getChildView("fastpay 5")->setVisible(FALSE);
+ info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_1));
+ mCallbackData.push_back(info);
- mQuickPayButton[i] = getChild<LLButton>("fastpay 5");
- mQuickPayInfo[i] = info;
- ++i;
+ childSetAction("fastpay 5", boost::bind(LLFloaterPay::onGive, info));
+ getChildView("fastpay 5")->setVisible(FALSE);
- info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_2));
- mCallbackData.push_back(info);
+ mQuickPayButton[i] = getChild<LLButton>("fastpay 5");
+ mQuickPayInfo[i] = info;
+ ++i;
- childSetAction("fastpay 10", boost::bind(LLFloaterPay::onGive, info));
- getChildView("fastpay 10")->setVisible(FALSE);
+ info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_2));
+ mCallbackData.push_back(info);
- mQuickPayButton[i] = getChild<LLButton>("fastpay 10");
- mQuickPayInfo[i] = info;
- ++i;
+ childSetAction("fastpay 10", boost::bind(LLFloaterPay::onGive, info));
+ getChildView("fastpay 10")->setVisible(FALSE);
- info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_3));
- mCallbackData.push_back(info);
+ mQuickPayButton[i] = getChild<LLButton>("fastpay 10");
+ mQuickPayInfo[i] = info;
+ ++i;
- childSetAction("fastpay 20", boost::bind(LLFloaterPay::onGive, info));
- getChildView("fastpay 20")->setVisible(FALSE);
+ info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_3));
+ mCallbackData.push_back(info);
- mQuickPayButton[i] = getChild<LLButton>("fastpay 20");
- mQuickPayInfo[i] = info;
- ++i;
+ childSetAction("fastpay 20", boost::bind(LLFloaterPay::onGive, info));
+ getChildView("fastpay 20")->setVisible(FALSE);
+ mQuickPayButton[i] = getChild<LLButton>("fastpay 20");
+ mQuickPayInfo[i] = info;
+ ++i;
- getChildView("amount text")->setVisible(FALSE);
- getChildView("amount")->setVisible(FALSE);
- getChild<LLLineEditor>("amount")->setKeystrokeCallback(&LLFloaterPay::onKeystroke, this);
- getChild<LLLineEditor>("amount")->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ getChildView("amount text")->setVisible(FALSE);
+ getChildView("amount")->setVisible(FALSE);
- info = give_money_ptr(new LLGiveMoneyInfo(this, 0));
- mCallbackData.push_back(info);
+ getChild<LLLineEditor>("amount")->setKeystrokeCallback(&LLFloaterPay::onKeystroke, this);
+ getChild<LLLineEditor>("amount")->setPrevalidate(LLTextValidate::validateNonNegativeS32);
- childSetAction("pay btn", boost::bind(LLFloaterPay::onGive, info));
- setDefaultBtn("pay btn");
- getChildView("pay btn")->setVisible(FALSE);
- getChildView("pay btn")->setEnabled(FALSE);
+ info = give_money_ptr(new LLGiveMoneyInfo(this, 0));
+ mCallbackData.push_back(info);
- childSetAction("cancel btn",&LLFloaterPay::onCancel,this);
+ childSetAction("pay btn", boost::bind(LLFloaterPay::onGive, info));
+ setDefaultBtn("pay btn");
+ getChildView("pay btn")->setVisible(FALSE);
+ getChildView("pay btn")->setEnabled(FALSE);
- return TRUE;
+ childSetAction("cancel btn",&LLFloaterPay::onCancel,this);
+
+ return TRUE;
}
// virtual
void LLFloaterPay::onClose(bool app_quitting)
{
- // Deselect the objects
- mObjectSelection = NULL;
+ // Deselect the objects
+ mObjectSelection = NULL;
}
// static
void LLFloaterPay::processPayPriceReply(LLMessageSystem* msg, void **userdata)
{
- LLFloaterPay* self = (LLFloaterPay*)userdata;
- if (self)
- {
- S32 price;
- LLUUID target;
-
- msg->getUUIDFast(_PREHASH_ObjectData,_PREHASH_ObjectID,target);
- if (target != self->mTargetUUID)
- {
- // This is a message for a different object's pay info
- return;
- }
-
- msg->getS32Fast(_PREHASH_ObjectData,_PREHASH_DefaultPayPrice,price);
-
- if (PAY_PRICE_HIDE == price)
- {
- self->getChildView("amount")->setVisible(FALSE);
- self->getChildView("pay btn")->setVisible(FALSE);
- self->getChildView("amount text")->setVisible(FALSE);
- }
- else if (PAY_PRICE_DEFAULT == price)
- {
- self->getChildView("amount")->setVisible(TRUE);
- self->getChildView("pay btn")->setVisible(TRUE);
- self->getChildView("amount text")->setVisible(TRUE);
- }
- else
- {
- // PAY_PRICE_HIDE and PAY_PRICE_DEFAULT are negative values
- // So we take the absolute value here after we have checked for those cases
-
- self->getChildView("amount")->setVisible(TRUE);
- self->getChildView("pay btn")->setVisible(TRUE);
- self->getChildView("pay btn")->setEnabled(TRUE);
- self->getChildView("amount text")->setVisible(TRUE);
-
- self->getChild<LLUICtrl>("amount")->setValue(llformat("%d", llabs(price)));
- }
-
- S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_ButtonData);
- S32 i = 0;
- if (num_blocks > MAX_PAY_BUTTONS) num_blocks = MAX_PAY_BUTTONS;
-
- S32 max_pay_amount = 0;
- S32 padding_required = 0;
-
- for (i=0;i<num_blocks;++i)
- {
- S32 pay_button;
- msg->getS32Fast(_PREHASH_ButtonData,_PREHASH_PayButton,pay_button,i);
- if (pay_button > 0)
- {
- std::string button_str = "L$";
- button_str += LLResMgr::getInstance()->getMonetaryString( pay_button );
-
- self->mQuickPayButton[i]->setLabelSelected(button_str);
- self->mQuickPayButton[i]->setLabelUnselected(button_str);
- self->mQuickPayButton[i]->setVisible(TRUE);
- self->mQuickPayInfo[i]->mAmount = pay_button;
-
- if ( pay_button > max_pay_amount )
- {
- max_pay_amount = pay_button;
- }
- }
- else
- {
- self->mQuickPayButton[i]->setVisible(FALSE);
- }
- }
-
- // build a string containing the maximum value and calc nerw button width from it.
- std::string balance_str = "L$";
- balance_str += LLResMgr::getInstance()->getMonetaryString( max_pay_amount );
- const LLFontGL* font = LLFontGL::getFontSansSerif();
- S32 new_button_width = font->getWidth( std::string(balance_str));
- new_button_width += ( 12 + 12 ); // padding
-
- // dialong is sized for 2 digit pay amounts - larger pay values need to be scaled
- const S32 threshold = 100000;
- if ( max_pay_amount >= threshold )
- {
- S32 num_digits_threshold = (S32)log10((double)threshold) + 1;
- S32 num_digits_max = (S32)log10((double)max_pay_amount) + 1;
-
- // calculate the extra width required by 2 buttons with max amount and some commas
- padding_required = ( num_digits_max - num_digits_threshold + ( num_digits_max / 3 ) ) * font->getWidth( std::string("0") );
- };
-
- // change in button width
- S32 button_delta = new_button_width - FASTPAY_BUTTON_WIDTH;
- if ( button_delta < 0 )
- button_delta = 0;
-
- // now we know the maximum amount, we can resize all the buttons to be
- for (i=0;i<num_blocks;++i)
- {
- LLRect r;
- r = self->mQuickPayButton[i]->getRect();
-
- // RHS button colum needs to move further because LHS changed too
- if ( i % 2 )
- {
- r.setCenterAndSize( r.getCenterX() + ( button_delta * 3 ) / 2 ,
- r.getCenterY(),
- r.getWidth() + button_delta,
- r.getHeight() );
- }
- else
- {
- r.setCenterAndSize( r.getCenterX() + button_delta / 2,
- r.getCenterY(),
- r.getWidth() + button_delta,
- r.getHeight() );
- }
- self->mQuickPayButton[i]->setRect( r );
- }
-
- for (i=num_blocks;i<MAX_PAY_BUTTONS;++i)
- {
- self->mQuickPayButton[i]->setVisible(FALSE);
- }
-
- self->reshape( self->getRect().getWidth() + padding_required, self->getRect().getHeight(), FALSE );
- }
- msg->setHandlerFunc("PayPriceReply",NULL,NULL);
+ LLFloaterPay* self = (LLFloaterPay*)userdata;
+ if (self)
+ {
+ S32 price;
+ LLUUID target;
+
+ msg->getUUIDFast(_PREHASH_ObjectData,_PREHASH_ObjectID,target);
+ if (target != self->mTargetUUID)
+ {
+ // This is a message for a different object's pay info
+ return;
+ }
+
+ msg->getS32Fast(_PREHASH_ObjectData,_PREHASH_DefaultPayPrice,price);
+
+ if (PAY_PRICE_HIDE == price)
+ {
+ self->getChildView("amount")->setVisible(FALSE);
+ self->getChildView("pay btn")->setVisible(FALSE);
+ self->getChildView("amount text")->setVisible(FALSE);
+ }
+ else if (PAY_PRICE_DEFAULT == price)
+ {
+ self->getChildView("amount")->setVisible(TRUE);
+ self->getChildView("pay btn")->setVisible(TRUE);
+ self->getChildView("amount text")->setVisible(TRUE);
+ }
+ else
+ {
+ // PAY_PRICE_HIDE and PAY_PRICE_DEFAULT are negative values
+ // So we take the absolute value here after we have checked for those cases
+
+ self->getChildView("amount")->setVisible(TRUE);
+ self->getChildView("pay btn")->setVisible(TRUE);
+ self->getChildView("pay btn")->setEnabled(TRUE);
+ self->getChildView("amount text")->setVisible(TRUE);
+
+ self->getChild<LLUICtrl>("amount")->setValue(llformat("%d", llabs(price)));
+ }
+
+ S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_ButtonData);
+ S32 i = 0;
+ if (num_blocks > MAX_PAY_BUTTONS) num_blocks = MAX_PAY_BUTTONS;
+
+ S32 max_pay_amount = 0;
+ S32 padding_required = 0;
+
+ for (i=0;i<num_blocks;++i)
+ {
+ S32 pay_button;
+ msg->getS32Fast(_PREHASH_ButtonData,_PREHASH_PayButton,pay_button,i);
+ if (pay_button > 0)
+ {
+ std::string button_str = "L$";
+ button_str += LLResMgr::getInstance()->getMonetaryString( pay_button );
+
+ self->mQuickPayButton[i]->setLabelSelected(button_str);
+ self->mQuickPayButton[i]->setLabelUnselected(button_str);
+ self->mQuickPayButton[i]->setVisible(TRUE);
+ self->mQuickPayInfo[i]->mAmount = pay_button;
+
+ if ( pay_button > max_pay_amount )
+ {
+ max_pay_amount = pay_button;
+ }
+ }
+ else
+ {
+ self->mQuickPayButton[i]->setVisible(FALSE);
+ }
+ }
+
+ // build a string containing the maximum value and calc nerw button width from it.
+ std::string balance_str = "L$";
+ balance_str += LLResMgr::getInstance()->getMonetaryString( max_pay_amount );
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
+ S32 new_button_width = font->getWidth( std::string(balance_str));
+ new_button_width += ( 12 + 12 ); // padding
+
+ // dialong is sized for 2 digit pay amounts - larger pay values need to be scaled
+ const S32 threshold = 100000;
+ if ( max_pay_amount >= threshold )
+ {
+ S32 num_digits_threshold = (S32)log10((double)threshold) + 1;
+ S32 num_digits_max = (S32)log10((double)max_pay_amount) + 1;
+
+ // calculate the extra width required by 2 buttons with max amount and some commas
+ padding_required = ( num_digits_max - num_digits_threshold + ( num_digits_max / 3 ) ) * font->getWidth( std::string("0") );
+ };
+
+ // change in button width
+ S32 button_delta = new_button_width - FASTPAY_BUTTON_WIDTH;
+ if ( button_delta < 0 )
+ button_delta = 0;
+
+ // now we know the maximum amount, we can resize all the buttons to be
+ for (i=0;i<num_blocks;++i)
+ {
+ LLRect r;
+ r = self->mQuickPayButton[i]->getRect();
+
+ // RHS button colum needs to move further because LHS changed too
+ if ( i % 2 )
+ {
+ r.setCenterAndSize( r.getCenterX() + ( button_delta * 3 ) / 2 ,
+ r.getCenterY(),
+ r.getWidth() + button_delta,
+ r.getHeight() );
+ }
+ else
+ {
+ r.setCenterAndSize( r.getCenterX() + button_delta / 2,
+ r.getCenterY(),
+ r.getWidth() + button_delta,
+ r.getHeight() );
+ }
+ self->mQuickPayButton[i]->setRect( r );
+ }
+
+ for (i=num_blocks;i<MAX_PAY_BUTTONS;++i)
+ {
+ self->mQuickPayButton[i]->setVisible(FALSE);
+ }
+
+ self->reshape( self->getRect().getWidth() + padding_required, self->getRect().getHeight(), FALSE );
+ }
+ msg->setHandlerFunc("PayPriceReply",NULL,NULL);
}
// static
void LLFloaterPay::payViaObject(money_callback callback, LLSafeHandle<LLObjectSelection> selection)
{
- // Object that lead to the selection, may be child
- LLViewerObject* object = selection->getPrimaryObject();
- if (!object)
- return;
-
- LLFloaterPay *floater = LLFloaterReg::showTypedInstance<LLFloaterPay>("pay_object", LLSD(object->getID()));
- if (!floater)
- return;
-
- floater->setCallback(callback);
- // Hold onto the selection until we close
- floater->mObjectSelection = selection;
-
- LLSelectNode* node = selection->getFirstRootNode();
- if (!node)
- {
- // object no longer exists
- LLNotificationsUtil::add("PayObjectFailed");
- floater->closeFloater();
- return;
- }
-
- LLHost target_region = object->getRegion()->getHost();
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RequestPayPrice);
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addUUIDFast(_PREHASH_ObjectID, object->getID());
- msg->sendReliable(target_region);
- msg->setHandlerFuncFast(_PREHASH_PayPriceReply, processPayPriceReply,(void **)floater);
-
- LLUUID owner_id;
- BOOL is_group = FALSE;
- node->mPermissions->getOwnership(owner_id, is_group);
-
- floater->getChild<LLUICtrl>("object_name_text")->setValue(node->mName);
-
- floater->finishPayUI(owner_id, is_group);
+ // Object that lead to the selection, may be child
+ LLViewerObject* object = selection->getPrimaryObject();
+ if (!object)
+ return;
+
+ LLFloaterPay *floater = LLFloaterReg::showTypedInstance<LLFloaterPay>("pay_object", LLSD(object->getID()));
+ if (!floater)
+ return;
+
+ floater->setCallback(callback);
+ // Hold onto the selection until we close
+ floater->mObjectSelection = selection;
+
+ LLSelectNode* node = selection->getFirstRootNode();
+ if (!node)
+ {
+ // object no longer exists
+ LLNotificationsUtil::add("PayObjectFailed");
+ floater->closeFloater();
+ return;
+ }
+
+ LLHost target_region = object->getRegion()->getHost();
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RequestPayPrice);
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addUUIDFast(_PREHASH_ObjectID, object->getID());
+ msg->sendReliable(target_region);
+ msg->setHandlerFuncFast(_PREHASH_PayPriceReply, processPayPriceReply,(void **)floater);
+
+ LLUUID owner_id;
+ BOOL is_group = FALSE;
+ node->mPermissions->getOwnership(owner_id, is_group);
+
+ floater->getChild<LLUICtrl>("object_name_text")->setValue(node->mName);
+
+ floater->finishPayUI(owner_id, is_group);
}
-void LLFloaterPay::payDirectly(money_callback callback,
- const LLUUID& target_id,
- bool is_group)
+void LLFloaterPay::payDirectly(money_callback callback,
+ const LLUUID& target_id,
+ bool is_group)
{
- LLFloaterPay *floater = LLFloaterReg::showTypedInstance<LLFloaterPay>("pay_resident", LLSD(target_id));
- if (!floater)
- return;
-
- floater->setCallback(callback);
- floater->mObjectSelection = NULL;
-
- floater->getChildView("amount")->setVisible(TRUE);
- floater->getChildView("pay btn")->setVisible(TRUE);
- floater->getChildView("amount text")->setVisible(TRUE);
-
- for(S32 i=0;i<MAX_PAY_BUTTONS;++i)
- {
- floater->mQuickPayButton[i]->setVisible(TRUE);
- }
-
- floater->finishPayUI(target_id, is_group);
+ LLFloaterPay *floater = LLFloaterReg::showTypedInstance<LLFloaterPay>("pay_resident", LLSD(target_id));
+ if (!floater)
+ return;
+
+ floater->setCallback(callback);
+ floater->mObjectSelection = NULL;
+
+ floater->getChildView("amount")->setVisible(TRUE);
+ floater->getChildView("pay btn")->setVisible(TRUE);
+ floater->getChildView("amount text")->setVisible(TRUE);
+
+ for(S32 i=0;i<MAX_PAY_BUTTONS;++i)
+ {
+ floater->mQuickPayButton[i]->setVisible(TRUE);
+ }
+
+ floater->finishPayUI(target_id, is_group);
}
bool LLFloaterPay::payConfirmationCallback(const LLSD& notification, const LLSD& response, give_money_ptr info)
{
- if (!info.get() || !info->mFloater)
- {
- return false;
- }
-
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- info->mFloater->give(info->mAmount);
- info->mFloater->closeFloater();
- }
-
- return false;
+ if (!info.get() || !info->mFloater)
+ {
+ return false;
+ }
+
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ info->mFloater->give(info->mAmount);
+ info->mFloater->closeFloater();
+ }
+
+ return false;
}
void LLFloaterPay::finishPayUI(const LLUUID& target_id, BOOL is_group)
{
- std::string slurl;
- if (is_group)
- {
- setTitle(getString("payee_group"));
- slurl = LLSLURL("group", target_id, "inspect").getSLURLString();
- }
- else
- {
- setTitle(getString("payee_resident"));
- slurl = LLSLURL("agent", target_id, "inspect").getSLURLString();
- }
- getChild<LLTextBox>("payee_name")->setText(slurl);
-
- // Make sure the amount field has focus
-
- LLLineEditor* amount = getChild<LLLineEditor>("amount");
- amount->setFocus(TRUE);
- amount->selectAll();
-
- mTargetIsGroup = is_group;
+ std::string slurl;
+ if (is_group)
+ {
+ setTitle(getString("payee_group"));
+ slurl = LLSLURL("group", target_id, "inspect").getSLURLString();
+ }
+ else
+ {
+ setTitle(getString("payee_resident"));
+ slurl = LLSLURL("agent", target_id, "inspect").getSLURLString();
+ }
+ getChild<LLTextBox>("payee_name")->setText(slurl);
+
+ // Make sure the amount field has focus
+
+ LLLineEditor* amount = getChild<LLLineEditor>("amount");
+ amount->setFocus(TRUE);
+ amount->selectAll();
+
+ mTargetIsGroup = is_group;
}
// static
void LLFloaterPay::onCancel(void* data)
{
- LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data);
- if(self)
- {
- self->closeFloater();
- }
+ LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data);
+ if(self)
+ {
+ self->closeFloater();
+ }
}
// static
void LLFloaterPay::onKeystroke(LLLineEditor*, void* data)
{
- LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data);
- if(self)
- {
- // enable the Pay button when amount is non-empty and positive, disable otherwise
- std::string amtstr = self->getChild<LLUICtrl>("amount")->getValue().asString();
- self->getChildView("pay btn")->setEnabled(!amtstr.empty() && atoi(amtstr.c_str()) > 0);
- }
+ LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data);
+ if(self)
+ {
+ // enable the Pay button when amount is non-empty and positive, disable otherwise
+ std::string amtstr = self->getChild<LLUICtrl>("amount")->getValue().asString();
+ self->getChildView("pay btn")->setEnabled(!amtstr.empty() && atoi(amtstr.c_str()) > 0);
+ }
}
// static
@@ -542,63 +542,63 @@ void LLFloaterPay::onGive(give_money_ptr info)
void LLFloaterPay::give(S32 amount)
{
- if(mCallback)
- {
- // if the amount is 0, that menas that we should use the
- // text field.
- if(amount == 0)
- {
- amount = atoi(getChild<LLUICtrl>("amount")->getValue().asString().c_str());
- }
-
- // Try to pay an object.
- if (mObjectSelection.notNull())
- {
- LLViewerObject* dest_object = gObjectList.findObject(mTargetUUID);
- if(dest_object)
- {
- LLViewerRegion* region = dest_object->getRegion();
- if (region)
- {
- // Find the name of the root object
- LLSelectNode* node = mObjectSelection->getFirstRootNode();
- std::string object_name;
- if (node)
- {
- object_name = node->mName;
- }
- S32 tx_type = TRANS_PAY_OBJECT;
- if(dest_object->isAvatar()) tx_type = TRANS_GIFT;
- mCallback(mTargetUUID, region, amount, FALSE, tx_type, object_name);
- mObjectSelection = NULL;
-
- // request the object owner in order to check if the owner needs to be unmuted
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU32Fast(_PREHASH_RequestFlags, OBJECT_PAY_REQUEST );
- msg->addUUIDFast(_PREHASH_ObjectID, mTargetUUID);
- msg->sendReliable( region->getHost() );
- }
- }
- else
- {
- LLNotificationsUtil::add("PayObjectFailed");
- }
- }
- else
- {
- // just transfer the L$
- std::string paymentMessage(getChild<LLLineEditor>("payment_message")->getValue().asString());
- mCallback(mTargetUUID, gAgent.getRegion(), amount, mTargetIsGroup, TRANS_GIFT, (paymentMessage.empty() ? LLStringUtil::null : paymentMessage));
-
- // check if the payee needs to be unmuted
- LLMuteList::getInstance()->autoRemove(mTargetUUID, LLMuteList::AR_MONEY);
- }
- }
+ if(mCallback)
+ {
+ // if the amount is 0, that menas that we should use the
+ // text field.
+ if(amount == 0)
+ {
+ amount = atoi(getChild<LLUICtrl>("amount")->getValue().asString().c_str());
+ }
+
+ // Try to pay an object.
+ if (mObjectSelection.notNull())
+ {
+ LLViewerObject* dest_object = gObjectList.findObject(mTargetUUID);
+ if(dest_object)
+ {
+ LLViewerRegion* region = dest_object->getRegion();
+ if (region)
+ {
+ // Find the name of the root object
+ LLSelectNode* node = mObjectSelection->getFirstRootNode();
+ std::string object_name;
+ if (node)
+ {
+ object_name = node->mName;
+ }
+ S32 tx_type = TRANS_PAY_OBJECT;
+ if(dest_object->isAvatar()) tx_type = TRANS_GIFT;
+ mCallback(mTargetUUID, region, amount, FALSE, tx_type, object_name);
+ mObjectSelection = NULL;
+
+ // request the object owner in order to check if the owner needs to be unmuted
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addU32Fast(_PREHASH_RequestFlags, OBJECT_PAY_REQUEST );
+ msg->addUUIDFast(_PREHASH_ObjectID, mTargetUUID);
+ msg->sendReliable( region->getHost() );
+ }
+ }
+ else
+ {
+ LLNotificationsUtil::add("PayObjectFailed");
+ }
+ }
+ else
+ {
+ // just transfer the L$
+ std::string paymentMessage(getChild<LLLineEditor>("payment_message")->getValue().asString());
+ mCallback(mTargetUUID, gAgent.getRegion(), amount, mTargetIsGroup, TRANS_GIFT, (paymentMessage.empty() ? LLStringUtil::null : paymentMessage));
+
+ // check if the payee needs to be unmuted
+ LLMuteList::getInstance()->autoRemove(mTargetUUID, LLMuteList::AR_MONEY);
+ }
+ }
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -606,22 +606,22 @@ void LLFloaterPay::give(S32 amount)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void LLFloaterPayUtil::registerFloater()
{
- // Sneaky, use same code but different XML for dialogs
- LLFloaterReg::add("pay_resident", "floater_pay.xml",
- &LLFloaterReg::build<LLFloaterPay>);
- LLFloaterReg::add("pay_object", "floater_pay_object.xml",
- &LLFloaterReg::build<LLFloaterPay>);
+ // Sneaky, use same code but different XML for dialogs
+ LLFloaterReg::add("pay_resident", "floater_pay.xml",
+ &LLFloaterReg::build<LLFloaterPay>);
+ LLFloaterReg::add("pay_object", "floater_pay_object.xml",
+ &LLFloaterReg::build<LLFloaterPay>);
}
void LLFloaterPayUtil::payViaObject(money_callback callback,
- LLSafeHandle<LLObjectSelection> selection)
+ LLSafeHandle<LLObjectSelection> selection)
{
- LLFloaterPay::payViaObject(callback, selection);
+ LLFloaterPay::payViaObject(callback, selection);
}
void LLFloaterPayUtil::payDirectly(money_callback callback,
- const LLUUID& target_id,
- bool is_group)
+ const LLUUID& target_id,
+ bool is_group)
{
- LLFloaterPay::payDirectly(callback, target_id, is_group);
+ LLFloaterPay::payDirectly(callback, target_id, is_group);
}
diff --git a/indra/newview/llfloaterpay.h b/indra/newview/llfloaterpay.h
index f322e5ef04..fe48d00867 100644
--- a/indra/newview/llfloaterpay.h
+++ b/indra/newview/llfloaterpay.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloaterpay.h
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,20 +36,20 @@ typedef void (*money_callback)(const LLUUID&, LLViewerRegion*,S32,BOOL,S32,const
namespace LLFloaterPayUtil
{
- /// Register with LLFloaterReg
- void registerFloater();
-
- /// Pay into an in-world object, which will trigger scripts and eventually
- /// transfer the L$ to the resident or group that owns the object.
- /// Objects must be selected. Recipient (primary) object may be a child.
- void payViaObject(money_callback callback,
- LLSafeHandle<LLObjectSelection> selection);
-
- /// Pay an avatar or group directly, not via an object in the world.
- /// Scripts are not notified, L$ can be direcly transferred.
- void payDirectly(money_callback callback,
- const LLUUID& target_id,
- bool is_group);
+ /// Register with LLFloaterReg
+ void registerFloater();
+
+ /// Pay into an in-world object, which will trigger scripts and eventually
+ /// transfer the L$ to the resident or group that owns the object.
+ /// Objects must be selected. Recipient (primary) object may be a child.
+ void payViaObject(money_callback callback,
+ LLSafeHandle<LLObjectSelection> selection);
+
+ /// Pay an avatar or group directly, not via an object in the world.
+ /// Scripts are not notified, L$ can be direcly transferred.
+ void payDirectly(money_callback callback,
+ const LLUUID& target_id,
+ bool is_group);
}
#endif // LLFLOATERPAY_H
diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp
index 19fc3e673e..97ae97dafc 100644
--- a/indra/newview/llfloaterperformance.cpp
+++ b/indra/newview/llfloaterperformance.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloaterperformance.cpp
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -186,7 +186,7 @@ void LLFloaterPerformance::draw()
{
enableAutotuneWarning();
- if (mUpdateTimer->hasExpired() &&
+ if (mUpdateTimer->hasExpired() &&
!LLFloaterReg::instanceVisible("save_pref_preset", PRESETS_GRAPHIC)) // give user a chance to save the graphics settings before updating them
{
setFPSText();
@@ -447,7 +447,7 @@ void LLFloaterPerformance::populateNearbyList()
row[0]["column"] = "complex_visual";
row[0]["type"] = "bar";
LLSD& value = row[0]["value"];
- // The ratio used in the bar is the current cost, as soon as we take action this changes so we keep the
+ // The ratio used in the bar is the current cost, as soon as we take action this changes so we keep the
// pre-tune value for the numerical column and sorting.
value["ratio"] = render_av_gpu_ms / mNearbyMaxGPUTime;
value["bottom"] = BAR_BOTTOM_PAD;
@@ -571,7 +571,7 @@ void LLFloaterPerformance::updateMaxRenderTime()
{
LLAvatarComplexityControls::updateMaxRenderTime(
mNearbyPanel->getChild<LLSliderCtrl>("RenderAvatarMaxART"),
- mNearbyPanel->getChild<LLTextBox>("RenderAvatarMaxARTText"),
+ mNearbyPanel->getChild<LLTextBox>("RenderAvatarMaxARTText"),
true);
}
@@ -684,7 +684,7 @@ bool is_ALM_available()
{
bool bumpshiny = LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump");
bool shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders");
-
+
return LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
bumpshiny &&
shaders;
diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h
index 620dbac5bb..d2f45a9e2e 100644
--- a/indra/newview/llfloaterperformance.h
+++ b/indra/newview/llfloaterperformance.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloaterperformance.h
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -98,7 +98,7 @@ private:
// -1.f if no profile has happened yet
F32 mNearbyMaxGPUTime = -1.f;
- boost::signals2::connection mMaxARTChangedSignal;
+ boost::signals2::connection mMaxARTChangedSignal;
};
#endif // LL_LLFLOATERPERFORMANCE_H
diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp
index b53839977e..15ca87c326 100644
--- a/indra/newview/llfloaterperms.cpp
+++ b/indra/newview/llfloaterperms.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterperms.cpp
* @brief Asset creation permission preferences.
* @author Jonathan Yap
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,127 +48,127 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed)
BOOL LLFloaterPerms::postBuild()
{
- return TRUE;
+ return TRUE;
}
-//static
+//static
U32 LLFloaterPerms::getGroupPerms(std::string prefix)
-{
- return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY | PERM_MOVE | PERM_MODIFY : PERM_NONE;
+{
+ return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY | PERM_MOVE | PERM_MODIFY : PERM_NONE;
}
-//static
+//static
U32 LLFloaterPerms::getEveryonePerms(std::string prefix)
{
- return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE;
+ return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE;
}
-//static
+//static
U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix)
{
- U32 flags = PERM_MOVE;
- if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") )
- {
- flags |= PERM_COPY;
- }
- if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") )
- {
- flags |= PERM_MODIFY;
- }
- if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") )
- {
- flags |= PERM_TRANSFER;
- }
- return flags;
+ U32 flags = PERM_MOVE;
+ if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") )
+ {
+ flags |= PERM_COPY;
+ }
+ if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") )
+ {
+ flags |= PERM_MODIFY;
+ }
+ if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") )
+ {
+ flags |= PERM_TRANSFER;
+ }
+ return flags;
}
-//static
+//static
U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix)
{
- // Sets bits for permissions that are off
- U32 flags = PERM_MOVE;
- if ( !gSavedSettings.getBOOL(prefix+"NextOwnerCopy") )
- {
- flags |= PERM_COPY;
- }
- if ( !gSavedSettings.getBOOL(prefix+"NextOwnerModify") )
- {
- flags |= PERM_MODIFY;
- }
- if ( !gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") )
- {
- flags |= PERM_TRANSFER;
- }
- return flags;
+ // Sets bits for permissions that are off
+ U32 flags = PERM_MOVE;
+ if ( !gSavedSettings.getBOOL(prefix+"NextOwnerCopy") )
+ {
+ flags |= PERM_COPY;
+ }
+ if ( !gSavedSettings.getBOOL(prefix+"NextOwnerModify") )
+ {
+ flags |= PERM_MODIFY;
+ }
+ if ( !gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") )
+ {
+ flags |= PERM_TRANSFER;
+ }
+ return flags;
}
static bool mCapSent = false;
LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed)
- : LLFloater(seed)
+ : LLFloater(seed)
{
- mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2));
- mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this));
- mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this));
+ mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2));
+ mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this));
+ mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this));
}
-
+
// String equivalents of enum Categories - initialization order must match enum order!
const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] =
{
- "Objects",
- "Uploads",
- "Scripts",
- "Notecards",
- "Gestures",
- "Wearables",
- "Settings",
- "Materials"
+ "Objects",
+ "Uploads",
+ "Scripts",
+ "Notecards",
+ "Gestures",
+ "Wearables",
+ "Settings",
+ "Materials"
};
BOOL LLFloaterPermsDefault::postBuild()
{
- if(!gSavedSettings.getBOOL("DefaultUploadPermissionsConverted"))
- {
- gSavedSettings.setBOOL("UploadsEveryoneCopy", gSavedSettings.getBOOL("EveryoneCopy"));
- gSavedSettings.setBOOL("UploadsNextOwnerCopy", gSavedSettings.getBOOL("NextOwnerCopy"));
- gSavedSettings.setBOOL("UploadsNextOwnerModify", gSavedSettings.getBOOL("NextOwnerModify"));
- gSavedSettings.setBOOL("UploadsNextOwnerTransfer", gSavedSettings.getBOOL("NextOwnerTransfer"));
- gSavedSettings.setBOOL("UploadsShareWithGroup", gSavedSettings.getBOOL("ShareWithGroup"));
- gSavedSettings.setBOOL("DefaultUploadPermissionsConverted", true);
- }
-
- mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this));
-
- refresh();
-
- return true;
+ if(!gSavedSettings.getBOOL("DefaultUploadPermissionsConverted"))
+ {
+ gSavedSettings.setBOOL("UploadsEveryoneCopy", gSavedSettings.getBOOL("EveryoneCopy"));
+ gSavedSettings.setBOOL("UploadsNextOwnerCopy", gSavedSettings.getBOOL("NextOwnerCopy"));
+ gSavedSettings.setBOOL("UploadsNextOwnerModify", gSavedSettings.getBOOL("NextOwnerModify"));
+ gSavedSettings.setBOOL("UploadsNextOwnerTransfer", gSavedSettings.getBOOL("NextOwnerTransfer"));
+ gSavedSettings.setBOOL("UploadsShareWithGroup", gSavedSettings.getBOOL("ShareWithGroup"));
+ gSavedSettings.setBOOL("DefaultUploadPermissionsConverted", true);
+ }
+
+ mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this));
+
+ refresh();
+
+ return true;
}
void LLFloaterPermsDefault::onClickOK()
{
- ok();
- closeFloater();
+ ok();
+ closeFloater();
}
void LLFloaterPermsDefault::onClickCancel()
{
- cancel();
- closeFloater();
+ cancel();
+ closeFloater();
}
void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data)
{
- // Implements fair use
- std::string prefix = user_data.asString();
-
- BOOL copyable = gSavedSettings.getBOOL(prefix+"NextOwnerCopy");
- if(!copyable)
- {
- gSavedSettings.setBOOL(prefix+"NextOwnerTransfer", TRUE);
- }
- LLCheckBoxCtrl* xfer = getChild<LLCheckBoxCtrl>(prefix+"_transfer");
- xfer->setEnabled(copyable);
+ // Implements fair use
+ std::string prefix = user_data.asString();
+
+ BOOL copyable = gSavedSettings.getBOOL(prefix+"NextOwnerCopy");
+ if(!copyable)
+ {
+ gSavedSettings.setBOOL(prefix+"NextOwnerTransfer", TRUE);
+ }
+ LLCheckBoxCtrl* xfer = getChild<LLCheckBoxCtrl>(prefix+"_transfer");
+ xfer->setEnabled(copyable);
}
const int MAX_HTTP_RETRIES = 5;
@@ -176,10 +176,10 @@ const float RETRY_TIMEOUT = 5.0;
void LLFloaterPermsDefault::sendInitialPerms()
{
- if(!mCapSent)
- {
- updateCap();
- }
+ if(!mCapSent)
+ {
+ updateCap();
+ }
}
void LLFloaterPermsDefault::updateCap()
@@ -189,13 +189,13 @@ void LLFloaterPermsDefault::updateCap()
LL_WARNS("Avatar") << "Region not set, cannot request capability update" << LL_ENDL;
return;
}
- std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences");
+ std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences");
- if(!object_url.empty())
- {
+ if(!object_url.empty())
+ {
LLCoros::instance().launch("LLFloaterPermsDefault::updateCapCoro",
boost::bind(&LLFloaterPermsDefault::updateCapCoro, object_url));
- }
+ }
else
{
LL_DEBUGS("ObjectPermissionsFloater") << "AgentPreferences cap not available." << LL_ENDL;
@@ -267,40 +267,40 @@ void LLFloaterPermsDefault::updateCapCoro(std::string url)
void LLFloaterPermsDefault::setCapSent(bool cap_sent)
{
- mCapSent = cap_sent;
+ mCapSent = cap_sent;
}
void LLFloaterPermsDefault::ok()
{
-// Changes were already applied automatically to saved settings.
-// Refreshing internal values makes it official.
- refresh();
+// Changes were already applied automatically to saved settings.
+// Refreshing internal values makes it official.
+ refresh();
// We know some setting has changed but not which one. Just in case it was a setting for
// object permissions tell the server what the values are.
- updateCap();
+ updateCap();
}
void LLFloaterPermsDefault::cancel()
{
- for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++)
- {
- gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]);
- gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerModify", mNextOwnerModify[iter]);
- gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]);
- gSavedSettings.setBOOL(sCategoryNames[iter]+"ShareWithGroup", mShareWithGroup[iter]);
- gSavedSettings.setBOOL(sCategoryNames[iter]+"EveryoneCopy", mEveryoneCopy[iter]);
- }
+ for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++)
+ {
+ gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]);
+ gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerModify", mNextOwnerModify[iter]);
+ gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]);
+ gSavedSettings.setBOOL(sCategoryNames[iter]+"ShareWithGroup", mShareWithGroup[iter]);
+ gSavedSettings.setBOOL(sCategoryNames[iter]+"EveryoneCopy", mEveryoneCopy[iter]);
+ }
}
void LLFloaterPermsDefault::refresh()
{
- for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++)
- {
- mShareWithGroup[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"ShareWithGroup");
- mEveryoneCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"EveryoneCopy");
- mNextOwnerCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerCopy");
- mNextOwnerModify[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerModify");
- mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerTransfer");
- }
+ for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++)
+ {
+ mShareWithGroup[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"ShareWithGroup");
+ mEveryoneCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"EveryoneCopy");
+ mNextOwnerCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerCopy");
+ mNextOwnerModify[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerModify");
+ mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerTransfer");
+ }
}
diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h
index 97ddec7cba..639d678781 100644
--- a/indra/newview/llfloaterperms.h
+++ b/indra/newview/llfloaterperms.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterperms.h
* @brief Asset creation permission preferences.
* @author Jonathan Yap
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,65 +34,65 @@
class LLFloaterPerms : public LLFloater
{
- friend class LLFloaterReg;
-
+ friend class LLFloaterReg;
+
public:
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- // Convenience methods to get current permission preference bitfields from saved settings:
- static U32 getEveryonePerms(std::string prefix=""); // prefix + "EveryoneCopy"
- static U32 getGroupPerms(std::string prefix=""); // prefix + "ShareWithGroup"
- static U32 getNextOwnerPerms(std::string prefix=""); // bitfield for prefix + "NextOwner" + "Copy", "Modify", and "Transfer"
- static U32 getNextOwnerPermsInverted(std::string prefix="");
+ // Convenience methods to get current permission preference bitfields from saved settings:
+ static U32 getEveryonePerms(std::string prefix=""); // prefix + "EveryoneCopy"
+ static U32 getGroupPerms(std::string prefix=""); // prefix + "ShareWithGroup"
+ static U32 getNextOwnerPerms(std::string prefix=""); // bitfield for prefix + "NextOwner" + "Copy", "Modify", and "Transfer"
+ static U32 getNextOwnerPermsInverted(std::string prefix="");
private:
- LLFloaterPerms(const LLSD& seed);
+ LLFloaterPerms(const LLSD& seed);
};
class LLFloaterPermsDefault : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- /*virtual*/ BOOL postBuild();
- void ok();
- void cancel();
- void onClickOK();
- void onClickCancel();
- void onCommitCopy(const LLSD& user_data);
- static void sendInitialPerms();
- static void updateCap();
- static void setCapSent(bool cap_sent);
+ /*virtual*/ BOOL postBuild();
+ void ok();
+ void cancel();
+ void onClickOK();
+ void onClickCancel();
+ void onCommitCopy(const LLSD& user_data);
+ static void sendInitialPerms();
+ static void updateCap();
+ static void setCapSent(bool cap_sent);
// Update instantiation of sCategoryNames in the .cpp file to match if you change this!
enum Categories
{
- CAT_OBJECTS,
- CAT_UPLOADS,
- CAT_SCRIPTS,
- CAT_NOTECARDS,
- CAT_GESTURES,
- CAT_WEARABLES,
- CAT_SETTINGS,
+ CAT_OBJECTS,
+ CAT_UPLOADS,
+ CAT_SCRIPTS,
+ CAT_NOTECARDS,
+ CAT_GESTURES,
+ CAT_WEARABLES,
+ CAT_SETTINGS,
CAT_MATERIALS,
- CAT_LAST
+ CAT_LAST
};
private:
- LLFloaterPermsDefault(const LLSD& seed);
- void refresh();
+ LLFloaterPermsDefault(const LLSD& seed);
+ void refresh();
- static const std::string sCategoryNames[CAT_LAST];
+ static const std::string sCategoryNames[CAT_LAST];
static void updateCapCoro(std::string url);
- // cached values only for implementing cancel.
- bool mShareWithGroup[CAT_LAST];
- bool mEveryoneCopy[CAT_LAST];
- bool mNextOwnerCopy[CAT_LAST];
- bool mNextOwnerModify[CAT_LAST];
- bool mNextOwnerTransfer[CAT_LAST];
+ // cached values only for implementing cancel.
+ bool mShareWithGroup[CAT_LAST];
+ bool mEveryoneCopy[CAT_LAST];
+ bool mNextOwnerCopy[CAT_LAST];
+ bool mNextOwnerModify[CAT_LAST];
+ bool mNextOwnerTransfer[CAT_LAST];
};
#endif
diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp
index 2d61109e17..af4f6b53bb 100644
--- a/indra/newview/llfloaterpostprocess.cpp
+++ b/indra/newview/llfloaterpostprocess.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterpostprocess.cpp
* @brief LLFloaterPostProcess class definition
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,179 +51,179 @@ LLFloaterPostProcess::~LLFloaterPostProcess()
}
BOOL LLFloaterPostProcess::postBuild()
{
- /// Color Filter Callbacks
- childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter");
- //childSetCommitCallback("ColorFilterGamma", &LLFloaterPostProcess::onFloatControlMoved, &(gPostProcess->tweaks.gamma()));
- childSetCommitCallback("ColorFilterBrightness", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness");
- childSetCommitCallback("ColorFilterSaturation", &LLFloaterPostProcess::onFloatControlMoved, (char*)"saturation");
- childSetCommitCallback("ColorFilterContrast", &LLFloaterPostProcess::onFloatControlMoved, (char*)"contrast");
-
- childSetCommitCallback("ColorFilterBaseR", &LLFloaterPostProcess::onColorControlRMoved, (char*)"contrast_base");
- childSetCommitCallback("ColorFilterBaseG", &LLFloaterPostProcess::onColorControlGMoved, (char*)"contrast_base");
- childSetCommitCallback("ColorFilterBaseB", &LLFloaterPostProcess::onColorControlBMoved, (char*)"contrast_base");
- childSetCommitCallback("ColorFilterBaseI", &LLFloaterPostProcess::onColorControlIMoved, (char*)"contrast_base");
-
- /// Night Vision Callbacks
- childSetCommitCallback("NightVisionToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_night_vision");
- childSetCommitCallback("NightVisionBrightMult", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness_multiplier");
- childSetCommitCallback("NightVisionNoiseSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_size");
- childSetCommitCallback("NightVisionNoiseStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_strength");
-
- /// Bloom Callbacks
- childSetCommitCallback("BloomToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_bloom");
- childSetCommitCallback("BloomExtract", &LLFloaterPostProcess::onFloatControlMoved, (char*)"extract_low");
- childSetCommitCallback("BloomSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_width");
- childSetCommitCallback("BloomStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_strength");
-
- // Effect loading and saving.
- LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo");
- getChild<LLComboBox>("PPLoadEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onLoadEffect, this, comboBox));
- comboBox->setCommitCallback(boost::bind(&LLFloaterPostProcess::onChangeEffectName, this, _1));
-
- LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor");
- getChild<LLComboBox>("PPSaveEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onSaveEffect, this, editBox));
-
- syncMenu();
- return TRUE;
+ /// Color Filter Callbacks
+ childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter");
+ //childSetCommitCallback("ColorFilterGamma", &LLFloaterPostProcess::onFloatControlMoved, &(gPostProcess->tweaks.gamma()));
+ childSetCommitCallback("ColorFilterBrightness", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness");
+ childSetCommitCallback("ColorFilterSaturation", &LLFloaterPostProcess::onFloatControlMoved, (char*)"saturation");
+ childSetCommitCallback("ColorFilterContrast", &LLFloaterPostProcess::onFloatControlMoved, (char*)"contrast");
+
+ childSetCommitCallback("ColorFilterBaseR", &LLFloaterPostProcess::onColorControlRMoved, (char*)"contrast_base");
+ childSetCommitCallback("ColorFilterBaseG", &LLFloaterPostProcess::onColorControlGMoved, (char*)"contrast_base");
+ childSetCommitCallback("ColorFilterBaseB", &LLFloaterPostProcess::onColorControlBMoved, (char*)"contrast_base");
+ childSetCommitCallback("ColorFilterBaseI", &LLFloaterPostProcess::onColorControlIMoved, (char*)"contrast_base");
+
+ /// Night Vision Callbacks
+ childSetCommitCallback("NightVisionToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_night_vision");
+ childSetCommitCallback("NightVisionBrightMult", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness_multiplier");
+ childSetCommitCallback("NightVisionNoiseSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_size");
+ childSetCommitCallback("NightVisionNoiseStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_strength");
+
+ /// Bloom Callbacks
+ childSetCommitCallback("BloomToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_bloom");
+ childSetCommitCallback("BloomExtract", &LLFloaterPostProcess::onFloatControlMoved, (char*)"extract_low");
+ childSetCommitCallback("BloomSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_width");
+ childSetCommitCallback("BloomStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_strength");
+
+ // Effect loading and saving.
+ LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo");
+ getChild<LLComboBox>("PPLoadEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onLoadEffect, this, comboBox));
+ comboBox->setCommitCallback(boost::bind(&LLFloaterPostProcess::onChangeEffectName, this, _1));
+
+ LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor");
+ getChild<LLComboBox>("PPSaveEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onSaveEffect, this, editBox));
+
+ syncMenu();
+ return TRUE;
}
// Bool Toggle
void LLFloaterPostProcess::onBoolToggle(LLUICtrl* ctrl, void* userData)
{
- char const * boolVariableName = (char const *)userData;
-
- // check the bool
- LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
- gPostProcess->tweaks[boolVariableName] = cbCtrl->getValue();
+ char const * boolVariableName = (char const *)userData;
+
+ // check the bool
+ LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
+ gPostProcess->tweaks[boolVariableName] = cbCtrl->getValue();
}
// Float Moved
void LLFloaterPostProcess::onFloatControlMoved(LLUICtrl* ctrl, void* userData)
{
- char const * floatVariableName = (char const *)userData;
- LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- gPostProcess->tweaks[floatVariableName] = sldrCtrl->getValue();
+ char const * floatVariableName = (char const *)userData;
+ LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ gPostProcess->tweaks[floatVariableName] = sldrCtrl->getValue();
}
// Color Moved
void LLFloaterPostProcess::onColorControlRMoved(LLUICtrl* ctrl, void* userData)
{
- char const * floatVariableName = (char const *)userData;
- LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- gPostProcess->tweaks[floatVariableName][0] = sldrCtrl->getValue();
+ char const * floatVariableName = (char const *)userData;
+ LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ gPostProcess->tweaks[floatVariableName][0] = sldrCtrl->getValue();
}
// Color Moved
void LLFloaterPostProcess::onColorControlGMoved(LLUICtrl* ctrl, void* userData)
{
- char const * floatVariableName = (char const *)userData;
- LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- gPostProcess->tweaks[floatVariableName][1] = sldrCtrl->getValue();
+ char const * floatVariableName = (char const *)userData;
+ LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ gPostProcess->tweaks[floatVariableName][1] = sldrCtrl->getValue();
}
// Color Moved
void LLFloaterPostProcess::onColorControlBMoved(LLUICtrl* ctrl, void* userData)
{
- char const * floatVariableName = (char const *)userData;
- LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- gPostProcess->tweaks[floatVariableName][2] = sldrCtrl->getValue();
+ char const * floatVariableName = (char const *)userData;
+ LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ gPostProcess->tweaks[floatVariableName][2] = sldrCtrl->getValue();
}
// Color Moved
void LLFloaterPostProcess::onColorControlIMoved(LLUICtrl* ctrl, void* userData)
{
- char const * floatVariableName = (char const *)userData;
- LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- gPostProcess->tweaks[floatVariableName][3] = sldrCtrl->getValue();
+ char const * floatVariableName = (char const *)userData;
+ LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
+ gPostProcess->tweaks[floatVariableName][3] = sldrCtrl->getValue();
}
void LLFloaterPostProcess::onLoadEffect(LLComboBox* comboBox)
{
- LLSD::String effectName(comboBox->getSelectedValue().asString());
+ LLSD::String effectName(comboBox->getSelectedValue().asString());
- gPostProcess->setSelectedEffect(effectName);
+ gPostProcess->setSelectedEffect(effectName);
- syncMenu();
+ syncMenu();
}
void LLFloaterPostProcess::onSaveEffect(LLLineEditor* editBox)
{
- std::string effectName(editBox->getValue().asString());
-
- if (gPostProcess->mAllEffects.has(effectName))
- {
- LLSD payload;
- payload["effect_name"] = effectName;
- LLNotificationsUtil::add("PPSaveEffectAlert", LLSD(), payload, boost::bind(&LLFloaterPostProcess::saveAlertCallback, this, _1, _2));
- }
- else
- {
- gPostProcess->saveEffect(effectName);
- syncMenu();
- }
+ std::string effectName(editBox->getValue().asString());
+
+ if (gPostProcess->mAllEffects.has(effectName))
+ {
+ LLSD payload;
+ payload["effect_name"] = effectName;
+ LLNotificationsUtil::add("PPSaveEffectAlert", LLSD(), payload, boost::bind(&LLFloaterPostProcess::saveAlertCallback, this, _1, _2));
+ }
+ else
+ {
+ gPostProcess->saveEffect(effectName);
+ syncMenu();
+ }
}
void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl)
{
- // get the combo box and name
- LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor");
+ // get the combo box and name
+ LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor");
- // set the parameter's new name
- editBox->setValue(ctrl->getValue());
+ // set the parameter's new name
+ editBox->setValue(ctrl->getValue());
}
bool LLFloaterPostProcess::saveAlertCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- // if they choose save, do it. Otherwise, don't do anything
- if (option == 0)
- {
- gPostProcess->saveEffect(notification["payload"]["effect_name"].asString());
+ // if they choose save, do it. Otherwise, don't do anything
+ if (option == 0)
+ {
+ gPostProcess->saveEffect(notification["payload"]["effect_name"].asString());
- syncMenu();
- }
- return false;
+ syncMenu();
+ }
+ return false;
}
void LLFloaterPostProcess::syncMenu()
{
- // add the combo boxe contents
- LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo");
-
- comboBox->removeall();
-
- LLSD::map_const_iterator currEffect;
- for(currEffect = gPostProcess->mAllEffects.beginMap();
- currEffect != gPostProcess->mAllEffects.endMap();
- ++currEffect)
- {
- comboBox->add(currEffect->first);
- }
-
- // set the current effect as selected.
- comboBox->selectByValue(gPostProcess->getSelectedEffect());
-
- /// Sync Color Filter Menu
- getChild<LLUICtrl>("ColorFilterToggle")->setValue(gPostProcess->tweaks.useColorFilter());
- //getChild<LLUICtrl>("ColorFilterGamma")->setValue(gPostProcess->tweaks.gamma());
- getChild<LLUICtrl>("ColorFilterBrightness")->setValue(gPostProcess->tweaks.brightness());
- getChild<LLUICtrl>("ColorFilterSaturation")->setValue(gPostProcess->tweaks.saturation());
- getChild<LLUICtrl>("ColorFilterContrast")->setValue(gPostProcess->tweaks.contrast());
- getChild<LLUICtrl>("ColorFilterBaseR")->setValue(gPostProcess->tweaks.contrastBaseR());
- getChild<LLUICtrl>("ColorFilterBaseG")->setValue(gPostProcess->tweaks.contrastBaseG());
- getChild<LLUICtrl>("ColorFilterBaseB")->setValue(gPostProcess->tweaks.contrastBaseB());
- getChild<LLUICtrl>("ColorFilterBaseI")->setValue(gPostProcess->tweaks.contrastBaseIntensity());
-
- /// Sync Night Vision Menu
- getChild<LLUICtrl>("NightVisionToggle")->setValue(gPostProcess->tweaks.useNightVisionShader());
- getChild<LLUICtrl>("NightVisionBrightMult")->setValue(gPostProcess->tweaks.brightMult());
- getChild<LLUICtrl>("NightVisionNoiseSize")->setValue(gPostProcess->tweaks.noiseSize());
- getChild<LLUICtrl>("NightVisionNoiseStrength")->setValue(gPostProcess->tweaks.noiseStrength());
-
- /// Sync Bloom Menu
- getChild<LLUICtrl>("BloomToggle")->setValue(LLSD(gPostProcess->tweaks.useBloomShader()));
- getChild<LLUICtrl>("BloomExtract")->setValue(gPostProcess->tweaks.extractLow());
- getChild<LLUICtrl>("BloomSize")->setValue(gPostProcess->tweaks.bloomWidth());
- getChild<LLUICtrl>("BloomStrength")->setValue(gPostProcess->tweaks.bloomStrength());
+ // add the combo boxe contents
+ LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo");
+
+ comboBox->removeall();
+
+ LLSD::map_const_iterator currEffect;
+ for(currEffect = gPostProcess->mAllEffects.beginMap();
+ currEffect != gPostProcess->mAllEffects.endMap();
+ ++currEffect)
+ {
+ comboBox->add(currEffect->first);
+ }
+
+ // set the current effect as selected.
+ comboBox->selectByValue(gPostProcess->getSelectedEffect());
+
+ /// Sync Color Filter Menu
+ getChild<LLUICtrl>("ColorFilterToggle")->setValue(gPostProcess->tweaks.useColorFilter());
+ //getChild<LLUICtrl>("ColorFilterGamma")->setValue(gPostProcess->tweaks.gamma());
+ getChild<LLUICtrl>("ColorFilterBrightness")->setValue(gPostProcess->tweaks.brightness());
+ getChild<LLUICtrl>("ColorFilterSaturation")->setValue(gPostProcess->tweaks.saturation());
+ getChild<LLUICtrl>("ColorFilterContrast")->setValue(gPostProcess->tweaks.contrast());
+ getChild<LLUICtrl>("ColorFilterBaseR")->setValue(gPostProcess->tweaks.contrastBaseR());
+ getChild<LLUICtrl>("ColorFilterBaseG")->setValue(gPostProcess->tweaks.contrastBaseG());
+ getChild<LLUICtrl>("ColorFilterBaseB")->setValue(gPostProcess->tweaks.contrastBaseB());
+ getChild<LLUICtrl>("ColorFilterBaseI")->setValue(gPostProcess->tweaks.contrastBaseIntensity());
+
+ /// Sync Night Vision Menu
+ getChild<LLUICtrl>("NightVisionToggle")->setValue(gPostProcess->tweaks.useNightVisionShader());
+ getChild<LLUICtrl>("NightVisionBrightMult")->setValue(gPostProcess->tweaks.brightMult());
+ getChild<LLUICtrl>("NightVisionNoiseSize")->setValue(gPostProcess->tweaks.noiseSize());
+ getChild<LLUICtrl>("NightVisionNoiseStrength")->setValue(gPostProcess->tweaks.noiseStrength());
+
+ /// Sync Bloom Menu
+ getChild<LLUICtrl>("BloomToggle")->setValue(LLSD(gPostProcess->tweaks.useBloomShader()));
+ getChild<LLUICtrl>("BloomExtract")->setValue(gPostProcess->tweaks.extractLow());
+ getChild<LLUICtrl>("BloomSize")->setValue(gPostProcess->tweaks.bloomWidth());
+ getChild<LLUICtrl>("BloomStrength")->setValue(gPostProcess->tweaks.bloomStrength());
}
diff --git a/indra/newview/llfloaterpostprocess.h b/indra/newview/llfloaterpostprocess.h
index 424a5fc8f0..9e38e34170 100644
--- a/indra/newview/llfloaterpostprocess.h
+++ b/indra/newview/llfloaterpostprocess.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterpostprocess.h
* @brief LLFloaterPostProcess class definition
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,29 +47,29 @@ class LLFloaterPostProcess : public LLFloater
{
public:
- LLFloaterPostProcess(const LLSD& key);
- virtual ~LLFloaterPostProcess();
- /*virtual*/ BOOL postBuild();
+ LLFloaterPostProcess(const LLSD& key);
+ virtual ~LLFloaterPostProcess();
+ /*virtual*/ BOOL postBuild();
- /// post process callbacks
- static void onBoolToggle(LLUICtrl* ctrl, void* userData);
- static void onFloatControlMoved(LLUICtrl* ctrl, void* userData);
- static void onColorControlRMoved(LLUICtrl* ctrl, void* userData);
- static void onColorControlGMoved(LLUICtrl* ctrl, void* userData);
- static void onColorControlBMoved(LLUICtrl* ctrl, void* userData);
- static void onColorControlIMoved(LLUICtrl* ctrl, void* userData);
- void onLoadEffect(LLComboBox* comboBox);
- void onSaveEffect(LLLineEditor* editBox);
- void onChangeEffectName(LLUICtrl* ctrl);
+ /// post process callbacks
+ static void onBoolToggle(LLUICtrl* ctrl, void* userData);
+ static void onFloatControlMoved(LLUICtrl* ctrl, void* userData);
+ static void onColorControlRMoved(LLUICtrl* ctrl, void* userData);
+ static void onColorControlGMoved(LLUICtrl* ctrl, void* userData);
+ static void onColorControlBMoved(LLUICtrl* ctrl, void* userData);
+ static void onColorControlIMoved(LLUICtrl* ctrl, void* userData);
+ void onLoadEffect(LLComboBox* comboBox);
+ void onSaveEffect(LLLineEditor* editBox);
+ void onChangeEffectName(LLUICtrl* ctrl);
- /// prompts a user when overwriting an effect
- bool saveAlertCallback(const LLSD& notification, const LLSD& response);
+ /// prompts a user when overwriting an effect
+ bool saveAlertCallback(const LLSD& notification, const LLSD& response);
- /// sync up sliders
- void syncMenu();
+ /// sync up sliders
+ void syncMenu();
/*
- void refresh();
+ void refresh();
*/
public:
};
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index a3e173398f..858a64973b 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterpreference.cpp
* @brief Global preferences with and without persistence.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -159,14 +159,14 @@ struct LabelTable : public LLInitParam::Block<LabelTable>
};
-// global functions
+// global functions
// helper functions for getting/freeing the web browser media
// if creating/destroying these is too slow, we'll need to create
// a static member and update all our static callbacks
-void handleNameTagOptionChanged(const LLSD& newvalue);
-void handleDisplayNamesOptionChanged(const LLSD& newvalue);
+void handleNameTagOptionChanged(const LLSD& newvalue);
+void handleDisplayNamesOptionChanged(const LLSD& newvalue);
bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response);
bool callback_clear_cache(const LLSD& notification, const LLSD& response);
@@ -177,79 +177,79 @@ void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator);
bool callback_clear_cache(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if ( option == 0 ) // YES
- {
- // flag client texture cache for clearing next time the client runs
- gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
- LLNotificationsUtil::add("CacheWillClear");
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if ( option == 0 ) // YES
+ {
+ // flag client texture cache for clearing next time the client runs
+ gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
+ LLNotificationsUtil::add("CacheWillClear");
+ }
- return false;
+ return false;
}
bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if ( option == 0 ) // YES
- {
- // clean web
- LLViewerMedia::getInstance()->clearAllCaches();
- LLViewerMedia::getInstance()->clearAllCookies();
-
- // clean nav bar history
- LLNavigationBar::getInstance()->clearHistoryCache();
-
- // flag client texture cache for clearing next time the client runs
- gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
- LLNotificationsUtil::add("CacheWillClear");
-
- LLSearchHistory::getInstance()->clearHistory();
- LLSearchHistory::getInstance()->save();
- LLSearchComboBox* search_ctrl = LLNavigationBar::getInstance()->getChild<LLSearchComboBox>("search_combo_box");
- search_ctrl->clearHistory();
-
- LLTeleportHistoryStorage::getInstance()->purgeItems();
- LLTeleportHistoryStorage::getInstance()->save();
- }
-
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if ( option == 0 ) // YES
+ {
+ // clean web
+ LLViewerMedia::getInstance()->clearAllCaches();
+ LLViewerMedia::getInstance()->clearAllCookies();
+
+ // clean nav bar history
+ LLNavigationBar::getInstance()->clearHistoryCache();
+
+ // flag client texture cache for clearing next time the client runs
+ gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
+ LLNotificationsUtil::add("CacheWillClear");
+
+ LLSearchHistory::getInstance()->clearHistory();
+ LLSearchHistory::getInstance()->save();
+ LLSearchComboBox* search_ctrl = LLNavigationBar::getInstance()->getChild<LLSearchComboBox>("search_combo_box");
+ search_ctrl->clearHistory();
+
+ LLTeleportHistoryStorage::getInstance()->purgeItems();
+ LLTeleportHistoryStorage::getInstance()->save();
+ }
+
+ return false;
}
void handleNameTagOptionChanged(const LLSD& newvalue)
{
- LLAvatarNameCache::getInstance()->setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames"));
- LLVOAvatar::invalidateNameTags();
+ LLAvatarNameCache::getInstance()->setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames"));
+ LLVOAvatar::invalidateNameTags();
}
void handleDisplayNamesOptionChanged(const LLSD& newvalue)
{
- LLAvatarNameCache::getInstance()->setUseDisplayNames(newvalue.asBoolean());
- LLVOAvatar::invalidateNameTags();
+ LLAvatarNameCache::getInstance()->setUseDisplayNames(newvalue.asBoolean());
+ LLVOAvatar::invalidateNameTags();
}
void handleAppearanceCameraMovementChanged(const LLSD& newvalue)
{
- if(!newvalue.asBoolean() && gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
- {
- gAgentCamera.changeCameraToDefault();
- gAgentCamera.resetView();
- }
+ if(!newvalue.asBoolean() && gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
+ {
+ gAgentCamera.changeCameraToDefault();
+ gAgentCamera.resetView();
+ }
}
void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator)
{
- numerator = 0;
- denominator = 0;
- for (F32 test_denominator = 1.f; test_denominator < 30.f; test_denominator += 1.f)
- {
- if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f)
- {
- numerator = ll_round(decimal_val * test_denominator);
- denominator = ll_round(test_denominator);
- break;
- }
- }
+ numerator = 0;
+ denominator = 0;
+ for (F32 test_denominator = 1.f; test_denominator < 30.f; test_denominator += 1.f)
+ {
+ if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f)
+ {
+ numerator = ll_round(decimal_val * test_denominator);
+ denominator = ll_round(test_denominator);
+ break;
+ }
+ }
}
// handle secondlife:///app/worldmap/{NAME}/{COORDS} URLs
@@ -295,89 +295,89 @@ LLKeybindingHandler gKeybindHandler;
std::string LLFloaterPreference::sSkin = "";
LLFloaterPreference::LLFloaterPreference(const LLSD& key)
- : LLFloater(key),
- mGotPersonalInfo(false),
- mLanguageChanged(false),
- mAvatarDataInitialized(false),
- mSearchDataDirty(true)
-{
- LLConversationLog::instance().addObserver(this);
-
- //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
-
- static bool registered_dialog = false;
- if (!registered_dialog)
- {
- LLFloaterReg::add("keybind_dialog", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLSetKeyBindDialog>);
- registered_dialog = true;
- }
-
- mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this, _2));
- mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this, _2));
-
- mCommitCallbackRegistrar.add("Pref.ClearCache", boost::bind(&LLFloaterPreference::onClickClearCache, this));
- mCommitCallbackRegistrar.add("Pref.WebClearCache", boost::bind(&LLFloaterPreference::onClickBrowserClearCache, this));
- mCommitCallbackRegistrar.add("Pref.SetCache", boost::bind(&LLFloaterPreference::onClickSetCache, this));
- mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this));
- mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2));
- mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this));
- mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this));
- mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this));
- mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this));
- mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this));
- mCommitCallbackRegistrar.add("Pref.RenderExceptions", boost::bind(&LLFloaterPreference::onClickRenderExceptions, this));
- mCommitCallbackRegistrar.add("Pref.AutoAdjustments", boost::bind(&LLFloaterPreference::onClickAutoAdjustments, this));
- mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this));
- mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this));
- mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this));
+ : LLFloater(key),
+ mGotPersonalInfo(false),
+ mLanguageChanged(false),
+ mAvatarDataInitialized(false),
+ mSearchDataDirty(true)
+{
+ LLConversationLog::instance().addObserver(this);
+
+ //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
+
+ static bool registered_dialog = false;
+ if (!registered_dialog)
+ {
+ LLFloaterReg::add("keybind_dialog", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLSetKeyBindDialog>);
+ registered_dialog = true;
+ }
+
+ mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this, _2));
+ mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this, _2));
+
+ mCommitCallbackRegistrar.add("Pref.ClearCache", boost::bind(&LLFloaterPreference::onClickClearCache, this));
+ mCommitCallbackRegistrar.add("Pref.WebClearCache", boost::bind(&LLFloaterPreference::onClickBrowserClearCache, this));
+ mCommitCallbackRegistrar.add("Pref.SetCache", boost::bind(&LLFloaterPreference::onClickSetCache, this));
+ mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this));
+ mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2));
+ mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this));
+ mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this));
+ mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this));
+ mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this));
+ mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this));
+ mCommitCallbackRegistrar.add("Pref.RenderExceptions", boost::bind(&LLFloaterPreference::onClickRenderExceptions, this));
+ mCommitCallbackRegistrar.add("Pref.AutoAdjustments", boost::bind(&LLFloaterPreference::onClickAutoAdjustments, this));
+ mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this));
+ mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this));
+ mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this));
mCommitCallbackRegistrar.add("Pref.RenderOptionUpdate", boost::bind(&LLFloaterPreference::onRenderOptionEnable, this));
- mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this));
- mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this));
- mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2));
- mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2));
- mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2));
- mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this));
- mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this));
- mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this));
- mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this));
- mCommitCallbackRegistrar.add("Pref.AutoReplace", boost::bind(&LLFloaterPreference::onClickAutoReplace, this));
- mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this));
- mCommitCallbackRegistrar.add("Pref.RememberedUsernames", boost::bind(&LLFloaterPreference::onClickRememberedUsernames, this));
- mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this));
- mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this));
-
- sSkin = gSavedSettings.getString("SkinCurrent");
-
- mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this));
-
- gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
- gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
- gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2));
-
- gSavedSettings.getControl("AppearanceCameraMovement")->getCommitSignal()->connect(boost::bind(&handleAppearanceCameraMovementChanged, _2));
+ mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this));
+ mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this));
+ mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2));
+ mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2));
+ mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2));
+ mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this));
+ mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this));
+ mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this));
+ mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this));
+ mCommitCallbackRegistrar.add("Pref.AutoReplace", boost::bind(&LLFloaterPreference::onClickAutoReplace, this));
+ mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this));
+ mCommitCallbackRegistrar.add("Pref.RememberedUsernames", boost::bind(&LLFloaterPreference::onClickRememberedUsernames, this));
+ mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this));
+ mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this));
+
+ sSkin = gSavedSettings.getString("SkinCurrent");
+
+ mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this));
+
+ gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
+ gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
+ gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2));
+
+ gSavedSettings.getControl("AppearanceCameraMovement")->getCommitSignal()->connect(boost::bind(&handleAppearanceCameraMovementChanged, _2));
gSavedSettings.getControl("WindLightUseAtmosShaders")->getCommitSignal()->connect(boost::bind(&LLFloaterPreference::onAtmosShaderChange, this));
- LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
+ LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreference::updateComplexityText, this));
- mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance()));
- mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this));
- mCommitCallbackRegistrar.add("UpdateFilter", boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false)); // <FS:ND/> Hook up for filtering
+ mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance()));
+ mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this));
+ mCommitCallbackRegistrar.add("UpdateFilter", boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false)); // <FS:ND/> Hook up for filtering
}
void LLFloaterPreference::processProperties( void* pData, EAvatarProcessorType type )
{
- if ( APT_PROPERTIES == type )
- {
- const LLAvatarData* pAvatarData = static_cast<const LLAvatarData*>( pData );
- if (pAvatarData && (gAgent.getID() == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null))
- {
+ if ( APT_PROPERTIES == type )
+ {
+ const LLAvatarData* pAvatarData = static_cast<const LLAvatarData*>( pData );
+ if (pAvatarData && (gAgent.getID() == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null))
+ {
mAllowPublish = (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH);
mAvatarDataInitialized = true;
getChild<LLUICtrl>("online_searchresults")->setValue(mAllowPublish);
- }
- }
+ }
+ }
}
void LLFloaterPreference::saveAvatarProperties( void )
@@ -430,247 +430,247 @@ void LLFloaterPreference::saveAvatarPropertiesCoro(const std::string cap_url, bo
BOOL LLFloaterPreference::postBuild()
{
- gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false));
+ gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false));
- gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged));
+ gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged));
- gSavedSettings.getControl("ChatBubbleOpacity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onNameTagOpacityChange, this, _2));
+ gSavedSettings.getControl("ChatBubbleOpacity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onNameTagOpacityChange, this, _2));
- gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this));
+ gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this));
- gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this));
+ gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this));
gSavedPerAccountSettings.getControl("PBRUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangePBRFolder, this));
- gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this));
- gSavedPerAccountSettings.getControl("SoundUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeSoundFolder, this));
- gSavedPerAccountSettings.getControl("AnimationUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeAnimationFolder, this));
-
- LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
- if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab")))
- tabcontainer->selectFirstTab();
-
- getChild<LLUICtrl>("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227)
- std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
- setCacheLocation(cache_location);
-
- getChild<LLUICtrl>("log_path_string")->setEnabled(FALSE); // make it read-only but selectable
-
- getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this));
-
- getChild<LLComboBox>("FriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"FriendIMOptions"));
- getChild<LLComboBox>("NonFriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NonFriendIMOptions"));
- getChild<LLComboBox>("ConferenceIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ConferenceIMOptions"));
- getChild<LLComboBox>("GroupChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"GroupChatOptions"));
- getChild<LLComboBox>("NearbyChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NearbyChatOptions"));
- getChild<LLComboBox>("ObjectIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ObjectIMOptions"));
-
- // if floater is opened before login set default localized do not disturb message
- if (LLStartUp::getStartupState() < STATE_STARTED)
- {
- gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault"));
- }
-
- // set 'enable' property for 'Clear log...' button
- changed();
-
- LLLogChat::getInstance()->setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this));
-
- LLSliderCtrl* fov_slider = getChild<LLSliderCtrl>("camera_fov");
- fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
- fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView());
-
- // Hook up and init for filtering
- mFilterEdit = getChild<LLSearchEditor>("search_prefs_edit");
- mFilterEdit->setKeystrokeCallback(boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false));
-
- // Load and assign label for 'default language'
- std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "default_languages.xml");
- std::map<std::string, std::string> labels;
- if (loadFromFilename(user_filename, labels))
- {
- std::string system_lang = gSavedSettings.getString("SystemLanguage");
- std::map<std::string, std::string>::iterator iter = labels.find(system_lang);
- if (iter != labels.end())
- {
- getChild<LLComboBox>("language_combobox")->add(iter->second, LLSD("default"), ADD_TOP, true);
- }
- else
- {
- LL_WARNS() << "Language \"" << system_lang << "\" is not in default_languages.xml" << LL_ENDL;
- getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true);
- }
- }
- else
- {
- LL_WARNS() << "Failed to load labels from " << user_filename << ". Using default." << LL_ENDL;
- getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true);
- }
-
- return TRUE;
+ gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this));
+ gSavedPerAccountSettings.getControl("SoundUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeSoundFolder, this));
+ gSavedPerAccountSettings.getControl("AnimationUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeAnimationFolder, this));
+
+ LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
+ if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab")))
+ tabcontainer->selectFirstTab();
+
+ getChild<LLUICtrl>("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227)
+ std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
+ setCacheLocation(cache_location);
+
+ getChild<LLUICtrl>("log_path_string")->setEnabled(FALSE); // make it read-only but selectable
+
+ getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this));
+
+ getChild<LLComboBox>("FriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"FriendIMOptions"));
+ getChild<LLComboBox>("NonFriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NonFriendIMOptions"));
+ getChild<LLComboBox>("ConferenceIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ConferenceIMOptions"));
+ getChild<LLComboBox>("GroupChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"GroupChatOptions"));
+ getChild<LLComboBox>("NearbyChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NearbyChatOptions"));
+ getChild<LLComboBox>("ObjectIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ObjectIMOptions"));
+
+ // if floater is opened before login set default localized do not disturb message
+ if (LLStartUp::getStartupState() < STATE_STARTED)
+ {
+ gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault"));
+ }
+
+ // set 'enable' property for 'Clear log...' button
+ changed();
+
+ LLLogChat::getInstance()->setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this));
+
+ LLSliderCtrl* fov_slider = getChild<LLSliderCtrl>("camera_fov");
+ fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
+ fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView());
+
+ // Hook up and init for filtering
+ mFilterEdit = getChild<LLSearchEditor>("search_prefs_edit");
+ mFilterEdit->setKeystrokeCallback(boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false));
+
+ // Load and assign label for 'default language'
+ std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "default_languages.xml");
+ std::map<std::string, std::string> labels;
+ if (loadFromFilename(user_filename, labels))
+ {
+ std::string system_lang = gSavedSettings.getString("SystemLanguage");
+ std::map<std::string, std::string>::iterator iter = labels.find(system_lang);
+ if (iter != labels.end())
+ {
+ getChild<LLComboBox>("language_combobox")->add(iter->second, LLSD("default"), ADD_TOP, true);
+ }
+ else
+ {
+ LL_WARNS() << "Language \"" << system_lang << "\" is not in default_languages.xml" << LL_ENDL;
+ getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true);
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Failed to load labels from " << user_filename << ". Using default." << LL_ENDL;
+ getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true);
+ }
+
+ return TRUE;
}
void LLFloaterPreference::updateDeleteTranscriptsButton()
{
- std::vector<std::string> list_of_transcriptions_file_names;
- LLLogChat::getListOfTranscriptFiles(list_of_transcriptions_file_names);
- getChild<LLButton>("delete_transcripts")->setEnabled(list_of_transcriptions_file_names.size() > 0);
+ std::vector<std::string> list_of_transcriptions_file_names;
+ LLLogChat::getListOfTranscriptFiles(list_of_transcriptions_file_names);
+ getChild<LLButton>("delete_transcripts")->setEnabled(list_of_transcriptions_file_names.size() > 0);
}
void LLFloaterPreference::onDoNotDisturbResponseChanged()
{
- // set "DoNotDisturbResponseChanged" TRUE if user edited message differs from default, FALSE otherwise
- bool response_changed_flag =
- LLTrans::getString("DoNotDisturbModeResponseDefault")
- != getChild<LLUICtrl>("do_not_disturb_response")->getValue().asString();
+ // set "DoNotDisturbResponseChanged" TRUE if user edited message differs from default, FALSE otherwise
+ bool response_changed_flag =
+ LLTrans::getString("DoNotDisturbModeResponseDefault")
+ != getChild<LLUICtrl>("do_not_disturb_response")->getValue().asString();
- gSavedPerAccountSettings.setBOOL("DoNotDisturbResponseChanged", response_changed_flag );
+ gSavedPerAccountSettings.setBOOL("DoNotDisturbResponseChanged", response_changed_flag );
}
LLFloaterPreference::~LLFloaterPreference()
{
- LLConversationLog::instance().removeObserver(this);
+ LLConversationLog::instance().removeObserver(this);
mComplexityChangedSignal.disconnect();
}
void LLFloaterPreference::draw()
{
- BOOL has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL);
- gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected);
-
- has_first_selected = (getChildRef<LLScrollListCtrl>("enabled_popups").getFirstSelected()!=NULL);
- gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected);
-
- LLFloater::draw();
+ BOOL has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL);
+ gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected);
+
+ has_first_selected = (getChildRef<LLScrollListCtrl>("enabled_popups").getFirstSelected()!=NULL);
+ gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected);
+
+ LLFloater::draw();
}
void LLFloaterPreference::saveSettings()
{
- LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
- child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
- child_list_t::const_iterator end = tabcontainer->getChildList()->end();
- for ( ; iter != end; ++iter)
- {
- LLView* view = *iter;
- LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
- if (panel)
- panel->saveSettings();
- }
+ LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
+ child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
+ child_list_t::const_iterator end = tabcontainer->getChildList()->end();
+ for ( ; iter != end; ++iter)
+ {
+ LLView* view = *iter;
+ LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
+ if (panel)
+ panel->saveSettings();
+ }
saveIgnoredNotifications();
-}
+}
void LLFloaterPreference::apply()
{
- LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
-
- LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
- if (sSkin != gSavedSettings.getString("SkinCurrent"))
- {
- LLNotificationsUtil::add("ChangeSkin");
- refreshSkin(this);
- }
- // Call apply() on all panels that derive from LLPanelPreference
- for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
- iter != tabcontainer->getChildList()->end(); ++iter)
- {
- LLView* view = *iter;
- LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
- if (panel)
- panel->apply();
- }
-
- gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor
-
- LLSliderCtrl* fov_slider = getChild<LLSliderCtrl>("camera_fov");
- fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
- fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView());
-
- std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
- setCacheLocation(cache_location);
-
- LLViewerMedia::getInstance()->setCookiesEnabled(getChild<LLUICtrl>("cookies_enabled")->getValue());
-
- if (hasChild("web_proxy_enabled", TRUE) &&hasChild("web_proxy_editor", TRUE) && hasChild("web_proxy_port", TRUE))
- {
- bool proxy_enable = getChild<LLUICtrl>("web_proxy_enabled")->getValue();
- std::string proxy_address = getChild<LLUICtrl>("web_proxy_editor")->getValue();
- int proxy_port = getChild<LLUICtrl>("web_proxy_port")->getValue();
- LLViewerMedia::getInstance()->setProxyConfig(proxy_enable, proxy_address, proxy_port);
- }
-
- if (mGotPersonalInfo)
- {
- bool new_hide_online = getChild<LLUICtrl>("online_visibility")->getValue().asBoolean();
-
- if (new_hide_online != mOriginalHideOnlineStatus)
- {
- // This hack is because we are representing several different
- // possible strings with a single checkbox. Since most users
- // can only select between 2 values, we represent it as a
- // checkbox. This breaks down a little bit for liaisons, but
- // works out in the end.
- if (new_hide_online != mOriginalHideOnlineStatus)
- {
- if (new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN;
- else mDirectoryVisibility = VISIBILITY_DEFAULT;
- //Update showonline value, otherwise multiple applys won't work
- mOriginalHideOnlineStatus = new_hide_online;
- }
- gAgent.sendAgentUpdateUserInfo(mDirectoryVisibility);
- }
- }
-
- saveAvatarProperties();
+ LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
+
+ LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
+ if (sSkin != gSavedSettings.getString("SkinCurrent"))
+ {
+ LLNotificationsUtil::add("ChangeSkin");
+ refreshSkin(this);
+ }
+ // Call apply() on all panels that derive from LLPanelPreference
+ for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
+ iter != tabcontainer->getChildList()->end(); ++iter)
+ {
+ LLView* view = *iter;
+ LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
+ if (panel)
+ panel->apply();
+ }
+
+ gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor
+
+ LLSliderCtrl* fov_slider = getChild<LLSliderCtrl>("camera_fov");
+ fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
+ fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView());
+
+ std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
+ setCacheLocation(cache_location);
+
+ LLViewerMedia::getInstance()->setCookiesEnabled(getChild<LLUICtrl>("cookies_enabled")->getValue());
+
+ if (hasChild("web_proxy_enabled", TRUE) &&hasChild("web_proxy_editor", TRUE) && hasChild("web_proxy_port", TRUE))
+ {
+ bool proxy_enable = getChild<LLUICtrl>("web_proxy_enabled")->getValue();
+ std::string proxy_address = getChild<LLUICtrl>("web_proxy_editor")->getValue();
+ int proxy_port = getChild<LLUICtrl>("web_proxy_port")->getValue();
+ LLViewerMedia::getInstance()->setProxyConfig(proxy_enable, proxy_address, proxy_port);
+ }
+
+ if (mGotPersonalInfo)
+ {
+ bool new_hide_online = getChild<LLUICtrl>("online_visibility")->getValue().asBoolean();
+
+ if (new_hide_online != mOriginalHideOnlineStatus)
+ {
+ // This hack is because we are representing several different
+ // possible strings with a single checkbox. Since most users
+ // can only select between 2 values, we represent it as a
+ // checkbox. This breaks down a little bit for liaisons, but
+ // works out in the end.
+ if (new_hide_online != mOriginalHideOnlineStatus)
+ {
+ if (new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN;
+ else mDirectoryVisibility = VISIBILITY_DEFAULT;
+ //Update showonline value, otherwise multiple applys won't work
+ mOriginalHideOnlineStatus = new_hide_online;
+ }
+ gAgent.sendAgentUpdateUserInfo(mDirectoryVisibility);
+ }
+ }
+
+ saveAvatarProperties();
}
void LLFloaterPreference::cancel()
{
- LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
- // Call cancel() on all panels that derive from LLPanelPreference
- for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
- iter != tabcontainer->getChildList()->end(); ++iter)
- {
- LLView* view = *iter;
- LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
- if (panel)
- panel->cancel();
- }
- // hide joystick pref floater
- LLFloaterReg::hideInstance("pref_joystick");
-
- // hide translation settings floater
- LLFloaterReg::hideInstance("prefs_translation");
-
- // hide autoreplace settings floater
- LLFloaterReg::hideInstance("prefs_autoreplace");
-
- // hide spellchecker settings folder
- LLFloaterReg::hideInstance("prefs_spellchecker");
-
- // hide advanced graphics floater
- LLFloaterReg::hideInstance("prefs_graphics_advanced");
-
- // reverts any changes to current skin
- gSavedSettings.setString("SkinCurrent", sSkin);
-
- updateClickActionViews();
-
- LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance<LLFloaterPreferenceProxy>("prefs_proxy");
- if (advanced_proxy_settings)
- {
- advanced_proxy_settings->cancel();
- }
- //Need to reload the navmesh if the pathing console is up
- LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle();
- if ( !pathfindingConsoleHandle.isDead() )
- {
- LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get();
- pPathfindingConsole->onRegionBoundaryCross();
- }
-
- if (!mSavedGraphicsPreset.empty())
- {
- gSavedSettings.setString("PresetGraphicActive", mSavedGraphicsPreset);
- LLPresetsManager::getInstance()->triggerChangeSignal();
- }
+ LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
+ // Call cancel() on all panels that derive from LLPanelPreference
+ for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
+ iter != tabcontainer->getChildList()->end(); ++iter)
+ {
+ LLView* view = *iter;
+ LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
+ if (panel)
+ panel->cancel();
+ }
+ // hide joystick pref floater
+ LLFloaterReg::hideInstance("pref_joystick");
+
+ // hide translation settings floater
+ LLFloaterReg::hideInstance("prefs_translation");
+
+ // hide autoreplace settings floater
+ LLFloaterReg::hideInstance("prefs_autoreplace");
+
+ // hide spellchecker settings folder
+ LLFloaterReg::hideInstance("prefs_spellchecker");
+
+ // hide advanced graphics floater
+ LLFloaterReg::hideInstance("prefs_graphics_advanced");
+
+ // reverts any changes to current skin
+ gSavedSettings.setString("SkinCurrent", sSkin);
+
+ updateClickActionViews();
+
+ LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance<LLFloaterPreferenceProxy>("prefs_proxy");
+ if (advanced_proxy_settings)
+ {
+ advanced_proxy_settings->cancel();
+ }
+ //Need to reload the navmesh if the pathing console is up
+ LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle();
+ if ( !pathfindingConsoleHandle.isDead() )
+ {
+ LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get();
+ pPathfindingConsole->onRegionBoundaryCross();
+ }
+
+ if (!mSavedGraphicsPreset.empty())
+ {
+ gSavedSettings.setString("PresetGraphicActive", mSavedGraphicsPreset);
+ LLPresetsManager::getInstance()->triggerChangeSignal();
+ }
restoreIgnoredNotifications();
}
@@ -678,157 +678,157 @@ void LLFloaterPreference::cancel()
void LLFloaterPreference::onOpen(const LLSD& key)
{
- // this variable and if that follows it are used to properly handle do not disturb mode response message
- static bool initialized = FALSE;
- // if user is logged in and we haven't initialized do not disturb mode response yet, do it
- if (!initialized && LLStartUp::getStartupState() == STATE_STARTED)
- {
- // Special approach is used for do not disturb response localization, because "DoNotDisturbModeResponse" is
- // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized.
- // To keep track of whether do not disturb response is default or changed by user additional setting DoNotDisturbResponseChanged
- // was added into per account settings.
-
- // initialization should happen once,so setting variable to TRUE
- initialized = TRUE;
- // this connection is needed to properly set "DoNotDisturbResponseChanged" setting when user makes changes in
- // do not disturb response message.
- gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this));
- }
- gAgent.sendAgentUserInfoRequest();
-
- /////////////////////////// From LLPanelGeneral //////////////////////////
- // if we have no agent, we can't let them choose anything
- // if we have an agent, then we only let them choose if they have a choice
- bool can_choose_maturity =
- gAgent.getID().notNull() &&
- (gAgent.isMature() || gAgent.isGodlike());
-
- LLComboBox* maturity_combo = getChild<LLComboBox>("maturity_desired_combobox");
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest( gAgent.getID() );
- if (can_choose_maturity)
- {
- // if they're not adult or a god, they shouldn't see the adult selection, so delete it
- if (!gAgent.isAdult() && !gAgent.isGodlikeWithoutAdminMenuFakery())
- {
- // we're going to remove the adult entry from the combo
- LLScrollListCtrl* maturity_list = maturity_combo->findChild<LLScrollListCtrl>("ComboBox");
- if (maturity_list)
- {
- maturity_list->deleteItems(LLSD(SIM_ACCESS_ADULT));
- }
- }
- getChildView("maturity_desired_combobox")->setEnabled( true);
- getChildView("maturity_desired_textbox")->setVisible( false);
- }
- else
- {
- getChild<LLUICtrl>("maturity_desired_textbox")->setValue(maturity_combo->getSelectedItemLabel());
- getChildView("maturity_desired_combobox")->setEnabled( false);
- }
-
- // Forget previous language changes.
- mLanguageChanged = false;
-
- // Display selected maturity icons.
- onChangeMaturity();
-
- onChangeModelFolder();
+ // this variable and if that follows it are used to properly handle do not disturb mode response message
+ static bool initialized = FALSE;
+ // if user is logged in and we haven't initialized do not disturb mode response yet, do it
+ if (!initialized && LLStartUp::getStartupState() == STATE_STARTED)
+ {
+ // Special approach is used for do not disturb response localization, because "DoNotDisturbModeResponse" is
+ // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized.
+ // To keep track of whether do not disturb response is default or changed by user additional setting DoNotDisturbResponseChanged
+ // was added into per account settings.
+
+ // initialization should happen once,so setting variable to TRUE
+ initialized = TRUE;
+ // this connection is needed to properly set "DoNotDisturbResponseChanged" setting when user makes changes in
+ // do not disturb response message.
+ gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this));
+ }
+ gAgent.sendAgentUserInfoRequest();
+
+ /////////////////////////// From LLPanelGeneral //////////////////////////
+ // if we have no agent, we can't let them choose anything
+ // if we have an agent, then we only let them choose if they have a choice
+ bool can_choose_maturity =
+ gAgent.getID().notNull() &&
+ (gAgent.isMature() || gAgent.isGodlike());
+
+ LLComboBox* maturity_combo = getChild<LLComboBox>("maturity_desired_combobox");
+ LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest( gAgent.getID() );
+ if (can_choose_maturity)
+ {
+ // if they're not adult or a god, they shouldn't see the adult selection, so delete it
+ if (!gAgent.isAdult() && !gAgent.isGodlikeWithoutAdminMenuFakery())
+ {
+ // we're going to remove the adult entry from the combo
+ LLScrollListCtrl* maturity_list = maturity_combo->findChild<LLScrollListCtrl>("ComboBox");
+ if (maturity_list)
+ {
+ maturity_list->deleteItems(LLSD(SIM_ACCESS_ADULT));
+ }
+ }
+ getChildView("maturity_desired_combobox")->setEnabled( true);
+ getChildView("maturity_desired_textbox")->setVisible( false);
+ }
+ else
+ {
+ getChild<LLUICtrl>("maturity_desired_textbox")->setValue(maturity_combo->getSelectedItemLabel());
+ getChildView("maturity_desired_combobox")->setEnabled( false);
+ }
+
+ // Forget previous language changes.
+ mLanguageChanged = false;
+
+ // Display selected maturity icons.
+ onChangeMaturity();
+
+ onChangeModelFolder();
onChangePBRFolder();
- onChangeTextureFolder();
- onChangeSoundFolder();
- onChangeAnimationFolder();
-
- // Load (double-)click to walk/teleport settings.
- updateClickActionViews();
-
- // Enabled/disabled popups, might have been changed by user actions
- // while preferences floater was closed.
- buildPopupLists();
-
-
- //get the options that were checked
- onNotificationsChange("FriendIMOptions");
- onNotificationsChange("NonFriendIMOptions");
- onNotificationsChange("ConferenceIMOptions");
- onNotificationsChange("GroupChatOptions");
- onNotificationsChange("NearbyChatOptions");
- onNotificationsChange("ObjectIMOptions");
-
- LLPanelLogin::setAlwaysRefresh(true);
- refresh();
-
- // Make sure the current state of prefs are saved away when
- // when the floater is opened. That will make cancel do its
- // job
- saveSettings();
-
- // Make sure there is a default preference file
- LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA);
- LLPresetsManager::getInstance()->createMissingDefault(PRESETS_GRAPHIC);
-
- bool started = (LLStartUp::getStartupState() == STATE_STARTED);
-
- LLButton* load_btn = findChild<LLButton>("PrefLoadButton");
- LLButton* save_btn = findChild<LLButton>("PrefSaveButton");
- LLButton* delete_btn = findChild<LLButton>("PrefDeleteButton");
- LLButton* exceptions_btn = findChild<LLButton>("RenderExceptionsButton");
+ onChangeTextureFolder();
+ onChangeSoundFolder();
+ onChangeAnimationFolder();
+
+ // Load (double-)click to walk/teleport settings.
+ updateClickActionViews();
+
+ // Enabled/disabled popups, might have been changed by user actions
+ // while preferences floater was closed.
+ buildPopupLists();
+
+
+ //get the options that were checked
+ onNotificationsChange("FriendIMOptions");
+ onNotificationsChange("NonFriendIMOptions");
+ onNotificationsChange("ConferenceIMOptions");
+ onNotificationsChange("GroupChatOptions");
+ onNotificationsChange("NearbyChatOptions");
+ onNotificationsChange("ObjectIMOptions");
+
+ LLPanelLogin::setAlwaysRefresh(true);
+ refresh();
+
+ // Make sure the current state of prefs are saved away when
+ // when the floater is opened. That will make cancel do its
+ // job
+ saveSettings();
+
+ // Make sure there is a default preference file
+ LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA);
+ LLPresetsManager::getInstance()->createMissingDefault(PRESETS_GRAPHIC);
+
+ bool started = (LLStartUp::getStartupState() == STATE_STARTED);
+
+ LLButton* load_btn = findChild<LLButton>("PrefLoadButton");
+ LLButton* save_btn = findChild<LLButton>("PrefSaveButton");
+ LLButton* delete_btn = findChild<LLButton>("PrefDeleteButton");
+ LLButton* exceptions_btn = findChild<LLButton>("RenderExceptionsButton");
LLButton* auto_adjustments_btn = findChild<LLButton>("AutoAdjustmentsButton");
- if (load_btn && save_btn && delete_btn && exceptions_btn && auto_adjustments_btn)
- {
- load_btn->setEnabled(started);
- save_btn->setEnabled(started);
- delete_btn->setEnabled(started);
- exceptions_btn->setEnabled(started);
+ if (load_btn && save_btn && delete_btn && exceptions_btn && auto_adjustments_btn)
+ {
+ load_btn->setEnabled(started);
+ save_btn->setEnabled(started);
+ delete_btn->setEnabled(started);
+ exceptions_btn->setEnabled(started);
auto_adjustments_btn->setEnabled(started);
- }
+ }
collectSearchableItems();
- if (!mFilterEdit->getText().empty())
- {
- mFilterEdit->setText(LLStringExplicit(""));
- onUpdateFilterTerm(true);
- }
+ if (!mFilterEdit->getText().empty())
+ {
+ mFilterEdit->setText(LLStringExplicit(""));
+ onUpdateFilterTerm(true);
+ }
}
void LLFloaterPreference::onRenderOptionEnable()
{
- refreshEnabledGraphics();
+ refreshEnabledGraphics();
}
void LLFloaterPreference::onAvatarImpostorsEnable()
{
- refreshEnabledGraphics();
+ refreshEnabledGraphics();
}
//static
void LLFloaterPreference::initDoNotDisturbResponse()
- {
- if (!gSavedPerAccountSettings.getBOOL("DoNotDisturbResponseChanged"))
- {
- //LLTrans::getString("DoNotDisturbModeResponseDefault") is used here for localization (EXT-5885)
- gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault"));
- }
- }
-
-//static
+ {
+ if (!gSavedPerAccountSettings.getBOOL("DoNotDisturbResponseChanged"))
+ {
+ //LLTrans::getString("DoNotDisturbModeResponseDefault") is used here for localization (EXT-5885)
+ gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault"));
+ }
+ }
+
+//static
void LLFloaterPreference::updateShowFavoritesCheckbox(bool val)
{
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
- instance->getChild<LLUICtrl>("favorites_on_login_check")->setValue(val);
- }
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance)
+ {
+ instance->getChild<LLUICtrl>("favorites_on_login_check")->setValue(val);
+ }
}
void LLFloaterPreference::setHardwareDefaults()
{
- std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
- if (!preset_graphic_active.empty())
- {
- saveGraphicsPreset(preset_graphic_active);
- saveSettings(); // save here to be able to return to the previous preset by Cancel
- }
+ std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
+ if (!preset_graphic_active.empty())
+ {
+ saveGraphicsPreset(preset_graphic_active);
+ saveSettings(); // save here to be able to return to the previous preset by Cancel
+ }
setRecommendedSettings();
}
@@ -837,27 +837,27 @@ void LLFloaterPreference::setRecommendedSettings()
resetAutotuneSettings();
gSavedSettings.getControl("RenderVSyncEnable")->resetToDefault(true);
- LLFeatureManager::getInstance()->applyRecommendedSettings();
+ LLFeatureManager::getInstance()->applyRecommendedSettings();
- // reset indirects before refresh because we may have changed what they control
- LLAvatarComplexityControls::setIndirectControls();
+ // reset indirects before refresh because we may have changed what they control
+ LLAvatarComplexityControls::setIndirectControls();
- refreshEnabledGraphics();
- gSavedSettings.setString("PresetGraphicActive", "");
- LLPresetsManager::getInstance()->triggerChangeSignal();
+ refreshEnabledGraphics();
+ gSavedSettings.setString("PresetGraphicActive", "");
+ LLPresetsManager::getInstance()->triggerChangeSignal();
- LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
- child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
- child_list_t::const_iterator end = tabcontainer->getChildList()->end();
- for ( ; iter != end; ++iter)
- {
- LLView* view = *iter;
- LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
- if (panel)
- {
- panel->setHardwareDefaults();
- }
- }
+ LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
+ child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
+ child_list_t::const_iterator end = tabcontainer->getChildList()->end();
+ for ( ; iter != end; ++iter)
+ {
+ LLView* view = *iter;
+ LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
+ if (panel)
+ {
+ panel->setHardwareDefaults();
+ }
+ }
}
void LLFloaterPreference::resetAutotuneSettings()
@@ -884,452 +884,452 @@ void LLFloaterPreference::resetAutotuneSettings()
void LLFloaterPreference::getControlNames(std::vector<std::string>& names)
{
- LLView* view = findChild<LLView>("display");
- LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
- if (view && advanced)
- {
- std::list<LLView*> stack;
- stack.push_back(view);
- stack.push_back(advanced);
- while(!stack.empty())
- {
- // Process view on top of the stack
- LLView* curview = stack.front();
- stack.pop_front();
-
- LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
- if (ctrl)
- {
- LLControlVariable* control = ctrl->getControlVariable();
- if (control)
- {
- std::string control_name = control->getName();
- if (std::find(names.begin(), names.end(), control_name) == names.end())
- {
- names.push_back(control_name);
- }
- }
- }
-
- for (child_list_t::const_iterator iter = curview->getChildList()->begin();
- iter != curview->getChildList()->end(); ++iter)
- {
- stack.push_back(*iter);
- }
- }
- }
+ LLView* view = findChild<LLView>("display");
+ LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
+ if (view && advanced)
+ {
+ std::list<LLView*> stack;
+ stack.push_back(view);
+ stack.push_back(advanced);
+ while(!stack.empty())
+ {
+ // Process view on top of the stack
+ LLView* curview = stack.front();
+ stack.pop_front();
+
+ LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
+ if (ctrl)
+ {
+ LLControlVariable* control = ctrl->getControlVariable();
+ if (control)
+ {
+ std::string control_name = control->getName();
+ if (std::find(names.begin(), names.end(), control_name) == names.end())
+ {
+ names.push_back(control_name);
+ }
+ }
+ }
+
+ for (child_list_t::const_iterator iter = curview->getChildList()->begin();
+ iter != curview->getChildList()->end(); ++iter)
+ {
+ stack.push_back(*iter);
+ }
+ }
+ }
}
//virtual
void LLFloaterPreference::onClose(bool app_quitting)
{
- gSavedSettings.setS32("LastPrefTab", getChild<LLTabContainer>("pref core")->getCurrentPanelIndex());
- LLPanelLogin::setAlwaysRefresh(false);
- if (!app_quitting)
- {
- cancel();
- }
+ gSavedSettings.setS32("LastPrefTab", getChild<LLTabContainer>("pref core")->getCurrentPanelIndex());
+ LLPanelLogin::setAlwaysRefresh(false);
+ if (!app_quitting)
+ {
+ cancel();
+ }
}
-// static
+// static
void LLFloaterPreference::onBtnOK(const LLSD& userdata)
{
- // commit any outstanding text entry
- if (hasFocus())
- {
- LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- if (cur_focus && cur_focus->acceptsTextInput())
- {
- cur_focus->onCommit();
- }
- }
-
- if (canClose())
- {
- saveSettings();
- apply();
-
- if (userdata.asString() == "closeadvanced")
- {
- LLFloaterReg::hideInstance("prefs_graphics_advanced");
- }
- else
- {
- closeFloater(false);
- }
-
- //Conversation transcript and log path changed so reload conversations based on new location
- if(mPriorInstantMessageLogPath.length())
- {
- if(moveTranscriptsAndLog())
- {
- //When floaters are empty but have a chat history files, reload chat history into them
- LLFloaterIMSessionTab::reloadEmptyFloaters();
- }
- //Couldn't move files so restore the old path and show a notification
- else
- {
- gSavedPerAccountSettings.setString("InstantMessageLogPath", mPriorInstantMessageLogPath);
- LLNotificationsUtil::add("PreferenceChatPathChanged");
- }
- mPriorInstantMessageLogPath.clear();
- }
-
- LLUIColorTable::instance().saveUserSettings();
- gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
-
- //Only save once logged in and loaded per account settings
- if(mGotPersonalInfo)
- {
- gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
- }
- }
- else
- {
- // Show beep, pop up dialog, etc.
- LL_INFOS("Preferences") << "Can't close preferences!" << LL_ENDL;
- }
-
- LLPanelLogin::updateLocationSelectorsVisibility();
- //Need to reload the navmesh if the pathing console is up
- LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle();
- if ( !pathfindingConsoleHandle.isDead() )
- {
- LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get();
- pPathfindingConsole->onRegionBoundaryCross();
- }
-}
-
-// static
+ // commit any outstanding text entry
+ if (hasFocus())
+ {
+ LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
+ if (cur_focus && cur_focus->acceptsTextInput())
+ {
+ cur_focus->onCommit();
+ }
+ }
+
+ if (canClose())
+ {
+ saveSettings();
+ apply();
+
+ if (userdata.asString() == "closeadvanced")
+ {
+ LLFloaterReg::hideInstance("prefs_graphics_advanced");
+ }
+ else
+ {
+ closeFloater(false);
+ }
+
+ //Conversation transcript and log path changed so reload conversations based on new location
+ if(mPriorInstantMessageLogPath.length())
+ {
+ if(moveTranscriptsAndLog())
+ {
+ //When floaters are empty but have a chat history files, reload chat history into them
+ LLFloaterIMSessionTab::reloadEmptyFloaters();
+ }
+ //Couldn't move files so restore the old path and show a notification
+ else
+ {
+ gSavedPerAccountSettings.setString("InstantMessageLogPath", mPriorInstantMessageLogPath);
+ LLNotificationsUtil::add("PreferenceChatPathChanged");
+ }
+ mPriorInstantMessageLogPath.clear();
+ }
+
+ LLUIColorTable::instance().saveUserSettings();
+ gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
+
+ //Only save once logged in and loaded per account settings
+ if(mGotPersonalInfo)
+ {
+ gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
+ }
+ }
+ else
+ {
+ // Show beep, pop up dialog, etc.
+ LL_INFOS("Preferences") << "Can't close preferences!" << LL_ENDL;
+ }
+
+ LLPanelLogin::updateLocationSelectorsVisibility();
+ //Need to reload the navmesh if the pathing console is up
+ LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle();
+ if ( !pathfindingConsoleHandle.isDead() )
+ {
+ LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get();
+ pPathfindingConsole->onRegionBoundaryCross();
+ }
+}
+
+// static
void LLFloaterPreference::onBtnCancel(const LLSD& userdata)
{
- if (hasFocus())
- {
- LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- if (cur_focus && cur_focus->acceptsTextInput())
- {
- cur_focus->onCommit();
- }
- refresh();
- }
- cancel();
-
- if (userdata.asString() == "closeadvanced")
- {
- LLFloaterReg::hideInstance("prefs_graphics_advanced");
- }
- else
- {
- closeFloater();
- }
-}
-
-// static
+ if (hasFocus())
+ {
+ LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
+ if (cur_focus && cur_focus->acceptsTextInput())
+ {
+ cur_focus->onCommit();
+ }
+ refresh();
+ }
+ cancel();
+
+ if (userdata.asString() == "closeadvanced")
+ {
+ LLFloaterReg::hideInstance("prefs_graphics_advanced");
+ }
+ else
+ {
+ closeFloater();
+ }
+}
+
+// static
void LLFloaterPreference::updateUserInfo(const std::string& visibility)
{
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance)
+ {
instance->setPersonalInfo(visibility);
- }
+ }
}
void LLFloaterPreference::refreshEnabledGraphics()
{
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
- instance->refresh();
- }
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance)
+ {
+ instance->refresh();
+ }
- LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
- if (advanced)
- {
- advanced->refresh();
- }
+ LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
+ if (advanced)
+ {
+ advanced->refresh();
+ }
}
void LLFloaterPreference::onClickClearCache()
{
- LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache);
+ LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache);
}
void LLFloaterPreference::onClickBrowserClearCache()
{
- LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache);
+ LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache);
}
// Called when user changes language via the combobox.
void LLFloaterPreference::onLanguageChange()
{
- // Let the user know that the change will only take effect after restart.
- // Do it only once so that we're not too irritating.
- if (!mLanguageChanged)
- {
- LLNotificationsUtil::add("ChangeLanguage");
- mLanguageChanged = true;
- }
+ // Let the user know that the change will only take effect after restart.
+ // Do it only once so that we're not too irritating.
+ if (!mLanguageChanged)
+ {
+ LLNotificationsUtil::add("ChangeLanguage");
+ mLanguageChanged = true;
+ }
}
void LLFloaterPreference::onNotificationsChange(const std::string& OptionName)
{
- mNotificationOptions[OptionName] = getChild<LLComboBox>(OptionName)->getSelectedItemLabel();
+ mNotificationOptions[OptionName] = getChild<LLComboBox>(OptionName)->getSelectedItemLabel();
- bool show_notifications_alert = true;
- for (notifications_map::iterator it_notification = mNotificationOptions.begin(); it_notification != mNotificationOptions.end(); it_notification++)
- {
- if(it_notification->second != "No action")
- {
- show_notifications_alert = false;
- break;
- }
- }
+ bool show_notifications_alert = true;
+ for (notifications_map::iterator it_notification = mNotificationOptions.begin(); it_notification != mNotificationOptions.end(); it_notification++)
+ {
+ if(it_notification->second != "No action")
+ {
+ show_notifications_alert = false;
+ break;
+ }
+ }
- getChild<LLTextBox>("notifications_alert")->setVisible(show_notifications_alert);
+ getChild<LLTextBox>("notifications_alert")->setVisible(show_notifications_alert);
}
void LLFloaterPreference::onNameTagOpacityChange(const LLSD& newvalue)
{
- LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>("background");
- if (color_swatch)
- {
- LLColor4 new_color = color_swatch->get();
- color_swatch->set( new_color.setAlpha(newvalue.asReal()) );
- }
+ LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>("background");
+ if (color_swatch)
+ {
+ LLColor4 new_color = color_swatch->get();
+ color_swatch->set( new_color.setAlpha(newvalue.asReal()) );
+ }
}
void LLFloaterPreference::onClickSetCache()
{
- std::string cur_name(gSavedSettings.getString("CacheLocation"));
-// std::string cur_top_folder(gDirUtilp->getBaseFileName(cur_name));
-
- std::string proposed_name(cur_name);
+ std::string cur_name(gSavedSettings.getString("CacheLocation"));
+// std::string cur_top_folder(gDirUtilp->getBaseFileName(cur_name));
+
+ std::string proposed_name(cur_name);
- (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeCachePath, this, _1, _2), proposed_name))->getFile();
+ (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeCachePath, this, _1, _2), proposed_name))->getFile();
}
void LLFloaterPreference::changeCachePath(const std::vector<std::string>& filenames, std::string proposed_name)
{
- std::string dir_name = filenames[0];
- if (!dir_name.empty() && dir_name != proposed_name)
- {
- std::string new_top_folder(gDirUtilp->getBaseFileName(dir_name));
- LLNotificationsUtil::add("CacheWillBeMoved");
- gSavedSettings.setString("NewCacheLocation", dir_name);
- gSavedSettings.setString("NewCacheLocationTopFolder", new_top_folder);
- }
- else
- {
- std::string cache_location = gDirUtilp->getCacheDir();
- gSavedSettings.setString("CacheLocation", cache_location);
- std::string top_folder(gDirUtilp->getBaseFileName(cache_location));
- gSavedSettings.setString("CacheLocationTopFolder", top_folder);
- }
+ std::string dir_name = filenames[0];
+ if (!dir_name.empty() && dir_name != proposed_name)
+ {
+ std::string new_top_folder(gDirUtilp->getBaseFileName(dir_name));
+ LLNotificationsUtil::add("CacheWillBeMoved");
+ gSavedSettings.setString("NewCacheLocation", dir_name);
+ gSavedSettings.setString("NewCacheLocationTopFolder", new_top_folder);
+ }
+ else
+ {
+ std::string cache_location = gDirUtilp->getCacheDir();
+ gSavedSettings.setString("CacheLocation", cache_location);
+ std::string top_folder(gDirUtilp->getBaseFileName(cache_location));
+ gSavedSettings.setString("CacheLocationTopFolder", top_folder);
+ }
}
void LLFloaterPreference::onClickResetCache()
{
- if (gDirUtilp->getCacheDir(false) == gDirUtilp->getCacheDir(true))
- {
- // The cache location was already the default.
- return;
- }
- gSavedSettings.setString("NewCacheLocation", "");
- gSavedSettings.setString("NewCacheLocationTopFolder", "");
- LLNotificationsUtil::add("CacheWillBeMoved");
- std::string cache_location = gDirUtilp->getCacheDir(false);
- gSavedSettings.setString("CacheLocation", cache_location);
- std::string top_folder(gDirUtilp->getBaseFileName(cache_location));
- gSavedSettings.setString("CacheLocationTopFolder", top_folder);
+ if (gDirUtilp->getCacheDir(false) == gDirUtilp->getCacheDir(true))
+ {
+ // The cache location was already the default.
+ return;
+ }
+ gSavedSettings.setString("NewCacheLocation", "");
+ gSavedSettings.setString("NewCacheLocationTopFolder", "");
+ LLNotificationsUtil::add("CacheWillBeMoved");
+ std::string cache_location = gDirUtilp->getCacheDir(false);
+ gSavedSettings.setString("CacheLocation", cache_location);
+ std::string top_folder(gDirUtilp->getBaseFileName(cache_location));
+ gSavedSettings.setString("CacheLocationTopFolder", top_folder);
}
void LLFloaterPreference::onClickSkin(LLUICtrl* ctrl, const LLSD& userdata)
{
- gSavedSettings.setString("SkinCurrent", userdata.asString());
- ctrl->setValue(userdata.asString());
+ gSavedSettings.setString("SkinCurrent", userdata.asString());
+ ctrl->setValue(userdata.asString());
}
void LLFloaterPreference::onSelectSkin()
{
- std::string skin_selection = getChild<LLRadioGroup>("skin_selection")->getValue().asString();
- gSavedSettings.setString("SkinCurrent", skin_selection);
+ std::string skin_selection = getChild<LLRadioGroup>("skin_selection")->getValue().asString();
+ gSavedSettings.setString("SkinCurrent", skin_selection);
}
void LLFloaterPreference::refreshSkin(void* data)
{
- LLPanel*self = (LLPanel*)data;
- sSkin = gSavedSettings.getString("SkinCurrent");
- self->getChild<LLRadioGroup>("skin_selection", true)->setValue(sSkin);
+ LLPanel*self = (LLPanel*)data;
+ sSkin = gSavedSettings.getString("SkinCurrent");
+ self->getChild<LLRadioGroup>("skin_selection", true)->setValue(sSkin);
}
void LLFloaterPreference::buildPopupLists()
{
- LLScrollListCtrl& disabled_popups =
- getChildRef<LLScrollListCtrl>("disabled_popups");
- LLScrollListCtrl& enabled_popups =
- getChildRef<LLScrollListCtrl>("enabled_popups");
-
- disabled_popups.deleteAllItems();
- enabled_popups.deleteAllItems();
-
- for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
- iter != LLNotifications::instance().templatesEnd();
- ++iter)
- {
- LLNotificationTemplatePtr templatep = iter->second;
- LLNotificationFormPtr formp = templatep->mForm;
-
- LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType();
- if (ignore <= LLNotificationForm::IGNORE_NO)
- continue;
-
- LLSD row;
- row["columns"][0]["value"] = formp->getIgnoreMessage();
- row["columns"][0]["font"] = "SANSSERIF_SMALL";
- row["columns"][0]["width"] = 400;
-
- LLScrollListItem* item = NULL;
-
- bool show_popup = !formp->getIgnored();
- if (!show_popup)
- {
- if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
- {
- LLSD last_response = LLUI::getInstance()->mSettingGroups["config"]->getLLSD("Default" + templatep->mName);
- if (!last_response.isUndefined())
- {
- for (LLSD::map_const_iterator it = last_response.beginMap();
- it != last_response.endMap();
- ++it)
- {
- if (it->second.asBoolean())
- {
- row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString();
- row["columns"][1]["font"] = "SANSSERIF_SMALL";
- row["columns"][1]["width"] = 360;
- break;
- }
- }
- }
- }
- item = disabled_popups.addElement(row);
- }
- else
- {
- item = enabled_popups.addElement(row);
- }
-
- if (item)
- {
- item->setUserdata((void*)&iter->first);
- }
- }
+ LLScrollListCtrl& disabled_popups =
+ getChildRef<LLScrollListCtrl>("disabled_popups");
+ LLScrollListCtrl& enabled_popups =
+ getChildRef<LLScrollListCtrl>("enabled_popups");
+
+ disabled_popups.deleteAllItems();
+ enabled_popups.deleteAllItems();
+
+ for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
+ iter != LLNotifications::instance().templatesEnd();
+ ++iter)
+ {
+ LLNotificationTemplatePtr templatep = iter->second;
+ LLNotificationFormPtr formp = templatep->mForm;
+
+ LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType();
+ if (ignore <= LLNotificationForm::IGNORE_NO)
+ continue;
+
+ LLSD row;
+ row["columns"][0]["value"] = formp->getIgnoreMessage();
+ row["columns"][0]["font"] = "SANSSERIF_SMALL";
+ row["columns"][0]["width"] = 400;
+
+ LLScrollListItem* item = NULL;
+
+ bool show_popup = !formp->getIgnored();
+ if (!show_popup)
+ {
+ if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
+ {
+ LLSD last_response = LLUI::getInstance()->mSettingGroups["config"]->getLLSD("Default" + templatep->mName);
+ if (!last_response.isUndefined())
+ {
+ for (LLSD::map_const_iterator it = last_response.beginMap();
+ it != last_response.endMap();
+ ++it)
+ {
+ if (it->second.asBoolean())
+ {
+ row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString();
+ row["columns"][1]["font"] = "SANSSERIF_SMALL";
+ row["columns"][1]["width"] = 360;
+ break;
+ }
+ }
+ }
+ }
+ item = disabled_popups.addElement(row);
+ }
+ else
+ {
+ item = enabled_popups.addElement(row);
+ }
+
+ if (item)
+ {
+ item->setUserdata((void*)&iter->first);
+ }
+ }
}
void LLFloaterPreference::refreshEnabledState()
{
- LLCheckBoxCtrl* ctrl_pbr = getChild<LLCheckBoxCtrl>("UsePBRShaders");
+ LLCheckBoxCtrl* ctrl_pbr = getChild<LLCheckBoxCtrl>("UsePBRShaders");
//PBR
ctrl_pbr->setEnabled(TRUE);
- // Cannot have floater active until caps have been received
- getChild<LLButton>("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true);
+ // Cannot have floater active until caps have been received
+ getChild<LLButton>("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true);
- getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess());
+ getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess());
}
void LLAvatarComplexityControls::setIndirectControls()
{
- /*
- * We have controls that have an indirect relationship between the control
- * values and adjacent text and the underlying setting they influence.
- * In each case, the control and its associated setting are named Indirect<something>
- * This method interrogates the controlled setting and establishes the
- * appropriate value for the indirect control. It must be called whenever the
- * underlying setting may have changed other than through the indirect control,
- * such as when the 'Reset all to recommended settings' button is used...
- */
- setIndirectMaxNonImpostors();
- setIndirectMaxArc();
+ /*
+ * We have controls that have an indirect relationship between the control
+ * values and adjacent text and the underlying setting they influence.
+ * In each case, the control and its associated setting are named Indirect<something>
+ * This method interrogates the controlled setting and establishes the
+ * appropriate value for the indirect control. It must be called whenever the
+ * underlying setting may have changed other than through the indirect control,
+ * such as when the 'Reset all to recommended settings' button is used...
+ */
+ setIndirectMaxNonImpostors();
+ setIndirectMaxArc();
}
// static
void LLAvatarComplexityControls::setIndirectMaxNonImpostors()
{
- U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors");
- // for this one, we just need to make zero, which means off, the max value of the slider
- U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER : max_non_impostors;
- gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors);
+ U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors");
+ // for this one, we just need to make zero, which means off, the max value of the slider
+ U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER : max_non_impostors;
+ gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors);
}
void LLAvatarComplexityControls::setIndirectMaxArc()
{
- U32 max_arc = gSavedSettings.getU32("RenderAvatarMaxComplexity");
- U32 indirect_max_arc;
- if (0 == max_arc)
- {
- // the off position is all the way to the right, so set to control max
- indirect_max_arc = INDIRECT_MAX_ARC_OFF;
- }
- else
- {
- // This is the inverse of the calculation in updateMaxComplexity
- indirect_max_arc = (U32)ll_round(((log(F32(max_arc)) - MIN_ARC_LOG) / ARC_LIMIT_MAP_SCALE)) + MIN_INDIRECT_ARC_LIMIT;
- }
- gSavedSettings.setU32("IndirectMaxComplexity", indirect_max_arc);
+ U32 max_arc = gSavedSettings.getU32("RenderAvatarMaxComplexity");
+ U32 indirect_max_arc;
+ if (0 == max_arc)
+ {
+ // the off position is all the way to the right, so set to control max
+ indirect_max_arc = INDIRECT_MAX_ARC_OFF;
+ }
+ else
+ {
+ // This is the inverse of the calculation in updateMaxComplexity
+ indirect_max_arc = (U32)ll_round(((log(F32(max_arc)) - MIN_ARC_LOG) / ARC_LIMIT_MAP_SCALE)) + MIN_INDIRECT_ARC_LIMIT;
+ }
+ gSavedSettings.setU32("IndirectMaxComplexity", indirect_max_arc);
}
void LLFloaterPreference::refresh()
{
- LLPanel::refresh();
+ LLPanel::refresh();
LLAvatarComplexityControls::setText(
gSavedSettings.getU32("RenderAvatarMaxComplexity"),
getChild<LLTextBox>("IndirectMaxComplexityText", true));
- refreshEnabledState();
- LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
- if (advanced)
- {
- advanced->refresh();
- }
+ refreshEnabledState();
+ LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
+ if (advanced)
+ {
+ advanced->refresh();
+ }
updateClickActionViews();
}
void LLFloaterPreference::onCommitWindowedMode()
{
- refresh();
+ refresh();
}
void LLFloaterPreference::onChangeQuality(const LLSD& data)
{
- U32 level = (U32)(data.asReal());
- LLFeatureManager::getInstance()->setGraphicsLevel(level, true);
- refreshEnabledGraphics();
- refresh();
+ U32 level = (U32)(data.asReal());
+ LLFeatureManager::getInstance()->setGraphicsLevel(level, true);
+ refreshEnabledGraphics();
+ refresh();
}
void LLFloaterPreference::onClickSetSounds()
{
- // Disable Enable gesture sounds checkbox if the master sound is disabled
- // or if sound effects are disabled.
- getChild<LLCheckBoxCtrl>("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds"));
+ // Disable Enable gesture sounds checkbox if the master sound is disabled
+ // or if sound effects are disabled.
+ getChild<LLCheckBoxCtrl>("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds"));
}
void LLFloaterPreference::onClickEnablePopup()
-{
- LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups");
-
- std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected();
- std::vector<LLScrollListItem*>::iterator itor;
- for (itor = items.begin(); itor != items.end(); ++itor)
- {
- LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
- //gSavedSettings.setWarning(templatep->mName, TRUE);
- std::string notification_name = templatep->mName;
- LLUI::getInstance()->mSettingGroups["ignores"]->setBOOL(notification_name, TRUE);
- }
-
- buildPopupLists();
+{
+ LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups");
+
+ std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected();
+ std::vector<LLScrollListItem*>::iterator itor;
+ for (itor = items.begin(); itor != items.end(); ++itor)
+ {
+ LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
+ //gSavedSettings.setWarning(templatep->mName, TRUE);
+ std::string notification_name = templatep->mName;
+ LLUI::getInstance()->mSettingGroups["ignores"]->setBOOL(notification_name, TRUE);
+ }
+
+ buildPopupLists();
if (!mFilterEdit->getText().empty())
{
filterIgnorableNotifications();
@@ -1337,18 +1337,18 @@ void LLFloaterPreference::onClickEnablePopup()
}
void LLFloaterPreference::onClickDisablePopup()
-{
- LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups");
-
- std::vector<LLScrollListItem*> items = enabled_popups.getAllSelected();
- std::vector<LLScrollListItem*>::iterator itor;
- for (itor = items.begin(); itor != items.end(); ++itor)
- {
- LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
- templatep->mForm->setIgnored(true);
- }
-
- buildPopupLists();
+{
+ LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups");
+
+ std::vector<LLScrollListItem*> items = enabled_popups.getAllSelected();
+ std::vector<LLScrollListItem*>::iterator itor;
+ for (itor = items.begin(); itor != items.end(); ++itor)
+ {
+ LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
+ templatep->mForm->setIgnored(true);
+ }
+
+ buildPopupLists();
if (!mFilterEdit->getText().empty())
{
filterIgnorableNotifications();
@@ -1357,191 +1357,191 @@ void LLFloaterPreference::onClickDisablePopup()
void LLFloaterPreference::resetAllIgnored()
{
- for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
- iter != LLNotifications::instance().templatesEnd();
- ++iter)
- {
- if (iter->second->mForm->getIgnoreType() > LLNotificationForm::IGNORE_NO)
- {
- iter->second->mForm->setIgnored(false);
- }
- }
+ for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
+ iter != LLNotifications::instance().templatesEnd();
+ ++iter)
+ {
+ if (iter->second->mForm->getIgnoreType() > LLNotificationForm::IGNORE_NO)
+ {
+ iter->second->mForm->setIgnored(false);
+ }
+ }
}
void LLFloaterPreference::setAllIgnored()
{
- for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
- iter != LLNotifications::instance().templatesEnd();
- ++iter)
- {
- if (iter->second->mForm->getIgnoreType() > LLNotificationForm::IGNORE_NO)
- {
- iter->second->mForm->setIgnored(true);
- }
- }
+ for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
+ iter != LLNotifications::instance().templatesEnd();
+ ++iter)
+ {
+ if (iter->second->mForm->getIgnoreType() > LLNotificationForm::IGNORE_NO)
+ {
+ iter->second->mForm->setIgnored(true);
+ }
+ }
}
void LLFloaterPreference::onClickLogPath()
{
- std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
- mPriorInstantMessageLogPath.clear();
-
+ std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
+ mPriorInstantMessageLogPath.clear();
- (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeLogPath, this, _1, _2), proposed_name))->getFile();
+
+ (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeLogPath, this, _1, _2), proposed_name))->getFile();
}
void LLFloaterPreference::changeLogPath(const std::vector<std::string>& filenames, std::string proposed_name)
{
- //Path changed
- if (proposed_name != filenames[0])
- {
- gSavedPerAccountSettings.setString("InstantMessageLogPath", filenames[0]);
- mPriorInstantMessageLogPath = proposed_name;
+ //Path changed
+ if (proposed_name != filenames[0])
+ {
+ gSavedPerAccountSettings.setString("InstantMessageLogPath", filenames[0]);
+ mPriorInstantMessageLogPath = proposed_name;
- // enable/disable 'Delete transcripts button
- updateDeleteTranscriptsButton();
- }
+ // enable/disable 'Delete transcripts button
+ updateDeleteTranscriptsButton();
+ }
}
bool LLFloaterPreference::moveTranscriptsAndLog()
{
- std::string instantMessageLogPath(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
- std::string chatLogPath = gDirUtilp->add(instantMessageLogPath, gDirUtilp->getUserName());
-
- bool madeDirectory = false;
-
- //Does the directory really exist, if not then make it
- if(!LLFile::isdir(chatLogPath))
- {
- //mkdir success is defined as zero
- if(LLFile::mkdir(chatLogPath) != 0)
- {
- return false;
- }
- madeDirectory = true;
- }
-
- std::string originalConversationLogDir = LLConversationLog::instance().getFileName();
- std::string targetConversationLogDir = gDirUtilp->add(chatLogPath, "conversation.log");
- //Try to move the conversation log
- if(!LLConversationLog::instance().moveLog(originalConversationLogDir, targetConversationLogDir))
- {
- //Couldn't move the log and created a new directory so remove the new directory
- if(madeDirectory)
- {
- LLFile::rmdir(chatLogPath);
- }
- return false;
- }
-
- //Attempt to move transcripts
- std::vector<std::string> listOfTranscripts;
- std::vector<std::string> listOfFilesMoved;
-
- LLLogChat::getListOfTranscriptFiles(listOfTranscripts);
-
- if(!LLLogChat::moveTranscripts(gDirUtilp->getChatLogsDir(),
- instantMessageLogPath,
- listOfTranscripts,
- listOfFilesMoved))
- {
- //Couldn't move all the transcripts so restore those that moved back to their old location
- LLLogChat::moveTranscripts(instantMessageLogPath,
- gDirUtilp->getChatLogsDir(),
- listOfFilesMoved);
-
- //Move the conversation log back
- LLConversationLog::instance().moveLog(targetConversationLogDir, originalConversationLogDir);
-
- if(madeDirectory)
- {
- LLFile::rmdir(chatLogPath);
- }
-
- return false;
- }
-
- gDirUtilp->setChatLogsDir(instantMessageLogPath);
- gDirUtilp->updatePerAccountChatLogsDir();
-
- return true;
+ std::string instantMessageLogPath(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
+ std::string chatLogPath = gDirUtilp->add(instantMessageLogPath, gDirUtilp->getUserName());
+
+ bool madeDirectory = false;
+
+ //Does the directory really exist, if not then make it
+ if(!LLFile::isdir(chatLogPath))
+ {
+ //mkdir success is defined as zero
+ if(LLFile::mkdir(chatLogPath) != 0)
+ {
+ return false;
+ }
+ madeDirectory = true;
+ }
+
+ std::string originalConversationLogDir = LLConversationLog::instance().getFileName();
+ std::string targetConversationLogDir = gDirUtilp->add(chatLogPath, "conversation.log");
+ //Try to move the conversation log
+ if(!LLConversationLog::instance().moveLog(originalConversationLogDir, targetConversationLogDir))
+ {
+ //Couldn't move the log and created a new directory so remove the new directory
+ if(madeDirectory)
+ {
+ LLFile::rmdir(chatLogPath);
+ }
+ return false;
+ }
+
+ //Attempt to move transcripts
+ std::vector<std::string> listOfTranscripts;
+ std::vector<std::string> listOfFilesMoved;
+
+ LLLogChat::getListOfTranscriptFiles(listOfTranscripts);
+
+ if(!LLLogChat::moveTranscripts(gDirUtilp->getChatLogsDir(),
+ instantMessageLogPath,
+ listOfTranscripts,
+ listOfFilesMoved))
+ {
+ //Couldn't move all the transcripts so restore those that moved back to their old location
+ LLLogChat::moveTranscripts(instantMessageLogPath,
+ gDirUtilp->getChatLogsDir(),
+ listOfFilesMoved);
+
+ //Move the conversation log back
+ LLConversationLog::instance().moveLog(targetConversationLogDir, originalConversationLogDir);
+
+ if(madeDirectory)
+ {
+ LLFile::rmdir(chatLogPath);
+ }
+
+ return false;
+ }
+
+ gDirUtilp->setChatLogsDir(instantMessageLogPath);
+ gDirUtilp->updatePerAccountChatLogsDir();
+
+ return true;
}
void LLFloaterPreference::setPersonalInfo(const std::string& visibility)
{
- mGotPersonalInfo = true;
- mDirectoryVisibility = visibility;
-
- if (visibility == VISIBILITY_DEFAULT)
- {
- mOriginalHideOnlineStatus = false;
- getChildView("online_visibility")->setEnabled(TRUE);
- }
- else if (visibility == VISIBILITY_HIDDEN)
- {
- mOriginalHideOnlineStatus = true;
- getChildView("online_visibility")->setEnabled(TRUE);
- }
- else
- {
- mOriginalHideOnlineStatus = true;
- }
-
- getChild<LLUICtrl>("online_searchresults")->setEnabled(TRUE);
- getChildView("friends_online_notify_checkbox")->setEnabled(TRUE);
- getChild<LLUICtrl>("online_visibility")->setValue(mOriginalHideOnlineStatus);
- getChild<LLUICtrl>("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility);
-
- getChildView("favorites_on_login_check")->setEnabled(TRUE);
- getChildView("log_path_button")->setEnabled(TRUE);
- getChildView("chat_font_size")->setEnabled(TRUE);
- getChildView("conversation_log_combo")->setEnabled(TRUE);
- getChild<LLUICtrl>("voice_call_friends_only_check")->setEnabled(TRUE);
- getChild<LLUICtrl>("voice_call_friends_only_check")->setValue(gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly"));
+ mGotPersonalInfo = true;
+ mDirectoryVisibility = visibility;
+
+ if (visibility == VISIBILITY_DEFAULT)
+ {
+ mOriginalHideOnlineStatus = false;
+ getChildView("online_visibility")->setEnabled(TRUE);
+ }
+ else if (visibility == VISIBILITY_HIDDEN)
+ {
+ mOriginalHideOnlineStatus = true;
+ getChildView("online_visibility")->setEnabled(TRUE);
+ }
+ else
+ {
+ mOriginalHideOnlineStatus = true;
+ }
+
+ getChild<LLUICtrl>("online_searchresults")->setEnabled(TRUE);
+ getChildView("friends_online_notify_checkbox")->setEnabled(TRUE);
+ getChild<LLUICtrl>("online_visibility")->setValue(mOriginalHideOnlineStatus);
+ getChild<LLUICtrl>("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility);
+
+ getChildView("favorites_on_login_check")->setEnabled(TRUE);
+ getChildView("log_path_button")->setEnabled(TRUE);
+ getChildView("chat_font_size")->setEnabled(TRUE);
+ getChildView("conversation_log_combo")->setEnabled(TRUE);
+ getChild<LLUICtrl>("voice_call_friends_only_check")->setEnabled(TRUE);
+ getChild<LLUICtrl>("voice_call_friends_only_check")->setValue(gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly"));
}
void LLFloaterPreference::refreshUI()
{
- refresh();
+ refresh();
}
void LLAvatarComplexityControls::updateMax(LLSliderCtrl* slider, LLTextBox* value_label, bool short_val)
{
- // Called when the IndirectMaxComplexity control changes
- // Responsible for fixing the slider label (IndirectMaxComplexityText) and setting RenderAvatarMaxComplexity
- U32 indirect_value = slider->getValue().asInteger();
- U32 max_arc;
-
- if (INDIRECT_MAX_ARC_OFF == indirect_value)
- {
- // The 'off' position is when the slider is all the way to the right,
- // which is a value of INDIRECT_MAX_ARC_OFF,
- // so it is necessary to set max_arc to 0 disable muted avatars.
- max_arc = 0;
- }
- else
- {
- // if this is changed, the inverse calculation in setIndirectMaxArc
- // must be changed to match
- max_arc = (U32)ll_round(exp(MIN_ARC_LOG + (ARC_LIMIT_MAP_SCALE * (indirect_value - MIN_INDIRECT_ARC_LIMIT))));
- }
-
- gSavedSettings.setU32("RenderAvatarMaxComplexity", (U32)max_arc);
- setText(max_arc, value_label, short_val);
+ // Called when the IndirectMaxComplexity control changes
+ // Responsible for fixing the slider label (IndirectMaxComplexityText) and setting RenderAvatarMaxComplexity
+ U32 indirect_value = slider->getValue().asInteger();
+ U32 max_arc;
+
+ if (INDIRECT_MAX_ARC_OFF == indirect_value)
+ {
+ // The 'off' position is when the slider is all the way to the right,
+ // which is a value of INDIRECT_MAX_ARC_OFF,
+ // so it is necessary to set max_arc to 0 disable muted avatars.
+ max_arc = 0;
+ }
+ else
+ {
+ // if this is changed, the inverse calculation in setIndirectMaxArc
+ // must be changed to match
+ max_arc = (U32)ll_round(exp(MIN_ARC_LOG + (ARC_LIMIT_MAP_SCALE * (indirect_value - MIN_INDIRECT_ARC_LIMIT))));
+ }
+
+ gSavedSettings.setU32("RenderAvatarMaxComplexity", (U32)max_arc);
+ setText(max_arc, value_label, short_val);
}
void LLAvatarComplexityControls::setText(U32 value, LLTextBox* text_box, bool short_val)
{
- if (0 == value)
- {
- text_box->setText(LLTrans::getString("no_limit"));
- }
- else
- {
+ if (0 == value)
+ {
+ text_box->setText(LLTrans::getString("no_limit"));
+ }
+ else
+ {
std::string text_value = short_val ? llformat("%d", value / 1000) : llformat("%d", value);
text_box->setText(text_value);
- }
+ }
}
void LLAvatarComplexityControls::updateMaxRenderTime(LLSliderCtrl* slider, LLTextBox* value_label, bool short_val)
@@ -1563,7 +1563,7 @@ void LLAvatarComplexityControls::setRenderTimeText(F32 value, LLTextBox* text_bo
void LLFloaterPreference::updateMaxComplexity()
{
- // Called when the IndirectMaxComplexity control changes
+ // Called when the IndirectMaxComplexity control changes
LLAvatarComplexityControls::updateMax(
getChild<LLSliderCtrl>("IndirectMaxComplexity"),
getChild<LLTextBox>("IndirectMaxComplexityText"));
@@ -1616,16 +1616,16 @@ bool LLFloaterPreference::loadFromFilename(const std::string& filename, std::map
void LLFloaterPreference::onChangeMaturity()
{
- U8 sim_access = gSavedSettings.getU32("PreferredMaturity");
+ U8 sim_access = gSavedSettings.getU32("PreferredMaturity");
- getChild<LLIconCtrl>("rating_icon_general")->setVisible(sim_access == SIM_ACCESS_PG
- || sim_access == SIM_ACCESS_MATURE
- || sim_access == SIM_ACCESS_ADULT);
+ getChild<LLIconCtrl>("rating_icon_general")->setVisible(sim_access == SIM_ACCESS_PG
+ || sim_access == SIM_ACCESS_MATURE
+ || sim_access == SIM_ACCESS_ADULT);
- getChild<LLIconCtrl>("rating_icon_moderate")->setVisible(sim_access == SIM_ACCESS_MATURE
- || sim_access == SIM_ACCESS_ADULT);
+ getChild<LLIconCtrl>("rating_icon_moderate")->setVisible(sim_access == SIM_ACCESS_MATURE
+ || sim_access == SIM_ACCESS_ADULT);
- getChild<LLIconCtrl>("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT);
+ getChild<LLIconCtrl>("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT);
}
std::string get_category_path(LLFolderType::EType cat_type)
@@ -1678,23 +1678,23 @@ void LLFloaterPreference::onChangeAnimationFolder()
// but the UI for this will still be enabled
void LLFloaterPreference::onClickBlockList()
{
- LLFloaterSidePanelContainer::showPanel("people", "panel_people",
- LLSD().with("people_panel_tab_name", "blocked_panel"));
+ LLFloaterSidePanelContainer::showPanel("people", "panel_people",
+ LLSD().with("people_panel_tab_name", "blocked_panel"));
}
void LLFloaterPreference::onClickProxySettings()
{
- LLFloaterReg::showInstance("prefs_proxy");
+ LLFloaterReg::showInstance("prefs_proxy");
}
void LLFloaterPreference::onClickTranslationSettings()
{
- LLFloaterReg::showInstance("prefs_translation");
+ LLFloaterReg::showInstance("prefs_translation");
}
void LLFloaterPreference::onClickAutoReplace()
{
- LLFloaterReg::showInstance("prefs_autoreplace");
+ LLFloaterReg::showInstance("prefs_autoreplace");
}
void LLFloaterPreference::onClickSpellChecker()
@@ -1718,19 +1718,19 @@ void LLFloaterPreference::onClickAutoAdjustments()
void LLFloaterPreference::onClickAdvanced()
{
- LLFloaterReg::showInstance("prefs_graphics_advanced");
+ LLFloaterReg::showInstance("prefs_graphics_advanced");
- LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
- for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
- iter != tabcontainer->getChildList()->end(); ++iter)
- {
- LLView* view = *iter;
- LLPanelPreferenceGraphics* panel = dynamic_cast<LLPanelPreferenceGraphics*>(view);
- if (panel)
- {
- panel->resetDirtyChilds();
- }
- }
+ LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
+ for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
+ iter != tabcontainer->getChildList()->end(); ++iter)
+ {
+ LLView* view = *iter;
+ LLPanelPreferenceGraphics* panel = dynamic_cast<LLPanelPreferenceGraphics*>(view);
+ if (panel)
+ {
+ panel->resetDirtyChilds();
+ }
+ }
}
void LLFloaterPreference::onClickActionChange()
@@ -1756,7 +1756,7 @@ void LLFloaterPreference::onAtmosShaderChange()
void LLFloaterPreference::onClickPermsDefault()
{
- LLFloaterReg::showInstance("perms_default");
+ LLFloaterReg::showInstance("perms_default");
}
void LLFloaterPreference::onClickRememberedUsernames()
@@ -1766,29 +1766,29 @@ void LLFloaterPreference::onClickRememberedUsernames()
void LLFloaterPreference::onDeleteTranscripts()
{
- LLSD args;
- args["FOLDER"] = gDirUtilp->getUserName();
+ LLSD args;
+ args["FOLDER"] = gDirUtilp->getUserName();
- LLNotificationsUtil::add("PreferenceChatDeleteTranscripts", args, LLSD(), boost::bind(&LLFloaterPreference::onDeleteTranscriptsResponse, this, _1, _2));
+ LLNotificationsUtil::add("PreferenceChatDeleteTranscripts", args, LLSD(), boost::bind(&LLFloaterPreference::onDeleteTranscriptsResponse, this, _1, _2));
}
void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response)
{
- if (0 == LLNotificationsUtil::getSelectedOption(notification, response))
- {
- LLLogChat::deleteTranscripts();
- updateDeleteTranscriptsButton();
- }
+ if (0 == LLNotificationsUtil::getSelectedOption(notification, response))
+ {
+ LLLogChat::deleteTranscripts();
+ updateDeleteTranscriptsButton();
+ }
}
void LLFloaterPreference::onLogChatHistorySaved()
{
- LLButton * delete_transcripts_buttonp = getChild<LLButton>("delete_transcripts");
+ LLButton * delete_transcripts_buttonp = getChild<LLButton>("delete_transcripts");
- if (!delete_transcripts_buttonp->getEnabled())
- {
- delete_transcripts_buttonp->setEnabled(true);
- }
+ if (!delete_transcripts_buttonp->getEnabled())
+ {
+ delete_transcripts_buttonp->setEnabled(true);
+ }
}
void LLFloaterPreference::updateClickActionControls()
@@ -1816,13 +1816,13 @@ void LLFloaterPreference::updateClickActionControls()
KEY_NONE,
MASK_NONE,
single_clk_action == 1);
-
+
panel->setKeyBind("walk_to",
EMouseClickType::CLICK_DOUBLELEFT,
KEY_NONE,
MASK_NONE,
double_clk_action == 1);
-
+
panel->setKeyBind("teleport_to",
EMouseClickType::CLICK_DOUBLELEFT,
KEY_NONE,
@@ -1867,8 +1867,8 @@ void LLFloaterPreference::updateClickActionViews()
}
}
- getChild<LLComboBox>("single_click_action_combo")->setValue((int)click_to_walk);
- getChild<LLComboBox>("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk);
+ getChild<LLComboBox>("single_click_action_combo")->setValue((int)click_to_walk);
+ getChild<LLComboBox>("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk);
}
void LLFloaterPreference::updateSearchableItems()
@@ -1878,62 +1878,62 @@ void LLFloaterPreference::updateSearchableItems()
void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param)
{
- LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue()));
+ LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue()));
}
void LLFloaterPreference::getUIColor(LLUICtrl* ctrl, const LLSD& param)
{
- LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*) ctrl;
- color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString()));
+ LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*) ctrl;
+ color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString()));
}
void LLFloaterPreference::setCacheLocation(const LLStringExplicit& location)
{
- LLUICtrl* cache_location_editor = getChild<LLUICtrl>("cache_location");
- cache_location_editor->setValue(location);
- cache_location_editor->setToolTip(location);
+ LLUICtrl* cache_location_editor = getChild<LLUICtrl>("cache_location");
+ cache_location_editor->setValue(location);
+ cache_location_editor->setToolTip(location);
}
void LLFloaterPreference::selectPanel(const LLSD& name)
{
- LLTabContainer * tab_containerp = getChild<LLTabContainer>("pref core");
- LLPanel * panel = tab_containerp->getPanelByName(name);
- if (NULL != panel)
- {
- tab_containerp->selectTabPanel(panel);
- }
+ LLTabContainer * tab_containerp = getChild<LLTabContainer>("pref core");
+ LLPanel * panel = tab_containerp->getPanelByName(name);
+ if (NULL != panel)
+ {
+ tab_containerp->selectTabPanel(panel);
+ }
}
void LLFloaterPreference::selectPrivacyPanel()
{
- selectPanel("im");
+ selectPanel("im");
}
void LLFloaterPreference::selectChatPanel()
{
- selectPanel("chat");
+ selectPanel("chat");
}
void LLFloaterPreference::changed()
{
- getChild<LLButton>("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0);
+ getChild<LLButton>("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0);
- // set 'enable' property for 'Delete transcripts...' button
- updateDeleteTranscriptsButton();
+ // set 'enable' property for 'Delete transcripts...' button
+ updateDeleteTranscriptsButton();
}
void LLFloaterPreference::saveGraphicsPreset(std::string& preset)
{
- mSavedGraphicsPreset = preset;
+ mSavedGraphicsPreset = preset;
}
//------------------------------Updater---------------------------------------
static bool handleBandwidthChanged(const LLSD& newvalue)
{
- gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal());
- return true;
+ gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal());
+ return true;
}
class LLPanelPreference::Updater : public LLEventTimer
@@ -1941,37 +1941,37 @@ class LLPanelPreference::Updater : public LLEventTimer
public:
- typedef boost::function<bool(const LLSD&)> callback_t;
+ typedef boost::function<bool(const LLSD&)> callback_t;
- Updater(callback_t cb, F32 period)
- :LLEventTimer(period),
- mCallback(cb)
- {
- mEventTimer.stop();
- }
+ Updater(callback_t cb, F32 period)
+ :LLEventTimer(period),
+ mCallback(cb)
+ {
+ mEventTimer.stop();
+ }
- virtual ~Updater(){}
+ virtual ~Updater(){}
- void update(const LLSD& new_value)
- {
- mNewValue = new_value;
- mEventTimer.start();
- }
+ void update(const LLSD& new_value)
+ {
+ mNewValue = new_value;
+ mEventTimer.start();
+ }
protected:
- BOOL tick()
- {
- mCallback(mNewValue);
- mEventTimer.stop();
+ BOOL tick()
+ {
+ mCallback(mNewValue);
+ mEventTimer.stop();
- return FALSE;
- }
+ return FALSE;
+ }
private:
- LLSD mNewValue;
- callback_t mCallback;
+ LLSD mNewValue;
+ callback_t mCallback;
};
//----------------------------------------------------------------------------
static LLPanelInjector<LLPanelPreference> t_places("panel_preference");
@@ -1979,160 +1979,160 @@ LLPanelPreference::LLPanelPreference()
: LLPanel(),
mBandWidthUpdater(NULL)
{
- mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2));
- mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1));
- mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::deletePreset, this, _2));
- mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::savePreset, this, _2));
- mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::loadPreset, this, _2));
+ mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2));
+ mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1));
+ mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::deletePreset, this, _2));
+ mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::savePreset, this, _2));
+ mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::loadPreset, this, _2));
}
//virtual
BOOL LLPanelPreference::postBuild()
{
- ////////////////////// PanelGeneral ///////////////////
- if (hasChild("display_names_check", TRUE))
- {
- BOOL use_people_api = gSavedSettings.getBOOL("UsePeopleAPI");
- LLCheckBoxCtrl* ctrl_display_name = getChild<LLCheckBoxCtrl>("display_names_check");
- ctrl_display_name->setEnabled(use_people_api);
- if (!use_people_api)
- {
- ctrl_display_name->setValue(FALSE);
- }
- }
-
- ////////////////////// PanelVoice ///////////////////
- if (hasChild("voice_unavailable", TRUE))
- {
- BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice");
- getChildView("voice_unavailable")->setVisible( voice_disabled);
- getChildView("enable_voice_check")->setVisible( !voice_disabled);
- }
-
- //////////////////////PanelSkins ///////////////////
-
- if (hasChild("skin_selection", TRUE))
- {
- LLFloaterPreference::refreshSkin(this);
-
- // if skin is set to a skin that no longer exists (silver) set back to default
- if (getChild<LLRadioGroup>("skin_selection")->getSelectedIndex() < 0)
- {
- gSavedSettings.setString("SkinCurrent", "default");
- LLFloaterPreference::refreshSkin(this);
- }
-
- }
-
- //////////////////////PanelPrivacy ///////////////////
- if (hasChild("media_enabled", TRUE))
- {
- bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia");
-
- getChild<LLCheckBoxCtrl>("media_enabled")->set(media_enabled);
- getChild<LLCheckBoxCtrl>("autoplay_enabled")->setEnabled(media_enabled);
- }
- if (hasChild("music_enabled", TRUE))
- {
- getChild<LLCheckBoxCtrl>("music_enabled")->set(gSavedSettings.getBOOL("AudioStreamingMusic"));
- }
- if (hasChild("voice_call_friends_only_check", TRUE))
- {
- getChild<LLCheckBoxCtrl>("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2));
- }
- if (hasChild("allow_multiple_viewer_check", TRUE))
- {
- getChild<LLCheckBoxCtrl>("allow_multiple_viewer_check")->setCommitCallback(boost::bind(&showMultipleViewersWarning, _1, _2));
- }
- if (hasChild("favorites_on_login_check", TRUE))
- {
- getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setCommitCallback(boost::bind(&handleFavoritesOnLoginChanged, _1, _2));
- bool show_favorites_at_login = LLPanelLogin::getShowFavorites();
- getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setValue(show_favorites_at_login);
- }
- if (hasChild("mute_chb_label", TRUE))
- {
- getChild<LLTextBox>("mute_chb_label")->setShowCursorHand(false);
- getChild<LLTextBox>("mute_chb_label")->setSoundFlags(LLView::MOUSE_UP);
- getChild<LLTextBox>("mute_chb_label")->setClickedCallback(boost::bind(&toggleMuteWhenMinimized));
- }
-
- //////////////////////PanelSetup ///////////////////
- if (hasChild("max_bandwidth", TRUE))
- {
- mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT);
- gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2));
- }
+ ////////////////////// PanelGeneral ///////////////////
+ if (hasChild("display_names_check", TRUE))
+ {
+ BOOL use_people_api = gSavedSettings.getBOOL("UsePeopleAPI");
+ LLCheckBoxCtrl* ctrl_display_name = getChild<LLCheckBoxCtrl>("display_names_check");
+ ctrl_display_name->setEnabled(use_people_api);
+ if (!use_people_api)
+ {
+ ctrl_display_name->setValue(FALSE);
+ }
+ }
+
+ ////////////////////// PanelVoice ///////////////////
+ if (hasChild("voice_unavailable", TRUE))
+ {
+ BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice");
+ getChildView("voice_unavailable")->setVisible( voice_disabled);
+ getChildView("enable_voice_check")->setVisible( !voice_disabled);
+ }
+
+ //////////////////////PanelSkins ///////////////////
+
+ if (hasChild("skin_selection", TRUE))
+ {
+ LLFloaterPreference::refreshSkin(this);
+
+ // if skin is set to a skin that no longer exists (silver) set back to default
+ if (getChild<LLRadioGroup>("skin_selection")->getSelectedIndex() < 0)
+ {
+ gSavedSettings.setString("SkinCurrent", "default");
+ LLFloaterPreference::refreshSkin(this);
+ }
+
+ }
+
+ //////////////////////PanelPrivacy ///////////////////
+ if (hasChild("media_enabled", TRUE))
+ {
+ bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia");
+
+ getChild<LLCheckBoxCtrl>("media_enabled")->set(media_enabled);
+ getChild<LLCheckBoxCtrl>("autoplay_enabled")->setEnabled(media_enabled);
+ }
+ if (hasChild("music_enabled", TRUE))
+ {
+ getChild<LLCheckBoxCtrl>("music_enabled")->set(gSavedSettings.getBOOL("AudioStreamingMusic"));
+ }
+ if (hasChild("voice_call_friends_only_check", TRUE))
+ {
+ getChild<LLCheckBoxCtrl>("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2));
+ }
+ if (hasChild("allow_multiple_viewer_check", TRUE))
+ {
+ getChild<LLCheckBoxCtrl>("allow_multiple_viewer_check")->setCommitCallback(boost::bind(&showMultipleViewersWarning, _1, _2));
+ }
+ if (hasChild("favorites_on_login_check", TRUE))
+ {
+ getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setCommitCallback(boost::bind(&handleFavoritesOnLoginChanged, _1, _2));
+ bool show_favorites_at_login = LLPanelLogin::getShowFavorites();
+ getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setValue(show_favorites_at_login);
+ }
+ if (hasChild("mute_chb_label", TRUE))
+ {
+ getChild<LLTextBox>("mute_chb_label")->setShowCursorHand(false);
+ getChild<LLTextBox>("mute_chb_label")->setSoundFlags(LLView::MOUSE_UP);
+ getChild<LLTextBox>("mute_chb_label")->setClickedCallback(boost::bind(&toggleMuteWhenMinimized));
+ }
+
+ //////////////////////PanelSetup ///////////////////
+ if (hasChild("max_bandwidth", TRUE))
+ {
+ mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT);
+ gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2));
+ }
#ifdef EXTERNAL_TOS
- LLRadioGroup* ext_browser_settings = getChild<LLRadioGroup>("preferred_browser_behavior");
- if (ext_browser_settings)
- {
- // turn off ability to set external/internal browser
- ext_browser_settings->setSelectedByValue(LLWeb::BROWSER_EXTERNAL_ONLY, true);
- ext_browser_settings->setEnabled(false);
- }
+ LLRadioGroup* ext_browser_settings = getChild<LLRadioGroup>("preferred_browser_behavior");
+ if (ext_browser_settings)
+ {
+ // turn off ability to set external/internal browser
+ ext_browser_settings->setSelectedByValue(LLWeb::BROWSER_EXTERNAL_ONLY, true);
+ ext_browser_settings->setEnabled(false);
+ }
#endif
- apply();
- return true;
+ apply();
+ return true;
}
LLPanelPreference::~LLPanelPreference()
{
- if (mBandWidthUpdater)
- {
- delete mBandWidthUpdater;
- }
+ if (mBandWidthUpdater)
+ {
+ delete mBandWidthUpdater;
+ }
}
void LLPanelPreference::apply()
{
- // no-op
+ // no-op
}
void LLPanelPreference::saveSettings()
{
- LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
-
- // Save the value of all controls in the hierarchy
- mSavedValues.clear();
- std::list<LLView*> view_stack;
- view_stack.push_back(this);
- if (advanced)
- {
- view_stack.push_back(advanced);
- }
- while(!view_stack.empty())
- {
- // Process view on top of the stack
- LLView* curview = view_stack.front();
- view_stack.pop_front();
-
- LLColorSwatchCtrl* color_swatch = dynamic_cast<LLColorSwatchCtrl *>(curview);
- if (color_swatch)
- {
- mSavedColors[color_swatch->getName()] = color_swatch->get();
- }
- else
- {
- LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
- if (ctrl)
- {
- LLControlVariable* control = ctrl->getControlVariable();
- if (control)
- {
- mSavedValues[control] = control->getValue();
- }
- }
- }
-
- // Push children onto the end of the work stack
- for (child_list_t::const_iterator iter = curview->getChildList()->begin();
- iter != curview->getChildList()->end(); ++iter)
- {
- view_stack.push_back(*iter);
- }
- }
+ LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
+
+ // Save the value of all controls in the hierarchy
+ mSavedValues.clear();
+ std::list<LLView*> view_stack;
+ view_stack.push_back(this);
+ if (advanced)
+ {
+ view_stack.push_back(advanced);
+ }
+ while(!view_stack.empty())
+ {
+ // Process view on top of the stack
+ LLView* curview = view_stack.front();
+ view_stack.pop_front();
+
+ LLColorSwatchCtrl* color_swatch = dynamic_cast<LLColorSwatchCtrl *>(curview);
+ if (color_swatch)
+ {
+ mSavedColors[color_swatch->getName()] = color_swatch->get();
+ }
+ else
+ {
+ LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
+ if (ctrl)
+ {
+ LLControlVariable* control = ctrl->getControlVariable();
+ if (control)
+ {
+ mSavedValues[control] = control->getValue();
+ }
+ }
+ }
+
+ // Push children onto the end of the work stack
+ for (child_list_t::const_iterator iter = curview->getChildList()->begin();
+ iter != curview->getChildList()->end(); ++iter)
+ {
+ view_stack.push_back(*iter);
+ }
+ }
if (LLStartUp::getStartupState() == STATE_STARTED)
{
@@ -2154,104 +2154,104 @@ void LLPanelPreference::showMultipleViewersWarning(LLUICtrl* checkbox, const LLS
void LLPanelPreference::showFriendsOnlyWarning(LLUICtrl* checkbox, const LLSD& value)
{
- if (checkbox)
- {
- gSavedPerAccountSettings.setBOOL("VoiceCallsFriendsOnly", checkbox->getValue().asBoolean());
- if (checkbox->getValue())
- {
- LLNotificationsUtil::add("FriendsAndGroupsOnly");
- }
- }
+ if (checkbox)
+ {
+ gSavedPerAccountSettings.setBOOL("VoiceCallsFriendsOnly", checkbox->getValue().asBoolean());
+ if (checkbox->getValue())
+ {
+ LLNotificationsUtil::add("FriendsAndGroupsOnly");
+ }
+ }
}
void LLPanelPreference::handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value)
{
- if (checkbox)
- {
- LLFavoritesOrderStorage::instance().showFavoritesOnLoginChanged(checkbox->getValue().asBoolean());
- if(checkbox->getValue())
- {
- LLNotificationsUtil::add("FavoritesOnLogin");
- }
- }
+ if (checkbox)
+ {
+ LLFavoritesOrderStorage::instance().showFavoritesOnLoginChanged(checkbox->getValue().asBoolean());
+ if(checkbox->getValue())
+ {
+ LLNotificationsUtil::add("FavoritesOnLogin");
+ }
+ }
}
void LLPanelPreference::toggleMuteWhenMinimized()
{
- std::string mute("MuteWhenMinimized");
- gSavedSettings.setBOOL(mute, !gSavedSettings.getBOOL(mute));
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
- instance->getChild<LLCheckBoxCtrl>("mute_when_minimized")->setBtnFocus();
- }
+ std::string mute("MuteWhenMinimized");
+ gSavedSettings.setBOOL(mute, !gSavedSettings.getBOOL(mute));
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance)
+ {
+ instance->getChild<LLCheckBoxCtrl>("mute_when_minimized")->setBtnFocus();
+ }
}
void LLPanelPreference::cancel()
{
- for (control_values_map_t::iterator iter = mSavedValues.begin();
- iter != mSavedValues.end(); ++iter)
- {
- LLControlVariable* control = iter->first;
- LLSD ctrl_value = iter->second;
+ for (control_values_map_t::iterator iter = mSavedValues.begin();
+ iter != mSavedValues.end(); ++iter)
+ {
+ LLControlVariable* control = iter->first;
+ LLSD ctrl_value = iter->second;
- if((control->getName() == "InstantMessageLogPath") && (ctrl_value.asString() == ""))
- {
- continue;
- }
+ if((control->getName() == "InstantMessageLogPath") && (ctrl_value.asString() == ""))
+ {
+ continue;
+ }
- control->set(ctrl_value);
- }
+ control->set(ctrl_value);
+ }
- for (string_color_map_t::iterator iter = mSavedColors.begin();
- iter != mSavedColors.end(); ++iter)
- {
- LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>(iter->first);
- if (color_swatch)
- {
- color_swatch->set(iter->second);
- color_swatch->onCommit();
- }
- }
+ for (string_color_map_t::iterator iter = mSavedColors.begin();
+ iter != mSavedColors.end(); ++iter)
+ {
+ LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>(iter->first);
+ if (color_swatch)
+ {
+ color_swatch->set(iter->second);
+ color_swatch->onCommit();
+ }
+ }
}
void LLPanelPreference::setControlFalse(const LLSD& user_data)
{
- std::string control_name = user_data.asString();
- LLControlVariable* control = findControl(control_name);
-
- if (control)
- control->set(LLSD(FALSE));
+ std::string control_name = user_data.asString();
+ LLControlVariable* control = findControl(control_name);
+
+ if (control)
+ control->set(LLSD(FALSE));
}
void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl)
{
- std::string name = ctrl->getName();
+ std::string name = ctrl->getName();
- // Disable "Allow Media to auto play" only when both
- // "Streaming Music" and "Media" are unchecked. STORM-513.
- if ((name == "enable_music") || (name == "enable_media"))
- {
- bool music_enabled = getChild<LLCheckBoxCtrl>("enable_music")->get();
- bool media_enabled = getChild<LLCheckBoxCtrl>("enable_media")->get();
+ // Disable "Allow Media to auto play" only when both
+ // "Streaming Music" and "Media" are unchecked. STORM-513.
+ if ((name == "enable_music") || (name == "enable_media"))
+ {
+ bool music_enabled = getChild<LLCheckBoxCtrl>("enable_music")->get();
+ bool media_enabled = getChild<LLCheckBoxCtrl>("enable_media")->get();
- getChild<LLCheckBoxCtrl>("media_auto_play_combo")->setEnabled(music_enabled || media_enabled);
- }
+ getChild<LLCheckBoxCtrl>("media_auto_play_combo")->setEnabled(music_enabled || media_enabled);
+ }
}
void LLPanelPreference::deletePreset(const LLSD& user_data)
{
- LLFloaterReg::showInstance("delete_pref_preset", user_data.asString());
+ LLFloaterReg::showInstance("delete_pref_preset", user_data.asString());
}
void LLPanelPreference::savePreset(const LLSD& user_data)
{
- LLFloaterReg::showInstance("save_pref_preset", user_data.asString());
+ LLFloaterReg::showInstance("save_pref_preset", user_data.asString());
}
void LLPanelPreference::loadPreset(const LLSD& user_data)
{
- LLFloaterReg::showInstance("load_pref_preset", user_data.asString());
+ LLFloaterReg::showInstance("load_pref_preset", user_data.asString());
}
void LLPanelPreference::setHardwareDefaults()
@@ -2261,38 +2261,38 @@ void LLPanelPreference::setHardwareDefaults()
class LLPanelPreferencePrivacy : public LLPanelPreference
{
public:
- LLPanelPreferencePrivacy()
- {
- mAccountIndependentSettings.push_back("AutoDisengageMic");
- }
-
- /*virtual*/ void saveSettings()
- {
- LLPanelPreference::saveSettings();
-
- // Don't save (=erase from the saved values map) per-account privacy settings
- // if we're not logged in, otherwise they will be reset to defaults on log off.
- if (LLStartUp::getStartupState() != STATE_STARTED)
- {
- // Erase only common settings, assuming there are no color settings on Privacy page.
- for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); )
- {
- const std::string setting = it->first->getName();
- if (find(mAccountIndependentSettings.begin(),
- mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end())
- {
- mSavedValues.erase(it++);
- }
- else
- {
- ++it;
- }
- }
- }
- }
+ LLPanelPreferencePrivacy()
+ {
+ mAccountIndependentSettings.push_back("AutoDisengageMic");
+ }
+
+ /*virtual*/ void saveSettings()
+ {
+ LLPanelPreference::saveSettings();
+
+ // Don't save (=erase from the saved values map) per-account privacy settings
+ // if we're not logged in, otherwise they will be reset to defaults on log off.
+ if (LLStartUp::getStartupState() != STATE_STARTED)
+ {
+ // Erase only common settings, assuming there are no color settings on Privacy page.
+ for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); )
+ {
+ const std::string setting = it->first->getName();
+ if (find(mAccountIndependentSettings.begin(),
+ mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end())
+ {
+ mSavedValues.erase(it++);
+ }
+ else
+ {
+ ++it;
+ }
+ }
+ }
+ }
private:
- std::list<std::string> mAccountIndependentSettings;
+ std::list<std::string> mAccountIndependentSettings;
};
static LLPanelInjector<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
@@ -2300,170 +2300,170 @@ static LLPanelInjector<LLPanelPreferencePrivacy> t_pref_privacy("panel_preferenc
BOOL LLPanelPreferenceGraphics::postBuild()
{
- LLFloaterReg::showInstance("prefs_graphics_advanced");
- LLFloaterReg::hideInstance("prefs_graphics_advanced");
+ LLFloaterReg::showInstance("prefs_graphics_advanced");
+ LLFloaterReg::hideInstance("prefs_graphics_advanced");
- resetDirtyChilds();
- setPresetText();
+ resetDirtyChilds();
+ setPresetText();
- LLPresetsManager* presetsMgr = LLPresetsManager::getInstance();
+ LLPresetsManager* presetsMgr = LLPresetsManager::getInstance();
presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this));
presetsMgr->createMissingDefault(PRESETS_GRAPHIC); // a no-op after the first time, but that's ok
-
- return LLPanelPreference::postBuild();
+
+ return LLPanelPreference::postBuild();
}
void LLPanelPreferenceGraphics::draw()
{
- setPresetText();
- LLPanelPreference::draw();
+ setPresetText();
+ LLPanelPreference::draw();
}
void LLPanelPreferenceGraphics::onPresetsListChange()
{
- resetDirtyChilds();
- setPresetText();
+ resetDirtyChilds();
+ setPresetText();
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance && !gSavedSettings.getString("PresetGraphicActive").empty())
- {
- instance->saveSettings(); //make cancel work correctly after changing the preset
- }
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance && !gSavedSettings.getString("PresetGraphicActive").empty())
+ {
+ instance->saveSettings(); //make cancel work correctly after changing the preset
+ }
}
void LLPanelPreferenceGraphics::setPresetText()
{
- LLTextBox* preset_text = getChild<LLTextBox>("preset_text");
+ LLTextBox* preset_text = getChild<LLTextBox>("preset_text");
- std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
+ std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
- if (!preset_graphic_active.empty() && preset_graphic_active != preset_text->getText())
- {
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
- instance->saveGraphicsPreset(preset_graphic_active);
- }
- }
+ if (!preset_graphic_active.empty() && preset_graphic_active != preset_text->getText())
+ {
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance)
+ {
+ instance->saveGraphicsPreset(preset_graphic_active);
+ }
+ }
if (hasDirtyChilds() && !preset_graphic_active.empty())
- {
- gSavedSettings.setString("PresetGraphicActive", "");
- preset_graphic_active.clear();
- // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown
- // panel to update.
- LLPresetsManager::getInstance()->triggerChangeSignal();
- }
-
- if (!preset_graphic_active.empty())
- {
- if (preset_graphic_active == PRESETS_DEFAULT)
- {
- preset_graphic_active = LLTrans::getString(PRESETS_DEFAULT);
- }
- preset_text->setText(preset_graphic_active);
- }
- else
- {
- preset_text->setText(LLTrans::getString("none_paren_cap"));
- }
-
- preset_text->resetDirty();
+ {
+ gSavedSettings.setString("PresetGraphicActive", "");
+ preset_graphic_active.clear();
+ // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown
+ // panel to update.
+ LLPresetsManager::getInstance()->triggerChangeSignal();
+ }
+
+ if (!preset_graphic_active.empty())
+ {
+ if (preset_graphic_active == PRESETS_DEFAULT)
+ {
+ preset_graphic_active = LLTrans::getString(PRESETS_DEFAULT);
+ }
+ preset_text->setText(preset_graphic_active);
+ }
+ else
+ {
+ preset_text->setText(LLTrans::getString("none_paren_cap"));
+ }
+
+ preset_text->resetDirty();
}
bool LLPanelPreferenceGraphics::hasDirtyChilds()
{
- LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
- std::list<LLView*> view_stack;
- view_stack.push_back(this);
- if (advanced)
- {
- view_stack.push_back(advanced);
- }
- while(!view_stack.empty())
- {
- // Process view on top of the stack
- LLView* curview = view_stack.front();
- view_stack.pop_front();
-
- LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
- if (ctrl)
- {
- if (ctrl->isDirty())
- {
- LLControlVariable* control = ctrl->getControlVariable();
- if (control)
- {
- std::string control_name = control->getName();
- if (!control_name.empty())
- {
- return true;
- }
- }
- }
- }
- // Push children onto the end of the work stack
- for (child_list_t::const_iterator iter = curview->getChildList()->begin();
- iter != curview->getChildList()->end(); ++iter)
- {
- view_stack.push_back(*iter);
- }
- }
-
- return false;
+ LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
+ std::list<LLView*> view_stack;
+ view_stack.push_back(this);
+ if (advanced)
+ {
+ view_stack.push_back(advanced);
+ }
+ while(!view_stack.empty())
+ {
+ // Process view on top of the stack
+ LLView* curview = view_stack.front();
+ view_stack.pop_front();
+
+ LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
+ if (ctrl)
+ {
+ if (ctrl->isDirty())
+ {
+ LLControlVariable* control = ctrl->getControlVariable();
+ if (control)
+ {
+ std::string control_name = control->getName();
+ if (!control_name.empty())
+ {
+ return true;
+ }
+ }
+ }
+ }
+ // Push children onto the end of the work stack
+ for (child_list_t::const_iterator iter = curview->getChildList()->begin();
+ iter != curview->getChildList()->end(); ++iter)
+ {
+ view_stack.push_back(*iter);
+ }
+ }
+
+ return false;
}
void LLPanelPreferenceGraphics::resetDirtyChilds()
{
- LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
- std::list<LLView*> view_stack;
- view_stack.push_back(this);
- if (advanced)
- {
- view_stack.push_back(advanced);
- }
- while(!view_stack.empty())
- {
- // Process view on top of the stack
- LLView* curview = view_stack.front();
- view_stack.pop_front();
-
- LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
- if (ctrl)
- {
- ctrl->resetDirty();
- }
- // Push children onto the end of the work stack
- for (child_list_t::const_iterator iter = curview->getChildList()->begin();
- iter != curview->getChildList()->end(); ++iter)
- {
- view_stack.push_back(*iter);
- }
- }
+ LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
+ std::list<LLView*> view_stack;
+ view_stack.push_back(this);
+ if (advanced)
+ {
+ view_stack.push_back(advanced);
+ }
+ while(!view_stack.empty())
+ {
+ // Process view on top of the stack
+ LLView* curview = view_stack.front();
+ view_stack.pop_front();
+
+ LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
+ if (ctrl)
+ {
+ ctrl->resetDirty();
+ }
+ // Push children onto the end of the work stack
+ for (child_list_t::const_iterator iter = curview->getChildList()->begin();
+ iter != curview->getChildList()->end(); ++iter)
+ {
+ view_stack.push_back(*iter);
+ }
+ }
}
void LLPanelPreferenceGraphics::cancel()
{
- LLPanelPreference::cancel();
+ LLPanelPreference::cancel();
}
void LLPanelPreferenceGraphics::saveSettings()
{
- resetDirtyChilds();
- std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
- if (preset_graphic_active.empty())
- {
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
- //don't restore previous preset after closing Preferences
- instance->saveGraphicsPreset(preset_graphic_active);
- }
- }
- LLPanelPreference::saveSettings();
+ resetDirtyChilds();
+ std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
+ if (preset_graphic_active.empty())
+ {
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance)
+ {
+ //don't restore previous preset after closing Preferences
+ instance->saveGraphicsPreset(preset_graphic_active);
+ }
+ }
+ LLPanelPreference::saveSettings();
}
void LLPanelPreferenceGraphics::setHardwareDefaults()
{
- resetDirtyChilds();
+ resetDirtyChilds();
}
//------------------------LLPanelPreferenceControls--------------------------------
@@ -3033,7 +3033,7 @@ void LLPanelPreferenceControls::onDefaultKeyBind(bool all_modes)
{
return;
}
-
+
if (mEditingColumn > 0)
{
if (all_modes)
@@ -3075,12 +3075,12 @@ void LLPanelPreferenceControls::onCancelKeyBind()
}
LLFloaterPreferenceProxy::LLFloaterPreferenceProxy(const LLSD& key)
- : LLFloater(key),
- mSocksSettingsDirty(false)
+ : LLFloater(key),
+ mSocksSettingsDirty(false)
{
- mCommitCallbackRegistrar.add("Proxy.OK", boost::bind(&LLFloaterPreferenceProxy::onBtnOk, this));
- mCommitCallbackRegistrar.add("Proxy.Cancel", boost::bind(&LLFloaterPreferenceProxy::onBtnCancel, this));
- mCommitCallbackRegistrar.add("Proxy.Change", boost::bind(&LLFloaterPreferenceProxy::onChangeSocksSettings, this));
+ mCommitCallbackRegistrar.add("Proxy.OK", boost::bind(&LLFloaterPreferenceProxy::onBtnOk, this));
+ mCommitCallbackRegistrar.add("Proxy.Cancel", boost::bind(&LLFloaterPreferenceProxy::onBtnCancel, this));
+ mCommitCallbackRegistrar.add("Proxy.Change", boost::bind(&LLFloaterPreferenceProxy::onChangeSocksSettings, this));
}
LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy()
@@ -3089,192 +3089,192 @@ LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy()
BOOL LLFloaterPreferenceProxy::postBuild()
{
- LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
- if (!socksAuth)
- {
- return FALSE;
- }
- if (socksAuth->getSelectedValue().asString() == "None")
- {
- getChild<LLLineEditor>("socks5_username")->setEnabled(false);
- getChild<LLLineEditor>("socks5_password")->setEnabled(false);
- }
- else
- {
- // Populate the SOCKS 5 credential fields with protected values.
- LLPointer<LLCredential> socks_cred = gSecAPIHandler->loadCredential("SOCKS5");
- getChild<LLLineEditor>("socks5_username")->setValue(socks_cred->getIdentifier()["username"].asString());
- getChild<LLLineEditor>("socks5_password")->setValue(socks_cred->getAuthenticator()["creds"].asString());
- }
-
- return TRUE;
+ LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
+ if (!socksAuth)
+ {
+ return FALSE;
+ }
+ if (socksAuth->getSelectedValue().asString() == "None")
+ {
+ getChild<LLLineEditor>("socks5_username")->setEnabled(false);
+ getChild<LLLineEditor>("socks5_password")->setEnabled(false);
+ }
+ else
+ {
+ // Populate the SOCKS 5 credential fields with protected values.
+ LLPointer<LLCredential> socks_cred = gSecAPIHandler->loadCredential("SOCKS5");
+ getChild<LLLineEditor>("socks5_username")->setValue(socks_cred->getIdentifier()["username"].asString());
+ getChild<LLLineEditor>("socks5_password")->setValue(socks_cred->getAuthenticator()["creds"].asString());
+ }
+
+ return TRUE;
}
void LLFloaterPreferenceProxy::onOpen(const LLSD& key)
{
- saveSettings();
+ saveSettings();
}
void LLFloaterPreferenceProxy::onClose(bool app_quitting)
{
- if(app_quitting)
- {
- cancel();
- }
+ if(app_quitting)
+ {
+ cancel();
+ }
- if (mSocksSettingsDirty)
- {
+ if (mSocksSettingsDirty)
+ {
- // If the user plays with the Socks proxy settings after login, it's only fair we let them know
- // it will not be updated until next restart.
- if (LLStartUp::getStartupState()>STATE_LOGIN_WAIT)
- {
- LLNotifications::instance().add("ChangeProxySettings", LLSD(), LLSD());
- mSocksSettingsDirty = false; // we have notified the user now be quiet again
- }
- }
+ // If the user plays with the Socks proxy settings after login, it's only fair we let them know
+ // it will not be updated until next restart.
+ if (LLStartUp::getStartupState()>STATE_LOGIN_WAIT)
+ {
+ LLNotifications::instance().add("ChangeProxySettings", LLSD(), LLSD());
+ mSocksSettingsDirty = false; // we have notified the user now be quiet again
+ }
+ }
}
void LLFloaterPreferenceProxy::saveSettings()
{
- // Save the value of all controls in the hierarchy
- mSavedValues.clear();
- std::list<LLView*> view_stack;
- view_stack.push_back(this);
- while(!view_stack.empty())
- {
- // Process view on top of the stack
- LLView* curview = view_stack.front();
- view_stack.pop_front();
-
- LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
- if (ctrl)
- {
- LLControlVariable* control = ctrl->getControlVariable();
- if (control)
- {
- mSavedValues[control] = control->getValue();
- }
- }
-
- // Push children onto the end of the work stack
- for (child_list_t::const_iterator iter = curview->getChildList()->begin();
- iter != curview->getChildList()->end(); ++iter)
- {
- view_stack.push_back(*iter);
- }
- }
+ // Save the value of all controls in the hierarchy
+ mSavedValues.clear();
+ std::list<LLView*> view_stack;
+ view_stack.push_back(this);
+ while(!view_stack.empty())
+ {
+ // Process view on top of the stack
+ LLView* curview = view_stack.front();
+ view_stack.pop_front();
+
+ LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
+ if (ctrl)
+ {
+ LLControlVariable* control = ctrl->getControlVariable();
+ if (control)
+ {
+ mSavedValues[control] = control->getValue();
+ }
+ }
+
+ // Push children onto the end of the work stack
+ for (child_list_t::const_iterator iter = curview->getChildList()->begin();
+ iter != curview->getChildList()->end(); ++iter)
+ {
+ view_stack.push_back(*iter);
+ }
+ }
}
void LLFloaterPreferenceProxy::onBtnOk()
{
- // commit any outstanding text entry
- if (hasFocus())
- {
- LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- if (cur_focus && cur_focus->acceptsTextInput())
- {
- cur_focus->onCommit();
- }
- }
-
- // Save SOCKS proxy credentials securely if password auth is enabled
- LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
- if (socksAuth->getSelectedValue().asString() == "UserPass")
- {
- LLSD socks_id = LLSD::emptyMap();
- socks_id["type"] = "SOCKS5";
- socks_id["username"] = getChild<LLLineEditor>("socks5_username")->getValue().asString();
-
- LLSD socks_authenticator = LLSD::emptyMap();
- socks_authenticator["type"] = "SOCKS5";
- socks_authenticator["creds"] = getChild<LLLineEditor>("socks5_password")->getValue().asString();
-
- // Using "SOCKS5" as the "grid" argument since the same proxy
- // settings will be used for all grids and because there is no
- // way to specify the type of credential.
- LLPointer<LLCredential> socks_cred = gSecAPIHandler->createCredential("SOCKS5", socks_id, socks_authenticator);
- gSecAPIHandler->saveCredential(socks_cred, true);
- }
- else
- {
- // Clear SOCKS5 credentials since they are no longer needed.
- LLPointer<LLCredential> socks_cred = new LLCredential("SOCKS5");
- gSecAPIHandler->deleteCredential(socks_cred);
- }
-
- closeFloater(false);
+ // commit any outstanding text entry
+ if (hasFocus())
+ {
+ LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
+ if (cur_focus && cur_focus->acceptsTextInput())
+ {
+ cur_focus->onCommit();
+ }
+ }
+
+ // Save SOCKS proxy credentials securely if password auth is enabled
+ LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
+ if (socksAuth->getSelectedValue().asString() == "UserPass")
+ {
+ LLSD socks_id = LLSD::emptyMap();
+ socks_id["type"] = "SOCKS5";
+ socks_id["username"] = getChild<LLLineEditor>("socks5_username")->getValue().asString();
+
+ LLSD socks_authenticator = LLSD::emptyMap();
+ socks_authenticator["type"] = "SOCKS5";
+ socks_authenticator["creds"] = getChild<LLLineEditor>("socks5_password")->getValue().asString();
+
+ // Using "SOCKS5" as the "grid" argument since the same proxy
+ // settings will be used for all grids and because there is no
+ // way to specify the type of credential.
+ LLPointer<LLCredential> socks_cred = gSecAPIHandler->createCredential("SOCKS5", socks_id, socks_authenticator);
+ gSecAPIHandler->saveCredential(socks_cred, true);
+ }
+ else
+ {
+ // Clear SOCKS5 credentials since they are no longer needed.
+ LLPointer<LLCredential> socks_cred = new LLCredential("SOCKS5");
+ gSecAPIHandler->deleteCredential(socks_cred);
+ }
+
+ closeFloater(false);
}
void LLFloaterPreferenceProxy::onBtnCancel()
{
- if (hasFocus())
- {
- LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- if (cur_focus && cur_focus->acceptsTextInput())
- {
- cur_focus->onCommit();
- }
- refresh();
- }
+ if (hasFocus())
+ {
+ LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
+ if (cur_focus && cur_focus->acceptsTextInput())
+ {
+ cur_focus->onCommit();
+ }
+ refresh();
+ }
- cancel();
+ cancel();
}
void LLFloaterPreferenceProxy::onClickCloseBtn(bool app_quitting)
{
- cancel();
+ cancel();
}
void LLFloaterPreferenceProxy::cancel()
{
- for (control_values_map_t::iterator iter = mSavedValues.begin();
- iter != mSavedValues.end(); ++iter)
- {
- LLControlVariable* control = iter->first;
- LLSD ctrl_value = iter->second;
- control->set(ctrl_value);
- }
- mSocksSettingsDirty = false;
- closeFloater();
+ for (control_values_map_t::iterator iter = mSavedValues.begin();
+ iter != mSavedValues.end(); ++iter)
+ {
+ LLControlVariable* control = iter->first;
+ LLSD ctrl_value = iter->second;
+ control->set(ctrl_value);
+ }
+ mSocksSettingsDirty = false;
+ closeFloater();
}
-void LLFloaterPreferenceProxy::onChangeSocksSettings()
+void LLFloaterPreferenceProxy::onChangeSocksSettings()
{
- mSocksSettingsDirty = true;
+ mSocksSettingsDirty = true;
- LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
- if (socksAuth->getSelectedValue().asString() == "None")
- {
- getChild<LLLineEditor>("socks5_username")->setEnabled(false);
- getChild<LLLineEditor>("socks5_password")->setEnabled(false);
- }
- else
- {
- getChild<LLLineEditor>("socks5_username")->setEnabled(true);
- getChild<LLLineEditor>("socks5_password")->setEnabled(true);
- }
+ LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
+ if (socksAuth->getSelectedValue().asString() == "None")
+ {
+ getChild<LLLineEditor>("socks5_username")->setEnabled(false);
+ getChild<LLLineEditor>("socks5_password")->setEnabled(false);
+ }
+ else
+ {
+ getChild<LLLineEditor>("socks5_username")->setEnabled(true);
+ getChild<LLLineEditor>("socks5_password")->setEnabled(true);
+ }
- // Check for invalid states for the other HTTP proxy radio
- LLRadioGroup* otherHttpProxy = getChild<LLRadioGroup>("other_http_proxy_type");
- if ((otherHttpProxy->getSelectedValue().asString() == "Socks" &&
- getChild<LLCheckBoxCtrl>("socks_proxy_enabled")->get() == FALSE )||(
- otherHttpProxy->getSelectedValue().asString() == "Web" &&
- getChild<LLCheckBoxCtrl>("web_proxy_enabled")->get() == FALSE ) )
- {
- otherHttpProxy->selectFirstItem();
- }
+ // Check for invalid states for the other HTTP proxy radio
+ LLRadioGroup* otherHttpProxy = getChild<LLRadioGroup>("other_http_proxy_type");
+ if ((otherHttpProxy->getSelectedValue().asString() == "Socks" &&
+ getChild<LLCheckBoxCtrl>("socks_proxy_enabled")->get() == FALSE )||(
+ otherHttpProxy->getSelectedValue().asString() == "Web" &&
+ getChild<LLCheckBoxCtrl>("web_proxy_enabled")->get() == FALSE ) )
+ {
+ otherHttpProxy->selectFirstItem();
+ }
}
void LLFloaterPreference::onUpdateFilterTerm(bool force)
{
- LLWString seachValue = utf8str_to_wstring( mFilterEdit->getValue() );
- LLWStringUtil::toLower( seachValue );
+ LLWString seachValue = utf8str_to_wstring( mFilterEdit->getValue() );
+ LLWStringUtil::toLower( seachValue );
- if( !mSearchData || (mSearchData->mLastFilter == seachValue && !force))
- return;
+ if( !mSearchData || (mSearchData->mLastFilter == seachValue && !force))
+ return;
if (mSearchDataDirty)
{
@@ -3282,17 +3282,17 @@ void LLFloaterPreference::onUpdateFilterTerm(bool force)
collectSearchableItems();
}
- mSearchData->mLastFilter = seachValue;
+ mSearchData->mLastFilter = seachValue;
- if( !mSearchData->mRootTab )
- return;
+ if( !mSearchData->mRootTab )
+ return;
- mSearchData->mRootTab->hightlightAndHide( seachValue );
+ mSearchData->mRootTab->hightlightAndHide( seachValue );
filterIgnorableNotifications();
- LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" );
- if( pRoot )
- pRoot->selectFirstTab();
+ LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" );
+ if( pRoot )
+ pRoot->selectFirstTab();
}
void LLFloaterPreference::filterIgnorableNotifications()
@@ -3308,91 +3308,91 @@ void LLFloaterPreference::filterIgnorableNotifications()
void collectChildren( LLView const *aView, ll::prefs::PanelDataPtr aParentPanel, ll::prefs::TabContainerDataPtr aParentTabContainer )
{
- if( !aView )
- return;
-
- llassert_always( aParentPanel || aParentTabContainer );
-
- LLView::child_list_const_iter_t itr = aView->beginChild();
- LLView::child_list_const_iter_t itrEnd = aView->endChild();
-
- while( itr != itrEnd )
- {
- LLView *pView = *itr;
- ll::prefs::PanelDataPtr pCurPanelData = aParentPanel;
- ll::prefs::TabContainerDataPtr pCurTabContainer = aParentTabContainer;
- if( !pView )
- continue;
- LLPanel const *pPanel = dynamic_cast< LLPanel const *>( pView );
- LLTabContainer const *pTabContainer = dynamic_cast< LLTabContainer const *>( pView );
- ll::ui::SearchableControl const *pSCtrl = dynamic_cast< ll::ui::SearchableControl const *>( pView );
-
- if( pTabContainer )
- {
- pCurPanelData.reset();
-
- pCurTabContainer = ll::prefs::TabContainerDataPtr( new ll::prefs::TabContainerData );
- pCurTabContainer->mTabContainer = const_cast< LLTabContainer *>( pTabContainer );
- pCurTabContainer->mLabel = pTabContainer->getLabel();
- pCurTabContainer->mPanel = 0;
-
- if( aParentPanel )
- aParentPanel->mChildPanel.push_back( pCurTabContainer );
- if( aParentTabContainer )
- aParentTabContainer->mChildPanel.push_back( pCurTabContainer );
- }
- else if( pPanel )
- {
- pCurTabContainer.reset();
-
- pCurPanelData = ll::prefs::PanelDataPtr( new ll::prefs::PanelData );
- pCurPanelData->mPanel = pPanel;
- pCurPanelData->mLabel = pPanel->getLabel();
-
- llassert_always( aParentPanel || aParentTabContainer );
-
- if( aParentTabContainer )
- aParentTabContainer->mChildPanel.push_back( pCurPanelData );
- else if( aParentPanel )
- aParentPanel->mChildPanel.push_back( pCurPanelData );
- }
- else if( pSCtrl && pSCtrl->getSearchText().size() )
- {
- ll::prefs::SearchableItemPtr item = ll::prefs::SearchableItemPtr( new ll::prefs::SearchableItem() );
- item->mView = pView;
- item->mCtrl = pSCtrl;
-
- item->mLabel = utf8str_to_wstring( pSCtrl->getSearchText() );
- LLWStringUtil::toLower( item->mLabel );
-
- llassert_always( aParentPanel || aParentTabContainer );
-
- if( aParentPanel )
- aParentPanel->mChildren.push_back( item );
- if( aParentTabContainer )
- aParentTabContainer->mChildren.push_back( item );
- }
- collectChildren( pView, pCurPanelData, pCurTabContainer );
- ++itr;
- }
+ if( !aView )
+ return;
+
+ llassert_always( aParentPanel || aParentTabContainer );
+
+ LLView::child_list_const_iter_t itr = aView->beginChild();
+ LLView::child_list_const_iter_t itrEnd = aView->endChild();
+
+ while( itr != itrEnd )
+ {
+ LLView *pView = *itr;
+ ll::prefs::PanelDataPtr pCurPanelData = aParentPanel;
+ ll::prefs::TabContainerDataPtr pCurTabContainer = aParentTabContainer;
+ if( !pView )
+ continue;
+ LLPanel const *pPanel = dynamic_cast< LLPanel const *>( pView );
+ LLTabContainer const *pTabContainer = dynamic_cast< LLTabContainer const *>( pView );
+ ll::ui::SearchableControl const *pSCtrl = dynamic_cast< ll::ui::SearchableControl const *>( pView );
+
+ if( pTabContainer )
+ {
+ pCurPanelData.reset();
+
+ pCurTabContainer = ll::prefs::TabContainerDataPtr( new ll::prefs::TabContainerData );
+ pCurTabContainer->mTabContainer = const_cast< LLTabContainer *>( pTabContainer );
+ pCurTabContainer->mLabel = pTabContainer->getLabel();
+ pCurTabContainer->mPanel = 0;
+
+ if( aParentPanel )
+ aParentPanel->mChildPanel.push_back( pCurTabContainer );
+ if( aParentTabContainer )
+ aParentTabContainer->mChildPanel.push_back( pCurTabContainer );
+ }
+ else if( pPanel )
+ {
+ pCurTabContainer.reset();
+
+ pCurPanelData = ll::prefs::PanelDataPtr( new ll::prefs::PanelData );
+ pCurPanelData->mPanel = pPanel;
+ pCurPanelData->mLabel = pPanel->getLabel();
+
+ llassert_always( aParentPanel || aParentTabContainer );
+
+ if( aParentTabContainer )
+ aParentTabContainer->mChildPanel.push_back( pCurPanelData );
+ else if( aParentPanel )
+ aParentPanel->mChildPanel.push_back( pCurPanelData );
+ }
+ else if( pSCtrl && pSCtrl->getSearchText().size() )
+ {
+ ll::prefs::SearchableItemPtr item = ll::prefs::SearchableItemPtr( new ll::prefs::SearchableItem() );
+ item->mView = pView;
+ item->mCtrl = pSCtrl;
+
+ item->mLabel = utf8str_to_wstring( pSCtrl->getSearchText() );
+ LLWStringUtil::toLower( item->mLabel );
+
+ llassert_always( aParentPanel || aParentTabContainer );
+
+ if( aParentPanel )
+ aParentPanel->mChildren.push_back( item );
+ if( aParentTabContainer )
+ aParentTabContainer->mChildren.push_back( item );
+ }
+ collectChildren( pView, pCurPanelData, pCurTabContainer );
+ ++itr;
+ }
}
void LLFloaterPreference::collectSearchableItems()
{
- mSearchData.reset( nullptr );
- LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" );
- if( mFilterEdit && pRoot )
- {
- mSearchData.reset(new ll::prefs::SearchData() );
+ mSearchData.reset( nullptr );
+ LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" );
+ if( mFilterEdit && pRoot )
+ {
+ mSearchData.reset(new ll::prefs::SearchData() );
- ll::prefs::TabContainerDataPtr pRootTabcontainer = ll::prefs::TabContainerDataPtr( new ll::prefs::TabContainerData );
- pRootTabcontainer->mTabContainer = pRoot;
- pRootTabcontainer->mLabel = pRoot->getLabel();
- mSearchData->mRootTab = pRootTabcontainer;
+ ll::prefs::TabContainerDataPtr pRootTabcontainer = ll::prefs::TabContainerDataPtr( new ll::prefs::TabContainerData );
+ pRootTabcontainer->mTabContainer = pRoot;
+ pRootTabcontainer->mLabel = pRoot->getLabel();
+ mSearchData->mRootTab = pRootTabcontainer;
- collectChildren( this, ll::prefs::PanelDataPtr(), pRootTabcontainer );
- }
- mSearchDataDirty = false;
+ collectChildren( this, ll::prefs::PanelDataPtr(), pRootTabcontainer );
+ }
+ mSearchDataDirty = false;
}
void LLFloaterPreference::saveIgnoredNotifications()
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 04ac87364d..fe684cf88c 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterpreference.h
* @brief LLPreferenceCore class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,189 +54,189 @@ class LLTextBox;
namespace ll
{
- namespace prefs
- {
- struct SearchData;
- }
+ namespace prefs
+ {
+ struct SearchData;
+ }
}
typedef std::map<std::string, std::string> notifications_map;
typedef enum
- {
- GS_LOW_GRAPHICS,
- GS_MID_GRAPHICS,
- GS_HIGH_GRAPHICS,
- GS_ULTRA_GRAPHICS
-
- } EGraphicsSettings;
+ {
+ GS_LOW_GRAPHICS,
+ GS_MID_GRAPHICS,
+ GS_HIGH_GRAPHICS,
+ GS_ULTRA_GRAPHICS
+
+ } EGraphicsSettings;
// Floater to control preferences (display, audio, bandwidth, general.
class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver, public LLConversationLogObserver
{
-public:
- LLFloaterPreference(const LLSD& key);
- ~LLFloaterPreference();
-
- void apply();
- void cancel();
- /*virtual*/ void draw();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
- /*virtual*/ void changed();
- /*virtual*/ void changed(const LLUUID& session_id, U32 mask) {};
-
- // static data update, called from message handler
- static void updateUserInfo(const std::string& visibility);
-
- // refresh all the graphics preferences menus
- static void refreshEnabledGraphics();
-
- // translate user's do not disturb response message according to current locale if message is default, otherwise do nothing
- static void initDoNotDisturbResponse();
-
- // update Show Favorites checkbox
- static void updateShowFavoritesCheckbox(bool val);
-
- void processProperties( void* pData, EAvatarProcessorType type );
- void saveAvatarProperties( void );
+public:
+ LLFloaterPreference(const LLSD& key);
+ ~LLFloaterPreference();
+
+ void apply();
+ void cancel();
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void changed();
+ /*virtual*/ void changed(const LLUUID& session_id, U32 mask) {};
+
+ // static data update, called from message handler
+ static void updateUserInfo(const std::string& visibility);
+
+ // refresh all the graphics preferences menus
+ static void refreshEnabledGraphics();
+
+ // translate user's do not disturb response message according to current locale if message is default, otherwise do nothing
+ static void initDoNotDisturbResponse();
+
+ // update Show Favorites checkbox
+ static void updateShowFavoritesCheckbox(bool val);
+
+ void processProperties( void* pData, EAvatarProcessorType type );
+ void saveAvatarProperties( void );
static void saveAvatarPropertiesCoro(const std::string url, bool allow_publish);
- void selectPrivacyPanel();
- void selectChatPanel();
- void getControlNames(std::vector<std::string>& names);
- // updates click/double-click action controls depending on values from settings.xml
- void updateClickActionViews();
+ void selectPrivacyPanel();
+ void selectChatPanel();
+ void getControlNames(std::vector<std::string>& names);
+ // updates click/double-click action controls depending on values from settings.xml
+ void updateClickActionViews();
void updateSearchableItems();
- void onBtnOK(const LLSD& userdata);
- void onBtnCancel(const LLSD& userdata);
-
-protected:
-
- void onClickClearCache(); // Clear viewer texture cache, file cache on next startup
- void onClickBrowserClearCache(); // Clear web history and caches as well as viewer caches above
- void onLanguageChange();
- void onNotificationsChange(const std::string& OptionName);
- void onNameTagOpacityChange(const LLSD& newvalue);
-
- // set value of "DoNotDisturbResponseChanged" in account settings depending on whether do not disturb response
- // string differs from default after user changes.
- void onDoNotDisturbResponseChanged();
- // if the custom settings box is clicked
- void onChangeCustom();
- void updateMeterText(LLUICtrl* ctrl);
- // callback for defaults
- void setHardwareDefaults();
- void setRecommended();
- // callback for when client modifies a render option
+ void onBtnOK(const LLSD& userdata);
+ void onBtnCancel(const LLSD& userdata);
+
+protected:
+
+ void onClickClearCache(); // Clear viewer texture cache, file cache on next startup
+ void onClickBrowserClearCache(); // Clear web history and caches as well as viewer caches above
+ void onLanguageChange();
+ void onNotificationsChange(const std::string& OptionName);
+ void onNameTagOpacityChange(const LLSD& newvalue);
+
+ // set value of "DoNotDisturbResponseChanged" in account settings depending on whether do not disturb response
+ // string differs from default after user changes.
+ void onDoNotDisturbResponseChanged();
+ // if the custom settings box is clicked
+ void onChangeCustom();
+ void updateMeterText(LLUICtrl* ctrl);
+ // callback for defaults
+ void setHardwareDefaults();
+ void setRecommended();
+ // callback for when client modifies a render option
void onRenderOptionEnable();
- // callback for when client turns on impostors
- void onAvatarImpostorsEnable();
+ // callback for when client turns on impostors
+ void onAvatarImpostorsEnable();
- // callback for commit in the "Single click on land" and "Double click on land" comboboxes.
- void onClickActionChange();
- // updates click/double-click action keybindngs depending on view values
- void updateClickActionControls();
+ // callback for commit in the "Single click on land" and "Double click on land" comboboxes.
+ void onClickActionChange();
+ // updates click/double-click action keybindngs depending on view values
+ void updateClickActionControls();
void onAtmosShaderChange();
public:
- // This function squirrels away the current values of the controls so that
- // cancel() can restore them.
- void saveSettings();
-
- void saveIgnoredNotifications();
- void restoreIgnoredNotifications();
-
- void setCacheLocation(const LLStringExplicit& location);
-
- void onClickSetCache();
- void changeCachePath(const std::vector<std::string>& filenames, std::string proposed_name);
- void onClickResetCache();
- void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata);
- void onSelectSkin();
- void onClickSetSounds();
- void onClickEnablePopup();
- void onClickDisablePopup();
- void resetAllIgnored();
- void setAllIgnored();
- void onClickLogPath();
- void changeLogPath(const std::vector<std::string>& filenames, std::string proposed_name);
- bool moveTranscriptsAndLog();
- void enableHistory();
- void setPersonalInfo(const std::string& visibility);
- void refreshEnabledState();
- void onCommitWindowedMode();
- void refresh(); // Refresh enable/disable
- // if the quality radio buttons are changed
- void onChangeQuality(const LLSD& data);
-
- void refreshUI();
-
- void onCommitMediaEnabled();
- void onCommitMusicEnabled();
- void applyResolution();
- void onChangeMaturity();
- void onChangeModelFolder();
+ // This function squirrels away the current values of the controls so that
+ // cancel() can restore them.
+ void saveSettings();
+
+ void saveIgnoredNotifications();
+ void restoreIgnoredNotifications();
+
+ void setCacheLocation(const LLStringExplicit& location);
+
+ void onClickSetCache();
+ void changeCachePath(const std::vector<std::string>& filenames, std::string proposed_name);
+ void onClickResetCache();
+ void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata);
+ void onSelectSkin();
+ void onClickSetSounds();
+ void onClickEnablePopup();
+ void onClickDisablePopup();
+ void resetAllIgnored();
+ void setAllIgnored();
+ void onClickLogPath();
+ void changeLogPath(const std::vector<std::string>& filenames, std::string proposed_name);
+ bool moveTranscriptsAndLog();
+ void enableHistory();
+ void setPersonalInfo(const std::string& visibility);
+ void refreshEnabledState();
+ void onCommitWindowedMode();
+ void refresh(); // Refresh enable/disable
+ // if the quality radio buttons are changed
+ void onChangeQuality(const LLSD& data);
+
+ void refreshUI();
+
+ void onCommitMediaEnabled();
+ void onCommitMusicEnabled();
+ void applyResolution();
+ void onChangeMaturity();
+ void onChangeModelFolder();
void onChangePBRFolder();
- void onChangeTextureFolder();
- void onChangeSoundFolder();
- void onChangeAnimationFolder();
- void onClickBlockList();
- void onClickProxySettings();
- void onClickTranslationSettings();
- void onClickPermsDefault();
- void onClickRememberedUsernames();
- void onClickAutoReplace();
- void onClickSpellChecker();
- void onClickRenderExceptions();
- void onClickAutoAdjustments();
- void onClickAdvanced();
- void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
- void getUIColor(LLUICtrl* ctrl, const LLSD& param);
- void onLogChatHistorySaved();
- void buildPopupLists();
- static void refreshSkin(void* data);
- void selectPanel(const LLSD& name);
- void saveCameraPreset(std::string& preset);
- void saveGraphicsPreset(std::string& preset);
+ void onChangeTextureFolder();
+ void onChangeSoundFolder();
+ void onChangeAnimationFolder();
+ void onClickBlockList();
+ void onClickProxySettings();
+ void onClickTranslationSettings();
+ void onClickPermsDefault();
+ void onClickRememberedUsernames();
+ void onClickAutoReplace();
+ void onClickSpellChecker();
+ void onClickRenderExceptions();
+ void onClickAutoAdjustments();
+ void onClickAdvanced();
+ void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
+ void getUIColor(LLUICtrl* ctrl, const LLSD& param);
+ void onLogChatHistorySaved();
+ void buildPopupLists();
+ static void refreshSkin(void* data);
+ void selectPanel(const LLSD& name);
+ void saveCameraPreset(std::string& preset);
+ void saveGraphicsPreset(std::string& preset);
void setRecommendedSettings();
void resetAutotuneSettings();
private:
- void onDeleteTranscripts();
- void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response);
- void updateDeleteTranscriptsButton();
- void updateMaxComplexity();
+ void onDeleteTranscripts();
+ void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response);
+ void updateDeleteTranscriptsButton();
+ void updateMaxComplexity();
void updateComplexityText();
- static bool loadFromFilename(const std::string& filename, std::map<std::string, std::string> &label_map);
-
- static std::string sSkin;
- notifications_map mNotificationOptions;
- bool mGotPersonalInfo;
- bool mLanguageChanged;
- bool mAvatarDataInitialized;
- std::string mPriorInstantMessageLogPath;
-
- bool mOriginalHideOnlineStatus;
- std::string mDirectoryVisibility;
-
- bool mAllowPublish; // Allow showing agent in search
- std::string mSavedCameraPreset;
- std::string mSavedGraphicsPreset;
- LOG_CLASS(LLFloaterPreference);
-
- LLSearchEditor *mFilterEdit;
- std::unique_ptr< ll::prefs::SearchData > mSearchData;
- bool mSearchDataDirty;
-
- boost::signals2::connection mComplexityChangedSignal;
-
- void onUpdateFilterTerm( bool force = false );
- void collectSearchableItems();
+ static bool loadFromFilename(const std::string& filename, std::map<std::string, std::string> &label_map);
+
+ static std::string sSkin;
+ notifications_map mNotificationOptions;
+ bool mGotPersonalInfo;
+ bool mLanguageChanged;
+ bool mAvatarDataInitialized;
+ std::string mPriorInstantMessageLogPath;
+
+ bool mOriginalHideOnlineStatus;
+ std::string mDirectoryVisibility;
+
+ bool mAllowPublish; // Allow showing agent in search
+ std::string mSavedCameraPreset;
+ std::string mSavedGraphicsPreset;
+ LOG_CLASS(LLFloaterPreference);
+
+ LLSearchEditor *mFilterEdit;
+ std::unique_ptr< ll::prefs::SearchData > mSearchData;
+ bool mSearchDataDirty;
+
+ boost::signals2::connection mComplexityChangedSignal;
+
+ void onUpdateFilterTerm( bool force = false );
+ void collectSearchableItems();
void filterIgnorableNotifications();
std::map<std::string, bool> mIgnorableNotifs;
@@ -245,89 +245,89 @@ private:
class LLPanelPreference : public LLPanel
{
public:
- LLPanelPreference();
- /*virtual*/ BOOL postBuild();
-
- virtual ~LLPanelPreference();
+ LLPanelPreference();
+ /*virtual*/ BOOL postBuild();
+
+ virtual ~LLPanelPreference();
- virtual void apply();
- virtual void cancel();
- void setControlFalse(const LLSD& user_data);
- virtual void setHardwareDefaults();
+ virtual void apply();
+ virtual void cancel();
+ void setControlFalse(const LLSD& user_data);
+ virtual void setHardwareDefaults();
- // Disables "Allow Media to auto play" check box only when both
- // "Streaming Music" and "Media" are unchecked. Otherwise enables it.
- void updateMediaAutoPlayCheckbox(LLUICtrl* ctrl);
+ // Disables "Allow Media to auto play" check box only when both
+ // "Streaming Music" and "Media" are unchecked. Otherwise enables it.
+ void updateMediaAutoPlayCheckbox(LLUICtrl* ctrl);
- // This function squirrels away the current values of the controls so that
- // cancel() can restore them.
- virtual void saveSettings();
+ // This function squirrels away the current values of the controls so that
+ // cancel() can restore them.
+ virtual void saveSettings();
- void deletePreset(const LLSD& user_data);
- void savePreset(const LLSD& user_data);
- void loadPreset(const LLSD& user_data);
+ void deletePreset(const LLSD& user_data);
+ void savePreset(const LLSD& user_data);
+ void loadPreset(const LLSD& user_data);
- class Updater;
+ class Updater;
protected:
- typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
- control_values_map_t mSavedValues;
+ typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
+ control_values_map_t mSavedValues;
private:
- //for "Only friends and groups can call or IM me"
- static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
+ //for "Only friends and groups can call or IM me"
+ static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
//for "Allow Multiple Viewers"
static void showMultipleViewersWarning(LLUICtrl*, const LLSD&);
- //for "Show my Favorite Landmarks at Login"
- static void handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value);
+ //for "Show my Favorite Landmarks at Login"
+ static void handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value);
- static void toggleMuteWhenMinimized();
- typedef std::map<std::string, LLColor4> string_color_map_t;
- string_color_map_t mSavedColors;
+ static void toggleMuteWhenMinimized();
+ typedef std::map<std::string, LLColor4> string_color_map_t;
+ string_color_map_t mSavedColors;
- Updater* mBandWidthUpdater;
- LOG_CLASS(LLPanelPreference);
+ Updater* mBandWidthUpdater;
+ LOG_CLASS(LLPanelPreference);
};
class LLPanelPreferenceGraphics : public LLPanelPreference
{
public:
- BOOL postBuild();
- void draw();
- void cancel();
- void saveSettings();
- void resetDirtyChilds();
- void setHardwareDefaults();
- void setPresetText();
+ BOOL postBuild();
+ void draw();
+ void cancel();
+ void saveSettings();
+ void resetDirtyChilds();
+ void setHardwareDefaults();
+ void setPresetText();
- static const std::string getPresetsPath();
+ static const std::string getPresetsPath();
protected:
- bool hasDirtyChilds();
+ bool hasDirtyChilds();
private:
- void onPresetsListChange();
- LOG_CLASS(LLPanelPreferenceGraphics);
+ void onPresetsListChange();
+ LOG_CLASS(LLPanelPreferenceGraphics);
};
class LLPanelPreferenceControls : public LLPanelPreference, public LLKeyBindResponderInterface
{
- LOG_CLASS(LLPanelPreferenceControls);
+ LOG_CLASS(LLPanelPreferenceControls);
public:
- LLPanelPreferenceControls();
- virtual ~LLPanelPreferenceControls();
+ LLPanelPreferenceControls();
+ virtual ~LLPanelPreferenceControls();
- BOOL postBuild();
+ BOOL postBuild();
- void apply();
- void cancel();
- void saveSettings();
- void resetDirtyChilds();
+ void apply();
+ void cancel();
+ void saveSettings();
+ void resetDirtyChilds();
- void onListCommit();
- void onModeCommit();
- void onRestoreDefaultsBtn();
- void onRestoreDefaultsResponse(const LLSD& notification, const LLSD& response);
+ void onListCommit();
+ void onModeCommit();
+ void onRestoreDefaultsBtn();
+ void onRestoreDefaultsResponse(const LLSD& notification, const LLSD& response);
// Bypass to let Move & view read values without need to create own key binding handler
// Todo: consider a better way to share access to keybindings
@@ -337,73 +337,73 @@ public:
void updateAndApply();
// from interface
- /*virtual*/ bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes);
+ /*virtual*/ bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes);
/*virtual*/ void onDefaultKeyBind(bool all_modes);
/*virtual*/ void onCancelKeyBind();
private:
- // reloads settings, discards current changes, updates table
- void regenerateControls();
+ // reloads settings, discards current changes, updates table
+ void regenerateControls();
- // These fuctions do not clean previous content
- bool addControlTableColumns(const std::string &filename);
- bool addControlTableRows(const std::string &filename);
- void addControlTableSeparator();
+ // These fuctions do not clean previous content
+ bool addControlTableColumns(const std::string &filename);
+ bool addControlTableRows(const std::string &filename);
+ void addControlTableSeparator();
- // Cleans content and then adds content from xml files according to current mEditingMode
+ // Cleans content and then adds content from xml files according to current mEditingMode
void populateControlTable();
// Updates keybindings from storage to table
void updateTable();
- LLScrollListCtrl* pControlsTable;
- LLComboBox *pKeyModeBox;
- LLKeyConflictHandler mConflictHandler[LLKeyConflictHandler::MODE_COUNT];
- std::string mEditingControl;
- S32 mEditingColumn;
- S32 mEditingMode;
+ LLScrollListCtrl* pControlsTable;
+ LLComboBox *pKeyModeBox;
+ LLKeyConflictHandler mConflictHandler[LLKeyConflictHandler::MODE_COUNT];
+ std::string mEditingControl;
+ S32 mEditingColumn;
+ S32 mEditingMode;
};
class LLAvatarComplexityControls
{
- public:
- static void updateMax(LLSliderCtrl* slider, LLTextBox* value_label, bool short_val = false);
- static void setText(U32 value, LLTextBox* text_box, bool short_val = false);
- static void updateMaxRenderTime(LLSliderCtrl* slider, LLTextBox* value_label, bool short_val = false);
- static void setRenderTimeText(F32 value, LLTextBox* text_box, bool short_val = false);
- static void setIndirectControls();
- static void setIndirectMaxNonImpostors();
- static void setIndirectMaxArc();
- LOG_CLASS(LLAvatarComplexityControls);
+ public:
+ static void updateMax(LLSliderCtrl* slider, LLTextBox* value_label, bool short_val = false);
+ static void setText(U32 value, LLTextBox* text_box, bool short_val = false);
+ static void updateMaxRenderTime(LLSliderCtrl* slider, LLTextBox* value_label, bool short_val = false);
+ static void setRenderTimeText(F32 value, LLTextBox* text_box, bool short_val = false);
+ static void setIndirectControls();
+ static void setIndirectMaxNonImpostors();
+ static void setIndirectMaxArc();
+ LOG_CLASS(LLAvatarComplexityControls);
};
class LLFloaterPreferenceProxy : public LLFloater
{
-public:
- LLFloaterPreferenceProxy(const LLSD& key);
- ~LLFloaterPreferenceProxy();
-
- /// show off our menu
- static void show();
- void cancel();
-
+public:
+ LLFloaterPreferenceProxy(const LLSD& key);
+ ~LLFloaterPreferenceProxy();
+
+ /// show off our menu
+ static void show();
+ void cancel();
+
protected:
- BOOL postBuild();
- void onOpen(const LLSD& key);
- void onClose(bool app_quitting);
- void saveSettings();
- void onBtnOk();
- void onBtnCancel();
- void onClickCloseBtn(bool app_quitting = false);
+ BOOL postBuild();
+ void onOpen(const LLSD& key);
+ void onClose(bool app_quitting);
+ void saveSettings();
+ void onBtnOk();
+ void onBtnCancel();
+ void onClickCloseBtn(bool app_quitting = false);
- void onChangeSocksSettings();
+ void onChangeSocksSettings();
private:
-
- bool mSocksSettingsDirty;
- typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
- control_values_map_t mSavedValues;
- LOG_CLASS(LLFloaterPreferenceProxy);
+
+ bool mSocksSettingsDirty;
+ typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
+ control_values_map_t mSavedValues;
+ LOG_CLASS(LLFloaterPreferenceProxy);
};
diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
index a91f0ec060..709963b924 100644
--- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
+++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterpreferencesgraphicsadvanced.cpp
* @brief floater for adjusting camera position
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -78,7 +78,7 @@ BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild()
use_HiDPI->setVisible(FALSE);
#endif
- mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateComplexityText, this));
+ mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateComplexityText, this));
mLODFactorChangedSignal = gSavedSettings.getControl("RenderVolumeLODFactor")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateObjectMeshDetailText, this));
return TRUE;
}
@@ -125,17 +125,17 @@ void LLFloaterPreferenceGraphicsAdvanced::refresh()
getChild<LLUICtrl>("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples"));
// sliders and their text boxes
- // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow");
+ // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow");
// slider text boxes
- updateSliderText(getChild<LLSliderCtrl>("ObjectMeshDetail", true), getChild<LLTextBox>("ObjectMeshDetailText", true));
- updateSliderText(getChild<LLSliderCtrl>("FlexibleMeshDetail", true), getChild<LLTextBox>("FlexibleMeshDetailText", true));
- updateSliderText(getChild<LLSliderCtrl>("TreeMeshDetail", true), getChild<LLTextBox>("TreeMeshDetailText", true));
- updateSliderText(getChild<LLSliderCtrl>("AvatarMeshDetail", true), getChild<LLTextBox>("AvatarMeshDetailText", true));
- updateSliderText(getChild<LLSliderCtrl>("AvatarPhysicsDetail", true), getChild<LLTextBox>("AvatarPhysicsDetailText", true));
- updateSliderText(getChild<LLSliderCtrl>("TerrainMeshDetail", true), getChild<LLTextBox>("TerrainMeshDetailText", true));
- updateSliderText(getChild<LLSliderCtrl>("RenderPostProcess", true), getChild<LLTextBox>("PostProcessText", true));
- updateSliderText(getChild<LLSliderCtrl>("SkyMeshDetail", true), getChild<LLTextBox>("SkyMeshDetailText", true));
- updateSliderText(getChild<LLSliderCtrl>("TerrainDetail", true), getChild<LLTextBox>("TerrainDetailText", true));
+ updateSliderText(getChild<LLSliderCtrl>("ObjectMeshDetail", true), getChild<LLTextBox>("ObjectMeshDetailText", true));
+ updateSliderText(getChild<LLSliderCtrl>("FlexibleMeshDetail", true), getChild<LLTextBox>("FlexibleMeshDetailText", true));
+ updateSliderText(getChild<LLSliderCtrl>("TreeMeshDetail", true), getChild<LLTextBox>("TreeMeshDetailText", true));
+ updateSliderText(getChild<LLSliderCtrl>("AvatarMeshDetail", true), getChild<LLTextBox>("AvatarMeshDetailText", true));
+ updateSliderText(getChild<LLSliderCtrl>("AvatarPhysicsDetail", true), getChild<LLTextBox>("AvatarPhysicsDetailText", true));
+ updateSliderText(getChild<LLSliderCtrl>("TerrainMeshDetail", true), getChild<LLTextBox>("TerrainMeshDetailText", true));
+ updateSliderText(getChild<LLSliderCtrl>("RenderPostProcess", true), getChild<LLTextBox>("PostProcessText", true));
+ updateSliderText(getChild<LLSliderCtrl>("SkyMeshDetail", true), getChild<LLTextBox>("SkyMeshDetailText", true));
+ updateSliderText(getChild<LLSliderCtrl>("TerrainDetail", true), getChild<LLTextBox>("TerrainDetailText", true));
LLAvatarComplexityControls::setIndirectControls();
setMaxNonImpostorsText(
gSavedSettings.getU32("RenderAvatarMaxNonImpostors"),
@@ -188,7 +188,7 @@ void LLFloaterPreferenceGraphicsAdvanced::updateSliderText(LLSliderCtrl* ctrl, L
if (value < midPoint)
{
text_box->setText(LLTrans::getString("GraphicsQualityLow"));
- }
+ }
else if (value < highPoint)
{
text_box->setText(LLTrans::getString("GraphicsQualityMid"));
@@ -238,7 +238,7 @@ void LLFloaterPreferenceGraphicsAdvanced::setMaxNonImpostorsText(U32 value, LLTe
}
void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings()
-{
+{
LLComboBox* ctrl_reflections = getChild<LLComboBox>("Reflections");
LLTextBox* reflections_text = getChild<LLTextBox>("ReflectionsText");
LLCheckBoxCtrl* ctrl_avatar_vp = getChild<LLCheckBoxCtrl>("AvatarVertexProgram");
@@ -358,7 +358,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState()
ctrl_reflections->setEnabled(reflections);
reflections_text->setEnabled(reflections);
- // Bump & Shiny
+ // Bump & Shiny
LLCheckBoxCtrl* bumpshiny_ctrl = getChild<LLCheckBoxCtrl>("BumpShiny");
bool bumpshiny = LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump");
bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE);
@@ -381,7 +381,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState()
if (gSavedSettings.getBOOL("RenderAvatarVP") == FALSE)
{
ctrl_avatar_cloth->setEnabled(FALSE);
- }
+ }
else
{
ctrl_avatar_cloth->setEnabled(TRUE);
@@ -414,7 +414,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState()
ctrl_deferred->setEnabled(enabled);
#endif
-
+
LLCheckBoxCtrl* ctrl_pbr = getChild<LLCheckBoxCtrl>("UsePBRShaders");
//PBR
@@ -439,7 +439,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState()
shadow_text->setEnabled(enabled);
// Hardware settings
-
+
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable"))
{
getChildView("vbo")->setEnabled(FALSE);
diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.h b/indra/newview/llfloaterpreferencesgraphicsadvanced.h
index 2c92f3dbf1..114a79a936 100644
--- a/indra/newview/llfloaterpreferencesgraphicsadvanced.h
+++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloaterpreferencesgraphicsadvanced.h
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,7 +34,7 @@ class LLTextBox;
class LLFloaterPreferenceGraphicsAdvanced : public LLFloater
{
-public:
+public:
LLFloaterPreferenceGraphicsAdvanced(const LLSD& key);
~LLFloaterPreferenceGraphicsAdvanced();
/*virtual*/ BOOL postBuild();
@@ -56,12 +56,12 @@ public:
void onAdvancedAtmosphericsEnable();
LOG_CLASS(LLFloaterPreferenceGraphicsAdvanced);
-protected:
- void onBtnOK(const LLSD& userdata);
- void onBtnCancel(const LLSD& userdata);
+protected:
+ void onBtnOK(const LLSD& userdata);
+ void onBtnCancel(const LLSD& userdata);
- boost::signals2::connection mComplexityChangedSignal;
- boost::signals2::connection mLODFactorChangedSignal;
+ boost::signals2::connection mComplexityChangedSignal;
+ boost::signals2::connection mLODFactorChangedSignal;
};
#endif //LLFLOATERPREFERENCEGRAPHICSADVANCED_H
diff --git a/indra/newview/llfloaterpreferenceviewadvanced.cpp b/indra/newview/llfloaterpreferenceviewadvanced.cpp
index f8db738923..3481397daa 100644
--- a/indra/newview/llfloaterpreferenceviewadvanced.cpp
+++ b/indra/newview/llfloaterpreferenceviewadvanced.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterpreferenceviewadvanced.cpp
* @brief floater for adjusting camera position
*
* $LicenseInfo:firstyear=2018&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2018, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,10 +34,10 @@
#include "llviewercontrol.h"
-LLFloaterPreferenceViewAdvanced::LLFloaterPreferenceViewAdvanced(const LLSD& key)
-: LLFloater(key)
+LLFloaterPreferenceViewAdvanced::LLFloaterPreferenceViewAdvanced(const LLSD& key)
+: LLFloater(key)
{
- mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceViewAdvanced::onCommitSettings, this));
+ mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceViewAdvanced::onCommitSettings, this));
}
LLFloaterPreferenceViewAdvanced::~LLFloaterPreferenceViewAdvanced()
@@ -45,38 +45,38 @@ LLFloaterPreferenceViewAdvanced::~LLFloaterPreferenceViewAdvanced()
void LLFloaterPreferenceViewAdvanced::updateCameraControl(const LLVector3& vector)
{
- getChild<LLSpinCtrl>("camera_x")->setValue(vector[VX]);
- getChild<LLSpinCtrl>("camera_y")->setValue(vector[VY]);
- getChild<LLSpinCtrl>("camera_z")->setValue(vector[VZ]);
+ getChild<LLSpinCtrl>("camera_x")->setValue(vector[VX]);
+ getChild<LLSpinCtrl>("camera_y")->setValue(vector[VY]);
+ getChild<LLSpinCtrl>("camera_z")->setValue(vector[VZ]);
}
void LLFloaterPreferenceViewAdvanced::updateFocusControl(const LLVector3d& vector3d)
{
- getChild<LLSpinCtrl>("focus_x")->setValue(vector3d[VX]);
- getChild<LLSpinCtrl>("focus_y")->setValue(vector3d[VY]);
- getChild<LLSpinCtrl>("focus_z")->setValue(vector3d[VZ]);
+ getChild<LLSpinCtrl>("focus_x")->setValue(vector3d[VX]);
+ getChild<LLSpinCtrl>("focus_y")->setValue(vector3d[VY]);
+ getChild<LLSpinCtrl>("focus_z")->setValue(vector3d[VZ]);
}
void LLFloaterPreferenceViewAdvanced::draw()
{
- updateCameraControl(gAgentCamera.getCameraOffsetInitial());
- updateFocusControl(gAgentCamera.getFocusOffsetInitial());
+ updateCameraControl(gAgentCamera.getCameraOffsetInitial());
+ updateFocusControl(gAgentCamera.getFocusOffsetInitial());
- LLFloater::draw();
+ LLFloater::draw();
}
void LLFloaterPreferenceViewAdvanced::onCommitSettings()
{
- LLVector3 vector;
- LLVector3d vector3d;
+ LLVector3 vector;
+ LLVector3d vector3d;
- vector.mV[VX] = (F32)getChild<LLUICtrl>("camera_x")->getValue().asReal();
- vector.mV[VY] = (F32)getChild<LLUICtrl>("camera_y")->getValue().asReal();
- vector.mV[VZ] = (F32)getChild<LLUICtrl>("camera_z")->getValue().asReal();
- gSavedSettings.setVector3("CameraOffsetRearView", vector);
+ vector.mV[VX] = (F32)getChild<LLUICtrl>("camera_x")->getValue().asReal();
+ vector.mV[VY] = (F32)getChild<LLUICtrl>("camera_y")->getValue().asReal();
+ vector.mV[VZ] = (F32)getChild<LLUICtrl>("camera_z")->getValue().asReal();
+ gSavedSettings.setVector3("CameraOffsetRearView", vector);
- vector3d.mdV[VX] = (F32)getChild<LLUICtrl>("focus_x")->getValue().asReal();
- vector3d.mdV[VY] = (F32)getChild<LLUICtrl>("focus_y")->getValue().asReal();
- vector3d.mdV[VZ] = (F32)getChild<LLUICtrl>("focus_z")->getValue().asReal();
- gSavedSettings.setVector3d("FocusOffsetRearView", vector3d);
+ vector3d.mdV[VX] = (F32)getChild<LLUICtrl>("focus_x")->getValue().asReal();
+ vector3d.mdV[VY] = (F32)getChild<LLUICtrl>("focus_y")->getValue().asReal();
+ vector3d.mdV[VZ] = (F32)getChild<LLUICtrl>("focus_z")->getValue().asReal();
+ gSavedSettings.setVector3d("FocusOffsetRearView", vector3d);
}
diff --git a/indra/newview/llfloaterpreferenceviewadvanced.h b/indra/newview/llfloaterpreferenceviewadvanced.h
index 4619fdaab1..06305fedab 100644
--- a/indra/newview/llfloaterpreferenceviewadvanced.h
+++ b/indra/newview/llfloaterpreferenceviewadvanced.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterpreferenceviewadvanced.h
* @brief floater for adjusting camera position
*
* $LicenseInfo:firstyear=2018&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2018, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,20 +31,20 @@
#include "llfloater.h"
class LLFloaterPreferenceViewAdvanced
-: public LLFloater
+: public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- LLFloaterPreferenceViewAdvanced(const LLSD& key);
- virtual void draw();
+ LLFloaterPreferenceViewAdvanced(const LLSD& key);
+ virtual void draw();
- void onCommitSettings();
- void updateCameraControl(const LLVector3& vector);
- void updateFocusControl(const LLVector3d& vector3d);
+ void onCommitSettings();
+ void updateCameraControl(const LLVector3& vector);
+ void updateFocusControl(const LLVector3d& vector3d);
private:
- virtual ~LLFloaterPreferenceViewAdvanced();
+ virtual ~LLFloaterPreferenceViewAdvanced();
};
#endif //LLFLOATERPREFERENCEVIEWADVANCED_H
diff --git a/indra/newview/llfloaterpreviewtrash.cpp b/indra/newview/llfloaterpreviewtrash.cpp
index cf4e3f04e6..af33e43109 100644
--- a/indra/newview/llfloaterpreviewtrash.cpp
+++ b/indra/newview/llfloaterpreviewtrash.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpreviewtrash.cpp
* @author AndreyK Productengine
* @brief LLFloaterPreviewTrash class implementation
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
#include "llfloaterreg.h"
LLFloaterPreviewTrash::LLFloaterPreviewTrash(const LLSD& key)
-: LLFloater(key)
+: LLFloater(key)
{
}
@@ -43,13 +43,13 @@ BOOL LLFloaterPreviewTrash::postBuild()
boost::bind(&LLFloaterPreviewTrash::onClickEmpty, this));
getChild<LLUICtrl>("cancel_btn")->setCommitCallback(
boost::bind(&LLFloaterPreviewTrash::onClickCancel, this));
- // Always center the dialog. User can change the size,
- // but purchases are important and should be center screen.
- // This also avoids problems where the user resizes the application window
- // mid-session and the saved rect is off-center.
- center();
-
- return TRUE;
+ // Always center the dialog. User can change the size,
+ // but purchases are important and should be center screen.
+ // This also avoids problems where the user resizes the application window
+ // mid-session and the saved rect is off-center.
+ center();
+
+ return TRUE;
}
LLFloaterPreviewTrash::~LLFloaterPreviewTrash()
@@ -60,23 +60,23 @@ LLFloaterPreviewTrash::~LLFloaterPreviewTrash()
// static
void LLFloaterPreviewTrash::show()
{
- LLFloaterReg::showTypedInstance<LLFloaterPreviewTrash>("preview_trash", LLSD(), TRUE);
+ LLFloaterReg::showTypedInstance<LLFloaterPreviewTrash>("preview_trash", LLSD(), TRUE);
}
// static
bool LLFloaterPreviewTrash::isVisible()
{
- return LLFloaterReg::instanceVisible("preview_trash");
+ return LLFloaterReg::instanceVisible("preview_trash");
}
void LLFloaterPreviewTrash::onClickEmpty()
{
- gInventory.emptyFolderType("PurgeSelectedItems", LLFolderType::FT_TRASH);
- closeFloater();
+ gInventory.emptyFolderType("PurgeSelectedItems", LLFolderType::FT_TRASH);
+ closeFloater();
}
void LLFloaterPreviewTrash::onClickCancel()
{
- closeFloater();
+ closeFloater();
}
diff --git a/indra/newview/llfloaterpreviewtrash.h b/indra/newview/llfloaterpreviewtrash.h
index 465c0c677f..7d130077c5 100644
--- a/indra/newview/llfloaterpreviewtrash.h
+++ b/indra/newview/llfloaterpreviewtrash.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterpreviewtrash.h
* @author AndreyK Productengine
* @brief LLFloaterPreviewTrash class header file
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,16 +34,16 @@ class LLFloaterPreviewTrash
: public LLFloater
{
public:
- static void show();
- static bool isVisible();
+ static void show();
+ static bool isVisible();
+
+ LLFloaterPreviewTrash(const LLSD& key);
+ ~LLFloaterPreviewTrash();
+ /*virtual*/ BOOL postBuild();
- LLFloaterPreviewTrash(const LLSD& key);
- ~LLFloaterPreviewTrash();
- /*virtual*/ BOOL postBuild();
-
protected:
- void onClickEmpty();
- void onClickCancel();
+ void onClickEmpty();
+ void onClickCancel();
};
#endif
diff --git a/indra/newview/llfloaterprofile.cpp b/indra/newview/llfloaterprofile.cpp
index 6ccdace6c5..8df42a4faa 100644
--- a/indra/newview/llfloaterprofile.cpp
+++ b/indra/newview/llfloaterprofile.cpp
@@ -40,7 +40,7 @@ LLFloaterProfile::LLFloaterProfile(const LLSD& key)
mAvatarId(key["id"].asUUID()),
mNameCallbackConnection()
{
- mDefaultRectForGroup = false;
+ mDefaultRectForGroup = false;
}
LLFloaterProfile::~LLFloaterProfile()
diff --git a/indra/newview/llfloaterprofiletexture.cpp b/indra/newview/llfloaterprofiletexture.cpp
index ec2e627165..8b36072034 100644
--- a/indra/newview/llfloaterprofiletexture.cpp
+++ b/indra/newview/llfloaterprofiletexture.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterprofiletexture.cpp
* @brief LLFloaterProfileTexture class implementation
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -70,13 +70,13 @@ BOOL LLFloaterProfileTexture::postBuild()
mCloseButton = getChild<LLButton>("close_btn");
mCloseButton->setCommitCallback([this](LLUICtrl*, void*) { closeFloater(); }, nullptr);
- return TRUE;
+ return TRUE;
}
// virtual
void LLFloaterProfileTexture::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- LLFloater::reshape(width, height, called_from_parent);
+ LLFloater::reshape(width, height, called_from_parent);
}
// It takes a while until we get height and width information.
diff --git a/indra/newview/llfloaterprofiletexture.h b/indra/newview/llfloaterprofiletexture.h
index 66a61213dd..e0ec0b16ef 100644
--- a/indra/newview/llfloaterprofiletexture.h
+++ b/indra/newview/llfloaterprofiletexture.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterprofiletexture.h
* @brief LLFloaterProfileTexture class definition
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp
index e817589622..afcd07f1ec 100644
--- a/indra/newview/llfloaterregiondebugconsole.cpp
+++ b/indra/newview/llfloaterregiondebugconsole.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterregiondebugconsole.h
* @author Brad Kittenbrink <brad@lindenlab.com>
* @brief Quick and dirty console for region debug settings
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,117 +56,117 @@
namespace
{
- // Signal used to notify the floater of responses from the asynchronous
- // API.
- console_reply_signal_t sConsoleReplySignal;
-
- const std::string PROMPT("\n\n> ");
- const std::string UNABLE_TO_SEND_COMMAND(
- "ERROR: The last command was not received by the server.");
- const std::string CONSOLE_UNAVAILABLE(
- "ERROR: No console available for this region/simulator.");
- const std::string CONSOLE_NOT_SUPPORTED(
- "This region does not support the simulator console.");
-
- // This handles responses for console commands sent via the asynchronous
- // API.
- class ConsoleResponseNode : public LLHTTPNode
- {
- public:
- /* virtual */
- void post(
- LLHTTPNode::ResponsePtr reponse,
- const LLSD& context,
- const LLSD& input) const
- {
- LL_INFOS() << "Received response from the debug console: "
- << input << LL_ENDL;
- sConsoleReplySignal(input["body"].asString());
- }
- };
+ // Signal used to notify the floater of responses from the asynchronous
+ // API.
+ console_reply_signal_t sConsoleReplySignal;
+
+ const std::string PROMPT("\n\n> ");
+ const std::string UNABLE_TO_SEND_COMMAND(
+ "ERROR: The last command was not received by the server.");
+ const std::string CONSOLE_UNAVAILABLE(
+ "ERROR: No console available for this region/simulator.");
+ const std::string CONSOLE_NOT_SUPPORTED(
+ "This region does not support the simulator console.");
+
+ // This handles responses for console commands sent via the asynchronous
+ // API.
+ class ConsoleResponseNode : public LLHTTPNode
+ {
+ public:
+ /* virtual */
+ void post(
+ LLHTTPNode::ResponsePtr reponse,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LL_INFOS() << "Received response from the debug console: "
+ << input << LL_ENDL;
+ sConsoleReplySignal(input["body"].asString());
+ }
+ };
}
boost::signals2::connection LLFloaterRegionDebugConsole::setConsoleReplyCallback(const console_reply_signal_t::slot_type& cb)
{
- return sConsoleReplySignal.connect(cb);
+ return sConsoleReplySignal.connect(cb);
}
LLFloaterRegionDebugConsole::LLFloaterRegionDebugConsole(LLSD const & key)
: LLFloater(key), mOutput(NULL)
{
- mReplySignalConnection = sConsoleReplySignal.connect(
- boost::bind(
- &LLFloaterRegionDebugConsole::onReplyReceived,
- this,
- _1));
+ mReplySignalConnection = sConsoleReplySignal.connect(
+ boost::bind(
+ &LLFloaterRegionDebugConsole::onReplyReceived,
+ this,
+ _1));
}
LLFloaterRegionDebugConsole::~LLFloaterRegionDebugConsole()
{
- mReplySignalConnection.disconnect();
+ mReplySignalConnection.disconnect();
}
BOOL LLFloaterRegionDebugConsole::postBuild()
{
- LLLineEditor* input = getChild<LLLineEditor>("region_debug_console_input");
- input->setEnableLineHistory(true);
- input->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2));
- input->setFocus(true);
- input->setCommitOnFocusLost(false);
-
- mOutput = getChild<LLTextEditor>("region_debug_console_output");
-
- std::string url = gAgent.getRegionCapability("SimConsoleAsync");
- if (url.empty())
- {
- // Fall back to see if the old API is supported.
- url = gAgent.getRegionCapability("SimConsole");
- if (url.empty())
- {
- mOutput->appendText(
- CONSOLE_NOT_SUPPORTED + PROMPT,
- false);
- return TRUE;
- }
- }
-
- mOutput->appendText("> ", false);
- return TRUE;
+ LLLineEditor* input = getChild<LLLineEditor>("region_debug_console_input");
+ input->setEnableLineHistory(true);
+ input->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2));
+ input->setFocus(true);
+ input->setCommitOnFocusLost(false);
+
+ mOutput = getChild<LLTextEditor>("region_debug_console_output");
+
+ std::string url = gAgent.getRegionCapability("SimConsoleAsync");
+ if (url.empty())
+ {
+ // Fall back to see if the old API is supported.
+ url = gAgent.getRegionCapability("SimConsole");
+ if (url.empty())
+ {
+ mOutput->appendText(
+ CONSOLE_NOT_SUPPORTED + PROMPT,
+ false);
+ return TRUE;
+ }
+ }
+
+ mOutput->appendText("> ", false);
+ return TRUE;
}
void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param)
{
- LLLineEditor* input = static_cast<LLLineEditor*>(ctrl);
- std::string text = input->getText() + "\n";
-
- std::string url = gAgent.getRegionCapability("SimConsoleAsync");
- if (url.empty())
- {
- // Fall back to the old API
- url = gAgent.getRegionCapability("SimConsole");
- if (url.empty())
- {
- text += CONSOLE_UNAVAILABLE + PROMPT;
- }
- else
- {
+ LLLineEditor* input = static_cast<LLLineEditor*>(ctrl);
+ std::string text = input->getText() + "\n";
+
+ std::string url = gAgent.getRegionCapability("SimConsoleAsync");
+ if (url.empty())
+ {
+ // Fall back to the old API
+ url = gAgent.getRegionCapability("SimConsole");
+ if (url.empty())
+ {
+ text += CONSOLE_UNAVAILABLE + PROMPT;
+ }
+ else
+ {
LLSD postData = LLSD(input->getText());
LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost(url, postData,
boost::bind(&LLFloaterRegionDebugConsole::onConsoleSuccess, this, _1),
boost::bind(&LLFloaterRegionDebugConsole::onConsoleError, this, _1));
- }
- }
- else
- {
+ }
+ }
+ else
+ {
LLSD postData = LLSD(input->getText());
LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost(url, postData,
NULL,
boost::bind(&LLFloaterRegionDebugConsole::onAsyncConsoleError, this, _1));
- }
+ }
- mOutput->appendText(text, false);
- input->clear();
+ mOutput->appendText(text, false);
+ input->clear();
}
void LLFloaterRegionDebugConsole::onAsyncConsoleError(LLSD result)
@@ -203,9 +203,9 @@ void LLFloaterRegionDebugConsole::onConsoleSuccess(LLSD result)
void LLFloaterRegionDebugConsole::onReplyReceived(const std::string& output)
{
- mOutput->appendText(output + PROMPT, false);
+ mOutput->appendText(output + PROMPT, false);
}
LLHTTPRegistration<ConsoleResponseNode>
- gHTTPRegistrationMessageDebugConsoleResponse(
- "/message/SimConsoleResponse");
+ gHTTPRegistrationMessageDebugConsoleResponse(
+ "/message/SimConsoleResponse");
diff --git a/indra/newview/llfloaterregiondebugconsole.h b/indra/newview/llfloaterregiondebugconsole.h
index f55d964924..e7dc0f3a5f 100644
--- a/indra/newview/llfloaterregiondebugconsole.h
+++ b/indra/newview/llfloaterregiondebugconsole.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterregiondebugconsole.h
* @author Brad Kittenbrink <brad@lindenlab.com>
* @brief Quick and dirty console for region debug settings
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,31 +35,31 @@
class LLTextEditor;
typedef boost::signals2::signal<
- void (const std::string& output)> console_reply_signal_t;
+ void (const std::string& output)> console_reply_signal_t;
class LLFloaterRegionDebugConsole : public LLFloater
{
public:
- LLFloaterRegionDebugConsole(LLSD const & key);
- virtual ~LLFloaterRegionDebugConsole();
+ LLFloaterRegionDebugConsole(LLSD const & key);
+ virtual ~LLFloaterRegionDebugConsole();
+
+ // virtual
+ BOOL postBuild();
- // virtual
- BOOL postBuild();
-
- void onInput(LLUICtrl* ctrl, const LLSD& param);
+ void onInput(LLUICtrl* ctrl, const LLSD& param);
- LLTextEditor * mOutput;
+ LLTextEditor * mOutput;
- static boost::signals2::connection setConsoleReplyCallback(const console_reply_signal_t::slot_type& cb);
+ static boost::signals2::connection setConsoleReplyCallback(const console_reply_signal_t::slot_type& cb);
private:
- void onReplyReceived(const std::string& output);
+ void onReplyReceived(const std::string& output);
void onAsyncConsoleError(LLSD result);
void onConsoleError(LLSD result);
void onConsoleSuccess(LLSD result);
- boost::signals2::connection mReplySignalConnection;
+ boost::signals2::connection mReplySignalConnection;
};
#endif // LL_LLFLOATERREGIONDEBUGCONSOLE_H
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 187ac9d323..ef81cb549f 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterregioninfo.cpp
* @author Aaron Brashears
* @brief Implementation of the region info and controls floater and panels.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,13 +50,13 @@
#include "llavataractions.h"
#include "llavatarname.h"
#include "llfloateravatarpicker.h"
-#include "llbutton.h"
+#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "llclipboard.h"
#include "llcombobox.h"
#include "llestateinfomodel.h"
#include "llfilepicker.h"
-#include "llfloatergodtools.h" // for send_sim_wide_deletes()
+#include "llfloatergodtools.h" // for send_sim_wide_deletes()
#include "llfloatertopobjects.h" // added to fix SL-32336
#include "llfloatergroups.h"
#include "llfloaterreg.h"
@@ -114,70 +114,70 @@ const U32 MAX_LISTED_NAMES = 100;
class LLDispatchEstateUpdateInfo : public LLDispatchHandler
{
public:
- LLDispatchEstateUpdateInfo() {}
- virtual ~LLDispatchEstateUpdateInfo() {}
- virtual bool operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings);
+ LLDispatchEstateUpdateInfo() {}
+ virtual ~LLDispatchEstateUpdateInfo() {}
+ virtual bool operator()(
+ const LLDispatcher* dispatcher,
+ const std::string& key,
+ const LLUUID& invoice,
+ const sparam_t& strings);
};
class LLDispatchSetEstateAccess : public LLDispatchHandler
{
public:
- LLDispatchSetEstateAccess() {}
- virtual ~LLDispatchSetEstateAccess() {}
- virtual bool operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings);
+ LLDispatchSetEstateAccess() {}
+ virtual ~LLDispatchSetEstateAccess() {}
+ virtual bool operator()(
+ const LLDispatcher* dispatcher,
+ const std::string& key,
+ const LLUUID& invoice,
+ const sparam_t& strings);
};
class LLDispatchSetEstateExperience : public LLDispatchHandler
{
public:
- virtual bool operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings);
+ virtual bool operator()(
+ const LLDispatcher* dispatcher,
+ const std::string& key,
+ const LLUUID& invoice,
+ const sparam_t& strings);
- static LLSD getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count );
+ static LLSD getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count );
};
/*
void unpack_request_params(
- LLMessageSystem* msg,
- LLDispatcher::sparam_t& strings,
- LLDispatcher::iparam_t& integers)
-{
- char str_buf[MAX_STRING];
- S32 str_count = msg->getNumberOfBlocksFast(_PREHASH_StringData);
- S32 i;
- for (i = 0; i < str_count; ++i)
- {
- // we treat the SParam as binary data (since it might be an
- // LLUUID in compressed form which may have embedded \0's,)
- str_buf[0] = '\0';
- S32 data_size = msg->getSizeFast(_PREHASH_StringData, i, _PREHASH_SParam);
- if (data_size >= 0)
- {
- msg->getBinaryDataFast(_PREHASH_StringData, _PREHASH_SParam,
- str_buf, data_size, i, MAX_STRING - 1);
- strings.push_back(std::string(str_buf, data_size));
- }
- }
-
- U32 int_buf;
- S32 int_count = msg->getNumberOfBlocksFast(_PREHASH_IntegerData);
- for (i = 0; i < int_count; ++i)
- {
- msg->getU32("IntegerData", "IParam", int_buf, i);
- integers.push_back(int_buf);
- }
+ LLMessageSystem* msg,
+ LLDispatcher::sparam_t& strings,
+ LLDispatcher::iparam_t& integers)
+{
+ char str_buf[MAX_STRING];
+ S32 str_count = msg->getNumberOfBlocksFast(_PREHASH_StringData);
+ S32 i;
+ for (i = 0; i < str_count; ++i)
+ {
+ // we treat the SParam as binary data (since it might be an
+ // LLUUID in compressed form which may have embedded \0's,)
+ str_buf[0] = '\0';
+ S32 data_size = msg->getSizeFast(_PREHASH_StringData, i, _PREHASH_SParam);
+ if (data_size >= 0)
+ {
+ msg->getBinaryDataFast(_PREHASH_StringData, _PREHASH_SParam,
+ str_buf, data_size, i, MAX_STRING - 1);
+ strings.push_back(std::string(str_buf, data_size));
+ }
+ }
+
+ U32 int_buf;
+ S32 int_count = msg->getNumberOfBlocksFast(_PREHASH_IntegerData);
+ for (i = 0; i < int_count; ++i)
+ {
+ msg->getU32("IntegerData", "IParam", int_buf, i);
+ integers.push_back(int_buf);
+ }
}
*/
@@ -229,75 +229,75 @@ LLUUID LLFloaterRegionInfo::sRequestInvoice;
LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed)
- : LLFloater(seed),
+ : LLFloater(seed),
mEnvironmentPanel(NULL),
mRegionChangedCallback()
{}
BOOL LLFloaterRegionInfo::postBuild()
{
- mTab = getChild<LLTabContainer>("region_panels");
- mTab->setCommitCallback(boost::bind(&LLFloaterRegionInfo::onTabSelected, this, _2));
-
- // contruct the panels
- LLPanelRegionInfo* panel;
- panel = new LLPanelEstateInfo;
- mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_estate.xml");
- mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true));
-
- panel = new LLPanelEstateAccess;
- mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_access.xml");
- mTab->addTabPanel(panel);
-
- panel = new LLPanelEstateCovenant;
- mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_covenant.xml");
- mTab->addTabPanel(panel);
-
- panel = new LLPanelRegionGeneralInfo;
- mInfoPanels.push_back(panel);
- panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel));
- panel->buildFromFile("panel_region_general.xml");
- mTab->addTabPanel(panel);
-
- panel = new LLPanelRegionTerrainInfo;
- mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_terrain.xml");
- mTab->addTabPanel(panel);
+ mTab = getChild<LLTabContainer>("region_panels");
+ mTab->setCommitCallback(boost::bind(&LLFloaterRegionInfo::onTabSelected, this, _2));
+
+ // contruct the panels
+ LLPanelRegionInfo* panel;
+ panel = new LLPanelEstateInfo;
+ mInfoPanels.push_back(panel);
+ panel->buildFromFile("panel_region_estate.xml");
+ mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true));
+
+ panel = new LLPanelEstateAccess;
+ mInfoPanels.push_back(panel);
+ panel->buildFromFile("panel_region_access.xml");
+ mTab->addTabPanel(panel);
+
+ panel = new LLPanelEstateCovenant;
+ mInfoPanels.push_back(panel);
+ panel->buildFromFile("panel_region_covenant.xml");
+ mTab->addTabPanel(panel);
+
+ panel = new LLPanelRegionGeneralInfo;
+ mInfoPanels.push_back(panel);
+ panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel));
+ panel->buildFromFile("panel_region_general.xml");
+ mTab->addTabPanel(panel);
+
+ panel = new LLPanelRegionTerrainInfo;
+ mInfoPanels.push_back(panel);
+ panel->buildFromFile("panel_region_terrain.xml");
+ mTab->addTabPanel(panel);
mEnvironmentPanel = new LLPanelRegionEnvironment;
mEnvironmentPanel->buildFromFile("panel_region_environment.xml");
// mEnvironmentPanel->configureForRegion();
mTab->addTabPanel(mEnvironmentPanel);
- panel = new LLPanelRegionDebugInfo;
- mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_debug.xml");
- mTab->addTabPanel(panel);
+ panel = new LLPanelRegionDebugInfo;
+ mInfoPanels.push_back(panel);
+ panel->buildFromFile("panel_region_debug.xml");
+ mTab->addTabPanel(panel);
- if(gDisconnected)
- {
- return TRUE;
- }
+ if(gDisconnected)
+ {
+ return TRUE;
+ }
+
+ if(!gAgent.getRegionCapability("RegionExperiences").empty())
+ {
+ panel = new LLPanelRegionExperiences;
+ mInfoPanels.push_back(panel);
+ panel->buildFromFile("panel_region_experiences.xml");
+ mTab->addTabPanel(panel);
+ }
- if(!gAgent.getRegionCapability("RegionExperiences").empty())
- {
- panel = new LLPanelRegionExperiences;
- mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_experiences.xml");
- mTab->addTabPanel(panel);
- }
-
- gMessageSystem->setHandlerFunc(
- "EstateOwnerMessage",
- &processEstateOwnerRequest);
+ gMessageSystem->setHandlerFunc(
+ "EstateOwnerMessage",
+ &processEstateOwnerRequest);
- // Request region info when agent region changes.
- mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionInfo::onRegionChanged, this));
+ // Request region info when agent region changes.
+ mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionInfo::onRegionChanged, this));
- return TRUE;
+ return TRUE;
}
LLFloaterRegionInfo::~LLFloaterRegionInfo()
@@ -310,26 +310,26 @@ LLFloaterRegionInfo::~LLFloaterRegionInfo()
void LLFloaterRegionInfo::onOpen(const LLSD& key)
{
- if(gDisconnected)
- {
- disableTabCtrls();
- return;
- }
- refreshFromRegion(gAgent.getRegion());
- requestRegionInfo();
+ if(gDisconnected)
+ {
+ disableTabCtrls();
+ return;
+ }
+ refreshFromRegion(gAgent.getRegion());
+ requestRegionInfo();
- if (!mGodLevelChangeSlot.connected())
- {
- mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLFloaterRegionInfo::onGodLevelChange, this, _1));
- }
+ if (!mGodLevelChangeSlot.connected())
+ {
+ mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLFloaterRegionInfo::onGodLevelChange, this, _1));
+ }
}
void LLFloaterRegionInfo::onClose(bool app_quitting)
{
- if (mGodLevelChangeSlot.connected())
- {
- mGodLevelChangeSlot.disconnect();
- }
+ if (mGodLevelChangeSlot.connected())
+ {
+ mGodLevelChangeSlot.disconnect();
+ }
}
void LLFloaterRegionInfo::onRegionChanged()
@@ -343,356 +343,356 @@ void LLFloaterRegionInfo::onRegionChanged()
// static
void LLFloaterRegionInfo::requestRegionInfo()
{
- LLTabContainer* tab = findChild<LLTabContainer>("region_panels");
- if (tab)
- {
- tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
+ LLTabContainer* tab = findChild<LLTabContainer>("region_panels");
+ if (tab)
+ {
+ tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
tab->getChild<LLPanel>("Access")->setCtrlsEnabled(FALSE);
- }
+ }
- // Must allow anyone to request the RegionInfo data
- // so non-owners/non-gods can see the values.
- // Therefore can't use an EstateOwnerMessage JC
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("RequestRegionInfo");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- gAgent.sendReliableMessage();
+ // Must allow anyone to request the RegionInfo data
+ // so non-owners/non-gods can see the values.
+ // Therefore can't use an EstateOwnerMessage JC
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("RequestRegionInfo");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ gAgent.sendReliableMessage();
}
// static
void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**)
{
- static LLDispatcher dispatch;
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if(!floater)
- {
- return;
- }
-
- if (!estate_dispatch_initialized)
- {
- LLPanelEstateInfo::initDispatch(dispatch);
- }
-
- LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate();
-
- // unpack the message
- std::string request;
- LLUUID invoice;
- LLDispatcher::sparam_t strings;
- LLDispatcher::unpackMessage(msg, request, invoice, strings);
- if(invoice != getLastInvoice())
- {
- LL_WARNS() << "Mismatched Estate message: " << request << LL_ENDL;
- return;
- }
-
- //dispatch the message
- dispatch.dispatch(request, invoice, strings);
-
- if (panel)
- {
- panel->updateControls(gAgent.getRegion());
- }
+ static LLDispatcher dispatch;
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if(!floater)
+ {
+ return;
+ }
+
+ if (!estate_dispatch_initialized)
+ {
+ LLPanelEstateInfo::initDispatch(dispatch);
+ }
+
+ LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate();
+
+ // unpack the message
+ std::string request;
+ LLUUID invoice;
+ LLDispatcher::sparam_t strings;
+ LLDispatcher::unpackMessage(msg, request, invoice, strings);
+ if(invoice != getLastInvoice())
+ {
+ LL_WARNS() << "Mismatched Estate message: " << request << LL_ENDL;
+ return;
+ }
+
+ //dispatch the message
+ dispatch.dispatch(request, invoice, strings);
+
+ if (panel)
+ {
+ panel->updateControls(gAgent.getRegion());
+ }
}
// static
void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
{
- LLPanel* panel;
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if(!floater)
- {
- return;
- }
+ LLPanel* panel;
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if(!floater)
+ {
+ return;
+ }
#if 0
- // We need to re-request environment setting here,
- // otherwise after we apply (send) updated region settings we won't get them back,
- // so our environment won't be updated.
- // This is also the way to know about externally changed region environment.
- LLEnvManagerNew::instance().requestRegionSettings();
-#endif
- LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
-
- LLViewerRegion* region = gAgent.getRegion();
- BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
-
- // *TODO: Replace parsing msg with accessing the region info model.
- LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
-
- // extract message
- std::string sim_name;
- std::string sim_type = LLTrans::getString("land_type_unknown");
- U64 region_flags;
- U8 agent_limit;
- S32 hard_agent_limit;
- F32 object_bonus_factor;
- U8 sim_access;
- F32 water_height;
- F32 terrain_raise_limit;
- F32 terrain_lower_limit;
- BOOL use_estate_sun;
- F32 sun_hour;
- msg->getString("RegionInfo", "SimName", sim_name);
- msg->getU8("RegionInfo", "MaxAgents", agent_limit);
- msg->getS32("RegionInfo2", "HardMaxAgents", hard_agent_limit);
- msg->getF32("RegionInfo", "ObjectBonusFactor", object_bonus_factor);
- msg->getU8("RegionInfo", "SimAccess", sim_access);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, water_height);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, terrain_raise_limit);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, terrain_lower_limit);
- msg->getBOOL("RegionInfo", "UseEstateSun", use_estate_sun);
- // actually the "last set" sun hour, not the current sun hour. JC
- msg->getF32("RegionInfo", "SunHour", sun_hour);
- // the only reasonable way to decide if we actually have any data is to
- // check to see if any of these fields have nonzero sizes
- if (msg->getSize("RegionInfo2", "ProductSKU") > 0 ||
- msg->getSize("RegionInfo2", "ProductName") > 0)
- {
- msg->getString("RegionInfo2", "ProductName", sim_type);
- LLTrans::findString(sim_type, sim_type); // try localizing sim product name
- }
-
- if (msg->has(_PREHASH_RegionInfo3))
- {
- msg->getU64("RegionInfo3", "RegionFlagsExtended", region_flags);
- }
- else
- {
- U32 flags = 0;
- msg->getU32("RegionInfo", "RegionFlags", flags);
- region_flags = flags;
- }
-
- if (msg->has(_PREHASH_RegionInfo5))
- {
- F32 chat_whisper_range;
- F32 chat_normal_range;
- F32 chat_shout_range;
- F32 chat_whisper_offset;
- F32 chat_normal_offset;
- F32 chat_shout_offset;
- U32 chat_flags;
-
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperRange, chat_whisper_range);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalRange, chat_normal_range);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutRange, chat_shout_range);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperOffset, chat_whisper_offset);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalOffset, chat_normal_offset);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutOffset, chat_shout_offset);
- msg->getU32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatFlags, chat_flags);
-
- LL_INFOS() << "Whisper range: " << chat_whisper_range << " normal range: " << chat_normal_range << " shout range: " << chat_shout_range
- << " whisper offset: " << chat_whisper_offset << " normal offset: " << chat_normal_offset << " shout offset: " << chat_shout_offset
- << " chat flags: " << chat_flags << LL_ENDL;
- }
-
- // GENERAL PANEL
- panel = tab->getChild<LLPanel>("General");
- panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name));
- panel->getChild<LLUICtrl>("region_type")->setValue(LLSD(sim_type));
- panel->getChild<LLUICtrl>("version_channel_text")->setValue(gLastVersionChannel);
-
- panel->getChild<LLUICtrl>("block_terraform_check")->setValue((region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("block_fly_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLY) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("block_fly_over_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLYOVER) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("allow_damage_check")->setValue((region_flags & REGION_FLAGS_ALLOW_DAMAGE) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("restrict_pushobject")->setValue((region_flags & REGION_FLAGS_RESTRICT_PUSHOBJECT) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("allow_land_resell_check")->setValue((region_flags & REGION_FLAGS_BLOCK_LAND_RESELL) ? FALSE : TRUE );
- panel->getChild<LLUICtrl>("allow_parcel_changes_check")->setValue((region_flags & REGION_FLAGS_ALLOW_PARCEL_CHANGES) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("block_parcel_search_check")->setValue((region_flags & REGION_FLAGS_BLOCK_PARCEL_SEARCH) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("agent_limit_spin")->setValue(LLSD((F32)agent_limit) );
- panel->getChild<LLUICtrl>("object_bonus_spin")->setValue(LLSD(object_bonus_factor) );
- panel->getChild<LLUICtrl>("access_combo")->setValue(LLSD(sim_access) );
-
- panel->getChild<LLSpinCtrl>("agent_limit_spin")->setMaxValue(hard_agent_limit);
-
- LLPanelRegionGeneralInfo* panel_general = LLFloaterRegionInfo::getPanelGeneral();
- if (panel)
- {
- panel_general->setObjBonusFactor(object_bonus_factor);
- }
-
- // detect teen grid for maturity
-
- U32 parent_estate_id;
- msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id);
- BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that
- panel->getChildView("access_combo")->setEnabled(gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid));
- panel->setCtrlsEnabled(allow_modify);
-
-
- // DEBUG PANEL
- panel = tab->getChild<LLPanel>("Debug");
-
- panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name) );
- panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_SCRIPTS) ? TRUE : FALSE )) );
- panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_COLLISIONS) ? TRUE : FALSE )) );
- panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_PHYSICS) ? TRUE : FALSE )) );
- panel->setCtrlsEnabled(allow_modify);
-
- // TERRAIN PANEL
- panel = tab->getChild<LLPanel>("Terrain");
-
- panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name));
- panel->getChild<LLUICtrl>("water_height_spin")->setValue(region_info.mWaterHeight);
- panel->getChild<LLUICtrl>("terrain_raise_spin")->setValue(region_info.mTerrainRaiseLimit);
- panel->getChild<LLUICtrl>("terrain_lower_spin")->setValue(region_info.mTerrainLowerLimit);
-
- panel->setCtrlsEnabled(allow_modify);
-
- if (floater->getVisible())
- {
- // Note: region info also causes LLRegionInfoModel::instance().update(msg); -> requestRegion(); -> changed message
- // we need to know env version here and in update(msg) to know when to request and when not to, when to filter 'changed'
- floater->refreshFromRegion(gAgent.getRegion());
- } // else will rerequest on onOpen either way
+ // We need to re-request environment setting here,
+ // otherwise after we apply (send) updated region settings we won't get them back,
+ // so our environment won't be updated.
+ // This is also the way to know about externally changed region environment.
+ LLEnvManagerNew::instance().requestRegionSettings();
+#endif
+ LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
+
+ LLViewerRegion* region = gAgent.getRegion();
+ BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
+
+ // *TODO: Replace parsing msg with accessing the region info model.
+ LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
+
+ // extract message
+ std::string sim_name;
+ std::string sim_type = LLTrans::getString("land_type_unknown");
+ U64 region_flags;
+ U8 agent_limit;
+ S32 hard_agent_limit;
+ F32 object_bonus_factor;
+ U8 sim_access;
+ F32 water_height;
+ F32 terrain_raise_limit;
+ F32 terrain_lower_limit;
+ BOOL use_estate_sun;
+ F32 sun_hour;
+ msg->getString("RegionInfo", "SimName", sim_name);
+ msg->getU8("RegionInfo", "MaxAgents", agent_limit);
+ msg->getS32("RegionInfo2", "HardMaxAgents", hard_agent_limit);
+ msg->getF32("RegionInfo", "ObjectBonusFactor", object_bonus_factor);
+ msg->getU8("RegionInfo", "SimAccess", sim_access);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, water_height);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, terrain_raise_limit);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, terrain_lower_limit);
+ msg->getBOOL("RegionInfo", "UseEstateSun", use_estate_sun);
+ // actually the "last set" sun hour, not the current sun hour. JC
+ msg->getF32("RegionInfo", "SunHour", sun_hour);
+ // the only reasonable way to decide if we actually have any data is to
+ // check to see if any of these fields have nonzero sizes
+ if (msg->getSize("RegionInfo2", "ProductSKU") > 0 ||
+ msg->getSize("RegionInfo2", "ProductName") > 0)
+ {
+ msg->getString("RegionInfo2", "ProductName", sim_type);
+ LLTrans::findString(sim_type, sim_type); // try localizing sim product name
+ }
+
+ if (msg->has(_PREHASH_RegionInfo3))
+ {
+ msg->getU64("RegionInfo3", "RegionFlagsExtended", region_flags);
+ }
+ else
+ {
+ U32 flags = 0;
+ msg->getU32("RegionInfo", "RegionFlags", flags);
+ region_flags = flags;
+ }
+
+ if (msg->has(_PREHASH_RegionInfo5))
+ {
+ F32 chat_whisper_range;
+ F32 chat_normal_range;
+ F32 chat_shout_range;
+ F32 chat_whisper_offset;
+ F32 chat_normal_offset;
+ F32 chat_shout_offset;
+ U32 chat_flags;
+
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperRange, chat_whisper_range);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalRange, chat_normal_range);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutRange, chat_shout_range);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperOffset, chat_whisper_offset);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalOffset, chat_normal_offset);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutOffset, chat_shout_offset);
+ msg->getU32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatFlags, chat_flags);
+
+ LL_INFOS() << "Whisper range: " << chat_whisper_range << " normal range: " << chat_normal_range << " shout range: " << chat_shout_range
+ << " whisper offset: " << chat_whisper_offset << " normal offset: " << chat_normal_offset << " shout offset: " << chat_shout_offset
+ << " chat flags: " << chat_flags << LL_ENDL;
+ }
+
+ // GENERAL PANEL
+ panel = tab->getChild<LLPanel>("General");
+ panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name));
+ panel->getChild<LLUICtrl>("region_type")->setValue(LLSD(sim_type));
+ panel->getChild<LLUICtrl>("version_channel_text")->setValue(gLastVersionChannel);
+
+ panel->getChild<LLUICtrl>("block_terraform_check")->setValue((region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE );
+ panel->getChild<LLUICtrl>("block_fly_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLY) ? TRUE : FALSE );
+ panel->getChild<LLUICtrl>("block_fly_over_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLYOVER) ? TRUE : FALSE );
+ panel->getChild<LLUICtrl>("allow_damage_check")->setValue((region_flags & REGION_FLAGS_ALLOW_DAMAGE) ? TRUE : FALSE );
+ panel->getChild<LLUICtrl>("restrict_pushobject")->setValue((region_flags & REGION_FLAGS_RESTRICT_PUSHOBJECT) ? TRUE : FALSE );
+ panel->getChild<LLUICtrl>("allow_land_resell_check")->setValue((region_flags & REGION_FLAGS_BLOCK_LAND_RESELL) ? FALSE : TRUE );
+ panel->getChild<LLUICtrl>("allow_parcel_changes_check")->setValue((region_flags & REGION_FLAGS_ALLOW_PARCEL_CHANGES) ? TRUE : FALSE );
+ panel->getChild<LLUICtrl>("block_parcel_search_check")->setValue((region_flags & REGION_FLAGS_BLOCK_PARCEL_SEARCH) ? TRUE : FALSE );
+ panel->getChild<LLUICtrl>("agent_limit_spin")->setValue(LLSD((F32)agent_limit) );
+ panel->getChild<LLUICtrl>("object_bonus_spin")->setValue(LLSD(object_bonus_factor) );
+ panel->getChild<LLUICtrl>("access_combo")->setValue(LLSD(sim_access) );
+
+ panel->getChild<LLSpinCtrl>("agent_limit_spin")->setMaxValue(hard_agent_limit);
+
+ LLPanelRegionGeneralInfo* panel_general = LLFloaterRegionInfo::getPanelGeneral();
+ if (panel)
+ {
+ panel_general->setObjBonusFactor(object_bonus_factor);
+ }
+
+ // detect teen grid for maturity
+
+ U32 parent_estate_id;
+ msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id);
+ BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that
+ panel->getChildView("access_combo")->setEnabled(gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid));
+ panel->setCtrlsEnabled(allow_modify);
+
+
+ // DEBUG PANEL
+ panel = tab->getChild<LLPanel>("Debug");
+
+ panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name) );
+ panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_SCRIPTS) ? TRUE : FALSE )) );
+ panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_COLLISIONS) ? TRUE : FALSE )) );
+ panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_PHYSICS) ? TRUE : FALSE )) );
+ panel->setCtrlsEnabled(allow_modify);
+
+ // TERRAIN PANEL
+ panel = tab->getChild<LLPanel>("Terrain");
+
+ panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name));
+ panel->getChild<LLUICtrl>("water_height_spin")->setValue(region_info.mWaterHeight);
+ panel->getChild<LLUICtrl>("terrain_raise_spin")->setValue(region_info.mTerrainRaiseLimit);
+ panel->getChild<LLUICtrl>("terrain_lower_spin")->setValue(region_info.mTerrainLowerLimit);
+
+ panel->setCtrlsEnabled(allow_modify);
+
+ if (floater->getVisible())
+ {
+ // Note: region info also causes LLRegionInfoModel::instance().update(msg); -> requestRegion(); -> changed message
+ // we need to know env version here and in update(msg) to know when to request and when not to, when to filter 'changed'
+ floater->refreshFromRegion(gAgent.getRegion());
+ } // else will rerequest on onOpen either way
}
// static
LLPanelEstateInfo* LLFloaterRegionInfo::getPanelEstate()
{
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if (!floater) return NULL;
- LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
- LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate");
- return panel;
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if (!floater) return NULL;
+ LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
+ LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate");
+ return panel;
}
// static
LLPanelEstateAccess* LLFloaterRegionInfo::getPanelAccess()
{
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if (!floater) return NULL;
- LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
- LLPanelEstateAccess* panel = (LLPanelEstateAccess*)tab->getChild<LLPanel>("Access");
- return panel;
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if (!floater) return NULL;
+ LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
+ LLPanelEstateAccess* panel = (LLPanelEstateAccess*)tab->getChild<LLPanel>("Access");
+ return panel;
}
// static
LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant()
{
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if (!floater) return NULL;
- LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
- LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)tab->getChild<LLPanel>("Covenant");
- return panel;
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if (!floater) return NULL;
+ LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
+ LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)tab->getChild<LLPanel>("Covenant");
+ return panel;
}
// static
LLPanelRegionGeneralInfo* LLFloaterRegionInfo::getPanelGeneral()
{
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if (!floater) return NULL;
- LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
- LLPanelRegionGeneralInfo* panel = (LLPanelRegionGeneralInfo*)tab->getChild<LLPanel>("General");
- return panel;
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if (!floater) return NULL;
+ LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
+ LLPanelRegionGeneralInfo* panel = (LLPanelRegionGeneralInfo*)tab->getChild<LLPanel>("General");
+ return panel;
}
// static
LLPanelRegionEnvironment* LLFloaterRegionInfo::getPanelEnvironment()
{
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if (!floater) return NULL;
- LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
- LLPanelRegionEnvironment* panel = (LLPanelRegionEnvironment*)tab->getChild<LLPanel>("panel_env_info");
- return panel;
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if (!floater) return NULL;
+ LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
+ LLPanelRegionEnvironment* panel = (LLPanelRegionEnvironment*)tab->getChild<LLPanel>("panel_env_info");
+ return panel;
}
// static
LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain()
{
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if (!floater)
- {
- llassert(floater);
- return NULL;
- }
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if (!floater)
+ {
+ llassert(floater);
+ return NULL;
+ }
- LLTabContainer* tab_container = floater->getChild<LLTabContainer>("region_panels");
- LLPanelRegionTerrainInfo* panel =
- dynamic_cast<LLPanelRegionTerrainInfo*>(tab_container->getChild<LLPanel>("Terrain"));
- llassert(panel);
- return panel;
+ LLTabContainer* tab_container = floater->getChild<LLTabContainer>("region_panels");
+ LLPanelRegionTerrainInfo* panel =
+ dynamic_cast<LLPanelRegionTerrainInfo*>(tab_container->getChild<LLPanel>("Terrain"));
+ llassert(panel);
+ return panel;
}
LLPanelRegionExperiences* LLFloaterRegionInfo::getPanelExperiences()
{
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if (!floater) return NULL;
- LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
- return (LLPanelRegionExperiences*)tab->getChild<LLPanel>("Experiences");
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if (!floater) return NULL;
+ LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
+ return (LLPanelRegionExperiences*)tab->getChild<LLPanel>("Experiences");
}
void LLFloaterRegionInfo::disableTabCtrls()
{
- LLTabContainer* tab = getChild<LLTabContainer>("region_panels");
+ LLTabContainer* tab = getChild<LLTabContainer>("region_panels");
- tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("panel_env_info")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Access")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("panel_env_info")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Access")->setCtrlsEnabled(FALSE);
}
void LLFloaterRegionInfo::onTabSelected(const LLSD& param)
{
- LLPanel* active_panel = getChild<LLPanel>(param.asString());
- active_panel->onOpen(LLSD());
+ LLPanel* active_panel = getChild<LLPanel>(param.asString());
+ active_panel->onOpen(LLSD());
}
void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region)
{
- if (!region)
- {
- return;
- }
+ if (!region)
+ {
+ return;
+ }
- // call refresh from region on all panels
- for (const auto& infoPanel : mInfoPanels)
- {
- infoPanel->refreshFromRegion(region);
- }
- mEnvironmentPanel->refreshFromRegion(region);
+ // call refresh from region on all panels
+ for (const auto& infoPanel : mInfoPanels)
+ {
+ infoPanel->refreshFromRegion(region);
+ }
+ mEnvironmentPanel->refreshFromRegion(region);
}
// public
void LLFloaterRegionInfo::refresh()
{
- for(info_panels_t::iterator iter = mInfoPanels.begin();
- iter != mInfoPanels.end(); ++iter)
- {
- (*iter)->refresh();
- }
+ for(info_panels_t::iterator iter = mInfoPanels.begin();
+ iter != mInfoPanels.end(); ++iter)
+ {
+ (*iter)->refresh();
+ }
mEnvironmentPanel->refresh();
}
void LLFloaterRegionInfo::enableTopButtons()
{
- getChildView("top_colliders_btn")->setEnabled(true);
- getChildView("top_scripts_btn")->setEnabled(true);
+ getChildView("top_colliders_btn")->setEnabled(true);
+ getChildView("top_scripts_btn")->setEnabled(true);
}
void LLFloaterRegionInfo::disableTopButtons()
{
- getChildView("top_colliders_btn")->setEnabled(false);
- getChildView("top_scripts_btn")->setEnabled(false);
+ getChildView("top_colliders_btn")->setEnabled(false);
+ getChildView("top_scripts_btn")->setEnabled(false);
}
void LLFloaterRegionInfo::onGodLevelChange(U8 god_level)
{
- LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if (floater && floater->getVisible())
- {
- refreshFromRegion(gAgent.getRegion());
- }
+ LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if (floater && floater->getVisible())
+ {
+ refreshFromRegion(gAgent.getRegion());
+ }
}
///----------------------------------------------------------------------------
@@ -704,58 +704,58 @@ void LLFloaterRegionInfo::onGodLevelChange(U8 god_level)
//
LLPanelRegionInfo::LLPanelRegionInfo()
- : LLPanel()
+ : LLPanel()
{
}
void LLPanelRegionInfo::onBtnSet()
{
- if (sendUpdate())
- {
- disableButton("apply_btn");
- }
+ if (sendUpdate())
+ {
+ disableButton("apply_btn");
+ }
}
void LLPanelRegionInfo::onChangeChildCtrl(LLUICtrl* ctrl)
{
- updateChild(ctrl); // virtual function
+ updateChild(ctrl); // virtual function
}
// Enables the "set" button if it is not already enabled
void LLPanelRegionInfo::onChangeAnything()
{
- enableButton("apply_btn");
- refresh();
+ enableButton("apply_btn");
+ refresh();
}
// static
// Enables set button on change to line editor
void LLPanelRegionInfo::onChangeText(LLLineEditor* caller, void* user_data)
{
- LLPanelRegionInfo* panel = dynamic_cast<LLPanelRegionInfo*>(caller->getParent());
- if(panel)
- {
- panel->enableButton("apply_btn");
- panel->refresh();
- }
+ LLPanelRegionInfo* panel = dynamic_cast<LLPanelRegionInfo*>(caller->getParent());
+ if(panel)
+ {
+ panel->enableButton("apply_btn");
+ panel->refresh();
+ }
}
// virtual
BOOL LLPanelRegionInfo::postBuild()
{
- // If the panel has an Apply button, set a callback for it.
- LLUICtrl* apply_btn = findChild<LLUICtrl>("apply_btn");
- if (apply_btn)
- {
- apply_btn->setCommitCallback(boost::bind(&LLPanelRegionInfo::onBtnSet, this));
- }
+ // If the panel has an Apply button, set a callback for it.
+ LLUICtrl* apply_btn = findChild<LLUICtrl>("apply_btn");
+ if (apply_btn)
+ {
+ apply_btn->setCommitCallback(boost::bind(&LLPanelRegionInfo::onBtnSet, this));
+ }
- refresh();
- return TRUE;
+ refresh();
+ return TRUE;
}
-// virtual
+// virtual
void LLPanelRegionInfo::updateChild(LLUICtrl* child_ctr)
{
}
@@ -763,64 +763,64 @@ void LLPanelRegionInfo::updateChild(LLUICtrl* child_ctr)
// virtual
bool LLPanelRegionInfo::refreshFromRegion(LLViewerRegion* region)
{
- if (region) mHost = region->getHost();
- return true;
+ if (region) mHost = region->getHost();
+ return true;
}
void LLPanelRegionInfo::sendEstateOwnerMessage(
- LLMessageSystem* msg,
- const std::string& request,
- const LLUUID& invoice,
- const strings_t& strings)
-{
- LL_INFOS() << "Sending estate request '" << request << "'" << LL_ENDL;
- msg->newMessage("EstateOwnerMessage");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", request);
- msg->addUUID("Invoice", invoice);
- if(strings.empty())
- {
- msg->nextBlock("ParamList");
- msg->addString("Parameter", NULL);
- }
- else
- {
- strings_t::const_iterator it = strings.begin();
- strings_t::const_iterator end = strings.end();
- for(; it != end; ++it)
- {
- msg->nextBlock("ParamList");
- msg->addString("Parameter", *it);
- }
- }
- msg->sendReliable(mHost);
+ LLMessageSystem* msg,
+ const std::string& request,
+ const LLUUID& invoice,
+ const strings_t& strings)
+{
+ LL_INFOS() << "Sending estate request '" << request << "'" << LL_ENDL;
+ msg->newMessage("EstateOwnerMessage");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ msg->nextBlock("MethodData");
+ msg->addString("Method", request);
+ msg->addUUID("Invoice", invoice);
+ if(strings.empty())
+ {
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", NULL);
+ }
+ else
+ {
+ strings_t::const_iterator it = strings.begin();
+ strings_t::const_iterator end = strings.end();
+ for(; it != end; ++it)
+ {
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", *it);
+ }
+ }
+ msg->sendReliable(mHost);
}
void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable)
{
- LLView* button = findChildView(btn_name);
- if (button) button->setEnabled(enable);
+ LLView* button = findChildView(btn_name);
+ if (button) button->setEnabled(enable);
}
void LLPanelRegionInfo::disableButton(const std::string& btn_name)
{
- LLView* button = findChildView(btn_name);
- if (button) button->setEnabled(FALSE);
+ LLView* button = findChildView(btn_name);
+ if (button) button->setEnabled(FALSE);
}
void LLPanelRegionInfo::initCtrl(const std::string& name)
{
- getChild<LLUICtrl>(name)->setCommitCallback(boost::bind(&LLPanelRegionInfo::onChangeAnything, this));
+ getChild<LLUICtrl>(name)->setCommitCallback(boost::bind(&LLPanelRegionInfo::onChangeAnything, this));
}
void LLPanelRegionInfo::onClickManageTelehub()
{
- LLFloaterReg::hideInstance("region_info");
- LLFloaterReg::showInstance("telehubs");
+ LLFloaterReg::hideInstance("region_info");
+ LLFloaterReg::showInstance("telehubs");
}
/////////////////////////////////////////////////////////////////////////////
@@ -828,181 +828,181 @@ void LLPanelRegionInfo::onClickManageTelehub()
//
bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region)
{
- BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
- setCtrlsEnabled(allow_modify);
- getChildView("apply_btn")->setEnabled(FALSE);
- getChildView("access_text")->setEnabled(allow_modify);
- // getChildView("access_combo")->setEnabled(allow_modify);
- // now set in processRegionInfo for teen grid detection
- getChildView("kick_btn")->setEnabled(allow_modify);
- getChildView("kick_all_btn")->setEnabled(allow_modify);
- getChildView("im_btn")->setEnabled(allow_modify);
- getChildView("manage_telehub_btn")->setEnabled(allow_modify);
+ BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
+ setCtrlsEnabled(allow_modify);
+ getChildView("apply_btn")->setEnabled(FALSE);
+ getChildView("access_text")->setEnabled(allow_modify);
+ // getChildView("access_combo")->setEnabled(allow_modify);
+ // now set in processRegionInfo for teen grid detection
+ getChildView("kick_btn")->setEnabled(allow_modify);
+ getChildView("kick_all_btn")->setEnabled(allow_modify);
+ getChildView("im_btn")->setEnabled(allow_modify);
+ getChildView("manage_telehub_btn")->setEnabled(allow_modify);
- // Data gets filled in by processRegionInfo
+ // Data gets filled in by processRegionInfo
- return LLPanelRegionInfo::refreshFromRegion(region);
+ return LLPanelRegionInfo::refreshFromRegion(region);
}
BOOL LLPanelRegionGeneralInfo::postBuild()
{
- // Enable the "Apply" button if something is changed. JC
- initCtrl("block_terraform_check");
- initCtrl("block_fly_check");
- initCtrl("block_fly_over_check");
- initCtrl("allow_damage_check");
- initCtrl("allow_land_resell_check");
- initCtrl("allow_parcel_changes_check");
- initCtrl("agent_limit_spin");
- initCtrl("object_bonus_spin");
- initCtrl("access_combo");
- initCtrl("restrict_pushobject");
- initCtrl("block_parcel_search_check");
-
- childSetAction("kick_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickKick, this));
- childSetAction("kick_all_btn", onClickKickAll, this);
- childSetAction("im_btn", onClickMessage, this);
-// childSetAction("manage_telehub_btn", onClickManageTelehub, this);
-
- LLUICtrl* apply_btn = findChild<LLUICtrl>("apply_btn");
- if (apply_btn)
- {
- apply_btn->setCommitCallback(boost::bind(&LLPanelRegionGeneralInfo::onBtnSet, this));
- }
-
- refresh();
- return TRUE;
+ // Enable the "Apply" button if something is changed. JC
+ initCtrl("block_terraform_check");
+ initCtrl("block_fly_check");
+ initCtrl("block_fly_over_check");
+ initCtrl("allow_damage_check");
+ initCtrl("allow_land_resell_check");
+ initCtrl("allow_parcel_changes_check");
+ initCtrl("agent_limit_spin");
+ initCtrl("object_bonus_spin");
+ initCtrl("access_combo");
+ initCtrl("restrict_pushobject");
+ initCtrl("block_parcel_search_check");
+
+ childSetAction("kick_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickKick, this));
+ childSetAction("kick_all_btn", onClickKickAll, this);
+ childSetAction("im_btn", onClickMessage, this);
+// childSetAction("manage_telehub_btn", onClickManageTelehub, this);
+
+ LLUICtrl* apply_btn = findChild<LLUICtrl>("apply_btn");
+ if (apply_btn)
+ {
+ apply_btn->setCommitCallback(boost::bind(&LLPanelRegionGeneralInfo::onBtnSet, this));
+ }
+
+ refresh();
+ return TRUE;
}
void LLPanelRegionGeneralInfo::onBtnSet()
{
- if(mObjBonusFactor == getChild<LLUICtrl>("object_bonus_spin")->getValue().asReal())
- {
- if (sendUpdate())
- {
- disableButton("apply_btn");
- }
- }
- else
- {
- LLNotificationsUtil::add("ChangeObjectBonusFactor", LLSD(), LLSD(), boost::bind(&LLPanelRegionGeneralInfo::onChangeObjectBonus, this, _1, _2));
- }
+ if(mObjBonusFactor == getChild<LLUICtrl>("object_bonus_spin")->getValue().asReal())
+ {
+ if (sendUpdate())
+ {
+ disableButton("apply_btn");
+ }
+ }
+ else
+ {
+ LLNotificationsUtil::add("ChangeObjectBonusFactor", LLSD(), LLSD(), boost::bind(&LLPanelRegionGeneralInfo::onChangeObjectBonus, this, _1, _2));
+ }
}
bool LLPanelRegionGeneralInfo::onChangeObjectBonus(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- if (sendUpdate())
- {
- disableButton("apply_btn");
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ if (sendUpdate())
+ {
+ disableButton("apply_btn");
+ }
+ }
+ return false;
}
void LLPanelRegionGeneralInfo::onClickKick()
{
- LL_INFOS() << "LLPanelRegionGeneralInfo::onClickKick" << LL_ENDL;
+ LL_INFOS() << "LLPanelRegionGeneralInfo::onClickKick" << LL_ENDL;
- // this depends on the grandparent view being a floater
- // in order to set up floater dependency
+ // this depends on the grandparent view being a floater
+ // in order to set up floater dependency
LLView * button = findChild<LLButton>("kick_btn");
- LLFloater* parent_floater = gFloaterView->getParentFloater(this);
- LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1),
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+ LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1),
FALSE, TRUE, FALSE, parent_floater->getName(), button);
- if (child_floater)
- {
- parent_floater->addDependentFloater(child_floater);
- }
+ if (child_floater)
+ {
+ parent_floater->addDependentFloater(child_floater);
+ }
}
void LLPanelRegionGeneralInfo::onKickCommit(const uuid_vec_t& ids)
{
- if (ids.empty()) return;
- if(ids[0].notNull())
- {
- strings_t strings;
- // [0] = our agent id
- // [1] = target agent id
- std::string buffer;
- gAgent.getID().toString(buffer);
- strings.push_back(buffer);
-
- ids[0].toString(buffer);
- strings.push_back(strings_t::value_type(buffer));
-
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- sendEstateOwnerMessage(gMessageSystem, "teleporthomeuser", invoice, strings);
- }
+ if (ids.empty()) return;
+ if(ids[0].notNull())
+ {
+ strings_t strings;
+ // [0] = our agent id
+ // [1] = target agent id
+ std::string buffer;
+ gAgent.getID().toString(buffer);
+ strings.push_back(buffer);
+
+ ids[0].toString(buffer);
+ strings.push_back(strings_t::value_type(buffer));
+
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ sendEstateOwnerMessage(gMessageSystem, "teleporthomeuser", invoice, strings);
+ }
}
// static
void LLPanelRegionGeneralInfo::onClickKickAll(void* userdata)
{
- LL_INFOS() << "LLPanelRegionGeneralInfo::onClickKickAll" << LL_ENDL;
- LLNotificationsUtil::add("KickUsersFromRegion",
- LLSD(),
- LLSD(),
- boost::bind(&LLPanelRegionGeneralInfo::onKickAllCommit, (LLPanelRegionGeneralInfo*)userdata, _1, _2));
+ LL_INFOS() << "LLPanelRegionGeneralInfo::onClickKickAll" << LL_ENDL;
+ LLNotificationsUtil::add("KickUsersFromRegion",
+ LLSD(),
+ LLSD(),
+ boost::bind(&LLPanelRegionGeneralInfo::onKickAllCommit, (LLPanelRegionGeneralInfo*)userdata, _1, _2));
}
bool LLPanelRegionGeneralInfo::onKickAllCommit(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- strings_t strings;
- // [0] = our agent id
- std::string buffer;
- gAgent.getID().toString(buffer);
- strings.push_back(buffer);
-
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- // historical message name
- sendEstateOwnerMessage(gMessageSystem, "teleporthomeallusers", invoice, strings);
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ strings_t strings;
+ // [0] = our agent id
+ std::string buffer;
+ gAgent.getID().toString(buffer);
+ strings.push_back(buffer);
+
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ // historical message name
+ sendEstateOwnerMessage(gMessageSystem, "teleporthomeallusers", invoice, strings);
+ }
+ return false;
}
// static
void LLPanelRegionGeneralInfo::onClickMessage(void* userdata)
{
- LL_INFOS() << "LLPanelRegionGeneralInfo::onClickMessage" << LL_ENDL;
- LLNotificationsUtil::add("MessageRegion",
- LLSD(),
- LLSD(),
- boost::bind(&LLPanelRegionGeneralInfo::onMessageCommit, (LLPanelRegionGeneralInfo*)userdata, _1, _2));
+ LL_INFOS() << "LLPanelRegionGeneralInfo::onClickMessage" << LL_ENDL;
+ LLNotificationsUtil::add("MessageRegion",
+ LLSD(),
+ LLSD(),
+ boost::bind(&LLPanelRegionGeneralInfo::onMessageCommit, (LLPanelRegionGeneralInfo*)userdata, _1, _2));
}
// static
bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const LLSD& response)
{
- if(LLNotificationsUtil::getSelectedOption(notification, response) != 0) return false;
-
- std::string text = response["message"].asString();
- if (text.empty()) return false;
-
- LL_INFOS() << "Message to everyone: " << text << LL_ENDL;
- strings_t strings;
- // [0] grid_x, unused here
- // [1] grid_y, unused here
- // [2] agent_id of sender
- // [3] sender name
- // [4] message
- strings.push_back("-1");
- strings.push_back("-1");
- std::string buffer;
- gAgent.getID().toString(buffer);
- strings.push_back(buffer);
- std::string name;
- LLAgentUI::buildFullname(name);
- strings.push_back(strings_t::value_type(name));
- strings.push_back(strings_t::value_type(text));
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- sendEstateOwnerMessage(gMessageSystem, "simulatormessage", invoice, strings);
- return false;
+ if(LLNotificationsUtil::getSelectedOption(notification, response) != 0) return false;
+
+ std::string text = response["message"].asString();
+ if (text.empty()) return false;
+
+ LL_INFOS() << "Message to everyone: " << text << LL_ENDL;
+ strings_t strings;
+ // [0] grid_x, unused here
+ // [1] grid_y, unused here
+ // [2] agent_id of sender
+ // [3] sender name
+ // [4] message
+ strings.push_back("-1");
+ strings.push_back("-1");
+ std::string buffer;
+ gAgent.getID().toString(buffer);
+ strings.push_back(buffer);
+ std::string name;
+ LLAgentUI::buildFullname(name);
+ strings.push_back(strings_t::value_type(name));
+ strings.push_back(strings_t::value_type(text));
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ sendEstateOwnerMessage(gMessageSystem, "simulatormessage", invoice, strings);
+ return false;
}
// setregioninfo
@@ -1018,74 +1018,74 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L
// strings[9] = 'Y' - block parcel search, 'N' - allow
BOOL LLPanelRegionGeneralInfo::sendUpdate()
{
- LL_INFOS() << "LLPanelRegionGeneralInfo::sendUpdate()" << LL_ENDL;
-
- // First try using a Cap. If that fails use the old method.
- LLSD body;
- std::string url = gAgent.getRegionCapability("DispatchRegionInfo");
- if (!url.empty())
- {
- body["block_terraform"] = getChild<LLUICtrl>("block_terraform_check")->getValue();
- body["block_fly"] = getChild<LLUICtrl>("block_fly_check")->getValue();
- body["block_fly_over"] = getChild<LLUICtrl>("block_fly_over_check")->getValue();
- body["allow_damage"] = getChild<LLUICtrl>("allow_damage_check")->getValue();
- body["allow_land_resell"] = getChild<LLUICtrl>("allow_land_resell_check")->getValue();
- body["agent_limit"] = getChild<LLUICtrl>("agent_limit_spin")->getValue();
- body["prim_bonus"] = getChild<LLUICtrl>("object_bonus_spin")->getValue();
- body["sim_access"] = getChild<LLUICtrl>("access_combo")->getValue();
- body["restrict_pushobject"] = getChild<LLUICtrl>("restrict_pushobject")->getValue();
- body["allow_parcel_changes"] = getChild<LLUICtrl>("allow_parcel_changes_check")->getValue();
- body["block_parcel_search"] = getChild<LLUICtrl>("block_parcel_search_check")->getValue();
+ LL_INFOS() << "LLPanelRegionGeneralInfo::sendUpdate()" << LL_ENDL;
+
+ // First try using a Cap. If that fails use the old method.
+ LLSD body;
+ std::string url = gAgent.getRegionCapability("DispatchRegionInfo");
+ if (!url.empty())
+ {
+ body["block_terraform"] = getChild<LLUICtrl>("block_terraform_check")->getValue();
+ body["block_fly"] = getChild<LLUICtrl>("block_fly_check")->getValue();
+ body["block_fly_over"] = getChild<LLUICtrl>("block_fly_over_check")->getValue();
+ body["allow_damage"] = getChild<LLUICtrl>("allow_damage_check")->getValue();
+ body["allow_land_resell"] = getChild<LLUICtrl>("allow_land_resell_check")->getValue();
+ body["agent_limit"] = getChild<LLUICtrl>("agent_limit_spin")->getValue();
+ body["prim_bonus"] = getChild<LLUICtrl>("object_bonus_spin")->getValue();
+ body["sim_access"] = getChild<LLUICtrl>("access_combo")->getValue();
+ body["restrict_pushobject"] = getChild<LLUICtrl>("restrict_pushobject")->getValue();
+ body["allow_parcel_changes"] = getChild<LLUICtrl>("allow_parcel_changes_check")->getValue();
+ body["block_parcel_search"] = getChild<LLUICtrl>("block_parcel_search_check")->getValue();
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body,
"Region info update posted.", "Region info update not posted.");
- }
- else
- {
- strings_t strings;
- std::string buffer;
+ }
+ else
+ {
+ strings_t strings;
+ std::string buffer;
- buffer = llformat("%s", (getChild<LLUICtrl>("block_terraform_check")->getValue().asBoolean() ? "Y" : "N"));
- strings.push_back(strings_t::value_type(buffer));
+ buffer = llformat("%s", (getChild<LLUICtrl>("block_terraform_check")->getValue().asBoolean() ? "Y" : "N"));
+ strings.push_back(strings_t::value_type(buffer));
- buffer = llformat("%s", (getChild<LLUICtrl>("block_fly_check")->getValue().asBoolean() ? "Y" : "N"));
- strings.push_back(strings_t::value_type(buffer));
+ buffer = llformat("%s", (getChild<LLUICtrl>("block_fly_check")->getValue().asBoolean() ? "Y" : "N"));
+ strings.push_back(strings_t::value_type(buffer));
- buffer = llformat("%s", (getChild<LLUICtrl>("allow_damage_check")->getValue().asBoolean() ? "Y" : "N"));
- strings.push_back(strings_t::value_type(buffer));
+ buffer = llformat("%s", (getChild<LLUICtrl>("allow_damage_check")->getValue().asBoolean() ? "Y" : "N"));
+ strings.push_back(strings_t::value_type(buffer));
- buffer = llformat("%s", (getChild<LLUICtrl>("allow_land_resell_check")->getValue().asBoolean() ? "Y" : "N"));
- strings.push_back(strings_t::value_type(buffer));
+ buffer = llformat("%s", (getChild<LLUICtrl>("allow_land_resell_check")->getValue().asBoolean() ? "Y" : "N"));
+ strings.push_back(strings_t::value_type(buffer));
- F32 value = (F32)getChild<LLUICtrl>("agent_limit_spin")->getValue().asReal();
- buffer = llformat("%f", value);
- strings.push_back(strings_t::value_type(buffer));
+ F32 value = (F32)getChild<LLUICtrl>("agent_limit_spin")->getValue().asReal();
+ buffer = llformat("%f", value);
+ strings.push_back(strings_t::value_type(buffer));
- value = (F32)getChild<LLUICtrl>("object_bonus_spin")->getValue().asReal();
- buffer = llformat("%f", value);
- strings.push_back(strings_t::value_type(buffer));
+ value = (F32)getChild<LLUICtrl>("object_bonus_spin")->getValue().asReal();
+ buffer = llformat("%f", value);
+ strings.push_back(strings_t::value_type(buffer));
- buffer = llformat("%d", getChild<LLUICtrl>("access_combo")->getValue().asInteger());
- strings.push_back(strings_t::value_type(buffer));
+ buffer = llformat("%d", getChild<LLUICtrl>("access_combo")->getValue().asInteger());
+ strings.push_back(strings_t::value_type(buffer));
- buffer = llformat("%s", (getChild<LLUICtrl>("restrict_pushobject")->getValue().asBoolean() ? "Y" : "N"));
- strings.push_back(strings_t::value_type(buffer));
+ buffer = llformat("%s", (getChild<LLUICtrl>("restrict_pushobject")->getValue().asBoolean() ? "Y" : "N"));
+ strings.push_back(strings_t::value_type(buffer));
- buffer = llformat("%s", (getChild<LLUICtrl>("allow_parcel_changes_check")->getValue().asBoolean() ? "Y" : "N"));
- strings.push_back(strings_t::value_type(buffer));
+ buffer = llformat("%s", (getChild<LLUICtrl>("allow_parcel_changes_check")->getValue().asBoolean() ? "Y" : "N"));
+ strings.push_back(strings_t::value_type(buffer));
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- sendEstateOwnerMessage(gMessageSystem, "setregioninfo", invoice, strings);
- }
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ sendEstateOwnerMessage(gMessageSystem, "setregioninfo", invoice, strings);
+ }
- // if we changed access levels, tell user about it
- LLViewerRegion* region = gAgent.getRegion();
- if (region && (getChild<LLUICtrl>("access_combo")->getValue().asInteger() != region->getSimAccess()) )
- {
- LLNotificationsUtil::add("RegionMaturityChange");
- }
+ // if we changed access levels, tell user about it
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region && (getChild<LLUICtrl>("access_combo")->getValue().asInteger() != region->getSimAccess()) )
+ {
+ LLNotificationsUtil::add("RegionMaturityChange");
+ }
- return TRUE;
+ return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
@@ -1093,278 +1093,278 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate()
/////////////////////////////////////////////////////////////////////////////
BOOL LLPanelRegionDebugInfo::postBuild()
{
- LLPanelRegionInfo::postBuild();
- initCtrl("disable_scripts_check");
- initCtrl("disable_collisions_check");
- initCtrl("disable_physics_check");
+ LLPanelRegionInfo::postBuild();
+ initCtrl("disable_scripts_check");
+ initCtrl("disable_collisions_check");
+ initCtrl("disable_physics_check");
- childSetAction("choose_avatar_btn", boost::bind(&LLPanelRegionDebugInfo::onClickChooseAvatar, this));
- childSetAction("return_btn", onClickReturn, this);
- childSetAction("top_colliders_btn", onClickTopColliders, this);
- childSetAction("top_scripts_btn", onClickTopScripts, this);
- childSetAction("restart_btn", onClickRestart, this);
- childSetAction("cancel_restart_btn", onClickCancelRestart, this);
- childSetAction("region_debug_console_btn", onClickDebugConsole, this);
+ childSetAction("choose_avatar_btn", boost::bind(&LLPanelRegionDebugInfo::onClickChooseAvatar, this));
+ childSetAction("return_btn", onClickReturn, this);
+ childSetAction("top_colliders_btn", onClickTopColliders, this);
+ childSetAction("top_scripts_btn", onClickTopScripts, this);
+ childSetAction("restart_btn", onClickRestart, this);
+ childSetAction("cancel_restart_btn", onClickCancelRestart, this);
+ childSetAction("region_debug_console_btn", onClickDebugConsole, this);
- return TRUE;
+ return TRUE;
}
// virtual
bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region)
{
- BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
- setCtrlsEnabled(allow_modify);
- getChildView("apply_btn")->setEnabled(FALSE);
- getChildView("target_avatar_name")->setEnabled(FALSE);
-
- getChildView("choose_avatar_btn")->setEnabled(allow_modify);
- getChildView("return_scripts")->setEnabled(allow_modify && !mTargetAvatar.isNull());
- getChildView("return_other_land")->setEnabled(allow_modify && !mTargetAvatar.isNull());
- getChildView("return_estate_wide")->setEnabled(allow_modify && !mTargetAvatar.isNull());
- getChildView("return_btn")->setEnabled(allow_modify && !mTargetAvatar.isNull());
- getChildView("top_colliders_btn")->setEnabled(allow_modify);
- getChildView("top_scripts_btn")->setEnabled(allow_modify);
- getChildView("restart_btn")->setEnabled(allow_modify);
- getChildView("cancel_restart_btn")->setEnabled(allow_modify);
- getChildView("region_debug_console_btn")->setEnabled(allow_modify);
-
- return LLPanelRegionInfo::refreshFromRegion(region);
+ BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
+ setCtrlsEnabled(allow_modify);
+ getChildView("apply_btn")->setEnabled(FALSE);
+ getChildView("target_avatar_name")->setEnabled(FALSE);
+
+ getChildView("choose_avatar_btn")->setEnabled(allow_modify);
+ getChildView("return_scripts")->setEnabled(allow_modify && !mTargetAvatar.isNull());
+ getChildView("return_other_land")->setEnabled(allow_modify && !mTargetAvatar.isNull());
+ getChildView("return_estate_wide")->setEnabled(allow_modify && !mTargetAvatar.isNull());
+ getChildView("return_btn")->setEnabled(allow_modify && !mTargetAvatar.isNull());
+ getChildView("top_colliders_btn")->setEnabled(allow_modify);
+ getChildView("top_scripts_btn")->setEnabled(allow_modify);
+ getChildView("restart_btn")->setEnabled(allow_modify);
+ getChildView("cancel_restart_btn")->setEnabled(allow_modify);
+ getChildView("region_debug_console_btn")->setEnabled(allow_modify);
+
+ return LLPanelRegionInfo::refreshFromRegion(region);
}
// virtual
BOOL LLPanelRegionDebugInfo::sendUpdate()
{
- LL_INFOS() << "LLPanelRegionDebugInfo::sendUpdate" << LL_ENDL;
- strings_t strings;
- std::string buffer;
+ LL_INFOS() << "LLPanelRegionDebugInfo::sendUpdate" << LL_ENDL;
+ strings_t strings;
+ std::string buffer;
- buffer = llformat("%s", (getChild<LLUICtrl>("disable_scripts_check")->getValue().asBoolean() ? "Y" : "N"));
- strings.push_back(buffer);
+ buffer = llformat("%s", (getChild<LLUICtrl>("disable_scripts_check")->getValue().asBoolean() ? "Y" : "N"));
+ strings.push_back(buffer);
- buffer = llformat("%s", (getChild<LLUICtrl>("disable_collisions_check")->getValue().asBoolean() ? "Y" : "N"));
- strings.push_back(buffer);
+ buffer = llformat("%s", (getChild<LLUICtrl>("disable_collisions_check")->getValue().asBoolean() ? "Y" : "N"));
+ strings.push_back(buffer);
- buffer = llformat("%s", (getChild<LLUICtrl>("disable_physics_check")->getValue().asBoolean() ? "Y" : "N"));
- strings.push_back(buffer);
+ buffer = llformat("%s", (getChild<LLUICtrl>("disable_physics_check")->getValue().asBoolean() ? "Y" : "N"));
+ strings.push_back(buffer);
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- sendEstateOwnerMessage(gMessageSystem, "setregiondebug", invoice, strings);
- return TRUE;
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ sendEstateOwnerMessage(gMessageSystem, "setregiondebug", invoice, strings);
+ return TRUE;
}
void LLPanelRegionDebugInfo::onClickChooseAvatar()
{
LLView * button = findChild<LLButton>("choose_avatar_btn");
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
- LLFloater * child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2),
+ LLFloater * child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2),
FALSE, TRUE, FALSE, parent_floater->getName(), button);
- if (child_floater)
- {
- parent_floater->addDependentFloater(child_floater);
- }
+ if (child_floater)
+ {
+ parent_floater->addDependentFloater(child_floater);
+ }
}
void LLPanelRegionDebugInfo::callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
{
- if (ids.empty() || names.empty()) return;
- mTargetAvatar = ids[0];
- getChild<LLUICtrl>("target_avatar_name")->setValue(LLSD(names[0].getCompleteName()));
- refreshFromRegion( gAgent.getRegion() );
+ if (ids.empty() || names.empty()) return;
+ mTargetAvatar = ids[0];
+ getChild<LLUICtrl>("target_avatar_name")->setValue(LLSD(names[0].getCompleteName()));
+ refreshFromRegion( gAgent.getRegion() );
}
// static
void LLPanelRegionDebugInfo::onClickReturn(void* data)
{
- LLPanelRegionDebugInfo* panelp = (LLPanelRegionDebugInfo*) data;
- if (panelp->mTargetAvatar.isNull()) return;
-
- LLSD args;
- args["USER_NAME"] = panelp->getChild<LLUICtrl>("target_avatar_name")->getValue().asString();
- LLSD payload;
- payload["avatar_id"] = panelp->mTargetAvatar;
-
- U32 flags = SWD_ALWAYS_RETURN_OBJECTS;
-
- if (panelp->getChild<LLUICtrl>("return_scripts")->getValue().asBoolean())
- {
- flags |= SWD_SCRIPTED_ONLY;
- }
-
- if (panelp->getChild<LLUICtrl>("return_other_land")->getValue().asBoolean())
- {
- flags |= SWD_OTHERS_LAND_ONLY;
- }
- payload["flags"] = int(flags);
- payload["return_estate_wide"] = panelp->getChild<LLUICtrl>("return_estate_wide")->getValue().asBoolean();
- LLNotificationsUtil::add("EstateObjectReturn", args, payload,
- boost::bind(&LLPanelRegionDebugInfo::callbackReturn, panelp, _1, _2));
+ LLPanelRegionDebugInfo* panelp = (LLPanelRegionDebugInfo*) data;
+ if (panelp->mTargetAvatar.isNull()) return;
+
+ LLSD args;
+ args["USER_NAME"] = panelp->getChild<LLUICtrl>("target_avatar_name")->getValue().asString();
+ LLSD payload;
+ payload["avatar_id"] = panelp->mTargetAvatar;
+
+ U32 flags = SWD_ALWAYS_RETURN_OBJECTS;
+
+ if (panelp->getChild<LLUICtrl>("return_scripts")->getValue().asBoolean())
+ {
+ flags |= SWD_SCRIPTED_ONLY;
+ }
+
+ if (panelp->getChild<LLUICtrl>("return_other_land")->getValue().asBoolean())
+ {
+ flags |= SWD_OTHERS_LAND_ONLY;
+ }
+ payload["flags"] = int(flags);
+ payload["return_estate_wide"] = panelp->getChild<LLUICtrl>("return_estate_wide")->getValue().asBoolean();
+ LLNotificationsUtil::add("EstateObjectReturn", args, payload,
+ boost::bind(&LLPanelRegionDebugInfo::callbackReturn, panelp, _1, _2));
}
bool LLPanelRegionDebugInfo::callbackReturn(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return false;
-
- LLUUID target_avatar = notification["payload"]["avatar_id"].asUUID();
- if (!target_avatar.isNull())
- {
- U32 flags = notification["payload"]["flags"].asInteger();
- bool return_estate_wide = notification["payload"]["return_estate_wide"];
- if (return_estate_wide)
- {
- // send as estate message - routed by spaceserver to all regions in estate
- strings_t strings;
- strings.push_back(llformat("%d", flags));
- strings.push_back(target_avatar.asString());
-
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
-
- sendEstateOwnerMessage(gMessageSystem, "estateobjectreturn", invoice, strings);
- }
- else
- {
- // send to this simulator only
- send_sim_wide_deletes(target_avatar, flags);
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return false;
+
+ LLUUID target_avatar = notification["payload"]["avatar_id"].asUUID();
+ if (!target_avatar.isNull())
+ {
+ U32 flags = notification["payload"]["flags"].asInteger();
+ bool return_estate_wide = notification["payload"]["return_estate_wide"];
+ if (return_estate_wide)
+ {
+ // send as estate message - routed by spaceserver to all regions in estate
+ strings_t strings;
+ strings.push_back(llformat("%d", flags));
+ strings.push_back(target_avatar.asString());
+
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+
+ sendEstateOwnerMessage(gMessageSystem, "estateobjectreturn", invoice, strings);
+ }
+ else
+ {
+ // send to this simulator only
+ send_sim_wide_deletes(target_avatar, flags);
+ }
+ }
+ return false;
}
// static
void LLPanelRegionDebugInfo::onClickTopColliders(void* data)
{
- LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data;
- strings_t strings;
- strings.push_back("1"); // one physics step
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
- if(!instance) return;
- LLFloaterReg::showInstance("top_objects");
- instance->clearList();
- instance->disableRefreshBtn();
+ LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data;
+ strings_t strings;
+ strings.push_back("1"); // one physics step
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
+ if(!instance) return;
+ LLFloaterReg::showInstance("top_objects");
+ instance->clearList();
+ instance->disableRefreshBtn();
- self->getChildView("top_colliders_btn")->setEnabled(false);
- self->getChildView("top_scripts_btn")->setEnabled(false);
+ self->getChildView("top_colliders_btn")->setEnabled(false);
+ self->getChildView("top_scripts_btn")->setEnabled(false);
- self->sendEstateOwnerMessage(gMessageSystem, "colliders", invoice, strings);
+ self->sendEstateOwnerMessage(gMessageSystem, "colliders", invoice, strings);
}
// static
void LLPanelRegionDebugInfo::onClickTopScripts(void* data)
{
- LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data;
- strings_t strings;
- strings.push_back("6"); // top 5 scripts
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
- if(!instance) return;
- LLFloaterReg::showInstance("top_objects");
- instance->clearList();
- instance->disableRefreshBtn();
+ LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data;
+ strings_t strings;
+ strings.push_back("6"); // top 5 scripts
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
+ if(!instance) return;
+ LLFloaterReg::showInstance("top_objects");
+ instance->clearList();
+ instance->disableRefreshBtn();
- self->getChildView("top_colliders_btn")->setEnabled(false);
- self->getChildView("top_scripts_btn")->setEnabled(false);
+ self->getChildView("top_colliders_btn")->setEnabled(false);
+ self->getChildView("top_scripts_btn")->setEnabled(false);
- self->sendEstateOwnerMessage(gMessageSystem, "scripts", invoice, strings);
+ self->sendEstateOwnerMessage(gMessageSystem, "scripts", invoice, strings);
}
// static
void LLPanelRegionDebugInfo::onClickRestart(void* data)
{
- LLNotificationsUtil::add("ConfirmRestart", LLSD(), LLSD(),
- boost::bind(&LLPanelRegionDebugInfo::callbackRestart, (LLPanelRegionDebugInfo*)data, _1, _2));
+ LLNotificationsUtil::add("ConfirmRestart", LLSD(), LLSD(),
+ boost::bind(&LLPanelRegionDebugInfo::callbackRestart, (LLPanelRegionDebugInfo*)data, _1, _2));
}
bool LLPanelRegionDebugInfo::callbackRestart(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return false;
- strings_t strings;
- strings.push_back("120");
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- sendEstateOwnerMessage(gMessageSystem, "restart", invoice, strings);
- return false;
+ strings_t strings;
+ strings.push_back("120");
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ sendEstateOwnerMessage(gMessageSystem, "restart", invoice, strings);
+ return false;
}
// static
void LLPanelRegionDebugInfo::onClickCancelRestart(void* data)
{
- LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data;
- strings_t strings;
- strings.push_back("-1");
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- self->sendEstateOwnerMessage(gMessageSystem, "restart", invoice, strings);
+ LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data;
+ strings_t strings;
+ strings.push_back("-1");
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ self->sendEstateOwnerMessage(gMessageSystem, "restart", invoice, strings);
}
// static
void LLPanelRegionDebugInfo::onClickDebugConsole(void* data)
{
- LLFloaterReg::showInstance("region_debug_console");
+ LLFloaterReg::showInstance("region_debug_console");
}
BOOL LLPanelRegionTerrainInfo::validateTextureSizes()
{
static const S32 MAX_TERRAIN_TEXTURE_SIZE = 1024;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- std::string buffer;
- buffer = llformat("texture_detail_%d", i);
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(buffer);
- if (!texture_ctrl) continue;
-
- LLUUID image_asset_id = texture_ctrl->getImageAssetID();
- LLViewerTexture* img = LLViewerTextureManager::getFetchedTexture(image_asset_id);
- S32 components = img->getComponents();
- // Must ask for highest resolution version's width. JC
- S32 width = img->getFullWidth();
- S32 height = img->getFullHeight();
-
- //LL_INFOS() << "texture detail " << i << " is " << width << "x" << height << "x" << components << LL_ENDL;
-
- if (components != 3)
- {
- LLSD args;
- args["TEXTURE_NUM"] = i+1;
- args["TEXTURE_BIT_DEPTH"] = llformat("%d",components * 8);
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ std::string buffer;
+ buffer = llformat("texture_detail_%d", i);
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(buffer);
+ if (!texture_ctrl) continue;
+
+ LLUUID image_asset_id = texture_ctrl->getImageAssetID();
+ LLViewerTexture* img = LLViewerTextureManager::getFetchedTexture(image_asset_id);
+ S32 components = img->getComponents();
+ // Must ask for highest resolution version's width. JC
+ S32 width = img->getFullWidth();
+ S32 height = img->getFullHeight();
+
+ //LL_INFOS() << "texture detail " << i << " is " << width << "x" << height << "x" << components << LL_ENDL;
+
+ if (components != 3)
+ {
+ LLSD args;
+ args["TEXTURE_NUM"] = i+1;
+ args["TEXTURE_BIT_DEPTH"] = llformat("%d",components * 8);
args["MAX_SIZE"] = MAX_TERRAIN_TEXTURE_SIZE;
- LLNotificationsUtil::add("InvalidTerrainBitDepth", args);
- return FALSE;
- }
+ LLNotificationsUtil::add("InvalidTerrainBitDepth", args);
+ return FALSE;
+ }
- if (width > MAX_TERRAIN_TEXTURE_SIZE || height > MAX_TERRAIN_TEXTURE_SIZE)
- {
+ if (width > MAX_TERRAIN_TEXTURE_SIZE || height > MAX_TERRAIN_TEXTURE_SIZE)
+ {
- LLSD args;
- args["TEXTURE_NUM"] = i+1;
- args["TEXTURE_SIZE_X"] = width;
- args["TEXTURE_SIZE_Y"] = height;
+ LLSD args;
+ args["TEXTURE_NUM"] = i+1;
+ args["TEXTURE_SIZE_X"] = width;
+ args["TEXTURE_SIZE_Y"] = height;
args["MAX_SIZE"] = MAX_TERRAIN_TEXTURE_SIZE;
- LLNotificationsUtil::add("InvalidTerrainSize", args);
- return FALSE;
-
- }
- }
+ LLNotificationsUtil::add("InvalidTerrainSize", args);
+ return FALSE;
- return TRUE;
+ }
+ }
+
+ return TRUE;
}
BOOL LLPanelRegionTerrainInfo::validateTextureHeights()
{
- for (S32 i = 0; i < CORNER_COUNT; ++i)
- {
- std::string low = llformat("height_start_spin_%d", i);
- std::string high = llformat("height_range_spin_%d", i);
+ for (S32 i = 0; i < CORNER_COUNT; ++i)
+ {
+ std::string low = llformat("height_start_spin_%d", i);
+ std::string high = llformat("height_range_spin_%d", i);
- if (getChild<LLUICtrl>(low)->getValue().asReal() > getChild<LLUICtrl>(high)->getValue().asReal())
- {
- return FALSE;
- }
- }
+ if (getChild<LLUICtrl>(low)->getValue().asReal() > getChild<LLUICtrl>(high)->getValue().asReal())
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
@@ -1374,286 +1374,286 @@ BOOL LLPanelRegionTerrainInfo::validateTextureHeights()
BOOL LLPanelRegionTerrainInfo::postBuild()
{
- LLPanelRegionInfo::postBuild();
-
- initCtrl("water_height_spin");
- initCtrl("terrain_raise_spin");
- initCtrl("terrain_lower_spin");
+ LLPanelRegionInfo::postBuild();
+
+ initCtrl("water_height_spin");
+ initCtrl("terrain_raise_spin");
+ initCtrl("terrain_lower_spin");
- std::string buffer;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("texture_detail_%d", i);
- initCtrl(buffer);
- }
+ std::string buffer;
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("texture_detail_%d", i);
+ initCtrl(buffer);
+ }
- for(S32 i = 0; i < CORNER_COUNT; ++i)
- {
- buffer = llformat("height_start_spin_%d", i);
- initCtrl(buffer);
- buffer = llformat("height_range_spin_%d", i);
- initCtrl(buffer);
- }
+ for(S32 i = 0; i < CORNER_COUNT; ++i)
+ {
+ buffer = llformat("height_start_spin_%d", i);
+ initCtrl(buffer);
+ buffer = llformat("height_range_spin_%d", i);
+ initCtrl(buffer);
+ }
- childSetAction("download_raw_btn", onClickDownloadRaw, this);
- childSetAction("upload_raw_btn", onClickUploadRaw, this);
- childSetAction("bake_terrain_btn", onClickBakeTerrain, this);
+ childSetAction("download_raw_btn", onClickDownloadRaw, this);
+ childSetAction("upload_raw_btn", onClickUploadRaw, this);
+ childSetAction("bake_terrain_btn", onClickBakeTerrain, this);
- mAskedTextureHeights = false;
- mConfirmedTextureHeights = false;
+ mAskedTextureHeights = false;
+ mConfirmedTextureHeights = false;
- return LLPanelRegionInfo::postBuild();
+ return LLPanelRegionInfo::postBuild();
}
// virtual
bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
{
- BOOL owner_or_god = gAgent.isGodlike()
- || (region && (region->getOwner() == gAgent.getID()));
- BOOL owner_or_god_or_manager = owner_or_god
- || (region && region->isEstateManager());
- setCtrlsEnabled(owner_or_god_or_manager);
-
- getChildView("apply_btn")->setEnabled(FALSE);
-
- if (region)
- {
- getChild<LLUICtrl>("region_text")->setValue(LLSD(region->getName()));
-
- LLVLComposition* compp = region->getComposition();
- LLTextureCtrl* texture_ctrl;
- std::string buffer;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("texture_detail_%d", i);
- texture_ctrl = getChild<LLTextureCtrl>(buffer);
- if(texture_ctrl)
- {
- LL_DEBUGS() << "Detail Texture " << i << ": "
- << compp->getDetailTextureID(i) << LL_ENDL;
- LLUUID tmp_id(compp->getDetailTextureID(i));
- texture_ctrl->setImageAssetID(tmp_id);
- }
- }
-
- for(S32 i = 0; i < CORNER_COUNT; ++i)
- {
- buffer = llformat("height_start_spin_%d", i);
- getChild<LLUICtrl>(buffer)->setValue(LLSD(compp->getStartHeight(i)));
- buffer = llformat("height_range_spin_%d", i);
- getChild<LLUICtrl>(buffer)->setValue(LLSD(compp->getHeightRange(i)));
- }
- }
- else
- {
- LL_DEBUGS() << "no region set" << LL_ENDL;
- getChild<LLUICtrl>("region_text")->setValue(LLSD(""));
- }
-
- getChildView("download_raw_btn")->setEnabled(owner_or_god);
- getChildView("upload_raw_btn")->setEnabled(owner_or_god);
- getChildView("bake_terrain_btn")->setEnabled(owner_or_god);
-
- return LLPanelRegionInfo::refreshFromRegion(region);
+ BOOL owner_or_god = gAgent.isGodlike()
+ || (region && (region->getOwner() == gAgent.getID()));
+ BOOL owner_or_god_or_manager = owner_or_god
+ || (region && region->isEstateManager());
+ setCtrlsEnabled(owner_or_god_or_manager);
+
+ getChildView("apply_btn")->setEnabled(FALSE);
+
+ if (region)
+ {
+ getChild<LLUICtrl>("region_text")->setValue(LLSD(region->getName()));
+
+ LLVLComposition* compp = region->getComposition();
+ LLTextureCtrl* texture_ctrl;
+ std::string buffer;
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("texture_detail_%d", i);
+ texture_ctrl = getChild<LLTextureCtrl>(buffer);
+ if(texture_ctrl)
+ {
+ LL_DEBUGS() << "Detail Texture " << i << ": "
+ << compp->getDetailTextureID(i) << LL_ENDL;
+ LLUUID tmp_id(compp->getDetailTextureID(i));
+ texture_ctrl->setImageAssetID(tmp_id);
+ }
+ }
+
+ for(S32 i = 0; i < CORNER_COUNT; ++i)
+ {
+ buffer = llformat("height_start_spin_%d", i);
+ getChild<LLUICtrl>(buffer)->setValue(LLSD(compp->getStartHeight(i)));
+ buffer = llformat("height_range_spin_%d", i);
+ getChild<LLUICtrl>(buffer)->setValue(LLSD(compp->getHeightRange(i)));
+ }
+ }
+ else
+ {
+ LL_DEBUGS() << "no region set" << LL_ENDL;
+ getChild<LLUICtrl>("region_text")->setValue(LLSD(""));
+ }
+
+ getChildView("download_raw_btn")->setEnabled(owner_or_god);
+ getChildView("upload_raw_btn")->setEnabled(owner_or_god);
+ getChildView("bake_terrain_btn")->setEnabled(owner_or_god);
+
+ return LLPanelRegionInfo::refreshFromRegion(region);
}
// virtual
BOOL LLPanelRegionTerrainInfo::sendUpdate()
{
- LL_INFOS() << "LLPanelRegionTerrainInfo::sendUpdate" << LL_ENDL;
- std::string buffer;
- strings_t strings;
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
-
- // update the model
- LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
- region_info.mWaterHeight = (F32) getChild<LLUICtrl>("water_height_spin")->getValue().asReal();
- region_info.mTerrainRaiseLimit = (F32) getChild<LLUICtrl>("terrain_raise_spin")->getValue().asReal();
- region_info.mTerrainLowerLimit = (F32) getChild<LLUICtrl>("terrain_lower_spin")->getValue().asReal();
-
- // and sync the region with it
- region_info.sendRegionTerrain(invoice);
-
- // =======================================
- // Assemble and send texturedetail message
-
- // Make sure user hasn't chosen wacky textures.
- if (!validateTextureSizes())
- {
- return FALSE;
- }
-
- // Check if terrain Elevation Ranges are correct
- if (gSavedSettings.getBOOL("RegionCheckTextureHeights") && !validateTextureHeights())
- {
- if (!mAskedTextureHeights)
- {
- LLNotificationsUtil::add("ConfirmTextureHeights", LLSD(), LLSD(), boost::bind(&LLPanelRegionTerrainInfo::callbackTextureHeights, this, _1, _2));
- mAskedTextureHeights = true;
- return FALSE;
- }
- else if (!mConfirmedTextureHeights)
- {
- return FALSE;
- }
- }
-
- LLTextureCtrl* texture_ctrl;
- std::string id_str;
- LLMessageSystem* msg = gMessageSystem;
-
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("texture_detail_%d", i);
- texture_ctrl = getChild<LLTextureCtrl>(buffer);
- if(texture_ctrl)
- {
- LLUUID tmp_id(texture_ctrl->getImageAssetID());
- tmp_id.toString(id_str);
- buffer = llformat("%d %s", i, id_str.c_str());
- strings.push_back(buffer);
- }
- }
- sendEstateOwnerMessage(msg, "texturedetail", invoice, strings);
- strings.clear();
-
- // ========================================
- // Assemble and send textureheights message
-
- for(S32 i = 0; i < CORNER_COUNT; ++i)
- {
- buffer = llformat("height_start_spin_%d", i);
- std::string buffer2 = llformat("height_range_spin_%d", i);
- std::string buffer3 = llformat("%d %f %f", i, (F32)getChild<LLUICtrl>(buffer)->getValue().asReal(), (F32)getChild<LLUICtrl>(buffer2)->getValue().asReal());
- strings.push_back(buffer3);
- }
- sendEstateOwnerMessage(msg, "textureheights", invoice, strings);
- strings.clear();
-
- // ========================================
- // Send texturecommit message
-
- sendEstateOwnerMessage(msg, "texturecommit", invoice, strings);
-
- return TRUE;
+ LL_INFOS() << "LLPanelRegionTerrainInfo::sendUpdate" << LL_ENDL;
+ std::string buffer;
+ strings_t strings;
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+
+ // update the model
+ LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
+ region_info.mWaterHeight = (F32) getChild<LLUICtrl>("water_height_spin")->getValue().asReal();
+ region_info.mTerrainRaiseLimit = (F32) getChild<LLUICtrl>("terrain_raise_spin")->getValue().asReal();
+ region_info.mTerrainLowerLimit = (F32) getChild<LLUICtrl>("terrain_lower_spin")->getValue().asReal();
+
+ // and sync the region with it
+ region_info.sendRegionTerrain(invoice);
+
+ // =======================================
+ // Assemble and send texturedetail message
+
+ // Make sure user hasn't chosen wacky textures.
+ if (!validateTextureSizes())
+ {
+ return FALSE;
+ }
+
+ // Check if terrain Elevation Ranges are correct
+ if (gSavedSettings.getBOOL("RegionCheckTextureHeights") && !validateTextureHeights())
+ {
+ if (!mAskedTextureHeights)
+ {
+ LLNotificationsUtil::add("ConfirmTextureHeights", LLSD(), LLSD(), boost::bind(&LLPanelRegionTerrainInfo::callbackTextureHeights, this, _1, _2));
+ mAskedTextureHeights = true;
+ return FALSE;
+ }
+ else if (!mConfirmedTextureHeights)
+ {
+ return FALSE;
+ }
+ }
+
+ LLTextureCtrl* texture_ctrl;
+ std::string id_str;
+ LLMessageSystem* msg = gMessageSystem;
+
+ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ {
+ buffer = llformat("texture_detail_%d", i);
+ texture_ctrl = getChild<LLTextureCtrl>(buffer);
+ if(texture_ctrl)
+ {
+ LLUUID tmp_id(texture_ctrl->getImageAssetID());
+ tmp_id.toString(id_str);
+ buffer = llformat("%d %s", i, id_str.c_str());
+ strings.push_back(buffer);
+ }
+ }
+ sendEstateOwnerMessage(msg, "texturedetail", invoice, strings);
+ strings.clear();
+
+ // ========================================
+ // Assemble and send textureheights message
+
+ for(S32 i = 0; i < CORNER_COUNT; ++i)
+ {
+ buffer = llformat("height_start_spin_%d", i);
+ std::string buffer2 = llformat("height_range_spin_%d", i);
+ std::string buffer3 = llformat("%d %f %f", i, (F32)getChild<LLUICtrl>(buffer)->getValue().asReal(), (F32)getChild<LLUICtrl>(buffer2)->getValue().asReal());
+ strings.push_back(buffer3);
+ }
+ sendEstateOwnerMessage(msg, "textureheights", invoice, strings);
+ strings.clear();
+
+ // ========================================
+ // Send texturecommit message
+
+ sendEstateOwnerMessage(msg, "texturecommit", invoice, strings);
+
+ return TRUE;
}
bool LLPanelRegionTerrainInfo::callbackTextureHeights(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0) // ok
- {
- mConfirmedTextureHeights = true;
- }
- else if (option == 1) // cancel
- {
- mConfirmedTextureHeights = false;
- }
- else if (option == 2) // don't ask
- {
- gSavedSettings.setBOOL("RegionCheckTextureHeights", FALSE);
- mConfirmedTextureHeights = true;
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0) // ok
+ {
+ mConfirmedTextureHeights = true;
+ }
+ else if (option == 1) // cancel
+ {
+ mConfirmedTextureHeights = false;
+ }
+ else if (option == 2) // don't ask
+ {
+ gSavedSettings.setBOOL("RegionCheckTextureHeights", FALSE);
+ mConfirmedTextureHeights = true;
+ }
- onBtnSet();
+ onBtnSet();
- mAskedTextureHeights = false;
- return false;
+ mAskedTextureHeights = false;
+ return false;
}
// static
void LLPanelRegionTerrainInfo::onClickDownloadRaw(void* data)
{
- LLFilePicker& picker = LLFilePicker::instance();
- if (!picker.getSaveFile(LLFilePicker::FFSAVE_RAW, "terrain.raw"))
- {
- LL_WARNS() << "No file" << LL_ENDL;
- return;
- }
- std::string filepath = picker.getFirstFile();
- gXferManager->expectFileForRequest(filepath);
+ LLFilePicker& picker = LLFilePicker::instance();
+ if (!picker.getSaveFile(LLFilePicker::FFSAVE_RAW, "terrain.raw"))
+ {
+ LL_WARNS() << "No file" << LL_ENDL;
+ return;
+ }
+ std::string filepath = picker.getFirstFile();
+ gXferManager->expectFileForRequest(filepath);
- LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data;
- strings_t strings;
- strings.push_back("download filename");
- strings.push_back(filepath);
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- self->sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings);
+ LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data;
+ strings_t strings;
+ strings.push_back("download filename");
+ strings.push_back(filepath);
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ self->sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings);
}
// static
void LLPanelRegionTerrainInfo::onClickUploadRaw(void* data)
{
- LLFilePicker& picker = LLFilePicker::instance();
- if (!picker.getOpenFile(LLFilePicker::FFLOAD_RAW))
- {
- LL_WARNS() << "No file" << LL_ENDL;
- return;
- }
- std::string filepath = picker.getFirstFile();
- gXferManager->expectFileForTransfer(filepath);
+ LLFilePicker& picker = LLFilePicker::instance();
+ if (!picker.getOpenFile(LLFilePicker::FFLOAD_RAW))
+ {
+ LL_WARNS() << "No file" << LL_ENDL;
+ return;
+ }
+ std::string filepath = picker.getFirstFile();
+ gXferManager->expectFileForTransfer(filepath);
- LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data;
- strings_t strings;
- strings.push_back("upload filename");
- strings.push_back(filepath);
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- self->sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings);
+ LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data;
+ strings_t strings;
+ strings.push_back("upload filename");
+ strings.push_back(filepath);
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ self->sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings);
- LLNotificationsUtil::add("RawUploadStarted");
+ LLNotificationsUtil::add("RawUploadStarted");
}
// static
void LLPanelRegionTerrainInfo::onClickBakeTerrain(void* data)
{
- LLNotificationsUtil::add("ConfirmBakeTerrain", LLSD(), LLSD(), boost::bind(&LLPanelRegionTerrainInfo::callbackBakeTerrain, (LLPanelRegionTerrainInfo*)data, _1, _2));
+ LLNotificationsUtil::add("ConfirmBakeTerrain", LLSD(), LLSD(), boost::bind(&LLPanelRegionTerrainInfo::callbackBakeTerrain, (LLPanelRegionTerrainInfo*)data, _1, _2));
}
bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return false;
- strings_t strings;
- strings.push_back("bake");
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings);
+ strings_t strings;
+ strings.push_back("bake");
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings);
- return false;
+ return false;
}
/////////////////////////////////////////////////////////////////////////////
// LLPanelEstateInfo
//
-LLPanelEstateInfo::LLPanelEstateInfo()
-: LLPanelRegionInfo(),
- mEstateID(0) // invalid
+LLPanelEstateInfo::LLPanelEstateInfo()
+: LLPanelRegionInfo(),
+ mEstateID(0) // invalid
{
- LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
- estate_info.setCommitCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
- estate_info.setUpdateCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
+ LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
+ estate_info.setCommitCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
+ estate_info.setUpdateCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
}
// static
void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch)
{
- std::string name;
-
- name.assign("estateupdateinfo");
- static LLDispatchEstateUpdateInfo estate_update_info;
- dispatch.addHandler(name, &estate_update_info);
+ std::string name;
+
+ name.assign("estateupdateinfo");
+ static LLDispatchEstateUpdateInfo estate_update_info;
+ dispatch.addHandler(name, &estate_update_info);
- name.assign("setaccess");
- static LLDispatchSetEstateAccess set_access;
- dispatch.addHandler(name, &set_access);
+ name.assign("setaccess");
+ static LLDispatchSetEstateAccess set_access;
+ dispatch.addHandler(name, &set_access);
- name.assign("setexperience");
- static LLDispatchSetEstateExperience set_experience;
- dispatch.addHandler(name, &set_experience);
+ name.assign("setexperience");
+ static LLDispatchSetEstateExperience set_experience;
+ dispatch.addHandler(name, &set_experience);
- estate_dispatch_initialized = true;
+ estate_dispatch_initialized = true;
}
//---------------------------------------------------------------------------
@@ -1662,49 +1662,49 @@ void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch)
void LLPanelEstateInfo::onClickKickUser()
{
- // this depends on the grandparent view being a floater
- // in order to set up floater dependency
+ // this depends on the grandparent view being a floater
+ // in order to set up floater dependency
LLView * button = findChild<LLButton>("kick_user_from_estate_btn");
- LLFloater* parent_floater = gFloaterView->getParentFloater(this);
- LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1),
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+ LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1),
FALSE, TRUE, FALSE, parent_floater->getName(), button);
- if (child_floater)
- {
- parent_floater->addDependentFloater(child_floater);
- }
+ if (child_floater)
+ {
+ parent_floater->addDependentFloater(child_floater);
+ }
}
void LLPanelEstateInfo::onKickUserCommit(const uuid_vec_t& ids)
{
- if (ids.empty()) return;
-
- //Bring up a confirmation dialog
- LLSD args;
- args["EVIL_USER"] = LLSLURL("agent", ids[0], "completename").getSLURLString();
- LLSD payload;
- payload["agent_id"] = ids[0];
- LLNotificationsUtil::add("EstateKickUser", args, payload, boost::bind(&LLPanelEstateInfo::kickUserConfirm, this, _1, _2));
+ if (ids.empty()) return;
+
+ //Bring up a confirmation dialog
+ LLSD args;
+ args["EVIL_USER"] = LLSLURL("agent", ids[0], "completename").getSLURLString();
+ LLSD payload;
+ payload["agent_id"] = ids[0];
+ LLNotificationsUtil::add("EstateKickUser", args, payload, boost::bind(&LLPanelEstateInfo::kickUserConfirm, this, _1, _2));
}
bool LLPanelEstateInfo::kickUserConfirm(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch(option)
- {
- case 0:
- {
- //Kick User
- strings_t strings;
- strings.push_back(notification["payload"]["agent_id"].asString());
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case 0:
+ {
+ //Kick User
+ strings_t strings;
+ strings.push_back(notification["payload"]["agent_id"].asString());
- sendEstateOwnerMessage(gMessageSystem, "kickestate", LLFloaterRegionInfo::getLastInvoice(), strings);
- break;
- }
- default:
- break;
- }
- return false;
+ sendEstateOwnerMessage(gMessageSystem, "kickestate", LLFloaterRegionInfo::getLastInvoice(), strings);
+ break;
+ }
+ default:
+ break;
+ }
+ return false;
}
//---------------------------------------------------------------------------
@@ -1715,270 +1715,270 @@ bool LLPanelEstateInfo::kickUserConfirm(const LLSD& notification, const LLSD& re
//---------------------------------------------------------------------------
std::string all_estates_text()
{
- LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate();
- if (!panel) return "(" + LLTrans::getString("RegionInfoError") + ")";
-
- LLStringUtil::format_map_t args;
- std::string owner = panel->getOwnerName();
-
- LLViewerRegion* region = gAgent.getRegion();
- if (gAgent.isGodlike())
- {
- args["[OWNER]"] = owner.c_str();
- return LLTrans::getString("RegionInfoAllEstatesOwnedBy", args);
- }
- else if (region && region->getOwner() == gAgent.getID())
- {
- return LLTrans::getString("RegionInfoAllEstatesYouOwn");
- }
- else if (region && region->isEstateManager())
- {
- args["[OWNER]"] = owner.c_str();
- return LLTrans::getString("RegionInfoAllEstatesYouManage", args);
- }
- else
- {
- return "(" + LLTrans::getString("RegionInfoError") + ")";
- }
+ LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate();
+ if (!panel) return "(" + LLTrans::getString("RegionInfoError") + ")";
+
+ LLStringUtil::format_map_t args;
+ std::string owner = panel->getOwnerName();
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (gAgent.isGodlike())
+ {
+ args["[OWNER]"] = owner.c_str();
+ return LLTrans::getString("RegionInfoAllEstatesOwnedBy", args);
+ }
+ else if (region && region->getOwner() == gAgent.getID())
+ {
+ return LLTrans::getString("RegionInfoAllEstatesYouOwn");
+ }
+ else if (region && region->isEstateManager())
+ {
+ args["[OWNER]"] = owner.c_str();
+ return LLTrans::getString("RegionInfoAllEstatesYouManage", args);
+ }
+ else
+ {
+ return "(" + LLTrans::getString("RegionInfoError") + ")";
+ }
}
// static
bool LLPanelEstateInfo::isLindenEstate()
{
- U32 estate_id = LLEstateInfoModel::instance().getID();
- return (estate_id <= ESTATE_LAST_LINDEN);
+ U32 estate_id = LLEstateInfoModel::instance().getID();
+ return (estate_id <= ESTATE_LAST_LINDEN);
}
struct LLEstateAccessChangeInfo
{
- LLEstateAccessChangeInfo(const LLSD& sd)
- {
- mDialogName = sd["dialog_name"].asString();
- mOperationFlag = (U32)sd["operation"].asInteger();
- LLSD::array_const_iterator end_it = sd["allowed_ids"].endArray();
- for (LLSD::array_const_iterator id_it = sd["allowed_ids"].beginArray();
- id_it != end_it;
- ++id_it)
- {
- mAgentOrGroupIDs.push_back(id_it->asUUID());
- }
- }
-
- const LLSD asLLSD() const
- {
- LLSD sd;
- sd["name"] = mDialogName;
- sd["operation"] = (S32)mOperationFlag;
- for (U32 i = 0; i < mAgentOrGroupIDs.size(); ++i)
- {
- sd["allowed_ids"].append(mAgentOrGroupIDs[i]);
- if (mAgentNames.size() > i)
- {
- sd["allowed_names"].append(mAgentNames[i].asLLSD());
- }
- }
- return sd;
- }
-
- U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc.
- std::string mDialogName;
- uuid_vec_t mAgentOrGroupIDs; // List of agent IDs to apply to this change
- std::vector<LLAvatarName> mAgentNames; // Optional list of the agent names for notifications
+ LLEstateAccessChangeInfo(const LLSD& sd)
+ {
+ mDialogName = sd["dialog_name"].asString();
+ mOperationFlag = (U32)sd["operation"].asInteger();
+ LLSD::array_const_iterator end_it = sd["allowed_ids"].endArray();
+ for (LLSD::array_const_iterator id_it = sd["allowed_ids"].beginArray();
+ id_it != end_it;
+ ++id_it)
+ {
+ mAgentOrGroupIDs.push_back(id_it->asUUID());
+ }
+ }
+
+ const LLSD asLLSD() const
+ {
+ LLSD sd;
+ sd["name"] = mDialogName;
+ sd["operation"] = (S32)mOperationFlag;
+ for (U32 i = 0; i < mAgentOrGroupIDs.size(); ++i)
+ {
+ sd["allowed_ids"].append(mAgentOrGroupIDs[i]);
+ if (mAgentNames.size() > i)
+ {
+ sd["allowed_names"].append(mAgentNames[i].asLLSD());
+ }
+ }
+ return sd;
+ }
+
+ U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc.
+ std::string mDialogName;
+ uuid_vec_t mAgentOrGroupIDs; // List of agent IDs to apply to this change
+ std::vector<LLAvatarName> mAgentNames; // Optional list of the agent names for notifications
};
// static
void LLPanelEstateInfo::updateEstateOwnerName(const std::string& name)
{
- LLPanelEstateInfo* panelp = LLFloaterRegionInfo::getPanelEstate();
- if (panelp)
- {
- panelp->setOwnerName(name);
- }
+ LLPanelEstateInfo* panelp = LLFloaterRegionInfo::getPanelEstate();
+ if (panelp)
+ {
+ panelp->setOwnerName(name);
+ }
}
// static
void LLPanelEstateInfo::updateEstateName(const std::string& name)
{
- LLPanelEstateInfo* panelp = LLFloaterRegionInfo::getPanelEstate();
- if (panelp)
- {
- panelp->getChildRef<LLTextBox>("estate_name").setText(name);
- }
+ LLPanelEstateInfo* panelp = LLFloaterRegionInfo::getPanelEstate();
+ if (panelp)
+ {
+ panelp->getChildRef<LLTextBox>("estate_name").setText(name);
+ }
}
void LLPanelEstateInfo::updateControls(LLViewerRegion* region)
{
- BOOL god = gAgent.isGodlike();
- BOOL owner = (region && (region->getOwner() == gAgent.getID()));
- BOOL manager = (region && region->isEstateManager());
- setCtrlsEnabled(god || owner || manager);
-
- getChildView("apply_btn")->setEnabled(FALSE);
+ BOOL god = gAgent.isGodlike();
+ BOOL owner = (region && (region->getOwner() == gAgent.getID()));
+ BOOL manager = (region && region->isEstateManager());
+ setCtrlsEnabled(god || owner || manager);
+
+ getChildView("apply_btn")->setEnabled(FALSE);
getChildView("estate_owner")->setEnabled(TRUE);
- getChildView("message_estate_btn")->setEnabled(god || owner || manager);
- getChildView("kick_user_from_estate_btn")->setEnabled(god || owner || manager);
+ getChildView("message_estate_btn")->setEnabled(god || owner || manager);
+ getChildView("kick_user_from_estate_btn")->setEnabled(god || owner || manager);
- refresh();
+ refresh();
}
bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region)
{
- updateControls(region);
-
- // let the parent class handle the general data collection.
- bool rv = LLPanelRegionInfo::refreshFromRegion(region);
+ updateControls(region);
+
+ // let the parent class handle the general data collection.
+ bool rv = LLPanelRegionInfo::refreshFromRegion(region);
- // We want estate info. To make sure it works across region
- // boundaries and multiple packets, we add a serial number to the
- // integers and track against that on update.
- strings_t strings;
- //integers_t integers;
- //LLFloaterRegionInfo::incrementSerial();
- LLFloaterRegionInfo::nextInvoice();
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- //integers.push_back(LLFloaterRegionInfo::());::getPanelEstate();
+ // We want estate info. To make sure it works across region
+ // boundaries and multiple packets, we add a serial number to the
+ // integers and track against that on update.
+ strings_t strings;
+ //integers_t integers;
+ //LLFloaterRegionInfo::incrementSerial();
+ LLFloaterRegionInfo::nextInvoice();
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ //integers.push_back(LLFloaterRegionInfo::());::getPanelEstate();
-
- sendEstateOwnerMessage(gMessageSystem, "getinfo", invoice, strings);
- refresh();
+ sendEstateOwnerMessage(gMessageSystem, "getinfo", invoice, strings);
- return rv;
+ refresh();
+
+ return rv;
}
void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl)
{
- // Ensure appropriate state of the management ui.
- updateControls(gAgent.getRegion());
+ // Ensure appropriate state of the management ui.
+ updateControls(gAgent.getRegion());
}
bool LLPanelEstateInfo::estateUpdate(LLMessageSystem* msg)
{
- LL_INFOS() << "LLPanelEstateInfo::estateUpdate()" << LL_ENDL;
- return false;
+ LL_INFOS() << "LLPanelEstateInfo::estateUpdate()" << LL_ENDL;
+ return false;
}
BOOL LLPanelEstateInfo::postBuild()
{
- // set up the callbacks for the generic controls
- initCtrl("externally_visible_radio");
- initCtrl("allow_direct_teleport");
- initCtrl("limit_payment");
- initCtrl("limit_age_verified");
+ // set up the callbacks for the generic controls
+ initCtrl("externally_visible_radio");
+ initCtrl("allow_direct_teleport");
+ initCtrl("limit_payment");
+ initCtrl("limit_age_verified");
initCtrl("limit_bots");
- initCtrl("voice_chat_check");
+ initCtrl("voice_chat_check");
initCtrl("parcel_access_override");
- childSetAction("message_estate_btn", boost::bind(&LLPanelEstateInfo::onClickMessageEstate, this));
- childSetAction("kick_user_from_estate_btn", boost::bind(&LLPanelEstateInfo::onClickKickUser, this));
+ childSetAction("message_estate_btn", boost::bind(&LLPanelEstateInfo::onClickMessageEstate, this));
+ childSetAction("kick_user_from_estate_btn", boost::bind(&LLPanelEstateInfo::onClickKickUser, this));
- getChild<LLUICtrl>("parcel_access_override")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeAccessOverride, this));
+ getChild<LLUICtrl>("parcel_access_override")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeAccessOverride, this));
- getChild<LLUICtrl>("externally_visible_radio")->setFocus(TRUE);
+ getChild<LLUICtrl>("externally_visible_radio")->setFocus(TRUE);
getChild<LLTextBox>("estate_owner")->setIsFriendCallback(LLAvatarActions::isFriend);
- return LLPanelRegionInfo::postBuild();
+ return LLPanelRegionInfo::postBuild();
}
void LLPanelEstateInfo::refresh()
{
- // Disable access restriction controls if they make no sense.
- bool public_access = ("estate_public_access" == getChild<LLUICtrl>("externally_visible_radio")->getValue().asString());
+ // Disable access restriction controls if they make no sense.
+ bool public_access = ("estate_public_access" == getChild<LLUICtrl>("externally_visible_radio")->getValue().asString());
- getChildView("Only Allow")->setEnabled(public_access);
- getChildView("limit_payment")->setEnabled(public_access);
- getChildView("limit_age_verified")->setEnabled(public_access);
+ getChildView("Only Allow")->setEnabled(public_access);
+ getChildView("limit_payment")->setEnabled(public_access);
+ getChildView("limit_age_verified")->setEnabled(public_access);
getChildView("limit_bots")->setEnabled(public_access);
- // if this is set to false, then the limit fields are meaningless and should be turned off
- if (public_access == false)
- {
- getChild<LLUICtrl>("limit_payment")->setValue(false);
- getChild<LLUICtrl>("limit_age_verified")->setValue(false);
+ // if this is set to false, then the limit fields are meaningless and should be turned off
+ if (public_access == false)
+ {
+ getChild<LLUICtrl>("limit_payment")->setValue(false);
+ getChild<LLUICtrl>("limit_age_verified")->setValue(false);
getChild<LLUICtrl>("limit_bots")->setValue(false);
- }
+ }
}
void LLPanelEstateInfo::refreshFromEstate()
{
- const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
+ const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
- getChild<LLUICtrl>("estate_name")->setValue(estate_info.getName());
- setOwnerName(LLSLURL("agent", estate_info.getOwnerID(), "inspect").getSLURLString());
+ getChild<LLUICtrl>("estate_name")->setValue(estate_info.getName());
+ setOwnerName(LLSLURL("agent", estate_info.getOwnerID(), "inspect").getSLURLString());
- getChild<LLUICtrl>("externally_visible_radio")->setValue(estate_info.getIsExternallyVisible() ? "estate_public_access" : "estate_restricted_access");
- getChild<LLUICtrl>("voice_chat_check")->setValue(estate_info.getAllowVoiceChat());
- getChild<LLUICtrl>("allow_direct_teleport")->setValue(estate_info.getAllowDirectTeleport());
- getChild<LLUICtrl>("limit_payment")->setValue(estate_info.getDenyAnonymous());
- getChild<LLUICtrl>("limit_age_verified")->setValue(estate_info.getDenyAgeUnverified());
+ getChild<LLUICtrl>("externally_visible_radio")->setValue(estate_info.getIsExternallyVisible() ? "estate_public_access" : "estate_restricted_access");
+ getChild<LLUICtrl>("voice_chat_check")->setValue(estate_info.getAllowVoiceChat());
+ getChild<LLUICtrl>("allow_direct_teleport")->setValue(estate_info.getAllowDirectTeleport());
+ getChild<LLUICtrl>("limit_payment")->setValue(estate_info.getDenyAnonymous());
+ getChild<LLUICtrl>("limit_age_verified")->setValue(estate_info.getDenyAgeUnverified());
getChild<LLUICtrl>("parcel_access_override")->setValue(estate_info.getAllowAccessOverride());
getChild<LLUICtrl>("limit_bots")->setValue(estate_info.getDenyScriptedAgents());
- // Ensure appriopriate state of the management UI
- updateControls(gAgent.getRegion());
- refresh();
+ // Ensure appriopriate state of the management UI
+ updateControls(gAgent.getRegion());
+ refresh();
}
BOOL LLPanelEstateInfo::sendUpdate()
{
- LL_INFOS() << "LLPanelEsateInfo::sendUpdate()" << LL_ENDL;
+ LL_INFOS() << "LLPanelEsateInfo::sendUpdate()" << LL_ENDL;
- LLNotification::Params params("ChangeLindenEstate");
- params.functor.function(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2));
+ LLNotification::Params params("ChangeLindenEstate");
+ params.functor.function(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2));
- if (isLindenEstate())
- {
- // trying to change reserved estate, warn
- LLNotifications::instance().add(params);
- }
- else
- {
- // for normal estates, just make the change
- LLNotifications::instance().forceResponse(params, 0);
- }
- return TRUE;
+ if (isLindenEstate())
+ {
+ // trying to change reserved estate, warn
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ // for normal estates, just make the change
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ return TRUE;
}
bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch(option)
- {
- case 0:
- {
- LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
-
- // update model
- estate_info.setUseFixedSun(false); // we don't support fixed sun estates anymore
- estate_info.setIsExternallyVisible("estate_public_access" == getChild<LLUICtrl>("externally_visible_radio")->getValue().asString());
- estate_info.setAllowDirectTeleport(getChild<LLUICtrl>("allow_direct_teleport")->getValue().asBoolean());
- estate_info.setDenyAnonymous(getChild<LLUICtrl>("limit_payment")->getValue().asBoolean());
- estate_info.setDenyAgeUnverified(getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean());
- estate_info.setAllowVoiceChat(getChild<LLUICtrl>("voice_chat_check")->getValue().asBoolean());
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case 0:
+ {
+ LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
+
+ // update model
+ estate_info.setUseFixedSun(false); // we don't support fixed sun estates anymore
+ estate_info.setIsExternallyVisible("estate_public_access" == getChild<LLUICtrl>("externally_visible_radio")->getValue().asString());
+ estate_info.setAllowDirectTeleport(getChild<LLUICtrl>("allow_direct_teleport")->getValue().asBoolean());
+ estate_info.setDenyAnonymous(getChild<LLUICtrl>("limit_payment")->getValue().asBoolean());
+ estate_info.setDenyAgeUnverified(getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean());
+ estate_info.setAllowVoiceChat(getChild<LLUICtrl>("voice_chat_check")->getValue().asBoolean());
estate_info.setAllowAccessOverride(getChild<LLUICtrl>("parcel_access_override")->getValue().asBoolean());
estate_info.setDenyScriptedAgents(getChild<LLUICtrl>("limit_bots")->getValue().asBoolean());
// JIGGLYPUFF
//estate_info.setAllowAccessOverride(getChild<LLUICtrl>("")->getValue().asBoolean());
- // send the update to sim
- estate_info.sendEstateInfo();
- }
-
- // we don't want to do this because we'll get it automatically from the sim
- // after the spaceserver processes it
-// else
-// {
-// // caps method does not automatically send this info
-// LLFloaterRegionInfo::requestRegionInfo();
-// }
- break;
- case 1:
- default:
- // do nothing
- break;
- }
- return false;
+ // send the update to sim
+ estate_info.sendEstateInfo();
+ }
+
+ // we don't want to do this because we'll get it automatically from the sim
+ // after the spaceserver processes it
+// else
+// {
+// // caps method does not automatically send this info
+// LLFloaterRegionInfo::requestRegionInfo();
+// }
+ break;
+ case 1:
+ default:
+ // do nothing
+ break;
+ }
+ return false;
}
@@ -1988,326 +1988,326 @@ bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, con
// IParam[0] = serial
void LLPanelEstateInfo::getEstateOwner()
{
- // TODO -- disable the panel
- // and call this function whenever we cross a region boundary
- // re-enable when owner matches, and get new estate info
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_EstateOwnerRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ // TODO -- disable the panel
+ // and call this function whenever we cross a region boundary
+ // re-enable when owner matches, and get new estate info
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_EstateOwnerRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->nextBlockFast(_PREHASH_RequestData);
- msg->addStringFast(_PREHASH_Request, "getowner");
+ msg->nextBlockFast(_PREHASH_RequestData);
+ msg->addStringFast(_PREHASH_Request, "getowner");
- // we send an empty string so that the variable block is not empty
- msg->nextBlockFast(_PREHASH_StringData);
- msg->addStringFast(_PREHASH_SParam, "");
+ // we send an empty string so that the variable block is not empty
+ msg->nextBlockFast(_PREHASH_StringData);
+ msg->addStringFast(_PREHASH_SParam, "");
- msg->nextBlockFast(_PREHASH_IntegerData);
- msg->addS32Fast(_PREHASH_IParam, LLFloaterRegionInfo::getSerial());
+ msg->nextBlockFast(_PREHASH_IntegerData);
+ msg->addS32Fast(_PREHASH_IParam, LLFloaterRegionInfo::getSerial());
- gAgent.sendMessage();
+ gAgent.sendMessage();
}
*/
const std::string LLPanelEstateInfo::getOwnerName() const
{
- return getChild<LLUICtrl>("estate_owner")->getValue().asString();
+ return getChild<LLUICtrl>("estate_owner")->getValue().asString();
}
void LLPanelEstateInfo::setOwnerName(const std::string& name)
{
- getChild<LLUICtrl>("estate_owner")->setValue(LLSD(name));
+ getChild<LLUICtrl>("estate_owner")->setValue(LLSD(name));
}
// static
void LLPanelEstateInfo::onClickMessageEstate(void* userdata)
{
- LL_INFOS() << "LLPanelEstateInfo::onClickMessageEstate" << LL_ENDL;
- LLNotificationsUtil::add("MessageEstate", LLSD(), LLSD(), boost::bind(&LLPanelEstateInfo::onMessageCommit, (LLPanelEstateInfo*)userdata, _1, _2));
+ LL_INFOS() << "LLPanelEstateInfo::onClickMessageEstate" << LL_ENDL;
+ LLNotificationsUtil::add("MessageEstate", LLSD(), LLSD(), boost::bind(&LLPanelEstateInfo::onMessageCommit, (LLPanelEstateInfo*)userdata, _1, _2));
}
bool LLPanelEstateInfo::onMessageCommit(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- std::string text = response["message"].asString();
- if(option != 0) return false;
- if(text.empty()) return false;
- LL_INFOS() << "Message to everyone: " << text << LL_ENDL;
- strings_t strings;
- //integers_t integers;
- std::string name;
- LLAgentUI::buildFullname(name);
- strings.push_back(strings_t::value_type(name));
- strings.push_back(strings_t::value_type(text));
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- sendEstateOwnerMessage(gMessageSystem, "instantmessage", invoice, strings);
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ std::string text = response["message"].asString();
+ if(option != 0) return false;
+ if(text.empty()) return false;
+ LL_INFOS() << "Message to everyone: " << text << LL_ENDL;
+ strings_t strings;
+ //integers_t integers;
+ std::string name;
+ LLAgentUI::buildFullname(name);
+ strings.push_back(strings_t::value_type(name));
+ strings.push_back(strings_t::value_type(text));
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ sendEstateOwnerMessage(gMessageSystem, "instantmessage", invoice, strings);
+ return false;
}
void LLPanelEstateInfo::onChangeAccessOverride()
{
- if (!getChild<LLUICtrl>("parcel_access_override")->getValue().asBoolean())
- {
- LLNotificationsUtil::add("EstateParcelAccessOverride");
- }
+ if (!getChild<LLUICtrl>("parcel_access_override")->getValue().asBoolean())
+ {
+ LLNotificationsUtil::add("EstateParcelAccessOverride");
+ }
}
LLPanelEstateCovenant::LLPanelEstateCovenant()
- :
- mCovenantID(LLUUID::null),
- mAssetStatus(ASSET_ERROR)
+ :
+ mCovenantID(LLUUID::null),
+ mAssetStatus(ASSET_ERROR)
{
}
-// virtual
+// virtual
bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region)
{
- LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
- if (region_name)
- {
- region_name->setText(region->getName());
- }
-
- LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
- if (resellable_clause)
- {
- if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
- {
- resellable_clause->setText(getString("can_not_resell"));
- }
- else
- {
- resellable_clause->setText(getString("can_resell"));
- }
- }
-
- LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
- if (changeable_clause)
- {
- if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
- {
- changeable_clause->setText(getString("can_change"));
- }
- else
- {
- changeable_clause->setText(getString("can_not_change"));
- }
- }
-
- LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text");
- if (region_maturity)
- {
- region_maturity->setText(region->getSimAccessString());
- }
-
- LLTextBox* region_landtype = getChild<LLTextBox>("region_landtype_text");
- region_landtype->setText(region->getLocalizedSimProductName());
+ LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
+ if (region_name)
+ {
+ region_name->setText(region->getName());
+ }
+
+ LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
+ if (resellable_clause)
+ {
+ if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
+ {
+ resellable_clause->setText(getString("can_not_resell"));
+ }
+ else
+ {
+ resellable_clause->setText(getString("can_resell"));
+ }
+ }
+
+ LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
+ if (changeable_clause)
+ {
+ if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
+ {
+ changeable_clause->setText(getString("can_change"));
+ }
+ else
+ {
+ changeable_clause->setText(getString("can_not_change"));
+ }
+ }
+
+ LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text");
+ if (region_maturity)
+ {
+ region_maturity->setText(region->getSimAccessString());
+ }
+
+ LLTextBox* region_landtype = getChild<LLTextBox>("region_landtype_text");
+ region_landtype->setText(region->getLocalizedSimProductName());
getChild<LLButton>("reset_covenant")->setEnabled(gAgent.isGodlike() || (region && region->canManageEstate()));
-
- // let the parent class handle the general data collection.
- bool rv = LLPanelRegionInfo::refreshFromRegion(region);
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessage("EstateCovenantRequest");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->sendReliable(region->getHost());
- return rv;
-}
-
-// virtual
+
+ // let the parent class handle the general data collection.
+ bool rv = LLPanelRegionInfo::refreshFromRegion(region);
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessage("EstateCovenantRequest");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->sendReliable(region->getHost());
+ return rv;
+}
+
+// virtual
bool LLPanelEstateCovenant::estateUpdate(LLMessageSystem* msg)
{
- LL_INFOS() << "LLPanelEstateCovenant::estateUpdate()" << LL_ENDL;
- return true;
+ LL_INFOS() << "LLPanelEstateCovenant::estateUpdate()" << LL_ENDL;
+ return true;
}
-
-// virtual
+
+// virtual
BOOL LLPanelEstateCovenant::postBuild()
{
- mEstateNameText = getChild<LLTextBox>("estate_name_text");
- mEstateOwnerText = getChild<LLTextBox>("estate_owner_text");
+ mEstateNameText = getChild<LLTextBox>("estate_name_text");
+ mEstateOwnerText = getChild<LLTextBox>("estate_owner_text");
mEstateOwnerText->setIsFriendCallback(LLAvatarActions::isFriend);
- mLastModifiedText = getChild<LLTextBox>("covenant_timestamp_text");
- mEditor = getChild<LLViewerTextEditor>("covenant_editor");
- LLButton* reset_button = getChild<LLButton>("reset_covenant");
- reset_button->setEnabled(gAgent.canManageEstate());
- reset_button->setClickedCallback(LLPanelEstateCovenant::resetCovenantID, NULL);
+ mLastModifiedText = getChild<LLTextBox>("covenant_timestamp_text");
+ mEditor = getChild<LLViewerTextEditor>("covenant_editor");
+ LLButton* reset_button = getChild<LLButton>("reset_covenant");
+ reset_button->setEnabled(gAgent.canManageEstate());
+ reset_button->setClickedCallback(LLPanelEstateCovenant::resetCovenantID, NULL);
- return LLPanelRegionInfo::postBuild();
+ return LLPanelRegionInfo::postBuild();
}
-// virtual
+// virtual
void LLPanelEstateCovenant::updateChild(LLUICtrl* child_ctrl)
{
}
// virtual
BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
-{
- LLInventoryItem* item = (LLInventoryItem*)cargo_data;
-
- if (!gAgent.canManageEstate())
- {
- *accept = ACCEPT_NO;
- return TRUE;
- }
-
- switch(cargo_type)
- {
- case DAD_NOTECARD:
- *accept = ACCEPT_YES_COPY_SINGLE;
- if (item && drop)
- {
- LLSD payload;
- payload["item_id"] = item->getUUID();
- LLNotificationsUtil::add("EstateChangeCovenant", LLSD(), payload,
- LLPanelEstateCovenant::confirmChangeCovenantCallback);
- }
- break;
- default:
- *accept = ACCEPT_NO;
- break;
- }
-
- return TRUE;
-}
-
-// static
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
+{
+ LLInventoryItem* item = (LLInventoryItem*)cargo_data;
+
+ if (!gAgent.canManageEstate())
+ {
+ *accept = ACCEPT_NO;
+ return TRUE;
+ }
+
+ switch(cargo_type)
+ {
+ case DAD_NOTECARD:
+ *accept = ACCEPT_YES_COPY_SINGLE;
+ if (item && drop)
+ {
+ LLSD payload;
+ payload["item_id"] = item->getUUID();
+ LLNotificationsUtil::add("EstateChangeCovenant", LLSD(), payload,
+ LLPanelEstateCovenant::confirmChangeCovenantCallback);
+ }
+ break;
+ default:
+ *accept = ACCEPT_NO;
+ break;
+ }
+
+ return TRUE;
+}
+
+// static
bool LLPanelEstateCovenant::confirmChangeCovenantCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLInventoryItem* item = gInventory.getItem(notification["payload"]["item_id"].asUUID());
- LLPanelEstateCovenant* self = LLFloaterRegionInfo::getPanelCovenant();
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLInventoryItem* item = gInventory.getItem(notification["payload"]["item_id"].asUUID());
+ LLPanelEstateCovenant* self = LLFloaterRegionInfo::getPanelCovenant();
- if (!item || !self) return false;
+ if (!item || !self) return false;
- switch(option)
- {
- case 0:
- self->loadInvItem(item);
- break;
- default:
- break;
- }
- return false;
+ switch(option)
+ {
+ case 0:
+ self->loadInvItem(item);
+ break;
+ default:
+ break;
+ }
+ return false;
}
// static
void LLPanelEstateCovenant::resetCovenantID(void* userdata)
{
- LLNotificationsUtil::add("EstateChangeCovenant", LLSD(), LLSD(), confirmResetCovenantCallback);
+ LLNotificationsUtil::add("EstateChangeCovenant", LLSD(), LLSD(), confirmResetCovenantCallback);
}
// static
bool LLPanelEstateCovenant::confirmResetCovenantCallback(const LLSD& notification, const LLSD& response)
{
- LLPanelEstateCovenant* self = LLFloaterRegionInfo::getPanelCovenant();
- if (!self) return false;
+ LLPanelEstateCovenant* self = LLFloaterRegionInfo::getPanelCovenant();
+ if (!self) return false;
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch(option)
- {
- case 0:
- self->loadInvItem(NULL);
- break;
- default:
- break;
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case 0:
+ self->loadInvItem(NULL);
+ break;
+ default:
+ break;
+ }
+ return false;
}
void LLPanelEstateCovenant::loadInvItem(LLInventoryItem *itemp)
{
- const BOOL high_priority = TRUE;
- if (itemp)
- {
- gAssetStorage->getInvItemAsset(gAgent.getRegionHost(),
- gAgent.getID(),
- gAgent.getSessionID(),
- itemp->getPermissions().getOwner(),
- LLUUID::null,
- itemp->getUUID(),
- itemp->getAssetUUID(),
- itemp->getType(),
+ const BOOL high_priority = TRUE;
+ if (itemp)
+ {
+ gAssetStorage->getInvItemAsset(gAgent.getRegionHost(),
+ gAgent.getID(),
+ gAgent.getSessionID(),
+ itemp->getPermissions().getOwner(),
+ LLUUID::null,
+ itemp->getUUID(),
+ itemp->getAssetUUID(),
+ itemp->getType(),
onLoadComplete,
- (void*)this,
- high_priority);
- mAssetStatus = ASSET_LOADING;
- }
- else
- {
- mAssetStatus = ASSET_LOADED;
- setCovenantTextEditor(LLTrans::getString("RegionNoCovenant"));
- sendChangeCovenantID(LLUUID::null);
- }
+ (void*)this,
+ high_priority);
+ mAssetStatus = ASSET_LOADING;
+ }
+ else
+ {
+ mAssetStatus = ASSET_LOADED;
+ setCovenantTextEditor(LLTrans::getString("RegionNoCovenant"));
+ sendChangeCovenantID(LLUUID::null);
+ }
}
// static
void LLPanelEstateCovenant::onLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status)
-{
- LL_INFOS() << "LLPanelEstateCovenant::onLoadComplete()" << LL_ENDL;
- LLPanelEstateCovenant* panelp = (LLPanelEstateCovenant*)user_data;
- if( panelp )
- {
- if(0 == status)
- {
- LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
-
- S32 file_length = file.getSize();
-
- std::vector<char> buffer(file_length+1);
- file.read((U8*)&buffer[0], file_length);
- // put a EOS at the end
- buffer[file_length] = 0;
-
- if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) )
- {
- if( !panelp->mEditor->importBuffer( &buffer[0], file_length+1 ) )
- {
- LL_WARNS() << "Problem importing estate covenant." << LL_ENDL;
- LLNotificationsUtil::add("ProblemImportingEstateCovenant");
- }
- else
- {
- panelp->sendChangeCovenantID(asset_uuid);
- }
- }
- else
- {
- // Version 0 (just text, doesn't include version number)
- panelp->sendChangeCovenantID(asset_uuid);
- }
- }
- else
- {
- if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
- LL_ERR_FILE_EMPTY == status)
- {
- LLNotificationsUtil::add("MissingNotecardAssetID");
- }
- else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
- {
- LLNotificationsUtil::add("NotAllowedToViewNotecard");
- }
- else
- {
- LLNotificationsUtil::add("UnableToLoadNotecardAsset");
- }
-
- LL_WARNS() << "Problem loading notecard: " << status << LL_ENDL;
- }
- panelp->mAssetStatus = ASSET_LOADED;
- panelp->setCovenantID(asset_uuid);
- }
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status)
+{
+ LL_INFOS() << "LLPanelEstateCovenant::onLoadComplete()" << LL_ENDL;
+ LLPanelEstateCovenant* panelp = (LLPanelEstateCovenant*)user_data;
+ if( panelp )
+ {
+ if(0 == status)
+ {
+ LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
+
+ S32 file_length = file.getSize();
+
+ std::vector<char> buffer(file_length+1);
+ file.read((U8*)&buffer[0], file_length);
+ // put a EOS at the end
+ buffer[file_length] = 0;
+
+ if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) )
+ {
+ if( !panelp->mEditor->importBuffer( &buffer[0], file_length+1 ) )
+ {
+ LL_WARNS() << "Problem importing estate covenant." << LL_ENDL;
+ LLNotificationsUtil::add("ProblemImportingEstateCovenant");
+ }
+ else
+ {
+ panelp->sendChangeCovenantID(asset_uuid);
+ }
+ }
+ else
+ {
+ // Version 0 (just text, doesn't include version number)
+ panelp->sendChangeCovenantID(asset_uuid);
+ }
+ }
+ else
+ {
+ if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
+ LL_ERR_FILE_EMPTY == status)
+ {
+ LLNotificationsUtil::add("MissingNotecardAssetID");
+ }
+ else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
+ {
+ LLNotificationsUtil::add("NotAllowedToViewNotecard");
+ }
+ else
+ {
+ LLNotificationsUtil::add("UnableToLoadNotecardAsset");
+ }
+
+ LL_WARNS() << "Problem loading notecard: " << status << LL_ENDL;
+ }
+ panelp->mAssetStatus = ASSET_LOADED;
+ panelp->setCovenantID(asset_uuid);
+ }
}
// key = "estatechangecovenantid"
@@ -2315,97 +2315,97 @@ void LLPanelEstateCovenant::onLoadComplete(const LLUUID& asset_uuid,
// strings[1] = str(covenant_id)
void LLPanelEstateCovenant::sendChangeCovenantID(const LLUUID &asset_id)
{
- if (asset_id != getCovenantID())
- {
+ if (asset_id != getCovenantID())
+ {
setCovenantID(asset_id);
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("EstateOwnerMessage");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("EstateOwnerMessage");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", "estatechangecovenantid");
- msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice());
+ msg->nextBlock("MethodData");
+ msg->addString("Method", "estatechangecovenantid");
+ msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice());
- msg->nextBlock("ParamList");
- msg->addString("Parameter", getCovenantID().asString());
- gAgent.sendReliableMessage();
- }
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", getCovenantID().asString());
+ gAgent.sendReliableMessage();
+ }
}
-// virtual
+// virtual
BOOL LLPanelEstateCovenant::sendUpdate()
{
- return TRUE;
+ return TRUE;
}
std::string LLPanelEstateCovenant::getEstateName() const
{
- return mEstateNameText->getText();
+ return mEstateNameText->getText();
}
void LLPanelEstateCovenant::setEstateName(const std::string& name)
{
- mEstateNameText->setText(name);
+ mEstateNameText->setText(name);
}
// static
void LLPanelEstateCovenant::updateCovenantText(const std::string& string, const LLUUID& asset_id)
{
- LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
- if( panelp )
- {
- panelp->mEditor->setText(string);
- panelp->setCovenantID(asset_id);
- }
+ LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
+ if( panelp )
+ {
+ panelp->mEditor->setText(string);
+ panelp->setCovenantID(asset_id);
+ }
}
// static
void LLPanelEstateCovenant::updateEstateName(const std::string& name)
{
- LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
- if( panelp )
- {
- panelp->mEstateNameText->setText(name);
- }
+ LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
+ if( panelp )
+ {
+ panelp->mEstateNameText->setText(name);
+ }
}
// static
void LLPanelEstateCovenant::updateLastModified(const std::string& text)
{
- LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
- if( panelp )
- {
- panelp->mLastModifiedText->setText(text);
- }
+ LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
+ if( panelp )
+ {
+ panelp->mLastModifiedText->setText(text);
+ }
}
// static
void LLPanelEstateCovenant::updateEstateOwnerName(const std::string& name)
{
- LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
- if( panelp )
- {
- panelp->mEstateOwnerText->setText(name);
- }
+ LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
+ if( panelp )
+ {
+ panelp->mEstateOwnerText->setText(name);
+ }
}
std::string LLPanelEstateCovenant::getOwnerName() const
{
- return mEstateOwnerText->getText();
+ return mEstateOwnerText->getText();
}
void LLPanelEstateCovenant::setOwnerName(const std::string& name)
{
- mEstateOwnerText->setText(name);
+ mEstateOwnerText->setText(name);
}
void LLPanelEstateCovenant::setCovenantTextEditor(const std::string& text)
{
- mEditor->setText(text);
+ mEditor->setText(text);
}
// key = "estateupdateinfo"
@@ -2420,47 +2420,47 @@ void LLPanelEstateCovenant::setCovenantTextEditor(const std::string& text)
// strings[8] = str(send_to_agent_only)
// strings[9] = str(abuse_email_addr)
bool LLDispatchEstateUpdateInfo::operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings)
+ const LLDispatcher* dispatcher,
+ const std::string& key,
+ const LLUUID& invoice,
+ const sparam_t& strings)
{
- LL_DEBUGS() << "Received estate update" << LL_ENDL;
+ LL_DEBUGS() << "Received estate update" << LL_ENDL;
- // Update estate info model.
- // This will call LLPanelEstateInfo::refreshFromEstate().
- // *TODO: Move estate message handling stuff to llestateinfomodel.cpp.
- LLEstateInfoModel::instance().update(strings);
+ // Update estate info model.
+ // This will call LLPanelEstateInfo::refreshFromEstate().
+ // *TODO: Move estate message handling stuff to llestateinfomodel.cpp.
+ LLEstateInfoModel::instance().update(strings);
- return true;
+ return true;
}
bool LLDispatchSetEstateAccess::operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings)
+ const LLDispatcher* dispatcher,
+ const std::string& key,
+ const LLUUID& invoice,
+ const sparam_t& strings)
{
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (panel && panel->getPendingUpdate())
- {
- panel->setPendingUpdate(false);
- panel->updateLists();
- }
- return true;
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (panel && panel->getPendingUpdate())
+ {
+ panel->setPendingUpdate(false);
+ panel->updateLists();
+ }
+ return true;
}
// static
LLSD LLDispatchSetEstateExperience::getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count )
{
- LLSD idList = LLSD::emptyArray();
- LLUUID id;
- while (count-- > 0 && it < end)
- {
- memcpy(id.mData, (*(it++)).data(), UUID_BYTES);
- idList.append(id);
- }
- return idList;
+ LLSD idList = LLSD::emptyArray();
+ LLUUID id;
+ while (count-- > 0 && it < end)
+ {
+ memcpy(id.mData, (*(it++)).data(), UUID_BYTES);
+ idList.append(id);
+ }
+ return idList;
}
// key = "setexperience"
@@ -2472,92 +2472,92 @@ LLSD LLDispatchSetEstateExperience::getIDs( sparam_t::const_iterator it, sparam_
// strings[5] = bin(uuid) ...
// ...
bool LLDispatchSetEstateExperience::operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings)
+ const LLDispatcher* dispatcher,
+ const std::string& key,
+ const LLUUID& invoice,
+ const sparam_t& strings)
{
- LLPanelRegionExperiences* panel = LLFloaterRegionInfo::getPanelExperiences();
- if (!panel)
- return true;
+ LLPanelRegionExperiences* panel = LLFloaterRegionInfo::getPanelExperiences();
+ if (!panel)
+ return true;
- const sparam_t::size_type MIN_SIZE = 5;
- if (strings.size() < MIN_SIZE)
- return true;
+ const sparam_t::size_type MIN_SIZE = 5;
+ if (strings.size() < MIN_SIZE)
+ return true;
- // Skip 2 parameters
- sparam_t::const_iterator it = strings.begin();
- ++it; // U32 estate_id = strtol((*it).c_str(), NULL, 10);
- ++it; // U32 send_to_agent_only = strtoul((*(++it)).c_str(), NULL, 10);
+ // Skip 2 parameters
+ sparam_t::const_iterator it = strings.begin();
+ ++it; // U32 estate_id = strtol((*it).c_str(), NULL, 10);
+ ++it; // U32 send_to_agent_only = strtoul((*(++it)).c_str(), NULL, 10);
- // Read 3 parameters
- LLUUID id;
- S32 num_blocked = strtol((*(it++)).c_str(), NULL, 10);
- S32 num_trusted = strtol((*(it++)).c_str(), NULL, 10);
- S32 num_allowed = strtol((*(it++)).c_str(), NULL, 10);
+ // Read 3 parameters
+ LLUUID id;
+ S32 num_blocked = strtol((*(it++)).c_str(), NULL, 10);
+ S32 num_trusted = strtol((*(it++)).c_str(), NULL, 10);
+ S32 num_allowed = strtol((*(it++)).c_str(), NULL, 10);
- LLSD ids = LLSD::emptyMap()
- .with("blocked", getIDs(it, strings.end(), num_blocked))
- .with("trusted", getIDs(it + num_blocked, strings.end(), num_trusted))
- .with("allowed", getIDs(it + num_blocked + num_trusted, strings.end(), num_allowed));
+ LLSD ids = LLSD::emptyMap()
+ .with("blocked", getIDs(it, strings.end(), num_blocked))
+ .with("trusted", getIDs(it + num_blocked, strings.end(), num_trusted))
+ .with("allowed", getIDs(it + num_blocked + num_trusted, strings.end(), num_allowed));
- panel->processResponse(ids);
+ panel->processResponse(ids);
- return true;
+ return true;
}
BOOL LLPanelRegionExperiences::postBuild()
{
- mAllowed = setupList("panel_allowed", ESTATE_EXPERIENCE_ALLOWED_ADD, ESTATE_EXPERIENCE_ALLOWED_REMOVE);
- mTrusted = setupList("panel_trusted", ESTATE_EXPERIENCE_TRUSTED_ADD, ESTATE_EXPERIENCE_TRUSTED_REMOVE);
- mBlocked = setupList("panel_blocked", ESTATE_EXPERIENCE_BLOCKED_ADD, ESTATE_EXPERIENCE_BLOCKED_REMOVE);
+ mAllowed = setupList("panel_allowed", ESTATE_EXPERIENCE_ALLOWED_ADD, ESTATE_EXPERIENCE_ALLOWED_REMOVE);
+ mTrusted = setupList("panel_trusted", ESTATE_EXPERIENCE_TRUSTED_ADD, ESTATE_EXPERIENCE_TRUSTED_REMOVE);
+ mBlocked = setupList("panel_blocked", ESTATE_EXPERIENCE_BLOCKED_ADD, ESTATE_EXPERIENCE_BLOCKED_REMOVE);
- getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(TRUE);
- getChild<LLTextBox>("experiences_help_text")->setText(getString("estate_caption"));
- getChild<LLTextBox>("trusted_text_help")->setText(getString("trusted_estate_text"));
- getChild<LLTextBox>("allowed_text_help")->setText(getString("allowed_estate_text"));
- getChild<LLTextBox>("blocked_text_help")->setText(getString("blocked_estate_text"));
+ getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(TRUE);
+ getChild<LLTextBox>("experiences_help_text")->setText(getString("estate_caption"));
+ getChild<LLTextBox>("trusted_text_help")->setText(getString("trusted_estate_text"));
+ getChild<LLTextBox>("allowed_text_help")->setText(getString("allowed_estate_text"));
+ getChild<LLTextBox>("blocked_text_help")->setText(getString("blocked_estate_text"));
- return LLPanelRegionInfo::postBuild();
+ return LLPanelRegionInfo::postBuild();
}
LLPanelExperienceListEditor* LLPanelRegionExperiences::setupList( const char* control_name, U32 add_id, U32 remove_id )
{
- LLPanelExperienceListEditor* child = findChild<LLPanelExperienceListEditor>(control_name);
- if(child)
- {
- child->getChild<LLTextBox>("text_name")->setText(child->getString(control_name));
- child->setMaxExperienceIDs(ESTATE_MAX_EXPERIENCE_IDS);
- child->setAddedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, add_id, _1));
- child->setRemovedCallback(boost::bind(&LLPanelRegionExperiences::itemChanged, this, remove_id, _1));
- }
+ LLPanelExperienceListEditor* child = findChild<LLPanelExperienceListEditor>(control_name);
+ if(child)
+ {
+ child->getChild<LLTextBox>("text_name")->setText(child->getString(control_name));
+ child->setMaxExperienceIDs(ESTATE_MAX_EXPERIENCE_IDS);
+ child->setAddedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, add_id, _1));
+ child->setRemovedCallback(boost::bind(&LLPanelRegionExperiences::itemChanged, this, remove_id, _1));
+ }
- return child;
+ return child;
}
void LLPanelRegionExperiences::processResponse( const LLSD& content )
{
- if(content.has("default"))
- {
- mDefaultExperience = content["default"].asUUID();
- }
+ if(content.has("default"))
+ {
+ mDefaultExperience = content["default"].asUUID();
+ }
- mAllowed->setExperienceIds(content["allowed"]);
- mBlocked->setExperienceIds(content["blocked"]);
+ mAllowed->setExperienceIds(content["allowed"]);
+ mBlocked->setExperienceIds(content["blocked"]);
- LLSD trusted = content["trusted"];
- if(mDefaultExperience.notNull())
- {
- mTrusted->setStickyFunction(boost::bind(LLPanelExperiencePicker::FilterMatching, _1, mDefaultExperience));
- trusted.append(mDefaultExperience);
- }
+ LLSD trusted = content["trusted"];
+ if(mDefaultExperience.notNull())
+ {
+ mTrusted->setStickyFunction(boost::bind(LLPanelExperiencePicker::FilterMatching, _1, mDefaultExperience));
+ trusted.append(mDefaultExperience);
+ }
- mTrusted->setExperienceIds(trusted);
-
- mAllowed->refreshExperienceCounter();
- mBlocked->refreshExperienceCounter();
- mTrusted->refreshExperienceCounter();
+ mTrusted->setExperienceIds(trusted);
+
+ mAllowed->refreshExperienceCounter();
+ mBlocked->refreshExperienceCounter();
+ mTrusted->refreshExperienceCounter();
}
@@ -2566,81 +2566,81 @@ void LLPanelRegionExperiences::processResponse( const LLSD& content )
// static
bool LLPanelRegionExperiences::experienceCoreConfirm(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- const U32 originalFlags = (U32)notification["payload"]["operation"].asInteger();
-
- LLViewerRegion* region = gAgent.getRegion();
-
- LLSD::array_const_iterator end_it = notification["payload"]["allowed_ids"].endArray();
-
- for (LLSD::array_const_iterator iter = notification["payload"]["allowed_ids"].beginArray();
- iter != end_it;
- iter++)
- {
- U32 flags = originalFlags;
- if (iter + 1 != end_it)
- flags |= ESTATE_ACCESS_NO_REPLY;
-
- const LLUUID id = iter->asUUID();
- switch(option)
- {
- case 0:
- // This estate
- sendEstateExperienceDelta(flags, id);
- break;
- case 1:
- {
- // All estates, either than I own or manage for this owner.
- // This will be verified on simulator. JC
- if (!region) break;
- if (region->getOwner() == gAgent.getID()
- || gAgent.isGodlike())
- {
- flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES;
- sendEstateExperienceDelta(flags, id);
- }
- else if (region->isEstateManager())
- {
- flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES;
- sendEstateExperienceDelta(flags, id);
- }
- break;
- }
- case 2:
- default:
- break;
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ const U32 originalFlags = (U32)notification["payload"]["operation"].asInteger();
+
+ LLViewerRegion* region = gAgent.getRegion();
+
+ LLSD::array_const_iterator end_it = notification["payload"]["allowed_ids"].endArray();
+
+ for (LLSD::array_const_iterator iter = notification["payload"]["allowed_ids"].beginArray();
+ iter != end_it;
+ iter++)
+ {
+ U32 flags = originalFlags;
+ if (iter + 1 != end_it)
+ flags |= ESTATE_ACCESS_NO_REPLY;
+
+ const LLUUID id = iter->asUUID();
+ switch(option)
+ {
+ case 0:
+ // This estate
+ sendEstateExperienceDelta(flags, id);
+ break;
+ case 1:
+ {
+ // All estates, either than I own or manage for this owner.
+ // This will be verified on simulator. JC
+ if (!region) break;
+ if (region->getOwner() == gAgent.getID()
+ || gAgent.isGodlike())
+ {
+ flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES;
+ sendEstateExperienceDelta(flags, id);
+ }
+ else if (region->isEstateManager())
+ {
+ flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES;
+ sendEstateExperienceDelta(flags, id);
+ }
+ break;
+ }
+ case 2:
+ default:
+ break;
+ }
+ }
+ return false;
}
// Send the actual "estateexperiencedelta" message
void LLPanelRegionExperiences::sendEstateExperienceDelta(U32 flags, const LLUUID& experience_id)
{
- strings_t str(3, std::string());
- gAgent.getID().toString(str[0]);
- str[1] = llformat("%u", flags);
- experience_id.toString(str[2]);
+ strings_t str(3, std::string());
+ gAgent.getID().toString(str[0]);
+ str[1] = llformat("%u", flags);
+ experience_id.toString(str[2]);
- LLPanelRegionExperiences* panel = LLFloaterRegionInfo::getPanelExperiences();
- if (panel)
- {
- panel->sendEstateOwnerMessage(gMessageSystem, "estateexperiencedelta", LLFloaterRegionInfo::getLastInvoice(), str);
- }
+ LLPanelRegionExperiences* panel = LLFloaterRegionInfo::getPanelExperiences();
+ if (panel)
+ {
+ panel->sendEstateOwnerMessage(gMessageSystem, "estateexperiencedelta", LLFloaterRegionInfo::getLastInvoice(), str);
+ }
}
void LLPanelRegionExperiences::infoCallback(LLHandle<LLPanelRegionExperiences> handle, const LLSD& content)
-{
- if(handle.isDead())
- return;
+{
+ if(handle.isDead())
+ return;
- LLPanelRegionExperiences* floater = handle.get();
- if (floater)
- {
- floater->processResponse(content);
- }
+ LLPanelRegionExperiences* floater = handle.get();
+ if (floater)
+ {
+ floater->processResponse(content);
+ }
}
/*static*/
@@ -2653,26 +2653,26 @@ std::string LLPanelRegionExperiences::regionCapabilityQuery(LLViewerRegion* regi
bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region)
{
- BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
+ BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
- mAllowed->loading();
- mAllowed->setReadonly(!allow_modify);
- // remove grid-wide experiences
- mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_GRID));
- // remove default experience
- mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterMatching, _1, mDefaultExperience));
+ mAllowed->loading();
+ mAllowed->setReadonly(!allow_modify);
+ // remove grid-wide experiences
+ mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_GRID));
+ // remove default experience
+ mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterMatching, _1, mDefaultExperience));
- mBlocked->loading();
- mBlocked->setReadonly(!allow_modify);
- // only grid-wide experiences
- mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithoutProperty, _1, LLExperienceCache::PROPERTY_GRID));
- // but not privileged ones
- mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_PRIVILEGED));
- // remove default experience
- mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterMatching, _1, mDefaultExperience));
+ mBlocked->loading();
+ mBlocked->setReadonly(!allow_modify);
+ // only grid-wide experiences
+ mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithoutProperty, _1, LLExperienceCache::PROPERTY_GRID));
+ // but not privileged ones
+ mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_PRIVILEGED));
+ // remove default experience
+ mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterMatching, _1, mDefaultExperience));
- mTrusted->loading();
- mTrusted->setReadonly(!allow_modify);
+ mTrusted->loading();
+ mTrusted->setReadonly(!allow_modify);
LLExperienceCache::instance().getRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1),
boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1));
@@ -2682,87 +2682,87 @@ bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region)
LLSD LLPanelRegionExperiences::addIds(LLPanelExperienceListEditor* panel)
{
- LLSD ids;
- const uuid_list_t& id_list = panel->getExperienceIds();
- for(uuid_list_t::const_iterator it = id_list.begin(); it != id_list.end(); ++it)
- {
- ids.append(*it);
- }
- return ids;
+ LLSD ids;
+ const uuid_list_t& id_list = panel->getExperienceIds();
+ for(uuid_list_t::const_iterator it = id_list.begin(); it != id_list.end(); ++it)
+ {
+ ids.append(*it);
+ }
+ return ids;
}
BOOL LLPanelRegionExperiences::sendUpdate()
{
- LLViewerRegion* region = gAgent.getRegion();
+ LLViewerRegion* region = gAgent.getRegion();
LLSD content;
- content["allowed"]=addIds(mAllowed);
- content["blocked"]=addIds(mBlocked);
- content["trusted"]=addIds(mTrusted);
+ content["allowed"]=addIds(mAllowed);
+ content["blocked"]=addIds(mBlocked);
+ content["trusted"]=addIds(mTrusted);
LLExperienceCache::instance().setRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1),
content, boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1));
- return TRUE;
+ return TRUE;
}
void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id )
{
- std::string dialog_name;
- switch (event_type)
- {
- case ESTATE_EXPERIENCE_ALLOWED_ADD:
- dialog_name = "EstateAllowedExperienceAdd";
- break;
+ std::string dialog_name;
+ switch (event_type)
+ {
+ case ESTATE_EXPERIENCE_ALLOWED_ADD:
+ dialog_name = "EstateAllowedExperienceAdd";
+ break;
- case ESTATE_EXPERIENCE_ALLOWED_REMOVE:
- dialog_name = "EstateAllowedExperienceRemove";
- break;
+ case ESTATE_EXPERIENCE_ALLOWED_REMOVE:
+ dialog_name = "EstateAllowedExperienceRemove";
+ break;
- case ESTATE_EXPERIENCE_TRUSTED_ADD:
- dialog_name = "EstateTrustedExperienceAdd";
- break;
+ case ESTATE_EXPERIENCE_TRUSTED_ADD:
+ dialog_name = "EstateTrustedExperienceAdd";
+ break;
- case ESTATE_EXPERIENCE_TRUSTED_REMOVE:
- dialog_name = "EstateTrustedExperienceRemove";
- break;
+ case ESTATE_EXPERIENCE_TRUSTED_REMOVE:
+ dialog_name = "EstateTrustedExperienceRemove";
+ break;
- case ESTATE_EXPERIENCE_BLOCKED_ADD:
- dialog_name = "EstateBlockedExperienceAdd";
- break;
+ case ESTATE_EXPERIENCE_BLOCKED_ADD:
+ dialog_name = "EstateBlockedExperienceAdd";
+ break;
- case ESTATE_EXPERIENCE_BLOCKED_REMOVE:
- dialog_name = "EstateBlockedExperienceRemove";
- break;
+ case ESTATE_EXPERIENCE_BLOCKED_REMOVE:
+ dialog_name = "EstateBlockedExperienceRemove";
+ break;
- default:
- return;
- }
+ default:
+ return;
+ }
- LLSD payload;
- payload["operation"] = (S32)event_type;
- payload["dialog_name"] = dialog_name;
- payload["allowed_ids"].append(id);
+ LLSD payload;
+ payload["operation"] = (S32)event_type;
+ payload["dialog_name"] = dialog_name;
+ payload["allowed_ids"].append(id);
- LLSD args;
- args["ALL_ESTATES"] = all_estates_text();
+ LLSD args;
+ args["ALL_ESTATES"] = all_estates_text();
- LLNotification::Params params(dialog_name);
- params.payload(payload)
- .substitutions(args)
- .functor.function(LLPanelRegionExperiences::experienceCoreConfirm);
- if (LLPanelEstateInfo::isLindenEstate())
- {
- LLNotifications::instance().forceResponse(params, 0);
- }
- else
- {
- LLNotifications::instance().add(params);
- }
+ LLNotification::Params params(dialog_name);
+ params.payload(payload)
+ .substitutions(args)
+ .functor.function(LLPanelRegionExperiences::experienceCoreConfirm);
+ if (LLPanelEstateInfo::isLindenEstate())
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ else
+ {
+ LLNotifications::instance().add(params);
+ }
- onChangeAnything();
+ onChangeAnything();
}
@@ -2772,99 +2772,99 @@ LLPanelEstateAccess::LLPanelEstateAccess()
BOOL LLPanelEstateAccess::postBuild()
{
- getChild<LLUICtrl>("allowed_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
- LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list");
- if (avatar_name_list)
- {
- avatar_name_list->setCommitOnSelectionChange(TRUE);
- avatar_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS);
- }
-
- getChild<LLUICtrl>("allowed_search_input")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onAllowedSearchEdit, this, _2));
- childSetAction("add_allowed_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickAddAllowedAgent, this));
- childSetAction("remove_allowed_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveAllowedAgent, this));
- childSetAction("copy_allowed_list_btn", boost::bind(&LLPanelEstateAccess::onClickCopyAllowedList, this));
-
- getChild<LLUICtrl>("allowed_group_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
- LLNameListCtrl* group_name_list = getChild<LLNameListCtrl>("allowed_group_name_list");
- if (group_name_list)
- {
- group_name_list->setCommitOnSelectionChange(TRUE);
- group_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS);
- }
-
- getChild<LLUICtrl>("allowed_group_search_input")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onAllowedGroupsSearchEdit, this, _2));
- getChild<LLUICtrl>("add_allowed_group_btn")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onClickAddAllowedGroup, this));
- childSetAction("remove_allowed_group_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveAllowedGroup, this));
- childSetAction("copy_allowed_group_list_btn", boost::bind(&LLPanelEstateAccess::onClickCopyAllowedGroupList, this));
-
- getChild<LLUICtrl>("banned_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
- LLNameListCtrl* banned_name_list = getChild<LLNameListCtrl>("banned_avatar_name_list");
- if (banned_name_list)
- {
- banned_name_list->setCommitOnSelectionChange(TRUE);
- banned_name_list->setMaxItemCount(ESTATE_MAX_BANNED_IDS);
- }
-
- getChild<LLUICtrl>("banned_search_input")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onBannedSearchEdit, this, _2));
- childSetAction("add_banned_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickAddBannedAgent, this));
- childSetAction("remove_banned_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveBannedAgent, this));
- childSetAction("copy_banned_list_btn", boost::bind(&LLPanelEstateAccess::onClickCopyBannedList, this));
-
- getChild<LLUICtrl>("estate_manager_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
- LLNameListCtrl* manager_name_list = getChild<LLNameListCtrl>("estate_manager_name_list");
- if (manager_name_list)
- {
- manager_name_list->setCommitOnSelectionChange(TRUE);
- manager_name_list->setMaxItemCount(ESTATE_MAX_MANAGERS * 4); // Allow extras for dupe issue
- }
-
- childSetAction("add_estate_manager_btn", boost::bind(&LLPanelEstateAccess::onClickAddEstateManager, this));
- childSetAction("remove_estate_manager_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveEstateManager, this));
-
- return TRUE;
+ getChild<LLUICtrl>("allowed_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
+ LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list");
+ if (avatar_name_list)
+ {
+ avatar_name_list->setCommitOnSelectionChange(TRUE);
+ avatar_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS);
+ }
+
+ getChild<LLUICtrl>("allowed_search_input")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onAllowedSearchEdit, this, _2));
+ childSetAction("add_allowed_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickAddAllowedAgent, this));
+ childSetAction("remove_allowed_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveAllowedAgent, this));
+ childSetAction("copy_allowed_list_btn", boost::bind(&LLPanelEstateAccess::onClickCopyAllowedList, this));
+
+ getChild<LLUICtrl>("allowed_group_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
+ LLNameListCtrl* group_name_list = getChild<LLNameListCtrl>("allowed_group_name_list");
+ if (group_name_list)
+ {
+ group_name_list->setCommitOnSelectionChange(TRUE);
+ group_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS);
+ }
+
+ getChild<LLUICtrl>("allowed_group_search_input")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onAllowedGroupsSearchEdit, this, _2));
+ getChild<LLUICtrl>("add_allowed_group_btn")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onClickAddAllowedGroup, this));
+ childSetAction("remove_allowed_group_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveAllowedGroup, this));
+ childSetAction("copy_allowed_group_list_btn", boost::bind(&LLPanelEstateAccess::onClickCopyAllowedGroupList, this));
+
+ getChild<LLUICtrl>("banned_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
+ LLNameListCtrl* banned_name_list = getChild<LLNameListCtrl>("banned_avatar_name_list");
+ if (banned_name_list)
+ {
+ banned_name_list->setCommitOnSelectionChange(TRUE);
+ banned_name_list->setMaxItemCount(ESTATE_MAX_BANNED_IDS);
+ }
+
+ getChild<LLUICtrl>("banned_search_input")->setCommitCallback(boost::bind(&LLPanelEstateAccess::onBannedSearchEdit, this, _2));
+ childSetAction("add_banned_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickAddBannedAgent, this));
+ childSetAction("remove_banned_avatar_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveBannedAgent, this));
+ childSetAction("copy_banned_list_btn", boost::bind(&LLPanelEstateAccess::onClickCopyBannedList, this));
+
+ getChild<LLUICtrl>("estate_manager_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
+ LLNameListCtrl* manager_name_list = getChild<LLNameListCtrl>("estate_manager_name_list");
+ if (manager_name_list)
+ {
+ manager_name_list->setCommitOnSelectionChange(TRUE);
+ manager_name_list->setMaxItemCount(ESTATE_MAX_MANAGERS * 4); // Allow extras for dupe issue
+ }
+
+ childSetAction("add_estate_manager_btn", boost::bind(&LLPanelEstateAccess::onClickAddEstateManager, this));
+ childSetAction("remove_estate_manager_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveEstateManager, this));
+
+ return TRUE;
}
void LLPanelEstateAccess::updateControls(LLViewerRegion* region)
{
- BOOL god = gAgent.isGodlike();
- BOOL owner = (region && (region->getOwner() == gAgent.getID()));
- BOOL manager = (region && region->isEstateManager());
- BOOL enable_cotrols = god || owner || manager;
- setCtrlsEnabled(enable_cotrols);
-
- BOOL has_allowed_avatar = getChild<LLNameListCtrl>("allowed_avatar_name_list")->getFirstSelected() ? TRUE : FALSE;
- BOOL has_allowed_group = getChild<LLNameListCtrl>("allowed_group_name_list")->getFirstSelected() ? TRUE : FALSE;
- BOOL has_banned_agent = getChild<LLNameListCtrl>("banned_avatar_name_list")->getFirstSelected() ? TRUE : FALSE;
- BOOL has_estate_manager = getChild<LLNameListCtrl>("estate_manager_name_list")->getFirstSelected() ? TRUE : FALSE;
-
- getChildView("add_allowed_avatar_btn")->setEnabled(enable_cotrols);
- getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && enable_cotrols);
- getChildView("allowed_avatar_name_list")->setEnabled(enable_cotrols);
-
- getChildView("add_allowed_group_btn")->setEnabled(enable_cotrols);
- getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && enable_cotrols);
- getChildView("allowed_group_name_list")->setEnabled(enable_cotrols);
-
- // Can't ban people from mainland, orientation islands, etc. because this
- // creates much network traffic and server load.
- // Disable their accounts in CSR tool instead.
- bool linden_estate = LLPanelEstateInfo::isLindenEstate();
- bool enable_ban = enable_cotrols && !linden_estate;
- getChildView("add_banned_avatar_btn")->setEnabled(enable_ban);
- getChildView("remove_banned_avatar_btn")->setEnabled(has_banned_agent && enable_ban);
- getChildView("banned_avatar_name_list")->setEnabled(enable_cotrols);
-
- // estate managers can't add estate managers
- getChildView("add_estate_manager_btn")->setEnabled(god || owner);
- getChildView("remove_estate_manager_btn")->setEnabled(has_estate_manager && (god || owner));
- getChildView("estate_manager_name_list")->setEnabled(god || owner);
-
- if (enable_cotrols != mCtrlsEnabled)
- {
- mCtrlsEnabled = enable_cotrols;
- updateLists(); // update the lists on the agent's access level change
- }
+ BOOL god = gAgent.isGodlike();
+ BOOL owner = (region && (region->getOwner() == gAgent.getID()));
+ BOOL manager = (region && region->isEstateManager());
+ BOOL enable_cotrols = god || owner || manager;
+ setCtrlsEnabled(enable_cotrols);
+
+ BOOL has_allowed_avatar = getChild<LLNameListCtrl>("allowed_avatar_name_list")->getFirstSelected() ? TRUE : FALSE;
+ BOOL has_allowed_group = getChild<LLNameListCtrl>("allowed_group_name_list")->getFirstSelected() ? TRUE : FALSE;
+ BOOL has_banned_agent = getChild<LLNameListCtrl>("banned_avatar_name_list")->getFirstSelected() ? TRUE : FALSE;
+ BOOL has_estate_manager = getChild<LLNameListCtrl>("estate_manager_name_list")->getFirstSelected() ? TRUE : FALSE;
+
+ getChildView("add_allowed_avatar_btn")->setEnabled(enable_cotrols);
+ getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && enable_cotrols);
+ getChildView("allowed_avatar_name_list")->setEnabled(enable_cotrols);
+
+ getChildView("add_allowed_group_btn")->setEnabled(enable_cotrols);
+ getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && enable_cotrols);
+ getChildView("allowed_group_name_list")->setEnabled(enable_cotrols);
+
+ // Can't ban people from mainland, orientation islands, etc. because this
+ // creates much network traffic and server load.
+ // Disable their accounts in CSR tool instead.
+ bool linden_estate = LLPanelEstateInfo::isLindenEstate();
+ bool enable_ban = enable_cotrols && !linden_estate;
+ getChildView("add_banned_avatar_btn")->setEnabled(enable_ban);
+ getChildView("remove_banned_avatar_btn")->setEnabled(has_banned_agent && enable_ban);
+ getChildView("banned_avatar_name_list")->setEnabled(enable_cotrols);
+
+ // estate managers can't add estate managers
+ getChildView("add_estate_manager_btn")->setEnabled(god || owner);
+ getChildView("remove_estate_manager_btn")->setEnabled(has_estate_manager && (god || owner));
+ getChildView("estate_manager_name_list")->setEnabled(god || owner);
+
+ if (enable_cotrols != mCtrlsEnabled)
+ {
+ mCtrlsEnabled = enable_cotrols;
+ updateLists(); // update the lists on the agent's access level change
+ }
}
//---------------------------------------------------------------------------
@@ -2872,483 +2872,483 @@ void LLPanelEstateAccess::updateControls(LLViewerRegion* region)
//---------------------------------------------------------------------------
void LLPanelEstateAccess::onClickAddAllowedAgent()
{
- LLCtrlListInterface *list = childGetListInterface("allowed_avatar_name_list");
- if (!list) return;
- if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS)
- {
- //args
+ LLCtrlListInterface *list = childGetListInterface("allowed_avatar_name_list");
+ if (!list) return;
+ if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS)
+ {
+ //args
- LLSD args;
- args["MAX_AGENTS"] = llformat("%d", ESTATE_MAX_ACCESS_IDS);
- LLNotificationsUtil::add("MaxAllowedAgentOnRegion", args);
- return;
- }
- accessAddCore(ESTATE_ACCESS_ALLOWED_AGENT_ADD, "EstateAllowedAgentAdd");
+ LLSD args;
+ args["MAX_AGENTS"] = llformat("%d", ESTATE_MAX_ACCESS_IDS);
+ LLNotificationsUtil::add("MaxAllowedAgentOnRegion", args);
+ return;
+ }
+ accessAddCore(ESTATE_ACCESS_ALLOWED_AGENT_ADD, "EstateAllowedAgentAdd");
}
void LLPanelEstateAccess::onClickRemoveAllowedAgent()
{
- accessRemoveCore(ESTATE_ACCESS_ALLOWED_AGENT_REMOVE, "EstateAllowedAgentRemove", "allowed_avatar_name_list");
+ accessRemoveCore(ESTATE_ACCESS_ALLOWED_AGENT_REMOVE, "EstateAllowedAgentRemove", "allowed_avatar_name_list");
}
void LLPanelEstateAccess::onClickAddAllowedGroup()
{
- LLCtrlListInterface *list = childGetListInterface("allowed_group_name_list");
- if (!list) return;
- if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS)
- {
- LLSD args;
- args["MAX_GROUPS"] = llformat("%d", ESTATE_MAX_ACCESS_IDS);
- LLNotificationsUtil::add("MaxAllowedGroupsOnRegion", args);
- return;
- }
-
- LLNotification::Params params("ChangeLindenAccess");
- params.functor.function(boost::bind(&LLPanelEstateAccess::addAllowedGroup, this, _1, _2));
- if (LLPanelEstateInfo::isLindenEstate())
- {
- LLNotifications::instance().add(params);
- }
- else
- {
- LLNotifications::instance().forceResponse(params, 0);
- }
+ LLCtrlListInterface *list = childGetListInterface("allowed_group_name_list");
+ if (!list) return;
+ if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS)
+ {
+ LLSD args;
+ args["MAX_GROUPS"] = llformat("%d", ESTATE_MAX_ACCESS_IDS);
+ LLNotificationsUtil::add("MaxAllowedGroupsOnRegion", args);
+ return;
+ }
+
+ LLNotification::Params params("ChangeLindenAccess");
+ params.functor.function(boost::bind(&LLPanelEstateAccess::addAllowedGroup, this, _1, _2));
+ if (LLPanelEstateInfo::isLindenEstate())
+ {
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
}
bool LLPanelEstateAccess::addAllowedGroup(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return false;
- LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
- LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
- if (widget)
- {
- widget->removeNoneOption();
- widget->setSelectGroupCallback(boost::bind(&LLPanelEstateAccess::addAllowedGroup2, this, _1));
- if (parent_floater)
- {
- LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, widget);
- widget->setOrigin(new_rect.mLeft, new_rect.mBottom);
- parent_floater->addDependentFloater(widget);
- }
- }
+ LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
+ if (widget)
+ {
+ widget->removeNoneOption();
+ widget->setSelectGroupCallback(boost::bind(&LLPanelEstateAccess::addAllowedGroup2, this, _1));
+ if (parent_floater)
+ {
+ LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, widget);
+ widget->setOrigin(new_rect.mLeft, new_rect.mBottom);
+ parent_floater->addDependentFloater(widget);
+ }
+ }
- return false;
+ return false;
}
void LLPanelEstateAccess::onClickRemoveAllowedGroup()
{
- accessRemoveCore(ESTATE_ACCESS_ALLOWED_GROUP_REMOVE, "EstateAllowedGroupRemove", "allowed_group_name_list");
+ accessRemoveCore(ESTATE_ACCESS_ALLOWED_GROUP_REMOVE, "EstateAllowedGroupRemove", "allowed_group_name_list");
}
void LLPanelEstateAccess::onClickAddBannedAgent()
{
- LLCtrlListInterface *list = childGetListInterface("banned_avatar_name_list");
- if (!list) return;
- if (list->getItemCount() >= ESTATE_MAX_BANNED_IDS)
- {
- LLSD args;
- args["MAX_BANNED"] = llformat("%d", ESTATE_MAX_BANNED_IDS);
- LLNotificationsUtil::add("MaxBannedAgentsOnRegion", args);
- return;
- }
- accessAddCore(ESTATE_ACCESS_BANNED_AGENT_ADD, "EstateBannedAgentAdd");
+ LLCtrlListInterface *list = childGetListInterface("banned_avatar_name_list");
+ if (!list) return;
+ if (list->getItemCount() >= ESTATE_MAX_BANNED_IDS)
+ {
+ LLSD args;
+ args["MAX_BANNED"] = llformat("%d", ESTATE_MAX_BANNED_IDS);
+ LLNotificationsUtil::add("MaxBannedAgentsOnRegion", args);
+ return;
+ }
+ accessAddCore(ESTATE_ACCESS_BANNED_AGENT_ADD, "EstateBannedAgentAdd");
}
void LLPanelEstateAccess::onClickRemoveBannedAgent()
{
- accessRemoveCore(ESTATE_ACCESS_BANNED_AGENT_REMOVE, "EstateBannedAgentRemove", "banned_avatar_name_list");
+ accessRemoveCore(ESTATE_ACCESS_BANNED_AGENT_REMOVE, "EstateBannedAgentRemove", "banned_avatar_name_list");
}
void LLPanelEstateAccess::onClickCopyAllowedList()
{
- copyListToClipboard("allowed_avatar_name_list");
+ copyListToClipboard("allowed_avatar_name_list");
}
void LLPanelEstateAccess::onClickCopyAllowedGroupList()
{
- copyListToClipboard("allowed_group_name_list");
+ copyListToClipboard("allowed_group_name_list");
}
void LLPanelEstateAccess::onClickCopyBannedList()
{
- copyListToClipboard("banned_avatar_name_list");
+ copyListToClipboard("banned_avatar_name_list");
}
// static
void LLPanelEstateAccess::onClickAddEstateManager()
{
- LLCtrlListInterface *list = childGetListInterface("estate_manager_name_list");
- if (!list) return;
- if (list->getItemCount() >= ESTATE_MAX_MANAGERS)
- { // Tell user they can't add more managers
- LLSD args;
- args["MAX_MANAGER"] = llformat("%d", ESTATE_MAX_MANAGERS);
- LLNotificationsUtil::add("MaxManagersOnRegion", args);
- }
- else
- { // Go pick managers to add
- accessAddCore(ESTATE_ACCESS_MANAGER_ADD, "EstateManagerAdd");
- }
+ LLCtrlListInterface *list = childGetListInterface("estate_manager_name_list");
+ if (!list) return;
+ if (list->getItemCount() >= ESTATE_MAX_MANAGERS)
+ { // Tell user they can't add more managers
+ LLSD args;
+ args["MAX_MANAGER"] = llformat("%d", ESTATE_MAX_MANAGERS);
+ LLNotificationsUtil::add("MaxManagersOnRegion", args);
+ }
+ else
+ { // Go pick managers to add
+ accessAddCore(ESTATE_ACCESS_MANAGER_ADD, "EstateManagerAdd");
+ }
}
// static
void LLPanelEstateAccess::onClickRemoveEstateManager()
{
- accessRemoveCore(ESTATE_ACCESS_MANAGER_REMOVE, "EstateManagerRemove", "estate_manager_name_list");
+ accessRemoveCore(ESTATE_ACCESS_MANAGER_REMOVE, "EstateManagerRemove", "estate_manager_name_list");
}
// Special case callback for groups, since it has different callback format than names
void LLPanelEstateAccess::addAllowedGroup2(LLUUID id)
{
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (panel)
- {
- LLNameListCtrl* group_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list");
- LLScrollListItem* item = group_list->getNameItemByAgentId(id);
- if (item)
- {
- LLSD args;
- args["GROUP"] = item->getColumn(0)->getValue().asString();
- LLNotificationsUtil::add("GroupIsAlreadyInList", args);
- return;
- }
- }
-
- LLSD payload;
- payload["operation"] = (S32)ESTATE_ACCESS_ALLOWED_GROUP_ADD;
- payload["dialog_name"] = "EstateAllowedGroupAdd";
- payload["allowed_ids"].append(id);
-
- LLSD args;
- args["ALL_ESTATES"] = all_estates_text();
-
- LLNotification::Params params("EstateAllowedGroupAdd");
- params.payload(payload)
- .substitutions(args)
- .functor.function(accessCoreConfirm);
- if (LLPanelEstateInfo::isLindenEstate())
- {
- LLNotifications::instance().forceResponse(params, 0);
- }
- else
- {
- LLNotifications::instance().add(params);
- }
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (panel)
+ {
+ LLNameListCtrl* group_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list");
+ LLScrollListItem* item = group_list->getNameItemByAgentId(id);
+ if (item)
+ {
+ LLSD args;
+ args["GROUP"] = item->getColumn(0)->getValue().asString();
+ LLNotificationsUtil::add("GroupIsAlreadyInList", args);
+ return;
+ }
+ }
+
+ LLSD payload;
+ payload["operation"] = (S32)ESTATE_ACCESS_ALLOWED_GROUP_ADD;
+ payload["dialog_name"] = "EstateAllowedGroupAdd";
+ payload["allowed_ids"].append(id);
+
+ LLSD args;
+ args["ALL_ESTATES"] = all_estates_text();
+
+ LLNotification::Params params("EstateAllowedGroupAdd");
+ params.payload(payload)
+ .substitutions(args)
+ .functor.function(accessCoreConfirm);
+ if (LLPanelEstateInfo::isLindenEstate())
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ else
+ {
+ LLNotifications::instance().add(params);
+ }
}
// static
void LLPanelEstateAccess::accessAddCore(U32 operation_flag, const std::string& dialog_name)
{
- LLSD payload;
- payload["operation"] = (S32)operation_flag;
- payload["dialog_name"] = dialog_name;
- // agent id filled in after avatar picker
+ LLSD payload;
+ payload["operation"] = (S32)operation_flag;
+ payload["dialog_name"] = dialog_name;
+ // agent id filled in after avatar picker
- LLNotification::Params params("ChangeLindenAccess");
- params.payload(payload)
- .functor.function(accessAddCore2);
+ LLNotification::Params params("ChangeLindenAccess");
+ params.payload(payload)
+ .functor.function(accessAddCore2);
- if (LLPanelEstateInfo::isLindenEstate())
- {
- LLNotifications::instance().add(params);
- }
- else
- {
- // same as clicking "OK"
- LLNotifications::instance().forceResponse(params, 0);
- }
+ if (LLPanelEstateInfo::isLindenEstate())
+ {
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ // same as clicking "OK"
+ LLNotifications::instance().forceResponse(params, 0);
+ }
}
// static
bool LLPanelEstateAccess::accessAddCore2(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0)
- {
- // abort change
- return false;
- }
-
- LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo(notification["payload"]);
- //Get parent floater name
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- LLFloater* parent_floater = panel ? gFloaterView->getParentFloater(panel) : NULL;
- const std::string& parent_floater_name = parent_floater ? parent_floater->getName() : "";
-
- //Determine the button that triggered opening of the avatar picker
- //(so that a shadow frustum from the button to the avatar picker can be created)
- LLView * button = NULL;
- switch (change_info->mOperationFlag)
- {
- case ESTATE_ACCESS_ALLOWED_AGENT_ADD:
- button = panel->findChild<LLButton>("add_allowed_avatar_btn");
- break;
-
- case ESTATE_ACCESS_BANNED_AGENT_ADD:
- button = panel->findChild<LLButton>("add_banned_avatar_btn");
- break;
-
- case ESTATE_ACCESS_MANAGER_ADD:
- button = panel->findChild<LLButton>("add_estate_manager_btn");
- break;
- }
-
- // avatar picker yes multi-select, yes close-on-select
- LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, _2, (void*)change_info),
- TRUE, TRUE, FALSE, parent_floater_name, button);
-
- //Allows the closed parent floater to close the child floater (avatar picker)
- if (child_floater)
- {
- parent_floater->addDependentFloater(child_floater);
- }
-
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0)
+ {
+ // abort change
+ return false;
+ }
+
+ LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo(notification["payload"]);
+ //Get parent floater name
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ LLFloater* parent_floater = panel ? gFloaterView->getParentFloater(panel) : NULL;
+ const std::string& parent_floater_name = parent_floater ? parent_floater->getName() : "";
+
+ //Determine the button that triggered opening of the avatar picker
+ //(so that a shadow frustum from the button to the avatar picker can be created)
+ LLView * button = NULL;
+ switch (change_info->mOperationFlag)
+ {
+ case ESTATE_ACCESS_ALLOWED_AGENT_ADD:
+ button = panel->findChild<LLButton>("add_allowed_avatar_btn");
+ break;
+
+ case ESTATE_ACCESS_BANNED_AGENT_ADD:
+ button = panel->findChild<LLButton>("add_banned_avatar_btn");
+ break;
+
+ case ESTATE_ACCESS_MANAGER_ADD:
+ button = panel->findChild<LLButton>("add_estate_manager_btn");
+ break;
+ }
+
+ // avatar picker yes multi-select, yes close-on-select
+ LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, _2, (void*)change_info),
+ TRUE, TRUE, FALSE, parent_floater_name, button);
+
+ //Allows the closed parent floater to close the child floater (avatar picker)
+ if (child_floater)
+ {
+ parent_floater->addDependentFloater(child_floater);
+ }
+
+ return false;
}
// static
void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, std::vector<LLAvatarName> names, void* data)
{
- LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data;
- if (!change_info) return;
- if (ids.empty())
- {
- // User didn't select a name.
- delete change_info;
- change_info = NULL;
- return;
- }
- // User did select a name.
- change_info->mAgentOrGroupIDs = ids;
- // Can't put estate owner on ban list
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (!panel) return;
- LLViewerRegion* region = gAgent.getRegion();
- if (!region) return;
-
- if (change_info->mOperationFlag & ESTATE_ACCESS_ALLOWED_AGENT_ADD)
- {
- LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list");
- int currentCount = (name_list ? name_list->getItemCount() : 0);
- if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS)
- {
- LLSD args;
- args["NUM_ADDED"] = llformat("%d", ids.size());
- args["MAX_AGENTS"] = llformat("%d", ESTATE_MAX_ACCESS_IDS);
- args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeAllowedAgents");
- args["NUM_EXCESS"] = llformat("%d", (ids.size() + currentCount) - ESTATE_MAX_ACCESS_IDS);
- LLNotificationsUtil::add("MaxAgentOnRegionBatch", args);
- delete change_info;
- return;
- }
-
- uuid_vec_t ids_allowed;
- std::vector<LLAvatarName> names_allowed;
- std::string already_allowed;
- bool single = true;
- for (U32 i = 0; i < ids.size(); ++i)
- {
- LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]);
- if (item)
- {
- if (!already_allowed.empty())
- {
- already_allowed += ", ";
- single = false;
- }
- already_allowed += item->getColumn(0)->getValue().asString();
- }
- else
- {
- ids_allowed.push_back(ids[i]);
- names_allowed.push_back(names[i]);
- }
- }
- if (!already_allowed.empty())
- {
- LLSD args;
- args["AGENT"] = already_allowed;
- args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeAllowedAgents");
- LLNotificationsUtil::add(single ? "AgentIsAlreadyInList" : "AgentsAreAlreadyInList", args);
- if (ids_allowed.empty())
- {
- delete change_info;
- return;
- }
- }
- change_info->mAgentOrGroupIDs = ids_allowed;
- change_info->mAgentNames = names_allowed;
- }
- if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD)
- {
- LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list");
- LLNameListCtrl* em_list = panel->getChild<LLNameListCtrl>("estate_manager_name_list");
- int currentCount = (name_list ? name_list->getItemCount() : 0);
- if (ids.size() + currentCount > ESTATE_MAX_BANNED_IDS)
- {
- LLSD args;
- args["NUM_ADDED"] = llformat("%d", ids.size());
- args["MAX_AGENTS"] = llformat("%d", ESTATE_MAX_BANNED_IDS);
- args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeBannedAgents");
- args["NUM_EXCESS"] = llformat("%d", (ids.size() + currentCount) - ESTATE_MAX_BANNED_IDS);
- LLNotificationsUtil::add("MaxAgentOnRegionBatch", args);
- delete change_info;
- return;
- }
-
- uuid_vec_t ids_allowed;
- std::vector<LLAvatarName> names_allowed;
- std::string already_banned;
- std::string em_ban;
- bool single = true;
- for (U32 i = 0; i < ids.size(); ++i)
- {
- bool is_allowed = true;
- LLScrollListItem* em_item = em_list->getNameItemByAgentId(ids[i]);
- if (em_item)
- {
- if (!em_ban.empty())
- {
- em_ban += ", ";
- }
- em_ban += em_item->getColumn(0)->getValue().asString();
- is_allowed = false;
- }
-
- LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]);
- if (item)
- {
- if (!already_banned.empty())
- {
- already_banned += ", ";
- single = false;
- }
- already_banned += item->getColumn(0)->getValue().asString();
- is_allowed = false;
- }
-
- if (is_allowed)
- {
- ids_allowed.push_back(ids[i]);
- names_allowed.push_back(names[i]);
- }
- }
- if (!em_ban.empty())
- {
- LLSD args;
- args["AGENT"] = em_ban;
- LLNotificationsUtil::add("ProblemBanningEstateManager", args);
- if (ids_allowed.empty())
- {
- delete change_info;
- return;
- }
- }
- if (!already_banned.empty())
- {
- LLSD args;
- args["AGENT"] = already_banned;
- args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeBannedAgents");
- LLNotificationsUtil::add(single ? "AgentIsAlreadyInList" : "AgentsAreAlreadyInList", args);
- if (ids_allowed.empty())
- {
- delete change_info;
- return;
- }
- }
- change_info->mAgentOrGroupIDs = ids_allowed;
- change_info->mAgentNames = names_allowed;
- }
-
- LLSD args;
- args["ALL_ESTATES"] = all_estates_text();
- LLNotification::Params params(change_info->mDialogName);
- params.substitutions(args)
- .payload(change_info->asLLSD())
- .functor.function(accessCoreConfirm);
-
- if (LLPanelEstateInfo::isLindenEstate())
- {
- // just apply to this estate
- LLNotifications::instance().forceResponse(params, 0);
- }
- else
- {
- // ask if this estate or all estates with this owner
- LLNotifications::instance().add(params);
- }
+ LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data;
+ if (!change_info) return;
+ if (ids.empty())
+ {
+ // User didn't select a name.
+ delete change_info;
+ change_info = NULL;
+ return;
+ }
+ // User did select a name.
+ change_info->mAgentOrGroupIDs = ids;
+ // Can't put estate owner on ban list
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (!panel) return;
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region) return;
+
+ if (change_info->mOperationFlag & ESTATE_ACCESS_ALLOWED_AGENT_ADD)
+ {
+ LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list");
+ int currentCount = (name_list ? name_list->getItemCount() : 0);
+ if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS)
+ {
+ LLSD args;
+ args["NUM_ADDED"] = llformat("%d", ids.size());
+ args["MAX_AGENTS"] = llformat("%d", ESTATE_MAX_ACCESS_IDS);
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeAllowedAgents");
+ args["NUM_EXCESS"] = llformat("%d", (ids.size() + currentCount) - ESTATE_MAX_ACCESS_IDS);
+ LLNotificationsUtil::add("MaxAgentOnRegionBatch", args);
+ delete change_info;
+ return;
+ }
+
+ uuid_vec_t ids_allowed;
+ std::vector<LLAvatarName> names_allowed;
+ std::string already_allowed;
+ bool single = true;
+ for (U32 i = 0; i < ids.size(); ++i)
+ {
+ LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]);
+ if (item)
+ {
+ if (!already_allowed.empty())
+ {
+ already_allowed += ", ";
+ single = false;
+ }
+ already_allowed += item->getColumn(0)->getValue().asString();
+ }
+ else
+ {
+ ids_allowed.push_back(ids[i]);
+ names_allowed.push_back(names[i]);
+ }
+ }
+ if (!already_allowed.empty())
+ {
+ LLSD args;
+ args["AGENT"] = already_allowed;
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeAllowedAgents");
+ LLNotificationsUtil::add(single ? "AgentIsAlreadyInList" : "AgentsAreAlreadyInList", args);
+ if (ids_allowed.empty())
+ {
+ delete change_info;
+ return;
+ }
+ }
+ change_info->mAgentOrGroupIDs = ids_allowed;
+ change_info->mAgentNames = names_allowed;
+ }
+ if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD)
+ {
+ LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list");
+ LLNameListCtrl* em_list = panel->getChild<LLNameListCtrl>("estate_manager_name_list");
+ int currentCount = (name_list ? name_list->getItemCount() : 0);
+ if (ids.size() + currentCount > ESTATE_MAX_BANNED_IDS)
+ {
+ LLSD args;
+ args["NUM_ADDED"] = llformat("%d", ids.size());
+ args["MAX_AGENTS"] = llformat("%d", ESTATE_MAX_BANNED_IDS);
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeBannedAgents");
+ args["NUM_EXCESS"] = llformat("%d", (ids.size() + currentCount) - ESTATE_MAX_BANNED_IDS);
+ LLNotificationsUtil::add("MaxAgentOnRegionBatch", args);
+ delete change_info;
+ return;
+ }
+
+ uuid_vec_t ids_allowed;
+ std::vector<LLAvatarName> names_allowed;
+ std::string already_banned;
+ std::string em_ban;
+ bool single = true;
+ for (U32 i = 0; i < ids.size(); ++i)
+ {
+ bool is_allowed = true;
+ LLScrollListItem* em_item = em_list->getNameItemByAgentId(ids[i]);
+ if (em_item)
+ {
+ if (!em_ban.empty())
+ {
+ em_ban += ", ";
+ }
+ em_ban += em_item->getColumn(0)->getValue().asString();
+ is_allowed = false;
+ }
+
+ LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]);
+ if (item)
+ {
+ if (!already_banned.empty())
+ {
+ already_banned += ", ";
+ single = false;
+ }
+ already_banned += item->getColumn(0)->getValue().asString();
+ is_allowed = false;
+ }
+
+ if (is_allowed)
+ {
+ ids_allowed.push_back(ids[i]);
+ names_allowed.push_back(names[i]);
+ }
+ }
+ if (!em_ban.empty())
+ {
+ LLSD args;
+ args["AGENT"] = em_ban;
+ LLNotificationsUtil::add("ProblemBanningEstateManager", args);
+ if (ids_allowed.empty())
+ {
+ delete change_info;
+ return;
+ }
+ }
+ if (!already_banned.empty())
+ {
+ LLSD args;
+ args["AGENT"] = already_banned;
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeBannedAgents");
+ LLNotificationsUtil::add(single ? "AgentIsAlreadyInList" : "AgentsAreAlreadyInList", args);
+ if (ids_allowed.empty())
+ {
+ delete change_info;
+ return;
+ }
+ }
+ change_info->mAgentOrGroupIDs = ids_allowed;
+ change_info->mAgentNames = names_allowed;
+ }
+
+ LLSD args;
+ args["ALL_ESTATES"] = all_estates_text();
+ LLNotification::Params params(change_info->mDialogName);
+ params.substitutions(args)
+ .payload(change_info->asLLSD())
+ .functor.function(accessCoreConfirm);
+
+ if (LLPanelEstateInfo::isLindenEstate())
+ {
+ // just apply to this estate
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ else
+ {
+ // ask if this estate or all estates with this owner
+ LLNotifications::instance().add(params);
+ }
}
// static
void LLPanelEstateAccess::accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name)
{
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (!panel) return;
- LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_ctrl_name);
- if (!name_list) return;
-
- std::vector<LLScrollListItem*> list_vector = name_list->getAllSelected();
- if (list_vector.size() == 0)
- return;
-
- LLSD payload;
- payload["operation"] = (S32)operation_flag;
- payload["dialog_name"] = dialog_name;
-
- for (std::vector<LLScrollListItem*>::const_iterator iter = list_vector.begin();
- iter != list_vector.end();
- iter++)
- {
- LLScrollListItem *item = (*iter);
- payload["allowed_ids"].append(item->getUUID());
- }
-
- LLNotification::Params params("ChangeLindenAccess");
- params.payload(payload)
- .functor.function(accessRemoveCore2);
-
- if (LLPanelEstateInfo::isLindenEstate())
- {
- // warn on change linden estate
- LLNotifications::instance().add(params);
- }
- else
- {
- // just proceed, as if clicking OK
- LLNotifications::instance().forceResponse(params, 0);
- }
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (!panel) return;
+ LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_ctrl_name);
+ if (!name_list) return;
+
+ std::vector<LLScrollListItem*> list_vector = name_list->getAllSelected();
+ if (list_vector.size() == 0)
+ return;
+
+ LLSD payload;
+ payload["operation"] = (S32)operation_flag;
+ payload["dialog_name"] = dialog_name;
+
+ for (std::vector<LLScrollListItem*>::const_iterator iter = list_vector.begin();
+ iter != list_vector.end();
+ iter++)
+ {
+ LLScrollListItem *item = (*iter);
+ payload["allowed_ids"].append(item->getUUID());
+ }
+
+ LLNotification::Params params("ChangeLindenAccess");
+ params.payload(payload)
+ .functor.function(accessRemoveCore2);
+
+ if (LLPanelEstateInfo::isLindenEstate())
+ {
+ // warn on change linden estate
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ // just proceed, as if clicking OK
+ LLNotifications::instance().forceResponse(params, 0);
+ }
}
// static
bool LLPanelEstateAccess::accessRemoveCore2(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0)
- {
- // abort
- return false;
- }
-
- // If Linden estate, can only apply to "this" estate, not all estates
- // owned by NULL.
- if (LLPanelEstateInfo::isLindenEstate())
- {
- accessCoreConfirm(notification, response);
- }
- else
- {
- LLSD args;
- args["ALL_ESTATES"] = all_estates_text();
- LLNotificationsUtil::add(notification["payload"]["dialog_name"],
- args,
- notification["payload"],
- accessCoreConfirm);
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0)
+ {
+ // abort
+ return false;
+ }
+
+ // If Linden estate, can only apply to "this" estate, not all estates
+ // owned by NULL.
+ if (LLPanelEstateInfo::isLindenEstate())
+ {
+ accessCoreConfirm(notification, response);
+ }
+ else
+ {
+ LLSD args;
+ args["ALL_ESTATES"] = all_estates_text();
+ LLNotificationsUtil::add(notification["payload"]["dialog_name"],
+ args,
+ notification["payload"],
+ accessCoreConfirm);
+ }
+ return false;
}
// Used for both access add and remove operations, depending on the mOperationFlag
@@ -3356,133 +3356,133 @@ bool LLPanelEstateAccess::accessRemoveCore2(const LLSD& notification, const LLSD
// static
bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- const U32 originalFlags = (U32)notification["payload"]["operation"].asInteger();
- U32 flags = originalFlags;
-
- LLViewerRegion* region = gAgent.getRegion();
-
- if (option == 2) // cancel
- {
- return false;
- }
- else if (option == 1)
- {
- // All estates, either than I own or manage for this owner.
- // This will be verified on simulator. JC
- if (!region) return false;
- if (region->getOwner() == gAgent.getID()
- || gAgent.isGodlike())
- {
- flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES;
- }
- else if (region->isEstateManager())
- {
- flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES;
- }
- }
-
- std::string names;
- U32 listed_names = 0;
- for (U32 i = 0; i < notification["payload"]["allowed_ids"].size(); ++i)
- {
- if (i + 1 != notification["payload"]["allowed_ids"].size())
- {
- flags |= ESTATE_ACCESS_NO_REPLY;
- }
- else
- {
- flags &= ~ESTATE_ACCESS_NO_REPLY;
- }
-
- const LLUUID id = notification["payload"]["allowed_ids"][i].asUUID();
- if (((U32)notification["payload"]["operation"].asInteger() & ESTATE_ACCESS_BANNED_AGENT_ADD)
- && region && (region->getOwner() == id))
- {
- LLNotificationsUtil::add("OwnerCanNotBeDenied");
- break;
- }
-
- sendEstateAccessDelta(flags, id);
-
- if ((flags & (ESTATE_ACCESS_ALLOWED_GROUP_ADD | ESTATE_ACCESS_ALLOWED_GROUP_REMOVE)) == 0)
- {
- // fill the name list for confirmation
- if (listed_names < MAX_LISTED_NAMES)
- {
- if (!names.empty())
- {
- names += ", ";
- }
- if (!notification["payload"]["allowed_names"][i]["display_name"].asString().empty())
- {
- names += notification["payload"]["allowed_names"][i]["display_name"].asString();
- }
- else
- { //try to get an agent name from cache
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(id, &av_name))
- {
- names += av_name.getCompleteName();
- }
- }
-
- }
- listed_names++;
- }
- }
- if (listed_names > MAX_LISTED_NAMES)
- {
- LLSD args;
- args["EXTRA_COUNT"] = llformat("%d", listed_names - MAX_LISTED_NAMES);
- names += " " + LLTrans::getString("AndNMore", args);
- }
-
- if (!names.empty()) // show the conirmation
- {
- LLSD args;
- args["AGENT"] = names;
-
- if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE))
- {
- args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeAllowedAgents");
- }
- else if (flags & (ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_REMOVE))
- {
- args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeBannedAgents");
- }
-
- if (flags & ESTATE_ACCESS_APPLY_TO_ALL_ESTATES)
- {
- args["ESTATE"] = LLTrans::getString("RegionInfoAllEstates");
- }
- else if (flags & ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES)
- {
- args["ESTATE"] = LLTrans::getString("RegionInfoManagedEstates");
- }
- else
- {
- args["ESTATE"] = LLTrans::getString("RegionInfoThisEstate");
- }
-
- bool single = (listed_names == 1);
- if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_ADD))
- {
- LLNotificationsUtil::add(single ? "AgentWasAddedToList" : "AgentsWereAddedToList", args);
- }
- else if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | ESTATE_ACCESS_BANNED_AGENT_REMOVE))
- {
- LLNotificationsUtil::add(single ? "AgentWasRemovedFromList" : "AgentsWereRemovedFromList", args);
- }
- }
-
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (panel)
- {
- panel->setPendingUpdate(true);
- }
-
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ const U32 originalFlags = (U32)notification["payload"]["operation"].asInteger();
+ U32 flags = originalFlags;
+
+ LLViewerRegion* region = gAgent.getRegion();
+
+ if (option == 2) // cancel
+ {
+ return false;
+ }
+ else if (option == 1)
+ {
+ // All estates, either than I own or manage for this owner.
+ // This will be verified on simulator. JC
+ if (!region) return false;
+ if (region->getOwner() == gAgent.getID()
+ || gAgent.isGodlike())
+ {
+ flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES;
+ }
+ else if (region->isEstateManager())
+ {
+ flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES;
+ }
+ }
+
+ std::string names;
+ U32 listed_names = 0;
+ for (U32 i = 0; i < notification["payload"]["allowed_ids"].size(); ++i)
+ {
+ if (i + 1 != notification["payload"]["allowed_ids"].size())
+ {
+ flags |= ESTATE_ACCESS_NO_REPLY;
+ }
+ else
+ {
+ flags &= ~ESTATE_ACCESS_NO_REPLY;
+ }
+
+ const LLUUID id = notification["payload"]["allowed_ids"][i].asUUID();
+ if (((U32)notification["payload"]["operation"].asInteger() & ESTATE_ACCESS_BANNED_AGENT_ADD)
+ && region && (region->getOwner() == id))
+ {
+ LLNotificationsUtil::add("OwnerCanNotBeDenied");
+ break;
+ }
+
+ sendEstateAccessDelta(flags, id);
+
+ if ((flags & (ESTATE_ACCESS_ALLOWED_GROUP_ADD | ESTATE_ACCESS_ALLOWED_GROUP_REMOVE)) == 0)
+ {
+ // fill the name list for confirmation
+ if (listed_names < MAX_LISTED_NAMES)
+ {
+ if (!names.empty())
+ {
+ names += ", ";
+ }
+ if (!notification["payload"]["allowed_names"][i]["display_name"].asString().empty())
+ {
+ names += notification["payload"]["allowed_names"][i]["display_name"].asString();
+ }
+ else
+ { //try to get an agent name from cache
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(id, &av_name))
+ {
+ names += av_name.getCompleteName();
+ }
+ }
+
+ }
+ listed_names++;
+ }
+ }
+ if (listed_names > MAX_LISTED_NAMES)
+ {
+ LLSD args;
+ args["EXTRA_COUNT"] = llformat("%d", listed_names - MAX_LISTED_NAMES);
+ names += " " + LLTrans::getString("AndNMore", args);
+ }
+
+ if (!names.empty()) // show the conirmation
+ {
+ LLSD args;
+ args["AGENT"] = names;
+
+ if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE))
+ {
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeAllowedAgents");
+ }
+ else if (flags & (ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_REMOVE))
+ {
+ args["LIST_TYPE"] = LLTrans::getString("RegionInfoListTypeBannedAgents");
+ }
+
+ if (flags & ESTATE_ACCESS_APPLY_TO_ALL_ESTATES)
+ {
+ args["ESTATE"] = LLTrans::getString("RegionInfoAllEstates");
+ }
+ else if (flags & ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES)
+ {
+ args["ESTATE"] = LLTrans::getString("RegionInfoManagedEstates");
+ }
+ else
+ {
+ args["ESTATE"] = LLTrans::getString("RegionInfoThisEstate");
+ }
+
+ bool single = (listed_names == 1);
+ if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_ADD))
+ {
+ LLNotificationsUtil::add(single ? "AgentWasAddedToList" : "AgentsWereAddedToList", args);
+ }
+ else if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | ESTATE_ACCESS_BANNED_AGENT_REMOVE))
+ {
+ LLNotificationsUtil::add(single ? "AgentWasRemovedFromList" : "AgentsWereRemovedFromList", args);
+ }
+ }
+
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (panel)
+ {
+ panel->setPendingUpdate(true);
+ }
+
+ return false;
}
// key = "estateaccessdelta"
@@ -3493,164 +3493,164 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
// static
void LLPanelEstateAccess::sendEstateAccessDelta(U32 flags, const LLUUID& agent_or_group_id)
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("EstateOwnerMessage");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("EstateOwnerMessage");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", "estateaccessdelta");
- msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice());
+ msg->nextBlock("MethodData");
+ msg->addString("Method", "estateaccessdelta");
+ msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice());
- std::string buf;
- gAgent.getID().toString(buf);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buf);
+ std::string buf;
+ gAgent.getID().toString(buf);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", buf);
- buf = llformat("%u", flags);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buf);
+ buf = llformat("%u", flags);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", buf);
- agent_or_group_id.toString(buf);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buf);
+ agent_or_group_id.toString(buf);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", buf);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
}
void LLPanelEstateAccess::updateChild(LLUICtrl* child_ctrl)
{
- // Ensure appropriate state of the management ui.
- updateControls(gAgent.getRegion());
+ // Ensure appropriate state of the management ui.
+ updateControls(gAgent.getRegion());
}
void LLPanelEstateAccess::updateLists()
{
- std::string cap_url = gAgent.getRegionCapability("EstateAccess");
- if (!cap_url.empty())
- {
- LLCoros::instance().launch("LLFloaterRegionInfo::requestEstateGetAccessCoro", boost::bind(LLPanelEstateAccess::requestEstateGetAccessCoro, cap_url));
- }
+ std::string cap_url = gAgent.getRegionCapability("EstateAccess");
+ if (!cap_url.empty())
+ {
+ LLCoros::instance().launch("LLFloaterRegionInfo::requestEstateGetAccessCoro", boost::bind(LLPanelEstateAccess::requestEstateGetAccessCoro, cap_url));
+ }
}
void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
{
- LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestEstateGetAccessoCoro", httpPolicy));
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
-
- LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
-
- LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
-
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (!panel) return;
-
- LLNameListCtrl* allowed_agent_name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list");
- if (allowed_agent_name_list && result.has("AllowedAgents"))
- {
- LLStringUtil::format_map_t args;
- args["[ALLOWEDAGENTS]"] = llformat("%d", result["AllowedAgents"].size());
- args["[MAXACCESS]"] = llformat("%d", ESTATE_MAX_ACCESS_IDS);
- std::string msg = LLTrans::getString("RegionInfoAllowedResidents", args);
- panel->getChild<LLUICtrl>("allow_resident_label")->setValue(LLSD(msg));
-
- allowed_agent_name_list->clearSortOrder();
- allowed_agent_name_list->deleteAllItems();
- for (LLSD::array_const_iterator it = result["AllowedAgents"].beginArray(); it != result["AllowedAgents"].endArray(); ++it)
- {
- LLUUID id = (*it)["id"].asUUID();
- allowed_agent_name_list->addNameItem(id);
- }
- allowed_agent_name_list->sortByName(TRUE);
- }
-
- LLNameListCtrl* banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list");
- if (banned_agent_name_list && result.has("BannedAgents"))
- {
- LLStringUtil::format_map_t args;
- args["[BANNEDAGENTS]"] = llformat("%d", result["BannedAgents"].size());
- args["[MAXBANNED]"] = llformat("%d", ESTATE_MAX_BANNED_IDS);
- std::string msg = LLTrans::getString("RegionInfoBannedResidents", args);
- panel->getChild<LLUICtrl>("ban_resident_label")->setValue(LLSD(msg));
-
- banned_agent_name_list->clearSortOrder();
- banned_agent_name_list->deleteAllItems();
- for (LLSD::array_const_iterator it = result["BannedAgents"].beginArray(); it != result["BannedAgents"].endArray(); ++it)
- {
- LLSD item;
- item["id"] = (*it)["id"].asUUID();
- LLSD& columns = item["columns"];
-
- columns[0]["column"] = "name"; // to be populated later
-
- columns[1]["column"] = "last_login_date";
- columns[1]["value"] = (*it)["last_login_date"].asString().substr(0, 16); // cut the seconds
-
- std::string ban_date = (*it)["ban_date"].asString();
- columns[2]["column"] = "ban_date";
- columns[2]["value"] = ban_date[0] != '0' ? ban_date.substr(0, 16) : LLTrans::getString("na"); // server returns the "0000-00-00 00:00:00" date in case it doesn't know it
-
- columns[3]["column"] = "bannedby";
- LLUUID banning_id = (*it)["banning_id"].asUUID();
- LLAvatarName av_name;
- if (banning_id.isNull())
- {
- columns[3]["value"] = LLTrans::getString("na");
- }
- else if (LLAvatarNameCache::get(banning_id, &av_name))
- {
- columns[3]["value"] = av_name.getCompleteName(); //TODO: fetch the name if it wasn't cached
- }
-
- banned_agent_name_list->addElement(item);
- }
- banned_agent_name_list->sortByName(TRUE);
- }
-
- LLNameListCtrl* allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list");
- if (allowed_group_name_list && result.has("AllowedGroups"))
- {
- LLStringUtil::format_map_t args;
- args["[ALLOWEDGROUPS]"] = llformat("%d", result["AllowedGroups"].size());
- args["[MAXACCESS]"] = llformat("%d", ESTATE_MAX_GROUP_IDS);
- std::string msg = LLTrans::getString("RegionInfoAllowedGroups", args);
- panel->getChild<LLUICtrl>("allow_group_label")->setValue(LLSD(msg));
-
- allowed_group_name_list->clearSortOrder();
- allowed_group_name_list->deleteAllItems();
- for (LLSD::array_const_iterator it = result["AllowedGroups"].beginArray(); it != result["AllowedGroups"].endArray(); ++it)
- {
- LLUUID id = (*it)["id"].asUUID();
- allowed_group_name_list->addGroupNameItem(id);
- }
- allowed_group_name_list->sortByName(TRUE);
- }
-
- LLNameListCtrl* estate_manager_name_list = panel->getChild<LLNameListCtrl>("estate_manager_name_list");
- if (estate_manager_name_list && result.has("Managers"))
- {
- LLStringUtil::format_map_t args;
- args["[ESTATEMANAGERS]"] = llformat("%d", result["Managers"].size());
- args["[MAXMANAGERS]"] = llformat("%d", ESTATE_MAX_MANAGERS);
- std::string msg = LLTrans::getString("RegionInfoEstateManagers", args);
- panel->getChild<LLUICtrl>("estate_manager_label")->setValue(LLSD(msg));
-
- estate_manager_name_list->clearSortOrder();
- estate_manager_name_list->deleteAllItems();
- for (LLSD::array_const_iterator it = result["Managers"].beginArray(); it != result["Managers"].endArray(); ++it)
- {
- LLUUID id = (*it)["agent_id"].asUUID();
- estate_manager_name_list->addNameItem(id);
- }
- estate_manager_name_list->sortByName(TRUE);
- }
-
-
- panel->updateControls(gAgent.getRegion());
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestEstateGetAccessoCoro", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+ LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
+
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (!panel) return;
+
+ LLNameListCtrl* allowed_agent_name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list");
+ if (allowed_agent_name_list && result.has("AllowedAgents"))
+ {
+ LLStringUtil::format_map_t args;
+ args["[ALLOWEDAGENTS]"] = llformat("%d", result["AllowedAgents"].size());
+ args["[MAXACCESS]"] = llformat("%d", ESTATE_MAX_ACCESS_IDS);
+ std::string msg = LLTrans::getString("RegionInfoAllowedResidents", args);
+ panel->getChild<LLUICtrl>("allow_resident_label")->setValue(LLSD(msg));
+
+ allowed_agent_name_list->clearSortOrder();
+ allowed_agent_name_list->deleteAllItems();
+ for (LLSD::array_const_iterator it = result["AllowedAgents"].beginArray(); it != result["AllowedAgents"].endArray(); ++it)
+ {
+ LLUUID id = (*it)["id"].asUUID();
+ allowed_agent_name_list->addNameItem(id);
+ }
+ allowed_agent_name_list->sortByName(TRUE);
+ }
+
+ LLNameListCtrl* banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list");
+ if (banned_agent_name_list && result.has("BannedAgents"))
+ {
+ LLStringUtil::format_map_t args;
+ args["[BANNEDAGENTS]"] = llformat("%d", result["BannedAgents"].size());
+ args["[MAXBANNED]"] = llformat("%d", ESTATE_MAX_BANNED_IDS);
+ std::string msg = LLTrans::getString("RegionInfoBannedResidents", args);
+ panel->getChild<LLUICtrl>("ban_resident_label")->setValue(LLSD(msg));
+
+ banned_agent_name_list->clearSortOrder();
+ banned_agent_name_list->deleteAllItems();
+ for (LLSD::array_const_iterator it = result["BannedAgents"].beginArray(); it != result["BannedAgents"].endArray(); ++it)
+ {
+ LLSD item;
+ item["id"] = (*it)["id"].asUUID();
+ LLSD& columns = item["columns"];
+
+ columns[0]["column"] = "name"; // to be populated later
+
+ columns[1]["column"] = "last_login_date";
+ columns[1]["value"] = (*it)["last_login_date"].asString().substr(0, 16); // cut the seconds
+
+ std::string ban_date = (*it)["ban_date"].asString();
+ columns[2]["column"] = "ban_date";
+ columns[2]["value"] = ban_date[0] != '0' ? ban_date.substr(0, 16) : LLTrans::getString("na"); // server returns the "0000-00-00 00:00:00" date in case it doesn't know it
+
+ columns[3]["column"] = "bannedby";
+ LLUUID banning_id = (*it)["banning_id"].asUUID();
+ LLAvatarName av_name;
+ if (banning_id.isNull())
+ {
+ columns[3]["value"] = LLTrans::getString("na");
+ }
+ else if (LLAvatarNameCache::get(banning_id, &av_name))
+ {
+ columns[3]["value"] = av_name.getCompleteName(); //TODO: fetch the name if it wasn't cached
+ }
+
+ banned_agent_name_list->addElement(item);
+ }
+ banned_agent_name_list->sortByName(TRUE);
+ }
+
+ LLNameListCtrl* allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list");
+ if (allowed_group_name_list && result.has("AllowedGroups"))
+ {
+ LLStringUtil::format_map_t args;
+ args["[ALLOWEDGROUPS]"] = llformat("%d", result["AllowedGroups"].size());
+ args["[MAXACCESS]"] = llformat("%d", ESTATE_MAX_GROUP_IDS);
+ std::string msg = LLTrans::getString("RegionInfoAllowedGroups", args);
+ panel->getChild<LLUICtrl>("allow_group_label")->setValue(LLSD(msg));
+
+ allowed_group_name_list->clearSortOrder();
+ allowed_group_name_list->deleteAllItems();
+ for (LLSD::array_const_iterator it = result["AllowedGroups"].beginArray(); it != result["AllowedGroups"].endArray(); ++it)
+ {
+ LLUUID id = (*it)["id"].asUUID();
+ allowed_group_name_list->addGroupNameItem(id);
+ }
+ allowed_group_name_list->sortByName(TRUE);
+ }
+
+ LLNameListCtrl* estate_manager_name_list = panel->getChild<LLNameListCtrl>("estate_manager_name_list");
+ if (estate_manager_name_list && result.has("Managers"))
+ {
+ LLStringUtil::format_map_t args;
+ args["[ESTATEMANAGERS]"] = llformat("%d", result["Managers"].size());
+ args["[MAXMANAGERS]"] = llformat("%d", ESTATE_MAX_MANAGERS);
+ std::string msg = LLTrans::getString("RegionInfoEstateManagers", args);
+ panel->getChild<LLUICtrl>("estate_manager_label")->setValue(LLSD(msg));
+
+ estate_manager_name_list->clearSortOrder();
+ estate_manager_name_list->deleteAllItems();
+ for (LLSD::array_const_iterator it = result["Managers"].beginArray(); it != result["Managers"].endArray(); ++it)
+ {
+ LLUUID id = (*it)["agent_id"].asUUID();
+ estate_manager_name_list->addNameItem(id);
+ }
+ estate_manager_name_list->sortByName(TRUE);
+ }
+
+
+ panel->updateControls(gAgent.getRegion());
}
//---------------------------------------------------------------------------
@@ -3658,76 +3658,76 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
//---------------------------------------------------------------------------
void LLPanelEstateAccess::onAllowedSearchEdit(const std::string& search_string)
{
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (!panel) return;
- LLNameListCtrl* allowed_agent_name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list");
- searchAgent(allowed_agent_name_list, search_string);
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (!panel) return;
+ LLNameListCtrl* allowed_agent_name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list");
+ searchAgent(allowed_agent_name_list, search_string);
}
void LLPanelEstateAccess::onAllowedGroupsSearchEdit(const std::string& search_string)
{
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (!panel) return;
- LLNameListCtrl* allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list");
- searchAgent(allowed_group_name_list, search_string);
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (!panel) return;
+ LLNameListCtrl* allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list");
+ searchAgent(allowed_group_name_list, search_string);
}
void LLPanelEstateAccess::onBannedSearchEdit(const std::string& search_string)
{
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (!panel) return;
- LLNameListCtrl* banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list");
- searchAgent(banned_agent_name_list, search_string);
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (!panel) return;
+ LLNameListCtrl* banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list");
+ searchAgent(banned_agent_name_list, search_string);
}
void LLPanelEstateAccess::searchAgent(LLNameListCtrl* listCtrl, const std::string& search_string)
{
- if (!listCtrl) return;
+ if (!listCtrl) return;
- if (!search_string.empty())
- {
- listCtrl->setSearchColumn(0); // name column
- listCtrl->searchItems(search_string, false, true);
- }
- else
- {
- listCtrl->deselectAllItems(TRUE);
- }
+ if (!search_string.empty())
+ {
+ listCtrl->setSearchColumn(0); // name column
+ listCtrl->searchItems(search_string, false, true);
+ }
+ else
+ {
+ listCtrl->deselectAllItems(TRUE);
+ }
}
void LLPanelEstateAccess::copyListToClipboard(std::string list_name)
{
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- if (!panel) return;
- LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_name);
- if (!name_list) return;
-
- std::vector<LLScrollListItem*> list_vector = name_list->getAllData();
- if (list_vector.size() == 0) return;
-
- LLSD::String list_to_copy;
- for (std::vector<LLScrollListItem*>::const_iterator iter = list_vector.begin();
- iter != list_vector.end();
- iter++)
- {
- LLScrollListItem *item = (*iter);
- if (item)
- {
- list_to_copy += item->getColumn(0)->getValue().asString();
- }
- if (std::next(iter) != list_vector.end())
- {
- list_to_copy += "\n";
- }
- }
-
- LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, list_to_copy.length());
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (!panel) return;
+ LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_name);
+ if (!name_list) return;
+
+ std::vector<LLScrollListItem*> list_vector = name_list->getAllData();
+ if (list_vector.size() == 0) return;
+
+ LLSD::String list_to_copy;
+ for (std::vector<LLScrollListItem*>::const_iterator iter = list_vector.begin();
+ iter != list_vector.end();
+ iter++)
+ {
+ LLScrollListItem *item = (*iter);
+ if (item)
+ {
+ list_to_copy += item->getColumn(0)->getValue().asString();
+ }
+ if (std::next(iter) != list_vector.end())
+ {
+ list_to_copy += "\n";
+ }
+ }
+
+ LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, list_to_copy.length());
}
bool LLPanelEstateAccess::refreshFromRegion(LLViewerRegion* region)
{
- updateLists();
- return LLPanelRegionInfo::refreshFromRegion(region);
+ updateLists();
+ return LLPanelRegionInfo::refreshFromRegion(region);
}
//=========================================================================
@@ -3863,10 +3863,10 @@ void LLPanelRegionEnvironment::onChkAllowOverride(bool value)
if (LLPanelEstateInfo::isLindenEstate())
notification = "ChangeLindenEstate";
- LLSD args;
- args["ESTATENAME"] = LLEstateInfoModel::instance().getName();
- LLNotification::Params params(notification);
- params.substitutions(args);
+ LLSD args;
+ args["ESTATENAME"] = LLEstateInfoModel::instance().getName();
+ LLNotification::Params params(notification);
+ params.substitutions(args);
params.functor.function([this](const LLSD& notification, const LLSD& response) { confirmUpdateEstateEnvironment(notification, response); });
if (!value || LLPanelEstateInfo::isLindenEstate())
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 3eb39b250f..d235877988 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterregioninfo.h
* @author Aaron Brashears
* @brief Declaration of the region info and controls floater and panels.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -71,58 +71,58 @@ class LLEventTimer;
class LLFloaterRegionInfo : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ BOOL postBuild();
+
+ static void processEstateOwnerRequest(LLMessageSystem* msg, void**);
- static void processEstateOwnerRequest(LLMessageSystem* msg, void**);
+ // get and process region info if necessary.
+ static void processRegionInfo(LLMessageSystem* msg);
- // get and process region info if necessary.
- static void processRegionInfo(LLMessageSystem* msg);
+ static const LLUUID& getLastInvoice() { return sRequestInvoice; }
+ static void nextInvoice() { sRequestInvoice.generate(); }
+ //static S32 getSerial() { return sRequestSerial; }
+ //static void incrementSerial() { sRequestSerial++; }
- static const LLUUID& getLastInvoice() { return sRequestInvoice; }
- static void nextInvoice() { sRequestInvoice.generate(); }
- //static S32 getSerial() { return sRequestSerial; }
- //static void incrementSerial() { sRequestSerial++; }
+ static LLPanelEstateInfo* getPanelEstate();
+ static LLPanelEstateAccess* getPanelAccess();
+ static LLPanelEstateCovenant* getPanelCovenant();
+ static LLPanelRegionTerrainInfo* getPanelRegionTerrain();
+ static LLPanelRegionExperiences* getPanelExperiences();
+ static LLPanelRegionGeneralInfo* getPanelGeneral();
+ static LLPanelRegionEnvironment* getPanelEnvironment();
- static LLPanelEstateInfo* getPanelEstate();
- static LLPanelEstateAccess* getPanelAccess();
- static LLPanelEstateCovenant* getPanelCovenant();
- static LLPanelRegionTerrainInfo* getPanelRegionTerrain();
- static LLPanelRegionExperiences* getPanelExperiences();
- static LLPanelRegionGeneralInfo* getPanelGeneral();
- static LLPanelRegionEnvironment* getPanelEnvironment();
+ // from LLPanel
+ virtual void refresh();
- // from LLPanel
- virtual void refresh();
-
- void onRegionChanged();
- void requestRegionInfo();
- void enableTopButtons();
- void disableTopButtons();
+ void onRegionChanged();
+ void requestRegionInfo();
+ void enableTopButtons();
+ void disableTopButtons();
private:
-
- LLFloaterRegionInfo(const LLSD& seed);
- ~LLFloaterRegionInfo();
+
+ LLFloaterRegionInfo(const LLSD& seed);
+ ~LLFloaterRegionInfo();
protected:
- void onTabSelected(const LLSD& param);
- void disableTabCtrls();
- void refreshFromRegion(LLViewerRegion* region);
- void onGodLevelChange(U8 god_level);
-
- // member data
- LLTabContainer* mTab;
- typedef std::vector<LLPanelRegionInfo*> info_panels_t;
- info_panels_t mInfoPanels;
+ void onTabSelected(const LLSD& param);
+ void disableTabCtrls();
+ void refreshFromRegion(LLViewerRegion* region);
+ void onGodLevelChange(U8 god_level);
+
+ // member data
+ LLTabContainer* mTab;
+ typedef std::vector<LLPanelRegionInfo*> info_panels_t;
+ info_panels_t mInfoPanels;
LLPanelRegionEnvironment *mEnvironmentPanel;
- //static S32 sRequestSerial; // serial # of last EstateOwnerRequest
- static LLUUID sRequestInvoice;
+ //static S32 sRequestSerial; // serial # of last EstateOwnerRequest
+ static LLUUID sRequestInvoice;
private:
LLAgent::god_level_change_slot_t mGodLevelChangeSlot;
@@ -134,42 +134,42 @@ private:
class LLPanelRegionInfo : public LLPanel
{
public:
- LLPanelRegionInfo();
-
- void onBtnSet();
- void onChangeChildCtrl(LLUICtrl* ctrl);
- void onChangeAnything();
- static void onChangeText(LLLineEditor* caller, void* user_data);
-
- virtual bool refreshFromRegion(LLViewerRegion* region);
- virtual bool estateUpdate(LLMessageSystem* msg) { return true; }
-
- virtual BOOL postBuild();
- virtual void updateChild(LLUICtrl* child_ctrl);
-
- void enableButton(const std::string& btn_name, BOOL enable = TRUE);
- void disableButton(const std::string& btn_name);
-
- void onClickManageTelehub();
-
+ LLPanelRegionInfo();
+
+ void onBtnSet();
+ void onChangeChildCtrl(LLUICtrl* ctrl);
+ void onChangeAnything();
+ static void onChangeText(LLLineEditor* caller, void* user_data);
+
+ virtual bool refreshFromRegion(LLViewerRegion* region);
+ virtual bool estateUpdate(LLMessageSystem* msg) { return true; }
+
+ virtual BOOL postBuild();
+ virtual void updateChild(LLUICtrl* child_ctrl);
+
+ void enableButton(const std::string& btn_name, BOOL enable = TRUE);
+ void disableButton(const std::string& btn_name);
+
+ void onClickManageTelehub();
+
protected:
- void initCtrl(const std::string& name);
-
- // Returns TRUE if update sent and apply button should be
- // disabled.
- virtual BOOL sendUpdate() { return TRUE; }
-
- typedef std::vector<std::string> strings_t;
- //typedef std::vector<U32> integers_t;
- void sendEstateOwnerMessage(
- LLMessageSystem* msg,
- const std::string& request,
- const LLUUID& invoice,
- const strings_t& strings);
-
-
- // member data
- LLHost mHost;
+ void initCtrl(const std::string& name);
+
+ // Returns TRUE if update sent and apply button should be
+ // disabled.
+ virtual BOOL sendUpdate() { return TRUE; }
+
+ typedef std::vector<std::string> strings_t;
+ //typedef std::vector<U32> integers_t;
+ void sendEstateOwnerMessage(
+ LLMessageSystem* msg,
+ const std::string& request,
+ const LLUUID& invoice,
+ const strings_t& strings);
+
+
+ // member data
+ LLHost mHost;
};
/////////////////////////////////////////////////////////////////////////////
@@ -178,31 +178,31 @@ protected:
class LLPanelRegionGeneralInfo : public LLPanelRegionInfo
{
-
+
public:
- LLPanelRegionGeneralInfo()
- : LLPanelRegionInfo() {}
- ~LLPanelRegionGeneralInfo() {}
-
- virtual bool refreshFromRegion(LLViewerRegion* region);
-
- // LLPanel
- virtual BOOL postBuild();
-
- void onBtnSet();
- void setObjBonusFactor(F32 object_bonus_factor) {mObjBonusFactor = object_bonus_factor;}
+ LLPanelRegionGeneralInfo()
+ : LLPanelRegionInfo() {}
+ ~LLPanelRegionGeneralInfo() {}
+
+ virtual bool refreshFromRegion(LLViewerRegion* region);
+
+ // LLPanel
+ virtual BOOL postBuild();
+
+ void onBtnSet();
+ void setObjBonusFactor(F32 object_bonus_factor) {mObjBonusFactor = object_bonus_factor;}
protected:
- virtual BOOL sendUpdate();
- void onClickKick();
- void onKickCommit(const uuid_vec_t& ids);
- static void onClickKickAll(void* userdata);
- bool onKickAllCommit(const LLSD& notification, const LLSD& response);
- static void onClickMessage(void* userdata);
- bool onMessageCommit(const LLSD& notification, const LLSD& response);
- bool onChangeObjectBonus(const LLSD& notification, const LLSD& response);
+ virtual BOOL sendUpdate();
+ void onClickKick();
+ void onKickCommit(const uuid_vec_t& ids);
+ static void onClickKickAll(void* userdata);
+ bool onKickAllCommit(const LLSD& notification, const LLSD& response);
+ static void onClickMessage(void* userdata);
+ bool onMessageCommit(const LLSD& notification, const LLSD& response);
+ bool onChangeObjectBonus(const LLSD& notification, const LLSD& response);
- F32 mObjBonusFactor;
+ F32 mObjBonusFactor;
};
@@ -211,63 +211,63 @@ protected:
class LLPanelRegionDebugInfo : public LLPanelRegionInfo
{
public:
- LLPanelRegionDebugInfo()
- : LLPanelRegionInfo(), mTargetAvatar() {}
- ~LLPanelRegionDebugInfo() {}
- // LLPanel
- virtual BOOL postBuild();
-
- virtual bool refreshFromRegion(LLViewerRegion* region);
-
+ LLPanelRegionDebugInfo()
+ : LLPanelRegionInfo(), mTargetAvatar() {}
+ ~LLPanelRegionDebugInfo() {}
+ // LLPanel
+ virtual BOOL postBuild();
+
+ virtual bool refreshFromRegion(LLViewerRegion* region);
+
protected:
- virtual BOOL sendUpdate();
-
- void onClickChooseAvatar();
- void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
- static void onClickReturn(void *);
- bool callbackReturn(const LLSD& notification, const LLSD& response);
- static void onClickTopColliders(void*);
- static void onClickTopScripts(void*);
- static void onClickRestart(void* data);
- bool callbackRestart(const LLSD& notification, const LLSD& response);
- static void onClickCancelRestart(void* data);
- static void onClickDebugConsole(void* data);
-
+ virtual BOOL sendUpdate();
+
+ void onClickChooseAvatar();
+ void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
+ static void onClickReturn(void *);
+ bool callbackReturn(const LLSD& notification, const LLSD& response);
+ static void onClickTopColliders(void*);
+ static void onClickTopScripts(void*);
+ static void onClickRestart(void* data);
+ bool callbackRestart(const LLSD& notification, const LLSD& response);
+ static void onClickCancelRestart(void* data);
+ static void onClickDebugConsole(void* data);
+
private:
- LLUUID mTargetAvatar;
+ LLUUID mTargetAvatar;
};
/////////////////////////////////////////////////////////////////////////////
class LLPanelRegionTerrainInfo : public LLPanelRegionInfo
{
- LOG_CLASS(LLPanelRegionTerrainInfo);
+ LOG_CLASS(LLPanelRegionTerrainInfo);
public:
- LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {}
- ~LLPanelRegionTerrainInfo() {}
-
- virtual BOOL postBuild(); // LLPanel
-
- virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator
- void setEnvControls(bool available); // Whether environment settings are available for this region
-
- BOOL validateTextureSizes();
- BOOL validateTextureHeights();
-
- //static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button
-
- virtual BOOL sendUpdate();
-
- static void onClickDownloadRaw(void*);
- static void onClickUploadRaw(void*);
- static void onClickBakeTerrain(void*);
- bool callbackBakeTerrain(const LLSD& notification, const LLSD& response);
- bool callbackTextureHeights(const LLSD& notification, const LLSD& response);
+ LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {}
+ ~LLPanelRegionTerrainInfo() {}
+
+ virtual BOOL postBuild(); // LLPanel
+
+ virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator
+ void setEnvControls(bool available); // Whether environment settings are available for this region
+
+ BOOL validateTextureSizes();
+ BOOL validateTextureHeights();
+
+ //static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button
+
+ virtual BOOL sendUpdate();
+
+ static void onClickDownloadRaw(void*);
+ static void onClickUploadRaw(void*);
+ static void onClickBakeTerrain(void*);
+ bool callbackBakeTerrain(const LLSD& notification, const LLSD& response);
+ bool callbackTextureHeights(const LLSD& notification, const LLSD& response);
private:
- bool mConfirmedTextureHeights;
- bool mAskedTextureHeights;
+ bool mConfirmedTextureHeights;
+ bool mAskedTextureHeights;
};
/////////////////////////////////////////////////////////////////////////////
@@ -275,60 +275,60 @@ private:
class LLPanelEstateInfo : public LLPanelRegionInfo
{
public:
- static void initDispatch(LLDispatcher& dispatch);
-
- void onChangeFixedSun();
- void onChangeUseGlobalTime();
- void onChangeAccessOverride();
-
- void onClickEditSky();
- void onClickEditSkyHelp();
- void onClickEditDayCycle();
- void onClickEditDayCycleHelp();
-
- void onClickKickUser();
-
-
- bool kickUserConfirm(const LLSD& notification, const LLSD& response);
-
- void onKickUserCommit(const uuid_vec_t& ids);
- static void onClickMessageEstate(void* data);
- bool onMessageCommit(const LLSD& notification, const LLSD& response);
-
- LLPanelEstateInfo();
- ~LLPanelEstateInfo() {}
-
- void updateControls(LLViewerRegion* region);
-
- static void updateEstateName(const std::string& name);
- static void updateEstateOwnerName(const std::string& name);
-
- virtual bool refreshFromRegion(LLViewerRegion* region);
- virtual bool estateUpdate(LLMessageSystem* msg);
-
- // LLPanel
- virtual BOOL postBuild();
- virtual void updateChild(LLUICtrl* child_ctrl);
- virtual void refresh();
-
- void refreshFromEstate();
-
- static bool isLindenEstate();
-
- const std::string getOwnerName() const;
- void setOwnerName(const std::string& name);
+ static void initDispatch(LLDispatcher& dispatch);
+
+ void onChangeFixedSun();
+ void onChangeUseGlobalTime();
+ void onChangeAccessOverride();
+
+ void onClickEditSky();
+ void onClickEditSkyHelp();
+ void onClickEditDayCycle();
+ void onClickEditDayCycleHelp();
+
+ void onClickKickUser();
+
+
+ bool kickUserConfirm(const LLSD& notification, const LLSD& response);
+
+ void onKickUserCommit(const uuid_vec_t& ids);
+ static void onClickMessageEstate(void* data);
+ bool onMessageCommit(const LLSD& notification, const LLSD& response);
+
+ LLPanelEstateInfo();
+ ~LLPanelEstateInfo() {}
+
+ void updateControls(LLViewerRegion* region);
+
+ static void updateEstateName(const std::string& name);
+ static void updateEstateOwnerName(const std::string& name);
+
+ virtual bool refreshFromRegion(LLViewerRegion* region);
+ virtual bool estateUpdate(LLMessageSystem* msg);
+
+ // LLPanel
+ virtual BOOL postBuild();
+ virtual void updateChild(LLUICtrl* child_ctrl);
+ virtual void refresh();
+
+ void refreshFromEstate();
+
+ static bool isLindenEstate();
+
+ const std::string getOwnerName() const;
+ void setOwnerName(const std::string& name);
protected:
- virtual BOOL sendUpdate();
- // confirmation dialog callback
- bool callbackChangeLindenEstate(const LLSD& notification, const LLSD& response);
+ virtual BOOL sendUpdate();
+ // confirmation dialog callback
+ bool callbackChangeLindenEstate(const LLSD& notification, const LLSD& response);
+
+ void commitEstateAccess();
+ void commitEstateManagers();
- void commitEstateAccess();
- void commitEstateManagers();
-
- BOOL checkSunHourSlider(LLUICtrl* child_ctrl);
+ BOOL checkSunHourSlider(LLUICtrl* child_ctrl);
- U32 mEstateID;
+ U32 mEstateID;
};
/////////////////////////////////////////////////////////////////////////////
@@ -336,60 +336,60 @@ protected:
class LLPanelEstateCovenant : public LLPanelRegionInfo
{
public:
- LLPanelEstateCovenant();
- ~LLPanelEstateCovenant() {}
-
- // LLPanel
- virtual BOOL postBuild();
- virtual void updateChild(LLUICtrl* child_ctrl);
- virtual bool refreshFromRegion(LLViewerRegion* region);
- virtual bool estateUpdate(LLMessageSystem* msg);
-
- // LLView overrides
- BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type,
- void *cargo_data, EAcceptance *accept,
- std::string& tooltip_msg);
- static bool confirmChangeCovenantCallback(const LLSD& notification, const LLSD& response);
- static void resetCovenantID(void* userdata);
- static bool confirmResetCovenantCallback(const LLSD& notification, const LLSD& response);
- void sendChangeCovenantID(const LLUUID &asset_id);
- void loadInvItem(LLInventoryItem *itemp);
- static void onLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status);
-
- // Accessor functions
- static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
- static void updateEstateName(const std::string& name);
- static void updateLastModified(const std::string& text);
- static void updateEstateOwnerName(const std::string& name);
-
- const LLUUID& getCovenantID() const { return mCovenantID; }
- void setCovenantID(const LLUUID& id) { mCovenantID = id; }
- std::string getEstateName() const;
- void setEstateName(const std::string& name);
- std::string getOwnerName() const;
- void setOwnerName(const std::string& name);
- void setCovenantTextEditor(const std::string& text);
-
- typedef enum e_asset_status
- {
- ASSET_ERROR,
- ASSET_UNLOADED,
- ASSET_LOADING,
- ASSET_LOADED
- } EAssetStatus;
+ LLPanelEstateCovenant();
+ ~LLPanelEstateCovenant() {}
+
+ // LLPanel
+ virtual BOOL postBuild();
+ virtual void updateChild(LLUICtrl* child_ctrl);
+ virtual bool refreshFromRegion(LLViewerRegion* region);
+ virtual bool estateUpdate(LLMessageSystem* msg);
+
+ // LLView overrides
+ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
+ BOOL drop, EDragAndDropType cargo_type,
+ void *cargo_data, EAcceptance *accept,
+ std::string& tooltip_msg);
+ static bool confirmChangeCovenantCallback(const LLSD& notification, const LLSD& response);
+ static void resetCovenantID(void* userdata);
+ static bool confirmResetCovenantCallback(const LLSD& notification, const LLSD& response);
+ void sendChangeCovenantID(const LLUUID &asset_id);
+ void loadInvItem(LLInventoryItem *itemp);
+ static void onLoadComplete(const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status);
+
+ // Accessor functions
+ static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
+ static void updateEstateName(const std::string& name);
+ static void updateLastModified(const std::string& text);
+ static void updateEstateOwnerName(const std::string& name);
+
+ const LLUUID& getCovenantID() const { return mCovenantID; }
+ void setCovenantID(const LLUUID& id) { mCovenantID = id; }
+ std::string getEstateName() const;
+ void setEstateName(const std::string& name);
+ std::string getOwnerName() const;
+ void setOwnerName(const std::string& name);
+ void setCovenantTextEditor(const std::string& text);
+
+ typedef enum e_asset_status
+ {
+ ASSET_ERROR,
+ ASSET_UNLOADED,
+ ASSET_LOADING,
+ ASSET_LOADED
+ } EAssetStatus;
protected:
- virtual BOOL sendUpdate();
- LLTextBox* mEstateNameText;
- LLTextBox* mEstateOwnerText;
- LLTextBox* mLastModifiedText;
- // CovenantID from sim
- LLUUID mCovenantID;
- LLViewerTextEditor* mEditor;
- EAssetStatus mAssetStatus;
+ virtual BOOL sendUpdate();
+ LLTextBox* mEstateNameText;
+ LLTextBox* mEstateOwnerText;
+ LLTextBox* mLastModifiedText;
+ // CovenantID from sim
+ LLUUID mCovenantID;
+ LLViewerTextEditor* mEditor;
+ EAssetStatus mAssetStatus;
};
/////////////////////////////////////////////////////////////////////////////
@@ -400,93 +400,93 @@ class LLPanelRegionExperiences : public LLPanelRegionInfo
LOG_CLASS(LLPanelRegionExperiences);
public:
- LLPanelRegionExperiences(){}
- /*virtual*/ BOOL postBuild();
- virtual BOOL sendUpdate();
-
- static bool experienceCoreConfirm(const LLSD& notification, const LLSD& response);
- static void sendEstateExperienceDelta(U32 flags, const LLUUID& agent_id);
-
- static void infoCallback(LLHandle<LLPanelRegionExperiences> handle, const LLSD& content);
- bool refreshFromRegion(LLViewerRegion* region);
- void sendPurchaseRequest()const;
- void processResponse( const LLSD& content );
+ LLPanelRegionExperiences(){}
+ /*virtual*/ BOOL postBuild();
+ virtual BOOL sendUpdate();
+
+ static bool experienceCoreConfirm(const LLSD& notification, const LLSD& response);
+ static void sendEstateExperienceDelta(U32 flags, const LLUUID& agent_id);
+
+ static void infoCallback(LLHandle<LLPanelRegionExperiences> handle, const LLSD& content);
+ bool refreshFromRegion(LLViewerRegion* region);
+ void sendPurchaseRequest()const;
+ void processResponse( const LLSD& content );
private:
- void refreshRegionExperiences();
+ void refreshRegionExperiences();
static std::string regionCapabilityQuery(LLViewerRegion* region, const std::string &cap);
- LLPanelExperienceListEditor* setupList(const char* control_name, U32 add_id, U32 remove_id);
- static LLSD addIds( LLPanelExperienceListEditor* panel );
+ LLPanelExperienceListEditor* setupList(const char* control_name, U32 add_id, U32 remove_id);
+ static LLSD addIds( LLPanelExperienceListEditor* panel );
- void itemChanged(U32 event_type, const LLUUID& id);
+ void itemChanged(U32 event_type, const LLUUID& id);
- LLPanelExperienceListEditor* mTrusted;
- LLPanelExperienceListEditor* mAllowed;
- LLPanelExperienceListEditor* mBlocked;
- LLUUID mDefaultExperience;
+ LLPanelExperienceListEditor* mTrusted;
+ LLPanelExperienceListEditor* mAllowed;
+ LLPanelExperienceListEditor* mBlocked;
+ LLUUID mDefaultExperience;
};
class LLPanelEstateAccess : public LLPanelRegionInfo
{
- LOG_CLASS(LLPanelEstateAccess);
+ LOG_CLASS(LLPanelEstateAccess);
public:
- LLPanelEstateAccess();
+ LLPanelEstateAccess();
- virtual BOOL postBuild();
- virtual void updateChild(LLUICtrl* child_ctrl);
+ virtual BOOL postBuild();
+ virtual void updateChild(LLUICtrl* child_ctrl);
- void updateControls(LLViewerRegion* region);
- void updateLists();
+ void updateControls(LLViewerRegion* region);
+ void updateLists();
- void setPendingUpdate(bool pending) { mPendingUpdate = pending; }
- bool getPendingUpdate() { return mPendingUpdate; }
+ void setPendingUpdate(bool pending) { mPendingUpdate = pending; }
+ bool getPendingUpdate() { return mPendingUpdate; }
- virtual bool refreshFromRegion(LLViewerRegion* region);
+ virtual bool refreshFromRegion(LLViewerRegion* region);
private:
- void onClickAddAllowedAgent();
- void onClickRemoveAllowedAgent();
- void onClickCopyAllowedList();
- void onClickAddAllowedGroup();
- void onClickRemoveAllowedGroup();
- void onClickCopyAllowedGroupList();
- void onClickAddBannedAgent();
- void onClickRemoveBannedAgent();
+ void onClickAddAllowedAgent();
+ void onClickRemoveAllowedAgent();
+ void onClickCopyAllowedList();
+ void onClickAddAllowedGroup();
+ void onClickRemoveAllowedGroup();
+ void onClickCopyAllowedGroupList();
+ void onClickAddBannedAgent();
+ void onClickRemoveBannedAgent();
void onClickCopyBannedList();
- void onClickAddEstateManager();
- void onClickRemoveEstateManager();
- void onAllowedSearchEdit(const std::string& search_string);
- void onAllowedGroupsSearchEdit(const std::string& search_string);
- void onBannedSearchEdit(const std::string& search_string);
-
- // Group picker callback is different, can't use core methods below
- bool addAllowedGroup(const LLSD& notification, const LLSD& response);
- void addAllowedGroup2(LLUUID id);
+ void onClickAddEstateManager();
+ void onClickRemoveEstateManager();
+ void onAllowedSearchEdit(const std::string& search_string);
+ void onAllowedGroupsSearchEdit(const std::string& search_string);
+ void onBannedSearchEdit(const std::string& search_string);
+
+ // Group picker callback is different, can't use core methods below
+ bool addAllowedGroup(const LLSD& notification, const LLSD& response);
+ void addAllowedGroup2(LLUUID id);
- // Core methods for all above add/remove button clicks
- static void accessAddCore(U32 operation_flag, const std::string& dialog_name);
- static bool accessAddCore2(const LLSD& notification, const LLSD& response);
- static void accessAddCore3(const uuid_vec_t& ids, std::vector<LLAvatarName> names, void* data);
+ // Core methods for all above add/remove button clicks
+ static void accessAddCore(U32 operation_flag, const std::string& dialog_name);
+ static bool accessAddCore2(const LLSD& notification, const LLSD& response);
+ static void accessAddCore3(const uuid_vec_t& ids, std::vector<LLAvatarName> names, void* data);
- static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name);
- static bool accessRemoveCore2(const LLSD& notification, const LLSD& response);
+ static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name);
+ static bool accessRemoveCore2(const LLSD& notification, const LLSD& response);
- // used for both add and remove operations
- static bool accessCoreConfirm(const LLSD& notification, const LLSD& response);
+ // used for both add and remove operations
+ static bool accessCoreConfirm(const LLSD& notification, const LLSD& response);
- // Send the actual EstateOwnerRequest "estateaccessdelta" message
- static void sendEstateAccessDelta(U32 flags, const LLUUID& agent_id);
+ // Send the actual EstateOwnerRequest "estateaccessdelta" message
+ static void sendEstateAccessDelta(U32 flags, const LLUUID& agent_id);
- static void requestEstateGetAccessCoro(std::string url);
+ static void requestEstateGetAccessCoro(std::string url);
- void searchAgent(LLNameListCtrl* listCtrl, const std::string& search_string);
- void copyListToClipboard(std::string list_name);
+ void searchAgent(LLNameListCtrl* listCtrl, const std::string& search_string);
+ void copyListToClipboard(std::string list_name);
- bool mPendingUpdate;
- BOOL mCtrlsEnabled;
+ bool mPendingUpdate;
+ BOOL mCtrlsEnabled;
};
#endif
diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp
index 95d4265bb4..1df2825fe0 100644
--- a/indra/newview/llfloaterregionrestarting.cpp
+++ b/indra/newview/llfloaterregionrestarting.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterregionrestarting.cpp
* @brief Shows countdown timer during region restart
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,139 +38,139 @@ static S32 sSeconds;
static U32 sShakeState;
LLFloaterRegionRestarting::LLFloaterRegionRestarting(const LLSD& key) :
- LLFloater(key),
- LLEventTimer(1)
+ LLFloater(key),
+ LLEventTimer(1)
{
- mName = (std::string)key["NAME"];
- sSeconds = (LLSD::Integer)key["SECONDS"];
+ mName = (std::string)key["NAME"];
+ sSeconds = (LLSD::Integer)key["SECONDS"];
}
LLFloaterRegionRestarting::~LLFloaterRegionRestarting()
{
- mRegionChangedConnection.disconnect();
+ mRegionChangedConnection.disconnect();
}
BOOL LLFloaterRegionRestarting::postBuild()
{
- mRegionChangedConnection = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this));
+ mRegionChangedConnection = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this));
- LLStringUtil::format_map_t args;
- std::string text;
+ LLStringUtil::format_map_t args;
+ std::string text;
- args["[NAME]"] = mName;
- text = getString("RegionName", args);
- LLTextBox* textbox = getChild<LLTextBox>("region_name");
- textbox->setValue(text);
+ args["[NAME]"] = mName;
+ text = getString("RegionName", args);
+ LLTextBox* textbox = getChild<LLTextBox>("region_name");
+ textbox->setValue(text);
- sShakeState = SHAKE_START;
+ sShakeState = SHAKE_START;
- refresh();
+ refresh();
- return TRUE;
+ return TRUE;
}
void LLFloaterRegionRestarting::regionChange()
{
- close();
+ close();
}
BOOL LLFloaterRegionRestarting::tick()
{
- refresh();
+ refresh();
- return FALSE;
+ return FALSE;
}
void LLFloaterRegionRestarting::refresh()
{
- LLStringUtil::format_map_t args;
- std::string text;
+ LLStringUtil::format_map_t args;
+ std::string text;
- args["[SECONDS]"] = llformat("%d", sSeconds);
- getChild<LLTextBox>("restart_seconds")->setValue(getString("RestartSeconds", args));
+ args["[SECONDS]"] = llformat("%d", sSeconds);
+ getChild<LLTextBox>("restart_seconds")->setValue(getString("RestartSeconds", args));
- sSeconds = sSeconds - 1;
- if(sSeconds < 0.0)
- {
- sSeconds = 0;
- }
+ sSeconds = sSeconds - 1;
+ if(sSeconds < 0.0)
+ {
+ sSeconds = 0;
+ }
}
void LLFloaterRegionRestarting::draw()
{
- LLFloater::draw();
-
- const F32 SHAKE_INTERVAL = 0.025;
- const F32 SHAKE_TOTAL_DURATION = 1.8; // the length of the default alert tone for this
- const F32 SHAKE_INITIAL_MAGNITUDE = 1.5;
- const F32 SHAKE_HORIZONTAL_BIAS = 0.25;
- F32 time_shaking;
-
- if(SHAKE_START == sShakeState)
- {
- mShakeTimer.setTimerExpirySec(SHAKE_INTERVAL);
- sShakeState = SHAKE_LEFT;
- mShakeIterations = 0;
- mShakeMagnitude = SHAKE_INITIAL_MAGNITUDE;
- }
-
- if(SHAKE_DONE != sShakeState && mShakeTimer.hasExpired())
- {
- gAgentCamera.unlockView();
-
- switch(sShakeState)
- {
- case SHAKE_LEFT:
- gAgentCamera.setPanLeftKey(mShakeMagnitude * SHAKE_HORIZONTAL_BIAS);
- sShakeState = SHAKE_UP;
- break;
-
- case SHAKE_UP:
- gAgentCamera.setPanUpKey(mShakeMagnitude);
- sShakeState = SHAKE_RIGHT;
- break;
-
- case SHAKE_RIGHT:
- gAgentCamera.setPanRightKey(mShakeMagnitude * SHAKE_HORIZONTAL_BIAS);
- sShakeState = SHAKE_DOWN;
- break;
-
- case SHAKE_DOWN:
- gAgentCamera.setPanDownKey(mShakeMagnitude);
- mShakeIterations++;
- time_shaking = SHAKE_INTERVAL * (mShakeIterations * 4 /* left, up, right, down */);
- if(SHAKE_TOTAL_DURATION <= time_shaking)
- {
- sShakeState = SHAKE_DONE;
- mShakeMagnitude = 0.0;
- }
- else
- {
- sShakeState = SHAKE_LEFT;
- F32 percent_done_shaking = (SHAKE_TOTAL_DURATION - time_shaking) / SHAKE_TOTAL_DURATION;
- mShakeMagnitude = SHAKE_INITIAL_MAGNITUDE * (percent_done_shaking * percent_done_shaking); // exponential decay
- }
- break;
-
- default:
- break;
- }
- mShakeTimer.setTimerExpirySec(SHAKE_INTERVAL);
- }
+ LLFloater::draw();
+
+ const F32 SHAKE_INTERVAL = 0.025;
+ const F32 SHAKE_TOTAL_DURATION = 1.8; // the length of the default alert tone for this
+ const F32 SHAKE_INITIAL_MAGNITUDE = 1.5;
+ const F32 SHAKE_HORIZONTAL_BIAS = 0.25;
+ F32 time_shaking;
+
+ if(SHAKE_START == sShakeState)
+ {
+ mShakeTimer.setTimerExpirySec(SHAKE_INTERVAL);
+ sShakeState = SHAKE_LEFT;
+ mShakeIterations = 0;
+ mShakeMagnitude = SHAKE_INITIAL_MAGNITUDE;
+ }
+
+ if(SHAKE_DONE != sShakeState && mShakeTimer.hasExpired())
+ {
+ gAgentCamera.unlockView();
+
+ switch(sShakeState)
+ {
+ case SHAKE_LEFT:
+ gAgentCamera.setPanLeftKey(mShakeMagnitude * SHAKE_HORIZONTAL_BIAS);
+ sShakeState = SHAKE_UP;
+ break;
+
+ case SHAKE_UP:
+ gAgentCamera.setPanUpKey(mShakeMagnitude);
+ sShakeState = SHAKE_RIGHT;
+ break;
+
+ case SHAKE_RIGHT:
+ gAgentCamera.setPanRightKey(mShakeMagnitude * SHAKE_HORIZONTAL_BIAS);
+ sShakeState = SHAKE_DOWN;
+ break;
+
+ case SHAKE_DOWN:
+ gAgentCamera.setPanDownKey(mShakeMagnitude);
+ mShakeIterations++;
+ time_shaking = SHAKE_INTERVAL * (mShakeIterations * 4 /* left, up, right, down */);
+ if(SHAKE_TOTAL_DURATION <= time_shaking)
+ {
+ sShakeState = SHAKE_DONE;
+ mShakeMagnitude = 0.0;
+ }
+ else
+ {
+ sShakeState = SHAKE_LEFT;
+ F32 percent_done_shaking = (SHAKE_TOTAL_DURATION - time_shaking) / SHAKE_TOTAL_DURATION;
+ mShakeMagnitude = SHAKE_INITIAL_MAGNITUDE * (percent_done_shaking * percent_done_shaking); // exponential decay
+ }
+ break;
+
+ default:
+ break;
+ }
+ mShakeTimer.setTimerExpirySec(SHAKE_INTERVAL);
+ }
}
void LLFloaterRegionRestarting::close()
{
- LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance<LLFloaterRegionRestarting>("region_restarting");
+ LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance<LLFloaterRegionRestarting>("region_restarting");
- if (floaterp)
- {
- floaterp->closeFloater();
- }
+ if (floaterp)
+ {
+ floaterp->closeFloater();
+ }
}
void LLFloaterRegionRestarting::updateTime(S32 time)
{
- sSeconds = time;
- sShakeState = SHAKE_START;
+ sSeconds = time;
+ sShakeState = SHAKE_START;
}
diff --git a/indra/newview/llfloaterregionrestarting.h b/indra/newview/llfloaterregionrestarting.h
index 46416db2c8..ab080073e7 100644
--- a/indra/newview/llfloaterregionrestarting.h
+++ b/indra/newview/llfloaterregionrestarting.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterregionrestarting.h
* @brief Shows countdown timer during region restart
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,37 +33,37 @@
class LLFloaterRegionRestarting : public LLFloater, public LLEventTimer
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- static void close();
- static void updateTime(S32 time);
+ static void close();
+ static void updateTime(S32 time);
private:
- LLFloaterRegionRestarting(const LLSD& key);
- virtual ~LLFloaterRegionRestarting();
- virtual BOOL postBuild();
- virtual BOOL tick();
- virtual void refresh();
- virtual void draw();
- virtual void regionChange();
+ LLFloaterRegionRestarting(const LLSD& key);
+ virtual ~LLFloaterRegionRestarting();
+ virtual BOOL postBuild();
+ virtual BOOL tick();
+ virtual void refresh();
+ virtual void draw();
+ virtual void regionChange();
- std::string mName;
- U32 mShakeIterations;
- F32 mShakeMagnitude;
- LLTimer mShakeTimer;
+ std::string mName;
+ U32 mShakeIterations;
+ F32 mShakeMagnitude;
+ LLTimer mShakeTimer;
- boost::signals2::connection mRegionChangedConnection;
+ boost::signals2::connection mRegionChangedConnection;
- enum
- {
- SHAKE_START,
- SHAKE_LEFT,
- SHAKE_UP,
- SHAKE_RIGHT,
- SHAKE_DOWN,
- SHAKE_DONE
- };
+ enum
+ {
+ SHAKE_START,
+ SHAKE_LEFT,
+ SHAKE_UP,
+ SHAKE_RIGHT,
+ SHAKE_DOWN,
+ SHAKE_DONE
+ };
};
#endif // LL_LLFLOATERREGIONRESTARTING_H
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 2df4ca973d..bcfe422d7a 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterreporter.cpp
* @brief Abuse reports.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,7 +67,7 @@
#include "llviewerobjectlist.h"
#include "lltoolobjpicker.h"
#include "lltoolmgr.h"
-#include "llresourcedata.h" // for LLResourceData
+#include "llresourcedata.h" // for LLResourceData
#include "llslurl.h"
#include "llviewerwindow.h"
#include "llviewertexturelist.h"
@@ -143,224 +143,224 @@ LLUUID LLARScreenShotUploader::finishUpload(LLSD &result)
//-----------------------------------------------------------------------------
// Member functions
//-----------------------------------------------------------------------------
-
+
LLFloaterReporter::LLFloaterReporter(const LLSD& key)
-: LLFloater(key),
- mReportType(COMPLAINT_REPORT),
- mObjectID(),
- mScreenID(),
- mAbuserID(),
- mOwnerName(),
- mDeselectOnClose( FALSE ),
- mPicking( FALSE),
- mPosition(),
- mCopyrightWarningSeen( FALSE ),
- mResourceDatap(new LLResourceData()),
- mAvatarNameCacheConnection()
+: LLFloater(key),
+ mReportType(COMPLAINT_REPORT),
+ mObjectID(),
+ mScreenID(),
+ mAbuserID(),
+ mOwnerName(),
+ mDeselectOnClose( FALSE ),
+ mPicking( FALSE),
+ mPosition(),
+ mCopyrightWarningSeen( FALSE ),
+ mResourceDatap(new LLResourceData()),
+ mAvatarNameCacheConnection()
{
- gIdleCallbacks.addFunction(onIdle, this);
+ gIdleCallbacks.addFunction(onIdle, this);
}
// virtual
BOOL LLFloaterReporter::postBuild()
{
- LLSLURL slurl;
- LLAgentUI::buildSLURL(slurl);
- getChild<LLUICtrl>("abuse_location_edit")->setValue(slurl.getSLURLString());
-
- enableControls(TRUE);
-
- // convert the position to a string
- LLVector3d pos = gAgent.getPositionGlobal();
- LLViewerRegion *regionp = gAgent.getRegion();
- if (regionp)
- {
- getChild<LLUICtrl>("sim_field")->setValue(regionp->getName());
- pos -= regionp->getOriginGlobal();
- }
- setPosBox(pos);
-
- // Default text to be blank
- getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null);
- getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null);
- mOwnerName = LLStringUtil::null;
-
- getChild<LLUICtrl>("summary_edit")->setFocus(TRUE);
-
- mDefaultSummary = getChild<LLUICtrl>("details_edit")->getValue().asString();
-
- // abuser name is selected from a list
- LLUICtrl* le = getChild<LLUICtrl>("abuser_name_edit");
- le->setEnabled( false );
-
- setPosBox((LLVector3d)mPosition.getValue());
- LLButton* pick_btn = getChild<LLButton>("pick_btn");
- pick_btn->setImages(std::string("tool_face.tga"),
- std::string("tool_face_active.tga") );
- childSetAction("pick_btn", onClickObjPicker, this);
-
- childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this));
-
- childSetAction("send_btn", onClickSend, this);
- childSetAction("cancel_btn", onClickCancel, this);
-
- // grab the user's name
- std::string reporter = LLSLURL("agent", gAgent.getID(), "inspect").getSLURLString();
- getChild<LLUICtrl>("reporter_field")->setValue(reporter);
-
- // request categories
- if (gAgent.getRegion()
- && gAgent.getRegion()->capabilitiesReceived())
- {
- std::string cap_url = gAgent.getRegionCapability("AbuseCategories");
-
- if (!cap_url.empty())
- {
- std::string lang = gSavedSettings.getString("Language");
- if (lang != "default" && !lang.empty())
- {
- cap_url += "?lc=";
- cap_url += lang;
- }
- LLCoros::instance().launch("LLFloaterReporter::requestAbuseCategoriesCoro",
- boost::bind(LLFloaterReporter::requestAbuseCategoriesCoro, cap_url, this->getHandle()));
- }
- }
-
- center();
-
- return TRUE;
+ LLSLURL slurl;
+ LLAgentUI::buildSLURL(slurl);
+ getChild<LLUICtrl>("abuse_location_edit")->setValue(slurl.getSLURLString());
+
+ enableControls(TRUE);
+
+ // convert the position to a string
+ LLVector3d pos = gAgent.getPositionGlobal();
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ getChild<LLUICtrl>("sim_field")->setValue(regionp->getName());
+ pos -= regionp->getOriginGlobal();
+ }
+ setPosBox(pos);
+
+ // Default text to be blank
+ getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null);
+ getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null);
+ mOwnerName = LLStringUtil::null;
+
+ getChild<LLUICtrl>("summary_edit")->setFocus(TRUE);
+
+ mDefaultSummary = getChild<LLUICtrl>("details_edit")->getValue().asString();
+
+ // abuser name is selected from a list
+ LLUICtrl* le = getChild<LLUICtrl>("abuser_name_edit");
+ le->setEnabled( false );
+
+ setPosBox((LLVector3d)mPosition.getValue());
+ LLButton* pick_btn = getChild<LLButton>("pick_btn");
+ pick_btn->setImages(std::string("tool_face.tga"),
+ std::string("tool_face_active.tga") );
+ childSetAction("pick_btn", onClickObjPicker, this);
+
+ childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this));
+
+ childSetAction("send_btn", onClickSend, this);
+ childSetAction("cancel_btn", onClickCancel, this);
+
+ // grab the user's name
+ std::string reporter = LLSLURL("agent", gAgent.getID(), "inspect").getSLURLString();
+ getChild<LLUICtrl>("reporter_field")->setValue(reporter);
+
+ // request categories
+ if (gAgent.getRegion()
+ && gAgent.getRegion()->capabilitiesReceived())
+ {
+ std::string cap_url = gAgent.getRegionCapability("AbuseCategories");
+
+ if (!cap_url.empty())
+ {
+ std::string lang = gSavedSettings.getString("Language");
+ if (lang != "default" && !lang.empty())
+ {
+ cap_url += "?lc=";
+ cap_url += lang;
+ }
+ LLCoros::instance().launch("LLFloaterReporter::requestAbuseCategoriesCoro",
+ boost::bind(LLFloaterReporter::requestAbuseCategoriesCoro, cap_url, this->getHandle()));
+ }
+ }
+
+ center();
+
+ return TRUE;
}
// virtual
LLFloaterReporter::~LLFloaterReporter()
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- gIdleCallbacks.deleteFunction(onIdle, this);
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ gIdleCallbacks.deleteFunction(onIdle, this);
- // child views automatically deleted
- mObjectID = LLUUID::null;
+ // child views automatically deleted
+ mObjectID = LLUUID::null;
- if (mPicking)
- {
- closePickTool(this);
- }
+ if (mPicking)
+ {
+ closePickTool(this);
+ }
- mPosition.setVec(0.0f, 0.0f, 0.0f);
+ mPosition.setVec(0.0f, 0.0f, 0.0f);
- delete mResourceDatap;
+ delete mResourceDatap;
}
void LLFloaterReporter::onIdle(void* user_data)
{
- LLFloaterReporter* floater_reporter = (LLFloaterReporter*)user_data;
- if (floater_reporter)
- {
- static LLCachedControl<F32> screenshot_delay(gSavedSettings, "AbuseReportScreenshotDelay");
- if (floater_reporter->mSnapshotTimer.getStarted() && floater_reporter->mSnapshotTimer.getElapsedTimeF32() > screenshot_delay)
- {
- floater_reporter->mSnapshotTimer.stop();
- floater_reporter->takeNewSnapshot();
- }
- }
+ LLFloaterReporter* floater_reporter = (LLFloaterReporter*)user_data;
+ if (floater_reporter)
+ {
+ static LLCachedControl<F32> screenshot_delay(gSavedSettings, "AbuseReportScreenshotDelay");
+ if (floater_reporter->mSnapshotTimer.getStarted() && floater_reporter->mSnapshotTimer.getElapsedTimeF32() > screenshot_delay)
+ {
+ floater_reporter->mSnapshotTimer.stop();
+ floater_reporter->takeNewSnapshot();
+ }
+ }
}
void LLFloaterReporter::enableControls(BOOL enable)
{
- getChildView("category_combo")->setEnabled(enable);
- getChildView("chat_check")->setEnabled(enable);
- getChildView("screenshot")->setEnabled(FALSE);
- getChildView("pick_btn")->setEnabled(enable);
- getChildView("summary_edit")->setEnabled(enable);
- getChildView("details_edit")->setEnabled(enable);
- getChildView("send_btn")->setEnabled(enable);
- getChildView("cancel_btn")->setEnabled(enable);
+ getChildView("category_combo")->setEnabled(enable);
+ getChildView("chat_check")->setEnabled(enable);
+ getChildView("screenshot")->setEnabled(FALSE);
+ getChildView("pick_btn")->setEnabled(enable);
+ getChildView("summary_edit")->setEnabled(enable);
+ getChildView("details_edit")->setEnabled(enable);
+ getChildView("send_btn")->setEnabled(enable);
+ getChildView("cancel_btn")->setEnabled(enable);
}
void LLFloaterReporter::getExperienceInfo(const LLUUID& experience_id)
{
- mExperienceID = experience_id;
+ mExperienceID = experience_id;
- if (LLUUID::null != mExperienceID)
- {
+ if (LLUUID::null != mExperienceID)
+ {
const LLSD& experience = LLExperienceCache::instance().get(mExperienceID);
- std::stringstream desc;
-
- if(experience.isDefined())
- {
- setFromAvatarID(experience[LLExperienceCache::AGENT_ID]);
- desc << "Experience id: " << mExperienceID;
- }
- else
- {
- desc << "Unable to retrieve details for id: "<< mExperienceID;
- }
-
- LLUICtrl* details = getChild<LLUICtrl>("details_edit");
- details->setValue(desc.str());
- }
+ std::stringstream desc;
+
+ if(experience.isDefined())
+ {
+ setFromAvatarID(experience[LLExperienceCache::AGENT_ID]);
+ desc << "Experience id: " << mExperienceID;
+ }
+ else
+ {
+ desc << "Unable to retrieve details for id: "<< mExperienceID;
+ }
+
+ LLUICtrl* details = getChild<LLUICtrl>("details_edit");
+ details->setValue(desc.str());
+ }
}
void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
{
- // TODO --
- // 1 need to send to correct simulator if object is not
- // in same simulator as agent
- // 2 display info in widget window that gives feedback that
- // we have recorded the object info
- // 3 can pick avatar ==> might want to indicate when a picked
- // object is an avatar, attachment, or other category
-
- mObjectID = object_id;
-
- if (LLUUID::null != mObjectID)
- {
- // get object info for the user's benefit
- LLViewerObject* objectp = NULL;
- objectp = gObjectList.findObject( mObjectID );
- if (objectp)
- {
- if ( objectp->isAttachment() )
- {
- objectp = (LLViewerObject*)objectp->getRoot();
- mObjectID = objectp->getID();
- }
-
- // correct the region and position information
- LLViewerRegion *regionp = objectp->getRegion();
- if (regionp)
- {
- getChild<LLUICtrl>("sim_field")->setValue(regionp->getName());
- LLVector3d global_pos;
- global_pos.setVec(objectp->getPositionRegion());
- setPosBox(global_pos);
- }
-
- if (objectp->isAvatar())
- {
- setFromAvatarID(mObjectID);
- }
- else
- {
- // we have to query the simulator for information
- // about this object
- LLMessageSystem* msg = gMessageSystem;
- U32 request_flags = COMPLAINT_REPORT_REQUEST;
- msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU32Fast(_PREHASH_RequestFlags, request_flags );
- msg->addUUIDFast(_PREHASH_ObjectID, mObjectID);
- LLViewerRegion* regionp = objectp->getRegion();
- msg->sendReliable( regionp->getHost() );
- }
- }
- }
+ // TODO --
+ // 1 need to send to correct simulator if object is not
+ // in same simulator as agent
+ // 2 display info in widget window that gives feedback that
+ // we have recorded the object info
+ // 3 can pick avatar ==> might want to indicate when a picked
+ // object is an avatar, attachment, or other category
+
+ mObjectID = object_id;
+
+ if (LLUUID::null != mObjectID)
+ {
+ // get object info for the user's benefit
+ LLViewerObject* objectp = NULL;
+ objectp = gObjectList.findObject( mObjectID );
+ if (objectp)
+ {
+ if ( objectp->isAttachment() )
+ {
+ objectp = (LLViewerObject*)objectp->getRoot();
+ mObjectID = objectp->getID();
+ }
+
+ // correct the region and position information
+ LLViewerRegion *regionp = objectp->getRegion();
+ if (regionp)
+ {
+ getChild<LLUICtrl>("sim_field")->setValue(regionp->getName());
+ LLVector3d global_pos;
+ global_pos.setVec(objectp->getPositionRegion());
+ setPosBox(global_pos);
+ }
+
+ if (objectp->isAvatar())
+ {
+ setFromAvatarID(mObjectID);
+ }
+ else
+ {
+ // we have to query the simulator for information
+ // about this object
+ LLMessageSystem* msg = gMessageSystem;
+ U32 request_flags = COMPLAINT_REPORT_REQUEST;
+ msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addU32Fast(_PREHASH_RequestFlags, request_flags );
+ msg->addUUIDFast(_PREHASH_ObjectID, mObjectID);
+ LLViewerRegion* regionp = objectp->getRegion();
+ msg->sendReliable( regionp->getHost() );
+ }
+ }
+ }
}
void LLFloaterReporter::onClickSelectAbuser()
@@ -368,49 +368,49 @@ void LLFloaterReporter::onClickSelectAbuser()
LLView * button = findChild<LLButton>("select_abuser", TRUE);
LLFloater * root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button);
- if (picker)
- {
- root_floater->addDependentFloater(picker);
- }
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button);
+ if (picker)
+ {
+ root_floater->addDependentFloater(picker);
+ }
}
void LLFloaterReporter::callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
{
- if (ids.empty() || names.empty()) return;
+ if (ids.empty() || names.empty()) return;
- getChild<LLUICtrl>("abuser_name_edit")->setValue(names[0].getCompleteName());
+ getChild<LLUICtrl>("abuser_name_edit")->setValue(names[0].getCompleteName());
- mAbuserID = ids[0];
+ mAbuserID = ids[0];
- refresh();
+ refresh();
}
void LLFloaterReporter::setFromAvatarID(const LLUUID& avatar_id)
{
- mAbuserID = mObjectID = avatar_id;
- std::string avatar_link = LLSLURL("agent", mObjectID, "inspect").getSLURLString();
- getChild<LLUICtrl>("owner_name")->setValue(avatar_link);
-
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(avatar_id, boost::bind(&LLFloaterReporter::onAvatarNameCache, this, _1, _2));
+ mAbuserID = mObjectID = avatar_id;
+ std::string avatar_link = LLSLURL("agent", mObjectID, "inspect").getSLURLString();
+ getChild<LLUICtrl>("owner_name")->setValue(avatar_link);
+
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(avatar_id, boost::bind(&LLFloaterReporter::onAvatarNameCache, this, _1, _2));
}
void LLFloaterReporter::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name)
{
- mAvatarNameCacheConnection.disconnect();
-
- if (mObjectID == avatar_id)
- {
- mOwnerName = av_name.getCompleteName();
- getChild<LLUICtrl>("object_name")->setValue(av_name.getCompleteName());
- getChild<LLUICtrl>("object_name")->setToolTip(av_name.getCompleteName());
- getChild<LLUICtrl>("abuser_name_edit")->setValue(av_name.getCompleteName());
- }
+ mAvatarNameCacheConnection.disconnect();
+
+ if (mObjectID == avatar_id)
+ {
+ mOwnerName = av_name.getCompleteName();
+ getChild<LLUICtrl>("object_name")->setValue(av_name.getCompleteName());
+ getChild<LLUICtrl>("object_name")->setToolTip(av_name.getCompleteName());
+ getChild<LLUICtrl>("abuser_name_edit")->setValue(av_name.getCompleteName());
+ }
}
void LLFloaterReporter::requestAbuseCategoriesCoro(std::string url, LLHandle<LLFloater> handle)
@@ -476,187 +476,187 @@ void LLFloaterReporter::requestAbuseCategoriesCoro(std::string url, LLHandle<LLF
// static
void LLFloaterReporter::onClickSend(void *userdata)
{
- LLFloaterReporter *self = (LLFloaterReporter *)userdata;
-
- if (self->mPicking)
- {
- closePickTool(self);
- }
-
- if(self->validateReport())
- {
-
- const int IP_CONTENT_REMOVAL = 66;
- const int IP_PERMISSONS_EXPLOIT = 37;
- LLComboBox* combo = self->getChild<LLComboBox>( "category_combo");
- int category_value = combo->getSelectedValue().asInteger();
-
- if ( ! self->mCopyrightWarningSeen )
- {
-
- std::string details_lc = self->getChild<LLUICtrl>("details_edit")->getValue().asString();
- LLStringUtil::toLower( details_lc );
- std::string summary_lc = self->getChild<LLUICtrl>("summary_edit")->getValue().asString();
- LLStringUtil::toLower( summary_lc );
- if ( details_lc.find( "copyright" ) != std::string::npos ||
- summary_lc.find( "copyright" ) != std::string::npos ||
- category_value == IP_CONTENT_REMOVAL ||
- category_value == IP_PERMISSONS_EXPLOIT)
- {
- LLNotificationsUtil::add("HelpReportAbuseContainsCopyright");
- self->mCopyrightWarningSeen = TRUE;
- return;
- }
- }
- else if (category_value == IP_CONTENT_REMOVAL)
- {
- // IP_CONTENT_REMOVAL *always* shows the dialog -
- // ergo you can never send that abuse report type.
- LLNotificationsUtil::add("HelpReportAbuseContainsCopyright");
- return;
- }
-
- LLUploadDialog::modalUploadDialog(LLTrans::getString("uploading_abuse_report"));
- // *TODO don't upload image if checkbox isn't checked
- std::string url = gAgent.getRegionCapability("SendUserReport");
- std::string sshot_url = gAgent.getRegionCapability("SendUserReportWithScreenshot");
- if(!url.empty() || !sshot_url.empty())
- {
- self->sendReportViaCaps(url, sshot_url, self->gatherReport());
- LLNotificationsUtil::add("HelpReportAbuseConfirm");
- self->closeFloater();
- }
- else
- {
- self->getChildView("send_btn")->setEnabled(FALSE);
- self->getChildView("cancel_btn")->setEnabled(FALSE);
- // the callback from uploading the image calls sendReportViaLegacy()
- self->uploadImage();
- }
- }
+ LLFloaterReporter *self = (LLFloaterReporter *)userdata;
+
+ if (self->mPicking)
+ {
+ closePickTool(self);
+ }
+
+ if(self->validateReport())
+ {
+
+ const int IP_CONTENT_REMOVAL = 66;
+ const int IP_PERMISSONS_EXPLOIT = 37;
+ LLComboBox* combo = self->getChild<LLComboBox>( "category_combo");
+ int category_value = combo->getSelectedValue().asInteger();
+
+ if ( ! self->mCopyrightWarningSeen )
+ {
+
+ std::string details_lc = self->getChild<LLUICtrl>("details_edit")->getValue().asString();
+ LLStringUtil::toLower( details_lc );
+ std::string summary_lc = self->getChild<LLUICtrl>("summary_edit")->getValue().asString();
+ LLStringUtil::toLower( summary_lc );
+ if ( details_lc.find( "copyright" ) != std::string::npos ||
+ summary_lc.find( "copyright" ) != std::string::npos ||
+ category_value == IP_CONTENT_REMOVAL ||
+ category_value == IP_PERMISSONS_EXPLOIT)
+ {
+ LLNotificationsUtil::add("HelpReportAbuseContainsCopyright");
+ self->mCopyrightWarningSeen = TRUE;
+ return;
+ }
+ }
+ else if (category_value == IP_CONTENT_REMOVAL)
+ {
+ // IP_CONTENT_REMOVAL *always* shows the dialog -
+ // ergo you can never send that abuse report type.
+ LLNotificationsUtil::add("HelpReportAbuseContainsCopyright");
+ return;
+ }
+
+ LLUploadDialog::modalUploadDialog(LLTrans::getString("uploading_abuse_report"));
+ // *TODO don't upload image if checkbox isn't checked
+ std::string url = gAgent.getRegionCapability("SendUserReport");
+ std::string sshot_url = gAgent.getRegionCapability("SendUserReportWithScreenshot");
+ if(!url.empty() || !sshot_url.empty())
+ {
+ self->sendReportViaCaps(url, sshot_url, self->gatherReport());
+ LLNotificationsUtil::add("HelpReportAbuseConfirm");
+ self->closeFloater();
+ }
+ else
+ {
+ self->getChildView("send_btn")->setEnabled(FALSE);
+ self->getChildView("cancel_btn")->setEnabled(FALSE);
+ // the callback from uploading the image calls sendReportViaLegacy()
+ self->uploadImage();
+ }
+ }
}
// static
void LLFloaterReporter::onClickCancel(void *userdata)
{
- LLFloaterReporter *self = (LLFloaterReporter *)userdata;
+ LLFloaterReporter *self = (LLFloaterReporter *)userdata;
- // reset flag in case the next report also contains this text
- self->mCopyrightWarningSeen = FALSE;
+ // reset flag in case the next report also contains this text
+ self->mCopyrightWarningSeen = FALSE;
- if (self->mPicking)
- {
- closePickTool(self);
- }
- self->closeFloater();
+ if (self->mPicking)
+ {
+ closePickTool(self);
+ }
+ self->closeFloater();
}
-// static
+// static
void LLFloaterReporter::onClickObjPicker(void *userdata)
{
- LLFloaterReporter *self = (LLFloaterReporter *)userdata;
- LLToolObjPicker::getInstance()->setExitCallback(LLFloaterReporter::closePickTool, self);
- LLToolMgr::getInstance()->setTransientTool(LLToolObjPicker::getInstance());
- self->mPicking = TRUE;
- self->getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null);
- self->getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null);
- self->mOwnerName = LLStringUtil::null;
- LLButton* pick_btn = self->getChild<LLButton>("pick_btn");
- if (pick_btn) pick_btn->setToggleState(TRUE);
+ LLFloaterReporter *self = (LLFloaterReporter *)userdata;
+ LLToolObjPicker::getInstance()->setExitCallback(LLFloaterReporter::closePickTool, self);
+ LLToolMgr::getInstance()->setTransientTool(LLToolObjPicker::getInstance());
+ self->mPicking = TRUE;
+ self->getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null);
+ self->getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null);
+ self->mOwnerName = LLStringUtil::null;
+ LLButton* pick_btn = self->getChild<LLButton>("pick_btn");
+ if (pick_btn) pick_btn->setToggleState(TRUE);
}
// static
void LLFloaterReporter::closePickTool(void *userdata)
{
- LLFloaterReporter *self = (LLFloaterReporter *)userdata;
+ LLFloaterReporter *self = (LLFloaterReporter *)userdata;
- LLUUID object_id = LLToolObjPicker::getInstance()->getObjectID();
- self->getObjectInfo(object_id);
+ LLUUID object_id = LLToolObjPicker::getInstance()->getObjectID();
+ self->getObjectInfo(object_id);
- LLToolMgr::getInstance()->clearTransientTool();
- self->mPicking = FALSE;
- LLButton* pick_btn = self->getChild<LLButton>("pick_btn");
- if (pick_btn) pick_btn->setToggleState(FALSE);
+ LLToolMgr::getInstance()->clearTransientTool();
+ self->mPicking = FALSE;
+ LLButton* pick_btn = self->getChild<LLButton>("pick_btn");
+ if (pick_btn) pick_btn->setToggleState(FALSE);
}
// static
void LLFloaterReporter::showFromMenu(EReportType report_type)
{
- if (COMPLAINT_REPORT != report_type)
- {
- LL_WARNS() << "Unknown LLViewerReporter type : " << report_type << LL_ENDL;
- return;
- }
- LLFloaterReporter* reporter_floater = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
- if(reporter_floater && reporter_floater->isInVisibleChain())
- {
- gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", FALSE);
- }
- reporter_floater = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter", LLSD());
- if (reporter_floater)
- {
- reporter_floater->setReportType(report_type);
- }
+ if (COMPLAINT_REPORT != report_type)
+ {
+ LL_WARNS() << "Unknown LLViewerReporter type : " << report_type << LL_ENDL;
+ return;
+ }
+ LLFloaterReporter* reporter_floater = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
+ if(reporter_floater && reporter_floater->isInVisibleChain())
+ {
+ gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", FALSE);
+ }
+ reporter_floater = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter", LLSD());
+ if (reporter_floater)
+ {
+ reporter_floater->setReportType(report_type);
+ }
}
// static
void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_name, const LLUUID& experience_id)
{
- LLFloaterReporter* reporter_floater = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
- if(reporter_floater && reporter_floater->isInVisibleChain())
- {
- gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", FALSE);
- }
- reporter_floater = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter");
- if (avatar_name.empty())
- {
- // Request info for this object
- reporter_floater->getObjectInfo(object_id);
- }
- else
- {
- reporter_floater->setFromAvatarID(object_id);
- }
- if(experience_id.notNull())
- {
- reporter_floater->getExperienceInfo(experience_id);
- }
-
- // Need to deselect on close
- reporter_floater->mDeselectOnClose = TRUE;
+ LLFloaterReporter* reporter_floater = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
+ if(reporter_floater && reporter_floater->isInVisibleChain())
+ {
+ gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", FALSE);
+ }
+ reporter_floater = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter");
+ if (avatar_name.empty())
+ {
+ // Request info for this object
+ reporter_floater->getObjectInfo(object_id);
+ }
+ else
+ {
+ reporter_floater->setFromAvatarID(object_id);
+ }
+ if(experience_id.notNull())
+ {
+ reporter_floater->getExperienceInfo(experience_id);
+ }
+
+ // Need to deselect on close
+ reporter_floater->mDeselectOnClose = TRUE;
}
void LLFloaterReporter::showFromExperience( const LLUUID& experience_id )
{
- LLFloaterReporter* reporter_floater = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
- if(reporter_floater && reporter_floater->isInVisibleChain())
- {
- gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", FALSE);
- }
- reporter_floater = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter");
- reporter_floater->getExperienceInfo(experience_id);
-
- // Need to deselect on close
- reporter_floater->mDeselectOnClose = TRUE;
+ LLFloaterReporter* reporter_floater = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
+ if(reporter_floater && reporter_floater->isInVisibleChain())
+ {
+ gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", FALSE);
+ }
+ reporter_floater = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter");
+ reporter_floater->getExperienceInfo(experience_id);
+
+ // Need to deselect on close
+ reporter_floater->mDeselectOnClose = TRUE;
}
// static
void LLFloaterReporter::showFromObject(const LLUUID& object_id, const LLUUID& experience_id)
{
- show(object_id, LLStringUtil::null, experience_id);
+ show(object_id, LLStringUtil::null, experience_id);
}
// static
void LLFloaterReporter::showFromAvatar(const LLUUID& avatar_id, const std::string avatar_name)
{
- show(avatar_id, avatar_name);
+ show(avatar_id, avatar_name);
}
// static
@@ -678,175 +678,175 @@ void LLFloaterReporter::showFromChat(const LLUUID& avatar_id, const std::string&
void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id)
{
- getChild<LLUICtrl>("object_name")->setValue(object_name);
- std::string owner_link =
- LLSLURL("agent", owner_id, "inspect").getSLURLString();
- getChild<LLUICtrl>("owner_name")->setValue(owner_link);
- getChild<LLUICtrl>("abuser_name_edit")->setValue(owner_name);
- mAbuserID = owner_id;
- mOwnerName = owner_name;
+ getChild<LLUICtrl>("object_name")->setValue(object_name);
+ std::string owner_link =
+ LLSLURL("agent", owner_id, "inspect").getSLURLString();
+ getChild<LLUICtrl>("owner_name")->setValue(owner_link);
+ getChild<LLUICtrl>("abuser_name_edit")->setValue(owner_name);
+ mAbuserID = owner_id;
+ mOwnerName = owner_name;
}
bool LLFloaterReporter::validateReport()
{
- // Ensure user selected a category from the list
- LLSD category_sd = getChild<LLUICtrl>("category_combo")->getValue();
- U8 category = (U8)category_sd.asInteger();
- if (category == 0)
- {
- LLNotificationsUtil::add("HelpReportAbuseSelectCategory");
- return false;
- }
-
-
- if ( getChild<LLUICtrl>("abuser_name_edit")->getValue().asString().empty() )
- {
- LLNotificationsUtil::add("HelpReportAbuseAbuserNameEmpty");
- return false;
- };
-
- if ( getChild<LLUICtrl>("abuse_location_edit")->getValue().asString().empty() )
- {
- LLNotificationsUtil::add("HelpReportAbuseAbuserLocationEmpty");
- return false;
- };
-
- if ( getChild<LLUICtrl>("abuse_location_edit")->getValue().asString().empty() )
- {
- LLNotificationsUtil::add("HelpReportAbuseAbuserLocationEmpty");
- return false;
- };
-
-
- if ( getChild<LLUICtrl>("summary_edit")->getValue().asString().empty() )
- {
- LLNotificationsUtil::add("HelpReportAbuseSummaryEmpty");
- return false;
- };
-
- if ( getChild<LLUICtrl>("details_edit")->getValue().asString() == mDefaultSummary )
- {
- LLNotificationsUtil::add("HelpReportAbuseDetailsEmpty");
- return false;
- };
- return true;
+ // Ensure user selected a category from the list
+ LLSD category_sd = getChild<LLUICtrl>("category_combo")->getValue();
+ U8 category = (U8)category_sd.asInteger();
+ if (category == 0)
+ {
+ LLNotificationsUtil::add("HelpReportAbuseSelectCategory");
+ return false;
+ }
+
+
+ if ( getChild<LLUICtrl>("abuser_name_edit")->getValue().asString().empty() )
+ {
+ LLNotificationsUtil::add("HelpReportAbuseAbuserNameEmpty");
+ return false;
+ };
+
+ if ( getChild<LLUICtrl>("abuse_location_edit")->getValue().asString().empty() )
+ {
+ LLNotificationsUtil::add("HelpReportAbuseAbuserLocationEmpty");
+ return false;
+ };
+
+ if ( getChild<LLUICtrl>("abuse_location_edit")->getValue().asString().empty() )
+ {
+ LLNotificationsUtil::add("HelpReportAbuseAbuserLocationEmpty");
+ return false;
+ };
+
+
+ if ( getChild<LLUICtrl>("summary_edit")->getValue().asString().empty() )
+ {
+ LLNotificationsUtil::add("HelpReportAbuseSummaryEmpty");
+ return false;
+ };
+
+ if ( getChild<LLUICtrl>("details_edit")->getValue().asString() == mDefaultSummary )
+ {
+ LLNotificationsUtil::add("HelpReportAbuseDetailsEmpty");
+ return false;
+ };
+ return true;
}
LLSD LLFloaterReporter::gatherReport()
-{
- LLViewerRegion *regionp = gAgent.getRegion();
- if (!regionp) return LLSD(); // *TODO handle this failure case more gracefully
-
- // reset flag in case the next report also contains this text
- mCopyrightWarningSeen = FALSE;
-
- std::ostringstream summary;
- if (!LLGridManager::getInstance()->isInProductionGrid())
- {
- summary << "Preview ";
- }
-
- std::string category_name;
- LLComboBox* combo = getChild<LLComboBox>( "category_combo");
- if (combo)
- {
- category_name = combo->getSelectedItemLabel(); // want label, not value
- }
+{
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if (!regionp) return LLSD(); // *TODO handle this failure case more gracefully
+
+ // reset flag in case the next report also contains this text
+ mCopyrightWarningSeen = FALSE;
+
+ std::ostringstream summary;
+ if (!LLGridManager::getInstance()->isInProductionGrid())
+ {
+ summary << "Preview ";
+ }
+
+ std::string category_name;
+ LLComboBox* combo = getChild<LLComboBox>( "category_combo");
+ if (combo)
+ {
+ category_name = combo->getSelectedItemLabel(); // want label, not value
+ }
#if LL_WINDOWS
- const char* platform = "Win";
+ const char* platform = "Win";
#elif LL_DARWIN
- const char* platform = "Mac";
+ const char* platform = "Mac";
#elif LL_LINUX
- const char* platform = "Lnx";
+ const char* platform = "Lnx";
#else
- const char* platform = "???";
+ const char* platform = "???";
#endif
- summary << ""
- << " |" << regionp->getName() << "|" // region reporter is currently in.
- << " (" << getChild<LLUICtrl>("abuse_location_edit")->getValue().asString() << ")" // region abuse occured in (freeform text - no LLRegionPicker tool)
- << " [" << category_name << "] " // updated category
- << " {" << getChild<LLUICtrl>("abuser_name_edit")->getValue().asString() << "} " // name of abuse entered in report (chosen using LLAvatarPicker)
- << " \"" << getChild<LLUICtrl>("summary_edit")->getValue().asString() << "\""; // summary as entered
-
-
- std::ostringstream details;
-
- details << "V" << LLVersionInfo::instance().getVersion() << std::endl << std::endl; // client version moved to body of email for abuse reports
-
- std::string object_name = getChild<LLUICtrl>("object_name")->getValue().asString();
- if (!object_name.empty() && !mOwnerName.empty())
- {
- details << "Object: " << object_name << "\n";
- details << "Owner: " << mOwnerName << "\n";
- }
-
-
- details << "Abuser name: " << getChild<LLUICtrl>("abuser_name_edit")->getValue().asString() << " \n";
- details << "Abuser location: " << getChild<LLUICtrl>("abuse_location_edit")->getValue().asString() << " \n";
-
- details << getChild<LLUICtrl>("details_edit")->getValue().asString();
-
- std::string version_string;
- version_string = llformat(
- "%s %s %s %s %s",
- LLVersionInfo::instance().getShortVersion().c_str(),
- platform,
- gSysCPU.getFamily().c_str(),
- gGLManager.mGLRenderer.c_str(),
- gGLManager.mDriverVersionVendorString.c_str());
-
- // only send a screenshot ID if we're asked to and the email is
- // going to LL - Estate Owners cannot see the screenshot asset
- LLUUID screenshot_id = LLUUID::null;
- screenshot_id = getChild<LLUICtrl>("screenshot")->getValue();
-
- LLSD report = LLSD::emptyMap();
- report["report-type"] = (U8) mReportType;
- report["category"] = getChild<LLUICtrl>("category_combo")->getValue();
- report["position"] = mPosition.getValue();
- report["check-flags"] = (U8)0; // this is not used
- report["screenshot-id"] = screenshot_id;
- report["object-id"] = mObjectID;
- report["abuser-id"] = mAbuserID;
- report["abuse-region-name"] = "";
- report["abuse-region-id"] = LLUUID::null;
- report["summary"] = summary.str();
- report["version-string"] = version_string;
- report["details"] = details.str();
- return report;
+ summary << ""
+ << " |" << regionp->getName() << "|" // region reporter is currently in.
+ << " (" << getChild<LLUICtrl>("abuse_location_edit")->getValue().asString() << ")" // region abuse occured in (freeform text - no LLRegionPicker tool)
+ << " [" << category_name << "] " // updated category
+ << " {" << getChild<LLUICtrl>("abuser_name_edit")->getValue().asString() << "} " // name of abuse entered in report (chosen using LLAvatarPicker)
+ << " \"" << getChild<LLUICtrl>("summary_edit")->getValue().asString() << "\""; // summary as entered
+
+
+ std::ostringstream details;
+
+ details << "V" << LLVersionInfo::instance().getVersion() << std::endl << std::endl; // client version moved to body of email for abuse reports
+
+ std::string object_name = getChild<LLUICtrl>("object_name")->getValue().asString();
+ if (!object_name.empty() && !mOwnerName.empty())
+ {
+ details << "Object: " << object_name << "\n";
+ details << "Owner: " << mOwnerName << "\n";
+ }
+
+
+ details << "Abuser name: " << getChild<LLUICtrl>("abuser_name_edit")->getValue().asString() << " \n";
+ details << "Abuser location: " << getChild<LLUICtrl>("abuse_location_edit")->getValue().asString() << " \n";
+
+ details << getChild<LLUICtrl>("details_edit")->getValue().asString();
+
+ std::string version_string;
+ version_string = llformat(
+ "%s %s %s %s %s",
+ LLVersionInfo::instance().getShortVersion().c_str(),
+ platform,
+ gSysCPU.getFamily().c_str(),
+ gGLManager.mGLRenderer.c_str(),
+ gGLManager.mDriverVersionVendorString.c_str());
+
+ // only send a screenshot ID if we're asked to and the email is
+ // going to LL - Estate Owners cannot see the screenshot asset
+ LLUUID screenshot_id = LLUUID::null;
+ screenshot_id = getChild<LLUICtrl>("screenshot")->getValue();
+
+ LLSD report = LLSD::emptyMap();
+ report["report-type"] = (U8) mReportType;
+ report["category"] = getChild<LLUICtrl>("category_combo")->getValue();
+ report["position"] = mPosition.getValue();
+ report["check-flags"] = (U8)0; // this is not used
+ report["screenshot-id"] = screenshot_id;
+ report["object-id"] = mObjectID;
+ report["abuser-id"] = mAbuserID;
+ report["abuse-region-name"] = "";
+ report["abuse-region-id"] = LLUUID::null;
+ report["summary"] = summary.str();
+ report["version-string"] = version_string;
+ report["details"] = details.str();
+ return report;
}
void LLFloaterReporter::sendReportViaLegacy(const LLSD & report)
{
- LLViewerRegion *regionp = gAgent.getRegion();
- if (!regionp) return;
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_UserReport);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-
- msg->nextBlockFast(_PREHASH_ReportData);
- msg->addU8Fast(_PREHASH_ReportType, report["report-type"].asInteger());
- msg->addU8(_PREHASH_Category, report["category"].asInteger());
- msg->addVector3Fast(_PREHASH_Position, LLVector3(report["position"]));
- msg->addU8Fast(_PREHASH_CheckFlags, report["check-flags"].asInteger());
- msg->addUUIDFast(_PREHASH_ScreenshotID, report["screenshot-id"].asUUID());
- msg->addUUIDFast(_PREHASH_ObjectID, report["object-id"].asUUID());
- msg->addUUID("AbuserID", report["abuser-id"].asUUID());
- msg->addString("AbuseRegionName", report["abuse-region-name"].asString());
- msg->addUUID("AbuseRegionID", report["abuse-region-id"].asUUID());
-
- msg->addStringFast(_PREHASH_Summary, report["summary"].asString());
- msg->addString("VersionString", report["version-string"]);
- msg->addStringFast(_PREHASH_Details, report["details"] );
-
- msg->sendReliable(regionp->getHost());
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if (!regionp) return;
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_UserReport);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+
+ msg->nextBlockFast(_PREHASH_ReportData);
+ msg->addU8Fast(_PREHASH_ReportType, report["report-type"].asInteger());
+ msg->addU8(_PREHASH_Category, report["category"].asInteger());
+ msg->addVector3Fast(_PREHASH_Position, LLVector3(report["position"]));
+ msg->addU8Fast(_PREHASH_CheckFlags, report["check-flags"].asInteger());
+ msg->addUUIDFast(_PREHASH_ScreenshotID, report["screenshot-id"].asUUID());
+ msg->addUUIDFast(_PREHASH_ObjectID, report["object-id"].asUUID());
+ msg->addUUID("AbuserID", report["abuser-id"].asUUID());
+ msg->addString("AbuseRegionName", report["abuse-region-name"].asString());
+ msg->addUUID("AbuseRegionID", report["abuse-region-id"].asUUID());
+
+ msg->addStringFast(_PREHASH_Summary, report["summary"].asString());
+ msg->addString("VersionString", report["version-string"]);
+ msg->addStringFast(_PREHASH_Details, report["details"] );
+
+ msg->sendReliable(regionp->getHost());
}
void LLFloaterReporter::finishedARPost(const LLSD &)
@@ -857,189 +857,189 @@ void LLFloaterReporter::finishedARPost(const LLSD &)
void LLFloaterReporter::sendReportViaCaps(std::string url, std::string sshot_url, const LLSD& report)
{
- if(!sshot_url.empty())
+ if(!sshot_url.empty())
{
- // try to upload screenshot
+ // try to upload screenshot
LLResourceUploadInfo::ptr_t uploadInfo(new LLARScreenShotUploader(report, mResourceDatap->mAssetInfo.mUuid, mResourceDatap->mAssetInfo.mType));
LLViewerAssetUpload::EnqueueInventoryUpload(sshot_url, uploadInfo);
- }
- else
- {
+ }
+ else
+ {
LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t proc = boost::bind(&LLFloaterReporter::finishedARPost, _1);
LLUploadDialog::modalUploadDialog("Abuse Report");
LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost(url, report, proc, proc);
- }
+ }
}
void LLFloaterReporter::takeScreenshot(bool use_prev_screenshot)
{
- gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", TRUE);
- if(!use_prev_screenshot)
- {
- std::string screenshot_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_PREV_FILENAME);
- LLPointer<LLImagePNG> png_image = new LLImagePNG;
- if(png_image->encode(mImageRaw, 0.0f))
- {
- png_image->save(screenshot_filename);
- }
- }
- else
- {
- mImageRaw = mPrevImageRaw;
- }
-
- LLPointer<LLImageJ2C> upload_data = LLViewerTextureList::convertToUploadFile(mImageRaw);
-
- // create a resource data
- mResourceDatap->mInventoryType = LLInventoryType::IT_NONE;
- mResourceDatap->mNextOwnerPerm = 0; // not used
- mResourceDatap->mExpectedUploadCost = 0; // we expect that abuse screenshots are free
- mResourceDatap->mAssetInfo.mTransactionID.generate();
- mResourceDatap->mAssetInfo.mUuid = mResourceDatap->mAssetInfo.mTransactionID.makeAssetID(gAgent.getSecureSessionID());
-
- if (COMPLAINT_REPORT == mReportType)
- {
- mResourceDatap->mAssetInfo.mType = LLAssetType::AT_TEXTURE;
- mResourceDatap->mPreferredLocation = LLFolderType::EType(LLResourceData::INVALID_LOCATION);
- }
- else
- {
- LL_WARNS() << "Unknown LLFloaterReporter type" << LL_ENDL;
- }
- mResourceDatap->mAssetInfo.mCreatorID = gAgentID;
- mResourceDatap->mAssetInfo.setName("screenshot_name");
- mResourceDatap->mAssetInfo.setDescription("screenshot_descr");
-
- // store in cache
+ gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", TRUE);
+ if(!use_prev_screenshot)
+ {
+ std::string screenshot_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_PREV_FILENAME);
+ LLPointer<LLImagePNG> png_image = new LLImagePNG;
+ if(png_image->encode(mImageRaw, 0.0f))
+ {
+ png_image->save(screenshot_filename);
+ }
+ }
+ else
+ {
+ mImageRaw = mPrevImageRaw;
+ }
+
+ LLPointer<LLImageJ2C> upload_data = LLViewerTextureList::convertToUploadFile(mImageRaw);
+
+ // create a resource data
+ mResourceDatap->mInventoryType = LLInventoryType::IT_NONE;
+ mResourceDatap->mNextOwnerPerm = 0; // not used
+ mResourceDatap->mExpectedUploadCost = 0; // we expect that abuse screenshots are free
+ mResourceDatap->mAssetInfo.mTransactionID.generate();
+ mResourceDatap->mAssetInfo.mUuid = mResourceDatap->mAssetInfo.mTransactionID.makeAssetID(gAgent.getSecureSessionID());
+
+ if (COMPLAINT_REPORT == mReportType)
+ {
+ mResourceDatap->mAssetInfo.mType = LLAssetType::AT_TEXTURE;
+ mResourceDatap->mPreferredLocation = LLFolderType::EType(LLResourceData::INVALID_LOCATION);
+ }
+ else
+ {
+ LL_WARNS() << "Unknown LLFloaterReporter type" << LL_ENDL;
+ }
+ mResourceDatap->mAssetInfo.mCreatorID = gAgentID;
+ mResourceDatap->mAssetInfo.setName("screenshot_name");
+ mResourceDatap->mAssetInfo.setDescription("screenshot_descr");
+
+ // store in cache
LLFileSystem j2c_file(mResourceDatap->mAssetInfo.mUuid, mResourceDatap->mAssetInfo.mType, LLFileSystem::WRITE);
j2c_file.write(upload_data->getData(), upload_data->getDataSize());
- // store in the image list so it doesn't try to fetch from the server
- LLPointer<LLViewerFetchedTexture> image_in_list =
- LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid);
- image_in_list->createGLTexture(0, mImageRaw, 0, TRUE, LLGLTexture::OTHER);
-
- // the texture picker then uses that texture
- LLTextureCtrl* texture = getChild<LLTextureCtrl>("screenshot");
- if (texture)
- {
- texture->setImageAssetID(mResourceDatap->mAssetInfo.mUuid);
- texture->setDefaultImageAssetID(mResourceDatap->mAssetInfo.mUuid);
- texture->setCaption(getString("Screenshot"));
- }
+ // store in the image list so it doesn't try to fetch from the server
+ LLPointer<LLViewerFetchedTexture> image_in_list =
+ LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid);
+ image_in_list->createGLTexture(0, mImageRaw, 0, TRUE, LLGLTexture::OTHER);
+
+ // the texture picker then uses that texture
+ LLTextureCtrl* texture = getChild<LLTextureCtrl>("screenshot");
+ if (texture)
+ {
+ texture->setImageAssetID(mResourceDatap->mAssetInfo.mUuid);
+ texture->setDefaultImageAssetID(mResourceDatap->mAssetInfo.mUuid);
+ texture->setCaption(getString("Screenshot"));
+ }
}
void LLFloaterReporter::takeNewSnapshot()
{
- childSetEnabled("send_btn", true);
- mImageRaw = new LLImageRaw;
- const S32 IMAGE_WIDTH = 1024;
- const S32 IMAGE_HEIGHT = 768;
+ childSetEnabled("send_btn", true);
+ mImageRaw = new LLImageRaw;
+ const S32 IMAGE_WIDTH = 1024;
+ const S32 IMAGE_HEIGHT = 768;
- // Take a screenshot, but don't draw this floater.
- setVisible(FALSE);
+ // Take a screenshot, but don't draw this floater.
+ setVisible(FALSE);
if (!gViewerWindow->rawSnapshot(mImageRaw,IMAGE_WIDTH, IMAGE_HEIGHT, TRUE, FALSE, TRUE /*UI*/, TRUE, FALSE))
- {
- LL_WARNS() << "Unable to take screenshot" << LL_ENDL;
- setVisible(TRUE);
- return;
- }
- setVisible(TRUE);
-
- if(gSavedPerAccountSettings.getBOOL("PreviousScreenshotForReport"))
- {
- std::string screenshot_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_PREV_FILENAME);
- mPrevImageRaw = new LLImageRaw;
- LLPointer<LLImagePNG> start_image_png = new LLImagePNG;
- if(start_image_png->load(screenshot_filename))
- {
- if (start_image_png->decode(mPrevImageRaw, 0.0f))
- {
- LLNotificationsUtil::add("LoadPreviousReportScreenshot", LLSD(), LLSD(), boost::bind(&LLFloaterReporter::onLoadScreenshotDialog,this, _1, _2));
- return;
- }
- }
- }
- takeScreenshot();
+ {
+ LL_WARNS() << "Unable to take screenshot" << LL_ENDL;
+ setVisible(TRUE);
+ return;
+ }
+ setVisible(TRUE);
+
+ if(gSavedPerAccountSettings.getBOOL("PreviousScreenshotForReport"))
+ {
+ std::string screenshot_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_PREV_FILENAME);
+ mPrevImageRaw = new LLImageRaw;
+ LLPointer<LLImagePNG> start_image_png = new LLImagePNG;
+ if(start_image_png->load(screenshot_filename))
+ {
+ if (start_image_png->decode(mPrevImageRaw, 0.0f))
+ {
+ LLNotificationsUtil::add("LoadPreviousReportScreenshot", LLSD(), LLSD(), boost::bind(&LLFloaterReporter::onLoadScreenshotDialog,this, _1, _2));
+ return;
+ }
+ }
+ }
+ takeScreenshot();
}
void LLFloaterReporter::onOpen(const LLSD& key)
{
- childSetEnabled("send_btn", false);
- //Time delay to avoid UI artifacts. MAINT-7067
- mSnapshotTimer.start();
+ childSetEnabled("send_btn", false);
+ //Time delay to avoid UI artifacts. MAINT-7067
+ mSnapshotTimer.start();
}
void LLFloaterReporter::onLoadScreenshotDialog(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- takeScreenshot(option == 0);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ takeScreenshot(option == 0);
}
void LLFloaterReporter::uploadImage()
{
- LL_INFOS() << "*** Uploading: " << LL_ENDL;
- LL_INFOS() << "Type: " << LLAssetType::lookup(mResourceDatap->mAssetInfo.mType) << LL_ENDL;
- LL_INFOS() << "UUID: " << mResourceDatap->mAssetInfo.mUuid << LL_ENDL;
- LL_INFOS() << "Name: " << mResourceDatap->mAssetInfo.getName() << LL_ENDL;
- LL_INFOS() << "Desc: " << mResourceDatap->mAssetInfo.getDescription() << LL_ENDL;
-
- gAssetStorage->storeAssetData(mResourceDatap->mAssetInfo.mTransactionID,
- mResourceDatap->mAssetInfo.mType,
- LLFloaterReporter::uploadDoneCallback,
- (void*)mResourceDatap, TRUE);
+ LL_INFOS() << "*** Uploading: " << LL_ENDL;
+ LL_INFOS() << "Type: " << LLAssetType::lookup(mResourceDatap->mAssetInfo.mType) << LL_ENDL;
+ LL_INFOS() << "UUID: " << mResourceDatap->mAssetInfo.mUuid << LL_ENDL;
+ LL_INFOS() << "Name: " << mResourceDatap->mAssetInfo.getName() << LL_ENDL;
+ LL_INFOS() << "Desc: " << mResourceDatap->mAssetInfo.getDescription() << LL_ENDL;
+
+ gAssetStorage->storeAssetData(mResourceDatap->mAssetInfo.mTransactionID,
+ mResourceDatap->mAssetInfo.mType,
+ LLFloaterReporter::uploadDoneCallback,
+ (void*)mResourceDatap, TRUE);
}
// static
void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
- LLUploadDialog::modalUploadFinished();
-
- LLResourceData* data = (LLResourceData*)user_data;
-
- if(result < 0)
- {
- LLSD args;
- args["REASON"] = std::string(LLAssetStorage::getErrorString(result));
- LLNotificationsUtil::add("ErrorUploadingReportScreenshot", args);
-
- std::string err_msg("There was a problem uploading a report screenshot");
- err_msg += " due to the following reason: " + args["REASON"].asString();
- LL_WARNS() << err_msg << LL_ENDL;
- return;
- }
-
- if (data->mPreferredLocation != LLResourceData::INVALID_LOCATION)
- {
- LL_WARNS() << "Unknown report type : " << data->mPreferredLocation << LL_ENDL;
- }
-
- LLFloaterReporter *self = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
- if (self)
- {
- self->mScreenID = uuid;
- LL_INFOS() << "Got screen shot " << uuid << LL_ENDL;
- self->sendReportViaLegacy(self->gatherReport());
- LLNotificationsUtil::add("HelpReportAbuseConfirm");
- self->closeFloater();
- }
+ LLUploadDialog::modalUploadFinished();
+
+ LLResourceData* data = (LLResourceData*)user_data;
+
+ if(result < 0)
+ {
+ LLSD args;
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(result));
+ LLNotificationsUtil::add("ErrorUploadingReportScreenshot", args);
+
+ std::string err_msg("There was a problem uploading a report screenshot");
+ err_msg += " due to the following reason: " + args["REASON"].asString();
+ LL_WARNS() << err_msg << LL_ENDL;
+ return;
+ }
+
+ if (data->mPreferredLocation != LLResourceData::INVALID_LOCATION)
+ {
+ LL_WARNS() << "Unknown report type : " << data->mPreferredLocation << LL_ENDL;
+ }
+
+ LLFloaterReporter *self = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
+ if (self)
+ {
+ self->mScreenID = uuid;
+ LL_INFOS() << "Got screen shot " << uuid << LL_ENDL;
+ self->sendReportViaLegacy(self->gatherReport());
+ LLNotificationsUtil::add("HelpReportAbuseConfirm");
+ self->closeFloater();
+ }
}
void LLFloaterReporter::setPosBox(const LLVector3d &pos)
{
- mPosition.setVec(pos);
- std::string pos_string = llformat("{%.1f, %.1f, %.1f}",
- mPosition.mV[VX],
- mPosition.mV[VY],
- mPosition.mV[VZ]);
- getChild<LLUICtrl>("pos_field")->setValue(pos_string);
+ mPosition.setVec(pos);
+ std::string pos_string = llformat("{%.1f, %.1f, %.1f}",
+ mPosition.mV[VX],
+ mPosition.mV[VY],
+ mPosition.mV[VZ]);
+ getChild<LLUICtrl>("pos_field")->setValue(pos_string);
}
void LLFloaterReporter::onClose(bool app_quitting)
{
- mSnapshotTimer.stop();
- gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", app_quitting);
+ mSnapshotTimer.stop();
+ gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", app_quitting);
}
diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h
index b6c70e866d..f10fcc8a0c 100644
--- a/indra/newview/llfloaterreporter.h
+++ b/indra/newview/llfloaterreporter.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterreporter.h
* @author Andrew Meadows
* @brief Abuse reports.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,9 +44,9 @@ class LLMeanCollisionData;
struct LLResourceData;
// these flags are used to label info requests to the server
-//const U32 BUG_REPORT_REQUEST = 0x01 << 0; // DEPRECATED
-const U32 COMPLAINT_REPORT_REQUEST = 0x01 << 1;
-const U32 OBJECT_PAY_REQUEST = 0x01 << 2;
+//const U32 BUG_REPORT_REQUEST = 0x01 << 0; // DEPRECATED
+const U32 COMPLAINT_REPORT_REQUEST = 0x01 << 1;
+const U32 OBJECT_PAY_REQUEST = 0x01 << 2;
// ************************************************************
@@ -67,87 +67,87 @@ const U32 OBJECT_PAY_REQUEST = 0x01 << 2;
// ************************************************************
enum EReportType
{
- NULL_REPORT = 0, // don't use this value anywhere
- UNKNOWN_REPORT = 1,
- //BUG_REPORT = 2, // DEPRECATED
- COMPLAINT_REPORT = 3,
- CS_REQUEST_REPORT = 4
+ NULL_REPORT = 0, // don't use this value anywhere
+ UNKNOWN_REPORT = 1,
+ //BUG_REPORT = 2, // DEPRECATED
+ COMPLAINT_REPORT = 3,
+ CS_REQUEST_REPORT = 4
};
class LLFloaterReporter
-: public LLFloater
+: public LLFloater
{
public:
- LLFloaterReporter(const LLSD& key);
- /*virtual*/ ~LLFloaterReporter();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
-
- static void onIdle(void* user_data);
-
- void setReportType(EReportType type) { mReportType = type; }
-
- // Enables all buttons
- static void showFromMenu(EReportType report_type);
-
- static void showFromObject(const LLUUID& object_id, const LLUUID& experience_id = LLUUID::null);
- static void showFromAvatar(const LLUUID& avatar_id, const std::string avatar_name);
+ LLFloaterReporter(const LLSD& key);
+ /*virtual*/ ~LLFloaterReporter();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
+
+ static void onIdle(void* user_data);
+
+ void setReportType(EReportType type) { mReportType = type; }
+
+ // Enables all buttons
+ static void showFromMenu(EReportType report_type);
+
+ static void showFromObject(const LLUUID& object_id, const LLUUID& experience_id = LLUUID::null);
+ static void showFromAvatar(const LLUUID& avatar_id, const std::string avatar_name);
static void showFromChat(const LLUUID& avatar_id, const std::string& avatar_name, const std::string& time, const std::string& description);
- static void showFromExperience(const LLUUID& experience_id);
+ static void showFromExperience(const LLUUID& experience_id);
- static void onClickSend (void *userdata);
- static void onClickCancel (void *userdata);
- static void onClickObjPicker (void *userdata);
- void onClickSelectAbuser ();
- static void closePickTool (void *userdata);
- static void uploadDoneCallback(const LLUUID &uuid, void* user_data, S32 result, LLExtStat ext_status);
+ static void onClickSend (void *userdata);
+ static void onClickCancel (void *userdata);
+ static void onClickObjPicker (void *userdata);
+ void onClickSelectAbuser ();
+ static void closePickTool (void *userdata);
+ static void uploadDoneCallback(const LLUUID &uuid, void* user_data, S32 result, LLExtStat ext_status);
- void setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id);
+ void setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id);
- void onLoadScreenshotDialog(const LLSD& notification, const LLSD& response);
+ void onLoadScreenshotDialog(const LLSD& notification, const LLSD& response);
- void takeNewSnapshot();
+ void takeNewSnapshot();
private:
- static void show(const LLUUID& object_id, const std::string& avatar_name = LLStringUtil::null, const LLUUID& experience_id = LLUUID::null);
-
- void takeScreenshot(bool use_prev_screenshot = false);
- void uploadImage();
- bool validateReport();
- LLSD gatherReport();
- void sendReportViaLegacy(const LLSD & report);
- void sendReportViaCaps(std::string url, std::string sshot_url, const LLSD & report);
- void setPosBox(const LLVector3d &pos);
- void enableControls(BOOL own_avatar);
- void getExperienceInfo(const LLUUID& object_id);
- void getObjectInfo(const LLUUID& object_id);
- void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
- void setFromAvatarID(const LLUUID& avatar_id);
- void onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name);
-
- static void requestAbuseCategoriesCoro(std::string url, LLHandle<LLFloater> handle);
+ static void show(const LLUUID& object_id, const std::string& avatar_name = LLStringUtil::null, const LLUUID& experience_id = LLUUID::null);
+
+ void takeScreenshot(bool use_prev_screenshot = false);
+ void uploadImage();
+ bool validateReport();
+ LLSD gatherReport();
+ void sendReportViaLegacy(const LLSD & report);
+ void sendReportViaCaps(std::string url, std::string sshot_url, const LLSD & report);
+ void setPosBox(const LLVector3d &pos);
+ void enableControls(BOOL own_avatar);
+ void getExperienceInfo(const LLUUID& object_id);
+ void getObjectInfo(const LLUUID& object_id);
+ void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
+ void setFromAvatarID(const LLUUID& avatar_id);
+ void onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name);
+
+ static void requestAbuseCategoriesCoro(std::string url, LLHandle<LLFloater> handle);
static void finishedARPost(const LLSD &);
private:
- EReportType mReportType;
- LLUUID mObjectID;
- LLUUID mScreenID;
- LLUUID mAbuserID;
- LLUUID mExperienceID;
- // Store the real name, not the link, for upstream reporting
- std::string mOwnerName;
- BOOL mDeselectOnClose;
- BOOL mPicking;
- LLVector3 mPosition;
- BOOL mCopyrightWarningSeen;
- std::string mDefaultSummary;
- LLResourceData* mResourceDatap;
- boost::signals2::connection mAvatarNameCacheConnection;
-
- LLPointer<LLImageRaw> mImageRaw;
- LLPointer<LLImageRaw> mPrevImageRaw;
- LLFrameTimer mSnapshotTimer;
+ EReportType mReportType;
+ LLUUID mObjectID;
+ LLUUID mScreenID;
+ LLUUID mAbuserID;
+ LLUUID mExperienceID;
+ // Store the real name, not the link, for upstream reporting
+ std::string mOwnerName;
+ BOOL mDeselectOnClose;
+ BOOL mPicking;
+ LLVector3 mPosition;
+ BOOL mCopyrightWarningSeen;
+ std::string mDefaultSummary;
+ LLResourceData* mResourceDatap;
+ boost::signals2::connection mAvatarNameCacheConnection;
+
+ LLPointer<LLImageRaw> mImageRaw;
+ LLPointer<LLImageRaw> mPrevImageRaw;
+ LLFrameTimer mSnapshotTimer;
};
#endif
diff --git a/indra/newview/llfloatersavecamerapreset.cpp b/indra/newview/llfloatersavecamerapreset.cpp
index 11809f9c82..0224d8652e 100644
--- a/indra/newview/llfloatersavecamerapreset.cpp
+++ b/indra/newview/llfloatersavecamerapreset.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatersavecamerapreset.cpp
* @brief Floater to save a camera preset
*
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,131 +42,131 @@
#include "llvoavatarself.h"
LLFloaterSaveCameraPreset::LLFloaterSaveCameraPreset(const LLSD &key)
- : LLModalDialog(key)
+ : LLModalDialog(key)
{
}
// virtual
BOOL LLFloaterSaveCameraPreset::postBuild()
{
- mPresetCombo = getChild<LLComboBox>("preset_combo");
+ mPresetCombo = getChild<LLComboBox>("preset_combo");
+
+ mNameEditor = getChild<LLLineEditor>("preset_txt_editor");
+ mNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterSaveCameraPreset::onPresetNameEdited, this), NULL);
+
+ mSaveButton = getChild<LLButton>("save");
+ mSaveButton->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onBtnSave, this));
- mNameEditor = getChild<LLLineEditor>("preset_txt_editor");
- mNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterSaveCameraPreset::onPresetNameEdited, this), NULL);
+ mSaveRadioGroup = getChild<LLRadioGroup>("radio_save_preset");
+ mSaveRadioGroup->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onSwitchSaveReplace, this));
- mSaveButton = getChild<LLButton>("save");
- mSaveButton->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onBtnSave, this));
-
- mSaveRadioGroup = getChild<LLRadioGroup>("radio_save_preset");
- mSaveRadioGroup->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onSwitchSaveReplace, this));
-
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onBtnCancel, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onBtnCancel, this));
- LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSaveCameraPreset::onPresetsListChange, this));
+ LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSaveCameraPreset::onPresetsListChange, this));
- return TRUE;
+ return TRUE;
}
void LLFloaterSaveCameraPreset::onPresetNameEdited()
{
- if (mSaveRadioGroup->getSelectedIndex() == 0)
- {
- // Disable saving a preset having empty name.
- std::string name = mNameEditor->getValue();
- mSaveButton->setEnabled(!name.empty());
- }
+ if (mSaveRadioGroup->getSelectedIndex() == 0)
+ {
+ // Disable saving a preset having empty name.
+ std::string name = mNameEditor->getValue();
+ mSaveButton->setEnabled(!name.empty());
+ }
}
void LLFloaterSaveCameraPreset::onOpen(const LLSD& key)
{
- LLModalDialog::onOpen(key);
- S32 index = 0;
- if (key.has("index"))
- {
- index = key["index"].asInteger();
- }
-
- LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_BOTTOM);
-
- mSaveRadioGroup->setSelectedIndex(index);
- onPresetNameEdited();
- onSwitchSaveReplace();
+ LLModalDialog::onOpen(key);
+ S32 index = 0;
+ if (key.has("index"))
+ {
+ index = key["index"].asInteger();
+ }
+
+ LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_BOTTOM);
+
+ mSaveRadioGroup->setSelectedIndex(index);
+ onPresetNameEdited();
+ onSwitchSaveReplace();
}
void LLFloaterSaveCameraPreset::onBtnSave()
{
- bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0;
- std::string name = is_saving_new ? mNameEditor->getText() : mPresetCombo->getSimple();
-
- if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT))
- {
- LLNotificationsUtil::add("DefaultPresetNotSaved");
- }
- else
- {
- if (isAgentAvatarValid() && gAgentAvatarp->getParent())
- {
- gSavedSettings.setLLSD("AvatarSitRotation", gAgent.getFrameAgent().getQuaternion().getValue());
- }
- if (gAgentCamera.isJoystickCameraUsed())
- {
- gSavedSettings.setVector3("CameraOffsetRearView", gAgentCamera.getCurrentCameraOffset());
- gSavedSettings.setVector3d("FocusOffsetRearView", gAgentCamera.getCurrentFocusOffset());
- gAgentCamera.resetCameraZoomFraction();
- gAgentCamera.setFocusOnAvatar(TRUE, TRUE, FALSE);
- }
- else
- {
- LLVector3 camera_offset = gSavedSettings.getVector3("CameraOffsetRearView") * gAgentCamera.getCurrentCameraZoomFraction();
- gSavedSettings.setVector3("CameraOffsetRearView", camera_offset);
- gAgentCamera.resetCameraZoomFraction();
- }
- if (is_saving_new)
- {
- std::list<std::string> preset_names;
- LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_HIDE);
- if (std::find(preset_names.begin(), preset_names.end(), name) != preset_names.end())
- {
- LLSD args;
- args["NAME"] = name;
- LLNotificationsUtil::add("PresetAlreadyExists", args);
- return;
- }
- }
- if (!LLPresetsManager::getInstance()->savePreset(PRESETS_CAMERA, name))
- {
- LLSD args;
- args["NAME"] = name;
- LLNotificationsUtil::add("PresetNotSaved", args);
- }
- }
-
- closeFloater();
+ bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0;
+ std::string name = is_saving_new ? mNameEditor->getText() : mPresetCombo->getSimple();
+
+ if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT))
+ {
+ LLNotificationsUtil::add("DefaultPresetNotSaved");
+ }
+ else
+ {
+ if (isAgentAvatarValid() && gAgentAvatarp->getParent())
+ {
+ gSavedSettings.setLLSD("AvatarSitRotation", gAgent.getFrameAgent().getQuaternion().getValue());
+ }
+ if (gAgentCamera.isJoystickCameraUsed())
+ {
+ gSavedSettings.setVector3("CameraOffsetRearView", gAgentCamera.getCurrentCameraOffset());
+ gSavedSettings.setVector3d("FocusOffsetRearView", gAgentCamera.getCurrentFocusOffset());
+ gAgentCamera.resetCameraZoomFraction();
+ gAgentCamera.setFocusOnAvatar(TRUE, TRUE, FALSE);
+ }
+ else
+ {
+ LLVector3 camera_offset = gSavedSettings.getVector3("CameraOffsetRearView") * gAgentCamera.getCurrentCameraZoomFraction();
+ gSavedSettings.setVector3("CameraOffsetRearView", camera_offset);
+ gAgentCamera.resetCameraZoomFraction();
+ }
+ if (is_saving_new)
+ {
+ std::list<std::string> preset_names;
+ LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_HIDE);
+ if (std::find(preset_names.begin(), preset_names.end(), name) != preset_names.end())
+ {
+ LLSD args;
+ args["NAME"] = name;
+ LLNotificationsUtil::add("PresetAlreadyExists", args);
+ return;
+ }
+ }
+ if (!LLPresetsManager::getInstance()->savePreset(PRESETS_CAMERA, name))
+ {
+ LLSD args;
+ args["NAME"] = name;
+ LLNotificationsUtil::add("PresetNotSaved", args);
+ }
+ }
+
+ closeFloater();
}
void LLFloaterSaveCameraPreset::onPresetsListChange()
{
- LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_BOTTOM);
+ LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_BOTTOM);
}
void LLFloaterSaveCameraPreset::onBtnCancel()
{
- closeFloater();
+ closeFloater();
}
void LLFloaterSaveCameraPreset::onSwitchSaveReplace()
{
- bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0;
- std::string label = is_saving_new ? getString("btn_label_save") : getString("btn_label_replace");
- mSaveButton->setLabel(label);
- mNameEditor->setEnabled(is_saving_new);
- mPresetCombo->setEnabled(!is_saving_new);
- if (is_saving_new)
- {
- onPresetNameEdited();
- }
- else
- {
- mSaveButton->setEnabled(true);
- }
+ bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0;
+ std::string label = is_saving_new ? getString("btn_label_save") : getString("btn_label_replace");
+ mSaveButton->setLabel(label);
+ mNameEditor->setEnabled(is_saving_new);
+ mPresetCombo->setEnabled(!is_saving_new);
+ if (is_saving_new)
+ {
+ onPresetNameEdited();
+ }
+ else
+ {
+ mSaveButton->setEnabled(true);
+ }
}
diff --git a/indra/newview/llfloatersavecamerapreset.h b/indra/newview/llfloatersavecamerapreset.h
index 282f213438..b90b406d1f 100644
--- a/indra/newview/llfloatersavecamerapreset.h
+++ b/indra/newview/llfloatersavecamerapreset.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatersavecamerapreset.h
* @brief Floater to save a camera preset
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,23 +38,23 @@ class LLFloaterSaveCameraPreset : public LLModalDialog
{
public:
- LLFloaterSaveCameraPreset(const LLSD &key);
+ LLFloaterSaveCameraPreset(const LLSD &key);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- void onBtnSave();
- void onBtnCancel();
- void onSwitchSaveReplace();
+ void onBtnSave();
+ void onBtnCancel();
+ void onSwitchSaveReplace();
private:
- LLRadioGroup* mSaveRadioGroup;
- LLLineEditor* mNameEditor;
- LLComboBox* mPresetCombo;
- LLButton* mSaveButton;
+ LLRadioGroup* mSaveRadioGroup;
+ LLLineEditor* mNameEditor;
+ LLComboBox* mPresetCombo;
+ LLButton* mSaveButton;
- void onPresetsListChange();
- void onPresetNameEdited();
+ void onPresetsListChange();
+ void onPresetNameEdited();
};
#endif // LL_LLFLOATERSAVECAMERAPRESET_H
diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp
index dd47d02bfa..f70dc04d14 100644
--- a/indra/newview/llfloatersaveprefpreset.cpp
+++ b/indra/newview/llfloatersaveprefpreset.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatersaveprefpreset.cpp
* @brief Floater to save a graphics preset
*
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,79 +37,79 @@
#include "lltrans.h"
LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key)
- : LLFloater(key)
+ : LLFloater(key)
{
}
// virtual
BOOL LLFloaterSavePrefPreset::postBuild()
{
- LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences");
- if (preferences)
- {
- preferences->addDependentFloater(this);
- }
-
- getChild<LLComboBox>("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
- getChild<LLComboBox>("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
- getChild<LLButton>("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this));
-
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this));
-
- LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this));
-
- mSaveButton = getChild<LLButton>("save");
- mPresetCombo = getChild<LLComboBox>("preset_combo");
-
- return TRUE;
+ LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences");
+ if (preferences)
+ {
+ preferences->addDependentFloater(this);
+ }
+
+ getChild<LLComboBox>("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
+ getChild<LLComboBox>("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
+ getChild<LLButton>("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this));
+
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this));
+
+ LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this));
+
+ mSaveButton = getChild<LLButton>("save");
+ mPresetCombo = getChild<LLComboBox>("preset_combo");
+
+ return TRUE;
}
void LLFloaterSavePrefPreset::onPresetNameEdited()
{
- // Disable saving a preset having empty name.
- std::string name = mPresetCombo->getSimple();
+ // Disable saving a preset having empty name.
+ std::string name = mPresetCombo->getSimple();
- mSaveButton->setEnabled(!name.empty());
+ mSaveButton->setEnabled(!name.empty());
}
void LLFloaterSavePrefPreset::onOpen(const LLSD& key)
{
- mSubdirectory = key.asString();
+ mSubdirectory = key.asString();
- EDefaultOptions option = DEFAULT_HIDE;
- LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option);
+ EDefaultOptions option = DEFAULT_HIDE;
+ LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option);
- onPresetNameEdited();
+ onPresetNameEdited();
}
void LLFloaterSavePrefPreset::onBtnSave()
{
- std::string name = mPresetCombo->getSimple();
-
- std::string upper_name(name);
- LLStringUtil::toUpper(upper_name);
-
- if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (upper_name == PRESETS_DEFAULT_UPPER))
- {
- LLNotificationsUtil::add("DefaultPresetNotSaved");
- }
- else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name))
- {
- LLSD args;
- args["NAME"] = name;
- LLNotificationsUtil::add("PresetNotSaved", args);
- }
-
- closeFloater();
+ std::string name = mPresetCombo->getSimple();
+
+ std::string upper_name(name);
+ LLStringUtil::toUpper(upper_name);
+
+ if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (upper_name == PRESETS_DEFAULT_UPPER))
+ {
+ LLNotificationsUtil::add("DefaultPresetNotSaved");
+ }
+ else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name))
+ {
+ LLSD args;
+ args["NAME"] = name;
+ LLNotificationsUtil::add("PresetNotSaved", args);
+ }
+
+ closeFloater();
}
void LLFloaterSavePrefPreset::onPresetsListChange()
{
- EDefaultOptions option = DEFAULT_HIDE;
- LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option);
+ EDefaultOptions option = DEFAULT_HIDE;
+ LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option);
}
void LLFloaterSavePrefPreset::onBtnCancel()
{
- closeFloater();
+ closeFloater();
}
diff --git a/indra/newview/llfloatersaveprefpreset.h b/indra/newview/llfloatersaveprefpreset.h
index ae58180e7f..c6bfbd37ba 100644
--- a/indra/newview/llfloatersaveprefpreset.h
+++ b/indra/newview/llfloatersaveprefpreset.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatersaveprefpreset.h
* @brief Floater to save a graphics preset
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,23 +36,23 @@ class LLFloaterSavePrefPreset : public LLFloater
{
public:
- LLFloaterSavePrefPreset(const LLSD &key);
+ LLFloaterSavePrefPreset(const LLSD &key);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- void onBtnSave();
- void onBtnCancel();
+ void onBtnSave();
+ void onBtnCancel();
private:
- LLComboBox* mPresetCombo;
- LLButton* mSaveButton;
+ LLComboBox* mPresetCombo;
+ LLButton* mSaveButton;
- void onPresetsListChange();
- void onPresetNameEdited();
+ void onPresetsListChange();
+ void onPresetNameEdited();
- std::string mSubdirectory;
+ std::string mSubdirectory;
};
#endif // LL_LLFLOATERSAVEPREFPRESET_H
diff --git a/indra/newview/llfloatersceneloadstats.cpp b/indra/newview/llfloatersceneloadstats.cpp
index 8aa93eae96..99b098e205 100644
--- a/indra/newview/llfloatersceneloadstats.cpp
+++ b/indra/newview/llfloatersceneloadstats.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatersceneloadstats.cpp
* @author Richard Nelson
* @brief debug floater for measuring various scene load statistics
@@ -6,35 +6,35 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
#include "llviewerprecompiledheaders.h"
#include "llfloatersceneloadstats.h"
-LLFloaterSceneLoadStats::LLFloaterSceneLoadStats( const LLSD& key )
-: LLFloater(key)
+LLFloaterSceneLoadStats::LLFloaterSceneLoadStats( const LLSD& key )
+: LLFloater(key)
{}
BOOL LLFloaterSceneLoadStats::postBuild()
{
- return TRUE;
+ return TRUE;
}
diff --git a/indra/newview/llfloatersceneloadstats.h b/indra/newview/llfloatersceneloadstats.h
index aa414bf544..f6b99d7dab 100644
--- a/indra/newview/llfloatersceneloadstats.h
+++ b/indra/newview/llfloatersceneloadstats.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatersceneloadstats.h
* @brief debug floater for measuring various scene load statistics
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,12 +31,12 @@
class LLFloaterSceneLoadStats : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
private:
- LLFloaterSceneLoadStats(const LLSD& key);
+ LLFloaterSceneLoadStats(const LLSD& key);
public:
- BOOL postBuild();
+ BOOL postBuild();
};
diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp
index 1ea3a07536..8331e034c0 100644
--- a/indra/newview/llfloaterscriptdebug.cpp
+++ b/indra/newview/llfloaterscriptdebug.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterscriptdebug.cpp
* @brief Chat window for showing script errors and warnings
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,11 +53,11 @@
LLFloaterScriptDebug::LLFloaterScriptDebug(const LLSD& key)
: LLMultiFloater(key)
{
- // avoid resizing of the window to match
- // the initial size of the tabbed-childs, whenever a tab is opened or closed
- mAutoResize = FALSE;
- // enabled autocous blocks controling focus via LLFloaterReg::showInstance
- setAutoFocus(FALSE);
+ // avoid resizing of the window to match
+ // the initial size of the tabbed-childs, whenever a tab is opened or closed
+ mAutoResize = FALSE;
+ // enabled autocous blocks controling focus via LLFloaterReg::showInstance
+ setAutoFocus(FALSE);
}
LLFloaterScriptDebug::~LLFloaterScriptDebug()
@@ -66,113 +66,113 @@ LLFloaterScriptDebug::~LLFloaterScriptDebug()
void LLFloaterScriptDebug::show(const LLUUID& object_id)
{
- addOutputWindow(object_id);
+ addOutputWindow(object_id);
}
BOOL LLFloaterScriptDebug::postBuild()
{
- LLMultiFloater::postBuild();
+ LLMultiFloater::postBuild();
- if (mTabContainer)
- {
- return TRUE;
- }
+ if (mTabContainer)
+ {
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
void LLFloaterScriptDebug::setVisible(BOOL visible)
{
- if(visible)
- {
- LLFloaterScriptDebugOutput* floater_output = LLFloaterReg::findTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", LLUUID::null);
- if (floater_output == NULL)
- {
- floater_output = dynamic_cast<LLFloaterScriptDebugOutput*>(LLFloaterReg::showInstance("script_debug_output", LLUUID::null, FALSE));
- if (floater_output)
- {
- addFloater(floater_output, false);
- }
- }
-
- }
- LLMultiFloater::setVisible(visible);
+ if(visible)
+ {
+ LLFloaterScriptDebugOutput* floater_output = LLFloaterReg::findTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", LLUUID::null);
+ if (floater_output == NULL)
+ {
+ floater_output = dynamic_cast<LLFloaterScriptDebugOutput*>(LLFloaterReg::showInstance("script_debug_output", LLUUID::null, FALSE));
+ if (floater_output)
+ {
+ addFloater(floater_output, false);
+ }
+ }
+
+ }
+ LLMultiFloater::setVisible(visible);
}
void LLFloaterScriptDebug::closeFloater(bool app_quitting/* = false*/)
{
- if(app_quitting)
- {
- LLMultiFloater::closeFloater(app_quitting);
- }
- else
- {
- setVisible(false);
- }
+ if(app_quitting)
+ {
+ LLMultiFloater::closeFloater(app_quitting);
+ }
+ else
+ {
+ setVisible(false);
+ }
}
LLFloater* LLFloaterScriptDebug::addOutputWindow(const LLUUID &object_id)
{
- LLMultiFloater* host = LLFloaterReg::showTypedInstance<LLMultiFloater>("script_debug", LLSD());
- if (!host)
- return NULL;
+ LLMultiFloater* host = LLFloaterReg::showTypedInstance<LLMultiFloater>("script_debug", LLSD());
+ if (!host)
+ return NULL;
- LLFloater::setFloaterHost(host);
- // prevent stealing focus, see EXT-8040
- LLFloater* floaterp = LLFloaterReg::showInstance("script_debug_output", object_id, FALSE);
- LLFloater::setFloaterHost(NULL);
+ LLFloater::setFloaterHost(host);
+ // prevent stealing focus, see EXT-8040
+ LLFloater* floaterp = LLFloaterReg::showInstance("script_debug_output", object_id, FALSE);
+ LLFloater::setFloaterHost(NULL);
- return floaterp;
+ return floaterp;
}
void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id)
{
- LLViewerObject* objectp = gObjectList.findObject(source_id);
- std::string floater_label;
-
- // Handle /me messages.
- std::string prefix = utf8mesg.substr(0, 4);
- std::string message = (prefix == "/me " || prefix == "/me'") ? user_name + utf8mesg.substr(3) : utf8mesg;
-
- if (objectp)
- {
- if(objectp->isHUDAttachment())
- {
- if (isAgentAvatarValid())
- {
- ((LLViewerObject*)gAgentAvatarp)->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI));
- }
- }
- else
- {
- objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI));
- }
- floater_label = llformat("%s(%.0f, %.0f, %.0f)",
- user_name.c_str(),
- objectp->getPositionRegion().mV[VX],
- objectp->getPositionRegion().mV[VY],
- objectp->getPositionRegion().mV[VZ]);
- }
- else
- {
- floater_label = user_name;
- }
-
- addOutputWindow(source_id);
-
- // add to "All" floater
- LLFloaterScriptDebugOutput* floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", LLUUID::null);
- if (floaterp)
- {
- floaterp->addLine(message, user_name, color);
- }
-
- // add to specific script instance floater
- floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", source_id);
- if (floaterp)
- {
- floaterp->addLine(message, floater_label, color);
- }
+ LLViewerObject* objectp = gObjectList.findObject(source_id);
+ std::string floater_label;
+
+ // Handle /me messages.
+ std::string prefix = utf8mesg.substr(0, 4);
+ std::string message = (prefix == "/me " || prefix == "/me'") ? user_name + utf8mesg.substr(3) : utf8mesg;
+
+ if (objectp)
+ {
+ if(objectp->isHUDAttachment())
+ {
+ if (isAgentAvatarValid())
+ {
+ ((LLViewerObject*)gAgentAvatarp)->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI));
+ }
+ }
+ else
+ {
+ objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI));
+ }
+ floater_label = llformat("%s(%.0f, %.0f, %.0f)",
+ user_name.c_str(),
+ objectp->getPositionRegion().mV[VX],
+ objectp->getPositionRegion().mV[VY],
+ objectp->getPositionRegion().mV[VZ]);
+ }
+ else
+ {
+ floater_label = user_name;
+ }
+
+ addOutputWindow(source_id);
+
+ // add to "All" floater
+ LLFloaterScriptDebugOutput* floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", LLUUID::null);
+ if (floaterp)
+ {
+ floaterp->addLine(message, user_name, color);
+ }
+
+ // add to specific script instance floater
+ floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", source_id);
+ if (floaterp)
+ {
+ floaterp->addLine(message, floater_label, color);
+ }
}
//
@@ -181,17 +181,17 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std:
LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLSD& object_id)
: LLFloater(LLSD(object_id)),
- mObjectID(object_id.asUUID())
+ mObjectID(object_id.asUUID())
{
- // enabled autocous blocks controling focus via LLFloaterReg::showInstance
- setAutoFocus(FALSE);
+ // enabled autocous blocks controling focus via LLFloaterReg::showInstance
+ setAutoFocus(FALSE);
}
BOOL LLFloaterScriptDebugOutput::postBuild()
{
- LLFloater::postBuild();
- mHistoryEditor = getChild<LLViewerTextEditor>("Chat History Editor");
- return TRUE;
+ LLFloater::postBuild();
+ mHistoryEditor = getChild<LLViewerTextEditor>("Chat History Editor");
+ return TRUE;
}
LLFloaterScriptDebugOutput::~LLFloaterScriptDebugOutput()
@@ -200,18 +200,18 @@ LLFloaterScriptDebugOutput::~LLFloaterScriptDebugOutput()
void LLFloaterScriptDebugOutput::addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color)
{
- if (mObjectID.isNull())
- {
- setCanTearOff(FALSE);
- setCanClose(FALSE);
- }
- else
- {
- setTitle(user_name);
- setShortTitle(user_name);
- }
-
- mHistoryEditor->appendText(utf8mesg, true, LLStyle::Params().color(color));
- mHistoryEditor->blockUndo();
+ if (mObjectID.isNull())
+ {
+ setCanTearOff(FALSE);
+ setCanClose(FALSE);
+ }
+ else
+ {
+ setTitle(user_name);
+ setShortTitle(user_name);
+ }
+
+ mHistoryEditor->appendText(utf8mesg, true, LLStyle::Params().color(color));
+ mHistoryEditor->blockUndo();
}
diff --git a/indra/newview/llfloaterscriptdebug.h b/indra/newview/llfloaterscriptdebug.h
index 8c08b234f3..9a5ccecb8c 100644
--- a/indra/newview/llfloaterscriptdebug.h
+++ b/indra/newview/llfloaterscriptdebug.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterscriptdebug.h
* @brief Shows error and warning output from scripts
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,36 +35,36 @@ class LLUUID;
class LLFloaterScriptDebug : public LLMultiFloater
{
public:
- LLFloaterScriptDebug(const LLSD& key);
- virtual ~LLFloaterScriptDebug();
- virtual BOOL postBuild();
- virtual void setVisible(BOOL visible);
+ LLFloaterScriptDebug(const LLSD& key);
+ virtual ~LLFloaterScriptDebug();
+ virtual BOOL postBuild();
+ virtual void setVisible(BOOL visible);
static void show(const LLUUID& object_id);
/*virtual*/ void closeFloater(bool app_quitting = false);
- static void addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id);
+ static void addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id);
protected:
- static LLFloater* addOutputWindow(const LLUUID& object_id);
+ static LLFloater* addOutputWindow(const LLUUID& object_id);
protected:
- static LLFloaterScriptDebug* sInstance;
+ static LLFloaterScriptDebug* sInstance;
};
class LLFloaterScriptDebugOutput : public LLFloater
{
public:
- LLFloaterScriptDebugOutput(const LLSD& object_id);
- ~LLFloaterScriptDebugOutput();
+ LLFloaterScriptDebugOutput(const LLSD& object_id);
+ ~LLFloaterScriptDebugOutput();
+
+ void addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color);
- void addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color);
+ virtual BOOL postBuild();
- virtual BOOL postBuild();
-
protected:
- LLTextEditor* mHistoryEditor;
+ LLTextEditor* mHistoryEditor;
- LLUUID mObjectID;
+ LLUUID mObjectID;
};
#endif // LL_LLFLOATERSCRIPTDEBUG_H
diff --git a/indra/newview/llfloaterscriptedprefs.cpp b/indra/newview/llfloaterscriptedprefs.cpp
index 2484a08626..89c5d3617c 100644
--- a/indra/newview/llfloaterscriptedprefs.cpp
+++ b/indra/newview/llfloaterscriptedprefs.cpp
@@ -33,33 +33,33 @@
LLFloaterScriptEdPrefs::LLFloaterScriptEdPrefs(const LLSD& key)
-: LLFloater(key)
-, mEditor(NULL)
+: LLFloater(key)
+, mEditor(NULL)
{
- mCommitCallbackRegistrar.add("ScriptPref.applyUIColor", boost::bind(&LLFloaterScriptEdPrefs::applyUIColor, this ,_1, _2));
- mCommitCallbackRegistrar.add("ScriptPref.getUIColor", boost::bind(&LLFloaterScriptEdPrefs::getUIColor, this ,_1, _2));
+ mCommitCallbackRegistrar.add("ScriptPref.applyUIColor", boost::bind(&LLFloaterScriptEdPrefs::applyUIColor, this ,_1, _2));
+ mCommitCallbackRegistrar.add("ScriptPref.getUIColor", boost::bind(&LLFloaterScriptEdPrefs::getUIColor, this ,_1, _2));
}
BOOL LLFloaterScriptEdPrefs::postBuild()
{
- mEditor = getChild<LLScriptEditor>("Script Preview");
- if (mEditor)
- {
- mEditor->initKeywords();
- mEditor->loadKeywords();
- }
- return TRUE;
+ mEditor = getChild<LLScriptEditor>("Script Preview");
+ if (mEditor)
+ {
+ mEditor->initKeywords();
+ mEditor->loadKeywords();
+ }
+ return TRUE;
}
void LLFloaterScriptEdPrefs::applyUIColor(LLUICtrl* ctrl, const LLSD& param)
{
- LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue()));
- mEditor->initKeywords();
- mEditor->loadKeywords();
+ LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue()));
+ mEditor->initKeywords();
+ mEditor->loadKeywords();
}
void LLFloaterScriptEdPrefs::getUIColor(LLUICtrl* ctrl, const LLSD& param)
{
- LLColorSwatchCtrl* color_swatch = dynamic_cast<LLColorSwatchCtrl*>(ctrl);
- color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString()));
+ LLColorSwatchCtrl* color_swatch = dynamic_cast<LLColorSwatchCtrl*>(ctrl);
+ color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString()));
}
diff --git a/indra/newview/llfloaterscriptedprefs.h b/indra/newview/llfloaterscriptedprefs.h
index 31df897aac..135c5bb6c7 100644
--- a/indra/newview/llfloaterscriptedprefs.h
+++ b/indra/newview/llfloaterscriptedprefs.h
@@ -36,16 +36,16 @@ class LLUICtrl;
class LLFloaterScriptEdPrefs : public LLFloater
{
public:
- LLFloaterScriptEdPrefs(const LLSD& key);
- BOOL postBuild();
-
+ LLFloaterScriptEdPrefs(const LLSD& key);
+ BOOL postBuild();
+
private:
- ~LLFloaterScriptEdPrefs() {};
-
- void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
- void getUIColor(LLUICtrl* ctrl, const LLSD& param);
-
- LLScriptEditor* mEditor;
+ ~LLFloaterScriptEdPrefs() {};
+
+ void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
+ void getUIColor(LLUICtrl* ctrl, const LLSD& param);
+
+ LLScriptEditor* mEditor;
};
#endif // LL_FLOATERSCRIPTEDPREFS_H
diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp
index 40fe11b309..8f3260ca3e 100644
--- a/indra/newview/llfloaterscriptlimits.cpp
+++ b/indra/newview/llfloaterscriptlimits.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterscriptlimits.cpp
* @author Gabriel Lee
* @brief Implementation of the region info and controls floater and panels.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -84,27 +84,27 @@ const S32 FAKE_AVAILABLE_MEMORY = 895577;
const S32 SIZE_OF_ONE_KB = 1024;
LLFloaterScriptLimits::LLFloaterScriptLimits(const LLSD& seed)
- : LLFloater(seed)
+ : LLFloater(seed)
{
}
BOOL LLFloaterScriptLimits::postBuild()
{
- mTab = getChild<LLTabContainer>("scriptlimits_panels");
-
- if(!mTab)
- {
- LL_WARNS() << "Error! couldn't get scriptlimits_panels, aborting Script Information setup" << LL_ENDL;
- return FALSE;
- }
-
- // contruct the panel
- LLPanelScriptLimitsRegionMemory* panel_memory = new LLPanelScriptLimitsRegionMemory;
- mInfoPanels.push_back(panel_memory);
- panel_memory->buildFromFile( "panel_script_limits_region_memory.xml");
- mTab->addTabPanel(panel_memory);
- mTab->selectTab(0);
- return TRUE;
+ mTab = getChild<LLTabContainer>("scriptlimits_panels");
+
+ if(!mTab)
+ {
+ LL_WARNS() << "Error! couldn't get scriptlimits_panels, aborting Script Information setup" << LL_ENDL;
+ return FALSE;
+ }
+
+ // contruct the panel
+ LLPanelScriptLimitsRegionMemory* panel_memory = new LLPanelScriptLimitsRegionMemory;
+ mInfoPanels.push_back(panel_memory);
+ panel_memory->buildFromFile( "panel_script_limits_region_memory.xml");
+ mTab->addTabPanel(panel_memory);
+ mTab->selectTab(0);
+ return TRUE;
}
LLFloaterScriptLimits::~LLFloaterScriptLimits()
@@ -114,11 +114,11 @@ LLFloaterScriptLimits::~LLFloaterScriptLimits()
// public
void LLFloaterScriptLimits::refresh()
{
- for(info_panels_t::iterator iter = mInfoPanels.begin();
- iter != mInfoPanels.end(); ++iter)
- {
- (*iter)->refresh();
- }
+ for(info_panels_t::iterator iter = mInfoPanels.begin();
+ iter != mInfoPanels.end(); ++iter)
+ {
+ (*iter)->refresh();
+ }
}
///----------------------------------------------------------------------------
@@ -126,7 +126,7 @@ void LLFloaterScriptLimits::refresh()
///----------------------------------------------------------------------------
LLPanelScriptLimitsInfo::LLPanelScriptLimitsInfo()
- : LLPanel()
+ : LLPanel()
{
}
@@ -134,11 +134,11 @@ LLPanelScriptLimitsInfo::LLPanelScriptLimitsInfo()
// virtual
BOOL LLPanelScriptLimitsInfo::postBuild()
{
- refresh();
- return TRUE;
+ refresh();
+ return TRUE;
}
-// virtual
+// virtual
void LLPanelScriptLimitsInfo::updateChild(LLUICtrl* child_ctr)
{
}
@@ -149,29 +149,29 @@ void LLPanelScriptLimitsInfo::updateChild(LLUICtrl* child_ctr)
LLPanelScriptLimitsRegionMemory::~LLPanelScriptLimitsRegionMemory()
{
- if(!mParcelId.isNull())
- {
- LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this);
- mParcelId.setNull();
- }
+ if(!mParcelId.isNull())
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this);
+ mParcelId.setNull();
+ }
};
BOOL LLPanelScriptLimitsRegionMemory::getLandScriptResources()
{
- if (!gAgent.getRegion()) return FALSE;
+ if (!gAgent.getRegion()) return FALSE;
- LLSD body;
- std::string url = gAgent.getRegion()->getCapability("LandResources");
- if (!url.empty())
- {
+ LLSD body;
+ std::string url = gAgent.getRegion()->getCapability("LandResources");
+ if (!url.empty())
+ {
LLCoros::instance().launch("LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro",
boost::bind(&LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro, this, url));
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
void LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro(std::string url)
@@ -196,9 +196,9 @@ void LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro(std::string url
return;
}
- // We could retrieve these sequentially inline from this coroutine. But
- // since the original code retrieved them in parallel I'll spawn two
- // coroutines to do the retrieval.
+ // We could retrieve these sequentially inline from this coroutine. But
+ // since the original code retrieved them in parallel I'll spawn two
+ // coroutines to do the retrieval.
// The summary service:
if (result.has("ScriptResourceSummary"))
@@ -215,7 +215,7 @@ void LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro(std::string url
boost::bind(&LLPanelScriptLimitsRegionMemory::getLandScriptDetailsCoro, this, urlResourceDetails));
}
-
+
}
void LLPanelScriptLimitsRegionMemory::getLandScriptSummaryCoro(std::string url)
@@ -317,42 +317,42 @@ void LLPanelScriptLimitsRegionMemory::getLandScriptDetailsCoro(std::string url)
void LLPanelScriptLimitsRegionMemory::processParcelInfo(const LLParcelData& parcel_data)
{
- if(!getLandScriptResources())
- {
- std::string msg_error = LLTrans::getString("ScriptLimitsRequestError");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_error));
- }
- else
- {
- std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
- }
+ if(!getLandScriptResources())
+ {
+ std::string msg_error = LLTrans::getString("ScriptLimitsRequestError");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_error));
+ }
+ else
+ {
+ std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
+ }
}
void LLPanelScriptLimitsRegionMemory::setParcelID(const LLUUID& parcel_id)
{
- if (!parcel_id.isNull())
- {
- if(!mParcelId.isNull())
- {
- LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this);
- mParcelId.setNull();
- }
- mParcelId = parcel_id;
- LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this);
- LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id);
- }
- else
- {
- std::string msg_error = LLTrans::getString("ScriptLimitsRequestError");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_error));
- }
+ if (!parcel_id.isNull())
+ {
+ if(!mParcelId.isNull())
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this);
+ mParcelId.setNull();
+ }
+ mParcelId = parcel_id;
+ LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this);
+ LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id);
+ }
+ else
+ {
+ std::string msg_error = LLTrans::getString("ScriptLimitsRequestError");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_error));
+ }
}
// virtual
void LLPanelScriptLimitsRegionMemory::setErrorStatus(S32 status, const std::string& reason)
{
- LL_WARNS() << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<LL_ENDL;
+ LL_WARNS() << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<LL_ENDL;
}
// callback from the name cache with an owner name to add to the list
@@ -365,577 +365,577 @@ void LLPanelScriptLimitsRegionMemory::onAvatarNameCache(
// callback from the name cache with an owner name to add to the list
void LLPanelScriptLimitsRegionMemory::onNameCache(
- const LLUUID& id,
- const std::string& full_name)
+ const LLUUID& id,
+ const std::string& full_name)
{
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
- if(!list)
- {
- return;
- }
-
- std::string name = LLCacheName::buildUsername(full_name);
-
- std::vector<LLSD>::iterator id_itor;
- for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor)
- {
- LLSD element = *id_itor;
- if(element["owner_id"].asUUID() == id)
- {
- LLScrollListItem* item = list->getItem(element["id"].asUUID());
-
- if(item)
- {
- item->getColumn(3)->setValue(LLSD(name));
- element["columns"][3]["value"] = name;
- }
- }
- }
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
+ if(!list)
+ {
+ return;
+ }
+
+ std::string name = LLCacheName::buildUsername(full_name);
+
+ std::vector<LLSD>::iterator id_itor;
+ for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor)
+ {
+ LLSD element = *id_itor;
+ if(element["owner_id"].asUUID() == id)
+ {
+ LLScrollListItem* item = list->getItem(element["id"].asUUID());
+
+ if(item)
+ {
+ item->getColumn(3)->setValue(LLSD(name));
+ element["columns"][3]["value"] = name;
+ }
+ }
+ }
}
void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
{
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
-
- if(!list)
- {
- LL_WARNS() << "Error getting the scripts_list control" << LL_ENDL;
- return;
- }
-
- S32 number_parcels = content["parcels"].size();
-
- LLStringUtil::format_map_t args_parcels;
- args_parcels["[PARCELS]"] = llformat ("%d", number_parcels);
- std::string msg_parcels = LLTrans::getString("ScriptLimitsParcelsOwned", args_parcels);
- getChild<LLUICtrl>("parcels_listed")->setValue(LLSD(msg_parcels));
-
- uuid_vec_t names_requested;
-
- // This makes the assumption that all objects will have the same set
- // of attributes, ie they will all have, or none will have locations
- // This is a pretty safe assumption as it's reliant on server version.
- bool has_locations = false;
- bool has_local_ids = false;
-
- for(S32 i = 0; i < number_parcels; i++)
- {
- std::string parcel_name = content["parcels"][i]["name"].asString();
- S32 number_objects = content["parcels"][i]["objects"].size();
-
- S32 local_id = 0;
- if(content["parcels"][i].has("local_id"))
- {
- // if any locations are found flag that we can use them and turn on the highlight button
- has_local_ids = true;
- local_id = content["parcels"][i]["local_id"].asInteger();
- }
-
- for(S32 j = 0; j < number_objects; j++)
- {
- S32 size = content["parcels"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
-
- S32 urls = content["parcels"][i]["objects"][j]["resources"]["urls"].asInteger();
-
- std::string name_buf = content["parcels"][i]["objects"][j]["name"].asString();
- LLUUID task_id = content["parcels"][i]["objects"][j]["id"].asUUID();
- LLUUID owner_id = content["parcels"][i]["objects"][j]["owner_id"].asUUID();
- // This field may not be sent by all server versions, but it's OK if
- // it uses the LLSD default of false
- bool is_group_owned = content["parcels"][i]["objects"][j]["is_group_owned"].asBoolean();
-
- F32 location_x = 0.0f;
- F32 location_y = 0.0f;
- F32 location_z = 0.0f;
-
- if(content["parcels"][i]["objects"][j].has("location"))
- {
- // if any locations are found flag that we can use them and turn on the highlight button
- LLVector3 vec = ll_vector3_from_sd(content["parcels"][i]["objects"][j]["location"]);
- has_locations = true;
- location_x = vec.mV[0];
- location_y = vec.mV[1];
- location_z = vec.mV[2];
- }
-
- std::string owner_buf;
-
- // in the future the server will give us owner names, so see if we're there yet:
- if(content["parcels"][i]["objects"][j].has("owner_name"))
- {
- owner_buf = content["parcels"][i]["objects"][j]["owner_name"].asString();
- }
- // ...and if not use the slightly more painful method of disovery:
- else
- {
- BOOL name_is_cached;
- if (is_group_owned)
- {
- name_is_cached = gCacheName->getGroupName(owner_id, owner_buf);
- }
- else
- {
- LLAvatarName av_name;
- name_is_cached = LLAvatarNameCache::get(owner_id, &av_name);
- owner_buf = av_name.getUserName();
- owner_buf = LLCacheName::buildUsername(owner_buf);
- }
- if(!name_is_cached)
- {
- if(std::find(names_requested.begin(), names_requested.end(), owner_id) == names_requested.end())
- {
- names_requested.push_back(owner_id);
- if (is_group_owned)
- {
- gCacheName->getGroup(owner_id,
- boost::bind(&LLPanelScriptLimitsRegionMemory::onNameCache,
- this, _1, _2));
- }
- else
- {
- LLAvatarNameCache::get(owner_id,
- boost::bind(&LLPanelScriptLimitsRegionMemory::onAvatarNameCache,
- this, _1, _2));
- }
- }
- }
- }
-
- LLScrollListItem::Params item_params;
- item_params.value = task_id;
-
- LLScrollListCell::Params cell_params;
- cell_params.font = LLFontGL::getFontSansSerif();
- // Start out right justifying numeric displays
- cell_params.font_halign = LLFontGL::RIGHT;
-
- cell_params.column = "size";
- cell_params.value = size;
- item_params.columns.add(cell_params);
-
- cell_params.column = "urls";
- cell_params.value = urls;
- item_params.columns.add(cell_params);
-
- cell_params.font_halign = LLFontGL::LEFT;
- // The rest of the columns are text to left justify them
- cell_params.column = "name";
- cell_params.value = name_buf;
- item_params.columns.add(cell_params);
-
- cell_params.column = "owner";
- cell_params.value = owner_buf;
- item_params.columns.add(cell_params);
-
- cell_params.column = "parcel";
- cell_params.value = parcel_name;
- item_params.columns.add(cell_params);
-
- cell_params.column = "location";
- cell_params.value = has_locations
- ? llformat("<%0.0f, %0.0f, %0.0f>", location_x, location_y, location_z)
- : "";
- item_params.columns.add(cell_params);
-
- list->addRow(item_params);
-
- LLSD element;
- element["owner_id"] = owner_id;
-
- element["id"] = task_id;
- element["local_id"] = local_id;
- mObjectListItems.push_back(element);
- }
- }
-
- if (has_locations)
- {
- LLButton* btn = getChild<LLButton>("highlight_btn");
- if(btn)
- {
- btn->setVisible(true);
- }
- }
-
- if (has_local_ids)
- {
- LLButton* btn = getChild<LLButton>("return_btn");
- if(btn)
- {
- btn->setVisible(true);
- }
- }
-
- // save the structure to make object return easier
- mContent = content;
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
+
+ if(!list)
+ {
+ LL_WARNS() << "Error getting the scripts_list control" << LL_ENDL;
+ return;
+ }
+
+ S32 number_parcels = content["parcels"].size();
+
+ LLStringUtil::format_map_t args_parcels;
+ args_parcels["[PARCELS]"] = llformat ("%d", number_parcels);
+ std::string msg_parcels = LLTrans::getString("ScriptLimitsParcelsOwned", args_parcels);
+ getChild<LLUICtrl>("parcels_listed")->setValue(LLSD(msg_parcels));
+
+ uuid_vec_t names_requested;
+
+ // This makes the assumption that all objects will have the same set
+ // of attributes, ie they will all have, or none will have locations
+ // This is a pretty safe assumption as it's reliant on server version.
+ bool has_locations = false;
+ bool has_local_ids = false;
+
+ for(S32 i = 0; i < number_parcels; i++)
+ {
+ std::string parcel_name = content["parcels"][i]["name"].asString();
+ S32 number_objects = content["parcels"][i]["objects"].size();
+
+ S32 local_id = 0;
+ if(content["parcels"][i].has("local_id"))
+ {
+ // if any locations are found flag that we can use them and turn on the highlight button
+ has_local_ids = true;
+ local_id = content["parcels"][i]["local_id"].asInteger();
+ }
+
+ for(S32 j = 0; j < number_objects; j++)
+ {
+ S32 size = content["parcels"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
+
+ S32 urls = content["parcels"][i]["objects"][j]["resources"]["urls"].asInteger();
+
+ std::string name_buf = content["parcels"][i]["objects"][j]["name"].asString();
+ LLUUID task_id = content["parcels"][i]["objects"][j]["id"].asUUID();
+ LLUUID owner_id = content["parcels"][i]["objects"][j]["owner_id"].asUUID();
+ // This field may not be sent by all server versions, but it's OK if
+ // it uses the LLSD default of false
+ bool is_group_owned = content["parcels"][i]["objects"][j]["is_group_owned"].asBoolean();
+
+ F32 location_x = 0.0f;
+ F32 location_y = 0.0f;
+ F32 location_z = 0.0f;
+
+ if(content["parcels"][i]["objects"][j].has("location"))
+ {
+ // if any locations are found flag that we can use them and turn on the highlight button
+ LLVector3 vec = ll_vector3_from_sd(content["parcels"][i]["objects"][j]["location"]);
+ has_locations = true;
+ location_x = vec.mV[0];
+ location_y = vec.mV[1];
+ location_z = vec.mV[2];
+ }
+
+ std::string owner_buf;
+
+ // in the future the server will give us owner names, so see if we're there yet:
+ if(content["parcels"][i]["objects"][j].has("owner_name"))
+ {
+ owner_buf = content["parcels"][i]["objects"][j]["owner_name"].asString();
+ }
+ // ...and if not use the slightly more painful method of disovery:
+ else
+ {
+ BOOL name_is_cached;
+ if (is_group_owned)
+ {
+ name_is_cached = gCacheName->getGroupName(owner_id, owner_buf);
+ }
+ else
+ {
+ LLAvatarName av_name;
+ name_is_cached = LLAvatarNameCache::get(owner_id, &av_name);
+ owner_buf = av_name.getUserName();
+ owner_buf = LLCacheName::buildUsername(owner_buf);
+ }
+ if(!name_is_cached)
+ {
+ if(std::find(names_requested.begin(), names_requested.end(), owner_id) == names_requested.end())
+ {
+ names_requested.push_back(owner_id);
+ if (is_group_owned)
+ {
+ gCacheName->getGroup(owner_id,
+ boost::bind(&LLPanelScriptLimitsRegionMemory::onNameCache,
+ this, _1, _2));
+ }
+ else
+ {
+ LLAvatarNameCache::get(owner_id,
+ boost::bind(&LLPanelScriptLimitsRegionMemory::onAvatarNameCache,
+ this, _1, _2));
+ }
+ }
+ }
+ }
+
+ LLScrollListItem::Params item_params;
+ item_params.value = task_id;
+
+ LLScrollListCell::Params cell_params;
+ cell_params.font = LLFontGL::getFontSansSerif();
+ // Start out right justifying numeric displays
+ cell_params.font_halign = LLFontGL::RIGHT;
+
+ cell_params.column = "size";
+ cell_params.value = size;
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "urls";
+ cell_params.value = urls;
+ item_params.columns.add(cell_params);
+
+ cell_params.font_halign = LLFontGL::LEFT;
+ // The rest of the columns are text to left justify them
+ cell_params.column = "name";
+ cell_params.value = name_buf;
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "owner";
+ cell_params.value = owner_buf;
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "parcel";
+ cell_params.value = parcel_name;
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "location";
+ cell_params.value = has_locations
+ ? llformat("<%0.0f, %0.0f, %0.0f>", location_x, location_y, location_z)
+ : "";
+ item_params.columns.add(cell_params);
+
+ list->addRow(item_params);
+
+ LLSD element;
+ element["owner_id"] = owner_id;
+
+ element["id"] = task_id;
+ element["local_id"] = local_id;
+ mObjectListItems.push_back(element);
+ }
+ }
+
+ if (has_locations)
+ {
+ LLButton* btn = getChild<LLButton>("highlight_btn");
+ if(btn)
+ {
+ btn->setVisible(true);
+ }
+ }
+
+ if (has_local_ids)
+ {
+ LLButton* btn = getChild<LLButton>("return_btn");
+ if(btn)
+ {
+ btn->setVisible(true);
+ }
+ }
+
+ // save the structure to make object return easier
+ mContent = content;
}
void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content)
{
- if(content["summary"]["used"][0]["type"].asString() == std::string("memory"))
- {
- mParcelMemoryUsed = content["summary"]["used"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mParcelMemoryMax = content["summary"]["available"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mGotParcelMemoryUsed = true;
- }
- else if(content["summary"]["used"][1]["type"].asString() == std::string("memory"))
- {
- mParcelMemoryUsed = content["summary"]["used"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mParcelMemoryMax = content["summary"]["available"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mGotParcelMemoryUsed = true;
- }
- else
- {
- LL_WARNS() << "summary doesn't contain memory info" << LL_ENDL;
- return;
- }
-
- if(content["summary"]["used"][0]["type"].asString() == std::string("urls"))
- {
- mParcelURLsUsed = content["summary"]["used"][0]["amount"].asInteger();
- mParcelURLsMax = content["summary"]["available"][0]["amount"].asInteger();
- mGotParcelURLsUsed = true;
- }
- else if(content["summary"]["used"][1]["type"].asString() == std::string("urls"))
- {
- mParcelURLsUsed = content["summary"]["used"][1]["amount"].asInteger();
- mParcelURLsMax = content["summary"]["available"][1]["amount"].asInteger();
- mGotParcelURLsUsed = true;
- }
- else
- {
- LL_WARNS() << "summary doesn't contain urls info" << LL_ENDL;
- return;
- }
-
- if((mParcelMemoryUsed >= 0) && (mParcelMemoryMax >= 0))
- {
- LLStringUtil::format_map_t args_parcel_memory;
- args_parcel_memory["[COUNT]"] = llformat ("%d", mParcelMemoryUsed);
- std::string translate_message = "ScriptLimitsMemoryUsedSimple";
-
- if (0 < mParcelMemoryMax)
- {
- S32 parcel_memory_available = mParcelMemoryMax - mParcelMemoryUsed;
-
- args_parcel_memory["[MAX]"] = llformat ("%d", mParcelMemoryMax);
- args_parcel_memory["[AVAILABLE]"] = llformat ("%d", parcel_memory_available);
- translate_message = "ScriptLimitsMemoryUsed";
- }
-
- std::string msg_parcel_memory = LLTrans::getString(translate_message, args_parcel_memory);
- getChild<LLUICtrl>("memory_used")->setValue(LLSD(msg_parcel_memory));
- }
-
- if((mParcelURLsUsed >= 0) && (mParcelURLsMax >= 0))
- {
- S32 parcel_urls_available = mParcelURLsMax - mParcelURLsUsed;
-
- LLStringUtil::format_map_t args_parcel_urls;
- args_parcel_urls["[COUNT]"] = llformat ("%d", mParcelURLsUsed);
- args_parcel_urls["[MAX]"] = llformat ("%d", mParcelURLsMax);
- args_parcel_urls["[AVAILABLE]"] = llformat ("%d", parcel_urls_available);
- std::string msg_parcel_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_parcel_urls);
- getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_parcel_urls));
- }
+ if(content["summary"]["used"][0]["type"].asString() == std::string("memory"))
+ {
+ mParcelMemoryUsed = content["summary"]["used"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mParcelMemoryMax = content["summary"]["available"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mGotParcelMemoryUsed = true;
+ }
+ else if(content["summary"]["used"][1]["type"].asString() == std::string("memory"))
+ {
+ mParcelMemoryUsed = content["summary"]["used"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mParcelMemoryMax = content["summary"]["available"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mGotParcelMemoryUsed = true;
+ }
+ else
+ {
+ LL_WARNS() << "summary doesn't contain memory info" << LL_ENDL;
+ return;
+ }
+
+ if(content["summary"]["used"][0]["type"].asString() == std::string("urls"))
+ {
+ mParcelURLsUsed = content["summary"]["used"][0]["amount"].asInteger();
+ mParcelURLsMax = content["summary"]["available"][0]["amount"].asInteger();
+ mGotParcelURLsUsed = true;
+ }
+ else if(content["summary"]["used"][1]["type"].asString() == std::string("urls"))
+ {
+ mParcelURLsUsed = content["summary"]["used"][1]["amount"].asInteger();
+ mParcelURLsMax = content["summary"]["available"][1]["amount"].asInteger();
+ mGotParcelURLsUsed = true;
+ }
+ else
+ {
+ LL_WARNS() << "summary doesn't contain urls info" << LL_ENDL;
+ return;
+ }
+
+ if((mParcelMemoryUsed >= 0) && (mParcelMemoryMax >= 0))
+ {
+ LLStringUtil::format_map_t args_parcel_memory;
+ args_parcel_memory["[COUNT]"] = llformat ("%d", mParcelMemoryUsed);
+ std::string translate_message = "ScriptLimitsMemoryUsedSimple";
+
+ if (0 < mParcelMemoryMax)
+ {
+ S32 parcel_memory_available = mParcelMemoryMax - mParcelMemoryUsed;
+
+ args_parcel_memory["[MAX]"] = llformat ("%d", mParcelMemoryMax);
+ args_parcel_memory["[AVAILABLE]"] = llformat ("%d", parcel_memory_available);
+ translate_message = "ScriptLimitsMemoryUsed";
+ }
+
+ std::string msg_parcel_memory = LLTrans::getString(translate_message, args_parcel_memory);
+ getChild<LLUICtrl>("memory_used")->setValue(LLSD(msg_parcel_memory));
+ }
+
+ if((mParcelURLsUsed >= 0) && (mParcelURLsMax >= 0))
+ {
+ S32 parcel_urls_available = mParcelURLsMax - mParcelURLsUsed;
+
+ LLStringUtil::format_map_t args_parcel_urls;
+ args_parcel_urls["[COUNT]"] = llformat ("%d", mParcelURLsUsed);
+ args_parcel_urls["[MAX]"] = llformat ("%d", mParcelURLsMax);
+ args_parcel_urls["[AVAILABLE]"] = llformat ("%d", parcel_urls_available);
+ std::string msg_parcel_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_parcel_urls);
+ getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_parcel_urls));
+ }
}
BOOL LLPanelScriptLimitsRegionMemory::postBuild()
{
- childSetAction("refresh_list_btn", onClickRefresh, this);
- childSetAction("highlight_btn", onClickHighlight, this);
- childSetAction("return_btn", onClickReturn, this);
-
- std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
-
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
- if(!list)
- {
- return FALSE;
- }
- list->setCommitCallback(boost::bind(&LLPanelScriptLimitsRegionMemory::checkButtonsEnabled, this));
- checkButtonsEnabled();
-
- //set all columns to resizable mode even if some columns will be empty
- for(S32 column = 0; column < list->getNumColumns(); column++)
- {
- LLScrollListColumn* columnp = list->getColumn(column);
- columnp->mHeader->setHasResizableElement(TRUE);
- }
-
- return StartRequestChain();
+ childSetAction("refresh_list_btn", onClickRefresh, this);
+ childSetAction("highlight_btn", onClickHighlight, this);
+ childSetAction("return_btn", onClickReturn, this);
+
+ std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
+
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
+ if(!list)
+ {
+ return FALSE;
+ }
+ list->setCommitCallback(boost::bind(&LLPanelScriptLimitsRegionMemory::checkButtonsEnabled, this));
+ checkButtonsEnabled();
+
+ //set all columns to resizable mode even if some columns will be empty
+ for(S32 column = 0; column < list->getNumColumns(); column++)
+ {
+ LLScrollListColumn* columnp = list->getColumn(column);
+ columnp->mHeader->setHasResizableElement(TRUE);
+ }
+
+ return StartRequestChain();
}
BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain()
{
- LLUUID region_id;
-
- LLFloaterLand* instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
- if(!instance)
- {
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
- //might have to do parent post build here
- //if not logic below could use early outs
- return FALSE;
- }
- LLParcel* parcel = instance->getCurrentSelectedParcel();
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
-
- if ((region) && (parcel))
- {
- LLUUID current_region_id = gAgent.getRegion()->getRegionID();
- LLVector3 parcel_center = parcel->getCenterpoint();
-
- region_id = region->getRegionID();
-
- if(region_id != current_region_id)
- {
- std::string msg_wrong_region = LLTrans::getString("ScriptLimitsRequestWrongRegion");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_wrong_region));
- return FALSE;
- }
-
- LLVector3d pos_global = region->getCenterGlobal();
-
- LLSD body;
- std::string url = region->getCapability("RemoteParcelRequest");
- if (!url.empty())
- {
- LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url,
+ LLUUID region_id;
+
+ LLFloaterLand* instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
+ if(!instance)
+ {
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
+ //might have to do parent post build here
+ //if not logic below could use early outs
+ return FALSE;
+ }
+ LLParcel* parcel = instance->getCurrentSelectedParcel();
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+
+ if ((region) && (parcel))
+ {
+ LLUUID current_region_id = gAgent.getRegion()->getRegionID();
+ LLVector3 parcel_center = parcel->getCenterpoint();
+
+ region_id = region->getRegionID();
+
+ if(region_id != current_region_id)
+ {
+ std::string msg_wrong_region = LLTrans::getString("ScriptLimitsRequestWrongRegion");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_wrong_region));
+ return FALSE;
+ }
+
+ LLVector3d pos_global = region->getCenterGlobal();
+
+ LLSD body;
+ std::string url = region->getCapability("RemoteParcelRequest");
+ if (!url.empty())
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url,
region_id, parcel_center, pos_global, getObserverHandle());
- }
- else
- {
- LL_WARNS() << "Can't get parcel info for script information request" << region_id
- << ". Region: " << region->getName()
- << " does not support RemoteParcelRequest" << LL_ENDL;
-
- std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
- }
- }
- else
- {
- std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestNoParcelSelected");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
- }
-
- return LLPanelScriptLimitsInfo::postBuild();
+ }
+ else
+ {
+ LL_WARNS() << "Can't get parcel info for script information request" << region_id
+ << ". Region: " << region->getName()
+ << " does not support RemoteParcelRequest" << LL_ENDL;
+
+ std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
+ }
+ }
+ else
+ {
+ std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestNoParcelSelected");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
+ }
+
+ return LLPanelScriptLimitsInfo::postBuild();
}
void LLPanelScriptLimitsRegionMemory::clearList()
{
- LLCtrlListInterface *list = childGetListInterface("scripts_list");
-
- if (list)
- {
- list->operateOnAll(LLCtrlListInterface::OP_DELETE);
- }
-
- mGotParcelMemoryUsed = false;
- mGotParcelMemoryMax = false;
- mGotParcelURLsUsed = false;
- mGotParcelURLsMax = false;
-
- LLStringUtil::format_map_t args_parcel_memory;
- std::string msg_empty_string("");
- getChild<LLUICtrl>("memory_used")->setValue(LLSD(msg_empty_string));
- getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_empty_string));
- getChild<LLUICtrl>("parcels_listed")->setValue(LLSD(msg_empty_string));
-
- mObjectListItems.clear();
- checkButtonsEnabled();
+ LLCtrlListInterface *list = childGetListInterface("scripts_list");
+
+ if (list)
+ {
+ list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+ }
+
+ mGotParcelMemoryUsed = false;
+ mGotParcelMemoryMax = false;
+ mGotParcelURLsUsed = false;
+ mGotParcelURLsMax = false;
+
+ LLStringUtil::format_map_t args_parcel_memory;
+ std::string msg_empty_string("");
+ getChild<LLUICtrl>("memory_used")->setValue(LLSD(msg_empty_string));
+ getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_empty_string));
+ getChild<LLUICtrl>("parcels_listed")->setValue(LLSD(msg_empty_string));
+
+ mObjectListItems.clear();
+ checkButtonsEnabled();
}
void LLPanelScriptLimitsRegionMemory::checkButtonsEnabled()
{
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("scripts_list");
- getChild<LLButton>("highlight_btn")->setEnabled(list->getNumSelected() > 0);
- getChild<LLButton>("return_btn")->setEnabled(list->getNumSelected() > 0);
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("scripts_list");
+ getChild<LLButton>("highlight_btn")->setEnabled(list->getNumSelected() > 0);
+ getChild<LLButton>("return_btn")->setEnabled(list->getNumSelected() > 0);
}
// static
void LLPanelScriptLimitsRegionMemory::onClickRefresh(void* userdata)
{
- LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
- if(instance)
- {
- LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
- if(tab)
- {
- LLPanelScriptLimitsRegionMemory* panel_memory = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel");
- if(panel_memory)
- {
- //To stop people from hammering the refesh button and accidentally dosing themselves - enough requests can crash the viewer!
- //turn the button off, then turn it on when we get a response
- LLButton* btn = panel_memory->getChild<LLButton>("refresh_list_btn");
- if(btn)
- {
- btn->setEnabled(false);
- }
- panel_memory->clearList();
-
- panel_memory->StartRequestChain();
- }
- }
- return;
- }
- else
- {
- LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << LL_ENDL;
- return;
- }
+ LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
+ if(instance)
+ {
+ LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
+ if(tab)
+ {
+ LLPanelScriptLimitsRegionMemory* panel_memory = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel");
+ if(panel_memory)
+ {
+ //To stop people from hammering the refesh button and accidentally dosing themselves - enough requests can crash the viewer!
+ //turn the button off, then turn it on when we get a response
+ LLButton* btn = panel_memory->getChild<LLButton>("refresh_list_btn");
+ if(btn)
+ {
+ btn->setEnabled(false);
+ }
+ panel_memory->clearList();
+
+ panel_memory->StartRequestChain();
+ }
+ }
+ return;
+ }
+ else
+ {
+ LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << LL_ENDL;
+ return;
+ }
}
void LLPanelScriptLimitsRegionMemory::showBeacon()
-{
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("scripts_list");
- if (!list) return;
+{
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("scripts_list");
+ if (!list) return;
+
+ LLScrollListItem* first_selected = list->getFirstSelected();
+ if (!first_selected) return;
- LLScrollListItem* first_selected = list->getFirstSelected();
- if (!first_selected) return;
+ std::string name = first_selected->getColumn(2)->getValue().asString();
+ std::string pos_string = first_selected->getColumn(5)->getValue().asString();
- std::string name = first_selected->getColumn(2)->getValue().asString();
- std::string pos_string = first_selected->getColumn(5)->getValue().asString();
-
- F32 x, y, z;
- S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z);
- if (matched != 3) return;
+ F32 x, y, z;
+ S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z);
+ if (matched != 3) return;
- LLVector3 pos_agent(x, y, z);
- LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
+ LLVector3 pos_agent(x, y, z);
+ LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
- std::string tooltip("");
- LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM);
+ std::string tooltip("");
+ LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM);
}
// static
void LLPanelScriptLimitsRegionMemory::onClickHighlight(void* userdata)
{
- LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
- if(instance)
- {
- LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
- if(tab)
- {
- LLPanelScriptLimitsRegionMemory* panel = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel");
- if(panel)
- {
- panel->showBeacon();
- }
- }
- return;
- }
- else
- {
- LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << LL_ENDL;
- return;
- }
+ LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
+ if(instance)
+ {
+ LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
+ if(tab)
+ {
+ LLPanelScriptLimitsRegionMemory* panel = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel");
+ if(panel)
+ {
+ panel->showBeacon();
+ }
+ }
+ return;
+ }
+ else
+ {
+ LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << LL_ENDL;
+ return;
+ }
}
void LLPanelScriptLimitsRegionMemory::returnObjectsFromParcel(S32 local_id)
{
- LLMessageSystem *msg = gMessageSystem;
-
- LLViewerRegion* region = gAgent.getRegion();
- if (!region) return;
-
- LLCtrlListInterface *list = childGetListInterface("scripts_list");
- if (!list || list->getItemCount() == 0) return;
-
- std::vector<LLSD>::iterator id_itor;
-
- bool start_message = true;
-
- for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor)
- {
- LLSD element = *id_itor;
- if (!list->isSelected(element["id"].asUUID()))
- {
- // Selected only
- continue;
- }
-
- if(element["local_id"].asInteger() != local_id)
- {
- // Not the parcel we are looking for
- continue;
- }
-
- if (start_message)
- {
- msg->newMessageFast(_PREHASH_ParcelReturnObjects);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, element["local_id"].asInteger());
- msg->addU32Fast(_PREHASH_ReturnType, RT_LIST);
- start_message = false;
- }
-
- msg->nextBlockFast(_PREHASH_TaskIDs);
- msg->addUUIDFast(_PREHASH_TaskID, element["id"].asUUID());
-
- if (msg->isSendFullFast(_PREHASH_TaskIDs))
- {
- msg->sendReliable(region->getHost());
- start_message = true;
- }
- }
-
- if (!start_message)
- {
- msg->sendReliable(region->getHost());
- }
+ LLMessageSystem *msg = gMessageSystem;
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region) return;
+
+ LLCtrlListInterface *list = childGetListInterface("scripts_list");
+ if (!list || list->getItemCount() == 0) return;
+
+ std::vector<LLSD>::iterator id_itor;
+
+ bool start_message = true;
+
+ for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor)
+ {
+ LLSD element = *id_itor;
+ if (!list->isSelected(element["id"].asUUID()))
+ {
+ // Selected only
+ continue;
+ }
+
+ if(element["local_id"].asInteger() != local_id)
+ {
+ // Not the parcel we are looking for
+ continue;
+ }
+
+ if (start_message)
+ {
+ msg->newMessageFast(_PREHASH_ParcelReturnObjects);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, element["local_id"].asInteger());
+ msg->addU32Fast(_PREHASH_ReturnType, RT_LIST);
+ start_message = false;
+ }
+
+ msg->nextBlockFast(_PREHASH_TaskIDs);
+ msg->addUUIDFast(_PREHASH_TaskID, element["id"].asUUID());
+
+ if (msg->isSendFullFast(_PREHASH_TaskIDs))
+ {
+ msg->sendReliable(region->getHost());
+ start_message = true;
+ }
+ }
+
+ if (!start_message)
+ {
+ msg->sendReliable(region->getHost());
+ }
}
void LLPanelScriptLimitsRegionMemory::returnObjects()
{
- if(!mContent.has("parcels"))
- {
- return;
- }
-
- S32 number_parcels = mContent["parcels"].size();
-
- // a message per parcel containing all objects to be returned from that parcel
- for(S32 i = 0; i < number_parcels; i++)
- {
- S32 local_id = 0;
- if(mContent["parcels"][i].has("local_id"))
- {
- local_id = mContent["parcels"][i]["local_id"].asInteger();
- returnObjectsFromParcel(local_id);
- }
- }
-
- onClickRefresh(NULL);
+ if(!mContent.has("parcels"))
+ {
+ return;
+ }
+
+ S32 number_parcels = mContent["parcels"].size();
+
+ // a message per parcel containing all objects to be returned from that parcel
+ for(S32 i = 0; i < number_parcels; i++)
+ {
+ S32 local_id = 0;
+ if(mContent["parcels"][i].has("local_id"))
+ {
+ local_id = mContent["parcels"][i]["local_id"].asInteger();
+ returnObjectsFromParcel(local_id);
+ }
+ }
+
+ onClickRefresh(NULL);
}
// static
void LLPanelScriptLimitsRegionMemory::onClickReturn(void* userdata)
{
- LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
- if(instance)
- {
- LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
- if(tab)
- {
- LLPanelScriptLimitsRegionMemory* panel = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel");
- if(panel)
- {
- panel->returnObjects();
- }
- }
- return;
- }
- else
- {
- LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << LL_ENDL;
- return;
- }
+ LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
+ if(instance)
+ {
+ LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
+ if(tab)
+ {
+ LLPanelScriptLimitsRegionMemory* panel = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel");
+ if(panel)
+ {
+ panel->returnObjects();
+ }
+ }
+ return;
+ }
+ else
+ {
+ LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << LL_ENDL;
+ return;
+ }
}
diff --git a/indra/newview/llfloaterscriptlimits.h b/indra/newview/llfloaterscriptlimits.h
index d2192f9d01..8c5bdb99cd 100644
--- a/indra/newview/llfloaterscriptlimits.h
+++ b/indra/newview/llfloaterscriptlimits.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterscriptlimits.h
* @author Gabriel Lee
* @brief Declaration of the region info and controls floater and panels.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,24 +44,24 @@ class LLPanelScriptLimitsRegionMemory;
class LLFloaterScriptLimits : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- // from LLPanel
- virtual void refresh();
+ // from LLPanel
+ virtual void refresh();
private:
- LLFloaterScriptLimits(const LLSD& seed);
- ~LLFloaterScriptLimits();
+ LLFloaterScriptLimits(const LLSD& seed);
+ ~LLFloaterScriptLimits();
protected:
- LLTabContainer* mTab;
- typedef std::vector<LLPanelScriptLimitsInfo*> info_panels_t;
- info_panels_t mInfoPanels;
+ LLTabContainer* mTab;
+ typedef std::vector<LLPanelScriptLimitsInfo*> info_panels_t;
+ info_panels_t mInfoPanels;
};
@@ -69,17 +69,17 @@ protected:
class LLPanelScriptLimitsInfo : public LLPanel
{
public:
- LLPanelScriptLimitsInfo();
-
- virtual BOOL postBuild();
- virtual void updateChild(LLUICtrl* child_ctrl);
-
+ LLPanelScriptLimitsInfo();
+
+ virtual BOOL postBuild();
+ virtual void updateChild(LLUICtrl* child_ctrl);
+
protected:
- void initCtrl(const std::string& name);
-
- typedef std::vector<std::string> strings_t;
-
- LLHost mHost;
+ void initCtrl(const std::string& name);
+
+ typedef std::vector<std::string> strings_t;
+
+ LLHost mHost;
};
/////////////////////////////////////////////////////////////////////////////
@@ -88,53 +88,53 @@ protected:
class LLPanelScriptLimitsRegionMemory : public LLPanelScriptLimitsInfo, LLRemoteParcelInfoObserver
{
-
+
public:
- LLPanelScriptLimitsRegionMemory()
- : LLPanelScriptLimitsInfo(), LLRemoteParcelInfoObserver(),
+ LLPanelScriptLimitsRegionMemory()
+ : LLPanelScriptLimitsInfo(), LLRemoteParcelInfoObserver(),
- mParcelId(LLUUID()),
- mGotParcelMemoryUsed(false),
- mGotParcelMemoryMax(false),
- mParcelMemoryMax(0),
- mParcelMemoryUsed(0) {};
+ mParcelId(LLUUID()),
+ mGotParcelMemoryUsed(false),
+ mGotParcelMemoryMax(false),
+ mParcelMemoryMax(0),
+ mParcelMemoryUsed(0) {};
- ~LLPanelScriptLimitsRegionMemory();
-
- // LLPanel
- virtual BOOL postBuild();
+ ~LLPanelScriptLimitsRegionMemory();
- void setRegionDetails(LLSD content);
- void setRegionSummary(LLSD content);
+ // LLPanel
+ virtual BOOL postBuild();
- BOOL StartRequestChain();
+ void setRegionDetails(LLSD content);
+ void setRegionSummary(LLSD content);
- BOOL getLandScriptResources();
- void clearList();
- void showBeacon();
- void returnObjectsFromParcel(S32 local_id);
- void returnObjects();
- void checkButtonsEnabled();
+ BOOL StartRequestChain();
+
+ BOOL getLandScriptResources();
+ void clearList();
+ void showBeacon();
+ void returnObjectsFromParcel(S32 local_id);
+ void returnObjects();
+ void checkButtonsEnabled();
private:
- void onAvatarNameCache(const LLUUID& id,
- const LLAvatarName& av_name);
- void onNameCache(const LLUUID& id,
- const std::string& name);
+ void onAvatarNameCache(const LLUUID& id,
+ const LLAvatarName& av_name);
+ void onNameCache(const LLUUID& id,
+ const std::string& name);
- LLSD mContent;
- LLUUID mParcelId;
- bool mGotParcelMemoryUsed;
- bool mGotParcelMemoryMax;
- S32 mParcelMemoryMax;
- S32 mParcelMemoryUsed;
+ LLSD mContent;
+ LLUUID mParcelId;
+ bool mGotParcelMemoryUsed;
+ bool mGotParcelMemoryMax;
+ S32 mParcelMemoryMax;
+ S32 mParcelMemoryUsed;
- bool mGotParcelURLsUsed;
- bool mGotParcelURLsMax;
- S32 mParcelURLsMax;
- S32 mParcelURLsUsed;
+ bool mGotParcelURLsUsed;
+ bool mGotParcelURLsMax;
+ S32 mParcelURLsMax;
+ S32 mParcelURLsUsed;
- std::vector<LLSD> mObjectListItems;
+ std::vector<LLSD> mObjectListItems;
void getLandScriptResourcesCoro(std::string url);
void getLandScriptSummaryCoro(std::string url);
@@ -146,10 +146,10 @@ protected:
/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
/*virtual*/ void setParcelID(const LLUUID& parcel_id);
/*virtual*/ void setErrorStatus(S32 status, const std::string& reason);
-
- static void onClickRefresh(void* userdata);
- static void onClickHighlight(void* userdata);
- static void onClickReturn(void* userdata);
+
+ static void onClickRefresh(void* userdata);
+ static void onClickHighlight(void* userdata);
+ static void onClickReturn(void* userdata);
};
#endif
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp
index 37ae80fa8f..4eda962e8b 100644
--- a/indra/newview/llfloatersearch.cpp
+++ b/indra/newview/llfloatersearch.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatersearch.cpp
* @author Martin Reddy
* @brief Search floater - uses an embedded web browser control
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,41 +44,41 @@
class LLSearchHandler : public LLCommandHandler
{
public:
- // requires trusted browser to trigger
- LLSearchHandler() : LLCommandHandler("search", UNTRUSTED_CLICK_ONLY) { }
- bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableSearch"))
- {
- LLNotificationsUtil::add("NoSearch", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
-
- const size_t parts = tokens.size();
-
- // get the (optional) category for the search
- std::string collection;
- if (parts > 0)
- {
+ // requires trusted browser to trigger
+ LLSearchHandler() : LLCommandHandler("search", UNTRUSTED_CLICK_ONLY) { }
+ bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableSearch"))
+ {
+ LLNotificationsUtil::add("NoSearch", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ const size_t parts = tokens.size();
+
+ // get the (optional) category for the search
+ std::string collection;
+ if (parts > 0)
+ {
collection = tokens[0].asString();
- }
-
- // get the (optional) search string
- std::string search_text;
- if (parts > 1)
- {
- search_text = tokens[1].asString();
- }
-
- // create the LLSD arguments for the search floater
- LLFloaterSearch::Params p;
- p.search.collection = collection;
- p.search.query = LLURI::unescape(search_text);
-
- // open the search floater and perform the requested search
- LLFloaterReg::showInstance("search", p);
- return true;
- }
+ }
+
+ // get the (optional) search string
+ std::string search_text;
+ if (parts > 1)
+ {
+ search_text = tokens[1].asString();
+ }
+
+ // create the LLSD arguments for the search floater
+ LLFloaterSearch::Params p;
+ p.search.collection = collection;
+ p.search.query = LLURI::unescape(search_text);
+
+ // open the search floater and perform the requested search
+ LLFloaterReg::showInstance("search", p);
+ return true;
+ }
};
LLSearchHandler gSearchHandler;
@@ -89,11 +89,11 @@ LLFloaterSearch::SearchQuery::SearchQuery()
{}
LLFloaterSearch::LLFloaterSearch(const Params& key) :
- LLFloaterWebContent(key),
- mSearchGodLevel(0)
+ LLFloaterWebContent(key),
+ mSearchGodLevel(0)
{
- // declare a map that transforms a category name into
- // the URL suffix that is used to search that category
+ // declare a map that transforms a category name into
+ // the URL suffix that is used to search that category
mSearchType.insert("standard");
mSearchType.insert("land");
@@ -108,67 +108,67 @@ LLFloaterSearch::LLFloaterSearch(const Params& key) :
BOOL LLFloaterSearch::postBuild()
{
- LLFloaterWebContent::postBuild();
- mWebBrowser->addObserver(this);
+ LLFloaterWebContent::postBuild();
+ mWebBrowser->addObserver(this);
- return TRUE;
+ return TRUE;
}
void LLFloaterSearch::onOpen(const LLSD& key)
{
- Params p(key);
- p.trusted_content = true;
- p.allow_address_entry = false;
+ Params p(key);
+ p.trusted_content = true;
+ p.allow_address_entry = false;
- LLFloaterWebContent::onOpen(p);
- mWebBrowser->setFocus(TRUE);
- search(p.search);
+ LLFloaterWebContent::onOpen(p);
+ mWebBrowser->setFocus(TRUE);
+ search(p.search);
}
void LLFloaterSearch::onClose(bool app_quitting)
{
- LLFloaterWebContent::onClose(app_quitting);
- // tear down the web view so we don't show the previous search
- // result when the floater is opened next time
- destroy();
+ LLFloaterWebContent::onClose(app_quitting);
+ // tear down the web view so we don't show the previous search
+ // result when the floater is opened next time
+ destroy();
}
void LLFloaterSearch::godLevelChanged(U8 godlevel)
{
- // search results can change based upon god level - if the user
- // changes god level, then give them a warning (we don't refresh
- // the search as this might undo any page navigation or
- // AJAX-driven changes since the last search).
-
- //FIXME: set status bar text
-
- //getChildView("refresh_search")->setVisible( (godlevel != mSearchGodLevel));
+ // search results can change based upon god level - if the user
+ // changes god level, then give them a warning (we don't refresh
+ // the search as this might undo any page navigation or
+ // AJAX-driven changes since the last search).
+
+ //FIXME: set status bar text
+
+ //getChildView("refresh_search")->setVisible( (godlevel != mSearchGodLevel));
}
void LLFloaterSearch::search(const SearchQuery &p)
{
- if (! mWebBrowser || !p.validateBlock())
- {
- return;
- }
-
- // reset the god level warning as we're sending the latest state
- getChildView("refresh_search")->setVisible(FALSE);
- mSearchGodLevel = gAgent.getGodLevel();
-
- // work out the subdir to use based on the requested category
- LLSD subs;
- if (mSearchType.find(p.category) != mSearchType.end())
- {
- subs["TYPE"] = p.category;
- }
- else
- {
- subs["TYPE"] = "standard";
- }
-
- // add the search query string
- subs["QUERY"] = LLURI::escape(p.query);
+ if (! mWebBrowser || !p.validateBlock())
+ {
+ return;
+ }
+
+ // reset the god level warning as we're sending the latest state
+ getChildView("refresh_search")->setVisible(FALSE);
+ mSearchGodLevel = gAgent.getGodLevel();
+
+ // work out the subdir to use based on the requested category
+ LLSD subs;
+ if (mSearchType.find(p.category) != mSearchType.end())
+ {
+ subs["TYPE"] = p.category;
+ }
+ else
+ {
+ subs["TYPE"] = "standard";
+ }
+
+ // add the search query string
+ subs["QUERY"] = LLURI::escape(p.query);
subs["COLLECTION"] = "";
if (subs["TYPE"] == "standard")
@@ -188,30 +188,30 @@ void LLFloaterSearch::search(const SearchQuery &p)
}
}
- // add the user's preferred maturity (can be changed via prefs)
- std::string maturity;
- if (gAgent.prefersAdult())
- {
- maturity = "gma"; // PG,Mature,Adult
- }
- else if (gAgent.prefersMature())
- {
- maturity = "gm"; // PG,Mature
- }
- else
- {
- maturity = "g"; // PG
- }
- subs["MATURITY"] = maturity;
-
- // add the user's god status
- subs["GODLIKE"] = gAgent.isGodlike() ? "1" : "0";
-
- // get the search URL and expand all of the substitutions
- // (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
- std::string url = gSavedSettings.getString("SearchURL");
- url = LLWeb::expandURLSubstitutions(url, subs);
-
- // and load the URL in the web view
- mWebBrowser->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
+ // add the user's preferred maturity (can be changed via prefs)
+ std::string maturity;
+ if (gAgent.prefersAdult())
+ {
+ maturity = "gma"; // PG,Mature,Adult
+ }
+ else if (gAgent.prefersMature())
+ {
+ maturity = "gm"; // PG,Mature
+ }
+ else
+ {
+ maturity = "g"; // PG
+ }
+ subs["MATURITY"] = maturity;
+
+ // add the user's god status
+ subs["GODLIKE"] = gAgent.isGodlike() ? "1" : "0";
+
+ // get the search URL and expand all of the substitutions
+ // (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
+ std::string url = gSavedSettings.getString("SearchURL");
+ url = LLWeb::expandURLSubstitutions(url, subs);
+
+ // and load the URL in the web view
+ mWebBrowser->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
}
diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h
index cc77ce696f..5350c34c56 100644
--- a/indra/newview/llfloatersearch.h
+++ b/indra/newview/llfloatersearch.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatersearch.h
* @author Martin Reddy
* @brief Search floater - uses an embedded web browser control
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,52 +42,52 @@ class LLMediaCtrl;
/// web page. The browser control is explicitly marked as "trusted"
/// so that the user can click on teleport links in search results.
///
-class LLFloaterSearch :
- public LLFloaterWebContent
+class LLFloaterSearch :
+ public LLFloaterWebContent
{
public:
- struct SearchQuery : public LLInitParam::Block<SearchQuery>
- {
- Optional<std::string> category;
+ struct SearchQuery : public LLInitParam::Block<SearchQuery>
+ {
+ Optional<std::string> category;
Optional<std::string> collection;
- Optional<std::string> query;
+ Optional<std::string> query;
- SearchQuery();
- };
+ SearchQuery();
+ };
- struct _Params : public LLInitParam::Block<_Params, LLFloaterWebContent::Params>
- {
- Optional<SearchQuery> search;
- };
+ struct _Params : public LLInitParam::Block<_Params, LLFloaterWebContent::Params>
+ {
+ Optional<SearchQuery> search;
+ };
- typedef LLSDParamAdapter<_Params> Params;
+ typedef LLSDParamAdapter<_Params> Params;
- LLFloaterSearch(const Params& key);
+ LLFloaterSearch(const Params& key);
- /// show the search floater with a new search
- /// see search() for details on the key parameter.
- /*virtual*/ void onOpen(const LLSD& key);
+ /// show the search floater with a new search
+ /// see search() for details on the key parameter.
+ /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void onClose(bool app_quitting);
- /// perform a search with the specific search term.
- /// The key should be a map that can contain the following keys:
- /// - "id": specifies the text phrase to search for
- /// - "category": one of "all" (default), "people", "places",
- /// "events", "groups", "wiki", "destinations", "classifieds"
- void search(const SearchQuery &query);
+ /// perform a search with the specific search term.
+ /// The key should be a map that can contain the following keys:
+ /// - "id": specifies the text phrase to search for
+ /// - "category": one of "all" (default), "people", "places",
+ /// "events", "groups", "wiki", "destinations", "classifieds"
+ void search(const SearchQuery &query);
- /// changing godmode can affect the search results that are
- /// returned by the search website - use this method to tell the
- /// search floater that the user has changed god level.
- void godLevelChanged(U8 godlevel);
+ /// changing godmode can affect the search results that are
+ /// returned by the search website - use this method to tell the
+ /// search floater that the user has changed god level.
+ void godLevelChanged(U8 godlevel);
private:
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
std::set<std::string> mSearchType;
std::set<std::string> mCollectionType;
- U8 mSearchGodLevel;
+ U8 mSearchGodLevel;
};
#endif // LL_LLFLOATERSEARCH_H
diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp
index b139e5daf5..65bd3d3717 100644
--- a/indra/newview/llfloatersellland.cpp
+++ b/indra/newview/llfloatersellland.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloatersellland.cpp
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,77 +47,77 @@ class LLAvatarName;
// defined in llfloaterland.cpp
void send_parcel_select_objects(S32 parcel_local_id, U32 return_type,
- uuid_list_t* return_ids = NULL);
+ uuid_list_t* return_ids = NULL);
enum Badge { BADGE_OK, BADGE_NOTE, BADGE_WARN, BADGE_ERROR };
class LLFloaterSellLandUI
-: public LLFloater
+: public LLFloater
{
public:
- LLFloaterSellLandUI(const LLSD& key);
- virtual ~LLFloaterSellLandUI();
- /*virtual*/ void onClose(bool app_quitting);
-
+ LLFloaterSellLandUI(const LLSD& key);
+ virtual ~LLFloaterSellLandUI();
+ /*virtual*/ void onClose(bool app_quitting);
+
private:
- class SelectionObserver : public LLParcelObserver
- {
- public:
- SelectionObserver(LLFloaterSellLandUI* floater) : mFloater(floater) {}
- virtual void changed();
- private:
- LLFloaterSellLandUI* mFloater;
- };
-
+ class SelectionObserver : public LLParcelObserver
+ {
+ public:
+ SelectionObserver(LLFloaterSellLandUI* floater) : mFloater(floater) {}
+ virtual void changed();
+ private:
+ LLFloaterSellLandUI* mFloater;
+ };
+
private:
- LLViewerRegion* mRegion;
- LLParcelSelectionHandle mParcelSelection;
- bool mParcelIsForSale;
- bool mSellToBuyer;
- bool mChoseSellTo;
- S32 mParcelPrice;
- S32 mParcelActualArea;
- LLUUID mParcelSnapshot;
- LLUUID mAuthorizedBuyer;
- bool mParcelSoldWithObjects;
- SelectionObserver mParcelSelectionObserver;
- boost::signals2::connection mAvatarNameCacheConnection;
-
- void updateParcelInfo();
- void refreshUI();
- void setBadge(const char* id, Badge badge);
-
- static void onChangeValue(LLUICtrl *ctrl, void *userdata);
- void doSelectAgent();
- static void doCancel(void *userdata);
- static void doSellLand(void *userdata);
- bool onConfirmSale(const LLSD& notification, const LLSD& response);
- static void doShowObjects(void *userdata);
-
- void callbackAvatarPick(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
-
- void onBuyerNameCache(const LLAvatarName& av_name);
+ LLViewerRegion* mRegion;
+ LLParcelSelectionHandle mParcelSelection;
+ bool mParcelIsForSale;
+ bool mSellToBuyer;
+ bool mChoseSellTo;
+ S32 mParcelPrice;
+ S32 mParcelActualArea;
+ LLUUID mParcelSnapshot;
+ LLUUID mAuthorizedBuyer;
+ bool mParcelSoldWithObjects;
+ SelectionObserver mParcelSelectionObserver;
+ boost::signals2::connection mAvatarNameCacheConnection;
+
+ void updateParcelInfo();
+ void refreshUI();
+ void setBadge(const char* id, Badge badge);
+
+ static void onChangeValue(LLUICtrl *ctrl, void *userdata);
+ void doSelectAgent();
+ static void doCancel(void *userdata);
+ static void doSellLand(void *userdata);
+ bool onConfirmSale(const LLSD& notification, const LLSD& response);
+ static void doShowObjects(void *userdata);
+
+ void callbackAvatarPick(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
+
+ void onBuyerNameCache(const LLAvatarName& av_name);
public:
- virtual BOOL postBuild();
-
- bool setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel);
- static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response);
+ virtual BOOL postBuild();
+
+ bool setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel);
+ static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response);
};
// static
void LLFloaterSellLand::sellLand(
- LLViewerRegion* region, LLParcelSelectionHandle parcel)
+ LLViewerRegion* region, LLParcelSelectionHandle parcel)
{
- LLFloaterSellLandUI* ui = LLFloaterReg::showTypedInstance<LLFloaterSellLandUI>("sell_land");
- ui->setParcel(region, parcel);
+ LLFloaterSellLandUI* ui = LLFloaterReg::showTypedInstance<LLFloaterSellLandUI>("sell_land");
+ ui->setParcel(region, parcel);
}
// static
LLFloater* LLFloaterSellLand::buildFloater(const LLSD& key)
{
- LLFloaterSellLandUI* floater = new LLFloaterSellLandUI(key);
- return floater;
+ LLFloaterSellLandUI* floater = new LLFloaterSellLandUI(key);
+ return floater;
}
#if LL_WINDOWS
@@ -126,326 +126,326 @@ LLFloater* LLFloaterSellLand::buildFloater(const LLSD& key)
// already valid, so this call does the correct thing. Disable the
// warning so that we can compile without generating a warning.
#pragma warning(disable : 4355)
-#endif
+#endif
LLFloaterSellLandUI::LLFloaterSellLandUI(const LLSD& key)
-: LLFloater(key),
- mParcelSelectionObserver(this),
- mRegion(0),
- mAvatarNameCacheConnection()
+: LLFloater(key),
+ mParcelSelectionObserver(this),
+ mRegion(0),
+ mAvatarNameCacheConnection()
{
- LLViewerParcelMgr::getInstance()->addObserver(&mParcelSelectionObserver);
+ LLViewerParcelMgr::getInstance()->addObserver(&mParcelSelectionObserver);
}
LLFloaterSellLandUI::~LLFloaterSellLandUI()
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- LLViewerParcelMgr::getInstance()->removeObserver(&mParcelSelectionObserver);
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ LLViewerParcelMgr::getInstance()->removeObserver(&mParcelSelectionObserver);
}
// Because we are single_instance, we are not destroyed on close.
void LLFloaterSellLandUI::onClose(bool app_quitting)
{
- // Must release parcel selection to allow land to deselect, see EXT-803
- mParcelSelection = NULL;
+ // Must release parcel selection to allow land to deselect, see EXT-803
+ mParcelSelection = NULL;
}
void LLFloaterSellLandUI::SelectionObserver::changed()
{
- if (LLViewerParcelMgr::getInstance()->selectionEmpty())
- {
- mFloater->closeFloater();
- }
- else if (mFloater->getVisible()) // only update selection if sell land ui in use
- {
- mFloater->setParcel(LLViewerParcelMgr::getInstance()->getSelectionRegion(),
- LLViewerParcelMgr::getInstance()->getParcelSelection());
- }
+ if (LLViewerParcelMgr::getInstance()->selectionEmpty())
+ {
+ mFloater->closeFloater();
+ }
+ else if (mFloater->getVisible()) // only update selection if sell land ui in use
+ {
+ mFloater->setParcel(LLViewerParcelMgr::getInstance()->getSelectionRegion(),
+ LLViewerParcelMgr::getInstance()->getParcelSelection());
+ }
}
BOOL LLFloaterSellLandUI::postBuild()
{
- childSetCommitCallback("sell_to", onChangeValue, this);
- childSetCommitCallback("price", onChangeValue, this);
- getChild<LLLineEditor>("price")->setPrevalidate(LLTextValidate::validateNonNegativeS32);
- childSetCommitCallback("sell_objects", onChangeValue, this);
- childSetAction("sell_to_select_agent", boost::bind( &LLFloaterSellLandUI::doSelectAgent, this));
- childSetAction("cancel_btn", doCancel, this);
- childSetAction("sell_btn", doSellLand, this);
- childSetAction("show_objects", doShowObjects, this);
- center();
- getChild<LLUICtrl>("profile_scroll")->setTabStop(true);
- return TRUE;
+ childSetCommitCallback("sell_to", onChangeValue, this);
+ childSetCommitCallback("price", onChangeValue, this);
+ getChild<LLLineEditor>("price")->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ childSetCommitCallback("sell_objects", onChangeValue, this);
+ childSetAction("sell_to_select_agent", boost::bind( &LLFloaterSellLandUI::doSelectAgent, this));
+ childSetAction("cancel_btn", doCancel, this);
+ childSetAction("sell_btn", doSellLand, this);
+ childSetAction("show_objects", doShowObjects, this);
+ center();
+ getChild<LLUICtrl>("profile_scroll")->setTabStop(true);
+ return TRUE;
}
bool LLFloaterSellLandUI::setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel)
{
- if (!parcel->getParcel())
- {
- return false;
- }
+ if (!parcel->getParcel())
+ {
+ return false;
+ }
- mRegion = region;
- mParcelSelection = parcel;
- mChoseSellTo = false;
+ mRegion = region;
+ mParcelSelection = parcel;
+ mChoseSellTo = false;
- updateParcelInfo();
- refreshUI();
+ updateParcelInfo();
+ refreshUI();
- return true;
+ return true;
}
void LLFloaterSellLandUI::updateParcelInfo()
{
- LLParcel* parcelp = mParcelSelection->getParcel();
- if (!parcelp) return;
-
- mParcelActualArea = parcelp->getArea();
- mParcelIsForSale = parcelp->getForSale();
- if (mParcelIsForSale)
- {
- mChoseSellTo = true;
- }
- mParcelPrice = mParcelIsForSale ? parcelp->getSalePrice() : 0;
- mParcelSoldWithObjects = parcelp->getSellWithObjects();
- if (mParcelIsForSale)
- {
- getChild<LLUICtrl>("price")->setValue(mParcelPrice);
- if (mParcelSoldWithObjects)
- {
- getChild<LLUICtrl>("sell_objects")->setValue("yes");
- }
- else
- {
- getChild<LLUICtrl>("sell_objects")->setValue("no");
- }
- }
- else
- {
- getChild<LLUICtrl>("price")->setValue("");
- getChild<LLUICtrl>("sell_objects")->setValue("none");
- }
-
- mParcelSnapshot = parcelp->getSnapshotID();
-
- mAuthorizedBuyer = parcelp->getAuthorizedBuyerID();
- mSellToBuyer = mAuthorizedBuyer.notNull();
-
- if(mSellToBuyer)
- {
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(mAuthorizedBuyer, boost::bind(&LLFloaterSellLandUI::onBuyerNameCache, this, _2));
- }
+ LLParcel* parcelp = mParcelSelection->getParcel();
+ if (!parcelp) return;
+
+ mParcelActualArea = parcelp->getArea();
+ mParcelIsForSale = parcelp->getForSale();
+ if (mParcelIsForSale)
+ {
+ mChoseSellTo = true;
+ }
+ mParcelPrice = mParcelIsForSale ? parcelp->getSalePrice() : 0;
+ mParcelSoldWithObjects = parcelp->getSellWithObjects();
+ if (mParcelIsForSale)
+ {
+ getChild<LLUICtrl>("price")->setValue(mParcelPrice);
+ if (mParcelSoldWithObjects)
+ {
+ getChild<LLUICtrl>("sell_objects")->setValue("yes");
+ }
+ else
+ {
+ getChild<LLUICtrl>("sell_objects")->setValue("no");
+ }
+ }
+ else
+ {
+ getChild<LLUICtrl>("price")->setValue("");
+ getChild<LLUICtrl>("sell_objects")->setValue("none");
+ }
+
+ mParcelSnapshot = parcelp->getSnapshotID();
+
+ mAuthorizedBuyer = parcelp->getAuthorizedBuyerID();
+ mSellToBuyer = mAuthorizedBuyer.notNull();
+
+ if(mSellToBuyer)
+ {
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(mAuthorizedBuyer, boost::bind(&LLFloaterSellLandUI::onBuyerNameCache, this, _2));
+ }
}
void LLFloaterSellLandUI::onBuyerNameCache(const LLAvatarName& av_name)
{
- mAvatarNameCacheConnection.disconnect();
+ mAvatarNameCacheConnection.disconnect();
- getChild<LLUICtrl>("sell_to_agent")->setValue(av_name.getCompleteName());
- getChild<LLUICtrl>("sell_to_agent")->setToolTip(av_name.getUserName());
+ getChild<LLUICtrl>("sell_to_agent")->setValue(av_name.getCompleteName());
+ getChild<LLUICtrl>("sell_to_agent")->setToolTip(av_name.getUserName());
}
void LLFloaterSellLandUI::setBadge(const char* id, Badge badge)
{
- static std::string badgeOK("badge_ok.j2c");
- static std::string badgeNote("badge_note.j2c");
- static std::string badgeWarn("badge_warn.j2c");
-
- std::string badgeName;
- switch (badge)
- {
- default:
- case BADGE_OK: badgeName = badgeOK; break;
- case BADGE_NOTE: badgeName = badgeNote; break;
- case BADGE_WARN: badgeName = badgeWarn; break;
- case BADGE_ERROR: badgeName = badgeWarn; break;
- }
-
- getChild<LLUICtrl>(id)->setValue(badgeName);
+ static std::string badgeOK("badge_ok.j2c");
+ static std::string badgeNote("badge_note.j2c");
+ static std::string badgeWarn("badge_warn.j2c");
+
+ std::string badgeName;
+ switch (badge)
+ {
+ default:
+ case BADGE_OK: badgeName = badgeOK; break;
+ case BADGE_NOTE: badgeName = badgeNote; break;
+ case BADGE_WARN: badgeName = badgeWarn; break;
+ case BADGE_ERROR: badgeName = badgeWarn; break;
+ }
+
+ getChild<LLUICtrl>(id)->setValue(badgeName);
}
void LLFloaterSellLandUI::refreshUI()
{
- LLParcel* parcelp = mParcelSelection->getParcel();
- if (!parcelp) return;
-
- LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image");
- snapshot->setImageAssetID(mParcelSnapshot);
-
- getChild<LLUICtrl>("info_parcel")->setValue(parcelp->getName());
- getChild<LLUICtrl>("info_size")->setTextArg("[AREA]", llformat("%d", mParcelActualArea));
-
- std::string price_str = getChild<LLUICtrl>("price")->getValue().asString();
- bool valid_price = false;
- valid_price = (price_str != "") && LLTextValidate::validateNonNegativeS32(utf8str_to_wstring(price_str));
-
- if (valid_price && mParcelActualArea > 0)
- {
- F32 per_meter_price = 0;
- per_meter_price = F32(mParcelPrice) / F32(mParcelActualArea);
- getChild<LLUICtrl>("price_per_m")->setTextArg("[PER_METER]", llformat("%0.2f", per_meter_price));
- getChildView("price_per_m")->setVisible(TRUE);
-
- setBadge("step_price", BADGE_OK);
- }
- else
- {
- getChildView("price_per_m")->setVisible(FALSE);
-
- if ("" == price_str)
- {
- setBadge("step_price", BADGE_NOTE);
- }
- else
- {
- setBadge("step_price", BADGE_ERROR);
- }
- }
-
- if (mSellToBuyer)
- {
- getChild<LLUICtrl>("sell_to")->setValue("user");
- getChildView("sell_to_agent")->setVisible(TRUE);
- getChildView("sell_to_select_agent")->setVisible(TRUE);
- }
- else
- {
- if (mChoseSellTo)
- {
- getChild<LLUICtrl>("sell_to")->setValue("anyone");
- }
- else
- {
- getChild<LLUICtrl>("sell_to")->setValue("select");
- }
- getChildView("sell_to_agent")->setVisible(FALSE);
- getChildView("sell_to_select_agent")->setVisible(FALSE);
- }
-
- // Must select Sell To: Anybody, or User (with a specified username)
- std::string sell_to = getChild<LLUICtrl>("sell_to")->getValue().asString();
- bool valid_sell_to = "select" != sell_to &&
- ("user" != sell_to || mAuthorizedBuyer.notNull());
-
- if (!valid_sell_to)
- {
- setBadge("step_sell_to", BADGE_NOTE);
- }
- else
- {
- setBadge("step_sell_to", BADGE_OK);
- }
-
- bool valid_sell_objects = ("none" != getChild<LLUICtrl>("sell_objects")->getValue().asString());
-
- if (!valid_sell_objects)
- {
- setBadge("step_sell_objects", BADGE_NOTE);
- }
- else
- {
- setBadge("step_sell_objects", BADGE_OK);
- }
-
- if (valid_sell_to && valid_price && valid_sell_objects)
- {
- getChildView("sell_btn")->setEnabled(TRUE);
- }
- else
- {
- getChildView("sell_btn")->setEnabled(FALSE);
- }
+ LLParcel* parcelp = mParcelSelection->getParcel();
+ if (!parcelp) return;
+
+ LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image");
+ snapshot->setImageAssetID(mParcelSnapshot);
+
+ getChild<LLUICtrl>("info_parcel")->setValue(parcelp->getName());
+ getChild<LLUICtrl>("info_size")->setTextArg("[AREA]", llformat("%d", mParcelActualArea));
+
+ std::string price_str = getChild<LLUICtrl>("price")->getValue().asString();
+ bool valid_price = false;
+ valid_price = (price_str != "") && LLTextValidate::validateNonNegativeS32(utf8str_to_wstring(price_str));
+
+ if (valid_price && mParcelActualArea > 0)
+ {
+ F32 per_meter_price = 0;
+ per_meter_price = F32(mParcelPrice) / F32(mParcelActualArea);
+ getChild<LLUICtrl>("price_per_m")->setTextArg("[PER_METER]", llformat("%0.2f", per_meter_price));
+ getChildView("price_per_m")->setVisible(TRUE);
+
+ setBadge("step_price", BADGE_OK);
+ }
+ else
+ {
+ getChildView("price_per_m")->setVisible(FALSE);
+
+ if ("" == price_str)
+ {
+ setBadge("step_price", BADGE_NOTE);
+ }
+ else
+ {
+ setBadge("step_price", BADGE_ERROR);
+ }
+ }
+
+ if (mSellToBuyer)
+ {
+ getChild<LLUICtrl>("sell_to")->setValue("user");
+ getChildView("sell_to_agent")->setVisible(TRUE);
+ getChildView("sell_to_select_agent")->setVisible(TRUE);
+ }
+ else
+ {
+ if (mChoseSellTo)
+ {
+ getChild<LLUICtrl>("sell_to")->setValue("anyone");
+ }
+ else
+ {
+ getChild<LLUICtrl>("sell_to")->setValue("select");
+ }
+ getChildView("sell_to_agent")->setVisible(FALSE);
+ getChildView("sell_to_select_agent")->setVisible(FALSE);
+ }
+
+ // Must select Sell To: Anybody, or User (with a specified username)
+ std::string sell_to = getChild<LLUICtrl>("sell_to")->getValue().asString();
+ bool valid_sell_to = "select" != sell_to &&
+ ("user" != sell_to || mAuthorizedBuyer.notNull());
+
+ if (!valid_sell_to)
+ {
+ setBadge("step_sell_to", BADGE_NOTE);
+ }
+ else
+ {
+ setBadge("step_sell_to", BADGE_OK);
+ }
+
+ bool valid_sell_objects = ("none" != getChild<LLUICtrl>("sell_objects")->getValue().asString());
+
+ if (!valid_sell_objects)
+ {
+ setBadge("step_sell_objects", BADGE_NOTE);
+ }
+ else
+ {
+ setBadge("step_sell_objects", BADGE_OK);
+ }
+
+ if (valid_sell_to && valid_price && valid_sell_objects)
+ {
+ getChildView("sell_btn")->setEnabled(TRUE);
+ }
+ else
+ {
+ getChildView("sell_btn")->setEnabled(FALSE);
+ }
}
// static
void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata)
{
- LLFloaterSellLandUI *self = (LLFloaterSellLandUI *)userdata;
-
- std::string sell_to = self->getChild<LLUICtrl>("sell_to")->getValue().asString();
-
- if (sell_to == "user")
- {
- self->mChoseSellTo = true;
- self->mSellToBuyer = true;
- if (self->mAuthorizedBuyer.isNull())
- {
- self->doSelectAgent();
- }
- }
- else if (sell_to == "anyone")
- {
- self->mChoseSellTo = true;
- self->mSellToBuyer = false;
- }
-
- self->mParcelPrice = self->getChild<LLUICtrl>("price")->getValue();
-
- if ("yes" == self->getChild<LLUICtrl>("sell_objects")->getValue().asString())
- {
- self->mParcelSoldWithObjects = true;
- }
- else
- {
- self->mParcelSoldWithObjects = false;
- }
-
- self->refreshUI();
+ LLFloaterSellLandUI *self = (LLFloaterSellLandUI *)userdata;
+
+ std::string sell_to = self->getChild<LLUICtrl>("sell_to")->getValue().asString();
+
+ if (sell_to == "user")
+ {
+ self->mChoseSellTo = true;
+ self->mSellToBuyer = true;
+ if (self->mAuthorizedBuyer.isNull())
+ {
+ self->doSelectAgent();
+ }
+ }
+ else if (sell_to == "anyone")
+ {
+ self->mChoseSellTo = true;
+ self->mSellToBuyer = false;
+ }
+
+ self->mParcelPrice = self->getChild<LLUICtrl>("price")->getValue();
+
+ if ("yes" == self->getChild<LLUICtrl>("sell_objects")->getValue().asString())
+ {
+ self->mParcelSoldWithObjects = true;
+ }
+ else
+ {
+ self->mParcelSoldWithObjects = false;
+ }
+
+ self->refreshUI();
}
void LLFloaterSellLandUI::doSelectAgent()
{
LLView * button = findChild<LLView>("sell_to_select_agent");
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE, FALSE, this->getName(), button);
- // grandparent is a floater, in order to set up dependency
- if (picker)
- {
- addDependentFloater(picker);
- }
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE, FALSE, this->getName(), button);
+ // grandparent is a floater, in order to set up dependency
+ if (picker)
+ {
+ addDependentFloater(picker);
+ }
}
void LLFloaterSellLandUI::callbackAvatarPick(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
-{
- LLParcel* parcel = mParcelSelection->getParcel();
+{
+ LLParcel* parcel = mParcelSelection->getParcel();
+
+ if (names.empty() || ids.empty()) return;
- if (names.empty() || ids.empty()) return;
-
- LLUUID id = ids[0];
- parcel->setAuthorizedBuyerID(id);
+ LLUUID id = ids[0];
+ parcel->setAuthorizedBuyerID(id);
- mAuthorizedBuyer = ids[0];
+ mAuthorizedBuyer = ids[0];
- getChild<LLUICtrl>("sell_to_agent")->setValue(names[0].getCompleteName());
+ getChild<LLUICtrl>("sell_to_agent")->setValue(names[0].getCompleteName());
- refreshUI();
+ refreshUI();
}
// static
void LLFloaterSellLandUI::doCancel(void *userdata)
{
- LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata;
- self->closeFloater();
+ LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata;
+ self->closeFloater();
}
// static
void LLFloaterSellLandUI::doShowObjects(void *userdata)
{
- LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata;
- LLParcel* parcel = self->mParcelSelection->getParcel();
- if (!parcel) return;
+ LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata;
+ LLParcel* parcel = self->mParcelSelection->getParcel();
+ if (!parcel) return;
- send_parcel_select_objects(parcel->getLocalID(), RT_SELL);
+ send_parcel_select_objects(parcel->getLocalID(), RT_SELL);
- // we shouldn't pass callback functor since it is registered in LLFunctorRegistration
- LLNotificationsUtil::add("TransferObjectsHighlighted",
- LLSD(), LLSD());
+ // we shouldn't pass callback functor since it is registered in LLFunctorRegistration
+ LLNotificationsUtil::add("TransferObjectsHighlighted",
+ LLSD(), LLSD());
}
static LLNotificationFunctorRegistration tr("TransferObjectsHighlighted", &LLFloaterSellLandUI::callbackHighlightTransferable);
@@ -453,110 +453,110 @@ static LLNotificationFunctorRegistration tr("TransferObjectsHighlighted", &LLFlo
// static
bool LLFloaterSellLandUI::callbackHighlightTransferable(const LLSD& notification, const LLSD& data)
{
- LLSelectMgr::getInstance()->unhighlightAll();
- return false;
+ LLSelectMgr::getInstance()->unhighlightAll();
+ return false;
}
// static
void LLFloaterSellLandUI::doSellLand(void *userdata)
{
- LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata;
-
- LLParcel* parcel = self->mParcelSelection->getParcel();
-
- // Do a confirmation
- S32 sale_price = self->getChild<LLUICtrl>("price")->getValue();
- S32 area = parcel->getArea();
- std::string authorizedBuyerName = LLTrans::getString("Anyone");
- bool sell_to_anyone = true;
- if ("user" == self->getChild<LLUICtrl>("sell_to")->getValue().asString())
- {
- authorizedBuyerName = self->getChild<LLUICtrl>("sell_to_agent")->getValue().asString();
- sell_to_anyone = false;
- }
-
- // must sell to someone if indicating sale to anyone
- if (!parcel->getForSale()
- && (sale_price == 0)
- && sell_to_anyone)
- {
- LLNotificationsUtil::add("SalePriceRestriction");
- return;
- }
-
- LLSD args;
- args["LAND_SIZE"] = llformat("%d",area);
- args["SALE_PRICE"] = llformat("%d",sale_price);
- args["NAME"] = authorizedBuyerName;
-
- LLNotification::Params params("ConfirmLandSaleChange");
- params.substitutions(args)
- .functor.function(boost::bind(&LLFloaterSellLandUI::onConfirmSale, self, _1, _2));
-
- if (sell_to_anyone)
- {
- params.name("ConfirmLandSaleToAnyoneChange");
- }
-
- if (parcel->getForSale())
- {
- // parcel already for sale, so ignore this question
- LLNotifications::instance().forceResponse(params, -1);
- }
- else
- {
- // ask away
- LLNotifications::instance().add(params);
- }
+ LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata;
+
+ LLParcel* parcel = self->mParcelSelection->getParcel();
+
+ // Do a confirmation
+ S32 sale_price = self->getChild<LLUICtrl>("price")->getValue();
+ S32 area = parcel->getArea();
+ std::string authorizedBuyerName = LLTrans::getString("Anyone");
+ bool sell_to_anyone = true;
+ if ("user" == self->getChild<LLUICtrl>("sell_to")->getValue().asString())
+ {
+ authorizedBuyerName = self->getChild<LLUICtrl>("sell_to_agent")->getValue().asString();
+ sell_to_anyone = false;
+ }
+
+ // must sell to someone if indicating sale to anyone
+ if (!parcel->getForSale()
+ && (sale_price == 0)
+ && sell_to_anyone)
+ {
+ LLNotificationsUtil::add("SalePriceRestriction");
+ return;
+ }
+
+ LLSD args;
+ args["LAND_SIZE"] = llformat("%d",area);
+ args["SALE_PRICE"] = llformat("%d",sale_price);
+ args["NAME"] = authorizedBuyerName;
+
+ LLNotification::Params params("ConfirmLandSaleChange");
+ params.substitutions(args)
+ .functor.function(boost::bind(&LLFloaterSellLandUI::onConfirmSale, self, _1, _2));
+
+ if (sell_to_anyone)
+ {
+ params.name("ConfirmLandSaleToAnyoneChange");
+ }
+
+ if (parcel->getForSale())
+ {
+ // parcel already for sale, so ignore this question
+ LLNotifications::instance().forceResponse(params, -1);
+ }
+ else
+ {
+ // ask away
+ LLNotifications::instance().add(params);
+ }
}
bool LLFloaterSellLandUI::onConfirmSale(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0)
- {
- return false;
- }
- S32 sale_price = getChild<LLUICtrl>("price")->getValue();
-
- // Valid extracted data
- if (sale_price < 0)
- {
- // TomY TODO: Throw an error
- return false;
- }
-
- LLParcel* parcel = mParcelSelection->getParcel();
- if (!parcel) return false;
-
- // can_agent_modify_parcel deprecated by GROUPS
-// if (!can_agent_modify_parcel(parcel))
-// {
-// close();
-// return;
-// }
-
- parcel->setParcelFlag(PF_FOR_SALE, TRUE);
- parcel->setSalePrice(sale_price);
- bool sell_with_objects = false;
- if ("yes" == getChild<LLUICtrl>("sell_objects")->getValue().asString())
- {
- sell_with_objects = true;
- }
- parcel->setSellWithObjects(sell_with_objects);
- if ("user" == getChild<LLUICtrl>("sell_to")->getValue().asString())
- {
- parcel->setAuthorizedBuyerID(mAuthorizedBuyer);
- }
- else
- {
- parcel->setAuthorizedBuyerID(LLUUID::null);
- }
-
- // Send update to server
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
-
- closeFloater();
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0)
+ {
+ return false;
+ }
+ S32 sale_price = getChild<LLUICtrl>("price")->getValue();
+
+ // Valid extracted data
+ if (sale_price < 0)
+ {
+ // TomY TODO: Throw an error
+ return false;
+ }
+
+ LLParcel* parcel = mParcelSelection->getParcel();
+ if (!parcel) return false;
+
+ // can_agent_modify_parcel deprecated by GROUPS
+// if (!can_agent_modify_parcel(parcel))
+// {
+// close();
+// return;
+// }
+
+ parcel->setParcelFlag(PF_FOR_SALE, TRUE);
+ parcel->setSalePrice(sale_price);
+ bool sell_with_objects = false;
+ if ("yes" == getChild<LLUICtrl>("sell_objects")->getValue().asString())
+ {
+ sell_with_objects = true;
+ }
+ parcel->setSellWithObjects(sell_with_objects);
+ if ("user" == getChild<LLUICtrl>("sell_to")->getValue().asString())
+ {
+ parcel->setAuthorizedBuyerID(mAuthorizedBuyer);
+ }
+ else
+ {
+ parcel->setAuthorizedBuyerID(LLUUID::null);
+ }
+
+ // Send update to server
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+
+ closeFloater();
+ return false;
}
diff --git a/indra/newview/llfloatersellland.h b/indra/newview/llfloatersellland.h
index 808e2ce4b0..de46d7b3fc 100644
--- a/indra/newview/llfloatersellland.h
+++ b/indra/newview/llfloatersellland.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloatersellland.h
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,10 +36,10 @@ class LLParcelSelection;
class LLFloaterSellLand
{
public:
- static void sellLand(LLViewerRegion* region,
- LLSafeHandle<LLParcelSelection> parcel);
-
- static LLFloater* buildFloater(const LLSD& key);
+ static void sellLand(LLViewerRegion* region,
+ LLSafeHandle<LLParcelSelection> parcel);
+
+ static LLFloater* buildFloater(const LLSD& key);
};
#endif // LL_LLFLOATERSELLLAND_H
diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp
index 3c7f341613..0c5762e4b1 100644
--- a/indra/newview/llfloatersettingsdebug.cpp
+++ b/indra/newview/llfloatersettingsdebug.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatersettingsdebug.cpp
* @brief floater for debugging internal viewer settings
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,12 +36,12 @@
#include "lltexteditor.h"
-LLFloaterSettingsDebug::LLFloaterSettingsDebug(const LLSD& key)
+LLFloaterSettingsDebug::LLFloaterSettingsDebug(const LLSD& key)
: LLFloater(key),
mSettingList(NULL)
{
- mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
- mCommitCallbackRegistrar.add("ClickDefault", boost::bind(&LLFloaterSettingsDebug::onClickDefault, this));
+ mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
+ mCommitCallbackRegistrar.add("ClickDefault", boost::bind(&LLFloaterSettingsDebug::onClickDefault, this));
}
LLFloaterSettingsDebug::~LLFloaterSettingsDebug()
@@ -63,7 +63,7 @@ BOOL LLFloaterSettingsDebug::postBuild()
gSavedSettings.getControl("DebugSettingsHideDefault")->getCommitSignal()->connect(boost::bind(&LLFloaterSettingsDebug::updateList, this, false));
- return TRUE;
+ return TRUE;
}
void LLFloaterSettingsDebug::draw()
@@ -75,7 +75,7 @@ void LLFloaterSettingsDebug::draw()
updateControl(controlp);
}
- LLFloater::draw();
+ LLFloater::draw();
}
void LLFloaterSettingsDebug::onCommitSettings()
@@ -87,78 +87,78 @@ void LLFloaterSettingsDebug::onCommitSettings()
}
LLControlVariable* controlp = (LLControlVariable*)first_selected->getUserdata();
- if (!controlp)
- {
- return;
- }
-
- LLVector3 vector;
- LLVector3d vectord;
- LLQuaternion quat;
- LLRect rect;
- LLColor4 col4;
- LLColor3 col3;
- LLColor4U col4U;
- LLColor4 color_with_alpha;
-
- switch(controlp->type())
- {
- case TYPE_U32:
- controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
- break;
- case TYPE_S32:
- controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
- break;
- case TYPE_F32:
- controlp->set(LLSD(getChild<LLUICtrl>("val_spinner_1")->getValue().asReal()));
- break;
- case TYPE_BOOLEAN:
- controlp->set(getChild<LLUICtrl>("boolean_combo")->getValue());
- break;
- case TYPE_STRING:
- controlp->set(LLSD(getChild<LLUICtrl>("val_text")->getValue().asString()));
- break;
- case TYPE_VEC3:
- vector.mV[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
- vector.mV[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
- vector.mV[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
- controlp->set(vector.getValue());
- break;
- case TYPE_VEC3D:
- vectord.mdV[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
- vectord.mdV[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
- vectord.mdV[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
- controlp->set(vectord.getValue());
- break;
- case TYPE_QUAT:
- quat.mQ[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
- quat.mQ[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
- quat.mQ[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
- quat.mQ[VS] = getChild<LLUICtrl>("val_spinner_4")->getValue().asReal();;
- controlp->set(quat.getValue());
- break;
- case TYPE_RECT:
- rect.mLeft = getChild<LLUICtrl>("val_spinner_1")->getValue().asInteger();
- rect.mRight = getChild<LLUICtrl>("val_spinner_2")->getValue().asInteger();
- rect.mBottom = getChild<LLUICtrl>("val_spinner_3")->getValue().asInteger();
- rect.mTop = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger();
- controlp->set(rect.getValue());
- break;
- case TYPE_COL4:
- col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue());
- col4 = LLColor4(col3, (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal());
- controlp->set(col4.getValue());
- break;
- case TYPE_COL3:
- controlp->set(getChild<LLUICtrl>("val_color_swatch")->getValue());
- //col3.mV[VRED] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_1")->getValue().asC();
- //col3.mV[VGREEN] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
- //col3.mV[VBLUE] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
- //controlp->set(col3.getValue());
- break;
- default:
- break;
- }
+ if (!controlp)
+ {
+ return;
+ }
+
+ LLVector3 vector;
+ LLVector3d vectord;
+ LLQuaternion quat;
+ LLRect rect;
+ LLColor4 col4;
+ LLColor3 col3;
+ LLColor4U col4U;
+ LLColor4 color_with_alpha;
+
+ switch(controlp->type())
+ {
+ case TYPE_U32:
+ controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
+ break;
+ case TYPE_S32:
+ controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
+ break;
+ case TYPE_F32:
+ controlp->set(LLSD(getChild<LLUICtrl>("val_spinner_1")->getValue().asReal()));
+ break;
+ case TYPE_BOOLEAN:
+ controlp->set(getChild<LLUICtrl>("boolean_combo")->getValue());
+ break;
+ case TYPE_STRING:
+ controlp->set(LLSD(getChild<LLUICtrl>("val_text")->getValue().asString()));
+ break;
+ case TYPE_VEC3:
+ vector.mV[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
+ vector.mV[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
+ vector.mV[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
+ controlp->set(vector.getValue());
+ break;
+ case TYPE_VEC3D:
+ vectord.mdV[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
+ vectord.mdV[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
+ vectord.mdV[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
+ controlp->set(vectord.getValue());
+ break;
+ case TYPE_QUAT:
+ quat.mQ[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
+ quat.mQ[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
+ quat.mQ[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
+ quat.mQ[VS] = getChild<LLUICtrl>("val_spinner_4")->getValue().asReal();;
+ controlp->set(quat.getValue());
+ break;
+ case TYPE_RECT:
+ rect.mLeft = getChild<LLUICtrl>("val_spinner_1")->getValue().asInteger();
+ rect.mRight = getChild<LLUICtrl>("val_spinner_2")->getValue().asInteger();
+ rect.mBottom = getChild<LLUICtrl>("val_spinner_3")->getValue().asInteger();
+ rect.mTop = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger();
+ controlp->set(rect.getValue());
+ break;
+ case TYPE_COL4:
+ col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue());
+ col4 = LLColor4(col3, (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal());
+ controlp->set(col4.getValue());
+ break;
+ case TYPE_COL3:
+ controlp->set(getChild<LLUICtrl>("val_color_swatch")->getValue());
+ //col3.mV[VRED] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_1")->getValue().asC();
+ //col3.mV[VGREEN] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
+ //col3.mV[VBLUE] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
+ //controlp->set(col3.getValue());
+ break;
+ default:
+ break;
+ }
updateDefaultColumn(controlp);
}
@@ -181,27 +181,27 @@ void LLFloaterSettingsDebug::onClickDefault()
// we've switched controls, or doing per-frame update, so update spinners, etc.
void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp)
{
- LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1");
- LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2");
- LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3");
- LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4");
- LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("val_color_swatch");
-
- if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch)
- {
- LL_WARNS() << "Could not find all desired controls by name"
- << LL_ENDL;
- return;
- }
+ LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1");
+ LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2");
+ LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3");
+ LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4");
+ LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("val_color_swatch");
+
+ if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch)
+ {
+ LL_WARNS() << "Could not find all desired controls by name"
+ << LL_ENDL;
+ return;
+ }
hideUIControls();
- if (controlp && !isSettingHidden(controlp))
- {
- eControlType type = controlp->type();
+ if (controlp && !isSettingHidden(controlp))
+ {
+ eControlType type = controlp->type();
- //hide combo box only for non booleans, otherwise this will result in the combo box closing every frame
- getChildView("boolean_combo")->setVisible( type == TYPE_BOOLEAN);
+ //hide combo box only for non booleans, otherwise this will result in the combo box closing every frame
+ getChildView("boolean_combo")->setVisible( type == TYPE_BOOLEAN);
getChildView("default_btn")->setVisible(true);
getChildView("setting_name_txt")->setVisible(true);
getChild<LLTextBox>("setting_name_txt")->setText(controlp->getName());
@@ -218,259 +218,259 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp)
mComment->setText(controlp->getComment());
}
- spinner1->setMaxValue(F32_MAX);
- spinner2->setMaxValue(F32_MAX);
- spinner3->setMaxValue(F32_MAX);
- spinner4->setMaxValue(F32_MAX);
- spinner1->setMinValue(-F32_MAX);
- spinner2->setMinValue(-F32_MAX);
- spinner3->setMinValue(-F32_MAX);
- spinner4->setMinValue(-F32_MAX);
- if (!spinner1->hasFocus())
- {
- spinner1->setIncrement(0.1f);
- }
- if (!spinner2->hasFocus())
- {
- spinner2->setIncrement(0.1f);
- }
- if (!spinner3->hasFocus())
- {
- spinner3->setIncrement(0.1f);
- }
- if (!spinner4->hasFocus())
- {
- spinner4->setIncrement(0.1f);
- }
-
- LLSD sd = controlp->get();
- switch(type)
- {
- case TYPE_U32:
- spinner1->setVisible(TRUE);
- spinner1->setLabel(std::string("value")); // Debug, don't translate
- if (!spinner1->hasFocus())
- {
- spinner1->setValue(sd);
- spinner1->setMinValue((F32)U32_MIN);
- spinner1->setMaxValue((F32)U32_MAX);
- spinner1->setIncrement(1.f);
- spinner1->setPrecision(0);
- }
- break;
- case TYPE_S32:
- spinner1->setVisible(TRUE);
- spinner1->setLabel(std::string("value")); // Debug, don't translate
- if (!spinner1->hasFocus())
- {
- spinner1->setValue(sd);
- spinner1->setMinValue((F32)S32_MIN);
- spinner1->setMaxValue((F32)S32_MAX);
- spinner1->setIncrement(1.f);
- spinner1->setPrecision(0);
- }
- break;
- case TYPE_F32:
- spinner1->setVisible(TRUE);
- spinner1->setLabel(std::string("value")); // Debug, don't translate
- if (!spinner1->hasFocus())
- {
- spinner1->setPrecision(3);
- spinner1->setValue(sd);
- }
- break;
- case TYPE_BOOLEAN:
- if (!getChild<LLUICtrl>("boolean_combo")->hasFocus())
- {
- if (sd.asBoolean())
- {
- getChild<LLUICtrl>("boolean_combo")->setValue(LLSD("true"));
- }
- else
- {
- getChild<LLUICtrl>("boolean_combo")->setValue(LLSD(""));
- }
- }
- break;
- case TYPE_STRING:
- getChildView("val_text")->setVisible( TRUE);
- if (!getChild<LLUICtrl>("val_text")->hasFocus())
- {
- getChild<LLUICtrl>("val_text")->setValue(sd);
- }
- break;
- case TYPE_VEC3:
- {
- LLVector3 v;
- v.setValue(sd);
- spinner1->setVisible(TRUE);
- spinner1->setLabel(std::string("X"));
- spinner2->setVisible(TRUE);
- spinner2->setLabel(std::string("Y"));
- spinner3->setVisible(TRUE);
- spinner3->setLabel(std::string("Z"));
- if (!spinner1->hasFocus())
- {
- spinner1->setPrecision(3);
- spinner1->setValue(v[VX]);
- }
- if (!spinner2->hasFocus())
- {
- spinner2->setPrecision(3);
- spinner2->setValue(v[VY]);
- }
- if (!spinner3->hasFocus())
- {
- spinner3->setPrecision(3);
- spinner3->setValue(v[VZ]);
- }
- break;
- }
- case TYPE_VEC3D:
- {
- LLVector3d v;
- v.setValue(sd);
- spinner1->setVisible(TRUE);
- spinner1->setLabel(std::string("X"));
- spinner2->setVisible(TRUE);
- spinner2->setLabel(std::string("Y"));
- spinner3->setVisible(TRUE);
- spinner3->setLabel(std::string("Z"));
- if (!spinner1->hasFocus())
- {
- spinner1->setPrecision(3);
- spinner1->setValue(v[VX]);
- }
- if (!spinner2->hasFocus())
- {
- spinner2->setPrecision(3);
- spinner2->setValue(v[VY]);
- }
- if (!spinner3->hasFocus())
- {
- spinner3->setPrecision(3);
- spinner3->setValue(v[VZ]);
- }
- break;
- }
- case TYPE_QUAT:
- {
- LLQuaternion q;
- q.setValue(sd);
- spinner1->setVisible(TRUE);
- spinner1->setLabel(std::string("X"));
- spinner2->setVisible(TRUE);
- spinner2->setLabel(std::string("Y"));
- spinner3->setVisible(TRUE);
- spinner3->setLabel(std::string("Z"));
- spinner4->setVisible(TRUE);
- spinner4->setLabel(std::string("S"));
- if (!spinner1->hasFocus())
- {
- spinner1->setPrecision(4);
- spinner1->setValue(q.mQ[VX]);
- }
- if (!spinner2->hasFocus())
- {
- spinner2->setPrecision(4);
- spinner2->setValue(q.mQ[VY]);
- }
- if (!spinner3->hasFocus())
- {
- spinner3->setPrecision(4);
- spinner3->setValue(q.mQ[VZ]);
- }
- if (!spinner4->hasFocus())
- {
- spinner4->setPrecision(4);
- spinner4->setValue(q.mQ[VS]);
- }
- break;
- }
- case TYPE_RECT:
- {
- LLRect r;
- r.setValue(sd);
- spinner1->setVisible(TRUE);
- spinner1->setLabel(std::string("Left"));
- spinner2->setVisible(TRUE);
- spinner2->setLabel(std::string("Right"));
- spinner3->setVisible(TRUE);
- spinner3->setLabel(std::string("Bottom"));
- spinner4->setVisible(TRUE);
- spinner4->setLabel(std::string("Top"));
- if (!spinner1->hasFocus())
- {
- spinner1->setPrecision(0);
- spinner1->setValue(r.mLeft);
- }
- if (!spinner2->hasFocus())
- {
- spinner2->setPrecision(0);
- spinner2->setValue(r.mRight);
- }
- if (!spinner3->hasFocus())
- {
- spinner3->setPrecision(0);
- spinner3->setValue(r.mBottom);
- }
- if (!spinner4->hasFocus())
- {
- spinner4->setPrecision(0);
- spinner4->setValue(r.mTop);
- }
-
- spinner1->setMinValue((F32)S32_MIN);
- spinner1->setMaxValue((F32)S32_MAX);
- spinner1->setIncrement(1.f);
-
- spinner2->setMinValue((F32)S32_MIN);
- spinner2->setMaxValue((F32)S32_MAX);
- spinner2->setIncrement(1.f);
-
- spinner3->setMinValue((F32)S32_MIN);
- spinner3->setMaxValue((F32)S32_MAX);
- spinner3->setIncrement(1.f);
-
- spinner4->setMinValue((F32)S32_MIN);
- spinner4->setMaxValue((F32)S32_MAX);
- spinner4->setIncrement(1.f);
- break;
- }
- case TYPE_COL4:
- {
- LLColor4 clr;
- clr.setValue(sd);
- color_swatch->setVisible(TRUE);
- // only set if changed so color picker doesn't update
- if(clr != LLColor4(color_swatch->getValue()))
- {
- color_swatch->set(LLColor4(sd), TRUE, FALSE);
- }
- spinner4->setVisible(TRUE);
- spinner4->setLabel(std::string("Alpha"));
- if (!spinner4->hasFocus())
- {
- spinner4->setPrecision(3);
- spinner4->setMinValue(0.0);
- spinner4->setMaxValue(1.f);
- spinner4->setValue(clr.mV[VALPHA]);
- }
- break;
- }
- case TYPE_COL3:
- {
- LLColor3 clr;
- clr.setValue(sd);
- color_swatch->setVisible(TRUE);
- color_swatch->setValue(sd);
- break;
- }
- default:
- mComment->setText(std::string("unknown"));
- break;
- }
- }
+ spinner1->setMaxValue(F32_MAX);
+ spinner2->setMaxValue(F32_MAX);
+ spinner3->setMaxValue(F32_MAX);
+ spinner4->setMaxValue(F32_MAX);
+ spinner1->setMinValue(-F32_MAX);
+ spinner2->setMinValue(-F32_MAX);
+ spinner3->setMinValue(-F32_MAX);
+ spinner4->setMinValue(-F32_MAX);
+ if (!spinner1->hasFocus())
+ {
+ spinner1->setIncrement(0.1f);
+ }
+ if (!spinner2->hasFocus())
+ {
+ spinner2->setIncrement(0.1f);
+ }
+ if (!spinner3->hasFocus())
+ {
+ spinner3->setIncrement(0.1f);
+ }
+ if (!spinner4->hasFocus())
+ {
+ spinner4->setIncrement(0.1f);
+ }
+
+ LLSD sd = controlp->get();
+ switch(type)
+ {
+ case TYPE_U32:
+ spinner1->setVisible(TRUE);
+ spinner1->setLabel(std::string("value")); // Debug, don't translate
+ if (!spinner1->hasFocus())
+ {
+ spinner1->setValue(sd);
+ spinner1->setMinValue((F32)U32_MIN);
+ spinner1->setMaxValue((F32)U32_MAX);
+ spinner1->setIncrement(1.f);
+ spinner1->setPrecision(0);
+ }
+ break;
+ case TYPE_S32:
+ spinner1->setVisible(TRUE);
+ spinner1->setLabel(std::string("value")); // Debug, don't translate
+ if (!spinner1->hasFocus())
+ {
+ spinner1->setValue(sd);
+ spinner1->setMinValue((F32)S32_MIN);
+ spinner1->setMaxValue((F32)S32_MAX);
+ spinner1->setIncrement(1.f);
+ spinner1->setPrecision(0);
+ }
+ break;
+ case TYPE_F32:
+ spinner1->setVisible(TRUE);
+ spinner1->setLabel(std::string("value")); // Debug, don't translate
+ if (!spinner1->hasFocus())
+ {
+ spinner1->setPrecision(3);
+ spinner1->setValue(sd);
+ }
+ break;
+ case TYPE_BOOLEAN:
+ if (!getChild<LLUICtrl>("boolean_combo")->hasFocus())
+ {
+ if (sd.asBoolean())
+ {
+ getChild<LLUICtrl>("boolean_combo")->setValue(LLSD("true"));
+ }
+ else
+ {
+ getChild<LLUICtrl>("boolean_combo")->setValue(LLSD(""));
+ }
+ }
+ break;
+ case TYPE_STRING:
+ getChildView("val_text")->setVisible( TRUE);
+ if (!getChild<LLUICtrl>("val_text")->hasFocus())
+ {
+ getChild<LLUICtrl>("val_text")->setValue(sd);
+ }
+ break;
+ case TYPE_VEC3:
+ {
+ LLVector3 v;
+ v.setValue(sd);
+ spinner1->setVisible(TRUE);
+ spinner1->setLabel(std::string("X"));
+ spinner2->setVisible(TRUE);
+ spinner2->setLabel(std::string("Y"));
+ spinner3->setVisible(TRUE);
+ spinner3->setLabel(std::string("Z"));
+ if (!spinner1->hasFocus())
+ {
+ spinner1->setPrecision(3);
+ spinner1->setValue(v[VX]);
+ }
+ if (!spinner2->hasFocus())
+ {
+ spinner2->setPrecision(3);
+ spinner2->setValue(v[VY]);
+ }
+ if (!spinner3->hasFocus())
+ {
+ spinner3->setPrecision(3);
+ spinner3->setValue(v[VZ]);
+ }
+ break;
+ }
+ case TYPE_VEC3D:
+ {
+ LLVector3d v;
+ v.setValue(sd);
+ spinner1->setVisible(TRUE);
+ spinner1->setLabel(std::string("X"));
+ spinner2->setVisible(TRUE);
+ spinner2->setLabel(std::string("Y"));
+ spinner3->setVisible(TRUE);
+ spinner3->setLabel(std::string("Z"));
+ if (!spinner1->hasFocus())
+ {
+ spinner1->setPrecision(3);
+ spinner1->setValue(v[VX]);
+ }
+ if (!spinner2->hasFocus())
+ {
+ spinner2->setPrecision(3);
+ spinner2->setValue(v[VY]);
+ }
+ if (!spinner3->hasFocus())
+ {
+ spinner3->setPrecision(3);
+ spinner3->setValue(v[VZ]);
+ }
+ break;
+ }
+ case TYPE_QUAT:
+ {
+ LLQuaternion q;
+ q.setValue(sd);
+ spinner1->setVisible(TRUE);
+ spinner1->setLabel(std::string("X"));
+ spinner2->setVisible(TRUE);
+ spinner2->setLabel(std::string("Y"));
+ spinner3->setVisible(TRUE);
+ spinner3->setLabel(std::string("Z"));
+ spinner4->setVisible(TRUE);
+ spinner4->setLabel(std::string("S"));
+ if (!spinner1->hasFocus())
+ {
+ spinner1->setPrecision(4);
+ spinner1->setValue(q.mQ[VX]);
+ }
+ if (!spinner2->hasFocus())
+ {
+ spinner2->setPrecision(4);
+ spinner2->setValue(q.mQ[VY]);
+ }
+ if (!spinner3->hasFocus())
+ {
+ spinner3->setPrecision(4);
+ spinner3->setValue(q.mQ[VZ]);
+ }
+ if (!spinner4->hasFocus())
+ {
+ spinner4->setPrecision(4);
+ spinner4->setValue(q.mQ[VS]);
+ }
+ break;
+ }
+ case TYPE_RECT:
+ {
+ LLRect r;
+ r.setValue(sd);
+ spinner1->setVisible(TRUE);
+ spinner1->setLabel(std::string("Left"));
+ spinner2->setVisible(TRUE);
+ spinner2->setLabel(std::string("Right"));
+ spinner3->setVisible(TRUE);
+ spinner3->setLabel(std::string("Bottom"));
+ spinner4->setVisible(TRUE);
+ spinner4->setLabel(std::string("Top"));
+ if (!spinner1->hasFocus())
+ {
+ spinner1->setPrecision(0);
+ spinner1->setValue(r.mLeft);
+ }
+ if (!spinner2->hasFocus())
+ {
+ spinner2->setPrecision(0);
+ spinner2->setValue(r.mRight);
+ }
+ if (!spinner3->hasFocus())
+ {
+ spinner3->setPrecision(0);
+ spinner3->setValue(r.mBottom);
+ }
+ if (!spinner4->hasFocus())
+ {
+ spinner4->setPrecision(0);
+ spinner4->setValue(r.mTop);
+ }
+
+ spinner1->setMinValue((F32)S32_MIN);
+ spinner1->setMaxValue((F32)S32_MAX);
+ spinner1->setIncrement(1.f);
+
+ spinner2->setMinValue((F32)S32_MIN);
+ spinner2->setMaxValue((F32)S32_MAX);
+ spinner2->setIncrement(1.f);
+
+ spinner3->setMinValue((F32)S32_MIN);
+ spinner3->setMaxValue((F32)S32_MAX);
+ spinner3->setIncrement(1.f);
+
+ spinner4->setMinValue((F32)S32_MIN);
+ spinner4->setMaxValue((F32)S32_MAX);
+ spinner4->setIncrement(1.f);
+ break;
+ }
+ case TYPE_COL4:
+ {
+ LLColor4 clr;
+ clr.setValue(sd);
+ color_swatch->setVisible(TRUE);
+ // only set if changed so color picker doesn't update
+ if(clr != LLColor4(color_swatch->getValue()))
+ {
+ color_swatch->set(LLColor4(sd), TRUE, FALSE);
+ }
+ spinner4->setVisible(TRUE);
+ spinner4->setLabel(std::string("Alpha"));
+ if (!spinner4->hasFocus())
+ {
+ spinner4->setPrecision(3);
+ spinner4->setMinValue(0.0);
+ spinner4->setMaxValue(1.f);
+ spinner4->setValue(clr.mV[VALPHA]);
+ }
+ break;
+ }
+ case TYPE_COL3:
+ {
+ LLColor3 clr;
+ clr.setValue(sd);
+ color_swatch->setVisible(TRUE);
+ color_swatch->setValue(sd);
+ break;
+ }
+ default:
+ mComment->setText(std::string("unknown"));
+ break;
+ }
+ }
}
@@ -494,7 +494,7 @@ void LLFloaterSettingsDebug::updateList(bool skip_selection)
LLFloaterSettingsDebug* floater;
std::string selected_setting;
bool skip_selection;
- f(LLScrollListCtrl* list, LLFloaterSettingsDebug* floater, std::string setting, bool skip_selection)
+ f(LLScrollListCtrl* list, LLFloaterSettingsDebug* floater, std::string setting, bool skip_selection)
: setting_list(list), floater(floater), selected_setting(setting), skip_selection(skip_selection) {}
virtual void apply(const std::string& name, LLControlVariable* control)
{
diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h
index 888eaadcbd..5a392e766c 100644
--- a/indra/newview/llfloatersettingsdebug.h
+++ b/indra/newview/llfloatersettingsdebug.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatersettingsdebug.h
* @brief floater for debugging internal viewer settings
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,29 +32,29 @@
class LLScrollListCtrl;
-class LLFloaterSettingsDebug
-: public LLFloater
+class LLFloaterSettingsDebug
+: public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- virtual BOOL postBuild();
- virtual void draw();
+ virtual BOOL postBuild();
+ virtual void draw();
- void updateControl(LLControlVariable* control);
+ void updateControl(LLControlVariable* control);
- void onCommitSettings();
- void onClickDefault();
+ void onCommitSettings();
+ void onClickDefault();
bool matchesSearchFilter(std::string setting_name);
bool isSettingHidden(LLControlVariable* control);
private:
- // key - selects which settings to show, one of:
- // "all", "base", "account", "skin"
- LLFloaterSettingsDebug(const LLSD& key);
- virtual ~LLFloaterSettingsDebug();
+ // key - selects which settings to show, one of:
+ // "all", "base", "account", "skin"
+ LLFloaterSettingsDebug(const LLSD& key);
+ virtual ~LLFloaterSettingsDebug();
void updateList(bool skip_selection = false);
void onSettingSelect();
@@ -64,9 +64,9 @@ private:
void hideUIControls();
LLScrollListCtrl* mSettingList;
-
+
protected:
- class LLTextEditor* mComment;
+ class LLTextEditor* mComment;
std::string mSearchFilter;
};
diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp
index 532e7da67f..c99d156c3a 100644
--- a/indra/newview/llfloatersidepanelcontainer.cpp
+++ b/indra/newview/llfloatersidepanelcontainer.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatersidepanelcontainer.cpp
* @brief LLFloaterSidePanelContainer class definition
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,61 +40,61 @@
const std::string LLFloaterSidePanelContainer::sMainPanelName("main_panel");
LLFloaterSidePanelContainer::LLFloaterSidePanelContainer(const LLSD& key, const Params& params)
-: LLFloater(key, params)
+: LLFloater(key, params)
{
- // Prevent transient floaters (e.g. IM windows) from hiding
- // when this floater is clicked.
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this);
+ // Prevent transient floaters (e.g. IM windows) from hiding
+ // when this floater is clicked.
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this);
}
LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer()
{
- LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this);
+ LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this);
}
void LLFloaterSidePanelContainer::onOpen(const LLSD& key)
{
- getChild<LLPanel>(sMainPanelName)->onOpen(key);
+ getChild<LLPanel>(sMainPanelName)->onOpen(key);
}
void LLFloaterSidePanelContainer::closeFloater(bool app_quitting)
{
- LLPanelOutfitEdit* panel_outfit_edit =
- dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit"));
- if (panel_outfit_edit)
- {
- LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit);
- if (parent == this )
- {
- LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance"));
- if (panel_appearance)
- {
- LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable();
- if (edit_wearable_ptr)
- {
- edit_wearable_ptr->onClose();
- }
- if (!app_quitting)
- {
- panel_appearance->showOutfitsInventoryPanel();
- }
- }
- }
- }
-
- LLFloater::closeFloater(app_quitting);
-
- if (getInstanceName() == "inventory" && !getKey().isUndefined())
- {
- destroy();
- }
+ LLPanelOutfitEdit* panel_outfit_edit =
+ dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit"));
+ if (panel_outfit_edit)
+ {
+ LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit);
+ if (parent == this )
+ {
+ LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance"));
+ if (panel_appearance)
+ {
+ LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable();
+ if (edit_wearable_ptr)
+ {
+ edit_wearable_ptr->onClose();
+ }
+ if (!app_quitting)
+ {
+ panel_appearance->showOutfitsInventoryPanel();
+ }
+ }
+ }
+ }
+
+ LLFloater::closeFloater(app_quitting);
+
+ if (getInstanceName() == "inventory" && !getKey().isUndefined())
+ {
+ destroy();
+ }
}
LLFloater* LLFloaterSidePanelContainer::getTopmostInventoryFloater()
{
LLFloater* topmost_floater = NULL;
S32 z_min = S32_MAX;
-
+
LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
{
@@ -115,73 +115,73 @@ LLFloater* LLFloaterSidePanelContainer::getTopmostInventoryFloater()
LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params)
{
- LLView* view = findChildView(panel_name, true);
- if (!view)
- return NULL;
-
- if (!getVisible())
- {
- openFloater();
- }
- else if (!hasFocus())
- {
- setFocus(TRUE);
- }
-
- LLPanel* panel = NULL;
-
- LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent());
- if (container)
- {
- container->openPanel(panel_name, params);
- panel = container->getCurrentPanel();
- }
- else if ((panel = dynamic_cast<LLPanel*>(view)) != NULL)
- {
- panel->onOpen(params);
- }
-
- return panel;
+ LLView* view = findChildView(panel_name, true);
+ if (!view)
+ return NULL;
+
+ if (!getVisible())
+ {
+ openFloater();
+ }
+ else if (!hasFocus())
+ {
+ setFocus(TRUE);
+ }
+
+ LLPanel* panel = NULL;
+
+ LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent());
+ if (container)
+ {
+ container->openPanel(panel_name, params);
+ panel = container->getCurrentPanel();
+ }
+ else if ((panel = dynamic_cast<LLPanel*>(view)) != NULL)
+ {
+ panel->onOpen(params);
+ }
+
+ return panel;
}
void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const LLSD& key)
{
- LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
- if (floaterp)
- {
- floaterp->openChildPanel(sMainPanelName, key);
- }
+ LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
+ if (floaterp)
+ {
+ floaterp->openChildPanel(sMainPanelName, key);
+ }
}
void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key)
{
- LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
- if (floaterp)
- {
- floaterp->openChildPanel(panel_name, key);
- }
+ LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
+ if (floaterp)
+ {
+ floaterp->openChildPanel(panel_name, key);
+ }
}
LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, const std::string& panel_name)
{
- LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
+ LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
- if (floaterp)
- {
- return floaterp->findChild<LLPanel>(panel_name, true);
- }
+ if (floaterp)
+ {
+ return floaterp->findChild<LLPanel>(panel_name, true);
+ }
- return NULL;
+ return NULL;
}
LLPanel* LLFloaterSidePanelContainer::findPanel(const std::string& floater_name, const std::string& panel_name)
{
- LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance<LLFloaterSidePanelContainer>(floater_name);
+ LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance<LLFloaterSidePanelContainer>(floater_name);
- if (floaterp)
- {
- return floaterp->findChild<LLPanel>(panel_name, true);
- }
+ if (floaterp)
+ {
+ return floaterp->findChild<LLPanel>(panel_name, true);
+ }
- return NULL;
+ return NULL;
}
diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h
index 5e7e755d1f..d5d0c43cae 100644
--- a/indra/newview/llfloatersidepanelcontainer.h
+++ b/indra/newview/llfloatersidepanelcontainer.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatersidepanelcontainer.h
* @brief LLFloaterSidePanelContainer class
*
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,47 +43,47 @@
class LLFloaterSidePanelContainer : public LLFloater
{
private:
- static const std::string sMainPanelName;
+ static const std::string sMainPanelName;
public:
- LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams());
- ~LLFloaterSidePanelContainer();
+ LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams());
+ ~LLFloaterSidePanelContainer();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void closeFloater(bool app_quitting = false);
+ /*virtual*/ void closeFloater(bool app_quitting = false);
- void cleanup() { destroy(); }
+ void cleanup() { destroy(); }
- LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params);
+ LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params);
static LLFloater* getTopmostInventoryFloater();
- static void showPanel(const std::string& floater_name, const LLSD& key);
+ static void showPanel(const std::string& floater_name, const LLSD& key);
+
+ static void showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key);
+
+ static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName);
- static void showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key);
-
- static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName);
+ static LLPanel* findPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName);
- static LLPanel* findPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName);
-
- /**
- * Gets the panel of given type T (doesn't show it or do anything else with it).
- *
- * @param floater_name a string specifying the floater to be searched for a child panel.
- * @param panel_name a string specifying the child panel to get.
- * @returns a pointer to the panel of given type T.
- */
- template <typename T>
- static T* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName)
- {
- T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name));
- if (!panel)
- {
- LL_WARNS() << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << LL_ENDL;
- }
- return panel;
- }
+ /**
+ * Gets the panel of given type T (doesn't show it or do anything else with it).
+ *
+ * @param floater_name a string specifying the floater to be searched for a child panel.
+ * @param panel_name a string specifying the child panel to get.
+ * @returns a pointer to the panel of given type T.
+ */
+ template <typename T>
+ static T* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName)
+ {
+ T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name));
+ if (!panel)
+ {
+ LL_WARNS() << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << LL_ENDL;
+ }
+ return panel;
+ }
};
#endif // LL_LLFLOATERSIDEPANELCONTAINER_H
diff --git a/indra/newview/llfloatersimplesnapshot.cpp b/indra/newview/llfloatersimplesnapshot.cpp
index 58604c5628..37f845b3d7 100644
--- a/indra/newview/llfloatersimplesnapshot.cpp
+++ b/indra/newview/llfloatersimplesnapshot.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatersimplesnapshot.cpp
* @brief Snapshot preview window for saving as a thumbnail
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -310,7 +310,7 @@ void LLFloaterSimpleSnapshot::draw()
LLFloater::draw();
if (previewp && !isMinimized() && mThumbnailPlaceholder->getVisible())
- {
+ {
if(previewp->getThumbnailImage())
{
bool working = impl->getStatus() == ImplBase::STATUS_WORKING;
@@ -325,7 +325,7 @@ void LLFloaterSimpleSnapshot::draw()
// Apply floater transparency to the texture unless the floater is focused.
F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
LLColor4 color = working ? LLColor4::grey4 : LLColor4::white;
- gl_draw_scaled_image(offset_x, offset_y,
+ gl_draw_scaled_image(offset_x, offset_y,
thumbnail_w, thumbnail_h,
previewp->getThumbnailImage(), color % alpha);
}
diff --git a/indra/newview/llfloatersimplesnapshot.h b/indra/newview/llfloatersimplesnapshot.h
index 91a81ee5c3..f6b79fd2ea 100644
--- a/indra/newview/llfloatersimplesnapshot.h
+++ b/indra/newview/llfloatersimplesnapshot.h
@@ -82,7 +82,7 @@ private:
LLUUID mTaskId;
LLView* mOwner;
- F32 mContextConeOpacity;
+ F32 mContextConeOpacity;
};
///----------------------------------------------------------------------------
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index ca2069cbfc..68ed0f5873 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatersnapshot.cpp
* @brief Snapshot preview window, allowing saving, e-mailing, etc.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2016, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "llpostcard.h"
-#include "llresmgr.h" // LLLocale
+#include "llresmgr.h" // LLLocale
#include "llsdserialize.h"
#include "llsidetraypanelcontainer.h"
#include "llsnapshotlivepreview.h"
@@ -58,199 +58,199 @@ static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_float
// virtual
LLPanelSnapshot* LLFloaterSnapshot::Impl::getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found)
{
- LLSideTrayPanelContainer* panel_container = floater->getChild<LLSideTrayPanelContainer>("panel_container");
- LLPanelSnapshot* active_panel = dynamic_cast<LLPanelSnapshot*>(panel_container->getCurrentPanel());
- if (!ok_if_not_found)
- {
- llassert_always(active_panel != NULL);
- }
- return active_panel;
+ LLSideTrayPanelContainer* panel_container = floater->getChild<LLSideTrayPanelContainer>("panel_container");
+ LLPanelSnapshot* active_panel = dynamic_cast<LLPanelSnapshot*>(panel_container->getCurrentPanel());
+ if (!ok_if_not_found)
+ {
+ llassert_always(active_panel != NULL);
+ }
+ return active_panel;
}
// virtual
LLSnapshotModel::ESnapshotType LLFloaterSnapshotBase::ImplBase::getActiveSnapshotType(LLFloaterSnapshotBase* floater)
{
- LLPanelSnapshot* spanel = getActivePanel(floater);
+ LLPanelSnapshot* spanel = getActivePanel(floater);
- //return type;
+ //return type;
if (spanel)
{
return spanel->getSnapshotType();
}
- return LLSnapshotModel::SNAPSHOT_WEB;
+ return LLSnapshotModel::SNAPSHOT_WEB;
}
// virtual
LLSnapshotModel::ESnapshotFormat LLFloaterSnapshot::Impl::getImageFormat(LLFloaterSnapshotBase* floater)
{
- LLPanelSnapshot* active_panel = getActivePanel(floater);
- // FIXME: if the default is not PNG, profile uploads may fail.
- return active_panel ? active_panel->getImageFormat() : LLSnapshotModel::SNAPSHOT_FORMAT_PNG;
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ // FIXME: if the default is not PNG, profile uploads may fail.
+ return active_panel ? active_panel->getImageFormat() : LLSnapshotModel::SNAPSHOT_FORMAT_PNG;
}
LLSpinCtrl* LLFloaterSnapshot::Impl::getWidthSpinner(LLFloaterSnapshotBase* floater)
{
- LLPanelSnapshot* active_panel = getActivePanel(floater);
- return active_panel ? active_panel->getWidthSpinner() : floater->getChild<LLSpinCtrl>("snapshot_width");
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ return active_panel ? active_panel->getWidthSpinner() : floater->getChild<LLSpinCtrl>("snapshot_width");
}
LLSpinCtrl* LLFloaterSnapshot::Impl::getHeightSpinner(LLFloaterSnapshotBase* floater)
{
- LLPanelSnapshot* active_panel = getActivePanel(floater);
- return active_panel ? active_panel->getHeightSpinner() : floater->getChild<LLSpinCtrl>("snapshot_height");
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ return active_panel ? active_panel->getHeightSpinner() : floater->getChild<LLSpinCtrl>("snapshot_height");
}
void LLFloaterSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, BOOL enable)
{
- LLPanelSnapshot* active_panel = getActivePanel(floater);
- if (active_panel)
- {
- active_panel->enableAspectRatioCheckbox(enable);
- }
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ if (active_panel)
+ {
+ active_panel->enableAspectRatioCheckbox(enable);
+ }
}
void LLFloaterSnapshot::Impl::setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, BOOL checked)
{
- LLPanelSnapshot* active_panel = getActivePanel(floater);
- if (active_panel)
- {
- active_panel->getChild<LLUICtrl>(active_panel->getAspectRatioCBName())->setValue(checked);
- }
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ if (active_panel)
+ {
+ active_panel->getChild<LLUICtrl>(active_panel->getAspectRatioCBName())->setValue(checked);
+ }
}
LLSnapshotLivePreview* LLFloaterSnapshotBase::getPreviewView()
{
- return impl->getPreviewView();
+ return impl->getPreviewView();
}
LLSnapshotLivePreview* LLFloaterSnapshotBase::ImplBase::getPreviewView()
{
- LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get();
- return previewp;
+ LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get();
+ return previewp;
}
// virtual
LLSnapshotModel::ESnapshotLayerType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSnapshotBase* floater)
{
- LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
- LLSD value = floater->getChild<LLUICtrl>("layer_types")->getValue();
- const std::string id = value.asString();
- if (id == "colors")
- type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
- else if (id == "depth")
- type = LLSnapshotModel::SNAPSHOT_TYPE_DEPTH;
- return type;
+ LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
+ LLSD value = floater->getChild<LLUICtrl>("layer_types")->getValue();
+ const std::string id = value.asString();
+ if (id == "colors")
+ type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
+ else if (id == "depth")
+ type = LLSnapshotModel::SNAPSHOT_TYPE_DEPTH;
+ return type;
}
void LLFloaterSnapshot::Impl::setResolution(LLFloaterSnapshotBase* floater, const std::string& comboname)
{
- LLComboBox* combo = floater->getChild<LLComboBox>(comboname);
- combo->setVisible(TRUE);
- updateResolution(combo, floater, FALSE); // to sync spinners with combo
+ LLComboBox* combo = floater->getChild<LLComboBox>(comboname);
+ combo->setVisible(TRUE);
+ updateResolution(combo, floater, FALSE); // to sync spinners with combo
}
-//virtual
+//virtual
void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floaterp)
{
- LLSnapshotLivePreview* previewp = getPreviewView();
-
- //BD - Automatically calculate the size of our snapshot window to enlarge
- // the snapshot preview to its maximum size, this is especially helpfull
- // for pretty much every aspect ratio other than 1:1.
- F32 panel_width = 400.f * gViewerWindow->getWorldViewAspectRatio();
-
- //BD - Make sure we clamp at 700 here because 700 would be for 16:9 which we
- // consider the maximum. Everything bigger will be clamped and will have
- // a slightly smaller preview window which most likely won't fill up the
- // whole snapshot floater as it should.
- if(panel_width > 700.f)
- {
- panel_width = 700.f;
- }
-
- S32 floater_width = 224.f;
- if(mAdvanced)
- {
- floater_width = floater_width + panel_width;
- }
-
- LLUICtrl* thumbnail_placeholder = floaterp->getChild<LLUICtrl>("thumbnail_placeholder");
- thumbnail_placeholder->setVisible(mAdvanced);
-
- floaterp->getChild<LLUICtrl>("image_res_text")->setVisible(mAdvanced);
- floaterp->getChild<LLUICtrl>("file_size_label")->setVisible(mAdvanced);
+ LLSnapshotLivePreview* previewp = getPreviewView();
+
+ //BD - Automatically calculate the size of our snapshot window to enlarge
+ // the snapshot preview to its maximum size, this is especially helpfull
+ // for pretty much every aspect ratio other than 1:1.
+ F32 panel_width = 400.f * gViewerWindow->getWorldViewAspectRatio();
+
+ //BD - Make sure we clamp at 700 here because 700 would be for 16:9 which we
+ // consider the maximum. Everything bigger will be clamped and will have
+ // a slightly smaller preview window which most likely won't fill up the
+ // whole snapshot floater as it should.
+ if(panel_width > 700.f)
+ {
+ panel_width = 700.f;
+ }
+
+ S32 floater_width = 224.f;
+ if(mAdvanced)
+ {
+ floater_width = floater_width + panel_width;
+ }
+
+ LLUICtrl* thumbnail_placeholder = floaterp->getChild<LLUICtrl>("thumbnail_placeholder");
+ thumbnail_placeholder->setVisible(mAdvanced);
+
+ floaterp->getChild<LLUICtrl>("image_res_text")->setVisible(mAdvanced);
+ floaterp->getChild<LLUICtrl>("file_size_label")->setVisible(mAdvanced);
if (floaterp->hasChild("360_label", TRUE))
- {
+ {
floaterp->getChild<LLUICtrl>("360_label")->setVisible(mAdvanced);
}
- if (!mSkipReshaping)
- {
+ if (!mSkipReshaping)
+ {
thumbnail_placeholder->reshape(panel_width, thumbnail_placeholder->getRect().getHeight());
if (!floaterp->isMinimized())
{
floaterp->reshape(floater_width, floaterp->getRect().getHeight());
}
- }
-
- bool use_freeze_frame = floaterp->getChild<LLUICtrl>("freeze_frame_check")->getValue().asBoolean();
-
- if (use_freeze_frame)
- {
- // stop all mouse events at fullscreen preview layer
- floaterp->getParent()->setMouseOpaque(TRUE);
-
- // shrink to smaller layout
- // *TODO: unneeded?
- floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight());
-
- // can see and interact with fullscreen preview now
- if (previewp)
- {
- previewp->setVisible(TRUE);
- previewp->setEnabled(TRUE);
- }
-
- //RN: freeze all avatars
- LLCharacter* avatarp;
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- avatarp = *iter;
- floaterp->impl->mAvatarPauseHandles.push_back(avatarp->requestPause());
- }
-
- // freeze everything else
- gSavedSettings.setBOOL("FreezeTime", TRUE);
-
- if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset)
- {
- floaterp->impl->mLastToolset = LLToolMgr::getInstance()->getCurrentToolset();
- LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset);
- }
- }
- else // turning off freeze frame mode
- {
- floaterp->getParent()->setMouseOpaque(FALSE);
- // *TODO: unneeded?
- floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight());
- if (previewp)
- {
- previewp->setVisible(FALSE);
- previewp->setEnabled(FALSE);
- }
-
- //RN: thaw all avatars
- floaterp->impl->mAvatarPauseHandles.clear();
-
- // thaw everything else
- gSavedSettings.setBOOL("FreezeTime", FALSE);
-
- // restore last tool (e.g. pie menu, etc)
- if (floaterp->impl->mLastToolset)
- {
- LLToolMgr::getInstance()->setCurrentToolset(floaterp->impl->mLastToolset);
- }
- }
+ }
+
+ bool use_freeze_frame = floaterp->getChild<LLUICtrl>("freeze_frame_check")->getValue().asBoolean();
+
+ if (use_freeze_frame)
+ {
+ // stop all mouse events at fullscreen preview layer
+ floaterp->getParent()->setMouseOpaque(TRUE);
+
+ // shrink to smaller layout
+ // *TODO: unneeded?
+ floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight());
+
+ // can see and interact with fullscreen preview now
+ if (previewp)
+ {
+ previewp->setVisible(TRUE);
+ previewp->setEnabled(TRUE);
+ }
+
+ //RN: freeze all avatars
+ LLCharacter* avatarp;
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ avatarp = *iter;
+ floaterp->impl->mAvatarPauseHandles.push_back(avatarp->requestPause());
+ }
+
+ // freeze everything else
+ gSavedSettings.setBOOL("FreezeTime", TRUE);
+
+ if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset)
+ {
+ floaterp->impl->mLastToolset = LLToolMgr::getInstance()->getCurrentToolset();
+ LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset);
+ }
+ }
+ else // turning off freeze frame mode
+ {
+ floaterp->getParent()->setMouseOpaque(FALSE);
+ // *TODO: unneeded?
+ floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight());
+ if (previewp)
+ {
+ previewp->setVisible(FALSE);
+ previewp->setEnabled(FALSE);
+ }
+
+ //RN: thaw all avatars
+ floaterp->impl->mAvatarPauseHandles.clear();
+
+ // thaw everything else
+ gSavedSettings.setBOOL("FreezeTime", FALSE);
+
+ // restore last tool (e.g. pie menu, etc)
+ if (floaterp->impl->mLastToolset)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(floaterp->impl->mLastToolset);
+ }
+ }
}
// This is the main function that keeps all the GUI controls in sync with the saved settings.
@@ -262,212 +262,212 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate
// virtual
void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
{
- LLSnapshotModel::ESnapshotType shot_type = getActiveSnapshotType(floater);
- LLSnapshotModel::ESnapshotFormat shot_format = (LLSnapshotModel::ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat");
- LLSnapshotModel::ESnapshotLayerType layer_type = getLayerType(floater);
-
- floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat"));
- floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotModel::SNAPSHOT_LOCAL);
-
- LLPanelSnapshot* active_panel = getActivePanel(floater);
- if (active_panel)
- {
- LLSpinCtrl* width_ctrl = getWidthSpinner(floater);
- LLSpinCtrl* height_ctrl = getHeightSpinner(floater);
-
- // Initialize spinners.
- if (width_ctrl->getValue().asInteger() == 0)
- {
- S32 w = gViewerWindow->getWindowWidthRaw();
- LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL;
- width_ctrl->setValue(w);
- if (getActiveSnapshotType(floater) == LLSnapshotModel::SNAPSHOT_TEXTURE)
- {
- width_ctrl->setIncrement(w >> 1);
- }
- }
- if (height_ctrl->getValue().asInteger() == 0)
- {
- S32 h = gViewerWindow->getWindowHeightRaw();
- LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL;
- height_ctrl->setValue(h);
- if (getActiveSnapshotType(floater) == LLSnapshotModel::SNAPSHOT_TEXTURE)
- {
- height_ctrl->setIncrement(h >> 1);
- }
- }
-
- // Clamp snapshot resolution to window size when showing UI or HUD in snapshot.
- if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot"))
- {
- S32 width = gViewerWindow->getWindowWidthRaw();
- S32 height = gViewerWindow->getWindowHeightRaw();
-
- width_ctrl->setMaxValue(width);
-
- height_ctrl->setMaxValue(height);
-
- if (width_ctrl->getValue().asInteger() > width)
- {
- width_ctrl->forceSetValue(width);
- }
- if (height_ctrl->getValue().asInteger() > height)
- {
- height_ctrl->forceSetValue(height);
- }
- }
- else
- {
- width_ctrl->setMaxValue(MAX_SNAPSHOT_IMAGE_SIZE);
- height_ctrl->setMaxValue(MAX_SNAPSHOT_IMAGE_SIZE);
- }
- }
-
- LLSnapshotLivePreview* previewp = getPreviewView();
- BOOL got_bytes = previewp && previewp->getDataSize() > 0;
- BOOL got_snap = previewp && previewp->getSnapshotUpToDate();
-
- // *TODO: Separate maximum size for Web images from postcards
- LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL;
-
- LLLocale locale(LLLocale::USER_LOCALE);
- std::string bytes_string;
- if (got_snap)
- {
- LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 );
- }
-
- // Update displayed image resolution.
- LLTextBox* image_res_tb = floater->getChild<LLTextBox>("image_res_text");
- image_res_tb->setVisible(got_snap);
- if (got_snap)
- {
- image_res_tb->setTextArg("[WIDTH]", llformat("%d", previewp->getEncodedImageWidth()));
- image_res_tb->setTextArg("[HEIGHT]", llformat("%d", previewp->getEncodedImageHeight()));
- }
-
- floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
- floater->getChild<LLUICtrl>("file_size_label")->setColor(
- shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD
- && got_bytes
- && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" ));
-
- // Update the width and height spinners based on the corresponding resolution combos. (?)
- switch(shot_type)
- {
- case LLSnapshotModel::SNAPSHOT_WEB:
- layer_type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
- floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
- setResolution(floater, "profile_size_combo");
- break;
- case LLSnapshotModel::SNAPSHOT_POSTCARD:
- layer_type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
- floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
- setResolution(floater, "postcard_size_combo");
- break;
- case LLSnapshotModel::SNAPSHOT_TEXTURE:
- layer_type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
- floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
- setResolution(floater, "texture_size_combo");
- break;
- case LLSnapshotModel::SNAPSHOT_LOCAL:
- setResolution(floater, "local_size_combo");
- break;
- default:
- break;
- }
- setAspectRatioCheckboxValue(floater, !floater->impl->mAspectRatioCheckOff && gSavedSettings.getBOOL("KeepAspectForSnapshot"));
-
- if (previewp)
- {
- previewp->setSnapshotType(shot_type);
- previewp->setSnapshotFormat(shot_format);
- previewp->setSnapshotBufferType(layer_type);
- }
-
- LLPanelSnapshot* current_panel = Impl::getActivePanel(floater);
- if (current_panel)
- {
- LLSD info;
- info["have-snapshot"] = got_snap;
- current_panel->updateControls(info);
- }
- LL_DEBUGS() << "finished updating controls" << LL_ENDL;
+ LLSnapshotModel::ESnapshotType shot_type = getActiveSnapshotType(floater);
+ LLSnapshotModel::ESnapshotFormat shot_format = (LLSnapshotModel::ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat");
+ LLSnapshotModel::ESnapshotLayerType layer_type = getLayerType(floater);
+
+ floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat"));
+ floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotModel::SNAPSHOT_LOCAL);
+
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ if (active_panel)
+ {
+ LLSpinCtrl* width_ctrl = getWidthSpinner(floater);
+ LLSpinCtrl* height_ctrl = getHeightSpinner(floater);
+
+ // Initialize spinners.
+ if (width_ctrl->getValue().asInteger() == 0)
+ {
+ S32 w = gViewerWindow->getWindowWidthRaw();
+ LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL;
+ width_ctrl->setValue(w);
+ if (getActiveSnapshotType(floater) == LLSnapshotModel::SNAPSHOT_TEXTURE)
+ {
+ width_ctrl->setIncrement(w >> 1);
+ }
+ }
+ if (height_ctrl->getValue().asInteger() == 0)
+ {
+ S32 h = gViewerWindow->getWindowHeightRaw();
+ LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL;
+ height_ctrl->setValue(h);
+ if (getActiveSnapshotType(floater) == LLSnapshotModel::SNAPSHOT_TEXTURE)
+ {
+ height_ctrl->setIncrement(h >> 1);
+ }
+ }
+
+ // Clamp snapshot resolution to window size when showing UI or HUD in snapshot.
+ if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot"))
+ {
+ S32 width = gViewerWindow->getWindowWidthRaw();
+ S32 height = gViewerWindow->getWindowHeightRaw();
+
+ width_ctrl->setMaxValue(width);
+
+ height_ctrl->setMaxValue(height);
+
+ if (width_ctrl->getValue().asInteger() > width)
+ {
+ width_ctrl->forceSetValue(width);
+ }
+ if (height_ctrl->getValue().asInteger() > height)
+ {
+ height_ctrl->forceSetValue(height);
+ }
+ }
+ else
+ {
+ width_ctrl->setMaxValue(MAX_SNAPSHOT_IMAGE_SIZE);
+ height_ctrl->setMaxValue(MAX_SNAPSHOT_IMAGE_SIZE);
+ }
+ }
+
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ BOOL got_bytes = previewp && previewp->getDataSize() > 0;
+ BOOL got_snap = previewp && previewp->getSnapshotUpToDate();
+
+ // *TODO: Separate maximum size for Web images from postcards
+ LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL;
+
+ LLLocale locale(LLLocale::USER_LOCALE);
+ std::string bytes_string;
+ if (got_snap)
+ {
+ LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 );
+ }
+
+ // Update displayed image resolution.
+ LLTextBox* image_res_tb = floater->getChild<LLTextBox>("image_res_text");
+ image_res_tb->setVisible(got_snap);
+ if (got_snap)
+ {
+ image_res_tb->setTextArg("[WIDTH]", llformat("%d", previewp->getEncodedImageWidth()));
+ image_res_tb->setTextArg("[HEIGHT]", llformat("%d", previewp->getEncodedImageHeight()));
+ }
+
+ floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
+ floater->getChild<LLUICtrl>("file_size_label")->setColor(
+ shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD
+ && got_bytes
+ && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" ));
+
+ // Update the width and height spinners based on the corresponding resolution combos. (?)
+ switch(shot_type)
+ {
+ case LLSnapshotModel::SNAPSHOT_WEB:
+ layer_type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
+ floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
+ setResolution(floater, "profile_size_combo");
+ break;
+ case LLSnapshotModel::SNAPSHOT_POSTCARD:
+ layer_type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
+ floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
+ setResolution(floater, "postcard_size_combo");
+ break;
+ case LLSnapshotModel::SNAPSHOT_TEXTURE:
+ layer_type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
+ floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
+ setResolution(floater, "texture_size_combo");
+ break;
+ case LLSnapshotModel::SNAPSHOT_LOCAL:
+ setResolution(floater, "local_size_combo");
+ break;
+ default:
+ break;
+ }
+ setAspectRatioCheckboxValue(floater, !floater->impl->mAspectRatioCheckOff && gSavedSettings.getBOOL("KeepAspectForSnapshot"));
+
+ if (previewp)
+ {
+ previewp->setSnapshotType(shot_type);
+ previewp->setSnapshotFormat(shot_format);
+ previewp->setSnapshotBufferType(layer_type);
+ }
+
+ LLPanelSnapshot* current_panel = Impl::getActivePanel(floater);
+ if (current_panel)
+ {
+ LLSD info;
+ info["have-snapshot"] = got_snap;
+ current_panel->updateControls(info);
+ }
+ LL_DEBUGS() << "finished updating controls" << LL_ENDL;
}
//virtual
void LLFloaterSnapshotBase::ImplBase::setStatus(EStatus status, bool ok, const std::string& msg)
{
- switch (status)
- {
- case STATUS_READY:
- setWorking(false);
- setFinished(false);
- break;
- case STATUS_WORKING:
- setWorking(true);
- setFinished(false);
- break;
- case STATUS_FINISHED:
- setWorking(false);
- setFinished(true, ok, msg);
- break;
- }
-
- mStatus = status;
+ switch (status)
+ {
+ case STATUS_READY:
+ setWorking(false);
+ setFinished(false);
+ break;
+ case STATUS_WORKING:
+ setWorking(true);
+ setFinished(false);
+ break;
+ case STATUS_FINISHED:
+ setWorking(false);
+ setFinished(true, ok, msg);
+ break;
+ }
+
+ mStatus = status;
}
// virtual
void LLFloaterSnapshotBase::ImplBase::setNeedRefresh(bool need)
{
- if (!mFloater) return;
+ if (!mFloater) return;
- // Don't display the "Refresh to save" message if we're in auto-refresh mode.
- if (gSavedSettings.getBOOL("AutoSnapshot"))
- {
- need = false;
- }
+ // Don't display the "Refresh to save" message if we're in auto-refresh mode.
+ if (gSavedSettings.getBOOL("AutoSnapshot"))
+ {
+ need = false;
+ }
- mFloater->setRefreshLabelVisible(need);
- mNeedRefresh = need;
+ mFloater->setRefreshLabelVisible(need);
+ mNeedRefresh = need;
}
// virtual
void LLFloaterSnapshotBase::ImplBase::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail)
{
- if (previewp)
- {
- BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot");
- LL_DEBUGS() << "updating " << (autosnap ? "snapshot" : "thumbnail") << LL_ENDL;
- previewp->updateSnapshot(autosnap, update_thumbnail, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f);
- }
+ if (previewp)
+ {
+ BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot");
+ LL_DEBUGS() << "updating " << (autosnap ? "snapshot" : "thumbnail") << LL_ENDL;
+ previewp->updateSnapshot(autosnap, update_thumbnail, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f);
+ }
}
// static
void LLFloaterSnapshotBase::ImplBase::onClickNewSnapshot(void* data)
{
- LLFloaterSnapshotBase* floater = (LLFloaterSnapshotBase *)data;
- LLSnapshotLivePreview* previewp = floater->getPreviewView();
- if (previewp)
- {
- floater->impl->setStatus(ImplBase::STATUS_READY);
- LL_DEBUGS() << "updating snapshot" << LL_ENDL;
- previewp->mForceUpdateSnapshot = TRUE;
- }
+ LLFloaterSnapshotBase* floater = (LLFloaterSnapshotBase *)data;
+ LLSnapshotLivePreview* previewp = floater->getPreviewView();
+ if (previewp)
+ {
+ floater->impl->setStatus(ImplBase::STATUS_READY);
+ LL_DEBUGS() << "updating snapshot" << LL_ENDL;
+ previewp->mForceUpdateSnapshot = TRUE;
+ }
}
// static
void LLFloaterSnapshotBase::ImplBase::onClickAutoSnap(LLUICtrl *ctrl, void* data)
{
- LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
- gSavedSettings.setBOOL( "AutoSnapshot", check->get() );
+ LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
+ gSavedSettings.setBOOL( "AutoSnapshot", check->get() );
- LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;
- if (view)
- {
- view->impl->checkAutoSnapshot(view->getPreviewView());
- view->impl->updateControls(view);
- }
+ LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;
+ if (view)
+ {
+ view->impl->checkAutoSnapshot(view->getPreviewView());
+ view->impl->updateControls(view);
+ }
}
// static
@@ -484,457 +484,457 @@ void LLFloaterSnapshotBase::ImplBase::onClickNoPost(LLUICtrl *ctrl, void* data)
// static
void LLFloaterSnapshotBase::ImplBase::onClickFilter(LLUICtrl *ctrl, void* data)
{
- LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;
- if (view)
- {
- view->impl->updateControls(view);
- LLSnapshotLivePreview* previewp = view->getPreviewView();
+ LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;
+ if (view)
+ {
+ view->impl->updateControls(view);
+ LLSnapshotLivePreview* previewp = view->getPreviewView();
if (previewp)
{
- view->impl->checkAutoSnapshot(previewp);
+ view->impl->checkAutoSnapshot(previewp);
// Note : index 0 of the filter drop down is assumed to be "No filter" in whichever locale
LLComboBox* filterbox = static_cast<LLComboBox *>(view->getChild<LLComboBox>("filters_combobox"));
std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : "");
previewp->setFilter(filter_name);
previewp->updateSnapshot(TRUE);
}
- }
+ }
}
// static
void LLFloaterSnapshotBase::ImplBase::onClickUICheck(LLUICtrl *ctrl, void* data)
{
- LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
- gSavedSettings.setBOOL( "RenderUIInSnapshot", check->get() );
-
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
- if (view)
- {
- LLSnapshotLivePreview* previewp = view->getPreviewView();
- if(previewp)
- {
- previewp->updateSnapshot(TRUE, TRUE);
- }
- view->impl->updateControls(view);
- }
+ LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
+ gSavedSettings.setBOOL( "RenderUIInSnapshot", check->get() );
+
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+ if (view)
+ {
+ LLSnapshotLivePreview* previewp = view->getPreviewView();
+ if(previewp)
+ {
+ previewp->updateSnapshot(TRUE, TRUE);
+ }
+ view->impl->updateControls(view);
+ }
}
// static
void LLFloaterSnapshotBase::ImplBase::onClickHUDCheck(LLUICtrl *ctrl, void* data)
{
- LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
- gSavedSettings.setBOOL( "RenderHUDInSnapshot", check->get() );
-
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
- if (view)
- {
- LLSnapshotLivePreview* previewp = view->getPreviewView();
- if(previewp)
- {
- previewp->updateSnapshot(TRUE, TRUE);
- }
- view->impl->updateControls(view);
- }
+ LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
+ gSavedSettings.setBOOL( "RenderHUDInSnapshot", check->get() );
+
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+ if (view)
+ {
+ LLSnapshotLivePreview* previewp = view->getPreviewView();
+ if(previewp)
+ {
+ previewp->updateSnapshot(TRUE, TRUE);
+ }
+ view->impl->updateControls(view);
+ }
}
void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshotBase* view, BOOL checked)
{
- gSavedSettings.setBOOL("KeepAspectForSnapshot", checked);
+ gSavedSettings.setBOOL("KeepAspectForSnapshot", checked);
- if (view)
- {
- LLPanelSnapshot* active_panel = getActivePanel(view);
- if (checked && active_panel)
- {
- LLComboBox* combo = view->getChild<LLComboBox>(active_panel->getImageSizeComboName());
- combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index
- }
+ if (view)
+ {
+ LLPanelSnapshot* active_panel = getActivePanel(view);
+ if (checked && active_panel)
+ {
+ LLComboBox* combo = view->getChild<LLComboBox>(active_panel->getImageSizeComboName());
+ combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index
+ }
- LLSnapshotLivePreview* previewp = getPreviewView() ;
- if(previewp)
- {
- previewp->mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ;
+ LLSnapshotLivePreview* previewp = getPreviewView() ;
+ if(previewp)
+ {
+ previewp->mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ;
- S32 w, h ;
- previewp->getSize(w, h) ;
- updateSpinners(view, previewp, w, h, TRUE); // may change w and h
+ S32 w, h ;
+ previewp->getSize(w, h) ;
+ updateSpinners(view, previewp, w, h, TRUE); // may change w and h
- LL_DEBUGS() << "updating thumbnail" << LL_ENDL;
- previewp->setSize(w, h) ;
- previewp->updateSnapshot(TRUE);
- checkAutoSnapshot(previewp, TRUE);
- }
- }
+ LL_DEBUGS() << "updating thumbnail" << LL_ENDL;
+ previewp->setSize(w, h) ;
+ previewp->updateSnapshot(TRUE);
+ checkAutoSnapshot(previewp, TRUE);
+ }
+ }
}
// static
void LLFloaterSnapshotBase::ImplBase::onCommitFreezeFrame(LLUICtrl* ctrl, void* data)
{
- LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
- LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;
- LLSnapshotLivePreview* previewp = view->getPreviewView();
-
- if (!view || !check_box || !previewp)
- {
- return;
- }
+ LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
+ LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;
+ LLSnapshotLivePreview* previewp = view->getPreviewView();
+
+ if (!view || !check_box || !previewp)
+ {
+ return;
+ }
- gSavedSettings.setBOOL("UseFreezeFrame", check_box->get());
+ gSavedSettings.setBOOL("UseFreezeFrame", check_box->get());
- if (check_box->get())
- {
- previewp->prepareFreezeFrame();
- }
+ if (check_box->get())
+ {
+ previewp->prepareFreezeFrame();
+ }
- view->impl->updateLayout(view);
+ view->impl->updateLayout(view);
}
void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshotBase *view, S32 index)
{
- LLSnapshotLivePreview *previewp = getPreviewView() ;
-
- // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here
- if (LLSnapshotModel::SNAPSHOT_TEXTURE == getActiveSnapshotType(view))
- {
- previewp->mKeepAspectRatio = FALSE ;
- return ;
- }
-
- BOOL keep_aspect = FALSE, enable_cb = FALSE;
-
- if (0 == index) // current window size
- {
- enable_cb = FALSE;
- keep_aspect = TRUE;
- }
- else if (-1 == index) // custom
- {
- enable_cb = TRUE;
- keep_aspect = gSavedSettings.getBOOL("KeepAspectForSnapshot");
- }
- else // predefined resolution
- {
- enable_cb = FALSE;
- keep_aspect = FALSE;
- }
-
- view->impl->mAspectRatioCheckOff = !enable_cb;
-
- if (previewp)
- {
- previewp->mKeepAspectRatio = keep_aspect;
- }
+ LLSnapshotLivePreview *previewp = getPreviewView() ;
+
+ // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here
+ if (LLSnapshotModel::SNAPSHOT_TEXTURE == getActiveSnapshotType(view))
+ {
+ previewp->mKeepAspectRatio = FALSE ;
+ return ;
+ }
+
+ BOOL keep_aspect = FALSE, enable_cb = FALSE;
+
+ if (0 == index) // current window size
+ {
+ enable_cb = FALSE;
+ keep_aspect = TRUE;
+ }
+ else if (-1 == index) // custom
+ {
+ enable_cb = TRUE;
+ keep_aspect = gSavedSettings.getBOOL("KeepAspectForSnapshot");
+ }
+ else // predefined resolution
+ {
+ enable_cb = FALSE;
+ keep_aspect = FALSE;
+ }
+
+ view->impl->mAspectRatioCheckOff = !enable_cb;
+
+ if (previewp)
+ {
+ previewp->mKeepAspectRatio = keep_aspect;
+ }
}
// Show/hide upload progress indicators.
void LLFloaterSnapshotBase::ImplBase::setWorking(bool working)
{
- LLUICtrl* working_lbl = mFloater->getChild<LLUICtrl>("working_lbl");
- working_lbl->setVisible(working);
- mFloater->getChild<LLUICtrl>("working_indicator")->setVisible(working);
+ LLUICtrl* working_lbl = mFloater->getChild<LLUICtrl>("working_lbl");
+ working_lbl->setVisible(working);
+ mFloater->getChild<LLUICtrl>("working_indicator")->setVisible(working);
- if (working)
- {
- const std::string panel_name = getActivePanel(mFloater, false)->getName();
- const std::string prefix = panel_name.substr(getSnapshotPanelPrefix().size());
- std::string progress_text = mFloater->getString(prefix + "_" + "progress_str");
- working_lbl->setValue(progress_text);
- }
+ if (working)
+ {
+ const std::string panel_name = getActivePanel(mFloater, false)->getName();
+ const std::string prefix = panel_name.substr(getSnapshotPanelPrefix().size());
+ std::string progress_text = mFloater->getString(prefix + "_" + "progress_str");
+ working_lbl->setValue(progress_text);
+ }
- // All controls should be disabled while posting.
- mFloater->setCtrlsEnabled(!working);
- LLPanelSnapshot* active_panel = getActivePanel(mFloater);
- if (active_panel)
- {
- active_panel->enableControls(!working);
- }
+ // All controls should be disabled while posting.
+ mFloater->setCtrlsEnabled(!working);
+ LLPanelSnapshot* active_panel = getActivePanel(mFloater);
+ if (active_panel)
+ {
+ active_panel->enableControls(!working);
+ }
}
//virtual
std::string LLFloaterSnapshot::Impl::getSnapshotPanelPrefix()
{
- return "panel_snapshot_";
+ return "panel_snapshot_";
}
// Show/hide upload status message.
// virtual
void LLFloaterSnapshot::Impl::setFinished(bool finished, bool ok, const std::string& msg)
{
- mFloater->setSuccessLabelPanelVisible(finished && ok);
- mFloater->setFailureLabelPanelVisible(finished && !ok);
+ mFloater->setSuccessLabelPanelVisible(finished && ok);
+ mFloater->setFailureLabelPanelVisible(finished && !ok);
- if (finished)
- {
- LLUICtrl* finished_lbl = mFloater->getChild<LLUICtrl>(ok ? "succeeded_lbl" : "failed_lbl");
- std::string result_text = mFloater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str"));
- finished_lbl->setValue(result_text);
- }
+ if (finished)
+ {
+ LLUICtrl* finished_lbl = mFloater->getChild<LLUICtrl>(ok ? "succeeded_lbl" : "failed_lbl");
+ std::string result_text = mFloater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str"));
+ finished_lbl->setValue(result_text);
+ }
}
// Apply a new resolution selected from the given combobox.
void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update)
{
- LLComboBox* combobox = (LLComboBox*)ctrl;
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
-
- if (!view || !combobox)
- {
- llassert(view && combobox);
- return;
- }
-
- std::string sdstring = combobox->getSelectedValue();
- LLSD sdres;
- std::stringstream sstream(sdstring);
- LLSDSerialize::fromNotation(sdres, sstream, sdstring.size());
-
- S32 width = sdres[0];
- S32 height = sdres[1];
-
- LLSnapshotLivePreview* previewp = getPreviewView();
- if (previewp && combobox->getCurrentIndex() >= 0)
- {
- S32 original_width = 0 , original_height = 0 ;
- previewp->getSize(original_width, original_height) ;
-
- if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot"))
- { //clamp snapshot resolution to window size when showing UI or HUD in snapshot
- width = llmin(width, gViewerWindow->getWindowWidthRaw());
- height = llmin(height, gViewerWindow->getWindowHeightRaw());
- }
-
- if (width == 0 || height == 0)
- {
- // take resolution from current window size
- LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL;
- previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
- }
- else if (width == -1 || height == -1)
- {
- // load last custom value
- S32 new_width = 0, new_height = 0;
- LLPanelSnapshot* spanel = getActivePanel(view);
- if (spanel)
- {
- LL_DEBUGS() << "Loading typed res from panel " << spanel->getName() << LL_ENDL;
- new_width = spanel->getTypedPreviewWidth();
- new_height = spanel->getTypedPreviewHeight();
-
- // Limit custom size for inventory snapshots to 512x512 px.
- if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)
- {
- new_width = llmin(new_width, MAX_TEXTURE_SIZE);
- new_height = llmin(new_height, MAX_TEXTURE_SIZE);
- }
- }
- else
- {
- LL_DEBUGS() << "No custom res chosen, setting preview res from window: "
- << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL;
- new_width = gViewerWindow->getWindowWidthRaw();
- new_height = gViewerWindow->getWindowHeightRaw();
- }
-
- llassert(new_width > 0 && new_height > 0);
- previewp->setSize(new_width, new_height);
- }
- else
- {
- // use the resolution from the selected pre-canned drop-down choice
- LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL;
- previewp->setSize(width, height);
- }
-
- checkAspectRatio(view, width) ;
-
- previewp->getSize(width, height);
-
- // We use the height spinner here because we come here via the aspect ratio
- // checkbox as well and we want height always changing to width by default.
- // If we use the width spinner we would change width according to height by
- // default, that is not what we want.
- updateSpinners(view, previewp, width, height, !getHeightSpinner(view)->isDirty()); // may change width and height
-
- if(getWidthSpinner(view)->getValue().asInteger() != width || getHeightSpinner(view)->getValue().asInteger() != height)
- {
- getWidthSpinner(view)->setValue(width);
- getHeightSpinner(view)->setValue(height);
- if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)
- {
- getWidthSpinner(view)->setIncrement(width >> 1);
- getHeightSpinner(view)->setIncrement(height >> 1);
- }
- }
-
- if(original_width != width || original_height != height)
- {
- previewp->setSize(width, height);
-
- // hide old preview as the aspect ratio could be wrong
- checkAutoSnapshot(previewp, FALSE);
- LL_DEBUGS() << "updating thumbnail" << LL_ENDL;
- // Don't update immediately, give window chance to redraw
- getPreviewView()->updateSnapshot(TRUE, FALSE, 1.f);
- if(do_update)
- {
- LL_DEBUGS() << "Will update controls" << LL_ENDL;
- updateControls(view);
- }
- }
- }
+ LLComboBox* combobox = (LLComboBox*)ctrl;
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+
+ if (!view || !combobox)
+ {
+ llassert(view && combobox);
+ return;
+ }
+
+ std::string sdstring = combobox->getSelectedValue();
+ LLSD sdres;
+ std::stringstream sstream(sdstring);
+ LLSDSerialize::fromNotation(sdres, sstream, sdstring.size());
+
+ S32 width = sdres[0];
+ S32 height = sdres[1];
+
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ if (previewp && combobox->getCurrentIndex() >= 0)
+ {
+ S32 original_width = 0 , original_height = 0 ;
+ previewp->getSize(original_width, original_height) ;
+
+ if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot"))
+ { //clamp snapshot resolution to window size when showing UI or HUD in snapshot
+ width = llmin(width, gViewerWindow->getWindowWidthRaw());
+ height = llmin(height, gViewerWindow->getWindowHeightRaw());
+ }
+
+ if (width == 0 || height == 0)
+ {
+ // take resolution from current window size
+ LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL;
+ previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
+ }
+ else if (width == -1 || height == -1)
+ {
+ // load last custom value
+ S32 new_width = 0, new_height = 0;
+ LLPanelSnapshot* spanel = getActivePanel(view);
+ if (spanel)
+ {
+ LL_DEBUGS() << "Loading typed res from panel " << spanel->getName() << LL_ENDL;
+ new_width = spanel->getTypedPreviewWidth();
+ new_height = spanel->getTypedPreviewHeight();
+
+ // Limit custom size for inventory snapshots to 512x512 px.
+ if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)
+ {
+ new_width = llmin(new_width, MAX_TEXTURE_SIZE);
+ new_height = llmin(new_height, MAX_TEXTURE_SIZE);
+ }
+ }
+ else
+ {
+ LL_DEBUGS() << "No custom res chosen, setting preview res from window: "
+ << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL;
+ new_width = gViewerWindow->getWindowWidthRaw();
+ new_height = gViewerWindow->getWindowHeightRaw();
+ }
+
+ llassert(new_width > 0 && new_height > 0);
+ previewp->setSize(new_width, new_height);
+ }
+ else
+ {
+ // use the resolution from the selected pre-canned drop-down choice
+ LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL;
+ previewp->setSize(width, height);
+ }
+
+ checkAspectRatio(view, width) ;
+
+ previewp->getSize(width, height);
+
+ // We use the height spinner here because we come here via the aspect ratio
+ // checkbox as well and we want height always changing to width by default.
+ // If we use the width spinner we would change width according to height by
+ // default, that is not what we want.
+ updateSpinners(view, previewp, width, height, !getHeightSpinner(view)->isDirty()); // may change width and height
+
+ if(getWidthSpinner(view)->getValue().asInteger() != width || getHeightSpinner(view)->getValue().asInteger() != height)
+ {
+ getWidthSpinner(view)->setValue(width);
+ getHeightSpinner(view)->setValue(height);
+ if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)
+ {
+ getWidthSpinner(view)->setIncrement(width >> 1);
+ getHeightSpinner(view)->setIncrement(height >> 1);
+ }
+ }
+
+ if(original_width != width || original_height != height)
+ {
+ previewp->setSize(width, height);
+
+ // hide old preview as the aspect ratio could be wrong
+ checkAutoSnapshot(previewp, FALSE);
+ LL_DEBUGS() << "updating thumbnail" << LL_ENDL;
+ // Don't update immediately, give window chance to redraw
+ getPreviewView()->updateSnapshot(TRUE, FALSE, 1.f);
+ if(do_update)
+ {
+ LL_DEBUGS() << "Will update controls" << LL_ENDL;
+ updateControls(view);
+ }
+ }
+ }
}
// static
void LLFloaterSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data)
{
- LLComboBox* combobox = (LLComboBox*)ctrl;
+ LLComboBox* combobox = (LLComboBox*)ctrl;
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
-
- if (view)
- {
- LLSnapshotLivePreview* previewp = view->getPreviewView();
- if (previewp)
- {
- previewp->setSnapshotBufferType((LLSnapshotModel::ESnapshotLayerType)combobox->getCurrentIndex());
- }
- view->impl->checkAutoSnapshot(previewp, TRUE);
- previewp->updateSnapshot(TRUE, TRUE);
- }
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+
+ if (view)
+ {
+ LLSnapshotLivePreview* previewp = view->getPreviewView();
+ if (previewp)
+ {
+ previewp->setSnapshotBufferType((LLSnapshotModel::ESnapshotLayerType)combobox->getCurrentIndex());
+ }
+ view->impl->checkAutoSnapshot(previewp, TRUE);
+ previewp->updateSnapshot(TRUE, TRUE);
+ }
}
void LLFloaterSnapshot::Impl::onImageQualityChange(LLFloaterSnapshotBase* view, S32 quality_val)
{
- LLSnapshotLivePreview* previewp = getPreviewView();
- if (previewp)
- {
- previewp->setSnapshotQuality(quality_val);
- }
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ if (previewp)
+ {
+ previewp->setSnapshotQuality(quality_val);
+ }
}
void LLFloaterSnapshot::Impl::onImageFormatChange(LLFloaterSnapshotBase* view)
{
- if (view)
- {
- gSavedSettings.setS32("SnapshotFormat", getImageFormat(view));
- LL_DEBUGS() << "image format changed, updating snapshot" << LL_ENDL;
- getPreviewView()->updateSnapshot(TRUE);
- updateControls(view);
- }
+ if (view)
+ {
+ gSavedSettings.setS32("SnapshotFormat", getImageFormat(view));
+ LL_DEBUGS() << "image format changed, updating snapshot" << LL_ENDL;
+ getPreviewView()->updateSnapshot(TRUE);
+ updateControls(view);
+ }
}
// Sets the named size combo to "custom" mode.
void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshotBase* floater, const std::string& comboname)
{
- LLComboBox* combo = floater->getChild<LLComboBox>(comboname);
- combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index
- checkAspectRatio(floater, -1); // -1 means custom
+ LLComboBox* combo = floater->getChild<LLComboBox>(comboname);
+ combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index
+ checkAspectRatio(floater, -1); // -1 means custom
}
// Update supplied width and height according to the constrain proportions flag; limit them by max_val.
BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)
{
- S32 w = width ;
- S32 h = height ;
-
- if(previewp && previewp->mKeepAspectRatio)
- {
- if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1)
- {
- return FALSE ;
- }
-
- //aspect ratio of the current window
- F32 aspect_ratio = (F32)gViewerWindow->getWindowWidthRaw() / gViewerWindow->getWindowHeightRaw() ;
-
- //change another value proportionally
- if(isWidthChanged)
- {
- height = ll_round(width / aspect_ratio) ;
- }
- else
- {
- width = ll_round(height * aspect_ratio) ;
- }
-
- //bound w/h by the max_value
- if(width > max_value || height > max_value)
- {
- if(width > height)
- {
- width = max_value ;
- height = (S32)(width / aspect_ratio) ;
- }
- else
- {
- height = max_value ;
- width = (S32)(height * aspect_ratio) ;
- }
- }
- }
-
- return (w != width || h != height) ;
+ S32 w = width ;
+ S32 h = height ;
+
+ if(previewp && previewp->mKeepAspectRatio)
+ {
+ if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1)
+ {
+ return FALSE ;
+ }
+
+ //aspect ratio of the current window
+ F32 aspect_ratio = (F32)gViewerWindow->getWindowWidthRaw() / gViewerWindow->getWindowHeightRaw() ;
+
+ //change another value proportionally
+ if(isWidthChanged)
+ {
+ height = ll_round(width / aspect_ratio) ;
+ }
+ else
+ {
+ width = ll_round(height * aspect_ratio) ;
+ }
+
+ //bound w/h by the max_value
+ if(width > max_value || height > max_value)
+ {
+ if(width > height)
+ {
+ width = max_value ;
+ height = (S32)(width / aspect_ratio) ;
+ }
+ else
+ {
+ height = max_value ;
+ width = (S32)(height * aspect_ratio) ;
+ }
+ }
+ }
+
+ return (w != width || h != height) ;
}
void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshotBase* view, S32 width, S32 height)
{
- getWidthSpinner(view)->forceSetValue(width);
- getHeightSpinner(view)->forceSetValue(height);
- if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)
- {
- getWidthSpinner(view)->setIncrement(width >> 1);
- getHeightSpinner(view)->setIncrement(height >> 1);
- }
+ getWidthSpinner(view)->forceSetValue(width);
+ getHeightSpinner(view)->forceSetValue(height);
+ if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)
+ {
+ getWidthSpinner(view)->setIncrement(width >> 1);
+ getHeightSpinner(view)->setIncrement(height >> 1);
+ }
}
void LLFloaterSnapshot::Impl::updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed)
{
- getWidthSpinner(view)->resetDirty();
- getHeightSpinner(view)->resetDirty();
- if (checkImageSize(previewp, width, height, is_width_changed, previewp->getMaxImageSize()))
- {
- setImageSizeSpinnersValues(view, width, height);
- }
+ getWidthSpinner(view)->resetDirty();
+ getHeightSpinner(view)->resetDirty();
+ if (checkImageSize(previewp, width, height, is_width_changed, previewp->getMaxImageSize()))
+ {
+ setImageSizeSpinnersValues(view, width, height);
+ }
}
void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshotBase* view, S32 w, S32 h)
{
- LL_DEBUGS() << "applyCustomResolution(" << w << ", " << h << ")" << LL_ENDL;
- if (!view) return;
-
- LLSnapshotLivePreview* previewp = getPreviewView();
- if (previewp)
- {
- S32 curw,curh;
- previewp->getSize(curw, curh);
+ LL_DEBUGS() << "applyCustomResolution(" << w << ", " << h << ")" << LL_ENDL;
+ if (!view) return;
- if (w != curw || h != curh)
- {
- //if to upload a snapshot, process spinner input in a special way.
- previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ;
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ if (previewp)
+ {
+ S32 curw,curh;
+ previewp->getSize(curw, curh);
- previewp->setSize(w,h);
- checkAutoSnapshot(previewp, FALSE);
- comboSetCustom(view, "profile_size_combo");
- comboSetCustom(view, "postcard_size_combo");
- comboSetCustom(view, "texture_size_combo");
- comboSetCustom(view, "local_size_combo");
- LL_DEBUGS() << "applied custom resolution, updating thumbnail" << LL_ENDL;
- previewp->updateSnapshot(TRUE);
- }
- }
+ if (w != curw || h != curh)
+ {
+ //if to upload a snapshot, process spinner input in a special way.
+ previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ;
+
+ previewp->setSize(w,h);
+ checkAutoSnapshot(previewp, FALSE);
+ comboSetCustom(view, "profile_size_combo");
+ comboSetCustom(view, "postcard_size_combo");
+ comboSetCustom(view, "texture_size_combo");
+ comboSetCustom(view, "local_size_combo");
+ LL_DEBUGS() << "applied custom resolution, updating thumbnail" << LL_ENDL;
+ previewp->updateSnapshot(TRUE);
+ }
+ }
}
// static
void LLFloaterSnapshot::Impl::onSnapshotUploadFinished(LLFloaterSnapshotBase* floater, bool status)
{
- floater->impl->setStatus(STATUS_FINISHED, status, "profile");
+ floater->impl->setStatus(STATUS_FINISHED, status, "profile");
}
// static
void LLFloaterSnapshot::Impl::onSendingPostcardFinished(LLFloaterSnapshotBase* floater, bool status)
{
- floater->impl->setStatus(STATUS_FINISHED, status, "postcard");
+ floater->impl->setStatus(STATUS_FINISHED, status, "postcard");
}
///----------------------------------------------------------------------------
@@ -944,26 +944,26 @@ void LLFloaterSnapshot::Impl::onSendingPostcardFinished(LLFloaterSnapshotBase* f
// Default constructor
LLFloaterSnapshotBase::LLFloaterSnapshotBase(const LLSD& key)
: LLFloater(key),
- mRefreshBtn(NULL),
- mRefreshLabel(NULL),
- mSucceessLblPanel(NULL),
- mFailureLblPanel(NULL)
+ mRefreshBtn(NULL),
+ mRefreshLabel(NULL),
+ mSucceessLblPanel(NULL),
+ mFailureLblPanel(NULL)
{
}
LLFloaterSnapshotBase::~LLFloaterSnapshotBase()
{
- if (impl->mPreviewHandle.get()) impl->mPreviewHandle.get()->die();
+ if (impl->mPreviewHandle.get()) impl->mPreviewHandle.get()->die();
- //unfreeze everything else
- gSavedSettings.setBOOL("FreezeTime", FALSE);
+ //unfreeze everything else
+ gSavedSettings.setBOOL("FreezeTime", FALSE);
- if (impl->mLastToolset)
- {
- LLToolMgr::getInstance()->setCurrentToolset(impl->mLastToolset);
- }
+ if (impl->mLastToolset)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(impl->mLastToolset);
+ }
- delete impl;
+ delete impl;
}
///----------------------------------------------------------------------------
@@ -974,7 +974,7 @@ LLFloaterSnapshotBase::~LLFloaterSnapshotBase()
LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key)
: LLFloaterSnapshotBase(key)
{
- impl = new Impl(this);
+ impl = new Impl(this);
}
LLFloaterSnapshot::~LLFloaterSnapshot()
@@ -984,29 +984,29 @@ LLFloaterSnapshot::~LLFloaterSnapshot()
// virtual
BOOL LLFloaterSnapshot::postBuild()
{
- mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");
- childSetAction("new_snapshot_btn", ImplBase::onClickNewSnapshot, this);
- mRefreshLabel = getChild<LLUICtrl>("refresh_lbl");
- mSucceessLblPanel = getChild<LLUICtrl>("succeeded_panel");
- mFailureLblPanel = getChild<LLUICtrl>("failed_panel");
+ mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");
+ childSetAction("new_snapshot_btn", ImplBase::onClickNewSnapshot, this);
+ mRefreshLabel = getChild<LLUICtrl>("refresh_lbl");
+ mSucceessLblPanel = getChild<LLUICtrl>("succeeded_panel");
+ mFailureLblPanel = getChild<LLUICtrl>("failed_panel");
- childSetCommitCallback("ui_check", ImplBase::onClickUICheck, this);
- getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot"));
+ childSetCommitCallback("ui_check", ImplBase::onClickUICheck, this);
+ getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot"));
- childSetCommitCallback("hud_check", ImplBase::onClickHUDCheck, this);
- getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot"));
+ childSetCommitCallback("hud_check", ImplBase::onClickHUDCheck, this);
+ getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot"));
- ((Impl*)impl)->setAspectRatioCheckboxValue(this, gSavedSettings.getBOOL("KeepAspectForSnapshot"));
+ ((Impl*)impl)->setAspectRatioCheckboxValue(this, gSavedSettings.getBOOL("KeepAspectForSnapshot"));
- childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this);
- getChild<LLUICtrl>("layer_types")->setValue("colors");
- getChildView("layer_types")->setEnabled(FALSE);
+ childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this);
+ getChild<LLUICtrl>("layer_types")->setValue("colors");
+ getChildView("layer_types")->setEnabled(FALSE);
- getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame"));
- childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this);
+ getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame"));
+ childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this);
- getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot"));
- childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this);
+ getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot"));
+ childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this);
getChild<LLUICtrl>("no_post_check")->setValue(gSavedSettings.getBOOL("RenderSnapshotNoPost"));
childSetCommitCallback("no_post_check", ImplBase::onClickNoPost, this);
@@ -1018,130 +1018,130 @@ BOOL LLFloaterSnapshot::postBuild()
getChild<LLTextBox>("360_label")->setShowCursorHand(false);
getChild<LLTextBox>("360_label")->setClickedCallback(boost::bind(&LLFloaterSnapshot::on360Snapshot, this));
- // Filters
- LLComboBox* filterbox = getChild<LLComboBox>("filters_combobox");
- std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList();
- for (U32 i = 0; i < filter_list.size(); i++)
- {
- filterbox->add(filter_list[i]);
- }
- childSetCommitCallback("filters_combobox", ImplBase::onClickFilter, this);
-
- LLWebProfile::setImageUploadResultCallback(boost::bind(&Impl::onSnapshotUploadFinished, this, _1));
- LLPostCard::setPostResultCallback(boost::bind(&Impl::onSendingPostcardFinished, this, _1));
-
- mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
-
- // create preview window
- LLRect full_screen_rect = getRootView()->getRect();
- LLSnapshotLivePreview::Params p;
- p.rect(full_screen_rect);
- LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
- LLView* parent_view = gSnapshotFloaterView->getParent();
-
- parent_view->removeChild(gSnapshotFloaterView);
- // make sure preview is below snapshot floater
- parent_view->addChild(previewp);
- parent_view->addChild(gSnapshotFloaterView);
-
- //move snapshot floater to special purpose snapshotfloaterview
- gFloaterView->removeChild(this);
- gSnapshotFloaterView->addChild(this);
-
- // Pre-select "Current Window" resolution.
- getChild<LLComboBox>("profile_size_combo")->selectNthItem(0);
- getChild<LLComboBox>("postcard_size_combo")->selectNthItem(0);
- getChild<LLComboBox>("texture_size_combo")->selectNthItem(0);
- getChild<LLComboBox>("local_size_combo")->selectNthItem(8);
- getChild<LLComboBox>("local_format_combo")->selectNthItem(0);
-
- impl->mPreviewHandle = previewp->getHandle();
- previewp->setContainer(this);
- impl->updateControls(this);
- impl->setAdvanced(gSavedSettings.getBOOL("AdvanceSnapshot"));
- impl->updateLayout(this);
-
+ // Filters
+ LLComboBox* filterbox = getChild<LLComboBox>("filters_combobox");
+ std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList();
+ for (U32 i = 0; i < filter_list.size(); i++)
+ {
+ filterbox->add(filter_list[i]);
+ }
+ childSetCommitCallback("filters_combobox", ImplBase::onClickFilter, this);
- previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect());
+ LLWebProfile::setImageUploadResultCallback(boost::bind(&Impl::onSnapshotUploadFinished, this, _1));
+ LLPostCard::setPostResultCallback(boost::bind(&Impl::onSendingPostcardFinished, this, _1));
- return TRUE;
-}
+ mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
-// virtual
-void LLFloaterSnapshotBase::draw()
-{
- LLSnapshotLivePreview* previewp = getPreviewView();
+ // create preview window
+ LLRect full_screen_rect = getRootView()->getRect();
+ LLSnapshotLivePreview::Params p;
+ p.rect(full_screen_rect);
+ LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
+ LLView* parent_view = gSnapshotFloaterView->getParent();
- if (previewp && (previewp->isSnapshotActive() || previewp->getThumbnailLock()))
- {
- // don't render snapshot window in snapshot, even if "show ui" is turned on
- return;
- }
+ parent_view->removeChild(gSnapshotFloaterView);
+ // make sure preview is below snapshot floater
+ parent_view->addChild(previewp);
+ parent_view->addChild(gSnapshotFloaterView);
- LLFloater::draw();
+ //move snapshot floater to special purpose snapshotfloaterview
+ gFloaterView->removeChild(this);
+ gSnapshotFloaterView->addChild(this);
- if (previewp && !isMinimized() && mThumbnailPlaceholder->getVisible())
- {
- if(previewp->getThumbnailImage())
- {
- bool working = impl->getStatus() == ImplBase::STATUS_WORKING;
- const LLRect& thumbnail_rect = getThumbnailPlaceholderRect();
- const S32 thumbnail_w = previewp->getThumbnailWidth();
- const S32 thumbnail_h = previewp->getThumbnailHeight();
+ // Pre-select "Current Window" resolution.
+ getChild<LLComboBox>("profile_size_combo")->selectNthItem(0);
+ getChild<LLComboBox>("postcard_size_combo")->selectNthItem(0);
+ getChild<LLComboBox>("texture_size_combo")->selectNthItem(0);
+ getChild<LLComboBox>("local_size_combo")->selectNthItem(8);
+ getChild<LLComboBox>("local_format_combo")->selectNthItem(0);
+
+ impl->mPreviewHandle = previewp->getHandle();
+ previewp->setContainer(this);
+ impl->updateControls(this);
+ impl->setAdvanced(gSavedSettings.getBOOL("AdvanceSnapshot"));
+ impl->updateLayout(this);
- // calc preview offset within the preview rect
- const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ;
- const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // preview y pos within the preview rect
- // calc preview offset within the floater rect
- S32 offset_x = thumbnail_rect.mLeft + local_offset_x;
- S32 offset_y = thumbnail_rect.mBottom + local_offset_y;
+ previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect());
+
+ return TRUE;
+}
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- // Apply floater transparency to the texture unless the floater is focused.
- F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
- LLColor4 color = working ? LLColor4::grey4 : LLColor4::white;
- gl_draw_scaled_image(offset_x, offset_y,
- thumbnail_w, thumbnail_h,
- previewp->getThumbnailImage(), color % alpha);
+// virtual
+void LLFloaterSnapshotBase::draw()
+{
+ LLSnapshotLivePreview* previewp = getPreviewView();
- previewp->drawPreviewRect(offset_x, offset_y) ;
+ if (previewp && (previewp->isSnapshotActive() || previewp->getThumbnailLock()))
+ {
+ // don't render snapshot window in snapshot, even if "show ui" is turned on
+ return;
+ }
- gGL.pushUIMatrix();
- LLUI::translate((F32) thumbnail_rect.mLeft, (F32) thumbnail_rect.mBottom);
- mThumbnailPlaceholder->draw();
- gGL.popUIMatrix();
- }
- }
- impl->updateLayout(this);
+ LLFloater::draw();
+
+ if (previewp && !isMinimized() && mThumbnailPlaceholder->getVisible())
+ {
+ if(previewp->getThumbnailImage())
+ {
+ bool working = impl->getStatus() == ImplBase::STATUS_WORKING;
+ const LLRect& thumbnail_rect = getThumbnailPlaceholderRect();
+ const S32 thumbnail_w = previewp->getThumbnailWidth();
+ const S32 thumbnail_h = previewp->getThumbnailHeight();
+
+ // calc preview offset within the preview rect
+ const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ;
+ const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // preview y pos within the preview rect
+
+ // calc preview offset within the floater rect
+ S32 offset_x = thumbnail_rect.mLeft + local_offset_x;
+ S32 offset_y = thumbnail_rect.mBottom + local_offset_y;
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ // Apply floater transparency to the texture unless the floater is focused.
+ F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+ LLColor4 color = working ? LLColor4::grey4 : LLColor4::white;
+ gl_draw_scaled_image(offset_x, offset_y,
+ thumbnail_w, thumbnail_h,
+ previewp->getThumbnailImage(), color % alpha);
+
+ previewp->drawPreviewRect(offset_x, offset_y) ;
+
+ gGL.pushUIMatrix();
+ LLUI::translate((F32) thumbnail_rect.mLeft, (F32) thumbnail_rect.mBottom);
+ mThumbnailPlaceholder->draw();
+ gGL.popUIMatrix();
+ }
+ }
+ impl->updateLayout(this);
}
//virtual
void LLFloaterSnapshot::onOpen(const LLSD& key)
{
- LLSnapshotLivePreview* preview = getPreviewView();
- if(preview)
- {
- LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL;
- preview->setAllowFullScreenPreview(TRUE);
- preview->updateSnapshot(TRUE);
- }
- focusFirstItem(FALSE);
- gSnapshotFloaterView->setEnabled(TRUE);
- gSnapshotFloaterView->setVisible(TRUE);
- gSnapshotFloaterView->adjustToFitScreen(this, FALSE);
+ LLSnapshotLivePreview* preview = getPreviewView();
+ if(preview)
+ {
+ LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL;
+ preview->setAllowFullScreenPreview(TRUE);
+ preview->updateSnapshot(TRUE);
+ }
+ focusFirstItem(FALSE);
+ gSnapshotFloaterView->setEnabled(TRUE);
+ gSnapshotFloaterView->setVisible(TRUE);
+ gSnapshotFloaterView->adjustToFitScreen(this, FALSE);
- impl->updateControls(this);
- impl->setAdvanced(gSavedSettings.getBOOL("AdvanceSnapshot"));
- impl->updateLayout(this);
+ impl->updateControls(this);
+ impl->setAdvanced(gSavedSettings.getBOOL("AdvanceSnapshot"));
+ impl->updateLayout(this);
- // Initialize default tab.
- getChild<LLSideTrayPanelContainer>("panel_container")->getCurrentPanel()->onOpen(LLSD());
+ // Initialize default tab.
+ getChild<LLSideTrayPanelContainer>("panel_container")->getCurrentPanel()->onOpen(LLSD());
}
void LLFloaterSnapshot::onExtendFloater()
{
- impl->setAdvanced(gSavedSettings.getBOOL("AdvanceSnapshot"));
+ impl->setAdvanced(gSavedSettings.getBOOL("AdvanceSnapshot"));
}
void LLFloaterSnapshot::on360Snapshot()
@@ -1153,211 +1153,211 @@ void LLFloaterSnapshot::on360Snapshot()
//virtual
void LLFloaterSnapshotBase::onClose(bool app_quitting)
{
- getParent()->setMouseOpaque(FALSE);
+ getParent()->setMouseOpaque(FALSE);
- //unfreeze everything, hide fullscreen preview
- LLSnapshotLivePreview* previewp = getPreviewView();
- if (previewp)
- {
- previewp->setAllowFullScreenPreview(FALSE);
- previewp->setVisible(FALSE);
- previewp->setEnabled(FALSE);
- }
+ //unfreeze everything, hide fullscreen preview
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ if (previewp)
+ {
+ previewp->setAllowFullScreenPreview(FALSE);
+ previewp->setVisible(FALSE);
+ previewp->setEnabled(FALSE);
+ }
- gSavedSettings.setBOOL("FreezeTime", FALSE);
- impl->mAvatarPauseHandles.clear();
+ gSavedSettings.setBOOL("FreezeTime", FALSE);
+ impl->mAvatarPauseHandles.clear();
- if (impl->mLastToolset)
- {
- LLToolMgr::getInstance()->setCurrentToolset(impl->mLastToolset);
- }
+ if (impl->mLastToolset)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(impl->mLastToolset);
+ }
}
// virtual
S32 LLFloaterSnapshotBase::notify(const LLSD& info)
{
- if (info.has("set-ready"))
- {
- impl->setStatus(ImplBase::STATUS_READY);
- return 1;
- }
-
- if (info.has("set-working"))
- {
- impl->setStatus(ImplBase::STATUS_WORKING);
- return 1;
- }
-
- if (info.has("set-finished"))
- {
- LLSD data = info["set-finished"];
- impl->setStatus(ImplBase::STATUS_FINISHED, data["ok"].asBoolean(), data["msg"].asString());
- return 1;
- }
-
- if (info.has("snapshot-updating"))
- {
- // Disable the send/post/save buttons until snapshot is ready.
- impl->updateControls(this);
- return 1;
- }
-
- if (info.has("snapshot-updated"))
- {
- // Enable the send/post/save buttons.
- impl->updateControls(this);
- // We've just done refresh.
- impl->setNeedRefresh(false);
-
- // The refresh button is initially hidden. We show it after the first update,
- // i.e. when preview appears.
- if (mRefreshBtn && !mRefreshBtn->getVisible())
- {
- mRefreshBtn->setVisible(true);
- }
- return 1;
- }
-
- return 0;
+ if (info.has("set-ready"))
+ {
+ impl->setStatus(ImplBase::STATUS_READY);
+ return 1;
+ }
+
+ if (info.has("set-working"))
+ {
+ impl->setStatus(ImplBase::STATUS_WORKING);
+ return 1;
+ }
+
+ if (info.has("set-finished"))
+ {
+ LLSD data = info["set-finished"];
+ impl->setStatus(ImplBase::STATUS_FINISHED, data["ok"].asBoolean(), data["msg"].asString());
+ return 1;
+ }
+
+ if (info.has("snapshot-updating"))
+ {
+ // Disable the send/post/save buttons until snapshot is ready.
+ impl->updateControls(this);
+ return 1;
+ }
+
+ if (info.has("snapshot-updated"))
+ {
+ // Enable the send/post/save buttons.
+ impl->updateControls(this);
+ // We've just done refresh.
+ impl->setNeedRefresh(false);
+
+ // The refresh button is initially hidden. We show it after the first update,
+ // i.e. when preview appears.
+ if (mRefreshBtn && !mRefreshBtn->getVisible())
+ {
+ mRefreshBtn->setVisible(true);
+ }
+ return 1;
+ }
+
+ return 0;
}
// virtual
S32 LLFloaterSnapshot::notify(const LLSD& info)
{
- bool res = LLFloaterSnapshotBase::notify(info);
- if (res)
- return res;
- // A child panel wants to change snapshot resolution.
- if (info.has("combo-res-change"))
- {
- std::string combo_name = info["combo-res-change"]["control-name"].asString();
- ((Impl*)impl)->updateResolution(getChild<LLUICtrl>(combo_name), this);
- return 1;
- }
-
- if (info.has("custom-res-change"))
- {
- LLSD res = info["custom-res-change"];
- ((Impl*)impl)->applyCustomResolution(this, res["w"].asInteger(), res["h"].asInteger());
- return 1;
- }
-
- if (info.has("keep-aspect-change"))
- {
- ((Impl*)impl)->applyKeepAspectCheck(this, info["keep-aspect-change"].asBoolean());
- return 1;
- }
-
- if (info.has("image-quality-change"))
- {
- ((Impl*)impl)->onImageQualityChange(this, info["image-quality-change"].asInteger());
- return 1;
- }
-
- if (info.has("image-format-change"))
- {
- ((Impl*)impl)->onImageFormatChange(this);
- return 1;
- }
-
- return 0;
+ bool res = LLFloaterSnapshotBase::notify(info);
+ if (res)
+ return res;
+ // A child panel wants to change snapshot resolution.
+ if (info.has("combo-res-change"))
+ {
+ std::string combo_name = info["combo-res-change"]["control-name"].asString();
+ ((Impl*)impl)->updateResolution(getChild<LLUICtrl>(combo_name), this);
+ return 1;
+ }
+
+ if (info.has("custom-res-change"))
+ {
+ LLSD res = info["custom-res-change"];
+ ((Impl*)impl)->applyCustomResolution(this, res["w"].asInteger(), res["h"].asInteger());
+ return 1;
+ }
+
+ if (info.has("keep-aspect-change"))
+ {
+ ((Impl*)impl)->applyKeepAspectCheck(this, info["keep-aspect-change"].asBoolean());
+ return 1;
+ }
+
+ if (info.has("image-quality-change"))
+ {
+ ((Impl*)impl)->onImageQualityChange(this, info["image-quality-change"].asInteger());
+ return 1;
+ }
+
+ if (info.has("image-format-change"))
+ {
+ ((Impl*)impl)->onImageFormatChange(this);
+ return 1;
+ }
+
+ return 0;
}
BOOL LLFloaterSnapshot::isWaitingState()
{
- return (impl->getStatus() == ImplBase::STATUS_WORKING);
+ return (impl->getStatus() == ImplBase::STATUS_WORKING);
}
BOOL LLFloaterSnapshotBase::ImplBase::updatePreviewList(bool initialized)
{
- if (!initialized)
- return FALSE;
+ if (!initialized)
+ return FALSE;
- BOOL changed = FALSE;
- LL_DEBUGS() << "npreviews: " << LLSnapshotLivePreview::sList.size() << LL_ENDL;
- for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin();
- iter != LLSnapshotLivePreview::sList.end(); ++iter)
- {
- changed |= LLSnapshotLivePreview::onIdle(*iter);
- }
- return changed;
+ BOOL changed = FALSE;
+ LL_DEBUGS() << "npreviews: " << LLSnapshotLivePreview::sList.size() << LL_ENDL;
+ for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin();
+ iter != LLSnapshotLivePreview::sList.end(); ++iter)
+ {
+ changed |= LLSnapshotLivePreview::onIdle(*iter);
+ }
+ return changed;
}
void LLFloaterSnapshotBase::ImplBase::updateLivePreview()
{
- if (ImplBase::updatePreviewList(true) && mFloater)
- {
- LL_DEBUGS() << "changed" << LL_ENDL;
- updateControls(mFloater);
- }
+ if (ImplBase::updatePreviewList(true) && mFloater)
+ {
+ LL_DEBUGS() << "changed" << LL_ENDL;
+ updateControls(mFloater);
+ }
}
-//static
+//static
void LLFloaterSnapshot::update()
{
- LLFloaterSnapshot* inst = findInstance();
- if (inst != NULL)
- {
- inst->impl->updateLivePreview();
- }
- else
- {
- ImplBase::updatePreviewList(false);
- }
+ LLFloaterSnapshot* inst = findInstance();
+ if (inst != NULL)
+ {
+ inst->impl->updateLivePreview();
+ }
+ else
+ {
+ ImplBase::updatePreviewList(false);
+ }
}
// static
LLFloaterSnapshot* LLFloaterSnapshot::findInstance()
{
- return LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+ return LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
}
// static
LLFloaterSnapshot* LLFloaterSnapshot::getInstance()
{
- return LLFloaterReg::getTypedInstance<LLFloaterSnapshot>("snapshot");
+ return LLFloaterReg::getTypedInstance<LLFloaterSnapshot>("snapshot");
}
// virtual
void LLFloaterSnapshot::saveTexture()
{
- LL_DEBUGS() << "saveTexture" << LL_ENDL;
+ LL_DEBUGS() << "saveTexture" << LL_ENDL;
- LLSnapshotLivePreview* previewp = getPreviewView();
- if (!previewp)
- {
- llassert(previewp != NULL);
- return;
- }
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ if (!previewp)
+ {
+ llassert(previewp != NULL);
+ return;
+ }
- previewp->saveTexture();
+ previewp->saveTexture();
}
void LLFloaterSnapshot::saveLocal(const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb)
{
- LL_DEBUGS() << "saveLocal" << LL_ENDL;
- LLSnapshotLivePreview* previewp = getPreviewView();
- llassert(previewp != NULL);
- if (previewp)
- {
- previewp->saveLocal(success_cb, failure_cb);
- }
+ LL_DEBUGS() << "saveLocal" << LL_ENDL;
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ llassert(previewp != NULL);
+ if (previewp)
+ {
+ previewp->saveLocal(success_cb, failure_cb);
+ }
}
void LLFloaterSnapshotBase::postSave()
{
- impl->updateControls(this);
- impl->setStatus(ImplBase::STATUS_WORKING);
+ impl->updateControls(this);
+ impl->setStatus(ImplBase::STATUS_WORKING);
}
// virtual
void LLFloaterSnapshotBase::postPanelSwitch()
{
- impl->updateControls(this);
+ impl->updateControls(this);
- // Remove the success/failure indicator whenever user presses a snapshot option button.
- impl->setStatus(ImplBase::STATUS_READY);
+ // Remove the success/failure indicator whenever user presses a snapshot option button.
+ impl->setStatus(ImplBase::STATUS_READY);
}
void LLFloaterSnapshotBase::inventorySaveFailed()
@@ -1368,47 +1368,47 @@ void LLFloaterSnapshotBase::inventorySaveFailed()
LLPointer<LLImageFormatted> LLFloaterSnapshotBase::getImageData()
{
- // FIXME: May not work for textures.
+ // FIXME: May not work for textures.
- LLSnapshotLivePreview* previewp = getPreviewView();
- if (!previewp)
- {
- llassert(previewp != NULL);
- return NULL;
- }
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ if (!previewp)
+ {
+ llassert(previewp != NULL);
+ return NULL;
+ }
- LLPointer<LLImageFormatted> img = previewp->getFormattedImage();
- if (!img.get())
- {
- LL_WARNS() << "Empty snapshot image data" << LL_ENDL;
- llassert(img.get() != NULL);
- }
+ LLPointer<LLImageFormatted> img = previewp->getFormattedImage();
+ if (!img.get())
+ {
+ LL_WARNS() << "Empty snapshot image data" << LL_ENDL;
+ llassert(img.get() != NULL);
+ }
- return img;
+ return img;
}
const LLVector3d& LLFloaterSnapshotBase::getPosTakenGlobal()
{
- LLSnapshotLivePreview* previewp = getPreviewView();
- if (!previewp)
- {
- llassert(previewp != NULL);
- return LLVector3d::zero;
- }
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ if (!previewp)
+ {
+ llassert(previewp != NULL);
+ return LLVector3d::zero;
+ }
- return previewp->getPosTakenGlobal();
+ return previewp->getPosTakenGlobal();
}
// static
void LLFloaterSnapshot::setAgentEmail(const std::string& email)
{
- LLFloaterSnapshot* instance = findInstance();
- if (instance)
- {
- LLSideTrayPanelContainer* panel_container = instance->getChild<LLSideTrayPanelContainer>("panel_container");
- LLPanel* postcard_panel = panel_container->getPanelByName("panel_snapshot_postcard");
- postcard_panel->notify(LLSD().with("agent-email", email));
- }
+ LLFloaterSnapshot* instance = findInstance();
+ if (instance)
+ {
+ LLSideTrayPanelContainer* panel_container = instance->getChild<LLSideTrayPanelContainer>("panel_container");
+ LLPanel* postcard_panel = panel_container->getPanelByName("panel_snapshot_postcard");
+ postcard_panel->notify(LLSD().with("agent-email", email));
+ }
}
///----------------------------------------------------------------------------
@@ -1426,69 +1426,69 @@ LLSnapshotFloaterView::~LLSnapshotFloaterView()
// virtual
BOOL LLSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
{
- // use default handler when not in freeze-frame mode
- if(!gSavedSettings.getBOOL("FreezeTime"))
- {
- return LLFloaterView::handleKey(key, mask, called_from_parent);
- }
-
- if (called_from_parent)
- {
- // pass all keystrokes down
- LLFloaterView::handleKey(key, mask, called_from_parent);
- }
- else
- {
- // bounce keystrokes back down
- LLFloaterView::handleKey(key, mask, TRUE);
- }
- return TRUE;
+ // use default handler when not in freeze-frame mode
+ if(!gSavedSettings.getBOOL("FreezeTime"))
+ {
+ return LLFloaterView::handleKey(key, mask, called_from_parent);
+ }
+
+ if (called_from_parent)
+ {
+ // pass all keystrokes down
+ LLFloaterView::handleKey(key, mask, called_from_parent);
+ }
+ else
+ {
+ // bounce keystrokes back down
+ LLFloaterView::handleKey(key, mask, TRUE);
+ }
+ return TRUE;
}
// virtual
BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask)
{
- // use default handler when not in freeze-frame mode
- if(!gSavedSettings.getBOOL("FreezeTime"))
- {
- return LLFloaterView::handleMouseDown(x, y, mask);
- }
- // give floater a change to handle mouse, else camera tool
- if (childrenHandleMouseDown(x, y, mask) == NULL)
- {
- LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask );
- }
- return TRUE;
+ // use default handler when not in freeze-frame mode
+ if(!gSavedSettings.getBOOL("FreezeTime"))
+ {
+ return LLFloaterView::handleMouseDown(x, y, mask);
+ }
+ // give floater a change to handle mouse, else camera tool
+ if (childrenHandleMouseDown(x, y, mask) == NULL)
+ {
+ LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask );
+ }
+ return TRUE;
}
// virtual
BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask)
{
- // use default handler when not in freeze-frame mode
- if(!gSavedSettings.getBOOL("FreezeTime"))
- {
- return LLFloaterView::handleMouseUp(x, y, mask);
- }
- // give floater a change to handle mouse, else camera tool
- if (childrenHandleMouseUp(x, y, mask) == NULL)
- {
- LLToolMgr::getInstance()->getCurrentTool()->handleMouseUp( x, y, mask );
- }
- return TRUE;
+ // use default handler when not in freeze-frame mode
+ if(!gSavedSettings.getBOOL("FreezeTime"))
+ {
+ return LLFloaterView::handleMouseUp(x, y, mask);
+ }
+ // give floater a change to handle mouse, else camera tool
+ if (childrenHandleMouseUp(x, y, mask) == NULL)
+ {
+ LLToolMgr::getInstance()->getCurrentTool()->handleMouseUp( x, y, mask );
+ }
+ return TRUE;
}
// virtual
BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask)
{
- // use default handler when not in freeze-frame mode
- if(!gSavedSettings.getBOOL("FreezeTime"))
- {
- return LLFloaterView::handleHover(x, y, mask);
- }
- // give floater a change to handle mouse, else camera tool
- if (childrenHandleHover(x, y, mask) == NULL)
- {
- LLToolMgr::getInstance()->getCurrentTool()->handleHover( x, y, mask );
- }
- return TRUE;
+ // use default handler when not in freeze-frame mode
+ if(!gSavedSettings.getBOOL("FreezeTime"))
+ {
+ return LLFloaterView::handleHover(x, y, mask);
+ }
+ // give floater a change to handle mouse, else camera tool
+ if (childrenHandleHover(x, y, mask) == NULL)
+ {
+ LLToolMgr::getInstance()->getCurrentTool()->handleHover( x, y, mask );
+ }
+ return TRUE;
}
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 89cb2bc809..b70d07434a 100644
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatersnapshot.h
* @brief Snapshot preview window, allowing saving, e-mailing, etc.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2016, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,132 +45,132 @@ public:
LLFloaterSnapshotBase(const LLSD& key);
virtual ~LLFloaterSnapshotBase();
- /*virtual*/ void draw();
- /*virtual*/ void onClose(bool app_quitting);
- virtual S32 notify(const LLSD& info);
+ /*virtual*/ void draw();
+ /*virtual*/ void onClose(bool app_quitting);
+ virtual S32 notify(const LLSD& info);
- // TODO: create a snapshot model instead
- virtual void saveTexture() = 0;
- void postSave();
- virtual void postPanelSwitch();
- LLPointer<LLImageFormatted> getImageData();
- LLSnapshotLivePreview* getPreviewView();
- const LLVector3d& getPosTakenGlobal();
+ // TODO: create a snapshot model instead
+ virtual void saveTexture() = 0;
+ void postSave();
+ virtual void postPanelSwitch();
+ LLPointer<LLImageFormatted> getImageData();
+ LLSnapshotLivePreview* getPreviewView();
+ const LLVector3d& getPosTakenGlobal();
- const LLRect& getThumbnailPlaceholderRect() { return mThumbnailPlaceholder->getRect(); }
+ const LLRect& getThumbnailPlaceholderRect() { return mThumbnailPlaceholder->getRect(); }
- void setRefreshLabelVisible(bool value) { if (mRefreshLabel) mRefreshLabel->setVisible(value); }
- void setSuccessLabelPanelVisible(bool value) { if (mSucceessLblPanel) mSucceessLblPanel->setVisible(value); }
- void setFailureLabelPanelVisible(bool value) { if (mFailureLblPanel) mFailureLblPanel->setVisible(value); }
- void inventorySaveFailed();
+ void setRefreshLabelVisible(bool value) { if (mRefreshLabel) mRefreshLabel->setVisible(value); }
+ void setSuccessLabelPanelVisible(bool value) { if (mSucceessLblPanel) mSucceessLblPanel->setVisible(value); }
+ void setFailureLabelPanelVisible(bool value) { if (mFailureLblPanel) mFailureLblPanel->setVisible(value); }
+ void inventorySaveFailed();
- class ImplBase;
- friend class ImplBase;
- ImplBase* impl;
+ class ImplBase;
+ friend class ImplBase;
+ ImplBase* impl;
protected:
- LLUICtrl* mThumbnailPlaceholder;
- LLUICtrl *mRefreshBtn, *mRefreshLabel;
- LLUICtrl *mSucceessLblPanel, *mFailureLblPanel;
+ LLUICtrl* mThumbnailPlaceholder;
+ LLUICtrl *mRefreshBtn, *mRefreshLabel;
+ LLUICtrl *mSucceessLblPanel, *mFailureLblPanel;
};
class LLFloaterSnapshotBase::ImplBase
{
public:
- typedef enum e_status
- {
- STATUS_READY,
- STATUS_WORKING,
- STATUS_FINISHED
- } EStatus;
-
- ImplBase(LLFloaterSnapshotBase* floater) : mAvatarPauseHandles(),
- mLastToolset(NULL),
- mAspectRatioCheckOff(false),
- mNeedRefresh(false),
+ typedef enum e_status
+ {
+ STATUS_READY,
+ STATUS_WORKING,
+ STATUS_FINISHED
+ } EStatus;
+
+ ImplBase(LLFloaterSnapshotBase* floater) : mAvatarPauseHandles(),
+ mLastToolset(NULL),
+ mAspectRatioCheckOff(false),
+ mNeedRefresh(false),
mSkipReshaping(false),
- mStatus(STATUS_READY),
- mFloater(floater)
- {}
- virtual ~ImplBase()
- {
- //unpause avatars
- mAvatarPauseHandles.clear();
- }
-
- static void onClickNewSnapshot(void* data);
- static void onClickAutoSnap(LLUICtrl *ctrl, void* data);
- static void onClickNoPost(LLUICtrl *ctrl, void* data);
- static void onClickFilter(LLUICtrl *ctrl, void* data);
- static void onClickUICheck(LLUICtrl *ctrl, void* data);
- static void onClickHUDCheck(LLUICtrl *ctrl, void* data);
- static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data);
-
- virtual LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true) = 0;
- virtual LLSnapshotModel::ESnapshotType getActiveSnapshotType(LLFloaterSnapshotBase* floater);
- virtual LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater) = 0;
- virtual std::string getSnapshotPanelPrefix() = 0;
-
- LLSnapshotLivePreview* getPreviewView();
- virtual void updateControls(LLFloaterSnapshotBase* floater) = 0;
- virtual void updateLayout(LLFloaterSnapshotBase* floater);
- virtual void updateLivePreview();
- virtual void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null);
- virtual EStatus getStatus() const { return mStatus; }
- virtual void setNeedRefresh(bool need);
-
- static BOOL updatePreviewList(bool initialized);
-
- void setAdvanced(bool advanced) { mAdvanced = advanced; }
+ mStatus(STATUS_READY),
+ mFloater(floater)
+ {}
+ virtual ~ImplBase()
+ {
+ //unpause avatars
+ mAvatarPauseHandles.clear();
+ }
+
+ static void onClickNewSnapshot(void* data);
+ static void onClickAutoSnap(LLUICtrl *ctrl, void* data);
+ static void onClickNoPost(LLUICtrl *ctrl, void* data);
+ static void onClickFilter(LLUICtrl *ctrl, void* data);
+ static void onClickUICheck(LLUICtrl *ctrl, void* data);
+ static void onClickHUDCheck(LLUICtrl *ctrl, void* data);
+ static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data);
+
+ virtual LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true) = 0;
+ virtual LLSnapshotModel::ESnapshotType getActiveSnapshotType(LLFloaterSnapshotBase* floater);
+ virtual LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater) = 0;
+ virtual std::string getSnapshotPanelPrefix() = 0;
+
+ LLSnapshotLivePreview* getPreviewView();
+ virtual void updateControls(LLFloaterSnapshotBase* floater) = 0;
+ virtual void updateLayout(LLFloaterSnapshotBase* floater);
+ virtual void updateLivePreview();
+ virtual void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null);
+ virtual EStatus getStatus() const { return mStatus; }
+ virtual void setNeedRefresh(bool need);
+
+ static BOOL updatePreviewList(bool initialized);
+
+ void setAdvanced(bool advanced) { mAdvanced = advanced; }
void setSkipReshaping(bool skip) { mSkipReshaping = skip; }
- virtual LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater) = 0;
- virtual void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE);
- void setWorking(bool working);
- virtual void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null) = 0;
+ virtual LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater) = 0;
+ virtual void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE);
+ void setWorking(bool working);
+ virtual void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null) = 0;
public:
- LLFloaterSnapshotBase* mFloater;
- std::vector<LLAnimPauseRequest> mAvatarPauseHandles;
-
- LLToolset* mLastToolset;
- LLHandle<LLView> mPreviewHandle;
- bool mAspectRatioCheckOff;
- bool mNeedRefresh;
- bool mAdvanced;
+ LLFloaterSnapshotBase* mFloater;
+ std::vector<LLAnimPauseRequest> mAvatarPauseHandles;
+
+ LLToolset* mLastToolset;
+ LLHandle<LLView> mPreviewHandle;
+ bool mAspectRatioCheckOff;
+ bool mNeedRefresh;
+ bool mAdvanced;
bool mSkipReshaping;
- EStatus mStatus;
+ EStatus mStatus;
};
class LLFloaterSnapshot : public LLFloaterSnapshotBase
{
- LOG_CLASS(LLFloaterSnapshot);
+ LOG_CLASS(LLFloaterSnapshot);
public:
- LLFloaterSnapshot(const LLSD& key);
- /*virtual*/ ~LLFloaterSnapshot();
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ S32 notify(const LLSD& info);
-
- static void update();
-
- void onExtendFloater();
+ LLFloaterSnapshot(const LLSD& key);
+ /*virtual*/ ~LLFloaterSnapshot();
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ S32 notify(const LLSD& info);
+
+ static void update();
+
+ void onExtendFloater();
void on360Snapshot();
- static LLFloaterSnapshot* getInstance();
- static LLFloaterSnapshot* findInstance();
- /*virtual*/ void saveTexture();
+ static LLFloaterSnapshot* getInstance();
+ static LLFloaterSnapshot* findInstance();
+ /*virtual*/ void saveTexture();
- typedef boost::signals2::signal<void(void)> snapshot_saved_signal_t;
- void saveLocal(const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
- static void setAgentEmail(const std::string& email);
+ typedef boost::signals2::signal<void(void)> snapshot_saved_signal_t;
+ void saveLocal(const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
+ static void setAgentEmail(const std::string& email);
- BOOL isWaitingState();
+ BOOL isWaitingState();
- class Impl;
- friend class Impl;
+ class Impl;
+ friend class Impl;
};
///----------------------------------------------------------------------------
@@ -179,63 +179,63 @@ public:
class LLFloaterSnapshot::Impl : public LLFloaterSnapshotBase::ImplBase
{
- LOG_CLASS(LLFloaterSnapshot::Impl);
+ LOG_CLASS(LLFloaterSnapshot::Impl);
public:
- Impl(LLFloaterSnapshotBase* floater)
- : LLFloaterSnapshotBase::ImplBase(floater)
- {}
- ~Impl()
- {}
-
- void applyKeepAspectCheck(LLFloaterSnapshotBase* view, BOOL checked);
- void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE);
- static void onCommitLayerTypes(LLUICtrl* ctrl, void*data);
- void onImageQualityChange(LLFloaterSnapshotBase* view, S32 quality_val);
- void onImageFormatChange(LLFloaterSnapshotBase* view);
- void applyCustomResolution(LLFloaterSnapshotBase* view, S32 w, S32 h);
- static void onSendingPostcardFinished(LLFloaterSnapshotBase* floater, bool status);
- BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);
- void setImageSizeSpinnersValues(LLFloaterSnapshotBase *view, S32 width, S32 height);
- void updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed);
- static void onSnapshotUploadFinished(LLFloaterSnapshotBase* floater, bool status);
-
- /*virtual*/ LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true);
- /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater);
- LLSpinCtrl* getWidthSpinner(LLFloaterSnapshotBase* floater);
- LLSpinCtrl* getHeightSpinner(LLFloaterSnapshotBase* floater);
- void enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, BOOL enable);
- void setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, BOOL checked);
- /*virtual*/ std::string getSnapshotPanelPrefix();
-
- void setResolution(LLFloaterSnapshotBase* floater, const std::string& comboname);
- /*virtual*/ void updateControls(LLFloaterSnapshotBase* floater);
+ Impl(LLFloaterSnapshotBase* floater)
+ : LLFloaterSnapshotBase::ImplBase(floater)
+ {}
+ ~Impl()
+ {}
+
+ void applyKeepAspectCheck(LLFloaterSnapshotBase* view, BOOL checked);
+ void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE);
+ static void onCommitLayerTypes(LLUICtrl* ctrl, void*data);
+ void onImageQualityChange(LLFloaterSnapshotBase* view, S32 quality_val);
+ void onImageFormatChange(LLFloaterSnapshotBase* view);
+ void applyCustomResolution(LLFloaterSnapshotBase* view, S32 w, S32 h);
+ static void onSendingPostcardFinished(LLFloaterSnapshotBase* floater, bool status);
+ BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);
+ void setImageSizeSpinnersValues(LLFloaterSnapshotBase *view, S32 width, S32 height);
+ void updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed);
+ static void onSnapshotUploadFinished(LLFloaterSnapshotBase* floater, bool status);
+
+ /*virtual*/ LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true);
+ /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater);
+ LLSpinCtrl* getWidthSpinner(LLFloaterSnapshotBase* floater);
+ LLSpinCtrl* getHeightSpinner(LLFloaterSnapshotBase* floater);
+ void enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, BOOL enable);
+ void setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, BOOL checked);
+ /*virtual*/ std::string getSnapshotPanelPrefix();
+
+ void setResolution(LLFloaterSnapshotBase* floater, const std::string& comboname);
+ /*virtual*/ void updateControls(LLFloaterSnapshotBase* floater);
private:
- /*virtual*/ LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater);
- void comboSetCustom(LLFloaterSnapshotBase *floater, const std::string& comboname);
- void checkAspectRatio(LLFloaterSnapshotBase *view, S32 index);
- void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null);
+ /*virtual*/ LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater);
+ void comboSetCustom(LLFloaterSnapshotBase *floater, const std::string& comboname);
+ void checkAspectRatio(LLFloaterSnapshotBase *view, S32 index);
+ void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null);
};
class LLSnapshotFloaterView : public LLFloaterView
{
public:
- struct Params
- : public LLInitParam::Block<Params, LLFloaterView::Params>
- {
- };
+ struct Params
+ : public LLInitParam::Block<Params, LLFloaterView::Params>
+ {
+ };
protected:
- LLSnapshotFloaterView (const Params& p);
- friend class LLUICtrlFactory;
+ LLSnapshotFloaterView (const Params& p);
+ friend class LLUICtrlFactory;
public:
- virtual ~LLSnapshotFloaterView();
+ virtual ~LLSnapshotFloaterView();
- /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
};
extern LLSnapshotFloaterView* gSnapshotFloaterView;
diff --git a/indra/newview/llfloatersounddevices.cpp b/indra/newview/llfloatersounddevices.cpp
index 72c077d215..a5064fa53d 100644
--- a/indra/newview/llfloatersounddevices.cpp
+++ b/indra/newview/llfloatersounddevices.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatersounddevices.cpp
* @author Leyla Farazha
* @brief Sound Preferences used for minimal skin
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,50 +37,50 @@
// protected
LLFloaterSoundDevices::LLFloaterSoundDevices(const LLSD& key)
-: LLTransientDockableFloater(NULL, false, key)
+: LLTransientDockableFloater(NULL, false, key)
{
- LLTransientFloaterMgr::getInstance()->addControlView(this);
+ LLTransientFloaterMgr::getInstance()->addControlView(this);
- // force docked state since this floater doesn't save it between recreations
- setDocked(true);
+ // force docked state since this floater doesn't save it between recreations
+ setDocked(true);
}
LLFloaterSoundDevices::~LLFloaterSoundDevices()
{
- LLTransientFloaterMgr::getInstance()->removeControlView(this);
+ LLTransientFloaterMgr::getInstance()->removeControlView(this);
}
// virtual
BOOL LLFloaterSoundDevices::postBuild()
{
- LLTransientDockableFloater::postBuild();
+ LLTransientDockableFloater::postBuild();
- updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
+ updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
- LLPanelVoiceDeviceSettings* panel = findChild<LLPanelVoiceDeviceSettings>("device_settings_panel");
- if (panel)
- {
- panel->setUseTuningMode(false);
- getChild<LLUICtrl>("voice_input_device")->setCommitCallback(boost::bind(&LLPanelVoiceDeviceSettings::apply, panel));
- getChild<LLUICtrl>("voice_output_device")->setCommitCallback(boost::bind(&LLPanelVoiceDeviceSettings::apply, panel));
- getChild<LLUICtrl>("mic_volume_slider")->setCommitCallback(boost::bind(&LLPanelVoiceDeviceSettings::apply, panel));
- }
- return TRUE;
+ LLPanelVoiceDeviceSettings* panel = findChild<LLPanelVoiceDeviceSettings>("device_settings_panel");
+ if (panel)
+ {
+ panel->setUseTuningMode(false);
+ getChild<LLUICtrl>("voice_input_device")->setCommitCallback(boost::bind(&LLPanelVoiceDeviceSettings::apply, panel));
+ getChild<LLUICtrl>("voice_output_device")->setCommitCallback(boost::bind(&LLPanelVoiceDeviceSettings::apply, panel));
+ getChild<LLUICtrl>("mic_volume_slider")->setCommitCallback(boost::bind(&LLPanelVoiceDeviceSettings::apply, panel));
+ }
+ return TRUE;
}
//virtual
void LLFloaterSoundDevices::setDocked(bool docked, bool pop_on_undock/* = true*/)
{
- LLTransientDockableFloater::setDocked(docked, pop_on_undock);
+ LLTransientDockableFloater::setDocked(docked, pop_on_undock);
}
// virtual
void LLFloaterSoundDevices::setFocus( BOOL b )
{
- LLTransientDockableFloater::setFocus(b);
+ LLTransientDockableFloater::setFocus(b);
- // Force using active floater transparency
- // We have to override setFocus() for because selecting an item of the
- // combobox causes the floater to lose focus and thus become transparent.
- updateTransparency(TT_ACTIVE);
+ // Force using active floater transparency
+ // We have to override setFocus() for because selecting an item of the
+ // combobox causes the floater to lose focus and thus become transparent.
+ updateTransparency(TT_ACTIVE);
}
diff --git a/indra/newview/llfloatersounddevices.h b/indra/newview/llfloatersounddevices.h
index f09ee3b069..b68e1c737b 100644
--- a/indra/newview/llfloatersounddevices.h
+++ b/indra/newview/llfloatersounddevices.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatersounddevices.h
* @author Leyla Farazha
* @brief Sound Preferences used for minimal skin
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,14 +34,14 @@ class LLFloaterSoundDevices : public LLTransientDockableFloater
{
public:
- LOG_CLASS(LLFloaterSoundDevices);
+ LOG_CLASS(LLFloaterSoundDevices);
- LLFloaterSoundDevices(const LLSD& key);
- ~LLFloaterSoundDevices();
+ LLFloaterSoundDevices(const LLSD& key);
+ ~LLFloaterSoundDevices();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
- /*virtual*/ void setFocus( BOOL b );
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
+ /*virtual*/ void setFocus( BOOL b );
};
diff --git a/indra/newview/llfloaterspellchecksettings.cpp b/indra/newview/llfloaterspellchecksettings.cpp
index 32eb70cd39..47ec3a16fb 100644
--- a/indra/newview/llfloaterspellchecksettings.cpp
+++ b/indra/newview/llfloaterspellchecksettings.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterspellchecksettings.h
* @brief Spell checker settings floater
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,418 +44,418 @@
/// Class LLFloaterSpellCheckerSettings
///----------------------------------------------------------------------------
LLFloaterSpellCheckerSettings::LLFloaterSpellCheckerSettings(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
}
void LLFloaterSpellCheckerSettings::draw()
{
- LLFloater::draw();
-
- std::vector<LLScrollListItem*> sel_items = getChild<LLScrollListCtrl>("spellcheck_available_list")->getAllSelected();
- bool enable_remove = !sel_items.empty();
- for (std::vector<LLScrollListItem*>::const_iterator sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
- {
- enable_remove &= LLSpellChecker::getInstance()->canRemoveDictionary((*sel_it)->getValue().asString());
- }
- getChild<LLUICtrl>("spellcheck_remove_btn")->setEnabled(enable_remove);
+ LLFloater::draw();
+
+ std::vector<LLScrollListItem*> sel_items = getChild<LLScrollListCtrl>("spellcheck_available_list")->getAllSelected();
+ bool enable_remove = !sel_items.empty();
+ for (std::vector<LLScrollListItem*>::const_iterator sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
+ {
+ enable_remove &= LLSpellChecker::getInstance()->canRemoveDictionary((*sel_it)->getValue().asString());
+ }
+ getChild<LLUICtrl>("spellcheck_remove_btn")->setEnabled(enable_remove);
}
BOOL LLFloaterSpellCheckerSettings::postBuild(void)
{
- gSavedSettings.getControl("SpellCheck")->getSignal()->connect(boost::bind(&LLFloaterSpellCheckerSettings::refreshDictionaries, this, false));
- LLSpellChecker::setSettingsChangeCallback(boost::bind(&LLFloaterSpellCheckerSettings::onSpellCheckSettingsChange, this));
- getChild<LLUICtrl>("spellcheck_remove_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnRemove, this));
- getChild<LLUICtrl>("spellcheck_import_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnImport, this));
- getChild<LLUICtrl>("spellcheck_main_combo")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::refreshDictionaries, this, false));
- getChild<LLUICtrl>("spellcheck_moveleft_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnMove, this, "spellcheck_active_list", "spellcheck_available_list"));
- getChild<LLUICtrl>("spellcheck_moveright_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnMove, this, "spellcheck_available_list", "spellcheck_active_list"));
- center();
- return true;
+ gSavedSettings.getControl("SpellCheck")->getSignal()->connect(boost::bind(&LLFloaterSpellCheckerSettings::refreshDictionaries, this, false));
+ LLSpellChecker::setSettingsChangeCallback(boost::bind(&LLFloaterSpellCheckerSettings::onSpellCheckSettingsChange, this));
+ getChild<LLUICtrl>("spellcheck_remove_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnRemove, this));
+ getChild<LLUICtrl>("spellcheck_import_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnImport, this));
+ getChild<LLUICtrl>("spellcheck_main_combo")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::refreshDictionaries, this, false));
+ getChild<LLUICtrl>("spellcheck_moveleft_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnMove, this, "spellcheck_active_list", "spellcheck_available_list"));
+ getChild<LLUICtrl>("spellcheck_moveright_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerSettings::onBtnMove, this, "spellcheck_available_list", "spellcheck_active_list"));
+ center();
+ return true;
}
void LLFloaterSpellCheckerSettings::onBtnImport()
{
- LLFloaterReg::showInstance("prefs_spellchecker_import");
+ LLFloaterReg::showInstance("prefs_spellchecker_import");
}
void LLFloaterSpellCheckerSettings::onBtnMove(const std::string& from, const std::string& to)
{
- LLScrollListCtrl* from_ctrl = findChild<LLScrollListCtrl>(from);
- LLScrollListCtrl* to_ctrl = findChild<LLScrollListCtrl>(to);
-
- LLSD row;
- row["columns"][0]["column"] = "name";
-
- std::vector<LLScrollListItem*> sel_items = from_ctrl->getAllSelected();
- std::vector<LLScrollListItem*>::const_iterator sel_it;
- for ( sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
- {
- row["value"] = (*sel_it)->getValue();
- row["columns"][0]["value"] = (*sel_it)->getColumn(0)->getValue();
- to_ctrl->addElement(row);
- to_ctrl->setSelectedByValue( (*sel_it)->getValue(), true );
- }
- from_ctrl->deleteSelectedItems();
+ LLScrollListCtrl* from_ctrl = findChild<LLScrollListCtrl>(from);
+ LLScrollListCtrl* to_ctrl = findChild<LLScrollListCtrl>(to);
+
+ LLSD row;
+ row["columns"][0]["column"] = "name";
+
+ std::vector<LLScrollListItem*> sel_items = from_ctrl->getAllSelected();
+ std::vector<LLScrollListItem*>::const_iterator sel_it;
+ for ( sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
+ {
+ row["value"] = (*sel_it)->getValue();
+ row["columns"][0]["value"] = (*sel_it)->getColumn(0)->getValue();
+ to_ctrl->addElement(row);
+ to_ctrl->setSelectedByValue( (*sel_it)->getValue(), true );
+ }
+ from_ctrl->deleteSelectedItems();
}
void LLFloaterSpellCheckerSettings::onClose(bool app_quitting)
{
- if (app_quitting)
- {
- // don't save anything
- return;
- }
- LLFloaterReg::hideInstance("prefs_spellchecker_import");
-
- std::list<std::string> list_dict;
-
- LLComboBox* dict_combo = findChild<LLComboBox>("spellcheck_main_combo");
- const std::string dict_name = dict_combo->getSelectedItemLabel();
- if (!dict_name.empty())
- {
- list_dict.push_back(dict_name);
-
- LLScrollListCtrl* list_ctrl = findChild<LLScrollListCtrl>("spellcheck_active_list");
- std::vector<LLScrollListItem*> list_items = list_ctrl->getAllData();
- for (std::vector<LLScrollListItem*>::const_iterator item_it = list_items.begin(); item_it != list_items.end(); ++item_it)
- {
- const std::string language = (*item_it)->getValue().asString();
- if (LLSpellChecker::getInstance()->hasDictionary(language, true))
- {
- list_dict.push_back(language);
- }
- }
- }
- gSavedSettings.setString("SpellCheckDictionary", boost::join(list_dict, ","));
+ if (app_quitting)
+ {
+ // don't save anything
+ return;
+ }
+ LLFloaterReg::hideInstance("prefs_spellchecker_import");
+
+ std::list<std::string> list_dict;
+
+ LLComboBox* dict_combo = findChild<LLComboBox>("spellcheck_main_combo");
+ const std::string dict_name = dict_combo->getSelectedItemLabel();
+ if (!dict_name.empty())
+ {
+ list_dict.push_back(dict_name);
+
+ LLScrollListCtrl* list_ctrl = findChild<LLScrollListCtrl>("spellcheck_active_list");
+ std::vector<LLScrollListItem*> list_items = list_ctrl->getAllData();
+ for (std::vector<LLScrollListItem*>::const_iterator item_it = list_items.begin(); item_it != list_items.end(); ++item_it)
+ {
+ const std::string language = (*item_it)->getValue().asString();
+ if (LLSpellChecker::getInstance()->hasDictionary(language, true))
+ {
+ list_dict.push_back(language);
+ }
+ }
+ }
+ gSavedSettings.setString("SpellCheckDictionary", boost::join(list_dict, ","));
}
void LLFloaterSpellCheckerSettings::onOpen(const LLSD& key)
{
- refreshDictionaries(true);
+ refreshDictionaries(true);
}
void LLFloaterSpellCheckerSettings::onBtnRemove()
{
- std::vector<LLScrollListItem*> sel_items = getChild<LLScrollListCtrl>("spellcheck_available_list")->getAllSelected();
- for (std::vector<LLScrollListItem*>::const_iterator sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
- {
- LLSpellChecker::instance().removeDictionary((*sel_it)->getValue().asString());
- }
+ std::vector<LLScrollListItem*> sel_items = getChild<LLScrollListCtrl>("spellcheck_available_list")->getAllSelected();
+ for (std::vector<LLScrollListItem*>::const_iterator sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
+ {
+ LLSpellChecker::instance().removeDictionary((*sel_it)->getValue().asString());
+ }
}
void LLFloaterSpellCheckerSettings::onSpellCheckSettingsChange()
{
- refreshDictionaries(true);
+ refreshDictionaries(true);
}
void LLFloaterSpellCheckerSettings::refreshDictionaries(bool from_settings)
{
- bool enabled = gSavedSettings.getBOOL("SpellCheck");
- getChild<LLUICtrl>("spellcheck_moveleft_btn")->setEnabled(enabled);
- getChild<LLUICtrl>("spellcheck_moveright_btn")->setEnabled(enabled);
-
- // Populate the dictionary combobox
- LLComboBox* dict_combo = findChild<LLComboBox>("spellcheck_main_combo");
- std::string dict_cur = dict_combo->getSelectedItemLabel();
- if ((dict_cur.empty() || from_settings) && (LLSpellChecker::getUseSpellCheck()))
- {
- dict_cur = LLSpellChecker::instance().getPrimaryDictionary();
- }
- dict_combo->clearRows();
-
- const LLSD& dict_map = LLSpellChecker::getInstance()->getDictionaryMap();
- if (dict_map.size())
- {
- for (LLSD::array_const_iterator dict_it = dict_map.beginArray(); dict_it != dict_map.endArray(); ++dict_it)
- {
- const LLSD& dict = *dict_it;
- if ( (dict["installed"].asBoolean()) && (dict["is_primary"].asBoolean()) && (dict.has("language")) )
- {
- dict_combo->add(dict["language"].asString());
- }
- }
- if (!dict_combo->selectByValue(dict_cur))
- {
- dict_combo->clear();
- }
- }
- dict_combo->sortByName();
- dict_combo->setEnabled(enabled);
-
- // Populate the available and active dictionary list
- LLScrollListCtrl* avail_ctrl = findChild<LLScrollListCtrl>("spellcheck_available_list");
- LLScrollListCtrl* active_ctrl = findChild<LLScrollListCtrl>("spellcheck_active_list");
-
- LLSpellChecker::dict_list_t active_list;
- if ( ((!avail_ctrl->getItemCount()) && (!active_ctrl->getItemCount())) || (from_settings) )
- {
- if (LLSpellChecker::getUseSpellCheck())
- {
- active_list = LLSpellChecker::instance().getSecondaryDictionaries();
- }
- }
- else
- {
- std::vector<LLScrollListItem*> active_items = active_ctrl->getAllData();
- for (std::vector<LLScrollListItem*>::const_iterator item_it = active_items.begin(); item_it != active_items.end(); ++item_it)
- {
- std::string dict = (*item_it)->getValue().asString();
- if (dict_cur != dict)
- {
- active_list.push_back(dict);
- }
- }
- }
-
- LLSD row;
- row["columns"][0]["column"] = "name";
-
- active_ctrl->clearRows();
- active_ctrl->setEnabled(enabled);
- for (LLSpellChecker::dict_list_t::const_iterator it = active_list.begin(); it != active_list.end(); ++it)
- {
- const std::string language = *it;
- const LLSD dict = LLSpellChecker::getInstance()->getDictionaryData(language);
- row["value"] = language;
- row["columns"][0]["value"] = (!dict["user_installed"].asBoolean()) ? language : language + " " + LLTrans::getString("UserDictionary");
- active_ctrl->addElement(row);
- }
- active_ctrl->sortByColumnIndex(0, true);
- active_list.push_back(dict_cur);
-
- avail_ctrl->clearRows();
- avail_ctrl->setEnabled(enabled);
- for (LLSD::array_const_iterator dict_it = dict_map.beginArray(); dict_it != dict_map.endArray(); ++dict_it)
- {
- const LLSD& dict = *dict_it;
- const std::string language = dict["language"].asString();
- if ( (dict["installed"].asBoolean()) && (active_list.end() == std::find(active_list.begin(), active_list.end(), language)) )
- {
- row["value"] = language;
- row["columns"][0]["value"] = (!dict["user_installed"].asBoolean()) ? language : language + " " + LLTrans::getString("UserDictionary");
- avail_ctrl->addElement(row);
- }
- }
- avail_ctrl->sortByColumnIndex(0, true);
+ bool enabled = gSavedSettings.getBOOL("SpellCheck");
+ getChild<LLUICtrl>("spellcheck_moveleft_btn")->setEnabled(enabled);
+ getChild<LLUICtrl>("spellcheck_moveright_btn")->setEnabled(enabled);
+
+ // Populate the dictionary combobox
+ LLComboBox* dict_combo = findChild<LLComboBox>("spellcheck_main_combo");
+ std::string dict_cur = dict_combo->getSelectedItemLabel();
+ if ((dict_cur.empty() || from_settings) && (LLSpellChecker::getUseSpellCheck()))
+ {
+ dict_cur = LLSpellChecker::instance().getPrimaryDictionary();
+ }
+ dict_combo->clearRows();
+
+ const LLSD& dict_map = LLSpellChecker::getInstance()->getDictionaryMap();
+ if (dict_map.size())
+ {
+ for (LLSD::array_const_iterator dict_it = dict_map.beginArray(); dict_it != dict_map.endArray(); ++dict_it)
+ {
+ const LLSD& dict = *dict_it;
+ if ( (dict["installed"].asBoolean()) && (dict["is_primary"].asBoolean()) && (dict.has("language")) )
+ {
+ dict_combo->add(dict["language"].asString());
+ }
+ }
+ if (!dict_combo->selectByValue(dict_cur))
+ {
+ dict_combo->clear();
+ }
+ }
+ dict_combo->sortByName();
+ dict_combo->setEnabled(enabled);
+
+ // Populate the available and active dictionary list
+ LLScrollListCtrl* avail_ctrl = findChild<LLScrollListCtrl>("spellcheck_available_list");
+ LLScrollListCtrl* active_ctrl = findChild<LLScrollListCtrl>("spellcheck_active_list");
+
+ LLSpellChecker::dict_list_t active_list;
+ if ( ((!avail_ctrl->getItemCount()) && (!active_ctrl->getItemCount())) || (from_settings) )
+ {
+ if (LLSpellChecker::getUseSpellCheck())
+ {
+ active_list = LLSpellChecker::instance().getSecondaryDictionaries();
+ }
+ }
+ else
+ {
+ std::vector<LLScrollListItem*> active_items = active_ctrl->getAllData();
+ for (std::vector<LLScrollListItem*>::const_iterator item_it = active_items.begin(); item_it != active_items.end(); ++item_it)
+ {
+ std::string dict = (*item_it)->getValue().asString();
+ if (dict_cur != dict)
+ {
+ active_list.push_back(dict);
+ }
+ }
+ }
+
+ LLSD row;
+ row["columns"][0]["column"] = "name";
+
+ active_ctrl->clearRows();
+ active_ctrl->setEnabled(enabled);
+ for (LLSpellChecker::dict_list_t::const_iterator it = active_list.begin(); it != active_list.end(); ++it)
+ {
+ const std::string language = *it;
+ const LLSD dict = LLSpellChecker::getInstance()->getDictionaryData(language);
+ row["value"] = language;
+ row["columns"][0]["value"] = (!dict["user_installed"].asBoolean()) ? language : language + " " + LLTrans::getString("UserDictionary");
+ active_ctrl->addElement(row);
+ }
+ active_ctrl->sortByColumnIndex(0, true);
+ active_list.push_back(dict_cur);
+
+ avail_ctrl->clearRows();
+ avail_ctrl->setEnabled(enabled);
+ for (LLSD::array_const_iterator dict_it = dict_map.beginArray(); dict_it != dict_map.endArray(); ++dict_it)
+ {
+ const LLSD& dict = *dict_it;
+ const std::string language = dict["language"].asString();
+ if ( (dict["installed"].asBoolean()) && (active_list.end() == std::find(active_list.begin(), active_list.end(), language)) )
+ {
+ row["value"] = language;
+ row["columns"][0]["value"] = (!dict["user_installed"].asBoolean()) ? language : language + " " + LLTrans::getString("UserDictionary");
+ avail_ctrl->addElement(row);
+ }
+ }
+ avail_ctrl->sortByColumnIndex(0, true);
}
///----------------------------------------------------------------------------
/// Class LLFloaterSpellCheckerImport
///----------------------------------------------------------------------------
LLFloaterSpellCheckerImport::LLFloaterSpellCheckerImport(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
}
BOOL LLFloaterSpellCheckerImport::postBuild(void)
{
- getChild<LLUICtrl>("dictionary_path_browse")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerImport::onBtnBrowse, this));
- getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerImport::onBtnOK, this));
- getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerImport::onBtnCancel, this));
- center();
- return true;
+ getChild<LLUICtrl>("dictionary_path_browse")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerImport::onBtnBrowse, this));
+ getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerImport::onBtnOK, this));
+ getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterSpellCheckerImport::onBtnCancel, this));
+ center();
+ return true;
}
void LLFloaterSpellCheckerImport::onBtnBrowse()
{
- LLFilePickerReplyThread::startPicker(boost::bind(&LLFloaterSpellCheckerImport::importSelectedDictionary, this, _1), LLFilePicker::FFLOAD_DICTIONARY, false);
+ LLFilePickerReplyThread::startPicker(boost::bind(&LLFloaterSpellCheckerImport::importSelectedDictionary, this, _1), LLFilePicker::FFLOAD_DICTIONARY, false);
}
void LLFloaterSpellCheckerImport::importSelectedDictionary(const std::vector<std::string>& filenames)
{
- std::string filepath = filenames[0];
-
- const std::string extension = gDirUtilp->getExtension(filepath);
- if ("xcu" == extension)
- {
- filepath = parseXcuFile(filepath);
- if (filepath.empty())
- {
- return;
- }
- }
-
- getChild<LLUICtrl>("dictionary_path")->setValue(filepath);
-
- mDictionaryDir = gDirUtilp->getDirName(filepath);
- mDictionaryBasename = gDirUtilp->getBaseFileName(filepath, true);
- getChild<LLUICtrl>("dictionary_name")->setValue(mDictionaryBasename);
+ std::string filepath = filenames[0];
+
+ const std::string extension = gDirUtilp->getExtension(filepath);
+ if ("xcu" == extension)
+ {
+ filepath = parseXcuFile(filepath);
+ if (filepath.empty())
+ {
+ return;
+ }
+ }
+
+ getChild<LLUICtrl>("dictionary_path")->setValue(filepath);
+
+ mDictionaryDir = gDirUtilp->getDirName(filepath);
+ mDictionaryBasename = gDirUtilp->getBaseFileName(filepath, true);
+ getChild<LLUICtrl>("dictionary_name")->setValue(mDictionaryBasename);
}
void LLFloaterSpellCheckerImport::onBtnCancel()
{
- closeFloater(false);
+ closeFloater(false);
}
void LLFloaterSpellCheckerImport::onBtnOK()
{
- const std::string dict_dic = mDictionaryDir + gDirUtilp->getDirDelimiter() + mDictionaryBasename + ".dic";
- const std::string dict_aff = mDictionaryDir + gDirUtilp->getDirDelimiter() + mDictionaryBasename + ".aff";
- std::string dict_language = getChild<LLUICtrl>("dictionary_language")->getValue().asString();
- LLStringUtil::trim(dict_language);
-
- bool imported = false;
- if ( dict_language.empty()
- || mDictionaryDir.empty()
- || mDictionaryBasename.empty()
- || ! gDirUtilp->fileExists(dict_dic)
- )
- {
- LLNotificationsUtil::add("SpellingDictImportRequired");
- }
- else
- {
- std::string settings_dic = LLSpellChecker::getDictionaryUserPath() + mDictionaryBasename + ".dic";
- if ( LLFile::copy( dict_dic, settings_dic ) )
- {
- if (gDirUtilp->fileExists(dict_aff))
- {
- std::string settings_aff = LLSpellChecker::getDictionaryUserPath() + mDictionaryBasename + ".aff";
- if ( LLFile::copy( dict_aff, settings_aff ))
- {
- imported = true;
- }
- else
- {
- LLSD args = LLSD::emptyMap();
- args["FROM_NAME"] = dict_aff;
- args["TO_NAME"] = settings_aff;
- LLNotificationsUtil::add("SpellingDictImportFailed", args);
- }
- }
- else
- {
- LLSD args = LLSD::emptyMap();
- args["DIC_NAME"] = dict_dic;
- LLNotificationsUtil::add("SpellingDictIsSecondary", args);
-
- imported = true;
- }
- }
- else
- {
- LLSD args = LLSD::emptyMap();
- args["FROM_NAME"] = dict_dic;
- args["TO_NAME"] = settings_dic;
- LLNotificationsUtil::add("SpellingDictImportFailed", args);
- }
- }
-
- if ( imported )
- {
- LLSD custom_dict_info;
- custom_dict_info["is_primary"] = (bool)gDirUtilp->fileExists(dict_aff);
- custom_dict_info["name"] = mDictionaryBasename;
- custom_dict_info["language"] = dict_language;
-
- LLSD custom_dict_map;
+ const std::string dict_dic = mDictionaryDir + gDirUtilp->getDirDelimiter() + mDictionaryBasename + ".dic";
+ const std::string dict_aff = mDictionaryDir + gDirUtilp->getDirDelimiter() + mDictionaryBasename + ".aff";
+ std::string dict_language = getChild<LLUICtrl>("dictionary_language")->getValue().asString();
+ LLStringUtil::trim(dict_language);
+
+ bool imported = false;
+ if ( dict_language.empty()
+ || mDictionaryDir.empty()
+ || mDictionaryBasename.empty()
+ || ! gDirUtilp->fileExists(dict_dic)
+ )
+ {
+ LLNotificationsUtil::add("SpellingDictImportRequired");
+ }
+ else
+ {
+ std::string settings_dic = LLSpellChecker::getDictionaryUserPath() + mDictionaryBasename + ".dic";
+ if ( LLFile::copy( dict_dic, settings_dic ) )
+ {
+ if (gDirUtilp->fileExists(dict_aff))
+ {
+ std::string settings_aff = LLSpellChecker::getDictionaryUserPath() + mDictionaryBasename + ".aff";
+ if ( LLFile::copy( dict_aff, settings_aff ))
+ {
+ imported = true;
+ }
+ else
+ {
+ LLSD args = LLSD::emptyMap();
+ args["FROM_NAME"] = dict_aff;
+ args["TO_NAME"] = settings_aff;
+ LLNotificationsUtil::add("SpellingDictImportFailed", args);
+ }
+ }
+ else
+ {
+ LLSD args = LLSD::emptyMap();
+ args["DIC_NAME"] = dict_dic;
+ LLNotificationsUtil::add("SpellingDictIsSecondary", args);
+
+ imported = true;
+ }
+ }
+ else
+ {
+ LLSD args = LLSD::emptyMap();
+ args["FROM_NAME"] = dict_dic;
+ args["TO_NAME"] = settings_dic;
+ LLNotificationsUtil::add("SpellingDictImportFailed", args);
+ }
+ }
+
+ if ( imported )
+ {
+ LLSD custom_dict_info;
+ custom_dict_info["is_primary"] = (bool)gDirUtilp->fileExists(dict_aff);
+ custom_dict_info["name"] = mDictionaryBasename;
+ custom_dict_info["language"] = dict_language;
+
+ LLSD custom_dict_map;
std::string custom_filename(LLSpellChecker::getDictionaryUserPath() + "user_dictionaries.xml");
- llifstream custom_file_in(custom_filename.c_str());
- if (custom_file_in.is_open())
- {
- LLSDSerialize::fromXMLDocument(custom_dict_map, custom_file_in);
- custom_file_in.close();
- }
-
- LLSD::array_iterator it = custom_dict_map.beginArray();
- for (; it != custom_dict_map.endArray(); ++it)
- {
- LLSD& dict_info = *it;
- if (dict_info["name"].asString() == mDictionaryBasename)
- {
- dict_info = custom_dict_info;
- break;
- }
- }
- if (custom_dict_map.endArray() == it)
- {
- custom_dict_map.append(custom_dict_info);
- }
-
- llofstream custom_file_out(custom_filename.c_str(), std::ios::trunc);
- if (custom_file_out.is_open())
- {
- LLSDSerialize::toPrettyXML(custom_dict_map, custom_file_out);
- custom_file_out.close();
- }
-
- LLSpellChecker::getInstance()->refreshDictionaryMap();
- }
-
- closeFloater(false);
+ llifstream custom_file_in(custom_filename.c_str());
+ if (custom_file_in.is_open())
+ {
+ LLSDSerialize::fromXMLDocument(custom_dict_map, custom_file_in);
+ custom_file_in.close();
+ }
+
+ LLSD::array_iterator it = custom_dict_map.beginArray();
+ for (; it != custom_dict_map.endArray(); ++it)
+ {
+ LLSD& dict_info = *it;
+ if (dict_info["name"].asString() == mDictionaryBasename)
+ {
+ dict_info = custom_dict_info;
+ break;
+ }
+ }
+ if (custom_dict_map.endArray() == it)
+ {
+ custom_dict_map.append(custom_dict_info);
+ }
+
+ llofstream custom_file_out(custom_filename.c_str(), std::ios::trunc);
+ if (custom_file_out.is_open())
+ {
+ LLSDSerialize::toPrettyXML(custom_dict_map, custom_file_out);
+ custom_file_out.close();
+ }
+
+ LLSpellChecker::getInstance()->refreshDictionaryMap();
+ }
+
+ closeFloater(false);
}
std::string LLFloaterSpellCheckerImport::parseXcuFile(const std::string& file_path) const
{
- LLXMLNodePtr xml_root;
- if ( (!LLUICtrlFactory::getLayeredXMLNode(file_path, xml_root)) || (xml_root.isNull()) )
- {
- return LLStringUtil::null;
- }
-
- // Bury down to the "Dictionaries" parent node
- LLXMLNode* dict_node = NULL;
- for (LLXMLNode* outer_node = xml_root->getFirstChild(); outer_node && !dict_node; outer_node = outer_node->getNextSibling())
- {
- std::string temp;
- if ( (outer_node->getAttributeString("oor:name", temp)) && ("ServiceManager" == temp) )
- {
- for (LLXMLNode* inner_node = outer_node->getFirstChild(); inner_node && !dict_node; inner_node = inner_node->getNextSibling())
- {
- if ( (inner_node->getAttributeString("oor:name", temp)) && ("Dictionaries" == temp) )
- {
- dict_node = inner_node;
- break;
- }
- }
- }
- }
-
- if (dict_node)
- {
- // Iterate over all child nodes until we find one that has a <value>DICT_SPELL</value> node
- for (LLXMLNode* outer_node = dict_node->getFirstChild(); outer_node; outer_node = outer_node->getNextSibling())
- {
- std::string temp;
- LLXMLNodePtr location_node, format_node;
- for (LLXMLNode* inner_node = outer_node->getFirstChild(); inner_node; inner_node = inner_node->getNextSibling())
- {
- if (inner_node->getAttributeString("oor:name", temp))
- {
- if ("Locations" == temp)
- {
- inner_node->getChild("value", location_node, false);
- }
- else if ("Format" == temp)
- {
- inner_node->getChild("value", format_node, false);
- }
- }
- }
- if ( (format_node.isNull()) || ("DICT_SPELL" != format_node->getValue()) || (location_node.isNull()) )
- {
- continue;
- }
-
- // Found a list of file locations, return the .dic (if present)
- std::list<std::string> location_list;
- boost::split(location_list, location_node->getValue(), boost::is_any_of(std::string(" ")));
- for (std::list<std::string>::iterator it = location_list.begin(); it != location_list.end(); ++it)
- {
- std::string& location = *it;
- if ("\\" != gDirUtilp->getDirDelimiter())
- LLStringUtil::replaceString(location, "\\", gDirUtilp->getDirDelimiter());
- else
- LLStringUtil::replaceString(location, "/", gDirUtilp->getDirDelimiter());
- LLStringUtil::replaceString(location, "%origin%", gDirUtilp->getDirName(file_path));
- if ("dic" == gDirUtilp->getExtension(location))
- {
- return location;
- }
- }
- }
- }
-
- return LLStringUtil::null;
+ LLXMLNodePtr xml_root;
+ if ( (!LLUICtrlFactory::getLayeredXMLNode(file_path, xml_root)) || (xml_root.isNull()) )
+ {
+ return LLStringUtil::null;
+ }
+
+ // Bury down to the "Dictionaries" parent node
+ LLXMLNode* dict_node = NULL;
+ for (LLXMLNode* outer_node = xml_root->getFirstChild(); outer_node && !dict_node; outer_node = outer_node->getNextSibling())
+ {
+ std::string temp;
+ if ( (outer_node->getAttributeString("oor:name", temp)) && ("ServiceManager" == temp) )
+ {
+ for (LLXMLNode* inner_node = outer_node->getFirstChild(); inner_node && !dict_node; inner_node = inner_node->getNextSibling())
+ {
+ if ( (inner_node->getAttributeString("oor:name", temp)) && ("Dictionaries" == temp) )
+ {
+ dict_node = inner_node;
+ break;
+ }
+ }
+ }
+ }
+
+ if (dict_node)
+ {
+ // Iterate over all child nodes until we find one that has a <value>DICT_SPELL</value> node
+ for (LLXMLNode* outer_node = dict_node->getFirstChild(); outer_node; outer_node = outer_node->getNextSibling())
+ {
+ std::string temp;
+ LLXMLNodePtr location_node, format_node;
+ for (LLXMLNode* inner_node = outer_node->getFirstChild(); inner_node; inner_node = inner_node->getNextSibling())
+ {
+ if (inner_node->getAttributeString("oor:name", temp))
+ {
+ if ("Locations" == temp)
+ {
+ inner_node->getChild("value", location_node, false);
+ }
+ else if ("Format" == temp)
+ {
+ inner_node->getChild("value", format_node, false);
+ }
+ }
+ }
+ if ( (format_node.isNull()) || ("DICT_SPELL" != format_node->getValue()) || (location_node.isNull()) )
+ {
+ continue;
+ }
+
+ // Found a list of file locations, return the .dic (if present)
+ std::list<std::string> location_list;
+ boost::split(location_list, location_node->getValue(), boost::is_any_of(std::string(" ")));
+ for (std::list<std::string>::iterator it = location_list.begin(); it != location_list.end(); ++it)
+ {
+ std::string& location = *it;
+ if ("\\" != gDirUtilp->getDirDelimiter())
+ LLStringUtil::replaceString(location, "\\", gDirUtilp->getDirDelimiter());
+ else
+ LLStringUtil::replaceString(location, "/", gDirUtilp->getDirDelimiter());
+ LLStringUtil::replaceString(location, "%origin%", gDirUtilp->getDirName(file_path));
+ if ("dic" == gDirUtilp->getExtension(location))
+ {
+ return location;
+ }
+ }
+ }
+ }
+
+ return LLStringUtil::null;
}
diff --git a/indra/newview/llfloaterspellchecksettings.h b/indra/newview/llfloaterspellchecksettings.h
index f9bbefafb7..ab64625b8d 100644
--- a/indra/newview/llfloaterspellchecksettings.h
+++ b/indra/newview/llfloaterspellchecksettings.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterspellchecksettings.h
* @brief Spell checker settings floater
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,37 +32,37 @@
class LLFloaterSpellCheckerSettings : public LLFloater
{
public:
- LLFloaterSpellCheckerSettings(const LLSD& key);
+ LLFloaterSpellCheckerSettings(const LLSD& key);
- /*virtual*/ void draw();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
protected:
- void onBtnImport();
- void onBtnMove(const std::string& from, const std::string& to);
- void onBtnRemove();
- void onSpellCheckSettingsChange();
- void refreshDictionaries(bool from_settings);
+ void onBtnImport();
+ void onBtnMove(const std::string& from, const std::string& to);
+ void onBtnRemove();
+ void onSpellCheckSettingsChange();
+ void refreshDictionaries(bool from_settings);
};
class LLFloaterSpellCheckerImport : public LLFloater
{
public:
- LLFloaterSpellCheckerImport(const LLSD& key);
+ LLFloaterSpellCheckerImport(const LLSD& key);
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
protected:
- void onBtnBrowse();
- void onBtnCancel();
- void onBtnOK();
- void importSelectedDictionary(const std::vector<std::string>& filenames);
- std::string parseXcuFile(const std::string& file_path) const;
+ void onBtnBrowse();
+ void onBtnCancel();
+ void onBtnOK();
+ void importSelectedDictionary(const std::vector<std::string>& filenames);
+ std::string parseXcuFile(const std::string& file_path) const;
- std::string mDictionaryDir;
- std::string mDictionaryBasename;
+ std::string mDictionaryDir;
+ std::string mDictionaryBasename;
};
#endif // LLFLOATERSPELLCHECKERSETTINGS_H
diff --git a/indra/newview/llfloatertelehub.cpp b/indra/newview/llfloatertelehub.cpp
index b845fd132d..20e281f454 100644
--- a/indra/newview/llfloatertelehub.cpp
+++ b/indra/newview/llfloatertelehub.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatertelehub.cpp
* @author James Cook
* @brief LLFloaterTelehub class implementation
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,236 +44,236 @@
#include "lluictrlfactory.h"
LLFloaterTelehub::LLFloaterTelehub(const LLSD& key)
-: LLFloater(key),
- mTelehubObjectID(),
- mTelehubObjectName(),
- mTelehubPos(),
- mTelehubRot(),
- mNumSpawn(0)
+: LLFloater(key),
+ mTelehubObjectID(),
+ mTelehubObjectName(),
+ mTelehubPos(),
+ mTelehubRot(),
+ mNumSpawn(0)
{
}
BOOL LLFloaterTelehub::postBuild()
{
- gMessageSystem->setHandlerFunc("TelehubInfo", processTelehubInfo);
+ gMessageSystem->setHandlerFunc("TelehubInfo", processTelehubInfo);
- getChild<LLUICtrl>("connect_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickConnect, this));
- getChild<LLUICtrl>("disconnect_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickDisconnect, this));
- getChild<LLUICtrl>("add_spawn_point_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickAddSpawnPoint, this));
- getChild<LLUICtrl>("remove_spawn_point_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickRemoveSpawnPoint, this));
+ getChild<LLUICtrl>("connect_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickConnect, this));
+ getChild<LLUICtrl>("disconnect_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickDisconnect, this));
+ getChild<LLUICtrl>("add_spawn_point_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickAddSpawnPoint, this));
+ getChild<LLUICtrl>("remove_spawn_point_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickRemoveSpawnPoint, this));
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
- if (list)
- {
- // otherwise you can't walk with arrow keys while floater is up
- list->setAllowKeyboardMovement(FALSE);
- }
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
+ if (list)
+ {
+ // otherwise you can't walk with arrow keys while floater is up
+ list->setAllowKeyboardMovement(FALSE);
+ }
- return TRUE;
+ return TRUE;
}
void LLFloaterTelehub::onOpen(const LLSD& key)
{
- // Show tools floater by selecting translate (select) tool
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompTranslate::getInstance() );
+ // Show tools floater by selecting translate (select) tool
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompTranslate::getInstance() );
+
+ sendTelehubInfoRequest();
- sendTelehubInfoRequest();
-
- mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+ mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
}
LLFloaterTelehub::~LLFloaterTelehub()
{
- // no longer interested in this message
- gMessageSystem->setHandlerFunc("TelehubInfo", NULL);
+ // no longer interested in this message
+ gMessageSystem->setHandlerFunc("TelehubInfo", NULL);
}
void LLFloaterTelehub::draw()
{
- if (!isMinimized())
- {
- refresh();
- }
- LLFloater::draw();
+ if (!isMinimized())
+ {
+ refresh();
+ }
+ LLFloater::draw();
}
// Per-frame updates, because we don't have a selection manager observer.
void LLFloaterTelehub::refresh()
{
- const BOOL children_ok = TRUE;
- LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok);
-
- BOOL have_selection = (object != NULL);
- BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
- getChildView("connect_btn")->setEnabled(have_selection && all_volume);
-
- BOOL have_telehub = mTelehubObjectID.notNull();
- getChildView("disconnect_btn")->setEnabled(have_telehub);
-
- BOOL space_avail = (mNumSpawn < MAX_SPAWNPOINTS_PER_TELEHUB);
- getChildView("add_spawn_point_btn")->setEnabled(have_selection && all_volume && space_avail);
-
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
- if (list)
- {
- BOOL enable_remove = (list->getFirstSelected() != NULL);
- getChildView("remove_spawn_point_btn")->setEnabled(enable_remove);
- }
+ const BOOL children_ok = TRUE;
+ LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok);
+
+ BOOL have_selection = (object != NULL);
+ BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
+ getChildView("connect_btn")->setEnabled(have_selection && all_volume);
+
+ BOOL have_telehub = mTelehubObjectID.notNull();
+ getChildView("disconnect_btn")->setEnabled(have_telehub);
+
+ BOOL space_avail = (mNumSpawn < MAX_SPAWNPOINTS_PER_TELEHUB);
+ getChildView("add_spawn_point_btn")->setEnabled(have_selection && all_volume && space_avail);
+
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
+ if (list)
+ {
+ BOOL enable_remove = (list->getFirstSelected() != NULL);
+ getChildView("remove_spawn_point_btn")->setEnabled(enable_remove);
+ }
}
// static
BOOL LLFloaterTelehub::renderBeacons()
{
- // only render if we've got a telehub
- LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs");
- return floater && floater->mTelehubObjectID.notNull();
+ // only render if we've got a telehub
+ LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs");
+ return floater && floater->mTelehubObjectID.notNull();
}
// static
void LLFloaterTelehub::addBeacons()
{
- LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs");
- if (!floater)
- return;
-
- // Find the telehub position, either our cached old position, or
- // an updated one based on the actual object position.
- LLVector3 hub_pos_region = floater->mTelehubPos;
- LLQuaternion hub_rot = floater->mTelehubRot;
- LLViewerObject* obj = gObjectList.findObject(floater->mTelehubObjectID);
- if (obj)
- {
- hub_pos_region = obj->getPositionRegion();
- hub_rot = obj->getRotationRegion();
- }
- // Draw nice thick 3-pixel lines.
- gObjectList.addDebugBeacon(hub_pos_region, "", LLColor4::yellow, LLColor4::white, 4);
-
- LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("spawn_points_list");
- if (list)
- {
- S32 spawn_index = list->getFirstSelectedIndex();
- if (spawn_index >= 0)
- {
- LLVector3 spawn_pos = hub_pos_region + (floater->mSpawnPointPos[spawn_index] * hub_rot);
- gObjectList.addDebugBeacon(spawn_pos, "", LLColor4::orange, LLColor4::white, 4);
- }
- }
+ LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs");
+ if (!floater)
+ return;
+
+ // Find the telehub position, either our cached old position, or
+ // an updated one based on the actual object position.
+ LLVector3 hub_pos_region = floater->mTelehubPos;
+ LLQuaternion hub_rot = floater->mTelehubRot;
+ LLViewerObject* obj = gObjectList.findObject(floater->mTelehubObjectID);
+ if (obj)
+ {
+ hub_pos_region = obj->getPositionRegion();
+ hub_rot = obj->getRotationRegion();
+ }
+ // Draw nice thick 3-pixel lines.
+ gObjectList.addDebugBeacon(hub_pos_region, "", LLColor4::yellow, LLColor4::white, 4);
+
+ LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("spawn_points_list");
+ if (list)
+ {
+ S32 spawn_index = list->getFirstSelectedIndex();
+ if (spawn_index >= 0)
+ {
+ LLVector3 spawn_pos = hub_pos_region + (floater->mSpawnPointPos[spawn_index] * hub_rot);
+ gObjectList.addDebugBeacon(spawn_pos, "", LLColor4::orange, LLColor4::white, 4);
+ }
+ }
}
void LLFloaterTelehub::sendTelehubInfoRequest()
{
- LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "info ui");
+ LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "info ui");
}
void LLFloaterTelehub::onClickConnect()
{
- LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "connect");
+ LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "connect");
}
void LLFloaterTelehub::onClickDisconnect()
{
- LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "delete");
+ LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "delete");
}
void LLFloaterTelehub::onClickAddSpawnPoint()
{
- LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "spawnpoint add");
- LLSelectMgr::getInstance()->deselectAll();
+ LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "spawnpoint add");
+ LLSelectMgr::getInstance()->deselectAll();
}
void LLFloaterTelehub::onClickRemoveSpawnPoint()
{
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
- if (!list)
- return;
-
- S32 spawn_index = list->getFirstSelectedIndex();
- if (spawn_index < 0) return; // nothing selected
-
- LLMessageSystem* msg = gMessageSystem;
-
- // Could be god or estate owner. If neither, server will reject message.
- if (gAgent.isGodlike())
- {
- msg->newMessage("GodlikeMessage");
- }
- else
- {
- msg->newMessage("EstateOwnerMessage");
- }
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", "telehub");
- msg->addUUID("Invoice", LLUUID::null);
-
- msg->nextBlock("ParamList");
- msg->addString("Parameter", "spawnpoint remove");
-
- std::string buffer;
- buffer = llformat("%d", spawn_index);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buffer);
-
- gAgent.sendReliableMessage();
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
+ if (!list)
+ return;
+
+ S32 spawn_index = list->getFirstSelectedIndex();
+ if (spawn_index < 0) return; // nothing selected
+
+ LLMessageSystem* msg = gMessageSystem;
+
+ // Could be god or estate owner. If neither, server will reject message.
+ if (gAgent.isGodlike())
+ {
+ msg->newMessage("GodlikeMessage");
+ }
+ else
+ {
+ msg->newMessage("EstateOwnerMessage");
+ }
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ msg->nextBlock("MethodData");
+ msg->addString("Method", "telehub");
+ msg->addUUID("Invoice", LLUUID::null);
+
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", "spawnpoint remove");
+
+ std::string buffer;
+ buffer = llformat("%d", spawn_index);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", buffer);
+
+ gAgent.sendReliableMessage();
}
-// static
+// static
void LLFloaterTelehub::processTelehubInfo(LLMessageSystem* msg, void**)
{
- LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs");
- if (floater)
- {
- floater->unpackTelehubInfo(msg);
- }
+ LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs");
+ if (floater)
+ {
+ floater->unpackTelehubInfo(msg);
+ }
}
void LLFloaterTelehub::unpackTelehubInfo(LLMessageSystem* msg)
{
- msg->getUUID("TelehubBlock", "ObjectID", mTelehubObjectID);
- msg->getString("TelehubBlock", "ObjectName", mTelehubObjectName);
- msg->getVector3("TelehubBlock", "TelehubPos", mTelehubPos);
- msg->getQuat("TelehubBlock", "TelehubRot", mTelehubRot);
-
- mNumSpawn = msg->getNumberOfBlocks("SpawnPointBlock");
- for (S32 i = 0; i < mNumSpawn; i++)
- {
- msg->getVector3("SpawnPointBlock", "SpawnPointPos", mSpawnPointPos[i], i);
- }
-
- // Update parts of the UI that change only when message received.
-
- if (mTelehubObjectID.isNull())
- {
- getChildView("status_text_connected")->setVisible( false);
- getChildView("status_text_not_connected")->setVisible( true);
- getChildView("help_text_connected")->setVisible( false);
- getChildView("help_text_not_connected")->setVisible( true);
- }
- else
- {
- getChild<LLUICtrl>("status_text_connected")->setTextArg("[OBJECT]", mTelehubObjectName);
- getChildView("status_text_connected")->setVisible( true);
- getChildView("status_text_not_connected")->setVisible( false);
- getChildView("help_text_connected")->setVisible( true);
- getChildView("help_text_not_connected")->setVisible( false);
- }
-
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
- if (list)
- {
- list->deleteAllItems();
- for (S32 i = 0; i < mNumSpawn; i++)
- {
- std::string pos = llformat("%.1f, %.1f, %.1f",
- mSpawnPointPos[i].mV[VX],
- mSpawnPointPos[i].mV[VY],
- mSpawnPointPos[i].mV[VZ]);
- list->addSimpleElement(pos);
- }
- list->selectNthItem(mNumSpawn - 1);
- }
+ msg->getUUID("TelehubBlock", "ObjectID", mTelehubObjectID);
+ msg->getString("TelehubBlock", "ObjectName", mTelehubObjectName);
+ msg->getVector3("TelehubBlock", "TelehubPos", mTelehubPos);
+ msg->getQuat("TelehubBlock", "TelehubRot", mTelehubRot);
+
+ mNumSpawn = msg->getNumberOfBlocks("SpawnPointBlock");
+ for (S32 i = 0; i < mNumSpawn; i++)
+ {
+ msg->getVector3("SpawnPointBlock", "SpawnPointPos", mSpawnPointPos[i], i);
+ }
+
+ // Update parts of the UI that change only when message received.
+
+ if (mTelehubObjectID.isNull())
+ {
+ getChildView("status_text_connected")->setVisible( false);
+ getChildView("status_text_not_connected")->setVisible( true);
+ getChildView("help_text_connected")->setVisible( false);
+ getChildView("help_text_not_connected")->setVisible( true);
+ }
+ else
+ {
+ getChild<LLUICtrl>("status_text_connected")->setTextArg("[OBJECT]", mTelehubObjectName);
+ getChildView("status_text_connected")->setVisible( true);
+ getChildView("status_text_not_connected")->setVisible( false);
+ getChildView("help_text_connected")->setVisible( true);
+ getChildView("help_text_not_connected")->setVisible( false);
+ }
+
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
+ if (list)
+ {
+ list->deleteAllItems();
+ for (S32 i = 0; i < mNumSpawn; i++)
+ {
+ std::string pos = llformat("%.1f, %.1f, %.1f",
+ mSpawnPointPos[i].mV[VX],
+ mSpawnPointPos[i].mV[VY],
+ mSpawnPointPos[i].mV[VZ]);
+ list->addSimpleElement(pos);
+ }
+ list->selectNthItem(mNumSpawn - 1);
+ }
}
diff --git a/indra/newview/llfloatertelehub.h b/indra/newview/llfloatertelehub.h
index 9b9b11fb29..a42ed6e85c 100644
--- a/indra/newview/llfloatertelehub.h
+++ b/indra/newview/llfloatertelehub.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatertelehub.h
* @author James Cook
* @brief LLFloaterTelehub class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,40 +38,40 @@ const S32 MAX_SPAWNPOINTS_PER_TELEHUB = 16;
class LLFloaterTelehub : public LLFloater
{
public:
- LLFloaterTelehub(const LLSD& key);
- ~LLFloaterTelehub();
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ LLFloaterTelehub(const LLSD& key);
+ ~LLFloaterTelehub();
- /*virtual*/ void draw();
-
- static BOOL renderBeacons();
- static void addBeacons();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- void refresh();
- void sendTelehubInfoRequest();
+ /*virtual*/ void draw();
- void onClickConnect();
- void onClickDisconnect();
- void onClickAddSpawnPoint();
- void onClickRemoveSpawnPoint();
+ static BOOL renderBeacons();
+ static void addBeacons();
- static void processTelehubInfo(LLMessageSystem* msg, void**);
- void unpackTelehubInfo(LLMessageSystem* msg);
+ void refresh();
+ void sendTelehubInfoRequest();
+
+ void onClickConnect();
+ void onClickDisconnect();
+ void onClickAddSpawnPoint();
+ void onClickRemoveSpawnPoint();
+
+ static void processTelehubInfo(LLMessageSystem* msg, void**);
+ void unpackTelehubInfo(LLMessageSystem* msg);
private:
- LLUUID mTelehubObjectID; // null if no telehub
- std::string mTelehubObjectName;
- LLVector3 mTelehubPos; // region local, fallback if viewer can't see the object
- LLQuaternion mTelehubRot;
+ LLUUID mTelehubObjectID; // null if no telehub
+ std::string mTelehubObjectName;
+ LLVector3 mTelehubPos; // region local, fallback if viewer can't see the object
+ LLQuaternion mTelehubRot;
+
+ S32 mNumSpawn;
+ LLVector3 mSpawnPointPos[MAX_SPAWNPOINTS_PER_TELEHUB];
- S32 mNumSpawn;
- LLVector3 mSpawnPointPos[MAX_SPAWNPOINTS_PER_TELEHUB];
-
- LLSafeHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
- static LLFloaterTelehub* sInstance;
+ static LLFloaterTelehub* sInstance;
};
#endif
diff --git a/indra/newview/llfloatertestinspectors.cpp b/indra/newview/llfloatertestinspectors.cpp
index 8a1582569b..f6f4324e71 100644
--- a/indra/newview/llfloatertestinspectors.cpp
+++ b/indra/newview/llfloatertestinspectors.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloatertestinspectors.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,12 +34,12 @@
//#include "lluictrlfactory.h"
LLFloaterTestInspectors::LLFloaterTestInspectors(const LLSD& seed)
-: LLFloater(seed)
+: LLFloater(seed)
{
- mCommitCallbackRegistrar.add("ShowAvatarInspector",
- boost::bind(&LLFloaterTestInspectors::showAvatarInspector, this, _1, _2));
- mCommitCallbackRegistrar.add("ShowObjectInspector",
- boost::bind(&LLFloaterTestInspectors::showObjectInspector, this, _1, _2));
+ mCommitCallbackRegistrar.add("ShowAvatarInspector",
+ boost::bind(&LLFloaterTestInspectors::showAvatarInspector, this, _1, _2));
+ mCommitCallbackRegistrar.add("ShowObjectInspector",
+ boost::bind(&LLFloaterTestInspectors::showObjectInspector, this, _1, _2));
}
LLFloaterTestInspectors::~LLFloaterTestInspectors()
@@ -47,41 +47,41 @@ LLFloaterTestInspectors::~LLFloaterTestInspectors()
BOOL LLFloaterTestInspectors::postBuild()
{
- // Test the dummy widget construction code
- getChild<LLUICtrl>("intentionally-not-found")->setEnabled(true);
-
-// getChild<LLUICtrl>("avatar_2d_btn")->setCommitCallback(
-// boost::bind(&LLFloaterTestInspectors::onClickAvatar2D, this));
- getChild<LLUICtrl>("avatar_3d_btn")->setCommitCallback(
- boost::bind(&LLFloaterTestInspectors::onClickAvatar3D, this));
- getChild<LLUICtrl>("object_2d_btn")->setCommitCallback(
- boost::bind(&LLFloaterTestInspectors::onClickObject2D, this));
- getChild<LLUICtrl>("object_3d_btn")->setCommitCallback(
- boost::bind(&LLFloaterTestInspectors::onClickObject3D, this));
- getChild<LLUICtrl>("group_btn")->setCommitCallback(
- boost::bind(&LLFloaterTestInspectors::onClickGroup, this));
- getChild<LLUICtrl>("place_btn")->setCommitCallback(
- boost::bind(&LLFloaterTestInspectors::onClickPlace, this));
- getChild<LLUICtrl>("event_btn")->setCommitCallback(
- boost::bind(&LLFloaterTestInspectors::onClickEvent, this));
-
- return LLFloater::postBuild();
+ // Test the dummy widget construction code
+ getChild<LLUICtrl>("intentionally-not-found")->setEnabled(true);
+
+// getChild<LLUICtrl>("avatar_2d_btn")->setCommitCallback(
+// boost::bind(&LLFloaterTestInspectors::onClickAvatar2D, this));
+ getChild<LLUICtrl>("avatar_3d_btn")->setCommitCallback(
+ boost::bind(&LLFloaterTestInspectors::onClickAvatar3D, this));
+ getChild<LLUICtrl>("object_2d_btn")->setCommitCallback(
+ boost::bind(&LLFloaterTestInspectors::onClickObject2D, this));
+ getChild<LLUICtrl>("object_3d_btn")->setCommitCallback(
+ boost::bind(&LLFloaterTestInspectors::onClickObject3D, this));
+ getChild<LLUICtrl>("group_btn")->setCommitCallback(
+ boost::bind(&LLFloaterTestInspectors::onClickGroup, this));
+ getChild<LLUICtrl>("place_btn")->setCommitCallback(
+ boost::bind(&LLFloaterTestInspectors::onClickPlace, this));
+ getChild<LLUICtrl>("event_btn")->setCommitCallback(
+ boost::bind(&LLFloaterTestInspectors::onClickEvent, this));
+
+ return LLFloater::postBuild();
}
void LLFloaterTestInspectors::showAvatarInspector(LLUICtrl*, const LLSD& avatar_id)
{
- LLUUID id; // defaults to null
- if (LLStartUp::getStartupState() >= STATE_STARTED)
- {
- id = avatar_id.asUUID();
- }
- // spawns off mouse position automatically
- LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", id));
+ LLUUID id; // defaults to null
+ if (LLStartUp::getStartupState() >= STATE_STARTED)
+ {
+ id = avatar_id.asUUID();
+ }
+ // spawns off mouse position automatically
+ LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", id));
}
void LLFloaterTestInspectors::showObjectInspector(LLUICtrl*, const LLSD& object_id)
{
- LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", object_id));
+ LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", object_id));
}
void LLFloaterTestInspectors::onClickAvatar2D()
diff --git a/indra/newview/llfloatertestinspectors.h b/indra/newview/llfloatertestinspectors.h
index 1724a2e076..32954df66d 100644
--- a/indra/newview/llfloatertestinspectors.h
+++ b/indra/newview/llfloatertestinspectors.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloatertestinspectors.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,29 +31,29 @@ class LLSD;
class LLFloaterTestInspectors : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- // nothing yet
+ // nothing yet
private:
- // Construction handled by LLFloaterReg
- LLFloaterTestInspectors(const LLSD& seed);
- ~LLFloaterTestInspectors();
-
- /*virtual*/ BOOL postBuild();
-
- // Button callback to show
- void showAvatarInspector(LLUICtrl*, const LLSD& avatar_id);
- void showObjectInspector(LLUICtrl*, const LLSD& avatar_id);
-
- // Debug function hookups for buttons
- void onClickAvatar2D();
- void onClickAvatar3D();
- void onClickObject2D();
- void onClickObject3D();
- void onClickGroup();
- void onClickPlace();
- void onClickEvent();
+ // Construction handled by LLFloaterReg
+ LLFloaterTestInspectors(const LLSD& seed);
+ ~LLFloaterTestInspectors();
+
+ /*virtual*/ BOOL postBuild();
+
+ // Button callback to show
+ void showAvatarInspector(LLUICtrl*, const LLSD& avatar_id);
+ void showObjectInspector(LLUICtrl*, const LLSD& avatar_id);
+
+ // Debug function hookups for buttons
+ void onClickAvatar2D();
+ void onClickAvatar3D();
+ void onClickObject2D();
+ void onClickObject3D();
+ void onClickGroup();
+ void onClickPlace();
+ void onClickEvent();
};
#endif
diff --git a/indra/newview/llfloatertestlistview.cpp b/indra/newview/llfloatertestlistview.cpp
index 97cf95baed..a5b21a0ea2 100644
--- a/indra/newview/llfloatertestlistview.cpp
+++ b/indra/newview/llfloatertestlistview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertestlistview.cpp
* @brief Tests of programmatic manipulation of LLListView widgets
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,7 +28,7 @@
#include "llfloatertestlistview.h"
LLFloaterTestListView::LLFloaterTestListView(const LLSD& seed)
-: LLFloater(seed)
+: LLFloater(seed)
{}
LLFloaterTestListView::~LLFloaterTestListView()
diff --git a/indra/newview/llfloatertestlistview.h b/indra/newview/llfloatertestlistview.h
index 0d4c7eb793..95cb7f25f5 100644
--- a/indra/newview/llfloatertestlistview.h
+++ b/indra/newview/llfloatertestlistview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertestlistview.h
* @brief Tests of programmatic manipulation of LLListView widgets
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,12 +32,12 @@ class LLSD;
class LLFloaterTestListView : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
private:
- // Construction handled by LLFloaterReg
- LLFloaterTestListView(const LLSD& seed);
- ~LLFloaterTestListView();
+ // Construction handled by LLFloaterReg
+ LLFloaterTestListView(const LLSD& seed);
+ ~LLFloaterTestListView();
};
#endif
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 5fb4fb9b07..ccecdd89f0 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertools.cpp
* @brief The edit tools, including move, position, land, etc.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -95,11 +95,11 @@ bool LLFloaterTools::sPreviousFocusOnAvatar = false;
const std::string PANEL_NAMES[LLFloaterTools::PANEL_COUNT] =
{
- std::string("General"), // PANEL_GENERAL,
- std::string("Object"), // PANEL_OBJECT,
- std::string("Features"), // PANEL_FEATURES,
- std::string("Texture"), // PANEL_FACE,
- std::string("Content"), // PANEL_CONTENTS,
+ std::string("General"), // PANEL_GENERAL,
+ std::string("Object"), // PANEL_OBJECT,
+ std::string("Features"), // PANEL_FEATURES,
+ std::string("Texture"), // PANEL_FACE,
+ std::string("Content"), // PANEL_CONTENTS,
};
@@ -127,352 +127,352 @@ void commit_slider_zoom(LLUICtrl *ctrl);
class LLLandImpactsObserver : public LLParcelObserver
{
public:
- virtual void changed()
- {
- LLFloaterTools* tools_floater = LLFloaterReg::getTypedInstance<LLFloaterTools>("build");
- if(tools_floater)
- {
- tools_floater->updateLandImpacts();
- }
- }
+ virtual void changed()
+ {
+ LLFloaterTools* tools_floater = LLFloaterReg::getTypedInstance<LLFloaterTools>("build");
+ if(tools_floater)
+ {
+ tools_floater->updateLandImpacts();
+ }
+ }
};
//static
-void* LLFloaterTools::createPanelPermissions(void* data)
+void* LLFloaterTools::createPanelPermissions(void* data)
{
- LLFloaterTools* floater = (LLFloaterTools*)data;
- floater->mPanelPermissions = new LLPanelPermissions();
- return floater->mPanelPermissions;
+ LLFloaterTools* floater = (LLFloaterTools*)data;
+ floater->mPanelPermissions = new LLPanelPermissions();
+ return floater->mPanelPermissions;
}
//static
-void* LLFloaterTools::createPanelObject(void* data)
+void* LLFloaterTools::createPanelObject(void* data)
{
- LLFloaterTools* floater = (LLFloaterTools*)data;
- floater->mPanelObject = new LLPanelObject();
- return floater->mPanelObject;
+ LLFloaterTools* floater = (LLFloaterTools*)data;
+ floater->mPanelObject = new LLPanelObject();
+ return floater->mPanelObject;
}
//static
-void* LLFloaterTools::createPanelVolume(void* data)
+void* LLFloaterTools::createPanelVolume(void* data)
{
- LLFloaterTools* floater = (LLFloaterTools*)data;
- floater->mPanelVolume = new LLPanelVolume();
- return floater->mPanelVolume;
+ LLFloaterTools* floater = (LLFloaterTools*)data;
+ floater->mPanelVolume = new LLPanelVolume();
+ return floater->mPanelVolume;
}
//static
-void* LLFloaterTools::createPanelFace(void* data)
+void* LLFloaterTools::createPanelFace(void* data)
{
- LLFloaterTools* floater = (LLFloaterTools*)data;
- floater->mPanelFace = new LLPanelFace();
- return floater->mPanelFace;
+ LLFloaterTools* floater = (LLFloaterTools*)data;
+ floater->mPanelFace = new LLPanelFace();
+ return floater->mPanelFace;
}
//static
-void* LLFloaterTools::createPanelContents(void* data)
+void* LLFloaterTools::createPanelContents(void* data)
{
- LLFloaterTools* floater = (LLFloaterTools*)data;
- floater->mPanelContents = new LLPanelContents();
- return floater->mPanelContents;
+ LLFloaterTools* floater = (LLFloaterTools*)data;
+ floater->mPanelContents = new LLPanelContents();
+ return floater->mPanelContents;
}
//static
-void* LLFloaterTools::createPanelLandInfo(void* data)
+void* LLFloaterTools::createPanelLandInfo(void* data)
{
- LLFloaterTools* floater = (LLFloaterTools*)data;
- floater->mPanelLandInfo = new LLPanelLandInfo();
- return floater->mPanelLandInfo;
+ LLFloaterTools* floater = (LLFloaterTools*)data;
+ floater->mPanelLandInfo = new LLPanelLandInfo();
+ return floater->mPanelLandInfo;
}
-static const std::string toolNames[]={
- "ToolCube",
- "ToolPrism",
- "ToolPyramid",
- "ToolTetrahedron",
- "ToolCylinder",
- "ToolHemiCylinder",
- "ToolCone",
- "ToolHemiCone",
- "ToolSphere",
- "ToolHemiSphere",
- "ToolTorus",
- "ToolTube",
- "ToolRing",
- "ToolTree",
- "ToolGrass"};
+static const std::string toolNames[]={
+ "ToolCube",
+ "ToolPrism",
+ "ToolPyramid",
+ "ToolTetrahedron",
+ "ToolCylinder",
+ "ToolHemiCylinder",
+ "ToolCone",
+ "ToolHemiCone",
+ "ToolSphere",
+ "ToolHemiSphere",
+ "ToolTorus",
+ "ToolTube",
+ "ToolRing",
+ "ToolTree",
+ "ToolGrass"};
LLPCode toolData[]={
- LL_PCODE_CUBE,
- LL_PCODE_PRISM,
- LL_PCODE_PYRAMID,
- LL_PCODE_TETRAHEDRON,
- LL_PCODE_CYLINDER,
- LL_PCODE_CYLINDER_HEMI,
- LL_PCODE_CONE,
- LL_PCODE_CONE_HEMI,
- LL_PCODE_SPHERE,
- LL_PCODE_SPHERE_HEMI,
- LL_PCODE_TORUS,
- LLViewerObject::LL_VO_SQUARE_TORUS,
- LLViewerObject::LL_VO_TRIANGLE_TORUS,
- LL_PCODE_LEGACY_TREE,
- LL_PCODE_LEGACY_GRASS};
-
-BOOL LLFloaterTools::postBuild()
-{
- // Hide until tool selected
- setVisible(FALSE);
-
- // Since we constantly show and hide this during drags, don't
- // make sounds on visibility changes.
- setSoundFlags(LLView::SILENT);
-
- getDragHandle()->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") );
-
- LLRect rect;
- mBtnFocus = getChild<LLButton>("button focus");//btn;
- mBtnMove = getChild<LLButton>("button move");
- mBtnEdit = getChild<LLButton>("button edit");
- mBtnCreate = getChild<LLButton>("button create");
- mBtnLand = getChild<LLButton>("button land" );
- mTextStatus = getChild<LLTextBox>("text status");
- mRadioGroupFocus = getChild<LLRadioGroup>("focus_radio_group");
- mRadioGroupMove = getChild<LLRadioGroup>("move_radio_group");
- mRadioGroupEdit = getChild<LLRadioGroup>("edit_radio_group");
- mBtnGridOptions = getChild<LLButton>("Options...");
- mBtnLink = getChild<LLButton>("link_btn");
- mBtnUnlink = getChild<LLButton>("unlink_btn");
-
- mCheckSelectIndividual = getChild<LLCheckBoxCtrl>("checkbox edit linked parts");
- getChild<LLUICtrl>("checkbox edit linked parts")->setValue((BOOL)gSavedSettings.getBOOL("EditLinkedParts"));
- mCheckSnapToGrid = getChild<LLCheckBoxCtrl>("checkbox snap to grid");
- getChild<LLUICtrl>("checkbox snap to grid")->setValue((BOOL)gSavedSettings.getBOOL("SnapEnabled"));
- mCheckStretchUniform = getChild<LLCheckBoxCtrl>("checkbox uniform");
- getChild<LLUICtrl>("checkbox uniform")->setValue((BOOL)gSavedSettings.getBOOL("ScaleUniform"));
- mCheckStretchTexture = getChild<LLCheckBoxCtrl>("checkbox stretch textures");
- getChild<LLUICtrl>("checkbox stretch textures")->setValue((BOOL)gSavedSettings.getBOOL("ScaleStretchTextures"));
- mComboGridMode = getChild<LLComboBox>("combobox grid mode");
-
- //
- // Create Buttons
- //
-
- for(size_t t=0; t<LL_ARRAY_SIZE(toolNames); ++t)
- {
- LLButton *found = getChild<LLButton>(toolNames[t]);
- if(found)
- {
- found->setClickedCallback(boost::bind(&LLFloaterTools::setObjectType, toolData[t]));
- mButtons.push_back( found );
- }else{
- LL_WARNS() << "Tool button not found! DOA Pending." << LL_ENDL;
- }
- }
- mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection");
- getChild<LLUICtrl>("checkbox copy selection")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopySelection"));
- mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky");
- getChild<LLUICtrl>("checkbox sticky")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected"));
- mCheckCopyCenters = getChild<LLCheckBoxCtrl>("checkbox copy centers");
- getChild<LLUICtrl>("checkbox copy centers")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters"));
- mCheckCopyRotates = getChild<LLCheckBoxCtrl>("checkbox copy rotates");
- getChild<LLUICtrl>("checkbox copy rotates")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates"));
-
- mRadioGroupLand = getChild<LLRadioGroup>("land_radio_group");
- mBtnApplyToSelection = getChild<LLButton>("button apply to selection");
- mSliderDozerSize = getChild<LLSlider>("slider brush size");
- getChild<LLUICtrl>("slider brush size")->setValue(gSavedSettings.getF32("LandBrushSize"));
- mSliderDozerForce = getChild<LLSlider>("slider force");
- // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here
- getChild<LLUICtrl>("slider force")->setValue(log10(gSavedSettings.getF32("LandBrushForce")));
-
- mCostTextBorder = getChild<LLViewBorder>("cost_text_border");
-
- mTab = getChild<LLTabContainer>("Object Info Tabs");
- if(mTab)
- {
- mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
- mTab->setBorderVisible(FALSE);
- mTab->selectFirstTab();
- }
-
- mStatusText["rotate"] = getString("status_rotate");
- mStatusText["scale"] = getString("status_scale");
- mStatusText["move"] = getString("status_move");
- mStatusText["modifyland"] = getString("status_modifyland");
- mStatusText["camera"] = getString("status_camera");
- mStatusText["grab"] = getString("status_grab");
- mStatusText["place"] = getString("status_place");
- mStatusText["selectland"] = getString("status_selectland");
-
- sShowObjectCost = gSavedSettings.getBOOL("ShowObjectRenderingCost");
-
- return TRUE;
+ LL_PCODE_CUBE,
+ LL_PCODE_PRISM,
+ LL_PCODE_PYRAMID,
+ LL_PCODE_TETRAHEDRON,
+ LL_PCODE_CYLINDER,
+ LL_PCODE_CYLINDER_HEMI,
+ LL_PCODE_CONE,
+ LL_PCODE_CONE_HEMI,
+ LL_PCODE_SPHERE,
+ LL_PCODE_SPHERE_HEMI,
+ LL_PCODE_TORUS,
+ LLViewerObject::LL_VO_SQUARE_TORUS,
+ LLViewerObject::LL_VO_TRIANGLE_TORUS,
+ LL_PCODE_LEGACY_TREE,
+ LL_PCODE_LEGACY_GRASS};
+
+BOOL LLFloaterTools::postBuild()
+{
+ // Hide until tool selected
+ setVisible(FALSE);
+
+ // Since we constantly show and hide this during drags, don't
+ // make sounds on visibility changes.
+ setSoundFlags(LLView::SILENT);
+
+ getDragHandle()->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") );
+
+ LLRect rect;
+ mBtnFocus = getChild<LLButton>("button focus");//btn;
+ mBtnMove = getChild<LLButton>("button move");
+ mBtnEdit = getChild<LLButton>("button edit");
+ mBtnCreate = getChild<LLButton>("button create");
+ mBtnLand = getChild<LLButton>("button land" );
+ mTextStatus = getChild<LLTextBox>("text status");
+ mRadioGroupFocus = getChild<LLRadioGroup>("focus_radio_group");
+ mRadioGroupMove = getChild<LLRadioGroup>("move_radio_group");
+ mRadioGroupEdit = getChild<LLRadioGroup>("edit_radio_group");
+ mBtnGridOptions = getChild<LLButton>("Options...");
+ mBtnLink = getChild<LLButton>("link_btn");
+ mBtnUnlink = getChild<LLButton>("unlink_btn");
+
+ mCheckSelectIndividual = getChild<LLCheckBoxCtrl>("checkbox edit linked parts");
+ getChild<LLUICtrl>("checkbox edit linked parts")->setValue((BOOL)gSavedSettings.getBOOL("EditLinkedParts"));
+ mCheckSnapToGrid = getChild<LLCheckBoxCtrl>("checkbox snap to grid");
+ getChild<LLUICtrl>("checkbox snap to grid")->setValue((BOOL)gSavedSettings.getBOOL("SnapEnabled"));
+ mCheckStretchUniform = getChild<LLCheckBoxCtrl>("checkbox uniform");
+ getChild<LLUICtrl>("checkbox uniform")->setValue((BOOL)gSavedSettings.getBOOL("ScaleUniform"));
+ mCheckStretchTexture = getChild<LLCheckBoxCtrl>("checkbox stretch textures");
+ getChild<LLUICtrl>("checkbox stretch textures")->setValue((BOOL)gSavedSettings.getBOOL("ScaleStretchTextures"));
+ mComboGridMode = getChild<LLComboBox>("combobox grid mode");
+
+ //
+ // Create Buttons
+ //
+
+ for(size_t t=0; t<LL_ARRAY_SIZE(toolNames); ++t)
+ {
+ LLButton *found = getChild<LLButton>(toolNames[t]);
+ if(found)
+ {
+ found->setClickedCallback(boost::bind(&LLFloaterTools::setObjectType, toolData[t]));
+ mButtons.push_back( found );
+ }else{
+ LL_WARNS() << "Tool button not found! DOA Pending." << LL_ENDL;
+ }
+ }
+ mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection");
+ getChild<LLUICtrl>("checkbox copy selection")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopySelection"));
+ mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky");
+ getChild<LLUICtrl>("checkbox sticky")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected"));
+ mCheckCopyCenters = getChild<LLCheckBoxCtrl>("checkbox copy centers");
+ getChild<LLUICtrl>("checkbox copy centers")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters"));
+ mCheckCopyRotates = getChild<LLCheckBoxCtrl>("checkbox copy rotates");
+ getChild<LLUICtrl>("checkbox copy rotates")->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates"));
+
+ mRadioGroupLand = getChild<LLRadioGroup>("land_radio_group");
+ mBtnApplyToSelection = getChild<LLButton>("button apply to selection");
+ mSliderDozerSize = getChild<LLSlider>("slider brush size");
+ getChild<LLUICtrl>("slider brush size")->setValue(gSavedSettings.getF32("LandBrushSize"));
+ mSliderDozerForce = getChild<LLSlider>("slider force");
+ // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here
+ getChild<LLUICtrl>("slider force")->setValue(log10(gSavedSettings.getF32("LandBrushForce")));
+
+ mCostTextBorder = getChild<LLViewBorder>("cost_text_border");
+
+ mTab = getChild<LLTabContainer>("Object Info Tabs");
+ if(mTab)
+ {
+ mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
+ mTab->setBorderVisible(FALSE);
+ mTab->selectFirstTab();
+ }
+
+ mStatusText["rotate"] = getString("status_rotate");
+ mStatusText["scale"] = getString("status_scale");
+ mStatusText["move"] = getString("status_move");
+ mStatusText["modifyland"] = getString("status_modifyland");
+ mStatusText["camera"] = getString("status_camera");
+ mStatusText["grab"] = getString("status_grab");
+ mStatusText["place"] = getString("status_place");
+ mStatusText["selectland"] = getString("status_selectland");
+
+ sShowObjectCost = gSavedSettings.getBOOL("ShowObjectRenderingCost");
+
+ return TRUE;
}
// Create the popupview with a dummy center. It will be moved into place
// during LLViewerWindow's per-frame hover processing.
LLFloaterTools::LLFloaterTools(const LLSD& key)
-: LLFloater(key),
- mBtnFocus(NULL),
- mBtnMove(NULL),
- mBtnEdit(NULL),
- mBtnCreate(NULL),
- mBtnLand(NULL),
- mTextStatus(NULL),
-
- mRadioGroupFocus(NULL),
- mRadioGroupMove(NULL),
- mRadioGroupEdit(NULL),
-
- mCheckSelectIndividual(NULL),
-
- mCheckSnapToGrid(NULL),
- mBtnGridOptions(NULL),
- mComboGridMode(NULL),
- mCheckStretchUniform(NULL),
- mCheckStretchTexture(NULL),
- mCheckStretchUniformLabel(NULL),
-
- mBtnRotateLeft(NULL),
- mBtnRotateReset(NULL),
- mBtnRotateRight(NULL),
-
- mBtnLink(NULL),
- mBtnUnlink(NULL),
-
- mBtnDelete(NULL),
- mBtnDuplicate(NULL),
- mBtnDuplicateInPlace(NULL),
-
- mCheckSticky(NULL),
- mCheckCopySelection(NULL),
- mCheckCopyCenters(NULL),
- mCheckCopyRotates(NULL),
- mRadioGroupLand(NULL),
- mSliderDozerSize(NULL),
- mSliderDozerForce(NULL),
- mBtnApplyToSelection(NULL),
-
- mTab(NULL),
- mPanelPermissions(NULL),
- mPanelObject(NULL),
- mPanelVolume(NULL),
- mPanelContents(NULL),
- mPanelFace(NULL),
- mPanelLandInfo(NULL),
-
- mCostTextBorder(NULL),
- mTabLand(NULL),
-
- mLandImpactsObserver(NULL),
-
- mDirty(TRUE),
- mHasSelection(TRUE)
+: LLFloater(key),
+ mBtnFocus(NULL),
+ mBtnMove(NULL),
+ mBtnEdit(NULL),
+ mBtnCreate(NULL),
+ mBtnLand(NULL),
+ mTextStatus(NULL),
+
+ mRadioGroupFocus(NULL),
+ mRadioGroupMove(NULL),
+ mRadioGroupEdit(NULL),
+
+ mCheckSelectIndividual(NULL),
+
+ mCheckSnapToGrid(NULL),
+ mBtnGridOptions(NULL),
+ mComboGridMode(NULL),
+ mCheckStretchUniform(NULL),
+ mCheckStretchTexture(NULL),
+ mCheckStretchUniformLabel(NULL),
+
+ mBtnRotateLeft(NULL),
+ mBtnRotateReset(NULL),
+ mBtnRotateRight(NULL),
+
+ mBtnLink(NULL),
+ mBtnUnlink(NULL),
+
+ mBtnDelete(NULL),
+ mBtnDuplicate(NULL),
+ mBtnDuplicateInPlace(NULL),
+
+ mCheckSticky(NULL),
+ mCheckCopySelection(NULL),
+ mCheckCopyCenters(NULL),
+ mCheckCopyRotates(NULL),
+ mRadioGroupLand(NULL),
+ mSliderDozerSize(NULL),
+ mSliderDozerForce(NULL),
+ mBtnApplyToSelection(NULL),
+
+ mTab(NULL),
+ mPanelPermissions(NULL),
+ mPanelObject(NULL),
+ mPanelVolume(NULL),
+ mPanelContents(NULL),
+ mPanelFace(NULL),
+ mPanelLandInfo(NULL),
+
+ mCostTextBorder(NULL),
+ mTabLand(NULL),
+
+ mLandImpactsObserver(NULL),
+
+ mDirty(TRUE),
+ mHasSelection(TRUE)
{
- gFloaterTools = this;
-
- setAutoFocus(FALSE);
- mFactoryMap["General"] = LLCallbackMap(createPanelPermissions, this);//LLPanelPermissions
- mFactoryMap["Object"] = LLCallbackMap(createPanelObject, this);//LLPanelObject
- mFactoryMap["Features"] = LLCallbackMap(createPanelVolume, this);//LLPanelVolume
- mFactoryMap["Texture"] = LLCallbackMap(createPanelFace, this);//LLPanelFace
- mFactoryMap["Contents"] = LLCallbackMap(createPanelContents, this);//LLPanelContents
- mFactoryMap["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo
-
- mCommitCallbackRegistrar.add("BuildTool.setTool", boost::bind(&LLFloaterTools::setTool,this, _2));
- mCommitCallbackRegistrar.add("BuildTool.commitZoom", boost::bind(&commit_slider_zoom, _1));
- mCommitCallbackRegistrar.add("BuildTool.commitRadioFocus", boost::bind(&commit_radio_group_focus, _1));
- mCommitCallbackRegistrar.add("BuildTool.commitRadioMove", boost::bind(&commit_radio_group_move,_1));
- mCommitCallbackRegistrar.add("BuildTool.commitRadioEdit", boost::bind(&commit_radio_group_edit,_1));
-
- mCommitCallbackRegistrar.add("BuildTool.gridMode", boost::bind(&commit_grid_mode,_1));
- mCommitCallbackRegistrar.add("BuildTool.selectComponent", boost::bind(&commit_select_component, this));
- mCommitCallbackRegistrar.add("BuildTool.gridOptions", boost::bind(&LLFloaterTools::onClickGridOptions,this));
- mCommitCallbackRegistrar.add("BuildTool.applyToSelection", boost::bind(&click_apply_to_selection, this));
- mCommitCallbackRegistrar.add("BuildTool.commitRadioLand", boost::bind(&commit_radio_group_land,_1));
- mCommitCallbackRegistrar.add("BuildTool.LandBrushForce", boost::bind(&commit_slider_dozer_force,_1));
-
- mCommitCallbackRegistrar.add("BuildTool.LinkObjects", boost::bind(&LLSelectMgr::linkObjects, LLSelectMgr::getInstance()));
- mCommitCallbackRegistrar.add("BuildTool.UnlinkObjects", boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance()));
-
- mLandImpactsObserver = new LLLandImpactsObserver();
- LLViewerParcelMgr::getInstance()->addObserver(mLandImpactsObserver);
+ gFloaterTools = this;
+
+ setAutoFocus(FALSE);
+ mFactoryMap["General"] = LLCallbackMap(createPanelPermissions, this);//LLPanelPermissions
+ mFactoryMap["Object"] = LLCallbackMap(createPanelObject, this);//LLPanelObject
+ mFactoryMap["Features"] = LLCallbackMap(createPanelVolume, this);//LLPanelVolume
+ mFactoryMap["Texture"] = LLCallbackMap(createPanelFace, this);//LLPanelFace
+ mFactoryMap["Contents"] = LLCallbackMap(createPanelContents, this);//LLPanelContents
+ mFactoryMap["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo
+
+ mCommitCallbackRegistrar.add("BuildTool.setTool", boost::bind(&LLFloaterTools::setTool,this, _2));
+ mCommitCallbackRegistrar.add("BuildTool.commitZoom", boost::bind(&commit_slider_zoom, _1));
+ mCommitCallbackRegistrar.add("BuildTool.commitRadioFocus", boost::bind(&commit_radio_group_focus, _1));
+ mCommitCallbackRegistrar.add("BuildTool.commitRadioMove", boost::bind(&commit_radio_group_move,_1));
+ mCommitCallbackRegistrar.add("BuildTool.commitRadioEdit", boost::bind(&commit_radio_group_edit,_1));
+
+ mCommitCallbackRegistrar.add("BuildTool.gridMode", boost::bind(&commit_grid_mode,_1));
+ mCommitCallbackRegistrar.add("BuildTool.selectComponent", boost::bind(&commit_select_component, this));
+ mCommitCallbackRegistrar.add("BuildTool.gridOptions", boost::bind(&LLFloaterTools::onClickGridOptions,this));
+ mCommitCallbackRegistrar.add("BuildTool.applyToSelection", boost::bind(&click_apply_to_selection, this));
+ mCommitCallbackRegistrar.add("BuildTool.commitRadioLand", boost::bind(&commit_radio_group_land,_1));
+ mCommitCallbackRegistrar.add("BuildTool.LandBrushForce", boost::bind(&commit_slider_dozer_force,_1));
+
+ mCommitCallbackRegistrar.add("BuildTool.LinkObjects", boost::bind(&LLSelectMgr::linkObjects, LLSelectMgr::getInstance()));
+ mCommitCallbackRegistrar.add("BuildTool.UnlinkObjects", boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance()));
+
+ mLandImpactsObserver = new LLLandImpactsObserver();
+ LLViewerParcelMgr::getInstance()->addObserver(mLandImpactsObserver);
}
LLFloaterTools::~LLFloaterTools()
{
- // children automatically deleted
- gFloaterTools = NULL;
+ // children automatically deleted
+ gFloaterTools = NULL;
- LLViewerParcelMgr::getInstance()->removeObserver(mLandImpactsObserver);
- delete mLandImpactsObserver;
+ LLViewerParcelMgr::getInstance()->removeObserver(mLandImpactsObserver);
+ delete mLandImpactsObserver;
}
void LLFloaterTools::setStatusText(const std::string& text)
{
- std::map<std::string, std::string>::iterator iter = mStatusText.find(text);
- if (iter != mStatusText.end())
- {
- mTextStatus->setText(iter->second);
- }
- else
- {
- mTextStatus->setText(text);
- }
+ std::map<std::string, std::string>::iterator iter = mStatusText.find(text);
+ if (iter != mStatusText.end())
+ {
+ mTextStatus->setText(iter->second);
+ }
+ else
+ {
+ mTextStatus->setText(text);
+ }
}
void LLFloaterTools::refresh()
{
- const S32 INFO_WIDTH = getRect().getWidth();
- const S32 INFO_HEIGHT = 384;
- LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT);
- BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
+ const S32 INFO_WIDTH = getRect().getWidth();
+ const S32 INFO_HEIGHT = 384;
+ LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT);
+ BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
- S32 idx_features = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FEATURES]);
- S32 idx_face = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FACE]);
- S32 idx_contents = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_CONTENTS]);
+ S32 idx_features = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FEATURES]);
+ S32 idx_face = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FACE]);
+ S32 idx_contents = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_CONTENTS]);
- S32 selected_index = mTab->getCurrentPanelIndex();
+ S32 selected_index = mTab->getCurrentPanelIndex();
- if (!all_volume && (selected_index == idx_features || selected_index == idx_face ||
- selected_index == idx_contents))
- {
- mTab->selectFirstTab();
- }
+ if (!all_volume && (selected_index == idx_features || selected_index == idx_face ||
+ selected_index == idx_contents))
+ {
+ mTab->selectFirstTab();
+ }
- mTab->enableTabButton(idx_features, all_volume);
- mTab->enableTabButton(idx_face, all_volume);
- mTab->enableTabButton(idx_contents, all_volume);
+ mTab->enableTabButton(idx_features, all_volume);
+ mTab->enableTabButton(idx_face, all_volume);
+ mTab->enableTabButton(idx_contents, all_volume);
- // Refresh object and prim count labels
- LLLocale locale(LLLocale::USER_LOCALE);
+ // Refresh object and prim count labels
+ LLLocale locale(LLLocale::USER_LOCALE);
#if 0
- if (!gMeshRepo.meshRezEnabled())
- {
- std::string obj_count_string;
- LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
- getChild<LLUICtrl>("selection_count")->setTextArg("[OBJ_COUNT]", obj_count_string);
- std::string prim_count_string;
- LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount());
- getChild<LLUICtrl>("selection_count")->setTextArg("[PRIM_COUNT]", prim_count_string);
-
- // calculate selection rendering cost
- if (sShowObjectCost)
- {
- std::string prim_cost_string;
- S32 render_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost();
- LLResMgr::getInstance()->getIntegerString(prim_cost_string, render_cost);
- getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string);
- }
-
- // disable the object and prim counts if nothing selected
- bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty();
- getChildView("obj_count")->setEnabled(have_selection);
- getChildView("prim_count")->setEnabled(have_selection);
- getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost);
- }
- else
+ if (!gMeshRepo.meshRezEnabled())
+ {
+ std::string obj_count_string;
+ LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
+ getChild<LLUICtrl>("selection_count")->setTextArg("[OBJ_COUNT]", obj_count_string);
+ std::string prim_count_string;
+ LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount());
+ getChild<LLUICtrl>("selection_count")->setTextArg("[PRIM_COUNT]", prim_count_string);
+
+ // calculate selection rendering cost
+ if (sShowObjectCost)
+ {
+ std::string prim_cost_string;
+ S32 render_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost();
+ LLResMgr::getInstance()->getIntegerString(prim_cost_string, render_cost);
+ getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string);
+ }
+
+ // disable the object and prim counts if nothing selected
+ bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty();
+ getChildView("obj_count")->setEnabled(have_selection);
+ getChildView("prim_count")->setEnabled(have_selection);
+ getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost);
+ }
+ else
#endif
- {
+ {
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
F32 link_cost = selection->getSelectedLinksetCost();
S32 link_count = selection->getRootObjectCount();
@@ -529,33 +529,33 @@ void LLFloaterTools::refresh()
&& LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool();
getChildView("selection_faces")->setVisible(show_faces);
- LLStringUtil::format_map_t selection_args;
- selection_args["OBJ_COUNT"] = llformat("%.1d", link_count);
- selection_args["LAND_IMPACT"] = llformat("%.1d", (S32)link_cost);
+ LLStringUtil::format_map_t selection_args;
+ selection_args["OBJ_COUNT"] = llformat("%.1d", link_count);
+ selection_args["LAND_IMPACT"] = llformat("%.1d", (S32)link_cost);
- std::ostringstream selection_info;
+ std::ostringstream selection_info;
- selection_info << getString("status_selectcount", selection_args);
+ selection_info << getString("status_selectcount", selection_args);
- getChild<LLTextBox>("selection_count")->setText(selection_info.str());
- }
+ getChild<LLTextBox>("selection_count")->setText(selection_info.str());
+ }
- // Refresh child tabs
- mPanelPermissions->refresh();
- mPanelObject->refresh();
- mPanelVolume->refresh();
- mPanelFace->refresh();
+ // Refresh child tabs
+ mPanelPermissions->refresh();
+ mPanelObject->refresh();
+ mPanelVolume->refresh();
+ mPanelFace->refresh();
mPanelFace->refreshMedia();
- mPanelContents->refresh();
- mPanelLandInfo->refresh();
-
- // Refresh the advanced weights floater
- LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::findTypedInstance<LLFloaterObjectWeights>("object_weights");
- if(object_weights_floater && object_weights_floater->getVisible())
- {
- object_weights_floater->refresh();
- }
+ mPanelContents->refresh();
+ mPanelLandInfo->refresh();
+
+ // Refresh the advanced weights floater
+ LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::findTypedInstance<LLFloaterObjectWeights>("object_weights");
+ if(object_weights_floater && object_weights_floater->getVisible())
+ {
+ object_weights_floater->refresh();
+ }
}
void LLFloaterTools::draw()
@@ -568,374 +568,374 @@ void LLFloaterTools::draw()
mHasSelection = has_selection;
if (mDirty)
- {
- refresh();
- mDirty = FALSE;
- }
+ {
+ refresh();
+ mDirty = FALSE;
+ }
- // mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts"));
- LLFloater::draw();
+ // mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts"));
+ LLFloater::draw();
}
void LLFloaterTools::dirty()
{
- mDirty = TRUE;
- LLFloaterOpenObject* instance = LLFloaterReg::findTypedInstance<LLFloaterOpenObject>("openobject");
- if (instance) instance->dirty();
+ mDirty = TRUE;
+ LLFloaterOpenObject* instance = LLFloaterReg::findTypedInstance<LLFloaterOpenObject>("openobject");
+ if (instance) instance->dirty();
}
// Clean up any tool state that should not persist when the
// floater is closed.
void LLFloaterTools::resetToolState()
{
- gCameraBtnZoom = TRUE;
- gCameraBtnOrbit = FALSE;
- gCameraBtnPan = FALSE;
+ gCameraBtnZoom = TRUE;
+ gCameraBtnOrbit = FALSE;
+ gCameraBtnPan = FALSE;
- gGrabBtnSpin = FALSE;
- gGrabBtnVertical = FALSE;
+ gGrabBtnSpin = FALSE;
+ gGrabBtnVertical = FALSE;
}
void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
{
- LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
-
- // HACK to allow seeing the buttons when you have the app in a window.
- // Keep the visibility the same as it
- if (tool == gToolNull)
- {
- return;
- }
-
- if ( isMinimized() )
- { // SL looks odd if we draw the tools while the window is minimized
- return;
- }
-
- // Focus buttons
- BOOL focus_visible = ( tool == LLToolCamera::getInstance() );
-
- mBtnFocus ->setToggleState( focus_visible );
-
- mRadioGroupFocus->setVisible( focus_visible );
- getChildView("slider zoom")->setVisible( focus_visible);
- getChildView("slider zoom")->setEnabled(gCameraBtnZoom);
-
- if (!gCameraBtnOrbit &&
- !gCameraBtnPan &&
- !(mask == MASK_ORBIT) &&
- !(mask == (MASK_ORBIT | MASK_ALT)) &&
- !(mask == MASK_PAN) &&
- !(mask == (MASK_PAN | MASK_ALT)) )
- {
- mRadioGroupFocus->setValue("radio zoom");
- }
- else if ( gCameraBtnOrbit ||
- (mask == MASK_ORBIT) ||
- (mask == (MASK_ORBIT | MASK_ALT)) )
- {
- mRadioGroupFocus->setValue("radio orbit");
- }
- else if ( gCameraBtnPan ||
- (mask == MASK_PAN) ||
- (mask == (MASK_PAN | MASK_ALT)) )
- {
- mRadioGroupFocus->setValue("radio pan");
- }
-
- // multiply by correction factor because volume sliders go [0, 0.5]
- getChild<LLUICtrl>("slider zoom")->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f);
-
- // Move buttons
- BOOL move_visible = (tool == LLToolGrab::getInstance());
-
- if (mBtnMove) mBtnMove ->setToggleState( move_visible );
-
- // HACK - highlight buttons for next click
- mRadioGroupMove->setVisible(move_visible);
- if (!(gGrabBtnSpin ||
- gGrabBtnVertical ||
- (mask == MASK_VERTICAL) ||
- (mask == MASK_SPIN)))
- {
- mRadioGroupMove->setValue("radio move");
- }
- else if ((mask == MASK_VERTICAL) ||
- (gGrabBtnVertical && (mask != MASK_SPIN)))
- {
- mRadioGroupMove->setValue("radio lift");
- }
- else if ((mask == MASK_SPIN) ||
- (gGrabBtnSpin && (mask != MASK_VERTICAL)))
- {
- mRadioGroupMove->setValue("radio spin");
- }
-
- // Edit buttons
- BOOL edit_visible = tool == LLToolCompTranslate::getInstance() ||
- tool == LLToolCompRotate::getInstance() ||
- tool == LLToolCompScale::getInstance() ||
- tool == LLToolFace::getInstance() ||
- tool == LLToolIndividual::getInstance() ||
- tool == LLToolPipette::getInstance();
-
- mBtnEdit ->setToggleState( edit_visible );
- mRadioGroupEdit->setVisible( edit_visible );
- //bool linked_parts = gSavedSettings.getBOOL("EditLinkedParts");
- //getChildView("RenderingCost")->setVisible( !linked_parts && (edit_visible || focus_visible || move_visible) && sShowObjectCost);
-
- mBtnLink->setVisible(edit_visible);
- mBtnUnlink->setVisible(edit_visible);
-
- mBtnLink->setEnabled(LLSelectMgr::instance().enableLinkObjects());
- mBtnUnlink->setEnabled(LLSelectMgr::instance().enableUnlinkObjects());
-
- if (mCheckSelectIndividual)
- {
- mCheckSelectIndividual->setVisible(edit_visible);
- //mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts"));
- }
-
- if ( tool == LLToolCompTranslate::getInstance() )
- {
- mRadioGroupEdit->setValue("radio position");
- }
- else if ( tool == LLToolCompRotate::getInstance() )
- {
- mRadioGroupEdit->setValue("radio rotate");
- }
- else if ( tool == LLToolCompScale::getInstance() )
- {
- mRadioGroupEdit->setValue("radio stretch");
- }
- else if ( tool == LLToolFace::getInstance() )
- {
- mRadioGroupEdit->setValue("radio select face");
- }
-
- if (mComboGridMode)
- {
- mComboGridMode->setVisible( edit_visible );
- S32 index = mComboGridMode->getCurrentIndex();
- mComboGridMode->removeall();
-
- switch (mObjectSelection->getSelectType())
- {
- case SELECT_TYPE_HUD:
- mComboGridMode->add(getString("grid_screen_text"));
- mComboGridMode->add(getString("grid_local_text"));
- break;
- case SELECT_TYPE_WORLD:
- mComboGridMode->add(getString("grid_world_text"));
- mComboGridMode->add(getString("grid_local_text"));
- mComboGridMode->add(getString("grid_reference_text"));
- break;
- case SELECT_TYPE_ATTACHMENT:
- mComboGridMode->add(getString("grid_attachment_text"));
- mComboGridMode->add(getString("grid_local_text"));
- mComboGridMode->add(getString("grid_reference_text"));
- break;
- }
-
- mComboGridMode->setCurrentByIndex(index);
- }
-
- // Snap to grid disabled for grab tool - very confusing
- if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ );
- if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ );
-
- //mCheckSelectLinked ->setVisible( edit_visible );
- if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible );
- if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible );
- if (mCheckStretchUniformLabel) mCheckStretchUniformLabel->setVisible( edit_visible );
-
- // Create buttons
- BOOL create_visible = (tool == LLToolCompCreate::getInstance());
-
- mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() );
-
- if (mCheckCopySelection
- && mCheckCopySelection->get())
- {
- // don't highlight any placer button
- for (std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++)
- {
- mButtons[i]->setToggleState(FALSE);
- mButtons[i]->setVisible( create_visible );
- }
- }
- else
- {
- // Highlight the correct placer button
- for( S32 t = 0; t < (S32)mButtons.size(); t++ )
- {
- LLPCode pcode = LLToolPlacer::getObjectType();
- LLPCode button_pcode = toolData[t];
- BOOL state = (pcode == button_pcode);
- mButtons[t]->setToggleState( state );
- mButtons[t]->setVisible( create_visible );
- }
- }
-
- if (mCheckSticky) mCheckSticky ->setVisible( create_visible );
- if (mCheckCopySelection) mCheckCopySelection ->setVisible( create_visible );
- if (mCheckCopyCenters) mCheckCopyCenters ->setVisible( create_visible );
- if (mCheckCopyRotates) mCheckCopyRotates ->setVisible( create_visible );
-
- if (mCheckCopyCenters && mCheckCopySelection) mCheckCopyCenters->setEnabled( mCheckCopySelection->get() );
- if (mCheckCopyRotates && mCheckCopySelection) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() );
-
- // Land buttons
- BOOL land_visible = (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance() );
-
- mCostTextBorder->setVisible(!land_visible);
-
- if (mBtnLand) mBtnLand ->setToggleState( land_visible );
-
- mRadioGroupLand->setVisible( land_visible );
- if ( tool == LLToolSelectLand::getInstance() )
- {
- mRadioGroupLand->setValue("radio select land");
- }
- else if ( tool == LLToolBrushLand::getInstance() )
- {
- S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction");
- switch(dozer_mode)
- {
- case 0:
- mRadioGroupLand->setValue("radio flatten");
- break;
- case 1:
- mRadioGroupLand->setValue("radio raise");
- break;
- case 2:
- mRadioGroupLand->setValue("radio lower");
- break;
- case 3:
- mRadioGroupLand->setValue("radio smooth");
- break;
- case 4:
- mRadioGroupLand->setValue("radio noise");
- break;
- case 5:
- mRadioGroupLand->setValue("radio revert");
- break;
- default:
- break;
- }
- }
-
- if (mBtnApplyToSelection)
- {
- mBtnApplyToSelection->setVisible( land_visible );
- mBtnApplyToSelection->setEnabled( land_visible && !LLViewerParcelMgr::getInstance()->selectionEmpty() && tool != LLToolSelectLand::getInstance());
- }
- if (mSliderDozerSize)
- {
- mSliderDozerSize ->setVisible( land_visible );
- getChildView("Bulldozer:")->setVisible( land_visible);
- getChildView("Dozer Size:")->setVisible( land_visible);
- }
- if (mSliderDozerForce)
- {
- mSliderDozerForce ->setVisible( land_visible );
- getChildView("Strength:")->setVisible( land_visible);
- }
-
- bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty();
-
- getChildView("selection_count")->setVisible(!land_visible && have_selection);
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
+
+ // HACK to allow seeing the buttons when you have the app in a window.
+ // Keep the visibility the same as it
+ if (tool == gToolNull)
+ {
+ return;
+ }
+
+ if ( isMinimized() )
+ { // SL looks odd if we draw the tools while the window is minimized
+ return;
+ }
+
+ // Focus buttons
+ BOOL focus_visible = ( tool == LLToolCamera::getInstance() );
+
+ mBtnFocus ->setToggleState( focus_visible );
+
+ mRadioGroupFocus->setVisible( focus_visible );
+ getChildView("slider zoom")->setVisible( focus_visible);
+ getChildView("slider zoom")->setEnabled(gCameraBtnZoom);
+
+ if (!gCameraBtnOrbit &&
+ !gCameraBtnPan &&
+ !(mask == MASK_ORBIT) &&
+ !(mask == (MASK_ORBIT | MASK_ALT)) &&
+ !(mask == MASK_PAN) &&
+ !(mask == (MASK_PAN | MASK_ALT)) )
+ {
+ mRadioGroupFocus->setValue("radio zoom");
+ }
+ else if ( gCameraBtnOrbit ||
+ (mask == MASK_ORBIT) ||
+ (mask == (MASK_ORBIT | MASK_ALT)) )
+ {
+ mRadioGroupFocus->setValue("radio orbit");
+ }
+ else if ( gCameraBtnPan ||
+ (mask == MASK_PAN) ||
+ (mask == (MASK_PAN | MASK_ALT)) )
+ {
+ mRadioGroupFocus->setValue("radio pan");
+ }
+
+ // multiply by correction factor because volume sliders go [0, 0.5]
+ getChild<LLUICtrl>("slider zoom")->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f);
+
+ // Move buttons
+ BOOL move_visible = (tool == LLToolGrab::getInstance());
+
+ if (mBtnMove) mBtnMove ->setToggleState( move_visible );
+
+ // HACK - highlight buttons for next click
+ mRadioGroupMove->setVisible(move_visible);
+ if (!(gGrabBtnSpin ||
+ gGrabBtnVertical ||
+ (mask == MASK_VERTICAL) ||
+ (mask == MASK_SPIN)))
+ {
+ mRadioGroupMove->setValue("radio move");
+ }
+ else if ((mask == MASK_VERTICAL) ||
+ (gGrabBtnVertical && (mask != MASK_SPIN)))
+ {
+ mRadioGroupMove->setValue("radio lift");
+ }
+ else if ((mask == MASK_SPIN) ||
+ (gGrabBtnSpin && (mask != MASK_VERTICAL)))
+ {
+ mRadioGroupMove->setValue("radio spin");
+ }
+
+ // Edit buttons
+ BOOL edit_visible = tool == LLToolCompTranslate::getInstance() ||
+ tool == LLToolCompRotate::getInstance() ||
+ tool == LLToolCompScale::getInstance() ||
+ tool == LLToolFace::getInstance() ||
+ tool == LLToolIndividual::getInstance() ||
+ tool == LLToolPipette::getInstance();
+
+ mBtnEdit ->setToggleState( edit_visible );
+ mRadioGroupEdit->setVisible( edit_visible );
+ //bool linked_parts = gSavedSettings.getBOOL("EditLinkedParts");
+ //getChildView("RenderingCost")->setVisible( !linked_parts && (edit_visible || focus_visible || move_visible) && sShowObjectCost);
+
+ mBtnLink->setVisible(edit_visible);
+ mBtnUnlink->setVisible(edit_visible);
+
+ mBtnLink->setEnabled(LLSelectMgr::instance().enableLinkObjects());
+ mBtnUnlink->setEnabled(LLSelectMgr::instance().enableUnlinkObjects());
+
+ if (mCheckSelectIndividual)
+ {
+ mCheckSelectIndividual->setVisible(edit_visible);
+ //mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts"));
+ }
+
+ if ( tool == LLToolCompTranslate::getInstance() )
+ {
+ mRadioGroupEdit->setValue("radio position");
+ }
+ else if ( tool == LLToolCompRotate::getInstance() )
+ {
+ mRadioGroupEdit->setValue("radio rotate");
+ }
+ else if ( tool == LLToolCompScale::getInstance() )
+ {
+ mRadioGroupEdit->setValue("radio stretch");
+ }
+ else if ( tool == LLToolFace::getInstance() )
+ {
+ mRadioGroupEdit->setValue("radio select face");
+ }
+
+ if (mComboGridMode)
+ {
+ mComboGridMode->setVisible( edit_visible );
+ S32 index = mComboGridMode->getCurrentIndex();
+ mComboGridMode->removeall();
+
+ switch (mObjectSelection->getSelectType())
+ {
+ case SELECT_TYPE_HUD:
+ mComboGridMode->add(getString("grid_screen_text"));
+ mComboGridMode->add(getString("grid_local_text"));
+ break;
+ case SELECT_TYPE_WORLD:
+ mComboGridMode->add(getString("grid_world_text"));
+ mComboGridMode->add(getString("grid_local_text"));
+ mComboGridMode->add(getString("grid_reference_text"));
+ break;
+ case SELECT_TYPE_ATTACHMENT:
+ mComboGridMode->add(getString("grid_attachment_text"));
+ mComboGridMode->add(getString("grid_local_text"));
+ mComboGridMode->add(getString("grid_reference_text"));
+ break;
+ }
+
+ mComboGridMode->setCurrentByIndex(index);
+ }
+
+ // Snap to grid disabled for grab tool - very confusing
+ if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ );
+ if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ );
+
+ //mCheckSelectLinked ->setVisible( edit_visible );
+ if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible );
+ if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible );
+ if (mCheckStretchUniformLabel) mCheckStretchUniformLabel->setVisible( edit_visible );
+
+ // Create buttons
+ BOOL create_visible = (tool == LLToolCompCreate::getInstance());
+
+ mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() );
+
+ if (mCheckCopySelection
+ && mCheckCopySelection->get())
+ {
+ // don't highlight any placer button
+ for (std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++)
+ {
+ mButtons[i]->setToggleState(FALSE);
+ mButtons[i]->setVisible( create_visible );
+ }
+ }
+ else
+ {
+ // Highlight the correct placer button
+ for( S32 t = 0; t < (S32)mButtons.size(); t++ )
+ {
+ LLPCode pcode = LLToolPlacer::getObjectType();
+ LLPCode button_pcode = toolData[t];
+ BOOL state = (pcode == button_pcode);
+ mButtons[t]->setToggleState( state );
+ mButtons[t]->setVisible( create_visible );
+ }
+ }
+
+ if (mCheckSticky) mCheckSticky ->setVisible( create_visible );
+ if (mCheckCopySelection) mCheckCopySelection ->setVisible( create_visible );
+ if (mCheckCopyCenters) mCheckCopyCenters ->setVisible( create_visible );
+ if (mCheckCopyRotates) mCheckCopyRotates ->setVisible( create_visible );
+
+ if (mCheckCopyCenters && mCheckCopySelection) mCheckCopyCenters->setEnabled( mCheckCopySelection->get() );
+ if (mCheckCopyRotates && mCheckCopySelection) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() );
+
+ // Land buttons
+ BOOL land_visible = (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance() );
+
+ mCostTextBorder->setVisible(!land_visible);
+
+ if (mBtnLand) mBtnLand ->setToggleState( land_visible );
+
+ mRadioGroupLand->setVisible( land_visible );
+ if ( tool == LLToolSelectLand::getInstance() )
+ {
+ mRadioGroupLand->setValue("radio select land");
+ }
+ else if ( tool == LLToolBrushLand::getInstance() )
+ {
+ S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction");
+ switch(dozer_mode)
+ {
+ case 0:
+ mRadioGroupLand->setValue("radio flatten");
+ break;
+ case 1:
+ mRadioGroupLand->setValue("radio raise");
+ break;
+ case 2:
+ mRadioGroupLand->setValue("radio lower");
+ break;
+ case 3:
+ mRadioGroupLand->setValue("radio smooth");
+ break;
+ case 4:
+ mRadioGroupLand->setValue("radio noise");
+ break;
+ case 5:
+ mRadioGroupLand->setValue("radio revert");
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (mBtnApplyToSelection)
+ {
+ mBtnApplyToSelection->setVisible( land_visible );
+ mBtnApplyToSelection->setEnabled( land_visible && !LLViewerParcelMgr::getInstance()->selectionEmpty() && tool != LLToolSelectLand::getInstance());
+ }
+ if (mSliderDozerSize)
+ {
+ mSliderDozerSize ->setVisible( land_visible );
+ getChildView("Bulldozer:")->setVisible( land_visible);
+ getChildView("Dozer Size:")->setVisible( land_visible);
+ }
+ if (mSliderDozerForce)
+ {
+ mSliderDozerForce ->setVisible( land_visible );
+ getChildView("Strength:")->setVisible( land_visible);
+ }
+
+ bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty();
+
+ getChildView("selection_count")->setVisible(!land_visible && have_selection);
getChildView("selection_faces")->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()
&& LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1);
- getChildView("selection_empty")->setVisible(!land_visible && !have_selection);
-
- mTab->setVisible(!land_visible);
- mPanelLandInfo->setVisible(land_visible);
+ getChildView("selection_empty")->setVisible(!land_visible && !have_selection);
+
+ mTab->setVisible(!land_visible);
+ mPanelLandInfo->setVisible(land_visible);
}
// virtual
BOOL LLFloaterTools::canClose()
{
- // don't close when quitting, so camera will stay put
- return !LLApp::isExiting();
+ // don't close when quitting, so camera will stay put
+ return !LLApp::isExiting();
}
// virtual
void LLFloaterTools::onOpen(const LLSD& key)
{
- mParcelSelection = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection();
- mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
-
- std::string panel = key.asString();
- if (!panel.empty())
- {
- mTab->selectTabByName(panel);
- }
-
- LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
- if (tool == LLToolCompInspect::getInstance()
- || tool == LLToolDragAndDrop::getInstance())
- {
- // Something called floater up while it was supressed (during drag n drop, inspect),
- // so it won't be getting any layout or visibility updates, update once
- // further updates will come from updateLayout()
- LLCoordGL select_center_screen;
- MASK mask = gKeyboard->currentMask(TRUE);
- updatePopup(select_center_screen, mask);
- }
-
- //gMenuBarView->setItemVisible("BuildTools", TRUE);
+ mParcelSelection = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection();
+ mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+
+ std::string panel = key.asString();
+ if (!panel.empty())
+ {
+ mTab->selectTabByName(panel);
+ }
+
+ LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (tool == LLToolCompInspect::getInstance()
+ || tool == LLToolDragAndDrop::getInstance())
+ {
+ // Something called floater up while it was supressed (during drag n drop, inspect),
+ // so it won't be getting any layout or visibility updates, update once
+ // further updates will come from updateLayout()
+ LLCoordGL select_center_screen;
+ MASK mask = gKeyboard->currentMask(TRUE);
+ updatePopup(select_center_screen, mask);
+ }
+
+ //gMenuBarView->setItemVisible("BuildTools", TRUE);
}
// virtual
void LLFloaterTools::onClose(bool app_quitting)
{
- mTab->setVisible(FALSE);
+ mTab->setVisible(FALSE);
- LLViewerJoystick::getInstance()->moveAvatar(false);
+ LLViewerJoystick::getInstance()->moveAvatar(false);
- // destroy media source used to grab media title
- mPanelFace->unloadMedia();
+ // destroy media source used to grab media title
+ mPanelFace->unloadMedia();
- // Different from handle_reset_view in that it doesn't actually
- // move the camera if EditCameraMovement is not set.
- gAgentCamera.resetView(gSavedSettings.getBOOL("EditCameraMovement"));
-
- // exit component selection mode
- LLSelectMgr::getInstance()->promoteSelectionToRoot();
- gSavedSettings.setBOOL("EditLinkedParts", FALSE);
+ // Different from handle_reset_view in that it doesn't actually
+ // move the camera if EditCameraMovement is not set.
+ gAgentCamera.resetView(gSavedSettings.getBOOL("EditCameraMovement"));
- gViewerWindow->showCursor();
+ // exit component selection mode
+ LLSelectMgr::getInstance()->promoteSelectionToRoot();
+ gSavedSettings.setBOOL("EditLinkedParts", FALSE);
- resetToolState();
+ gViewerWindow->showCursor();
- mParcelSelection = NULL;
- mObjectSelection = NULL;
+ resetToolState();
- // Switch back to basic toolset
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- // we were already in basic toolset, using build tools
- // so manually reset tool to default (pie menu tool)
- LLToolMgr::getInstance()->getCurrentToolset()->selectFirstTool();
+ mParcelSelection = NULL;
+ mObjectSelection = NULL;
- //gMenuBarView->setItemVisible("BuildTools", FALSE);
- LLFloaterReg::hideInstance("media_settings");
+ // Switch back to basic toolset
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ // we were already in basic toolset, using build tools
+ // so manually reset tool to default (pie menu tool)
+ LLToolMgr::getInstance()->getCurrentToolset()->selectFirstTool();
- // hide the advanced object weights floater
- LLFloaterReg::hideInstance("object_weights");
+ //gMenuBarView->setItemVisible("BuildTools", FALSE);
+ LLFloaterReg::hideInstance("media_settings");
+
+ // hide the advanced object weights floater
+ LLFloaterReg::hideInstance("object_weights");
// hide gltf material editor
LLFloaterReg::hideInstance("live_material_editor");
- // prepare content for next call
- mPanelContents->clearContents();
+ // prepare content for next call
+ mPanelContents->clearContents();
- if(sPreviousFocusOnAvatar)
- {
- sPreviousFocusOnAvatar = false;
- gAgentCamera.setAllowChangeToFollow(TRUE);
- }
+ if(sPreviousFocusOnAvatar)
+ {
+ sPreviousFocusOnAvatar = false;
+ gAgentCamera.setAllowChangeToFollow(TRUE);
+ }
}
void click_popup_info(void*)
@@ -944,227 +944,227 @@ void click_popup_info(void*)
void click_popup_done(void*)
{
- handle_reset_view();
+ handle_reset_view();
}
void commit_radio_group_move(LLUICtrl* ctrl)
{
- LLRadioGroup* group = (LLRadioGroup*)ctrl;
- std::string selected = group->getValue().asString();
- if (selected == "radio move")
- {
- gGrabBtnVertical = FALSE;
- gGrabBtnSpin = FALSE;
- }
- else if (selected == "radio lift")
- {
- gGrabBtnVertical = TRUE;
- gGrabBtnSpin = FALSE;
- }
- else if (selected == "radio spin")
- {
- gGrabBtnVertical = FALSE;
- gGrabBtnSpin = TRUE;
- }
+ LLRadioGroup* group = (LLRadioGroup*)ctrl;
+ std::string selected = group->getValue().asString();
+ if (selected == "radio move")
+ {
+ gGrabBtnVertical = FALSE;
+ gGrabBtnSpin = FALSE;
+ }
+ else if (selected == "radio lift")
+ {
+ gGrabBtnVertical = TRUE;
+ gGrabBtnSpin = FALSE;
+ }
+ else if (selected == "radio spin")
+ {
+ gGrabBtnVertical = FALSE;
+ gGrabBtnSpin = TRUE;
+ }
}
void commit_radio_group_focus(LLUICtrl* ctrl)
{
- LLRadioGroup* group = (LLRadioGroup*)ctrl;
- std::string selected = group->getValue().asString();
- if (selected == "radio zoom")
- {
- gCameraBtnZoom = TRUE;
- gCameraBtnOrbit = FALSE;
- gCameraBtnPan = FALSE;
- }
- else if (selected == "radio orbit")
- {
- gCameraBtnZoom = FALSE;
- gCameraBtnOrbit = TRUE;
- gCameraBtnPan = FALSE;
- }
- else if (selected == "radio pan")
- {
- gCameraBtnZoom = FALSE;
- gCameraBtnOrbit = FALSE;
- gCameraBtnPan = TRUE;
- }
+ LLRadioGroup* group = (LLRadioGroup*)ctrl;
+ std::string selected = group->getValue().asString();
+ if (selected == "radio zoom")
+ {
+ gCameraBtnZoom = TRUE;
+ gCameraBtnOrbit = FALSE;
+ gCameraBtnPan = FALSE;
+ }
+ else if (selected == "radio orbit")
+ {
+ gCameraBtnZoom = FALSE;
+ gCameraBtnOrbit = TRUE;
+ gCameraBtnPan = FALSE;
+ }
+ else if (selected == "radio pan")
+ {
+ gCameraBtnZoom = FALSE;
+ gCameraBtnOrbit = FALSE;
+ gCameraBtnPan = TRUE;
+ }
}
void commit_slider_zoom(LLUICtrl *ctrl)
{
- // renormalize value, since max "volume" level is 0.5 for some reason
- F32 zoom_level = (F32)ctrl->getValue().asReal() * 2.f; // / 0.5f;
- gAgentCamera.setCameraZoomFraction(zoom_level);
+ // renormalize value, since max "volume" level is 0.5 for some reason
+ F32 zoom_level = (F32)ctrl->getValue().asReal() * 2.f; // / 0.5f;
+ gAgentCamera.setCameraZoomFraction(zoom_level);
}
void commit_slider_dozer_force(LLUICtrl *ctrl)
{
- // the slider is logarithmic, so we exponentiate to get the actual force multiplier
- F32 dozer_force = pow(10.f, (F32)ctrl->getValue().asReal());
- gSavedSettings.setF32("LandBrushForce", dozer_force);
+ // the slider is logarithmic, so we exponentiate to get the actual force multiplier
+ F32 dozer_force = pow(10.f, (F32)ctrl->getValue().asReal());
+ gSavedSettings.setF32("LandBrushForce", dozer_force);
}
void click_apply_to_selection(void*)
{
- LLToolBrushLand::getInstance()->modifyLandInSelectionGlobal();
+ LLToolBrushLand::getInstance()->modifyLandInSelectionGlobal();
}
void commit_radio_group_edit(LLUICtrl *ctrl)
{
- S32 show_owners = gSavedSettings.getBOOL("ShowParcelOwners");
-
- LLRadioGroup* group = (LLRadioGroup*)ctrl;
- std::string selected = group->getValue().asString();
- if (selected == "radio position")
- {
- LLFloaterTools::setEditTool( LLToolCompTranslate::getInstance() );
- }
- else if (selected == "radio rotate")
- {
- LLFloaterTools::setEditTool( LLToolCompRotate::getInstance() );
- }
- else if (selected == "radio stretch")
- {
- LLFloaterTools::setEditTool( LLToolCompScale::getInstance() );
- }
- else if (selected == "radio select face")
- {
- LLFloaterTools::setEditTool( LLToolFace::getInstance() );
- }
- gSavedSettings.setBOOL("ShowParcelOwners", show_owners);
+ S32 show_owners = gSavedSettings.getBOOL("ShowParcelOwners");
+
+ LLRadioGroup* group = (LLRadioGroup*)ctrl;
+ std::string selected = group->getValue().asString();
+ if (selected == "radio position")
+ {
+ LLFloaterTools::setEditTool( LLToolCompTranslate::getInstance() );
+ }
+ else if (selected == "radio rotate")
+ {
+ LLFloaterTools::setEditTool( LLToolCompRotate::getInstance() );
+ }
+ else if (selected == "radio stretch")
+ {
+ LLFloaterTools::setEditTool( LLToolCompScale::getInstance() );
+ }
+ else if (selected == "radio select face")
+ {
+ LLFloaterTools::setEditTool( LLToolFace::getInstance() );
+ }
+ gSavedSettings.setBOOL("ShowParcelOwners", show_owners);
}
void commit_radio_group_land(LLUICtrl* ctrl)
{
- LLRadioGroup* group = (LLRadioGroup*)ctrl;
- std::string selected = group->getValue().asString();
- if (selected == "radio select land")
- {
- LLFloaterTools::setEditTool( LLToolSelectLand::getInstance() );
- }
- else
- {
- LLFloaterTools::setEditTool( LLToolBrushLand::getInstance() );
- S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction");
- if (selected == "radio flatten")
- dozer_mode = 0;
- else if (selected == "radio raise")
- dozer_mode = 1;
- else if (selected == "radio lower")
- dozer_mode = 2;
- else if (selected == "radio smooth")
- dozer_mode = 3;
- else if (selected == "radio noise")
- dozer_mode = 4;
- else if (selected == "radio revert")
- dozer_mode = 5;
- gSavedSettings.setS32("RadioLandBrushAction", dozer_mode);
- }
+ LLRadioGroup* group = (LLRadioGroup*)ctrl;
+ std::string selected = group->getValue().asString();
+ if (selected == "radio select land")
+ {
+ LLFloaterTools::setEditTool( LLToolSelectLand::getInstance() );
+ }
+ else
+ {
+ LLFloaterTools::setEditTool( LLToolBrushLand::getInstance() );
+ S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction");
+ if (selected == "radio flatten")
+ dozer_mode = 0;
+ else if (selected == "radio raise")
+ dozer_mode = 1;
+ else if (selected == "radio lower")
+ dozer_mode = 2;
+ else if (selected == "radio smooth")
+ dozer_mode = 3;
+ else if (selected == "radio noise")
+ dozer_mode = 4;
+ else if (selected == "radio revert")
+ dozer_mode = 5;
+ gSavedSettings.setS32("RadioLandBrushAction", dozer_mode);
+ }
}
void commit_select_component(void *data)
{
- LLFloaterTools* floaterp = (LLFloaterTools*)data;
-
- //forfeit focus
- if (gFocusMgr.childHasKeyboardFocus(floaterp))
- {
- gFocusMgr.setKeyboardFocus(NULL);
- }
-
- BOOL select_individuals = floaterp->mCheckSelectIndividual->get();
- gSavedSettings.setBOOL("EditLinkedParts", select_individuals);
- floaterp->dirty();
-
- if (select_individuals)
- {
- LLSelectMgr::getInstance()->demoteSelectionToIndividuals();
- }
- else
- {
- LLSelectMgr::getInstance()->promoteSelectionToRoot();
- }
+ LLFloaterTools* floaterp = (LLFloaterTools*)data;
+
+ //forfeit focus
+ if (gFocusMgr.childHasKeyboardFocus(floaterp))
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+
+ BOOL select_individuals = floaterp->mCheckSelectIndividual->get();
+ gSavedSettings.setBOOL("EditLinkedParts", select_individuals);
+ floaterp->dirty();
+
+ if (select_individuals)
+ {
+ LLSelectMgr::getInstance()->demoteSelectionToIndividuals();
+ }
+ else
+ {
+ LLSelectMgr::getInstance()->promoteSelectionToRoot();
+ }
}
-// static
+// static
void LLFloaterTools::setObjectType( LLPCode pcode )
{
- LLToolPlacer::setObjectType( pcode );
- gSavedSettings.setBOOL("CreateToolCopySelection", FALSE);
- gFocusMgr.setMouseCapture(NULL);
+ LLToolPlacer::setObjectType( pcode );
+ gSavedSettings.setBOOL("CreateToolCopySelection", FALSE);
+ gFocusMgr.setMouseCapture(NULL);
}
void commit_grid_mode(LLUICtrl *ctrl)
{
- LLComboBox* combo = (LLComboBox*)ctrl;
+ LLComboBox* combo = (LLComboBox*)ctrl;
- LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
+ LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
}
// static
void LLFloaterTools::setGridMode(S32 mode)
{
- LLFloaterTools* tools_floater = LLFloaterReg::getTypedInstance<LLFloaterTools>("build");
- if (!tools_floater || !tools_floater->mComboGridMode)
- {
- return;
- }
+ LLFloaterTools* tools_floater = LLFloaterReg::getTypedInstance<LLFloaterTools>("build");
+ if (!tools_floater || !tools_floater->mComboGridMode)
+ {
+ return;
+ }
- tools_floater->mComboGridMode->setCurrentByIndex(mode);
+ tools_floater->mComboGridMode->setCurrentByIndex(mode);
}
void LLFloaterTools::onClickGridOptions()
{
- LLFloater* floaterp = LLFloaterReg::showInstance("build_options");
- // position floater next to build tools, not over
- floaterp->setShape(gFloaterView->findNeighboringPosition(this, floaterp), true);
+ LLFloater* floaterp = LLFloaterReg::showInstance("build_options");
+ // position floater next to build tools, not over
+ floaterp->setShape(gFloaterView->findNeighboringPosition(this, floaterp), true);
}
// static
void LLFloaterTools::setEditTool(void* tool_pointer)
{
- LLTool *tool = (LLTool *)tool_pointer;
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( tool );
+ LLTool *tool = (LLTool *)tool_pointer;
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( tool );
}
void LLFloaterTools::setTool(const LLSD& user_data)
{
- std::string control_name = user_data.asString();
- if(control_name == "Focus")
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool((LLTool *) LLToolCamera::getInstance() );
- else if (control_name == "Move" )
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool *)LLToolGrab::getInstance() );
- else if (control_name == "Edit" )
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool *) LLToolCompTranslate::getInstance());
- else if (control_name == "Create" )
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool *) LLToolCompCreate::getInstance());
- else if (control_name == "Land" )
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool *) LLToolSelectLand::getInstance());
- else
- LL_WARNS()<<" no parameter name "<<control_name<<" found!! No Tool selected!!"<< LL_ENDL;
+ std::string control_name = user_data.asString();
+ if(control_name == "Focus")
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool((LLTool *) LLToolCamera::getInstance() );
+ else if (control_name == "Move" )
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool *)LLToolGrab::getInstance() );
+ else if (control_name == "Edit" )
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool *) LLToolCompTranslate::getInstance());
+ else if (control_name == "Create" )
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool *) LLToolCompCreate::getInstance());
+ else if (control_name == "Land" )
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool *) LLToolSelectLand::getInstance());
+ else
+ LL_WARNS()<<" no parameter name "<<control_name<<" found!! No Tool selected!!"<< LL_ENDL;
}
void LLFloaterTools::onFocusReceived()
{
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- LLFloater::onFocusReceived();
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ LLFloater::onFocusReceived();
}
void LLFloaterTools::updateLandImpacts()
{
- LLParcel *parcel = mParcelSelection->getParcel();
- if (!parcel)
- {
- return;
- }
-
- // Update land impacts info in the weights floater
- LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::findTypedInstance<LLFloaterObjectWeights>("object_weights");
- if(object_weights_floater)
- {
- object_weights_floater->updateLandImpacts(parcel);
- }
+ LLParcel *parcel = mParcelSelection->getParcel();
+ if (!parcel)
+ {
+ return;
+ }
+
+ // Update land impacts info in the weights floater
+ LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::findTypedInstance<LLFloaterObjectWeights>("object_weights");
+ if(object_weights_floater)
+ {
+ object_weights_floater->updateLandImpacts(parcel);
+ }
}
diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h
index 3bb6492a6e..f6e03afc11 100644
--- a/indra/newview/llfloatertools.h
+++ b/indra/newview/llfloatertools.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertools.h
* @brief The edit tools, including move, position, land, etc.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,141 +55,141 @@ class LLFloaterTools
: public LLFloater
{
public:
- virtual BOOL postBuild();
- static void* createPanelPermissions(void* vdata);
- static void* createPanelObject(void* vdata);
- static void* createPanelVolume(void* vdata);
- static void* createPanelFace(void* vdata);
- static void* createPanelContents(void* vdata);
- static void* createPanelLandInfo(void* vdata);
-
- LLFloaterTools(const LLSD& key);
- virtual ~LLFloaterTools();
-
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ BOOL canClose();
- /*virtual*/ void onClose(bool app_quitting);
- /*virtual*/ void draw();
- /*virtual*/ void onFocusReceived();
-
- // call this once per frame to handle visibility, rect location,
- // button highlights, etc.
- void updatePopup(LLCoordGL center, MASK mask);
-
- // When the floater is going away, reset any options that need to be
- // cleared.
- void resetToolState();
-
- enum EInfoPanel
- {
- PANEL_GENERAL=0,
- PANEL_OBJECT,
- PANEL_FEATURES,
- PANEL_FACE,
- PANEL_CONTENTS,
- PANEL_COUNT
- };
-
- void dirty();
- void showPanel(EInfoPanel panel);
-
- void setStatusText(const std::string& text);
- static void setEditTool(void* data);
- void setTool(const LLSD& user_data);
- void saveLastTool();
- void updateLandImpacts();
-
- static void setGridMode(S32 mode);
-
- LLPanelFace* getPanelFace() { return mPanelFace; }
+ virtual BOOL postBuild();
+ static void* createPanelPermissions(void* vdata);
+ static void* createPanelObject(void* vdata);
+ static void* createPanelVolume(void* vdata);
+ static void* createPanelFace(void* vdata);
+ static void* createPanelContents(void* vdata);
+ static void* createPanelLandInfo(void* vdata);
+
+ LLFloaterTools(const LLSD& key);
+ virtual ~LLFloaterTools();
+
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL canClose();
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void draw();
+ /*virtual*/ void onFocusReceived();
+
+ // call this once per frame to handle visibility, rect location,
+ // button highlights, etc.
+ void updatePopup(LLCoordGL center, MASK mask);
+
+ // When the floater is going away, reset any options that need to be
+ // cleared.
+ void resetToolState();
+
+ enum EInfoPanel
+ {
+ PANEL_GENERAL=0,
+ PANEL_OBJECT,
+ PANEL_FEATURES,
+ PANEL_FACE,
+ PANEL_CONTENTS,
+ PANEL_COUNT
+ };
+
+ void dirty();
+ void showPanel(EInfoPanel panel);
+
+ void setStatusText(const std::string& text);
+ static void setEditTool(void* data);
+ void setTool(const LLSD& user_data);
+ void saveLastTool();
+ void updateLandImpacts();
+
+ static void setGridMode(S32 mode);
+
+ LLPanelFace* getPanelFace() { return mPanelFace; }
private:
- void refresh();
- static void setObjectType( LLPCode pcode );
- void onClickGridOptions();
+ void refresh();
+ static void setObjectType( LLPCode pcode );
+ void onClickGridOptions();
public:
- LLButton *mBtnFocus;
- LLButton *mBtnMove;
- LLButton *mBtnEdit;
- LLButton *mBtnCreate;
- LLButton *mBtnLand;
+ LLButton *mBtnFocus;
+ LLButton *mBtnMove;
+ LLButton *mBtnEdit;
+ LLButton *mBtnCreate;
+ LLButton *mBtnLand;
- LLTextBox *mTextStatus;
+ LLTextBox *mTextStatus;
- // Focus buttons
- LLRadioGroup* mRadioGroupFocus;
+ // Focus buttons
+ LLRadioGroup* mRadioGroupFocus;
- // Move buttons
- LLRadioGroup* mRadioGroupMove;
+ // Move buttons
+ LLRadioGroup* mRadioGroupMove;
- // Edit buttons
- LLRadioGroup* mRadioGroupEdit;
+ // Edit buttons
+ LLRadioGroup* mRadioGroupEdit;
- LLCheckBoxCtrl *mCheckSelectIndividual;
- LLButton* mBtnLink;
- LLButton* mBtnUnlink;
+ LLCheckBoxCtrl *mCheckSelectIndividual;
+ LLButton* mBtnLink;
+ LLButton* mBtnUnlink;
- LLCheckBoxCtrl* mCheckSnapToGrid;
- LLButton* mBtnGridOptions;
- LLComboBox* mComboGridMode;
- LLCheckBoxCtrl* mCheckStretchUniform;
- LLCheckBoxCtrl* mCheckStretchTexture;
+ LLCheckBoxCtrl* mCheckSnapToGrid;
+ LLButton* mBtnGridOptions;
+ LLComboBox* mComboGridMode;
+ LLCheckBoxCtrl* mCheckStretchUniform;
+ LLCheckBoxCtrl* mCheckStretchTexture;
- // !HACK! Replacement of mCheckStretchUniform label because LLCheckBoxCtrl
- // doesn't support word_wrap of its label. Need to fix truncation bug EXT-6658
- LLTextBox* mCheckStretchUniformLabel;
+ // !HACK! Replacement of mCheckStretchUniform label because LLCheckBoxCtrl
+ // doesn't support word_wrap of its label. Need to fix truncation bug EXT-6658
+ LLTextBox* mCheckStretchUniformLabel;
- LLButton *mBtnRotateLeft;
- LLButton *mBtnRotateReset;
- LLButton *mBtnRotateRight;
+ LLButton *mBtnRotateLeft;
+ LLButton *mBtnRotateReset;
+ LLButton *mBtnRotateRight;
- LLButton *mBtnDelete;
- LLButton *mBtnDuplicate;
- LLButton *mBtnDuplicateInPlace;
+ LLButton *mBtnDelete;
+ LLButton *mBtnDuplicate;
+ LLButton *mBtnDuplicateInPlace;
- // Create buttons
- LLCheckBoxCtrl *mCheckSticky;
- LLCheckBoxCtrl *mCheckCopySelection;
- LLCheckBoxCtrl *mCheckCopyCenters;
- LLCheckBoxCtrl *mCheckCopyRotates;
+ // Create buttons
+ LLCheckBoxCtrl *mCheckSticky;
+ LLCheckBoxCtrl *mCheckCopySelection;
+ LLCheckBoxCtrl *mCheckCopyCenters;
+ LLCheckBoxCtrl *mCheckCopyRotates;
- // Land buttons
- LLRadioGroup* mRadioGroupLand;
- LLSlider *mSliderDozerSize;
- LLSlider *mSliderDozerForce;
+ // Land buttons
+ LLRadioGroup* mRadioGroupLand;
+ LLSlider *mSliderDozerSize;
+ LLSlider *mSliderDozerForce;
- LLButton *mBtnApplyToSelection;
+ LLButton *mBtnApplyToSelection;
- std::vector<LLButton*> mButtons;//[ 15 ];
+ std::vector<LLButton*> mButtons;//[ 15 ];
- LLTabContainer *mTab;
- LLPanelPermissions *mPanelPermissions;
- LLPanelObject *mPanelObject;
- LLPanelVolume *mPanelVolume;
- LLPanelContents *mPanelContents;
- LLPanelFace *mPanelFace;
- LLPanelLandInfo *mPanelLandInfo;
+ LLTabContainer *mTab;
+ LLPanelPermissions *mPanelPermissions;
+ LLPanelObject *mPanelObject;
+ LLPanelVolume *mPanelVolume;
+ LLPanelContents *mPanelContents;
+ LLPanelFace *mPanelFace;
+ LLPanelLandInfo *mPanelLandInfo;
- LLViewBorder* mCostTextBorder;
+ LLViewBorder* mCostTextBorder;
- LLTabContainer* mTabLand;
+ LLTabContainer* mTabLand;
- LLLandImpactsObserver* mLandImpactsObserver;
+ LLLandImpactsObserver* mLandImpactsObserver;
- LLParcelSelectionHandle mParcelSelection;
- LLObjectSelectionHandle mObjectSelection;
+ LLParcelSelectionHandle mParcelSelection;
+ LLObjectSelectionHandle mObjectSelection;
private:
- BOOL mDirty;
- BOOL mHasSelection;
+ BOOL mDirty;
+ BOOL mHasSelection;
- std::map<std::string, std::string> mStatusText;
+ std::map<std::string, std::string> mStatusText;
public:
- static bool sShowObjectCost;
- static bool sPreviousFocusOnAvatar;
-
+ static bool sShowObjectCost;
+ static bool sPreviousFocusOnAvatar;
+
};
extern LLFloaterTools *gFloaterTools;
diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp
index 9f277021c8..c630daa836 100644
--- a/indra/newview/llfloatertopobjects.cpp
+++ b/indra/newview/llfloatertopobjects.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertopobjects.cpp
* @brief Shows top colliders, top scripts, etc.
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -61,29 +61,29 @@
// static
void LLFloaterTopObjects::show()
{
- if (sInstance)
- {
- sInstance->setVisibleAndFrontmost();
- return;
- }
-
- sInstance = new LLFloaterTopObjects();
- sInstance->center();
+ if (sInstance)
+ {
+ sInstance->setVisibleAndFrontmost();
+ return;
+ }
+
+ sInstance = new LLFloaterTopObjects();
+ sInstance->center();
}
*/
LLFloaterTopObjects::LLFloaterTopObjects(const LLSD& key)
-: LLFloater(key),
- mInitialized(FALSE),
- mtotalScore(0.f)
+: LLFloater(key),
+ mInitialized(FALSE),
+ mtotalScore(0.f)
{
- mCommitCallbackRegistrar.add("TopObjects.ShowBeacon", boost::bind(&LLFloaterTopObjects::onClickShowBeacon, this));
- mCommitCallbackRegistrar.add("TopObjects.ReturnSelected", boost::bind(&LLFloaterTopObjects::onReturnSelected, this));
- mCommitCallbackRegistrar.add("TopObjects.ReturnAll", boost::bind(&LLFloaterTopObjects::onReturnAll, this));
- mCommitCallbackRegistrar.add("TopObjects.Refresh", boost::bind(&LLFloaterTopObjects::onRefresh, this));
- mCommitCallbackRegistrar.add("TopObjects.GetByObjectName", boost::bind(&LLFloaterTopObjects::onGetByObjectName, this));
- mCommitCallbackRegistrar.add("TopObjects.GetByOwnerName", boost::bind(&LLFloaterTopObjects::onGetByOwnerName, this));
- mCommitCallbackRegistrar.add("TopObjects.GetByParcelName", boost::bind(&LLFloaterTopObjects::onGetByParcelName, this));
- mCommitCallbackRegistrar.add("TopObjects.CommitObjectsList",boost::bind(&LLFloaterTopObjects::onCommitObjectsList, this));
+ mCommitCallbackRegistrar.add("TopObjects.ShowBeacon", boost::bind(&LLFloaterTopObjects::onClickShowBeacon, this));
+ mCommitCallbackRegistrar.add("TopObjects.ReturnSelected", boost::bind(&LLFloaterTopObjects::onReturnSelected, this));
+ mCommitCallbackRegistrar.add("TopObjects.ReturnAll", boost::bind(&LLFloaterTopObjects::onReturnAll, this));
+ mCommitCallbackRegistrar.add("TopObjects.Refresh", boost::bind(&LLFloaterTopObjects::onRefresh, this));
+ mCommitCallbackRegistrar.add("TopObjects.GetByObjectName", boost::bind(&LLFloaterTopObjects::onGetByObjectName, this));
+ mCommitCallbackRegistrar.add("TopObjects.GetByOwnerName", boost::bind(&LLFloaterTopObjects::onGetByOwnerName, this));
+ mCommitCallbackRegistrar.add("TopObjects.GetByParcelName", boost::bind(&LLFloaterTopObjects::onGetByParcelName, this));
+ mCommitCallbackRegistrar.add("TopObjects.CommitObjectsList",boost::bind(&LLFloaterTopObjects::onCommitObjectsList, this));
mCommitCallbackRegistrar.add("TopObjects.TeleportToSelected", boost::bind(&LLFloaterTopObjects::teleportToSelectedObject, this));
}
@@ -101,330 +101,330 @@ BOOL LLFloaterTopObjects::postBuild()
mObjectsScrollList->setCommitOnSelectionChange(TRUE);
mObjectsScrollList->setCommitCallback(boost::bind(&LLFloaterTopObjects::onSelectionChanged, this));
- setDefaultBtn("show_beacon_btn");
+ setDefaultBtn("show_beacon_btn");
- mCurrentMode = STAT_REPORT_TOP_SCRIPTS;
- mFlags = 0;
- mFilter.clear();
+ mCurrentMode = STAT_REPORT_TOP_SCRIPTS;
+ mFlags = 0;
+ mFilter.clear();
- return TRUE;
+ return TRUE;
}
// static
void LLFloaterTopObjects::setMode(U32 mode)
{
- LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
- if(!instance) return;
- instance->mCurrentMode = mode;
+ LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
+ if(!instance) return;
+ instance->mCurrentMode = mode;
}
-// static
+// static
void LLFloaterTopObjects::handle_land_reply(LLMessageSystem* msg, void** data)
{
LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
if(instance && instance->isInVisibleChain())
{
- instance->handleReply(msg, data);
- //HACK: for some reason sometimes top scripts originally comes back
- //with no results even though they're there
- if (!instance->mObjectListIDs.size() && !instance->mInitialized)
- {
- instance->onRefresh();
- instance->mInitialized = TRUE;
- }
- }
- else
- {
- LLFloaterRegionInfo* region_info_floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if(region_info_floater)
- {
- region_info_floater->enableTopButtons();
- }
- }
+ instance->handleReply(msg, data);
+ //HACK: for some reason sometimes top scripts originally comes back
+ //with no results even though they're there
+ if (!instance->mObjectListIDs.size() && !instance->mInitialized)
+ {
+ instance->onRefresh();
+ instance->mInitialized = TRUE;
+ }
+ }
+ else
+ {
+ LLFloaterRegionInfo* region_info_floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if(region_info_floater)
+ {
+ region_info_floater->enableTopButtons();
+ }
+ }
}
void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
{
U32 request_flags;
- U32 total_count;
- U64 total_memory = 0;
-
- msg->getU32Fast(_PREHASH_RequestData, _PREHASH_RequestFlags, request_flags);
- msg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count);
- msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode);
-
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("objects_list");
-
- S32 block_count = msg->getNumberOfBlocks("ReportData");
- for (S32 block = 0; block < block_count; ++block)
- {
- U32 task_local_id;
- U32 time_stamp = 0;
- LLUUID task_id;
- F32 location_x, location_y, location_z;
- F32 score;
- std::string name_buf;
- std::string owner_buf;
- std::string parcel_buf("unknown");
- F32 mono_score = 0.f;
- bool have_extended_data = false;
- S32 public_urls = 0;
- F32 script_memory = 0.f;
-
- msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block);
- msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block);
- msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationX, location_x, block);
- msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block);
- msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block);
- msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block);
- msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block);
- msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block);
-
- if(msg->has("DataExtended"))
- {
- have_extended_data = true;
- msg->getU32("DataExtended", "TimeStamp", time_stamp, block);
- msg->getF32("DataExtended", "MonoScore", mono_score, block);
- msg->getS32("DataExtended", "PublicURLs", public_urls, block);
-
- std::string parcel_name;
- F32 script_size = 0.f;
- msg->getString("DataExtended", "ParcelName", parcel_name, block);
- msg->getF32("DataExtended", "Size", script_size, block);
- if (parcel_name.size() > 0 || script_size > 0)
- {
- parcel_buf = parcel_name;
- script_memory = script_size;
- total_memory += script_size;
- }
- }
-
- LLSD element;
-
- element["id"] = task_id;
-
- LLSD columns;
- S32 column_num = 0;
- columns[column_num]["column"] = "score";
- columns[column_num]["value"] = llformat("%0.3f", score);
- columns[column_num++]["font"] = "SANSSERIF";
-
- columns[column_num]["column"] = "name";
- columns[column_num]["value"] = name_buf;
- columns[column_num++]["font"] = "SANSSERIF";
-
- // Owner names can have trailing spaces sent from server
- LLStringUtil::trim(owner_buf);
-
- // *TODO: Send owner_id from server and look up display name
- owner_buf = LLCacheName::buildUsername(owner_buf);
-
- columns[column_num]["column"] = "owner";
- columns[column_num]["value"] = owner_buf;
- columns[column_num++]["font"] = "SANSSERIF";
-
- columns[column_num]["column"] = "location";
- columns[column_num]["value"] = llformat("<%0.f, %0.f, %0.f>", location_x, location_y, location_z);
- columns[column_num++]["font"] = "SANSSERIF";
-
- columns[column_num]["column"] = "parcel";
- columns[column_num]["value"] = parcel_buf;
- columns[column_num++]["font"] = "SANSSERIF";
-
- columns[column_num]["column"] = "time";
- columns[column_num]["type"] = "date";
- columns[column_num]["value"] = LLDate((time_t)time_stamp);
- columns[column_num++]["font"] = "SANSSERIF";
-
- if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS
- && have_extended_data)
- {
- columns[column_num]["column"] = "memory";
- columns[column_num]["value"] = llformat("%0.0f", (script_memory / 1024.f));
- columns[column_num++]["font"] = "SANSSERIF";
-
- columns[column_num]["column"] = "URLs";
- columns[column_num]["value"] = llformat("%d", public_urls);
- columns[column_num++]["font"] = "SANSSERIF";
- }
- element["columns"] = columns;
- list->addElement(element);
-
- mObjectListData.append(element);
- mObjectListIDs.push_back(task_id);
-
- mtotalScore += score;
- }
-
- if (total_count == 0 && list->getItemCount() == 0)
- {
- list->setCommentText(getString("none_descriptor"));
- }
- else
- {
- list->selectFirstItem();
- }
-
- if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS)
- {
- setTitle(getString("top_scripts_title"));
- list->setColumnLabel("score", getString("scripts_score_label"));
-
- LLUIString format = getString("top_scripts_text");
- total_memory /= 1024;
- format.setArg("[MEMORY]", llformat("%ld", total_memory));
- format.setArg("[COUNT]", llformat("%d", total_count));
- format.setArg("[TIME]", llformat("%0.3f", mtotalScore));
- getChild<LLUICtrl>("title_text")->setValue(LLSD(format));
- list->setColumnLabel("URLs", getString("URLs"));
- list->setColumnLabel("memory", getString("memory"));
- }
- else
- {
- setTitle(getString("top_colliders_title"));
- list->setColumnLabel("score", getString("colliders_score_label"));
- list->setColumnLabel("URLs", "");
- list->setColumnLabel("memory", "");
- LLUIString format = getString("top_colliders_text");
- format.setArg("[COUNT]", llformat("%d", total_count));
- getChild<LLUICtrl>("title_text")->setValue(LLSD(format));
- }
-
- LLFloaterRegionInfo* region_info_floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if(region_info_floater)
- {
- region_info_floater->enableTopButtons();
- }
- getChildView("refresh_btn")->setEnabled(true);
+ U32 total_count;
+ U64 total_memory = 0;
+
+ msg->getU32Fast(_PREHASH_RequestData, _PREHASH_RequestFlags, request_flags);
+ msg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count);
+ msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode);
+
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("objects_list");
+
+ S32 block_count = msg->getNumberOfBlocks("ReportData");
+ for (S32 block = 0; block < block_count; ++block)
+ {
+ U32 task_local_id;
+ U32 time_stamp = 0;
+ LLUUID task_id;
+ F32 location_x, location_y, location_z;
+ F32 score;
+ std::string name_buf;
+ std::string owner_buf;
+ std::string parcel_buf("unknown");
+ F32 mono_score = 0.f;
+ bool have_extended_data = false;
+ S32 public_urls = 0;
+ F32 script_memory = 0.f;
+
+ msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block);
+ msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block);
+ msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationX, location_x, block);
+ msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block);
+ msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block);
+ msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block);
+ msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block);
+ msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block);
+
+ if(msg->has("DataExtended"))
+ {
+ have_extended_data = true;
+ msg->getU32("DataExtended", "TimeStamp", time_stamp, block);
+ msg->getF32("DataExtended", "MonoScore", mono_score, block);
+ msg->getS32("DataExtended", "PublicURLs", public_urls, block);
+
+ std::string parcel_name;
+ F32 script_size = 0.f;
+ msg->getString("DataExtended", "ParcelName", parcel_name, block);
+ msg->getF32("DataExtended", "Size", script_size, block);
+ if (parcel_name.size() > 0 || script_size > 0)
+ {
+ parcel_buf = parcel_name;
+ script_memory = script_size;
+ total_memory += script_size;
+ }
+ }
+
+ LLSD element;
+
+ element["id"] = task_id;
+
+ LLSD columns;
+ S32 column_num = 0;
+ columns[column_num]["column"] = "score";
+ columns[column_num]["value"] = llformat("%0.3f", score);
+ columns[column_num++]["font"] = "SANSSERIF";
+
+ columns[column_num]["column"] = "name";
+ columns[column_num]["value"] = name_buf;
+ columns[column_num++]["font"] = "SANSSERIF";
+
+ // Owner names can have trailing spaces sent from server
+ LLStringUtil::trim(owner_buf);
+
+ // *TODO: Send owner_id from server and look up display name
+ owner_buf = LLCacheName::buildUsername(owner_buf);
+
+ columns[column_num]["column"] = "owner";
+ columns[column_num]["value"] = owner_buf;
+ columns[column_num++]["font"] = "SANSSERIF";
+
+ columns[column_num]["column"] = "location";
+ columns[column_num]["value"] = llformat("<%0.f, %0.f, %0.f>", location_x, location_y, location_z);
+ columns[column_num++]["font"] = "SANSSERIF";
+
+ columns[column_num]["column"] = "parcel";
+ columns[column_num]["value"] = parcel_buf;
+ columns[column_num++]["font"] = "SANSSERIF";
+
+ columns[column_num]["column"] = "time";
+ columns[column_num]["type"] = "date";
+ columns[column_num]["value"] = LLDate((time_t)time_stamp);
+ columns[column_num++]["font"] = "SANSSERIF";
+
+ if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS
+ && have_extended_data)
+ {
+ columns[column_num]["column"] = "memory";
+ columns[column_num]["value"] = llformat("%0.0f", (script_memory / 1024.f));
+ columns[column_num++]["font"] = "SANSSERIF";
+
+ columns[column_num]["column"] = "URLs";
+ columns[column_num]["value"] = llformat("%d", public_urls);
+ columns[column_num++]["font"] = "SANSSERIF";
+ }
+ element["columns"] = columns;
+ list->addElement(element);
+
+ mObjectListData.append(element);
+ mObjectListIDs.push_back(task_id);
+
+ mtotalScore += score;
+ }
+
+ if (total_count == 0 && list->getItemCount() == 0)
+ {
+ list->setCommentText(getString("none_descriptor"));
+ }
+ else
+ {
+ list->selectFirstItem();
+ }
+
+ if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS)
+ {
+ setTitle(getString("top_scripts_title"));
+ list->setColumnLabel("score", getString("scripts_score_label"));
+
+ LLUIString format = getString("top_scripts_text");
+ total_memory /= 1024;
+ format.setArg("[MEMORY]", llformat("%ld", total_memory));
+ format.setArg("[COUNT]", llformat("%d", total_count));
+ format.setArg("[TIME]", llformat("%0.3f", mtotalScore));
+ getChild<LLUICtrl>("title_text")->setValue(LLSD(format));
+ list->setColumnLabel("URLs", getString("URLs"));
+ list->setColumnLabel("memory", getString("memory"));
+ }
+ else
+ {
+ setTitle(getString("top_colliders_title"));
+ list->setColumnLabel("score", getString("colliders_score_label"));
+ list->setColumnLabel("URLs", "");
+ list->setColumnLabel("memory", "");
+ LLUIString format = getString("top_colliders_text");
+ format.setArg("[COUNT]", llformat("%d", total_count));
+ getChild<LLUICtrl>("title_text")->setValue(LLSD(format));
+ }
+
+ LLFloaterRegionInfo* region_info_floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if(region_info_floater)
+ {
+ region_info_floater->enableTopButtons();
+ }
+ getChildView("refresh_btn")->setEnabled(true);
}
void LLFloaterTopObjects::onCommitObjectsList()
{
- updateSelectionInfo();
+ updateSelectionInfo();
}
void LLFloaterTopObjects::updateSelectionInfo()
{
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
- if (!list) return;
+ if (!list) return;
- LLUUID object_id = list->getCurrentID();
- if (object_id.isNull()) return;
+ LLUUID object_id = list->getCurrentID();
+ if (object_id.isNull()) return;
- std::string object_id_string = object_id.asString();
+ std::string object_id_string = object_id.asString();
- getChild<LLUICtrl>("id_editor")->setValue(LLSD(object_id_string));
- LLScrollListItem* sli = list->getFirstSelected();
- llassert(sli);
- if (sli)
- {
- getChild<LLUICtrl>("object_name_editor")->setValue(sli->getColumn(1)->getValue().asString());
- getChild<LLUICtrl>("owner_name_editor")->setValue(sli->getColumn(2)->getValue().asString());
- getChild<LLUICtrl>("parcel_name_editor")->setValue(sli->getColumn(4)->getValue().asString());
- }
+ getChild<LLUICtrl>("id_editor")->setValue(LLSD(object_id_string));
+ LLScrollListItem* sli = list->getFirstSelected();
+ llassert(sli);
+ if (sli)
+ {
+ getChild<LLUICtrl>("object_name_editor")->setValue(sli->getColumn(1)->getValue().asString());
+ getChild<LLUICtrl>("owner_name_editor")->setValue(sli->getColumn(2)->getValue().asString());
+ getChild<LLUICtrl>("parcel_name_editor")->setValue(sli->getColumn(4)->getValue().asString());
+ }
}
// static
void LLFloaterTopObjects::onDoubleClickObjectsList(void* data)
{
- LLFloaterTopObjects* self = (LLFloaterTopObjects*)data;
- self->showBeacon();
+ LLFloaterTopObjects* self = (LLFloaterTopObjects*)data;
+ self->showBeacon();
}
// static
void LLFloaterTopObjects::onClickShowBeacon()
{
- showBeacon();
+ showBeacon();
}
void LLFloaterTopObjects::returnObjects(bool all)
{
- LLMessageSystem *msg = gMessageSystem;
-
- LLViewerRegion* region = gAgent.getRegion();
- if (!region) return;
-
- LLCtrlListInterface *list = getChild<LLUICtrl>("objects_list")->getListInterface();
- if (!list || list->getItemCount() == 0) return;
-
- uuid_vec_t::iterator id_itor;
-
- bool start_message = true;
-
- for (id_itor = mObjectListIDs.begin(); id_itor != mObjectListIDs.end(); ++id_itor)
- {
- LLUUID task_id = *id_itor;
- if (!all && !list->isSelected(task_id))
- {
- // Selected only
- continue;
- }
- if (start_message)
- {
- msg->newMessageFast(_PREHASH_ParcelReturnObjects);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, -1); // Whole region
- msg->addS32Fast(_PREHASH_ReturnType, RT_NONE);
- start_message = false;
- }
-
- msg->nextBlockFast(_PREHASH_TaskIDs);
- msg->addUUIDFast(_PREHASH_TaskID, task_id);
-
- if (msg->isSendFullFast(_PREHASH_TaskIDs))
- {
- msg->sendReliable(region->getHost());
- start_message = true;
- }
- }
-
- if (!start_message)
- {
- msg->sendReliable(region->getHost());
- }
+ LLMessageSystem *msg = gMessageSystem;
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region) return;
+
+ LLCtrlListInterface *list = getChild<LLUICtrl>("objects_list")->getListInterface();
+ if (!list || list->getItemCount() == 0) return;
+
+ uuid_vec_t::iterator id_itor;
+
+ bool start_message = true;
+
+ for (id_itor = mObjectListIDs.begin(); id_itor != mObjectListIDs.end(); ++id_itor)
+ {
+ LLUUID task_id = *id_itor;
+ if (!all && !list->isSelected(task_id))
+ {
+ // Selected only
+ continue;
+ }
+ if (start_message)
+ {
+ msg->newMessageFast(_PREHASH_ParcelReturnObjects);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, -1); // Whole region
+ msg->addS32Fast(_PREHASH_ReturnType, RT_NONE);
+ start_message = false;
+ }
+
+ msg->nextBlockFast(_PREHASH_TaskIDs);
+ msg->addUUIDFast(_PREHASH_TaskID, task_id);
+
+ if (msg->isSendFullFast(_PREHASH_TaskIDs))
+ {
+ msg->sendReliable(region->getHost());
+ start_message = true;
+ }
+ }
+
+ if (!start_message)
+ {
+ msg->sendReliable(region->getHost());
+ }
}
//static
bool LLFloaterTopObjects::callbackReturnAll(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
- if(!instance) return false;
- if (option == 0)
- {
- instance->returnObjects(true);
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLFloaterTopObjects* instance = LLFloaterReg::getTypedInstance<LLFloaterTopObjects>("top_objects");
+ if(!instance) return false;
+ if (option == 0)
+ {
+ instance->returnObjects(true);
+ }
+ return false;
}
void LLFloaterTopObjects::onReturnAll()
-{
- LLNotificationsUtil::add("ReturnAllTopObjects", LLSD(), LLSD(), &callbackReturnAll);
+{
+ LLNotificationsUtil::add("ReturnAllTopObjects", LLSD(), LLSD(), &callbackReturnAll);
}
void LLFloaterTopObjects::onReturnSelected()
{
- returnObjects(false);
+ returnObjects(false);
}
void LLFloaterTopObjects::clearList()
{
- LLCtrlListInterface *list = childGetListInterface("objects_list");
-
- if (list)
- {
- list->operateOnAll(LLCtrlListInterface::OP_DELETE);
- }
+ LLCtrlListInterface *list = childGetListInterface("objects_list");
+
+ if (list)
+ {
+ list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+ }
- mObjectListData.clear();
- mObjectListIDs.clear();
- mtotalScore = 0.f;
+ mObjectListData.clear();
+ mObjectListIDs.clear();
+ mtotalScore = 0.f;
onSelectionChanged();
}
@@ -432,86 +432,86 @@ void LLFloaterTopObjects::clearList()
void LLFloaterTopObjects::onRefresh()
{
- U32 mode = STAT_REPORT_TOP_SCRIPTS;
- U32 flags = 0;
- std::string filter = "";
-
- mode = mCurrentMode;
- flags = mFlags;
- filter = mFilter;
- clearList();
-
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_LandStatRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- msg->nextBlockFast(_PREHASH_RequestData);
- msg->addU32Fast(_PREHASH_ReportType, mode);
- msg->addU32Fast(_PREHASH_RequestFlags, flags);
- msg->addStringFast(_PREHASH_Filter, filter);
- msg->addS32Fast(_PREHASH_ParcelLocalID, 0);
-
- LLFloaterRegionInfo* region_info_floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
- if(region_info_floater)
- {
- region_info_floater->disableTopButtons();
- }
- disableRefreshBtn();
-
- msg->sendReliable(gAgent.getRegionHost());
-
- mFilter.clear();
- mFlags = 0;
+ U32 mode = STAT_REPORT_TOP_SCRIPTS;
+ U32 flags = 0;
+ std::string filter = "";
+
+ mode = mCurrentMode;
+ flags = mFlags;
+ filter = mFilter;
+ clearList();
+
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_LandStatRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->nextBlockFast(_PREHASH_RequestData);
+ msg->addU32Fast(_PREHASH_ReportType, mode);
+ msg->addU32Fast(_PREHASH_RequestFlags, flags);
+ msg->addStringFast(_PREHASH_Filter, filter);
+ msg->addS32Fast(_PREHASH_ParcelLocalID, 0);
+
+ LLFloaterRegionInfo* region_info_floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+ if(region_info_floater)
+ {
+ region_info_floater->disableTopButtons();
+ }
+ disableRefreshBtn();
+
+ msg->sendReliable(gAgent.getRegionHost());
+
+ mFilter.clear();
+ mFlags = 0;
}
void LLFloaterTopObjects::disableRefreshBtn()
{
- getChildView("refresh_btn")->setEnabled(false);
+ getChildView("refresh_btn")->setEnabled(false);
}
void LLFloaterTopObjects::onGetByObjectName()
{
- mFlags = STAT_FILTER_BY_OBJECT;
- mFilter = getChild<LLUICtrl>("object_name_editor")->getValue().asString();
- onRefresh();
+ mFlags = STAT_FILTER_BY_OBJECT;
+ mFilter = getChild<LLUICtrl>("object_name_editor")->getValue().asString();
+ onRefresh();
}
void LLFloaterTopObjects::onGetByOwnerName()
{
- mFlags = STAT_FILTER_BY_OWNER;
- mFilter = getChild<LLUICtrl>("owner_name_editor")->getValue().asString();
- onRefresh();
+ mFlags = STAT_FILTER_BY_OWNER;
+ mFilter = getChild<LLUICtrl>("owner_name_editor")->getValue().asString();
+ onRefresh();
}
void LLFloaterTopObjects::onGetByParcelName()
{
- mFlags = STAT_FILTER_BY_PARCEL_NAME;
- mFilter = getChild<LLUICtrl>("parcel_name_editor")->getValue().asString();
- onRefresh();
+ mFlags = STAT_FILTER_BY_PARCEL_NAME;
+ mFilter = getChild<LLUICtrl>("parcel_name_editor")->getValue().asString();
+ onRefresh();
}
void LLFloaterTopObjects::showBeacon()
{
- LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
- if (!list) return;
+ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
+ if (!list) return;
- LLScrollListItem* first_selected = list->getFirstSelected();
- if (!first_selected) return;
+ LLScrollListItem* first_selected = list->getFirstSelected();
+ if (!first_selected) return;
- std::string name = first_selected->getColumn(1)->getValue().asString();
- std::string pos_string = first_selected->getColumn(3)->getValue().asString();
+ std::string name = first_selected->getColumn(1)->getValue().asString();
+ std::string pos_string = first_selected->getColumn(3)->getValue().asString();
- F32 x, y, z;
- S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z);
- if (matched != 3) return;
+ F32 x, y, z;
+ S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z);
+ if (matched != 3) return;
- LLVector3 pos_agent(x, y, z);
- LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
- std::string tooltip("");
- LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM);
+ LLVector3 pos_agent(x, y, z);
+ LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
+ std::string tooltip("");
+ LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM);
}
void LLFloaterTopObjects::teleportToSelectedObject()
diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h
index b73401e50d..a3f987f2e1 100644
--- a/indra/newview/llfloatertopobjects.h
+++ b/indra/newview/llfloatertopobjects.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertopobjects.h
* @brief Shows top colliders or top scripts
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,80 +35,80 @@ class LLScrollListCtrl;
// Bits for simulator performance query flags
enum LAND_STAT_FLAGS
{
- STAT_FILTER_BY_PARCEL = 0x00000001,
- STAT_FILTER_BY_OWNER = 0x00000002,
- STAT_FILTER_BY_OBJECT = 0x00000004,
- STAT_FILTER_BY_PARCEL_NAME = 0x00000008,
- STAT_REQUEST_LAST_ENTRY = 0x80000000,
+ STAT_FILTER_BY_PARCEL = 0x00000001,
+ STAT_FILTER_BY_OWNER = 0x00000002,
+ STAT_FILTER_BY_OBJECT = 0x00000004,
+ STAT_FILTER_BY_PARCEL_NAME = 0x00000008,
+ STAT_REQUEST_LAST_ENTRY = 0x80000000,
};
enum LAND_STAT_REPORT_TYPE
{
- STAT_REPORT_TOP_SCRIPTS = 0,
- STAT_REPORT_TOP_COLLIDERS
+ STAT_REPORT_TOP_SCRIPTS = 0,
+ STAT_REPORT_TOP_COLLIDERS
};
class LLFloaterTopObjects : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- // Opens the floater on screen.
-// static void show();
+ // Opens the floater on screen.
+// static void show();
+
+ // Opens the floater if it's not on-screen.
+ // Juggles the UI based on method = "scripts" or "colliders"
+ static void handle_land_reply(LLMessageSystem* msg, void** data);
+ void handleReply(LLMessageSystem* msg, void** data);
- // Opens the floater if it's not on-screen.
- // Juggles the UI based on method = "scripts" or "colliders"
- static void handle_land_reply(LLMessageSystem* msg, void** data);
- void handleReply(LLMessageSystem* msg, void** data);
-
- void clearList();
- void updateSelectionInfo();
- virtual BOOL postBuild();
+ void clearList();
+ void updateSelectionInfo();
+ virtual BOOL postBuild();
- void onRefresh();
+ void onRefresh();
- static void setMode(U32 mode);
- void disableRefreshBtn();
+ static void setMode(U32 mode);
+ void disableRefreshBtn();
private:
- LLFloaterTopObjects(const LLSD& key);
- ~LLFloaterTopObjects();
+ LLFloaterTopObjects(const LLSD& key);
+ ~LLFloaterTopObjects();
- void initColumns(LLCtrlListInterface *list);
+ void initColumns(LLCtrlListInterface *list);
- void onCommitObjectsList();
+ void onCommitObjectsList();
void onSelectionChanged();
- static void onDoubleClickObjectsList(void* data);
- void onClickShowBeacon();
+ static void onDoubleClickObjectsList(void* data);
+ void onClickShowBeacon();
- void returnObjects(bool all);
+ void returnObjects(bool all);
- void onReturnAll();
- void onReturnSelected();
+ void onReturnAll();
+ void onReturnSelected();
- static bool callbackReturnAll(const LLSD& notification, const LLSD& response);
+ static bool callbackReturnAll(const LLSD& notification, const LLSD& response);
- void onGetByOwnerName();
- void onGetByObjectName();
- void onGetByParcelName();
+ void onGetByOwnerName();
+ void onGetByObjectName();
+ void onGetByParcelName();
- void showBeacon();
+ void showBeacon();
void teleportToSelectedObject();
private:
- std::string mMethod;
+ std::string mMethod;
- LLSD mObjectListData;
- uuid_vec_t mObjectListIDs;
+ LLSD mObjectListData;
+ uuid_vec_t mObjectListIDs;
- U32 mCurrentMode;
- U32 mFlags;
- std::string mFilter;
+ U32 mCurrentMode;
+ U32 mFlags;
+ std::string mFilter;
- BOOL mInitialized;
+ BOOL mInitialized;
- F32 mtotalScore;
+ F32 mtotalScore;
- static LLFloaterTopObjects* sInstance;
+ static LLFloaterTopObjects* sInstance;
LLScrollListCtrl* mObjectsScrollList;
};
diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp
index 1aeb727172..47deb92826 100644
--- a/indra/newview/llfloatertos.cpp
+++ b/indra/newview/llfloatertos.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertos.cpp
* @brief Terms of Service Agreement dialog
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,71 +47,71 @@
#include "llfloaterreg.h"
LLFloaterTOS::LLFloaterTOS(const LLSD& data)
-: LLModalDialog( data["message"].asString() ),
- mMessage(data["message"].asString()),
- mLoadingScreenLoaded(false),
- mSiteAlive(false),
- mRealNavigateBegun(false),
- mReplyPumpName(data["reply_pump"].asString())
+: LLModalDialog( data["message"].asString() ),
+ mMessage(data["message"].asString()),
+ mLoadingScreenLoaded(false),
+ mSiteAlive(false),
+ mRealNavigateBegun(false),
+ mReplyPumpName(data["reply_pump"].asString())
{
}
BOOL LLFloaterTOS::postBuild()
-{
- childSetAction("Continue", onContinue, this);
- childSetAction("Cancel", onCancel, this);
- childSetCommitCallback("agree_chk", updateAgree, this);
-
- if (hasChild("tos_text"))
- {
- // this displays the critical message
- LLUICtrl *tos_text = getChild<LLUICtrl>("tos_text");
- tos_text->setEnabled( FALSE );
- tos_text->setFocus(TRUE);
- tos_text->setValue(LLSD(mMessage));
-
- return TRUE;
- }
-
- // disable Agree to TOS radio button until the page has fully loaded
+{
+ childSetAction("Continue", onContinue, this);
+ childSetAction("Cancel", onCancel, this);
+ childSetCommitCallback("agree_chk", updateAgree, this);
+
+ if (hasChild("tos_text"))
+ {
+ // this displays the critical message
+ LLUICtrl *tos_text = getChild<LLUICtrl>("tos_text");
+ tos_text->setEnabled( FALSE );
+ tos_text->setFocus(TRUE);
+ tos_text->setValue(LLSD(mMessage));
+
+ return TRUE;
+ }
+
+ // disable Agree to TOS radio button until the page has fully loaded
updateAgreeEnabled(false);
- // hide the SL text widget if we're displaying TOS with using a browser widget.
- LLUICtrl *editor = getChild<LLUICtrl>("tos_text");
- editor->setVisible( FALSE );
+ // hide the SL text widget if we're displaying TOS with using a browser widget.
+ LLUICtrl *editor = getChild<LLUICtrl>("tos_text");
+ editor->setVisible( FALSE );
- LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
- if ( web_browser )
- {
+ LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
+ if ( web_browser )
+ {
// if we are forced to send users to an external site in their system browser
// (e.g.) Linux users because of lack of media support for HTML ToS page
// remove exisiting UI and replace with a link to external page where users can accept ToS
#ifdef EXTERNAL_TOS
- LLTextBox* header = getChild<LLTextBox>("tos_heading");
- if (header)
- header->setVisible(false);
+ LLTextBox* header = getChild<LLTextBox>("tos_heading");
+ if (header)
+ header->setVisible(false);
- LLTextBox* external_prompt = getChild<LLTextBox>("external_tos_required");
- if (external_prompt)
- external_prompt->setVisible(true);
+ LLTextBox* external_prompt = getChild<LLTextBox>("external_tos_required");
+ if (external_prompt)
+ external_prompt->setVisible(true);
- web_browser->setVisible(false);
+ web_browser->setVisible(false);
#else
- web_browser->addObserver(this);
-
- // Don't use the start_url parameter for this browser instance -- it may finish loading before we get to add our observer.
- // Store the URL separately and navigate here instead.
- web_browser->navigateTo( getString( "loading_url" ) );
- LLPluginClassMedia* media_plugin = web_browser->getMediaPlugin();
- if (media_plugin)
- {
- // All links from tos_html should be opened in external browser
- media_plugin->setOverrideClickTarget("_external");
- }
+ web_browser->addObserver(this);
+
+ // Don't use the start_url parameter for this browser instance -- it may finish loading before we get to add our observer.
+ // Store the URL separately and navigate here instead.
+ web_browser->navigateTo( getString( "loading_url" ) );
+ LLPluginClassMedia* media_plugin = web_browser->getMediaPlugin();
+ if (media_plugin)
+ {
+ // All links from tos_html should be opened in external browser
+ media_plugin->setOverrideClickTarget("_external");
+ }
#endif
- }
+ }
- return TRUE;
+ return TRUE;
}
void LLFloaterTOS::setSiteIsAlive( bool alive )
@@ -120,38 +120,38 @@ void LLFloaterTOS::setSiteIsAlive( bool alive )
// (e.g.) Linux users because of lack of media support for HTML ToS page
// force the regular HTML UI to deactivate so alternative is rendered instead.
#ifdef EXTERNAL_TOS
- mSiteAlive = false;
+ mSiteAlive = false;
#else
- mSiteAlive = alive;
-
- // only do this for TOS pages
- if (hasChild("tos_html"))
- {
- // if the contents of the site was retrieved
- if ( alive )
- {
- // navigate to the "real" page
- if(!mRealNavigateBegun && mSiteAlive)
- {
- LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
- if(web_browser)
- {
- mRealNavigateBegun = true;
- web_browser->navigateTo( getString( "real_url" ) );
- }
- }
- }
- else
- {
- LL_INFOS("TOS") << "ToS page: ToS page unavailable!" << LL_ENDL;
- // normally this is set when navigation to TOS page navigation completes (so you can't accept before TOS loads)
- // but if the page is unavailable, we need to do this now
- updateAgreeEnabled(true);
- LLTextBox* tos_list = getChild<LLTextBox>("agree_list");
- tos_list->setEnabled(true);
- }
- }
+ mSiteAlive = alive;
+
+ // only do this for TOS pages
+ if (hasChild("tos_html"))
+ {
+ // if the contents of the site was retrieved
+ if ( alive )
+ {
+ // navigate to the "real" page
+ if(!mRealNavigateBegun && mSiteAlive)
+ {
+ LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
+ if(web_browser)
+ {
+ mRealNavigateBegun = true;
+ web_browser->navigateTo( getString( "real_url" ) );
+ }
+ }
+ }
+ else
+ {
+ LL_INFOS("TOS") << "ToS page: ToS page unavailable!" << LL_ENDL;
+ // normally this is set when navigation to TOS page navigation completes (so you can't accept before TOS loads)
+ // but if the page is unavailable, we need to do this now
+ updateAgreeEnabled(true);
+ LLTextBox* tos_list = getChild<LLTextBox>("agree_list");
+ tos_list->setEnabled(true);
+ }
+ }
#endif
}
@@ -162,86 +162,86 @@ LLFloaterTOS::~LLFloaterTOS()
// virtual
void LLFloaterTOS::draw()
{
- // draw children
- LLModalDialog::draw();
+ // draw children
+ LLModalDialog::draw();
}
// update status of "Agree" checkbox and text
void LLFloaterTOS::updateAgreeEnabled(bool enabled)
{
- LLCheckBoxCtrl* tos_agreement_agree_cb = getChild<LLCheckBoxCtrl>("agree_chk");
- tos_agreement_agree_cb->setEnabled(enabled);
+ LLCheckBoxCtrl* tos_agreement_agree_cb = getChild<LLCheckBoxCtrl>("agree_chk");
+ tos_agreement_agree_cb->setEnabled(enabled);
- LLTextBox* tos_agreement_agree_text = getChild<LLTextBox>("agree_list");
- tos_agreement_agree_text->setEnabled(enabled);
+ LLTextBox* tos_agreement_agree_text = getChild<LLTextBox>("agree_list");
+ tos_agreement_agree_text->setEnabled(enabled);
}
// static
void LLFloaterTOS::updateAgree(LLUICtrl*, void* userdata )
{
- LLFloaterTOS* self = (LLFloaterTOS*) userdata;
- bool agree = self->getChild<LLUICtrl>("agree_chk")->getValue().asBoolean();
- self->getChildView("Continue")->setEnabled(agree);
+ LLFloaterTOS* self = (LLFloaterTOS*) userdata;
+ bool agree = self->getChild<LLUICtrl>("agree_chk")->getValue().asBoolean();
+ self->getChildView("Continue")->setEnabled(agree);
}
// static
void LLFloaterTOS::onContinue( void* userdata )
{
- LLFloaterTOS* self = (LLFloaterTOS*) userdata;
- LL_INFOS("TOS") << "User agrees with TOS." << LL_ENDL;
+ LLFloaterTOS* self = (LLFloaterTOS*) userdata;
+ LL_INFOS("TOS") << "User agrees with TOS." << LL_ENDL;
- if(self->mReplyPumpName != "")
- {
- LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD(true));
- }
+ if(self->mReplyPumpName != "")
+ {
+ LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD(true));
+ }
- self->closeFloater(); // destroys this object
+ self->closeFloater(); // destroys this object
}
// static
void LLFloaterTOS::onCancel( void* userdata )
{
- LLFloaterTOS* self = (LLFloaterTOS*) userdata;
- LL_INFOS("TOS") << "User disagrees with TOS." << LL_ENDL;
- LLNotificationsUtil::add("MustAgreeToLogIn", LLSD(), LLSD(), login_alert_done);
-
- if(self->mReplyPumpName != "")
- {
- LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD(false));
- }
-
- // reset state for next time we come to TOS
- self->mLoadingScreenLoaded = false;
- self->mSiteAlive = false;
- self->mRealNavigateBegun = false;
-
- // destroys this object
- self->closeFloater();
+ LLFloaterTOS* self = (LLFloaterTOS*) userdata;
+ LL_INFOS("TOS") << "User disagrees with TOS." << LL_ENDL;
+ LLNotificationsUtil::add("MustAgreeToLogIn", LLSD(), LLSD(), login_alert_done);
+
+ if(self->mReplyPumpName != "")
+ {
+ LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD(false));
+ }
+
+ // reset state for next time we come to TOS
+ self->mLoadingScreenLoaded = false;
+ self->mSiteAlive = false;
+ self->mRealNavigateBegun = false;
+
+ // destroys this object
+ self->closeFloater();
}
-//virtual
+//virtual
void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent event)
{
- if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
- {
- if(!mLoadingScreenLoaded)
- {
- mLoadingScreenLoaded = true;
+ if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
+ {
+ if(!mLoadingScreenLoaded)
+ {
+ mLoadingScreenLoaded = true;
std::string url(getString("real_url"));
LLHandle<LLFloater> handle = getHandle();
LLCoros::instance().launch("LLFloaterTOS::testSiteIsAliveCoro",
boost::bind(&LLFloaterTOS::testSiteIsAliveCoro, handle, url));
- }
- else if(mRealNavigateBegun)
- {
- LL_INFOS("TOS") << "TOS: NAVIGATE COMPLETE" << LL_ENDL;
- // enable Agree to TOS check box now that page has loaded
- updateAgreeEnabled(true);
- }
- }
+ }
+ else if(mRealNavigateBegun)
+ {
+ LL_INFOS("TOS") << "TOS: NAVIGATE COMPLETE" << LL_ENDL;
+ // enable Agree to TOS check box now that page has loaded
+ updateAgreeEnabled(true);
+ }
+ }
}
void LLFloaterTOS::testSiteIsAliveCoro(LLHandle<LLFloater> handle, std::string url)
@@ -253,7 +253,7 @@ void LLFloaterTOS::testSiteIsAliveCoro(LLHandle<LLFloater> handle, std::string u
LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
httpOpts->setWantHeaders(true);
- httpOpts->setHeadersOnly(true);
+ httpOpts->setHeadersOnly(true);
LL_INFOS("testSiteIsAliveCoro") << "Generic POST for " << url << LL_ENDL;
@@ -269,9 +269,9 @@ void LLFloaterTOS::testSiteIsAliveCoro(LLHandle<LLFloater> handle, std::string u
}
LLFloaterTOS *that = dynamic_cast<LLFloaterTOS *>(handle.get());
-
+
if (that)
- that->setSiteIsAlive(static_cast<bool>(status));
+ that->setSiteIsAlive(static_cast<bool>(status));
else
{
LL_WARNS("testSiteIsAliveCoro") << "Handle was not a TOS floater." << LL_ENDL;
diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h
index 7c2f0705b7..b4f08be00b 100644
--- a/indra/newview/llfloatertos.h
+++ b/indra/newview/llfloatertos.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertos.h
* @brief Terms of Service Agreement dialog
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,37 +39,37 @@ class LLRadioGroup;
class LLTextEditor;
class LLUUID;
-class LLFloaterTOS :
- public LLModalDialog,
- public LLViewerMediaObserver
+class LLFloaterTOS :
+ public LLModalDialog,
+ public LLViewerMediaObserver
{
public:
- LLFloaterTOS(const LLSD& data);
- virtual ~LLFloaterTOS();
+ LLFloaterTOS(const LLSD& data);
+ virtual ~LLFloaterTOS();
+
+ BOOL postBuild();
- BOOL postBuild();
-
- virtual void draw();
+ virtual void draw();
- static void updateAgree( LLUICtrl *, void* userdata );
- static void onContinue( void* userdata );
- static void onCancel( void* userdata );
+ static void updateAgree( LLUICtrl *, void* userdata );
+ static void onContinue( void* userdata );
+ static void onCancel( void* userdata );
- void setSiteIsAlive( bool alive );
+ void setSiteIsAlive( bool alive );
- void updateAgreeEnabled(bool enabled);
+ void updateAgreeEnabled(bool enabled);
- // inherited from LLViewerMediaObserver
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+ // inherited from LLViewerMediaObserver
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
private:
static void testSiteIsAliveCoro(LLHandle<LLFloater> handle, std::string url);
- std::string mMessage;
- bool mLoadingScreenLoaded;
- bool mSiteAlive;
- bool mRealNavigateBegun;
- std::string mReplyPumpName;
+ std::string mMessage;
+ bool mLoadingScreenLoaded;
+ bool mSiteAlive;
+ bool mRealNavigateBegun;
+ std::string mReplyPumpName;
};
diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp
index a025a859e7..635d1e2bc4 100644
--- a/indra/newview/llfloatertoybox.cpp
+++ b/indra/newview/llfloatertoybox.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertoybox.cpp
* @brief The toybox for flexibilizing the UI.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,11 +38,11 @@
#include "lltrans.h"
LLFloaterToybox::LLFloaterToybox(const LLSD& key)
- : LLFloater(key)
- , mToolBar(NULL)
+ : LLFloater(key)
+ , mToolBar(NULL)
{
- mCommitCallbackRegistrar.add("Toybox.RestoreDefaults", boost::bind(&LLFloaterToybox::onBtnRestoreDefaults, this));
- mCommitCallbackRegistrar.add("Toybox.ClearAll", boost::bind(&LLFloaterToybox::onBtnClearAll, this));
+ mCommitCallbackRegistrar.add("Toybox.RestoreDefaults", boost::bind(&LLFloaterToybox::onBtnRestoreDefaults, this));
+ mCommitCallbackRegistrar.add("Toybox.ClearAll", boost::bind(&LLFloaterToybox::onBtnClearAll, this));
}
LLFloaterToybox::~LLFloaterToybox()
@@ -51,91 +51,91 @@ LLFloaterToybox::~LLFloaterToybox()
bool compare_localized_command_labels(LLCommand * cmd1, LLCommand * cmd2)
{
- std::string lab1 = LLTrans::getString(cmd1->labelRef());
- std::string lab2 = LLTrans::getString(cmd2->labelRef());
+ std::string lab1 = LLTrans::getString(cmd1->labelRef());
+ std::string lab2 = LLTrans::getString(cmd2->labelRef());
- return (lab1 < lab2);
+ return (lab1 < lab2);
}
BOOL LLFloaterToybox::postBuild()
-{
- mToolBar = getChild<LLToolBar>("toybox_toolbar");
-
- mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
- mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
- mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
- mToolBar->setButtonEnterCallback(boost::bind(&LLFloaterToybox::onToolBarButtonEnter,this,_1));
-
- //
- // Sort commands by localized labels so they will appear alphabetized in all languages
- //
-
- std::list<LLCommand *> alphabetized_commands;
-
- LLCommandManager& cmdMgr = LLCommandManager::instance();
- for (U32 i = 0; i < cmdMgr.commandCount(); i++)
- {
- LLCommand * command = cmdMgr.getCommand(i);
-
- if (command->availableInToybox())
- {
- alphabetized_commands.push_back(command);
- }
- }
-
- alphabetized_commands.sort(compare_localized_command_labels);
-
- //
- // Create Buttons
- //
-
- for (std::list<LLCommand *>::iterator it = alphabetized_commands.begin(); it != alphabetized_commands.end(); ++it)
- {
- mToolBar->addCommand((*it)->id());
- }
-
- return TRUE;
+{
+ mToolBar = getChild<LLToolBar>("toybox_toolbar");
+
+ mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
+ mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
+ mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
+ mToolBar->setButtonEnterCallback(boost::bind(&LLFloaterToybox::onToolBarButtonEnter,this,_1));
+
+ //
+ // Sort commands by localized labels so they will appear alphabetized in all languages
+ //
+
+ std::list<LLCommand *> alphabetized_commands;
+
+ LLCommandManager& cmdMgr = LLCommandManager::instance();
+ for (U32 i = 0; i < cmdMgr.commandCount(); i++)
+ {
+ LLCommand * command = cmdMgr.getCommand(i);
+
+ if (command->availableInToybox())
+ {
+ alphabetized_commands.push_back(command);
+ }
+ }
+
+ alphabetized_commands.sort(compare_localized_command_labels);
+
+ //
+ // Create Buttons
+ //
+
+ for (std::list<LLCommand *>::iterator it = alphabetized_commands.begin(); it != alphabetized_commands.end(); ++it)
+ {
+ mToolBar->addCommand((*it)->id());
+ }
+
+ return TRUE;
}
void LLFloaterToybox::draw()
{
- llassert(gToolBarView != NULL);
+ llassert(gToolBarView != NULL);
- const command_id_list_t& command_list = mToolBar->getCommandsList();
+ const command_id_list_t& command_list = mToolBar->getCommandsList();
- for (command_id_list_t::const_iterator it = command_list.begin(); it != command_list.end(); ++it)
- {
- const LLCommandId& id = *it;
+ for (command_id_list_t::const_iterator it = command_list.begin(); it != command_list.end(); ++it)
+ {
+ const LLCommandId& id = *it;
- const bool command_not_present = (gToolBarView->hasCommand(id) == LLToolBarEnums::TOOLBAR_NONE);
- mToolBar->enableCommand(id, command_not_present);
- }
+ const bool command_not_present = (gToolBarView->hasCommand(id) == LLToolBarEnums::TOOLBAR_NONE);
+ mToolBar->enableCommand(id, command_not_present);
+ }
- LLFloater::draw();
+ LLFloater::draw();
}
static bool finish_restore_toybox(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- LLToolBarView::loadDefaultToolbars();
- }
+ if (option == 0)
+ {
+ LLToolBarView::loadDefaultToolbars();
+ }
- return false;
+ return false;
}
static bool finish_clear_all_toybox(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- LLToolBarView::clearAllToolbars();
- }
+ if (option == 0)
+ {
+ LLToolBarView::clearAllToolbars();
+ }
- return false;
+ return false;
}
static LLNotificationFunctorRegistration finish_restore_toybox_reg("ConfirmRestoreToybox", finish_restore_toybox);
@@ -143,48 +143,48 @@ static LLNotificationFunctorRegistration finish_clear_all_toybox_reg("ConfirmCle
void LLFloaterToybox::onBtnRestoreDefaults()
{
- LLNotificationsUtil::add("ConfirmRestoreToybox");
+ LLNotificationsUtil::add("ConfirmRestoreToybox");
}
void LLFloaterToybox::onBtnClearAll()
{
- LLNotificationsUtil::add("ConfirmClearAllToybox");
+ LLNotificationsUtil::add("ConfirmClearAllToybox");
}
BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
{
- S32 local_x = x - mToolBar->getRect().mLeft;
- S32 local_y = y - mToolBar->getRect().mBottom;
- return mToolBar->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+ S32 local_x = x - mToolBar->getRect().mLeft;
+ S32 local_y = y - mToolBar->getRect().mBottom;
+ return mToolBar->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
}
void LLFloaterToybox::onToolBarButtonEnter(LLView* button)
{
- std::string suffix = "";
+ std::string suffix = "";
- LLCommandId commandId(button->getName());
- LLCommand* command = LLCommandManager::instance().getCommand(commandId);
+ LLCommandId commandId(button->getName());
+ LLCommand* command = LLCommandManager::instance().getCommand(commandId);
- if (command)
- {
- S32 command_loc = gToolBarView->hasCommand(commandId);
+ if (command)
+ {
+ S32 command_loc = gToolBarView->hasCommand(commandId);
- switch(command_loc)
- {
- case LLToolBarEnums::TOOLBAR_BOTTOM: suffix = LLTrans::getString("Toolbar_Bottom_Tooltip"); break;
- case LLToolBarEnums::TOOLBAR_LEFT: suffix = LLTrans::getString("Toolbar_Left_Tooltip"); break;
- case LLToolBarEnums::TOOLBAR_RIGHT: suffix = LLTrans::getString("Toolbar_Right_Tooltip"); break;
+ switch(command_loc)
+ {
+ case LLToolBarEnums::TOOLBAR_BOTTOM: suffix = LLTrans::getString("Toolbar_Bottom_Tooltip"); break;
+ case LLToolBarEnums::TOOLBAR_LEFT: suffix = LLTrans::getString("Toolbar_Left_Tooltip"); break;
+ case LLToolBarEnums::TOOLBAR_RIGHT: suffix = LLTrans::getString("Toolbar_Right_Tooltip"); break;
- default:
- break;
- }
- }
+ default:
+ break;
+ }
+ }
- mToolBar->setTooltipButtonSuffix(suffix);
+ mToolBar->setTooltipButtonSuffix(suffix);
}
diff --git a/indra/newview/llfloatertoybox.h b/indra/newview/llfloatertoybox.h
index 10aee0e6f5..fa7ef51703 100644
--- a/indra/newview/llfloatertoybox.h
+++ b/indra/newview/llfloatertoybox.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertoybox.h
* @brief The toybox for flexibilizing the UI.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,26 +37,26 @@ class LLToolBar;
class LLFloaterToybox : public LLFloater
{
public:
- LLFloaterToybox(const LLSD& key);
- virtual ~LLFloaterToybox();
-
- // virtuals
- BOOL postBuild();
- void draw();
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
+ LLFloaterToybox(const LLSD& key);
+ virtual ~LLFloaterToybox();
+
+ // virtuals
+ BOOL postBuild();
+ void draw();
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
protected:
- void onBtnClearAll();
- void onBtnRestoreDefaults();
+ void onBtnClearAll();
+ void onBtnRestoreDefaults();
- void onToolBarButtonEnter(LLView* button);
+ void onToolBarButtonEnter(LLView* button);
public:
- LLToolBar * mToolBar;
+ LLToolBar * mToolBar;
};
#endif // LL_LLFLOATERTOYBOX_H
diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp
index d29ecbbf95..61c4e05183 100644
--- a/indra/newview/llfloatertranslationsettings.cpp
+++ b/indra/newview/llfloatertranslationsettings.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertranslationsettings.cpp
* @brief Machine translation settings for chat
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,41 +43,41 @@
#include "llradiogroup.h"
LLFloaterTranslationSettings::LLFloaterTranslationSettings(const LLSD& key)
-: LLFloater(key)
-, mMachineTranslationCB(NULL)
-, mAzureKeyVerified(false)
-, mGoogleKeyVerified(false)
-, mDeepLKeyVerified(false)
+: LLFloater(key)
+, mMachineTranslationCB(NULL)
+, mAzureKeyVerified(false)
+, mGoogleKeyVerified(false)
+, mDeepLKeyVerified(false)
{
}
// virtual
BOOL LLFloaterTranslationSettings::postBuild()
{
- mMachineTranslationCB = getChild<LLCheckBoxCtrl>("translate_chat_checkbox");
- mLanguageCombo = getChild<LLComboBox>("translate_language_combo");
- mTranslationServiceRadioGroup = getChild<LLRadioGroup>("translation_service_rg");
+ mMachineTranslationCB = getChild<LLCheckBoxCtrl>("translate_chat_checkbox");
+ mLanguageCombo = getChild<LLComboBox>("translate_language_combo");
+ mTranslationServiceRadioGroup = getChild<LLRadioGroup>("translation_service_rg");
mAzureAPIEndpointEditor = getChild<LLComboBox>("azure_api_endpoint_combo");
- mAzureAPIKeyEditor = getChild<LLLineEditor>("azure_api_key");
+ mAzureAPIKeyEditor = getChild<LLLineEditor>("azure_api_key");
mAzureAPIRegionEditor = getChild<LLLineEditor>("azure_api_region");
- mGoogleAPIKeyEditor = getChild<LLLineEditor>("google_api_key");
+ mGoogleAPIKeyEditor = getChild<LLLineEditor>("google_api_key");
mDeepLAPIDomainCombo = getChild<LLComboBox>("deepl_api_domain_combo");
mDeepLAPIKeyEditor = getChild<LLLineEditor>("deepl_api_key");
- mAzureVerifyBtn = getChild<LLButton>("verify_azure_api_key_btn");
- mGoogleVerifyBtn = getChild<LLButton>("verify_google_api_key_btn");
+ mAzureVerifyBtn = getChild<LLButton>("verify_azure_api_key_btn");
+ mGoogleVerifyBtn = getChild<LLButton>("verify_google_api_key_btn");
mDeepLVerifyBtn = getChild<LLButton>("verify_deepl_api_key_btn");
- mOKBtn = getChild<LLButton>("ok_btn");
-
- mMachineTranslationCB->setCommitCallback(boost::bind(&LLFloaterTranslationSettings::updateControlsEnabledState, this));
- mTranslationServiceRadioGroup->setCommitCallback(boost::bind(&LLFloaterTranslationSettings::updateControlsEnabledState, this));
- mOKBtn->setClickedCallback(boost::bind(&LLFloaterTranslationSettings::onBtnOK, this));
- getChild<LLButton>("cancel_btn")->setClickedCallback(boost::bind(&LLFloater::closeFloater, this, false));
- mAzureVerifyBtn->setClickedCallback(boost::bind(&LLFloaterTranslationSettings::onBtnAzureVerify, this));
- mGoogleVerifyBtn->setClickedCallback(boost::bind(&LLFloaterTranslationSettings::onBtnGoogleVerify, this));
+ mOKBtn = getChild<LLButton>("ok_btn");
+
+ mMachineTranslationCB->setCommitCallback(boost::bind(&LLFloaterTranslationSettings::updateControlsEnabledState, this));
+ mTranslationServiceRadioGroup->setCommitCallback(boost::bind(&LLFloaterTranslationSettings::updateControlsEnabledState, this));
+ mOKBtn->setClickedCallback(boost::bind(&LLFloaterTranslationSettings::onBtnOK, this));
+ getChild<LLButton>("cancel_btn")->setClickedCallback(boost::bind(&LLFloater::closeFloater, this, false));
+ mAzureVerifyBtn->setClickedCallback(boost::bind(&LLFloaterTranslationSettings::onBtnAzureVerify, this));
+ mGoogleVerifyBtn->setClickedCallback(boost::bind(&LLFloaterTranslationSettings::onBtnGoogleVerify, this));
mDeepLVerifyBtn->setClickedCallback(boost::bind(&LLFloaterTranslationSettings::onBtnDeepLVerify, this));
- mAzureAPIKeyEditor->setFocusReceivedCallback(boost::bind(&LLFloaterTranslationSettings::onEditorFocused, this, _1));
- mAzureAPIKeyEditor->setKeystrokeCallback(boost::bind(&LLFloaterTranslationSettings::onAzureKeyEdited, this), NULL);
+ mAzureAPIKeyEditor->setFocusReceivedCallback(boost::bind(&LLFloaterTranslationSettings::onEditorFocused, this, _1));
+ mAzureAPIKeyEditor->setKeystrokeCallback(boost::bind(&LLFloaterTranslationSettings::onAzureKeyEdited, this), NULL);
mAzureAPIRegionEditor->setFocusReceivedCallback(boost::bind(&LLFloaterTranslationSettings::onEditorFocused, this, _1));
mAzureAPIRegionEditor->setKeystrokeCallback(boost::bind(&LLFloaterTranslationSettings::onAzureKeyEdited, this), NULL);
@@ -90,8 +90,8 @@ BOOL LLFloaterTranslationSettings::postBuild()
setAzureVerified(false, false, 0);
});
- mGoogleAPIKeyEditor->setFocusReceivedCallback(boost::bind(&LLFloaterTranslationSettings::onEditorFocused, this, _1));
- mGoogleAPIKeyEditor->setKeystrokeCallback(boost::bind(&LLFloaterTranslationSettings::onGoogleKeyEdited, this), NULL);
+ mGoogleAPIKeyEditor->setFocusReceivedCallback(boost::bind(&LLFloaterTranslationSettings::onEditorFocused, this, _1));
+ mGoogleAPIKeyEditor->setKeystrokeCallback(boost::bind(&LLFloaterTranslationSettings::onGoogleKeyEdited, this), NULL);
mDeepLAPIKeyEditor->setFocusReceivedCallback(boost::bind(&LLFloaterTranslationSettings::onEditorFocused, this, _1));
mDeepLAPIKeyEditor->setKeystrokeCallback(boost::bind(&LLFloaterTranslationSettings::onDeepLKeyEdited, this), NULL);
@@ -105,22 +105,22 @@ BOOL LLFloaterTranslationSettings::postBuild()
setDeepLVerified(false, false, 0);
});
- center();
- return TRUE;
+ center();
+ return TRUE;
}
// virtual
void LLFloaterTranslationSettings::onOpen(const LLSD& key)
{
- mMachineTranslationCB->setValue(gSavedSettings.getBOOL("TranslateChat"));
- mLanguageCombo->setSelectedByValue(gSavedSettings.getString("TranslateLanguage"), TRUE);
- mTranslationServiceRadioGroup->setSelectedByValue(gSavedSettings.getString("TranslationService"), TRUE);
-
- LLSD azure_key = gSavedSettings.getLLSD("AzureTranslateAPIKey");
- if (azure_key.isMap() && !azure_key["id"].asString().empty())
- {
- mAzureAPIKeyEditor->setText(azure_key["id"].asString());
- mAzureAPIKeyEditor->setTentative(false);
+ mMachineTranslationCB->setValue(gSavedSettings.getBOOL("TranslateChat"));
+ mLanguageCombo->setSelectedByValue(gSavedSettings.getString("TranslateLanguage"), TRUE);
+ mTranslationServiceRadioGroup->setSelectedByValue(gSavedSettings.getString("TranslationService"), TRUE);
+
+ LLSD azure_key = gSavedSettings.getLLSD("AzureTranslateAPIKey");
+ if (azure_key.isMap() && !azure_key["id"].asString().empty())
+ {
+ mAzureAPIKeyEditor->setText(azure_key["id"].asString());
+ mAzureAPIKeyEditor->setTentative(false);
if (azure_key.has("region") && !azure_key["region"].asString().empty())
{
mAzureAPIRegionEditor->setText(azure_key["region"].asString());
@@ -131,27 +131,27 @@ void LLFloaterTranslationSettings::onOpen(const LLSD& key)
mAzureAPIRegionEditor->setTentative(true);
}
mAzureAPIEndpointEditor->setValue(azure_key["endpoint"]);
- verifyKey(LLTranslate::SERVICE_AZURE, azure_key, false);
- }
- else
- {
- mAzureAPIKeyEditor->setTentative(TRUE);
+ verifyKey(LLTranslate::SERVICE_AZURE, azure_key, false);
+ }
+ else
+ {
+ mAzureAPIKeyEditor->setTentative(TRUE);
mAzureAPIRegionEditor->setTentative(true);
- mAzureKeyVerified = FALSE;
- }
-
- std::string google_key = gSavedSettings.getString("GoogleTranslateAPIKey");
- if (!google_key.empty())
- {
- mGoogleAPIKeyEditor->setText(google_key);
- mGoogleAPIKeyEditor->setTentative(FALSE);
- verifyKey(LLTranslate::SERVICE_GOOGLE, google_key, false);
- }
- else
- {
- mGoogleAPIKeyEditor->setTentative(TRUE);
- mGoogleKeyVerified = FALSE;
- }
+ mAzureKeyVerified = FALSE;
+ }
+
+ std::string google_key = gSavedSettings.getString("GoogleTranslateAPIKey");
+ if (!google_key.empty())
+ {
+ mGoogleAPIKeyEditor->setText(google_key);
+ mGoogleAPIKeyEditor->setTentative(FALSE);
+ verifyKey(LLTranslate::SERVICE_GOOGLE, google_key, false);
+ }
+ else
+ {
+ mGoogleAPIKeyEditor->setTentative(TRUE);
+ mGoogleKeyVerified = FALSE;
+ }
LLSD deepl_key = gSavedSettings.getLLSD("DeepLTranslateAPIKey");
if (deepl_key.isMap() && !deepl_key["id"].asString().empty())
@@ -167,29 +167,29 @@ void LLFloaterTranslationSettings::onOpen(const LLSD& key)
mDeepLKeyVerified = FALSE;
}
- updateControlsEnabledState();
+ updateControlsEnabledState();
}
void LLFloaterTranslationSettings::setAzureVerified(bool ok, bool alert, S32 status)
{
- if (alert)
- {
- showAlert(ok ? "azure_api_key_verified" : "azure_api_key_not_verified", status);
- }
+ if (alert)
+ {
+ showAlert(ok ? "azure_api_key_verified" : "azure_api_key_not_verified", status);
+ }
- mAzureKeyVerified = ok;
- updateControlsEnabledState();
+ mAzureKeyVerified = ok;
+ updateControlsEnabledState();
}
void LLFloaterTranslationSettings::setGoogleVerified(bool ok, bool alert, S32 status)
{
- if (alert)
- {
- showAlert(ok ? "google_api_key_verified" : "google_api_key_not_verified", status);
- }
+ if (alert)
+ {
+ showAlert(ok ? "google_api_key_verified" : "google_api_key_not_verified", status);
+ }
- mGoogleKeyVerified = ok;
- updateControlsEnabledState();
+ mGoogleKeyVerified = ok;
+ updateControlsEnabledState();
}
void LLFloaterTranslationSettings::setDeepLVerified(bool ok, bool alert, S32 status)
@@ -205,7 +205,7 @@ void LLFloaterTranslationSettings::setDeepLVerified(bool ok, bool alert, S32 sta
std::string LLFloaterTranslationSettings::getSelectedService() const
{
- return mTranslationServiceRadioGroup->getSelectedValue().asString();
+ return mTranslationServiceRadioGroup->getSelectedValue().asString();
}
LLSD LLFloaterTranslationSettings::getEnteredAzureKey() const
@@ -220,12 +220,12 @@ LLSD LLFloaterTranslationSettings::getEnteredAzureKey() const
key["region"] = mAzureAPIRegionEditor->getText();
}
}
- return key;
+ return key;
}
std::string LLFloaterTranslationSettings::getEnteredGoogleKey() const
{
- return mGoogleAPIKeyEditor->getTentative() ? LLStringUtil::null : mGoogleAPIKeyEditor->getText();
+ return mGoogleAPIKeyEditor->getTentative() ? LLStringUtil::null : mGoogleAPIKeyEditor->getText();
}
LLSD LLFloaterTranslationSettings::getEnteredDeepLKey() const
@@ -246,22 +246,22 @@ void LLFloaterTranslationSettings::showAlert(const std::string& msg_name, S32 st
string_args["[STATUS]"] = llformat("%d", status);
std::string message = getString(msg_name, string_args);
- LLSD args;
- args["MESSAGE"] = message;
- LLNotificationsUtil::add("GenericAlert", args);
+ LLSD args;
+ args["MESSAGE"] = message;
+ LLNotificationsUtil::add("GenericAlert", args);
}
void LLFloaterTranslationSettings::updateControlsEnabledState()
{
- // Enable/disable controls based on the checkbox value.
- bool on = mMachineTranslationCB->getValue().asBoolean();
- std::string service = getSelectedService();
- bool azure_selected = service == "azure";
- bool google_selected = service == "google";
+ // Enable/disable controls based on the checkbox value.
+ bool on = mMachineTranslationCB->getValue().asBoolean();
+ std::string service = getSelectedService();
+ bool azure_selected = service == "azure";
+ bool google_selected = service == "google";
bool deepl_selected = service == "deepl";
- mTranslationServiceRadioGroup->setEnabled(on);
- mLanguageCombo->setEnabled(on);
+ mTranslationServiceRadioGroup->setEnabled(on);
+ mLanguageCombo->setEnabled(on);
// MS Azure
getChild<LLTextBox>("azure_api_endoint_label")->setEnabled(on);
@@ -278,8 +278,8 @@ void LLFloaterTranslationSettings::updateControlsEnabledState()
getChild<LLTextBox>("google_api_key_label")->setEnabled(on);
mGoogleAPIKeyEditor->setEnabled(on && google_selected);
- mGoogleVerifyBtn->setEnabled(on && google_selected &&
- !mGoogleKeyVerified && !getEnteredGoogleKey().empty());
+ mGoogleVerifyBtn->setEnabled(on && google_selected &&
+ !mGoogleKeyVerified && !getEnteredGoogleKey().empty());
// DeepL
getChild<LLTextBox>("deepl_api_domain_label")->setEnabled(on);
@@ -291,12 +291,12 @@ void LLFloaterTranslationSettings::updateControlsEnabledState()
!mDeepLKeyVerified && getEnteredDeepLKey().isMap());
bool service_verified =
- (azure_selected && mAzureKeyVerified)
+ (azure_selected && mAzureKeyVerified)
|| (google_selected && mGoogleKeyVerified)
|| (deepl_selected && mDeepLKeyVerified);
- gSavedPerAccountSettings.setBOOL("TranslatingEnabled", service_verified);
+ gSavedPerAccountSettings.setBOOL("TranslatingEnabled", service_verified);
- mOKBtn->setEnabled(!on || service_verified);
+ mOKBtn->setEnabled(!on || service_verified);
}
/*static*/
@@ -334,33 +334,33 @@ void LLFloaterTranslationSettings::verifyKey(int service, const LLSD& key, bool
void LLFloaterTranslationSettings::onEditorFocused(LLFocusableElement* control)
{
- LLLineEditor* editor = dynamic_cast<LLLineEditor*>(control);
- if (editor && editor->hasTabStop()) // if enabled. getEnabled() doesn't work
- {
- if (editor->getTentative())
- {
- editor->setText(LLStringUtil::null);
- editor->setTentative(FALSE);
- }
- }
+ LLLineEditor* editor = dynamic_cast<LLLineEditor*>(control);
+ if (editor && editor->hasTabStop()) // if enabled. getEnabled() doesn't work
+ {
+ if (editor->getTentative())
+ {
+ editor->setText(LLStringUtil::null);
+ editor->setTentative(FALSE);
+ }
+ }
}
void LLFloaterTranslationSettings::onAzureKeyEdited()
{
- if (mAzureAPIKeyEditor->isDirty()
+ if (mAzureAPIKeyEditor->isDirty()
|| mAzureAPIRegionEditor->isDirty())
- {
+ {
// todo: verify mAzureAPIEndpointEditor url
- setAzureVerified(false, false, 0);
- }
+ setAzureVerified(false, false, 0);
+ }
}
void LLFloaterTranslationSettings::onGoogleKeyEdited()
{
- if (mGoogleAPIKeyEditor->isDirty())
- {
- setGoogleVerified(false, false, 0);
- }
+ if (mGoogleAPIKeyEditor->isDirty())
+ {
+ setGoogleVerified(false, false, 0);
+ }
}
void LLFloaterTranslationSettings::onDeepLKeyEdited()
@@ -373,20 +373,20 @@ void LLFloaterTranslationSettings::onDeepLKeyEdited()
void LLFloaterTranslationSettings::onBtnAzureVerify()
{
- LLSD key = getEnteredAzureKey();
- if (key.isMap())
- {
- verifyKey(LLTranslate::SERVICE_AZURE, key);
- }
+ LLSD key = getEnteredAzureKey();
+ if (key.isMap())
+ {
+ verifyKey(LLTranslate::SERVICE_AZURE, key);
+ }
}
void LLFloaterTranslationSettings::onBtnGoogleVerify()
{
- std::string key = getEnteredGoogleKey();
- if (!key.empty())
- {
- verifyKey(LLTranslate::SERVICE_GOOGLE, LLSD(key));
- }
+ std::string key = getEnteredGoogleKey();
+ if (!key.empty())
+ {
+ verifyKey(LLTranslate::SERVICE_GOOGLE, LLSD(key));
+ }
}
void LLFloaterTranslationSettings::onBtnDeepLVerify()
@@ -400,9 +400,9 @@ void LLFloaterTranslationSettings::onBtnDeepLVerify()
void LLFloaterTranslationSettings::onClose(bool app_quitting)
{
- std::string service = gSavedSettings.getString("TranslationService");
- bool azure_selected = service == "azure";
- bool google_selected = service == "google";
+ std::string service = gSavedSettings.getString("TranslationService");
+ bool azure_selected = service == "azure";
+ bool google_selected = service == "google";
bool deepl_selected = service == "deepl";
bool service_verified =
@@ -413,12 +413,12 @@ void LLFloaterTranslationSettings::onClose(bool app_quitting)
}
void LLFloaterTranslationSettings::onBtnOK()
{
- gSavedSettings.setBOOL("TranslateChat", mMachineTranslationCB->getValue().asBoolean());
- gSavedSettings.setString("TranslateLanguage", mLanguageCombo->getSelectedValue().asString());
- gSavedSettings.setString("TranslationService", getSelectedService());
- gSavedSettings.setLLSD("AzureTranslateAPIKey", getEnteredAzureKey());
- gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey());
+ gSavedSettings.setBOOL("TranslateChat", mMachineTranslationCB->getValue().asBoolean());
+ gSavedSettings.setString("TranslateLanguage", mLanguageCombo->getSelectedValue().asString());
+ gSavedSettings.setString("TranslationService", getSelectedService());
+ gSavedSettings.setLLSD("AzureTranslateAPIKey", getEnteredAzureKey());
+ gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey());
gSavedSettings.setLLSD("DeepLTranslateAPIKey", getEnteredDeepLKey());
- closeFloater(false);
+ closeFloater(false);
}
diff --git a/indra/newview/llfloatertranslationsettings.h b/indra/newview/llfloatertranslationsettings.h
index eff0803fdd..1801184c7e 100644
--- a/indra/newview/llfloatertranslationsettings.h
+++ b/indra/newview/llfloatertranslationsettings.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatertranslationsettings.h
* @brief Machine translation settings for chat
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,51 +38,51 @@ class LLRadioGroup;
class LLFloaterTranslationSettings : public LLFloater
{
public:
- LLFloaterTranslationSettings(const LLSD& key);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ LLFloaterTranslationSettings(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- void setAzureVerified(bool ok, bool alert, S32 status);
- void setGoogleVerified(bool ok, bool alert, S32 status);
+ void setAzureVerified(bool ok, bool alert, S32 status);
+ void setGoogleVerified(bool ok, bool alert, S32 status);
void setDeepLVerified(bool ok, bool alert, S32 status);
- void onClose(bool app_quitting);
+ void onClose(bool app_quitting);
private:
- std::string getSelectedService() const;
- LLSD getEnteredAzureKey() const;
- std::string getEnteredGoogleKey() const;
+ std::string getSelectedService() const;
+ LLSD getEnteredAzureKey() const;
+ std::string getEnteredGoogleKey() const;
LLSD getEnteredDeepLKey() const;
- void showAlert(const std::string& msg_name, S32 status) const;
- void updateControlsEnabledState();
+ void showAlert(const std::string& msg_name, S32 status) const;
+ void updateControlsEnabledState();
void verifyKey(int service, const LLSD& key, bool alert = true);
- void onEditorFocused(LLFocusableElement* control);
- void onAzureKeyEdited();
- void onGoogleKeyEdited();
+ void onEditorFocused(LLFocusableElement* control);
+ void onAzureKeyEdited();
+ void onGoogleKeyEdited();
void onDeepLKeyEdited();
- void onBtnAzureVerify();
- void onBtnGoogleVerify();
+ void onBtnAzureVerify();
+ void onBtnGoogleVerify();
void onBtnDeepLVerify();
- void onBtnOK();
+ void onBtnOK();
static void setVerificationStatus(int service, bool alert, bool ok, S32 status);
- LLCheckBoxCtrl* mMachineTranslationCB;
- LLComboBox* mLanguageCombo;
+ LLCheckBoxCtrl* mMachineTranslationCB;
+ LLComboBox* mLanguageCombo;
LLComboBox* mAzureAPIEndpointEditor;
- LLLineEditor* mAzureAPIKeyEditor;
+ LLLineEditor* mAzureAPIKeyEditor;
LLLineEditor* mAzureAPIRegionEditor;
- LLLineEditor* mGoogleAPIKeyEditor;
+ LLLineEditor* mGoogleAPIKeyEditor;
LLComboBox* mDeepLAPIDomainCombo;
LLLineEditor* mDeepLAPIKeyEditor;
- LLRadioGroup* mTranslationServiceRadioGroup;
- LLButton* mAzureVerifyBtn;
- LLButton* mGoogleVerifyBtn;
+ LLRadioGroup* mTranslationServiceRadioGroup;
+ LLButton* mAzureVerifyBtn;
+ LLButton* mGoogleVerifyBtn;
LLButton* mDeepLVerifyBtn;
- LLButton* mOKBtn;
+ LLButton* mOKBtn;
- bool mAzureKeyVerified;
- bool mGoogleKeyVerified;
+ bool mAzureKeyVerified;
+ bool mGoogleKeyVerified;
bool mDeepLKeyVerified;
};
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index 553d09bec2..4db76c7971 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,9 +30,9 @@
// *TODO: Translate error messgaes using notifications/alerts.xml
-#include "llviewerprecompiledheaders.h" // Precompiled headers
+#include "llviewerprecompiledheaders.h" // Precompiled headers
-#include "llfloateruipreview.h" // Own header
+#include "llfloateruipreview.h" // Own header
// Internal utility
#include "lldiriterator.h"
@@ -56,10 +56,10 @@
#include "lltooltip.h"
#include "llviewermenu.h"
#include "llrngwriter.h"
-#include "llfloater.h" // superclass
+#include "llfloater.h" // superclass
#include "llfloaterreg.h"
-#include "llscrollcontainer.h" // scroll container for overlapping elements
-#include "lllivefile.h" // live file poll/stat/reload
+#include "llscrollcontainer.h" // scroll container for overlapping elements
+#include "lllivefile.h" // live file poll/stat/reload
#include "llviewermenufile.h" // LLFilePickerReplyThread
// Boost (for linux/unix command-line execv)
@@ -84,8 +84,8 @@ static LLDefaultChildRegistry::Register<LLOverlapPanel> register_overlap_panel("
static std::string get_xui_dir()
{
- std::string delim = gDirUtilp->getDirDelimiter();
- return gDirUtilp->getSkinBaseDir() + delim + "default" + delim + "xui" + delim;
+ std::string delim = gDirUtilp->getDirDelimiter();
+ return gDirUtilp->getSkinBaseDir() + delim + "default" + delim + "xui" + delim;
}
// Forward declarations to avoid header dependencies
@@ -107,115 +107,115 @@ class LLPreviewedFloater;
class LLOverlapPanel : public LLPanel
{
public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {
- Params() {}
- };
- LLOverlapPanel(Params p = Params()) : LLPanel(p),
- mSpacing(10),
- // mClickedElement(NULL),
- mLastClickedElement(NULL)
- {
- mOriginalWidth = getRect().getWidth();
- mOriginalHeight = getRect().getHeight();
- }
- virtual void draw();
-
- typedef std::map<LLView*, std::list<LLView*> > OverlapMap;
- OverlapMap mOverlapMap; // map, of XUI element to a list of XUI elements it overlaps
-
- // LLView *mClickedElement;
- LLView *mLastClickedElement;
- int mOriginalWidth, mOriginalHeight, mSpacing;
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Params() {}
+ };
+ LLOverlapPanel(Params p = Params()) : LLPanel(p),
+ mSpacing(10),
+ // mClickedElement(NULL),
+ mLastClickedElement(NULL)
+ {
+ mOriginalWidth = getRect().getWidth();
+ mOriginalHeight = getRect().getHeight();
+ }
+ virtual void draw();
+
+ typedef std::map<LLView*, std::list<LLView*> > OverlapMap;
+ OverlapMap mOverlapMap; // map, of XUI element to a list of XUI elements it overlaps
+
+ // LLView *mClickedElement;
+ LLView *mLastClickedElement;
+ int mOriginalWidth, mOriginalHeight, mSpacing;
};
class LLFloaterUIPreview : public LLFloater
{
public:
- // Setup
- LLFloaterUIPreview(const LLSD& key);
- virtual ~LLFloaterUIPreview();
-
- std::string getLocStr(S32 ID); // fetches the localization string based on what is selected in the drop-down menu
- void displayFloater(BOOL click, S32 ID); // needs to be public so live file can call it when it finds an update
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onClose(bool app_quitting);
-
- void refreshList(); // refresh list (empty it out and fill it up from scratch)
- void addFloaterEntry(const std::string& path); // add a single file's entry to the list of floaters
-
- static BOOL containerType(LLView* viewp); // check if the element is a container type and tree traverses need to look at its children
-
-public:
- LLPreviewedFloater* mDisplayedFloater; // the floater which is currently being displayed
- LLPreviewedFloater* mDisplayedFloater_2; // the floater which is currently being displayed
- LLGUIPreviewLiveFile* mLiveFile; // live file for checking for updates to the currently-displayed XML file
- LLOverlapPanel* mOverlapPanel; // custom overlapping elements panel
- // BOOL mHighlightingDiffs; // bool for whether localization diffs are being highlighted or not
- BOOL mHighlightingOverlaps; // bool for whether overlapping elements are being highlighted
-
- // typedef std::map<std::string,std::pair<std::list<std::string>,std::list<std::string> > > DiffMap; // this version copies the lists etc., and thus is bad memory-wise
- typedef std::list<std::string> StringList;
- typedef std::shared_ptr<StringList> StringListPtr;
- typedef std::map<std::string, std::pair<StringListPtr,StringListPtr> > DiffMap;
- DiffMap mDiffsMap; // map, of filename to pair of list of changed element paths and list of errors
+ // Setup
+ LLFloaterUIPreview(const LLSD& key);
+ virtual ~LLFloaterUIPreview();
+
+ std::string getLocStr(S32 ID); // fetches the localization string based on what is selected in the drop-down menu
+ void displayFloater(BOOL click, S32 ID); // needs to be public so live file can call it when it finds an update
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onClose(bool app_quitting);
+
+ void refreshList(); // refresh list (empty it out and fill it up from scratch)
+ void addFloaterEntry(const std::string& path); // add a single file's entry to the list of floaters
+
+ static BOOL containerType(LLView* viewp); // check if the element is a container type and tree traverses need to look at its children
+
+public:
+ LLPreviewedFloater* mDisplayedFloater; // the floater which is currently being displayed
+ LLPreviewedFloater* mDisplayedFloater_2; // the floater which is currently being displayed
+ LLGUIPreviewLiveFile* mLiveFile; // live file for checking for updates to the currently-displayed XML file
+ LLOverlapPanel* mOverlapPanel; // custom overlapping elements panel
+ // BOOL mHighlightingDiffs; // bool for whether localization diffs are being highlighted or not
+ BOOL mHighlightingOverlaps; // bool for whether overlapping elements are being highlighted
+
+ // typedef std::map<std::string,std::pair<std::list<std::string>,std::list<std::string> > > DiffMap; // this version copies the lists etc., and thus is bad memory-wise
+ typedef std::list<std::string> StringList;
+ typedef std::shared_ptr<StringList> StringListPtr;
+ typedef std::map<std::string, std::pair<StringListPtr,StringListPtr> > DiffMap;
+ DiffMap mDiffsMap; // map, of filename to pair of list of changed element paths and list of errors
private:
- LLExternalEditor mExternalEditor;
-
- // XUI elements for this floater
- LLScrollListCtrl* mFileList; // scroll list control for file list
- LLLineEditor* mEditorPathTextBox; // text field for path to editor executable
- LLLineEditor* mEditorArgsTextBox; // text field for arguments to editor executable
- LLLineEditor* mDiffPathTextBox; // text field for path to diff file
- LLButton* mDisplayFloaterBtn; // button to display primary floater
- LLButton* mDisplayFloaterBtn_2; // button to display secondary floater
- LLButton* mEditFloaterBtn; // button to edit floater
- LLButton* mExecutableBrowseButton; // button to browse for executable
- LLButton* mCloseOtherButton; // button to close primary displayed floater
- LLButton* mCloseOtherButton_2; // button to close secondary displayed floater
- LLButton* mDiffBrowseButton; // button to browse for diff file
- LLButton* mToggleHighlightButton; // button to toggle highlight of files/elements with diffs
- LLButton* mToggleOverlapButton; // button to togle overlap panel/highlighting
- LLComboBox* mLanguageSelection; // combo box for primary language selection
- LLComboBox* mLanguageSelection_2; // combo box for secondary language selection
- S32 mLastDisplayedX, mLastDisplayedY; // stored position of last floater so the new one opens up in the same place
- std::string mDelim; // the OS-specific delimiter character (/ or \) (*TODO: this shouldn't be needed, right?)
-
- std::string mSavedEditorPath; // stored editor path so closing this floater doesn't reset it
- std::string mSavedEditorArgs; // stored editor args so closing this floater doesn't reset it
- std::string mSavedDiffPath; // stored diff file path so closing this floater doesn't reset it
-
- // Internal functionality
- static void popupAndPrintWarning(const std::string& warning); // pop up a warning
- std::string getLocalizedDirectory(); // build and return the path to the XUI directory for the currently-selected localization
- void scanDiffFile(LLXmlTreeNode* file_node); // scan a given XML node for diff entries and highlight them in its associated file
- void highlightChangedElements(); // look up the list of elements to highlight and highlight them in the current floater
- void highlightChangedFiles(); // look up the list of changed files to highlight and highlight them in the scroll list
- void findOverlapsInChildren(LLView* parent); // fill the map below with element overlap information
- static BOOL overlapIgnorable(LLView* viewp); // check it the element can be ignored for overlap/localization purposes
-
- // check if two elements overlap using their rectangles
- // used instead of llrect functions because by adding a few pixels of leeway I can cut down drastically on the number of overlaps
- BOOL elementOverlap(LLView* view1, LLView* view2);
-
- // Button/drop-down action listeners (self explanatory)
- void onClickDisplayFloater(S32 id);
- void onClickSaveFloater(S32 id);
- void onClickSaveAll(S32 id);
- void onClickEditFloater();
- void onClickBrowseForEditor();
- void getExecutablePath(const std::vector<std::string>& filenames);
- void onClickBrowseForDiffs();
- void getDiffsFilePath(const std::vector<std::string>& filenames);
- void onClickToggleDiffHighlighting();
- void onClickToggleOverlapping();
- void onClickCloseDisplayedFloater(S32 id);
- void onLanguageComboSelect(LLUICtrl* ctrl);
- void onClickExportSchema();
- void onClickShowRectangles(const LLSD& data);
+ LLExternalEditor mExternalEditor;
+
+ // XUI elements for this floater
+ LLScrollListCtrl* mFileList; // scroll list control for file list
+ LLLineEditor* mEditorPathTextBox; // text field for path to editor executable
+ LLLineEditor* mEditorArgsTextBox; // text field for arguments to editor executable
+ LLLineEditor* mDiffPathTextBox; // text field for path to diff file
+ LLButton* mDisplayFloaterBtn; // button to display primary floater
+ LLButton* mDisplayFloaterBtn_2; // button to display secondary floater
+ LLButton* mEditFloaterBtn; // button to edit floater
+ LLButton* mExecutableBrowseButton; // button to browse for executable
+ LLButton* mCloseOtherButton; // button to close primary displayed floater
+ LLButton* mCloseOtherButton_2; // button to close secondary displayed floater
+ LLButton* mDiffBrowseButton; // button to browse for diff file
+ LLButton* mToggleHighlightButton; // button to toggle highlight of files/elements with diffs
+ LLButton* mToggleOverlapButton; // button to togle overlap panel/highlighting
+ LLComboBox* mLanguageSelection; // combo box for primary language selection
+ LLComboBox* mLanguageSelection_2; // combo box for secondary language selection
+ S32 mLastDisplayedX, mLastDisplayedY; // stored position of last floater so the new one opens up in the same place
+ std::string mDelim; // the OS-specific delimiter character (/ or \) (*TODO: this shouldn't be needed, right?)
+
+ std::string mSavedEditorPath; // stored editor path so closing this floater doesn't reset it
+ std::string mSavedEditorArgs; // stored editor args so closing this floater doesn't reset it
+ std::string mSavedDiffPath; // stored diff file path so closing this floater doesn't reset it
+
+ // Internal functionality
+ static void popupAndPrintWarning(const std::string& warning); // pop up a warning
+ std::string getLocalizedDirectory(); // build and return the path to the XUI directory for the currently-selected localization
+ void scanDiffFile(LLXmlTreeNode* file_node); // scan a given XML node for diff entries and highlight them in its associated file
+ void highlightChangedElements(); // look up the list of elements to highlight and highlight them in the current floater
+ void highlightChangedFiles(); // look up the list of changed files to highlight and highlight them in the scroll list
+ void findOverlapsInChildren(LLView* parent); // fill the map below with element overlap information
+ static BOOL overlapIgnorable(LLView* viewp); // check it the element can be ignored for overlap/localization purposes
+
+ // check if two elements overlap using their rectangles
+ // used instead of llrect functions because by adding a few pixels of leeway I can cut down drastically on the number of overlaps
+ BOOL elementOverlap(LLView* view1, LLView* view2);
+
+ // Button/drop-down action listeners (self explanatory)
+ void onClickDisplayFloater(S32 id);
+ void onClickSaveFloater(S32 id);
+ void onClickSaveAll(S32 id);
+ void onClickEditFloater();
+ void onClickBrowseForEditor();
+ void getExecutablePath(const std::vector<std::string>& filenames);
+ void onClickBrowseForDiffs();
+ void getDiffsFilePath(const std::vector<std::string>& filenames);
+ void onClickToggleDiffHighlighting();
+ void onClickToggleOverlapping();
+ void onClickCloseDisplayedFloater(S32 id);
+ void onLanguageComboSelect(LLUICtrl* ctrl);
+ void onClickExportSchema();
+ void onClickShowRectangles(const LLSD& data);
};
//----------------------------------------------------------------------------
@@ -226,11 +226,11 @@ private:
class LLLocalizationResetForcer
{
public:
- LLLocalizationResetForcer(LLFloaterUIPreview* floater, S32 ID);
- virtual ~LLLocalizationResetForcer();
+ LLLocalizationResetForcer(LLFloaterUIPreview* floater, S32 ID);
+ virtual ~LLLocalizationResetForcer();
private:
- std::string mSavedLocalization; // the localization before we change it
+ std::string mSavedLocalization; // the localization before we change it
};
// Implementation of live file
@@ -239,26 +239,26 @@ private:
class LLGUIPreviewLiveFile : public LLLiveFile
{
public:
- LLGUIPreviewLiveFile(std::string path, std::string name, LLFloaterUIPreview* parent);
- virtual ~LLGUIPreviewLiveFile();
- LLFloaterUIPreview* mParent;
- LLFadeEventTimer* mFadeTimer; // timer for fade-to-yellow-and-back effect to warn that file has been reloaded
- BOOL mFirstFade; // setting this avoids showing the fade reload warning on first load
- std::string mFileName;
+ LLGUIPreviewLiveFile(std::string path, std::string name, LLFloaterUIPreview* parent);
+ virtual ~LLGUIPreviewLiveFile();
+ LLFloaterUIPreview* mParent;
+ LLFadeEventTimer* mFadeTimer; // timer for fade-to-yellow-and-back effect to warn that file has been reloaded
+ BOOL mFirstFade; // setting this avoids showing the fade reload warning on first load
+ std::string mFileName;
protected:
- bool loadFile();
+ bool loadFile();
};
// Implementation of graphical fade in/out (on timer) for when XUI files are updated
class LLFadeEventTimer : public LLEventTimer
{
public:
- LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent);
- BOOL tick();
- LLGUIPreviewLiveFile* mParent;
+ LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent);
+ BOOL tick();
+ LLGUIPreviewLiveFile* mParent;
private:
- BOOL mFadingOut; // fades in then out; this is toggled in between
- LLColor4 mOriginalColor; // original color; color is reset to this after fade is coimplete
+ BOOL mFadingOut; // fades in then out; this is toggled in between
+ LLColor4 mOriginalColor; // original color; color is reset to this after fade is coimplete
};
// Implementation of previewed floater
@@ -266,21 +266,21 @@ private:
class LLPreviewedFloater : public LLFloater
{
public:
- LLPreviewedFloater(LLFloaterUIPreview* floater, const Params& params)
- : LLFloater(LLSD(), params),
- mFloaterUIPreview(floater)
- {
- }
+ LLPreviewedFloater(LLFloaterUIPreview* floater, const Params& params)
+ : LLFloater(LLSD(), params),
+ mFloaterUIPreview(floater)
+ {
+ }
- virtual void draw();
- BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- BOOL handleToolTip(S32 x, S32 y, MASK mask);
- BOOL selectElement(LLView* parent, int x, int y, int depth); // select element to display its overlappers
+ virtual void draw();
+ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ BOOL selectElement(LLView* parent, int x, int y, int depth); // select element to display its overlappers
- LLFloaterUIPreview* mFloaterUIPreview;
+ LLFloaterUIPreview* mFloaterUIPreview;
- // draw widget outlines
- static bool sShowRectangles;
+ // draw widget outlines
+ static bool sShowRectangles;
};
bool LLPreviewedFloater::sShowRectangles = false;
@@ -291,507 +291,507 @@ bool LLPreviewedFloater::sShowRectangles = false;
// Changes are made here
LLLocalizationResetForcer::LLLocalizationResetForcer(LLFloaterUIPreview* floater, S32 ID)
{
- mSavedLocalization = LLUI::getInstance()->mSettingGroups["config"]->getString("Language"); // save current localization setting
- LLUI::getInstance()->mSettingGroups["config"]->setString("Language", floater->getLocStr(ID));// hack language to be the one we want to preview floaters in
- // forcibly reset XUI paths with this new language
- gDirUtilp->setSkinFolder(gDirUtilp->getSkinFolder(), floater->getLocStr(ID));
+ mSavedLocalization = LLUI::getInstance()->mSettingGroups["config"]->getString("Language"); // save current localization setting
+ LLUI::getInstance()->mSettingGroups["config"]->setString("Language", floater->getLocStr(ID));// hack language to be the one we want to preview floaters in
+ // forcibly reset XUI paths with this new language
+ gDirUtilp->setSkinFolder(gDirUtilp->getSkinFolder(), floater->getLocStr(ID));
}
// Actually reset in destructor
// Changes are reversed here
LLLocalizationResetForcer::~LLLocalizationResetForcer()
{
- LLUI::getInstance()->mSettingGroups["config"]->setString("Language", mSavedLocalization); // reset language to what it was before we changed it
- // forcibly reset XUI paths with this new language
- gDirUtilp->setSkinFolder(gDirUtilp->getSkinFolder(), mSavedLocalization);
+ LLUI::getInstance()->mSettingGroups["config"]->setString("Language", mSavedLocalization); // reset language to what it was before we changed it
+ // forcibly reset XUI paths with this new language
+ gDirUtilp->setSkinFolder(gDirUtilp->getSkinFolder(), mSavedLocalization);
}
// Live file constructor
// Needs full path for LLLiveFile but needs just file name for this code, hence the reduntant arguments; easier than separating later
LLGUIPreviewLiveFile::LLGUIPreviewLiveFile(std::string path, std::string name, LLFloaterUIPreview* parent)
: mFileName(name),
- mParent(parent),
- mFirstFade(TRUE),
- mFadeTimer(NULL),
- LLLiveFile(path, 1.0)
+ mParent(parent),
+ mFirstFade(TRUE),
+ mFadeTimer(NULL),
+ LLLiveFile(path, 1.0)
{}
LLGUIPreviewLiveFile::~LLGUIPreviewLiveFile()
{
- mParent->mLiveFile = NULL;
- if(mFadeTimer)
- {
- mFadeTimer->mParent = NULL;
- // deletes itself; see lltimer.cpp
- }
+ mParent->mLiveFile = NULL;
+ if(mFadeTimer)
+ {
+ mFadeTimer->mParent = NULL;
+ // deletes itself; see lltimer.cpp
+ }
}
// Live file load
bool LLGUIPreviewLiveFile::loadFile()
{
- mParent->displayFloater(FALSE,1); // redisplay the floater
- if(mFirstFade) // only fade if it wasn't just clicked on; can't use "clicked" BOOL below because of an oddity with setting LLLiveFile initial state
- {
- mFirstFade = FALSE;
- }
- else
- {
- if(mFadeTimer)
- {
- mFadeTimer->mParent = NULL;
- }
- mFadeTimer = new LLFadeEventTimer(0.05f,this);
- }
- return true;
+ mParent->displayFloater(FALSE,1); // redisplay the floater
+ if(mFirstFade) // only fade if it wasn't just clicked on; can't use "clicked" BOOL below because of an oddity with setting LLLiveFile initial state
+ {
+ mFirstFade = FALSE;
+ }
+ else
+ {
+ if(mFadeTimer)
+ {
+ mFadeTimer->mParent = NULL;
+ }
+ mFadeTimer = new LLFadeEventTimer(0.05f,this);
+ }
+ return true;
}
// Initialize fade event timer
LLFadeEventTimer::LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent)
- : mParent(parent),
- mFadingOut(TRUE),
- LLEventTimer(refresh)
+ : mParent(parent),
+ mFadingOut(TRUE),
+ LLEventTimer(refresh)
{
- mOriginalColor = mParent->mParent->mDisplayedFloater->getBackgroundColor();
+ mOriginalColor = mParent->mParent->mDisplayedFloater->getBackgroundColor();
}
// Single tick of fade event timer: increment the color
BOOL LLFadeEventTimer::tick()
{
- float diff = 0.04f;
- if(TRUE == mFadingOut) // set fade for in/out color direction
- {
- diff = -diff;
- }
-
- if(NULL == mParent) // no more need to tick, so suicide
- {
- return TRUE;
- }
-
- // Set up colors
- LLColor4 bg_color = mParent->mParent->mDisplayedFloater->getBackgroundColor();
- LLSD colors = bg_color.getValue();
- LLSD colors_old = colors;
-
- // Tick colors
- colors[0] = colors[0].asReal() - diff; if(colors[0].asReal() < mOriginalColor.getValue()[0].asReal()) { colors[0] = colors_old[0]; }
- colors[1] = colors[1].asReal() - diff; if(colors[1].asReal() < mOriginalColor.getValue()[1].asReal()) { colors[1] = colors_old[1]; }
- colors[2] = colors[2].asReal() + diff; if(colors[2].asReal() > mOriginalColor.getValue()[2].asReal()) { colors[2] = colors_old[2]; }
-
- // Clamp and set colors
- bg_color.setValue(colors);
- bg_color.clamp(); // make sure we didn't exceed [0,1]
- mParent->mParent->mDisplayedFloater->setBackgroundColor(bg_color);
-
- if(bg_color[2] <= 0.0f) // end of fade out, start fading in
- {
- mFadingOut = FALSE;
- }
-
- return FALSE;
+ float diff = 0.04f;
+ if(TRUE == mFadingOut) // set fade for in/out color direction
+ {
+ diff = -diff;
+ }
+
+ if(NULL == mParent) // no more need to tick, so suicide
+ {
+ return TRUE;
+ }
+
+ // Set up colors
+ LLColor4 bg_color = mParent->mParent->mDisplayedFloater->getBackgroundColor();
+ LLSD colors = bg_color.getValue();
+ LLSD colors_old = colors;
+
+ // Tick colors
+ colors[0] = colors[0].asReal() - diff; if(colors[0].asReal() < mOriginalColor.getValue()[0].asReal()) { colors[0] = colors_old[0]; }
+ colors[1] = colors[1].asReal() - diff; if(colors[1].asReal() < mOriginalColor.getValue()[1].asReal()) { colors[1] = colors_old[1]; }
+ colors[2] = colors[2].asReal() + diff; if(colors[2].asReal() > mOriginalColor.getValue()[2].asReal()) { colors[2] = colors_old[2]; }
+
+ // Clamp and set colors
+ bg_color.setValue(colors);
+ bg_color.clamp(); // make sure we didn't exceed [0,1]
+ mParent->mParent->mDisplayedFloater->setBackgroundColor(bg_color);
+
+ if(bg_color[2] <= 0.0f) // end of fade out, start fading in
+ {
+ mFadingOut = FALSE;
+ }
+
+ return FALSE;
}
// Constructor
LLFloaterUIPreview::LLFloaterUIPreview(const LLSD& key)
: LLFloater(key),
- mDisplayedFloater(NULL),
- mDisplayedFloater_2(NULL),
- mLiveFile(NULL),
- // sHighlightingDiffs(FALSE),
- mHighlightingOverlaps(FALSE),
- mLastDisplayedX(0),
- mLastDisplayedY(0)
+ mDisplayedFloater(NULL),
+ mDisplayedFloater_2(NULL),
+ mLiveFile(NULL),
+ // sHighlightingDiffs(FALSE),
+ mHighlightingOverlaps(FALSE),
+ mLastDisplayedX(0),
+ mLastDisplayedY(0)
{
}
// Destructor
LLFloaterUIPreview::~LLFloaterUIPreview()
{
- // spawned floaters are deleted automatically, so we don't need to delete them here
-
- // save contents of textfields so it can be restored later if the floater is created again this session
- mSavedEditorPath = mEditorPathTextBox->getText();
- mSavedEditorArgs = mEditorArgsTextBox->getText();
- mSavedDiffPath = mDiffPathTextBox->getText();
-
- // delete live file if it exists
- if(mLiveFile)
- {
- delete mLiveFile;
- mLiveFile = NULL;
- }
+ // spawned floaters are deleted automatically, so we don't need to delete them here
+
+ // save contents of textfields so it can be restored later if the floater is created again this session
+ mSavedEditorPath = mEditorPathTextBox->getText();
+ mSavedEditorArgs = mEditorArgsTextBox->getText();
+ mSavedDiffPath = mDiffPathTextBox->getText();
+
+ // delete live file if it exists
+ if(mLiveFile)
+ {
+ delete mLiveFile;
+ mLiveFile = NULL;
+ }
}
// Perform post-build setup (defined in superclass)
BOOL LLFloaterUIPreview::postBuild()
{
- LLPanel* main_panel_tmp = getChild<LLPanel>("main_panel"); // get a pointer to the main panel in order to...
- mFileList = main_panel_tmp->getChild<LLScrollListCtrl>("name_list"); // save pointer to file list
- // Double-click opens the floater, for convenience
- mFileList->setDoubleClickCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, PRIMARY_FLOATER));
-
- setDefaultBtn("display_floater");
- // get pointers to buttons and link to callbacks
- mLanguageSelection = main_panel_tmp->getChild<LLComboBox>("language_select_combo");
- mLanguageSelection->setCommitCallback(boost::bind(&LLFloaterUIPreview::onLanguageComboSelect, this, mLanguageSelection));
- mLanguageSelection_2 = main_panel_tmp->getChild<LLComboBox>("language_select_combo_2");
- mLanguageSelection_2->setCommitCallback(boost::bind(&LLFloaterUIPreview::onLanguageComboSelect, this, mLanguageSelection));
- LLPanel* editor_panel_tmp = main_panel_tmp->getChild<LLPanel>("editor_panel");
- mDisplayFloaterBtn = main_panel_tmp->getChild<LLButton>("display_floater");
- mDisplayFloaterBtn->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, PRIMARY_FLOATER));
- mDisplayFloaterBtn_2 = main_panel_tmp->getChild<LLButton>("display_floater_2");
- mDisplayFloaterBtn_2->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, SECONDARY_FLOATER));
- mToggleOverlapButton = main_panel_tmp->getChild<LLButton>("toggle_overlap_panel");
- mToggleOverlapButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickToggleOverlapping, this));
- mCloseOtherButton = main_panel_tmp->getChild<LLButton>("close_displayed_floater");
- mCloseOtherButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickCloseDisplayedFloater, this, PRIMARY_FLOATER));
- mCloseOtherButton_2 = main_panel_tmp->getChild<LLButton>("close_displayed_floater_2");
- mCloseOtherButton_2->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickCloseDisplayedFloater, this, SECONDARY_FLOATER));
- mEditFloaterBtn = main_panel_tmp->getChild<LLButton>("edit_floater");
- mEditFloaterBtn->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickEditFloater, this));
- mExecutableBrowseButton = editor_panel_tmp->getChild<LLButton>("browse_for_executable");
- LLPanel* vlt_panel_tmp = main_panel_tmp->getChild<LLPanel>("vlt_panel");
- mExecutableBrowseButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickBrowseForEditor, this));
- mDiffBrowseButton = vlt_panel_tmp->getChild<LLButton>("browse_for_vlt_diffs");
- mDiffBrowseButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickBrowseForDiffs, this));
- mToggleHighlightButton = vlt_panel_tmp->getChild<LLButton>("toggle_vlt_diff_highlight");
- mToggleHighlightButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickToggleDiffHighlighting, this));
- main_panel_tmp->getChild<LLButton>("save_floater")->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickSaveFloater, this, PRIMARY_FLOATER));
- main_panel_tmp->getChild<LLButton>("save_all_floaters")->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickSaveAll, this, PRIMARY_FLOATER));
-
- getChild<LLButton>("export_schema")->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickExportSchema, this));
- getChild<LLUICtrl>("show_rectangles")->setCommitCallback(
- boost::bind(&LLFloaterUIPreview::onClickShowRectangles, this, _2));
-
- // get pointers to text fields
- mEditorPathTextBox = editor_panel_tmp->getChild<LLLineEditor>("executable_path_field");
- mEditorArgsTextBox = editor_panel_tmp->getChild<LLLineEditor>("executable_args_field");
- mDiffPathTextBox = vlt_panel_tmp->getChild<LLLineEditor>("vlt_diff_path_field");
-
- // *HACK: restored saved editor path and args to textfields
- mEditorPathTextBox->setText(mSavedEditorPath);
- mEditorArgsTextBox->setText(mSavedEditorArgs);
- mDiffPathTextBox->setText(mSavedDiffPath);
-
- // Set up overlap panel
- mOverlapPanel = getChild<LLOverlapPanel>("overlap_panel");
-
- getChildView("overlap_scroll")->setVisible( mHighlightingOverlaps);
-
- mDelim = gDirUtilp->getDirDelimiter(); // initialize delimiter to dir sep slash
-
- // refresh list of available languages (EN will still be default)
- BOOL found = TRUE;
- BOOL found_en_us = FALSE;
- std::string language_directory;
- std::string xui_dir = get_xui_dir(); // directory containing localizations -- don't forget trailing delim
- mLanguageSelection->removeall(); // clear out anything temporarily in list from XML
-
- LLDirIterator iter(xui_dir, "*");
- while(found) // for every directory
- {
- if((found = iter.next(language_directory))) // get next directory
- {
- std::string full_path = gDirUtilp->add(xui_dir, language_directory);
- if(LLFile::isfile(full_path.c_str())) // if it's not a directory, skip it
- {
- continue;
- }
-
- if(strncmp("template",language_directory.c_str(),8) && -1 == language_directory.find(".")) // if it's not the template directory or a hidden directory
- {
- if(!strncmp("en",language_directory.c_str(),5)) // remember if we've seen en, so we can make it default
- {
- found_en_us = TRUE;
- }
- else
- {
- mLanguageSelection->add(std::string(language_directory)); // add it to the language selection dropdown menu
- mLanguageSelection_2->add(std::string(language_directory));
- }
- }
- }
- }
- if(found_en_us)
- {
- mLanguageSelection->add(std::string("en"),ADD_TOP); // make en first item if we found it
- mLanguageSelection_2->add(std::string("en"),ADD_TOP);
- }
- else
- {
- std::string warning = std::string("No EN localization found; check your XUI directories!");
- popupAndPrintWarning(warning);
- }
- mLanguageSelection->selectFirstItem(); // select the first item
- mLanguageSelection_2->selectFirstItem();
-
- refreshList(); // refresh the list of available floaters
-
- return TRUE;
+ LLPanel* main_panel_tmp = getChild<LLPanel>("main_panel"); // get a pointer to the main panel in order to...
+ mFileList = main_panel_tmp->getChild<LLScrollListCtrl>("name_list"); // save pointer to file list
+ // Double-click opens the floater, for convenience
+ mFileList->setDoubleClickCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, PRIMARY_FLOATER));
+
+ setDefaultBtn("display_floater");
+ // get pointers to buttons and link to callbacks
+ mLanguageSelection = main_panel_tmp->getChild<LLComboBox>("language_select_combo");
+ mLanguageSelection->setCommitCallback(boost::bind(&LLFloaterUIPreview::onLanguageComboSelect, this, mLanguageSelection));
+ mLanguageSelection_2 = main_panel_tmp->getChild<LLComboBox>("language_select_combo_2");
+ mLanguageSelection_2->setCommitCallback(boost::bind(&LLFloaterUIPreview::onLanguageComboSelect, this, mLanguageSelection));
+ LLPanel* editor_panel_tmp = main_panel_tmp->getChild<LLPanel>("editor_panel");
+ mDisplayFloaterBtn = main_panel_tmp->getChild<LLButton>("display_floater");
+ mDisplayFloaterBtn->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, PRIMARY_FLOATER));
+ mDisplayFloaterBtn_2 = main_panel_tmp->getChild<LLButton>("display_floater_2");
+ mDisplayFloaterBtn_2->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, SECONDARY_FLOATER));
+ mToggleOverlapButton = main_panel_tmp->getChild<LLButton>("toggle_overlap_panel");
+ mToggleOverlapButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickToggleOverlapping, this));
+ mCloseOtherButton = main_panel_tmp->getChild<LLButton>("close_displayed_floater");
+ mCloseOtherButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickCloseDisplayedFloater, this, PRIMARY_FLOATER));
+ mCloseOtherButton_2 = main_panel_tmp->getChild<LLButton>("close_displayed_floater_2");
+ mCloseOtherButton_2->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickCloseDisplayedFloater, this, SECONDARY_FLOATER));
+ mEditFloaterBtn = main_panel_tmp->getChild<LLButton>("edit_floater");
+ mEditFloaterBtn->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickEditFloater, this));
+ mExecutableBrowseButton = editor_panel_tmp->getChild<LLButton>("browse_for_executable");
+ LLPanel* vlt_panel_tmp = main_panel_tmp->getChild<LLPanel>("vlt_panel");
+ mExecutableBrowseButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickBrowseForEditor, this));
+ mDiffBrowseButton = vlt_panel_tmp->getChild<LLButton>("browse_for_vlt_diffs");
+ mDiffBrowseButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickBrowseForDiffs, this));
+ mToggleHighlightButton = vlt_panel_tmp->getChild<LLButton>("toggle_vlt_diff_highlight");
+ mToggleHighlightButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickToggleDiffHighlighting, this));
+ main_panel_tmp->getChild<LLButton>("save_floater")->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickSaveFloater, this, PRIMARY_FLOATER));
+ main_panel_tmp->getChild<LLButton>("save_all_floaters")->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickSaveAll, this, PRIMARY_FLOATER));
+
+ getChild<LLButton>("export_schema")->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickExportSchema, this));
+ getChild<LLUICtrl>("show_rectangles")->setCommitCallback(
+ boost::bind(&LLFloaterUIPreview::onClickShowRectangles, this, _2));
+
+ // get pointers to text fields
+ mEditorPathTextBox = editor_panel_tmp->getChild<LLLineEditor>("executable_path_field");
+ mEditorArgsTextBox = editor_panel_tmp->getChild<LLLineEditor>("executable_args_field");
+ mDiffPathTextBox = vlt_panel_tmp->getChild<LLLineEditor>("vlt_diff_path_field");
+
+ // *HACK: restored saved editor path and args to textfields
+ mEditorPathTextBox->setText(mSavedEditorPath);
+ mEditorArgsTextBox->setText(mSavedEditorArgs);
+ mDiffPathTextBox->setText(mSavedDiffPath);
+
+ // Set up overlap panel
+ mOverlapPanel = getChild<LLOverlapPanel>("overlap_panel");
+
+ getChildView("overlap_scroll")->setVisible( mHighlightingOverlaps);
+
+ mDelim = gDirUtilp->getDirDelimiter(); // initialize delimiter to dir sep slash
+
+ // refresh list of available languages (EN will still be default)
+ BOOL found = TRUE;
+ BOOL found_en_us = FALSE;
+ std::string language_directory;
+ std::string xui_dir = get_xui_dir(); // directory containing localizations -- don't forget trailing delim
+ mLanguageSelection->removeall(); // clear out anything temporarily in list from XML
+
+ LLDirIterator iter(xui_dir, "*");
+ while(found) // for every directory
+ {
+ if((found = iter.next(language_directory))) // get next directory
+ {
+ std::string full_path = gDirUtilp->add(xui_dir, language_directory);
+ if(LLFile::isfile(full_path.c_str())) // if it's not a directory, skip it
+ {
+ continue;
+ }
+
+ if(strncmp("template",language_directory.c_str(),8) && -1 == language_directory.find(".")) // if it's not the template directory or a hidden directory
+ {
+ if(!strncmp("en",language_directory.c_str(),5)) // remember if we've seen en, so we can make it default
+ {
+ found_en_us = TRUE;
+ }
+ else
+ {
+ mLanguageSelection->add(std::string(language_directory)); // add it to the language selection dropdown menu
+ mLanguageSelection_2->add(std::string(language_directory));
+ }
+ }
+ }
+ }
+ if(found_en_us)
+ {
+ mLanguageSelection->add(std::string("en"),ADD_TOP); // make en first item if we found it
+ mLanguageSelection_2->add(std::string("en"),ADD_TOP);
+ }
+ else
+ {
+ std::string warning = std::string("No EN localization found; check your XUI directories!");
+ popupAndPrintWarning(warning);
+ }
+ mLanguageSelection->selectFirstItem(); // select the first item
+ mLanguageSelection_2->selectFirstItem();
+
+ refreshList(); // refresh the list of available floaters
+
+ return TRUE;
}
// Callback for language combo box selection: refresh current floater when you change languages
void LLFloaterUIPreview::onLanguageComboSelect(LLUICtrl* ctrl)
{
- LLComboBox* caller = dynamic_cast<LLComboBox*>(ctrl);
- if (!caller)
- return;
- if(caller->getName() == std::string("language_select_combo"))
- {
- if(mDisplayedFloater)
- {
- onClickCloseDisplayedFloater(PRIMARY_FLOATER);
- displayFloater(TRUE,1);
- }
- }
- else
- {
- if(mDisplayedFloater_2)
- {
- onClickCloseDisplayedFloater(PRIMARY_FLOATER);
- displayFloater(TRUE,2); // *TODO: make take an arg
- }
- }
+ LLComboBox* caller = dynamic_cast<LLComboBox*>(ctrl);
+ if (!caller)
+ return;
+ if(caller->getName() == std::string("language_select_combo"))
+ {
+ if(mDisplayedFloater)
+ {
+ onClickCloseDisplayedFloater(PRIMARY_FLOATER);
+ displayFloater(TRUE,1);
+ }
+ }
+ else
+ {
+ if(mDisplayedFloater_2)
+ {
+ onClickCloseDisplayedFloater(PRIMARY_FLOATER);
+ displayFloater(TRUE,2); // *TODO: make take an arg
+ }
+ }
}
void LLFloaterUIPreview::onClickExportSchema()
{
- //NOTE: schema generation not complete
- //gViewerWindow->setCursor(UI_CURSOR_WAIT);
- //std::string template_path = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "xui", "schema");
-
- //typedef LLWidgetTypeRegistry::Registrar::registry_map_t::const_iterator registry_it;
- //registry_it end_it = LLWidgetTypeRegistry::defaultRegistrar().endItems();
- //for(registry_it it = LLWidgetTypeRegistry::defaultRegistrar().beginItems();
- // it != end_it;
- // ++it)
- //{
- // std::string widget_name = it->first;
- // const LLInitParam::BaseBlock& block =
- // (*LLDefaultParamBlockRegistry::instance().getValue(*LLWidgetTypeRegistry::instance().getValue(widget_name)))();
- // LLXMLNodePtr root_nodep = new LLXMLNode();
- // LLRNGWriter().writeRNG(widget_name, root_nodep, block, "http://www.lindenlab.com/xui");
-
- // std::string file_name(template_path + gDirUtilp->getDirDelimiter() + widget_name + ".rng");
-
- // LLFILE* rng_file = LLFile::fopen(file_name.c_str(), "w");
- // {
- // LLXMLNode::writeHeaderToFile(rng_file);
- // const bool use_type_decorations = false;
- // root_nodep->writeToFile(rng_file, std::string(), use_type_decorations);
- // }
- // fclose(rng_file);
- //}
- //gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ //NOTE: schema generation not complete
+ //gViewerWindow->setCursor(UI_CURSOR_WAIT);
+ //std::string template_path = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "xui", "schema");
+
+ //typedef LLWidgetTypeRegistry::Registrar::registry_map_t::const_iterator registry_it;
+ //registry_it end_it = LLWidgetTypeRegistry::defaultRegistrar().endItems();
+ //for(registry_it it = LLWidgetTypeRegistry::defaultRegistrar().beginItems();
+ // it != end_it;
+ // ++it)
+ //{
+ // std::string widget_name = it->first;
+ // const LLInitParam::BaseBlock& block =
+ // (*LLDefaultParamBlockRegistry::instance().getValue(*LLWidgetTypeRegistry::instance().getValue(widget_name)))();
+ // LLXMLNodePtr root_nodep = new LLXMLNode();
+ // LLRNGWriter().writeRNG(widget_name, root_nodep, block, "http://www.lindenlab.com/xui");
+
+ // std::string file_name(template_path + gDirUtilp->getDirDelimiter() + widget_name + ".rng");
+
+ // LLFILE* rng_file = LLFile::fopen(file_name.c_str(), "w");
+ // {
+ // LLXMLNode::writeHeaderToFile(rng_file);
+ // const bool use_type_decorations = false;
+ // root_nodep->writeToFile(rng_file, std::string(), use_type_decorations);
+ // }
+ // fclose(rng_file);
+ //}
+ //gViewerWindow->setCursor(UI_CURSOR_ARROW);
}
void LLFloaterUIPreview::onClickShowRectangles(const LLSD& data)
{
- LLPreviewedFloater::sShowRectangles = data.asBoolean();
+ LLPreviewedFloater::sShowRectangles = data.asBoolean();
}
// Close click handler -- delete my displayed floater if it exists
void LLFloaterUIPreview::onClose(bool app_quitting)
{
- if(!app_quitting && mDisplayedFloater)
- {
- onClickCloseDisplayedFloater(PRIMARY_FLOATER);
- onClickCloseDisplayedFloater(SECONDARY_FLOATER);
- delete mDisplayedFloater;
- mDisplayedFloater = NULL;
- delete mDisplayedFloater_2;
- mDisplayedFloater_2 = NULL;
- }
+ if(!app_quitting && mDisplayedFloater)
+ {
+ onClickCloseDisplayedFloater(PRIMARY_FLOATER);
+ onClickCloseDisplayedFloater(SECONDARY_FLOATER);
+ delete mDisplayedFloater;
+ mDisplayedFloater = NULL;
+ delete mDisplayedFloater_2;
+ mDisplayedFloater_2 = NULL;
+ }
}
// Error handling (to avoid code repetition)
// *TODO: this is currently unlocalized. Add to alerts/notifications.xml, someday, maybe.
void LLFloaterUIPreview::popupAndPrintWarning(const std::string& warning)
{
- LL_WARNS() << warning << LL_ENDL;
- LLSD args;
- args["MESSAGE"] = warning;
- LLNotificationsUtil::add("GenericAlert", args);
+ LL_WARNS() << warning << LL_ENDL;
+ LLSD args;
+ args["MESSAGE"] = warning;
+ LLNotificationsUtil::add("GenericAlert", args);
}
// Get localization string from drop-down menu
std::string LLFloaterUIPreview::getLocStr(S32 ID)
{
- if(ID == 1)
- {
- return mLanguageSelection->getSelectedItemLabel(0);
- }
- else
- {
- return mLanguageSelection_2->getSelectedItemLabel(0);
- }
+ if(ID == 1)
+ {
+ return mLanguageSelection->getSelectedItemLabel(0);
+ }
+ else
+ {
+ return mLanguageSelection_2->getSelectedItemLabel(0);
+ }
}
// Get localized directory (build path from data directory to XUI files, substituting localization string in for language)
std::string LLFloaterUIPreview::getLocalizedDirectory()
{
- return get_xui_dir() + (getLocStr(1)) + mDelim; // e.g. "C:/Code/guipreview/indra/newview/skins/xui/en/";
+ return get_xui_dir() + (getLocStr(1)) + mDelim; // e.g. "C:/Code/guipreview/indra/newview/skins/xui/en/";
}
// Refresh the list of floaters by doing a directory traverse for XML XUI floater files
// Could be used to grab any specific language's list of compatible floaters, but currently it's just used to get all of them
void LLFloaterUIPreview::refreshList()
{
- // Note: the mask doesn't seem to accept regular expressions, so there need to be two directory searches here
- mFileList->clearRows(); // empty list
- std::string name;
- BOOL found = TRUE;
-
- LLDirIterator floater_iter(getLocalizedDirectory(), "floater_*.xml");
- while(found) // for every floater file that matches the pattern
- {
- if((found = floater_iter.next(name))) // get next file matching pattern
- {
- addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
- }
- }
- found = TRUE;
-
- LLDirIterator inspect_iter(getLocalizedDirectory(), "inspect_*.xml");
- while(found) // for every inspector file that matches the pattern
- {
- if((found = inspect_iter.next(name))) // get next file matching pattern
- {
- addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
- }
- }
- found = TRUE;
-
- LLDirIterator menu_iter(getLocalizedDirectory(), "menu_*.xml");
- while(found) // for every menu file that matches the pattern
- {
- if((found = menu_iter.next(name))) // get next file matching pattern
- {
- addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
- }
- }
- found = TRUE;
-
- LLDirIterator panel_iter(getLocalizedDirectory(), "panel_*.xml");
- while(found) // for every panel file that matches the pattern
- {
- if((found = panel_iter.next(name))) // get next file matching pattern
- {
- addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
- }
- }
- found = TRUE;
-
- LLDirIterator sidepanel_iter(getLocalizedDirectory(), "sidepanel_*.xml");
- while(found) // for every sidepanel file that matches the pattern
- {
- if((found = sidepanel_iter.next(name))) // get next file matching pattern
- {
- addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
- }
- }
-
- if(!mFileList->isEmpty()) // if there were any matching files, just select the first one (so we don't have to worry about disabling buttons when no entry is selected)
- {
- mFileList->selectFirstItem();
- }
+ // Note: the mask doesn't seem to accept regular expressions, so there need to be two directory searches here
+ mFileList->clearRows(); // empty list
+ std::string name;
+ BOOL found = TRUE;
+
+ LLDirIterator floater_iter(getLocalizedDirectory(), "floater_*.xml");
+ while(found) // for every floater file that matches the pattern
+ {
+ if((found = floater_iter.next(name))) // get next file matching pattern
+ {
+ addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
+ }
+ }
+ found = TRUE;
+
+ LLDirIterator inspect_iter(getLocalizedDirectory(), "inspect_*.xml");
+ while(found) // for every inspector file that matches the pattern
+ {
+ if((found = inspect_iter.next(name))) // get next file matching pattern
+ {
+ addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
+ }
+ }
+ found = TRUE;
+
+ LLDirIterator menu_iter(getLocalizedDirectory(), "menu_*.xml");
+ while(found) // for every menu file that matches the pattern
+ {
+ if((found = menu_iter.next(name))) // get next file matching pattern
+ {
+ addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
+ }
+ }
+ found = TRUE;
+
+ LLDirIterator panel_iter(getLocalizedDirectory(), "panel_*.xml");
+ while(found) // for every panel file that matches the pattern
+ {
+ if((found = panel_iter.next(name))) // get next file matching pattern
+ {
+ addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
+ }
+ }
+ found = TRUE;
+
+ LLDirIterator sidepanel_iter(getLocalizedDirectory(), "sidepanel_*.xml");
+ while(found) // for every sidepanel file that matches the pattern
+ {
+ if((found = sidepanel_iter.next(name))) // get next file matching pattern
+ {
+ addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
+ }
+ }
+
+ if(!mFileList->isEmpty()) // if there were any matching files, just select the first one (so we don't have to worry about disabling buttons when no entry is selected)
+ {
+ mFileList->selectFirstItem();
+ }
}
// Add a single entry to the list of available floaters
// Note: no deduplification (shouldn't be necessary)
void LLFloaterUIPreview::addFloaterEntry(const std::string& path)
{
- LLUUID* entry_id = new LLUUID(); // create a new UUID
- entry_id->generate(path);
- const LLUUID& entry_id_ref = *entry_id; // get a reference to the UUID for the LLSD block
-
- // fill LLSD column entry: initialize row/col structure
- LLSD row;
- row["id"] = entry_id_ref;
- LLSD& columns = row["columns"];
-
- // Get name of floater:
- LLXmlTree xml_tree;
- std::string full_path = getLocalizedDirectory() + path; // get full path
- BOOL success = xml_tree.parseFile(full_path.c_str(), TRUE); // parse xml
- std::string entry_name;
- std::string entry_title;
- if(success)
- {
- // get root (or error handle)
- LLXmlTreeNode* root_floater = xml_tree.getRoot();
- if (!root_floater)
- {
- std::string warning = std::string("No root node found in XUI file: ") + path;
- popupAndPrintWarning(warning);
- return;
- }
-
- // get name
- root_floater->getAttributeString("name",entry_name);
- if(std::string("") == entry_name)
- {
- entry_name = "Error: unable to load " + std::string(path); // set to error state if load fails
- }
-
- // get title
- root_floater->getAttributeString("title",entry_title); // some don't have a title, and some have title = "(unknown)", so just leave it blank if it fails
- }
- else
- {
- std::string warning = std::string("Unable to parse XUI file: ") + path; // error handling
- popupAndPrintWarning(warning);
- if(mLiveFile)
- {
- delete mLiveFile;
- mLiveFile = NULL;
- }
- return;
- }
-
- // Fill floater title column
- columns[0]["column"] = "title_column";
- columns[0]["type"] = "text";
- columns[0]["value"] = entry_title;
-
- // Fill floater path column
- columns[1]["column"] = "file_column";
- columns[1]["type"] = "text";
- columns[1]["value"] = std::string(path);
-
- // Fill floater name column
- columns[2]["column"] = "top_level_node_column";
- columns[2]["type"] = "text";
- columns[2]["value"] = entry_name;
-
- mFileList->addElement(row); // actually add to list
+ LLUUID* entry_id = new LLUUID(); // create a new UUID
+ entry_id->generate(path);
+ const LLUUID& entry_id_ref = *entry_id; // get a reference to the UUID for the LLSD block
+
+ // fill LLSD column entry: initialize row/col structure
+ LLSD row;
+ row["id"] = entry_id_ref;
+ LLSD& columns = row["columns"];
+
+ // Get name of floater:
+ LLXmlTree xml_tree;
+ std::string full_path = getLocalizedDirectory() + path; // get full path
+ BOOL success = xml_tree.parseFile(full_path.c_str(), TRUE); // parse xml
+ std::string entry_name;
+ std::string entry_title;
+ if(success)
+ {
+ // get root (or error handle)
+ LLXmlTreeNode* root_floater = xml_tree.getRoot();
+ if (!root_floater)
+ {
+ std::string warning = std::string("No root node found in XUI file: ") + path;
+ popupAndPrintWarning(warning);
+ return;
+ }
+
+ // get name
+ root_floater->getAttributeString("name",entry_name);
+ if(std::string("") == entry_name)
+ {
+ entry_name = "Error: unable to load " + std::string(path); // set to error state if load fails
+ }
+
+ // get title
+ root_floater->getAttributeString("title",entry_title); // some don't have a title, and some have title = "(unknown)", so just leave it blank if it fails
+ }
+ else
+ {
+ std::string warning = std::string("Unable to parse XUI file: ") + path; // error handling
+ popupAndPrintWarning(warning);
+ if(mLiveFile)
+ {
+ delete mLiveFile;
+ mLiveFile = NULL;
+ }
+ return;
+ }
+
+ // Fill floater title column
+ columns[0]["column"] = "title_column";
+ columns[0]["type"] = "text";
+ columns[0]["value"] = entry_title;
+
+ // Fill floater path column
+ columns[1]["column"] = "file_column";
+ columns[1]["type"] = "text";
+ columns[1]["value"] = std::string(path);
+
+ // Fill floater name column
+ columns[2]["column"] = "top_level_node_column";
+ columns[2]["type"] = "text";
+ columns[2]["value"] = entry_name;
+
+ mFileList->addElement(row); // actually add to list
}
// Respond to button click to display/refresh currently-selected floater
void LLFloaterUIPreview::onClickDisplayFloater(S32 caller_id)
{
- displayFloater(TRUE, caller_id);
+ displayFloater(TRUE, caller_id);
}
// Saves the current floater/panel
void LLFloaterUIPreview::onClickSaveFloater(S32 caller_id)
{
- displayFloater(TRUE, caller_id);
- popupAndPrintWarning("Save-floater functionality removed, use XML schema to clean up XUI files");
+ displayFloater(TRUE, caller_id);
+ popupAndPrintWarning("Save-floater functionality removed, use XML schema to clean up XUI files");
}
// Saves all floater/panels
void LLFloaterUIPreview::onClickSaveAll(S32 caller_id)
{
- int listSize = mFileList->getItemCount();
-
- for (int index = 0; index < listSize; index++)
- {
- mFileList->selectNthItem(index);
- displayFloater(TRUE, caller_id);
- }
- popupAndPrintWarning("Save-floater functionality removed, use XML schema to clean up XUI files");
+ int listSize = mFileList->getItemCount();
+
+ for (int index = 0; index < listSize; index++)
+ {
+ mFileList->selectNthItem(index);
+ displayFloater(TRUE, caller_id);
+ }
+ popupAndPrintWarning("Save-floater functionality removed, use XML schema to clean up XUI files");
}
// Actually display the floater
@@ -799,224 +799,224 @@ void LLFloaterUIPreview::onClickSaveAll(S32 caller_id)
// otherwise, we get an infinite loop as the live file keeps recreating itself. That means this function is generally called twice.
void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID)
{
- // Convince UI that we're in a different language (the one selected on the drop-down menu)
- LLLocalizationResetForcer reset_forcer(this, ID); // save old language in reset forcer object (to be reset upon destruction when it falls out of scope)
-
- LLPreviewedFloater** floaterp = (ID == 1 ? &(mDisplayedFloater) : &(mDisplayedFloater_2));
- if(ID == 1)
- {
- BOOL floater_already_open = mDisplayedFloater != NULL;
- if(floater_already_open) // if we are already displaying a floater
- {
- mLastDisplayedX = mDisplayedFloater->calcScreenRect().mLeft; // save floater's last known position to put the new one there
- mLastDisplayedY = mDisplayedFloater->calcScreenRect().mBottom;
- delete mDisplayedFloater; // delete it (this closes it too)
- mDisplayedFloater = NULL; // and reset the pointer
- }
- }
- else
- {
- if(mDisplayedFloater_2 != NULL)
- {
- delete mDisplayedFloater_2;
- mDisplayedFloater_2 = NULL;
- }
- }
-
- std::string path = mFileList->getSelectedItemLabel(1); // get the path of the currently-selected floater
- if(std::string("") == path) // if no item is selected
- {
- return; // ignore click (this can only happen with empty list; otherwise an item is always selected)
- }
-
- LLFloater::Params p(LLFloater::getDefaultParams());
- p.min_height=p.header_height;
- p.min_width=10;
-
- *floaterp = new LLPreviewedFloater(this, p);
-
- if(!strncmp(path.c_str(),"floater_",8)
- || !strncmp(path.c_str(), "inspect_", 8)) // if it's a floater
- {
- (*floaterp)->buildFromFile(path); // just build it
- (*floaterp)->openFloater((*floaterp)->getKey());
- (*floaterp)->setCanResize((*floaterp)->isResizable());
- }
- else if (!strncmp(path.c_str(),"menu_",5)) // if it's a menu
- {
- // former 'save' processing excised
- }
- else // if it is a panel...
- {
- (*floaterp)->setCanResize(true);
-
- const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
- S32 floater_header_size = floater_params.header_height;
-
- LLPanel::Params panel_params;
- LLPanel* panel = LLUICtrlFactory::create<LLPanel>(panel_params); // create a new panel
-
- panel->buildFromFile(path); // build it
- panel->setOrigin(2,2); // reset its origin point so it's not offset by -left or other XUI attributes
- (*floaterp)->setTitle(path); // use the file name as its title, since panels have no guaranteed meaningful name attribute
- panel->setUseBoundingRect(TRUE); // enable the use of its outer bounding rect (normally disabled because it's O(n) on the number of sub-elements)
- panel->updateBoundingRect(); // update bounding rect
- LLRect bounding_rect = panel->getBoundingRect(); // get the bounding rect
- LLRect new_rect = panel->getRect(); // get the panel's rect
- new_rect.unionWith(bounding_rect); // union them to make sure we get the biggest one possible
- LLRect floater_rect = new_rect;
- floater_rect.stretch(4, 4);
- (*floaterp)->reshape(floater_rect.getWidth(), floater_rect.getHeight() + floater_header_size); // reshape floater to match the union rect's dimensions
- panel->reshape(new_rect.getWidth(), new_rect.getHeight()); // reshape panel to match the union rect's dimensions as well (both are needed)
- (*floaterp)->addChild(panel); // add panel as child
- (*floaterp)->openFloater(); // open floater (needed?)
- }
-
- if(ID == 1)
- {
- (*floaterp)->setOrigin(mLastDisplayedX, mLastDisplayedY);
- }
-
- // *HACK: Remove ability to close it; if you close it, its destructor gets called, but we don't know it's null and try to delete it again,
- // resulting in a double free
- (*floaterp)->setCanClose(FALSE);
-
- if(ID == 1)
- {
- mCloseOtherButton->setEnabled(TRUE); // enable my floater's close button
- }
- else
- {
- mCloseOtherButton_2->setEnabled(TRUE);
- }
-
- // Add localization to title so user knows whether it's localized or defaulted to en
- std::string full_path = getLocalizedDirectory() + path;
- std::string floater_lang = "EN";
- llstat dummy;
- if(!LLFile::stat(full_path.c_str(), &dummy)) // if the file does not exist
- {
- floater_lang = getLocStr(ID);
- }
- std::string new_title = (*floaterp)->getTitle() + std::string(" [") + floater_lang +
- (ID == 1 ? " - Primary" : " - Secondary") + std::string("]");
- (*floaterp)->setTitle(new_title);
-
- (*floaterp)->center();
- addDependentFloater(*floaterp);
-
- if(click && ID == 1)
- {
- // set up live file to track it
- if(mLiveFile)
- {
- delete mLiveFile;
- mLiveFile = NULL;
- }
- mLiveFile = new LLGUIPreviewLiveFile(std::string(full_path.c_str()),std::string(path.c_str()),this);
- mLiveFile->checkAndReload();
- mLiveFile->addToEventTimer();
- }
-
- if(ID == 1)
- {
- mToggleOverlapButton->setEnabled(TRUE);
- }
-
- if(LLView::sHighlightingDiffs && click && ID == 1)
- {
- highlightChangedElements();
- }
-
- if(ID == 1)
- {
- mOverlapPanel->mOverlapMap.clear();
- LLView::sPreviewClickedElement = NULL; // stop overlapping elements from drawing
- mOverlapPanel->mLastClickedElement = NULL;
- findOverlapsInChildren((LLView*)mDisplayedFloater);
-
- // highlight and enable them
- if(mHighlightingOverlaps)
- {
- for(LLOverlapPanel::OverlapMap::iterator iter = mOverlapPanel->mOverlapMap.begin(); iter != mOverlapPanel->mOverlapMap.end(); ++iter)
- {
- LLView* viewp = iter->first;
- LLView::sPreviewHighlightedElements.insert(viewp);
- }
- }
- else if(LLView::sHighlightingDiffs)
- {
- highlightChangedElements();
- }
- }
-
- // NOTE: language is reset here automatically when the reset forcer object falls out of scope (see header for details)
+ // Convince UI that we're in a different language (the one selected on the drop-down menu)
+ LLLocalizationResetForcer reset_forcer(this, ID); // save old language in reset forcer object (to be reset upon destruction when it falls out of scope)
+
+ LLPreviewedFloater** floaterp = (ID == 1 ? &(mDisplayedFloater) : &(mDisplayedFloater_2));
+ if(ID == 1)
+ {
+ BOOL floater_already_open = mDisplayedFloater != NULL;
+ if(floater_already_open) // if we are already displaying a floater
+ {
+ mLastDisplayedX = mDisplayedFloater->calcScreenRect().mLeft; // save floater's last known position to put the new one there
+ mLastDisplayedY = mDisplayedFloater->calcScreenRect().mBottom;
+ delete mDisplayedFloater; // delete it (this closes it too)
+ mDisplayedFloater = NULL; // and reset the pointer
+ }
+ }
+ else
+ {
+ if(mDisplayedFloater_2 != NULL)
+ {
+ delete mDisplayedFloater_2;
+ mDisplayedFloater_2 = NULL;
+ }
+ }
+
+ std::string path = mFileList->getSelectedItemLabel(1); // get the path of the currently-selected floater
+ if(std::string("") == path) // if no item is selected
+ {
+ return; // ignore click (this can only happen with empty list; otherwise an item is always selected)
+ }
+
+ LLFloater::Params p(LLFloater::getDefaultParams());
+ p.min_height=p.header_height;
+ p.min_width=10;
+
+ *floaterp = new LLPreviewedFloater(this, p);
+
+ if(!strncmp(path.c_str(),"floater_",8)
+ || !strncmp(path.c_str(), "inspect_", 8)) // if it's a floater
+ {
+ (*floaterp)->buildFromFile(path); // just build it
+ (*floaterp)->openFloater((*floaterp)->getKey());
+ (*floaterp)->setCanResize((*floaterp)->isResizable());
+ }
+ else if (!strncmp(path.c_str(),"menu_",5)) // if it's a menu
+ {
+ // former 'save' processing excised
+ }
+ else // if it is a panel...
+ {
+ (*floaterp)->setCanResize(true);
+
+ const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
+ S32 floater_header_size = floater_params.header_height;
+
+ LLPanel::Params panel_params;
+ LLPanel* panel = LLUICtrlFactory::create<LLPanel>(panel_params); // create a new panel
+
+ panel->buildFromFile(path); // build it
+ panel->setOrigin(2,2); // reset its origin point so it's not offset by -left or other XUI attributes
+ (*floaterp)->setTitle(path); // use the file name as its title, since panels have no guaranteed meaningful name attribute
+ panel->setUseBoundingRect(TRUE); // enable the use of its outer bounding rect (normally disabled because it's O(n) on the number of sub-elements)
+ panel->updateBoundingRect(); // update bounding rect
+ LLRect bounding_rect = panel->getBoundingRect(); // get the bounding rect
+ LLRect new_rect = panel->getRect(); // get the panel's rect
+ new_rect.unionWith(bounding_rect); // union them to make sure we get the biggest one possible
+ LLRect floater_rect = new_rect;
+ floater_rect.stretch(4, 4);
+ (*floaterp)->reshape(floater_rect.getWidth(), floater_rect.getHeight() + floater_header_size); // reshape floater to match the union rect's dimensions
+ panel->reshape(new_rect.getWidth(), new_rect.getHeight()); // reshape panel to match the union rect's dimensions as well (both are needed)
+ (*floaterp)->addChild(panel); // add panel as child
+ (*floaterp)->openFloater(); // open floater (needed?)
+ }
+
+ if(ID == 1)
+ {
+ (*floaterp)->setOrigin(mLastDisplayedX, mLastDisplayedY);
+ }
+
+ // *HACK: Remove ability to close it; if you close it, its destructor gets called, but we don't know it's null and try to delete it again,
+ // resulting in a double free
+ (*floaterp)->setCanClose(FALSE);
+
+ if(ID == 1)
+ {
+ mCloseOtherButton->setEnabled(TRUE); // enable my floater's close button
+ }
+ else
+ {
+ mCloseOtherButton_2->setEnabled(TRUE);
+ }
+
+ // Add localization to title so user knows whether it's localized or defaulted to en
+ std::string full_path = getLocalizedDirectory() + path;
+ std::string floater_lang = "EN";
+ llstat dummy;
+ if(!LLFile::stat(full_path.c_str(), &dummy)) // if the file does not exist
+ {
+ floater_lang = getLocStr(ID);
+ }
+ std::string new_title = (*floaterp)->getTitle() + std::string(" [") + floater_lang +
+ (ID == 1 ? " - Primary" : " - Secondary") + std::string("]");
+ (*floaterp)->setTitle(new_title);
+
+ (*floaterp)->center();
+ addDependentFloater(*floaterp);
+
+ if(click && ID == 1)
+ {
+ // set up live file to track it
+ if(mLiveFile)
+ {
+ delete mLiveFile;
+ mLiveFile = NULL;
+ }
+ mLiveFile = new LLGUIPreviewLiveFile(std::string(full_path.c_str()),std::string(path.c_str()),this);
+ mLiveFile->checkAndReload();
+ mLiveFile->addToEventTimer();
+ }
+
+ if(ID == 1)
+ {
+ mToggleOverlapButton->setEnabled(TRUE);
+ }
+
+ if(LLView::sHighlightingDiffs && click && ID == 1)
+ {
+ highlightChangedElements();
+ }
+
+ if(ID == 1)
+ {
+ mOverlapPanel->mOverlapMap.clear();
+ LLView::sPreviewClickedElement = NULL; // stop overlapping elements from drawing
+ mOverlapPanel->mLastClickedElement = NULL;
+ findOverlapsInChildren((LLView*)mDisplayedFloater);
+
+ // highlight and enable them
+ if(mHighlightingOverlaps)
+ {
+ for(LLOverlapPanel::OverlapMap::iterator iter = mOverlapPanel->mOverlapMap.begin(); iter != mOverlapPanel->mOverlapMap.end(); ++iter)
+ {
+ LLView* viewp = iter->first;
+ LLView::sPreviewHighlightedElements.insert(viewp);
+ }
+ }
+ else if(LLView::sHighlightingDiffs)
+ {
+ highlightChangedElements();
+ }
+ }
+
+ // NOTE: language is reset here automatically when the reset forcer object falls out of scope (see header for details)
}
// Respond to button click to edit currently-selected floater
void LLFloaterUIPreview::onClickEditFloater()
{
- // Determine file to edit.
- std::string file_path;
- {
- std::string file_name = mFileList->getSelectedItemLabel(1); // get the file name of the currently-selected floater
- if (file_name.empty()) // if no item is selected
- {
- LL_WARNS() << "No file selected" << LL_ENDL;
- return; // ignore click
- }
- file_path = getLocalizedDirectory() + file_name;
-
- // stat file to see if it exists (some localized versions may not have it there are no diffs, and then we try to open an nonexistent file)
- llstat dummy;
- if(LLFile::stat(file_path.c_str(), &dummy)) // if the file does not exist
- {
- popupAndPrintWarning("No file for this floater exists in the selected localization. Opening the EN version instead.");
- file_path = get_xui_dir() + mDelim + "en" + mDelim + file_name; // open the en version instead, by default
- }
- }
-
- // Set the editor command.
- std::string cmd_override;
- {
- std::string bin = mEditorPathTextBox->getText();
- if (!bin.empty())
- {
- // surround command with double quotes for the case if the path contains spaces
- if (bin.find("\"") == std::string::npos)
- {
- bin = "\"" + bin + "\"";
- }
-
- std::string args = mEditorArgsTextBox->getText();
- cmd_override = bin + " " + args;
- }
- }
-
- LLExternalEditor::EErrorCode status = mExternalEditor.setCommand("LL_XUI_EDITOR", cmd_override);
- if (status != LLExternalEditor::EC_SUCCESS)
- {
- std::string warning;
-
- if (status == LLExternalEditor::EC_NOT_SPECIFIED) // Use custom message for this error.
- {
- warning = getString("ExternalEditorNotSet");
- }
- else
- {
- warning = LLExternalEditor::getErrorMessage(status);
- }
-
- popupAndPrintWarning(warning);
- return;
- }
-
- // Run the editor.
- if (mExternalEditor.run(file_path) != LLExternalEditor::EC_SUCCESS)
- {
- popupAndPrintWarning(LLExternalEditor::getErrorMessage(status));
- return;
- }
+ // Determine file to edit.
+ std::string file_path;
+ {
+ std::string file_name = mFileList->getSelectedItemLabel(1); // get the file name of the currently-selected floater
+ if (file_name.empty()) // if no item is selected
+ {
+ LL_WARNS() << "No file selected" << LL_ENDL;
+ return; // ignore click
+ }
+ file_path = getLocalizedDirectory() + file_name;
+
+ // stat file to see if it exists (some localized versions may not have it there are no diffs, and then we try to open an nonexistent file)
+ llstat dummy;
+ if(LLFile::stat(file_path.c_str(), &dummy)) // if the file does not exist
+ {
+ popupAndPrintWarning("No file for this floater exists in the selected localization. Opening the EN version instead.");
+ file_path = get_xui_dir() + mDelim + "en" + mDelim + file_name; // open the en version instead, by default
+ }
+ }
+
+ // Set the editor command.
+ std::string cmd_override;
+ {
+ std::string bin = mEditorPathTextBox->getText();
+ if (!bin.empty())
+ {
+ // surround command with double quotes for the case if the path contains spaces
+ if (bin.find("\"") == std::string::npos)
+ {
+ bin = "\"" + bin + "\"";
+ }
+
+ std::string args = mEditorArgsTextBox->getText();
+ cmd_override = bin + " " + args;
+ }
+ }
+
+ LLExternalEditor::EErrorCode status = mExternalEditor.setCommand("LL_XUI_EDITOR", cmd_override);
+ if (status != LLExternalEditor::EC_SUCCESS)
+ {
+ std::string warning;
+
+ if (status == LLExternalEditor::EC_NOT_SPECIFIED) // Use custom message for this error.
+ {
+ warning = getString("ExternalEditorNotSet");
+ }
+ else
+ {
+ warning = LLExternalEditor::getErrorMessage(status);
+ }
+
+ popupAndPrintWarning(warning);
+ return;
+ }
+
+ // Run the editor.
+ if (mExternalEditor.run(file_path) != LLExternalEditor::EC_SUCCESS)
+ {
+ popupAndPrintWarning(LLExternalEditor::getErrorMessage(status));
+ return;
+ }
}
// Respond to button click to browse for an executable with which to edit XML files
@@ -1028,398 +1028,398 @@ void LLFloaterUIPreview::onClickBrowseForEditor()
void LLFloaterUIPreview::getExecutablePath(const std::vector<std::string>& filenames)
{
- // put the selected path into text field
- const std::string chosen_path = filenames[0];
- std::string executable_path = chosen_path;
+ // put the selected path into text field
+ const std::string chosen_path = filenames[0];
+ std::string executable_path = chosen_path;
#if LL_DARWIN
- // on Mac, if it's an application bundle, figure out the actual path from the Info.plist file
- CFStringRef path_cfstr = CFStringCreateWithCString(kCFAllocatorDefault, chosen_path.c_str(), kCFStringEncodingMacRoman); // get path as a CFStringRef
- CFURLRef path_url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path_cfstr, kCFURLPOSIXPathStyle, TRUE); // turn it into a CFURLRef
- CFBundleRef chosen_bundle = CFBundleCreate(kCFAllocatorDefault, path_url); // get a handle for the bundle
- if(NULL != chosen_bundle)
- {
- CFDictionaryRef bundleInfoDict = CFBundleGetInfoDictionary(chosen_bundle); // get the bundle's dictionary
- if(NULL != bundleInfoDict)
- {
- CFStringRef executable_cfstr = (CFStringRef)CFDictionaryGetValue(bundleInfoDict, CFSTR("CFBundleExecutable")); // get the name of the actual executable (e.g. TextEdit or firefox-bin)
- int max_file_length = 256; // (max file name length is 255 in OSX)
- char executable_buf[max_file_length];
- if(CFStringGetCString(executable_cfstr, executable_buf, max_file_length, kCFStringEncodingMacRoman)) // convert CFStringRef to char*
- {
- executable_path += std::string("/Contents/MacOS/") + std::string(executable_buf); // append path to executable directory and then executable name to exec path
- }
- else
- {
- std::string warning = "Unable to get CString from CFString for executable path";
- popupAndPrintWarning(warning);
- }
- }
- else
- {
- std::string warning = "Unable to get bundle info dictionary from application bundle";
- popupAndPrintWarning(warning);
- }
- }
- else
- {
- if(-1 != executable_path.find(".app")) // only warn if this path actually had ".app" in it, i.e. it probably just wasn'nt an app bundle and that's okay
- {
- std::string warning = std::string("Unable to get bundle from path \"") + chosen_path + std::string("\"");
- popupAndPrintWarning(warning);
- }
- }
+ // on Mac, if it's an application bundle, figure out the actual path from the Info.plist file
+ CFStringRef path_cfstr = CFStringCreateWithCString(kCFAllocatorDefault, chosen_path.c_str(), kCFStringEncodingMacRoman); // get path as a CFStringRef
+ CFURLRef path_url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path_cfstr, kCFURLPOSIXPathStyle, TRUE); // turn it into a CFURLRef
+ CFBundleRef chosen_bundle = CFBundleCreate(kCFAllocatorDefault, path_url); // get a handle for the bundle
+ if(NULL != chosen_bundle)
+ {
+ CFDictionaryRef bundleInfoDict = CFBundleGetInfoDictionary(chosen_bundle); // get the bundle's dictionary
+ if(NULL != bundleInfoDict)
+ {
+ CFStringRef executable_cfstr = (CFStringRef)CFDictionaryGetValue(bundleInfoDict, CFSTR("CFBundleExecutable")); // get the name of the actual executable (e.g. TextEdit or firefox-bin)
+ int max_file_length = 256; // (max file name length is 255 in OSX)
+ char executable_buf[max_file_length];
+ if(CFStringGetCString(executable_cfstr, executable_buf, max_file_length, kCFStringEncodingMacRoman)) // convert CFStringRef to char*
+ {
+ executable_path += std::string("/Contents/MacOS/") + std::string(executable_buf); // append path to executable directory and then executable name to exec path
+ }
+ else
+ {
+ std::string warning = "Unable to get CString from CFString for executable path";
+ popupAndPrintWarning(warning);
+ }
+ }
+ else
+ {
+ std::string warning = "Unable to get bundle info dictionary from application bundle";
+ popupAndPrintWarning(warning);
+ }
+ }
+ else
+ {
+ if(-1 != executable_path.find(".app")) // only warn if this path actually had ".app" in it, i.e. it probably just wasn'nt an app bundle and that's okay
+ {
+ std::string warning = std::string("Unable to get bundle from path \"") + chosen_path + std::string("\"");
+ popupAndPrintWarning(warning);
+ }
+ }
#endif
- mEditorPathTextBox->setText(std::string(executable_path)); // copy the path to the executable to the textfield for display and later fetching
+ mEditorPathTextBox->setText(std::string(executable_path)); // copy the path to the executable to the textfield for display and later fetching
}
// Respond to button click to browse for a VLT-generated diffs file
void LLFloaterUIPreview::onClickBrowseForDiffs()
{
- // create load dialog box
+ // create load dialog box
LLFilePickerReplyThread::startPicker(boost::bind(&LLFloaterUIPreview::getDiffsFilePath, this, _1), LLFilePicker::FFLOAD_XML, false);
}
void LLFloaterUIPreview::getDiffsFilePath(const std::vector<std::string>& filenames)
{
- // put the selected path into text field
- const std::string chosen_path = filenames[0];
- mDiffPathTextBox->setText(std::string(chosen_path)); // copy the path to the executable to the textfield for display and later fetching
- if(LLView::sHighlightingDiffs) // if we're already highlighting, toggle off and then on so we get the data from the new file
- {
- onClickToggleDiffHighlighting();
- onClickToggleDiffHighlighting();
- }
+ // put the selected path into text field
+ const std::string chosen_path = filenames[0];
+ mDiffPathTextBox->setText(std::string(chosen_path)); // copy the path to the executable to the textfield for display and later fetching
+ if(LLView::sHighlightingDiffs) // if we're already highlighting, toggle off and then on so we get the data from the new file
+ {
+ onClickToggleDiffHighlighting();
+ onClickToggleDiffHighlighting();
+ }
}
void LLFloaterUIPreview::onClickToggleDiffHighlighting()
{
- if(mHighlightingOverlaps)
- {
- onClickToggleOverlapping();
- mToggleOverlapButton->toggleState();
- }
-
- LLView::sPreviewHighlightedElements.clear(); // clear lists first
- mDiffsMap.clear();
- mFileList->clearHighlightedItems();
-
- if(LLView::sHighlightingDiffs) // Turning highlighting off
- {
- LLView::sHighlightingDiffs = !sHighlightingDiffs;
- return;
- }
- else // Turning highlighting on
- {
- // Get the file and make sure it exists
- std::string path_in_textfield = mDiffPathTextBox->getText(); // get file path
- BOOL error = FALSE;
-
- if(std::string("") == path_in_textfield) // check for blank file
- {
- std::string warning = "Unable to highlight differences because no file was provided; fill in the relevant text field";
- popupAndPrintWarning(warning);
- error = TRUE;
- }
-
- llstat dummy;
- if(LLFile::stat(path_in_textfield.c_str(), &dummy) && !error) // check if the file exists (empty check is reduntant but useful for the informative error message)
- {
- std::string warning = std::string("Unable to highlight differences because an invalid path to a difference file was provided:\"") + path_in_textfield + "\"";
- popupAndPrintWarning(warning);
- error = TRUE;
- }
-
- // Build a list of changed elements as given by the XML
- std::list<std::string> changed_element_names;
- LLXmlTree xml_tree;
- BOOL success = xml_tree.parseFile(path_in_textfield.c_str(), TRUE);
-
- if(success && !error)
- {
- LLXmlTreeNode* root_floater = xml_tree.getRoot();
- if(!strncmp("XuiDelta",root_floater->getName().c_str(),9))
- {
- for (LLXmlTreeNode* child = root_floater->getFirstChild(); // get the first child first, then below get the next one; otherwise the iterator is invalid (bug or feature in XML code?)
- child != NULL;
- child = root_floater->getNextChild()) // get child for next iteration
- {
- if(!strncmp("file",child->getName().c_str(),5))
- {
- scanDiffFile(child);
- }
- else if(!strncmp("error",child->getName().c_str(),6))
- {
- std::string error_file, error_message;
- child->getAttributeString("filename",error_file);
- child->getAttributeString("message",error_message);
- if(mDiffsMap.find(error_file) != mDiffsMap.end())
- {
- mDiffsMap.insert(std::make_pair(error_file,std::make_pair(StringListPtr(new StringList), StringListPtr(new StringList))));
- }
- mDiffsMap[error_file].second->push_back(error_message);
- }
- else
- {
- std::string warning = std::string("Child was neither a file or an error, but rather the following:\"") + std::string(child->getName()) + "\"";
- popupAndPrintWarning(warning);
- error = TRUE;
- break;
- }
- }
- }
- else
- {
- std::string warning = std::string("Root node not named XuiDelta:\"") + path_in_textfield + "\"";
- popupAndPrintWarning(warning);
- error = TRUE;
- }
- }
- else if(!error)
- {
- std::string warning = std::string("Unable to create tree from XML:\"") + path_in_textfield + "\"";
- popupAndPrintWarning(warning);
- error = TRUE;
- }
-
- if(error) // if we encountered an error, reset the button to off
- {
- mToggleHighlightButton->setToggleState(FALSE);
- }
- else // only toggle if we didn't encounter an error
- {
- LLView::sHighlightingDiffs = !sHighlightingDiffs;
- highlightChangedElements(); // *TODO: this is extraneous, right?
- highlightChangedFiles(); // *TODO: this is extraneous, right?
- }
- }
+ if(mHighlightingOverlaps)
+ {
+ onClickToggleOverlapping();
+ mToggleOverlapButton->toggleState();
+ }
+
+ LLView::sPreviewHighlightedElements.clear(); // clear lists first
+ mDiffsMap.clear();
+ mFileList->clearHighlightedItems();
+
+ if(LLView::sHighlightingDiffs) // Turning highlighting off
+ {
+ LLView::sHighlightingDiffs = !sHighlightingDiffs;
+ return;
+ }
+ else // Turning highlighting on
+ {
+ // Get the file and make sure it exists
+ std::string path_in_textfield = mDiffPathTextBox->getText(); // get file path
+ BOOL error = FALSE;
+
+ if(std::string("") == path_in_textfield) // check for blank file
+ {
+ std::string warning = "Unable to highlight differences because no file was provided; fill in the relevant text field";
+ popupAndPrintWarning(warning);
+ error = TRUE;
+ }
+
+ llstat dummy;
+ if(LLFile::stat(path_in_textfield.c_str(), &dummy) && !error) // check if the file exists (empty check is reduntant but useful for the informative error message)
+ {
+ std::string warning = std::string("Unable to highlight differences because an invalid path to a difference file was provided:\"") + path_in_textfield + "\"";
+ popupAndPrintWarning(warning);
+ error = TRUE;
+ }
+
+ // Build a list of changed elements as given by the XML
+ std::list<std::string> changed_element_names;
+ LLXmlTree xml_tree;
+ BOOL success = xml_tree.parseFile(path_in_textfield.c_str(), TRUE);
+
+ if(success && !error)
+ {
+ LLXmlTreeNode* root_floater = xml_tree.getRoot();
+ if(!strncmp("XuiDelta",root_floater->getName().c_str(),9))
+ {
+ for (LLXmlTreeNode* child = root_floater->getFirstChild(); // get the first child first, then below get the next one; otherwise the iterator is invalid (bug or feature in XML code?)
+ child != NULL;
+ child = root_floater->getNextChild()) // get child for next iteration
+ {
+ if(!strncmp("file",child->getName().c_str(),5))
+ {
+ scanDiffFile(child);
+ }
+ else if(!strncmp("error",child->getName().c_str(),6))
+ {
+ std::string error_file, error_message;
+ child->getAttributeString("filename",error_file);
+ child->getAttributeString("message",error_message);
+ if(mDiffsMap.find(error_file) != mDiffsMap.end())
+ {
+ mDiffsMap.insert(std::make_pair(error_file,std::make_pair(StringListPtr(new StringList), StringListPtr(new StringList))));
+ }
+ mDiffsMap[error_file].second->push_back(error_message);
+ }
+ else
+ {
+ std::string warning = std::string("Child was neither a file or an error, but rather the following:\"") + std::string(child->getName()) + "\"";
+ popupAndPrintWarning(warning);
+ error = TRUE;
+ break;
+ }
+ }
+ }
+ else
+ {
+ std::string warning = std::string("Root node not named XuiDelta:\"") + path_in_textfield + "\"";
+ popupAndPrintWarning(warning);
+ error = TRUE;
+ }
+ }
+ else if(!error)
+ {
+ std::string warning = std::string("Unable to create tree from XML:\"") + path_in_textfield + "\"";
+ popupAndPrintWarning(warning);
+ error = TRUE;
+ }
+
+ if(error) // if we encountered an error, reset the button to off
+ {
+ mToggleHighlightButton->setToggleState(FALSE);
+ }
+ else // only toggle if we didn't encounter an error
+ {
+ LLView::sHighlightingDiffs = !sHighlightingDiffs;
+ highlightChangedElements(); // *TODO: this is extraneous, right?
+ highlightChangedFiles(); // *TODO: this is extraneous, right?
+ }
+ }
}
void LLFloaterUIPreview::scanDiffFile(LLXmlTreeNode* file_node)
{
- // Get file name
- std::string file_name;
- file_node->getAttributeString("name",file_name);
- if(std::string("") == file_name)
- {
- std::string warning = std::string("Empty file name encountered in differences:\"") + file_name + "\"";
- popupAndPrintWarning(warning);
- return;
- }
-
- // Get a list of changed elements
- // Get the first child first, then below get the next one; otherwise the iterator is invalid (bug or feature in XML code?)
- for (LLXmlTreeNode* child = file_node->getFirstChild(); child != NULL; child = file_node->getNextChild())
- {
- if(!strncmp("delta",child->getName().c_str(),6))
- {
- std::string id;
- child->getAttributeString("id",id);
- if(mDiffsMap.find(file_name) == mDiffsMap.end())
- {
- mDiffsMap.insert(std::make_pair(file_name,std::make_pair(StringListPtr(new StringList), StringListPtr(new StringList))));
- }
- mDiffsMap[file_name].first->push_back(std::string(id.c_str()));
- }
- else
- {
- std::string warning = std::string("Child of file was not a delta, but rather the following:\"") + std::string(child->getName()) + "\"";
- popupAndPrintWarning(warning);
- return;
- }
- }
+ // Get file name
+ std::string file_name;
+ file_node->getAttributeString("name",file_name);
+ if(std::string("") == file_name)
+ {
+ std::string warning = std::string("Empty file name encountered in differences:\"") + file_name + "\"";
+ popupAndPrintWarning(warning);
+ return;
+ }
+
+ // Get a list of changed elements
+ // Get the first child first, then below get the next one; otherwise the iterator is invalid (bug or feature in XML code?)
+ for (LLXmlTreeNode* child = file_node->getFirstChild(); child != NULL; child = file_node->getNextChild())
+ {
+ if(!strncmp("delta",child->getName().c_str(),6))
+ {
+ std::string id;
+ child->getAttributeString("id",id);
+ if(mDiffsMap.find(file_name) == mDiffsMap.end())
+ {
+ mDiffsMap.insert(std::make_pair(file_name,std::make_pair(StringListPtr(new StringList), StringListPtr(new StringList))));
+ }
+ mDiffsMap[file_name].first->push_back(std::string(id.c_str()));
+ }
+ else
+ {
+ std::string warning = std::string("Child of file was not a delta, but rather the following:\"") + std::string(child->getName()) + "\"";
+ popupAndPrintWarning(warning);
+ return;
+ }
+ }
}
void LLFloaterUIPreview::highlightChangedElements()
{
- if(NULL == mLiveFile)
- {
- return;
- }
-
- // Process differences first (we want their warnings to be shown underneath other warnings)
- StringListPtr changed_element_paths;
- DiffMap::iterator iterExists = mDiffsMap.find(mLiveFile->mFileName);
- if(iterExists != mDiffsMap.end())
- {
- changed_element_paths = mDiffsMap[mLiveFile->mFileName].first; // retrieve list of changed element paths from map
- }
-
- for(std::list<std::string>::iterator iter = changed_element_paths->begin(); iter != changed_element_paths->end(); ++iter) // for every changed element path
- {
- LLView* element = mDisplayedFloater;
- if(!strncmp(iter->c_str(),".",1)) // if it's the root floater itself
- {
- continue;
- }
-
- // Split element hierarchy path on period (*HACK: it's possible that the element name will have a period in it, in which case this won't work. See https://wiki.lindenlab.com/wiki/Viewer_Localization_Tool_Documentation.)
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep(".");
- tokenizer tokens(*iter, sep);
- tokenizer::iterator token_iter;
- BOOL failed = FALSE;
- for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
- {
- element = element->findChild<LLView>(*token_iter,FALSE); // try to find element: don't recur, and don't create if missing
-
- // if we still didn't find it...
- if(NULL == element)
- {
- LL_INFOS() << "Unable to find element in XuiDelta file named \"" << *iter << "\" in file \"" << mLiveFile->mFileName <<
- "\". The element may no longer exist, the path may be incorrect, or it may not be a non-displayable element (not an LLView) such as a \"string\" type." << LL_ENDL;
- failed = TRUE;
- break;
- }
- }
-
- if(!failed)
- {
- // Now that we have a pointer to the actual element, add it to the list of elements to be highlighted
- std::set<LLView*>::iterator iter2 = std::find(LLView::sPreviewHighlightedElements.begin(), LLView::sPreviewHighlightedElements.end(), element);
- if(iter2 == LLView::sPreviewHighlightedElements.end())
- {
- LLView::sPreviewHighlightedElements.insert(element);
- }
- }
- }
-
- // Process errors second, so their warnings show up on top of other warnings
- StringListPtr error_list;
- if(iterExists != mDiffsMap.end())
- {
- error_list = mDiffsMap[mLiveFile->mFileName].second;
- }
- for(std::list<std::string>::iterator iter = error_list->begin(); iter != error_list->end(); ++iter) // for every changed element path
- {
- std::string warning = std::string("Error listed among differences. Filename: \"") + mLiveFile->mFileName + "\". Message: \"" + *iter + "\"";
- popupAndPrintWarning(warning);
- }
+ if(NULL == mLiveFile)
+ {
+ return;
+ }
+
+ // Process differences first (we want their warnings to be shown underneath other warnings)
+ StringListPtr changed_element_paths;
+ DiffMap::iterator iterExists = mDiffsMap.find(mLiveFile->mFileName);
+ if(iterExists != mDiffsMap.end())
+ {
+ changed_element_paths = mDiffsMap[mLiveFile->mFileName].first; // retrieve list of changed element paths from map
+ }
+
+ for(std::list<std::string>::iterator iter = changed_element_paths->begin(); iter != changed_element_paths->end(); ++iter) // for every changed element path
+ {
+ LLView* element = mDisplayedFloater;
+ if(!strncmp(iter->c_str(),".",1)) // if it's the root floater itself
+ {
+ continue;
+ }
+
+ // Split element hierarchy path on period (*HACK: it's possible that the element name will have a period in it, in which case this won't work. See https://wiki.lindenlab.com/wiki/Viewer_Localization_Tool_Documentation.)
+ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+ boost::char_separator<char> sep(".");
+ tokenizer tokens(*iter, sep);
+ tokenizer::iterator token_iter;
+ BOOL failed = FALSE;
+ for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
+ {
+ element = element->findChild<LLView>(*token_iter,FALSE); // try to find element: don't recur, and don't create if missing
+
+ // if we still didn't find it...
+ if(NULL == element)
+ {
+ LL_INFOS() << "Unable to find element in XuiDelta file named \"" << *iter << "\" in file \"" << mLiveFile->mFileName <<
+ "\". The element may no longer exist, the path may be incorrect, or it may not be a non-displayable element (not an LLView) such as a \"string\" type." << LL_ENDL;
+ failed = TRUE;
+ break;
+ }
+ }
+
+ if(!failed)
+ {
+ // Now that we have a pointer to the actual element, add it to the list of elements to be highlighted
+ std::set<LLView*>::iterator iter2 = std::find(LLView::sPreviewHighlightedElements.begin(), LLView::sPreviewHighlightedElements.end(), element);
+ if(iter2 == LLView::sPreviewHighlightedElements.end())
+ {
+ LLView::sPreviewHighlightedElements.insert(element);
+ }
+ }
+ }
+
+ // Process errors second, so their warnings show up on top of other warnings
+ StringListPtr error_list;
+ if(iterExists != mDiffsMap.end())
+ {
+ error_list = mDiffsMap[mLiveFile->mFileName].second;
+ }
+ for(std::list<std::string>::iterator iter = error_list->begin(); iter != error_list->end(); ++iter) // for every changed element path
+ {
+ std::string warning = std::string("Error listed among differences. Filename: \"") + mLiveFile->mFileName + "\". Message: \"" + *iter + "\"";
+ popupAndPrintWarning(warning);
+ }
}
void LLFloaterUIPreview::highlightChangedFiles()
{
- for(DiffMap::iterator iter = mDiffsMap.begin(); iter != mDiffsMap.end(); ++iter) // for every file listed in diffs
- {
- LLScrollListItem* item = mFileList->getItemByLabel(std::string(iter->first), FALSE, 1);
- if(item)
- {
- item->setHighlighted(TRUE);
- }
- }
+ for(DiffMap::iterator iter = mDiffsMap.begin(); iter != mDiffsMap.end(); ++iter) // for every file listed in diffs
+ {
+ LLScrollListItem* item = mFileList->getItemByLabel(std::string(iter->first), FALSE, 1);
+ if(item)
+ {
+ item->setHighlighted(TRUE);
+ }
+ }
}
// Respond to button click to browse for an executable with which to edit XML files
void LLFloaterUIPreview::onClickCloseDisplayedFloater(S32 caller_id)
{
- if(caller_id == PRIMARY_FLOATER)
- {
- mCloseOtherButton->setEnabled(FALSE);
- mToggleOverlapButton->setEnabled(FALSE);
-
- if(mDisplayedFloater)
- {
- mLastDisplayedX = mDisplayedFloater->calcScreenRect().mLeft;
- mLastDisplayedY = mDisplayedFloater->calcScreenRect().mBottom;
- delete mDisplayedFloater;
- mDisplayedFloater = NULL;
- }
-
- if(mLiveFile)
- {
- delete mLiveFile;
- mLiveFile = NULL;
- }
-
- if(mToggleOverlapButton->getToggleState())
- {
- mToggleOverlapButton->toggleState();
- onClickToggleOverlapping();
- }
-
- LLView::sPreviewClickedElement = NULL; // stop overlapping elements panel from drawing
- mOverlapPanel->mLastClickedElement = NULL;
- }
- else
- {
- mCloseOtherButton_2->setEnabled(FALSE);
- delete mDisplayedFloater_2;
- mDisplayedFloater_2 = NULL;
- }
+ if(caller_id == PRIMARY_FLOATER)
+ {
+ mCloseOtherButton->setEnabled(FALSE);
+ mToggleOverlapButton->setEnabled(FALSE);
+
+ if(mDisplayedFloater)
+ {
+ mLastDisplayedX = mDisplayedFloater->calcScreenRect().mLeft;
+ mLastDisplayedY = mDisplayedFloater->calcScreenRect().mBottom;
+ delete mDisplayedFloater;
+ mDisplayedFloater = NULL;
+ }
+
+ if(mLiveFile)
+ {
+ delete mLiveFile;
+ mLiveFile = NULL;
+ }
+
+ if(mToggleOverlapButton->getToggleState())
+ {
+ mToggleOverlapButton->toggleState();
+ onClickToggleOverlapping();
+ }
+
+ LLView::sPreviewClickedElement = NULL; // stop overlapping elements panel from drawing
+ mOverlapPanel->mLastClickedElement = NULL;
+ }
+ else
+ {
+ mCloseOtherButton_2->setEnabled(FALSE);
+ delete mDisplayedFloater_2;
+ mDisplayedFloater_2 = NULL;
+ }
}
void append_view_tooltip(LLView* tooltip_view, std::string *tooltip_msg)
{
- LLRect rect = tooltip_view->getRect();
- LLRect parent_rect = tooltip_view->getParent()->getRect();
- S32 left = rect.mLeft;
- // invert coordinate system for XUI top-left layout
- S32 top = parent_rect.getHeight() - rect.mTop;
- if (!tooltip_msg->empty())
- {
- tooltip_msg->append("\n");
- }
- std::string msg = llformat("%s %d, %d (%d x %d)",
- tooltip_view->getName().c_str(),
- left,
- top,
- rect.getWidth(),
- rect.getHeight() );
- tooltip_msg->append( msg );
+ LLRect rect = tooltip_view->getRect();
+ LLRect parent_rect = tooltip_view->getParent()->getRect();
+ S32 left = rect.mLeft;
+ // invert coordinate system for XUI top-left layout
+ S32 top = parent_rect.getHeight() - rect.mTop;
+ if (!tooltip_msg->empty())
+ {
+ tooltip_msg->append("\n");
+ }
+ std::string msg = llformat("%s %d, %d (%d x %d)",
+ tooltip_view->getName().c_str(),
+ left,
+ top,
+ rect.getWidth(),
+ rect.getHeight() );
+ tooltip_msg->append( msg );
}
BOOL LLPreviewedFloater::handleToolTip(S32 x, S32 y, MASK mask)
{
- if (!sShowRectangles)
- {
- return LLFloater::handleToolTip(x, y, mask);
- }
-
- S32 screen_x, screen_y;
- localPointToScreen(x, y, &screen_x, &screen_y);
- std::string tooltip_msg;
- LLView* tooltip_view = this;
- LLView::tree_iterator_t end_it = endTreeDFS();
- for (LLView::tree_iterator_t it = beginTreeDFS(); it != end_it; ++it)
- {
- LLView* viewp = *it;
- LLRect screen_rect;
- viewp->localRectToScreen(viewp->getLocalRect(), &screen_rect);
- if (!(viewp->getVisible()
- && screen_rect.pointInRect(screen_x, screen_y)))
- {
- it.skipDescendants();
- }
- // only report xui names for LLUICtrls, not the various container LLViews
-
- else if (dynamic_cast<LLUICtrl*>(viewp))
- {
- // if we are in a new part of the tree (not a descendent of current tooltip_view)
- // then push the results for tooltip_view and start with a new potential view
- // NOTE: this emulates visiting only the leaf nodes that meet our criteria
-
- if (tooltip_view != this
- && !viewp->hasAncestor(tooltip_view))
- {
- append_view_tooltip(tooltip_view, &tooltip_msg);
- }
- tooltip_view = viewp;
- }
- }
-
- append_view_tooltip(tooltip_view, &tooltip_msg);
-
- LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(tooltip_msg)
- .max_width(400));
- return TRUE;
+ if (!sShowRectangles)
+ {
+ return LLFloater::handleToolTip(x, y, mask);
+ }
+
+ S32 screen_x, screen_y;
+ localPointToScreen(x, y, &screen_x, &screen_y);
+ std::string tooltip_msg;
+ LLView* tooltip_view = this;
+ LLView::tree_iterator_t end_it = endTreeDFS();
+ for (LLView::tree_iterator_t it = beginTreeDFS(); it != end_it; ++it)
+ {
+ LLView* viewp = *it;
+ LLRect screen_rect;
+ viewp->localRectToScreen(viewp->getLocalRect(), &screen_rect);
+ if (!(viewp->getVisible()
+ && screen_rect.pointInRect(screen_x, screen_y)))
+ {
+ it.skipDescendants();
+ }
+ // only report xui names for LLUICtrls, not the various container LLViews
+
+ else if (dynamic_cast<LLUICtrl*>(viewp))
+ {
+ // if we are in a new part of the tree (not a descendent of current tooltip_view)
+ // then push the results for tooltip_view and start with a new potential view
+ // NOTE: this emulates visiting only the leaf nodes that meet our criteria
+
+ if (tooltip_view != this
+ && !viewp->hasAncestor(tooltip_view))
+ {
+ append_view_tooltip(tooltip_view, &tooltip_msg);
+ }
+ tooltip_view = viewp;
+ }
+ }
+
+ append_view_tooltip(tooltip_view, &tooltip_msg);
+
+ LLToolTipMgr::instance().show(LLToolTip::Params()
+ .message(tooltip_msg)
+ .max_width(400));
+ return TRUE;
}
BOOL LLPreviewedFloater::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- selectElement(this,x,y,0);
- return TRUE;
+ selectElement(this,x,y,0);
+ return TRUE;
}
// *NOTE: In order to hide all of the overlapping elements of the selected element so as to see it in context, here is what you would need to do:
@@ -1433,131 +1433,131 @@ BOOL LLPreviewedFloater::handleRightMouseDown(S32 x, S32 y, MASK mask)
// ~Jacob, 8/08
BOOL LLPreviewedFloater::selectElement(LLView* parent, int x, int y, int depth)
{
- if(getVisible())
- {
- BOOL handled = FALSE;
- if(LLFloaterUIPreview::containerType(parent))
- {
- for(child_list_const_iter_t child_it = parent->getChildList()->begin(); child_it != parent->getChildList()->end(); ++child_it)
- {
- LLView* child = *child_it;
- S32 local_x = x - child->getRect().mLeft;
- S32 local_y = y - child->getRect().mBottom;
- if (child->pointInView(local_x, local_y) &&
- child->getVisible() &&
- selectElement(child, x, y, ++depth))
- {
- handled = TRUE;
- break;
- }
- }
- }
-
- if(!handled)
- {
- LLView::sPreviewClickedElement = parent;
- }
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ if(getVisible())
+ {
+ BOOL handled = FALSE;
+ if(LLFloaterUIPreview::containerType(parent))
+ {
+ for(child_list_const_iter_t child_it = parent->getChildList()->begin(); child_it != parent->getChildList()->end(); ++child_it)
+ {
+ LLView* child = *child_it;
+ S32 local_x = x - child->getRect().mLeft;
+ S32 local_y = y - child->getRect().mBottom;
+ if (child->pointInView(local_x, local_y) &&
+ child->getVisible() &&
+ selectElement(child, x, y, ++depth))
+ {
+ handled = TRUE;
+ break;
+ }
+ }
+ }
+
+ if(!handled)
+ {
+ LLView::sPreviewClickedElement = parent;
+ }
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
void LLPreviewedFloater::draw()
{
- if(NULL != mFloaterUIPreview)
- {
- // Set and unset sDrawPreviewHighlights flag so as to avoid using two flags
- if(mFloaterUIPreview->mHighlightingOverlaps)
- {
- LLView::sDrawPreviewHighlights = TRUE;
- }
-
- // If we're looking for truncations, draw debug rects for the displayed
- // floater only.
- bool old_debug_rects = LLView::sDebugRects;
- bool old_show_names = LLView::sDebugRectsShowNames;
- if (sShowRectangles)
- {
- LLView::sDebugRects = true;
- LLView::sDebugRectsShowNames = false;
- }
-
- LLFloater::draw();
-
- LLView::sDebugRects = old_debug_rects;
- LLView::sDebugRectsShowNames = old_show_names;
-
- if(mFloaterUIPreview->mHighlightingOverlaps)
- {
- LLView::sDrawPreviewHighlights = FALSE;
- }
- }
+ if(NULL != mFloaterUIPreview)
+ {
+ // Set and unset sDrawPreviewHighlights flag so as to avoid using two flags
+ if(mFloaterUIPreview->mHighlightingOverlaps)
+ {
+ LLView::sDrawPreviewHighlights = TRUE;
+ }
+
+ // If we're looking for truncations, draw debug rects for the displayed
+ // floater only.
+ bool old_debug_rects = LLView::sDebugRects;
+ bool old_show_names = LLView::sDebugRectsShowNames;
+ if (sShowRectangles)
+ {
+ LLView::sDebugRects = true;
+ LLView::sDebugRectsShowNames = false;
+ }
+
+ LLFloater::draw();
+
+ LLView::sDebugRects = old_debug_rects;
+ LLView::sDebugRectsShowNames = old_show_names;
+
+ if(mFloaterUIPreview->mHighlightingOverlaps)
+ {
+ LLView::sDrawPreviewHighlights = FALSE;
+ }
+ }
}
void LLFloaterUIPreview::onClickToggleOverlapping()
{
- if(LLView::sHighlightingDiffs)
- {
- onClickToggleDiffHighlighting();
- mToggleHighlightButton->toggleState();
- }
- LLView::sPreviewHighlightedElements.clear(); // clear lists first
-
- S32 width, height;
- getResizeLimits(&width, &height); // illegal call of non-static member function
- if(mHighlightingOverlaps)
- {
- mHighlightingOverlaps = !mHighlightingOverlaps;
- // reset list of preview highlighted elements
- setRect(LLRect(getRect().mLeft,getRect().mTop,getRect().mRight - mOverlapPanel->getRect().getWidth(),getRect().mBottom));
- setResizeLimits(width - mOverlapPanel->getRect().getWidth(), height);
- }
- else
- {
- mHighlightingOverlaps = !mHighlightingOverlaps;
- displayFloater(FALSE,1);
- setRect(LLRect(getRect().mLeft,getRect().mTop,getRect().mRight + mOverlapPanel->getRect().getWidth(),getRect().mBottom));
- setResizeLimits(width + mOverlapPanel->getRect().getWidth(), height);
- }
- getChildView("overlap_scroll")->setVisible( mHighlightingOverlaps);
+ if(LLView::sHighlightingDiffs)
+ {
+ onClickToggleDiffHighlighting();
+ mToggleHighlightButton->toggleState();
+ }
+ LLView::sPreviewHighlightedElements.clear(); // clear lists first
+
+ S32 width, height;
+ getResizeLimits(&width, &height); // illegal call of non-static member function
+ if(mHighlightingOverlaps)
+ {
+ mHighlightingOverlaps = !mHighlightingOverlaps;
+ // reset list of preview highlighted elements
+ setRect(LLRect(getRect().mLeft,getRect().mTop,getRect().mRight - mOverlapPanel->getRect().getWidth(),getRect().mBottom));
+ setResizeLimits(width - mOverlapPanel->getRect().getWidth(), height);
+ }
+ else
+ {
+ mHighlightingOverlaps = !mHighlightingOverlaps;
+ displayFloater(FALSE,1);
+ setRect(LLRect(getRect().mLeft,getRect().mTop,getRect().mRight + mOverlapPanel->getRect().getWidth(),getRect().mBottom));
+ setResizeLimits(width + mOverlapPanel->getRect().getWidth(), height);
+ }
+ getChildView("overlap_scroll")->setVisible( mHighlightingOverlaps);
}
void LLFloaterUIPreview::findOverlapsInChildren(LLView* parent)
{
- if(parent->getChildCount() == 0 || !containerType(parent)) // if it has no children or isn't a container type, skip it
- {
- return;
- }
-
- // for every child of the parent
- for(child_list_const_iter_t child_it = parent->getChildList()->begin(); child_it != parent->getChildList()->end(); ++child_it)
- {
- LLView* child = *child_it;
- if(overlapIgnorable(child))
- {
- continue;
- }
-
- // for every sibling
- for(child_list_const_iter_t sibling_it = parent->getChildList()->begin(); sibling_it != parent->getChildList()->end(); ++sibling_it) // for each sibling
- {
- LLView* sibling = *sibling_it;
- if(overlapIgnorable(sibling))
- {
- continue;
- }
-
- // if they overlap... (we don't care if they're visible or enabled -- we want to check those anyway, i.e. hidden tabs that can be later shown)
- if(sibling != child && elementOverlap(child, sibling))
- {
- mOverlapPanel->mOverlapMap[child].push_back(sibling); // add to the map
- }
- }
- findOverlapsInChildren(child); // recur
- }
+ if(parent->getChildCount() == 0 || !containerType(parent)) // if it has no children or isn't a container type, skip it
+ {
+ return;
+ }
+
+ // for every child of the parent
+ for(child_list_const_iter_t child_it = parent->getChildList()->begin(); child_it != parent->getChildList()->end(); ++child_it)
+ {
+ LLView* child = *child_it;
+ if(overlapIgnorable(child))
+ {
+ continue;
+ }
+
+ // for every sibling
+ for(child_list_const_iter_t sibling_it = parent->getChildList()->begin(); sibling_it != parent->getChildList()->end(); ++sibling_it) // for each sibling
+ {
+ LLView* sibling = *sibling_it;
+ if(overlapIgnorable(sibling))
+ {
+ continue;
+ }
+
+ // if they overlap... (we don't care if they're visible or enabled -- we want to check those anyway, i.e. hidden tabs that can be later shown)
+ if(sibling != child && elementOverlap(child, sibling))
+ {
+ mOverlapPanel->mOverlapMap[child].push_back(sibling); // add to the map
+ }
+ }
+ findOverlapsInChildren(child); // recur
+ }
}
// *HACK: don't overlap with the drag handle and various other elements
@@ -1565,153 +1565,153 @@ void LLFloaterUIPreview::findOverlapsInChildren(LLView* parent)
// *NOTE: If a list of elements which have localizable content were created, this function should return false if viewp's class is in that list.
BOOL LLFloaterUIPreview::overlapIgnorable(LLView* viewp)
{
- return NULL != dynamic_cast<LLDragHandle*>(viewp) ||
- NULL != dynamic_cast<LLViewBorder*>(viewp) ||
- NULL != dynamic_cast<LLResizeBar*>(viewp);
+ return NULL != dynamic_cast<LLDragHandle*>(viewp) ||
+ NULL != dynamic_cast<LLViewBorder*>(viewp) ||
+ NULL != dynamic_cast<LLResizeBar*>(viewp);
}
// *HACK: these are the only two container types as of 8/08, per Richard
// This is using dynamic casts because there is no object-oriented way to tell which elements are containers.
BOOL LLFloaterUIPreview::containerType(LLView* viewp)
{
- return NULL != dynamic_cast<LLPanel*>(viewp) || NULL != dynamic_cast<LLLayoutStack*>(viewp);
+ return NULL != dynamic_cast<LLPanel*>(viewp) || NULL != dynamic_cast<LLLayoutStack*>(viewp);
}
// Check if two llview's rectangles overlap, with some tolerance
BOOL LLFloaterUIPreview::elementOverlap(LLView* view1, LLView* view2)
{
- LLSD rec1 = view1->getRect().getValue();
- LLSD rec2 = view2->getRect().getValue();
- int tolerance = 2;
- return (int)rec1[0] <= (int)rec2[2] - tolerance &&
- (int)rec2[0] <= (int)rec1[2] - tolerance &&
- (int)rec1[3] <= (int)rec2[1] - tolerance &&
- (int)rec2[3] <= (int)rec1[1] - tolerance;
+ LLSD rec1 = view1->getRect().getValue();
+ LLSD rec2 = view2->getRect().getValue();
+ int tolerance = 2;
+ return (int)rec1[0] <= (int)rec2[2] - tolerance &&
+ (int)rec2[0] <= (int)rec1[2] - tolerance &&
+ (int)rec1[3] <= (int)rec2[1] - tolerance &&
+ (int)rec2[3] <= (int)rec1[1] - tolerance;
}
void LLOverlapPanel::draw()
{
- static const std::string current_selection_text("Current selection: ");
- static const std::string overlapper_text("Overlapper: ");
- LLColor4 text_color = LLColor4::grey;
- gGL.color4fv(text_color.mV);
-
- if(!LLView::sPreviewClickedElement)
- {
- LLUI::translate(5,getRect().getHeight()-20); // translate to top-5,left-5
- LLView::sDrawPreviewHighlights = FALSE;
- LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection_text, 0, 0, 0, text_color,
- LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
- }
- else
- {
- OverlapMap::iterator iterExists = mOverlapMap.find(LLView::sPreviewClickedElement);
- if(iterExists == mOverlapMap.end())
- {
- return;
- }
-
- std::list<LLView*> overlappers = mOverlapMap[LLView::sPreviewClickedElement];
- if(overlappers.size() == 0)
- {
- LLUI::translate(5,getRect().getHeight()-20); // translate to top-5,left-5
- LLView::sDrawPreviewHighlights = FALSE;
- std::string current_selection = std::string(current_selection_text + LLView::sPreviewClickedElement->getName() + " (no elements overlap)");
- S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(current_selection) + 10;
- LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection, 0, 0, 0, text_color,
- LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
- // widen panel enough to fit this text
- LLRect rect = getRect();
- setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop));
- return;
- }
-
- // recalculate required with and height; otherwise use cached
- BOOL need_to_recalculate_bounds = FALSE;
- if(mLastClickedElement == NULL)
- {
- need_to_recalculate_bounds = TRUE;
- }
-
- if(NULL == mLastClickedElement)
- {
- mLastClickedElement = LLView::sPreviewClickedElement;
- }
-
- // recalculate bounds for scroll panel
- if(need_to_recalculate_bounds || LLView::sPreviewClickedElement->getName() != mLastClickedElement->getName())
- {
- // reset panel's rectangle to its default width and height (300x600)
- LLRect panel_rect = getRect();
- setRect(LLRect(panel_rect.mLeft,panel_rect.mTop,panel_rect.mLeft+getRect().getWidth(),panel_rect.mTop-getRect().getHeight()));
-
- LLRect rect;
-
- // change bounds for selected element
- int height_sum = mLastClickedElement->getRect().getHeight() + mSpacing + 80;
- rect = getRect();
- setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > mLastClickedElement->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + mLastClickedElement->getRect().getWidth() + 5, rect.mBottom));
-
- // and widen to accomodate text if that's wider
- std::string display_text = current_selection_text + LLView::sPreviewClickedElement->getName();
- S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(display_text) + 10;
- rect = getRect();
- setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop));
-
- std::list<LLView*> overlappers = mOverlapMap[LLView::sPreviewClickedElement];
- for(std::list<LLView*>::iterator overlap_it = overlappers.begin(); overlap_it != overlappers.end(); ++overlap_it)
- {
- LLView* viewp = *overlap_it;
- height_sum += viewp->getRect().getHeight() + mSpacing*3;
-
- // widen panel's rectangle to accommodate widest overlapping element of this floater
- rect = getRect();
- setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > viewp->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + viewp->getRect().getWidth() + 5, rect.mBottom));
-
- // and widen to accomodate text if that's wider
- std::string display_text = overlapper_text + viewp->getName();
- S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(display_text) + 10;
- rect = getRect();
- setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop));
- }
- // change panel's height to accommodate all element heights plus spacing between them
- rect = getRect();
- setRect(LLRect(rect.mLeft,rect.mTop,rect.mRight,rect.mTop-height_sum));
- }
-
- LLUI::translate(5,getRect().getHeight()-10); // translate to top left
- LLView::sDrawPreviewHighlights = FALSE;
-
- // draw currently-selected element at top of overlappers
- LLUI::translate(0,-mSpacing);
- LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection_text + LLView::sPreviewClickedElement->getName(), 0, 0, 0, text_color,
- LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
- LLUI::translate(0,-mSpacing-LLView::sPreviewClickedElement->getRect().getHeight()); // skip spacing distance + height
- LLView::sPreviewClickedElement->draw();
-
- for(std::list<LLView*>::iterator overlap_it = overlappers.begin(); overlap_it != overlappers.end(); ++overlap_it)
- {
- LLView* viewp = *overlap_it;
-
- // draw separating line
- LLUI::translate(0,-mSpacing);
- gl_line_2d(0,0,getRect().getWidth()-10,0,LLColor4(192.0f/255.0f,192.0f/255.0f,192.0f/255.0f));
-
- // draw name
- LLUI::translate(0,-mSpacing);
- LLFontGL::getFontSansSerifSmall()->renderUTF8(overlapper_text + viewp->getName(), 0, 0, 0, text_color,
- LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
-
- // draw element
- LLUI::translate(0,-mSpacing-viewp->getRect().getHeight()); // skip spacing distance + height
- viewp->draw();
- }
- mLastClickedElement = LLView::sPreviewClickedElement;
- }
+ static const std::string current_selection_text("Current selection: ");
+ static const std::string overlapper_text("Overlapper: ");
+ LLColor4 text_color = LLColor4::grey;
+ gGL.color4fv(text_color.mV);
+
+ if(!LLView::sPreviewClickedElement)
+ {
+ LLUI::translate(5,getRect().getHeight()-20); // translate to top-5,left-5
+ LLView::sDrawPreviewHighlights = FALSE;
+ LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection_text, 0, 0, 0, text_color,
+ LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
+ }
+ else
+ {
+ OverlapMap::iterator iterExists = mOverlapMap.find(LLView::sPreviewClickedElement);
+ if(iterExists == mOverlapMap.end())
+ {
+ return;
+ }
+
+ std::list<LLView*> overlappers = mOverlapMap[LLView::sPreviewClickedElement];
+ if(overlappers.size() == 0)
+ {
+ LLUI::translate(5,getRect().getHeight()-20); // translate to top-5,left-5
+ LLView::sDrawPreviewHighlights = FALSE;
+ std::string current_selection = std::string(current_selection_text + LLView::sPreviewClickedElement->getName() + " (no elements overlap)");
+ S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(current_selection) + 10;
+ LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection, 0, 0, 0, text_color,
+ LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
+ // widen panel enough to fit this text
+ LLRect rect = getRect();
+ setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop));
+ return;
+ }
+
+ // recalculate required with and height; otherwise use cached
+ BOOL need_to_recalculate_bounds = FALSE;
+ if(mLastClickedElement == NULL)
+ {
+ need_to_recalculate_bounds = TRUE;
+ }
+
+ if(NULL == mLastClickedElement)
+ {
+ mLastClickedElement = LLView::sPreviewClickedElement;
+ }
+
+ // recalculate bounds for scroll panel
+ if(need_to_recalculate_bounds || LLView::sPreviewClickedElement->getName() != mLastClickedElement->getName())
+ {
+ // reset panel's rectangle to its default width and height (300x600)
+ LLRect panel_rect = getRect();
+ setRect(LLRect(panel_rect.mLeft,panel_rect.mTop,panel_rect.mLeft+getRect().getWidth(),panel_rect.mTop-getRect().getHeight()));
+
+ LLRect rect;
+
+ // change bounds for selected element
+ int height_sum = mLastClickedElement->getRect().getHeight() + mSpacing + 80;
+ rect = getRect();
+ setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > mLastClickedElement->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + mLastClickedElement->getRect().getWidth() + 5, rect.mBottom));
+
+ // and widen to accomodate text if that's wider
+ std::string display_text = current_selection_text + LLView::sPreviewClickedElement->getName();
+ S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(display_text) + 10;
+ rect = getRect();
+ setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop));
+
+ std::list<LLView*> overlappers = mOverlapMap[LLView::sPreviewClickedElement];
+ for(std::list<LLView*>::iterator overlap_it = overlappers.begin(); overlap_it != overlappers.end(); ++overlap_it)
+ {
+ LLView* viewp = *overlap_it;
+ height_sum += viewp->getRect().getHeight() + mSpacing*3;
+
+ // widen panel's rectangle to accommodate widest overlapping element of this floater
+ rect = getRect();
+ setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > viewp->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + viewp->getRect().getWidth() + 5, rect.mBottom));
+
+ // and widen to accomodate text if that's wider
+ std::string display_text = overlapper_text + viewp->getName();
+ S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(display_text) + 10;
+ rect = getRect();
+ setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop));
+ }
+ // change panel's height to accommodate all element heights plus spacing between them
+ rect = getRect();
+ setRect(LLRect(rect.mLeft,rect.mTop,rect.mRight,rect.mTop-height_sum));
+ }
+
+ LLUI::translate(5,getRect().getHeight()-10); // translate to top left
+ LLView::sDrawPreviewHighlights = FALSE;
+
+ // draw currently-selected element at top of overlappers
+ LLUI::translate(0,-mSpacing);
+ LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection_text + LLView::sPreviewClickedElement->getName(), 0, 0, 0, text_color,
+ LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
+ LLUI::translate(0,-mSpacing-LLView::sPreviewClickedElement->getRect().getHeight()); // skip spacing distance + height
+ LLView::sPreviewClickedElement->draw();
+
+ for(std::list<LLView*>::iterator overlap_it = overlappers.begin(); overlap_it != overlappers.end(); ++overlap_it)
+ {
+ LLView* viewp = *overlap_it;
+
+ // draw separating line
+ LLUI::translate(0,-mSpacing);
+ gl_line_2d(0,0,getRect().getWidth()-10,0,LLColor4(192.0f/255.0f,192.0f/255.0f,192.0f/255.0f));
+
+ // draw name
+ LLUI::translate(0,-mSpacing);
+ LLFontGL::getFontSansSerifSmall()->renderUTF8(overlapper_text + viewp->getName(), 0, 0, 0, text_color,
+ LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
+
+ // draw element
+ LLUI::translate(0,-mSpacing-viewp->getRect().getHeight()); // skip spacing distance + height
+ viewp->draw();
+ }
+ mLastClickedElement = LLView::sPreviewClickedElement;
+ }
}
void LLFloaterUIPreviewUtil::registerFloater()
{
- LLFloaterReg::add("ui_preview", "floater_ui_preview.xml",
- &LLFloaterReg::build<LLFloaterUIPreview>);
+ LLFloaterReg::add("ui_preview", "floater_ui_preview.xml",
+ &LLFloaterReg::build<LLFloaterUIPreview>);
}
diff --git a/indra/newview/llfloateruipreview.h b/indra/newview/llfloateruipreview.h
index 910ab7ebc9..a3b1bf8840 100644
--- a/indra/newview/llfloateruipreview.h
+++ b/indra/newview/llfloateruipreview.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
namespace LLFloaterUIPreviewUtil
{
- void registerFloater();
+ void registerFloater();
}
#endif // LL_LLUIPREVIEW_H
diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp
index 48d6e01d32..6d75c4eb94 100644
--- a/indra/newview/llfloaterurlentry.cpp
+++ b/indra/newview/llfloaterurlentry.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,10 +46,10 @@ static LLFloaterURLEntry* sInstance = NULL;
// LLFloaterURLEntry()
//-----------------------------------------------------------------------------
LLFloaterURLEntry::LLFloaterURLEntry(LLHandle<LLPanel> parent)
- : LLFloater(LLSD()),
- mPanelLandMediaHandle(parent)
+ : LLFloater(LLSD()),
+ mPanelLandMediaHandle(parent)
{
- buildFromFile("floater_url_entry.xml");
+ buildFromFile("floater_url_entry.xml");
}
//-----------------------------------------------------------------------------
@@ -57,91 +57,91 @@ LLFloaterURLEntry::LLFloaterURLEntry(LLHandle<LLPanel> parent)
//-----------------------------------------------------------------------------
LLFloaterURLEntry::~LLFloaterURLEntry()
{
- sInstance = NULL;
+ sInstance = NULL;
}
BOOL LLFloaterURLEntry::postBuild()
{
- mMediaURLEdit = getChild<LLComboBox>("media_entry");
+ mMediaURLEdit = getChild<LLComboBox>("media_entry");
- // Cancel button
- childSetAction("cancel_btn", onBtnCancel, this);
+ // Cancel button
+ childSetAction("cancel_btn", onBtnCancel, this);
- // Cancel button
- childSetAction("clear_btn", onBtnClear, this);
- // clear media list button
- LLSD parcel_history = LLURLHistory::getURLHistory("parcel");
- bool enable_clear_button = parcel_history.size() > 0 ? true : false;
- getChildView("clear_btn")->setEnabled(enable_clear_button );
+ // Cancel button
+ childSetAction("clear_btn", onBtnClear, this);
+ // clear media list button
+ LLSD parcel_history = LLURLHistory::getURLHistory("parcel");
+ bool enable_clear_button = parcel_history.size() > 0 ? true : false;
+ getChildView("clear_btn")->setEnabled(enable_clear_button );
- // OK button
- childSetAction("ok_btn", onBtnOK, this);
+ // OK button
+ childSetAction("ok_btn", onBtnOK, this);
- setDefaultBtn("ok_btn");
- buildURLHistory();
+ setDefaultBtn("ok_btn");
+ buildURLHistory();
- return TRUE;
+ return TRUE;
}
void LLFloaterURLEntry::buildURLHistory()
{
- LLCtrlListInterface* url_list = childGetListInterface("media_entry");
- if (url_list)
- {
- url_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
- }
-
- // Get all of the entries in the "parcel" collection
- LLSD parcel_history = LLURLHistory::getURLHistory("parcel");
-
- LLSD::array_iterator iter_history =
- parcel_history.beginArray();
- LLSD::array_iterator end_history =
- parcel_history.endArray();
- for(; iter_history != end_history; ++iter_history)
- {
- url_list->addSimpleElement((*iter_history).asString());
- }
+ LLCtrlListInterface* url_list = childGetListInterface("media_entry");
+ if (url_list)
+ {
+ url_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+ }
+
+ // Get all of the entries in the "parcel" collection
+ LLSD parcel_history = LLURLHistory::getURLHistory("parcel");
+
+ LLSD::array_iterator iter_history =
+ parcel_history.beginArray();
+ LLSD::array_iterator end_history =
+ parcel_history.endArray();
+ for(; iter_history != end_history; ++iter_history)
+ {
+ url_list->addSimpleElement((*iter_history).asString());
+ }
}
void LLFloaterURLEntry::headerFetchComplete(S32 status, const std::string& mime_type)
{
- LLPanelLandMedia* panel_media = dynamic_cast<LLPanelLandMedia*>(mPanelLandMediaHandle.get());
- if (panel_media)
- {
- // status is ignored for now -- error = "none/none"
- panel_media->setMediaType(mime_type);
- panel_media->setMediaURL(mMediaURLEdit->getValue().asString());
- }
-
- getChildView("loading_label")->setVisible( false);
- closeFloater();
+ LLPanelLandMedia* panel_media = dynamic_cast<LLPanelLandMedia*>(mPanelLandMediaHandle.get());
+ if (panel_media)
+ {
+ // status is ignored for now -- error = "none/none"
+ panel_media->setMediaType(mime_type);
+ panel_media->setMediaURL(mMediaURLEdit->getValue().asString());
+ }
+
+ getChildView("loading_label")->setVisible( false);
+ closeFloater();
}
// static
LLHandle<LLFloater> LLFloaterURLEntry::show(LLHandle<LLPanel> parent, const std::string media_url)
{
- if (!sInstance)
- {
- sInstance = new LLFloaterURLEntry(parent);
- }
- sInstance->openFloater();
- sInstance->addURLToCombobox(media_url);
- return sInstance->getHandle();
+ if (!sInstance)
+ {
+ sInstance = new LLFloaterURLEntry(parent);
+ }
+ sInstance->openFloater();
+ sInstance->addURLToCombobox(media_url);
+ return sInstance->getHandle();
}
bool LLFloaterURLEntry::addURLToCombobox(const std::string& media_url)
{
- if(! mMediaURLEdit->setSimple( media_url ) && ! media_url.empty())
- {
- mMediaURLEdit->add( media_url );
- mMediaURLEdit->setSimple( media_url );
- return true;
- }
-
- // URL was not added for whatever reason (either it was empty or already existed)
- return false;
+ if(! mMediaURLEdit->setSimple( media_url ) && ! media_url.empty())
+ {
+ mMediaURLEdit->add( media_url );
+ mMediaURLEdit->setSimple( media_url );
+ return true;
+ }
+
+ // URL was not added for whatever reason (either it was empty or already existed)
+ return false;
}
// static
@@ -150,49 +150,49 @@ bool LLFloaterURLEntry::addURLToCombobox(const std::string& media_url)
//-----------------------------------------------------------------------------
void LLFloaterURLEntry::onBtnOK( void* userdata )
{
- LLFloaterURLEntry *self =(LLFloaterURLEntry *)userdata;
-
- std::string media_url = self->mMediaURLEdit->getValue().asString();
- self->mMediaURLEdit->remove(media_url);
- LLURLHistory::removeURL("parcel", media_url);
- if(self->addURLToCombobox(media_url))
- {
- // Add this url to the parcel collection
- LLURLHistory::addURL("parcel", media_url);
- }
-
- // show progress bar here?
- getWindow()->incBusyCount();
- self->getChildView("loading_label")->setVisible( true);
-
- // leading whitespace causes problems with the MIME-type detection so strip it
- LLStringUtil::trim( media_url );
-
- // First check the URL scheme
- LLURI url(media_url);
- std::string scheme = url.scheme();
-
- // We assume that an empty scheme is an http url, as this is how we will treat it.
- if(scheme == "")
- {
- scheme = "https";
- }
-
- if(!media_url.empty() &&
- (scheme == "http" || scheme == "https"))
- {
+ LLFloaterURLEntry *self =(LLFloaterURLEntry *)userdata;
+
+ std::string media_url = self->mMediaURLEdit->getValue().asString();
+ self->mMediaURLEdit->remove(media_url);
+ LLURLHistory::removeURL("parcel", media_url);
+ if(self->addURLToCombobox(media_url))
+ {
+ // Add this url to the parcel collection
+ LLURLHistory::addURL("parcel", media_url);
+ }
+
+ // show progress bar here?
+ getWindow()->incBusyCount();
+ self->getChildView("loading_label")->setVisible( true);
+
+ // leading whitespace causes problems with the MIME-type detection so strip it
+ LLStringUtil::trim( media_url );
+
+ // First check the URL scheme
+ LLURI url(media_url);
+ std::string scheme = url.scheme();
+
+ // We assume that an empty scheme is an http url, as this is how we will treat it.
+ if(scheme == "")
+ {
+ scheme = "https";
+ }
+
+ if(!media_url.empty() &&
+ (scheme == "http" || scheme == "https"))
+ {
LLCoros::instance().launch("LLFloaterURLEntry::getMediaTypeCoro",
boost::bind(&LLFloaterURLEntry::getMediaTypeCoro, media_url, self->getHandle()));
- }
- else
- {
- self->headerFetchComplete(0, scheme);
- }
-
- // Grey the buttons until we get the header response
- self->getChildView("ok_btn")->setEnabled(false);
- self->getChildView("cancel_btn")->setEnabled(false);
- self->getChildView("media_entry")->setEnabled(false);
+ }
+ else
+ {
+ self->headerFetchComplete(0, scheme);
+ }
+
+ // Grey the buttons until we get the header response
+ self->getChildView("ok_btn")->setEnabled(false);
+ self->getChildView("cancel_btn")->setEnabled(false);
+ self->getChildView("media_entry")->setEnabled(false);
self->getChildView("clear_btn")->setEnabled(false);
}
@@ -253,8 +253,8 @@ void LLFloaterURLEntry::getMediaTypeCoro(std::string url, LLHandle<LLFloater> pa
//-----------------------------------------------------------------------------
void LLFloaterURLEntry::onBtnCancel( void* userdata )
{
- LLFloaterURLEntry *self =(LLFloaterURLEntry *)userdata;
- self->closeFloater();
+ LLFloaterURLEntry *self =(LLFloaterURLEntry *)userdata;
+ self->closeFloater();
}
// static
@@ -263,32 +263,32 @@ void LLFloaterURLEntry::onBtnCancel( void* userdata )
//-----------------------------------------------------------------------------
void LLFloaterURLEntry::onBtnClear( void* userdata )
{
- LLNotificationsUtil::add( "ConfirmClearMediaUrlList", LLSD(), LLSD(),
- boost::bind(&LLFloaterURLEntry::callback_clear_url_list, (LLFloaterURLEntry*)userdata, _1, _2) );
+ LLNotificationsUtil::add( "ConfirmClearMediaUrlList", LLSD(), LLSD(),
+ boost::bind(&LLFloaterURLEntry::callback_clear_url_list, (LLFloaterURLEntry*)userdata, _1, _2) );
}
bool LLFloaterURLEntry::callback_clear_url_list(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if ( option == 0 ) // YES
- {
- // clear saved list
- LLCtrlListInterface* url_list = childGetListInterface("media_entry");
- if ( url_list )
- {
- url_list->operateOnAll( LLCtrlListInterface::OP_DELETE );
- }
-
- // clear current contents of combo box
- mMediaURLEdit->clear();
-
- // clear stored version of list
- LLURLHistory::clear("parcel");
-
- // cleared the list so disable Clear button
- getChildView("clear_btn")->setEnabled(false );
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if ( option == 0 ) // YES
+ {
+ // clear saved list
+ LLCtrlListInterface* url_list = childGetListInterface("media_entry");
+ if ( url_list )
+ {
+ url_list->operateOnAll( LLCtrlListInterface::OP_DELETE );
+ }
+
+ // clear current contents of combo box
+ mMediaURLEdit->clear();
+
+ // clear stored version of list
+ LLURLHistory::clear("parcel");
+
+ // cleared the list so disable Clear button
+ getChildView("clear_btn")->setEnabled(false );
+ }
+ return false;
}
void LLFloaterURLEntry::onClose( bool app_quitting )
diff --git a/indra/newview/llfloaterurlentry.h b/indra/newview/llfloaterurlentry.h
index 04a8eca069..8118803422 100644
--- a/indra/newview/llfloaterurlentry.h
+++ b/indra/newview/llfloaterurlentry.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,28 +38,28 @@ class LLComboBox;
class LLFloaterURLEntry : public LLFloater
{
public:
- // Can only be shown by LLPanelLandMedia, and pushes data back into
- // that panel via the handle.
- static LLHandle<LLFloater> show(LLHandle<LLPanel> panel_land_media_handle, const std::string media_url);
- /*virtual*/ BOOL postBuild();
+ // Can only be shown by LLPanelLandMedia, and pushes data back into
+ // that panel via the handle.
+ static LLHandle<LLFloater> show(LLHandle<LLPanel> panel_land_media_handle, const std::string media_url);
+ /*virtual*/ BOOL postBuild();
/*virtual*/ void onClose( bool app_quitting );
- void headerFetchComplete(S32 status, const std::string& mime_type);
+ void headerFetchComplete(S32 status, const std::string& mime_type);
- bool addURLToCombobox(const std::string& media_url);
+ bool addURLToCombobox(const std::string& media_url);
private:
- LLFloaterURLEntry(LLHandle<LLPanel> parent);
- /*virtual*/ ~LLFloaterURLEntry();
- void buildURLHistory();
+ LLFloaterURLEntry(LLHandle<LLPanel> parent);
+ /*virtual*/ ~LLFloaterURLEntry();
+ void buildURLHistory();
private:
- LLComboBox* mMediaURLEdit;
- LLHandle<LLPanel> mPanelLandMediaHandle;
+ LLComboBox* mMediaURLEdit;
+ LLHandle<LLPanel> mPanelLandMediaHandle;
- static void onBtnOK(void*);
- static void onBtnCancel(void*);
- static void onBtnClear(void*);
- bool callback_clear_url_list(const LLSD& notification, const LLSD& response);
+ static void onBtnOK(void*);
+ static void onBtnCancel(void*);
+ static void onBtnClear(void*);
+ bool callback_clear_url_list(const LLSD& notification, const LLSD& response);
static void getMediaTypeCoro(std::string url, LLHandle<LLFloater> parentHandle);
diff --git a/indra/newview/llfloatervoiceeffect.cpp b/indra/newview/llfloatervoiceeffect.cpp
index 227720bee3..4bde73c7ec 100644
--- a/indra/newview/llfloatervoiceeffect.cpp
+++ b/indra/newview/llfloatervoiceeffect.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatervoiceeffect.cpp
* @author Aimee
* @brief Selection and preview of voice effect.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,256 +34,256 @@
#include "llweb.h"
LLFloaterVoiceEffect::LLFloaterVoiceEffect(const LLSD& key)
- : LLFloater(key)
+ : LLFloater(key)
{
- mCommitCallbackRegistrar.add("VoiceEffect.Record", boost::bind(&LLFloaterVoiceEffect::onClickRecord, this));
- mCommitCallbackRegistrar.add("VoiceEffect.Play", boost::bind(&LLFloaterVoiceEffect::onClickPlay, this));
- mCommitCallbackRegistrar.add("VoiceEffect.Stop", boost::bind(&LLFloaterVoiceEffect::onClickStop, this));
-// mCommitCallbackRegistrar.add("VoiceEffect.Activate", boost::bind(&LLFloaterVoiceEffect::onClickActivate, this));
+ mCommitCallbackRegistrar.add("VoiceEffect.Record", boost::bind(&LLFloaterVoiceEffect::onClickRecord, this));
+ mCommitCallbackRegistrar.add("VoiceEffect.Play", boost::bind(&LLFloaterVoiceEffect::onClickPlay, this));
+ mCommitCallbackRegistrar.add("VoiceEffect.Stop", boost::bind(&LLFloaterVoiceEffect::onClickStop, this));
+// mCommitCallbackRegistrar.add("VoiceEffect.Activate", boost::bind(&LLFloaterVoiceEffect::onClickActivate, this));
}
// virtual
LLFloaterVoiceEffect::~LLFloaterVoiceEffect()
{
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interface)
- {
- effect_interface->removeObserver(this);
- }
- }
+ if(LLVoiceClient::instanceExists())
+ {
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interface)
+ {
+ effect_interface->removeObserver(this);
+ }
+ }
}
// virtual
BOOL LLFloaterVoiceEffect::postBuild()
{
- setDefaultBtn("record_btn");
- getChild<LLButton>("record_btn")->setFocus(true);
- getChild<LLUICtrl>("voice_morphing_link")->setTextArg("[URL]", LLTrans::getString("voice_morphing_url"));
-
- mVoiceEffectList = getChild<LLScrollListCtrl>("voice_effect_list");
- if (mVoiceEffectList)
- {
- mVoiceEffectList->setCommitCallback(boost::bind(&LLFloaterVoiceEffect::onClickPlay, this));
-// mVoiceEffectList->setDoubleClickCallback(boost::bind(&LLFloaterVoiceEffect::onClickActivate, this));
- }
-
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interface)
- {
- effect_interface->addObserver(this);
-
- // Disconnect from the current voice channel ready to record a voice sample for previewing
- effect_interface->enablePreviewBuffer(true);
- }
-
- refreshEffectList();
- updateControls();
-
- return TRUE;
+ setDefaultBtn("record_btn");
+ getChild<LLButton>("record_btn")->setFocus(true);
+ getChild<LLUICtrl>("voice_morphing_link")->setTextArg("[URL]", LLTrans::getString("voice_morphing_url"));
+
+ mVoiceEffectList = getChild<LLScrollListCtrl>("voice_effect_list");
+ if (mVoiceEffectList)
+ {
+ mVoiceEffectList->setCommitCallback(boost::bind(&LLFloaterVoiceEffect::onClickPlay, this));
+// mVoiceEffectList->setDoubleClickCallback(boost::bind(&LLFloaterVoiceEffect::onClickActivate, this));
+ }
+
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interface)
+ {
+ effect_interface->addObserver(this);
+
+ // Disconnect from the current voice channel ready to record a voice sample for previewing
+ effect_interface->enablePreviewBuffer(true);
+ }
+
+ refreshEffectList();
+ updateControls();
+
+ return TRUE;
}
// virtual
void LLFloaterVoiceEffect::onClose(bool app_quitting)
{
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interface)
- {
- effect_interface->enablePreviewBuffer(false);
- }
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interface)
+ {
+ effect_interface->enablePreviewBuffer(false);
+ }
}
void LLFloaterVoiceEffect::refreshEffectList()
{
- if (!mVoiceEffectList)
- {
- return;
- }
-
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (!effect_interface)
- {
- mVoiceEffectList->setEnabled(false);
- return;
- }
-
- LL_DEBUGS("Voice")<< "Rebuilding Voice Morph list."<< LL_ENDL;
-
- // Preserve selected items and scroll position
- S32 scroll_pos = mVoiceEffectList->getScrollPos();
- uuid_vec_t selected_items;
- std::vector<LLScrollListItem*> items = mVoiceEffectList->getAllSelected();
- for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++)
- {
- selected_items.push_back((*it)->getUUID());
- }
-
- mVoiceEffectList->deleteAllItems();
-
- {
- // Add the "No Voice Morph" entry
- LLSD element;
-
- element["id"] = LLUUID::null;
- element["columns"][NAME_COLUMN]["column"] = "name";
- element["columns"][NAME_COLUMN]["value"] = getString("no_voice_effect");
- element["columns"][NAME_COLUMN]["font"]["style"] = "BOLD";
-
- LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM);
- // *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :(
- if(sl_item)
- {
- ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(LLFontGL::BOLD);
- }
- }
-
- // Add each Voice Morph template, if there are any (template list includes all usable effects)
- const voice_effect_list_t& template_list = effect_interface->getVoiceEffectTemplateList();
- if (!template_list.empty())
- {
- for (voice_effect_list_t::const_iterator it = template_list.begin(); it != template_list.end(); ++it)
- {
- const LLUUID& effect_id = it->second;
-
- std::string localized_effect = "effect_" + it->first;
- std::string effect_name = hasString(localized_effect) ? getString(localized_effect) : it->first; // XML contains localized effects names
-
- LLSD effect_properties = effect_interface->getVoiceEffectProperties(effect_id);
-
- // Tag the active effect.
- if (effect_id == LLVoiceClient::instance().getVoiceEffectDefault())
- {
- effect_name += " " + getString("active_voice_effect");
- }
-
- // Tag available effects that are new this session
- if (effect_properties["is_new"].asBoolean())
- {
- effect_name += " " + getString("new_voice_effect");
- }
-
- LLDate expiry_date = effect_properties["expiry_date"].asDate();
- bool is_template_only = effect_properties["template_only"].asBoolean();
-
- std::string font_style = "NORMAL";
- if (!is_template_only)
- {
- font_style = "BOLD";
- }
-
- LLSD element;
- element["id"] = effect_id;
-
- element["columns"][NAME_COLUMN]["column"] = "name";
- element["columns"][NAME_COLUMN]["value"] = effect_name;
- element["columns"][NAME_COLUMN]["font"]["style"] = font_style;
-
- element["columns"][1]["column"] = "expires";
- if (!is_template_only)
- {
- element["columns"][DATE_COLUMN]["value"] = expiry_date;
- element["columns"][DATE_COLUMN]["type"] = "date";
- }
- else {
- element["columns"][DATE_COLUMN]["value"] = getString("unsubscribed_voice_effect");
- }
-// element["columns"][DATE_COLUMN]["font"]["style"] = "NORMAL";
-
- LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM);
- // *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :(
- if(sl_item)
- {
- LLFontGL::StyleFlags style = is_template_only ? LLFontGL::NORMAL : LLFontGL::BOLD;
- LLScrollListText* slt = dynamic_cast<LLScrollListText*>(sl_item->getColumn(0));
- llassert(slt);
- if (slt)
- {
- slt->setFontStyle(style);
- }
- }
- }
- }
-
- // Re-select items that were selected before, and restore the scroll position
- for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++)
- {
- mVoiceEffectList->selectByID(*it);
- }
- mVoiceEffectList->setScrollPos(scroll_pos);
- mVoiceEffectList->setEnabled(true);
+ if (!mVoiceEffectList)
+ {
+ return;
+ }
+
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (!effect_interface)
+ {
+ mVoiceEffectList->setEnabled(false);
+ return;
+ }
+
+ LL_DEBUGS("Voice")<< "Rebuilding Voice Morph list."<< LL_ENDL;
+
+ // Preserve selected items and scroll position
+ S32 scroll_pos = mVoiceEffectList->getScrollPos();
+ uuid_vec_t selected_items;
+ std::vector<LLScrollListItem*> items = mVoiceEffectList->getAllSelected();
+ for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++)
+ {
+ selected_items.push_back((*it)->getUUID());
+ }
+
+ mVoiceEffectList->deleteAllItems();
+
+ {
+ // Add the "No Voice Morph" entry
+ LLSD element;
+
+ element["id"] = LLUUID::null;
+ element["columns"][NAME_COLUMN]["column"] = "name";
+ element["columns"][NAME_COLUMN]["value"] = getString("no_voice_effect");
+ element["columns"][NAME_COLUMN]["font"]["style"] = "BOLD";
+
+ LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM);
+ // *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :(
+ if(sl_item)
+ {
+ ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(LLFontGL::BOLD);
+ }
+ }
+
+ // Add each Voice Morph template, if there are any (template list includes all usable effects)
+ const voice_effect_list_t& template_list = effect_interface->getVoiceEffectTemplateList();
+ if (!template_list.empty())
+ {
+ for (voice_effect_list_t::const_iterator it = template_list.begin(); it != template_list.end(); ++it)
+ {
+ const LLUUID& effect_id = it->second;
+
+ std::string localized_effect = "effect_" + it->first;
+ std::string effect_name = hasString(localized_effect) ? getString(localized_effect) : it->first; // XML contains localized effects names
+
+ LLSD effect_properties = effect_interface->getVoiceEffectProperties(effect_id);
+
+ // Tag the active effect.
+ if (effect_id == LLVoiceClient::instance().getVoiceEffectDefault())
+ {
+ effect_name += " " + getString("active_voice_effect");
+ }
+
+ // Tag available effects that are new this session
+ if (effect_properties["is_new"].asBoolean())
+ {
+ effect_name += " " + getString("new_voice_effect");
+ }
+
+ LLDate expiry_date = effect_properties["expiry_date"].asDate();
+ bool is_template_only = effect_properties["template_only"].asBoolean();
+
+ std::string font_style = "NORMAL";
+ if (!is_template_only)
+ {
+ font_style = "BOLD";
+ }
+
+ LLSD element;
+ element["id"] = effect_id;
+
+ element["columns"][NAME_COLUMN]["column"] = "name";
+ element["columns"][NAME_COLUMN]["value"] = effect_name;
+ element["columns"][NAME_COLUMN]["font"]["style"] = font_style;
+
+ element["columns"][1]["column"] = "expires";
+ if (!is_template_only)
+ {
+ element["columns"][DATE_COLUMN]["value"] = expiry_date;
+ element["columns"][DATE_COLUMN]["type"] = "date";
+ }
+ else {
+ element["columns"][DATE_COLUMN]["value"] = getString("unsubscribed_voice_effect");
+ }
+// element["columns"][DATE_COLUMN]["font"]["style"] = "NORMAL";
+
+ LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM);
+ // *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :(
+ if(sl_item)
+ {
+ LLFontGL::StyleFlags style = is_template_only ? LLFontGL::NORMAL : LLFontGL::BOLD;
+ LLScrollListText* slt = dynamic_cast<LLScrollListText*>(sl_item->getColumn(0));
+ llassert(slt);
+ if (slt)
+ {
+ slt->setFontStyle(style);
+ }
+ }
+ }
+ }
+
+ // Re-select items that were selected before, and restore the scroll position
+ for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++)
+ {
+ mVoiceEffectList->selectByID(*it);
+ }
+ mVoiceEffectList->setScrollPos(scroll_pos);
+ mVoiceEffectList->setEnabled(true);
}
void LLFloaterVoiceEffect::updateControls()
{
- bool recording = false;
+ bool recording = false;
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interface)
- {
- recording = effect_interface->isPreviewRecording();
- }
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interface)
+ {
+ recording = effect_interface->isPreviewRecording();
+ }
- getChild<LLButton>("record_btn")->setVisible(!recording);
- getChild<LLButton>("record_stop_btn")->setVisible(recording);
+ getChild<LLButton>("record_btn")->setVisible(!recording);
+ getChild<LLButton>("record_stop_btn")->setVisible(recording);
}
// virtual
void LLFloaterVoiceEffect::onVoiceEffectChanged(bool effect_list_updated)
{
- if (effect_list_updated)
- {
- refreshEffectList();
- }
- updateControls();
+ if (effect_list_updated)
+ {
+ refreshEffectList();
+ }
+ updateControls();
}
void LLFloaterVoiceEffect::onClickRecord()
{
- LL_DEBUGS("Voice") << "Record clicked" << LL_ENDL;
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interface)
- {
- effect_interface->recordPreviewBuffer();
- }
- updateControls();
+ LL_DEBUGS("Voice") << "Record clicked" << LL_ENDL;
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interface)
+ {
+ effect_interface->recordPreviewBuffer();
+ }
+ updateControls();
}
void LLFloaterVoiceEffect::onClickPlay()
{
- LL_DEBUGS("Voice") << "Play clicked" << LL_ENDL;
- if (!mVoiceEffectList)
- {
- return;
- }
-
- const LLUUID& effect_id = mVoiceEffectList->getCurrentID();
-
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interface)
- {
- effect_interface->playPreviewBuffer(effect_id);
- }
- updateControls();
+ LL_DEBUGS("Voice") << "Play clicked" << LL_ENDL;
+ if (!mVoiceEffectList)
+ {
+ return;
+ }
+
+ const LLUUID& effect_id = mVoiceEffectList->getCurrentID();
+
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interface)
+ {
+ effect_interface->playPreviewBuffer(effect_id);
+ }
+ updateControls();
}
void LLFloaterVoiceEffect::onClickStop()
{
- LL_DEBUGS("Voice") << "Stop clicked" << LL_ENDL;
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interface)
- {
- effect_interface->stopPreviewBuffer();
- }
- updateControls();
+ LL_DEBUGS("Voice") << "Stop clicked" << LL_ENDL;
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interface)
+ {
+ effect_interface->stopPreviewBuffer();
+ }
+ updateControls();
}
//void LLFloaterVoiceEffect::onClickActivate()
//{
-// LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
-// if (effect_interface && mVoiceEffectList)
-// {
-// effect_interface->setVoiceEffect(mVoiceEffectList->getCurrentID());
-// }
+// LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+// if (effect_interface && mVoiceEffectList)
+// {
+// effect_interface->setVoiceEffect(mVoiceEffectList->getCurrentID());
+// }
//}
diff --git a/indra/newview/llfloatervoiceeffect.h b/indra/newview/llfloatervoiceeffect.h
index 4d432c46cc..f45c46dcd9 100644
--- a/indra/newview/llfloatervoiceeffect.h
+++ b/indra/newview/llfloatervoiceeffect.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloatervoiceeffect.h
* @author Aimee
* @brief Selection and preview of voice effects.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,38 +35,38 @@ class LLButton;
class LLScrollListCtrl;
class LLFloaterVoiceEffect
- : public LLFloater
- , public LLVoiceEffectObserver
+ : public LLFloater
+ , public LLVoiceEffectObserver
{
public:
- LOG_CLASS(LLFloaterVoiceEffect);
+ LOG_CLASS(LLFloaterVoiceEffect);
- LLFloaterVoiceEffect(const LLSD& key);
- virtual ~LLFloaterVoiceEffect();
+ LLFloaterVoiceEffect(const LLSD& key);
+ virtual ~LLFloaterVoiceEffect();
- virtual BOOL postBuild();
- virtual void onClose(bool app_quitting);
+ virtual BOOL postBuild();
+ virtual void onClose(bool app_quitting);
private:
- enum ColumnIndex
- {
- NAME_COLUMN = 0,
- DATE_COLUMN = 1,
- };
+ enum ColumnIndex
+ {
+ NAME_COLUMN = 0,
+ DATE_COLUMN = 1,
+ };
- void refreshEffectList();
- void updateControls();
+ void refreshEffectList();
+ void updateControls();
- /// Called by voice effect provider when voice effect list is changed.
- virtual void onVoiceEffectChanged(bool effect_list_updated);
+ /// Called by voice effect provider when voice effect list is changed.
+ virtual void onVoiceEffectChanged(bool effect_list_updated);
- void onClickRecord();
- void onClickPlay();
- void onClickStop();
-// void onClickActivate();
+ void onClickRecord();
+ void onClickPlay();
+ void onClickStop();
+// void onClickActivate();
- LLUUID mSelectedID;
- LLScrollListCtrl* mVoiceEffectList;
+ LLUUID mSelectedID;
+ LLScrollListCtrl* mVoiceEffectList;
};
#endif
diff --git a/indra/newview/llfloatervoicevolume.cpp b/indra/newview/llfloatervoicevolume.cpp
index 23f19dd5aa..ec1a09f877 100644
--- a/indra/newview/llfloatervoicevolume.cpp
+++ b/indra/newview/llfloatervoicevolume.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloatervoicevolume.cpp
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,67 +52,67 @@ class LLAvatarName;
// the 3D world.
class LLFloaterVoiceVolume : public LLInspect, LLTransientFloater
{
- friend class LLFloaterReg;
-
+ friend class LLFloaterReg;
+
public:
- // avatar_id - Avatar ID for which to show information
- // Inspector will be positioned relative to current mouse position
- LLFloaterVoiceVolume(const LLSD& avatar_id);
- virtual ~LLFloaterVoiceVolume();
-
- /*virtual*/ BOOL postBuild(void);
-
- // Because floater is single instance, need to re-parse data on each spawn
- // (for example, inspector about same avatar but in different position)
- /*virtual*/ void onOpen(const LLSD& avatar_id);
-
- /*virtual*/ LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; }
+ // avatar_id - Avatar ID for which to show information
+ // Inspector will be positioned relative to current mouse position
+ LLFloaterVoiceVolume(const LLSD& avatar_id);
+ virtual ~LLFloaterVoiceVolume();
+
+ /*virtual*/ BOOL postBuild(void);
+
+ // Because floater is single instance, need to re-parse data on each spawn
+ // (for example, inspector about same avatar but in different position)
+ /*virtual*/ void onOpen(const LLSD& avatar_id);
+
+ /*virtual*/ LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; }
private:
- // Set the volume slider to this user's current client-side volume setting,
- // hiding/disabling if the user is not nearby.
- void updateVolumeControls();
-
- void onClickMuteVolume();
- void onVolumeChange(const LLSD& data);
- void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
-
+ // Set the volume slider to this user's current client-side volume setting,
+ // hiding/disabling if the user is not nearby.
+ void updateVolumeControls();
+
+ void onClickMuteVolume();
+ void onVolumeChange(const LLSD& data);
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
+
private:
- LLUUID mAvatarID;
- // Need avatar name information to spawn friend add request
- LLAvatarName mAvatarName;
- boost::signals2::connection mAvatarNameCacheConnection;
+ LLUUID mAvatarID;
+ // Need avatar name information to spawn friend add request
+ LLAvatarName mAvatarName;
+ boost::signals2::connection mAvatarNameCacheConnection;
};
LLFloaterVoiceVolume::LLFloaterVoiceVolume(const LLSD& sd)
-: LLInspect(LLSD()) // single_instance, doesn't really need key
-, mAvatarID() // set in onOpen() *Note: we used to show partner's name but we dont anymore --angela 3rd Dec*
-, mAvatarName()
+: LLInspect(LLSD()) // single_instance, doesn't really need key
+, mAvatarID() // set in onOpen() *Note: we used to show partner's name but we dont anymore --angela 3rd Dec*
+, mAvatarName()
, mAvatarNameCacheConnection()
{
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this);
- LLTransientFloater::init(this);
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this);
+ LLTransientFloater::init(this);
}
LLFloaterVoiceVolume::~LLFloaterVoiceVolume()
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- LLTransientFloaterMgr::getInstance()->removeControlView(this);
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ LLTransientFloaterMgr::getInstance()->removeControlView(this);
}
/*virtual*/
BOOL LLFloaterVoiceVolume::postBuild(void)
{
- getChild<LLUICtrl>("mute_btn")->setCommitCallback(
- boost::bind(&LLFloaterVoiceVolume::onClickMuteVolume, this) );
+ getChild<LLUICtrl>("mute_btn")->setCommitCallback(
+ boost::bind(&LLFloaterVoiceVolume::onClickMuteVolume, this) );
- getChild<LLUICtrl>("volume_slider")->setCommitCallback(
- boost::bind(&LLFloaterVoiceVolume::onVolumeChange, this, _2));
+ getChild<LLUICtrl>("volume_slider")->setCommitCallback(
+ boost::bind(&LLFloaterVoiceVolume::onVolumeChange, this, _2));
- return TRUE;
+ return TRUE;
}
@@ -121,93 +121,93 @@ BOOL LLFloaterVoiceVolume::postBuild(void)
//virtual
void LLFloaterVoiceVolume::onOpen(const LLSD& data)
{
- // Start open animation
- LLInspect::onOpen(data);
+ // Start open animation
+ LLInspect::onOpen(data);
- // Extract appropriate avatar id
- mAvatarID = data["avatar_id"];
+ // Extract appropriate avatar id
+ mAvatarID = data["avatar_id"];
- LLInspect::repositionInspector(data);
+ LLInspect::repositionInspector(data);
- getChild<LLUICtrl>("avatar_name")->setValue("");
- updateVolumeControls();
+ getChild<LLUICtrl>("avatar_name")->setValue("");
+ updateVolumeControls();
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarID, boost::bind(&LLFloaterVoiceVolume::onAvatarNameCache, this, _1, _2));
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarID, boost::bind(&LLFloaterVoiceVolume::onAvatarNameCache, this, _1, _2));
}
void LLFloaterVoiceVolume::updateVolumeControls()
{
- bool voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled(mAvatarID);
-
- LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn");
- LLUICtrl* volume_slider = getChild<LLUICtrl>("volume_slider");
-
- // Do not display volume slider and mute button if it
- // is ourself or we are not in a voice channel together
- if (!voice_enabled || (mAvatarID == gAgent.getID()))
- {
- mute_btn->setVisible(false);
- volume_slider->setVisible(false);
- }
- else
- {
- mute_btn->setVisible(true);
- volume_slider->setVisible(true);
-
- // By convention, we only display and toggle voice mutes, not all mutes
- bool is_muted = LLAvatarActions::isVoiceMuted(mAvatarID);
- bool is_linden = LLStringUtil::endsWith(mAvatarName.getUserName(), " Linden");
-
- mute_btn->setEnabled(!is_linden);
- mute_btn->setValue(is_muted);
-
- volume_slider->setEnabled(!is_muted);
-
- F32 volume;
- if (is_muted)
- {
- // it's clearer to display their volume as zero
- volume = 0.f;
- }
- else
- {
- // actual volume
- volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID);
- }
- volume_slider->setValue((F64)volume);
- }
+ bool voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled(mAvatarID);
+
+ LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn");
+ LLUICtrl* volume_slider = getChild<LLUICtrl>("volume_slider");
+
+ // Do not display volume slider and mute button if it
+ // is ourself or we are not in a voice channel together
+ if (!voice_enabled || (mAvatarID == gAgent.getID()))
+ {
+ mute_btn->setVisible(false);
+ volume_slider->setVisible(false);
+ }
+ else
+ {
+ mute_btn->setVisible(true);
+ volume_slider->setVisible(true);
+
+ // By convention, we only display and toggle voice mutes, not all mutes
+ bool is_muted = LLAvatarActions::isVoiceMuted(mAvatarID);
+ bool is_linden = LLStringUtil::endsWith(mAvatarName.getUserName(), " Linden");
+
+ mute_btn->setEnabled(!is_linden);
+ mute_btn->setValue(is_muted);
+
+ volume_slider->setEnabled(!is_muted);
+
+ F32 volume;
+ if (is_muted)
+ {
+ // it's clearer to display their volume as zero
+ volume = 0.f;
+ }
+ else
+ {
+ // actual volume
+ volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID);
+ }
+ volume_slider->setValue((F64)volume);
+ }
}
void LLFloaterVoiceVolume::onClickMuteVolume()
{
- LLAvatarActions::toggleMuteVoice(mAvatarID);
- updateVolumeControls();
+ LLAvatarActions::toggleMuteVoice(mAvatarID);
+ updateVolumeControls();
}
void LLFloaterVoiceVolume::onVolumeChange(const LLSD& data)
{
- F32 volume = (F32)data.asReal();
- LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume);
+ F32 volume = (F32)data.asReal();
+ LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume);
}
void LLFloaterVoiceVolume::onAvatarNameCache(
- const LLUUID& agent_id,
- const LLAvatarName& av_name)
+ const LLUUID& agent_id,
+ const LLAvatarName& av_name)
{
- mAvatarNameCacheConnection.disconnect();
+ mAvatarNameCacheConnection.disconnect();
- if (agent_id != mAvatarID)
- {
- return;
- }
+ if (agent_id != mAvatarID)
+ {
+ return;
+ }
- getChild<LLUICtrl>("avatar_name")->setValue(av_name.getCompleteName());
- mAvatarName = av_name;
+ getChild<LLUICtrl>("avatar_name")->setValue(av_name.getCompleteName());
+ mAvatarName = av_name;
}
//////////////////////////////////////////////////////////////////////////////
@@ -215,6 +215,6 @@ void LLFloaterVoiceVolume::onAvatarNameCache(
//////////////////////////////////////////////////////////////////////////////
void LLFloaterVoiceVolumeUtil::registerFloater()
{
- LLFloaterReg::add("floater_voice_volume", "floater_voice_volume.xml",
- &LLFloaterReg::build<LLFloaterVoiceVolume>);
+ LLFloaterReg::add("floater_voice_volume", "floater_voice_volume.xml",
+ &LLFloaterReg::build<LLFloaterVoiceVolume>);
}
diff --git a/indra/newview/llfloatervoicevolume.h b/indra/newview/llfloatervoicevolume.h
index 8fcf7f250b..087eb52df8 100644
--- a/indra/newview/llfloatervoicevolume.h
+++ b/indra/newview/llfloatervoicevolume.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloatervoicevolume.h
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,8 +28,8 @@
namespace LLFloaterVoiceVolumeUtil
{
- // Register with LLFloaterReg
- void registerFloater();
+ // Register with LLFloaterReg
+ void registerFloater();
}
#endif // LL_LLFLOATERVOICEVOLUME_H
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index ceab472c55..71f1181566 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -42,342 +42,342 @@
#include "llfloaterwebcontent.h"
LLFloaterWebContent::_Params::_Params()
-: url("url"),
- target("target"),
- id("id"),
- window_class("window_class", "web_content"),
- show_chrome("show_chrome", true),
+: url("url"),
+ target("target"),
+ id("id"),
+ window_class("window_class", "web_content"),
+ show_chrome("show_chrome", true),
allow_address_entry("allow_address_entry", true),
allow_back_forward_navigation("allow_back_forward_navigation", true),
- preferred_media_size("preferred_media_size"),
- trusted_content("trusted_content", false),
- show_page_title("show_page_title", true),
- clean_browser("clean_browser", false),
- dev_mode("dev_mode", false)
+ preferred_media_size("preferred_media_size"),
+ trusted_content("trusted_content", false),
+ show_page_title("show_page_title", true),
+ clean_browser("clean_browser", false),
+ dev_mode("dev_mode", false)
{}
LLFloaterWebContent::LLFloaterWebContent( const Params& params )
-: LLFloater( params ),
- LLInstanceTracker<LLFloaterWebContent, std::string, LLInstanceTrackerReplaceOnCollision>(params.id()),
- mWebBrowser(NULL),
- mAddressCombo(NULL),
- mSecureLockIcon(NULL),
- mStatusBarText(NULL),
- mStatusBarProgress(NULL),
- mBtnBack(NULL),
- mBtnForward(NULL),
- mBtnReload(NULL),
- mBtnStop(NULL),
- mUUID(params.id()),
- mShowPageTitle(params.show_page_title),
+: LLFloater( params ),
+ LLInstanceTracker<LLFloaterWebContent, std::string, LLInstanceTrackerReplaceOnCollision>(params.id()),
+ mWebBrowser(NULL),
+ mAddressCombo(NULL),
+ mSecureLockIcon(NULL),
+ mStatusBarText(NULL),
+ mStatusBarProgress(NULL),
+ mBtnBack(NULL),
+ mBtnForward(NULL),
+ mBtnReload(NULL),
+ mBtnStop(NULL),
+ mUUID(params.id()),
+ mShowPageTitle(params.show_page_title),
mAllowNavigation(true),
mCurrentURL(""),
mDisplayURL(""),
mDevelopMode(params.dev_mode) // if called from "Develop" Menu, set a flag and change things to be more useful for devs
{
- mCommitCallbackRegistrar.add( "WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this ));
- mCommitCallbackRegistrar.add( "WebContent.Forward", boost::bind( &LLFloaterWebContent::onClickForward, this ));
- mCommitCallbackRegistrar.add( "WebContent.Reload", boost::bind( &LLFloaterWebContent::onClickReload, this ));
- mCommitCallbackRegistrar.add( "WebContent.Stop", boost::bind( &LLFloaterWebContent::onClickStop, this ));
- mCommitCallbackRegistrar.add( "WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this ));
- mCommitCallbackRegistrar.add( "WebContent.PopExternal", boost::bind(&LLFloaterWebContent::onPopExternal, this));
- mCommitCallbackRegistrar.add( "WebContent.TestURL", boost::bind(&LLFloaterWebContent::onTestURL, this, _2));
+ mCommitCallbackRegistrar.add( "WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this ));
+ mCommitCallbackRegistrar.add( "WebContent.Forward", boost::bind( &LLFloaterWebContent::onClickForward, this ));
+ mCommitCallbackRegistrar.add( "WebContent.Reload", boost::bind( &LLFloaterWebContent::onClickReload, this ));
+ mCommitCallbackRegistrar.add( "WebContent.Stop", boost::bind( &LLFloaterWebContent::onClickStop, this ));
+ mCommitCallbackRegistrar.add( "WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this ));
+ mCommitCallbackRegistrar.add( "WebContent.PopExternal", boost::bind(&LLFloaterWebContent::onPopExternal, this));
+ mCommitCallbackRegistrar.add( "WebContent.TestURL", boost::bind(&LLFloaterWebContent::onTestURL, this, _2));
}
BOOL LLFloaterWebContent::postBuild()
{
- // these are used in a bunch of places so cache them
- mWebBrowser = getChild< LLMediaCtrl >( "webbrowser" );
- mAddressCombo = getChild< LLComboBox >( "address" );
- mStatusBarText = getChild< LLTextBox >( "statusbartext" );
- mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress" );
-
- mBtnBack = getChildView( "back" );
- mBtnForward = getChildView( "forward" );
- mBtnReload = getChildView( "reload" );
- mBtnStop = getChildView( "stop" );
-
- // observe browser events
- mWebBrowser->addObserver( this );
-
- // these buttons are always enabled
- mBtnReload->setEnabled( true );
- mBtnReload->setVisible( false );
- getChildView("popexternal")->setEnabled( true );
-
- // cache image for secure browsing
- mSecureLockIcon = getChild< LLIconCtrl >("media_secure_lock_flag");
-
- // initialize the URL history using the system URL History manager
- initializeURLHistory();
-
- return TRUE;
+ // these are used in a bunch of places so cache them
+ mWebBrowser = getChild< LLMediaCtrl >( "webbrowser" );
+ mAddressCombo = getChild< LLComboBox >( "address" );
+ mStatusBarText = getChild< LLTextBox >( "statusbartext" );
+ mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress" );
+
+ mBtnBack = getChildView( "back" );
+ mBtnForward = getChildView( "forward" );
+ mBtnReload = getChildView( "reload" );
+ mBtnStop = getChildView( "stop" );
+
+ // observe browser events
+ mWebBrowser->addObserver( this );
+
+ // these buttons are always enabled
+ mBtnReload->setEnabled( true );
+ mBtnReload->setVisible( false );
+ getChildView("popexternal")->setEnabled( true );
+
+ // cache image for secure browsing
+ mSecureLockIcon = getChild< LLIconCtrl >("media_secure_lock_flag");
+
+ // initialize the URL history using the system URL History manager
+ initializeURLHistory();
+
+ return TRUE;
}
void LLFloaterWebContent::initializeURLHistory()
{
- // start with an empty list
- LLCtrlListInterface* url_list = childGetListInterface("address");
- if (url_list)
- {
- url_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
- }
-
- // Get all of the entries in the "browser" collection
- LLSD browser_history = LLURLHistory::getURLHistory("browser");
- LLSD::array_iterator iter_history = browser_history.beginArray();
- LLSD::array_iterator end_history = browser_history.endArray();
- for(; iter_history != end_history; ++iter_history)
- {
- std::string url = (*iter_history).asString();
- if(! url.empty())
- url_list->addSimpleElement(url);
- }
+ // start with an empty list
+ LLCtrlListInterface* url_list = childGetListInterface("address");
+ if (url_list)
+ {
+ url_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+ }
+
+ // Get all of the entries in the "browser" collection
+ LLSD browser_history = LLURLHistory::getURLHistory("browser");
+ LLSD::array_iterator iter_history = browser_history.beginArray();
+ LLSD::array_iterator end_history = browser_history.endArray();
+ for(; iter_history != end_history; ++iter_history)
+ {
+ std::string url = (*iter_history).asString();
+ if(! url.empty())
+ url_list->addSimpleElement(url);
+ }
}
bool LLFloaterWebContent::matchesKey(const LLSD& key)
{
- Params p(mKey);
- Params other_p(key);
- if (!other_p.target().empty() && other_p.target() != "_blank")
- {
- return other_p.target() == p.target();
- }
- else
- {
- return other_p.id() == p.id();
- }
+ Params p(mKey);
+ Params other_p(key);
+ if (!other_p.target().empty() && other_p.target() != "_blank")
+ {
+ return other_p.target() == p.target();
+ }
+ else
+ {
+ return other_p.id() == p.id();
+ }
}
//static
LLFloater* LLFloaterWebContent::create( Params p)
{
- preCreate(p);
- return new LLFloaterWebContent(p);
+ preCreate(p);
+ return new LLFloaterWebContent(p);
}
//static
void LLFloaterWebContent::closeRequest(const std::string &uuid)
{
- auto floaterp = instance_tracker_t::getInstance(uuid);
- if (floaterp)
- {
- floaterp->closeFloater(false);
- }
+ auto floaterp = instance_tracker_t::getInstance(uuid);
+ if (floaterp)
+ {
+ floaterp->closeFloater(false);
+ }
}
//static
void LLFloaterWebContent::geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height)
{
- auto floaterp = instance_tracker_t::getInstance(uuid);
- if (floaterp)
- {
- floaterp->geometryChanged(x, y, width, height);
- }
+ auto floaterp = instance_tracker_t::getInstance(uuid);
+ if (floaterp)
+ {
+ floaterp->geometryChanged(x, y, width, height);
+ }
}
void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height)
{
- // Make sure the layout of the browser control is updated, so this calculation is correct.
- getChild<LLLayoutStack>("stack1")->updateLayout();
-
- // TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
- LLCoordWindow window_size;
- getWindow()->getSize(&window_size);
-
- // Adjust width and height for the size of the chrome on the web Browser window.
- LLRect browser_rect;
- mWebBrowser->localRectToOtherView(mWebBrowser->getLocalRect(), &browser_rect, this);
-
- S32 requested_browser_bottom = window_size.mY - (y + height);
- LLRect geom;
- geom.setOriginAndSize(x - browser_rect.mLeft,
- requested_browser_bottom - browser_rect.mBottom,
- width + getRect().getWidth() - browser_rect.getWidth(),
- height + getRect().getHeight() - browser_rect.getHeight());
-
- LLRect new_rect;
- getParent()->screenRectToLocal(geom, &new_rect);
- setShape(new_rect);
+ // Make sure the layout of the browser control is updated, so this calculation is correct.
+ getChild<LLLayoutStack>("stack1")->updateLayout();
+
+ // TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
+ LLCoordWindow window_size;
+ getWindow()->getSize(&window_size);
+
+ // Adjust width and height for the size of the chrome on the web Browser window.
+ LLRect browser_rect;
+ mWebBrowser->localRectToOtherView(mWebBrowser->getLocalRect(), &browser_rect, this);
+
+ S32 requested_browser_bottom = window_size.mY - (y + height);
+ LLRect geom;
+ geom.setOriginAndSize(x - browser_rect.mLeft,
+ requested_browser_bottom - browser_rect.mBottom,
+ width + getRect().getWidth() - browser_rect.getWidth(),
+ height + getRect().getHeight() - browser_rect.getHeight());
+
+ LLRect new_rect;
+ getParent()->screenRectToLocal(geom, &new_rect);
+ setShape(new_rect);
}
// static
void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
{
- if (!p.id.isProvided())
- {
- p.id = LLUUID::generateNewID().asString();
- }
-
- if(p.target().empty() || p.target() == "_blank")
- {
- p.target = p.id();
- }
-
- S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
- if(browser_window_limit != 0)
- {
- // showInstance will open a new window. Figure out how many web browsers are already open,
- // and close the least recently opened one if this will put us over the limit.
-
- LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
-
- if(instances.size() >= (size_t)browser_window_limit)
- {
- // Destroy the least recently opened instance
- (*instances.begin())->closeFloater();
- }
- }
+ if (!p.id.isProvided())
+ {
+ p.id = LLUUID::generateNewID().asString();
+ }
+
+ if(p.target().empty() || p.target() == "_blank")
+ {
+ p.target = p.id();
+ }
+
+ S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
+ if(browser_window_limit != 0)
+ {
+ // showInstance will open a new window. Figure out how many web browsers are already open,
+ // and close the least recently opened one if this will put us over the limit.
+
+ LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
+
+ if(instances.size() >= (size_t)browser_window_limit)
+ {
+ // Destroy the least recently opened instance
+ (*instances.begin())->closeFloater();
+ }
+ }
}
void LLFloaterWebContent::open_media(const Params& p)
{
- LLViewerMedia::getInstance()->proxyWindowOpened(p.target(), p.id());
- mWebBrowser->setHomePageUrl(p.url);
- mWebBrowser->setTarget(p.target);
- mWebBrowser->navigateTo(p.url);
-
- set_current_url(p.url);
+ LLViewerMedia::getInstance()->proxyWindowOpened(p.target(), p.id());
+ mWebBrowser->setHomePageUrl(p.url);
+ mWebBrowser->setTarget(p.target);
+ mWebBrowser->navigateTo(p.url);
+
+ set_current_url(p.url);
- getChild<LLLayoutPanel>("status_bar")->setVisible(p.show_chrome);
- getChild<LLLayoutPanel>("nav_controls")->setVisible(p.show_chrome);
+ getChild<LLLayoutPanel>("status_bar")->setVisible(p.show_chrome);
+ getChild<LLLayoutPanel>("nav_controls")->setVisible(p.show_chrome);
- // turn additional debug controls on but only for Develop mode (Develop menu open)
- getChild<LLLayoutPanel>("debug_controls")->setVisible(mDevelopMode);
+ // turn additional debug controls on but only for Develop mode (Develop menu open)
+ getChild<LLLayoutPanel>("debug_controls")->setVisible(mDevelopMode);
- bool address_entry_enabled = p.allow_address_entry && !p.trusted_content;
+ bool address_entry_enabled = p.allow_address_entry && !p.trusted_content;
mAllowNavigation = p.allow_back_forward_navigation;
- getChildView("address")->setEnabled(address_entry_enabled);
- getChildView("popexternal")->setEnabled(address_entry_enabled);
-
- if (!p.show_chrome)
- {
- setResizeLimits(100, 100);
- }
-
- if (!p.preferred_media_size().isEmpty())
- {
- getChild<LLLayoutStack>("stack1")->updateLayout();
- LLRect browser_rect = mWebBrowser->calcScreenRect();
- LLCoordWindow window_size;
- getWindow()->getSize(&window_size);
-
- geometryChanged(browser_rect.mLeft, window_size.mY - browser_rect.mTop, p.preferred_media_size().getWidth(), p.preferred_media_size().getHeight());
- }
+ getChildView("address")->setEnabled(address_entry_enabled);
+ getChildView("popexternal")->setEnabled(address_entry_enabled);
+
+ if (!p.show_chrome)
+ {
+ setResizeLimits(100, 100);
+ }
+
+ if (!p.preferred_media_size().isEmpty())
+ {
+ getChild<LLLayoutStack>("stack1")->updateLayout();
+ LLRect browser_rect = mWebBrowser->calcScreenRect();
+ LLCoordWindow window_size;
+ getWindow()->getSize(&window_size);
+
+ geometryChanged(browser_rect.mLeft, window_size.mY - browser_rect.mTop, p.preferred_media_size().getWidth(), p.preferred_media_size().getHeight());
+ }
}
void LLFloaterWebContent::onOpen(const LLSD& key)
{
- Params params(key);
+ Params params(key);
- if (!params.validateBlock())
- {
- closeFloater();
- return;
- }
+ if (!params.validateBlock())
+ {
+ closeFloater();
+ return;
+ }
- mWebBrowser->setTrustedContent(params.trusted_content);
+ mWebBrowser->setTrustedContent(params.trusted_content);
- // tell the browser instance to load the specified URL
- open_media(params);
+ // tell the browser instance to load the specified URL
+ open_media(params);
}
//virtual
void LLFloaterWebContent::onClose(bool app_quitting)
{
- LLViewerMedia::getInstance()->proxyWindowClosed(mUUID);
- destroy();
+ LLViewerMedia::getInstance()->proxyWindowClosed(mUUID);
+ destroy();
}
// virtual
void LLFloaterWebContent::draw()
{
- // this is asynchronous so we need to keep checking
- mBtnBack->setEnabled( mWebBrowser->canNavigateBack() && mAllowNavigation);
- mBtnForward->setEnabled( mWebBrowser->canNavigateForward() && mAllowNavigation);
+ // this is asynchronous so we need to keep checking
+ mBtnBack->setEnabled( mWebBrowser->canNavigateBack() && mAllowNavigation);
+ mBtnForward->setEnabled( mWebBrowser->canNavigateForward() && mAllowNavigation);
- LLFloater::draw();
+ LLFloater::draw();
}
// virtual
void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
{
- if(event == MEDIA_EVENT_LOCATION_CHANGED)
- {
- const std::string url = self->getLocation();
-
- if ( url.length() )
- mStatusBarText->setText( url );
-
- set_current_url( url );
- }
- else if(event == MEDIA_EVENT_NAVIGATE_BEGIN)
- {
- // flags are sent with this event
- mBtnBack->setEnabled( self->getHistoryBackAvailable() );
- mBtnForward->setEnabled( self->getHistoryForwardAvailable() );
-
- // toggle visibility of these buttons based on browser state
- mBtnReload->setVisible( false );
- mBtnStop->setVisible( true );
-
- // turn "on" progress bar now we're about to start loading
- mStatusBarProgress->setVisible( true );
- }
- else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
- {
- // flags are sent with this event
- mBtnBack->setEnabled( self->getHistoryBackAvailable() );
- mBtnForward->setEnabled( self->getHistoryForwardAvailable() );
-
- // toggle visibility of these buttons based on browser state
- mBtnReload->setVisible( true );
- mBtnStop->setVisible( false );
-
- // turn "off" progress bar now we're loaded
- mStatusBarProgress->setVisible( false );
-
- // we populate the status bar with URLs as they change so clear it now we're done
- const std::string end_str = "";
- mStatusBarText->setText( end_str );
- }
- else if(event == MEDIA_EVENT_CLOSE_REQUEST)
- {
- // The browser instance wants its window closed.
- closeFloater();
- }
- else if(event == MEDIA_EVENT_STATUS_TEXT_CHANGED )
- {
- const std::string text = self->getStatusText();
- if ( text.length() )
- mStatusBarText->setText( text );
- }
- else if(event == MEDIA_EVENT_PROGRESS_UPDATED )
- {
- int percent = (int)self->getProgressPercent();
- mStatusBarProgress->setValue( percent );
- }
- else if(event == MEDIA_EVENT_NAME_CHANGED )
- {
- // flags are sent with this event
- mBtnBack->setEnabled(self->getHistoryBackAvailable());
- mBtnForward->setEnabled(self->getHistoryForwardAvailable());
- std::string page_title = self->getMediaName();
- // simulate browser behavior - title is empty, use the current URL
- if (mShowPageTitle)
- {
- if ( page_title.length() > 0 )
- setTitle( page_title );
- else
- setTitle( mCurrentURL );
- }
- }
- else if(event == MEDIA_EVENT_LINK_HOVERED )
- {
- const std::string link = self->getHoverLink();
- mStatusBarText->setText( link );
- }
+ if(event == MEDIA_EVENT_LOCATION_CHANGED)
+ {
+ const std::string url = self->getLocation();
+
+ if ( url.length() )
+ mStatusBarText->setText( url );
+
+ set_current_url( url );
+ }
+ else if(event == MEDIA_EVENT_NAVIGATE_BEGIN)
+ {
+ // flags are sent with this event
+ mBtnBack->setEnabled( self->getHistoryBackAvailable() );
+ mBtnForward->setEnabled( self->getHistoryForwardAvailable() );
+
+ // toggle visibility of these buttons based on browser state
+ mBtnReload->setVisible( false );
+ mBtnStop->setVisible( true );
+
+ // turn "on" progress bar now we're about to start loading
+ mStatusBarProgress->setVisible( true );
+ }
+ else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
+ {
+ // flags are sent with this event
+ mBtnBack->setEnabled( self->getHistoryBackAvailable() );
+ mBtnForward->setEnabled( self->getHistoryForwardAvailable() );
+
+ // toggle visibility of these buttons based on browser state
+ mBtnReload->setVisible( true );
+ mBtnStop->setVisible( false );
+
+ // turn "off" progress bar now we're loaded
+ mStatusBarProgress->setVisible( false );
+
+ // we populate the status bar with URLs as they change so clear it now we're done
+ const std::string end_str = "";
+ mStatusBarText->setText( end_str );
+ }
+ else if(event == MEDIA_EVENT_CLOSE_REQUEST)
+ {
+ // The browser instance wants its window closed.
+ closeFloater();
+ }
+ else if(event == MEDIA_EVENT_STATUS_TEXT_CHANGED )
+ {
+ const std::string text = self->getStatusText();
+ if ( text.length() )
+ mStatusBarText->setText( text );
+ }
+ else if(event == MEDIA_EVENT_PROGRESS_UPDATED )
+ {
+ int percent = (int)self->getProgressPercent();
+ mStatusBarProgress->setValue( percent );
+ }
+ else if(event == MEDIA_EVENT_NAME_CHANGED )
+ {
+ // flags are sent with this event
+ mBtnBack->setEnabled(self->getHistoryBackAvailable());
+ mBtnForward->setEnabled(self->getHistoryForwardAvailable());
+ std::string page_title = self->getMediaName();
+ // simulate browser behavior - title is empty, use the current URL
+ if (mShowPageTitle)
+ {
+ if ( page_title.length() > 0 )
+ setTitle( page_title );
+ else
+ setTitle( mCurrentURL );
+ }
+ }
+ else if(event == MEDIA_EVENT_LINK_HOVERED )
+ {
+ const std::string link = self->getHoverLink();
+ mStatusBarText->setText( link );
+ }
}
void LLFloaterWebContent::set_current_url(const std::string& url)
@@ -399,14 +399,14 @@ void LLFloaterWebContent::set_current_url(const std::string& url)
LLURLHistory::removeURL("browser", mCurrentURL);
LLURLHistory::addURL("browser", mCurrentURL);
- // Check if this is a secure URL
- static const std::string secure_prefix = std::string("https://");
- std::string prefix = mCurrentURL.substr(0, secure_prefix.length());
- LLStringUtil::toLower(prefix);
+ // Check if this is a secure URL
+ static const std::string secure_prefix = std::string("https://");
+ std::string prefix = mCurrentURL.substr(0, secure_prefix.length());
+ LLStringUtil::toLower(prefix);
bool secure_url = (prefix == secure_prefix);
- mSecureLockIcon->setVisible(secure_url);
- mAddressCombo->setLeftTextPadding(secure_url ? 22 : 2);
- mDisplayURL = mCurrentURL;
+ mSecureLockIcon->setVisible(secure_url);
+ mAddressCombo->setLeftTextPadding(secure_url ? 22 : 2);
+ mDisplayURL = mCurrentURL;
// Clean up browsing list (prevent dupes) and add/select the new URL to it
mAddressCombo->remove(mCurrentURL);
@@ -417,69 +417,69 @@ void LLFloaterWebContent::set_current_url(const std::string& url)
void LLFloaterWebContent::onClickForward()
{
- mWebBrowser->navigateForward();
+ mWebBrowser->navigateForward();
}
void LLFloaterWebContent::onClickBack()
{
- mWebBrowser->navigateBack();
+ mWebBrowser->navigateBack();
}
void LLFloaterWebContent::onClickReload()
{
- if( mWebBrowser->getMediaPlugin() )
- {
- bool ignore_cache = true;
- mWebBrowser->getMediaPlugin()->browse_reload( ignore_cache );
- }
- else
- {
- mWebBrowser->navigateTo(mCurrentURL);
- }
+ if( mWebBrowser->getMediaPlugin() )
+ {
+ bool ignore_cache = true;
+ mWebBrowser->getMediaPlugin()->browse_reload( ignore_cache );
+ }
+ else
+ {
+ mWebBrowser->navigateTo(mCurrentURL);
+ }
}
void LLFloaterWebContent::onClickStop()
{
- if( mWebBrowser->getMediaPlugin() )
- mWebBrowser->getMediaPlugin()->browse_stop();
-
- // still should happen when we catch the navigate complete event
- // but sometimes (don't know why) that event isn't sent from Qt
- // and we ghetto a point where the stop button stays active.
- mBtnReload->setVisible( true );
- mBtnStop->setVisible( false );
+ if( mWebBrowser->getMediaPlugin() )
+ mWebBrowser->getMediaPlugin()->browse_stop();
+
+ // still should happen when we catch the navigate complete event
+ // but sometimes (don't know why) that event isn't sent from Qt
+ // and we ghetto a point where the stop button stays active.
+ mBtnReload->setVisible( true );
+ mBtnStop->setVisible( false );
}
void LLFloaterWebContent::onEnterAddress()
{
- // make sure there is at least something there.
- // (perhaps this test should be for minimum length of a URL)
- std::string url = mAddressCombo->getValue().asString();
+ // make sure there is at least something there.
+ // (perhaps this test should be for minimum length of a URL)
+ std::string url = mAddressCombo->getValue().asString();
LLStringUtil::trim(url);
- if ( url.length() > 0 )
- {
- mWebBrowser->navigateTo(url);
- };
+ if ( url.length() > 0 )
+ {
+ mWebBrowser->navigateTo(url);
+ };
}
void LLFloaterWebContent::onPopExternal()
{
- // make sure there is at least something there.
- // (perhaps this test should be for minimum length of a URL)
- std::string url = mAddressCombo->getValue().asString();
- LLStringUtil::trim(url);
- if (url.length() > 0)
- {
- LLWeb::loadURLExternal(url);
- };
+ // make sure there is at least something there.
+ // (perhaps this test should be for minimum length of a URL)
+ std::string url = mAddressCombo->getValue().asString();
+ LLStringUtil::trim(url);
+ if (url.length() > 0)
+ {
+ LLWeb::loadURLExternal(url);
+ };
}
void LLFloaterWebContent::onTestURL(std::string url)
{
- LLStringUtil::trim(url);
- if (url.length() > 0)
- {
- mWebBrowser->navigateTo(url);
- };
+ LLStringUtil::trim(url);
+ if (url.length() > 0)
+ {
+ mWebBrowser->navigateTo(url);
+ };
}
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h
index 0bf93504c2..e4f8cf4279 100644
--- a/indra/newview/llfloaterwebcontent.h
+++ b/indra/newview/llfloaterwebcontent.h
@@ -38,84 +38,84 @@ class LLProgressBar;
class LLIconCtrl;
class LLFloaterWebContent :
- public LLFloater,
- public LLViewerMediaObserver,
- public LLInstanceTracker<LLFloaterWebContent, std::string, LLInstanceTrackerReplaceOnCollision>
+ public LLFloater,
+ public LLViewerMediaObserver,
+ public LLInstanceTracker<LLFloaterWebContent, std::string, LLInstanceTrackerReplaceOnCollision>
{
public:
- typedef LLInstanceTracker<LLFloaterWebContent, std::string, LLInstanceTrackerReplaceOnCollision> instance_tracker_t;
+ typedef LLInstanceTracker<LLFloaterWebContent, std::string, LLInstanceTrackerReplaceOnCollision> instance_tracker_t;
LOG_CLASS(LLFloaterWebContent);
- struct _Params : public LLInitParam::Block<_Params>
- {
- Optional<std::string> url,
- target,
- window_class,
- id;
- Optional<bool> show_chrome,
- allow_address_entry,
+ struct _Params : public LLInitParam::Block<_Params>
+ {
+ Optional<std::string> url,
+ target,
+ window_class,
+ id;
+ Optional<bool> show_chrome,
+ allow_address_entry,
allow_back_forward_navigation,
- trusted_content,
- show_page_title,
- clean_browser,
- dev_mode;
- Optional<LLRect> preferred_media_size;
+ trusted_content,
+ show_page_title,
+ clean_browser,
+ dev_mode;
+ Optional<LLRect> preferred_media_size;
- _Params();
- };
+ _Params();
+ };
- typedef LLSDParamAdapter<_Params> Params;
+ typedef LLSDParamAdapter<_Params> Params;
- LLFloaterWebContent(const Params& params);
+ LLFloaterWebContent(const Params& params);
- void initializeURLHistory();
+ void initializeURLHistory();
- static LLFloater* create(Params);
+ static LLFloater* create(Params);
- static void closeRequest(const std::string &uuid);
- static void geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height);
- void geometryChanged(S32 x, S32 y, S32 width, S32 height);
+ static void closeRequest(const std::string &uuid);
+ static void geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height);
+ void geometryChanged(S32 x, S32 y, S32 width, S32 height);
- /* virtual */ BOOL postBuild();
- /* virtual */ void onOpen(const LLSD& key);
- /* virtual */ bool matchesKey(const LLSD& key);
- /* virtual */ void onClose(bool app_quitting);
- /* virtual */ void draw();
+ /* virtual */ BOOL postBuild();
+ /* virtual */ void onOpen(const LLSD& key);
+ /* virtual */ bool matchesKey(const LLSD& key);
+ /* virtual */ void onClose(bool app_quitting);
+ /* virtual */ void draw();
protected:
- // inherited from LLViewerMediaObserver
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
-
- void onClickBack();
- void onClickForward();
- void onClickReload();
- void onClickStop();
- void onEnterAddress();
- void onPopExternal();
- void onTestURL(std::string url);
-
- static void preCreate(Params& p);
- void open_media(const Params& );
- void set_current_url(const std::string& url);
-
- LLMediaCtrl* mWebBrowser;
- LLComboBox* mAddressCombo;
- LLIconCtrl* mSecureLockIcon;
- LLTextBox* mStatusBarText;
- LLProgressBar* mStatusBarProgress;
-
- LLView* mBtnBack;
- LLView* mBtnForward;
- LLView* mBtnReload;
- LLView* mBtnStop;
-
- std::string mCurrentURL; // Current URL
- std::string mDisplayURL; // URL being displayed in the address bar (can differ by trailing / leading space)
- std::string mUUID;
- bool mShowPageTitle;
+ // inherited from LLViewerMediaObserver
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+
+ void onClickBack();
+ void onClickForward();
+ void onClickReload();
+ void onClickStop();
+ void onEnterAddress();
+ void onPopExternal();
+ void onTestURL(std::string url);
+
+ static void preCreate(Params& p);
+ void open_media(const Params& );
+ void set_current_url(const std::string& url);
+
+ LLMediaCtrl* mWebBrowser;
+ LLComboBox* mAddressCombo;
+ LLIconCtrl* mSecureLockIcon;
+ LLTextBox* mStatusBarText;
+ LLProgressBar* mStatusBarProgress;
+
+ LLView* mBtnBack;
+ LLView* mBtnForward;
+ LLView* mBtnReload;
+ LLView* mBtnStop;
+
+ std::string mCurrentURL; // Current URL
+ std::string mDisplayURL; // URL being displayed in the address bar (can differ by trailing / leading space)
+ std::string mUUID;
+ bool mShowPageTitle;
bool mAllowNavigation;
- bool mDevelopMode;
+ bool mDevelopMode;
};
#endif // LL_LLFLOATERWEBCONTENT_H
diff --git a/indra/newview/llfloaterwhitelistentry.cpp b/indra/newview/llfloaterwhitelistentry.cpp
index 2a499f681b..d0ad176625 100644
--- a/indra/newview/llfloaterwhitelistentry.cpp
+++ b/indra/newview/llfloaterwhitelistentry.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,7 +39,7 @@
///////////////////////////////////////////////////////////////////////////////
//
LLFloaterWhiteListEntry::LLFloaterWhiteListEntry( const LLSD& key ) :
- LLFloater(key)
+ LLFloater(key)
{
}
@@ -53,39 +53,39 @@ LLFloaterWhiteListEntry::~LLFloaterWhiteListEntry()
//
BOOL LLFloaterWhiteListEntry::postBuild()
{
- mWhiteListEdit = getChild<LLLineEditor>("whitelist_entry");
+ mWhiteListEdit = getChild<LLLineEditor>("whitelist_entry");
- childSetAction("cancel_btn", onBtnCancel, this);
- childSetAction("ok_btn", onBtnOK, this);
+ childSetAction("cancel_btn", onBtnCancel, this);
+ childSetAction("ok_btn", onBtnOK, this);
- setDefaultBtn("ok_btn");
+ setDefaultBtn("ok_btn");
- return TRUE;
+ return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// static
void LLFloaterWhiteListEntry::onBtnOK( void* userdata )
{
- LLFloaterWhiteListEntry *self =(LLFloaterWhiteListEntry *)userdata;
+ LLFloaterWhiteListEntry *self =(LLFloaterWhiteListEntry *)userdata;
+
+ LLPanelMediaSettingsSecurity* panel = LLFloaterReg::getTypedInstance<LLFloaterMediaSettings>("media_settings")->getPanelSecurity();
+ if ( panel )
+ {
+ std::string white_list_item = self->mWhiteListEdit->getText();
- LLPanelMediaSettingsSecurity* panel = LLFloaterReg::getTypedInstance<LLFloaterMediaSettings>("media_settings")->getPanelSecurity();
- if ( panel )
- {
- std::string white_list_item = self->mWhiteListEdit->getText();
+ panel->addWhiteListEntry( white_list_item );
+ panel->updateWhitelistEnableStatus();
+ };
- panel->addWhiteListEntry( white_list_item );
- panel->updateWhitelistEnableStatus();
- };
-
- self->closeFloater();
+ self->closeFloater();
}
///////////////////////////////////////////////////////////////////////////////
// static
void LLFloaterWhiteListEntry::onBtnCancel( void* userdata )
{
- LLFloaterWhiteListEntry *self =(LLFloaterWhiteListEntry *)userdata;
-
- self->closeFloater();
+ LLFloaterWhiteListEntry *self =(LLFloaterWhiteListEntry *)userdata;
+
+ self->closeFloater();
}
diff --git a/indra/newview/llfloaterwhitelistentry.h b/indra/newview/llfloaterwhitelistentry.h
index deab49c523..9e4e6b381c 100644
--- a/indra/newview/llfloaterwhitelistentry.h
+++ b/indra/newview/llfloaterwhitelistentry.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,20 +31,20 @@
class LLLineEditor;
-class LLFloaterWhiteListEntry :
- public LLFloater
+class LLFloaterWhiteListEntry :
+ public LLFloater
{
- public:
- LLFloaterWhiteListEntry(const LLSD& key);
- ~LLFloaterWhiteListEntry();
-
- BOOL postBuild();
+ public:
+ LLFloaterWhiteListEntry(const LLSD& key);
+ ~LLFloaterWhiteListEntry();
+
+ BOOL postBuild();
- private:
- LLLineEditor* mWhiteListEdit;
+ private:
+ LLLineEditor* mWhiteListEdit;
- static void onBtnOK(void*);
- static void onBtnCancel(void*);
+ static void onBtnOK(void*);
+ static void onBtnCancel(void*);
};
#endif // LL_LLFLOATERWHITELISTENTRY_H
diff --git a/indra/newview/llfloaterwindowsize.cpp b/indra/newview/llfloaterwindowsize.cpp
index 863b7cbb12..1ae7ea9692 100644
--- a/indra/newview/llfloaterwindowsize.cpp
+++ b/indra/newview/llfloaterwindowsize.cpp
@@ -1,28 +1,28 @@
-/**
+/**
* @file llfloaterwindowsize.cpp
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
#include "llviewerprecompiledheaders.h"
#include "llfloaterwindowsize.h"
@@ -40,24 +40,24 @@
// Extract from strings of the form "<width> x <height>", e.g. "640 x 480".
bool extractWindowSizeFromString(const std::string& instr, U32 *width, U32 *height)
{
- boost::cmatch what;
- // matches (any number)(any non-number)(any number)
- const boost::regex expression("([0-9]+)[^0-9]+([0-9]+)");
- if (ll_regex_match(instr.c_str(), what, expression))
- {
- *width = atoi(what[1].first);
- *height = atoi(what[2].first);
- return true;
- }
-
- *width = 0;
- *height = 0;
- return false;
+ boost::cmatch what;
+ // matches (any number)(any non-number)(any number)
+ const boost::regex expression("([0-9]+)[^0-9]+([0-9]+)");
+ if (ll_regex_match(instr.c_str(), what, expression))
+ {
+ *width = atoi(what[1].first);
+ *height = atoi(what[2].first);
+ return true;
+ }
+
+ *width = 0;
+ *height = 0;
+ return false;
}
-LLFloaterWindowSize::LLFloaterWindowSize(const LLSD& key)
-: LLFloater(key)
+LLFloaterWindowSize::LLFloaterWindowSize(const LLSD& key)
+: LLFloater(key)
{}
LLFloaterWindowSize::~LLFloaterWindowSize()
@@ -65,60 +65,60 @@ LLFloaterWindowSize::~LLFloaterWindowSize()
BOOL LLFloaterWindowSize::postBuild()
{
- center();
- initWindowSizeControls();
- getChild<LLUICtrl>("set_btn")->setCommitCallback(
- boost::bind(&LLFloaterWindowSize::onClickSet, this));
- getChild<LLUICtrl>("cancel_btn")->setCommitCallback(
- boost::bind(&LLFloaterWindowSize::onClickCancel, this));
- setDefaultBtn("set_btn");
- return TRUE;
+ center();
+ initWindowSizeControls();
+ getChild<LLUICtrl>("set_btn")->setCommitCallback(
+ boost::bind(&LLFloaterWindowSize::onClickSet, this));
+ getChild<LLUICtrl>("cancel_btn")->setCommitCallback(
+ boost::bind(&LLFloaterWindowSize::onClickCancel, this));
+ setDefaultBtn("set_btn");
+ return TRUE;
}
void LLFloaterWindowSize::initWindowSizeControls()
{
- LLComboBox* ctrl_window_size = getChild<LLComboBox>("window_size_combo");
-
- // Look to see if current window size matches existing window sizes, if so then
- // just set the selection value...
- const U32 height = gViewerWindow->getWindowHeightRaw();
- const U32 width = gViewerWindow->getWindowWidthRaw();
- for (S32 i=0; i < ctrl_window_size->getItemCount(); i++)
- {
- U32 height_test = 0;
- U32 width_test = 0;
- ctrl_window_size->setCurrentByIndex(i);
- std::string resolution = ctrl_window_size->getValue().asString();
- if (extractWindowSizeFromString(resolution, &width_test, &height_test))
- {
- if ((height_test == height) && (width_test == width))
- {
- return;
- }
- }
- }
- // ...otherwise, add a new entry with the current window height/width.
- LLUIString resolution_label = getString("resolution_format");
- resolution_label.setArg("[RES_X]", llformat("%d", width));
- resolution_label.setArg("[RES_Y]", llformat("%d", height));
- ctrl_window_size->add(resolution_label, ADD_TOP);
- ctrl_window_size->setCurrentByIndex(0);
+ LLComboBox* ctrl_window_size = getChild<LLComboBox>("window_size_combo");
+
+ // Look to see if current window size matches existing window sizes, if so then
+ // just set the selection value...
+ const U32 height = gViewerWindow->getWindowHeightRaw();
+ const U32 width = gViewerWindow->getWindowWidthRaw();
+ for (S32 i=0; i < ctrl_window_size->getItemCount(); i++)
+ {
+ U32 height_test = 0;
+ U32 width_test = 0;
+ ctrl_window_size->setCurrentByIndex(i);
+ std::string resolution = ctrl_window_size->getValue().asString();
+ if (extractWindowSizeFromString(resolution, &width_test, &height_test))
+ {
+ if ((height_test == height) && (width_test == width))
+ {
+ return;
+ }
+ }
+ }
+ // ...otherwise, add a new entry with the current window height/width.
+ LLUIString resolution_label = getString("resolution_format");
+ resolution_label.setArg("[RES_X]", llformat("%d", width));
+ resolution_label.setArg("[RES_Y]", llformat("%d", height));
+ ctrl_window_size->add(resolution_label, ADD_TOP);
+ ctrl_window_size->setCurrentByIndex(0);
}
void LLFloaterWindowSize::onClickSet()
{
- LLComboBox* ctrl_window_size = getChild<LLComboBox>("window_size_combo");
- U32 width = 0;
- U32 height = 0;
- std::string resolution = ctrl_window_size->getValue().asString();
- if (extractWindowSizeFromString(resolution, &width, &height))
- {
- LLViewerWindow::movieSize(width, height);
- }
- closeFloater();
+ LLComboBox* ctrl_window_size = getChild<LLComboBox>("window_size_combo");
+ U32 width = 0;
+ U32 height = 0;
+ std::string resolution = ctrl_window_size->getValue().asString();
+ if (extractWindowSizeFromString(resolution, &width, &height))
+ {
+ LLViewerWindow::movieSize(width, height);
+ }
+ closeFloater();
}
void LLFloaterWindowSize::onClickCancel()
{
- closeFloater();
+ closeFloater();
}
diff --git a/indra/newview/llfloaterwindowsize.h b/indra/newview/llfloaterwindowsize.h
index a71e5e273c..aabbe401d7 100644
--- a/indra/newview/llfloaterwindowsize.h
+++ b/indra/newview/llfloaterwindowsize.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llfloaterwindowsize.h
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,18 +32,18 @@
/// Class LLFloaterWindowSize
///----------------------------------------------------------------------------
class LLFloaterWindowSize
- : public LLFloater
+ : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
private:
- LLFloaterWindowSize(const LLSD& key);
- virtual ~LLFloaterWindowSize();
+ LLFloaterWindowSize(const LLSD& key);
+ virtual ~LLFloaterWindowSize();
public:
- /*virtual*/ BOOL postBuild();
- void initWindowSizeControls();
- void onClickSet();
- void onClickCancel();
+ /*virtual*/ BOOL postBuild();
+ void initWindowSizeControls();
+ void onClickSet();
+ void onClickCancel();
};
#endif
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 62e4022ddb..da1e6cca74 100755
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfloaterworldmap.cpp
* @author James Cook, Tom Yedwab
* @brief LLFloaterWorldMap class implementation
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,7 +43,7 @@
#include "llcommandhandler.h"
#include "lldraghandle.h"
//#include "llfirstuse.h"
-#include "llfloaterreg.h" // getTypedInstance()
+#include "llfloaterreg.h" // getTypedInstance()
#include "llfocusmgr.h"
#include "lliconctrl.h"
#include "llinventoryfunctions.h"
@@ -60,7 +60,7 @@
#include "lltoolbarview.h"
#include "lltracker.h"
#include "lltrans.h"
-#include "llviewerinventory.h" // LLViewerInventoryItem
+#include "llviewerinventory.h" // LLViewerInventoryItem
#include "llviewermenu.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
@@ -76,7 +76,7 @@
#include "llweb.h"
#include "llsliderctrl.h"
#include "message.h"
-#include "llwindow.h" // copyTextToClipboard()
+#include "llwindow.h" // copyTextToClipboard()
#include <algorithm>
//---------------------------------------------------------------------------
@@ -96,18 +96,18 @@ const S32 HIDE_BEACON_PAD = 133;
// struct has to be here.
struct SortRegionNames
{
- inline bool operator ()(std::pair <U64, LLSimInfo*> const& _left, std::pair <U64, LLSimInfo*> const& _right)
- {
- return(LLStringUtil::compareInsensitive(_left.second->getName(), _right.second->getName()) < 0);
- }
+ inline bool operator ()(std::pair <U64, LLSimInfo*> const& _left, std::pair <U64, LLSimInfo*> const& _right)
+ {
+ return(LLStringUtil::compareInsensitive(_left.second->getName(), _right.second->getName()) < 0);
+ }
};
enum EPanDirection
{
- PAN_UP,
- PAN_DOWN,
- PAN_LEFT,
- PAN_RIGHT
+ PAN_UP,
+ PAN_DOWN,
+ PAN_LEFT,
+ PAN_RIGHT
};
// Values in pixels per region
@@ -145,31 +145,31 @@ public:
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableWorldMap"))
- {
- LLNotificationsUtil::add("NoWorldMap", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
-
- if (params.size() == 0)
- {
- // support the secondlife:///app/worldmap SLapp
- LLFloaterReg::showInstance("world_map", "center");
- return true;
- }
-
- // support the secondlife:///app/worldmap/{LOCATION}/{COORDS} SLapp
- const std::string region_name = LLURI::unescape(params[0].asString());
- S32 x = (params.size() > 1) ? params[1].asInteger() : 128;
- S32 y = (params.size() > 2) ? params[2].asInteger() : 128;
- S32 z = (params.size() > 3) ? params[3].asInteger() : 0;
-
- LLFloaterWorldMap::getInstance()->trackURL(region_name, x, y, z);
- LLFloaterReg::showInstance("world_map", "center");
-
- return true;
- }
+ {
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableWorldMap"))
+ {
+ LLNotificationsUtil::add("NoWorldMap", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ if (params.size() == 0)
+ {
+ // support the secondlife:///app/worldmap SLapp
+ LLFloaterReg::showInstance("world_map", "center");
+ return true;
+ }
+
+ // support the secondlife:///app/worldmap/{LOCATION}/{COORDS} SLapp
+ const std::string region_name = LLURI::unescape(params[0].asString());
+ S32 x = (params.size() > 1) ? params[1].asInteger() : 128;
+ S32 y = (params.size() > 2) ? params[2].asInteger() : 128;
+ S32 z = (params.size() > 3) ? params[3].asInteger() : 0;
+
+ LLFloaterWorldMap::getInstance()->trackURL(region_name, x, y, z);
+ LLFloaterReg::showInstance("world_map", "center");
+
+ return true;
+ }
};
LLWorldMapHandler gWorldMapHandler;
@@ -177,9 +177,9 @@ LLWorldMapHandler gWorldMapHandler;
class LLMapTrackAvatarHandler : public LLCommandHandler
{
public:
- LLMapTrackAvatarHandler() : LLCommandHandler("maptrackavatar", UNTRUSTED_THROTTLE)
- {
- }
+ LLMapTrackAvatarHandler() : LLCommandHandler("maptrackavatar", UNTRUSTED_THROTTLE)
+ {
+ }
virtual bool canHandleUntrusted(
const LLSD& params,
@@ -206,32 +206,32 @@ public:
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableWorldMap"))
- {
- LLNotificationsUtil::add("NoWorldMap", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
-
- //Make sure we have some parameters
- if (params.size() == 0)
- {
- return false;
- }
-
- //Get the ID
- LLUUID id;
- if (!id.set( params[0], FALSE ))
- {
- return false;
- }
-
- LLFloaterWorldMap::getInstance()->avatarTrackFromSlapp( id );
- LLFloaterReg::showInstance( "world_map", "center" );
-
- return true;
- }
-};
+ {
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableWorldMap"))
+ {
+ LLNotificationsUtil::add("NoWorldMap", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ //Make sure we have some parameters
+ if (params.size() == 0)
+ {
+ return false;
+ }
+
+ //Get the ID
+ LLUUID id;
+ if (!id.set( params[0], FALSE ))
+ {
+ return false;
+ }
+
+ LLFloaterWorldMap::getInstance()->avatarTrackFromSlapp( id );
+ LLFloaterReg::showInstance( "world_map", "center" );
+
+ return true;
+ }
+};
LLMapTrackAvatarHandler gMapTrackAvatar;
LLFloaterWorldMap* gFloaterWorldMap = NULL;
@@ -239,36 +239,36 @@ LLFloaterWorldMap* gFloaterWorldMap = NULL;
class LLMapInventoryObserver : public LLInventoryObserver
{
public:
- LLMapInventoryObserver() {}
- virtual ~LLMapInventoryObserver() {}
- virtual void changed(U32 mask);
+ LLMapInventoryObserver() {}
+ virtual ~LLMapInventoryObserver() {}
+ virtual void changed(U32 mask);
};
void LLMapInventoryObserver::changed(U32 mask)
{
- // if there's a change we're interested in.
- if((mask & (LLInventoryObserver::CALLING_CARD | LLInventoryObserver::ADD |
- LLInventoryObserver::REMOVE)) != 0)
- {
- gFloaterWorldMap->inventoryChanged();
- }
+ // if there's a change we're interested in.
+ if((mask & (LLInventoryObserver::CALLING_CARD | LLInventoryObserver::ADD |
+ LLInventoryObserver::REMOVE)) != 0)
+ {
+ gFloaterWorldMap->inventoryChanged();
+ }
}
class LLMapFriendObserver : public LLFriendObserver
{
public:
- LLMapFriendObserver() {}
- virtual ~LLMapFriendObserver() {}
- virtual void changed(U32 mask);
+ LLMapFriendObserver() {}
+ virtual ~LLMapFriendObserver() {}
+ virtual void changed(U32 mask);
};
void LLMapFriendObserver::changed(U32 mask)
{
- // if there's a change we're interested in.
- if((mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE | LLFriendObserver::POWERS)) != 0)
- {
- gFloaterWorldMap->friendsChanged();
- }
+ // if there's a change we're interested in.
+ if((mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE | LLFriendObserver::POWERS)) != 0)
+ {
+ gFloaterWorldMap->friendsChanged();
+ }
}
//---------------------------------------------------------------------------
@@ -284,96 +284,96 @@ const LLUUID LLFloaterWorldMap::sHomeID( "10000000-0000-0000-0000-000000000001"
LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
-: LLFloater(key),
- mInventory(NULL),
- mInventoryObserver(NULL),
- mFriendObserver(NULL),
- mCompletingRegionName(),
- mCompletingRegionPos(),
- mWaitingForTracker(FALSE),
- mIsClosing(FALSE),
- mSetToUserPosition(TRUE),
- mTrackedLocation(0,0,0),
- mTrackedStatus(LLTracker::TRACKING_NOTHING),
- mListFriendCombo(NULL),
- mListLandmarkCombo(NULL),
- mListSearchResults(NULL)
-{
- gFloaterWorldMap = this;
-
- mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL);
-
- mCommitCallbackRegistrar.add("WMap.Coordinates", boost::bind(&LLFloaterWorldMap::onCoordinatesCommit, this));
- mCommitCallbackRegistrar.add("WMap.Location", boost::bind(&LLFloaterWorldMap::onLocationCommit, this));
- mCommitCallbackRegistrar.add("WMap.AvatarCombo", boost::bind(&LLFloaterWorldMap::onAvatarComboCommit, this));
- mCommitCallbackRegistrar.add("WMap.Landmark", boost::bind(&LLFloaterWorldMap::onLandmarkComboCommit, this));
- mCommitCallbackRegistrar.add("WMap.SearchResult", boost::bind(&LLFloaterWorldMap::onCommitSearchResult, this));
- mCommitCallbackRegistrar.add("WMap.GoHome", boost::bind(&LLFloaterWorldMap::onGoHome, this));
- mCommitCallbackRegistrar.add("WMap.Teleport", boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));
- mCommitCallbackRegistrar.add("WMap.ShowTarget", boost::bind(&LLFloaterWorldMap::onShowTargetBtn, this));
- mCommitCallbackRegistrar.add("WMap.ShowAgent", boost::bind(&LLFloaterWorldMap::onShowAgentBtn, this));
- mCommitCallbackRegistrar.add("WMap.Clear", boost::bind(&LLFloaterWorldMap::onClearBtn, this));
- mCommitCallbackRegistrar.add("WMap.CopySLURL", boost::bind(&LLFloaterWorldMap::onCopySLURL, this));
-
- gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterWorldMap::onChangeMaturity, this));
+: LLFloater(key),
+ mInventory(NULL),
+ mInventoryObserver(NULL),
+ mFriendObserver(NULL),
+ mCompletingRegionName(),
+ mCompletingRegionPos(),
+ mWaitingForTracker(FALSE),
+ mIsClosing(FALSE),
+ mSetToUserPosition(TRUE),
+ mTrackedLocation(0,0,0),
+ mTrackedStatus(LLTracker::TRACKING_NOTHING),
+ mListFriendCombo(NULL),
+ mListLandmarkCombo(NULL),
+ mListSearchResults(NULL)
+{
+ gFloaterWorldMap = this;
+
+ mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL);
+
+ mCommitCallbackRegistrar.add("WMap.Coordinates", boost::bind(&LLFloaterWorldMap::onCoordinatesCommit, this));
+ mCommitCallbackRegistrar.add("WMap.Location", boost::bind(&LLFloaterWorldMap::onLocationCommit, this));
+ mCommitCallbackRegistrar.add("WMap.AvatarCombo", boost::bind(&LLFloaterWorldMap::onAvatarComboCommit, this));
+ mCommitCallbackRegistrar.add("WMap.Landmark", boost::bind(&LLFloaterWorldMap::onLandmarkComboCommit, this));
+ mCommitCallbackRegistrar.add("WMap.SearchResult", boost::bind(&LLFloaterWorldMap::onCommitSearchResult, this));
+ mCommitCallbackRegistrar.add("WMap.GoHome", boost::bind(&LLFloaterWorldMap::onGoHome, this));
+ mCommitCallbackRegistrar.add("WMap.Teleport", boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));
+ mCommitCallbackRegistrar.add("WMap.ShowTarget", boost::bind(&LLFloaterWorldMap::onShowTargetBtn, this));
+ mCommitCallbackRegistrar.add("WMap.ShowAgent", boost::bind(&LLFloaterWorldMap::onShowAgentBtn, this));
+ mCommitCallbackRegistrar.add("WMap.Clear", boost::bind(&LLFloaterWorldMap::onClearBtn, this));
+ mCommitCallbackRegistrar.add("WMap.CopySLURL", boost::bind(&LLFloaterWorldMap::onCopySLURL, this));
+
+ gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterWorldMap::onChangeMaturity, this));
}
// static
void* LLFloaterWorldMap::createWorldMapView(void* data)
{
- return new LLWorldMapView();
+ return new LLWorldMapView();
}
BOOL LLFloaterWorldMap::postBuild()
{
mMapView = dynamic_cast<LLWorldMapView*>(getChild<LLPanel>("objects_mapview"));
mMapView->setPan(0, 0, true);
-
- LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo");
- avatar_combo->selectFirstItem();
- avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) );
- avatar_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
- mListFriendCombo = dynamic_cast<LLCtrlListInterface *>(avatar_combo);
-
- LLSearchEditor *location_editor = getChild<LLSearchEditor>("location");
- location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1));
- location_editor->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this));
-
- getChild<LLScrollListCtrl>("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));
- mListSearchResults = childGetListInterface("search_results");
-
- LLComboBox *landmark_combo = getChild<LLComboBox>( "landmark combo");
- landmark_combo->selectFirstItem();
- landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) );
- landmark_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
- mListLandmarkCombo = dynamic_cast<LLCtrlListInterface *>(landmark_combo);
-
+
+ LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo");
+ avatar_combo->selectFirstItem();
+ avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) );
+ avatar_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
+ mListFriendCombo = dynamic_cast<LLCtrlListInterface *>(avatar_combo);
+
+ LLSearchEditor *location_editor = getChild<LLSearchEditor>("location");
+ location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1));
+ location_editor->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this));
+
+ getChild<LLScrollListCtrl>("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));
+ mListSearchResults = childGetListInterface("search_results");
+
+ LLComboBox *landmark_combo = getChild<LLComboBox>( "landmark combo");
+ landmark_combo->selectFirstItem();
+ landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) );
+ landmark_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
+ mListLandmarkCombo = dynamic_cast<LLCtrlListInterface *>(landmark_combo);
+
F32 slider_zoom = mMapView->getZoom();
getChild<LLUICtrl>("zoom slider")->setValue(slider_zoom);
-
+
getChild<LLPanel>("expand_btn_panel")->setMouseDownCallback(boost::bind(&LLFloaterWorldMap::onExpandCollapseBtn, this));
-
- setDefaultBtn(NULL);
-
- onChangeMaturity();
-
- return TRUE;
+
+ setDefaultBtn(NULL);
+
+ onChangeMaturity();
+
+ return TRUE;
}
// virtual
LLFloaterWorldMap::~LLFloaterWorldMap()
{
- // All cleaned up by LLView destructor
+ // All cleaned up by LLView destructor
mMapView = NULL;
-
- // Inventory deletes all observers on shutdown
- mInventory = NULL;
- mInventoryObserver = NULL;
-
- // avatar tracker will delete this for us.
- mFriendObserver = NULL;
-
- gFloaterWorldMap = NULL;
+
+ // Inventory deletes all observers on shutdown
+ mInventory = NULL;
+ mInventoryObserver = NULL;
+
+ // avatar tracker will delete this for us.
+ mFriendObserver = NULL;
+
+ gFloaterWorldMap = NULL;
mTeleportFinishConnection.disconnect();
}
@@ -381,14 +381,14 @@ LLFloaterWorldMap::~LLFloaterWorldMap()
//static
LLFloaterWorldMap* LLFloaterWorldMap::getInstance()
{
- return LLFloaterReg::getTypedInstance<LLFloaterWorldMap>("world_map");
+ return LLFloaterReg::getTypedInstance<LLFloaterWorldMap>("world_map");
}
// virtual
void LLFloaterWorldMap::onClose(bool app_quitting)
{
- // While we're not visible, discard the overlay images we're using
- LLWorldMap::getInstance()->clearImageRefs();
+ // While we're not visible, discard the overlay images we're using
+ LLWorldMap::getInstance()->clearImageRefs();
mTeleportFinishConnection.disconnect();
}
@@ -397,63 +397,63 @@ void LLFloaterWorldMap::onOpen(const LLSD& key)
{
mTeleportFinishConnection = LLViewerParcelMgr::getInstance()->
setTeleportFinishedCallback(boost::bind(&LLFloaterWorldMap::onTeleportFinished, this));
-
+
bool center_on_target = (key.asString() == "center");
-
- mIsClosing = FALSE;
-
+
+ mIsClosing = FALSE;
+
mMapView->clearLastClick();
-
- {
- // reset pan on show, so it centers on you again
- if (!center_on_target)
- {
+
+ {
+ // reset pan on show, so it centers on you again
+ if (!center_on_target)
+ {
mMapView->setPan(0, 0, true);
- }
+ }
mMapView->updateVisibleBlocks();
-
- // Reload items as they may have changed
- LLWorldMap::getInstance()->reloadItems();
-
- // We may already have a bounding box for the regions of the world,
- // so use that to adjust the view.
- adjustZoomSliderBounds();
-
- // Could be first show
- //LLFirstUse::useMap();
-
- // Start speculative download of landmarks
- const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
- LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id);
-
- getChild<LLUICtrl>("location")->setFocus( TRUE);
- gFocusMgr.triggerFocusFlash();
-
- buildAvatarIDList();
- buildLandmarkIDLists();
-
- // If nothing is being tracked, set flag so the user position will be found
- mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
- }
-
- if (center_on_target)
- {
- centerOnTarget(FALSE);
- }
+
+ // Reload items as they may have changed
+ LLWorldMap::getInstance()->reloadItems();
+
+ // We may already have a bounding box for the regions of the world,
+ // so use that to adjust the view.
+ adjustZoomSliderBounds();
+
+ // Could be first show
+ //LLFirstUse::useMap();
+
+ // Start speculative download of landmarks
+ const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id);
+
+ getChild<LLUICtrl>("location")->setFocus( TRUE);
+ gFocusMgr.triggerFocusFlash();
+
+ buildAvatarIDList();
+ buildLandmarkIDLists();
+
+ // If nothing is being tracked, set flag so the user position will be found
+ mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
+ }
+
+ if (center_on_target)
+ {
+ centerOnTarget(FALSE);
+ }
}
// static
void LLFloaterWorldMap::reloadIcons(void*)
{
- LLWorldMap::getInstance()->reloadItems();
+ LLWorldMap::getInstance()->reloadItems();
}
// virtual
BOOL LLFloaterWorldMap::handleHover(S32 x, S32 y, MASK mask)
{
- BOOL handled;
- handled = LLFloater::handleHover(x, y, mask);
- return handled;
+ BOOL handled;
+ handled = LLFloater::handleHover(x, y, mask);
+ return handled;
}
BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
@@ -479,94 +479,94 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
// virtual
void LLFloaterWorldMap::reshape( S32 width, S32 height, BOOL called_from_parent )
{
- LLFloater::reshape( width, height, called_from_parent );
+ LLFloater::reshape( width, height, called_from_parent );
}
// virtual
void LLFloaterWorldMap::draw()
{
- static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
- static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white);
-
- // On orientation island, users don't have a home location yet, so don't
- // let them teleport "home". It dumps them in an often-crowed welcome
- // area (infohub) and they get confused. JC
- LLViewerRegion* regionp = gAgent.getRegion();
- bool agent_on_prelude = (regionp && regionp->isPrelude());
- bool enable_go_home = gAgent.isGodlike() || !agent_on_prelude;
- getChildView("Go Home")->setEnabled(enable_go_home);
-
- updateLocation();
-
- LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
- if (LLTracker::TRACKING_AVATAR == tracking_status)
- {
- getChild<LLUICtrl>("avatar_icon")->setColor( map_track_color);
- }
- else
- {
- getChild<LLUICtrl>("avatar_icon")->setColor( map_track_disabled_color);
- }
-
- if (LLTracker::TRACKING_LANDMARK == tracking_status)
- {
- getChild<LLUICtrl>("landmark_icon")->setColor( map_track_color);
- }
- else
- {
- getChild<LLUICtrl>("landmark_icon")->setColor( map_track_disabled_color);
- }
-
- if (LLTracker::TRACKING_LOCATION == tracking_status)
- {
- getChild<LLUICtrl>("location_icon")->setColor( map_track_color);
- }
- else
- {
- if (mCompletingRegionName != "")
- {
- F64 seconds = LLTimer::getElapsedSeconds();
- double value = fmod(seconds, 2);
- value = 0.5 + 0.5*cos(value * F_PI);
- LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0);
- getChild<LLUICtrl>("location_icon")->setColor( loading_color);
- }
- else
- {
- getChild<LLUICtrl>("location_icon")->setColor( map_track_disabled_color);
- }
- }
-
- // check for completion of tracking data
- if (mWaitingForTracker)
- {
- centerOnTarget(TRUE);
- }
-
- getChildView("Teleport")->setEnabled((BOOL)tracking_status);
- // getChildView("Clear")->setEnabled((BOOL)tracking_status);
- getChildView("Show Destination")->setEnabled((BOOL)tracking_status || LLWorldMap::getInstance()->isTracking());
- getChildView("copy_slurl")->setEnabled((mSLURL.isValid()) );
-
- setMouseOpaque(TRUE);
- getDragHandle()->setMouseOpaque(TRUE);
+ static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
+ static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white);
+
+ // On orientation island, users don't have a home location yet, so don't
+ // let them teleport "home". It dumps them in an often-crowed welcome
+ // area (infohub) and they get confused. JC
+ LLViewerRegion* regionp = gAgent.getRegion();
+ bool agent_on_prelude = (regionp && regionp->isPrelude());
+ bool enable_go_home = gAgent.isGodlike() || !agent_on_prelude;
+ getChildView("Go Home")->setEnabled(enable_go_home);
+
+ updateLocation();
+
+ LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
+ if (LLTracker::TRACKING_AVATAR == tracking_status)
+ {
+ getChild<LLUICtrl>("avatar_icon")->setColor( map_track_color);
+ }
+ else
+ {
+ getChild<LLUICtrl>("avatar_icon")->setColor( map_track_disabled_color);
+ }
+
+ if (LLTracker::TRACKING_LANDMARK == tracking_status)
+ {
+ getChild<LLUICtrl>("landmark_icon")->setColor( map_track_color);
+ }
+ else
+ {
+ getChild<LLUICtrl>("landmark_icon")->setColor( map_track_disabled_color);
+ }
+
+ if (LLTracker::TRACKING_LOCATION == tracking_status)
+ {
+ getChild<LLUICtrl>("location_icon")->setColor( map_track_color);
+ }
+ else
+ {
+ if (mCompletingRegionName != "")
+ {
+ F64 seconds = LLTimer::getElapsedSeconds();
+ double value = fmod(seconds, 2);
+ value = 0.5 + 0.5*cos(value * F_PI);
+ LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0);
+ getChild<LLUICtrl>("location_icon")->setColor( loading_color);
+ }
+ else
+ {
+ getChild<LLUICtrl>("location_icon")->setColor( map_track_disabled_color);
+ }
+ }
+
+ // check for completion of tracking data
+ if (mWaitingForTracker)
+ {
+ centerOnTarget(TRUE);
+ }
+
+ getChildView("Teleport")->setEnabled((BOOL)tracking_status);
+ // getChildView("Clear")->setEnabled((BOOL)tracking_status);
+ getChildView("Show Destination")->setEnabled((BOOL)tracking_status || LLWorldMap::getInstance()->isTracking());
+ getChildView("copy_slurl")->setEnabled((mSLURL.isValid()) );
+
+ setMouseOpaque(TRUE);
+ getDragHandle()->setMouseOpaque(TRUE);
mMapView->zoom((F32)getChild<LLUICtrl>("zoom slider")->getValue().asReal());
-
- // Enable/disable checkboxes depending on the zoom level
- // If above threshold level (i.e. low res) -> Disable all checkboxes
- // If under threshold level (i.e. high res) -> Enable all checkboxes
+
+ // Enable/disable checkboxes depending on the zoom level
+ // If above threshold level (i.e. low res) -> Disable all checkboxes
+ // If under threshold level (i.e. high res) -> Enable all checkboxes
bool enable = mMapView->showRegionInfo();
- getChildView("people_chk")->setEnabled(enable);
- getChildView("infohub_chk")->setEnabled(enable);
- getChildView("telehub_chk")->setEnabled(enable);
- getChildView("land_for_sale_chk")->setEnabled(enable);
- getChildView("event_chk")->setEnabled(enable);
- getChildView("events_mature_chk")->setEnabled(enable);
- getChildView("events_adult_chk")->setEnabled(enable);
-
- LLFloater::draw();
+ getChildView("people_chk")->setEnabled(enable);
+ getChildView("infohub_chk")->setEnabled(enable);
+ getChildView("telehub_chk")->setEnabled(enable);
+ getChildView("land_for_sale_chk")->setEnabled(enable);
+ getChildView("event_chk")->setEnabled(enable);
+ getChildView("events_mature_chk")->setEnabled(enable);
+ getChildView("events_adult_chk")->setEnabled(enable);
+
+ LLFloater::draw();
}
@@ -577,470 +577,470 @@ void LLFloaterWorldMap::draw()
void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& name )
{
- LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo");
- if (!iface) return;
-
- buildAvatarIDList();
- if(iface->setCurrentByID(avatar_id) || gAgent.isGodlike())
- {
- // *HACK: Adjust Z values automatically for liaisons & gods so
- // they swoop down when they click on the map. Requested
- // convenience.
- if(gAgent.isGodlike())
- {
- getChild<LLUICtrl>("teleport_coordinate_z")->setValue(LLSD(200.f));
- }
- // Don't re-request info if we already have it or we won't have it in time to teleport
- if (mTrackedStatus != LLTracker::TRACKING_AVATAR || avatar_id != mTrackedAvatarID)
- {
- mTrackedStatus = LLTracker::TRACKING_AVATAR;
- mTrackedAvatarID = avatar_id;
- LLTracker::trackAvatar(avatar_id, name);
- }
- }
- else
- {
- LLTracker::stopTracking(false);
- }
- setDefaultBtn("Teleport");
+ LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo");
+ if (!iface) return;
+
+ buildAvatarIDList();
+ if(iface->setCurrentByID(avatar_id) || gAgent.isGodlike())
+ {
+ // *HACK: Adjust Z values automatically for liaisons & gods so
+ // they swoop down when they click on the map. Requested
+ // convenience.
+ if(gAgent.isGodlike())
+ {
+ getChild<LLUICtrl>("teleport_coordinate_z")->setValue(LLSD(200.f));
+ }
+ // Don't re-request info if we already have it or we won't have it in time to teleport
+ if (mTrackedStatus != LLTracker::TRACKING_AVATAR || avatar_id != mTrackedAvatarID)
+ {
+ mTrackedStatus = LLTracker::TRACKING_AVATAR;
+ mTrackedAvatarID = avatar_id;
+ LLTracker::trackAvatar(avatar_id, name);
+ }
+ }
+ else
+ {
+ LLTracker::stopTracking(false);
+ }
+ setDefaultBtn("Teleport");
}
void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
{
- LLCtrlSelectionInterface *iface = childGetSelectionInterface("landmark combo");
- if (!iface) return;
-
- buildLandmarkIDLists();
- BOOL found = FALSE;
- S32 idx;
- for (idx = 0; idx < mLandmarkItemIDList.size(); idx++)
- {
- if ( mLandmarkItemIDList.at(idx) == landmark_item_id)
- {
- found = TRUE;
- break;
- }
- }
-
- if (found && iface->setCurrentByID( landmark_item_id ) )
- {
- LLUUID asset_id = mLandmarkAssetIDList.at( idx );
- std::string name;
- LLComboBox* combo = getChild<LLComboBox>( "landmark combo");
- if (combo) name = combo->getSimple();
- mTrackedStatus = LLTracker::TRACKING_LANDMARK;
- LLTracker::trackLandmark(mLandmarkAssetIDList.at( idx ), // assetID
- mLandmarkItemIDList.at( idx ), // itemID
- name); // name
-
- if( asset_id != sHomeID )
- {
- // start the download process
- gLandmarkList.getAsset( asset_id);
- }
-
- // We have to download both region info and landmark data, so set busy. JC
- // getWindow()->incBusyCount();
- }
- else
- {
- LLTracker::stopTracking(false);
- }
- setDefaultBtn("Teleport");
+ LLCtrlSelectionInterface *iface = childGetSelectionInterface("landmark combo");
+ if (!iface) return;
+
+ buildLandmarkIDLists();
+ BOOL found = FALSE;
+ S32 idx;
+ for (idx = 0; idx < mLandmarkItemIDList.size(); idx++)
+ {
+ if ( mLandmarkItemIDList.at(idx) == landmark_item_id)
+ {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (found && iface->setCurrentByID( landmark_item_id ) )
+ {
+ LLUUID asset_id = mLandmarkAssetIDList.at( idx );
+ std::string name;
+ LLComboBox* combo = getChild<LLComboBox>( "landmark combo");
+ if (combo) name = combo->getSimple();
+ mTrackedStatus = LLTracker::TRACKING_LANDMARK;
+ LLTracker::trackLandmark(mLandmarkAssetIDList.at( idx ), // assetID
+ mLandmarkItemIDList.at( idx ), // itemID
+ name); // name
+
+ if( asset_id != sHomeID )
+ {
+ // start the download process
+ gLandmarkList.getAsset( asset_id);
+ }
+
+ // We have to download both region info and landmark data, so set busy. JC
+ // getWindow()->incBusyCount();
+ }
+ else
+ {
+ LLTracker::stopTracking(false);
+ }
+ setDefaultBtn("Teleport");
}
void LLFloaterWorldMap::trackEvent(const LLItemInfo &event_info)
{
- mTrackedStatus = LLTracker::TRACKING_LOCATION;
- LLTracker::trackLocation(event_info.getGlobalPosition(), event_info.getName(), event_info.getToolTip(), LLTracker::LOCATION_EVENT);
- setDefaultBtn("Teleport");
+ mTrackedStatus = LLTracker::TRACKING_LOCATION;
+ LLTracker::trackLocation(event_info.getGlobalPosition(), event_info.getName(), event_info.getToolTip(), LLTracker::LOCATION_EVENT);
+ setDefaultBtn("Teleport");
}
void LLFloaterWorldMap::trackGenericItem(const LLItemInfo &item)
{
- mTrackedStatus = LLTracker::TRACKING_LOCATION;
- LLTracker::trackLocation(item.getGlobalPosition(), item.getName(), item.getToolTip(), LLTracker::LOCATION_ITEM);
- setDefaultBtn("Teleport");
+ mTrackedStatus = LLTracker::TRACKING_LOCATION;
+ LLTracker::trackLocation(item.getGlobalPosition(), item.getName(), item.getToolTip(), LLTracker::LOCATION_ITEM);
+ setDefaultBtn("Teleport");
}
void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
{
- LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
- if (!sim_info)
- {
- // We haven't found a region for that point yet, leave the tracking to the world map
- LLTracker::stopTracking(false);
- LLWorldMap::getInstance()->setTracking(pos_global);
- S32 world_x = S32(pos_global.mdV[0] / 256);
- S32 world_y = S32(pos_global.mdV[1] / 256);
- LLWorldMapMessage::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
- setDefaultBtn("");
-
- // clicked on a non-region - turn off coord display
- enableTeleportCoordsDisplay( false );
-
- return;
- }
- if (sim_info->isDown())
- {
- // Down region. Show the blue circle of death!
- // i.e. let the world map that this and tell it it's invalid
- LLTracker::stopTracking(false);
- LLWorldMap::getInstance()->setTracking(pos_global);
- LLWorldMap::getInstance()->setTrackingInvalid();
- setDefaultBtn("");
-
- // clicked on a down region - turn off coord display
- enableTeleportCoordsDisplay( false );
-
- return;
- }
-
- std::string sim_name = sim_info->getName();
- F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
- F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
- std::string full_name = llformat("%s (%d, %d, %d)",
- sim_name.c_str(),
- ll_round(region_x),
- ll_round(region_y),
- ll_round((F32)pos_global.mdV[VZ]));
-
- std::string tooltip("");
- mTrackedStatus = LLTracker::TRACKING_LOCATION;
- LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking
- LLTracker::trackLocation(pos_global, full_name, tooltip);
-
- LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
- updateTeleportCoordsDisplay( coord_pos );
-
- // we have a valid region - turn on coord display
- enableTeleportCoordsDisplay( true );
-
- setDefaultBtn("Teleport");
-}
-
-// enable/disable teleport destination coordinates
+ LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
+ if (!sim_info)
+ {
+ // We haven't found a region for that point yet, leave the tracking to the world map
+ LLTracker::stopTracking(false);
+ LLWorldMap::getInstance()->setTracking(pos_global);
+ S32 world_x = S32(pos_global.mdV[0] / 256);
+ S32 world_y = S32(pos_global.mdV[1] / 256);
+ LLWorldMapMessage::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
+ setDefaultBtn("");
+
+ // clicked on a non-region - turn off coord display
+ enableTeleportCoordsDisplay( false );
+
+ return;
+ }
+ if (sim_info->isDown())
+ {
+ // Down region. Show the blue circle of death!
+ // i.e. let the world map that this and tell it it's invalid
+ LLTracker::stopTracking(false);
+ LLWorldMap::getInstance()->setTracking(pos_global);
+ LLWorldMap::getInstance()->setTrackingInvalid();
+ setDefaultBtn("");
+
+ // clicked on a down region - turn off coord display
+ enableTeleportCoordsDisplay( false );
+
+ return;
+ }
+
+ std::string sim_name = sim_info->getName();
+ F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
+ F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
+ std::string full_name = llformat("%s (%d, %d, %d)",
+ sim_name.c_str(),
+ ll_round(region_x),
+ ll_round(region_y),
+ ll_round((F32)pos_global.mdV[VZ]));
+
+ std::string tooltip("");
+ mTrackedStatus = LLTracker::TRACKING_LOCATION;
+ LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking
+ LLTracker::trackLocation(pos_global, full_name, tooltip);
+
+ LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
+ updateTeleportCoordsDisplay( coord_pos );
+
+ // we have a valid region - turn on coord display
+ enableTeleportCoordsDisplay( true );
+
+ setDefaultBtn("Teleport");
+}
+
+// enable/disable teleport destination coordinates
void LLFloaterWorldMap::enableTeleportCoordsDisplay( bool enabled )
{
- childSetEnabled("teleport_coordinate_x", enabled );
- childSetEnabled("teleport_coordinate_y", enabled );
- childSetEnabled("teleport_coordinate_z", enabled );
+ childSetEnabled("teleport_coordinate_x", enabled );
+ childSetEnabled("teleport_coordinate_y", enabled );
+ childSetEnabled("teleport_coordinate_z", enabled );
}
// update display of teleport destination coordinates - pos is in global coordinates
void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos )
{
- // if we're going to update their value, we should also enable them
- enableTeleportCoordsDisplay( true );
-
- // convert global specified position to a local one
- F32 region_local_x = (F32)fmod( pos.mdV[VX], (F64)REGION_WIDTH_METERS );
- F32 region_local_y = (F32)fmod( pos.mdV[VY], (F64)REGION_WIDTH_METERS );
- F32 region_local_z = (F32)llclamp( pos.mdV[VZ], 0.0, (F64)REGION_HEIGHT_METERS );
+ // if we're going to update their value, we should also enable them
+ enableTeleportCoordsDisplay( true );
+
+ // convert global specified position to a local one
+ F32 region_local_x = (F32)fmod( pos.mdV[VX], (F64)REGION_WIDTH_METERS );
+ F32 region_local_y = (F32)fmod( pos.mdV[VY], (F64)REGION_WIDTH_METERS );
+ F32 region_local_z = (F32)llclamp( pos.mdV[VZ], 0.0, (F64)REGION_HEIGHT_METERS );
- // write in the values
- childSetValue("teleport_coordinate_x", region_local_x );
- childSetValue("teleport_coordinate_y", region_local_y );
- childSetValue("teleport_coordinate_z", region_local_z );
+ // write in the values
+ childSetValue("teleport_coordinate_x", region_local_x );
+ childSetValue("teleport_coordinate_y", region_local_y );
+ childSetValue("teleport_coordinate_z", region_local_z );
}
void LLFloaterWorldMap::updateLocation()
{
- bool gotSimName;
-
- LLTracker::ETrackingStatus status = LLTracker::getTrackingStatus();
-
- // These values may get updated by a message, so need to check them every frame
- // The fields may be changed by the user, so only update them if the data changes
- LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
- if (pos_global.isExactlyZero())
- {
- LLVector3d agentPos = gAgent.getPositionGlobal();
-
- // Set to avatar's current postion if nothing is selected
- if ( status == LLTracker::TRACKING_NOTHING && mSetToUserPosition )
- {
- // Make sure we know where we are before setting the current user position
- std::string agent_sim_name;
- gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( agentPos, agent_sim_name );
- if ( gotSimName )
- {
- mSetToUserPosition = FALSE;
-
- // Fill out the location field
- getChild<LLUICtrl>("location")->setValue(agent_sim_name);
-
- // update the coordinate display with location of avatar in region
- updateTeleportCoordsDisplay( agentPos );
-
- // Figure out where user is
- // Set the current SLURL
- mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal());
- }
- }
-
- return; // invalid location
- }
- std::string sim_name;
- gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name );
- if ((status != LLTracker::TRACKING_NOTHING) &&
- (status != mTrackedStatus || pos_global != mTrackedLocation || sim_name != mTrackedSimName))
- {
- mTrackedStatus = status;
- mTrackedLocation = pos_global;
- mTrackedSimName = sim_name;
-
- if (status == LLTracker::TRACKING_AVATAR)
- {
- // *HACK: Adjust Z values automatically for liaisons &
- // gods so they swoop down when they click on the
- // map. Requested convenience.
- if(gAgent.isGodlike())
- {
- pos_global[2] = 200;
- }
- }
-
- getChild<LLUICtrl>("location")->setValue(sim_name);
-
- // refresh coordinate display to reflect where user clicked.
- LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
- updateTeleportCoordsDisplay( coord_pos );
-
- // simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
- if ( gotSimName )
- {
- mSLURL = LLSLURL(sim_name, pos_global);
- }
- else
- { // Empty SLURL will disable the "Copy SLURL to clipboard" button
- mSLURL = LLSLURL();
- }
- }
+ bool gotSimName;
+
+ LLTracker::ETrackingStatus status = LLTracker::getTrackingStatus();
+
+ // These values may get updated by a message, so need to check them every frame
+ // The fields may be changed by the user, so only update them if the data changes
+ LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
+ if (pos_global.isExactlyZero())
+ {
+ LLVector3d agentPos = gAgent.getPositionGlobal();
+
+ // Set to avatar's current postion if nothing is selected
+ if ( status == LLTracker::TRACKING_NOTHING && mSetToUserPosition )
+ {
+ // Make sure we know where we are before setting the current user position
+ std::string agent_sim_name;
+ gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( agentPos, agent_sim_name );
+ if ( gotSimName )
+ {
+ mSetToUserPosition = FALSE;
+
+ // Fill out the location field
+ getChild<LLUICtrl>("location")->setValue(agent_sim_name);
+
+ // update the coordinate display with location of avatar in region
+ updateTeleportCoordsDisplay( agentPos );
+
+ // Figure out where user is
+ // Set the current SLURL
+ mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal());
+ }
+ }
+
+ return; // invalid location
+ }
+ std::string sim_name;
+ gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name );
+ if ((status != LLTracker::TRACKING_NOTHING) &&
+ (status != mTrackedStatus || pos_global != mTrackedLocation || sim_name != mTrackedSimName))
+ {
+ mTrackedStatus = status;
+ mTrackedLocation = pos_global;
+ mTrackedSimName = sim_name;
+
+ if (status == LLTracker::TRACKING_AVATAR)
+ {
+ // *HACK: Adjust Z values automatically for liaisons &
+ // gods so they swoop down when they click on the
+ // map. Requested convenience.
+ if(gAgent.isGodlike())
+ {
+ pos_global[2] = 200;
+ }
+ }
+
+ getChild<LLUICtrl>("location")->setValue(sim_name);
+
+ // refresh coordinate display to reflect where user clicked.
+ LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
+ updateTeleportCoordsDisplay( coord_pos );
+
+ // simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
+ if ( gotSimName )
+ {
+ mSLURL = LLSLURL(sim_name, pos_global);
+ }
+ else
+ { // Empty SLURL will disable the "Copy SLURL to clipboard" button
+ mSLURL = LLSLURL();
+ }
+ }
}
void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S32 y_coord, S32 z_coord)
{
- LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromName(region_name);
- z_coord = llclamp(z_coord, 0, 4096);
- if (sim_info)
- {
- LLVector3 local_pos;
- local_pos.mV[VX] = (F32)x_coord;
- local_pos.mV[VY] = (F32)y_coord;
- local_pos.mV[VZ] = (F32)z_coord;
- LLVector3d global_pos = sim_info->getGlobalPos(local_pos);
- trackLocation(global_pos);
- setDefaultBtn("Teleport");
- }
- else
- {
- // fill in UI based on URL
- gFloaterWorldMap->getChild<LLUICtrl>("location")->setValue(region_name);
-
- // Save local coords to highlight position after region global
- // position is returned.
- gFloaterWorldMap->mCompletingRegionPos.set(
- (F32)x_coord, (F32)y_coord, (F32)z_coord);
-
- // pass sim name to combo box
- gFloaterWorldMap->mCompletingRegionName = region_name;
- LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name);
- LLStringUtil::toLower(gFloaterWorldMap->mCompletingRegionName);
- LLWorldMap::getInstance()->setTrackingCommit();
- }
+ LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromName(region_name);
+ z_coord = llclamp(z_coord, 0, 4096);
+ if (sim_info)
+ {
+ LLVector3 local_pos;
+ local_pos.mV[VX] = (F32)x_coord;
+ local_pos.mV[VY] = (F32)y_coord;
+ local_pos.mV[VZ] = (F32)z_coord;
+ LLVector3d global_pos = sim_info->getGlobalPos(local_pos);
+ trackLocation(global_pos);
+ setDefaultBtn("Teleport");
+ }
+ else
+ {
+ // fill in UI based on URL
+ gFloaterWorldMap->getChild<LLUICtrl>("location")->setValue(region_name);
+
+ // Save local coords to highlight position after region global
+ // position is returned.
+ gFloaterWorldMap->mCompletingRegionPos.set(
+ (F32)x_coord, (F32)y_coord, (F32)z_coord);
+
+ // pass sim name to combo box
+ gFloaterWorldMap->mCompletingRegionName = region_name;
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name);
+ LLStringUtil::toLower(gFloaterWorldMap->mCompletingRegionName);
+ LLWorldMap::getInstance()->setTrackingCommit();
+ }
}
void LLFloaterWorldMap::observeInventory(LLInventoryModel* model)
{
- if(mInventory)
- {
- mInventory->removeObserver(mInventoryObserver);
- delete mInventoryObserver;
- mInventory = NULL;
- mInventoryObserver = NULL;
- }
- if(model)
- {
- mInventory = model;
- mInventoryObserver = new LLMapInventoryObserver;
- // Inventory deletes all observers on shutdown
- mInventory->addObserver(mInventoryObserver);
- inventoryChanged();
- }
+ if(mInventory)
+ {
+ mInventory->removeObserver(mInventoryObserver);
+ delete mInventoryObserver;
+ mInventory = NULL;
+ mInventoryObserver = NULL;
+ }
+ if(model)
+ {
+ mInventory = model;
+ mInventoryObserver = new LLMapInventoryObserver;
+ // Inventory deletes all observers on shutdown
+ mInventory->addObserver(mInventoryObserver);
+ inventoryChanged();
+ }
}
void LLFloaterWorldMap::inventoryChanged()
{
- if(!LLTracker::getTrackedLandmarkItemID().isNull())
- {
- LLUUID item_id = LLTracker::getTrackedLandmarkItemID();
- buildLandmarkIDLists();
- trackLandmark(item_id);
- }
+ if(!LLTracker::getTrackedLandmarkItemID().isNull())
+ {
+ LLUUID item_id = LLTracker::getTrackedLandmarkItemID();
+ buildLandmarkIDLists();
+ trackLandmark(item_id);
+ }
}
void LLFloaterWorldMap::observeFriends()
{
- if(!mFriendObserver)
- {
- mFriendObserver = new LLMapFriendObserver;
- LLAvatarTracker::instance().addObserver(mFriendObserver);
- friendsChanged();
- }
+ if(!mFriendObserver)
+ {
+ mFriendObserver = new LLMapFriendObserver;
+ LLAvatarTracker::instance().addObserver(mFriendObserver);
+ friendsChanged();
+ }
}
void LLFloaterWorldMap::friendsChanged()
{
- LLAvatarTracker& t = LLAvatarTracker::instance();
- const LLUUID& avatar_id = t.getAvatarID();
- buildAvatarIDList();
- if(avatar_id.notNull())
- {
- LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo");
- const LLRelationship* buddy_info = t.getBuddyInfo(avatar_id);
- if(!iface ||
- !iface->setCurrentByID(avatar_id) ||
- (buddy_info && !buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) ||
- gAgent.isGodlike())
- {
- LLTracker::stopTracking(false);
- }
- }
+ LLAvatarTracker& t = LLAvatarTracker::instance();
+ const LLUUID& avatar_id = t.getAvatarID();
+ buildAvatarIDList();
+ if(avatar_id.notNull())
+ {
+ LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo");
+ const LLRelationship* buddy_info = t.getBuddyInfo(avatar_id);
+ if(!iface ||
+ !iface->setCurrentByID(avatar_id) ||
+ (buddy_info && !buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) ||
+ gAgent.isGodlike())
+ {
+ LLTracker::stopTracking(false);
+ }
+ }
}
// No longer really builds a list. Instead, just updates mAvatarCombo.
void LLFloaterWorldMap::buildAvatarIDList()
{
- LLCtrlListInterface *list = mListFriendCombo;
- if (!list) return;
-
+ LLCtrlListInterface *list = mListFriendCombo;
+ if (!list) return;
+
// Delete all but the "None" entry
- S32 list_size = list->getItemCount();
- if (list_size > 1)
- {
- list->selectItemRange(1, -1);
- list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
- }
-
- // Get all of the calling cards for avatar that are currently online
- LLCollectMappableBuddies collector;
- LLAvatarTracker::instance().applyFunctor(collector);
- LLCollectMappableBuddies::buddy_map_t::iterator it;
- LLCollectMappableBuddies::buddy_map_t::iterator end;
- it = collector.mMappable.begin();
- end = collector.mMappable.end();
- for( ; it != end; ++it)
- {
- list->addSimpleElement((*it).second, ADD_BOTTOM, (*it).first);
- }
-
- list->setCurrentByID( LLAvatarTracker::instance().getAvatarID() );
- list->selectFirstItem();
+ S32 list_size = list->getItemCount();
+ if (list_size > 1)
+ {
+ list->selectItemRange(1, -1);
+ list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
+ }
+
+ // Get all of the calling cards for avatar that are currently online
+ LLCollectMappableBuddies collector;
+ LLAvatarTracker::instance().applyFunctor(collector);
+ LLCollectMappableBuddies::buddy_map_t::iterator it;
+ LLCollectMappableBuddies::buddy_map_t::iterator end;
+ it = collector.mMappable.begin();
+ end = collector.mMappable.end();
+ for( ; it != end; ++it)
+ {
+ list->addSimpleElement((*it).second, ADD_BOTTOM, (*it).first);
+ }
+
+ list->setCurrentByID( LLAvatarTracker::instance().getAvatarID() );
+ list->selectFirstItem();
}
void LLFloaterWorldMap::buildLandmarkIDLists()
{
- LLCtrlListInterface *list = mListLandmarkCombo;
- if (!list) return;
-
+ LLCtrlListInterface *list = mListLandmarkCombo;
+ if (!list) return;
+
// Delete all but the "None" entry
- S32 list_size = list->getItemCount();
- if (list_size > 1)
- {
- list->selectItemRange(1, -1);
- list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
- }
-
- mLandmarkItemIDList.clear();
- mLandmarkAssetIDList.clear();
-
- // Get all of the current landmarks
- mLandmarkAssetIDList.push_back( LLUUID::null );
- mLandmarkItemIDList.push_back( LLUUID::null );
-
- mLandmarkAssetIDList.push_back( sHomeID );
- mLandmarkItemIDList.push_back( sHomeID );
-
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLIsType is_landmark(LLAssetType::AT_LANDMARK);
- gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_landmark);
-
- std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers());
-
- mLandmarkAssetIDList.reserve(mLandmarkAssetIDList.size() + items.size());
- mLandmarkItemIDList.reserve(mLandmarkItemIDList.size() + items.size());
-
- S32 count = items.size();
- for(S32 i = 0; i < count; ++i)
- {
- LLInventoryItem* item = items.at(i);
-
- list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID());
-
- mLandmarkAssetIDList.push_back( item->getAssetUUID() );
- mLandmarkItemIDList.push_back( item->getUUID() );
- }
-
- list->selectFirstItem();
-}
-
-
-F32 LLFloaterWorldMap::getDistanceToDestination(const LLVector3d &destination,
- F32 z_attenuation) const
-{
- LLVector3d delta = destination - gAgent.getPositionGlobal();
- // by attenuating the z-component we effectively
- // give more weight to the x-y plane
- delta.mdV[VZ] *= z_attenuation;
- F32 distance = (F32)delta.magVec();
- return distance;
+ S32 list_size = list->getItemCount();
+ if (list_size > 1)
+ {
+ list->selectItemRange(1, -1);
+ list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
+ }
+
+ mLandmarkItemIDList.clear();
+ mLandmarkAssetIDList.clear();
+
+ // Get all of the current landmarks
+ mLandmarkAssetIDList.push_back( LLUUID::null );
+ mLandmarkItemIDList.push_back( LLUUID::null );
+
+ mLandmarkAssetIDList.push_back( sHomeID );
+ mLandmarkItemIDList.push_back( sHomeID );
+
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLIsType is_landmark(LLAssetType::AT_LANDMARK);
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_landmark);
+
+ std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers());
+
+ mLandmarkAssetIDList.reserve(mLandmarkAssetIDList.size() + items.size());
+ mLandmarkItemIDList.reserve(mLandmarkItemIDList.size() + items.size());
+
+ S32 count = items.size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ LLInventoryItem* item = items.at(i);
+
+ list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID());
+
+ mLandmarkAssetIDList.push_back( item->getAssetUUID() );
+ mLandmarkItemIDList.push_back( item->getUUID() );
+ }
+
+ list->selectFirstItem();
+}
+
+
+F32 LLFloaterWorldMap::getDistanceToDestination(const LLVector3d &destination,
+ F32 z_attenuation) const
+{
+ LLVector3d delta = destination - gAgent.getPositionGlobal();
+ // by attenuating the z-component we effectively
+ // give more weight to the x-y plane
+ delta.mdV[VZ] *= z_attenuation;
+ F32 distance = (F32)delta.magVec();
+ return distance;
}
void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui, BOOL dest_reached)
{
- LLCtrlListInterface *list = mListSearchResults;
- if (list && (!dest_reached || (list->getItemCount() == 1)))
- {
- list->operateOnAll(LLCtrlListInterface::OP_DELETE);
- }
- LLWorldMap::getInstance()->cancelTracking();
- mCompletingRegionName = "";
+ LLCtrlListInterface *list = mListSearchResults;
+ if (list && (!dest_reached || (list->getItemCount() == 1)))
+ {
+ list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+ }
+ LLWorldMap::getInstance()->cancelTracking();
+ mCompletingRegionName = "";
}
void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui)
{
- if (clear_ui || !childHasKeyboardFocus("landmark combo"))
- {
- LLCtrlListInterface *list = mListLandmarkCombo;
- if (list)
- {
- list->selectByValue( "None" );
- }
- }
+ if (clear_ui || !childHasKeyboardFocus("landmark combo"))
+ {
+ LLCtrlListInterface *list = mListLandmarkCombo;
+ if (list)
+ {
+ list->selectByValue( "None" );
+ }
+ }
}
void LLFloaterWorldMap::clearAvatarSelection(BOOL clear_ui)
{
- if (clear_ui || !childHasKeyboardFocus("friend combo"))
- {
- mTrackedStatus = LLTracker::TRACKING_NOTHING;
- LLCtrlListInterface *list = mListFriendCombo;
- if (list && list->getSelectedValue().asString() != "None")
- {
- list->selectByValue( "None" );
- }
- }
+ if (clear_ui || !childHasKeyboardFocus("friend combo"))
+ {
+ mTrackedStatus = LLTracker::TRACKING_NOTHING;
+ LLCtrlListInterface *list = mListFriendCombo;
+ if (list && list->getSelectedValue().asString() != "None")
+ {
+ list->selectByValue( "None" );
+ }
+ }
}
@@ -1048,38 +1048,38 @@ void LLFloaterWorldMap::clearAvatarSelection(BOOL clear_ui)
// can see the whole world, plus a little.
void LLFloaterWorldMap::adjustZoomSliderBounds()
{
- // Merov: we switched from using the "world size" (which varies depending where the user went) to a fixed
- // width of 512 regions max visible at a time. This makes the zoom slider works in a consistent way across
- // sessions and doesn't prevent the user to pan the world if it was to grow a lot beyond that limit.
- // Currently (01/26/09), this value allows the whole grid to be visible in a 1024x1024 window.
- S32 world_width_regions = MAX_VISIBLE_REGIONS;
- S32 world_height_regions = MAX_VISIBLE_REGIONS;
-
- // Find how much space we have to display the world
+ // Merov: we switched from using the "world size" (which varies depending where the user went) to a fixed
+ // width of 512 regions max visible at a time. This makes the zoom slider works in a consistent way across
+ // sessions and doesn't prevent the user to pan the world if it was to grow a lot beyond that limit.
+ // Currently (01/26/09), this value allows the whole grid to be visible in a 1024x1024 window.
+ S32 world_width_regions = MAX_VISIBLE_REGIONS;
+ S32 world_height_regions = MAX_VISIBLE_REGIONS;
+
+ // Find how much space we have to display the world
LLRect view_rect = mMapView->getRect();
-
- // View size in pixels
- S32 view_width = view_rect.getWidth();
- S32 view_height = view_rect.getHeight();
-
- // Pixels per region to display entire width/height
- F32 width_pixels_per_region = (F32) view_width / (F32) world_width_regions;
- F32 height_pixels_per_region = (F32) view_height / (F32) world_height_regions;
-
- F32 pixels_per_region = llmin(width_pixels_per_region,
- height_pixels_per_region);
-
- // Round pixels per region to an even number of slider increments
- S32 slider_units = llfloor(pixels_per_region / 0.2f);
- pixels_per_region = slider_units * 0.2f;
-
- // Make sure the zoom slider can be moved at least a little bit.
- // Likewise, less than the increment pixels per region is just silly.
- pixels_per_region = llclamp(pixels_per_region, 1.f, ZOOM_MAX);
-
- F32 min_power = log(pixels_per_region/256.f)/log(2.f);
-
- getChild<LLSliderCtrl>("zoom slider")->setMinValue(min_power);
+
+ // View size in pixels
+ S32 view_width = view_rect.getWidth();
+ S32 view_height = view_rect.getHeight();
+
+ // Pixels per region to display entire width/height
+ F32 width_pixels_per_region = (F32) view_width / (F32) world_width_regions;
+ F32 height_pixels_per_region = (F32) view_height / (F32) world_height_regions;
+
+ F32 pixels_per_region = llmin(width_pixels_per_region,
+ height_pixels_per_region);
+
+ // Round pixels per region to an even number of slider increments
+ S32 slider_units = llfloor(pixels_per_region / 0.2f);
+ pixels_per_region = slider_units * 0.2f;
+
+ // Make sure the zoom slider can be moved at least a little bit.
+ // Likewise, less than the increment pixels per region is just silly.
+ pixels_per_region = llclamp(pixels_per_region, 1.f, ZOOM_MAX);
+
+ F32 min_power = log(pixels_per_region/256.f)/log(2.f);
+
+ getChild<LLSliderCtrl>("zoom slider")->setMinValue(min_power);
}
@@ -1089,237 +1089,237 @@ void LLFloaterWorldMap::adjustZoomSliderBounds()
void LLFloaterWorldMap::onGoHome()
{
- gAgent.teleportHome();
- closeFloater();
+ gAgent.teleportHome();
+ closeFloater();
}
void LLFloaterWorldMap::onLandmarkComboPrearrange( )
{
- if( mIsClosing )
- {
- return;
- }
-
- LLCtrlListInterface *list = mListLandmarkCombo;
- if (!list) return;
-
- LLUUID current_choice = list->getCurrentID();
-
- buildLandmarkIDLists();
-
- if( current_choice.isNull() || !list->setCurrentByID( current_choice ) )
- {
- LLTracker::stopTracking(false);
- }
-
+ if( mIsClosing )
+ {
+ return;
+ }
+
+ LLCtrlListInterface *list = mListLandmarkCombo;
+ if (!list) return;
+
+ LLUUID current_choice = list->getCurrentID();
+
+ buildLandmarkIDLists();
+
+ if( current_choice.isNull() || !list->setCurrentByID( current_choice ) )
+ {
+ LLTracker::stopTracking(false);
+ }
+
}
void LLFloaterWorldMap::onComboTextEntry()
{
- // Reset the tracking whenever we start typing into any of the search fields,
- // so that hitting <enter> does an auto-complete versus teleporting us to the
- // previously selected landmark/friend.
- LLTracker::stopTracking(false);
+ // Reset the tracking whenever we start typing into any of the search fields,
+ // so that hitting <enter> does an auto-complete versus teleporting us to the
+ // previously selected landmark/friend.
+ LLTracker::stopTracking(false);
}
void LLFloaterWorldMap::onSearchTextEntry( )
{
- onComboTextEntry();
- updateSearchEnabled();
+ onComboTextEntry();
+ updateSearchEnabled();
}
void LLFloaterWorldMap::onLandmarkComboCommit()
{
- if( mIsClosing )
- {
- return;
- }
-
- LLCtrlListInterface *list = mListLandmarkCombo;
- if (!list) return;
-
- LLUUID asset_id;
- LLUUID item_id = list->getCurrentID();
-
- LLTracker::stopTracking(false);
-
- //RN: stopTracking() clears current combobox selection, need to reassert it here
- list->setCurrentByID(item_id);
-
- if( item_id.isNull() )
- {
- }
- else if( item_id == sHomeID )
- {
- asset_id = sHomeID;
- }
- else
- {
- LLInventoryItem* item = gInventory.getItem( item_id );
- if( item )
- {
- asset_id = item->getAssetUUID();
- }
- else
- {
- // Something went wrong, so revert to a safe value.
- item_id.setNull();
- }
- }
-
- trackLandmark( item_id);
- onShowTargetBtn();
-
- // Reset to user postion if nothing is tracked
- mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
-}
-
-// static
+ if( mIsClosing )
+ {
+ return;
+ }
+
+ LLCtrlListInterface *list = mListLandmarkCombo;
+ if (!list) return;
+
+ LLUUID asset_id;
+ LLUUID item_id = list->getCurrentID();
+
+ LLTracker::stopTracking(false);
+
+ //RN: stopTracking() clears current combobox selection, need to reassert it here
+ list->setCurrentByID(item_id);
+
+ if( item_id.isNull() )
+ {
+ }
+ else if( item_id == sHomeID )
+ {
+ asset_id = sHomeID;
+ }
+ else
+ {
+ LLInventoryItem* item = gInventory.getItem( item_id );
+ if( item )
+ {
+ asset_id = item->getAssetUUID();
+ }
+ else
+ {
+ // Something went wrong, so revert to a safe value.
+ item_id.setNull();
+ }
+ }
+
+ trackLandmark( item_id);
+ onShowTargetBtn();
+
+ // Reset to user postion if nothing is tracked
+ mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
+}
+
+// static
void LLFloaterWorldMap::onAvatarComboPrearrange( )
{
- if( mIsClosing )
- {
- return;
- }
-
- LLCtrlListInterface *list = mListFriendCombo;
- if (!list) return;
-
- LLUUID current_choice;
-
- if( LLAvatarTracker::instance().haveTrackingInfo() )
- {
- current_choice = LLAvatarTracker::instance().getAvatarID();
- }
-
- buildAvatarIDList();
-
- if( !list->setCurrentByID( current_choice ) || current_choice.isNull() )
- {
- LLTracker::stopTracking(false);
- }
+ if( mIsClosing )
+ {
+ return;
+ }
+
+ LLCtrlListInterface *list = mListFriendCombo;
+ if (!list) return;
+
+ LLUUID current_choice;
+
+ if( LLAvatarTracker::instance().haveTrackingInfo() )
+ {
+ current_choice = LLAvatarTracker::instance().getAvatarID();
+ }
+
+ buildAvatarIDList();
+
+ if( !list->setCurrentByID( current_choice ) || current_choice.isNull() )
+ {
+ LLTracker::stopTracking(false);
+ }
}
void LLFloaterWorldMap::onAvatarComboCommit()
{
- if( mIsClosing )
- {
- return;
- }
-
- LLCtrlListInterface *list = mListFriendCombo;
- if (!list) return;
-
- const LLUUID& new_avatar_id = list->getCurrentID();
- if (new_avatar_id.notNull())
- {
- std::string name;
- LLComboBox* combo = getChild<LLComboBox>("friend combo");
- if (combo) name = combo->getSimple();
- trackAvatar(new_avatar_id, name);
- onShowTargetBtn();
- }
- else
- { // Reset to user postion if nothing is tracked
- mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
- }
-}
-
-void LLFloaterWorldMap::avatarTrackFromSlapp( const LLUUID& id )
-{
- trackAvatar( id, "av" );
- onShowTargetBtn();
+ if( mIsClosing )
+ {
+ return;
+ }
+
+ LLCtrlListInterface *list = mListFriendCombo;
+ if (!list) return;
+
+ const LLUUID& new_avatar_id = list->getCurrentID();
+ if (new_avatar_id.notNull())
+ {
+ std::string name;
+ LLComboBox* combo = getChild<LLComboBox>("friend combo");
+ if (combo) name = combo->getSimple();
+ trackAvatar(new_avatar_id, name);
+ onShowTargetBtn();
+ }
+ else
+ { // Reset to user postion if nothing is tracked
+ mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
+ }
+}
+
+void LLFloaterWorldMap::avatarTrackFromSlapp( const LLUUID& id )
+{
+ trackAvatar( id, "av" );
+ onShowTargetBtn();
}
void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus )
{
- updateSearchEnabled();
+ updateSearchEnabled();
}
void LLFloaterWorldMap::updateSearchEnabled()
{
- if (childHasKeyboardFocus("location") &&
- getChild<LLUICtrl>("location")->getValue().asString().length() > 0)
- {
- setDefaultBtn("DoSearch");
- }
- else
- {
- setDefaultBtn(NULL);
- }
+ if (childHasKeyboardFocus("location") &&
+ getChild<LLUICtrl>("location")->getValue().asString().length() > 0)
+ {
+ setDefaultBtn("DoSearch");
+ }
+ else
+ {
+ setDefaultBtn(NULL);
+ }
}
void LLFloaterWorldMap::onLocationCommit()
{
- if( mIsClosing )
- {
- return;
- }
-
- clearLocationSelection(FALSE);
- mCompletingRegionName = "";
- mLastRegionName = "";
-
- std::string str = getChild<LLUICtrl>("location")->getValue().asString();
-
- // Trim any leading and trailing spaces in the search target
- std::string saved_str = str;
- LLStringUtil::trim( str );
- if ( str != saved_str )
- { // Set the value in the UI if any spaces were removed
- getChild<LLUICtrl>("location")->setValue(str);
- }
-
- // Don't try completing empty name (STORM-1427).
- if (str.empty())
- {
- return;
- }
-
- LLStringUtil::toLower(str);
- mCompletingRegionName = str;
- LLWorldMap::getInstance()->setTrackingCommit();
- if (str.length() >= 3)
- {
- LLWorldMapMessage::getInstance()->sendNamedRegionRequest(str);
- }
- else
- {
- str += "#";
- LLWorldMapMessage::getInstance()->sendNamedRegionRequest(str);
- }
+ if( mIsClosing )
+ {
+ return;
+ }
+
+ clearLocationSelection(FALSE);
+ mCompletingRegionName = "";
+ mLastRegionName = "";
+
+ std::string str = getChild<LLUICtrl>("location")->getValue().asString();
+
+ // Trim any leading and trailing spaces in the search target
+ std::string saved_str = str;
+ LLStringUtil::trim( str );
+ if ( str != saved_str )
+ { // Set the value in the UI if any spaces were removed
+ getChild<LLUICtrl>("location")->setValue(str);
+ }
+
+ // Don't try completing empty name (STORM-1427).
+ if (str.empty())
+ {
+ return;
+ }
+
+ LLStringUtil::toLower(str);
+ mCompletingRegionName = str;
+ LLWorldMap::getInstance()->setTrackingCommit();
+ if (str.length() >= 3)
+ {
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(str);
+ }
+ else
+ {
+ str += "#";
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(str);
+ }
}
void LLFloaterWorldMap::onCoordinatesCommit()
{
- if( mIsClosing )
- {
- return;
- }
-
- S32 x_coord = (S32)childGetValue("teleport_coordinate_x").asReal();
- S32 y_coord = (S32)childGetValue("teleport_coordinate_y").asReal();
- S32 z_coord = (S32)childGetValue("teleport_coordinate_z").asReal();
-
- const std::string region_name = childGetValue("location").asString();
-
- trackURL( region_name, x_coord, y_coord, z_coord );
+ if( mIsClosing )
+ {
+ return;
+ }
+
+ S32 x_coord = (S32)childGetValue("teleport_coordinate_x").asReal();
+ S32 y_coord = (S32)childGetValue("teleport_coordinate_y").asReal();
+ S32 z_coord = (S32)childGetValue("teleport_coordinate_z").asReal();
+
+ const std::string region_name = childGetValue("location").asString();
+
+ trackURL( region_name, x_coord, y_coord, z_coord );
}
void LLFloaterWorldMap::onClearBtn()
{
- mTrackedStatus = LLTracker::TRACKING_NOTHING;
- LLTracker::stopTracking(true);
- LLWorldMap::getInstance()->cancelTracking();
- mSLURL = LLSLURL(); // Clear the SLURL since it's invalid
- mSetToUserPosition = TRUE; // Revert back to the current user position
+ mTrackedStatus = LLTracker::TRACKING_NOTHING;
+ LLTracker::stopTracking(true);
+ LLWorldMap::getInstance()->cancelTracking();
+ mSLURL = LLSLURL(); // Clear the SLURL since it's invalid
+ mSetToUserPosition = TRUE; // Revert back to the current user position
}
void LLFloaterWorldMap::onShowTargetBtn()
{
- centerOnTarget(TRUE);
+ centerOnTarget(TRUE);
}
void LLFloaterWorldMap::onShowAgentBtn()
@@ -1331,28 +1331,28 @@ void LLFloaterWorldMap::onShowAgentBtn()
void LLFloaterWorldMap::onClickTeleportBtn()
{
- teleport();
+ teleport();
}
void LLFloaterWorldMap::onCopySLURL()
{
- getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL.getSLURLString()));
-
- LLSD args;
- args["SLURL"] = mSLURL.getSLURLString();
-
- LLNotificationsUtil::add("CopySLURL", args);
+ getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL.getSLURLString()));
+
+ LLSD args;
+ args["SLURL"] = mSLURL.getSLURLString();
+
+ LLNotificationsUtil::add("CopySLURL", args);
}
void LLFloaterWorldMap::onExpandCollapseBtn()
{
LLLayoutStack* floater_stack = getChild<LLLayoutStack>("floater_map_stack");
LLLayoutPanel* controls_panel = getChild<LLLayoutPanel>("controls_lp");
-
+
bool toggle_collapse = !controls_panel->isCollapsed();
floater_stack->collapsePanel(controls_panel, toggle_collapse);
floater_stack->updateLayout();
-
+
std::string image_name = getString(toggle_collapse ? "expand_icon" : "collapse_icon");
std::string tooltip = getString(toggle_collapse ? "expand_tooltip" : "collapse_tooltip");
getChild<LLIconCtrl>("expand_collapse_icon")->setImage(LLUI::getUIImage(image_name));
@@ -1363,264 +1363,264 @@ void LLFloaterWorldMap::onExpandCollapseBtn()
// protected
void LLFloaterWorldMap::centerOnTarget(BOOL animate)
{
- LLVector3d pos_global;
- if(LLTracker::getTrackingStatus() != LLTracker::TRACKING_NOTHING)
- {
- LLVector3d tracked_position = LLTracker::getTrackedPositionGlobal();
- //RN: tracker doesn't allow us to query completion, so we check for a tracking position of
- // absolute zero, and keep trying in the draw loop
- if (tracked_position.isExactlyZero())
- {
- mWaitingForTracker = TRUE;
- return;
- }
- else
- {
- // We've got the position finally, so we're no longer busy. JC
- // getWindow()->decBusyCount();
- pos_global = LLTracker::getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();
- }
- }
- else if(LLWorldMap::getInstance()->isTracking())
- {
- pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();;
-
-
-
- }
- else
- {
- // default behavior = center on agent
- pos_global.clearVec();
- }
-
+ LLVector3d pos_global;
+ if(LLTracker::getTrackingStatus() != LLTracker::TRACKING_NOTHING)
+ {
+ LLVector3d tracked_position = LLTracker::getTrackedPositionGlobal();
+ //RN: tracker doesn't allow us to query completion, so we check for a tracking position of
+ // absolute zero, and keep trying in the draw loop
+ if (tracked_position.isExactlyZero())
+ {
+ mWaitingForTracker = TRUE;
+ return;
+ }
+ else
+ {
+ // We've got the position finally, so we're no longer busy. JC
+ // getWindow()->decBusyCount();
+ pos_global = LLTracker::getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();
+ }
+ }
+ else if(LLWorldMap::getInstance()->isTracking())
+ {
+ pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();;
+
+
+
+ }
+ else
+ {
+ // default behavior = center on agent
+ pos_global.clearVec();
+ }
+
F64 map_scale = (F64)mMapView->getScale();
mMapView->setPanWithInterpTime(-llfloor((F32)(pos_global.mdV[VX] * map_scale / REGION_WIDTH_METERS)),
-llfloor((F32)(pos_global.mdV[VY] * map_scale / REGION_WIDTH_METERS)),
!animate, 0.1f);
- mWaitingForTracker = FALSE;
+ mWaitingForTracker = FALSE;
}
// protected
void LLFloaterWorldMap::fly()
{
- LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
-
- // Start the autopilot and close the floater,
- // so we can see where we're flying
- if (!pos_global.isExactlyZero())
- {
- gAgent.startAutoPilotGlobal( pos_global );
- closeFloater();
- }
- else
- {
- make_ui_sound("UISndInvalidOp");
- }
+ LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
+
+ // Start the autopilot and close the floater,
+ // so we can see where we're flying
+ if (!pos_global.isExactlyZero())
+ {
+ gAgent.startAutoPilotGlobal( pos_global );
+ closeFloater();
+ }
+ else
+ {
+ make_ui_sound("UISndInvalidOp");
+ }
}
// protected
void LLFloaterWorldMap::teleport()
{
- BOOL teleport_home = FALSE;
- LLVector3d pos_global;
- LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
-
- LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
- if (LLTracker::TRACKING_AVATAR == tracking_status
- && av_tracker.haveTrackingInfo() )
- {
- pos_global = av_tracker.getGlobalPos();
- pos_global.mdV[VZ] = getChild<LLUICtrl>("teleport_coordinate_z")->getValue();
- }
- else if ( LLTracker::TRACKING_LANDMARK == tracking_status)
- {
- if( LLTracker::getTrackedLandmarkAssetID() == sHomeID )
- {
- teleport_home = TRUE;
- }
- else
- {
- LLLandmark* landmark = gLandmarkList.getAsset( LLTracker::getTrackedLandmarkAssetID() );
- LLUUID region_id;
- if(landmark
- && !landmark->getGlobalPos(pos_global)
- && landmark->getRegionID(region_id))
- {
- LLLandmark::requestRegionHandle(
- gMessageSystem,
- gAgent.getRegionHost(),
- region_id,
- NULL);
- }
- }
- }
- else if ( LLTracker::TRACKING_LOCATION == tracking_status)
- {
- pos_global = LLTracker::getTrackedPositionGlobal();
- }
- else
- {
- make_ui_sound("UISndInvalidOp");
- }
-
- // Do the teleport, which will also close the floater
- if (teleport_home)
- {
- gAgent.teleportHome();
- }
- else if (!pos_global.isExactlyZero())
- {
- if(LLTracker::TRACKING_LANDMARK == tracking_status)
- {
- gAgent.teleportViaLandmark(LLTracker::getTrackedLandmarkAssetID());
- }
- else
- {
- gAgent.teleportViaLocation( pos_global );
- }
- }
+ BOOL teleport_home = FALSE;
+ LLVector3d pos_global;
+ LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
+
+ LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
+ if (LLTracker::TRACKING_AVATAR == tracking_status
+ && av_tracker.haveTrackingInfo() )
+ {
+ pos_global = av_tracker.getGlobalPos();
+ pos_global.mdV[VZ] = getChild<LLUICtrl>("teleport_coordinate_z")->getValue();
+ }
+ else if ( LLTracker::TRACKING_LANDMARK == tracking_status)
+ {
+ if( LLTracker::getTrackedLandmarkAssetID() == sHomeID )
+ {
+ teleport_home = TRUE;
+ }
+ else
+ {
+ LLLandmark* landmark = gLandmarkList.getAsset( LLTracker::getTrackedLandmarkAssetID() );
+ LLUUID region_id;
+ if(landmark
+ && !landmark->getGlobalPos(pos_global)
+ && landmark->getRegionID(region_id))
+ {
+ LLLandmark::requestRegionHandle(
+ gMessageSystem,
+ gAgent.getRegionHost(),
+ region_id,
+ NULL);
+ }
+ }
+ }
+ else if ( LLTracker::TRACKING_LOCATION == tracking_status)
+ {
+ pos_global = LLTracker::getTrackedPositionGlobal();
+ }
+ else
+ {
+ make_ui_sound("UISndInvalidOp");
+ }
+
+ // Do the teleport, which will also close the floater
+ if (teleport_home)
+ {
+ gAgent.teleportHome();
+ }
+ else if (!pos_global.isExactlyZero())
+ {
+ if(LLTracker::TRACKING_LANDMARK == tracking_status)
+ {
+ gAgent.teleportViaLandmark(LLTracker::getTrackedLandmarkAssetID());
+ }
+ else
+ {
+ gAgent.teleportViaLocation( pos_global );
+ }
+ }
}
void LLFloaterWorldMap::flyToLandmark()
{
- LLVector3d destination_pos_global;
- if( !LLTracker::getTrackedLandmarkAssetID().isNull() )
- {
- if (LLTracker::hasLandmarkPosition())
- {
- gAgent.startAutoPilotGlobal( LLTracker::getTrackedPositionGlobal() );
- }
- }
+ LLVector3d destination_pos_global;
+ if( !LLTracker::getTrackedLandmarkAssetID().isNull() )
+ {
+ if (LLTracker::hasLandmarkPosition())
+ {
+ gAgent.startAutoPilotGlobal( LLTracker::getTrackedPositionGlobal() );
+ }
+ }
}
void LLFloaterWorldMap::teleportToLandmark()
{
- BOOL has_destination = FALSE;
- LLUUID destination_id; // Null means "home"
-
- if( LLTracker::getTrackedLandmarkAssetID() == sHomeID )
- {
- has_destination = TRUE;
- }
- else
- {
- LLLandmark* landmark = gLandmarkList.getAsset( LLTracker::getTrackedLandmarkAssetID() );
- LLVector3d global_pos;
- if(landmark && landmark->getGlobalPos(global_pos))
- {
- destination_id = LLTracker::getTrackedLandmarkAssetID();
- has_destination = TRUE;
- }
- else if(landmark)
- {
- // pop up an anonymous request request.
- LLUUID region_id;
- if(landmark->getRegionID(region_id))
- {
- LLLandmark::requestRegionHandle(
- gMessageSystem,
- gAgent.getRegionHost(),
- region_id,
- NULL);
- }
- }
- }
-
- if( has_destination )
- {
- gAgent.teleportViaLandmark( destination_id );
- }
+ BOOL has_destination = FALSE;
+ LLUUID destination_id; // Null means "home"
+
+ if( LLTracker::getTrackedLandmarkAssetID() == sHomeID )
+ {
+ has_destination = TRUE;
+ }
+ else
+ {
+ LLLandmark* landmark = gLandmarkList.getAsset( LLTracker::getTrackedLandmarkAssetID() );
+ LLVector3d global_pos;
+ if(landmark && landmark->getGlobalPos(global_pos))
+ {
+ destination_id = LLTracker::getTrackedLandmarkAssetID();
+ has_destination = TRUE;
+ }
+ else if(landmark)
+ {
+ // pop up an anonymous request request.
+ LLUUID region_id;
+ if(landmark->getRegionID(region_id))
+ {
+ LLLandmark::requestRegionHandle(
+ gMessageSystem,
+ gAgent.getRegionHost(),
+ region_id,
+ NULL);
+ }
+ }
+ }
+
+ if( has_destination )
+ {
+ gAgent.teleportViaLandmark( destination_id );
+ }
}
void LLFloaterWorldMap::teleportToAvatar()
{
- LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
- if(av_tracker.haveTrackingInfo())
- {
- LLVector3d pos_global = av_tracker.getGlobalPos();
- gAgent.teleportViaLocation( pos_global );
- }
+ LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
+ if(av_tracker.haveTrackingInfo())
+ {
+ LLVector3d pos_global = av_tracker.getGlobalPos();
+ gAgent.teleportViaLocation( pos_global );
+ }
}
void LLFloaterWorldMap::flyToAvatar()
{
- if( LLAvatarTracker::instance().haveTrackingInfo() )
- {
- gAgent.startAutoPilotGlobal( LLAvatarTracker::instance().getGlobalPos() );
- }
+ if( LLAvatarTracker::instance().haveTrackingInfo() )
+ {
+ gAgent.startAutoPilotGlobal( LLAvatarTracker::instance().getGlobalPos() );
+ }
}
void LLFloaterWorldMap::updateSims(bool found_null_sim)
{
- if (mCompletingRegionName == "")
- {
- return;
- }
-
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results");
- list->operateOnAll(LLCtrlListInterface::OP_DELETE);
-
- S32 name_length = mCompletingRegionName.length();
-
- LLSD match;
-
- S32 num_results = 0;
-
- std::vector<std::pair <U64, LLSimInfo*> > sim_info_vec(LLWorldMap::getInstance()->getRegionMap().begin(), LLWorldMap::getInstance()->getRegionMap().end());
- std::sort(sim_info_vec.begin(), sim_info_vec.end(), SortRegionNames());
-
- for (std::vector<std::pair <U64, LLSimInfo*> >::const_iterator it = sim_info_vec.begin(); it != sim_info_vec.end(); ++it)
- {
- LLSimInfo* info = it->second;
- std::string sim_name_lower = info->getName();
- LLStringUtil::toLower(sim_name_lower);
-
- if (sim_name_lower.substr(0, name_length) == mCompletingRegionName)
- {
- if (sim_name_lower == mCompletingRegionName)
- {
- match = info->getName();
- }
-
- LLSD value;
- value["id"] = info->getName();
- value["columns"][0]["column"] = "sim_name";
- value["columns"][0]["value"] = info->getName();
- list->addElement(value);
- num_results++;
- }
- }
-
- if (found_null_sim)
- {
- mCompletingRegionName = "";
- }
-
- if (num_results > 0)
- {
- // if match found, highlight it and go
- if (!match.isUndefined())
- {
- list->selectByValue(match);
- }
- // else select first found item
- else
- {
- list->selectFirstItem();
- }
- getChild<LLUICtrl>("search_results")->setFocus(TRUE);
- onCommitSearchResult();
- }
- else
- {
- // if we found nothing, say "none"
- list->setCommentText(LLTrans::getString("worldmap_results_none_found"));
- list->operateOnAll(LLCtrlListInterface::OP_DESELECT);
- }
+ if (mCompletingRegionName == "")
+ {
+ return;
+ }
+
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results");
+ list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+
+ S32 name_length = mCompletingRegionName.length();
+
+ LLSD match;
+
+ S32 num_results = 0;
+
+ std::vector<std::pair <U64, LLSimInfo*> > sim_info_vec(LLWorldMap::getInstance()->getRegionMap().begin(), LLWorldMap::getInstance()->getRegionMap().end());
+ std::sort(sim_info_vec.begin(), sim_info_vec.end(), SortRegionNames());
+
+ for (std::vector<std::pair <U64, LLSimInfo*> >::const_iterator it = sim_info_vec.begin(); it != sim_info_vec.end(); ++it)
+ {
+ LLSimInfo* info = it->second;
+ std::string sim_name_lower = info->getName();
+ LLStringUtil::toLower(sim_name_lower);
+
+ if (sim_name_lower.substr(0, name_length) == mCompletingRegionName)
+ {
+ if (sim_name_lower == mCompletingRegionName)
+ {
+ match = info->getName();
+ }
+
+ LLSD value;
+ value["id"] = info->getName();
+ value["columns"][0]["column"] = "sim_name";
+ value["columns"][0]["value"] = info->getName();
+ list->addElement(value);
+ num_results++;
+ }
+ }
+
+ if (found_null_sim)
+ {
+ mCompletingRegionName = "";
+ }
+
+ if (num_results > 0)
+ {
+ // if match found, highlight it and go
+ if (!match.isUndefined())
+ {
+ list->selectByValue(match);
+ }
+ // else select first found item
+ else
+ {
+ list->selectFirstItem();
+ }
+ getChild<LLUICtrl>("search_results")->setFocus(TRUE);
+ onCommitSearchResult();
+ }
+ else
+ {
+ // if we found nothing, say "none"
+ list->setCommentText(LLTrans::getString("worldmap_results_none_found"));
+ list->operateOnAll(LLCtrlListInterface::OP_DESELECT);
+ }
}
void LLFloaterWorldMap::onTeleportFinished()
@@ -1633,71 +1633,71 @@ void LLFloaterWorldMap::onTeleportFinished()
void LLFloaterWorldMap::onCommitSearchResult()
{
- LLCtrlListInterface *list = mListSearchResults;
- if (!list) return;
-
- LLSD selected_value = list->getSelectedValue();
- std::string sim_name = selected_value.asString();
- if (sim_name.empty())
- {
- return;
- }
- LLStringUtil::toLower(sim_name);
-
- std::map<U64, LLSimInfo*>::const_iterator it;
- for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
- {
- LLSimInfo* info = it->second;
-
- if (info->isName(sim_name))
- {
- LLVector3d pos_global = info->getGlobalOrigin();
-
- const F64 SIM_COORD_DEFAULT = 128.0;
- LLVector3 pos_local(SIM_COORD_DEFAULT, SIM_COORD_DEFAULT, 0.0f);
-
- // Did this value come from a trackURL() request?
- if (!mCompletingRegionPos.isExactlyZero())
- {
- pos_local = mCompletingRegionPos;
- mCompletingRegionPos.clear();
- }
- pos_global.mdV[VX] += (F64)pos_local.mV[VX];
- pos_global.mdV[VY] += (F64)pos_local.mV[VY];
- pos_global.mdV[VZ] = (F64)pos_local.mV[VZ];
-
- getChild<LLUICtrl>("location")->setValue(sim_name);
- trackLocation(pos_global);
- setDefaultBtn("Teleport");
- break;
- }
- }
-
- onShowTargetBtn();
+ LLCtrlListInterface *list = mListSearchResults;
+ if (!list) return;
+
+ LLSD selected_value = list->getSelectedValue();
+ std::string sim_name = selected_value.asString();
+ if (sim_name.empty())
+ {
+ return;
+ }
+ LLStringUtil::toLower(sim_name);
+
+ std::map<U64, LLSimInfo*>::const_iterator it;
+ for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
+ {
+ LLSimInfo* info = it->second;
+
+ if (info->isName(sim_name))
+ {
+ LLVector3d pos_global = info->getGlobalOrigin();
+
+ const F64 SIM_COORD_DEFAULT = 128.0;
+ LLVector3 pos_local(SIM_COORD_DEFAULT, SIM_COORD_DEFAULT, 0.0f);
+
+ // Did this value come from a trackURL() request?
+ if (!mCompletingRegionPos.isExactlyZero())
+ {
+ pos_local = mCompletingRegionPos;
+ mCompletingRegionPos.clear();
+ }
+ pos_global.mdV[VX] += (F64)pos_local.mV[VX];
+ pos_global.mdV[VY] += (F64)pos_local.mV[VY];
+ pos_global.mdV[VZ] = (F64)pos_local.mV[VZ];
+
+ getChild<LLUICtrl>("location")->setValue(sim_name);
+ trackLocation(pos_global);
+ setDefaultBtn("Teleport");
+ break;
+ }
+ }
+
+ onShowTargetBtn();
}
void LLFloaterWorldMap::onChangeMaturity()
{
- bool can_access_mature = gAgent.canAccessMature();
- bool can_access_adult = gAgent.canAccessAdult();
-
- getChildView("events_mature_icon")->setVisible( can_access_mature);
- getChildView("events_mature_label")->setVisible( can_access_mature);
- getChildView("events_mature_chk")->setVisible( can_access_mature);
-
- getChildView("events_adult_icon")->setVisible( can_access_adult);
- getChildView("events_adult_label")->setVisible( can_access_adult);
- getChildView("events_adult_chk")->setVisible( can_access_adult);
-
- // disable mature / adult events.
- if (!can_access_mature)
- {
- gSavedSettings.setBOOL("ShowMatureEvents", FALSE);
- }
- if (!can_access_adult)
- {
- gSavedSettings.setBOOL("ShowAdultEvents", FALSE);
- }
+ bool can_access_mature = gAgent.canAccessMature();
+ bool can_access_adult = gAgent.canAccessAdult();
+
+ getChildView("events_mature_icon")->setVisible( can_access_mature);
+ getChildView("events_mature_label")->setVisible( can_access_mature);
+ getChildView("events_mature_chk")->setVisible( can_access_mature);
+
+ getChildView("events_adult_icon")->setVisible( can_access_adult);
+ getChildView("events_adult_label")->setVisible( can_access_adult);
+ getChildView("events_adult_chk")->setVisible( can_access_adult);
+
+ // disable mature / adult events.
+ if (!can_access_mature)
+ {
+ gSavedSettings.setBOOL("ShowMatureEvents", FALSE);
+ }
+ if (!can_access_adult)
+ {
+ gSavedSettings.setBOOL("ShowAdultEvents", FALSE);
+ }
}
void LLFloaterWorldMap::onFocusLost()
@@ -1707,74 +1707,74 @@ void LLFloaterWorldMap::onFocusLost()
}
LLPanelHideBeacon::LLPanelHideBeacon() :
- mHideButton(NULL)
+ mHideButton(NULL)
{
}
// static
LLPanelHideBeacon* LLPanelHideBeacon::getInstance()
{
- static LLPanelHideBeacon* panel = getPanelHideBeacon();
- return panel;
+ static LLPanelHideBeacon* panel = getPanelHideBeacon();
+ return panel;
}
BOOL LLPanelHideBeacon::postBuild()
{
- mHideButton = getChild<LLButton>("hide_beacon_btn");
- mHideButton->setCommitCallback(boost::bind(&LLPanelHideBeacon::onHideButtonClick, this));
+ mHideButton = getChild<LLButton>("hide_beacon_btn");
+ mHideButton->setCommitCallback(boost::bind(&LLPanelHideBeacon::onHideButtonClick, this));
- gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLPanelHideBeacon::updatePosition, this));
+ gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLPanelHideBeacon::updatePosition, this));
- return TRUE;
+ return TRUE;
}
//virtual
void LLPanelHideBeacon::draw()
{
- if (!LLTracker::isTracking(NULL))
- {
+ if (!LLTracker::isTracking(NULL))
+ {
mHideButton->setVisible(false);
return;
- }
+ }
mHideButton->setVisible(true);
- updatePosition();
- LLPanel::draw();
+ updatePosition();
+ LLPanel::draw();
}
//virtual
void LLPanelHideBeacon::setVisible(BOOL visible)
{
- if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false;
+ if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false;
- if (visible)
- {
- updatePosition();
- }
+ if (visible)
+ {
+ updatePosition();
+ }
- LLPanel::setVisible(visible);
+ LLPanel::setVisible(visible);
}
//static
LLPanelHideBeacon* LLPanelHideBeacon::getPanelHideBeacon()
{
- LLPanelHideBeacon* panel = new LLPanelHideBeacon();
- panel->buildFromFile("panel_hide_beacon.xml");
+ LLPanelHideBeacon* panel = new LLPanelHideBeacon();
+ panel->buildFromFile("panel_hide_beacon.xml");
- LL_INFOS() << "Build LLPanelHideBeacon panel" << LL_ENDL;
+ LL_INFOS() << "Build LLPanelHideBeacon panel" << LL_ENDL;
- panel->updatePosition();
- return panel;
+ panel->updatePosition();
+ return panel;
}
void LLPanelHideBeacon::onHideButtonClick()
{
- LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
- if (instance)
- {
- instance->onClearBtn();
- }
+ LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
+ if (instance)
+ {
+ instance->onClearBtn();
+ }
}
/**
@@ -1782,26 +1782,26 @@ void LLPanelHideBeacon::onHideButtonClick()
*/
void LLPanelHideBeacon::updatePosition()
{
- S32 bottom_tb_center = 0;
- if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_BOTTOM))
- {
- bottom_tb_center = toolbar_bottom->getRect().getCenterX();
- }
-
- S32 left_tb_width = 0;
- if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT))
- {
- left_tb_width = toolbar_left->getRect().getWidth();
- }
-
- if (gToolBarView != NULL && gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT)->hasButtons())
- {
- S32 x_pos = bottom_tb_center - getRect().getWidth() / 2 - left_tb_width;
- setOrigin( x_pos + HIDE_BEACON_PAD, 0);
- }
- else
- {
- S32 x_pos = bottom_tb_center - getRect().getWidth() / 2;
- setOrigin( x_pos + HIDE_BEACON_PAD, 0);
- }
+ S32 bottom_tb_center = 0;
+ if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_BOTTOM))
+ {
+ bottom_tb_center = toolbar_bottom->getRect().getCenterX();
+ }
+
+ S32 left_tb_width = 0;
+ if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT))
+ {
+ left_tb_width = toolbar_left->getRect().getWidth();
+ }
+
+ if (gToolBarView != NULL && gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT)->hasButtons())
+ {
+ S32 x_pos = bottom_tb_center - getRect().getWidth() / 2 - left_tb_width;
+ setOrigin( x_pos + HIDE_BEACON_PAD, 0);
+ }
+ else
+ {
+ S32 x_pos = bottom_tb_center - getRect().getWidth() / 2;
+ setOrigin( x_pos + HIDE_BEACON_PAD, 0);
+ }
}
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index 3702226d23..25306d0601 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloaterworldmap.h
* @brief LLFloaterWorldMap class definition
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,151 +49,151 @@ class LLWorldMapView;
class LLFloaterWorldMap : public LLFloater
{
public:
- LLFloaterWorldMap(const LLSD& key);
- virtual ~LLFloaterWorldMap();
+ LLFloaterWorldMap(const LLSD& key);
+ virtual ~LLFloaterWorldMap();
+
+ // Prefer this to gFloaterWorldMap
+ static LLFloaterWorldMap* getInstance();
- // Prefer this to gFloaterWorldMap
- static LLFloaterWorldMap* getInstance();
+ static void *createWorldMapView(void* data);
+ BOOL postBuild();
- static void *createWorldMapView(void* data);
- BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_quitting);
+ static void reloadIcons(void*);
- static void reloadIcons(void*);
+ /*virtual*/ void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE );
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+ /*virtual*/ void draw();
- /*virtual*/ void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE );
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
- /*virtual*/ void draw();
+ /*virtual*/ void onFocusLost();
- /*virtual*/ void onFocusLost();
+ // methods for dealing with inventory. The observe() method is
+ // called during program startup. inventoryUpdated() will be
+ // called by a helper object when an interesting change has
+ // occurred.
+ void observeInventory(LLInventoryModel* inventory);
+ void inventoryChanged();
- // methods for dealing with inventory. The observe() method is
- // called during program startup. inventoryUpdated() will be
- // called by a helper object when an interesting change has
- // occurred.
- void observeInventory(LLInventoryModel* inventory);
- void inventoryChanged();
+ // Calls for dealing with changes in friendship
+ void observeFriends();
+ void friendsChanged();
- // Calls for dealing with changes in friendship
- void observeFriends();
- void friendsChanged();
+ // tracking methods
+ void trackAvatar( const LLUUID& avatar_id, const std::string& name );
+ void trackLandmark( const LLUUID& landmark_item_id );
+ void trackLocation(const LLVector3d& pos);
+ void trackEvent(const LLItemInfo &event_info);
+ void trackGenericItem(const LLItemInfo &item);
+ void trackURL(const std::string& region_name, S32 x_coord, S32 y_coord, S32 z_coord);
- // tracking methods
- void trackAvatar( const LLUUID& avatar_id, const std::string& name );
- void trackLandmark( const LLUUID& landmark_item_id );
- void trackLocation(const LLVector3d& pos);
- void trackEvent(const LLItemInfo &event_info);
- void trackGenericItem(const LLItemInfo &item);
- void trackURL(const std::string& region_name, S32 x_coord, S32 y_coord, S32 z_coord);
+ static const LLUUID& getHomeID() { return sHomeID; }
- static const LLUUID& getHomeID() { return sHomeID; }
+ // A z_attenuation of 0.0f collapses the distance into the X-Y plane
+ F32 getDistanceToDestination(const LLVector3d& pos_global, F32 z_attenuation = 0.5f) const;
- // A z_attenuation of 0.0f collapses the distance into the X-Y plane
- F32 getDistanceToDestination(const LLVector3d& pos_global, F32 z_attenuation = 0.5f) const;
+ void clearLocationSelection(BOOL clear_ui = FALSE, BOOL dest_reached = FALSE);
+ void clearAvatarSelection(BOOL clear_ui = FALSE);
+ void clearLandmarkSelection(BOOL clear_ui = FALSE);
- void clearLocationSelection(BOOL clear_ui = FALSE, BOOL dest_reached = FALSE);
- void clearAvatarSelection(BOOL clear_ui = FALSE);
- void clearLandmarkSelection(BOOL clear_ui = FALSE);
+ // Adjust the maximally zoomed out limit of the zoom slider so you can
+ // see the whole world, plus a little.
+ void adjustZoomSliderBounds();
- // Adjust the maximally zoomed out limit of the zoom slider so you can
- // see the whole world, plus a little.
- void adjustZoomSliderBounds();
+ // Catch changes in the sim list
+ void updateSims(bool found_null_sim);
- // Catch changes in the sim list
- void updateSims(bool found_null_sim);
+ // teleport to the tracked item, if there is one
+ void teleport();
+ void onChangeMaturity();
- // teleport to the tracked item, if there is one
- void teleport();
- void onChangeMaturity();
+ void onClearBtn();
- void onClearBtn();
-
- //Slapp instigated avatar tracking
- void avatarTrackFromSlapp( const LLUUID& id );
+ //Slapp instigated avatar tracking
+ void avatarTrackFromSlapp( const LLUUID& id );
-protected:
- void onGoHome();
+protected:
+ void onGoHome();
- void onLandmarkComboPrearrange();
- void onLandmarkComboCommit();
+ void onLandmarkComboPrearrange();
+ void onLandmarkComboCommit();
- void onAvatarComboPrearrange();
- void onAvatarComboCommit();
+ void onAvatarComboPrearrange();
+ void onAvatarComboCommit();
- void onComboTextEntry( );
- void onSearchTextEntry( );
+ void onComboTextEntry( );
+ void onSearchTextEntry( );
- void onClickTeleportBtn();
- void onShowTargetBtn();
- void onShowAgentBtn();
- void onCopySLURL();
+ void onClickTeleportBtn();
+ void onShowTargetBtn();
+ void onShowAgentBtn();
+ void onCopySLURL();
void onExpandCollapseBtn();
- void centerOnTarget(BOOL animate);
- void updateLocation();
+ void centerOnTarget(BOOL animate);
+ void updateLocation();
- // fly to the tracked item, if there is one
- void fly();
+ // fly to the tracked item, if there is one
+ void fly();
- void buildLandmarkIDLists();
- void flyToLandmark();
- void teleportToLandmark();
- void setLandmarkVisited();
+ void buildLandmarkIDLists();
+ void flyToLandmark();
+ void teleportToLandmark();
+ void setLandmarkVisited();
- void buildAvatarIDList();
- void flyToAvatar();
- void teleportToAvatar();
+ void buildAvatarIDList();
+ void flyToAvatar();
+ void teleportToAvatar();
- void updateSearchEnabled();
- void onLocationFocusChanged( LLFocusableElement* ctrl );
- void onLocationCommit();
- void onCoordinatesCommit();
- void onCommitSearchResult();
+ void updateSearchEnabled();
+ void onLocationFocusChanged( LLFocusableElement* ctrl );
+ void onLocationCommit();
+ void onCoordinatesCommit();
+ void onCommitSearchResult();
void onTeleportFinished();
private:
LLWorldMapView* mMapView; // Panel displaying the map
- // update display of teleport destination coordinates - pos is in global coordinates
- void updateTeleportCoordsDisplay( const LLVector3d& pos );
+ // update display of teleport destination coordinates - pos is in global coordinates
+ void updateTeleportCoordsDisplay( const LLVector3d& pos );
- // enable/disable teleport destination coordinates
- void enableTeleportCoordsDisplay( bool enabled );
+ // enable/disable teleport destination coordinates
+ void enableTeleportCoordsDisplay( bool enabled );
- std::vector<LLUUID> mLandmarkAssetIDList;
- std::vector<LLUUID> mLandmarkItemIDList;
+ std::vector<LLUUID> mLandmarkAssetIDList;
+ std::vector<LLUUID> mLandmarkItemIDList;
- static const LLUUID sHomeID;
+ static const LLUUID sHomeID;
- LLInventoryModel* mInventory;
- LLInventoryObserver* mInventoryObserver;
- LLFriendObserver* mFriendObserver;
+ LLInventoryModel* mInventory;
+ LLInventoryObserver* mInventoryObserver;
+ LLFriendObserver* mFriendObserver;
- std::string mCompletingRegionName;
- // Local position from trackURL() request, used to select final
- // position once region lookup complete.
- LLVector3 mCompletingRegionPos;
+ std::string mCompletingRegionName;
+ // Local position from trackURL() request, used to select final
+ // position once region lookup complete.
+ LLVector3 mCompletingRegionPos;
- std::string mLastRegionName;
- BOOL mWaitingForTracker;
+ std::string mLastRegionName;
+ BOOL mWaitingForTracker;
- BOOL mIsClosing;
- BOOL mSetToUserPosition;
+ BOOL mIsClosing;
+ BOOL mSetToUserPosition;
- LLVector3d mTrackedLocation;
- LLTracker::ETrackingStatus mTrackedStatus;
- std::string mTrackedSimName;
- LLUUID mTrackedAvatarID;
- LLSLURL mSLURL;
+ LLVector3d mTrackedLocation;
+ LLTracker::ETrackingStatus mTrackedStatus;
+ std::string mTrackedSimName;
+ LLUUID mTrackedAvatarID;
+ LLSLURL mSLURL;
- LLCtrlListInterface * mListFriendCombo;
- LLCtrlListInterface * mListLandmarkCombo;
- LLCtrlListInterface * mListSearchResults;
+ LLCtrlListInterface * mListFriendCombo;
+ LLCtrlListInterface * mListLandmarkCombo;
+ LLCtrlListInterface * mListSearchResults;
boost::signals2::connection mTeleportFinishConnection;
};
@@ -204,19 +204,19 @@ extern LLFloaterWorldMap* gFloaterWorldMap;
class LLPanelHideBeacon : public LLPanel
{
public:
- static LLPanelHideBeacon* getInstance();
+ static LLPanelHideBeacon* getInstance();
- LLPanelHideBeacon();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void setVisible(BOOL visible);
- /*virtual*/ void draw();
+ LLPanelHideBeacon();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void setVisible(BOOL visible);
+ /*virtual*/ void draw();
private:
- static LLPanelHideBeacon* getPanelHideBeacon();
- void onHideButtonClick();
- void updatePosition();
+ static LLPanelHideBeacon* getPanelHideBeacon();
+ void onHideButtonClick();
+ void updatePosition();
- LLButton* mHideButton;
+ LLButton* mHideButton;
};
diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp
index e4f1d9fcaa..728f60e1c0 100644
--- a/indra/newview/llflyoutcombobtn.cpp
+++ b/indra/newview/llflyoutcombobtn.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llflyoutcombobtn.cpp
* @brief Represents outfit save/save as combo button.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,8 +48,8 @@ LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent,
mParent->childSetAction(flyout_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutButton(ctrl, data); });
mParent->childSetAction(action_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutAction(ctrl, data); });
- mFlyoutMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu> (menu_file, gMenuHolder,
- LLViewerMenuHolderGL::child_registry_t::instance());
+ mFlyoutMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu> (menu_file, gMenuHolder,
+ LLViewerMenuHolderGL::child_registry_t::instance());
// select the first item in the list.
setSelectedItem(0);
@@ -87,7 +87,7 @@ void LLFlyoutComboBtnCtrl::setSelectedItem(LLMenuItemGL *pitem)
}
mSelectedName = pitem->getName();
-
+
LLButton *action_button = mParent->getChild<LLButton>(mActionButton);
action_button->setEnabled(pitem->getEnabled());
action_button->setLabel(pitem->getLabel());
@@ -120,11 +120,11 @@ void LLFlyoutComboBtnCtrl::setMenuItemLabel(const std::string &item, const std::
void LLFlyoutComboBtnCtrl::onFlyoutButton(LLUICtrl *ctrl, const LLSD &data)
{
- S32 x, y;
+ S32 x, y;
LLUI::getInstance()->getMousePositionLocal(mParent, &x, &y);
- mFlyoutMenu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(mParent, mFlyoutMenu, x, y);
+ mFlyoutMenu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(mParent, mFlyoutMenu, x, y);
}
void LLFlyoutComboBtnCtrl::onFlyoutItemSelected(LLUICtrl *ctrl, const LLSD &data)
diff --git a/indra/newview/llflyoutcombobtn.h b/indra/newview/llflyoutcombobtn.h
index e41cd0cecb..1589fc3b30 100644
--- a/indra/newview/llflyoutcombobtn.h
+++ b/indra/newview/llflyoutcombobtn.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsaveoutfitcombobtn.h
* @brief Represents outfit save/save as combo button.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,8 +43,8 @@ public:
const std::string &menu_file,
bool apply_immediately = true);
- void setMenuItemEnabled(const std::string &item, bool enabled);
- void setShownBtnEnabled(bool enabled);
+ void setMenuItemEnabled(const std::string &item, bool enabled);
+ void setShownBtnEnabled(bool enabled);
void setMenuItemVisible(const std::string &item, bool visible);
void setMenuItemLabel(const std::string &item, const std::string &label);
@@ -63,8 +63,8 @@ protected:
void setSelectedItem(LLMenuItemGL *pitem);
private:
- LLPanel * mParent;
- LLToggleableMenu * mFlyoutMenu;
+ LLPanel * mParent;
+ LLToggleableMenu * mFlyoutMenu;
std::string mActionButton;
std::string mFlyoutButton;
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index 241aa96bc8..734f20830d 100644
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -1,25 +1,25 @@
-/*
+/*
* @file llfolderviewmodelinventory.cpp
* @brief Implementation of the inventory-specific view model
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,97 +39,97 @@ static LLTrace::BlockTimerStatHandle FTM_INVENTORY_SORT("Inventory Sort");
bool LLFolderViewModelInventory::startDrag(std::vector<LLFolderViewModelItem*>& items)
{
- std::vector<EDragAndDropType> types;
- uuid_vec_t cargo_ids;
- std::vector<LLFolderViewModelItem*>::iterator item_it;
- bool can_drag = true;
- if (!items.empty())
- {
- for (item_it = items.begin(); item_it != items.end(); ++item_it)
- {
- EDragAndDropType type = DAD_NONE;
- LLUUID id = LLUUID::null;
- can_drag = can_drag && static_cast<LLFolderViewModelItemInventory*>(*item_it)->startDrag(&type, &id);
-
- types.push_back(type);
- cargo_ids.push_back(id);
- }
-
- LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids,
- static_cast<LLFolderViewModelItemInventory*>(items.front())->getDragSource(), mTaskID);
- }
- return can_drag;
+ std::vector<EDragAndDropType> types;
+ uuid_vec_t cargo_ids;
+ std::vector<LLFolderViewModelItem*>::iterator item_it;
+ bool can_drag = true;
+ if (!items.empty())
+ {
+ for (item_it = items.begin(); item_it != items.end(); ++item_it)
+ {
+ EDragAndDropType type = DAD_NONE;
+ LLUUID id = LLUUID::null;
+ can_drag = can_drag && static_cast<LLFolderViewModelItemInventory*>(*item_it)->startDrag(&type, &id);
+
+ types.push_back(type);
+ cargo_ids.push_back(id);
+ }
+
+ LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids,
+ static_cast<LLFolderViewModelItemInventory*>(items.front())->getDragSource(), mTaskID);
+ }
+ return can_drag;
}
void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder )
{
- LL_RECORD_BLOCK_TIME(FTM_INVENTORY_SORT);
+ LL_RECORD_BLOCK_TIME(FTM_INVENTORY_SORT);
- if (!folder->areChildrenInited() || !needsSort(folder->getViewModelItem())) return;
+ if (!folder->areChildrenInited() || !needsSort(folder->getViewModelItem())) return;
- LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem());
- if (modelp->getUUID().isNull()) return;
+ LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem());
+ if (modelp->getUUID().isNull()) return;
- for (std::list<LLFolderViewFolder*>::iterator it = folder->getFoldersBegin(), end_it = folder->getFoldersEnd();
- it != end_it;
- ++it)
- {
+ for (std::list<LLFolderViewFolder*>::iterator it = folder->getFoldersBegin(), end_it = folder->getFoldersEnd();
+ it != end_it;
+ ++it)
+ {
// Recursive call to sort() on child (CHUI-849)
- LLFolderViewFolder* child_folderp = *it;
- sort(child_folderp);
-
- if (child_folderp->getFoldersCount() > 0)
- {
- time_t most_recent_folder_time =
- static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getFoldersBegin())->getViewModelItem())->getCreationDate();
- LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem());
- if (most_recent_folder_time > modelp->getCreationDate())
- {
- modelp->setCreationDate(most_recent_folder_time);
- }
- }
- if (child_folderp->getItemsCount() > 0)
- {
- time_t most_recent_item_time =
- static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getItemsBegin())->getViewModelItem())->getCreationDate();
-
- LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem());
- if (most_recent_item_time > modelp->getCreationDate())
- {
- modelp->setCreationDate(most_recent_item_time);
- }
- }
- }
- base_t::sort(folder);
+ LLFolderViewFolder* child_folderp = *it;
+ sort(child_folderp);
+
+ if (child_folderp->getFoldersCount() > 0)
+ {
+ time_t most_recent_folder_time =
+ static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getFoldersBegin())->getViewModelItem())->getCreationDate();
+ LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem());
+ if (most_recent_folder_time > modelp->getCreationDate())
+ {
+ modelp->setCreationDate(most_recent_folder_time);
+ }
+ }
+ if (child_folderp->getItemsCount() > 0)
+ {
+ time_t most_recent_item_time =
+ static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getItemsBegin())->getViewModelItem())->getCreationDate();
+
+ LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem());
+ if (most_recent_item_time > modelp->getCreationDate())
+ {
+ modelp->setCreationDate(most_recent_item_time);
+ }
+ }
+ }
+ base_t::sort(folder);
}
bool LLFolderViewModelInventory::contentsReady()
{
- return !LLInventoryModelBackgroundFetch::instance().folderFetchActive();
+ return !LLInventoryModelBackgroundFetch::instance().folderFetchActive();
}
bool LLFolderViewModelInventory::isFolderComplete(LLFolderViewFolder* folder)
{
- LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem());
- LLUUID cat_id = modelp->getUUID();
- if (cat_id.isNull())
- {
- return false;
- }
- LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
- if (cat)
- {
- // don't need to check version - descendents_server == -1 if we have no data
- S32 descendents_server = cat->getDescendentCount();
- S32 descendents_actual = cat->getViewerDescendentCount();
- if (descendents_server == descendents_actual
- || (descendents_actual > 0 && descendents_server == -1)) // content was loaded in previous session
- {
- return true;
- }
- }
- return false;
+ LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem());
+ LLUUID cat_id = modelp->getUUID();
+ if (cat_id.isNull())
+ {
+ return false;
+ }
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (cat)
+ {
+ // don't need to check version - descendents_server == -1 if we have no data
+ S32 descendents_server = cat->getDescendentCount();
+ S32 descendents_actual = cat->getViewerDescendentCount();
+ if (descendents_server == descendents_actual
+ || (descendents_actual > 0 && descendents_server == -1)) // content was loaded in previous session
+ {
+ return true;
+ }
+ }
+ return false;
}
//virtual
@@ -144,12 +144,12 @@ void LLFolderViewModelItemInventory::addChild(LLFolderViewModelItem* child)
void LLFolderViewModelItemInventory::requestSort()
{
- LLFolderViewModelItemCommon::requestSort();
- LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(mFolderViewItem);
- if (folderp)
- {
- folderp->requestArrange();
- }
+ LLFolderViewModelItemCommon::requestSort();
+ LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(mFolderViewItem);
+ if (folderp)
+ {
+ folderp->requestArrange();
+ }
LLInventorySort sorter = static_cast<LLFolderViewModelInventory&>(mRootViewModel).getSorter();
// Sort by date potentially affects parent folders which use a date
@@ -179,28 +179,28 @@ void LLFolderViewModelItemInventory::requestSort()
void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size)
{
- bool generation_skip = mMarkedDirtyGeneration >= 0
- && mPrevPassedAllFilters
- && mMarkedDirtyGeneration < mRootViewModel.getFilter().getFirstSuccessGeneration();
+ bool generation_skip = mMarkedDirtyGeneration >= 0
+ && mPrevPassedAllFilters
+ && mMarkedDirtyGeneration < mRootViewModel.getFilter().getFirstSuccessGeneration();
S32 last_generation = mLastFilterGeneration;
- LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size);
- bool before = mPrevPassedAllFilters;
- mPrevPassedAllFilters = passedFilter(filter_generation);
+ LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size);
+ bool before = mPrevPassedAllFilters;
+ mPrevPassedAllFilters = passedFilter(filter_generation);
- if (before != mPrevPassedAllFilters // Change of state
+ if (before != mPrevPassedAllFilters // Change of state
|| generation_skip // Was marked dirty
// Potential change from being in-progress and invisible to visible)
|| (mPrevPassedAllFilters && last_generation < mRootViewModel.getFilter().getFirstRequiredGeneration()))
- {
- // Need to rearrange the folder if the filtered state of the item changed,
- // previously passed item skipped filter generation changes while being dirty
- // or previously passed not yet filtered item was marked dirty
- LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder();
- if (parent_folder)
- {
- parent_folder->requestArrange();
- }
- }
+ {
+ // Need to rearrange the folder if the filtered state of the item changed,
+ // previously passed item skipped filter generation changes while being dirty
+ // or previously passed not yet filtered item was marked dirty
+ LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder();
+ if (parent_folder)
+ {
+ parent_folder->requestArrange();
+ }
+ }
}
@@ -208,183 +208,183 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_gen
bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter )
{
- S32 filter_generation = filter.getCurrentGeneration();
-
- bool continue_filtering = true;
- if (item)
- {
- if (item->getLastFilterGeneration() < filter_generation)
- {
- // Recursive application of the filter for child items (CHUI-849)
- continue_filtering = item->filter(filter);
- }
-
- // Update latest generation to pass filter in parent and propagate up to root
- if (item->passedFilter())
- {
- LLFolderViewModelItemInventory* view_model = this;
-
- while (view_model && view_model->mMostFilteredDescendantGeneration < filter_generation)
- {
- view_model->mMostFilteredDescendantGeneration = filter_generation;
- view_model = static_cast<LLFolderViewModelItemInventory*>(view_model->mParent);
- }
- }
- }
- return continue_filtering;
+ S32 filter_generation = filter.getCurrentGeneration();
+
+ bool continue_filtering = true;
+ if (item)
+ {
+ if (item->getLastFilterGeneration() < filter_generation)
+ {
+ // Recursive application of the filter for child items (CHUI-849)
+ continue_filtering = item->filter(filter);
+ }
+
+ // Update latest generation to pass filter in parent and propagate up to root
+ if (item->passedFilter())
+ {
+ LLFolderViewModelItemInventory* view_model = this;
+
+ while (view_model && view_model->mMostFilteredDescendantGeneration < filter_generation)
+ {
+ view_model->mMostFilteredDescendantGeneration = filter_generation;
+ view_model = static_cast<LLFolderViewModelItemInventory*>(view_model->mParent);
+ }
+ }
+ }
+ return continue_filtering;
}
bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
{
- const S32 filter_generation = filter.getCurrentGeneration();
- const S32 must_pass_generation = filter.getFirstRequiredGeneration();
+ const S32 filter_generation = filter.getCurrentGeneration();
+ const S32 must_pass_generation = filter.getFirstRequiredGeneration();
if (getLastFilterGeneration() >= must_pass_generation
- && getLastFolderFilterGeneration() >= must_pass_generation
- && !passedFilter(must_pass_generation))
- {
- // failed to pass an earlier filter that was a subset of the current one
- // go ahead and flag this item as not pass
- setPassedFilter(false, filter_generation);
- setPassedFolderFilter(false, filter_generation);
- return true;
- }
+ && getLastFolderFilterGeneration() >= must_pass_generation
+ && !passedFilter(must_pass_generation))
+ {
+ // failed to pass an earlier filter that was a subset of the current one
+ // go ahead and flag this item as not pass
+ setPassedFilter(false, filter_generation);
+ setPassedFolderFilter(false, filter_generation);
+ return true;
+ }
// *TODO : Revise the logic for fast pass on less restrictive filter case
/*
const S32 sufficient_pass_generation = filter.getFirstSuccessGeneration();
if (getLastFilterGeneration() >= sufficient_pass_generation
- && getLastFolderFilterGeneration() >= sufficient_pass_generation
- && passedFilter(sufficient_pass_generation))
- {
- // passed an earlier filter that was a superset of the current one
- // go ahead and flag this item as pass
- setPassedFilter(true, filter_generation);
- setPassedFolderFilter(true, filter_generation);
- return true;
- }
+ && getLastFolderFilterGeneration() >= sufficient_pass_generation
+ && passedFilter(sufficient_pass_generation))
+ {
+ // passed an earlier filter that was a superset of the current one
+ // go ahead and flag this item as pass
+ setPassedFilter(true, filter_generation);
+ setPassedFolderFilter(true, filter_generation);
+ return true;
+ }
*/
- bool is_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY);
- const bool passed_filter_folder = is_folder ? filter.checkFolder(this) : true;
- setPassedFolderFilter(passed_filter_folder, filter_generation);
+ bool is_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY);
+ const bool passed_filter_folder = is_folder ? filter.checkFolder(this) : true;
+ setPassedFolderFilter(passed_filter_folder, filter_generation);
- bool continue_filtering = true;
+ bool continue_filtering = true;
- if (!mChildren.empty()
- && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass
+ if (!mChildren.empty()
+ && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass
|| descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement
- {
- // now query children
- for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); iter != end_iter; ++iter)
- {
- continue_filtering = filterChildItem((*iter), filter);
+ {
+ // now query children
+ for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); iter != end_iter; ++iter)
+ {
+ continue_filtering = filterChildItem((*iter), filter);
if (!continue_filtering)
- {
- break;
- }
- }
- }
+ {
+ break;
+ }
+ }
+ }
- // If we didn't use all the filter time that means we filtered all of our descendants so we can filter ourselves now
+ // If we didn't use all the filter time that means we filtered all of our descendants so we can filter ourselves now
if (continue_filtering)
- {
+ {
// This is where filter check on the item done (CHUI-849)
- const bool passed_filter = filter.check(this);
- if (passed_filter && mChildren.empty() && is_folder) // Update the latest filter generation for empty folders
- {
- LLFolderViewModelItemInventory* view_model = this;
- while (view_model && view_model->mMostFilteredDescendantGeneration < filter_generation)
- {
- view_model->mMostFilteredDescendantGeneration = filter_generation;
- view_model = static_cast<LLFolderViewModelItemInventory*>(view_model->mParent);
- }
- }
- setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize());
+ const bool passed_filter = filter.check(this);
+ if (passed_filter && mChildren.empty() && is_folder) // Update the latest filter generation for empty folders
+ {
+ LLFolderViewModelItemInventory* view_model = this;
+ while (view_model && view_model->mMostFilteredDescendantGeneration < filter_generation)
+ {
+ view_model->mMostFilteredDescendantGeneration = filter_generation;
+ view_model = static_cast<LLFolderViewModelItemInventory*>(view_model->mParent);
+ }
+ }
+ setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize());
continue_filtering = !filter.isTimedOut();
- }
+ }
return continue_filtering;
}
//LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel()
//{
-// return &mInventoryViewModel;
+// return &mInventoryViewModel;
//}
//
//
//const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const
//{
-// return &mInventoryViewModel;
+// return &mInventoryViewModel;
//}
bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const
{
- // Ignore sort order for landmarks in the Favorites folder.
- // In that folder, landmarks should be always sorted as in the Favorites bar. See EXT-719
- if (a->getSortGroup() == SG_ITEM
- && b->getSortGroup() == SG_ITEM
- && a->getInventoryType() == LLInventoryType::IT_LANDMARK
- && b->getInventoryType() == LLInventoryType::IT_LANDMARK)
- {
- static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- // If both landmarks are in the Favorites folder...
- if (gInventory.isObjectDescendentOf(a->getUUID(), favorites_folder_id) && gInventory.isObjectDescendentOf(b->getUUID(), favorites_folder_id))
- {
- // Get their index in that folder
- S32 a_sort = LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID());
- S32 b_sort = LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID());
- // Note: this test is a bit overkill: since they are both in the Favorites folder, we shouldn't get negative index values...
- if (!((a_sort < 0) && (b_sort < 0)))
- {
- return a_sort < b_sort;
- }
- }
- }
-
- // We sort by name if we aren't sorting by date
- // OR if these are folders and we are sorting folders by name.
- bool by_name = ((!mByDate || (mFoldersByName && (a->getSortGroup() != SG_ITEM))) && !mFoldersByWeight);
-
- if (a->getSortGroup() != b->getSortGroup())
- {
- if (mSystemToTop)
- {
- // Group order is System Folders, Trash, Normal Folders, Items
- return (a->getSortGroup() < b->getSortGroup());
- }
- else if (mByDate)
- {
- // Trash needs to go to the bottom if we are sorting by date
- if ( (a->getSortGroup() == SG_TRASH_FOLDER)
- || (b->getSortGroup() == SG_TRASH_FOLDER))
- {
- return (b->getSortGroup() == SG_TRASH_FOLDER);
- }
- }
- }
-
- if (by_name)
- {
- S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName());
- if (0 == compare)
- {
- return (a->getCreationDate() > b->getCreationDate());
- }
- else
- {
- return (compare < 0);
- }
- }
+ // Ignore sort order for landmarks in the Favorites folder.
+ // In that folder, landmarks should be always sorted as in the Favorites bar. See EXT-719
+ if (a->getSortGroup() == SG_ITEM
+ && b->getSortGroup() == SG_ITEM
+ && a->getInventoryType() == LLInventoryType::IT_LANDMARK
+ && b->getInventoryType() == LLInventoryType::IT_LANDMARK)
+ {
+ static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ // If both landmarks are in the Favorites folder...
+ if (gInventory.isObjectDescendentOf(a->getUUID(), favorites_folder_id) && gInventory.isObjectDescendentOf(b->getUUID(), favorites_folder_id))
+ {
+ // Get their index in that folder
+ S32 a_sort = LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID());
+ S32 b_sort = LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID());
+ // Note: this test is a bit overkill: since they are both in the Favorites folder, we shouldn't get negative index values...
+ if (!((a_sort < 0) && (b_sort < 0)))
+ {
+ return a_sort < b_sort;
+ }
+ }
+ }
+
+ // We sort by name if we aren't sorting by date
+ // OR if these are folders and we are sorting folders by name.
+ bool by_name = ((!mByDate || (mFoldersByName && (a->getSortGroup() != SG_ITEM))) && !mFoldersByWeight);
+
+ if (a->getSortGroup() != b->getSortGroup())
+ {
+ if (mSystemToTop)
+ {
+ // Group order is System Folders, Trash, Normal Folders, Items
+ return (a->getSortGroup() < b->getSortGroup());
+ }
+ else if (mByDate)
+ {
+ // Trash needs to go to the bottom if we are sorting by date
+ if ( (a->getSortGroup() == SG_TRASH_FOLDER)
+ || (b->getSortGroup() == SG_TRASH_FOLDER))
+ {
+ return (b->getSortGroup() == SG_TRASH_FOLDER);
+ }
+ }
+ }
+
+ if (by_name)
+ {
+ S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName());
+ if (0 == compare)
+ {
+ return (a->getCreationDate() > b->getCreationDate());
+ }
+ else
+ {
+ return (compare < 0);
+ }
+ }
else if (mFoldersByWeight)
{
S32 weight_a = compute_stock_count(a->getUUID());
S32 weight_b = compute_stock_count(b->getUUID());
- if (weight_a == weight_b)
- {
+ if (weight_a == weight_b)
+ {
// Equal weight -> use alphabetical order
- return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0);
- }
- else if (weight_a == COMPUTE_STOCK_INFINITE)
+ return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0);
+ }
+ else if (weight_a == COMPUTE_STOCK_INFINITE)
{
// No stock -> move a at the end of the list
return false;
@@ -395,24 +395,24 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a,
return true;
}
else
- {
+ {
// Lighter is first (sorted in increasing order of weight)
return (weight_a < weight_b);
}
}
- else
- {
- time_t first_create = a->getCreationDate();
- time_t second_create = b->getCreationDate();
- if (first_create == second_create)
- {
- return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0);
- }
- else
- {
- return (first_create > second_create);
- }
- }
+ else
+ {
+ time_t first_create = a->getCreationDate();
+ time_t second_create = b->getCreationDate();
+ if (first_create == second_create)
+ {
+ return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0);
+ }
+ else
+ {
+ return (first_create > second_create);
+ }
+ }
}
LLFolderViewModelItemInventory::LLFolderViewModelItemInventory( class LLFolderViewModelInventory& root_view_model ) :
diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h
index 1649b2eed7..c8fb155176 100644
--- a/indra/newview/llfolderviewmodelinventory.h
+++ b/indra/newview/llfolderviewmodelinventory.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfolderviewmodelinventory.h
* @brief view model implementation specific to inventory
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,36 +34,36 @@
#include "lltooldraganddrop.h"
class LLFolderViewModelItemInventory
- : public LLFolderViewModelItemCommon
+ : public LLFolderViewModelItemCommon
{
public:
- LLFolderViewModelItemInventory(class LLFolderViewModelInventory& root_view_model);
- virtual const LLUUID& getUUID() const = 0;
+ LLFolderViewModelItemInventory(class LLFolderViewModelInventory& root_view_model);
+ virtual const LLUUID& getUUID() const = 0;
virtual const LLUUID& getThumbnailUUID() const = 0;
- virtual time_t getCreationDate() const = 0; // UTC seconds
- virtual void setCreationDate(time_t creation_date_utc) = 0;
- virtual PermissionMask getPermissionMask() const = 0;
- virtual LLFolderType::EType getPreferredType() const = 0;
- virtual void showProperties(void) = 0;
- virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual.
+ virtual time_t getCreationDate() const = 0; // UTC seconds
+ virtual void setCreationDate(time_t creation_date_utc) = 0;
+ virtual PermissionMask getPermissionMask() const = 0;
+ virtual LLFolderType::EType getPreferredType() const = 0;
+ virtual void showProperties(void) = 0;
+ virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual.
virtual bool isItemInOutfits() const { return false; }
- virtual BOOL isAgentInventory() const { return FALSE; }
- virtual BOOL isUpToDate() const = 0;
+ virtual BOOL isAgentInventory() const { return FALSE; }
+ virtual BOOL isUpToDate() const = 0;
virtual void addChild(LLFolderViewModelItem* child);
- virtual bool hasChildren() const = 0;
- virtual LLInventoryType::EType getInventoryType() const = 0;
- virtual void performAction(LLInventoryModel* model, std::string action) = 0;
+ virtual bool hasChildren() const = 0;
+ virtual LLInventoryType::EType getInventoryType() const = 0;
+ virtual void performAction(LLInventoryModel* model, std::string action) = 0;
virtual LLWearableType::EType getWearableType() const = 0;
virtual LLSettingsType::type_e getSettingsType() const = 0;
virtual EInventorySortGroup getSortGroup() const = 0;
- virtual LLInventoryObject* getInventoryObject() const = 0;
- virtual void requestSort();
- virtual void setPassedFilter(bool filtered, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0);
- virtual bool filter( LLFolderViewFilter& filter);
- virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter);
+ virtual LLInventoryObject* getInventoryObject() const = 0;
+ virtual void requestSort();
+ virtual void setPassedFilter(bool filtered, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0);
+ virtual bool filter( LLFolderViewFilter& filter);
+ virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter);
- virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0;
- virtual LLToolDragAndDrop::ESource getDragSource() const = 0;
+ virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0;
+ virtual LLToolDragAndDrop::ESource getDragSource() const = 0;
protected:
bool mPrevPassedAllFilters;
time_t mLastAddedChildCreationDate; // -1 if nothing was added
@@ -72,61 +72,61 @@ protected:
class LLInventorySort
{
public:
- struct Params : public LLInitParam::Block<Params>
- {
- Optional<S32> order;
+ struct Params : public LLInitParam::Block<Params>
+ {
+ Optional<S32> order;
- Params()
- : order("order", 0)
- {}
- };
+ Params()
+ : order("order", 0)
+ {}
+ };
- LLInventorySort(S32 order = 0)
- {
- fromParams(Params().order(order));
- }
+ LLInventorySort(S32 order = 0)
+ {
+ fromParams(Params().order(order));
+ }
- bool isByDate() const { return mByDate; }
- bool isFoldersByName() const { return (!mByDate || mFoldersByName) && !mFoldersByWeight; }
+ bool isByDate() const { return mByDate; }
+ bool isFoldersByName() const { return (!mByDate || mFoldersByName) && !mFoldersByWeight; }
bool isFoldersByDate() const { return mByDate && !mFoldersByName && !mFoldersByWeight; }
- U32 getSortOrder() const { return mSortOrder; }
- void toParams(Params& p) { p.order(mSortOrder);}
- void fromParams(Params& p)
- {
- mSortOrder = p.order;
- mByDate = (mSortOrder & LLInventoryFilter::SO_DATE);
- mSystemToTop = (mSortOrder & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP);
- mFoldersByName = (mSortOrder & LLInventoryFilter::SO_FOLDERS_BY_NAME);
- mFoldersByWeight = (mSortOrder & LLInventoryFilter::SO_FOLDERS_BY_WEIGHT);
- }
+ U32 getSortOrder() const { return mSortOrder; }
+ void toParams(Params& p) { p.order(mSortOrder);}
+ void fromParams(Params& p)
+ {
+ mSortOrder = p.order;
+ mByDate = (mSortOrder & LLInventoryFilter::SO_DATE);
+ mSystemToTop = (mSortOrder & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP);
+ mFoldersByName = (mSortOrder & LLInventoryFilter::SO_FOLDERS_BY_NAME);
+ mFoldersByWeight = (mSortOrder & LLInventoryFilter::SO_FOLDERS_BY_WEIGHT);
+ }
- bool operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const;
+ bool operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const;
private:
- U32 mSortOrder;
- bool mByDate;
- bool mSystemToTop;
- bool mFoldersByName;
- bool mFoldersByWeight;
+ U32 mSortOrder;
+ bool mByDate;
+ bool mSystemToTop;
+ bool mFoldersByName;
+ bool mFoldersByWeight;
};
class LLFolderViewModelInventory
- : public LLFolderViewModel<LLInventorySort, LLFolderViewModelItemInventory, LLFolderViewModelItemInventory, LLInventoryFilter>
+ : public LLFolderViewModel<LLInventorySort, LLFolderViewModelItemInventory, LLFolderViewModelItemInventory, LLInventoryFilter>
{
public:
- typedef LLFolderViewModel<LLInventorySort, LLFolderViewModelItemInventory, LLFolderViewModelItemInventory, LLInventoryFilter> base_t;
+ typedef LLFolderViewModel<LLInventorySort, LLFolderViewModelItemInventory, LLFolderViewModelItemInventory, LLInventoryFilter> base_t;
- LLFolderViewModelInventory(const std::string& name)
- : base_t(new LLInventorySort(), new LLInventoryFilter(LLInventoryFilter::Params().name(name)))
- {}
+ LLFolderViewModelInventory(const std::string& name)
+ : base_t(new LLInventorySort(), new LLInventoryFilter(LLInventoryFilter::Params().name(name)))
+ {}
- void setTaskID(const LLUUID& id) {mTaskID = id;}
+ void setTaskID(const LLUUID& id) {mTaskID = id;}
- void sort(LLFolderViewFolder* folder);
- bool contentsReady();
- bool isFolderComplete(LLFolderViewFolder* folder);
- bool startDrag(std::vector<LLFolderViewModelItem*>& items);
+ void sort(LLFolderViewFolder* folder);
+ bool contentsReady();
+ bool isFolderComplete(LLFolderViewFolder* folder);
+ bool startDrag(std::vector<LLFolderViewModelItem*>& items);
private:
- LLUUID mTaskID;
+ LLUUID mTaskID;
};
#endif // LL_LLFOLDERVIEWMODELINVENTORY_H
diff --git a/indra/newview/llfollowcam.cpp b/indra/newview/llfollowcam.cpp
index c2ea3b07c1..561ac96504 100644
--- a/indra/newview/llfollowcam.cpp
+++ b/indra/newview/llfollowcam.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfollowcam.cpp
* @author Jeffrey Ventrella
* @brief LLFollowCam class implementation
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,103 +32,103 @@
//-------------------------------------------------------
// constants
//-------------------------------------------------------
-const F32 FOLLOW_CAM_ZOOM_FACTOR = 0.1f;
-const F32 FOLLOW_CAM_MIN_ZOOM_AMOUNT = 0.1f;
-const F32 DISTANCE_EPSILON = 0.0001f;
-const F32 DEFAULT_MAX_DISTANCE_FROM_SUBJECT = 1000.0; // this will be correctly set on me by my caller
+const F32 FOLLOW_CAM_ZOOM_FACTOR = 0.1f;
+const F32 FOLLOW_CAM_MIN_ZOOM_AMOUNT = 0.1f;
+const F32 DISTANCE_EPSILON = 0.0001f;
+const F32 DEFAULT_MAX_DISTANCE_FROM_SUBJECT = 1000.0; // this will be correctly set on me by my caller
//----------------------------------------------------------------------------------------
-// This is how slowly the camera position moves to its ideal position
+// This is how slowly the camera position moves to its ideal position
//----------------------------------------------------------------------------------------
-const F32 FOLLOW_CAM_MIN_POSITION_LAG = 0.0f;
-const F32 FOLLOW_CAM_DEFAULT_POSITION_LAG = 0.1f;
-const F32 FOLLOW_CAM_MAX_POSITION_LAG = 3.0f;
+const F32 FOLLOW_CAM_MIN_POSITION_LAG = 0.0f;
+const F32 FOLLOW_CAM_DEFAULT_POSITION_LAG = 0.1f;
+const F32 FOLLOW_CAM_MAX_POSITION_LAG = 3.0f;
//----------------------------------------------------------------------------------------
// This is how slowly the camera focus moves to its subject
//----------------------------------------------------------------------------------------
-const F32 FOLLOW_CAM_MIN_FOCUS_LAG = 0.0f;
-const F32 FOLLOW_CAM_DEFAULT_FOCUS_LAG = 0.1f;
-const F32 FOLLOW_CAM_MAX_FOCUS_LAG = 3.0f;
+const F32 FOLLOW_CAM_MIN_FOCUS_LAG = 0.0f;
+const F32 FOLLOW_CAM_DEFAULT_FOCUS_LAG = 0.1f;
+const F32 FOLLOW_CAM_MAX_FOCUS_LAG = 3.0f;
//----------------------------------------------------------------------------------------
// This is far the position can get from its IDEAL POSITION before it starts getting pulled
//----------------------------------------------------------------------------------------
-const F32 FOLLOW_CAM_MIN_POSITION_THRESHOLD = 0.0f;
-const F32 FOLLOW_CAM_DEFAULT_POSITION_THRESHOLD = 1.0f;
-const F32 FOLLOW_CAM_MAX_POSITION_THRESHOLD = 4.0f;
+const F32 FOLLOW_CAM_MIN_POSITION_THRESHOLD = 0.0f;
+const F32 FOLLOW_CAM_DEFAULT_POSITION_THRESHOLD = 1.0f;
+const F32 FOLLOW_CAM_MAX_POSITION_THRESHOLD = 4.0f;
//----------------------------------------------------------------------------------------
// This is far the focus can get from the subject before it starts getting pulled
//----------------------------------------------------------------------------------------
-const F32 FOLLOW_CAM_MIN_FOCUS_THRESHOLD = 0.0f;
-const F32 FOLLOW_CAM_DEFAULT_FOCUS_THRESHOLD = 1.0f;
-const F32 FOLLOW_CAM_MAX_FOCUS_THRESHOLD = 4.0f;
+const F32 FOLLOW_CAM_MIN_FOCUS_THRESHOLD = 0.0f;
+const F32 FOLLOW_CAM_DEFAULT_FOCUS_THRESHOLD = 1.0f;
+const F32 FOLLOW_CAM_MAX_FOCUS_THRESHOLD = 4.0f;
//----------------------------------------------------------------------------------------
// This is the distance the camera wants to be from the subject
//----------------------------------------------------------------------------------------
-const F32 FOLLOW_CAM_MIN_DISTANCE = 0.5f;
-const F32 FOLLOW_CAM_DEFAULT_DISTANCE = 3.0f;
-//const F32 FOLLOW_CAM_MAX_DISTANCE = 10.0f; // from now on I am using mMaxCameraDistantFromSubject
+const F32 FOLLOW_CAM_MIN_DISTANCE = 0.5f;
+const F32 FOLLOW_CAM_DEFAULT_DISTANCE = 3.0f;
+//const F32 FOLLOW_CAM_MAX_DISTANCE = 10.0f; // from now on I am using mMaxCameraDistantFromSubject
//----------------------------------------------------------------------------------------
// this is an angluar value
-// It affects the angle that the camera rises (pitches) in relation
+// It affects the angle that the camera rises (pitches) in relation
// to the horizontal plane
//----------------------------------------------------------------------------------------
-const F32 FOLLOW_CAM_MIN_PITCH = -45.0f;
-const F32 FOLLOW_CAM_DEFAULT_PITCH = 0.0f;
-const F32 FOLLOW_CAM_MAX_PITCH = 80.0f; // keep under 90 degrees - avoid gimble lock!
+const F32 FOLLOW_CAM_MIN_PITCH = -45.0f;
+const F32 FOLLOW_CAM_DEFAULT_PITCH = 0.0f;
+const F32 FOLLOW_CAM_MAX_PITCH = 80.0f; // keep under 90 degrees - avoid gimble lock!
//----------------------------------------------------------------------------------------
// how high or low the camera considers its ideal focus to be (relative to its subject)
//----------------------------------------------------------------------------------------
-const F32 FOLLOW_CAM_MIN_FOCUS_OFFSET = -10.0f;
-const LLVector3 FOLLOW_CAM_DEFAULT_FOCUS_OFFSET = LLVector3(1.0f, 0.f, 0.f);
-const F32 FOLLOW_CAM_MAX_FOCUS_OFFSET = 10.0f;
+const F32 FOLLOW_CAM_MIN_FOCUS_OFFSET = -10.0f;
+const LLVector3 FOLLOW_CAM_DEFAULT_FOCUS_OFFSET = LLVector3(1.0f, 0.f, 0.f);
+const F32 FOLLOW_CAM_MAX_FOCUS_OFFSET = 10.0f;
//----------------------------------------------------------------------------------------
// This affects the rate at which the camera adjusts to stay behind the subject
//----------------------------------------------------------------------------------------
-const F32 FOLLOW_CAM_MIN_BEHINDNESS_LAG = 0.0f;
-const F32 FOLLOW_CAM_DEFAULT_BEHINDNESS_LAG = 0.f;
-const F32 FOLLOW_CAM_MAX_BEHINDNESS_LAG = 3.0f;
+const F32 FOLLOW_CAM_MIN_BEHINDNESS_LAG = 0.0f;
+const F32 FOLLOW_CAM_DEFAULT_BEHINDNESS_LAG = 0.f;
+const F32 FOLLOW_CAM_MAX_BEHINDNESS_LAG = 3.0f;
//---------------------------------------------------------------------------------------------------------------------
// in degrees: This is the size of the pie slice behind the subject matter within which the camera is free to move
//---------------------------------------------------------------------------------------------------------------------
-const F32 FOLLOW_CAM_MIN_BEHINDNESS_ANGLE = 0.0f;
-const F32 FOLLOW_CAM_DEFAULT_BEHINDNESS_ANGLE = 10.0f;
-const F32 FOLLOW_CAM_MAX_BEHINDNESS_ANGLE = 180.0f;
-const F32 FOLLOW_CAM_BEHINDNESS_EPSILON = 1.0f;
+const F32 FOLLOW_CAM_MIN_BEHINDNESS_ANGLE = 0.0f;
+const F32 FOLLOW_CAM_DEFAULT_BEHINDNESS_ANGLE = 10.0f;
+const F32 FOLLOW_CAM_MAX_BEHINDNESS_ANGLE = 180.0f;
+const F32 FOLLOW_CAM_BEHINDNESS_EPSILON = 1.0f;
//------------------------------------
// Constructor
//------------------------------------
LLFollowCamParams::LLFollowCamParams()
{
- mMaxCameraDistantFromSubject = DEFAULT_MAX_DISTANCE_FROM_SUBJECT;
- mPositionLocked = false;
- mFocusLocked = false;
- mUsePosition = false;
- mUseFocus = false;
-
- //------------------------------------------------------
- // setting the attributes to their defaults
- //------------------------------------------------------
- setPositionLag ( FOLLOW_CAM_DEFAULT_POSITION_LAG );
- setFocusLag ( FOLLOW_CAM_DEFAULT_FOCUS_LAG );
- setPositionThreshold( FOLLOW_CAM_DEFAULT_POSITION_THRESHOLD );
- setFocusThreshold ( FOLLOW_CAM_DEFAULT_FOCUS_THRESHOLD );
- setBehindnessLag ( FOLLOW_CAM_DEFAULT_BEHINDNESS_LAG );
- setDistance ( FOLLOW_CAM_DEFAULT_DISTANCE );
- setPitch ( FOLLOW_CAM_DEFAULT_PITCH );
- setFocusOffset ( FOLLOW_CAM_DEFAULT_FOCUS_OFFSET );
- setBehindnessAngle ( FOLLOW_CAM_DEFAULT_BEHINDNESS_ANGLE );
- setPositionThreshold( FOLLOW_CAM_DEFAULT_POSITION_THRESHOLD );
- setFocusThreshold ( FOLLOW_CAM_DEFAULT_FOCUS_THRESHOLD );
+ mMaxCameraDistantFromSubject = DEFAULT_MAX_DISTANCE_FROM_SUBJECT;
+ mPositionLocked = false;
+ mFocusLocked = false;
+ mUsePosition = false;
+ mUseFocus = false;
+
+ //------------------------------------------------------
+ // setting the attributes to their defaults
+ //------------------------------------------------------
+ setPositionLag ( FOLLOW_CAM_DEFAULT_POSITION_LAG );
+ setFocusLag ( FOLLOW_CAM_DEFAULT_FOCUS_LAG );
+ setPositionThreshold( FOLLOW_CAM_DEFAULT_POSITION_THRESHOLD );
+ setFocusThreshold ( FOLLOW_CAM_DEFAULT_FOCUS_THRESHOLD );
+ setBehindnessLag ( FOLLOW_CAM_DEFAULT_BEHINDNESS_LAG );
+ setDistance ( FOLLOW_CAM_DEFAULT_DISTANCE );
+ setPitch ( FOLLOW_CAM_DEFAULT_PITCH );
+ setFocusOffset ( FOLLOW_CAM_DEFAULT_FOCUS_OFFSET );
+ setBehindnessAngle ( FOLLOW_CAM_DEFAULT_BEHINDNESS_ANGLE );
+ setPositionThreshold( FOLLOW_CAM_DEFAULT_POSITION_THRESHOLD );
+ setFocusThreshold ( FOLLOW_CAM_DEFAULT_FOCUS_THRESHOLD );
}
@@ -139,305 +139,305 @@ LLFollowCamParams::~LLFollowCamParams() { }
//---------------------------------------------------------
//---------------------------------------------------------
-void LLFollowCamParams::setPositionLag( F32 p )
-{
- mPositionLag = llclamp(p, FOLLOW_CAM_MIN_POSITION_LAG, FOLLOW_CAM_MAX_POSITION_LAG);
+void LLFollowCamParams::setPositionLag( F32 p )
+{
+ mPositionLag = llclamp(p, FOLLOW_CAM_MIN_POSITION_LAG, FOLLOW_CAM_MAX_POSITION_LAG);
}
//---------------------------------------------------------
-void LLFollowCamParams::setFocusLag( F32 f )
-{
- mFocusLag = llclamp(f, FOLLOW_CAM_MIN_FOCUS_LAG, FOLLOW_CAM_MAX_FOCUS_LAG);
+void LLFollowCamParams::setFocusLag( F32 f )
+{
+ mFocusLag = llclamp(f, FOLLOW_CAM_MIN_FOCUS_LAG, FOLLOW_CAM_MAX_FOCUS_LAG);
}
//---------------------------------------------------------
-void LLFollowCamParams::setPositionThreshold( F32 p )
-{
- mPositionThreshold = llclamp(p, FOLLOW_CAM_MIN_POSITION_THRESHOLD, FOLLOW_CAM_MAX_POSITION_THRESHOLD);
+void LLFollowCamParams::setPositionThreshold( F32 p )
+{
+ mPositionThreshold = llclamp(p, FOLLOW_CAM_MIN_POSITION_THRESHOLD, FOLLOW_CAM_MAX_POSITION_THRESHOLD);
}
//---------------------------------------------------------
-void LLFollowCamParams::setFocusThreshold( F32 f )
-{
- mFocusThreshold = llclamp(f, FOLLOW_CAM_MIN_FOCUS_THRESHOLD, FOLLOW_CAM_MAX_FOCUS_THRESHOLD);
+void LLFollowCamParams::setFocusThreshold( F32 f )
+{
+ mFocusThreshold = llclamp(f, FOLLOW_CAM_MIN_FOCUS_THRESHOLD, FOLLOW_CAM_MAX_FOCUS_THRESHOLD);
}
//---------------------------------------------------------
-void LLFollowCamParams::setPitch( F32 p )
-{
- mPitch = llclamp(p, FOLLOW_CAM_MIN_PITCH, FOLLOW_CAM_MAX_PITCH);
+void LLFollowCamParams::setPitch( F32 p )
+{
+ mPitch = llclamp(p, FOLLOW_CAM_MIN_PITCH, FOLLOW_CAM_MAX_PITCH);
}
//---------------------------------------------------------
-void LLFollowCamParams::setBehindnessLag( F32 b )
-{
- mBehindnessLag = llclamp(b, FOLLOW_CAM_MIN_BEHINDNESS_LAG, FOLLOW_CAM_MAX_BEHINDNESS_LAG);
+void LLFollowCamParams::setBehindnessLag( F32 b )
+{
+ mBehindnessLag = llclamp(b, FOLLOW_CAM_MIN_BEHINDNESS_LAG, FOLLOW_CAM_MAX_BEHINDNESS_LAG);
}
//---------------------------------------------------------
-void LLFollowCamParams::setBehindnessAngle( F32 b )
-{
- mBehindnessMaxAngle = llclamp(b, FOLLOW_CAM_MIN_BEHINDNESS_ANGLE, FOLLOW_CAM_MAX_BEHINDNESS_ANGLE);
+void LLFollowCamParams::setBehindnessAngle( F32 b )
+{
+ mBehindnessMaxAngle = llclamp(b, FOLLOW_CAM_MIN_BEHINDNESS_ANGLE, FOLLOW_CAM_MAX_BEHINDNESS_ANGLE);
}
//---------------------------------------------------------
-void LLFollowCamParams::setDistance( F32 d )
-{
- mDistance = llclamp(d, FOLLOW_CAM_MIN_DISTANCE, mMaxCameraDistantFromSubject);
+void LLFollowCamParams::setDistance( F32 d )
+{
+ mDistance = llclamp(d, FOLLOW_CAM_MIN_DISTANCE, mMaxCameraDistantFromSubject);
}
//---------------------------------------------------------
-void LLFollowCamParams::setPositionLocked( bool l )
+void LLFollowCamParams::setPositionLocked( bool l )
{
- mPositionLocked = l;
+ mPositionLocked = l;
}
//---------------------------------------------------------
-void LLFollowCamParams::setFocusLocked( bool l )
+void LLFollowCamParams::setFocusLocked( bool l )
{
- mFocusLocked = l;
+ mFocusLocked = l;
}
//---------------------------------------------------------
-void LLFollowCamParams::setFocusOffset( const LLVector3& v )
-{
- mFocusOffset = v;
- mFocusOffset.clamp(FOLLOW_CAM_MIN_FOCUS_OFFSET, FOLLOW_CAM_MAX_FOCUS_OFFSET);
+void LLFollowCamParams::setFocusOffset( const LLVector3& v )
+{
+ mFocusOffset = v;
+ mFocusOffset.clamp(FOLLOW_CAM_MIN_FOCUS_OFFSET, FOLLOW_CAM_MAX_FOCUS_OFFSET);
}
//---------------------------------------------------------
-void LLFollowCamParams::setPosition( const LLVector3& p )
-{
- mUsePosition = true;
- mPosition = p;
+void LLFollowCamParams::setPosition( const LLVector3& p )
+{
+ mUsePosition = true;
+ mPosition = p;
}
//---------------------------------------------------------
-void LLFollowCamParams::setFocus( const LLVector3& f )
-{
- mUseFocus = true;
- mFocus = f;
+void LLFollowCamParams::setFocus( const LLVector3& f )
+{
+ mUseFocus = true;
+ mFocus = f;
}
//---------------------------------------------------------
// buncho get methods
//---------------------------------------------------------
-F32 LLFollowCamParams::getPositionLag () const { return mPositionLag; }
-F32 LLFollowCamParams::getFocusLag () const { return mFocusLag; }
-F32 LLFollowCamParams::getPositionThreshold () const { return mPositionThreshold; }
-F32 LLFollowCamParams::getFocusThreshold () const { return mFocusThreshold; }
-F32 LLFollowCamParams::getDistance () const { return mDistance; }
-F32 LLFollowCamParams::getPitch () const { return mPitch; }
-LLVector3 LLFollowCamParams::getFocusOffset () const { return mFocusOffset; }
-F32 LLFollowCamParams::getBehindnessAngle () const { return mBehindnessMaxAngle; }
-F32 LLFollowCamParams::getBehindnessLag () const { return mBehindnessLag; }
-LLVector3 LLFollowCamParams::getPosition () const { return mPosition; }
-LLVector3 LLFollowCamParams::getFocus () const { return mFocus; }
-bool LLFollowCamParams::getPositionLocked () const { return mPositionLocked; }
-bool LLFollowCamParams::getFocusLocked () const { return mFocusLocked; }
+F32 LLFollowCamParams::getPositionLag () const { return mPositionLag; }
+F32 LLFollowCamParams::getFocusLag () const { return mFocusLag; }
+F32 LLFollowCamParams::getPositionThreshold () const { return mPositionThreshold; }
+F32 LLFollowCamParams::getFocusThreshold () const { return mFocusThreshold; }
+F32 LLFollowCamParams::getDistance () const { return mDistance; }
+F32 LLFollowCamParams::getPitch () const { return mPitch; }
+LLVector3 LLFollowCamParams::getFocusOffset () const { return mFocusOffset; }
+F32 LLFollowCamParams::getBehindnessAngle () const { return mBehindnessMaxAngle; }
+F32 LLFollowCamParams::getBehindnessLag () const { return mBehindnessLag; }
+LLVector3 LLFollowCamParams::getPosition () const { return mPosition; }
+LLVector3 LLFollowCamParams::getFocus () const { return mFocus; }
+bool LLFollowCamParams::getPositionLocked () const { return mPositionLocked; }
+bool LLFollowCamParams::getFocusLocked () const { return mFocusLocked; }
//------------------------------------
// Constructor
//------------------------------------
LLFollowCam::LLFollowCam() : LLFollowCamParams()
{
- mUpVector = LLVector3::z_axis;
- mSubjectPosition = LLVector3::zero;
- mSubjectRotation = LLQuaternion::DEFAULT;
+ mUpVector = LLVector3::z_axis;
+ mSubjectPosition = LLVector3::zero;
+ mSubjectRotation = LLQuaternion::DEFAULT;
- mZoomedToMinimumDistance = false;
- mPitchCos = mPitchSin = 0.f;
- mPitchSineAndCosineNeedToBeUpdated = true;
+ mZoomedToMinimumDistance = false;
+ mPitchCos = mPitchSin = 0.f;
+ mPitchSineAndCosineNeedToBeUpdated = true;
- mSimulatedDistance = mDistance;
+ mSimulatedDistance = mDistance;
}
void LLFollowCam::copyParams(LLFollowCamParams& params)
{
- setPositionLag(params.getPositionLag());
- setFocusLag(params.getFocusLag());
- setFocusThreshold( params.getFocusThreshold());
- setPositionThreshold(params.getPositionThreshold());
- setPitch(params.getPitch());
- setFocusOffset(params.getFocusOffset());
- setBehindnessAngle(params.getBehindnessAngle());
- setBehindnessLag(params.getBehindnessLag());
-
- setPositionLocked(params.getPositionLocked());
- setFocusLocked(params.getFocusLocked());
-
- setDistance(params.getDistance());
- if (params.getUsePosition())
- {
- setPosition(params.getPosition());
- }
- if (params.getUseFocus())
- {
- setFocus(params.getFocus());
- }
+ setPositionLag(params.getPositionLag());
+ setFocusLag(params.getFocusLag());
+ setFocusThreshold( params.getFocusThreshold());
+ setPositionThreshold(params.getPositionThreshold());
+ setPitch(params.getPitch());
+ setFocusOffset(params.getFocusOffset());
+ setBehindnessAngle(params.getBehindnessAngle());
+ setBehindnessLag(params.getBehindnessLag());
+
+ setPositionLocked(params.getPositionLocked());
+ setFocusLocked(params.getFocusLocked());
+
+ setDistance(params.getDistance());
+ if (params.getUsePosition())
+ {
+ setPosition(params.getPosition());
+ }
+ if (params.getUseFocus())
+ {
+ setFocus(params.getFocus());
+ }
}
//---------------------------------------------------------------------------------------------------------
void LLFollowCam::update()
{
- //####################################################################################
- // update Focus
- //####################################################################################
- LLVector3 offsetSubjectPosition = mSubjectPosition + (mFocusOffset * mSubjectRotation);
-
- LLVector3 simulated_pos_agent = gAgent.getPosAgentFromGlobal(mSimulatedPositionGlobal);
- LLVector3 vectorFromCameraToSubject = offsetSubjectPosition - simulated_pos_agent;
- F32 distanceFromCameraToSubject = vectorFromCameraToSubject.magVec();
-
- LLVector3 whereFocusWantsToBe = mFocus;
- LLVector3 focus_pt_agent = gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal);
- if ( mFocusLocked ) // if focus is locked, only relative focus needs to be updated
- {
- mRelativeFocus = (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation;
- }
- else
- {
- LLVector3 focusOffset = offsetSubjectPosition - focus_pt_agent;
- F32 focusOffsetDistance = focusOffset.magVec();
-
- LLVector3 focusOffsetDirection = focusOffset / focusOffsetDistance;
- whereFocusWantsToBe = focus_pt_agent +
- (focusOffsetDirection * (focusOffsetDistance - mFocusThreshold));
- if ( focusOffsetDistance > mFocusThreshold )
- {
- // this version normalizes focus threshold by distance
- // so that the effect is not changed with distance
- /*
- F32 focusThresholdNormalizedByDistance = distanceFromCameraToSubject * mFocusThreshold;
- if ( focusOffsetDistance > focusThresholdNormalizedByDistance )
- {
- LLVector3 focusOffsetDirection = focusOffset / focusOffsetDistance;
- F32 force = focusOffsetDistance - focusThresholdNormalizedByDistance;
- */
-
- F32 focusLagLerp = LLSmoothInterpolation::getInterpolant( mFocusLag );
- focus_pt_agent = lerp( focus_pt_agent, whereFocusWantsToBe, focusLagLerp );
- mSimulatedFocusGlobal = gAgent.getPosGlobalFromAgent(focus_pt_agent);
- }
- mRelativeFocus = lerp(mRelativeFocus, (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation, LLSmoothInterpolation::getInterpolant(0.05f));
- }// if focus is not locked ---------------------------------------------
-
-
- LLVector3 whereCameraPositionWantsToBe = gAgent.getPosAgentFromGlobal(mSimulatedPositionGlobal);
- if ( mPositionLocked )
- {
- mRelativePos = (whereCameraPositionWantsToBe - mSubjectPosition) * ~mSubjectRotation;
- }
- else
- {
- //####################################################################################
- // update Position
- //####################################################################################
- //-------------------------------------------------------------------------
- // I determine the horizontal vector from the camera to the subject
- //-------------------------------------------------------------------------
- LLVector3 horizontalVectorFromCameraToSubject = vectorFromCameraToSubject;
- horizontalVectorFromCameraToSubject.mV[VZ] = 0.0f;
-
- //---------------------------------------------------------
- // Now I determine the horizontal distance
- //---------------------------------------------------------
- F32 horizontalDistanceFromCameraToSubject = horizontalVectorFromCameraToSubject.magVec();
-
- //---------------------------------------------------------
- // Then I get the (normalized) horizontal direction...
- //---------------------------------------------------------
- LLVector3 horizontalDirectionFromCameraToSubject;
- if ( horizontalDistanceFromCameraToSubject < DISTANCE_EPSILON )
- {
- // make sure we still have a normalized vector if distance is really small
- // (this case is rare and fleeting)
- horizontalDirectionFromCameraToSubject = LLVector3::z_axis;
- }
- else
- {
- // I'm not using the "normalize" method, because I can just divide by horizontalDistanceFromCameraToSubject
- horizontalDirectionFromCameraToSubject = horizontalVectorFromCameraToSubject / horizontalDistanceFromCameraToSubject;
- }
-
- //------------------------------------------------------------------------------------------------------------
- // Here is where I determine an offset relative to subject position in oder to set the ideal position.
- //------------------------------------------------------------------------------------------------------------
- if ( mPitchSineAndCosineNeedToBeUpdated )
- {
- calculatePitchSineAndCosine();
- mPitchSineAndCosineNeedToBeUpdated = false;
- }
-
- LLVector3 positionOffsetFromSubject;
- positionOffsetFromSubject.setVec
- (
- horizontalDirectionFromCameraToSubject.mV[ VX ] * mPitchCos,
- horizontalDirectionFromCameraToSubject.mV[ VY ] * mPitchCos,
- -mPitchSin
- );
-
- positionOffsetFromSubject *= mSimulatedDistance;
-
- //----------------------------------------------------------------------
- // Finally, ideal position is set by taking the subject position and
- // extending the positionOffsetFromSubject from that
- //----------------------------------------------------------------------
- LLVector3 idealCameraPosition = offsetSubjectPosition - positionOffsetFromSubject;
-
- //--------------------------------------------------------------------------------
- // Now I prepare to move the current camera position towards its ideal position...
- //--------------------------------------------------------------------------------
- LLVector3 vectorFromPositionToIdealPosition = idealCameraPosition - simulated_pos_agent;
- F32 distanceFromPositionToIdealPosition = vectorFromPositionToIdealPosition.magVec();
-
- //put this inside of the block?
- LLVector3 normalFromPositionToIdealPosition = vectorFromPositionToIdealPosition / distanceFromPositionToIdealPosition;
-
- whereCameraPositionWantsToBe = simulated_pos_agent +
- (normalFromPositionToIdealPosition * (distanceFromPositionToIdealPosition - mPositionThreshold));
- //-------------------------------------------------------------------------------------------------
- // The following method takes the target camera position and resets it so that it stays "behind" the subject,
- // using behindness angle and behindness force as parameters affecting the exact behavior
- //-------------------------------------------------------------------------------------------------
- if ( distanceFromPositionToIdealPosition > mPositionThreshold )
- {
- F32 positionPullLerp = LLSmoothInterpolation::getInterpolant( mPositionLag );
- simulated_pos_agent = lerp( simulated_pos_agent, whereCameraPositionWantsToBe, positionPullLerp );
- }
-
- //--------------------------------------------------------------------
- // don't let the camera get farther than its official max distance
- //--------------------------------------------------------------------
- if ( distanceFromCameraToSubject > mMaxCameraDistantFromSubject )
- {
- LLVector3 directionFromCameraToSubject = vectorFromCameraToSubject / distanceFromCameraToSubject;
- simulated_pos_agent = offsetSubjectPosition - directionFromCameraToSubject * mMaxCameraDistantFromSubject;
- }
-
- ////-------------------------------------------------------------------------------------------------
- //// The following method takes mSimulatedPositionGlobal and resets it so that it stays "behind" the subject,
- //// using behindness angle and behindness force as parameters affecting the exact behavior
- ////-------------------------------------------------------------------------------------------------
- updateBehindnessConstraint(gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal), simulated_pos_agent);
- mSimulatedPositionGlobal = gAgent.getPosGlobalFromAgent(simulated_pos_agent);
-
- mRelativePos = lerp(mRelativePos, (simulated_pos_agent - mSubjectPosition) * ~mSubjectRotation, LLSmoothInterpolation::getInterpolant(0.05f));
- } // if position is not locked -----------------------------------------------------------
-
-
- //####################################################################################
- // update UpVector
- //####################################################################################
- // this just points upward for now, but I anticipate future effects requiring
- // some rolling ("banking" effects for fun, swoopy vehicles, etc.)
- mUpVector = LLVector3::z_axis;
+ //####################################################################################
+ // update Focus
+ //####################################################################################
+ LLVector3 offsetSubjectPosition = mSubjectPosition + (mFocusOffset * mSubjectRotation);
+
+ LLVector3 simulated_pos_agent = gAgent.getPosAgentFromGlobal(mSimulatedPositionGlobal);
+ LLVector3 vectorFromCameraToSubject = offsetSubjectPosition - simulated_pos_agent;
+ F32 distanceFromCameraToSubject = vectorFromCameraToSubject.magVec();
+
+ LLVector3 whereFocusWantsToBe = mFocus;
+ LLVector3 focus_pt_agent = gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal);
+ if ( mFocusLocked ) // if focus is locked, only relative focus needs to be updated
+ {
+ mRelativeFocus = (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation;
+ }
+ else
+ {
+ LLVector3 focusOffset = offsetSubjectPosition - focus_pt_agent;
+ F32 focusOffsetDistance = focusOffset.magVec();
+
+ LLVector3 focusOffsetDirection = focusOffset / focusOffsetDistance;
+ whereFocusWantsToBe = focus_pt_agent +
+ (focusOffsetDirection * (focusOffsetDistance - mFocusThreshold));
+ if ( focusOffsetDistance > mFocusThreshold )
+ {
+ // this version normalizes focus threshold by distance
+ // so that the effect is not changed with distance
+ /*
+ F32 focusThresholdNormalizedByDistance = distanceFromCameraToSubject * mFocusThreshold;
+ if ( focusOffsetDistance > focusThresholdNormalizedByDistance )
+ {
+ LLVector3 focusOffsetDirection = focusOffset / focusOffsetDistance;
+ F32 force = focusOffsetDistance - focusThresholdNormalizedByDistance;
+ */
+
+ F32 focusLagLerp = LLSmoothInterpolation::getInterpolant( mFocusLag );
+ focus_pt_agent = lerp( focus_pt_agent, whereFocusWantsToBe, focusLagLerp );
+ mSimulatedFocusGlobal = gAgent.getPosGlobalFromAgent(focus_pt_agent);
+ }
+ mRelativeFocus = lerp(mRelativeFocus, (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation, LLSmoothInterpolation::getInterpolant(0.05f));
+ }// if focus is not locked ---------------------------------------------
+
+
+ LLVector3 whereCameraPositionWantsToBe = gAgent.getPosAgentFromGlobal(mSimulatedPositionGlobal);
+ if ( mPositionLocked )
+ {
+ mRelativePos = (whereCameraPositionWantsToBe - mSubjectPosition) * ~mSubjectRotation;
+ }
+ else
+ {
+ //####################################################################################
+ // update Position
+ //####################################################################################
+ //-------------------------------------------------------------------------
+ // I determine the horizontal vector from the camera to the subject
+ //-------------------------------------------------------------------------
+ LLVector3 horizontalVectorFromCameraToSubject = vectorFromCameraToSubject;
+ horizontalVectorFromCameraToSubject.mV[VZ] = 0.0f;
+
+ //---------------------------------------------------------
+ // Now I determine the horizontal distance
+ //---------------------------------------------------------
+ F32 horizontalDistanceFromCameraToSubject = horizontalVectorFromCameraToSubject.magVec();
+
+ //---------------------------------------------------------
+ // Then I get the (normalized) horizontal direction...
+ //---------------------------------------------------------
+ LLVector3 horizontalDirectionFromCameraToSubject;
+ if ( horizontalDistanceFromCameraToSubject < DISTANCE_EPSILON )
+ {
+ // make sure we still have a normalized vector if distance is really small
+ // (this case is rare and fleeting)
+ horizontalDirectionFromCameraToSubject = LLVector3::z_axis;
+ }
+ else
+ {
+ // I'm not using the "normalize" method, because I can just divide by horizontalDistanceFromCameraToSubject
+ horizontalDirectionFromCameraToSubject = horizontalVectorFromCameraToSubject / horizontalDistanceFromCameraToSubject;
+ }
+
+ //------------------------------------------------------------------------------------------------------------
+ // Here is where I determine an offset relative to subject position in oder to set the ideal position.
+ //------------------------------------------------------------------------------------------------------------
+ if ( mPitchSineAndCosineNeedToBeUpdated )
+ {
+ calculatePitchSineAndCosine();
+ mPitchSineAndCosineNeedToBeUpdated = false;
+ }
+
+ LLVector3 positionOffsetFromSubject;
+ positionOffsetFromSubject.setVec
+ (
+ horizontalDirectionFromCameraToSubject.mV[ VX ] * mPitchCos,
+ horizontalDirectionFromCameraToSubject.mV[ VY ] * mPitchCos,
+ -mPitchSin
+ );
+
+ positionOffsetFromSubject *= mSimulatedDistance;
+
+ //----------------------------------------------------------------------
+ // Finally, ideal position is set by taking the subject position and
+ // extending the positionOffsetFromSubject from that
+ //----------------------------------------------------------------------
+ LLVector3 idealCameraPosition = offsetSubjectPosition - positionOffsetFromSubject;
+
+ //--------------------------------------------------------------------------------
+ // Now I prepare to move the current camera position towards its ideal position...
+ //--------------------------------------------------------------------------------
+ LLVector3 vectorFromPositionToIdealPosition = idealCameraPosition - simulated_pos_agent;
+ F32 distanceFromPositionToIdealPosition = vectorFromPositionToIdealPosition.magVec();
+
+ //put this inside of the block?
+ LLVector3 normalFromPositionToIdealPosition = vectorFromPositionToIdealPosition / distanceFromPositionToIdealPosition;
+
+ whereCameraPositionWantsToBe = simulated_pos_agent +
+ (normalFromPositionToIdealPosition * (distanceFromPositionToIdealPosition - mPositionThreshold));
+ //-------------------------------------------------------------------------------------------------
+ // The following method takes the target camera position and resets it so that it stays "behind" the subject,
+ // using behindness angle and behindness force as parameters affecting the exact behavior
+ //-------------------------------------------------------------------------------------------------
+ if ( distanceFromPositionToIdealPosition > mPositionThreshold )
+ {
+ F32 positionPullLerp = LLSmoothInterpolation::getInterpolant( mPositionLag );
+ simulated_pos_agent = lerp( simulated_pos_agent, whereCameraPositionWantsToBe, positionPullLerp );
+ }
+
+ //--------------------------------------------------------------------
+ // don't let the camera get farther than its official max distance
+ //--------------------------------------------------------------------
+ if ( distanceFromCameraToSubject > mMaxCameraDistantFromSubject )
+ {
+ LLVector3 directionFromCameraToSubject = vectorFromCameraToSubject / distanceFromCameraToSubject;
+ simulated_pos_agent = offsetSubjectPosition - directionFromCameraToSubject * mMaxCameraDistantFromSubject;
+ }
+
+ ////-------------------------------------------------------------------------------------------------
+ //// The following method takes mSimulatedPositionGlobal and resets it so that it stays "behind" the subject,
+ //// using behindness angle and behindness force as parameters affecting the exact behavior
+ ////-------------------------------------------------------------------------------------------------
+ updateBehindnessConstraint(gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal), simulated_pos_agent);
+ mSimulatedPositionGlobal = gAgent.getPosGlobalFromAgent(simulated_pos_agent);
+
+ mRelativePos = lerp(mRelativePos, (simulated_pos_agent - mSubjectPosition) * ~mSubjectRotation, LLSmoothInterpolation::getInterpolant(0.05f));
+ } // if position is not locked -----------------------------------------------------------
+
+
+ //####################################################################################
+ // update UpVector
+ //####################################################################################
+ // this just points upward for now, but I anticipate future effects requiring
+ // some rolling ("banking" effects for fun, swoopy vehicles, etc.)
+ mUpVector = LLVector3::z_axis;
}
@@ -445,209 +445,209 @@ void LLFollowCam::update()
//-------------------------------------------------------------------------------------
BOOL LLFollowCam::updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_position)
{
- BOOL constraint_active = FALSE;
- // only apply this stuff if the behindness angle is something other than opened up all the way
- if ( mBehindnessMaxAngle < FOLLOW_CAM_MAX_BEHINDNESS_ANGLE - FOLLOW_CAM_BEHINDNESS_EPSILON )
- {
- //--------------------------------------------------------------
- // horizontalized vector from focus to camera
- //--------------------------------------------------------------
- LLVector3 horizontalVectorFromFocusToCamera;
- horizontalVectorFromFocusToCamera.setVec(cam_position - focus);
- horizontalVectorFromFocusToCamera.mV[ VZ ] = 0.0f;
- F32 cameraZ = cam_position.mV[ VZ ];
-
- //--------------------------------------------------------------
- // distance of horizontalized vector
- //--------------------------------------------------------------
- F32 horizontalDistance = horizontalVectorFromFocusToCamera.magVec();
-
- //--------------------------------------------------------------------------------------------------
- // calculate horizontalized back vector of the subject and scale by horizontalDistance
- //--------------------------------------------------------------------------------------------------
- LLVector3 horizontalSubjectBack( -1.0f, 0.0f, 0.0f );
- horizontalSubjectBack *= mSubjectRotation;
- horizontalSubjectBack.mV[ VZ ] = 0.0f;
- horizontalSubjectBack.normVec(); // because horizontalizing might make it shorter than 1
- horizontalSubjectBack *= horizontalDistance;
-
- //--------------------------------------------------------------------------------------------------
- // find the angle (in degrees) between these vectors
- //--------------------------------------------------------------------------------------------------
- F32 cameraOffsetAngle = 0.f;
- LLVector3 cameraOffsetRotationAxis;
- LLQuaternion camera_offset_rotation;
- camera_offset_rotation.shortestArc(horizontalSubjectBack, horizontalVectorFromFocusToCamera);
- camera_offset_rotation.getAngleAxis(&cameraOffsetAngle, cameraOffsetRotationAxis);
- cameraOffsetAngle *= RAD_TO_DEG;
-
- if ( cameraOffsetAngle > mBehindnessMaxAngle )
- {
- F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLSmoothInterpolation::getInterpolant(mBehindnessLag);
- cam_position = focus + horizontalSubjectBack * (slerp(fraction, camera_offset_rotation, LLQuaternion::DEFAULT));
- cam_position.mV[VZ] = cameraZ; // clamp z value back to what it was before we started messing with it
- constraint_active = TRUE;
- }
- }
- return constraint_active;
+ BOOL constraint_active = FALSE;
+ // only apply this stuff if the behindness angle is something other than opened up all the way
+ if ( mBehindnessMaxAngle < FOLLOW_CAM_MAX_BEHINDNESS_ANGLE - FOLLOW_CAM_BEHINDNESS_EPSILON )
+ {
+ //--------------------------------------------------------------
+ // horizontalized vector from focus to camera
+ //--------------------------------------------------------------
+ LLVector3 horizontalVectorFromFocusToCamera;
+ horizontalVectorFromFocusToCamera.setVec(cam_position - focus);
+ horizontalVectorFromFocusToCamera.mV[ VZ ] = 0.0f;
+ F32 cameraZ = cam_position.mV[ VZ ];
+
+ //--------------------------------------------------------------
+ // distance of horizontalized vector
+ //--------------------------------------------------------------
+ F32 horizontalDistance = horizontalVectorFromFocusToCamera.magVec();
+
+ //--------------------------------------------------------------------------------------------------
+ // calculate horizontalized back vector of the subject and scale by horizontalDistance
+ //--------------------------------------------------------------------------------------------------
+ LLVector3 horizontalSubjectBack( -1.0f, 0.0f, 0.0f );
+ horizontalSubjectBack *= mSubjectRotation;
+ horizontalSubjectBack.mV[ VZ ] = 0.0f;
+ horizontalSubjectBack.normVec(); // because horizontalizing might make it shorter than 1
+ horizontalSubjectBack *= horizontalDistance;
+
+ //--------------------------------------------------------------------------------------------------
+ // find the angle (in degrees) between these vectors
+ //--------------------------------------------------------------------------------------------------
+ F32 cameraOffsetAngle = 0.f;
+ LLVector3 cameraOffsetRotationAxis;
+ LLQuaternion camera_offset_rotation;
+ camera_offset_rotation.shortestArc(horizontalSubjectBack, horizontalVectorFromFocusToCamera);
+ camera_offset_rotation.getAngleAxis(&cameraOffsetAngle, cameraOffsetRotationAxis);
+ cameraOffsetAngle *= RAD_TO_DEG;
+
+ if ( cameraOffsetAngle > mBehindnessMaxAngle )
+ {
+ F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLSmoothInterpolation::getInterpolant(mBehindnessLag);
+ cam_position = focus + horizontalSubjectBack * (slerp(fraction, camera_offset_rotation, LLQuaternion::DEFAULT));
+ cam_position.mV[VZ] = cameraZ; // clamp z value back to what it was before we started messing with it
+ constraint_active = TRUE;
+ }
+ }
+ return constraint_active;
}
//---------------------------------------------------------
void LLFollowCam::calculatePitchSineAndCosine()
{
- F32 radian = mPitch * DEG_TO_RAD;
- mPitchCos = cos( radian );
- mPitchSin = sin( radian );
+ F32 radian = mPitch * DEG_TO_RAD;
+ mPitchCos = cos( radian );
+ mPitchSin = sin( radian );
}
//---------------------------------------------------------
void LLFollowCam::setSubjectPositionAndRotation( const LLVector3 p, const LLQuaternion r )
{
- mSubjectPosition = p;
- mSubjectRotation = r;
+ mSubjectPosition = p;
+ mSubjectRotation = r;
}
//---------------------------------------------------------
-void LLFollowCam::zoom( S32 z )
-{
- F32 zoomAmount = z * mSimulatedDistance * FOLLOW_CAM_ZOOM_FACTOR;
-
- if (( zoomAmount < FOLLOW_CAM_MIN_ZOOM_AMOUNT )
- && ( zoomAmount > -FOLLOW_CAM_MIN_ZOOM_AMOUNT ))
- {
- if ( zoomAmount < 0.0f )
- {
- zoomAmount = -FOLLOW_CAM_MIN_ZOOM_AMOUNT;
- }
- else
- {
- zoomAmount = FOLLOW_CAM_MIN_ZOOM_AMOUNT;
- }
- }
-
- mSimulatedDistance += zoomAmount;
-
- mZoomedToMinimumDistance = false;
- if ( mSimulatedDistance < FOLLOW_CAM_MIN_DISTANCE )
- {
- mSimulatedDistance = FOLLOW_CAM_MIN_DISTANCE;
-
- // if zoomAmount is negative (i.e., getting closer), then
- // this signifies having hit the minimum:
- if ( zoomAmount < 0.0f )
- {
- mZoomedToMinimumDistance = true;
- }
- }
- else if ( mSimulatedDistance > mMaxCameraDistantFromSubject )
- {
- mSimulatedDistance = mMaxCameraDistantFromSubject;
- }
+void LLFollowCam::zoom( S32 z )
+{
+ F32 zoomAmount = z * mSimulatedDistance * FOLLOW_CAM_ZOOM_FACTOR;
+
+ if (( zoomAmount < FOLLOW_CAM_MIN_ZOOM_AMOUNT )
+ && ( zoomAmount > -FOLLOW_CAM_MIN_ZOOM_AMOUNT ))
+ {
+ if ( zoomAmount < 0.0f )
+ {
+ zoomAmount = -FOLLOW_CAM_MIN_ZOOM_AMOUNT;
+ }
+ else
+ {
+ zoomAmount = FOLLOW_CAM_MIN_ZOOM_AMOUNT;
+ }
+ }
+
+ mSimulatedDistance += zoomAmount;
+
+ mZoomedToMinimumDistance = false;
+ if ( mSimulatedDistance < FOLLOW_CAM_MIN_DISTANCE )
+ {
+ mSimulatedDistance = FOLLOW_CAM_MIN_DISTANCE;
+
+ // if zoomAmount is negative (i.e., getting closer), then
+ // this signifies having hit the minimum:
+ if ( zoomAmount < 0.0f )
+ {
+ mZoomedToMinimumDistance = true;
+ }
+ }
+ else if ( mSimulatedDistance > mMaxCameraDistantFromSubject )
+ {
+ mSimulatedDistance = mMaxCameraDistantFromSubject;
+ }
}
//---------------------------------------------------------
bool LLFollowCam::isZoomedToMinimumDistance()
{
- return mZoomedToMinimumDistance;
+ return mZoomedToMinimumDistance;
}
//---------------------------------------------------------
void LLFollowCam::reset( const LLVector3 p, const LLVector3 f , const LLVector3 u )
{
- setPosition(p);
- setFocus(f);
- mUpVector = u;
+ setPosition(p);
+ setFocus(f);
+ mUpVector = u;
}
//---------------------------------------------------------
void LLFollowCam::setMaxCameraDistantFromSubject( F32 m )
{
- mMaxCameraDistantFromSubject = m;
+ mMaxCameraDistantFromSubject = m;
}
-void LLFollowCam::setPitch( F32 p )
-{
- LLFollowCamParams::setPitch(p);
- mPitchSineAndCosineNeedToBeUpdated = true; // important
+void LLFollowCam::setPitch( F32 p )
+{
+ LLFollowCamParams::setPitch(p);
+ mPitchSineAndCosineNeedToBeUpdated = true; // important
}
-void LLFollowCam::setDistance( F32 d )
-{
- if (d != mDistance)
- {
- LLFollowCamParams::setDistance(d);
- mSimulatedDistance = d;
- mZoomedToMinimumDistance = false;
- }
+void LLFollowCam::setDistance( F32 d )
+{
+ if (d != mDistance)
+ {
+ LLFollowCamParams::setDistance(d);
+ mSimulatedDistance = d;
+ mZoomedToMinimumDistance = false;
+ }
}
-void LLFollowCam::setPosition( const LLVector3& p )
-{
- if (p != mPosition)
- {
- LLFollowCamParams::setPosition(p);
- mSimulatedPositionGlobal = gAgent.getPosGlobalFromAgent(mPosition);
- if (mPositionLocked)
- {
- mRelativePos = (mPosition - mSubjectPosition) * ~mSubjectRotation;
- }
- }
+void LLFollowCam::setPosition( const LLVector3& p )
+{
+ if (p != mPosition)
+ {
+ LLFollowCamParams::setPosition(p);
+ mSimulatedPositionGlobal = gAgent.getPosGlobalFromAgent(mPosition);
+ if (mPositionLocked)
+ {
+ mRelativePos = (mPosition - mSubjectPosition) * ~mSubjectRotation;
+ }
+ }
}
-void LLFollowCam::setFocus( const LLVector3& f )
-{
- if (f != mFocus)
- {
- LLFollowCamParams::setFocus(f);
- mSimulatedFocusGlobal = gAgent.getPosGlobalFromAgent(f);
- if (mFocusLocked)
- {
- mRelativeFocus = (mFocus - mSubjectPosition) * ~mSubjectRotation;
- }
- }
+void LLFollowCam::setFocus( const LLVector3& f )
+{
+ if (f != mFocus)
+ {
+ LLFollowCamParams::setFocus(f);
+ mSimulatedFocusGlobal = gAgent.getPosGlobalFromAgent(f);
+ if (mFocusLocked)
+ {
+ mRelativeFocus = (mFocus - mSubjectPosition) * ~mSubjectRotation;
+ }
+ }
}
void LLFollowCam::setPositionLocked( bool locked )
{
- LLFollowCamParams::setPositionLocked(locked);
- if (locked)
- {
- // propagate set position to relative position
- mRelativePos = (gAgent.getPosAgentFromGlobal(mSimulatedPositionGlobal) - mSubjectPosition) * ~mSubjectRotation;
- }
+ LLFollowCamParams::setPositionLocked(locked);
+ if (locked)
+ {
+ // propagate set position to relative position
+ mRelativePos = (gAgent.getPosAgentFromGlobal(mSimulatedPositionGlobal) - mSubjectPosition) * ~mSubjectRotation;
+ }
}
void LLFollowCam::setFocusLocked( bool locked )
{
- LLFollowCamParams::setFocusLocked(locked);
- if (locked)
- {
- // propagate set position to relative position
- mRelativeFocus = (gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal) - mSubjectPosition) * ~mSubjectRotation;
- }
+ LLFollowCamParams::setFocusLocked(locked);
+ if (locked)
+ {
+ // propagate set position to relative position
+ mRelativeFocus = (gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal) - mSubjectPosition) * ~mSubjectRotation;
+ }
}
-LLVector3 LLFollowCam::getSimulatedPosition() const
-{
- // return simulated position
- return mSubjectPosition + (mRelativePos * mSubjectRotation);
+LLVector3 LLFollowCam::getSimulatedPosition() const
+{
+ // return simulated position
+ return mSubjectPosition + (mRelativePos * mSubjectRotation);
}
-LLVector3 LLFollowCam::getSimulatedFocus() const
-{
- // return simulated focus point
- return mSubjectPosition + (mRelativeFocus * mSubjectRotation);
+LLVector3 LLFollowCam::getSimulatedFocus() const
+{
+ // return simulated focus point
+ return mSubjectPosition + (mRelativeFocus * mSubjectRotation);
}
-LLVector3 LLFollowCam::getUpVector()
-{
- return mUpVector;
+LLVector3 LLFollowCam::getUpVector()
+{
+ return mUpVector;
}
@@ -678,201 +678,201 @@ LLFollowCamMgr::~LLFollowCamMgr()
void LLFollowCamMgr::setPositionLag( const LLUUID& source, F32 lag)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setPositionLag(lag);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setPositionLag(lag);
+ }
}
void LLFollowCamMgr::setFocusLag( const LLUUID& source, F32 lag)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setFocusLag(lag);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setFocusLag(lag);
+ }
}
void LLFollowCamMgr::setFocusThreshold( const LLUUID& source, F32 threshold)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setFocusThreshold(threshold);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setFocusThreshold(threshold);
+ }
}
void LLFollowCamMgr::setPositionThreshold( const LLUUID& source, F32 threshold)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setPositionThreshold(threshold);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setPositionThreshold(threshold);
+ }
}
void LLFollowCamMgr::setDistance( const LLUUID& source, F32 distance)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setDistance(distance);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setDistance(distance);
+ }
}
void LLFollowCamMgr::setPitch( const LLUUID& source, F32 pitch)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setPitch(pitch);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setPitch(pitch);
+ }
}
void LLFollowCamMgr::setFocusOffset( const LLUUID& source, const LLVector3& offset)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setFocusOffset(offset);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setFocusOffset(offset);
+ }
}
void LLFollowCamMgr::setBehindnessAngle( const LLUUID& source, F32 angle)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setBehindnessAngle(angle);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setBehindnessAngle(angle);
+ }
}
void LLFollowCamMgr::setBehindnessLag( const LLUUID& source, F32 force)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setBehindnessLag(force);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setBehindnessLag(force);
+ }
}
void LLFollowCamMgr::setPosition( const LLUUID& source, const LLVector3 position)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setPosition(position);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setPosition(position);
+ }
}
void LLFollowCamMgr::setFocus( const LLUUID& source, const LLVector3 focus)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setFocus(focus);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setFocus(focus);
+ }
}
void LLFollowCamMgr::setPositionLocked( const LLUUID& source, bool locked)
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setPositionLocked(locked);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setPositionLocked(locked);
+ }
}
void LLFollowCamMgr::setFocusLocked( const LLUUID& source, bool locked )
{
- LLFollowCamParams* paramsp = getParamsForID(source);
- if (paramsp)
- {
- paramsp->setFocusLocked(locked);
- }
+ LLFollowCamParams* paramsp = getParamsForID(source);
+ if (paramsp)
+ {
+ paramsp->setFocusLocked(locked);
+ }
}
LLFollowCamParams* LLFollowCamMgr::getParamsForID(const LLUUID& source)
{
- LLFollowCamParams* params = NULL;
+ LLFollowCamParams* params = NULL;
- param_map_t::iterator found_it = mParamMap.find(source);
- if (found_it == mParamMap.end()) // didn't find it?
- {
- params = new LLFollowCamParams();
- mParamMap[source] = params;
- }
- else
- {
- params = found_it->second;
- }
+ param_map_t::iterator found_it = mParamMap.find(source);
+ if (found_it == mParamMap.end()) // didn't find it?
+ {
+ params = new LLFollowCamParams();
+ mParamMap[source] = params;
+ }
+ else
+ {
+ params = found_it->second;
+ }
- return params;
+ return params;
}
LLFollowCamParams* LLFollowCamMgr::getActiveFollowCamParams()
{
- if (mParamStack.empty())
- {
- return NULL;
- }
+ if (mParamStack.empty())
+ {
+ return NULL;
+ }
- return mParamStack.back();
+ return mParamStack.back();
}
void LLFollowCamMgr::setCameraActive( const LLUUID& source, bool active )
{
- LLFollowCamParams* params = getParamsForID(source);
- param_stack_t::iterator found_it = std::find(mParamStack.begin(), mParamStack.end(), params);
- if (found_it != mParamStack.end())
- {
- mParamStack.erase(found_it);
- }
- // put on top of stack
- if(active)
- {
- mParamStack.push_back(params);
- }
+ LLFollowCamParams* params = getParamsForID(source);
+ param_stack_t::iterator found_it = std::find(mParamStack.begin(), mParamStack.end(), params);
+ if (found_it != mParamStack.end())
+ {
+ mParamStack.erase(found_it);
+ }
+ // put on top of stack
+ if(active)
+ {
+ mParamStack.push_back(params);
+ }
}
void LLFollowCamMgr::removeFollowCamParams(const LLUUID& source)
{
- setCameraActive(source, FALSE);
- LLFollowCamParams* params = getParamsForID(source);
- mParamMap.erase(source);
- delete params;
+ setCameraActive(source, FALSE);
+ LLFollowCamParams* params = getParamsForID(source);
+ mParamMap.erase(source);
+ delete params;
}
bool LLFollowCamMgr::isScriptedCameraSource(const LLUUID& source)
{
- param_map_t::iterator found_it = mParamMap.find(source);
- return (found_it != mParamMap.end());
+ param_map_t::iterator found_it = mParamMap.find(source);
+ return (found_it != mParamMap.end());
}
void LLFollowCamMgr::dump()
{
- S32 param_count = 0;
- LL_INFOS() << "Scripted camera active stack" << LL_ENDL;
- for (param_stack_t::iterator param_it = mParamStack.begin();
- param_it != mParamStack.end();
- ++param_it)
- {
- LL_INFOS() << param_count++ <<
- " rot_limit: " << (*param_it)->getBehindnessAngle() <<
- " rot_lag: " << (*param_it)->getBehindnessLag() <<
- " distance: " << (*param_it)->getDistance() <<
- " focus: " << (*param_it)->getFocus() <<
- " foc_lag: " << (*param_it)->getFocusLag() <<
- " foc_lock: " << ((*param_it)->getFocusLocked() ? "Y" : "N") <<
- " foc_offset: " << (*param_it)->getFocusOffset() <<
- " foc_thresh: " << (*param_it)->getFocusThreshold() <<
- " pitch: " << (*param_it)->getPitch() <<
- " pos: " << (*param_it)->getPosition() <<
- " pos_lag: " << (*param_it)->getPositionLag() <<
- " pos_lock: " << ((*param_it)->getPositionLocked() ? "Y" : "N") <<
- " pos_thresh: " << (*param_it)->getPositionThreshold() << LL_ENDL;
- }
+ S32 param_count = 0;
+ LL_INFOS() << "Scripted camera active stack" << LL_ENDL;
+ for (param_stack_t::iterator param_it = mParamStack.begin();
+ param_it != mParamStack.end();
+ ++param_it)
+ {
+ LL_INFOS() << param_count++ <<
+ " rot_limit: " << (*param_it)->getBehindnessAngle() <<
+ " rot_lag: " << (*param_it)->getBehindnessLag() <<
+ " distance: " << (*param_it)->getDistance() <<
+ " focus: " << (*param_it)->getFocus() <<
+ " foc_lag: " << (*param_it)->getFocusLag() <<
+ " foc_lock: " << ((*param_it)->getFocusLocked() ? "Y" : "N") <<
+ " foc_offset: " << (*param_it)->getFocusOffset() <<
+ " foc_thresh: " << (*param_it)->getFocusThreshold() <<
+ " pitch: " << (*param_it)->getPitch() <<
+ " pos: " << (*param_it)->getPosition() <<
+ " pos_lag: " << (*param_it)->getPositionLag() <<
+ " pos_lock: " << ((*param_it)->getPositionLocked() ? "Y" : "N") <<
+ " pos_thresh: " << (*param_it)->getPositionThreshold() << LL_ENDL;
+ }
}
diff --git a/indra/newview/llfollowcam.h b/indra/newview/llfollowcam.h
index 7995848160..509d654fb6 100644
--- a/indra/newview/llfollowcam.h
+++ b/indra/newview/llfollowcam.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llfollowcam.h
* @author Jeffrey Ventrella
* @brief LLFollowCam class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,12 +28,12 @@
//--------------------------------------------------------------------
// FollowCam
//
-// The FollowCam controls three dynamic variables which determine
+// The FollowCam controls three dynamic variables which determine
// a camera orientation and position for a "loose" third-person view
-// (orientation being derived from a combination of focus and up
-// vector). It is good for fast-moving vehicles that change
-// acceleration a lot, but it can also be general-purpose, like for
-// avatar navigation. It has a handful of parameters allowing it to
+// (orientation being derived from a combination of focus and up
+// vector). It is good for fast-moving vehicles that change
+// acceleration a lot, but it can also be general-purpose, like for
+// avatar navigation. It has a handful of parameters allowing it to
// be tweaked to assume different styles of tracking objects.
//
//--------------------------------------------------------------------
@@ -52,143 +52,143 @@
class LLFollowCamParams
{
public:
- LLFollowCamParams();
- virtual ~LLFollowCamParams();
-
- //--------------------------------------
- // setty setty set set
- //--------------------------------------
- virtual void setPositionLag ( F32 );
- virtual void setFocusLag ( F32 );
- virtual void setFocusThreshold ( F32 );
- virtual void setPositionThreshold ( F32 );
- virtual void setDistance ( F32 );
- virtual void setPitch ( F32 );
- virtual void setFocusOffset ( const LLVector3& );
- virtual void setBehindnessAngle ( F32 );
- virtual void setBehindnessLag ( F32 );
- virtual void setPosition ( const LLVector3& );
- virtual void setFocus ( const LLVector3& );
- virtual void setPositionLocked ( bool );
- virtual void setFocusLocked ( bool );
-
-
- //--------------------------------------
- // getty getty get get
- //--------------------------------------
- virtual F32 getPositionLag() const;
- virtual F32 getFocusLag() const;
- virtual F32 getPositionThreshold() const;
- virtual F32 getFocusThreshold() const;
- virtual F32 getDistance() const;
- virtual F32 getPitch() const;
- virtual LLVector3 getFocusOffset() const;
- virtual F32 getBehindnessAngle() const;
- virtual F32 getBehindnessLag() const;
- virtual LLVector3 getPosition() const;
- virtual LLVector3 getFocus() const;
- virtual bool getFocusLocked() const;
- virtual bool getPositionLocked() const;
- virtual bool getUseFocus() const { return mUseFocus; }
- virtual bool getUsePosition() const { return mUsePosition; }
+ LLFollowCamParams();
+ virtual ~LLFollowCamParams();
+
+ //--------------------------------------
+ // setty setty set set
+ //--------------------------------------
+ virtual void setPositionLag ( F32 );
+ virtual void setFocusLag ( F32 );
+ virtual void setFocusThreshold ( F32 );
+ virtual void setPositionThreshold ( F32 );
+ virtual void setDistance ( F32 );
+ virtual void setPitch ( F32 );
+ virtual void setFocusOffset ( const LLVector3& );
+ virtual void setBehindnessAngle ( F32 );
+ virtual void setBehindnessLag ( F32 );
+ virtual void setPosition ( const LLVector3& );
+ virtual void setFocus ( const LLVector3& );
+ virtual void setPositionLocked ( bool );
+ virtual void setFocusLocked ( bool );
+
+
+ //--------------------------------------
+ // getty getty get get
+ //--------------------------------------
+ virtual F32 getPositionLag() const;
+ virtual F32 getFocusLag() const;
+ virtual F32 getPositionThreshold() const;
+ virtual F32 getFocusThreshold() const;
+ virtual F32 getDistance() const;
+ virtual F32 getPitch() const;
+ virtual LLVector3 getFocusOffset() const;
+ virtual F32 getBehindnessAngle() const;
+ virtual F32 getBehindnessLag() const;
+ virtual LLVector3 getPosition() const;
+ virtual LLVector3 getFocus() const;
+ virtual bool getFocusLocked() const;
+ virtual bool getPositionLocked() const;
+ virtual bool getUseFocus() const { return mUseFocus; }
+ virtual bool getUsePosition() const { return mUsePosition; }
protected:
- F32 mPositionLag;
- F32 mFocusLag;
- F32 mFocusThreshold;
- F32 mPositionThreshold;
- F32 mDistance;
- F32 mPitch;
- LLVector3 mFocusOffset;
- F32 mBehindnessMaxAngle;
- F32 mBehindnessLag;
- F32 mMaxCameraDistantFromSubject;
-
- bool mPositionLocked;
- bool mFocusLocked;
- bool mUsePosition; // specific camera point specified by script
- bool mUseFocus; // specific focus point specified by script
- LLVector3 mPosition; // where the camera is (in world-space)
- LLVector3 mFocus; // what the camera is aimed at (in world-space)
+ F32 mPositionLag;
+ F32 mFocusLag;
+ F32 mFocusThreshold;
+ F32 mPositionThreshold;
+ F32 mDistance;
+ F32 mPitch;
+ LLVector3 mFocusOffset;
+ F32 mBehindnessMaxAngle;
+ F32 mBehindnessLag;
+ F32 mMaxCameraDistantFromSubject;
+
+ bool mPositionLocked;
+ bool mFocusLocked;
+ bool mUsePosition; // specific camera point specified by script
+ bool mUseFocus; // specific focus point specified by script
+ LLVector3 mPosition; // where the camera is (in world-space)
+ LLVector3 mFocus; // what the camera is aimed at (in world-space)
};
class LLFollowCam : public LLFollowCamParams
{
public:
- //--------------------
- // Contructor
- //--------------------
- LLFollowCam();
-
- //--------------------
- // Destructor
- //--------------------
- virtual ~LLFollowCam();
-
- //---------------------------------------------------------------------------------------
- // The following methods must be called every time step. However, if you know for
- // sure that your subject matter (what the camera is looking at) is not moving,
- // then you can get away with not calling "update" But keep in mind that "update"
- // may still be needed after the subject matter has stopped moving because the
- // camera may still need to animate itself catching up to its ideal resting place.
- //---------------------------------------------------------------------------------------
- void setSubjectPositionAndRotation ( const LLVector3 p, const LLQuaternion r );
- void update();
-
- // initialize from another instance of llfollowcamparams
- void copyParams(LLFollowCamParams& params);
-
- //-----------------------------------------------------------------------------------
- // this is how to bang the followCam into a specific configuration. Keep in mind
- // that it will immediately try to adjust these values according to its attributes.
- //-----------------------------------------------------------------------------------
- void reset( const LLVector3 position, const LLVector3 focus, const LLVector3 upVector );
-
- void setMaxCameraDistantFromSubject ( F32 m ); // this should be determined by llAgent
- bool isZoomedToMinimumDistance();
- LLVector3 getUpVector();
- void zoom( S32 );
-
- // overrides for setters and getters
- virtual void setPitch( F32 );
- virtual void setDistance( F32 );
- virtual void setPosition(const LLVector3& pos);
- virtual void setFocus(const LLVector3& focus);
- virtual void setPositionLocked ( bool );
- virtual void setFocusLocked ( bool );
-
- LLVector3 getSimulatedPosition() const;
- LLVector3 getSimulatedFocus() const;
-
- //------------------------------------------
- // protected members of FollowCam
- //------------------------------------------
+ //--------------------
+ // Contructor
+ //--------------------
+ LLFollowCam();
+
+ //--------------------
+ // Destructor
+ //--------------------
+ virtual ~LLFollowCam();
+
+ //---------------------------------------------------------------------------------------
+ // The following methods must be called every time step. However, if you know for
+ // sure that your subject matter (what the camera is looking at) is not moving,
+ // then you can get away with not calling "update" But keep in mind that "update"
+ // may still be needed after the subject matter has stopped moving because the
+ // camera may still need to animate itself catching up to its ideal resting place.
+ //---------------------------------------------------------------------------------------
+ void setSubjectPositionAndRotation ( const LLVector3 p, const LLQuaternion r );
+ void update();
+
+ // initialize from another instance of llfollowcamparams
+ void copyParams(LLFollowCamParams& params);
+
+ //-----------------------------------------------------------------------------------
+ // this is how to bang the followCam into a specific configuration. Keep in mind
+ // that it will immediately try to adjust these values according to its attributes.
+ //-----------------------------------------------------------------------------------
+ void reset( const LLVector3 position, const LLVector3 focus, const LLVector3 upVector );
+
+ void setMaxCameraDistantFromSubject ( F32 m ); // this should be determined by llAgent
+ bool isZoomedToMinimumDistance();
+ LLVector3 getUpVector();
+ void zoom( S32 );
+
+ // overrides for setters and getters
+ virtual void setPitch( F32 );
+ virtual void setDistance( F32 );
+ virtual void setPosition(const LLVector3& pos);
+ virtual void setFocus(const LLVector3& focus);
+ virtual void setPositionLocked ( bool );
+ virtual void setFocusLocked ( bool );
+
+ LLVector3 getSimulatedPosition() const;
+ LLVector3 getSimulatedFocus() const;
+
+ //------------------------------------------
+ // protected members of FollowCam
+ //------------------------------------------
protected:
- F32 mPitchCos; // derived from mPitch
- F32 mPitchSin; // derived from mPitch
- LLGlobalVec mSimulatedPositionGlobal; // where the camera is (global coordinates), simulated
- LLGlobalVec mSimulatedFocusGlobal; // what the camera is aimed at (global coordinates), simulated
- F32 mSimulatedDistance;
-
- //---------------------
- // dynamic variables
- //---------------------
- bool mZoomedToMinimumDistance;
- LLFrameTimer mTimer;
- LLVector3 mSubjectPosition; // this is the position of what I'm looking at
- LLQuaternion mSubjectRotation; // this is the rotation of what I'm looking at
- LLVector3 mUpVector; // the camera's up vector in world-space (determines roll)
- LLVector3 mRelativeFocus;
- LLVector3 mRelativePos;
-
- bool mPitchSineAndCosineNeedToBeUpdated;
-
- //------------------------------------------
- // protected methods of FollowCam
- //------------------------------------------
+ F32 mPitchCos; // derived from mPitch
+ F32 mPitchSin; // derived from mPitch
+ LLGlobalVec mSimulatedPositionGlobal; // where the camera is (global coordinates), simulated
+ LLGlobalVec mSimulatedFocusGlobal; // what the camera is aimed at (global coordinates), simulated
+ F32 mSimulatedDistance;
+
+ //---------------------
+ // dynamic variables
+ //---------------------
+ bool mZoomedToMinimumDistance;
+ LLFrameTimer mTimer;
+ LLVector3 mSubjectPosition; // this is the position of what I'm looking at
+ LLQuaternion mSubjectRotation; // this is the rotation of what I'm looking at
+ LLVector3 mUpVector; // the camera's up vector in world-space (determines roll)
+ LLVector3 mRelativeFocus;
+ LLVector3 mRelativePos;
+
+ bool mPitchSineAndCosineNeedToBeUpdated;
+
+ //------------------------------------------
+ // protected methods of FollowCam
+ //------------------------------------------
protected:
- void calculatePitchSineAndCosine();
- BOOL updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_position);
+ void calculatePitchSineAndCosine();
+ BOOL updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_position);
};// end of FollowCam class
@@ -197,36 +197,36 @@ class LLFollowCamMgr : public LLSingleton<LLFollowCamMgr>
{
LLSINGLETON(LLFollowCamMgr);
~LLFollowCamMgr();
-public:
- void setPositionLag ( const LLUUID& source, F32 lag);
- void setFocusLag ( const LLUUID& source, F32 lag);
- void setFocusThreshold ( const LLUUID& source, F32 threshold);
- void setPositionThreshold ( const LLUUID& source, F32 threshold);
- void setDistance ( const LLUUID& source, F32 distance);
- void setPitch ( const LLUUID& source, F32 pitch);
- void setFocusOffset ( const LLUUID& source, const LLVector3& offset);
- void setBehindnessAngle ( const LLUUID& source, F32 angle);
- void setBehindnessLag ( const LLUUID& source, F32 lag);
- void setPosition ( const LLUUID& source, const LLVector3 position);
- void setFocus ( const LLUUID& source, const LLVector3 focus);
- void setPositionLocked ( const LLUUID& source, bool locked);
- void setFocusLocked ( const LLUUID& source, bool locked );
-
- void setCameraActive ( const LLUUID& source, bool active );
-
- LLFollowCamParams* getActiveFollowCamParams();
- LLFollowCamParams* getParamsForID(const LLUUID& source);
- void removeFollowCamParams(const LLUUID& source);
- bool isScriptedCameraSource(const LLUUID& source);
- void dump();
+public:
+ void setPositionLag ( const LLUUID& source, F32 lag);
+ void setFocusLag ( const LLUUID& source, F32 lag);
+ void setFocusThreshold ( const LLUUID& source, F32 threshold);
+ void setPositionThreshold ( const LLUUID& source, F32 threshold);
+ void setDistance ( const LLUUID& source, F32 distance);
+ void setPitch ( const LLUUID& source, F32 pitch);
+ void setFocusOffset ( const LLUUID& source, const LLVector3& offset);
+ void setBehindnessAngle ( const LLUUID& source, F32 angle);
+ void setBehindnessLag ( const LLUUID& source, F32 lag);
+ void setPosition ( const LLUUID& source, const LLVector3 position);
+ void setFocus ( const LLUUID& source, const LLVector3 focus);
+ void setPositionLocked ( const LLUUID& source, bool locked);
+ void setFocusLocked ( const LLUUID& source, bool locked );
+
+ void setCameraActive ( const LLUUID& source, bool active );
+
+ LLFollowCamParams* getActiveFollowCamParams();
+ LLFollowCamParams* getParamsForID(const LLUUID& source);
+ void removeFollowCamParams(const LLUUID& source);
+ bool isScriptedCameraSource(const LLUUID& source);
+ void dump();
protected:
- typedef std::map<LLUUID, LLFollowCamParams*> param_map_t;
- param_map_t mParamMap;
+ typedef std::map<LLUUID, LLFollowCamParams*> param_map_t;
+ param_map_t mParamMap;
- typedef std::vector<LLFollowCamParams*> param_stack_t;
- param_stack_t mParamStack;
+ typedef std::vector<LLFollowCamParams*> param_stack_t;
+ param_stack_t mParamStack;
};
#endif //LL_FOLLOWCAM_H
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index 142177010f..3f9c3ee683 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfriendcard.cpp
* @brief Implementation of classes to process Friends Cards
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -58,42 +58,42 @@ static const std::string INVENTORY_STRING_FRIENDS_ALL_SUBFOLDER = "All";
// or these folders are not protected these names should be localized in another place/way.
inline const std::string get_friend_folder_name()
{
- return INVENTORY_STRING_FRIENDS_SUBFOLDER;
+ return INVENTORY_STRING_FRIENDS_SUBFOLDER;
}
inline const std::string get_friend_all_subfolder_name()
{
- return INVENTORY_STRING_FRIENDS_ALL_SUBFOLDER;
+ return INVENTORY_STRING_FRIENDS_ALL_SUBFOLDER;
}
void move_from_to_arrays(LLInventoryModel::cat_array_t& from, LLInventoryModel::cat_array_t& to)
{
- while (from.size() > 0)
- {
- to.push_back(from.at(0));
- from.erase(from.begin());
- }
+ while (from.size() > 0)
+ {
+ to.push_back(from.at(0));
+ from.erase(from.begin());
+ }
}
const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollectFunctor& matchFunctor)
{
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
- gInventory.collectDescendentsIf(parentFolderUUID, cats, items,
- LLInventoryModel::EXCLUDE_TRASH, matchFunctor);
+ gInventory.collectDescendentsIf(parentFolderUUID, cats, items,
+ LLInventoryModel::EXCLUDE_TRASH, matchFunctor);
- S32 cats_count = cats.size();
+ S32 cats_count = cats.size();
- if (cats_count > 1)
- {
- LL_WARNS_ONCE("LLFriendCardsManager")
- << "There is more than one Friend card folder."
- << "The first folder will be used."
- << LL_ENDL;
- }
+ if (cats_count > 1)
+ {
+ LL_WARNS_ONCE("LLFriendCardsManager")
+ << "There is more than one Friend card folder."
+ << "The first folder will be used."
+ << LL_ENDL;
+ }
- return (cats_count >= 1) ? cats.at(0)->getUUID() : LLUUID::null;
+ return (cats_count >= 1) ? cats.at(0)->getUUID() : LLUUID::null;
}
/**
@@ -105,25 +105,25 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect
class LLFindAgentCallingCard : public LLInventoryCollectFunctor
{
public:
- LLFindAgentCallingCard() : mIsAgentCallingCardFound(false) {}
- virtual ~LLFindAgentCallingCard() {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
- bool isAgentCallingCardFound() { return mIsAgentCallingCardFound; }
+ LLFindAgentCallingCard() : mIsAgentCallingCardFound(false) {}
+ virtual ~LLFindAgentCallingCard() {}
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+ bool isAgentCallingCardFound() { return mIsAgentCallingCardFound; }
private:
- bool mIsAgentCallingCardFound;
+ bool mIsAgentCallingCardFound;
};
bool LLFindAgentCallingCard::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- if (mIsAgentCallingCardFound) return true;
+ if (mIsAgentCallingCardFound) return true;
- if (item && item->getType() == LLAssetType::AT_CALLINGCARD && item->getCreatorUUID() == gAgentID)
- {
- mIsAgentCallingCardFound = true;
- }
+ if (item && item->getType() == LLAssetType::AT_CALLINGCARD && item->getCreatorUUID() == gAgentID)
+ {
+ mIsAgentCallingCardFound = true;
+ }
- return mIsAgentCallingCardFound;
+ return mIsAgentCallingCardFound;
}
/**
@@ -136,196 +136,196 @@ bool LLFindAgentCallingCard::operator()(LLInventoryCategory* cat, LLInventoryIte
class LLInitialFriendCardsFetch : public LLInventoryFetchDescendentsObserver
{
public:
- typedef boost::function<void()> callback_t;
+ typedef boost::function<void()> callback_t;
- LLInitialFriendCardsFetch(const LLUUID& folder_id,
- callback_t cb) :
- LLInventoryFetchDescendentsObserver(folder_id),
- mCheckFolderCallback(cb)
- {}
+ LLInitialFriendCardsFetch(const LLUUID& folder_id,
+ callback_t cb) :
+ LLInventoryFetchDescendentsObserver(folder_id),
+ mCheckFolderCallback(cb)
+ {}
- /* virtual */ void done();
+ /* virtual */ void done();
private:
- callback_t mCheckFolderCallback;
+ callback_t mCheckFolderCallback;
};
void LLInitialFriendCardsFetch::done()
{
- // This observer is no longer needed.
- gInventory.removeObserver(this);
+ // This observer is no longer needed.
+ gInventory.removeObserver(this);
- doOnIdleOneTime(mCheckFolderCallback);
+ doOnIdleOneTime(mCheckFolderCallback);
- delete this;
+ delete this;
}
// LLFriendCardsManager Constructor / Destructor
LLFriendCardsManager::LLFriendCardsManager()
: mState(INIT)
{
- LLAvatarTracker::instance().addObserver(this);
+ LLAvatarTracker::instance().addObserver(this);
}
LLFriendCardsManager::~LLFriendCardsManager()
{
- LLAvatarTracker::instance().removeObserver(this);
+ LLAvatarTracker::instance().removeObserver(this);
}
void LLFriendCardsManager::putAvatarData(const LLUUID& avatarID)
{
- LL_INFOS() << "Store avatar data, avatarID: " << avatarID << LL_ENDL;
- std::pair< avatar_uuid_set_t::iterator, bool > pr;
- pr = mBuddyIDSet.insert(avatarID);
- if (pr.second == false)
- {
- LL_WARNS() << "Trying to add avatar UUID for the stored avatar: "
- << avatarID
- << LL_ENDL;
- }
+ LL_INFOS() << "Store avatar data, avatarID: " << avatarID << LL_ENDL;
+ std::pair< avatar_uuid_set_t::iterator, bool > pr;
+ pr = mBuddyIDSet.insert(avatarID);
+ if (pr.second == false)
+ {
+ LL_WARNS() << "Trying to add avatar UUID for the stored avatar: "
+ << avatarID
+ << LL_ENDL;
+ }
}
const LLUUID LLFriendCardsManager::extractAvatarID(const LLUUID& avatarID)
{
- LLUUID rv;
- avatar_uuid_set_t::iterator it = mBuddyIDSet.find(avatarID);
- if (mBuddyIDSet.end() == it)
- {
- LL_WARNS() << "Call method for non-existent avatar name in the map: " << avatarID << LL_ENDL;
- }
- else
- {
- rv = (*it);
- mBuddyIDSet.erase(it);
- }
- return rv;
+ LLUUID rv;
+ avatar_uuid_set_t::iterator it = mBuddyIDSet.find(avatarID);
+ if (mBuddyIDSet.end() == it)
+ {
+ LL_WARNS() << "Call method for non-existent avatar name in the map: " << avatarID << LL_ENDL;
+ }
+ else
+ {
+ rv = (*it);
+ mBuddyIDSet.erase(it);
+ }
+ return rv;
}
bool LLFriendCardsManager::isItemInAnyFriendsList(const LLViewerInventoryItem* item)
{
- if (item->getType() != LLAssetType::AT_CALLINGCARD)
- return false;
+ if (item->getType() != LLAssetType::AT_CALLINGCARD)
+ return false;
- LLInventoryModel::item_array_t items;
- findMatchedFriendCards(item->getCreatorUUID(), items);
+ LLInventoryModel::item_array_t items;
+ findMatchedFriendCards(item->getCreatorUUID(), items);
- return items.size() > 0;
+ return items.size() > 0;
}
-bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObject* obj,
- const LLViewerInventoryCategory* cat) const
+bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObject* obj,
+ const LLViewerInventoryCategory* cat) const
{
- // we need both params to proceed.
- if ( !obj || !cat )
- return false;
-
- // Need to check that target category is in the Calling Card/Friends folder.
- // In other case function returns unpredictable result.
- if ( !isCategoryInFriendFolder(cat) )
- return false;
-
- bool result = false;
-
- LLInventoryModel::item_array_t* items;
- LLInventoryModel::cat_array_t* cats;
-
- gInventory.lockDirectDescendentArrays(cat->getUUID(), cats, items);
- if ( items )
- {
- if ( obj->getType() == LLAssetType::AT_CALLINGCARD )
- {
- // For CALLINGCARD compare items by creator's id, if they are equal assume
- // that it is same card and return true. Note: UUID's of compared items
- // may be not equal. Also, we already know that obj should be type of LLInventoryItem,
- // but in case inventory database is broken check what dynamic_cast returns.
- const LLInventoryItem* item = dynamic_cast < const LLInventoryItem* > (obj);
- if ( item )
- {
- LLUUID creator_id = item->getCreatorUUID();
- LLViewerInventoryItem* cur_item = NULL;
- for ( S32 i = items->size() - 1; i >= 0; --i )
- {
- cur_item = items->at(i);
- if ( creator_id == cur_item->getCreatorUUID() )
- {
- result = true;
- break;
- }
- }
- }
- }
- else
- {
- // Else check that items have same type and name.
- // Note: UUID's of compared items also may be not equal.
- std::string obj_name = obj->getName();
- LLViewerInventoryItem* cur_item = NULL;
- for ( S32 i = items->size() - 1; i >= 0; --i )
- {
- cur_item = items->at(i);
- if ( obj->getType() != cur_item->getType() )
- continue;
- if ( obj_name == cur_item->getName() )
- {
- result = true;
- break;
- }
- }
- }
- }
- if ( !result && cats )
- {
- // There is no direct descendent in items, so check categories.
- // If target obj and descendent category have same type and name
- // then return true. Note: UUID's of compared items also may be not equal.
- std::string obj_name = obj->getName();
- LLViewerInventoryCategory* cur_cat = NULL;
- for ( S32 i = cats->size() - 1; i >= 0; --i )
- {
- cur_cat = cats->at(i);
- if ( obj->getType() != cur_cat->getType() )
- continue;
- if ( obj_name == cur_cat->getName() )
- {
- result = true;
- break;
- }
- }
- }
- gInventory.unlockDirectDescendentArrays(cat->getUUID());
-
- return result;
+ // we need both params to proceed.
+ if ( !obj || !cat )
+ return false;
+
+ // Need to check that target category is in the Calling Card/Friends folder.
+ // In other case function returns unpredictable result.
+ if ( !isCategoryInFriendFolder(cat) )
+ return false;
+
+ bool result = false;
+
+ LLInventoryModel::item_array_t* items;
+ LLInventoryModel::cat_array_t* cats;
+
+ gInventory.lockDirectDescendentArrays(cat->getUUID(), cats, items);
+ if ( items )
+ {
+ if ( obj->getType() == LLAssetType::AT_CALLINGCARD )
+ {
+ // For CALLINGCARD compare items by creator's id, if they are equal assume
+ // that it is same card and return true. Note: UUID's of compared items
+ // may be not equal. Also, we already know that obj should be type of LLInventoryItem,
+ // but in case inventory database is broken check what dynamic_cast returns.
+ const LLInventoryItem* item = dynamic_cast < const LLInventoryItem* > (obj);
+ if ( item )
+ {
+ LLUUID creator_id = item->getCreatorUUID();
+ LLViewerInventoryItem* cur_item = NULL;
+ for ( S32 i = items->size() - 1; i >= 0; --i )
+ {
+ cur_item = items->at(i);
+ if ( creator_id == cur_item->getCreatorUUID() )
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ // Else check that items have same type and name.
+ // Note: UUID's of compared items also may be not equal.
+ std::string obj_name = obj->getName();
+ LLViewerInventoryItem* cur_item = NULL;
+ for ( S32 i = items->size() - 1; i >= 0; --i )
+ {
+ cur_item = items->at(i);
+ if ( obj->getType() != cur_item->getType() )
+ continue;
+ if ( obj_name == cur_item->getName() )
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+ }
+ if ( !result && cats )
+ {
+ // There is no direct descendent in items, so check categories.
+ // If target obj and descendent category have same type and name
+ // then return true. Note: UUID's of compared items also may be not equal.
+ std::string obj_name = obj->getName();
+ LLViewerInventoryCategory* cur_cat = NULL;
+ for ( S32 i = cats->size() - 1; i >= 0; --i )
+ {
+ cur_cat = cats->at(i);
+ if ( obj->getType() != cur_cat->getType() )
+ continue;
+ if ( obj_name == cur_cat->getName() )
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+ gInventory.unlockDirectDescendentArrays(cat->getUUID());
+
+ return result;
}
bool LLFriendCardsManager::isCategoryInFriendFolder(const LLViewerInventoryCategory* cat) const
{
- if (NULL == cat)
- return false;
- return TRUE == gInventory.isObjectDescendentOf(cat->getUUID(), findFriendFolderUUIDImpl());
+ if (NULL == cat)
+ return false;
+ return TRUE == gInventory.isObjectDescendentOf(cat->getUUID(), findFriendFolderUUIDImpl());
}
bool LLFriendCardsManager::isAnyFriendCategory(const LLUUID& catID) const
{
- const LLUUID& friendFolderID = findFriendFolderUUIDImpl();
- if (catID == friendFolderID)
- return true;
+ const LLUUID& friendFolderID = findFriendFolderUUIDImpl();
+ if (catID == friendFolderID)
+ return true;
- return TRUE == gInventory.isObjectDescendentOf(catID, friendFolderID);
+ return TRUE == gInventory.isObjectDescendentOf(catID, friendFolderID);
}
void LLFriendCardsManager::syncFriendCardsFolders()
{
- const LLUUID callingCardsFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
+ const LLUUID callingCardsFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
- fetchAndCheckFolderDescendents(callingCardsFolderID,
- boost::bind(&LLFriendCardsManager::ensureFriendsFolderExists, this));
+ fetchAndCheckFolderDescendents(callingCardsFolderID,
+ boost::bind(&LLFriendCardsManager::ensureFriendsFolderExists, this));
}
/************************************************************************/
-/* Private Methods */
+/* Private Methods */
/************************************************************************/
const LLUUID& LLFriendCardsManager::findFirstCallingCardSubfolder(const LLUUID &parent_id) const
{
@@ -388,99 +388,99 @@ const LLUUID& LLFriendCardsManager::findFriendAllSubfolderUUIDImpl() const
const LLUUID& LLFriendCardsManager::findChildFolderUUID(const LLUUID& parentFolderUUID, const std::string& nonLocalizedName) const
{
- LLNameCategoryCollector matchFolderFunctor(nonLocalizedName);
+ LLNameCategoryCollector matchFolderFunctor(nonLocalizedName);
- return get_folder_uuid(parentFolderUUID, matchFolderFunctor);
+ return get_folder_uuid(parentFolderUUID, matchFolderFunctor);
}
const LLUUID& LLFriendCardsManager::findFriendCardInventoryUUIDImpl(const LLUUID& avatarID)
{
- LLUUID friendAllSubfolderUUID = findFriendAllSubfolderUUIDImpl();
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLInventoryModel::item_array_t::const_iterator it;
-
- // it is not necessary to check friendAllSubfolderUUID against NULL. It will be processed by collectDescendents
- gInventory.collectDescendents(friendAllSubfolderUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH);
- for (it = items.begin(); it != items.end(); ++it)
- {
- if ((*it)->getCreatorUUID() == avatarID)
- return (*it)->getUUID();
- }
-
- return LLUUID::null;
+ LLUUID friendAllSubfolderUUID = findFriendAllSubfolderUUIDImpl();
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLInventoryModel::item_array_t::const_iterator it;
+
+ // it is not necessary to check friendAllSubfolderUUID against NULL. It will be processed by collectDescendents
+ gInventory.collectDescendents(friendAllSubfolderUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH);
+ for (it = items.begin(); it != items.end(); ++it)
+ {
+ if ((*it)->getCreatorUUID() == avatarID)
+ return (*it)->getUUID();
+ }
+
+ return LLUUID::null;
}
void LLFriendCardsManager::findMatchedFriendCards(const LLUUID& avatarID, LLInventoryModel::item_array_t& items) const
{
- LLInventoryModel::cat_array_t cats;
- LLUUID friendFolderUUID = findFriendFolderUUIDImpl();
+ LLInventoryModel::cat_array_t cats;
+ LLUUID friendFolderUUID = findFriendFolderUUIDImpl();
- LLViewerInventoryCategory* friendFolder = gInventory.getCategory(friendFolderUUID);
- if (NULL == friendFolder)
- return;
+ LLViewerInventoryCategory* friendFolder = gInventory.getCategory(friendFolderUUID);
+ if (NULL == friendFolder)
+ return;
- LLParticularBuddyCollector matchFunctor(avatarID);
- LLInventoryModel::cat_array_t subFolders;
- subFolders.push_back(friendFolder);
+ LLParticularBuddyCollector matchFunctor(avatarID);
+ LLInventoryModel::cat_array_t subFolders;
+ subFolders.push_back(friendFolder);
- while (subFolders.size() > 0)
- {
- LLViewerInventoryCategory* cat = subFolders.at(0);
- subFolders.erase(subFolders.begin());
+ while (subFolders.size() > 0)
+ {
+ LLViewerInventoryCategory* cat = subFolders.at(0);
+ subFolders.erase(subFolders.begin());
- gInventory.collectDescendentsIf(cat->getUUID(), cats, items,
- LLInventoryModel::EXCLUDE_TRASH, matchFunctor);
+ gInventory.collectDescendentsIf(cat->getUUID(), cats, items,
+ LLInventoryModel::EXCLUDE_TRASH, matchFunctor);
- move_from_to_arrays(cats, subFolders);
- }
+ move_from_to_arrays(cats, subFolders);
+ }
}
void LLFriendCardsManager::fetchAndCheckFolderDescendents(const LLUUID& folder_id, callback_t cb)
{
- // This instance will be deleted in LLInitialFriendCardsFetch::done().
- LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(folder_id, cb);
- fetch->startFetch();
- if(fetch->isFinished())
- {
- // everything is already here - call done.
- fetch->done();
- }
- else
- {
- // it's all on it's way - add an observer, and the inventory
- // will call done for us when everything is here.
- gInventory.addObserver(fetch);
- }
+ // This instance will be deleted in LLInitialFriendCardsFetch::done().
+ LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(folder_id, cb);
+ fetch->startFetch();
+ if(fetch->isFinished())
+ {
+ // everything is already here - call done.
+ fetch->done();
+ }
+ else
+ {
+ // it's all on it's way - add an observer, and the inventory
+ // will call done for us when everything is here.
+ gInventory.addObserver(fetch);
+ }
}
// Make sure LLInventoryModel::buildParentChildMap() has been called before it.
// This method must be called before any actions with friends list.
void LLFriendCardsManager::ensureFriendsFolderExists()
{
- const LLUUID calling_cards_folder_ID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
+ const LLUUID calling_cards_folder_ID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
- // If "Friends" folder exists in "Calling Cards" we should check if "All" sub-folder
- // exists in "Friends", otherwise we create it.
- LLUUID friends_folder_ID = findFriendFolderUUIDImpl();
- if (friends_folder_ID.notNull())
- {
+ // If "Friends" folder exists in "Calling Cards" we should check if "All" sub-folder
+ // exists in "Friends", otherwise we create it.
+ LLUUID friends_folder_ID = findFriendFolderUUIDImpl();
+ if (friends_folder_ID.notNull())
+ {
mState = LOADING_FRIENDS_FOLDER;
- fetchAndCheckFolderDescendents(friends_folder_ID,
- boost::bind(&LLFriendCardsManager::ensureFriendsAllFolderExists, this));
- }
- else
- {
- if (!gInventory.isCategoryComplete(calling_cards_folder_ID))
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(calling_cards_folder_ID);
- std::string cat_name = cat ? cat->getName() : "unknown";
- LL_WARNS() << "Failed to find \"" << cat_name << "\" category descendents in Category Tree." << LL_ENDL;
- }
-
- gInventory.createNewCategory(
+ fetchAndCheckFolderDescendents(friends_folder_ID,
+ boost::bind(&LLFriendCardsManager::ensureFriendsAllFolderExists, this));
+ }
+ else
+ {
+ if (!gInventory.isCategoryComplete(calling_cards_folder_ID))
+ {
+ LLViewerInventoryCategory* cat = gInventory.getCategory(calling_cards_folder_ID);
+ std::string cat_name = cat ? cat->getName() : "unknown";
+ LL_WARNS() << "Failed to find \"" << cat_name << "\" category descendents in Category Tree." << LL_ENDL;
+ }
+
+ gInventory.createNewCategory(
calling_cards_folder_ID,
- LLFolderType::FT_CALLINGCARD,
+ LLFolderType::FT_CALLINGCARD,
get_friend_folder_name(),
[](const LLUUID &new_category_id)
{
@@ -496,33 +496,33 @@ void LLFriendCardsManager::ensureFriendsFolderExists()
);
}
);
- }
+ }
}
// Make sure LLFriendCardsManager::ensureFriendsFolderExists() has been called before it.
void LLFriendCardsManager::ensureFriendsAllFolderExists()
{
- LLUUID friends_all_folder_ID = findFriendAllSubfolderUUIDImpl();
- if (friends_all_folder_ID.notNull())
- {
+ LLUUID friends_all_folder_ID = findFriendAllSubfolderUUIDImpl();
+ if (friends_all_folder_ID.notNull())
+ {
mState = LOADING_ALL_FOLDER;
- fetchAndCheckFolderDescendents(friends_all_folder_ID,
- boost::bind(&LLFriendCardsManager::syncFriendsFolder, this));
- }
- else
- {
- LLUUID friends_folder_ID = findFriendFolderUUIDImpl();
-
- if (!gInventory.isCategoryComplete(friends_folder_ID))
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(friends_folder_ID);
- std::string cat_name = cat ? cat->getName() : "unknown";
- LL_WARNS() << "Failed to find \"" << cat_name << "\" category descendents in Category Tree." << LL_ENDL;
- }
+ fetchAndCheckFolderDescendents(friends_all_folder_ID,
+ boost::bind(&LLFriendCardsManager::syncFriendsFolder, this));
+ }
+ else
+ {
+ LLUUID friends_folder_ID = findFriendFolderUUIDImpl();
+
+ if (!gInventory.isCategoryComplete(friends_folder_ID))
+ {
+ LLViewerInventoryCategory* cat = gInventory.getCategory(friends_folder_ID);
+ std::string cat_name = cat ? cat->getName() : "unknown";
+ LL_WARNS() << "Failed to find \"" << cat_name << "\" category descendents in Category Tree." << LL_ENDL;
+ }
gInventory.createNewCategory(
friends_folder_ID,
- LLFolderType::FT_CALLINGCARD,
+ LLFolderType::FT_CALLINGCARD,
get_friend_all_subfolder_name(),
[](const LLUUID &new_cat_id)
{
@@ -530,64 +530,64 @@ void LLFriendCardsManager::ensureFriendsAllFolderExists()
LLFriendCardsManager::getInstance()->syncFriendsFolder();
}
);
- }
+ }
}
void LLFriendCardsManager::syncFriendsFolder()
{
- LLAvatarTracker::buddy_map_t all_buddies;
- LLAvatarTracker::instance().copyBuddyList(all_buddies);
+ LLAvatarTracker::buddy_map_t all_buddies;
+ LLAvatarTracker::instance().copyBuddyList(all_buddies);
- // 1. Check if own calling card exists
- const LLUUID calling_cards_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
+ // 1. Check if own calling card exists
+ const LLUUID calling_cards_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFindAgentCallingCard collector;
- gInventory.collectDescendentsIf(calling_cards_folder_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, collector);
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindAgentCallingCard collector;
+ gInventory.collectDescendentsIf(calling_cards_folder_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, collector);
- // Create own calling card if it was not found in Friends/All folder
- if (!collector.isAgentCallingCardFound())
- {
- create_inventory_callingcard(gAgentID, calling_cards_folder_id);
- }
+ // Create own calling card if it was not found in Friends/All folder
+ if (!collector.isAgentCallingCardFound())
+ {
+ create_inventory_callingcard(gAgentID, calling_cards_folder_id);
+ }
// All folders created and updated.
mState = MANAGER_READY;
- // 2. Add missing Friend Cards for friends
- LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();
- LL_INFOS() << "try to build friends, count: " << all_buddies.size() << LL_ENDL;
- for(; buddy_it != all_buddies.end(); ++buddy_it)
- {
- const LLUUID& buddy_id = (*buddy_it).first;
- addFriendCardToInventory(buddy_id);
- }
+ // 2. Add missing Friend Cards for friends
+ LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();
+ LL_INFOS() << "try to build friends, count: " << all_buddies.size() << LL_ENDL;
+ for(; buddy_it != all_buddies.end(); ++buddy_it)
+ {
+ const LLUUID& buddy_id = (*buddy_it).first;
+ addFriendCardToInventory(buddy_id);
+ }
}
class CreateFriendCardCallback : public LLInventoryCallback
{
public:
- void fire(const LLUUID& inv_item_id)
- {
- LLViewerInventoryItem* item = gInventory.getItem(inv_item_id);
+ void fire(const LLUUID& inv_item_id)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item_id);
- if (item)
- LLFriendCardsManager::instance().extractAvatarID(item->getCreatorUUID());
- }
+ if (item)
+ LLFriendCardsManager::instance().extractAvatarID(item->getCreatorUUID());
+ }
};
void LLFriendCardsManager::addFriendCardToInventory(const LLUUID& avatarID)
{
- bool shouldBeAdded = true;
- LLAvatarName av_name;
- LLAvatarNameCache::get(avatarID, &av_name);
- const std::string& name = av_name.getAccountName();
+ bool shouldBeAdded = true;
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(avatarID, &av_name);
+ const std::string& name = av_name.getAccountName();
- LL_DEBUGS() << "Processing buddy name: " << name
- << ", id: " << avatarID
- << LL_ENDL;
+ LL_DEBUGS() << "Processing buddy name: " << name
+ << ", id: " << avatarID
+ << LL_ENDL;
if (shouldBeAdded && !isManagerReady())
{
@@ -595,49 +595,49 @@ void LLFriendCardsManager::addFriendCardToInventory(const LLUUID& avatarID)
LL_DEBUGS() << "Calling cards manager not ready, state: " << getManagerState() << LL_ENDL;
}
- if (shouldBeAdded && findFriendCardInventoryUUIDImpl(avatarID).notNull())
- {
- shouldBeAdded = false;
- LL_DEBUGS() << "is found in Inventory: " << name << LL_ENDL;
- }
+ if (shouldBeAdded && findFriendCardInventoryUUIDImpl(avatarID).notNull())
+ {
+ shouldBeAdded = false;
+ LL_DEBUGS() << "is found in Inventory: " << name << LL_ENDL;
+ }
- if (shouldBeAdded && isAvatarDataStored(avatarID))
- {
- shouldBeAdded = false;
- LL_DEBUGS() << "is found in sentRequests: " << name << LL_ENDL;
- }
+ if (shouldBeAdded && isAvatarDataStored(avatarID))
+ {
+ shouldBeAdded = false;
+ LL_DEBUGS() << "is found in sentRequests: " << name << LL_ENDL;
+ }
- if (shouldBeAdded)
- {
- putAvatarData(avatarID);
- LL_DEBUGS() << "Sent create_inventory_item for " << avatarID << ", " << name << LL_ENDL;
+ if (shouldBeAdded)
+ {
+ putAvatarData(avatarID);
+ LL_DEBUGS() << "Sent create_inventory_item for " << avatarID << ", " << name << LL_ENDL;
- // TODO: mantipov: Is CreateFriendCardCallback really needed? Probably not
- LLPointer<LLInventoryCallback> cb = new CreateFriendCardCallback;
+ // TODO: mantipov: Is CreateFriendCardCallback really needed? Probably not
+ LLPointer<LLInventoryCallback> cb = new CreateFriendCardCallback;
- create_inventory_callingcard(avatarID, findFriendAllSubfolderUUIDImpl(), cb);
- }
+ create_inventory_callingcard(avatarID, findFriendAllSubfolderUUIDImpl(), cb);
+ }
}
void LLFriendCardsManager::removeFriendCardFromInventory(const LLUUID& avatarID)
{
- LLInventoryModel::item_array_t items;
- findMatchedFriendCards(avatarID, items);
-
- LLInventoryModel::item_array_t::const_iterator it;
- for (it = items.begin(); it != items.end(); ++ it)
- {
- gInventory.removeItem((*it)->getUUID());
- }
+ LLInventoryModel::item_array_t items;
+ findMatchedFriendCards(avatarID, items);
+
+ LLInventoryModel::item_array_t::const_iterator it;
+ for (it = items.begin(); it != items.end(); ++ it)
+ {
+ gInventory.removeItem((*it)->getUUID());
+ }
}
void LLFriendCardsManager::onFriendListUpdate(U32 changed_mask)
{
- LLAvatarTracker& at = LLAvatarTracker::instance();
+ LLAvatarTracker& at = LLAvatarTracker::instance();
- switch(changed_mask) {
- case LLFriendObserver::ADD:
- {
+ switch(changed_mask) {
+ case LLFriendObserver::ADD:
+ {
LLFriendCardsManager& cards_manager = LLFriendCardsManager::instance();
if (cards_manager.isManagerReady())
{
@@ -662,21 +662,21 @@ void LLFriendCardsManager::onFriendListUpdate(U32 changed_mask)
<< ", postponing update."
<< LL_ENDL;
}
- }
- break;
- case LLFriendObserver::REMOVE:
- {
- const std::set<LLUUID>& changed_items = at.getChangedIDs();
- std::set<LLUUID>::const_iterator id_it = changed_items.begin();
- std::set<LLUUID>::const_iterator id_end = changed_items.end();
- for (;id_it != id_end; ++id_it)
- {
- LLFriendCardsManager::instance().removeFriendCardFromInventory(*id_it);
- }
- }
-
- default:;
- }
+ }
+ break;
+ case LLFriendObserver::REMOVE:
+ {
+ const std::set<LLUUID>& changed_items = at.getChangedIDs();
+ std::set<LLUUID>::const_iterator id_it = changed_items.begin();
+ std::set<LLUUID>::const_iterator id_end = changed_items.end();
+ for (;id_it != id_end; ++id_it)
+ {
+ LLFriendCardsManager::instance().removeFriendCardFromInventory(*id_it);
+ }
+ }
+
+ default:;
+ }
}
// EOF
diff --git a/indra/newview/llfriendcard.h b/indra/newview/llfriendcard.h
index ef0dda7949..e3bd25aae7 100644
--- a/indra/newview/llfriendcard.h
+++ b/indra/newview/llfriendcard.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfriendcard.h
* @brief Definition of classes to process Friends Cards
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,17 +34,17 @@
class LLViewerInventoryItem;
class LLFriendCardsManager
- : public LLSingleton<LLFriendCardsManager>
- , public LLFriendObserver
+ : public LLSingleton<LLFriendCardsManager>
+ , public LLFriendObserver
{
- LLSINGLETON(LLFriendCardsManager);
- ~LLFriendCardsManager();
- LOG_CLASS(LLFriendCardsManager);
+ LLSINGLETON(LLFriendCardsManager);
+ ~LLFriendCardsManager();
+ LOG_CLASS(LLFriendCardsManager);
- friend class CreateFriendCardCallback;
+ friend class CreateFriendCardCallback;
public:
- typedef std::map<LLUUID, uuid_vec_t > folderid_buddies_map_t;
+ typedef std::map<LLUUID, uuid_vec_t > folderid_buddies_map_t;
enum EManagerState
{
@@ -54,111 +54,111 @@ public:
MANAGER_READY
};
- // LLFriendObserver implementation
- void changed(U32 mask) override
- {
- onFriendListUpdate(mask);
- }
-
- /**
- * Determines if specified Inventory Calling Card exists in any of lists
- * in the Calling Card/Friends/ folder (Default, or Custom)
- */
- bool isItemInAnyFriendsList(const LLViewerInventoryItem* item);
-
- /**
- * Checks if specified category is contained in the Calling Card/Friends folder and
- * determines if specified Inventory Object exists in that category.
- */
- bool isObjDirectDescendentOfCategory(const LLInventoryObject* obj, const LLViewerInventoryCategory* cat) const;
-
- /**
- * Checks is the specified category is in the Calling Card/Friends folder
- */
- bool isCategoryInFriendFolder(const LLViewerInventoryCategory* cat) const;
-
- /**
- * Checks is the specified category is a Friend folder or any its subfolder
- */
+ // LLFriendObserver implementation
+ void changed(U32 mask) override
+ {
+ onFriendListUpdate(mask);
+ }
+
+ /**
+ * Determines if specified Inventory Calling Card exists in any of lists
+ * in the Calling Card/Friends/ folder (Default, or Custom)
+ */
+ bool isItemInAnyFriendsList(const LLViewerInventoryItem* item);
+
+ /**
+ * Checks if specified category is contained in the Calling Card/Friends folder and
+ * determines if specified Inventory Object exists in that category.
+ */
+ bool isObjDirectDescendentOfCategory(const LLInventoryObject* obj, const LLViewerInventoryCategory* cat) const;
+
+ /**
+ * Checks is the specified category is in the Calling Card/Friends folder
+ */
+ bool isCategoryInFriendFolder(const LLViewerInventoryCategory* cat) const;
+
+ /**
+ * Checks is the specified category is a Friend folder or any its subfolder
+ */
bool isAnyFriendCategory(const LLUUID& catID) const;
/**
- * Indicates that all calling card related folders are created or loaded
+ * Indicates that all calling card related folders are created or loaded
*/
bool isManagerReady() const { return mState == MANAGER_READY; }
EManagerState getManagerState() const { return mState; }
- /**
- * Checks whether "Friends" and "Friends/All" folders exist in "Calling Cards" category
- * (creates them otherwise) and fetches their contents to synchronize with Agent's Friends List.
- */
- void syncFriendCardsFolders();
+ /**
+ * Checks whether "Friends" and "Friends/All" folders exist in "Calling Cards" category
+ * (creates them otherwise) and fetches their contents to synchronize with Agent's Friends List.
+ */
+ void syncFriendCardsFolders();
private:
- typedef boost::function<void()> callback_t;
+ typedef boost::function<void()> callback_t;
- /**
- * Stores buddy id to avoid sent create_inventory_callingcard several time for the same Avatar
- */
- void putAvatarData(const LLUUID& avatarID);
+ /**
+ * Stores buddy id to avoid sent create_inventory_callingcard several time for the same Avatar
+ */
+ void putAvatarData(const LLUUID& avatarID);
- /**
- * Extracts buddy id of Created Friend Card
- */
- const LLUUID extractAvatarID(const LLUUID& avatarID);
+ /**
+ * Extracts buddy id of Created Friend Card
+ */
+ const LLUUID extractAvatarID(const LLUUID& avatarID);
- bool isAvatarDataStored(const LLUUID& avatarID) const
- {
- return (mBuddyIDSet.end() != mBuddyIDSet.find(avatarID));
- }
+ bool isAvatarDataStored(const LLUUID& avatarID) const
+ {
+ return (mBuddyIDSet.end() != mBuddyIDSet.find(avatarID));
+ }
- const LLUUID& findChildFolderUUID(const LLUUID& parentFolderUUID, const std::string& nonLocalizedName) const;
+ const LLUUID& findChildFolderUUID(const LLUUID& parentFolderUUID, const std::string& nonLocalizedName) const;
const LLUUID& findFirstCallingCardSubfolder(const LLUUID &parent_id) const;
- const LLUUID& findFriendFolderUUIDImpl() const;
- const LLUUID& findFriendAllSubfolderUUIDImpl() const;
- const LLUUID& findFriendCardInventoryUUIDImpl(const LLUUID& avatarID);
- void findMatchedFriendCards(const LLUUID& avatarID, LLInventoryModel::item_array_t& items) const;
+ const LLUUID& findFriendFolderUUIDImpl() const;
+ const LLUUID& findFriendAllSubfolderUUIDImpl() const;
+ const LLUUID& findFriendCardInventoryUUIDImpl(const LLUUID& avatarID);
+ void findMatchedFriendCards(const LLUUID& avatarID, LLInventoryModel::item_array_t& items) const;
- void fetchAndCheckFolderDescendents(const LLUUID& folder_id, callback_t cb);
+ void fetchAndCheckFolderDescendents(const LLUUID& folder_id, callback_t cb);
- /**
- * Checks whether "Calling Cards/Friends" folder exists. If not, creates it with "All"
- * sub-folder and synchronizes its contents with buddies list.
- */
- void ensureFriendsFolderExists();
+ /**
+ * Checks whether "Calling Cards/Friends" folder exists. If not, creates it with "All"
+ * sub-folder and synchronizes its contents with buddies list.
+ */
+ void ensureFriendsFolderExists();
- /**
- * Checks whether "Calling Cards/Friends/All" folder exists. If not, creates it and
- * synchronizes its contents with buddies list.
- */
- void ensureFriendsAllFolderExists();
+ /**
+ * Checks whether "Calling Cards/Friends/All" folder exists. If not, creates it and
+ * synchronizes its contents with buddies list.
+ */
+ void ensureFriendsAllFolderExists();
- /**
- * Synchronizes content of the Calling Card/Friends/All Global Inventory folder with Agent's Friend List
- */
- void syncFriendsFolder();
+ /**
+ * Synchronizes content of the Calling Card/Friends/All Global Inventory folder with Agent's Friend List
+ */
+ void syncFriendsFolder();
- /**
- * Adds avatar specified by its UUID into the Calling Card/Friends/All Global Inventory folder
- */
- void addFriendCardToInventory(const LLUUID& avatarID);
+ /**
+ * Adds avatar specified by its UUID into the Calling Card/Friends/All Global Inventory folder
+ */
+ void addFriendCardToInventory(const LLUUID& avatarID);
- /**
- * Removes an avatar specified by its UUID from the Calling Card/Friends/All Global Inventory folder
- * and from the all Custom Folders
- */
- void removeFriendCardFromInventory(const LLUUID& avatarID);
+ /**
+ * Removes an avatar specified by its UUID from the Calling Card/Friends/All Global Inventory folder
+ * and from the all Custom Folders
+ */
+ void removeFriendCardFromInventory(const LLUUID& avatarID);
- void onFriendListUpdate(U32 changed_mask);
+ void onFriendListUpdate(U32 changed_mask);
private:
- typedef std::set<LLUUID> avatar_uuid_set_t;
+ typedef std::set<LLUUID> avatar_uuid_set_t;
- avatar_uuid_set_t mBuddyIDSet;
+ avatar_uuid_set_t mBuddyIDSet;
EManagerState mState;
};
diff --git a/indra/newview/llgesturelistener.cpp b/indra/newview/llgesturelistener.cpp
index 6fd749d83e..01485c2b7c 100644
--- a/indra/newview/llgesturelistener.cpp
+++ b/indra/newview/llgesturelistener.cpp
@@ -40,20 +40,20 @@ LLGestureListener::LLGestureListener()
add("getActiveGestures",
"Return information about the agent's available gestures [\"reply\"]:\n"
"[\"gestures\"]: a dictionary with UUID strings as keys\n"
- " and the following dict values for each entry:\n"
- " [\"name\"]: name of the gesture, may be empty\n"
- " [\"trigger\"]: trigger string used to invoke via user chat, may be empty\n"
- " [\"playing\"]: true or false indicating the playing state",
+ " and the following dict values for each entry:\n"
+ " [\"name\"]: name of the gesture, may be empty\n"
+ " [\"trigger\"]: trigger string used to invoke via user chat, may be empty\n"
+ " [\"playing\"]: true or false indicating the playing state",
&LLGestureListener::getActiveGestures,
LLSDMap("reply", LLSD()));
- add("isGesturePlaying",
- "[\"id\"]: UUID of the gesture to query. Returns True or False in [\"playing\"] value of the result",
+ add("isGesturePlaying",
+ "[\"id\"]: UUID of the gesture to query. Returns True or False in [\"playing\"] value of the result",
&LLGestureListener::isGesturePlaying);
- add("startGesture",
- "[\"id\"]: UUID of the gesture to start playing",
+ add("startGesture",
+ "[\"id\"]: UUID of the gesture to start playing",
&LLGestureListener::startGesture);
- add("stopGesture",
- "[\"id\"]: UUID of the gesture to stop",
+ add("stopGesture",
+ "[\"id\"]: UUID of the gesture to stop",
&LLGestureListener::stopGesture);
}
@@ -61,29 +61,29 @@ LLGestureListener::LLGestureListener()
// "getActiveGestures" command
void LLGestureListener::getActiveGestures(const LLSD& event_data) const
{
- LLSD reply = LLSD::emptyMap();
- LLSD gesture_map = LLSD::emptyMap();
-
- const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
-
- // Scan active gesture map and get all the names
- LLGestureMgr::item_map_t::const_iterator it;
- for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
- {
- LLMultiGesture* gesture = (*it).second;
- if (gesture)
- { // Add an entry to the result map with the LLUUID as key with a map containing data
- LLSD info = LLSD::emptyMap();
- info["name"] = (LLSD::String) gesture->mName;
- info["trigger"] = (LLSD::String) gesture->mTrigger;
- info["playing"] = (LLSD::Boolean) gesture->mPlaying;
-
- gesture_map[(*it).first.asString()] = info;
- }
- }
-
- reply["gestures"] = gesture_map;
- sendReply(reply, event_data);
+ LLSD reply = LLSD::emptyMap();
+ LLSD gesture_map = LLSD::emptyMap();
+
+ const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
+
+ // Scan active gesture map and get all the names
+ LLGestureMgr::item_map_t::const_iterator it;
+ for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
+ {
+ LLMultiGesture* gesture = (*it).second;
+ if (gesture)
+ { // Add an entry to the result map with the LLUUID as key with a map containing data
+ LLSD info = LLSD::emptyMap();
+ info["name"] = (LLSD::String) gesture->mName;
+ info["trigger"] = (LLSD::String) gesture->mTrigger;
+ info["playing"] = (LLSD::Boolean) gesture->mPlaying;
+
+ gesture_map[(*it).first.asString()] = info;
+ }
+ }
+
+ reply["gestures"] = gesture_map;
+ sendReply(reply, event_data);
}
@@ -91,69 +91,69 @@ void LLGestureListener::getActiveGestures(const LLSD& event_data) const
// "isGesturePlaying" command
void LLGestureListener::isGesturePlaying(const LLSD& event_data) const
{
- bool is_playing = false;
- if (event_data.has("id"))
- {
- LLUUID gesture_id = event_data["id"].asUUID();
- if (gesture_id.notNull())
- {
- is_playing = LLGestureMgr::instance().isGesturePlaying(gesture_id);
- }
- else
- {
- LL_WARNS() << "isGesturePlaying did not find a gesture object for " << gesture_id << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS() << "isGesturePlaying didn't have 'id' value passed in" << LL_ENDL;
- }
-
- LLSD reply = LLSD::emptyMap();
- reply["playing"] = (LLSD::Boolean) is_playing;
- sendReply(reply, event_data);
+ bool is_playing = false;
+ if (event_data.has("id"))
+ {
+ LLUUID gesture_id = event_data["id"].asUUID();
+ if (gesture_id.notNull())
+ {
+ is_playing = LLGestureMgr::instance().isGesturePlaying(gesture_id);
+ }
+ else
+ {
+ LL_WARNS() << "isGesturePlaying did not find a gesture object for " << gesture_id << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "isGesturePlaying didn't have 'id' value passed in" << LL_ENDL;
+ }
+
+ LLSD reply = LLSD::emptyMap();
+ reply["playing"] = (LLSD::Boolean) is_playing;
+ sendReply(reply, event_data);
}
// "startGesture" command
void LLGestureListener::startGesture(LLSD const & event_data) const
{
- startOrStopGesture(event_data, true);
+ startOrStopGesture(event_data, true);
}
// "stopGesture" command
void LLGestureListener::stopGesture(LLSD const & event_data) const
{
- startOrStopGesture(event_data, false);
+ startOrStopGesture(event_data, false);
}
// Real code for "startGesture" or "stopGesture"
void LLGestureListener::startOrStopGesture(LLSD const & event_data, bool start) const
{
- if (event_data.has("id"))
- {
- LLUUID gesture_id = event_data["id"].asUUID();
- if (gesture_id.notNull())
- {
- if (start)
- {
- LLGestureMgr::instance().playGesture(gesture_id);
- }
- else
- {
- LLGestureMgr::instance().stopGesture(gesture_id);
- }
- }
- else
- {
- LL_WARNS() << "startOrStopGesture did not find a gesture object for " << gesture_id << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS() << "startOrStopGesture didn't have 'id' value passed in" << LL_ENDL;
- }
+ if (event_data.has("id"))
+ {
+ LLUUID gesture_id = event_data["id"].asUUID();
+ if (gesture_id.notNull())
+ {
+ if (start)
+ {
+ LLGestureMgr::instance().playGesture(gesture_id);
+ }
+ else
+ {
+ LLGestureMgr::instance().stopGesture(gesture_id);
+ }
+ }
+ else
+ {
+ LL_WARNS() << "startOrStopGesture did not find a gesture object for " << gesture_id << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "startOrStopGesture didn't have 'id' value passed in" << LL_ENDL;
+ }
}
diff --git a/indra/newview/llgesturelistener.h b/indra/newview/llgesturelistener.h
index 6f59698ed1..36511e14f7 100644
--- a/indra/newview/llgesturelistener.h
+++ b/indra/newview/llgesturelistener.h
@@ -37,15 +37,15 @@ class LLSD;
class LLGestureListener : public LLEventAPI
{
public:
- LLGestureListener();
+ LLGestureListener();
private:
void getActiveGestures(LLSD const & gesture_data) const;
- void isGesturePlaying(LLSD const & gesture_data) const;
+ void isGesturePlaying(LLSD const & gesture_data) const;
void startGesture(LLSD const & gesture_data) const;
void stopGesture(LLSD const & gesture_data) const;
- void startOrStopGesture(LLSD const & event_data, bool start) const;
+ void startOrStopGesture(LLSD const & event_data, bool start) const;
};
#endif // LL_LLGESTURELISTENER_H
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index c0f773968d..71c7606672 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgesturemgr.cpp
* @brief Manager for playing gestures on the viewer
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,7 +41,7 @@
#include "llmultigesture.h"
#include "llnotificationsutil.h"
#include "llstl.h"
-#include "llstring.h" // todo: remove
+#include "llstring.h" // todo: remove
#include "llfilesystem.h"
#include "message.h"
@@ -62,69 +62,69 @@ const F32 MAX_WAIT_ANIM_SECS = 30.f;
// Lightweight constructor.
// init() does the heavy lifting.
LLGestureMgr::LLGestureMgr()
-: mValid(FALSE),
- mPlaying(),
- mActive(),
- mLoadingCount(0)
+: mValid(FALSE),
+ mPlaying(),
+ mActive(),
+ mLoadingCount(0)
{
- gInventory.addObserver(this);
- mListener.reset(new LLGestureListener());
+ gInventory.addObserver(this);
+ mListener.reset(new LLGestureListener());
}
// We own the data for gestures, so clean them up.
LLGestureMgr::~LLGestureMgr()
{
- item_map_t::iterator it;
- for (it = mActive.begin(); it != mActive.end(); ++it)
- {
- LLMultiGesture* gesture = (*it).second;
-
- delete gesture;
- gesture = NULL;
- }
- gInventory.removeObserver(this);
+ item_map_t::iterator it;
+ for (it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ LLMultiGesture* gesture = (*it).second;
+
+ delete gesture;
+ gesture = NULL;
+ }
+ gInventory.removeObserver(this);
}
void LLGestureMgr::init()
{
- // TODO
+ // TODO
}
-void LLGestureMgr::changed(U32 mask)
-{
- LLInventoryFetchItemsObserver::changed(mask);
-
- if (mask & LLInventoryObserver::GESTURE)
- {
- // If there was a gesture label changed, update all the names in the
- // active gestures and then notify observers
- if (mask & LLInventoryObserver::LABEL)
- {
- for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it)
- {
- if(it->second)
- {
- LLViewerInventoryItem* item = gInventory.getItem(it->first);
- if(item)
- {
- it->second->mName = item->getName();
- }
- }
- }
- notifyObservers();
- }
- // If there was a gesture added or removed notify observers
- // STRUCTURE denotes that the inventory item has been moved
- // In the case of deleting gesture, it is moved to the trash
- else if(mask & LLInventoryObserver::ADD ||
- mask & LLInventoryObserver::REMOVE ||
- mask & LLInventoryObserver::STRUCTURE)
- {
- notifyObservers();
- }
- }
+void LLGestureMgr::changed(U32 mask)
+{
+ LLInventoryFetchItemsObserver::changed(mask);
+
+ if (mask & LLInventoryObserver::GESTURE)
+ {
+ // If there was a gesture label changed, update all the names in the
+ // active gestures and then notify observers
+ if (mask & LLInventoryObserver::LABEL)
+ {
+ for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ if(it->second)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(it->first);
+ if(item)
+ {
+ it->second->mName = item->getName();
+ }
+ }
+ }
+ notifyObservers();
+ }
+ // If there was a gesture added or removed notify observers
+ // STRUCTURE denotes that the inventory item has been moved
+ // In the case of deleting gesture, it is moved to the trash
+ else if(mask & LLInventoryObserver::ADD ||
+ mask & LLInventoryObserver::REMOVE ||
+ mask & LLInventoryObserver::STRUCTURE)
+ {
+ notifyObservers();
+ }
+ }
}
@@ -132,111 +132,111 @@ void LLGestureMgr::changed(U32 mask)
// and you KNOW the inventory is loaded.
void LLGestureMgr::activateGesture(const LLUUID& item_id)
{
- LLViewerInventoryItem* item = gInventory.getItem(item_id);
- if (!item) return;
- if (item->getType() != LLAssetType::AT_GESTURE)
- return;
+ LLViewerInventoryItem* item = gInventory.getItem(item_id);
+ if (!item) return;
+ if (item->getType() != LLAssetType::AT_GESTURE)
+ return;
- LLUUID asset_id = item->getAssetUUID();
+ LLUUID asset_id = item->getAssetUUID();
- mLoadingCount = 1;
- mDeactivateSimilarNames.clear();
+ mLoadingCount = 1;
+ mDeactivateSimilarNames.clear();
- const BOOL inform_server = TRUE;
- const BOOL deactivate_similar = FALSE;
- activateGestureWithAsset(item_id, asset_id, inform_server, deactivate_similar);
+ const BOOL inform_server = TRUE;
+ const BOOL deactivate_similar = FALSE;
+ activateGestureWithAsset(item_id, asset_id, inform_server, deactivate_similar);
}
void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
{
- // Load up the assets
- S32 count = 0;
- LLViewerInventoryItem::item_array_t::const_iterator it;
- for (it = items.begin(); it != items.end(); ++it)
- {
- LLViewerInventoryItem* item = *it;
-
- if (isGestureActive(item->getUUID()))
- {
- continue;
- }
- else
- { // Make gesture active and persistent through login sessions. -Aura 07-12-06
- activateGesture(item->getUUID());
- }
-
- count++;
- }
-
- mLoadingCount = count;
- mDeactivateSimilarNames.clear();
-
- for (it = items.begin(); it != items.end(); ++it)
- {
- LLViewerInventoryItem* item = *it;
-
- if (isGestureActive(item->getUUID()))
- {
- continue;
- }
-
- // Don't inform server, we'll do that in bulk
- const BOOL no_inform_server = FALSE;
- const BOOL deactivate_similar = TRUE;
- activateGestureWithAsset(item->getUUID(), item->getAssetUUID(),
- no_inform_server,
- deactivate_similar);
- }
-
- // Inform the database of this change
- LLMessageSystem* msg = gMessageSystem;
-
- BOOL start_message = TRUE;
-
- for (it = items.begin(); it != items.end(); ++it)
- {
- LLViewerInventoryItem* item = *it;
-
- if (isGestureActive(item->getUUID()))
- {
- continue;
- }
-
- if (start_message)
- {
- msg->newMessage("ActivateGestures");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addU32("Flags", 0x0);
- start_message = FALSE;
- }
-
- msg->nextBlock("Data");
- msg->addUUID("ItemID", item->getUUID());
- msg->addUUID("AssetID", item->getAssetUUID());
- msg->addU32("GestureFlags", 0x0);
-
- if (msg->getCurrentSendTotal() > MTUBYTES)
- {
- gAgent.sendReliableMessage();
- start_message = TRUE;
- }
- }
-
- if (!start_message)
- {
- gAgent.sendReliableMessage();
- }
+ // Load up the assets
+ S32 count = 0;
+ LLViewerInventoryItem::item_array_t::const_iterator it;
+ for (it = items.begin(); it != items.end(); ++it)
+ {
+ LLViewerInventoryItem* item = *it;
+
+ if (isGestureActive(item->getUUID()))
+ {
+ continue;
+ }
+ else
+ { // Make gesture active and persistent through login sessions. -Aura 07-12-06
+ activateGesture(item->getUUID());
+ }
+
+ count++;
+ }
+
+ mLoadingCount = count;
+ mDeactivateSimilarNames.clear();
+
+ for (it = items.begin(); it != items.end(); ++it)
+ {
+ LLViewerInventoryItem* item = *it;
+
+ if (isGestureActive(item->getUUID()))
+ {
+ continue;
+ }
+
+ // Don't inform server, we'll do that in bulk
+ const BOOL no_inform_server = FALSE;
+ const BOOL deactivate_similar = TRUE;
+ activateGestureWithAsset(item->getUUID(), item->getAssetUUID(),
+ no_inform_server,
+ deactivate_similar);
+ }
+
+ // Inform the database of this change
+ LLMessageSystem* msg = gMessageSystem;
+
+ BOOL start_message = TRUE;
+
+ for (it = items.begin(); it != items.end(); ++it)
+ {
+ LLViewerInventoryItem* item = *it;
+
+ if (isGestureActive(item->getUUID()))
+ {
+ continue;
+ }
+
+ if (start_message)
+ {
+ msg->newMessage("ActivateGestures");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->addU32("Flags", 0x0);
+ start_message = FALSE;
+ }
+
+ msg->nextBlock("Data");
+ msg->addUUID("ItemID", item->getUUID());
+ msg->addUUID("AssetID", item->getAssetUUID());
+ msg->addU32("GestureFlags", 0x0);
+
+ if (msg->getCurrentSendTotal() > MTUBYTES)
+ {
+ gAgent.sendReliableMessage();
+ start_message = TRUE;
+ }
+ }
+
+ if (!start_message)
+ {
+ gAgent.sendReliableMessage();
+ }
}
struct LLLoadInfo
{
- LLUUID mItemID;
- BOOL mInformServer;
- BOOL mDeactivateSimilar;
+ LLUUID mItemID;
+ BOOL mInformServer;
+ BOOL mDeactivateSimilar;
};
// If inform_server is true, will send a message upstream to update
@@ -245,243 +245,243 @@ struct LLLoadInfo
* It will load a gesture from remote storage
*/
void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id,
- const LLUUID& asset_id,
- BOOL inform_server,
- BOOL deactivate_similar)
+ const LLUUID& asset_id,
+ BOOL inform_server,
+ BOOL deactivate_similar)
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
-
- if( !gAssetStorage )
- {
- LL_WARNS() << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << LL_ENDL;
- return;
- }
- // If gesture is already active, nothing to do.
- if (isGestureActive(item_id))
- {
- LL_WARNS() << "Tried to loadGesture twice " << item_id << LL_ENDL;
- return;
- }
-
-// if (asset_id.isNull())
-// {
-// LL_WARNS() << "loadGesture() - gesture has no asset" << LL_ENDL;
-// return;
-// }
-
- // For now, put NULL into the item map. We'll build a gesture
- // class object when the asset data arrives.
- mActive[base_item_id] = NULL;
-
- // Copy the UUID
- if (asset_id.notNull())
- {
- LLLoadInfo* info = new LLLoadInfo;
- info->mItemID = base_item_id;
- info->mInformServer = inform_server;
- info->mDeactivateSimilar = deactivate_similar;
-
- const BOOL high_priority = TRUE;
- gAssetStorage->getAssetData(asset_id,
- LLAssetType::AT_GESTURE,
- onLoadComplete,
- (void*)info,
- high_priority);
- }
- else
- {
- notifyObservers();
- }
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+
+ if( !gAssetStorage )
+ {
+ LL_WARNS() << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << LL_ENDL;
+ return;
+ }
+ // If gesture is already active, nothing to do.
+ if (isGestureActive(item_id))
+ {
+ LL_WARNS() << "Tried to loadGesture twice " << item_id << LL_ENDL;
+ return;
+ }
+
+// if (asset_id.isNull())
+// {
+// LL_WARNS() << "loadGesture() - gesture has no asset" << LL_ENDL;
+// return;
+// }
+
+ // For now, put NULL into the item map. We'll build a gesture
+ // class object when the asset data arrives.
+ mActive[base_item_id] = NULL;
+
+ // Copy the UUID
+ if (asset_id.notNull())
+ {
+ LLLoadInfo* info = new LLLoadInfo;
+ info->mItemID = base_item_id;
+ info->mInformServer = inform_server;
+ info->mDeactivateSimilar = deactivate_similar;
+
+ const BOOL high_priority = TRUE;
+ gAssetStorage->getAssetData(asset_id,
+ LLAssetType::AT_GESTURE,
+ onLoadComplete,
+ (void*)info,
+ high_priority);
+ }
+ else
+ {
+ notifyObservers();
+ }
}
void notify_update_label(const LLUUID& base_item_id)
{
- gInventory.addChangedMask(LLInventoryObserver::LABEL, base_item_id);
- LLGestureMgr::instance().notifyObservers();
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, base_item_id);
+ LLGestureMgr::instance().notifyObservers();
}
void LLGestureMgr::deactivateGesture(const LLUUID& item_id)
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
- item_map_t::iterator it = mActive.find(base_item_id);
- if (it == mActive.end())
- {
- LL_WARNS() << "deactivateGesture for inactive gesture " << item_id << LL_ENDL;
- return;
- }
-
- // mActive owns this gesture pointer, so clean up memory.
- LLMultiGesture* gesture = (*it).second;
-
- // Can be NULL gestures in the map
- if (gesture)
- {
- stopGesture(gesture);
-
- delete gesture;
- gesture = NULL;
- }
-
- mActive.erase(it);
-
- // Inform the database of this change
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("DeactivateGestures");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addU32("Flags", 0x0);
-
- msg->nextBlock("Data");
- msg->addUUID("ItemID", item_id);
- msg->addU32("GestureFlags", 0x0);
-
- gAgent.sendReliableMessage();
-
- LLPointer<LLInventoryCallback> cb =
- new LLBoostFuncInventoryCallback(no_op_inventory_func,
- boost::bind(notify_update_label,base_item_id));
-
- LLAppearanceMgr::instance().removeCOFItemLinks(base_item_id, cb);
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+ item_map_t::iterator it = mActive.find(base_item_id);
+ if (it == mActive.end())
+ {
+ LL_WARNS() << "deactivateGesture for inactive gesture " << item_id << LL_ENDL;
+ return;
+ }
+
+ // mActive owns this gesture pointer, so clean up memory.
+ LLMultiGesture* gesture = (*it).second;
+
+ // Can be NULL gestures in the map
+ if (gesture)
+ {
+ stopGesture(gesture);
+
+ delete gesture;
+ gesture = NULL;
+ }
+
+ mActive.erase(it);
+
+ // Inform the database of this change
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("DeactivateGestures");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->addU32("Flags", 0x0);
+
+ msg->nextBlock("Data");
+ msg->addUUID("ItemID", item_id);
+ msg->addU32("GestureFlags", 0x0);
+
+ gAgent.sendReliableMessage();
+
+ LLPointer<LLInventoryCallback> cb =
+ new LLBoostFuncInventoryCallback(no_op_inventory_func,
+ boost::bind(notify_update_label,base_item_id));
+
+ LLAppearanceMgr::instance().removeCOFItemLinks(base_item_id, cb);
}
void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id)
{
- const LLUUID& base_in_item_id = gInventory.getLinkedItemID(in_item_id);
- uuid_vec_t gest_item_ids;
-
- // Deactivate all gestures that match
- item_map_t::iterator it;
- for (it = mActive.begin(); it != mActive.end(); )
- {
- const LLUUID& item_id = (*it).first;
- LLMultiGesture* gest = (*it).second;
-
- // Don't deactivate the gesture we are looking for duplicates of
- // (for replaceGesture)
- if (!gest || item_id == base_in_item_id)
- {
- // legal, can have null pointers in list
- ++it;
- }
- else if ((!gest->mTrigger.empty() && gest->mTrigger == in->mTrigger)
- || (gest->mKey != KEY_NONE && gest->mKey == in->mKey && gest->mMask == in->mMask))
- {
- gest_item_ids.push_back(item_id);
-
- stopGesture(gest);
-
- delete gest;
- gest = NULL;
-
- mActive.erase(it++);
- gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
-
- }
- else
- {
- ++it;
- }
- }
-
- // Inform database of the change
- LLMessageSystem* msg = gMessageSystem;
- BOOL start_message = TRUE;
- uuid_vec_t::const_iterator vit = gest_item_ids.begin();
- while (vit != gest_item_ids.end())
- {
- if (start_message)
- {
- msg->newMessage("DeactivateGestures");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addU32("Flags", 0x0);
- start_message = FALSE;
- }
-
- msg->nextBlock("Data");
- msg->addUUID("ItemID", *vit);
- msg->addU32("GestureFlags", 0x0);
-
- if (msg->getCurrentSendTotal() > MTUBYTES)
- {
- gAgent.sendReliableMessage();
- start_message = TRUE;
- }
-
- ++vit;
- }
-
- if (!start_message)
- {
- gAgent.sendReliableMessage();
- }
-
- // Add to the list of names for the user.
- for (vit = gest_item_ids.begin(); vit != gest_item_ids.end(); ++vit)
- {
- LLViewerInventoryItem* item = gInventory.getItem(*vit);
- if (!item) continue;
-
- mDeactivateSimilarNames.append(item->getName());
- mDeactivateSimilarNames.append("\n");
- }
-
- notifyObservers();
+ const LLUUID& base_in_item_id = gInventory.getLinkedItemID(in_item_id);
+ uuid_vec_t gest_item_ids;
+
+ // Deactivate all gestures that match
+ item_map_t::iterator it;
+ for (it = mActive.begin(); it != mActive.end(); )
+ {
+ const LLUUID& item_id = (*it).first;
+ LLMultiGesture* gest = (*it).second;
+
+ // Don't deactivate the gesture we are looking for duplicates of
+ // (for replaceGesture)
+ if (!gest || item_id == base_in_item_id)
+ {
+ // legal, can have null pointers in list
+ ++it;
+ }
+ else if ((!gest->mTrigger.empty() && gest->mTrigger == in->mTrigger)
+ || (gest->mKey != KEY_NONE && gest->mKey == in->mKey && gest->mMask == in->mMask))
+ {
+ gest_item_ids.push_back(item_id);
+
+ stopGesture(gest);
+
+ delete gest;
+ gest = NULL;
+
+ mActive.erase(it++);
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+
+ }
+ else
+ {
+ ++it;
+ }
+ }
+
+ // Inform database of the change
+ LLMessageSystem* msg = gMessageSystem;
+ BOOL start_message = TRUE;
+ uuid_vec_t::const_iterator vit = gest_item_ids.begin();
+ while (vit != gest_item_ids.end())
+ {
+ if (start_message)
+ {
+ msg->newMessage("DeactivateGestures");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->addU32("Flags", 0x0);
+ start_message = FALSE;
+ }
+
+ msg->nextBlock("Data");
+ msg->addUUID("ItemID", *vit);
+ msg->addU32("GestureFlags", 0x0);
+
+ if (msg->getCurrentSendTotal() > MTUBYTES)
+ {
+ gAgent.sendReliableMessage();
+ start_message = TRUE;
+ }
+
+ ++vit;
+ }
+
+ if (!start_message)
+ {
+ gAgent.sendReliableMessage();
+ }
+
+ // Add to the list of names for the user.
+ for (vit = gest_item_ids.begin(); vit != gest_item_ids.end(); ++vit)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(*vit);
+ if (!item) continue;
+
+ mDeactivateSimilarNames.append(item->getName());
+ mDeactivateSimilarNames.append("\n");
+ }
+
+ notifyObservers();
}
BOOL LLGestureMgr::isGestureActive(const LLUUID& item_id)
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
- item_map_t::iterator it = mActive.find(base_item_id);
- return (it != mActive.end());
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+ item_map_t::iterator it = mActive.find(base_item_id);
+ return (it != mActive.end());
}
BOOL LLGestureMgr::isGesturePlaying(const LLUUID& item_id)
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
- item_map_t::iterator it = mActive.find(base_item_id);
- if (it == mActive.end()) return FALSE;
+ item_map_t::iterator it = mActive.find(base_item_id);
+ if (it == mActive.end()) return FALSE;
- LLMultiGesture* gesture = (*it).second;
- if (!gesture) return FALSE;
+ LLMultiGesture* gesture = (*it).second;
+ if (!gesture) return FALSE;
- return gesture->mPlaying;
+ return gesture->mPlaying;
}
BOOL LLGestureMgr::isGesturePlaying(LLMultiGesture* gesture)
{
- if(!gesture)
- {
- return FALSE;
- }
+ if(!gesture)
+ {
+ return FALSE;
+ }
- return gesture->mPlaying;
+ return gesture->mPlaying;
}
void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id)
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
- item_map_t::iterator it = mActive.find(base_item_id);
- if (it == mActive.end())
- {
- LL_WARNS() << "replaceGesture for inactive gesture " << base_item_id << LL_ENDL;
- return;
- }
+ item_map_t::iterator it = mActive.find(base_item_id);
+ if (it == mActive.end())
+ {
+ LL_WARNS() << "replaceGesture for inactive gesture " << base_item_id << LL_ENDL;
+ return;
+ }
- LLMultiGesture* old_gesture = (*it).second;
- stopGesture(old_gesture);
+ LLMultiGesture* old_gesture = (*it).second;
+ stopGesture(old_gesture);
- mActive.erase(base_item_id);
+ mActive.erase(base_item_id);
- mActive[base_item_id] = new_gesture;
+ mActive[base_item_id] = new_gesture;
// replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id)
// replaces ids without repalcing gesture
@@ -491,133 +491,133 @@ void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_ges
old_gesture = NULL;
}
- if (asset_id.notNull())
- {
- mLoadingCount = 1;
- mDeactivateSimilarNames.clear();
-
- LLLoadInfo* info = new LLLoadInfo;
- info->mItemID = base_item_id;
- info->mInformServer = TRUE;
- info->mDeactivateSimilar = FALSE;
-
- const BOOL high_priority = TRUE;
- gAssetStorage->getAssetData(asset_id,
- LLAssetType::AT_GESTURE,
- onLoadComplete,
- (void*)info,
- high_priority);
- }
-
- notifyObservers();
+ if (asset_id.notNull())
+ {
+ mLoadingCount = 1;
+ mDeactivateSimilarNames.clear();
+
+ LLLoadInfo* info = new LLLoadInfo;
+ info->mItemID = base_item_id;
+ info->mInformServer = TRUE;
+ info->mDeactivateSimilar = FALSE;
+
+ const BOOL high_priority = TRUE;
+ gAssetStorage->getAssetData(asset_id,
+ LLAssetType::AT_GESTURE,
+ onLoadComplete,
+ (void*)info,
+ high_priority);
+ }
+
+ notifyObservers();
}
void LLGestureMgr::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id)
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
-
- item_map_t::iterator it = LLGestureMgr::instance().mActive.find(base_item_id);
- if (it == mActive.end())
- {
- LL_WARNS() << "replaceGesture for inactive gesture " << base_item_id << LL_ENDL;
- return;
- }
-
- // mActive owns this gesture pointer, so clean up memory.
- LLMultiGesture* gesture = (*it).second;
- LLGestureMgr::instance().replaceGesture(base_item_id, gesture, new_asset_id);
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+
+ item_map_t::iterator it = LLGestureMgr::instance().mActive.find(base_item_id);
+ if (it == mActive.end())
+ {
+ LL_WARNS() << "replaceGesture for inactive gesture " << base_item_id << LL_ENDL;
+ return;
+ }
+
+ // mActive owns this gesture pointer, so clean up memory.
+ LLMultiGesture* gesture = (*it).second;
+ LLGestureMgr::instance().replaceGesture(base_item_id, gesture, new_asset_id);
}
void LLGestureMgr::playGesture(LLMultiGesture* gesture)
{
- if (!gesture) return;
-
- // Reset gesture to first step
- gesture->mCurrentStep = 0;
-
- // Add to list of playing
- gesture->mPlaying = TRUE;
- mPlaying.push_back(gesture);
-
- // Load all needed assets to minimize the delays
- // when gesture is playing.
- for (std::vector<LLGestureStep*>::iterator steps_it = gesture->mSteps.begin();
- steps_it != gesture->mSteps.end();
- ++steps_it)
- {
- LLGestureStep* step = *steps_it;
- switch(step->getType())
- {
- case STEP_ANIMATION:
- {
- LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- const LLUUID& anim_id = anim_step->mAnimAssetID;
-
- // Don't request the animation if this step stops it or if it is already in the cache
- if (!(anim_id.isNull()
- || anim_step->mFlags & ANIM_FLAG_STOP
- || gAssetStorage->hasLocalAsset(anim_id, LLAssetType::AT_ANIMATION)))
- {
- mLoadingAssets.insert(anim_id);
-
- LLUUID* id = new LLUUID(gAgentID);
- gAssetStorage->getAssetData(anim_id,
- LLAssetType::AT_ANIMATION,
- onAssetLoadComplete,
- (void *)id,
- TRUE);
- }
- break;
- }
- case STEP_SOUND:
- {
- LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
- const LLUUID& sound_id = sound_step->mSoundAssetID;
- if (!(sound_id.isNull()
- || gAssetStorage->hasLocalAsset(sound_id, LLAssetType::AT_SOUND)))
- {
- mLoadingAssets.insert(sound_id);
-
- gAssetStorage->getAssetData(sound_id,
- LLAssetType::AT_SOUND,
- onAssetLoadComplete,
- NULL,
- TRUE);
- }
- break;
- }
- case STEP_CHAT:
- case STEP_WAIT:
- case STEP_EOF:
- {
- break;
- }
- default:
- {
- LL_WARNS() << "Unknown gesture step type: " << step->getType() << LL_ENDL;
- }
- }
- }
-
- // And get it going
- stepGesture(gesture);
-
- notifyObservers();
+ if (!gesture) return;
+
+ // Reset gesture to first step
+ gesture->mCurrentStep = 0;
+
+ // Add to list of playing
+ gesture->mPlaying = TRUE;
+ mPlaying.push_back(gesture);
+
+ // Load all needed assets to minimize the delays
+ // when gesture is playing.
+ for (std::vector<LLGestureStep*>::iterator steps_it = gesture->mSteps.begin();
+ steps_it != gesture->mSteps.end();
+ ++steps_it)
+ {
+ LLGestureStep* step = *steps_it;
+ switch(step->getType())
+ {
+ case STEP_ANIMATION:
+ {
+ LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
+ const LLUUID& anim_id = anim_step->mAnimAssetID;
+
+ // Don't request the animation if this step stops it or if it is already in the cache
+ if (!(anim_id.isNull()
+ || anim_step->mFlags & ANIM_FLAG_STOP
+ || gAssetStorage->hasLocalAsset(anim_id, LLAssetType::AT_ANIMATION)))
+ {
+ mLoadingAssets.insert(anim_id);
+
+ LLUUID* id = new LLUUID(gAgentID);
+ gAssetStorage->getAssetData(anim_id,
+ LLAssetType::AT_ANIMATION,
+ onAssetLoadComplete,
+ (void *)id,
+ TRUE);
+ }
+ break;
+ }
+ case STEP_SOUND:
+ {
+ LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
+ const LLUUID& sound_id = sound_step->mSoundAssetID;
+ if (!(sound_id.isNull()
+ || gAssetStorage->hasLocalAsset(sound_id, LLAssetType::AT_SOUND)))
+ {
+ mLoadingAssets.insert(sound_id);
+
+ gAssetStorage->getAssetData(sound_id,
+ LLAssetType::AT_SOUND,
+ onAssetLoadComplete,
+ NULL,
+ TRUE);
+ }
+ break;
+ }
+ case STEP_CHAT:
+ case STEP_WAIT:
+ case STEP_EOF:
+ {
+ break;
+ }
+ default:
+ {
+ LL_WARNS() << "Unknown gesture step type: " << step->getType() << LL_ENDL;
+ }
+ }
+ }
+
+ // And get it going
+ stepGesture(gesture);
+
+ notifyObservers();
}
// Convenience function that looks up the item_id for you.
void LLGestureMgr::playGesture(const LLUUID& item_id)
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
- item_map_t::iterator it = mActive.find(base_item_id);
- if (it == mActive.end()) return;
+ item_map_t::iterator it = mActive.find(base_item_id);
+ if (it == mActive.end()) return;
- LLMultiGesture* gesture = (*it).second;
- if (!gesture) return;
+ LLMultiGesture* gesture = (*it).second;
+ if (!gesture) return;
- playGesture(gesture);
+ playGesture(gesture);
}
@@ -626,482 +626,482 @@ void LLGestureMgr::playGesture(const LLUUID& item_id)
// and (as a minor side effect) has multiple spaces in a row replaced by single spaces.
BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::string* revised_string)
{
- std::string tokenized = utf8str;
-
- BOOL found_gestures = FALSE;
- BOOL first_token = TRUE;
-
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep(" ");
- tokenizer tokens(tokenized, sep);
- tokenizer::iterator token_iter;
-
- for( token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
- {
- const char* cur_token = token_iter->c_str();
- LLMultiGesture* gesture = NULL;
-
- // Only pay attention to the first gesture in the string.
- if( !found_gestures )
- {
- // collect gestures that match
- std::vector <LLMultiGesture *> matching;
- item_map_t::iterator it;
- for (it = mActive.begin(); it != mActive.end(); ++it)
- {
- gesture = (*it).second;
-
- // Gesture asset data might not have arrived yet
- if (!gesture) continue;
-
- if (LLStringUtil::compareInsensitive(gesture->mTrigger, cur_token) == 0)
- {
- matching.push_back(gesture);
- }
-
- gesture = NULL;
- }
-
-
- if (matching.size() > 0)
- {
- // choose one at random
- {
- S32 random = ll_rand(matching.size());
-
- gesture = matching[random];
-
- playGesture(gesture);
-
- if (!gesture->mReplaceText.empty())
- {
- if( !first_token )
- {
- if (revised_string)
- revised_string->append( " " );
- }
-
- // Don't muck with the user's capitalization if we don't have to.
- if( LLStringUtil::compareInsensitive(cur_token, gesture->mReplaceText) == 0)
- {
- if (revised_string)
- revised_string->append( cur_token );
- }
- else
- {
- if (revised_string)
- revised_string->append( gesture->mReplaceText );
- }
- }
- found_gestures = TRUE;
- }
- }
- }
-
- if(!gesture)
- {
- // This token doesn't match a gesture. Pass it through to the output.
- if( !first_token )
- {
- if (revised_string)
- revised_string->append( " " );
- }
- if (revised_string)
- revised_string->append( cur_token );
- }
-
- first_token = FALSE;
- gesture = NULL;
- }
- return found_gestures;
+ std::string tokenized = utf8str;
+
+ BOOL found_gestures = FALSE;
+ BOOL first_token = TRUE;
+
+ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+ boost::char_separator<char> sep(" ");
+ tokenizer tokens(tokenized, sep);
+ tokenizer::iterator token_iter;
+
+ for( token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
+ {
+ const char* cur_token = token_iter->c_str();
+ LLMultiGesture* gesture = NULL;
+
+ // Only pay attention to the first gesture in the string.
+ if( !found_gestures )
+ {
+ // collect gestures that match
+ std::vector <LLMultiGesture *> matching;
+ item_map_t::iterator it;
+ for (it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ gesture = (*it).second;
+
+ // Gesture asset data might not have arrived yet
+ if (!gesture) continue;
+
+ if (LLStringUtil::compareInsensitive(gesture->mTrigger, cur_token) == 0)
+ {
+ matching.push_back(gesture);
+ }
+
+ gesture = NULL;
+ }
+
+
+ if (matching.size() > 0)
+ {
+ // choose one at random
+ {
+ S32 random = ll_rand(matching.size());
+
+ gesture = matching[random];
+
+ playGesture(gesture);
+
+ if (!gesture->mReplaceText.empty())
+ {
+ if( !first_token )
+ {
+ if (revised_string)
+ revised_string->append( " " );
+ }
+
+ // Don't muck with the user's capitalization if we don't have to.
+ if( LLStringUtil::compareInsensitive(cur_token, gesture->mReplaceText) == 0)
+ {
+ if (revised_string)
+ revised_string->append( cur_token );
+ }
+ else
+ {
+ if (revised_string)
+ revised_string->append( gesture->mReplaceText );
+ }
+ }
+ found_gestures = TRUE;
+ }
+ }
+ }
+
+ if(!gesture)
+ {
+ // This token doesn't match a gesture. Pass it through to the output.
+ if( !first_token )
+ {
+ if (revised_string)
+ revised_string->append( " " );
+ }
+ if (revised_string)
+ revised_string->append( cur_token );
+ }
+
+ first_token = FALSE;
+ gesture = NULL;
+ }
+ return found_gestures;
}
BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask)
{
- std::vector <LLMultiGesture *> matching;
- item_map_t::iterator it;
-
- // collect matching gestures
- for (it = mActive.begin(); it != mActive.end(); ++it)
- {
- LLMultiGesture* gesture = (*it).second;
-
- // asset data might not have arrived yet
- if (!gesture) continue;
-
- if (gesture->mKey == key
- && gesture->mMask == mask)
- {
- matching.push_back(gesture);
- }
- }
-
- // choose one and play it
- if (matching.size() > 0)
- {
- U32 random = ll_rand(matching.size());
-
- LLMultiGesture* gesture = matching[random];
-
- playGesture(gesture);
- return TRUE;
- }
- return FALSE;
+ std::vector <LLMultiGesture *> matching;
+ item_map_t::iterator it;
+
+ // collect matching gestures
+ for (it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ LLMultiGesture* gesture = (*it).second;
+
+ // asset data might not have arrived yet
+ if (!gesture) continue;
+
+ if (gesture->mKey == key
+ && gesture->mMask == mask)
+ {
+ matching.push_back(gesture);
+ }
+ }
+
+ // choose one and play it
+ if (matching.size() > 0)
+ {
+ U32 random = ll_rand(matching.size());
+
+ LLMultiGesture* gesture = matching[random];
+
+ playGesture(gesture);
+ return TRUE;
+ }
+ return FALSE;
}
S32 LLGestureMgr::getPlayingCount() const
{
- return mPlaying.size();
+ return mPlaying.size();
}
struct IsGesturePlaying
{
- bool operator()(const LLMultiGesture* gesture) const
- {
- return bool(gesture->mPlaying);
- }
+ bool operator()(const LLMultiGesture* gesture) const
+ {
+ return bool(gesture->mPlaying);
+ }
};
void LLGestureMgr::update()
{
- S32 i;
- for (i = 0; i < (S32)mPlaying.size(); ++i)
- {
- stepGesture(mPlaying[i]);
- }
-
- // Clear out gestures that are done, by moving all the
- // ones that are still playing to the front.
- std::vector<LLMultiGesture*>::iterator new_end;
- new_end = std::partition(mPlaying.begin(),
- mPlaying.end(),
- IsGesturePlaying());
-
- // Something finished playing
- if (new_end != mPlaying.end())
- {
- // Delete the completed gestures that want deletion
- std::vector<LLMultiGesture*>::iterator it;
- for (it = new_end; it != mPlaying.end(); ++it)
- {
- LLMultiGesture* gesture = *it;
-
- if (gesture->mDoneCallback)
- {
- gesture->mDoneCallback(gesture, gesture->mCallbackData);
-
- // callback might have deleted gesture, can't
- // rely on this pointer any more
- gesture = NULL;
- }
- }
-
- // And take done gestures out of the playing list
- mPlaying.erase(new_end, mPlaying.end());
-
- notifyObservers();
- }
+ S32 i;
+ for (i = 0; i < (S32)mPlaying.size(); ++i)
+ {
+ stepGesture(mPlaying[i]);
+ }
+
+ // Clear out gestures that are done, by moving all the
+ // ones that are still playing to the front.
+ std::vector<LLMultiGesture*>::iterator new_end;
+ new_end = std::partition(mPlaying.begin(),
+ mPlaying.end(),
+ IsGesturePlaying());
+
+ // Something finished playing
+ if (new_end != mPlaying.end())
+ {
+ // Delete the completed gestures that want deletion
+ std::vector<LLMultiGesture*>::iterator it;
+ for (it = new_end; it != mPlaying.end(); ++it)
+ {
+ LLMultiGesture* gesture = *it;
+
+ if (gesture->mDoneCallback)
+ {
+ gesture->mDoneCallback(gesture, gesture->mCallbackData);
+
+ // callback might have deleted gesture, can't
+ // rely on this pointer any more
+ gesture = NULL;
+ }
+ }
+
+ // And take done gestures out of the playing list
+ mPlaying.erase(new_end, mPlaying.end());
+
+ notifyObservers();
+ }
}
// Run all steps until you're either done or hit a wait.
void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
{
- if (!gesture)
- {
- return;
- }
- if (!isAgentAvatarValid() || hasLoadingAssets(gesture)) return;
-
- // Of the ones that started playing, have any stopped?
-
- std::set<LLUUID>::iterator gest_it;
- for (gest_it = gesture->mPlayingAnimIDs.begin();
- gest_it != gesture->mPlayingAnimIDs.end();
- )
- {
- // look in signaled animations (simulator's view of what is
- // currently playing.
- LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it);
- if (play_it != gAgentAvatarp->mSignaledAnimations.end())
- {
- ++gest_it;
- }
- else
- {
- // not found, so not currently playing or scheduled to play
- // delete from the triggered set
- gesture->mPlayingAnimIDs.erase(gest_it++);
- }
- }
-
- // Of all the animations that we asked the sim to start for us,
- // pick up the ones that have actually started.
- for (gest_it = gesture->mRequestedAnimIDs.begin();
- gest_it != gesture->mRequestedAnimIDs.end();
- )
- {
- LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it);
- if (play_it != gAgentAvatarp->mSignaledAnimations.end())
- {
- // Hooray, this animation has started playing!
- // Copy into playing.
- gesture->mPlayingAnimIDs.insert(*gest_it);
- gesture->mRequestedAnimIDs.erase(gest_it++);
- }
- else
- {
- // nope, not playing yet
- ++gest_it;
- }
- }
-
- // Run the current steps
- BOOL waiting = FALSE;
- while (!waiting && gesture->mPlaying)
- {
- // Get the current step, if there is one.
- // Otherwise enter the waiting at end state.
- LLGestureStep* step = NULL;
- if (gesture->mCurrentStep < (S32)gesture->mSteps.size())
- {
- step = gesture->mSteps[gesture->mCurrentStep];
- llassert(step != NULL);
- }
- else
- {
- // step stays null, we're off the end
- gesture->mWaitingAtEnd = TRUE;
- }
-
-
- // If we're waiting at the end, wait for all gestures to stop
- // playing.
- // TODO: Wait for all sounds to complete as well.
- if (gesture->mWaitingAtEnd)
- {
- // Neither do we have any pending requests, nor are they
- // still playing.
- if ((gesture->mRequestedAnimIDs.empty()
- && gesture->mPlayingAnimIDs.empty()))
- {
- // all animations are done playing
- gesture->mWaitingAtEnd = FALSE;
- gesture->mPlaying = FALSE;
- }
- else
- {
- waiting = TRUE;
- }
- continue;
- }
-
- // If we're waiting on our animations to stop, poll for
- // completion.
- if (gesture->mWaitingAnimations)
- {
- // Neither do we have any pending requests, nor are they
- // still playing.
- if ((gesture->mRequestedAnimIDs.empty()
- && gesture->mPlayingAnimIDs.empty()))
- {
- // all animations are done playing
- gesture->mWaitingAnimations = FALSE;
- gesture->mCurrentStep++;
- }
- else if (gesture->mWaitTimer.getElapsedTimeF32() > MAX_WAIT_ANIM_SECS)
- {
- // we've waited too long for an animation
- LL_INFOS("GestureMgr") << "Waited too long for animations to stop, continuing gesture."
- << LL_ENDL;
- gesture->mWaitingAnimations = FALSE;
- gesture->mCurrentStep++;
- }
- else
- {
- waiting = TRUE;
- }
- continue;
- }
-
- // If we're waiting a fixed amount of time, check for timer
- // expiration.
- if (gesture->mWaitingTimer)
- {
- // We're waiting for a certain amount of time to pass
- LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
-
- F32 elapsed = gesture->mWaitTimer.getElapsedTimeF32();
- if (elapsed > wait_step->mWaitSeconds)
- {
- // wait is done, continue execution
- gesture->mWaitingTimer = FALSE;
- gesture->mCurrentStep++;
- }
- else
- {
- // we're waiting, so execution is done for now
- waiting = TRUE;
- }
- continue;
- }
-
- // Not waiting, do normal execution
- runStep(gesture, step);
- }
+ if (!gesture)
+ {
+ return;
+ }
+ if (!isAgentAvatarValid() || hasLoadingAssets(gesture)) return;
+
+ // Of the ones that started playing, have any stopped?
+
+ std::set<LLUUID>::iterator gest_it;
+ for (gest_it = gesture->mPlayingAnimIDs.begin();
+ gest_it != gesture->mPlayingAnimIDs.end();
+ )
+ {
+ // look in signaled animations (simulator's view of what is
+ // currently playing.
+ LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it);
+ if (play_it != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ ++gest_it;
+ }
+ else
+ {
+ // not found, so not currently playing or scheduled to play
+ // delete from the triggered set
+ gesture->mPlayingAnimIDs.erase(gest_it++);
+ }
+ }
+
+ // Of all the animations that we asked the sim to start for us,
+ // pick up the ones that have actually started.
+ for (gest_it = gesture->mRequestedAnimIDs.begin();
+ gest_it != gesture->mRequestedAnimIDs.end();
+ )
+ {
+ LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it);
+ if (play_it != gAgentAvatarp->mSignaledAnimations.end())
+ {
+ // Hooray, this animation has started playing!
+ // Copy into playing.
+ gesture->mPlayingAnimIDs.insert(*gest_it);
+ gesture->mRequestedAnimIDs.erase(gest_it++);
+ }
+ else
+ {
+ // nope, not playing yet
+ ++gest_it;
+ }
+ }
+
+ // Run the current steps
+ BOOL waiting = FALSE;
+ while (!waiting && gesture->mPlaying)
+ {
+ // Get the current step, if there is one.
+ // Otherwise enter the waiting at end state.
+ LLGestureStep* step = NULL;
+ if (gesture->mCurrentStep < (S32)gesture->mSteps.size())
+ {
+ step = gesture->mSteps[gesture->mCurrentStep];
+ llassert(step != NULL);
+ }
+ else
+ {
+ // step stays null, we're off the end
+ gesture->mWaitingAtEnd = TRUE;
+ }
+
+
+ // If we're waiting at the end, wait for all gestures to stop
+ // playing.
+ // TODO: Wait for all sounds to complete as well.
+ if (gesture->mWaitingAtEnd)
+ {
+ // Neither do we have any pending requests, nor are they
+ // still playing.
+ if ((gesture->mRequestedAnimIDs.empty()
+ && gesture->mPlayingAnimIDs.empty()))
+ {
+ // all animations are done playing
+ gesture->mWaitingAtEnd = FALSE;
+ gesture->mPlaying = FALSE;
+ }
+ else
+ {
+ waiting = TRUE;
+ }
+ continue;
+ }
+
+ // If we're waiting on our animations to stop, poll for
+ // completion.
+ if (gesture->mWaitingAnimations)
+ {
+ // Neither do we have any pending requests, nor are they
+ // still playing.
+ if ((gesture->mRequestedAnimIDs.empty()
+ && gesture->mPlayingAnimIDs.empty()))
+ {
+ // all animations are done playing
+ gesture->mWaitingAnimations = FALSE;
+ gesture->mCurrentStep++;
+ }
+ else if (gesture->mWaitTimer.getElapsedTimeF32() > MAX_WAIT_ANIM_SECS)
+ {
+ // we've waited too long for an animation
+ LL_INFOS("GestureMgr") << "Waited too long for animations to stop, continuing gesture."
+ << LL_ENDL;
+ gesture->mWaitingAnimations = FALSE;
+ gesture->mCurrentStep++;
+ }
+ else
+ {
+ waiting = TRUE;
+ }
+ continue;
+ }
+
+ // If we're waiting a fixed amount of time, check for timer
+ // expiration.
+ if (gesture->mWaitingTimer)
+ {
+ // We're waiting for a certain amount of time to pass
+ LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
+
+ F32 elapsed = gesture->mWaitTimer.getElapsedTimeF32();
+ if (elapsed > wait_step->mWaitSeconds)
+ {
+ // wait is done, continue execution
+ gesture->mWaitingTimer = FALSE;
+ gesture->mCurrentStep++;
+ }
+ else
+ {
+ // we're waiting, so execution is done for now
+ waiting = TRUE;
+ }
+ continue;
+ }
+
+ // Not waiting, do normal execution
+ runStep(gesture, step);
+ }
}
void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
{
- switch(step->getType())
- {
- case STEP_ANIMATION:
- {
- LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- if (anim_step->mAnimAssetID.isNull())
- {
- gesture->mCurrentStep++;
- }
-
- if (anim_step->mFlags & ANIM_FLAG_STOP)
- {
- gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_STOP);
- // remove it from our request set in case we just requested it
- std::set<LLUUID>::iterator set_it = gesture->mRequestedAnimIDs.find(anim_step->mAnimAssetID);
- if (set_it != gesture->mRequestedAnimIDs.end())
- {
- gesture->mRequestedAnimIDs.erase(set_it);
- }
- }
- else
- {
- gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_START);
- // Indicate that we've requested this animation to play as
- // part of this gesture (but it won't start playing for at
- // least one round-trip to simulator).
- gesture->mRequestedAnimIDs.insert(anim_step->mAnimAssetID);
- }
- gesture->mCurrentStep++;
- break;
- }
- case STEP_SOUND:
- {
- LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
- const LLUUID& sound_id = sound_step->mSoundAssetID;
- const F32 volume = 1.f;
- send_sound_trigger(sound_id, volume);
- gesture->mCurrentStep++;
- break;
- }
- case STEP_CHAT:
- {
- LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
- std::string chat_text = chat_step->mChatText;
- // Don't animate the nodding, as this might not blend with
- // other playing animations.
-
- const BOOL animate = FALSE;
-
- (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->
- sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
-
- gesture->mCurrentStep++;
- break;
- }
- case STEP_WAIT:
- {
- LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
- if (wait_step->mFlags & WAIT_FLAG_TIME)
- {
- gesture->mWaitingTimer = TRUE;
- gesture->mWaitTimer.reset();
- }
- else if (wait_step->mFlags & WAIT_FLAG_ALL_ANIM)
- {
- gesture->mWaitingAnimations = TRUE;
- // Use the wait timer as a deadlock breaker for animation
- // waits.
- gesture->mWaitTimer.reset();
- }
- else
- {
- gesture->mCurrentStep++;
- }
- // Don't increment instruction pointer until wait is complete.
- break;
- }
- default:
- {
- break;
- }
- }
+ switch(step->getType())
+ {
+ case STEP_ANIMATION:
+ {
+ LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
+ if (anim_step->mAnimAssetID.isNull())
+ {
+ gesture->mCurrentStep++;
+ }
+
+ if (anim_step->mFlags & ANIM_FLAG_STOP)
+ {
+ gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_STOP);
+ // remove it from our request set in case we just requested it
+ std::set<LLUUID>::iterator set_it = gesture->mRequestedAnimIDs.find(anim_step->mAnimAssetID);
+ if (set_it != gesture->mRequestedAnimIDs.end())
+ {
+ gesture->mRequestedAnimIDs.erase(set_it);
+ }
+ }
+ else
+ {
+ gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_START);
+ // Indicate that we've requested this animation to play as
+ // part of this gesture (but it won't start playing for at
+ // least one round-trip to simulator).
+ gesture->mRequestedAnimIDs.insert(anim_step->mAnimAssetID);
+ }
+ gesture->mCurrentStep++;
+ break;
+ }
+ case STEP_SOUND:
+ {
+ LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
+ const LLUUID& sound_id = sound_step->mSoundAssetID;
+ const F32 volume = 1.f;
+ send_sound_trigger(sound_id, volume);
+ gesture->mCurrentStep++;
+ break;
+ }
+ case STEP_CHAT:
+ {
+ LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
+ std::string chat_text = chat_step->mChatText;
+ // Don't animate the nodding, as this might not blend with
+ // other playing animations.
+
+ const BOOL animate = FALSE;
+
+ (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->
+ sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
+
+ gesture->mCurrentStep++;
+ break;
+ }
+ case STEP_WAIT:
+ {
+ LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
+ if (wait_step->mFlags & WAIT_FLAG_TIME)
+ {
+ gesture->mWaitingTimer = TRUE;
+ gesture->mWaitTimer.reset();
+ }
+ else if (wait_step->mFlags & WAIT_FLAG_ALL_ANIM)
+ {
+ gesture->mWaitingAnimations = TRUE;
+ // Use the wait timer as a deadlock breaker for animation
+ // waits.
+ gesture->mWaitTimer.reset();
+ }
+ else
+ {
+ gesture->mCurrentStep++;
+ }
+ // Don't increment instruction pointer until wait is complete.
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
// static
void LLGestureMgr::onLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status)
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status)
{
- LLLoadInfo* info = (LLLoadInfo*)user_data;
-
- LLUUID item_id = info->mItemID;
- BOOL inform_server = info->mInformServer;
- BOOL deactivate_similar = info->mDeactivateSimilar;
-
- delete info;
- info = NULL;
- LLGestureMgr& self = LLGestureMgr::instance();
- self.mLoadingCount--;
-
- if (0 == status)
- {
- LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
- S32 size = file.getSize();
-
- std::vector<char> buffer(size+1);
-
- file.read((U8*)&buffer[0], size);
- // ensure there's a trailing NULL so strlen will work.
- buffer[size] = '\0';
-
- LLMultiGesture* gesture = new LLMultiGesture();
-
- LLDataPackerAsciiBuffer dp(&buffer[0], size+1);
- BOOL ok = gesture->deserialize(dp);
-
- if (ok)
- {
- if (deactivate_similar)
- {
- self.deactivateSimilarGestures(gesture, item_id);
-
- // Display deactivation message if this was the last of the bunch.
- if (self.mLoadingCount == 0
- && self.mDeactivateSimilarNames.length() > 0)
- {
- // we're done with this set of deactivations
- LLSD args;
- args["NAMES"] = self.mDeactivateSimilarNames;
- LLNotificationsUtil::add("DeactivatedGesturesTrigger", args);
- }
- }
-
- LLViewerInventoryItem* item = gInventory.getItem(item_id);
- if(item)
- {
- gesture->mName = item->getName();
- }
- else
- {
- // Watch this item and set gesture name when item exists in inventory
- self.setFetchID(item_id);
- self.startFetch();
- }
+ LLLoadInfo* info = (LLLoadInfo*)user_data;
+
+ LLUUID item_id = info->mItemID;
+ BOOL inform_server = info->mInformServer;
+ BOOL deactivate_similar = info->mDeactivateSimilar;
+
+ delete info;
+ info = NULL;
+ LLGestureMgr& self = LLGestureMgr::instance();
+ self.mLoadingCount--;
+
+ if (0 == status)
+ {
+ LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
+ S32 size = file.getSize();
+
+ std::vector<char> buffer(size+1);
+
+ file.read((U8*)&buffer[0], size);
+ // ensure there's a trailing NULL so strlen will work.
+ buffer[size] = '\0';
+
+ LLMultiGesture* gesture = new LLMultiGesture();
+
+ LLDataPackerAsciiBuffer dp(&buffer[0], size+1);
+ BOOL ok = gesture->deserialize(dp);
+
+ if (ok)
+ {
+ if (deactivate_similar)
+ {
+ self.deactivateSimilarGestures(gesture, item_id);
+
+ // Display deactivation message if this was the last of the bunch.
+ if (self.mLoadingCount == 0
+ && self.mDeactivateSimilarNames.length() > 0)
+ {
+ // we're done with this set of deactivations
+ LLSD args;
+ args["NAMES"] = self.mDeactivateSimilarNames;
+ LLNotificationsUtil::add("DeactivatedGesturesTrigger", args);
+ }
+ }
+
+ LLViewerInventoryItem* item = gInventory.getItem(item_id);
+ if(item)
+ {
+ gesture->mName = item->getName();
+ }
+ else
+ {
+ // Watch this item and set gesture name when item exists in inventory
+ self.setFetchID(item_id);
+ self.startFetch();
+ }
item_map_t::iterator it = self.mActive.find(item_id);
if (it == self.mActive.end())
@@ -1130,41 +1130,41 @@ void LLGestureMgr::onLoadComplete(const LLUUID& asset_uuid,
}
}
- self.mActive[item_id] = gesture;
-
- // Everything has been successful. Add to the active list.
- gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
-
- if (inform_server)
- {
- // Inform the database of this change
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ActivateGestures");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addU32("Flags", 0x0);
-
- msg->nextBlock("Data");
- msg->addUUID("ItemID", item_id);
- msg->addUUID("AssetID", asset_uuid);
- msg->addU32("GestureFlags", 0x0);
-
- gAgent.sendReliableMessage();
- }
- callback_map_t::iterator i_cb = self.mCallbackMap.find(item_id);
-
- if(i_cb != self.mCallbackMap.end())
- {
- i_cb->second(gesture);
- self.mCallbackMap.erase(i_cb);
- }
-
- self.notifyObservers();
- }
- else
- {
- LL_WARNS("GestureMgr") << "Unable to load gesture" << LL_ENDL;
+ self.mActive[item_id] = gesture;
+
+ // Everything has been successful. Add to the active list.
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+
+ if (inform_server)
+ {
+ // Inform the database of this change
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ActivateGestures");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->addU32("Flags", 0x0);
+
+ msg->nextBlock("Data");
+ msg->addUUID("ItemID", item_id);
+ msg->addUUID("AssetID", asset_uuid);
+ msg->addU32("GestureFlags", 0x0);
+
+ gAgent.sendReliableMessage();
+ }
+ callback_map_t::iterator i_cb = self.mCallbackMap.find(item_id);
+
+ if(i_cb != self.mCallbackMap.end())
+ {
+ i_cb->second(gesture);
+ self.mCallbackMap.erase(i_cb);
+ }
+
+ self.notifyObservers();
+ }
+ else
+ {
+ LL_WARNS("GestureMgr") << "Unable to load gesture" << LL_ENDL;
item_map_t::iterator it = self.mActive.find(item_id);
if (it != self.mActive.end())
@@ -1181,25 +1181,25 @@ void LLGestureMgr::onLoadComplete(const LLUUID& asset_uuid,
}
self.mActive.erase(item_id);
}
-
- delete gesture;
- gesture = NULL;
- }
- }
- else
- {
- if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
- LL_ERR_FILE_EMPTY == status)
- {
- LLDelayedGestureError::gestureMissing( item_id );
- }
- else
- {
- LLDelayedGestureError::gestureFailedToLoad( item_id );
- }
-
- LL_WARNS("GestureMgr") << "Problem loading gesture: " << status << LL_ENDL;
-
+
+ delete gesture;
+ gesture = NULL;
+ }
+ }
+ else
+ {
+ if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
+ LL_ERR_FILE_EMPTY == status)
+ {
+ LLDelayedGestureError::gestureMissing( item_id );
+ }
+ else
+ {
+ LLDelayedGestureError::gestureFailedToLoad( item_id );
+ }
+
+ LL_WARNS("GestureMgr") << "Problem loading gesture: " << status << LL_ENDL;
+
item_map_t::iterator it = self.mActive.find(item_id);
if (it != self.mActive.end())
{
@@ -1215,168 +1215,168 @@ void LLGestureMgr::onLoadComplete(const LLUUID& asset_uuid,
}
self.mActive.erase(item_id);
}
- }
+ }
}
// static
void LLGestureMgr::onAssetLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status)
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status)
{
- LLGestureMgr& self = LLGestureMgr::instance();
-
- // Complete the asset loading process depending on the type and
- // remove the asset id from pending downloads list.
- switch(type)
- {
- case LLAssetType::AT_ANIMATION:
- {
- LLKeyframeMotion::onLoadComplete(asset_uuid, type, user_data, status, ext_status);
-
- self.mLoadingAssets.erase(asset_uuid);
-
- break;
- }
- case LLAssetType::AT_SOUND:
- {
- LLAudioEngine::assetCallback(asset_uuid, type, user_data, status, ext_status);
-
- self.mLoadingAssets.erase(asset_uuid);
-
- break;
- }
- default:
- {
- LL_WARNS() << "Unexpected asset type: " << type << LL_ENDL;
-
- // We don't want to return from this callback without
- // an animation or sound callback being fired
- // and *user_data handled to avoid memory leaks.
- llassert(type == LLAssetType::AT_ANIMATION || type == LLAssetType::AT_SOUND);
- }
- }
+ LLGestureMgr& self = LLGestureMgr::instance();
+
+ // Complete the asset loading process depending on the type and
+ // remove the asset id from pending downloads list.
+ switch(type)
+ {
+ case LLAssetType::AT_ANIMATION:
+ {
+ LLKeyframeMotion::onLoadComplete(asset_uuid, type, user_data, status, ext_status);
+
+ self.mLoadingAssets.erase(asset_uuid);
+
+ break;
+ }
+ case LLAssetType::AT_SOUND:
+ {
+ LLAudioEngine::assetCallback(asset_uuid, type, user_data, status, ext_status);
+
+ self.mLoadingAssets.erase(asset_uuid);
+
+ break;
+ }
+ default:
+ {
+ LL_WARNS() << "Unexpected asset type: " << type << LL_ENDL;
+
+ // We don't want to return from this callback without
+ // an animation or sound callback being fired
+ // and *user_data handled to avoid memory leaks.
+ llassert(type == LLAssetType::AT_ANIMATION || type == LLAssetType::AT_SOUND);
+ }
+ }
}
// static
bool LLGestureMgr::hasLoadingAssets(LLMultiGesture* gesture)
{
- LLGestureMgr& self = LLGestureMgr::instance();
-
- for (std::vector<LLGestureStep*>::iterator steps_it = gesture->mSteps.begin();
- steps_it != gesture->mSteps.end();
- ++steps_it)
- {
- LLGestureStep* step = *steps_it;
- switch(step->getType())
- {
- case STEP_ANIMATION:
- {
- LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- const LLUUID& anim_id = anim_step->mAnimAssetID;
-
- if (!(anim_id.isNull()
- || anim_step->mFlags & ANIM_FLAG_STOP
- || self.mLoadingAssets.find(anim_id) == self.mLoadingAssets.end()))
- {
- return true;
- }
- break;
- }
- case STEP_SOUND:
- {
- LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
- const LLUUID& sound_id = sound_step->mSoundAssetID;
-
- if (!(sound_id.isNull()
- || self.mLoadingAssets.find(sound_id) == self.mLoadingAssets.end()))
- {
- return true;
- }
- break;
- }
- case STEP_CHAT:
- case STEP_WAIT:
- case STEP_EOF:
- {
- break;
- }
- default:
- {
- LL_WARNS() << "Unknown gesture step type: " << step->getType() << LL_ENDL;
- }
- }
- }
-
- return false;
+ LLGestureMgr& self = LLGestureMgr::instance();
+
+ for (std::vector<LLGestureStep*>::iterator steps_it = gesture->mSteps.begin();
+ steps_it != gesture->mSteps.end();
+ ++steps_it)
+ {
+ LLGestureStep* step = *steps_it;
+ switch(step->getType())
+ {
+ case STEP_ANIMATION:
+ {
+ LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
+ const LLUUID& anim_id = anim_step->mAnimAssetID;
+
+ if (!(anim_id.isNull()
+ || anim_step->mFlags & ANIM_FLAG_STOP
+ || self.mLoadingAssets.find(anim_id) == self.mLoadingAssets.end()))
+ {
+ return true;
+ }
+ break;
+ }
+ case STEP_SOUND:
+ {
+ LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
+ const LLUUID& sound_id = sound_step->mSoundAssetID;
+
+ if (!(sound_id.isNull()
+ || self.mLoadingAssets.find(sound_id) == self.mLoadingAssets.end()))
+ {
+ return true;
+ }
+ break;
+ }
+ case STEP_CHAT:
+ case STEP_WAIT:
+ case STEP_EOF:
+ {
+ break;
+ }
+ default:
+ {
+ LL_WARNS() << "Unknown gesture step type: " << step->getType() << LL_ENDL;
+ }
+ }
+ }
+
+ return false;
}
void LLGestureMgr::stopGesture(LLMultiGesture* gesture)
{
- if (!gesture) return;
-
- // Stop any animations that this gesture is currently playing
- std::set<LLUUID>::const_iterator set_it;
- for (set_it = gesture->mRequestedAnimIDs.begin(); set_it != gesture->mRequestedAnimIDs.end(); ++set_it)
- {
- const LLUUID& anim_id = *set_it;
- gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_STOP);
- }
- for (set_it = gesture->mPlayingAnimIDs.begin(); set_it != gesture->mPlayingAnimIDs.end(); ++set_it)
- {
- const LLUUID& anim_id = *set_it;
- gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_STOP);
- }
-
- std::vector<LLMultiGesture*>::iterator it;
- it = std::find(mPlaying.begin(), mPlaying.end(), gesture);
- while (it != mPlaying.end())
- {
- mPlaying.erase(it);
- it = std::find(mPlaying.begin(), mPlaying.end(), gesture);
- }
-
- gesture->reset();
-
- if (gesture->mDoneCallback)
- {
- gesture->mDoneCallback(gesture, gesture->mCallbackData);
-
- // callback might have deleted gesture, can't
- // rely on this pointer any more
- gesture = NULL;
- }
-
- notifyObservers();
+ if (!gesture) return;
+
+ // Stop any animations that this gesture is currently playing
+ std::set<LLUUID>::const_iterator set_it;
+ for (set_it = gesture->mRequestedAnimIDs.begin(); set_it != gesture->mRequestedAnimIDs.end(); ++set_it)
+ {
+ const LLUUID& anim_id = *set_it;
+ gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_STOP);
+ }
+ for (set_it = gesture->mPlayingAnimIDs.begin(); set_it != gesture->mPlayingAnimIDs.end(); ++set_it)
+ {
+ const LLUUID& anim_id = *set_it;
+ gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_STOP);
+ }
+
+ std::vector<LLMultiGesture*>::iterator it;
+ it = std::find(mPlaying.begin(), mPlaying.end(), gesture);
+ while (it != mPlaying.end())
+ {
+ mPlaying.erase(it);
+ it = std::find(mPlaying.begin(), mPlaying.end(), gesture);
+ }
+
+ gesture->reset();
+
+ if (gesture->mDoneCallback)
+ {
+ gesture->mDoneCallback(gesture, gesture->mCallbackData);
+
+ // callback might have deleted gesture, can't
+ // rely on this pointer any more
+ gesture = NULL;
+ }
+
+ notifyObservers();
}
void LLGestureMgr::stopGesture(const LLUUID& item_id)
{
- const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
+ const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
- item_map_t::iterator it = mActive.find(base_item_id);
- if (it == mActive.end()) return;
+ item_map_t::iterator it = mActive.find(base_item_id);
+ if (it == mActive.end()) return;
- LLMultiGesture* gesture = (*it).second;
- if (!gesture) return;
+ LLMultiGesture* gesture = (*it).second;
+ if (!gesture) return;
- stopGesture(gesture);
+ stopGesture(gesture);
}
void LLGestureMgr::addObserver(LLGestureManagerObserver* observer)
{
- mObservers.push_back(observer);
+ mObservers.push_back(observer);
}
void LLGestureMgr::removeObserver(LLGestureManagerObserver* observer)
{
- std::vector<LLGestureManagerObserver*>::iterator it;
- it = std::find(mObservers.begin(), mObservers.end(), observer);
- if (it != mObservers.end())
- {
- mObservers.erase(it);
- }
+ std::vector<LLGestureManagerObserver*>::iterator it;
+ it = std::find(mObservers.begin(), mObservers.end(), observer);
+ if (it != mObservers.end())
+ {
+ mObservers.erase(it);
+ }
}
// Call this method when it's time to update everyone on a new state.
@@ -1384,132 +1384,132 @@ void LLGestureMgr::removeObserver(LLGestureManagerObserver* observer)
// from the list.
void LLGestureMgr::notifyObservers()
{
- LL_DEBUGS() << "LLGestureMgr::notifyObservers" << LL_ENDL;
-
- for(std::vector<LLGestureManagerObserver*>::iterator iter = mObservers.begin();
- iter != mObservers.end();
- ++iter)
- {
- LLGestureManagerObserver* observer = (*iter);
- observer->changed();
- }
+ LL_DEBUGS() << "LLGestureMgr::notifyObservers" << LL_ENDL;
+
+ for(std::vector<LLGestureManagerObserver*>::iterator iter = mObservers.begin();
+ iter != mObservers.end();
+ ++iter)
+ {
+ LLGestureManagerObserver* observer = (*iter);
+ observer->changed();
+ }
}
BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
{
- S32 in_len = in_str.length();
-
- //return whole trigger, if received text equals to it
- item_map_t::iterator it;
- for (it = mActive.begin(); it != mActive.end(); ++it)
- {
- LLMultiGesture* gesture = (*it).second;
- if (gesture)
- {
- const std::string& trigger = gesture->getTrigger();
- if (!LLStringUtil::compareInsensitive(in_str, trigger))
- {
- *out_str = trigger;
- return TRUE;
- }
- }
- }
-
- //return common chars, if more than one trigger matches the prefix
- std::string rest_of_match = "";
- std::string buf = "";
- for (it = mActive.begin(); it != mActive.end(); ++it)
- {
- LLMultiGesture* gesture = (*it).second;
- if (gesture)
- {
- const std::string& trigger = gesture->getTrigger();
-
- if (in_len > (S32)trigger.length())
- {
- // too short, bail out
- continue;
- }
-
- std::string trigger_trunc = trigger;
- LLStringUtil::truncate(trigger_trunc, in_len);
- if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc))
- {
- if (rest_of_match.compare("") == 0)
- {
- rest_of_match = trigger.substr(in_str.size());
- }
- std::string cur_rest_of_match = trigger.substr(in_str.size());
- buf = "";
- S32 i=0;
-
- while (i<rest_of_match.length() && i<cur_rest_of_match.length())
- {
- if (rest_of_match[i]==cur_rest_of_match[i])
- {
- buf.push_back(rest_of_match[i]);
- }
- else
- {
- if(i==0)
- {
- rest_of_match = "";
- }
- break;
- }
- i++;
- }
- if (rest_of_match.compare("") == 0)
- {
- return TRUE;
- }
- if (buf.compare("") != 0)
- {
- rest_of_match = buf;
- }
-
- }
- }
- }
-
- if (rest_of_match.compare("") != 0)
- {
- *out_str = in_str+rest_of_match;
- return TRUE;
- }
-
- return FALSE;
+ S32 in_len = in_str.length();
+
+ //return whole trigger, if received text equals to it
+ item_map_t::iterator it;
+ for (it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ LLMultiGesture* gesture = (*it).second;
+ if (gesture)
+ {
+ const std::string& trigger = gesture->getTrigger();
+ if (!LLStringUtil::compareInsensitive(in_str, trigger))
+ {
+ *out_str = trigger;
+ return TRUE;
+ }
+ }
+ }
+
+ //return common chars, if more than one trigger matches the prefix
+ std::string rest_of_match = "";
+ std::string buf = "";
+ for (it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ LLMultiGesture* gesture = (*it).second;
+ if (gesture)
+ {
+ const std::string& trigger = gesture->getTrigger();
+
+ if (in_len > (S32)trigger.length())
+ {
+ // too short, bail out
+ continue;
+ }
+
+ std::string trigger_trunc = trigger;
+ LLStringUtil::truncate(trigger_trunc, in_len);
+ if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc))
+ {
+ if (rest_of_match.compare("") == 0)
+ {
+ rest_of_match = trigger.substr(in_str.size());
+ }
+ std::string cur_rest_of_match = trigger.substr(in_str.size());
+ buf = "";
+ S32 i=0;
+
+ while (i<rest_of_match.length() && i<cur_rest_of_match.length())
+ {
+ if (rest_of_match[i]==cur_rest_of_match[i])
+ {
+ buf.push_back(rest_of_match[i]);
+ }
+ else
+ {
+ if(i==0)
+ {
+ rest_of_match = "";
+ }
+ break;
+ }
+ i++;
+ }
+ if (rest_of_match.compare("") == 0)
+ {
+ return TRUE;
+ }
+ if (buf.compare("") != 0)
+ {
+ rest_of_match = buf;
+ }
+
+ }
+ }
+ }
+
+ if (rest_of_match.compare("") != 0)
+ {
+ *out_str = in_str+rest_of_match;
+ return TRUE;
+ }
+
+ return FALSE;
}
void LLGestureMgr::getItemIDs(uuid_vec_t* ids)
{
- item_map_t::const_iterator it;
- for (it = mActive.begin(); it != mActive.end(); ++it)
- {
- ids->push_back(it->first);
- }
+ item_map_t::const_iterator it;
+ for (it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ ids->push_back(it->first);
+ }
}
void LLGestureMgr::done()
{
- bool notify = false;
- for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it)
- {
- if(it->second && it->second->mName.empty())
- {
- LLViewerInventoryItem* item = gInventory.getItem(it->first);
- if(item)
- {
- it->second->mName = item->getName();
- notify = true;
- }
- }
- }
- if(notify)
- {
- notifyObservers();
- }
+ bool notify = false;
+ for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ if(it->second && it->second->mName.empty())
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(it->first);
+ if(item)
+ {
+ it->second->mName = item->getName();
+ notify = true;
+ }
+ }
+ }
+ if(notify)
+ {
+ notifyObservers();
+ }
}
diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h
index 7bb60f00e2..73b898c406 100644
--- a/indra/newview/llgesturemgr.h
+++ b/indra/newview/llgesturemgr.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgesturemgr.h
* @brief Manager for playing gestures on the viewer
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,7 +31,7 @@
#include <string>
#include <vector>
-#include "llassetstorage.h" // LLAssetType
+#include "llassetstorage.h" // LLAssetType
#include "llinventoryobserver.h"
#include "llsingleton.h"
#include "llviewerinventory.h"
@@ -44,148 +44,148 @@ class LLUUID;
class LLGestureManagerObserver
{
public:
- virtual ~LLGestureManagerObserver() { };
- virtual void changed() = 0;
+ virtual ~LLGestureManagerObserver() { };
+ virtual void changed() = 0;
};
class LLGestureMgr : public LLSingleton<LLGestureMgr>, public LLInventoryFetchItemsObserver
{
- LLSINGLETON(LLGestureMgr);
- ~LLGestureMgr();
+ LLSINGLETON(LLGestureMgr);
+ ~LLGestureMgr();
public:
- typedef boost::function<void (LLMultiGesture* loaded_gesture)> gesture_loaded_callback_t;
- // Maps inventory item_id to gesture
- typedef std::map<LLUUID, LLMultiGesture*> item_map_t;
- typedef std::map<LLUUID, gesture_loaded_callback_t> callback_map_t;
+ typedef boost::function<void (LLMultiGesture* loaded_gesture)> gesture_loaded_callback_t;
+ // Maps inventory item_id to gesture
+ typedef std::map<LLUUID, LLMultiGesture*> item_map_t;
+ typedef std::map<LLUUID, gesture_loaded_callback_t> callback_map_t;
- void init();
+ void init();
- // Call once per frame to manage gestures
- void update();
+ // Call once per frame to manage gestures
+ void update();
- // Loads a gesture out of inventory into the in-memory active form
- // Note that the inventory item must exist, so we can look up the
- // asset id.
- void activateGesture(const LLUUID& item_id);
+ // Loads a gesture out of inventory into the in-memory active form
+ // Note that the inventory item must exist, so we can look up the
+ // asset id.
+ void activateGesture(const LLUUID& item_id);
- // Activate a list of gestures
- void activateGestures(LLViewerInventoryItem::item_array_t& items);
+ // Activate a list of gestures
+ void activateGestures(LLViewerInventoryItem::item_array_t& items);
- // If you change a gesture, you need to build a new multigesture
- // and call this method.
- void replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id);
- void replaceGesture(const LLUUID& item_id, const LLUUID& asset_id);
+ // If you change a gesture, you need to build a new multigesture
+ // and call this method.
+ void replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id);
+ void replaceGesture(const LLUUID& item_id, const LLUUID& asset_id);
- // Load gesture into in-memory active form.
- // Can be called even if the inventory item isn't loaded yet.
- // inform_server TRUE will send message upstream to update database
- // user_gesture_active table, which isn't necessary on login.
- // deactivate_similar will cause other gestures with the same trigger phrase
- // or keybinding to be deactivated.
- void activateGestureWithAsset(const LLUUID& item_id, const LLUUID& asset_id, BOOL inform_server, BOOL deactivate_similar);
+ // Load gesture into in-memory active form.
+ // Can be called even if the inventory item isn't loaded yet.
+ // inform_server TRUE will send message upstream to update database
+ // user_gesture_active table, which isn't necessary on login.
+ // deactivate_similar will cause other gestures with the same trigger phrase
+ // or keybinding to be deactivated.
+ void activateGestureWithAsset(const LLUUID& item_id, const LLUUID& asset_id, BOOL inform_server, BOOL deactivate_similar);
- // Takes gesture out of active list and deletes it.
- void deactivateGesture(const LLUUID& item_id);
+ // Takes gesture out of active list and deletes it.
+ void deactivateGesture(const LLUUID& item_id);
- // Deactivates all gestures that match either this trigger phrase,
- // or this hot key.
- void deactivateSimilarGestures(LLMultiGesture* gesture, const LLUUID& in_item_id);
+ // Deactivates all gestures that match either this trigger phrase,
+ // or this hot key.
+ void deactivateSimilarGestures(LLMultiGesture* gesture, const LLUUID& in_item_id);
- BOOL isGestureActive(const LLUUID& item_id);
+ BOOL isGestureActive(const LLUUID& item_id);
- BOOL isGesturePlaying(const LLUUID& item_id);
+ BOOL isGesturePlaying(const LLUUID& item_id);
- BOOL isGesturePlaying(LLMultiGesture* gesture);
+ BOOL isGesturePlaying(LLMultiGesture* gesture);
- const item_map_t& getActiveGestures() const { return mActive; }
- // Force a gesture to be played, for example, if it is being
- // previewed.
- void playGesture(LLMultiGesture* gesture);
- void playGesture(const LLUUID& item_id);
+ const item_map_t& getActiveGestures() const { return mActive; }
+ // Force a gesture to be played, for example, if it is being
+ // previewed.
+ void playGesture(LLMultiGesture* gesture);
+ void playGesture(const LLUUID& item_id);
- // Stop all requested or playing anims for this gesture
- // Also remove from playing list
- void stopGesture(LLMultiGesture* gesture);
- void stopGesture(const LLUUID& item_id);
- /**
- * Add cb into callbackMap.
- * Note:
- * Manager will call cb after gesture will be loaded and will remove cb automatically.
- */
- void setGestureLoadedCallback(LLUUID inv_item_id, gesture_loaded_callback_t cb)
- {
- mCallbackMap[inv_item_id] = cb;
- }
- // Trigger the first gesture that matches this key.
- // Returns TRUE if it finds a gesture bound to that key.
- BOOL triggerGesture(KEY key, MASK mask);
+ // Stop all requested or playing anims for this gesture
+ // Also remove from playing list
+ void stopGesture(LLMultiGesture* gesture);
+ void stopGesture(const LLUUID& item_id);
+ /**
+ * Add cb into callbackMap.
+ * Note:
+ * Manager will call cb after gesture will be loaded and will remove cb automatically.
+ */
+ void setGestureLoadedCallback(LLUUID inv_item_id, gesture_loaded_callback_t cb)
+ {
+ mCallbackMap[inv_item_id] = cb;
+ }
+ // Trigger the first gesture that matches this key.
+ // Returns TRUE if it finds a gesture bound to that key.
+ BOOL triggerGesture(KEY key, MASK mask);
- // Trigger all gestures referenced as substrings in this string
- BOOL triggerAndReviseString(const std::string &str, std::string *revised_string = NULL);
+ // Trigger all gestures referenced as substrings in this string
+ BOOL triggerAndReviseString(const std::string &str, std::string *revised_string = NULL);
- // Does some gesture have this key bound?
- BOOL isKeyBound(KEY key, MASK mask);
+ // Does some gesture have this key bound?
+ BOOL isKeyBound(KEY key, MASK mask);
- S32 getPlayingCount() const;
+ S32 getPlayingCount() const;
- void addObserver(LLGestureManagerObserver* observer);
- void removeObserver(LLGestureManagerObserver* observer);
- void notifyObservers();
+ void addObserver(LLGestureManagerObserver* observer);
+ void removeObserver(LLGestureManagerObserver* observer);
+ void notifyObservers();
- // Overriding so we can update active gesture names and notify observers
- void changed(U32 mask) override;
+ // Overriding so we can update active gesture names and notify observers
+ void changed(U32 mask) override;
- BOOL matchPrefix(const std::string& in_str, std::string* out_str);
+ BOOL matchPrefix(const std::string& in_str, std::string* out_str);
- // Copy item ids into the vector
- void getItemIDs(uuid_vec_t* ids);
+ // Copy item ids into the vector
+ void getItemIDs(uuid_vec_t* ids);
protected:
- // Handle the processing of a single gesture
- void stepGesture(LLMultiGesture* gesture);
+ // Handle the processing of a single gesture
+ void stepGesture(LLMultiGesture* gesture);
- // Do a single step in a gesture
- void runStep(LLMultiGesture* gesture, LLGestureStep* step);
+ // Do a single step in a gesture
+ void runStep(LLMultiGesture* gesture, LLGestureStep* step);
- // LLInventoryCompletionObserver trigger
- void done() override;
+ // LLInventoryCompletionObserver trigger
+ void done() override;
- // Used by loadGesture
- static void onLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status);
+ // Used by loadGesture
+ static void onLoadComplete(const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status);
- // Used by playGesture to load an asset file
- // required to play a gesture step
- static void onAssetLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status);
+ // Used by playGesture to load an asset file
+ // required to play a gesture step
+ static void onAssetLoadComplete(const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status);
- // Checks whether all animation and sound assets
- // needed to play a gesture are loaded.
- static bool hasLoadingAssets(LLMultiGesture* gesture);
+ // Checks whether all animation and sound assets
+ // needed to play a gesture are loaded.
+ static bool hasLoadingAssets(LLMultiGesture* gesture);
private:
- // Active gestures.
- // NOTE: The gesture pointer CAN BE NULL. This means that
- // there is a gesture with that item_id, but the asset data
- // is still on its way down from the server.
- item_map_t mActive;
-
- S32 mLoadingCount;
- std::string mDeactivateSimilarNames;
-
- std::vector<LLGestureManagerObserver*> mObservers;
- callback_map_t mCallbackMap;
- std::vector<LLMultiGesture*> mPlaying;
- BOOL mValid;
-
- std::set<LLUUID> mLoadingAssets;
-
- // LLEventHost interface
- std::shared_ptr<LLGestureListener> mListener;
+ // Active gestures.
+ // NOTE: The gesture pointer CAN BE NULL. This means that
+ // there is a gesture with that item_id, but the asset data
+ // is still on its way down from the server.
+ item_map_t mActive;
+
+ S32 mLoadingCount;
+ std::string mDeactivateSimilarNames;
+
+ std::vector<LLGestureManagerObserver*> mObservers;
+ callback_map_t mCallbackMap;
+ std::vector<LLMultiGesture*> mPlaying;
+ BOOL mValid;
+
+ std::set<LLUUID> mLoadingAssets;
+
+ // LLEventHost interface
+ std::shared_ptr<LLGestureListener> mListener;
};
#endif
diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp
index 127055459d..abe44ae019 100644
--- a/indra/newview/llgiveinventory.cpp
+++ b/indra/newview/llgiveinventory.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,241 +56,241 @@ const S32 MAX_ITEMS = 42;
class LLGiveable : public LLInventoryCollectFunctor
{
public:
- LLGiveable() : mCountLosing(0) {}
- virtual ~LLGiveable() {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+ LLGiveable() : mCountLosing(0) {}
+ virtual ~LLGiveable() {}
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
- S32 countNoCopy() const { return mCountLosing; }
+ S32 countNoCopy() const { return mCountLosing; }
protected:
- S32 mCountLosing;
+ S32 mCountLosing;
};
bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- // All categories can be given.
- if (cat)
- return true;
-
- bool allowed = false;
- if (item)
- {
- allowed = itemTransferCommonlyAllowed(item);
- if (allowed &&
- !item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID()))
- {
- allowed = FALSE;
- }
- if (allowed &&
- !item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- ++mCountLosing;
- }
- }
- return allowed;
+ // All categories can be given.
+ if (cat)
+ return true;
+
+ bool allowed = false;
+ if (item)
+ {
+ allowed = itemTransferCommonlyAllowed(item);
+ if (allowed &&
+ !item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ gAgent.getID()))
+ {
+ allowed = FALSE;
+ }
+ if (allowed &&
+ !item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ ++mCountLosing;
+ }
+ }
+ return allowed;
}
class LLUncopyableItems : public LLInventoryCollectFunctor
{
public:
- LLUncopyableItems() {}
- virtual ~LLUncopyableItems() {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+ LLUncopyableItems() {}
+ virtual ~LLUncopyableItems() {}
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
};
bool LLUncopyableItems::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
+ LLInventoryItem* item)
{
- bool uncopyable = false;
- if (item)
- {
- if (itemTransferCommonlyAllowed(item) &&
- !item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- uncopyable = true;
- }
- }
- return uncopyable;
+ bool uncopyable = false;
+ if (item)
+ {
+ if (itemTransferCommonlyAllowed(item) &&
+ !item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ uncopyable = true;
+ }
+ }
+ return uncopyable;
}
// static
bool LLGiveInventory::isInventoryGiveAcceptable(const LLInventoryItem* item)
{
- if (!item) return false;
-
- if (!isAgentAvatarValid()) return false;
-
- if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID))
- {
- return false;
- }
-
- bool acceptable = true;
- switch(item->getType())
- {
- case LLAssetType::AT_OBJECT:
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_CLOTHING:
- {
- if (get_is_item_worn(item->getUUID()))
- {
- acceptable = false;
- }
- break;
- }
- break;
- default:
- break;
- }
- return acceptable;
+ if (!item) return false;
+
+ if (!isAgentAvatarValid()) return false;
+
+ if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID))
+ {
+ return false;
+ }
+
+ bool acceptable = true;
+ switch(item->getType())
+ {
+ case LLAssetType::AT_OBJECT:
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ {
+ if (get_is_item_worn(item->getUUID()))
+ {
+ acceptable = false;
+ }
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return acceptable;
}
// static
bool LLGiveInventory::isInventoryGroupGiveAcceptable(const LLInventoryItem* item)
{
- if (!item) return false;
-
- if (!isAgentAvatarValid()) return false;
-
- // These permissions are double checked in the simulator in
- // LLGroupNoticeInventoryItemFetch::result().
- if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID))
- {
- return false;
- }
- if (!item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- return false;
- }
-
-
- bool acceptable = true;
- switch(item->getType())
- {
- case LLAssetType::AT_OBJECT:
- if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
- {
- acceptable = false;
- }
- break;
- default:
- break;
- }
- return acceptable;
+ if (!item) return false;
+
+ if (!isAgentAvatarValid()) return false;
+
+ // These permissions are double checked in the simulator in
+ // LLGroupNoticeInventoryItemFetch::result().
+ if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID))
+ {
+ return false;
+ }
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ return false;
+ }
+
+
+ bool acceptable = true;
+ switch(item->getType())
+ {
+ case LLAssetType::AT_OBJECT:
+ if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
+ {
+ acceptable = false;
+ }
+ break;
+ default:
+ break;
+ }
+ return acceptable;
}
// static
bool LLGiveInventory::doGiveInventoryItem(const LLUUID& to_agent,
- const LLInventoryItem* item,
- const LLUUID& im_session_id/* = LLUUID::null*/)
+ const LLInventoryItem* item,
+ const LLUUID& im_session_id/* = LLUUID::null*/)
{
- bool res = true;
- LL_INFOS() << "LLGiveInventory::giveInventory()" << LL_ENDL;
- if (!isInventoryGiveAcceptable(item))
- {
- return false;
- }
- if (item->getPermissions().allowCopyBy(gAgentID))
- {
- // just give it away.
- LLGiveInventory::commitGiveInventoryItem(to_agent, item, im_session_id);
- }
- else
- {
- // ask if the agent is sure.
- LLSD substitutions;
- substitutions["ITEMS"] = item->getName();
- LLSD payload;
- payload["agent_id"] = to_agent;
- LLSD items = LLSD::emptyArray();
- items.append(item->getUUID());
- payload["items"] = items;
- LLNotificationsUtil::add("CannotCopyWarning", substitutions, payload,
- &LLGiveInventory::handleCopyProtectedItem);
- res = false;
- }
-
- return res;
+ bool res = true;
+ LL_INFOS() << "LLGiveInventory::giveInventory()" << LL_ENDL;
+ if (!isInventoryGiveAcceptable(item))
+ {
+ return false;
+ }
+ if (item->getPermissions().allowCopyBy(gAgentID))
+ {
+ // just give it away.
+ LLGiveInventory::commitGiveInventoryItem(to_agent, item, im_session_id);
+ }
+ else
+ {
+ // ask if the agent is sure.
+ LLSD substitutions;
+ substitutions["ITEMS"] = item->getName();
+ LLSD payload;
+ payload["agent_id"] = to_agent;
+ LLSD items = LLSD::emptyArray();
+ items.append(item->getUUID());
+ payload["items"] = items;
+ LLNotificationsUtil::add("CannotCopyWarning", substitutions, payload,
+ &LLGiveInventory::handleCopyProtectedItem);
+ res = false;
+ }
+
+ return res;
}
bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent,
- const LLInventoryCategory* cat,
- const LLUUID& im_session_id,
- const std::string& notification_name)
+ const LLInventoryCategory* cat,
+ const LLUUID& im_session_id,
+ const std::string& notification_name)
{
- if (!cat)
- {
- return false;
- }
- LL_INFOS() << "LLGiveInventory::giveInventoryCategory() - "
- << cat->getUUID() << LL_ENDL;
-
- if (!isAgentAvatarValid())
- {
- return false;
- }
-
- bool give_successful = true;
- // Test out how many items are being given.
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLGiveable giveable;
- gInventory.collectDescendentsIf (cat->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- giveable);
- S32 count = cats.size();
- bool complete = true;
- for(S32 i = 0; i < count; ++i)
- {
- if (!gInventory.isCategoryComplete(cats.at(i)->getUUID()))
- {
- complete = false;
- break;
- }
- }
- if (!complete)
- {
- LLNotificationsUtil::add("IncompleteInventory");
- give_successful = false;
- }
- count = items.size() + cats.size();
- if (count > MAX_ITEMS)
- {
- LLNotificationsUtil::add("TooManyItems");
- give_successful = false;
- }
- else if (count == 0)
- {
- LLNotificationsUtil::add("NoItems");
- give_successful = false;
- }
- else if (give_successful)
- {
- if (0 == giveable.countNoCopy())
- {
- give_successful = LLGiveInventory::commitGiveInventoryCategory(to_agent, cat, im_session_id);
- }
- else
- {
- LLSD args;
- args["COUNT"] = llformat("%d",giveable.countNoCopy());
- LLSD payload;
- payload["agent_id"] = to_agent;
- payload["folder_id"] = cat->getUUID();
- if (!notification_name.empty())
- {
- payload["success_notification"] = notification_name;
- }
- LLNotificationsUtil::add("CannotCopyCountItems", args, payload, &LLGiveInventory::handleCopyProtectedCategory);
- give_successful = false;
- }
- }
-
- return give_successful;
+ if (!cat)
+ {
+ return false;
+ }
+ LL_INFOS() << "LLGiveInventory::giveInventoryCategory() - "
+ << cat->getUUID() << LL_ENDL;
+
+ if (!isAgentAvatarValid())
+ {
+ return false;
+ }
+
+ bool give_successful = true;
+ // Test out how many items are being given.
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLGiveable giveable;
+ gInventory.collectDescendentsIf (cat->getUUID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ giveable);
+ S32 count = cats.size();
+ bool complete = true;
+ for(S32 i = 0; i < count; ++i)
+ {
+ if (!gInventory.isCategoryComplete(cats.at(i)->getUUID()))
+ {
+ complete = false;
+ break;
+ }
+ }
+ if (!complete)
+ {
+ LLNotificationsUtil::add("IncompleteInventory");
+ give_successful = false;
+ }
+ count = items.size() + cats.size();
+ if (count > MAX_ITEMS)
+ {
+ LLNotificationsUtil::add("TooManyItems");
+ give_successful = false;
+ }
+ else if (count == 0)
+ {
+ LLNotificationsUtil::add("NoItems");
+ give_successful = false;
+ }
+ else if (give_successful)
+ {
+ if (0 == giveable.countNoCopy())
+ {
+ give_successful = LLGiveInventory::commitGiveInventoryCategory(to_agent, cat, im_session_id);
+ }
+ else
+ {
+ LLSD args;
+ args["COUNT"] = llformat("%d",giveable.countNoCopy());
+ LLSD payload;
+ payload["agent_id"] = to_agent;
+ payload["folder_id"] = cat->getUUID();
+ if (!notification_name.empty())
+ {
+ payload["success_notification"] = notification_name;
+ }
+ LLNotificationsUtil::add("CannotCopyCountItems", args, payload, &LLGiveInventory::handleCopyProtectedCategory);
+ give_successful = false;
+ }
+ }
+
+ return give_successful;
}
//////////////////////////////////////////////////////////////////////////
@@ -300,286 +300,286 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent,
//static
void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im_session_id, const std::string& item_name, bool is_folder)
{
- // compute id of possible IM session with agent that has "to_agent" id
- LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, to_agent);
- // If this item was given by drag-and-drop into an IM panel, log this action in the IM panel chat.
- LLSD args;
- args["user_id"] = to_agent;
- args["ITEM_NAME"] = item_name;
- std::string message_name = is_folder ? "inventory_folder_offered" : "inventory_item_offered";
- if (im_session_id.notNull())
- {
- gIMMgr->addSystemMessage(im_session_id, message_name, args);
- }
- // If this item was given by drag-and-drop on avatar while IM panel was open, log this action in the IM panel chat.
- else if (LLIMModel::getInstance()->findIMSession(session_id))
- {
- gIMMgr->addSystemMessage(session_id, message_name, args);
- }
- // If this item was given by drag-and-drop on avatar while IM panel wasn't open, log this action to IM history.
- else
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(to_agent, &av_name))
- {
- // Build a new format username or firstname_lastname for legacy names
- // to use it for a history log filename.
- std::string full_name = LLCacheName::buildUsername(av_name.getUserName());
- LLUIString message = LLTrans::getString(message_name + "-im");
- message.setArgs(args);
- LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, message.getString());
- }
- }
+ // compute id of possible IM session with agent that has "to_agent" id
+ LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, to_agent);
+ // If this item was given by drag-and-drop into an IM panel, log this action in the IM panel chat.
+ LLSD args;
+ args["user_id"] = to_agent;
+ args["ITEM_NAME"] = item_name;
+ std::string message_name = is_folder ? "inventory_folder_offered" : "inventory_item_offered";
+ if (im_session_id.notNull())
+ {
+ gIMMgr->addSystemMessage(im_session_id, message_name, args);
+ }
+ // If this item was given by drag-and-drop on avatar while IM panel was open, log this action in the IM panel chat.
+ else if (LLIMModel::getInstance()->findIMSession(session_id))
+ {
+ gIMMgr->addSystemMessage(session_id, message_name, args);
+ }
+ // If this item was given by drag-and-drop on avatar while IM panel wasn't open, log this action to IM history.
+ else
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(to_agent, &av_name))
+ {
+ // Build a new format username or firstname_lastname for legacy names
+ // to use it for a history log filename.
+ std::string full_name = LLCacheName::buildUsername(av_name.getUserName());
+ LLUIString message = LLTrans::getString(message_name + "-im");
+ message.setArgs(args);
+ LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, message.getString());
+ }
+ }
}
// static
bool LLGiveInventory::handleCopyProtectedItem(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLSD itmes = notification["payload"]["items"];
- LLInventoryItem* item = NULL;
- bool give_successful = true;
- switch(option)
- {
- case 0: // "Yes"
- for (LLSD::array_iterator it = itmes.beginArray(); it != itmes.endArray(); it++)
- {
- item = gInventory.getItem((*it).asUUID());
- if (item)
- {
- LLGiveInventory::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(),
- item);
- // delete it for now - it will be deleted on the server
- // quickly enough.
- gInventory.deleteObject(item->getUUID());
- gInventory.notifyObservers();
- }
- else
- {
- LLNotificationsUtil::add("CannotGiveItem");
- give_successful = false;
- }
- }
- if (give_successful && notification["payload"]["success_notification"].isDefined())
- {
- LLNotificationsUtil::add(notification["payload"]["success_notification"].asString());
- }
- break;
-
- default: // no, cancel, whatever, who cares, not yes.
- LLNotificationsUtil::add("TransactionCancelled");
- give_successful = false;
- break;
- }
- return give_successful;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLSD itmes = notification["payload"]["items"];
+ LLInventoryItem* item = NULL;
+ bool give_successful = true;
+ switch(option)
+ {
+ case 0: // "Yes"
+ for (LLSD::array_iterator it = itmes.beginArray(); it != itmes.endArray(); it++)
+ {
+ item = gInventory.getItem((*it).asUUID());
+ if (item)
+ {
+ LLGiveInventory::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(),
+ item);
+ // delete it for now - it will be deleted on the server
+ // quickly enough.
+ gInventory.deleteObject(item->getUUID());
+ gInventory.notifyObservers();
+ }
+ else
+ {
+ LLNotificationsUtil::add("CannotGiveItem");
+ give_successful = false;
+ }
+ }
+ if (give_successful && notification["payload"]["success_notification"].isDefined())
+ {
+ LLNotificationsUtil::add(notification["payload"]["success_notification"].asString());
+ }
+ break;
+
+ default: // no, cancel, whatever, who cares, not yes.
+ LLNotificationsUtil::add("TransactionCancelled");
+ give_successful = false;
+ break;
+ }
+ return give_successful;
}
// static
void LLGiveInventory::commitGiveInventoryItem(const LLUUID& to_agent,
- const LLInventoryItem* item,
- const LLUUID& im_session_id)
+ const LLInventoryItem* item,
+ const LLUUID& im_session_id)
{
- if (!item) return;
- std::string name;
- std::string item_name = item->getName();
- LLAgentUI::buildFullname(name);
- LLUUID transaction_id;
- transaction_id.generate();
- const S32 BUCKET_SIZE = sizeof(U8) + UUID_BYTES;
- U8 bucket[BUCKET_SIZE];
- bucket[0] = (U8)item->getType();
- memcpy(&bucket[1], &(item->getUUID().mData), UUID_BYTES); /* Flawfinder: ignore */
- pack_instant_message(
- gMessageSystem,
- gAgentID,
- FALSE,
- gAgentSessionID,
- to_agent,
- name,
- item_name,
- IM_ONLINE,
- IM_INVENTORY_OFFERED,
- transaction_id,
- 0,
- LLUUID::null,
- gAgent.getPositionAgent(),
- NO_TIMESTAMP,
- bucket,
- BUCKET_SIZE);
- gAgent.sendReliableMessage();
-
- // VEFFECT: giveInventory
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgentAvatarp);
- effectp->setTargetObject(gObjectList.findObject(to_agent));
- effectp->setDuration(LL_HUD_DUR_SHORT);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- gFloaterTools->dirty();
-
- LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY);
-
- logInventoryOffer(to_agent, im_session_id, item_name);
-
- // add buddy to recent people list
- LLRecentPeople::instance().add(to_agent);
+ if (!item) return;
+ std::string name;
+ std::string item_name = item->getName();
+ LLAgentUI::buildFullname(name);
+ LLUUID transaction_id;
+ transaction_id.generate();
+ const S32 BUCKET_SIZE = sizeof(U8) + UUID_BYTES;
+ U8 bucket[BUCKET_SIZE];
+ bucket[0] = (U8)item->getType();
+ memcpy(&bucket[1], &(item->getUUID().mData), UUID_BYTES); /* Flawfinder: ignore */
+ pack_instant_message(
+ gMessageSystem,
+ gAgentID,
+ FALSE,
+ gAgentSessionID,
+ to_agent,
+ name,
+ item_name,
+ IM_ONLINE,
+ IM_INVENTORY_OFFERED,
+ transaction_id,
+ 0,
+ LLUUID::null,
+ gAgent.getPositionAgent(),
+ NO_TIMESTAMP,
+ bucket,
+ BUCKET_SIZE);
+ gAgent.sendReliableMessage();
+
+ // VEFFECT: giveInventory
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ effectp->setSourceObject(gAgentAvatarp);
+ effectp->setTargetObject(gObjectList.findObject(to_agent));
+ effectp->setDuration(LL_HUD_DUR_SHORT);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ gFloaterTools->dirty();
+
+ LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY);
+
+ logInventoryOffer(to_agent, im_session_id, item_name);
+
+ // add buddy to recent people list
+ LLRecentPeople::instance().add(to_agent);
}
// static
bool LLGiveInventory::handleCopyProtectedCategory(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLInventoryCategory* cat = NULL;
- bool give_successful = true;
- switch(option)
- {
- case 0: // "Yes"
- cat = gInventory.getCategory(notification["payload"]["folder_id"].asUUID());
- if (cat)
- {
- give_successful = LLGiveInventory::commitGiveInventoryCategory(notification["payload"]["agent_id"].asUUID(),
- cat);
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLUncopyableItems remove;
- gInventory.collectDescendentsIf (cat->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- remove);
- S32 count = items.size();
- for(S32 i = 0; i < count; ++i)
- {
- gInventory.deleteObject(items.at(i)->getUUID());
- }
- gInventory.notifyObservers();
-
- if (give_successful && notification["payload"]["success_notification"].isDefined())
- {
- LLNotificationsUtil::add(notification["payload"]["success_notification"].asString());
- }
- }
- else
- {
- LLNotificationsUtil::add("CannotGiveCategory");
- give_successful = false;
- }
- break;
-
- default: // no, cancel, whatever, who cares, not yes.
- LLNotificationsUtil::add("TransactionCancelled");
- give_successful = false;
- break;
- }
- return give_successful;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLInventoryCategory* cat = NULL;
+ bool give_successful = true;
+ switch(option)
+ {
+ case 0: // "Yes"
+ cat = gInventory.getCategory(notification["payload"]["folder_id"].asUUID());
+ if (cat)
+ {
+ give_successful = LLGiveInventory::commitGiveInventoryCategory(notification["payload"]["agent_id"].asUUID(),
+ cat);
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLUncopyableItems remove;
+ gInventory.collectDescendentsIf (cat->getUUID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ remove);
+ S32 count = items.size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ gInventory.deleteObject(items.at(i)->getUUID());
+ }
+ gInventory.notifyObservers();
+
+ if (give_successful && notification["payload"]["success_notification"].isDefined())
+ {
+ LLNotificationsUtil::add(notification["payload"]["success_notification"].asString());
+ }
+ }
+ else
+ {
+ LLNotificationsUtil::add("CannotGiveCategory");
+ give_successful = false;
+ }
+ break;
+
+ default: // no, cancel, whatever, who cares, not yes.
+ LLNotificationsUtil::add("TransactionCancelled");
+ give_successful = false;
+ break;
+ }
+ return give_successful;
}
// static
bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent,
- const LLInventoryCategory* cat,
- const LLUUID& im_session_id)
+ const LLInventoryCategory* cat,
+ const LLUUID& im_session_id)
{
- if (!cat)
- {
- return false;
- }
- LL_INFOS() << "LLGiveInventory::commitGiveInventoryCategory() - "
- << cat->getUUID() << LL_ENDL;
-
- // add buddy to recent people list
- LLRecentPeople::instance().add(to_agent);
-
- // Test out how many items are being given.
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLGiveable giveable;
- gInventory.collectDescendentsIf (cat->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- giveable);
- std::string cat_name = cat->getName();
- bool give_successful = true;
- // MAX ITEMS is based on (sizeof(uuid)+2) * count must be <
- // MTUBYTES or 18 * count < 1200 => count < 1200/18 =>
- // 66. I've cut it down a bit from there to give some pad.
- S32 count = items.size() + cats.size();
- if (count > MAX_ITEMS)
- {
- LLNotificationsUtil::add("TooManyItems");
- give_successful = false;
- }
- else if (count == 0)
- {
- LLNotificationsUtil::add("NoItems");
- give_successful = false;
- }
- else
- {
- std::string name;
- LLAgentUI::buildFullname(name);
- LLUUID transaction_id;
- transaction_id.generate();
- S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (count + 1);
- U8* bucket = new U8[bucket_size];
- U8* pos = bucket;
- U8 type = (U8)cat->getType();
- memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */
- pos += sizeof(U8);
- memcpy(pos, &(cat->getUUID()), UUID_BYTES); /* Flawfinder: ignore */
- pos += UUID_BYTES;
- S32 i;
- count = cats.size();
- for(i = 0; i < count; ++i)
- {
- memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */
- pos += sizeof(U8);
- memcpy(pos, &(cats.at(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */
- pos += UUID_BYTES;
- }
- count = items.size();
- for(i = 0; i < count; ++i)
- {
- type = (U8)items.at(i)->getType();
- memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */
- pos += sizeof(U8);
- memcpy(pos, &(items.at(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */
- pos += UUID_BYTES;
- }
- pack_instant_message(
- gMessageSystem,
- gAgent.getID(),
- FALSE,
- gAgent.getSessionID(),
- to_agent,
- name,
- cat_name,
- IM_ONLINE,
- IM_INVENTORY_OFFERED,
- transaction_id,
- 0,
- LLUUID::null,
- gAgent.getPositionAgent(),
- NO_TIMESTAMP,
- bucket,
- bucket_size);
- gAgent.sendReliableMessage();
- delete[] bucket;
-
- // VEFFECT: giveInventoryCategory
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgentAvatarp);
- effectp->setTargetObject(gObjectList.findObject(to_agent));
- effectp->setDuration(LL_HUD_DUR_SHORT);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- gFloaterTools->dirty();
-
- LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY);
-
- logInventoryOffer(to_agent, im_session_id, cat_name, true);
- }
-
- return give_successful;
+ if (!cat)
+ {
+ return false;
+ }
+ LL_INFOS() << "LLGiveInventory::commitGiveInventoryCategory() - "
+ << cat->getUUID() << LL_ENDL;
+
+ // add buddy to recent people list
+ LLRecentPeople::instance().add(to_agent);
+
+ // Test out how many items are being given.
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLGiveable giveable;
+ gInventory.collectDescendentsIf (cat->getUUID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ giveable);
+ std::string cat_name = cat->getName();
+ bool give_successful = true;
+ // MAX ITEMS is based on (sizeof(uuid)+2) * count must be <
+ // MTUBYTES or 18 * count < 1200 => count < 1200/18 =>
+ // 66. I've cut it down a bit from there to give some pad.
+ S32 count = items.size() + cats.size();
+ if (count > MAX_ITEMS)
+ {
+ LLNotificationsUtil::add("TooManyItems");
+ give_successful = false;
+ }
+ else if (count == 0)
+ {
+ LLNotificationsUtil::add("NoItems");
+ give_successful = false;
+ }
+ else
+ {
+ std::string name;
+ LLAgentUI::buildFullname(name);
+ LLUUID transaction_id;
+ transaction_id.generate();
+ S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (count + 1);
+ U8* bucket = new U8[bucket_size];
+ U8* pos = bucket;
+ U8 type = (U8)cat->getType();
+ memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */
+ pos += sizeof(U8);
+ memcpy(pos, &(cat->getUUID()), UUID_BYTES); /* Flawfinder: ignore */
+ pos += UUID_BYTES;
+ S32 i;
+ count = cats.size();
+ for(i = 0; i < count; ++i)
+ {
+ memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */
+ pos += sizeof(U8);
+ memcpy(pos, &(cats.at(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */
+ pos += UUID_BYTES;
+ }
+ count = items.size();
+ for(i = 0; i < count; ++i)
+ {
+ type = (U8)items.at(i)->getType();
+ memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */
+ pos += sizeof(U8);
+ memcpy(pos, &(items.at(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */
+ pos += UUID_BYTES;
+ }
+ pack_instant_message(
+ gMessageSystem,
+ gAgent.getID(),
+ FALSE,
+ gAgent.getSessionID(),
+ to_agent,
+ name,
+ cat_name,
+ IM_ONLINE,
+ IM_INVENTORY_OFFERED,
+ transaction_id,
+ 0,
+ LLUUID::null,
+ gAgent.getPositionAgent(),
+ NO_TIMESTAMP,
+ bucket,
+ bucket_size);
+ gAgent.sendReliableMessage();
+ delete[] bucket;
+
+ // VEFFECT: giveInventoryCategory
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ effectp->setSourceObject(gAgentAvatarp);
+ effectp->setTargetObject(gObjectList.findObject(to_agent));
+ effectp->setDuration(LL_HUD_DUR_SHORT);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ gFloaterTools->dirty();
+
+ LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY);
+
+ logInventoryOffer(to_agent, im_session_id, cat_name, true);
+ }
+
+ return give_successful;
}
// EOF
diff --git a/indra/newview/llgiveinventory.h b/indra/newview/llgiveinventory.h
index 20e6df76e5..23b400cacd 100644
--- a/indra/newview/llgiveinventory.h
+++ b/indra/newview/llgiveinventory.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,59 +38,59 @@ class LLInventoryCategory;
class LLGiveInventory
{
public:
- /**
- * Checks if inventory item you are attempting to transfer to a resident can be given.
- *
- * @return true if you can give, otherwise false.
- */
- static bool isInventoryGiveAcceptable(const LLInventoryItem* item);
+ /**
+ * Checks if inventory item you are attempting to transfer to a resident can be given.
+ *
+ * @return true if you can give, otherwise false.
+ */
+ static bool isInventoryGiveAcceptable(const LLInventoryItem* item);
- /**
- * Checks if inventory item you are attempting to transfer to a group can be given.
- *
- * @return true if you can give, otherwise false.
- */
- static bool isInventoryGroupGiveAcceptable(const LLInventoryItem* item);
+ /**
+ * Checks if inventory item you are attempting to transfer to a group can be given.
+ *
+ * @return true if you can give, otherwise false.
+ */
+ static bool isInventoryGroupGiveAcceptable(const LLInventoryItem* item);
- /**
- * Gives passed inventory item to specified avatar in specified session.
- */
- static bool doGiveInventoryItem(const LLUUID& to_agent,
- const LLInventoryItem* item,
- const LLUUID& im_session_id = LLUUID::null);
+ /**
+ * Gives passed inventory item to specified avatar in specified session.
+ */
+ static bool doGiveInventoryItem(const LLUUID& to_agent,
+ const LLInventoryItem* item,
+ const LLUUID& im_session_id = LLUUID::null);
- /**
- * Gives passed inventory category to specified avatar in specified session.
- */
- static bool doGiveInventoryCategory(const LLUUID& to_agent,
- const LLInventoryCategory* item,
- const LLUUID &session_id = LLUUID::null,
- const std::string& notification = std::string());
+ /**
+ * Gives passed inventory category to specified avatar in specified session.
+ */
+ static bool doGiveInventoryCategory(const LLUUID& to_agent,
+ const LLInventoryCategory* item,
+ const LLUUID &session_id = LLUUID::null,
+ const std::string& notification = std::string());
- // give inventory item functionality
- static bool handleCopyProtectedItem(const LLSD& notification, const LLSD& response);
+ // give inventory item functionality
+ static bool handleCopyProtectedItem(const LLSD& notification, const LLSD& response);
private:
- // this class is not intended to be instantiated.
- LLGiveInventory();
+ // this class is not intended to be instantiated.
+ LLGiveInventory();
- /**
- * logs "Inventory item offered" to IM
- */
- static void logInventoryOffer(const LLUUID& to_agent,
- const LLUUID &im_session_id = LLUUID::null,
- const std::string& item_name = std::string(),
- bool is_folder = false);
+ /**
+ * logs "Inventory item offered" to IM
+ */
+ static void logInventoryOffer(const LLUUID& to_agent,
+ const LLUUID &im_session_id = LLUUID::null,
+ const std::string& item_name = std::string(),
+ bool is_folder = false);
- static void commitGiveInventoryItem(const LLUUID& to_agent,
- const LLInventoryItem* item,
- const LLUUID &im_session_id = LLUUID::null);
+ static void commitGiveInventoryItem(const LLUUID& to_agent,
+ const LLInventoryItem* item,
+ const LLUUID &im_session_id = LLUUID::null);
- // give inventory category functionality
- static bool handleCopyProtectedCategory(const LLSD& notification, const LLSD& response);
- static bool commitGiveInventoryCategory(const LLUUID& to_agent,
- const LLInventoryCategory* cat,
- const LLUUID &im_session_id = LLUUID::null);
+ // give inventory category functionality
+ static bool handleCopyProtectedCategory(const LLSD& notification, const LLSD& response);
+ static bool commitGiveInventoryCategory(const LLUUID& to_agent,
+ const LLInventoryCategory* cat,
+ const LLUUID &im_session_id = LLUUID::null);
};
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 1b22b903fc..a688689013 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -1,31 +1,31 @@
-/**
+/**
* @file llglsandbox.cpp
* @brief GL functionality access
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-/**
- * Contains ALL methods which directly access GL functionality
+/**
+ * Contains ALL methods which directly access GL functionality
* except for core rendering engine functionality.
*/
@@ -73,381 +73,381 @@ const F32 PARCEL_POST_HEIGHT = 0.666f;
// Returns true if you got at least one object
void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
{
- LLVector3 av_pos = gAgent.getPositionAgent();
- F32 select_dist_squared = gSavedSettings.getF32("MaxSelectDistance");
- select_dist_squared = select_dist_squared * select_dist_squared;
-
- BOOL deselect = (mask == MASK_CONTROL);
- S32 left = llmin(x, mDragStartX);
- S32 right = llmax(x, mDragStartX);
- S32 top = llmax(y, mDragStartY);
- S32 bottom =llmin(y, mDragStartY);
-
- left = ll_round((F32) left * LLUI::getScaleFactor().mV[VX]);
- right = ll_round((F32) right * LLUI::getScaleFactor().mV[VX]);
- top = ll_round((F32) top * LLUI::getScaleFactor().mV[VY]);
- bottom = ll_round((F32) bottom * LLUI::getScaleFactor().mV[VY]);
-
- F32 old_far_plane = LLViewerCamera::getInstance()->getFar();
- F32 old_near_plane = LLViewerCamera::getInstance()->getNear();
-
- S32 width = right - left + 1;
- S32 height = top - bottom + 1;
-
- BOOL grow_selection = FALSE;
- BOOL shrink_selection = FALSE;
-
- if (height > mDragLastHeight || width > mDragLastWidth)
- {
- grow_selection = TRUE;
- }
- if (height < mDragLastHeight || width < mDragLastWidth)
- {
- shrink_selection = TRUE;
- }
-
- if (!grow_selection && !shrink_selection)
- {
- // nothing to do
- return;
- }
-
- mDragLastHeight = height;
- mDragLastWidth = width;
-
- S32 center_x = (left + right) / 2;
- S32 center_y = (top + bottom) / 2;
-
- // save drawing mode
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
-
- BOOL limit_select_distance = gSavedSettings.getBOOL("LimitSelectDistance");
- if (limit_select_distance)
- {
- // ...select distance from control
- LLVector3 relative_av_pos = av_pos;
- relative_av_pos -= LLViewerCamera::getInstance()->getOrigin();
-
- F32 new_far = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() + gSavedSettings.getF32("MaxSelectDistance");
- F32 new_near = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() - gSavedSettings.getF32("MaxSelectDistance");
-
- new_near = llmax(new_near, 0.1f);
-
- LLViewerCamera::getInstance()->setFar(new_far);
- LLViewerCamera::getInstance()->setNear(new_near);
- }
- LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION,
- center_x-width/2, center_y-height/2, width, height,
- limit_select_distance);
-
- if (shrink_selection)
- {
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* vobjp)
- {
- LLDrawable* drawable = vobjp->mDrawable;
- if (!drawable || vobjp->getPCode() != LL_PCODE_VOLUME || vobjp->isAttachment())
- {
- return true;
- }
- S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
- switch (result)
- {
- case 0:
- LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
- break;
- case 1:
- // check vertices
- if (!LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
- {
- LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
- }
- break;
- default:
- break;
- }
- return true;
- }
- } func;
- LLSelectMgr::getInstance()->getHighlightedObjects()->applyToObjects(&func);
- }
-
- if (grow_selection)
- {
- std::vector<LLDrawable*> potentials;
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- part->cull(*LLViewerCamera::getInstance(), &potentials, TRUE);
- }
- }
- }
-
- for (std::vector<LLDrawable*>::iterator iter = potentials.begin();
- iter != potentials.end(); iter++)
- {
- LLDrawable* drawable = *iter;
- LLViewerObject* vobjp = drawable->getVObj();
-
- if (!drawable || !vobjp ||
- vobjp->getPCode() != LL_PCODE_VOLUME ||
- vobjp->isAttachment() ||
- (deselect && !vobjp->isSelected()))
- {
- continue;
- }
-
- if (limit_select_distance && dist_vec_squared(drawable->getWorldPosition(), av_pos) > select_dist_squared)
- {
- continue;
- }
-
- S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
- if (result)
- {
- switch (result)
- {
- case 1:
- // check vertices
- if (LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
- {
- LLSelectMgr::getInstance()->highlightObjectOnly(vobjp);
- }
- break;
- case 2:
- LLSelectMgr::getInstance()->highlightObjectOnly(vobjp);
- break;
- default:
- break;
- }
- }
- }
- }
-
- // restore drawing mode
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- // restore camera
- LLViewerCamera::getInstance()->setFar(old_far_plane);
- LLViewerCamera::getInstance()->setNear(old_near_plane);
- gViewerWindow->setup3DRender();
+ LLVector3 av_pos = gAgent.getPositionAgent();
+ F32 select_dist_squared = gSavedSettings.getF32("MaxSelectDistance");
+ select_dist_squared = select_dist_squared * select_dist_squared;
+
+ BOOL deselect = (mask == MASK_CONTROL);
+ S32 left = llmin(x, mDragStartX);
+ S32 right = llmax(x, mDragStartX);
+ S32 top = llmax(y, mDragStartY);
+ S32 bottom =llmin(y, mDragStartY);
+
+ left = ll_round((F32) left * LLUI::getScaleFactor().mV[VX]);
+ right = ll_round((F32) right * LLUI::getScaleFactor().mV[VX]);
+ top = ll_round((F32) top * LLUI::getScaleFactor().mV[VY]);
+ bottom = ll_round((F32) bottom * LLUI::getScaleFactor().mV[VY]);
+
+ F32 old_far_plane = LLViewerCamera::getInstance()->getFar();
+ F32 old_near_plane = LLViewerCamera::getInstance()->getNear();
+
+ S32 width = right - left + 1;
+ S32 height = top - bottom + 1;
+
+ BOOL grow_selection = FALSE;
+ BOOL shrink_selection = FALSE;
+
+ if (height > mDragLastHeight || width > mDragLastWidth)
+ {
+ grow_selection = TRUE;
+ }
+ if (height < mDragLastHeight || width < mDragLastWidth)
+ {
+ shrink_selection = TRUE;
+ }
+
+ if (!grow_selection && !shrink_selection)
+ {
+ // nothing to do
+ return;
+ }
+
+ mDragLastHeight = height;
+ mDragLastWidth = width;
+
+ S32 center_x = (left + right) / 2;
+ S32 center_y = (top + bottom) / 2;
+
+ // save drawing mode
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+
+ BOOL limit_select_distance = gSavedSettings.getBOOL("LimitSelectDistance");
+ if (limit_select_distance)
+ {
+ // ...select distance from control
+ LLVector3 relative_av_pos = av_pos;
+ relative_av_pos -= LLViewerCamera::getInstance()->getOrigin();
+
+ F32 new_far = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() + gSavedSettings.getF32("MaxSelectDistance");
+ F32 new_near = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() - gSavedSettings.getF32("MaxSelectDistance");
+
+ new_near = llmax(new_near, 0.1f);
+
+ LLViewerCamera::getInstance()->setFar(new_far);
+ LLViewerCamera::getInstance()->setNear(new_near);
+ }
+ LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION,
+ center_x-width/2, center_y-height/2, width, height,
+ limit_select_distance);
+
+ if (shrink_selection)
+ {
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* vobjp)
+ {
+ LLDrawable* drawable = vobjp->mDrawable;
+ if (!drawable || vobjp->getPCode() != LL_PCODE_VOLUME || vobjp->isAttachment())
+ {
+ return true;
+ }
+ S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
+ switch (result)
+ {
+ case 0:
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
+ break;
+ case 1:
+ // check vertices
+ if (!LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
+ {
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
+ }
+ break;
+ default:
+ break;
+ }
+ return true;
+ }
+ } func;
+ LLSelectMgr::getInstance()->getHighlightedObjects()->applyToObjects(&func);
+ }
+
+ if (grow_selection)
+ {
+ std::vector<LLDrawable*> potentials;
+
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
+ {
+ part->cull(*LLViewerCamera::getInstance(), &potentials, TRUE);
+ }
+ }
+ }
+
+ for (std::vector<LLDrawable*>::iterator iter = potentials.begin();
+ iter != potentials.end(); iter++)
+ {
+ LLDrawable* drawable = *iter;
+ LLViewerObject* vobjp = drawable->getVObj();
+
+ if (!drawable || !vobjp ||
+ vobjp->getPCode() != LL_PCODE_VOLUME ||
+ vobjp->isAttachment() ||
+ (deselect && !vobjp->isSelected()))
+ {
+ continue;
+ }
+
+ if (limit_select_distance && dist_vec_squared(drawable->getWorldPosition(), av_pos) > select_dist_squared)
+ {
+ continue;
+ }
+
+ S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
+ if (result)
+ {
+ switch (result)
+ {
+ case 1:
+ // check vertices
+ if (LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
+ {
+ LLSelectMgr::getInstance()->highlightObjectOnly(vobjp);
+ }
+ break;
+ case 2:
+ LLSelectMgr::getInstance()->highlightObjectOnly(vobjp);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ // restore drawing mode
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ // restore camera
+ LLViewerCamera::getInstance()->setFar(old_far_plane);
+ LLViewerCamera::getInstance()->setNear(old_near_plane);
+ gViewerWindow->setup3DRender();
}
-const F32 WIND_RELATIVE_ALTITUDE = 25.f;
+const F32 WIND_RELATIVE_ALTITUDE = 25.f;
void LLWind::renderVectors()
{
- // Renders the wind as vectors (used for debug)
- S32 i,j;
- F32 x,y;
-
- F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters();
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.pushMatrix();
- LLVector3 origin_agent;
- origin_agent = gAgent.getPosAgentFromGlobal(mOriginGlobal);
- gGL.translatef(origin_agent.mV[VX], origin_agent.mV[VY], gAgent.getPositionAgent().mV[VZ] + WIND_RELATIVE_ALTITUDE);
- for (j = 0; j < mSize; j++)
- {
- for (i = 0; i < mSize; i++)
- {
- x = mVelX[i + j*mSize] * WIND_SCALE_HACK;
- y = mVelY[i + j*mSize] * WIND_SCALE_HACK;
- gGL.pushMatrix();
- gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.0);
- gGL.color3f(0,1,0);
- gGL.begin(LLRender::POINTS);
- gGL.vertex3f(0,0,0);
- gGL.end();
- gGL.color3f(1,0,0);
- gGL.begin(LLRender::LINES);
- gGL.vertex3f(x * 0.1f, y * 0.1f ,0.f);
- gGL.vertex3f(x, y, 0.f);
- gGL.end();
- gGL.popMatrix();
- }
- }
- gGL.popMatrix();
+ // Renders the wind as vectors (used for debug)
+ S32 i,j;
+ F32 x,y;
+
+ F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters();
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.pushMatrix();
+ LLVector3 origin_agent;
+ origin_agent = gAgent.getPosAgentFromGlobal(mOriginGlobal);
+ gGL.translatef(origin_agent.mV[VX], origin_agent.mV[VY], gAgent.getPositionAgent().mV[VZ] + WIND_RELATIVE_ALTITUDE);
+ for (j = 0; j < mSize; j++)
+ {
+ for (i = 0; i < mSize; i++)
+ {
+ x = mVelX[i + j*mSize] * WIND_SCALE_HACK;
+ y = mVelY[i + j*mSize] * WIND_SCALE_HACK;
+ gGL.pushMatrix();
+ gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.0);
+ gGL.color3f(0,1,0);
+ gGL.begin(LLRender::POINTS);
+ gGL.vertex3f(0,0,0);
+ gGL.end();
+ gGL.color3f(1,0,0);
+ gGL.begin(LLRender::LINES);
+ gGL.vertex3f(x * 0.1f, y * 0.1f ,0.f);
+ gGL.vertex3f(x, y, 0.f);
+ gGL.end();
+ gGL.popMatrix();
+ }
+ }
+ gGL.popMatrix();
}
// Used by lltoolselectland
-void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global,
- const LLVector3d &east_north_top_global )
+void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global,
+ const LLVector3d &east_north_top_global )
{
- LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest gls_depth(GL_TRUE);
+ LLGLSUIDefault gls_ui;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest gls_depth(GL_TRUE);
- LLVector3 west_south_bottom_agent = gAgent.getPosAgentFromGlobal(west_south_bottom_global);
- F32 west = west_south_bottom_agent.mV[VX];
- F32 south = west_south_bottom_agent.mV[VY];
-// F32 bottom = west_south_bottom_agent.mV[VZ] - 1.f;
+ LLVector3 west_south_bottom_agent = gAgent.getPosAgentFromGlobal(west_south_bottom_global);
+ F32 west = west_south_bottom_agent.mV[VX];
+ F32 south = west_south_bottom_agent.mV[VY];
+// F32 bottom = west_south_bottom_agent.mV[VZ] - 1.f;
- LLVector3 east_north_top_agent = gAgent.getPosAgentFromGlobal(east_north_top_global);
- F32 east = east_north_top_agent.mV[VX];
- F32 north = east_north_top_agent.mV[VY];
-// F32 top = east_north_top_agent.mV[VZ] + 1.f;
+ LLVector3 east_north_top_agent = gAgent.getPosAgentFromGlobal(east_north_top_global);
+ F32 east = east_north_top_agent.mV[VX];
+ F32 north = east_north_top_agent.mV[VY];
+// F32 top = east_north_top_agent.mV[VZ] + 1.f;
- // HACK: At edge of last region of world, we need to make sure the region
- // resolves correctly so we can get a height value.
- const F32 FUDGE = 0.01f;
+ // HACK: At edge of last region of world, we need to make sure the region
+ // resolves correctly so we can get a height value.
+ const F32 FUDGE = 0.01f;
- F32 sw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, south, 0.f ) );
- F32 se_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) );
- F32 ne_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) );
- F32 nw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) );
+ F32 sw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, south, 0.f ) );
+ F32 se_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) );
+ F32 ne_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) );
+ F32 nw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) );
- F32 sw_top = sw_bottom + PARCEL_POST_HEIGHT;
- F32 se_top = se_bottom + PARCEL_POST_HEIGHT;
- F32 ne_top = ne_bottom + PARCEL_POST_HEIGHT;
- F32 nw_top = nw_bottom + PARCEL_POST_HEIGHT;
+ F32 sw_top = sw_bottom + PARCEL_POST_HEIGHT;
+ F32 se_top = se_bottom + PARCEL_POST_HEIGHT;
+ F32 ne_top = ne_bottom + PARCEL_POST_HEIGHT;
+ F32 nw_top = nw_bottom + PARCEL_POST_HEIGHT;
- LLUI::setLineWidth(2.f);
- gGL.color4f(1.f, 1.f, 0.f, 1.f);
+ LLUI::setLineWidth(2.f);
+ gGL.color4f(1.f, 1.f, 0.f, 1.f);
- // Cheat and give this the same pick-name as land
- gGL.begin(LLRender::LINES);
+ // Cheat and give this the same pick-name as land
+ gGL.begin(LLRender::LINES);
- gGL.vertex3f(west, north, nw_bottom);
- gGL.vertex3f(west, north, nw_top);
+ gGL.vertex3f(west, north, nw_bottom);
+ gGL.vertex3f(west, north, nw_top);
- gGL.vertex3f(east, north, ne_bottom);
- gGL.vertex3f(east, north, ne_top);
+ gGL.vertex3f(east, north, ne_bottom);
+ gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, south, se_bottom);
- gGL.vertex3f(east, south, se_top);
+ gGL.vertex3f(east, south, se_bottom);
+ gGL.vertex3f(east, south, se_top);
- gGL.vertex3f(west, south, sw_bottom);
- gGL.vertex3f(west, south, sw_top);
+ gGL.vertex3f(west, south, sw_bottom);
+ gGL.vertex3f(west, south, sw_top);
- gGL.end();
+ gGL.end();
- gGL.color4f(1.f, 1.f, 0.f, 0.2f);
- gGL.begin(LLRender::QUADS);
+ gGL.color4f(1.f, 1.f, 0.f, 0.2f);
+ gGL.begin(LLRender::QUADS);
- gGL.vertex3f(west, north, nw_bottom);
- gGL.vertex3f(west, north, nw_top);
- gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, north, ne_bottom);
+ gGL.vertex3f(west, north, nw_bottom);
+ gGL.vertex3f(west, north, nw_top);
+ gGL.vertex3f(east, north, ne_top);
+ gGL.vertex3f(east, north, ne_bottom);
- gGL.vertex3f(east, north, ne_bottom);
- gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, south, se_top);
- gGL.vertex3f(east, south, se_bottom);
+ gGL.vertex3f(east, north, ne_bottom);
+ gGL.vertex3f(east, north, ne_top);
+ gGL.vertex3f(east, south, se_top);
+ gGL.vertex3f(east, south, se_bottom);
- gGL.vertex3f(east, south, se_bottom);
- gGL.vertex3f(east, south, se_top);
- gGL.vertex3f(west, south, sw_top);
- gGL.vertex3f(west, south, sw_bottom);
+ gGL.vertex3f(east, south, se_bottom);
+ gGL.vertex3f(east, south, se_top);
+ gGL.vertex3f(west, south, sw_top);
+ gGL.vertex3f(west, south, sw_bottom);
- gGL.vertex3f(west, south, sw_bottom);
- gGL.vertex3f(west, south, sw_top);
- gGL.vertex3f(west, north, nw_top);
- gGL.vertex3f(west, north, nw_bottom);
+ gGL.vertex3f(west, south, sw_bottom);
+ gGL.vertex3f(west, south, sw_top);
+ gGL.vertex3f(west, north, nw_top);
+ gGL.vertex3f(west, north, nw_bottom);
- gGL.end();
+ gGL.end();
- LLUI::setLineWidth(1.f);
+ LLUI::setLineWidth(1.f);
}
/*
void LLViewerParcelMgr::renderParcel(LLParcel* parcel )
{
- S32 i;
- S32 count = parcel->getBoxCount();
- for (i = 0; i < count; i++)
- {
- const LLParcelBox& box = parcel->getBox(i);
+ S32 i;
+ S32 count = parcel->getBoxCount();
+ for (i = 0; i < count; i++)
+ {
+ const LLParcelBox& box = parcel->getBox(i);
- F32 west = box.mMin.mV[VX];
- F32 south = box.mMin.mV[VY];
+ F32 west = box.mMin.mV[VX];
+ F32 south = box.mMin.mV[VY];
- F32 east = box.mMax.mV[VX];
- F32 north = box.mMax.mV[VY];
+ F32 east = box.mMax.mV[VX];
+ F32 north = box.mMax.mV[VY];
- // HACK: At edge of last region of world, we need to make sure the region
- // resolves correctly so we can get a height value.
- const F32 FUDGE = 0.01f;
+ // HACK: At edge of last region of world, we need to make sure the region
+ // resolves correctly so we can get a height value.
+ const F32 FUDGE = 0.01f;
- F32 sw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, south, 0.f ) );
- F32 se_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) );
- F32 ne_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) );
- F32 nw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) );
+ F32 sw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, south, 0.f ) );
+ F32 se_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) );
+ F32 ne_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) );
+ F32 nw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) );
- // little hack to make nearby lines not Z-fight
- east -= 0.1f;
- north -= 0.1f;
+ // little hack to make nearby lines not Z-fight
+ east -= 0.1f;
+ north -= 0.1f;
- F32 sw_top = sw_bottom + POST_HEIGHT;
- F32 se_top = se_bottom + POST_HEIGHT;
- F32 ne_top = ne_bottom + POST_HEIGHT;
- F32 nw_top = nw_bottom + POST_HEIGHT;
+ F32 sw_top = sw_bottom + POST_HEIGHT;
+ F32 se_top = se_bottom + POST_HEIGHT;
+ F32 ne_top = ne_bottom + POST_HEIGHT;
+ F32 nw_top = nw_bottom + POST_HEIGHT;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest gls_depth(GL_TRUE);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest gls_depth(GL_TRUE);
- LLUI::setLineWidth(2.f);
- gGL.color4f(0.f, 1.f, 1.f, 1.f);
+ LLUI::setLineWidth(2.f);
+ gGL.color4f(0.f, 1.f, 1.f, 1.f);
- // Cheat and give this the same pick-name as land
- gGL.begin(LLRender::LINES);
+ // Cheat and give this the same pick-name as land
+ gGL.begin(LLRender::LINES);
- gGL.vertex3f(west, north, nw_bottom);
- gGL.vertex3f(west, north, nw_top);
+ gGL.vertex3f(west, north, nw_bottom);
+ gGL.vertex3f(west, north, nw_top);
- gGL.vertex3f(east, north, ne_bottom);
- gGL.vertex3f(east, north, ne_top);
+ gGL.vertex3f(east, north, ne_bottom);
+ gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, south, se_bottom);
- gGL.vertex3f(east, south, se_top);
+ gGL.vertex3f(east, south, se_bottom);
+ gGL.vertex3f(east, south, se_top);
- gGL.vertex3f(west, south, sw_bottom);
- gGL.vertex3f(west, south, sw_top);
+ gGL.vertex3f(west, south, sw_bottom);
+ gGL.vertex3f(west, south, sw_top);
- gGL.end();
+ gGL.end();
- gGL.color4f(0.f, 1.f, 1.f, 0.2f);
- gGL.begin(LLRender::QUADS);
+ gGL.color4f(0.f, 1.f, 1.f, 0.2f);
+ gGL.begin(LLRender::QUADS);
- gGL.vertex3f(west, north, nw_bottom);
- gGL.vertex3f(west, north, nw_top);
- gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, north, ne_bottom);
+ gGL.vertex3f(west, north, nw_bottom);
+ gGL.vertex3f(west, north, nw_top);
+ gGL.vertex3f(east, north, ne_top);
+ gGL.vertex3f(east, north, ne_bottom);
- gGL.vertex3f(east, north, ne_bottom);
- gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, south, se_top);
- gGL.vertex3f(east, south, se_bottom);
+ gGL.vertex3f(east, north, ne_bottom);
+ gGL.vertex3f(east, north, ne_top);
+ gGL.vertex3f(east, south, se_top);
+ gGL.vertex3f(east, south, se_bottom);
- gGL.vertex3f(east, south, se_bottom);
- gGL.vertex3f(east, south, se_top);
- gGL.vertex3f(west, south, sw_top);
- gGL.vertex3f(west, south, sw_bottom);
+ gGL.vertex3f(east, south, se_bottom);
+ gGL.vertex3f(east, south, se_top);
+ gGL.vertex3f(west, south, sw_top);
+ gGL.vertex3f(west, south, sw_bottom);
- gGL.vertex3f(west, south, sw_bottom);
- gGL.vertex3f(west, south, sw_top);
- gGL.vertex3f(west, north, nw_top);
- gGL.vertex3f(west, north, nw_bottom);
+ gGL.vertex3f(west, south, sw_bottom);
+ gGL.vertex3f(west, south, sw_top);
+ gGL.vertex3f(west, north, nw_top);
+ gGL.vertex3f(west, north, nw_bottom);
- gGL.end();
+ gGL.end();
- LLUI::setLineWidth(1.f);
- }
+ LLUI::setLineWidth(1.f);
+ }
}
*/
@@ -456,289 +456,289 @@ void LLViewerParcelMgr::renderParcel(LLParcel* parcel )
// coordinates correctly.
void LLViewerParcelMgr::renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 height, U8 direction, LLViewerRegion* regionp)
{
- // HACK: At edge of last region of world, we need to make sure the region
- // resolves correctly so we can get a height value.
- const F32 BORDER = REGION_WIDTH_METERS - 0.1f;
-
- F32 clamped_x1 = x1;
- F32 clamped_y1 = y1;
- F32 clamped_x2 = x2;
- F32 clamped_y2 = y2;
-
- if (clamped_x1 > BORDER) clamped_x1 = BORDER;
- if (clamped_y1 > BORDER) clamped_y1 = BORDER;
- if (clamped_x2 > BORDER) clamped_x2 = BORDER;
- if (clamped_y2 > BORDER) clamped_y2 = BORDER;
-
- F32 z;
- F32 z1;
- F32 z2;
-
- z1 = regionp->getLand().resolveHeightRegion( LLVector3( clamped_x1, clamped_y1, 0.f ) );
- z2 = regionp->getLand().resolveHeightRegion( LLVector3( clamped_x2, clamped_y2, 0.f ) );
-
- // Convert x1 and x2 from region-local to agent coords.
- LLVector3 origin = regionp->getOriginAgent();
- x1 += origin.mV[VX];
- x2 += origin.mV[VX];
- y1 += origin.mV[VY];
- y2 += origin.mV[VY];
-
- if (height < 1.f)
- {
- z = z1+height;
- gGL.vertex3f(x1, y1, z);
-
- gGL.vertex3f(x1, y1, z1);
-
- gGL.vertex3f(x2, y2, z2);
-
- z = z2+height;
- gGL.vertex3f(x2, y2, z);
- }
- else
- {
- F32 tex_coord1;
- F32 tex_coord2;
-
- if (WEST_MASK == direction)
- {
- tex_coord1 = y1;
- tex_coord2 = y2;
- }
- else if (SOUTH_MASK == direction)
- {
- tex_coord1 = x1;
- tex_coord2 = x2;
- }
- else if (EAST_MASK == direction)
- {
- tex_coord1 = y2;
- tex_coord2 = y1;
- }
- else /* (NORTH_MASK == direction) */
- {
- tex_coord1 = x2;
- tex_coord2 = x1;
- }
-
-
- gGL.texCoord2f(tex_coord1*0.5f+0.5f, z1*0.5f);
- gGL.vertex3f(x1, y1, z1);
-
- gGL.texCoord2f(tex_coord2*0.5f+0.5f, z2*0.5f);
- gGL.vertex3f(x2, y2, z2);
-
- // top edge stairsteps
- z = llmax(z2+height, z1+height);
- gGL.texCoord2f(tex_coord2*0.5f+0.5f, z*0.5f);
- gGL.vertex3f(x2, y2, z);
-
- gGL.texCoord2f(tex_coord1*0.5f+0.5f, z*0.5f);
- gGL.vertex3f(x1, y1, z);
- }
+ // HACK: At edge of last region of world, we need to make sure the region
+ // resolves correctly so we can get a height value.
+ const F32 BORDER = REGION_WIDTH_METERS - 0.1f;
+
+ F32 clamped_x1 = x1;
+ F32 clamped_y1 = y1;
+ F32 clamped_x2 = x2;
+ F32 clamped_y2 = y2;
+
+ if (clamped_x1 > BORDER) clamped_x1 = BORDER;
+ if (clamped_y1 > BORDER) clamped_y1 = BORDER;
+ if (clamped_x2 > BORDER) clamped_x2 = BORDER;
+ if (clamped_y2 > BORDER) clamped_y2 = BORDER;
+
+ F32 z;
+ F32 z1;
+ F32 z2;
+
+ z1 = regionp->getLand().resolveHeightRegion( LLVector3( clamped_x1, clamped_y1, 0.f ) );
+ z2 = regionp->getLand().resolveHeightRegion( LLVector3( clamped_x2, clamped_y2, 0.f ) );
+
+ // Convert x1 and x2 from region-local to agent coords.
+ LLVector3 origin = regionp->getOriginAgent();
+ x1 += origin.mV[VX];
+ x2 += origin.mV[VX];
+ y1 += origin.mV[VY];
+ y2 += origin.mV[VY];
+
+ if (height < 1.f)
+ {
+ z = z1+height;
+ gGL.vertex3f(x1, y1, z);
+
+ gGL.vertex3f(x1, y1, z1);
+
+ gGL.vertex3f(x2, y2, z2);
+
+ z = z2+height;
+ gGL.vertex3f(x2, y2, z);
+ }
+ else
+ {
+ F32 tex_coord1;
+ F32 tex_coord2;
+
+ if (WEST_MASK == direction)
+ {
+ tex_coord1 = y1;
+ tex_coord2 = y2;
+ }
+ else if (SOUTH_MASK == direction)
+ {
+ tex_coord1 = x1;
+ tex_coord2 = x2;
+ }
+ else if (EAST_MASK == direction)
+ {
+ tex_coord1 = y2;
+ tex_coord2 = y1;
+ }
+ else /* (NORTH_MASK == direction) */
+ {
+ tex_coord1 = x2;
+ tex_coord2 = x1;
+ }
+
+
+ gGL.texCoord2f(tex_coord1*0.5f+0.5f, z1*0.5f);
+ gGL.vertex3f(x1, y1, z1);
+
+ gGL.texCoord2f(tex_coord2*0.5f+0.5f, z2*0.5f);
+ gGL.vertex3f(x2, y2, z2);
+
+ // top edge stairsteps
+ z = llmax(z2+height, z1+height);
+ gGL.texCoord2f(tex_coord2*0.5f+0.5f, z*0.5f);
+ gGL.vertex3f(x2, y2, z);
+
+ gGL.texCoord2f(tex_coord1*0.5f+0.5f, z*0.5f);
+ gGL.vertex3f(x1, y1, z);
+ }
}
void LLViewerParcelMgr::renderHighlightSegments(const U8* segments, LLViewerRegion* regionp)
{
- S32 x, y;
- F32 x1, y1; // start point
- F32 x2, y2; // end point
- bool has_segments = false;
-
- LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest gls_depth(GL_TRUE);
-
- gGL.color4f(1.f, 1.f, 0.f, 0.2f);
-
- const S32 STRIDE = (mParcelsPerEdge+1);
-
- // Cheat and give this the same pick-name as land
-
-
- for (y = 0; y < STRIDE; y++)
- {
- for (x = 0; x < STRIDE; x++)
- {
- U8 segment_mask = segments[x + y*STRIDE];
-
- if (segment_mask & SOUTH_MASK)
- {
- x1 = x * PARCEL_GRID_STEP_METERS;
- y1 = y * PARCEL_GRID_STEP_METERS;
-
- x2 = x1 + PARCEL_GRID_STEP_METERS;
- y2 = y1;
-
- if (!has_segments)
- {
- has_segments = true;
- gGL.begin(LLRender::QUADS);
- }
- renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, SOUTH_MASK, regionp);
- }
-
- if (segment_mask & WEST_MASK)
- {
- x1 = x * PARCEL_GRID_STEP_METERS;
- y1 = y * PARCEL_GRID_STEP_METERS;
-
- x2 = x1;
- y2 = y1 + PARCEL_GRID_STEP_METERS;
-
- if (!has_segments)
- {
- has_segments = true;
- gGL.begin(LLRender::QUADS);
- }
- renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, WEST_MASK, regionp);
- }
- }
- }
-
- if (has_segments)
- {
- gGL.end();
- }
+ S32 x, y;
+ F32 x1, y1; // start point
+ F32 x2, y2; // end point
+ bool has_segments = false;
+
+ LLGLSUIDefault gls_ui;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest gls_depth(GL_TRUE);
+
+ gGL.color4f(1.f, 1.f, 0.f, 0.2f);
+
+ const S32 STRIDE = (mParcelsPerEdge+1);
+
+ // Cheat and give this the same pick-name as land
+
+
+ for (y = 0; y < STRIDE; y++)
+ {
+ for (x = 0; x < STRIDE; x++)
+ {
+ U8 segment_mask = segments[x + y*STRIDE];
+
+ if (segment_mask & SOUTH_MASK)
+ {
+ x1 = x * PARCEL_GRID_STEP_METERS;
+ y1 = y * PARCEL_GRID_STEP_METERS;
+
+ x2 = x1 + PARCEL_GRID_STEP_METERS;
+ y2 = y1;
+
+ if (!has_segments)
+ {
+ has_segments = true;
+ gGL.begin(LLRender::QUADS);
+ }
+ renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, SOUTH_MASK, regionp);
+ }
+
+ if (segment_mask & WEST_MASK)
+ {
+ x1 = x * PARCEL_GRID_STEP_METERS;
+ y1 = y * PARCEL_GRID_STEP_METERS;
+
+ x2 = x1;
+ y2 = y1 + PARCEL_GRID_STEP_METERS;
+
+ if (!has_segments)
+ {
+ has_segments = true;
+ gGL.begin(LLRender::QUADS);
+ }
+ renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, WEST_MASK, regionp);
+ }
+ }
+ }
+
+ if (has_segments)
+ {
+ gGL.end();
+ }
}
void LLViewerParcelMgr::renderCollisionSegments(U8* segments, BOOL use_pass, LLViewerRegion* regionp)
{
- S32 x, y;
- F32 x1, y1; // start point
- F32 x2, y2; // end point
- F32 alpha = 0;
- F32 dist = 0;
- F32 dx, dy;
- F32 collision_height;
-
- const S32 STRIDE = (mParcelsPerEdge+1);
-
- LLVector3 pos = gAgent.getPositionAgent();
-
- F32 pos_x = pos.mV[VX];
- F32 pos_y = pos.mV[VY];
-
- LLGLSUIDefault gls_ui;
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- LLGLDisable cull(GL_CULL_FACE);
-
- if (mCollisionBanned == BA_BANNED ||
- regionp->getRegionFlag(REGION_FLAGS_BLOCK_FLYOVER))
- {
- collision_height = BAN_HEIGHT;
- }
- else
- {
- collision_height = PARCEL_HEIGHT;
- }
-
-
- if (use_pass && (mCollisionBanned == BA_NOT_ON_LIST))
- {
- gGL.getTexUnit(0)->bind(mPassImage);
- }
- else
- {
- gGL.getTexUnit(0)->bind(mBlockedImage);
- }
-
- gGL.begin(LLRender::QUADS);
-
- for (y = 0; y < STRIDE; y++)
- {
- for (x = 0; x < STRIDE; x++)
- {
- U8 segment_mask = segments[x + y*STRIDE];
- U8 direction;
- const F32 MAX_ALPHA = 0.95f;
- const S32 DIST_OFFSET = 5;
- const S32 MIN_DIST_SQ = DIST_OFFSET*DIST_OFFSET;
- const S32 MAX_DIST_SQ = 169;
-
- if (segment_mask & SOUTH_MASK)
- {
- x1 = x * PARCEL_GRID_STEP_METERS;
- y1 = y * PARCEL_GRID_STEP_METERS;
-
- x2 = x1 + PARCEL_GRID_STEP_METERS;
- y2 = y1;
-
- dy = (pos_y - y1) + DIST_OFFSET;
-
- if (pos_x < x1)
- dx = pos_x - x1;
- else if (pos_x > x2)
- dx = pos_x - x2;
- else
- dx = 0;
-
- dist = dx*dx+dy*dy;
-
- if (dist < MIN_DIST_SQ)
- alpha = MAX_ALPHA;
- else if (dist > MAX_DIST_SQ)
- alpha = 0.0f;
- else
- alpha = 30/dist;
-
- alpha = llclamp(alpha, 0.0f, MAX_ALPHA);
-
- gGL.color4f(1.f, 1.f, 1.f, alpha);
-
- if ((pos_y - y1) < 0) direction = SOUTH_MASK;
- else direction = NORTH_MASK;
-
- // avoid Z fighting
- renderOneSegment(x1+0.1f, y1+0.1f, x2+0.1f, y2+0.1f, collision_height, direction, regionp);
-
- }
-
- if (segment_mask & WEST_MASK)
- {
- x1 = x * PARCEL_GRID_STEP_METERS;
- y1 = y * PARCEL_GRID_STEP_METERS;
-
- x2 = x1;
- y2 = y1 + PARCEL_GRID_STEP_METERS;
-
- dx = (pos_x - x1) + DIST_OFFSET;
-
- if (pos_y < y1)
- dy = pos_y - y1;
- else if (pos_y > y2)
- dy = pos_y - y2;
- else
- dy = 0;
-
- dist = dx*dx+dy*dy;
-
- if (dist < MIN_DIST_SQ)
- alpha = MAX_ALPHA;
- else if (dist > MAX_DIST_SQ)
- alpha = 0.0f;
- else
- alpha = 30/dist;
-
- alpha = llclamp(alpha, 0.0f, MAX_ALPHA);
-
- gGL.color4f(1.f, 1.f, 1.f, alpha);
-
- if ((pos_x - x1) > 0) direction = WEST_MASK;
- else direction = EAST_MASK;
-
- // avoid Z fighting
- renderOneSegment(x1+0.1f, y1+0.1f, x2+0.1f, y2+0.1f, collision_height, direction, regionp);
-
- }
- }
- }
-
- gGL.end();
+ S32 x, y;
+ F32 x1, y1; // start point
+ F32 x2, y2; // end point
+ F32 alpha = 0;
+ F32 dist = 0;
+ F32 dx, dy;
+ F32 collision_height;
+
+ const S32 STRIDE = (mParcelsPerEdge+1);
+
+ LLVector3 pos = gAgent.getPositionAgent();
+
+ F32 pos_x = pos.mV[VX];
+ F32 pos_y = pos.mV[VY];
+
+ LLGLSUIDefault gls_ui;
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ LLGLDisable cull(GL_CULL_FACE);
+
+ if (mCollisionBanned == BA_BANNED ||
+ regionp->getRegionFlag(REGION_FLAGS_BLOCK_FLYOVER))
+ {
+ collision_height = BAN_HEIGHT;
+ }
+ else
+ {
+ collision_height = PARCEL_HEIGHT;
+ }
+
+
+ if (use_pass && (mCollisionBanned == BA_NOT_ON_LIST))
+ {
+ gGL.getTexUnit(0)->bind(mPassImage);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->bind(mBlockedImage);
+ }
+
+ gGL.begin(LLRender::QUADS);
+
+ for (y = 0; y < STRIDE; y++)
+ {
+ for (x = 0; x < STRIDE; x++)
+ {
+ U8 segment_mask = segments[x + y*STRIDE];
+ U8 direction;
+ const F32 MAX_ALPHA = 0.95f;
+ const S32 DIST_OFFSET = 5;
+ const S32 MIN_DIST_SQ = DIST_OFFSET*DIST_OFFSET;
+ const S32 MAX_DIST_SQ = 169;
+
+ if (segment_mask & SOUTH_MASK)
+ {
+ x1 = x * PARCEL_GRID_STEP_METERS;
+ y1 = y * PARCEL_GRID_STEP_METERS;
+
+ x2 = x1 + PARCEL_GRID_STEP_METERS;
+ y2 = y1;
+
+ dy = (pos_y - y1) + DIST_OFFSET;
+
+ if (pos_x < x1)
+ dx = pos_x - x1;
+ else if (pos_x > x2)
+ dx = pos_x - x2;
+ else
+ dx = 0;
+
+ dist = dx*dx+dy*dy;
+
+ if (dist < MIN_DIST_SQ)
+ alpha = MAX_ALPHA;
+ else if (dist > MAX_DIST_SQ)
+ alpha = 0.0f;
+ else
+ alpha = 30/dist;
+
+ alpha = llclamp(alpha, 0.0f, MAX_ALPHA);
+
+ gGL.color4f(1.f, 1.f, 1.f, alpha);
+
+ if ((pos_y - y1) < 0) direction = SOUTH_MASK;
+ else direction = NORTH_MASK;
+
+ // avoid Z fighting
+ renderOneSegment(x1+0.1f, y1+0.1f, x2+0.1f, y2+0.1f, collision_height, direction, regionp);
+
+ }
+
+ if (segment_mask & WEST_MASK)
+ {
+ x1 = x * PARCEL_GRID_STEP_METERS;
+ y1 = y * PARCEL_GRID_STEP_METERS;
+
+ x2 = x1;
+ y2 = y1 + PARCEL_GRID_STEP_METERS;
+
+ dx = (pos_x - x1) + DIST_OFFSET;
+
+ if (pos_y < y1)
+ dy = pos_y - y1;
+ else if (pos_y > y2)
+ dy = pos_y - y2;
+ else
+ dy = 0;
+
+ dist = dx*dx+dy*dy;
+
+ if (dist < MIN_DIST_SQ)
+ alpha = MAX_ALPHA;
+ else if (dist > MAX_DIST_SQ)
+ alpha = 0.0f;
+ else
+ alpha = 30/dist;
+
+ alpha = llclamp(alpha, 0.0f, MAX_ALPHA);
+
+ gGL.color4f(1.f, 1.f, 1.f, alpha);
+
+ if ((pos_x - x1) > 0) direction = WEST_MASK;
+ else direction = EAST_MASK;
+
+ // avoid Z fighting
+ renderOneSegment(x1+0.1f, y1+0.1f, x2+0.1f, y2+0.1f, collision_height, direction, regionp);
+
+ }
+ }
+ }
+
+ gGL.end();
}
void LLViewerParcelMgr::resetCollisionTimer()
@@ -749,162 +749,162 @@ void LLViewerParcelMgr::resetCollisionTimer()
void draw_line_cube(F32 width, const LLVector3& center)
{
- width = 0.5f * width;
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] + width);
-
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] - width);
-
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] - width);
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] + width);
- gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width);
+ width = 0.5f * width;
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] + width);
+
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] - width);
+
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] + width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] + width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] - width);
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] + width);
+ gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width);
}
void draw_cross_lines(const LLVector3& center, F32 dx, F32 dy, F32 dz)
{
- gGL.vertex3f(center.mV[VX] - dx, center.mV[VY], center.mV[VZ]);
- gGL.vertex3f(center.mV[VX] + dx, center.mV[VY], center.mV[VZ]);
- gGL.vertex3f(center.mV[VX], center.mV[VY] - dy, center.mV[VZ]);
- gGL.vertex3f(center.mV[VX], center.mV[VY] + dy, center.mV[VZ]);
- gGL.vertex3f(center.mV[VX], center.mV[VY], center.mV[VZ] - dz);
- gGL.vertex3f(center.mV[VX], center.mV[VY], center.mV[VZ] + dz);
+ gGL.vertex3f(center.mV[VX] - dx, center.mV[VY], center.mV[VZ]);
+ gGL.vertex3f(center.mV[VX] + dx, center.mV[VY], center.mV[VZ]);
+ gGL.vertex3f(center.mV[VX], center.mV[VY] - dy, center.mV[VZ]);
+ gGL.vertex3f(center.mV[VX], center.mV[VY] + dy, center.mV[VZ]);
+ gGL.vertex3f(center.mV[VX], center.mV[VY], center.mV[VZ] - dz);
+ gGL.vertex3f(center.mV[VX], center.mV[VY], center.mV[VZ] + dz);
}
void LLViewerObjectList::renderObjectBeacons()
{
- if (mDebugBeacons.empty())
- {
- return;
- }
-
- LLGLSUIDefault gls_ui;
-
- gUIProgram.bind();
-
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- S32 last_line_width = -1;
- // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
-
- for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
- {
- const LLDebugBeacon &debug_beacon = *iter;
- LLColor4 color = debug_beacon.mColor;
- color.mV[3] *= 0.25f;
- S32 line_width = debug_beacon.mLineWidth;
- if (line_width != last_line_width)
- {
- gGL.flush();
- glLineWidth( (F32)line_width );
- last_line_width = line_width;
- }
-
- const LLVector3 &thisline = debug_beacon.mPositionAgent;
-
- gGL.begin(LLRender::LINES);
- gGL.color4fv(linearColor4(color).mV);
- draw_cross_lines(thisline, 2.0f, 2.0f, 50.f);
- draw_line_cube(0.10f, thisline);
-
- gGL.end();
- }
- }
-
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest gls_depth(GL_TRUE);
-
- S32 last_line_width = -1;
- // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
-
- for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
- {
- const LLDebugBeacon &debug_beacon = *iter;
-
- S32 line_width = debug_beacon.mLineWidth;
- if (line_width != last_line_width)
- {
- gGL.flush();
- glLineWidth( (F32)line_width );
- last_line_width = line_width;
- }
-
- const LLVector3 &thisline = debug_beacon.mPositionAgent;
- gGL.begin(LLRender::LINES);
- gGL.color4fv(linearColor4(debug_beacon.mColor).mV);
- draw_cross_lines(thisline, 0.5f, 0.5f, 0.5f);
- draw_line_cube(0.10f, thisline);
-
- gGL.end();
- }
-
- gGL.flush();
- glLineWidth(1.f);
-
- for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
- {
- LLDebugBeacon &debug_beacon = *iter;
- if (debug_beacon.mString == "")
- {
- continue;
- }
- LLHUDText *hud_textp = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
-
- hud_textp->setZCompare(FALSE);
- LLColor4 color;
- color = debug_beacon.mTextColor;
- color.mV[3] *= 1.f;
-
- hud_textp->setString(debug_beacon.mString);
- hud_textp->setColor(color);
- hud_textp->setPositionAgent(debug_beacon.mPositionAgent);
- debug_beacon.mHUDObject = hud_textp;
- }
- }
+ if (mDebugBeacons.empty())
+ {
+ return;
+ }
+
+ LLGLSUIDefault gls_ui;
+
+ gUIProgram.bind();
+
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ S32 last_line_width = -1;
+ // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
+
+ for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
+ {
+ const LLDebugBeacon &debug_beacon = *iter;
+ LLColor4 color = debug_beacon.mColor;
+ color.mV[3] *= 0.25f;
+ S32 line_width = debug_beacon.mLineWidth;
+ if (line_width != last_line_width)
+ {
+ gGL.flush();
+ glLineWidth( (F32)line_width );
+ last_line_width = line_width;
+ }
+
+ const LLVector3 &thisline = debug_beacon.mPositionAgent;
+
+ gGL.begin(LLRender::LINES);
+ gGL.color4fv(linearColor4(color).mV);
+ draw_cross_lines(thisline, 2.0f, 2.0f, 50.f);
+ draw_line_cube(0.10f, thisline);
+
+ gGL.end();
+ }
+ }
+
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest gls_depth(GL_TRUE);
+
+ S32 last_line_width = -1;
+ // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
+
+ for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
+ {
+ const LLDebugBeacon &debug_beacon = *iter;
+
+ S32 line_width = debug_beacon.mLineWidth;
+ if (line_width != last_line_width)
+ {
+ gGL.flush();
+ glLineWidth( (F32)line_width );
+ last_line_width = line_width;
+ }
+
+ const LLVector3 &thisline = debug_beacon.mPositionAgent;
+ gGL.begin(LLRender::LINES);
+ gGL.color4fv(linearColor4(debug_beacon.mColor).mV);
+ draw_cross_lines(thisline, 0.5f, 0.5f, 0.5f);
+ draw_line_cube(0.10f, thisline);
+
+ gGL.end();
+ }
+
+ gGL.flush();
+ glLineWidth(1.f);
+
+ for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
+ {
+ LLDebugBeacon &debug_beacon = *iter;
+ if (debug_beacon.mString == "")
+ {
+ continue;
+ }
+ LLHUDText *hud_textp = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
+
+ hud_textp->setZCompare(FALSE);
+ LLColor4 color;
+ color = debug_beacon.mTextColor;
+ color.mV[3] *= 1.f;
+
+ hud_textp->setString(debug_beacon.mString);
+ hud_textp->setColor(color);
+ hud_textp->setPositionAgent(debug_beacon.mPositionAgent);
+ debug_beacon.mHUDObject = hud_textp;
+ }
+ }
}
void LLSky::renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& direction, LLColor4 color)
{
- LLGLSUIDefault gls_ui;
- gUIProgram.bind();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- LLVector3 pos_end;
- for (S32 i = 0; i < 3; ++i)
- {
- pos_end.mV[i] = pos_agent.mV[i] + (50 * direction.mV[i]);
- }
- glLineWidth(LLPipeline::DebugBeaconLineWidth);
- gGL.begin(LLRender::LINES);
- color.mV[3] *= 0.5f;
- gGL.color4fv(color.mV);
- draw_cross_lines(pos_agent, 0.5f, 0.5f, 0.5f);
- draw_cross_lines(pos_end, 2.f, 2.f, 2.f);
- gGL.vertex3fv(pos_agent.mV);
- gGL.vertex3fv(pos_end.mV);
- gGL.end();
-
- gGL.flush();
- glLineWidth(1.f);
+ LLGLSUIDefault gls_ui;
+ gUIProgram.bind();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ LLVector3 pos_end;
+ for (S32 i = 0; i < 3; ++i)
+ {
+ pos_end.mV[i] = pos_agent.mV[i] + (50 * direction.mV[i]);
+ }
+ glLineWidth(LLPipeline::DebugBeaconLineWidth);
+ gGL.begin(LLRender::LINES);
+ color.mV[3] *= 0.5f;
+ gGL.color4fv(color.mV);
+ draw_cross_lines(pos_agent, 0.5f, 0.5f, 0.5f);
+ draw_cross_lines(pos_end, 2.f, 2.f, 2.f);
+ gGL.vertex3fv(pos_agent.mV);
+ gGL.vertex3fv(pos_end.mV);
+ gGL.end();
+
+ gGL.flush();
+ glLineWidth(1.f);
}
@@ -917,14 +917,14 @@ void LLSky::renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& di
// a struct rather than a class simply because every member is public.
struct ShaderProfileHelper
{
- ShaderProfileHelper()
- {
- LLGLSLShader::initProfile();
- }
- ~ShaderProfileHelper()
- {
- LLGLSLShader::finishProfile(false);
- }
+ ShaderProfileHelper()
+ {
+ LLGLSLShader::initProfile();
+ }
+ ~ShaderProfileHelper()
+ {
+ LLGLSLShader::finishProfile(false);
+ }
};
// This helper class is used to ensure that each generateTextures() call
@@ -933,58 +933,58 @@ struct ShaderProfileHelper
class TextureHolder
{
public:
- TextureHolder(U32 unit, U32 size) :
- texUnit(gGL.getTexUnit(unit)),
- source(size) // preallocate vector
- {
- // takes (count, pointer)
- // &vector[0] gets pointer to contiguous array
- LLImageGL::generateTextures(source.size(), &source[0]);
- }
-
- ~TextureHolder()
- {
- // unbind
- if (texUnit)
- {
- texUnit->unbind(LLTexUnit::TT_TEXTURE);
- }
- // ensure that we delete these textures regardless of how we exit
- LLImageGL::deleteTextures(source.size(), &source[0]);
- }
-
- bool bind(U32 index)
- {
- if (texUnit) // should always be there with dummy (-1), but just in case
- {
- return texUnit->bindManual(LLTexUnit::TT_TEXTURE, source[index]);
- }
- return false;
- }
+ TextureHolder(U32 unit, U32 size) :
+ texUnit(gGL.getTexUnit(unit)),
+ source(size) // preallocate vector
+ {
+ // takes (count, pointer)
+ // &vector[0] gets pointer to contiguous array
+ LLImageGL::generateTextures(source.size(), &source[0]);
+ }
+
+ ~TextureHolder()
+ {
+ // unbind
+ if (texUnit)
+ {
+ texUnit->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ // ensure that we delete these textures regardless of how we exit
+ LLImageGL::deleteTextures(source.size(), &source[0]);
+ }
+
+ bool bind(U32 index)
+ {
+ if (texUnit) // should always be there with dummy (-1), but just in case
+ {
+ return texUnit->bindManual(LLTexUnit::TT_TEXTURE, source[index]);
+ }
+ return false;
+ }
private:
- // capture which LLTexUnit we're going to use
- LLTexUnit* texUnit;
+ // capture which LLTexUnit we're going to use
+ LLTexUnit* texUnit;
- // use std::vector for implicit resource management
- std::vector<U32> source;
+ // use std::vector for implicit resource management
+ std::vector<U32> source;
};
class ShaderBinder
{
public:
- ShaderBinder(LLGLSLShader& shader) :
- mShader(shader)
- {
- mShader.bind();
- }
- ~ShaderBinder()
- {
- mShader.unbind();
- }
+ ShaderBinder(LLGLSLShader& shader) :
+ mShader(shader)
+ {
+ mShader.bind();
+ }
+ ~ShaderBinder()
+ {
+ mShader.unbind();
+ }
private:
- LLGLSLShader& mShader;
+ LLGLSLShader& mShader;
};
@@ -994,127 +994,127 @@ private:
//-----------------------------------------------------------------------------
F32 gpu_benchmark()
{
- if (gGLManager.mGLVersion < 3.3f)
- { // don't bother benchmarking venerable drivers which don't support accurate timing anyway
- return -1.f;
- }
+ if (gGLManager.mGLVersion < 3.3f)
+ { // don't bother benchmarking venerable drivers which don't support accurate timing anyway
+ return -1.f;
+ }
if (gBenchmarkProgram.mProgramObject == 0)
- {
- LLViewerShaderMgr::instance()->initAttribsAndUniforms();
-
- gBenchmarkProgram.mName = "Benchmark Shader";
- gBenchmarkProgram.mFeatures.attachNothing = true;
- gBenchmarkProgram.mShaderFiles.clear();
- gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER));
- gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER));
- gBenchmarkProgram.mShaderLevel = 1;
- if (!gBenchmarkProgram.createShader(NULL, NULL))
- {
- return -1.f;
- }
- }
-
- LLGLDisable blend(GL_BLEND);
-
- //measure memory bandwidth by:
- // - allocating a batch of textures and render targets
- // - rendering those textures to those render targets
- // - recording time taken
- // - taking the median time for a given number of samples
-
- //resolution of textures/render targets
- const U32 res = 1024;
-
- //number of textures
- const U32 count = 32;
-
- //number of samples to take
- const S32 samples = 64;
-
- //time limit, allocation operations shouldn't take longer then 30 seconds, same for actual benchmark.
- const F32 time_limit = 30;
-
- std::vector<LLRenderTarget> dest(count);
- TextureHolder texHolder(0, count);
- std::vector<F32> results;
-
- //build a random texture
- U8* pixels = new U8[res*res*4];
-
- for (U32 i = 0; i < res*res*4; ++i)
- {
- pixels[i] = (U8) ll_rand(255);
- }
-
- gGL.setColorMask(true, true);
- LLGLDepthTest depth(GL_FALSE);
-
- LLTimer alloc_timer;
- alloc_timer.start();
- for (U32 i = 0; i < count; ++i)
- {
- //allocate render targets and textures
- if (!dest[i].allocate(res, res, GL_RGBA))
- {
- LL_WARNS("Benchmark") << "Failed to allocate render target." << LL_ENDL;
- // abandon the benchmark test
- delete[] pixels;
- return -1.f;
- }
- dest[i].bindTarget();
- dest[i].clear();
- dest[i].flush();
-
- if (!texHolder.bind(i))
- {
- // can use a dummy value mDummyTexUnit = new LLTexUnit(-1);
- LL_WARNS("Benchmark") << "Failed to bind tex unit." << LL_ENDL;
- // abandon the benchmark test
- delete[] pixels;
- return -1.f;
- }
- LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RGBA, res,res,GL_RGBA, GL_UNSIGNED_BYTE, pixels);
-
- if (alloc_timer.getElapsedTimeF32() > time_limit)
- {
- // abandon the benchmark test
- LL_WARNS("Benchmark") << "Allocation operation took longer then 30 seconds, stopping." << LL_ENDL;
- delete[] pixels;
- return -1.f;
- }
- }
+ {
+ LLViewerShaderMgr::instance()->initAttribsAndUniforms();
+
+ gBenchmarkProgram.mName = "Benchmark Shader";
+ gBenchmarkProgram.mFeatures.attachNothing = true;
+ gBenchmarkProgram.mShaderFiles.clear();
+ gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER));
+ gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER));
+ gBenchmarkProgram.mShaderLevel = 1;
+ if (!gBenchmarkProgram.createShader(NULL, NULL))
+ {
+ return -1.f;
+ }
+ }
+
+ LLGLDisable blend(GL_BLEND);
+
+ //measure memory bandwidth by:
+ // - allocating a batch of textures and render targets
+ // - rendering those textures to those render targets
+ // - recording time taken
+ // - taking the median time for a given number of samples
+
+ //resolution of textures/render targets
+ const U32 res = 1024;
+
+ //number of textures
+ const U32 count = 32;
+
+ //number of samples to take
+ const S32 samples = 64;
+
+ //time limit, allocation operations shouldn't take longer then 30 seconds, same for actual benchmark.
+ const F32 time_limit = 30;
+
+ std::vector<LLRenderTarget> dest(count);
+ TextureHolder texHolder(0, count);
+ std::vector<F32> results;
+
+ //build a random texture
+ U8* pixels = new U8[res*res*4];
+
+ for (U32 i = 0; i < res*res*4; ++i)
+ {
+ pixels[i] = (U8) ll_rand(255);
+ }
+
+ gGL.setColorMask(true, true);
+ LLGLDepthTest depth(GL_FALSE);
+
+ LLTimer alloc_timer;
+ alloc_timer.start();
+ for (U32 i = 0; i < count; ++i)
+ {
+ //allocate render targets and textures
+ if (!dest[i].allocate(res, res, GL_RGBA))
+ {
+ LL_WARNS("Benchmark") << "Failed to allocate render target." << LL_ENDL;
+ // abandon the benchmark test
+ delete[] pixels;
+ return -1.f;
+ }
+ dest[i].bindTarget();
+ dest[i].clear();
+ dest[i].flush();
+
+ if (!texHolder.bind(i))
+ {
+ // can use a dummy value mDummyTexUnit = new LLTexUnit(-1);
+ LL_WARNS("Benchmark") << "Failed to bind tex unit." << LL_ENDL;
+ // abandon the benchmark test
+ delete[] pixels;
+ return -1.f;
+ }
+ LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RGBA, res,res,GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+
+ if (alloc_timer.getElapsedTimeF32() > time_limit)
+ {
+ // abandon the benchmark test
+ LL_WARNS("Benchmark") << "Allocation operation took longer then 30 seconds, stopping." << LL_ENDL;
+ delete[] pixels;
+ return -1.f;
+ }
+ }
delete [] pixels;
- //make a dummy triangle to draw with
- LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX);
+ //make a dummy triangle to draw with
+ LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX);
- if (!buff->allocateBuffer(3, 0))
- {
- LL_WARNS("Benchmark") << "Failed to allocate buffer during benchmark." << LL_ENDL;
- // abandon the benchmark test
- return -1.f;
- }
+ if (!buff->allocateBuffer(3, 0))
+ {
+ LL_WARNS("Benchmark") << "Failed to allocate buffer during benchmark." << LL_ENDL;
+ // abandon the benchmark test
+ return -1.f;
+ }
- LLStrider<LLVector3> v;
+ LLStrider<LLVector3> v;
- if (! buff->getVertexStrider(v))
- {
- LL_WARNS("Benchmark") << "GL LLVertexBuffer::getVertexStrider() returned false, "
- << "buff->getMappedData() is"
- << (buff->getMappedData()? " not" : "")
- << " NULL" << LL_ENDL;
- // abandon the benchmark test
- return -1.f;
- }
+ if (! buff->getVertexStrider(v))
+ {
+ LL_WARNS("Benchmark") << "GL LLVertexBuffer::getVertexStrider() returned false, "
+ << "buff->getMappedData() is"
+ << (buff->getMappedData()? " not" : "")
+ << " NULL" << LL_ENDL;
+ // abandon the benchmark test
+ return -1.f;
+ }
- // generate dummy triangle
- v[0].set(-1, 1, 0);
- v[1].set(-1, -3, 0);
- v[2].set(3, 1, 0);
+ // generate dummy triangle
+ v[0].set(-1, 1, 0);
+ v[1].set(-1, -3, 0);
+ v[2].set(3, 1, 0);
- buff->unmapBuffer();
+ buff->unmapBuffer();
LLGLSLShader::unbind();
@@ -1154,15 +1154,15 @@ F32 gpu_benchmark()
gBenchmarkProgram.unbind();
}
- std::sort(results.begin(), results.end());
+ std::sort(results.begin(), results.end());
+
+ F32 gbps = results[results.size()/2];
- F32 gbps = results[results.size()/2];
+ LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to CPU timers, " << (F32)results.size() << " tests took " << time_passed << " seconds" << LL_ENDL;
- LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to CPU timers, " << (F32)results.size() << " tests took " << time_passed << " seconds" << LL_ENDL;
-
#if LL_DARWIN
if (gbps > 512.f)
- {
+ {
LL_WARNS("Benchmark") << "Memory bandwidth is improbably high and likely incorrect; discarding result." << LL_ENDL;
//OSX is probably lying, discard result
return -1.f;
@@ -1170,7 +1170,7 @@ F32 gpu_benchmark()
#endif
// run GPU timer benchmark
- {
+ {
ShaderProfileHelper initProfile;
dest[0].bindTarget();
gBenchmarkProgram.bind();
@@ -1187,14 +1187,14 @@ F32 gpu_benchmark()
dest[0].flush();
}
- F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
- F32 seconds = ms/1000.f;
+ F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
+ F32 seconds = ms/1000.f;
F64 samples_drawn = gBenchmarkProgram.mSamplesDrawn;
- F32 samples_sec = (samples_drawn/1000000000.0)/seconds;
- gbps = samples_sec*4; // 4 bytes per sample
+ F32 samples_sec = (samples_drawn/1000000000.0)/seconds;
+ gbps = samples_sec*4; // 4 bytes per sample
- LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;
+ LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;
- return gbps;
+ return gbps;
}
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 92c58a2dbc..b36c302a67 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -78,7 +78,7 @@ static bool is_valid_update(const LLSD& data)
++count;
}
else
- {
+ {
LL_WARNS() << "Missing required parameter: object_id" << LL_ENDL;
return false;
}
@@ -98,7 +98,7 @@ static bool is_valid_update(const LLSD& data)
++count;
}
else
- {
+ {
LL_WARNS() << "Missing required parameter: side" << LL_ENDL;
return false;
}
@@ -124,7 +124,7 @@ static bool is_valid_update(const LLSD& data)
}
if (count < 3)
- {
+ {
LL_WARNS() << "Only specified object_id and side, update won't actually change anything and is just noise" << LL_ENDL;
return false;
}
@@ -178,7 +178,7 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
LLSDSerialize::fromNotation(data, str, data_in.length());
const LLHost& host = msg->getSender();
-
+
LLViewerRegion* region = LLWorld::instance().getRegion(host);
llassert(region);
@@ -204,7 +204,7 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
bool has_te[MAX_TES] = { false };
if (tes.isArray()) // NOTE: if no "te" array exists, this is a malformed message (null out all overrides will come in as an empty te array)
- {
+ {
LLGLTFOverrideCacheEntry cache;
cache.mLocalId = local_id;
cache.mObjectId = id;
@@ -256,7 +256,7 @@ void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFM
{
#if 0
override_list_t& overrides = mQueuedOverrides[id];
-
+
if (overrides.size() < side + 1)
{
overrides.resize(side + 1);
@@ -376,7 +376,7 @@ void LLGLTFMaterialList::queueUpdate(const LLSD& data)
{
sUpdates = LLSD::emptyArray();
}
-
+
sUpdates[sUpdates.size()] = data;
}
@@ -396,7 +396,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool))
data[i]["object_id"] = e.object_id;
data[i]["side"] = e.side;
-
+
if (e.has_override)
{
data[i]["gltf_json"] = e.override_data.asJSON();
@@ -582,7 +582,7 @@ LLFetchedGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id)
gAssetStorage->getAssetData(id, LLAssetType::AT_MATERIAL, onAssetLoadComplete, (void*)user_data);
}
-
+
return mat;
}
diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h
index f1c4ce20f9..c1e0dd0a64 100644
--- a/indra/newview/llgltfmateriallist.h
+++ b/indra/newview/llgltfmateriallist.h
@@ -81,14 +81,14 @@ public:
static void flushUpdates(void(*done_callback)(bool) = nullptr);
static void addSelectionUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side));
-
+
// Queue an explicit LLSD ModifyMaterialParams update apply given override data
// overrides -- LLSD map (or array of maps) in the format:
// object_id UUID(required) id of object
// side integer(required) TE index of face to set, or -1 for all faces
// gltf_json string(optional) override data to set, empty string nulls out override data, omissions of this parameter keeps existing data
// asset_id UUID(optional) id of material asset to set, omission of this parameter keeps existing material asset id
- //
+ //
// NOTE: Unless you already have a gltf_json string you want to send, strongly prefer using queueModify
// If the queue/flush API is insufficient, extend it.
static void queueUpdate(const LLSD& data);
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index 380e49c320..9e46d9c6ca 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgroupactions.cpp
* @brief Group-related actions (join, leave, new, delete, etc)
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,7 +40,7 @@
#include "llimview.h" // for gIMMgr
#include "llnotificationsutil.h"
#include "llstartup.h"
-#include "llstatusbar.h" // can_afford_transaction()
+#include "llstatusbar.h" // can_afford_transaction()
#include "groupchatlistener.h"
//
@@ -51,8 +51,8 @@ static GroupChatListener sGroupChatListener;
class LLGroupHandler : public LLCommandHandler
{
public:
- // requires trusted browser to trigger
- LLGroupHandler() : LLCommandHandler("group", UNTRUSTED_THROTTLE) { }
+ // requires trusted browser to trigger
+ LLGroupHandler() : LLCommandHandler("group", UNTRUSTED_THROTTLE) { }
virtual bool canHandleUntrusted(
const LLSD& params,
@@ -79,74 +79,74 @@ public:
return true;
}
- bool handle(const LLSD& tokens,
+ bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- if (LLStartUp::getStartupState() < STATE_STARTED)
- {
- return true;
- }
-
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableGroupInfo"))
- {
- LLNotificationsUtil::add("NoGroupInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
-
- if (tokens.size() < 1)
- {
- return false;
- }
-
- if (tokens[0].asString() == "create")
- {
- LLGroupActions::createGroup();
- return true;
- }
-
- if (tokens.size() < 2)
- {
- return false;
- }
-
- if (tokens[0].asString() == "list")
- {
- if (tokens[1].asString() == "show")
- {
- LLSD params;
- params["people_panel_tab_name"] = "groups_panel";
- LLFloaterSidePanelContainer::showPanel("people", "panel_people", params);
- return true;
- }
+ {
+ if (LLStartUp::getStartupState() < STATE_STARTED)
+ {
+ return true;
+ }
+
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableGroupInfo"))
+ {
+ LLNotificationsUtil::add("NoGroupInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ if (tokens.size() < 1)
+ {
+ return false;
+ }
+
+ if (tokens[0].asString() == "create")
+ {
+ LLGroupActions::createGroup();
+ return true;
+ }
+
+ if (tokens.size() < 2)
+ {
+ return false;
+ }
+
+ if (tokens[0].asString() == "list")
+ {
+ if (tokens[1].asString() == "show")
+ {
+ LLSD params;
+ params["people_panel_tab_name"] = "groups_panel";
+ LLFloaterSidePanelContainer::showPanel("people", "panel_people", params);
+ return true;
+ }
+ return false;
+ }
+
+ LLUUID group_id;
+ if (!group_id.set(tokens[0], FALSE))
+ {
return false;
- }
-
- LLUUID group_id;
- if (!group_id.set(tokens[0], FALSE))
- {
- return false;
- }
-
- if (tokens[1].asString() == "about")
- {
- if (group_id.isNull())
- return true;
-
- LLGroupActions::show(group_id);
-
- return true;
- }
- if (tokens[1].asString() == "inspect")
- {
- if (group_id.isNull())
- return true;
- LLGroupActions::inspect(group_id);
- return true;
- }
- return false;
- }
+ }
+
+ if (tokens[1].asString() == "about")
+ {
+ if (group_id.isNull())
+ return true;
+
+ LLGroupActions::show(group_id);
+
+ return true;
+ }
+ if (tokens[1].asString() == "inspect")
+ {
+ if (group_id.isNull())
+ return true;
+ LLGroupActions::inspect(group_id);
+ return true;
+ }
+ return false;
+ }
};
LLGroupHandler gGroupHandler;
@@ -155,67 +155,67 @@ LLGroupHandler gGroupHandler;
class LLFetchGroupMemberData : public LLGroupMgrObserver
{
public:
- LLFetchGroupMemberData(const LLUUID& group_id) :
- mGroupId(group_id),
- mRequestProcessed(false),
- LLGroupMgrObserver(group_id)
- {
- LL_INFOS() << "Sending new group member request for group_id: "<< group_id << LL_ENDL;
- LLGroupMgr* mgr = LLGroupMgr::getInstance();
- // register ourselves as an observer
- mgr->addObserver(this);
- // send a request
- mgr->sendGroupPropertiesRequest(group_id);
- mgr->sendCapGroupMembersRequest(group_id);
- }
-
- ~LLFetchGroupMemberData()
- {
- if (!mRequestProcessed)
- {
- // Request is pending
- LL_WARNS() << "Destroying pending group member request for group_id: "
- << mGroupId << LL_ENDL;
- }
- // Remove ourselves as an observer
- LLGroupMgr::getInstance()->removeObserver(this);
- }
-
- void changed(LLGroupChange gc)
- {
- if (gc == GC_PROPERTIES && !mRequestProcessed)
- {
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupId);
- if (!gdatap)
- {
- LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData() was NULL" << LL_ENDL;
- }
- else if (!gdatap->isMemberDataComplete())
- {
- LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData()->isMemberDataComplete() was FALSE" << LL_ENDL;
- processGroupData();
- mRequestProcessed = true;
- }
- }
- }
-
- LLUUID getGroupId() { return mGroupId; }
- virtual void processGroupData() = 0;
+ LLFetchGroupMemberData(const LLUUID& group_id) :
+ mGroupId(group_id),
+ mRequestProcessed(false),
+ LLGroupMgrObserver(group_id)
+ {
+ LL_INFOS() << "Sending new group member request for group_id: "<< group_id << LL_ENDL;
+ LLGroupMgr* mgr = LLGroupMgr::getInstance();
+ // register ourselves as an observer
+ mgr->addObserver(this);
+ // send a request
+ mgr->sendGroupPropertiesRequest(group_id);
+ mgr->sendCapGroupMembersRequest(group_id);
+ }
+
+ ~LLFetchGroupMemberData()
+ {
+ if (!mRequestProcessed)
+ {
+ // Request is pending
+ LL_WARNS() << "Destroying pending group member request for group_id: "
+ << mGroupId << LL_ENDL;
+ }
+ // Remove ourselves as an observer
+ LLGroupMgr::getInstance()->removeObserver(this);
+ }
+
+ void changed(LLGroupChange gc)
+ {
+ if (gc == GC_PROPERTIES && !mRequestProcessed)
+ {
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupId);
+ if (!gdatap)
+ {
+ LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData() was NULL" << LL_ENDL;
+ }
+ else if (!gdatap->isMemberDataComplete())
+ {
+ LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData()->isMemberDataComplete() was FALSE" << LL_ENDL;
+ processGroupData();
+ mRequestProcessed = true;
+ }
+ }
+ }
+
+ LLUUID getGroupId() { return mGroupId; }
+ virtual void processGroupData() = 0;
protected:
- LLUUID mGroupId;
+ LLUUID mGroupId;
bool mRequestProcessed;
};
class LLFetchLeaveGroupData: public LLFetchGroupMemberData
{
public:
- LLFetchLeaveGroupData(const LLUUID& group_id)
- : LLFetchGroupMemberData(group_id)
- {}
- void processGroupData()
- {
- LLGroupActions::processLeaveGroupDataResponse(mGroupId);
- }
+ LLFetchLeaveGroupData(const LLUUID& group_id)
+ : LLFetchGroupMemberData(group_id)
+ {}
+ void processGroupData()
+ {
+ LLGroupActions::processLeaveGroupDataResponse(mGroupId);
+ }
void changed(LLGroupChange gc)
{
if (gc == GC_PROPERTIES && !mRequestProcessed)
@@ -224,7 +224,7 @@ public:
if (!gdatap)
{
LL_WARNS() << "GroupData was NULL" << LL_ENDL;
- }
+ }
else
{
processGroupData();
@@ -239,182 +239,182 @@ LLFetchLeaveGroupData* gFetchLeaveGroupData = NULL;
// static
void LLGroupActions::search()
{
- LLFloaterReg::showInstance("search", LLSD().with("collection", "groups"));
+ LLFloaterReg::showInstance("search", LLSD().with("collection", "groups"));
}
// static
void LLGroupActions::startCall(const LLUUID& group_id)
{
- // create a new group voice session
- LLGroupData gdata;
-
- if (!gAgent.getGroupData(group_id, gdata))
- {
- LL_WARNS() << "Error getting group data" << LL_ENDL;
- return;
- }
-
- LLUUID session_id = gIMMgr->addSession(gdata.mName, IM_SESSION_GROUP_START, group_id, true);
- if (session_id == LLUUID::null)
- {
- LL_WARNS() << "Error adding session" << LL_ENDL;
- return;
- }
-
- // start the call
- gIMMgr->autoStartCallOnStartup(session_id);
-
- make_ui_sound("UISndStartIM");
+ // create a new group voice session
+ LLGroupData gdata;
+
+ if (!gAgent.getGroupData(group_id, gdata))
+ {
+ LL_WARNS() << "Error getting group data" << LL_ENDL;
+ return;
+ }
+
+ LLUUID session_id = gIMMgr->addSession(gdata.mName, IM_SESSION_GROUP_START, group_id, true);
+ if (session_id == LLUUID::null)
+ {
+ LL_WARNS() << "Error adding session" << LL_ENDL;
+ return;
+ }
+
+ // start the call
+ gIMMgr->autoStartCallOnStartup(session_id);
+
+ make_ui_sound("UISndStartIM");
}
// static
void LLGroupActions::join(const LLUUID& group_id)
{
- if (!gAgent.canJoinGroups())
- {
- LLNotificationsUtil::add("JoinedTooManyGroups");
- return;
- }
-
- LLGroupMgrGroupData* gdatap =
- LLGroupMgr::getInstance()->getGroupData(group_id);
-
- if (gdatap)
- {
- S32 cost = gdatap->mMembershipFee;
- LLSD args;
- args["COST"] = llformat("%d", cost);
- args["NAME"] = gdatap->mName;
- LLSD payload;
- payload["group_id"] = group_id;
-
- if (can_afford_transaction(cost))
- {
- if(cost > 0)
- LLNotificationsUtil::add("JoinGroupCanAfford", args, payload, onJoinGroup);
- else
- LLNotificationsUtil::add("JoinGroupNoCost", args, payload, onJoinGroup);
-
- }
- else
- {
- LLNotificationsUtil::add("JoinGroupCannotAfford", args, payload);
- }
- }
- else
- {
- LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData(" << group_id
- << ") was NULL" << LL_ENDL;
- }
+ if (!gAgent.canJoinGroups())
+ {
+ LLNotificationsUtil::add("JoinedTooManyGroups");
+ return;
+ }
+
+ LLGroupMgrGroupData* gdatap =
+ LLGroupMgr::getInstance()->getGroupData(group_id);
+
+ if (gdatap)
+ {
+ S32 cost = gdatap->mMembershipFee;
+ LLSD args;
+ args["COST"] = llformat("%d", cost);
+ args["NAME"] = gdatap->mName;
+ LLSD payload;
+ payload["group_id"] = group_id;
+
+ if (can_afford_transaction(cost))
+ {
+ if(cost > 0)
+ LLNotificationsUtil::add("JoinGroupCanAfford", args, payload, onJoinGroup);
+ else
+ LLNotificationsUtil::add("JoinGroupNoCost", args, payload, onJoinGroup);
+
+ }
+ else
+ {
+ LLNotificationsUtil::add("JoinGroupCannotAfford", args, payload);
+ }
+ }
+ else
+ {
+ LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData(" << group_id
+ << ") was NULL" << LL_ENDL;
+ }
}
// static
bool LLGroupActions::onJoinGroup(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 1)
- {
- // user clicked cancel
- return false;
- }
+ if (option == 1)
+ {
+ // user clicked cancel
+ return false;
+ }
- LLGroupMgr::getInstance()->
- sendGroupMemberJoin(notification["payload"]["group_id"].asUUID());
- return false;
+ LLGroupMgr::getInstance()->
+ sendGroupMemberJoin(notification["payload"]["group_id"].asUUID());
+ return false;
}
// static
void LLGroupActions::leave(const LLUUID& group_id)
{
- if (group_id.isNull())
- {
- return;
- }
-
- LLGroupData group_data;
- if (gAgent.getGroupData(group_id, group_data))
- {
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (!gdatap || !gdatap->isMemberDataComplete())
- {
- if (gFetchLeaveGroupData != NULL)
- {
- delete gFetchLeaveGroupData;
- gFetchLeaveGroupData = NULL;
- }
- gFetchLeaveGroupData = new LLFetchLeaveGroupData(group_id);
- }
- else
- {
- processLeaveGroupDataResponse(group_id);
- }
- }
+ if (group_id.isNull())
+ {
+ return;
+ }
+
+ LLGroupData group_data;
+ if (gAgent.getGroupData(group_id, group_data))
+ {
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ if (!gdatap || !gdatap->isMemberDataComplete())
+ {
+ if (gFetchLeaveGroupData != NULL)
+ {
+ delete gFetchLeaveGroupData;
+ gFetchLeaveGroupData = NULL;
+ }
+ gFetchLeaveGroupData = new LLFetchLeaveGroupData(group_id);
+ }
+ else
+ {
+ processLeaveGroupDataResponse(group_id);
+ }
+ }
}
//static
void LLGroupActions::processLeaveGroupDataResponse(const LLUUID group_id)
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
- LLUUID agent_id = gAgent.getID();
- LLGroupMgrGroupData::member_list_t::iterator mit = gdatap->mMembers.find(agent_id);
- //get the member data for the group
- if ( mit != gdatap->mMembers.end() )
- {
- LLGroupMemberData* member_data = (*mit).second;
-
- if ( member_data && member_data->isOwner() && gdatap->mMemberCount == 1)
- {
- LLNotificationsUtil::add("OwnerCannotLeaveGroup");
- return;
- }
- }
- LLSD args;
- args["GROUP"] = gdatap->mName;
- LLSD payload;
- payload["group_id"] = group_id;
- LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, onLeaveGroup);
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ LLUUID agent_id = gAgent.getID();
+ LLGroupMgrGroupData::member_list_t::iterator mit = gdatap->mMembers.find(agent_id);
+ //get the member data for the group
+ if ( mit != gdatap->mMembers.end() )
+ {
+ LLGroupMemberData* member_data = (*mit).second;
+
+ if ( member_data && member_data->isOwner() && gdatap->mMemberCount == 1)
+ {
+ LLNotificationsUtil::add("OwnerCannotLeaveGroup");
+ return;
+ }
+ }
+ LLSD args;
+ args["GROUP"] = gdatap->mName;
+ LLSD payload;
+ payload["group_id"] = group_id;
+ LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, onLeaveGroup);
}
// static
void LLGroupActions::activate(const LLUUID& group_id)
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ActivateGroup);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_GroupID, group_id);
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ActivateGroup);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_GroupID, group_id);
+ gAgent.sendReliableMessage();
}
static bool isGroupUIVisible()
{
- static LLPanel* panel = 0;
- if(!panel)
- panel = LLFloaterSidePanelContainer::getPanel("people", "panel_group_info_sidetray");
- if(!panel)
- return false;
- return panel->isInVisibleChain();
+ static LLPanel* panel = 0;
+ if(!panel)
+ panel = LLFloaterSidePanelContainer::getPanel("people", "panel_group_info_sidetray");
+ if(!panel)
+ return false;
+ return panel->isInVisibleChain();
}
-// static
+// static
void LLGroupActions::inspect(const LLUUID& group_id)
{
- LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", group_id));
+ LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", group_id));
}
// static
void LLGroupActions::show(const LLUUID& group_id)
{
- if (group_id.isNull())
- return;
+ if (group_id.isNull())
+ return;
- LLSD params;
- params["group_id"] = group_id;
- params["open_tab_name"] = "panel_group_info_sidetray";
+ LLSD params;
+ params["group_id"] = group_id;
+ params["open_tab_name"] = "panel_group_info_sidetray";
- LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
+ LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
LLFloater *floater = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>("people");
if (!floater->isFrontmost())
{
@@ -424,126 +424,126 @@ void LLGroupActions::show(const LLUUID& group_id)
void LLGroupActions::refresh_notices()
{
- if(!isGroupUIVisible())
- return;
+ if(!isGroupUIVisible())
+ return;
- LLSD params;
- params["group_id"] = LLUUID::null;
- params["open_tab_name"] = "panel_group_info_sidetray";
- params["action"] = "refresh_notices";
+ LLSD params;
+ params["group_id"] = LLUUID::null;
+ params["open_tab_name"] = "panel_group_info_sidetray";
+ params["action"] = "refresh_notices";
- LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
+ LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
}
-//static
+//static
void LLGroupActions::refresh(const LLUUID& group_id)
{
- if(!isGroupUIVisible())
- return;
+ if(!isGroupUIVisible())
+ return;
- LLSD params;
- params["group_id"] = group_id;
- params["open_tab_name"] = "panel_group_info_sidetray";
- params["action"] = "refresh";
+ LLSD params;
+ params["group_id"] = group_id;
+ params["open_tab_name"] = "panel_group_info_sidetray";
+ params["action"] = "refresh";
- LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
+ LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
}
-//static
+//static
void LLGroupActions::createGroup()
{
- LLSD params;
- params["group_id"] = LLUUID::null;
- params["open_tab_name"] = "panel_group_creation_sidetray";
- params["action"] = "create";
+ LLSD params;
+ params["group_id"] = LLUUID::null;
+ params["open_tab_name"] = "panel_group_creation_sidetray";
+ params["action"] = "create";
- LLFloaterSidePanelContainer::showPanel("people", "panel_group_creation_sidetray", params);
+ LLFloaterSidePanelContainer::showPanel("people", "panel_group_creation_sidetray", params);
}
//static
void LLGroupActions::closeGroup(const LLUUID& group_id)
{
- if(!isGroupUIVisible())
- return;
+ if(!isGroupUIVisible())
+ return;
- LLSD params;
- params["group_id"] = group_id;
- params["open_tab_name"] = "panel_group_info_sidetray";
- params["action"] = "close";
+ LLSD params;
+ params["group_id"] = group_id;
+ params["open_tab_name"] = "panel_group_info_sidetray";
+ params["action"] = "close";
- LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
+ LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
}
// static
LLUUID LLGroupActions::startIM(const LLUUID& group_id)
{
- if (group_id.isNull()) return LLUUID::null;
-
- LLGroupData group_data;
- if (gAgent.getGroupData(group_id, group_data))
- {
- LLUUID session_id = gIMMgr->addSession(
- group_data.mName,
- IM_SESSION_GROUP_START,
- group_id);
- if (session_id != LLUUID::null)
- {
- LLFloaterIMContainer::getInstance()->showConversation(session_id);
- }
- make_ui_sound("UISndStartIM");
- return session_id;
- }
- else
- {
- // this should never happen, as starting a group IM session
- // relies on you belonging to the group and hence having the group data
- make_ui_sound("UISndInvalidOp");
- return LLUUID::null;
- }
+ if (group_id.isNull()) return LLUUID::null;
+
+ LLGroupData group_data;
+ if (gAgent.getGroupData(group_id, group_data))
+ {
+ LLUUID session_id = gIMMgr->addSession(
+ group_data.mName,
+ IM_SESSION_GROUP_START,
+ group_id);
+ if (session_id != LLUUID::null)
+ {
+ LLFloaterIMContainer::getInstance()->showConversation(session_id);
+ }
+ make_ui_sound("UISndStartIM");
+ return session_id;
+ }
+ else
+ {
+ // this should never happen, as starting a group IM session
+ // relies on you belonging to the group and hence having the group data
+ make_ui_sound("UISndInvalidOp");
+ return LLUUID::null;
+ }
}
// static
void LLGroupActions::endIM(const LLUUID& group_id)
{
- if (group_id.isNull())
- return;
-
- LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id);
- if (session_id != LLUUID::null)
- {
- gIMMgr->leaveSession(session_id);
- }
+ if (group_id.isNull())
+ return;
+
+ LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id);
+ if (session_id != LLUUID::null)
+ {
+ gIMMgr->leaveSession(session_id);
+ }
}
// static
bool LLGroupActions::isInGroup(const LLUUID& group_id)
{
- // *TODO: Move all the LLAgent group stuff into another class, such as
- // this one.
- return gAgent.isInGroup(group_id);
+ // *TODO: Move all the LLAgent group stuff into another class, such as
+ // this one.
+ return gAgent.isInGroup(group_id);
}
// static
bool LLGroupActions::isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID& avatar_id)
{
- if(group_id.isNull() || avatar_id.isNull())
- {
- return false;
- }
-
- LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id);
- if(!group_data)
- {
- return false;
- }
-
- if(group_data->mMembers.end() == group_data->mMembers.find(avatar_id))
- {
- return false;
- }
-
- return true;
+ if(group_id.isNull() || avatar_id.isNull())
+ {
+ return false;
+ }
+
+ LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id);
+ if(!group_data)
+ {
+ return false;
+ }
+
+ if(group_data->mMembers.end() == group_data->mMembers.find(avatar_id))
+ {
+ return false;
+ }
+
+ return true;
}
//-- Private methods ----------------------------------------------------------
@@ -551,18 +551,18 @@ bool LLGroupActions::isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID&
// static
bool LLGroupActions::onLeaveGroup(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLUUID group_id = notification["payload"]["group_id"].asUUID();
- if(option == 0)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_LeaveGroupRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_GroupData);
- msg->addUUIDFast(_PREHASH_GroupID, group_id);
- gAgent.sendReliableMessage();
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLUUID group_id = notification["payload"]["group_id"].asUUID();
+ if(option == 0)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_LeaveGroupRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_GroupData);
+ msg->addUUIDFast(_PREHASH_GroupID, group_id);
+ gAgent.sendReliableMessage();
+ }
+ return false;
}
diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h
index afc4686dd7..5a447f682f 100644
--- a/indra/newview/llgroupactions.h
+++ b/indra/newview/llgroupactions.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgroupactions.h
* @brief Group-related actions (join, leave, new, delete, etc)
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,92 +36,92 @@
class LLGroupActions
{
public:
- /**
- * Invokes group search floater.
- */
- static void search();
-
- /// Join a group. Assumes LLGroupMgr has data for that group already.
- static void join(const LLUUID& group_id);
-
- /**
- * Invokes "Leave Group" floater.
- */
- static void leave(const LLUUID& group_id);
-
- /**
- * Activate group.
- */
- static void activate(const LLUUID& group_id);
-
- /**
- * Show group information panel.
- */
- static void show(const LLUUID& group_id);
-
- /**
- * Show group inspector floater.
- */
- static void inspect(const LLUUID& group_id);
-
- /**
- * Refresh group information panel.
- */
- static void refresh(const LLUUID& group_id);
-
- /**
- * Refresh group notices panel.
- */
- static void refresh_notices();
-
- /**
- * Refresh group information panel.
- */
- static void createGroup();
-
- /**
- * Close group information panel.
- */
- static void closeGroup (const LLUUID& group_id);
-
- /**
- * Start group instant messaging session.
- */
- static LLUUID startIM(const LLUUID& group_id);
-
- /**
- * End group instant messaging session.
- */
- static void endIM(const LLUUID& group_id);
-
- /// Returns if the current user is a member of the group
- static bool isInGroup(const LLUUID& group_id);
-
- /**
- * Start a group voice call.
- */
- static void startCall(const LLUUID& group_id);
-
- /**
- * Returns true if avatar is in group.
- *
- * Note that data about group members is loaded from server.
- * If data has not been loaded yet, function will return inaccurate result.
- * See LLGroupMgr::sendGroupMembersRequest
- */
- static bool isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID& avatar_id);
-
+ /**
+ * Invokes group search floater.
+ */
+ static void search();
+
+ /// Join a group. Assumes LLGroupMgr has data for that group already.
+ static void join(const LLUUID& group_id);
+
+ /**
+ * Invokes "Leave Group" floater.
+ */
+ static void leave(const LLUUID& group_id);
+
+ /**
+ * Activate group.
+ */
+ static void activate(const LLUUID& group_id);
+
+ /**
+ * Show group information panel.
+ */
+ static void show(const LLUUID& group_id);
+
+ /**
+ * Show group inspector floater.
+ */
+ static void inspect(const LLUUID& group_id);
+
+ /**
+ * Refresh group information panel.
+ */
+ static void refresh(const LLUUID& group_id);
+
+ /**
+ * Refresh group notices panel.
+ */
+ static void refresh_notices();
+
+ /**
+ * Refresh group information panel.
+ */
+ static void createGroup();
+
+ /**
+ * Close group information panel.
+ */
+ static void closeGroup (const LLUUID& group_id);
+
+ /**
+ * Start group instant messaging session.
+ */
+ static LLUUID startIM(const LLUUID& group_id);
+
+ /**
+ * End group instant messaging session.
+ */
+ static void endIM(const LLUUID& group_id);
+
+ /// Returns if the current user is a member of the group
+ static bool isInGroup(const LLUUID& group_id);
+
+ /**
+ * Start a group voice call.
+ */
+ static void startCall(const LLUUID& group_id);
+
+ /**
+ * Returns true if avatar is in group.
+ *
+ * Note that data about group members is loaded from server.
+ * If data has not been loaded yet, function will return inaccurate result.
+ * See LLGroupMgr::sendGroupMembersRequest
+ */
+ static bool isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID& avatar_id);
+
private:
- static bool onJoinGroup(const LLSD& notification, const LLSD& response);
- static bool onLeaveGroup(const LLSD& notification, const LLSD& response);
-
- /**
- * This function is called by LLFetchLeaveGroupData upon receiving a response to a group
- * members data request.
- */
- static void processLeaveGroupDataResponse(const LLUUID group_id);
-
- friend class LLFetchLeaveGroupData;
+ static bool onJoinGroup(const LLSD& notification, const LLSD& response);
+ static bool onLeaveGroup(const LLSD& notification, const LLSD& response);
+
+ /**
+ * This function is called by LLFetchLeaveGroupData upon receiving a response to a group
+ * members data request.
+ */
+ static void processLeaveGroupDataResponse(const LLUUID group_id);
+
+ friend class LLFetchLeaveGroupData;
};
#endif // LL_LLGROUPACTIONS_H
diff --git a/indra/newview/llgroupiconctrl.cpp b/indra/newview/llgroupiconctrl.cpp
index 7c2a3cad43..af2b3c10c5 100644
--- a/indra/newview/llgroupiconctrl.cpp
+++ b/indra/newview/llgroupiconctrl.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgroupiconctrl.cpp
* @brief LLGroupIconCtrl class implementation
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,9 +34,9 @@
static LLDefaultChildRegistry::Register<LLGroupIconCtrl> g_i("group_icon");
LLGroupIconCtrl::Params::Params()
-: group_id("group_id"),
- draw_tooltip("draw_tooltip", true),
- default_icon_name("default_icon_name")
+: group_id("group_id"),
+ draw_tooltip("draw_tooltip", true),
+ default_icon_name("default_icon_name")
{
changeDefault(min_width, 32);
changeDefault(min_height, 32);
@@ -44,12 +44,12 @@ LLGroupIconCtrl::Params::Params()
LLGroupIconCtrl::LLGroupIconCtrl(const LLGroupIconCtrl::Params& p)
-: LLIconCtrl(p),
- mGroupId(LLUUID::null),
- mDrawTooltip(p.draw_tooltip),
- mDefaultIconName(p.default_icon_name)
+: LLIconCtrl(p),
+ mGroupId(LLUUID::null),
+ mDrawTooltip(p.draw_tooltip),
+ mDefaultIconName(p.default_icon_name)
{
- mPriority = LLViewerFetchedTexture::BOOST_ICON;
+ mPriority = LLViewerFetchedTexture::BOOST_ICON;
// don't request larger image then necessary to save gl memory,
// but ensure that quality is sufficient
@@ -57,21 +57,21 @@ LLGroupIconCtrl::LLGroupIconCtrl(const LLGroupIconCtrl::Params& p)
mMaxHeight = llmax((S32)p.min_height, rect.getHeight());
mMaxWidth = llmax((S32)p.min_width, rect.getWidth());
- if (p.group_id.isProvided())
- {
- LLSD value(p.group_id);
- setValue(value);
- }
- else
- {
- //TODO: Consider implementing dedicated setDefault() function instead of passing priority for local file
- LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
- }
+ if (p.group_id.isProvided())
+ {
+ LLSD value(p.group_id);
+ setValue(value);
+ }
+ else
+ {
+ //TODO: Consider implementing dedicated setDefault() function instead of passing priority for local file
+ LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
+ }
}
LLGroupIconCtrl::~LLGroupIconCtrl()
{
- LLGroupMgr::getInstance()->removeObserver(this);
+ LLGroupMgr::getInstance()->removeObserver(this);
}
void LLGroupIconCtrl::setIconId(const LLUUID& icon_id)
@@ -88,57 +88,57 @@ void LLGroupIconCtrl::setIconId(const LLUUID& icon_id)
void LLGroupIconCtrl::setValue(const LLSD& value)
{
- if (value.isUUID())
- {
- LLGroupMgr* gm = LLGroupMgr::getInstance();
- if (mGroupId.notNull())
- {
- gm->removeObserver(this);
- }
-
- if (mGroupId != value.asUUID())
- {
- mGroupId = value.asUUID();
- mID = mGroupId; // set LLGroupMgrObserver::mID to make callbacks work
-
- // Check if cache already contains image_id for that group
- if (!updateFromCache())
- {
- LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
- gm->addObserver(this);
- gm->sendGroupPropertiesRequest(mGroupId);
- }
- }
- }
- else
- {
- LLIconCtrl::setValue(value);
- }
+ if (value.isUUID())
+ {
+ LLGroupMgr* gm = LLGroupMgr::getInstance();
+ if (mGroupId.notNull())
+ {
+ gm->removeObserver(this);
+ }
+
+ if (mGroupId != value.asUUID())
+ {
+ mGroupId = value.asUUID();
+ mID = mGroupId; // set LLGroupMgrObserver::mID to make callbacks work
+
+ // Check if cache already contains image_id for that group
+ if (!updateFromCache())
+ {
+ LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI);
+ gm->addObserver(this);
+ gm->sendGroupPropertiesRequest(mGroupId);
+ }
+ }
+ }
+ else
+ {
+ LLIconCtrl::setValue(value);
+ }
}
void LLGroupIconCtrl::changed(LLGroupChange gc)
{
- if (GC_PROPERTIES == gc)
- {
- updateFromCache();
- }
+ if (GC_PROPERTIES == gc)
+ {
+ updateFromCache();
+ }
}
bool LLGroupIconCtrl::updateFromCache()
{
- LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mGroupId);
- if (!group_data) return false;
-
- setIconId(group_data->mInsigniaID);
-
- if (mDrawTooltip && !group_data->mName.empty())
- {
- setToolTip(group_data->mName);
- }
- else
- {
- setToolTip(LLStringUtil::null);
- }
- return true;
+ LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mGroupId);
+ if (!group_data) return false;
+
+ setIconId(group_data->mInsigniaID);
+
+ if (mDrawTooltip && !group_data->mName.empty())
+ {
+ setToolTip(group_data->mName);
+ }
+ else
+ {
+ setToolTip(LLStringUtil::null);
+ }
+ return true;
}
diff --git a/indra/newview/llgroupiconctrl.h b/indra/newview/llgroupiconctrl.h
index 43e384d3e2..b646695bc8 100644
--- a/indra/newview/llgroupiconctrl.h
+++ b/indra/newview/llgroupiconctrl.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgroupiconctrl.h
* @brief LLGroupIconCtrl class declaration
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,62 +33,62 @@
/**
* Extends IconCtrl to show group icon wherever it is needed.
- *
+ *
* It gets icon id by group id from the LLGroupMgr.
* If group data is not loaded yet it subscribes as LLGroupMgr observer and requests necessary data.
*/
class LLGroupIconCtrl
- : public LLIconCtrl, public LLGroupMgrObserver
+ : public LLIconCtrl, public LLGroupMgrObserver
{
public:
- struct Params : public LLInitParam::Block<Params, LLIconCtrl::Params>
- {
- Optional <LLUUID> group_id;
- Optional <bool> draw_tooltip;
- Optional <std::string> default_icon_name;
- Params();
- };
+ struct Params : public LLInitParam::Block<Params, LLIconCtrl::Params>
+ {
+ Optional <LLUUID> group_id;
+ Optional <bool> draw_tooltip;
+ Optional <std::string> default_icon_name;
+ Params();
+ };
protected:
- LLGroupIconCtrl(const Params&);
- friend class LLUICtrlFactory;
+ LLGroupIconCtrl(const Params&);
+ friend class LLUICtrlFactory;
public:
- virtual ~LLGroupIconCtrl();
+ virtual ~LLGroupIconCtrl();
- /**
- * Determines group icon id by group id and sets it as icon value.
- *
- * Icon id is got from the appropriate LLGroupMgrGroupData specified by group UUID.
- * If necessary it requests necessary data from the LLGroupMgr.
- *
- * @params value - if LLUUID - it is processed as group id otherwise base method is called.
- */
- virtual void setValue(const LLSD& value);
+ /**
+ * Determines group icon id by group id and sets it as icon value.
+ *
+ * Icon id is got from the appropriate LLGroupMgrGroupData specified by group UUID.
+ * If necessary it requests necessary data from the LLGroupMgr.
+ *
+ * @params value - if LLUUID - it is processed as group id otherwise base method is called.
+ */
+ virtual void setValue(const LLSD& value);
- /**
- * Sets icon_id as icon value directly. Avoids LLGroupMgr cache checks for group id
- * Uses default icon in case id is null.
- *
- * @params icon_id - it is processed as icon id, default image will be used in case id is null.
- */
- void setIconId(const LLUUID& icon_id);
+ /**
+ * Sets icon_id as icon value directly. Avoids LLGroupMgr cache checks for group id
+ * Uses default icon in case id is null.
+ *
+ * @params icon_id - it is processed as icon id, default image will be used in case id is null.
+ */
+ void setIconId(const LLUUID& icon_id);
- // LLGroupMgrObserver observer trigger
- virtual void changed(LLGroupChange gc);
+ // LLGroupMgrObserver observer trigger
+ virtual void changed(LLGroupChange gc);
- const std::string& getGroupName() const { return mGroupName; }
- void setDrawTooltip(bool value) { mDrawTooltip = value;}
+ const std::string& getGroupName() const { return mGroupName; }
+ void setDrawTooltip(bool value) { mDrawTooltip = value;}
- const LLUUID& getGroupId() const { return mGroupId; }
+ const LLUUID& getGroupId() const { return mGroupId; }
protected:
- LLUUID mGroupId;
- std::string mGroupName;
- bool mDrawTooltip;
- std::string mDefaultIconName;
+ LLUUID mGroupId;
+ std::string mGroupName;
+ bool mDrawTooltip;
+ std::string mDefaultIconName;
- bool updateFromCache();
+ bool updateFromCache();
};
#endif // LL_LLGROUPICONCTRL_H
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index 32af2592d3..12092a02c6 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgrouplist.cpp
* @brief List of the groups the agent belongs to.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,8 +40,8 @@
#include "llagent.h"
#include "llgroupactions.h"
#include "llfloaterreg.h"
-#include "llviewercontrol.h" // for gSavedSettings
-#include "llviewermenu.h" // for gMenuHolder
+#include "llviewercontrol.h" // for gSavedSettings
+#include "llviewermenu.h" // for gMenuHolder
#include "llvoiceclient.h"
static LLDefaultChildRegistry::Register<LLGroupList> r("group_list");
@@ -49,19 +49,19 @@ static LLDefaultChildRegistry::Register<LLGroupList> r("group_list");
class LLGroupComparator : public LLFlatListView::ItemComparator
{
public:
- LLGroupComparator() {};
+ LLGroupComparator() {};
- /** Returns true if item1 < item2, false otherwise */
- /*virtual*/ bool compare(const LLPanel* item1, const LLPanel* item2) const
- {
- std::string name1 = static_cast<const LLGroupListItem*>(item1)->getGroupName();
- std::string name2 = static_cast<const LLGroupListItem*>(item2)->getGroupName();
+ /** Returns true if item1 < item2, false otherwise */
+ /*virtual*/ bool compare(const LLPanel* item1, const LLPanel* item2) const
+ {
+ std::string name1 = static_cast<const LLGroupListItem*>(item1)->getGroupName();
+ std::string name2 = static_cast<const LLGroupListItem*>(item2)->getGroupName();
- LLStringUtil::toUpper(name1);
- LLStringUtil::toUpper(name2);
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
- return name1 < name2;
- }
+ return name1 < name2;
+ }
};
class LLSharedGroupComparator : public LLFlatListView::ItemComparator
@@ -100,15 +100,15 @@ LLGroupList::Params::Params()
}
LLGroupList::LLGroupList(const Params& p)
-: LLFlatListViewEx(p)
+: LLFlatListViewEx(p)
, mForAgent(p.for_agent)
- , mDirty(true) // to force initial update
+ , mDirty(true) // to force initial update
, mShowIcons(false)
, mShowNone(true)
{
- setCommitOnSelectionChange(true);
+ setCommitOnSelectionChange(true);
- // Set default sort order.
+ // Set default sort order.
if (mForAgent)
{
setComparator(&GROUP_COMPARATOR);
@@ -120,7 +120,7 @@ LLGroupList::LLGroupList(const Params& p)
}
if (mForAgent)
- {
+ {
enableForAgent(true);
}
}
@@ -140,32 +140,32 @@ void LLGroupList::enableForAgent(bool show_icons)
// Listen for agent group changes.
gAgent.addListener(this, "new group");
- // Set up context menu.
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+ // Set up context menu.
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- registrar.add("People.Groups.Action", boost::bind(&LLGroupList::onContextMenuItemClick, this, _2));
- enable_registrar.add("People.Groups.Enable", boost::bind(&LLGroupList::onContextMenuItemEnable, this, _2));
+ registrar.add("People.Groups.Action", boost::bind(&LLGroupList::onContextMenuItemClick, this, _2));
+ enable_registrar.add("People.Groups.Enable", boost::bind(&LLGroupList::onContextMenuItemEnable, this, _2));
- LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_people_groups.xml",
- gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if(context_menu)
- mContextMenuHandle = context_menu->getHandle();
+ LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_people_groups.xml",
+ gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if(context_menu)
+ mContextMenuHandle = context_menu->getHandle();
}
// virtual
void LLGroupList::draw()
{
- if (mDirty)
- refresh();
+ if (mDirty)
+ refresh();
- LLFlatListView::draw();
+ LLFlatListView::draw();
}
// virtual
BOOL LLGroupList::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
+ BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
if (mForAgent)
{
@@ -176,40 +176,40 @@ BOOL LLGroupList::handleRightMouseDown(S32 x, S32 y, MASK mask)
context_menu->updateParent(LLMenuGL::sMenuContainer);
LLMenuGL::showPopup(this, context_menu, x, y);
}
- }
+ }
- return handled;
+ return handled;
}
// virtual
BOOL LLGroupList::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLView::handleDoubleClick(x, y, mask);
- // Handle double click only for the selected item in the list, skip clicks on empty space.
- if (handled)
- {
- if (mDoubleClickSignal && getItemsRect().pointInRect(x, y))
- {
- (*mDoubleClickSignal)(this, x, y, mask);
- }
- }
+ BOOL handled = LLView::handleDoubleClick(x, y, mask);
+ // Handle double click only for the selected item in the list, skip clicks on empty space.
+ if (handled)
+ {
+ if (mDoubleClickSignal && getItemsRect().pointInRect(x, y))
+ {
+ (*mDoubleClickSignal)(this, x, y, mask);
+ }
+ }
- return handled;
+ return handled;
}
void LLGroupList::setNameFilter(const std::string& filter)
{
- std::string filter_upper = filter;
- LLStringUtil::toUpper(filter_upper);
- if (mNameFilter != filter_upper)
- {
- mNameFilter = filter_upper;
+ std::string filter_upper = filter;
+ LLStringUtil::toUpper(filter_upper);
+ if (mNameFilter != filter_upper)
+ {
+ mNameFilter = filter_upper;
- // set no items message depend on filter state
- updateNoItemsMessage(filter);
+ // set no items message depend on filter state
+ updateNoItemsMessage(filter);
- setDirty();
- }
+ setDirty();
+ }
}
static bool findInsensitive(std::string haystack, const std::string& needle_upper)
@@ -222,10 +222,10 @@ void LLGroupList::refresh()
{
if (mForAgent)
{
- const LLUUID& highlight_id = gAgent.getGroupID();
- S32 count = gAgent.mGroups.size();
- LLUUID id;
- bool have_filter = !mNameFilter.empty();
+ const LLUUID& highlight_id = gAgent.getGroupID();
+ S32 count = gAgent.mGroups.size();
+ LLUUID id;
+ bool have_filter = !mNameFilter.empty();
clear();
@@ -264,23 +264,23 @@ void LLGroupList::refresh()
sort();
}
- setDirty(false);
- onCommit();
+ setDirty(false);
+ onCommit();
}
void LLGroupList::toggleIcons()
{
- // Save the new value for new items to use.
- mShowIcons = !mShowIcons;
- gSavedSettings.setBOOL("GroupListShowIcons", mShowIcons);
+ // Save the new value for new items to use.
+ mShowIcons = !mShowIcons;
+ gSavedSettings.setBOOL("GroupListShowIcons", mShowIcons);
- // Show/hide icons for all existing items.
- std::vector<LLPanel*> items;
- getItems(items);
- for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
- {
- static_cast<LLGroupListItem*>(*it)->setGroupIconVisible(mShowIcons);
- }
+ // Show/hide icons for all existing items.
+ std::vector<LLPanel*> items;
+ getItems(items);
+ for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
+ {
+ static_cast<LLGroupListItem*>(*it)->setGroupIconVisible(mShowIcons);
+ }
}
void LLGroupList::setGroups(const std::map< std::string,LLUUID> group_list)
@@ -295,33 +295,33 @@ void LLGroupList::setGroups(const std::map< std::string,LLUUID> group_list)
void LLGroupList::addNewItem(const LLUUID& id, const std::string& name, const LLUUID& icon_id, EAddPosition pos, bool visible_in_profile)
{
- LLGroupListItem* item = new LLGroupListItem(mForAgent, mShowIcons);
+ LLGroupListItem* item = new LLGroupListItem(mForAgent, mShowIcons);
- item->setGroupID(id);
- item->setName(name, mNameFilter);
- item->setGroupIconID(icon_id);
+ item->setGroupID(id);
+ item->setName(name, mNameFilter);
+ item->setGroupIconID(icon_id);
- item->getChildView("info_btn")->setVisible( false);
- item->getChildView("profile_btn")->setVisible( false);
- item->setGroupIconVisible(mShowIcons);
+ item->getChildView("info_btn")->setVisible( false);
+ item->getChildView("profile_btn")->setVisible( false);
+ item->setGroupIconVisible(mShowIcons);
if (!mShowIcons)
{
item->setVisibleInProfile(visible_in_profile);
}
- addItem(item, id, pos);
+ addItem(item, id, pos);
-// setCommentVisible(false);
+// setCommentVisible(false);
}
// virtual
bool LLGroupList::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- // Why is "new group" sufficient?
- if (event->desc() == "new group")
- {
- setDirty();
- return true;
- }
+ // Why is "new group" sufficient?
+ if (event->desc() == "new group")
+ {
+ setDirty();
+ return true;
+ }
if (event->desc() == "value_changed")
{
@@ -346,51 +346,51 @@ bool LLGroupList::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD&
return true;
}
- return false;
+ return false;
}
bool LLGroupList::onContextMenuItemClick(const LLSD& userdata)
{
- std::string action = userdata.asString();
- LLUUID selected_group = getSelectedUUID();
-
- if (action == "view_info")
- {
- LLGroupActions::show(selected_group);
- }
- else if (action == "chat")
- {
- LLGroupActions::startIM(selected_group);
- }
- else if (action == "call")
- {
- LLGroupActions::startCall(selected_group);
- }
- else if (action == "activate")
- {
- LLGroupActions::activate(selected_group);
- }
- else if (action == "leave")
- {
- LLGroupActions::leave(selected_group);
- }
-
- return true;
+ std::string action = userdata.asString();
+ LLUUID selected_group = getSelectedUUID();
+
+ if (action == "view_info")
+ {
+ LLGroupActions::show(selected_group);
+ }
+ else if (action == "chat")
+ {
+ LLGroupActions::startIM(selected_group);
+ }
+ else if (action == "call")
+ {
+ LLGroupActions::startCall(selected_group);
+ }
+ else if (action == "activate")
+ {
+ LLGroupActions::activate(selected_group);
+ }
+ else if (action == "leave")
+ {
+ LLGroupActions::leave(selected_group);
+ }
+
+ return true;
}
bool LLGroupList::onContextMenuItemEnable(const LLSD& userdata)
{
- LLUUID selected_group_id = getSelectedUUID();
- bool real_group_selected = selected_group_id.notNull(); // a "real" (not "none") group is selected
+ LLUUID selected_group_id = getSelectedUUID();
+ bool real_group_selected = selected_group_id.notNull(); // a "real" (not "none") group is selected
- // each group including "none" can be activated
- if (userdata.asString() == "activate")
- return gAgent.getGroupID() != selected_group_id;
+ // each group including "none" can be activated
+ if (userdata.asString() == "activate")
+ return gAgent.getGroupID() != selected_group_id;
- if (userdata.asString() == "call")
- return real_group_selected && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+ if (userdata.asString() == "call")
+ return real_group_selected && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
- return real_group_selected;
+ return real_group_selected;
}
/************************************************************************/
@@ -398,7 +398,7 @@ bool LLGroupList::onContextMenuItemEnable(const LLSD& userdata)
/************************************************************************/
LLGroupListItem::LLGroupListItem(bool for_agent, bool show_icons)
-: LLPanel(),
+: LLPanel(),
mGroupIcon(NULL),
mGroupNameBox(NULL),
mInfoBtn(NULL),
@@ -420,17 +420,17 @@ mForAgent(for_agent)
LLGroupListItem::~LLGroupListItem()
{
- LLGroupMgr::getInstance()->removeObserver(this);
+ LLGroupMgr::getInstance()->removeObserver(this);
}
//virtual
BOOL LLGroupListItem::postBuild()
{
- mGroupIcon = getChild<LLGroupIconCtrl>("group_icon");
- mGroupNameBox = getChild<LLTextBox>("group_name");
+ mGroupIcon = getChild<LLGroupIconCtrl>("group_icon");
+ mGroupNameBox = getChild<LLTextBox>("group_name");
- mInfoBtn = getChild<LLButton>("info_btn");
- mInfoBtn->setClickedCallback(boost::bind(&LLGroupListItem::onInfoBtnClick, this));
+ mInfoBtn = getChild<LLButton>("info_btn");
+ mInfoBtn->setClickedCallback(boost::bind(&LLGroupListItem::onInfoBtnClick, this));
mProfileBtn = getChild<LLButton>("profile_btn");
mProfileBtn->setClickedCallback([this](LLUICtrl *, const LLSD &) { onProfileBtnClick(); });
@@ -452,23 +452,23 @@ BOOL LLGroupListItem::postBuild()
// have icons of different sizes so we need to figure it per file.
mIconWidth = mGroupNameBox->getRect().mLeft - mGroupIcon->getRect().mLeft;
- return TRUE;
+ return TRUE;
}
//virtual
void LLGroupListItem::setValue( const LLSD& value )
{
- if (!value.isMap()) return;
- if (!value.has("selected")) return;
- getChildView("selected_icon")->setVisible( value["selected"]);
+ if (!value.isMap()) return;
+ if (!value.has("selected")) return;
+ getChildView("selected_icon")->setVisible( value["selected"]);
}
void LLGroupListItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible( true);
- if (mGroupID.notNull()) // don't show the info button for the "none" group
- {
- mInfoBtn->setVisible(true);
+ getChildView("hovered_icon")->setVisible( true);
+ if (mGroupID.notNull()) // don't show the info button for the "none" group
+ {
+ mInfoBtn->setVisible(true);
mProfileBtn->setVisible(true);
if (mForAgent && mVisibilityHideBtn)
{
@@ -479,15 +479,15 @@ void LLGroupListItem::onMouseEnter(S32 x, S32 y, MASK mask)
mVisibilityShowBtn->setVisible(!agent_gdatap.mListInProfile);
}
}
- }
+ }
- LLPanel::onMouseEnter(x, y, mask);
+ LLPanel::onMouseEnter(x, y, mask);
}
void LLGroupListItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible( false);
- mInfoBtn->setVisible(false);
+ getChildView("hovered_icon")->setVisible( false);
+ mInfoBtn->setVisible(false);
mProfileBtn->setVisible(false);
if (mVisibilityHideBtn)
{
@@ -495,22 +495,22 @@ void LLGroupListItem::onMouseLeave(S32 x, S32 y, MASK mask)
mVisibilityShowBtn->setVisible(false);
}
- LLPanel::onMouseLeave(x, y, mask);
+ LLPanel::onMouseLeave(x, y, mask);
}
void LLGroupListItem::setName(const std::string& name, const std::string& highlight)
{
- mGroupName = name;
- LLTextUtil::textboxSetHighlightedVal(mGroupNameBox, mGroupNameStyle, name, highlight);
- mGroupNameBox->setToolTip(name);
+ mGroupName = name;
+ LLTextUtil::textboxSetHighlightedVal(mGroupNameBox, mGroupNameStyle, name, highlight);
+ mGroupNameBox->setToolTip(name);
}
void LLGroupListItem::setGroupID(const LLUUID& group_id)
{
- LLGroupMgr::getInstance()->removeObserver(this);
-
- mID = group_id;
- mGroupID = group_id;
+ LLGroupMgr::getInstance()->removeObserver(this);
+
+ mID = group_id;
+ mGroupID = group_id;
if (mForAgent)
{
@@ -523,27 +523,27 @@ void LLGroupListItem::setGroupID(const LLUUID& group_id)
setBold(gAgent.isInGroup(group_id, true));
}
- LLGroupMgr::getInstance()->addObserver(this);
+ LLGroupMgr::getInstance()->addObserver(this);
}
void LLGroupListItem::setGroupIconID(const LLUUID& group_icon_id)
{
- mGroupIcon->setIconId(group_icon_id);
+ mGroupIcon->setIconId(group_icon_id);
}
void LLGroupListItem::setGroupIconVisible(bool visible)
{
- // Already done? Then do nothing.
- if (mGroupIcon->getVisible() == (BOOL)visible)
- return;
+ // Already done? Then do nothing.
+ if (mGroupIcon->getVisible() == (BOOL)visible)
+ return;
- // Show/hide the group icon.
- mGroupIcon->setVisible(visible);
+ // Show/hide the group icon.
+ mGroupIcon->setVisible(visible);
- // Move the group name horizontally by icon size + its distance from the group name.
- LLRect name_rect = mGroupNameBox->getRect();
- name_rect.mLeft += visible ? mIconWidth : -mIconWidth;
- mGroupNameBox->setRect(name_rect);
+ // Move the group name horizontally by icon size + its distance from the group name.
+ LLRect name_rect = mGroupNameBox->getRect();
+ name_rect.mLeft += visible ? mIconWidth : -mIconWidth;
+ mGroupNameBox->setRect(name_rect);
}
void LLGroupListItem::setVisibleInProfile(bool visible)
@@ -556,31 +556,31 @@ void LLGroupListItem::setVisibleInProfile(bool visible)
//////////////////////////////////////////////////////////////////////////
void LLGroupListItem::setBold(bool bold)
{
- // *BUG: setName() overrides the style params.
+ // *BUG: setName() overrides the style params.
- LLFontDescriptor new_desc(mGroupNameBox->getFont()->getFontDesc());
+ LLFontDescriptor new_desc(mGroupNameBox->getFont()->getFontDesc());
- // *NOTE dzaporozhan
- // On Windows LLFontGL::NORMAL will not remove LLFontGL::BOLD if font
- // is predefined as bold (SansSerifSmallBold, for example)
- new_desc.setStyle(bold ? LLFontGL::BOLD : LLFontGL::NORMAL);
- LLFontGL* new_font = LLFontGL::getFont(new_desc);
- mGroupNameStyle.font = new_font;
+ // *NOTE dzaporozhan
+ // On Windows LLFontGL::NORMAL will not remove LLFontGL::BOLD if font
+ // is predefined as bold (SansSerifSmallBold, for example)
+ new_desc.setStyle(bold ? LLFontGL::BOLD : LLFontGL::NORMAL);
+ LLFontGL* new_font = LLFontGL::getFont(new_desc);
+ mGroupNameStyle.font = new_font;
- // *NOTE: You cannot set the style on a text box anymore, you must
- // rebuild the text. This will cause problems if the text contains
- // hyperlinks, as their styles will be wrong.
- mGroupNameBox->setText(mGroupName, mGroupNameStyle);
+ // *NOTE: You cannot set the style on a text box anymore, you must
+ // rebuild the text. This will cause problems if the text contains
+ // hyperlinks, as their styles will be wrong.
+ mGroupNameBox->setText(mGroupName, mGroupNameStyle);
}
void LLGroupListItem::onInfoBtnClick()
{
- LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", mGroupID));
+ LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", mGroupID));
}
void LLGroupListItem::onProfileBtnClick()
{
- LLGroupActions::show(mGroupID);
+ LLGroupActions::show(mGroupID);
}
void LLGroupListItem::onVisibilityBtnClick(bool new_visibility)
@@ -597,8 +597,8 @@ void LLGroupListItem::onVisibilityBtnClick(bool new_visibility)
void LLGroupListItem::changed(LLGroupChange gc)
{
- LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mID);
- if ((gc == GC_ALL || gc == GC_PROPERTIES) && group_data)
+ LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mID);
+ if ((gc == GC_ALL || gc == GC_PROPERTIES) && group_data)
{
setGroupIconID(group_data->mInsigniaID);
}
diff --git a/indra/newview/llgrouplist.h b/indra/newview/llgrouplist.h
index 5cbabb712f..69257a2d7c 100644
--- a/indra/newview/llgrouplist.h
+++ b/indra/newview/llgrouplist.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgrouplist.h
* @brief List of the groups the agent belongs to.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,58 +39,58 @@
/**
* Auto-updating list of agent groups.
- *
+ *
* Can use optional group name filter.
- *
+ *
* @see setNameFilter()
*/
class LLGroupList: public LLFlatListViewEx, public LLOldEvents::LLSimpleListener
{
- LOG_CLASS(LLGroupList);
+ LOG_CLASS(LLGroupList);
public:
- struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
- {
+ struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
+ {
Optional<bool> for_agent;
Params();
- };
+ };
- LLGroupList(const Params& p);
- virtual ~LLGroupList();
+ LLGroupList(const Params& p);
+ virtual ~LLGroupList();
void enableForAgent(bool show_icons);
- virtual void draw(); // from LLView
- /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView
- /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); // from LLView
+ virtual void draw(); // from LLView
+ /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); // from LLView
- void setNameFilter(const std::string& filter);
- void toggleIcons();
- bool getIconsVisible() const { return mShowIcons; }
+ void setNameFilter(const std::string& filter);
+ void toggleIcons();
+ bool getIconsVisible() const { return mShowIcons; }
void setIconsVisible(bool show_icons) { mShowIcons = show_icons; }
void setShowNone(bool show_none) { mShowNone = show_none; }
void setGroups(const std::map< std::string,LLUUID> group_list);
- LLToggleableMenu* getContextMenu() const { return mContextMenuHandle.get(); }
+ LLToggleableMenu* getContextMenu() const { return mContextMenuHandle.get(); }
private:
- void setDirty(bool val = true) { mDirty = val; }
- void refresh();
- void addNewItem(const LLUUID& id, const std::string& name, const LLUUID& icon_id, EAddPosition pos = ADD_BOTTOM, bool visible_in_profile = true);
- bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); // called on agent group list changes
+ void setDirty(bool val = true) { mDirty = val; }
+ void refresh();
+ void addNewItem(const LLUUID& id, const std::string& name, const LLUUID& icon_id, EAddPosition pos = ADD_BOTTOM, bool visible_in_profile = true);
+ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); // called on agent group list changes
- bool onContextMenuItemClick(const LLSD& userdata);
- bool onContextMenuItemEnable(const LLSD& userdata);
+ bool onContextMenuItemClick(const LLSD& userdata);
+ bool onContextMenuItemEnable(const LLSD& userdata);
- LLHandle<LLToggleableMenu> mContextMenuHandle;
+ LLHandle<LLToggleableMenu> mContextMenuHandle;
- bool mShowIcons;
- bool mDirty;
- std::string mNameFilter;
+ bool mShowIcons;
+ bool mDirty;
+ std::string mNameFilter;
bool mForAgent;
bool mShowNone;
- typedef std::map< std::string,LLUUID> group_map_t;
- group_map_t mGroups;
+ typedef std::map< std::string,LLUUID> group_map_t;
+ group_map_t mGroups;
};
class LLButton;
@@ -98,45 +98,45 @@ class LLGroupIconCtrl;
class LLTextBox;
class LLGroupListItem : public LLPanel
- , public LLGroupMgrObserver
+ , public LLGroupMgrObserver
{
public:
LLGroupListItem(bool for_agent, bool show_icons);
- ~LLGroupListItem();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void setValue(const LLSD& value);
- void onMouseEnter(S32 x, S32 y, MASK mask);
- void onMouseLeave(S32 x, S32 y, MASK mask);
+ ~LLGroupListItem();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void setValue(const LLSD& value);
+ void onMouseEnter(S32 x, S32 y, MASK mask);
+ void onMouseLeave(S32 x, S32 y, MASK mask);
- const LLUUID& getGroupID() const { return mGroupID; }
- const std::string& getGroupName() const { return mGroupName; }
+ const LLUUID& getGroupID() const { return mGroupID; }
+ const std::string& getGroupName() const { return mGroupName; }
- void setName(const std::string& name, const std::string& highlight = LLStringUtil::null);
- void setGroupID(const LLUUID& group_id);
- void setGroupIconID(const LLUUID& group_icon_id);
- void setGroupIconVisible(bool visible);
+ void setName(const std::string& name, const std::string& highlight = LLStringUtil::null);
+ void setGroupID(const LLUUID& group_id);
+ void setGroupIconID(const LLUUID& group_icon_id);
+ void setGroupIconVisible(bool visible);
- virtual void changed(LLGroupChange gc);
+ virtual void changed(LLGroupChange gc);
void setVisibleInProfile(bool visible);
private:
- void setBold(bool bold);
- void onInfoBtnClick();
- void onProfileBtnClick();
+ void setBold(bool bold);
+ void onInfoBtnClick();
+ void onProfileBtnClick();
void onVisibilityBtnClick(bool new_visibility);
- LLTextBox* mGroupNameBox;
- LLUUID mGroupID;
- LLGroupIconCtrl* mGroupIcon;
- LLButton* mInfoBtn;
- LLButton* mProfileBtn;
- LLButton* mVisibilityHideBtn;
- LLButton* mVisibilityShowBtn;
+ LLTextBox* mGroupNameBox;
+ LLUUID mGroupID;
+ LLGroupIconCtrl* mGroupIcon;
+ LLButton* mInfoBtn;
+ LLButton* mProfileBtn;
+ LLButton* mVisibilityHideBtn;
+ LLButton* mVisibilityShowBtn;
- std::string mGroupName;
+ std::string mGroupName;
bool mForAgent;
- LLStyle::Params mGroupNameStyle;
+ LLStyle::Params mGroupNameStyle;
- S32 mIconWidth;
+ S32 mIconWidth;
};
#endif // LL_LLGROUPLIST_H
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index a9e5e55451..ceb3c63bc7 100644
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgroupmgr.cpp
* @brief LLGroupMgr class implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,7 +57,7 @@
#if LL_MSVC
-#pragma warning(push)
+#pragma warning(push)
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
#endif
@@ -79,27 +79,27 @@ LLRoleActionSet::LLRoleActionSet()
LLRoleActionSet::~LLRoleActionSet()
{
- delete mActionSetData;
- std::for_each(mActions.begin(), mActions.end(), DeletePointer());
- mActions.clear();
+ delete mActionSetData;
+ std::for_each(mActions.begin(), mActions.end(), DeletePointer());
+ mActions.clear();
}
//
// LLGroupMemberData
//
-LLGroupMemberData::LLGroupMemberData(const LLUUID& id,
- S32 contribution,
- U64 agent_powers,
- const std::string& title,
- const std::string& online_status,
- BOOL is_owner) :
- mID(id),
- mContribution(contribution),
- mAgentPowers(agent_powers),
- mTitle(title),
- mOnlineStatus(online_status),
- mIsOwner(is_owner)
+LLGroupMemberData::LLGroupMemberData(const LLUUID& id,
+ S32 contribution,
+ U64 agent_powers,
+ const std::string& title,
+ const std::string& online_status,
+ BOOL is_owner) :
+ mID(id),
+ mContribution(contribution),
+ mAgentPowers(agent_powers),
+ mTitle(title),
+ mOnlineStatus(online_status),
+ mIsOwner(is_owner)
{
}
@@ -109,114 +109,114 @@ LLGroupMemberData::~LLGroupMemberData()
void LLGroupMemberData::addRole(const LLUUID& role, LLGroupRoleData* rd)
{
- mRolesList[role] = rd;
+ mRolesList[role] = rd;
}
bool LLGroupMemberData::removeRole(const LLUUID& role)
{
- role_list_t::iterator it = mRolesList.find(role);
+ role_list_t::iterator it = mRolesList.find(role);
- if (it != mRolesList.end())
- {
- mRolesList.erase(it);
- return true;
- }
+ if (it != mRolesList.end())
+ {
+ mRolesList.erase(it);
+ return true;
+ }
- return false;
+ return false;
}
//
// LLGroupRoleData
//
-LLGroupRoleData::LLGroupRoleData(const LLUUID& role_id,
- const std::string& role_name,
- const std::string& role_title,
- const std::string& role_desc,
- const U64 role_powers,
- const S32 member_count) :
- mRoleID(role_id),
- mMemberCount(member_count),
- mMembersNeedsSort(FALSE)
+LLGroupRoleData::LLGroupRoleData(const LLUUID& role_id,
+ const std::string& role_name,
+ const std::string& role_title,
+ const std::string& role_desc,
+ const U64 role_powers,
+ const S32 member_count) :
+ mRoleID(role_id),
+ mMemberCount(member_count),
+ mMembersNeedsSort(FALSE)
{
- mRoleData.mRoleName = role_name;
- mRoleData.mRoleTitle = role_title;
- mRoleData.mRoleDescription = role_desc;
- mRoleData.mRolePowers = role_powers;
- mRoleData.mChangeType = RC_UPDATE_NONE;
+ mRoleData.mRoleName = role_name;
+ mRoleData.mRoleTitle = role_title;
+ mRoleData.mRoleDescription = role_desc;
+ mRoleData.mRolePowers = role_powers;
+ mRoleData.mChangeType = RC_UPDATE_NONE;
}
-LLGroupRoleData::LLGroupRoleData(const LLUUID& role_id,
- LLRoleData role_data,
- const S32 member_count) :
- mRoleID(role_id),
- mRoleData(role_data),
- mMemberCount(member_count),
- mMembersNeedsSort(FALSE)
+LLGroupRoleData::LLGroupRoleData(const LLUUID& role_id,
+ LLRoleData role_data,
+ const S32 member_count) :
+ mRoleID(role_id),
+ mRoleData(role_data),
+ mMemberCount(member_count),
+ mMembersNeedsSort(FALSE)
{
}
LLGroupRoleData::~LLGroupRoleData()
-{
+{
}
S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members,
- BOOL needs_sort)
-{
- if (mRoleID.isNull())
- {
- // This is the everyone role, just return the size of members,
- // because everyone is in the everyone role.
- return members.size();
- }
-
- // Sort the members list, if needed.
- if (mMembersNeedsSort)
- {
- std::sort(mMemberIDs.begin(), mMemberIDs.end());
- mMembersNeedsSort = FALSE;
- }
- if (needs_sort)
- {
- // Sort the members parameter.
- std::sort(members.begin(), members.end());
- }
-
- // Return the number of members in the intersection.
- S32 max_size = llmin( members.size(), mMemberIDs.size() );
- uuid_vec_t in_role( max_size );
- uuid_vec_t::iterator in_role_end;
- in_role_end = std::set_intersection(mMemberIDs.begin(), mMemberIDs.end(),
- members.begin(), members.end(),
- in_role.begin());
- return in_role_end - in_role.begin();
-}
-
+ BOOL needs_sort)
+{
+ if (mRoleID.isNull())
+ {
+ // This is the everyone role, just return the size of members,
+ // because everyone is in the everyone role.
+ return members.size();
+ }
+
+ // Sort the members list, if needed.
+ if (mMembersNeedsSort)
+ {
+ std::sort(mMemberIDs.begin(), mMemberIDs.end());
+ mMembersNeedsSort = FALSE;
+ }
+ if (needs_sort)
+ {
+ // Sort the members parameter.
+ std::sort(members.begin(), members.end());
+ }
+
+ // Return the number of members in the intersection.
+ S32 max_size = llmin( members.size(), mMemberIDs.size() );
+ uuid_vec_t in_role( max_size );
+ uuid_vec_t::iterator in_role_end;
+ in_role_end = std::set_intersection(mMemberIDs.begin(), mMemberIDs.end(),
+ members.begin(), members.end(),
+ in_role.begin());
+ return in_role_end - in_role.begin();
+}
+
void LLGroupRoleData::addMember(const LLUUID& member)
{
- mMembersNeedsSort = TRUE;
- mMemberIDs.push_back(member);
+ mMembersNeedsSort = TRUE;
+ mMemberIDs.push_back(member);
}
bool LLGroupRoleData::removeMember(const LLUUID& member)
{
- uuid_vec_t::iterator it = std::find(mMemberIDs.begin(),mMemberIDs.end(),member);
+ uuid_vec_t::iterator it = std::find(mMemberIDs.begin(),mMemberIDs.end(),member);
- if (it != mMemberIDs.end())
- {
- mMembersNeedsSort = TRUE;
- mMemberIDs.erase(it);
- return true;
- }
+ if (it != mMemberIDs.end())
+ {
+ mMembersNeedsSort = TRUE;
+ mMemberIDs.erase(it);
+ return true;
+ }
- return false;
+ return false;
}
void LLGroupRoleData::clearMembers()
{
- mMembersNeedsSort = FALSE;
- mMemberIDs.clear();
+ mMembersNeedsSort = FALSE;
+ mMemberIDs.clear();
}
@@ -224,608 +224,608 @@ void LLGroupRoleData::clearMembers()
// LLGroupMgrGroupData
//
-LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) :
- mID(id),
- mShowInList(TRUE),
- mOpenEnrollment(FALSE),
- mMembershipFee(0),
- mAllowPublish(FALSE),
- mListInProfile(FALSE),
- mMaturePublish(FALSE),
- mChanged(FALSE),
- mMemberCount(0),
- mRoleCount(0),
- mReceivedRoleMemberPairs(0),
- mMemberDataComplete(false),
- mRoleDataComplete(false),
- mRoleMemberDataComplete(false),
- mGroupPropertiesDataComplete(false),
- mPendingRoleMemberRequest(false),
- mAccessTime(0.0f),
- mPendingBanRequest(false)
-{
- mMemberVersion.generate();
+LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) :
+ mID(id),
+ mShowInList(TRUE),
+ mOpenEnrollment(FALSE),
+ mMembershipFee(0),
+ mAllowPublish(FALSE),
+ mListInProfile(FALSE),
+ mMaturePublish(FALSE),
+ mChanged(FALSE),
+ mMemberCount(0),
+ mRoleCount(0),
+ mReceivedRoleMemberPairs(0),
+ mMemberDataComplete(false),
+ mRoleDataComplete(false),
+ mRoleMemberDataComplete(false),
+ mGroupPropertiesDataComplete(false),
+ mPendingRoleMemberRequest(false),
+ mAccessTime(0.0f),
+ mPendingBanRequest(false)
+{
+ mMemberVersion.generate();
}
void LLGroupMgrGroupData::setAccessed()
{
- mAccessTime = (F32)LLFrameTimer::getTotalSeconds();
+ mAccessTime = (F32)LLFrameTimer::getTotalSeconds();
}
BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_data)
{
- role_data_map_t::const_iterator it;
+ role_data_map_t::const_iterator it;
- // Do we have changes for it?
- it = mRoleChanges.find(role_id);
- if (it != mRoleChanges.end())
- {
- if ((*it).second.mChangeType == RC_DELETE) return FALSE;
+ // Do we have changes for it?
+ it = mRoleChanges.find(role_id);
+ if (it != mRoleChanges.end())
+ {
+ if ((*it).second.mChangeType == RC_DELETE) return FALSE;
- role_data = (*it).second;
- return TRUE;
- }
+ role_data = (*it).second;
+ return TRUE;
+ }
- // Ok, no changes, hasn't been deleted, isn't a new role, just find the role.
- role_list_t::const_iterator rit = mRoles.find(role_id);
- if (rit != mRoles.end())
- {
- role_data = (*rit).second->getRoleData();
- return TRUE;
- }
+ // Ok, no changes, hasn't been deleted, isn't a new role, just find the role.
+ role_list_t::const_iterator rit = mRoles.find(role_id);
+ if (rit != mRoles.end())
+ {
+ role_data = (*rit).second->getRoleData();
+ return TRUE;
+ }
- // This role must not exist.
- return FALSE;
+ // This role must not exist.
+ return FALSE;
}
void LLGroupMgrGroupData::setRoleData(const LLUUID& role_id, LLRoleData role_data)
{
- // If this is a newly created group, we need to change the data in the created list.
- role_data_map_t::iterator it;
- it = mRoleChanges.find(role_id);
- if (it != mRoleChanges.end())
- {
- if ((*it).second.mChangeType == RC_CREATE)
- {
- role_data.mChangeType = RC_CREATE;
- mRoleChanges[role_id] = role_data;
- return;
- }
- else if ((*it).second.mChangeType == RC_DELETE)
- {
- // Don't do anything for a role being deleted.
- return;
- }
- }
-
- // Not a new role, so put it in the changes list.
- LLRoleData old_role_data;
- role_list_t::iterator rit = mRoles.find(role_id);
- if (rit != mRoles.end())
- {
- bool data_change = ( ((*rit).second->mRoleData.mRoleDescription != role_data.mRoleDescription)
- || ((*rit).second->mRoleData.mRoleName != role_data.mRoleName)
- || ((*rit).second->mRoleData.mRoleTitle != role_data.mRoleTitle) );
- bool powers_change = ((*rit).second->mRoleData.mRolePowers != role_data.mRolePowers);
-
- if (!data_change && !powers_change)
- {
- // We are back to the original state, the changes have been 'undone' so take out the change.
- mRoleChanges.erase(role_id);
- return;
- }
-
- if (data_change && powers_change)
- {
- role_data.mChangeType = RC_UPDATE_ALL;
- }
- else if (data_change)
- {
- role_data.mChangeType = RC_UPDATE_DATA;
- }
- else
- {
- role_data.mChangeType = RC_UPDATE_POWERS;
- }
-
- mRoleChanges[role_id] = role_data;
- }
- else
- {
- LL_WARNS() << "Change being made to non-existant role " << role_id << LL_ENDL;
- }
+ // If this is a newly created group, we need to change the data in the created list.
+ role_data_map_t::iterator it;
+ it = mRoleChanges.find(role_id);
+ if (it != mRoleChanges.end())
+ {
+ if ((*it).second.mChangeType == RC_CREATE)
+ {
+ role_data.mChangeType = RC_CREATE;
+ mRoleChanges[role_id] = role_data;
+ return;
+ }
+ else if ((*it).second.mChangeType == RC_DELETE)
+ {
+ // Don't do anything for a role being deleted.
+ return;
+ }
+ }
+
+ // Not a new role, so put it in the changes list.
+ LLRoleData old_role_data;
+ role_list_t::iterator rit = mRoles.find(role_id);
+ if (rit != mRoles.end())
+ {
+ bool data_change = ( ((*rit).second->mRoleData.mRoleDescription != role_data.mRoleDescription)
+ || ((*rit).second->mRoleData.mRoleName != role_data.mRoleName)
+ || ((*rit).second->mRoleData.mRoleTitle != role_data.mRoleTitle) );
+ bool powers_change = ((*rit).second->mRoleData.mRolePowers != role_data.mRolePowers);
+
+ if (!data_change && !powers_change)
+ {
+ // We are back to the original state, the changes have been 'undone' so take out the change.
+ mRoleChanges.erase(role_id);
+ return;
+ }
+
+ if (data_change && powers_change)
+ {
+ role_data.mChangeType = RC_UPDATE_ALL;
+ }
+ else if (data_change)
+ {
+ role_data.mChangeType = RC_UPDATE_DATA;
+ }
+ else
+ {
+ role_data.mChangeType = RC_UPDATE_POWERS;
+ }
+
+ mRoleChanges[role_id] = role_data;
+ }
+ else
+ {
+ LL_WARNS() << "Change being made to non-existant role " << role_id << LL_ENDL;
+ }
}
BOOL LLGroupMgrGroupData::pendingRoleChanges()
{
- return (!mRoleChanges.empty());
+ return (!mRoleChanges.empty());
}
// This is a no-op if the role has already been created.
void LLGroupMgrGroupData::createRole(const LLUUID& role_id, LLRoleData role_data)
{
- if (mRoleChanges.find(role_id) != mRoleChanges.end())
- {
- LL_WARNS() << "create role for existing role! " << role_id << LL_ENDL;
- }
- else
- {
- role_data.mChangeType = RC_CREATE;
- mRoleChanges[role_id] = role_data;
- }
+ if (mRoleChanges.find(role_id) != mRoleChanges.end())
+ {
+ LL_WARNS() << "create role for existing role! " << role_id << LL_ENDL;
+ }
+ else
+ {
+ role_data.mChangeType = RC_CREATE;
+ mRoleChanges[role_id] = role_data;
+ }
}
void LLGroupMgrGroupData::deleteRole(const LLUUID& role_id)
{
- role_data_map_t::iterator it;
+ role_data_map_t::iterator it;
- // If this was a new role, just discard it.
- it = mRoleChanges.find(role_id);
- if (it != mRoleChanges.end()
- && (*it).second.mChangeType == RC_CREATE)
- {
- mRoleChanges.erase(it);
- return;
- }
+ // If this was a new role, just discard it.
+ it = mRoleChanges.find(role_id);
+ if (it != mRoleChanges.end()
+ && (*it).second.mChangeType == RC_CREATE)
+ {
+ mRoleChanges.erase(it);
+ return;
+ }
- LLRoleData rd;
- rd.mChangeType = RC_DELETE;
- mRoleChanges[role_id] = rd;
+ LLRoleData rd;
+ rd.mChangeType = RC_DELETE;
+ mRoleChanges[role_id] = rd;
}
void LLGroupMgrGroupData::addRolePower(const LLUUID &role_id, U64 power)
{
- LLRoleData rd;
- if (getRoleData(role_id,rd))
- {
- rd.mRolePowers |= power;
- setRoleData(role_id,rd);
- }
- else
- {
- LL_WARNS() << "addRolePower: no role data found for " << role_id << LL_ENDL;
- }
+ LLRoleData rd;
+ if (getRoleData(role_id,rd))
+ {
+ rd.mRolePowers |= power;
+ setRoleData(role_id,rd);
+ }
+ else
+ {
+ LL_WARNS() << "addRolePower: no role data found for " << role_id << LL_ENDL;
+ }
}
void LLGroupMgrGroupData::removeRolePower(const LLUUID &role_id, U64 power)
{
- LLRoleData rd;
- if (getRoleData(role_id,rd))
- {
- rd.mRolePowers &= ~power;
- setRoleData(role_id,rd);
- }
- else
- {
- LL_WARNS() << "removeRolePower: no role data found for " << role_id << LL_ENDL;
- }
+ LLRoleData rd;
+ if (getRoleData(role_id,rd))
+ {
+ rd.mRolePowers &= ~power;
+ setRoleData(role_id,rd);
+ }
+ else
+ {
+ LL_WARNS() << "removeRolePower: no role data found for " << role_id << LL_ENDL;
+ }
}
U64 LLGroupMgrGroupData::getRolePowers(const LLUUID& role_id)
{
- LLRoleData rd;
- if (getRoleData(role_id,rd))
- {
- return rd.mRolePowers;
- }
- else
- {
- LL_WARNS() << "getRolePowers: no role data found for " << role_id << LL_ENDL;
- return GP_NO_POWERS;
- }
+ LLRoleData rd;
+ if (getRoleData(role_id,rd))
+ {
+ return rd.mRolePowers;
+ }
+ else
+ {
+ LL_WARNS() << "getRolePowers: no role data found for " << role_id << LL_ENDL;
+ return GP_NO_POWERS;
+ }
}
void LLGroupMgrGroupData::removeData()
{
- // Remove member data first, because removeRoleData will walk the member list
- removeMemberData();
- removeRoleData();
+ // Remove member data first, because removeRoleData will walk the member list
+ removeMemberData();
+ removeRoleData();
}
void LLGroupMgrGroupData::removeMemberData()
{
- for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi)
- {
- delete mi->second;
- }
- mMembers.clear();
- mMemberDataComplete = false;
- mMemberVersion.generate();
+ for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi)
+ {
+ delete mi->second;
+ }
+ mMembers.clear();
+ mMemberDataComplete = false;
+ mMemberVersion.generate();
}
void LLGroupMgrGroupData::removeRoleData()
{
- for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi)
- {
- LLGroupMemberData* data = mi->second;
- if (data)
- {
- data->clearRoles();
- }
- }
-
- for (role_list_t::iterator ri = mRoles.begin(); ri != mRoles.end(); ++ri)
- {
- LLGroupRoleData* data = ri->second;
- delete data;
- }
- mRoles.clear();
- mReceivedRoleMemberPairs = 0;
- mRoleDataComplete = false;
- mRoleMemberDataComplete= false;
+ for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi)
+ {
+ LLGroupMemberData* data = mi->second;
+ if (data)
+ {
+ data->clearRoles();
+ }
+ }
+
+ for (role_list_t::iterator ri = mRoles.begin(); ri != mRoles.end(); ++ri)
+ {
+ LLGroupRoleData* data = ri->second;
+ delete data;
+ }
+ mRoles.clear();
+ mReceivedRoleMemberPairs = 0;
+ mRoleDataComplete = false;
+ mRoleMemberDataComplete= false;
}
void LLGroupMgrGroupData::removeRoleMemberData()
{
- for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi)
- {
- LLGroupMemberData* data = mi->second;
- if (data)
- {
- data->clearRoles();
- }
- }
+ for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi)
+ {
+ LLGroupMemberData* data = mi->second;
+ if (data)
+ {
+ data->clearRoles();
+ }
+ }
- for (role_list_t::iterator ri = mRoles.begin(); ri != mRoles.end(); ++ri)
- {
- LLGroupRoleData* data = ri->second;
- if (data)
- {
- data->clearMembers();
- }
- }
+ for (role_list_t::iterator ri = mRoles.begin(); ri != mRoles.end(); ++ri)
+ {
+ LLGroupRoleData* data = ri->second;
+ if (data)
+ {
+ data->clearMembers();
+ }
+ }
- mReceivedRoleMemberPairs = 0;
- mRoleMemberDataComplete= false;
+ mReceivedRoleMemberPairs = 0;
+ mRoleMemberDataComplete= false;
}
LLGroupMgrGroupData::~LLGroupMgrGroupData()
{
- removeData();
-}
-
-bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id,
- const LLUUID& member_id,
- LLRoleMemberChangeType rmc)
-{
- role_list_t::iterator ri = mRoles.find(role_id);
- member_list_t::iterator mi = mMembers.find(member_id);
-
- if (ri == mRoles.end()
- || mi == mMembers.end() )
- {
- if (ri == mRoles.end()) LL_WARNS() << "LLGroupMgrGroupData::changeRoleMember couldn't find role " << role_id << LL_ENDL;
- if (mi == mMembers.end()) LL_WARNS() << "LLGroupMgrGroupData::changeRoleMember couldn't find member " << member_id << LL_ENDL;
- return false;
- }
-
- LLGroupRoleData* grd = ri->second;
- LLGroupMemberData* gmd = mi->second;
-
- if (!grd || !gmd)
- {
- LL_WARNS() << "LLGroupMgrGroupData::changeRoleMember couldn't get member or role data." << LL_ENDL;
- return false;
- }
-
- if (RMC_ADD == rmc)
- {
- LL_INFOS() << " adding member to role." << LL_ENDL;
- grd->addMember(member_id);
- gmd->addRole(role_id,grd);
-
- //TODO move this into addrole function
- //see if they added someone to the owner role and update isOwner
- gmd->mIsOwner = (role_id == mOwnerRole) ? TRUE : gmd->mIsOwner;
- }
- else if (RMC_REMOVE == rmc)
- {
- LL_INFOS() << " removing member from role." << LL_ENDL;
- grd->removeMember(member_id);
- gmd->removeRole(role_id);
-
- //see if they removed someone from the owner role and update isOwner
- gmd->mIsOwner = (role_id == mOwnerRole) ? FALSE : gmd->mIsOwner;
- }
-
- lluuid_pair role_member;
- role_member.first = role_id;
- role_member.second = member_id;
-
- change_map_t::iterator it = mRoleMemberChanges.find(role_member);
- if (it != mRoleMemberChanges.end())
- {
- // There was already a role change for this role_member
- if (it->second.mChange == rmc)
- {
- // Already recorded this change? Weird.
- LL_INFOS() << "Received duplicate change for "
- << " role: " << role_id << " member " << member_id
- << " change " << (rmc == RMC_ADD ? "ADD" : "REMOVE") << LL_ENDL;
- }
- else
- {
- // The only two operations (add and remove) currently cancel each other out
- // If that changes this will need more logic
- if (rmc == RMC_NONE)
- {
- LL_WARNS() << "changeRoleMember: existing entry with 'RMC_NONE' change! This shouldn't happen." << LL_ENDL;
- LLRoleMemberChange rc(role_id,member_id,rmc);
- mRoleMemberChanges[role_member] = rc;
- }
- else
- {
- mRoleMemberChanges.erase(it);
- }
- }
- }
- else
- {
- LLRoleMemberChange rc(role_id,member_id,rmc);
- mRoleMemberChanges[role_member] = rc;
- }
-
- recalcAgentPowers(member_id);
-
- mChanged = TRUE;
- return true;
+ removeData();
+}
+
+bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id,
+ const LLUUID& member_id,
+ LLRoleMemberChangeType rmc)
+{
+ role_list_t::iterator ri = mRoles.find(role_id);
+ member_list_t::iterator mi = mMembers.find(member_id);
+
+ if (ri == mRoles.end()
+ || mi == mMembers.end() )
+ {
+ if (ri == mRoles.end()) LL_WARNS() << "LLGroupMgrGroupData::changeRoleMember couldn't find role " << role_id << LL_ENDL;
+ if (mi == mMembers.end()) LL_WARNS() << "LLGroupMgrGroupData::changeRoleMember couldn't find member " << member_id << LL_ENDL;
+ return false;
+ }
+
+ LLGroupRoleData* grd = ri->second;
+ LLGroupMemberData* gmd = mi->second;
+
+ if (!grd || !gmd)
+ {
+ LL_WARNS() << "LLGroupMgrGroupData::changeRoleMember couldn't get member or role data." << LL_ENDL;
+ return false;
+ }
+
+ if (RMC_ADD == rmc)
+ {
+ LL_INFOS() << " adding member to role." << LL_ENDL;
+ grd->addMember(member_id);
+ gmd->addRole(role_id,grd);
+
+ //TODO move this into addrole function
+ //see if they added someone to the owner role and update isOwner
+ gmd->mIsOwner = (role_id == mOwnerRole) ? TRUE : gmd->mIsOwner;
+ }
+ else if (RMC_REMOVE == rmc)
+ {
+ LL_INFOS() << " removing member from role." << LL_ENDL;
+ grd->removeMember(member_id);
+ gmd->removeRole(role_id);
+
+ //see if they removed someone from the owner role and update isOwner
+ gmd->mIsOwner = (role_id == mOwnerRole) ? FALSE : gmd->mIsOwner;
+ }
+
+ lluuid_pair role_member;
+ role_member.first = role_id;
+ role_member.second = member_id;
+
+ change_map_t::iterator it = mRoleMemberChanges.find(role_member);
+ if (it != mRoleMemberChanges.end())
+ {
+ // There was already a role change for this role_member
+ if (it->second.mChange == rmc)
+ {
+ // Already recorded this change? Weird.
+ LL_INFOS() << "Received duplicate change for "
+ << " role: " << role_id << " member " << member_id
+ << " change " << (rmc == RMC_ADD ? "ADD" : "REMOVE") << LL_ENDL;
+ }
+ else
+ {
+ // The only two operations (add and remove) currently cancel each other out
+ // If that changes this will need more logic
+ if (rmc == RMC_NONE)
+ {
+ LL_WARNS() << "changeRoleMember: existing entry with 'RMC_NONE' change! This shouldn't happen." << LL_ENDL;
+ LLRoleMemberChange rc(role_id,member_id,rmc);
+ mRoleMemberChanges[role_member] = rc;
+ }
+ else
+ {
+ mRoleMemberChanges.erase(it);
+ }
+ }
+ }
+ else
+ {
+ LLRoleMemberChange rc(role_id,member_id,rmc);
+ mRoleMemberChanges[role_member] = rc;
+ }
+
+ recalcAgentPowers(member_id);
+
+ mChanged = TRUE;
+ return true;
}
void LLGroupMgrGroupData::recalcAllAgentPowers()
{
- LLGroupMemberData* gmd;
+ LLGroupMemberData* gmd;
- for (member_list_t::iterator mit = mMembers.begin();
- mit != mMembers.end(); ++mit)
- {
- gmd = mit->second;
- if (!gmd) continue;
+ for (member_list_t::iterator mit = mMembers.begin();
+ mit != mMembers.end(); ++mit)
+ {
+ gmd = mit->second;
+ if (!gmd) continue;
- gmd->mAgentPowers = 0;
- for (LLGroupMemberData::role_list_t::iterator it = gmd->mRolesList.begin();
- it != gmd->mRolesList.end(); ++it)
- {
- LLGroupRoleData* grd = (*it).second;
- if (!grd) continue;
+ gmd->mAgentPowers = 0;
+ for (LLGroupMemberData::role_list_t::iterator it = gmd->mRolesList.begin();
+ it != gmd->mRolesList.end(); ++it)
+ {
+ LLGroupRoleData* grd = (*it).second;
+ if (!grd) continue;
- gmd->mAgentPowers |= grd->mRoleData.mRolePowers;
- }
- }
+ gmd->mAgentPowers |= grd->mRoleData.mRolePowers;
+ }
+ }
}
void LLGroupMgrGroupData::recalcAgentPowers(const LLUUID& agent_id)
{
- member_list_t::iterator mi = mMembers.find(agent_id);
- if (mi == mMembers.end()) return;
+ member_list_t::iterator mi = mMembers.find(agent_id);
+ if (mi == mMembers.end()) return;
- LLGroupMemberData* gmd = mi->second;
+ LLGroupMemberData* gmd = mi->second;
- if (!gmd) return;
+ if (!gmd) return;
- gmd->mAgentPowers = 0;
- for (LLGroupMemberData::role_list_t::iterator it = gmd->mRolesList.begin();
- it != gmd->mRolesList.end(); ++it)
- {
- LLGroupRoleData* grd = (*it).second;
- if (!grd) continue;
+ gmd->mAgentPowers = 0;
+ for (LLGroupMemberData::role_list_t::iterator it = gmd->mRolesList.begin();
+ it != gmd->mRolesList.end(); ++it)
+ {
+ LLGroupRoleData* grd = (*it).second;
+ if (!grd) continue;
- gmd->mAgentPowers |= grd->mRoleData.mRolePowers;
- }
+ gmd->mAgentPowers |= grd->mRoleData.mRolePowers;
+ }
}
bool LLGroupMgrGroupData::isSingleMemberNotOwner()
{
- return mMembers.size() == 1 && !mMembers.begin()->second->isOwner();
+ return mMembers.size() == 1 && !mMembers.begin()->second->isOwner();
}
-bool packRoleUpdateMessageBlock(LLMessageSystem* msg,
- const LLUUID& group_id,
- const LLUUID& role_id,
- const LLRoleData& role_data,
- bool start_message)
+bool packRoleUpdateMessageBlock(LLMessageSystem* msg,
+ const LLUUID& group_id,
+ const LLUUID& role_id,
+ const LLRoleData& role_data,
+ bool start_message)
{
- if (start_message)
- {
- msg->newMessage("GroupRoleUpdate");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->addUUID("GroupID",group_id);
- start_message = false;
- }
+ if (start_message)
+ {
+ msg->newMessage("GroupRoleUpdate");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->addUUID("GroupID",group_id);
+ start_message = false;
+ }
- msg->nextBlock("RoleData");
- msg->addUUID("RoleID",role_id);
- msg->addString("Name", role_data.mRoleName);
- msg->addString("Description", role_data.mRoleDescription);
- msg->addString("Title", role_data.mRoleTitle);
- msg->addU64("Powers", role_data.mRolePowers);
- msg->addU8("UpdateType", (U8)role_data.mChangeType);
+ msg->nextBlock("RoleData");
+ msg->addUUID("RoleID",role_id);
+ msg->addString("Name", role_data.mRoleName);
+ msg->addString("Description", role_data.mRoleDescription);
+ msg->addString("Title", role_data.mRoleTitle);
+ msg->addU64("Powers", role_data.mRolePowers);
+ msg->addU8("UpdateType", (U8)role_data.mChangeType);
- if (msg->isSendFullFast())
- {
- gAgent.sendReliableMessage();
- start_message = true;
- }
+ if (msg->isSendFullFast())
+ {
+ gAgent.sendReliableMessage();
+ start_message = true;
+ }
- return start_message;
+ return start_message;
}
void LLGroupMgrGroupData::sendRoleChanges()
{
- // Commit changes locally
- LLGroupRoleData* grd;
- role_list_t::iterator role_it;
- LLMessageSystem* msg = gMessageSystem;
- bool start_message = true;
-
- bool need_role_cleanup = false;
- bool need_role_data = false;
- bool need_power_recalc = false;
-
- // Apply all changes
- for (role_data_map_t::iterator iter = mRoleChanges.begin();
- iter != mRoleChanges.end(); )
- {
- role_data_map_t::iterator it = iter++; // safely incrament iter
- const LLUUID& role_id = (*it).first;
- const LLRoleData& role_data = (*it).second;
-
- // Commit to local data set
- role_it = mRoles.find((*it).first);
- if ( (mRoles.end() == role_it
- && RC_CREATE != role_data.mChangeType)
- || (mRoles.end() != role_it
- && RC_CREATE == role_data.mChangeType))
- {
- continue;
- }
-
- // NOTE: role_it is valid EXCEPT for the RC_CREATE case
- switch (role_data.mChangeType)
- {
- case RC_CREATE:
- {
- // NOTE: role_it is NOT valid in this case
- grd = new LLGroupRoleData(role_id, role_data, 0);
- mRoles[role_id] = grd;
- need_role_data = true;
- break;
- }
- case RC_DELETE:
- {
- LLGroupRoleData* group_role_data = (*role_it).second;
- delete group_role_data;
- mRoles.erase(role_it);
- need_role_cleanup = true;
- need_power_recalc = true;
- break;
- }
- case RC_UPDATE_ALL:
- // fall through
- case RC_UPDATE_POWERS:
- need_power_recalc = true;
- // fall through
- case RC_UPDATE_DATA:
- // fall through
- default:
- {
- LLGroupRoleData* group_role_data = (*role_it).second;
- group_role_data->setRoleData(role_data); // NOTE! might modify mRoleChanges!
- break;
- }
- }
-
- // Update dataserver
- start_message = packRoleUpdateMessageBlock(msg,getID(),role_id,role_data,start_message);
- }
-
- if (!start_message)
- {
- gAgent.sendReliableMessage();
- }
-
- // If we delete a role then all the role-member pairs are invalid!
- if (need_role_cleanup)
- {
- removeRoleMemberData();
- }
-
- // If we create a new role, then we need to re-fetch all the role data.
- if (need_role_data)
- {
- LLGroupMgr::getInstance()->sendGroupRoleDataRequest(getID());
- }
-
- // Clean up change lists
- mRoleChanges.clear();
-
- // Recalculate all the agent powers because role powers have now changed.
- if (need_power_recalc)
- {
- recalcAllAgentPowers();
- }
+ // Commit changes locally
+ LLGroupRoleData* grd;
+ role_list_t::iterator role_it;
+ LLMessageSystem* msg = gMessageSystem;
+ bool start_message = true;
+
+ bool need_role_cleanup = false;
+ bool need_role_data = false;
+ bool need_power_recalc = false;
+
+ // Apply all changes
+ for (role_data_map_t::iterator iter = mRoleChanges.begin();
+ iter != mRoleChanges.end(); )
+ {
+ role_data_map_t::iterator it = iter++; // safely incrament iter
+ const LLUUID& role_id = (*it).first;
+ const LLRoleData& role_data = (*it).second;
+
+ // Commit to local data set
+ role_it = mRoles.find((*it).first);
+ if ( (mRoles.end() == role_it
+ && RC_CREATE != role_data.mChangeType)
+ || (mRoles.end() != role_it
+ && RC_CREATE == role_data.mChangeType))
+ {
+ continue;
+ }
+
+ // NOTE: role_it is valid EXCEPT for the RC_CREATE case
+ switch (role_data.mChangeType)
+ {
+ case RC_CREATE:
+ {
+ // NOTE: role_it is NOT valid in this case
+ grd = new LLGroupRoleData(role_id, role_data, 0);
+ mRoles[role_id] = grd;
+ need_role_data = true;
+ break;
+ }
+ case RC_DELETE:
+ {
+ LLGroupRoleData* group_role_data = (*role_it).second;
+ delete group_role_data;
+ mRoles.erase(role_it);
+ need_role_cleanup = true;
+ need_power_recalc = true;
+ break;
+ }
+ case RC_UPDATE_ALL:
+ // fall through
+ case RC_UPDATE_POWERS:
+ need_power_recalc = true;
+ // fall through
+ case RC_UPDATE_DATA:
+ // fall through
+ default:
+ {
+ LLGroupRoleData* group_role_data = (*role_it).second;
+ group_role_data->setRoleData(role_data); // NOTE! might modify mRoleChanges!
+ break;
+ }
+ }
+
+ // Update dataserver
+ start_message = packRoleUpdateMessageBlock(msg,getID(),role_id,role_data,start_message);
+ }
+
+ if (!start_message)
+ {
+ gAgent.sendReliableMessage();
+ }
+
+ // If we delete a role then all the role-member pairs are invalid!
+ if (need_role_cleanup)
+ {
+ removeRoleMemberData();
+ }
+
+ // If we create a new role, then we need to re-fetch all the role data.
+ if (need_role_data)
+ {
+ LLGroupMgr::getInstance()->sendGroupRoleDataRequest(getID());
+ }
+
+ // Clean up change lists
+ mRoleChanges.clear();
+
+ // Recalculate all the agent powers because role powers have now changed.
+ if (need_power_recalc)
+ {
+ recalcAllAgentPowers();
+ }
}
void LLGroupMgrGroupData::cancelRoleChanges()
{
- // Clear out all changes!
- mRoleChanges.clear();
+ // Clear out all changes!
+ mRoleChanges.clear();
}
void LLGroupMgrGroupData::createBanEntry(const LLUUID& ban_id, const LLGroupBanData& ban_data)
-{
- mBanList[ban_id] = ban_data;
+{
+ mBanList[ban_id] = ban_data;
}
void LLGroupMgrGroupData::removeBanEntry(const LLUUID& ban_id)
{
- mBanList.erase(ban_id);
+ mBanList.erase(ban_id);
}
void LLGroupMgrGroupData::banMemberById(const LLUUID& participant_uuid)
{
- if (!mMemberDataComplete ||
- !mRoleDataComplete ||
- !(mRoleMemberDataComplete && mMembers.size()))
- {
- LL_WARNS() << "No Role-Member data yet, setting ban request to pending." << LL_ENDL;
- mPendingBanRequest = true;
- mPendingBanMemberID = participant_uuid;
-
- if (!mMemberDataComplete || !mMembers.size())
- {
- LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mID);
- }
-
- if (!mRoleDataComplete)
- {
- LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mID);
- }
-
- return;
- }
-
- LLGroupMgrGroupData::member_list_t::iterator mi = mMembers.find((participant_uuid));
- if (mi == mMembers.end())
- {
- if (!mPendingBanRequest)
- {
- mPendingBanRequest = true;
- mPendingBanMemberID = participant_uuid;
- LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mID); // member isn't in members list, request reloading
- }
- else
- {
- mPendingBanRequest = false;
- }
-
- return;
- }
-
- mPendingBanRequest = false;
-
- LLGroupMemberData* member_data = (*mi).second;
- if (member_data && member_data->isInRole(mOwnerRole))
- {
- return; // can't ban group owner
- }
-
- std::vector<LLUUID> ids;
- ids.push_back(participant_uuid);
-
- LLGroupBanData ban_data;
- createBanEntry(participant_uuid, ban_data);
- LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mID, LLGroupMgr::BAN_CREATE, ids);
- LLGroupMgr::getInstance()->sendGroupMemberEjects(mID, ids);
- LLGroupMgr::getInstance()->sendGroupMembersRequest(mID);
- LLSD args;
- LLAvatarName av_name;
- LLAvatarNameCache::get(participant_uuid, &av_name);
- args["AVATAR_NAME"] = av_name.getUserName();
- args["GROUP_NAME"] = mName;
- LLNotifications::instance().add(LLNotification::Params("EjectAvatarFromGroup").substitutions(args));
+ if (!mMemberDataComplete ||
+ !mRoleDataComplete ||
+ !(mRoleMemberDataComplete && mMembers.size()))
+ {
+ LL_WARNS() << "No Role-Member data yet, setting ban request to pending." << LL_ENDL;
+ mPendingBanRequest = true;
+ mPendingBanMemberID = participant_uuid;
+
+ if (!mMemberDataComplete || !mMembers.size())
+ {
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mID);
+ }
+
+ if (!mRoleDataComplete)
+ {
+ LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mID);
+ }
+
+ return;
+ }
+
+ LLGroupMgrGroupData::member_list_t::iterator mi = mMembers.find((participant_uuid));
+ if (mi == mMembers.end())
+ {
+ if (!mPendingBanRequest)
+ {
+ mPendingBanRequest = true;
+ mPendingBanMemberID = participant_uuid;
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mID); // member isn't in members list, request reloading
+ }
+ else
+ {
+ mPendingBanRequest = false;
+ }
+
+ return;
+ }
+
+ mPendingBanRequest = false;
+
+ LLGroupMemberData* member_data = (*mi).second;
+ if (member_data && member_data->isInRole(mOwnerRole))
+ {
+ return; // can't ban group owner
+ }
+
+ std::vector<LLUUID> ids;
+ ids.push_back(participant_uuid);
+
+ LLGroupBanData ban_data;
+ createBanEntry(participant_uuid, ban_data);
+ LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mID, LLGroupMgr::BAN_CREATE, ids);
+ LLGroupMgr::getInstance()->sendGroupMemberEjects(mID, ids);
+ LLGroupMgr::getInstance()->sendGroupMembersRequest(mID);
+ LLSD args;
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(participant_uuid, &av_name);
+ args["AVATAR_NAME"] = av_name.getUserName();
+ args["GROUP_NAME"] = mName;
+ LLNotifications::instance().add(LLNotification::Params("EjectAvatarFromGroup").substitutions(args));
}
//
@@ -839,70 +839,70 @@ LLGroupMgr::LLGroupMgr():
LLGroupMgr::~LLGroupMgr()
{
- clearGroups();
+ clearGroups();
}
void LLGroupMgr::clearGroups()
{
- std::for_each(mRoleActionSets.begin(), mRoleActionSets.end(), DeletePointer());
- mRoleActionSets.clear();
- std::for_each(mGroups.begin(), mGroups.end(), DeletePairedPointer());
- mGroups.clear();
- mObservers.clear();
+ std::for_each(mRoleActionSets.begin(), mRoleActionSets.end(), DeletePointer());
+ mRoleActionSets.clear();
+ std::for_each(mGroups.begin(), mGroups.end(), DeletePairedPointer());
+ mGroups.clear();
+ mObservers.clear();
}
void LLGroupMgr::clearGroupData(const LLUUID& group_id)
{
- group_map_t::iterator iter = mGroups.find(group_id);
- if (iter != mGroups.end())
- {
- delete (*iter).second;
- mGroups.erase(iter);
- }
+ group_map_t::iterator iter = mGroups.find(group_id);
+ if (iter != mGroups.end())
+ {
+ delete (*iter).second;
+ mGroups.erase(iter);
+ }
}
-void LLGroupMgr::addObserver(LLGroupMgrObserver* observer)
-{
- if( observer->getID() != LLUUID::null )
- mObservers.insert(std::pair<LLUUID, LLGroupMgrObserver*>(observer->getID(), observer));
+void LLGroupMgr::addObserver(LLGroupMgrObserver* observer)
+{
+ if( observer->getID() != LLUUID::null )
+ mObservers.insert(std::pair<LLUUID, LLGroupMgrObserver*>(observer->getID(), observer));
}
void LLGroupMgr::addObserver(const LLUUID& group_id, LLParticularGroupObserver* observer)
{
- if(group_id.notNull() && observer)
- {
- mParticularObservers[group_id].insert(observer);
- }
+ if(group_id.notNull() && observer)
+ {
+ mParticularObservers[group_id].insert(observer);
+ }
}
void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer)
{
- if (!observer)
- {
- return;
- }
- observer_multimap_t::iterator it;
- it = mObservers.find(observer->getID());
- while (it != mObservers.end())
- {
- if (it->second == observer)
- {
- mObservers.erase(it);
- break;
- }
- else
- {
- ++it;
- }
- }
+ if (!observer)
+ {
+ return;
+ }
+ observer_multimap_t::iterator it;
+ it = mObservers.find(observer->getID());
+ while (it != mObservers.end())
+ {
+ if (it->second == observer)
+ {
+ mObservers.erase(it);
+ break;
+ }
+ else
+ {
+ ++it;
+ }
+ }
}
void LLGroupMgr::removeObserver(const LLUUID& group_id, LLParticularGroupObserver* observer)
{
- if(group_id.isNull() || !observer)
- {
- return;
- }
+ if(group_id.isNull() || !observer)
+ {
+ return;
+ }
observer_map_t::iterator obs_it = mParticularObservers.find(group_id);
if(obs_it == mParticularObservers.end())
@@ -911,18 +911,18 @@ void LLGroupMgr::removeObserver(const LLUUID& group_id, LLParticularGroupObserve
obs_it->second.erase(observer);
if (obs_it->second.size() == 0)
- mParticularObservers.erase(obs_it);
+ mParticularObservers.erase(obs_it);
}
LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id)
{
- group_map_t::iterator gi = mGroups.find(id);
+ group_map_t::iterator gi = mGroups.find(id);
- if (gi != mGroups.end())
- {
- return gi->second;
- }
- return NULL;
+ if (gi != mGroups.end())
+ {
+ return gi->second;
+ }
+ return NULL;
}
// Helper function for LLGroupMgr::processGroupMembersReply
@@ -930,19 +930,19 @@ LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id)
// so that the sorter can sort by year before month before day.
static void formatDateString(std::string &date_string)
{
- using namespace boost;
- cmatch result;
- const regex expression("([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})");
- if (regex_match(date_string.c_str(), result, expression))
- {
- // convert matches to integers so that we can pad them with zeroes on Linux
- S32 year = boost::lexical_cast<S32>(result[3]);
- S32 month = boost::lexical_cast<S32>(result[1]);
- S32 day = boost::lexical_cast<S32>(result[2]);
+ using namespace boost;
+ cmatch result;
+ const regex expression("([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})");
+ if (regex_match(date_string.c_str(), result, expression))
+ {
+ // convert matches to integers so that we can pad them with zeroes on Linux
+ S32 year = boost::lexical_cast<S32>(result[3]);
+ S32 month = boost::lexical_cast<S32>(result[1]);
+ S32 day = boost::lexical_cast<S32>(result[2]);
- // ISO 8601 date format
- date_string = llformat("%04d/%02d/%02d", year, month, day);
- }
+ // ISO 8601 date format
+ date_string = llformat("%04d/%02d/%02d", year, month, day);
+ }
}
// static
@@ -950,179 +950,179 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data)
{
LL_PROFILE_ZONE_SCOPED;
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupMembersReply" << LL_ENDL;
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- if (gAgent.getID() != agent_id)
- {
- LL_WARNS() << "Got group members reply for another agent!" << LL_ENDL;
- return;
- }
-
- LLUUID group_id;
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id );
-
- LLUUID request_id;
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id);
-
- LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (!group_datap || (group_datap->mMemberRequestID != request_id))
- {
- LL_WARNS() << "processGroupMembersReply: Received incorrect (stale?) group or request id" << LL_ENDL;
- return;
- }
-
- msg->getS32(_PREHASH_GroupData, "MemberCount", group_datap->mMemberCount );
-
- if (group_datap->mMemberCount > 0)
- {
- S32 contribution = 0;
- std::string online_status;
- std::string title;
- U64 agent_powers = 0;
- BOOL is_owner = FALSE;
-
- S32 num_members = msg->getNumberOfBlocksFast(_PREHASH_MemberData);
- for (S32 i = 0; i < num_members; i++)
- {
- LLUUID member_id;
-
- msg->getUUIDFast(_PREHASH_MemberData, _PREHASH_AgentID, member_id, i );
- msg->getS32(_PREHASH_MemberData, _PREHASH_Contribution, contribution, i);
- msg->getU64(_PREHASH_MemberData, "AgentPowers", agent_powers, i);
- msg->getStringFast(_PREHASH_MemberData, _PREHASH_OnlineStatus, online_status, i);
- msg->getString(_PREHASH_MemberData, "Title", title, i);
- msg->getBOOL(_PREHASH_MemberData,"IsOwner",is_owner,i);
-
- if (member_id.notNull())
- {
- if (online_status == "Online")
- {
- static std::string localized_online(LLTrans::getString("group_member_status_online"));
- online_status = localized_online;
- }
- else
- {
- formatDateString(online_status); // reformat for sorting, e.g. 12/25/2008 -> 2008/12/25
- }
-
- //LL_INFOS() << "Member " << member_id << " has powers " << std::hex << agent_powers << std::dec << LL_ENDL;
- LLGroupMemberData* newdata = new LLGroupMemberData(member_id,
- contribution,
- agent_powers,
- title,
- online_status,
- is_owner);
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupMembersReply" << LL_ENDL;
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ if (gAgent.getID() != agent_id)
+ {
+ LL_WARNS() << "Got group members reply for another agent!" << LL_ENDL;
+ return;
+ }
+
+ LLUUID group_id;
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id );
+
+ LLUUID request_id;
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id);
+
+ LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ if (!group_datap || (group_datap->mMemberRequestID != request_id))
+ {
+ LL_WARNS() << "processGroupMembersReply: Received incorrect (stale?) group or request id" << LL_ENDL;
+ return;
+ }
+
+ msg->getS32(_PREHASH_GroupData, "MemberCount", group_datap->mMemberCount );
+
+ if (group_datap->mMemberCount > 0)
+ {
+ S32 contribution = 0;
+ std::string online_status;
+ std::string title;
+ U64 agent_powers = 0;
+ BOOL is_owner = FALSE;
+
+ S32 num_members = msg->getNumberOfBlocksFast(_PREHASH_MemberData);
+ for (S32 i = 0; i < num_members; i++)
+ {
+ LLUUID member_id;
+
+ msg->getUUIDFast(_PREHASH_MemberData, _PREHASH_AgentID, member_id, i );
+ msg->getS32(_PREHASH_MemberData, _PREHASH_Contribution, contribution, i);
+ msg->getU64(_PREHASH_MemberData, "AgentPowers", agent_powers, i);
+ msg->getStringFast(_PREHASH_MemberData, _PREHASH_OnlineStatus, online_status, i);
+ msg->getString(_PREHASH_MemberData, "Title", title, i);
+ msg->getBOOL(_PREHASH_MemberData,"IsOwner",is_owner,i);
+
+ if (member_id.notNull())
+ {
+ if (online_status == "Online")
+ {
+ static std::string localized_online(LLTrans::getString("group_member_status_online"));
+ online_status = localized_online;
+ }
+ else
+ {
+ formatDateString(online_status); // reformat for sorting, e.g. 12/25/2008 -> 2008/12/25
+ }
+
+ //LL_INFOS() << "Member " << member_id << " has powers " << std::hex << agent_powers << std::dec << LL_ENDL;
+ LLGroupMemberData* newdata = new LLGroupMemberData(member_id,
+ contribution,
+ agent_powers,
+ title,
+ online_status,
+ is_owner);
#if LL_DEBUG
- LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(member_id);
- if (mit != group_datap->mMembers.end())
- {
- LL_INFOS() << " *** Received duplicate member data for agent " << member_id << LL_ENDL;
- }
+ LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(member_id);
+ if (mit != group_datap->mMembers.end())
+ {
+ LL_INFOS() << " *** Received duplicate member data for agent " << member_id << LL_ENDL;
+ }
#endif
- group_datap->mMembers[member_id] = newdata;
- }
- else
- {
- LL_INFOS() << "Received null group member data." << LL_ENDL;
- }
- }
-
- //if group members are loaded while titles are missing, load the titles.
- if(group_datap->mTitles.size() < 1)
- {
- LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_id);
- }
- }
-
- group_datap->mMemberVersion.generate();
-
- if (group_datap->mMembers.size() == (U32)group_datap->mMemberCount)
- {
- group_datap->mMemberDataComplete = true;
- group_datap->mMemberRequestID.setNull();
- // We don't want to make role-member data requests until we have all the members
- if (group_datap->mPendingRoleMemberRequest)
- {
- group_datap->mPendingRoleMemberRequest = false;
- LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(group_datap->mID);
- }
- }
-
- group_datap->mChanged = TRUE;
- LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA);
-}
-
-//static
+ group_datap->mMembers[member_id] = newdata;
+ }
+ else
+ {
+ LL_INFOS() << "Received null group member data." << LL_ENDL;
+ }
+ }
+
+ //if group members are loaded while titles are missing, load the titles.
+ if(group_datap->mTitles.size() < 1)
+ {
+ LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_id);
+ }
+ }
+
+ group_datap->mMemberVersion.generate();
+
+ if (group_datap->mMembers.size() == (U32)group_datap->mMemberCount)
+ {
+ group_datap->mMemberDataComplete = true;
+ group_datap->mMemberRequestID.setNull();
+ // We don't want to make role-member data requests until we have all the members
+ if (group_datap->mPendingRoleMemberRequest)
+ {
+ group_datap->mPendingRoleMemberRequest = false;
+ LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(group_datap->mID);
+ }
+ }
+
+ group_datap->mChanged = TRUE;
+ LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA);
+}
+
+//static
void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data)
{
LL_PROFILE_ZONE_SCOPED;
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupPropertiesReply" << LL_ENDL;
- if (!msg)
- {
- LL_ERRS() << "Can't access the messaging system" << LL_ENDL;
- return;
- }
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- if (gAgent.getID() != agent_id)
- {
- LL_WARNS() << "Got group properties reply for another agent!" << LL_ENDL;
- return;
- }
-
- LLUUID group_id;
- std::string name;
- std::string charter;
- BOOL show_in_list = FALSE;
- LLUUID founder_id;
- U64 powers_mask = GP_NO_POWERS;
- S32 money = 0;
- std::string member_title;
- LLUUID insignia_id;
- LLUUID owner_role;
- U32 membership_fee = 0;
- BOOL open_enrollment = FALSE;
- S32 num_group_members = 0;
- S32 num_group_roles = 0;
- BOOL allow_publish = FALSE;
- BOOL mature = FALSE;
-
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id );
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_FounderID, founder_id);
- msg->getStringFast(_PREHASH_GroupData, _PREHASH_Name, name );
- msg->getStringFast(_PREHASH_GroupData, _PREHASH_Charter, charter );
- msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_ShowInList, show_in_list );
- msg->getStringFast(_PREHASH_GroupData, _PREHASH_MemberTitle, member_title );
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_InsigniaID, insignia_id );
- msg->getU64Fast(_PREHASH_GroupData, _PREHASH_PowersMask, powers_mask );
- msg->getU32Fast(_PREHASH_GroupData, _PREHASH_MembershipFee, membership_fee );
- msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_OpenEnrollment, open_enrollment );
- msg->getS32Fast(_PREHASH_GroupData, _PREHASH_GroupMembershipCount, num_group_members);
- msg->getS32(_PREHASH_GroupData, "GroupRolesCount", num_group_roles);
- msg->getS32Fast(_PREHASH_GroupData, _PREHASH_Money, money);
- msg->getBOOL("GroupData", "AllowPublish", allow_publish);
- msg->getBOOL("GroupData", "MaturePublish", mature);
- msg->getUUID(_PREHASH_GroupData, "OwnerRole", owner_role);
-
- LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id);
-
- group_datap->mName = name;
- group_datap->mCharter = charter;
- group_datap->mShowInList = show_in_list;
- group_datap->mInsigniaID = insignia_id;
- group_datap->mFounderID = founder_id;
- group_datap->mMembershipFee = membership_fee;
- group_datap->mOpenEnrollment = open_enrollment;
- group_datap->mAllowPublish = allow_publish;
- group_datap->mMaturePublish = mature;
- group_datap->mOwnerRole = owner_role;
- group_datap->mMemberCount = num_group_members;
- group_datap->mRoleCount = num_group_roles + 1; // Add the everyone role.
-
- group_datap->mGroupPropertiesDataComplete = true;
- group_datap->mChanged = TRUE;
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupPropertiesReply" << LL_ENDL;
+ if (!msg)
+ {
+ LL_ERRS() << "Can't access the messaging system" << LL_ENDL;
+ return;
+ }
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ if (gAgent.getID() != agent_id)
+ {
+ LL_WARNS() << "Got group properties reply for another agent!" << LL_ENDL;
+ return;
+ }
+
+ LLUUID group_id;
+ std::string name;
+ std::string charter;
+ BOOL show_in_list = FALSE;
+ LLUUID founder_id;
+ U64 powers_mask = GP_NO_POWERS;
+ S32 money = 0;
+ std::string member_title;
+ LLUUID insignia_id;
+ LLUUID owner_role;
+ U32 membership_fee = 0;
+ BOOL open_enrollment = FALSE;
+ S32 num_group_members = 0;
+ S32 num_group_roles = 0;
+ BOOL allow_publish = FALSE;
+ BOOL mature = FALSE;
+
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id );
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_FounderID, founder_id);
+ msg->getStringFast(_PREHASH_GroupData, _PREHASH_Name, name );
+ msg->getStringFast(_PREHASH_GroupData, _PREHASH_Charter, charter );
+ msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_ShowInList, show_in_list );
+ msg->getStringFast(_PREHASH_GroupData, _PREHASH_MemberTitle, member_title );
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_InsigniaID, insignia_id );
+ msg->getU64Fast(_PREHASH_GroupData, _PREHASH_PowersMask, powers_mask );
+ msg->getU32Fast(_PREHASH_GroupData, _PREHASH_MembershipFee, membership_fee );
+ msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_OpenEnrollment, open_enrollment );
+ msg->getS32Fast(_PREHASH_GroupData, _PREHASH_GroupMembershipCount, num_group_members);
+ msg->getS32(_PREHASH_GroupData, "GroupRolesCount", num_group_roles);
+ msg->getS32Fast(_PREHASH_GroupData, _PREHASH_Money, money);
+ msg->getBOOL("GroupData", "AllowPublish", allow_publish);
+ msg->getBOOL("GroupData", "MaturePublish", mature);
+ msg->getUUID(_PREHASH_GroupData, "OwnerRole", owner_role);
+
+ LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id);
+
+ group_datap->mName = name;
+ group_datap->mCharter = charter;
+ group_datap->mShowInList = show_in_list;
+ group_datap->mInsigniaID = insignia_id;
+ group_datap->mFounderID = founder_id;
+ group_datap->mMembershipFee = membership_fee;
+ group_datap->mOpenEnrollment = open_enrollment;
+ group_datap->mAllowPublish = allow_publish;
+ group_datap->mMaturePublish = mature;
+ group_datap->mOwnerRole = owner_role;
+ group_datap->mMemberCount = num_group_members;
+ group_datap->mRoleCount = num_group_roles + 1; // Add the everyone role.
+
+ group_datap->mGroupPropertiesDataComplete = true;
+ group_datap->mChanged = TRUE;
properties_request_map_t::iterator request = LLGroupMgr::getInstance()->mPropRequests.find(group_id);
if (request != LLGroupMgr::getInstance()->mPropRequests.end())
@@ -1133,7 +1133,7 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data)
{
LL_DEBUGS("GrpMgr") << "GroupPropertyResponse received with no pending request. Response was slow." << LL_ENDL;
}
- LLGroupMgr::getInstance()->notifyObservers(GC_PROPERTIES);
+ LLGroupMgr::getInstance()->notifyObservers(GC_PROPERTIES);
}
// static
@@ -1141,86 +1141,86 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data)
{
LL_PROFILE_ZONE_SCOPED;
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupRoleDataReply" << LL_ENDL;
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- if (gAgent.getID() != agent_id)
- {
- LL_WARNS() << "Got group role data reply for another agent!" << LL_ENDL;
- return;
- }
-
- LLUUID group_id;
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id );
-
- LLUUID request_id;
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id);
-
- LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (!group_datap || (group_datap->mRoleDataRequestID != request_id))
- {
- LL_WARNS() << "processGroupPropertiesReply: Received incorrect (stale?) group or request id" << LL_ENDL;
- return;
- }
-
- msg->getS32(_PREHASH_GroupData, "RoleCount", group_datap->mRoleCount );
-
- std::string name;
- std::string title;
- std::string desc;
- U64 powers = 0;
- U32 member_count = 0;
- LLUUID role_id;
-
- U32 num_blocks = msg->getNumberOfBlocks("RoleData");
- U32 i = 0;
- for (i=0; i< num_blocks; ++i)
- {
- msg->getUUID("RoleData", "RoleID", role_id, i );
-
- msg->getString("RoleData","Name",name,i);
- msg->getString("RoleData","Title",title,i);
- msg->getString("RoleData","Description",desc,i);
- msg->getU64("RoleData","Powers",powers,i);
- msg->getU32("RoleData","Members",member_count,i);
-
- //there are 3 predifined roles - Owners, Officers, Everyone
- //there names are defined in lldatagroups.cpp
- //lets change names from server to localized strings
- if(name == "Everyone")
- {
- name = LLTrans::getString("group_role_everyone");
- }
- else if(name == "Officers")
- {
- name = LLTrans::getString("group_role_officers");
- }
- else if(name == "Owners")
- {
- name = LLTrans::getString("group_role_owners");
- }
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupRoleDataReply" << LL_ENDL;
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ if (gAgent.getID() != agent_id)
+ {
+ LL_WARNS() << "Got group role data reply for another agent!" << LL_ENDL;
+ return;
+ }
+
+ LLUUID group_id;
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id );
+
+ LLUUID request_id;
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id);
+
+ LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ if (!group_datap || (group_datap->mRoleDataRequestID != request_id))
+ {
+ LL_WARNS() << "processGroupPropertiesReply: Received incorrect (stale?) group or request id" << LL_ENDL;
+ return;
+ }
+
+ msg->getS32(_PREHASH_GroupData, "RoleCount", group_datap->mRoleCount );
+
+ std::string name;
+ std::string title;
+ std::string desc;
+ U64 powers = 0;
+ U32 member_count = 0;
+ LLUUID role_id;
+
+ U32 num_blocks = msg->getNumberOfBlocks("RoleData");
+ U32 i = 0;
+ for (i=0; i< num_blocks; ++i)
+ {
+ msg->getUUID("RoleData", "RoleID", role_id, i );
+
+ msg->getString("RoleData","Name",name,i);
+ msg->getString("RoleData","Title",title,i);
+ msg->getString("RoleData","Description",desc,i);
+ msg->getU64("RoleData","Powers",powers,i);
+ msg->getU32("RoleData","Members",member_count,i);
+
+ //there are 3 predifined roles - Owners, Officers, Everyone
+ //there names are defined in lldatagroups.cpp
+ //lets change names from server to localized strings
+ if(name == "Everyone")
+ {
+ name = LLTrans::getString("group_role_everyone");
+ }
+ else if(name == "Officers")
+ {
+ name = LLTrans::getString("group_role_officers");
+ }
+ else if(name == "Owners")
+ {
+ name = LLTrans::getString("group_role_owners");
+ }
LL_DEBUGS("GrpMgr") << "Adding role data: " << name << " {" << role_id << "}" << LL_ENDL;
- LLGroupRoleData* rd = new LLGroupRoleData(role_id,name,title,desc,powers,member_count);
- group_datap->mRoles[role_id] = rd;
- }
-
- if (group_datap->mRoles.size() == (U32)group_datap->mRoleCount)
- {
- group_datap->mRoleDataComplete = true;
- group_datap->mRoleDataRequestID.setNull();
- // We don't want to make role-member data requests until we have all the role data
- if (group_datap->mPendingRoleMemberRequest)
- {
- group_datap->mPendingRoleMemberRequest = false;
- LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(group_datap->mID);
- }
- }
-
- group_datap->mChanged = TRUE;
- LLGroupMgr::getInstance()->notifyObservers(GC_ROLE_DATA);
+ LLGroupRoleData* rd = new LLGroupRoleData(role_id,name,title,desc,powers,member_count);
+ group_datap->mRoles[role_id] = rd;
+ }
+
+ if (group_datap->mRoles.size() == (U32)group_datap->mRoleCount)
+ {
+ group_datap->mRoleDataComplete = true;
+ group_datap->mRoleDataRequestID.setNull();
+ // We don't want to make role-member data requests until we have all the role data
+ if (group_datap->mPendingRoleMemberRequest)
+ {
+ group_datap->mPendingRoleMemberRequest = false;
+ LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(group_datap->mID);
+ }
+ }
+
+ group_datap->mChanged = TRUE;
+ LLGroupMgr::getInstance()->notifyObservers(GC_ROLE_DATA);
}
// static
@@ -1228,282 +1228,282 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data)
{
LL_PROFILE_ZONE_SCOPED;
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupRoleMembersReply" << LL_ENDL;
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- if (gAgent.getID() != agent_id)
- {
- LL_WARNS() << "Got group role members reply for another agent!" << LL_ENDL;
- return;
- }
-
- LLUUID request_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_RequestID, request_id);
-
- LLUUID group_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
-
- U32 total_pairs;
- msg->getU32(_PREHASH_AgentData, "TotalPairs", total_pairs);
-
- LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (!group_datap || (group_datap->mRoleMembersRequestID != request_id))
- {
- LL_WARNS() << "processGroupRoleMembersReply: Received incorrect (stale?) group or request id" << LL_ENDL;
- return;
- }
-
- U32 num_blocks = msg->getNumberOfBlocks("MemberData");
- U32 i;
- LLUUID member_id;
- LLUUID role_id;
- LLGroupRoleData* rd = NULL;
- LLGroupMemberData* md = NULL;
-
- LLGroupMgrGroupData::role_list_t::iterator ri;
- LLGroupMgrGroupData::member_list_t::iterator mi;
-
- // If total_pairs == 0, there are no members in any custom roles.
- if (total_pairs > 0)
- {
- for (i = 0;i < num_blocks; ++i)
- {
- msg->getUUID("MemberData","RoleID",role_id,i);
- msg->getUUID("MemberData","MemberID",member_id,i);
-
- if (role_id.notNull() && member_id.notNull() )
- {
- rd = NULL;
- ri = group_datap->mRoles.find(role_id);
- if (ri != group_datap->mRoles.end())
- {
- rd = ri->second;
- }
-
- md = NULL;
- mi = group_datap->mMembers.find(member_id);
- if (mi != group_datap->mMembers.end())
- {
- md = mi->second;
- }
-
- if (rd && md)
- {
- LL_DEBUGS("GrpMgr") << "Adding role-member pair: " << role_id << ", " << member_id << LL_ENDL;
- rd->addMember(member_id);
- md->addRole(role_id,rd);
- }
- else
- {
- if (!rd) LL_WARNS() << "Received role data for unknown role " << role_id << " in group " << group_id << LL_ENDL;
- if (!md) LL_WARNS() << "Received role data for unknown member " << member_id << " in group " << group_id << LL_ENDL;
- }
- }
- }
-
- group_datap->mReceivedRoleMemberPairs += num_blocks;
- }
-
- if (group_datap->mReceivedRoleMemberPairs == total_pairs)
- {
- // Add role data for the 'everyone' role to all members
- LLGroupRoleData* everyone = group_datap->mRoles[LLUUID::null];
- if (!everyone)
- {
- LL_WARNS() << "Everyone role not found!" << LL_ENDL;
- }
- else
- {
- for (LLGroupMgrGroupData::member_list_t::iterator mi = group_datap->mMembers.begin();
- mi != group_datap->mMembers.end(); ++mi)
- {
- LLGroupMemberData* data = mi->second;
- if (data)
- {
- data->addRole(LLUUID::null,everyone);
- }
- }
- }
-
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupRoleMembersReply" << LL_ENDL;
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ if (gAgent.getID() != agent_id)
+ {
+ LL_WARNS() << "Got group role members reply for another agent!" << LL_ENDL;
+ return;
+ }
+
+ LLUUID request_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_RequestID, request_id);
+
+ LLUUID group_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
+
+ U32 total_pairs;
+ msg->getU32(_PREHASH_AgentData, "TotalPairs", total_pairs);
+
+ LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ if (!group_datap || (group_datap->mRoleMembersRequestID != request_id))
+ {
+ LL_WARNS() << "processGroupRoleMembersReply: Received incorrect (stale?) group or request id" << LL_ENDL;
+ return;
+ }
+
+ U32 num_blocks = msg->getNumberOfBlocks("MemberData");
+ U32 i;
+ LLUUID member_id;
+ LLUUID role_id;
+ LLGroupRoleData* rd = NULL;
+ LLGroupMemberData* md = NULL;
+
+ LLGroupMgrGroupData::role_list_t::iterator ri;
+ LLGroupMgrGroupData::member_list_t::iterator mi;
+
+ // If total_pairs == 0, there are no members in any custom roles.
+ if (total_pairs > 0)
+ {
+ for (i = 0;i < num_blocks; ++i)
+ {
+ msg->getUUID("MemberData","RoleID",role_id,i);
+ msg->getUUID("MemberData","MemberID",member_id,i);
+
+ if (role_id.notNull() && member_id.notNull() )
+ {
+ rd = NULL;
+ ri = group_datap->mRoles.find(role_id);
+ if (ri != group_datap->mRoles.end())
+ {
+ rd = ri->second;
+ }
+
+ md = NULL;
+ mi = group_datap->mMembers.find(member_id);
+ if (mi != group_datap->mMembers.end())
+ {
+ md = mi->second;
+ }
+
+ if (rd && md)
+ {
+ LL_DEBUGS("GrpMgr") << "Adding role-member pair: " << role_id << ", " << member_id << LL_ENDL;
+ rd->addMember(member_id);
+ md->addRole(role_id,rd);
+ }
+ else
+ {
+ if (!rd) LL_WARNS() << "Received role data for unknown role " << role_id << " in group " << group_id << LL_ENDL;
+ if (!md) LL_WARNS() << "Received role data for unknown member " << member_id << " in group " << group_id << LL_ENDL;
+ }
+ }
+ }
+
+ group_datap->mReceivedRoleMemberPairs += num_blocks;
+ }
+
+ if (group_datap->mReceivedRoleMemberPairs == total_pairs)
+ {
+ // Add role data for the 'everyone' role to all members
+ LLGroupRoleData* everyone = group_datap->mRoles[LLUUID::null];
+ if (!everyone)
+ {
+ LL_WARNS() << "Everyone role not found!" << LL_ENDL;
+ }
+ else
+ {
+ for (LLGroupMgrGroupData::member_list_t::iterator mi = group_datap->mMembers.begin();
+ mi != group_datap->mMembers.end(); ++mi)
+ {
+ LLGroupMemberData* data = mi->second;
+ if (data)
+ {
+ data->addRole(LLUUID::null,everyone);
+ }
+ }
+ }
+
group_datap->mRoleMemberDataComplete= true;
- group_datap->mRoleMembersRequestID.setNull();
- }
+ group_datap->mRoleMembersRequestID.setNull();
+ }
- group_datap->mChanged = TRUE;
- LLGroupMgr::getInstance()->notifyObservers(GC_ROLE_MEMBER_DATA);
+ group_datap->mChanged = TRUE;
+ LLGroupMgr::getInstance()->notifyObservers(GC_ROLE_MEMBER_DATA);
- if (group_datap->mPendingBanRequest)
- {
- group_datap->banMemberById(group_datap->mPendingBanMemberID);
- }
+ if (group_datap->mPendingBanRequest)
+ {
+ group_datap->banMemberById(group_datap->mPendingBanMemberID);
+ }
}
// static
void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupTitlesReply" << LL_ENDL;
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- if (gAgent.getID() != agent_id)
- {
- LL_WARNS() << "Got group properties reply for another agent!" << LL_ENDL;
- return;
- }
-
- LLUUID group_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
- LLUUID request_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_RequestID, request_id);
-
- LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (!group_datap || (group_datap->mTitlesRequestID != request_id))
- {
- LL_WARNS() << "processGroupTitlesReply: Received incorrect (stale?) group" << LL_ENDL;
- return;
- }
-
- LLGroupTitle title;
-
- S32 i = 0;
- S32 blocks = msg->getNumberOfBlocksFast(_PREHASH_GroupData);
- for (i=0; i<blocks; ++i)
- {
- msg->getString("GroupData","Title",title.mTitle,i);
- msg->getUUID("GroupData","RoleID",title.mRoleID,i);
- msg->getBOOL("GroupData","Selected",title.mSelected,i);
-
- if (!title.mTitle.empty())
- {
- LL_DEBUGS("GrpMgr") << "LLGroupMgr adding title: " << title.mTitle << ", " << title.mRoleID << ", " << (title.mSelected ? 'Y' : 'N') << LL_ENDL;
- group_datap->mTitles.push_back(title);
- }
- }
-
- group_datap->mChanged = TRUE;
- LLGroupMgr::getInstance()->notifyObservers(GC_TITLES);
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::processGroupTitlesReply" << LL_ENDL;
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ if (gAgent.getID() != agent_id)
+ {
+ LL_WARNS() << "Got group properties reply for another agent!" << LL_ENDL;
+ return;
+ }
+
+ LLUUID group_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
+ LLUUID request_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_RequestID, request_id);
+
+ LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ if (!group_datap || (group_datap->mTitlesRequestID != request_id))
+ {
+ LL_WARNS() << "processGroupTitlesReply: Received incorrect (stale?) group" << LL_ENDL;
+ return;
+ }
+
+ LLGroupTitle title;
+
+ S32 i = 0;
+ S32 blocks = msg->getNumberOfBlocksFast(_PREHASH_GroupData);
+ for (i=0; i<blocks; ++i)
+ {
+ msg->getString("GroupData","Title",title.mTitle,i);
+ msg->getUUID("GroupData","RoleID",title.mRoleID,i);
+ msg->getBOOL("GroupData","Selected",title.mSelected,i);
+
+ if (!title.mTitle.empty())
+ {
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr adding title: " << title.mTitle << ", " << title.mRoleID << ", " << (title.mSelected ? 'Y' : 'N') << LL_ENDL;
+ group_datap->mTitles.push_back(title);
+ }
+ }
+
+ group_datap->mChanged = TRUE;
+ LLGroupMgr::getInstance()->notifyObservers(GC_TITLES);
}
// static
void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data)
{
- LL_DEBUGS("GrpMgr") << "processEjectGroupMemberReply" << LL_ENDL;
- LLUUID group_id;
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id);
- BOOL success;
- msg->getBOOLFast(_PREHASH_EjectData, _PREHASH_Success, success);
+ LL_DEBUGS("GrpMgr") << "processEjectGroupMemberReply" << LL_ENDL;
+ LLUUID group_id;
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id);
+ BOOL success;
+ msg->getBOOLFast(_PREHASH_EjectData, _PREHASH_Success, success);
- // If we had a failure, the group panel needs to be updated.
- if (!success)
- {
- LLGroupActions::refresh(group_id);
- }
+ // If we had a failure, the group panel needs to be updated.
+ if (!success)
+ {
+ LLGroupActions::refresh(group_id);
+ }
}
// static
void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data)
{
- LL_DEBUGS("GrpMgr") << "processJoinGroupReply" << LL_ENDL;
- LLUUID group_id;
- BOOL success;
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id);
- msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_Success, success);
+ LL_DEBUGS("GrpMgr") << "processJoinGroupReply" << LL_ENDL;
+ LLUUID group_id;
+ BOOL success;
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id);
+ msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_Success, success);
- if (success)
- {
- // refresh all group information
- gAgent.sendAgentDataUpdateRequest();
+ if (success)
+ {
+ // refresh all group information
+ gAgent.sendAgentDataUpdateRequest();
- LLGroupMgr::getInstance()->clearGroupData(group_id);
- // refresh the floater for this group, if any.
- LLGroupActions::refresh(group_id);
- }
+ LLGroupMgr::getInstance()->clearGroupData(group_id);
+ // refresh the floater for this group, if any.
+ LLGroupActions::refresh(group_id);
+ }
}
// static
void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data)
{
- LL_DEBUGS("GrpMgr") << "processLeaveGroupReply" << LL_ENDL;
- LLUUID group_id;
- BOOL success;
- msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id);
- msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_Success, success);
+ LL_DEBUGS("GrpMgr") << "processLeaveGroupReply" << LL_ENDL;
+ LLUUID group_id;
+ BOOL success;
+ msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id);
+ msg->getBOOLFast(_PREHASH_GroupData, _PREHASH_Success, success);
- if (success)
- {
- // refresh all group information
- gAgent.sendAgentDataUpdateRequest();
+ if (success)
+ {
+ // refresh all group information
+ gAgent.sendAgentDataUpdateRequest();
- LLGroupMgr::getInstance()->clearGroupData(group_id);
- // close the floater for this group, if any.
- LLGroupActions::closeGroup(group_id);
- }
+ LLGroupMgr::getInstance()->clearGroupData(group_id);
+ // close the floater for this group, if any.
+ LLGroupActions::closeGroup(group_id);
+ }
}
// static
void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data)
{
- LLUUID group_id;
- BOOL success;
- std::string message;
-
- msg->getUUIDFast(_PREHASH_ReplyData, _PREHASH_GroupID, group_id );
-
- msg->getBOOLFast(_PREHASH_ReplyData, _PREHASH_Success, success );
- msg->getStringFast(_PREHASH_ReplyData, _PREHASH_Message, message );
-
- if (success)
- {
- // refresh all group information
- gAgent.sendAgentDataUpdateRequest();
-
- // HACK! We haven't gotten the agent group update yet, so ... um ... fake it.
- // This is so when we go to modify the group we will be able to do so.
- // This isn't actually too bad because real data will come down in 2 or 3 miliseconds and replace this.
- LLGroupData gd;
- gd.mAcceptNotices = TRUE;
- gd.mListInProfile = TRUE;
- gd.mContribution = 0;
- gd.mID = group_id;
- gd.mName = "new group";
- gd.mPowers = GP_ALL_POWERS;
-
- gAgent.mGroups.push_back(gd);
-
- LLPanelGroupCreate::refreshCreatedGroup(group_id);
- //FIXME
- //LLFloaterGroupInfo::closeCreateGroup();
- //LLFloaterGroupInfo::showFromUUID(group_id,"roles_tab");
- }
- else
- {
- // *TODO: Translate
- LLSD args;
- args["MESSAGE"] = message;
- LLNotificationsUtil::add("UnableToCreateGroup", args);
- }
+ LLUUID group_id;
+ BOOL success;
+ std::string message;
+
+ msg->getUUIDFast(_PREHASH_ReplyData, _PREHASH_GroupID, group_id );
+
+ msg->getBOOLFast(_PREHASH_ReplyData, _PREHASH_Success, success );
+ msg->getStringFast(_PREHASH_ReplyData, _PREHASH_Message, message );
+
+ if (success)
+ {
+ // refresh all group information
+ gAgent.sendAgentDataUpdateRequest();
+
+ // HACK! We haven't gotten the agent group update yet, so ... um ... fake it.
+ // This is so when we go to modify the group we will be able to do so.
+ // This isn't actually too bad because real data will come down in 2 or 3 miliseconds and replace this.
+ LLGroupData gd;
+ gd.mAcceptNotices = TRUE;
+ gd.mListInProfile = TRUE;
+ gd.mContribution = 0;
+ gd.mID = group_id;
+ gd.mName = "new group";
+ gd.mPowers = GP_ALL_POWERS;
+
+ gAgent.mGroups.push_back(gd);
+
+ LLPanelGroupCreate::refreshCreatedGroup(group_id);
+ //FIXME
+ //LLFloaterGroupInfo::closeCreateGroup();
+ //LLFloaterGroupInfo::showFromUUID(group_id,"roles_tab");
+ }
+ else
+ {
+ // *TODO: Translate
+ LLSD args;
+ args["MESSAGE"] = message;
+ LLNotificationsUtil::add("UnableToCreateGroup", args);
+ }
}
LLGroupMgrGroupData* LLGroupMgr::createGroupData(const LLUUID& id)
{
- LLGroupMgrGroupData* group_datap = NULL;
+ LLGroupMgrGroupData* group_datap = NULL;
- group_map_t::iterator existing_group = LLGroupMgr::getInstance()->mGroups.find(id);
- if (existing_group == LLGroupMgr::getInstance()->mGroups.end())
- {
- group_datap = new LLGroupMgrGroupData(id);
- LLGroupMgr::getInstance()->addGroup(group_datap);
- }
- else
- {
- group_datap = existing_group->second;
- }
+ group_map_t::iterator existing_group = LLGroupMgr::getInstance()->mGroups.find(id);
+ if (existing_group == LLGroupMgr::getInstance()->mGroups.end())
+ {
+ group_datap = new LLGroupMgrGroupData(id);
+ LLGroupMgr::getInstance()->addGroup(group_datap);
+ }
+ else
+ {
+ group_datap = existing_group->second;
+ }
- if (group_datap)
- {
- group_datap->setAccessed();
- }
+ if (group_datap)
+ {
+ group_datap->setAccessed();
+ }
- return group_datap;
+ return group_datap;
}
bool LLGroupMgr::hasPendingPropertyRequest(const LLUUID & id)
@@ -1530,86 +1530,86 @@ void LLGroupMgr::addPendingPropertyRequest(const LLUUID& id)
void LLGroupMgr::notifyObservers(LLGroupChange gc)
{
- for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end(); ++gi)
- {
- LLUUID group_id = gi->first;
- if (gi->second->mChanged)
- {
- // notify LLGroupMgrObserver
- // Copy the map because observers may remove themselves on update
- observer_multimap_t observers = mObservers;
-
- // find all observers for this group id
- observer_multimap_t::iterator oi = observers.lower_bound(group_id);
- observer_multimap_t::iterator end = observers.upper_bound(group_id);
- for (; oi != end; ++oi)
- {
- oi->second->changed(gc);
- }
- gi->second->mChanged = FALSE;
-
-
- // notify LLParticularGroupObserver
- observer_map_t::iterator obs_it = mParticularObservers.find(group_id);
- if(obs_it == mParticularObservers.end())
- return;
-
- observer_set_t& obs = obs_it->second;
- for (observer_set_t::iterator ob_it = obs.begin(); ob_it != obs.end(); ++ob_it)
- {
- (*ob_it)->changed(group_id, gc);
- }
- }
- }
+ for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end(); ++gi)
+ {
+ LLUUID group_id = gi->first;
+ if (gi->second->mChanged)
+ {
+ // notify LLGroupMgrObserver
+ // Copy the map because observers may remove themselves on update
+ observer_multimap_t observers = mObservers;
+
+ // find all observers for this group id
+ observer_multimap_t::iterator oi = observers.lower_bound(group_id);
+ observer_multimap_t::iterator end = observers.upper_bound(group_id);
+ for (; oi != end; ++oi)
+ {
+ oi->second->changed(gc);
+ }
+ gi->second->mChanged = FALSE;
+
+
+ // notify LLParticularGroupObserver
+ observer_map_t::iterator obs_it = mParticularObservers.find(group_id);
+ if(obs_it == mParticularObservers.end())
+ return;
+
+ observer_set_t& obs = obs_it->second;
+ for (observer_set_t::iterator ob_it = obs.begin(); ob_it != obs.end(); ++ob_it)
+ {
+ (*ob_it)->changed(group_id, gc);
+ }
+ }
+ }
}
void LLGroupMgr::addGroup(LLGroupMgrGroupData* group_datap)
{
- while (mGroups.size() >= MAX_CACHED_GROUPS)
- {
- // LRU: Remove the oldest un-observed group from cache until group size is small enough
-
- F32 oldest_access = LLFrameTimer::getTotalSeconds();
- group_map_t::iterator oldest_gi = mGroups.end();
-
- for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end(); ++gi )
- {
- observer_multimap_t::iterator oi = mObservers.find(gi->first);
- if (oi == mObservers.end())
- {
- if (gi->second
- && (gi->second->getAccessTime() < oldest_access))
- {
- oldest_access = gi->second->getAccessTime();
- oldest_gi = gi;
- }
- }
- }
-
- if (oldest_gi != mGroups.end())
- {
- delete oldest_gi->second;
- mGroups.erase(oldest_gi);
- }
- else
- {
- // All groups must be currently open, none to remove.
- // Just add the new group anyway, but get out of this loop as it
- // will never drop below max_cached_groups.
- break;
- }
- }
-
- mGroups[group_datap->getID()] = group_datap;
+ while (mGroups.size() >= MAX_CACHED_GROUPS)
+ {
+ // LRU: Remove the oldest un-observed group from cache until group size is small enough
+
+ F32 oldest_access = LLFrameTimer::getTotalSeconds();
+ group_map_t::iterator oldest_gi = mGroups.end();
+
+ for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end(); ++gi )
+ {
+ observer_multimap_t::iterator oi = mObservers.find(gi->first);
+ if (oi == mObservers.end())
+ {
+ if (gi->second
+ && (gi->second->getAccessTime() < oldest_access))
+ {
+ oldest_access = gi->second->getAccessTime();
+ oldest_gi = gi;
+ }
+ }
+ }
+
+ if (oldest_gi != mGroups.end())
+ {
+ delete oldest_gi->second;
+ mGroups.erase(oldest_gi);
+ }
+ else
+ {
+ // All groups must be currently open, none to remove.
+ // Just add the new group anyway, but get out of this loop as it
+ // will never drop below max_cached_groups.
+ break;
+ }
+ }
+
+ mGroups[group_datap->getID()] = group_datap;
}
void LLGroupMgr::sendGroupPropertiesRequest(const LLUUID& group_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupPropertiesRequest" << LL_ENDL;
- // This will happen when we get the reply
- //LLGroupMgrGroupData* group_datap = createGroupData(group_id);
-
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupPropertiesRequest" << LL_ENDL;
+ // This will happen when we get the reply
+ //LLGroupMgrGroupData* group_datap = createGroupData(group_id);
+
if (LLGroupMgr::getInstance()->hasPendingPropertyRequest(group_id))
{
LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupPropertiesRequest suppressed repeat for " << group_id << LL_ENDL;
@@ -1617,371 +1617,371 @@ void LLGroupMgr::sendGroupPropertiesRequest(const LLUUID& group_id)
}
LLGroupMgr::getInstance()->addPendingPropertyRequest(group_id);
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GroupProfileRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->nextBlock("GroupData");
- msg->addUUID("GroupID",group_id);
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GroupProfileRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->nextBlock("GroupData");
+ msg->addUUID("GroupID",group_id);
+ gAgent.sendReliableMessage();
}
void LLGroupMgr::sendGroupMembersRequest(const LLUUID& group_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupMembersRequest" << LL_ENDL;
- LLGroupMgrGroupData* group_datap = createGroupData(group_id);
- if (group_datap->mMemberRequestID.isNull())
- {
- group_datap->removeMemberData();
- group_datap->mMemberRequestID.generate();
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GroupMembersRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->nextBlock("GroupData");
- msg->addUUID("GroupID",group_id);
- msg->addUUID("RequestID",group_datap->mMemberRequestID);
- gAgent.sendReliableMessage();
- }
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupMembersRequest" << LL_ENDL;
+ LLGroupMgrGroupData* group_datap = createGroupData(group_id);
+ if (group_datap->mMemberRequestID.isNull())
+ {
+ group_datap->removeMemberData();
+ group_datap->mMemberRequestID.generate();
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GroupMembersRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->nextBlock("GroupData");
+ msg->addUUID("GroupID",group_id);
+ msg->addUUID("RequestID",group_datap->mMemberRequestID);
+ gAgent.sendReliableMessage();
+ }
}
void LLGroupMgr::sendGroupRoleDataRequest(const LLUUID& group_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupRoleDataRequest" << LL_ENDL;
- LLGroupMgrGroupData* group_datap = createGroupData(group_id);
- if (group_datap->mRoleDataRequestID.isNull())
- {
- group_datap->removeRoleData();
- group_datap->mRoleDataRequestID.generate();
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GroupRoleDataRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->nextBlock("GroupData");
- msg->addUUID("GroupID",group_id);
- msg->addUUID("RequestID",group_datap->mRoleDataRequestID);
- gAgent.sendReliableMessage();
- }
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupRoleDataRequest" << LL_ENDL;
+ LLGroupMgrGroupData* group_datap = createGroupData(group_id);
+ if (group_datap->mRoleDataRequestID.isNull())
+ {
+ group_datap->removeRoleData();
+ group_datap->mRoleDataRequestID.generate();
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GroupRoleDataRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->nextBlock("GroupData");
+ msg->addUUID("GroupID",group_id);
+ msg->addUUID("RequestID",group_datap->mRoleDataRequestID);
+ gAgent.sendReliableMessage();
+ }
}
void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupRoleMembersRequest" << LL_ENDL;
- LLGroupMgrGroupData* group_datap = createGroupData(group_id);
-
- if (group_datap->mRoleMembersRequestID.isNull())
- {
- // Don't send the request if we don't have all the member or role data
- if (!group_datap->isMemberDataComplete()
- || !group_datap->isRoleDataComplete())
- {
- // *TODO: KLW FIXME: Should we start a member or role data request?
- LL_INFOS("GrpMgr") << " Pending: " << (group_datap->mPendingRoleMemberRequest ? "Y" : "N")
- << " MemberDataComplete: " << (group_datap->mMemberDataComplete ? "Y" : "N")
- << " RoleDataComplete: " << (group_datap->mRoleDataComplete ? "Y" : "N") << LL_ENDL;
- group_datap->mPendingRoleMemberRequest = TRUE;
- return;
- }
-
- group_datap->removeRoleMemberData();
- group_datap->mRoleMembersRequestID.generate();
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GroupRoleMembersRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->nextBlock("GroupData");
- msg->addUUID("GroupID",group_id);
- msg->addUUID("RequestID",group_datap->mRoleMembersRequestID);
- gAgent.sendReliableMessage();
- }
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupRoleMembersRequest" << LL_ENDL;
+ LLGroupMgrGroupData* group_datap = createGroupData(group_id);
+
+ if (group_datap->mRoleMembersRequestID.isNull())
+ {
+ // Don't send the request if we don't have all the member or role data
+ if (!group_datap->isMemberDataComplete()
+ || !group_datap->isRoleDataComplete())
+ {
+ // *TODO: KLW FIXME: Should we start a member or role data request?
+ LL_INFOS("GrpMgr") << " Pending: " << (group_datap->mPendingRoleMemberRequest ? "Y" : "N")
+ << " MemberDataComplete: " << (group_datap->mMemberDataComplete ? "Y" : "N")
+ << " RoleDataComplete: " << (group_datap->mRoleDataComplete ? "Y" : "N") << LL_ENDL;
+ group_datap->mPendingRoleMemberRequest = TRUE;
+ return;
+ }
+
+ group_datap->removeRoleMemberData();
+ group_datap->mRoleMembersRequestID.generate();
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GroupRoleMembersRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->nextBlock("GroupData");
+ msg->addUUID("GroupID",group_id);
+ msg->addUUID("RequestID",group_datap->mRoleMembersRequestID);
+ gAgent.sendReliableMessage();
+ }
}
void LLGroupMgr::sendGroupTitlesRequest(const LLUUID& group_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupTitlesRequest" << LL_ENDL;
- LLGroupMgrGroupData* group_datap = createGroupData(group_id);
-
- group_datap->mTitles.clear();
- group_datap->mTitlesRequestID.generate();
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupTitlesRequest" << LL_ENDL;
+ LLGroupMgrGroupData* group_datap = createGroupData(group_id);
+
+ group_datap->mTitles.clear();
+ group_datap->mTitlesRequestID.generate();
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GroupTitlesRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->addUUID("GroupID",group_id);
- msg->addUUID("RequestID",group_datap->mTitlesRequestID);
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GroupTitlesRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->addUUID("GroupID",group_id);
+ msg->addUUID("RequestID",group_datap->mTitlesRequestID);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
}
void LLGroupMgr::sendGroupTitleUpdate(const LLUUID& group_id, const LLUUID& title_role_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupTitleUpdate" << LL_ENDL;
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GroupTitleUpdate");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->addUUID("GroupID",group_id);
- msg->addUUID("TitleRoleID",title_role_id);
-
- gAgent.sendReliableMessage();
-
- // Save the change locally
- LLGroupMgrGroupData* group_datap = createGroupData(group_id);
- for (std::vector<LLGroupTitle>::iterator iter = group_datap->mTitles.begin();
- iter != group_datap->mTitles.end(); ++iter)
- {
- if (iter->mRoleID == title_role_id)
- {
- iter->mSelected = TRUE;
- }
- else if (iter->mSelected)
- {
- iter->mSelected = FALSE;
- }
- }
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupTitleUpdate" << LL_ENDL;
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GroupTitleUpdate");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->addUUID("GroupID",group_id);
+ msg->addUUID("TitleRoleID",title_role_id);
+
+ gAgent.sendReliableMessage();
+
+ // Save the change locally
+ LLGroupMgrGroupData* group_datap = createGroupData(group_id);
+ for (std::vector<LLGroupTitle>::iterator iter = group_datap->mTitles.begin();
+ iter != group_datap->mTitles.end(); ++iter)
+ {
+ if (iter->mRoleID == title_role_id)
+ {
+ iter->mSelected = TRUE;
+ }
+ else if (iter->mSelected)
+ {
+ iter->mSelected = FALSE;
+ }
+ }
}
// static
void LLGroupMgr::sendCreateGroupRequest(const std::string& name,
- const std::string& charter,
- U8 show_in_list,
- const LLUUID& insignia,
- S32 membership_fee,
- BOOL open_enrollment,
- BOOL allow_publish,
- BOOL mature_publish)
-{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("CreateGroupRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
-
- msg->nextBlock("GroupData");
- msg->addString("Name",name);
- msg->addString("Charter",charter);
- msg->addBOOL("ShowInList",show_in_list);
- msg->addUUID("InsigniaID",insignia);
- msg->addS32("MembershipFee",membership_fee);
- msg->addBOOL("OpenEnrollment",open_enrollment);
- msg->addBOOL("AllowPublish",allow_publish);
- msg->addBOOL("MaturePublish",mature_publish);
-
- gAgent.sendReliableMessage();
+ const std::string& charter,
+ U8 show_in_list,
+ const LLUUID& insignia,
+ S32 membership_fee,
+ BOOL open_enrollment,
+ BOOL allow_publish,
+ BOOL mature_publish)
+{
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("CreateGroupRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+
+ msg->nextBlock("GroupData");
+ msg->addString("Name",name);
+ msg->addString("Charter",charter);
+ msg->addBOOL("ShowInList",show_in_list);
+ msg->addUUID("InsigniaID",insignia);
+ msg->addS32("MembershipFee",membership_fee);
+ msg->addBOOL("OpenEnrollment",open_enrollment);
+ msg->addBOOL("AllowPublish",allow_publish);
+ msg->addBOOL("MaturePublish",mature_publish);
+
+ gAgent.sendReliableMessage();
}
void LLGroupMgr::sendUpdateGroupInfo(const LLUUID& group_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendUpdateGroupInfo" << LL_ENDL;
- LLGroupMgrGroupData* group_datap = createGroupData(group_id);
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendUpdateGroupInfo" << LL_ENDL;
+ LLGroupMgrGroupData* group_datap = createGroupData(group_id);
- LLMessageSystem* msg = gMessageSystem;
+ LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_UpdateGroupInfo);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID,gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->newMessageFast(_PREHASH_UpdateGroupInfo);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID,gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_GroupData);
- msg->addUUIDFast(_PREHASH_GroupID,group_datap->getID());
- msg->addStringFast(_PREHASH_Charter,group_datap->mCharter);
- msg->addBOOLFast(_PREHASH_ShowInList,group_datap->mShowInList);
- msg->addUUIDFast(_PREHASH_InsigniaID,group_datap->mInsigniaID);
- msg->addS32Fast(_PREHASH_MembershipFee,group_datap->mMembershipFee);
- msg->addBOOLFast(_PREHASH_OpenEnrollment,group_datap->mOpenEnrollment);
- msg->addBOOLFast(_PREHASH_AllowPublish,group_datap->mAllowPublish);
- msg->addBOOLFast(_PREHASH_MaturePublish,group_datap->mMaturePublish);
+ msg->nextBlockFast(_PREHASH_GroupData);
+ msg->addUUIDFast(_PREHASH_GroupID,group_datap->getID());
+ msg->addStringFast(_PREHASH_Charter,group_datap->mCharter);
+ msg->addBOOLFast(_PREHASH_ShowInList,group_datap->mShowInList);
+ msg->addUUIDFast(_PREHASH_InsigniaID,group_datap->mInsigniaID);
+ msg->addS32Fast(_PREHASH_MembershipFee,group_datap->mMembershipFee);
+ msg->addBOOLFast(_PREHASH_OpenEnrollment,group_datap->mOpenEnrollment);
+ msg->addBOOLFast(_PREHASH_AllowPublish,group_datap->mAllowPublish);
+ msg->addBOOLFast(_PREHASH_MaturePublish,group_datap->mMaturePublish);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
- // Not expecting a response, so let anyone else watching know the data has changed.
- group_datap->mChanged = TRUE;
- notifyObservers(GC_PROPERTIES);
+ // Not expecting a response, so let anyone else watching know the data has changed.
+ group_datap->mChanged = TRUE;
+ notifyObservers(GC_PROPERTIES);
}
void LLGroupMgr::sendGroupRoleMemberChanges(const LLUUID& group_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupRoleMemberChanges" << LL_ENDL;
- LLGroupMgrGroupData* group_datap = createGroupData(group_id);
-
- if (group_datap->mRoleMemberChanges.empty()) return;
-
- LLMessageSystem* msg = gMessageSystem;
-
- bool start_message = true;
- for (LLGroupMgrGroupData::change_map_t::const_iterator citer = group_datap->mRoleMemberChanges.begin();
- citer != group_datap->mRoleMemberChanges.end(); ++citer)
- {
- if (start_message)
- {
- msg->newMessage("GroupRoleChanges");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID,gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_GroupID,group_id);
- start_message = false;
- }
- msg->nextBlock("RoleChange");
- msg->addUUID("RoleID",citer->second.mRole);
- msg->addUUID("MemberID",citer->second.mMember);
- msg->addU32("Change",(U32)citer->second.mChange);
-
- if (msg->isSendFullFast())
- {
- gAgent.sendReliableMessage();
- start_message = true;
- }
- }
-
- if (!start_message)
- {
- gAgent.sendReliableMessage();
- }
-
- group_datap->mRoleMemberChanges.clear();
-
- // Not expecting a response, so let anyone else watching know the data has changed.
- group_datap->mChanged = TRUE;
- notifyObservers(GC_ROLE_MEMBER_DATA);
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupRoleMemberChanges" << LL_ENDL;
+ LLGroupMgrGroupData* group_datap = createGroupData(group_id);
+
+ if (group_datap->mRoleMemberChanges.empty()) return;
+
+ LLMessageSystem* msg = gMessageSystem;
+
+ bool start_message = true;
+ for (LLGroupMgrGroupData::change_map_t::const_iterator citer = group_datap->mRoleMemberChanges.begin();
+ citer != group_datap->mRoleMemberChanges.end(); ++citer)
+ {
+ if (start_message)
+ {
+ msg->newMessage("GroupRoleChanges");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID,gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_GroupID,group_id);
+ start_message = false;
+ }
+ msg->nextBlock("RoleChange");
+ msg->addUUID("RoleID",citer->second.mRole);
+ msg->addUUID("MemberID",citer->second.mMember);
+ msg->addU32("Change",(U32)citer->second.mChange);
+
+ if (msg->isSendFullFast())
+ {
+ gAgent.sendReliableMessage();
+ start_message = true;
+ }
+ }
+
+ if (!start_message)
+ {
+ gAgent.sendReliableMessage();
+ }
+
+ group_datap->mRoleMemberChanges.clear();
+
+ // Not expecting a response, so let anyone else watching know the data has changed.
+ group_datap->mChanged = TRUE;
+ notifyObservers(GC_ROLE_MEMBER_DATA);
}
//static
void LLGroupMgr::sendGroupMemberJoin(const LLUUID& group_id)
{
- LLUIUsage::instance().logCommand("Group.Join");
+ LLUIUsage::instance().logCommand("Group.Join");
- LLMessageSystem *msg = gMessageSystem;
+ LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_JoinGroupRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_GroupData);
- msg->addUUIDFast(_PREHASH_GroupID, group_id);
+ msg->newMessageFast(_PREHASH_JoinGroupRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_GroupData);
+ msg->addUUIDFast(_PREHASH_GroupID, group_id);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
}
// member_role_pairs is <member_id,role_id>
// static
void LLGroupMgr::sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID,LLUUID>& member_role_pairs)
{
- bool start_message = true;
- LLMessageSystem* msg = gMessageSystem;
-
- for (std::map<LLUUID,LLUUID>::iterator it = member_role_pairs.begin();
- it != member_role_pairs.end(); ++it)
- {
- if (start_message)
- {
- msg->newMessage("InviteGroupRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->nextBlock("GroupData");
- msg->addUUID("GroupID",group_id);
- start_message = false;
- }
-
- msg->nextBlock("InviteData");
- msg->addUUID("InviteeID",(*it).first);
- msg->addUUID("RoleID",(*it).second);
-
- if (msg->isSendFull())
- {
- gAgent.sendReliableMessage();
- start_message = true;
- }
- }
-
- if (!start_message)
- {
- gAgent.sendReliableMessage();
- }
+ bool start_message = true;
+ LLMessageSystem* msg = gMessageSystem;
+
+ for (std::map<LLUUID,LLUUID>::iterator it = member_role_pairs.begin();
+ it != member_role_pairs.end(); ++it)
+ {
+ if (start_message)
+ {
+ msg->newMessage("InviteGroupRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->nextBlock("GroupData");
+ msg->addUUID("GroupID",group_id);
+ start_message = false;
+ }
+
+ msg->nextBlock("InviteData");
+ msg->addUUID("InviteeID",(*it).first);
+ msg->addUUID("RoleID",(*it).second);
+
+ if (msg->isSendFull())
+ {
+ gAgent.sendReliableMessage();
+ start_message = true;
+ }
+ }
+
+ if (!start_message)
+ {
+ gAgent.sendReliableMessage();
+ }
}
//static
void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
- uuid_vec_t& member_ids)
-{
- bool start_message = true;
- LLMessageSystem* msg = gMessageSystem;
-
- LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (!group_datap) return;
-
- for (uuid_vec_t::iterator it = member_ids.begin();
- it != member_ids.end(); ++it)
- {
- LLUUID& ejected_member_id = (*it);
-
- // Can't use 'eject' to leave a group.
- if (ejected_member_id == gAgent.getID()) continue;
-
- // Make sure they are in the group, and we need the member data
- LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(ejected_member_id);
- if (mit != group_datap->mMembers.end())
- {
- // Add them to the message
- if (start_message)
- {
- msg->newMessage("EjectGroupMemberRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->nextBlock("GroupData");
- msg->addUUID("GroupID",group_id);
- start_message = false;
- }
-
- msg->nextBlock("EjectData");
- msg->addUUID("EjecteeID",ejected_member_id);
-
- if (msg->isSendFull())
- {
- gAgent.sendReliableMessage();
- start_message = true;
- }
-
- LLGroupMemberData* member_data = (*mit).second;
-
- // Clean up groupmgr
- for (LLGroupMemberData::role_list_t::iterator rit = member_data->roleBegin();
- rit != member_data->roleEnd(); ++rit)
- {
- if ((*rit).first.notNull() && (*rit).second!=0)
- {
- (*rit).second->removeMember(ejected_member_id);
- }
- }
-
- group_datap->mMembers.erase(ejected_member_id);
-
- // member_data was introduced and is used here instead of (*mit).second to avoid crash because of invalid iterator
- // It becomes invalid after line with erase above. EXT-4778
- delete member_data;
- }
- }
-
- if (!start_message)
- {
- gAgent.sendReliableMessage();
- }
-
- group_datap->mMemberVersion.generate();
+ uuid_vec_t& member_ids)
+{
+ bool start_message = true;
+ LLMessageSystem* msg = gMessageSystem;
+
+ LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ if (!group_datap) return;
+
+ for (uuid_vec_t::iterator it = member_ids.begin();
+ it != member_ids.end(); ++it)
+ {
+ LLUUID& ejected_member_id = (*it);
+
+ // Can't use 'eject' to leave a group.
+ if (ejected_member_id == gAgent.getID()) continue;
+
+ // Make sure they are in the group, and we need the member data
+ LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(ejected_member_id);
+ if (mit != group_datap->mMembers.end())
+ {
+ // Add them to the message
+ if (start_message)
+ {
+ msg->newMessage("EjectGroupMemberRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->nextBlock("GroupData");
+ msg->addUUID("GroupID",group_id);
+ start_message = false;
+ }
+
+ msg->nextBlock("EjectData");
+ msg->addUUID("EjecteeID",ejected_member_id);
+
+ if (msg->isSendFull())
+ {
+ gAgent.sendReliableMessage();
+ start_message = true;
+ }
+
+ LLGroupMemberData* member_data = (*mit).second;
+
+ // Clean up groupmgr
+ for (LLGroupMemberData::role_list_t::iterator rit = member_data->roleBegin();
+ rit != member_data->roleEnd(); ++rit)
+ {
+ if ((*rit).first.notNull() && (*rit).second!=0)
+ {
+ (*rit).second->removeMember(ejected_member_id);
+ }
+ }
+
+ group_datap->mMembers.erase(ejected_member_id);
+
+ // member_data was introduced and is used here instead of (*mit).second to avoid crash because of invalid iterator
+ // It becomes invalid after line with erase above. EXT-4778
+ delete member_data;
+ }
+ }
+
+ if (!start_message)
+ {
+ gAgent.sendReliableMessage();
+ }
+
+ group_datap->mMemberVersion.generate();
}
void LLGroupMgr::getGroupBanRequestCoro(std::string url, LLUUID groupId)
@@ -2068,31 +2068,31 @@ void LLGroupMgr::postGroupBanRequestCoro(std::string url, LLUUID groupId,
}
}
-void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
- const LLUUID& group_id,
- U32 ban_action, /* = BAN_NO_ACTION */
- const std::vector<LLUUID> &ban_list) /* = std::vector<LLUUID>() */
+void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
+ const LLUUID& group_id,
+ U32 ban_action, /* = BAN_NO_ACTION */
+ const std::vector<LLUUID> &ban_list) /* = std::vector<LLUUID>() */
{
- LLViewerRegion* currentRegion = gAgent.getRegion();
- if(!currentRegion)
- {
- LL_WARNS("GrpMgr") << "Agent does not have a current region. Uh-oh!" << LL_ENDL;
- return;
- }
+ LLViewerRegion* currentRegion = gAgent.getRegion();
+ if(!currentRegion)
+ {
+ LL_WARNS("GrpMgr") << "Agent does not have a current region. Uh-oh!" << LL_ENDL;
+ return;
+ }
- // Check to make sure we have our capabilities
- if(!currentRegion->capabilitiesReceived())
- {
- LL_WARNS("GrpMgr") << " Capabilities not received!" << LL_ENDL;
- return;
- }
+ // Check to make sure we have our capabilities
+ if(!currentRegion->capabilitiesReceived())
+ {
+ LL_WARNS("GrpMgr") << " Capabilities not received!" << LL_ENDL;
+ return;
+ }
- // Get our capability
- std::string cap_url = currentRegion->getCapability("GroupAPIv1");
- if(cap_url.empty())
- {
- return;
- }
+ // Get our capability
+ std::string cap_url = currentRegion->getCapability("GroupAPIv1");
+ if(cap_url.empty())
+ {
+ return;
+ }
U32 action = ban_action & ~BAN_UPDATE;
bool update = ((ban_action & BAN_UPDATE) == BAN_UPDATE);
@@ -2105,7 +2105,7 @@ void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
break;
case REQUEST_POST:
LLCoros::instance().launch("LLGroupMgr::postGroupBanRequestCoro",
- boost::bind(&LLGroupMgr::postGroupBanRequestCoro, this, cap_url, group_id,
+ boost::bind(&LLGroupMgr::postGroupBanRequestCoro, this, cap_url, group_id,
action, ban_list, update));
break;
case REQUEST_PUT:
@@ -2116,39 +2116,39 @@ void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
void LLGroupMgr::processGroupBanRequest(const LLSD& content)
{
- // Did we get anything in content?
- if(!content.size())
- {
- LL_WARNS("GrpMgr") << "No group member data received." << LL_ENDL;
- return;
- }
-
- LLUUID group_id = content["group_id"].asUUID();
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (!gdatap)
- return;
-
- gdatap->clearBanList();
- LLSD::map_const_iterator i = content["ban_list"].beginMap();
- LLSD::map_const_iterator iEnd = content["ban_list"].endMap();
- for(;i != iEnd; ++i)
- {
- const LLUUID ban_id(i->first);
- LLSD ban_entry(i->second);
-
- LLGroupBanData ban_data;
- if(ban_entry.has("ban_date"))
- {
- ban_data.mBanDate = ban_entry["ban_date"].asDate();
- // TODO: Ban Reason
- }
-
- gdatap->createBanEntry(ban_id, ban_data);
- }
-
- gdatap->mChanged = TRUE;
- LLGroupMgr::getInstance()->notifyObservers(GC_BANLIST);
+ // Did we get anything in content?
+ if(!content.size())
+ {
+ LL_WARNS("GrpMgr") << "No group member data received." << LL_ENDL;
+ return;
+ }
+
+ LLUUID group_id = content["group_id"].asUUID();
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ if (!gdatap)
+ return;
+
+ gdatap->clearBanList();
+ LLSD::map_const_iterator i = content["ban_list"].beginMap();
+ LLSD::map_const_iterator iEnd = content["ban_list"].endMap();
+ for(;i != iEnd; ++i)
+ {
+ const LLUUID ban_id(i->first);
+ LLSD ban_entry(i->second);
+
+ LLGroupBanData ban_data;
+ if(ban_entry.has("ban_date"))
+ {
+ ban_data.mBanDate = ban_entry["ban_date"].asDate();
+ // TODO: Ban Reason
+ }
+
+ gdatap->createBanEntry(ban_id, ban_data);
+ }
+
+ gdatap->mChanged = TRUE;
+ LLGroupMgr::getInstance()->notifyObservers(GC_BANLIST);
}
void LLGroupMgr::groupMembersRequestCoro(std::string url, LLUUID groupId)
@@ -2185,36 +2185,36 @@ void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id)
{
static U32 lastGroupMemberRequestFrame = 0;
- // Have we requested the information already this frame?
+ // Have we requested the information already this frame?
// Todo: make this per group, we can invite to one group and simultaneously be checking another one
if ((lastGroupMemberRequestFrame == gFrameCount) || (mMemberRequestInFlight))
- return;
-
- LLViewerRegion* currentRegion = gAgent.getRegion();
- // Thank you FS:Ansariel!
- if(!currentRegion)
- {
- LL_WARNS("GrpMgr") << "Agent does not have a current region. Uh-oh!" << LL_ENDL;
- return;
- }
-
- // Check to make sure we have our capabilities
- if(!currentRegion->capabilitiesReceived())
- {
- LL_WARNS("GrpMgr") << " Capabilities not received!" << LL_ENDL;
- return;
- }
-
- // Get our capability
- std::string cap_url = currentRegion->getCapability("GroupMemberData");
-
- // Thank you FS:Ansariel!
- if(cap_url.empty())
- {
- LL_INFOS("GrpMgr") << "Region has no GroupMemberData capability. Falling back to UDP fetch." << LL_ENDL;
- sendGroupMembersRequest(group_id);
- return;
- }
+ return;
+
+ LLViewerRegion* currentRegion = gAgent.getRegion();
+ // Thank you FS:Ansariel!
+ if(!currentRegion)
+ {
+ LL_WARNS("GrpMgr") << "Agent does not have a current region. Uh-oh!" << LL_ENDL;
+ return;
+ }
+
+ // Check to make sure we have our capabilities
+ if(!currentRegion->capabilitiesReceived())
+ {
+ LL_WARNS("GrpMgr") << " Capabilities not received!" << LL_ENDL;
+ return;
+ }
+
+ // Get our capability
+ std::string cap_url = currentRegion->getCapability("GroupMemberData");
+
+ // Thank you FS:Ansariel!
+ if(cap_url.empty())
+ {
+ LL_INFOS("GrpMgr") << "Region has no GroupMemberData capability. Falling back to UDP fetch." << LL_ENDL;
+ sendGroupMembersRequest(group_id);
+ return;
+ }
LLGroupMgrGroupData* group_datap = createGroupData(group_id); //make sure group exists
group_datap->mMemberRequestID.generate(); // mark as pending
@@ -2228,280 +2228,280 @@ void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id)
void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
{
- // Did we get anything in content?
- if(!content.size())
- {
- LL_DEBUGS("GrpMgr") << "No group member data received." << LL_ENDL;
- return;
- }
-
- LLUUID group_id = content["group_id"].asUUID();
-
- LLGroupMgrGroupData* group_datap = getGroupData(group_id);
- if(!group_datap)
- {
- LL_WARNS("GrpMgr") << "Received incorrect, possibly stale, group or request id" << LL_ENDL;
- return;
- }
-
- // If we have no members, there's no reason to do anything else
- S32 num_members = content["member_count"];
- if (num_members < 1)
- {
- LL_INFOS("GrpMgr") << "Received empty group members list for group id: " << group_id.asString() << LL_ENDL;
- // Set mMemberDataComplete for correct handling of empty responses. See MAINT-5237
- group_datap->mMemberDataComplete = true;
- group_datap->mChanged = TRUE;
- LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA);
- return;
- }
-
- group_datap->mMemberCount = num_members;
-
- LLSD member_list = content["members"];
- LLSD titles = content["titles"];
- LLSD defaults = content["defaults"];
-
- std::string online_status;
- std::string title;
- S32 contribution;
- U64 member_powers;
- // If this is changed to a bool, make sure to change the LLGroupMemberData constructor
- BOOL is_owner;
-
- // Compute this once, rather than every time.
- U64 default_powers = llstrtou64(defaults["default_powers"].asString().c_str(), NULL, 16);
-
- LLSD::map_const_iterator member_iter_start = member_list.beginMap();
- LLSD::map_const_iterator member_iter_end = member_list.endMap();
- for( ; member_iter_start != member_iter_end; ++member_iter_start)
- {
- // Reset defaults
- online_status = "unknown";
- title = titles[0].asString();
- contribution = 0;
- member_powers = default_powers;
- is_owner = false;
-
- const LLUUID member_id(member_iter_start->first);
- LLSD member_info = member_iter_start->second;
-
- if(member_info.has("last_login"))
- {
- online_status = member_info["last_login"].asString();
- if(online_status == "Online")
- online_status = LLTrans::getString("group_member_status_online");
- else
- formatDateString(online_status);
- }
-
- if(member_info.has("title"))
- title = titles[member_info["title"].asInteger()].asString();
-
- if(member_info.has("powers"))
- member_powers = llstrtou64(member_info["powers"].asString().c_str(), NULL, 16);
-
- if(member_info.has("donated_square_meters"))
- contribution = member_info["donated_square_meters"];
-
- if(member_info.has("owner"))
- is_owner = true;
-
- LLGroupMemberData* data = new LLGroupMemberData(member_id,
- contribution,
- member_powers,
- title,
- online_status,
- is_owner);
-
- LLGroupMemberData* member_old = group_datap->mMembers[member_id];
- if (member_old && group_datap->mRoleMemberDataComplete)
- {
- LLGroupMemberData::role_list_t::iterator rit = member_old->roleBegin();
- LLGroupMemberData::role_list_t::iterator end = member_old->roleEnd();
-
- for ( ; rit != end; ++rit)
- {
- data->addRole((*rit).first,(*rit).second);
- }
- }
- else
- {
- group_datap->mRoleMemberDataComplete = false;
- }
-
- group_datap->mMembers[member_id] = data;
- }
-
- group_datap->mMemberVersion.generate();
-
- // Technically, we have this data, but to prevent completely overhauling
- // this entire system (it would be nice, but I don't have the time),
- // I'm going to be dumb and just call services I most likely don't need
- // with the thought being that the system might need it to be done.
- //
- // TODO:
- // Refactor to reduce multiple calls for data we already have.
- if(group_datap->mTitles.size() < 1)
- sendGroupTitlesRequest(group_id);
-
-
- group_datap->mMemberDataComplete = true;
- group_datap->mMemberRequestID.setNull();
- // Make the role-member data request
- if (group_datap->mPendingRoleMemberRequest || !group_datap->mRoleMemberDataComplete)
- {
- group_datap->mPendingRoleMemberRequest = false;
- sendGroupRoleMembersRequest(group_id);
- }
-
- group_datap->mChanged = TRUE;
- notifyObservers(GC_MEMBER_DATA);
+ // Did we get anything in content?
+ if(!content.size())
+ {
+ LL_DEBUGS("GrpMgr") << "No group member data received." << LL_ENDL;
+ return;
+ }
+
+ LLUUID group_id = content["group_id"].asUUID();
+
+ LLGroupMgrGroupData* group_datap = getGroupData(group_id);
+ if(!group_datap)
+ {
+ LL_WARNS("GrpMgr") << "Received incorrect, possibly stale, group or request id" << LL_ENDL;
+ return;
+ }
+
+ // If we have no members, there's no reason to do anything else
+ S32 num_members = content["member_count"];
+ if (num_members < 1)
+ {
+ LL_INFOS("GrpMgr") << "Received empty group members list for group id: " << group_id.asString() << LL_ENDL;
+ // Set mMemberDataComplete for correct handling of empty responses. See MAINT-5237
+ group_datap->mMemberDataComplete = true;
+ group_datap->mChanged = TRUE;
+ LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA);
+ return;
+ }
+
+ group_datap->mMemberCount = num_members;
+
+ LLSD member_list = content["members"];
+ LLSD titles = content["titles"];
+ LLSD defaults = content["defaults"];
+
+ std::string online_status;
+ std::string title;
+ S32 contribution;
+ U64 member_powers;
+ // If this is changed to a bool, make sure to change the LLGroupMemberData constructor
+ BOOL is_owner;
+
+ // Compute this once, rather than every time.
+ U64 default_powers = llstrtou64(defaults["default_powers"].asString().c_str(), NULL, 16);
+
+ LLSD::map_const_iterator member_iter_start = member_list.beginMap();
+ LLSD::map_const_iterator member_iter_end = member_list.endMap();
+ for( ; member_iter_start != member_iter_end; ++member_iter_start)
+ {
+ // Reset defaults
+ online_status = "unknown";
+ title = titles[0].asString();
+ contribution = 0;
+ member_powers = default_powers;
+ is_owner = false;
+
+ const LLUUID member_id(member_iter_start->first);
+ LLSD member_info = member_iter_start->second;
+
+ if(member_info.has("last_login"))
+ {
+ online_status = member_info["last_login"].asString();
+ if(online_status == "Online")
+ online_status = LLTrans::getString("group_member_status_online");
+ else
+ formatDateString(online_status);
+ }
+
+ if(member_info.has("title"))
+ title = titles[member_info["title"].asInteger()].asString();
+
+ if(member_info.has("powers"))
+ member_powers = llstrtou64(member_info["powers"].asString().c_str(), NULL, 16);
+
+ if(member_info.has("donated_square_meters"))
+ contribution = member_info["donated_square_meters"];
+
+ if(member_info.has("owner"))
+ is_owner = true;
+
+ LLGroupMemberData* data = new LLGroupMemberData(member_id,
+ contribution,
+ member_powers,
+ title,
+ online_status,
+ is_owner);
+
+ LLGroupMemberData* member_old = group_datap->mMembers[member_id];
+ if (member_old && group_datap->mRoleMemberDataComplete)
+ {
+ LLGroupMemberData::role_list_t::iterator rit = member_old->roleBegin();
+ LLGroupMemberData::role_list_t::iterator end = member_old->roleEnd();
+
+ for ( ; rit != end; ++rit)
+ {
+ data->addRole((*rit).first,(*rit).second);
+ }
+ }
+ else
+ {
+ group_datap->mRoleMemberDataComplete = false;
+ }
+
+ group_datap->mMembers[member_id] = data;
+ }
+
+ group_datap->mMemberVersion.generate();
+
+ // Technically, we have this data, but to prevent completely overhauling
+ // this entire system (it would be nice, but I don't have the time),
+ // I'm going to be dumb and just call services I most likely don't need
+ // with the thought being that the system might need it to be done.
+ //
+ // TODO:
+ // Refactor to reduce multiple calls for data we already have.
+ if(group_datap->mTitles.size() < 1)
+ sendGroupTitlesRequest(group_id);
+
+
+ group_datap->mMemberDataComplete = true;
+ group_datap->mMemberRequestID.setNull();
+ // Make the role-member data request
+ if (group_datap->mPendingRoleMemberRequest || !group_datap->mRoleMemberDataComplete)
+ {
+ group_datap->mPendingRoleMemberRequest = false;
+ sendGroupRoleMembersRequest(group_id);
+ }
+
+ group_datap->mChanged = TRUE;
+ notifyObservers(GC_MEMBER_DATA);
}
void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupRoleChanges" << LL_ENDL;
- LLGroupMgrGroupData* group_datap = getGroupData(group_id);
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupRoleChanges" << LL_ENDL;
+ LLGroupMgrGroupData* group_datap = getGroupData(group_id);
+
+ if (group_datap && group_datap->pendingRoleChanges())
+ {
+ group_datap->sendRoleChanges();
- if (group_datap && group_datap->pendingRoleChanges())
- {
- group_datap->sendRoleChanges();
-
- // Not expecting a response, so let anyone else watching know the data has changed.
- group_datap->mChanged = TRUE;
- notifyObservers(GC_ROLE_DATA);
- }
+ // Not expecting a response, so let anyone else watching know the data has changed.
+ group_datap->mChanged = TRUE;
+ notifyObservers(GC_ROLE_DATA);
+ }
}
void LLGroupMgr::cancelGroupRoleChanges(const LLUUID& group_id)
{
- LL_DEBUGS("GrpMgr") << "LLGroupMgr::cancelGroupRoleChanges" << LL_ENDL;
- LLGroupMgrGroupData* group_datap = getGroupData(group_id);
+ LL_DEBUGS("GrpMgr") << "LLGroupMgr::cancelGroupRoleChanges" << LL_ENDL;
+ LLGroupMgrGroupData* group_datap = getGroupData(group_id);
- if (group_datap) group_datap->cancelRoleChanges();
+ if (group_datap) group_datap->cancelRoleChanges();
}
//static
bool LLGroupMgr::parseRoleActions(const std::string& xml_filename)
{
- LLXMLNodePtr root;
-
- BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
-
- if (!success || !root || !root->hasName( "role_actions" ))
- {
- LL_ERRS() << "Problem reading UI role_actions file: " << xml_filename << LL_ENDL;
- return false;
- }
-
- LLXMLNodeList role_list;
-
- root->getChildren("action_set", role_list, false);
-
- for (LLXMLNodeList::iterator role_iter = role_list.begin(); role_iter != role_list.end(); ++role_iter)
- {
- LLXMLNodePtr action_set = role_iter->second;
-
- LLRoleActionSet* role_action_set = new LLRoleActionSet();
- LLRoleAction* role_action_data = new LLRoleAction();
-
- // name=
- std::string action_set_name;
- if (action_set->getAttributeString("name", action_set_name))
- {
- LL_DEBUGS("GrpMgr") << "Loading action set " << action_set_name << LL_ENDL;
- role_action_data->mName = action_set_name;
- }
- else
- {
- LL_WARNS() << "Unable to parse action set with no name" << LL_ENDL;
- delete role_action_set;
- delete role_action_data;
- continue;
- }
- // description=
- std::string set_description;
- if (action_set->getAttributeString("description", set_description))
- {
- role_action_data->mDescription = set_description;
- }
- // long description=
- std::string set_longdescription;
- if (action_set->getAttributeString("longdescription", set_longdescription))
- {
- role_action_data->mLongDescription = set_longdescription;
- }
-
- // power mask=
- U64 set_power_mask = 0;
-
- LLXMLNodeList action_list;
- LLXMLNodeList::iterator action_iter;
-
- action_set->getChildren("action", action_list, false);
-
- for (action_iter = action_list.begin(); action_iter != action_list.end(); ++action_iter)
- {
- LLXMLNodePtr action = action_iter->second;
-
- LLRoleAction* role_action = new LLRoleAction();
-
- // name=
- std::string action_name;
- if (action->getAttributeString("name", action_name))
- {
- LL_DEBUGS("GrpMgr") << "Loading action " << action_name << LL_ENDL;
- role_action->mName = action_name;
- }
- else
- {
- LL_WARNS() << "Unable to parse action with no name" << LL_ENDL;
- delete role_action;
- continue;
- }
- // description=
- std::string description;
- if (action->getAttributeString("description", description))
- {
- role_action->mDescription = description;
- }
- // long description=
- std::string longdescription;
- if (action->getAttributeString("longdescription", longdescription))
- {
- role_action->mLongDescription = longdescription;
- }
- // description=
- S32 power_bit = 0;
- if (action->getAttributeS32("value", power_bit))
- {
- if (0 <= power_bit && power_bit < 64)
- {
- role_action->mPowerBit = 0x1LL << power_bit;
- }
- }
-
- set_power_mask |= role_action->mPowerBit;
-
- role_action_set->mActions.push_back(role_action);
- }
-
- role_action_data->mPowerBit = set_power_mask;
- role_action_set->mActionSetData = role_action_data;
-
- LLGroupMgr::getInstance()->mRoleActionSets.push_back(role_action_set);
- }
- return true;
+ LLXMLNodePtr root;
+
+ BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
+
+ if (!success || !root || !root->hasName( "role_actions" ))
+ {
+ LL_ERRS() << "Problem reading UI role_actions file: " << xml_filename << LL_ENDL;
+ return false;
+ }
+
+ LLXMLNodeList role_list;
+
+ root->getChildren("action_set", role_list, false);
+
+ for (LLXMLNodeList::iterator role_iter = role_list.begin(); role_iter != role_list.end(); ++role_iter)
+ {
+ LLXMLNodePtr action_set = role_iter->second;
+
+ LLRoleActionSet* role_action_set = new LLRoleActionSet();
+ LLRoleAction* role_action_data = new LLRoleAction();
+
+ // name=
+ std::string action_set_name;
+ if (action_set->getAttributeString("name", action_set_name))
+ {
+ LL_DEBUGS("GrpMgr") << "Loading action set " << action_set_name << LL_ENDL;
+ role_action_data->mName = action_set_name;
+ }
+ else
+ {
+ LL_WARNS() << "Unable to parse action set with no name" << LL_ENDL;
+ delete role_action_set;
+ delete role_action_data;
+ continue;
+ }
+ // description=
+ std::string set_description;
+ if (action_set->getAttributeString("description", set_description))
+ {
+ role_action_data->mDescription = set_description;
+ }
+ // long description=
+ std::string set_longdescription;
+ if (action_set->getAttributeString("longdescription", set_longdescription))
+ {
+ role_action_data->mLongDescription = set_longdescription;
+ }
+
+ // power mask=
+ U64 set_power_mask = 0;
+
+ LLXMLNodeList action_list;
+ LLXMLNodeList::iterator action_iter;
+
+ action_set->getChildren("action", action_list, false);
+
+ for (action_iter = action_list.begin(); action_iter != action_list.end(); ++action_iter)
+ {
+ LLXMLNodePtr action = action_iter->second;
+
+ LLRoleAction* role_action = new LLRoleAction();
+
+ // name=
+ std::string action_name;
+ if (action->getAttributeString("name", action_name))
+ {
+ LL_DEBUGS("GrpMgr") << "Loading action " << action_name << LL_ENDL;
+ role_action->mName = action_name;
+ }
+ else
+ {
+ LL_WARNS() << "Unable to parse action with no name" << LL_ENDL;
+ delete role_action;
+ continue;
+ }
+ // description=
+ std::string description;
+ if (action->getAttributeString("description", description))
+ {
+ role_action->mDescription = description;
+ }
+ // long description=
+ std::string longdescription;
+ if (action->getAttributeString("longdescription", longdescription))
+ {
+ role_action->mLongDescription = longdescription;
+ }
+ // description=
+ S32 power_bit = 0;
+ if (action->getAttributeS32("value", power_bit))
+ {
+ if (0 <= power_bit && power_bit < 64)
+ {
+ role_action->mPowerBit = 0x1LL << power_bit;
+ }
+ }
+
+ set_power_mask |= role_action->mPowerBit;
+
+ role_action_set->mActions.push_back(role_action);
+ }
+
+ role_action_data->mPowerBit = set_power_mask;
+ role_action_set->mActionSetData = role_action_data;
+
+ LLGroupMgr::getInstance()->mRoleActionSets.push_back(role_action_set);
+ }
+ return true;
}
// static
void LLGroupMgr::debugClearAllGroups(void*)
{
- LLGroupMgr::getInstance()->clearGroups();
- LLGroupMgr::parseRoleActions("role_actions.xml");
+ LLGroupMgr::getInstance()->clearGroups();
+ LLGroupMgr::parseRoleActions("role_actions.xml");
}
diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h
index 0d25e8fb22..c12a0b019a 100644
--- a/indra/newview/llgroupmgr.h
+++ b/indra/newview/llgroupmgr.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llgroupmgr.h
* @brief Manager for aggregating all client knowledge for specific groups
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,13 +42,13 @@ class LLGroupMgr;
enum LLGroupChange
{
- GC_PROPERTIES,
- GC_MEMBER_DATA,
- GC_ROLE_DATA,
- GC_ROLE_MEMBER_DATA,
- GC_TITLES,
- GC_BANLIST,
- GC_ALL
+ GC_PROPERTIES,
+ GC_MEMBER_DATA,
+ GC_ROLE_DATA,
+ GC_ROLE_MEMBER_DATA,
+ GC_TITLES,
+ GC_BANLIST,
+ GC_ALL
};
const U32 GB_MAX_BANNED_AGENTS = 500;
@@ -56,20 +56,20 @@ const U32 GB_MAX_BANNED_AGENTS = 500;
class LLGroupMgrObserver
{
public:
- LLGroupMgrObserver(const LLUUID& id) : mID(id){};
- LLGroupMgrObserver() : mID(LLUUID::null){};
- virtual ~LLGroupMgrObserver(){};
- virtual void changed(LLGroupChange gc) = 0;
- const LLUUID& getID() { return mID; }
+ LLGroupMgrObserver(const LLUUID& id) : mID(id){};
+ LLGroupMgrObserver() : mID(LLUUID::null){};
+ virtual ~LLGroupMgrObserver(){};
+ virtual void changed(LLGroupChange gc) = 0;
+ const LLUUID& getID() { return mID; }
protected:
- LLUUID mID;
+ LLUUID mID;
};
class LLParticularGroupObserver
{
public:
- virtual ~LLParticularGroupObserver(){}
- virtual void changed(const LLUUID& group_id, LLGroupChange gc) = 0;
+ virtual ~LLParticularGroupObserver(){}
+ virtual void changed(const LLUUID& group_id, LLGroupChange gc) = 0;
};
class LLGroupMemberData
@@ -77,56 +77,56 @@ class LLGroupMemberData
friend class LLGroupMgrGroupData;
public:
- typedef std::map<LLUUID,LLGroupRoleData*> role_list_t;
-
- LLGroupMemberData(const LLUUID& id,
- S32 contribution,
- U64 agent_powers,
- const std::string& title,
- const std::string& online_status,
- BOOL is_owner);
-
- ~LLGroupMemberData();
-
- const LLUUID& getID() const { return mID; }
- S32 getContribution() const { return mContribution; }
- U64 getAgentPowers() const { return mAgentPowers; }
- BOOL isOwner() const { return mIsOwner; }
- const std::string& getTitle() const { return mTitle; }
- const std::string& getOnlineStatus() const { return mOnlineStatus; }
- void addRole(const LLUUID& role, LLGroupRoleData* rd);
- bool removeRole(const LLUUID& role);
- void clearRoles() { mRolesList.clear(); };
- role_list_t::iterator roleBegin() { return mRolesList.begin(); }
- role_list_t::iterator roleEnd() { return mRolesList.end(); }
-
- BOOL isInRole(const LLUUID& role_id) { return (mRolesList.find(role_id) != mRolesList.end()); }
+ typedef std::map<LLUUID,LLGroupRoleData*> role_list_t;
+
+ LLGroupMemberData(const LLUUID& id,
+ S32 contribution,
+ U64 agent_powers,
+ const std::string& title,
+ const std::string& online_status,
+ BOOL is_owner);
+
+ ~LLGroupMemberData();
+
+ const LLUUID& getID() const { return mID; }
+ S32 getContribution() const { return mContribution; }
+ U64 getAgentPowers() const { return mAgentPowers; }
+ BOOL isOwner() const { return mIsOwner; }
+ const std::string& getTitle() const { return mTitle; }
+ const std::string& getOnlineStatus() const { return mOnlineStatus; }
+ void addRole(const LLUUID& role, LLGroupRoleData* rd);
+ bool removeRole(const LLUUID& role);
+ void clearRoles() { mRolesList.clear(); };
+ role_list_t::iterator roleBegin() { return mRolesList.begin(); }
+ role_list_t::iterator roleEnd() { return mRolesList.end(); }
+
+ BOOL isInRole(const LLUUID& role_id) { return (mRolesList.find(role_id) != mRolesList.end()); }
private:
- LLUUID mID;
- S32 mContribution;
- U64 mAgentPowers;
- std::string mTitle;
- std::string mOnlineStatus;
- BOOL mIsOwner;
- role_list_t mRolesList;
+ LLUUID mID;
+ S32 mContribution;
+ U64 mAgentPowers;
+ std::string mTitle;
+ std::string mOnlineStatus;
+ BOOL mIsOwner;
+ role_list_t mRolesList;
};
struct LLRoleData
{
- LLRoleData() : mRolePowers(0), mChangeType(RC_UPDATE_NONE) { }
- LLRoleData(const LLRoleData& rd)
- : mRoleName(rd.mRoleName),
- mRoleTitle(rd.mRoleTitle),
- mRoleDescription(rd.mRoleDescription),
- mRolePowers(rd.mRolePowers),
- mChangeType(rd.mChangeType) { }
-
- std::string mRoleName;
- std::string mRoleTitle;
- std::string mRoleDescription;
- U64 mRolePowers;
- LLRoleChangeType mChangeType;
+ LLRoleData() : mRolePowers(0), mChangeType(RC_UPDATE_NONE) { }
+ LLRoleData(const LLRoleData& rd)
+ : mRoleName(rd.mRoleName),
+ mRoleTitle(rd.mRoleTitle),
+ mRoleDescription(rd.mRoleDescription),
+ mRolePowers(rd.mRolePowers),
+ mChangeType(rd.mChangeType) { }
+
+ std::string mRoleName;
+ std::string mRoleTitle;
+ std::string mRoleDescription;
+ U64 mRolePowers;
+ LLRoleChangeType mChangeType;
};
class LLGroupRoleData
@@ -134,94 +134,94 @@ class LLGroupRoleData
friend class LLGroupMgrGroupData;
public:
- LLGroupRoleData(const LLUUID& role_id,
- const std::string& role_name,
- const std::string& role_title,
- const std::string& role_desc,
- const U64 role_powers,
- const S32 member_count);
-
- LLGroupRoleData(const LLUUID& role_id,
- LLRoleData role_data,
- const S32 member_count);
+ LLGroupRoleData(const LLUUID& role_id,
+ const std::string& role_name,
+ const std::string& role_title,
+ const std::string& role_desc,
+ const U64 role_powers,
+ const S32 member_count);
+
+ LLGroupRoleData(const LLUUID& role_id,
+ LLRoleData role_data,
+ const S32 member_count);
+
+ ~LLGroupRoleData();
- ~LLGroupRoleData();
+ const LLUUID& getID() const { return mRoleID; }
- const LLUUID& getID() const { return mRoleID; }
+ const uuid_vec_t& getRoleMembers() const { return mMemberIDs; }
+ S32 getMembersInRole(uuid_vec_t members, BOOL needs_sort = TRUE);
+ S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : mMemberIDs.size(); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225
- const uuid_vec_t& getRoleMembers() const { return mMemberIDs; }
- S32 getMembersInRole(uuid_vec_t members, BOOL needs_sort = TRUE);
- S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : mMemberIDs.size(); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225
+ LLRoleData getRoleData() const { return mRoleData; }
+ void setRoleData(LLRoleData data) { mRoleData = data; }
- LLRoleData getRoleData() const { return mRoleData; }
- void setRoleData(LLRoleData data) { mRoleData = data; }
-
- void addMember(const LLUUID& member);
- bool removeMember(const LLUUID& member);
- void clearMembers();
+ void addMember(const LLUUID& member);
+ bool removeMember(const LLUUID& member);
+ void clearMembers();
- const uuid_vec_t::const_iterator getMembersBegin() const
- { return mMemberIDs.begin(); }
+ const uuid_vec_t::const_iterator getMembersBegin() const
+ { return mMemberIDs.begin(); }
- const uuid_vec_t::const_iterator getMembersEnd() const
- { return mMemberIDs.end(); }
+ const uuid_vec_t::const_iterator getMembersEnd() const
+ { return mMemberIDs.end(); }
protected:
- LLGroupRoleData()
- : mMemberCount(0), mMembersNeedsSort(FALSE) {}
+ LLGroupRoleData()
+ : mMemberCount(0), mMembersNeedsSort(FALSE) {}
- LLUUID mRoleID;
- LLRoleData mRoleData;
+ LLUUID mRoleID;
+ LLRoleData mRoleData;
- uuid_vec_t mMemberIDs;
- S32 mMemberCount;
+ uuid_vec_t mMemberIDs;
+ S32 mMemberCount;
private:
- BOOL mMembersNeedsSort;
+ BOOL mMembersNeedsSort;
};
struct LLRoleMemberChange
{
- LLRoleMemberChange() : mChange(RMC_NONE) { }
- LLRoleMemberChange(const LLUUID& role, const LLUUID& member, LLRoleMemberChangeType change)
- : mRole(role), mMember(member), mChange(change) { }
- LLRoleMemberChange(const LLRoleMemberChange& rc)
- : mRole(rc.mRole), mMember(rc.mMember), mChange(rc.mChange) { }
- LLUUID mRole;
- LLUUID mMember;
- LLRoleMemberChangeType mChange;
+ LLRoleMemberChange() : mChange(RMC_NONE) { }
+ LLRoleMemberChange(const LLUUID& role, const LLUUID& member, LLRoleMemberChangeType change)
+ : mRole(role), mMember(member), mChange(change) { }
+ LLRoleMemberChange(const LLRoleMemberChange& rc)
+ : mRole(rc.mRole), mMember(rc.mMember), mChange(rc.mChange) { }
+ LLUUID mRole;
+ LLUUID mMember;
+ LLRoleMemberChangeType mChange;
};
typedef std::pair<LLUUID,LLUUID> lluuid_pair;
struct lluuid_pair_less
{
- bool operator()(const lluuid_pair& lhs, const lluuid_pair& rhs) const
- {
- if (lhs.first == rhs.first)
- return lhs.second < rhs.second;
- else
- return lhs.first < rhs.first;
- }
+ bool operator()(const lluuid_pair& lhs, const lluuid_pair& rhs) const
+ {
+ if (lhs.first == rhs.first)
+ return lhs.second < rhs.second;
+ else
+ return lhs.first < rhs.first;
+ }
};
struct LLGroupBanData
{
- LLGroupBanData(): mBanDate() {}
- ~LLGroupBanData() {}
-
- LLDate mBanDate;
- // TODO: std:string ban_reason;
+ LLGroupBanData(): mBanDate() {}
+ ~LLGroupBanData() {}
+
+ LLDate mBanDate;
+ // TODO: std:string ban_reason;
};
struct LLGroupTitle
{
- std::string mTitle;
- LLUUID mRoleID;
- BOOL mSelected;
+ std::string mTitle;
+ LLUUID mRoleID;
+ BOOL mSelected;
};
class LLGroupMgrGroupData
@@ -229,211 +229,211 @@ class LLGroupMgrGroupData
friend class LLGroupMgr;
public:
- LLGroupMgrGroupData(const LLUUID& id);
- ~LLGroupMgrGroupData();
-
- const LLUUID& getID() { return mID; }
-
- BOOL getRoleData(const LLUUID& role_id, LLRoleData& role_data);
- void setRoleData(const LLUUID& role_id, LLRoleData role_data);
- void createRole(const LLUUID& role_id, LLRoleData role_data);
- void deleteRole(const LLUUID& role_id);
- BOOL pendingRoleChanges();
-
- void addRolePower(const LLUUID& role_id, U64 power);
- void removeRolePower(const LLUUID& role_id, U64 power);
- U64 getRolePowers(const LLUUID& role_id);
-
- void removeData();
- void removeRoleData();
- void removeMemberData();
- void removeRoleMemberData();
-
- bool changeRoleMember(const LLUUID& role_id, const LLUUID& member_id, LLRoleMemberChangeType rmc);
- void recalcAllAgentPowers();
- void recalcAgentPowers(const LLUUID& agent_id);
-
- bool isMemberDataComplete() { return mMemberDataComplete; }
- bool isRoleDataComplete() { return mRoleDataComplete; }
- bool isRoleMemberDataComplete() { return mRoleMemberDataComplete; }
- bool isGroupPropertiesDataComplete() { return mGroupPropertiesDataComplete; }
-
- bool isMemberDataPending() { return mMemberRequestID.notNull(); }
- bool isRoleDataPending() { return mRoleDataRequestID.notNull(); }
- bool isRoleMemberDataPending() { return (mRoleMembersRequestID.notNull() || mPendingRoleMemberRequest); }
- bool isGroupTitlePending() { return mTitlesRequestID.notNull(); }
-
- bool isSingleMemberNotOwner();
-
- F32 getAccessTime() const { return mAccessTime; }
- void setAccessed();
-
- const LLUUID& getMemberVersion() const { return mMemberVersion; }
-
- void clearBanList() { mBanList.clear(); }
- void getBanList(const LLUUID& group_id, LLGroupBanData& ban_data);
- const LLGroupBanData& getBanEntry(const LLUUID& ban_id) { return mBanList[ban_id]; }
-
- void createBanEntry(const LLUUID& ban_id, const LLGroupBanData& ban_data = LLGroupBanData());
- void removeBanEntry(const LLUUID& ban_id);
- void banMemberById(const LLUUID& participant_uuid);
-
+ LLGroupMgrGroupData(const LLUUID& id);
+ ~LLGroupMgrGroupData();
+
+ const LLUUID& getID() { return mID; }
+
+ BOOL getRoleData(const LLUUID& role_id, LLRoleData& role_data);
+ void setRoleData(const LLUUID& role_id, LLRoleData role_data);
+ void createRole(const LLUUID& role_id, LLRoleData role_data);
+ void deleteRole(const LLUUID& role_id);
+ BOOL pendingRoleChanges();
+
+ void addRolePower(const LLUUID& role_id, U64 power);
+ void removeRolePower(const LLUUID& role_id, U64 power);
+ U64 getRolePowers(const LLUUID& role_id);
+
+ void removeData();
+ void removeRoleData();
+ void removeMemberData();
+ void removeRoleMemberData();
+
+ bool changeRoleMember(const LLUUID& role_id, const LLUUID& member_id, LLRoleMemberChangeType rmc);
+ void recalcAllAgentPowers();
+ void recalcAgentPowers(const LLUUID& agent_id);
+
+ bool isMemberDataComplete() { return mMemberDataComplete; }
+ bool isRoleDataComplete() { return mRoleDataComplete; }
+ bool isRoleMemberDataComplete() { return mRoleMemberDataComplete; }
+ bool isGroupPropertiesDataComplete() { return mGroupPropertiesDataComplete; }
+
+ bool isMemberDataPending() { return mMemberRequestID.notNull(); }
+ bool isRoleDataPending() { return mRoleDataRequestID.notNull(); }
+ bool isRoleMemberDataPending() { return (mRoleMembersRequestID.notNull() || mPendingRoleMemberRequest); }
+ bool isGroupTitlePending() { return mTitlesRequestID.notNull(); }
+
+ bool isSingleMemberNotOwner();
+
+ F32 getAccessTime() const { return mAccessTime; }
+ void setAccessed();
+
+ const LLUUID& getMemberVersion() const { return mMemberVersion; }
+
+ void clearBanList() { mBanList.clear(); }
+ void getBanList(const LLUUID& group_id, LLGroupBanData& ban_data);
+ const LLGroupBanData& getBanEntry(const LLUUID& ban_id) { return mBanList[ban_id]; }
+
+ void createBanEntry(const LLUUID& ban_id, const LLGroupBanData& ban_data = LLGroupBanData());
+ void removeBanEntry(const LLUUID& ban_id);
+ void banMemberById(const LLUUID& participant_uuid);
+
public:
- typedef std::map<LLUUID,LLGroupMemberData*> member_list_t;
- typedef std::map<LLUUID,LLGroupRoleData*> role_list_t;
- typedef std::map<lluuid_pair,LLRoleMemberChange,lluuid_pair_less> change_map_t;
- typedef std::map<LLUUID,LLRoleData> role_data_map_t;
- typedef std::map<LLUUID,LLGroupBanData> ban_list_t;
-
- member_list_t mMembers;
- role_list_t mRoles;
- change_map_t mRoleMemberChanges;
- role_data_map_t mRoleChanges;
- ban_list_t mBanList;
-
- std::vector<LLGroupTitle> mTitles;
-
- LLUUID mID;
- LLUUID mOwnerRole;
- std::string mName;
- std::string mCharter;
- BOOL mShowInList;
- LLUUID mInsigniaID;
- LLUUID mFounderID;
- BOOL mOpenEnrollment;
- S32 mMembershipFee;
- BOOL mAllowPublish;
- BOOL mListInProfile;
- BOOL mMaturePublish;
- BOOL mChanged;
- S32 mMemberCount;
- S32 mRoleCount;
-
- bool mPendingBanRequest;
- LLUUID mPendingBanMemberID;
+ typedef std::map<LLUUID,LLGroupMemberData*> member_list_t;
+ typedef std::map<LLUUID,LLGroupRoleData*> role_list_t;
+ typedef std::map<lluuid_pair,LLRoleMemberChange,lluuid_pair_less> change_map_t;
+ typedef std::map<LLUUID,LLRoleData> role_data_map_t;
+ typedef std::map<LLUUID,LLGroupBanData> ban_list_t;
+
+ member_list_t mMembers;
+ role_list_t mRoles;
+ change_map_t mRoleMemberChanges;
+ role_data_map_t mRoleChanges;
+ ban_list_t mBanList;
+
+ std::vector<LLGroupTitle> mTitles;
+
+ LLUUID mID;
+ LLUUID mOwnerRole;
+ std::string mName;
+ std::string mCharter;
+ BOOL mShowInList;
+ LLUUID mInsigniaID;
+ LLUUID mFounderID;
+ BOOL mOpenEnrollment;
+ S32 mMembershipFee;
+ BOOL mAllowPublish;
+ BOOL mListInProfile;
+ BOOL mMaturePublish;
+ BOOL mChanged;
+ S32 mMemberCount;
+ S32 mRoleCount;
+
+ bool mPendingBanRequest;
+ LLUUID mPendingBanMemberID;
protected:
- void sendRoleChanges();
- void cancelRoleChanges();
+ void sendRoleChanges();
+ void cancelRoleChanges();
private:
- LLUUID mMemberRequestID;
- LLUUID mRoleDataRequestID;
- LLUUID mRoleMembersRequestID;
- LLUUID mTitlesRequestID;
- U32 mReceivedRoleMemberPairs;
-
- bool mMemberDataComplete;
- bool mRoleDataComplete;
- bool mRoleMemberDataComplete;
- bool mGroupPropertiesDataComplete;
-
- bool mPendingRoleMemberRequest;
- F32 mAccessTime;
-
- // Generate a new ID every time mMembers
- LLUUID mMemberVersion;
+ LLUUID mMemberRequestID;
+ LLUUID mRoleDataRequestID;
+ LLUUID mRoleMembersRequestID;
+ LLUUID mTitlesRequestID;
+ U32 mReceivedRoleMemberPairs;
+
+ bool mMemberDataComplete;
+ bool mRoleDataComplete;
+ bool mRoleMemberDataComplete;
+ bool mGroupPropertiesDataComplete;
+
+ bool mPendingRoleMemberRequest;
+ F32 mAccessTime;
+
+ // Generate a new ID every time mMembers
+ LLUUID mMemberVersion;
};
struct LLRoleAction
{
- std::string mName;
- std::string mDescription;
- std::string mLongDescription;
- U64 mPowerBit;
+ std::string mName;
+ std::string mDescription;
+ std::string mLongDescription;
+ U64 mPowerBit;
};
struct LLRoleActionSet
{
- LLRoleActionSet();
- ~LLRoleActionSet();
- LLRoleAction* mActionSetData;
- std::vector<LLRoleAction*> mActions;
+ LLRoleActionSet();
+ ~LLRoleActionSet();
+ LLRoleAction* mActionSetData;
+ std::vector<LLRoleAction*> mActions;
};
class LLGroupMgr : public LLSingleton<LLGroupMgr>
{
- LLSINGLETON(LLGroupMgr);
- ~LLGroupMgr();
- LOG_CLASS(LLGroupMgr);
-
+ LLSINGLETON(LLGroupMgr);
+ ~LLGroupMgr();
+ LOG_CLASS(LLGroupMgr);
+
public:
- enum EBanRequestType
- {
- REQUEST_GET = 0,
- REQUEST_POST,
- REQUEST_PUT,
- REQUEST_DEL
- };
-
- enum EBanRequestAction
- {
- BAN_NO_ACTION = 0,
- BAN_CREATE = 1,
- BAN_DELETE = 2,
- BAN_UPDATE = 4
- };
+ enum EBanRequestType
+ {
+ REQUEST_GET = 0,
+ REQUEST_POST,
+ REQUEST_PUT,
+ REQUEST_DEL
+ };
+
+ enum EBanRequestAction
+ {
+ BAN_NO_ACTION = 0,
+ BAN_CREATE = 1,
+ BAN_DELETE = 2,
+ BAN_UPDATE = 4
+ };
public:
- void addObserver(LLGroupMgrObserver* observer);
- void addObserver(const LLUUID& group_id, LLParticularGroupObserver* observer);
- void removeObserver(LLGroupMgrObserver* observer);
- void removeObserver(const LLUUID& group_id, LLParticularGroupObserver* observer);
- LLGroupMgrGroupData* getGroupData(const LLUUID& id);
-
- void sendGroupPropertiesRequest(const LLUUID& group_id);
- void sendGroupRoleDataRequest(const LLUUID& group_id);
- void sendGroupRoleMembersRequest(const LLUUID& group_id);
- void sendGroupMembersRequest(const LLUUID& group_id);
- void sendGroupTitlesRequest(const LLUUID& group_id);
- void sendGroupTitleUpdate(const LLUUID& group_id, const LLUUID& title_role_id);
- void sendUpdateGroupInfo(const LLUUID& group_id);
- void sendGroupRoleMemberChanges(const LLUUID& group_id);
- void sendGroupRoleChanges(const LLUUID& group_id);
-
- static void sendCreateGroupRequest(const std::string& name,
- const std::string& charter,
- U8 show_in_list,
- const LLUUID& insignia,
- S32 membership_fee,
- BOOL open_enrollment,
- BOOL allow_publish,
- BOOL mature_publish);
-
- static void sendGroupMemberJoin(const LLUUID& group_id);
- static void sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID,LLUUID>& role_member_pairs);
- static void sendGroupMemberEjects(const LLUUID& group_id,
- uuid_vec_t& member_ids);
-
- void sendGroupBanRequest(EBanRequestType request_type,
- const LLUUID& group_id,
- U32 ban_action = BAN_NO_ACTION,
- const uuid_vec_t &ban_list = uuid_vec_t());
-
-
- void sendCapGroupMembersRequest(const LLUUID& group_id);
-
- void cancelGroupRoleChanges(const LLUUID& group_id);
-
- static void processGroupPropertiesReply(LLMessageSystem* msg, void** data);
- static void processGroupMembersReply(LLMessageSystem* msg, void** data);
- static void processGroupRoleDataReply(LLMessageSystem* msg, void** data);
- static void processGroupRoleMembersReply(LLMessageSystem* msg, void** data);
- static void processGroupTitlesReply(LLMessageSystem* msg, void** data);
- static void processCreateGroupReply(LLMessageSystem* msg, void** data);
- static void processJoinGroupReply(LLMessageSystem* msg, void ** data);
- static void processEjectGroupMemberReply(LLMessageSystem* msg, void ** data);
- static void processLeaveGroupReply(LLMessageSystem* msg, void ** data);
-
- static bool parseRoleActions(const std::string& xml_filename);
-
- std::vector<LLRoleActionSet*> mRoleActionSets;
-
- static void debugClearAllGroups(void*);
- void clearGroups();
- void clearGroupData(const LLUUID& group_id);
+ void addObserver(LLGroupMgrObserver* observer);
+ void addObserver(const LLUUID& group_id, LLParticularGroupObserver* observer);
+ void removeObserver(LLGroupMgrObserver* observer);
+ void removeObserver(const LLUUID& group_id, LLParticularGroupObserver* observer);
+ LLGroupMgrGroupData* getGroupData(const LLUUID& id);
+
+ void sendGroupPropertiesRequest(const LLUUID& group_id);
+ void sendGroupRoleDataRequest(const LLUUID& group_id);
+ void sendGroupRoleMembersRequest(const LLUUID& group_id);
+ void sendGroupMembersRequest(const LLUUID& group_id);
+ void sendGroupTitlesRequest(const LLUUID& group_id);
+ void sendGroupTitleUpdate(const LLUUID& group_id, const LLUUID& title_role_id);
+ void sendUpdateGroupInfo(const LLUUID& group_id);
+ void sendGroupRoleMemberChanges(const LLUUID& group_id);
+ void sendGroupRoleChanges(const LLUUID& group_id);
+
+ static void sendCreateGroupRequest(const std::string& name,
+ const std::string& charter,
+ U8 show_in_list,
+ const LLUUID& insignia,
+ S32 membership_fee,
+ BOOL open_enrollment,
+ BOOL allow_publish,
+ BOOL mature_publish);
+
+ static void sendGroupMemberJoin(const LLUUID& group_id);
+ static void sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID,LLUUID>& role_member_pairs);
+ static void sendGroupMemberEjects(const LLUUID& group_id,
+ uuid_vec_t& member_ids);
+
+ void sendGroupBanRequest(EBanRequestType request_type,
+ const LLUUID& group_id,
+ U32 ban_action = BAN_NO_ACTION,
+ const uuid_vec_t &ban_list = uuid_vec_t());
+
+
+ void sendCapGroupMembersRequest(const LLUUID& group_id);
+
+ void cancelGroupRoleChanges(const LLUUID& group_id);
+
+ static void processGroupPropertiesReply(LLMessageSystem* msg, void** data);
+ static void processGroupMembersReply(LLMessageSystem* msg, void** data);
+ static void processGroupRoleDataReply(LLMessageSystem* msg, void** data);
+ static void processGroupRoleMembersReply(LLMessageSystem* msg, void** data);
+ static void processGroupTitlesReply(LLMessageSystem* msg, void** data);
+ static void processCreateGroupReply(LLMessageSystem* msg, void** data);
+ static void processJoinGroupReply(LLMessageSystem* msg, void ** data);
+ static void processEjectGroupMemberReply(LLMessageSystem* msg, void ** data);
+ static void processLeaveGroupReply(LLMessageSystem* msg, void ** data);
+
+ static bool parseRoleActions(const std::string& xml_filename);
+
+ std::vector<LLRoleActionSet*> mRoleActionSets;
+
+ static void debugClearAllGroups(void*);
+ void clearGroups();
+ void clearGroupData(const LLUUID& group_id);
private:
void groupMembersRequestCoro(std::string url, LLUUID groupId);
@@ -444,26 +444,26 @@ private:
static void processGroupBanRequest(const LLSD& content);
- void notifyObservers(LLGroupChange gc);
- void notifyObserver(const LLUUID& group_id, LLGroupChange gc);
- void addGroup(LLGroupMgrGroupData* group_datap);
- LLGroupMgrGroupData* createGroupData(const LLUUID &id);
- bool hasPendingPropertyRequest(const LLUUID& id);
- void addPendingPropertyRequest(const LLUUID& id);
+ void notifyObservers(LLGroupChange gc);
+ void notifyObserver(const LLUUID& group_id, LLGroupChange gc);
+ void addGroup(LLGroupMgrGroupData* group_datap);
+ LLGroupMgrGroupData* createGroupData(const LLUUID &id);
+ bool hasPendingPropertyRequest(const LLUUID& id);
+ void addPendingPropertyRequest(const LLUUID& id);
- typedef std::multimap<LLUUID,LLGroupMgrObserver*> observer_multimap_t;
- observer_multimap_t mObservers;
+ typedef std::multimap<LLUUID,LLGroupMgrObserver*> observer_multimap_t;
+ observer_multimap_t mObservers;
- typedef std::map<LLUUID, LLGroupMgrGroupData*> group_map_t;
- group_map_t mGroups;
+ typedef std::map<LLUUID, LLGroupMgrGroupData*> group_map_t;
+ group_map_t mGroups;
- const U64MicrosecondsImplicit MIN_GROUP_PROPERTY_REQUEST_FREQ = 100000;//100ms between requests should be enough to avoid spamming.
- typedef std::map<LLUUID, U64MicrosecondsImplicit> properties_request_map_t;
- properties_request_map_t mPropRequests;
+ const U64MicrosecondsImplicit MIN_GROUP_PROPERTY_REQUEST_FREQ = 100000;//100ms between requests should be enough to avoid spamming.
+ typedef std::map<LLUUID, U64MicrosecondsImplicit> properties_request_map_t;
+ properties_request_map_t mPropRequests;
- typedef std::set<LLParticularGroupObserver*> observer_set_t;
- typedef std::map<LLUUID,observer_set_t> observer_map_t;
- observer_map_t mParticularObservers;
+ typedef std::set<LLParticularGroupObserver*> observer_set_t;
+ typedef std::map<LLUUID,observer_set_t> observer_map_t;
+ observer_map_t mParticularObservers;
bool mMemberRequestInFlight;
};
diff --git a/indra/newview/llhasheduniqueid.cpp b/indra/newview/llhasheduniqueid.cpp
index 38dafc167f..077f699c48 100644
--- a/indra/newview/llhasheduniqueid.cpp
+++ b/indra/newview/llhasheduniqueid.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhasheduniqueid.cpp
* @brief retrieves an obfuscated unique id for the system
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,24 +32,24 @@
bool llHashedUniqueID(unsigned char id[MD5HEX_STR_SIZE])
{
- bool idIsUnique = true;
- LLMD5 hashed_unique_id;
- unsigned char unique_id[MAC_ADDRESS_BYTES];
+ bool idIsUnique = true;
+ LLMD5 hashed_unique_id;
+ unsigned char unique_id[MAC_ADDRESS_BYTES];
if ( LLMachineID::getUniqueID(unique_id, sizeof(unique_id))
|| LLUUID::getNodeID(unique_id)
- )
- {
- hashed_unique_id.update(unique_id, MAC_ADDRESS_BYTES);
- hashed_unique_id.finalize();
- hashed_unique_id.hex_digest((char*)id);
- LL_INFOS_ONCE("AppInit") << "System ID " << id << LL_ENDL;
- }
- else
- {
- idIsUnique = false;
- memcpy(id,"00000000000000000000000000000000", MD5HEX_STR_SIZE);
- LL_WARNS_ONCE("AppInit") << "Failed to get an id; cannot uniquely identify this machine." << LL_ENDL;
- }
- return idIsUnique;
+ )
+ {
+ hashed_unique_id.update(unique_id, MAC_ADDRESS_BYTES);
+ hashed_unique_id.finalize();
+ hashed_unique_id.hex_digest((char*)id);
+ LL_INFOS_ONCE("AppInit") << "System ID " << id << LL_ENDL;
+ }
+ else
+ {
+ idIsUnique = false;
+ memcpy(id,"00000000000000000000000000000000", MD5HEX_STR_SIZE);
+ LL_WARNS_ONCE("AppInit") << "Failed to get an id; cannot uniquely identify this machine." << LL_ENDL;
+ }
+ return idIsUnique;
}
diff --git a/indra/newview/llhasheduniqueid.h b/indra/newview/llhasheduniqueid.h
index 8ef706c1f3..afc3e76a5f 100644
--- a/indra/newview/llhasheduniqueid.h
+++ b/indra/newview/llhasheduniqueid.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhasheduniqueid.h
* @brief retrieves obfuscated but unique id for the system
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
#define LL_LLHASHEDUNIQUEID_H
#include "llmd5.h"
-/// Get an obfuscated identifier for this system
+/// Get an obfuscated identifier for this system
bool llHashedUniqueID(unsigned char id[MD5HEX_STR_SIZE]);
///< @returns true if the id is considered valid (if false, the id is all zeros)
diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp
index 7271376a3c..1de2a64d72 100644
--- a/indra/newview/llhints.cpp
+++ b/indra/newview/llhints.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,312 +40,312 @@ class LLHintPopup : public LLPanel
{
public:
- typedef enum e_popup_direction
- {
- LEFT,
- TOP,
- RIGHT,
- BOTTOM,
- TOP_RIGHT
- } EPopupDirection;
-
- struct PopupDirections : public LLInitParam::TypeValuesHelper<LLHintPopup::EPopupDirection, PopupDirections>
- {
- static void declareValues()
- {
- declare("left", LLHintPopup::LEFT);
- declare("right", LLHintPopup::RIGHT);
- declare("top", LLHintPopup::TOP);
- declare("bottom", LLHintPopup::BOTTOM);
- declare("top_right", LLHintPopup::TOP_RIGHT);
- }
- };
-
- struct TargetParams : public LLInitParam::Block<TargetParams>
- {
- Mandatory<std::string> target;
- Mandatory<EPopupDirection, PopupDirections> direction;
-
- TargetParams()
- : target("target"),
- direction("direction")
- {}
- };
-
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {
- Mandatory<LLNotificationPtr> notification;
- Optional<TargetParams> target_params;
- Optional<S32> distance;
- Optional<LLUIImage*> left_arrow,
- up_arrow,
- right_arrow,
- down_arrow,
- lower_left_arrow,
- hint_image;
-
- Optional<S32> left_arrow_offset,
- up_arrow_offset,
- right_arrow_offset,
- down_arrow_offset;
- Optional<F32> fade_in_time,
- fade_out_time;
-
- Params()
- : distance("distance"),
- left_arrow("left_arrow"),
- up_arrow("up_arrow"),
- right_arrow("right_arrow"),
- down_arrow("down_arrow"),
- lower_left_arrow("lower_left_arrow"),
- hint_image("hint_image"),
- left_arrow_offset("left_arrow_offset"),
- up_arrow_offset("up_arrow_offset"),
- right_arrow_offset("right_arrow_offset"),
- down_arrow_offset("down_arrow_offset"),
- fade_in_time("fade_in_time"),
- fade_out_time("fade_out_time")
- {}
- };
-
- LLHintPopup(const Params&);
-
- /*virtual*/ BOOL postBuild();
-
- void onClickClose()
- {
- if (!mHidden)
- {
- hide();
- LLNotifications::instance().cancel(mNotification);
- }
- }
- void draw();
- void hide() { if(!mHidden) {mHidden = true; mFadeTimer.reset();} }
+ typedef enum e_popup_direction
+ {
+ LEFT,
+ TOP,
+ RIGHT,
+ BOTTOM,
+ TOP_RIGHT
+ } EPopupDirection;
+
+ struct PopupDirections : public LLInitParam::TypeValuesHelper<LLHintPopup::EPopupDirection, PopupDirections>
+ {
+ static void declareValues()
+ {
+ declare("left", LLHintPopup::LEFT);
+ declare("right", LLHintPopup::RIGHT);
+ declare("top", LLHintPopup::TOP);
+ declare("bottom", LLHintPopup::BOTTOM);
+ declare("top_right", LLHintPopup::TOP_RIGHT);
+ }
+ };
+
+ struct TargetParams : public LLInitParam::Block<TargetParams>
+ {
+ Mandatory<std::string> target;
+ Mandatory<EPopupDirection, PopupDirections> direction;
+
+ TargetParams()
+ : target("target"),
+ direction("direction")
+ {}
+ };
+
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Mandatory<LLNotificationPtr> notification;
+ Optional<TargetParams> target_params;
+ Optional<S32> distance;
+ Optional<LLUIImage*> left_arrow,
+ up_arrow,
+ right_arrow,
+ down_arrow,
+ lower_left_arrow,
+ hint_image;
+
+ Optional<S32> left_arrow_offset,
+ up_arrow_offset,
+ right_arrow_offset,
+ down_arrow_offset;
+ Optional<F32> fade_in_time,
+ fade_out_time;
+
+ Params()
+ : distance("distance"),
+ left_arrow("left_arrow"),
+ up_arrow("up_arrow"),
+ right_arrow("right_arrow"),
+ down_arrow("down_arrow"),
+ lower_left_arrow("lower_left_arrow"),
+ hint_image("hint_image"),
+ left_arrow_offset("left_arrow_offset"),
+ up_arrow_offset("up_arrow_offset"),
+ right_arrow_offset("right_arrow_offset"),
+ down_arrow_offset("down_arrow_offset"),
+ fade_in_time("fade_in_time"),
+ fade_out_time("fade_out_time")
+ {}
+ };
+
+ LLHintPopup(const Params&);
+
+ /*virtual*/ BOOL postBuild();
+
+ void onClickClose()
+ {
+ if (!mHidden)
+ {
+ hide();
+ LLNotifications::instance().cancel(mNotification);
+ }
+ }
+ void draw();
+ void hide() { if(!mHidden) {mHidden = true; mFadeTimer.reset();} }
private:
- LLNotificationPtr mNotification;
- std::string mTarget;
- EPopupDirection mDirection;
- S32 mDistance;
- LLUIImagePtr mArrowLeft,
- mArrowUp,
- mArrowRight,
- mArrowDown,
- mArrowDownAndLeft;
- S32 mArrowLeftOffset,
- mArrowUpOffset,
- mArrowRightOffset,
- mArrowDownOffset;
- LLFrameTimer mFadeTimer;
- F32 mFadeInTime,
- mFadeOutTime;
- bool mHidden;
+ LLNotificationPtr mNotification;
+ std::string mTarget;
+ EPopupDirection mDirection;
+ S32 mDistance;
+ LLUIImagePtr mArrowLeft,
+ mArrowUp,
+ mArrowRight,
+ mArrowDown,
+ mArrowDownAndLeft;
+ S32 mArrowLeftOffset,
+ mArrowUpOffset,
+ mArrowRightOffset,
+ mArrowDownOffset;
+ LLFrameTimer mFadeTimer;
+ F32 mFadeInTime,
+ mFadeOutTime;
+ bool mHidden;
};
static LLDefaultChildRegistry::Register<LLHintPopup> r("hint_popup");
LLHintPopup::LLHintPopup(const LLHintPopup::Params& p)
-: mNotification(p.notification),
- mDirection(TOP),
- mDistance(p.distance),
- mArrowLeft(p.left_arrow),
- mArrowUp(p.up_arrow),
- mArrowRight(p.right_arrow),
- mArrowDown(p.down_arrow),
- mArrowDownAndLeft(p.lower_left_arrow),
- mArrowLeftOffset(p.left_arrow_offset),
- mArrowUpOffset(p.up_arrow_offset),
- mArrowRightOffset(p.right_arrow_offset),
- mArrowDownOffset(p.down_arrow_offset),
- mHidden(false),
- mFadeInTime(p.fade_in_time),
- mFadeOutTime(p.fade_out_time),
- LLPanel(p)
+: mNotification(p.notification),
+ mDirection(TOP),
+ mDistance(p.distance),
+ mArrowLeft(p.left_arrow),
+ mArrowUp(p.up_arrow),
+ mArrowRight(p.right_arrow),
+ mArrowDown(p.down_arrow),
+ mArrowDownAndLeft(p.lower_left_arrow),
+ mArrowLeftOffset(p.left_arrow_offset),
+ mArrowUpOffset(p.up_arrow_offset),
+ mArrowRightOffset(p.right_arrow_offset),
+ mArrowDownOffset(p.down_arrow_offset),
+ mHidden(false),
+ mFadeInTime(p.fade_in_time),
+ mFadeOutTime(p.fade_out_time),
+ LLPanel(p)
{
- if (p.target_params.isProvided())
- {
- mDirection = p.target_params.direction;
- mTarget = p.target_params.target;
- }
- if (p.hint_image.isProvided())
- {
- buildFromFile("panel_hint_image.xml", p);
- getChild<LLIconCtrl>("hint_image")->setImage(p.hint_image());
- }
- else
- {
- buildFromFile( "panel_hint.xml", p);
- }
+ if (p.target_params.isProvided())
+ {
+ mDirection = p.target_params.direction;
+ mTarget = p.target_params.target;
+ }
+ if (p.hint_image.isProvided())
+ {
+ buildFromFile("panel_hint_image.xml", p);
+ getChild<LLIconCtrl>("hint_image")->setImage(p.hint_image());
+ }
+ else
+ {
+ buildFromFile( "panel_hint.xml", p);
+ }
}
BOOL LLHintPopup::postBuild()
{
- LLTextBox& hint_text = getChildRef<LLTextBox>("hint_text");
- hint_text.setText(mNotification->getMessage());
-
- getChild<LLButton>("close")->setClickedCallback(boost::bind(&LLHintPopup::onClickClose, this));
- getChild<LLTextBox>("hint_title")->setText(mNotification->getLabel());
-
- LLRect text_bounds = hint_text.getTextBoundingRect();
- S32 delta_height = text_bounds.getHeight() - hint_text.getRect().getHeight();
- reshape(getRect().getWidth(), getRect().getHeight() + delta_height);
- hint_text.reshape(hint_text.getRect().getWidth(), hint_text.getRect().getHeight() + delta_height);
-// hint_text.translate(0, -delta_height);
- return TRUE;
+ LLTextBox& hint_text = getChildRef<LLTextBox>("hint_text");
+ hint_text.setText(mNotification->getMessage());
+
+ getChild<LLButton>("close")->setClickedCallback(boost::bind(&LLHintPopup::onClickClose, this));
+ getChild<LLTextBox>("hint_title")->setText(mNotification->getLabel());
+
+ LLRect text_bounds = hint_text.getTextBoundingRect();
+ S32 delta_height = text_bounds.getHeight() - hint_text.getRect().getHeight();
+ reshape(getRect().getWidth(), getRect().getHeight() + delta_height);
+ hint_text.reshape(hint_text.getRect().getWidth(), hint_text.getRect().getHeight() + delta_height);
+// hint_text.translate(0, -delta_height);
+ return TRUE;
}
void LLHintPopup::draw()
{
- F32 alpha = 1.f;
- if (mHidden)
- {
- alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, mFadeOutTime, 1.f, 0.f);
- if (alpha == 0.f)
- {
- die();
- return;
- }
- }
- else
- {
- alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, mFadeInTime, 0.f, 1.f);
- }
-
- LLIconCtrl* hint_icon = findChild<LLIconCtrl>("hint_image");
-
- if (hint_icon)
- {
- LLUIImagePtr hint_image = hint_icon->getImage();
- S32 image_height = hint_image.isNull() ? 0 : hint_image->getHeight();
- S32 image_width = hint_image.isNull() ? 0 : hint_image->getWidth();
-
- LLView* layout_stack = hint_icon->getParent()->getParent();
- S32 delta_height = image_height - layout_stack->getRect().getHeight();
- hint_icon->getParent()->reshape(image_width, hint_icon->getParent()->getRect().getHeight());
- layout_stack->reshape(layout_stack->getRect().getWidth(), image_height);
- layout_stack->translate(0, -delta_height);
-
- LLRect hint_rect = getLocalRect();
- reshape(hint_rect.getWidth(), hint_rect.getHeight() + delta_height);
- }
-
- { LLViewDrawContext context(alpha);
-
- if (mTarget.empty())
- {
- // just draw contents, no arrow, in default position
- LLPanel::draw();
- }
- else
- {
- LLView* targetp = LLHints::getInstance()->getHintTarget(mTarget).get();
- if (!targetp)
- {
- // target widget is no longer valid, go away
- die();
- }
- else if (!targetp->isInVisibleChain())
- {
- // if target is invisible, don't draw, but keep alive in case widget comes back
- // but do make it so that it allows mouse events to pass through
- setEnabled(false);
- setMouseOpaque(false);
- }
- else
- {
- // revert back enabled and mouse opaque state in case we disabled it before
- setEnabled(true);
- setMouseOpaque(true);
-
- LLRect target_rect;
- targetp->localRectToOtherView(targetp->getLocalRect(), &target_rect, getParent());
-
- LLRect my_local_rect = getLocalRect();
- LLRect my_rect;
- LLRect arrow_rect;
- LLUIImagePtr arrow_imagep;
-
- switch(mDirection)
- {
- case LEFT:
- my_rect.setCenterAndSize( target_rect.mLeft - (my_local_rect.getWidth() / 2 + mDistance),
- target_rect.getCenterY(),
- my_local_rect.getWidth(),
- my_local_rect.getHeight());
- if (mArrowRight)
- {
- arrow_rect.setCenterAndSize(my_local_rect.mRight + mArrowRight->getWidth() / 2 + mArrowRightOffset,
- my_local_rect.getCenterY(),
- mArrowRight->getWidth(),
- mArrowRight->getHeight());
- arrow_imagep = mArrowRight;
- }
- break;
- case TOP:
- my_rect.setCenterAndSize( target_rect.getCenterX(),
- target_rect.mTop + (my_local_rect.getHeight() / 2 + mDistance),
- my_local_rect.getWidth(),
- my_local_rect.getHeight());
- if (mArrowDown)
- {
- arrow_rect.setCenterAndSize(my_local_rect.getCenterX(),
- my_local_rect.mBottom - mArrowDown->getHeight() / 2 + mArrowDownOffset,
- mArrowDown->getWidth(),
- mArrowDown->getHeight());
- arrow_imagep = mArrowDown;
- }
- break;
- case RIGHT:
- my_rect.setCenterAndSize( target_rect.mRight + (my_local_rect.getWidth() / 2 + mDistance),
- target_rect.getCenterY(),
- my_local_rect.getWidth(),
- my_local_rect.getHeight());
- if (mArrowLeft)
- {
- arrow_rect.setCenterAndSize(my_local_rect.mLeft - mArrowLeft->getWidth() / 2 + mArrowLeftOffset,
- my_local_rect.getCenterY(),
- mArrowLeft->getWidth(),
- mArrowLeft->getHeight());
- arrow_imagep = mArrowLeft;
- }
- break;
- case BOTTOM:
- my_rect.setCenterAndSize( target_rect.getCenterX(),
- target_rect.mBottom - (my_local_rect.getHeight() / 2 + mDistance),
- my_local_rect.getWidth(),
- my_local_rect.getHeight());
- if (mArrowUp)
- {
- arrow_rect.setCenterAndSize(my_local_rect.getCenterX(),
- my_local_rect.mTop + mArrowUp->getHeight() / 2 + mArrowUpOffset,
- mArrowUp->getWidth(),
- mArrowUp->getHeight());
- arrow_imagep = mArrowUp;
- }
- break;
- case TOP_RIGHT:
- my_rect.setCenterAndSize( target_rect.mRight + (my_local_rect.getWidth() / 2),
- target_rect.mTop + (my_local_rect.getHeight() / 2 + mDistance),
- my_local_rect.getWidth(),
- my_local_rect.getHeight());
- if (mArrowDownAndLeft)
- {
- arrow_rect.setCenterAndSize(my_local_rect.mLeft + mArrowDownAndLeft->getWidth() / 2 + mArrowLeftOffset,
- my_local_rect.mBottom - mArrowDownAndLeft->getHeight() / 2 + mArrowDownOffset,
- mArrowDownAndLeft->getWidth(),
- mArrowDownAndLeft->getHeight());
- arrow_imagep = mArrowDownAndLeft;
- }
- }
- setShape(my_rect);
- LLPanel::draw();
-
- if (arrow_imagep) arrow_imagep->draw(arrow_rect, LLColor4(1.f, 1.f, 1.f, alpha));
- }
- }
- }
+ F32 alpha = 1.f;
+ if (mHidden)
+ {
+ alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, mFadeOutTime, 1.f, 0.f);
+ if (alpha == 0.f)
+ {
+ die();
+ return;
+ }
+ }
+ else
+ {
+ alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, mFadeInTime, 0.f, 1.f);
+ }
+
+ LLIconCtrl* hint_icon = findChild<LLIconCtrl>("hint_image");
+
+ if (hint_icon)
+ {
+ LLUIImagePtr hint_image = hint_icon->getImage();
+ S32 image_height = hint_image.isNull() ? 0 : hint_image->getHeight();
+ S32 image_width = hint_image.isNull() ? 0 : hint_image->getWidth();
+
+ LLView* layout_stack = hint_icon->getParent()->getParent();
+ S32 delta_height = image_height - layout_stack->getRect().getHeight();
+ hint_icon->getParent()->reshape(image_width, hint_icon->getParent()->getRect().getHeight());
+ layout_stack->reshape(layout_stack->getRect().getWidth(), image_height);
+ layout_stack->translate(0, -delta_height);
+
+ LLRect hint_rect = getLocalRect();
+ reshape(hint_rect.getWidth(), hint_rect.getHeight() + delta_height);
+ }
+
+ { LLViewDrawContext context(alpha);
+
+ if (mTarget.empty())
+ {
+ // just draw contents, no arrow, in default position
+ LLPanel::draw();
+ }
+ else
+ {
+ LLView* targetp = LLHints::getInstance()->getHintTarget(mTarget).get();
+ if (!targetp)
+ {
+ // target widget is no longer valid, go away
+ die();
+ }
+ else if (!targetp->isInVisibleChain())
+ {
+ // if target is invisible, don't draw, but keep alive in case widget comes back
+ // but do make it so that it allows mouse events to pass through
+ setEnabled(false);
+ setMouseOpaque(false);
+ }
+ else
+ {
+ // revert back enabled and mouse opaque state in case we disabled it before
+ setEnabled(true);
+ setMouseOpaque(true);
+
+ LLRect target_rect;
+ targetp->localRectToOtherView(targetp->getLocalRect(), &target_rect, getParent());
+
+ LLRect my_local_rect = getLocalRect();
+ LLRect my_rect;
+ LLRect arrow_rect;
+ LLUIImagePtr arrow_imagep;
+
+ switch(mDirection)
+ {
+ case LEFT:
+ my_rect.setCenterAndSize( target_rect.mLeft - (my_local_rect.getWidth() / 2 + mDistance),
+ target_rect.getCenterY(),
+ my_local_rect.getWidth(),
+ my_local_rect.getHeight());
+ if (mArrowRight)
+ {
+ arrow_rect.setCenterAndSize(my_local_rect.mRight + mArrowRight->getWidth() / 2 + mArrowRightOffset,
+ my_local_rect.getCenterY(),
+ mArrowRight->getWidth(),
+ mArrowRight->getHeight());
+ arrow_imagep = mArrowRight;
+ }
+ break;
+ case TOP:
+ my_rect.setCenterAndSize( target_rect.getCenterX(),
+ target_rect.mTop + (my_local_rect.getHeight() / 2 + mDistance),
+ my_local_rect.getWidth(),
+ my_local_rect.getHeight());
+ if (mArrowDown)
+ {
+ arrow_rect.setCenterAndSize(my_local_rect.getCenterX(),
+ my_local_rect.mBottom - mArrowDown->getHeight() / 2 + mArrowDownOffset,
+ mArrowDown->getWidth(),
+ mArrowDown->getHeight());
+ arrow_imagep = mArrowDown;
+ }
+ break;
+ case RIGHT:
+ my_rect.setCenterAndSize( target_rect.mRight + (my_local_rect.getWidth() / 2 + mDistance),
+ target_rect.getCenterY(),
+ my_local_rect.getWidth(),
+ my_local_rect.getHeight());
+ if (mArrowLeft)
+ {
+ arrow_rect.setCenterAndSize(my_local_rect.mLeft - mArrowLeft->getWidth() / 2 + mArrowLeftOffset,
+ my_local_rect.getCenterY(),
+ mArrowLeft->getWidth(),
+ mArrowLeft->getHeight());
+ arrow_imagep = mArrowLeft;
+ }
+ break;
+ case BOTTOM:
+ my_rect.setCenterAndSize( target_rect.getCenterX(),
+ target_rect.mBottom - (my_local_rect.getHeight() / 2 + mDistance),
+ my_local_rect.getWidth(),
+ my_local_rect.getHeight());
+ if (mArrowUp)
+ {
+ arrow_rect.setCenterAndSize(my_local_rect.getCenterX(),
+ my_local_rect.mTop + mArrowUp->getHeight() / 2 + mArrowUpOffset,
+ mArrowUp->getWidth(),
+ mArrowUp->getHeight());
+ arrow_imagep = mArrowUp;
+ }
+ break;
+ case TOP_RIGHT:
+ my_rect.setCenterAndSize( target_rect.mRight + (my_local_rect.getWidth() / 2),
+ target_rect.mTop + (my_local_rect.getHeight() / 2 + mDistance),
+ my_local_rect.getWidth(),
+ my_local_rect.getHeight());
+ if (mArrowDownAndLeft)
+ {
+ arrow_rect.setCenterAndSize(my_local_rect.mLeft + mArrowDownAndLeft->getWidth() / 2 + mArrowLeftOffset,
+ my_local_rect.mBottom - mArrowDownAndLeft->getHeight() / 2 + mArrowDownOffset,
+ mArrowDownAndLeft->getWidth(),
+ mArrowDownAndLeft->getHeight());
+ arrow_imagep = mArrowDownAndLeft;
+ }
+ }
+ setShape(my_rect);
+ LLPanel::draw();
+
+ if (arrow_imagep) arrow_imagep->draw(arrow_rect, LLColor4(1.f, 1.f, 1.f, alpha));
+ }
+ }
+ }
}
@@ -365,57 +365,57 @@ LLHints::~LLHints()
void LLHints::show(LLNotificationPtr hint)
{
- LLHintPopup::Params p(LLUICtrlFactory::getDefaultParams<LLHintPopup>());
+ LLHintPopup::Params p(LLUICtrlFactory::getDefaultParams<LLHintPopup>());
- LLParamSDParser parser;
- parser.readSD(hint->getPayload(), p, true);
- p.notification = hint;
+ LLParamSDParser parser;
+ parser.readSD(hint->getPayload(), p, true);
+ p.notification = hint;
- if (p.validateBlock())
- {
- LLHintPopup* popup = new LLHintPopup(p);
+ if (p.validateBlock())
+ {
+ LLHintPopup* popup = new LLHintPopup(p);
- mHints[hint] = popup;
+ mHints[hint] = popup;
- LLView* hint_holder = gViewerWindow->getHintHolder();
- if (hint_holder)
- {
- hint_holder->addChild(popup);
- popup->centerWithin(hint_holder->getLocalRect());
- }
- }
+ LLView* hint_holder = gViewerWindow->getHintHolder();
+ if (hint_holder)
+ {
+ hint_holder->addChild(popup);
+ popup->centerWithin(hint_holder->getLocalRect());
+ }
+ }
}
void LLHints::hide(LLNotificationPtr hint)
{
- hint_map_t::iterator found_it = mHints.find(hint);
- if (found_it != mHints.end())
- {
- found_it->second->hide();
- mHints.erase(found_it);
- }
+ hint_map_t::iterator found_it = mHints.find(hint);
+ if (found_it != mHints.end())
+ {
+ found_it->second->hide();
+ mHints.erase(found_it);
+ }
}
void LLHints::registerHintTarget(const std::string& name, LLHandle<LLView> target)
{
- mTargetRegistry.defaultRegistrar().replace(name, target);
+ mTargetRegistry.defaultRegistrar().replace(name, target);
}
LLHandle<LLView> LLHints::getHintTarget(const std::string& name)
{
- LLHandle<LLView>* handlep = mTargetRegistry.getValue(name);
- if (handlep)
- {
- return *handlep;
- }
- else
- {
- return LLHandle<LLView>();
- }
+ LLHandle<LLView>* handlep = mTargetRegistry.getValue(name);
+ if (handlep)
+ {
+ return *handlep;
+ }
+ else
+ {
+ return LLHandle<LLView>();
+ }
}
void LLHints::showHints(const LLSD& show)
{
- bool visible = show.asBoolean();
- gViewerWindow->getHintHolder()->setVisible(visible);
+ bool visible = show.asBoolean();
+ gViewerWindow->getHintHolder()->setVisible(visible);
}
diff --git a/indra/newview/llhints.h b/indra/newview/llhints.h
index 1f730734d0..e661ef304b 100644
--- a/indra/newview/llhints.h
+++ b/indra/newview/llhints.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,20 +34,20 @@
class LLHints : public LLSingleton<LLHints>
{
- LLSINGLETON(LLHints);
- ~LLHints();
+ LLSINGLETON(LLHints);
+ ~LLHints();
public:
- void show(LLNotificationPtr hint);
- void hide(LLNotificationPtr hint);
- void registerHintTarget(const std::string& name, LLHandle<LLView> target);
- LLHandle<LLView> getHintTarget(const std::string& name);
+ void show(LLNotificationPtr hint);
+ void hide(LLNotificationPtr hint);
+ void registerHintTarget(const std::string& name, LLHandle<LLView> target);
+ LLHandle<LLView> getHintTarget(const std::string& name);
private:
- LLRegistry<std::string, LLHandle<LLView> > mTargetRegistry;
- typedef std::map<LLNotificationPtr, class LLHintPopup*> hint_map_t;
- hint_map_t mHints;
- void showHints(const LLSD& show);
+ LLRegistry<std::string, LLHandle<LLView> > mTargetRegistry;
+ typedef std::map<LLNotificationPtr, class LLHintPopup*> hint_map_t;
+ hint_map_t mHints;
+ void showHints(const LLSD& show);
- boost::signals2::connection mControlConnection;
+ boost::signals2::connection mControlConnection;
};
diff --git a/indra/newview/llhttpretrypolicy.cpp b/indra/newview/llhttpretrypolicy.cpp
index 6a2daeeb90..44d33eec93 100644
--- a/indra/newview/llhttpretrypolicy.cpp
+++ b/indra/newview/llhttpretrypolicy.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhttpretrypolicy.h
* @brief Header for a retry policy class intended for use with http responders.
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,116 +43,116 @@ namespace
}
LLAdaptiveRetryPolicy::LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx):
- mMinDelay(min_delay),
- mMaxDelay(max_delay),
- mBackoffFactor(backoff_factor),
- mMaxRetries(max_retries),
- mRetryOn4xx(retry_on_4xx)
+ mMinDelay(min_delay),
+ mMaxDelay(max_delay),
+ mBackoffFactor(backoff_factor),
+ mMaxRetries(max_retries),
+ mRetryOn4xx(retry_on_4xx)
{
- init();
+ init();
}
void LLAdaptiveRetryPolicy::init()
{
- mDelay = mMinDelay;
- mRetryCount = 0;
- mShouldRetry = true;
+ mDelay = mMinDelay;
+ mRetryCount = 0;
+ mShouldRetry = true;
}
void LLAdaptiveRetryPolicy::reset()
{
- init();
+ init();
}
bool LLAdaptiveRetryPolicy::getRetryAfter(const LLSD& headers, F32& retry_header_time)
{
- return (headers.has(HTTP_IN_HEADER_RETRY_AFTER)
- && getSecondsUntilRetryAfter(headers[HTTP_IN_HEADER_RETRY_AFTER].asStringRef(), retry_header_time));
+ return (headers.has(HTTP_IN_HEADER_RETRY_AFTER)
+ && getSecondsUntilRetryAfter(headers[HTTP_IN_HEADER_RETRY_AFTER].asStringRef(), retry_header_time));
}
bool LLAdaptiveRetryPolicy::getRetryAfter(const LLCore::HttpHeaders::ptr_t &headers, F32& retry_header_time)
{
- if (headers)
- {
- const std::string *retry_value = headers->find(HTTP_IN_HEADER_RETRY_AFTER.c_str());
- if (retry_value &&
- getSecondsUntilRetryAfter(*retry_value, retry_header_time))
- {
- return true;
- }
- }
- return false;
+ if (headers)
+ {
+ const std::string *retry_value = headers->find(HTTP_IN_HEADER_RETRY_AFTER.c_str());
+ if (retry_value &&
+ getSecondsUntilRetryAfter(*retry_value, retry_header_time))
+ {
+ return true;
+ }
+ }
+ return false;
}
void LLAdaptiveRetryPolicy::onSuccess()
{
- init();
+ init();
}
void LLAdaptiveRetryPolicy::onFailure(S32 status, const LLSD& headers)
{
- F32 retry_header_time;
- bool has_retry_header_time = getRetryAfter(headers,retry_header_time);
- onFailureCommon(status, has_retry_header_time, retry_header_time);
+ F32 retry_header_time;
+ bool has_retry_header_time = getRetryAfter(headers,retry_header_time);
+ onFailureCommon(status, has_retry_header_time, retry_header_time);
}
-
+
void LLAdaptiveRetryPolicy::onFailure(const LLCore::HttpResponse *response)
{
- F32 retry_header_time;
- const LLCore::HttpHeaders::ptr_t headers = response->getHeaders();
- bool has_retry_header_time = getRetryAfter(headers,retry_header_time);
- onFailureCommon(response->getStatus().getType(), has_retry_header_time, retry_header_time);
+ F32 retry_header_time;
+ const LLCore::HttpHeaders::ptr_t headers = response->getHeaders();
+ bool has_retry_header_time = getRetryAfter(headers,retry_header_time);
+ onFailureCommon(response->getStatus().getType(), has_retry_header_time, retry_header_time);
}
void LLAdaptiveRetryPolicy::onFailureCommon(S32 status, bool has_retry_header_time, F32 retry_header_time)
{
- if (!mShouldRetry)
- {
- LL_INFOS() << "keep on failing" << LL_ENDL;
- return;
- }
- if (mRetryCount > 0)
- {
- mDelay = llclamp(mDelay*mBackoffFactor,mMinDelay,mMaxDelay);
- }
- // Honor server Retry-After header.
- // Status 503 may ask us to wait for a certain amount of time before retrying.
- F32 wait_time = mDelay;
- if (has_retry_header_time)
- {
- wait_time = retry_header_time;
- }
-
- if (mRetryCount>=mMaxRetries)
- {
- LL_INFOS() << "Too many retries " << mRetryCount << ", will not retry" << LL_ENDL;
- mShouldRetry = false;
- }
- if (!mRetryOn4xx && !isHttpServerErrorStatus(status))
- {
- LL_INFOS() << "Non-server error " << status << ", will not retry" << LL_ENDL;
- mShouldRetry = false;
- }
- if (mShouldRetry)
- {
- LL_INFOS() << "Retry count " << mRetryCount << " should retry after " << wait_time << LL_ENDL;
- mRetryTimer.reset();
- mRetryTimer.setTimerExpirySec(wait_time);
- }
- mRetryCount++;
+ if (!mShouldRetry)
+ {
+ LL_INFOS() << "keep on failing" << LL_ENDL;
+ return;
+ }
+ if (mRetryCount > 0)
+ {
+ mDelay = llclamp(mDelay*mBackoffFactor,mMinDelay,mMaxDelay);
+ }
+ // Honor server Retry-After header.
+ // Status 503 may ask us to wait for a certain amount of time before retrying.
+ F32 wait_time = mDelay;
+ if (has_retry_header_time)
+ {
+ wait_time = retry_header_time;
+ }
+
+ if (mRetryCount>=mMaxRetries)
+ {
+ LL_INFOS() << "Too many retries " << mRetryCount << ", will not retry" << LL_ENDL;
+ mShouldRetry = false;
+ }
+ if (!mRetryOn4xx && !isHttpServerErrorStatus(status))
+ {
+ LL_INFOS() << "Non-server error " << status << ", will not retry" << LL_ENDL;
+ mShouldRetry = false;
+ }
+ if (mShouldRetry)
+ {
+ LL_INFOS() << "Retry count " << mRetryCount << " should retry after " << wait_time << LL_ENDL;
+ mRetryTimer.reset();
+ mRetryTimer.setTimerExpirySec(wait_time);
+ }
+ mRetryCount++;
}
-
+
bool LLAdaptiveRetryPolicy::shouldRetry(F32& seconds_to_wait) const
{
- if (mRetryCount == 0)
- {
- // Called shouldRetry before any failure.
- seconds_to_wait = F32_MAX;
- return false;
- }
- seconds_to_wait = mShouldRetry ? (F32) mRetryTimer.getRemainingTimeF32() : F32_MAX;
- return mShouldRetry;
+ if (mRetryCount == 0)
+ {
+ // Called shouldRetry before any failure.
+ seconds_to_wait = F32_MAX;
+ return false;
+ }
+ seconds_to_wait = mShouldRetry ? (F32) mRetryTimer.getRemainingTimeF32() : F32_MAX;
+ return mShouldRetry;
}
// Moved from httpconstants. Only used by this file.
diff --git a/indra/newview/llhttpretrypolicy.h b/indra/newview/llhttpretrypolicy.h
index af07b4afec..59bcc07848 100644
--- a/indra/newview/llhttpretrypolicy.h
+++ b/indra/newview/llhttpretrypolicy.h
@@ -1,29 +1,29 @@
-/**
+/**
* @file file llhttpretrypolicy.h
* @brief declarations for http retry policy class.
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
#ifndef LL_RETRYPOLICY_H
#define LL_RETRYPOLICY_H
@@ -41,20 +41,20 @@
class LLHTTPRetryPolicy: public LLThreadSafeRefCount
{
public:
- LLHTTPRetryPolicy() {}
+ LLHTTPRetryPolicy() {}
- virtual ~LLHTTPRetryPolicy() {}
- // Call after a sucess to reset retry state.
+ virtual ~LLHTTPRetryPolicy() {}
+ // Call after a sucess to reset retry state.
- virtual void onSuccess() = 0;
- // Call once after an HTTP failure to update state.
- virtual void onFailure(S32 status, const LLSD& headers) = 0;
+ virtual void onSuccess() = 0;
+ // Call once after an HTTP failure to update state.
+ virtual void onFailure(S32 status, const LLSD& headers) = 0;
- virtual void onFailure(const LLCore::HttpResponse *response) = 0;
+ virtual void onFailure(const LLCore::HttpResponse *response) = 0;
- virtual bool shouldRetry(F32& seconds_to_wait) const = 0;
+ virtual bool shouldRetry(F32& seconds_to_wait) const = 0;
- virtual void reset() = 0;
+ virtual void reset() = 0;
};
// Very general policy with geometric back-off after failures,
@@ -62,39 +62,39 @@ public:
class LLAdaptiveRetryPolicy: public LLHTTPRetryPolicy
{
public:
- LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx = false);
+ LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx = false);
+
+ // virtual
+ void onSuccess();
- // virtual
- void onSuccess();
+ void reset();
- void reset();
-
- // virtual
- void onFailure(S32 status, const LLSD& headers);
- // virtual
- void onFailure(const LLCore::HttpResponse *response);
- // virtual
- bool shouldRetry(F32& seconds_to_wait) const;
+ // virtual
+ void onFailure(S32 status, const LLSD& headers);
+ // virtual
+ void onFailure(const LLCore::HttpResponse *response);
+ // virtual
+ bool shouldRetry(F32& seconds_to_wait) const;
static bool getSecondsUntilRetryAfter(const std::string& retry_after, F32& seconds_to_wait);
protected:
- void init();
- bool getRetryAfter(const LLSD& headers, F32& retry_header_time);
- bool getRetryAfter(const LLCore::HttpHeaders::ptr_t &headers, F32& retry_header_time);
- void onFailureCommon(S32 status, bool has_retry_header_time, F32 retry_header_time);
+ void init();
+ bool getRetryAfter(const LLSD& headers, F32& retry_header_time);
+ bool getRetryAfter(const LLCore::HttpHeaders::ptr_t &headers, F32& retry_header_time);
+ void onFailureCommon(S32 status, bool has_retry_header_time, F32 retry_header_time);
private:
- const F32 mMinDelay; // delay never less than this value
- const F32 mMaxDelay; // delay never exceeds this value
- const F32 mBackoffFactor; // delay increases by this factor after each retry, up to mMaxDelay.
- const U32 mMaxRetries; // maximum number of times shouldRetry will return true.
- F32 mDelay; // current default delay.
- U32 mRetryCount; // number of times shouldRetry has been called.
- LLTimer mRetryTimer; // time until next retry.
- bool mShouldRetry; // Becomes false after too many retries, or the wrong sort of status received, etc.
- bool mRetryOn4xx; // Normally only retry on 5xx server errors.
+ const F32 mMinDelay; // delay never less than this value
+ const F32 mMaxDelay; // delay never exceeds this value
+ const F32 mBackoffFactor; // delay increases by this factor after each retry, up to mMaxDelay.
+ const U32 mMaxRetries; // maximum number of times shouldRetry will return true.
+ F32 mDelay; // current default delay.
+ U32 mRetryCount; // number of times shouldRetry has been called.
+ LLTimer mRetryTimer; // time until next retry.
+ bool mShouldRetry; // Becomes false after too many retries, or the wrong sort of status received, etc.
+ bool mRetryOn4xx; // Normally only retry on 5xx server errors.
};
#endif
diff --git a/indra/newview/llhudeffect.cpp b/indra/newview/llhudeffect.cpp
index eff5587610..f845284c8c 100644
--- a/indra/newview/llhudeffect.cpp
+++ b/indra/newview/llhudeffect.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffect.cpp
* @brief LLHUDEffect class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,14 +37,14 @@
#include "lldrawable.h"
LLHUDEffect::LLHUDEffect(const U8 type)
-: LLHUDObject(type),
- mID(),
- mDuration(1.f),
- mColor()
+: LLHUDObject(type),
+ mID(),
+ mDuration(1.f),
+ mColor()
{
- mNeedsSendToSim = FALSE;
- mOriginatedHere = FALSE;
- mDead = FALSE;
+ mNeedsSendToSim = FALSE;
+ mOriginatedHere = FALSE;
+ mDead = FALSE;
}
LLHUDEffect::~LLHUDEffect()
@@ -54,80 +54,80 @@ LLHUDEffect::~LLHUDEffect()
void LLHUDEffect::packData(LLMessageSystem *mesgsys)
{
- mesgsys->addUUIDFast(_PREHASH_ID, mID);
- mesgsys->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- mesgsys->addU8Fast(_PREHASH_Type, mType);
- mesgsys->addF32Fast(_PREHASH_Duration, mDuration);
- mesgsys->addBinaryData(_PREHASH_Color, mColor.mV, 4);
+ mesgsys->addUUIDFast(_PREHASH_ID, mID);
+ mesgsys->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ mesgsys->addU8Fast(_PREHASH_Type, mType);
+ mesgsys->addF32Fast(_PREHASH_Duration, mDuration);
+ mesgsys->addBinaryData(_PREHASH_Color, mColor.mV, 4);
}
void LLHUDEffect::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
{
- mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, mID, blocknum);
- mesgsys->getU8Fast(_PREHASH_Effect, _PREHASH_Type, mType, blocknum);
- mesgsys->getF32Fast(_PREHASH_Effect, _PREHASH_Duration, mDuration, blocknum);
- mesgsys->getBinaryDataFast(_PREHASH_Effect,_PREHASH_Color, mColor.mV, 4, blocknum);
+ mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, mID, blocknum);
+ mesgsys->getU8Fast(_PREHASH_Effect, _PREHASH_Type, mType, blocknum);
+ mesgsys->getF32Fast(_PREHASH_Effect, _PREHASH_Duration, mDuration, blocknum);
+ mesgsys->getBinaryDataFast(_PREHASH_Effect,_PREHASH_Color, mColor.mV, 4, blocknum);
}
void LLHUDEffect::render()
{
- LL_ERRS() << "Never call this!" << LL_ENDL;
+ LL_ERRS() << "Never call this!" << LL_ENDL;
}
void LLHUDEffect::setID(const LLUUID &id)
{
- mID = id;
+ mID = id;
}
const LLUUID &LLHUDEffect::getID() const
{
- return mID;
+ return mID;
}
void LLHUDEffect::setColor(const LLColor4U &color)
{
- mColor = color;
+ mColor = color;
}
void LLHUDEffect::setDuration(const F32 duration)
{
- mDuration = duration;
+ mDuration = duration;
}
void LLHUDEffect::setNeedsSendToSim(const BOOL send_to_sim)
{
- mNeedsSendToSim = send_to_sim;
+ mNeedsSendToSim = send_to_sim;
}
BOOL LLHUDEffect::getNeedsSendToSim() const
{
- return mNeedsSendToSim;
+ return mNeedsSendToSim;
}
void LLHUDEffect::setOriginatedHere(const BOOL orig_here)
{
- mOriginatedHere = orig_here;
+ mOriginatedHere = orig_here;
}
BOOL LLHUDEffect::getOriginatedHere() const
{
- return mOriginatedHere;
+ return mOriginatedHere;
}
//static
void LLHUDEffect::getIDType(LLMessageSystem *mesgsys, S32 blocknum, LLUUID &id, U8 &type)
{
- mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, id, blocknum);
- mesgsys->getU8Fast(_PREHASH_Effect, _PREHASH_Type, type, blocknum);
+ mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, id, blocknum);
+ mesgsys->getU8Fast(_PREHASH_Effect, _PREHASH_Type, type, blocknum);
}
BOOL LLHUDEffect::isDead() const
{
- return mDead;
+ return mDead;
}
void LLHUDEffect::update()
{
- // do nothing
+ // do nothing
}
diff --git a/indra/newview/llhudeffect.h b/indra/newview/llhudeffect.h
index 7c825e3f3d..e5f05599c9 100644
--- a/indra/newview/llhudeffect.h
+++ b/indra/newview/llhudeffect.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffect.h
* @brief LLHUDEffect class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,38 +40,38 @@ class LLMessageSystem;
class LLHUDEffect : public LLHUDObject
{
public:
- void setNeedsSendToSim(const BOOL send_to_sim);
- BOOL getNeedsSendToSim() const;
- void setOriginatedHere(const BOOL orig_here);
- BOOL getOriginatedHere() const;
+ void setNeedsSendToSim(const BOOL send_to_sim);
+ BOOL getNeedsSendToSim() const;
+ void setOriginatedHere(const BOOL orig_here);
+ BOOL getOriginatedHere() const;
- void setDuration(const F32 duration);
- void setColor(const LLColor4U &color);
- void setID(const LLUUID &id);
- const LLUUID &getID() const;
+ void setDuration(const F32 duration);
+ void setColor(const LLColor4U &color);
+ void setID(const LLUUID &id);
+ const LLUUID &getID() const;
- BOOL isDead() const;
+ BOOL isDead() const;
- friend class LLHUDManager;
+ friend class LLHUDManager;
protected:
- LLHUDEffect(const U8 type);
- ~LLHUDEffect();
+ LLHUDEffect(const U8 type);
+ ~LLHUDEffect();
- /*virtual*/ void render();
+ /*virtual*/ void render();
- virtual void packData(LLMessageSystem *mesgsys);
- virtual void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
- virtual void update();
+ virtual void packData(LLMessageSystem *mesgsys);
+ virtual void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
+ virtual void update();
- static void getIDType(LLMessageSystem *mesgsys, S32 blocknum, LLUUID &uuid, U8 &type);
+ static void getIDType(LLMessageSystem *mesgsys, S32 blocknum, LLUUID &uuid, U8 &type);
protected:
- LLUUID mID;
- F32 mDuration;
- LLColor4U mColor;
+ LLUUID mID;
+ F32 mDuration;
+ LLColor4U mColor;
- BOOL mNeedsSendToSim;
- BOOL mOriginatedHere;
+ BOOL mNeedsSendToSim;
+ BOOL mOriginatedHere;
};
#endif // LL_LLHUDEFFECT_H
diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp
index d1d83e6e03..b3e98ba561 100644
--- a/indra/newview/llhudeffectbeam.cpp
+++ b/indra/newview/llhudeffectbeam.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffectbeam.cpp
* @brief LLHUDEffectBeam class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,28 +46,28 @@ const F32 BEAM_SPACING = 0.075f;
LLHUDEffectBeam::LLHUDEffectBeam(const U8 type) : LLHUDEffect(type)
{
- mKillTime = mDuration;
-
- // Initialize all of these to defaults
- S32 i;
- for (i = 0; i < NUM_POINTS; i++)
- {
- mInterp[i].setStartTime(BEAM_SPACING*i);
- mInterp[i].setEndTime(BEAM_SPACING*NUM_POINTS + BEAM_SPACING*i);
- mInterp[i].start();
- mInterpFade[i].setStartTime(BEAM_SPACING*NUM_POINTS + BEAM_SPACING*i - 0.5f*NUM_POINTS*BEAM_SPACING);
- mInterpFade[i].setEndTime(BEAM_SPACING*NUM_POINTS + BEAM_SPACING*i);
- mInterpFade[i].setStartVal(1.f);
- mInterpFade[i].setEndVal(0.f);
- }
-
- // Setup default timeouts and fade animations.
- F32 fade_length;
- fade_length = llmin(0.5f, mDuration);
- mFadeInterp.setStartTime(mKillTime - fade_length);
- mFadeInterp.setEndTime(mKillTime);
- mFadeInterp.setStartVal(1.f);
- mFadeInterp.setEndVal(0.f);
+ mKillTime = mDuration;
+
+ // Initialize all of these to defaults
+ S32 i;
+ for (i = 0; i < NUM_POINTS; i++)
+ {
+ mInterp[i].setStartTime(BEAM_SPACING*i);
+ mInterp[i].setEndTime(BEAM_SPACING*NUM_POINTS + BEAM_SPACING*i);
+ mInterp[i].start();
+ mInterpFade[i].setStartTime(BEAM_SPACING*NUM_POINTS + BEAM_SPACING*i - 0.5f*NUM_POINTS*BEAM_SPACING);
+ mInterpFade[i].setEndTime(BEAM_SPACING*NUM_POINTS + BEAM_SPACING*i);
+ mInterpFade[i].setStartVal(1.f);
+ mInterpFade[i].setEndVal(0.f);
+ }
+
+ // Setup default timeouts and fade animations.
+ F32 fade_length;
+ fade_length = llmin(0.5f, mDuration);
+ mFadeInterp.setStartTime(mKillTime - fade_length);
+ mFadeInterp.setEndTime(mKillTime);
+ mFadeInterp.setStartVal(1.f);
+ mFadeInterp.setEndVal(0.f);
}
LLHUDEffectBeam::~LLHUDEffectBeam()
@@ -76,273 +76,273 @@ LLHUDEffectBeam::~LLHUDEffectBeam()
void LLHUDEffectBeam::packData(LLMessageSystem *mesgsys)
{
- if (!mSourceObject)
- {
- LL_WARNS() << "Missing source object!" << LL_ENDL;
- }
-
- // Pack the default data
- LLHUDEffect::packData(mesgsys);
-
- // Pack the type-specific data. Uses a fun packed binary format. Whee!
- // 16 + 24 + 1 = 41
- U8 packed_data[41];
- memset(packed_data, 0, 41);
- if (mSourceObject)
- {
- htolememcpy(packed_data, mSourceObject->mID.mData, MVT_LLUUID, 16);
- }
-
- if (mTargetObject)
- {
- packed_data[16] = 1;
- }
- else
- {
- packed_data[16] = 0;
- }
-
- if (mTargetObject)
- {
- htolememcpy(&(packed_data[17]), mTargetObject->mID.mData, MVT_LLUUID, 16);
- }
- else
- {
- htolememcpy(&(packed_data[17]), mTargetPos.mdV, MVT_LLVector3d, 24);
- }
- mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, 41);
+ if (!mSourceObject)
+ {
+ LL_WARNS() << "Missing source object!" << LL_ENDL;
+ }
+
+ // Pack the default data
+ LLHUDEffect::packData(mesgsys);
+
+ // Pack the type-specific data. Uses a fun packed binary format. Whee!
+ // 16 + 24 + 1 = 41
+ U8 packed_data[41];
+ memset(packed_data, 0, 41);
+ if (mSourceObject)
+ {
+ htolememcpy(packed_data, mSourceObject->mID.mData, MVT_LLUUID, 16);
+ }
+
+ if (mTargetObject)
+ {
+ packed_data[16] = 1;
+ }
+ else
+ {
+ packed_data[16] = 0;
+ }
+
+ if (mTargetObject)
+ {
+ htolememcpy(&(packed_data[17]), mTargetObject->mID.mData, MVT_LLUUID, 16);
+ }
+ else
+ {
+ htolememcpy(&(packed_data[17]), mTargetPos.mdV, MVT_LLVector3d, 24);
+ }
+ mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, 41);
}
void LLHUDEffectBeam::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
{
- LL_ERRS() << "Got beam!" << LL_ENDL;
- BOOL use_target_object;
- LLVector3d new_target;
- U8 packed_data[41];
-
- LLHUDEffect::unpackData(mesgsys, blocknum);
- LLUUID source_id;
- LLUUID target_id;
- S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
- if (size != 41)
- {
- LL_WARNS() << "Beam effect with bad size " << size << LL_ENDL;
- return;
- }
- mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, 41, blocknum);
-
- htolememcpy(source_id.mData, packed_data, MVT_LLUUID, 16);
-
- LLViewerObject *objp = gObjectList.findObject(source_id);
- if (objp)
- {
- setSourceObject(objp);
- }
-
- use_target_object = packed_data[16];
-
- if (use_target_object)
- {
- htolememcpy(target_id.mData, &packed_data[17], MVT_LLUUID, 16);
-
- LLViewerObject *objp = gObjectList.findObject(target_id);
- if (objp)
- {
- setTargetObject(objp);
- }
- }
- else
- {
- htolememcpy(new_target.mdV, &(packed_data[17]), MVT_LLVector3d, 24);
- setTargetPos(new_target);
- }
-
- // We've received an update for the effect, update the various timeouts
- // and fade animations.
- mKillTime = mTimer.getElapsedTimeF32() + mDuration;
- F32 fade_length;
- fade_length = llmin(0.5f, mDuration);
- mFadeInterp.setStartTime(mKillTime - fade_length);
- mFadeInterp.setEndTime(mKillTime);
- mFadeInterp.setStartVal(1.f);
- mFadeInterp.setEndVal(0.f);
+ LL_ERRS() << "Got beam!" << LL_ENDL;
+ BOOL use_target_object;
+ LLVector3d new_target;
+ U8 packed_data[41];
+
+ LLHUDEffect::unpackData(mesgsys, blocknum);
+ LLUUID source_id;
+ LLUUID target_id;
+ S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
+ if (size != 41)
+ {
+ LL_WARNS() << "Beam effect with bad size " << size << LL_ENDL;
+ return;
+ }
+ mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, 41, blocknum);
+
+ htolememcpy(source_id.mData, packed_data, MVT_LLUUID, 16);
+
+ LLViewerObject *objp = gObjectList.findObject(source_id);
+ if (objp)
+ {
+ setSourceObject(objp);
+ }
+
+ use_target_object = packed_data[16];
+
+ if (use_target_object)
+ {
+ htolememcpy(target_id.mData, &packed_data[17], MVT_LLUUID, 16);
+
+ LLViewerObject *objp = gObjectList.findObject(target_id);
+ if (objp)
+ {
+ setTargetObject(objp);
+ }
+ }
+ else
+ {
+ htolememcpy(new_target.mdV, &(packed_data[17]), MVT_LLVector3d, 24);
+ setTargetPos(new_target);
+ }
+
+ // We've received an update for the effect, update the various timeouts
+ // and fade animations.
+ mKillTime = mTimer.getElapsedTimeF32() + mDuration;
+ F32 fade_length;
+ fade_length = llmin(0.5f, mDuration);
+ mFadeInterp.setStartTime(mKillTime - fade_length);
+ mFadeInterp.setEndTime(mKillTime);
+ mFadeInterp.setStartVal(1.f);
+ mFadeInterp.setEndVal(0.f);
}
void LLHUDEffectBeam::setSourceObject(LLViewerObject *objp)
{
- if (objp->isDead())
- {
- LL_WARNS() << "HUDEffectBeam: Source object is dead!" << LL_ENDL;
- mSourceObject = NULL;
- return;
- }
-
- if (mSourceObject == objp)
- {
- return;
- }
-
- mSourceObject = objp;
- if (mSourceObject)
- {
- S32 i;
- for (i = 0; i < NUM_POINTS; i++)
- {
- if (mSourceObject->isAvatar())
- {
- LLViewerObject *objp = mSourceObject;
- LLVOAvatar *avatarp = (LLVOAvatar *)objp;
- LLVector3d hand_pos_global = gAgent.getPosGlobalFromAgent(avatarp->mWristLeftp->getWorldPosition());
- mInterp[i].setStartVal(hand_pos_global);
- mInterp[i].start();
- }
- else
- {
- mInterp[i].setStartVal(mSourceObject->getPositionGlobal());
- mInterp[i].start();
- }
- }
- }
+ if (objp->isDead())
+ {
+ LL_WARNS() << "HUDEffectBeam: Source object is dead!" << LL_ENDL;
+ mSourceObject = NULL;
+ return;
+ }
+
+ if (mSourceObject == objp)
+ {
+ return;
+ }
+
+ mSourceObject = objp;
+ if (mSourceObject)
+ {
+ S32 i;
+ for (i = 0; i < NUM_POINTS; i++)
+ {
+ if (mSourceObject->isAvatar())
+ {
+ LLViewerObject *objp = mSourceObject;
+ LLVOAvatar *avatarp = (LLVOAvatar *)objp;
+ LLVector3d hand_pos_global = gAgent.getPosGlobalFromAgent(avatarp->mWristLeftp->getWorldPosition());
+ mInterp[i].setStartVal(hand_pos_global);
+ mInterp[i].start();
+ }
+ else
+ {
+ mInterp[i].setStartVal(mSourceObject->getPositionGlobal());
+ mInterp[i].start();
+ }
+ }
+ }
}
void LLHUDEffectBeam::setTargetObject(LLViewerObject *objp)
{
- if (mTargetObject->isDead())
- {
- LL_WARNS() << "HUDEffectBeam: Target object is dead!" << LL_ENDL;
- }
+ if (mTargetObject->isDead())
+ {
+ LL_WARNS() << "HUDEffectBeam: Target object is dead!" << LL_ENDL;
+ }
- mTargetObject = objp;
+ mTargetObject = objp;
}
void LLHUDEffectBeam::setTargetPos(const LLVector3d &pos_global)
{
- mTargetPos = pos_global;
- mTargetObject = NULL;
+ mTargetPos = pos_global;
+ mTargetObject = NULL;
}
void LLHUDEffectBeam::render()
{
- if (!mSourceObject)
- {
- markDead();
- return;
- }
- if (mSourceObject->isDead())
- {
- markDead();
- return;
- }
-
- F32 time = mTimer.getElapsedTimeF32();
-
- // Kill us if our time is over...
- if (mKillTime < time)
- {
- markDead();
- return;
- }
-
- LLGLSPipelineAlpha gls_pipeline_alpha;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
-
- // Interpolate the global fade alpha
- mFadeInterp.update(time);
-
- if (mTargetObject.notNull() && mTargetObject->mDrawable.notNull())
- {
- // use viewer object position on freshly created objects
- if (mTargetObject->mDrawable->getGeneration() == -1)
- {
- mTargetPos = mTargetObject->getPositionGlobal();
- }
- // otherwise use drawable
- else
- {
- mTargetPos = gAgent.getPosGlobalFromAgent(mTargetObject->mDrawable->getPositionAgent());
- }
- }
-
-
- // Init the color of the particles
- LLColor4U coloru = mColor;
-
- // Draw the particles
- S32 i;
- for (i = 0; i < NUM_POINTS; i++)
- {
- mInterp[i].update(time);
- if (!mInterp[i].isActive())
- {
- continue;
- }
- mInterpFade[i].update(time);
-
- if (mInterp[i].isDone())
- {
- // Reinitialize the particle when the particle has finished its animation.
- setupParticle(i);
- }
-
- F32 frac = mInterp[i].getCurFrac();
- F32 scale = 0.025f + fabs(0.05f*sin(2.f*F_PI*(frac - time)));
- scale *= mInterpFade[i].getCurVal();
-
- LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(mInterp[i].getCurVal());
-
- F32 alpha = mFadeInterp.getCurVal()*mColor.mV[3];
- alpha *= mInterpFade[i].getCurVal();
- coloru.mV[3] = (U8)alpha;
- gGL.color4ubv(coloru.mV);
-
- gGL.pushMatrix();
- gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
- gGL.scalef(scale, scale, scale);
- gSphere.render();
- gGL.popMatrix();
- }
+ if (!mSourceObject)
+ {
+ markDead();
+ return;
+ }
+ if (mSourceObject->isDead())
+ {
+ markDead();
+ return;
+ }
+
+ F32 time = mTimer.getElapsedTimeF32();
+
+ // Kill us if our time is over...
+ if (mKillTime < time)
+ {
+ markDead();
+ return;
+ }
+
+ LLGLSPipelineAlpha gls_pipeline_alpha;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+
+ // Interpolate the global fade alpha
+ mFadeInterp.update(time);
+
+ if (mTargetObject.notNull() && mTargetObject->mDrawable.notNull())
+ {
+ // use viewer object position on freshly created objects
+ if (mTargetObject->mDrawable->getGeneration() == -1)
+ {
+ mTargetPos = mTargetObject->getPositionGlobal();
+ }
+ // otherwise use drawable
+ else
+ {
+ mTargetPos = gAgent.getPosGlobalFromAgent(mTargetObject->mDrawable->getPositionAgent());
+ }
+ }
+
+
+ // Init the color of the particles
+ LLColor4U coloru = mColor;
+
+ // Draw the particles
+ S32 i;
+ for (i = 0; i < NUM_POINTS; i++)
+ {
+ mInterp[i].update(time);
+ if (!mInterp[i].isActive())
+ {
+ continue;
+ }
+ mInterpFade[i].update(time);
+
+ if (mInterp[i].isDone())
+ {
+ // Reinitialize the particle when the particle has finished its animation.
+ setupParticle(i);
+ }
+
+ F32 frac = mInterp[i].getCurFrac();
+ F32 scale = 0.025f + fabs(0.05f*sin(2.f*F_PI*(frac - time)));
+ scale *= mInterpFade[i].getCurVal();
+
+ LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(mInterp[i].getCurVal());
+
+ F32 alpha = mFadeInterp.getCurVal()*mColor.mV[3];
+ alpha *= mInterpFade[i].getCurVal();
+ coloru.mV[3] = (U8)alpha;
+ gGL.color4ubv(coloru.mV);
+
+ gGL.pushMatrix();
+ gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
+ gGL.scalef(scale, scale, scale);
+ gSphere.render();
+ gGL.popMatrix();
+ }
}
void LLHUDEffectBeam::renderForTimer()
{
- render();
+ render();
}
void LLHUDEffectBeam::setupParticle(const S32 i)
{
- LLVector3d start_pos_global;
- if (mSourceObject->getPCode() == LL_PCODE_LEGACY_AVATAR)
- {
- LLViewerObject *objp = mSourceObject;
- LLVOAvatar *avatarp = (LLVOAvatar *)objp;
- start_pos_global = gAgent.getPosGlobalFromAgent(avatarp->mWristLeftp->getWorldPosition());
- }
- else
- {
- start_pos_global = mSourceObject->getPositionGlobal();
- }
-
- // Generate a random offset for the target point.
- const F32 SCALE = 0.5f;
- F32 x, y, z;
- x = ll_frand(SCALE) - 0.5f*SCALE;
- y = ll_frand(SCALE) - 0.5f*SCALE;
- z = ll_frand(SCALE) - 0.5f*SCALE;
-
- LLVector3d target_pos_global(mTargetPos);
- target_pos_global += LLVector3d(x, y, z);
-
- mInterp[i].setStartTime(mInterp[i].getEndTime());
- mInterp[i].setEndTime(mInterp[i].getStartTime() + BEAM_SPACING*NUM_POINTS);
- mInterp[i].setStartVal(start_pos_global);
- mInterp[i].setEndVal(target_pos_global);
- mInterp[i].start();
-
-
- // Setup the interpolator that fades out the alpha.
- mInterpFade[i].setStartTime(mInterp[i].getStartTime() + BEAM_SPACING*NUM_POINTS - 0.5f*NUM_POINTS*BEAM_SPACING);
- mInterpFade[i].setEndTime(mInterp[i].getStartTime() + BEAM_SPACING*NUM_POINTS - 0.05f);
- mInterpFade[i].start();
+ LLVector3d start_pos_global;
+ if (mSourceObject->getPCode() == LL_PCODE_LEGACY_AVATAR)
+ {
+ LLViewerObject *objp = mSourceObject;
+ LLVOAvatar *avatarp = (LLVOAvatar *)objp;
+ start_pos_global = gAgent.getPosGlobalFromAgent(avatarp->mWristLeftp->getWorldPosition());
+ }
+ else
+ {
+ start_pos_global = mSourceObject->getPositionGlobal();
+ }
+
+ // Generate a random offset for the target point.
+ const F32 SCALE = 0.5f;
+ F32 x, y, z;
+ x = ll_frand(SCALE) - 0.5f*SCALE;
+ y = ll_frand(SCALE) - 0.5f*SCALE;
+ z = ll_frand(SCALE) - 0.5f*SCALE;
+
+ LLVector3d target_pos_global(mTargetPos);
+ target_pos_global += LLVector3d(x, y, z);
+
+ mInterp[i].setStartTime(mInterp[i].getEndTime());
+ mInterp[i].setEndTime(mInterp[i].getStartTime() + BEAM_SPACING*NUM_POINTS);
+ mInterp[i].setStartVal(start_pos_global);
+ mInterp[i].setEndVal(target_pos_global);
+ mInterp[i].start();
+
+
+ // Setup the interpolator that fades out the alpha.
+ mInterpFade[i].setStartTime(mInterp[i].getStartTime() + BEAM_SPACING*NUM_POINTS - 0.5f*NUM_POINTS*BEAM_SPACING);
+ mInterpFade[i].setEndTime(mInterp[i].getStartTime() + BEAM_SPACING*NUM_POINTS - 0.05f);
+ mInterpFade[i].start();
}
diff --git a/indra/newview/llhudeffectbeam.h b/indra/newview/llhudeffectbeam.h
index fdee5178af..7d9177e7ab 100644
--- a/indra/newview/llhudeffectbeam.h
+++ b/indra/newview/llhudeffectbeam.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffectbeam.h
* @brief LLHUDEffectBeam class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,31 +40,31 @@ const S32 NUM_POINTS = 5;
class LLHUDEffectBeam : public LLHUDEffect
{
public:
- /*virtual*/ void setSourceObject(LLViewerObject *objp);
+ /*virtual*/ void setSourceObject(LLViewerObject *objp);
- // A beam can have either a target object or a target position
- void setTargetObject(LLViewerObject *objp);
- void setTargetPos(const LLVector3d &target_pos_global);
+ // A beam can have either a target object or a target position
+ void setTargetObject(LLViewerObject *objp);
+ void setTargetPos(const LLVector3d &target_pos_global);
- friend class LLHUDObject;
+ friend class LLHUDObject;
protected:
- LLHUDEffectBeam(const U8 type);
- ~LLHUDEffectBeam();
+ LLHUDEffectBeam(const U8 type);
+ ~LLHUDEffectBeam();
- /*virtual*/ void render();
- /*virtual*/ void renderForTimer();
- /*virtual*/ void packData(LLMessageSystem *mesgsys);
- /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
+ /*virtual*/ void render();
+ /*virtual*/ void renderForTimer();
+ /*virtual*/ void packData(LLMessageSystem *mesgsys);
+ /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
private:
- void setupParticle(const S32 i);
+ void setupParticle(const S32 i);
+
-
- F32 mKillTime;
- LLFrameTimer mTimer;
- LLInterpLinear<LLVector3d> mInterp[NUM_POINTS];
- LLInterpLinear<F32> mInterpFade[NUM_POINTS];
- LLInterpLinear<F32> mFadeInterp;
- LLVector3d mTargetPos;
+ F32 mKillTime;
+ LLFrameTimer mTimer;
+ LLInterpLinear<LLVector3d> mInterp[NUM_POINTS];
+ LLInterpLinear<F32> mInterpFade[NUM_POINTS];
+ LLInterpLinear<F32> mFadeInterp;
+ LLVector3d mTargetPos;
};
#endif // LL_LLHUDEFFECTBEAM_H
diff --git a/indra/newview/llhudeffectblob.cpp b/indra/newview/llhudeffectblob.cpp
index c909551b51..b476226d05 100644
--- a/indra/newview/llhudeffectblob.cpp
+++ b/indra/newview/llhudeffectblob.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffecttrail.cpp
* @brief LLHUDEffectSpiral class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,12 +32,12 @@
#include "llviewercamera.h"
#include "llui.h"
-LLHUDEffectBlob::LLHUDEffectBlob(const U8 type)
-: LLHUDEffect(type),
- mPixelSize(10)
+LLHUDEffectBlob::LLHUDEffectBlob(const U8 type)
+: LLHUDEffect(type),
+ mPixelSize(10)
{
- mTimer.start();
- mImage = LLUI::getUIImage("Camera_Drag_Dot");
+ mTimer.start();
+ mImage = LLUI::getUIImage("Camera_Drag_Dot");
}
LLHUDEffectBlob::~LLHUDEffectBlob()
@@ -46,50 +46,50 @@ LLHUDEffectBlob::~LLHUDEffectBlob()
void LLHUDEffectBlob::markDead()
{
- mImage = NULL;
+ mImage = NULL;
- LLHUDEffect::markDead();
+ LLHUDEffect::markDead();
}
void LLHUDEffectBlob::render()
{
- F32 time = mTimer.getElapsedTimeF32();
- if (mDuration < time)
- {
- markDead();
- return;
- }
-
- LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(mPositionGlobal);
-
- LLVector3 pixel_up, pixel_right;
-
- LLViewerCamera::instance().getPixelVectors(pos_agent, pixel_up, pixel_right);
-
- LLGLSPipelineAlpha gls_pipeline_alpha;
- gGL.getTexUnit(0)->bind(mImage->getImage());
-
- LLColor4U color = mColor;
- color.mV[VALPHA] = (U8)clamp_rescale(time, 0.f, mDuration, 255.f, 0.f);
- gGL.color4ubv(color.mV);
-
- { gGL.pushMatrix();
- gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
- LLVector3 u_scale = pixel_right * (F32)mPixelSize;
- LLVector3 v_scale = pixel_up * (F32)mPixelSize;
-
- { gGL.begin(LLRender::QUADS);
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex3fv((v_scale - u_scale).mV);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex3fv((-v_scale - u_scale).mV);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex3fv((-v_scale + u_scale).mV);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex3fv((v_scale + u_scale).mV);
- } gGL.end();
-
- } gGL.popMatrix();
+ F32 time = mTimer.getElapsedTimeF32();
+ if (mDuration < time)
+ {
+ markDead();
+ return;
+ }
+
+ LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(mPositionGlobal);
+
+ LLVector3 pixel_up, pixel_right;
+
+ LLViewerCamera::instance().getPixelVectors(pos_agent, pixel_up, pixel_right);
+
+ LLGLSPipelineAlpha gls_pipeline_alpha;
+ gGL.getTexUnit(0)->bind(mImage->getImage());
+
+ LLColor4U color = mColor;
+ color.mV[VALPHA] = (U8)clamp_rescale(time, 0.f, mDuration, 255.f, 0.f);
+ gGL.color4ubv(color.mV);
+
+ { gGL.pushMatrix();
+ gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
+ LLVector3 u_scale = pixel_right * (F32)mPixelSize;
+ LLVector3 v_scale = pixel_up * (F32)mPixelSize;
+
+ { gGL.begin(LLRender::QUADS);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3fv((v_scale - u_scale).mV);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3fv((-v_scale - u_scale).mV);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3fv((-v_scale + u_scale).mV);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3fv((v_scale + u_scale).mV);
+ } gGL.end();
+
+ } gGL.popMatrix();
}
void LLHUDEffectBlob::renderForTimer()
diff --git a/indra/newview/llhudeffectblob.h b/indra/newview/llhudeffectblob.h
index ce3e8500fc..6435371d78 100644
--- a/indra/newview/llhudeffectblob.h
+++ b/indra/newview/llhudeffectblob.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffectblob.h
* @brief LLHUDEffectBlob class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,22 +33,22 @@
class LLHUDEffectBlob : public LLHUDEffect
{
public:
- friend class LLHUDObject;
+ friend class LLHUDObject;
- void markDead();
+ void markDead();
- void setPixelSize(S32 pixels) { mPixelSize = pixels; }
+ void setPixelSize(S32 pixels) { mPixelSize = pixels; }
protected:
- LLHUDEffectBlob(const U8 type);
- ~LLHUDEffectBlob();
+ LLHUDEffectBlob(const U8 type);
+ ~LLHUDEffectBlob();
- /*virtual*/ void render();
- /*virtual*/ void renderForTimer();
+ /*virtual*/ void render();
+ /*virtual*/ void renderForTimer();
private:
- S32 mPixelSize;
- LLFrameTimer mTimer;
- LLPointer<LLUIImage> mImage;
+ S32 mPixelSize;
+ LLFrameTimer mTimer;
+ LLPointer<LLUIImage> mImage;
};
#endif // LL_LLHUDEFFECTBLOB_H
diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp
index 0f230067bc..eb49e53c86 100644
--- a/indra/newview/llhudeffectlookat.cpp
+++ b/indra/newview/llhudeffectlookat.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffectlookat.cpp
* @brief LLHUDEffectLookAt class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,17 +67,17 @@ const F32 MAX_TIMEOUT = F32_MAX / 2.f;
class LLAttention
{
public:
- LLAttention()
- : mTimeout(0.f),
- mPriority(0.f)
- {}
- LLAttention(F32 timeout, F32 priority, const std::string& name, LLColor3 color) :
- mTimeout(timeout), mPriority(priority), mName(name), mColor(color)
- {
- }
- F32 mTimeout, mPriority;
- std::string mName;
- LLColor3 mColor;
+ LLAttention()
+ : mTimeout(0.f),
+ mPriority(0.f)
+ {}
+ LLAttention(F32 timeout, F32 priority, const std::string& name, LLColor3 color) :
+ mTimeout(timeout), mPriority(priority), mName(name), mColor(color)
+ {
+ }
+ F32 mTimeout, mPriority;
+ std::string mName;
+ LLColor3 mColor;
};
/**
@@ -86,15 +86,15 @@ public:
class LLAttentionSet
{
public:
- LLAttentionSet(const LLAttention attentions[])
- {
- for(int i=0; i<LOOKAT_NUM_TARGETS; i++)
- {
- mAttentions[i] = attentions[i];
- }
- }
- LLAttention mAttentions[LOOKAT_NUM_TARGETS];
- LLAttention& operator[](int idx) { return mAttentions[idx]; }
+ LLAttentionSet(const LLAttention attentions[])
+ {
+ for(int i=0; i<LOOKAT_NUM_TARGETS; i++)
+ {
+ mAttentions[i] = attentions[i];
+ }
+ }
+ LLAttention mAttentions[LOOKAT_NUM_TARGETS];
+ LLAttention& operator[](int idx) { return mAttentions[idx]; }
};
// Default attribute set data.
@@ -104,130 +104,130 @@ public:
// can be overwritten with customizing data from the XML file. The actual values below
// are those that will give exactly the same look-at behavior as before the ability
// to customize was added. - MG
-static const
- LLAttention
- BOY_ATTS[] = { // default set of masculine attentions
- LLAttention(MAX_TIMEOUT, 0, "None", LLColor3(0.3f, 0.3f, 0.3f)), // LOOKAT_TARGET_NONE
- LLAttention(3.f, 1, "Idle", LLColor3(0.5f, 0.5f, 0.5f)), // LOOKAT_TARGET_IDLE
- LLAttention(4.f, 3, "AutoListen", LLColor3(0.5f, 0.5f, 0.5f)), // LOOKAT_TARGET_AUTO_LISTEN
- LLAttention(2.f, 2, "FreeLook", LLColor3(0.5f, 0.5f, 0.9f)), // LOOKAT_TARGET_FREELOOK
- LLAttention(4.f, 3, "Respond", LLColor3(0.0f, 0.0f, 0.0f)), // LOOKAT_TARGET_RESPOND
- LLAttention(1.f, 4, "Hover", LLColor3(0.5f, 0.9f, 0.5f)), // LOOKAT_TARGET_HOVER
- LLAttention(MAX_TIMEOUT, 0, "Conversation", LLColor3(0.1f, 0.1f, 0.5f)), // LOOKAT_TARGET_CONVERSATION
- LLAttention(MAX_TIMEOUT, 6, "Select", LLColor3(0.9f, 0.5f, 0.5f)), // LOOKAT_TARGET_SELECT
- LLAttention(MAX_TIMEOUT, 6, "Focus", LLColor3(0.9f, 0.5f, 0.9f)), // LOOKAT_TARGET_FOCUS
- LLAttention(MAX_TIMEOUT, 7, "Mouselook", LLColor3(0.9f, 0.9f, 0.5f)), // LOOKAT_TARGET_MOUSELOOK
- LLAttention(0.f, 8, "Clear", LLColor3(1.0f, 1.0f, 1.0f)), // LOOKAT_TARGET_CLEAR
- },
- GIRL_ATTS[] = { // default set of feminine attentions
- LLAttention(MAX_TIMEOUT, 0, "None", LLColor3(0.3f, 0.3f, 0.3f)), // LOOKAT_TARGET_NONE
- LLAttention(3.f, 1, "Idle", LLColor3(0.5f, 0.5f, 0.5f)), // LOOKAT_TARGET_IDLE
- LLAttention(4.f, 3, "AutoListen", LLColor3(0.5f, 0.5f, 0.5f)), // LOOKAT_TARGET_AUTO_LISTEN
- LLAttention(2.f, 2, "FreeLook", LLColor3(0.5f, 0.5f, 0.9f)), // LOOKAT_TARGET_FREELOOK
- LLAttention(4.f, 3, "Respond", LLColor3(0.0f, 0.0f, 0.0f)), // LOOKAT_TARGET_RESPOND
- LLAttention(1.f, 4, "Hover", LLColor3(0.5f, 0.9f, 0.5f)), // LOOKAT_TARGET_HOVER
- LLAttention(MAX_TIMEOUT, 0, "Conversation", LLColor3(0.1f, 0.1f, 0.5f)), // LOOKAT_TARGET_CONVERSATION
- LLAttention(MAX_TIMEOUT, 6, "Select", LLColor3(0.9f, 0.5f, 0.5f)), // LOOKAT_TARGET_SELECT
- LLAttention(MAX_TIMEOUT, 6, "Focus", LLColor3(0.9f, 0.5f, 0.9f)), // LOOKAT_TARGET_FOCUS
- LLAttention(MAX_TIMEOUT, 7, "Mouselook", LLColor3(0.9f, 0.9f, 0.5f)), // LOOKAT_TARGET_MOUSELOOK
- LLAttention(0.f, 8, "Clear", LLColor3(1.0f, 1.0f, 1.0f)), // LOOKAT_TARGET_CLEAR
- };
+static const
+ LLAttention
+ BOY_ATTS[] = { // default set of masculine attentions
+ LLAttention(MAX_TIMEOUT, 0, "None", LLColor3(0.3f, 0.3f, 0.3f)), // LOOKAT_TARGET_NONE
+ LLAttention(3.f, 1, "Idle", LLColor3(0.5f, 0.5f, 0.5f)), // LOOKAT_TARGET_IDLE
+ LLAttention(4.f, 3, "AutoListen", LLColor3(0.5f, 0.5f, 0.5f)), // LOOKAT_TARGET_AUTO_LISTEN
+ LLAttention(2.f, 2, "FreeLook", LLColor3(0.5f, 0.5f, 0.9f)), // LOOKAT_TARGET_FREELOOK
+ LLAttention(4.f, 3, "Respond", LLColor3(0.0f, 0.0f, 0.0f)), // LOOKAT_TARGET_RESPOND
+ LLAttention(1.f, 4, "Hover", LLColor3(0.5f, 0.9f, 0.5f)), // LOOKAT_TARGET_HOVER
+ LLAttention(MAX_TIMEOUT, 0, "Conversation", LLColor3(0.1f, 0.1f, 0.5f)), // LOOKAT_TARGET_CONVERSATION
+ LLAttention(MAX_TIMEOUT, 6, "Select", LLColor3(0.9f, 0.5f, 0.5f)), // LOOKAT_TARGET_SELECT
+ LLAttention(MAX_TIMEOUT, 6, "Focus", LLColor3(0.9f, 0.5f, 0.9f)), // LOOKAT_TARGET_FOCUS
+ LLAttention(MAX_TIMEOUT, 7, "Mouselook", LLColor3(0.9f, 0.9f, 0.5f)), // LOOKAT_TARGET_MOUSELOOK
+ LLAttention(0.f, 8, "Clear", LLColor3(1.0f, 1.0f, 1.0f)), // LOOKAT_TARGET_CLEAR
+ },
+ GIRL_ATTS[] = { // default set of feminine attentions
+ LLAttention(MAX_TIMEOUT, 0, "None", LLColor3(0.3f, 0.3f, 0.3f)), // LOOKAT_TARGET_NONE
+ LLAttention(3.f, 1, "Idle", LLColor3(0.5f, 0.5f, 0.5f)), // LOOKAT_TARGET_IDLE
+ LLAttention(4.f, 3, "AutoListen", LLColor3(0.5f, 0.5f, 0.5f)), // LOOKAT_TARGET_AUTO_LISTEN
+ LLAttention(2.f, 2, "FreeLook", LLColor3(0.5f, 0.5f, 0.9f)), // LOOKAT_TARGET_FREELOOK
+ LLAttention(4.f, 3, "Respond", LLColor3(0.0f, 0.0f, 0.0f)), // LOOKAT_TARGET_RESPOND
+ LLAttention(1.f, 4, "Hover", LLColor3(0.5f, 0.9f, 0.5f)), // LOOKAT_TARGET_HOVER
+ LLAttention(MAX_TIMEOUT, 0, "Conversation", LLColor3(0.1f, 0.1f, 0.5f)), // LOOKAT_TARGET_CONVERSATION
+ LLAttention(MAX_TIMEOUT, 6, "Select", LLColor3(0.9f, 0.5f, 0.5f)), // LOOKAT_TARGET_SELECT
+ LLAttention(MAX_TIMEOUT, 6, "Focus", LLColor3(0.9f, 0.5f, 0.9f)), // LOOKAT_TARGET_FOCUS
+ LLAttention(MAX_TIMEOUT, 7, "Mouselook", LLColor3(0.9f, 0.9f, 0.5f)), // LOOKAT_TARGET_MOUSELOOK
+ LLAttention(0.f, 8, "Clear", LLColor3(1.0f, 1.0f, 1.0f)), // LOOKAT_TARGET_CLEAR
+ };
static LLAttentionSet
- gBoyAttentions(BOY_ATTS),
- gGirlAttentions(GIRL_ATTS);
+ gBoyAttentions(BOY_ATTS),
+ gGirlAttentions(GIRL_ATTS);
static BOOL loadGender(LLXmlTreeNode* gender)
{
- if( !gender)
- {
- return FALSE;
- }
- std::string str;
- gender->getAttributeString("name", str);
- LLAttentionSet& attentions = (str.compare("Masculine") == 0) ? gBoyAttentions : gGirlAttentions;
- for (LLXmlTreeNode* attention_node = gender->getChildByName( "param" );
- attention_node;
- attention_node = gender->getNextNamedChild())
- {
- attention_node->getAttributeString("attention", str);
- LLAttention* attention;
- if (str == "idle") attention = &attentions[LOOKAT_TARGET_IDLE];
- else if(str == "auto_listen") attention = &attentions[LOOKAT_TARGET_AUTO_LISTEN];
- else if(str == "freelook") attention = &attentions[LOOKAT_TARGET_FREELOOK];
- else if(str == "respond") attention = &attentions[LOOKAT_TARGET_RESPOND];
- else if(str == "hover") attention = &attentions[LOOKAT_TARGET_HOVER];
- else if(str == "conversation") attention = &attentions[LOOKAT_TARGET_CONVERSATION];
- else if(str == "select") attention = &attentions[LOOKAT_TARGET_SELECT];
- else if(str == "focus") attention = &attentions[LOOKAT_TARGET_FOCUS];
- else if(str == "mouselook") attention = &attentions[LOOKAT_TARGET_MOUSELOOK];
- else return FALSE;
-
- F32 priority, timeout;
- attention_node->getAttributeF32("priority", priority);
- attention_node->getAttributeF32("timeout", timeout);
- if(timeout < 0) timeout = MAX_TIMEOUT;
- attention->mPriority = priority;
- attention->mTimeout = timeout;
- }
- return TRUE;
+ if( !gender)
+ {
+ return FALSE;
+ }
+ std::string str;
+ gender->getAttributeString("name", str);
+ LLAttentionSet& attentions = (str.compare("Masculine") == 0) ? gBoyAttentions : gGirlAttentions;
+ for (LLXmlTreeNode* attention_node = gender->getChildByName( "param" );
+ attention_node;
+ attention_node = gender->getNextNamedChild())
+ {
+ attention_node->getAttributeString("attention", str);
+ LLAttention* attention;
+ if (str == "idle") attention = &attentions[LOOKAT_TARGET_IDLE];
+ else if(str == "auto_listen") attention = &attentions[LOOKAT_TARGET_AUTO_LISTEN];
+ else if(str == "freelook") attention = &attentions[LOOKAT_TARGET_FREELOOK];
+ else if(str == "respond") attention = &attentions[LOOKAT_TARGET_RESPOND];
+ else if(str == "hover") attention = &attentions[LOOKAT_TARGET_HOVER];
+ else if(str == "conversation") attention = &attentions[LOOKAT_TARGET_CONVERSATION];
+ else if(str == "select") attention = &attentions[LOOKAT_TARGET_SELECT];
+ else if(str == "focus") attention = &attentions[LOOKAT_TARGET_FOCUS];
+ else if(str == "mouselook") attention = &attentions[LOOKAT_TARGET_MOUSELOOK];
+ else return FALSE;
+
+ F32 priority, timeout;
+ attention_node->getAttributeF32("priority", priority);
+ attention_node->getAttributeF32("timeout", timeout);
+ if(timeout < 0) timeout = MAX_TIMEOUT;
+ attention->mPriority = priority;
+ attention->mTimeout = timeout;
+ }
+ return TRUE;
}
static BOOL loadAttentions()
{
- static BOOL first_time = TRUE;
- if( ! first_time)
- {
- return TRUE; // maybe not ideal but otherwise it can continue to fail forever.
- }
- first_time = FALSE;
-
- std::string filename;
- filename = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"attentions.xml");
- LLXmlTree xml_tree;
- BOOL success = xml_tree.parseFile( filename, FALSE );
- if( !success )
- {
- return FALSE;
- }
- LLXmlTreeNode* root = xml_tree.getRoot();
- if( !root )
- {
- return FALSE;
- }
-
- //-------------------------------------------------------------------------
- // <linden_attentions version="1.0"> (root)
- //-------------------------------------------------------------------------
- if( !root->hasName( "linden_attentions" ) )
- {
- LL_WARNS() << "Invalid linden_attentions file header: " << filename << LL_ENDL;
- return FALSE;
- }
-
- std::string version;
- static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
- if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") )
- {
- LL_WARNS() << "Invalid linden_attentions file version: " << version << LL_ENDL;
- return FALSE;
- }
-
- //-------------------------------------------------------------------------
- // <gender>
- //-------------------------------------------------------------------------
- for (LLXmlTreeNode* child = root->getChildByName( "gender" );
- child;
- child = root->getNextNamedChild())
- {
- if( !loadGender( child ) )
- {
- return FALSE;
- }
- }
-
- return TRUE;
+ static BOOL first_time = TRUE;
+ if( ! first_time)
+ {
+ return TRUE; // maybe not ideal but otherwise it can continue to fail forever.
+ }
+ first_time = FALSE;
+
+ std::string filename;
+ filename = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"attentions.xml");
+ LLXmlTree xml_tree;
+ BOOL success = xml_tree.parseFile( filename, FALSE );
+ if( !success )
+ {
+ return FALSE;
+ }
+ LLXmlTreeNode* root = xml_tree.getRoot();
+ if( !root )
+ {
+ return FALSE;
+ }
+
+ //-------------------------------------------------------------------------
+ // <linden_attentions version="1.0"> (root)
+ //-------------------------------------------------------------------------
+ if( !root->hasName( "linden_attentions" ) )
+ {
+ LL_WARNS() << "Invalid linden_attentions file header: " << filename << LL_ENDL;
+ return FALSE;
+ }
+
+ std::string version;
+ static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
+ if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") )
+ {
+ LL_WARNS() << "Invalid linden_attentions file version: " << version << LL_ENDL;
+ return FALSE;
+ }
+
+ //-------------------------------------------------------------------------
+ // <gender>
+ //-------------------------------------------------------------------------
+ for (LLXmlTreeNode* child = root->getChildByName( "gender" );
+ child;
+ child = root->getNextNamedChild())
+ {
+ if( !loadGender( child ) )
+ {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
}
@@ -236,16 +236,16 @@ static BOOL loadAttentions()
//-----------------------------------------------------------------------------
// LLHUDEffectLookAt()
//-----------------------------------------------------------------------------
-LLHUDEffectLookAt::LLHUDEffectLookAt(const U8 type) :
- LLHUDEffect(type),
- mKillTime(0.f),
- mLastSendTime(0.f)
+LLHUDEffectLookAt::LLHUDEffectLookAt(const U8 type) :
+ LLHUDEffect(type),
+ mKillTime(0.f),
+ mLastSendTime(0.f)
{
- clearLookAtTarget();
- // parse the default sets
- loadAttentions();
- // initialize current attention set. switches when avatar sex changes.
- mAttentions = &gGirlAttentions;
+ clearLookAtTarget();
+ // parse the default sets
+ loadAttentions();
+ // initialize current attention set. switches when avatar sex changes.
+ mAttentions = &gGirlAttentions;
}
//-----------------------------------------------------------------------------
@@ -260,42 +260,42 @@ LLHUDEffectLookAt::~LLHUDEffectLookAt()
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::packData(LLMessageSystem *mesgsys)
{
- // Pack the default data
- LLHUDEffect::packData(mesgsys);
-
- // Pack the type-specific data. Uses a fun packed binary format. Whee!
- U8 packed_data[PKT_SIZE];
- memset(packed_data, 0, PKT_SIZE);
-
- if (mSourceObject)
- {
- htolememcpy(&(packed_data[SOURCE_AVATAR]), mSourceObject->mID.mData, MVT_LLUUID, 16);
- }
- else
- {
- htolememcpy(&(packed_data[SOURCE_AVATAR]), LLUUID::null.mData, MVT_LLUUID, 16);
- }
-
- // pack both target object and position
- // position interpreted as offset if target object is non-null
- if (mTargetObject)
- {
- htolememcpy(&(packed_data[TARGET_OBJECT]), mTargetObject->mID.mData, MVT_LLUUID, 16);
- }
- else
- {
- htolememcpy(&(packed_data[TARGET_OBJECT]), LLUUID::null.mData, MVT_LLUUID, 16);
- }
-
- htolememcpy(&(packed_data[TARGET_POS]), mTargetOffsetGlobal.mdV, MVT_LLVector3d, 24);
-
- U8 lookAtTypePacked = (U8)mTargetType;
-
- htolememcpy(&(packed_data[LOOKAT_TYPE]), &lookAtTypePacked, MVT_U8, 1);
-
- mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, PKT_SIZE);
-
- mLastSendTime = mTimer.getElapsedTimeF32();
+ // Pack the default data
+ LLHUDEffect::packData(mesgsys);
+
+ // Pack the type-specific data. Uses a fun packed binary format. Whee!
+ U8 packed_data[PKT_SIZE];
+ memset(packed_data, 0, PKT_SIZE);
+
+ if (mSourceObject)
+ {
+ htolememcpy(&(packed_data[SOURCE_AVATAR]), mSourceObject->mID.mData, MVT_LLUUID, 16);
+ }
+ else
+ {
+ htolememcpy(&(packed_data[SOURCE_AVATAR]), LLUUID::null.mData, MVT_LLUUID, 16);
+ }
+
+ // pack both target object and position
+ // position interpreted as offset if target object is non-null
+ if (mTargetObject)
+ {
+ htolememcpy(&(packed_data[TARGET_OBJECT]), mTargetObject->mID.mData, MVT_LLUUID, 16);
+ }
+ else
+ {
+ htolememcpy(&(packed_data[TARGET_OBJECT]), LLUUID::null.mData, MVT_LLUUID, 16);
+ }
+
+ htolememcpy(&(packed_data[TARGET_POS]), mTargetOffsetGlobal.mdV, MVT_LLVector3d, 24);
+
+ U8 lookAtTypePacked = (U8)mTargetType;
+
+ htolememcpy(&(packed_data[LOOKAT_TYPE]), &lookAtTypePacked, MVT_U8, 1);
+
+ mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, PKT_SIZE);
+
+ mLastSendTime = mTimer.getElapsedTimeF32();
}
//-----------------------------------------------------------------------------
@@ -303,68 +303,68 @@ void LLHUDEffectLookAt::packData(LLMessageSystem *mesgsys)
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
{
- LLVector3d new_target;
- U8 packed_data[PKT_SIZE];
-
- LLUUID dataId;
- mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, dataId, blocknum);
-
- if (!gAgentCamera.mLookAt.isNull() && dataId == gAgentCamera.mLookAt->getID())
- {
- return;
- }
-
- LLHUDEffect::unpackData(mesgsys, blocknum);
- LLUUID source_id;
- LLUUID target_id;
- S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
- if (size != PKT_SIZE)
- {
- LL_WARNS() << "LookAt effect with bad size " << size << LL_ENDL;
- return;
- }
- mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, PKT_SIZE, blocknum);
-
- htolememcpy(source_id.mData, &(packed_data[SOURCE_AVATAR]), MVT_LLUUID, 16);
-
- LLViewerObject *objp = gObjectList.findObject(source_id);
- if (objp && objp->isAvatar())
- {
- setSourceObject(objp);
- }
- else
- {
- //LL_WARNS() << "Could not find source avatar for lookat effect" << LL_ENDL;
- return;
- }
-
- htolememcpy(target_id.mData, &(packed_data[TARGET_OBJECT]), MVT_LLUUID, 16);
-
- objp = gObjectList.findObject(target_id);
-
- htolememcpy(new_target.mdV, &(packed_data[TARGET_POS]), MVT_LLVector3d, 24);
-
- if (objp)
- {
- setTargetObjectAndOffset(objp, new_target);
- }
- else if (target_id.isNull())
- {
- setTargetPosGlobal(new_target);
- }
- else
- {
- //LL_WARNS() << "Could not find target object for lookat effect" << LL_ENDL;
- }
-
- U8 lookAtTypeUnpacked = 0;
- htolememcpy(&lookAtTypeUnpacked, &(packed_data[LOOKAT_TYPE]), MVT_U8, 1);
- mTargetType = (ELookAtType)lookAtTypeUnpacked;
-
- if (mTargetType == LOOKAT_TARGET_NONE)
- {
- clearLookAtTarget();
- }
+ LLVector3d new_target;
+ U8 packed_data[PKT_SIZE];
+
+ LLUUID dataId;
+ mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, dataId, blocknum);
+
+ if (!gAgentCamera.mLookAt.isNull() && dataId == gAgentCamera.mLookAt->getID())
+ {
+ return;
+ }
+
+ LLHUDEffect::unpackData(mesgsys, blocknum);
+ LLUUID source_id;
+ LLUUID target_id;
+ S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
+ if (size != PKT_SIZE)
+ {
+ LL_WARNS() << "LookAt effect with bad size " << size << LL_ENDL;
+ return;
+ }
+ mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, PKT_SIZE, blocknum);
+
+ htolememcpy(source_id.mData, &(packed_data[SOURCE_AVATAR]), MVT_LLUUID, 16);
+
+ LLViewerObject *objp = gObjectList.findObject(source_id);
+ if (objp && objp->isAvatar())
+ {
+ setSourceObject(objp);
+ }
+ else
+ {
+ //LL_WARNS() << "Could not find source avatar for lookat effect" << LL_ENDL;
+ return;
+ }
+
+ htolememcpy(target_id.mData, &(packed_data[TARGET_OBJECT]), MVT_LLUUID, 16);
+
+ objp = gObjectList.findObject(target_id);
+
+ htolememcpy(new_target.mdV, &(packed_data[TARGET_POS]), MVT_LLVector3d, 24);
+
+ if (objp)
+ {
+ setTargetObjectAndOffset(objp, new_target);
+ }
+ else if (target_id.isNull())
+ {
+ setTargetPosGlobal(new_target);
+ }
+ else
+ {
+ //LL_WARNS() << "Could not find target object for lookat effect" << LL_ENDL;
+ }
+
+ U8 lookAtTypeUnpacked = 0;
+ htolememcpy(&lookAtTypeUnpacked, &(packed_data[LOOKAT_TYPE]), MVT_U8, 1);
+ mTargetType = (ELookAtType)lookAtTypeUnpacked;
+
+ if (mTargetType == LOOKAT_TARGET_NONE)
+ {
+ clearLookAtTarget();
+ }
}
//-----------------------------------------------------------------------------
@@ -372,8 +372,8 @@ void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset)
{
- mTargetObject = objp;
- mTargetOffsetGlobal = offset;
+ mTargetObject = objp;
+ mTargetOffsetGlobal = offset;
}
//-----------------------------------------------------------------------------
@@ -381,8 +381,8 @@ void LLHUDEffectLookAt::setTargetObjectAndOffset(LLViewerObject *objp, LLVector3
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::setTargetPosGlobal(const LLVector3d &target_pos_global)
{
- mTargetObject = NULL;
- mTargetOffsetGlobal = target_pos_global;
+ mTargetObject = NULL;
+ mTargetOffsetGlobal = target_pos_global;
}
//-----------------------------------------------------------------------------
@@ -391,61 +391,61 @@ void LLHUDEffectLookAt::setTargetPosGlobal(const LLVector3d &target_pos_global)
//-----------------------------------------------------------------------------
BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position)
{
- if (!mSourceObject)
- {
- return FALSE;
- }
-
- if (target_type >= LOOKAT_NUM_TARGETS)
- {
- LL_WARNS() << "Bad target_type " << (int)target_type << " - ignoring." << LL_ENDL;
- return FALSE;
- }
-
- // must be same or higher priority than existing effect
- if ((*mAttentions)[target_type].mPriority < (*mAttentions)[mTargetType].mPriority)
- {
- return FALSE;
- }
-
- F32 current_time = mTimer.getElapsedTimeF32();
-
- // type of lookat behavior or target object has changed
- BOOL lookAtChanged = (target_type != mTargetType) || (object != mTargetObject);
-
- // lookat position has moved a certain amount and we haven't just sent an update
- lookAtChanged = lookAtChanged || ((dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) &&
- ((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC)));
-
- if (lookAtChanged)
- {
- mLastSentOffsetGlobal = position;
- F32 timeout = (*mAttentions)[target_type].mTimeout;
- setDuration(timeout);
- setNeedsSendToSim(TRUE);
- }
-
- if (target_type == LOOKAT_TARGET_CLEAR)
- {
- clearLookAtTarget();
- }
- else
- {
- mTargetType = target_type;
- mTargetObject = object;
- if (object)
- {
- mTargetOffsetGlobal.setVec(position);
- }
- else
- {
- mTargetOffsetGlobal = gAgent.getPosGlobalFromAgent(position);
- }
- mKillTime = mTimer.getElapsedTimeF32() + mDuration;
-
- update();
- }
- return TRUE;
+ if (!mSourceObject)
+ {
+ return FALSE;
+ }
+
+ if (target_type >= LOOKAT_NUM_TARGETS)
+ {
+ LL_WARNS() << "Bad target_type " << (int)target_type << " - ignoring." << LL_ENDL;
+ return FALSE;
+ }
+
+ // must be same or higher priority than existing effect
+ if ((*mAttentions)[target_type].mPriority < (*mAttentions)[mTargetType].mPriority)
+ {
+ return FALSE;
+ }
+
+ F32 current_time = mTimer.getElapsedTimeF32();
+
+ // type of lookat behavior or target object has changed
+ BOOL lookAtChanged = (target_type != mTargetType) || (object != mTargetObject);
+
+ // lookat position has moved a certain amount and we haven't just sent an update
+ lookAtChanged = lookAtChanged || ((dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) &&
+ ((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC)));
+
+ if (lookAtChanged)
+ {
+ mLastSentOffsetGlobal = position;
+ F32 timeout = (*mAttentions)[target_type].mTimeout;
+ setDuration(timeout);
+ setNeedsSendToSim(TRUE);
+ }
+
+ if (target_type == LOOKAT_TARGET_CLEAR)
+ {
+ clearLookAtTarget();
+ }
+ else
+ {
+ mTargetType = target_type;
+ mTargetObject = object;
+ if (object)
+ {
+ mTargetOffsetGlobal.setVec(position);
+ }
+ else
+ {
+ mTargetOffsetGlobal = gAgent.getPosGlobalFromAgent(position);
+ }
+ mKillTime = mTimer.getElapsedTimeF32() + mDuration;
+
+ update();
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -453,13 +453,13 @@ BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::clearLookAtTarget()
{
- mTargetObject = NULL;
- mTargetOffsetGlobal.clearVec();
- mTargetType = LOOKAT_TARGET_NONE;
- if (mSourceObject.notNull())
- {
- ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->stopMotion(ANIM_AGENT_HEAD_ROT);
- }
+ mTargetObject = NULL;
+ mTargetOffsetGlobal.clearVec();
+ mTargetType = LOOKAT_TARGET_NONE;
+ if (mSourceObject.notNull())
+ {
+ ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->stopMotion(ANIM_AGENT_HEAD_ROT);
+ }
}
//-----------------------------------------------------------------------------
@@ -467,23 +467,23 @@ void LLHUDEffectLookAt::clearLookAtTarget()
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::markDead()
{
- if (mSourceObject.notNull())
- {
- ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->removeAnimationData("LookAtPoint");
- }
-
- mSourceObject = NULL;
- clearLookAtTarget();
- LLHUDEffect::markDead();
+ if (mSourceObject.notNull())
+ {
+ ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->removeAnimationData("LookAtPoint");
+ }
+
+ mSourceObject = NULL;
+ clearLookAtTarget();
+ LLHUDEffect::markDead();
}
void LLHUDEffectLookAt::setSourceObject(LLViewerObject* objectp)
{
- // restrict source objects to avatars
- if (objectp && objectp->isAvatar())
- {
- LLHUDEffect::setSourceObject(objectp);
- }
+ // restrict source objects to avatars
+ if (objectp && objectp->isAvatar())
+ {
+ LLHUDEffect::setSourceObject(objectp);
+ }
}
//-----------------------------------------------------------------------------
@@ -491,32 +491,32 @@ void LLHUDEffectLookAt::setSourceObject(LLViewerObject* objectp)
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::render()
{
- if (sDebugLookAt && mSourceObject.notNull())
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- //LLGLDisable gls_stencil(GL_STENCIL_TEST);
-
- LLVector3 target = mTargetPos + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->mHeadp->getWorldPosition();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]);
- gGL.scalef(0.3f, 0.3f, 0.3f);
- gGL.begin(LLRender::LINES);
- {
- LLColor3 color = (*mAttentions)[mTargetType].mColor;
- gGL.color3f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE]);
- gGL.vertex3f(-1.f, 0.f, 0.f);
- gGL.vertex3f(1.f, 0.f, 0.f);
-
- gGL.vertex3f(0.f, -1.f, 0.f);
- gGL.vertex3f(0.f, 1.f, 0.f);
-
- gGL.vertex3f(0.f, 0.f, -1.f);
- gGL.vertex3f(0.f, 0.f, 1.f);
- } gGL.end();
- gGL.popMatrix();
- }
+ if (sDebugLookAt && mSourceObject.notNull())
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
+
+ LLVector3 target = mTargetPos + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->mHeadp->getWorldPosition();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]);
+ gGL.scalef(0.3f, 0.3f, 0.3f);
+ gGL.begin(LLRender::LINES);
+ {
+ LLColor3 color = (*mAttentions)[mTargetType].mColor;
+ gGL.color3f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE]);
+ gGL.vertex3f(-1.f, 0.f, 0.f);
+ gGL.vertex3f(1.f, 0.f, 0.f);
+
+ gGL.vertex3f(0.f, -1.f, 0.f);
+ gGL.vertex3f(0.f, 1.f, 0.f);
+
+ gGL.vertex3f(0.f, 0.f, -1.f);
+ gGL.vertex3f(0.f, 0.f, 1.f);
+ } gGL.end();
+ gGL.popMatrix();
+ }
}
//-----------------------------------------------------------------------------
@@ -524,62 +524,62 @@ void LLHUDEffectLookAt::render()
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::update()
{
- // If the target object is dead, set the target object to NULL
- if (!mTargetObject.isNull() && mTargetObject->isDead())
- {
- clearLookAtTarget();
- }
-
- // if source avatar is null or dead, mark self as dead and return
- if (mSourceObject.isNull() || mSourceObject->isDead())
- {
- markDead();
- return;
- }
-
- // make sure the proper set of avatar attention are currently being used.
- LLVOAvatar* source_avatar = (LLVOAvatar*)(LLViewerObject*)mSourceObject;
- // for now the first cut will just switch on sex. future development could adjust
- // timeouts according to avatar age and/or other features.
- mAttentions = (source_avatar->getSex() == SEX_MALE) ? &gBoyAttentions : &gGirlAttentions;
- //printf("updated to %s\n", (source_avatar->getSex() == SEX_MALE) ? "male" : "female");
-
- F32 time = mTimer.getElapsedTimeF32();
-
- // clear out the effect if time is up
- if (mKillTime != 0.f && time > mKillTime)
- {
- if (mTargetType != LOOKAT_TARGET_NONE)
- {
- clearLookAtTarget();
- // look at timed out (only happens on own avatar), so tell everyone
- setNeedsSendToSim(TRUE);
- }
- }
-
- if (mTargetType != LOOKAT_TARGET_NONE)
- {
- if (calcTargetPosition())
- {
- LLMotion* head_motion = ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->findMotion(ANIM_AGENT_HEAD_ROT);
- if (!head_motion || head_motion->isStopped())
- {
- ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_HEAD_ROT);
- }
- }
- }
-
- if (sDebugLookAt)
- {
- ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->addDebugText((*mAttentions)[mTargetType].mName);
- }
+ // If the target object is dead, set the target object to NULL
+ if (!mTargetObject.isNull() && mTargetObject->isDead())
+ {
+ clearLookAtTarget();
+ }
+
+ // if source avatar is null or dead, mark self as dead and return
+ if (mSourceObject.isNull() || mSourceObject->isDead())
+ {
+ markDead();
+ return;
+ }
+
+ // make sure the proper set of avatar attention are currently being used.
+ LLVOAvatar* source_avatar = (LLVOAvatar*)(LLViewerObject*)mSourceObject;
+ // for now the first cut will just switch on sex. future development could adjust
+ // timeouts according to avatar age and/or other features.
+ mAttentions = (source_avatar->getSex() == SEX_MALE) ? &gBoyAttentions : &gGirlAttentions;
+ //printf("updated to %s\n", (source_avatar->getSex() == SEX_MALE) ? "male" : "female");
+
+ F32 time = mTimer.getElapsedTimeF32();
+
+ // clear out the effect if time is up
+ if (mKillTime != 0.f && time > mKillTime)
+ {
+ if (mTargetType != LOOKAT_TARGET_NONE)
+ {
+ clearLookAtTarget();
+ // look at timed out (only happens on own avatar), so tell everyone
+ setNeedsSendToSim(TRUE);
+ }
+ }
+
+ if (mTargetType != LOOKAT_TARGET_NONE)
+ {
+ if (calcTargetPosition())
+ {
+ LLMotion* head_motion = ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->findMotion(ANIM_AGENT_HEAD_ROT);
+ if (!head_motion || head_motion->isStopped())
+ {
+ ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_HEAD_ROT);
+ }
+ }
+ }
+
+ if (sDebugLookAt)
+ {
+ ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->addDebugText((*mAttentions)[mTargetType].mName);
+ }
}
/**
* Initializes the mTargetPos member from the current mSourceObjec and mTargetObject
* (and possibly mTargetOffsetGlobal).
* When mTargetObject is another avatar, it sets mTargetPos to be their eyes.
- *
+ *
* Has the side-effect of also calling setAnimationData("LookAtPoint") with the new
* mTargetPos on the source object which is assumed to be an avatar.
*
@@ -587,85 +587,85 @@ void LLHUDEffectLookAt::update()
*/
bool LLHUDEffectLookAt::calcTargetPosition()
{
- LLViewerObject *target_obj = (LLViewerObject *)mTargetObject;
- LLVector3 local_offset;
-
- if (target_obj)
- {
- local_offset.setVec(mTargetOffsetGlobal);
- }
- else
- {
- local_offset = gAgent.getPosAgentFromGlobal(mTargetOffsetGlobal);
- }
-
- LLVOAvatar* source_avatar = (LLVOAvatar*)(LLViewerObject*)mSourceObject;
- if (!source_avatar->isBuilt())
- return false;
-
- if (target_obj && target_obj->mDrawable.notNull())
- {
- LLQuaternion target_rot;
- if (target_obj->isAvatar())
- {
- LLVOAvatar *target_av = (LLVOAvatar *)target_obj;
-
- BOOL looking_at_self = source_avatar->isSelf() && target_av->isSelf();
-
- // if selecting self, stare forward
- if (looking_at_self && mTargetOffsetGlobal.magVecSquared() < MIN_TARGET_OFFSET_SQUARED)
- {
- //sets the lookat point in front of the avatar
- mTargetOffsetGlobal.setVec(5.0, 0.0, 0.0);
- local_offset.setVec(mTargetOffsetGlobal);
- }
-
- // look the other avatar in the eye. note: what happens if target is self? -MG
- mTargetPos = target_av->mHeadp->getWorldPosition();
- if (mTargetType == LOOKAT_TARGET_MOUSELOOK || mTargetType == LOOKAT_TARGET_FREELOOK)
- {
- // mouselook and freelook target offsets are absolute
- target_rot = LLQuaternion::DEFAULT;
- }
- else if (looking_at_self && gAgentCamera.cameraCustomizeAvatar())
- {
- // *NOTE: We have to do this because animation
- // overrides do not set lookat behavior.
- // *TODO: animation overrides for lookat behavior.
- target_rot = target_av->mPelvisp->getWorldRotation();
- }
- else
- {
- target_rot = target_av->mRoot->getWorldRotation();
- }
- }
- else // target obj is not an avatar
- {
- if (target_obj->mDrawable->getGeneration() == -1)
- {
- mTargetPos = target_obj->getPositionAgent();
- target_rot = target_obj->getWorldRotation();
- }
- else
- {
- mTargetPos = target_obj->getRenderPosition();
- target_rot = target_obj->getRenderRotation();
- }
- }
-
- mTargetPos += (local_offset * target_rot);
- }
- else // no target obj or it's not drawable
- {
- mTargetPos = local_offset;
- }
-
- mTargetPos -= source_avatar->mHeadp->getWorldPosition();
-
- if (!mTargetPos.isFinite())
- return false;
-
- source_avatar->setAnimationData("LookAtPoint", (void *)&mTargetPos);
-
- return true;
+ LLViewerObject *target_obj = (LLViewerObject *)mTargetObject;
+ LLVector3 local_offset;
+
+ if (target_obj)
+ {
+ local_offset.setVec(mTargetOffsetGlobal);
+ }
+ else
+ {
+ local_offset = gAgent.getPosAgentFromGlobal(mTargetOffsetGlobal);
+ }
+
+ LLVOAvatar* source_avatar = (LLVOAvatar*)(LLViewerObject*)mSourceObject;
+ if (!source_avatar->isBuilt())
+ return false;
+
+ if (target_obj && target_obj->mDrawable.notNull())
+ {
+ LLQuaternion target_rot;
+ if (target_obj->isAvatar())
+ {
+ LLVOAvatar *target_av = (LLVOAvatar *)target_obj;
+
+ BOOL looking_at_self = source_avatar->isSelf() && target_av->isSelf();
+
+ // if selecting self, stare forward
+ if (looking_at_self && mTargetOffsetGlobal.magVecSquared() < MIN_TARGET_OFFSET_SQUARED)
+ {
+ //sets the lookat point in front of the avatar
+ mTargetOffsetGlobal.setVec(5.0, 0.0, 0.0);
+ local_offset.setVec(mTargetOffsetGlobal);
+ }
+
+ // look the other avatar in the eye. note: what happens if target is self? -MG
+ mTargetPos = target_av->mHeadp->getWorldPosition();
+ if (mTargetType == LOOKAT_TARGET_MOUSELOOK || mTargetType == LOOKAT_TARGET_FREELOOK)
+ {
+ // mouselook and freelook target offsets are absolute
+ target_rot = LLQuaternion::DEFAULT;
+ }
+ else if (looking_at_self && gAgentCamera.cameraCustomizeAvatar())
+ {
+ // *NOTE: We have to do this because animation
+ // overrides do not set lookat behavior.
+ // *TODO: animation overrides for lookat behavior.
+ target_rot = target_av->mPelvisp->getWorldRotation();
+ }
+ else
+ {
+ target_rot = target_av->mRoot->getWorldRotation();
+ }
+ }
+ else // target obj is not an avatar
+ {
+ if (target_obj->mDrawable->getGeneration() == -1)
+ {
+ mTargetPos = target_obj->getPositionAgent();
+ target_rot = target_obj->getWorldRotation();
+ }
+ else
+ {
+ mTargetPos = target_obj->getRenderPosition();
+ target_rot = target_obj->getRenderRotation();
+ }
+ }
+
+ mTargetPos += (local_offset * target_rot);
+ }
+ else // no target obj or it's not drawable
+ {
+ mTargetPos = local_offset;
+ }
+
+ mTargetPos -= source_avatar->mHeadp->getWorldPosition();
+
+ if (!mTargetPos.isFinite())
+ return false;
+
+ source_avatar->setAnimationData("LookAtPoint", (void *)&mTargetPos);
+
+ return true;
}
diff --git a/indra/newview/llhudeffectlookat.h b/indra/newview/llhudeffectlookat.h
index fd057715b6..9e92212cc8 100644
--- a/indra/newview/llhudeffectlookat.h
+++ b/indra/newview/llhudeffectlookat.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffectlookat.h
* @brief LLHUDEffectLookAt class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,61 +35,61 @@ class LLAttentionSet;
typedef enum e_lookat_type
{
- LOOKAT_TARGET_NONE,
- LOOKAT_TARGET_IDLE,
- LOOKAT_TARGET_AUTO_LISTEN,
- LOOKAT_TARGET_FREELOOK,
- LOOKAT_TARGET_RESPOND,
- LOOKAT_TARGET_HOVER,
- LOOKAT_TARGET_CONVERSATION,
- LOOKAT_TARGET_SELECT,
- LOOKAT_TARGET_FOCUS,
- LOOKAT_TARGET_MOUSELOOK,
- LOOKAT_TARGET_CLEAR,
- LOOKAT_NUM_TARGETS
+ LOOKAT_TARGET_NONE,
+ LOOKAT_TARGET_IDLE,
+ LOOKAT_TARGET_AUTO_LISTEN,
+ LOOKAT_TARGET_FREELOOK,
+ LOOKAT_TARGET_RESPOND,
+ LOOKAT_TARGET_HOVER,
+ LOOKAT_TARGET_CONVERSATION,
+ LOOKAT_TARGET_SELECT,
+ LOOKAT_TARGET_FOCUS,
+ LOOKAT_TARGET_MOUSELOOK,
+ LOOKAT_TARGET_CLEAR,
+ LOOKAT_NUM_TARGETS
} ELookAtType;
class LLHUDEffectLookAt : public LLHUDEffect
{
public:
- friend class LLHUDObject;
+ friend class LLHUDObject;
- /*virtual*/ void markDead();
- /*virtual*/ void setSourceObject(LLViewerObject* objectp);
+ /*virtual*/ void markDead();
+ /*virtual*/ void setSourceObject(LLViewerObject* objectp);
- BOOL setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position);
- void clearLookAtTarget();
+ BOOL setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position);
+ void clearLookAtTarget();
- ELookAtType getLookAtType() { return mTargetType; }
- const LLVector3& getTargetPos() { return mTargetPos; }
- const LLVector3d& getTargetOffset() { return mTargetOffsetGlobal; }
- bool calcTargetPosition();
+ ELookAtType getLookAtType() { return mTargetType; }
+ const LLVector3& getTargetPos() { return mTargetPos; }
+ const LLVector3d& getTargetOffset() { return mTargetOffsetGlobal; }
+ bool calcTargetPosition();
protected:
- LLHUDEffectLookAt(const U8 type);
- ~LLHUDEffectLookAt();
+ LLHUDEffectLookAt(const U8 type);
+ ~LLHUDEffectLookAt();
+
+ /*virtual*/ void update();
+ /*virtual*/ void render();
+ /*virtual*/ void packData(LLMessageSystem *mesgsys);
+ /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
- /*virtual*/ void update();
- /*virtual*/ void render();
- /*virtual*/ void packData(LLMessageSystem *mesgsys);
- /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
-
- // lookat behavior has either target position or target object with offset
- void setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset);
- void setTargetPosGlobal(const LLVector3d &target_pos_global);
+ // lookat behavior has either target position or target object with offset
+ void setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset);
+ void setTargetPosGlobal(const LLVector3d &target_pos_global);
public:
- static BOOL sDebugLookAt;
+ static BOOL sDebugLookAt;
private:
- ELookAtType mTargetType;
- LLVector3d mTargetOffsetGlobal;
- LLVector3 mLastSentOffsetGlobal;
- F32 mKillTime;
- LLFrameTimer mTimer;
- LLVector3 mTargetPos;
- F32 mLastSendTime;
- LLAttentionSet* mAttentions;
+ ELookAtType mTargetType;
+ LLVector3d mTargetOffsetGlobal;
+ LLVector3 mLastSentOffsetGlobal;
+ F32 mKillTime;
+ LLFrameTimer mTimer;
+ LLVector3 mTargetPos;
+ F32 mLastSendTime;
+ LLAttentionSet* mAttentions;
};
#endif // LL_LLHUDEFFECTLOOKAT_H
diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp
index dfa299528a..bfa81c7fd1 100644
--- a/indra/newview/llhudeffectpointat.cpp
+++ b/indra/newview/llhudeffectpointat.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffectpointat.cpp
* @brief LLHUDEffectPointAt class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,20 +54,20 @@ const F32 MIN_DELTAPOS_FOR_UPDATE_SQUARED = 0.05f * 0.05f;
// can't use actual F32_MAX, because we add this to the current frametime
const F32 MAX_TIMEOUT = F32_MAX / 4.f;
-const F32 POINTAT_TIMEOUTS[POINTAT_NUM_TARGETS] =
+const F32 POINTAT_TIMEOUTS[POINTAT_NUM_TARGETS] =
{
- MAX_TIMEOUT, //POINTAT_TARGET_NONE
- MAX_TIMEOUT, //POINTAT_TARGET_SELECT
- MAX_TIMEOUT, //POINTAT_TARGET_GRAB
- 0.f, //POINTAT_TARGET_CLEAR
+ MAX_TIMEOUT, //POINTAT_TARGET_NONE
+ MAX_TIMEOUT, //POINTAT_TARGET_SELECT
+ MAX_TIMEOUT, //POINTAT_TARGET_GRAB
+ 0.f, //POINTAT_TARGET_CLEAR
};
-const S32 POINTAT_PRIORITIES[POINTAT_NUM_TARGETS] =
+const S32 POINTAT_PRIORITIES[POINTAT_NUM_TARGETS] =
{
- 0, //POINTAT_TARGET_NONE
- 1, //POINTAT_TARGET_SELECT
- 2, //POINTAT_TARGET_GRAB
- 3, //POINTAT_TARGET_CLEAR
+ 0, //POINTAT_TARGET_NONE
+ 1, //POINTAT_TARGET_SELECT
+ 2, //POINTAT_TARGET_GRAB
+ 3, //POINTAT_TARGET_CLEAR
};
// statics
@@ -78,12 +78,12 @@ BOOL LLHUDEffectPointAt::sDebugPointAt;
//-----------------------------------------------------------------------------
// LLHUDEffectPointAt()
//-----------------------------------------------------------------------------
-LLHUDEffectPointAt::LLHUDEffectPointAt(const U8 type) :
- LLHUDEffect(type),
- mKillTime(0.f),
- mLastSendTime(0.f)
+LLHUDEffectPointAt::LLHUDEffectPointAt(const U8 type) :
+ LLHUDEffect(type),
+ mKillTime(0.f),
+ mLastSendTime(0.f)
{
- clearPointAtTarget();
+ clearPointAtTarget();
}
//-----------------------------------------------------------------------------
@@ -98,41 +98,41 @@ LLHUDEffectPointAt::~LLHUDEffectPointAt()
//-----------------------------------------------------------------------------
void LLHUDEffectPointAt::packData(LLMessageSystem *mesgsys)
{
- // Pack the default data
- LLHUDEffect::packData(mesgsys);
-
- // Pack the type-specific data. Uses a fun packed binary format. Whee!
- U8 packed_data[PKT_SIZE];
- memset(packed_data, 0, PKT_SIZE);
-
- if (mSourceObject)
- {
- htolememcpy(&(packed_data[SOURCE_AVATAR]), mSourceObject->mID.mData, MVT_LLUUID, 16);
- }
- else
- {
- htolememcpy(&(packed_data[SOURCE_AVATAR]), LLUUID::null.mData, MVT_LLUUID, 16);
- }
-
- // pack both target object and position
- // position interpreted as offset if target object is non-null
- if (mTargetObject)
- {
- htolememcpy(&(packed_data[TARGET_OBJECT]), mTargetObject->mID.mData, MVT_LLUUID, 16);
- }
- else
- {
- htolememcpy(&(packed_data[TARGET_OBJECT]), LLUUID::null.mData, MVT_LLUUID, 16);
- }
-
- htolememcpy(&(packed_data[TARGET_POS]), mTargetOffsetGlobal.mdV, MVT_LLVector3d, 24);
-
- U8 pointAtTypePacked = (U8)mTargetType;
- htolememcpy(&(packed_data[POINTAT_TYPE]), &pointAtTypePacked, MVT_U8, 1);
-
- mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, PKT_SIZE);
-
- mLastSendTime = mTimer.getElapsedTimeF32();
+ // Pack the default data
+ LLHUDEffect::packData(mesgsys);
+
+ // Pack the type-specific data. Uses a fun packed binary format. Whee!
+ U8 packed_data[PKT_SIZE];
+ memset(packed_data, 0, PKT_SIZE);
+
+ if (mSourceObject)
+ {
+ htolememcpy(&(packed_data[SOURCE_AVATAR]), mSourceObject->mID.mData, MVT_LLUUID, 16);
+ }
+ else
+ {
+ htolememcpy(&(packed_data[SOURCE_AVATAR]), LLUUID::null.mData, MVT_LLUUID, 16);
+ }
+
+ // pack both target object and position
+ // position interpreted as offset if target object is non-null
+ if (mTargetObject)
+ {
+ htolememcpy(&(packed_data[TARGET_OBJECT]), mTargetObject->mID.mData, MVT_LLUUID, 16);
+ }
+ else
+ {
+ htolememcpy(&(packed_data[TARGET_OBJECT]), LLUUID::null.mData, MVT_LLUUID, 16);
+ }
+
+ htolememcpy(&(packed_data[TARGET_POS]), mTargetOffsetGlobal.mdV, MVT_LLVector3d, 24);
+
+ U8 pointAtTypePacked = (U8)mTargetType;
+ htolememcpy(&(packed_data[POINTAT_TYPE]), &pointAtTypePacked, MVT_U8, 1);
+
+ mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, PKT_SIZE);
+
+ mLastSendTime = mTimer.getElapsedTimeF32();
}
//-----------------------------------------------------------------------------
@@ -140,61 +140,61 @@ void LLHUDEffectPointAt::packData(LLMessageSystem *mesgsys)
//-----------------------------------------------------------------------------
void LLHUDEffectPointAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
{
- LLVector3d new_target;
- U8 packed_data[PKT_SIZE];
-
- LLUUID dataId;
- mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, dataId, blocknum);
-
- // ignore messages from ourselves
- if (!gAgentCamera.mPointAt.isNull() && dataId == gAgentCamera.mPointAt->getID())
- {
- return;
- }
-
- LLHUDEffect::unpackData(mesgsys, blocknum);
- LLUUID source_id;
- LLUUID target_id;
- U8 pointAtTypeUnpacked = 0;
- S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
- if (size != PKT_SIZE)
- {
- LL_WARNS() << "PointAt effect with bad size " << size << LL_ENDL;
- return;
- }
- mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, PKT_SIZE, blocknum);
-
- htolememcpy(source_id.mData, &(packed_data[SOURCE_AVATAR]), MVT_LLUUID, 16);
- htolememcpy(target_id.mData, &(packed_data[TARGET_OBJECT]), MVT_LLUUID, 16);
- htolememcpy(new_target.mdV, &(packed_data[TARGET_POS]), MVT_LLVector3d, 24);
- htolememcpy(&pointAtTypeUnpacked, &(packed_data[POINTAT_TYPE]), MVT_U8, 1);
-
- LLViewerObject *objp = gObjectList.findObject(source_id);
- if (objp && objp->isAvatar())
- {
- setSourceObject(objp);
- }
- else
- {
- //LL_WARNS() << "Could not find source avatar for pointat effect" << LL_ENDL;
- return;
- }
-
- objp = gObjectList.findObject(target_id);
-
- if (objp)
- {
- setTargetObjectAndOffset(objp, new_target);
- }
- else if (target_id.isNull())
- {
- setTargetPosGlobal(new_target);
- }
-
- mTargetType = (EPointAtType)pointAtTypeUnpacked;
-
-// mKillTime = mTimer.getElapsedTimeF32() + mDuration;
- update();
+ LLVector3d new_target;
+ U8 packed_data[PKT_SIZE];
+
+ LLUUID dataId;
+ mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_ID, dataId, blocknum);
+
+ // ignore messages from ourselves
+ if (!gAgentCamera.mPointAt.isNull() && dataId == gAgentCamera.mPointAt->getID())
+ {
+ return;
+ }
+
+ LLHUDEffect::unpackData(mesgsys, blocknum);
+ LLUUID source_id;
+ LLUUID target_id;
+ U8 pointAtTypeUnpacked = 0;
+ S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
+ if (size != PKT_SIZE)
+ {
+ LL_WARNS() << "PointAt effect with bad size " << size << LL_ENDL;
+ return;
+ }
+ mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, PKT_SIZE, blocknum);
+
+ htolememcpy(source_id.mData, &(packed_data[SOURCE_AVATAR]), MVT_LLUUID, 16);
+ htolememcpy(target_id.mData, &(packed_data[TARGET_OBJECT]), MVT_LLUUID, 16);
+ htolememcpy(new_target.mdV, &(packed_data[TARGET_POS]), MVT_LLVector3d, 24);
+ htolememcpy(&pointAtTypeUnpacked, &(packed_data[POINTAT_TYPE]), MVT_U8, 1);
+
+ LLViewerObject *objp = gObjectList.findObject(source_id);
+ if (objp && objp->isAvatar())
+ {
+ setSourceObject(objp);
+ }
+ else
+ {
+ //LL_WARNS() << "Could not find source avatar for pointat effect" << LL_ENDL;
+ return;
+ }
+
+ objp = gObjectList.findObject(target_id);
+
+ if (objp)
+ {
+ setTargetObjectAndOffset(objp, new_target);
+ }
+ else if (target_id.isNull())
+ {
+ setTargetPosGlobal(new_target);
+ }
+
+ mTargetType = (EPointAtType)pointAtTypeUnpacked;
+
+// mKillTime = mTimer.getElapsedTimeF32() + mDuration;
+ update();
}
//-----------------------------------------------------------------------------
@@ -202,8 +202,8 @@ void LLHUDEffectPointAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
//-----------------------------------------------------------------------------
void LLHUDEffectPointAt::setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset)
{
- mTargetObject = objp;
- mTargetOffsetGlobal = offset;
+ mTargetObject = objp;
+ mTargetOffsetGlobal = offset;
}
//-----------------------------------------------------------------------------
@@ -211,8 +211,8 @@ void LLHUDEffectPointAt::setTargetObjectAndOffset(LLViewerObject *objp, LLVector
//-----------------------------------------------------------------------------
void LLHUDEffectPointAt::setTargetPosGlobal(const LLVector3d &target_pos_global)
{
- mTargetObject = NULL;
- mTargetOffsetGlobal = target_pos_global;
+ mTargetObject = NULL;
+ mTargetOffsetGlobal = target_pos_global;
}
//-----------------------------------------------------------------------------
@@ -221,64 +221,64 @@ void LLHUDEffectPointAt::setTargetPosGlobal(const LLVector3d &target_pos_global)
//-----------------------------------------------------------------------------
BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position)
{
- if (!mSourceObject)
- {
- return FALSE;
- }
-
- if (target_type >= POINTAT_NUM_TARGETS)
- {
- LL_WARNS() << "Bad target_type " << (int)target_type << " - ignoring." << LL_ENDL;
- return FALSE;
- }
-
- // must be same or higher priority than existing effect
- if (POINTAT_PRIORITIES[target_type] < POINTAT_PRIORITIES[mTargetType])
- {
- return FALSE;
- }
-
- F32 current_time = mTimer.getElapsedTimeF32();
-
- // type of pointat behavior or target object has changed
- BOOL targetTypeChanged = (target_type != mTargetType) ||
- (object != mTargetObject);
-
- BOOL targetPosChanged = (dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) &&
- ((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC));
-
- if (targetTypeChanged || targetPosChanged)
- {
- mLastSentOffsetGlobal = position;
- setDuration(POINTAT_TIMEOUTS[target_type]);
- setNeedsSendToSim(TRUE);
-// LL_INFOS() << "Sending pointat data" << LL_ENDL;
- }
-
- if (target_type == POINTAT_TARGET_CLEAR)
- {
- clearPointAtTarget();
- }
- else
- {
- mTargetType = target_type;
- mTargetObject = object;
- if (object)
- {
- mTargetOffsetGlobal.setVec(position);
- }
- else
- {
- mTargetOffsetGlobal = gAgent.getPosGlobalFromAgent(position);
- }
-
- mKillTime = mTimer.getElapsedTimeF32() + mDuration;
-
- //set up requisite animation data
- update();
- }
-
- return TRUE;
+ if (!mSourceObject)
+ {
+ return FALSE;
+ }
+
+ if (target_type >= POINTAT_NUM_TARGETS)
+ {
+ LL_WARNS() << "Bad target_type " << (int)target_type << " - ignoring." << LL_ENDL;
+ return FALSE;
+ }
+
+ // must be same or higher priority than existing effect
+ if (POINTAT_PRIORITIES[target_type] < POINTAT_PRIORITIES[mTargetType])
+ {
+ return FALSE;
+ }
+
+ F32 current_time = mTimer.getElapsedTimeF32();
+
+ // type of pointat behavior or target object has changed
+ BOOL targetTypeChanged = (target_type != mTargetType) ||
+ (object != mTargetObject);
+
+ BOOL targetPosChanged = (dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) &&
+ ((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC));
+
+ if (targetTypeChanged || targetPosChanged)
+ {
+ mLastSentOffsetGlobal = position;
+ setDuration(POINTAT_TIMEOUTS[target_type]);
+ setNeedsSendToSim(TRUE);
+// LL_INFOS() << "Sending pointat data" << LL_ENDL;
+ }
+
+ if (target_type == POINTAT_TARGET_CLEAR)
+ {
+ clearPointAtTarget();
+ }
+ else
+ {
+ mTargetType = target_type;
+ mTargetObject = object;
+ if (object)
+ {
+ mTargetOffsetGlobal.setVec(position);
+ }
+ else
+ {
+ mTargetOffsetGlobal = gAgent.getPosGlobalFromAgent(position);
+ }
+
+ mKillTime = mTimer.getElapsedTimeF32() + mDuration;
+
+ //set up requisite animation data
+ update();
+ }
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -286,9 +286,9 @@ BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *ob
//-----------------------------------------------------------------------------
void LLHUDEffectPointAt::clearPointAtTarget()
{
- mTargetObject = NULL;
- mTargetOffsetGlobal.clearVec();
- mTargetType = POINTAT_TARGET_NONE;
+ mTargetObject = NULL;
+ mTargetOffsetGlobal.clearVec();
+ mTargetType = POINTAT_TARGET_NONE;
}
//-----------------------------------------------------------------------------
@@ -296,22 +296,22 @@ void LLHUDEffectPointAt::clearPointAtTarget()
//-----------------------------------------------------------------------------
void LLHUDEffectPointAt::markDead()
{
- if (!mSourceObject.isNull() && mSourceObject->isAvatar())
- {
- ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->removeAnimationData("PointAtPoint");
- }
+ if (!mSourceObject.isNull() && mSourceObject->isAvatar())
+ {
+ ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->removeAnimationData("PointAtPoint");
+ }
- clearPointAtTarget();
- LLHUDEffect::markDead();
+ clearPointAtTarget();
+ LLHUDEffect::markDead();
}
void LLHUDEffectPointAt::setSourceObject(LLViewerObject* objectp)
{
- // restrict source objects to avatars
- if (objectp && objectp->isAvatar())
- {
- LLHUDEffect::setSourceObject(objectp);
- }
+ // restrict source objects to avatars
+ if (objectp && objectp->isAvatar())
+ {
+ LLHUDEffect::setSourceObject(objectp);
+ }
}
//-----------------------------------------------------------------------------
@@ -319,30 +319,30 @@ void LLHUDEffectPointAt::setSourceObject(LLViewerObject* objectp)
//-----------------------------------------------------------------------------
void LLHUDEffectPointAt::render()
{
- update();
- if (sDebugPointAt && mTargetType != POINTAT_TARGET_NONE)
- {
- //LLGLDisable gls_stencil(GL_STENCIL_TEST);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- LLVector3 target = mTargetPos + mSourceObject->getRenderPosition();
- gGL.pushMatrix();
- gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]);
- gGL.scalef(0.3f, 0.3f, 0.3f);
- gGL.begin(LLRender::LINES);
- {
- gGL.color3f(1.f, 0.f, 0.f);
- gGL.vertex3f(-1.f, 0.f, 0.f);
- gGL.vertex3f(1.f, 0.f, 0.f);
-
- gGL.vertex3f(0.f, -1.f, 0.f);
- gGL.vertex3f(0.f, 1.f, 0.f);
-
- gGL.vertex3f(0.f, 0.f, -1.f);
- gGL.vertex3f(0.f, 0.f, 1.f);
- } gGL.end();
- gGL.popMatrix();
- }
+ update();
+ if (sDebugPointAt && mTargetType != POINTAT_TARGET_NONE)
+ {
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ LLVector3 target = mTargetPos + mSourceObject->getRenderPosition();
+ gGL.pushMatrix();
+ gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]);
+ gGL.scalef(0.3f, 0.3f, 0.3f);
+ gGL.begin(LLRender::LINES);
+ {
+ gGL.color3f(1.f, 0.f, 0.f);
+ gGL.vertex3f(-1.f, 0.f, 0.f);
+ gGL.vertex3f(1.f, 0.f, 0.f);
+
+ gGL.vertex3f(0.f, -1.f, 0.f);
+ gGL.vertex3f(0.f, 1.f, 0.f);
+
+ gGL.vertex3f(0.f, 0.f, -1.f);
+ gGL.vertex3f(0.f, 0.f, 1.f);
+ } gGL.end();
+ gGL.popMatrix();
+ }
}
//-----------------------------------------------------------------------------
@@ -350,40 +350,40 @@ void LLHUDEffectPointAt::render()
//-----------------------------------------------------------------------------
void LLHUDEffectPointAt::update()
{
- // If the target object is dead, set the target object to NULL
- if (!mTargetObject.isNull() && mTargetObject->isDead())
- {
- clearPointAtTarget();
- }
-
- if (mSourceObject.isNull() || mSourceObject->isDead())
- {
- markDead();
- return;
- }
-
- F32 time = mTimer.getElapsedTimeF32();
-
- // clear out the effect if time is up
- if (mKillTime != 0.f && time > mKillTime)
- {
- mTargetType = POINTAT_TARGET_NONE;
- }
-
- if (mSourceObject->isAvatar())
- {
- if (mTargetType == POINTAT_TARGET_NONE)
- {
- ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->removeAnimationData("PointAtPoint");
- }
- else
- {
- if (calcTargetPosition())
- {
- ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_EDITING);
- }
- }
- }
+ // If the target object is dead, set the target object to NULL
+ if (!mTargetObject.isNull() && mTargetObject->isDead())
+ {
+ clearPointAtTarget();
+ }
+
+ if (mSourceObject.isNull() || mSourceObject->isDead())
+ {
+ markDead();
+ return;
+ }
+
+ F32 time = mTimer.getElapsedTimeF32();
+
+ // clear out the effect if time is up
+ if (mKillTime != 0.f && time > mKillTime)
+ {
+ mTargetType = POINTAT_TARGET_NONE;
+ }
+
+ if (mSourceObject->isAvatar())
+ {
+ if (mTargetType == POINTAT_TARGET_NONE)
+ {
+ ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->removeAnimationData("PointAtPoint");
+ }
+ else
+ {
+ if (calcTargetPosition())
+ {
+ ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_EDITING);
+ }
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -392,71 +392,71 @@ void LLHUDEffectPointAt::update()
//-----------------------------------------------------------------------------
bool LLHUDEffectPointAt::calcTargetPosition()
{
- LLViewerObject *targetObject = (LLViewerObject *)mTargetObject;
- LLVector3 local_offset;
-
- if (targetObject)
- {
- local_offset.setVec(mTargetOffsetGlobal);
- }
- else
- {
- local_offset = gAgent.getPosAgentFromGlobal(mTargetOffsetGlobal);
- }
-
- if (targetObject && targetObject->mDrawable.notNull())
- {
- LLQuaternion objRot;
- if (targetObject->isAvatar())
- {
- LLVOAvatar *avatarp = (LLVOAvatar *)targetObject;
- mTargetPos = avatarp->mHeadp->getWorldPosition();
- objRot = avatarp->mPelvisp->getWorldRotation();
- }
- else
- {
- if (targetObject->mDrawable->getGeneration() == -1)
- {
- mTargetPos = targetObject->getPositionAgent();
- objRot = targetObject->getWorldRotation();
- }
- else
- {
- mTargetPos = targetObject->getRenderPosition();
- objRot = targetObject->getRenderRotation();
- }
- }
-
- mTargetPos += (local_offset * objRot);
- }
- else
- {
- mTargetPos = local_offset;
- }
-
- mTargetPos -= mSourceObject->getRenderPosition();
-
- if (!llfinite(mTargetPos.lengthSquared()))
- {
- return false;
- }
-
- if (mSourceObject->isAvatar())
- {
- ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->setAnimationData("PointAtPoint", (void *)&mTargetPos);
- }
-
- return true;
+ LLViewerObject *targetObject = (LLViewerObject *)mTargetObject;
+ LLVector3 local_offset;
+
+ if (targetObject)
+ {
+ local_offset.setVec(mTargetOffsetGlobal);
+ }
+ else
+ {
+ local_offset = gAgent.getPosAgentFromGlobal(mTargetOffsetGlobal);
+ }
+
+ if (targetObject && targetObject->mDrawable.notNull())
+ {
+ LLQuaternion objRot;
+ if (targetObject->isAvatar())
+ {
+ LLVOAvatar *avatarp = (LLVOAvatar *)targetObject;
+ mTargetPos = avatarp->mHeadp->getWorldPosition();
+ objRot = avatarp->mPelvisp->getWorldRotation();
+ }
+ else
+ {
+ if (targetObject->mDrawable->getGeneration() == -1)
+ {
+ mTargetPos = targetObject->getPositionAgent();
+ objRot = targetObject->getWorldRotation();
+ }
+ else
+ {
+ mTargetPos = targetObject->getRenderPosition();
+ objRot = targetObject->getRenderRotation();
+ }
+ }
+
+ mTargetPos += (local_offset * objRot);
+ }
+ else
+ {
+ mTargetPos = local_offset;
+ }
+
+ mTargetPos -= mSourceObject->getRenderPosition();
+
+ if (!llfinite(mTargetPos.lengthSquared()))
+ {
+ return false;
+ }
+
+ if (mSourceObject->isAvatar())
+ {
+ ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->setAnimationData("PointAtPoint", (void *)&mTargetPos);
+ }
+
+ return true;
}
const LLVector3d LLHUDEffectPointAt::getPointAtPosGlobal()
{
- LLVector3d global_pos;
- global_pos.setVec(mTargetPos);
- if (mSourceObject.notNull())
- {
- global_pos += mSourceObject->getPositionGlobal();
- }
-
- return global_pos;
+ LLVector3d global_pos;
+ global_pos.setVec(mTargetPos);
+ if (mSourceObject.notNull())
+ {
+ global_pos += mSourceObject->getPositionGlobal();
+ }
+
+ return global_pos;
}
diff --git a/indra/newview/llhudeffectpointat.h b/indra/newview/llhudeffectpointat.h
index 6200b68cbc..501e2992e2 100644
--- a/indra/newview/llhudeffectpointat.h
+++ b/indra/newview/llhudeffectpointat.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffectpointat.h
* @brief LLHUDEffectPointAt class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,50 +35,50 @@ class LLVOAvatar;
typedef enum e_pointat_type
{
- POINTAT_TARGET_NONE,
- POINTAT_TARGET_SELECT,
- POINTAT_TARGET_GRAB,
- POINTAT_TARGET_CLEAR,
- POINTAT_NUM_TARGETS
+ POINTAT_TARGET_NONE,
+ POINTAT_TARGET_SELECT,
+ POINTAT_TARGET_GRAB,
+ POINTAT_TARGET_CLEAR,
+ POINTAT_NUM_TARGETS
} EPointAtType;
class LLHUDEffectPointAt : public LLHUDEffect
{
public:
- friend class LLHUDObject;
+ friend class LLHUDObject;
- /*virtual*/ void markDead();
- /*virtual*/ void setSourceObject(LLViewerObject* objectp);
+ /*virtual*/ void markDead();
+ /*virtual*/ void setSourceObject(LLViewerObject* objectp);
- BOOL setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position);
- void clearPointAtTarget();
+ BOOL setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position);
+ void clearPointAtTarget();
- EPointAtType getPointAtType() { return mTargetType; }
- const LLVector3& getPointAtPosAgent() { return mTargetPos; }
- const LLVector3d getPointAtPosGlobal();
+ EPointAtType getPointAtType() { return mTargetType; }
+ const LLVector3& getPointAtPosAgent() { return mTargetPos; }
+ const LLVector3d getPointAtPosGlobal();
protected:
- LLHUDEffectPointAt(const U8 type);
- ~LLHUDEffectPointAt();
+ LLHUDEffectPointAt(const U8 type);
+ ~LLHUDEffectPointAt();
- /*virtual*/ void render();
- /*virtual*/ void packData(LLMessageSystem *mesgsys);
- /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
+ /*virtual*/ void render();
+ /*virtual*/ void packData(LLMessageSystem *mesgsys);
+ /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
- // lookat behavior has either target position or target object with offset
- void setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset);
- void setTargetPosGlobal(const LLVector3d &target_pos_global);
- bool calcTargetPosition();
- void update();
+ // lookat behavior has either target position or target object with offset
+ void setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset);
+ void setTargetPosGlobal(const LLVector3d &target_pos_global);
+ bool calcTargetPosition();
+ void update();
public:
- static BOOL sDebugPointAt;
+ static BOOL sDebugPointAt;
private:
- EPointAtType mTargetType;
- LLVector3d mTargetOffsetGlobal;
- LLVector3 mLastSentOffsetGlobal;
- F32 mKillTime;
- LLFrameTimer mTimer;
- LLVector3 mTargetPos;
- F32 mLastSendTime;
+ EPointAtType mTargetType;
+ LLVector3d mTargetOffsetGlobal;
+ LLVector3 mLastSentOffsetGlobal;
+ F32 mKillTime;
+ LLFrameTimer mTimer;
+ LLVector3 mTargetPos;
+ F32 mLastSendTime;
};
#endif // LL_LLHUDEFFECTPOINTAT_H
diff --git a/indra/newview/llhudeffecttrail.cpp b/indra/newview/llhudeffecttrail.cpp
index 2ba8aa422b..ebdb15746b 100644
--- a/indra/newview/llhudeffecttrail.cpp
+++ b/indra/newview/llhudeffecttrail.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffecttrail.cpp
* @brief LLHUDEffectSpiral class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,20 +44,20 @@
LLHUDEffectSpiral::LLHUDEffectSpiral(const U8 type) : LLHUDEffect(type), mbInit(FALSE)
{
- mKillTime = 10.f;
- mVMag = 1.f;
- mVOffset = 0.f;
- mInitialRadius = 1.f;
- mFinalRadius = 1.f;
- mSpinRate = 10.f;
- mFlickerRate = 50.f;
- mScaleBase = 0.1f;
- mScaleVar = 0.f;
+ mKillTime = 10.f;
+ mVMag = 1.f;
+ mVOffset = 0.f;
+ mInitialRadius = 1.f;
+ mFinalRadius = 1.f;
+ mSpinRate = 10.f;
+ mFlickerRate = 50.f;
+ mScaleBase = 0.1f;
+ mScaleVar = 0.f;
- mFadeInterp.setStartTime(0.f);
- mFadeInterp.setEndTime(mKillTime);
- mFadeInterp.setStartVal(1.f);
- mFadeInterp.setEndVal(1.f);
+ mFadeInterp.setStartTime(0.f);
+ mFadeInterp.setEndTime(mKillTime);
+ mFadeInterp.setStartVal(1.f);
+ mFadeInterp.setEndVal(1.f);
}
LLHUDEffectSpiral::~LLHUDEffectSpiral()
@@ -66,215 +66,215 @@ LLHUDEffectSpiral::~LLHUDEffectSpiral()
void LLHUDEffectSpiral::markDead()
{
- if (mPartSourcep)
- {
- mPartSourcep->setDead();
- mPartSourcep = NULL;
- }
- LLHUDEffect::markDead();
+ if (mPartSourcep)
+ {
+ mPartSourcep->setDead();
+ mPartSourcep = NULL;
+ }
+ LLHUDEffect::markDead();
}
void LLHUDEffectSpiral::packData(LLMessageSystem *mesgsys)
{
- if (!mSourceObject)
- {
- //LL_WARNS() << "Missing object in trail pack!" << LL_ENDL;
- }
- LLHUDEffect::packData(mesgsys);
+ if (!mSourceObject)
+ {
+ //LL_WARNS() << "Missing object in trail pack!" << LL_ENDL;
+ }
+ LLHUDEffect::packData(mesgsys);
- U8 packed_data[56];
- memset(packed_data, 0, 56);
+ U8 packed_data[56];
+ memset(packed_data, 0, 56);
- if (mSourceObject)
- {
- htolememcpy(packed_data, mSourceObject->mID.mData, MVT_LLUUID, 16);
- }
- if (mTargetObject)
- {
- htolememcpy(packed_data + 16, mTargetObject->mID.mData, MVT_LLUUID, 16);
- }
- if (!mPositionGlobal.isExactlyZero())
- {
- htolememcpy(packed_data + 32, mPositionGlobal.mdV, MVT_LLVector3d, 24);
- }
- mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, 56);
+ if (mSourceObject)
+ {
+ htolememcpy(packed_data, mSourceObject->mID.mData, MVT_LLUUID, 16);
+ }
+ if (mTargetObject)
+ {
+ htolememcpy(packed_data + 16, mTargetObject->mID.mData, MVT_LLUUID, 16);
+ }
+ if (!mPositionGlobal.isExactlyZero())
+ {
+ htolememcpy(packed_data + 32, mPositionGlobal.mdV, MVT_LLVector3d, 24);
+ }
+ mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, 56);
}
void LLHUDEffectSpiral::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
{
- const size_t EFFECT_SIZE = 56;
- U8 packed_data[EFFECT_SIZE];
+ const size_t EFFECT_SIZE = 56;
+ U8 packed_data[EFFECT_SIZE];
+
+ LLHUDEffect::unpackData(mesgsys, blocknum);
+ LLUUID object_id, target_object_id;
+ size_t size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
+ if (size != EFFECT_SIZE)
+ {
+ LL_WARNS() << "Spiral effect with bad size " << size << LL_ENDL;
+ return;
+ }
+ mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData,
+ packed_data, EFFECT_SIZE, blocknum, EFFECT_SIZE);
- LLHUDEffect::unpackData(mesgsys, blocknum);
- LLUUID object_id, target_object_id;
- size_t size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
- if (size != EFFECT_SIZE)
- {
- LL_WARNS() << "Spiral effect with bad size " << size << LL_ENDL;
- return;
- }
- mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData,
- packed_data, EFFECT_SIZE, blocknum, EFFECT_SIZE);
-
- htolememcpy(object_id.mData, packed_data, MVT_LLUUID, 16);
- htolememcpy(target_object_id.mData, packed_data + 16, MVT_LLUUID, 16);
- htolememcpy(mPositionGlobal.mdV, packed_data + 32, MVT_LLVector3d, 24);
+ htolememcpy(object_id.mData, packed_data, MVT_LLUUID, 16);
+ htolememcpy(target_object_id.mData, packed_data + 16, MVT_LLUUID, 16);
+ htolememcpy(mPositionGlobal.mdV, packed_data + 32, MVT_LLVector3d, 24);
- LLViewerObject *objp = NULL;
+ LLViewerObject *objp = NULL;
- if (object_id.isNull())
- {
- setSourceObject(NULL);
- }
- else
- {
- LLViewerObject *objp = gObjectList.findObject(object_id);
- if (objp)
- {
- setSourceObject(objp);
- }
- else
- {
- // We don't have this object, kill this effect
- markDead();
- return;
- }
- }
+ if (object_id.isNull())
+ {
+ setSourceObject(NULL);
+ }
+ else
+ {
+ LLViewerObject *objp = gObjectList.findObject(object_id);
+ if (objp)
+ {
+ setSourceObject(objp);
+ }
+ else
+ {
+ // We don't have this object, kill this effect
+ markDead();
+ return;
+ }
+ }
- if (target_object_id.isNull())
- {
- setTargetObject(NULL);
- }
- else
- {
- objp = gObjectList.findObject(target_object_id);
- if (objp)
- {
- setTargetObject(objp);
- }
- else
- {
- // We don't have this object, kill this effect
- markDead();
- return;
- }
- }
+ if (target_object_id.isNull())
+ {
+ setTargetObject(NULL);
+ }
+ else
+ {
+ objp = gObjectList.findObject(target_object_id);
+ if (objp)
+ {
+ setTargetObject(objp);
+ }
+ else
+ {
+ // We don't have this object, kill this effect
+ markDead();
+ return;
+ }
+ }
- triggerLocal();
+ triggerLocal();
}
void LLHUDEffectSpiral::triggerLocal()
{
- mKillTime = mTimer.getElapsedTimeF32() + mDuration;
+ mKillTime = mTimer.getElapsedTimeF32() + mDuration;
- BOOL show_beam = gSavedSettings.getBOOL("ShowSelectionBeam");
+ BOOL show_beam = gSavedSettings.getBOOL("ShowSelectionBeam");
- LLColor4 color;
- color.setVec(mColor);
+ LLColor4 color;
+ color.setVec(mColor);
- if (!mPartSourcep)
- {
- if (!mTargetObject.isNull() && !mSourceObject.isNull())
- {
- if (show_beam)
- {
- LLPointer<LLViewerPartSourceBeam> psb = new LLViewerPartSourceBeam;
- psb->setColor(color);
- psb->setSourceObject(mSourceObject);
- psb->setTargetObject(mTargetObject);
- psb->setOwnerUUID(gAgent.getID());
- LLViewerPartSim::getInstance()->addPartSource(psb);
- mPartSourcep = psb;
- }
- }
- else
- {
- if (!mSourceObject.isNull() && !mPositionGlobal.isExactlyZero())
- {
- if (show_beam)
- {
- LLPointer<LLViewerPartSourceBeam> psb = new LLViewerPartSourceBeam;
- psb->setSourceObject(mSourceObject);
- psb->setTargetObject(NULL);
- psb->setColor(color);
- psb->mLKGTargetPosGlobal = mPositionGlobal;
- psb->setOwnerUUID(gAgent.getID());
- LLViewerPartSim::getInstance()->addPartSource(psb);
- mPartSourcep = psb;
- }
- }
- else
- {
- LLVector3 pos;
- if (mSourceObject)
- {
- pos = mSourceObject->getPositionAgent();
- }
- else
- {
- pos = gAgent.getPosAgentFromGlobal(mPositionGlobal);
- }
- LLPointer<LLViewerPartSourceSpiral> pss = new LLViewerPartSourceSpiral(pos);
- if (!mSourceObject.isNull())
- {
- pss->setSourceObject(mSourceObject);
- }
- pss->setColor(color);
- pss->setOwnerUUID(gAgent.getID());
- LLViewerPartSim::getInstance()->addPartSource(pss);
- mPartSourcep = pss;
- }
- }
- }
- else
- {
- LLPointer<LLViewerPartSource>& ps = mPartSourcep;
- if (mPartSourcep->getType() == LLViewerPartSource::LL_PART_SOURCE_BEAM)
- {
- LLViewerPartSourceBeam *psb = (LLViewerPartSourceBeam *)ps.get();
- psb->setSourceObject(mSourceObject);
- psb->setTargetObject(mTargetObject);
- psb->setColor(color);
- if (mTargetObject.isNull())
- {
- psb->mLKGTargetPosGlobal = mPositionGlobal;
- }
- }
- else
- {
- LLViewerPartSourceSpiral *pss = (LLViewerPartSourceSpiral *)ps.get();
- pss->setSourceObject(mSourceObject);
- }
- }
+ if (!mPartSourcep)
+ {
+ if (!mTargetObject.isNull() && !mSourceObject.isNull())
+ {
+ if (show_beam)
+ {
+ LLPointer<LLViewerPartSourceBeam> psb = new LLViewerPartSourceBeam;
+ psb->setColor(color);
+ psb->setSourceObject(mSourceObject);
+ psb->setTargetObject(mTargetObject);
+ psb->setOwnerUUID(gAgent.getID());
+ LLViewerPartSim::getInstance()->addPartSource(psb);
+ mPartSourcep = psb;
+ }
+ }
+ else
+ {
+ if (!mSourceObject.isNull() && !mPositionGlobal.isExactlyZero())
+ {
+ if (show_beam)
+ {
+ LLPointer<LLViewerPartSourceBeam> psb = new LLViewerPartSourceBeam;
+ psb->setSourceObject(mSourceObject);
+ psb->setTargetObject(NULL);
+ psb->setColor(color);
+ psb->mLKGTargetPosGlobal = mPositionGlobal;
+ psb->setOwnerUUID(gAgent.getID());
+ LLViewerPartSim::getInstance()->addPartSource(psb);
+ mPartSourcep = psb;
+ }
+ }
+ else
+ {
+ LLVector3 pos;
+ if (mSourceObject)
+ {
+ pos = mSourceObject->getPositionAgent();
+ }
+ else
+ {
+ pos = gAgent.getPosAgentFromGlobal(mPositionGlobal);
+ }
+ LLPointer<LLViewerPartSourceSpiral> pss = new LLViewerPartSourceSpiral(pos);
+ if (!mSourceObject.isNull())
+ {
+ pss->setSourceObject(mSourceObject);
+ }
+ pss->setColor(color);
+ pss->setOwnerUUID(gAgent.getID());
+ LLViewerPartSim::getInstance()->addPartSource(pss);
+ mPartSourcep = pss;
+ }
+ }
+ }
+ else
+ {
+ LLPointer<LLViewerPartSource>& ps = mPartSourcep;
+ if (mPartSourcep->getType() == LLViewerPartSource::LL_PART_SOURCE_BEAM)
+ {
+ LLViewerPartSourceBeam *psb = (LLViewerPartSourceBeam *)ps.get();
+ psb->setSourceObject(mSourceObject);
+ psb->setTargetObject(mTargetObject);
+ psb->setColor(color);
+ if (mTargetObject.isNull())
+ {
+ psb->mLKGTargetPosGlobal = mPositionGlobal;
+ }
+ }
+ else
+ {
+ LLViewerPartSourceSpiral *pss = (LLViewerPartSourceSpiral *)ps.get();
+ pss->setSourceObject(mSourceObject);
+ }
+ }
- mbInit = TRUE;
+ mbInit = TRUE;
}
void LLHUDEffectSpiral::setTargetObject(LLViewerObject *objp)
{
- if (objp == mTargetObject)
- {
- return;
- }
+ if (objp == mTargetObject)
+ {
+ return;
+ }
- mTargetObject = objp;
+ mTargetObject = objp;
}
void LLHUDEffectSpiral::render()
{
- F32 time = mTimer.getElapsedTimeF32();
+ F32 time = mTimer.getElapsedTimeF32();
- if ((!mSourceObject.isNull() && mSourceObject->isDead()) ||
- (!mTargetObject.isNull() && mTargetObject->isDead()) ||
- mKillTime < time ||
- (!mPartSourcep.isNull() && !gSavedSettings.getBOOL("ShowSelectionBeam")) )
- {
- markDead();
- return;
- }
+ if ((!mSourceObject.isNull() && mSourceObject->isDead()) ||
+ (!mTargetObject.isNull() && mTargetObject->isDead()) ||
+ mKillTime < time ||
+ (!mPartSourcep.isNull() && !gSavedSettings.getBOOL("ShowSelectionBeam")) )
+ {
+ markDead();
+ return;
+ }
}
void LLHUDEffectSpiral::renderForTimer()
{
- render();
+ render();
}
diff --git a/indra/newview/llhudeffecttrail.h b/indra/newview/llhudeffecttrail.h
index 6f5a328c63..39418ccef0 100644
--- a/indra/newview/llhudeffecttrail.h
+++ b/indra/newview/llhudeffecttrail.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudeffecttrail.h
* @brief LLHUDEffectSpiral class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,54 +42,54 @@ const U32 NUM_TRAIL_POINTS = 40;
class LLHUDEffectSpiral : public LLHUDEffect
{
public:
- /*virtual*/ void markDead();
- /*virtual*/ void setTargetObject(LLViewerObject* objectp);
- void setVMag(F32 vmag) { mVMag = vmag; }
- void setVOffset(F32 offset) { mVOffset = offset; }
- void setInitialRadius(F32 radius) { mInitialRadius = radius; }
- void setFinalRadius(F32 radius) { mFinalRadius = radius; }
- void setScaleBase(F32 scale) { mScaleBase = scale; }
- void setScaleVar(F32 scale) { mScaleVar = scale; }
- void setSpinRate(F32 rate) { mSpinRate = rate; }
- void setFlickerRate(F32 rate) { mFlickerRate = rate; }
-
- // Start the effect playing locally.
- void triggerLocal();
-
- friend class LLHUDObject;
+ /*virtual*/ void markDead();
+ /*virtual*/ void setTargetObject(LLViewerObject* objectp);
+ void setVMag(F32 vmag) { mVMag = vmag; }
+ void setVOffset(F32 offset) { mVOffset = offset; }
+ void setInitialRadius(F32 radius) { mInitialRadius = radius; }
+ void setFinalRadius(F32 radius) { mFinalRadius = radius; }
+ void setScaleBase(F32 scale) { mScaleBase = scale; }
+ void setScaleVar(F32 scale) { mScaleVar = scale; }
+ void setSpinRate(F32 rate) { mSpinRate = rate; }
+ void setFlickerRate(F32 rate) { mFlickerRate = rate; }
+
+ // Start the effect playing locally.
+ void triggerLocal();
+
+ friend class LLHUDObject;
protected:
- LLHUDEffectSpiral(const U8 type);
- ~LLHUDEffectSpiral();
+ LLHUDEffectSpiral(const U8 type);
+ ~LLHUDEffectSpiral();
- /*virtual*/ void render();
- /*virtual*/ void renderForTimer();
- /*virtual*/ void packData(LLMessageSystem *mesgsys);
- /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
+ /*virtual*/ void render();
+ /*virtual*/ void renderForTimer();
+ /*virtual*/ void packData(LLMessageSystem *mesgsys);
+ /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
private:
- /*
- void setupParticle(const S32 i, const F32 start_time);
-
-
- LLInterpExp<F32> mRadius[NUM_TRAIL_POINTS];
- LLInterpLinear<LLVector3d> mDistance[NUM_TRAIL_POINTS];
- LLInterpLinear<F32> mScale[NUM_TRAIL_POINTS];
- F32 mOffset[NUM_TRAIL_POINTS];
- */
-
- BOOL mbInit;
- LLPointer<LLViewerPartSource> mPartSourcep;
-
- F32 mKillTime;
- F32 mVMag;
- F32 mVOffset;
- F32 mInitialRadius;
- F32 mFinalRadius;
- F32 mSpinRate;
- F32 mFlickerRate;
- F32 mScaleBase;
- F32 mScaleVar;
- LLFrameTimer mTimer;
- LLInterpLinear<F32> mFadeInterp;
+ /*
+ void setupParticle(const S32 i, const F32 start_time);
+
+
+ LLInterpExp<F32> mRadius[NUM_TRAIL_POINTS];
+ LLInterpLinear<LLVector3d> mDistance[NUM_TRAIL_POINTS];
+ LLInterpLinear<F32> mScale[NUM_TRAIL_POINTS];
+ F32 mOffset[NUM_TRAIL_POINTS];
+ */
+
+ BOOL mbInit;
+ LLPointer<LLViewerPartSource> mPartSourcep;
+
+ F32 mKillTime;
+ F32 mVMag;
+ F32 mVOffset;
+ F32 mInitialRadius;
+ F32 mFinalRadius;
+ F32 mSpinRate;
+ F32 mFlickerRate;
+ F32 mScaleBase;
+ F32 mScaleVar;
+ LLFrameTimer mTimer;
+ LLInterpLinear<F32> mFadeInterp;
};
#endif // LL_LLHUDEFFECTGLOW_H
diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp
index 38be2b69fd..dfff6c1dc4 100644
--- a/indra/newview/llhudicon.cpp
+++ b/indra/newview/llhudicon.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudicon.cpp
* @brief LLHUDIcon class implementation
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,7 +52,7 @@ const F32 FADE_OUT_TIME = 1.f;
//-----------------------------------------------------------------------------
static F32 calc_bouncy_animation(F32 x)
{
- return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f;
+ return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f;
}
@@ -62,287 +62,287 @@ static F32 calc_bouncy_animation(F32 x)
LLHUDIcon::icon_instance_t LLHUDIcon::sIconInstances;
LLHUDIcon::LLHUDIcon(const U8 type) :
- LLHUDObject(type),
- mImagep(NULL),
- mScale(0.1f),
- mHidden(FALSE)
+ LLHUDObject(type),
+ mImagep(NULL),
+ mScale(0.1f),
+ mHidden(FALSE)
{
- sIconInstances.push_back(this);
+ sIconInstances.push_back(this);
}
LLHUDIcon::~LLHUDIcon()
{
- mImagep = NULL;
+ mImagep = NULL;
}
void LLHUDIcon::render()
{
- LLGLSUIDefault texture_state;
- LLGLDepthTest gls_depth(GL_TRUE);
- //LLGLDisable gls_stencil(GL_STENCIL_TEST);
-
- if (mHidden)
- return;
-
- if (mSourceObject.isNull() || mImagep.isNull())
- {
- markDead();
- return;
- }
-
- LLVector3 obj_position = mSourceObject->getRenderPosition();
-
- // put icon above object, and in front
- // RN: don't use drawable radius, it's fricking HUGE
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- LLVector3 icon_relative_pos = (camera->getUpAxis() * ~mSourceObject->getRenderRotation());
- icon_relative_pos.abs();
-
- F32 distance_scale = llmin(mSourceObject->getScale().mV[VX] / icon_relative_pos.mV[VX],
- mSourceObject->getScale().mV[VY] / icon_relative_pos.mV[VY],
- mSourceObject->getScale().mV[VZ] / icon_relative_pos.mV[VZ]);
- F32 up_distance = 0.5f * distance_scale;
- LLVector3 icon_position = obj_position + (up_distance * camera->getUpAxis()) * 1.2f;
-
- LLVector3 icon_to_cam = LLViewerCamera::getInstance()->getOrigin() - icon_position;
- icon_to_cam.normVec();
-
- icon_position += icon_to_cam * mSourceObject->mDrawable->getRadius() * 1.1f;
-
- mDistance = dist_vec(icon_position, camera->getOrigin());
-
- F32 alpha_factor = clamp_rescale(mDistance, DIST_START_FADE, DIST_END_FADE, 1.f, 0.f);
-
- LLVector3 x_pixel_vec;
- LLVector3 y_pixel_vec;
-
- camera->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec);
-
- F32 scale_factor = 1.f;
- if (mAnimTimer.getElapsedTimeF32() < ANIM_TIME)
- {
- scale_factor = llmax(0.f, calc_bouncy_animation(mAnimTimer.getElapsedTimeF32() / ANIM_TIME));
- }
-
- F32 time_elapsed = mLifeTimer.getElapsedTimeF32();
- if (time_elapsed > MAX_VISIBLE_TIME)
- {
- markDead();
- return;
- }
-
- if (time_elapsed > MAX_VISIBLE_TIME - FADE_OUT_TIME)
- {
- alpha_factor *= clamp_rescale(time_elapsed, MAX_VISIBLE_TIME - FADE_OUT_TIME, MAX_VISIBLE_TIME, 1.f, 0.f);
- }
-
- F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight() ;
- LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * x_pixel_vec;
- LLVector3 y_scale = (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * y_pixel_vec;
-
- LLVector3 lower_left = icon_position - (x_scale * 0.5f);
- LLVector3 lower_right = icon_position + (x_scale * 0.5f);
- LLVector3 upper_left = icon_position - (x_scale * 0.5f) + y_scale;
- LLVector3 upper_right = icon_position + (x_scale * 0.5f) + y_scale;
-
- {
- LLColor4 icon_color = LLColor4::white;
- icon_color.mV[VALPHA] = alpha_factor;
- gGL.color4fv(icon_color.mV);
- gGL.getTexUnit(0)->bind(mImagep);
- }
-
- gGL.begin(LLRender::QUADS);
- {
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex3fv(upper_left.mV);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex3fv(lower_left.mV);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex3fv(lower_right.mV);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex3fv(upper_right.mV);
- }
- gGL.end();
+ LLGLSUIDefault texture_state;
+ LLGLDepthTest gls_depth(GL_TRUE);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
+
+ if (mHidden)
+ return;
+
+ if (mSourceObject.isNull() || mImagep.isNull())
+ {
+ markDead();
+ return;
+ }
+
+ LLVector3 obj_position = mSourceObject->getRenderPosition();
+
+ // put icon above object, and in front
+ // RN: don't use drawable radius, it's fricking HUGE
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ LLVector3 icon_relative_pos = (camera->getUpAxis() * ~mSourceObject->getRenderRotation());
+ icon_relative_pos.abs();
+
+ F32 distance_scale = llmin(mSourceObject->getScale().mV[VX] / icon_relative_pos.mV[VX],
+ mSourceObject->getScale().mV[VY] / icon_relative_pos.mV[VY],
+ mSourceObject->getScale().mV[VZ] / icon_relative_pos.mV[VZ]);
+ F32 up_distance = 0.5f * distance_scale;
+ LLVector3 icon_position = obj_position + (up_distance * camera->getUpAxis()) * 1.2f;
+
+ LLVector3 icon_to_cam = LLViewerCamera::getInstance()->getOrigin() - icon_position;
+ icon_to_cam.normVec();
+
+ icon_position += icon_to_cam * mSourceObject->mDrawable->getRadius() * 1.1f;
+
+ mDistance = dist_vec(icon_position, camera->getOrigin());
+
+ F32 alpha_factor = clamp_rescale(mDistance, DIST_START_FADE, DIST_END_FADE, 1.f, 0.f);
+
+ LLVector3 x_pixel_vec;
+ LLVector3 y_pixel_vec;
+
+ camera->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec);
+
+ F32 scale_factor = 1.f;
+ if (mAnimTimer.getElapsedTimeF32() < ANIM_TIME)
+ {
+ scale_factor = llmax(0.f, calc_bouncy_animation(mAnimTimer.getElapsedTimeF32() / ANIM_TIME));
+ }
+
+ F32 time_elapsed = mLifeTimer.getElapsedTimeF32();
+ if (time_elapsed > MAX_VISIBLE_TIME)
+ {
+ markDead();
+ return;
+ }
+
+ if (time_elapsed > MAX_VISIBLE_TIME - FADE_OUT_TIME)
+ {
+ alpha_factor *= clamp_rescale(time_elapsed, MAX_VISIBLE_TIME - FADE_OUT_TIME, MAX_VISIBLE_TIME, 1.f, 0.f);
+ }
+
+ F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight() ;
+ LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * x_pixel_vec;
+ LLVector3 y_scale = (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * y_pixel_vec;
+
+ LLVector3 lower_left = icon_position - (x_scale * 0.5f);
+ LLVector3 lower_right = icon_position + (x_scale * 0.5f);
+ LLVector3 upper_left = icon_position - (x_scale * 0.5f) + y_scale;
+ LLVector3 upper_right = icon_position + (x_scale * 0.5f) + y_scale;
+
+ {
+ LLColor4 icon_color = LLColor4::white;
+ icon_color.mV[VALPHA] = alpha_factor;
+ gGL.color4fv(icon_color.mV);
+ gGL.getTexUnit(0)->bind(mImagep);
+ }
+
+ gGL.begin(LLRender::QUADS);
+ {
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3fv(upper_left.mV);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3fv(lower_left.mV);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3fv(lower_right.mV);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3fv(upper_right.mV);
+ }
+ gGL.end();
}
void LLHUDIcon::setImage(LLViewerTexture* imagep)
{
- mImagep = imagep;
- mImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
+ mImagep = imagep;
+ mImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
}
void LLHUDIcon::setScale(F32 fraction_of_fov)
{
- mScale = fraction_of_fov;
+ mScale = fraction_of_fov;
}
void LLHUDIcon::markDead()
{
- if (mSourceObject)
- {
- mSourceObject->clearIcon();
- }
- LLHUDObject::markDead();
+ if (mSourceObject)
+ {
+ mSourceObject->clearIcon();
+ }
+ LLHUDObject::markDead();
}
BOOL LLHUDIcon::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection)
{
- if (mHidden)
- return FALSE;
-
- if (mSourceObject.isNull() || mImagep.isNull())
- {
- markDead();
- return FALSE;
- }
-
- LLVector3 obj_position = mSourceObject->getRenderPosition();
-
- // put icon above object, and in front
- // RN: don't use drawable radius, it's fricking HUGE
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- LLVector3 icon_relative_pos = (camera->getUpAxis() * ~mSourceObject->getRenderRotation());
- icon_relative_pos.abs();
-
- F32 distance_scale = llmin(mSourceObject->getScale().mV[VX] / icon_relative_pos.mV[VX],
- mSourceObject->getScale().mV[VY] / icon_relative_pos.mV[VY],
- mSourceObject->getScale().mV[VZ] / icon_relative_pos.mV[VZ]);
- F32 up_distance = 0.5f * distance_scale;
- LLVector3 icon_position = obj_position + (up_distance * camera->getUpAxis()) * 1.2f;
-
- LLVector3 icon_to_cam = LLViewerCamera::getInstance()->getOrigin() - icon_position;
- icon_to_cam.normVec();
-
- icon_position += icon_to_cam * mSourceObject->mDrawable->getRadius() * 1.1f;
-
- mDistance = dist_vec(icon_position, camera->getOrigin());
-
- LLVector3 x_pixel_vec;
- LLVector3 y_pixel_vec;
-
- camera->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec);
-
- F32 scale_factor = 1.f;
- if (mAnimTimer.getElapsedTimeF32() < ANIM_TIME)
- {
- scale_factor = llmax(0.f, calc_bouncy_animation(mAnimTimer.getElapsedTimeF32() / ANIM_TIME));
- }
-
- F32 time_elapsed = mLifeTimer.getElapsedTimeF32();
- if (time_elapsed > MAX_VISIBLE_TIME)
- {
- markDead();
- return FALSE;
- }
-
- F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight() ;
- LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * x_pixel_vec;
- LLVector3 y_scale = (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * y_pixel_vec;
-
- LLVector4a x_scalea;
- LLVector4a icon_positiona;
- LLVector4a y_scalea;
-
- x_scalea.load3(x_scale.mV);
- x_scalea.mul(0.5f);
- y_scalea.load3(y_scale.mV);
-
- icon_positiona.load3(icon_position.mV);
-
- LLVector4a lower_left;
- lower_left.setSub(icon_positiona, x_scalea);
- LLVector4a lower_right;
- lower_right.setAdd(icon_positiona, x_scalea);
- LLVector4a upper_left;
- upper_left.setAdd(lower_left, y_scalea);
- LLVector4a upper_right;
- upper_right.setAdd(lower_right, y_scalea);
-
- LLVector4a dir;
- dir.setSub(end, start);
-
- F32 a,b,t;
-
- if (LLTriangleRayIntersect(upper_right, upper_left, lower_right, start, dir, a,b,t) ||
- LLTriangleRayIntersect(upper_left, lower_left, lower_right, start, dir, a,b,t))
- {
- if (intersection)
- {
- dir.mul(t);
- intersection->setAdd(start, dir);
- }
- return TRUE;
- }
-
- return FALSE;
+ if (mHidden)
+ return FALSE;
+
+ if (mSourceObject.isNull() || mImagep.isNull())
+ {
+ markDead();
+ return FALSE;
+ }
+
+ LLVector3 obj_position = mSourceObject->getRenderPosition();
+
+ // put icon above object, and in front
+ // RN: don't use drawable radius, it's fricking HUGE
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ LLVector3 icon_relative_pos = (camera->getUpAxis() * ~mSourceObject->getRenderRotation());
+ icon_relative_pos.abs();
+
+ F32 distance_scale = llmin(mSourceObject->getScale().mV[VX] / icon_relative_pos.mV[VX],
+ mSourceObject->getScale().mV[VY] / icon_relative_pos.mV[VY],
+ mSourceObject->getScale().mV[VZ] / icon_relative_pos.mV[VZ]);
+ F32 up_distance = 0.5f * distance_scale;
+ LLVector3 icon_position = obj_position + (up_distance * camera->getUpAxis()) * 1.2f;
+
+ LLVector3 icon_to_cam = LLViewerCamera::getInstance()->getOrigin() - icon_position;
+ icon_to_cam.normVec();
+
+ icon_position += icon_to_cam * mSourceObject->mDrawable->getRadius() * 1.1f;
+
+ mDistance = dist_vec(icon_position, camera->getOrigin());
+
+ LLVector3 x_pixel_vec;
+ LLVector3 y_pixel_vec;
+
+ camera->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec);
+
+ F32 scale_factor = 1.f;
+ if (mAnimTimer.getElapsedTimeF32() < ANIM_TIME)
+ {
+ scale_factor = llmax(0.f, calc_bouncy_animation(mAnimTimer.getElapsedTimeF32() / ANIM_TIME));
+ }
+
+ F32 time_elapsed = mLifeTimer.getElapsedTimeF32();
+ if (time_elapsed > MAX_VISIBLE_TIME)
+ {
+ markDead();
+ return FALSE;
+ }
+
+ F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight() ;
+ LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * x_pixel_vec;
+ LLVector3 y_scale = (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * y_pixel_vec;
+
+ LLVector4a x_scalea;
+ LLVector4a icon_positiona;
+ LLVector4a y_scalea;
+
+ x_scalea.load3(x_scale.mV);
+ x_scalea.mul(0.5f);
+ y_scalea.load3(y_scale.mV);
+
+ icon_positiona.load3(icon_position.mV);
+
+ LLVector4a lower_left;
+ lower_left.setSub(icon_positiona, x_scalea);
+ LLVector4a lower_right;
+ lower_right.setAdd(icon_positiona, x_scalea);
+ LLVector4a upper_left;
+ upper_left.setAdd(lower_left, y_scalea);
+ LLVector4a upper_right;
+ upper_right.setAdd(lower_right, y_scalea);
+
+ LLVector4a dir;
+ dir.setSub(end, start);
+
+ F32 a,b,t;
+
+ if (LLTriangleRayIntersect(upper_right, upper_left, lower_right, start, dir, a,b,t) ||
+ LLTriangleRayIntersect(upper_left, lower_left, lower_right, start, dir, a,b,t))
+ {
+ if (intersection)
+ {
+ dir.mul(t);
+ intersection->setAdd(start, dir);
+ }
+ return TRUE;
+ }
+
+ return FALSE;
}
//static
LLHUDIcon* LLHUDIcon::lineSegmentIntersectAll(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection)
{
- icon_instance_t::iterator icon_it;
-
- LLVector4a local_end = end;
- LLVector4a position;
-
- LLHUDIcon* ret = NULL;
- for(icon_it = sIconInstances.begin(); icon_it != sIconInstances.end(); ++icon_it)
- {
- LLHUDIcon* icon = *icon_it;
- if (icon->lineSegmentIntersect(start, local_end, &position))
- {
- ret = icon;
- if (intersection)
- {
- *intersection = position;
- }
- local_end = position;
- }
- }
-
- return ret;
+ icon_instance_t::iterator icon_it;
+
+ LLVector4a local_end = end;
+ LLVector4a position;
+
+ LLHUDIcon* ret = NULL;
+ for(icon_it = sIconInstances.begin(); icon_it != sIconInstances.end(); ++icon_it)
+ {
+ LLHUDIcon* icon = *icon_it;
+ if (icon->lineSegmentIntersect(start, local_end, &position))
+ {
+ ret = icon;
+ if (intersection)
+ {
+ *intersection = position;
+ }
+ local_end = position;
+ }
+ }
+
+ return ret;
}
//static
void LLHUDIcon::updateAll()
{
- cleanupDeadIcons();
+ cleanupDeadIcons();
}
//static
BOOL LLHUDIcon::iconsNearby()
{
- return !sIconInstances.empty();
+ return !sIconInstances.empty();
}
//static
void LLHUDIcon::cleanupDeadIcons()
{
- icon_instance_t::iterator icon_it;
-
- icon_instance_t icons_to_erase;
- for(icon_it = sIconInstances.begin(); icon_it != sIconInstances.end(); ++icon_it)
- {
- if ((*icon_it)->mDead)
- {
- icons_to_erase.push_back(*icon_it);
- }
- }
-
- for(icon_it = icons_to_erase.begin(); icon_it != icons_to_erase.end(); ++icon_it)
- {
- icon_instance_t::iterator found_it = std::find(sIconInstances.begin(), sIconInstances.end(), *icon_it);
- if (found_it != sIconInstances.end())
- {
- sIconInstances.erase(found_it);
- }
- }
+ icon_instance_t::iterator icon_it;
+
+ icon_instance_t icons_to_erase;
+ for(icon_it = sIconInstances.begin(); icon_it != sIconInstances.end(); ++icon_it)
+ {
+ if ((*icon_it)->mDead)
+ {
+ icons_to_erase.push_back(*icon_it);
+ }
+ }
+
+ for(icon_it = icons_to_erase.begin(); icon_it != icons_to_erase.end(); ++icon_it)
+ {
+ icon_instance_t::iterator found_it = std::find(sIconInstances.begin(), sIconInstances.end(), *icon_it);
+ if (found_it != sIconInstances.end())
+ {
+ sIconInstances.erase(found_it);
+ }
+ }
}
//static
S32 LLHUDIcon::getNumInstances()
{
- return (S32)sIconInstances.size();
+ return (S32)sIconInstances.size();
}
diff --git a/indra/newview/llhudicon.h b/indra/newview/llhudicon.h
index 7f452b5c36..edc843aa8c 100644
--- a/indra/newview/llhudicon.h
+++ b/indra/newview/llhudicon.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudicon.h
* @brief LLHUDIcon class definition
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,42 +47,42 @@ class LLHUDIcon : public LLHUDObject
friend class LLHUDObject;
public:
- /*virtual*/ void render();
- /*virtual*/ void markDead();
- /*virtual*/ F32 getDistance() const { return mDistance; }
+ /*virtual*/ void render();
+ /*virtual*/ void markDead();
+ /*virtual*/ F32 getDistance() const { return mDistance; }
- void setImage(LLViewerTexture* imagep);
- void setScale(F32 fraction_of_fov);
+ void setImage(LLViewerTexture* imagep);
+ void setScale(F32 fraction_of_fov);
- void restartLifeTimer() { mLifeTimer.reset(); }
+ void restartLifeTimer() { mLifeTimer.reset(); }
- static LLHUDIcon* lineSegmentIntersectAll(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection);
+ static LLHUDIcon* lineSegmentIntersectAll(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection);
- static void updateAll();
- static void cleanupDeadIcons();
- static S32 getNumInstances();
+ static void updateAll();
+ static void cleanupDeadIcons();
+ static S32 getNumInstances();
- static BOOL iconsNearby();
+ static BOOL iconsNearby();
- BOOL getHidden() const { return mHidden; }
- void setHidden( BOOL hide ) { mHidden = hide; }
+ BOOL getHidden() const { return mHidden; }
+ void setHidden( BOOL hide ) { mHidden = hide; }
- BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection);
+ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection);
protected:
- LLHUDIcon(const U8 type);
- ~LLHUDIcon();
+ LLHUDIcon(const U8 type);
+ ~LLHUDIcon();
private:
- LLPointer<LLViewerTexture> mImagep;
- LLFrameTimer mAnimTimer;
- LLFrameTimer mLifeTimer;
- F32 mDistance;
- F32 mScale;
- BOOL mHidden;
-
- typedef std::vector<LLPointer<LLHUDIcon> > icon_instance_t;
- static icon_instance_t sIconInstances;
+ LLPointer<LLViewerTexture> mImagep;
+ LLFrameTimer mAnimTimer;
+ LLFrameTimer mLifeTimer;
+ F32 mDistance;
+ F32 mScale;
+ BOOL mHidden;
+
+ typedef std::vector<LLPointer<LLHUDIcon> > icon_instance_t;
+ static icon_instance_t sIconInstances;
};
#endif // LL_LLHUDICON_H
diff --git a/indra/newview/llhudmanager.cpp b/indra/newview/llhudmanager.cpp
index 1f9b0f47b1..531ca804ef 100644
--- a/indra/newview/llhudmanager.cpp
+++ b/indra/newview/llhudmanager.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudmanager.cpp
* @brief LLHUDManager class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,9 +45,9 @@ LLColor4 LLHUDManager::sChildColor;
LLHUDManager::LLHUDManager()
{
- LLHUDManager::sParentColor = LLUIColorTable::instance().getColor("FocusColor");
- // rdw commented out since it's not used. Also removed from colors_base.xml
- //LLHUDManager::sChildColor =LLUIColorTable::instance().getColor("FocusSecondaryColor");
+ LLHUDManager::sParentColor = LLUIColorTable::instance().getColor("FocusColor");
+ // rdw commented out since it's not used. Also removed from colors_base.xml
+ //LLHUDManager::sChildColor =LLUIColorTable::instance().getColor("FocusSecondaryColor");
}
LLHUDManager::~LLHUDManager()
@@ -58,153 +58,153 @@ static LLTrace::BlockTimerStatHandle FTM_UPDATE_HUD_EFFECTS("Update Hud Effects"
void LLHUDManager::updateEffects()
{
- LL_RECORD_BLOCK_TIME(FTM_UPDATE_HUD_EFFECTS);
- S32 i;
- for (i = 0; i < mHUDEffects.size(); i++)
- {
- LLHUDEffect *hep = mHUDEffects[i];
- if (hep->isDead())
- {
- continue;
- }
- hep->update();
- }
+ LL_RECORD_BLOCK_TIME(FTM_UPDATE_HUD_EFFECTS);
+ S32 i;
+ for (i = 0; i < mHUDEffects.size(); i++)
+ {
+ LLHUDEffect *hep = mHUDEffects[i];
+ if (hep->isDead())
+ {
+ continue;
+ }
+ hep->update();
+ }
}
void LLHUDManager::sendEffects()
{
- S32 i;
- for (i = 0; i < mHUDEffects.size(); i++)
- {
- LLHUDEffect *hep = mHUDEffects[i];
- if (hep->isDead())
- {
- LL_WARNS() << "Trying to send dead effect!" << LL_ENDL;
- continue;
- }
- if (hep->mType < LLHUDObject::LL_HUD_EFFECT_BEAM)
- {
- LL_WARNS() << "Trying to send effect of type " << hep->mType << " which isn't really an effect and shouldn't be in this list!" << LL_ENDL;
- continue;
- }
- if (hep->getNeedsSendToSim() && hep->getOriginatedHere())
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ViewerEffect);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Effect);
- hep->packData(msg);
- hep->setNeedsSendToSim(FALSE);
- gAgent.sendMessage();
- }
- }
+ S32 i;
+ for (i = 0; i < mHUDEffects.size(); i++)
+ {
+ LLHUDEffect *hep = mHUDEffects[i];
+ if (hep->isDead())
+ {
+ LL_WARNS() << "Trying to send dead effect!" << LL_ENDL;
+ continue;
+ }
+ if (hep->mType < LLHUDObject::LL_HUD_EFFECT_BEAM)
+ {
+ LL_WARNS() << "Trying to send effect of type " << hep->mType << " which isn't really an effect and shouldn't be in this list!" << LL_ENDL;
+ continue;
+ }
+ if (hep->getNeedsSendToSim() && hep->getOriginatedHere())
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ViewerEffect);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_Effect);
+ hep->packData(msg);
+ hep->setNeedsSendToSim(FALSE);
+ gAgent.sendMessage();
+ }
+ }
}
//static
void LLHUDManager::shutdownClass()
{
- getInstance()->mHUDEffects.clear();
+ getInstance()->mHUDEffects.clear();
}
void LLHUDManager::cleanupEffects()
{
- S32 i = 0;
-
- while (i < mHUDEffects.size())
- {
- if (mHUDEffects[i]->isDead())
- {
- mHUDEffects.erase(mHUDEffects.begin() + i);
- }
- else
- {
- i++;
- }
- }
+ S32 i = 0;
+
+ while (i < mHUDEffects.size())
+ {
+ if (mHUDEffects[i]->isDead())
+ {
+ mHUDEffects.erase(mHUDEffects.begin() + i);
+ }
+ else
+ {
+ i++;
+ }
+ }
}
LLHUDEffect *LLHUDManager::createViewerEffect(const U8 type, BOOL send_to_sim, BOOL originated_here)
{
- // SJB: DO NOT USE addHUDObject!!! Not all LLHUDObjects are LLHUDEffects!
- LLHUDEffect *hep = LLHUDObject::addHUDEffect(type);
- if (!hep)
- {
- return NULL;
- }
-
- LLUUID tmp;
- tmp.generate();
- hep->setID(tmp);
- hep->setNeedsSendToSim(send_to_sim);
- hep->setOriginatedHere(originated_here);
-
- mHUDEffects.push_back(hep);
- return hep;
+ // SJB: DO NOT USE addHUDObject!!! Not all LLHUDObjects are LLHUDEffects!
+ LLHUDEffect *hep = LLHUDObject::addHUDEffect(type);
+ if (!hep)
+ {
+ return NULL;
+ }
+
+ LLUUID tmp;
+ tmp.generate();
+ hep->setID(tmp);
+ hep->setNeedsSendToSim(send_to_sim);
+ hep->setOriginatedHere(originated_here);
+
+ mHUDEffects.push_back(hep);
+ return hep;
}
//static
void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_data)
{
- LLHUDEffect *effectp = NULL;
- LLUUID effect_id;
- U8 effect_type = 0;
- S32 number_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_Effect);
- S32 k;
-
- for (k = 0; k < number_blocks; k++)
- {
- effectp = NULL;
- LLHUDEffect::getIDType(mesgsys, k, effect_id, effect_type);
- S32 i;
- for (i = 0; i < LLHUDManager::getInstance()->mHUDEffects.size(); i++)
- {
- LLHUDEffect *cur_effectp = LLHUDManager::getInstance()->mHUDEffects[i];
- if (!cur_effectp)
- {
- LL_WARNS() << "Null effect in effect manager, skipping" << LL_ENDL;
- LLHUDManager::getInstance()->mHUDEffects.erase(LLHUDManager::getInstance()->mHUDEffects.begin() + i);
- i--;
- continue;
- }
- if (cur_effectp->isDead())
- {
- // LL_WARNS() << "Dead effect in effect manager, removing" << LL_ENDL;
- LLHUDManager::getInstance()->mHUDEffects.erase(LLHUDManager::getInstance()->mHUDEffects.begin() + i);
- i--;
- continue;
- }
- if (cur_effectp->getID() == effect_id)
- {
- if (cur_effectp->getType() != effect_type)
- {
- LL_WARNS() << "Viewer effect update doesn't match old type!" << LL_ENDL;
- }
- effectp = cur_effectp;
- break;
- }
- }
-
- if (effect_type)
- {
- if (!effectp)
- {
- effectp = LLHUDManager::getInstance()->createViewerEffect(effect_type, FALSE, FALSE);
- }
-
- if (effectp)
- {
- effectp->unpackData(mesgsys, k);
- }
- }
- else
- {
- LL_WARNS() << "Received viewer effect of type " << effect_type << " which isn't really an effect!" << LL_ENDL;
- }
- }
-
- //LL_INFOS() << "Got viewer effect: " << effect_id << LL_ENDL;
+ LLHUDEffect *effectp = NULL;
+ LLUUID effect_id;
+ U8 effect_type = 0;
+ S32 number_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_Effect);
+ S32 k;
+
+ for (k = 0; k < number_blocks; k++)
+ {
+ effectp = NULL;
+ LLHUDEffect::getIDType(mesgsys, k, effect_id, effect_type);
+ S32 i;
+ for (i = 0; i < LLHUDManager::getInstance()->mHUDEffects.size(); i++)
+ {
+ LLHUDEffect *cur_effectp = LLHUDManager::getInstance()->mHUDEffects[i];
+ if (!cur_effectp)
+ {
+ LL_WARNS() << "Null effect in effect manager, skipping" << LL_ENDL;
+ LLHUDManager::getInstance()->mHUDEffects.erase(LLHUDManager::getInstance()->mHUDEffects.begin() + i);
+ i--;
+ continue;
+ }
+ if (cur_effectp->isDead())
+ {
+ // LL_WARNS() << "Dead effect in effect manager, removing" << LL_ENDL;
+ LLHUDManager::getInstance()->mHUDEffects.erase(LLHUDManager::getInstance()->mHUDEffects.begin() + i);
+ i--;
+ continue;
+ }
+ if (cur_effectp->getID() == effect_id)
+ {
+ if (cur_effectp->getType() != effect_type)
+ {
+ LL_WARNS() << "Viewer effect update doesn't match old type!" << LL_ENDL;
+ }
+ effectp = cur_effectp;
+ break;
+ }
+ }
+
+ if (effect_type)
+ {
+ if (!effectp)
+ {
+ effectp = LLHUDManager::getInstance()->createViewerEffect(effect_type, FALSE, FALSE);
+ }
+
+ if (effectp)
+ {
+ effectp->unpackData(mesgsys, k);
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Received viewer effect of type " << effect_type << " which isn't really an effect!" << LL_ENDL;
+ }
+ }
+
+ //LL_INFOS() << "Got viewer effect: " << effect_id << LL_ENDL;
}
diff --git a/indra/newview/llhudmanager.h b/indra/newview/llhudmanager.h
index 7782739690..27e5bafe61 100644
--- a/indra/newview/llhudmanager.h
+++ b/indra/newview/llhudmanager.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudmanager.h
* @brief LLHUDManager class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,25 +36,25 @@ class LLMessageSystem;
class LLHUDManager : public LLSingleton<LLHUDManager>
{
- LLSINGLETON(LLHUDManager);
- ~LLHUDManager();
+ LLSINGLETON(LLHUDManager);
+ ~LLHUDManager();
public:
- LLHUDEffect *createViewerEffect(const U8 type, BOOL send_to_sim = TRUE, BOOL originated_here = TRUE);
+ LLHUDEffect *createViewerEffect(const U8 type, BOOL send_to_sim = TRUE, BOOL originated_here = TRUE);
- void updateEffects();
- void sendEffects();
- void cleanupEffects();
+ void updateEffects();
+ void sendEffects();
+ void cleanupEffects();
- static void shutdownClass();
+ static void shutdownClass();
- static void processViewerEffect(LLMessageSystem *mesgsys, void **user_data);
+ static void processViewerEffect(LLMessageSystem *mesgsys, void **user_data);
- static LLColor4 sParentColor;
- static LLColor4 sChildColor;
+ static LLColor4 sParentColor;
+ static LLColor4 sChildColor;
protected:
- std::vector<LLPointer<LLHUDEffect> > mHUDEffects;
+ std::vector<LLPointer<LLHUDEffect> > mHUDEffects;
};
#endif // LL_LLHUDMANAGER_H
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 5524bb7f09..f873eff87d 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llhudnametag.cpp
* @brief Name tags for avatars
* @author James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,7 +54,7 @@
const F32 SPRING_STRENGTH = 0.7f;
const F32 HORIZONTAL_PADDING = 16.f;
const F32 VERTICAL_PADDING = 12.f;
-const F32 LINE_PADDING = 3.f; // aka "leading"
+const F32 LINE_PADDING = 3.f; // aka "leading"
const F32 BUFFER_SIZE = 2.f;
const S32 NUM_OVERLAP_ITERATIONS = 10;
const F32 POSITION_DAMPING_TC = 0.2f;
@@ -71,41 +71,41 @@ const F32 LLHUDNameTag::HUD_TEXT_MAX_WIDTH = 190.f;
bool llhudnametag_further_away::operator()(const LLPointer<LLHUDNameTag>& lhs, const LLPointer<LLHUDNameTag>& rhs) const
{
- return lhs->getDistance() > rhs->getDistance();
+ return lhs->getDistance() > rhs->getDistance();
}
LLHUDNameTag::LLHUDNameTag(const U8 type)
-: LLHUDObject(type),
- mDoFade(TRUE),
- mFadeDistance(8.f),
- mFadeRange(4.f),
- mLastDistance(0.f),
- mZCompare(TRUE),
- mVisibleOffScreen(FALSE),
- mOffscreen(FALSE),
- mColor(1.f, 1.f, 1.f, 1.f),
-// mScale(),
- mWidth(0.f),
- mHeight(0.f),
- mFontp(LLFontGL::getFontSansSerifSmall()),
- mBoldFontp(LLFontGL::getFontSansSerifBold()),
- mSoftScreenRect(),
- mPositionAgent(),
- mPositionOffset(),
- mMass(10.f),
- mMaxLines(10),
- mOffsetY(0),
- mRadius(0.1f),
- mTextSegments(),
- mLabelSegments(),
- mTextAlignment(ALIGN_TEXT_CENTER),
- mVertAlignment(ALIGN_VERT_CENTER),
- mLOD(0),
- mHidden(FALSE)
+: LLHUDObject(type),
+ mDoFade(TRUE),
+ mFadeDistance(8.f),
+ mFadeRange(4.f),
+ mLastDistance(0.f),
+ mZCompare(TRUE),
+ mVisibleOffScreen(FALSE),
+ mOffscreen(FALSE),
+ mColor(1.f, 1.f, 1.f, 1.f),
+// mScale(),
+ mWidth(0.f),
+ mHeight(0.f),
+ mFontp(LLFontGL::getFontSansSerifSmall()),
+ mBoldFontp(LLFontGL::getFontSansSerifBold()),
+ mSoftScreenRect(),
+ mPositionAgent(),
+ mPositionOffset(),
+ mMass(10.f),
+ mMaxLines(10),
+ mOffsetY(0),
+ mRadius(0.1f),
+ mTextSegments(),
+ mLabelSegments(),
+ mTextAlignment(ALIGN_TEXT_CENTER),
+ mVertAlignment(ALIGN_VERT_CENTER),
+ mLOD(0),
+ mHidden(FALSE)
{
- LLPointer<LLHUDNameTag> ptr(this);
- sTextObjects.insert(ptr);
+ LLPointer<LLHUDNameTag> ptr(this);
+ sTextObjects.insert(ptr);
mRoundedRectImgp = LLUI::getUIImage("Rounded_Rect");
mRoundedRectTopImgp = LLUI::getUIImage("Rounded_Rect_Top");
@@ -118,319 +118,319 @@ LLHUDNameTag::~LLHUDNameTag()
BOOL LLHUDNameTag::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, BOOL debug_render)
{
- if (!mVisible || mHidden)
- {
- return FALSE;
- }
-
- // don't pick text that isn't bound to a viewerobject
- if (!mSourceObject || mSourceObject->mDrawable.isNull())
- {
- return FALSE;
- }
-
- F32 alpha_factor = 1.f;
- LLColor4 text_color = mColor;
- if (mDoFade)
- {
- if (mLastDistance > mFadeDistance)
- {
- alpha_factor = llmax(0.f, 1.f - (mLastDistance - mFadeDistance)/mFadeRange);
- text_color.mV[3] = text_color.mV[3]*alpha_factor;
- }
- }
- if (text_color.mV[3] < 0.01f)
- {
- return FALSE;
- }
-
- mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
-
- LLVector3 position = mPositionAgent;
-
- if (mSourceObject)
- { //get intersection of eye through mPositionAgent to plane of source object
- //using this position keeps the camera from focusing on some seemingly random
- //point several meters in front of the nametag
- const LLVector3& p = mSourceObject->getPositionAgent();
- const LLVector3& n = LLViewerCamera::getInstance()->getAtAxis();
- const LLVector3& eye = LLViewerCamera::getInstance()->getOrigin();
-
- LLVector3 ray = position-eye;
- ray.normalize();
-
- LLVector3 delta = p-position;
- F32 dist = delta*n;
- F32 dt = dist/(ray*n);
- position += ray*dt;
- }
-
- // scale screen size of borders down
-
- LLVector3 x_pixel_vec;
- LLVector3 y_pixel_vec;
-
- LLViewerCamera::getInstance()->getPixelVectors(position, y_pixel_vec, x_pixel_vec);
-
- LLVector3 width_vec = mWidth * x_pixel_vec;
- LLVector3 height_vec = mHeight * y_pixel_vec;
-
- LLCoordGL screen_pos;
- LLViewerCamera::getInstance()->projectPosAgentToScreen(position, screen_pos, FALSE);
-
- LLVector2 screen_offset;
- screen_offset = updateScreenPos(mPositionOffset);
-
- LLVector3 render_position = position
- + (x_pixel_vec * screen_offset.mV[VX])
- + (y_pixel_vec * screen_offset.mV[VY]);
-
-
- LLVector3 bg_pos = render_position
- + (F32)mOffsetY * y_pixel_vec
- - (width_vec / 2.f)
- - (height_vec);
-
- LLVector3 v[] =
- {
- bg_pos,
- bg_pos + width_vec,
- bg_pos + width_vec + height_vec,
- bg_pos + height_vec,
- };
-
- LLVector4a dir;
- dir.setSub(end,start);
- F32 a, b, t;
-
- LLVector4a v0,v1,v2,v3;
- v0.load3(v[0].mV);
- v1.load3(v[1].mV);
- v2.load3(v[2].mV);
- v3.load3(v[3].mV);
-
- if (LLTriangleRayIntersect(v0, v1, v2, start, dir, a, b, t) ||
- LLTriangleRayIntersect(v2, v3, v0, start, dir, a, b, t) )
- {
- if (t <= 1.f)
- {
- dir.mul(t);
- intersection.setAdd(start, dir);
- return TRUE;
- }
- }
-
- return FALSE;
+ if (!mVisible || mHidden)
+ {
+ return FALSE;
+ }
+
+ // don't pick text that isn't bound to a viewerobject
+ if (!mSourceObject || mSourceObject->mDrawable.isNull())
+ {
+ return FALSE;
+ }
+
+ F32 alpha_factor = 1.f;
+ LLColor4 text_color = mColor;
+ if (mDoFade)
+ {
+ if (mLastDistance > mFadeDistance)
+ {
+ alpha_factor = llmax(0.f, 1.f - (mLastDistance - mFadeDistance)/mFadeRange);
+ text_color.mV[3] = text_color.mV[3]*alpha_factor;
+ }
+ }
+ if (text_color.mV[3] < 0.01f)
+ {
+ return FALSE;
+ }
+
+ mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
+
+ LLVector3 position = mPositionAgent;
+
+ if (mSourceObject)
+ { //get intersection of eye through mPositionAgent to plane of source object
+ //using this position keeps the camera from focusing on some seemingly random
+ //point several meters in front of the nametag
+ const LLVector3& p = mSourceObject->getPositionAgent();
+ const LLVector3& n = LLViewerCamera::getInstance()->getAtAxis();
+ const LLVector3& eye = LLViewerCamera::getInstance()->getOrigin();
+
+ LLVector3 ray = position-eye;
+ ray.normalize();
+
+ LLVector3 delta = p-position;
+ F32 dist = delta*n;
+ F32 dt = dist/(ray*n);
+ position += ray*dt;
+ }
+
+ // scale screen size of borders down
+
+ LLVector3 x_pixel_vec;
+ LLVector3 y_pixel_vec;
+
+ LLViewerCamera::getInstance()->getPixelVectors(position, y_pixel_vec, x_pixel_vec);
+
+ LLVector3 width_vec = mWidth * x_pixel_vec;
+ LLVector3 height_vec = mHeight * y_pixel_vec;
+
+ LLCoordGL screen_pos;
+ LLViewerCamera::getInstance()->projectPosAgentToScreen(position, screen_pos, FALSE);
+
+ LLVector2 screen_offset;
+ screen_offset = updateScreenPos(mPositionOffset);
+
+ LLVector3 render_position = position
+ + (x_pixel_vec * screen_offset.mV[VX])
+ + (y_pixel_vec * screen_offset.mV[VY]);
+
+
+ LLVector3 bg_pos = render_position
+ + (F32)mOffsetY * y_pixel_vec
+ - (width_vec / 2.f)
+ - (height_vec);
+
+ LLVector3 v[] =
+ {
+ bg_pos,
+ bg_pos + width_vec,
+ bg_pos + width_vec + height_vec,
+ bg_pos + height_vec,
+ };
+
+ LLVector4a dir;
+ dir.setSub(end,start);
+ F32 a, b, t;
+
+ LLVector4a v0,v1,v2,v3;
+ v0.load3(v[0].mV);
+ v1.load3(v[1].mV);
+ v2.load3(v[2].mV);
+ v3.load3(v[3].mV);
+
+ if (LLTriangleRayIntersect(v0, v1, v2, start, dir, a, b, t) ||
+ LLTriangleRayIntersect(v2, v3, v0, start, dir, a, b, t) )
+ {
+ if (t <= 1.f)
+ {
+ dir.mul(t);
+ intersection.setAdd(start, dir);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
}
void LLHUDNameTag::render()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
- if (sDisplayText)
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- //LLGLDisable gls_stencil(GL_STENCIL_TEST);
- renderText(FALSE);
- }
+ if (sDisplayText)
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ renderText(FALSE);
+ }
}
void LLHUDNameTag::renderText(BOOL for_select)
{
- if (!mVisible || mHidden)
- {
- return;
- }
-
- // don't pick text that isn't bound to a viewerobject
- if (for_select &&
- (!mSourceObject || mSourceObject->mDrawable.isNull()))
- {
- return;
- }
-
- if (for_select)
- {
- gGL.getTexUnit(0)->disable();
- }
- else
- {
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
- }
-
- LLGLState gls_blend(GL_BLEND, for_select ? FALSE : TRUE);
-
- LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f);
- F32 alpha_factor = 1.f;
- LLColor4 text_color = mColor;
- if (mDoFade)
- {
- if (mLastDistance > mFadeDistance)
- {
- alpha_factor = llmax(0.f, 1.f - (mLastDistance - mFadeDistance)/mFadeRange);
- text_color.mV[3] = text_color.mV[3]*alpha_factor;
- }
- }
- if (text_color.mV[3] < 0.01f)
- {
- return;
- }
- shadow_color.mV[3] = text_color.mV[3];
-
- mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
-
- // *TODO: make this a per-text setting
- LLColor4 bg_color = LLUIColorTable::instance().getColor("NameTagBackground");
- bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor);
-
- // scale screen size of borders down
- //RN: for now, text on hud objects is never occluded
-
- LLVector3 x_pixel_vec;
- LLVector3 y_pixel_vec;
-
- LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
-
- LLVector3 width_vec = mWidth * x_pixel_vec;
- LLVector3 height_vec = mHeight * y_pixel_vec;
-
- mRadius = (width_vec + height_vec).magVec() * 0.5f;
-
- LLCoordGL screen_pos;
- LLViewerCamera::getInstance()->projectPosAgentToScreen(mPositionAgent, screen_pos, FALSE);
-
- LLVector2 screen_offset = updateScreenPos(mPositionOffset);
-
- LLVector3 render_position = mPositionAgent
- + (x_pixel_vec * screen_offset.mV[VX])
- + (y_pixel_vec * screen_offset.mV[VY]);
-
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- LLRect screen_rect;
- screen_rect.setCenterAndSize(0, static_cast<S32>(lltrunc(-mHeight / 2 + mOffsetY)), static_cast<S32>(lltrunc(mWidth)), static_cast<S32>(lltrunc(mHeight)));
+ if (!mVisible || mHidden)
+ {
+ return;
+ }
+
+ // don't pick text that isn't bound to a viewerobject
+ if (for_select &&
+ (!mSourceObject || mSourceObject->mDrawable.isNull()))
+ {
+ return;
+ }
+
+ if (for_select)
+ {
+ gGL.getTexUnit(0)->disable();
+ }
+ else
+ {
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+ }
+
+ LLGLState gls_blend(GL_BLEND, for_select ? FALSE : TRUE);
+
+ LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f);
+ F32 alpha_factor = 1.f;
+ LLColor4 text_color = mColor;
+ if (mDoFade)
+ {
+ if (mLastDistance > mFadeDistance)
+ {
+ alpha_factor = llmax(0.f, 1.f - (mLastDistance - mFadeDistance)/mFadeRange);
+ text_color.mV[3] = text_color.mV[3]*alpha_factor;
+ }
+ }
+ if (text_color.mV[3] < 0.01f)
+ {
+ return;
+ }
+ shadow_color.mV[3] = text_color.mV[3];
+
+ mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
+
+ // *TODO: make this a per-text setting
+ LLColor4 bg_color = LLUIColorTable::instance().getColor("NameTagBackground");
+ bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor);
+
+ // scale screen size of borders down
+ //RN: for now, text on hud objects is never occluded
+
+ LLVector3 x_pixel_vec;
+ LLVector3 y_pixel_vec;
+
+ LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
+
+ LLVector3 width_vec = mWidth * x_pixel_vec;
+ LLVector3 height_vec = mHeight * y_pixel_vec;
+
+ mRadius = (width_vec + height_vec).magVec() * 0.5f;
+
+ LLCoordGL screen_pos;
+ LLViewerCamera::getInstance()->projectPosAgentToScreen(mPositionAgent, screen_pos, FALSE);
+
+ LLVector2 screen_offset = updateScreenPos(mPositionOffset);
+
+ LLVector3 render_position = mPositionAgent
+ + (x_pixel_vec * screen_offset.mV[VX])
+ + (y_pixel_vec * screen_offset.mV[VY]);
+
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ LLRect screen_rect;
+ screen_rect.setCenterAndSize(0, static_cast<S32>(lltrunc(-mHeight / 2 + mOffsetY)), static_cast<S32>(lltrunc(mWidth)), static_cast<S32>(lltrunc(mHeight)));
mRoundedRectImgp->draw3D(render_position, x_pixel_vec, y_pixel_vec, screen_rect, bg_color);
- if (mLabelSegments.size())
- {
- LLRect label_top_rect = screen_rect;
- const S32 label_height = ll_round((mFontp->getLineHeight() * (F32)mLabelSegments.size() + (VERTICAL_PADDING / 3.f)));
- label_top_rect.mBottom = label_top_rect.mTop - label_height;
- LLColor4 label_top_color = text_color;
- label_top_color.mV[VALPHA] = gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor;
+ if (mLabelSegments.size())
+ {
+ LLRect label_top_rect = screen_rect;
+ const S32 label_height = ll_round((mFontp->getLineHeight() * (F32)mLabelSegments.size() + (VERTICAL_PADDING / 3.f)));
+ label_top_rect.mBottom = label_top_rect.mTop - label_height;
+ LLColor4 label_top_color = text_color;
+ label_top_color.mV[VALPHA] = gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor;
mRoundedRectTopImgp->draw3D(render_position, x_pixel_vec, y_pixel_vec, label_top_rect, label_top_color);
- }
-
- F32 y_offset = (F32)mOffsetY;
-
- // Render label
- {
- for(std::vector<LLHUDTextSegment>::iterator segment_iter = mLabelSegments.begin();
- segment_iter != mLabelSegments.end(); ++segment_iter )
- {
- // Label segments use default font
- const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp;
- y_offset -= fontp->getLineHeight();
-
- F32 x_offset;
- if (mTextAlignment == ALIGN_TEXT_CENTER)
- {
- x_offset = -0.5f*segment_iter->getWidth(fontp);
- }
- else // ALIGN_LEFT
- {
- x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f);
- }
-
- LLColor4 label_color(0.f, 0.f, 0.f, 1.f);
- label_color.mV[VALPHA] = alpha_factor;
- hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, FALSE);
- }
- }
-
- // Render text
- {
- // -1 mMaxLines means unlimited lines.
- S32 start_segment;
- S32 max_lines = getMaxLines();
-
- if (max_lines < 0)
- {
- start_segment = 0;
- }
- else
- {
- start_segment = llmax((S32)0, (S32)mTextSegments.size() - max_lines);
- }
-
- for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment;
- segment_iter != mTextSegments.end(); ++segment_iter )
- {
- const LLFontGL* fontp = segment_iter->mFont;
- y_offset -= fontp->getLineHeight();
- y_offset -= LINE_PADDING;
-
- U8 style = segment_iter->mStyle;
- LLFontGL::ShadowType shadow = LLFontGL::DROP_SHADOW;
-
- F32 x_offset;
- if (mTextAlignment== ALIGN_TEXT_CENTER)
- {
- x_offset = -0.5f*segment_iter->getWidth(fontp);
- }
- else // ALIGN_LEFT
- {
- x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f);
-
- // *HACK
- x_offset += 1;
- }
-
- text_color = segment_iter->mColor;
- text_color.mV[VALPHA] *= alpha_factor;
-
- hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, FALSE);
- }
- }
- /// Reset the default color to white. The renderer expects this to be the default.
- gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f);
- if (for_select)
- {
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
- }
+ }
+
+ F32 y_offset = (F32)mOffsetY;
+
+ // Render label
+ {
+ for(std::vector<LLHUDTextSegment>::iterator segment_iter = mLabelSegments.begin();
+ segment_iter != mLabelSegments.end(); ++segment_iter )
+ {
+ // Label segments use default font
+ const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp;
+ y_offset -= fontp->getLineHeight();
+
+ F32 x_offset;
+ if (mTextAlignment == ALIGN_TEXT_CENTER)
+ {
+ x_offset = -0.5f*segment_iter->getWidth(fontp);
+ }
+ else // ALIGN_LEFT
+ {
+ x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f);
+ }
+
+ LLColor4 label_color(0.f, 0.f, 0.f, 1.f);
+ label_color.mV[VALPHA] = alpha_factor;
+ hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, FALSE);
+ }
+ }
+
+ // Render text
+ {
+ // -1 mMaxLines means unlimited lines.
+ S32 start_segment;
+ S32 max_lines = getMaxLines();
+
+ if (max_lines < 0)
+ {
+ start_segment = 0;
+ }
+ else
+ {
+ start_segment = llmax((S32)0, (S32)mTextSegments.size() - max_lines);
+ }
+
+ for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment;
+ segment_iter != mTextSegments.end(); ++segment_iter )
+ {
+ const LLFontGL* fontp = segment_iter->mFont;
+ y_offset -= fontp->getLineHeight();
+ y_offset -= LINE_PADDING;
+
+ U8 style = segment_iter->mStyle;
+ LLFontGL::ShadowType shadow = LLFontGL::DROP_SHADOW;
+
+ F32 x_offset;
+ if (mTextAlignment== ALIGN_TEXT_CENTER)
+ {
+ x_offset = -0.5f*segment_iter->getWidth(fontp);
+ }
+ else // ALIGN_LEFT
+ {
+ x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f);
+
+ // *HACK
+ x_offset += 1;
+ }
+
+ text_color = segment_iter->mColor;
+ text_color.mV[VALPHA] *= alpha_factor;
+
+ hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, FALSE);
+ }
+ }
+ /// Reset the default color to white. The renderer expects this to be the default.
+ gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f);
+ if (for_select)
+ {
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+ }
}
void LLHUDNameTag::setString(const std::string &text_utf8)
{
- mTextSegments.clear();
- addLine(text_utf8, mColor);
+ mTextSegments.clear();
+ addLine(text_utf8, mColor);
}
void LLHUDNameTag::clearString()
{
- mTextSegments.clear();
+ mTextSegments.clear();
}
void LLHUDNameTag::addLine(const std::string &text_utf8,
- const LLColor4& color,
- const LLFontGL::StyleFlags style,
- const LLFontGL* font,
- const bool use_ellipses,
- F32 max_pixels)
+ const LLColor4& color,
+ const LLFontGL::StyleFlags style,
+ const LLFontGL* font,
+ const bool use_ellipses,
+ F32 max_pixels)
{
- LLWString wline = utf8str_to_wstring(text_utf8);
- if (!wline.empty())
- {
- // use default font for segment if custom font not specified
- if (!font)
- {
- font = mFontp;
- }
- typedef boost::tokenizer<boost::char_separator<llwchar>, LLWString::const_iterator, LLWString > tokenizer;
- LLWString seps(utf8str_to_wstring("\r\n"));
- boost::char_separator<llwchar> sep(seps.c_str());
-
- tokenizer tokens(wline, sep);
- tokenizer::iterator iter = tokens.begin();
+ LLWString wline = utf8str_to_wstring(text_utf8);
+ if (!wline.empty())
+ {
+ // use default font for segment if custom font not specified
+ if (!font)
+ {
+ font = mFontp;
+ }
+ typedef boost::tokenizer<boost::char_separator<llwchar>, LLWString::const_iterator, LLWString > tokenizer;
+ LLWString seps(utf8str_to_wstring("\r\n"));
+ boost::char_separator<llwchar> sep(seps.c_str());
+
+ tokenizer tokens(wline, sep);
+ tokenizer::iterator iter = tokens.begin();
max_pixels = llmin(max_pixels, NAMETAG_MAX_WIDTH);
while (iter != tokens.end())
@@ -478,481 +478,481 @@ void LLHUDNameTag::addLine(const std::string &text_utf8,
line_length += segment_length;
} while (line_length != iter->size());
}
- ++iter;
- }
- }
+ ++iter;
+ }
+ }
}
void LLHUDNameTag::setLabel(const std::string &label_utf8)
{
- mLabelSegments.clear();
- addLabel(label_utf8);
+ mLabelSegments.clear();
+ addLabel(label_utf8);
}
void LLHUDNameTag::addLabel(const std::string& label_utf8, F32 max_pixels)
{
- LLWString wstr = utf8string_to_wstring(label_utf8);
- if (!wstr.empty())
- {
- LLWString seps(utf8str_to_wstring("\r\n"));
- LLWString empty;
+ LLWString wstr = utf8string_to_wstring(label_utf8);
+ if (!wstr.empty())
+ {
+ LLWString seps(utf8str_to_wstring("\r\n"));
+ LLWString empty;
- typedef boost::tokenizer<boost::char_separator<llwchar>, LLWString::const_iterator, LLWString > tokenizer;
- boost::char_separator<llwchar> sep(seps.c_str(), empty.c_str(), boost::keep_empty_tokens);
+ typedef boost::tokenizer<boost::char_separator<llwchar>, LLWString::const_iterator, LLWString > tokenizer;
+ boost::char_separator<llwchar> sep(seps.c_str(), empty.c_str(), boost::keep_empty_tokens);
- tokenizer tokens(wstr, sep);
- tokenizer::iterator iter = tokens.begin();
+ tokenizer tokens(wstr, sep);
+ tokenizer::iterator iter = tokens.begin();
max_pixels = llmin(max_pixels, NAMETAG_MAX_WIDTH);
- while (iter != tokens.end())
- {
- U32 line_length = 0;
- do
- {
- S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(),
+ while (iter != tokens.end())
+ {
+ U32 line_length = 0;
+ do
+ {
+ S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(),
max_pixels, wstr.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE);
- LLHUDTextSegment segment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor, mFontp);
- mLabelSegments.push_back(segment);
- line_length += segment_length;
- }
- while (line_length != iter->size());
- ++iter;
- }
- }
+ LLHUDTextSegment segment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor, mFontp);
+ mLabelSegments.push_back(segment);
+ line_length += segment_length;
+ }
+ while (line_length != iter->size());
+ ++iter;
+ }
+ }
}
void LLHUDNameTag::setZCompare(const BOOL zcompare)
{
- mZCompare = zcompare;
+ mZCompare = zcompare;
}
void LLHUDNameTag::setFont(const LLFontGL* font)
{
- mFontp = font;
+ mFontp = font;
}
void LLHUDNameTag::setColor(const LLColor4 &color)
{
- mColor = color;
- for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin();
- segment_iter != mTextSegments.end(); ++segment_iter )
- {
- segment_iter->mColor = color;
- }
+ mColor = color;
+ for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin();
+ segment_iter != mTextSegments.end(); ++segment_iter )
+ {
+ segment_iter->mColor = color;
+ }
}
void LLHUDNameTag::setAlpha(F32 alpha)
{
- mColor.mV[VALPHA] = alpha;
- for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin();
- segment_iter != mTextSegments.end(); ++segment_iter )
- {
- segment_iter->mColor.mV[VALPHA] = alpha;
- }
+ mColor.mV[VALPHA] = alpha;
+ for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin();
+ segment_iter != mTextSegments.end(); ++segment_iter )
+ {
+ segment_iter->mColor.mV[VALPHA] = alpha;
+ }
}
void LLHUDNameTag::setDoFade(const BOOL do_fade)
{
- mDoFade = do_fade;
+ mDoFade = do_fade;
}
void LLHUDNameTag::updateVisibility()
{
- if (mSourceObject)
- {
- mSourceObject->updateText();
- }
-
- mPositionAgent = gAgent.getPosAgentFromGlobal(mPositionGlobal);
-
- if (!mSourceObject)
- {
- //LL_WARNS() << "LLHUDNameTag::updateScreenPos -- mSourceObject is NULL!" << LL_ENDL;
- mVisible = TRUE;
- sVisibleTextObjects.push_back(LLPointer<LLHUDNameTag> (this));
- return;
- }
-
- // Not visible if parent object is dead
- if (mSourceObject->isDead())
- {
- mVisible = FALSE;
- return;
- }
-
- // push text towards camera by radius of object, but not past camera
- LLVector3 vec_from_camera = mPositionAgent - LLViewerCamera::getInstance()->getOrigin();
- LLVector3 dir_from_camera = vec_from_camera;
- dir_from_camera.normVec();
-
- if (dir_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= 0.f)
- { //text is behind camera, don't render
- mVisible = FALSE;
- return;
- }
-
- if (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= LLViewerCamera::getInstance()->getNear() + 0.1f + mSourceObject->getVObjRadius())
- {
- mPositionAgent = LLViewerCamera::getInstance()->getOrigin() + vec_from_camera * ((LLViewerCamera::getInstance()->getNear() + 0.1f) / (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis()));
- }
- else
- {
- mPositionAgent -= dir_from_camera * mSourceObject->getVObjRadius();
- }
-
- mLastDistance = (mPositionAgent - LLViewerCamera::getInstance()->getOrigin()).magVec();
-
- if (mLOD >= 3 || !mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange)))
- {
- mVisible = FALSE;
- return;
- }
-
- LLVector3 x_pixel_vec;
- LLVector3 y_pixel_vec;
-
- LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
-
- LLVector3 render_position = mPositionAgent +
- (x_pixel_vec * mPositionOffset.mV[VX]) +
- (y_pixel_vec * mPositionOffset.mV[VY]);
-
- mOffscreen = FALSE;
- if (!LLViewerCamera::getInstance()->sphereInFrustum(render_position, mRadius))
- {
- if (!mVisibleOffScreen)
- {
- mVisible = FALSE;
- return;
- }
- else
- {
- mOffscreen = TRUE;
- }
- }
-
- mVisible = TRUE;
- sVisibleTextObjects.push_back(LLPointer<LLHUDNameTag> (this));
+ if (mSourceObject)
+ {
+ mSourceObject->updateText();
+ }
+
+ mPositionAgent = gAgent.getPosAgentFromGlobal(mPositionGlobal);
+
+ if (!mSourceObject)
+ {
+ //LL_WARNS() << "LLHUDNameTag::updateScreenPos -- mSourceObject is NULL!" << LL_ENDL;
+ mVisible = TRUE;
+ sVisibleTextObjects.push_back(LLPointer<LLHUDNameTag> (this));
+ return;
+ }
+
+ // Not visible if parent object is dead
+ if (mSourceObject->isDead())
+ {
+ mVisible = FALSE;
+ return;
+ }
+
+ // push text towards camera by radius of object, but not past camera
+ LLVector3 vec_from_camera = mPositionAgent - LLViewerCamera::getInstance()->getOrigin();
+ LLVector3 dir_from_camera = vec_from_camera;
+ dir_from_camera.normVec();
+
+ if (dir_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= 0.f)
+ { //text is behind camera, don't render
+ mVisible = FALSE;
+ return;
+ }
+
+ if (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= LLViewerCamera::getInstance()->getNear() + 0.1f + mSourceObject->getVObjRadius())
+ {
+ mPositionAgent = LLViewerCamera::getInstance()->getOrigin() + vec_from_camera * ((LLViewerCamera::getInstance()->getNear() + 0.1f) / (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis()));
+ }
+ else
+ {
+ mPositionAgent -= dir_from_camera * mSourceObject->getVObjRadius();
+ }
+
+ mLastDistance = (mPositionAgent - LLViewerCamera::getInstance()->getOrigin()).magVec();
+
+ if (mLOD >= 3 || !mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange)))
+ {
+ mVisible = FALSE;
+ return;
+ }
+
+ LLVector3 x_pixel_vec;
+ LLVector3 y_pixel_vec;
+
+ LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
+
+ LLVector3 render_position = mPositionAgent +
+ (x_pixel_vec * mPositionOffset.mV[VX]) +
+ (y_pixel_vec * mPositionOffset.mV[VY]);
+
+ mOffscreen = FALSE;
+ if (!LLViewerCamera::getInstance()->sphereInFrustum(render_position, mRadius))
+ {
+ if (!mVisibleOffScreen)
+ {
+ mVisible = FALSE;
+ return;
+ }
+ else
+ {
+ mOffscreen = TRUE;
+ }
+ }
+
+ mVisible = TRUE;
+ sVisibleTextObjects.push_back(LLPointer<LLHUDNameTag> (this));
}
LLVector2 LLHUDNameTag::updateScreenPos(LLVector2 &offset)
{
- LLCoordGL screen_pos;
- LLVector2 screen_pos_vec;
- LLVector3 x_pixel_vec;
- LLVector3 y_pixel_vec;
- LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
- LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec);
- if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen)
- {
- // bubble off-screen, so find a spot for it along screen edge
- LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(world_pos, screen_pos);
- }
-
- screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY);
-
- LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
- S32 bottom = world_rect.mBottom + STATUS_BAR_HEIGHT;
-
- LLVector2 screen_center;
- screen_center.mV[VX] = llclamp((F32)screen_pos_vec.mV[VX], (F32)world_rect.mLeft + mWidth * 0.5f, (F32)world_rect.mRight - mWidth * 0.5f);
-
- if(mVertAlignment == ALIGN_VERT_TOP)
- {
- screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
- (F32)bottom,
- (F32)world_rect.mTop - mHeight - (F32)MENU_BAR_HEIGHT);
- mSoftScreenRect.setLeftTopAndSize(screen_center.mV[VX] - (mWidth + BUFFER_SIZE) * 0.5f,
- screen_center.mV[VY] + (mHeight + BUFFER_SIZE), mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
- }
- else
- {
- screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
- (F32)bottom + mHeight * 0.5f,
- (F32)world_rect.mTop - mHeight * 0.5f - (F32)MENU_BAR_HEIGHT);
- mSoftScreenRect.setCenterAndSize(screen_center.mV[VX], screen_center.mV[VY], mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
- }
-
- return offset + (screen_center - LLVector2((F32)screen_pos.mX, (F32)screen_pos.mY));
+ LLCoordGL screen_pos;
+ LLVector2 screen_pos_vec;
+ LLVector3 x_pixel_vec;
+ LLVector3 y_pixel_vec;
+ LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
+ LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec);
+ if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen)
+ {
+ // bubble off-screen, so find a spot for it along screen edge
+ LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(world_pos, screen_pos);
+ }
+
+ screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY);
+
+ LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
+ S32 bottom = world_rect.mBottom + STATUS_BAR_HEIGHT;
+
+ LLVector2 screen_center;
+ screen_center.mV[VX] = llclamp((F32)screen_pos_vec.mV[VX], (F32)world_rect.mLeft + mWidth * 0.5f, (F32)world_rect.mRight - mWidth * 0.5f);
+
+ if(mVertAlignment == ALIGN_VERT_TOP)
+ {
+ screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
+ (F32)bottom,
+ (F32)world_rect.mTop - mHeight - (F32)MENU_BAR_HEIGHT);
+ mSoftScreenRect.setLeftTopAndSize(screen_center.mV[VX] - (mWidth + BUFFER_SIZE) * 0.5f,
+ screen_center.mV[VY] + (mHeight + BUFFER_SIZE), mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
+ }
+ else
+ {
+ screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
+ (F32)bottom + mHeight * 0.5f,
+ (F32)world_rect.mTop - mHeight * 0.5f - (F32)MENU_BAR_HEIGHT);
+ mSoftScreenRect.setCenterAndSize(screen_center.mV[VX], screen_center.mV[VY], mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
+ }
+
+ return offset + (screen_center - LLVector2((F32)screen_pos.mX, (F32)screen_pos.mY));
}
void LLHUDNameTag::updateSize()
{
- F32 height = 0.f;
- F32 width = 0.f;
-
- S32 max_lines = getMaxLines();
- //S32 lines = (max_lines < 0) ? (S32)mTextSegments.size() : llmin((S32)mTextSegments.size(), max_lines);
- //F32 height = (F32)mFontp->getLineHeight() * (lines + mLabelSegments.size());
-
- S32 start_segment;
- if (max_lines < 0) start_segment = 0;
- else start_segment = llmax((S32)0, (S32)mTextSegments.size() - max_lines);
-
- std::vector<LLHUDTextSegment>::iterator iter = mTextSegments.begin() + start_segment;
- while (iter != mTextSegments.end())
- {
- const LLFontGL* fontp = iter->mFont;
- height += fontp->getLineHeight();
- height += LINE_PADDING;
- width = llmax(width, llmin(iter->getWidth(fontp), NAMETAG_MAX_WIDTH));
- ++iter;
- }
-
- // Don't want line spacing under the last line
- if (height > 0.f)
- {
- height -= LINE_PADDING;
- }
-
- iter = mLabelSegments.begin();
- while (iter != mLabelSegments.end())
- {
- height += mFontp->getLineHeight();
- width = llmax(width, llmin(iter->getWidth(mFontp), NAMETAG_MAX_WIDTH));
- ++iter;
- }
-
- if (width == 0.f)
- {
- return;
- }
-
- width += HORIZONTAL_PADDING;
- height += VERTICAL_PADDING;
-
- // *TODO: Could do a timer-based resize here
- //mWidth = llmax(width, lerp(mWidth, (F32)width, u));
- //mHeight = llmax(height, lerp(mHeight, (F32)height, u));
- mWidth = width;
- mHeight = height;
+ F32 height = 0.f;
+ F32 width = 0.f;
+
+ S32 max_lines = getMaxLines();
+ //S32 lines = (max_lines < 0) ? (S32)mTextSegments.size() : llmin((S32)mTextSegments.size(), max_lines);
+ //F32 height = (F32)mFontp->getLineHeight() * (lines + mLabelSegments.size());
+
+ S32 start_segment;
+ if (max_lines < 0) start_segment = 0;
+ else start_segment = llmax((S32)0, (S32)mTextSegments.size() - max_lines);
+
+ std::vector<LLHUDTextSegment>::iterator iter = mTextSegments.begin() + start_segment;
+ while (iter != mTextSegments.end())
+ {
+ const LLFontGL* fontp = iter->mFont;
+ height += fontp->getLineHeight();
+ height += LINE_PADDING;
+ width = llmax(width, llmin(iter->getWidth(fontp), NAMETAG_MAX_WIDTH));
+ ++iter;
+ }
+
+ // Don't want line spacing under the last line
+ if (height > 0.f)
+ {
+ height -= LINE_PADDING;
+ }
+
+ iter = mLabelSegments.begin();
+ while (iter != mLabelSegments.end())
+ {
+ height += mFontp->getLineHeight();
+ width = llmax(width, llmin(iter->getWidth(mFontp), NAMETAG_MAX_WIDTH));
+ ++iter;
+ }
+
+ if (width == 0.f)
+ {
+ return;
+ }
+
+ width += HORIZONTAL_PADDING;
+ height += VERTICAL_PADDING;
+
+ // *TODO: Could do a timer-based resize here
+ //mWidth = llmax(width, lerp(mWidth, (F32)width, u));
+ //mHeight = llmax(height, lerp(mHeight, (F32)height, u));
+ mWidth = width;
+ mHeight = height;
}
void LLHUDNameTag::updateAll()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
- // iterate over all text objects, calculate their restoration forces,
- // and add them to the visible set if they are on screen and close enough
- sVisibleTextObjects.clear();
-
- TextObjectIterator text_it;
- for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
- {
- LLHUDNameTag* textp = (*text_it);
- textp->mTargetPositionOffset.clearVec();
- textp->updateSize();
- textp->updateVisibility();
- }
-
- // sort back to front for rendering purposes
- std::sort(sVisibleTextObjects.begin(), sVisibleTextObjects.end(), llhudnametag_further_away());
-
- // iterate from front to back, and set LOD based on current screen coverage
- F32 screen_area = (F32)(gViewerWindow->getWindowWidthScaled() * gViewerWindow->getWindowHeightScaled());
- F32 current_screen_area = 0.f;
- std::vector<LLPointer<LLHUDNameTag> >::reverse_iterator r_it;
- for (r_it = sVisibleTextObjects.rbegin(); r_it != sVisibleTextObjects.rend(); ++r_it)
- {
- LLHUDNameTag* textp = (*r_it);
- if (current_screen_area / screen_area > LOD_2_SCREEN_COVERAGE)
- {
- textp->setLOD(3);
- }
- else if (current_screen_area / screen_area > LOD_1_SCREEN_COVERAGE)
- {
- textp->setLOD(2);
- }
- else if (current_screen_area / screen_area > LOD_0_SCREEN_COVERAGE)
- {
- textp->setLOD(1);
- }
- else
- {
- textp->setLOD(0);
- }
- textp->updateSize();
- // find on-screen position and initialize collision rectangle
- textp->mTargetPositionOffset = textp->updateScreenPos(LLVector2::zero);
- current_screen_area += (F32)(textp->mSoftScreenRect.getWidth() * textp->mSoftScreenRect.getHeight());
- }
-
- LLTrace::CountStatHandle<>* camera_vel_stat = LLViewerCamera::getVelocityStat();
- F32 camera_vel = LLTrace::get_frame_recording().getLastRecording().getPerSec(*camera_vel_stat);
- if (camera_vel > MAX_STABLE_CAMERA_VELOCITY)
- {
- return;
- }
-
- VisibleTextObjectIterator src_it;
-
- for (S32 i = 0; i < NUM_OVERLAP_ITERATIONS; i++)
- {
- for (src_it = sVisibleTextObjects.begin(); src_it != sVisibleTextObjects.end(); ++src_it)
- {
- LLHUDNameTag* src_textp = (*src_it);
-
- VisibleTextObjectIterator dst_it = src_it;
- ++dst_it;
- for (; dst_it != sVisibleTextObjects.end(); ++dst_it)
- {
- LLHUDNameTag* dst_textp = (*dst_it);
-
- if (src_textp->mSoftScreenRect.overlaps(dst_textp->mSoftScreenRect))
- {
- LLRectf intersect_rect = src_textp->mSoftScreenRect;
- intersect_rect.intersectWith(dst_textp->mSoftScreenRect);
- intersect_rect.stretch(-BUFFER_SIZE * 0.5f);
-
- F32 src_center_x = src_textp->mSoftScreenRect.getCenterX();
- F32 src_center_y = src_textp->mSoftScreenRect.getCenterY();
- F32 dst_center_x = dst_textp->mSoftScreenRect.getCenterX();
- F32 dst_center_y = dst_textp->mSoftScreenRect.getCenterY();
- F32 intersect_center_x = intersect_rect.getCenterX();
- F32 intersect_center_y = intersect_rect.getCenterY();
- LLVector2 force = lerp(LLVector2(dst_center_x - intersect_center_x, dst_center_y - intersect_center_y),
- LLVector2(intersect_center_x - src_center_x, intersect_center_y - src_center_y),
- 0.5f);
- force.setVec(dst_center_x - src_center_x, dst_center_y - src_center_y);
- force.normVec();
-
- LLVector2 src_force = -1.f * force;
- LLVector2 dst_force = force;
-
- LLVector2 force_strength;
- F32 src_mult = dst_textp->mMass / (dst_textp->mMass + src_textp->mMass);
- F32 dst_mult = 1.f - src_mult;
- F32 src_aspect_ratio = src_textp->mSoftScreenRect.getWidth() / src_textp->mSoftScreenRect.getHeight();
- F32 dst_aspect_ratio = dst_textp->mSoftScreenRect.getWidth() / dst_textp->mSoftScreenRect.getHeight();
- src_force.mV[VY] *= src_aspect_ratio;
- src_force.normVec();
- dst_force.mV[VY] *= dst_aspect_ratio;
- dst_force.normVec();
-
- src_force.mV[VX] *= llmin(intersect_rect.getWidth() * src_mult, intersect_rect.getHeight() * SPRING_STRENGTH);
- src_force.mV[VY] *= llmin(intersect_rect.getHeight() * src_mult, intersect_rect.getWidth() * SPRING_STRENGTH);
- dst_force.mV[VX] *= llmin(intersect_rect.getWidth() * dst_mult, intersect_rect.getHeight() * SPRING_STRENGTH);
- dst_force.mV[VY] *= llmin(intersect_rect.getHeight() * dst_mult, intersect_rect.getWidth() * SPRING_STRENGTH);
-
- src_textp->mTargetPositionOffset += src_force;
- dst_textp->mTargetPositionOffset += dst_force;
- src_textp->mTargetPositionOffset = src_textp->updateScreenPos(src_textp->mTargetPositionOffset);
- dst_textp->mTargetPositionOffset = dst_textp->updateScreenPos(dst_textp->mTargetPositionOffset);
- }
- }
- }
- }
-
- VisibleTextObjectIterator this_object_it;
- for (this_object_it = sVisibleTextObjects.begin(); this_object_it != sVisibleTextObjects.end(); ++this_object_it)
- {
- (*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLSmoothInterpolation::getInterpolant(POSITION_DAMPING_TC));
- }
+ // iterate over all text objects, calculate their restoration forces,
+ // and add them to the visible set if they are on screen and close enough
+ sVisibleTextObjects.clear();
+
+ TextObjectIterator text_it;
+ for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
+ {
+ LLHUDNameTag* textp = (*text_it);
+ textp->mTargetPositionOffset.clearVec();
+ textp->updateSize();
+ textp->updateVisibility();
+ }
+
+ // sort back to front for rendering purposes
+ std::sort(sVisibleTextObjects.begin(), sVisibleTextObjects.end(), llhudnametag_further_away());
+
+ // iterate from front to back, and set LOD based on current screen coverage
+ F32 screen_area = (F32)(gViewerWindow->getWindowWidthScaled() * gViewerWindow->getWindowHeightScaled());
+ F32 current_screen_area = 0.f;
+ std::vector<LLPointer<LLHUDNameTag> >::reverse_iterator r_it;
+ for (r_it = sVisibleTextObjects.rbegin(); r_it != sVisibleTextObjects.rend(); ++r_it)
+ {
+ LLHUDNameTag* textp = (*r_it);
+ if (current_screen_area / screen_area > LOD_2_SCREEN_COVERAGE)
+ {
+ textp->setLOD(3);
+ }
+ else if (current_screen_area / screen_area > LOD_1_SCREEN_COVERAGE)
+ {
+ textp->setLOD(2);
+ }
+ else if (current_screen_area / screen_area > LOD_0_SCREEN_COVERAGE)
+ {
+ textp->setLOD(1);
+ }
+ else
+ {
+ textp->setLOD(0);
+ }
+ textp->updateSize();
+ // find on-screen position and initialize collision rectangle
+ textp->mTargetPositionOffset = textp->updateScreenPos(LLVector2::zero);
+ current_screen_area += (F32)(textp->mSoftScreenRect.getWidth() * textp->mSoftScreenRect.getHeight());
+ }
+
+ LLTrace::CountStatHandle<>* camera_vel_stat = LLViewerCamera::getVelocityStat();
+ F32 camera_vel = LLTrace::get_frame_recording().getLastRecording().getPerSec(*camera_vel_stat);
+ if (camera_vel > MAX_STABLE_CAMERA_VELOCITY)
+ {
+ return;
+ }
+
+ VisibleTextObjectIterator src_it;
+
+ for (S32 i = 0; i < NUM_OVERLAP_ITERATIONS; i++)
+ {
+ for (src_it = sVisibleTextObjects.begin(); src_it != sVisibleTextObjects.end(); ++src_it)
+ {
+ LLHUDNameTag* src_textp = (*src_it);
+
+ VisibleTextObjectIterator dst_it = src_it;
+ ++dst_it;
+ for (; dst_it != sVisibleTextObjects.end(); ++dst_it)
+ {
+ LLHUDNameTag* dst_textp = (*dst_it);
+
+ if (src_textp->mSoftScreenRect.overlaps(dst_textp->mSoftScreenRect))
+ {
+ LLRectf intersect_rect = src_textp->mSoftScreenRect;
+ intersect_rect.intersectWith(dst_textp->mSoftScreenRect);
+ intersect_rect.stretch(-BUFFER_SIZE * 0.5f);
+
+ F32 src_center_x = src_textp->mSoftScreenRect.getCenterX();
+ F32 src_center_y = src_textp->mSoftScreenRect.getCenterY();
+ F32 dst_center_x = dst_textp->mSoftScreenRect.getCenterX();
+ F32 dst_center_y = dst_textp->mSoftScreenRect.getCenterY();
+ F32 intersect_center_x = intersect_rect.getCenterX();
+ F32 intersect_center_y = intersect_rect.getCenterY();
+ LLVector2 force = lerp(LLVector2(dst_center_x - intersect_center_x, dst_center_y - intersect_center_y),
+ LLVector2(intersect_center_x - src_center_x, intersect_center_y - src_center_y),
+ 0.5f);
+ force.setVec(dst_center_x - src_center_x, dst_center_y - src_center_y);
+ force.normVec();
+
+ LLVector2 src_force = -1.f * force;
+ LLVector2 dst_force = force;
+
+ LLVector2 force_strength;
+ F32 src_mult = dst_textp->mMass / (dst_textp->mMass + src_textp->mMass);
+ F32 dst_mult = 1.f - src_mult;
+ F32 src_aspect_ratio = src_textp->mSoftScreenRect.getWidth() / src_textp->mSoftScreenRect.getHeight();
+ F32 dst_aspect_ratio = dst_textp->mSoftScreenRect.getWidth() / dst_textp->mSoftScreenRect.getHeight();
+ src_force.mV[VY] *= src_aspect_ratio;
+ src_force.normVec();
+ dst_force.mV[VY] *= dst_aspect_ratio;
+ dst_force.normVec();
+
+ src_force.mV[VX] *= llmin(intersect_rect.getWidth() * src_mult, intersect_rect.getHeight() * SPRING_STRENGTH);
+ src_force.mV[VY] *= llmin(intersect_rect.getHeight() * src_mult, intersect_rect.getWidth() * SPRING_STRENGTH);
+ dst_force.mV[VX] *= llmin(intersect_rect.getWidth() * dst_mult, intersect_rect.getHeight() * SPRING_STRENGTH);
+ dst_force.mV[VY] *= llmin(intersect_rect.getHeight() * dst_mult, intersect_rect.getWidth() * SPRING_STRENGTH);
+
+ src_textp->mTargetPositionOffset += src_force;
+ dst_textp->mTargetPositionOffset += dst_force;
+ src_textp->mTargetPositionOffset = src_textp->updateScreenPos(src_textp->mTargetPositionOffset);
+ dst_textp->mTargetPositionOffset = dst_textp->updateScreenPos(dst_textp->mTargetPositionOffset);
+ }
+ }
+ }
+ }
+
+ VisibleTextObjectIterator this_object_it;
+ for (this_object_it = sVisibleTextObjects.begin(); this_object_it != sVisibleTextObjects.end(); ++this_object_it)
+ {
+ (*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLSmoothInterpolation::getInterpolant(POSITION_DAMPING_TC));
+ }
}
void LLHUDNameTag::setLOD(S32 lod)
{
- mLOD = lod;
- //RN: uncomment this to visualize LOD levels
- //std::string label = llformat("%d", lod);
- //setLabel(label);
+ mLOD = lod;
+ //RN: uncomment this to visualize LOD levels
+ //std::string label = llformat("%d", lod);
+ //setLabel(label);
}
S32 LLHUDNameTag::getMaxLines()
{
- switch(mLOD)
- {
- case 0:
- return mMaxLines;
- case 1:
- return mMaxLines > 0 ? mMaxLines / 2 : 5;
- case 2:
- return mMaxLines > 0 ? mMaxLines / 3 : 2;
- default:
- // label only
- return 0;
- }
+ switch(mLOD)
+ {
+ case 0:
+ return mMaxLines;
+ case 1:
+ return mMaxLines > 0 ? mMaxLines / 2 : 5;
+ case 2:
+ return mMaxLines > 0 ? mMaxLines / 3 : 2;
+ default:
+ // label only
+ return 0;
+ }
}
void LLHUDNameTag::markDead()
{
- sTextObjects.erase(LLPointer<LLHUDNameTag>(this));
- LLHUDObject::markDead();
+ sTextObjects.erase(LLPointer<LLHUDNameTag>(this));
+ LLHUDObject::markDead();
}
void LLHUDNameTag::shiftAll(const LLVector3& offset)
{
- TextObjectIterator text_it;
- for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
- {
- LLHUDNameTag *textp = text_it->get();
- textp->shift(offset);
- }
+ TextObjectIterator text_it;
+ for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
+ {
+ LLHUDNameTag *textp = text_it->get();
+ textp->shift(offset);
+ }
}
void LLHUDNameTag::shift(const LLVector3& offset)
{
- mPositionAgent += offset;
+ mPositionAgent += offset;
}
F32 LLHUDNameTag::getWorldHeight() const
{
- const LLViewerCamera* camera = LLViewerCamera::getInstance();
- F32 height_meters = mLastDistance * (F32)tan(camera->getView() / 2.f);
- F32 height_pixels = camera->getViewHeightInPixels() / 2.f;
- F32 meters_per_pixel = height_meters / height_pixels;
- return mHeight * meters_per_pixel * gViewerWindow->getDisplayScale().mV[VY];
+ const LLViewerCamera* camera = LLViewerCamera::getInstance();
+ F32 height_meters = mLastDistance * (F32)tan(camera->getView() / 2.f);
+ F32 height_pixels = camera->getViewHeightInPixels() / 2.f;
+ F32 meters_per_pixel = height_meters / height_pixels;
+ return mHeight * meters_per_pixel * gViewerWindow->getDisplayScale().mV[VY];
}
-//static
+//static
void LLHUDNameTag::addPickable(std::set<LLViewerObject*> &pick_list)
{
- //this might put an object on the pick list a second time, overriding it's mGLName, which is ok
- // *FIX: we should probably cull against pick frustum
- VisibleTextObjectIterator text_it;
- for (text_it = sVisibleTextObjects.begin(); text_it != sVisibleTextObjects.end(); ++text_it)
- {
- pick_list.insert((*text_it)->mSourceObject);
- }
+ //this might put an object on the pick list a second time, overriding it's mGLName, which is ok
+ // *FIX: we should probably cull against pick frustum
+ VisibleTextObjectIterator text_it;
+ for (text_it = sVisibleTextObjects.begin(); text_it != sVisibleTextObjects.end(); ++text_it)
+ {
+ pick_list.insert((*text_it)->mSourceObject);
+ }
}
//static
// called when UI scale changes, to flush font width caches
void LLHUDNameTag::reshape()
{
- TextObjectIterator text_it;
- for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
- {
- LLHUDNameTag* textp = (*text_it);
- std::vector<LLHUDTextSegment>::iterator segment_iter;
- for (segment_iter = textp->mTextSegments.begin();
- segment_iter != textp->mTextSegments.end(); ++segment_iter )
- {
- segment_iter->clearFontWidthMap();
- }
- for(segment_iter = textp->mLabelSegments.begin();
- segment_iter != textp->mLabelSegments.end(); ++segment_iter )
- {
- segment_iter->clearFontWidthMap();
- }
- }
+ TextObjectIterator text_it;
+ for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
+ {
+ LLHUDNameTag* textp = (*text_it);
+ std::vector<LLHUDTextSegment>::iterator segment_iter;
+ for (segment_iter = textp->mTextSegments.begin();
+ segment_iter != textp->mTextSegments.end(); ++segment_iter )
+ {
+ segment_iter->clearFontWidthMap();
+ }
+ for(segment_iter = textp->mLabelSegments.begin();
+ segment_iter != textp->mLabelSegments.end(); ++segment_iter )
+ {
+ segment_iter->clearFontWidthMap();
+ }
+ }
}
//============================================================================
F32 LLHUDNameTag::LLHUDTextSegment::getWidth(const LLFontGL* font)
{
- std::map<const LLFontGL*, F32>::iterator iter = mFontWidthMap.find(font);
- if (iter != mFontWidthMap.end())
- {
- return iter->second;
- }
- else
- {
- F32 width = font->getWidthF32(mText.c_str());
- mFontWidthMap[font] = width;
- return width;
- }
+ std::map<const LLFontGL*, F32>::iterator iter = mFontWidthMap.find(font);
+ if (iter != mFontWidthMap.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ F32 width = font->getWidthF32(mText.c_str());
+ mFontWidthMap[font] = width;
+ return width;
+ }
}
diff --git a/indra/newview/llhudnametag.h b/indra/newview/llhudnametag.h
index 592ab5518f..36d774cccf 100644
--- a/indra/newview/llhudnametag.h
+++ b/indra/newview/llhudnametag.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llhudnametag.h
* @brief Name tags for avatars
* @author James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,57 +45,57 @@ class LLUIImage;
struct llhudnametag_further_away
{
- bool operator()(const LLPointer<LLHUDNameTag>& lhs, const LLPointer<LLHUDNameTag>& rhs) const;
+ bool operator()(const LLPointer<LLHUDNameTag>& lhs, const LLPointer<LLHUDNameTag>& rhs) const;
};
class LLHUDNameTag : public LLHUDObject
{
protected:
- class LLHUDTextSegment
- {
- public:
- LLHUDTextSegment(const LLWString& text, const LLFontGL::StyleFlags style, const LLColor4& color, const LLFontGL* font)
- : mColor(color),
- mStyle(style),
- mText(text),
- mFont(font)
- {}
- F32 getWidth(const LLFontGL* font);
- const LLWString& getText() const { return mText; }
- void clearFontWidthMap() { mFontWidthMap.clear(); }
-
- LLColor4 mColor;
- LLFontGL::StyleFlags mStyle;
- const LLFontGL* mFont;
- private:
- LLWString mText;
- std::map<const LLFontGL*, F32> mFontWidthMap;
- };
+ class LLHUDTextSegment
+ {
+ public:
+ LLHUDTextSegment(const LLWString& text, const LLFontGL::StyleFlags style, const LLColor4& color, const LLFontGL* font)
+ : mColor(color),
+ mStyle(style),
+ mText(text),
+ mFont(font)
+ {}
+ F32 getWidth(const LLFontGL* font);
+ const LLWString& getText() const { return mText; }
+ void clearFontWidthMap() { mFontWidthMap.clear(); }
+
+ LLColor4 mColor;
+ LLFontGL::StyleFlags mStyle;
+ const LLFontGL* mFont;
+ private:
+ LLWString mText;
+ std::map<const LLFontGL*, F32> mFontWidthMap;
+ };
public:
- typedef enum e_text_alignment
- {
- ALIGN_TEXT_LEFT,
- ALIGN_TEXT_CENTER
- } ETextAlignment;
-
- typedef enum e_vert_alignment
- {
- ALIGN_VERT_TOP,
- ALIGN_VERT_CENTER
- } EVertAlignment;
+ typedef enum e_text_alignment
+ {
+ ALIGN_TEXT_LEFT,
+ ALIGN_TEXT_CENTER
+ } ETextAlignment;
+
+ typedef enum e_vert_alignment
+ {
+ ALIGN_VERT_TOP,
+ ALIGN_VERT_CENTER
+ } EVertAlignment;
static const F32 NAMETAG_MAX_WIDTH; // 298px, made to fit 31 M's
static const F32 HUD_TEXT_MAX_WIDTH; // 190px
public:
- // Set entire string, eliminating existing lines
- void setString(const std::string& text_utf8);
+ // Set entire string, eliminating existing lines
+ void setString(const std::string& text_utf8);
- void clearString();
+ void clearString();
- // Add text a line at a time, allowing custom formatting
- void addLine(
+ // Add text a line at a time, allowing custom formatting
+ void addLine(
const std::string &text_utf8,
const LLColor4& color,
const LLFontGL::StyleFlags style = LLFontGL::NORMAL,
@@ -103,93 +103,93 @@ public:
const bool use_ellipses = false,
F32 max_pixels = HUD_TEXT_MAX_WIDTH);
- // For bubble chat, set the part above the chat text
- void setLabel(const std::string& label_utf8);
- void addLabel(const std::string& label_utf8, F32 max_pixels = HUD_TEXT_MAX_WIDTH);
-
- // Sets the default font for lines with no font specified
- void setFont(const LLFontGL* font);
- void setColor(const LLColor4 &color);
- void setAlpha(F32 alpha);
- void setZCompare(const BOOL zcompare);
- void setDoFade(const BOOL do_fade);
- void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; }
-
- // mMaxLines of -1 means unlimited lines.
- void setMaxLines(S32 max_lines) { mMaxLines = max_lines; }
- void setFadeDistance(F32 fade_distance, F32 fade_range) { mFadeDistance = fade_distance; mFadeRange = fade_range; }
- void updateVisibility();
- LLVector2 updateScreenPos(LLVector2 &offset_target);
- void updateSize();
-// void setMass(F32 mass) { mMass = llmax(0.1f, mass); }
- void setTextAlignment(ETextAlignment alignment) { mTextAlignment = alignment; }
- void setVertAlignment(EVertAlignment alignment) { mVertAlignment = alignment; }
- /*virtual*/ void markDead();
- friend class LLHUDObject;
- /*virtual*/ F32 getDistance() const { return mLastDistance; }
- S32 getLOD() const { return mLOD; }
- BOOL getVisible() const { return mVisible; }
- BOOL getHidden() const { return mHidden; }
- void setHidden( BOOL hide ) { mHidden = hide; }
- void shift(const LLVector3& offset);
- F32 getWorldHeight() const;
-
- BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, BOOL debug_render = FALSE);
-
- static void shiftAll(const LLVector3& offset);
- static void addPickable(std::set<LLViewerObject*> &pick_list);
- static void reshape();
- static void setDisplayText(BOOL flag) { sDisplayText = flag ; }
+ // For bubble chat, set the part above the chat text
+ void setLabel(const std::string& label_utf8);
+ void addLabel(const std::string& label_utf8, F32 max_pixels = HUD_TEXT_MAX_WIDTH);
+
+ // Sets the default font for lines with no font specified
+ void setFont(const LLFontGL* font);
+ void setColor(const LLColor4 &color);
+ void setAlpha(F32 alpha);
+ void setZCompare(const BOOL zcompare);
+ void setDoFade(const BOOL do_fade);
+ void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; }
+
+ // mMaxLines of -1 means unlimited lines.
+ void setMaxLines(S32 max_lines) { mMaxLines = max_lines; }
+ void setFadeDistance(F32 fade_distance, F32 fade_range) { mFadeDistance = fade_distance; mFadeRange = fade_range; }
+ void updateVisibility();
+ LLVector2 updateScreenPos(LLVector2 &offset_target);
+ void updateSize();
+// void setMass(F32 mass) { mMass = llmax(0.1f, mass); }
+ void setTextAlignment(ETextAlignment alignment) { mTextAlignment = alignment; }
+ void setVertAlignment(EVertAlignment alignment) { mVertAlignment = alignment; }
+ /*virtual*/ void markDead();
+ friend class LLHUDObject;
+ /*virtual*/ F32 getDistance() const { return mLastDistance; }
+ S32 getLOD() const { return mLOD; }
+ BOOL getVisible() const { return mVisible; }
+ BOOL getHidden() const { return mHidden; }
+ void setHidden( BOOL hide ) { mHidden = hide; }
+ void shift(const LLVector3& offset);
+ F32 getWorldHeight() const;
+
+ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, BOOL debug_render = FALSE);
+
+ static void shiftAll(const LLVector3& offset);
+ static void addPickable(std::set<LLViewerObject*> &pick_list);
+ static void reshape();
+ static void setDisplayText(BOOL flag) { sDisplayText = flag ; }
protected:
- LLHUDNameTag(const U8 type);
+ LLHUDNameTag(const U8 type);
- /*virtual*/ void render();
- void renderText(BOOL for_select);
- static void updateAll();
- void setLOD(S32 lod);
- S32 getMaxLines();
+ /*virtual*/ void render();
+ void renderText(BOOL for_select);
+ static void updateAll();
+ void setLOD(S32 lod);
+ S32 getMaxLines();
private:
- ~LLHUDNameTag();
- BOOL mDoFade;
- F32 mFadeRange;
- F32 mFadeDistance;
- F32 mLastDistance;
- BOOL mZCompare;
- BOOL mVisibleOffScreen;
- BOOL mOffscreen;
- LLColor4 mColor;
-// LLVector3 mScale;
- F32 mWidth;
- F32 mHeight;
-// LLColor4U mPickColor;
- const LLFontGL* mFontp;
- const LLFontGL* mBoldFontp;
- LLRectf mSoftScreenRect;
- LLVector3 mPositionAgent;
- LLVector2 mPositionOffset;
- LLVector2 mTargetPositionOffset;
- F32 mMass;
- S32 mMaxLines;
- S32 mOffsetY;
- F32 mRadius;
- std::vector<LLHUDTextSegment> mTextSegments;
- std::vector<LLHUDTextSegment> mLabelSegments;
-// LLFrameTimer mResizeTimer;
- ETextAlignment mTextAlignment;
- EVertAlignment mVertAlignment;
- S32 mLOD;
- BOOL mHidden;
- LLPointer<LLUIImage> mRoundedRectImgp;
- LLPointer<LLUIImage> mRoundedRectTopImgp;
-
- static BOOL sDisplayText ;
- static std::set<LLPointer<LLHUDNameTag> > sTextObjects;
- static std::vector<LLPointer<LLHUDNameTag> > sVisibleTextObjects;
-// static std::vector<LLPointer<LLHUDNameTag> > sVisibleHUDTextObjects;
- typedef std::set<LLPointer<LLHUDNameTag> >::iterator TextObjectIterator;
- typedef std::vector<LLPointer<LLHUDNameTag> >::iterator VisibleTextObjectIterator;
+ ~LLHUDNameTag();
+ BOOL mDoFade;
+ F32 mFadeRange;
+ F32 mFadeDistance;
+ F32 mLastDistance;
+ BOOL mZCompare;
+ BOOL mVisibleOffScreen;
+ BOOL mOffscreen;
+ LLColor4 mColor;
+// LLVector3 mScale;
+ F32 mWidth;
+ F32 mHeight;
+// LLColor4U mPickColor;
+ const LLFontGL* mFontp;
+ const LLFontGL* mBoldFontp;
+ LLRectf mSoftScreenRect;
+ LLVector3 mPositionAgent;
+ LLVector2 mPositionOffset;
+ LLVector2 mTargetPositionOffset;
+ F32 mMass;
+ S32 mMaxLines;
+ S32 mOffsetY;
+ F32 mRadius;
+ std::vector<LLHUDTextSegment> mTextSegments;
+ std::vector<LLHUDTextSegment> mLabelSegments;
+// LLFrameTimer mResizeTimer;
+ ETextAlignment mTextAlignment;
+ EVertAlignment mVertAlignment;
+ S32 mLOD;
+ BOOL mHidden;
+ LLPointer<LLUIImage> mRoundedRectImgp;
+ LLPointer<LLUIImage> mRoundedRectTopImgp;
+
+ static BOOL sDisplayText ;
+ static std::set<LLPointer<LLHUDNameTag> > sTextObjects;
+ static std::vector<LLPointer<LLHUDNameTag> > sVisibleTextObjects;
+// static std::vector<LLPointer<LLHUDNameTag> > sVisibleHUDTextObjects;
+ typedef std::set<LLPointer<LLHUDNameTag> >::iterator TextObjectIterator;
+ typedef std::vector<LLPointer<LLHUDNameTag> >::iterator VisibleTextObjectIterator;
};
#endif
diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp
index 292045f25d..e922e8230c 100644
--- a/indra/newview/llhudobject.cpp
+++ b/indra/newview/llhudobject.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudobject.cpp
* @brief LLHUDObject class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2002-2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,24 +46,24 @@ std::list<LLPointer<LLHUDObject> > LLHUDObject::sHUDObjects;
struct hud_object_further_away
{
- bool operator()(const LLPointer<LLHUDObject>& lhs, const LLPointer<LLHUDObject>& rhs) const;
+ bool operator()(const LLPointer<LLHUDObject>& lhs, const LLPointer<LLHUDObject>& rhs) const;
};
bool hud_object_further_away::operator()(const LLPointer<LLHUDObject>& lhs, const LLPointer<LLHUDObject>& rhs) const
{
- return (lhs->getDistance() > rhs->getDistance()) ? true : false;
+ return (lhs->getDistance() > rhs->getDistance()) ? true : false;
}
-LLHUDObject::LLHUDObject(const U8 type) :
- mPositionGlobal(),
- mSourceObject(NULL),
- mTargetObject(NULL)
+LLHUDObject::LLHUDObject(const U8 type) :
+ mPositionGlobal(),
+ mSourceObject(NULL),
+ mTargetObject(NULL)
{
- mVisible = TRUE;
- mType = type;
- mDead = FALSE;
+ mVisible = TRUE;
+ mType = type;
+ mDead = FALSE;
}
LLHUDObject::~LLHUDObject()
@@ -72,184 +72,184 @@ LLHUDObject::~LLHUDObject()
void LLHUDObject::markDead()
{
- mVisible = FALSE;
- mDead = TRUE;
- mSourceObject = NULL;
- mTargetObject = NULL;
+ mVisible = FALSE;
+ mDead = TRUE;
+ mSourceObject = NULL;
+ mTargetObject = NULL;
}
F32 LLHUDObject::getDistance() const
{
- return 0.f;
+ return 0.f;
}
void LLHUDObject::setSourceObject(LLViewerObject* objectp)
{
- if (objectp == mSourceObject)
- {
- return;
- }
+ if (objectp == mSourceObject)
+ {
+ return;
+ }
- mSourceObject = objectp;
+ mSourceObject = objectp;
}
void LLHUDObject::setTargetObject(LLViewerObject* objectp)
{
- if (objectp == mTargetObject)
- {
- return;
- }
+ if (objectp == mTargetObject)
+ {
+ return;
+ }
- mTargetObject = objectp;
+ mTargetObject = objectp;
}
void LLHUDObject::setPositionGlobal(const LLVector3d &position_global)
{
- mPositionGlobal = position_global;
+ mPositionGlobal = position_global;
}
void LLHUDObject::setPositionAgent(const LLVector3 &position_agent)
{
- mPositionGlobal = gAgent.getPosGlobalFromAgent(position_agent);
+ mPositionGlobal = gAgent.getPosGlobalFromAgent(position_agent);
}
// static
void LLHUDObject::cleanupHUDObjects()
{
- LLHUDIcon::cleanupDeadIcons();
- hud_object_list_t::iterator object_it;
- for (object_it = sHUDObjects.begin(); object_it != sHUDObjects.end(); ++object_it)
- {
- (*object_it)->markDead();
- if ((*object_it)->getNumRefs() > 1)
- {
- LL_INFOS() << "LLHUDObject " << (LLHUDObject *)(*object_it) << " type " << (S32)(*object_it)->getType() << " has " << (*object_it)->getNumRefs() << " refs!" << LL_ENDL;
- }
- }
- sHUDObjects.clear();
+ LLHUDIcon::cleanupDeadIcons();
+ hud_object_list_t::iterator object_it;
+ for (object_it = sHUDObjects.begin(); object_it != sHUDObjects.end(); ++object_it)
+ {
+ (*object_it)->markDead();
+ if ((*object_it)->getNumRefs() > 1)
+ {
+ LL_INFOS() << "LLHUDObject " << (LLHUDObject *)(*object_it) << " type " << (S32)(*object_it)->getType() << " has " << (*object_it)->getNumRefs() << " refs!" << LL_ENDL;
+ }
+ }
+ sHUDObjects.clear();
}
// static
LLHUDObject *LLHUDObject::addHUDObject(const U8 type)
{
- LLHUDObject *hud_objectp = NULL;
-
- switch (type)
- {
- case LL_HUD_TEXT:
- hud_objectp = new LLHUDText(type);
- break;
- case LL_HUD_ICON:
- hud_objectp = new LLHUDIcon(type);
- break;
- case LL_HUD_NAME_TAG:
- hud_objectp = new LLHUDNameTag(type);
- break;
- default:
- LL_WARNS() << "Unknown type of hud object:" << (U32) type << LL_ENDL;
- }
- if (hud_objectp)
- {
- sHUDObjects.push_back(hud_objectp);
- }
- return hud_objectp;
+ LLHUDObject *hud_objectp = NULL;
+
+ switch (type)
+ {
+ case LL_HUD_TEXT:
+ hud_objectp = new LLHUDText(type);
+ break;
+ case LL_HUD_ICON:
+ hud_objectp = new LLHUDIcon(type);
+ break;
+ case LL_HUD_NAME_TAG:
+ hud_objectp = new LLHUDNameTag(type);
+ break;
+ default:
+ LL_WARNS() << "Unknown type of hud object:" << (U32) type << LL_ENDL;
+ }
+ if (hud_objectp)
+ {
+ sHUDObjects.push_back(hud_objectp);
+ }
+ return hud_objectp;
}
LLHUDEffect *LLHUDObject::addHUDEffect(const U8 type)
{
- LLHUDEffect *hud_objectp = NULL;
-
- switch (type)
- {
- case LL_HUD_EFFECT_BEAM:
- hud_objectp = new LLHUDEffectSpiral(type);
- ((LLHUDEffectSpiral *)hud_objectp)->setDuration(0.7f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVMag(0.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(0.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(0.1f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(0.2f);
- ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(10.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(0.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.05f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.02f);
- ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
- break;
- case LL_HUD_EFFECT_GLOW:
- // deprecated
- break;
- case LL_HUD_EFFECT_POINT:
- hud_objectp = new LLHUDEffectSpiral(type);
- ((LLHUDEffectSpiral *)hud_objectp)->setDuration(0.5f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVMag(1.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(0.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(0.5f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(1.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(10.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(0.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.1f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.1f);
- ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
- break;
- case LL_HUD_EFFECT_SPHERE:
- hud_objectp = new LLHUDEffectSpiral(type);
- ((LLHUDEffectSpiral *)hud_objectp)->setDuration(0.5f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVMag(1.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(0.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(0.5f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(0.5f);
- ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(20.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(0.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.1f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.1f);
- ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
- break;
- case LL_HUD_EFFECT_SPIRAL:
- hud_objectp = new LLHUDEffectSpiral(type);
- ((LLHUDEffectSpiral *)hud_objectp)->setDuration(2.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVMag(-2.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(0.5f);
- ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(1.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(0.5f);
- ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(10.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(20.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.02f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.02f);
- ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
- break;
- case LL_HUD_EFFECT_EDIT:
- hud_objectp = new LLHUDEffectSpiral(type);
- ((LLHUDEffectSpiral *)hud_objectp)->setDuration(2.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVMag(2.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(-1.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(1.5f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(1.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(4.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(200.f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.1f);
- ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.1f);
- ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
- break;
- case LL_HUD_EFFECT_LOOKAT:
- hud_objectp = new LLHUDEffectLookAt(type);
- break;
- case LL_HUD_EFFECT_VOICE_VISUALIZER:
- hud_objectp = new LLVoiceVisualizer(type);
- break;
- case LL_HUD_EFFECT_POINTAT:
- hud_objectp = new LLHUDEffectPointAt(type);
- break;
- case LL_HUD_EFFECT_BLOB:
- hud_objectp = new LLHUDEffectBlob(type);
- break;
- default:
- LL_WARNS() << "Unknown type of hud effect:" << (U32) type << LL_ENDL;
- }
-
- if (hud_objectp)
- {
- sHUDObjects.push_back(hud_objectp);
- }
- return hud_objectp;
+ LLHUDEffect *hud_objectp = NULL;
+
+ switch (type)
+ {
+ case LL_HUD_EFFECT_BEAM:
+ hud_objectp = new LLHUDEffectSpiral(type);
+ ((LLHUDEffectSpiral *)hud_objectp)->setDuration(0.7f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVMag(0.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(0.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(0.1f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(0.2f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(10.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(0.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.05f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.02f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
+ break;
+ case LL_HUD_EFFECT_GLOW:
+ // deprecated
+ break;
+ case LL_HUD_EFFECT_POINT:
+ hud_objectp = new LLHUDEffectSpiral(type);
+ ((LLHUDEffectSpiral *)hud_objectp)->setDuration(0.5f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVMag(1.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(0.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(0.5f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(1.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(10.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(0.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.1f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.1f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
+ break;
+ case LL_HUD_EFFECT_SPHERE:
+ hud_objectp = new LLHUDEffectSpiral(type);
+ ((LLHUDEffectSpiral *)hud_objectp)->setDuration(0.5f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVMag(1.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(0.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(0.5f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(0.5f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(20.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(0.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.1f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.1f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
+ break;
+ case LL_HUD_EFFECT_SPIRAL:
+ hud_objectp = new LLHUDEffectSpiral(type);
+ ((LLHUDEffectSpiral *)hud_objectp)->setDuration(2.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVMag(-2.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(0.5f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(1.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(0.5f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(10.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(20.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.02f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.02f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
+ break;
+ case LL_HUD_EFFECT_EDIT:
+ hud_objectp = new LLHUDEffectSpiral(type);
+ ((LLHUDEffectSpiral *)hud_objectp)->setDuration(2.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVMag(2.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setVOffset(-1.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setInitialRadius(1.5f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFinalRadius(1.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setSpinRate(4.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setFlickerRate(200.f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleBase(0.1f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setScaleVar(0.1f);
+ ((LLHUDEffectSpiral *)hud_objectp)->setColor(LLColor4U(255, 255, 255, 255));
+ break;
+ case LL_HUD_EFFECT_LOOKAT:
+ hud_objectp = new LLHUDEffectLookAt(type);
+ break;
+ case LL_HUD_EFFECT_VOICE_VISUALIZER:
+ hud_objectp = new LLVoiceVisualizer(type);
+ break;
+ case LL_HUD_EFFECT_POINTAT:
+ hud_objectp = new LLHUDEffectPointAt(type);
+ break;
+ case LL_HUD_EFFECT_BLOB:
+ hud_objectp = new LLHUDEffectBlob(type);
+ break;
+ default:
+ LL_WARNS() << "Unknown type of hud effect:" << (U32) type << LL_ENDL;
+ }
+
+ if (hud_objectp)
+ {
+ sHUDObjects.push_back(hud_objectp);
+ }
+ return hud_objectp;
}
static LLTrace::BlockTimerStatHandle FTM_HUD_UPDATE("Update Hud");
@@ -257,11 +257,11 @@ static LLTrace::BlockTimerStatHandle FTM_HUD_UPDATE("Update Hud");
// static
void LLHUDObject::updateAll()
{
- LL_RECORD_BLOCK_TIME(FTM_HUD_UPDATE);
- LLHUDText::updateAll();
- LLHUDIcon::updateAll();
- LLHUDNameTag::updateAll();
- sortObjects();
+ LL_RECORD_BLOCK_TIME(FTM_HUD_UPDATE);
+ LLHUDText::updateAll();
+ LLHUDIcon::updateAll();
+ LLHUDNameTag::updateAll();
+ sortObjects();
}
// static
@@ -274,58 +274,58 @@ void LLHUDObject::renderAll()
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
- LLHUDObject *hud_objp;
-
- hud_object_list_t::iterator object_it;
- for (object_it = sHUDObjects.begin(); object_it != sHUDObjects.end(); )
- {
- hud_object_list_t::iterator cur_it = object_it++;
- hud_objp = (*cur_it);
- if (hud_objp->getNumRefs() == 1)
- {
- sHUDObjects.erase(cur_it);
- }
- else if (hud_objp->isVisible())
- {
- hud_objp->render();
- }
- }
-
- LLVertexBuffer::unbind();
+ LLHUDObject *hud_objp;
+
+ hud_object_list_t::iterator object_it;
+ for (object_it = sHUDObjects.begin(); object_it != sHUDObjects.end(); )
+ {
+ hud_object_list_t::iterator cur_it = object_it++;
+ hud_objp = (*cur_it);
+ if (hud_objp->getNumRefs() == 1)
+ {
+ sHUDObjects.erase(cur_it);
+ }
+ else if (hud_objp->isVisible())
+ {
+ hud_objp->render();
+ }
+ }
+
+ LLVertexBuffer::unbind();
gUIProgram.unbind();
}
// static
void LLHUDObject::renderAllForTimer()
{
- LLHUDObject *hud_objp;
-
- hud_object_list_t::iterator object_it;
- for (object_it = sHUDObjects.begin(); object_it != sHUDObjects.end(); )
- {
- hud_object_list_t::iterator cur_it = object_it++;
- hud_objp = (*cur_it);
- if (hud_objp->getNumRefs() == 1)
- {
- sHUDObjects.erase(cur_it);
- }
- else if (hud_objp->isVisible())
- {
- hud_objp->renderForTimer();
- }
- }
+ LLHUDObject *hud_objp;
+
+ hud_object_list_t::iterator object_it;
+ for (object_it = sHUDObjects.begin(); object_it != sHUDObjects.end(); )
+ {
+ hud_object_list_t::iterator cur_it = object_it++;
+ hud_objp = (*cur_it);
+ if (hud_objp->getNumRefs() == 1)
+ {
+ sHUDObjects.erase(cur_it);
+ }
+ else if (hud_objp->isVisible())
+ {
+ hud_objp->renderForTimer();
+ }
+ }
}
// static
void LLHUDObject::reshapeAll()
{
- // only hud objects that use fonts care about window size/scale changes
- LLHUDText::reshape();
- LLHUDNameTag::reshape();
+ // only hud objects that use fonts care about window size/scale changes
+ LLHUDText::reshape();
+ LLHUDNameTag::reshape();
}
// static
void LLHUDObject::sortObjects()
{
- sHUDObjects.sort(hud_object_further_away());
+ sHUDObjects.sort(hud_object_further_away());
}
diff --git a/indra/newview/llhudobject.h b/indra/newview/llhudobject.h
index ce128519ea..13953d2329 100644
--- a/indra/newview/llhudobject.h
+++ b/indra/newview/llhudobject.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudobject.h
* @brief LLHUDObject class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,7 +36,7 @@
#include "v4color.h"
#include "v3math.h"
#include "v3dmath.h"
-#include "lldrawpool.h" // TODO: eliminate, unused below
+#include "lldrawpool.h" // TODO: eliminate, unused below
#include <list>
class LLViewerCamera;
@@ -48,76 +48,76 @@ class LLHUDEffect;
class LLHUDObject : public LLRefCount
{
public:
- virtual void markDead();
- virtual F32 getDistance() const;
- virtual void setSourceObject(LLViewerObject* objectp);
- virtual void setTargetObject(LLViewerObject* objectp);
- virtual LLViewerObject* getSourceObject() { return mSourceObject; }
- virtual LLViewerObject* getTargetObject() { return mTargetObject; }
-
- void setPositionGlobal(const LLVector3d &position_global);
- void setPositionAgent(const LLVector3 &position_agent);
-
- BOOL isVisible() const { return mVisible; }
-
- U8 getType() const { return mType; }
-
- LLVector3d getPositionGlobal() const { return mPositionGlobal; }
-
- static LLHUDObject *addHUDObject(const U8 type);
- static LLHUDEffect *addHUDEffect(const U8 type);
- static void updateAll();
- static void renderAll();
- static void renderAllForSelect();
- static void renderAllForTimer();
-
- // Some objects may need to update when window shape changes
- static void reshapeAll();
-
- static void cleanupHUDObjects();
-
- enum
- {
- LL_HUD_TEXT,
- LL_HUD_ICON,
- LL_HUD_CONNECTOR,
- LL_HUD_FLEXIBLE_OBJECT, // Ventrella
- LL_HUD_ANIMAL_CONTROLS, // Ventrella
- LL_HUD_LOCAL_ANIMATION_OBJECT, // Ventrella
- LL_HUD_CLOTH, // Ventrella
- LL_HUD_EFFECT_BEAM,
- LL_HUD_EFFECT_GLOW,
- LL_HUD_EFFECT_POINT,
- LL_HUD_EFFECT_TRAIL,
- LL_HUD_EFFECT_SPHERE,
- LL_HUD_EFFECT_SPIRAL,
- LL_HUD_EFFECT_EDIT,
- LL_HUD_EFFECT_LOOKAT,
- LL_HUD_EFFECT_POINTAT,
- LL_HUD_EFFECT_VOICE_VISUALIZER, // Ventrella
- LL_HUD_NAME_TAG,
- LL_HUD_EFFECT_BLOB
- };
+ virtual void markDead();
+ virtual F32 getDistance() const;
+ virtual void setSourceObject(LLViewerObject* objectp);
+ virtual void setTargetObject(LLViewerObject* objectp);
+ virtual LLViewerObject* getSourceObject() { return mSourceObject; }
+ virtual LLViewerObject* getTargetObject() { return mTargetObject; }
+
+ void setPositionGlobal(const LLVector3d &position_global);
+ void setPositionAgent(const LLVector3 &position_agent);
+
+ BOOL isVisible() const { return mVisible; }
+
+ U8 getType() const { return mType; }
+
+ LLVector3d getPositionGlobal() const { return mPositionGlobal; }
+
+ static LLHUDObject *addHUDObject(const U8 type);
+ static LLHUDEffect *addHUDEffect(const U8 type);
+ static void updateAll();
+ static void renderAll();
+ static void renderAllForSelect();
+ static void renderAllForTimer();
+
+ // Some objects may need to update when window shape changes
+ static void reshapeAll();
+
+ static void cleanupHUDObjects();
+
+ enum
+ {
+ LL_HUD_TEXT,
+ LL_HUD_ICON,
+ LL_HUD_CONNECTOR,
+ LL_HUD_FLEXIBLE_OBJECT, // Ventrella
+ LL_HUD_ANIMAL_CONTROLS, // Ventrella
+ LL_HUD_LOCAL_ANIMATION_OBJECT, // Ventrella
+ LL_HUD_CLOTH, // Ventrella
+ LL_HUD_EFFECT_BEAM,
+ LL_HUD_EFFECT_GLOW,
+ LL_HUD_EFFECT_POINT,
+ LL_HUD_EFFECT_TRAIL,
+ LL_HUD_EFFECT_SPHERE,
+ LL_HUD_EFFECT_SPIRAL,
+ LL_HUD_EFFECT_EDIT,
+ LL_HUD_EFFECT_LOOKAT,
+ LL_HUD_EFFECT_POINTAT,
+ LL_HUD_EFFECT_VOICE_VISUALIZER, // Ventrella
+ LL_HUD_NAME_TAG,
+ LL_HUD_EFFECT_BLOB
+ };
protected:
- static void sortObjects();
+ static void sortObjects();
+
+ LLHUDObject(const U8 type);
+ virtual ~LLHUDObject();
- LLHUDObject(const U8 type);
- virtual ~LLHUDObject();
+ virtual void render() = 0;
+ virtual void renderForTimer() {};
- virtual void render() = 0;
- virtual void renderForTimer() {};
-
protected:
- U8 mType;
- BOOL mDead;
- BOOL mVisible;
- LLVector3d mPositionGlobal;
- LLPointer<LLViewerObject> mSourceObject;
- LLPointer<LLViewerObject> mTargetObject;
+ U8 mType;
+ BOOL mDead;
+ BOOL mVisible;
+ LLVector3d mPositionGlobal;
+ LLPointer<LLViewerObject> mSourceObject;
+ LLPointer<LLViewerObject> mTargetObject;
private:
- typedef std::list<LLPointer<LLHUDObject> > hud_object_list_t;
- static hud_object_list_t sHUDObjects;
+ typedef std::list<LLPointer<LLHUDObject> > hud_object_list_t;
+ static hud_object_list_t sHUDObjects;
};
#endif // LL_LLHUDOBJECT_H
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index c1f17c9d33..e862fc7bc1 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudrender.cpp
* @brief LLHUDRender class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,111 +39,111 @@
#include "llui.h"
void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent,
- const LLFontGL &font,
- const U8 style,
- const LLFontGL::ShadowType shadow,
- const F32 x_offset, const F32 y_offset,
- const LLColor4& color,
- const BOOL orthographic)
+ const LLFontGL &font,
+ const U8 style,
+ const LLFontGL::ShadowType shadow,
+ const F32 x_offset, const F32 y_offset,
+ const LLColor4& color,
+ const BOOL orthographic)
{
- LLWString wstr(utf8str_to_wstring(str));
- hud_render_text(wstr, pos_agent, font, style, shadow, x_offset, y_offset, color, orthographic);
+ LLWString wstr(utf8str_to_wstring(str));
+ hud_render_text(wstr, pos_agent, font, style, shadow, x_offset, y_offset, color, orthographic);
}
void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
- const LLFontGL &font,
- const U8 style,
- const LLFontGL::ShadowType shadow,
- const F32 x_offset, const F32 y_offset,
- const LLColor4& color,
- const BOOL orthographic)
+ const LLFontGL &font,
+ const U8 style,
+ const LLFontGL::ShadowType shadow,
+ const F32 x_offset, const F32 y_offset,
+ const LLColor4& color,
+ const BOOL orthographic)
{
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- // Do cheap plane culling
- LLVector3 dir_vec = pos_agent - camera->getOrigin();
- dir_vec /= dir_vec.magVec();
-
- if (wstr.empty() || (!orthographic && dir_vec * camera->getAtAxis() <= 0.f))
- {
- return;
- }
-
- LLVector3 right_axis;
- LLVector3 up_axis;
- if (orthographic)
- {
- right_axis.setVec(0.f, -1.f / gViewerWindow->getWorldViewHeightScaled(), 0.f);
- up_axis.setVec(0.f, 0.f, 1.f / gViewerWindow->getWorldViewHeightScaled());
- }
- else
- {
- camera->getPixelVectors(pos_agent, up_axis, right_axis);
- }
- LLCoordFrame render_frame = *camera;
- LLQuaternion rot;
- if (!orthographic)
- {
- rot = render_frame.getQuaternion();
- rot = rot * LLQuaternion(-F_PI_BY_TWO, camera->getYAxis());
- rot = rot * LLQuaternion(F_PI_BY_TWO, camera->getXAxis());
- }
- else
- {
- rot = LLQuaternion(-F_PI_BY_TWO, LLVector3(0.f, 0.f, 1.f));
- rot = rot * LLQuaternion(-F_PI_BY_TWO, LLVector3(0.f, 1.f, 0.f));
- }
- F32 angle;
- LLVector3 axis;
- rot.getAngleAxis(&angle, axis);
-
- LLVector3 render_pos = pos_agent + (floorf(x_offset) * right_axis) + (floorf(y_offset) * up_axis);
-
- //get the render_pos in screen space
-
- F64 winX, winY, winZ;
- LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
- S32 viewport[4];
- viewport[0] = world_view_rect.mLeft;
- viewport[1] = world_view_rect.mBottom;
- viewport[2] = world_view_rect.getWidth();
- viewport[3] = world_view_rect.getHeight();
-
- F64 mdlv[16];
- F64 proj[16];
-
- for (U32 i = 0; i < 16; i++)
- {
- mdlv[i] = (F64) gGLModelView[i];
- proj[i] = (F64) gGLProjection[i];
- }
-
- gluProject(render_pos.mV[0], render_pos.mV[1], render_pos.mV[2],
- mdlv, proj, (GLint*) viewport,
- &winX, &winY, &winZ);
-
- //fonts all render orthographically, set up projection``
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- LLUI::pushMatrix();
-
- gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight());
- gViewerWindow->setup3DViewport();
-
- winX -= world_view_rect.mLeft;
- winY -= world_view_rect.mBottom;
- LLUI::loadIdentity();
- gGL.loadIdentity();
- LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
- F32 right_x;
-
- font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true);
-
- LLUI::popMatrix();
- gGL.popMatrix();
-
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ // Do cheap plane culling
+ LLVector3 dir_vec = pos_agent - camera->getOrigin();
+ dir_vec /= dir_vec.magVec();
+
+ if (wstr.empty() || (!orthographic && dir_vec * camera->getAtAxis() <= 0.f))
+ {
+ return;
+ }
+
+ LLVector3 right_axis;
+ LLVector3 up_axis;
+ if (orthographic)
+ {
+ right_axis.setVec(0.f, -1.f / gViewerWindow->getWorldViewHeightScaled(), 0.f);
+ up_axis.setVec(0.f, 0.f, 1.f / gViewerWindow->getWorldViewHeightScaled());
+ }
+ else
+ {
+ camera->getPixelVectors(pos_agent, up_axis, right_axis);
+ }
+ LLCoordFrame render_frame = *camera;
+ LLQuaternion rot;
+ if (!orthographic)
+ {
+ rot = render_frame.getQuaternion();
+ rot = rot * LLQuaternion(-F_PI_BY_TWO, camera->getYAxis());
+ rot = rot * LLQuaternion(F_PI_BY_TWO, camera->getXAxis());
+ }
+ else
+ {
+ rot = LLQuaternion(-F_PI_BY_TWO, LLVector3(0.f, 0.f, 1.f));
+ rot = rot * LLQuaternion(-F_PI_BY_TWO, LLVector3(0.f, 1.f, 0.f));
+ }
+ F32 angle;
+ LLVector3 axis;
+ rot.getAngleAxis(&angle, axis);
+
+ LLVector3 render_pos = pos_agent + (floorf(x_offset) * right_axis) + (floorf(y_offset) * up_axis);
+
+ //get the render_pos in screen space
+
+ F64 winX, winY, winZ;
+ LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
+ S32 viewport[4];
+ viewport[0] = world_view_rect.mLeft;
+ viewport[1] = world_view_rect.mBottom;
+ viewport[2] = world_view_rect.getWidth();
+ viewport[3] = world_view_rect.getHeight();
+
+ F64 mdlv[16];
+ F64 proj[16];
+
+ for (U32 i = 0; i < 16; i++)
+ {
+ mdlv[i] = (F64) gGLModelView[i];
+ proj[i] = (F64) gGLProjection[i];
+ }
+
+ gluProject(render_pos.mV[0], render_pos.mV[1], render_pos.mV[2],
+ mdlv, proj, (GLint*) viewport,
+ &winX, &winY, &winZ);
+
+ //fonts all render orthographically, set up projection``
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ LLUI::pushMatrix();
+
+ gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight());
+ gViewerWindow->setup3DViewport();
+
+ winX -= world_view_rect.mLeft;
+ winY -= world_view_rect.mBottom;
+ LLUI::loadIdentity();
+ gGL.loadIdentity();
+ LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
+ F32 right_x;
+
+ font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true);
+
+ LLUI::popMatrix();
+ gGL.popMatrix();
+
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
diff --git a/indra/newview/llhudrender.h b/indra/newview/llhudrender.h
index b541cd5036..5b95ff9b71 100644
--- a/indra/newview/llhudrender.h
+++ b/indra/newview/llhudrender.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudrender.h
* @brief LLHUDRender class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,25 +34,25 @@ class LLFontGL;
// Utility classes for rendering HUD elements
void hud_render_text(const LLWString &wstr,
- const LLVector3 &pos_agent,
- const LLFontGL &font,
- const U8 style,
- const LLFontGL::ShadowType,
- const F32 x_offset,
- const F32 y_offset,
- const LLColor4& color,
- const BOOL orthographic);
+ const LLVector3 &pos_agent,
+ const LLFontGL &font,
+ const U8 style,
+ const LLFontGL::ShadowType,
+ const F32 x_offset,
+ const F32 y_offset,
+ const LLColor4& color,
+ const BOOL orthographic);
// Legacy, slower
void hud_render_utf8text(const std::string &str,
- const LLVector3 &pos_agent,
- const LLFontGL &font,
- const U8 style,
- const LLFontGL::ShadowType,
- const F32 x_offset,
- const F32 y_offset,
- const LLColor4& color,
- const BOOL orthographic);
+ const LLVector3 &pos_agent,
+ const LLFontGL &font,
+ const U8 style,
+ const LLFontGL::ShadowType,
+ const F32 x_offset,
+ const F32 y_offset,
+ const LLColor4& color,
+ const BOOL orthographic);
#endif //LL_LLHUDRENDER_H
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 0b0de18534..736c0a5bcd 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudtext.cpp
* @brief Floating text above objects, set via script with llSetText()
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -62,35 +62,35 @@ BOOL LLHUDText::sDisplayText = TRUE ;
bool lltextobject_further_away::operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const
{
- return lhs->getDistance() > rhs->getDistance();
+ return lhs->getDistance() > rhs->getDistance();
}
LLHUDText::LLHUDText(const U8 type) :
- LLHUDObject(type),
- mOnHUDAttachment(FALSE),
-// mVisibleOffScreen(FALSE),
- mWidth(0.f),
- mHeight(0.f),
- mFontp(LLFontGL::getFontSansSerifSmall()),
- mBoldFontp(LLFontGL::getFontSansSerifBold()),
- mMass(1.f),
- mMaxLines(10),
- mOffsetY(0),
- mTextAlignment(ALIGN_TEXT_CENTER),
- mVertAlignment(ALIGN_VERT_CENTER),
-// mLOD(0),
- mHidden(FALSE)
+ LLHUDObject(type),
+ mOnHUDAttachment(FALSE),
+// mVisibleOffScreen(FALSE),
+ mWidth(0.f),
+ mHeight(0.f),
+ mFontp(LLFontGL::getFontSansSerifSmall()),
+ mBoldFontp(LLFontGL::getFontSansSerifBold()),
+ mMass(1.f),
+ mMaxLines(10),
+ mOffsetY(0),
+ mTextAlignment(ALIGN_TEXT_CENTER),
+ mVertAlignment(ALIGN_VERT_CENTER),
+// mLOD(0),
+ mHidden(FALSE)
{
- mColor = LLColor4(1.f, 1.f, 1.f, 1.f);
- mDoFade = TRUE;
- mFadeDistance = 8.f;
- mFadeRange = 4.f;
- mZCompare = TRUE;
- mOffscreen = FALSE;
- mRadius = 0.1f;
- LLPointer<LLHUDText> ptr(this);
- sTextObjects.insert(ptr);
+ mColor = LLColor4(1.f, 1.f, 1.f, 1.f);
+ mDoFade = TRUE;
+ mFadeDistance = 8.f;
+ mFadeRange = 4.f;
+ mZCompare = TRUE;
+ mOffscreen = FALSE;
+ mRadius = 0.1f;
+ LLPointer<LLHUDText> ptr(this);
+ sTextObjects.insert(ptr);
}
LLHUDText::~LLHUDText()
@@ -99,541 +99,541 @@ LLHUDText::~LLHUDText()
void LLHUDText::render()
{
- if (!mOnHUDAttachment && sDisplayText)
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- //LLGLDisable gls_stencil(GL_STENCIL_TEST);
- renderText();
- }
+ if (!mOnHUDAttachment && sDisplayText)
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ renderText();
+ }
}
void LLHUDText::renderText()
{
- if (!mVisible || mHidden)
- {
- return;
- }
-
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
-
- LLGLState gls_blend(GL_BLEND, TRUE);
-
- LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f);
- F32 alpha_factor = 1.f;
- LLColor4 text_color = mColor;
- if (mDoFade)
- {
- if (mLastDistance > mFadeDistance)
- {
- alpha_factor = llmax(0.f, 1.f - (mLastDistance - mFadeDistance)/mFadeRange);
- text_color.mV[3] = text_color.mV[3]*alpha_factor;
- }
- }
- if (text_color.mV[3] < 0.01f)
- {
- return;
- }
- shadow_color.mV[3] = text_color.mV[3];
-
- mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
-
- // *TODO: make this a per-text setting
- LLColor4 bg_color = LLUIColorTable::instance().getColor("ObjectBubbleColor");
- bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor);
-
- const S32 border_height = 16;
- const S32 border_width = 16;
-
- // *TODO move this into helper function
- F32 border_scale = 1.f;
-
- if (border_height * 2 > mHeight)
- {
- border_scale = (F32)mHeight / ((F32)border_height * 2.f);
- }
- if (border_width * 2 > mWidth)
- {
- border_scale = llmin(border_scale, (F32)mWidth / ((F32)border_width * 2.f));
- }
-
- // scale screen size of borders down
- //RN: for now, text on hud objects is never occluded
-
- LLVector3 x_pixel_vec;
- LLVector3 y_pixel_vec;
-
- if (mOnHUDAttachment)
- {
- x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWorldViewWidthRaw();
- y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWorldViewHeightRaw();
- }
- else
- {
- LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
- }
-
- LLVector3 width_vec = mWidth * x_pixel_vec;
- LLVector3 height_vec = mHeight * y_pixel_vec;
-
- mRadius = (width_vec + height_vec).magVec() * 0.5f;
-
- LLVector2 screen_offset;
- screen_offset = mPositionOffset;
-
- LLVector3 render_position = mPositionAgent
- + (x_pixel_vec * screen_offset.mV[VX])
- + (y_pixel_vec * screen_offset.mV[VY]);
-
- F32 y_offset = (F32)mOffsetY;
-
- // Render label
-
- // Render text
- {
- // -1 mMaxLines means unlimited lines.
- S32 start_segment;
- S32 max_lines = getMaxLines();
-
- if (max_lines < 0)
- {
- start_segment = 0;
- }
- else
- {
- start_segment = llmax((S32)0, (S32)mTextSegments.size() - max_lines);
- }
-
- for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment;
- segment_iter != mTextSegments.end(); ++segment_iter )
- {
- const LLFontGL* fontp = segment_iter->mFont;
- y_offset -= fontp->getLineHeight() - 1; // correction factor to match legacy font metrics
-
- U8 style = segment_iter->mStyle;
- LLFontGL::ShadowType shadow = LLFontGL::DROP_SHADOW;
-
- F32 x_offset;
- if (mTextAlignment== ALIGN_TEXT_CENTER)
- {
- x_offset = -0.5f*segment_iter->getWidth(fontp);
- }
- else // ALIGN_LEFT
- {
- x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f);
- }
-
- text_color = segment_iter->mColor;
+ if (!mVisible || mHidden)
+ {
+ return;
+ }
+
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+
+ LLGLState gls_blend(GL_BLEND, TRUE);
+
+ LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f);
+ F32 alpha_factor = 1.f;
+ LLColor4 text_color = mColor;
+ if (mDoFade)
+ {
+ if (mLastDistance > mFadeDistance)
+ {
+ alpha_factor = llmax(0.f, 1.f - (mLastDistance - mFadeDistance)/mFadeRange);
+ text_color.mV[3] = text_color.mV[3]*alpha_factor;
+ }
+ }
+ if (text_color.mV[3] < 0.01f)
+ {
+ return;
+ }
+ shadow_color.mV[3] = text_color.mV[3];
+
+ mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
+
+ // *TODO: make this a per-text setting
+ LLColor4 bg_color = LLUIColorTable::instance().getColor("ObjectBubbleColor");
+ bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor);
+
+ const S32 border_height = 16;
+ const S32 border_width = 16;
+
+ // *TODO move this into helper function
+ F32 border_scale = 1.f;
+
+ if (border_height * 2 > mHeight)
+ {
+ border_scale = (F32)mHeight / ((F32)border_height * 2.f);
+ }
+ if (border_width * 2 > mWidth)
+ {
+ border_scale = llmin(border_scale, (F32)mWidth / ((F32)border_width * 2.f));
+ }
+
+ // scale screen size of borders down
+ //RN: for now, text on hud objects is never occluded
+
+ LLVector3 x_pixel_vec;
+ LLVector3 y_pixel_vec;
+
+ if (mOnHUDAttachment)
+ {
+ x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWorldViewWidthRaw();
+ y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWorldViewHeightRaw();
+ }
+ else
+ {
+ LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
+ }
+
+ LLVector3 width_vec = mWidth * x_pixel_vec;
+ LLVector3 height_vec = mHeight * y_pixel_vec;
+
+ mRadius = (width_vec + height_vec).magVec() * 0.5f;
+
+ LLVector2 screen_offset;
+ screen_offset = mPositionOffset;
+
+ LLVector3 render_position = mPositionAgent
+ + (x_pixel_vec * screen_offset.mV[VX])
+ + (y_pixel_vec * screen_offset.mV[VY]);
+
+ F32 y_offset = (F32)mOffsetY;
+
+ // Render label
+
+ // Render text
+ {
+ // -1 mMaxLines means unlimited lines.
+ S32 start_segment;
+ S32 max_lines = getMaxLines();
+
+ if (max_lines < 0)
+ {
+ start_segment = 0;
+ }
+ else
+ {
+ start_segment = llmax((S32)0, (S32)mTextSegments.size() - max_lines);
+ }
+
+ for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment;
+ segment_iter != mTextSegments.end(); ++segment_iter )
+ {
+ const LLFontGL* fontp = segment_iter->mFont;
+ y_offset -= fontp->getLineHeight() - 1; // correction factor to match legacy font metrics
+
+ U8 style = segment_iter->mStyle;
+ LLFontGL::ShadowType shadow = LLFontGL::DROP_SHADOW;
+
+ F32 x_offset;
+ if (mTextAlignment== ALIGN_TEXT_CENTER)
+ {
+ x_offset = -0.5f*segment_iter->getWidth(fontp);
+ }
+ else // ALIGN_LEFT
+ {
+ x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f);
+ }
+
+ text_color = segment_iter->mColor;
if (mOnHUDAttachment)
{
text_color = linearColor4(text_color);
}
- text_color.mV[VALPHA] *= alpha_factor;
+ text_color.mV[VALPHA] *= alpha_factor;
- hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment);
- }
- }
- /// Reset the default color to white. The renderer expects this to be the default.
- gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f);
+ hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment);
+ }
+ }
+ /// Reset the default color to white. The renderer expects this to be the default.
+ gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f);
}
void LLHUDText::setString(const std::string &text_utf8)
{
- mTextSegments.clear();
- addLine(text_utf8, mColor);
+ mTextSegments.clear();
+ addLine(text_utf8, mColor);
}
void LLHUDText::clearString()
{
- mTextSegments.clear();
+ mTextSegments.clear();
}
void LLHUDText::addLine(const std::string &text_utf8,
- const LLColor4& color,
- const LLFontGL::StyleFlags style,
- const LLFontGL* font)
+ const LLColor4& color,
+ const LLFontGL::StyleFlags style,
+ const LLFontGL* font)
{
- LLWString wline = utf8str_to_wstring(text_utf8);
- if (!wline.empty())
- {
- // use default font for segment if custom font not specified
- if (!font)
- {
- font = mFontp;
- }
- typedef boost::tokenizer<boost::char_separator<llwchar>, LLWString::const_iterator, LLWString > tokenizer;
- LLWString seps(utf8str_to_wstring("\r\n"));
- boost::char_separator<llwchar> sep(seps.c_str());
-
- tokenizer tokens(wline, sep);
- tokenizer::iterator iter = tokens.begin();
-
- while (iter != tokens.end())
- {
- U32 line_length = 0;
- do
- {
- F32 max_pixels = HUD_TEXT_MAX_WIDTH_NO_BUBBLE;
- S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE);
- LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font);
- mTextSegments.push_back(segment);
- line_length += segment_length;
- }
- while (line_length != iter->size());
- ++iter;
- }
- }
+ LLWString wline = utf8str_to_wstring(text_utf8);
+ if (!wline.empty())
+ {
+ // use default font for segment if custom font not specified
+ if (!font)
+ {
+ font = mFontp;
+ }
+ typedef boost::tokenizer<boost::char_separator<llwchar>, LLWString::const_iterator, LLWString > tokenizer;
+ LLWString seps(utf8str_to_wstring("\r\n"));
+ boost::char_separator<llwchar> sep(seps.c_str());
+
+ tokenizer tokens(wline, sep);
+ tokenizer::iterator iter = tokens.begin();
+
+ while (iter != tokens.end())
+ {
+ U32 line_length = 0;
+ do
+ {
+ F32 max_pixels = HUD_TEXT_MAX_WIDTH_NO_BUBBLE;
+ S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE);
+ LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font);
+ mTextSegments.push_back(segment);
+ line_length += segment_length;
+ }
+ while (line_length != iter->size());
+ ++iter;
+ }
+ }
}
void LLHUDText::setZCompare(const BOOL zcompare)
{
- mZCompare = zcompare;
+ mZCompare = zcompare;
}
void LLHUDText::setFont(const LLFontGL* font)
{
- mFontp = font;
+ mFontp = font;
}
void LLHUDText::setColor(const LLColor4 &color)
{
- mColor = color;
- for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin();
- segment_iter != mTextSegments.end(); ++segment_iter )
- {
- segment_iter->mColor = color;
- }
+ mColor = color;
+ for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin();
+ segment_iter != mTextSegments.end(); ++segment_iter )
+ {
+ segment_iter->mColor = color;
+ }
}
void LLHUDText::setAlpha(F32 alpha)
{
- mColor.mV[VALPHA] = alpha;
- for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin();
- segment_iter != mTextSegments.end(); ++segment_iter )
- {
- segment_iter->mColor.mV[VALPHA] = alpha;
- }
+ mColor.mV[VALPHA] = alpha;
+ for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin();
+ segment_iter != mTextSegments.end(); ++segment_iter )
+ {
+ segment_iter->mColor.mV[VALPHA] = alpha;
+ }
}
void LLHUDText::setDoFade(const BOOL do_fade)
{
- mDoFade = do_fade;
+ mDoFade = do_fade;
}
void LLHUDText::updateVisibility()
{
- if (mSourceObject)
- {
- mSourceObject->updateText();
- }
-
- mPositionAgent = gAgent.getPosAgentFromGlobal(mPositionGlobal);
-
- if (!mSourceObject)
- {
+ if (mSourceObject)
+ {
+ mSourceObject->updateText();
+ }
+
+ mPositionAgent = gAgent.getPosAgentFromGlobal(mPositionGlobal);
+
+ if (!mSourceObject)
+ {
// Beacons
- mVisible = TRUE;
- if (mOnHUDAttachment)
- {
- sVisibleHUDTextObjects.push_back(LLPointer<LLHUDText> (this));
- }
- else
- {
- sVisibleTextObjects.push_back(LLPointer<LLHUDText> (this));
- }
- return;
- }
-
- // Not visible if parent object is dead
- if (mSourceObject->isDead())
- {
- mVisible = FALSE;
- return;
- }
-
- // for now, all text on hud objects is visible
- if (mOnHUDAttachment)
- {
- mVisible = TRUE;
- sVisibleHUDTextObjects.push_back(LLPointer<LLHUDText> (this));
- mLastDistance = mPositionAgent.mV[VX];
- return;
- }
-
- // push text towards camera by radius of object, but not past camera
- LLVector3 vec_from_camera = mPositionAgent - LLViewerCamera::getInstance()->getOrigin();
- LLVector3 dir_from_camera = vec_from_camera;
- dir_from_camera.normVec();
-
- if (dir_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= 0.f)
- { //text is behind camera, don't render
- mVisible = FALSE;
- return;
- }
-
- if (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= LLViewerCamera::getInstance()->getNear() + 0.1f + mSourceObject->getVObjRadius())
- {
- mPositionAgent = LLViewerCamera::getInstance()->getOrigin() + vec_from_camera * ((LLViewerCamera::getInstance()->getNear() + 0.1f) / (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis()));
- }
- else
- {
- mPositionAgent -= dir_from_camera * mSourceObject->getVObjRadius();
- }
-
- mLastDistance = (mPositionAgent - LLViewerCamera::getInstance()->getOrigin()).magVec();
-
- if (!mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange)))
- {
- mVisible = FALSE;
- return;
- }
-
- LLVector3 pos_agent_center = gAgent.getPosAgentFromGlobal(mPositionGlobal) - dir_from_camera;
- F32 last_distance_center = (pos_agent_center - LLViewerCamera::getInstance()->getOrigin()).magVec();
- F32 max_draw_distance = gSavedSettings.getF32("PrimTextMaxDrawDistance");
-
- if(max_draw_distance < 0)
- {
- max_draw_distance = 0;
- gSavedSettings.setF32("PrimTextMaxDrawDistance", max_draw_distance);
- }
- else if(max_draw_distance > MAX_DRAW_DISTANCE)
- {
- max_draw_distance = MAX_DRAW_DISTANCE;
- gSavedSettings.setF32("PrimTextMaxDrawDistance", MAX_DRAW_DISTANCE);
- }
-
- if(last_distance_center > max_draw_distance)
- {
- mVisible = FALSE;
- return;
- }
-
-
- LLVector3 x_pixel_vec;
- LLVector3 y_pixel_vec;
-
- LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
-
- LLVector3 render_position = mPositionAgent +
- (x_pixel_vec * mPositionOffset.mV[VX]) +
- (y_pixel_vec * mPositionOffset.mV[VY]);
-
- mOffscreen = FALSE;
- if (!LLViewerCamera::getInstance()->sphereInFrustum(render_position, mRadius))
- {
-// if (!mVisibleOffScreen)
-// {
- mVisible = FALSE;
- return;
-// }
-// else
-// {
-// mOffscreen = TRUE;
-// }
- }
-
- mVisible = TRUE;
- sVisibleTextObjects.push_back(LLPointer<LLHUDText> (this));
+ mVisible = TRUE;
+ if (mOnHUDAttachment)
+ {
+ sVisibleHUDTextObjects.push_back(LLPointer<LLHUDText> (this));
+ }
+ else
+ {
+ sVisibleTextObjects.push_back(LLPointer<LLHUDText> (this));
+ }
+ return;
+ }
+
+ // Not visible if parent object is dead
+ if (mSourceObject->isDead())
+ {
+ mVisible = FALSE;
+ return;
+ }
+
+ // for now, all text on hud objects is visible
+ if (mOnHUDAttachment)
+ {
+ mVisible = TRUE;
+ sVisibleHUDTextObjects.push_back(LLPointer<LLHUDText> (this));
+ mLastDistance = mPositionAgent.mV[VX];
+ return;
+ }
+
+ // push text towards camera by radius of object, but not past camera
+ LLVector3 vec_from_camera = mPositionAgent - LLViewerCamera::getInstance()->getOrigin();
+ LLVector3 dir_from_camera = vec_from_camera;
+ dir_from_camera.normVec();
+
+ if (dir_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= 0.f)
+ { //text is behind camera, don't render
+ mVisible = FALSE;
+ return;
+ }
+
+ if (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= LLViewerCamera::getInstance()->getNear() + 0.1f + mSourceObject->getVObjRadius())
+ {
+ mPositionAgent = LLViewerCamera::getInstance()->getOrigin() + vec_from_camera * ((LLViewerCamera::getInstance()->getNear() + 0.1f) / (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis()));
+ }
+ else
+ {
+ mPositionAgent -= dir_from_camera * mSourceObject->getVObjRadius();
+ }
+
+ mLastDistance = (mPositionAgent - LLViewerCamera::getInstance()->getOrigin()).magVec();
+
+ if (!mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange)))
+ {
+ mVisible = FALSE;
+ return;
+ }
+
+ LLVector3 pos_agent_center = gAgent.getPosAgentFromGlobal(mPositionGlobal) - dir_from_camera;
+ F32 last_distance_center = (pos_agent_center - LLViewerCamera::getInstance()->getOrigin()).magVec();
+ F32 max_draw_distance = gSavedSettings.getF32("PrimTextMaxDrawDistance");
+
+ if(max_draw_distance < 0)
+ {
+ max_draw_distance = 0;
+ gSavedSettings.setF32("PrimTextMaxDrawDistance", max_draw_distance);
+ }
+ else if(max_draw_distance > MAX_DRAW_DISTANCE)
+ {
+ max_draw_distance = MAX_DRAW_DISTANCE;
+ gSavedSettings.setF32("PrimTextMaxDrawDistance", MAX_DRAW_DISTANCE);
+ }
+
+ if(last_distance_center > max_draw_distance)
+ {
+ mVisible = FALSE;
+ return;
+ }
+
+
+ LLVector3 x_pixel_vec;
+ LLVector3 y_pixel_vec;
+
+ LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
+
+ LLVector3 render_position = mPositionAgent +
+ (x_pixel_vec * mPositionOffset.mV[VX]) +
+ (y_pixel_vec * mPositionOffset.mV[VY]);
+
+ mOffscreen = FALSE;
+ if (!LLViewerCamera::getInstance()->sphereInFrustum(render_position, mRadius))
+ {
+// if (!mVisibleOffScreen)
+// {
+ mVisible = FALSE;
+ return;
+// }
+// else
+// {
+// mOffscreen = TRUE;
+// }
+ }
+
+ mVisible = TRUE;
+ sVisibleTextObjects.push_back(LLPointer<LLHUDText> (this));
}
LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset)
{
- LLCoordGL screen_pos;
- LLVector2 screen_pos_vec;
- LLVector3 x_pixel_vec;
- LLVector3 y_pixel_vec;
- LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
-// LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec);
-// if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen)
-// {
-// // bubble off-screen, so find a spot for it along screen edge
-// LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(world_pos, screen_pos);
-// }
-
- screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY);
-
- LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
- S32 bottom = world_rect.mBottom + STATUS_BAR_HEIGHT;
-
- LLVector2 screen_center;
- screen_center.mV[VX] = llclamp((F32)screen_pos_vec.mV[VX], (F32)world_rect.mLeft + mWidth * 0.5f, (F32)world_rect.mRight - mWidth * 0.5f);
-
- if(mVertAlignment == ALIGN_VERT_TOP)
- {
- screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
- (F32)bottom,
- (F32)world_rect.mTop - mHeight - (F32)MENU_BAR_HEIGHT);
- mSoftScreenRect.setLeftTopAndSize(screen_center.mV[VX] - (mWidth + BUFFER_SIZE) * 0.5f,
- screen_center.mV[VY] + (mHeight + BUFFER_SIZE), mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
- }
- else
- {
- screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
- (F32)bottom + mHeight * 0.5f,
- (F32)world_rect.mTop - mHeight * 0.5f - (F32)MENU_BAR_HEIGHT);
- mSoftScreenRect.setCenterAndSize(screen_center.mV[VX], screen_center.mV[VY], mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
- }
-
- return offset + (screen_center - LLVector2((F32)screen_pos.mX, (F32)screen_pos.mY));
+ LLCoordGL screen_pos;
+ LLVector2 screen_pos_vec;
+ LLVector3 x_pixel_vec;
+ LLVector3 y_pixel_vec;
+ LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
+// LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec);
+// if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen)
+// {
+// // bubble off-screen, so find a spot for it along screen edge
+// LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(world_pos, screen_pos);
+// }
+
+ screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY);
+
+ LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
+ S32 bottom = world_rect.mBottom + STATUS_BAR_HEIGHT;
+
+ LLVector2 screen_center;
+ screen_center.mV[VX] = llclamp((F32)screen_pos_vec.mV[VX], (F32)world_rect.mLeft + mWidth * 0.5f, (F32)world_rect.mRight - mWidth * 0.5f);
+
+ if(mVertAlignment == ALIGN_VERT_TOP)
+ {
+ screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
+ (F32)bottom,
+ (F32)world_rect.mTop - mHeight - (F32)MENU_BAR_HEIGHT);
+ mSoftScreenRect.setLeftTopAndSize(screen_center.mV[VX] - (mWidth + BUFFER_SIZE) * 0.5f,
+ screen_center.mV[VY] + (mHeight + BUFFER_SIZE), mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
+ }
+ else
+ {
+ screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY],
+ (F32)bottom + mHeight * 0.5f,
+ (F32)world_rect.mTop - mHeight * 0.5f - (F32)MENU_BAR_HEIGHT);
+ mSoftScreenRect.setCenterAndSize(screen_center.mV[VX], screen_center.mV[VY], mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE);
+ }
+
+ return offset + (screen_center - LLVector2((F32)screen_pos.mX, (F32)screen_pos.mY));
}
void LLHUDText::updateSize()
{
- F32 height = 0.f;
- F32 width = 0.f;
-
- S32 max_lines = getMaxLines();
-
- S32 start_segment;
- if (max_lines < 0) start_segment = 0;
- else start_segment = llmax((S32)0, (S32)mTextSegments.size() - max_lines);
-
- std::vector<LLHUDTextSegment>::iterator iter = mTextSegments.begin() + start_segment;
- while (iter != mTextSegments.end())
- {
- const LLFontGL* fontp = iter->mFont;
- height += fontp->getLineHeight() - 1; // correction factor to match legacy font metrics
- width = llmax(width, llmin(iter->getWidth(fontp), HUD_TEXT_MAX_WIDTH));
- ++iter;
- }
-
- if (width == 0.f)
- {
- return;
- }
-
- width += HORIZONTAL_PADDING;
- height += VERTICAL_PADDING;
-
- // *TODO: Could do some sort of timer-based resize logic here
- F32 u = 1.f;
- mWidth = llmax(width, lerp(mWidth, (F32)width, u));
- mHeight = llmax(height, lerp(mHeight, (F32)height, u));
+ F32 height = 0.f;
+ F32 width = 0.f;
+
+ S32 max_lines = getMaxLines();
+
+ S32 start_segment;
+ if (max_lines < 0) start_segment = 0;
+ else start_segment = llmax((S32)0, (S32)mTextSegments.size() - max_lines);
+
+ std::vector<LLHUDTextSegment>::iterator iter = mTextSegments.begin() + start_segment;
+ while (iter != mTextSegments.end())
+ {
+ const LLFontGL* fontp = iter->mFont;
+ height += fontp->getLineHeight() - 1; // correction factor to match legacy font metrics
+ width = llmax(width, llmin(iter->getWidth(fontp), HUD_TEXT_MAX_WIDTH));
+ ++iter;
+ }
+
+ if (width == 0.f)
+ {
+ return;
+ }
+
+ width += HORIZONTAL_PADDING;
+ height += VERTICAL_PADDING;
+
+ // *TODO: Could do some sort of timer-based resize logic here
+ F32 u = 1.f;
+ mWidth = llmax(width, lerp(mWidth, (F32)width, u));
+ mHeight = llmax(height, lerp(mHeight, (F32)height, u));
}
void LLHUDText::updateAll()
{
- // iterate over all text objects, calculate their restoration forces,
- // and add them to the visible set if they are on screen and close enough
- sVisibleTextObjects.clear();
- sVisibleHUDTextObjects.clear();
-
- TextObjectIterator text_it;
- for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
- {
- LLHUDText* textp = (*text_it);
- textp->mTargetPositionOffset.clearVec();
- textp->updateSize();
- textp->updateVisibility();
- }
-
- // sort back to front for rendering purposes
- std::sort(sVisibleTextObjects.begin(), sVisibleTextObjects.end(), lltextobject_further_away());
- std::sort(sVisibleHUDTextObjects.begin(), sVisibleHUDTextObjects.end(), lltextobject_further_away());
+ // iterate over all text objects, calculate their restoration forces,
+ // and add them to the visible set if they are on screen and close enough
+ sVisibleTextObjects.clear();
+ sVisibleHUDTextObjects.clear();
+
+ TextObjectIterator text_it;
+ for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
+ {
+ LLHUDText* textp = (*text_it);
+ textp->mTargetPositionOffset.clearVec();
+ textp->updateSize();
+ textp->updateVisibility();
+ }
+
+ // sort back to front for rendering purposes
+ std::sort(sVisibleTextObjects.begin(), sVisibleTextObjects.end(), lltextobject_further_away());
+ std::sort(sVisibleHUDTextObjects.begin(), sVisibleHUDTextObjects.end(), lltextobject_further_away());
}
//void LLHUDText::setLOD(S32 lod)
//{
-// mLOD = lod;
-// //RN: uncomment this to visualize LOD levels
-// //std::string label = llformat("%d", lod);
-// //setLabel(label);
+// mLOD = lod;
+// //RN: uncomment this to visualize LOD levels
+// //std::string label = llformat("%d", lod);
+// //setLabel(label);
//}
S32 LLHUDText::getMaxLines()
{
- return mMaxLines;
- //switch(mLOD)
- //{
- //case 0:
- // return mMaxLines;
- //case 1:
- // return mMaxLines > 0 ? mMaxLines / 2 : 5;
- //case 2:
- // return mMaxLines > 0 ? mMaxLines / 3 : 2;
- //default:
- // // label only
- // return 0;
- //}
+ return mMaxLines;
+ //switch(mLOD)
+ //{
+ //case 0:
+ // return mMaxLines;
+ //case 1:
+ // return mMaxLines > 0 ? mMaxLines / 2 : 5;
+ //case 2:
+ // return mMaxLines > 0 ? mMaxLines / 3 : 2;
+ //default:
+ // // label only
+ // return 0;
+ //}
}
void LLHUDText::markDead()
{
// make sure we have at least one pointer
// till the end of the function
- LLPointer<LLHUDText> ptr(this);
- sTextObjects.erase(ptr);
- LLHUDObject::markDead();
+ LLPointer<LLHUDText> ptr(this);
+ sTextObjects.erase(ptr);
+ LLHUDObject::markDead();
}
void LLHUDText::renderAllHUD()
{
- LLGLState::checkStates();
-
- {
- LLGLDepthTest depth(GL_FALSE, GL_FALSE);
-
- VisibleTextObjectIterator text_it;
-
- for (text_it = sVisibleHUDTextObjects.begin(); text_it != sVisibleHUDTextObjects.end(); ++text_it)
- {
- (*text_it)->renderText();
- }
- }
-
- LLVertexBuffer::unbind();
-
- LLGLState::checkStates();
+ LLGLState::checkStates();
+
+ {
+ LLGLDepthTest depth(GL_FALSE, GL_FALSE);
+
+ VisibleTextObjectIterator text_it;
+
+ for (text_it = sVisibleHUDTextObjects.begin(); text_it != sVisibleHUDTextObjects.end(); ++text_it)
+ {
+ (*text_it)->renderText();
+ }
+ }
+
+ LLVertexBuffer::unbind();
+
+ LLGLState::checkStates();
}
void LLHUDText::shiftAll(const LLVector3& offset)
{
- TextObjectIterator text_it;
- for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
- {
- LLHUDText *textp = text_it->get();
- textp->shift(offset);
- }
+ TextObjectIterator text_it;
+ for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
+ {
+ LLHUDText *textp = text_it->get();
+ textp->shift(offset);
+ }
}
void LLHUDText::shift(const LLVector3& offset)
{
- mPositionAgent += offset;
+ mPositionAgent += offset;
}
//static
// called when UI scale changes, to flush font width caches
void LLHUDText::reshape()
{
- TextObjectIterator text_it;
- for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
- {
- LLHUDText* textp = (*text_it);
- std::vector<LLHUDTextSegment>::iterator segment_iter;
- for (segment_iter = textp->mTextSegments.begin();
- segment_iter != textp->mTextSegments.end(); ++segment_iter )
- {
- segment_iter->clearFontWidthMap();
- }
- }
+ TextObjectIterator text_it;
+ for (text_it = sTextObjects.begin(); text_it != sTextObjects.end(); ++text_it)
+ {
+ LLHUDText* textp = (*text_it);
+ std::vector<LLHUDTextSegment>::iterator segment_iter;
+ for (segment_iter = textp->mTextSegments.begin();
+ segment_iter != textp->mTextSegments.end(); ++segment_iter )
+ {
+ segment_iter->clearFontWidthMap();
+ }
+ }
}
//============================================================================
F32 LLHUDText::LLHUDTextSegment::getWidth(const LLFontGL* font)
{
- std::map<const LLFontGL*, F32>::iterator iter = mFontWidthMap.find(font);
- if (iter != mFontWidthMap.end())
- {
- return iter->second;
- }
- else
- {
- F32 width = font->getWidthF32(mText.c_str());
- mFontWidthMap[font] = width;
- return width;
- }
+ std::map<const LLFontGL*, F32>::iterator iter = mFontWidthMap.find(font);
+ if (iter != mFontWidthMap.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ F32 width = font->getWidthF32(mText.c_str());
+ mFontWidthMap[font] = width;
+ return width;
+ }
}
diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h
index 36015d51f0..1bfd12256e 100644
--- a/indra/newview/llhudtext.h
+++ b/indra/newview/llhudtext.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudtext.h
* @brief LLHUDText class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,130 +44,130 @@ class LLHUDText;
struct lltextobject_further_away
{
- bool operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const;
+ bool operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const;
};
class LLHUDText : public LLHUDObject
{
protected:
- class LLHUDTextSegment
- {
- public:
- LLHUDTextSegment(const LLWString& text, const LLFontGL::StyleFlags style, const LLColor4& color, const LLFontGL* font)
- : mColor(color),
- mStyle(style),
- mText(text),
- mFont(font)
- {}
- F32 getWidth(const LLFontGL* font);
- const LLWString& getText() const { return mText; }
- void clearFontWidthMap() { mFontWidthMap.clear(); }
-
- LLColor4 mColor;
- LLFontGL::StyleFlags mStyle;
- const LLFontGL* mFont;
- private:
- LLWString mText;
- std::map<const LLFontGL*, F32> mFontWidthMap;
- };
+ class LLHUDTextSegment
+ {
+ public:
+ LLHUDTextSegment(const LLWString& text, const LLFontGL::StyleFlags style, const LLColor4& color, const LLFontGL* font)
+ : mColor(color),
+ mStyle(style),
+ mText(text),
+ mFont(font)
+ {}
+ F32 getWidth(const LLFontGL* font);
+ const LLWString& getText() const { return mText; }
+ void clearFontWidthMap() { mFontWidthMap.clear(); }
+
+ LLColor4 mColor;
+ LLFontGL::StyleFlags mStyle;
+ const LLFontGL* mFont;
+ private:
+ LLWString mText;
+ std::map<const LLFontGL*, F32> mFontWidthMap;
+ };
public:
- typedef enum e_text_alignment
- {
- ALIGN_TEXT_LEFT,
- ALIGN_TEXT_CENTER
- } ETextAlignment;
-
- typedef enum e_vert_alignment
- {
- ALIGN_VERT_TOP,
- ALIGN_VERT_CENTER
- } EVertAlignment;
+ typedef enum e_text_alignment
+ {
+ ALIGN_TEXT_LEFT,
+ ALIGN_TEXT_CENTER
+ } ETextAlignment;
+
+ typedef enum e_vert_alignment
+ {
+ ALIGN_VERT_TOP,
+ ALIGN_VERT_CENTER
+ } EVertAlignment;
public:
- // Set entire string, eliminating existing lines
- void setString(const std::string& text_utf8);
-
- void clearString();
-
- // Add text a line at a time, allowing custom formatting
- void addLine(const std::string &text_utf8, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL, const LLFontGL* font = NULL);
-
- // Sets the default font for lines with no font specified
- void setFont(const LLFontGL* font);
- void setColor(const LLColor4 &color);
- void setAlpha(F32 alpha);
- void setZCompare(const BOOL zcompare);
- void setDoFade(const BOOL do_fade);
-// void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; }
-
- // mMaxLines of -1 means unlimited lines.
- void setMaxLines(S32 max_lines) { mMaxLines = max_lines; }
- void setFadeDistance(F32 fade_distance, F32 fade_range) { mFadeDistance = fade_distance; mFadeRange = fade_range; }
- void updateVisibility();
- LLVector2 updateScreenPos(LLVector2 &offset_target);
- void updateSize();
- void setMass(F32 mass) { mMass = llmax(0.1f, mass); }
- void setTextAlignment(ETextAlignment alignment) { mTextAlignment = alignment; }
- void setVertAlignment(EVertAlignment alignment) { mVertAlignment = alignment; }
- /*virtual*/ void markDead();
- friend class LLHUDObject;
- /*virtual*/ F32 getDistance() const { return mLastDistance; }
- BOOL getVisible() { return mVisible; }
- BOOL getHidden() const { return mHidden; }
- void setHidden( BOOL hide ) { mHidden = hide; }
- void setOnHUDAttachment(BOOL on_hud) { mOnHUDAttachment = on_hud; }
- void shift(const LLVector3& offset);
-
- static void shiftAll(const LLVector3& offset);
- static void renderAllHUD();
- static void reshape();
- static void setDisplayText(BOOL flag) { sDisplayText = flag ; }
+ // Set entire string, eliminating existing lines
+ void setString(const std::string& text_utf8);
+
+ void clearString();
+
+ // Add text a line at a time, allowing custom formatting
+ void addLine(const std::string &text_utf8, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL, const LLFontGL* font = NULL);
+
+ // Sets the default font for lines with no font specified
+ void setFont(const LLFontGL* font);
+ void setColor(const LLColor4 &color);
+ void setAlpha(F32 alpha);
+ void setZCompare(const BOOL zcompare);
+ void setDoFade(const BOOL do_fade);
+// void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; }
+
+ // mMaxLines of -1 means unlimited lines.
+ void setMaxLines(S32 max_lines) { mMaxLines = max_lines; }
+ void setFadeDistance(F32 fade_distance, F32 fade_range) { mFadeDistance = fade_distance; mFadeRange = fade_range; }
+ void updateVisibility();
+ LLVector2 updateScreenPos(LLVector2 &offset_target);
+ void updateSize();
+ void setMass(F32 mass) { mMass = llmax(0.1f, mass); }
+ void setTextAlignment(ETextAlignment alignment) { mTextAlignment = alignment; }
+ void setVertAlignment(EVertAlignment alignment) { mVertAlignment = alignment; }
+ /*virtual*/ void markDead();
+ friend class LLHUDObject;
+ /*virtual*/ F32 getDistance() const { return mLastDistance; }
+ BOOL getVisible() { return mVisible; }
+ BOOL getHidden() const { return mHidden; }
+ void setHidden( BOOL hide ) { mHidden = hide; }
+ void setOnHUDAttachment(BOOL on_hud) { mOnHUDAttachment = on_hud; }
+ void shift(const LLVector3& offset);
+
+ static void shiftAll(const LLVector3& offset);
+ static void renderAllHUD();
+ static void reshape();
+ static void setDisplayText(BOOL flag) { sDisplayText = flag ; }
protected:
- LLHUDText(const U8 type);
+ LLHUDText(const U8 type);
- /*virtual*/ void render();
- void renderText();
- static void updateAll();
- S32 getMaxLines();
+ /*virtual*/ void render();
+ void renderText();
+ static void updateAll();
+ S32 getMaxLines();
private:
- ~LLHUDText();
- BOOL mOnHUDAttachment;
- BOOL mDoFade;
- F32 mFadeRange;
- F32 mFadeDistance;
- F32 mLastDistance;
- BOOL mZCompare;
-// BOOL mVisibleOffScreen;
- BOOL mOffscreen;
- LLColor4 mColor;
- LLVector3 mScale;
- F32 mWidth;
- F32 mHeight;
- LLColor4U mPickColor;
- const LLFontGL* mFontp;
- const LLFontGL* mBoldFontp;
- LLRectf mSoftScreenRect;
- LLVector3 mPositionAgent;
- LLVector2 mPositionOffset;
- LLVector2 mTargetPositionOffset;
- F32 mMass;
- S32 mMaxLines;
- S32 mOffsetY;
- F32 mRadius;
- std::vector<LLHUDTextSegment> mTextSegments;
- ETextAlignment mTextAlignment;
- EVertAlignment mVertAlignment;
- BOOL mHidden;
-
- static BOOL sDisplayText ;
- static std::set<LLPointer<LLHUDText> > sTextObjects;
- static std::vector<LLPointer<LLHUDText> > sVisibleTextObjects;
- static std::vector<LLPointer<LLHUDText> > sVisibleHUDTextObjects;
- typedef std::set<LLPointer<LLHUDText> >::iterator TextObjectIterator;
- typedef std::vector<LLPointer<LLHUDText> >::iterator VisibleTextObjectIterator;
+ ~LLHUDText();
+ BOOL mOnHUDAttachment;
+ BOOL mDoFade;
+ F32 mFadeRange;
+ F32 mFadeDistance;
+ F32 mLastDistance;
+ BOOL mZCompare;
+// BOOL mVisibleOffScreen;
+ BOOL mOffscreen;
+ LLColor4 mColor;
+ LLVector3 mScale;
+ F32 mWidth;
+ F32 mHeight;
+ LLColor4U mPickColor;
+ const LLFontGL* mFontp;
+ const LLFontGL* mBoldFontp;
+ LLRectf mSoftScreenRect;
+ LLVector3 mPositionAgent;
+ LLVector2 mPositionOffset;
+ LLVector2 mTargetPositionOffset;
+ F32 mMass;
+ S32 mMaxLines;
+ S32 mOffsetY;
+ F32 mRadius;
+ std::vector<LLHUDTextSegment> mTextSegments;
+ ETextAlignment mTextAlignment;
+ EVertAlignment mVertAlignment;
+ BOOL mHidden;
+
+ static BOOL sDisplayText ;
+ static std::set<LLPointer<LLHUDText> > sTextObjects;
+ static std::vector<LLPointer<LLHUDText> > sVisibleTextObjects;
+ static std::vector<LLPointer<LLHUDText> > sVisibleHUDTextObjects;
+ typedef std::set<LLPointer<LLHUDText> >::iterator TextObjectIterator;
+ typedef std::vector<LLPointer<LLHUDText> >::iterator VisibleTextObjectIterator;
};
#endif // LL_LLHUDTEXT_H
diff --git a/indra/newview/llhudview.cpp b/indra/newview/llhudview.cpp
index cead4dbce6..be4c5f9d33 100644
--- a/indra/newview/llhudview.cpp
+++ b/indra/newview/llhudview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudview.cpp
* @brief 2D HUD overlay
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,8 +46,8 @@ LLHUDView *gHUDView = NULL;
LLHUDView::LLHUDView(const LLRect& r)
{
- buildFromFile( "panel_hud.xml");
- setShape(r, true);
+ buildFromFile( "panel_hud.xml");
+ setShape(r, true);
}
LLHUDView::~LLHUDView()
@@ -57,16 +57,16 @@ LLHUDView::~LLHUDView()
// virtual
void LLHUDView::draw()
{
- LLTracker::drawHUDArrow();
- LLView::draw();
+ LLTracker::drawHUDArrow();
+ LLView::draw();
}
/*virtual*/
BOOL LLHUDView::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if (LLTracker::handleMouseDown(x, y))
- {
- return TRUE;
- }
- return LLView::handleMouseDown(x, y, mask);
+ if (LLTracker::handleMouseDown(x, y))
+ {
+ return TRUE;
+ }
+ return LLView::handleMouseDown(x, y, mask);
}
diff --git a/indra/newview/llhudview.h b/indra/newview/llhudview.h
index 6689554706..dd99996818 100644
--- a/indra/newview/llhudview.h
+++ b/indra/newview/llhudview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhudview.h
* @brief 2D HUD overlay
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,13 +36,13 @@ class LLHUDView
: public LLPanel
{
public:
- LLHUDView(const LLRect& rect);
- virtual ~LLHUDView();
+ LLHUDView(const LLRect& rect);
+ virtual ~LLHUDView();
- virtual void draw();
+ virtual void draw();
protected:
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
};
extern LLHUDView *gHUDView;
diff --git a/indra/newview/llimagefiltersmanager.cpp b/indra/newview/llimagefiltersmanager.cpp
index 3b8adc1610..d63ed4126a 100644
--- a/indra/newview/llimagefiltersmanager.cpp
+++ b/indra/newview/llimagefiltersmanager.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llimagefiltersmanager.cpp
* @brief Load image filters list and retrieve their path.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
std::string get_sys_dir()
{
- return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "filters", "");
+ return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "filters", "");
}
//---------------------------------------------------------------------------
@@ -51,39 +51,39 @@ LLImageFiltersManager::~LLImageFiltersManager()
// virtual
void LLImageFiltersManager::initSingleton()
{
- loadAllFilters();
+ loadAllFilters();
}
void LLImageFiltersManager::loadAllFilters()
{
- // Load system (coming out of the box) filters
- loadFiltersFromDir(get_sys_dir());
+ // Load system (coming out of the box) filters
+ loadFiltersFromDir(get_sys_dir());
}
void LLImageFiltersManager::loadFiltersFromDir(const std::string& dir)
{
- mFiltersList.clear();
-
- LLDirIterator dir_iter(dir, "*.xml");
- while (1)
- {
- std::string file_name;
- if (!dir_iter.next(file_name))
- {
- break; // no more files
- }
-
- // Get the ".xml" out of the file name to get the filter name. That's the one known in strings.xml
- std::string filter_name_untranslated = file_name.substr(0,file_name.length()-4);
-
+ mFiltersList.clear();
+
+ LLDirIterator dir_iter(dir, "*.xml");
+ while (1)
+ {
+ std::string file_name;
+ if (!dir_iter.next(file_name))
+ {
+ break; // no more files
+ }
+
+ // Get the ".xml" out of the file name to get the filter name. That's the one known in strings.xml
+ std::string filter_name_untranslated = file_name.substr(0,file_name.length()-4);
+
// Get the localized name for the filter
- std::string filter_name_translated;
+ std::string filter_name_translated;
bool translated = LLTrans::findString(filter_name_translated, filter_name_untranslated);
- std::string filter_name = (translated ? filter_name_translated: filter_name_untranslated);
-
+ std::string filter_name = (translated ? filter_name_translated: filter_name_untranslated);
+
// Store the filter in the list with its associated file name
mFiltersList[filter_name] = file_name;
- }
+ }
}
// Note : That method is a bit heavy handed but the list of filters is always small (10 or so)
diff --git a/indra/newview/llimagefiltersmanager.h b/indra/newview/llimagefiltersmanager.h
index 05d1806da4..e46e7074e4 100644
--- a/indra/newview/llimagefiltersmanager.h
+++ b/indra/newview/llimagefiltersmanager.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llimagefiltersmanager.h
* @brief Load image filters list and retrieve their path.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,20 +34,20 @@
class LLImageFiltersManager : public LLSingleton<LLImageFiltersManager>
{
- LLSINGLETON(LLImageFiltersManager);
- ~LLImageFiltersManager();
- LOG_CLASS(LLImageFiltersManager);
+ LLSINGLETON(LLImageFiltersManager);
+ ~LLImageFiltersManager();
+ LOG_CLASS(LLImageFiltersManager);
public:
const std::vector<std::string> getFiltersList() const;
std::string getFilterPath(const std::string& filter_name);
-
+
private:
- void loadAllFilters();
- void loadFiltersFromDir(const std::string& dir);
-
- /*virtual*/ void initSingleton() override;
-
- // List of filters : first is the user friendly localized name, second is the xml file name
+ void loadAllFilters();
+ void loadFiltersFromDir(const std::string& dir);
+
+ /*virtual*/ void initSingleton() override;
+
+ // List of filters : first is the user friendly localized name, second is the xml file name
std::map<std::string,std::string> mFiltersList;
};
diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp
index 0fa3dc1110..3554412e18 100644
--- a/indra/newview/llimhandler.cpp
+++ b/indra/newview/llimhandler.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llimhandler.cpp
* @brief Notification Handler Class for IM notifications
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,10 +40,10 @@ extern void process_dnd_im(const LLSD& notification);
//--------------------------------------------------------------------------
LLIMHandler::LLIMHandler()
-: LLCommunicationNotificationHandler("IM Notifications", "notifytoast")
+: LLCommunicationNotificationHandler("IM Notifications", "notifytoast")
{
- // Getting a Channel for our notifications
- mChannel = LLChannelManager::getInstance()->createNotificationChannel()->getHandle();
+ // Getting a Channel for our notifications
+ mChannel = LLChannelManager::getInstance()->createNotificationChannel()->getHandle();
}
//--------------------------------------------------------------------------
@@ -54,9 +54,9 @@ LLIMHandler::~LLIMHandler()
//--------------------------------------------------------------------------
void LLIMHandler::initChannel()
{
- S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
- S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
- mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
+ S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
+ S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
+ mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
}
//--------------------------------------------------------------------------
@@ -69,47 +69,47 @@ bool LLIMHandler::processNotification(const LLNotificationPtr& notification, boo
}
else
{
- if(mChannel.isDead())
- {
- return false;
- }
-
- // arrange a channel on a screen
- if(!mChannel.get()->getVisible())
- {
- initChannel();
- }
-
- LLSD substitutions = notification->getSubstitutions();
-
- // According to comments in LLIMMgr::addMessage(), if we get message
- // from ourselves, the sender id is set to null. This fixes EXT-875.
- LLUUID avatar_id = substitutions["FROM_ID"].asUUID();
- if (avatar_id.isNull())
- avatar_id = gAgentID;
-
- LLToastIMPanel::Params im_p;
- im_p.notification = notification;
- im_p.avatar_id = avatar_id;
- im_p.from = substitutions["FROM"].asString();
- im_p.time = substitutions["TIME"].asString();
- im_p.message = substitutions["MESSAGE"].asString();
- im_p.session_id = substitutions["SESSION_ID"].asUUID();
-
- LLToastIMPanel* im_box = new LLToastIMPanel(im_p);
-
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.session_id = im_p.session_id;
- p.notification = notification;
- p.panel = im_box;
- p.can_be_stored = false;
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
- if(channel)
- channel->addToast(p);
+ if(mChannel.isDead())
+ {
+ return false;
+ }
+
+ // arrange a channel on a screen
+ if(!mChannel.get()->getVisible())
+ {
+ initChannel();
+ }
+
+ LLSD substitutions = notification->getSubstitutions();
+
+ // According to comments in LLIMMgr::addMessage(), if we get message
+ // from ourselves, the sender id is set to null. This fixes EXT-875.
+ LLUUID avatar_id = substitutions["FROM_ID"].asUUID();
+ if (avatar_id.isNull())
+ avatar_id = gAgentID;
+
+ LLToastIMPanel::Params im_p;
+ im_p.notification = notification;
+ im_p.avatar_id = avatar_id;
+ im_p.from = substitutions["FROM"].asString();
+ im_p.time = substitutions["TIME"].asString();
+ im_p.message = substitutions["MESSAGE"].asString();
+ im_p.session_id = substitutions["SESSION_ID"].asUUID();
+
+ LLToastIMPanel* im_box = new LLToastIMPanel(im_p);
+
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.session_id = im_p.session_id;
+ p.notification = notification;
+ p.panel = im_box;
+ p.can_be_stored = false;
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if(channel)
+ channel->addToast(p);
}
- return false;
+ return false;
}
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index c194dc05b0..3de18ba92f 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llimpanel.cpp
* @brief LLIMPanel class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -97,881 +97,881 @@ static std::string sSessionStartString = "Starting session with [NAME] please wa
//
LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label,
- const LLUUID& session_id,
- const LLUUID& other_participant_id,
- const std::vector<LLUUID>& ids,
- EInstantMessage dialog)
-: LLFloater(session_id),
- mInputEditor(NULL),
- mHistoryEditor(NULL),
- mSessionUUID(session_id),
- mSessionLabel(session_label),
- mSessionInitialized(FALSE),
- mSessionStartMsgPos(0),
- mOtherParticipantUUID(other_participant_id),
- mDialog(dialog),
- mSessionInitialTargetIDs(ids),
- mTyping(FALSE),
- mOtherTyping(FALSE),
- mTypingLineStartIndex(0),
- mSentTypingState(TRUE),
- mNumUnreadMessages(0),
- mShowSpeakersOnConnect(TRUE),
- mTextIMPossible(TRUE),
- mProfileButtonEnabled(TRUE),
- mCallBackEnabled(TRUE),
- mSpeakerPanel(NULL),
- mFirstKeystrokeTimer(),
- mLastKeystrokeTimer()
-{
- std::string xml_filename;
- switch(mDialog)
- {
- case IM_SESSION_GROUP_START:
- mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
- xml_filename = "floater_instant_message_group.xml";
- break;
- case IM_SESSION_INVITE:
- mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
- if (gAgent.isInGroup(mSessionUUID))
- {
- xml_filename = "floater_instant_message_group.xml";
- }
- else // must be invite to ad hoc IM
- {
- xml_filename = "floater_instant_message_ad_hoc.xml";
- }
- break;
- case IM_SESSION_P2P_INVITE:
- xml_filename = "floater_instant_message.xml";
- break;
- case IM_SESSION_CONFERENCE_START:
- mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
- xml_filename = "floater_instant_message_ad_hoc.xml";
- break;
- // just received text from another user
- case IM_NOTHING_SPECIAL:
-
- xml_filename = "floater_instant_message.xml";
-
- mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID);
- mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID);
- mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID);
- break;
- default:
- LL_WARNS() << "Unknown session type" << LL_ENDL;
- xml_filename = "floater_instant_message.xml";
- break;
- }
-
- LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, NULL);
-
- setTitle(mSessionLabel);
- mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN);
- // enable line history support for instant message bar
- mInputEditor->setEnableLineHistory(TRUE);
-
- //*TODO we probably need the same "awaiting message" thing in LLFloaterIMSession
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionUUID);
- if (!im_session)
- {
- llerror("im session with id " + mSessionUUID.asString() + " does not exist!", 0);
- return;
- }
-
- mSessionInitialized = im_session->mSessionInitialized;
- if (!mSessionInitialized)
- {
- //locally echo a little "starting session" message
- LLUIString session_start = sSessionStartString;
-
- session_start.setArg("[NAME]", getTitle());
- mSessionStartMsgPos =
- mHistoryEditor->getWText().length();
-
- addHistoryLine(
- session_start,
- LLUIColorTable::instance().getColor("SystemChatColor"),
- false);
- }
+ const LLUUID& session_id,
+ const LLUUID& other_participant_id,
+ const std::vector<LLUUID>& ids,
+ EInstantMessage dialog)
+: LLFloater(session_id),
+ mInputEditor(NULL),
+ mHistoryEditor(NULL),
+ mSessionUUID(session_id),
+ mSessionLabel(session_label),
+ mSessionInitialized(FALSE),
+ mSessionStartMsgPos(0),
+ mOtherParticipantUUID(other_participant_id),
+ mDialog(dialog),
+ mSessionInitialTargetIDs(ids),
+ mTyping(FALSE),
+ mOtherTyping(FALSE),
+ mTypingLineStartIndex(0),
+ mSentTypingState(TRUE),
+ mNumUnreadMessages(0),
+ mShowSpeakersOnConnect(TRUE),
+ mTextIMPossible(TRUE),
+ mProfileButtonEnabled(TRUE),
+ mCallBackEnabled(TRUE),
+ mSpeakerPanel(NULL),
+ mFirstKeystrokeTimer(),
+ mLastKeystrokeTimer()
+{
+ std::string xml_filename;
+ switch(mDialog)
+ {
+ case IM_SESSION_GROUP_START:
+ mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
+ xml_filename = "floater_instant_message_group.xml";
+ break;
+ case IM_SESSION_INVITE:
+ mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
+ if (gAgent.isInGroup(mSessionUUID))
+ {
+ xml_filename = "floater_instant_message_group.xml";
+ }
+ else // must be invite to ad hoc IM
+ {
+ xml_filename = "floater_instant_message_ad_hoc.xml";
+ }
+ break;
+ case IM_SESSION_P2P_INVITE:
+ xml_filename = "floater_instant_message.xml";
+ break;
+ case IM_SESSION_CONFERENCE_START:
+ mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
+ xml_filename = "floater_instant_message_ad_hoc.xml";
+ break;
+ // just received text from another user
+ case IM_NOTHING_SPECIAL:
+
+ xml_filename = "floater_instant_message.xml";
+
+ mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID);
+ mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID);
+ mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID);
+ break;
+ default:
+ LL_WARNS() << "Unknown session type" << LL_ENDL;
+ xml_filename = "floater_instant_message.xml";
+ break;
+ }
+
+ LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, NULL);
+
+ setTitle(mSessionLabel);
+ mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN);
+ // enable line history support for instant message bar
+ mInputEditor->setEnableLineHistory(TRUE);
+
+ //*TODO we probably need the same "awaiting message" thing in LLFloaterIMSession
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionUUID);
+ if (!im_session)
+ {
+ llerror("im session with id " + mSessionUUID.asString() + " does not exist!", 0);
+ return;
+ }
+
+ mSessionInitialized = im_session->mSessionInitialized;
+ if (!mSessionInitialized)
+ {
+ //locally echo a little "starting session" message
+ LLUIString session_start = sSessionStartString;
+
+ session_start.setArg("[NAME]", getTitle());
+ mSessionStartMsgPos =
+ mHistoryEditor->getWText().length();
+
+ addHistoryLine(
+ session_start,
+ LLUIColorTable::instance().getColor("SystemChatColor"),
+ false);
+ }
}
LLFloaterIMPanel::~LLFloaterIMPanel()
{
- //delete focus lost callback
- mFocusCallbackConnection.disconnect();
+ //delete focus lost callback
+ mFocusCallbackConnection.disconnect();
}
-BOOL LLFloaterIMPanel::postBuild()
+BOOL LLFloaterIMPanel::postBuild()
{
- setVisibleCallback(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2));
-
- mInputEditor = getChild<LLLineEditor>("chat_editor");
- mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
- mFocusCallbackConnection = mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this));
- mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this );
- mInputEditor->setCommitCallback( onCommitChat, this );
- mInputEditor->setCommitOnFocusLost( FALSE );
- mInputEditor->setRevertOnEsc( FALSE );
- mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
+ setVisibleCallback(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2));
+
+ mInputEditor = getChild<LLLineEditor>("chat_editor");
+ mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
+ mFocusCallbackConnection = mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this));
+ mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this );
+ mInputEditor->setCommitCallback( onCommitChat, this );
+ mInputEditor->setCommitOnFocusLost( FALSE );
+ mInputEditor->setRevertOnEsc( FALSE );
+ mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
- childSetAction("profile_callee_btn", onClickProfile, this);
- childSetAction("group_info_btn", onClickGroupInfo, this);
+ childSetAction("profile_callee_btn", onClickProfile, this);
+ childSetAction("group_info_btn", onClickGroupInfo, this);
- childSetAction("start_call_btn", onClickStartCall, this);
- childSetAction("end_call_btn", onClickEndCall, this);
- childSetAction("send_btn", onClickSend, this);
- childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this);
+ childSetAction("start_call_btn", onClickStartCall, this);
+ childSetAction("end_call_btn", onClickEndCall, this);
+ childSetAction("send_btn", onClickSend, this);
+ childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this);
- childSetAction("moderator_kick_speaker", onKickSpeaker, this);
- //LLButton* close_btn = getChild<LLButton>("close_btn");
- //close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this);
+ childSetAction("moderator_kick_speaker", onKickSpeaker, this);
+ //LLButton* close_btn = getChild<LLButton>("close_btn");
+ //close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this);
- mHistoryEditor = getChild<LLViewerTextEditor>("im_history");
+ mHistoryEditor = getChild<LLViewerTextEditor>("im_history");
- if ( IM_SESSION_GROUP_START == mDialog )
- {
- childSetEnabled("profile_btn", FALSE);
- }
-
- if(!mProfileButtonEnabled)
- {
- childSetEnabled("profile_callee_btn", FALSE);
- }
+ if ( IM_SESSION_GROUP_START == mDialog )
+ {
+ childSetEnabled("profile_btn", FALSE);
+ }
- sTitleString = getString("title_string");
- sTypingStartString = getString("typing_start_string");
- sSessionStartString = getString("session_start_string");
+ if(!mProfileButtonEnabled)
+ {
+ childSetEnabled("profile_callee_btn", FALSE);
+ }
- if (mSpeakerPanel)
- {
- mSpeakerPanel->refreshSpeakers();
- }
+ sTitleString = getString("title_string");
+ sTypingStartString = getString("typing_start_string");
+ sSessionStartString = getString("session_start_string");
- if (mDialog == IM_NOTHING_SPECIAL)
- {
- childSetAction("mute_btn", onClickMuteVoice, this);
- childSetCommitCallback("speaker_volume", onVolumeChange, this);
- }
+ if (mSpeakerPanel)
+ {
+ mSpeakerPanel->refreshSpeakers();
+ }
- setDefaultBtn("send_btn");
- return TRUE;
+ if (mDialog == IM_NOTHING_SPECIAL)
+ {
+ childSetAction("mute_btn", onClickMuteVoice, this);
+ childSetCommitCallback("speaker_volume", onVolumeChange, this);
+ }
+
+ setDefaultBtn("send_btn");
+ return TRUE;
}
void* LLFloaterIMPanel::createSpeakersPanel(void* data)
{
- LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)data;
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(floaterp->mSessionUUID);
- floaterp->mSpeakerPanel = new LLPanelActiveSpeakers(speaker_mgr, TRUE);
- return floaterp->mSpeakerPanel;
+ LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)data;
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(floaterp->mSessionUUID);
+ floaterp->mSpeakerPanel = new LLPanelActiveSpeakers(speaker_mgr, TRUE);
+ return floaterp->mSpeakerPanel;
}
-//static
+//static
void LLFloaterIMPanel::onClickMuteVoice(void* user_data)
{
- LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
- if (floaterp)
- {
- BOOL is_muted = LLMuteList::getInstance()->isMuted(floaterp->mOtherParticipantUUID, LLMute::flagVoiceChat);
+ LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
+ if (floaterp)
+ {
+ BOOL is_muted = LLMuteList::getInstance()->isMuted(floaterp->mOtherParticipantUUID, LLMute::flagVoiceChat);
- LLMute mute(floaterp->mOtherParticipantUUID, floaterp->getTitle(), LLMute::AGENT);
- if (!is_muted)
- {
- LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat);
- }
- else
- {
- LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat);
- }
- }
+ LLMute mute(floaterp->mOtherParticipantUUID, floaterp->getTitle(), LLMute::AGENT);
+ if (!is_muted)
+ {
+ LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat);
+ }
+ else
+ {
+ LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat);
+ }
+ }
}
-//static
+//static
void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data)
{
- LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
- if (floaterp)
- {
- LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
- }
+ LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
+ if (floaterp)
+ {
+ LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
+ }
}
// virtual
void LLFloaterIMPanel::draw()
-{
- LLViewerRegion* region = gAgent.getRegion();
-
- BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "")
- && mSessionInitialized
- && LLVoiceClient::getInstance()->voiceEnabled()
- && mCallBackEnabled;
-
- // hide/show start call and end call buttons
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID);
- if (!voice_channel)
- return;
-
- childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
- childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
- childSetEnabled("start_call_btn", enable_connect);
- childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty());
-
- LLPointer<LLSpeaker> self_speaker;
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
- if (speaker_mgr)
- {
- self_speaker = speaker_mgr->findSpeaker(gAgent.getID());
- }
- if(!mTextIMPossible)
- {
- mInputEditor->setEnabled(FALSE);
- mInputEditor->setLabel(getString("unavailable_text_label"));
- }
- else if (self_speaker.notNull() && self_speaker->mModeratorMutedText)
- {
- mInputEditor->setEnabled(FALSE);
- mInputEditor->setLabel(getString("muted_text_label"));
- }
- else
- {
- mInputEditor->setEnabled(TRUE);
- mInputEditor->setLabel(getString("default_text_label"));
- }
-
- // show speakers window when voice first connects
- if (mShowSpeakersOnConnect && voice_channel->isActive())
- {
- childSetVisible("active_speakers_panel", TRUE);
- mShowSpeakersOnConnect = FALSE;
- }
- childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel"));
-
- if (mTyping)
- {
- // Time out if user hasn't typed for a while.
- if (mLastKeystrokeTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS)
- {
- setTyping(FALSE);
- }
-
- // If we are typing, and it's been a little while, send the
- // typing indicator
- if (!mSentTypingState
- && mFirstKeystrokeTimer.getElapsedTimeF32() > 1.f)
- {
- sendTypingState(TRUE);
- mSentTypingState = TRUE;
- }
- }
-
- // use embedded panel if available
- if (mSpeakerPanel)
- {
- if (mSpeakerPanel->getVisible())
- {
- mSpeakerPanel->refreshSpeakers();
- }
- }
- else
- {
- // refresh volume and mute checkbox
- childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
- childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID));
-
- childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
- childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
- }
- LLFloater::draw();
+{
+ LLViewerRegion* region = gAgent.getRegion();
+
+ BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "")
+ && mSessionInitialized
+ && LLVoiceClient::getInstance()->voiceEnabled()
+ && mCallBackEnabled;
+
+ // hide/show start call and end call buttons
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID);
+ if (!voice_channel)
+ return;
+
+ childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
+ childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
+ childSetEnabled("start_call_btn", enable_connect);
+ childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty());
+
+ LLPointer<LLSpeaker> self_speaker;
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
+ if (speaker_mgr)
+ {
+ self_speaker = speaker_mgr->findSpeaker(gAgent.getID());
+ }
+ if(!mTextIMPossible)
+ {
+ mInputEditor->setEnabled(FALSE);
+ mInputEditor->setLabel(getString("unavailable_text_label"));
+ }
+ else if (self_speaker.notNull() && self_speaker->mModeratorMutedText)
+ {
+ mInputEditor->setEnabled(FALSE);
+ mInputEditor->setLabel(getString("muted_text_label"));
+ }
+ else
+ {
+ mInputEditor->setEnabled(TRUE);
+ mInputEditor->setLabel(getString("default_text_label"));
+ }
+
+ // show speakers window when voice first connects
+ if (mShowSpeakersOnConnect && voice_channel->isActive())
+ {
+ childSetVisible("active_speakers_panel", TRUE);
+ mShowSpeakersOnConnect = FALSE;
+ }
+ childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel"));
+
+ if (mTyping)
+ {
+ // Time out if user hasn't typed for a while.
+ if (mLastKeystrokeTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS)
+ {
+ setTyping(FALSE);
+ }
+
+ // If we are typing, and it's been a little while, send the
+ // typing indicator
+ if (!mSentTypingState
+ && mFirstKeystrokeTimer.getElapsedTimeF32() > 1.f)
+ {
+ sendTypingState(TRUE);
+ mSentTypingState = TRUE;
+ }
+ }
+
+ // use embedded panel if available
+ if (mSpeakerPanel)
+ {
+ if (mSpeakerPanel->getVisible())
+ {
+ mSpeakerPanel->refreshSpeakers();
+ }
+ }
+ else
+ {
+ // refresh volume and mute checkbox
+ childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
+ childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID));
+
+ childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
+ childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
+ }
+ LLFloater::draw();
}
class LLSessionInviteResponder : public LLHTTPClient::Responder
{
- LOG_CLASS(LLSessionInviteResponder);
+ LOG_CLASS(LLSessionInviteResponder);
public:
- LLSessionInviteResponder(const LLUUID& session_id)
- {
- mSessionID = session_id;
- }
+ LLSessionInviteResponder(const LLUUID& session_id)
+ {
+ mSessionID = session_id;
+ }
protected:
- void httpFailure()
- {
- LL_WARNS() << "Error inviting all agents to session " << dumpResponse() << LL_ENDL;
- //throw something back to the viewer here?
- }
+ void httpFailure()
+ {
+ LL_WARNS() << "Error inviting all agents to session " << dumpResponse() << LL_ENDL;
+ //throw something back to the viewer here?
+ }
private:
- LLUUID mSessionID;
+ LLUUID mSessionID;
};
BOOL LLFloaterIMPanel::inviteToSession(const std::vector<LLUUID>& ids)
{
- LLViewerRegion* region = gAgent.getRegion();
- if (!region)
- {
- return FALSE;
- }
-
- S32 count = ids.size();
-
- if( isInviteAllowed() && (count > 0) )
- {
- LL_INFOS() << "LLFloaterIMPanel::inviteToSession() - inviting participants" << LL_ENDL;
-
- std::string url = region->getCapability("ChatSessionRequest");
-
- LLSD data;
-
- data["params"] = LLSD::emptyArray();
- for (int i = 0; i < count; i++)
- {
- data["params"].append(ids[i]);
- }
-
- data["method"] = "invite";
- data["session-id"] = mSessionUUID;
- LLHTTPClient::post(
- url,
- data,
- new LLSessionInviteResponder(
- mSessionUUID));
- }
- else
- {
- LL_INFOS() << "LLFloaterIMPanel::inviteToSession -"
- << " no need to invite agents for "
- << mDialog << LL_ENDL;
- // successful add, because everyone that needed to get added
- // was added.
- }
-
- return TRUE;
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region)
+ {
+ return FALSE;
+ }
+
+ S32 count = ids.size();
+
+ if( isInviteAllowed() && (count > 0) )
+ {
+ LL_INFOS() << "LLFloaterIMPanel::inviteToSession() - inviting participants" << LL_ENDL;
+
+ std::string url = region->getCapability("ChatSessionRequest");
+
+ LLSD data;
+
+ data["params"] = LLSD::emptyArray();
+ for (int i = 0; i < count; i++)
+ {
+ data["params"].append(ids[i]);
+ }
+
+ data["method"] = "invite";
+ data["session-id"] = mSessionUUID;
+ LLHTTPClient::post(
+ url,
+ data,
+ new LLSessionInviteResponder(
+ mSessionUUID));
+ }
+ else
+ {
+ LL_INFOS() << "LLFloaterIMPanel::inviteToSession -"
+ << " no need to invite agents for "
+ << mDialog << LL_ENDL;
+ // successful add, because everyone that needed to get added
+ // was added.
+ }
+
+ return TRUE;
}
void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name)
{
- // start tab flashing when receiving im for background session from user
- if (source != LLUUID::null)
- {
- LLMultiFloater* hostp = getHost();
- if( !isInVisibleChain()
- && hostp
- && source != gAgent.getID())
- {
- hostp->setFloaterFlashing(this, TRUE);
- }
- }
-
- // Now we're adding the actual line of text, so erase the
- // "Foo is typing..." text segment, and the optional timestamp
- // if it was present. JC
- removeTypingIndicator(NULL);
-
- // Actually add the line
- std::string timestring;
- bool prepend_newline = true;
- if (gSavedSettings.getBOOL("IMShowTimestamps"))
- {
- timestring = mHistoryEditor->appendTime(prepend_newline);
- prepend_newline = false;
- }
-
- std::string separator_string(": ");
-
- // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile.
- if (!name.empty()) // If name exists, then add it to the front of the message.
- {
- // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
- if (name == SYSTEM_FROM)
- {
- mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyle::Params().color(color));
- }
- else
- {
- // Convert the name to a hotlink and add to message.
- mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyleMap::instance().lookupAgent(source));
- }
- prepend_newline = false;
- }
- mHistoryEditor->appendText(utf8msg, prepend_newline, LLStyle::Params().color(color));
- mHistoryEditor->blockUndo();
-
- if (!isInVisibleChain())
- {
- mNumUnreadMessages++;
- }
+ // start tab flashing when receiving im for background session from user
+ if (source != LLUUID::null)
+ {
+ LLMultiFloater* hostp = getHost();
+ if( !isInVisibleChain()
+ && hostp
+ && source != gAgent.getID())
+ {
+ hostp->setFloaterFlashing(this, TRUE);
+ }
+ }
+
+ // Now we're adding the actual line of text, so erase the
+ // "Foo is typing..." text segment, and the optional timestamp
+ // if it was present. JC
+ removeTypingIndicator(NULL);
+
+ // Actually add the line
+ std::string timestring;
+ bool prepend_newline = true;
+ if (gSavedSettings.getBOOL("IMShowTimestamps"))
+ {
+ timestring = mHistoryEditor->appendTime(prepend_newline);
+ prepend_newline = false;
+ }
+
+ std::string separator_string(": ");
+
+ // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile.
+ if (!name.empty()) // If name exists, then add it to the front of the message.
+ {
+ // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
+ if (name == SYSTEM_FROM)
+ {
+ mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyle::Params().color(color));
+ }
+ else
+ {
+ // Convert the name to a hotlink and add to message.
+ mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyleMap::instance().lookupAgent(source));
+ }
+ prepend_newline = false;
+ }
+ mHistoryEditor->appendText(utf8msg, prepend_newline, LLStyle::Params().color(color));
+ mHistoryEditor->blockUndo();
+
+ if (!isInVisibleChain())
+ {
+ mNumUnreadMessages++;
+ }
}
void LLFloaterIMPanel::setInputFocus( BOOL b )
{
- mInputEditor->setFocus( b );
+ mInputEditor->setFocus( b );
}
void LLFloaterIMPanel::selectAll()
{
- mInputEditor->selectAll();
+ mInputEditor->selectAll();
}
void LLFloaterIMPanel::selectNone()
{
- mInputEditor->deselect();
+ mInputEditor->deselect();
}
BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask )
{
- BOOL handled = FALSE;
- if( KEY_RETURN == key && mask == MASK_NONE)
- {
- sendMsg();
- handled = TRUE;
- }
- else if ( KEY_ESCAPE == key )
- {
- handled = TRUE;
- gFocusMgr.setKeyboardFocus(NULL);
- }
+ BOOL handled = FALSE;
+ if( KEY_RETURN == key && mask == MASK_NONE)
+ {
+ sendMsg();
+ handled = TRUE;
+ }
+ else if ( KEY_ESCAPE == key )
+ {
+ handled = TRUE;
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
- // May need to call base class LLPanel::handleKeyHere if not handled
- // in order to tab between buttons. JNC 1.2.2002
- return handled;
+ // May need to call base class LLPanel::handleKeyHere if not handled
+ // in order to tab between buttons. JNC 1.2.2002
+ return handled;
}
BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
-{
-
- if (mDialog == IM_NOTHING_SPECIAL)
- {
- LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionUUID, drop,
- cargo_type, cargo_data, accept);
- }
-
- // handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites
- else if (isInviteAllowed())
- {
- *accept = ACCEPT_NO;
-
- if (cargo_type == DAD_CALLINGCARD)
- {
- if (dropCallingCard((LLInventoryItem*)cargo_data, drop))
- {
- *accept = ACCEPT_YES_MULTI;
- }
- }
- else if (cargo_type == DAD_CATEGORY)
- {
- if (dropCategory((LLInventoryCategory*)cargo_data, drop))
- {
- *accept = ACCEPT_YES_MULTI;
- }
- }
- }
- return TRUE;
-}
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
+{
+
+ if (mDialog == IM_NOTHING_SPECIAL)
+ {
+ LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionUUID, drop,
+ cargo_type, cargo_data, accept);
+ }
+
+ // handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites
+ else if (isInviteAllowed())
+ {
+ *accept = ACCEPT_NO;
+
+ if (cargo_type == DAD_CALLINGCARD)
+ {
+ if (dropCallingCard((LLInventoryItem*)cargo_data, drop))
+ {
+ *accept = ACCEPT_YES_MULTI;
+ }
+ }
+ else if (cargo_type == DAD_CATEGORY)
+ {
+ if (dropCategory((LLInventoryCategory*)cargo_data, drop))
+ {
+ *accept = ACCEPT_YES_MULTI;
+ }
+ }
+ }
+ return TRUE;
+}
BOOL LLFloaterIMPanel::dropCallingCard(LLInventoryItem* item, BOOL drop)
{
- BOOL rv = isInviteAllowed();
- if(rv && item && item->getCreatorUUID().notNull())
- {
- if(drop)
- {
- std::vector<LLUUID> ids;
- ids.push_back(item->getCreatorUUID());
- inviteToSession(ids);
- }
- }
- else
- {
- // set to false if creator uuid is null.
- rv = FALSE;
- }
- return rv;
+ BOOL rv = isInviteAllowed();
+ if(rv && item && item->getCreatorUUID().notNull())
+ {
+ if(drop)
+ {
+ std::vector<LLUUID> ids;
+ ids.push_back(item->getCreatorUUID());
+ inviteToSession(ids);
+ }
+ }
+ else
+ {
+ // set to false if creator uuid is null.
+ rv = FALSE;
+ }
+ return rv;
}
BOOL LLFloaterIMPanel::dropCategory(LLInventoryCategory* category, BOOL drop)
{
- BOOL rv = isInviteAllowed();
- if(rv && category)
- {
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLUniqueBuddyCollector buddies;
- gInventory.collectDescendentsIf(category->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- buddies);
- S32 count = items.count();
- if(count == 0)
- {
- rv = FALSE;
- }
- else if(drop)
- {
- std::vector<LLUUID> ids;
- ids.reserve(count);
- for(S32 i = 0; i < count; ++i)
- {
- ids.push_back(items.get(i)->getCreatorUUID());
- }
- inviteToSession(ids);
- }
- }
- return rv;
+ BOOL rv = isInviteAllowed();
+ if(rv && category)
+ {
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLUniqueBuddyCollector buddies;
+ gInventory.collectDescendentsIf(category->getUUID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ buddies);
+ S32 count = items.count();
+ if(count == 0)
+ {
+ rv = FALSE;
+ }
+ else if(drop)
+ {
+ std::vector<LLUUID> ids;
+ ids.reserve(count);
+ for(S32 i = 0; i < count; ++i)
+ {
+ ids.push_back(items.get(i)->getCreatorUUID());
+ }
+ inviteToSession(ids);
+ }
+ }
+ return rv;
}
BOOL LLFloaterIMPanel::isInviteAllowed() const
{
- return ( (IM_SESSION_CONFERENCE_START == mDialog)
- || (IM_SESSION_INVITE == mDialog) );
+ return ( (IM_SESSION_CONFERENCE_START == mDialog)
+ || (IM_SESSION_INVITE == mDialog) );
}
// static
void LLFloaterIMPanel::onTabClick(void* userdata)
{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
- self->setInputFocus(TRUE);
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
+ self->setInputFocus(TRUE);
}
// static
void LLFloaterIMPanel::onClickProfile( void* userdata )
{
- // Bring up the Profile window
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
-
- if (self->getOtherParticipantID().notNull())
- {
- LLAvatarActions::showProfile(self->getOtherParticipantID());
- }
+ // Bring up the Profile window
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
+
+ if (self->getOtherParticipantID().notNull())
+ {
+ LLAvatarActions::showProfile(self->getOtherParticipantID());
+ }
}
// static
void LLFloaterIMPanel::onClickGroupInfo( void* userdata )
{
- // Bring up the Profile window
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
+ // Bring up the Profile window
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
- LLGroupActions::show(self->mSessionUUID);
+ LLGroupActions::show(self->mSessionUUID);
}
// static
void LLFloaterIMPanel::onClickClose( void* userdata )
{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
- if(self)
- {
- self->closeFloater();
- }
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
+ if(self)
+ {
+ self->closeFloater();
+ }
}
// static
void LLFloaterIMPanel::onClickStartCall(void* userdata)
{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
- gIMMgr->startCall(self->mSessionUUID);
+ gIMMgr->startCall(self->mSessionUUID);
}
// static
void LLFloaterIMPanel::onClickEndCall(void* userdata)
{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
- gIMMgr->endCall(self->mSessionUUID);
+ gIMMgr->endCall(self->mSessionUUID);
}
// static
void LLFloaterIMPanel::onClickSend(void* userdata)
{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
- self->sendMsg();
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
+ self->sendMsg();
}
// static
void LLFloaterIMPanel::onClickToggleActiveSpeakers(void* userdata)
{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
- self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel"));
+ self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel"));
}
// static
void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata)
{
- LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata;
- self->sendMsg();
+ LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata;
+ self->sendMsg();
}
// static
void LLFloaterIMPanel::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata )
{
- LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata;
- self->mHistoryEditor->setCursorAndScrollToEnd();
+ LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata;
+ self->mHistoryEditor->setCursorAndScrollToEnd();
}
// static
void LLFloaterIMPanel::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata)
{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
- self->setTyping(FALSE);
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
+ self->setTyping(FALSE);
}
// static
void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata)
{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
- std::string text = self->mInputEditor->getText();
- if (!text.empty())
- {
- self->setTyping(TRUE);
- }
- else
- {
- // Deleting all text counts as stopping typing.
- self->setTyping(FALSE);
- }
+ LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
+ std::string text = self->mInputEditor->getText();
+ if (!text.empty())
+ {
+ self->setTyping(TRUE);
+ }
+ else
+ {
+ // Deleting all text counts as stopping typing.
+ self->setTyping(FALSE);
+ }
}
// virtual
void LLFloaterIMPanel::onClose(bool app_quitting)
{
- setTyping(FALSE);
+ setTyping(FALSE);
- gIMMgr->leaveSession(mSessionUUID);
+ gIMMgr->leaveSession(mSessionUUID);
- // *HACK hide the voice floater
- LLFloaterReg::hideInstance("voice_call", mSessionUUID);
+ // *HACK hide the voice floater
+ LLFloaterReg::hideInstance("voice_call", mSessionUUID);
}
void LLFloaterIMPanel::onVisibilityChange(const LLSD& new_visibility)
{
- if (new_visibility.asBoolean())
- {
- mNumUnreadMessages = 0;
- }
-
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID);
- if (voice_channel && voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED)
- {
- if (new_visibility.asBoolean())
- LLFloaterReg::showInstance("voice_call", mSessionUUID);
- else
- LLFloaterReg::hideInstance("voice_call", mSessionUUID);
- }
+ if (new_visibility.asBoolean())
+ {
+ mNumUnreadMessages = 0;
+ }
+
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID);
+ if (voice_channel && voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED)
+ {
+ if (new_visibility.asBoolean())
+ LLFloaterReg::showInstance("voice_call", mSessionUUID);
+ else
+ LLFloaterReg::hideInstance("voice_call", mSessionUUID);
+ }
}
void LLFloaterIMPanel::sendMsg()
{
- if (!gAgent.isGodlike()
- && (mDialog == IM_NOTHING_SPECIAL)
- && mOtherParticipantUUID.isNull())
- {
- LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL;
- return;
- }
-
- if (mInputEditor)
- {
- LLWString text = mInputEditor->getConvertedText();
- if(!text.empty())
- {
- // store sent line in history, duplicates will get filtered
- if (mInputEditor) mInputEditor->updateHistory();
- // Truncate and convert to UTF8 for transport
- std::string utf8_text = wstring_to_utf8str(text);
- utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1);
-
- if ( mSessionInitialized )
- {
- LLIMModel::sendMessage(utf8_text,
- mSessionUUID,
- mOtherParticipantUUID,
- mDialog);
-
- }
- else
- {
- //queue up the message to send once the session is
- //initialized
- mQueuedMsgsForInit.append(utf8_text);
- }
- }
-
- LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT);
-
- mInputEditor->setText(LLStringUtil::null);
- }
-
- // Don't need to actually send the typing stop message, the other
- // client will infer it from receiving the message.
- mTyping = FALSE;
- mSentTypingState = TRUE;
+ if (!gAgent.isGodlike()
+ && (mDialog == IM_NOTHING_SPECIAL)
+ && mOtherParticipantUUID.isNull())
+ {
+ LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL;
+ return;
+ }
+
+ if (mInputEditor)
+ {
+ LLWString text = mInputEditor->getConvertedText();
+ if(!text.empty())
+ {
+ // store sent line in history, duplicates will get filtered
+ if (mInputEditor) mInputEditor->updateHistory();
+ // Truncate and convert to UTF8 for transport
+ std::string utf8_text = wstring_to_utf8str(text);
+ utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1);
+
+ if ( mSessionInitialized )
+ {
+ LLIMModel::sendMessage(utf8_text,
+ mSessionUUID,
+ mOtherParticipantUUID,
+ mDialog);
+
+ }
+ else
+ {
+ //queue up the message to send once the session is
+ //initialized
+ mQueuedMsgsForInit.append(utf8_text);
+ }
+ }
+
+ LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT);
+
+ mInputEditor->setText(LLStringUtil::null);
+ }
+
+ // Don't need to actually send the typing stop message, the other
+ // client will infer it from receiving the message.
+ mTyping = FALSE;
+ mSentTypingState = TRUE;
}
void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update)
{
- if (
- session_update.has("moderated_mode") &&
- session_update["moderated_mode"].has("voice") )
- {
- BOOL voice_moderated = session_update["moderated_mode"]["voice"];
+ if (
+ session_update.has("moderated_mode") &&
+ session_update["moderated_mode"].has("voice") )
+ {
+ BOOL voice_moderated = session_update["moderated_mode"]["voice"];
- if (voice_moderated)
- {
- setTitle(mSessionLabel + std::string(" ") + getString("moderated_chat_label"));
- }
- else
- {
- setTitle(mSessionLabel);
- }
+ if (voice_moderated)
+ {
+ setTitle(mSessionLabel + std::string(" ") + getString("moderated_chat_label"));
+ }
+ else
+ {
+ setTitle(mSessionLabel);
+ }
- //update the speakers dropdown too, if it's available
- if (mSpeakerPanel)
- {
- mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated);
- }
- }
+ //update the speakers dropdown too, if it's available
+ if (mSpeakerPanel)
+ {
+ mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated);
+ }
+ }
}
void LLFloaterIMPanel::sessionInitReplyReceived(const LLUUID& session_id)
{
- mSessionUUID = session_id;
- mSessionInitialized = TRUE;
-
- //we assume the history editor hasn't moved at all since
- //we added the starting session message
- //so, we count how many characters to remove
- S32 chars_to_remove = mHistoryEditor->getWText().length() -
- mSessionStartMsgPos;
- mHistoryEditor->removeTextFromEnd(chars_to_remove);
-
- //and now, send the queued msg
- LLSD::array_iterator iter;
- for ( iter = mQueuedMsgsForInit.beginArray();
- iter != mQueuedMsgsForInit.endArray();
- ++iter)
- {
- LLIMModel::sendMessage(
- iter->asString(),
- mSessionUUID,
- mOtherParticipantUUID,
- mDialog);
- }
+ mSessionUUID = session_id;
+ mSessionInitialized = TRUE;
+
+ //we assume the history editor hasn't moved at all since
+ //we added the starting session message
+ //so, we count how many characters to remove
+ S32 chars_to_remove = mHistoryEditor->getWText().length() -
+ mSessionStartMsgPos;
+ mHistoryEditor->removeTextFromEnd(chars_to_remove);
+
+ //and now, send the queued msg
+ LLSD::array_iterator iter;
+ for ( iter = mQueuedMsgsForInit.beginArray();
+ iter != mQueuedMsgsForInit.endArray();
+ ++iter)
+ {
+ LLIMModel::sendMessage(
+ iter->asString(),
+ mSessionUUID,
+ mOtherParticipantUUID,
+ mDialog);
+ }
}
void LLFloaterIMPanel::setTyping(BOOL typing)
{
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
- if (typing)
- {
- // Every time you type something, reset this timer
- mLastKeystrokeTimer.reset();
-
- if (!mTyping)
- {
- // You just started typing.
- mFirstKeystrokeTimer.reset();
-
- // Will send typing state after a short delay.
- mSentTypingState = FALSE;
- }
-
- if (speaker_mgr)
- speaker_mgr->setSpeakerTyping(gAgent.getID(), TRUE);
- }
- else
- {
- if (mTyping)
- {
- // you just stopped typing, send state immediately
- sendTypingState(FALSE);
- mSentTypingState = TRUE;
- }
- if (speaker_mgr)
- speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE);
- }
-
- mTyping = typing;
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
+ if (typing)
+ {
+ // Every time you type something, reset this timer
+ mLastKeystrokeTimer.reset();
+
+ if (!mTyping)
+ {
+ // You just started typing.
+ mFirstKeystrokeTimer.reset();
+
+ // Will send typing state after a short delay.
+ mSentTypingState = FALSE;
+ }
+
+ if (speaker_mgr)
+ speaker_mgr->setSpeakerTyping(gAgent.getID(), TRUE);
+ }
+ else
+ {
+ if (mTyping)
+ {
+ // you just stopped typing, send state immediately
+ sendTypingState(FALSE);
+ mSentTypingState = TRUE;
+ }
+ if (speaker_mgr)
+ speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE);
+ }
+
+ mTyping = typing;
}
void LLFloaterIMPanel::sendTypingState(BOOL typing)
{
- // Don't want to send typing indicators to multiple people, potentially too
- // much network traffic. Only send in person-to-person IMs.
- if (mDialog != IM_NOTHING_SPECIAL) return;
+ // Don't want to send typing indicators to multiple people, potentially too
+ // much network traffic. Only send in person-to-person IMs.
+ if (mDialog != IM_NOTHING_SPECIAL) return;
- LLIMModel::instance().sendTypingState(mSessionUUID, mOtherParticipantUUID, typing);
+ LLIMModel::instance().sendTypingState(mSessionUUID, mOtherParticipantUUID, typing);
}
void LLFloaterIMPanel::processIMTyping(const LLIMInfo* im_info, BOOL typing)
{
- if (typing)
- {
- // other user started typing
- addTypingIndicator(im_info->mName);
- }
- else
- {
- // other user stopped typing
- removeTypingIndicator(im_info);
- }
+ if (typing)
+ {
+ // other user started typing
+ addTypingIndicator(im_info->mName);
+ }
+ else
+ {
+ // other user stopped typing
+ removeTypingIndicator(im_info);
+ }
}
void LLFloaterIMPanel::addTypingIndicator(const std::string &name)
{
- // we may have lost a "stop-typing" packet, don't add it twice
- if (!mOtherTyping)
- {
- mTypingLineStartIndex = mHistoryEditor->getWText().length();
- LLUIString typing_start = sTypingStartString;
- typing_start.setArg("[NAME]", name);
- addHistoryLine(typing_start, LLUIColorTable::instance().getColor("SystemChatColor"), false);
- mOtherTypingName = name;
- mOtherTyping = TRUE;
- }
- // MBW -- XXX -- merge from release broke this (argument to this function changed from an LLIMInfo to a name)
- // Richard will fix.
-// mSpeakers->setSpeakerTyping(im_info->mFromID, TRUE);
+ // we may have lost a "stop-typing" packet, don't add it twice
+ if (!mOtherTyping)
+ {
+ mTypingLineStartIndex = mHistoryEditor->getWText().length();
+ LLUIString typing_start = sTypingStartString;
+ typing_start.setArg("[NAME]", name);
+ addHistoryLine(typing_start, LLUIColorTable::instance().getColor("SystemChatColor"), false);
+ mOtherTypingName = name;
+ mOtherTyping = TRUE;
+ }
+ // MBW -- XXX -- merge from release broke this (argument to this function changed from an LLIMInfo to a name)
+ // Richard will fix.
+// mSpeakers->setSpeakerTyping(im_info->mFromID, TRUE);
}
void LLFloaterIMPanel::removeTypingIndicator(const LLIMInfo* im_info)
{
- if (mOtherTyping)
- {
- // Must do this first, otherwise addHistoryLine calls us again.
- mOtherTyping = FALSE;
-
- S32 chars_to_remove = mHistoryEditor->getWText().length() - mTypingLineStartIndex;
- mHistoryEditor->removeTextFromEnd(chars_to_remove);
- if (im_info)
- {
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
- if (speaker_mgr)
- {
- speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE);
- }
- }
- }
-}
-
-//static
+ if (mOtherTyping)
+ {
+ // Must do this first, otherwise addHistoryLine calls us again.
+ mOtherTyping = FALSE;
+
+ S32 chars_to_remove = mHistoryEditor->getWText().length() - mTypingLineStartIndex;
+ mHistoryEditor->removeTextFromEnd(chars_to_remove);
+ if (im_info)
+ {
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
+ if (speaker_mgr)
+ {
+ speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE);
+ }
+ }
+ }
+}
+
+//static
void LLFloaterIMPanel::onKickSpeaker(void* user_data)
{
diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h
index c5930b56f7..01cd0c5861 100644
--- a/indra/newview/llimpanel.h
+++ b/indra/newview/llimpanel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llimpanel.h
* @brief LLIMPanel class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,166 +47,166 @@ class LLFloaterIMPanel : public LLFloater
{
public:
- // The session id is the id of the session this is for. The target
- // refers to the user (or group) that where this session serves as
- // the default. For example, if you open a session though a
- // calling card, a new session id will be generated, but the
- // target_id will be the agent referenced by the calling card.
- LLFloaterIMPanel(const std::string& session_label,
- const LLUUID& session_id,
- const LLUUID& target_id,
- const std::vector<LLUUID>& ids,
- EInstantMessage dialog);
- virtual ~LLFloaterIMPanel();
-
- /*virtual*/ BOOL postBuild();
-
- // Check typing timeout timer.
- /*virtual*/ void draw();
-
- /*virtual*/ void onClose(bool app_quitting);
- void onVisibilityChange(const LLSD& new_visibility);
-
- // add target ids to the session.
- // Return TRUE if successful, otherwise FALSE.
- BOOL inviteToSession(const std::vector<LLUUID>& agent_ids);
-
- void addHistoryLine(const std::string &utf8msg,
- const LLColor4& color = LLColor4::white,
- bool log_to_file = true,
- const LLUUID& source = LLUUID::null,
- const std::string& name = LLStringUtil::null);
-
- void setInputFocus( BOOL b );
-
- void selectAll();
- void selectNone();
-
- S32 getNumUnreadMessages() { return mNumUnreadMessages; }
-
- BOOL handleKeyHere(KEY key, MASK mask);
- BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type,
- void *cargo_data, EAcceptance *accept,
- std::string& tooltip_msg);
-
- static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
- static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
- static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
- static void onCommitChat(LLUICtrl* caller, void* userdata);
- static void onTabClick( void* userdata );
-
- static void onClickProfile( void* userdata );
- static void onClickGroupInfo( void* userdata );
- static void onClickClose( void* userdata );
- static void onClickStartCall( void* userdata );
- static void onClickEndCall( void* userdata );
- static void onClickSend( void* userdata );
- static void onClickToggleActiveSpeakers( void* userdata );
- static void* createSpeakersPanel(void* data);
- static void onKickSpeaker(void* user_data);
-
- //callbacks for P2P muting and volume control
- static void onClickMuteVoice(void* user_data);
- static void onVolumeChange(LLUICtrl* source, void* user_data);
-
- const LLUUID& getSessionID() const { return mSessionUUID; }
- const LLUUID& getOtherParticipantID() const { return mOtherParticipantUUID; }
- void processSessionUpdate(const LLSD& update);
- EInstantMessage getDialogType() const { return mDialog; }
- void setDialogType(EInstantMessage dialog) { mDialog = dialog; }
-
- void sessionInitReplyReceived(const LLUUID& im_session_id);
-
- // Handle other participant in the session typing.
- void processIMTyping(const LLIMInfo* im_info, BOOL typing);
+ // The session id is the id of the session this is for. The target
+ // refers to the user (or group) that where this session serves as
+ // the default. For example, if you open a session though a
+ // calling card, a new session id will be generated, but the
+ // target_id will be the agent referenced by the calling card.
+ LLFloaterIMPanel(const std::string& session_label,
+ const LLUUID& session_id,
+ const LLUUID& target_id,
+ const std::vector<LLUUID>& ids,
+ EInstantMessage dialog);
+ virtual ~LLFloaterIMPanel();
+
+ /*virtual*/ BOOL postBuild();
+
+ // Check typing timeout timer.
+ /*virtual*/ void draw();
+
+ /*virtual*/ void onClose(bool app_quitting);
+ void onVisibilityChange(const LLSD& new_visibility);
+
+ // add target ids to the session.
+ // Return TRUE if successful, otherwise FALSE.
+ BOOL inviteToSession(const std::vector<LLUUID>& agent_ids);
+
+ void addHistoryLine(const std::string &utf8msg,
+ const LLColor4& color = LLColor4::white,
+ bool log_to_file = true,
+ const LLUUID& source = LLUUID::null,
+ const std::string& name = LLStringUtil::null);
+
+ void setInputFocus( BOOL b );
+
+ void selectAll();
+ void selectNone();
+
+ S32 getNumUnreadMessages() { return mNumUnreadMessages; }
+
+ BOOL handleKeyHere(KEY key, MASK mask);
+ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
+ BOOL drop, EDragAndDropType cargo_type,
+ void *cargo_data, EAcceptance *accept,
+ std::string& tooltip_msg);
+
+ static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
+ static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
+ static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
+ static void onCommitChat(LLUICtrl* caller, void* userdata);
+ static void onTabClick( void* userdata );
+
+ static void onClickProfile( void* userdata );
+ static void onClickGroupInfo( void* userdata );
+ static void onClickClose( void* userdata );
+ static void onClickStartCall( void* userdata );
+ static void onClickEndCall( void* userdata );
+ static void onClickSend( void* userdata );
+ static void onClickToggleActiveSpeakers( void* userdata );
+ static void* createSpeakersPanel(void* data);
+ static void onKickSpeaker(void* user_data);
+
+ //callbacks for P2P muting and volume control
+ static void onClickMuteVoice(void* user_data);
+ static void onVolumeChange(LLUICtrl* source, void* user_data);
+
+ const LLUUID& getSessionID() const { return mSessionUUID; }
+ const LLUUID& getOtherParticipantID() const { return mOtherParticipantUUID; }
+ void processSessionUpdate(const LLSD& update);
+ EInstantMessage getDialogType() const { return mDialog; }
+ void setDialogType(EInstantMessage dialog) { mDialog = dialog; }
+
+ void sessionInitReplyReceived(const LLUUID& im_session_id);
+
+ // Handle other participant in the session typing.
+ void processIMTyping(const LLIMInfo* im_info, BOOL typing);
private:
- // Called by UI methods.
- void sendMsg();
+ // Called by UI methods.
+ void sendMsg();
- // for adding agents via the UI. Return TRUE if possible, do it if
- BOOL dropCallingCard(LLInventoryItem* item, BOOL drop);
- BOOL dropCategory(LLInventoryCategory* category, BOOL drop);
+ // for adding agents via the UI. Return TRUE if possible, do it if
+ BOOL dropCallingCard(LLInventoryItem* item, BOOL drop);
+ BOOL dropCategory(LLInventoryCategory* category, BOOL drop);
- // test if local agent can add agents.
- BOOL isInviteAllowed() const;
+ // test if local agent can add agents.
+ BOOL isInviteAllowed() const;
- // Called whenever the user starts or stops typing.
- // Sends the typing state to the other user if necessary.
- void setTyping(BOOL typing);
+ // Called whenever the user starts or stops typing.
+ // Sends the typing state to the other user if necessary.
+ void setTyping(BOOL typing);
- // Add the "User is typing..." indicator.
- void addTypingIndicator(const std::string &name);
+ // Add the "User is typing..." indicator.
+ void addTypingIndicator(const std::string &name);
- // Remove the "User is typing..." indicator.
- void removeTypingIndicator(const LLIMInfo* im_info);
+ // Remove the "User is typing..." indicator.
+ void removeTypingIndicator(const LLIMInfo* im_info);
+
+ void sendTypingState(BOOL typing);
- void sendTypingState(BOOL typing);
-
private:
- LLLineEditor* mInputEditor;
- LLViewerTextEditor* mHistoryEditor;
+ LLLineEditor* mInputEditor;
+ LLViewerTextEditor* mHistoryEditor;
+
+ // The value of the mSessionUUID depends on how the IM session was started:
+ // one-on-one ==> random id
+ // group ==> group_id
+ // inventory folder ==> folder item_id
+ // 911 ==> Gaurdian_Angel_Group_ID ^ gAgent.getID()
+ LLUUID mSessionUUID;
+
+ std::string mSessionLabel;
- // The value of the mSessionUUID depends on how the IM session was started:
- // one-on-one ==> random id
- // group ==> group_id
- // inventory folder ==> folder item_id
- // 911 ==> Gaurdian_Angel_Group_ID ^ gAgent.getID()
- LLUUID mSessionUUID;
+ BOOL mSessionInitialized;
+ LLSD mQueuedMsgsForInit;
- std::string mSessionLabel;
+ // The value mOtherParticipantUUID depends on how the IM session was started:
+ // one-on-one = recipient's id
+ // group ==> group_id
+ // inventory folder ==> first target id in list
+ // 911 ==> sender
+ LLUUID mOtherParticipantUUID;
+ std::vector<LLUUID> mSessionInitialTargetIDs;
- BOOL mSessionInitialized;
- LLSD mQueuedMsgsForInit;
+ EInstantMessage mDialog;
- // The value mOtherParticipantUUID depends on how the IM session was started:
- // one-on-one = recipient's id
- // group ==> group_id
- // inventory folder ==> first target id in list
- // 911 ==> sender
- LLUUID mOtherParticipantUUID;
- std::vector<LLUUID> mSessionInitialTargetIDs;
+ // Are you currently typing?
+ BOOL mTyping;
- EInstantMessage mDialog;
+ // Is other user currently typing?
+ BOOL mOtherTyping;
- // Are you currently typing?
- BOOL mTyping;
+ // name of other user who is currently typing
+ std::string mOtherTypingName;
- // Is other user currently typing?
- BOOL mOtherTyping;
+ // Where does the "User is typing..." line start?
+ S32 mTypingLineStartIndex;
+ // Where does the "Starting session..." line start?
+ S32 mSessionStartMsgPos;
- // name of other user who is currently typing
- std::string mOtherTypingName;
+ S32 mNumUnreadMessages;
- // Where does the "User is typing..." line start?
- S32 mTypingLineStartIndex;
- // Where does the "Starting session..." line start?
- S32 mSessionStartMsgPos;
-
- S32 mNumUnreadMessages;
+ BOOL mSentTypingState;
- BOOL mSentTypingState;
+ BOOL mShowSpeakersOnConnect;
- BOOL mShowSpeakersOnConnect;
+ BOOL mTextIMPossible;
+ BOOL mProfileButtonEnabled;
+ BOOL mCallBackEnabled;
- BOOL mTextIMPossible;
- BOOL mProfileButtonEnabled;
- BOOL mCallBackEnabled;
+ LLPanelActiveSpeakers* mSpeakerPanel;
- LLPanelActiveSpeakers* mSpeakerPanel;
-
- // Optimization: Don't send "User is typing..." until the
- // user has actually been typing for a little while. Prevents
- // extra IMs for brief "lol" type utterences.
- LLFrameTimer mFirstKeystrokeTimer;
+ // Optimization: Don't send "User is typing..." until the
+ // user has actually been typing for a little while. Prevents
+ // extra IMs for brief "lol" type utterences.
+ LLFrameTimer mFirstKeystrokeTimer;
- // Timer to detect when user has stopped typing.
- LLFrameTimer mLastKeystrokeTimer;
+ // Timer to detect when user has stopped typing.
+ LLFrameTimer mLastKeystrokeTimer;
- boost::signals2::connection mFocusCallbackConnection;
+ boost::signals2::connection mFocusCallbackConnection;
- void disableWhileSessionStarting();
+ void disableWhileSessionStarting();
};
#endif // LL_IMPANEL_H
diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp
index 948793681d..ff803ae312 100644
--- a/indra/newview/llimprocessing.cpp
+++ b/indra/newview/llimprocessing.cpp
@@ -245,7 +245,7 @@ void inventory_offer_handler(LLOfferInfo* info)
object_id.generate(msg);
payload["from_id"] = info->mFromID;
- // Needed by LLScriptFloaterManager to bind original notification with
+ // Needed by LLScriptFloaterManager to bind original notification with
// faked for toast one.
payload["object_id"] = object_id;
// Flag indicating that this notification is faked for toast.
@@ -285,7 +285,7 @@ void inventory_offer_handler(LLOfferInfo* info)
p.responder = info;
// Note: sets inventory_offer_callback as the callback
// *TODO fix memory leak
- // inventory_offer_callback() is not invoked if user received notification and
+ // inventory_offer_callback() is not invoked if user received notification and
// closes viewer(without responding the notification)
p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
info->mPersist = true;
@@ -489,7 +489,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
LLPostponedNotification::add<LLPostponedIMSystemTipNotification>(params, from_id, false);
break;
- case IM_NOTHING_SPECIAL: // p2p IM
+ case IM_NOTHING_SPECIAL: // p2p IM
// Don't show dialog, just do IM
if (!gAgent.isGodlike()
&& gAgent.getRegion()->isPrelude()
@@ -679,7 +679,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
U8 item_name[DB_INV_ITEM_NAME_BUF_SIZE];
}*notice_bin_bucket;
- // Make sure the binary bucket is big enough to hold the header
+ // Make sure the binary bucket is big enough to hold the header
// and a null terminated item name.
if ((binary_bucket_size < (S32)((sizeof(notice_bucket_header_t) + sizeof(U8))))
|| (binary_bucket[binary_bucket_size - 1] != '\0'))
@@ -852,8 +852,8 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
{
struct offer_agent_bucket_t
{
- S8 asset_type;
- LLUUID object_id;
+ S8 asset_type;
+ LLUUID object_id;
}*bucketp;
if (sizeof(offer_agent_bucket_t) != binary_bucket_size)
@@ -875,8 +875,8 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
}
else
{
- /*RIDER*/ // The previous version of the protocol returned the wrong binary bucket... we
- // still might be able to figure out the type... even though the offer is not retrievable.
+ /*RIDER*/ // The previous version of the protocol returned the wrong binary bucket... we
+ // still might be able to figure out the type... even though the offer is not retrievable.
// Should be safe to remove once DRTSIM-451 fully deploys
std::string str_bucket(reinterpret_cast<char *>(binary_bucket));
@@ -889,7 +889,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
// We could try AT_UNKNOWN which would be more accurate, but that causes an auto decline
info->mType = static_cast<LLAssetType::EType>(type);
- // Don't break in the case of a bad binary bucket. Go ahead and show the
+ // Don't break in the case of a bad binary bucket. Go ahead and show the
// accept/decline popup even though it will not do anything.
LL_WARNS("Messaging") << "Malformed inventory offer from object, type might be " << info->mType << LL_ENDL;
}
@@ -1076,7 +1076,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
}
break;
- case IM_SESSION_SEND: // ad-hoc or group IMs
+ case IM_SESSION_SEND: // ad-hoc or group IMs
// Only show messages if we have a session open (which
// should happen after you get an "invitation"
@@ -1088,7 +1088,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
else if (offline == IM_ONLINE && is_do_not_disturb)
{
- // return a standard "do not disturb" message, but only do it to online IM
+ // return a standard "do not disturb" message, but only do it to online IM
// (i.e. not other auto responses and not store-and-forward IM)
if (!gIMMgr->hasSession(session_id))
{
@@ -1597,8 +1597,8 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url)
{
const LLSD &message_data(*i);
- /* RIDER: Many fields in this message are using a '_' rather than the standard '-'. This
- * should be changed but would require tight coordination with the simulator.
+ /* RIDER: Many fields in this message are using a '_' rather than the standard '-'. This
+ * should be changed but would require tight coordination with the simulator.
*/
LLVector3 position;
if (message_data.has("position"))
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index ce4a032b27..0eb5a2c365 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -28,7 +28,7 @@
#include "llimview.h"
-#include "llavatarnamecache.h" // IDEVO
+#include "llavatarnamecache.h" // IDEVO
#include "llavataractions.h"
#include "llfloaterconversationlog.h"
#include "llfloaterreg.h"
@@ -101,14 +101,14 @@ LLIMMgr* gIMMgr = NULL;
BOOL LLSessionTimeoutTimer::tick()
{
- if (mSessionId.isNull()) return TRUE;
+ if (mSessionId.isNull()) return TRUE;
- LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId);
- if (session && !session->mSessionInitialized)
- {
- gIMMgr->showSessionStartError("session_initialization_timed_out_error", mSessionId);
- }
- return TRUE;
+ LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId);
+ if (session && !session->mSessionInitialized)
+ {
+ gIMMgr->showSessionStartError("session_initialization_timed_out_error", mSessionId);
+ }
+ return TRUE;
}
@@ -146,25 +146,25 @@ void process_dnd_im(const LLSD& notification)
static void on_avatar_name_cache_toast(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- LLSD msg)
+ const LLAvatarName& av_name,
+ LLSD msg)
{
- LLSD args;
- args["MESSAGE"] = msg["message"];
- args["TIME"] = msg["time"];
- // *TODO: Can this ever be an object name or group name?
- args["FROM"] = av_name.getCompleteName();
- args["FROM_ID"] = msg["from_id"];
- args["SESSION_ID"] = msg["session_id"];
- args["SESSION_TYPE"] = msg["session_type"];
- LLNotificationsUtil::add("IMToast", args, args, boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID()));
+ LLSD args;
+ args["MESSAGE"] = msg["message"];
+ args["TIME"] = msg["time"];
+ // *TODO: Can this ever be an object name or group name?
+ args["FROM"] = av_name.getCompleteName();
+ args["FROM_ID"] = msg["from_id"];
+ args["SESSION_ID"] = msg["session_id"];
+ args["SESSION_TYPE"] = msg["session_type"];
+ LLNotificationsUtil::add("IMToast", args, args, boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID()));
}
void notify_of_message(const LLSD& msg, bool is_dnd_msg)
{
std::string user_preferences;
- LLUUID participant_id = msg[is_dnd_msg ? "FROM_ID" : "from_id"].asUUID();
- LLUUID session_id = msg[is_dnd_msg ? "SESSION_ID" : "session_id"].asUUID();
+ LLUUID participant_id = msg[is_dnd_msg ? "FROM_ID" : "from_id"].asUUID();
+ LLUUID session_id = msg[is_dnd_msg ? "SESSION_ID" : "session_id"].asUUID();
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
// do not show notification which goes from agent
@@ -178,222 +178,222 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
- bool store_dnd_message = false; // flag storage of a dnd message
- bool is_session_focused = session_floater->isTornOff() && session_floater->hasFocus();
- if (!LLFloater::isVisible(im_box) || im_box->isMinimized())
- {
- conversations_floater_status = CLOSED;
- }
- else if (!im_box->hasFocus() &&
- !(session_floater && LLFloater::isVisible(session_floater)
- && !session_floater->isMinimized() && session_floater->hasFocus()))
- {
- conversations_floater_status = NOT_ON_TOP;
- }
- else if (im_box->getSelectedSession() != session_id)
- {
- conversations_floater_status = ON_TOP;
- }
- else
- {
- conversations_floater_status = ON_TOP_AND_ITEM_IS_SELECTED;
- }
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
+ bool store_dnd_message = false; // flag storage of a dnd message
+ bool is_session_focused = session_floater->isTornOff() && session_floater->hasFocus();
+ if (!LLFloater::isVisible(im_box) || im_box->isMinimized())
+ {
+ conversations_floater_status = CLOSED;
+ }
+ else if (!im_box->hasFocus() &&
+ !(session_floater && LLFloater::isVisible(session_floater)
+ && !session_floater->isMinimized() && session_floater->hasFocus()))
+ {
+ conversations_floater_status = NOT_ON_TOP;
+ }
+ else if (im_box->getSelectedSession() != session_id)
+ {
+ conversations_floater_status = ON_TOP;
+ }
+ else
+ {
+ conversations_floater_status = ON_TOP_AND_ITEM_IS_SELECTED;
+ }
// determine user prefs for this session
if (session_id.isNull())
{
- if (msg["source_type"].asInteger() == CHAT_SOURCE_OBJECT)
- {
- user_preferences = gSavedSettings.getString("NotificationObjectIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundObjectIM") == TRUE))
- {
- make_ui_sound("UISndNewIncomingIMSession");
- }
- }
- else
- {
- user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM") == TRUE))
- {
- make_ui_sound("UISndNewIncomingIMSession");
- }
- }
- }
+ if (msg["source_type"].asInteger() == CHAT_SOURCE_OBJECT)
+ {
+ user_preferences = gSavedSettings.getString("NotificationObjectIMOptions");
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundObjectIM") == TRUE))
+ {
+ make_ui_sound("UISndNewIncomingIMSession");
+ }
+ }
+ else
+ {
+ user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions");
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM") == TRUE))
+ {
+ make_ui_sound("UISndNewIncomingIMSession");
+ }
+ }
+ }
else if(session->isP2PSessionType())
{
if (LLAvatarTracker::instance().isBuddy(participant_id))
{
- user_preferences = gSavedSettings.getString("NotificationFriendIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM") == TRUE))
- {
- make_ui_sound("UISndNewIncomingIMSession");
- }
+ user_preferences = gSavedSettings.getString("NotificationFriendIMOptions");
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM") == TRUE))
+ {
+ make_ui_sound("UISndNewIncomingIMSession");
+ }
}
else
{
- user_preferences = gSavedSettings.getString("NotificationNonFriendIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM") == TRUE))
- {
- make_ui_sound("UISndNewIncomingIMSession");
+ user_preferences = gSavedSettings.getString("NotificationNonFriendIMOptions");
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM") == TRUE))
+ {
+ make_ui_sound("UISndNewIncomingIMSession");
}
}
- }
+ }
else if(session->isAdHocSessionType())
{
- user_preferences = gSavedSettings.getString("NotificationConferenceIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM") == TRUE))
- {
- make_ui_sound("UISndNewIncomingIMSession");
+ user_preferences = gSavedSettings.getString("NotificationConferenceIMOptions");
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM") == TRUE))
+ {
+ make_ui_sound("UISndNewIncomingIMSession");
+ }
}
- }
else if(session->isGroupSessionType())
{
- user_preferences = gSavedSettings.getString("NotificationGroupChatOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM") == TRUE))
- {
- make_ui_sound("UISndNewIncomingIMSession");
- }
+ user_preferences = gSavedSettings.getString("NotificationGroupChatOptions");
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM") == TRUE))
+ {
+ make_ui_sound("UISndNewIncomingIMSession");
+ }
}
// actions:
// 0. nothing - exit
if (("noaction" == user_preferences ||
- ON_TOP_AND_ITEM_IS_SELECTED == conversations_floater_status)
- && session_floater->isMessagePaneExpanded())
+ ON_TOP_AND_ITEM_IS_SELECTED == conversations_floater_status)
+ && session_floater->isMessagePaneExpanded())
{
- return;
+ return;
}
// 1. open floater and [optional] surface it
if ("openconversations" == user_preferences &&
- (CLOSED == conversations_floater_status
- || NOT_ON_TOP == conversations_floater_status))
+ (CLOSED == conversations_floater_status
+ || NOT_ON_TOP == conversations_floater_status))
{
- if(!gAgent.isDoNotDisturb())
+ if(!gAgent.isDoNotDisturb())
{
- if(!LLAppViewer::instance()->quitRequested() && !LLFloater::isVisible(im_box))
- {
- // Open conversations floater
- LLFloaterReg::showInstance("im_container");
- }
- im_box->collapseMessagesPane(false);
- if (session_floater)
- {
- if (session_floater->getHost())
- {
- if (NULL != im_box && im_box->isMinimized())
- {
- LLFloater::onClickMinimize(im_box);
- }
- }
- else
- {
- if (session_floater->isMinimized())
- {
- LLFloater::onClickMinimize(session_floater);
- }
- }
- }
- }
+ if(!LLAppViewer::instance()->quitRequested() && !LLFloater::isVisible(im_box))
+ {
+ // Open conversations floater
+ LLFloaterReg::showInstance("im_container");
+ }
+ im_box->collapseMessagesPane(false);
+ if (session_floater)
+ {
+ if (session_floater->getHost())
+ {
+ if (NULL != im_box && im_box->isMinimized())
+ {
+ LLFloater::onClickMinimize(im_box);
+ }
+ }
+ else
+ {
+ if (session_floater->isMinimized())
+ {
+ LLFloater::onClickMinimize(session_floater);
+ }
+ }
+ }
+ }
else
{
- store_dnd_message = true;
- }
+ store_dnd_message = true;
+ }
}
// 2. Flash line item
if ("openconversations" == user_preferences
- || ON_TOP == conversations_floater_status
- || ("toast" == user_preferences && ON_TOP != conversations_floater_status)
- || ("flash" == user_preferences && (CLOSED == conversations_floater_status
- || NOT_ON_TOP == conversations_floater_status))
- || is_dnd_msg)
- {
- if(!LLMuteList::getInstance()->isMuted(participant_id))
- {
- if(gAgent.isDoNotDisturb())
- {
- store_dnd_message = true;
- }
- else
- {
- if (is_dnd_msg && (ON_TOP == conversations_floater_status ||
- NOT_ON_TOP == conversations_floater_status ||
- CLOSED == conversations_floater_status))
- {
- im_box->highlightConversationItemWidget(session_id, true);
- }
- else
- {
- im_box->flashConversationItemWidget(session_id, true);
- }
- }
- }
- }
+ || ON_TOP == conversations_floater_status
+ || ("toast" == user_preferences && ON_TOP != conversations_floater_status)
+ || ("flash" == user_preferences && (CLOSED == conversations_floater_status
+ || NOT_ON_TOP == conversations_floater_status))
+ || is_dnd_msg)
+ {
+ if(!LLMuteList::getInstance()->isMuted(participant_id))
+ {
+ if(gAgent.isDoNotDisturb())
+ {
+ store_dnd_message = true;
+ }
+ else
+ {
+ if (is_dnd_msg && (ON_TOP == conversations_floater_status ||
+ NOT_ON_TOP == conversations_floater_status ||
+ CLOSED == conversations_floater_status))
+ {
+ im_box->highlightConversationItemWidget(session_id, true);
+ }
+ else
+ {
+ im_box->flashConversationItemWidget(session_id, true);
+ }
+ }
+ }
+ }
// 3. Flash FUI button
if (("toast" == user_preferences || "flash" == user_preferences) &&
- (CLOSED == conversations_floater_status
- || NOT_ON_TOP == conversations_floater_status)
- && !is_session_focused
- && !is_dnd_msg) //prevent flashing FUI button because the conversation floater will have already opened
- {
- if(!LLMuteList::getInstance()->isMuted(participant_id))
- {
- if(!gAgent.isDoNotDisturb())
- {
- gToolBarView->flashCommand(LLCommandId("chat"), true, im_box->isMinimized());
- }
- else
- {
- store_dnd_message = true;
- }
- }
- }
+ (CLOSED == conversations_floater_status
+ || NOT_ON_TOP == conversations_floater_status)
+ && !is_session_focused
+ && !is_dnd_msg) //prevent flashing FUI button because the conversation floater will have already opened
+ {
+ if(!LLMuteList::getInstance()->isMuted(participant_id))
+ {
+ if(!gAgent.isDoNotDisturb())
+ {
+ gToolBarView->flashCommand(LLCommandId("chat"), true, im_box->isMinimized());
+ }
+ else
+ {
+ store_dnd_message = true;
+ }
+ }
+ }
// 4. Toast
if ((("toast" == user_preferences) &&
- (ON_TOP_AND_ITEM_IS_SELECTED != conversations_floater_status) &&
- (!session_floater->isTornOff() || !LLFloater::isVisible(session_floater)))
- || !session_floater->isMessagePaneExpanded())
+ (ON_TOP_AND_ITEM_IS_SELECTED != conversations_floater_status) &&
+ (!session_floater->isTornOff() || !LLFloater::isVisible(session_floater)))
+ || !session_floater->isMessagePaneExpanded())
{
//Show IM toasts (upper right toasts)
// Skip toasting for system messages and for nearby chat
if(session_id.notNull() && participant_id.notNull())
{
- if(!is_dnd_msg)
- {
- if(gAgent.isDoNotDisturb())
- {
- store_dnd_message = true;
- }
- else
- {
+ if(!is_dnd_msg)
+ {
+ if(gAgent.isDoNotDisturb())
+ {
+ store_dnd_message = true;
+ }
+ else
+ {
LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
}
}
}
- }
- if (store_dnd_message)
- {
- // If in DND mode, allow notification to be stored so upon DND exit
- // the user will be notified with some limitations (see 'is_dnd_msg' flag checks)
- if(session_id.notNull()
- && participant_id.notNull()
- && !session_floater->isShown())
- {
- LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
- }
- }
+ }
+ if (store_dnd_message)
+ {
+ // If in DND mode, allow notification to be stored so upon DND exit
+ // the user will be notified with some limitations (see 'is_dnd_msg' flag checks)
+ if(session_id.notNull()
+ && participant_id.notNull()
+ && !session_floater->isShown())
+ {
+ LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
+ }
+ }
}
void on_new_message(const LLSD& msg)
{
- notify_of_message(msg, false);
+ notify_of_message(msg, false);
}
void startConfrenceCoro(std::string url,
@@ -638,251 +638,251 @@ void chatterBoxHistoryCoro(std::string url, LLUUID sessionId, std::string from,
LLIMModel::LLIMModel()
{
- addNewMsgCallback(boost::bind(&LLFloaterIMSession::newIMCallback, _1));
- addNewMsgCallback(boost::bind(&on_new_message, _1));
- LLCallDialogManager::instance();
+ addNewMsgCallback(boost::bind(&LLFloaterIMSession::newIMCallback, _1));
+ addNewMsgCallback(boost::bind(&on_new_message, _1));
+ LLCallDialogManager::instance();
}
LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg)
-: mSessionID(session_id),
- mName(name),
- mType(type),
- mHasOfflineMessage(has_offline_msg),
- mParticipantUnreadMessageCount(0),
- mNumUnread(0),
- mOtherParticipantID(other_participant_id),
- mInitialTargetIDs(ids),
- mVoiceChannel(NULL),
- mSpeakers(NULL),
- mSessionInitialized(false),
- mCallBackEnabled(true),
- mTextIMPossible(true),
- mStartCallOnInitialize(false),
- mStartedAsIMCall(voice),
- mIsDNDsend(false),
- mAvatarNameCacheConnection()
-{
- // set P2P type by default
- mSessionType = P2P_SESSION;
-
- if (IM_NOTHING_SPECIAL == mType || IM_SESSION_P2P_INVITE == mType)
- {
- mVoiceChannel = new LLVoiceChannelP2P(session_id, name, other_participant_id);
- }
- else
- {
- mVoiceChannel = new LLVoiceChannelGroup(session_id, name);
-
- // determine whether it is group or conference session
- if (gAgent.isInGroup(mSessionID))
- {
- mSessionType = GROUP_SESSION;
- }
- else
- {
- mSessionType = ADHOC_SESSION;
- }
- }
-
- if(mVoiceChannel)
- {
- mVoiceChannelStateChangeConnection = mVoiceChannel->setStateChangedCallback(boost::bind(&LLIMSession::onVoiceChannelStateChanged, this, _1, _2, _3));
- }
-
- mSpeakers = new LLIMSpeakerMgr(mVoiceChannel);
-
- // All participants will be added to the list of people we've recently interacted with.
-
- // we need to add only _active_ speakers...so comment this.
- // may delete this later on cleanup
- //mSpeakers->addListener(&LLRecentPeople::instance(), "add");
-
- //we need to wait for session initialization for outgoing ad-hoc and group chat session
- //correct session id for initiated ad-hoc chat will be received from the server
- if (!LLIMModel::getInstance()->sendStartSession(mSessionID, mOtherParticipantID,
- mInitialTargetIDs, mType))
- {
- //we don't need to wait for any responses
- //so we're already initialized
- mSessionInitialized = true;
- }
- else
- {
- //tick returns TRUE - timer will be deleted after the tick
- new LLSessionTimeoutTimer(mSessionID, SESSION_INITIALIZATION_TIMEOUT);
- }
-
- if (IM_NOTHING_SPECIAL == mType)
- {
- mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionID);
- mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionID);
- }
-
- buildHistoryFileName();
- loadHistory();
-
- // Localizing name of ad-hoc session. STORM-153
- // Changing name should happen here- after the history file was created, so that
- // history files have consistent (English) names in different locales.
- if (isAdHocSessionType() && IM_SESSION_INVITE == mType)
- {
- mAvatarNameCacheConnection = LLAvatarNameCache::get(mOtherParticipantID,boost::bind(&LLIMModel::LLIMSession::onAdHocNameCache,this, _2));
- }
+: mSessionID(session_id),
+ mName(name),
+ mType(type),
+ mHasOfflineMessage(has_offline_msg),
+ mParticipantUnreadMessageCount(0),
+ mNumUnread(0),
+ mOtherParticipantID(other_participant_id),
+ mInitialTargetIDs(ids),
+ mVoiceChannel(NULL),
+ mSpeakers(NULL),
+ mSessionInitialized(false),
+ mCallBackEnabled(true),
+ mTextIMPossible(true),
+ mStartCallOnInitialize(false),
+ mStartedAsIMCall(voice),
+ mIsDNDsend(false),
+ mAvatarNameCacheConnection()
+{
+ // set P2P type by default
+ mSessionType = P2P_SESSION;
+
+ if (IM_NOTHING_SPECIAL == mType || IM_SESSION_P2P_INVITE == mType)
+ {
+ mVoiceChannel = new LLVoiceChannelP2P(session_id, name, other_participant_id);
+ }
+ else
+ {
+ mVoiceChannel = new LLVoiceChannelGroup(session_id, name);
+
+ // determine whether it is group or conference session
+ if (gAgent.isInGroup(mSessionID))
+ {
+ mSessionType = GROUP_SESSION;
+ }
+ else
+ {
+ mSessionType = ADHOC_SESSION;
+ }
+ }
+
+ if(mVoiceChannel)
+ {
+ mVoiceChannelStateChangeConnection = mVoiceChannel->setStateChangedCallback(boost::bind(&LLIMSession::onVoiceChannelStateChanged, this, _1, _2, _3));
+ }
+
+ mSpeakers = new LLIMSpeakerMgr(mVoiceChannel);
+
+ // All participants will be added to the list of people we've recently interacted with.
+
+ // we need to add only _active_ speakers...so comment this.
+ // may delete this later on cleanup
+ //mSpeakers->addListener(&LLRecentPeople::instance(), "add");
+
+ //we need to wait for session initialization for outgoing ad-hoc and group chat session
+ //correct session id for initiated ad-hoc chat will be received from the server
+ if (!LLIMModel::getInstance()->sendStartSession(mSessionID, mOtherParticipantID,
+ mInitialTargetIDs, mType))
+ {
+ //we don't need to wait for any responses
+ //so we're already initialized
+ mSessionInitialized = true;
+ }
+ else
+ {
+ //tick returns TRUE - timer will be deleted after the tick
+ new LLSessionTimeoutTimer(mSessionID, SESSION_INITIALIZATION_TIMEOUT);
+ }
+
+ if (IM_NOTHING_SPECIAL == mType)
+ {
+ mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionID);
+ mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionID);
+ }
+
+ buildHistoryFileName();
+ loadHistory();
+
+ // Localizing name of ad-hoc session. STORM-153
+ // Changing name should happen here- after the history file was created, so that
+ // history files have consistent (English) names in different locales.
+ if (isAdHocSessionType() && IM_SESSION_INVITE == mType)
+ {
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(mOtherParticipantID,boost::bind(&LLIMModel::LLIMSession::onAdHocNameCache,this, _2));
+ }
}
void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name)
{
- mAvatarNameCacheConnection.disconnect();
-
- if (!av_name.isValidName())
- {
- S32 separator_index = mName.rfind(" ");
- std::string name = mName.substr(0, separator_index);
- ++separator_index;
- std::string conference_word = mName.substr(separator_index, mName.length());
-
- // additional check that session name is what we expected
- if ("Conference" == conference_word)
- {
- LLStringUtil::format_map_t args;
- args["[AGENT_NAME]"] = name;
- LLTrans::findString(mName, "conference-title-incoming", args);
- }
- }
- else
- {
- LLStringUtil::format_map_t args;
- args["[AGENT_NAME]"] = av_name.getCompleteName();
- LLTrans::findString(mName, "conference-title-incoming", args);
- }
+ mAvatarNameCacheConnection.disconnect();
+
+ if (!av_name.isValidName())
+ {
+ S32 separator_index = mName.rfind(" ");
+ std::string name = mName.substr(0, separator_index);
+ ++separator_index;
+ std::string conference_word = mName.substr(separator_index, mName.length());
+
+ // additional check that session name is what we expected
+ if ("Conference" == conference_word)
+ {
+ LLStringUtil::format_map_t args;
+ args["[AGENT_NAME]"] = name;
+ LLTrans::findString(mName, "conference-title-incoming", args);
+ }
+ }
+ else
+ {
+ LLStringUtil::format_map_t args;
+ args["[AGENT_NAME]"] = av_name.getCompleteName();
+ LLTrans::findString(mName, "conference-title-incoming", args);
+ }
}
void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction)
{
- std::string you_joined_call = LLTrans::getString("you_joined_call");
- std::string you_started_call = LLTrans::getString("you_started_call");
- std::string other_avatar_name = "";
- LLAvatarName av_name;
-
- std::string message;
-
- switch(mSessionType)
- {
- case P2P_SESSION:
- LLAvatarNameCache::get(mOtherParticipantID, &av_name);
- other_avatar_name = av_name.getUserName();
-
- if(direction == LLVoiceChannel::INCOMING_CALL)
- {
- switch(new_state)
- {
- case LLVoiceChannel::STATE_CALL_STARTED :
- {
- LLStringUtil::format_map_t string_args;
- string_args["[NAME]"] = other_avatar_name;
- message = LLTrans::getString("name_started_call", string_args);
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
- break;
- }
- case LLVoiceChannel::STATE_CONNECTED :
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_joined_call);
- default:
- break;
- }
- }
- else // outgoing call
- {
- switch(new_state)
- {
- case LLVoiceChannel::STATE_CALL_STARTED :
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_started_call);
- break;
- case LLVoiceChannel::STATE_CONNECTED :
- message = LLTrans::getString("answered_call");
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
- default:
- break;
- }
- }
- break;
-
- case GROUP_SESSION:
- case ADHOC_SESSION:
- if(direction == LLVoiceChannel::INCOMING_CALL)
- {
- switch(new_state)
- {
- case LLVoiceChannel::STATE_CONNECTED :
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_joined_call);
- default:
- break;
- }
- }
- else // outgoing call
- {
- switch(new_state)
- {
- case LLVoiceChannel::STATE_CALL_STARTED :
- LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_started_call);
- break;
- default:
- break;
- }
- }
- default:
- break;
- }
- // Update speakers list when connected
- if (LLVoiceChannel::STATE_CONNECTED == new_state)
- {
- mSpeakers->update(true);
- }
+ std::string you_joined_call = LLTrans::getString("you_joined_call");
+ std::string you_started_call = LLTrans::getString("you_started_call");
+ std::string other_avatar_name = "";
+ LLAvatarName av_name;
+
+ std::string message;
+
+ switch(mSessionType)
+ {
+ case P2P_SESSION:
+ LLAvatarNameCache::get(mOtherParticipantID, &av_name);
+ other_avatar_name = av_name.getUserName();
+
+ if(direction == LLVoiceChannel::INCOMING_CALL)
+ {
+ switch(new_state)
+ {
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[NAME]"] = other_avatar_name;
+ message = LLTrans::getString("name_started_call", string_args);
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
+ break;
+ }
+ case LLVoiceChannel::STATE_CONNECTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_joined_call);
+ default:
+ break;
+ }
+ }
+ else // outgoing call
+ {
+ switch(new_state)
+ {
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_started_call);
+ break;
+ case LLVoiceChannel::STATE_CONNECTED :
+ message = LLTrans::getString("answered_call");
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, message);
+ default:
+ break;
+ }
+ }
+ break;
+
+ case GROUP_SESSION:
+ case ADHOC_SESSION:
+ if(direction == LLVoiceChannel::INCOMING_CALL)
+ {
+ switch(new_state)
+ {
+ case LLVoiceChannel::STATE_CONNECTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_joined_call);
+ default:
+ break;
+ }
+ }
+ else // outgoing call
+ {
+ switch(new_state)
+ {
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, SYSTEM_FROM, LLUUID::null, you_started_call);
+ break;
+ default:
+ break;
+ }
+ }
+ default:
+ break;
+ }
+ // Update speakers list when connected
+ if (LLVoiceChannel::STATE_CONNECTED == new_state)
+ {
+ mSpeakers->update(true);
+ }
}
LLIMModel::LLIMSession::~LLIMSession()
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
-
- delete mSpeakers;
- mSpeakers = NULL;
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
- // End the text IM session if necessary
- if(LLVoiceClient::getInstance() && mOtherParticipantID.notNull())
- {
- switch(mType)
- {
- case IM_NOTHING_SPECIAL:
- case IM_SESSION_P2P_INVITE:
- LLVoiceClient::getInstance()->endUserIMSession(mOtherParticipantID);
- break;
+ delete mSpeakers;
+ mSpeakers = NULL;
- default:
- // Appease the linux compiler
- break;
- }
- }
+ // End the text IM session if necessary
+ if(LLVoiceClient::getInstance() && mOtherParticipantID.notNull())
+ {
+ switch(mType)
+ {
+ case IM_NOTHING_SPECIAL:
+ case IM_SESSION_P2P_INVITE:
+ LLVoiceClient::getInstance()->endUserIMSession(mOtherParticipantID);
+ break;
+
+ default:
+ // Appease the linux compiler
+ break;
+ }
+ }
- mVoiceChannelStateChangeConnection.disconnect();
+ mVoiceChannelStateChangeConnection.disconnect();
- // HAVE to do this here -- if it happens in the LLVoiceChannel destructor it will call the wrong version (since the object's partially deconstructed at that point).
- mVoiceChannel->deactivate();
+ // HAVE to do this here -- if it happens in the LLVoiceChannel destructor it will call the wrong version (since the object's partially deconstructed at that point).
+ mVoiceChannel->deactivate();
- delete mVoiceChannel;
- mVoiceChannel = NULL;
+ delete mVoiceChannel;
+ mVoiceChannel = NULL;
}
void LLIMModel::LLIMSession::sessionInitReplyReceived(const LLUUID& new_session_id)
{
- mSessionInitialized = true;
+ mSessionInitialized = true;
- if (new_session_id != mSessionID)
- {
- mSessionID = new_session_id;
- mVoiceChannel->updateSessionID(new_session_id);
- }
+ if (new_session_id != mSessionID)
+ {
+ mSessionID = new_session_id;
+ mVoiceChannel->updateSessionID(new_session_id);
+ }
}
void LLIMModel::LLIMSession::addMessage(const std::string& from,
@@ -893,40 +893,40 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from,
const bool is_region_msg,
const U32 timestamp) // may be zero
{
- LLSD message;
- message["from"] = from;
- message["from_id"] = from_id;
- message["message"] = utf8_text;
- message["time"] = time; // string used in display, may be full data YYYY/MM/DD HH:MM or just HH:MM
+ LLSD message;
+ message["from"] = from;
+ message["from_id"] = from_id;
+ message["message"] = utf8_text;
+ message["time"] = time; // string used in display, may be full data YYYY/MM/DD HH:MM or just HH:MM
message["timestamp"] = (S32)timestamp; // use string? LLLogChat::timestamp2LogString(timestamp, true);
- message["index"] = (LLSD::Integer)mMsgs.size();
- message["is_history"] = is_history;
- message["is_region_msg"] = is_region_msg;
-
- LL_DEBUGS("UIUsage") << "addMessage " << " from " << from << " from_id " << from_id << " utf8_text " << utf8_text << " time " << time << " is_history " << is_history << " session mType " << mType << LL_ENDL;
- if (from_id == gAgent.getID())
- {
- if (mType == IM_SESSION_GROUP_START)
- {
- LLUIUsage::instance().logCommand("Chat.SendGroup");
- }
- else if (mType == IM_NOTHING_SPECIAL)
- {
- LLUIUsage::instance().logCommand("Chat.SendIM");
- }
- else
- {
- LLUIUsage::instance().logCommand("Chat.SendOther");
- }
- }
-
- mMsgs.push_front(message); // Add most recent messages to the front of mMsgs
-
- if (mSpeakers && from_id.notNull())
- {
- mSpeakers->speakerChatted(from_id);
- mSpeakers->setSpeakerTyping(from_id, FALSE);
- }
+ message["index"] = (LLSD::Integer)mMsgs.size();
+ message["is_history"] = is_history;
+ message["is_region_msg"] = is_region_msg;
+
+ LL_DEBUGS("UIUsage") << "addMessage " << " from " << from << " from_id " << from_id << " utf8_text " << utf8_text << " time " << time << " is_history " << is_history << " session mType " << mType << LL_ENDL;
+ if (from_id == gAgent.getID())
+ {
+ if (mType == IM_SESSION_GROUP_START)
+ {
+ LLUIUsage::instance().logCommand("Chat.SendGroup");
+ }
+ else if (mType == IM_NOTHING_SPECIAL)
+ {
+ LLUIUsage::instance().logCommand("Chat.SendIM");
+ }
+ else
+ {
+ LLUIUsage::instance().logCommand("Chat.SendOther");
+ }
+ }
+
+ mMsgs.push_front(message); // Add most recent messages to the front of mMsgs
+
+ if (mSpeakers && from_id.notNull())
+ {
+ mSpeakers->speakerChatted(from_id);
+ mSpeakers->setSpeakerTyping(from_id, FALSE);
+ }
}
void LLIMModel::LLIMSession::addMessagesFromHistoryCache(const chat_message_list_t& history)
@@ -1206,329 +1206,329 @@ void LLIMModel::LLIMSession::addMessagesFromServerHistory(const LLSD& history,
void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata)
{
- if (!userdata) return;
+ if (!userdata) return;
- LLIMSession* self = (LLIMSession*) userdata;
+ LLIMSession* self = (LLIMSession*) userdata;
- if (type == LLLogChat::LOG_LINE)
- {
+ if (type == LLLogChat::LOG_LINE)
+ {
LL_DEBUGS("ChatHistory") << "chatFromLogFile() adding LOG_LINE message from " << msg << LL_ENDL;
self->addMessage("", LLSD(), msg["message"].asString(), "", true, false, 0); // from history data, not region message, no timestamp
- }
- else if (type == LLLogChat::LOG_LLSD)
- {
+ }
+ else if (type == LLLogChat::LOG_LLSD)
+ {
LL_DEBUGS("ChatHistory") << "chatFromLogFile() adding LOG_LLSD message from " << msg << LL_ENDL;
self->addMessage(msg["from"].asString(), msg["from_id"].asUUID(), msg["message"].asString(), msg["time"].asString(), true, false, 0); // from history data, not region message, no timestamp
- }
+ }
}
void LLIMModel::LLIMSession::loadHistory()
{
- mMsgs.clear();
+ mMsgs.clear();
mLastHistoryCacheMsgs.clear();
mLastHistoryCacheDateTime.clear();
- if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
- {
+ if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
+ {
// read and parse chat history from local file
chat_message_list_t chat_history;
- LLLogChat::loadChatHistory(mHistoryFileName, chat_history, LLSD(), isGroupChat());
+ LLLogChat::loadChatHistory(mHistoryFileName, chat_history, LLSD(), isGroupChat());
addMessagesFromHistoryCache(chat_history);
}
}
LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const
{
- return get_if_there(mId2SessionMap, session_id, (LLIMModel::LLIMSession*) NULL);
+ return get_if_there(mId2SessionMap, session_id, (LLIMModel::LLIMSession*) NULL);
}
//*TODO consider switching to using std::set instead of std::list for holding LLUUIDs across the whole code
LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids)
{
- S32 num = ids.size();
- if (!num) return NULL;
+ S32 num = ids.size();
+ if (!num) return NULL;
- if (mId2SessionMap.empty()) return NULL;
+ if (mId2SessionMap.empty()) return NULL;
- std::map<LLUUID, LLIMSession*>::const_iterator it = mId2SessionMap.begin();
- for (; it != mId2SessionMap.end(); ++it)
- {
- LLIMSession* session = (*it).second;
+ std::map<LLUUID, LLIMSession*>::const_iterator it = mId2SessionMap.begin();
+ for (; it != mId2SessionMap.end(); ++it)
+ {
+ LLIMSession* session = (*it).second;
- if (!session->isAdHoc()) continue;
- if (session->mInitialTargetIDs.size() != num) continue;
+ if (!session->isAdHoc()) continue;
+ if (session->mInitialTargetIDs.size() != num) continue;
- std::list<LLUUID> tmp_list(session->mInitialTargetIDs.begin(), session->mInitialTargetIDs.end());
+ std::list<LLUUID> tmp_list(session->mInitialTargetIDs.begin(), session->mInitialTargetIDs.end());
- uuid_vec_t::const_iterator iter = ids.begin();
- while (iter != ids.end())
- {
- tmp_list.remove(*iter);
- ++iter;
+ uuid_vec_t::const_iterator iter = ids.begin();
+ while (iter != ids.end())
+ {
+ tmp_list.remove(*iter);
+ ++iter;
- if (tmp_list.empty())
- {
- break;
- }
- }
+ if (tmp_list.empty())
+ {
+ break;
+ }
+ }
- if (tmp_list.empty() && iter == ids.end())
- {
- return session;
- }
- }
+ if (tmp_list.empty() && iter == ids.end())
+ {
+ return session;
+ }
+ }
- return NULL;
+ return NULL;
}
bool LLIMModel::LLIMSession::isOutgoingAdHoc() const
{
- return IM_SESSION_CONFERENCE_START == mType;
+ return IM_SESSION_CONFERENCE_START == mType;
}
bool LLIMModel::LLIMSession::isAdHoc()
{
- return IM_SESSION_CONFERENCE_START == mType || (IM_SESSION_INVITE == mType && !gAgent.isInGroup(mSessionID, TRUE));
+ return IM_SESSION_CONFERENCE_START == mType || (IM_SESSION_INVITE == mType && !gAgent.isInGroup(mSessionID, TRUE));
}
bool LLIMModel::LLIMSession::isP2P()
{
- return IM_NOTHING_SPECIAL == mType;
+ return IM_NOTHING_SPECIAL == mType;
}
bool LLIMModel::LLIMSession::isGroupChat()
{
- return IM_SESSION_GROUP_START == mType || (IM_SESSION_INVITE == mType && gAgent.isInGroup(mSessionID, TRUE));
+ return IM_SESSION_GROUP_START == mType || (IM_SESSION_INVITE == mType && gAgent.isInGroup(mSessionID, TRUE));
}
LLUUID LLIMModel::LLIMSession::generateOutgoingAdHocHash() const
{
- LLUUID hash = LLUUID::null;
+ LLUUID hash = LLUUID::null;
- if (mInitialTargetIDs.size())
- {
- std::set<LLUUID> sorted_uuids(mInitialTargetIDs.begin(), mInitialTargetIDs.end());
- hash = generateHash(sorted_uuids);
- }
+ if (mInitialTargetIDs.size())
+ {
+ std::set<LLUUID> sorted_uuids(mInitialTargetIDs.begin(), mInitialTargetIDs.end());
+ hash = generateHash(sorted_uuids);
+ }
- return hash;
+ return hash;
}
void LLIMModel::LLIMSession::buildHistoryFileName()
{
- mHistoryFileName = mName;
-
- //ad-hoc requires sophisticated chat history saving schemes
- if (isAdHoc())
- {
- /* in case of outgoing ad-hoc sessions we need to make specilized names
- * if this naming system is ever changed then the filtering definitions in
- * lllogchat.cpp need to be change acordingly so that the filtering for the
- * date stamp code introduced in STORM-102 will work properly and not add
- * a date stamp to the Ad-hoc conferences.
- */
- if (mInitialTargetIDs.size())
- {
- std::set<LLUUID> sorted_uuids(mInitialTargetIDs.begin(), mInitialTargetIDs.end());
- mHistoryFileName = mName + " hash" + generateHash(sorted_uuids).asString();
- }
- else
- {
- //in case of incoming ad-hoc sessions
- mHistoryFileName = mName + " " + LLLogChat::timestamp2LogString(0, true) + " " + mSessionID.asString().substr(0, 4);
- }
- }
- else if (isP2P()) // look up username to use as the log name
- {
- LLAvatarName av_name;
- // For outgoing sessions we already have a cached name
- // so no need for a callback in LLAvatarNameCache::get()
- if (LLAvatarNameCache::get(mOtherParticipantID, &av_name))
- {
- mHistoryFileName = LLCacheName::buildUsername(av_name.getUserName());
- }
- else
- {
- // Incoming P2P sessions include a name that we can use to build a history file name
- mHistoryFileName = LLCacheName::buildUsername(mName);
- }
+ mHistoryFileName = mName;
+
+ //ad-hoc requires sophisticated chat history saving schemes
+ if (isAdHoc())
+ {
+ /* in case of outgoing ad-hoc sessions we need to make specilized names
+ * if this naming system is ever changed then the filtering definitions in
+ * lllogchat.cpp need to be change acordingly so that the filtering for the
+ * date stamp code introduced in STORM-102 will work properly and not add
+ * a date stamp to the Ad-hoc conferences.
+ */
+ if (mInitialTargetIDs.size())
+ {
+ std::set<LLUUID> sorted_uuids(mInitialTargetIDs.begin(), mInitialTargetIDs.end());
+ mHistoryFileName = mName + " hash" + generateHash(sorted_uuids).asString();
+ }
+ else
+ {
+ //in case of incoming ad-hoc sessions
+ mHistoryFileName = mName + " " + LLLogChat::timestamp2LogString(0, true) + " " + mSessionID.asString().substr(0, 4);
+ }
+ }
+ else if (isP2P()) // look up username to use as the log name
+ {
+ LLAvatarName av_name;
+ // For outgoing sessions we already have a cached name
+ // so no need for a callback in LLAvatarNameCache::get()
+ if (LLAvatarNameCache::get(mOtherParticipantID, &av_name))
+ {
+ mHistoryFileName = LLCacheName::buildUsername(av_name.getUserName());
+ }
+ else
+ {
+ // Incoming P2P sessions include a name that we can use to build a history file name
+ mHistoryFileName = LLCacheName::buildUsername(mName);
+ }
// user's account name can change, but filenames and session names are account name based
LLConversationLog::getInstance()->verifyFilename(mSessionID, mHistoryFileName, av_name.getCompleteName());
- }
- else if (isGroupChat())
- {
- mHistoryFileName = mName + GROUP_CHAT_SUFFIX;
- }
+ }
+ else if (isGroupChat())
+ {
+ mHistoryFileName = mName + GROUP_CHAT_SUFFIX;
+ }
}
//static
LLUUID LLIMModel::LLIMSession::generateHash(const std::set<LLUUID>& sorted_uuids)
{
- LLMD5 md5_uuid;
+ LLMD5 md5_uuid;
- std::set<LLUUID>::const_iterator it = sorted_uuids.begin();
- while (it != sorted_uuids.end())
- {
- md5_uuid.update((unsigned char*)(*it).mData, 16);
- it++;
- }
- md5_uuid.finalize();
+ std::set<LLUUID>::const_iterator it = sorted_uuids.begin();
+ while (it != sorted_uuids.end())
+ {
+ md5_uuid.update((unsigned char*)(*it).mData, 16);
+ it++;
+ }
+ md5_uuid.finalize();
- LLUUID participants_md5_hash;
- md5_uuid.raw_digest((unsigned char*) participants_md5_hash.mData);
- return participants_md5_hash;
+ LLUUID participants_md5_hash;
+ md5_uuid.raw_digest((unsigned char*) participants_md5_hash.mData);
+ return participants_md5_hash;
}
void LLIMModel::processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id)
{
- LLIMSession* session = findIMSession(old_session_id);
- if (session)
- {
- session->sessionInitReplyReceived(new_session_id);
+ LLIMSession* session = findIMSession(old_session_id);
+ if (session)
+ {
+ session->sessionInitReplyReceived(new_session_id);
- if (old_session_id != new_session_id)
- {
- mId2SessionMap.erase(old_session_id);
- mId2SessionMap[new_session_id] = session;
- }
+ if (old_session_id != new_session_id)
+ {
+ mId2SessionMap.erase(old_session_id);
+ mId2SessionMap[new_session_id] = session;
+ }
- LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(old_session_id);
- if (im_floater)
- {
- im_floater->sessionInitReplyReceived(new_session_id);
- }
+ LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(old_session_id);
+ if (im_floater)
+ {
+ im_floater->sessionInitReplyReceived(new_session_id);
+ }
- if (old_session_id != new_session_id)
- {
- gIMMgr->notifyObserverSessionIDUpdated(old_session_id, new_session_id);
- }
+ if (old_session_id != new_session_id)
+ {
+ gIMMgr->notifyObserverSessionIDUpdated(old_session_id, new_session_id);
+ }
- // auto-start the call on session initialization?
- if (session->mStartCallOnInitialize)
- {
- gIMMgr->startCall(new_session_id);
- }
- }
+ // auto-start the call on session initialization?
+ if (session->mStartCallOnInitialize)
+ {
+ gIMMgr->startCall(new_session_id);
+ }
+ }
}
void LLIMModel::testMessages()
{
- LLUUID bot1_id("d0426ec6-6535-4c11-a5d9-526bb0c654d9");
- LLUUID bot1_session_id;
- std::string from = "IM Tester";
+ LLUUID bot1_id("d0426ec6-6535-4c11-a5d9-526bb0c654d9");
+ LLUUID bot1_session_id;
+ std::string from = "IM Tester";
- bot1_session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, bot1_id);
- newSession(bot1_session_id, from, IM_NOTHING_SPECIAL, bot1_id);
- addMessage(bot1_session_id, from, bot1_id, "Test Message: Hi from testerbot land!");
+ bot1_session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, bot1_id);
+ newSession(bot1_session_id, from, IM_NOTHING_SPECIAL, bot1_id);
+ addMessage(bot1_session_id, from, bot1_id, "Test Message: Hi from testerbot land!");
- LLUUID bot2_id;
- std::string firstname[] = {"Roflcopter", "Joe"};
- std::string lastname[] = {"Linden", "Tester", "Resident", "Schmoe"};
+ LLUUID bot2_id;
+ std::string firstname[] = {"Roflcopter", "Joe"};
+ std::string lastname[] = {"Linden", "Tester", "Resident", "Schmoe"};
- S32 rand1 = ll_rand(sizeof firstname)/(sizeof firstname[0]);
- S32 rand2 = ll_rand(sizeof lastname)/(sizeof lastname[0]);
+ S32 rand1 = ll_rand(sizeof firstname)/(sizeof firstname[0]);
+ S32 rand2 = ll_rand(sizeof lastname)/(sizeof lastname[0]);
- from = firstname[rand1] + " " + lastname[rand2];
- bot2_id.generate(from);
- LLUUID bot2_session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, bot2_id);
- newSession(bot2_session_id, from, IM_NOTHING_SPECIAL, bot2_id);
- addMessage(bot2_session_id, from, bot2_id, "Test Message: Hello there, I have a question. Can I bother you for a second? ");
- addMessage(bot2_session_id, from, bot2_id, "Test Message: OMGWTFBBQ.");
+ from = firstname[rand1] + " " + lastname[rand2];
+ bot2_id.generate(from);
+ LLUUID bot2_session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, bot2_id);
+ newSession(bot2_session_id, from, IM_NOTHING_SPECIAL, bot2_id);
+ addMessage(bot2_session_id, from, bot2_id, "Test Message: Hello there, I have a question. Can I bother you for a second? ");
+ addMessage(bot2_session_id, from, bot2_id, "Test Message: OMGWTFBBQ.");
}
//session name should not be empty
bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type,
- const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg)
+ const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg)
{
- if (name.empty())
- {
- LL_WARNS() << "Attempt to create a new session with empty name; id = " << session_id << LL_ENDL;
- return false;
- }
+ if (name.empty())
+ {
+ LL_WARNS() << "Attempt to create a new session with empty name; id = " << session_id << LL_ENDL;
+ return false;
+ }
- if (findIMSession(session_id))
- {
- LL_WARNS() << "IM Session " << session_id << " already exists" << LL_ENDL;
- return false;
- }
+ if (findIMSession(session_id))
+ {
+ LL_WARNS() << "IM Session " << session_id << " already exists" << LL_ENDL;
+ return false;
+ }
- LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids, voice, has_offline_msg);
- mId2SessionMap[session_id] = session;
+ LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids, voice, has_offline_msg);
+ mId2SessionMap[session_id] = session;
- // When notifying observer, name of session is used instead of "name", because they may not be the
- // same if it is an adhoc session (in this case name is localized in LLIMSession constructor).
- std::string session_name = LLIMModel::getInstance()->getName(session_id);
- LLIMMgr::getInstance()->notifyObserverSessionAdded(session_id, session_name, other_participant_id,has_offline_msg);
+ // When notifying observer, name of session is used instead of "name", because they may not be the
+ // same if it is an adhoc session (in this case name is localized in LLIMSession constructor).
+ std::string session_name = LLIMModel::getInstance()->getName(session_id);
+ LLIMMgr::getInstance()->notifyObserverSessionAdded(session_id, session_name, other_participant_id,has_offline_msg);
- return true;
+ return true;
}
bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, bool voice, bool has_offline_msg)
{
- uuid_vec_t ids;
- ids.push_back(other_participant_id);
- return newSession(session_id, name, type, other_participant_id, ids, voice, has_offline_msg);
+ uuid_vec_t ids;
+ ids.push_back(other_participant_id);
+ return newSession(session_id, name, type, other_participant_id, ids, voice, has_offline_msg);
}
bool LLIMModel::clearSession(const LLUUID& session_id)
{
- if (mId2SessionMap.find(session_id) == mId2SessionMap.end()) return false;
- delete (mId2SessionMap[session_id]);
- mId2SessionMap.erase(session_id);
- return true;
+ if (mId2SessionMap.find(session_id) == mId2SessionMap.end()) return false;
+ delete (mId2SessionMap[session_id]);
+ mId2SessionMap.erase(session_id);
+ return true;
}
void LLIMModel::getMessages(const LLUUID& session_id, chat_message_list_t& messages, int start_index, const bool sendNoUnreadMsgs)
{
- getMessagesSilently(session_id, messages, start_index);
+ getMessagesSilently(session_id, messages, start_index);
- if (sendNoUnreadMsgs)
- {
- sendNoUnreadMessages(session_id);
- }
+ if (sendNoUnreadMsgs)
+ {
+ sendNoUnreadMessages(session_id);
+ }
}
void LLIMModel::getMessagesSilently(const LLUUID& session_id, chat_message_list_t& messages, int start_index)
{
- LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
- return;
- }
+ LLIMSession* session = findIMSession(session_id);
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
+ return;
+ }
- int i = session->mMsgs.size() - start_index;
+ int i = session->mMsgs.size() - start_index;
- for (chat_message_list_t::iterator iter = session->mMsgs.begin();
- iter != session->mMsgs.end() && i > 0;
- iter++)
- {
- LLSD msg;
- msg = *iter;
- messages.push_back(*iter);
- i--;
- }
+ for (chat_message_list_t::iterator iter = session->mMsgs.begin();
+ iter != session->mMsgs.end() && i > 0;
+ iter++)
+ {
+ LLSD msg;
+ msg = *iter;
+ messages.push_back(*iter);
+ i--;
+ }
}
void LLIMModel::sendNoUnreadMessages(const LLUUID& session_id)
{
- LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
- return;
- }
+ LLIMSession* session = findIMSession(session_id);
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
+ return;
+ }
- session->mNumUnread = 0;
- session->mParticipantUnreadMessageCount = 0;
+ session->mNumUnread = 0;
+ session->mParticipantUnreadMessageCount = 0;
- LLSD arg;
- arg["session_id"] = session_id;
- arg["num_unread"] = 0;
- arg["participant_unread"] = session->mParticipantUnreadMessageCount;
- mNoUnreadMsgsSignal(arg);
+ LLSD arg;
+ arg["session_id"] = session_id;
+ arg["num_unread"] = 0;
+ arg["participant_unread"] = session->mParticipantUnreadMessageCount;
+ mNoUnreadMsgsSignal(arg);
}
bool LLIMModel::addToHistory(const LLUUID& session_id,
@@ -1538,54 +1538,54 @@ bool LLIMModel::addToHistory(const LLUUID& session_id,
bool is_region_msg,
U32 timestamp)
{
- LLIMSession* session = findIMSession(session_id);
+ LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
- return false;
- }
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
+ return false;
+ }
// This is where a normal arriving message is added to the session. Note that the time string created here is without the full date
- session->addMessage(from, from_id, utf8_text, LLLogChat::timestamp2LogString(timestamp, false), false, is_region_msg, timestamp);
+ session->addMessage(from, from_id, utf8_text, LLLogChat::timestamp2LogString(timestamp, false), false, is_region_msg, timestamp);
- return true;
+ return true;
}
bool LLIMModel::logToFile(const std::string& file_name, const std::string& from, const LLUUID& from_id, const std::string& utf8_text)
{
- if (gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 1)
- {
- std::string from_name = from;
+ if (gSavedPerAccountSettings.getS32("KeepConversationLogTranscripts") > 1)
+ {
+ std::string from_name = from;
- LLAvatarName av_name;
- if (!from_id.isNull() &&
- LLAvatarNameCache::get(from_id, &av_name) &&
- !av_name.isDisplayNameDefault())
- {
- from_name = av_name.getCompleteName();
- }
+ LLAvatarName av_name;
+ if (!from_id.isNull() &&
+ LLAvatarNameCache::get(from_id, &av_name) &&
+ !av_name.isDisplayNameDefault())
+ {
+ from_name = av_name.getCompleteName();
+ }
- LLLogChat::saveHistory(file_name, from_name, from_id, utf8_text);
- LLConversationLog::instance().cache(); // update the conversation log too
- return true;
- }
- else
- {
- return false;
- }
+ LLLogChat::saveHistory(file_name, from_name, from_id, utf8_text);
+ LLConversationLog::instance().cache(); // update the conversation log too
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
void LLIMModel::proccessOnlineOfflineNotification(
- const LLUUID& session_id,
+ const LLUUID& session_id,
const std::string& utf8_text)
{
- // Add system message to history
- addMessage(session_id, SYSTEM_FROM, LLUUID::null, utf8_text);
+ // Add system message to history
+ addMessage(session_id, SYSTEM_FROM, LLUUID::null, utf8_text);
}
void LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
- const std::string& utf8_text, bool log2file /* = true */, bool is_region_msg, /* = false */ U32 time_stamp /* = 0 */)
+ const std::string& utf8_text, bool log2file /* = true */, bool is_region_msg, /* = false */ U32 time_stamp /* = 0 */)
{
if (gSavedSettings.getBOOL("TranslateChat") && (from != SYSTEM_FROM))
{
@@ -1631,442 +1631,442 @@ void LLIMModel::processAddingMessage(const LLUUID& session_id, const std::string
}
LLIMModel::LLIMSession* LLIMModel::addMessageSilently(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
- const std::string& utf8_text, bool log2file /* = true */, bool is_region_msg, /* false */
+ const std::string& utf8_text, bool log2file /* = true */, bool is_region_msg, /* false */
U32 timestamp /* = 0 */)
{
- LLIMSession* session = findIMSession(session_id);
+ LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- return NULL;
- }
+ if (!session)
+ {
+ return NULL;
+ }
- // replace interactive system message marker with correct from string value
- std::string from_name = from;
- if (INTERACTIVE_SYSTEM_FROM == from)
- {
- from_name = SYSTEM_FROM;
- }
+ // replace interactive system message marker with correct from string value
+ std::string from_name = from;
+ if (INTERACTIVE_SYSTEM_FROM == from)
+ {
+ from_name = SYSTEM_FROM;
+ }
- addToHistory(session_id, from_name, from_id, utf8_text, is_region_msg, timestamp);
- if (log2file)
- {
- logToFile(getHistoryFileName(session_id), from_name, from_id, utf8_text);
- }
+ addToHistory(session_id, from_name, from_id, utf8_text, is_region_msg, timestamp);
+ if (log2file)
+ {
+ logToFile(getHistoryFileName(session_id), from_name, from_id, utf8_text);
+ }
- session->mNumUnread++;
+ session->mNumUnread++;
- //update count of unread messages from real participant
- if (!(from_id.isNull() || from_id == gAgentID || SYSTEM_FROM == from)
- // we should increment counter for interactive system messages()
- || INTERACTIVE_SYSTEM_FROM == from)
- {
- ++(session->mParticipantUnreadMessageCount);
- }
+ //update count of unread messages from real participant
+ if (!(from_id.isNull() || from_id == gAgentID || SYSTEM_FROM == from)
+ // we should increment counter for interactive system messages()
+ || INTERACTIVE_SYSTEM_FROM == from)
+ {
+ ++(session->mParticipantUnreadMessageCount);
+ }
- return session;
+ return session;
}
const std::string LLIMModel::getName(const LLUUID& session_id) const
{
- LLIMSession* session = findIMSession(session_id);
+ LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
- return LLTrans::getString("no_session_message");
- }
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
+ return LLTrans::getString("no_session_message");
+ }
- return session->mName;
+ return session->mName;
}
const S32 LLIMModel::getNumUnread(const LLUUID& session_id) const
{
- LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
- return -1;
- }
+ LLIMSession* session = findIMSession(session_id);
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
+ return -1;
+ }
- return session->mNumUnread;
+ return session->mNumUnread;
}
const LLUUID& LLIMModel::getOtherParticipantID(const LLUUID& session_id) const
{
- LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << " does not exist " << LL_ENDL;
- return LLUUID::null;
- }
+ LLIMSession* session = findIMSession(session_id);
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << " does not exist " << LL_ENDL;
+ return LLUUID::null;
+ }
- return session->mOtherParticipantID;
+ return session->mOtherParticipantID;
}
EInstantMessage LLIMModel::getType(const LLUUID& session_id) const
{
- LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
- return IM_COUNT;
- }
+ LLIMSession* session = findIMSession(session_id);
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
+ return IM_COUNT;
+ }
- return session->mType;
+ return session->mType;
}
LLVoiceChannel* LLIMModel::getVoiceChannel( const LLUUID& session_id ) const
{
- LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
- return NULL;
- }
+ LLIMSession* session = findIMSession(session_id);
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL;
+ return NULL;
+ }
- return session->mVoiceChannel;
+ return session->mVoiceChannel;
}
LLIMSpeakerMgr* LLIMModel::getSpeakerManager( const LLUUID& session_id ) const
{
- LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << " does not exist " << LL_ENDL;
- return NULL;
- }
+ LLIMSession* session = findIMSession(session_id);
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << " does not exist " << LL_ENDL;
+ return NULL;
+ }
- return session->mSpeakers;
+ return session->mSpeakers;
}
const std::string& LLIMModel::getHistoryFileName(const LLUUID& session_id) const
{
- LLIMSession* session = findIMSession(session_id);
- if (!session)
- {
- LL_WARNS() << "session " << session_id << " does not exist " << LL_ENDL;
- return LLStringUtil::null;
- }
+ LLIMSession* session = findIMSession(session_id);
+ if (!session)
+ {
+ LL_WARNS() << "session " << session_id << " does not exist " << LL_ENDL;
+ return LLStringUtil::null;
+ }
- return session->mHistoryFileName;
+ return session->mHistoryFileName;
}
// TODO get rid of other participant ID
void LLIMModel::sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing)
{
- std::string name;
- LLAgentUI::buildFullname(name);
+ std::string name;
+ LLAgentUI::buildFullname(name);
- pack_instant_message(
- gMessageSystem,
- gAgent.getID(),
- FALSE,
- gAgent.getSessionID(),
- other_participant_id,
- name,
- std::string("typing"),
- IM_ONLINE,
- (typing ? IM_TYPING_START : IM_TYPING_STOP),
- session_id);
- gAgent.sendReliableMessage();
+ pack_instant_message(
+ gMessageSystem,
+ gAgent.getID(),
+ FALSE,
+ gAgent.getSessionID(),
+ other_participant_id,
+ name,
+ std::string("typing"),
+ IM_ONLINE,
+ (typing ? IM_TYPING_START : IM_TYPING_STOP),
+ session_id);
+ gAgent.sendReliableMessage();
}
void LLIMModel::sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id)
{
- if(session_id.notNull())
- {
- std::string name;
- LLAgentUI::buildFullname(name);
- pack_instant_message(
- gMessageSystem,
- gAgent.getID(),
- FALSE,
- gAgent.getSessionID(),
- other_participant_id,
- name,
- LLStringUtil::null,
- IM_ONLINE,
- IM_SESSION_LEAVE,
- session_id);
- gAgent.sendReliableMessage();
- }
+ if(session_id.notNull())
+ {
+ std::string name;
+ LLAgentUI::buildFullname(name);
+ pack_instant_message(
+ gMessageSystem,
+ gAgent.getID(),
+ FALSE,
+ gAgent.getSessionID(),
+ other_participant_id,
+ name,
+ LLStringUtil::null,
+ IM_ONLINE,
+ IM_SESSION_LEAVE,
+ session_id);
+ gAgent.sendReliableMessage();
+ }
}
//*TODO this method is better be moved to the LLIMMgr
void LLIMModel::sendMessage(const std::string& utf8_text,
- const LLUUID& im_session_id,
- const LLUUID& other_participant_id,
- EInstantMessage dialog)
-{
- std::string name;
- bool sent = false;
- LLAgentUI::buildFullname(name);
-
- const LLRelationship* info = NULL;
- info = LLAvatarTracker::instance().getBuddyInfo(other_participant_id);
-
- U8 offline = (!info || info->isOnline()) ? IM_ONLINE : IM_OFFLINE;
- // Old call to send messages to SLim client, no longer supported.
- //if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
- //{
- // // User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice.
- // sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
- //}
-
- if(!sent)
- {
- // Send message normally.
-
- // default to IM_SESSION_SEND unless it's nothing special - in
- // which case it's probably an IM to everyone.
- U8 new_dialog = dialog;
-
- if ( dialog != IM_NOTHING_SPECIAL )
- {
- new_dialog = IM_SESSION_SEND;
- }
- pack_instant_message(
- gMessageSystem,
- gAgent.getID(),
- FALSE,
- gAgent.getSessionID(),
- other_participant_id,
- name.c_str(),
- utf8_text.c_str(),
- offline,
- (EInstantMessage)new_dialog,
- im_session_id);
- gAgent.sendReliableMessage();
- }
-
- bool is_group_chat = false;
- LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(im_session_id);
- if(session)
- {
- is_group_chat = session->isGroupSessionType();
- }
-
- // If there is a mute list and this is not a group chat...
- if ( LLMuteList::getInstance() && !is_group_chat)
- {
- // ... the target should not be in our mute list for some message types.
- // Auto-remove them if present.
- switch( dialog )
- {
- case IM_NOTHING_SPECIAL:
- case IM_GROUP_INVITATION:
- case IM_INVENTORY_OFFERED:
- case IM_SESSION_INVITE:
- case IM_SESSION_P2P_INVITE:
- case IM_SESSION_CONFERENCE_START:
- case IM_SESSION_SEND: // This one is marginal - erring on the side of hearing.
- case IM_LURE_USER:
- case IM_GODLIKE_LURE_USER:
- case IM_FRIENDSHIP_OFFERED:
- LLMuteList::getInstance()->autoRemove(other_participant_id, LLMuteList::AR_IM);
- break;
- default: ; // do nothing
- }
- }
-
- if((dialog == IM_NOTHING_SPECIAL) &&
- (other_participant_id.notNull()))
- {
- // Do we have to replace the /me's here?
- std::string from;
- LLAgentUI::buildFullname(from);
- LLIMModel::getInstance()->addMessage(im_session_id, from, gAgentID, utf8_text);
-
- //local echo for the legacy communicate panel
- std::string history_echo;
- LLAgentUI::buildFullname(history_echo);
-
- history_echo += ": " + utf8_text;
-
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(im_session_id);
- if (speaker_mgr)
- {
- speaker_mgr->speakerChatted(gAgentID);
- speaker_mgr->setSpeakerTyping(gAgentID, FALSE);
- }
- }
-
- // Add the recipient to the recent people list.
- bool is_not_group_id = LLGroupMgr::getInstance()->getGroupData(other_participant_id) == NULL;
-
- if (is_not_group_id)
- {
- if( session == 0)//??? shouldn't really happen
- {
- LLRecentPeople::instance().add(other_participant_id);
- return;
- }
- // IM_SESSION_INVITE means that this is an Ad-hoc incoming chat
- // (it can be also Group chat but it is checked above)
- // In this case mInitialTargetIDs contains Ad-hoc session ID and it should not be added
- // to Recent People to prevent showing of an item with (?? ?)(?? ?), sans the spaces. See EXT-8246.
- // Concrete participants will be added into this list once they sent message in chat.
- if (IM_SESSION_INVITE == dialog) return;
-
- if (IM_SESSION_CONFERENCE_START == dialog) // outgoing ad-hoc session
- {
- // Add only online members of conference to recent list (EXT-8658)
- addSpeakersToRecent(im_session_id);
- }
- else // outgoing P2P session
- {
- // Add the recepient of the session.
- if (!session->mInitialTargetIDs.empty())
- {
- LLRecentPeople::instance().add(*(session->mInitialTargetIDs.begin()));
- }
- }
- }
+ const LLUUID& im_session_id,
+ const LLUUID& other_participant_id,
+ EInstantMessage dialog)
+{
+ std::string name;
+ bool sent = false;
+ LLAgentUI::buildFullname(name);
+
+ const LLRelationship* info = NULL;
+ info = LLAvatarTracker::instance().getBuddyInfo(other_participant_id);
+
+ U8 offline = (!info || info->isOnline()) ? IM_ONLINE : IM_OFFLINE;
+ // Old call to send messages to SLim client, no longer supported.
+ //if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
+ //{
+ // // User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice.
+ // sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
+ //}
+
+ if(!sent)
+ {
+ // Send message normally.
+
+ // default to IM_SESSION_SEND unless it's nothing special - in
+ // which case it's probably an IM to everyone.
+ U8 new_dialog = dialog;
+
+ if ( dialog != IM_NOTHING_SPECIAL )
+ {
+ new_dialog = IM_SESSION_SEND;
+ }
+ pack_instant_message(
+ gMessageSystem,
+ gAgent.getID(),
+ FALSE,
+ gAgent.getSessionID(),
+ other_participant_id,
+ name.c_str(),
+ utf8_text.c_str(),
+ offline,
+ (EInstantMessage)new_dialog,
+ im_session_id);
+ gAgent.sendReliableMessage();
+ }
+
+ bool is_group_chat = false;
+ LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(im_session_id);
+ if(session)
+ {
+ is_group_chat = session->isGroupSessionType();
+ }
+
+ // If there is a mute list and this is not a group chat...
+ if ( LLMuteList::getInstance() && !is_group_chat)
+ {
+ // ... the target should not be in our mute list for some message types.
+ // Auto-remove them if present.
+ switch( dialog )
+ {
+ case IM_NOTHING_SPECIAL:
+ case IM_GROUP_INVITATION:
+ case IM_INVENTORY_OFFERED:
+ case IM_SESSION_INVITE:
+ case IM_SESSION_P2P_INVITE:
+ case IM_SESSION_CONFERENCE_START:
+ case IM_SESSION_SEND: // This one is marginal - erring on the side of hearing.
+ case IM_LURE_USER:
+ case IM_GODLIKE_LURE_USER:
+ case IM_FRIENDSHIP_OFFERED:
+ LLMuteList::getInstance()->autoRemove(other_participant_id, LLMuteList::AR_IM);
+ break;
+ default: ; // do nothing
+ }
+ }
+
+ if((dialog == IM_NOTHING_SPECIAL) &&
+ (other_participant_id.notNull()))
+ {
+ // Do we have to replace the /me's here?
+ std::string from;
+ LLAgentUI::buildFullname(from);
+ LLIMModel::getInstance()->addMessage(im_session_id, from, gAgentID, utf8_text);
+
+ //local echo for the legacy communicate panel
+ std::string history_echo;
+ LLAgentUI::buildFullname(history_echo);
+
+ history_echo += ": " + utf8_text;
+
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(im_session_id);
+ if (speaker_mgr)
+ {
+ speaker_mgr->speakerChatted(gAgentID);
+ speaker_mgr->setSpeakerTyping(gAgentID, FALSE);
+ }
+ }
+
+ // Add the recipient to the recent people list.
+ bool is_not_group_id = LLGroupMgr::getInstance()->getGroupData(other_participant_id) == NULL;
+
+ if (is_not_group_id)
+ {
+ if( session == 0)//??? shouldn't really happen
+ {
+ LLRecentPeople::instance().add(other_participant_id);
+ return;
+ }
+ // IM_SESSION_INVITE means that this is an Ad-hoc incoming chat
+ // (it can be also Group chat but it is checked above)
+ // In this case mInitialTargetIDs contains Ad-hoc session ID and it should not be added
+ // to Recent People to prevent showing of an item with (?? ?)(?? ?), sans the spaces. See EXT-8246.
+ // Concrete participants will be added into this list once they sent message in chat.
+ if (IM_SESSION_INVITE == dialog) return;
+
+ if (IM_SESSION_CONFERENCE_START == dialog) // outgoing ad-hoc session
+ {
+ // Add only online members of conference to recent list (EXT-8658)
+ addSpeakersToRecent(im_session_id);
+ }
+ else // outgoing P2P session
+ {
+ // Add the recepient of the session.
+ if (!session->mInitialTargetIDs.empty())
+ {
+ LLRecentPeople::instance().add(*(session->mInitialTargetIDs.begin()));
+ }
+ }
+ }
}
void LLIMModel::addSpeakersToRecent(const LLUUID& im_session_id)
{
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(im_session_id);
- LLSpeakerMgr::speaker_list_t speaker_list;
- if(speaker_mgr != NULL)
- {
- speaker_mgr->getSpeakerList(&speaker_list, true);
- }
- for(LLSpeakerMgr::speaker_list_t::iterator it = speaker_list.begin(); it != speaker_list.end(); it++)
- {
- const LLPointer<LLSpeaker>& speakerp = *it;
- LLRecentPeople::instance().add(speakerp->mID);
- }
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(im_session_id);
+ LLSpeakerMgr::speaker_list_t speaker_list;
+ if(speaker_mgr != NULL)
+ {
+ speaker_mgr->getSpeakerList(&speaker_list, true);
+ }
+ for(LLSpeakerMgr::speaker_list_t::iterator it = speaker_list.begin(); it != speaker_list.end(); it++)
+ {
+ const LLPointer<LLSpeaker>& speakerp = *it;
+ LLRecentPeople::instance().add(speakerp->mID);
+ }
}
void session_starter_helper(
- const LLUUID& temp_session_id,
- const LLUUID& other_participant_id,
- EInstantMessage im_type)
+ const LLUUID& temp_session_id,
+ const LLUUID& other_participant_id,
+ EInstantMessage im_type)
{
- LLMessageSystem *msg = gMessageSystem;
+ LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MessageBlock);
- msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
- msg->addUUIDFast(_PREHASH_ToAgentID, other_participant_id);
- msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
- msg->addU8Fast(_PREHASH_Dialog, im_type);
- msg->addUUIDFast(_PREHASH_ID, temp_session_id);
- msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
+ msg->nextBlockFast(_PREHASH_MessageBlock);
+ msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
+ msg->addUUIDFast(_PREHASH_ToAgentID, other_participant_id);
+ msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
+ msg->addU8Fast(_PREHASH_Dialog, im_type);
+ msg->addUUIDFast(_PREHASH_ID, temp_session_id);
+ msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
- std::string name;
- LLAgentUI::buildFullname(name);
+ std::string name;
+ LLAgentUI::buildFullname(name);
- msg->addStringFast(_PREHASH_FromAgentName, name);
- msg->addStringFast(_PREHASH_Message, LLStringUtil::null);
- msg->addU32Fast(_PREHASH_ParentEstateID, 0);
- msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
- msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
+ msg->addStringFast(_PREHASH_FromAgentName, name);
+ msg->addStringFast(_PREHASH_Message, LLStringUtil::null);
+ msg->addU32Fast(_PREHASH_ParentEstateID, 0);
+ msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
+ msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
}
void start_deprecated_conference_chat(
- const LLUUID& temp_session_id,
- const LLUUID& creator_id,
- const LLUUID& other_participant_id,
- const LLSD& agents_to_invite)
-{
- U8* bucket;
- U8* pos;
- S32 count;
- S32 bucket_size;
-
- // *FIX: this could suffer from endian issues
- count = agents_to_invite.size();
- bucket_size = UUID_BYTES * count;
- bucket = new U8[bucket_size];
- pos = bucket;
-
- for(S32 i = 0; i < count; ++i)
- {
- LLUUID agent_id = agents_to_invite[i].asUUID();
+ const LLUUID& temp_session_id,
+ const LLUUID& creator_id,
+ const LLUUID& other_participant_id,
+ const LLSD& agents_to_invite)
+{
+ U8* bucket;
+ U8* pos;
+ S32 count;
+ S32 bucket_size;
+
+ // *FIX: this could suffer from endian issues
+ count = agents_to_invite.size();
+ bucket_size = UUID_BYTES * count;
+ bucket = new U8[bucket_size];
+ pos = bucket;
+
+ for(S32 i = 0; i < count; ++i)
+ {
+ LLUUID agent_id = agents_to_invite[i].asUUID();
- memcpy(pos, &agent_id, UUID_BYTES);
- pos += UUID_BYTES;
- }
+ memcpy(pos, &agent_id, UUID_BYTES);
+ pos += UUID_BYTES;
+ }
- session_starter_helper(
- temp_session_id,
- other_participant_id,
- IM_SESSION_CONFERENCE_START);
+ session_starter_helper(
+ temp_session_id,
+ other_participant_id,
+ IM_SESSION_CONFERENCE_START);
- gMessageSystem->addBinaryDataFast(
- _PREHASH_BinaryBucket,
- bucket,
- bucket_size);
+ gMessageSystem->addBinaryDataFast(
+ _PREHASH_BinaryBucket,
+ bucket,
+ bucket_size);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
- delete[] bucket;
+ delete[] bucket;
}
// Returns true if any messages were sent, false otherwise.
// Is sort of equivalent to "does the server need to do anything?"
bool LLIMModel::sendStartSession(
- const LLUUID& temp_session_id,
- const LLUUID& other_participant_id,
- const uuid_vec_t& ids,
- EInstantMessage dialog)
-{
- if ( dialog == IM_SESSION_GROUP_START )
- {
- session_starter_helper(
- temp_session_id,
- other_participant_id,
- dialog);
- gMessageSystem->addBinaryDataFast(
- _PREHASH_BinaryBucket,
- EMPTY_BINARY_BUCKET,
- EMPTY_BINARY_BUCKET_SIZE);
- gAgent.sendReliableMessage();
-
- return true;
- }
- else if ( dialog == IM_SESSION_CONFERENCE_START )
- {
- LLSD agents;
- for (int i = 0; i < (S32) ids.size(); i++)
- {
- agents.append(ids[i]);
- }
-
- //we have a new way of starting conference calls now
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
- std::string url = region->getCapability(
- "ChatSessionRequest");
+ const LLUUID& temp_session_id,
+ const LLUUID& other_participant_id,
+ const uuid_vec_t& ids,
+ EInstantMessage dialog)
+{
+ if ( dialog == IM_SESSION_GROUP_START )
+ {
+ session_starter_helper(
+ temp_session_id,
+ other_participant_id,
+ dialog);
+ gMessageSystem->addBinaryDataFast(
+ _PREHASH_BinaryBucket,
+ EMPTY_BINARY_BUCKET,
+ EMPTY_BINARY_BUCKET_SIZE);
+ gAgent.sendReliableMessage();
+
+ return true;
+ }
+ else if ( dialog == IM_SESSION_CONFERENCE_START )
+ {
+ LLSD agents;
+ for (int i = 0; i < (S32) ids.size(); i++)
+ {
+ agents.append(ids[i]);
+ }
+
+ //we have a new way of starting conference calls now
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ std::string url = region->getCapability(
+ "ChatSessionRequest");
LLCoros::instance().launch("startConfrenceCoro",
boost::bind(&startConfrenceCoro, url,
temp_session_id, gAgent.getID(), other_participant_id, agents));
- }
- else
- {
- start_deprecated_conference_chat(
- temp_session_id,
- gAgent.getID(),
- other_participant_id,
- agents);
- }
+ }
+ else
+ {
+ start_deprecated_conference_chat(
+ temp_session_id,
+ gAgent.getID(),
+ other_participant_id,
+ agents);
+ }
- //we also need to wait for reply from the server in case of ad-hoc chat (we'll get new session id)
- return true;
- }
+ //we also need to wait for reply from the server in case of ad-hoc chat (we'll get new session id)
+ return true;
+ }
- return false;
+ return false;
}
@@ -2075,126 +2075,126 @@ bool LLIMModel::sendStartSession(
// static
LLUUID LLIMMgr::computeSessionID(
- EInstantMessage dialog,
- const LLUUID& other_participant_id)
-{
- LLUUID session_id;
- if (IM_SESSION_GROUP_START == dialog)
- {
- // slam group session_id to the group_id (other_participant_id)
- session_id = other_participant_id;
- }
- else if (IM_SESSION_CONFERENCE_START == dialog)
- {
- session_id.generate();
- }
- else if (IM_SESSION_INVITE == dialog)
- {
- // use provided session id for invites
- session_id = other_participant_id;
- }
- else
- {
- LLUUID agent_id = gAgent.getID();
- if (other_participant_id == agent_id)
- {
- // if we try to send an IM to ourselves then the XOR would be null
- // so we just make the session_id the same as the agent_id
- session_id = agent_id;
- }
- else
- {
- // peer-to-peer or peer-to-asset session_id is the XOR
- session_id = other_participant_id ^ agent_id;
- }
- }
-
- if (gAgent.isInGroup(session_id, TRUE) && (session_id != other_participant_id))
- {
- LL_WARNS() << "Group session id different from group id: IM type = " << dialog << ", session id = " << session_id << ", group id = " << other_participant_id << LL_ENDL;
- }
- return session_id;
+ EInstantMessage dialog,
+ const LLUUID& other_participant_id)
+{
+ LLUUID session_id;
+ if (IM_SESSION_GROUP_START == dialog)
+ {
+ // slam group session_id to the group_id (other_participant_id)
+ session_id = other_participant_id;
+ }
+ else if (IM_SESSION_CONFERENCE_START == dialog)
+ {
+ session_id.generate();
+ }
+ else if (IM_SESSION_INVITE == dialog)
+ {
+ // use provided session id for invites
+ session_id = other_participant_id;
+ }
+ else
+ {
+ LLUUID agent_id = gAgent.getID();
+ if (other_participant_id == agent_id)
+ {
+ // if we try to send an IM to ourselves then the XOR would be null
+ // so we just make the session_id the same as the agent_id
+ session_id = agent_id;
+ }
+ else
+ {
+ // peer-to-peer or peer-to-asset session_id is the XOR
+ session_id = other_participant_id ^ agent_id;
+ }
+ }
+
+ if (gAgent.isInGroup(session_id, TRUE) && (session_id != other_participant_id))
+ {
+ LL_WARNS() << "Group session id different from group id: IM type = " << dialog << ", session id = " << session_id << ", group id = " << other_participant_id << LL_ENDL;
+ }
+ return session_id;
}
void
LLIMMgr::showSessionStartError(
- const std::string& error_string,
- const LLUUID session_id)
+ const std::string& error_string,
+ const LLUUID session_id)
{
- if (!hasSession(session_id)) return;
+ if (!hasSession(session_id)) return;
- LLSD args;
- args["REASON"] = LLTrans::getString(error_string);
- args["RECIPIENT"] = LLIMModel::getInstance()->getName(session_id);
+ LLSD args;
+ args["REASON"] = LLTrans::getString(error_string);
+ args["RECIPIENT"] = LLIMModel::getInstance()->getName(session_id);
- LLSD payload;
- payload["session_id"] = session_id;
+ LLSD payload;
+ payload["session_id"] = session_id;
- LLNotificationsUtil::add(
- "ChatterBoxSessionStartError",
- args,
- payload,
- LLIMMgr::onConfirmForceCloseError);
+ LLNotificationsUtil::add(
+ "ChatterBoxSessionStartError",
+ args,
+ payload,
+ LLIMMgr::onConfirmForceCloseError);
}
void
LLIMMgr::showSessionEventError(
- const std::string& event_string,
- const std::string& error_string,
- const LLUUID session_id)
+ const std::string& event_string,
+ const std::string& error_string,
+ const LLUUID session_id)
{
- LLSD args;
- LLStringUtil::format_map_t event_args;
+ LLSD args;
+ LLStringUtil::format_map_t event_args;
- event_args["RECIPIENT"] = LLIMModel::getInstance()->getName(session_id);
+ event_args["RECIPIENT"] = LLIMModel::getInstance()->getName(session_id);
- args["REASON"] =
- LLTrans::getString(error_string);
- args["EVENT"] =
- LLTrans::getString(event_string, event_args);
+ args["REASON"] =
+ LLTrans::getString(error_string);
+ args["EVENT"] =
+ LLTrans::getString(event_string, event_args);
- LLNotificationsUtil::add(
- "ChatterBoxSessionEventError",
- args);
+ LLNotificationsUtil::add(
+ "ChatterBoxSessionEventError",
+ args);
}
void
LLIMMgr::showSessionForceClose(
- const std::string& reason_string,
- const LLUUID session_id)
+ const std::string& reason_string,
+ const LLUUID session_id)
{
- if (!hasSession(session_id)) return;
+ if (!hasSession(session_id)) return;
- LLSD args;
+ LLSD args;
- args["NAME"] = LLIMModel::getInstance()->getName(session_id);
- args["REASON"] = LLTrans::getString(reason_string);
+ args["NAME"] = LLIMModel::getInstance()->getName(session_id);
+ args["REASON"] = LLTrans::getString(reason_string);
- LLSD payload;
- payload["session_id"] = session_id;
+ LLSD payload;
+ payload["session_id"] = session_id;
- LLNotificationsUtil::add(
- "ForceCloseChatterBoxSession",
- args,
- payload,
- LLIMMgr::onConfirmForceCloseError);
+ LLNotificationsUtil::add(
+ "ForceCloseChatterBoxSession",
+ args,
+ payload,
+ LLIMMgr::onConfirmForceCloseError);
}
//static
bool
LLIMMgr::onConfirmForceCloseError(
- const LLSD& notification,
- const LLSD& response)
+ const LLSD& notification,
+ const LLSD& response)
{
- //only 1 option really
- LLUUID session_id = notification["payload"]["session_id"];
+ //only 1 option really
+ LLUUID session_id = notification["payload"]["session_id"];
- LLFloater* floater = LLFloaterIMSession::findInstance(session_id);
- if ( floater )
- {
- floater->closeFloater(FALSE);
- }
- return false;
+ LLFloater* floater = LLFloaterIMSession::findInstance(session_id);
+ if ( floater )
+ {
+ floater->closeFloater(FALSE);
+ }
+ return false;
}
@@ -2216,7 +2216,7 @@ LLCallDialogManager::~LLCallDialogManager()
void LLCallDialogManager::initSingleton()
{
- LLVoiceChannel::setCurrentVoiceChannelChangedCallback(LLCallDialogManager::onVoiceChannelChanged);
+ LLVoiceChannel::setCurrentVoiceChannelChangedCallback(LLCallDialogManager::onVoiceChannelChanged);
}
// static
@@ -2227,48 +2227,48 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
void LLCallDialogManager::onVoiceChannelChangedInt(const LLUUID &session_id)
{
- LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id);
- if(!session)
- {
- mPreviousSessionlName = mCurrentSessionlName;
- mCurrentSessionlName = ""; // Empty string results in "Nearby Voice Chat" after substitution
- return;
- }
-
- mSession = session;
-
- static boost::signals2::connection prev_channel_state_changed_connection;
- // disconnect previously connected callback to avoid have invalid sSession in onVoiceChannelStateChanged()
- prev_channel_state_changed_connection.disconnect();
- prev_channel_state_changed_connection =
- mSession->mVoiceChannel->setStateChangedCallback(boost::bind(LLCallDialogManager::onVoiceChannelStateChanged, _1, _2, _3, _4));
-
- if(mCurrentSessionlName != session->mName)
- {
- mPreviousSessionlName = mCurrentSessionlName;
- mCurrentSessionlName = session->mName;
- }
-
- if (LLVoiceChannel::getCurrentVoiceChannel()->getState() == LLVoiceChannel::STATE_CALL_STARTED &&
- LLVoiceChannel::getCurrentVoiceChannel()->getCallDirection() == LLVoiceChannel::OUTGOING_CALL)
- {
-
- //*TODO get rid of duplicated code
- LLSD mCallDialogPayload;
- mCallDialogPayload["session_id"] = mSession->mSessionID;
- mCallDialogPayload["session_name"] = mSession->mName;
- mCallDialogPayload["other_user_id"] = mSession->mOtherParticipantID;
- mCallDialogPayload["old_channel_name"] = mPreviousSessionlName;
- mCallDialogPayload["state"] = LLVoiceChannel::STATE_CALL_STARTED;
- mCallDialogPayload["disconnected_channel_name"] = mSession->mName;
- mCallDialogPayload["session_type"] = mSession->mSessionType;
-
- LLOutgoingCallDialog* ocd = LLFloaterReg::getTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
- if(ocd)
- {
- ocd->show(mCallDialogPayload);
- }
- }
+ LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id);
+ if(!session)
+ {
+ mPreviousSessionlName = mCurrentSessionlName;
+ mCurrentSessionlName = ""; // Empty string results in "Nearby Voice Chat" after substitution
+ return;
+ }
+
+ mSession = session;
+
+ static boost::signals2::connection prev_channel_state_changed_connection;
+ // disconnect previously connected callback to avoid have invalid sSession in onVoiceChannelStateChanged()
+ prev_channel_state_changed_connection.disconnect();
+ prev_channel_state_changed_connection =
+ mSession->mVoiceChannel->setStateChangedCallback(boost::bind(LLCallDialogManager::onVoiceChannelStateChanged, _1, _2, _3, _4));
+
+ if(mCurrentSessionlName != session->mName)
+ {
+ mPreviousSessionlName = mCurrentSessionlName;
+ mCurrentSessionlName = session->mName;
+ }
+
+ if (LLVoiceChannel::getCurrentVoiceChannel()->getState() == LLVoiceChannel::STATE_CALL_STARTED &&
+ LLVoiceChannel::getCurrentVoiceChannel()->getCallDirection() == LLVoiceChannel::OUTGOING_CALL)
+ {
+
+ //*TODO get rid of duplicated code
+ LLSD mCallDialogPayload;
+ mCallDialogPayload["session_id"] = mSession->mSessionID;
+ mCallDialogPayload["session_name"] = mSession->mName;
+ mCallDialogPayload["other_user_id"] = mSession->mOtherParticipantID;
+ mCallDialogPayload["old_channel_name"] = mPreviousSessionlName;
+ mCallDialogPayload["state"] = LLVoiceChannel::STATE_CALL_STARTED;
+ mCallDialogPayload["disconnected_channel_name"] = mSession->mName;
+ mCallDialogPayload["session_type"] = mSession->mSessionType;
+
+ LLOutgoingCallDialog* ocd = LLFloaterReg::getTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
+ if(ocd)
+ {
+ ocd->show(mCallDialogPayload);
+ }
+ }
}
@@ -2280,116 +2280,116 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat
void LLCallDialogManager::onVoiceChannelStateChangedInt(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent)
{
- LLSD mCallDialogPayload;
- LLOutgoingCallDialog* ocd = NULL;
-
- if(mOldState == new_state)
- {
- return;
- }
-
- mOldState = new_state;
-
- mCallDialogPayload["session_id"] = mSession->mSessionID;
- mCallDialogPayload["session_name"] = mSession->mName;
- mCallDialogPayload["other_user_id"] = mSession->mOtherParticipantID;
- mCallDialogPayload["old_channel_name"] = mPreviousSessionlName;
- mCallDialogPayload["state"] = new_state;
- mCallDialogPayload["disconnected_channel_name"] = mSession->mName;
- mCallDialogPayload["session_type"] = mSession->mSessionType;
- mCallDialogPayload["ended_by_agent"] = ended_by_agent;
-
- switch(new_state)
- {
- case LLVoiceChannel::STATE_CALL_STARTED :
- // do not show "Calling to..." if it is incoming call
- if(direction == LLVoiceChannel::INCOMING_CALL)
- {
- return;
- }
- break;
-
- case LLVoiceChannel::STATE_HUNG_UP:
- // this state is coming before session is changed
- break;
-
- case LLVoiceChannel::STATE_CONNECTED :
- ocd = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
- if (ocd)
- {
- ocd->closeFloater();
- }
- return;
-
- default:
- break;
- }
-
- ocd = LLFloaterReg::getTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
- if(ocd)
- {
- ocd->show(mCallDialogPayload);
- }
+ LLSD mCallDialogPayload;
+ LLOutgoingCallDialog* ocd = NULL;
+
+ if(mOldState == new_state)
+ {
+ return;
+ }
+
+ mOldState = new_state;
+
+ mCallDialogPayload["session_id"] = mSession->mSessionID;
+ mCallDialogPayload["session_name"] = mSession->mName;
+ mCallDialogPayload["other_user_id"] = mSession->mOtherParticipantID;
+ mCallDialogPayload["old_channel_name"] = mPreviousSessionlName;
+ mCallDialogPayload["state"] = new_state;
+ mCallDialogPayload["disconnected_channel_name"] = mSession->mName;
+ mCallDialogPayload["session_type"] = mSession->mSessionType;
+ mCallDialogPayload["ended_by_agent"] = ended_by_agent;
+
+ switch(new_state)
+ {
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ // do not show "Calling to..." if it is incoming call
+ if(direction == LLVoiceChannel::INCOMING_CALL)
+ {
+ return;
+ }
+ break;
+
+ case LLVoiceChannel::STATE_HUNG_UP:
+ // this state is coming before session is changed
+ break;
+
+ case LLVoiceChannel::STATE_CONNECTED :
+ ocd = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
+ if (ocd)
+ {
+ ocd->closeFloater();
+ }
+ return;
+
+ default:
+ break;
+ }
+
+ ocd = LLFloaterReg::getTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
+ if(ocd)
+ {
+ ocd->show(mCallDialogPayload);
+ }
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLCallDialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LLCallDialog::LLCallDialog(const LLSD& payload)
- : LLDockableFloater(NULL, false, payload),
+ : LLDockableFloater(NULL, false, payload),
- mPayload(payload),
- mLifetime(DEFAULT_LIFETIME)
+ mPayload(payload),
+ mLifetime(DEFAULT_LIFETIME)
{
- setAutoFocus(FALSE);
- // force docked state since this floater doesn't save it between recreations
- setDocked(true);
+ setAutoFocus(FALSE);
+ // force docked state since this floater doesn't save it between recreations
+ setDocked(true);
}
LLCallDialog::~LLCallDialog()
{
- LLUI::getInstance()->removePopup(this);
+ LLUI::getInstance()->removePopup(this);
}
BOOL LLCallDialog::postBuild()
{
- if (!LLDockableFloater::postBuild() || !gToolBarView)
- return FALSE;
+ if (!LLDockableFloater::postBuild() || !gToolBarView)
+ return FALSE;
- dockToToolbarButton("speak");
+ dockToToolbarButton("speak");
- return TRUE;
+ return TRUE;
}
void LLCallDialog::dockToToolbarButton(const std::string& toolbarButtonName)
{
- LLDockControl::DocAt dock_pos = getDockControlPos(toolbarButtonName);
- LLView *anchor_panel = gToolBarView->findChildView(toolbarButtonName);
+ LLDockControl::DocAt dock_pos = getDockControlPos(toolbarButtonName);
+ LLView *anchor_panel = gToolBarView->findChildView(toolbarButtonName);
- setUseTongue(anchor_panel);
+ setUseTongue(anchor_panel);
- setDockControl(new LLDockControl(anchor_panel, this, getDockTongue(dock_pos), dock_pos));
+ setDockControl(new LLDockControl(anchor_panel, this, getDockTongue(dock_pos), dock_pos));
}
LLDockControl::DocAt LLCallDialog::getDockControlPos(const std::string& toolbarButtonName)
{
- LLCommandId command_id(toolbarButtonName);
- S32 toolbar_loc = gToolBarView->hasCommand(command_id);
+ LLCommandId command_id(toolbarButtonName);
+ S32 toolbar_loc = gToolBarView->hasCommand(command_id);
- LLDockControl::DocAt doc_at = LLDockControl::TOP;
+ LLDockControl::DocAt doc_at = LLDockControl::TOP;
- switch (toolbar_loc)
- {
- case LLToolBarEnums::TOOLBAR_LEFT:
- doc_at = LLDockControl::RIGHT;
- break;
+ switch (toolbar_loc)
+ {
+ case LLToolBarEnums::TOOLBAR_LEFT:
+ doc_at = LLDockControl::RIGHT;
+ break;
- case LLToolBarEnums::TOOLBAR_RIGHT:
- doc_at = LLDockControl::LEFT;
- break;
- }
+ case LLToolBarEnums::TOOLBAR_RIGHT:
+ doc_at = LLDockControl::LEFT;
+ break;
+ }
- return doc_at;
+ return doc_at;
}
@@ -2399,237 +2399,237 @@ LLDockControl::DocAt LLCallDialog::getDockControlPos(const std::string& toolbarB
LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) :
LLCallDialog(payload)
{
- LLOutgoingCallDialog* instance = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
- if(instance && instance->getVisible())
- {
- instance->onCancel(instance);
- }
+ LLOutgoingCallDialog* instance = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
+ if(instance && instance->getVisible())
+ {
+ instance->onCancel(instance);
+ }
}
void LLCallDialog::draw()
{
- if (lifetimeHasExpired())
- {
- onLifetimeExpired();
- }
+ if (lifetimeHasExpired())
+ {
+ onLifetimeExpired();
+ }
- if (getDockControl() != NULL)
- {
- LLDockableFloater::draw();
- }
+ if (getDockControl() != NULL)
+ {
+ LLDockableFloater::draw();
+ }
}
// virtual
void LLCallDialog::onOpen(const LLSD& key)
{
- LLDockableFloater::onOpen(key);
+ LLDockableFloater::onOpen(key);
- // it should be over the all floaters. EXT-5116
- LLUI::getInstance()->addPopup(this);
+ // it should be over the all floaters. EXT-5116
+ LLUI::getInstance()->addPopup(this);
}
void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id)
{
- bool participant_is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
+ bool participant_is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
- bool is_group = participant_is_avatar && gAgent.isInGroup(session_id, TRUE);
+ bool is_group = participant_is_avatar && gAgent.isInGroup(session_id, TRUE);
- LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon");
- LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon");
+ LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon");
+ LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon");
- avatar_icon->setVisible(!is_group);
- group_icon->setVisible(is_group);
+ avatar_icon->setVisible(!is_group);
+ group_icon->setVisible(is_group);
- if (is_group)
- {
- group_icon->setValue(session_id);
- }
- else if (participant_is_avatar)
- {
- avatar_icon->setValue(participant_id);
- }
- else
- {
+ if (is_group)
+ {
+ group_icon->setValue(session_id);
+ }
+ else if (participant_is_avatar)
+ {
+ avatar_icon->setValue(participant_id);
+ }
+ else
+ {
LL_WARNS() << "Participant neither avatar nor group" << LL_ENDL;
group_icon->setValue(session_id);
- }
+ }
}
bool LLCallDialog::lifetimeHasExpired()
{
- if (mLifetimeTimer.getStarted())
- {
- F32 elapsed_time = mLifetimeTimer.getElapsedTimeF32();
- if (elapsed_time > mLifetime)
- {
- return true;
- }
- }
- return false;
+ if (mLifetimeTimer.getStarted())
+ {
+ F32 elapsed_time = mLifetimeTimer.getElapsedTimeF32();
+ if (elapsed_time > mLifetime)
+ {
+ return true;
+ }
+ }
+ return false;
}
void LLCallDialog::onLifetimeExpired()
{
- mLifetimeTimer.stop();
- closeFloater();
+ mLifetimeTimer.stop();
+ closeFloater();
}
void LLOutgoingCallDialog::show(const LLSD& key)
{
- mPayload = key;
-
- //will be false only if voice in parcel is disabled and channel we leave is nearby(checked further)
- bool show_oldchannel = LLViewerParcelMgr::getInstance()->allowAgentVoice();
-
- // hide all text at first
- hideAllText();
-
- // init notification's lifetime
- std::istringstream ss( getString("lifetime") );
- if (!(ss >> mLifetime))
- {
- mLifetime = DEFAULT_LIFETIME;
- }
-
- // customize text strings
- // tell the user which voice channel they are leaving
- if (!mPayload["old_channel_name"].asString().empty())
- {
- std::string old_caller_name = mPayload["old_channel_name"].asString();
-
- getChild<LLUICtrl>("leaving")->setTextArg("[CURRENT_CHAT]", old_caller_name);
- show_oldchannel = true;
- }
- else
- {
- getChild<LLUICtrl>("leaving")->setTextArg("[CURRENT_CHAT]", getString("localchat"));
- }
-
- if (!mPayload["disconnected_channel_name"].asString().empty())
- {
- std::string channel_name = mPayload["disconnected_channel_name"].asString();
- getChild<LLUICtrl>("nearby")->setTextArg("[VOICE_CHANNEL_NAME]", channel_name);
-
- // skipping "You will now be reconnected to nearby" in notification when call is ended by disabling voice,
- // so no reconnection to nearby chat happens (EXT-4397)
- bool voice_works = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
- std::string reconnect_nearby = voice_works ? LLTrans::getString("reconnect_nearby") : std::string();
- getChild<LLUICtrl>("nearby")->setTextArg("[RECONNECT_NEARBY]", reconnect_nearby);
-
- const std::string& nearby_str = mPayload["ended_by_agent"] ? NEARBY_P2P_BY_AGENT : NEARBY_P2P_BY_OTHER;
- getChild<LLUICtrl>(nearby_str)->setTextArg("[RECONNECT_NEARBY]", reconnect_nearby);
- }
-
- std::string callee_name = mPayload["session_name"].asString();
-
- if (callee_name == "anonymous") // obsolete? Likely was part of avaline support
- {
- callee_name = getString("anonymous");
- }
-
- LLSD callee_id = mPayload["other_user_id"];
- // Beautification: Since you know who you called, just show display name
- std::string title = callee_name;
- std::string final_callee_name = callee_name;
- if (mPayload["session_type"].asInteger() == LLIMModel::LLIMSession::P2P_SESSION)
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(callee_id, &av_name))
- {
- final_callee_name = av_name.getDisplayName();
- title = av_name.getCompleteName();
- }
- }
- getChild<LLUICtrl>("calling")->setTextArg("[CALLEE_NAME]", final_callee_name);
- getChild<LLUICtrl>("connecting")->setTextArg("[CALLEE_NAME]", final_callee_name);
-
- setTitle(title);
-
- // for outgoing group calls callee_id == group id == session id
- setIcon(callee_id, callee_id);
-
- // stop timer by default
- mLifetimeTimer.stop();
-
- // show only necessary strings and controls
- switch(mPayload["state"].asInteger())
- {
- case LLVoiceChannel::STATE_CALL_STARTED :
- getChild<LLTextBox>("calling")->setVisible(true);
- getChild<LLButton>("Cancel")->setVisible(true);
- if(show_oldchannel)
- {
- getChild<LLTextBox>("leaving")->setVisible(true);
- }
- break;
- // STATE_READY is here to show appropriate text for ad-hoc and group calls when floater is shown(EXT-6893)
- case LLVoiceChannel::STATE_READY :
- case LLVoiceChannel::STATE_RINGING :
- if(show_oldchannel)
- {
- getChild<LLTextBox>("leaving")->setVisible(true);
- }
- getChild<LLTextBox>("connecting")->setVisible(true);
- break;
- case LLVoiceChannel::STATE_ERROR :
- getChild<LLTextBox>("noanswer")->setVisible(true);
- getChild<LLButton>("Cancel")->setVisible(false);
- setCanClose(true);
- mLifetimeTimer.start();
- break;
- case LLVoiceChannel::STATE_HUNG_UP :
- if (mPayload["session_type"].asInteger() == LLIMModel::LLIMSession::P2P_SESSION)
- {
- const std::string& nearby_str = mPayload["ended_by_agent"] ? NEARBY_P2P_BY_AGENT : NEARBY_P2P_BY_OTHER;
- getChild<LLTextBox>(nearby_str)->setVisible(true);
- }
- else
- {
- getChild<LLTextBox>("nearby")->setVisible(true);
- }
- getChild<LLButton>("Cancel")->setVisible(false);
- setCanClose(true);
- mLifetimeTimer.start();
- }
-
- openFloater(LLOutgoingCallDialog::OCD_KEY);
+ mPayload = key;
+
+ //will be false only if voice in parcel is disabled and channel we leave is nearby(checked further)
+ bool show_oldchannel = LLViewerParcelMgr::getInstance()->allowAgentVoice();
+
+ // hide all text at first
+ hideAllText();
+
+ // init notification's lifetime
+ std::istringstream ss( getString("lifetime") );
+ if (!(ss >> mLifetime))
+ {
+ mLifetime = DEFAULT_LIFETIME;
+ }
+
+ // customize text strings
+ // tell the user which voice channel they are leaving
+ if (!mPayload["old_channel_name"].asString().empty())
+ {
+ std::string old_caller_name = mPayload["old_channel_name"].asString();
+
+ getChild<LLUICtrl>("leaving")->setTextArg("[CURRENT_CHAT]", old_caller_name);
+ show_oldchannel = true;
+ }
+ else
+ {
+ getChild<LLUICtrl>("leaving")->setTextArg("[CURRENT_CHAT]", getString("localchat"));
+ }
+
+ if (!mPayload["disconnected_channel_name"].asString().empty())
+ {
+ std::string channel_name = mPayload["disconnected_channel_name"].asString();
+ getChild<LLUICtrl>("nearby")->setTextArg("[VOICE_CHANNEL_NAME]", channel_name);
+
+ // skipping "You will now be reconnected to nearby" in notification when call is ended by disabling voice,
+ // so no reconnection to nearby chat happens (EXT-4397)
+ bool voice_works = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+ std::string reconnect_nearby = voice_works ? LLTrans::getString("reconnect_nearby") : std::string();
+ getChild<LLUICtrl>("nearby")->setTextArg("[RECONNECT_NEARBY]", reconnect_nearby);
+
+ const std::string& nearby_str = mPayload["ended_by_agent"] ? NEARBY_P2P_BY_AGENT : NEARBY_P2P_BY_OTHER;
+ getChild<LLUICtrl>(nearby_str)->setTextArg("[RECONNECT_NEARBY]", reconnect_nearby);
+ }
+
+ std::string callee_name = mPayload["session_name"].asString();
+
+ if (callee_name == "anonymous") // obsolete? Likely was part of avaline support
+ {
+ callee_name = getString("anonymous");
+ }
+
+ LLSD callee_id = mPayload["other_user_id"];
+ // Beautification: Since you know who you called, just show display name
+ std::string title = callee_name;
+ std::string final_callee_name = callee_name;
+ if (mPayload["session_type"].asInteger() == LLIMModel::LLIMSession::P2P_SESSION)
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(callee_id, &av_name))
+ {
+ final_callee_name = av_name.getDisplayName();
+ title = av_name.getCompleteName();
+ }
+ }
+ getChild<LLUICtrl>("calling")->setTextArg("[CALLEE_NAME]", final_callee_name);
+ getChild<LLUICtrl>("connecting")->setTextArg("[CALLEE_NAME]", final_callee_name);
+
+ setTitle(title);
+
+ // for outgoing group calls callee_id == group id == session id
+ setIcon(callee_id, callee_id);
+
+ // stop timer by default
+ mLifetimeTimer.stop();
+
+ // show only necessary strings and controls
+ switch(mPayload["state"].asInteger())
+ {
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ getChild<LLTextBox>("calling")->setVisible(true);
+ getChild<LLButton>("Cancel")->setVisible(true);
+ if(show_oldchannel)
+ {
+ getChild<LLTextBox>("leaving")->setVisible(true);
+ }
+ break;
+ // STATE_READY is here to show appropriate text for ad-hoc and group calls when floater is shown(EXT-6893)
+ case LLVoiceChannel::STATE_READY :
+ case LLVoiceChannel::STATE_RINGING :
+ if(show_oldchannel)
+ {
+ getChild<LLTextBox>("leaving")->setVisible(true);
+ }
+ getChild<LLTextBox>("connecting")->setVisible(true);
+ break;
+ case LLVoiceChannel::STATE_ERROR :
+ getChild<LLTextBox>("noanswer")->setVisible(true);
+ getChild<LLButton>("Cancel")->setVisible(false);
+ setCanClose(true);
+ mLifetimeTimer.start();
+ break;
+ case LLVoiceChannel::STATE_HUNG_UP :
+ if (mPayload["session_type"].asInteger() == LLIMModel::LLIMSession::P2P_SESSION)
+ {
+ const std::string& nearby_str = mPayload["ended_by_agent"] ? NEARBY_P2P_BY_AGENT : NEARBY_P2P_BY_OTHER;
+ getChild<LLTextBox>(nearby_str)->setVisible(true);
+ }
+ else
+ {
+ getChild<LLTextBox>("nearby")->setVisible(true);
+ }
+ getChild<LLButton>("Cancel")->setVisible(false);
+ setCanClose(true);
+ mLifetimeTimer.start();
+ }
+
+ openFloater(LLOutgoingCallDialog::OCD_KEY);
}
void LLOutgoingCallDialog::hideAllText()
{
- getChild<LLTextBox>("calling")->setVisible(false);
- getChild<LLTextBox>("leaving")->setVisible(false);
- getChild<LLTextBox>("connecting")->setVisible(false);
- getChild<LLTextBox>("nearby_P2P_by_other")->setVisible(false);
- getChild<LLTextBox>("nearby_P2P_by_agent")->setVisible(false);
- getChild<LLTextBox>("nearby")->setVisible(false);
- getChild<LLTextBox>("noanswer")->setVisible(false);
+ getChild<LLTextBox>("calling")->setVisible(false);
+ getChild<LLTextBox>("leaving")->setVisible(false);
+ getChild<LLTextBox>("connecting")->setVisible(false);
+ getChild<LLTextBox>("nearby_P2P_by_other")->setVisible(false);
+ getChild<LLTextBox>("nearby_P2P_by_agent")->setVisible(false);
+ getChild<LLTextBox>("nearby")->setVisible(false);
+ getChild<LLTextBox>("noanswer")->setVisible(false);
}
//static
void LLOutgoingCallDialog::onCancel(void* user_data)
{
- LLOutgoingCallDialog* self = (LLOutgoingCallDialog*)user_data;
+ LLOutgoingCallDialog* self = (LLOutgoingCallDialog*)user_data;
- if (!gIMMgr)
- return;
+ if (!gIMMgr)
+ return;
- LLUUID session_id = self->mPayload["session_id"].asUUID();
- gIMMgr->endCall(session_id);
+ LLUUID session_id = self->mPayload["session_id"].asUUID();
+ gIMMgr->endCall(session_id);
- self->closeFloater();
+ self->closeFloater();
}
BOOL LLOutgoingCallDialog::postBuild()
{
- BOOL success = LLCallDialog::postBuild();
+ BOOL success = LLCallDialog::postBuild();
- childSetAction("Cancel", onCancel, this);
+ childSetAction("Cancel", onCancel, this);
- setCanDrag(FALSE);
+ setCanDrag(FALSE);
- return success;
+ return success;
}
@@ -2658,26 +2658,26 @@ mAvatarNameCacheConnection()
void LLIncomingCallDialog::onLifetimeExpired()
{
- std::string session_handle = mPayload["session_handle"].asString();
- if (LLVoiceClient::getInstance()->isValidChannel(session_handle))
- {
- // restart notification's timer if call is still valid
- mLifetimeTimer.start();
- }
- else
- {
- // close invitation if call is already not valid
- mLifetimeTimer.stop();
- LLUUID session_id = mPayload["session_id"].asUUID();
- gIMMgr->clearPendingAgentListUpdates(session_id);
- gIMMgr->clearPendingInvitation(session_id);
- closeFloater();
- }
+ std::string session_handle = mPayload["session_handle"].asString();
+ if (LLVoiceClient::getInstance()->isValidChannel(session_handle))
+ {
+ // restart notification's timer if call is still valid
+ mLifetimeTimer.start();
+ }
+ else
+ {
+ // close invitation if call is already not valid
+ mLifetimeTimer.stop();
+ LLUUID session_id = mPayload["session_id"].asUUID();
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ gIMMgr->clearPendingInvitation(session_id);
+ closeFloater();
+ }
}
BOOL LLIncomingCallDialog::postBuild()
{
- LLCallDialog::postBuild();
+ LLCallDialog::postBuild();
if (!mPayload.isMap() || mPayload.size() == 0)
{
@@ -2685,9 +2685,9 @@ BOOL LLIncomingCallDialog::postBuild()
return TRUE;
}
- LLUUID session_id = mPayload["session_id"].asUUID();
- LLSD caller_id = mPayload["caller_id"];
- std::string caller_name = mPayload["caller_name"].asString();
+ LLUUID session_id = mPayload["session_id"].asUUID();
+ LLSD caller_id = mPayload["caller_id"];
+ std::string caller_name = mPayload["caller_name"].asString();
if (session_id.isNull() && caller_id.asUUID().isNull())
{
@@ -2702,347 +2702,347 @@ BOOL LLIncomingCallDialog::postBuild()
return TRUE;
}
- // init notification's lifetime
- std::istringstream ss( getString("lifetime") );
- if (!(ss >> mLifetime))
- {
- mLifetime = DEFAULT_LIFETIME;
- }
-
- std::string call_type;
- if (gAgent.isInGroup(session_id, TRUE))
- {
- LLStringUtil::format_map_t args;
- LLGroupData data;
- if (gAgent.getGroupData(session_id, data))
- {
- args["[GROUP]"] = data.mName;
- call_type = getString(notify_box_type, args);
- }
- }
- else
- {
- call_type = getString(notify_box_type);
- }
-
- if (caller_name == "anonymous") // obsolete? Likely was part of avaline support
- {
- caller_name = getString("anonymous");
- setCallerName(caller_name, caller_name, call_type);
- }
- else
- {
- // Get the full name information
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(caller_id, boost::bind(&LLIncomingCallDialog::onAvatarNameCache, this, _1, _2, call_type));
- }
-
- setIcon(session_id, caller_id);
-
- childSetAction("Accept", onAccept, this);
- childSetAction("Reject", onReject, this);
- childSetAction("Start IM", onStartIM, this);
- setDefaultBtn("Accept");
-
- if(notify_box_type != "VoiceInviteGroup" && notify_box_type != "VoiceInviteAdHoc")
- {
- // starting notification's timer for P2P invitations
- mLifetimeTimer.start();
- }
- else
- {
- mLifetimeTimer.stop();
- }
-
- //it's not possible to connect to existing Ad-Hoc/Group chat through incoming ad-hoc call
- bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
- getChildView("Start IM")->setVisible( is_avatar && notify_box_type != "VoiceInviteAdHoc" && notify_box_type != "VoiceInviteGroup");
-
- setCanDrag(FALSE);
- return TRUE;
+ // init notification's lifetime
+ std::istringstream ss( getString("lifetime") );
+ if (!(ss >> mLifetime))
+ {
+ mLifetime = DEFAULT_LIFETIME;
+ }
+
+ std::string call_type;
+ if (gAgent.isInGroup(session_id, TRUE))
+ {
+ LLStringUtil::format_map_t args;
+ LLGroupData data;
+ if (gAgent.getGroupData(session_id, data))
+ {
+ args["[GROUP]"] = data.mName;
+ call_type = getString(notify_box_type, args);
+ }
+ }
+ else
+ {
+ call_type = getString(notify_box_type);
+ }
+
+ if (caller_name == "anonymous") // obsolete? Likely was part of avaline support
+ {
+ caller_name = getString("anonymous");
+ setCallerName(caller_name, caller_name, call_type);
+ }
+ else
+ {
+ // Get the full name information
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(caller_id, boost::bind(&LLIncomingCallDialog::onAvatarNameCache, this, _1, _2, call_type));
+ }
+
+ setIcon(session_id, caller_id);
+
+ childSetAction("Accept", onAccept, this);
+ childSetAction("Reject", onReject, this);
+ childSetAction("Start IM", onStartIM, this);
+ setDefaultBtn("Accept");
+
+ if(notify_box_type != "VoiceInviteGroup" && notify_box_type != "VoiceInviteAdHoc")
+ {
+ // starting notification's timer for P2P invitations
+ mLifetimeTimer.start();
+ }
+ else
+ {
+ mLifetimeTimer.stop();
+ }
+
+ //it's not possible to connect to existing Ad-Hoc/Group chat through incoming ad-hoc call
+ bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
+ getChildView("Start IM")->setVisible( is_avatar && notify_box_type != "VoiceInviteAdHoc" && notify_box_type != "VoiceInviteGroup");
+
+ setCanDrag(FALSE);
+ return TRUE;
}
void LLIncomingCallDialog::setCallerName(const std::string& ui_title,
- const std::string& ui_label,
- const std::string& call_type)
+ const std::string& ui_label,
+ const std::string& call_type)
{
- // call_type may be a string like " is calling."
- LLUICtrl* caller_name_widget = getChild<LLUICtrl>("caller name");
- caller_name_widget->setValue(ui_label + " " + call_type);
+ // call_type may be a string like " is calling."
+ LLUICtrl* caller_name_widget = getChild<LLUICtrl>("caller name");
+ caller_name_widget->setValue(ui_label + " " + call_type);
}
void LLIncomingCallDialog::onAvatarNameCache(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- const std::string& call_type)
+ const LLAvatarName& av_name,
+ const std::string& call_type)
{
- mAvatarNameCacheConnection.disconnect();
- std::string title = av_name.getCompleteName();
- setCallerName(title, av_name.getCompleteName(), call_type);
+ mAvatarNameCacheConnection.disconnect();
+ std::string title = av_name.getCompleteName();
+ setCallerName(title, av_name.getCompleteName(), call_type);
}
void LLIncomingCallDialog::onOpen(const LLSD& key)
{
- LLCallDialog::onOpen(key);
+ LLCallDialog::onOpen(key);
- if (gSavedSettings.getBOOL("PlaySoundIncomingVoiceCall"))
- {
- // play a sound for incoming voice call if respective property is set
- make_ui_sound("UISndStartIM");
- }
+ if (gSavedSettings.getBOOL("PlaySoundIncomingVoiceCall"))
+ {
+ // play a sound for incoming voice call if respective property is set
+ make_ui_sound("UISndStartIM");
+ }
- LLStringUtil::format_map_t args;
- LLGroupData data;
- // if it's a group call, retrieve group name to use it in question
- if (gAgent.getGroupData(key["session_id"].asUUID(), data))
- {
- args["[GROUP]"] = data.mName;
- }
+ LLStringUtil::format_map_t args;
+ LLGroupData data;
+ // if it's a group call, retrieve group name to use it in question
+ if (gAgent.getGroupData(key["session_id"].asUUID(), data))
+ {
+ args["[GROUP]"] = data.mName;
+ }
}
//static
void LLIncomingCallDialog::onAccept(void* user_data)
{
- LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data;
- processCallResponse(0, self->mPayload);
- self->closeFloater();
+ LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data;
+ processCallResponse(0, self->mPayload);
+ self->closeFloater();
}
//static
void LLIncomingCallDialog::onReject(void* user_data)
{
- LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data;
- processCallResponse(1, self->mPayload);
- self->closeFloater();
+ LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data;
+ processCallResponse(1, self->mPayload);
+ self->closeFloater();
}
//static
void LLIncomingCallDialog::onStartIM(void* user_data)
{
- LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data;
- processCallResponse(2, self->mPayload);
- self->closeFloater();
+ LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data;
+ processCallResponse(2, self->mPayload);
+ self->closeFloater();
}
// static
void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload)
{
- if (!gIMMgr || gDisconnected)
- return;
-
- LLUUID session_id = payload["session_id"].asUUID();
- LLUUID caller_id = payload["caller_id"].asUUID();
- std::string session_name = payload["session_name"].asString();
- EInstantMessage type = (EInstantMessage)payload["type"].asInteger();
- LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)payload["inv_type"].asInteger();
- bool voice = true;
- switch(response)
- {
- case 2: // start IM: just don't start the voice chat
- {
- voice = false;
- /* FALLTHROUGH */
- }
- case 0: // accept
- {
- if (type == IM_SESSION_P2P_INVITE)
- {
- // create a normal IM session
- session_id = gIMMgr->addP2PSession(
- session_name,
- caller_id,
- payload["session_handle"].asString(),
- payload["session_uri"].asString());
-
- if (voice)
- {
- gIMMgr->startCall(session_id, LLVoiceChannel::INCOMING_CALL);
- }
- else
- {
- LLAvatarActions::startIM(caller_id);
- }
-
- gIMMgr->clearPendingAgentListUpdates(session_id);
- gIMMgr->clearPendingInvitation(session_id);
- }
- else
- {
- //session name should not be empty, but it can contain spaces so we don't trim
- std::string correct_session_name = session_name;
- if (session_name.empty())
- {
- LL_WARNS() << "Received an empty session name from a server" << LL_ENDL;
-
- switch(type){
- case IM_SESSION_CONFERENCE_START:
- case IM_SESSION_GROUP_START:
- case IM_SESSION_INVITE:
- if (gAgent.isInGroup(session_id, TRUE))
- {
- LLGroupData data;
- if (!gAgent.getGroupData(session_id, data)) break;
- correct_session_name = data.mName;
- }
- else
- {
- // *NOTE: really should be using callbacks here
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(caller_id, &av_name))
- {
- correct_session_name = av_name.getCompleteName();
- correct_session_name.append(ADHOC_NAME_SUFFIX);
- }
- }
- LL_INFOS("IMVIEW") << "Corrected session name is " << correct_session_name << LL_ENDL;
- break;
- default:
- LL_WARNS("IMVIEW") << "Received an empty session name from a server and failed to generate a new proper session name" << LL_ENDL;
- break;
- }
- }
-
- gIMMgr->addSession(correct_session_name, type, session_id, true);
-
- std::string url = gAgent.getRegion()->getCapability(
- "ChatSessionRequest");
-
- if (voice)
- {
+ if (!gIMMgr || gDisconnected)
+ return;
+
+ LLUUID session_id = payload["session_id"].asUUID();
+ LLUUID caller_id = payload["caller_id"].asUUID();
+ std::string session_name = payload["session_name"].asString();
+ EInstantMessage type = (EInstantMessage)payload["type"].asInteger();
+ LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)payload["inv_type"].asInteger();
+ bool voice = true;
+ switch(response)
+ {
+ case 2: // start IM: just don't start the voice chat
+ {
+ voice = false;
+ /* FALLTHROUGH */
+ }
+ case 0: // accept
+ {
+ if (type == IM_SESSION_P2P_INVITE)
+ {
+ // create a normal IM session
+ session_id = gIMMgr->addP2PSession(
+ session_name,
+ caller_id,
+ payload["session_handle"].asString(),
+ payload["session_uri"].asString());
+
+ if (voice)
+ {
+ gIMMgr->startCall(session_id, LLVoiceChannel::INCOMING_CALL);
+ }
+ else
+ {
+ LLAvatarActions::startIM(caller_id);
+ }
+
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ gIMMgr->clearPendingInvitation(session_id);
+ }
+ else
+ {
+ //session name should not be empty, but it can contain spaces so we don't trim
+ std::string correct_session_name = session_name;
+ if (session_name.empty())
+ {
+ LL_WARNS() << "Received an empty session name from a server" << LL_ENDL;
+
+ switch(type){
+ case IM_SESSION_CONFERENCE_START:
+ case IM_SESSION_GROUP_START:
+ case IM_SESSION_INVITE:
+ if (gAgent.isInGroup(session_id, TRUE))
+ {
+ LLGroupData data;
+ if (!gAgent.getGroupData(session_id, data)) break;
+ correct_session_name = data.mName;
+ }
+ else
+ {
+ // *NOTE: really should be using callbacks here
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(caller_id, &av_name))
+ {
+ correct_session_name = av_name.getCompleteName();
+ correct_session_name.append(ADHOC_NAME_SUFFIX);
+ }
+ }
+ LL_INFOS("IMVIEW") << "Corrected session name is " << correct_session_name << LL_ENDL;
+ break;
+ default:
+ LL_WARNS("IMVIEW") << "Received an empty session name from a server and failed to generate a new proper session name" << LL_ENDL;
+ break;
+ }
+ }
+
+ gIMMgr->addSession(correct_session_name, type, session_id, true);
+
+ std::string url = gAgent.getRegion()->getCapability(
+ "ChatSessionRequest");
+
+ if (voice)
+ {
LLCoros::instance().launch("chatterBoxInvitationCoro",
boost::bind(&chatterBoxInvitationCoro, url,
session_id, inv_type));
- // send notification message to the corresponding chat
- if (payload["notify_box_type"].asString() == "VoiceInviteGroup" || payload["notify_box_type"].asString() == "VoiceInviteAdHoc")
- {
- LLStringUtil::format_map_t string_args;
- string_args["[NAME]"] = payload["caller_name"].asString();
- std::string message = LLTrans::getString("name_started_call", string_args);
- LLIMModel::getInstance()->addMessageSilently(session_id, SYSTEM_FROM, LLUUID::null, message);
- }
- }
- }
- if (voice)
- {
- break;
- }
- }
- case 1: // decline
- {
- if (type == IM_SESSION_P2P_INVITE)
- {
- if(LLVoiceClient::getInstance())
- {
- std::string s = payload["session_handle"].asString();
- LLVoiceClient::getInstance()->declineInvite(s);
- }
- }
- else
- {
- std::string url = gAgent.getRegion()->getCapability(
- "ChatSessionRequest");
-
- LLSD data;
- data["method"] = "decline invitation";
- data["session-id"] = session_id;
+ // send notification message to the corresponding chat
+ if (payload["notify_box_type"].asString() == "VoiceInviteGroup" || payload["notify_box_type"].asString() == "VoiceInviteAdHoc")
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[NAME]"] = payload["caller_name"].asString();
+ std::string message = LLTrans::getString("name_started_call", string_args);
+ LLIMModel::getInstance()->addMessageSilently(session_id, SYSTEM_FROM, LLUUID::null, message);
+ }
+ }
+ }
+ if (voice)
+ {
+ break;
+ }
+ }
+ case 1: // decline
+ {
+ if (type == IM_SESSION_P2P_INVITE)
+ {
+ if(LLVoiceClient::getInstance())
+ {
+ std::string s = payload["session_handle"].asString();
+ LLVoiceClient::getInstance()->declineInvite(s);
+ }
+ }
+ else
+ {
+ std::string url = gAgent.getRegion()->getCapability(
+ "ChatSessionRequest");
+
+ LLSD data;
+ data["method"] = "decline invitation";
+ data["session-id"] = session_id;
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data,
"Invitation declined",
"Invitation decline failed.");
- }
- }
+ }
+ }
- gIMMgr->clearPendingAgentListUpdates(session_id);
- gIMMgr->clearPendingInvitation(session_id);
- }
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ gIMMgr->clearPendingInvitation(session_id);
+ }
}
bool inviteUserResponse(const LLSD& notification, const LLSD& response)
{
- if (!gIMMgr)
- return false;
-
- const LLSD& payload = notification["payload"];
- LLUUID session_id = payload["session_id"].asUUID();
- EInstantMessage type = (EInstantMessage)payload["type"].asInteger();
- LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)payload["inv_type"].asInteger();
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch(option)
- {
- case 0: // accept
- {
- if (type == IM_SESSION_P2P_INVITE)
- {
- // create a normal IM session
- session_id = gIMMgr->addP2PSession(
- payload["session_name"].asString(),
- payload["caller_id"].asUUID(),
- payload["session_handle"].asString(),
- payload["session_uri"].asString());
-
- gIMMgr->startCall(session_id);
-
- gIMMgr->clearPendingAgentListUpdates(session_id);
- gIMMgr->clearPendingInvitation(session_id);
- }
- else
- {
- gIMMgr->addSession(
- payload["session_name"].asString(),
- type,
- session_id, true);
-
- std::string url = gAgent.getRegion()->getCapability(
- "ChatSessionRequest");
+ if (!gIMMgr)
+ return false;
+
+ const LLSD& payload = notification["payload"];
+ LLUUID session_id = payload["session_id"].asUUID();
+ EInstantMessage type = (EInstantMessage)payload["type"].asInteger();
+ LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)payload["inv_type"].asInteger();
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case 0: // accept
+ {
+ if (type == IM_SESSION_P2P_INVITE)
+ {
+ // create a normal IM session
+ session_id = gIMMgr->addP2PSession(
+ payload["session_name"].asString(),
+ payload["caller_id"].asUUID(),
+ payload["session_handle"].asString(),
+ payload["session_uri"].asString());
+
+ gIMMgr->startCall(session_id);
+
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ gIMMgr->clearPendingInvitation(session_id);
+ }
+ else
+ {
+ gIMMgr->addSession(
+ payload["session_name"].asString(),
+ type,
+ session_id, true);
+
+ std::string url = gAgent.getRegion()->getCapability(
+ "ChatSessionRequest");
LLCoros::instance().launch("chatterBoxInvitationCoro",
boost::bind(&chatterBoxInvitationCoro, url,
session_id, inv_type));
- }
- }
- break;
- case 2: // mute (also implies ignore, so this falls through to the "ignore" case below)
- {
- // mute the sender of this invite
- if (!LLMuteList::getInstance()->isMuted(payload["caller_id"].asUUID()))
- {
- LLMute mute(payload["caller_id"].asUUID(), payload["caller_name"].asString(), LLMute::AGENT);
- LLMuteList::getInstance()->add(mute);
- }
- }
- /* FALLTHROUGH */
-
- case 1: // decline
- {
- if (type == IM_SESSION_P2P_INVITE)
- {
- std::string s = payload["session_handle"].asString();
- LLVoiceClient::getInstance()->declineInvite(s);
- }
- else
- {
- std::string url = gAgent.getRegion()->getCapability(
- "ChatSessionRequest");
-
- LLSD data;
- data["method"] = "decline invitation";
- data["session-id"] = session_id;
+ }
+ }
+ break;
+ case 2: // mute (also implies ignore, so this falls through to the "ignore" case below)
+ {
+ // mute the sender of this invite
+ if (!LLMuteList::getInstance()->isMuted(payload["caller_id"].asUUID()))
+ {
+ LLMute mute(payload["caller_id"].asUUID(), payload["caller_name"].asString(), LLMute::AGENT);
+ LLMuteList::getInstance()->add(mute);
+ }
+ }
+ /* FALLTHROUGH */
+
+ case 1: // decline
+ {
+ if (type == IM_SESSION_P2P_INVITE)
+ {
+ std::string s = payload["session_handle"].asString();
+ LLVoiceClient::getInstance()->declineInvite(s);
+ }
+ else
+ {
+ std::string url = gAgent.getRegion()->getCapability(
+ "ChatSessionRequest");
+
+ LLSD data;
+ data["method"] = "decline invitation";
+ data["session-id"] = session_id;
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data,
"Invitation declined.",
"Invitation decline failed.");
- }
- }
+ }
+ }
- gIMMgr->clearPendingAgentListUpdates(session_id);
- gIMMgr->clearPendingInvitation(session_id);
- break;
- }
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ gIMMgr->clearPendingInvitation(session_id);
+ break;
+ }
- return false;
+ return false;
}
//
@@ -3051,113 +3051,113 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
LLIMMgr::LLIMMgr()
{
- mPendingInvitations = LLSD::emptyMap();
- mPendingAgentListUpdates = LLSD::emptyMap();
+ mPendingInvitations = LLSD::emptyMap();
+ mPendingAgentListUpdates = LLSD::emptyMap();
- LLIMModel::getInstance()->addNewMsgCallback(boost::bind(&LLFloaterIMSession::sRemoveTypingIndicator, _1));
+ LLIMModel::getInstance()->addNewMsgCallback(boost::bind(&LLFloaterIMSession::sRemoveTypingIndicator, _1));
- gSavedPerAccountSettings.declareBOOL("FetchGroupChatHistory", TRUE, "Fetch recent messages from group chat servers when a group window opens", LLControlVariable::PERSIST_ALWAYS);
+ gSavedPerAccountSettings.declareBOOL("FetchGroupChatHistory", TRUE, "Fetch recent messages from group chat servers when a group window opens", LLControlVariable::PERSIST_ALWAYS);
}
// Add a message to a session.
void LLIMMgr::addMessage(
- const LLUUID& session_id,
- const LLUUID& target_id,
- const std::string& from,
- const std::string& msg,
- bool is_offline_msg,
- const std::string& session_name,
- EInstantMessage dialog,
- U32 parent_estate_id,
- const LLUUID& region_id,
- const LLVector3& position,
+ const LLUUID& session_id,
+ const LLUUID& target_id,
+ const std::string& from,
+ const std::string& msg,
+ bool is_offline_msg,
+ const std::string& session_name,
+ EInstantMessage dialog,
+ U32 parent_estate_id,
+ const LLUUID& region_id,
+ const LLVector3& position,
bool is_region_msg,
U32 timestamp) // May be zero
{
- LLUUID other_participant_id = target_id;
-
- LLUUID new_session_id = session_id;
- if (new_session_id.isNull())
- {
- //no session ID...compute new one
- new_session_id = computeSessionID(dialog, other_participant_id);
- }
-
- //*NOTE session_name is empty in case of incoming P2P sessions
- std::string fixed_session_name = from;
- bool name_is_setted = false;
- if(!session_name.empty() && session_name.size()>1)
- {
- fixed_session_name = session_name;
- name_is_setted = true;
- }
- bool skip_message = false;
- bool from_linden = LLMuteList::isLinden(from);
+ LLUUID other_participant_id = target_id;
+
+ LLUUID new_session_id = session_id;
+ if (new_session_id.isNull())
+ {
+ //no session ID...compute new one
+ new_session_id = computeSessionID(dialog, other_participant_id);
+ }
+
+ //*NOTE session_name is empty in case of incoming P2P sessions
+ std::string fixed_session_name = from;
+ bool name_is_setted = false;
+ if(!session_name.empty() && session_name.size()>1)
+ {
+ fixed_session_name = session_name;
+ name_is_setted = true;
+ }
+ bool skip_message = false;
+ bool from_linden = LLMuteList::isLinden(from);
if (gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly") && !from_linden)
- {
- // Evaluate if we need to skip this message when that setting is true (default is false)
- skip_message = (LLAvatarTracker::instance().getBuddyInfo(other_participant_id) == NULL); // Skip non friends...
- skip_message &= !(other_participant_id == gAgentID); // You are your best friend... Don't skip yourself
- }
-
- bool new_session = !hasSession(new_session_id);
- if (new_session)
- {
- // Group chat session was initiated by muted resident, do not start this session viewerside
- // do not send leave msg either, so we are able to get group messages from other participants
- if ((IM_SESSION_INVITE == dialog) && gAgent.isInGroup(new_session_id) &&
- LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !from_linden)
- {
- return;
- }
-
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(other_participant_id, &av_name) && !name_is_setted)
- {
- fixed_session_name = av_name.getDisplayName();
- }
- LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id, false, is_offline_msg);
-
- LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(new_session_id);
- if (session)
- {
- skip_message &= !session->isGroupSessionType(); // Do not skip group chats...
- if (skip_message)
- {
- gIMMgr->leaveSession(new_session_id);
- }
- // When we get a new IM, and if you are a god, display a bit
- // of information about the source. This is to help liaisons
- // when answering questions.
- if (gAgent.isGodlike())
- {
- // *TODO:translate (low priority, god ability)
- std::ostringstream bonus_info;
- bonus_info << LLTrans::getString("***") + " " + LLTrans::getString("IMParentEstate") + ":" + " "
- << parent_estate_id
- << ((parent_estate_id == 1) ? "," + LLTrans::getString("IMMainland") : "")
- << ((parent_estate_id == 5) ? "," + LLTrans::getString("IMTeen") : "");
-
- // once we have web-services (or something) which returns
- // information about a region id, we can print this out
- // and even have it link to map-teleport or something.
- //<< "*** region_id: " << region_id << std::endl
- //<< "*** position: " << position << std::endl;
-
- LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, bonus_info.str(), true, is_region_msg);
- }
-
- // Logically it would make more sense to reject the session sooner, in another area of the
- // code, but the session has to be established inside the server before it can be left.
- if (LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !from_linden)
- {
- LL_WARNS() << "Leaving IM session from initiating muted resident " << from << LL_ENDL;
- if (!gIMMgr->leaveSession(new_session_id))
- {
- LL_INFOS("IMVIEW") << "Session " << new_session_id << " does not exist." << LL_ENDL;
- }
- return;
- }
+ {
+ // Evaluate if we need to skip this message when that setting is true (default is false)
+ skip_message = (LLAvatarTracker::instance().getBuddyInfo(other_participant_id) == NULL); // Skip non friends...
+ skip_message &= !(other_participant_id == gAgentID); // You are your best friend... Don't skip yourself
+ }
+
+ bool new_session = !hasSession(new_session_id);
+ if (new_session)
+ {
+ // Group chat session was initiated by muted resident, do not start this session viewerside
+ // do not send leave msg either, so we are able to get group messages from other participants
+ if ((IM_SESSION_INVITE == dialog) && gAgent.isInGroup(new_session_id) &&
+ LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !from_linden)
+ {
+ return;
+ }
+
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(other_participant_id, &av_name) && !name_is_setted)
+ {
+ fixed_session_name = av_name.getDisplayName();
+ }
+ LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id, false, is_offline_msg);
+
+ LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(new_session_id);
+ if (session)
+ {
+ skip_message &= !session->isGroupSessionType(); // Do not skip group chats...
+ if (skip_message)
+ {
+ gIMMgr->leaveSession(new_session_id);
+ }
+ // When we get a new IM, and if you are a god, display a bit
+ // of information about the source. This is to help liaisons
+ // when answering questions.
+ if (gAgent.isGodlike())
+ {
+ // *TODO:translate (low priority, god ability)
+ std::ostringstream bonus_info;
+ bonus_info << LLTrans::getString("***") + " " + LLTrans::getString("IMParentEstate") + ":" + " "
+ << parent_estate_id
+ << ((parent_estate_id == 1) ? "," + LLTrans::getString("IMMainland") : "")
+ << ((parent_estate_id == 5) ? "," + LLTrans::getString("IMTeen") : "");
+
+ // once we have web-services (or something) which returns
+ // information about a region id, we can print this out
+ // and even have it link to map-teleport or something.
+ //<< "*** region_id: " << region_id << std::endl
+ //<< "*** position: " << position << std::endl;
+
+ LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, bonus_info.str(), true, is_region_msg);
+ }
+
+ // Logically it would make more sense to reject the session sooner, in another area of the
+ // code, but the session has to be established inside the server before it can be left.
+ if (LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !from_linden)
+ {
+ LL_WARNS() << "Leaving IM session from initiating muted resident " << from << LL_ENDL;
+ if (!gIMMgr->leaveSession(new_session_id))
+ {
+ LL_INFOS("IMVIEW") << "Session " << new_session_id << " does not exist." << LL_ENDL;
+ }
+ return;
+ }
// Fetch group chat history, enabled by default.
if (gSavedPerAccountSettings.getBOOL("FetchGroupChatHistory"))
@@ -3169,131 +3169,131 @@ void LLIMMgr::addMessage(
}
}
- //Play sound for new conversations
- if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation") == TRUE))
- {
- make_ui_sound("UISndNewIncomingIMSession");
- }
- }
- else
- {
- // Failed to create a session, most likely due to empty name (name cache failed?)
- LL_WARNS() << "Failed to create IM session " << fixed_session_name << LL_ENDL;
- }
- }
-
- if (!LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !skip_message)
- {
- LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg, true, is_region_msg, timestamp);
- }
-
- // Open conversation floater if offline messages are present
- if (is_offline_msg && !skip_message)
+ //Play sound for new conversations
+ if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation") == TRUE))
+ {
+ make_ui_sound("UISndNewIncomingIMSession");
+ }
+ }
+ else
+ {
+ // Failed to create a session, most likely due to empty name (name cache failed?)
+ LL_WARNS() << "Failed to create IM session " << fixed_session_name << LL_ENDL;
+ }
+ }
+
+ if (!LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !skip_message)
+ {
+ LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg, true, is_region_msg, timestamp);
+ }
+
+ // Open conversation floater if offline messages are present
+ if (is_offline_msg && !skip_message)
{
LLFloaterReg::showInstance("im_container");
- LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")->
- flashConversationItemWidget(new_session_id, true);
+ LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")->
+ flashConversationItemWidget(new_session_id, true);
}
}
void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args)
{
- LLUIString message;
-
- // null session id means near me (chat history)
- if (session_id.isNull())
- {
- message = LLTrans::getString(message_name);
- message.setArgs(args);
-
- LLChat chat(message);
- chat.mSourceType = CHAT_SOURCE_SYSTEM;
-
- LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if (nearby_chat)
- {
- nearby_chat->addMessage(chat);
- }
- }
- else // going to IM session
- {
- message = LLTrans::getString(message_name + "-im");
- message.setArgs(args);
- if (hasSession(session_id))
- {
- gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString());
- }
- // log message to file
-
- else
- {
- LLAvatarName av_name;
- // since we select user to share item with - his name is already in cache
- LLAvatarNameCache::get(args["user_id"], &av_name);
- std::string session_name = LLCacheName::buildUsername(av_name.getUserName());
- LLIMModel::instance().logToFile(session_name, SYSTEM_FROM, LLUUID::null, message.getString());
- }
- }
+ LLUIString message;
+
+ // null session id means near me (chat history)
+ if (session_id.isNull())
+ {
+ message = LLTrans::getString(message_name);
+ message.setArgs(args);
+
+ LLChat chat(message);
+ chat.mSourceType = CHAT_SOURCE_SYSTEM;
+
+ LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ if (nearby_chat)
+ {
+ nearby_chat->addMessage(chat);
+ }
+ }
+ else // going to IM session
+ {
+ message = LLTrans::getString(message_name + "-im");
+ message.setArgs(args);
+ if (hasSession(session_id))
+ {
+ gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString());
+ }
+ // log message to file
+
+ else
+ {
+ LLAvatarName av_name;
+ // since we select user to share item with - his name is already in cache
+ LLAvatarNameCache::get(args["user_id"], &av_name);
+ std::string session_name = LLCacheName::buildUsername(av_name.getUserName());
+ LLIMModel::instance().logToFile(session_name, SYSTEM_FROM, LLUUID::null, message.getString());
+ }
+ }
}
S32 LLIMMgr::getNumberOfUnreadIM()
{
- std::map<LLUUID, LLIMModel::LLIMSession*>::iterator it;
+ std::map<LLUUID, LLIMModel::LLIMSession*>::iterator it;
- S32 num = 0;
- for(it = LLIMModel::getInstance()->mId2SessionMap.begin(); it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it)
- {
- num += (*it).second->mNumUnread;
- }
+ S32 num = 0;
+ for(it = LLIMModel::getInstance()->mId2SessionMap.begin(); it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it)
+ {
+ num += (*it).second->mNumUnread;
+ }
- return num;
+ return num;
}
S32 LLIMMgr::getNumberOfUnreadParticipantMessages()
{
- std::map<LLUUID, LLIMModel::LLIMSession*>::iterator it;
+ std::map<LLUUID, LLIMModel::LLIMSession*>::iterator it;
- S32 num = 0;
- for(it = LLIMModel::getInstance()->mId2SessionMap.begin(); it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it)
- {
- num += (*it).second->mParticipantUnreadMessageCount;
- }
+ S32 num = 0;
+ for(it = LLIMModel::getInstance()->mId2SessionMap.begin(); it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it)
+ {
+ num += (*it).second->mParticipantUnreadMessageCount;
+ }
- return num;
+ return num;
}
void LLIMMgr::autoStartCallOnStartup(const LLUUID& session_id)
{
- LLIMModel::LLIMSession *session = LLIMModel::getInstance()->findIMSession(session_id);
- if (!session) return;
+ LLIMModel::LLIMSession *session = LLIMModel::getInstance()->findIMSession(session_id);
+ if (!session) return;
- if (session->mSessionInitialized)
- {
- startCall(session_id);
- }
- else
- {
- session->mStartCallOnInitialize = true;
- }
+ if (session->mSessionInitialized)
+ {
+ startCall(session_id);
+ }
+ else
+ {
+ session->mStartCallOnInitialize = true;
+ }
}
LLUUID LLIMMgr::addP2PSession(const std::string& name,
- const LLUUID& other_participant_id,
- const std::string& voice_session_handle,
- const std::string& caller_uri)
+ const LLUUID& other_participant_id,
+ const std::string& voice_session_handle,
+ const std::string& caller_uri)
{
- LLUUID session_id = addSession(name, IM_NOTHING_SPECIAL, other_participant_id, true);
+ LLUUID session_id = addSession(name, IM_NOTHING_SPECIAL, other_participant_id, true);
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
- if (speaker_mgr)
- {
- LLVoiceChannelP2P* voice_channel = dynamic_cast<LLVoiceChannelP2P*>(speaker_mgr->getVoiceChannel());
- if (voice_channel)
- {
- voice_channel->setSessionHandle(voice_session_handle, caller_uri);
- }
- }
- return session_id;
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
+ if (speaker_mgr)
+ {
+ LLVoiceChannelP2P* voice_channel = dynamic_cast<LLVoiceChannelP2P*>(speaker_mgr->getVoiceChannel());
+ if (voice_channel)
+ {
+ voice_channel->setSessionHandle(voice_session_handle, caller_uri);
+ }
+ }
+ return session_id;
}
// This adds a session to the talk view. The name is the local name of
@@ -3301,70 +3301,70 @@ LLUUID LLIMMgr::addP2PSession(const std::string& name,
// exists, it is brought forward. Specifying id = NULL results in an
// im session to everyone. Returns the uuid of the session.
LLUUID LLIMMgr::addSession(
- const std::string& name,
- EInstantMessage dialog,
- const LLUUID& other_participant_id, bool voice)
+ const std::string& name,
+ EInstantMessage dialog,
+ const LLUUID& other_participant_id, bool voice)
{
- std::vector<LLUUID> ids;
- ids.push_back(other_participant_id);
- LLUUID session_id = addSession(name, dialog, other_participant_id, ids, voice);
- return session_id;
+ std::vector<LLUUID> ids;
+ ids.push_back(other_participant_id);
+ LLUUID session_id = addSession(name, dialog, other_participant_id, ids, voice);
+ return session_id;
}
// Adds a session using the given session_id. If the session already exists
// the dialog type is assumed correct. Returns the uuid of the session.
LLUUID LLIMMgr::addSession(
- const std::string& name,
- EInstantMessage dialog,
- const LLUUID& other_participant_id,
- const std::vector<LLUUID>& ids, bool voice,
- const LLUUID& floater_id)
-{
- if (ids.empty())
- {
- return LLUUID::null;
- }
-
- if (name.empty())
- {
- LL_WARNS() << "Session name cannot be null!" << LL_ENDL;
- return LLUUID::null;
- }
-
- LLUUID session_id = computeSessionID(dialog,other_participant_id);
-
- if (floater_id.notNull())
- {
- LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(floater_id);
-
- if (im_floater)
- {
- // The IM floater should be initialized with a new session_id
- // so that it is found by that id when creating a chiclet in LLFloaterIMSession::onIMChicletCreated,
- // and a new floater is not created.
- im_floater->initIMSession(session_id);
+ const std::string& name,
+ EInstantMessage dialog,
+ const LLUUID& other_participant_id,
+ const std::vector<LLUUID>& ids, bool voice,
+ const LLUUID& floater_id)
+{
+ if (ids.empty())
+ {
+ return LLUUID::null;
+ }
+
+ if (name.empty())
+ {
+ LL_WARNS() << "Session name cannot be null!" << LL_ENDL;
+ return LLUUID::null;
+ }
+
+ LLUUID session_id = computeSessionID(dialog,other_participant_id);
+
+ if (floater_id.notNull())
+ {
+ LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(floater_id);
+
+ if (im_floater)
+ {
+ // The IM floater should be initialized with a new session_id
+ // so that it is found by that id when creating a chiclet in LLFloaterIMSession::onIMChicletCreated,
+ // and a new floater is not created.
+ im_floater->initIMSession(session_id);
im_floater->reloadMessages();
- }
- }
-
- bool new_session = (LLIMModel::getInstance()->findIMSession(session_id) == NULL);
-
- //works only for outgoing ad-hoc sessions
- if (new_session && IM_SESSION_CONFERENCE_START == dialog && ids.size())
- {
- LLIMModel::LLIMSession* ad_hoc_found = LLIMModel::getInstance()->findAdHocIMSession(ids);
- if (ad_hoc_found)
- {
- new_session = false;
- session_id = ad_hoc_found->mSessionID;
- }
- }
+ }
+ }
+
+ bool new_session = (LLIMModel::getInstance()->findIMSession(session_id) == NULL);
+
+ //works only for outgoing ad-hoc sessions
+ if (new_session && IM_SESSION_CONFERENCE_START == dialog && ids.size())
+ {
+ LLIMModel::LLIMSession* ad_hoc_found = LLIMModel::getInstance()->findAdHocIMSession(ids);
+ if (ad_hoc_found)
+ {
+ new_session = false;
+ session_id = ad_hoc_found->mSessionID;
+ }
+ }
//Notify observers that a session was added
- if (new_session)
- {
- LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids, voice);
- }
+ if (new_session)
+ {
+ LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids, voice);
+ }
//Notifies observers that the session was already added
else
{
@@ -3372,334 +3372,334 @@ LLUUID LLIMMgr::addSession(
LLIMMgr::getInstance()->notifyObserverSessionActivated(session_id, session_name, other_participant_id);
}
- //we don't need to show notes about online/offline, mute/unmute users' statuses for existing sessions
- if (!new_session) return session_id;
+ //we don't need to show notes about online/offline, mute/unmute users' statuses for existing sessions
+ if (!new_session) return session_id;
LL_INFOS("IMVIEW") << "LLIMMgr::addSession, new session added, name = " << name << ", session id = " << session_id << LL_ENDL;
- //Per Plan's suggestion commented "explicit offline status warning" out to make Dessie happier (see EXT-3609)
- //*TODO After February 2010 remove this commented out line if no one will be missing that warning
- //noteOfflineUsers(session_id, floater, ids);
+ //Per Plan's suggestion commented "explicit offline status warning" out to make Dessie happier (see EXT-3609)
+ //*TODO After February 2010 remove this commented out line if no one will be missing that warning
+ //noteOfflineUsers(session_id, floater, ids);
- // Only warn for regular IMs - not group IMs
- if( dialog == IM_NOTHING_SPECIAL )
- {
- noteMutedUsers(session_id, ids);
- }
+ // Only warn for regular IMs - not group IMs
+ if( dialog == IM_NOTHING_SPECIAL )
+ {
+ noteMutedUsers(session_id, ids);
+ }
- notifyObserverSessionVoiceOrIMStarted(session_id);
+ notifyObserverSessionVoiceOrIMStarted(session_id);
- return session_id;
+ return session_id;
}
bool LLIMMgr::leaveSession(const LLUUID& session_id)
{
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
- if (!im_session) return false;
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
+ if (!im_session) return false;
- LLIMModel::getInstance()->sendLeaveSession(session_id, im_session->mOtherParticipantID);
- gIMMgr->removeSession(session_id);
- return true;
+ LLIMModel::getInstance()->sendLeaveSession(session_id, im_session->mOtherParticipantID);
+ gIMMgr->removeSession(session_id);
+ return true;
}
// Removes data associated with a particular session specified by session_id
void LLIMMgr::removeSession(const LLUUID& session_id)
{
- llassert_always(hasSession(session_id));
+ llassert_always(hasSession(session_id));
- clearPendingInvitation(session_id);
- clearPendingAgentListUpdates(session_id);
+ clearPendingInvitation(session_id);
+ clearPendingAgentListUpdates(session_id);
- LLIMModel::getInstance()->clearSession(session_id);
+ LLIMModel::getInstance()->clearSession(session_id);
LL_INFOS("IMVIEW") << "LLIMMgr::removeSession, session removed, session id = " << session_id << LL_ENDL;
- notifyObserverSessionRemoved(session_id);
+ notifyObserverSessionRemoved(session_id);
}
void LLIMMgr::inviteToSession(
- const LLUUID& session_id,
- const std::string& session_name,
- const LLUUID& caller_id,
- const std::string& caller_name,
- EInstantMessage type,
- EInvitationType inv_type,
- const std::string& session_handle,
- const std::string& session_uri)
-{
- std::string notify_box_type;
- // voice invite question is different from default only for group call (EXT-7118)
- std::string question_type = "VoiceInviteQuestionDefault";
-
- BOOL voice_invite = FALSE;
- bool is_linden = LLMuteList::isLinden(caller_name);
-
-
- if(type == IM_SESSION_P2P_INVITE)
- {
- //P2P is different...they only have voice invitations
- notify_box_type = "VoiceInviteP2P";
- voice_invite = TRUE;
- }
- else if ( gAgent.isInGroup(session_id, TRUE) )
- {
- //only really old school groups have voice invitations
- notify_box_type = "VoiceInviteGroup";
- question_type = "VoiceInviteQuestionGroup";
- voice_invite = TRUE;
- }
- else if ( inv_type == INVITATION_TYPE_VOICE )
- {
- //else it's an ad-hoc
- //and a voice ad-hoc
- notify_box_type = "VoiceInviteAdHoc";
- voice_invite = TRUE;
- }
- else if ( inv_type == INVITATION_TYPE_IMMEDIATE )
- {
- notify_box_type = "InviteAdHoc";
- }
-
- LLSD payload;
- payload["session_id"] = session_id;
- payload["session_name"] = session_name;
- payload["caller_id"] = caller_id;
- payload["caller_name"] = caller_name;
- payload["type"] = type;
- payload["inv_type"] = inv_type;
- payload["session_handle"] = session_handle;
- payload["session_uri"] = session_uri;
- payload["notify_box_type"] = notify_box_type;
- payload["question_type"] = question_type;
-
- //ignore invites from muted residents
- if (!is_linden)
- {
- if (LLMuteList::getInstance()->isMuted(caller_id, LLMute::flagVoiceChat)
- && voice_invite && "VoiceInviteQuestionDefault" == question_type)
- {
- LL_INFOS("IMVIEW") << "Rejecting voice call from initiating muted resident " << caller_name << LL_ENDL;
- LLIncomingCallDialog::processCallResponse(1, payload);
- return;
- }
- else if (LLMuteList::getInstance()->isMuted(caller_id, LLMute::flagAll & ~LLMute::flagVoiceChat) && !voice_invite)
- {
- LL_INFOS("IMVIEW") << "Rejecting session invite from initiating muted resident " << caller_name << LL_ENDL;
- return;
- }
- }
-
- LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id);
- if (channelp && channelp->callStarted())
- {
- // you have already started a call to the other user, so just accept the invite
- LLIncomingCallDialog::processCallResponse(0, payload);
- return;
- }
-
- if (voice_invite)
- {
- bool isRejectGroupCall = (gSavedSettings.getBOOL("VoiceCallsRejectGroup") && (notify_box_type == "VoiceInviteGroup"));
+ const LLUUID& session_id,
+ const std::string& session_name,
+ const LLUUID& caller_id,
+ const std::string& caller_name,
+ EInstantMessage type,
+ EInvitationType inv_type,
+ const std::string& session_handle,
+ const std::string& session_uri)
+{
+ std::string notify_box_type;
+ // voice invite question is different from default only for group call (EXT-7118)
+ std::string question_type = "VoiceInviteQuestionDefault";
+
+ BOOL voice_invite = FALSE;
+ bool is_linden = LLMuteList::isLinden(caller_name);
+
+
+ if(type == IM_SESSION_P2P_INVITE)
+ {
+ //P2P is different...they only have voice invitations
+ notify_box_type = "VoiceInviteP2P";
+ voice_invite = TRUE;
+ }
+ else if ( gAgent.isInGroup(session_id, TRUE) )
+ {
+ //only really old school groups have voice invitations
+ notify_box_type = "VoiceInviteGroup";
+ question_type = "VoiceInviteQuestionGroup";
+ voice_invite = TRUE;
+ }
+ else if ( inv_type == INVITATION_TYPE_VOICE )
+ {
+ //else it's an ad-hoc
+ //and a voice ad-hoc
+ notify_box_type = "VoiceInviteAdHoc";
+ voice_invite = TRUE;
+ }
+ else if ( inv_type == INVITATION_TYPE_IMMEDIATE )
+ {
+ notify_box_type = "InviteAdHoc";
+ }
+
+ LLSD payload;
+ payload["session_id"] = session_id;
+ payload["session_name"] = session_name;
+ payload["caller_id"] = caller_id;
+ payload["caller_name"] = caller_name;
+ payload["type"] = type;
+ payload["inv_type"] = inv_type;
+ payload["session_handle"] = session_handle;
+ payload["session_uri"] = session_uri;
+ payload["notify_box_type"] = notify_box_type;
+ payload["question_type"] = question_type;
+
+ //ignore invites from muted residents
+ if (!is_linden)
+ {
+ if (LLMuteList::getInstance()->isMuted(caller_id, LLMute::flagVoiceChat)
+ && voice_invite && "VoiceInviteQuestionDefault" == question_type)
+ {
+ LL_INFOS("IMVIEW") << "Rejecting voice call from initiating muted resident " << caller_name << LL_ENDL;
+ LLIncomingCallDialog::processCallResponse(1, payload);
+ return;
+ }
+ else if (LLMuteList::getInstance()->isMuted(caller_id, LLMute::flagAll & ~LLMute::flagVoiceChat) && !voice_invite)
+ {
+ LL_INFOS("IMVIEW") << "Rejecting session invite from initiating muted resident " << caller_name << LL_ENDL;
+ return;
+ }
+ }
+
+ LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id);
+ if (channelp && channelp->callStarted())
+ {
+ // you have already started a call to the other user, so just accept the invite
+ LLIncomingCallDialog::processCallResponse(0, payload);
+ return;
+ }
+
+ if (voice_invite)
+ {
+ bool isRejectGroupCall = (gSavedSettings.getBOOL("VoiceCallsRejectGroup") && (notify_box_type == "VoiceInviteGroup"));
bool isRejectNonFriendCall = (gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL));
- if (isRejectGroupCall || isRejectNonFriendCall || gAgent.isDoNotDisturb())
- {
- if (gAgent.isDoNotDisturb() && !isRejectGroupCall && !isRejectNonFriendCall)
- {
- if (!hasSession(session_id) && (type == IM_SESSION_P2P_INVITE))
- {
- std::string fixed_session_name = caller_name;
- if(!session_name.empty() && session_name.size()>1)
- {
- fixed_session_name = session_name;
- }
- else
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(caller_id, &av_name))
- {
- fixed_session_name = av_name.getDisplayName();
- }
- }
- LLIMModel::getInstance()->newSession(session_id, fixed_session_name, IM_NOTHING_SPECIAL, caller_id, false, false);
- }
-
- LLSD args;
- addSystemMessage(session_id, "you_auto_rejected_call", args);
- send_do_not_disturb_message(gMessageSystem, caller_id, session_id);
- }
- // silently decline the call
- LLIncomingCallDialog::processCallResponse(1, payload);
- return;
- }
- }
-
- if ( !mPendingInvitations.has(session_id.asString()) )
- {
- if (caller_name.empty())
- {
- LLAvatarNameCache::get(caller_id,
- boost::bind(&LLIMMgr::onInviteNameLookup, payload, _1, _2));
- }
- else
- {
- LLFloaterReg::showInstance("incoming_call", payload, FALSE);
- }
-
- // Add the caller to the Recent List here (at this point
- // "incoming_call" floater is shown and the recipient can
- // reject the call), because even if a recipient will reject
- // the call, the caller should be added to the recent list
- // anyway. STORM-507.
- if(type == IM_SESSION_P2P_INVITE)
- LLRecentPeople::instance().add(caller_id);
-
- mPendingInvitations[session_id.asString()] = LLSD();
- }
+ if (isRejectGroupCall || isRejectNonFriendCall || gAgent.isDoNotDisturb())
+ {
+ if (gAgent.isDoNotDisturb() && !isRejectGroupCall && !isRejectNonFriendCall)
+ {
+ if (!hasSession(session_id) && (type == IM_SESSION_P2P_INVITE))
+ {
+ std::string fixed_session_name = caller_name;
+ if(!session_name.empty() && session_name.size()>1)
+ {
+ fixed_session_name = session_name;
+ }
+ else
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(caller_id, &av_name))
+ {
+ fixed_session_name = av_name.getDisplayName();
+ }
+ }
+ LLIMModel::getInstance()->newSession(session_id, fixed_session_name, IM_NOTHING_SPECIAL, caller_id, false, false);
+ }
+
+ LLSD args;
+ addSystemMessage(session_id, "you_auto_rejected_call", args);
+ send_do_not_disturb_message(gMessageSystem, caller_id, session_id);
+ }
+ // silently decline the call
+ LLIncomingCallDialog::processCallResponse(1, payload);
+ return;
+ }
+ }
+
+ if ( !mPendingInvitations.has(session_id.asString()) )
+ {
+ if (caller_name.empty())
+ {
+ LLAvatarNameCache::get(caller_id,
+ boost::bind(&LLIMMgr::onInviteNameLookup, payload, _1, _2));
+ }
+ else
+ {
+ LLFloaterReg::showInstance("incoming_call", payload, FALSE);
+ }
+
+ // Add the caller to the Recent List here (at this point
+ // "incoming_call" floater is shown and the recipient can
+ // reject the call), because even if a recipient will reject
+ // the call, the caller should be added to the recent list
+ // anyway. STORM-507.
+ if(type == IM_SESSION_P2P_INVITE)
+ LLRecentPeople::instance().add(caller_id);
+
+ mPendingInvitations[session_id.asString()] = LLSD();
+ }
}
void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const LLAvatarName& av_name)
{
- payload["caller_name"] = av_name.getUserName();
- payload["session_name"] = payload["caller_name"].asString();
+ payload["caller_name"] = av_name.getUserName();
+ payload["session_name"] = payload["caller_name"].asString();
- std::string notify_box_type = payload["notify_box_type"].asString();
+ std::string notify_box_type = payload["notify_box_type"].asString();
- LLFloaterReg::showInstance("incoming_call", payload, FALSE);
+ LLFloaterReg::showInstance("incoming_call", payload, FALSE);
}
//*TODO disconnects all sessions
void LLIMMgr::disconnectAllSessions()
{
- //*TODO disconnects all IM sessions
+ //*TODO disconnects all IM sessions
}
BOOL LLIMMgr::hasSession(const LLUUID& session_id)
{
- return LLIMModel::getInstance()->findIMSession(session_id) != NULL;
+ return LLIMModel::getInstance()->findIMSession(session_id) != NULL;
}
void LLIMMgr::clearPendingInvitation(const LLUUID& session_id)
{
- if ( mPendingInvitations.has(session_id.asString()) )
- {
- mPendingInvitations.erase(session_id.asString());
- }
+ if ( mPendingInvitations.has(session_id.asString()) )
+ {
+ mPendingInvitations.erase(session_id.asString());
+ }
}
void LLIMMgr::processAgentListUpdates(const LLUUID& session_id, const LLSD& body)
{
- LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
- if ( im_floater )
- {
- im_floater->processAgentListUpdates(body);
- }
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
- if (speaker_mgr)
- {
- speaker_mgr->updateSpeakers(body);
-
- // also the same call is added into LLVoiceClient::participantUpdatedEvent because
- // sometimes it is called AFTER LLViewerChatterBoxSessionAgentListUpdates::post()
- // when moderation state changed too late. See EXT-3544.
- speaker_mgr->update(true);
- }
- else
- {
- //we don't have a speaker manager yet..something went wrong
- //we are probably receiving an update here before
- //a start or an acceptance of an invitation. Race condition.
- gIMMgr->addPendingAgentListUpdates(
- session_id,
- body);
- }
+ LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
+ if ( im_floater )
+ {
+ im_floater->processAgentListUpdates(body);
+ }
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
+ if (speaker_mgr)
+ {
+ speaker_mgr->updateSpeakers(body);
+
+ // also the same call is added into LLVoiceClient::participantUpdatedEvent because
+ // sometimes it is called AFTER LLViewerChatterBoxSessionAgentListUpdates::post()
+ // when moderation state changed too late. See EXT-3544.
+ speaker_mgr->update(true);
+ }
+ else
+ {
+ //we don't have a speaker manager yet..something went wrong
+ //we are probably receiving an update here before
+ //a start or an acceptance of an invitation. Race condition.
+ gIMMgr->addPendingAgentListUpdates(
+ session_id,
+ body);
+ }
}
LLSD LLIMMgr::getPendingAgentListUpdates(const LLUUID& session_id)
{
- if ( mPendingAgentListUpdates.has(session_id.asString()) )
- {
- return mPendingAgentListUpdates[session_id.asString()];
- }
- else
- {
- return LLSD();
- }
+ if ( mPendingAgentListUpdates.has(session_id.asString()) )
+ {
+ return mPendingAgentListUpdates[session_id.asString()];
+ }
+ else
+ {
+ return LLSD();
+ }
}
void LLIMMgr::addPendingAgentListUpdates(
- const LLUUID& session_id,
- const LLSD& updates)
-{
- LLSD::map_const_iterator iter;
-
- if ( !mPendingAgentListUpdates.has(session_id.asString()) )
- {
- //this is a new agent list update for this session
- mPendingAgentListUpdates[session_id.asString()] = LLSD::emptyMap();
- }
-
- if (
- updates.has("agent_updates") &&
- updates["agent_updates"].isMap() &&
- updates.has("updates") &&
- updates["updates"].isMap() )
- {
- //new school update
- LLSD update_types = LLSD::emptyArray();
- LLSD::array_iterator array_iter;
-
- update_types.append("agent_updates");
- update_types.append("updates");
-
- for (
- array_iter = update_types.beginArray();
- array_iter != update_types.endArray();
- ++array_iter)
- {
- //we only want to include the last update for a given agent
- for (
- iter = updates[array_iter->asString()].beginMap();
- iter != updates[array_iter->asString()].endMap();
- ++iter)
- {
- mPendingAgentListUpdates[session_id.asString()][array_iter->asString()][iter->first] =
- iter->second;
- }
- }
- }
- else if (
- updates.has("updates") &&
- updates["updates"].isMap() )
- {
- //old school update where the SD contained just mappings
- //of agent_id -> "LEAVE"/"ENTER"
-
- //only want to keep last update for each agent
- for (
- iter = updates["updates"].beginMap();
- iter != updates["updates"].endMap();
- ++iter)
- {
- mPendingAgentListUpdates[session_id.asString()]["updates"][iter->first] =
- iter->second;
- }
- }
+ const LLUUID& session_id,
+ const LLSD& updates)
+{
+ LLSD::map_const_iterator iter;
+
+ if ( !mPendingAgentListUpdates.has(session_id.asString()) )
+ {
+ //this is a new agent list update for this session
+ mPendingAgentListUpdates[session_id.asString()] = LLSD::emptyMap();
+ }
+
+ if (
+ updates.has("agent_updates") &&
+ updates["agent_updates"].isMap() &&
+ updates.has("updates") &&
+ updates["updates"].isMap() )
+ {
+ //new school update
+ LLSD update_types = LLSD::emptyArray();
+ LLSD::array_iterator array_iter;
+
+ update_types.append("agent_updates");
+ update_types.append("updates");
+
+ for (
+ array_iter = update_types.beginArray();
+ array_iter != update_types.endArray();
+ ++array_iter)
+ {
+ //we only want to include the last update for a given agent
+ for (
+ iter = updates[array_iter->asString()].beginMap();
+ iter != updates[array_iter->asString()].endMap();
+ ++iter)
+ {
+ mPendingAgentListUpdates[session_id.asString()][array_iter->asString()][iter->first] =
+ iter->second;
+ }
+ }
+ }
+ else if (
+ updates.has("updates") &&
+ updates["updates"].isMap() )
+ {
+ //old school update where the SD contained just mappings
+ //of agent_id -> "LEAVE"/"ENTER"
+
+ //only want to keep last update for each agent
+ for (
+ iter = updates["updates"].beginMap();
+ iter != updates["updates"].endMap();
+ ++iter)
+ {
+ mPendingAgentListUpdates[session_id.asString()]["updates"][iter->first] =
+ iter->second;
+ }
+ }
}
void LLIMMgr::clearPendingAgentListUpdates(const LLUUID& session_id)
{
- if ( mPendingAgentListUpdates.has(session_id.asString()) )
- {
- mPendingAgentListUpdates.erase(session_id.asString());
- }
+ if ( mPendingAgentListUpdates.has(session_id.asString()) )
+ {
+ mPendingAgentListUpdates.erase(session_id.asString());
+ }
}
void LLIMMgr::notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg)
{
- for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++)
- {
- (*it)->sessionAdded(session_id, name, other_participant_id, has_offline_msg);
- }
+ for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++)
+ {
+ (*it)->sessionAdded(session_id, name, other_participant_id, has_offline_msg);
+ }
}
void LLIMMgr::notifyObserverSessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id)
@@ -3712,239 +3712,239 @@ void LLIMMgr::notifyObserverSessionActivated(const LLUUID& session_id, const std
void LLIMMgr::notifyObserverSessionVoiceOrIMStarted(const LLUUID& session_id)
{
- for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++)
- {
- (*it)->sessionVoiceOrIMStarted(session_id);
- }
+ for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++)
+ {
+ (*it)->sessionVoiceOrIMStarted(session_id);
+ }
}
void LLIMMgr::notifyObserverSessionRemoved(const LLUUID& session_id)
{
- for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++)
- {
- (*it)->sessionRemoved(session_id);
- }
+ for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++)
+ {
+ (*it)->sessionRemoved(session_id);
+ }
}
void LLIMMgr::notifyObserverSessionIDUpdated( const LLUUID& old_session_id, const LLUUID& new_session_id )
{
- for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++)
- {
- (*it)->sessionIDUpdated(old_session_id, new_session_id);
- }
+ for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++)
+ {
+ (*it)->sessionIDUpdated(old_session_id, new_session_id);
+ }
}
void LLIMMgr::addSessionObserver(LLIMSessionObserver *observer)
{
- mSessionObservers.push_back(observer);
+ mSessionObservers.push_back(observer);
}
void LLIMMgr::removeSessionObserver(LLIMSessionObserver *observer)
{
- mSessionObservers.remove(observer);
+ mSessionObservers.remove(observer);
}
bool LLIMMgr::startCall(const LLUUID& session_id, LLVoiceChannel::EDirection direction)
{
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id);
- if (!voice_channel) return false;
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id);
+ if (!voice_channel) return false;
- voice_channel->setCallDirection(direction);
- voice_channel->activate();
- return true;
+ voice_channel->setCallDirection(direction);
+ voice_channel->activate();
+ return true;
}
bool LLIMMgr::endCall(const LLUUID& session_id)
{
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id);
- if (!voice_channel) return false;
+ LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id);
+ if (!voice_channel) return false;
- voice_channel->deactivate();
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
- if (im_session)
- {
- // need to update speakers' state
- im_session->mSpeakers->update(FALSE);
- }
- return true;
+ voice_channel->deactivate();
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
+ if (im_session)
+ {
+ // need to update speakers' state
+ im_session->mSpeakers->update(FALSE);
+ }
+ return true;
}
bool LLIMMgr::isVoiceCall(const LLUUID& session_id)
{
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
- if (!im_session) return false;
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
+ if (!im_session) return false;
- return im_session->mStartedAsIMCall;
+ return im_session->mStartedAsIMCall;
}
void LLIMMgr::updateDNDMessageStatus()
{
- if (LLIMModel::getInstance()->mId2SessionMap.empty()) return;
+ if (LLIMModel::getInstance()->mId2SessionMap.empty()) return;
- std::map<LLUUID, LLIMModel::LLIMSession*>::const_iterator it = LLIMModel::getInstance()->mId2SessionMap.begin();
- for (; it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it)
- {
- LLIMModel::LLIMSession* session = (*it).second;
+ std::map<LLUUID, LLIMModel::LLIMSession*>::const_iterator it = LLIMModel::getInstance()->mId2SessionMap.begin();
+ for (; it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it)
+ {
+ LLIMModel::LLIMSession* session = (*it).second;
- if (session->isP2P())
- {
- setDNDMessageSent(session->mSessionID,false);
- }
- }
+ if (session->isP2P())
+ {
+ setDNDMessageSent(session->mSessionID,false);
+ }
+ }
}
bool LLIMMgr::isDNDMessageSend(const LLUUID& session_id)
{
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
- if (!im_session) return false;
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
+ if (!im_session) return false;
- return im_session->mIsDNDsend;
+ return im_session->mIsDNDsend;
}
void LLIMMgr::setDNDMessageSent(const LLUUID& session_id, bool is_send)
{
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
- if (!im_session) return;
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
+ if (!im_session) return;
- im_session->mIsDNDsend = is_send;
+ im_session->mIsDNDsend = is_send;
}
void LLIMMgr::addNotifiedNonFriendSessionID(const LLUUID& session_id)
{
- mNotifiedNonFriendSessions.insert(session_id);
+ mNotifiedNonFriendSessions.insert(session_id);
}
bool LLIMMgr::isNonFriendSessionNotified(const LLUUID& session_id)
{
- return mNotifiedNonFriendSessions.end() != mNotifiedNonFriendSessions.find(session_id);
+ return mNotifiedNonFriendSessions.end() != mNotifiedNonFriendSessions.find(session_id);
}
void LLIMMgr::noteOfflineUsers(
- const LLUUID& session_id,
- const std::vector<LLUUID>& ids)
-{
- S32 count = ids.size();
- if(count == 0)
- {
- const std::string& only_user = LLTrans::getString("only_user_message");
- LLIMModel::getInstance()->addMessage(session_id, SYSTEM_FROM, LLUUID::null, only_user);
- }
- else
- {
- const LLRelationship* info = NULL;
- LLAvatarTracker& at = LLAvatarTracker::instance();
- LLIMModel& im_model = LLIMModel::instance();
- for(S32 i = 0; i < count; ++i)
- {
- info = at.getBuddyInfo(ids.at(i));
- LLAvatarName av_name;
- if (info
- && !info->isOnline()
- && LLAvatarNameCache::get(ids.at(i), &av_name))
- {
- LLUIString offline = LLTrans::getString("offline_message");
- // Use display name only because this user is your friend
- offline.setArg("[NAME]", av_name.getDisplayName());
- im_model.proccessOnlineOfflineNotification(session_id, offline);
- }
- }
- }
+ const LLUUID& session_id,
+ const std::vector<LLUUID>& ids)
+{
+ S32 count = ids.size();
+ if(count == 0)
+ {
+ const std::string& only_user = LLTrans::getString("only_user_message");
+ LLIMModel::getInstance()->addMessage(session_id, SYSTEM_FROM, LLUUID::null, only_user);
+ }
+ else
+ {
+ const LLRelationship* info = NULL;
+ LLAvatarTracker& at = LLAvatarTracker::instance();
+ LLIMModel& im_model = LLIMModel::instance();
+ for(S32 i = 0; i < count; ++i)
+ {
+ info = at.getBuddyInfo(ids.at(i));
+ LLAvatarName av_name;
+ if (info
+ && !info->isOnline()
+ && LLAvatarNameCache::get(ids.at(i), &av_name))
+ {
+ LLUIString offline = LLTrans::getString("offline_message");
+ // Use display name only because this user is your friend
+ offline.setArg("[NAME]", av_name.getDisplayName());
+ im_model.proccessOnlineOfflineNotification(session_id, offline);
+ }
+ }
+ }
}
void LLIMMgr::noteMutedUsers(const LLUUID& session_id,
- const std::vector<LLUUID>& ids)
+ const std::vector<LLUUID>& ids)
{
- // Don't do this if we don't have a mute list.
- LLMuteList *ml = LLMuteList::getInstance();
- if( !ml )
- {
- return;
- }
+ // Don't do this if we don't have a mute list.
+ LLMuteList *ml = LLMuteList::getInstance();
+ if( !ml )
+ {
+ return;
+ }
- S32 count = ids.size();
- if(count > 0)
- {
- LLIMModel* im_model = LLIMModel::getInstance();
+ S32 count = ids.size();
+ if(count > 0)
+ {
+ LLIMModel* im_model = LLIMModel::getInstance();
- for(S32 i = 0; i < count; ++i)
- {
- if( ml->isMuted(ids.at(i)) )
- {
- LLUIString muted = LLTrans::getString("muted_message");
+ for(S32 i = 0; i < count; ++i)
+ {
+ if( ml->isMuted(ids.at(i)) )
+ {
+ LLUIString muted = LLTrans::getString("muted_message");
- im_model->addMessage(session_id, SYSTEM_FROM, LLUUID::null, muted);
- break;
- }
- }
- }
+ im_model->addMessage(session_id, SYSTEM_FROM, LLUUID::null, muted);
+ break;
+ }
+ }
+ }
}
void LLIMMgr::processIMTypingStart(const LLUUID& from_id, const EInstantMessage im_type)
{
- processIMTypingCore(from_id, im_type, TRUE);
+ processIMTypingCore(from_id, im_type, TRUE);
}
void LLIMMgr::processIMTypingStop(const LLUUID& from_id, const EInstantMessage im_type)
{
- processIMTypingCore(from_id, im_type, FALSE);
+ processIMTypingCore(from_id, im_type, FALSE);
}
void LLIMMgr::processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing)
{
- LLUUID session_id = computeSessionID(im_type, from_id);
- LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
- if ( im_floater )
- {
- im_floater->processIMTyping(from_id, typing);
- }
+ LLUUID session_id = computeSessionID(im_type, from_id);
+ LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
+ if ( im_floater )
+ {
+ im_floater->processIMTyping(from_id, typing);
+ }
}
class LLViewerChatterBoxSessionStartReply : public LLHTTPNode
{
public:
- virtual void describe(Description& desc) const
- {
- desc.shortInfo("Used for receiving a reply to a request to initialize an ChatterBox session");
- desc.postAPI();
- desc.input(
- "{\"client_session_id\": UUID, \"session_id\": UUID, \"success\" boolean, \"reason\": string");
- desc.source(__FILE__, __LINE__);
- }
-
- virtual void post(ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- LLSD body;
- LLUUID temp_session_id;
- LLUUID session_id;
- bool success;
-
- body = input["body"];
- success = body["success"].asBoolean();
- temp_session_id = body["temp_session_id"].asUUID();
-
- if ( success )
- {
- session_id = body["session_id"].asUUID();
-
- LLIMModel::getInstance()->processSessionInitializedReply(temp_session_id, session_id);
-
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
- if (speaker_mgr)
- {
- speaker_mgr->setSpeakers(body);
- speaker_mgr->updateSpeakers(gIMMgr->getPendingAgentListUpdates(session_id));
- }
-
- LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
- if ( im_floater )
- {
- if ( body.has("session_info") )
- {
- im_floater->processSessionUpdate(body["session_info"]);
+ virtual void describe(Description& desc) const
+ {
+ desc.shortInfo("Used for receiving a reply to a request to initialize an ChatterBox session");
+ desc.postAPI();
+ desc.input(
+ "{\"client_session_id\": UUID, \"session_id\": UUID, \"success\" boolean, \"reason\": string");
+ desc.source(__FILE__, __LINE__);
+ }
+
+ virtual void post(ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LLSD body;
+ LLUUID temp_session_id;
+ LLUUID session_id;
+ bool success;
+
+ body = input["body"];
+ success = body["success"].asBoolean();
+ temp_session_id = body["temp_session_id"].asUUID();
+
+ if ( success )
+ {
+ session_id = body["session_id"].asUUID();
+
+ LLIMModel::getInstance()->processSessionInitializedReply(temp_session_id, session_id);
+
+ LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
+ if (speaker_mgr)
+ {
+ speaker_mgr->setSpeakers(body);
+ speaker_mgr->updateSpeakers(gIMMgr->getPendingAgentListUpdates(session_id));
+ }
+
+ LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
+ if ( im_floater )
+ {
+ if ( body.has("session_info") )
+ {
+ im_floater->processSessionUpdate(body["session_info"]);
// Send request for chat history, if enabled.
if (gSavedPerAccountSettings.getBOOL("FetchGroupChatHistory"))
@@ -3954,104 +3954,104 @@ public:
boost::bind(&chatterBoxHistoryCoro, url, session_id, "", "", 0));
}
}
- }
-
- gIMMgr->clearPendingAgentListUpdates(session_id);
- }
- else
- {
- //throw an error dialog and close the temp session's floater
- gIMMgr->showSessionStartError(body["error"].asString(), temp_session_id);
- }
-
- gIMMgr->clearPendingAgentListUpdates(session_id);
- }
+ }
+
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ }
+ else
+ {
+ //throw an error dialog and close the temp session's floater
+ gIMMgr->showSessionStartError(body["error"].asString(), temp_session_id);
+ }
+
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ }
};
class LLViewerChatterBoxSessionEventReply : public LLHTTPNode
{
public:
- virtual void describe(Description& desc) const
- {
- desc.shortInfo("Used for receiving a reply to a ChatterBox session event");
- desc.postAPI();
- desc.input(
- "{\"event\": string, \"reason\": string, \"success\": boolean, \"session_id\": UUID");
- desc.source(__FILE__, __LINE__);
- }
-
- virtual void post(ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- LLUUID session_id;
- bool success;
-
- LLSD body = input["body"];
- success = body["success"].asBoolean();
- session_id = body["session_id"].asUUID();
-
- if ( !success )
- {
- //throw an error dialog
- gIMMgr->showSessionEventError(
- body["event"].asString(),
- body["error"].asString(),
- session_id);
- }
- }
+ virtual void describe(Description& desc) const
+ {
+ desc.shortInfo("Used for receiving a reply to a ChatterBox session event");
+ desc.postAPI();
+ desc.input(
+ "{\"event\": string, \"reason\": string, \"success\": boolean, \"session_id\": UUID");
+ desc.source(__FILE__, __LINE__);
+ }
+
+ virtual void post(ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LLUUID session_id;
+ bool success;
+
+ LLSD body = input["body"];
+ success = body["success"].asBoolean();
+ session_id = body["session_id"].asUUID();
+
+ if ( !success )
+ {
+ //throw an error dialog
+ gIMMgr->showSessionEventError(
+ body["event"].asString(),
+ body["error"].asString(),
+ session_id);
+ }
+ }
};
class LLViewerForceCloseChatterBoxSession: public LLHTTPNode
{
public:
- virtual void post(ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- LLUUID session_id;
- std::string reason;
-
- session_id = input["body"]["session_id"].asUUID();
- reason = input["body"]["reason"].asString();
-
- gIMMgr->showSessionForceClose(reason, session_id);
- }
+ virtual void post(ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LLUUID session_id;
+ std::string reason;
+
+ session_id = input["body"]["session_id"].asUUID();
+ reason = input["body"]["reason"].asString();
+
+ gIMMgr->showSessionForceClose(reason, session_id);
+ }
};
class LLViewerChatterBoxSessionAgentListUpdates : public LLHTTPNode
{
public:
- virtual void post(
- ResponsePtr responder,
- const LLSD& context,
- const LLSD& input) const
- {
- const LLUUID& session_id = input["body"]["session_id"].asUUID();
- gIMMgr->processAgentListUpdates(session_id, input["body"]);
- }
+ virtual void post(
+ ResponsePtr responder,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ const LLUUID& session_id = input["body"]["session_id"].asUUID();
+ gIMMgr->processAgentListUpdates(session_id, input["body"]);
+ }
};
class LLViewerChatterBoxSessionUpdate : public LLHTTPNode
{
public:
- virtual void post(
- ResponsePtr responder,
- const LLSD& context,
- const LLSD& input) const
- {
- LLUUID session_id = input["body"]["session_id"].asUUID();
- LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
- if ( im_floater )
- {
- im_floater->processSessionUpdate(input["body"]["info"]);
- }
- LLIMSpeakerMgr* im_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
- if (im_mgr)
- {
- im_mgr->processSessionUpdate(input["body"]["info"]);
- }
- }
+ virtual void post(
+ ResponsePtr responder,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LLUUID session_id = input["body"]["session_id"].asUUID();
+ LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
+ if ( im_floater )
+ {
+ im_floater->processSessionUpdate(input["body"]["info"]);
+ }
+ LLIMSpeakerMgr* im_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
+ if (im_mgr)
+ {
+ im_mgr->processSessionUpdate(input["body"]["info"]);
+ }
+ }
};
@@ -4059,135 +4059,135 @@ class LLViewerChatterBoxInvitation : public LLHTTPNode
{
public:
- virtual void post(
- ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- //for backwards compatiblity reasons...we need to still
- //check for 'text' or 'voice' invitations...bleh
- if ( input["body"].has("instantmessage") )
- {
- LLSD message_params =
- input["body"]["instantmessage"]["message_params"];
-
- //do something here to have the IM invite behave
- //just like a normal IM
- //this is just replicated code from process_improved_im
- //and should really go in it's own function -jwolk
-
- std::string message = message_params["message"].asString();
- std::string name = message_params["from_name"].asString();
- LLUUID from_id = message_params["from_id"].asUUID();
- LLUUID session_id = message_params["id"].asUUID();
- std::vector<U8> bin_bucket = message_params["data"]["binary_bucket"].asBinary();
- U8 offline = (U8)message_params["offline"].asInteger();
-
- time_t timestamp =
- (time_t) message_params["timestamp"].asInteger();
-
- BOOL is_do_not_disturb = gAgent.isDoNotDisturb();
-
- //don't return if user is muted b/c proper way to ignore a muted user who
- //initiated an adhoc/group conference is to create then leave the session (see STORM-1731)
- if (is_do_not_disturb)
- {
- return;
- }
-
- // standard message, not from system
- std::string saved;
- if(offline == IM_OFFLINE)
- {
- LLStringUtil::format_map_t args;
- args["[LONG_TIMESTAMP]"] = formatted_time(timestamp);
- saved = LLTrans::getString("Saved_message", args);
- }
- std::string buffer = saved + message;
-
- if(from_id == gAgentID)
- {
- return;
- }
- gIMMgr->addMessage(
- session_id,
- from_id,
- name,
- buffer,
- IM_OFFLINE == offline,
- std::string((char*)&bin_bucket[0]),
- IM_SESSION_INVITE,
- message_params["parent_estate_id"].asInteger(),
- message_params["region_id"].asUUID(),
- ll_vector3_from_sd(message_params["position"]),
+ virtual void post(
+ ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ //for backwards compatiblity reasons...we need to still
+ //check for 'text' or 'voice' invitations...bleh
+ if ( input["body"].has("instantmessage") )
+ {
+ LLSD message_params =
+ input["body"]["instantmessage"]["message_params"];
+
+ //do something here to have the IM invite behave
+ //just like a normal IM
+ //this is just replicated code from process_improved_im
+ //and should really go in it's own function -jwolk
+
+ std::string message = message_params["message"].asString();
+ std::string name = message_params["from_name"].asString();
+ LLUUID from_id = message_params["from_id"].asUUID();
+ LLUUID session_id = message_params["id"].asUUID();
+ std::vector<U8> bin_bucket = message_params["data"]["binary_bucket"].asBinary();
+ U8 offline = (U8)message_params["offline"].asInteger();
+
+ time_t timestamp =
+ (time_t) message_params["timestamp"].asInteger();
+
+ BOOL is_do_not_disturb = gAgent.isDoNotDisturb();
+
+ //don't return if user is muted b/c proper way to ignore a muted user who
+ //initiated an adhoc/group conference is to create then leave the session (see STORM-1731)
+ if (is_do_not_disturb)
+ {
+ return;
+ }
+
+ // standard message, not from system
+ std::string saved;
+ if(offline == IM_OFFLINE)
+ {
+ LLStringUtil::format_map_t args;
+ args["[LONG_TIMESTAMP]"] = formatted_time(timestamp);
+ saved = LLTrans::getString("Saved_message", args);
+ }
+ std::string buffer = saved + message;
+
+ if(from_id == gAgentID)
+ {
+ return;
+ }
+ gIMMgr->addMessage(
+ session_id,
+ from_id,
+ name,
+ buffer,
+ IM_OFFLINE == offline,
+ std::string((char*)&bin_bucket[0]),
+ IM_SESSION_INVITE,
+ message_params["parent_estate_id"].asInteger(),
+ message_params["region_id"].asUUID(),
+ ll_vector3_from_sd(message_params["position"]),
false, // is_region_message
timestamp);
- if (LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat))
- {
- return;
- }
+ if (LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat))
+ {
+ return;
+ }
- //K now we want to accept the invitation
- std::string url = gAgent.getRegionCapability("ChatSessionRequest");
+ //K now we want to accept the invitation
+ std::string url = gAgent.getRegionCapability("ChatSessionRequest");
- if ( url != "" )
- {
+ if ( url != "" )
+ {
LLCoros::instance().launch("chatterBoxInvitationCoro",
boost::bind(&chatterBoxInvitationCoro, url,
session_id, LLIMMgr::INVITATION_TYPE_INSTANT_MESSAGE));
- }
- } //end if invitation has instant message
- else if ( input["body"].has("voice") )
- {
- if(!LLVoiceClient::getInstance()->voiceEnabled() || !LLVoiceClient::getInstance()->isVoiceWorking())
- {
- // Don't display voice invites unless the user has voice enabled.
- return;
- }
-
- gIMMgr->inviteToSession(
- input["body"]["session_id"].asUUID(),
- input["body"]["session_name"].asString(),
- input["body"]["from_id"].asUUID(),
- input["body"]["from_name"].asString(),
- IM_SESSION_INVITE,
- LLIMMgr::INVITATION_TYPE_VOICE);
- }
- else if ( input["body"].has("immediate") )
- {
- gIMMgr->inviteToSession(
- input["body"]["session_id"].asUUID(),
- input["body"]["session_name"].asString(),
- input["body"]["from_id"].asUUID(),
- input["body"]["from_name"].asString(),
- IM_SESSION_INVITE,
- LLIMMgr::INVITATION_TYPE_IMMEDIATE);
- }
- }
+ }
+ } //end if invitation has instant message
+ else if ( input["body"].has("voice") )
+ {
+ if(!LLVoiceClient::getInstance()->voiceEnabled() || !LLVoiceClient::getInstance()->isVoiceWorking())
+ {
+ // Don't display voice invites unless the user has voice enabled.
+ return;
+ }
+
+ gIMMgr->inviteToSession(
+ input["body"]["session_id"].asUUID(),
+ input["body"]["session_name"].asString(),
+ input["body"]["from_id"].asUUID(),
+ input["body"]["from_name"].asString(),
+ IM_SESSION_INVITE,
+ LLIMMgr::INVITATION_TYPE_VOICE);
+ }
+ else if ( input["body"].has("immediate") )
+ {
+ gIMMgr->inviteToSession(
+ input["body"]["session_id"].asUUID(),
+ input["body"]["session_name"].asString(),
+ input["body"]["from_id"].asUUID(),
+ input["body"]["from_name"].asString(),
+ IM_SESSION_INVITE,
+ LLIMMgr::INVITATION_TYPE_IMMEDIATE);
+ }
+ }
};
LLHTTPRegistration<LLViewerChatterBoxSessionStartReply>
gHTTPRegistrationMessageChatterboxsessionstartreply(
- "/message/ChatterBoxSessionStartReply");
+ "/message/ChatterBoxSessionStartReply");
LLHTTPRegistration<LLViewerChatterBoxSessionEventReply>
gHTTPRegistrationMessageChatterboxsessioneventreply(
- "/message/ChatterBoxSessionEventReply");
+ "/message/ChatterBoxSessionEventReply");
LLHTTPRegistration<LLViewerForceCloseChatterBoxSession>
gHTTPRegistrationMessageForceclosechatterboxsession(
- "/message/ForceCloseChatterBoxSession");
+ "/message/ForceCloseChatterBoxSession");
LLHTTPRegistration<LLViewerChatterBoxSessionAgentListUpdates>
gHTTPRegistrationMessageChatterboxsessionagentlistupdates(
- "/message/ChatterBoxSessionAgentListUpdates");
+ "/message/ChatterBoxSessionAgentListUpdates");
LLHTTPRegistration<LLViewerChatterBoxSessionUpdate>
gHTTPRegistrationMessageChatterBoxSessionUpdate(
- "/message/ChatterBoxSessionUpdate");
+ "/message/ChatterBoxSessionUpdate");
LLHTTPRegistration<LLViewerChatterBoxInvitation>
gHTTPRegistrationMessageChatterBoxInvitation(
- "/message/ChatterBoxInvitation");
+ "/message/ChatterBoxInvitation");
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index bace97d37a..8d1bc1c76a 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file LLIMMgr.h
* @brief Container for Instant Messaging
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,7 +40,7 @@
class LLAvatarName;
class LLFriendObserver;
-class LLCallDialogManager;
+class LLCallDialogManager;
class LLIMSpeakerMgr;
/**
@@ -49,12 +49,12 @@ class LLIMSpeakerMgr;
class LLSessionTimeoutTimer : public LLEventTimer
{
public:
- LLSessionTimeoutTimer(const LLUUID& session_id, F32 period) : LLEventTimer(period), mSessionId(session_id) {}
- virtual ~LLSessionTimeoutTimer() {};
- /* virtual */ BOOL tick();
+ LLSessionTimeoutTimer(const LLUUID& session_id, F32 period) : LLEventTimer(period), mSessionId(session_id) {}
+ virtual ~LLSessionTimeoutTimer() {};
+ /* virtual */ BOOL tick();
private:
- LLUUID mSessionId;
+ LLUUID mSessionId;
};
@@ -63,30 +63,30 @@ private:
*/
class LLIMModel : public LLSingleton<LLIMModel>
{
- LLSINGLETON(LLIMModel);
+ LLSINGLETON(LLIMModel);
public:
typedef std::list<LLSD> chat_message_list_t;
struct LLIMSession : public boost::signals2::trackable
- {
+ {
typedef enum e_session_type
- { // for now we have 4 predefined types for a session
- P2P_SESSION,
- GROUP_SESSION,
- ADHOC_SESSION,
- NONE_SESSION,
- } SType;
-
- LLIMSession(const LLUUID& session_id, const std::string& name,
- const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg);
- virtual ~LLIMSession();
-
- void sessionInitReplyReceived(const LLUUID& new_session_id);
- void addMessagesFromHistoryCache(const std::list<LLSD>& history); // From local file
+ { // for now we have 4 predefined types for a session
+ P2P_SESSION,
+ GROUP_SESSION,
+ ADHOC_SESSION,
+ NONE_SESSION,
+ } SType;
+
+ LLIMSession(const LLUUID& session_id, const std::string& name,
+ const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg);
+ virtual ~LLIMSession();
+
+ void sessionInitReplyReceived(const LLUUID& new_session_id);
+ void addMessagesFromHistoryCache(const std::list<LLSD>& history); // From local file
void addMessagesFromServerHistory(const LLSD& history, const std::string& target_from, const std::string& target_message, U32 timestamp); // From chat server
- void addMessage(const std::string& from,
+ void addMessage(const std::string& from,
const LLUUID& from_id,
const std::string& utf8_text,
const std::string& time,
@@ -96,135 +96,135 @@ public:
void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction);
- /** @deprecated */
- static void chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata);
+ /** @deprecated */
+ static void chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata);
- bool isOutgoingAdHoc() const;
- bool isAdHoc();
- bool isP2P();
- bool isGroupChat();
+ bool isOutgoingAdHoc() const;
+ bool isAdHoc();
+ bool isP2P();
+ bool isGroupChat();
- bool isP2PSessionType() const { return mSessionType == P2P_SESSION;}
- bool isAdHocSessionType() const { return mSessionType == ADHOC_SESSION;}
- bool isGroupSessionType() const { return mSessionType == GROUP_SESSION;}
+ bool isP2PSessionType() const { return mSessionType == P2P_SESSION;}
+ bool isAdHocSessionType() const { return mSessionType == ADHOC_SESSION;}
+ bool isGroupSessionType() const { return mSessionType == GROUP_SESSION;}
- LLUUID generateOutgoingAdHocHash() const;
+ LLUUID generateOutgoingAdHocHash() const;
- //*TODO make private
- /** ad-hoc sessions involve sophisticated chat history file naming schemes */
- void buildHistoryFileName();
+ //*TODO make private
+ /** ad-hoc sessions involve sophisticated chat history file naming schemes */
+ void buildHistoryFileName();
- void loadHistory();
+ void loadHistory();
- LLUUID mSessionID;
- std::string mName;
- EInstantMessage mType;
- SType mSessionType;
- LLUUID mOtherParticipantID;
- uuid_vec_t mInitialTargetIDs;
- std::string mHistoryFileName;
+ LLUUID mSessionID;
+ std::string mName;
+ EInstantMessage mType;
+ SType mSessionType;
+ LLUUID mOtherParticipantID;
+ uuid_vec_t mInitialTargetIDs;
+ std::string mHistoryFileName;
// Saved messages from the last minute of history read from the local group chat cache file
std::string mLastHistoryCacheDateTime;
chat_message_list_t mLastHistoryCacheMsgs;
- // connection to voice channel state change signal
- boost::signals2::connection mVoiceChannelStateChangeConnection;
+ // connection to voice channel state change signal
+ boost::signals2::connection mVoiceChannelStateChangeConnection;
- //does NOT include system messages and agent's messages
- S32 mParticipantUnreadMessageCount;
+ //does NOT include system messages and agent's messages
+ S32 mParticipantUnreadMessageCount;
- // does include all incoming messages
- S32 mNumUnread;
+ // does include all incoming messages
+ S32 mNumUnread;
chat_message_list_t mMsgs;
- LLVoiceChannel* mVoiceChannel;
- LLIMSpeakerMgr* mSpeakers;
+ LLVoiceChannel* mVoiceChannel;
+ LLIMSpeakerMgr* mSpeakers;
+
+ bool mSessionInitialized;
+
+ //true if calling back the session URI after the session has closed is possible.
+ //Currently this will be false only for PSTN P2P calls.
+ bool mCallBackEnabled;
- bool mSessionInitialized;
+ bool mTextIMPossible;
+ bool mStartCallOnInitialize;
- //true if calling back the session URI after the session has closed is possible.
- //Currently this will be false only for PSTN P2P calls.
- bool mCallBackEnabled;
+ //if IM session is created for a voice call
+ bool mStartedAsIMCall;
- bool mTextIMPossible;
- bool mStartCallOnInitialize;
+ bool mHasOfflineMessage;
- //if IM session is created for a voice call
- bool mStartedAsIMCall;
+ bool mIsDNDsend;
- bool mHasOfflineMessage;
+ private:
+ void onAdHocNameCache(const LLAvatarName& av_name);
- bool mIsDNDsend;
+ static LLUUID generateHash(const std::set<LLUUID>& sorted_uuids);
+ boost::signals2::connection mAvatarNameCacheConnection;
+ };
- private:
- void onAdHocNameCache(const LLAvatarName& av_name);
- static LLUUID generateHash(const std::set<LLUUID>& sorted_uuids);
- boost::signals2::connection mAvatarNameCacheConnection;
- };
-
+ /** Session id to session object */
+ std::map<LLUUID, LLIMSession*> mId2SessionMap;
- /** Session id to session object */
- std::map<LLUUID, LLIMSession*> mId2SessionMap;
+ typedef boost::signals2::signal<void(const LLSD&)> session_signal_t;
+ session_signal_t mNewMsgSignal;
+ session_signal_t mNoUnreadMsgsSignal;
- typedef boost::signals2::signal<void(const LLSD&)> session_signal_t;
- session_signal_t mNewMsgSignal;
- session_signal_t mNoUnreadMsgsSignal;
-
- /**
- * Find an IM Session corresponding to session_id
- * Returns NULL if the session does not exist
- */
- LLIMSession* findIMSession(const LLUUID& session_id) const;
+ /**
+ * Find an IM Session corresponding to session_id
+ * Returns NULL if the session does not exist
+ */
+ LLIMSession* findIMSession(const LLUUID& session_id) const;
- /**
- * Find an Ad-Hoc IM Session with specified participants
- * @return first found Ad-Hoc session or NULL if the session does not exist
- */
- LLIMSession* findAdHocIMSession(const uuid_vec_t& ids);
+ /**
+ * Find an Ad-Hoc IM Session with specified participants
+ * @return first found Ad-Hoc session or NULL if the session does not exist
+ */
+ LLIMSession* findAdHocIMSession(const uuid_vec_t& ids);
- /**
- * Rebind session data to a new session id.
- */
- void processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id);
+ /**
+ * Rebind session data to a new session id.
+ */
+ void processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id);
- boost::signals2::connection addNewMsgCallback(const session_signal_t::slot_type& cb ) { return mNewMsgSignal.connect(cb); }
- boost::signals2::connection addNoUnreadMsgsCallback(const session_signal_t::slot_type& cb ) { return mNoUnreadMsgsSignal.connect(cb); }
+ boost::signals2::connection addNewMsgCallback(const session_signal_t::slot_type& cb ) { return mNewMsgSignal.connect(cb); }
+ boost::signals2::connection addNoUnreadMsgsCallback(const session_signal_t::slot_type& cb ) { return mNoUnreadMsgsSignal.connect(cb); }
- /**
- * Create new session object in a model
- * @param name session name should not be empty, will return false if empty
- */
- bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id,
- const uuid_vec_t& ids, bool voice = false, bool has_offline_msg = false);
+ /**
+ * Create new session object in a model
+ * @param name session name should not be empty, will return false if empty
+ */
+ bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id,
+ const uuid_vec_t& ids, bool voice = false, bool has_offline_msg = false);
- bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type,
- const LLUUID& other_participant_id, bool voice = false, bool has_offline_msg = false);
+ bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type,
+ const LLUUID& other_participant_id, bool voice = false, bool has_offline_msg = false);
- /**
- * Remove all session data associated with a session specified by session_id
- */
- bool clearSession(const LLUUID& session_id);
+ /**
+ * Remove all session data associated with a session specified by session_id
+ */
+ bool clearSession(const LLUUID& session_id);
- /**
- * Sends no unread messages signal.
- */
- void sendNoUnreadMessages(const LLUUID& session_id);
+ /**
+ * Sends no unread messages signal.
+ */
+ void sendNoUnreadMessages(const LLUUID& session_id);
- /**
- * Populate supplied std::list with messages starting from index specified by start_index
- */
- void getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0, const bool sendNoUnreadMsgs = true);
+ /**
+ * Populate supplied std::list with messages starting from index specified by start_index
+ */
+ void getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0, const bool sendNoUnreadMsgs = true);
- /**
- * Add a message to an IM Model - the message is saved in a message store associated with a session specified by session_id
- * and also saved into a file if log2file is specified.
- * It sends new message signal for each added message.
- */
- void addMessage(const LLUUID& session_id,
+ /**
+ * Add a message to an IM Model - the message is saved in a message store associated with a session specified by session_id
+ * and also saved into a file if log2file is specified.
+ * It sends new message signal for each added message.
+ */
+ void addMessage(const LLUUID& session_id,
const std::string& from,
const LLUUID& other_participant_id,
const std::string& utf8_text,
@@ -240,400 +240,400 @@ public:
bool is_region_msg,
U32 time_stamp);
- /**
- * Similar to addMessage(...) above but won't send a signal about a new message added
- */
- LLIMModel::LLIMSession* addMessageSilently(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
- const std::string& utf8_text, bool log2file = true, bool is_region_msg = false, U32 timestamp = 0);
-
- /**
- * Add a system message to an IM Model
- */
- void proccessOnlineOfflineNotification(const LLUUID& session_id, const std::string& utf8_text);
-
- /**
- * Get a session's name.
- * For a P2P chat - it's an avatar's name,
- * For a group chat - it's a group's name
- * For an incoming ad-hoc chat - is received from the server and is in a from of "<Avatar's name> Conference"
- * It is updated in LLIMModel::LLIMSession's constructor to localize the "Conference".
- */
- const std::string getName(const LLUUID& session_id) const;
-
- /**
- * Get number of unread messages in a session with session_id
- * Returns -1 if the session with session_id doesn't exist
- */
- const S32 getNumUnread(const LLUUID& session_id) const;
-
- /**
- * Get uuid of other participant in a session with session_id
- * Returns LLUUID::null if the session doesn't exist
- *
- * *TODO what to do with other participants in ad-hoc and group chats?
- */
- const LLUUID& getOtherParticipantID(const LLUUID& session_id) const;
-
- /**
- * Get type of a session specified by session_id
- * Returns EInstantMessage::IM_COUNT if the session does not exist
- */
- EInstantMessage getType(const LLUUID& session_id) const;
-
- /**
- * Get voice channel for the session specified by session_id
- * Returns NULL if the session does not exist
- */
- LLVoiceChannel* getVoiceChannel(const LLUUID& session_id) const;
-
- /**
- * Get im speaker manager for the session specified by session_id
- * Returns NULL if the session does not exist
- */
- LLIMSpeakerMgr* getSpeakerManager(const LLUUID& session_id) const;
-
- const std::string& getHistoryFileName(const LLUUID& session_id) const;
-
- static void sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id);
- static bool sendStartSession(const LLUUID& temp_session_id, const LLUUID& other_participant_id,
- const uuid_vec_t& ids, EInstantMessage dialog);
- static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing);
- static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
- const LLUUID& other_participant_id, EInstantMessage dialog);
-
- // Adds people from speakers list (people with whom you are currently speaking) to the Recent People List
- static void addSpeakersToRecent(const LLUUID& im_session_id);
-
- void testMessages();
-
- /**
- * Saves an IM message into a file
- */
- bool logToFile(const std::string& file_name, const std::string& from, const LLUUID& from_id, const std::string& utf8_text);
+ /**
+ * Similar to addMessage(...) above but won't send a signal about a new message added
+ */
+ LLIMModel::LLIMSession* addMessageSilently(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
+ const std::string& utf8_text, bool log2file = true, bool is_region_msg = false, U32 timestamp = 0);
+
+ /**
+ * Add a system message to an IM Model
+ */
+ void proccessOnlineOfflineNotification(const LLUUID& session_id, const std::string& utf8_text);
+
+ /**
+ * Get a session's name.
+ * For a P2P chat - it's an avatar's name,
+ * For a group chat - it's a group's name
+ * For an incoming ad-hoc chat - is received from the server and is in a from of "<Avatar's name> Conference"
+ * It is updated in LLIMModel::LLIMSession's constructor to localize the "Conference".
+ */
+ const std::string getName(const LLUUID& session_id) const;
+
+ /**
+ * Get number of unread messages in a session with session_id
+ * Returns -1 if the session with session_id doesn't exist
+ */
+ const S32 getNumUnread(const LLUUID& session_id) const;
+
+ /**
+ * Get uuid of other participant in a session with session_id
+ * Returns LLUUID::null if the session doesn't exist
+ *
+ * *TODO what to do with other participants in ad-hoc and group chats?
+ */
+ const LLUUID& getOtherParticipantID(const LLUUID& session_id) const;
+
+ /**
+ * Get type of a session specified by session_id
+ * Returns EInstantMessage::IM_COUNT if the session does not exist
+ */
+ EInstantMessage getType(const LLUUID& session_id) const;
+
+ /**
+ * Get voice channel for the session specified by session_id
+ * Returns NULL if the session does not exist
+ */
+ LLVoiceChannel* getVoiceChannel(const LLUUID& session_id) const;
+
+ /**
+ * Get im speaker manager for the session specified by session_id
+ * Returns NULL if the session does not exist
+ */
+ LLIMSpeakerMgr* getSpeakerManager(const LLUUID& session_id) const;
+
+ const std::string& getHistoryFileName(const LLUUID& session_id) const;
+
+ static void sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id);
+ static bool sendStartSession(const LLUUID& temp_session_id, const LLUUID& other_participant_id,
+ const uuid_vec_t& ids, EInstantMessage dialog);
+ static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing);
+ static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
+ const LLUUID& other_participant_id, EInstantMessage dialog);
+
+ // Adds people from speakers list (people with whom you are currently speaking) to the Recent People List
+ static void addSpeakersToRecent(const LLUUID& im_session_id);
+
+ void testMessages();
+
+ /**
+ * Saves an IM message into a file
+ */
+ bool logToFile(const std::string& file_name, const std::string& from, const LLUUID& from_id, const std::string& utf8_text);
private:
- /**
- * Populate supplied std::list with messages starting from index specified by start_index without
- * emitting no unread messages signal.
- */
- void getMessagesSilently(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0);
+ /**
+ * Populate supplied std::list with messages starting from index specified by start_index without
+ * emitting no unread messages signal.
+ */
+ void getMessagesSilently(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0);
- /**
- * Add message to a list of message associated with session specified by session_id
- */
- bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text, bool is_region_msg, U32 timestamp);
+ /**
+ * Add message to a list of message associated with session specified by session_id
+ */
+ bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text, bool is_region_msg, U32 timestamp);
};
class LLIMSessionObserver
{
public:
- virtual ~LLIMSessionObserver() {}
- virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) = 0;
+ virtual ~LLIMSessionObserver() {}
+ virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) = 0;
virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) = 0;
- virtual void sessionVoiceOrIMStarted(const LLUUID& session_id) = 0;
- virtual void sessionRemoved(const LLUUID& session_id) = 0;
- virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) = 0;
+ virtual void sessionVoiceOrIMStarted(const LLUUID& session_id) = 0;
+ virtual void sessionRemoved(const LLUUID& session_id) = 0;
+ virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) = 0;
};
class LLIMMgr : public LLSingleton<LLIMMgr>
{
- LLSINGLETON(LLIMMgr);
- friend class LLIMModel;
+ LLSINGLETON(LLIMMgr);
+ friend class LLIMModel;
public:
- enum EInvitationType
- {
- INVITATION_TYPE_INSTANT_MESSAGE = 0,
- INVITATION_TYPE_VOICE = 1,
- INVITATION_TYPE_IMMEDIATE = 2
- };
-
-
- // Add a message to a session. The session can keyed to sesion id
- // or agent id.
- void addMessage(const LLUUID& session_id,
- const LLUUID& target_id,
- const std::string& from,
- const std::string& msg,
- bool is_offline_msg = false,
- const std::string& session_name = LLStringUtil::null,
- EInstantMessage dialog = IM_NOTHING_SPECIAL,
- U32 parent_estate_id = 0,
- const LLUUID& region_id = LLUUID::null,
- const LLVector3& position = LLVector3::zero,
+ enum EInvitationType
+ {
+ INVITATION_TYPE_INSTANT_MESSAGE = 0,
+ INVITATION_TYPE_VOICE = 1,
+ INVITATION_TYPE_IMMEDIATE = 2
+ };
+
+
+ // Add a message to a session. The session can keyed to sesion id
+ // or agent id.
+ void addMessage(const LLUUID& session_id,
+ const LLUUID& target_id,
+ const std::string& from,
+ const std::string& msg,
+ bool is_offline_msg = false,
+ const std::string& session_name = LLStringUtil::null,
+ EInstantMessage dialog = IM_NOTHING_SPECIAL,
+ U32 parent_estate_id = 0,
+ const LLUUID& region_id = LLUUID::null,
+ const LLVector3& position = LLVector3::zero,
bool is_region_msg = false,
U32 timestamp = 0);
- void addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args);
-
- // This adds a session to the talk view. The name is the local
- // name of the session, dialog specifies the type of
- // session. Since sessions can be keyed off of first recipient or
- // initiator, the session can be matched against the id
- // provided. If the session exists, it is brought forward. This
- // method accepts a group id or an agent id. Specifying id = NULL
- // results in an im session to everyone. Returns the uuid of the
- // session.
- LLUUID addSession(const std::string& name,
- EInstantMessage dialog,
- const LLUUID& other_participant_id, bool voice = false);
-
- // Adds a session using a specific group of starting agents
- // the dialog type is assumed correct. Returns the uuid of the session.
- // A session can be added to a floater specified by floater_id.
- LLUUID addSession(const std::string& name,
- EInstantMessage dialog,
- const LLUUID& other_participant_id,
- const std::vector<LLUUID>& ids, bool voice = false,
- const LLUUID& floater_id = LLUUID::null);
-
- /**
- * Creates a P2P session with the requisite handle for responding to voice calls.
- *
- * @param name session name, cannot be null
- * @param caller_uri - sip URI of caller. It should be always be passed into the method to avoid
- * incorrect working of LLVoiceChannel instances. See EXT-2985.
- */
- LLUUID addP2PSession(const std::string& name,
- const LLUUID& other_participant_id,
- const std::string& voice_session_handle,
- const std::string& caller_uri);
-
- /**
- * Leave the session with session id. Send leave session notification
- * to the server and removes all associated session data
- * @return false if the session with specified id was not exist
- */
- bool leaveSession(const LLUUID& session_id);
-
- void inviteToSession(
- const LLUUID& session_id,
- const std::string& session_name,
- const LLUUID& caller,
- const std::string& caller_name,
- EInstantMessage type,
- EInvitationType inv_type,
- const std::string& session_handle = LLStringUtil::null,
- const std::string& session_uri = LLStringUtil::null);
-
- void processIMTypingStart(const LLUUID& from_id, const EInstantMessage im_type);
- void processIMTypingStop(const LLUUID& from_id, const EInstantMessage im_type);
-
- // automatically start a call once the session has initialized
- void autoStartCallOnStartup(const LLUUID& session_id);
-
- // Calc number of all unread IMs
- S32 getNumberOfUnreadIM();
-
- /**
- * Calculates number of unread IMs from real participants in all stored sessions
- */
- S32 getNumberOfUnreadParticipantMessages();
-
- // This method is used to go through all active sessions and
- // disable all of them. This method is usally called when you are
- // forced to log out or similar situations where you do not have a
- // good connection.
- void disconnectAllSessions();
-
- BOOL hasSession(const LLUUID& session_id);
-
- static LLUUID computeSessionID(EInstantMessage dialog, const LLUUID& other_participant_id);
-
- void clearPendingInvitation(const LLUUID& session_id);
-
- void processAgentListUpdates(const LLUUID& session_id, const LLSD& body);
- LLSD getPendingAgentListUpdates(const LLUUID& session_id);
- void addPendingAgentListUpdates(
- const LLUUID& sessioN_id,
- const LLSD& updates);
- void clearPendingAgentListUpdates(const LLUUID& session_id);
-
- void addSessionObserver(LLIMSessionObserver *);
- void removeSessionObserver(LLIMSessionObserver *);
-
- //show error statuses to the user
- void showSessionStartError(const std::string& error_string, const LLUUID session_id);
- void showSessionEventError(const std::string& event_string, const std::string& error_string, const LLUUID session_id);
- void showSessionForceClose(const std::string& reason, const LLUUID session_id);
- static bool onConfirmForceCloseError(const LLSD& notification, const LLSD& response);
-
- /**
- * Start call in a session
- * @return false if voice channel doesn't exist
- **/
- bool startCall(const LLUUID& session_id, LLVoiceChannel::EDirection direction = LLVoiceChannel::OUTGOING_CALL);
-
- /**
- * End call in a session
- * @return false if voice channel doesn't exist
- **/
- bool endCall(const LLUUID& session_id);
-
- bool isVoiceCall(const LLUUID& session_id);
-
- void updateDNDMessageStatus();
-
- bool isDNDMessageSend(const LLUUID& session_id);
-
- void setDNDMessageSent(const LLUUID& session_id, bool is_send);
-
- void addNotifiedNonFriendSessionID(const LLUUID& session_id);
-
- bool isNonFriendSessionNotified(const LLUUID& session_id);
+ void addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args);
+
+ // This adds a session to the talk view. The name is the local
+ // name of the session, dialog specifies the type of
+ // session. Since sessions can be keyed off of first recipient or
+ // initiator, the session can be matched against the id
+ // provided. If the session exists, it is brought forward. This
+ // method accepts a group id or an agent id. Specifying id = NULL
+ // results in an im session to everyone. Returns the uuid of the
+ // session.
+ LLUUID addSession(const std::string& name,
+ EInstantMessage dialog,
+ const LLUUID& other_participant_id, bool voice = false);
+
+ // Adds a session using a specific group of starting agents
+ // the dialog type is assumed correct. Returns the uuid of the session.
+ // A session can be added to a floater specified by floater_id.
+ LLUUID addSession(const std::string& name,
+ EInstantMessage dialog,
+ const LLUUID& other_participant_id,
+ const std::vector<LLUUID>& ids, bool voice = false,
+ const LLUUID& floater_id = LLUUID::null);
+
+ /**
+ * Creates a P2P session with the requisite handle for responding to voice calls.
+ *
+ * @param name session name, cannot be null
+ * @param caller_uri - sip URI of caller. It should be always be passed into the method to avoid
+ * incorrect working of LLVoiceChannel instances. See EXT-2985.
+ */
+ LLUUID addP2PSession(const std::string& name,
+ const LLUUID& other_participant_id,
+ const std::string& voice_session_handle,
+ const std::string& caller_uri);
+
+ /**
+ * Leave the session with session id. Send leave session notification
+ * to the server and removes all associated session data
+ * @return false if the session with specified id was not exist
+ */
+ bool leaveSession(const LLUUID& session_id);
+
+ void inviteToSession(
+ const LLUUID& session_id,
+ const std::string& session_name,
+ const LLUUID& caller,
+ const std::string& caller_name,
+ EInstantMessage type,
+ EInvitationType inv_type,
+ const std::string& session_handle = LLStringUtil::null,
+ const std::string& session_uri = LLStringUtil::null);
+
+ void processIMTypingStart(const LLUUID& from_id, const EInstantMessage im_type);
+ void processIMTypingStop(const LLUUID& from_id, const EInstantMessage im_type);
+
+ // automatically start a call once the session has initialized
+ void autoStartCallOnStartup(const LLUUID& session_id);
+
+ // Calc number of all unread IMs
+ S32 getNumberOfUnreadIM();
+
+ /**
+ * Calculates number of unread IMs from real participants in all stored sessions
+ */
+ S32 getNumberOfUnreadParticipantMessages();
+
+ // This method is used to go through all active sessions and
+ // disable all of them. This method is usally called when you are
+ // forced to log out or similar situations where you do not have a
+ // good connection.
+ void disconnectAllSessions();
+
+ BOOL hasSession(const LLUUID& session_id);
+
+ static LLUUID computeSessionID(EInstantMessage dialog, const LLUUID& other_participant_id);
+
+ void clearPendingInvitation(const LLUUID& session_id);
+
+ void processAgentListUpdates(const LLUUID& session_id, const LLSD& body);
+ LLSD getPendingAgentListUpdates(const LLUUID& session_id);
+ void addPendingAgentListUpdates(
+ const LLUUID& sessioN_id,
+ const LLSD& updates);
+ void clearPendingAgentListUpdates(const LLUUID& session_id);
+
+ void addSessionObserver(LLIMSessionObserver *);
+ void removeSessionObserver(LLIMSessionObserver *);
+
+ //show error statuses to the user
+ void showSessionStartError(const std::string& error_string, const LLUUID session_id);
+ void showSessionEventError(const std::string& event_string, const std::string& error_string, const LLUUID session_id);
+ void showSessionForceClose(const std::string& reason, const LLUUID session_id);
+ static bool onConfirmForceCloseError(const LLSD& notification, const LLSD& response);
+
+ /**
+ * Start call in a session
+ * @return false if voice channel doesn't exist
+ **/
+ bool startCall(const LLUUID& session_id, LLVoiceChannel::EDirection direction = LLVoiceChannel::OUTGOING_CALL);
+
+ /**
+ * End call in a session
+ * @return false if voice channel doesn't exist
+ **/
+ bool endCall(const LLUUID& session_id);
+
+ bool isVoiceCall(const LLUUID& session_id);
+
+ void updateDNDMessageStatus();
+
+ bool isDNDMessageSend(const LLUUID& session_id);
+
+ void setDNDMessageSent(const LLUUID& session_id, bool is_send);
+
+ void addNotifiedNonFriendSessionID(const LLUUID& session_id);
+
+ bool isNonFriendSessionNotified(const LLUUID& session_id);
private:
- /**
- * Remove data associated with a particular session specified by session_id
- */
- void removeSession(const LLUUID& session_id);
+ /**
+ * Remove data associated with a particular session specified by session_id
+ */
+ void removeSession(const LLUUID& session_id);
- // This simple method just iterates through all of the ids, and
- // prints a simple message if they are not online. Used to help
- // reduce 'hello' messages to the linden employees unlucky enough
- // to have their calling card in the default inventory.
- void noteOfflineUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids);
- void noteMutedUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids);
+ // This simple method just iterates through all of the ids, and
+ // prints a simple message if they are not online. Used to help
+ // reduce 'hello' messages to the linden employees unlucky enough
+ // to have their calling card in the default inventory.
+ void noteOfflineUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids);
+ void noteMutedUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids);
- void processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing);
+ void processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing);
- static void onInviteNameLookup(LLSD payload, const LLUUID& id, const LLAvatarName& name);
+ static void onInviteNameLookup(LLSD payload, const LLUUID& id, const LLAvatarName& name);
- void notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg);
+ void notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg);
//Triggers when a session has already been added
void notifyObserverSessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id);
- void notifyObserverSessionVoiceOrIMStarted(const LLUUID& session_id);
- void notifyObserverSessionRemoved(const LLUUID& session_id);
- void notifyObserverSessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id);
+ void notifyObserverSessionVoiceOrIMStarted(const LLUUID& session_id);
+ void notifyObserverSessionRemoved(const LLUUID& session_id);
+ void notifyObserverSessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id);
private:
-
- typedef std::list <LLIMSessionObserver *> session_observers_list_t;
- session_observers_list_t mSessionObservers;
-
- // EXP-901
- // If "Only friends and groups can IM me" option is ON but the user got message from non-friend,
- // the user should be notified that to be able to see this message the option should be OFF.
- // This set stores session IDs in which user was notified. Need to store this IDs so that the user
- // be notified only one time per session with non-friend.
- typedef std::set<LLUUID> notified_non_friend_sessions_t;
- notified_non_friend_sessions_t mNotifiedNonFriendSessions;
-
- LLSD mPendingInvitations;
- LLSD mPendingAgentListUpdates;
+
+ typedef std::list <LLIMSessionObserver *> session_observers_list_t;
+ session_observers_list_t mSessionObservers;
+
+ // EXP-901
+ // If "Only friends and groups can IM me" option is ON but the user got message from non-friend,
+ // the user should be notified that to be able to see this message the option should be OFF.
+ // This set stores session IDs in which user was notified. Need to store this IDs so that the user
+ // be notified only one time per session with non-friend.
+ typedef std::set<LLUUID> notified_non_friend_sessions_t;
+ notified_non_friend_sessions_t mNotifiedNonFriendSessions;
+
+ LLSD mPendingInvitations;
+ LLSD mPendingAgentListUpdates;
};
class LLCallDialogManager : public LLSingleton<LLCallDialogManager>
{
- LLSINGLETON(LLCallDialogManager);
- ~LLCallDialogManager();
+ LLSINGLETON(LLCallDialogManager);
+ ~LLCallDialogManager();
public:
- // static for convinience
- static void onVoiceChannelChanged(const LLUUID &session_id);
- static void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent);
+ // static for convinience
+ static void onVoiceChannelChanged(const LLUUID &session_id);
+ static void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent);
private:
- void initSingleton() override;
- void onVoiceChannelChangedInt(const LLUUID &session_id);
- void onVoiceChannelStateChangedInt(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent);
+ void initSingleton() override;
+ void onVoiceChannelChangedInt(const LLUUID &session_id);
+ void onVoiceChannelStateChangedInt(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent);
protected:
- std::string mPreviousSessionlName;
- std::string mCurrentSessionlName;
- LLIMModel::LLIMSession* mSession;
- LLVoiceChannel::EState mOldState;
+ std::string mPreviousSessionlName;
+ std::string mCurrentSessionlName;
+ LLIMModel::LLIMSession* mSession;
+ LLVoiceChannel::EState mOldState;
};
class LLCallDialog : public LLDockableFloater
{
public:
- LLCallDialog(const LLSD& payload);
- virtual ~LLCallDialog();
+ LLCallDialog(const LLSD& payload);
+ virtual ~LLCallDialog();
+
+ virtual BOOL postBuild();
+
+ void dockToToolbarButton(const std::string& toolbarButtonName);
- virtual BOOL postBuild();
+ // check timer state
+ /*virtual*/ void draw();
+ /*virtual*/ void onOpen(const LLSD& key);
- void dockToToolbarButton(const std::string& toolbarButtonName);
-
- // check timer state
- /*virtual*/ void draw();
- /*virtual*/ void onOpen(const LLSD& key);
-
protected:
- // lifetime timer for a notification
- LLTimer mLifetimeTimer;
- // notification's lifetime in seconds
- S32 mLifetime;
- static const S32 DEFAULT_LIFETIME = 5;
- virtual bool lifetimeHasExpired();
- virtual void onLifetimeExpired();
-
- /**
- * Sets icon depend on session.
- *
- * If passed session_id is a group id group icon will be shown, otherwise avatar icon for participant_id
- *
- * @param session_id - UUID of session
- * @param participant_id - UUID of other participant
- */
- void setIcon(const LLSD& session_id, const LLSD& participant_id);
-
- LLSD mPayload;
+ // lifetime timer for a notification
+ LLTimer mLifetimeTimer;
+ // notification's lifetime in seconds
+ S32 mLifetime;
+ static const S32 DEFAULT_LIFETIME = 5;
+ virtual bool lifetimeHasExpired();
+ virtual void onLifetimeExpired();
+
+ /**
+ * Sets icon depend on session.
+ *
+ * If passed session_id is a group id group icon will be shown, otherwise avatar icon for participant_id
+ *
+ * @param session_id - UUID of session
+ * @param participant_id - UUID of other participant
+ */
+ void setIcon(const LLSD& session_id, const LLSD& participant_id);
+
+ LLSD mPayload;
private:
- LLDockControl::DocAt getDockControlPos(const std::string& toolbarButtonName);
+ LLDockControl::DocAt getDockControlPos(const std::string& toolbarButtonName);
};
class LLIncomingCallDialog : public LLCallDialog
{
public:
- LLIncomingCallDialog(const LLSD& payload);
- ~LLIncomingCallDialog()
- {
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- }
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
-
- static void onAccept(void* user_data);
- static void onReject(void* user_data);
- static void onStartIM(void* user_data);
-
- static void processCallResponse(S32 response, const LLSD& payload);
+ LLIncomingCallDialog(const LLSD& payload);
+ ~LLIncomingCallDialog()
+ {
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ }
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ static void onAccept(void* user_data);
+ static void onReject(void* user_data);
+ static void onStartIM(void* user_data);
+
+ static void processCallResponse(S32 response, const LLSD& payload);
private:
- void setCallerName(const std::string& ui_title,
- const std::string& ui_label,
- const std::string& call_type);
- void onAvatarNameCache(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- const std::string& call_type);
+ void setCallerName(const std::string& ui_title,
+ const std::string& ui_label,
+ const std::string& call_type);
+ void onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name,
+ const std::string& call_type);
- boost::signals2::connection mAvatarNameCacheConnection;
+ boost::signals2::connection mAvatarNameCacheConnection;
- /*virtual*/ void onLifetimeExpired();
+ /*virtual*/ void onLifetimeExpired();
};
class LLOutgoingCallDialog : public LLCallDialog
{
public:
- LLOutgoingCallDialog(const LLSD& payload);
+ LLOutgoingCallDialog(const LLSD& payload);
- /*virtual*/ BOOL postBuild();
- void show(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ void show(const LLSD& key);
- static void onCancel(void* user_data);
- static const LLUUID OCD_KEY;
+ static void onCancel(void* user_data);
+ static const LLUUID OCD_KEY;
private:
- // hide all text boxes
- void hideAllText();
+ // hide all text boxes
+ void hideAllText();
};
// Globals
diff --git a/indra/newview/llinspect.cpp b/indra/newview/llinspect.cpp
index f382b5985f..92272c7f45 100644
--- a/indra/newview/llinspect.cpp
+++ b/indra/newview/llinspect.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspect.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,14 +27,14 @@
#include "llinspect.h"
#include "lltooltip.h"
-#include "llcontrol.h" // LLCachedControl
-#include "llui.h" // LLUI::getInstance()->mSettingsGroups
+#include "llcontrol.h" // LLCachedControl
+#include "llui.h" // LLUI::getInstance()->mSettingsGroups
#include "llviewermenu.h"
LLInspect::LLInspect(const LLSD& key)
-: LLFloater(key),
- mCloseTimer(),
- mOpenTimer()
+: LLFloater(key),
+ mCloseTimer(),
+ mOpenTimer()
{
}
@@ -45,121 +45,121 @@ LLInspect::~LLInspect()
// virtual
void LLInspect::draw()
{
- static LLCachedControl<F32> FADE_TIME(*LLUI::getInstance()->mSettingGroups["config"], "InspectorFadeTime", 1.f);
- static LLCachedControl<F32> STAY_TIME(*LLUI::getInstance()->mSettingGroups["config"], "InspectorShowTime", 1.f);
- if (mOpenTimer.getStarted())
- {
- LLFloater::draw();
- if (mOpenTimer.getElapsedTimeF32() > STAY_TIME)
- {
- mOpenTimer.stop();
- mCloseTimer.start();
- }
-
- }
- else if (mCloseTimer.getStarted())
- {
- F32 alpha = clamp_rescale(mCloseTimer.getElapsedTimeF32(), 0.f, FADE_TIME(), 1.f, 0.f);
- LLViewDrawContext context(alpha);
- LLFloater::draw();
- if (mCloseTimer.getElapsedTimeF32() > FADE_TIME)
- {
- closeFloater(false);
- }
- }
- else
- {
- LLFloater::draw();
- }
+ static LLCachedControl<F32> FADE_TIME(*LLUI::getInstance()->mSettingGroups["config"], "InspectorFadeTime", 1.f);
+ static LLCachedControl<F32> STAY_TIME(*LLUI::getInstance()->mSettingGroups["config"], "InspectorShowTime", 1.f);
+ if (mOpenTimer.getStarted())
+ {
+ LLFloater::draw();
+ if (mOpenTimer.getElapsedTimeF32() > STAY_TIME)
+ {
+ mOpenTimer.stop();
+ mCloseTimer.start();
+ }
+
+ }
+ else if (mCloseTimer.getStarted())
+ {
+ F32 alpha = clamp_rescale(mCloseTimer.getElapsedTimeF32(), 0.f, FADE_TIME(), 1.f, 0.f);
+ LLViewDrawContext context(alpha);
+ LLFloater::draw();
+ if (mCloseTimer.getElapsedTimeF32() > FADE_TIME)
+ {
+ closeFloater(false);
+ }
+ }
+ else
+ {
+ LLFloater::draw();
+ }
}
// virtual
void LLInspect::onOpen(const LLSD& data)
{
- LLFloater::onOpen(data);
-
- mCloseTimer.stop();
- mOpenTimer.start();
+ LLFloater::onOpen(data);
+
+ mCloseTimer.stop();
+ mOpenTimer.start();
}
// virtual
void LLInspect::onFocusLost()
{
- LLFloater::onFocusLost();
-
- // Start closing when we lose focus
- mCloseTimer.start();
- mOpenTimer.stop();
+ LLFloater::onFocusLost();
+
+ // Start closing when we lose focus
+ mCloseTimer.start();
+ mOpenTimer.stop();
}
// virtual
BOOL LLInspect::handleHover(S32 x, S32 y, MASK mask)
{
- mOpenTimer.pause();
- return LLView::handleHover(x, y, mask);
+ mOpenTimer.pause();
+ return LLView::handleHover(x, y, mask);
}
BOOL LLInspect::handleToolTip(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
-
-
- //delegate handling of tooltip to the hovered child
- LLView* child_handler = childFromPoint(x,y);
- if (child_handler && !child_handler->getToolTip().empty())// show tooltip if a view has non-empty tooltip message
- {
- //build LLInspector params to get correct tooltip setting, etc. background image
- LLInspector::Params params;
- params.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
- params.message = child_handler->getToolTip();
- //set up delay if there is no visible tooltip at this moment
- params.delay_time = LLToolTipMgr::instance().toolTipVisible() ? 0.f : LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipDelay" );
- LLToolTipMgr::instance().show(params);
- handled = TRUE;
- }
- return handled;
+ BOOL handled = FALSE;
+
+
+ //delegate handling of tooltip to the hovered child
+ LLView* child_handler = childFromPoint(x,y);
+ if (child_handler && !child_handler->getToolTip().empty())// show tooltip if a view has non-empty tooltip message
+ {
+ //build LLInspector params to get correct tooltip setting, etc. background image
+ LLInspector::Params params;
+ params.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
+ params.message = child_handler->getToolTip();
+ //set up delay if there is no visible tooltip at this moment
+ params.delay_time = LLToolTipMgr::instance().toolTipVisible() ? 0.f : LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipDelay" );
+ LLToolTipMgr::instance().show(params);
+ handled = TRUE;
+ }
+ return handled;
}
// virtual
void LLInspect::onMouseLeave(S32 x, S32 y, MASK mask)
{
- mOpenTimer.unpause();
+ mOpenTimer.unpause();
}
bool LLInspect::childHasVisiblePopupMenu()
{
- // Child text-box may spawn a pop-up menu, if mouse is over the menu, Inspector
- // will hide(which is not expected).
- // This is an attempt to find out if child control has spawned a menu.
-
- LLView* child_menu = gMenuHolder->getVisibleMenu();
- if(child_menu)
- {
- LLRect floater_rc = calcScreenRect();
- LLRect menu_screen_rc = child_menu->calcScreenRect();
- S32 mx, my;
- LLUI::getInstance()->getMousePositionScreen(&mx, &my);
-
- // This works wrong if we spawn a menu near Inspector and menu overlaps Inspector.
- if(floater_rc.overlaps(menu_screen_rc) && menu_screen_rc.pointInRect(mx, my))
- {
- return true;
- }
- }
- return false;
+ // Child text-box may spawn a pop-up menu, if mouse is over the menu, Inspector
+ // will hide(which is not expected).
+ // This is an attempt to find out if child control has spawned a menu.
+
+ LLView* child_menu = gMenuHolder->getVisibleMenu();
+ if(child_menu)
+ {
+ LLRect floater_rc = calcScreenRect();
+ LLRect menu_screen_rc = child_menu->calcScreenRect();
+ S32 mx, my;
+ LLUI::getInstance()->getMousePositionScreen(&mx, &my);
+
+ // This works wrong if we spawn a menu near Inspector and menu overlaps Inspector.
+ if(floater_rc.overlaps(menu_screen_rc) && menu_screen_rc.pointInRect(mx, my))
+ {
+ return true;
+ }
+ }
+ return false;
}
void LLInspect::repositionInspector(const LLSD& data)
{
- // Position the inspector relative to the mouse cursor
- // Similar to how tooltips are positioned
- // See LLToolTipMgr::createToolTip
- if (data.has("pos"))
- {
- LLUI::getInstance()->positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
- }
- else
- {
- LLUI::getInstance()->positionViewNearMouse(this);
- }
- applyRectControl();
+ // Position the inspector relative to the mouse cursor
+ // Similar to how tooltips are positioned
+ // See LLToolTipMgr::createToolTip
+ if (data.has("pos"))
+ {
+ LLUI::getInstance()->positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
+ }
+ else
+ {
+ LLUI::getInstance()->positionViewNearMouse(this);
+ }
+ applyRectControl();
}
diff --git a/indra/newview/llinspect.h b/indra/newview/llinspect.h
index 6909aa3f16..881043389d 100644
--- a/indra/newview/llinspect.h
+++ b/indra/newview/llinspect.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspect.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,30 +34,30 @@
class LLInspect : public LLFloater
{
public:
- LLInspect(const LLSD& key);
- virtual ~LLInspect();
-
- /// Inspectors have a custom fade-in/fade-out animation
- /*virtual*/ void draw();
-
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
- /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
-
- /// Start open animation
- /*virtual*/ void onOpen(const LLSD& avatar_id);
-
- /// Inspectors close themselves when they lose focus
- /*virtual*/ void onFocusLost();
+ LLInspect(const LLSD& key);
+ virtual ~LLInspect();
+
+ /// Inspectors have a custom fade-in/fade-out animation
+ /*virtual*/ void draw();
+
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
+
+ /// Start open animation
+ /*virtual*/ void onOpen(const LLSD& avatar_id);
+
+ /// Inspectors close themselves when they lose focus
+ /*virtual*/ void onFocusLost();
+
+ void repositionInspector(const LLSD& data);
- void repositionInspector(const LLSD& data);
-
protected:
- virtual bool childHasVisiblePopupMenu();
+ virtual bool childHasVisiblePopupMenu();
- LLFrameTimer mCloseTimer;
- LLFrameTimer mOpenTimer;
+ LLFrameTimer mCloseTimer;
+ LLFrameTimer mOpenTimer;
};
#endif
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index b11c440015..61213c1a5d 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspectavatar.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -59,49 +59,49 @@ class LLFetchAvatarData;
// the 3D world.
class LLInspectAvatar : public LLInspect, LLTransientFloater
{
- friend class LLFloaterReg;
-
+ friend class LLFloaterReg;
+
public:
- // avatar_id - Avatar ID for which to show information
- // Inspector will be positioned relative to current mouse position
- LLInspectAvatar(const LLSD& avatar_id);
- virtual ~LLInspectAvatar();
-
- /*virtual*/ BOOL postBuild(void);
-
- // Because floater is single instance, need to re-parse data on each spawn
- // (for example, inspector about same avatar but in different position)
- /*virtual*/ void onOpen(const LLSD& avatar_id);
-
- // Update view based on information from avatar properties processor
- void processAvatarData(LLAvatarData* data);
-
- virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; }
+ // avatar_id - Avatar ID for which to show information
+ // Inspector will be positioned relative to current mouse position
+ LLInspectAvatar(const LLSD& avatar_id);
+ virtual ~LLInspectAvatar();
+
+ /*virtual*/ BOOL postBuild(void);
+
+ // Because floater is single instance, need to re-parse data on each spawn
+ // (for example, inspector about same avatar but in different position)
+ /*virtual*/ void onOpen(const LLSD& avatar_id);
+
+ // Update view based on information from avatar properties processor
+ void processAvatarData(LLAvatarData* data);
+
+ virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; }
private:
- // Make network requests for all the data to display in this view.
- // Used on construction and if avatar id changes.
- void requestUpdate();
-
- // Set the volume slider to this user's current client-side volume setting,
- // hiding/disabling if the user is not nearby.
- void updateVolumeSlider();
-
- // Button callbacks
- void onClickMuteVolume();
- void onVolumeChange(const LLSD& data);
-
- void onAvatarNameCache(const LLUUID& agent_id,
- const LLAvatarName& av_name);
-
+ // Make network requests for all the data to display in this view.
+ // Used on construction and if avatar id changes.
+ void requestUpdate();
+
+ // Set the volume slider to this user's current client-side volume setting,
+ // hiding/disabling if the user is not nearby.
+ void updateVolumeSlider();
+
+ // Button callbacks
+ void onClickMuteVolume();
+ void onVolumeChange(const LLSD& data);
+
+ void onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name);
+
private:
- LLUUID mAvatarID;
- // Need avatar name information to spawn friend add request
- LLAvatarName mAvatarName;
- // an in-flight request for avatar properties from LLAvatarPropertiesProcessor
- // is represented by this object
- LLFetchAvatarData* mPropertiesRequest;
- boost::signals2::connection mAvatarNameCacheConnection;
+ LLUUID mAvatarID;
+ // Need avatar name information to spawn friend add request
+ LLAvatarName mAvatarName;
+ // an in-flight request for avatar properties from LLAvatarPropertiesProcessor
+ // is represented by this object
+ LLFetchAvatarData* mPropertiesRequest;
+ boost::signals2::connection mAvatarNameCacheConnection;
};
//////////////////////////////////////////////////////////////////////////////
@@ -112,82 +112,82 @@ private:
class LLFetchAvatarData : public LLAvatarPropertiesObserver
{
public:
- // If the inspector closes it will delete the pending request object, so the
- // inspector pointer will be valid for the lifetime of this object
- LLFetchAvatarData(const LLUUID& avatar_id, LLInspectAvatar* inspector)
- : mAvatarID(avatar_id),
- mInspector(inspector)
- {
- LLAvatarPropertiesProcessor* processor =
- LLAvatarPropertiesProcessor::getInstance();
- // register ourselves as an observer
- processor->addObserver(mAvatarID, this);
- // send a request (duplicates will be suppressed inside the avatar
- // properties processor)
- processor->sendAvatarPropertiesRequest(mAvatarID);
- }
-
- ~LLFetchAvatarData()
- {
- // remove ourselves as an observer
- LLAvatarPropertiesProcessor::getInstance()->
- removeObserver(mAvatarID, this);
- }
-
- void processProperties(void* data, EAvatarProcessorType type)
- {
- // route the data to the inspector
- if (data
- && type == APT_PROPERTIES)
- {
- LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
- mInspector->processAvatarData(avatar_data);
- }
- }
-
- // Store avatar ID so we can un-register the observer on destruction
- LLUUID mAvatarID;
- LLInspectAvatar* mInspector;
+ // If the inspector closes it will delete the pending request object, so the
+ // inspector pointer will be valid for the lifetime of this object
+ LLFetchAvatarData(const LLUUID& avatar_id, LLInspectAvatar* inspector)
+ : mAvatarID(avatar_id),
+ mInspector(inspector)
+ {
+ LLAvatarPropertiesProcessor* processor =
+ LLAvatarPropertiesProcessor::getInstance();
+ // register ourselves as an observer
+ processor->addObserver(mAvatarID, this);
+ // send a request (duplicates will be suppressed inside the avatar
+ // properties processor)
+ processor->sendAvatarPropertiesRequest(mAvatarID);
+ }
+
+ ~LLFetchAvatarData()
+ {
+ // remove ourselves as an observer
+ LLAvatarPropertiesProcessor::getInstance()->
+ removeObserver(mAvatarID, this);
+ }
+
+ void processProperties(void* data, EAvatarProcessorType type)
+ {
+ // route the data to the inspector
+ if (data
+ && type == APT_PROPERTIES)
+ {
+ LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
+ mInspector->processAvatarData(avatar_data);
+ }
+ }
+
+ // Store avatar ID so we can un-register the observer on destruction
+ LLUUID mAvatarID;
+ LLInspectAvatar* mInspector;
};
LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
-: LLInspect( LLSD() ), // single_instance, doesn't really need key
- mAvatarID(), // set in onOpen() *Note: we used to show partner's name but we dont anymore --angela 3rd Dec*
- mAvatarName(),
- mPropertiesRequest(NULL),
- mAvatarNameCacheConnection()
+: LLInspect( LLSD() ), // single_instance, doesn't really need key
+ mAvatarID(), // set in onOpen() *Note: we used to show partner's name but we dont anymore --angela 3rd Dec*
+ mAvatarName(),
+ mPropertiesRequest(NULL),
+ mAvatarNameCacheConnection()
{
- // can't make the properties request until the widgets are constructed
- // as it might return immediately, so do it in onOpen.
+ // can't make the properties request until the widgets are constructed
+ // as it might return immediately, so do it in onOpen.
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this);
- LLTransientFloater::init(this);
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this);
+ LLTransientFloater::init(this);
}
LLInspectAvatar::~LLInspectAvatar()
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- // clean up any pending requests so they don't call back into a deleted
- // view
- delete mPropertiesRequest;
- mPropertiesRequest = NULL;
-
- LLTransientFloaterMgr::getInstance()->removeControlView(this);
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ // clean up any pending requests so they don't call back into a deleted
+ // view
+ delete mPropertiesRequest;
+ mPropertiesRequest = NULL;
+
+ LLTransientFloaterMgr::getInstance()->removeControlView(this);
}
/*virtual*/
BOOL LLInspectAvatar::postBuild(void)
{
- getChild<LLUICtrl>("mute_btn")->setCommitCallback(
- boost::bind(&LLInspectAvatar::onClickMuteVolume, this) );
+ getChild<LLUICtrl>("mute_btn")->setCommitCallback(
+ boost::bind(&LLInspectAvatar::onClickMuteVolume, this) );
- getChild<LLUICtrl>("volume_slider")->setCommitCallback(
- boost::bind(&LLInspectAvatar::onVolumeChange, this, _2));
+ getChild<LLUICtrl>("volume_slider")->setCommitCallback(
+ boost::bind(&LLInspectAvatar::onVolumeChange, this, _2));
- return TRUE;
+ return TRUE;
}
// Multiple calls to showInstance("inspect_avatar", foo) will provide different
@@ -195,194 +195,194 @@ BOOL LLInspectAvatar::postBuild(void)
//virtual
void LLInspectAvatar::onOpen(const LLSD& data)
{
- // Start open animation
- LLInspect::onOpen(data);
+ // Start open animation
+ LLInspect::onOpen(data);
- // Extract appropriate avatar id
- mAvatarID = data["avatar_id"];
+ // Extract appropriate avatar id
+ mAvatarID = data["avatar_id"];
- LLInspect::repositionInspector(data);
+ LLInspect::repositionInspector(data);
- // Generate link to avatar profile.
- LLTextBase* avatar_profile_link = getChild<LLTextBase>("avatar_profile_link");
- avatar_profile_link->setTextArg("[LINK]", LLSLURL("agent", mAvatarID, "about").getSLURLString());
- avatar_profile_link->setIsFriendCallback(LLAvatarActions::isFriend);
+ // Generate link to avatar profile.
+ LLTextBase* avatar_profile_link = getChild<LLTextBase>("avatar_profile_link");
+ avatar_profile_link->setTextArg("[LINK]", LLSLURL("agent", mAvatarID, "about").getSLURLString());
+ avatar_profile_link->setIsFriendCallback(LLAvatarActions::isFriend);
- // can't call from constructor as widgets are not built yet
- requestUpdate();
+ // can't call from constructor as widgets are not built yet
+ requestUpdate();
- updateVolumeSlider();
+ updateVolumeSlider();
}
void LLInspectAvatar::requestUpdate()
{
- // Don't make network requests when spawning from the debug menu at the
- // login screen (which is useful to work on the layout).
- if (mAvatarID.isNull())
- {
- if (LLStartUp::getStartupState() >= STATE_STARTED)
- {
- // once we're running we don't want to show the test floater
- // for bogus LLUUID::null links
- closeFloater();
- }
- return;
- }
-
- // Clear out old data so it doesn't flash between old and new
- getChild<LLUICtrl>("user_name")->setValue("");
- getChild<LLUICtrl>("user_name_small")->setValue("");
- getChild<LLUICtrl>("user_slid")->setValue("");
- getChild<LLUICtrl>("user_subtitle")->setValue("");
- getChild<LLUICtrl>("user_details")->setValue("");
-
- // Make a new request for properties
- delete mPropertiesRequest;
- mPropertiesRequest = new LLFetchAvatarData(mAvatarID, this);
-
- // Use an avatar_icon even though the image id will come down with the
- // avatar properties because the avatar_icon code maintains a cache of icons
- // and this may result in the image being visible sooner.
- // *NOTE: This may generate a duplicate avatar properties request, but that
- // will be suppressed internally in the avatar properties processor.
-
- //remove avatar id from cache to get fresh info
- LLAvatarIconIDCache::getInstance()->remove(mAvatarID);
-
- getChild<LLUICtrl>("avatar_icon")->setValue(LLSD(mAvatarID) );
-
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarID,boost::bind(&LLInspectAvatar::onAvatarNameCache,this, _1, _2));
+ // Don't make network requests when spawning from the debug menu at the
+ // login screen (which is useful to work on the layout).
+ if (mAvatarID.isNull())
+ {
+ if (LLStartUp::getStartupState() >= STATE_STARTED)
+ {
+ // once we're running we don't want to show the test floater
+ // for bogus LLUUID::null links
+ closeFloater();
+ }
+ return;
+ }
+
+ // Clear out old data so it doesn't flash between old and new
+ getChild<LLUICtrl>("user_name")->setValue("");
+ getChild<LLUICtrl>("user_name_small")->setValue("");
+ getChild<LLUICtrl>("user_slid")->setValue("");
+ getChild<LLUICtrl>("user_subtitle")->setValue("");
+ getChild<LLUICtrl>("user_details")->setValue("");
+
+ // Make a new request for properties
+ delete mPropertiesRequest;
+ mPropertiesRequest = new LLFetchAvatarData(mAvatarID, this);
+
+ // Use an avatar_icon even though the image id will come down with the
+ // avatar properties because the avatar_icon code maintains a cache of icons
+ // and this may result in the image being visible sooner.
+ // *NOTE: This may generate a duplicate avatar properties request, but that
+ // will be suppressed internally in the avatar properties processor.
+
+ //remove avatar id from cache to get fresh info
+ LLAvatarIconIDCache::getInstance()->remove(mAvatarID);
+
+ getChild<LLUICtrl>("avatar_icon")->setValue(LLSD(mAvatarID) );
+
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarID,boost::bind(&LLInspectAvatar::onAvatarNameCache,this, _1, _2));
}
void LLInspectAvatar::processAvatarData(LLAvatarData* data)
{
- LLStringUtil::format_map_t args;
- {
- std::string birth_date = LLTrans::getString("AvatarBirthDateFormat");
- LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) data->born_on.secondsSinceEpoch()));
- args["[BORN_ON]"] = birth_date;
- }
- args["[AGE]"] = LLDateUtil::ageFromDate(data->born_on, LLDate::now());
- args["[SL_PROFILE]"] = data->about_text;
- args["[RW_PROFILE"] = data->fl_about_text;
- args["[ACCTTYPE]"] = LLAvatarPropertiesProcessor::accountType(data);
- std::string payment_info = LLAvatarPropertiesProcessor::paymentInfo(data);
- args["[PAYMENTINFO]"] = payment_info;
- args["[COMMA]"] = (payment_info.empty() ? "" : ",");
-
- std::string subtitle = getString("Subtitle", args);
- getChild<LLUICtrl>("user_subtitle")->setValue( LLSD(subtitle) );
- std::string details = getString("Details", args);
- getChild<LLUICtrl>("user_details")->setValue( LLSD(details) );
-
- // Delete the request object as it has been satisfied
- delete mPropertiesRequest;
- mPropertiesRequest = NULL;
+ LLStringUtil::format_map_t args;
+ {
+ std::string birth_date = LLTrans::getString("AvatarBirthDateFormat");
+ LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) data->born_on.secondsSinceEpoch()));
+ args["[BORN_ON]"] = birth_date;
+ }
+ args["[AGE]"] = LLDateUtil::ageFromDate(data->born_on, LLDate::now());
+ args["[SL_PROFILE]"] = data->about_text;
+ args["[RW_PROFILE"] = data->fl_about_text;
+ args["[ACCTTYPE]"] = LLAvatarPropertiesProcessor::accountType(data);
+ std::string payment_info = LLAvatarPropertiesProcessor::paymentInfo(data);
+ args["[PAYMENTINFO]"] = payment_info;
+ args["[COMMA]"] = (payment_info.empty() ? "" : ",");
+
+ std::string subtitle = getString("Subtitle", args);
+ getChild<LLUICtrl>("user_subtitle")->setValue( LLSD(subtitle) );
+ std::string details = getString("Details", args);
+ getChild<LLUICtrl>("user_details")->setValue( LLSD(details) );
+
+ // Delete the request object as it has been satisfied
+ delete mPropertiesRequest;
+ mPropertiesRequest = NULL;
}
void LLInspectAvatar::updateVolumeSlider()
{
- bool voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled(mAvatarID);
-
- // Do not display volume slider and mute button if it
- // is ourself or we are not in a voice channel together
- if (!voice_enabled || (mAvatarID == gAgent.getID()))
- {
- getChild<LLUICtrl>("mute_btn")->setVisible(false);
- getChild<LLUICtrl>("volume_slider")->setVisible(false);
- }
-
- else
- {
- getChild<LLUICtrl>("mute_btn")->setVisible(true);
- getChild<LLUICtrl>("volume_slider")->setVisible(true);
-
- // By convention, we only display and toggle voice mutes, not all mutes
- bool is_muted = LLAvatarActions::isVoiceMuted(mAvatarID);
-
- LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn");
-
- bool is_linden = LLStringUtil::endsWith(mAvatarName.getDisplayName(), " Linden");
-
- mute_btn->setEnabled( !is_linden);
- mute_btn->setValue( is_muted );
-
- LLUICtrl* volume_slider = getChild<LLUICtrl>("volume_slider");
- volume_slider->setEnabled( !is_muted );
-
- F32 volume;
-
- if (is_muted)
- {
- // it's clearer to display their volume as zero
- volume = 0.f;
- }
- else
- {
- // actual volume
- volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID);
- }
- volume_slider->setValue( (F64)volume );
- }
+ bool voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled(mAvatarID);
+
+ // Do not display volume slider and mute button if it
+ // is ourself or we are not in a voice channel together
+ if (!voice_enabled || (mAvatarID == gAgent.getID()))
+ {
+ getChild<LLUICtrl>("mute_btn")->setVisible(false);
+ getChild<LLUICtrl>("volume_slider")->setVisible(false);
+ }
+
+ else
+ {
+ getChild<LLUICtrl>("mute_btn")->setVisible(true);
+ getChild<LLUICtrl>("volume_slider")->setVisible(true);
+
+ // By convention, we only display and toggle voice mutes, not all mutes
+ bool is_muted = LLAvatarActions::isVoiceMuted(mAvatarID);
+
+ LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn");
+
+ bool is_linden = LLStringUtil::endsWith(mAvatarName.getDisplayName(), " Linden");
+
+ mute_btn->setEnabled( !is_linden);
+ mute_btn->setValue( is_muted );
+
+ LLUICtrl* volume_slider = getChild<LLUICtrl>("volume_slider");
+ volume_slider->setEnabled( !is_muted );
+
+ F32 volume;
+
+ if (is_muted)
+ {
+ // it's clearer to display their volume as zero
+ volume = 0.f;
+ }
+ else
+ {
+ // actual volume
+ volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID);
+ }
+ volume_slider->setValue( (F64)volume );
+ }
}
void LLInspectAvatar::onClickMuteVolume()
{
- // By convention, we only display and toggle voice mutes, not all mutes
- LLMuteList* mute_list = LLMuteList::getInstance();
- bool is_muted = mute_list->isMuted(mAvatarID, LLMute::flagVoiceChat);
-
- LLMute mute(mAvatarID, mAvatarName.getUserName(), LLMute::AGENT);
- if (!is_muted)
- {
- mute_list->add(mute, LLMute::flagVoiceChat);
- }
- else
- {
- mute_list->remove(mute, LLMute::flagVoiceChat);
- }
-
- updateVolumeSlider();
+ // By convention, we only display and toggle voice mutes, not all mutes
+ LLMuteList* mute_list = LLMuteList::getInstance();
+ bool is_muted = mute_list->isMuted(mAvatarID, LLMute::flagVoiceChat);
+
+ LLMute mute(mAvatarID, mAvatarName.getUserName(), LLMute::AGENT);
+ if (!is_muted)
+ {
+ mute_list->add(mute, LLMute::flagVoiceChat);
+ }
+ else
+ {
+ mute_list->remove(mute, LLMute::flagVoiceChat);
+ }
+
+ updateVolumeSlider();
}
void LLInspectAvatar::onVolumeChange(const LLSD& data)
{
- F32 volume = (F32)data.asReal();
- LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume);
+ F32 volume = (F32)data.asReal();
+ LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume);
}
void LLInspectAvatar::onAvatarNameCache(
- const LLUUID& agent_id,
- const LLAvatarName& av_name)
+ const LLUUID& agent_id,
+ const LLAvatarName& av_name)
{
- mAvatarNameCacheConnection.disconnect();
-
- if (agent_id == mAvatarID)
- {
- getChild<LLUICtrl>("user_name")->setValue(av_name.getDisplayName());
- getChild<LLUICtrl>("user_name_small")->setValue(av_name.getDisplayName());
- getChild<LLUICtrl>("user_slid")->setValue(av_name.getUserName());
- mAvatarName = av_name;
-
- // show smaller display name if too long to display in regular size
- if (getChild<LLTextBox>("user_name")->getTextPixelWidth() > getChild<LLTextBox>("user_name")->getRect().getWidth())
- {
- getChild<LLUICtrl>("user_name_small")->setVisible( true );
- getChild<LLUICtrl>("user_name")->setVisible( false );
- }
- else
- {
- getChild<LLUICtrl>("user_name_small")->setVisible( false );
- getChild<LLUICtrl>("user_name")->setVisible( true );
-
- }
-
- }
+ mAvatarNameCacheConnection.disconnect();
+
+ if (agent_id == mAvatarID)
+ {
+ getChild<LLUICtrl>("user_name")->setValue(av_name.getDisplayName());
+ getChild<LLUICtrl>("user_name_small")->setValue(av_name.getDisplayName());
+ getChild<LLUICtrl>("user_slid")->setValue(av_name.getUserName());
+ mAvatarName = av_name;
+
+ // show smaller display name if too long to display in regular size
+ if (getChild<LLTextBox>("user_name")->getTextPixelWidth() > getChild<LLTextBox>("user_name")->getRect().getWidth())
+ {
+ getChild<LLUICtrl>("user_name_small")->setVisible( true );
+ getChild<LLUICtrl>("user_name")->setVisible( false );
+ }
+ else
+ {
+ getChild<LLUICtrl>("user_name_small")->setVisible( false );
+ getChild<LLUICtrl>("user_name")->setVisible( true );
+
+ }
+
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -390,6 +390,6 @@ void LLInspectAvatar::onAvatarNameCache(
//////////////////////////////////////////////////////////////////////////////
void LLInspectAvatarUtil::registerFloater()
{
- LLFloaterReg::add("inspect_avatar", "inspect_avatar.xml",
- &LLFloaterReg::build<LLInspectAvatar>);
+ LLFloaterReg::add("inspect_avatar", "inspect_avatar.xml",
+ &LLFloaterReg::build<LLInspectAvatar>);
}
diff --git a/indra/newview/llinspectavatar.h b/indra/newview/llinspectavatar.h
index 4329504b62..89656ce971 100644
--- a/indra/newview/llinspectavatar.h
+++ b/indra/newview/llinspectavatar.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspectavatar.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,8 +28,8 @@
namespace LLInspectAvatarUtil
{
- // Register with LLFloaterReg
- void registerFloater();
+ // Register with LLFloaterReg
+ void registerFloater();
}
#endif
diff --git a/indra/newview/llinspectgroup.cpp b/indra/newview/llinspectgroup.cpp
index 0a30ab9217..db48061c56 100644
--- a/indra/newview/llinspectgroup.cpp
+++ b/indra/newview/llinspectgroup.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspectgroup.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,10 +34,10 @@
#include "llstartup.h"
// Linden libraries
-#include "llcontrol.h" // LLCachedControl
+#include "llcontrol.h" // LLCachedControl
#include "llfloater.h"
#include "llfloaterreg.h"
-#include "llresmgr.h" // getMonetaryString()
+#include "llresmgr.h" // getMonetaryString()
#include "lltrans.h"
#include "lluictrl.h"
#include "llgroupiconctrl.h"
@@ -50,61 +50,61 @@
/// on group names in the 2D UI
class LLInspectGroup : public LLInspect, public LLGroupMgrObserver
{
- friend class LLFloaterReg;
-
+ friend class LLFloaterReg;
+
public:
- // key["group_id"] - Group ID for which to show information
- // Inspector will be positioned relative to current mouse position
- LLInspectGroup(const LLSD& key);
- virtual ~LLInspectGroup();
-
- // Because floater is single instance, need to re-parse data on each spawn
- // (for example, inspector about same group but in different position)
- /*virtual*/ void onOpen(const LLSD& group_id);
-
- void setGroupID(const LLUUID& group_id);
-
- // When closing they should close their gear menu
- /*virtual*/ void onClose(bool app_quitting);
-
- // Update view based on information from group manager
- void processGroupData();
-
- virtual void changed(LLGroupChange gc);
-
- // Make network requests for all the data to display in this view.
- // Used on construction and if avatar id changes.
- void requestUpdate();
-
- // Callback for gCacheName to look up group name
- // Faster than waiting for group properties to return
- void nameUpdatedCallback(const LLUUID& id,
- const std::string& name,
- bool is_group);
-
- // Button/menu callbacks
- void onClickViewProfile();
- void onClickJoin();
- void onClickLeave();
-
+ // key["group_id"] - Group ID for which to show information
+ // Inspector will be positioned relative to current mouse position
+ LLInspectGroup(const LLSD& key);
+ virtual ~LLInspectGroup();
+
+ // Because floater is single instance, need to re-parse data on each spawn
+ // (for example, inspector about same group but in different position)
+ /*virtual*/ void onOpen(const LLSD& group_id);
+
+ void setGroupID(const LLUUID& group_id);
+
+ // When closing they should close their gear menu
+ /*virtual*/ void onClose(bool app_quitting);
+
+ // Update view based on information from group manager
+ void processGroupData();
+
+ virtual void changed(LLGroupChange gc);
+
+ // Make network requests for all the data to display in this view.
+ // Used on construction and if avatar id changes.
+ void requestUpdate();
+
+ // Callback for gCacheName to look up group name
+ // Faster than waiting for group properties to return
+ void nameUpdatedCallback(const LLUUID& id,
+ const std::string& name,
+ bool is_group);
+
+ // Button/menu callbacks
+ void onClickViewProfile();
+ void onClickJoin();
+ void onClickLeave();
+
private:
- LLUUID mGroupID;
+ LLUUID mGroupID;
};
LLInspectGroup::LLInspectGroup(const LLSD& sd)
-: LLInspect( LLSD() ), // single_instance, doesn't really need key
- mGroupID() // set in onOpen()
+: LLInspect( LLSD() ), // single_instance, doesn't really need key
+ mGroupID() // set in onOpen()
{
- mCommitCallbackRegistrar.add("InspectGroup.ViewProfile",
- boost::bind(&LLInspectGroup::onClickViewProfile, this));
- mCommitCallbackRegistrar.add("InspectGroup.Join",
- boost::bind(&LLInspectGroup::onClickJoin, this));
- mCommitCallbackRegistrar.add("InspectGroup.Leave",
- boost::bind(&LLInspectGroup::onClickLeave, this));
-
- // can't make the properties request until the widgets are constructed
- // as it might return immediately, so do it in postBuild.
+ mCommitCallbackRegistrar.add("InspectGroup.ViewProfile",
+ boost::bind(&LLInspectGroup::onClickViewProfile, this));
+ mCommitCallbackRegistrar.add("InspectGroup.Join",
+ boost::bind(&LLInspectGroup::onClickJoin, this));
+ mCommitCallbackRegistrar.add("InspectGroup.Leave",
+ boost::bind(&LLInspectGroup::onClickLeave, this));
+
+ // can't make the properties request until the widgets are constructed
+ // as it might return immediately, so do it in postBuild.
}
LLInspectGroup::~LLInspectGroup()
@@ -118,15 +118,15 @@ LLInspectGroup::~LLInspectGroup()
//virtual
void LLInspectGroup::onOpen(const LLSD& data)
{
- // start fade animation
- LLInspect::onOpen(data);
+ // start fade animation
+ LLInspect::onOpen(data);
- setGroupID(data["group_id"]);
+ setGroupID(data["group_id"]);
- LLInspect::repositionInspector(data);
+ LLInspect::repositionInspector(data);
- // can't call from constructor as widgets are not built yet
- requestUpdate();
+ // can't call from constructor as widgets are not built yet
+ requestUpdate();
}
// virtual
@@ -134,47 +134,47 @@ void LLInspectGroup::onClose(bool app_quitting)
{
LLGroupMgr::getInstance()->removeObserver(this);
// *TODO: If we add a gear menu, close it here
-}
+}
void LLInspectGroup::requestUpdate()
{
- // Don't make network requests when spawning from the debug menu at the
- // login screen (which is useful to work on the layout).
- if (mGroupID.isNull())
- {
- if (LLStartUp::getStartupState() >= STATE_STARTED)
- {
- // once we're running we don't want to show the test floater
- // for bogus LLUUID::null links
- closeFloater();
- }
- return;
- }
-
- // Clear out old data so it doesn't flash between old and new
- getChild<LLUICtrl>("group_name")->setValue("");
- getChild<LLUICtrl>("group_subtitle")->setValue("");
- getChild<LLUICtrl>("group_details")->setValue("");
- getChild<LLUICtrl>("group_cost")->setValue("");
- // Must have a visible button so the inspector can take focus
- getChild<LLUICtrl>("view_profile_btn")->setVisible(true);
- getChild<LLUICtrl>("leave_btn")->setVisible(false);
- getChild<LLUICtrl>("join_btn")->setVisible(false);
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap || !gdatap->isGroupPropertiesDataComplete() )
- {
- LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID);
- }
- else
- {
- processGroupData();
- }
-
- // Name lookup will be faster out of cache, use that
- gCacheName->getGroup(mGroupID,
- boost::bind(&LLInspectGroup::nameUpdatedCallback,
- this, _1, _2, _3));
+ // Don't make network requests when spawning from the debug menu at the
+ // login screen (which is useful to work on the layout).
+ if (mGroupID.isNull())
+ {
+ if (LLStartUp::getStartupState() >= STATE_STARTED)
+ {
+ // once we're running we don't want to show the test floater
+ // for bogus LLUUID::null links
+ closeFloater();
+ }
+ return;
+ }
+
+ // Clear out old data so it doesn't flash between old and new
+ getChild<LLUICtrl>("group_name")->setValue("");
+ getChild<LLUICtrl>("group_subtitle")->setValue("");
+ getChild<LLUICtrl>("group_details")->setValue("");
+ getChild<LLUICtrl>("group_cost")->setValue("");
+ // Must have a visible button so the inspector can take focus
+ getChild<LLUICtrl>("view_profile_btn")->setVisible(true);
+ getChild<LLUICtrl>("leave_btn")->setVisible(false);
+ getChild<LLUICtrl>("join_btn")->setVisible(false);
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap || !gdatap->isGroupPropertiesDataComplete() )
+ {
+ LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID);
+ }
+ else
+ {
+ processGroupData();
+ }
+
+ // Name lookup will be faster out of cache, use that
+ gCacheName->getGroup(mGroupID,
+ boost::bind(&LLInspectGroup::nameUpdatedCallback,
+ this, _1, _2, _3));
}
void LLInspectGroup::setGroupID(const LLUUID& group_id)
@@ -188,16 +188,16 @@ void LLInspectGroup::setGroupID(const LLUUID& group_id)
}
void LLInspectGroup::nameUpdatedCallback(
- const LLUUID& id,
- const std::string& name,
- bool is_group)
+ const LLUUID& id,
+ const std::string& name,
+ bool is_group)
{
- if (id == mGroupID)
- {
- getChild<LLUICtrl>("group_name")->setValue(LLSD("<nolink>" + name + "</nolink>"));
- }
-
- // Otherwise possibly a request for an older inspector, ignore it
+ if (id == mGroupID)
+ {
+ getChild<LLUICtrl>("group_name")->setValue(LLSD("<nolink>" + name + "</nolink>"));
+ }
+
+ // Otherwise possibly a request for an older inspector, ignore it
}
void LLInspectGroup::changed(LLGroupChange gc)
@@ -210,74 +210,74 @@ void LLInspectGroup::changed(LLGroupChange gc)
void LLInspectGroup::processGroupData()
{
- LLGroupMgrGroupData* data =
- LLGroupMgr::getInstance()->getGroupData(mGroupID);
-
- if (data)
- {
- // Noun pluralization depends on language
- std::string lang = LLUI::getLanguage();
- std::string members =
- LLTrans::getCountString(lang, "GroupMembers", data->mMemberCount);
- getChild<LLUICtrl>("group_subtitle")->setValue( LLSD(members) );
-
- getChild<LLUICtrl>("group_details")->setValue( LLSD(data->mCharter) );
-
- getChild<LLGroupIconCtrl>("group_icon")->setIconId(data->mInsigniaID);
-
- std::string cost;
- bool is_member = LLGroupActions::isInGroup(mGroupID);
- if (is_member)
- {
- cost = getString("YouAreMember");
- }
- else if (data->mOpenEnrollment)
- {
- if (data->mMembershipFee == 0)
- {
- cost = getString("FreeToJoin");
- }
- else
- {
- std::string amount =
- LLResMgr::getInstance()->getMonetaryString(
- data->mMembershipFee);
- LLStringUtil::format_map_t args;
- args["[AMOUNT]"] = amount;
- cost = getString("CostToJoin", args);
- }
- }
- else
- {
- cost = getString("PrivateGroup");
- }
- getChild<LLUICtrl>("group_cost")->setValue(cost);
-
- getChild<LLUICtrl>("join_btn")->setVisible(!is_member);
- getChild<LLUICtrl>("leave_btn")->setVisible(is_member);
-
- // Only enable join button if you are allowed to join
- bool can_join = !is_member && data->mOpenEnrollment;
- getChild<LLUICtrl>("join_btn")->setEnabled(can_join);
- }
+ LLGroupMgrGroupData* data =
+ LLGroupMgr::getInstance()->getGroupData(mGroupID);
+
+ if (data)
+ {
+ // Noun pluralization depends on language
+ std::string lang = LLUI::getLanguage();
+ std::string members =
+ LLTrans::getCountString(lang, "GroupMembers", data->mMemberCount);
+ getChild<LLUICtrl>("group_subtitle")->setValue( LLSD(members) );
+
+ getChild<LLUICtrl>("group_details")->setValue( LLSD(data->mCharter) );
+
+ getChild<LLGroupIconCtrl>("group_icon")->setIconId(data->mInsigniaID);
+
+ std::string cost;
+ bool is_member = LLGroupActions::isInGroup(mGroupID);
+ if (is_member)
+ {
+ cost = getString("YouAreMember");
+ }
+ else if (data->mOpenEnrollment)
+ {
+ if (data->mMembershipFee == 0)
+ {
+ cost = getString("FreeToJoin");
+ }
+ else
+ {
+ std::string amount =
+ LLResMgr::getInstance()->getMonetaryString(
+ data->mMembershipFee);
+ LLStringUtil::format_map_t args;
+ args["[AMOUNT]"] = amount;
+ cost = getString("CostToJoin", args);
+ }
+ }
+ else
+ {
+ cost = getString("PrivateGroup");
+ }
+ getChild<LLUICtrl>("group_cost")->setValue(cost);
+
+ getChild<LLUICtrl>("join_btn")->setVisible(!is_member);
+ getChild<LLUICtrl>("leave_btn")->setVisible(is_member);
+
+ // Only enable join button if you are allowed to join
+ bool can_join = !is_member && data->mOpenEnrollment;
+ getChild<LLUICtrl>("join_btn")->setEnabled(can_join);
+ }
}
void LLInspectGroup::onClickViewProfile()
{
- closeFloater();
- LLGroupActions::show(mGroupID);
+ closeFloater();
+ LLGroupActions::show(mGroupID);
}
void LLInspectGroup::onClickJoin()
{
- closeFloater();
- LLGroupActions::join(mGroupID);
+ closeFloater();
+ LLGroupActions::join(mGroupID);
}
void LLInspectGroup::onClickLeave()
{
- closeFloater();
- LLGroupActions::leave(mGroupID);
+ closeFloater();
+ LLGroupActions::leave(mGroupID);
}
//////////////////////////////////////////////////////////////////////////////
@@ -285,6 +285,6 @@ void LLInspectGroup::onClickLeave()
//////////////////////////////////////////////////////////////////////////////
void LLInspectGroupUtil::registerFloater()
{
- LLFloaterReg::add("inspect_group", "inspect_group.xml",
- &LLFloaterReg::build<LLInspectGroup>);
+ LLFloaterReg::add("inspect_group", "inspect_group.xml",
+ &LLFloaterReg::build<LLInspectGroup>);
}
diff --git a/indra/newview/llinspectgroup.h b/indra/newview/llinspectgroup.h
index 8b135a465e..f4338b183d 100644
--- a/indra/newview/llinspectgroup.h
+++ b/indra/newview/llinspectgroup.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspectgroup.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,8 +28,8 @@
namespace LLInspectGroupUtil
{
- // Register with LLFloaterReg
- void registerFloater();
+ // Register with LLFloaterReg
+ void registerFloater();
}
#endif
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp
index 491c90c571..eccc359a3a 100644
--- a/indra/newview/llinspectobject.cpp
+++ b/indra/newview/llinspectobject.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspectobject.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,20 +34,20 @@
#include "llmediaentry.h"
#include "llselectmgr.h"
#include "llslurl.h"
-#include "llviewermenu.h" // handle_object_touch(), handle_buy()
+#include "llviewermenu.h" // handle_object_touch(), handle_buy()
#include "llviewermedia.h"
#include "llviewermediafocus.h"
-#include "llviewerobjectlist.h" // to select the requested object
+#include "llviewerobjectlist.h" // to select the requested object
#include "llvoavatarself.h"
// Linden libraries
-#include "llbutton.h" // setLabel(), not virtual!
+#include "llbutton.h" // setLabel(), not virtual!
#include "llclickaction.h"
#include "llfloaterreg.h"
#include "llmenubutton.h"
-#include "llresmgr.h" // getMonetaryString
+#include "llresmgr.h" // getMonetaryString
#include "llsafehandle.h"
-#include "lltextbox.h" // for description truncation
+#include "lltextbox.h" // for description truncation
#include "lltoggleablemenu.h"
#include "lltrans.h"
#include "lluictrl.h"
@@ -62,81 +62,81 @@ class LLViewerObject;
// in the ambient inspector widget for objects in the 3D world.
class LLInspectObject : public LLInspect
{
- friend class LLFloaterReg;
-
+ friend class LLFloaterReg;
+
public:
- // object_id - Root object ID for which to show information
- // Inspector will be positioned relative to current mouse position
- LLInspectObject(const LLSD& object_id);
- virtual ~LLInspectObject();
-
- /*virtual*/ BOOL postBuild(void);
-
- // Because floater is single instance, need to re-parse data on each spawn
- // (for example, inspector about same avatar but in different position)
- /*virtual*/ void onOpen(const LLSD& avatar_id);
-
- // Release the selection and do other cleanup
- /*virtual*/ void onClose(bool app_quitting);
-
- // override the inspector mouse leave so timer is only paused if
- // gear menu is not open
- /* virtual */ void onMouseLeave(S32 x, S32 y, MASK mask);
-
+ // object_id - Root object ID for which to show information
+ // Inspector will be positioned relative to current mouse position
+ LLInspectObject(const LLSD& object_id);
+ virtual ~LLInspectObject();
+
+ /*virtual*/ BOOL postBuild(void);
+
+ // Because floater is single instance, need to re-parse data on each spawn
+ // (for example, inspector about same avatar but in different position)
+ /*virtual*/ void onOpen(const LLSD& avatar_id);
+
+ // Release the selection and do other cleanup
+ /*virtual*/ void onClose(bool app_quitting);
+
+ // override the inspector mouse leave so timer is only paused if
+ // gear menu is not open
+ /* virtual */ void onMouseLeave(S32 x, S32 y, MASK mask);
+
private:
- // Refresh displayed data with information from selection manager
- void update();
-
- void hideButtons();
- void updateButtons(LLSelectNode* nodep);
- void updateSitLabel(LLSelectNode* nodep);
- void updateTouchLabel(LLSelectNode* nodep);
-
- void updateName(LLSelectNode* nodep);
- void updateDescription(LLSelectNode* nodep);
- void updatePrice(LLSelectNode* nodep);
- void updateCreator(LLSelectNode* nodep);
-
- void updateMediaCurrentURL();
- void updateSecureBrowsing();
-
- void onClickBuy();
- void onClickPay();
- void onClickTakeFreeCopy();
- void onClickTouch();
- void onClickSit();
- void onClickOpen();
- void onClickMoreInfo();
- void onClickZoomIn();
-
+ // Refresh displayed data with information from selection manager
+ void update();
+
+ void hideButtons();
+ void updateButtons(LLSelectNode* nodep);
+ void updateSitLabel(LLSelectNode* nodep);
+ void updateTouchLabel(LLSelectNode* nodep);
+
+ void updateName(LLSelectNode* nodep);
+ void updateDescription(LLSelectNode* nodep);
+ void updatePrice(LLSelectNode* nodep);
+ void updateCreator(LLSelectNode* nodep);
+
+ void updateMediaCurrentURL();
+ void updateSecureBrowsing();
+
+ void onClickBuy();
+ void onClickPay();
+ void onClickTakeFreeCopy();
+ void onClickTouch();
+ void onClickSit();
+ void onClickOpen();
+ void onClickMoreInfo();
+ void onClickZoomIn();
+
private:
- LLUUID mObjectID;
- LLUUID mPreviousObjectID;
- S32 mObjectFace;
- viewer_media_t mMediaImpl;
- LLMediaEntry* mMediaEntry;
- LLSafeHandle<LLObjectSelection> mObjectSelection;
+ LLUUID mObjectID;
+ LLUUID mPreviousObjectID;
+ S32 mObjectFace;
+ viewer_media_t mMediaImpl;
+ LLMediaEntry* mMediaEntry;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
boost::signals2::connection mSelectionUpdateSlot;
};
LLInspectObject::LLInspectObject(const LLSD& sd)
-: LLInspect( LLSD() ), // single_instance, doesn't really need key
- mObjectID(NULL), // set in onOpen()
- mObjectFace(0),
- mObjectSelection(NULL),
- mMediaImpl(NULL),
- mMediaEntry(NULL)
+: LLInspect( LLSD() ), // single_instance, doesn't really need key
+ mObjectID(NULL), // set in onOpen()
+ mObjectFace(0),
+ mObjectSelection(NULL),
+ mMediaImpl(NULL),
+ mMediaEntry(NULL)
{
- // can't make the properties request until the widgets are constructed
- // as it might return immediately, so do it in postBuild.
- mCommitCallbackRegistrar.add("InspectObject.Buy", boost::bind(&LLInspectObject::onClickBuy, this));
- mCommitCallbackRegistrar.add("InspectObject.Pay", boost::bind(&LLInspectObject::onClickPay, this));
- mCommitCallbackRegistrar.add("InspectObject.TakeFreeCopy", boost::bind(&LLInspectObject::onClickTakeFreeCopy, this));
- mCommitCallbackRegistrar.add("InspectObject.Touch", boost::bind(&LLInspectObject::onClickTouch, this));
- mCommitCallbackRegistrar.add("InspectObject.Sit", boost::bind(&LLInspectObject::onClickSit, this));
- mCommitCallbackRegistrar.add("InspectObject.Open", boost::bind(&LLInspectObject::onClickOpen, this));
- mCommitCallbackRegistrar.add("InspectObject.MoreInfo", boost::bind(&LLInspectObject::onClickMoreInfo, this));
- mCommitCallbackRegistrar.add("InspectObject.ZoomIn", boost::bind(&LLInspectObject::onClickZoomIn, this));
+ // can't make the properties request until the widgets are constructed
+ // as it might return immediately, so do it in postBuild.
+ mCommitCallbackRegistrar.add("InspectObject.Buy", boost::bind(&LLInspectObject::onClickBuy, this));
+ mCommitCallbackRegistrar.add("InspectObject.Pay", boost::bind(&LLInspectObject::onClickPay, this));
+ mCommitCallbackRegistrar.add("InspectObject.TakeFreeCopy", boost::bind(&LLInspectObject::onClickTakeFreeCopy, this));
+ mCommitCallbackRegistrar.add("InspectObject.Touch", boost::bind(&LLInspectObject::onClickTouch, this));
+ mCommitCallbackRegistrar.add("InspectObject.Sit", boost::bind(&LLInspectObject::onClickSit, this));
+ mCommitCallbackRegistrar.add("InspectObject.Open", boost::bind(&LLInspectObject::onClickOpen, this));
+ mCommitCallbackRegistrar.add("InspectObject.MoreInfo", boost::bind(&LLInspectObject::onClickMoreInfo, this));
+ mCommitCallbackRegistrar.add("InspectObject.ZoomIn", boost::bind(&LLInspectObject::onClickZoomIn, this));
}
@@ -151,34 +151,34 @@ LLInspectObject::~LLInspectObject()
/*virtual*/
BOOL LLInspectObject::postBuild(void)
{
- // The XML file has sample data in it. Clear that out so we don't
- // flicker when data arrives off network.
- getChild<LLUICtrl>("object_name")->setValue("");
- getChild<LLUICtrl>("object_creator")->setValue("");
- getChild<LLUICtrl>("object_description")->setValue("");
- getChild<LLUICtrl>("object_media_url")->setValue("");
- // Set buttons invisible until we know what this object can do
- hideButtons();
-
- // Hide floater when name links clicked
- LLTextBox* textbox = getChild<LLTextBox>("object_creator");
- textbox->setURLClickedCallback(boost::bind(&LLInspectObject::closeFloater, this, false) );
-
- // Hook up functionality
- getChild<LLUICtrl>("buy_btn")->setCommitCallback(
- boost::bind(&LLInspectObject::onClickBuy, this));
- getChild<LLUICtrl>("pay_btn")->setCommitCallback(
- boost::bind(&LLInspectObject::onClickPay, this));
- getChild<LLUICtrl>("take_free_copy_btn")->setCommitCallback(
- boost::bind(&LLInspectObject::onClickTakeFreeCopy, this));
- getChild<LLUICtrl>("touch_btn")->setCommitCallback(
- boost::bind(&LLInspectObject::onClickTouch, this));
- getChild<LLUICtrl>("sit_btn")->setCommitCallback(
- boost::bind(&LLInspectObject::onClickSit, this));
- getChild<LLUICtrl>("open_btn")->setCommitCallback(
- boost::bind(&LLInspectObject::onClickOpen, this));
- getChild<LLUICtrl>("more_info_btn")->setCommitCallback(
- boost::bind(&LLInspectObject::onClickMoreInfo, this));
+ // The XML file has sample data in it. Clear that out so we don't
+ // flicker when data arrives off network.
+ getChild<LLUICtrl>("object_name")->setValue("");
+ getChild<LLUICtrl>("object_creator")->setValue("");
+ getChild<LLUICtrl>("object_description")->setValue("");
+ getChild<LLUICtrl>("object_media_url")->setValue("");
+ // Set buttons invisible until we know what this object can do
+ hideButtons();
+
+ // Hide floater when name links clicked
+ LLTextBox* textbox = getChild<LLTextBox>("object_creator");
+ textbox->setURLClickedCallback(boost::bind(&LLInspectObject::closeFloater, this, false) );
+
+ // Hook up functionality
+ getChild<LLUICtrl>("buy_btn")->setCommitCallback(
+ boost::bind(&LLInspectObject::onClickBuy, this));
+ getChild<LLUICtrl>("pay_btn")->setCommitCallback(
+ boost::bind(&LLInspectObject::onClickPay, this));
+ getChild<LLUICtrl>("take_free_copy_btn")->setCommitCallback(
+ boost::bind(&LLInspectObject::onClickTakeFreeCopy, this));
+ getChild<LLUICtrl>("touch_btn")->setCommitCallback(
+ boost::bind(&LLInspectObject::onClickTouch, this));
+ getChild<LLUICtrl>("sit_btn")->setCommitCallback(
+ boost::bind(&LLInspectObject::onClickSit, this));
+ getChild<LLUICtrl>("open_btn")->setCommitCallback(
+ boost::bind(&LLInspectObject::onClickOpen, this));
+ getChild<LLUICtrl>("more_info_btn")->setCommitCallback(
+ boost::bind(&LLInspectObject::onClickMoreInfo, this));
if (!mSelectionUpdateSlot.connected())
{
@@ -187,7 +187,7 @@ BOOL LLInspectObject::postBuild(void)
boost::bind(&LLInspectObject::update, this));
}
- return TRUE;
+ return TRUE;
}
// Multiple calls to showInstance("inspect_avatar", foo) will provide different
@@ -195,124 +195,124 @@ BOOL LLInspectObject::postBuild(void)
//virtual
void LLInspectObject::onOpen(const LLSD& data)
{
- // Start animation
- LLInspect::onOpen(data);
-
- // Extract appropriate avatar id
- mObjectID = data["object_id"];
-
- if(data.has("object_face"))
- {
- mObjectFace = data["object_face"];
- }
-
- LLInspect::repositionInspector(data);
-
- // Promote hovered object to a complete selection, which will also force
- // a request for selected object data off the network
- LLViewerObject* obj = gObjectList.findObject( mObjectID );
- if (obj)
- {
- // Media focus and this code fight over the select manager.
- // Make sure any media is unfocused before changing the selection here.
- LLViewerMediaFocus::getInstance()->clearFocus();
-
- LLSelectMgr::instance().deselectAll();
- mObjectSelection = LLSelectMgr::instance().selectObjectAndFamily(obj,FALSE,TRUE);
-
- // Mark this as a transient selection
- struct SetTransient : public LLSelectedNodeFunctor
- {
- bool apply(LLSelectNode* node)
- {
- node->setTransient(TRUE);
- return true;
- }
- } functor;
- mObjectSelection->applyToNodes(&functor);
-
- // Does this face have media?
- const LLTextureEntry* tep = obj->getTE(mObjectFace);
- if (!tep)
- return;
-
- mMediaEntry = tep->hasMedia() ? tep->getMediaData() : NULL;
- if(!mMediaEntry)
- return;
-
- mMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mMediaEntry->getMediaID());
- }
+ // Start animation
+ LLInspect::onOpen(data);
+
+ // Extract appropriate avatar id
+ mObjectID = data["object_id"];
+
+ if(data.has("object_face"))
+ {
+ mObjectFace = data["object_face"];
+ }
+
+ LLInspect::repositionInspector(data);
+
+ // Promote hovered object to a complete selection, which will also force
+ // a request for selected object data off the network
+ LLViewerObject* obj = gObjectList.findObject( mObjectID );
+ if (obj)
+ {
+ // Media focus and this code fight over the select manager.
+ // Make sure any media is unfocused before changing the selection here.
+ LLViewerMediaFocus::getInstance()->clearFocus();
+
+ LLSelectMgr::instance().deselectAll();
+ mObjectSelection = LLSelectMgr::instance().selectObjectAndFamily(obj,FALSE,TRUE);
+
+ // Mark this as a transient selection
+ struct SetTransient : public LLSelectedNodeFunctor
+ {
+ bool apply(LLSelectNode* node)
+ {
+ node->setTransient(TRUE);
+ return true;
+ }
+ } functor;
+ mObjectSelection->applyToNodes(&functor);
+
+ // Does this face have media?
+ const LLTextureEntry* tep = obj->getTE(mObjectFace);
+ if (!tep)
+ return;
+
+ mMediaEntry = tep->hasMedia() ? tep->getMediaData() : NULL;
+ if(!mMediaEntry)
+ return;
+
+ mMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mMediaEntry->getMediaID());
+ }
}
// virtual
void LLInspectObject::onClose(bool app_quitting)
{
- // Release selection to deselect
- mObjectSelection = NULL;
- mPreviousObjectID = mObjectID;
+ // Release selection to deselect
+ mObjectSelection = NULL;
+ mPreviousObjectID = mObjectID;
- getChild<LLMenuButton>("gear_btn")->hideMenu();
+ getChild<LLMenuButton>("gear_btn")->hideMenu();
}
void LLInspectObject::update()
{
- // Performance optimization, because we listen to updates from select mgr
- // but we're never destroyed.
- if (!getVisible()) return;
-
- LLObjectSelection* selection = LLSelectMgr::getInstance()->getSelection();
- if (!selection) return;
-
- LLSelectNode* nodep = selection->getFirstRootNode();
- if (!nodep) return;
-
- // If we don't have fresh object info yet and it's the object we inspected last time,
- // keep showing the previously retrieved data until we get the update.
- if (!nodep->mValid && nodep->getObject()->getID() == mPreviousObjectID)
- {
- return;
- }
-
- updateButtons(nodep);
- updateName(nodep);
- updateDescription(nodep);
- updateCreator(nodep);
- updatePrice(nodep);
-
- LLViewerObject* obj = nodep->getObject();
- if(!obj)
- return;
-
- if ( mObjectFace < 0
- || mObjectFace >= obj->getNumTEs() )
- {
- return;
- }
-
- // Does this face have media?
- const LLTextureEntry* tep = obj->getTE(mObjectFace);
- if (!tep)
- return;
-
- mMediaEntry = tep->hasMedia() ? tep->getMediaData() : NULL;
- if(!mMediaEntry)
- return;
-
- mMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mMediaEntry->getMediaID());
-
- updateMediaCurrentURL();
- updateSecureBrowsing();
+ // Performance optimization, because we listen to updates from select mgr
+ // but we're never destroyed.
+ if (!getVisible()) return;
+
+ LLObjectSelection* selection = LLSelectMgr::getInstance()->getSelection();
+ if (!selection) return;
+
+ LLSelectNode* nodep = selection->getFirstRootNode();
+ if (!nodep) return;
+
+ // If we don't have fresh object info yet and it's the object we inspected last time,
+ // keep showing the previously retrieved data until we get the update.
+ if (!nodep->mValid && nodep->getObject()->getID() == mPreviousObjectID)
+ {
+ return;
+ }
+
+ updateButtons(nodep);
+ updateName(nodep);
+ updateDescription(nodep);
+ updateCreator(nodep);
+ updatePrice(nodep);
+
+ LLViewerObject* obj = nodep->getObject();
+ if(!obj)
+ return;
+
+ if ( mObjectFace < 0
+ || mObjectFace >= obj->getNumTEs() )
+ {
+ return;
+ }
+
+ // Does this face have media?
+ const LLTextureEntry* tep = obj->getTE(mObjectFace);
+ if (!tep)
+ return;
+
+ mMediaEntry = tep->hasMedia() ? tep->getMediaData() : NULL;
+ if(!mMediaEntry)
+ return;
+
+ mMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mMediaEntry->getMediaID());
+
+ updateMediaCurrentURL();
+ updateSecureBrowsing();
}
void LLInspectObject::hideButtons()
{
- getChild<LLUICtrl>("buy_btn")->setVisible(false);
- getChild<LLUICtrl>("pay_btn")->setVisible(false);
- getChild<LLUICtrl>("take_free_copy_btn")->setVisible(false);
- getChild<LLUICtrl>("touch_btn")->setVisible(false);
- getChild<LLUICtrl>("sit_btn")->setVisible(false);
- getChild<LLUICtrl>("open_btn")->setVisible(false);
+ getChild<LLUICtrl>("buy_btn")->setVisible(false);
+ getChild<LLUICtrl>("pay_btn")->setVisible(false);
+ getChild<LLUICtrl>("take_free_copy_btn")->setVisible(false);
+ getChild<LLUICtrl>("touch_btn")->setVisible(false);
+ getChild<LLUICtrl>("sit_btn")->setVisible(false);
+ getChild<LLUICtrl>("open_btn")->setVisible(false);
}
// *TODO: Extract this method from lltoolpie.cpp and put somewhere shared
@@ -322,314 +322,314 @@ extern U8 final_click_action(LLViewerObject*);
// that operation as the left-most button in the inspector.
void LLInspectObject::updateButtons(LLSelectNode* nodep)
{
- // We'll start with everyone hidden and show the ones we need
- hideButtons();
-
- LLViewerObject* object = nodep->getObject();
- LLViewerObject *parent = (LLViewerObject*)object->getParent();
- bool for_copy = anyone_copy_selection(nodep);
- bool for_sale = enable_buy_object();
- S32 price = nodep->mSaleInfo.getSalePrice();
- U8 click_action = final_click_action(object);
-
- if (for_copy
- || (for_sale && price == 0))
- {
- // Free copies have priority over other operations
- getChild<LLUICtrl>("take_free_copy_btn")->setVisible(true);
- }
- else if (for_sale)
- {
- getChild<LLUICtrl>("buy_btn")->setVisible(true);
- }
- else if ( enable_pay_object() )
- {
- getChild<LLUICtrl>("pay_btn")->setVisible(true);
- }
- else if (click_action == CLICK_ACTION_SIT)
- {
- // Click-action sit must come before "open" because many objects on
- // which you can sit have scripts, and hence can be opened
- getChild<LLUICtrl>("sit_btn")->setVisible(true);
- updateSitLabel(nodep);
- }
- else if (object->flagHandleTouch()
- || (parent && parent->flagHandleTouch()))
- {
- getChild<LLUICtrl>("touch_btn")->setVisible(true);
- updateTouchLabel(nodep);
- }
- else if ( enable_object_open() )
- {
- // Open is last because anything with a script in it can be opened
- getChild<LLUICtrl>("open_btn")->setVisible(true);
- }
- else
- {
- // By default, we can sit on anything
- getChild<LLUICtrl>("sit_btn")->setVisible(true);
- updateSitLabel(nodep);
- }
-
- // No flash
- focusFirstItem(FALSE, FALSE);
+ // We'll start with everyone hidden and show the ones we need
+ hideButtons();
+
+ LLViewerObject* object = nodep->getObject();
+ LLViewerObject *parent = (LLViewerObject*)object->getParent();
+ bool for_copy = anyone_copy_selection(nodep);
+ bool for_sale = enable_buy_object();
+ S32 price = nodep->mSaleInfo.getSalePrice();
+ U8 click_action = final_click_action(object);
+
+ if (for_copy
+ || (for_sale && price == 0))
+ {
+ // Free copies have priority over other operations
+ getChild<LLUICtrl>("take_free_copy_btn")->setVisible(true);
+ }
+ else if (for_sale)
+ {
+ getChild<LLUICtrl>("buy_btn")->setVisible(true);
+ }
+ else if ( enable_pay_object() )
+ {
+ getChild<LLUICtrl>("pay_btn")->setVisible(true);
+ }
+ else if (click_action == CLICK_ACTION_SIT)
+ {
+ // Click-action sit must come before "open" because many objects on
+ // which you can sit have scripts, and hence can be opened
+ getChild<LLUICtrl>("sit_btn")->setVisible(true);
+ updateSitLabel(nodep);
+ }
+ else if (object->flagHandleTouch()
+ || (parent && parent->flagHandleTouch()))
+ {
+ getChild<LLUICtrl>("touch_btn")->setVisible(true);
+ updateTouchLabel(nodep);
+ }
+ else if ( enable_object_open() )
+ {
+ // Open is last because anything with a script in it can be opened
+ getChild<LLUICtrl>("open_btn")->setVisible(true);
+ }
+ else
+ {
+ // By default, we can sit on anything
+ getChild<LLUICtrl>("sit_btn")->setVisible(true);
+ updateSitLabel(nodep);
+ }
+
+ // No flash
+ focusFirstItem(FALSE, FALSE);
}
void LLInspectObject::updateSitLabel(LLSelectNode* nodep)
{
- LLButton* sit_btn = getChild<LLButton>("sit_btn");
- if (!nodep->mSitName.empty())
- {
- sit_btn->setLabel( nodep->mSitName );
- }
- else
- {
- sit_btn->setLabel( getString("Sit") );
- }
+ LLButton* sit_btn = getChild<LLButton>("sit_btn");
+ if (!nodep->mSitName.empty())
+ {
+ sit_btn->setLabel( nodep->mSitName );
+ }
+ else
+ {
+ sit_btn->setLabel( getString("Sit") );
+ }
}
void LLInspectObject::updateTouchLabel(LLSelectNode* nodep)
{
- LLButton* sit_btn = getChild<LLButton>("touch_btn");
- if (!nodep->mTouchName.empty())
- {
- sit_btn->setLabel( nodep->mTouchName );
- }
- else
- {
- sit_btn->setLabel( getString("Touch") );
- }
+ LLButton* sit_btn = getChild<LLButton>("touch_btn");
+ if (!nodep->mTouchName.empty())
+ {
+ sit_btn->setLabel( nodep->mTouchName );
+ }
+ else
+ {
+ sit_btn->setLabel( getString("Touch") );
+ }
}
void LLInspectObject::updateName(LLSelectNode* nodep)
{
- std::string name;
- if (!nodep->mName.empty())
- {
- name = nodep->mName;
- }
- else
- {
- name = LLTrans::getString("TooltipNoName");
- }
- getChild<LLUICtrl>("object_name")->setValue(name);
+ std::string name;
+ if (!nodep->mName.empty())
+ {
+ name = nodep->mName;
+ }
+ else
+ {
+ name = LLTrans::getString("TooltipNoName");
+ }
+ getChild<LLUICtrl>("object_name")->setValue(name);
}
void LLInspectObject::updateDescription(LLSelectNode* nodep)
{
- const char* const DEFAULT_DESC = "(No Description)";
- std::string desc;
- if (!nodep->mDescription.empty()
- && nodep->mDescription != DEFAULT_DESC)
- {
- desc = nodep->mDescription;
- }
-
- LLTextBox* textbox = getChild<LLTextBox>("object_description");
- textbox->setValue(desc);
+ const char* const DEFAULT_DESC = "(No Description)";
+ std::string desc;
+ if (!nodep->mDescription.empty()
+ && nodep->mDescription != DEFAULT_DESC)
+ {
+ desc = nodep->mDescription;
+ }
+
+ LLTextBox* textbox = getChild<LLTextBox>("object_description");
+ textbox->setValue(desc);
}
void LLInspectObject::updateMediaCurrentURL()
-{
- if(!mMediaEntry)
- return;
- LLTextBox* textbox = getChild<LLTextBox>("object_media_url");
- std::string media_url = "";
- textbox->setValue(media_url);
- textbox->setToolTip(media_url);
- LLStringUtil::format_map_t args;
-
- if(mMediaImpl.notNull() && mMediaImpl->hasMedia())
- {
-
- LLPluginClassMedia* media_plugin = NULL;
- media_plugin = mMediaImpl->getMediaPlugin();
- if(media_plugin)
- {
- if(media_plugin->pluginSupportsMediaTime())
- {
- args["[CurrentURL]"] = mMediaImpl->getMediaURL();
- }
- else
- {
- args["[CurrentURL]"] = media_plugin->getLocation();
- }
- media_url = LLTrans::getString("CurrentURL", args);
-
- }
- }
- else if(mMediaEntry->getCurrentURL() != "")
- {
- args["[CurrentURL]"] = mMediaEntry->getCurrentURL();
- media_url = LLTrans::getString("CurrentURL", args);
- }
-
- textbox->setText(media_url);
- textbox->setToolTip(media_url);
+{
+ if(!mMediaEntry)
+ return;
+ LLTextBox* textbox = getChild<LLTextBox>("object_media_url");
+ std::string media_url = "";
+ textbox->setValue(media_url);
+ textbox->setToolTip(media_url);
+ LLStringUtil::format_map_t args;
+
+ if(mMediaImpl.notNull() && mMediaImpl->hasMedia())
+ {
+
+ LLPluginClassMedia* media_plugin = NULL;
+ media_plugin = mMediaImpl->getMediaPlugin();
+ if(media_plugin)
+ {
+ if(media_plugin->pluginSupportsMediaTime())
+ {
+ args["[CurrentURL]"] = mMediaImpl->getMediaURL();
+ }
+ else
+ {
+ args["[CurrentURL]"] = media_plugin->getLocation();
+ }
+ media_url = LLTrans::getString("CurrentURL", args);
+
+ }
+ }
+ else if(mMediaEntry->getCurrentURL() != "")
+ {
+ args["[CurrentURL]"] = mMediaEntry->getCurrentURL();
+ media_url = LLTrans::getString("CurrentURL", args);
+ }
+
+ textbox->setText(media_url);
+ textbox->setToolTip(media_url);
}
void LLInspectObject::updateCreator(LLSelectNode* nodep)
{
- // final information for display
- LLStringUtil::format_map_t args;
- std::string text;
-
- // Leave text blank until data loaded
- if (nodep->mValid)
- {
- // Utilize automatic translation of SLURL into name to display
- // a clickable link
- // Objects cannot be created by a group, so use agent URL format
- LLUUID creator_id = nodep->mPermissions->getCreator();
- std::string creator_url =
- LLSLURL("agent", creator_id, "about").getSLURLString();
- args["[CREATOR]"] = creator_url;
-
- // created by one user but owned by another
- std::string owner_url;
- LLUUID owner_id;
- bool group_owned = nodep->mPermissions->isGroupOwned();
- if (group_owned)
- {
- owner_id = nodep->mPermissions->getGroup();
- owner_url = LLSLURL("group", owner_id, "about").getSLURLString();
- }
- else
- {
- owner_id = nodep->mPermissions->getOwner();
- owner_url = LLSLURL("agent", owner_id, "about").getSLURLString();
- }
- args["[OWNER]"] = owner_url;
-
- if (creator_id == owner_id)
- {
- // common case, created and owned by one user
- text = getString("Creator", args);
- }
- else
- {
- text = getString("CreatorAndOwner", args);
- }
- }
- getChild<LLUICtrl>("object_creator")->setValue(text);
+ // final information for display
+ LLStringUtil::format_map_t args;
+ std::string text;
+
+ // Leave text blank until data loaded
+ if (nodep->mValid)
+ {
+ // Utilize automatic translation of SLURL into name to display
+ // a clickable link
+ // Objects cannot be created by a group, so use agent URL format
+ LLUUID creator_id = nodep->mPermissions->getCreator();
+ std::string creator_url =
+ LLSLURL("agent", creator_id, "about").getSLURLString();
+ args["[CREATOR]"] = creator_url;
+
+ // created by one user but owned by another
+ std::string owner_url;
+ LLUUID owner_id;
+ bool group_owned = nodep->mPermissions->isGroupOwned();
+ if (group_owned)
+ {
+ owner_id = nodep->mPermissions->getGroup();
+ owner_url = LLSLURL("group", owner_id, "about").getSLURLString();
+ }
+ else
+ {
+ owner_id = nodep->mPermissions->getOwner();
+ owner_url = LLSLURL("agent", owner_id, "about").getSLURLString();
+ }
+ args["[OWNER]"] = owner_url;
+
+ if (creator_id == owner_id)
+ {
+ // common case, created and owned by one user
+ text = getString("Creator", args);
+ }
+ else
+ {
+ text = getString("CreatorAndOwner", args);
+ }
+ }
+ getChild<LLUICtrl>("object_creator")->setValue(text);
}
void LLInspectObject::updatePrice(LLSelectNode* nodep)
{
- // *TODO: Only look these up once and use for both updateButtons and here
- bool for_copy = anyone_copy_selection(nodep);
- bool for_sale = enable_buy_object();
- S32 price = nodep->mSaleInfo.getSalePrice();
-
- bool show_price_icon = false;
- std::string line;
- if (for_copy
- || (for_sale && price == 0))
- {
- line = getString("PriceFree");
- show_price_icon = true;
- }
- else if (for_sale)
- {
- LLStringUtil::format_map_t args;
- args["[AMOUNT]"] = LLResMgr::getInstance()->getMonetaryString(price);
- line = getString("Price", args);
- show_price_icon = true;
- }
- getChild<LLUICtrl>("price_text")->setValue(line);
- getChild<LLUICtrl>("price_icon")->setVisible(show_price_icon);
+ // *TODO: Only look these up once and use for both updateButtons and here
+ bool for_copy = anyone_copy_selection(nodep);
+ bool for_sale = enable_buy_object();
+ S32 price = nodep->mSaleInfo.getSalePrice();
+
+ bool show_price_icon = false;
+ std::string line;
+ if (for_copy
+ || (for_sale && price == 0))
+ {
+ line = getString("PriceFree");
+ show_price_icon = true;
+ }
+ else if (for_sale)
+ {
+ LLStringUtil::format_map_t args;
+ args["[AMOUNT]"] = LLResMgr::getInstance()->getMonetaryString(price);
+ line = getString("Price", args);
+ show_price_icon = true;
+ }
+ getChild<LLUICtrl>("price_text")->setValue(line);
+ getChild<LLUICtrl>("price_icon")->setVisible(show_price_icon);
}
void LLInspectObject::updateSecureBrowsing()
{
- bool is_secure_browsing = false;
-
- if(mMediaImpl.notNull()
- && mMediaImpl->hasMedia())
- {
- LLPluginClassMedia* media_plugin = NULL;
- std::string current_url = "";
- media_plugin = mMediaImpl->getMediaPlugin();
- if(media_plugin)
- {
- if(media_plugin->pluginSupportsMediaTime())
- {
- current_url = mMediaImpl->getMediaURL();
- }
- else
- {
- current_url = media_plugin->getLocation();
- }
- }
-
- std::string prefix = std::string("https://");
- std::string test_prefix = current_url.substr(0, prefix.length());
- LLStringUtil::toLower(test_prefix);
- if(test_prefix == prefix)
- {
- is_secure_browsing = true;
- }
- }
- getChild<LLUICtrl>("secure_browsing")->setVisible(is_secure_browsing);
+ bool is_secure_browsing = false;
+
+ if(mMediaImpl.notNull()
+ && mMediaImpl->hasMedia())
+ {
+ LLPluginClassMedia* media_plugin = NULL;
+ std::string current_url = "";
+ media_plugin = mMediaImpl->getMediaPlugin();
+ if(media_plugin)
+ {
+ if(media_plugin->pluginSupportsMediaTime())
+ {
+ current_url = mMediaImpl->getMediaURL();
+ }
+ else
+ {
+ current_url = media_plugin->getLocation();
+ }
+ }
+
+ std::string prefix = std::string("https://");
+ std::string test_prefix = current_url.substr(0, prefix.length());
+ LLStringUtil::toLower(test_prefix);
+ if(test_prefix == prefix)
+ {
+ is_secure_browsing = true;
+ }
+ }
+ getChild<LLUICtrl>("secure_browsing")->setVisible(is_secure_browsing);
}
-// For the object inspector, only unpause the fade timer
+// For the object inspector, only unpause the fade timer
// if the gear menu is not open
void LLInspectObject::onMouseLeave(S32 x, S32 y, MASK mask)
{
- LLToggleableMenu* gear_menu = getChild<LLMenuButton>("gear_btn")->getMenu();
- if ( gear_menu && gear_menu->getVisible() )
- {
- return;
- }
-
- if(childHasVisiblePopupMenu())
- {
- return;
- }
-
- mOpenTimer.unpause();
+ LLToggleableMenu* gear_menu = getChild<LLMenuButton>("gear_btn")->getMenu();
+ if ( gear_menu && gear_menu->getVisible() )
+ {
+ return;
+ }
+
+ if(childHasVisiblePopupMenu())
+ {
+ return;
+ }
+
+ mOpenTimer.unpause();
}
void LLInspectObject::onClickBuy()
{
- handle_buy();
- closeFloater();
+ handle_buy();
+ closeFloater();
}
void LLInspectObject::onClickPay()
{
- handle_give_money_dialog();
- closeFloater();
+ handle_give_money_dialog();
+ closeFloater();
}
void LLInspectObject::onClickTakeFreeCopy()
{
- LLObjectSelection* selection = LLSelectMgr::getInstance()->getSelection();
- if (!selection) return;
-
- LLSelectNode* nodep = selection->getFirstRootNode();
- if (!nodep) return;
-
- // Figure out if this is a "free buy" or a "take copy"
- bool for_copy = anyone_copy_selection(nodep);
- // Prefer to just take a free copy
- if (for_copy)
- {
- handle_take_copy();
- }
- else
- {
- // Buy for free (confusing, but that's how it is)
- handle_buy();
- }
- closeFloater();
+ LLObjectSelection* selection = LLSelectMgr::getInstance()->getSelection();
+ if (!selection) return;
+
+ LLSelectNode* nodep = selection->getFirstRootNode();
+ if (!nodep) return;
+
+ // Figure out if this is a "free buy" or a "take copy"
+ bool for_copy = anyone_copy_selection(nodep);
+ // Prefer to just take a free copy
+ if (for_copy)
+ {
+ handle_take_copy();
+ }
+ else
+ {
+ // Buy for free (confusing, but that's how it is)
+ handle_buy();
+ }
+ closeFloater();
}
void LLInspectObject::onClickTouch()
{
- handle_object_touch();
- closeFloater();
+ handle_object_touch();
+ closeFloater();
}
void LLInspectObject::onClickSit()
@@ -659,25 +659,25 @@ void LLInspectObject::onClickSit()
{
handle_object_sit(mObjectID);
}
- closeFloater();
+ closeFloater();
}
void LLInspectObject::onClickOpen()
{
- LLFloaterReg::showInstance("openobject");
- closeFloater();
+ LLFloaterReg::showInstance("openobject");
+ closeFloater();
}
void LLInspectObject::onClickMoreInfo()
{
LLFloaterReg::showInstance("task_properties");
- closeFloater();
+ closeFloater();
}
-void LLInspectObject::onClickZoomIn()
+void LLInspectObject::onClickZoomIn()
{
- handle_look_at_selection("zoom");
- closeFloater();
+ handle_look_at_selection("zoom");
+ closeFloater();
}
//////////////////////////////////////////////////////////////////////////////
@@ -685,7 +685,7 @@ void LLInspectObject::onClickZoomIn()
//////////////////////////////////////////////////////////////////////////////
void LLInspectObjectUtil::registerFloater()
{
- LLFloaterReg::add("inspect_object", "inspect_object.xml",
- &LLFloaterReg::build<LLInspectObject>);
+ LLFloaterReg::add("inspect_object", "inspect_object.xml",
+ &LLFloaterReg::build<LLInspectObject>);
}
diff --git a/indra/newview/llinspectobject.h b/indra/newview/llinspectobject.h
index 9362139458..aab8f0c93c 100644
--- a/indra/newview/llinspectobject.h
+++ b/indra/newview/llinspectobject.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspectobject.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,7 +28,7 @@
namespace LLInspectObjectUtil
{
- void registerFloater();
+ void registerFloater();
}
#endif
diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp
index 77320510a6..bf4ca40397 100644
--- a/indra/newview/llinspectremoteobject.cpp
+++ b/indra/newview/llinspectremoteobject.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspectremoteobject.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,133 +45,133 @@
// to display details about objects sending messages to the user.
class LLInspectRemoteObject : public LLInspect
{
- friend class LLFloaterReg;
-
+ friend class LLFloaterReg;
+
public:
- LLInspectRemoteObject(const LLSD& object_id);
- virtual ~LLInspectRemoteObject() {};
+ LLInspectRemoteObject(const LLSD& object_id);
+ virtual ~LLInspectRemoteObject() {};
+
+ /*virtual*/ BOOL postBuild(void);
+ /*virtual*/ void onOpen(const LLSD& avatar_id);
- /*virtual*/ BOOL postBuild(void);
- /*virtual*/ void onOpen(const LLSD& avatar_id);
+ void onClickMap();
+ void onClickBlock();
+ void onClickClose();
- void onClickMap();
- void onClickBlock();
- void onClickClose();
-
private:
- void update();
-
+ void update();
+
private:
- LLUUID mObjectID;
- LLUUID mOwnerID;
- std::string mSLurl;
- std::string mName;
- bool mGroupOwned;
+ LLUUID mObjectID;
+ LLUUID mOwnerID;
+ std::string mSLurl;
+ std::string mName;
+ bool mGroupOwned;
};
LLInspectRemoteObject::LLInspectRemoteObject(const LLSD& sd) :
- LLInspect(LLSD()),
- mObjectID(NULL),
- mOwnerID(NULL),
- mSLurl(""),
- mName(""),
- mGroupOwned(false)
+ LLInspect(LLSD()),
+ mObjectID(NULL),
+ mOwnerID(NULL),
+ mSLurl(""),
+ mName(""),
+ mGroupOwned(false)
{
}
/*virtual*/
BOOL LLInspectRemoteObject::postBuild(void)
{
- // hook up the inspector's buttons
- getChild<LLUICtrl>("map_btn")->setCommitCallback(
- boost::bind(&LLInspectRemoteObject::onClickMap, this));
- getChild<LLUICtrl>("block_btn")->setCommitCallback(
- boost::bind(&LLInspectRemoteObject::onClickBlock, this));
- getChild<LLUICtrl>("close_btn")->setCommitCallback(
- boost::bind(&LLInspectRemoteObject::onClickClose, this));
-
- return TRUE;
+ // hook up the inspector's buttons
+ getChild<LLUICtrl>("map_btn")->setCommitCallback(
+ boost::bind(&LLInspectRemoteObject::onClickMap, this));
+ getChild<LLUICtrl>("block_btn")->setCommitCallback(
+ boost::bind(&LLInspectRemoteObject::onClickBlock, this));
+ getChild<LLUICtrl>("close_btn")->setCommitCallback(
+ boost::bind(&LLInspectRemoteObject::onClickClose, this));
+
+ return TRUE;
}
/*virtual*/
void LLInspectRemoteObject::onOpen(const LLSD& data)
{
- // Start animation
- LLInspect::onOpen(data);
-
- // Extract appropriate object information from input LLSD
- // (Eventually, it might be nice to query server for details
- // rather than require caller to pass in the information.)
- mObjectID = data["object_id"].asUUID();
- mName = data["name"].asString();
- mOwnerID = data["owner_id"].asUUID();
- mGroupOwned = data["group_owned"].asBoolean();
- mSLurl = data["slurl"].asString();
-
- // update the inspector with the current object state
- update();
-
- LLInspect::repositionInspector(data);
+ // Start animation
+ LLInspect::onOpen(data);
+
+ // Extract appropriate object information from input LLSD
+ // (Eventually, it might be nice to query server for details
+ // rather than require caller to pass in the information.)
+ mObjectID = data["object_id"].asUUID();
+ mName = data["name"].asString();
+ mOwnerID = data["owner_id"].asUUID();
+ mGroupOwned = data["group_owned"].asBoolean();
+ mSLurl = data["slurl"].asString();
+
+ // update the inspector with the current object state
+ update();
+
+ LLInspect::repositionInspector(data);
}
void LLInspectRemoteObject::onClickMap()
{
- std::string url = "secondlife://" + mSLurl;
- LLUrlAction::showLocationOnMap(url);
- closeFloater();
+ std::string url = "secondlife://" + mSLurl;
+ LLUrlAction::showLocationOnMap(url);
+ closeFloater();
}
void LLInspectRemoteObject::onClickBlock()
{
- LLMute mute(mObjectID, mName, LLMute::OBJECT);
- LLMuteList::getInstance()->add(mute);
- LLPanelBlockedList::showPanelAndSelect(mute.mID);
- closeFloater();
+ LLMute mute(mObjectID, mName, LLMute::OBJECT);
+ LLMuteList::getInstance()->add(mute);
+ LLPanelBlockedList::showPanelAndSelect(mute.mID);
+ closeFloater();
}
void LLInspectRemoteObject::onClickClose()
{
- closeFloater();
+ closeFloater();
}
void LLInspectRemoteObject::update()
{
- // show the object name as the inspector's title
- // (don't hyperlink URLs in object names)
- getChild<LLUICtrl>("object_name")->setValue("<nolink>" + mName + "</nolink>");
-
- // show the object's owner - click it to show profile
- std::string owner;
- if (! mOwnerID.isNull())
- {
- if (mGroupOwned)
- {
- owner = LLSLURL("group", mOwnerID, "about").getSLURLString();
- }
- else
- {
- owner = LLSLURL("agent", mOwnerID, "about").getSLURLString();
- }
- }
- else
- {
- owner = LLTrans::getString("Unknown");
- }
- getChild<LLUICtrl>("object_owner")->setValue(owner);
-
- // display the object's SLurl - click it to teleport
- std::string url;
- if (! mSLurl.empty())
- {
- url = "secondlife:///app/teleport/" + mSLurl;
- }
- getChild<LLUICtrl>("object_slurl")->setValue(url);
-
- // disable the Map button if we don't have a SLurl
- getChild<LLUICtrl>("map_btn")->setEnabled(! mSLurl.empty());
-
- // disable the Block button if we don't have the object ID (will this ever happen?)
- getChild<LLUICtrl>("block_btn")->setEnabled(!mObjectID.isNull() && !LLMuteList::getInstance()->isMuted(mObjectID));
+ // show the object name as the inspector's title
+ // (don't hyperlink URLs in object names)
+ getChild<LLUICtrl>("object_name")->setValue("<nolink>" + mName + "</nolink>");
+
+ // show the object's owner - click it to show profile
+ std::string owner;
+ if (! mOwnerID.isNull())
+ {
+ if (mGroupOwned)
+ {
+ owner = LLSLURL("group", mOwnerID, "about").getSLURLString();
+ }
+ else
+ {
+ owner = LLSLURL("agent", mOwnerID, "about").getSLURLString();
+ }
+ }
+ else
+ {
+ owner = LLTrans::getString("Unknown");
+ }
+ getChild<LLUICtrl>("object_owner")->setValue(owner);
+
+ // display the object's SLurl - click it to teleport
+ std::string url;
+ if (! mSLurl.empty())
+ {
+ url = "secondlife:///app/teleport/" + mSLurl;
+ }
+ getChild<LLUICtrl>("object_slurl")->setValue(url);
+
+ // disable the Map button if we don't have a SLurl
+ getChild<LLUICtrl>("map_btn")->setEnabled(! mSLurl.empty());
+
+ // disable the Block button if we don't have the object ID (will this ever happen?)
+ getChild<LLUICtrl>("block_btn")->setEnabled(!mObjectID.isNull() && !LLMuteList::getInstance()->isMuted(mObjectID));
}
//////////////////////////////////////////////////////////////////////////////
@@ -179,6 +179,6 @@ void LLInspectRemoteObject::update()
//////////////////////////////////////////////////////////////////////////////
void LLInspectRemoteObjectUtil::registerFloater()
{
- LLFloaterReg::add("inspect_remote_object", "inspect_remote_object.xml",
- &LLFloaterReg::build<LLInspectRemoteObject>);
+ LLFloaterReg::add("inspect_remote_object", "inspect_remote_object.xml",
+ &LLFloaterReg::build<LLInspectRemoteObject>);
}
diff --git a/indra/newview/llinspectremoteobject.h b/indra/newview/llinspectremoteobject.h
index 173efd1c0c..df0c8a4bcd 100644
--- a/indra/newview/llinspectremoteobject.h
+++ b/indra/newview/llinspectremoteobject.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspectremoteobject.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,7 +28,7 @@
namespace LLInspectRemoteObjectUtil
{
- void registerFloater();
+ void registerFloater();
}
#endif
diff --git a/indra/newview/llinspecttexture.cpp b/indra/newview/llinspecttexture.cpp
index 76e428b7d0..add9a22f15 100644
--- a/indra/newview/llinspecttexture.cpp
+++ b/indra/newview/llinspecttexture.cpp
@@ -41,7 +41,7 @@
LLToolTip* LLInspectTextureUtil::createInventoryToolTip(LLToolTip::Params p)
{
const LLSD& sdTooltip = p.create_params;
-
+
if (sdTooltip.has("thumbnail_id") && sdTooltip["thumbnail_id"].asUUID().notNull())
{
// go straight for thumbnail regardless of type
@@ -49,14 +49,14 @@ LLToolTip* LLInspectTextureUtil::createInventoryToolTip(LLToolTip::Params p)
return LLUICtrlFactory::create<LLTextureToolTip>(p);
}
- LLInventoryType::EType eInvType = (sdTooltip.has("inv_type")) ? (LLInventoryType::EType)sdTooltip["inv_type"].asInteger() : LLInventoryType::IT_NONE;
- switch (eInvType)
- {
- case LLInventoryType::IT_CATEGORY:
- {
- if (sdTooltip.has("item_id"))
- {
- const LLUUID idCategory = sdTooltip["item_id"].asUUID();
+ LLInventoryType::EType eInvType = (sdTooltip.has("inv_type")) ? (LLInventoryType::EType)sdTooltip["inv_type"].asInteger() : LLInventoryType::IT_NONE;
+ switch (eInvType)
+ {
+ case LLInventoryType::IT_CATEGORY:
+ {
+ if (sdTooltip.has("item_id"))
+ {
+ const LLUUID idCategory = sdTooltip["item_id"].asUUID();
LLViewerInventoryCategory* cat = gInventory.getCategory(idCategory);
if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
{
@@ -83,17 +83,17 @@ LLToolTip* LLInspectTextureUtil::createInventoryToolTip(LLToolTip::Params p)
}
}
}
- }
- if ((!p.message.isProvided() || p.message().empty()))
+ }
+ if ((!p.message.isProvided() || p.message().empty()))
{
return NULL;
}
- // No or more than one texture found => show default tooltip
- return LLUICtrlFactory::create<LLToolTip>(p);
- }
- default:
- return LLUICtrlFactory::create<LLToolTip>(p);
- }
+ // No or more than one texture found => show default tooltip
+ return LLUICtrlFactory::create<LLToolTip>(p);
+ }
+ default:
+ return LLUICtrlFactory::create<LLToolTip>(p);
+ }
}
// ============================================================================
@@ -103,83 +103,83 @@ LLToolTip* LLInspectTextureUtil::createInventoryToolTip(LLToolTip::Params p)
class LLTexturePreviewView : public LLView
{
public:
- LLTexturePreviewView(const LLView::Params& p);
- ~LLTexturePreviewView();
+ LLTexturePreviewView(const LLView::Params& p);
+ ~LLTexturePreviewView();
public:
- void draw() override;
+ void draw() override;
public:
- void setImageFromAssetId(const LLUUID& idAsset);
- void setImageFromItemId(const LLUUID& idItem);
+ void setImageFromAssetId(const LLUUID& idAsset);
+ void setImageFromItemId(const LLUUID& idItem);
protected:
- LLPointer<LLViewerFetchedTexture> m_Image;
- S32 mImageBoostLevel = LLGLTexture::BOOST_NONE;
- std::string mLoadingText;
+ LLPointer<LLViewerFetchedTexture> m_Image;
+ S32 mImageBoostLevel = LLGLTexture::BOOST_NONE;
+ std::string mLoadingText;
};
LLTexturePreviewView::LLTexturePreviewView(const LLView::Params& p)
- : LLView(p)
+ : LLView(p)
{
- mLoadingText = LLTrans::getString("texture_loading");
+ mLoadingText = LLTrans::getString("texture_loading");
}
LLTexturePreviewView::~LLTexturePreviewView()
{
- if (m_Image)
- {
- m_Image->setBoostLevel(mImageBoostLevel);
- m_Image = nullptr;
- }
+ if (m_Image)
+ {
+ m_Image->setBoostLevel(mImageBoostLevel);
+ m_Image = nullptr;
+ }
}
void LLTexturePreviewView::draw()
{
LLView::draw();
- if (m_Image)
- {
- LLRect rctClient = getLocalRect();
+ if (m_Image)
+ {
+ LLRect rctClient = getLocalRect();
if (4 == m_Image->getComponents())
{
const LLColor4 color(.098f, .098f, .098f);
gl_rect_2d(rctClient, color, TRUE);
}
- gl_draw_scaled_image(rctClient.mLeft, rctClient.mBottom, rctClient.getWidth(), rctClient.getHeight(), m_Image);
+ gl_draw_scaled_image(rctClient.mLeft, rctClient.mBottom, rctClient.getWidth(), rctClient.getHeight(), m_Image);
- bool isLoading = (!m_Image->isFullyLoaded()) && (m_Image->getDiscardLevel() > 0);
- if (isLoading)
- LLFontGL::getFontSansSerif()->renderUTF8(mLoadingText, 0, llfloor(rctClient.mLeft + 3), llfloor(rctClient.mTop - 25), LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
- m_Image->addTextureStats((isLoading) ? MAX_IMAGE_AREA : (F32)(rctClient.getWidth() * rctClient.getHeight()));
- }
+ bool isLoading = (!m_Image->isFullyLoaded()) && (m_Image->getDiscardLevel() > 0);
+ if (isLoading)
+ LLFontGL::getFontSansSerif()->renderUTF8(mLoadingText, 0, llfloor(rctClient.mLeft + 3), llfloor(rctClient.mTop - 25), LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
+ m_Image->addTextureStats((isLoading) ? MAX_IMAGE_AREA : (F32)(rctClient.getWidth() * rctClient.getHeight()));
+ }
}
void LLTexturePreviewView::setImageFromAssetId(const LLUUID& idAsset)
{
- m_Image = LLViewerTextureManager::getFetchedTexture(idAsset, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- if (m_Image)
- {
- mImageBoostLevel = m_Image->getBoostLevel();
- m_Image->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
- m_Image->forceToSaveRawImage(0);
- if ( (!m_Image->isFullyLoaded()) && (!m_Image->hasFetcher()) )
- {
- if (m_Image->isInFastCacheList())
- {
- m_Image->loadFromFastCache();
- }
- gTextureList.forceImmediateUpdate(m_Image);
- }
- }
+ m_Image = LLViewerTextureManager::getFetchedTexture(idAsset, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ if (m_Image)
+ {
+ mImageBoostLevel = m_Image->getBoostLevel();
+ m_Image->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
+ m_Image->forceToSaveRawImage(0);
+ if ( (!m_Image->isFullyLoaded()) && (!m_Image->hasFetcher()) )
+ {
+ if (m_Image->isInFastCacheList())
+ {
+ m_Image->loadFromFastCache();
+ }
+ gTextureList.forceImmediateUpdate(m_Image);
+ }
+ }
}
void LLTexturePreviewView::setImageFromItemId(const LLUUID& idItem)
{
- const LLViewerInventoryItem* pItem = gInventory.getItem(idItem);
- setImageFromAssetId( (pItem) ? pItem->getAssetUUID() : LLUUID::null );
+ const LLViewerInventoryItem* pItem = gInventory.getItem(idItem);
+ setImageFromAssetId( (pItem) ? pItem->getAssetUUID() : LLUUID::null );
}
// ============================================================================
@@ -187,11 +187,11 @@ void LLTexturePreviewView::setImageFromItemId(const LLUUID& idItem)
//
LLTextureToolTip::LLTextureToolTip(const LLToolTip::Params& p)
- : LLToolTip(p)
- , mPreviewView(nullptr)
- , mPreviewSize(256)
+ : LLToolTip(p)
+ , mPreviewView(nullptr)
+ , mPreviewSize(256)
{
- mMaxWidth = llmax(mMaxWidth, mPreviewSize);
+ mMaxWidth = llmax(mMaxWidth, mPreviewSize);
// Currently has to share params with LLToolTip, override values
setBackgroundColor(LLColor4::black);
@@ -206,7 +206,7 @@ LLTextureToolTip::~LLTextureToolTip()
void LLTextureToolTip::initFromParams(const LLToolTip::Params& p)
{
LLToolTip::initFromParams(p);
-
+
// Create and add the preview control
LLView::Params p_preview;
p_preview.name = "texture_preview";
@@ -215,7 +215,7 @@ void LLTextureToolTip::initFromParams(const LLToolTip::Params& p)
p_preview.rect = rctPreview;
mPreviewView = LLUICtrlFactory::create<LLTexturePreviewView>(p_preview);
addChild(mPreviewView);
-
+
// Parse the control params
const LLSD& sdTextureParams = p.create_params;
if (sdTextureParams.has("thumbnail_id"))
@@ -246,7 +246,7 @@ void LLTextureToolTip::initFromParams(const LLToolTip::Params& p)
mTextBox->setColor(LLColor4::white);
- snapToChildren();
+ snapToChildren();
}
// ============================================================================
diff --git a/indra/newview/llinspecttexture.h b/indra/newview/llinspecttexture.h
index ff0d80b825..d735789bf1 100644
--- a/indra/newview/llinspecttexture.h
+++ b/indra/newview/llinspecttexture.h
@@ -31,19 +31,19 @@ class LLTexturePreviewView;
namespace LLInspectTextureUtil
{
- LLToolTip* createInventoryToolTip(LLToolTip::Params p);
+ LLToolTip* createInventoryToolTip(LLToolTip::Params p);
}
class LLTextureToolTip : public LLToolTip
{
public:
- LLTextureToolTip(const LLToolTip::Params& p);
- ~LLTextureToolTip();
+ LLTextureToolTip(const LLToolTip::Params& p);
+ ~LLTextureToolTip();
public:
- void initFromParams(const LLToolTip::Params& p) override;
+ void initFromParams(const LLToolTip::Params& p) override;
protected:
- LLTexturePreviewView* mPreviewView;
- S32 mPreviewSize;
+ LLTexturePreviewView* mPreviewView;
+ S32 mPreviewSize;
};
diff --git a/indra/newview/llinspecttoast.cpp b/indra/newview/llinspecttoast.cpp
index 6f93a78ca6..0104714a16 100644
--- a/indra/newview/llinspecttoast.cpp
+++ b/indra/newview/llinspecttoast.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinspecttoast.cpp
* @brief Toast inspector implementation.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,85 +42,85 @@ class LLInspectToast: public LLInspect
{
public:
- LLInspectToast(const LLSD& notification_idl);
- virtual ~LLInspectToast();
+ LLInspectToast(const LLSD& notification_idl);
+ virtual ~LLInspectToast();
- /*virtual*/ void onOpen(const LLSD& notification_id);
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ /*virtual*/ void onOpen(const LLSD& notification_id);
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
/*virtual*/ void deleteAllChildren();
- /*virtual*/ void removeChild(LLView* child);
+ /*virtual*/ void removeChild(LLView* child);
private:
- void onToastDestroy(LLToast * toast);
+ void onToastDestroy(LLToast * toast);
- boost::signals2::scoped_connection mConnection;
- LLPanel* mPanel;
- LLScreenChannel* mScreenChannel;
+ boost::signals2::scoped_connection mConnection;
+ LLPanel* mPanel;
+ LLScreenChannel* mScreenChannel;
};
LLInspectToast::LLInspectToast(const LLSD& notification_id) :
- LLInspect(LLSD()), mPanel(NULL)
+ LLInspect(LLSD()), mPanel(NULL)
{
- LLScreenChannelBase* channel = LLChannelManager::getInstance()->findChannelByID(
- LLUUID(gSavedSettings.getString("NotificationChannelUUID")));
- mScreenChannel = dynamic_cast<LLScreenChannel*>(channel);
- if(NULL == mScreenChannel)
- {
- LL_WARNS() << "Could not get requested screen channel." << LL_ENDL;
- return;
- }
-
- LLTransientFloaterMgr::getInstance()->addControlView(this);
+ LLScreenChannelBase* channel = LLChannelManager::getInstance()->findChannelByID(
+ LLUUID(gSavedSettings.getString("NotificationChannelUUID")));
+ mScreenChannel = dynamic_cast<LLScreenChannel*>(channel);
+ if(NULL == mScreenChannel)
+ {
+ LL_WARNS() << "Could not get requested screen channel." << LL_ENDL;
+ return;
+ }
+
+ LLTransientFloaterMgr::getInstance()->addControlView(this);
}
LLInspectToast::~LLInspectToast()
{
- LLTransientFloaterMgr::getInstance()->removeControlView(this);
+ LLTransientFloaterMgr::getInstance()->removeControlView(this);
- mConnection.disconnect();
+ mConnection.disconnect();
}
// virtual
void LLInspectToast::onOpen(const LLSD& notification_id)
{
- LLInspect::onOpen(notification_id);
- LLToast* toast = mScreenChannel->getToastByNotificationID(notification_id);
- if (toast == NULL)
- {
- LL_WARNS() << "Could not get requested toast from screen channel." << LL_ENDL;
- return;
- }
- mConnection = toast->setOnToastDestroyedCallback(boost::bind(&LLInspectToast::onToastDestroy, this, _1));
-
- LLPanel * panel = toast->getPanel();
- if (panel == NULL)
- {
- LL_WARNS() << "Could not get toast's panel." << LL_ENDL;
- return;
- }
- panel->setVisible(TRUE);
- panel->setMouseOpaque(FALSE);
- if(mPanel != NULL && mPanel->getParent() == this)
- {
- LLInspect::removeChild(mPanel);
- }
- addChild(panel);
- panel->setFocus(TRUE);
- mPanel = panel;
-
-
- LLRect panel_rect;
- panel_rect = panel->getRect();
- reshape(panel_rect.getWidth(), panel_rect.getHeight());
-
- LLInspect::repositionInspector(notification_id);
+ LLInspect::onOpen(notification_id);
+ LLToast* toast = mScreenChannel->getToastByNotificationID(notification_id);
+ if (toast == NULL)
+ {
+ LL_WARNS() << "Could not get requested toast from screen channel." << LL_ENDL;
+ return;
+ }
+ mConnection = toast->setOnToastDestroyedCallback(boost::bind(&LLInspectToast::onToastDestroy, this, _1));
+
+ LLPanel * panel = toast->getPanel();
+ if (panel == NULL)
+ {
+ LL_WARNS() << "Could not get toast's panel." << LL_ENDL;
+ return;
+ }
+ panel->setVisible(TRUE);
+ panel->setMouseOpaque(FALSE);
+ if(mPanel != NULL && mPanel->getParent() == this)
+ {
+ LLInspect::removeChild(mPanel);
+ }
+ addChild(panel);
+ panel->setFocus(TRUE);
+ mPanel = panel;
+
+
+ LLRect panel_rect;
+ panel_rect = panel->getRect();
+ reshape(panel_rect.getWidth(), panel_rect.getHeight());
+
+ LLInspect::repositionInspector(notification_id);
}
// virtual
BOOL LLInspectToast::handleToolTip(S32 x, S32 y, MASK mask)
{
- // We don't like the way LLInspect handles tooltips
- // (black tooltips look weird),
- // so force using the default implementation (STORM-511).
- return LLFloater::handleToolTip(x, y, mask);
+ // We don't like the way LLInspect handles tooltips
+ // (black tooltips look weird),
+ // so force using the default implementation (STORM-511).
+ return LLFloater::handleToolTip(x, y, mask);
}
void LLInspectToast::deleteAllChildren()
@@ -132,21 +132,21 @@ void LLInspectToast::deleteAllChildren()
// virtual
void LLInspectToast::removeChild(LLView* child)
{
- if (mPanel == child)
- {
- mPanel = NULL;
- }
- LLInspect::removeChild(child);
+ if (mPanel == child)
+ {
+ mPanel = NULL;
+ }
+ LLInspect::removeChild(child);
}
void LLInspectToast::onToastDestroy(LLToast * toast)
{
- closeFloater(false);
+ closeFloater(false);
}
void LLNotificationsUI::registerFloater()
{
- LLFloaterReg::add("inspect_toast", "inspect_toast.xml",
- &LLFloaterReg::build<LLInspectToast>);
+ LLFloaterReg::add("inspect_toast", "inspect_toast.xml",
+ &LLFloaterReg::build<LLInspectToast>);
}
diff --git a/indra/newview/llinspecttoast.h b/indra/newview/llinspecttoast.h
index 441dffdfde..a05d5ecf8c 100644
--- a/indra/newview/llinspecttoast.h
+++ b/indra/newview/llinspecttoast.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llinspecttoast.h
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llinventoryactions.h b/indra/newview/llinventoryactions.h
index 96e9f42ca4..ee7ff35f3f 100644
--- a/indra/newview/llinventoryactions.h
+++ b/indra/newview/llinventoryactions.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llinventoryactions.h
* @brief inventory callback functions
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index ddb69cdfb3..5e66fadd4c 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,15 +28,15 @@
#include "llinventorybridge.h"
// external projects
-#include "lltransfersourceasset.h"
-#include "llavatarnamecache.h" // IDEVO
+#include "lltransfersourceasset.h"
+#include "llavatarnamecache.h" // IDEVO
#include "llagent.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
#include "llappearancemgr.h"
#include "llattachmentsmgr.h"
-#include "llavataractions.h"
+#include "llavataractions.h"
#include "llfavoritesbar.h" // management of favorites folder
#include "llfloateropenobject.h"
#include "llfloaterreg.h"
@@ -47,7 +47,7 @@
#include "llfolderview.h"
#include "llfriendcard.h"
#include "llgesturemgr.h"
-#include "llgiveinventory.h"
+#include "llgiveinventory.h"
#include "llfloaterimcontainer.h"
#include "llimview.h"
#include "llclipboard.h"
@@ -97,28 +97,28 @@ using namespace LLOldEvents;
bool confirm_attachment_rez(const LLSD& notification, const LLSD& response);
void teleport_via_landmark(const LLUUID& asset_id);
static bool check_category(LLInventoryModel* model,
- const LLUUID& cat_id,
- LLInventoryPanel* active_panel,
- LLInventoryFilter* filter);
+ const LLUUID& cat_id,
+ LLInventoryPanel* active_panel,
+ LLInventoryFilter* filter);
static bool check_item(const LLUUID& item_id,
- LLInventoryPanel* active_panel,
- LLInventoryFilter* filter);
+ LLInventoryPanel* active_panel,
+ LLInventoryFilter* filter);
// Helper functions
bool isAddAction(const std::string& action)
{
- return ("wear" == action || "attach" == action || "activate" == action);
+ return ("wear" == action || "attach" == action || "activate" == action);
}
bool isRemoveAction(const std::string& action)
{
- return ("take_off" == action || "detach" == action);
+ return ("take_off" == action || "detach" == action);
}
bool isMarketplaceSendAction(const std::string& action)
{
- return ("send_to_marketplace" == action);
+ return ("send_to_marketplace" == action);
}
bool isPanelActive(const std::string& panel_name)
@@ -131,35 +131,35 @@ bool isPanelActive(const std::string& panel_name)
class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
{
public:
- LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids) : LLInventoryFetchDescendentsObserver(ids) {}
- ~LLRightClickInventoryFetchDescendentsObserver() {}
- virtual void execute(bool clear_observer = false);
- virtual void done()
- {
- execute(true);
- }
+ LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids) : LLInventoryFetchDescendentsObserver(ids) {}
+ ~LLRightClickInventoryFetchDescendentsObserver() {}
+ virtual void execute(bool clear_observer = false);
+ virtual void done()
+ {
+ execute(true);
+ }
};
// Used by LLFolderBridge as callback for directory content items fetching
class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver
{
public:
- LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) : LLInventoryFetchItemsObserver(ids) { };
- ~LLRightClickInventoryFetchObserver() {}
- void execute(bool clear_observer = false)
- {
- if (clear_observer)
- {
- gInventory.removeObserver(this);
- delete this;
- }
- // we've downloaded all the items, so repaint the dialog
- LLFolderBridge::staticFolderOptionsMenu();
- }
- virtual void done()
- {
- execute(true);
- }
+ LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) : LLInventoryFetchItemsObserver(ids) { };
+ ~LLRightClickInventoryFetchObserver() {}
+ void execute(bool clear_observer = false)
+ {
+ if (clear_observer)
+ {
+ gInventory.removeObserver(this);
+ delete this;
+ }
+ // we've downloaded all the items, so repaint the dialog
+ LLFolderBridge::staticFolderOptionsMenu();
+ }
+ virtual void done()
+ {
+ execute(true);
+ }
};
class LLPasteIntoFolderCallback: public LLInventoryCallback
@@ -225,37 +225,37 @@ private:
// | LLInvFVBridge |
// +=================================================+
-LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- mUUID(uuid),
- mRoot(root),
- mInvType(LLInventoryType::IT_NONE),
- mIsLink(FALSE),
- LLFolderViewModelItemInventory(inventory->getRootViewModel())
+LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ mUUID(uuid),
+ mRoot(root),
+ mInvType(LLInventoryType::IT_NONE),
+ mIsLink(FALSE),
+ LLFolderViewModelItemInventory(inventory->getRootViewModel())
{
- mInventoryPanel = inventory->getInventoryPanelHandle();
- const LLInventoryObject* obj = getInventoryObject();
- mIsLink = obj && obj->getIsLinkType();
+ mInventoryPanel = inventory->getInventoryPanelHandle();
+ const LLInventoryObject* obj = getInventoryObject();
+ mIsLink = obj && obj->getIsLinkType();
}
const std::string& LLInvFVBridge::getName() const
{
- const LLInventoryObject* obj = getInventoryObject();
- if(obj)
- {
- return obj->getName();
- }
- return LLStringUtil::null;
+ const LLInventoryObject* obj = getInventoryObject();
+ if(obj)
+ {
+ return obj->getName();
+ }
+ return LLStringUtil::null;
}
const std::string& LLInvFVBridge::getDisplayName() const
{
- if(mDisplayName.empty())
- {
- buildDisplayName();
- }
- return mDisplayName;
+ if(mDisplayName.empty())
+ {
+ buildDisplayName();
+ }
+ return mDisplayName;
}
std::string LLInvFVBridge::getSearchableDescription() const
@@ -276,57 +276,57 @@ std::string LLInvFVBridge::getSearchableUUIDString() const
// Folders have full perms
PermissionMask LLInvFVBridge::getPermissionMask() const
{
- return PERM_ALL;
+ return PERM_ALL;
}
// virtual
LLFolderType::EType LLInvFVBridge::getPreferredType() const
{
- return LLFolderType::FT_NONE;
+ return LLFolderType::FT_NONE;
}
// Folders don't have creation dates.
time_t LLInvFVBridge::getCreationDate() const
{
- LLInventoryObject* objectp = getInventoryObject();
- if (objectp)
- {
- return objectp->getCreationDate();
- }
- return (time_t)0;
+ LLInventoryObject* objectp = getInventoryObject();
+ if (objectp)
+ {
+ return objectp->getCreationDate();
+ }
+ return (time_t)0;
}
void LLInvFVBridge::setCreationDate(time_t creation_date_utc)
{
- LLInventoryObject* objectp = getInventoryObject();
- if (objectp)
- {
- objectp->setCreationDate(creation_date_utc);
- }
+ LLInventoryObject* objectp = getInventoryObject();
+ if (objectp)
+ {
+ objectp->setCreationDate(creation_date_utc);
+ }
}
// Can be destroyed (or moved to trash)
BOOL LLInvFVBridge::isItemRemovable() const
{
- return get_is_item_removable(getInventoryModel(), mUUID);
+ return get_is_item_removable(getInventoryModel(), mUUID);
}
// Can be moved to another folder
BOOL LLInvFVBridge::isItemMovable() const
{
- return TRUE;
+ return TRUE;
}
BOOL LLInvFVBridge::isLink() const
{
- return mIsLink;
+ return mIsLink;
}
BOOL LLInvFVBridge::isLibraryItem() const
{
- return gInventory.isObjectDescendentOf(getUUID(),gInventory.getLibraryRootFolderID());
+ return gInventory.isObjectDescendentOf(getUUID(),gInventory.getLibraryRootFolderID());
}
/*virtual*/
@@ -335,12 +335,12 @@ BOOL LLInvFVBridge::isLibraryItem() const
*/
BOOL LLInvFVBridge::cutToClipboard()
{
- const LLInventoryObject* obj = gInventory.getObject(mUUID);
- if (obj && isItemMovable() && isItemRemovable())
- {
+ const LLInventoryObject* obj = gInventory.getObject(mUUID);
+ if (obj && isItemMovable() && isItemRemovable())
+ {
const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
const BOOL cut_from_marketplacelistings = gInventory.isObjectDescendentOf(mUUID, marketplacelistings_id);
-
+
if (cut_from_marketplacelistings && (LLMarketplaceData::instance().isInActiveFolder(mUUID) ||
LLMarketplaceData::instance().isListedAndActive(mUUID)))
{
@@ -355,7 +355,7 @@ BOOL LLInvFVBridge::cutToClipboard()
return perform_cutToClipboard();
}
}
- return FALSE;
+ return FALSE;
}
// virtual
@@ -374,35 +374,35 @@ BOOL LLInvFVBridge::callback_cutToClipboard(const LLSD& notification, const LLSD
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0) // YES
{
- return perform_cutToClipboard();
+ return perform_cutToClipboard();
}
return FALSE;
}
BOOL LLInvFVBridge::perform_cutToClipboard()
{
- const LLInventoryObject* obj = gInventory.getObject(mUUID);
- if (obj && isItemMovable() && isItemRemovable())
- {
- LLClipboard::instance().setCutMode(true);
- return LLClipboard::instance().addToClipboard(mUUID);
- }
- return FALSE;
+ const LLInventoryObject* obj = gInventory.getObject(mUUID);
+ if (obj && isItemMovable() && isItemRemovable())
+ {
+ LLClipboard::instance().setCutMode(true);
+ return LLClipboard::instance().addToClipboard(mUUID);
+ }
+ return FALSE;
}
BOOL LLInvFVBridge::copyToClipboard() const
{
- const LLInventoryObject* obj = gInventory.getObject(mUUID);
- if (obj && isItemCopyable())
- {
- return LLClipboard::instance().addToClipboard(mUUID);
- }
- return FALSE;
+ const LLInventoryObject* obj = gInventory.getObject(mUUID);
+ if (obj && isItemCopyable())
+ {
+ return LLClipboard::instance().addToClipboard(mUUID);
+ }
+ return FALSE;
}
void LLInvFVBridge::showProperties()
{
- if (isMarketplaceListingsFolder())
+ if (isMarketplaceListingsFolder())
{
LLFloaterReg::showInstance("item_properties", LLSD().with("id",mUUID),TRUE);
// Force it to show on top as this floater has a tendency to hide when confirmation dialog shows up
@@ -446,331 +446,331 @@ void LLInvFVBridge::navigateToFolder(bool new_window, bool change_mode)
void LLInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch)
{
- // Deactivate gestures when moving them into Trash
- LLInvFVBridge* bridge;
- LLInventoryModel* model = getInventoryModel();
- LLViewerInventoryItem* item = NULL;
- LLViewerInventoryCategory* cat = NULL;
- LLInventoryModel::cat_array_t descendent_categories;
- LLInventoryModel::item_array_t descendent_items;
- S32 count = batch.size();
- S32 i,j;
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch[i]);
- if(!bridge || !bridge->isItemRemovable()) continue;
- item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
- if (item)
- {
- if(LLAssetType::AT_GESTURE == item->getType())
- {
- LLGestureMgr::instance().deactivateGesture(item->getUUID());
- }
- }
- }
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch[i]);
- if(!bridge || !bridge->isItemRemovable()) continue;
- cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID());
- if (cat)
- {
- gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, FALSE );
- for (j=0; j<descendent_items.size(); j++)
- {
- if(LLAssetType::AT_GESTURE == descendent_items[j]->getType())
- {
- LLGestureMgr::instance().deactivateGesture(descendent_items[j]->getUUID());
- }
- }
- }
- }
- removeBatchNoCheck(batch);
- model->checkTrashOverflow();
+ // Deactivate gestures when moving them into Trash
+ LLInvFVBridge* bridge;
+ LLInventoryModel* model = getInventoryModel();
+ LLViewerInventoryItem* item = NULL;
+ LLViewerInventoryCategory* cat = NULL;
+ LLInventoryModel::cat_array_t descendent_categories;
+ LLInventoryModel::item_array_t descendent_items;
+ S32 count = batch.size();
+ S32 i,j;
+ for(i = 0; i < count; ++i)
+ {
+ bridge = (LLInvFVBridge*)(batch[i]);
+ if(!bridge || !bridge->isItemRemovable()) continue;
+ item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
+ if (item)
+ {
+ if(LLAssetType::AT_GESTURE == item->getType())
+ {
+ LLGestureMgr::instance().deactivateGesture(item->getUUID());
+ }
+ }
+ }
+ for(i = 0; i < count; ++i)
+ {
+ bridge = (LLInvFVBridge*)(batch[i]);
+ if(!bridge || !bridge->isItemRemovable()) continue;
+ cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID());
+ if (cat)
+ {
+ gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, FALSE );
+ for (j=0; j<descendent_items.size(); j++)
+ {
+ if(LLAssetType::AT_GESTURE == descendent_items[j]->getType())
+ {
+ LLGestureMgr::instance().deactivateGesture(descendent_items[j]->getUUID());
+ }
+ }
+ }
+ }
+ removeBatchNoCheck(batch);
+ model->checkTrashOverflow();
}
void LLInvFVBridge::removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& batch)
{
- // this method moves a bunch of items and folders to the trash. As
- // per design guidelines for the inventory model, the message is
- // built and the accounting is performed first. After all of that,
- // we call LLInventoryModel::moveObject() to move everything
- // around.
- LLInvFVBridge* bridge;
- LLInventoryModel* model = getInventoryModel();
- if(!model) return;
- LLMessageSystem* msg = gMessageSystem;
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- LLViewerInventoryItem* item = NULL;
- uuid_vec_t move_ids;
- LLInventoryModel::update_map_t update;
- bool start_new_message = true;
- S32 count = batch.size();
- S32 i;
-
- // first, hide any 'preview' floaters that correspond to the items
- // being deleted.
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch[i]);
- if(!bridge || !bridge->isItemRemovable()) continue;
- item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
- if(item)
- {
- LLPreview::hide(item->getUUID());
- }
- }
-
- // do the inventory move to trash
-
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch[i]);
- if(!bridge || !bridge->isItemRemovable()) continue;
- item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
- if(item)
- {
- if(item->getParentUUID() == trash_id) continue;
- move_ids.push_back(item->getUUID());
- --update[item->getParentUUID()];
- ++update[trash_id];
- if(start_new_message)
- {
- start_new_message = false;
- msg->newMessageFast(_PREHASH_MoveInventoryItem);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addBOOLFast(_PREHASH_Stamp, TRUE);
- }
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
- msg->addUUIDFast(_PREHASH_FolderID, trash_id);
- msg->addString("NewName", NULL);
- if(msg->isSendFullFast(_PREHASH_InventoryData))
- {
- start_new_message = true;
- gAgent.sendReliableMessage();
- gInventory.accountForUpdate(update);
- update.clear();
- }
- }
- }
- if(!start_new_message)
- {
- start_new_message = true;
- gAgent.sendReliableMessage();
- gInventory.accountForUpdate(update);
- update.clear();
- }
-
- for(i = 0; i < count; ++i)
- {
- bridge = (LLInvFVBridge*)(batch[i]);
- if(!bridge || !bridge->isItemRemovable()) continue;
- LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID());
- if(cat)
- {
- if(cat->getParentUUID() == trash_id) continue;
- move_ids.push_back(cat->getUUID());
- --update[cat->getParentUUID()];
- ++update[trash_id];
- if(start_new_message)
- {
- start_new_message = false;
- msg->newMessageFast(_PREHASH_MoveInventoryFolder);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addBOOL("Stamp", TRUE);
- }
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addUUIDFast(_PREHASH_FolderID, cat->getUUID());
- msg->addUUIDFast(_PREHASH_ParentID, trash_id);
- if(msg->isSendFullFast(_PREHASH_InventoryData))
- {
- start_new_message = true;
- gAgent.sendReliableMessage();
- gInventory.accountForUpdate(update);
- update.clear();
- }
- }
- }
- if(!start_new_message)
- {
- gAgent.sendReliableMessage();
- gInventory.accountForUpdate(update);
- }
-
- // move everything.
- uuid_vec_t::iterator it = move_ids.begin();
- uuid_vec_t::iterator end = move_ids.end();
- for(; it != end; ++it)
- {
- gInventory.moveObject((*it), trash_id);
- LLViewerInventoryItem* item = gInventory.getItem(*it);
- if (item)
- {
- model->updateItem(item);
- }
- }
-
- // notify inventory observers.
- model->notifyObservers();
+ // this method moves a bunch of items and folders to the trash. As
+ // per design guidelines for the inventory model, the message is
+ // built and the accounting is performed first. After all of that,
+ // we call LLInventoryModel::moveObject() to move everything
+ // around.
+ LLInvFVBridge* bridge;
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ LLMessageSystem* msg = gMessageSystem;
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLViewerInventoryItem* item = NULL;
+ uuid_vec_t move_ids;
+ LLInventoryModel::update_map_t update;
+ bool start_new_message = true;
+ S32 count = batch.size();
+ S32 i;
+
+ // first, hide any 'preview' floaters that correspond to the items
+ // being deleted.
+ for(i = 0; i < count; ++i)
+ {
+ bridge = (LLInvFVBridge*)(batch[i]);
+ if(!bridge || !bridge->isItemRemovable()) continue;
+ item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
+ if(item)
+ {
+ LLPreview::hide(item->getUUID());
+ }
+ }
+
+ // do the inventory move to trash
+
+ for(i = 0; i < count; ++i)
+ {
+ bridge = (LLInvFVBridge*)(batch[i]);
+ if(!bridge || !bridge->isItemRemovable()) continue;
+ item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
+ if(item)
+ {
+ if(item->getParentUUID() == trash_id) continue;
+ move_ids.push_back(item->getUUID());
+ --update[item->getParentUUID()];
+ ++update[trash_id];
+ if(start_new_message)
+ {
+ start_new_message = false;
+ msg->newMessageFast(_PREHASH_MoveInventoryItem);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addBOOLFast(_PREHASH_Stamp, TRUE);
+ }
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
+ msg->addUUIDFast(_PREHASH_FolderID, trash_id);
+ msg->addString("NewName", NULL);
+ if(msg->isSendFullFast(_PREHASH_InventoryData))
+ {
+ start_new_message = true;
+ gAgent.sendReliableMessage();
+ gInventory.accountForUpdate(update);
+ update.clear();
+ }
+ }
+ }
+ if(!start_new_message)
+ {
+ start_new_message = true;
+ gAgent.sendReliableMessage();
+ gInventory.accountForUpdate(update);
+ update.clear();
+ }
+
+ for(i = 0; i < count; ++i)
+ {
+ bridge = (LLInvFVBridge*)(batch[i]);
+ if(!bridge || !bridge->isItemRemovable()) continue;
+ LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID());
+ if(cat)
+ {
+ if(cat->getParentUUID() == trash_id) continue;
+ move_ids.push_back(cat->getUUID());
+ --update[cat->getParentUUID()];
+ ++update[trash_id];
+ if(start_new_message)
+ {
+ start_new_message = false;
+ msg->newMessageFast(_PREHASH_MoveInventoryFolder);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addBOOL("Stamp", TRUE);
+ }
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addUUIDFast(_PREHASH_FolderID, cat->getUUID());
+ msg->addUUIDFast(_PREHASH_ParentID, trash_id);
+ if(msg->isSendFullFast(_PREHASH_InventoryData))
+ {
+ start_new_message = true;
+ gAgent.sendReliableMessage();
+ gInventory.accountForUpdate(update);
+ update.clear();
+ }
+ }
+ }
+ if(!start_new_message)
+ {
+ gAgent.sendReliableMessage();
+ gInventory.accountForUpdate(update);
+ }
+
+ // move everything.
+ uuid_vec_t::iterator it = move_ids.begin();
+ uuid_vec_t::iterator end = move_ids.end();
+ for(; it != end; ++it)
+ {
+ gInventory.moveObject((*it), trash_id);
+ LLViewerInventoryItem* item = gInventory.getItem(*it);
+ if (item)
+ {
+ model->updateItem(item);
+ }
+ }
+
+ // notify inventory observers.
+ model->notifyObservers();
}
BOOL LLInvFVBridge::isClipboardPasteable() const
{
- // Return FALSE on degenerated cases: empty clipboard, no inventory, no agent
- if (!LLClipboard::instance().hasContents() || !isAgentInventory())
- {
- return FALSE;
- }
- LLInventoryModel* model = getInventoryModel();
- if (!model)
- {
- return FALSE;
- }
-
- // In cut mode, whatever is on the clipboard is always pastable
- if (LLClipboard::instance().isCutMode())
- {
- return TRUE;
- }
-
- // In normal mode, we need to check each element of the clipboard to know if we can paste or not
- std::vector<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
- S32 count = objects.size();
- for(S32 i = 0; i < count; i++)
- {
- const LLUUID &item_id = objects.at(i);
-
- // Folders are pastable if all items in there are copyable
- const LLInventoryCategory *cat = model->getCategory(item_id);
- if (cat)
- {
- LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, item_id);
- if (!cat_br.isItemCopyable(false))
- return FALSE;
- // Skip to the next item in the clipboard
- continue;
- }
-
- // Each item must be copyable to be pastable
- LLItemBridge item_br(mInventoryPanel.get(), mRoot, item_id);
- if (!item_br.isItemCopyable(false))
- {
- return FALSE;
- }
- }
- return TRUE;
+ // Return FALSE on degenerated cases: empty clipboard, no inventory, no agent
+ if (!LLClipboard::instance().hasContents() || !isAgentInventory())
+ {
+ return FALSE;
+ }
+ LLInventoryModel* model = getInventoryModel();
+ if (!model)
+ {
+ return FALSE;
+ }
+
+ // In cut mode, whatever is on the clipboard is always pastable
+ if (LLClipboard::instance().isCutMode())
+ {
+ return TRUE;
+ }
+
+ // In normal mode, we need to check each element of the clipboard to know if we can paste or not
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+ S32 count = objects.size();
+ for(S32 i = 0; i < count; i++)
+ {
+ const LLUUID &item_id = objects.at(i);
+
+ // Folders are pastable if all items in there are copyable
+ const LLInventoryCategory *cat = model->getCategory(item_id);
+ if (cat)
+ {
+ LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, item_id);
+ if (!cat_br.isItemCopyable(false))
+ return FALSE;
+ // Skip to the next item in the clipboard
+ continue;
+ }
+
+ // Each item must be copyable to be pastable
+ LLItemBridge item_br(mInventoryPanel.get(), mRoot, item_id);
+ if (!item_br.isItemCopyable(false))
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
{
- if (!LLClipboard::instance().hasContents() || !isAgentInventory())
- {
- return FALSE;
- }
- const LLInventoryModel* model = getInventoryModel();
- if (!model)
- {
- return FALSE;
- }
-
- std::vector<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
- S32 count = objects.size();
- for(S32 i = 0; i < count; i++)
- {
- const LLInventoryItem *item = model->getItem(objects.at(i));
- if (item)
- {
- if (!LLAssetType::lookupCanLink(item->getActualType()))
- {
- return FALSE;
- }
+ if (!LLClipboard::instance().hasContents() || !isAgentInventory())
+ {
+ return FALSE;
+ }
+ const LLInventoryModel* model = getInventoryModel();
+ if (!model)
+ {
+ return FALSE;
+ }
+
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+ S32 count = objects.size();
+ for(S32 i = 0; i < count; i++)
+ {
+ const LLInventoryItem *item = model->getItem(objects.at(i));
+ if (item)
+ {
+ if (!LLAssetType::lookupCanLink(item->getActualType()))
+ {
+ return FALSE;
+ }
if (gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()))
{
return FALSE;
}
- }
- const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i));
- if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
- {
- return FALSE;
- }
- }
- return TRUE;
+ }
+ const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i));
+ if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
void disable_context_entries_if_present(LLMenuGL& menu,
const menuentry_vec_t &disabled_entries)
{
- const LLView::child_list_t *list = menu.getChildList();
- for (LLView::child_list_t::const_iterator itor = list->begin();
- itor != list->end();
- ++itor)
- {
- LLView *menu_item = (*itor);
- std::string name = menu_item->getName();
-
- // descend into split menus:
- LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(menu_item);
- if ((name == "More") && branchp)
- {
- disable_context_entries_if_present(*branchp->getBranch(), disabled_entries);
- }
-
- bool found = false;
- menuentry_vec_t::const_iterator itor2;
- for (itor2 = disabled_entries.begin(); itor2 != disabled_entries.end(); ++itor2)
- {
- if (*itor2 == name)
- {
- found = true;
- break;
- }
- }
+ const LLView::child_list_t *list = menu.getChildList();
+ for (LLView::child_list_t::const_iterator itor = list->begin();
+ itor != list->end();
+ ++itor)
+ {
+ LLView *menu_item = (*itor);
+ std::string name = menu_item->getName();
+
+ // descend into split menus:
+ LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(menu_item);
+ if ((name == "More") && branchp)
+ {
+ disable_context_entries_if_present(*branchp->getBranch(), disabled_entries);
+ }
+
+ bool found = false;
+ menuentry_vec_t::const_iterator itor2;
+ for (itor2 = disabled_entries.begin(); itor2 != disabled_entries.end(); ++itor2)
+ {
+ if (*itor2 == name)
+ {
+ found = true;
+ break;
+ }
+ }
if (found)
{
- menu_item->setVisible(TRUE);
- // A bit of a hack so we can remember that some UI element explicitly set this to be visible
- // so that some other UI element from multi-select doesn't later set this invisible.
- menu_item->pushVisible(TRUE);
+ menu_item->setVisible(TRUE);
+ // A bit of a hack so we can remember that some UI element explicitly set this to be visible
+ // so that some other UI element from multi-select doesn't later set this invisible.
+ menu_item->pushVisible(TRUE);
- menu_item->setEnabled(FALSE);
+ menu_item->setEnabled(FALSE);
}
}
}
-void hide_context_entries(LLMenuGL& menu,
- const menuentry_vec_t &entries_to_show,
- const menuentry_vec_t &disabled_entries)
+void hide_context_entries(LLMenuGL& menu,
+ const menuentry_vec_t &entries_to_show,
+ const menuentry_vec_t &disabled_entries)
{
- const LLView::child_list_t *list = menu.getChildList();
+ const LLView::child_list_t *list = menu.getChildList();
- // For removing double separators or leading separator. Start at true so that
- // if the first element is a separator, it will not be shown.
- bool is_previous_entry_separator = true;
+ // For removing double separators or leading separator. Start at true so that
+ // if the first element is a separator, it will not be shown.
+ bool is_previous_entry_separator = true;
- for (LLView::child_list_t::const_iterator itor = list->begin();
- itor != list->end();
- ++itor)
- {
- LLView *menu_item = (*itor);
- std::string name = menu_item->getName();
+ for (LLView::child_list_t::const_iterator itor = list->begin();
+ itor != list->end();
+ ++itor)
+ {
+ LLView *menu_item = (*itor);
+ std::string name = menu_item->getName();
- // descend into split menus:
- LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(menu_item);
+ // descend into split menus:
+ LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(menu_item);
if (((name == "More") || (name == "create_new")) && branchp)
- {
- hide_context_entries(*branchp->getBranch(), entries_to_show, disabled_entries);
- }
+ {
+ hide_context_entries(*branchp->getBranch(), entries_to_show, disabled_entries);
+ }
- bool found = false;
+ bool found = false;
std::string myinput;
std::vector<std::string> mylist{ "a", "b", "c" };
@@ -781,21 +781,21 @@ void hide_context_entries(LLMenuGL& menu,
found = true;
}
- // Don't allow multiple separators in a row (e.g. such as if there are no items
- // between two separators).
- if (found)
- {
- const bool is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(menu_item) != NULL);
- found = !(is_entry_separator && is_previous_entry_separator);
- is_previous_entry_separator = is_entry_separator;
- }
-
- if (!found)
- {
- if (!menu_item->getLastVisible())
- {
- menu_item->setVisible(FALSE);
- }
+ // Don't allow multiple separators in a row (e.g. such as if there are no items
+ // between two separators).
+ if (found)
+ {
+ const bool is_entry_separator = (dynamic_cast<LLMenuItemSeparatorGL *>(menu_item) != NULL);
+ found = !(is_entry_separator && is_previous_entry_separator);
+ is_previous_entry_separator = is_entry_separator;
+ }
+
+ if (!found)
+ {
+ if (!menu_item->getLastVisible())
+ {
+ menu_item->setVisible(FALSE);
+ }
if (menu_item->getEnabled())
{
@@ -812,45 +812,45 @@ void hide_context_entries(LLMenuGL& menu,
menu_item->setEnabled(FALSE);
}
}
- }
- else
- {
- menu_item->setVisible(TRUE);
- // A bit of a hack so we can remember that some UI element explicitly set this to be visible
- // so that some other UI element from multi-select doesn't later set this invisible.
- menu_item->pushVisible(TRUE);
+ }
+ else
+ {
+ menu_item->setVisible(TRUE);
+ // A bit of a hack so we can remember that some UI element explicitly set this to be visible
+ // so that some other UI element from multi-select doesn't later set this invisible.
+ menu_item->pushVisible(TRUE);
- bool enabled = true;
- for (itor2 = disabled_entries.begin(); enabled && (itor2 != disabled_entries.end()); ++itor2)
- {
- enabled &= (*itor2 != name);
- }
+ bool enabled = true;
+ for (itor2 = disabled_entries.begin(); enabled && (itor2 != disabled_entries.end()); ++itor2)
+ {
+ enabled &= (*itor2 != name);
+ }
- menu_item->setEnabled(enabled);
- }
- }
+ menu_item->setEnabled(enabled);
+ }
+ }
}
// Helper for commonly-used entries
void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
- menuentry_vec_t &items,
- menuentry_vec_t &disabled_items, U32 flags)
+ menuentry_vec_t &items,
+ menuentry_vec_t &disabled_items, U32 flags)
{
- const LLInventoryObject *obj = getInventoryObject();
+ const LLInventoryObject *obj = getInventoryObject();
bool single_folder_root = (mRoot == NULL);
- if (obj)
- {
-
- if (obj->getType() != LLAssetType::AT_CATEGORY)
- {
- items.push_back(std::string("Copy Separator"));
- }
- items.push_back(std::string("Copy"));
- if (!isItemCopyable())
- {
- disabled_items.push_back(std::string("Copy"));
- }
+ if (obj)
+ {
+
+ if (obj->getType() != LLAssetType::AT_CATEGORY)
+ {
+ items.push_back(std::string("Copy Separator"));
+ }
+ items.push_back(std::string("Copy"));
+ if (!isItemCopyable())
+ {
+ disabled_items.push_back(std::string("Copy"));
+ }
if (isAgentInventory() && !single_folder_root)
{
@@ -865,35 +865,35 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
}
}
- if (obj->getIsLinkType())
- {
- items.push_back(std::string("Find Original"));
- if (isLinkedObjectMissing())
- {
- disabled_items.push_back(std::string("Find Original"));
- }
+ if (obj->getIsLinkType())
+ {
+ items.push_back(std::string("Find Original"));
+ if (isLinkedObjectMissing())
+ {
+ disabled_items.push_back(std::string("Find Original"));
+ }
items.push_back(std::string("Cut"));
if (!isItemMovable() || !isItemRemovable())
{
disabled_items.push_back(std::string("Cut"));
}
- }
- else
- {
- if (LLAssetType::lookupCanLink(obj->getType()))
- {
- items.push_back(std::string("Find Links"));
- }
-
- if (!isInboxFolder() && !single_folder_root)
- {
- items.push_back(std::string("Rename"));
- if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0))
- {
- disabled_items.push_back(std::string("Rename"));
- }
- }
+ }
+ else
+ {
+ if (LLAssetType::lookupCanLink(obj->getType()))
+ {
+ items.push_back(std::string("Find Links"));
+ }
+
+ if (!isInboxFolder() && !single_folder_root)
+ {
+ items.push_back(std::string("Rename"));
+ if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0))
+ {
+ disabled_items.push_back(std::string("Rename"));
+ }
+ }
items.push_back(std::string("thumbnail"));
if (isLibraryItem())
@@ -902,35 +902,35 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
}
LLViewerInventoryItem *inv_item = gInventory.getItem(mUUID);
- if (show_asset_id)
- {
- items.push_back(std::string("Copy Asset UUID"));
-
- bool is_asset_knowable = false;
-
- if (inv_item)
- {
- is_asset_knowable = LLAssetType::lookupIsAssetIDKnowable(inv_item->getType());
- }
- if ( !is_asset_knowable // disable menu item for Inventory items with unknown asset. EXT-5308
- || (! ( isItemPermissive() || gAgent.isGodlike() ) )
- || (flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Copy Asset UUID"));
- }
- }
+ if (show_asset_id)
+ {
+ items.push_back(std::string("Copy Asset UUID"));
+
+ bool is_asset_knowable = false;
+
+ if (inv_item)
+ {
+ is_asset_knowable = LLAssetType::lookupIsAssetIDKnowable(inv_item->getType());
+ }
+ if ( !is_asset_knowable // disable menu item for Inventory items with unknown asset. EXT-5308
+ || (! ( isItemPermissive() || gAgent.isGodlike() ) )
+ || (flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Copy Asset UUID"));
+ }
+ }
if(!single_folder_root)
{
- items.push_back(std::string("Cut"));
- if (!isItemMovable() || !isItemRemovable())
- {
- disabled_items.push_back(std::string("Cut"));
- }
+ items.push_back(std::string("Cut"));
+ if (!isItemMovable() || !isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Cut"));
+ }
- if (canListOnMarketplace() && !isMarketplaceListingsFolder() && !isInboxFolder())
- {
- items.push_back(std::string("Marketplace Separator"));
+ if (canListOnMarketplace() && !isMarketplaceListingsFolder() && !isInboxFolder())
+ {
+ items.push_back(std::string("Marketplace Separator"));
if (gMenuHolder->getChild<LLView>("MarketplaceListings")->getVisible())
{
@@ -942,152 +942,152 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
disabled_items.push_back(std::string("Marketplace Move"));
}
}
- }
}
- }
- }
+ }
+ }
+ }
- // Don't allow items to be pasted directly into the COF or the inbox
- if (!isCOFFolder() && !isInboxFolder())
- {
- items.push_back(std::string("Paste"));
- }
- if (!isClipboardPasteable() || ((flags & FIRST_SELECTED_ITEM) == 0))
- {
- disabled_items.push_back(std::string("Paste"));
- }
+ // Don't allow items to be pasted directly into the COF or the inbox
+ if (!isCOFFolder() && !isInboxFolder())
+ {
+ items.push_back(std::string("Paste"));
+ }
+ if (!isClipboardPasteable() || ((flags & FIRST_SELECTED_ITEM) == 0))
+ {
+ disabled_items.push_back(std::string("Paste"));
+ }
static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryLinking", true);
- if (inventory_linking)
- {
- items.push_back(std::string("Paste As Link"));
- if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Paste As Link"));
- }
- }
-
- if (obj->getType() != LLAssetType::AT_CATEGORY)
- {
- items.push_back(std::string("Paste Separator"));
- }
+ if (inventory_linking)
+ {
+ items.push_back(std::string("Paste As Link"));
+ if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
+ }
+
+ if (obj->getType() != LLAssetType::AT_CATEGORY)
+ {
+ items.push_back(std::string("Paste Separator"));
+ }
if(!single_folder_root)
{
addDeleteContextMenuOptions(items, disabled_items);
}
- if (!isPanelActive("All Items") && !isPanelActive("comb_single_folder_inv"))
- {
- items.push_back(std::string("Show in Main Panel"));
- }
+ if (!isPanelActive("All Items") && !isPanelActive("comb_single_folder_inv"))
+ {
+ items.push_back(std::string("Show in Main Panel"));
+ }
}
void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LL_DEBUGS() << "LLInvFVBridge::buildContextMenu()" << LL_ENDL;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
- else
- {
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
-
- addOpenRightClickMenuOption(items);
- items.push_back(std::string("Properties"));
-
- getClipboardEntries(true, items, disabled_items, flags);
- }
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ LL_DEBUGS() << "LLInvFVBridge::buildContextMenu()" << LL_ENDL;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+ if(isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
+ else
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+
+ addOpenRightClickMenuOption(items);
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+ }
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
bool get_selection_item_uuids(LLFolderView::selected_items_t& selected_items, uuid_vec_t& ids)
{
- uuid_vec_t results;
+ uuid_vec_t results;
S32 non_item = 0;
- for(LLFolderView::selected_items_t::iterator it = selected_items.begin(); it != selected_items.end(); ++it)
- {
- LLItemBridge *view_model = dynamic_cast<LLItemBridge *>((*it)->getViewModelItem());
-
- if(view_model && view_model->getUUID().notNull())
- {
- results.push_back(view_model->getUUID());
- }
+ for(LLFolderView::selected_items_t::iterator it = selected_items.begin(); it != selected_items.end(); ++it)
+ {
+ LLItemBridge *view_model = dynamic_cast<LLItemBridge *>((*it)->getViewModelItem());
+
+ if(view_model && view_model->getUUID().notNull())
+ {
+ results.push_back(view_model->getUUID());
+ }
else
{
non_item++;
}
- }
- if (non_item == 0)
- {
- ids = results;
- return true;
- }
- return false;
+ }
+ if (non_item == 0)
+ {
+ ids = results;
+ return true;
+ }
+ return false;
}
void LLInvFVBridge::addTrashContextMenuOptions(menuentry_vec_t &items,
- menuentry_vec_t &disabled_items)
-{
- const LLInventoryObject *obj = getInventoryObject();
- if (obj && obj->getIsLinkType())
- {
- items.push_back(std::string("Find Original"));
- if (isLinkedObjectMissing())
- {
- disabled_items.push_back(std::string("Find Original"));
- }
- }
- items.push_back(std::string("Purge Item"));
- if (!isItemRemovable())
- {
- disabled_items.push_back(std::string("Purge Item"));
- }
- items.push_back(std::string("Restore Item"));
+ menuentry_vec_t &disabled_items)
+{
+ const LLInventoryObject *obj = getInventoryObject();
+ if (obj && obj->getIsLinkType())
+ {
+ items.push_back(std::string("Find Original"));
+ if (isLinkedObjectMissing())
+ {
+ disabled_items.push_back(std::string("Find Original"));
+ }
+ }
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+ items.push_back(std::string("Restore Item"));
}
void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items,
- menuentry_vec_t &disabled_items)
+ menuentry_vec_t &disabled_items)
{
- const LLInventoryObject *obj = getInventoryObject();
+ const LLInventoryObject *obj = getInventoryObject();
- // Don't allow delete as a direct option from COF folder.
- if (obj && obj->getIsLinkType() && isCOFFolder() && get_is_item_worn(mUUID))
- {
- return;
- }
+ // Don't allow delete as a direct option from COF folder.
+ if (obj && obj->getIsLinkType() && isCOFFolder() && get_is_item_worn(mUUID))
+ {
+ return;
+ }
- items.push_back(std::string("Delete"));
+ items.push_back(std::string("Delete"));
- if (!isItemRemovable() || isPanelActive("Favorite Items"))
- {
- disabled_items.push_back(std::string("Delete"));
- }
+ if (!isItemRemovable() || isPanelActive("Favorite Items"))
+ {
+ disabled_items.push_back(std::string("Delete"));
+ }
}
void LLInvFVBridge::addOpenRightClickMenuOption(menuentry_vec_t &items)
{
- const LLInventoryObject *obj = getInventoryObject();
- const BOOL is_link = (obj && obj->getIsLinkType());
+ const LLInventoryObject *obj = getInventoryObject();
+ const BOOL is_link = (obj && obj->getIsLinkType());
- if (is_link)
- items.push_back(std::string("Open Original"));
- else
- items.push_back(std::string("Open"));
+ if (is_link)
+ items.push_back(std::string("Open Original"));
+ else
+ items.push_back(std::string("Open"));
}
void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags,
- menuentry_vec_t &items,
- menuentry_vec_t &disabled_items)
+ menuentry_vec_t &items,
+ menuentry_vec_t &disabled_items)
{
S32 depth = depth_nesting_in_marketplace(mUUID);
if (depth == 1)
@@ -1198,7 +1198,7 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags,
disabled_items.push_back(std::string("New Folder"));
}
}
-
+
// Options available at all levels on items and categories
if (!LLMarketplaceData::instance().isListed(listing_folder_id) || version_folder_id.isNull())
{
@@ -1211,92 +1211,92 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags,
void LLInvFVBridge::addLinkReplaceMenuOption(menuentry_vec_t& items, menuentry_vec_t& disabled_items)
{
- const LLInventoryObject* obj = getInventoryObject();
+ const LLInventoryObject* obj = getInventoryObject();
- if (isAgentInventory() && obj && obj->getType() != LLAssetType::AT_CATEGORY && obj->getType() != LLAssetType::AT_LINK_FOLDER)
- {
- items.push_back(std::string("Replace Links"));
+ if (isAgentInventory() && obj && obj->getType() != LLAssetType::AT_CATEGORY && obj->getType() != LLAssetType::AT_LINK_FOLDER)
+ {
+ items.push_back(std::string("Replace Links"));
- if (mRoot->getSelectedCount() != 1)
- {
- disabled_items.push_back(std::string("Replace Links"));
- }
- }
+ if (mRoot->getSelectedCount() != 1)
+ {
+ disabled_items.push_back(std::string("Replace Links"));
+ }
+ }
}
// *TODO: remove this
BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
{
- BOOL rv = FALSE;
+ BOOL rv = FALSE;
- const LLInventoryObject* obj = getInventoryObject();
+ const LLInventoryObject* obj = getInventoryObject();
- if(obj)
- {
- *type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType());
- if(*type == DAD_NONE)
- {
- return FALSE;
- }
+ if(obj)
+ {
+ *type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType());
+ if(*type == DAD_NONE)
+ {
+ return FALSE;
+ }
- *id = obj->getUUID();
- //object_ids.push_back(obj->getUUID());
+ *id = obj->getUUID();
+ //object_ids.push_back(obj->getUUID());
- if (*type == DAD_CATEGORY)
- {
- LLInventoryModelBackgroundFetch::instance().start(obj->getUUID());
- }
+ if (*type == DAD_CATEGORY)
+ {
+ LLInventoryModelBackgroundFetch::instance().start(obj->getUUID());
+ }
- rv = TRUE;
- }
+ rv = TRUE;
+ }
- return rv;
+ return rv;
}
LLInventoryObject* LLInvFVBridge::getInventoryObject() const
{
- LLInventoryObject* obj = NULL;
- LLInventoryModel* model = getInventoryModel();
- if(model)
- {
- obj = (LLInventoryObject*)model->getObject(mUUID);
- }
- return obj;
+ LLInventoryObject* obj = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ obj = (LLInventoryObject*)model->getObject(mUUID);
+ }
+ return obj;
}
LLInventoryModel* LLInvFVBridge::getInventoryModel() const
{
- LLInventoryPanel* panel = mInventoryPanel.get();
- return panel ? panel->getModel() : NULL;
+ LLInventoryPanel* panel = mInventoryPanel.get();
+ return panel ? panel->getModel() : NULL;
}
LLInventoryFilter* LLInvFVBridge::getInventoryFilter() const
{
- LLInventoryPanel* panel = mInventoryPanel.get();
- return panel ? &(panel->getFilter()) : NULL;
+ LLInventoryPanel* panel = mInventoryPanel.get();
+ return panel ? &(panel->getFilter()) : NULL;
}
BOOL LLInvFVBridge::isItemInTrash() const
{
- LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- return model->isObjectDescendentOf(mUUID, trash_id);
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ return model->isObjectDescendentOf(mUUID, trash_id);
}
BOOL LLInvFVBridge::isLinkedObjectInTrash() const
{
- if (isItemInTrash()) return TRUE;
+ if (isItemInTrash()) return TRUE;
- const LLInventoryObject *obj = getInventoryObject();
- if (obj && obj->getIsLinkType())
- {
- LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- return model->isObjectDescendentOf(obj->getLinkedUUID(), trash_id);
- }
- return FALSE;
+ const LLInventoryObject *obj = getInventoryObject();
+ if (obj && obj->getIsLinkType())
+ {
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ return model->isObjectDescendentOf(obj->getLinkedUUID(), trash_id);
+ }
+ return FALSE;
}
bool LLInvFVBridge::isItemInOutfits() const
@@ -1311,207 +1311,207 @@ bool LLInvFVBridge::isItemInOutfits() const
BOOL LLInvFVBridge::isLinkedObjectMissing() const
{
- const LLInventoryObject *obj = getInventoryObject();
- if (!obj)
- {
- return TRUE;
- }
- if (obj->getIsLinkType() && LLAssetType::lookupIsLinkType(obj->getType()))
- {
- return TRUE;
- }
- return FALSE;
+ const LLInventoryObject *obj = getInventoryObject();
+ if (!obj)
+ {
+ return TRUE;
+ }
+ if (obj->getIsLinkType() && LLAssetType::lookupIsLinkType(obj->getType()))
+ {
+ return TRUE;
+ }
+ return FALSE;
}
BOOL LLInvFVBridge::isAgentInventory() const
{
- const LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- if(gInventory.getRootFolderID() == mUUID) return TRUE;
- return model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID());
+ const LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ if(gInventory.getRootFolderID() == mUUID) return TRUE;
+ return model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID());
}
BOOL LLInvFVBridge::isCOFFolder() const
{
- return LLAppearanceMgr::instance().getIsInCOF(mUUID);
+ return LLAppearanceMgr::instance().getIsInCOF(mUUID);
}
// *TODO : Suppress isInboxFolder() once Merchant Outbox is fully deprecated
BOOL LLInvFVBridge::isInboxFolder() const
{
- const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
-
- if (inbox_id.isNull())
- {
- return FALSE;
- }
-
- return gInventory.isObjectDescendentOf(mUUID, inbox_id);
+ const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
+
+ if (inbox_id.isNull())
+ {
+ return FALSE;
+ }
+
+ return gInventory.isObjectDescendentOf(mUUID, inbox_id);
}
BOOL LLInvFVBridge::isMarketplaceListingsFolder() const
{
- const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
-
- if (folder_id.isNull())
- {
- return FALSE;
- }
-
- return gInventory.isObjectDescendentOf(mUUID, folder_id);
+ const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
+
+ if (folder_id.isNull())
+ {
+ return FALSE;
+ }
+
+ return gInventory.isObjectDescendentOf(mUUID, folder_id);
}
BOOL LLInvFVBridge::isItemPermissive() const
{
- return FALSE;
+ return FALSE;
}
// static
void LLInvFVBridge::changeItemParent(LLInventoryModel* model,
- LLViewerInventoryItem* item,
- const LLUUID& new_parent_id,
- BOOL restamp)
+ LLViewerInventoryItem* item,
+ const LLUUID& new_parent_id,
+ BOOL restamp)
{
- model->changeItemParent(item, new_parent_id, restamp);
+ model->changeItemParent(item, new_parent_id, restamp);
}
// static
void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model,
- LLViewerInventoryCategory* cat,
- const LLUUID& new_parent_id,
- BOOL restamp)
+ LLViewerInventoryCategory* cat,
+ const LLUUID& new_parent_id,
+ BOOL restamp)
{
- model->changeCategoryParent(cat, new_parent_id, restamp);
+ model->changeCategoryParent(cat, new_parent_id, restamp);
}
LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
- LLAssetType::EType actual_asset_type,
- LLInventoryType::EType inv_type,
- LLInventoryPanel* inventory,
- LLFolderViewModelInventory* view_model,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags)
-{
- LLInvFVBridge* new_listener = NULL;
- switch(asset_type)
- {
- case LLAssetType::AT_TEXTURE:
- if(!(inv_type == LLInventoryType::IT_TEXTURE || inv_type == LLInventoryType::IT_SNAPSHOT))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLTextureBridge(inventory, root, uuid, inv_type);
- break;
-
- case LLAssetType::AT_SOUND:
- if(!(inv_type == LLInventoryType::IT_SOUND))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLSoundBridge(inventory, root, uuid);
- break;
-
- case LLAssetType::AT_LANDMARK:
- if(!(inv_type == LLInventoryType::IT_LANDMARK))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLLandmarkBridge(inventory, root, uuid, flags);
- break;
-
- case LLAssetType::AT_CALLINGCARD:
- if(!(inv_type == LLInventoryType::IT_CALLINGCARD))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLCallingCardBridge(inventory, root, uuid);
- break;
-
- case LLAssetType::AT_SCRIPT:
- if(!(inv_type == LLInventoryType::IT_LSL))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLItemBridge(inventory, root, uuid);
- break;
-
- case LLAssetType::AT_OBJECT:
- if(!(inv_type == LLInventoryType::IT_OBJECT || inv_type == LLInventoryType::IT_ATTACHMENT))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLObjectBridge(inventory, root, uuid, inv_type, flags);
- break;
-
- case LLAssetType::AT_NOTECARD:
- if(!(inv_type == LLInventoryType::IT_NOTECARD))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLNotecardBridge(inventory, root, uuid);
- break;
-
- case LLAssetType::AT_ANIMATION:
- if(!(inv_type == LLInventoryType::IT_ANIMATION))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLAnimationBridge(inventory, root, uuid);
- break;
-
- case LLAssetType::AT_GESTURE:
- if(!(inv_type == LLInventoryType::IT_GESTURE))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLGestureBridge(inventory, root, uuid);
- break;
-
- case LLAssetType::AT_LSL_TEXT:
- if(!(inv_type == LLInventoryType::IT_LSL))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLLSLTextBridge(inventory, root, uuid);
- break;
-
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_BODYPART:
- if(!(inv_type == LLInventoryType::IT_WEARABLE))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, LLWearableType::inventoryFlagsToWearableType(flags));
- break;
- case LLAssetType::AT_CATEGORY:
- if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
- {
- // Create a link folder handler instead
- new_listener = new LLLinkFolderBridge(inventory, root, uuid);
- }
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderViewModelInventory* view_model,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags)
+{
+ LLInvFVBridge* new_listener = NULL;
+ switch(asset_type)
+ {
+ case LLAssetType::AT_TEXTURE:
+ if(!(inv_type == LLInventoryType::IT_TEXTURE || inv_type == LLInventoryType::IT_SNAPSHOT))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLTextureBridge(inventory, root, uuid, inv_type);
+ break;
+
+ case LLAssetType::AT_SOUND:
+ if(!(inv_type == LLInventoryType::IT_SOUND))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLSoundBridge(inventory, root, uuid);
+ break;
+
+ case LLAssetType::AT_LANDMARK:
+ if(!(inv_type == LLInventoryType::IT_LANDMARK))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLLandmarkBridge(inventory, root, uuid, flags);
+ break;
+
+ case LLAssetType::AT_CALLINGCARD:
+ if(!(inv_type == LLInventoryType::IT_CALLINGCARD))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLCallingCardBridge(inventory, root, uuid);
+ break;
+
+ case LLAssetType::AT_SCRIPT:
+ if(!(inv_type == LLInventoryType::IT_LSL))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLItemBridge(inventory, root, uuid);
+ break;
+
+ case LLAssetType::AT_OBJECT:
+ if(!(inv_type == LLInventoryType::IT_OBJECT || inv_type == LLInventoryType::IT_ATTACHMENT))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLObjectBridge(inventory, root, uuid, inv_type, flags);
+ break;
+
+ case LLAssetType::AT_NOTECARD:
+ if(!(inv_type == LLInventoryType::IT_NOTECARD))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLNotecardBridge(inventory, root, uuid);
+ break;
+
+ case LLAssetType::AT_ANIMATION:
+ if(!(inv_type == LLInventoryType::IT_ANIMATION))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLAnimationBridge(inventory, root, uuid);
+ break;
+
+ case LLAssetType::AT_GESTURE:
+ if(!(inv_type == LLInventoryType::IT_GESTURE))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLGestureBridge(inventory, root, uuid);
+ break;
+
+ case LLAssetType::AT_LSL_TEXT:
+ if(!(inv_type == LLInventoryType::IT_LSL))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLLSLTextBridge(inventory, root, uuid);
+ break;
+
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_BODYPART:
+ if(!(inv_type == LLInventoryType::IT_WEARABLE))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, LLWearableType::inventoryFlagsToWearableType(flags));
+ break;
+ case LLAssetType::AT_CATEGORY:
+ if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
+ {
+ // Create a link folder handler instead
+ new_listener = new LLLinkFolderBridge(inventory, root, uuid);
+ }
else if (actual_asset_type == LLAssetType::AT_MARKETPLACE_FOLDER)
{
- // Create a marketplace folder handler
- new_listener = new LLMarketplaceFolderBridge(inventory, root, uuid);
+ // Create a marketplace folder handler
+ new_listener = new LLMarketplaceFolderBridge(inventory, root, uuid);
}
else
{
new_listener = new LLFolderBridge(inventory, root, uuid);
}
- break;
- case LLAssetType::AT_LINK:
- case LLAssetType::AT_LINK_FOLDER:
- // Only should happen for broken links.
- new_listener = new LLLinkItemBridge(inventory, root, uuid);
- break;
- case LLAssetType::AT_UNKNOWN:
- new_listener = new LLUnknownItemBridge(inventory, root, uuid);
- break;
- case LLAssetType::AT_IMAGE_TGA:
- case LLAssetType::AT_IMAGE_JPEG:
- //LL_WARNS() << LLAssetType::lookup(asset_type) << " asset type is unhandled for uuid " << uuid << LL_ENDL;
- break;
+ break;
+ case LLAssetType::AT_LINK:
+ case LLAssetType::AT_LINK_FOLDER:
+ // Only should happen for broken links.
+ new_listener = new LLLinkItemBridge(inventory, root, uuid);
+ break;
+ case LLAssetType::AT_UNKNOWN:
+ new_listener = new LLUnknownItemBridge(inventory, root, uuid);
+ break;
+ case LLAssetType::AT_IMAGE_TGA:
+ case LLAssetType::AT_IMAGE_JPEG:
+ //LL_WARNS() << LLAssetType::lookup(asset_type) << " asset type is unhandled for uuid " << uuid << LL_ENDL;
+ break;
case LLAssetType::AT_SETTINGS:
if (inv_type != LLInventoryType::IT_SETTINGS)
@@ -1529,27 +1529,27 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
new_listener = new LLMaterialBridge(inventory, root, uuid);
break;
- default:
- LL_INFOS_ONCE() << "Unhandled asset type (llassetstorage.h): "
- << (S32)asset_type << " (" << LLAssetType::lookup(asset_type) << ")" << LL_ENDL;
- break;
- }
+ default:
+ LL_INFOS_ONCE() << "Unhandled asset type (llassetstorage.h): "
+ << (S32)asset_type << " (" << LLAssetType::lookup(asset_type) << ")" << LL_ENDL;
+ break;
+ }
- if (new_listener)
- {
- new_listener->mInvType = inv_type;
- }
+ if (new_listener)
+ {
+ new_listener->mInvType = inv_type;
+ }
- return new_listener;
+ return new_listener;
}
void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid)
{
- LLInventoryObject* obj = model->getObject(uuid);
- if (obj)
- {
- remove_inventory_object(uuid, NULL);
- }
+ LLInventoryObject* obj = model->getObject(uuid);
+ if (obj)
+ {
+ remove_inventory_object(uuid, NULL);
+ }
}
void LLInvFVBridge::removeObject(LLInventoryModel *model, const LLUUID &uuid)
@@ -1570,93 +1570,93 @@ void LLInvFVBridge::removeObject(LLInventoryModel *model, const LLUUID &uuid)
bool LLInvFVBridge::canShare() const
{
- bool can_share = false;
-
- if (isAgentInventory())
- {
- const LLInventoryModel* model = getInventoryModel();
- if (model)
- {
- const LLViewerInventoryItem *item = model->getItem(mUUID);
- if (item)
- {
- if (LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item))
- {
- can_share = LLGiveInventory::isInventoryGiveAcceptable(item);
- }
- }
- else
- {
- // Categories can be given.
- can_share = (model->getCategory(mUUID) != NULL);
- }
-
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if ((mUUID == trash_id) || gInventory.isObjectDescendentOf(mUUID, trash_id))
- {
- can_share = false;
- }
- }
- }
-
- return can_share;
+ bool can_share = false;
+
+ if (isAgentInventory())
+ {
+ const LLInventoryModel* model = getInventoryModel();
+ if (model)
+ {
+ const LLViewerInventoryItem *item = model->getItem(mUUID);
+ if (item)
+ {
+ if (LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item))
+ {
+ can_share = LLGiveInventory::isInventoryGiveAcceptable(item);
+ }
+ }
+ else
+ {
+ // Categories can be given.
+ can_share = (model->getCategory(mUUID) != NULL);
+ }
+
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if ((mUUID == trash_id) || gInventory.isObjectDescendentOf(mUUID, trash_id))
+ {
+ can_share = false;
+ }
+ }
+ }
+
+ return can_share;
}
bool LLInvFVBridge::canListOnMarketplace() const
{
- LLInventoryModel * model = getInventoryModel();
-
- LLViewerInventoryCategory * cat = model->getCategory(mUUID);
- if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
- {
- return false;
- }
-
- if (!isAgentInventory())
- {
- return false;
- }
-
- LLViewerInventoryItem * item = model->getItem(mUUID);
- if (item)
- {
- if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
- {
- return false;
- }
-
- if (LLAssetType::AT_CALLINGCARD == item->getType())
- {
- return false;
- }
- }
-
- return true;
+ LLInventoryModel * model = getInventoryModel();
+
+ LLViewerInventoryCategory * cat = model->getCategory(mUUID);
+ if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+ {
+ return false;
+ }
+
+ if (!isAgentInventory())
+ {
+ return false;
+ }
+
+ LLViewerInventoryItem * item = model->getItem(mUUID);
+ if (item)
+ {
+ if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+ {
+ return false;
+ }
+
+ if (LLAssetType::AT_CALLINGCARD == item->getType())
+ {
+ return false;
+ }
+ }
+
+ return true;
}
bool LLInvFVBridge::canListOnMarketplaceNow() const
{
- bool can_list = true;
-
- const LLInventoryObject* obj = getInventoryObject();
- can_list &= (obj != NULL);
-
- if (can_list)
- {
- const LLUUID& object_id = obj->getLinkedUUID();
- can_list = object_id.notNull();
-
- if (can_list)
- {
- LLFolderViewFolder * object_folderp = mInventoryPanel.get() ? mInventoryPanel.get()->getFolderByID(object_id) : NULL;
- if (object_folderp)
- {
- can_list = !static_cast<LLFolderBridge*>(object_folderp->getViewModelItem())->isLoading();
- }
- }
-
- if (can_list)
- {
+ bool can_list = true;
+
+ const LLInventoryObject* obj = getInventoryObject();
+ can_list &= (obj != NULL);
+
+ if (can_list)
+ {
+ const LLUUID& object_id = obj->getLinkedUUID();
+ can_list = object_id.notNull();
+
+ if (can_list)
+ {
+ LLFolderViewFolder * object_folderp = mInventoryPanel.get() ? mInventoryPanel.get()->getFolderByID(object_id) : NULL;
+ if (object_folderp)
+ {
+ can_list = !static_cast<LLFolderBridge*>(object_folderp->getViewModelItem())->isLoading();
+ }
+ }
+
+ if (can_list)
+ {
std::string error_msg;
LLInventoryModel* model = getInventoryModel();
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
@@ -1678,24 +1678,24 @@ bool LLInvFVBridge::canListOnMarketplaceNow() const
{
can_list = false;
}
- }
- }
-
- return can_list;
+ }
+ }
+
+ return can_list;
}
LLToolDragAndDrop::ESource LLInvFVBridge::getDragSource() const
{
- if (gInventory.isObjectDescendentOf(getUUID(), gInventory.getRootFolderID()))
- {
- return LLToolDragAndDrop::SOURCE_AGENT;
- }
- else if (gInventory.isObjectDescendentOf(getUUID(), gInventory.getLibraryRootFolderID()))
- {
- return LLToolDragAndDrop::SOURCE_LIBRARY;
- }
+ if (gInventory.isObjectDescendentOf(getUUID(), gInventory.getRootFolderID()))
+ {
+ return LLToolDragAndDrop::SOURCE_AGENT;
+ }
+ else if (gInventory.isObjectDescendentOf(getUUID(), gInventory.getLibraryRootFolderID()))
+ {
+ return LLToolDragAndDrop::SOURCE_LIBRARY;
+ }
- return LLToolDragAndDrop::SOURCE_VIEWER;
+ return LLToolDragAndDrop::SOURCE_VIEWER;
}
@@ -1704,22 +1704,22 @@ LLToolDragAndDrop::ESource LLInvFVBridge::getDragSource() const
// | InventoryFVBridgeBuilder |
// +=================================================+
LLInvFVBridge* LLInventoryFolderViewModelBuilder::createBridge(LLAssetType::EType asset_type,
- LLAssetType::EType actual_asset_type,
- LLInventoryType::EType inv_type,
- LLInventoryPanel* inventory,
- LLFolderViewModelInventory* view_model,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags /* = 0x00 */) const
-{
- return LLInvFVBridge::createBridge(asset_type,
- actual_asset_type,
- inv_type,
- inventory,
- view_model,
- root,
- uuid,
- flags);
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderViewModelInventory* view_model,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags /* = 0x00 */) const
+{
+ return LLInvFVBridge::createBridge(asset_type,
+ actual_asset_type,
+ inv_type,
+ inventory,
+ view_model,
+ root,
+ uuid,
+ flags);
}
// +=================================================+
@@ -1728,224 +1728,224 @@ LLInvFVBridge* LLInventoryFolderViewModelBuilder::createBridge(LLAssetType::ETyp
void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
{
- if ("goto" == action)
- {
- gotoItem();
- }
-
- if ("open" == action || "open_original" == action)
- {
- openItem();
- return;
- }
- else if ("properties" == action)
- {
- showProperties();
- return;
- }
- else if ("purge" == action)
- {
- purgeItem(model, mUUID);
- return;
- }
- else if ("restoreToWorld" == action)
- {
- restoreToWorld();
- return;
- }
- else if ("restore" == action)
- {
- restoreItem();
- return;
- }
+ if ("goto" == action)
+ {
+ gotoItem();
+ }
+
+ if ("open" == action || "open_original" == action)
+ {
+ openItem();
+ return;
+ }
+ else if ("properties" == action)
+ {
+ showProperties();
+ return;
+ }
+ else if ("purge" == action)
+ {
+ purgeItem(model, mUUID);
+ return;
+ }
+ else if ("restoreToWorld" == action)
+ {
+ restoreToWorld();
+ return;
+ }
+ else if ("restore" == action)
+ {
+ restoreItem();
+ return;
+ }
else if ("thumbnail" == action)
{
LLSD data(mUUID);
LLFloaterReg::showInstance("change_item_thumbnail", data);
return;
}
- else if ("copy_uuid" == action)
- {
- // Single item only
- LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
- if(!item) return;
- LLUUID asset_id = item->getProtectedAssetUUID();
- std::string buffer;
- asset_id.toString(buffer);
-
- gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(buffer));
- return;
- }
- else if ("show_in_main_panel" == action)
- {
- LLInventoryPanel::openInventoryPanelAndSetSelection(true, mUUID, true);
- return;
- }
- else if ("cut" == action)
- {
- cutToClipboard();
- return;
- }
- else if ("copy" == action)
- {
- copyToClipboard();
- return;
- }
- else if ("paste" == action)
- {
- LLInventoryItem* itemp = model->getItem(mUUID);
- if (!itemp) return;
-
- LLFolderViewItem* folder_view_itemp = mInventoryPanel.get()->getItemByID(itemp->getParentUUID());
- if (!folder_view_itemp) return;
-
- folder_view_itemp->getViewModelItem()->pasteFromClipboard();
- return;
- }
- else if ("paste_link" == action)
- {
- // Single item only
- LLInventoryItem* itemp = model->getItem(mUUID);
- if (!itemp) return;
-
- LLFolderViewItem* folder_view_itemp = mInventoryPanel.get()->getItemByID(itemp->getParentUUID());
- if (!folder_view_itemp) return;
-
- folder_view_itemp->getViewModelItem()->pasteLinkFromClipboard();
- return;
- }
- else if (("move_to_marketplace_listings" == action) || ("copy_to_marketplace_listings" == action) || ("copy_or_move_to_marketplace_listings" == action))
- {
- LLInventoryItem* itemp = model->getItem(mUUID);
- if (!itemp) return;
+ else if ("copy_uuid" == action)
+ {
+ // Single item only
+ LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
+ if(!item) return;
+ LLUUID asset_id = item->getProtectedAssetUUID();
+ std::string buffer;
+ asset_id.toString(buffer);
+
+ gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(buffer));
+ return;
+ }
+ else if ("show_in_main_panel" == action)
+ {
+ LLInventoryPanel::openInventoryPanelAndSetSelection(true, mUUID, true);
+ return;
+ }
+ else if ("cut" == action)
+ {
+ cutToClipboard();
+ return;
+ }
+ else if ("copy" == action)
+ {
+ copyToClipboard();
+ return;
+ }
+ else if ("paste" == action)
+ {
+ LLInventoryItem* itemp = model->getItem(mUUID);
+ if (!itemp) return;
+
+ LLFolderViewItem* folder_view_itemp = mInventoryPanel.get()->getItemByID(itemp->getParentUUID());
+ if (!folder_view_itemp) return;
+
+ folder_view_itemp->getViewModelItem()->pasteFromClipboard();
+ return;
+ }
+ else if ("paste_link" == action)
+ {
+ // Single item only
+ LLInventoryItem* itemp = model->getItem(mUUID);
+ if (!itemp) return;
+
+ LLFolderViewItem* folder_view_itemp = mInventoryPanel.get()->getItemByID(itemp->getParentUUID());
+ if (!folder_view_itemp) return;
+
+ folder_view_itemp->getViewModelItem()->pasteLinkFromClipboard();
+ return;
+ }
+ else if (("move_to_marketplace_listings" == action) || ("copy_to_marketplace_listings" == action) || ("copy_or_move_to_marketplace_listings" == action))
+ {
+ LLInventoryItem* itemp = model->getItem(mUUID);
+ if (!itemp) return;
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
// Note: For a single item, if it's not a copy, then it's a move
move_item_to_marketplacelistings(itemp, marketplacelistings_id, ("copy_to_marketplace_listings" == action));
}
- else if ("copy_slurl" == action)
- {
- LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
- if(item)
- {
- LLUUID asset_id = item->getAssetUUID();
- LLLandmark* landmark = gLandmarkList.getAsset(asset_id);
- if (landmark)
- {
- LLVector3d global_pos;
- landmark->getGlobalPos(global_pos);
- LLLandmarkActions::getSLURLfromPosGlobal(global_pos, &copy_slurl_to_clipboard_callback_inv, true);
- }
- }
- }
- else if ("show_on_map" == action)
- {
- doActionOnCurSelectedLandmark(boost::bind(&LLItemBridge::doShowOnMap, this, _1));
- }
- else if ("marketplace_edit_listing" == action)
- {
+ else if ("copy_slurl" == action)
+ {
+ LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
+ if(item)
+ {
+ LLUUID asset_id = item->getAssetUUID();
+ LLLandmark* landmark = gLandmarkList.getAsset(asset_id);
+ if (landmark)
+ {
+ LLVector3d global_pos;
+ landmark->getGlobalPos(global_pos);
+ LLLandmarkActions::getSLURLfromPosGlobal(global_pos, &copy_slurl_to_clipboard_callback_inv, true);
+ }
+ }
+ }
+ else if ("show_on_map" == action)
+ {
+ doActionOnCurSelectedLandmark(boost::bind(&LLItemBridge::doShowOnMap, this, _1));
+ }
+ else if ("marketplace_edit_listing" == action)
+ {
std::string url = LLMarketplaceData::instance().getListingURL(mUUID);
LLUrlAction::openURL(url);
- }
+ }
}
void LLItemBridge::doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb)
{
- LLViewerInventoryItem* cur_item = getItem();
- if(cur_item && cur_item->getInventoryType() == LLInventoryType::IT_LANDMARK)
- {
- LLLandmark* landmark = LLLandmarkActions::getLandmark(cur_item->getUUID(), cb);
- if (landmark)
- {
- cb(landmark);
- }
- }
+ LLViewerInventoryItem* cur_item = getItem();
+ if(cur_item && cur_item->getInventoryType() == LLInventoryType::IT_LANDMARK)
+ {
+ LLLandmark* landmark = LLLandmarkActions::getLandmark(cur_item->getUUID(), cb);
+ if (landmark)
+ {
+ cb(landmark);
+ }
+ }
}
void LLItemBridge::doShowOnMap(LLLandmark* landmark)
{
- LLVector3d landmark_global_pos;
- // landmark has already been tested for NULL by calling routine
- if (landmark->getGlobalPos(landmark_global_pos))
- {
- LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
- if (!landmark_global_pos.isExactlyZero() && worldmap_instance)
- {
- worldmap_instance->trackLocation(landmark_global_pos);
- LLFloaterReg::showInstance("world_map", "center");
- }
- }
+ LLVector3d landmark_global_pos;
+ // landmark has already been tested for NULL by calling routine
+ if (landmark->getGlobalPos(landmark_global_pos))
+ {
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+ if (!landmark_global_pos.isExactlyZero() && worldmap_instance)
+ {
+ worldmap_instance->trackLocation(landmark_global_pos);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
+ }
}
void copy_slurl_to_clipboard_callback_inv(const std::string& slurl)
{
- gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(slurl));
- LLSD args;
- args["SLURL"] = slurl;
- LLNotificationsUtil::add("CopySLURL", args);
+ gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(slurl));
+ LLSD args;
+ args["SLURL"] = slurl;
+ LLNotificationsUtil::add("CopySLURL", args);
}
void LLItemBridge::selectItem()
{
- LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
- if(item && !item->isFinished())
- {
- //item->fetchFromServer();
- LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false);
- }
+ LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
+ if(item && !item->isFinished())
+ {
+ //item->fetchFromServer();
+ LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false);
+ }
}
void LLItemBridge::restoreItem()
{
- LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
- if(item)
- {
- LLInventoryModel* model = getInventoryModel();
- bool is_snapshot = (item->getInventoryType() == LLInventoryType::IT_SNAPSHOT);
+ LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
+ if(item)
+ {
+ LLInventoryModel* model = getInventoryModel();
+ bool is_snapshot = (item->getInventoryType() == LLInventoryType::IT_SNAPSHOT);
- const LLUUID new_parent = model->findCategoryUUIDForType(is_snapshot? LLFolderType::FT_SNAPSHOT_CATEGORY : LLFolderType::assetTypeToFolderType(item->getType()));
- // do not restamp on restore.
- LLInvFVBridge::changeItemParent(model, item, new_parent, FALSE);
- }
+ const LLUUID new_parent = model->findCategoryUUIDForType(is_snapshot? LLFolderType::FT_SNAPSHOT_CATEGORY : LLFolderType::assetTypeToFolderType(item->getType()));
+ // do not restamp on restore.
+ LLInvFVBridge::changeItemParent(model, item, new_parent, FALSE);
+ }
}
void LLItemBridge::restoreToWorld()
{
- //Similar functionality to the drag and drop rez logic
- bool remove_from_inventory = false;
-
- LLViewerInventoryItem* itemp = static_cast<LLViewerInventoryItem*>(getItem());
- if (itemp)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("RezRestoreToWorld");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-
- msg->nextBlockFast(_PREHASH_InventoryData);
- itemp->packMessage(msg);
- msg->sendReliable(gAgent.getRegionHost());
-
- //remove local inventory copy, sim will deal with permissions and removing the item
- //from the actual inventory if its a no-copy etc
- if(!itemp->getPermissions().allowCopyBy(gAgent.getID()))
- {
- remove_from_inventory = true;
- }
-
- // Check if it's in the trash. (again similar to the normal rez logic)
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id))
- {
- remove_from_inventory = true;
- }
- }
-
- if(remove_from_inventory)
- {
- gInventory.deleteObject(itemp->getUUID());
- gInventory.notifyObservers();
- }
+ //Similar functionality to the drag and drop rez logic
+ bool remove_from_inventory = false;
+
+ LLViewerInventoryItem* itemp = static_cast<LLViewerInventoryItem*>(getItem());
+ if (itemp)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("RezRestoreToWorld");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ itemp->packMessage(msg);
+ msg->sendReliable(gAgent.getRegionHost());
+
+ //remove local inventory copy, sim will deal with permissions and removing the item
+ //from the actual inventory if its a no-copy etc
+ if(!itemp->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ remove_from_inventory = true;
+ }
+
+ // Check if it's in the trash. (again similar to the normal rez logic)
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id))
+ {
+ remove_from_inventory = true;
+ }
+ }
+
+ if(remove_from_inventory)
+ {
+ gInventory.deleteObject(itemp->getUUID());
+ gInventory.notifyObservers();
+ }
}
void LLItemBridge::gotoItem()
@@ -1959,250 +1959,250 @@ void LLItemBridge::gotoItem()
LLUIImagePtr LLItemBridge::getIcon() const
{
- LLInventoryObject *obj = getInventoryObject();
- if (obj)
- {
- return LLInventoryIcon::getIcon(obj->getType(),
- LLInventoryType::IT_NONE,
- mIsLink);
- }
-
- return LLInventoryIcon::getIcon(LLInventoryType::ICONNAME_OBJECT);
+ LLInventoryObject *obj = getInventoryObject();
+ if (obj)
+ {
+ return LLInventoryIcon::getIcon(obj->getType(),
+ LLInventoryType::IT_NONE,
+ mIsLink);
+ }
+
+ return LLInventoryIcon::getIcon(LLInventoryType::ICONNAME_OBJECT);
}
LLUIImagePtr LLItemBridge::getIconOverlay() const
{
- if (getItem() && getItem()->getIsLinkType())
- {
- return LLUI::getUIImage("Inv_Link");
- }
- return NULL;
+ if (getItem() && getItem()->getIsLinkType())
+ {
+ return LLUI::getUIImage("Inv_Link");
+ }
+ return NULL;
}
PermissionMask LLItemBridge::getPermissionMask() const
{
- LLViewerInventoryItem* item = getItem();
- PermissionMask perm_mask = 0;
- if (item) perm_mask = item->getPermissionMask();
- return perm_mask;
+ LLViewerInventoryItem* item = getItem();
+ PermissionMask perm_mask = 0;
+ if (item) perm_mask = item->getPermissionMask();
+ return perm_mask;
}
void LLItemBridge::buildDisplayName() const
{
- if(getItem())
- {
- mDisplayName.assign(getItem()->getName());
- }
- else
- {
- mDisplayName.assign(LLStringUtil::null);
- }
-
- mSearchableName.assign(mDisplayName);
- mSearchableName.append(getLabelSuffix());
- LLStringUtil::toUpper(mSearchableName);
-
- //Name set, so trigger a sort
+ if(getItem())
+ {
+ mDisplayName.assign(getItem()->getName());
+ }
+ else
+ {
+ mDisplayName.assign(LLStringUtil::null);
+ }
+
+ mSearchableName.assign(mDisplayName);
+ mSearchableName.append(getLabelSuffix());
+ LLStringUtil::toUpper(mSearchableName);
+
+ //Name set, so trigger a sort
LLInventorySort sorter = static_cast<LLFolderViewModelInventory&>(mRootViewModel).getSorter();
- if(mParent && !sorter.isByDate())
- {
- mParent->requestSort();
- }
+ if(mParent && !sorter.isByDate())
+ {
+ mParent->requestSort();
+ }
}
LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const
{
- U8 font = LLFontGL::NORMAL;
- const LLViewerInventoryItem* item = getItem();
+ U8 font = LLFontGL::NORMAL;
+ const LLViewerInventoryItem* item = getItem();
- if (get_is_item_worn(mUUID))
- {
- // LL_INFOS() << "BOLD" << LL_ENDL;
- font |= LLFontGL::BOLD;
- }
- else if(item && item->getIsLinkType())
- {
- font |= LLFontGL::ITALIC;
- }
+ if (get_is_item_worn(mUUID))
+ {
+ // LL_INFOS() << "BOLD" << LL_ENDL;
+ font |= LLFontGL::BOLD;
+ }
+ else if(item && item->getIsLinkType())
+ {
+ font |= LLFontGL::ITALIC;
+ }
- return (LLFontGL::StyleFlags)font;
+ return (LLFontGL::StyleFlags)font;
}
std::string LLItemBridge::getLabelSuffix() const
{
- // String table is loaded before login screen and inventory items are
- // loaded after login, so LLTrans should be ready.
- static std::string NO_COPY = LLTrans::getString("no_copy_lbl");
- static std::string NO_MOD = LLTrans::getString("no_modify_lbl");
- static std::string NO_XFER = LLTrans::getString("no_transfer_lbl");
- static std::string LINK = LLTrans::getString("link");
- static std::string BROKEN_LINK = LLTrans::getString("broken_link");
- std::string suffix;
- LLInventoryItem* item = getItem();
- if(item)
- {
- // Any type can have the link suffix...
- BOOL broken_link = LLAssetType::lookupIsLinkType(item->getType());
- if (broken_link) return BROKEN_LINK;
-
- BOOL link = item->getIsLinkType();
- if (link) return LINK;
-
- // ...but it's a bit confusing to put nocopy/nomod/etc suffixes on calling cards.
- if(LLAssetType::AT_CALLINGCARD != item->getType()
- && item->getPermissions().getOwner() == gAgent.getID())
- {
- BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
- if (!copy)
- {
+ // String table is loaded before login screen and inventory items are
+ // loaded after login, so LLTrans should be ready.
+ static std::string NO_COPY = LLTrans::getString("no_copy_lbl");
+ static std::string NO_MOD = LLTrans::getString("no_modify_lbl");
+ static std::string NO_XFER = LLTrans::getString("no_transfer_lbl");
+ static std::string LINK = LLTrans::getString("link");
+ static std::string BROKEN_LINK = LLTrans::getString("broken_link");
+ std::string suffix;
+ LLInventoryItem* item = getItem();
+ if(item)
+ {
+ // Any type can have the link suffix...
+ BOOL broken_link = LLAssetType::lookupIsLinkType(item->getType());
+ if (broken_link) return BROKEN_LINK;
+
+ BOOL link = item->getIsLinkType();
+ if (link) return LINK;
+
+ // ...but it's a bit confusing to put nocopy/nomod/etc suffixes on calling cards.
+ if(LLAssetType::AT_CALLINGCARD != item->getType()
+ && item->getPermissions().getOwner() == gAgent.getID())
+ {
+ BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
+ if (!copy)
+ {
suffix += " ";
- suffix += NO_COPY;
- }
- BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
- if (!mod)
- {
+ suffix += NO_COPY;
+ }
+ BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
+ if (!mod)
+ {
suffix += suffix.empty() ? " " : ",";
suffix += NO_MOD;
- }
- BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID());
- if (!xfer)
- {
+ }
+ BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ gAgent.getID());
+ if (!xfer)
+ {
suffix += suffix.empty() ? " " : ",";
- suffix += NO_XFER;
- }
- }
- }
- return suffix;
+ suffix += NO_XFER;
+ }
+ }
+ }
+ return suffix;
}
time_t LLItemBridge::getCreationDate() const
{
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- return item->getCreationDate();
- }
- return 0;
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ return item->getCreationDate();
+ }
+ return 0;
}
BOOL LLItemBridge::isItemRenameable() const
{
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- // (For now) Don't allow calling card rename since that may confuse users as to
- // what the calling card points to.
- if (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
- {
- return FALSE;
- }
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ // (For now) Don't allow calling card rename since that may confuse users as to
+ // what the calling card points to.
+ if (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
+ {
+ return FALSE;
+ }
- if (!item->isFinished()) // EXT-8662
- {
- return FALSE;
- }
+ if (!item->isFinished()) // EXT-8662
+ {
+ return FALSE;
+ }
- if (isInboxFolder())
- {
- return FALSE;
- }
+ if (isInboxFolder())
+ {
+ return FALSE;
+ }
- return (item->getPermissions().allowModifyBy(gAgent.getID()));
- }
- return FALSE;
+ return (item->getPermissions().allowModifyBy(gAgent.getID()));
+ }
+ return FALSE;
}
BOOL LLItemBridge::renameItem(const std::string& new_name)
{
- if(!isItemRenameable())
- return FALSE;
- LLPreview::dirty(mUUID);
- LLInventoryModel* model = getInventoryModel();
- if(!model)
- return FALSE;
- LLViewerInventoryItem* item = getItem();
- if(item && (item->getName() != new_name))
- {
- LLSD updates;
- updates["name"] = new_name;
- update_inventory_item(item->getUUID(),updates, NULL);
- }
- // return FALSE because we either notified observers (& therefore
- // rebuilt) or we didn't update.
- return FALSE;
+ if(!isItemRenameable())
+ return FALSE;
+ LLPreview::dirty(mUUID);
+ LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ return FALSE;
+ LLViewerInventoryItem* item = getItem();
+ if(item && (item->getName() != new_name))
+ {
+ LLSD updates;
+ updates["name"] = new_name;
+ update_inventory_item(item->getUUID(),updates, NULL);
+ }
+ // return FALSE because we either notified observers (& therefore
+ // rebuilt) or we didn't update.
+ return FALSE;
}
BOOL LLItemBridge::removeItem()
{
- if(!isItemRemovable())
- {
- return FALSE;
- }
-
- // move it to the trash
- LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- LLViewerInventoryItem* item = getItem();
- if (!item) return FALSE;
- if (item->getType() != LLAssetType::AT_LSL_TEXT)
- {
- LLPreview::hide(mUUID, TRUE);
- }
- // Already in trash
- if (model->isObjectDescendentOf(mUUID, trash_id)) return FALSE;
-
- LLNotification::Params params("ConfirmItemDeleteHasLinks");
- params.functor.function(boost::bind(&LLItemBridge::confirmRemoveItem, this, _1, _2));
-
- // Check if this item has any links. If generic inventory linking is enabled,
- // we can't do this check because we may have items in a folder somewhere that is
- // not yet in memory, so we don't want false negatives. (If disabled, then we
- // know we only have links in the Outfits folder which we explicitly fetch.)
+ if(!isItemRemovable())
+ {
+ return FALSE;
+ }
+
+ // move it to the trash
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLViewerInventoryItem* item = getItem();
+ if (!item) return FALSE;
+ if (item->getType() != LLAssetType::AT_LSL_TEXT)
+ {
+ LLPreview::hide(mUUID, TRUE);
+ }
+ // Already in trash
+ if (model->isObjectDescendentOf(mUUID, trash_id)) return FALSE;
+
+ LLNotification::Params params("ConfirmItemDeleteHasLinks");
+ params.functor.function(boost::bind(&LLItemBridge::confirmRemoveItem, this, _1, _2));
+
+ // Check if this item has any links. If generic inventory linking is enabled,
+ // we can't do this check because we may have items in a folder somewhere that is
+ // not yet in memory, so we don't want false negatives. (If disabled, then we
+ // know we only have links in the Outfits folder which we explicitly fetch.)
static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryLinking", true);
- if (!inventory_linking)
- {
- if (!item->getIsLinkType())
- {
- LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID);
- const U32 num_links = item_array.size();
- if (num_links > 0)
- {
- // Warn if the user is will break any links when deleting this item.
- LLNotifications::instance().add(params);
- return FALSE;
- }
- }
- }
-
- LLNotifications::instance().forceResponse(params, 0);
- model->checkTrashOverflow();
- return TRUE;
+ if (!inventory_linking)
+ {
+ if (!item->getIsLinkType())
+ {
+ LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID);
+ const U32 num_links = item_array.size();
+ if (num_links > 0)
+ {
+ // Warn if the user is will break any links when deleting this item.
+ LLNotifications::instance().add(params);
+ return FALSE;
+ }
+ }
+ }
+
+ LLNotifications::instance().forceResponse(params, 0);
+ model->checkTrashOverflow();
+ return TRUE;
}
BOOL LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return FALSE;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return FALSE;
- LLInventoryModel* model = getInventoryModel();
- if (!model) return FALSE;
+ LLInventoryModel* model = getInventoryModel();
+ if (!model) return FALSE;
- LLViewerInventoryItem* item = getItem();
- if (!item) return FALSE;
+ LLViewerInventoryItem* item = getItem();
+ if (!item) return FALSE;
- const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- // if item is not already in trash
- if(item && !model->isObjectDescendentOf(mUUID, trash_id))
- {
- // move to trash, and restamp
- LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE);
- // delete was successful
- return TRUE;
- }
- return FALSE;
+ const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ // if item is not already in trash
+ if(item && !model->isObjectDescendentOf(mUUID, trash_id))
+ {
+ // move to trash, and restamp
+ LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE);
+ // delete was successful
+ return TRUE;
+ }
+ return FALSE;
}
bool LLItemBridge::isItemCopyable(bool can_copy_as_link) const
@@ -2228,13 +2228,13 @@ bool LLItemBridge::isItemCopyable(bool can_copy_as_link) const
LLViewerInventoryItem* LLItemBridge::getItem() const
{
- LLViewerInventoryItem* item = NULL;
- LLInventoryModel* model = getInventoryModel();
- if(model)
- {
- item = (LLViewerInventoryItem*)model->getItem(mUUID);
- }
- return item;
+ LLViewerInventoryItem* item = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ item = (LLViewerInventoryItem*)model->getItem(mUUID);
+ }
+ return item;
}
const LLUUID& LLItemBridge::getThumbnailUUID() const
@@ -2254,12 +2254,12 @@ const LLUUID& LLItemBridge::getThumbnailUUID() const
BOOL LLItemBridge::isItemPermissive() const
{
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- return item->getIsFullPerm();
- }
- return FALSE;
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ return item->getIsFullPerm();
+ }
+ return FALSE;
}
// +=================================================+
@@ -2271,15 +2271,15 @@ LLHandle<LLFolderBridge> LLFolderBridge::sSelf;
// Can be moved to another folder
BOOL LLFolderBridge::isItemMovable() const
{
- LLInventoryObject* obj = getInventoryObject();
- if(obj)
- {
- // If it's a protected type folder, we can't move it
- if (LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()))
- return FALSE;
- return TRUE;
- }
- return FALSE;
+ LLInventoryObject* obj = getInventoryObject();
+ if(obj)
+ {
+ // If it's a protected type folder, we can't move it
+ if (LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()))
+ return FALSE;
+ return TRUE;
+ }
+ return FALSE;
}
void LLFolderBridge::selectItem()
@@ -2293,39 +2293,39 @@ void LLFolderBridge::selectItem()
void LLFolderBridge::buildDisplayName() const
{
- LLFolderType::EType preferred_type = getPreferredType();
-
- // *TODO: to be removed when database supports multi language. This is a
- // temporary attempt to display the inventory folder in the user locale.
- // mantipov: *NOTE: be sure this code is synchronized with LLFriendCardsManager::findChildFolderUUID
- // it uses the same way to find localized string
-
- // HACK: EXT - 6028 ([HARD CODED]? Inventory > Library > "Accessories" folder)
- // Translation of Accessories folder in Library inventory folder
- bool accessories = false;
- if(getName() == "Accessories")
- {
- //To ensure that Accessories folder is in Library we have to check its parent folder.
- //Due to parent LLFolderViewFloder is not set to this item yet we have to check its parent via Inventory Model
- LLInventoryCategory* cat = gInventory.getCategory(getUUID());
- if(cat)
- {
- const LLUUID& parent_folder_id = cat->getParentUUID();
- accessories = (parent_folder_id == gInventory.getLibraryRootFolderID());
- }
- }
-
- //"Accessories" inventory category has folder type FT_NONE. So, this folder
- //can not be detected as protected with LLFolderType::lookupIsProtectedType
- mDisplayName.assign(getName());
- if (accessories || LLFolderType::lookupIsProtectedType(preferred_type))
- {
- LLTrans::findString(mDisplayName, std::string("InvFolder ") + getName(), LLSD());
- }
-
- mSearchableName.assign(mDisplayName);
- mSearchableName.append(getLabelSuffix());
- LLStringUtil::toUpper(mSearchableName);
+ LLFolderType::EType preferred_type = getPreferredType();
+
+ // *TODO: to be removed when database supports multi language. This is a
+ // temporary attempt to display the inventory folder in the user locale.
+ // mantipov: *NOTE: be sure this code is synchronized with LLFriendCardsManager::findChildFolderUUID
+ // it uses the same way to find localized string
+
+ // HACK: EXT - 6028 ([HARD CODED]? Inventory > Library > "Accessories" folder)
+ // Translation of Accessories folder in Library inventory folder
+ bool accessories = false;
+ if(getName() == "Accessories")
+ {
+ //To ensure that Accessories folder is in Library we have to check its parent folder.
+ //Due to parent LLFolderViewFloder is not set to this item yet we have to check its parent via Inventory Model
+ LLInventoryCategory* cat = gInventory.getCategory(getUUID());
+ if(cat)
+ {
+ const LLUUID& parent_folder_id = cat->getParentUUID();
+ accessories = (parent_folder_id == gInventory.getLibraryRootFolderID());
+ }
+ }
+
+ //"Accessories" inventory category has folder type FT_NONE. So, this folder
+ //can not be detected as protected with LLFolderType::lookupIsProtectedType
+ mDisplayName.assign(getName());
+ if (accessories || LLFolderType::lookupIsProtectedType(preferred_type))
+ {
+ LLTrans::findString(mDisplayName, std::string("InvFolder ") + getName(), LLSD());
+ }
+
+ mSearchableName.assign(mDisplayName);
+ mSearchableName.append(getLabelSuffix());
+ LLStringUtil::toUpper(mSearchableName);
//Name set, so trigger a sort
LLInventorySort sorter = static_cast<LLFolderViewModelInventory&>(mRootViewModel).getSorter();
@@ -2339,7 +2339,7 @@ std::string LLFolderBridge::getLabelSuffix() const
{
static LLCachedControl<F32> folder_loading_message_delay(gSavedSettings, "FolderLoadingMessageWaitTime", 0.5f);
static LLCachedControl<bool> xui_debug(gSavedSettings, "DebugShowXUINames", 0);
-
+
if (mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= folder_loading_message_delay())
{
return llformat(" ( %s ) ", LLTrans::getString("LoadingData").c_str());
@@ -2350,7 +2350,7 @@ std::string LLFolderBridge::getLabelSuffix() const
LLInventoryModel::cat_array_t* cats;
LLInventoryModel::item_array_t* items;
gInventory.getDirectDescendentsOf(getUUID(), cats, items);
-
+
LLViewerInventoryCategory* cat = gInventory.getCategory(getUUID());
if (cat)
{
@@ -2399,20 +2399,20 @@ const LLUUID& LLFolderBridge::getThumbnailUUID() const
void LLFolderBridge::update()
{
- // we know we have children but haven't fetched them (doesn't obey filter)
- bool loading = !isUpToDate() && hasChildren() && mFolderViewItem->isOpen();
+ // we know we have children but haven't fetched them (doesn't obey filter)
+ bool loading = !isUpToDate() && hasChildren() && mFolderViewItem->isOpen();
- if (loading != mIsLoading)
- {
- if ( loading )
- {
- // Measure how long we've been in the loading state
- mTimeSinceRequestStart.reset();
- }
- mIsLoading = loading;
+ if (loading != mIsLoading)
+ {
+ if ( loading )
+ {
+ // Measure how long we've been in the loading state
+ mTimeSinceRequestStart.reset();
+ }
+ mIsLoading = loading;
- mFolderViewItem->refresh();
- }
+ mFolderViewItem->refresh();
+ }
}
@@ -2421,57 +2421,57 @@ void LLFolderBridge::update()
class LLIsItemRemovable : public LLFolderViewFunctor
{
public:
- LLIsItemRemovable() : mPassed(TRUE) {}
- virtual void doFolder(LLFolderViewFolder* folder)
- {
- mPassed &= folder->getViewModelItem()->isItemRemovable();
- }
- virtual void doItem(LLFolderViewItem* item)
- {
- mPassed &= item->getViewModelItem()->isItemRemovable();
- }
- BOOL mPassed;
+ LLIsItemRemovable() : mPassed(TRUE) {}
+ virtual void doFolder(LLFolderViewFolder* folder)
+ {
+ mPassed &= folder->getViewModelItem()->isItemRemovable();
+ }
+ virtual void doItem(LLFolderViewItem* item)
+ {
+ mPassed &= item->getViewModelItem()->isItemRemovable();
+ }
+ BOOL mPassed;
};
// Can be destroyed (or moved to trash)
BOOL LLFolderBridge::isItemRemovable() const
{
- if (!get_is_category_removable(getInventoryModel(), mUUID))
- {
- return FALSE;
- }
+ if (!get_is_category_removable(getInventoryModel(), mUUID))
+ {
+ return FALSE;
+ }
- LLInventoryPanel* panel = mInventoryPanel.get();
- LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(panel ? panel->getItemByID(mUUID) : NULL);
- if (folderp)
- {
- LLIsItemRemovable folder_test;
- folderp->applyFunctorToChildren(folder_test);
- if (!folder_test.mPassed)
- {
- return FALSE;
- }
- }
+ LLInventoryPanel* panel = mInventoryPanel.get();
+ LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(panel ? panel->getItemByID(mUUID) : NULL);
+ if (folderp)
+ {
+ LLIsItemRemovable folder_test;
+ folderp->applyFunctorToChildren(folder_test);
+ if (!folder_test.mPassed)
+ {
+ return FALSE;
+ }
+ }
- if (isMarketplaceListingsFolder() && (!LLMarketplaceData::instance().isSLMDataFetched() || LLMarketplaceData::instance().getActivationState(mUUID)))
- {
- return FALSE;
- }
+ if (isMarketplaceListingsFolder() && (!LLMarketplaceData::instance().isSLMDataFetched() || LLMarketplaceData::instance().getActivationState(mUUID)))
+ {
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
BOOL LLFolderBridge::isUpToDate() const
{
- LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
- if( !category )
- {
- return FALSE;
- }
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
+ if( !category )
+ {
+ return FALSE;
+ }
- return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN;
+ return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN;
}
bool LLFolderBridge::isItemCopyable(bool can_copy_as_link) const
@@ -2482,31 +2482,31 @@ bool LLFolderBridge::isItemCopyable(bool can_copy_as_link) const
return true;
}
- // Folders are copyable if items in them are, recursively, copyable.
-
- // Get the content of the folder
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(mUUID,cat_array,item_array);
+ // Folders are copyable if items in them are, recursively, copyable.
- // Check the items
- LLInventoryModel::item_array_t item_array_copy = *item_array;
- for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
- {
- LLInventoryItem* item = *iter;
- LLItemBridge item_br(mInventoryPanel.get(), mRoot, item->getUUID());
+ // Get the content of the folder
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(mUUID,cat_array,item_array);
+
+ // Check the items
+ LLInventoryModel::item_array_t item_array_copy = *item_array;
+ for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
+ {
+ LLInventoryItem* item = *iter;
+ LLItemBridge item_br(mInventoryPanel.get(), mRoot, item->getUUID());
if (!item_br.isItemCopyable(false))
{
return false;
}
}
- // Check the folders
- LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
- for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
+ // Check the folders
+ LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
+ for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
{
- LLViewerInventoryCategory* category = *iter;
- LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, category->getUUID());
+ LLViewerInventoryCategory* category = *iter;
+ LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, category->getUUID());
if (!cat_br.isItemCopyable(false))
{
return false;
@@ -2518,149 +2518,149 @@ bool LLFolderBridge::isItemCopyable(bool can_copy_as_link) const
BOOL LLFolderBridge::isClipboardPasteable() const
{
- if ( ! LLInvFVBridge::isClipboardPasteable() )
- return FALSE;
-
- // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599
- if ( LLFriendCardsManager::instance().isCategoryInFriendFolder( getCategory() ) )
- {
- LLInventoryModel* model = getInventoryModel();
- if ( !model )
- {
- return FALSE;
- }
-
- std::vector<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
- const LLViewerInventoryCategory *current_cat = getCategory();
-
- // Search for the direct descendent of current Friends subfolder among all pasted items,
- // and return false if is found.
- for(S32 i = objects.size() - 1; i >= 0; --i)
- {
- const LLUUID &obj_id = objects.at(i);
- if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) )
- {
- return FALSE;
- }
- }
-
- }
- return TRUE;
+ if ( ! LLInvFVBridge::isClipboardPasteable() )
+ return FALSE;
+
+ // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599
+ if ( LLFriendCardsManager::instance().isCategoryInFriendFolder( getCategory() ) )
+ {
+ LLInventoryModel* model = getInventoryModel();
+ if ( !model )
+ {
+ return FALSE;
+ }
+
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+ const LLViewerInventoryCategory *current_cat = getCategory();
+
+ // Search for the direct descendent of current Friends subfolder among all pasted items,
+ // and return false if is found.
+ for(S32 i = objects.size() - 1; i >= 0; --i)
+ {
+ const LLUUID &obj_id = objects.at(i);
+ if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) )
+ {
+ return FALSE;
+ }
+ }
+
+ }
+ return TRUE;
}
BOOL LLFolderBridge::isClipboardPasteableAsLink() const
{
- // Check normal paste-as-link permissions
- if (!LLInvFVBridge::isClipboardPasteableAsLink())
- {
- return FALSE;
- }
-
- const LLInventoryModel* model = getInventoryModel();
- if (!model)
- {
- return FALSE;
- }
-
- const LLViewerInventoryCategory *current_cat = getCategory();
- if (current_cat)
- {
- const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat );
- const LLUUID &current_cat_id = current_cat->getUUID();
- std::vector<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
- S32 count = objects.size();
- for(S32 i = 0; i < count; i++)
- {
- const LLUUID &obj_id = objects.at(i);
- const LLInventoryCategory *cat = model->getCategory(obj_id);
- if (cat)
- {
- const LLUUID &cat_id = cat->getUUID();
- // Don't allow recursive pasting
- if ((cat_id == current_cat_id) ||
- model->isObjectDescendentOf(current_cat_id, cat_id))
- {
- return FALSE;
- }
- }
- // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599
- if ( is_in_friend_folder )
- {
- // If object is direct descendent of current Friends subfolder than return false.
- // Note: We can't use 'const LLInventoryCategory *cat', because it may be null
- // in case type of obj_id is LLInventoryItem.
- if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) )
- {
- return FALSE;
- }
- }
- }
- }
- return TRUE;
+ // Check normal paste-as-link permissions
+ if (!LLInvFVBridge::isClipboardPasteableAsLink())
+ {
+ return FALSE;
+ }
+
+ const LLInventoryModel* model = getInventoryModel();
+ if (!model)
+ {
+ return FALSE;
+ }
+
+ const LLViewerInventoryCategory *current_cat = getCategory();
+ if (current_cat)
+ {
+ const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat );
+ const LLUUID &current_cat_id = current_cat->getUUID();
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+ S32 count = objects.size();
+ for(S32 i = 0; i < count; i++)
+ {
+ const LLUUID &obj_id = objects.at(i);
+ const LLInventoryCategory *cat = model->getCategory(obj_id);
+ if (cat)
+ {
+ const LLUUID &cat_id = cat->getUUID();
+ // Don't allow recursive pasting
+ if ((cat_id == current_cat_id) ||
+ model->isObjectDescendentOf(current_cat_id, cat_id))
+ {
+ return FALSE;
+ }
+ }
+ // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599
+ if ( is_in_friend_folder )
+ {
+ // If object is direct descendent of current Friends subfolder than return false.
+ // Note: We can't use 'const LLInventoryCategory *cat', because it may be null
+ // in case type of obj_id is LLInventoryItem.
+ if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) )
+ {
+ return FALSE;
+ }
+ }
+ }
+ }
+ return TRUE;
}
BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
- BOOL drop,
- std::string& tooltip_msg,
- BOOL is_link,
- BOOL user_confirm,
+ BOOL drop,
+ std::string& tooltip_msg,
+ BOOL is_link,
+ BOOL user_confirm,
LLPointer<LLInventoryCallback> cb)
{
- LLInventoryModel* model = getInventoryModel();
+ LLInventoryModel* model = getInventoryModel();
- if (!inv_cat) return FALSE; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL
- if (!model) return FALSE;
- if (!isAgentAvatarValid()) return FALSE;
- if (!isAgentInventory()) return FALSE; // cannot drag categories into library
+ if (!inv_cat) return FALSE; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL
+ if (!model) return FALSE;
+ if (!isAgentAvatarValid()) return FALSE;
+ if (!isAgentInventory()) return FALSE; // cannot drag categories into library
- LLInventoryPanel* destination_panel = mInventoryPanel.get();
- if (!destination_panel) return false;
+ LLInventoryPanel* destination_panel = mInventoryPanel.get();
+ if (!destination_panel) return false;
- LLInventoryFilter* filter = getInventoryFilter();
- if (!filter) return false;
+ LLInventoryFilter* filter = getInventoryFilter();
+ if (!filter) return false;
- const LLUUID &cat_id = inv_cat->getUUID();
- const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
- const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
+ const LLUUID &cat_id = inv_cat->getUUID();
+ const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
const LLUUID from_folder_uuid = inv_cat->getParentUUID();
-
- const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
- const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id);
+
+ const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+ const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id);
const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id);
- // check to make sure source is agent inventory, and is represented there.
- LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
- const BOOL is_agent_inventory = (model->getCategory(cat_id) != NULL)
- && (LLToolDragAndDrop::SOURCE_AGENT == source);
+ // check to make sure source is agent inventory, and is represented there.
+ LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
+ const BOOL is_agent_inventory = (model->getCategory(cat_id) != NULL)
+ && (LLToolDragAndDrop::SOURCE_AGENT == source);
- BOOL accept = FALSE;
- U64 filter_types = filter->getFilterTypes();
- BOOL use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0);
+ BOOL accept = FALSE;
+ U64 filter_types = filter->getFilterTypes();
+ BOOL use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0);
- if (is_agent_inventory)
- {
- const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
- const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
- const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ if (is_agent_inventory)
+ {
+ const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+ const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
- const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id);
- const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
- const BOOL move_is_into_current_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT);
- const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
- const BOOL move_is_into_lost_and_found = model->isObjectDescendentOf(mUUID, lost_and_found_id);
+ const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
+ const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id);
+ const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+ const BOOL move_is_into_current_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT);
+ const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
+ const BOOL move_is_into_lost_and_found = model->isObjectDescendentOf(mUUID, lost_and_found_id);
- //--------------------------------------------------------------------------------
- // Determine if folder can be moved.
- //
+ //--------------------------------------------------------------------------------
+ // Determine if folder can be moved.
+ //
- BOOL is_movable = TRUE;
+ BOOL is_movable = TRUE;
if (is_movable && (marketplacelistings_id == cat_id))
{
@@ -2674,185 +2674,185 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
is_movable = FALSE;
tooltip_msg = LLTrans::getString("TooltipOutboxDragActive");
}
- if (is_movable && (mUUID == cat_id))
- {
- is_movable = FALSE;
- tooltip_msg = LLTrans::getString("TooltipDragOntoSelf");
- }
- if (is_movable && (model->isObjectDescendentOf(mUUID, cat_id)))
- {
- is_movable = FALSE;
- tooltip_msg = LLTrans::getString("TooltipDragOntoOwnChild");
- }
- if (is_movable && LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()))
- {
- is_movable = FALSE;
- // tooltip?
- }
-
- U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit");
- if (is_movable && move_is_into_outfit)
- {
- if (mUUID == my_outifts_id)
- {
- if (source != LLToolDragAndDrop::SOURCE_AGENT || move_is_from_marketplacelistings)
- {
- tooltip_msg = LLTrans::getString("TooltipOutfitNotInInventory");
- is_movable = false;
- }
- else if (can_move_to_my_outfits(model, inv_cat, max_items_to_wear))
- {
- is_movable = true;
- }
- else
- {
- tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit");
- is_movable = false;
- }
- }
- else if(getCategory() && getCategory()->getPreferredType() == LLFolderType::FT_NONE)
- {
- is_movable = ((inv_cat->getPreferredType() == LLFolderType::FT_NONE) || (inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT));
- }
- else
- {
- is_movable = false;
- }
- }
- if(is_movable && move_is_into_current_outfit && is_link)
- {
- is_movable = FALSE;
- }
- if (is_movable && move_is_into_lost_and_found)
- {
- is_movable = FALSE;
- }
- if (is_movable && (mUUID == model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE)))
- {
- is_movable = FALSE;
- // tooltip?
- }
- if (is_movable && (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK))
- {
+ if (is_movable && (mUUID == cat_id))
+ {
+ is_movable = FALSE;
+ tooltip_msg = LLTrans::getString("TooltipDragOntoSelf");
+ }
+ if (is_movable && (model->isObjectDescendentOf(mUUID, cat_id)))
+ {
+ is_movable = FALSE;
+ tooltip_msg = LLTrans::getString("TooltipDragOntoOwnChild");
+ }
+ if (is_movable && LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()))
+ {
+ is_movable = FALSE;
+ // tooltip?
+ }
+
+ U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit");
+ if (is_movable && move_is_into_outfit)
+ {
+ if (mUUID == my_outifts_id)
+ {
+ if (source != LLToolDragAndDrop::SOURCE_AGENT || move_is_from_marketplacelistings)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutfitNotInInventory");
+ is_movable = false;
+ }
+ else if (can_move_to_my_outfits(model, inv_cat, max_items_to_wear))
+ {
+ is_movable = true;
+ }
+ else
+ {
+ tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit");
+ is_movable = false;
+ }
+ }
+ else if(getCategory() && getCategory()->getPreferredType() == LLFolderType::FT_NONE)
+ {
+ is_movable = ((inv_cat->getPreferredType() == LLFolderType::FT_NONE) || (inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT));
+ }
+ else
+ {
+ is_movable = false;
+ }
+ }
+ if(is_movable && move_is_into_current_outfit && is_link)
+ {
+ is_movable = FALSE;
+ }
+ if (is_movable && move_is_into_lost_and_found)
+ {
+ is_movable = FALSE;
+ }
+ if (is_movable && (mUUID == model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE)))
+ {
+ is_movable = FALSE;
+ // tooltip?
+ }
+ if (is_movable && (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK))
+ {
// One cannot move a folder into a stock folder
- is_movable = FALSE;
- // tooltip?
- }
-
- LLInventoryModel::cat_array_t descendent_categories;
- LLInventoryModel::item_array_t descendent_items;
- if (is_movable)
- {
- model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
- for (S32 i=0; i < descendent_categories.size(); ++i)
- {
- LLInventoryCategory* category = descendent_categories[i];
- if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
- {
- // Can't move "special folders" (e.g. Textures Folder).
- is_movable = FALSE;
- break;
- }
- }
- }
- if (is_movable
- && move_is_into_current_outfit
- && descendent_items.size() > max_items_to_wear)
- {
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
- gInventory.collectDescendentsIf(cat_id,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- not_worn);
-
- if (items.size() > max_items_to_wear)
- {
- // Can't move 'large' folders into current outfit: MAINT-4086
- is_movable = FALSE;
- LLStringUtil::format_map_t args;
- args["AMOUNT"] = llformat("%d", max_items_to_wear);
- tooltip_msg = LLTrans::getString("TooltipTooManyWearables",args);
- }
- }
- if (is_movable && move_is_into_trash)
- {
- for (S32 i=0; i < descendent_items.size(); ++i)
- {
- LLInventoryItem* item = descendent_items[i];
- if (get_is_item_worn(item->getUUID()))
- {
- is_movable = FALSE;
- break; // It's generally movable, but not into the trash.
- }
- }
- }
- if (is_movable && move_is_into_landmarks)
- {
- for (S32 i=0; i < descendent_items.size(); ++i)
- {
- LLViewerInventoryItem* item = descendent_items[i];
-
- // Don't move anything except landmarks and categories into Landmarks folder.
- // We use getType() instead of getActua;Type() to allow links to landmarks and folders.
- if (LLAssetType::AT_LANDMARK != item->getType() && LLAssetType::AT_CATEGORY != item->getType())
- {
- is_movable = FALSE;
- break; // It's generally movable, but not into Landmarks.
- }
- }
- }
-
- if (is_movable && move_is_into_marketplacelistings)
- {
+ is_movable = FALSE;
+ // tooltip?
+ }
+
+ LLInventoryModel::cat_array_t descendent_categories;
+ LLInventoryModel::item_array_t descendent_items;
+ if (is_movable)
+ {
+ model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
+ for (S32 i=0; i < descendent_categories.size(); ++i)
+ {
+ LLInventoryCategory* category = descendent_categories[i];
+ if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
+ {
+ // Can't move "special folders" (e.g. Textures Folder).
+ is_movable = FALSE;
+ break;
+ }
+ }
+ }
+ if (is_movable
+ && move_is_into_current_outfit
+ && descendent_items.size() > max_items_to_wear)
+ {
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
+ gInventory.collectDescendentsIf(cat_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ not_worn);
+
+ if (items.size() > max_items_to_wear)
+ {
+ // Can't move 'large' folders into current outfit: MAINT-4086
+ is_movable = FALSE;
+ LLStringUtil::format_map_t args;
+ args["AMOUNT"] = llformat("%d", max_items_to_wear);
+ tooltip_msg = LLTrans::getString("TooltipTooManyWearables",args);
+ }
+ }
+ if (is_movable && move_is_into_trash)
+ {
+ for (S32 i=0; i < descendent_items.size(); ++i)
+ {
+ LLInventoryItem* item = descendent_items[i];
+ if (get_is_item_worn(item->getUUID()))
+ {
+ is_movable = FALSE;
+ break; // It's generally movable, but not into the trash.
+ }
+ }
+ }
+ if (is_movable && move_is_into_landmarks)
+ {
+ for (S32 i=0; i < descendent_items.size(); ++i)
+ {
+ LLViewerInventoryItem* item = descendent_items[i];
+
+ // Don't move anything except landmarks and categories into Landmarks folder.
+ // We use getType() instead of getActua;Type() to allow links to landmarks and folders.
+ if (LLAssetType::AT_LANDMARK != item->getType() && LLAssetType::AT_CATEGORY != item->getType())
+ {
+ is_movable = FALSE;
+ break; // It's generally movable, but not into Landmarks.
+ }
+ }
+ }
+
+ if (is_movable && move_is_into_marketplacelistings)
+ {
const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, mUUID);
LLViewerInventoryCategory * dest_folder = getCategory();
S32 bundle_size = (drop ? 1 : LLToolDragAndDrop::instance().getCargoCount());
is_movable = can_move_folder_to_marketplace(master_folder, dest_folder, inv_cat, tooltip_msg, bundle_size);
- }
-
- if (is_movable && !move_is_into_landmarks)
- {
- LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
- is_movable = active_panel != NULL;
-
- // For a folder to pass the filter all its descendants are required to pass.
- // We make this exception to allow reordering folders within an inventory panel,
- // which has a filter applied, like Recent tab for example.
- // There may be folders which are displayed because some of their descendants pass
- // the filter, but other don't, and thus remain hidden. Without this check,
- // such folders would not be allowed to be moved within a panel.
- if (destination_panel == active_panel)
- {
- is_movable = true;
- }
- else
- {
- LLFolderView* active_folder_view = NULL;
-
- if (is_movable)
- {
- active_folder_view = active_panel->getRootFolder();
- is_movable = active_folder_view != NULL;
- }
-
- if (is_movable && use_filter)
- {
- // Check whether the folder being dragged from active inventory panel
- // passes the filter of the destination panel.
- is_movable = check_category(model, cat_id, active_panel, filter);
- }
- }
- }
- //
- //--------------------------------------------------------------------------------
-
- accept = is_movable;
-
- if (accept && drop)
- {
+ }
+
+ if (is_movable && !move_is_into_landmarks)
+ {
+ LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+ is_movable = active_panel != NULL;
+
+ // For a folder to pass the filter all its descendants are required to pass.
+ // We make this exception to allow reordering folders within an inventory panel,
+ // which has a filter applied, like Recent tab for example.
+ // There may be folders which are displayed because some of their descendants pass
+ // the filter, but other don't, and thus remain hidden. Without this check,
+ // such folders would not be allowed to be moved within a panel.
+ if (destination_panel == active_panel)
+ {
+ is_movable = true;
+ }
+ else
+ {
+ LLFolderView* active_folder_view = NULL;
+
+ if (is_movable)
+ {
+ active_folder_view = active_panel->getRootFolder();
+ is_movable = active_folder_view != NULL;
+ }
+
+ if (is_movable && use_filter)
+ {
+ // Check whether the folder being dragged from active inventory panel
+ // passes the filter of the destination panel.
+ is_movable = check_category(model, cat_id, active_panel, filter);
+ }
+ }
+ }
+ //
+ //--------------------------------------------------------------------------------
+
+ accept = is_movable;
+
+ if (accept && drop)
+ {
// Dropping in or out of marketplace needs (sometimes) confirmation
if (user_confirm && (move_is_from_marketplacelistings || move_is_into_marketplacelistings))
{
@@ -2895,57 +2895,57 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
return true;
}
}
- // Look for any gestures and deactivate them
- if (move_is_into_trash)
- {
- for (S32 i=0; i < descendent_items.size(); i++)
- {
- LLInventoryItem* item = descendent_items[i];
- if (item->getType() == LLAssetType::AT_GESTURE
- && LLGestureMgr::instance().isGestureActive(item->getUUID()))
- {
- LLGestureMgr::instance().deactivateGesture(item->getUUID());
- }
- }
- }
-
- if (mUUID == my_outifts_id)
- {
- // Category can contains objects,
- // create a new folder and populate it with links to original objects
- dropToMyOutfits(inv_cat, cb);
- }
- // if target is current outfit folder we use link
- else if (move_is_into_current_outfit &&
- (inv_cat->getPreferredType() == LLFolderType::FT_NONE ||
- inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT))
- {
- // traverse category and add all contents to currently worn.
- BOOL append = true;
- LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append);
+ // Look for any gestures and deactivate them
+ if (move_is_into_trash)
+ {
+ for (S32 i=0; i < descendent_items.size(); i++)
+ {
+ LLInventoryItem* item = descendent_items[i];
+ if (item->getType() == LLAssetType::AT_GESTURE
+ && LLGestureMgr::instance().isGestureActive(item->getUUID()))
+ {
+ LLGestureMgr::instance().deactivateGesture(item->getUUID());
+ }
+ }
+ }
+
+ if (mUUID == my_outifts_id)
+ {
+ // Category can contains objects,
+ // create a new folder and populate it with links to original objects
+ dropToMyOutfits(inv_cat, cb);
+ }
+ // if target is current outfit folder we use link
+ else if (move_is_into_current_outfit &&
+ (inv_cat->getPreferredType() == LLFolderType::FT_NONE ||
+ inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT))
+ {
+ // traverse category and add all contents to currently worn.
+ BOOL append = true;
+ LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append);
if (cb) cb->fire(inv_cat->getUUID());
- }
- else if (move_is_into_marketplacelistings)
- {
- move_folder_to_marketplacelistings(inv_cat, mUUID);
+ }
+ else if (move_is_into_marketplacelistings)
+ {
+ move_folder_to_marketplacelistings(inv_cat, mUUID);
if (cb) cb->fire(inv_cat->getUUID());
- }
- else
- {
- if (model->isObjectDescendentOf(cat_id, model->findCategoryUUIDForType(LLFolderType::FT_INBOX)))
- {
- set_dad_inbox_object(cat_id);
- }
-
- // Reparent the folder and restamp children if it's moving
- // into trash.
- LLInvFVBridge::changeCategoryParent(
- model,
- (LLViewerInventoryCategory*)inv_cat,
- mUUID,
- move_is_into_trash);
+ }
+ else
+ {
+ if (model->isObjectDescendentOf(cat_id, model->findCategoryUUIDForType(LLFolderType::FT_INBOX)))
+ {
+ set_dad_inbox_object(cat_id);
+ }
+
+ // Reparent the folder and restamp children if it's moving
+ // into trash.
+ LLInvFVBridge::changeCategoryParent(
+ model,
+ (LLViewerInventoryCategory*)inv_cat,
+ mUUID,
+ move_is_into_trash);
if (cb) cb->fire(inv_cat->getUUID());
- }
+ }
if (move_is_from_marketplacelistings)
{
// If we are moving a folder at the listing folder level (i.e. its parent is the marketplace listings folder)
@@ -2979,17 +2979,17 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
if (cb) cb->fire(inv_cat->getUUID());
}
}
- }
- }
- else if (LLToolDragAndDrop::SOURCE_WORLD == source)
- {
- if (move_is_into_marketplacelistings)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
- accept = FALSE;
- }
- else
- {
+ }
+ }
+ else if (LLToolDragAndDrop::SOURCE_WORLD == source)
+ {
+ if (move_is_into_marketplacelistings)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+ accept = FALSE;
+ }
+ else
+ {
// Todo: fix me. moving from task inventory doesn't have a completion callback,
// yet making a copy creates new item id so this doesn't work right
std::function<void(S32, void*, const LLMoveInv*)> callback = [cb](S32, void*, const LLMoveInv* move_inv) mutable
@@ -3005,42 +3005,42 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
}
}
};
- accept = move_inv_category_world_to_agent(cat_id, mUUID, drop, callback, NULL, filter);
- }
- }
- else if (LLToolDragAndDrop::SOURCE_LIBRARY == source)
- {
- if (move_is_into_marketplacelistings)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
- accept = FALSE;
- }
- else
- {
- // Accept folders that contain complete outfits.
- accept = move_is_into_current_outfit && LLAppearanceMgr::instance().getCanMakeFolderIntoOutfit(cat_id);
- }
-
- if (accept && drop)
- {
- LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, true, false);
- }
- }
-
- return accept;
+ accept = move_inv_category_world_to_agent(cat_id, mUUID, drop, callback, NULL, filter);
+ }
+ }
+ else if (LLToolDragAndDrop::SOURCE_LIBRARY == source)
+ {
+ if (move_is_into_marketplacelistings)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+ accept = FALSE;
+ }
+ else
+ {
+ // Accept folders that contain complete outfits.
+ accept = move_is_into_current_outfit && LLAppearanceMgr::instance().getCanMakeFolderIntoOutfit(cat_id);
+ }
+
+ if (accept && drop)
+ {
+ LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, true, false);
+ }
+ }
+
+ return accept;
}
void warn_move_inventory(LLViewerObject* object, std::shared_ptr<LLMoveInv> move_inv)
{
- const char* dialog = NULL;
- if (object->flagScripted())
- {
- dialog = "MoveInventoryFromScriptedObject";
- }
- else
- {
- dialog = "MoveInventoryFromObject";
- }
+ const char* dialog = NULL;
+ if (object->flagScripted())
+ {
+ dialog = "MoveInventoryFromScriptedObject";
+ }
+ else
+ {
+ dialog = "MoveInventoryFromObject";
+ }
static LLNotificationPtr notification_ptr;
static std::shared_ptr<LLMoveInv> inv_ptr;
@@ -3074,228 +3074,228 @@ void warn_move_inventory(LLViewerObject* object, std::shared_ptr<LLMoveInv> move
// Move/copy all inventory items from the Contents folder of an in-world
// object to the agent's inventory, inside a given category.
BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
- const LLUUID& category_id,
- BOOL drop,
- std::function<void(S32, void*, const LLMoveInv*)> callback,
- void* user_data,
- LLInventoryFilter* filter)
-{
- // Make sure the object exists. If we allowed dragging from
- // anonymous objects, it would be possible to bypass
- // permissions.
- // content category has same ID as object itself
- LLViewerObject* object = gObjectList.findObject(object_id);
- if(!object)
- {
- LL_INFOS() << "Object not found for drop." << LL_ENDL;
- return FALSE;
- }
-
- // this folder is coming from an object, as there is only one folder in an object, the root,
- // we need to collect the entire contents and handle them as a group
- LLInventoryObject::object_list_t inventory_objects;
- object->getInventoryContents(inventory_objects);
-
- if (inventory_objects.empty())
- {
- LL_INFOS() << "Object contents not found for drop." << LL_ENDL;
- return FALSE;
- }
-
- BOOL accept = FALSE;
- BOOL is_move = FALSE;
- BOOL use_filter = FALSE;
- if (filter)
- {
- U64 filter_types = filter->getFilterTypes();
- use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0);
- }
-
- // coming from a task. Need to figure out if the person can
- // move/copy this item.
- LLInventoryObject::object_list_t::iterator it = inventory_objects.begin();
- LLInventoryObject::object_list_t::iterator end = inventory_objects.end();
- for ( ; it != end; ++it)
- {
- LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(it->get());
- if (!item)
- {
- LL_WARNS() << "Invalid inventory item for drop" << LL_ENDL;
- continue;
- }
-
- // coming from a task. Need to figure out if the person can
- // move/copy this item.
- LLPermissions perm(item->getPermissions());
- if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
- && perm.allowTransferTo(gAgent.getID())))
-// || gAgent.isGodlike())
- {
- accept = TRUE;
- }
- else if(object->permYouOwner())
- {
- // If the object cannot be copied, but the object the
- // inventory is owned by the agent, then the item can be
- // moved from the task to agent inventory.
- is_move = TRUE;
- accept = TRUE;
- }
-
- if (accept && use_filter)
- {
- accept = filter->check(item);
- }
-
- if (!accept)
- {
- break;
- }
- }
-
- if(drop && accept)
- {
- it = inventory_objects.begin();
+ const LLUUID& category_id,
+ BOOL drop,
+ std::function<void(S32, void*, const LLMoveInv*)> callback,
+ void* user_data,
+ LLInventoryFilter* filter)
+{
+ // Make sure the object exists. If we allowed dragging from
+ // anonymous objects, it would be possible to bypass
+ // permissions.
+ // content category has same ID as object itself
+ LLViewerObject* object = gObjectList.findObject(object_id);
+ if(!object)
+ {
+ LL_INFOS() << "Object not found for drop." << LL_ENDL;
+ return FALSE;
+ }
+
+ // this folder is coming from an object, as there is only one folder in an object, the root,
+ // we need to collect the entire contents and handle them as a group
+ LLInventoryObject::object_list_t inventory_objects;
+ object->getInventoryContents(inventory_objects);
+
+ if (inventory_objects.empty())
+ {
+ LL_INFOS() << "Object contents not found for drop." << LL_ENDL;
+ return FALSE;
+ }
+
+ BOOL accept = FALSE;
+ BOOL is_move = FALSE;
+ BOOL use_filter = FALSE;
+ if (filter)
+ {
+ U64 filter_types = filter->getFilterTypes();
+ use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0);
+ }
+
+ // coming from a task. Need to figure out if the person can
+ // move/copy this item.
+ LLInventoryObject::object_list_t::iterator it = inventory_objects.begin();
+ LLInventoryObject::object_list_t::iterator end = inventory_objects.end();
+ for ( ; it != end; ++it)
+ {
+ LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(it->get());
+ if (!item)
+ {
+ LL_WARNS() << "Invalid inventory item for drop" << LL_ENDL;
+ continue;
+ }
+
+ // coming from a task. Need to figure out if the person can
+ // move/copy this item.
+ LLPermissions perm(item->getPermissions());
+ if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
+ && perm.allowTransferTo(gAgent.getID())))
+// || gAgent.isGodlike())
+ {
+ accept = TRUE;
+ }
+ else if(object->permYouOwner())
+ {
+ // If the object cannot be copied, but the object the
+ // inventory is owned by the agent, then the item can be
+ // moved from the task to agent inventory.
+ is_move = TRUE;
+ accept = TRUE;
+ }
+
+ if (accept && use_filter)
+ {
+ accept = filter->check(item);
+ }
+
+ if (!accept)
+ {
+ break;
+ }
+ }
+
+ if(drop && accept)
+ {
+ it = inventory_objects.begin();
std::shared_ptr<LLMoveInv> move_inv(new LLMoveInv);
- move_inv->mObjectID = object_id;
- move_inv->mCategoryID = category_id;
- move_inv->mCallback = callback;
- move_inv->mUserData = user_data;
-
- for ( ; it != end; ++it)
- {
- two_uuids_t two(category_id, (*it)->getUUID());
- move_inv->mMoveList.push_back(two);
- }
-
- if(is_move)
- {
- // Callback called from within here.
- warn_move_inventory(object, move_inv);
- }
- else
- {
- LLNotification::Params params("MoveInventoryFromObject");
- params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv));
- LLNotifications::instance().forceResponse(params, 0);
- }
- }
- return accept;
+ move_inv->mObjectID = object_id;
+ move_inv->mCategoryID = category_id;
+ move_inv->mCallback = callback;
+ move_inv->mUserData = user_data;
+
+ for ( ; it != end; ++it)
+ {
+ two_uuids_t two(category_id, (*it)->getUUID());
+ move_inv->mMoveList.push_back(two);
+ }
+
+ if(is_move)
+ {
+ // Callback called from within here.
+ warn_move_inventory(object, move_inv);
+ }
+ else
+ {
+ LLNotification::Params params("MoveInventoryFromObject");
+ params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv));
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ }
+ return accept;
}
void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer)
{
- // Bail out immediately if no descendents
- if( mComplete.empty() )
- {
- LL_WARNS() << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << LL_ENDL;
- if (clear_observer)
- {
- gInventory.removeObserver(this);
- delete this;
- }
- return;
- }
-
- // Copy the list of complete fetched folders while "this" is still valid
- uuid_vec_t completed_folder = mComplete;
-
- // Clean up, and remove this as an observer now since recursive calls
- // could notify observers and throw us into an infinite loop.
- if (clear_observer)
- {
- gInventory.removeObserver(this);
- delete this;
- }
-
- for (uuid_vec_t::iterator current_folder = completed_folder.begin(); current_folder != completed_folder.end(); ++current_folder)
- {
- // Get the information on the fetched folder items and subfolders and fetch those
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array);
-
- S32 item_count(0);
- if( item_array )
- {
- item_count = item_array->size();
- }
-
- S32 cat_count(0);
- if( cat_array )
- {
- cat_count = cat_array->size();
- }
-
- // Move to next if current folder empty
- if ((item_count == 0) && (cat_count == 0))
- {
- continue;
- }
-
- uuid_vec_t ids;
- LLRightClickInventoryFetchObserver* outfit = NULL;
- LLRightClickInventoryFetchDescendentsObserver* categories = NULL;
-
- // Fetch the items
- if (item_count)
- {
- for (S32 i = 0; i < item_count; ++i)
- {
- ids.push_back(item_array->at(i)->getUUID());
- }
- outfit = new LLRightClickInventoryFetchObserver(ids);
- }
- // Fetch the subfolders
- if (cat_count)
- {
- for (S32 i = 0; i < cat_count; ++i)
- {
- ids.push_back(cat_array->at(i)->getUUID());
- }
- categories = new LLRightClickInventoryFetchDescendentsObserver(ids);
- }
-
- // Perform the item fetch
- if (outfit)
- {
- outfit->startFetch();
- outfit->execute(); // Not interested in waiting and this will be right 99% of the time.
- delete outfit;
+ // Bail out immediately if no descendents
+ if( mComplete.empty() )
+ {
+ LL_WARNS() << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << LL_ENDL;
+ if (clear_observer)
+ {
+ gInventory.removeObserver(this);
+ delete this;
+ }
+ return;
+ }
+
+ // Copy the list of complete fetched folders while "this" is still valid
+ uuid_vec_t completed_folder = mComplete;
+
+ // Clean up, and remove this as an observer now since recursive calls
+ // could notify observers and throw us into an infinite loop.
+ if (clear_observer)
+ {
+ gInventory.removeObserver(this);
+ delete this;
+ }
+
+ for (uuid_vec_t::iterator current_folder = completed_folder.begin(); current_folder != completed_folder.end(); ++current_folder)
+ {
+ // Get the information on the fetched folder items and subfolders and fetch those
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array);
+
+ S32 item_count(0);
+ if( item_array )
+ {
+ item_count = item_array->size();
+ }
+
+ S32 cat_count(0);
+ if( cat_array )
+ {
+ cat_count = cat_array->size();
+ }
+
+ // Move to next if current folder empty
+ if ((item_count == 0) && (cat_count == 0))
+ {
+ continue;
+ }
+
+ uuid_vec_t ids;
+ LLRightClickInventoryFetchObserver* outfit = NULL;
+ LLRightClickInventoryFetchDescendentsObserver* categories = NULL;
+
+ // Fetch the items
+ if (item_count)
+ {
+ for (S32 i = 0; i < item_count; ++i)
+ {
+ ids.push_back(item_array->at(i)->getUUID());
+ }
+ outfit = new LLRightClickInventoryFetchObserver(ids);
+ }
+ // Fetch the subfolders
+ if (cat_count)
+ {
+ for (S32 i = 0; i < cat_count; ++i)
+ {
+ ids.push_back(cat_array->at(i)->getUUID());
+ }
+ categories = new LLRightClickInventoryFetchDescendentsObserver(ids);
+ }
+
+ // Perform the item fetch
+ if (outfit)
+ {
+ outfit->startFetch();
+ outfit->execute(); // Not interested in waiting and this will be right 99% of the time.
+ delete outfit;
//Uncomment the following code for laggy Inventory UI.
- /*
- if (outfit->isFinished())
- {
- // everything is already here - call done.
- outfit->execute();
- delete outfit;
- }
- else
- {
- // it's all on its way - add an observer, and the inventory
- // will call done for us when everything is here.
- gInventory.addObserver(outfit);
- }
- */
- }
- // Perform the subfolders fetch : this is where we truly recurse down the folder hierarchy
- if (categories)
- {
- categories->startFetch();
- if (categories->isFinished())
- {
- // everything is already here - call done.
- categories->execute();
- delete categories;
- }
- else
- {
- // it's all on its way - add an observer, and the inventory
- // will call done for us when everything is here.
- gInventory.addObserver(categories);
- }
- }
- }
+ /*
+ if (outfit->isFinished())
+ {
+ // everything is already here - call done.
+ outfit->execute();
+ delete outfit;
+ }
+ else
+ {
+ // it's all on its way - add an observer, and the inventory
+ // will call done for us when everything is here.
+ gInventory.addObserver(outfit);
+ }
+ */
+ }
+ // Perform the subfolders fetch : this is where we truly recurse down the folder hierarchy
+ if (categories)
+ {
+ categories->startFetch();
+ if (categories->isFinished())
+ {
+ // everything is already here - call done.
+ categories->execute();
+ delete categories;
+ }
+ else
+ {
+ // it's all on its way - add an observer, and the inventory
+ // will call done for us when everything is here.
+ gInventory.addObserver(categories);
+ }
+ }
+ }
}
@@ -3308,149 +3308,149 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer)
class LLInventoryCopyAndWearObserver : public LLInventoryObserver
{
public:
- LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count, bool folder_added=false, bool replace=false) :
- mCatID(cat_id), mContentsCount(count), mFolderAdded(folder_added), mReplace(replace){}
- virtual ~LLInventoryCopyAndWearObserver() {}
- virtual void changed(U32 mask);
+ LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count, bool folder_added=false, bool replace=false) :
+ mCatID(cat_id), mContentsCount(count), mFolderAdded(folder_added), mReplace(replace){}
+ virtual ~LLInventoryCopyAndWearObserver() {}
+ virtual void changed(U32 mask);
protected:
- LLUUID mCatID;
- int mContentsCount;
- bool mFolderAdded;
- bool mReplace;
+ LLUUID mCatID;
+ int mContentsCount;
+ bool mFolderAdded;
+ bool mReplace;
};
void LLInventoryCopyAndWearObserver::changed(U32 mask)
{
- if((mask & (LLInventoryObserver::ADD)) != 0)
- {
- if (!mFolderAdded)
- {
- const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
-
- std::set<LLUUID>::const_iterator id_it = changed_items.begin();
- std::set<LLUUID>::const_iterator id_end = changed_items.end();
- for (;id_it != id_end; ++id_it)
- {
- if ((*id_it) == mCatID)
- {
- mFolderAdded = TRUE;
- break;
- }
- }
- }
-
- if (mFolderAdded)
- {
- LLViewerInventoryCategory* category = gInventory.getCategory(mCatID);
- if (NULL == category)
- {
- LL_WARNS() << "gInventory.getCategory(" << mCatID
- << ") was NULL" << LL_ENDL;
- }
- else
- {
- if (category->getDescendentCount() ==
- mContentsCount)
- {
- gInventory.removeObserver(this);
- LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, !mReplace);
- delete this;
- }
- }
- }
-
- }
+ if((mask & (LLInventoryObserver::ADD)) != 0)
+ {
+ if (!mFolderAdded)
+ {
+ const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
+
+ std::set<LLUUID>::const_iterator id_it = changed_items.begin();
+ std::set<LLUUID>::const_iterator id_end = changed_items.end();
+ for (;id_it != id_end; ++id_it)
+ {
+ if ((*id_it) == mCatID)
+ {
+ mFolderAdded = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (mFolderAdded)
+ {
+ LLViewerInventoryCategory* category = gInventory.getCategory(mCatID);
+ if (NULL == category)
+ {
+ LL_WARNS() << "gInventory.getCategory(" << mCatID
+ << ") was NULL" << LL_ENDL;
+ }
+ else
+ {
+ if (category->getDescendentCount() ==
+ mContentsCount)
+ {
+ gInventory.removeObserver(this);
+ LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, !mReplace);
+ delete this;
+ }
+ }
+ }
+
+ }
}
void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
{
- if ("open" == action)
- {
- LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(mInventoryPanel.get()->getItemByID(mUUID));
- if (f)
- {
- f->toggleOpen();
- }
-
- return;
- }
+ if ("open" == action)
+ {
+ LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(mInventoryPanel.get()->getItemByID(mUUID));
+ if (f)
+ {
+ f->toggleOpen();
+ }
+
+ return;
+ }
else if ("thumbnail" == action)
{
LLSD data(mUUID);
LLFloaterReg::showInstance("change_item_thumbnail", data);
return;
}
- else if ("paste" == action)
- {
- pasteFromClipboard();
- return;
- }
- else if ("paste_link" == action)
- {
- pasteLinkFromClipboard();
- return;
- }
- else if ("properties" == action)
- {
- showProperties();
- return;
- }
- else if ("replaceoutfit" == action)
- {
- modifyOutfit(FALSE);
- return;
- }
- else if ("addtooutfit" == action)
- {
- modifyOutfit(TRUE);
- return;
- }
- else if ("show_in_main_panel" == action)
- {
- LLInventoryPanel::openInventoryPanelAndSetSelection(true, mUUID, true);
- return;
- }
- else if ("cut" == action)
- {
- cutToClipboard();
- return;
- }
- else if ("copy" == action)
- {
- copyToClipboard();
- return;
- }
- else if ("removefromoutfit" == action)
- {
- LLInventoryModel* model = getInventoryModel();
- if(!model) return;
- LLViewerInventoryCategory* cat = getCategory();
- if(!cat) return;
-
- LLAppearanceMgr::instance().takeOffOutfit( cat->getLinkedUUID() );
- return;
- }
- else if ("copyoutfittoclipboard" == action)
- {
- copyOutfitToClipboard();
- }
- else if ("purge" == action)
- {
- purgeItem(model, mUUID);
- return;
- }
- else if ("restore" == action)
- {
- restoreItem();
- return;
- }
- else if ("marketplace_list" == action)
- {
+ else if ("paste" == action)
+ {
+ pasteFromClipboard();
+ return;
+ }
+ else if ("paste_link" == action)
+ {
+ pasteLinkFromClipboard();
+ return;
+ }
+ else if ("properties" == action)
+ {
+ showProperties();
+ return;
+ }
+ else if ("replaceoutfit" == action)
+ {
+ modifyOutfit(FALSE);
+ return;
+ }
+ else if ("addtooutfit" == action)
+ {
+ modifyOutfit(TRUE);
+ return;
+ }
+ else if ("show_in_main_panel" == action)
+ {
+ LLInventoryPanel::openInventoryPanelAndSetSelection(true, mUUID, true);
+ return;
+ }
+ else if ("cut" == action)
+ {
+ cutToClipboard();
+ return;
+ }
+ else if ("copy" == action)
+ {
+ copyToClipboard();
+ return;
+ }
+ else if ("removefromoutfit" == action)
+ {
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ LLViewerInventoryCategory* cat = getCategory();
+ if(!cat) return;
+
+ LLAppearanceMgr::instance().takeOffOutfit( cat->getLinkedUUID() );
+ return;
+ }
+ else if ("copyoutfittoclipboard" == action)
+ {
+ copyOutfitToClipboard();
+ }
+ else if ("purge" == action)
+ {
+ purgeItem(model, mUUID);
+ return;
+ }
+ else if ("restore" == action)
+ {
+ restoreItem();
+ return;
+ }
+ else if ("marketplace_list" == action)
+ {
if (depth_nesting_in_marketplace(mUUID) == 1)
{
LLUUID version_folder_id = LLMarketplaceData::instance().getVersionFolder(mUUID);
@@ -3475,10 +3475,10 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2, _3)
);
}
- return;
- }
- else if ("marketplace_activate" == action)
- {
+ return;
+ }
+ else if ("marketplace_activate" == action)
+ {
if (depth_nesting_in_marketplace(mUUID) == 2)
{
mMessage = "";
@@ -3503,27 +3503,27 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
false,
2);
}
- return;
- }
- else if ("marketplace_unlist" == action)
- {
+ return;
+ }
+ else if ("marketplace_unlist" == action)
+ {
if (depth_nesting_in_marketplace(mUUID) == 1)
{
LLMarketplaceData::instance().activateListing(mUUID,false,1);
}
- return;
- }
- else if ("marketplace_deactivate" == action)
- {
+ return;
+ }
+ else if ("marketplace_deactivate" == action)
+ {
if (depth_nesting_in_marketplace(mUUID) == 2)
{
- LLInventoryCategory* category = gInventory.getCategory(mUUID);
+ LLInventoryCategory* category = gInventory.getCategory(mUUID);
LLMarketplaceData::instance().setVersionFolder(category->getParentUUID(), LLUUID::null, 1);
}
- return;
- }
- else if ("marketplace_create_listing" == action)
- {
+ return;
+ }
+ else if ("marketplace_create_listing" == action)
+ {
mMessage = "";
// first run vithout fix_hierarchy, second run with fix_hierarchy
@@ -3561,50 +3561,50 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
},
boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2, _3),
false);
-
- return;
- }
+
+ return;
+ }
else if ("marketplace_disassociate_listing" == action)
{
LLMarketplaceData::instance().clearListing(mUUID);
- return;
+ return;
}
else if ("marketplace_get_listing" == action)
{
// This is used only to exercise the SLM API but won't be shown to end users
LLMarketplaceData::instance().getListing(mUUID);
- return;
+ return;
}
- else if ("marketplace_associate_listing" == action)
- {
+ else if ("marketplace_associate_listing" == action)
+ {
LLFloaterAssociateListing::show(mUUID);
- return;
- }
- else if ("marketplace_check_listing" == action)
- {
+ return;
+ }
+ else if ("marketplace_check_listing" == action)
+ {
LLSD data(mUUID);
LLFloaterReg::showInstance("marketplace_validation", data);
- return;
- }
- else if ("marketplace_edit_listing" == action)
- {
+ return;
+ }
+ else if ("marketplace_edit_listing" == action)
+ {
std::string url = LLMarketplaceData::instance().getListingURL(mUUID);
if (!url.empty())
{
LLUrlAction::openURL(url);
}
- return;
- }
+ return;
+ }
#ifndef LL_RELEASE_FOR_DOWNLOAD
- else if ("delete_system_folder" == action)
- {
- removeSystemFolder();
- }
+ else if ("delete_system_folder" == action)
+ {
+ removeSystemFolder();
+ }
#endif
- else if (("move_to_marketplace_listings" == action) || ("copy_to_marketplace_listings" == action) || ("copy_or_move_to_marketplace_listings" == action))
- {
- LLInventoryCategory * cat = gInventory.getCategory(mUUID);
- if (!cat) return;
+ else if (("move_to_marketplace_listings" == action) || ("copy_to_marketplace_listings" == action) || ("copy_or_move_to_marketplace_listings" == action))
+ {
+ LLInventoryCategory * cat = gInventory.getCategory(mUUID);
+ if (!cat) return;
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
move_folder_to_marketplacelistings(cat, marketplacelistings_id, ("move_to_marketplace_listings" != action), (("copy_or_move_to_marketplace_listings" == action)));
}
@@ -3630,40 +3630,40 @@ void LLFolderBridge::gatherMessage(std::string& message, S32 depth, LLError::ELe
void LLFolderBridge::copyOutfitToClipboard()
{
- std::string text;
+ std::string text;
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array);
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array);
- S32 item_count(0);
- if( item_array )
- {
- item_count = item_array->size();
- }
+ S32 item_count(0);
+ if( item_array )
+ {
+ item_count = item_array->size();
+ }
- if (item_count)
- {
- for (S32 i = 0; i < item_count;)
- {
- LLSD uuid =item_array->at(i)->getUUID();
- LLViewerInventoryItem* item = gInventory.getItem(uuid);
+ if (item_count)
+ {
+ for (S32 i = 0; i < item_count;)
+ {
+ LLSD uuid =item_array->at(i)->getUUID();
+ LLViewerInventoryItem* item = gInventory.getItem(uuid);
- i++;
- if (item != NULL)
- {
- // Append a newline to all but the last line
- text += i != item_count ? item->getName() + "\n" : item->getName();
- }
- }
- }
+ i++;
+ if (item != NULL)
+ {
+ // Append a newline to all but the last line
+ text += i != item_count ? item->getName() + "\n" : item->getName();
+ }
+ }
+ }
- LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size());
+ LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size());
}
void LLFolderBridge::openItem()
{
- LL_DEBUGS() << "LLFolderBridge::openItem()" << LL_ENDL;
+ LL_DEBUGS() << "LLFolderBridge::openItem()" << LL_ENDL;
LLInventoryPanel* panel = mInventoryPanel.get();
if (!panel)
@@ -3680,161 +3680,161 @@ void LLFolderBridge::openItem()
return;
}
panel->onFolderOpening(mUUID);
- bool fetching_inventory = model->fetchDescendentsOf(mUUID);
- // Only change folder type if we have the folder contents.
- if (!fetching_inventory)
- {
- // Disabling this for now, it's causing crash when new items are added to folders
- // since folder type may change before new item item has finished processing.
- // determineFolderType();
- }
+ bool fetching_inventory = model->fetchDescendentsOf(mUUID);
+ // Only change folder type if we have the folder contents.
+ if (!fetching_inventory)
+ {
+ // Disabling this for now, it's causing crash when new items are added to folders
+ // since folder type may change before new item item has finished processing.
+ // determineFolderType();
+ }
}
void LLFolderBridge::closeItem()
{
- determineFolderType();
+ determineFolderType();
}
void LLFolderBridge::determineFolderType()
{
- if (isUpToDate())
- {
- LLInventoryModel* model = getInventoryModel();
- LLViewerInventoryCategory* category = model->getCategory(mUUID);
- if (category)
- {
- category->determineFolderType();
- }
- }
+ if (isUpToDate())
+ {
+ LLInventoryModel* model = getInventoryModel();
+ LLViewerInventoryCategory* category = model->getCategory(mUUID);
+ if (category)
+ {
+ category->determineFolderType();
+ }
+ }
}
BOOL LLFolderBridge::isItemRenameable() const
{
- return get_is_category_renameable(getInventoryModel(), mUUID);
+ return get_is_category_renameable(getInventoryModel(), mUUID);
}
void LLFolderBridge::restoreItem()
{
- LLViewerInventoryCategory* cat;
- cat = (LLViewerInventoryCategory*)getCategory();
- if(cat)
- {
- LLInventoryModel* model = getInventoryModel();
- const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(cat->getType()));
- // do not restamp children on restore
- LLInvFVBridge::changeCategoryParent(model, cat, new_parent, FALSE);
- }
+ LLViewerInventoryCategory* cat;
+ cat = (LLViewerInventoryCategory*)getCategory();
+ if(cat)
+ {
+ LLInventoryModel* model = getInventoryModel();
+ const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(cat->getType()));
+ // do not restamp children on restore
+ LLInvFVBridge::changeCategoryParent(model, cat, new_parent, FALSE);
+ }
}
LLFolderType::EType LLFolderBridge::getPreferredType() const
{
- LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
- LLViewerInventoryCategory* cat = getCategory();
- if(cat)
- {
- preferred_type = cat->getPreferredType();
- }
+ LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
+ LLViewerInventoryCategory* cat = getCategory();
+ if(cat)
+ {
+ preferred_type = cat->getPreferredType();
+ }
- return preferred_type;
+ return preferred_type;
}
// Icons for folders are based on the preferred type
LLUIImagePtr LLFolderBridge::getIcon() const
{
- return getFolderIcon(FALSE);
+ return getFolderIcon(FALSE);
}
LLUIImagePtr LLFolderBridge::getIconOpen() const
{
- return getFolderIcon(TRUE);
+ return getFolderIcon(TRUE);
}
LLUIImagePtr LLFolderBridge::getFolderIcon(BOOL is_open) const
{
- LLFolderType::EType preferred_type = getPreferredType();
- return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, is_open));
+ LLFolderType::EType preferred_type = getPreferredType();
+ return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, is_open));
}
// static : use by LLLinkFolderBridge to get the closed type icons
LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
{
- return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, FALSE));
+ return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, FALSE));
}
LLUIImagePtr LLFolderBridge::getIconOverlay() const
{
- if (getInventoryObject() && getInventoryObject()->getIsLinkType())
- {
- return LLUI::getUIImage("Inv_Link");
- }
- return NULL;
+ if (getInventoryObject() && getInventoryObject()->getIsLinkType())
+ {
+ return LLUI::getUIImage("Inv_Link");
+ }
+ return NULL;
}
BOOL LLFolderBridge::renameItem(const std::string& new_name)
{
- LLScrollOnRenameObserver *observer = new LLScrollOnRenameObserver(mUUID, mRoot);
- gInventory.addObserver(observer);
+ LLScrollOnRenameObserver *observer = new LLScrollOnRenameObserver(mUUID, mRoot);
+ gInventory.addObserver(observer);
- rename_category(getInventoryModel(), mUUID, new_name);
+ rename_category(getInventoryModel(), mUUID, new_name);
- // return FALSE because we either notified observers (& therefore
- // rebuilt) or we didn't update.
- return FALSE;
+ // return FALSE because we either notified observers (& therefore
+ // rebuilt) or we didn't update.
+ return FALSE;
}
BOOL LLFolderBridge::removeItem()
{
- if(!isItemRemovable())
- {
- return FALSE;
- }
- const LLViewerInventoryCategory *cat = getCategory();
-
- LLSD payload;
- LLSD args;
- args["FOLDERNAME"] = cat->getName();
+ if(!isItemRemovable())
+ {
+ return FALSE;
+ }
+ const LLViewerInventoryCategory *cat = getCategory();
- LLNotification::Params params("ConfirmDeleteProtectedCategory");
- params.payload(payload).substitutions(args).functor.function(boost::bind(&LLFolderBridge::removeItemResponse, this, _1, _2));
- LLNotifications::instance().forceResponse(params, 0);
- return TRUE;
+ LLSD payload;
+ LLSD args;
+ args["FOLDERNAME"] = cat->getName();
+
+ LLNotification::Params params("ConfirmDeleteProtectedCategory");
+ params.payload(payload).substitutions(args).functor.function(boost::bind(&LLFolderBridge::removeItemResponse, this, _1, _2));
+ LLNotifications::instance().forceResponse(params, 0);
+ return TRUE;
}
BOOL LLFolderBridge::removeSystemFolder()
{
- const LLViewerInventoryCategory *cat = getCategory();
- if (!LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
- {
- return FALSE;
- }
+ const LLViewerInventoryCategory *cat = getCategory();
+ if (!LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+ {
+ return FALSE;
+ }
- LLSD payload;
- LLSD args;
- args["FOLDERNAME"] = cat->getName();
+ LLSD payload;
+ LLSD args;
+ args["FOLDERNAME"] = cat->getName();
- LLNotification::Params params("ConfirmDeleteProtectedCategory");
- params.payload(payload).substitutions(args).functor.function(boost::bind(&LLFolderBridge::removeItemResponse, this, _1, _2));
- {
- LLNotifications::instance().add(params);
- }
- return TRUE;
+ LLNotification::Params params("ConfirmDeleteProtectedCategory");
+ params.payload(payload).substitutions(args).functor.function(boost::bind(&LLFolderBridge::removeItemResponse, this, _1, _2));
+ {
+ LLNotifications::instance().add(params);
+ }
+ return TRUE;
}
bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotification::getSelectedOption(notification, response);
- // if they choose delete, do it. Otherwise, don't do anything
- if(option == 0)
- {
- // move it to the trash
- LLPreview::hide(mUUID);
- getInventoryModel()->removeCategory(mUUID);
- return TRUE;
- }
- return FALSE;
+ // if they choose delete, do it. Otherwise, don't do anything
+ if(option == 0)
+ {
+ // move it to the trash
+ LLPreview::hide(mUUID);
+ getInventoryModel()->removeCategory(mUUID);
+ return TRUE;
+ }
+ return FALSE;
}
//Recursively update the folder's creation date
@@ -3852,12 +3852,12 @@ void LLFolderBridge::updateHierarchyCreationDate(time_t date)
void LLFolderBridge::pasteFromClipboard()
{
- LLInventoryModel* model = getInventoryModel();
- if (model && isClipboardPasteable())
- {
+ LLInventoryModel* model = getInventoryModel();
+ if (model && isClipboardPasteable())
+ {
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
const BOOL paste_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id);
-
+
BOOL cut_from_marketplacelistings = FALSE;
if (LLClipboard::instance().isCutMode())
{
@@ -3885,7 +3885,7 @@ void LLFolderBridge::pasteFromClipboard()
// Otherwise just do the paste
perform_pasteFromClipboard();
}
- }
+ }
}
// Callback for pasteFromClipboard if DAMA required...
@@ -3913,24 +3913,24 @@ void LLFolderBridge::callback_pasteFromClipboard(const LLSD& notification, const
void LLFolderBridge::perform_pasteFromClipboard()
{
- LLInventoryModel* model = getInventoryModel();
- if (model && isClipboardPasteable())
- {
+ LLInventoryModel* model = getInventoryModel();
+ if (model && isClipboardPasteable())
+ {
const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
- const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
- const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+ const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
- const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id);
- const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+ const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+ const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id);
+ const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id);
- const BOOL move_is_into_favorites = (mUUID == favorites_id);
- const BOOL move_is_into_lost_and_found = model->isObjectDescendentOf(mUUID, lost_and_found_id);
+ const BOOL move_is_into_favorites = (mUUID == favorites_id);
+ const BOOL move_is_into_lost_and_found = model->isObjectDescendentOf(mUUID, lost_and_found_id);
- std::vector<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
LLPointer<LLInventoryCallback> cb = NULL;
LLInventoryPanel* panel = mInventoryPanel.get();
@@ -3938,10 +3938,10 @@ void LLFolderBridge::perform_pasteFromClipboard()
{
cb = new LLPasteIntoFolderCallback(mInventoryPanel);
}
-
+
LLViewerInventoryCategory * dest_folder = getCategory();
- if (move_is_into_marketplacelistings)
- {
+ if (move_is_into_marketplacelistings)
+ {
std::string error_msg;
const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, mUUID);
int index = 0;
@@ -3950,7 +3950,7 @@ void LLFolderBridge::perform_pasteFromClipboard()
const LLUUID& item_id = (*iter);
LLInventoryItem *item = model->getItem(item_id);
LLInventoryCategory *cat = model->getCategory(item_id);
-
+
if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, objects.size() - index, true))
{
break;
@@ -3960,7 +3960,7 @@ void LLFolderBridge::perform_pasteFromClipboard()
break;
}
++index;
- }
+ }
if (!error_msg.empty())
{
LLSD subs;
@@ -3968,7 +3968,7 @@ void LLFolderBridge::perform_pasteFromClipboard()
LLNotificationsUtil::add("MerchantPasteFailed", subs);
return;
}
- }
+ }
else
{
// Check that all items can be moved into that folder : for the moment, only stock folder mismatch is checked
@@ -3988,66 +3988,66 @@ void LLFolderBridge::perform_pasteFromClipboard()
}
}
}
-
- const LLUUID parent_id(mUUID);
-
- for (std::vector<LLUUID>::const_iterator iter = objects.begin();
- iter != objects.end();
- ++iter)
- {
- const LLUUID& item_id = (*iter);
-
- LLInventoryItem *item = model->getItem(item_id);
- LLInventoryObject *obj = model->getObject(item_id);
- if (obj)
- {
-
- if (move_is_into_lost_and_found)
- {
- if (LLAssetType::AT_CATEGORY == obj->getType())
- {
- return;
- }
- }
- if (move_is_into_outfit)
- {
- if (!move_is_into_my_outfits && item && can_move_to_outfit(item, move_is_into_current_outfit))
- {
- dropToOutfit(item, move_is_into_current_outfit, cb);
- }
- else if (move_is_into_my_outfits && LLAssetType::AT_CATEGORY == obj->getType())
- {
- LLInventoryCategory* cat = model->getCategory(item_id);
- U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit");
- if (cat && can_move_to_my_outfits(model, cat, max_items_to_wear))
- {
- dropToMyOutfits(cat, cb);
- }
- else
- {
- LLNotificationsUtil::add("MyOutfitsPasteFailed");
- }
- }
- else
- {
- LLNotificationsUtil::add("MyOutfitsPasteFailed");
- }
- }
- else if (move_is_into_current_outfit)
- {
- if (item && can_move_to_outfit(item, move_is_into_current_outfit))
- {
- dropToOutfit(item, move_is_into_current_outfit, cb);
- }
- else
- {
- LLNotificationsUtil::add("MyOutfitsPasteFailed");
- }
- }
- else if (move_is_into_favorites)
- {
- if (item && can_move_to_landmarks(item))
- {
+
+ const LLUUID parent_id(mUUID);
+
+ for (std::vector<LLUUID>::const_iterator iter = objects.begin();
+ iter != objects.end();
+ ++iter)
+ {
+ const LLUUID& item_id = (*iter);
+
+ LLInventoryItem *item = model->getItem(item_id);
+ LLInventoryObject *obj = model->getObject(item_id);
+ if (obj)
+ {
+
+ if (move_is_into_lost_and_found)
+ {
+ if (LLAssetType::AT_CATEGORY == obj->getType())
+ {
+ return;
+ }
+ }
+ if (move_is_into_outfit)
+ {
+ if (!move_is_into_my_outfits && item && can_move_to_outfit(item, move_is_into_current_outfit))
+ {
+ dropToOutfit(item, move_is_into_current_outfit, cb);
+ }
+ else if (move_is_into_my_outfits && LLAssetType::AT_CATEGORY == obj->getType())
+ {
+ LLInventoryCategory* cat = model->getCategory(item_id);
+ U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit");
+ if (cat && can_move_to_my_outfits(model, cat, max_items_to_wear))
+ {
+ dropToMyOutfits(cat, cb);
+ }
+ else
+ {
+ LLNotificationsUtil::add("MyOutfitsPasteFailed");
+ }
+ }
+ else
+ {
+ LLNotificationsUtil::add("MyOutfitsPasteFailed");
+ }
+ }
+ else if (move_is_into_current_outfit)
+ {
+ if (item && can_move_to_outfit(item, move_is_into_current_outfit))
+ {
+ dropToOutfit(item, move_is_into_current_outfit, cb);
+ }
+ else
+ {
+ LLNotificationsUtil::add("MyOutfitsPasteFailed");
+ }
+ }
+ else if (move_is_into_favorites)
+ {
+ if (item && can_move_to_landmarks(item))
+ {
if (LLClipboard::instance().isCutMode())
{
LLViewerInventoryItem* viitem = dynamic_cast<LLViewerInventoryItem*>(item);
@@ -4063,18 +4063,18 @@ void LLFolderBridge::perform_pasteFromClipboard()
{
dropToFavorites(item, cb);
}
- }
- }
- else if (LLClipboard::instance().isCutMode())
- {
- // Do a move to "paste" a "cut"
- // move_inventory_item() is not enough, as we have to update inventory locally too
- if (LLAssetType::AT_CATEGORY == obj->getType())
- {
- LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
- llassert(vicat);
- if (vicat)
- {
+ }
+ }
+ else if (LLClipboard::instance().isCutMode())
+ {
+ // Do a move to "paste" a "cut"
+ // move_inventory_item() is not enough, as we have to update inventory locally too
+ if (LLAssetType::AT_CATEGORY == obj->getType())
+ {
+ LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
+ llassert(vicat);
+ if (vicat)
+ {
// Clear the cut folder from the marketplace if it is a listing folder
if (LLMarketplaceData::instance().isListed(item_id))
{
@@ -4090,9 +4090,9 @@ void LLFolderBridge::perform_pasteFromClipboard()
changeCategoryParent(model, vicat, parent_id, FALSE);
}
if (cb) cb->fire(item_id);
- }
- }
- else
+ }
+ }
+ else
{
LLViewerInventoryItem* viitem = dynamic_cast<LLViewerInventoryItem*>(item);
llassert(viitem);
@@ -4114,16 +4114,16 @@ void LLFolderBridge::perform_pasteFromClipboard()
if (cb) cb->fire(item_id);
}
}
- }
- else
- {
- // Do a "copy" to "paste" a regular copy clipboard
- if (LLAssetType::AT_CATEGORY == obj->getType())
- {
- LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
- llassert(vicat);
- if (vicat)
- {
+ }
+ else
+ {
+ // Do a "copy" to "paste" a regular copy clipboard
+ if (LLAssetType::AT_CATEGORY == obj->getType())
+ {
+ LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
+ llassert(vicat);
+ if (vicat)
+ {
if (move_is_into_marketplacelistings)
{
move_folder_to_marketplacelistings(vicat, parent_id, true);
@@ -4133,8 +4133,8 @@ void LLFolderBridge::perform_pasteFromClipboard()
copy_inventory_category(model, vicat, parent_id);
}
if (cb) cb->fire(item_id);
- }
- }
+ }
+ }
else
{
LLViewerInventoryItem* viitem = dynamic_cast<LLViewerInventoryItem*>(item);
@@ -4171,35 +4171,35 @@ void LLFolderBridge::perform_pasteFromClipboard()
}
}
}
- // Change mode to paste for next paste
- LLClipboard::instance().setCutMode(false);
- }
+ // Change mode to paste for next paste
+ LLClipboard::instance().setCutMode(false);
+ }
}
void LLFolderBridge::pasteLinkFromClipboard()
{
- LLInventoryModel* model = getInventoryModel();
- if(model)
- {
- const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
- const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+ const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
- const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
- const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id);
- const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+ const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+ const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id);
+ const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id);
- if (move_is_into_marketplacelistings)
- {
- // Notify user of failure somehow -- play error sound? modal dialog?
- return;
- }
+ if (move_is_into_marketplacelistings)
+ {
+ // Notify user of failure somehow -- play error sound? modal dialog?
+ return;
+ }
- const LLUUID parent_id(mUUID);
+ const LLUUID parent_id(mUUID);
- std::vector<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
LLPointer<LLInventoryCallback> cb = NULL;
LLInventoryPanel* panel = mInventoryPanel.get();
@@ -4208,92 +4208,92 @@ void LLFolderBridge::pasteLinkFromClipboard()
cb = new LLPasteIntoFolderCallback(mInventoryPanel);
}
- for (std::vector<LLUUID>::const_iterator iter = objects.begin();
- iter != objects.end();
- ++iter)
- {
- const LLUUID &object_id = (*iter);
- if (move_is_into_current_outfit || move_is_into_outfit)
- {
- LLInventoryItem *item = model->getItem(object_id);
- if (item && can_move_to_outfit(item, move_is_into_current_outfit))
- {
- dropToOutfit(item, move_is_into_current_outfit, cb);
- }
- }
- else if (LLConstPointer<LLInventoryObject> obj = model->getObject(object_id))
- {
- link_inventory_object(parent_id, obj, cb);
- }
- }
- // Change mode to paste for next paste
- LLClipboard::instance().setCutMode(false);
- }
+ for (std::vector<LLUUID>::const_iterator iter = objects.begin();
+ iter != objects.end();
+ ++iter)
+ {
+ const LLUUID &object_id = (*iter);
+ if (move_is_into_current_outfit || move_is_into_outfit)
+ {
+ LLInventoryItem *item = model->getItem(object_id);
+ if (item && can_move_to_outfit(item, move_is_into_current_outfit))
+ {
+ dropToOutfit(item, move_is_into_current_outfit, cb);
+ }
+ }
+ else if (LLConstPointer<LLInventoryObject> obj = model->getObject(object_id))
+ {
+ link_inventory_object(parent_id, obj, cb);
+ }
+ }
+ // Change mode to paste for next paste
+ LLClipboard::instance().setCutMode(false);
+ }
}
void LLFolderBridge::staticFolderOptionsMenu()
{
- LLFolderBridge* selfp = sSelf.get();
+ LLFolderBridge* selfp = sSelf.get();
- if (selfp && selfp->mRoot)
- {
- selfp->mRoot->updateMenu();
- }
+ if (selfp && selfp->mRoot)
+ {
+ selfp->mRoot->updateMenu();
+ }
}
BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type)
{
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- model->collectDescendentsIf(mUUID,
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- is_type);
- return ((item_array.size() > 0) ? TRUE : FALSE );
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ model->collectDescendentsIf(mUUID,
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_type);
+ return ((item_array.size() > 0) ? TRUE : FALSE );
}
void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items)
{
- LLInventoryModel* model = getInventoryModel();
- llassert(model != NULL);
-
- const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- const LLUUID &favorites = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- const LLUUID &marketplace_listings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
- const LLUUID &outfits_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
-
- if (outfits_id == mUUID)
- {
- items.push_back(std::string("New Outfit"));
- }
-
- if (lost_and_found_id == mUUID)
- {
- // This is the lost+found folder.
- items.push_back(std::string("Empty Lost And Found"));
-
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array);
- // Enable Empty menu item only when there is something to act upon.
- if (0 == cat_array->size() && 0 == item_array->size())
- {
- disabled_items.push_back(std::string("Empty Lost And Found"));
- }
-
- disabled_items.push_back(std::string("New Folder"));
- disabled_items.push_back(std::string("upload_def"));
+ LLInventoryModel* model = getInventoryModel();
+ llassert(model != NULL);
+
+ const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ const LLUUID &favorites = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ const LLUUID &marketplace_listings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
+ const LLUUID &outfits_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+
+ if (outfits_id == mUUID)
+ {
+ items.push_back(std::string("New Outfit"));
+ }
+
+ if (lost_and_found_id == mUUID)
+ {
+ // This is the lost+found folder.
+ items.push_back(std::string("Empty Lost And Found"));
+
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array);
+ // Enable Empty menu item only when there is something to act upon.
+ if (0 == cat_array->size() && 0 == item_array->size())
+ {
+ disabled_items.push_back(std::string("Empty Lost And Found"));
+ }
+
+ disabled_items.push_back(std::string("New Folder"));
+ disabled_items.push_back(std::string("upload_def"));
disabled_items.push_back(std::string("create_new"));
- }
- if (favorites == mUUID)
- {
- disabled_items.push_back(std::string("New Folder"));
- }
+ }
+ if (favorites == mUUID)
+ {
+ disabled_items.push_back(std::string("New Folder"));
+ }
if (isMarketplaceListingsFolder())
{
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
if (LLMarketplaceData::instance().isUpdating(mUUID))
{
disabled_items.push_back(std::string("New Folder"));
@@ -4307,69 +4307,69 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
if (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK)
{
disabled_items.push_back(std::string("New Folder"));
- disabled_items.push_back(std::string("upload_def"));
+ disabled_items.push_back(std::string("upload_def"));
disabled_items.push_back(std::string("create_new"));
}
if (marketplace_listings_id == mUUID)
{
- disabled_items.push_back(std::string("New Folder"));
+ disabled_items.push_back(std::string("New Folder"));
disabled_items.push_back(std::string("Rename"));
disabled_items.push_back(std::string("Cut"));
disabled_items.push_back(std::string("Delete"));
}
- if (isPanelActive("Favorite Items"))
- {
- disabled_items.push_back(std::string("Delete"));
- }
- if(trash_id == mUUID)
- {
- bool is_recent_panel = isPanelActive("Recent Items");
-
- // This is the trash.
- items.push_back(std::string("Empty Trash"));
-
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array);
- LLViewerInventoryCategory *trash = getCategory();
- // Enable Empty menu item only when there is something to act upon.
- // Also don't enable menu if folder isn't fully fetched
- if ((0 == cat_array->size() && 0 == item_array->size())
- || is_recent_panel
- || !trash
- || trash->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN
- || trash->getDescendentCount() == LLViewerInventoryCategory::VERSION_UNKNOWN
- || gAgentAvatarp->hasAttachmentsInTrash())
- {
- disabled_items.push_back(std::string("Empty Trash"));
- }
+ if (isPanelActive("Favorite Items"))
+ {
+ disabled_items.push_back(std::string("Delete"));
+ }
+ if(trash_id == mUUID)
+ {
+ bool is_recent_panel = isPanelActive("Recent Items");
+
+ // This is the trash.
+ items.push_back(std::string("Empty Trash"));
+
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array);
+ LLViewerInventoryCategory *trash = getCategory();
+ // Enable Empty menu item only when there is something to act upon.
+ // Also don't enable menu if folder isn't fully fetched
+ if ((0 == cat_array->size() && 0 == item_array->size())
+ || is_recent_panel
+ || !trash
+ || trash->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN
+ || trash->getDescendentCount() == LLViewerInventoryCategory::VERSION_UNKNOWN
+ || gAgentAvatarp->hasAttachmentsInTrash())
+ {
+ disabled_items.push_back(std::string("Empty Trash"));
+ }
items.push_back(std::string("thumbnail"));
- }
- else if(isItemInTrash())
- {
- // This is a folder in the trash.
- items.clear(); // clear any items that used to exist
- addTrashContextMenuOptions(items, disabled_items);
- }
- else if(isAgentInventory()) // do not allow creating in library
- {
- LLViewerInventoryCategory *cat = getCategory();
- // BAP removed protected check to re-enable standard ops in untyped folders.
- // Not sure what the right thing is to do here.
- if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT))
- {
- if (!isInboxFolder() // don't allow creation in inbox
- && outfits_id != mUUID)
- {
- bool menu_items_added = false;
- // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694.
- if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat))
- {
- items.push_back(std::string("New Folder"));
- menu_items_added = true;
- }
+ }
+ else if(isItemInTrash())
+ {
+ // This is a folder in the trash.
+ items.clear(); // clear any items that used to exist
+ addTrashContextMenuOptions(items, disabled_items);
+ }
+ else if(isAgentInventory()) // do not allow creating in library
+ {
+ LLViewerInventoryCategory *cat = getCategory();
+ // BAP removed protected check to re-enable standard ops in untyped folders.
+ // Not sure what the right thing is to do here.
+ if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT))
+ {
+ if (!isInboxFolder() // don't allow creation in inbox
+ && outfits_id != mUUID)
+ {
+ bool menu_items_added = false;
+ // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694.
+ if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat))
+ {
+ items.push_back(std::string("New Folder"));
+ menu_items_added = true;
+ }
if (!isMarketplaceListingsFolder())
{
items.push_back(std::string("upload_def"));
@@ -4390,170 +4390,170 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
{
items.push_back(std::string("Create Separator"));
}
- }
- getClipboardEntries(false, items, disabled_items, flags);
- }
- else
- {
- // Want some but not all of the items from getClipboardEntries for outfits.
- if (cat && (cat->getPreferredType() == LLFolderType::FT_OUTFIT))
- {
- items.push_back(std::string("Rename"));
+ }
+ getClipboardEntries(false, items, disabled_items, flags);
+ }
+ else
+ {
+ // Want some but not all of the items from getClipboardEntries for outfits.
+ if (cat && (cat->getPreferredType() == LLFolderType::FT_OUTFIT))
+ {
+ items.push_back(std::string("Rename"));
items.push_back(std::string("thumbnail"));
- addDeleteContextMenuOptions(items, disabled_items);
- // EXT-4030: disallow deletion of currently worn outfit
- const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink();
- if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory()))
- {
- disabled_items.push_back(std::string("Delete"));
- }
- }
- }
-
- if (model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) == mUUID)
- {
- items.push_back(std::string("Copy outfit list to clipboard"));
+ addDeleteContextMenuOptions(items, disabled_items);
+ // EXT-4030: disallow deletion of currently worn outfit
+ const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink();
+ if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory()))
+ {
+ disabled_items.push_back(std::string("Delete"));
+ }
+ }
+ }
+
+ if (model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) == mUUID)
+ {
+ items.push_back(std::string("Copy outfit list to clipboard"));
addOpenFolderMenuOptions(flags, items);
- }
+ }
- //Added by aura to force inventory pull on right-click to display folder options correctly. 07-17-06
- mCallingCards = mWearables = FALSE;
+ //Added by aura to force inventory pull on right-click to display folder options correctly. 07-17-06
+ mCallingCards = mWearables = FALSE;
- LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
- if (checkFolderForContentsOfType(model, is_callingcard))
- {
- mCallingCards=TRUE;
- }
+ LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
+ if (checkFolderForContentsOfType(model, is_callingcard))
+ {
+ mCallingCards=TRUE;
+ }
- LLFindWearables is_wearable;
- LLIsType is_object( LLAssetType::AT_OBJECT );
- LLIsType is_gesture( LLAssetType::AT_GESTURE );
+ LLFindWearables is_wearable;
+ LLIsType is_object( LLAssetType::AT_OBJECT );
+ LLIsType is_gesture( LLAssetType::AT_GESTURE );
- if (checkFolderForContentsOfType(model, is_wearable) ||
+ if (checkFolderForContentsOfType(model, is_wearable) ||
checkFolderForContentsOfType(model, is_object) ||
checkFolderForContentsOfType(model, is_gesture) )
- {
- mWearables=TRUE;
- }
- }
- else
- {
- // Mark wearables and allow copy from library
- LLInventoryModel* model = getInventoryModel();
- if(!model) return;
- const LLInventoryCategory* category = model->getCategory(mUUID);
- if (!category) return;
- LLFolderType::EType type = category->getPreferredType();
- const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
-
- LLFindWearables is_wearable;
- LLIsType is_object(LLAssetType::AT_OBJECT);
- LLIsType is_gesture(LLAssetType::AT_GESTURE);
-
- if (checkFolderForContentsOfType(model, is_wearable) ||
- checkFolderForContentsOfType(model, is_object) ||
- checkFolderForContentsOfType(model, is_gesture))
- {
- mWearables = TRUE;
- }
-
- if (!is_system_folder)
- {
- items.push_back(std::string("Copy"));
- if (!isItemCopyable())
- {
- // For some reason there are items in library that can't be copied directly
- disabled_items.push_back(std::string("Copy"));
- }
- }
- }
-
- // Preemptively disable system folder removal if more than one item selected.
- if ((flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Delete System Folder"));
- }
-
- if (isAgentInventory() && !isMarketplaceListingsFolder())
- {
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
- }
-
-
-
- // Add menu items that are dependent on the contents of the folder.
- LLViewerInventoryCategory* category = (LLViewerInventoryCategory *) model->getCategory(mUUID);
- if (category && (marketplace_listings_id != mUUID))
- {
- uuid_vec_t folders;
- folders.push_back(category->getUUID());
-
- sSelf = getHandle();
- LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders);
- fetch->startFetch();
- if (fetch->isFinished())
- {
- // Do not call execute() or done() here as if the folder is here, there's likely no point drilling down
- // This saves lots of time as buildContextMenu() is called a lot
- delete fetch;
- buildContextMenuFolderOptions(flags, items, disabled_items);
- }
- else
- {
- // it's all on its way - add an observer, and the inventory will call done for us when everything is here.
- gInventory.addObserver(fetch);
+ {
+ mWearables=TRUE;
+ }
+ }
+ else
+ {
+ // Mark wearables and allow copy from library
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ const LLInventoryCategory* category = model->getCategory(mUUID);
+ if (!category) return;
+ LLFolderType::EType type = category->getPreferredType();
+ const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
+
+ LLFindWearables is_wearable;
+ LLIsType is_object(LLAssetType::AT_OBJECT);
+ LLIsType is_gesture(LLAssetType::AT_GESTURE);
+
+ if (checkFolderForContentsOfType(model, is_wearable) ||
+ checkFolderForContentsOfType(model, is_object) ||
+ checkFolderForContentsOfType(model, is_gesture))
+ {
+ mWearables = TRUE;
+ }
+
+ if (!is_system_folder)
+ {
+ items.push_back(std::string("Copy"));
+ if (!isItemCopyable())
+ {
+ // For some reason there are items in library that can't be copied directly
+ disabled_items.push_back(std::string("Copy"));
+ }
+ }
+ }
+
+ // Preemptively disable system folder removal if more than one item selected.
+ if ((flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Delete System Folder"));
+ }
+
+ if (isAgentInventory() && !isMarketplaceListingsFolder())
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+ }
+
+
+
+ // Add menu items that are dependent on the contents of the folder.
+ LLViewerInventoryCategory* category = (LLViewerInventoryCategory *) model->getCategory(mUUID);
+ if (category && (marketplace_listings_id != mUUID))
+ {
+ uuid_vec_t folders;
+ folders.push_back(category->getUUID());
+
+ sSelf = getHandle();
+ LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders);
+ fetch->startFetch();
+ if (fetch->isFinished())
+ {
+ // Do not call execute() or done() here as if the folder is here, there's likely no point drilling down
+ // This saves lots of time as buildContextMenu() is called a lot
+ delete fetch;
+ buildContextMenuFolderOptions(flags, items, disabled_items);
+ }
+ else
+ {
+ // it's all on its way - add an observer, and the inventory will call done for us when everything is here.
+ gInventory.addObserver(fetch);
}
}
}
void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items)
{
- // Build folder specific options back up
- LLInventoryModel* model = getInventoryModel();
- if(!model) return;
+ // Build folder specific options back up
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
- const LLInventoryCategory* category = model->getCategory(mUUID);
- if(!category) return;
+ const LLInventoryCategory* category = model->getCategory(mUUID);
+ if(!category) return;
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if ((trash_id == mUUID) || isItemInTrash())
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if ((trash_id == mUUID) || isItemInTrash())
{
addOpenFolderMenuOptions(flags, items);
return;
}
- if (!isItemRemovable())
- {
- disabled_items.push_back(std::string("Delete"));
- }
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Delete"));
+ }
if (isMarketplaceListingsFolder()) return;
- LLFolderType::EType type = category->getPreferredType();
- const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
- // BAP change once we're no longer treating regular categories as ensembles.
- const bool is_agent_inventory = isAgentInventory();
-
- // Only enable calling-card related options for non-system folders.
- if (!is_system_folder && is_agent_inventory && (mRoot != NULL))
- {
- LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
- if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
- {
- items.push_back(std::string("Calling Card Separator"));
- items.push_back(std::string("Conference Chat Folder"));
- items.push_back(std::string("IM All Contacts In Folder"));
- }
+ LLFolderType::EType type = category->getPreferredType();
+ const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
+ // BAP change once we're no longer treating regular categories as ensembles.
+ const bool is_agent_inventory = isAgentInventory();
+
+ // Only enable calling-card related options for non-system folders.
+ if (!is_system_folder && is_agent_inventory && (mRoot != NULL))
+ {
+ LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
+ if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
+ {
+ items.push_back(std::string("Calling Card Separator"));
+ items.push_back(std::string("Conference Chat Folder"));
+ items.push_back(std::string("IM All Contacts In Folder"));
+ }
if (((flags & ITEM_IN_MULTI_SELECTION) == 0) && hasChildren() && (type != LLFolderType::FT_OUTFIT))
{
items.push_back(std::string("Ungroup folder items"));
}
- }
+ }
else
{
disabled_items.push_back(std::string("New folder from selected"));
@@ -4568,83 +4568,83 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
addOpenFolderMenuOptions(flags, items);
#ifndef LL_RELEASE_FOR_DOWNLOAD
- if (LLFolderType::lookupIsProtectedType(type) && is_agent_inventory)
- {
- items.push_back(std::string("Delete System Folder"));
- }
+ if (LLFolderType::lookupIsProtectedType(type) && is_agent_inventory)
+ {
+ items.push_back(std::string("Delete System Folder"));
+ }
#endif
- // wearables related functionality for folders.
- //is_wearable
- LLFindWearables is_wearable;
- LLIsType is_object( LLAssetType::AT_OBJECT );
- LLIsType is_gesture( LLAssetType::AT_GESTURE );
-
- if (mWearables ||
- checkFolderForContentsOfType(model, is_wearable) ||
- checkFolderForContentsOfType(model, is_object) ||
- checkFolderForContentsOfType(model, is_gesture) )
- {
- // Only enable add/replace outfit for non-system folders.
- if (!is_system_folder)
- {
- // Adding an outfit onto another (versus replacing) doesn't make sense.
- if (type != LLFolderType::FT_OUTFIT)
- {
- items.push_back(std::string("Add To Outfit"));
+ // wearables related functionality for folders.
+ //is_wearable
+ LLFindWearables is_wearable;
+ LLIsType is_object( LLAssetType::AT_OBJECT );
+ LLIsType is_gesture( LLAssetType::AT_GESTURE );
+
+ if (mWearables ||
+ checkFolderForContentsOfType(model, is_wearable) ||
+ checkFolderForContentsOfType(model, is_object) ||
+ checkFolderForContentsOfType(model, is_gesture) )
+ {
+ // Only enable add/replace outfit for non-system folders.
+ if (!is_system_folder)
+ {
+ // Adding an outfit onto another (versus replacing) doesn't make sense.
+ if (type != LLFolderType::FT_OUTFIT)
+ {
+ items.push_back(std::string("Add To Outfit"));
if (!LLAppearanceMgr::instance().getCanAddToCOF(mUUID))
{
disabled_items.push_back(std::string("Add To Outfit"));
}
- }
+ }
- items.push_back(std::string("Replace Outfit"));
+ items.push_back(std::string("Replace Outfit"));
if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID))
{
disabled_items.push_back(std::string("Replace Outfit"));
}
- }
- if (is_agent_inventory)
- {
- items.push_back(std::string("Folder Wearables Separator"));
+ }
+ if (is_agent_inventory)
+ {
+ items.push_back(std::string("Folder Wearables Separator"));
// Note: If user tries to unwear "My Inventory", it's going to deactivate everything including gestures
// Might be safer to disable this for "My Inventory"
- items.push_back(std::string("Remove From Outfit"));
+ items.push_back(std::string("Remove From Outfit"));
if (type != LLFolderType::FT_ROOT_INVENTORY // Unless COF is empty, whih shouldn't be, warrantied to have worn items
&& !LLAppearanceMgr::getCanRemoveFromCOF(mUUID)) // expensive from root!
{
disabled_items.push_back(std::string("Remove From Outfit"));
}
- }
- items.push_back(std::string("Outfit Separator"));
+ }
+ items.push_back(std::string("Outfit Separator"));
- }
+ }
}
// Flags unused
void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- sSelf.markDead();
+ sSelf.markDead();
- // fetch contents of this folder, as context menu can depend on contents
- // still, user would have to open context menu again to see the changes
- gInventory.fetchDescendentsOf(getUUID());
+ // fetch contents of this folder, as context menu can depend on contents
+ // still, user would have to open context menu again to see the changes
+ gInventory.fetchDescendentsOf(getUUID());
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
- LL_DEBUGS() << "LLFolderBridge::buildContextMenu()" << LL_ENDL;
+ LL_DEBUGS() << "LLFolderBridge::buildContextMenu()" << LL_ENDL;
- LLInventoryModel* model = getInventoryModel();
- if(!model) return;
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
- buildContextMenuOptions(flags, items, disabled_items);
+ buildContextMenuOptions(flags, items, disabled_items);
hide_context_entries(menu, items, disabled_items);
- // Reposition the menu, in case we're adding items to an existing menu.
- menu.needsArrange();
- menu.arrangeAndClear();
+ // Reposition the menu, in case we're adding items to an existing menu.
+ menu.needsArrange();
+ menu.arrangeAndClear();
}
void LLFolderBridge::addOpenFolderMenuOptions(U32 flags, menuentry_vec_t& items)
@@ -4663,19 +4663,19 @@ void LLFolderBridge::addOpenFolderMenuOptions(U32 flags, menuentry_vec_t& items)
bool LLFolderBridge::hasChildren() const
{
- LLInventoryModel* model = getInventoryModel();
- if(!model) return FALSE;
- LLInventoryModel::EHasChildren has_children;
- has_children = gInventory.categoryHasChildren(mUUID);
- return has_children != LLInventoryModel::CHILDREN_NO;
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ LLInventoryModel::EHasChildren has_children;
+ has_children = gInventory.categoryHasChildren(mUUID);
+ return has_children != LLInventoryModel::CHILDREN_NO;
}
BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg)
{
- LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
+ LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
static LLPointer<LLInventoryCallback> drop_cb = NULL;
LLInventoryPanel* panel = mInventoryPanel.get();
@@ -4689,213 +4689,213 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,
}
- //LL_INFOS() << "LLFolderBridge::dragOrDrop()" << LL_ENDL;
- BOOL accept = FALSE;
- switch(cargo_type)
- {
- case DAD_TEXTURE:
- case DAD_SOUND:
- case DAD_CALLINGCARD:
- case DAD_LANDMARK:
- case DAD_SCRIPT:
- case DAD_CLOTHING:
- case DAD_OBJECT:
- case DAD_NOTECARD:
- case DAD_BODYPART:
- case DAD_ANIMATION:
- case DAD_GESTURE:
- case DAD_MESH:
+ //LL_INFOS() << "LLFolderBridge::dragOrDrop()" << LL_ENDL;
+ BOOL accept = FALSE;
+ switch(cargo_type)
+ {
+ case DAD_TEXTURE:
+ case DAD_SOUND:
+ case DAD_CALLINGCARD:
+ case DAD_LANDMARK:
+ case DAD_SCRIPT:
+ case DAD_CLOTHING:
+ case DAD_OBJECT:
+ case DAD_NOTECARD:
+ case DAD_BODYPART:
+ case DAD_ANIMATION:
+ case DAD_GESTURE:
+ case DAD_MESH:
case DAD_SETTINGS:
case DAD_MATERIAL:
- accept = dragItemIntoFolder(inv_item, drop, tooltip_msg, TRUE, drop_cb);
- break;
- case DAD_LINK:
- // DAD_LINK type might mean one of two asset types: AT_LINK or AT_LINK_FOLDER.
- // If we have an item of AT_LINK_FOLDER type we should process the linked
- // category being dragged or dropped into folder.
- if (inv_item && LLAssetType::AT_LINK_FOLDER == inv_item->getActualType())
- {
- LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID());
- if (linked_category)
- {
- accept = dragCategoryIntoFolder((LLInventoryCategory*)linked_category, drop, tooltip_msg, TRUE, TRUE, drop_cb);
- }
- }
- else
- {
- accept = dragItemIntoFolder(inv_item, drop, tooltip_msg, TRUE, drop_cb);
- }
- break;
- case DAD_CATEGORY:
- if (LLFriendCardsManager::instance().isAnyFriendCategory(mUUID))
- {
- accept = FALSE;
- }
- else
- {
- accept = dragCategoryIntoFolder((LLInventoryCategory*)cargo_data, drop, tooltip_msg, FALSE, TRUE, drop_cb);
- }
- break;
- case DAD_ROOT_CATEGORY:
- case DAD_NONE:
- break;
- default:
- LL_WARNS() << "Unhandled cargo type for drag&drop " << cargo_type << LL_ENDL;
- break;
- }
+ accept = dragItemIntoFolder(inv_item, drop, tooltip_msg, TRUE, drop_cb);
+ break;
+ case DAD_LINK:
+ // DAD_LINK type might mean one of two asset types: AT_LINK or AT_LINK_FOLDER.
+ // If we have an item of AT_LINK_FOLDER type we should process the linked
+ // category being dragged or dropped into folder.
+ if (inv_item && LLAssetType::AT_LINK_FOLDER == inv_item->getActualType())
+ {
+ LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID());
+ if (linked_category)
+ {
+ accept = dragCategoryIntoFolder((LLInventoryCategory*)linked_category, drop, tooltip_msg, TRUE, TRUE, drop_cb);
+ }
+ }
+ else
+ {
+ accept = dragItemIntoFolder(inv_item, drop, tooltip_msg, TRUE, drop_cb);
+ }
+ break;
+ case DAD_CATEGORY:
+ if (LLFriendCardsManager::instance().isAnyFriendCategory(mUUID))
+ {
+ accept = FALSE;
+ }
+ else
+ {
+ accept = dragCategoryIntoFolder((LLInventoryCategory*)cargo_data, drop, tooltip_msg, FALSE, TRUE, drop_cb);
+ }
+ break;
+ case DAD_ROOT_CATEGORY:
+ case DAD_NONE:
+ break;
+ default:
+ LL_WARNS() << "Unhandled cargo type for drag&drop " << cargo_type << LL_ENDL;
+ break;
+ }
if (!drop || drop_tool->getCargoIndex() + 1 == drop_tool->getCargoCount())
{
drop_cb = NULL;
}
- return accept;
+ return accept;
}
LLViewerInventoryCategory* LLFolderBridge::getCategory() const
{
- LLViewerInventoryCategory* cat = NULL;
- LLInventoryModel* model = getInventoryModel();
- if(model)
- {
- cat = (LLViewerInventoryCategory*)model->getCategory(mUUID);
- }
- return cat;
+ LLViewerInventoryCategory* cat = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ cat = (LLViewerInventoryCategory*)model->getCategory(mUUID);
+ }
+ return cat;
}
// static
void LLFolderBridge::pasteClipboard(void* user_data)
{
- LLFolderBridge* self = (LLFolderBridge*)user_data;
- if(self) self->pasteFromClipboard();
+ LLFolderBridge* self = (LLFolderBridge*)user_data;
+ if(self) self->pasteFromClipboard();
}
void LLFolderBridge::createNewShirt(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHIRT);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHIRT);
}
void LLFolderBridge::createNewPants(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_PANTS);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_PANTS);
}
void LLFolderBridge::createNewShoes(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHOES);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHOES);
}
void LLFolderBridge::createNewSocks(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SOCKS);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SOCKS);
}
void LLFolderBridge::createNewJacket(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_JACKET);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_JACKET);
}
void LLFolderBridge::createNewSkirt(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIRT);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIRT);
}
void LLFolderBridge::createNewGloves(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_GLOVES);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_GLOVES);
}
void LLFolderBridge::createNewUndershirt(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERSHIRT);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERSHIRT);
}
void LLFolderBridge::createNewUnderpants(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERPANTS);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERPANTS);
}
void LLFolderBridge::createNewShape(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHAPE);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHAPE);
}
void LLFolderBridge::createNewSkin(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIN);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIN);
}
void LLFolderBridge::createNewHair(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_HAIR);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_HAIR);
}
void LLFolderBridge::createNewEyes(void* user_data)
{
- LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_EYES);
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_EYES);
}
EInventorySortGroup LLFolderBridge::getSortGroup() const
{
- LLFolderType::EType preferred_type = getPreferredType();
+ LLFolderType::EType preferred_type = getPreferredType();
- if (preferred_type == LLFolderType::FT_TRASH)
- {
- return SG_TRASH_FOLDER;
- }
+ if (preferred_type == LLFolderType::FT_TRASH)
+ {
+ return SG_TRASH_FOLDER;
+ }
- if(LLFolderType::lookupIsProtectedType(preferred_type))
- {
- return SG_SYSTEM_FOLDER;
- }
+ if(LLFolderType::lookupIsProtectedType(preferred_type))
+ {
+ return SG_SYSTEM_FOLDER;
+ }
- return SG_NORMAL_FOLDER;
+ return SG_NORMAL_FOLDER;
}
// static
void LLFolderBridge::createWearable(LLFolderBridge* bridge, LLWearableType::EType type)
{
- if(!bridge) return;
- LLUUID parent_id = bridge->getUUID();
- LLAgentWearables::createWearable(type, false, parent_id);
+ if(!bridge) return;
+ LLUUID parent_id = bridge->getUUID();
+ LLAgentWearables::createWearable(type, false, parent_id);
}
void LLFolderBridge::modifyOutfit(BOOL append)
{
- LLInventoryModel* model = getInventoryModel();
- if(!model) return;
- LLViewerInventoryCategory* cat = getCategory();
- if(!cat) return;
-
- // checking amount of items to wear
- U32 max_items = gSavedSettings.getU32("WearFolderLimit");
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
- gInventory.collectDescendentsIf(cat->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- not_worn);
-
- if (items.size() > max_items)
- {
- LLSD args;
- args["AMOUNT"] = llformat("%d", max_items);
- LLNotificationsUtil::add("TooManyWearables", args);
- return;
- }
-
- if (isAgentInventory())
- {
- LLAppearanceMgr::instance().wearInventoryCategory(cat, FALSE, append);
- }
- else
- {
- // Library, we need to copy content first
- LLAppearanceMgr::instance().wearInventoryCategory(cat, TRUE, append);
- }
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ LLViewerInventoryCategory* cat = getCategory();
+ if(!cat) return;
+
+ // checking amount of items to wear
+ U32 max_items = gSavedSettings.getU32("WearFolderLimit");
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
+ gInventory.collectDescendentsIf(cat->getUUID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ not_worn);
+
+ if (items.size() > max_items)
+ {
+ LLSD args;
+ args["AMOUNT"] = llformat("%d", max_items);
+ LLNotificationsUtil::add("TooManyWearables", args);
+ return;
+ }
+
+ if (isAgentInventory())
+ {
+ LLAppearanceMgr::instance().wearInventoryCategory(cat, FALSE, append);
+ }
+ else
+ {
+ // Library, we need to copy content first
+ LLAppearanceMgr::instance().wearInventoryCategory(cat, TRUE, append);
+ }
}
@@ -4915,17 +4915,17 @@ LLFolderBridge(inventory, root, uuid)
LLUIImagePtr LLMarketplaceFolderBridge::getIcon() const
{
- return getMarketplaceFolderIcon(FALSE);
+ return getMarketplaceFolderIcon(FALSE);
}
LLUIImagePtr LLMarketplaceFolderBridge::getIconOpen() const
{
- return getMarketplaceFolderIcon(TRUE);
+ return getMarketplaceFolderIcon(TRUE);
}
LLUIImagePtr LLMarketplaceFolderBridge::getMarketplaceFolderIcon(BOOL is_open) const
{
- LLFolderType::EType preferred_type = getPreferredType();
+ LLFolderType::EType preferred_type = getPreferredType();
if (!LLMarketplaceData::instance().isUpdating(getUUID()))
{
// Skip computation (expensive) if we're waiting for updates. Use the old value in that case.
@@ -4936,18 +4936,18 @@ LLUIImagePtr LLMarketplaceFolderBridge::getMarketplaceFolderIcon(BOOL is_open) c
// We override the type when in the marketplace listings folder and only for version folder
preferred_type = LLFolderType::FT_MARKETPLACE_VERSION;
}
- return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, is_open));
+ return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, is_open));
}
std::string LLMarketplaceFolderBridge::getLabelSuffix() const
{
static LLCachedControl<F32> folder_loading_message_delay(gSavedSettings, "FolderLoadingMessageWaitTime", 0.5f);
-
+
if (mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= folder_loading_message_delay())
{
return llformat(" ( %s ) ", LLTrans::getString("LoadingData").c_str());
}
-
+
std::string suffix = "";
// Listing folder case
if (LLMarketplaceData::instance().isListed(getUUID()))
@@ -5017,42 +5017,42 @@ LLFontGL::StyleFlags LLMarketplaceFolderBridge::getLabelStyle() const
// helper stuff
bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, std::shared_ptr<LLMoveInv> move_inv)
{
- LLFloaterOpenObject::LLCatAndWear* cat_and_wear = (LLFloaterOpenObject::LLCatAndWear* )move_inv->mUserData;
- LLViewerObject* object = gObjectList.findObject(move_inv->mObjectID);
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- if(option == 0 && object)
- {
- if (cat_and_wear && cat_and_wear->mWear) // && !cat_and_wear->mFolderResponded)
- {
- LLInventoryObject::object_list_t inventory_objects;
- object->getInventoryContents(inventory_objects);
- int contents_count = inventory_objects.size();
- LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count, cat_and_wear->mFolderResponded,
- cat_and_wear->mReplace);
-
- gInventory.addObserver(inventoryObserver);
- }
-
- two_uuids_list_t::iterator move_it;
- for (move_it = move_inv->mMoveList.begin();
- move_it != move_inv->mMoveList.end();
- ++move_it)
- {
- object->moveInventory(move_it->first, move_it->second);
- }
-
- // update the UI.
- dialog_refresh_all();
- }
-
- if (move_inv->mCallback)
- {
- move_inv->mCallback(option, move_inv->mUserData, move_inv.get());
- }
-
- move_inv.reset(); //since notification will persist
- return false;
+ LLFloaterOpenObject::LLCatAndWear* cat_and_wear = (LLFloaterOpenObject::LLCatAndWear* )move_inv->mUserData;
+ LLViewerObject* object = gObjectList.findObject(move_inv->mObjectID);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ if(option == 0 && object)
+ {
+ if (cat_and_wear && cat_and_wear->mWear) // && !cat_and_wear->mFolderResponded)
+ {
+ LLInventoryObject::object_list_t inventory_objects;
+ object->getInventoryContents(inventory_objects);
+ int contents_count = inventory_objects.size();
+ LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count, cat_and_wear->mFolderResponded,
+ cat_and_wear->mReplace);
+
+ gInventory.addObserver(inventoryObserver);
+ }
+
+ two_uuids_list_t::iterator move_it;
+ for (move_it = move_inv->mMoveList.begin();
+ move_it != move_inv->mMoveList.end();
+ ++move_it)
+ {
+ object->moveInventory(move_it->first, move_it->second);
+ }
+
+ // update the UI.
+ dialog_refresh_all();
+ }
+
+ if (move_inv->mCallback)
+ {
+ move_inv->mCallback(option, move_inv->mUserData, move_inv.get());
+ }
+
+ move_inv.reset(); //since notification will persist
+ return false;
}
void drop_to_favorites_cb(const LLUUID& id, LLPointer<LLInventoryCallback> cb1, LLPointer<LLInventoryCallback> cb2)
@@ -5063,16 +5063,16 @@ void drop_to_favorites_cb(const LLUUID& id, LLPointer<LLInventoryCallback> cb1,
void LLFolderBridge::dropToFavorites(LLInventoryItem* inv_item, LLPointer<LLInventoryCallback> cb)
{
- // use callback to rearrange favorite landmarks after adding
- // to have new one placed before target (on which it was dropped). See EXT-4312.
- LLPointer<AddFavoriteLandmarkCallback> cb_fav = new AddFavoriteLandmarkCallback();
- LLInventoryPanel* panel = mInventoryPanel.get();
- LLFolderViewItem* drag_over_item = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
- LLFolderViewModelItemInventory* view_model = drag_over_item ? static_cast<LLFolderViewModelItemInventory*>(drag_over_item->getViewModelItem()) : NULL;
- if (view_model)
- {
- cb_fav.get()->setTargetLandmarkId(view_model->getUUID());
- }
+ // use callback to rearrange favorite landmarks after adding
+ // to have new one placed before target (on which it was dropped). See EXT-4312.
+ LLPointer<AddFavoriteLandmarkCallback> cb_fav = new AddFavoriteLandmarkCallback();
+ LLInventoryPanel* panel = mInventoryPanel.get();
+ LLFolderViewItem* drag_over_item = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
+ LLFolderViewModelItemInventory* view_model = drag_over_item ? static_cast<LLFolderViewModelItemInventory*>(drag_over_item->getViewModelItem()) : NULL;
+ if (view_model)
+ {
+ cb_fav.get()->setTargetLandmarkId(view_model->getUUID());
+ }
LLPointer <LLInventoryCallback> callback = cb_fav;
if (cb)
@@ -5080,38 +5080,38 @@ void LLFolderBridge::dropToFavorites(LLInventoryItem* inv_item, LLPointer<LLInve
callback = new LLBoostFuncInventoryCallback(boost::bind(drop_to_favorites_cb, _1, cb, cb_fav));
}
- copy_inventory_item(
- gAgent.getID(),
- inv_item->getPermissions().getOwner(),
- inv_item->getUUID(),
- mUUID,
- std::string(),
+ copy_inventory_item(
+ gAgent.getID(),
+ inv_item->getPermissions().getOwner(),
+ inv_item->getUUID(),
+ mUUID,
+ std::string(),
callback);
}
void LLFolderBridge::dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit, LLPointer<LLInventoryCallback> cb)
{
- if((inv_item->getInventoryType() == LLInventoryType::IT_TEXTURE) || (inv_item->getInventoryType() == LLInventoryType::IT_SNAPSHOT))
- {
- const LLUUID &my_outifts_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
- if(mUUID != my_outifts_id)
- {
+ if((inv_item->getInventoryType() == LLInventoryType::IT_TEXTURE) || (inv_item->getInventoryType() == LLInventoryType::IT_SNAPSHOT))
+ {
+ const LLUUID &my_outifts_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+ if(mUUID != my_outifts_id)
+ {
// Legacy: prior to thumbnails images in outfits were used for outfit gallery.
LLNotificationsUtil::add("ThumbnailOutfitPhoto");
- }
- return;
- }
-
- // BAP - should skip if dup.
- if (move_is_into_current_outfit)
- {
- LLAppearanceMgr::instance().wearItemOnAvatar(inv_item->getUUID(), true, true);
- }
- else
- {
- LLPointer<LLInventoryCallback> cb = NULL;
- link_inventory_object(mUUID, LLConstPointer<LLInventoryObject>(inv_item), cb);
- }
+ }
+ return;
+ }
+
+ // BAP - should skip if dup.
+ if (move_is_into_current_outfit)
+ {
+ LLAppearanceMgr::instance().wearItemOnAvatar(inv_item->getUUID(), true, true);
+ }
+ else
+ {
+ LLPointer<LLInventoryCallback> cb = NULL;
+ link_inventory_object(mUUID, LLConstPointer<LLInventoryObject>(inv_item), cb);
+ }
}
void LLFolderBridge::dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointer<LLInventoryCallback> cb)
@@ -5182,7 +5182,7 @@ void LLFolderBridge::callback_dropCategoryIntoFolder(const LLSD& notification, c
if (option == 0) // YES
{
std::string tooltip_msg;
- dragCategoryIntoFolder(inv_category, TRUE, tooltip_msg, FALSE, FALSE);
+ dragCategoryIntoFolder(inv_category, TRUE, tooltip_msg, FALSE, FALSE);
}
}
@@ -5190,116 +5190,116 @@ void LLFolderBridge::callback_dropCategoryIntoFolder(const LLSD& notification, c
// into the folder, as well as performing the actual drop, depending
// if drop == TRUE.
BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
- BOOL drop,
- std::string& tooltip_msg,
+ BOOL drop,
+ std::string& tooltip_msg,
BOOL user_confirm,
LLPointer<LLInventoryCallback> cb)
{
- LLInventoryModel* model = getInventoryModel();
+ LLInventoryModel* model = getInventoryModel();
- if (!model || !inv_item) return FALSE;
- if (!isAgentInventory()) return FALSE; // cannot drag into library
- if (!isAgentAvatarValid()) return FALSE;
+ if (!model || !inv_item) return FALSE;
+ if (!isAgentInventory()) return FALSE; // cannot drag into library
+ if (!isAgentAvatarValid()) return FALSE;
- LLInventoryPanel* destination_panel = mInventoryPanel.get();
- if (!destination_panel) return false;
+ LLInventoryPanel* destination_panel = mInventoryPanel.get();
+ if (!destination_panel) return false;
- LLInventoryFilter* filter = getInventoryFilter();
- if (!filter) return false;
+ LLInventoryFilter* filter = getInventoryFilter();
+ if (!filter) return false;
- const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
- const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
- const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
- const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+ const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
+ const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
const LLUUID from_folder_uuid = inv_item->getParentUUID();
- const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
- const BOOL move_is_into_favorites = (mUUID == favorites_id);
- const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id);
- const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
- const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
+ const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+ const BOOL move_is_into_favorites = (mUUID == favorites_id);
+ const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id);
+ const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+ const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id);
const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id);
- LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
- BOOL accept = FALSE;
- U64 filter_types = filter->getFilterTypes();
- // We shouldn't allow to drop non recent items into recent tab (or some similar transactions)
- // while we are allowing to interact with regular filtered inventory
- BOOL use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0);
- LLViewerObject* object = NULL;
- if(LLToolDragAndDrop::SOURCE_AGENT == source)
- {
- const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
-
- const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
- const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
-
- //--------------------------------------------------------------------------------
- // Determine if item can be moved.
- //
-
- BOOL is_movable = TRUE;
-
- switch (inv_item->getActualType())
- {
- case LLAssetType::AT_CATEGORY:
- is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
- break;
- default:
- break;
- }
- // Can't explicitly drag things out of the COF.
- if (move_is_outof_current_outfit)
- {
- is_movable = FALSE;
- }
- if (move_is_into_trash)
- {
- is_movable &= inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID());
- }
- if (is_movable)
- {
- // Don't allow creating duplicates in the Calling Card/Friends
- // subfolders, see bug EXT-1599. Check is item direct descendent
- // of target folder and forbid item's movement if it so.
- // Note: isItemDirectDescendentOfCategory checks if
- // passed category is in the Calling Card/Friends folder
- is_movable &= !LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(inv_item, getCategory());
- }
-
- //
- //--------------------------------------------------------------------------------
-
- //--------------------------------------------------------------------------------
- // Determine if item can be moved & dropped
- // Note: if user_confirm is false, we already went through those accept logic test and can skip them
-
- accept = TRUE;
-
- if (user_confirm && !is_movable)
- {
- accept = FALSE;
- }
- else if (user_confirm && (mUUID == inv_item->getParentUUID()) && !move_is_into_favorites)
- {
- accept = FALSE;
- }
- else if (user_confirm && (move_is_into_current_outfit || move_is_into_outfit))
- {
- accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
- }
- else if (user_confirm && (move_is_into_favorites || move_is_into_landmarks))
- {
- accept = can_move_to_landmarks(inv_item);
- }
- else if (user_confirm && move_is_into_marketplacelistings)
- {
+ LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
+ BOOL accept = FALSE;
+ U64 filter_types = filter->getFilterTypes();
+ // We shouldn't allow to drop non recent items into recent tab (or some similar transactions)
+ // while we are allowing to interact with regular filtered inventory
+ BOOL use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0);
+ LLViewerObject* object = NULL;
+ if(LLToolDragAndDrop::SOURCE_AGENT == source)
+ {
+ const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+
+ const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
+ const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
+
+ //--------------------------------------------------------------------------------
+ // Determine if item can be moved.
+ //
+
+ BOOL is_movable = TRUE;
+
+ switch (inv_item->getActualType())
+ {
+ case LLAssetType::AT_CATEGORY:
+ is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
+ break;
+ default:
+ break;
+ }
+ // Can't explicitly drag things out of the COF.
+ if (move_is_outof_current_outfit)
+ {
+ is_movable = FALSE;
+ }
+ if (move_is_into_trash)
+ {
+ is_movable &= inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID());
+ }
+ if (is_movable)
+ {
+ // Don't allow creating duplicates in the Calling Card/Friends
+ // subfolders, see bug EXT-1599. Check is item direct descendent
+ // of target folder and forbid item's movement if it so.
+ // Note: isItemDirectDescendentOfCategory checks if
+ // passed category is in the Calling Card/Friends folder
+ is_movable &= !LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(inv_item, getCategory());
+ }
+
+ //
+ //--------------------------------------------------------------------------------
+
+ //--------------------------------------------------------------------------------
+ // Determine if item can be moved & dropped
+ // Note: if user_confirm is false, we already went through those accept logic test and can skip them
+
+ accept = TRUE;
+
+ if (user_confirm && !is_movable)
+ {
+ accept = FALSE;
+ }
+ else if (user_confirm && (mUUID == inv_item->getParentUUID()) && !move_is_into_favorites)
+ {
+ accept = FALSE;
+ }
+ else if (user_confirm && (move_is_into_current_outfit || move_is_into_outfit))
+ {
+ accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
+ }
+ else if (user_confirm && (move_is_into_favorites || move_is_into_landmarks))
+ {
+ accept = can_move_to_landmarks(inv_item);
+ }
+ else if (user_confirm && move_is_into_marketplacelistings)
+ {
const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, mUUID);
LLViewerInventoryCategory * dest_folder = getCategory();
accept = can_move_item_to_marketplace(master_folder, dest_folder, inv_item, tooltip_msg, LLToolDragAndDrop::instance().getCargoCount() - LLToolDragAndDrop::instance().getCargoIndex());
- }
+ }
// Check that the folder can accept this item based on folder/item type compatibility (e.g. stock folder compatibility)
if (user_confirm && accept)
@@ -5307,31 +5307,31 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
LLViewerInventoryCategory * dest_folder = getCategory();
accept = dest_folder->acceptItem(inv_item);
}
-
- LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
-
- // Check whether the item being dragged from active inventory panel
- // passes the filter of the destination panel.
- if (user_confirm && accept && active_panel && use_filter)
- {
- LLFolderViewItem* fv_item = active_panel->getItemByID(inv_item->getUUID());
- if (!fv_item) return false;
-
- accept = filter->check(fv_item->getViewModelItem());
- }
-
- if (accept && drop)
- {
- if (inv_item->getType() == LLAssetType::AT_GESTURE
- && LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
- {
- LLGestureMgr::instance().deactivateGesture(inv_item->getUUID());
- }
- // If an item is being dragged between windows, unselect everything in the active window
- // so that we don't follow the selection to its new location (which is very annoying).
+
+ LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+
+ // Check whether the item being dragged from active inventory panel
+ // passes the filter of the destination panel.
+ if (user_confirm && accept && active_panel && use_filter)
+ {
+ LLFolderViewItem* fv_item = active_panel->getItemByID(inv_item->getUUID());
+ if (!fv_item) return false;
+
+ accept = filter->check(fv_item->getViewModelItem());
+ }
+
+ if (accept && drop)
+ {
+ if (inv_item->getType() == LLAssetType::AT_GESTURE
+ && LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
+ {
+ LLGestureMgr::instance().deactivateGesture(inv_item->getUUID());
+ }
+ // If an item is being dragged between windows, unselect everything in the active window
+ // so that we don't follow the selection to its new location (which is very annoying).
// RN: a better solution would be to deselect automatically when an item is moved
- // and then select any item that is dropped only in the panel that it is dropped in
- if (active_panel && (destination_panel != active_panel))
+ // and then select any item that is dropped only in the panel that it is dropped in
+ if (active_panel && (destination_panel != active_panel))
{
active_panel->unSelectAll();
}
@@ -5352,35 +5352,35 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
}
}
- //--------------------------------------------------------------------------------
- // Destination folder logic
- //
+ //--------------------------------------------------------------------------------
+ // Destination folder logic
+ //
- // REORDER
- // (only reorder the item in Favorites folder)
- if ((mUUID == inv_item->getParentUUID()) && move_is_into_favorites)
- {
- LLFolderViewItem* itemp = destination_panel->getRootFolder()->getDraggingOverItem();
- if (itemp)
- {
+ // REORDER
+ // (only reorder the item in Favorites folder)
+ if ((mUUID == inv_item->getParentUUID()) && move_is_into_favorites)
+ {
+ LLFolderViewItem* itemp = destination_panel->getRootFolder()->getDraggingOverItem();
+ if (itemp)
+ {
LLUUID srcItemId = inv_item->getUUID();
- LLUUID destItemId = static_cast<LLFolderViewModelItemInventory*>(itemp->getViewModelItem())->getUUID();
- LLFavoritesOrderStorage::instance().rearrangeFavoriteLandmarks(srcItemId, destItemId);
- }
- }
-
- // FAVORITES folder
- // (copy the item)
- else if (move_is_into_favorites)
- {
- dropToFavorites(inv_item, cb);
- }
- // CURRENT OUTFIT or OUTFIT folder
- // (link the item)
- else if (move_is_into_current_outfit || move_is_into_outfit)
- {
- dropToOutfit(inv_item, move_is_into_current_outfit, cb);
- }
+ LLUUID destItemId = static_cast<LLFolderViewModelItemInventory*>(itemp->getViewModelItem())->getUUID();
+ LLFavoritesOrderStorage::instance().rearrangeFavoriteLandmarks(srcItemId, destItemId);
+ }
+ }
+
+ // FAVORITES folder
+ // (copy the item)
+ else if (move_is_into_favorites)
+ {
+ dropToFavorites(inv_item, cb);
+ }
+ // CURRENT OUTFIT or OUTFIT folder
+ // (link the item)
+ else if (move_is_into_current_outfit || move_is_into_outfit)
+ {
+ dropToOutfit(inv_item, move_is_into_current_outfit, cb);
+ }
// MARKETPLACE LISTINGS folder
// Move the item
else if (move_is_into_marketplacelistings)
@@ -5388,24 +5388,24 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
move_item_to_marketplacelistings(inv_item, mUUID);
if (cb) cb->fire(inv_item->getUUID());
}
- // NORMAL or TRASH folder
- // (move the item, restamp if into trash)
- else
- {
- // set up observer to select item once drag and drop from inbox is complete
- if (gInventory.isObjectDescendentOf(inv_item->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX)))
- {
- set_dad_inbox_object(inv_item->getUUID());
- }
-
- LLInvFVBridge::changeItemParent(
- model,
- (LLViewerInventoryItem*)inv_item,
- mUUID,
- move_is_into_trash);
+ // NORMAL or TRASH folder
+ // (move the item, restamp if into trash)
+ else
+ {
+ // set up observer to select item once drag and drop from inbox is complete
+ if (gInventory.isObjectDescendentOf(inv_item->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX)))
+ {
+ set_dad_inbox_object(inv_item->getUUID());
+ }
+
+ LLInvFVBridge::changeItemParent(
+ model,
+ (LLViewerInventoryItem*)inv_item,
+ mUUID,
+ move_is_into_trash);
if (cb) cb->fire(inv_item->getUUID());
- }
-
+ }
+
if (move_is_from_marketplacelistings)
{
// If we move from an active (listed) listing, checks that it's still valid, if not, unlist
@@ -5424,260 +5424,260 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
}
}
- //
- //--------------------------------------------------------------------------------
- }
- }
- else if (LLToolDragAndDrop::SOURCE_WORLD == source)
- {
- // Make sure the object exists. If we allowed dragging from
- // anonymous objects, it would be possible to bypass
- // permissions.
- object = gObjectList.findObject(inv_item->getParentUUID());
- if (!object)
- {
- LL_INFOS() << "Object not found for drop." << LL_ENDL;
- return FALSE;
- }
-
- // coming from a task. Need to figure out if the person can
- // move/copy this item.
- LLPermissions perm(inv_item->getPermissions());
- BOOL is_move = FALSE;
- if ((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
- && perm.allowTransferTo(gAgent.getID())))
- // || gAgent.isGodlike())
- {
- accept = TRUE;
- }
- else if(object->permYouOwner())
- {
- // If the object cannot be copied, but the object the
- // inventory is owned by the agent, then the item can be
- // moved from the task to agent inventory.
- is_move = TRUE;
- accept = TRUE;
- }
-
- // Don't allow placing an original item into Current Outfit or an outfit folder
- // because they must contain only links to wearable items.
- // *TODO: Probably we should create a link to an item if it was dragged to outfit or COF.
- if (move_is_into_current_outfit || move_is_into_outfit)
- {
- accept = FALSE;
- }
- // Don't allow to move a single item to Favorites or Landmarks
- // if it is not a landmark or a link to a landmark.
- else if ((move_is_into_favorites || move_is_into_landmarks)
- && !can_move_to_landmarks(inv_item))
- {
- accept = FALSE;
- }
- else if (move_is_into_marketplacelistings)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
- accept = FALSE;
- }
-
- // Check whether the item being dragged from in world
- // passes the filter of the destination panel.
- if (accept && use_filter)
- {
- accept = filter->check(inv_item);
- }
-
- if (accept && drop)
- {
+ //
+ //--------------------------------------------------------------------------------
+ }
+ }
+ else if (LLToolDragAndDrop::SOURCE_WORLD == source)
+ {
+ // Make sure the object exists. If we allowed dragging from
+ // anonymous objects, it would be possible to bypass
+ // permissions.
+ object = gObjectList.findObject(inv_item->getParentUUID());
+ if (!object)
+ {
+ LL_INFOS() << "Object not found for drop." << LL_ENDL;
+ return FALSE;
+ }
+
+ // coming from a task. Need to figure out if the person can
+ // move/copy this item.
+ LLPermissions perm(inv_item->getPermissions());
+ BOOL is_move = FALSE;
+ if ((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
+ && perm.allowTransferTo(gAgent.getID())))
+ // || gAgent.isGodlike())
+ {
+ accept = TRUE;
+ }
+ else if(object->permYouOwner())
+ {
+ // If the object cannot be copied, but the object the
+ // inventory is owned by the agent, then the item can be
+ // moved from the task to agent inventory.
+ is_move = TRUE;
+ accept = TRUE;
+ }
+
+ // Don't allow placing an original item into Current Outfit or an outfit folder
+ // because they must contain only links to wearable items.
+ // *TODO: Probably we should create a link to an item if it was dragged to outfit or COF.
+ if (move_is_into_current_outfit || move_is_into_outfit)
+ {
+ accept = FALSE;
+ }
+ // Don't allow to move a single item to Favorites or Landmarks
+ // if it is not a landmark or a link to a landmark.
+ else if ((move_is_into_favorites || move_is_into_landmarks)
+ && !can_move_to_landmarks(inv_item))
+ {
+ accept = FALSE;
+ }
+ else if (move_is_into_marketplacelistings)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+ accept = FALSE;
+ }
+
+ // Check whether the item being dragged from in world
+ // passes the filter of the destination panel.
+ if (accept && use_filter)
+ {
+ accept = filter->check(inv_item);
+ }
+
+ if (accept && drop)
+ {
LLUUID item_id = inv_item->getUUID();
std::shared_ptr<LLMoveInv> move_inv (new LLMoveInv());
- move_inv->mObjectID = inv_item->getParentUUID();
- two_uuids_t item_pair(mUUID, item_id);
- move_inv->mMoveList.push_back(item_pair);
+ move_inv->mObjectID = inv_item->getParentUUID();
+ two_uuids_t item_pair(mUUID, item_id);
+ move_inv->mMoveList.push_back(item_pair);
if (cb)
{
move_inv->mCallback = [item_id, cb](S32, void*, const LLMoveInv* move_inv) mutable
{ cb->fire(item_id); };
}
- move_inv->mUserData = NULL;
- if(is_move)
- {
- warn_move_inventory(object, move_inv);
- }
- else
- {
- // store dad inventory item to select added one later. See EXT-4347
- set_dad_inventory_item(inv_item, mUUID);
-
- LLNotification::Params params("MoveInventoryFromObject");
- params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv));
- LLNotifications::instance().forceResponse(params, 0);
- }
- }
- }
- else if(LLToolDragAndDrop::SOURCE_NOTECARD == source)
- {
- if (move_is_into_marketplacelistings)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
- accept = FALSE;
- }
- else if ((inv_item->getActualType() == LLAssetType::AT_SETTINGS) && !LLEnvironment::instance().isInventoryEnabled())
- {
- tooltip_msg = LLTrans::getString("NoEnvironmentSettings");
- accept = FALSE;
- }
- else
- {
- // Don't allow placing an original item from a notecard to Current Outfit or an outfit folder
- // because they must contain only links to wearable items.
- accept = !(move_is_into_current_outfit || move_is_into_outfit);
- }
-
- // Check whether the item being dragged from notecard
- // passes the filter of the destination panel.
- if (accept && use_filter)
- {
- accept = filter->check(inv_item);
- }
-
- if (accept && drop)
- {
- copy_inventory_from_notecard(mUUID, // Drop to the chosen destination folder
- LLToolDragAndDrop::getInstance()->getObjectID(),
- LLToolDragAndDrop::getInstance()->getSourceID(),
- inv_item);
- }
- }
- else if(LLToolDragAndDrop::SOURCE_LIBRARY == source)
- {
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item;
- if(item && item->isFinished())
- {
- accept = TRUE;
-
- if (move_is_into_marketplacelistings)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
- accept = FALSE;
- }
- else if (move_is_into_current_outfit || move_is_into_outfit)
- {
- accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
- }
- // Don't allow to move a single item to Favorites or Landmarks
- // if it is not a landmark or a link to a landmark.
- else if (move_is_into_favorites || move_is_into_landmarks)
- {
- accept = can_move_to_landmarks(inv_item);
- }
-
- LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
-
- // Check whether the item being dragged from the library
- // passes the filter of the destination panel.
- if (accept && active_panel && use_filter)
- {
- LLFolderViewItem* fv_item = active_panel->getItemByID(inv_item->getUUID());
- if (!fv_item) return false;
-
- accept = filter->check(fv_item->getViewModelItem());
- }
-
- if (accept && drop)
- {
- // FAVORITES folder
- // (copy the item)
- if (move_is_into_favorites)
- {
- dropToFavorites(inv_item, cb);
- }
- // CURRENT OUTFIT or OUTFIT folder
- // (link the item)
- else if (move_is_into_current_outfit || move_is_into_outfit)
- {
- dropToOutfit(inv_item, move_is_into_current_outfit, cb);
- }
- else
- {
- copy_inventory_item(
- gAgent.getID(),
- inv_item->getPermissions().getOwner(),
- inv_item->getUUID(),
- mUUID,
- std::string(),
- cb);
- }
- }
- }
- }
- else
- {
- LL_WARNS() << "unhandled drag source" << LL_ENDL;
- }
- return accept;
+ move_inv->mUserData = NULL;
+ if(is_move)
+ {
+ warn_move_inventory(object, move_inv);
+ }
+ else
+ {
+ // store dad inventory item to select added one later. See EXT-4347
+ set_dad_inventory_item(inv_item, mUUID);
+
+ LLNotification::Params params("MoveInventoryFromObject");
+ params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv));
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ }
+ }
+ else if(LLToolDragAndDrop::SOURCE_NOTECARD == source)
+ {
+ if (move_is_into_marketplacelistings)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+ accept = FALSE;
+ }
+ else if ((inv_item->getActualType() == LLAssetType::AT_SETTINGS) && !LLEnvironment::instance().isInventoryEnabled())
+ {
+ tooltip_msg = LLTrans::getString("NoEnvironmentSettings");
+ accept = FALSE;
+ }
+ else
+ {
+ // Don't allow placing an original item from a notecard to Current Outfit or an outfit folder
+ // because they must contain only links to wearable items.
+ accept = !(move_is_into_current_outfit || move_is_into_outfit);
+ }
+
+ // Check whether the item being dragged from notecard
+ // passes the filter of the destination panel.
+ if (accept && use_filter)
+ {
+ accept = filter->check(inv_item);
+ }
+
+ if (accept && drop)
+ {
+ copy_inventory_from_notecard(mUUID, // Drop to the chosen destination folder
+ LLToolDragAndDrop::getInstance()->getObjectID(),
+ LLToolDragAndDrop::getInstance()->getSourceID(),
+ inv_item);
+ }
+ }
+ else if(LLToolDragAndDrop::SOURCE_LIBRARY == source)
+ {
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item;
+ if(item && item->isFinished())
+ {
+ accept = TRUE;
+
+ if (move_is_into_marketplacelistings)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+ accept = FALSE;
+ }
+ else if (move_is_into_current_outfit || move_is_into_outfit)
+ {
+ accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
+ }
+ // Don't allow to move a single item to Favorites or Landmarks
+ // if it is not a landmark or a link to a landmark.
+ else if (move_is_into_favorites || move_is_into_landmarks)
+ {
+ accept = can_move_to_landmarks(inv_item);
+ }
+
+ LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+
+ // Check whether the item being dragged from the library
+ // passes the filter of the destination panel.
+ if (accept && active_panel && use_filter)
+ {
+ LLFolderViewItem* fv_item = active_panel->getItemByID(inv_item->getUUID());
+ if (!fv_item) return false;
+
+ accept = filter->check(fv_item->getViewModelItem());
+ }
+
+ if (accept && drop)
+ {
+ // FAVORITES folder
+ // (copy the item)
+ if (move_is_into_favorites)
+ {
+ dropToFavorites(inv_item, cb);
+ }
+ // CURRENT OUTFIT or OUTFIT folder
+ // (link the item)
+ else if (move_is_into_current_outfit || move_is_into_outfit)
+ {
+ dropToOutfit(inv_item, move_is_into_current_outfit, cb);
+ }
+ else
+ {
+ copy_inventory_item(
+ gAgent.getID(),
+ inv_item->getPermissions().getOwner(),
+ inv_item->getUUID(),
+ mUUID,
+ std::string(),
+ cb);
+ }
+ }
+ }
+ }
+ else
+ {
+ LL_WARNS() << "unhandled drag source" << LL_ENDL;
+ }
+ return accept;
}
// static
bool check_category(LLInventoryModel* model,
- const LLUUID& cat_id,
- LLInventoryPanel* active_panel,
- LLInventoryFilter* filter)
-{
- if (!model || !active_panel || !filter)
- return false;
-
- if (!filter->checkFolder(cat_id))
- {
- return false;
- }
-
- LLInventoryModel::cat_array_t descendent_categories;
- LLInventoryModel::item_array_t descendent_items;
- model->collectDescendents(cat_id, descendent_categories, descendent_items, TRUE);
-
- S32 num_descendent_categories = descendent_categories.size();
- S32 num_descendent_items = descendent_items.size();
-
- if (num_descendent_categories + num_descendent_items == 0)
- {
- // Empty folder should be checked as any other folder view item.
- // If we are filtering by date the folder should not pass because
- // it doesn't have its own creation date. See LLInvFVBridge::getCreationDate().
- return check_item(cat_id, active_panel, filter);
- }
-
- for (S32 i = 0; i < num_descendent_categories; ++i)
- {
- LLInventoryCategory* category = descendent_categories[i];
- if(!check_category(model, category->getUUID(), active_panel, filter))
- {
- return false;
- }
- }
-
- for (S32 i = 0; i < num_descendent_items; ++i)
- {
- LLViewerInventoryItem* item = descendent_items[i];
- if(!check_item(item->getUUID(), active_panel, filter))
- {
- return false;
- }
- }
-
- return true;
+ const LLUUID& cat_id,
+ LLInventoryPanel* active_panel,
+ LLInventoryFilter* filter)
+{
+ if (!model || !active_panel || !filter)
+ return false;
+
+ if (!filter->checkFolder(cat_id))
+ {
+ return false;
+ }
+
+ LLInventoryModel::cat_array_t descendent_categories;
+ LLInventoryModel::item_array_t descendent_items;
+ model->collectDescendents(cat_id, descendent_categories, descendent_items, TRUE);
+
+ S32 num_descendent_categories = descendent_categories.size();
+ S32 num_descendent_items = descendent_items.size();
+
+ if (num_descendent_categories + num_descendent_items == 0)
+ {
+ // Empty folder should be checked as any other folder view item.
+ // If we are filtering by date the folder should not pass because
+ // it doesn't have its own creation date. See LLInvFVBridge::getCreationDate().
+ return check_item(cat_id, active_panel, filter);
+ }
+
+ for (S32 i = 0; i < num_descendent_categories; ++i)
+ {
+ LLInventoryCategory* category = descendent_categories[i];
+ if(!check_category(model, category->getUUID(), active_panel, filter))
+ {
+ return false;
+ }
+ }
+
+ for (S32 i = 0; i < num_descendent_items; ++i)
+ {
+ LLViewerInventoryItem* item = descendent_items[i];
+ if(!check_item(item->getUUID(), active_panel, filter))
+ {
+ return false;
+ }
+ }
+
+ return true;
}
// static
bool check_item(const LLUUID& item_id,
- LLInventoryPanel* active_panel,
- LLInventoryFilter* filter)
+ LLInventoryPanel* active_panel,
+ LLInventoryFilter* filter)
{
- if (!active_panel || !filter) return false;
+ if (!active_panel || !filter) return false;
- LLFolderViewItem* fv_item = active_panel->getItemByID(item_id);
- if (!fv_item) return false;
+ LLFolderViewItem* fv_item = active_panel->getItemByID(item_id);
+ if (!fv_item) return false;
- return filter->check(fv_item->getViewModelItem());
+ return filter->check(fv_item->getViewModelItem());
}
// +=================================================+
@@ -5686,65 +5686,65 @@ bool check_item(const LLUUID& item_id,
LLUIImagePtr LLTextureBridge::getIcon() const
{
- return LLInventoryIcon::getIcon(LLAssetType::AT_TEXTURE, mInvType);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_TEXTURE, mInvType);
}
void LLTextureBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
+ LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
- }
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
}
bool LLTextureBridge::canSaveTexture(void)
{
- const LLInventoryModel* model = getInventoryModel();
- if(!model)
- {
- return false;
- }
-
- const LLViewerInventoryItem *item = model->getItem(mUUID);
- if (item)
- {
- return item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED);
- }
- return false;
+ const LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ {
+ return false;
+ }
+
+ const LLViewerInventoryItem *item = model->getItem(mUUID);
+ if (item)
+ {
+ return item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED);
+ }
+ return false;
}
void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LL_DEBUGS() << "LLTextureBridge::buildContextMenu()" << LL_ENDL;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
+ LL_DEBUGS() << "LLTextureBridge::buildContextMenu()" << LL_ENDL;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+ if(isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
else if (isMarketplaceListingsFolder())
{
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
- items.push_back(std::string("Properties"));
- getClipboardEntries(false, items, disabled_items, flags);
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
}
- else
- {
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
+ else
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+
+ addOpenRightClickMenuOption(items);
+ items.push_back(std::string("Properties"));
- addOpenRightClickMenuOption(items);
- items.push_back(std::string("Properties"));
+ getClipboardEntries(true, items, disabled_items, flags);
- getClipboardEntries(true, items, disabled_items, flags);
+ items.push_back(std::string("Texture Separator"));
- items.push_back(std::string("Texture Separator"));
-
if ((flags & ITEM_IN_MULTI_SELECTION) != 0)
{
items.push_back(std::string("Save Selected As"));
@@ -5758,23 +5758,23 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
}
- }
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ }
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
// virtual
void LLTextureBridge::performAction(LLInventoryModel* model, std::string action)
{
- if ("save_as" == action)
- {
- LLPreviewTexture* preview_texture = LLFloaterReg::getTypedInstance<LLPreviewTexture>("preview_texture", mUUID);
- if (preview_texture)
- {
- preview_texture->openToSave();
- preview_texture->saveAs();
- }
- }
+ if ("save_as" == action)
+ {
+ LLPreviewTexture* preview_texture = LLFloaterReg::getTypedInstance<LLPreviewTexture>("preview_texture", mUUID);
+ if (preview_texture)
+ {
+ preview_texture->openToSave();
+ preview_texture->saveAs();
+ }
+ }
else if ("save_selected_as" == action)
{
openItem();
@@ -5792,7 +5792,7 @@ void LLTextureBridge::performAction(LLInventoryModel* model, std::string action)
}
}
- else LLItemBridge::performAction(model, action);
+ else LLItemBridge::performAction(model, action);
}
// +=================================================+
@@ -5801,213 +5801,213 @@ void LLTextureBridge::performAction(LLInventoryModel* model, std::string action)
void LLSoundBridge::openItem()
{
- const LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
- }
+ const LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
}
void LLSoundBridge::openSoundPreview(void* which)
{
- LLSoundBridge *me = (LLSoundBridge *)which;
- LLFloaterReg::showInstance("preview_sound", LLSD(me->mUUID), TAKE_FOCUS_YES);
+ LLSoundBridge *me = (LLSoundBridge *)which;
+ LLFloaterReg::showInstance("preview_sound", LLSD(me->mUUID), TAKE_FOCUS_YES);
}
void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LL_DEBUGS() << "LLSoundBridge::buildContextMenu()" << LL_ENDL;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
+ LL_DEBUGS() << "LLSoundBridge::buildContextMenu()" << LL_ENDL;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
if (isMarketplaceListingsFolder())
{
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
- items.push_back(std::string("Properties"));
- getClipboardEntries(false, items, disabled_items, flags);
- }
- else
- {
- if (isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
- else
- {
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
- items.push_back(std::string("Sound Open"));
- items.push_back(std::string("Properties"));
-
- getClipboardEntries(true, items, disabled_items, flags);
- }
-
- items.push_back(std::string("Sound Separator"));
- items.push_back(std::string("Sound Play"));
- }
-
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
+ }
+ else
+ {
+ if (isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
+ else
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+ items.push_back(std::string("Sound Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+ }
+
+ items.push_back(std::string("Sound Separator"));
+ items.push_back(std::string("Sound Play"));
+ }
+
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
void LLSoundBridge::performAction(LLInventoryModel* model, std::string action)
{
- if ("sound_play" == action)
- {
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- send_sound_trigger(item->getAssetUUID(), SOUND_GAIN);
- }
- }
- else if ("open" == action)
- {
- openSoundPreview((void*)this);
- }
- else LLItemBridge::performAction(model, action);
+ if ("sound_play" == action)
+ {
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ send_sound_trigger(item->getAssetUUID(), SOUND_GAIN);
+ }
+ }
+ else if ("open" == action)
+ {
+ openSoundPreview((void*)this);
+ }
+ else LLItemBridge::performAction(model, action);
}
// +=================================================+
// | LLLandmarkBridge |
// +=================================================+
-LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags/* = 0x00*/) :
- LLItemBridge(inventory, root, uuid)
+LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags/* = 0x00*/) :
+ LLItemBridge(inventory, root, uuid)
{
- mVisited = FALSE;
- if (flags & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED)
- {
- mVisited = TRUE;
- }
+ mVisited = FALSE;
+ if (flags & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED)
+ {
+ mVisited = TRUE;
+ }
}
LLUIImagePtr LLLandmarkBridge::getIcon() const
{
- return LLInventoryIcon::getIcon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE);
}
void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
- LL_DEBUGS() << "LLLandmarkBridge::buildContextMenu()" << LL_ENDL;
+ LL_DEBUGS() << "LLLandmarkBridge::buildContextMenu()" << LL_ENDL;
if (isMarketplaceListingsFolder())
{
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
- items.push_back(std::string("Properties"));
- getClipboardEntries(false, items, disabled_items, flags);
- }
- else
- {
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
- else
- {
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
- items.push_back(std::string("Landmark Open"));
- items.push_back(std::string("Properties"));
-
- getClipboardEntries(true, items, disabled_items, flags);
- }
-
- items.push_back(std::string("Landmark Separator"));
- items.push_back(std::string("url_copy"));
- items.push_back(std::string("About Landmark"));
- items.push_back(std::string("show_on_map"));
- }
-
- // Disable "About Landmark" menu item for
- // multiple landmarks selected. Only one landmark
- // info panel can be shown at a time.
- if ((flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("url_copy"));
- disabled_items.push_back(std::string("About Landmark"));
- }
-
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
+ }
+ else
+ {
+ if(isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
+ else
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+ items.push_back(std::string("Landmark Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+ }
+
+ items.push_back(std::string("Landmark Separator"));
+ items.push_back(std::string("url_copy"));
+ items.push_back(std::string("About Landmark"));
+ items.push_back(std::string("show_on_map"));
+ }
+
+ // Disable "About Landmark" menu item for
+ // multiple landmarks selected. Only one landmark
+ // info panel can be shown at a time.
+ if ((flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("url_copy"));
+ disabled_items.push_back(std::string("About Landmark"));
+ }
+
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
// Convenience function for the two functions below.
void teleport_via_landmark(const LLUUID& asset_id)
{
- gAgent.teleportViaLandmark( asset_id );
+ gAgent.teleportViaLandmark( asset_id );
- // we now automatically track the landmark you're teleporting to
- // because you'll probably arrive at a telehub instead
- LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
- if( floater_world_map )
- {
- floater_world_map->trackLandmark( asset_id );
- }
+ // we now automatically track the landmark you're teleporting to
+ // because you'll probably arrive at a telehub instead
+ LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
+ if( floater_world_map )
+ {
+ floater_world_map->trackLandmark( asset_id );
+ }
}
// virtual
void LLLandmarkBridge::performAction(LLInventoryModel* model, std::string action)
{
- if ("teleport" == action)
- {
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- teleport_via_landmark(item->getAssetUUID());
- }
- }
- else if ("about" == action)
- {
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- LLSD key;
- key["type"] = "landmark";
- key["id"] = item->getUUID();
-
- LLFloaterSidePanelContainer::showPanel("places", key);
- }
- }
- else
- {
- LLItemBridge::performAction(model, action);
- }
+ if ("teleport" == action)
+ {
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ teleport_via_landmark(item->getAssetUUID());
+ }
+ }
+ else if ("about" == action)
+ {
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ LLSD key;
+ key["type"] = "landmark";
+ key["id"] = item->getUUID();
+
+ LLFloaterSidePanelContainer::showPanel("places", key);
+ }
+ }
+ else
+ {
+ LLItemBridge::performAction(model, action);
+ }
}
static bool open_landmark_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLUUID asset_id = notification["payload"]["asset_id"].asUUID();
- if (option == 0)
- {
- teleport_via_landmark(asset_id);
- }
+ LLUUID asset_id = notification["payload"]["asset_id"].asUUID();
+ if (option == 0)
+ {
+ teleport_via_landmark(asset_id);
+ }
- return false;
+ return false;
}
static LLNotificationFunctorRegistration open_landmark_callback_reg("TeleportFromLandmark", open_landmark_callback);
void LLLandmarkBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
+ LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
- }
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
}
@@ -6017,8 +6017,8 @@ void LLLandmarkBridge::openItem()
class LLCallingCardObserver : public LLFriendObserver
{
public:
- LLCallingCardObserver(LLCallingCardBridge* bridge) : mBridgep(bridge) {}
- virtual ~LLCallingCardObserver() { mBridgep = NULL; }
+ LLCallingCardObserver(LLCallingCardBridge* bridge) : mBridgep(bridge) {}
+ virtual ~LLCallingCardObserver() { mBridgep = NULL; }
virtual void changed(U32 mask)
{
if (mask & LLFriendObserver::ONLINE)
@@ -6028,17 +6028,17 @@ public:
}
}
protected:
- LLCallingCardBridge* mBridgep;
+ LLCallingCardBridge* mBridgep;
};
// +=================================================+
// | LLCallingCardBridge |
// +=================================================+
-LLCallingCardBridge::LLCallingCardBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid ) :
- LLItemBridge(inventory, root, uuid)
+LLCallingCardBridge::LLCallingCardBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid ) :
+ LLItemBridge(inventory, root, uuid)
{
mObserver = new LLCallingCardObserver(this);
mCreatorUUID = getItem()->getCreatorUUID();
@@ -6054,128 +6054,128 @@ LLCallingCardBridge::~LLCallingCardBridge()
void LLCallingCardBridge::refreshFolderViewItem()
{
- LLInventoryPanel* panel = mInventoryPanel.get();
- LLFolderViewItem* itemp = panel ? panel->getItemByID(mUUID) : NULL;
- if (itemp)
- {
- itemp->refresh();
- }
+ LLInventoryPanel* panel = mInventoryPanel.get();
+ LLFolderViewItem* itemp = panel ? panel->getItemByID(mUUID) : NULL;
+ if (itemp)
+ {
+ itemp->refresh();
+ }
}
void LLCallingCardBridge::checkSearchBySuffixChanges()
{
- if (!mDisplayName.empty())
- {
- // changes in mDisplayName are processed by rename function and here it will be always same
- // suffixes are also of fixed length, and we are processing change of one at a time,
- // so it should be safe to use length (note: mSearchableName is capitalized)
- S32 old_length = mSearchableName.length();
- S32 new_length = mDisplayName.length() + getLabelSuffix().length();
- if (old_length == new_length)
- {
- return;
- }
- mSearchableName.assign(mDisplayName);
- mSearchableName.append(getLabelSuffix());
- LLStringUtil::toUpper(mSearchableName);
- if (new_length<old_length)
- {
- LLInventoryFilter* filter = getInventoryFilter();
- if (filter && mPassedFilter && mSearchableName.find(filter->getFilterSubString()) == std::string::npos)
- {
- // string no longer contains substring
- // we either have to update all parents manually or restart filter.
- // dirtyFilter will not work here due to obsolete descendants' generations
- getInventoryFilter()->setModified(LLFolderViewFilter::FILTER_MORE_RESTRICTIVE);
- }
- }
- else
- {
- if (getInventoryFilter())
- {
- // mSearchableName became longer, we gained additional suffix and need to repeat filter check.
- dirtyFilter();
- }
- }
- }
+ if (!mDisplayName.empty())
+ {
+ // changes in mDisplayName are processed by rename function and here it will be always same
+ // suffixes are also of fixed length, and we are processing change of one at a time,
+ // so it should be safe to use length (note: mSearchableName is capitalized)
+ S32 old_length = mSearchableName.length();
+ S32 new_length = mDisplayName.length() + getLabelSuffix().length();
+ if (old_length == new_length)
+ {
+ return;
+ }
+ mSearchableName.assign(mDisplayName);
+ mSearchableName.append(getLabelSuffix());
+ LLStringUtil::toUpper(mSearchableName);
+ if (new_length<old_length)
+ {
+ LLInventoryFilter* filter = getInventoryFilter();
+ if (filter && mPassedFilter && mSearchableName.find(filter->getFilterSubString()) == std::string::npos)
+ {
+ // string no longer contains substring
+ // we either have to update all parents manually or restart filter.
+ // dirtyFilter will not work here due to obsolete descendants' generations
+ getInventoryFilter()->setModified(LLFolderViewFilter::FILTER_MORE_RESTRICTIVE);
+ }
+ }
+ else
+ {
+ if (getInventoryFilter())
+ {
+ // mSearchableName became longer, we gained additional suffix and need to repeat filter check.
+ dirtyFilter();
+ }
+ }
+ }
}
// virtual
void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string action)
{
- if ("begin_im" == action)
- {
- LLViewerInventoryItem *item = getItem();
- if (item && (item->getCreatorUUID() != gAgent.getID()) &&
- (!item->getCreatorUUID().isNull()))
- {
- std::string callingcard_name = LLCacheName::getDefaultName();
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(item->getCreatorUUID(), &av_name))
- {
- callingcard_name = av_name.getCompleteName();
- }
- LLUUID session_id = gIMMgr->addSession(callingcard_name, IM_NOTHING_SPECIAL, item->getCreatorUUID());
- if (session_id != LLUUID::null)
- {
- LLFloaterIMContainer::getInstance()->showConversation(session_id);
- }
- }
- }
- else if ("lure" == action)
- {
- LLViewerInventoryItem *item = getItem();
- if (item && (item->getCreatorUUID() != gAgent.getID()) &&
- (!item->getCreatorUUID().isNull()))
- {
- LLAvatarActions::offerTeleport(item->getCreatorUUID());
- }
- }
- else if ("request_lure" == action)
- {
- LLViewerInventoryItem *item = getItem();
- if (item && (item->getCreatorUUID() != gAgent.getID()) &&
- (!item->getCreatorUUID().isNull()))
- {
- LLAvatarActions::teleportRequest(item->getCreatorUUID());
- }
- }
-
- else LLItemBridge::performAction(model, action);
+ if ("begin_im" == action)
+ {
+ LLViewerInventoryItem *item = getItem();
+ if (item && (item->getCreatorUUID() != gAgent.getID()) &&
+ (!item->getCreatorUUID().isNull()))
+ {
+ std::string callingcard_name = LLCacheName::getDefaultName();
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(item->getCreatorUUID(), &av_name))
+ {
+ callingcard_name = av_name.getCompleteName();
+ }
+ LLUUID session_id = gIMMgr->addSession(callingcard_name, IM_NOTHING_SPECIAL, item->getCreatorUUID());
+ if (session_id != LLUUID::null)
+ {
+ LLFloaterIMContainer::getInstance()->showConversation(session_id);
+ }
+ }
+ }
+ else if ("lure" == action)
+ {
+ LLViewerInventoryItem *item = getItem();
+ if (item && (item->getCreatorUUID() != gAgent.getID()) &&
+ (!item->getCreatorUUID().isNull()))
+ {
+ LLAvatarActions::offerTeleport(item->getCreatorUUID());
+ }
+ }
+ else if ("request_lure" == action)
+ {
+ LLViewerInventoryItem *item = getItem();
+ if (item && (item->getCreatorUUID() != gAgent.getID()) &&
+ (!item->getCreatorUUID().isNull()))
+ {
+ LLAvatarActions::teleportRequest(item->getCreatorUUID());
+ }
+ }
+
+ else LLItemBridge::performAction(model, action);
}
LLUIImagePtr LLCallingCardBridge::getIcon() const
{
- BOOL online = FALSE;
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID());
- }
- return LLInventoryIcon::getIcon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE);
+ BOOL online = FALSE;
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID());
+ }
+ return LLInventoryIcon::getIcon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE);
}
std::string LLCallingCardBridge::getLabelSuffix() const
{
- LLViewerInventoryItem* item = getItem();
- if( item && LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()) )
- {
- return LLItemBridge::getLabelSuffix() + " online";
- }
- else
- {
- return LLItemBridge::getLabelSuffix();
- }
+ LLViewerInventoryItem* item = getItem();
+ if( item && LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()) )
+ {
+ return LLItemBridge::getLabelSuffix() + " online";
+ }
+ else
+ {
+ return LLItemBridge::getLabelSuffix();
+ }
}
void LLCallingCardBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
+ LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
- }
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
/*
LLViewerInventoryItem* item = getItem();
if(item && !item->getCreatorUUID().isNull())
@@ -6187,140 +6187,140 @@ void LLCallingCardBridge::openItem()
void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LL_DEBUGS() << "LLCallingCardBridge::buildContextMenu()" << LL_ENDL;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
+ LL_DEBUGS() << "LLCallingCardBridge::buildContextMenu()" << LL_ENDL;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
+ if(isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
else if (isMarketplaceListingsFolder())
{
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
- items.push_back(std::string("Properties"));
- getClipboardEntries(false, items, disabled_items, flags);
- }
- else
- {
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
- if ((flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Open"));
- }
- addOpenRightClickMenuOption(items);
- items.push_back(std::string("Properties"));
-
- getClipboardEntries(true, items, disabled_items, flags);
-
- LLInventoryItem* item = getItem();
- BOOL good_card = (item
- && (LLUUID::null != item->getCreatorUUID())
- && (item->getCreatorUUID() != gAgent.getID()));
- BOOL user_online = FALSE;
- if (item)
- {
- user_online = (LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()));
- }
- items.push_back(std::string("Send Instant Message Separator"));
- items.push_back(std::string("Send Instant Message"));
- items.push_back(std::string("Offer Teleport..."));
- items.push_back(std::string("Request Teleport..."));
- items.push_back(std::string("Conference Chat"));
-
- if (!good_card)
- {
- disabled_items.push_back(std::string("Send Instant Message"));
- }
- if (!good_card || !user_online)
- {
- disabled_items.push_back(std::string("Offer Teleport..."));
- disabled_items.push_back(std::string("Request Teleport..."));
- disabled_items.push_back(std::string("Conference Chat"));
- }
- }
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
+ }
+ else
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+ if ((flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Open"));
+ }
+ addOpenRightClickMenuOption(items);
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ LLInventoryItem* item = getItem();
+ BOOL good_card = (item
+ && (LLUUID::null != item->getCreatorUUID())
+ && (item->getCreatorUUID() != gAgent.getID()));
+ BOOL user_online = FALSE;
+ if (item)
+ {
+ user_online = (LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()));
+ }
+ items.push_back(std::string("Send Instant Message Separator"));
+ items.push_back(std::string("Send Instant Message"));
+ items.push_back(std::string("Offer Teleport..."));
+ items.push_back(std::string("Request Teleport..."));
+ items.push_back(std::string("Conference Chat"));
+
+ if (!good_card)
+ {
+ disabled_items.push_back(std::string("Send Instant Message"));
+ }
+ if (!good_card || !user_online)
+ {
+ disabled_items.push_back(std::string("Offer Teleport..."));
+ disabled_items.push_back(std::string("Request Teleport..."));
+ disabled_items.push_back(std::string("Conference Chat"));
+ }
+ }
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg)
-{
- LLViewerInventoryItem* item = getItem();
- BOOL rv = FALSE;
- if(item)
- {
- // check the type
- switch(cargo_type)
- {
- case DAD_TEXTURE:
- case DAD_SOUND:
- case DAD_LANDMARK:
- case DAD_SCRIPT:
- case DAD_CLOTHING:
- case DAD_OBJECT:
- case DAD_NOTECARD:
- case DAD_BODYPART:
- case DAD_ANIMATION:
- case DAD_GESTURE:
- case DAD_MESH:
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg)
+{
+ LLViewerInventoryItem* item = getItem();
+ BOOL rv = FALSE;
+ if(item)
+ {
+ // check the type
+ switch(cargo_type)
+ {
+ case DAD_TEXTURE:
+ case DAD_SOUND:
+ case DAD_LANDMARK:
+ case DAD_SCRIPT:
+ case DAD_CLOTHING:
+ case DAD_OBJECT:
+ case DAD_NOTECARD:
+ case DAD_BODYPART:
+ case DAD_ANIMATION:
+ case DAD_GESTURE:
+ case DAD_MESH:
case DAD_SETTINGS:
case DAD_MATERIAL:
- {
- LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
- const LLPermissions& perm = inv_item->getPermissions();
- if(gInventory.getItem(inv_item->getUUID())
- && perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
- {
- rv = TRUE;
- if(drop)
- {
- LLGiveInventory::doGiveInventoryItem(item->getCreatorUUID(),
- (LLInventoryItem*)cargo_data);
- }
- }
- else
- {
- // It's not in the user's inventory (it's probably in
- // an object's contents), so disallow dragging it here.
- // You can't give something you don't yet have.
- rv = FALSE;
- }
- break;
- }
- case DAD_CATEGORY:
- {
- LLInventoryCategory* inv_cat = (LLInventoryCategory*)cargo_data;
- if( gInventory.getCategory( inv_cat->getUUID() ) )
- {
- rv = TRUE;
- if(drop)
- {
- LLGiveInventory::doGiveInventoryCategory(
- item->getCreatorUUID(),
- inv_cat);
- }
- }
- else
- {
- // It's not in the user's inventory (it's probably in
- // an object's contents), so disallow dragging it here.
- // You can't give something you don't yet have.
- rv = FALSE;
- }
- break;
- }
- default:
- break;
- }
- }
- return rv;
+ {
+ LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
+ const LLPermissions& perm = inv_item->getPermissions();
+ if(gInventory.getItem(inv_item->getUUID())
+ && perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+ {
+ rv = TRUE;
+ if(drop)
+ {
+ LLGiveInventory::doGiveInventoryItem(item->getCreatorUUID(),
+ (LLInventoryItem*)cargo_data);
+ }
+ }
+ else
+ {
+ // It's not in the user's inventory (it's probably in
+ // an object's contents), so disallow dragging it here.
+ // You can't give something you don't yet have.
+ rv = FALSE;
+ }
+ break;
+ }
+ case DAD_CATEGORY:
+ {
+ LLInventoryCategory* inv_cat = (LLInventoryCategory*)cargo_data;
+ if( gInventory.getCategory( inv_cat->getUUID() ) )
+ {
+ rv = TRUE;
+ if(drop)
+ {
+ LLGiveInventory::doGiveInventoryCategory(
+ item->getCreatorUUID(),
+ inv_cat);
+ }
+ }
+ else
+ {
+ // It's not in the user's inventory (it's probably in
+ // an object's contents), so disallow dragging it here.
+ // You can't give something you don't yet have.
+ rv = FALSE;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ return rv;
}
// +=================================================+
@@ -6329,28 +6329,28 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
void LLNotecardBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
- }
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
}
void LLNotecardBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LL_DEBUGS() << "LLNotecardBridge::buildContextMenu()" << LL_ENDL;
-
+ LL_DEBUGS() << "LLNotecardBridge::buildContextMenu()" << LL_ENDL;
+
if (isMarketplaceListingsFolder())
{
menuentry_vec_t items;
menuentry_vec_t disabled_items;
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
- items.push_back(std::string("Properties"));
- getClipboardEntries(false, items, disabled_items, flags);
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
hide_context_entries(menu, items, disabled_items);
}
- else
- {
+ else
+ {
LLItemBridge::buildContextMenu(menu, flags);
}
}
@@ -6361,88 +6361,88 @@ void LLNotecardBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
{
- if( LLGestureMgr::instance().isGestureActive(mUUID) )
- {
- return LLFontGL::BOLD;
- }
- else
- {
- return LLFontGL::NORMAL;
- }
+ if( LLGestureMgr::instance().isGestureActive(mUUID) )
+ {
+ return LLFontGL::BOLD;
+ }
+ else
+ {
+ return LLFontGL::NORMAL;
+ }
}
std::string LLGestureBridge::getLabelSuffix() const
{
- if( LLGestureMgr::instance().isGestureActive(mUUID) )
- {
- LLStringUtil::format_map_t args;
- args["[GESLABEL]"] = LLItemBridge::getLabelSuffix();
- return LLTrans::getString("ActiveGesture", args);
- }
- else
- {
- return LLItemBridge::getLabelSuffix();
- }
+ if( LLGestureMgr::instance().isGestureActive(mUUID) )
+ {
+ LLStringUtil::format_map_t args;
+ args["[GESLABEL]"] = LLItemBridge::getLabelSuffix();
+ return LLTrans::getString("ActiveGesture", args);
+ }
+ else
+ {
+ return LLItemBridge::getLabelSuffix();
+ }
}
// virtual
void LLGestureBridge::performAction(LLInventoryModel* model, std::string action)
{
- if (isAddAction(action))
- {
- LLGestureMgr::instance().activateGesture(mUUID);
-
- LLViewerInventoryItem* item = gInventory.getItem(mUUID);
- if (!item) return;
-
- // Since we just changed the suffix to indicate (active)
- // the server doesn't need to know, just the viewer.
- gInventory.updateItem(item);
- gInventory.notifyObservers();
- }
- else if ("deactivate" == action || isRemoveAction(action))
- {
- LLGestureMgr::instance().deactivateGesture(mUUID);
-
- LLViewerInventoryItem* item = gInventory.getItem(mUUID);
- if (!item) return;
-
- // Since we just changed the suffix to indicate (active)
- // the server doesn't need to know, just the viewer.
- gInventory.updateItem(item);
- gInventory.notifyObservers();
- }
- else if("play" == action)
- {
- if(!LLGestureMgr::instance().isGestureActive(mUUID))
- {
- // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList.
- BOOL inform_server = TRUE;
- BOOL deactivate_similar = FALSE;
- LLGestureMgr::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID));
- LLViewerInventoryItem* item = gInventory.getItem(mUUID);
- llassert(item);
- if (item)
- {
- LLGestureMgr::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar);
- }
- }
- else
- {
- playGesture(mUUID);
- }
- }
- else LLItemBridge::performAction(model, action);
+ if (isAddAction(action))
+ {
+ LLGestureMgr::instance().activateGesture(mUUID);
+
+ LLViewerInventoryItem* item = gInventory.getItem(mUUID);
+ if (!item) return;
+
+ // Since we just changed the suffix to indicate (active)
+ // the server doesn't need to know, just the viewer.
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+ else if ("deactivate" == action || isRemoveAction(action))
+ {
+ LLGestureMgr::instance().deactivateGesture(mUUID);
+
+ LLViewerInventoryItem* item = gInventory.getItem(mUUID);
+ if (!item) return;
+
+ // Since we just changed the suffix to indicate (active)
+ // the server doesn't need to know, just the viewer.
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+ else if("play" == action)
+ {
+ if(!LLGestureMgr::instance().isGestureActive(mUUID))
+ {
+ // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList.
+ BOOL inform_server = TRUE;
+ BOOL deactivate_similar = FALSE;
+ LLGestureMgr::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID));
+ LLViewerInventoryItem* item = gInventory.getItem(mUUID);
+ llassert(item);
+ if (item)
+ {
+ LLGestureMgr::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar);
+ }
+ }
+ else
+ {
+ playGesture(mUUID);
+ }
+ }
+ else LLItemBridge::performAction(model, action);
}
void LLGestureBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
+ LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
- }
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
/*
LLViewerInventoryItem* item = getItem();
if (item)
@@ -6455,82 +6455,82 @@ void LLGestureBridge::openItem()
BOOL LLGestureBridge::removeItem()
{
- // Grab class information locally since *this may be deleted
- // within this function. Not a great pattern...
- const LLInventoryModel* model = getInventoryModel();
- if(!model)
- {
- return FALSE;
- }
- const LLUUID item_id = mUUID;
-
- // This will also force close the preview window, if it exists.
- // This may actually delete *this, if mUUID is in the COF.
- LLGestureMgr::instance().deactivateGesture(item_id);
-
- // If deactivateGesture deleted *this, then return out immediately.
- if (!model->getObject(item_id))
- {
- return TRUE;
- }
-
- return LLItemBridge::removeItem();
+ // Grab class information locally since *this may be deleted
+ // within this function. Not a great pattern...
+ const LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ {
+ return FALSE;
+ }
+ const LLUUID item_id = mUUID;
+
+ // This will also force close the preview window, if it exists.
+ // This may actually delete *this, if mUUID is in the COF.
+ LLGestureMgr::instance().deactivateGesture(item_id);
+
+ // If deactivateGesture deleted *this, then return out immediately.
+ if (!model->getObject(item_id))
+ {
+ return TRUE;
+ }
+
+ return LLItemBridge::removeItem();
}
void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LL_DEBUGS() << "LLGestureBridge::buildContextMenu()" << LL_ENDL;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
+ LL_DEBUGS() << "LLGestureBridge::buildContextMenu()" << LL_ENDL;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+ if(isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
else if (isMarketplaceListingsFolder())
{
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
- items.push_back(std::string("Properties"));
- getClipboardEntries(false, items, disabled_items, flags);
- }
- else
- {
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
-
- addOpenRightClickMenuOption(items);
- items.push_back(std::string("Properties"));
-
- getClipboardEntries(true, items, disabled_items, flags);
-
- items.push_back(std::string("Gesture Separator"));
- if (LLGestureMgr::instance().isGestureActive(getUUID()))
- {
- items.push_back(std::string("Deactivate"));
- }
- else
- {
- items.push_back(std::string("Activate"));
- }
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
+ }
+ else
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+
+ addOpenRightClickMenuOption(items);
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ items.push_back(std::string("Gesture Separator"));
+ if (LLGestureMgr::instance().isGestureActive(getUUID()))
+ {
+ items.push_back(std::string("Deactivate"));
+ }
+ else
+ {
+ items.push_back(std::string("Activate"));
+ }
items.push_back(std::string("PlayGesture"));
- }
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ }
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
// static
void LLGestureBridge::playGesture(const LLUUID& item_id)
{
- if (LLGestureMgr::instance().isGesturePlaying(item_id))
- {
- LLGestureMgr::instance().stopGesture(item_id);
- }
- else
- {
- LLGestureMgr::instance().playGesture(item_id);
- }
+ if (LLGestureMgr::instance().isGesturePlaying(item_id))
+ {
+ LLGestureMgr::instance().stopGesture(item_id);
+ }
+ else
+ {
+ LLGestureMgr::instance().playGesture(item_id);
+ }
}
@@ -6540,76 +6540,76 @@ void LLGestureBridge::playGesture(const LLUUID& item_id)
void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
- LL_DEBUGS() << "LLAnimationBridge::buildContextMenu()" << LL_ENDL;
+ LL_DEBUGS() << "LLAnimationBridge::buildContextMenu()" << LL_ENDL;
if (isMarketplaceListingsFolder())
{
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
- items.push_back(std::string("Properties"));
- getClipboardEntries(false, items, disabled_items, flags);
- }
- else
- {
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
- else
- {
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
- items.push_back(std::string("Animation Open"));
- items.push_back(std::string("Properties"));
-
- getClipboardEntries(true, items, disabled_items, flags);
- }
-
- items.push_back(std::string("Animation Separator"));
- items.push_back(std::string("Animation Play"));
- items.push_back(std::string("Animation Audition"));
- }
-
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
+ }
+ else
+ {
+ if(isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
+ else
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+ items.push_back(std::string("Animation Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+ }
+
+ items.push_back(std::string("Animation Separator"));
+ items.push_back(std::string("Animation Play"));
+ items.push_back(std::string("Animation Audition"));
+ }
+
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
// virtual
void LLAnimationBridge::performAction(LLInventoryModel* model, std::string action)
{
- if ((action == "playworld") || (action == "playlocal"))
- {
- if (getItem())
- {
- LLSD::String activate = "NONE";
- if ("playworld" == action) activate = "Inworld";
- if ("playlocal" == action) activate = "Locally";
-
- LLPreviewAnim* preview = LLFloaterReg::showTypedInstance<LLPreviewAnim>("preview_anim", LLSD(mUUID));
- if (preview)
- {
- preview->play(activate);
- }
- }
- }
- else
- {
- LLItemBridge::performAction(model, action);
- }
+ if ((action == "playworld") || (action == "playlocal"))
+ {
+ if (getItem())
+ {
+ LLSD::String activate = "NONE";
+ if ("playworld" == action) activate = "Inworld";
+ if ("playlocal" == action) activate = "Locally";
+
+ LLPreviewAnim* preview = LLFloaterReg::showTypedInstance<LLPreviewAnim>("preview_anim", LLSD(mUUID));
+ if (preview)
+ {
+ preview->play(activate);
+ }
+ }
+ }
+ else
+ {
+ LLItemBridge::performAction(model, action);
+ }
}
void LLAnimationBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
+ LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
- }
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
/*
LLViewerInventoryItem* item = getItem();
if (item)
@@ -6626,329 +6626,329 @@ void LLAnimationBridge::openItem()
// static
LLUUID LLObjectBridge::sContextMenuItemID;
-LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- LLInventoryType::EType type,
- U32 flags) :
- LLItemBridge(inventory, root, uuid)
+LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ LLInventoryType::EType type,
+ U32 flags) :
+ LLItemBridge(inventory, root, uuid)
{
- mAttachPt = (flags & 0xff); // low bye of inventory flags
- mIsMultiObject = ( flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE;
- mInvType = type;
+ mAttachPt = (flags & 0xff); // low bye of inventory flags
+ mIsMultiObject = ( flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE;
+ mInvType = type;
}
LLUIImagePtr LLObjectBridge::getIcon() const
{
- return LLInventoryIcon::getIcon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject);
}
LLInventoryObject* LLObjectBridge::getObject() const
{
- LLInventoryObject* object = NULL;
- LLInventoryModel* model = getInventoryModel();
- if(model)
- {
- object = (LLInventoryObject*)model->getObject(mUUID);
- }
- return object;
+ LLInventoryObject* object = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ object = (LLInventoryObject*)model->getObject(mUUID);
+ }
+ return object;
}
// virtual
void LLObjectBridge::performAction(LLInventoryModel* model, std::string action)
{
- if (isAddAction(action))
- {
- LLUUID object_id = mUUID;
- LLViewerInventoryItem* item;
- item = (LLViewerInventoryItem*)gInventory.getItem(object_id);
- if(item && gInventory.isObjectDescendentOf(object_id, gInventory.getRootFolderID()))
- {
- rez_attachment(item, NULL, true); // Replace if "Wear"ing.
- }
- else if(item && item->isFinished())
- {
- // must be in library. copy it to our inventory and put it on.
- LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0));
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- LLUUID::null,
- std::string(),
- cb);
- }
- gFocusMgr.setKeyboardFocus(NULL);
- }
- else if ("wear_add" == action)
- {
- LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, false); // Don't replace if adding.
- }
- else if ("touch" == action)
- {
- handle_attachment_touch(mUUID);
- }
- else if ("edit" == action)
- {
- handle_attachment_edit(mUUID);
- }
- else if (isRemoveAction(action))
- {
- LLAppearanceMgr::instance().removeItemFromAvatar(mUUID);
- }
- else LLItemBridge::performAction(model, action);
+ if (isAddAction(action))
+ {
+ LLUUID object_id = mUUID;
+ LLViewerInventoryItem* item;
+ item = (LLViewerInventoryItem*)gInventory.getItem(object_id);
+ if(item && gInventory.isObjectDescendentOf(object_id, gInventory.getRootFolderID()))
+ {
+ rez_attachment(item, NULL, true); // Replace if "Wear"ing.
+ }
+ else if(item && item->isFinished())
+ {
+ // must be in library. copy it to our inventory and put it on.
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0));
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+ else if ("wear_add" == action)
+ {
+ LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, false); // Don't replace if adding.
+ }
+ else if ("touch" == action)
+ {
+ handle_attachment_touch(mUUID);
+ }
+ else if ("edit" == action)
+ {
+ handle_attachment_edit(mUUID);
+ }
+ else if (isRemoveAction(action))
+ {
+ LLAppearanceMgr::instance().removeItemFromAvatar(mUUID);
+ }
+ else LLItemBridge::performAction(model, action);
}
void LLObjectBridge::openItem()
{
- // object double-click action is to wear/unwear object
- performAction(getInventoryModel(),
- get_is_item_worn(mUUID) ? "detach" : "attach");
+ // object double-click action is to wear/unwear object
+ performAction(getInventoryModel(),
+ get_is_item_worn(mUUID) ? "detach" : "attach");
}
std::string LLObjectBridge::getLabelSuffix() const
{
- if (get_is_item_worn(mUUID))
- {
- if (!isAgentAvatarValid()) // Error condition, can't figure out attach point
- {
- return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn");
- }
- std::string attachment_point_name;
- if (gAgentAvatarp->getAttachedPointName(mUUID, attachment_point_name))
- {
- LLStringUtil::format_map_t args;
- args["[ATTACHMENT_POINT]"] = LLTrans::getString(attachment_point_name);
-
- return LLItemBridge::getLabelSuffix() + LLTrans::getString("WornOnAttachmentPoint", args);
- }
- else
- {
- LLStringUtil::format_map_t args;
- args["[ATTACHMENT_ERROR]"] = LLTrans::getString(attachment_point_name);
- return LLItemBridge::getLabelSuffix() + LLTrans::getString("AttachmentErrorMessage", args);
- }
- }
- return LLItemBridge::getLabelSuffix();
+ if (get_is_item_worn(mUUID))
+ {
+ if (!isAgentAvatarValid()) // Error condition, can't figure out attach point
+ {
+ return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn");
+ }
+ std::string attachment_point_name;
+ if (gAgentAvatarp->getAttachedPointName(mUUID, attachment_point_name))
+ {
+ LLStringUtil::format_map_t args;
+ args["[ATTACHMENT_POINT]"] = LLTrans::getString(attachment_point_name);
+
+ return LLItemBridge::getLabelSuffix() + LLTrans::getString("WornOnAttachmentPoint", args);
+ }
+ else
+ {
+ LLStringUtil::format_map_t args;
+ args["[ATTACHMENT_ERROR]"] = LLTrans::getString(attachment_point_name);
+ return LLItemBridge::getLabelSuffix() + LLTrans::getString("AttachmentErrorMessage", args);
+ }
+ }
+ return LLItemBridge::getLabelSuffix();
}
void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment, bool replace)
{
- const LLUUID& item_id = item->getLinkedUUID();
-
- // Check for duplicate request.
- if (isAgentAvatarValid() &&
- gAgentAvatarp->isWearingAttachment(item_id))
- {
- LL_WARNS() << "ATT duplicate attachment request, ignoring" << LL_ENDL;
- return;
- }
-
- S32 attach_pt = 0;
- if (isAgentAvatarValid() && attachment)
- {
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
- {
- if (iter->second == attachment)
- {
- attach_pt = iter->first;
- break;
- }
- }
- }
-
- LLSD payload;
- payload["item_id"] = item_id; // Wear the base object in case this is a link.
- payload["attachment_point"] = attach_pt;
- payload["is_add"] = !replace;
-
- if (replace &&
- (attachment && attachment->getNumObjects() > 0))
- {
- LLNotificationsUtil::add("ReplaceAttachment", LLSD(), payload, confirm_attachment_rez);
- }
- else
- {
- LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0/*YES*/);
- }
+ const LLUUID& item_id = item->getLinkedUUID();
+
+ // Check for duplicate request.
+ if (isAgentAvatarValid() &&
+ gAgentAvatarp->isWearingAttachment(item_id))
+ {
+ LL_WARNS() << "ATT duplicate attachment request, ignoring" << LL_ENDL;
+ return;
+ }
+
+ S32 attach_pt = 0;
+ if (isAgentAvatarValid() && attachment)
+ {
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
+ {
+ if (iter->second == attachment)
+ {
+ attach_pt = iter->first;
+ break;
+ }
+ }
+ }
+
+ LLSD payload;
+ payload["item_id"] = item_id; // Wear the base object in case this is a link.
+ payload["attachment_point"] = attach_pt;
+ payload["is_add"] = !replace;
+
+ if (replace &&
+ (attachment && attachment->getNumObjects() > 0))
+ {
+ LLNotificationsUtil::add("ReplaceAttachment", LLSD(), payload, confirm_attachment_rez);
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0/*YES*/);
+ }
}
bool confirm_attachment_rez(const LLSD& notification, const LLSD& response)
{
- if (!gAgentAvatarp->canAttachMoreObjects())
- {
- LLSD args;
- args["MAX_ATTACHMENTS"] = llformat("%d", gAgentAvatarp->getMaxAttachments());
- LLNotificationsUtil::add("MaxAttachmentsOnOutfit", args);
- return false;
- }
-
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0/*YES*/)
- {
- LLUUID item_id = notification["payload"]["item_id"].asUUID();
- LLViewerInventoryItem* itemp = gInventory.getItem(item_id);
-
- if (itemp)
- {
- // Queue up attachments to be sent in next idle tick, this way the
- // attachments are batched up all into one message versus each attachment
- // being sent in its own separate attachments message.
- U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
- BOOL is_add = notification["payload"]["is_add"].asBoolean();
-
- LL_DEBUGS("Avatar") << "ATT calling addAttachmentRequest " << (itemp ? itemp->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
- LLAttachmentsMgr::instance().addAttachmentRequest(item_id, attachment_pt, is_add);
- }
- }
- return false;
+ if (!gAgentAvatarp->canAttachMoreObjects())
+ {
+ LLSD args;
+ args["MAX_ATTACHMENTS"] = llformat("%d", gAgentAvatarp->getMaxAttachments());
+ LLNotificationsUtil::add("MaxAttachmentsOnOutfit", args);
+ return false;
+ }
+
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0/*YES*/)
+ {
+ LLUUID item_id = notification["payload"]["item_id"].asUUID();
+ LLViewerInventoryItem* itemp = gInventory.getItem(item_id);
+
+ if (itemp)
+ {
+ // Queue up attachments to be sent in next idle tick, this way the
+ // attachments are batched up all into one message versus each attachment
+ // being sent in its own separate attachments message.
+ U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
+ BOOL is_add = notification["payload"]["is_add"].asBoolean();
+
+ LL_DEBUGS("Avatar") << "ATT calling addAttachmentRequest " << (itemp ? itemp->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
+ LLAttachmentsMgr::instance().addAttachmentRequest(item_id, attachment_pt, is_add);
+ }
+ }
+ return false;
}
static LLNotificationFunctorRegistration confirm_replace_attachment_rez_reg("ReplaceAttachment", confirm_attachment_rez);
void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+ if(isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
else if (isMarketplaceListingsFolder())
{
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
- items.push_back(std::string("Properties"));
- getClipboardEntries(false, items, disabled_items, flags);
- }
- else
- {
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
-
- items.push_back(std::string("Properties"));
-
- getClipboardEntries(true, items, disabled_items, flags);
-
- LLObjectBridge::sContextMenuItemID = mUUID;
-
- LLInventoryItem *item = getItem();
- if(item)
- {
- if (!isAgentAvatarValid()) return;
-
- if( get_is_item_worn( mUUID ) )
- {
- items.push_back(std::string("Wearable And Object Separator"));
-
- items.push_back(std::string("Attachment Touch"));
- if ( ((flags & FIRST_SELECTED_ITEM) == 0) || !enable_attachment_touch(mUUID) )
- {
- disabled_items.push_back(std::string("Attachment Touch"));
- }
-
- items.push_back(std::string("Wearable Edit"));
- if ( ((flags & FIRST_SELECTED_ITEM) == 0) || !get_is_item_editable(mUUID) )
- {
- disabled_items.push_back(std::string("Wearable Edit"));
- }
-
- items.push_back(std::string("Detach From Yourself"));
- }
- else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder())
- {
- items.push_back(std::string("Wearable And Object Separator"));
- items.push_back(std::string("Wearable And Object Wear"));
- items.push_back(std::string("Wearable Add"));
- items.push_back(std::string("Attach To"));
- items.push_back(std::string("Attach To HUD"));
- // commented out for DEV-32347
- //items.push_back(std::string("Restore to Last Position"));
-
- if (!gAgentAvatarp->canAttachMoreObjects())
- {
- disabled_items.push_back(std::string("Wearable And Object Wear"));
- disabled_items.push_back(std::string("Wearable Add"));
- disabled_items.push_back(std::string("Attach To"));
- disabled_items.push_back(std::string("Attach To HUD"));
- }
- LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE);
- LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE);
- if (attach_menu
- && (attach_menu->getChildCount() == 0)
- && attach_hud_menu
- && (attach_hud_menu->getChildCount() == 0)
- && isAgentAvatarValid())
- {
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); )
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- LLMenuItemCallGL::Params p;
- std::string submenu_name = attachment->getName();
- if (LLTrans::getString(submenu_name) != "")
- {
- p.name = (" ")+LLTrans::getString(submenu_name)+" ";
- }
- else
- {
- p.name = submenu_name;
- }
- LLSD cbparams;
- cbparams["index"] = curiter->first;
- cbparams["label"] = p.name;
- p.on_click.function_name = "Inventory.AttachObject";
- p.on_click.parameter = LLSD(attachment->getName());
- p.on_enable.function_name = "Attachment.Label";
- p.on_enable.parameter = cbparams;
- LLView* parent = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu;
- LLUICtrlFactory::create<LLMenuItemCallGL>(p, parent);
- items.push_back(p.name);
- }
- }
- }
- }
- }
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
+ }
+ else
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ LLObjectBridge::sContextMenuItemID = mUUID;
+
+ LLInventoryItem *item = getItem();
+ if(item)
+ {
+ if (!isAgentAvatarValid()) return;
+
+ if( get_is_item_worn( mUUID ) )
+ {
+ items.push_back(std::string("Wearable And Object Separator"));
+
+ items.push_back(std::string("Attachment Touch"));
+ if ( ((flags & FIRST_SELECTED_ITEM) == 0) || !enable_attachment_touch(mUUID) )
+ {
+ disabled_items.push_back(std::string("Attachment Touch"));
+ }
+
+ items.push_back(std::string("Wearable Edit"));
+ if ( ((flags & FIRST_SELECTED_ITEM) == 0) || !get_is_item_editable(mUUID) )
+ {
+ disabled_items.push_back(std::string("Wearable Edit"));
+ }
+
+ items.push_back(std::string("Detach From Yourself"));
+ }
+ else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder())
+ {
+ items.push_back(std::string("Wearable And Object Separator"));
+ items.push_back(std::string("Wearable And Object Wear"));
+ items.push_back(std::string("Wearable Add"));
+ items.push_back(std::string("Attach To"));
+ items.push_back(std::string("Attach To HUD"));
+ // commented out for DEV-32347
+ //items.push_back(std::string("Restore to Last Position"));
+
+ if (!gAgentAvatarp->canAttachMoreObjects())
+ {
+ disabled_items.push_back(std::string("Wearable And Object Wear"));
+ disabled_items.push_back(std::string("Wearable Add"));
+ disabled_items.push_back(std::string("Attach To"));
+ disabled_items.push_back(std::string("Attach To HUD"));
+ }
+ LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE);
+ LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE);
+ if (attach_menu
+ && (attach_menu->getChildCount() == 0)
+ && attach_hud_menu
+ && (attach_hud_menu->getChildCount() == 0)
+ && isAgentAvatarValid())
+ {
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ LLMenuItemCallGL::Params p;
+ std::string submenu_name = attachment->getName();
+ if (LLTrans::getString(submenu_name) != "")
+ {
+ p.name = (" ")+LLTrans::getString(submenu_name)+" ";
+ }
+ else
+ {
+ p.name = submenu_name;
+ }
+ LLSD cbparams;
+ cbparams["index"] = curiter->first;
+ cbparams["label"] = p.name;
+ p.on_click.function_name = "Inventory.AttachObject";
+ p.on_click.parameter = LLSD(attachment->getName());
+ p.on_enable.function_name = "Attachment.Label";
+ p.on_enable.parameter = cbparams;
+ LLView* parent = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu;
+ LLUICtrlFactory::create<LLMenuItemCallGL>(p, parent);
+ items.push_back(p.name);
+ }
+ }
+ }
+ }
+ }
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
BOOL LLObjectBridge::renameItem(const std::string& new_name)
{
- if(!isItemRenameable())
- return FALSE;
- LLPreview::dirty(mUUID);
- LLInventoryModel* model = getInventoryModel();
- if(!model)
- return FALSE;
- LLViewerInventoryItem* item = getItem();
- if(item && (item->getName() != new_name))
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->rename(new_name);
- new_item->updateServer(FALSE);
- model->updateItem(new_item);
- model->notifyObservers();
- buildDisplayName();
-
- if (isAgentAvatarValid())
- {
- LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
- if(obj)
- {
- LLSelectMgr::getInstance()->deselectAll();
- LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
- LLSelectMgr::getInstance()->selectionSetObjectName( new_name );
- LLSelectMgr::getInstance()->deselectAll();
- }
- }
- }
- // return FALSE because we either notified observers (& therefore
- // rebuilt) or we didn't update.
- return FALSE;
+ if(!isItemRenameable())
+ return FALSE;
+ LLPreview::dirty(mUUID);
+ LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ return FALSE;
+ LLViewerInventoryItem* item = getItem();
+ if(item && (item->getName() != new_name))
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->rename(new_name);
+ new_item->updateServer(FALSE);
+ model->updateItem(new_item);
+ model->notifyObservers();
+ buildDisplayName();
+
+ if (isAgentAvatarValid())
+ {
+ LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
+ if(obj)
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
+ LLSelectMgr::getInstance()->selectionSetObjectName( new_name );
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+ }
+ }
+ // return FALSE because we either notified observers (& therefore
+ // rebuilt) or we didn't update.
+ return FALSE;
}
// +=================================================+
@@ -6957,331 +6957,331 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
void LLLSLTextBridge::openItem()
{
- LLViewerInventoryItem* item = getItem();
+ LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
- }
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
}
// +=================================================+
// | LLWearableBridge |
// +=================================================+
-LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- LLAssetType::EType asset_type,
- LLInventoryType::EType inv_type,
- LLWearableType::EType wearable_type) :
- LLItemBridge(inventory, root, uuid),
- mAssetType( asset_type ),
- mWearableType(wearable_type)
+LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ LLAssetType::EType asset_type,
+ LLInventoryType::EType inv_type,
+ LLWearableType::EType wearable_type) :
+ LLItemBridge(inventory, root, uuid),
+ mAssetType( asset_type ),
+ mWearableType(wearable_type)
{
- mInvType = inv_type;
+ mInvType = inv_type;
}
BOOL LLWearableBridge::renameItem(const std::string& new_name)
{
- if (get_is_item_worn(mUUID))
- {
- gAgentWearables.setWearableName( mUUID, new_name );
- }
- return LLItemBridge::renameItem(new_name);
+ if (get_is_item_worn(mUUID))
+ {
+ gAgentWearables.setWearableName( mUUID, new_name );
+ }
+ return LLItemBridge::renameItem(new_name);
}
std::string LLWearableBridge::getLabelSuffix() const
{
- if (get_is_item_worn(mUUID))
- {
- // e.g. "(worn)"
- return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn");
- }
- else
- {
- return LLItemBridge::getLabelSuffix();
- }
+ if (get_is_item_worn(mUUID))
+ {
+ // e.g. "(worn)"
+ return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn");
+ }
+ else
+ {
+ return LLItemBridge::getLabelSuffix();
+ }
}
LLUIImagePtr LLWearableBridge::getIcon() const
{
- return LLInventoryIcon::getIcon(mAssetType, mInvType, mWearableType, FALSE);
+ return LLInventoryIcon::getIcon(mAssetType, mInvType, mWearableType, FALSE);
}
// virtual
void LLWearableBridge::performAction(LLInventoryModel* model, std::string action)
{
- if (isAddAction(action))
- {
- wearOnAvatar();
- }
- else if ("wear_add" == action)
- {
- wearAddOnAvatar();
- }
- else if ("edit" == action)
- {
- editOnAvatar();
- return;
- }
- else if (isRemoveAction(action))
- {
- removeFromAvatar();
- return;
- }
- else LLItemBridge::performAction(model, action);
+ if (isAddAction(action))
+ {
+ wearOnAvatar();
+ }
+ else if ("wear_add" == action)
+ {
+ wearAddOnAvatar();
+ }
+ else if ("edit" == action)
+ {
+ editOnAvatar();
+ return;
+ }
+ else if (isRemoveAction(action))
+ {
+ removeFromAvatar();
+ return;
+ }
+ else LLItemBridge::performAction(model, action);
}
void LLWearableBridge::openItem()
{
- performAction(getInventoryModel(),
- get_is_item_worn(mUUID) ? "take_off" : "wear");
+ performAction(getInventoryModel(),
+ get_is_item_worn(mUUID) ? "take_off" : "wear");
}
void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LL_DEBUGS() << "LLWearableBridge::buildContextMenu()" << LL_ENDL;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
+ LL_DEBUGS() << "LLWearableBridge::buildContextMenu()" << LL_ENDL;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+ if(isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
else if (isMarketplaceListingsFolder())
{
- addMarketplaceContextMenuOptions(flags, items, disabled_items);
- items.push_back(std::string("Properties"));
- getClipboardEntries(false, items, disabled_items, flags);
- }
- else
- { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere
- BOOL can_open = ((flags & SUPPRESS_OPEN_ITEM) != SUPPRESS_OPEN_ITEM);
-
- // If we have clothing, don't add "Open" as it's the same action as "Wear" SL-18976
- LLViewerInventoryItem* item = getItem();
- if (can_open && item)
- {
- can_open = (item->getType() != LLAssetType::AT_CLOTHING) &&
- (item->getType() != LLAssetType::AT_BODYPART);
- }
- if (isLinkedObjectMissing())
- {
- can_open = FALSE;
- }
- items.push_back(std::string("Share"));
- if (!canShare())
- {
- disabled_items.push_back(std::string("Share"));
- }
-
- if (can_open)
- {
- addOpenRightClickMenuOption(items);
- }
- else
- {
- disabled_items.push_back(std::string("Open"));
- disabled_items.push_back(std::string("Open Original"));
- }
-
- items.push_back(std::string("Properties"));
-
- getClipboardEntries(true, items, disabled_items, flags);
-
- items.push_back(std::string("Wearable And Object Separator"));
- items.push_back(std::string("Wearable Edit"));
-
- if (((flags & FIRST_SELECTED_ITEM) == 0) || (item && !gAgentWearables.isWearableModifiable(item->getUUID())))
- {
- disabled_items.push_back(std::string("Wearable Edit"));
- }
- // Don't allow items to be worn if their baseobj is in the trash.
- if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder())
- {
- disabled_items.push_back(std::string("Wearable And Object Wear"));
- disabled_items.push_back(std::string("Wearable Add"));
- disabled_items.push_back(std::string("Wearable Edit"));
- }
-
- // Disable wear and take off based on whether the item is worn.
- if(item)
- {
- switch (item->getType())
- {
- case LLAssetType::AT_CLOTHING:
- items.push_back(std::string("Take Off"));
- // Fallthrough since clothing and bodypart share wear options
- case LLAssetType::AT_BODYPART:
- if (get_is_item_worn(item->getUUID()))
- {
- disabled_items.push_back(std::string("Wearable And Object Wear"));
- disabled_items.push_back(std::string("Wearable Add"));
- }
- else
- {
- items.push_back(std::string("Wearable And Object Wear"));
- disabled_items.push_back(std::string("Take Off"));
- disabled_items.push_back(std::string("Wearable Edit"));
- }
-
- if (LLWearableType::getInstance()->getAllowMultiwear(mWearableType))
- {
- items.push_back(std::string("Wearable Add"));
- if (!gAgentWearables.canAddWearable(mWearableType))
- {
- disabled_items.push_back(std::string("Wearable Add"));
- }
- }
- break;
- default:
- break;
- }
- }
- }
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
+ }
+ else
+ { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere
+ BOOL can_open = ((flags & SUPPRESS_OPEN_ITEM) != SUPPRESS_OPEN_ITEM);
+
+ // If we have clothing, don't add "Open" as it's the same action as "Wear" SL-18976
+ LLViewerInventoryItem* item = getItem();
+ if (can_open && item)
+ {
+ can_open = (item->getType() != LLAssetType::AT_CLOTHING) &&
+ (item->getType() != LLAssetType::AT_BODYPART);
+ }
+ if (isLinkedObjectMissing())
+ {
+ can_open = FALSE;
+ }
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+
+ if (can_open)
+ {
+ addOpenRightClickMenuOption(items);
+ }
+ else
+ {
+ disabled_items.push_back(std::string("Open"));
+ disabled_items.push_back(std::string("Open Original"));
+ }
+
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ items.push_back(std::string("Wearable And Object Separator"));
+ items.push_back(std::string("Wearable Edit"));
+
+ if (((flags & FIRST_SELECTED_ITEM) == 0) || (item && !gAgentWearables.isWearableModifiable(item->getUUID())))
+ {
+ disabled_items.push_back(std::string("Wearable Edit"));
+ }
+ // Don't allow items to be worn if their baseobj is in the trash.
+ if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder())
+ {
+ disabled_items.push_back(std::string("Wearable And Object Wear"));
+ disabled_items.push_back(std::string("Wearable Add"));
+ disabled_items.push_back(std::string("Wearable Edit"));
+ }
+
+ // Disable wear and take off based on whether the item is worn.
+ if(item)
+ {
+ switch (item->getType())
+ {
+ case LLAssetType::AT_CLOTHING:
+ items.push_back(std::string("Take Off"));
+ // Fallthrough since clothing and bodypart share wear options
+ case LLAssetType::AT_BODYPART:
+ if (get_is_item_worn(item->getUUID()))
+ {
+ disabled_items.push_back(std::string("Wearable And Object Wear"));
+ disabled_items.push_back(std::string("Wearable Add"));
+ }
+ else
+ {
+ items.push_back(std::string("Wearable And Object Wear"));
+ disabled_items.push_back(std::string("Take Off"));
+ disabled_items.push_back(std::string("Wearable Edit"));
+ }
+
+ if (LLWearableType::getInstance()->getAllowMultiwear(mWearableType))
+ {
+ items.push_back(std::string("Wearable Add"));
+ if (!gAgentWearables.canAddWearable(mWearableType))
+ {
+ disabled_items.push_back(std::string("Wearable Add"));
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
// Called from menus
// static
BOOL LLWearableBridge::canWearOnAvatar(void* user_data)
{
- LLWearableBridge* self = (LLWearableBridge*)user_data;
- if(!self) return FALSE;
- if(!self->isAgentInventory())
- {
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
- if(!item || !item->isFinished()) return FALSE;
- }
- return (!get_is_item_worn(self->mUUID));
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if(!self) return FALSE;
+ if(!self->isAgentInventory())
+ {
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
+ if(!item || !item->isFinished()) return FALSE;
+ }
+ return (!get_is_item_worn(self->mUUID));
}
// Called from menus
// static
void LLWearableBridge::onWearOnAvatar(void* user_data)
{
- LLWearableBridge* self = (LLWearableBridge*)user_data;
- if(!self) return;
- self->wearOnAvatar();
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if(!self) return;
+ self->wearOnAvatar();
}
void LLWearableBridge::wearOnAvatar()
{
- // TODO: investigate wearables may not be loaded at this point EXT-8231
+ // TODO: investigate wearables may not be loaded at this point EXT-8231
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, true);
- }
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, true);
+ }
}
void LLWearableBridge::wearAddOnAvatar()
{
- // TODO: investigate wearables may not be loaded at this point EXT-8231
+ // TODO: investigate wearables may not be loaded at this point EXT-8231
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
- LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, false);
- }
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, false);
+ }
}
// static
void LLWearableBridge::onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata )
{
- LLUUID* item_id = (LLUUID*) userdata;
- if(wearable)
- {
- LLViewerInventoryItem* item = NULL;
- item = (LLViewerInventoryItem*)gInventory.getItem(*item_id);
- if(item)
- {
- if(item->getAssetUUID() == wearable->getAssetID())
- {
- gAgentWearables.setWearableItem(item, wearable);
- gInventory.notifyObservers();
- //self->getFolderItem()->refreshFromRoot();
- }
- else
- {
- LL_INFOS() << "By the time wearable asset arrived, its inv item already pointed to a different asset." << LL_ENDL;
- }
- }
- }
- delete item_id;
+ LLUUID* item_id = (LLUUID*) userdata;
+ if(wearable)
+ {
+ LLViewerInventoryItem* item = NULL;
+ item = (LLViewerInventoryItem*)gInventory.getItem(*item_id);
+ if(item)
+ {
+ if(item->getAssetUUID() == wearable->getAssetID())
+ {
+ gAgentWearables.setWearableItem(item, wearable);
+ gInventory.notifyObservers();
+ //self->getFolderItem()->refreshFromRoot();
+ }
+ else
+ {
+ LL_INFOS() << "By the time wearable asset arrived, its inv item already pointed to a different asset." << LL_ENDL;
+ }
+ }
+ }
+ delete item_id;
}
// static
// BAP remove the "add" code path once everything is fully COF-ified.
void LLWearableBridge::onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata )
{
- LLUUID* item_id = (LLUUID*) userdata;
- if(wearable)
- {
- LLViewerInventoryItem* item = NULL;
- item = (LLViewerInventoryItem*)gInventory.getItem(*item_id);
- if(item)
- {
- if(item->getAssetUUID() == wearable->getAssetID())
- {
- bool do_append = true;
- gAgentWearables.setWearableItem(item, wearable, do_append);
- gInventory.notifyObservers();
- //self->getFolderItem()->refreshFromRoot();
- }
- else
- {
- LL_INFOS() << "By the time wearable asset arrived, its inv item already pointed to a different asset." << LL_ENDL;
- }
- }
- }
- delete item_id;
+ LLUUID* item_id = (LLUUID*) userdata;
+ if(wearable)
+ {
+ LLViewerInventoryItem* item = NULL;
+ item = (LLViewerInventoryItem*)gInventory.getItem(*item_id);
+ if(item)
+ {
+ if(item->getAssetUUID() == wearable->getAssetID())
+ {
+ bool do_append = true;
+ gAgentWearables.setWearableItem(item, wearable, do_append);
+ gInventory.notifyObservers();
+ //self->getFolderItem()->refreshFromRoot();
+ }
+ else
+ {
+ LL_INFOS() << "By the time wearable asset arrived, its inv item already pointed to a different asset." << LL_ENDL;
+ }
+ }
+ }
+ delete item_id;
}
// static
BOOL LLWearableBridge::canEditOnAvatar(void* user_data)
{
- LLWearableBridge* self = (LLWearableBridge*)user_data;
- if(!self) return FALSE;
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if(!self) return FALSE;
- return (get_is_item_worn(self->mUUID));
+ return (get_is_item_worn(self->mUUID));
}
// static
void LLWearableBridge::onEditOnAvatar(void* user_data)
{
- LLWearableBridge* self = (LLWearableBridge*)user_data;
- if(self)
- {
- self->editOnAvatar();
- }
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if(self)
+ {
+ self->editOnAvatar();
+ }
}
void LLWearableBridge::editOnAvatar()
{
- LLAgentWearables::editWearable(mUUID);
+ LLAgentWearables::editWearable(mUUID);
}
// static
BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data)
{
- LLWearableBridge* self = (LLWearableBridge*)user_data;
- if( self && (LLAssetType::AT_BODYPART != self->mAssetType) )
- {
- return get_is_item_worn( self->mUUID );
- }
- return FALSE;
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if( self && (LLAssetType::AT_BODYPART != self->mAssetType) )
+ {
+ return get_is_item_worn( self->mUUID );
+ }
+ return FALSE;
}
void LLWearableBridge::removeFromAvatar()
{
- LL_WARNS() << "safe to remove?" << LL_ENDL;
- if (get_is_item_worn(mUUID))
- {
- LLAppearanceMgr::instance().removeItemFromAvatar(mUUID);
- }
+ LL_WARNS() << "safe to remove?" << LL_ENDL;
+ if (get_is_item_worn(mUUID))
+ {
+ LLAppearanceMgr::instance().removeItemFromAvatar(mUUID);
+ }
}
@@ -7294,25 +7294,25 @@ std::string LLLinkItemBridge::sPrefix("Link: ");
void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- // *TODO: Translate
- LL_DEBUGS() << "LLLink::buildContextMenu()" << LL_ENDL;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
-
- items.push_back(std::string("Find Original"));
- disabled_items.push_back(std::string("Find Original"));
-
- if(isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
- else
- {
- items.push_back(std::string("Properties"));
- addDeleteContextMenuOptions(items, disabled_items);
- }
- addLinkReplaceMenuOption(items, disabled_items);
- hide_context_entries(menu, items, disabled_items);
+ // *TODO: Translate
+ LL_DEBUGS() << "LLLink::buildContextMenu()" << LL_ENDL;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+
+ items.push_back(std::string("Find Original"));
+ disabled_items.push_back(std::string("Find Original"));
+
+ if(isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
+ else
+ {
+ items.push_back(std::string("Properties"));
+ addDeleteContextMenuOptions(items, disabled_items);
+ }
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
// +=================================================+
@@ -7339,7 +7339,7 @@ void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action
{
// Single item only
LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
- if (!item)
+ if (!item)
return;
LLUUID asset_id = item->getAssetUUID();
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, asset_id, LLEnvironment::TRANSITION_INSTANT);
@@ -7427,7 +7427,7 @@ void LLSettingsBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
items.push_back("Settings Apply Parcel");
if (!canUpdateParcel())
disabled_items.push_back("Settings Apply Parcel");
-
+
items.push_back("Settings Apply Region");
if (!canUpdateRegion())
disabled_items.push_back("Settings Apply Region");
@@ -7503,50 +7503,50 @@ void LLMaterialBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
std::string LLLinkFolderBridge::sPrefix("Link: ");
LLUIImagePtr LLLinkFolderBridge::getIcon() const
{
- LLFolderType::EType folder_type = LLFolderType::FT_NONE;
- const LLInventoryObject *obj = getInventoryObject();
- if (obj)
- {
- LLViewerInventoryCategory* cat = NULL;
- LLInventoryModel* model = getInventoryModel();
- if(model)
- {
- cat = (LLViewerInventoryCategory*)model->getCategory(obj->getLinkedUUID());
- if (cat)
- {
- folder_type = cat->getPreferredType();
- }
- }
- }
- return LLFolderBridge::getIcon(folder_type);
+ LLFolderType::EType folder_type = LLFolderType::FT_NONE;
+ const LLInventoryObject *obj = getInventoryObject();
+ if (obj)
+ {
+ LLViewerInventoryCategory* cat = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ cat = (LLViewerInventoryCategory*)model->getCategory(obj->getLinkedUUID());
+ if (cat)
+ {
+ folder_type = cat->getPreferredType();
+ }
+ }
+ }
+ return LLFolderBridge::getIcon(folder_type);
}
void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- // *TODO: Translate
- LL_DEBUGS() << "LLLink::buildContextMenu()" << LL_ENDL;
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
-
- if (isItemInTrash())
- {
- addTrashContextMenuOptions(items, disabled_items);
- }
- else
- {
- items.push_back(std::string("Find Original"));
- addDeleteContextMenuOptions(items, disabled_items);
- }
- hide_context_entries(menu, items, disabled_items);
+ // *TODO: Translate
+ LL_DEBUGS() << "LLLink::buildContextMenu()" << LL_ENDL;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+
+ if (isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
+ else
+ {
+ items.push_back(std::string("Find Original"));
+ addDeleteContextMenuOptions(items, disabled_items);
+ }
+ hide_context_entries(menu, items, disabled_items);
}
void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string action)
{
- if ("goto" == action)
- {
- gotoItem();
- return;
- }
- LLItemBridge::performAction(model,action);
+ if ("goto" == action)
+ {
+ gotoItem();
+ return;
+ }
+ LLItemBridge::performAction(model,action);
}
void LLLinkFolderBridge::gotoItem()
{
@@ -7564,29 +7564,29 @@ void LLLinkFolderBridge::gotoItem()
}
const LLUUID &LLLinkFolderBridge::getFolderID() const
{
- if (LLViewerInventoryItem *link_item = getItem())
- {
- if (const LLViewerInventoryCategory *cat = link_item->getLinkedCategory())
- {
- const LLUUID& cat_uuid = cat->getUUID();
- return cat_uuid;
- }
- }
- return LLUUID::null;
+ if (LLViewerInventoryItem *link_item = getItem())
+ {
+ if (const LLViewerInventoryCategory *cat = link_item->getLinkedCategory())
+ {
+ const LLUUID& cat_uuid = cat->getUUID();
+ return cat_uuid;
+ }
+ }
+ return LLUUID::null;
}
void LLUnknownItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- menuentry_vec_t items;
- menuentry_vec_t disabled_items;
- items.push_back(std::string("Properties"));
- items.push_back(std::string("Rename"));
- hide_context_entries(menu, items, disabled_items);
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+ items.push_back(std::string("Properties"));
+ items.push_back(std::string("Rename"));
+ hide_context_entries(menu, items, disabled_items);
}
LLUIImagePtr LLUnknownItemBridge::getIcon() const
{
- return LLInventoryIcon::getIcon(LLAssetType::AT_UNKNOWN, mInvType);
+ return LLInventoryIcon::getIcon(LLAssetType::AT_UNKNOWN, mInvType);
}
@@ -7597,192 +7597,192 @@ LLUIImagePtr LLUnknownItemBridge::getIcon() const
// static
void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type,
- const LLUUID& uuid,
- LLInventoryModel* model)
+ const LLUUID& uuid,
+ LLInventoryModel* model)
{
- // Perform indirection in case of link.
- const LLUUID& linked_uuid = gInventory.getLinkedItemID(uuid);
+ // Perform indirection in case of link.
+ const LLUUID& linked_uuid = gInventory.getLinkedItemID(uuid);
- LLInvFVBridgeAction* action = createAction(asset_type,linked_uuid,model);
- if(action)
- {
- action->doIt();
- delete action;
- }
+ LLInvFVBridgeAction* action = createAction(asset_type,linked_uuid,model);
+ if(action)
+ {
+ action->doIt();
+ delete action;
+ }
}
// static
void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model)
{
- llassert(model);
- LLViewerInventoryItem* item = model->getItem(uuid);
- llassert(item);
- if (item)
- {
- LLAssetType::EType asset_type = item->getType();
- LLInvFVBridgeAction* action = createAction(asset_type,uuid,model);
- if(action)
- {
- action->doIt();
- delete action;
- }
- }
+ llassert(model);
+ LLViewerInventoryItem* item = model->getItem(uuid);
+ llassert(item);
+ if (item)
+ {
+ LLAssetType::EType asset_type = item->getType();
+ LLInvFVBridgeAction* action = createAction(asset_type,uuid,model);
+ if(action)
+ {
+ action->doIt();
+ delete action;
+ }
+ }
}
LLViewerInventoryItem* LLInvFVBridgeAction::getItem() const
{
- if (mModel)
- return (LLViewerInventoryItem*)mModel->getItem(mUUID);
- return NULL;
+ if (mModel)
+ return (LLViewerInventoryItem*)mModel->getItem(mUUID);
+ return NULL;
}
class LLTextureBridgeAction: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
- if (getItem())
- {
- LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
- }
- LLInvFVBridgeAction::doIt();
- }
- virtual ~LLTextureBridgeAction(){}
+ virtual void doIt()
+ {
+ if (getItem())
+ {
+ LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLTextureBridgeAction(){}
protected:
- LLTextureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ LLTextureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
};
class LLSoundBridgeAction: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- send_sound_trigger(item->getAssetUUID(), SOUND_GAIN);
- }
- LLInvFVBridgeAction::doIt();
- }
- virtual ~LLSoundBridgeAction(){}
+ virtual void doIt()
+ {
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ send_sound_trigger(item->getAssetUUID(), SOUND_GAIN);
+ }
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLSoundBridgeAction(){}
protected:
- LLSoundBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ LLSoundBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
};
class LLLandmarkBridgeAction: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- // Opening (double-clicking) a landmark immediately teleports,
- // but warns you the first time.
- LLSD payload;
- payload["asset_id"] = item->getAssetUUID();
-
- LLSD args;
- args["LOCATION"] = item->getName();
-
- LLNotificationsUtil::add("TeleportFromLandmark", args, payload);
- }
- LLInvFVBridgeAction::doIt();
- }
- virtual ~LLLandmarkBridgeAction(){}
+ virtual void doIt()
+ {
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ // Opening (double-clicking) a landmark immediately teleports,
+ // but warns you the first time.
+ LLSD payload;
+ payload["asset_id"] = item->getAssetUUID();
+
+ LLSD args;
+ args["LOCATION"] = item->getName();
+
+ LLNotificationsUtil::add("TeleportFromLandmark", args, payload);
+ }
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLLandmarkBridgeAction(){}
protected:
- LLLandmarkBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ LLLandmarkBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
};
class LLCallingCardBridgeAction: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
- LLViewerInventoryItem* item = getItem();
- if (item && item->getCreatorUUID().notNull())
- {
- LLAvatarActions::showProfile(item->getCreatorUUID());
- }
- LLInvFVBridgeAction::doIt();
- }
- virtual ~LLCallingCardBridgeAction(){}
+ virtual void doIt()
+ {
+ LLViewerInventoryItem* item = getItem();
+ if (item && item->getCreatorUUID().notNull())
+ {
+ LLAvatarActions::showProfile(item->getCreatorUUID());
+ }
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLCallingCardBridgeAction(){}
protected:
- LLCallingCardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ LLCallingCardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
};
class LLNotecardBridgeAction
: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
- }
- LLInvFVBridgeAction::doIt();
- }
- virtual ~LLNotecardBridgeAction(){}
+ virtual void doIt()
+ {
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+ }
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLNotecardBridgeAction(){}
protected:
- LLNotecardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ LLNotecardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
};
class LLGestureBridgeAction: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
- preview->setFocus(TRUE);
- }
- LLInvFVBridgeAction::doIt();
- }
- virtual ~LLGestureBridgeAction(){}
+ virtual void doIt()
+ {
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
+ preview->setFocus(TRUE);
+ }
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLGestureBridgeAction(){}
protected:
- LLGestureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ LLGestureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
};
class LLAnimationBridgeAction: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
- }
- LLInvFVBridgeAction::doIt();
- }
- virtual ~LLAnimationBridgeAction(){}
+ virtual void doIt()
+ {
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLAnimationBridgeAction(){}
protected:
- LLAnimationBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ LLAnimationBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
};
class LLObjectBridgeAction: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
+ virtual void doIt()
+ {
attachOrDetach();
- }
- virtual ~LLObjectBridgeAction(){}
+ }
+ virtual ~LLObjectBridgeAction(){}
protected:
- LLObjectBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ LLObjectBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
void attachOrDetach();
};
@@ -7800,62 +7800,62 @@ void LLObjectBridgeAction::attachOrDetach()
class LLLSLTextBridgeAction: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
- }
- LLInvFVBridgeAction::doIt();
- }
- virtual ~LLLSLTextBridgeAction(){}
+ virtual void doIt()
+ {
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+ LLInvFVBridgeAction::doIt();
+ }
+ virtual ~LLLSLTextBridgeAction(){}
protected:
- LLLSLTextBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ LLLSLTextBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
};
class LLWearableBridgeAction: public LLInvFVBridgeAction
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- virtual void doIt()
- {
- wearOnAvatar();
- }
+ virtual void doIt()
+ {
+ wearOnAvatar();
+ }
- virtual ~LLWearableBridgeAction(){}
+ virtual ~LLWearableBridgeAction(){}
protected:
- LLWearableBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
- BOOL isItemInTrash() const;
- // return true if the item is in agent inventory. if false, it
- // must be lost or in the inventory library.
- BOOL isAgentInventory() const;
- void wearOnAvatar();
+ LLWearableBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+ BOOL isItemInTrash() const;
+ // return true if the item is in agent inventory. if false, it
+ // must be lost or in the inventory library.
+ BOOL isAgentInventory() const;
+ void wearOnAvatar();
};
BOOL LLWearableBridgeAction::isItemInTrash() const
{
- if(!mModel) return FALSE;
- const LLUUID trash_id = mModel->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- return mModel->isObjectDescendentOf(mUUID, trash_id);
+ if(!mModel) return FALSE;
+ const LLUUID trash_id = mModel->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ return mModel->isObjectDescendentOf(mUUID, trash_id);
}
BOOL LLWearableBridgeAction::isAgentInventory() const
{
- if(!mModel) return FALSE;
- if(gInventory.getRootFolderID() == mUUID) return TRUE;
- return mModel->isObjectDescendentOf(mUUID, gInventory.getRootFolderID());
+ if(!mModel) return FALSE;
+ if(gInventory.getRootFolderID() == mUUID) return TRUE;
+ return mModel->isObjectDescendentOf(mUUID, gInventory.getRootFolderID());
}
void LLWearableBridgeAction::wearOnAvatar()
{
- // TODO: investigate wearables may not be loaded at this point EXT-8231
+ // TODO: investigate wearables may not be loaded at this point EXT-8231
- LLViewerInventoryItem* item = getItem();
- if(item)
- {
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
if (get_is_item_worn(mUUID))
{
if(item->getType() != LLAssetType::AT_BODYPART)
@@ -7867,7 +7867,7 @@ void LLWearableBridgeAction::wearOnAvatar()
{
LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, true);
}
- }
+ }
}
class LLSettingsBridgeAction
@@ -7923,53 +7923,53 @@ private:
LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type,
- const LLUUID& uuid,
- LLInventoryModel* model)
-{
- LLInvFVBridgeAction* action = NULL;
- switch(asset_type)
- {
- case LLAssetType::AT_TEXTURE:
- action = new LLTextureBridgeAction(uuid,model);
- break;
- case LLAssetType::AT_SOUND:
- action = new LLSoundBridgeAction(uuid,model);
- break;
- case LLAssetType::AT_LANDMARK:
- action = new LLLandmarkBridgeAction(uuid,model);
- break;
- case LLAssetType::AT_CALLINGCARD:
- action = new LLCallingCardBridgeAction(uuid,model);
- break;
- case LLAssetType::AT_OBJECT:
- action = new LLObjectBridgeAction(uuid,model);
- break;
- case LLAssetType::AT_NOTECARD:
- action = new LLNotecardBridgeAction(uuid,model);
- break;
- case LLAssetType::AT_ANIMATION:
- action = new LLAnimationBridgeAction(uuid,model);
- break;
- case LLAssetType::AT_GESTURE:
- action = new LLGestureBridgeAction(uuid,model);
- break;
- case LLAssetType::AT_LSL_TEXT:
- action = new LLLSLTextBridgeAction(uuid,model);
- break;
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_BODYPART:
- action = new LLWearableBridgeAction(uuid,model);
- break;
+ const LLUUID& uuid,
+ LLInventoryModel* model)
+{
+ LLInvFVBridgeAction* action = NULL;
+ switch(asset_type)
+ {
+ case LLAssetType::AT_TEXTURE:
+ action = new LLTextureBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_SOUND:
+ action = new LLSoundBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_LANDMARK:
+ action = new LLLandmarkBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_CALLINGCARD:
+ action = new LLCallingCardBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_OBJECT:
+ action = new LLObjectBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_NOTECARD:
+ action = new LLNotecardBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_ANIMATION:
+ action = new LLAnimationBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_GESTURE:
+ action = new LLGestureBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_LSL_TEXT:
+ action = new LLLSLTextBridgeAction(uuid,model);
+ break;
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_BODYPART:
+ action = new LLWearableBridgeAction(uuid,model);
+ break;
case LLAssetType::AT_SETTINGS:
action = new LLSettingsBridgeAction(uuid, model);
break;
case LLAssetType::AT_MATERIAL:
action = new LLMaterialBridgeAction(uuid, model);
break;
- default:
- break;
- }
- return action;
+ default:
+ break;
+ }
+ return action;
}
/** Bridge Actions
@@ -7981,42 +7981,42 @@ LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_
/************************************************************************/
void LLRecentItemsFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- menuentry_vec_t disabled_items, items;
+ menuentry_vec_t disabled_items, items;
buildContextMenuOptions(flags, items, disabled_items);
- items.erase(std::remove(items.begin(), items.end(), std::string("New Folder")), items.end());
+ items.erase(std::remove(items.begin(), items.end(), std::string("New Folder")), items.end());
- hide_context_entries(menu, items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge(
- LLAssetType::EType asset_type,
- LLAssetType::EType actual_asset_type,
- LLInventoryType::EType inv_type,
- LLInventoryPanel* inventory,
- LLFolderViewModelInventory* view_model,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags /*= 0x00*/ ) const
-{
- LLInvFVBridge* new_listener = NULL;
- if (asset_type == LLAssetType::AT_CATEGORY
- && actual_asset_type != LLAssetType::AT_LINK_FOLDER)
- {
- new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid);
- }
- else
- {
- new_listener = LLInventoryFolderViewModelBuilder::createBridge(asset_type,
- actual_asset_type,
- inv_type,
- inventory,
- view_model,
- root,
- uuid,
- flags);
- }
- return new_listener;
+ LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderViewModelInventory* view_model,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags /*= 0x00*/ ) const
+{
+ LLInvFVBridge* new_listener = NULL;
+ if (asset_type == LLAssetType::AT_CATEGORY
+ && actual_asset_type != LLAssetType::AT_LINK_FOLDER)
+ {
+ new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid);
+ }
+ else
+ {
+ new_listener = LLInventoryFolderViewModelBuilder::createBridge(asset_type,
+ actual_asset_type,
+ inv_type,
+ inventory,
+ view_model,
+ root,
+ uuid,
+ flags);
+ }
+ return new_listener;
}
LLFolderViewGroupedItemBridge::LLFolderViewGroupedItemBridge()
@@ -8026,10 +8026,10 @@ LLFolderViewGroupedItemBridge::LLFolderViewGroupedItemBridge()
void LLFolderViewGroupedItemBridge::groupFilterContextMenu(folder_view_item_deque& selected_items, LLMenuGL& menu)
{
uuid_vec_t ids;
- menuentry_vec_t disabled_items;
+ menuentry_vec_t disabled_items;
if (get_selection_item_uuids(selected_items, ids))
{
- if (!LLAppearanceMgr::instance().canAddWearables(ids) && canWearSelected(ids))
+ if (!LLAppearanceMgr::instance().canAddWearables(ids) && canWearSelected(ids))
{
disabled_items.push_back(std::string("Wearable And Object Wear"));
disabled_items.push_back(std::string("Wearable Add"));
@@ -8037,19 +8037,19 @@ void LLFolderViewGroupedItemBridge::groupFilterContextMenu(folder_view_item_dequ
disabled_items.push_back(std::string("Attach To HUD"));
}
}
- disable_context_entries_if_present(menu, disabled_items);
+ disable_context_entries_if_present(menu, disabled_items);
}
bool LLFolderViewGroupedItemBridge::canWearSelected(const uuid_vec_t& item_ids) const
{
- for (uuid_vec_t::const_iterator it = item_ids.begin(); it != item_ids.end(); ++it)
- {
- const LLViewerInventoryItem* item = gInventory.getItem(*it);
- if (!item || (item->getType() >= LLAssetType::AT_COUNT) || (item->getType() <= LLAssetType::AT_NONE))
- {
- return false;
- }
- }
- return true;
+ for (uuid_vec_t::const_iterator it = item_ids.begin(); it != item_ids.end(); ++it)
+ {
+ const LLViewerInventoryItem* item = gInventory.getItem(*it);
+ if (!item || (item->getType() >= LLAssetType::AT_COUNT) || (item->getType() <= LLAssetType::AT_NONE))
+ {
+ return false;
+ }
+ }
+ return true;
}
// EOF
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 6f06f3b36d..e1e0bbb5bd 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventorybridge.h
* @brief Implementation of the Inventory-Folder-View-Bridge classes.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -65,144 +65,144 @@ typedef std::list<two_uuids_t> two_uuids_list_t;
class LLInvFVBridge : public LLFolderViewModelItemInventory
{
public:
- // This method is a convenience function which creates the correct
- // type of bridge based on some basic information
- static LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
- LLAssetType::EType actual_asset_type,
- LLInventoryType::EType inv_type,
- LLInventoryPanel* inventory,
- LLFolderViewModelInventory* view_model,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags = 0x00);
- virtual ~LLInvFVBridge() {}
-
- bool canShare() const;
- bool canListOnMarketplace() const;
- bool canListOnMarketplaceNow() const;
-
- //--------------------------------------------------------------------
- // LLInvFVBridge functionality
- //--------------------------------------------------------------------
- virtual const LLUUID& getUUID() const { return mUUID; }
+ // This method is a convenience function which creates the correct
+ // type of bridge based on some basic information
+ static LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderViewModelInventory* view_model,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags = 0x00);
+ virtual ~LLInvFVBridge() {}
+
+ bool canShare() const;
+ bool canListOnMarketplace() const;
+ bool canListOnMarketplaceNow() const;
+
+ //--------------------------------------------------------------------
+ // LLInvFVBridge functionality
+ //--------------------------------------------------------------------
+ virtual const LLUUID& getUUID() const { return mUUID; }
virtual const LLUUID& getThumbnailUUID() const { return LLUUID::null; }
- virtual void clearDisplayName() { mDisplayName.clear(); }
- virtual void restoreItem() {}
- virtual void restoreToWorld() {}
-
- //--------------------------------------------------------------------
- // Inherited LLFolderViewModelItemInventory functions
- //--------------------------------------------------------------------
- virtual const std::string& getName() const;
- virtual const std::string& getDisplayName() const;
- const std::string& getSearchableName() const { return mSearchableName; }
-
- std::string getSearchableDescription() const;
- std::string getSearchableCreatorName() const;
- std::string getSearchableUUIDString() const;
-
- virtual PermissionMask getPermissionMask() const;
- virtual LLFolderType::EType getPreferredType() const;
- virtual time_t getCreationDate() const;
+ virtual void clearDisplayName() { mDisplayName.clear(); }
+ virtual void restoreItem() {}
+ virtual void restoreToWorld() {}
+
+ //--------------------------------------------------------------------
+ // Inherited LLFolderViewModelItemInventory functions
+ //--------------------------------------------------------------------
+ virtual const std::string& getName() const;
+ virtual const std::string& getDisplayName() const;
+ const std::string& getSearchableName() const { return mSearchableName; }
+
+ std::string getSearchableDescription() const;
+ std::string getSearchableCreatorName() const;
+ std::string getSearchableUUIDString() const;
+
+ virtual PermissionMask getPermissionMask() const;
+ virtual LLFolderType::EType getPreferredType() const;
+ virtual time_t getCreationDate() const;
virtual void setCreationDate(time_t creation_date_utc);
- virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
- virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
- virtual void openItem() {}
- virtual void closeItem() {}
+ virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
+ virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
+ virtual void openItem() {}
+ virtual void closeItem() {}
virtual void navigateToFolder(bool new_window = false, bool change_mode = false);
- virtual void showProperties();
- virtual BOOL isItemRenameable() const { return TRUE; }
- virtual BOOL isMultiPreviewAllowed() { return TRUE; }
- //virtual BOOL renameItem(const std::string& new_name) {}
- virtual BOOL isItemRemovable() const;
- virtual BOOL isItemMovable() const;
- virtual BOOL isItemInTrash() const;
+ virtual void showProperties();
+ virtual BOOL isItemRenameable() const { return TRUE; }
+ virtual BOOL isMultiPreviewAllowed() { return TRUE; }
+ //virtual BOOL renameItem(const std::string& new_name) {}
+ virtual BOOL isItemRemovable() const;
+ virtual BOOL isItemMovable() const;
+ virtual BOOL isItemInTrash() const;
virtual bool isItemInOutfits() const;
- virtual BOOL isLink() const;
- virtual BOOL isLibraryItem() const;
- //virtual BOOL removeItem() = 0;
- virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch);
- virtual void move(LLFolderViewModelItem* new_parent_bridge) {}
+ virtual BOOL isLink() const;
+ virtual BOOL isLibraryItem() const;
+ //virtual BOOL removeItem() = 0;
+ virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch);
+ virtual void move(LLFolderViewModelItem* new_parent_bridge) {}
virtual bool isItemCopyable(bool can_copy_as_link = true) const { return false; }
- virtual BOOL copyToClipboard() const;
- virtual BOOL cutToClipboard();
- virtual bool isCutToClipboard();
- virtual BOOL isClipboardPasteable() const;
- virtual BOOL isClipboardPasteableAsLink() const;
- virtual void pasteFromClipboard() {}
- virtual void pasteLinkFromClipboard() {}
- void getClipboardEntries(bool show_asset_id, menuentry_vec_t &items,
- menuentry_vec_t &disabled_items, U32 flags);
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual BOOL copyToClipboard() const;
+ virtual BOOL cutToClipboard();
+ virtual bool isCutToClipboard();
+ virtual BOOL isClipboardPasteable() const;
+ virtual BOOL isClipboardPasteableAsLink() const;
+ virtual void pasteFromClipboard() {}
+ virtual void pasteLinkFromClipboard() {}
+ void getClipboardEntries(bool show_asset_id, menuentry_vec_t &items,
+ menuentry_vec_t &disabled_items, U32 flags);
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
virtual LLToolDragAndDrop::ESource getDragSource() const;
- virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
- virtual BOOL dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg) { return FALSE; }
- virtual LLInventoryType::EType getInventoryType() const { return mInvType; }
- virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; }
+ virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
+ virtual BOOL dragOrDrop(MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg) { return FALSE; }
+ virtual LLInventoryType::EType getInventoryType() const { return mInvType; }
+ virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; }
virtual LLSettingsType::type_e getSettingsType() const { return LLSettingsType::ST_NONE; }
EInventorySortGroup getSortGroup() const { return SG_ITEM; }
- virtual LLInventoryObject* getInventoryObject() const;
+ virtual LLInventoryObject* getInventoryObject() const;
- //--------------------------------------------------------------------
- // Convenience functions for adding various common menu options.
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Convenience functions for adding various common menu options.
+ //--------------------------------------------------------------------
protected:
- virtual void addTrashContextMenuOptions(menuentry_vec_t &items,
- menuentry_vec_t &disabled_items);
- virtual void addDeleteContextMenuOptions(menuentry_vec_t &items,
- menuentry_vec_t &disabled_items);
- virtual void addOpenRightClickMenuOption(menuentry_vec_t &items);
- virtual void addMarketplaceContextMenuOptions(U32 flags,
- menuentry_vec_t &items,
- menuentry_vec_t &disabled_items);
- virtual void addLinkReplaceMenuOption(menuentry_vec_t& items,
- menuentry_vec_t& disabled_items);
+ virtual void addTrashContextMenuOptions(menuentry_vec_t &items,
+ menuentry_vec_t &disabled_items);
+ virtual void addDeleteContextMenuOptions(menuentry_vec_t &items,
+ menuentry_vec_t &disabled_items);
+ virtual void addOpenRightClickMenuOption(menuentry_vec_t &items);
+ virtual void addMarketplaceContextMenuOptions(U32 flags,
+ menuentry_vec_t &items,
+ menuentry_vec_t &disabled_items);
+ virtual void addLinkReplaceMenuOption(menuentry_vec_t& items,
+ menuentry_vec_t& disabled_items);
protected:
- LLInvFVBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid);
-
- LLInventoryModel* getInventoryModel() const;
- LLInventoryFilter* getInventoryFilter() const;
-
- BOOL isLinkedObjectInTrash() const; // Is this obj or its baseobj in the trash?
- BOOL isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory?
-
- BOOL isAgentInventory() const; // false if lost or in the inventory library
- BOOL isCOFFolder() const; // true if COF or descendant of
- BOOL isInboxFolder() const; // true if COF or descendant of marketplace inbox
-
- BOOL isMarketplaceListingsFolder() const; // true if descendant of Marketplace listings folder
-
- virtual BOOL isItemPermissive() const;
- static void changeItemParent(LLInventoryModel* model,
- LLViewerInventoryItem* item,
- const LLUUID& new_parent,
- BOOL restamp);
- static void changeCategoryParent(LLInventoryModel* model,
- LLViewerInventoryCategory* item,
- const LLUUID& new_parent,
- BOOL restamp);
- void removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& batch);
-
+ LLInvFVBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid);
+
+ LLInventoryModel* getInventoryModel() const;
+ LLInventoryFilter* getInventoryFilter() const;
+
+ BOOL isLinkedObjectInTrash() const; // Is this obj or its baseobj in the trash?
+ BOOL isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory?
+
+ BOOL isAgentInventory() const; // false if lost or in the inventory library
+ BOOL isCOFFolder() const; // true if COF or descendant of
+ BOOL isInboxFolder() const; // true if COF or descendant of marketplace inbox
+
+ BOOL isMarketplaceListingsFolder() const; // true if descendant of Marketplace listings folder
+
+ virtual BOOL isItemPermissive() const;
+ static void changeItemParent(LLInventoryModel* model,
+ LLViewerInventoryItem* item,
+ const LLUUID& new_parent,
+ BOOL restamp);
+ static void changeCategoryParent(LLInventoryModel* model,
+ LLViewerInventoryCategory* item,
+ const LLUUID& new_parent,
+ BOOL restamp);
+ void removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& batch);
+
BOOL callback_cutToClipboard(const LLSD& notification, const LLSD& response);
BOOL perform_cutToClipboard();
- LLHandle<LLInventoryPanel> mInventoryPanel;
- LLFolderView* mRoot;
- const LLUUID mUUID; // item id
- LLInventoryType::EType mInvType;
- bool mIsLink;
- LLTimer mTimeSinceRequestStart;
- mutable std::string mDisplayName;
- mutable std::string mSearchableName;
-
- void purgeItem(LLInventoryModel *model, const LLUUID &uuid);
- void removeObject(LLInventoryModel *model, const LLUUID &uuid);
- virtual void buildDisplayName() const {}
+ LLHandle<LLInventoryPanel> mInventoryPanel;
+ LLFolderView* mRoot;
+ const LLUUID mUUID; // item id
+ LLInventoryType::EType mInvType;
+ bool mIsLink;
+ LLTimer mTimeSinceRequestStart;
+ mutable std::string mDisplayName;
+ mutable std::string mSearchableName;
+
+ void purgeItem(LLInventoryModel *model, const LLUUID &uuid);
+ void removeObject(LLInventoryModel *model, const LLUUID &uuid);
+ virtual void buildDisplayName() const {}
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -214,169 +214,169 @@ protected:
class LLInventoryFolderViewModelBuilder
{
public:
- LLInventoryFolderViewModelBuilder() {}
- virtual ~LLInventoryFolderViewModelBuilder() {}
- virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
- LLAssetType::EType actual_asset_type,
- LLInventoryType::EType inv_type,
- LLInventoryPanel* inventory,
- LLFolderViewModelInventory* view_model,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags = 0x00) const;
+ LLInventoryFolderViewModelBuilder() {}
+ virtual ~LLInventoryFolderViewModelBuilder() {}
+ virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderViewModelInventory* view_model,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags = 0x00) const;
};
class LLItemBridge : public LLInvFVBridge
{
public:
- LLItemBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLInvFVBridge(inventory, root, uuid) {}
-
- typedef boost::function<void(std::string& slurl)> slurl_callback_t;
-
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void selectItem();
- virtual void restoreItem();
- virtual void restoreToWorld();
- virtual void gotoItem();
- virtual LLUIImagePtr getIcon() const;
- virtual std::string getLabelSuffix() const;
- virtual LLFontGL::StyleFlags getLabelStyle() const;
- virtual PermissionMask getPermissionMask() const;
- virtual time_t getCreationDate() const;
- virtual BOOL isItemRenameable() const;
- virtual BOOL renameItem(const std::string& new_name);
- virtual BOOL removeItem();
+ LLItemBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLInvFVBridge(inventory, root, uuid) {}
+
+ typedef boost::function<void(std::string& slurl)> slurl_callback_t;
+
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void selectItem();
+ virtual void restoreItem();
+ virtual void restoreToWorld();
+ virtual void gotoItem();
+ virtual LLUIImagePtr getIcon() const;
+ virtual std::string getLabelSuffix() const;
+ virtual LLFontGL::StyleFlags getLabelStyle() const;
+ virtual PermissionMask getPermissionMask() const;
+ virtual time_t getCreationDate() const;
+ virtual BOOL isItemRenameable() const;
+ virtual BOOL renameItem(const std::string& new_name);
+ virtual BOOL removeItem();
virtual bool isItemCopyable(bool can_copy_as_link = true) const;
- virtual bool hasChildren() const { return FALSE; }
- virtual BOOL isUpToDate() const { return TRUE; }
- virtual LLUIImagePtr getIconOverlay() const;
+ virtual bool hasChildren() const { return FALSE; }
+ virtual BOOL isUpToDate() const { return TRUE; }
+ virtual LLUIImagePtr getIconOverlay() const;
- LLViewerInventoryItem* getItem() const;
+ LLViewerInventoryItem* getItem() const;
virtual const LLUUID& getThumbnailUUID() const;
protected:
- BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response);
- virtual BOOL isItemPermissive() const;
- virtual void buildDisplayName() const;
- void doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb);
+ BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response);
+ virtual BOOL isItemPermissive() const;
+ virtual void buildDisplayName() const;
+ void doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb);
private:
- void doShowOnMap(LLLandmark* landmark);
+ void doShowOnMap(LLLandmark* landmark);
};
class LLFolderBridge : public LLInvFVBridge
{
public:
- LLFolderBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid)
- : LLInvFVBridge(inventory, root, uuid),
- mCallingCards(FALSE),
- mWearables(FALSE),
- mIsLoading(false),
- mShowDescendantsCount(false)
- {}
-
- BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg, BOOL user_confirm = TRUE, LLPointer<LLInventoryCallback> cb = NULL);
- BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop, std::string& tooltip_msg, BOOL is_link = FALSE, BOOL user_confirm = TRUE, LLPointer<LLInventoryCallback> cb = NULL);
+ LLFolderBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid)
+ : LLInvFVBridge(inventory, root, uuid),
+ mCallingCards(FALSE),
+ mWearables(FALSE),
+ mIsLoading(false),
+ mShowDescendantsCount(false)
+ {}
+
+ BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg, BOOL user_confirm = TRUE, LLPointer<LLInventoryCallback> cb = NULL);
+ BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop, std::string& tooltip_msg, BOOL is_link = FALSE, BOOL user_confirm = TRUE, LLPointer<LLInventoryCallback> cb = NULL);
void callback_dropItemIntoFolder(const LLSD& notification, const LLSD& response, LLInventoryItem* inv_item);
void callback_dropCategoryIntoFolder(const LLSD& notification, const LLSD& response, LLInventoryCategory* inv_category);
virtual void buildDisplayName() const;
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void openItem();
- virtual void closeItem();
- virtual BOOL isItemRenameable() const;
- virtual void selectItem();
- virtual void restoreItem();
-
- virtual LLFolderType::EType getPreferredType() const;
- virtual LLUIImagePtr getIcon() const;
- virtual LLUIImagePtr getIconOpen() const;
- virtual LLUIImagePtr getIconOverlay() const;
- static LLUIImagePtr getIcon(LLFolderType::EType preferred_type);
- virtual std::string getLabelSuffix() const;
- virtual LLFontGL::StyleFlags getLabelStyle() const;
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void openItem();
+ virtual void closeItem();
+ virtual BOOL isItemRenameable() const;
+ virtual void selectItem();
+ virtual void restoreItem();
+
+ virtual LLFolderType::EType getPreferredType() const;
+ virtual LLUIImagePtr getIcon() const;
+ virtual LLUIImagePtr getIconOpen() const;
+ virtual LLUIImagePtr getIconOverlay() const;
+ static LLUIImagePtr getIcon(LLFolderType::EType preferred_type);
+ virtual std::string getLabelSuffix() const;
+ virtual LLFontGL::StyleFlags getLabelStyle() const;
virtual const LLUUID& getThumbnailUUID() const;
- void setShowDescendantsCount(bool show_count) {mShowDescendantsCount = show_count;}
+ void setShowDescendantsCount(bool show_count) {mShowDescendantsCount = show_count;}
- virtual BOOL renameItem(const std::string& new_name);
+ virtual BOOL renameItem(const std::string& new_name);
- virtual BOOL removeItem();
- BOOL removeSystemFolder();
- bool removeItemResponse(const LLSD& notification, const LLSD& response);
+ virtual BOOL removeItem();
+ BOOL removeSystemFolder();
+ bool removeItemResponse(const LLSD& notification, const LLSD& response);
void updateHierarchyCreationDate(time_t date);
- virtual void pasteFromClipboard();
- virtual void pasteLinkFromClipboard();
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual bool hasChildren() const;
- virtual BOOL dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg);
-
- virtual BOOL isItemRemovable() const;
- virtual BOOL isItemMovable() const ;
- virtual BOOL isUpToDate() const;
+ virtual void pasteFromClipboard();
+ virtual void pasteLinkFromClipboard();
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual bool hasChildren() const;
+ virtual BOOL dragOrDrop(MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg);
+
+ virtual BOOL isItemRemovable() const;
+ virtual BOOL isItemMovable() const ;
+ virtual BOOL isUpToDate() const;
virtual bool isItemCopyable(bool can_copy_as_link = true) const;
- virtual BOOL isClipboardPasteable() const;
- virtual BOOL isClipboardPasteableAsLink() const;
-
- EInventorySortGroup getSortGroup() const;
- virtual void update();
+ virtual BOOL isClipboardPasteable() const;
+ virtual BOOL isClipboardPasteableAsLink() const;
+
+ EInventorySortGroup getSortGroup() const;
+ virtual void update();
- static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
+ static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
- LLViewerInventoryCategory* getCategory() const;
- LLHandle<LLFolderBridge> getHandle() { mHandle.bind(this); return mHandle; }
+ LLViewerInventoryCategory* getCategory() const;
+ LLHandle<LLFolderBridge> getHandle() { mHandle.bind(this); return mHandle; }
- bool isLoading() { return mIsLoading; }
+ bool isLoading() { return mIsLoading; }
protected:
- void buildContextMenuOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items);
- void buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items);
+ void buildContextMenuOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items);
+ void buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items);
void addOpenFolderMenuOptions(U32 flags, menuentry_vec_t& items);
- //--------------------------------------------------------------------
- // Menu callbacks
- //--------------------------------------------------------------------
- static void pasteClipboard(void* user_data);
- static void createNewShirt(void* user_data);
- static void createNewPants(void* user_data);
- static void createNewShoes(void* user_data);
- static void createNewSocks(void* user_data);
- static void createNewJacket(void* user_data);
- static void createNewSkirt(void* user_data);
- static void createNewGloves(void* user_data);
- static void createNewUndershirt(void* user_data);
- static void createNewUnderpants(void* user_data);
- static void createNewShape(void* user_data);
- static void createNewSkin(void* user_data);
- static void createNewHair(void* user_data);
- static void createNewEyes(void* user_data);
-
- BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck);
-
- void modifyOutfit(BOOL append);
- void copyOutfitToClipboard();
- void determineFolderType();
-
- void dropToFavorites(LLInventoryItem* inv_item, LLPointer<LLInventoryCallback> cb = NULL);
- void dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit, LLPointer<LLInventoryCallback> cb = NULL);
- void dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointer<LLInventoryCallback> cb = NULL);
-
- //--------------------------------------------------------------------
- // Messy hacks for handling folder options
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Menu callbacks
+ //--------------------------------------------------------------------
+ static void pasteClipboard(void* user_data);
+ static void createNewShirt(void* user_data);
+ static void createNewPants(void* user_data);
+ static void createNewShoes(void* user_data);
+ static void createNewSocks(void* user_data);
+ static void createNewJacket(void* user_data);
+ static void createNewSkirt(void* user_data);
+ static void createNewGloves(void* user_data);
+ static void createNewUndershirt(void* user_data);
+ static void createNewUnderpants(void* user_data);
+ static void createNewShape(void* user_data);
+ static void createNewSkin(void* user_data);
+ static void createNewHair(void* user_data);
+ static void createNewEyes(void* user_data);
+
+ BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck);
+
+ void modifyOutfit(BOOL append);
+ void copyOutfitToClipboard();
+ void determineFolderType();
+
+ void dropToFavorites(LLInventoryItem* inv_item, LLPointer<LLInventoryCallback> cb = NULL);
+ void dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit, LLPointer<LLInventoryCallback> cb = NULL);
+ void dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointer<LLInventoryCallback> cb = NULL);
+
+ //--------------------------------------------------------------------
+ // Messy hacks for handling folder options
+ //--------------------------------------------------------------------
public:
- static LLHandle<LLFolderBridge> sSelf;
- static void staticFolderOptionsMenu();
+ static LLHandle<LLFolderBridge> sSelf;
+ static void staticFolderOptionsMenu();
protected:
void outfitFolderCreatedCallback(LLUUID cat_source_id, LLUUID cat_dest_id, LLPointer<LLInventoryCallback> cb);
@@ -385,31 +385,31 @@ protected:
void gatherMessage(std::string& message, S32 depth, LLError::ELevel log_level);
LLUIImagePtr getFolderIcon(BOOL is_open) const;
- bool mCallingCards;
- bool mWearables;
- bool mIsLoading;
- bool mShowDescendantsCount;
- LLTimer mTimeSinceRequestStart;
+ bool mCallingCards;
+ bool mWearables;
+ bool mIsLoading;
+ bool mShowDescendantsCount;
+ LLTimer mTimeSinceRequestStart;
std::string mMessage;
- LLRootHandle<LLFolderBridge> mHandle;
+ LLRootHandle<LLFolderBridge> mHandle;
};
class LLTextureBridge : public LLItemBridge
{
public:
- LLTextureBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- LLInventoryType::EType type) :
- LLItemBridge(inventory, root, uuid)
- {
- mInvType = type;
- }
- virtual LLUIImagePtr getIcon() const;
- virtual void openItem();
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual void performAction(LLInventoryModel* model, std::string action);
- bool canSaveTexture(void);
+ LLTextureBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ LLInventoryType::EType type) :
+ LLItemBridge(inventory, root, uuid)
+ {
+ mInvType = type;
+ }
+ virtual LLUIImagePtr getIcon() const;
+ virtual void openItem();
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ bool canSaveTexture(void);
void setFileName(const std::string& file_name) { mFileName = file_name; }
protected:
std::string mFileName;
@@ -418,205 +418,205 @@ protected:
class LLSoundBridge : public LLItemBridge
{
public:
- LLSoundBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLItemBridge(inventory, root, uuid) {}
- virtual void openItem();
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual void performAction(LLInventoryModel* model, std::string action);
- static void openSoundPreview(void*);
+ LLSoundBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
+ virtual void openItem();
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ static void openSoundPreview(void*);
};
class LLLandmarkBridge : public LLItemBridge
{
public:
- LLLandmarkBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags = 0x00);
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual LLUIImagePtr getIcon() const;
- virtual void openItem();
+ LLLandmarkBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags = 0x00);
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual LLUIImagePtr getIcon() const;
+ virtual void openItem();
protected:
- BOOL mVisited;
+ BOOL mVisited;
};
class LLCallingCardBridge : public LLItemBridge
{
public:
- LLCallingCardBridge(LLInventoryPanel* inventory,
- LLFolderView* folder,
- const LLUUID& uuid );
- ~LLCallingCardBridge();
- virtual std::string getLabelSuffix() const;
- //virtual const std::string& getDisplayName() const;
- virtual LLUIImagePtr getIcon() const;
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void openItem();
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual BOOL dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg);
- void refreshFolderViewItem();
- void checkSearchBySuffixChanges();
+ LLCallingCardBridge(LLInventoryPanel* inventory,
+ LLFolderView* folder,
+ const LLUUID& uuid );
+ ~LLCallingCardBridge();
+ virtual std::string getLabelSuffix() const;
+ //virtual const std::string& getDisplayName() const;
+ virtual LLUIImagePtr getIcon() const;
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void openItem();
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual BOOL dragOrDrop(MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg);
+ void refreshFolderViewItem();
+ void checkSearchBySuffixChanges();
protected:
- LLCallingCardObserver* mObserver;
+ LLCallingCardObserver* mObserver;
LLUUID mCreatorUUID;
};
class LLNotecardBridge : public LLItemBridge
{
public:
- LLNotecardBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLItemBridge(inventory, root, uuid) {}
- virtual void openItem();
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ LLNotecardBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
+ virtual void openItem();
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
};
class LLGestureBridge : public LLItemBridge
{
public:
- LLGestureBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLItemBridge(inventory, root, uuid) {}
- // Only suffix for gesture items, not task items, because only
- // gestures in your inventory can be active.
- virtual LLFontGL::StyleFlags getLabelStyle() const;
- virtual std::string getLabelSuffix() const;
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void openItem();
- virtual BOOL removeItem();
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- static void playGesture(const LLUUID& item_id);
+ LLGestureBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
+ // Only suffix for gesture items, not task items, because only
+ // gestures in your inventory can be active.
+ virtual LLFontGL::StyleFlags getLabelStyle() const;
+ virtual std::string getLabelSuffix() const;
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void openItem();
+ virtual BOOL removeItem();
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ static void playGesture(const LLUUID& item_id);
};
class LLAnimationBridge : public LLItemBridge
{
public:
- LLAnimationBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLItemBridge(inventory, root, uuid) {}
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual void openItem();
+ LLAnimationBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual void openItem();
};
class LLObjectBridge : public LLItemBridge
{
public:
- LLObjectBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- LLInventoryType::EType type,
- U32 flags);
- virtual LLUIImagePtr getIcon() const;
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void openItem();
+ LLObjectBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ LLInventoryType::EType type,
+ U32 flags);
+ virtual LLUIImagePtr getIcon() const;
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void openItem();
virtual BOOL isItemWearable() const { return TRUE; }
- virtual std::string getLabelSuffix() const;
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual BOOL renameItem(const std::string& new_name);
- LLInventoryObject* getObject() const;
+ virtual std::string getLabelSuffix() const;
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual BOOL renameItem(const std::string& new_name);
+ LLInventoryObject* getObject() const;
protected:
- static LLUUID sContextMenuItemID; // Only valid while the context menu is open.
- U32 mAttachPt;
- BOOL mIsMultiObject;
+ static LLUUID sContextMenuItemID; // Only valid while the context menu is open.
+ U32 mAttachPt;
+ BOOL mIsMultiObject;
};
class LLLSLTextBridge : public LLItemBridge
{
public:
- LLLSLTextBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid ) :
- LLItemBridge(inventory, root, uuid) {}
- virtual void openItem();
+ LLLSLTextBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid ) :
+ LLItemBridge(inventory, root, uuid) {}
+ virtual void openItem();
};
class LLWearableBridge : public LLItemBridge
{
public:
- LLWearableBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- LLAssetType::EType asset_type,
- LLInventoryType::EType inv_type,
- LLWearableType::EType wearable_type);
- virtual LLUIImagePtr getIcon() const;
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void openItem();
+ LLWearableBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ LLAssetType::EType asset_type,
+ LLInventoryType::EType inv_type,
+ LLWearableType::EType wearable_type);
+ virtual LLUIImagePtr getIcon() const;
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void openItem();
virtual BOOL isItemWearable() const { return TRUE; }
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual std::string getLabelSuffix() const;
- virtual BOOL renameItem(const std::string& new_name);
- virtual LLWearableType::EType getWearableType() const { return mWearableType; }
-
- static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu
- static BOOL canWearOnAvatar( void* userdata );
- static void onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata );
- void wearOnAvatar();
-
- static void onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata );
- void wearAddOnAvatar();
-
- static BOOL canEditOnAvatar( void* userdata ); // Access to editOnAvatar() from menu
- static void onEditOnAvatar( void* userdata );
- void editOnAvatar();
-
- static BOOL canRemoveFromAvatar( void* userdata );
- static void removeAllClothesFromAvatar();
- void removeFromAvatar();
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual std::string getLabelSuffix() const;
+ virtual BOOL renameItem(const std::string& new_name);
+ virtual LLWearableType::EType getWearableType() const { return mWearableType; }
+
+ static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu
+ static BOOL canWearOnAvatar( void* userdata );
+ static void onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata );
+ void wearOnAvatar();
+
+ static void onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata );
+ void wearAddOnAvatar();
+
+ static BOOL canEditOnAvatar( void* userdata ); // Access to editOnAvatar() from menu
+ static void onEditOnAvatar( void* userdata );
+ void editOnAvatar();
+
+ static BOOL canRemoveFromAvatar( void* userdata );
+ static void removeAllClothesFromAvatar();
+ void removeFromAvatar();
protected:
- LLAssetType::EType mAssetType;
- LLWearableType::EType mWearableType;
+ LLAssetType::EType mAssetType;
+ LLWearableType::EType mWearableType;
};
class LLLinkItemBridge : public LLItemBridge
{
public:
- LLLinkItemBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLItemBridge(inventory, root, uuid) {}
- virtual const std::string& getPrefix() { return sPrefix; }
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ LLLinkItemBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
+ virtual const std::string& getPrefix() { return sPrefix; }
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
protected:
- static std::string sPrefix;
+ static std::string sPrefix;
};
class LLUnknownItemBridge : public LLItemBridge
{
public:
- LLUnknownItemBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLItemBridge(inventory, root, uuid) {}
- virtual LLUIImagePtr getIcon() const;
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ LLUnknownItemBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
+ virtual LLUIImagePtr getIcon() const;
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
};
class LLLinkFolderBridge : public LLItemBridge
{
public:
- LLLinkFolderBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLItemBridge(inventory, root, uuid) {}
- virtual const std::string& getPrefix() { return sPrefix; }
- virtual LLUIImagePtr getIcon() const;
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void gotoItem();
+ LLLinkFolderBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
+ virtual const std::string& getPrefix() { return sPrefix; }
+ virtual LLUIImagePtr getIcon() const;
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void gotoItem();
protected:
- const LLUUID &getFolderID() const;
- static std::string sPrefix;
+ const LLUUID &getFolderID() const;
+ static std::string sPrefix;
};
@@ -628,10 +628,10 @@ public:
const LLUUID& uuid,
LLSettingsType::type_e settings_type);
virtual LLUIImagePtr getIcon() const;
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void openItem();
- virtual BOOL isMultiPreviewAllowed() { return FALSE; }
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void openItem();
+ virtual BOOL isMultiPreviewAllowed() { return FALSE; }
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
virtual BOOL renameItem(const std::string& new_name);
virtual BOOL isItemRenameable() const;
virtual LLSettingsType::type_e getSettingsType() const { return mSettingsType; }
@@ -658,31 +658,31 @@ public:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInvFVBridgeAction
//
-// This is an implementation class to be able to
+// This is an implementation class to be able to
// perform action to view inventory items.
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInvFVBridgeAction
{
public:
- // This method is a convenience function which creates the correct
- // type of bridge action based on some basic information.
- static LLInvFVBridgeAction* createAction(LLAssetType::EType asset_type,
- const LLUUID& uuid,
- LLInventoryModel* model);
- static void doAction(LLAssetType::EType asset_type,
- const LLUUID& uuid, LLInventoryModel* model);
- static void doAction(const LLUUID& uuid, LLInventoryModel* model);
-
- virtual void doIt() {};
- virtual ~LLInvFVBridgeAction() {} // need this because of warning on OSX
+ // This method is a convenience function which creates the correct
+ // type of bridge action based on some basic information.
+ static LLInvFVBridgeAction* createAction(LLAssetType::EType asset_type,
+ const LLUUID& uuid,
+ LLInventoryModel* model);
+ static void doAction(LLAssetType::EType asset_type,
+ const LLUUID& uuid, LLInventoryModel* model);
+ static void doAction(const LLUUID& uuid, LLInventoryModel* model);
+
+ virtual void doIt() {};
+ virtual ~LLInvFVBridgeAction() {} // need this because of warning on OSX
protected:
- LLInvFVBridgeAction(const LLUUID& id, LLInventoryModel* model) :
- mUUID(id), mModel(model) {}
- LLViewerInventoryItem* getItem() const;
+ LLInvFVBridgeAction(const LLUUID& id, LLInventoryModel* model) :
+ mUUID(id), mModel(model) {}
+ LLViewerInventoryItem* getItem() const;
protected:
- const LLUUID& mUUID; // item id
- LLInventoryModel* mModel;
+ const LLUUID& mUUID; // item id
+ LLInventoryModel* mModel;
};
@@ -693,36 +693,36 @@ protected:
// Overridden version of the Inventory-Folder-View-Bridge for Folders
class LLRecentItemsFolderBridge : public LLFolderBridge
{
- friend class LLInvFVBridgeAction;
+ friend class LLInvFVBridgeAction;
public:
- // Creates context menu for Folders related to Recent Inventory Panel.
- // Uses base logic and than removes from visible items "New..." menu items.
- LLRecentItemsFolderBridge(LLInventoryType::EType type,
- LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLFolderBridge(inventory, root, uuid)
- {
- mInvType = type;
- }
- /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
+ // Creates context menu for Folders related to Recent Inventory Panel.
+ // Uses base logic and than removes from visible items "New..." menu items.
+ LLRecentItemsFolderBridge(LLInventoryType::EType type,
+ LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLFolderBridge(inventory, root, uuid)
+ {
+ mInvType = type;
+ }
+ /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
};
// Bridge builder to create Inventory-Folder-View-Bridge for Recent Inventory Panel
class LLRecentInventoryBridgeBuilder : public LLInventoryFolderViewModelBuilder
{
public:
- LLRecentInventoryBridgeBuilder() {}
- // Overrides FolderBridge for Recent Inventory Panel.
- // It use base functionality for bridges other than FolderBridge.
- virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
- LLAssetType::EType actual_asset_type,
- LLInventoryType::EType inv_type,
- LLInventoryPanel* inventory,
- LLFolderViewModelInventory* view_model,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags = 0x00) const;
+ LLRecentInventoryBridgeBuilder() {}
+ // Overrides FolderBridge for Recent Inventory Panel.
+ // It use base functionality for bridges other than FolderBridge.
+ virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderViewModelInventory* view_model,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags = 0x00) const;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -733,15 +733,15 @@ class LLMarketplaceFolderBridge : public LLFolderBridge
{
public:
// Overloads some display related methods specific to folders in a marketplace floater context
- LLMarketplaceFolderBridge(LLInventoryPanel* inventory,
- LLFolderView* root,
+ LLMarketplaceFolderBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
const LLUUID& uuid);
-
- virtual LLUIImagePtr getIcon() const;
- virtual LLUIImagePtr getIconOpen() const;
- virtual std::string getLabelSuffix() const;
- virtual LLFontGL::StyleFlags getLabelStyle() const;
-
+
+ virtual LLUIImagePtr getIcon() const;
+ virtual LLUIImagePtr getIconOpen() const;
+ virtual std::string getLabelSuffix() const;
+ virtual LLFontGL::StyleFlags getLabelStyle() const;
+
private:
LLUIImagePtr getMarketplaceFolderIcon(BOOL is_open) const;
// Those members are mutable because they are cached variablse to speed up display, not a state variables
@@ -750,26 +750,26 @@ private:
};
-void rez_attachment(LLViewerInventoryItem* item,
- LLViewerJointAttachment* attachment,
- bool replace = false);
+void rez_attachment(LLViewerInventoryItem* item,
+ LLViewerJointAttachment* attachment,
+ bool replace = false);
// Move items from an in-world object's "Contents" folder to a specified
// folder in agent inventory.
-BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
- const LLUUID& category_id,
- BOOL drop,
- std::function<void(S32, void*, const LLMoveInv *)> callback = NULL,
- void* user_data = NULL,
- LLInventoryFilter* filter = NULL);
+BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
+ const LLUUID& category_id,
+ BOOL drop,
+ std::function<void(S32, void*, const LLMoveInv *)> callback = NULL,
+ void* user_data = NULL,
+ LLInventoryFilter* filter = NULL);
// Utility function to hide all entries except those in the list
// Can be called multiple times on the same menu (e.g. if multiple items
// are selected). If "append" is false, then only common enabled items
// are set as enabled.
-void hide_context_entries(LLMenuGL& menu,
- const menuentry_vec_t &entries_to_show,
- const menuentry_vec_t &disabled_entries);
+void hide_context_entries(LLMenuGL& menu,
+ const menuentry_vec_t &entries_to_show,
+ const menuentry_vec_t &disabled_entries);
// Helper functions to classify actions.
bool isAddAction(const std::string& action);
diff --git a/indra/newview/llinventoryclipboard.cpp b/indra/newview/llinventoryclipboard.cpp
index 53da34f448..d21e4da880 100644
--- a/indra/newview/llinventoryclipboard.cpp
+++ b/indra/newview/llinventoryclipboard.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventoryclipboard.cpp
* @brief LLInventoryClipboard class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,61 +47,61 @@ LLInventoryClipboard::LLInventoryClipboard()
LLInventoryClipboard::~LLInventoryClipboard()
{
- reset();
+ reset();
}
void LLInventoryClipboard::add(const LLUUID& object)
{
- mObjects.put(object);
+ mObjects.put(object);
}
// this stores a single inventory object
void LLInventoryClipboard::store(const LLUUID& object)
{
- reset();
- mObjects.put(object);
+ reset();
+ mObjects.put(object);
}
void LLInventoryClipboard::store(const LLDynamicArray<LLUUID>& inv_objects)
{
- reset();
- S32 count = inv_objects.count();
- for(S32 i = 0; i < count; i++)
- {
- mObjects.put(inv_objects[i]);
- }
+ reset();
+ S32 count = inv_objects.count();
+ for(S32 i = 0; i < count; i++)
+ {
+ mObjects.put(inv_objects[i]);
+ }
}
void LLInventoryClipboard::cut(const LLUUID& object)
{
- if(!mCutMode && !mObjects.empty())
- {
- //looks like there are some stored items, reset clipboard state
- reset();
- }
- mCutMode = true;
- add(object);
+ if(!mCutMode && !mObjects.empty())
+ {
+ //looks like there are some stored items, reset clipboard state
+ reset();
+ }
+ mCutMode = true;
+ add(object);
}
void LLInventoryClipboard::retrieve(LLDynamicArray<LLUUID>& inv_objects) const
{
- inv_objects.reset();
- S32 count = mObjects.count();
- for(S32 i = 0; i < count; i++)
- {
- inv_objects.put(mObjects[i]);
- }
+ inv_objects.reset();
+ S32 count = mObjects.count();
+ for(S32 i = 0; i < count; i++)
+ {
+ inv_objects.put(mObjects[i]);
+ }
}
void LLInventoryClipboard::reset()
{
- mObjects.reset();
- mCutMode = false;
+ mObjects.reset();
+ mCutMode = false;
}
// returns true if the clipboard has something pasteable in it.
BOOL LLInventoryClipboard::hasContents() const
{
- return (mObjects.count() > 0);
+ return (mObjects.count() > 0);
}
diff --git a/indra/newview/llinventoryclipboard.h b/indra/newview/llinventoryclipboard.h
index b9f1451e5c..487325d070 100644
--- a/indra/newview/llinventoryclipboard.h
+++ b/indra/newview/llinventoryclipboard.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventoryclipboard.h
* @brief LLInventoryClipboard class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,44 +42,44 @@
class LLInventoryClipboard
{
public:
- // calling this before main() is undefined
- static LLInventoryClipboard& instance() { return sInstance; }
+ // calling this before main() is undefined
+ static LLInventoryClipboard& instance() { return sInstance; }
- // this method adds to the current list.
- void add(const LLUUID& object);
+ // this method adds to the current list.
+ void add(const LLUUID& object);
- // this stores a single inventory object
- void store(const LLUUID& object);
+ // this stores a single inventory object
+ void store(const LLUUID& object);
- // this method stores an array of objects
- void store(const LLDynamicArray<LLUUID>& inventory_objects);
+ // this method stores an array of objects
+ void store(const LLDynamicArray<LLUUID>& inventory_objects);
- void cut(const LLUUID& object);
- // this method gets the objects in the clipboard by copying them
- // into the array provided.
- void retrieve(LLDynamicArray<LLUUID>& inventory_objects) const;
+ void cut(const LLUUID& object);
+ // this method gets the objects in the clipboard by copying them
+ // into the array provided.
+ void retrieve(LLDynamicArray<LLUUID>& inventory_objects) const;
- // this method empties out the clipboard
- void reset();
+ // this method empties out the clipboard
+ void reset();
- // returns true if the clipboard has something pasteable in it.
- BOOL hasContents() const;
- bool isCutMode() const { return mCutMode; }
+ // returns true if the clipboard has something pasteable in it.
+ BOOL hasContents() const;
+ bool isCutMode() const { return mCutMode; }
protected:
- static LLInventoryClipboard sInstance;
+ static LLInventoryClipboard sInstance;
- LLDynamicArray<LLUUID> mObjects;
- bool mCutMode;
+ LLDynamicArray<LLUUID> mObjects;
+ bool mCutMode;
public:
- // please don't actually call these
- LLInventoryClipboard();
- ~LLInventoryClipboard();
+ // please don't actually call these
+ LLInventoryClipboard();
+ ~LLInventoryClipboard();
private:
- // please don't implement these
- LLInventoryClipboard(const LLInventoryClipboard&);
- LLInventoryClipboard& operator=(const LLInventoryClipboard&);
+ // please don't implement these
+ LLInventoryClipboard(const LLInventoryClipboard&);
+ LLInventoryClipboard& operator=(const LLInventoryClipboard&);
};
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 332c6d3085..b9ce90ff7b 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llinventoryfilter.cpp
* @brief Support for filtering your inventory to only display a subset of the
* available items.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,22 +49,22 @@
#include "lltrans.h"
LLInventoryFilter::FilterOps::FilterOps(const Params& p)
-: mFilterObjectTypes(p.object_types),
- mFilterCategoryTypes(p.category_types),
- mFilterWearableTypes(p.wearable_types),
+: mFilterObjectTypes(p.object_types),
+ mFilterCategoryTypes(p.category_types),
+ mFilterWearableTypes(p.wearable_types),
mFilterSettingsTypes(p.settings_types),
- mMinDate(p.date_range.min_date),
- mMaxDate(p.date_range.max_date),
- mHoursAgo(p.hours_ago),
- mDateSearchDirection(p.date_search_direction),
- mShowFolderState(p.show_folder_state),
- mFilterCreatorType(p.creator_type),
- mPermissions(p.permissions),
- mFilterTypes(p.types),
- mFilterUUID(p.uuid),
- mFilterLinks(p.links),
+ mMinDate(p.date_range.min_date),
+ mMaxDate(p.date_range.max_date),
+ mHoursAgo(p.hours_ago),
+ mDateSearchDirection(p.date_search_direction),
+ mShowFolderState(p.show_folder_state),
+ mFilterCreatorType(p.creator_type),
+ mPermissions(p.permissions),
+ mFilterTypes(p.types),
+ mFilterUUID(p.uuid),
+ mFilterLinks(p.links),
mFilterThumbnails(p.thumbnails),
- mSearchVisibility(p.search_visibility)
+ mSearchVisibility(p.search_visibility)
{
}
@@ -72,133 +72,133 @@ LLInventoryFilter::FilterOps::FilterOps(const Params& p)
/// Class LLInventoryFilter
///----------------------------------------------------------------------------
LLInventoryFilter::LLInventoryFilter(const Params& p)
-: mName(p.name),
- mFilterModified(FILTER_NONE),
- mEmptyLookupMessage("InventoryNoMatchingItems"),
- mDefaultEmptyLookupMessage(""),
- mFilterOps(p.filter_ops),
- mBackupFilterOps(mFilterOps),
- mFilterSubString(p.substring),
- mCurrentGeneration(0),
- mFirstRequiredGeneration(0),
- mFirstSuccessGeneration(0),
- mSearchType(SEARCHTYPE_NAME),
+: mName(p.name),
+ mFilterModified(FILTER_NONE),
+ mEmptyLookupMessage("InventoryNoMatchingItems"),
+ mDefaultEmptyLookupMessage(""),
+ mFilterOps(p.filter_ops),
+ mBackupFilterOps(mFilterOps),
+ mFilterSubString(p.substring),
+ mCurrentGeneration(0),
+ mFirstRequiredGeneration(0),
+ mFirstSuccessGeneration(0),
+ mSearchType(SEARCHTYPE_NAME),
mSingleFolderMode(false)
{
- // copy mFilterOps into mDefaultFilterOps
- markDefault();
- mUsername = gAgentUsername;
- LLStringUtil::toUpper(mUsername);
-}
-
-bool LLInventoryFilter::check(const LLFolderViewModelItem* item)
-{
- const LLFolderViewModelItemInventory* listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item);
-
- // If it's a folder and we're showing all folders, return automatically.
- const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY;
- if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS))
- {
- return true;
- }
-
- std::string desc = listener->getSearchableCreatorName();
- switch(mSearchType)
- {
- case SEARCHTYPE_CREATOR:
- desc = listener->getSearchableCreatorName();
- break;
- case SEARCHTYPE_DESCRIPTION:
- desc = listener->getSearchableDescription();
- break;
- case SEARCHTYPE_UUID:
- desc = listener->getSearchableUUIDString();
- break;
- case SEARCHTYPE_NAME:
- default:
- desc = listener->getSearchableName();
- break;
- }
-
-
- bool passed = true;
- if (!mExactToken.empty() && (mSearchType == SEARCHTYPE_NAME))
- {
- passed = false;
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep(" ");
- tokenizer tokens(desc, sep);
-
- for (auto token_iter : tokens)
- {
- if (token_iter == mExactToken)
- {
- passed = true;
- break;
- }
- }
- }
- else if ((mFilterTokens.size() > 0) && (mSearchType == SEARCHTYPE_NAME))
- {
- for (auto token_iter : mFilterTokens)
- {
- if (desc.find(token_iter) == std::string::npos)
- {
- return false;
- }
- }
- }
- else
- {
- passed = (mFilterSubString.size() ? desc.find(mFilterSubString) != std::string::npos : true);
- }
-
- passed = passed && checkAgainstFilterType(listener);
- passed = passed && checkAgainstPermissions(listener);
- passed = passed && checkAgainstFilterLinks(listener);
- passed = passed && checkAgainstCreator(listener);
- passed = passed && checkAgainstSearchVisibility(listener);
+ // copy mFilterOps into mDefaultFilterOps
+ markDefault();
+ mUsername = gAgentUsername;
+ LLStringUtil::toUpper(mUsername);
+}
+
+bool LLInventoryFilter::check(const LLFolderViewModelItem* item)
+{
+ const LLFolderViewModelItemInventory* listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item);
+
+ // If it's a folder and we're showing all folders, return automatically.
+ const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY;
+ if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS))
+ {
+ return true;
+ }
+
+ std::string desc = listener->getSearchableCreatorName();
+ switch(mSearchType)
+ {
+ case SEARCHTYPE_CREATOR:
+ desc = listener->getSearchableCreatorName();
+ break;
+ case SEARCHTYPE_DESCRIPTION:
+ desc = listener->getSearchableDescription();
+ break;
+ case SEARCHTYPE_UUID:
+ desc = listener->getSearchableUUIDString();
+ break;
+ case SEARCHTYPE_NAME:
+ default:
+ desc = listener->getSearchableName();
+ break;
+ }
+
+
+ bool passed = true;
+ if (!mExactToken.empty() && (mSearchType == SEARCHTYPE_NAME))
+ {
+ passed = false;
+ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+ boost::char_separator<char> sep(" ");
+ tokenizer tokens(desc, sep);
+
+ for (auto token_iter : tokens)
+ {
+ if (token_iter == mExactToken)
+ {
+ passed = true;
+ break;
+ }
+ }
+ }
+ else if ((mFilterTokens.size() > 0) && (mSearchType == SEARCHTYPE_NAME))
+ {
+ for (auto token_iter : mFilterTokens)
+ {
+ if (desc.find(token_iter) == std::string::npos)
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ passed = (mFilterSubString.size() ? desc.find(mFilterSubString) != std::string::npos : true);
+ }
+
+ passed = passed && checkAgainstFilterType(listener);
+ passed = passed && checkAgainstPermissions(listener);
+ passed = passed && checkAgainstFilterLinks(listener);
+ passed = passed && checkAgainstCreator(listener);
+ passed = passed && checkAgainstSearchVisibility(listener);
passed = passed && checkAgainstFilterThumbnails(listener->getUUID());
- return passed;
+ return passed;
}
bool LLInventoryFilter::check(const LLInventoryItem* item)
{
- const bool passed_string = (mFilterSubString.size() ? item->getName().find(mFilterSubString) != std::string::npos : true);
- const bool passed_filtertype = checkAgainstFilterType(item);
- const bool passed_permissions = checkAgainstPermissions(item);
+ const bool passed_string = (mFilterSubString.size() ? item->getName().find(mFilterSubString) != std::string::npos : true);
+ const bool passed_filtertype = checkAgainstFilterType(item);
+ const bool passed_permissions = checkAgainstPermissions(item);
- return passed_filtertype && passed_permissions && passed_string;
+ return passed_filtertype && passed_permissions && passed_string;
}
bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const
{
- const LLFolderViewModelItemInventory* listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item);
- if (!listener)
- {
- LL_ERRS() << "Folder view event listener not found." << LL_ENDL;
- return false;
- }
+ const LLFolderViewModelItemInventory* listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item);
+ if (!listener)
+ {
+ LL_ERRS() << "Folder view event listener not found." << LL_ENDL;
+ return false;
+ }
- const LLUUID folder_id = listener->getUUID();
+ const LLUUID folder_id = listener->getUUID();
- return checkFolder(folder_id);
+ return checkFolder(folder_id);
}
bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const
{
- // we're showing all folders, overriding filter
- if (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)
- {
- return true;
- }
+ // we're showing all folders, overriding filter
+ if (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)
+ {
+ return true;
+ }
- // when applying a filter, matching folders get their contents downloaded first
- // but make sure we are not interfering with pre-download
- if (isNotDefault()
- && LLStartUp::getStartupState() > STATE_WEARABLES_WAIT
+ // when applying a filter, matching folders get their contents downloaded first
+ // but make sure we are not interfering with pre-download
+ if (isNotDefault()
+ && LLStartUp::getStartupState() > STATE_WEARABLES_WAIT
&& !LLInventoryModelBackgroundFetch::instance().inventoryFetchInProgress())
{
LLViewerInventoryCategory* cat = gInventory.getCategory(folder_id);
@@ -214,14 +214,14 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const
// but if that is nesesary, do a forced scheduleFolderFetch.
cat->fetch();
}
- }
+ }
if (!checkAgainstFilterThumbnails(folder_id))
{
return false;
}
- // Marketplace folder filtering
+ // Marketplace folder filtering
const U32 filterTypes = mFilterOps.mFilterTypes;
const U32 marketplace_filter = FILTERTYPE_MARKETPLACE_ACTIVE | FILTERTYPE_MARKETPLACE_INACTIVE |
FILTERTYPE_MARKETPLACE_UNASSOCIATED | FILTERTYPE_MARKETPLACE_LISTING_FOLDER |
@@ -245,7 +245,7 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const
return false;
}
}
-
+
if (depth > 0)
{
LLUUID listing_uuid = nested_parent_id(folder_id, depth);
@@ -272,44 +272,44 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const
}
}
}
-
- // show folder links
- LLViewerInventoryItem* item = gInventory.getItem(folder_id);
- if (item && item->getActualType() == LLAssetType::AT_LINK_FOLDER)
- {
- return true;
- }
-
- if (mFilterOps.mFilterTypes & FILTERTYPE_CATEGORY)
- {
- // Can only filter categories for items in your inventory
- // (e.g. versus in-world object contents).
- const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id);
- if (!cat)
- return folder_id.isNull();
- LLFolderType::EType cat_type = cat->getPreferredType();
- if (cat_type != LLFolderType::FT_NONE && (1LL << cat_type & mFilterOps.mFilterCategoryTypes) == U64(0))
- return false;
- }
-
- return true;
+
+ // show folder links
+ LLViewerInventoryItem* item = gInventory.getItem(folder_id);
+ if (item && item->getActualType() == LLAssetType::AT_LINK_FOLDER)
+ {
+ return true;
+ }
+
+ if (mFilterOps.mFilterTypes & FILTERTYPE_CATEGORY)
+ {
+ // Can only filter categories for items in your inventory
+ // (e.g. versus in-world object contents).
+ const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id);
+ if (!cat)
+ return folder_id.isNull();
+ LLFolderType::EType cat_type = cat->getPreferredType();
+ if (cat_type != LLFolderType::FT_NONE && (1LL << cat_type & mFilterOps.mFilterCategoryTypes) == U64(0))
+ return false;
+ }
+
+ return true;
}
bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInventory* listener) const
{
- if (!listener) return FALSE;
+ if (!listener) return FALSE;
- LLInventoryType::EType object_type = listener->getInventoryType();
- const LLUUID object_id = listener->getUUID();
- const LLInventoryObject *object = gInventory.getObject(object_id);
+ LLInventoryType::EType object_type = listener->getInventoryType();
+ const LLUUID object_id = listener->getUUID();
+ const LLInventoryObject *object = gInventory.getObject(object_id);
- const U32 filterTypes = mFilterOps.mFilterTypes;
+ const U32 filterTypes = mFilterOps.mFilterTypes;
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_OBJECT
- // Pass if this item's type is of the correct filter type
- if (filterTypes & FILTERTYPE_OBJECT)
- {
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_OBJECT
+ // Pass if this item's type is of the correct filter type
+ if (filterTypes & FILTERTYPE_OBJECT)
+ {
switch (object_type)
{
case LLInventoryType::IT_NONE:
@@ -321,7 +321,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent
break;
case LLInventoryType::IT_UNKNOWN:
{
- // Unknows are only shown when we show every type.
+ // Unknows are only shown when we show every type.
// Unknows are 255 and won't fit in 64 bits.
if (mFilterOps.mFilterObjectTypes != 0xffffffffffffffffULL)
{
@@ -336,70 +336,70 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent
}
break;
}
- }
-
- if(filterTypes & FILTERTYPE_WORN)
- {
- if (!get_is_item_worn(object_id))
- {
- return FALSE;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_UUID
- // Pass if this item is the target UUID or if it links to the target UUID
- if (filterTypes & FILTERTYPE_UUID)
- {
- if (!object) return FALSE;
-
- if (object->getLinkedUUID() != mFilterOps.mFilterUUID)
- return FALSE;
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_DATE
- // Pass if this item is within the date range.
- if (filterTypes & FILTERTYPE_DATE)
- {
- const U16 HOURS_TO_SECONDS = 3600;
- time_t earliest = time_corrected() - mFilterOps.mHoursAgo * HOURS_TO_SECONDS;
-
- if (mFilterOps.mMinDate > time_min() && mFilterOps.mMinDate < earliest)
- {
- earliest = mFilterOps.mMinDate;
- }
- else if (!mFilterOps.mHoursAgo)
- {
- earliest = 0;
- }
-
- if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection || isSinceLogoff())
- {
- if (listener->getCreationDate() < earliest ||
- listener->getCreationDate() > mFilterOps.mMaxDate)
- return FALSE;
- }
- else
- {
- if (listener->getCreationDate() > earliest ||
- listener->getCreationDate() > mFilterOps.mMaxDate)
- return FALSE;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_WEARABLE
- // Pass if this item is a wearable of the appropriate type
- if (filterTypes & FILTERTYPE_WEARABLE)
- {
- LLWearableType::EType type = listener->getWearableType();
+ }
+
+ if(filterTypes & FILTERTYPE_WORN)
+ {
+ if (!get_is_item_worn(object_id))
+ {
+ return FALSE;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_UUID
+ // Pass if this item is the target UUID or if it links to the target UUID
+ if (filterTypes & FILTERTYPE_UUID)
+ {
+ if (!object) return FALSE;
+
+ if (object->getLinkedUUID() != mFilterOps.mFilterUUID)
+ return FALSE;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_DATE
+ // Pass if this item is within the date range.
+ if (filterTypes & FILTERTYPE_DATE)
+ {
+ const U16 HOURS_TO_SECONDS = 3600;
+ time_t earliest = time_corrected() - mFilterOps.mHoursAgo * HOURS_TO_SECONDS;
+
+ if (mFilterOps.mMinDate > time_min() && mFilterOps.mMinDate < earliest)
+ {
+ earliest = mFilterOps.mMinDate;
+ }
+ else if (!mFilterOps.mHoursAgo)
+ {
+ earliest = 0;
+ }
+
+ if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection || isSinceLogoff())
+ {
+ if (listener->getCreationDate() < earliest ||
+ listener->getCreationDate() > mFilterOps.mMaxDate)
+ return FALSE;
+ }
+ else
+ {
+ if (listener->getCreationDate() > earliest ||
+ listener->getCreationDate() > mFilterOps.mMaxDate)
+ return FALSE;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_WEARABLE
+ // Pass if this item is a wearable of the appropriate type
+ if (filterTypes & FILTERTYPE_WEARABLE)
+ {
+ LLWearableType::EType type = listener->getWearableType();
if ((object_type == LLInventoryType::IT_WEARABLE) &&
(((0x1LL << type) & mFilterOps.mFilterWearableTypes) == 0))
- {
- return FALSE;
- }
- }
+ {
+ return FALSE;
+ }
+ }
////////////////////////////////////////////////////////////////////////////////
// FILTERTYPE_SETTINGS
@@ -409,58 +409,58 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent
LLSettingsType::type_e type = listener->getSettingsType();
if ((object_type == LLInventoryType::IT_SETTINGS) &&
(((0x1LL << type) & mFilterOps.mFilterSettingsTypes) == 0))
- {
- return FALSE;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_EMPTYFOLDERS
- // Pass if this item is a folder and is not a system folder that should be hidden
- if (filterTypes & FILTERTYPE_EMPTYFOLDERS)
- {
- if (object_type == LLInventoryType::IT_CATEGORY)
- {
- bool is_hidden_if_empty = LLViewerFolderType::lookupIsHiddenIfEmpty(listener->getPreferredType());
- if (is_hidden_if_empty)
- {
- // Force the fetching of those folders so they are hidden if they really are empty...
- // But don't interfere with startup download
- if (LLStartUp::getStartupState() > STATE_WEARABLES_WAIT)
- {
- gInventory.fetchDescendentsOf(object_id);
- }
-
- LLInventoryModel::cat_array_t* cat_array = NULL;
- LLInventoryModel::item_array_t* item_array = NULL;
- gInventory.getDirectDescendentsOf(object_id,cat_array,item_array);
- S32 descendents_actual = 0;
- if(cat_array && item_array)
- {
- descendents_actual = cat_array->size() + item_array->size();
- }
- if (descendents_actual == 0)
- {
- return FALSE;
- }
- }
- }
- }
-
- return TRUE;
+ {
+ return FALSE;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_EMPTYFOLDERS
+ // Pass if this item is a folder and is not a system folder that should be hidden
+ if (filterTypes & FILTERTYPE_EMPTYFOLDERS)
+ {
+ if (object_type == LLInventoryType::IT_CATEGORY)
+ {
+ bool is_hidden_if_empty = LLViewerFolderType::lookupIsHiddenIfEmpty(listener->getPreferredType());
+ if (is_hidden_if_empty)
+ {
+ // Force the fetching of those folders so they are hidden if they really are empty...
+ // But don't interfere with startup download
+ if (LLStartUp::getStartupState() > STATE_WEARABLES_WAIT)
+ {
+ gInventory.fetchDescendentsOf(object_id);
+ }
+
+ LLInventoryModel::cat_array_t* cat_array = NULL;
+ LLInventoryModel::item_array_t* item_array = NULL;
+ gInventory.getDirectDescendentsOf(object_id,cat_array,item_array);
+ S32 descendents_actual = 0;
+ if(cat_array && item_array)
+ {
+ descendents_actual = cat_array->size() + item_array->size();
+ }
+ if (descendents_actual == 0)
+ {
+ return FALSE;
+ }
+ }
+ }
+ }
+
+ return TRUE;
}
bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) const
{
- LLInventoryType::EType object_type = item->getInventoryType();
+ LLInventoryType::EType object_type = item->getInventoryType();
- const U32 filterTypes = mFilterOps.mFilterTypes;
+ const U32 filterTypes = mFilterOps.mFilterTypes;
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_OBJECT
- // Pass if this item's type is of the correct filter type
- if (filterTypes & FILTERTYPE_OBJECT)
- {
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_OBJECT
+ // Pass if this item's type is of the correct filter type
+ if (filterTypes & FILTERTYPE_OBJECT)
+ {
switch (object_type)
{
case LLInventoryType::IT_NONE:
@@ -472,7 +472,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) cons
break;
case LLInventoryType::IT_UNKNOWN:
{
- // Unknows are only shown when we show every type.
+ // Unknows are only shown when we show every type.
// Unknows are 255 and won't fit in 64 bits.
if (mFilterOps.mFilterObjectTypes != 0xffffffffffffffffULL)
{
@@ -487,98 +487,98 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) cons
}
break;
}
- }
+ }
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_UUID
- // Pass if this item is the target UUID or if it links to the target UUID
- if (filterTypes & FILTERTYPE_UUID)
- {
- if (!item) return false;
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_UUID
+ // Pass if this item is the target UUID or if it links to the target UUID
+ if (filterTypes & FILTERTYPE_UUID)
+ {
+ if (!item) return false;
- if (item->getLinkedUUID() != mFilterOps.mFilterUUID)
- return false;
- }
+ if (item->getLinkedUUID() != mFilterOps.mFilterUUID)
+ return false;
+ }
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_DATE
- // Pass if this item is within the date range.
- if (filterTypes & FILTERTYPE_DATE)
- {
- // We don't get the updated item creation date for the task inventory or
- // a notecard embedded item. See LLTaskInvFVBridge::getCreationDate().
- return false;
- }
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_DATE
+ // Pass if this item is within the date range.
+ if (filterTypes & FILTERTYPE_DATE)
+ {
+ // We don't get the updated item creation date for the task inventory or
+ // a notecard embedded item. See LLTaskInvFVBridge::getCreationDate().
+ return false;
+ }
- return true;
+ return true;
}
-// Items and folders that are on the clipboard or, recursively, in a folder which
+// Items and folders that are on the clipboard or, recursively, in a folder which
// is on the clipboard must be filtered out if the clipboard is in the "cut" mode.
bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const
{
- if (LLClipboard::instance().isCutMode())
- {
+ if (LLClipboard::instance().isCutMode())
+ {
LL_PROFILE_ZONE_SCOPED;
- LLUUID current_id = object_id;
- LLInventoryObject *current_object = gInventory.getObject(object_id);
- while (current_id.notNull() && current_object)
- {
- if (LLClipboard::instance().isOnClipboard(current_id))
- {
- return false;
- }
- current_id = current_object->getParentUUID();
- if (current_id.notNull())
- {
- current_object = gInventory.getObject(current_id);
- }
- }
- }
- return true;
+ LLUUID current_id = object_id;
+ LLInventoryObject *current_object = gInventory.getObject(object_id);
+ while (current_id.notNull() && current_object)
+ {
+ if (LLClipboard::instance().isOnClipboard(current_id))
+ {
+ return false;
+ }
+ current_id = current_object->getParentUUID();
+ if (current_id.notNull())
+ {
+ current_object = gInventory.getObject(current_id);
+ }
+ }
+ }
+ return true;
}
bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewModelItemInventory* listener) const
{
- if (!listener) return FALSE;
+ if (!listener) return FALSE;
- PermissionMask perm = listener->getPermissionMask();
- const LLInvFVBridge *bridge = dynamic_cast<const LLInvFVBridge *>(listener);
- if (bridge && bridge->isLink())
- {
- const LLUUID& linked_uuid = gInventory.getLinkedItemID(bridge->getUUID());
- const LLViewerInventoryItem *linked_item = gInventory.getItem(linked_uuid);
- if (linked_item)
- perm = linked_item->getPermissionMask();
- }
- return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
+ PermissionMask perm = listener->getPermissionMask();
+ const LLInvFVBridge *bridge = dynamic_cast<const LLInvFVBridge *>(listener);
+ if (bridge && bridge->isLink())
+ {
+ const LLUUID& linked_uuid = gInventory.getLinkedItemID(bridge->getUUID());
+ const LLViewerInventoryItem *linked_item = gInventory.getItem(linked_uuid);
+ if (linked_item)
+ perm = linked_item->getPermissionMask();
+ }
+ return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
}
bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) const
{
- if (!item) return false;
+ if (!item) return false;
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- PermissionMask perm = new_item->getPermissionMask();
- new_item = NULL;
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ PermissionMask perm = new_item->getPermissionMask();
+ new_item = NULL;
- return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
+ return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
}
bool LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewModelItemInventory* listener) const
{
- if (!listener) return TRUE;
+ if (!listener) return TRUE;
- const LLUUID object_id = listener->getUUID();
- const LLInventoryObject *object = gInventory.getObject(object_id);
- if (!object) return TRUE;
+ const LLUUID object_id = listener->getUUID();
+ const LLInventoryObject *object = gInventory.getObject(object_id);
+ if (!object) return TRUE;
- const BOOL is_link = object->getIsLinkType();
- if (is_link && (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS))
- return FALSE;
- if (!is_link && (mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS))
- return FALSE;
- return TRUE;
+ const BOOL is_link = object->getIsLinkType();
+ if (is_link && (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS))
+ return FALSE;
+ if (!is_link && (mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS))
+ return FALSE;
+ return TRUE;
}
bool LLInventoryFilter::checkAgainstFilterThumbnails(const LLUUID& object_id) const
@@ -596,167 +596,167 @@ bool LLInventoryFilter::checkAgainstFilterThumbnails(const LLUUID& object_id) co
bool LLInventoryFilter::checkAgainstCreator(const LLFolderViewModelItemInventory* listener) const
{
- if (!listener) return TRUE;
- const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY;
- switch (mFilterOps.mFilterCreatorType)
- {
- case FILTERCREATOR_SELF:
- if(is_folder) return FALSE;
- return (listener->getSearchableCreatorName() == mUsername);
- case FILTERCREATOR_OTHERS:
- if(is_folder) return FALSE;
- return (listener->getSearchableCreatorName() != mUsername);
- case FILTERCREATOR_ALL:
- default:
- return TRUE;
- }
+ if (!listener) return TRUE;
+ const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY;
+ switch (mFilterOps.mFilterCreatorType)
+ {
+ case FILTERCREATOR_SELF:
+ if(is_folder) return FALSE;
+ return (listener->getSearchableCreatorName() == mUsername);
+ case FILTERCREATOR_OTHERS:
+ if(is_folder) return FALSE;
+ return (listener->getSearchableCreatorName() != mUsername);
+ case FILTERCREATOR_ALL:
+ default:
+ return TRUE;
+ }
}
bool LLInventoryFilter::checkAgainstSearchVisibility(const LLFolderViewModelItemInventory* listener) const
{
- if (!listener || !hasFilterString()) return TRUE;
+ if (!listener || !hasFilterString()) return TRUE;
- const LLUUID object_id = listener->getUUID();
- const LLInventoryObject *object = gInventory.getObject(object_id);
- if (!object) return TRUE;
+ const LLUUID object_id = listener->getUUID();
+ const LLInventoryObject *object = gInventory.getObject(object_id);
+ if (!object) return TRUE;
- const BOOL is_link = object->getIsLinkType();
- if (is_link && ((mFilterOps.mSearchVisibility & VISIBILITY_LINKS) == 0))
- return FALSE;
+ const BOOL is_link = object->getIsLinkType();
+ if (is_link && ((mFilterOps.mSearchVisibility & VISIBILITY_LINKS) == 0))
+ return FALSE;
if (listener->isItemInOutfits() && ((mFilterOps.mSearchVisibility & VISIBILITY_OUTFITS) == 0))
return FALSE;
- if (listener->isItemInTrash() && ((mFilterOps.mSearchVisibility & VISIBILITY_TRASH) == 0))
- return FALSE;
+ if (listener->isItemInTrash() && ((mFilterOps.mSearchVisibility & VISIBILITY_TRASH) == 0))
+ return FALSE;
- if (!listener->isAgentInventory() && ((mFilterOps.mSearchVisibility & VISIBILITY_LIBRARY) == 0))
- return FALSE;
+ if (!listener->isAgentInventory() && ((mFilterOps.mSearchVisibility & VISIBILITY_LIBRARY) == 0))
+ return FALSE;
- return TRUE;
+ return TRUE;
}
const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const
{
- return mFilterSubString;
+ return mFilterSubString;
}
std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewModelItem* item) const
{
- if (mSearchType == SEARCHTYPE_NAME)
- {
- return mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos;
- }
- else
- {
- return std::string::npos;
- }
+ if (mSearchType == SEARCHTYPE_NAME)
+ {
+ return mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos;
+ }
+ else
+ {
+ return std::string::npos;
+ }
}
bool LLInventoryFilter::isDefault() const
{
- return !isNotDefault();
+ return !isNotDefault();
}
// has user modified default filter params?
bool LLInventoryFilter::isNotDefault() const
{
- S32 not_default = 0;
+ S32 not_default = 0;
- not_default |= (mFilterOps.mFilterObjectTypes != mDefaultFilterOps.mFilterObjectTypes);
- not_default |= (mFilterOps.mFilterCategoryTypes != mDefaultFilterOps.mFilterCategoryTypes);
- not_default |= (mFilterOps.mFilterWearableTypes != mDefaultFilterOps.mFilterWearableTypes);
- not_default |= (mFilterOps.mFilterTypes != mDefaultFilterOps.mFilterTypes);
- not_default |= (mFilterOps.mFilterLinks != mDefaultFilterOps.mFilterLinks);
- not_default |= (mFilterSubString.size());
- not_default |= (mFilterOps.mPermissions != mDefaultFilterOps.mPermissions);
- not_default |= (mFilterOps.mMinDate != mDefaultFilterOps.mMinDate);
- not_default |= (mFilterOps.mMaxDate != mDefaultFilterOps.mMaxDate);
- not_default |= (mFilterOps.mHoursAgo != mDefaultFilterOps.mHoursAgo);
+ not_default |= (mFilterOps.mFilterObjectTypes != mDefaultFilterOps.mFilterObjectTypes);
+ not_default |= (mFilterOps.mFilterCategoryTypes != mDefaultFilterOps.mFilterCategoryTypes);
+ not_default |= (mFilterOps.mFilterWearableTypes != mDefaultFilterOps.mFilterWearableTypes);
+ not_default |= (mFilterOps.mFilterTypes != mDefaultFilterOps.mFilterTypes);
+ not_default |= (mFilterOps.mFilterLinks != mDefaultFilterOps.mFilterLinks);
+ not_default |= (mFilterSubString.size());
+ not_default |= (mFilterOps.mPermissions != mDefaultFilterOps.mPermissions);
+ not_default |= (mFilterOps.mMinDate != mDefaultFilterOps.mMinDate);
+ not_default |= (mFilterOps.mMaxDate != mDefaultFilterOps.mMaxDate);
+ not_default |= (mFilterOps.mHoursAgo != mDefaultFilterOps.mHoursAgo);
- return not_default != 0;
+ return not_default != 0;
}
bool LLInventoryFilter::isActive() const
{
- return mFilterOps.mFilterObjectTypes != 0xffffffffffffffffULL
- || mFilterOps.mFilterCategoryTypes != 0xffffffffffffffffULL
- || mFilterOps.mFilterWearableTypes != 0xffffffffffffffffULL
- || mFilterOps.mFilterTypes != FILTERTYPE_OBJECT
- || mFilterOps.mFilterLinks != FILTERLINK_INCLUDE_LINKS
- || mFilterSubString.size()
- || mFilterOps.mPermissions != PERM_NONE
- || mFilterOps.mMinDate != time_min()
- || mFilterOps.mMaxDate != time_max()
- || mFilterOps.mHoursAgo != 0;
+ return mFilterOps.mFilterObjectTypes != 0xffffffffffffffffULL
+ || mFilterOps.mFilterCategoryTypes != 0xffffffffffffffffULL
+ || mFilterOps.mFilterWearableTypes != 0xffffffffffffffffULL
+ || mFilterOps.mFilterTypes != FILTERTYPE_OBJECT
+ || mFilterOps.mFilterLinks != FILTERLINK_INCLUDE_LINKS
+ || mFilterSubString.size()
+ || mFilterOps.mPermissions != PERM_NONE
+ || mFilterOps.mMinDate != time_min()
+ || mFilterOps.mMaxDate != time_max()
+ || mFilterOps.mHoursAgo != 0;
}
bool LLInventoryFilter::isModified() const
{
- return mFilterModified != FILTER_NONE;
+ return mFilterModified != FILTER_NONE;
}
void LLInventoryFilter::updateFilterTypes(U64 types, U64& current_types)
{
- if (current_types != types)
- {
- // keep current items only if no type bits getting turned off
- bool fewer_bits_set = (current_types & ~types) != 0;
- bool more_bits_set = (~current_types & types) != 0;
-
- current_types = types;
- if (more_bits_set && fewer_bits_set)
- {
- // neither less or more restrictive, both simultaneously
- // so we need to filter from scratch
- setModified(FILTER_RESTART);
- }
- else if (more_bits_set)
- {
- // target is only one of all requested types so more type bits == less restrictive
- setModified(FILTER_LESS_RESTRICTIVE);
- }
- else if (fewer_bits_set)
- {
- setModified(FILTER_MORE_RESTRICTIVE);
- }
- }
+ if (current_types != types)
+ {
+ // keep current items only if no type bits getting turned off
+ bool fewer_bits_set = (current_types & ~types) != 0;
+ bool more_bits_set = (~current_types & types) != 0;
+
+ current_types = types;
+ if (more_bits_set && fewer_bits_set)
+ {
+ // neither less or more restrictive, both simultaneously
+ // so we need to filter from scratch
+ setModified(FILTER_RESTART);
+ }
+ else if (more_bits_set)
+ {
+ // target is only one of all requested types so more type bits == less restrictive
+ setModified(FILTER_LESS_RESTRICTIVE);
+ }
+ else if (fewer_bits_set)
+ {
+ setModified(FILTER_MORE_RESTRICTIVE);
+ }
+ }
}
void LLInventoryFilter::setSearchType(ESearchType type)
{
- if(mSearchType != type)
- {
- mSearchType = type;
- setModified();
- }
+ if(mSearchType != type)
+ {
+ mSearchType = type;
+ setModified();
+ }
}
void LLInventoryFilter::setFilterCreator(EFilterCreatorType type)
{
- if (mFilterOps.mFilterCreatorType != type)
- {
- mFilterOps.mFilterCreatorType = type;
- setModified();
- }
+ if (mFilterOps.mFilterCreatorType != type)
+ {
+ mFilterOps.mFilterCreatorType = type;
+ setModified();
+ }
}
void LLInventoryFilter::setFilterObjectTypes(U64 types)
{
- updateFilterTypes(types, mFilterOps.mFilterObjectTypes);
- mFilterOps.mFilterTypes |= FILTERTYPE_OBJECT;
+ updateFilterTypes(types, mFilterOps.mFilterObjectTypes);
+ mFilterOps.mFilterTypes |= FILTERTYPE_OBJECT;
}
void LLInventoryFilter::setFilterCategoryTypes(U64 types)
{
- updateFilterTypes(types, mFilterOps.mFilterCategoryTypes);
- mFilterOps.mFilterTypes |= FILTERTYPE_CATEGORY;
+ updateFilterTypes(types, mFilterOps.mFilterCategoryTypes);
+ mFilterOps.mFilterTypes |= FILTERTYPE_CATEGORY;
}
void LLInventoryFilter::setFilterWearableTypes(U64 types)
{
- updateFilterTypes(types, mFilterOps.mFilterWearableTypes);
- mFilterOps.mFilterTypes |= FILTERTYPE_WEARABLE;
+ updateFilterTypes(types, mFilterOps.mFilterWearableTypes);
+ mFilterOps.mFilterTypes |= FILTERTYPE_WEARABLE;
}
void LLInventoryFilter::setFilterSettingsTypes(U64 types)
@@ -793,7 +793,7 @@ void LLInventoryFilter::setFilterThumbnails(U64 filter_thumbnails)
void LLInventoryFilter::setFilterEmptySystemFolders()
{
- mFilterOps.mFilterTypes |= FILTERTYPE_EMPTYFOLDERS;
+ mFilterOps.mFilterTypes |= FILTERTYPE_EMPTYFOLDERS;
}
void LLInventoryFilter::setFilterWorn()
@@ -803,17 +803,17 @@ void LLInventoryFilter::setFilterWorn()
void LLInventoryFilter::setFilterMarketplaceActiveFolders()
{
- mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_ACTIVE;
+ mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_ACTIVE;
}
void LLInventoryFilter::setFilterMarketplaceInactiveFolders()
{
- mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_INACTIVE;
+ mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_INACTIVE;
}
void LLInventoryFilter::setFilterMarketplaceUnassociatedFolders()
{
- mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_UNASSOCIATED;
+ mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_UNASSOCIATED;
}
void LLInventoryFilter::setFilterMarketplaceListingFolders(bool select_only_listing_folders)
@@ -833,20 +833,20 @@ void LLInventoryFilter::setFilterMarketplaceListingFolders(bool select_only_list
void LLInventoryFilter::toggleSearchVisibilityLinks()
{
- bool hide_links = mFilterOps.mSearchVisibility & VISIBILITY_LINKS;
- if (hide_links)
- {
- mFilterOps.mSearchVisibility &= ~VISIBILITY_LINKS;
- }
- else
- {
- mFilterOps.mSearchVisibility |= VISIBILITY_LINKS;
- }
+ bool hide_links = mFilterOps.mSearchVisibility & VISIBILITY_LINKS;
+ if (hide_links)
+ {
+ mFilterOps.mSearchVisibility &= ~VISIBILITY_LINKS;
+ }
+ else
+ {
+ mFilterOps.mSearchVisibility |= VISIBILITY_LINKS;
+ }
- if (hasFilterString())
- {
- setModified(hide_links ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
- }
+ if (hasFilterString())
+ {
+ setModified(hide_links ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
+ }
}
void LLInventoryFilter::toggleSearchVisibilityOutfits()
@@ -869,38 +869,38 @@ void LLInventoryFilter::toggleSearchVisibilityOutfits()
void LLInventoryFilter::toggleSearchVisibilityTrash()
{
- bool hide_trash = mFilterOps.mSearchVisibility & VISIBILITY_TRASH;
- if (hide_trash)
- {
- mFilterOps.mSearchVisibility &= ~VISIBILITY_TRASH;
- }
- else
- {
- mFilterOps.mSearchVisibility |= VISIBILITY_TRASH;
- }
+ bool hide_trash = mFilterOps.mSearchVisibility & VISIBILITY_TRASH;
+ if (hide_trash)
+ {
+ mFilterOps.mSearchVisibility &= ~VISIBILITY_TRASH;
+ }
+ else
+ {
+ mFilterOps.mSearchVisibility |= VISIBILITY_TRASH;
+ }
- if (hasFilterString())
- {
- setModified(hide_trash ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
- }
+ if (hasFilterString())
+ {
+ setModified(hide_trash ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
+ }
}
void LLInventoryFilter::toggleSearchVisibilityLibrary()
{
- bool hide_library = mFilterOps.mSearchVisibility & VISIBILITY_LIBRARY;
- if (hide_library)
- {
- mFilterOps.mSearchVisibility &= ~VISIBILITY_LIBRARY;
- }
- else
- {
- mFilterOps.mSearchVisibility |= VISIBILITY_LIBRARY;
- }
+ bool hide_library = mFilterOps.mSearchVisibility & VISIBILITY_LIBRARY;
+ if (hide_library)
+ {
+ mFilterOps.mSearchVisibility &= ~VISIBILITY_LIBRARY;
+ }
+ else
+ {
+ mFilterOps.mSearchVisibility |= VISIBILITY_LIBRARY;
+ }
- if (hasFilterString())
- {
- setModified(hide_library ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
- }
+ if (hasFilterString())
+ {
+ setModified(hide_library ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
+ }
}
void LLInventoryFilter::setFilterNoMarketplaceFolder()
@@ -910,675 +910,675 @@ void LLInventoryFilter::setFilterNoMarketplaceFolder()
void LLInventoryFilter::setFilterUUID(const LLUUID& object_id)
{
- if (mFilterOps.mFilterUUID == LLUUID::null)
- {
- setModified(FILTER_MORE_RESTRICTIVE);
- }
- else
- {
- setModified(FILTER_RESTART);
- }
- mFilterOps.mFilterUUID = object_id;
- mFilterOps.mFilterTypes = FILTERTYPE_UUID;
+ if (mFilterOps.mFilterUUID == LLUUID::null)
+ {
+ setModified(FILTER_MORE_RESTRICTIVE);
+ }
+ else
+ {
+ setModified(FILTER_RESTART);
+ }
+ mFilterOps.mFilterUUID = object_id;
+ mFilterOps.mFilterTypes = FILTERTYPE_UUID;
}
void LLInventoryFilter::setFilterSubString(const std::string& string)
{
- std::string filter_sub_string_new = string;
- mFilterSubStringOrig = string;
- LLStringUtil::trimHead(filter_sub_string_new);
- LLStringUtil::toUpper(filter_sub_string_new);
-
- if (mFilterSubString != filter_sub_string_new)
- {
-
- mFilterTokens.clear();
- if (filter_sub_string_new.find_first_of("+") != std::string::npos)
- {
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep("+");
- tokenizer tokens(filter_sub_string_new, sep);
-
- for (auto token_iter : tokens)
- {
- mFilterTokens.push_back(token_iter);
- }
- }
-
- std::string old_token = mExactToken;
- mExactToken.clear();
- bool exact_token_changed = false;
- if (mFilterTokens.empty() && filter_sub_string_new.size() > 2)
- {
- boost::regex mPattern = boost::regex("\"\\s*([^<]*)?\\s*\"",
- boost::regex::perl | boost::regex::icase);
- boost::match_results<std::string::const_iterator> matches;
- mExactToken = (ll_regex_match(filter_sub_string_new, matches, mPattern) && matches[1].matched)
- ? matches[1]
- : LLStringUtil::null;
- if ((old_token.empty() && !mExactToken.empty())
- || (!old_token.empty() && mExactToken.empty()))
- {
- exact_token_changed = true;
- }
- }
-
- // hitting BACKSPACE, for example
- const BOOL less_restrictive = mFilterSubString.size() >= filter_sub_string_new.size()
- && !mFilterSubString.substr(0, filter_sub_string_new.size()).compare(filter_sub_string_new);
-
- // appending new characters
- const BOOL more_restrictive = mFilterSubString.size() < filter_sub_string_new.size()
- && !filter_sub_string_new.substr(0, mFilterSubString.size()).compare(mFilterSubString);
-
- mFilterSubString = filter_sub_string_new;
- if (exact_token_changed)
- {
- setModified(FILTER_RESTART);
- }
- else if (less_restrictive)
- {
- setModified(FILTER_LESS_RESTRICTIVE);
- }
- else if (more_restrictive)
- {
- setModified(FILTER_MORE_RESTRICTIVE);
- }
- else
- {
- setModified(FILTER_RESTART);
- }
-
- // Cancel out filter links once the search string is modified
- if (mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS)
- {
- if (mBackupFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS)
- {
- // we started viewer/floater in 'only links' mode
- mFilterOps.mFilterLinks = FILTERLINK_INCLUDE_LINKS;
- }
- else
- {
- mFilterOps = mBackupFilterOps;
- setModified(FILTER_RESTART);
- }
- }
-
- // Cancel out UUID once the search string is modified
- if (mFilterOps.mFilterTypes == FILTERTYPE_UUID)
- {
- mFilterOps.mFilterTypes &= ~FILTERTYPE_UUID;
- mFilterOps.mFilterUUID = LLUUID::null;
- setModified(FILTER_RESTART);
- }
- }
+ std::string filter_sub_string_new = string;
+ mFilterSubStringOrig = string;
+ LLStringUtil::trimHead(filter_sub_string_new);
+ LLStringUtil::toUpper(filter_sub_string_new);
+
+ if (mFilterSubString != filter_sub_string_new)
+ {
+
+ mFilterTokens.clear();
+ if (filter_sub_string_new.find_first_of("+") != std::string::npos)
+ {
+ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+ boost::char_separator<char> sep("+");
+ tokenizer tokens(filter_sub_string_new, sep);
+
+ for (auto token_iter : tokens)
+ {
+ mFilterTokens.push_back(token_iter);
+ }
+ }
+
+ std::string old_token = mExactToken;
+ mExactToken.clear();
+ bool exact_token_changed = false;
+ if (mFilterTokens.empty() && filter_sub_string_new.size() > 2)
+ {
+ boost::regex mPattern = boost::regex("\"\\s*([^<]*)?\\s*\"",
+ boost::regex::perl | boost::regex::icase);
+ boost::match_results<std::string::const_iterator> matches;
+ mExactToken = (ll_regex_match(filter_sub_string_new, matches, mPattern) && matches[1].matched)
+ ? matches[1]
+ : LLStringUtil::null;
+ if ((old_token.empty() && !mExactToken.empty())
+ || (!old_token.empty() && mExactToken.empty()))
+ {
+ exact_token_changed = true;
+ }
+ }
+
+ // hitting BACKSPACE, for example
+ const BOOL less_restrictive = mFilterSubString.size() >= filter_sub_string_new.size()
+ && !mFilterSubString.substr(0, filter_sub_string_new.size()).compare(filter_sub_string_new);
+
+ // appending new characters
+ const BOOL more_restrictive = mFilterSubString.size() < filter_sub_string_new.size()
+ && !filter_sub_string_new.substr(0, mFilterSubString.size()).compare(mFilterSubString);
+
+ mFilterSubString = filter_sub_string_new;
+ if (exact_token_changed)
+ {
+ setModified(FILTER_RESTART);
+ }
+ else if (less_restrictive)
+ {
+ setModified(FILTER_LESS_RESTRICTIVE);
+ }
+ else if (more_restrictive)
+ {
+ setModified(FILTER_MORE_RESTRICTIVE);
+ }
+ else
+ {
+ setModified(FILTER_RESTART);
+ }
+
+ // Cancel out filter links once the search string is modified
+ if (mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS)
+ {
+ if (mBackupFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS)
+ {
+ // we started viewer/floater in 'only links' mode
+ mFilterOps.mFilterLinks = FILTERLINK_INCLUDE_LINKS;
+ }
+ else
+ {
+ mFilterOps = mBackupFilterOps;
+ setModified(FILTER_RESTART);
+ }
+ }
+
+ // Cancel out UUID once the search string is modified
+ if (mFilterOps.mFilterTypes == FILTERTYPE_UUID)
+ {
+ mFilterOps.mFilterTypes &= ~FILTERTYPE_UUID;
+ mFilterOps.mFilterUUID = LLUUID::null;
+ setModified(FILTER_RESTART);
+ }
+ }
}
void LLInventoryFilter::setSearchVisibilityTypes(U32 types)
{
- if (mFilterOps.mSearchVisibility != types)
- {
- // keep current items only if no perm bits getting turned off
- BOOL fewer_bits_set = (mFilterOps.mSearchVisibility & ~types);
- BOOL more_bits_set = (~mFilterOps.mSearchVisibility & types);
- mFilterOps.mSearchVisibility = types;
-
- if (more_bits_set && fewer_bits_set)
- {
- setModified(FILTER_RESTART);
- }
- else if (more_bits_set)
- {
- // target must have all requested permission bits, so more bits == more restrictive
- setModified(FILTER_MORE_RESTRICTIVE);
- }
- else if (fewer_bits_set)
- {
- setModified(FILTER_LESS_RESTRICTIVE);
- }
- }
+ if (mFilterOps.mSearchVisibility != types)
+ {
+ // keep current items only if no perm bits getting turned off
+ BOOL fewer_bits_set = (mFilterOps.mSearchVisibility & ~types);
+ BOOL more_bits_set = (~mFilterOps.mSearchVisibility & types);
+ mFilterOps.mSearchVisibility = types;
+
+ if (more_bits_set && fewer_bits_set)
+ {
+ setModified(FILTER_RESTART);
+ }
+ else if (more_bits_set)
+ {
+ // target must have all requested permission bits, so more bits == more restrictive
+ setModified(FILTER_MORE_RESTRICTIVE);
+ }
+ else if (fewer_bits_set)
+ {
+ setModified(FILTER_LESS_RESTRICTIVE);
+ }
+ }
}
void LLInventoryFilter::setSearchVisibilityTypes(const Params& params)
{
- if (!params.validateBlock())
- {
- return;
- }
+ if (!params.validateBlock())
+ {
+ return;
+ }
- if (params.filter_ops.search_visibility.isProvided())
- {
- setSearchVisibilityTypes(params.filter_ops.search_visibility);
- }
+ if (params.filter_ops.search_visibility.isProvided())
+ {
+ setSearchVisibilityTypes(params.filter_ops.search_visibility);
+ }
}
void LLInventoryFilter::setFilterPermissions(PermissionMask perms)
{
- if (mFilterOps.mPermissions != perms)
- {
- // keep current items only if no perm bits getting turned off
- BOOL fewer_bits_set = (mFilterOps.mPermissions & ~perms);
- BOOL more_bits_set = (~mFilterOps.mPermissions & perms);
- mFilterOps.mPermissions = perms;
-
- if (more_bits_set && fewer_bits_set)
- {
- setModified(FILTER_RESTART);
- }
- else if (more_bits_set)
- {
- // target must have all requested permission bits, so more bits == more restrictive
- setModified(FILTER_MORE_RESTRICTIVE);
- }
- else if (fewer_bits_set)
- {
- setModified(FILTER_LESS_RESTRICTIVE);
- }
- }
+ if (mFilterOps.mPermissions != perms)
+ {
+ // keep current items only if no perm bits getting turned off
+ BOOL fewer_bits_set = (mFilterOps.mPermissions & ~perms);
+ BOOL more_bits_set = (~mFilterOps.mPermissions & perms);
+ mFilterOps.mPermissions = perms;
+
+ if (more_bits_set && fewer_bits_set)
+ {
+ setModified(FILTER_RESTART);
+ }
+ else if (more_bits_set)
+ {
+ // target must have all requested permission bits, so more bits == more restrictive
+ setModified(FILTER_MORE_RESTRICTIVE);
+ }
+ else if (fewer_bits_set)
+ {
+ setModified(FILTER_LESS_RESTRICTIVE);
+ }
+ }
}
void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date)
{
- mFilterOps.mHoursAgo = 0;
- if (mFilterOps.mMinDate != min_date)
- {
- mFilterOps.mMinDate = min_date;
- setModified();
- }
- if (mFilterOps.mMaxDate != llmax(mFilterOps.mMinDate, max_date))
- {
- mFilterOps.mMaxDate = llmax(mFilterOps.mMinDate, max_date);
- setModified();
- }
-
- if (areDateLimitsSet())
- {
- mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
- }
- else
- {
- mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
- }
+ mFilterOps.mHoursAgo = 0;
+ if (mFilterOps.mMinDate != min_date)
+ {
+ mFilterOps.mMinDate = min_date;
+ setModified();
+ }
+ if (mFilterOps.mMaxDate != llmax(mFilterOps.mMinDate, max_date))
+ {
+ mFilterOps.mMaxDate = llmax(mFilterOps.mMinDate, max_date);
+ setModified();
+ }
+
+ if (areDateLimitsSet())
+ {
+ mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+ }
+ else
+ {
+ mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
+ }
}
void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl)
{
- static LLCachedControl<U32> s_last_logoff(gSavedPerAccountSettings, "LastLogoff", 0);
- if (sl && !isSinceLogoff())
- {
- setDateRange(s_last_logoff(), time_max());
- setModified();
- }
- if (!sl && isSinceLogoff())
- {
- setDateRange(time_min(), time_max());
- setModified();
- }
-
- if (areDateLimitsSet())
- {
- mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
- }
- else
- {
- mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
- }
+ static LLCachedControl<U32> s_last_logoff(gSavedPerAccountSettings, "LastLogoff", 0);
+ if (sl && !isSinceLogoff())
+ {
+ setDateRange(s_last_logoff(), time_max());
+ setModified();
+ }
+ if (!sl && isSinceLogoff())
+ {
+ setDateRange(time_min(), time_max());
+ setModified();
+ }
+
+ if (areDateLimitsSet())
+ {
+ mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+ }
+ else
+ {
+ mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
+ }
}
bool LLInventoryFilter::isSinceLogoff() const
{
- static LLCachedControl<U32> s_last_logoff(gSavedSettings, "LastLogoff", 0);
+ static LLCachedControl<U32> s_last_logoff(gSavedSettings, "LastLogoff", 0);
- return (mFilterOps.mMinDate == (time_t)s_last_logoff()) &&
- (mFilterOps.mMaxDate == time_max()) &&
- (mFilterOps.mFilterTypes & FILTERTYPE_DATE);
+ return (mFilterOps.mMinDate == (time_t)s_last_logoff()) &&
+ (mFilterOps.mMaxDate == time_max()) &&
+ (mFilterOps.mFilterTypes & FILTERTYPE_DATE);
}
void LLInventoryFilter::clearModified()
{
- mFilterModified = FILTER_NONE;
+ mFilterModified = FILTER_NONE;
}
void LLInventoryFilter::setHoursAgo(U32 hours)
{
- if (mFilterOps.mHoursAgo != hours)
- {
- bool are_date_limits_valid = mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max();
-
- bool is_increasing = hours > mFilterOps.mHoursAgo;
- bool is_decreasing = hours < mFilterOps.mHoursAgo;
- bool is_increasing_from_zero = is_increasing && !mFilterOps.mHoursAgo && !isSinceLogoff();
-
- // *NOTE: need to cache last filter time, in case filter goes stale
- BOOL less_restrictive;
- BOOL more_restrictive;
- if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection)
- {
- less_restrictive = ((are_date_limits_valid && ((is_increasing && mFilterOps.mHoursAgo))) || !hours);
- more_restrictive = ((are_date_limits_valid && (!is_increasing && hours)) || is_increasing_from_zero);
- }
- else
- {
- less_restrictive = ((are_date_limits_valid && ((is_decreasing && mFilterOps.mHoursAgo))) || !hours);
- more_restrictive = ((are_date_limits_valid && (!is_decreasing && hours)) || is_increasing_from_zero);
- }
-
- mFilterOps.mHoursAgo = hours;
- mFilterOps.mMinDate = time_min();
- mFilterOps.mMaxDate = time_max();
- if (less_restrictive)
- {
- setModified(FILTER_LESS_RESTRICTIVE);
- }
- else if (more_restrictive)
- {
- setModified(FILTER_MORE_RESTRICTIVE);
- }
- else
- {
- setModified(FILTER_RESTART);
- }
- }
-
- if (areDateLimitsSet())
- {
- mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
- }
- else
- {
- mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
- }
+ if (mFilterOps.mHoursAgo != hours)
+ {
+ bool are_date_limits_valid = mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max();
+
+ bool is_increasing = hours > mFilterOps.mHoursAgo;
+ bool is_decreasing = hours < mFilterOps.mHoursAgo;
+ bool is_increasing_from_zero = is_increasing && !mFilterOps.mHoursAgo && !isSinceLogoff();
+
+ // *NOTE: need to cache last filter time, in case filter goes stale
+ BOOL less_restrictive;
+ BOOL more_restrictive;
+ if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection)
+ {
+ less_restrictive = ((are_date_limits_valid && ((is_increasing && mFilterOps.mHoursAgo))) || !hours);
+ more_restrictive = ((are_date_limits_valid && (!is_increasing && hours)) || is_increasing_from_zero);
+ }
+ else
+ {
+ less_restrictive = ((are_date_limits_valid && ((is_decreasing && mFilterOps.mHoursAgo))) || !hours);
+ more_restrictive = ((are_date_limits_valid && (!is_decreasing && hours)) || is_increasing_from_zero);
+ }
+
+ mFilterOps.mHoursAgo = hours;
+ mFilterOps.mMinDate = time_min();
+ mFilterOps.mMaxDate = time_max();
+ if (less_restrictive)
+ {
+ setModified(FILTER_LESS_RESTRICTIVE);
+ }
+ else if (more_restrictive)
+ {
+ setModified(FILTER_MORE_RESTRICTIVE);
+ }
+ else
+ {
+ setModified(FILTER_RESTART);
+ }
+ }
+
+ if (areDateLimitsSet())
+ {
+ mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+ }
+ else
+ {
+ mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
+ }
}
void LLInventoryFilter::setDateSearchDirection(U32 direction)
{
- if (direction != mFilterOps.mDateSearchDirection)
- {
- mFilterOps.mDateSearchDirection = direction;
- setModified(FILTER_RESTART);
- }
+ if (direction != mFilterOps.mDateSearchDirection)
+ {
+ mFilterOps.mDateSearchDirection = direction;
+ setModified(FILTER_RESTART);
+ }
}
U32 LLInventoryFilter::getDateSearchDirection() const
{
- return mFilterOps.mDateSearchDirection;
+ return mFilterOps.mDateSearchDirection;
}
void LLInventoryFilter::setFilterLinks(U64 filter_links)
{
- if (mFilterOps.mFilterLinks != filter_links)
- {
- if (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS ||
- mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS)
- setModified(FILTER_MORE_RESTRICTIVE);
- else
- setModified(FILTER_LESS_RESTRICTIVE);
- }
- mFilterOps.mFilterLinks = filter_links;
+ if (mFilterOps.mFilterLinks != filter_links)
+ {
+ if (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS ||
+ mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS)
+ setModified(FILTER_MORE_RESTRICTIVE);
+ else
+ setModified(FILTER_LESS_RESTRICTIVE);
+ }
+ mFilterOps.mFilterLinks = filter_links;
}
void LLInventoryFilter::setShowFolderState(EFolderShow state)
{
- if (mFilterOps.mShowFolderState != state)
- {
- mFilterOps.mShowFolderState = state;
- if (state == SHOW_NON_EMPTY_FOLDERS)
- {
- // showing fewer folders than before
- setModified(FILTER_MORE_RESTRICTIVE);
- }
- else if (state == SHOW_ALL_FOLDERS)
- {
- // showing same folders as before and then some
- setModified(FILTER_LESS_RESTRICTIVE);
- }
- else
- {
- setModified();
- }
- }
+ if (mFilterOps.mShowFolderState != state)
+ {
+ mFilterOps.mShowFolderState = state;
+ if (state == SHOW_NON_EMPTY_FOLDERS)
+ {
+ // showing fewer folders than before
+ setModified(FILTER_MORE_RESTRICTIVE);
+ }
+ else if (state == SHOW_ALL_FOLDERS)
+ {
+ // showing same folders as before and then some
+ setModified(FILTER_LESS_RESTRICTIVE);
+ }
+ else
+ {
+ setModified();
+ }
+ }
}
void LLInventoryFilter::setFindAllLinksMode(const std::string &search_name, const LLUUID& search_id)
{
- // Save a copy of settings so that we will be able to restore it later
- // but make sure we are not searching for links already
- if(mFilterOps.mFilterLinks != FILTERLINK_ONLY_LINKS)
- {
- mBackupFilterOps = mFilterOps;
- }
-
- // set search options
- setFilterSubString(search_name);
- setFilterUUID(search_id);
- setShowFolderState(SHOW_NON_EMPTY_FOLDERS);
- setFilterLinks(FILTERLINK_ONLY_LINKS);
+ // Save a copy of settings so that we will be able to restore it later
+ // but make sure we are not searching for links already
+ if(mFilterOps.mFilterLinks != FILTERLINK_ONLY_LINKS)
+ {
+ mBackupFilterOps = mFilterOps;
+ }
+
+ // set search options
+ setFilterSubString(search_name);
+ setFilterUUID(search_id);
+ setShowFolderState(SHOW_NON_EMPTY_FOLDERS);
+ setFilterLinks(FILTERLINK_ONLY_LINKS);
}
void LLInventoryFilter::markDefault()
{
- mDefaultFilterOps = mFilterOps;
+ mDefaultFilterOps = mFilterOps;
}
void LLInventoryFilter::resetDefault()
{
- mFilterOps = mDefaultFilterOps;
- setModified();
+ mFilterOps = mDefaultFilterOps;
+ setModified();
}
void LLInventoryFilter::setModified(EFilterModified behavior)
{
- mFilterText.clear();
- mCurrentGeneration++;
-
- if (mFilterModified == FILTER_NONE)
- {
- mFilterModified = behavior;
- }
- else if (mFilterModified != behavior)
- {
- // trying to do both less restrictive and more restrictive filter
- // basically means restart from scratch
- mFilterModified = FILTER_RESTART;
- }
-
- // if not keeping current filter results, update last valid as well
- switch(mFilterModified)
- {
- case FILTER_RESTART:
- mFirstRequiredGeneration = mCurrentGeneration;
- mFirstSuccessGeneration = mCurrentGeneration;
- break;
- case FILTER_LESS_RESTRICTIVE:
- mFirstRequiredGeneration = mCurrentGeneration;
- break;
- case FILTER_MORE_RESTRICTIVE:
- mFirstSuccessGeneration = mCurrentGeneration;
- break;
- default:
- LL_ERRS() << "Bad filter behavior specified" << LL_ENDL;
- }
+ mFilterText.clear();
+ mCurrentGeneration++;
+
+ if (mFilterModified == FILTER_NONE)
+ {
+ mFilterModified = behavior;
+ }
+ else if (mFilterModified != behavior)
+ {
+ // trying to do both less restrictive and more restrictive filter
+ // basically means restart from scratch
+ mFilterModified = FILTER_RESTART;
+ }
+
+ // if not keeping current filter results, update last valid as well
+ switch(mFilterModified)
+ {
+ case FILTER_RESTART:
+ mFirstRequiredGeneration = mCurrentGeneration;
+ mFirstSuccessGeneration = mCurrentGeneration;
+ break;
+ case FILTER_LESS_RESTRICTIVE:
+ mFirstRequiredGeneration = mCurrentGeneration;
+ break;
+ case FILTER_MORE_RESTRICTIVE:
+ mFirstSuccessGeneration = mCurrentGeneration;
+ break;
+ default:
+ LL_ERRS() << "Bad filter behavior specified" << LL_ENDL;
+ }
}
bool LLInventoryFilter::isFilterObjectTypesWith(LLInventoryType::EType t) const
{
- return mFilterOps.mFilterObjectTypes & (1LL << t);
+ return mFilterOps.mFilterObjectTypes & (1LL << t);
}
const std::string& LLInventoryFilter::getFilterText()
{
- if (!mFilterText.empty())
- {
- return mFilterText;
- }
-
- std::string filtered_types;
- std::string not_filtered_types;
- BOOL filtered_by_type = FALSE;
- BOOL filtered_by_all_types = TRUE;
- S32 num_filter_types = 0;
-
- mFilterText.clear();
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_ANIMATION))
- {
- filtered_types += LLTrans::getString("Animations");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Animations");
-
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_CALLINGCARD))
- {
- filtered_types += LLTrans::getString("Calling Cards");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Calling Cards");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_WEARABLE))
- {
- filtered_types += LLTrans::getString("Clothing");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Clothing");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_GESTURE))
- {
- filtered_types += LLTrans::getString("Gestures");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Gestures");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_LANDMARK))
- {
- filtered_types += LLTrans::getString("Landmarks");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Landmarks");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_MATERIAL))
- {
- filtered_types += LLTrans::getString("Materials");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Materials");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_NOTECARD))
- {
- filtered_types += LLTrans::getString("Notecards");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Notecards");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_OBJECT) && isFilterObjectTypesWith(LLInventoryType::IT_ATTACHMENT))
- {
- filtered_types += LLTrans::getString("Objects");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Objects");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_LSL))
- {
- filtered_types += LLTrans::getString("Scripts");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Scripts");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_SOUND))
- {
- filtered_types += LLTrans::getString("Sounds");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Sounds");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_TEXTURE))
- {
- filtered_types += LLTrans::getString("Textures");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Textures");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_SNAPSHOT))
- {
- filtered_types += LLTrans::getString("Snapshots");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Snapshots");
- filtered_by_all_types = FALSE;
- }
-
- if (isFilterObjectTypesWith(LLInventoryType::IT_SETTINGS))
- {
- filtered_types += LLTrans::getString("Settings");
- filtered_by_type = TRUE;
- num_filter_types++;
- }
- else
- {
- not_filtered_types += LLTrans::getString("Settings");
- filtered_by_all_types = FALSE;
- }
-
- if (!LLInventoryModelBackgroundFetch::instance().folderFetchActive()
- && filtered_by_type
- && !filtered_by_all_types)
- {
- mFilterText += " - ";
- if (num_filter_types < 5)
- {
- mFilterText += filtered_types;
- }
- else
- {
- mFilterText += LLTrans::getString("No Filters");
- mFilterText += not_filtered_types;
- }
- // remove the ',' at the end
- mFilterText.erase(mFilterText.size() - 1, 1);
- }
-
- if (isSinceLogoff())
- {
- mFilterText += LLTrans::getString("Since Logoff");
- }
- return mFilterText;
+ if (!mFilterText.empty())
+ {
+ return mFilterText;
+ }
+
+ std::string filtered_types;
+ std::string not_filtered_types;
+ BOOL filtered_by_type = FALSE;
+ BOOL filtered_by_all_types = TRUE;
+ S32 num_filter_types = 0;
+
+ mFilterText.clear();
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_ANIMATION))
+ {
+ filtered_types += LLTrans::getString("Animations");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Animations");
+
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_CALLINGCARD))
+ {
+ filtered_types += LLTrans::getString("Calling Cards");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Calling Cards");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_WEARABLE))
+ {
+ filtered_types += LLTrans::getString("Clothing");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Clothing");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_GESTURE))
+ {
+ filtered_types += LLTrans::getString("Gestures");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Gestures");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_LANDMARK))
+ {
+ filtered_types += LLTrans::getString("Landmarks");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Landmarks");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_MATERIAL))
+ {
+ filtered_types += LLTrans::getString("Materials");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Materials");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_NOTECARD))
+ {
+ filtered_types += LLTrans::getString("Notecards");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Notecards");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_OBJECT) && isFilterObjectTypesWith(LLInventoryType::IT_ATTACHMENT))
+ {
+ filtered_types += LLTrans::getString("Objects");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Objects");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_LSL))
+ {
+ filtered_types += LLTrans::getString("Scripts");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Scripts");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_SOUND))
+ {
+ filtered_types += LLTrans::getString("Sounds");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Sounds");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_TEXTURE))
+ {
+ filtered_types += LLTrans::getString("Textures");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Textures");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_SNAPSHOT))
+ {
+ filtered_types += LLTrans::getString("Snapshots");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Snapshots");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (isFilterObjectTypesWith(LLInventoryType::IT_SETTINGS))
+ {
+ filtered_types += LLTrans::getString("Settings");
+ filtered_by_type = TRUE;
+ num_filter_types++;
+ }
+ else
+ {
+ not_filtered_types += LLTrans::getString("Settings");
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!LLInventoryModelBackgroundFetch::instance().folderFetchActive()
+ && filtered_by_type
+ && !filtered_by_all_types)
+ {
+ mFilterText += " - ";
+ if (num_filter_types < 5)
+ {
+ mFilterText += filtered_types;
+ }
+ else
+ {
+ mFilterText += LLTrans::getString("No Filters");
+ mFilterText += not_filtered_types;
+ }
+ // remove the ',' at the end
+ mFilterText.erase(mFilterText.size() - 1, 1);
+ }
+
+ if (isSinceLogoff())
+ {
+ mFilterText += LLTrans::getString("Since Logoff");
+ }
+ return mFilterText;
}
LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& other )
{
- setFilterObjectTypes(other.getFilterObjectTypes());
- setDateRange(other.getMinDate(), other.getMaxDate());
- setHoursAgo(other.getHoursAgo());
- setDateSearchDirection(other.getDateSearchDirection());
- setShowFolderState(other.getShowFolderState());
- setFilterPermissions(other.getFilterPermissions());
- setFilterSubString(other.getFilterSubString());
- setDateRangeLastLogoff(other.isSinceLogoff());
- return *this;
+ setFilterObjectTypes(other.getFilterObjectTypes());
+ setDateRange(other.getMinDate(), other.getMaxDate());
+ setHoursAgo(other.getHoursAgo());
+ setDateSearchDirection(other.getDateSearchDirection());
+ setShowFolderState(other.getShowFolderState());
+ setFilterPermissions(other.getFilterPermissions());
+ setFilterSubString(other.getFilterSubString());
+ setDateRangeLastLogoff(other.isSinceLogoff());
+ return *this;
}
void LLInventoryFilter::toParams(Params& params) const
{
- params.filter_ops.types = getFilterObjectTypes();
- params.filter_ops.category_types = getFilterCategoryTypes();
- if (getFilterObjectTypes() & FILTERTYPE_WEARABLE)
- {
- params.filter_ops.wearable_types = getFilterWearableTypes();
- }
- params.filter_ops.date_range.min_date = getMinDate();
- params.filter_ops.date_range.max_date = getMaxDate();
- params.filter_ops.hours_ago = getHoursAgo();
- params.filter_ops.date_search_direction = getDateSearchDirection();
- params.filter_ops.show_folder_state = getShowFolderState();
- params.filter_ops.creator_type = getFilterCreatorType();
- params.filter_ops.permissions = getFilterPermissions();
- params.filter_ops.search_visibility = getSearchVisibilityTypes();
- params.substring = getFilterSubString();
- params.since_logoff = isSinceLogoff();
+ params.filter_ops.types = getFilterObjectTypes();
+ params.filter_ops.category_types = getFilterCategoryTypes();
+ if (getFilterObjectTypes() & FILTERTYPE_WEARABLE)
+ {
+ params.filter_ops.wearable_types = getFilterWearableTypes();
+ }
+ params.filter_ops.date_range.min_date = getMinDate();
+ params.filter_ops.date_range.max_date = getMaxDate();
+ params.filter_ops.hours_ago = getHoursAgo();
+ params.filter_ops.date_search_direction = getDateSearchDirection();
+ params.filter_ops.show_folder_state = getShowFolderState();
+ params.filter_ops.creator_type = getFilterCreatorType();
+ params.filter_ops.permissions = getFilterPermissions();
+ params.filter_ops.search_visibility = getSearchVisibilityTypes();
+ params.substring = getFilterSubString();
+ params.since_logoff = isSinceLogoff();
}
void LLInventoryFilter::fromParams(const Params& params)
{
- if (!params.validateBlock())
- {
- return;
- }
-
- setFilterObjectTypes(params.filter_ops.types);
- setFilterCategoryTypes(params.filter_ops.category_types);
- if (params.filter_ops.wearable_types.isProvided())
- {
- setFilterWearableTypes(params.filter_ops.wearable_types);
- }
- setDateRange(params.filter_ops.date_range.min_date, params.filter_ops.date_range.max_date);
- setHoursAgo(params.filter_ops.hours_ago);
- setDateSearchDirection(params.filter_ops.date_search_direction);
- setShowFolderState(params.filter_ops.show_folder_state);
- setFilterCreator(params.filter_ops.creator_type);
- setFilterPermissions(params.filter_ops.permissions);
- setSearchVisibilityTypes(params.filter_ops.search_visibility);
- setFilterSubString(params.substring);
- setDateRangeLastLogoff(params.since_logoff);
+ if (!params.validateBlock())
+ {
+ return;
+ }
+
+ setFilterObjectTypes(params.filter_ops.types);
+ setFilterCategoryTypes(params.filter_ops.category_types);
+ if (params.filter_ops.wearable_types.isProvided())
+ {
+ setFilterWearableTypes(params.filter_ops.wearable_types);
+ }
+ setDateRange(params.filter_ops.date_range.min_date, params.filter_ops.date_range.max_date);
+ setHoursAgo(params.filter_ops.hours_ago);
+ setDateSearchDirection(params.filter_ops.date_search_direction);
+ setShowFolderState(params.filter_ops.show_folder_state);
+ setFilterCreator(params.filter_ops.creator_type);
+ setFilterPermissions(params.filter_ops.permissions);
+ setSearchVisibilityTypes(params.filter_ops.search_visibility);
+ setFilterSubString(params.substring);
+ setDateRangeLastLogoff(params.since_logoff);
}
U64 LLInventoryFilter::getFilterTypes() const
{
- return mFilterOps.mFilterTypes;
+ return mFilterOps.mFilterTypes;
}
U64 LLInventoryFilter::getFilterObjectTypes() const
{
- return mFilterOps.mFilterObjectTypes;
+ return mFilterOps.mFilterObjectTypes;
}
U64 LLInventoryFilter::getFilterCategoryTypes() const
{
- return mFilterOps.mFilterCategoryTypes;
+ return mFilterOps.mFilterCategoryTypes;
}
U64 LLInventoryFilter::getFilterWearableTypes() const
{
- return mFilterOps.mFilterWearableTypes;
+ return mFilterOps.mFilterWearableTypes;
}
U64 LLInventoryFilter::getFilterSettingsTypes() const
@@ -1588,7 +1588,7 @@ U64 LLInventoryFilter::getFilterSettingsTypes() const
U64 LLInventoryFilter::getSearchVisibilityTypes() const
{
- return mFilterOps.mSearchVisibility;
+ return mFilterOps.mSearchVisibility;
}
U64 LLInventoryFilter::getFilterThumbnails() const
@@ -1598,124 +1598,124 @@ U64 LLInventoryFilter::getFilterThumbnails() const
bool LLInventoryFilter::hasFilterString() const
{
- return mFilterSubString.size() > 0;
+ return mFilterSubString.size() > 0;
}
std::string::size_type LLInventoryFilter::getFilterStringSize() const
{
- return mFilterSubString.size();
+ return mFilterSubString.size();
}
PermissionMask LLInventoryFilter::getFilterPermissions() const
{
- return mFilterOps.mPermissions;
+ return mFilterOps.mPermissions;
}
time_t LLInventoryFilter::getMinDate() const
{
- return mFilterOps.mMinDate;
+ return mFilterOps.mMinDate;
}
-time_t LLInventoryFilter::getMaxDate() const
-{
- return mFilterOps.mMaxDate;
+time_t LLInventoryFilter::getMaxDate() const
+{
+ return mFilterOps.mMaxDate;
}
-U32 LLInventoryFilter::getHoursAgo() const
-{
- return mFilterOps.mHoursAgo;
+U32 LLInventoryFilter::getHoursAgo() const
+{
+ return mFilterOps.mHoursAgo;
}
U64 LLInventoryFilter::getFilterLinks() const
{
- return mFilterOps.mFilterLinks;
+ return mFilterOps.mFilterLinks;
}
LLInventoryFilter::EFolderShow LLInventoryFilter::getShowFolderState() const
-{
- return mFilterOps.mShowFolderState;
+{
+ return mFilterOps.mShowFolderState;
}
LLInventoryFilter::EFilterCreatorType LLInventoryFilter::getFilterCreatorType() const
{
- return mFilterOps.mFilterCreatorType;
+ return mFilterOps.mFilterCreatorType;
}
bool LLInventoryFilter::isTimedOut()
{
- return mFilterTime.hasExpired();
+ return mFilterTime.hasExpired();
}
void LLInventoryFilter::resetTime(S32 timeout)
{
- mFilterTime.reset();
+ mFilterTime.reset();
F32 time_in_sec = (F32)(timeout)/1000.0;
- mFilterTime.setTimerExpirySec(time_in_sec);
+ mFilterTime.setTimerExpirySec(time_in_sec);
}
S32 LLInventoryFilter::getCurrentGeneration() const
-{
- return mCurrentGeneration;
+{
+ return mCurrentGeneration;
}
S32 LLInventoryFilter::getFirstSuccessGeneration() const
-{
- return mFirstSuccessGeneration;
+{
+ return mFirstSuccessGeneration;
}
S32 LLInventoryFilter::getFirstRequiredGeneration() const
-{
- return mFirstRequiredGeneration;
+{
+ return mFirstRequiredGeneration;
}
void LLInventoryFilter::setEmptyLookupMessage(const std::string& message)
{
- mEmptyLookupMessage = message;
+ mEmptyLookupMessage = message;
}
void LLInventoryFilter::setDefaultEmptyLookupMessage(const std::string& message)
{
- mDefaultEmptyLookupMessage = message;
+ mDefaultEmptyLookupMessage = message;
}
std::string LLInventoryFilter::getEmptyLookupMessage(bool is_empty_folder) const
{
- if ((isDefault() || is_empty_folder) && !mDefaultEmptyLookupMessage.empty())
- {
- return LLTrans::getString(mDefaultEmptyLookupMessage);
- }
- else
- {
- LLStringUtil::format_map_t args;
- args["[SEARCH_TERM]"] = LLURI::escape(getFilterSubStringOrig());
+ if ((isDefault() || is_empty_folder) && !mDefaultEmptyLookupMessage.empty())
+ {
+ return LLTrans::getString(mDefaultEmptyLookupMessage);
+ }
+ else
+ {
+ LLStringUtil::format_map_t args;
+ args["[SEARCH_TERM]"] = LLURI::escape(getFilterSubStringOrig());
- return LLTrans::getString(mEmptyLookupMessage, args);
- }
+ return LLTrans::getString(mEmptyLookupMessage, args);
+ }
}
bool LLInventoryFilter::areDateLimitsSet()
{
- return mFilterOps.mMinDate != time_min()
- || mFilterOps.mMaxDate != time_max()
- || mFilterOps.mHoursAgo != 0;
+ return mFilterOps.mMinDate != time_min()
+ || mFilterOps.mMaxDate != time_max()
+ || mFilterOps.mHoursAgo != 0;
}
bool LLInventoryFilter::showAllResults() const
{
- return hasFilterString() && !mSingleFolderMode;
+ return hasFilterString() && !mSingleFolderMode;
}
bool LLInventoryFilter::FilterOps::DateRange::validateBlock( bool emit_errors /*= true*/ ) const
{
- bool valid = LLInitParam::Block<DateRange>::validateBlock(emit_errors);
- if (valid)
- {
- if (max_date() < min_date())
- {
- if (emit_errors)
- {
- LL_WARNS() << "max_date should be greater or equal to min_date" << LL_ENDL;
- }
- valid = false;
- }
- }
- return valid;
+ bool valid = LLInitParam::Block<DateRange>::validateBlock(emit_errors);
+ if (valid)
+ {
+ if (max_date() < min_date())
+ {
+ if (emit_errors)
+ {
+ LL_WARNS() << "max_date should be greater or equal to min_date" << LL_ENDL;
+ }
+ valid = false;
+ }
+ }
+ return valid;
}
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index ada1d0f4b4..e45375deca 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llinventoryfilter.h
* @brief Support for filtering your inventory to only display a subset of the
* available items.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,42 +38,42 @@ class LLInventoryItem;
class LLInventoryFilter : public LLFolderViewFilter
{
public:
- enum EFolderShow
- {
- SHOW_ALL_FOLDERS,
- SHOW_NON_EMPTY_FOLDERS,
- SHOW_NO_FOLDERS
- };
-
- enum EFilterType {
- FILTERTYPE_NONE = 0,
- FILTERTYPE_OBJECT = 0x1 << 0, // normal default search-by-object-type
- FILTERTYPE_CATEGORY = 0x1 << 1, // search by folder type
- FILTERTYPE_UUID = 0x1 << 2, // find the object with UUID and any links to it
- FILTERTYPE_DATE = 0x1 << 3, // search by date range
- FILTERTYPE_WEARABLE = 0x1 << 4, // search by wearable type
- FILTERTYPE_EMPTYFOLDERS = 0x1 << 5, // pass if folder is not a system folder to be hidden if empty
- FILTERTYPE_MARKETPLACE_ACTIVE = 0x1 << 6, // pass if folder is a marketplace active folder
- FILTERTYPE_MARKETPLACE_INACTIVE = 0x1 << 7, // pass if folder is a marketplace inactive folder
- FILTERTYPE_MARKETPLACE_UNASSOCIATED = 0x1 << 8, // pass if folder is a marketplace non associated (no market ID) folder
- FILTERTYPE_MARKETPLACE_LISTING_FOLDER = 0x1 << 9, // pass iff folder is a listing folder
+ enum EFolderShow
+ {
+ SHOW_ALL_FOLDERS,
+ SHOW_NON_EMPTY_FOLDERS,
+ SHOW_NO_FOLDERS
+ };
+
+ enum EFilterType {
+ FILTERTYPE_NONE = 0,
+ FILTERTYPE_OBJECT = 0x1 << 0, // normal default search-by-object-type
+ FILTERTYPE_CATEGORY = 0x1 << 1, // search by folder type
+ FILTERTYPE_UUID = 0x1 << 2, // find the object with UUID and any links to it
+ FILTERTYPE_DATE = 0x1 << 3, // search by date range
+ FILTERTYPE_WEARABLE = 0x1 << 4, // search by wearable type
+ FILTERTYPE_EMPTYFOLDERS = 0x1 << 5, // pass if folder is not a system folder to be hidden if empty
+ FILTERTYPE_MARKETPLACE_ACTIVE = 0x1 << 6, // pass if folder is a marketplace active folder
+ FILTERTYPE_MARKETPLACE_INACTIVE = 0x1 << 7, // pass if folder is a marketplace inactive folder
+ FILTERTYPE_MARKETPLACE_UNASSOCIATED = 0x1 << 8, // pass if folder is a marketplace non associated (no market ID) folder
+ FILTERTYPE_MARKETPLACE_LISTING_FOLDER = 0x1 << 9, // pass iff folder is a listing folder
FILTERTYPE_NO_MARKETPLACE_ITEMS = 0x1 << 10, // pass iff folder is not under the marketplace
FILTERTYPE_WORN = 0x1 << 11, // pass if item is worn
FILTERTYPE_SETTINGS = 0x1 << 12, // pass if the item is a settings object
- };
+ };
- enum EFilterDateDirection
- {
- FILTERDATEDIRECTION_NEWER,
- FILTERDATEDIRECTION_OLDER
- };
+ enum EFilterDateDirection
+ {
+ FILTERDATEDIRECTION_NEWER,
+ FILTERDATEDIRECTION_OLDER
+ };
- enum EFilterLink
- {
- FILTERLINK_INCLUDE_LINKS, // show links too
- FILTERLINK_EXCLUDE_LINKS, // don't show links
- FILTERLINK_ONLY_LINKS // only show links
- };
+ enum EFilterLink
+ {
+ FILTERLINK_INCLUDE_LINKS, // show links too
+ FILTERLINK_EXCLUDE_LINKS, // don't show links
+ FILTERLINK_ONLY_LINKS // only show links
+ };
enum EFilterThumbnail
{
@@ -82,301 +82,301 @@ public:
FILTER_ONLY_THUMBNAILS
};
- enum ESortOrderType
- {
- SO_NAME = 0, // Sort inventory by name
- SO_DATE = 0x1, // Sort inventory by date
- SO_FOLDERS_BY_NAME = 0x1 << 1, // Force folder sort by name
- SO_SYSTEM_FOLDERS_TO_TOP = 0x1 << 2,// Force system folders to be on top
- SO_FOLDERS_BY_WEIGHT = 0x1 << 3, // Force folder sort by weight, usually, amount of some elements in their descendants
- };
-
- enum ESearchType
- {
- SEARCHTYPE_NAME,
- SEARCHTYPE_DESCRIPTION,
- SEARCHTYPE_CREATOR,
- SEARCHTYPE_UUID
- };
-
- enum EFilterCreatorType
- {
- FILTERCREATOR_ALL,
- FILTERCREATOR_SELF,
- FILTERCREATOR_OTHERS
- };
-
- enum ESearchVisibility
- {
- VISIBILITY_NONE = 0,
- VISIBILITY_TRASH = 0x1 << 0,
- VISIBILITY_LIBRARY = 0x1 << 1,
- VISIBILITY_LINKS = 0x1 << 2,
+ enum ESortOrderType
+ {
+ SO_NAME = 0, // Sort inventory by name
+ SO_DATE = 0x1, // Sort inventory by date
+ SO_FOLDERS_BY_NAME = 0x1 << 1, // Force folder sort by name
+ SO_SYSTEM_FOLDERS_TO_TOP = 0x1 << 2,// Force system folders to be on top
+ SO_FOLDERS_BY_WEIGHT = 0x1 << 3, // Force folder sort by weight, usually, amount of some elements in their descendants
+ };
+
+ enum ESearchType
+ {
+ SEARCHTYPE_NAME,
+ SEARCHTYPE_DESCRIPTION,
+ SEARCHTYPE_CREATOR,
+ SEARCHTYPE_UUID
+ };
+
+ enum EFilterCreatorType
+ {
+ FILTERCREATOR_ALL,
+ FILTERCREATOR_SELF,
+ FILTERCREATOR_OTHERS
+ };
+
+ enum ESearchVisibility
+ {
+ VISIBILITY_NONE = 0,
+ VISIBILITY_TRASH = 0x1 << 0,
+ VISIBILITY_LIBRARY = 0x1 << 1,
+ VISIBILITY_LINKS = 0x1 << 2,
VISIBILITY_OUTFITS = 0x1 << 3
- };
-
- struct FilterOps
- {
- struct DateRange : public LLInitParam::Block<DateRange>
- {
- Optional<time_t> min_date,
- max_date;
-
- DateRange()
- : min_date("min_date", time_min()),
- max_date("max_date", time_max())
- {}
-
- bool validateBlock(bool emit_errors = true) const;
- };
-
- struct Params : public LLInitParam::Block<Params>
- {
- Optional<U32> types,
- search_visibility;
- Optional<U64> object_types,
- wearable_types,
+ };
+
+ struct FilterOps
+ {
+ struct DateRange : public LLInitParam::Block<DateRange>
+ {
+ Optional<time_t> min_date,
+ max_date;
+
+ DateRange()
+ : min_date("min_date", time_min()),
+ max_date("max_date", time_max())
+ {}
+
+ bool validateBlock(bool emit_errors = true) const;
+ };
+
+ struct Params : public LLInitParam::Block<Params>
+ {
+ Optional<U32> types,
+ search_visibility;
+ Optional<U64> object_types,
+ wearable_types,
settings_types,
- category_types;
-
- Optional<EFilterLink> links;
- Optional<LLUUID> uuid;
- Optional<DateRange> date_range;
- Optional<U32> hours_ago;
- Optional<U32> date_search_direction;
- Optional<EFolderShow> show_folder_state;
- Optional<PermissionMask> permissions;
- Optional<EFilterCreatorType> creator_type;
+ category_types;
+
+ Optional<EFilterLink> links;
+ Optional<LLUUID> uuid;
+ Optional<DateRange> date_range;
+ Optional<U32> hours_ago;
+ Optional<U32> date_search_direction;
+ Optional<EFolderShow> show_folder_state;
+ Optional<PermissionMask> permissions;
+ Optional<EFilterCreatorType> creator_type;
Optional<EFilterThumbnail> thumbnails;
- Params()
- : types("filter_types", FILTERTYPE_OBJECT),
- object_types("object_types", 0xffffFFFFffffFFFFULL),
- wearable_types("wearable_types", 0xffffFFFFffffFFFFULL),
+ Params()
+ : types("filter_types", FILTERTYPE_OBJECT),
+ object_types("object_types", 0xffffFFFFffffFFFFULL),
+ wearable_types("wearable_types", 0xffffFFFFffffFFFFULL),
settings_types("settings_types", 0xffffFFFFffffFFFFULL),
thumbnails("thumbnails", FILTER_INCLUDE_THUMBNAILS),
- category_types("category_types", 0xffffFFFFffffFFFFULL),
- links("links", FILTERLINK_INCLUDE_LINKS),
- search_visibility("search_visibility", 0xFFFFFFFF),
- uuid("uuid"),
- date_range("date_range"),
- hours_ago("hours_ago", 0),
- date_search_direction("date_search_direction", FILTERDATEDIRECTION_NEWER),
- show_folder_state("show_folder_state", SHOW_NON_EMPTY_FOLDERS),
- creator_type("creator_type", FILTERCREATOR_ALL),
- permissions("permissions", PERM_NONE)
- {}
- };
-
- FilterOps(const Params& = Params());
-
- U32 mFilterTypes,
- mSearchVisibility;
- U64 mFilterObjectTypes, // For _OBJECT
- mFilterWearableTypes,
+ category_types("category_types", 0xffffFFFFffffFFFFULL),
+ links("links", FILTERLINK_INCLUDE_LINKS),
+ search_visibility("search_visibility", 0xFFFFFFFF),
+ uuid("uuid"),
+ date_range("date_range"),
+ hours_ago("hours_ago", 0),
+ date_search_direction("date_search_direction", FILTERDATEDIRECTION_NEWER),
+ show_folder_state("show_folder_state", SHOW_NON_EMPTY_FOLDERS),
+ creator_type("creator_type", FILTERCREATOR_ALL),
+ permissions("permissions", PERM_NONE)
+ {}
+ };
+
+ FilterOps(const Params& = Params());
+
+ U32 mFilterTypes,
+ mSearchVisibility;
+ U64 mFilterObjectTypes, // For _OBJECT
+ mFilterWearableTypes,
mFilterSettingsTypes, // for _SETTINGS
mFilterThumbnails,
- mFilterLinks,
- mFilterCategoryTypes; // For _CATEGORY
- LLUUID mFilterUUID; // for UUID
-
- time_t mMinDate,
- mMaxDate;
- U32 mHoursAgo;
- U32 mDateSearchDirection;
-
- EFolderShow mShowFolderState;
- PermissionMask mPermissions;
- EFilterCreatorType mFilterCreatorType;
- };
-
- struct Params : public LLInitParam::Block<Params>
- {
- Optional<std::string> name;
- Optional<FilterOps::Params> filter_ops;
- Optional<std::string> substring;
- Optional<bool> since_logoff;
-
- Params()
- : name("name"),
- filter_ops(""),
- substring("substring"),
- since_logoff("since_logoff")
- {}
- };
-
- LLInventoryFilter(const Params& p = Params());
- LLInventoryFilter(const LLInventoryFilter& other) { *this = other; }
- virtual ~LLInventoryFilter() {}
-
- // +-------------------------------------------------------------------+
- // + Parameters
- // +-------------------------------------------------------------------+
- U64 getFilterTypes() const;
- U64 getFilterObjectTypes() const;
- U64 getFilterCategoryTypes() const;
- U64 getFilterWearableTypes() const;
- U64 getFilterSettingsTypes() const;
- U64 getSearchVisibilityTypes() const;
+ mFilterLinks,
+ mFilterCategoryTypes; // For _CATEGORY
+ LLUUID mFilterUUID; // for UUID
+
+ time_t mMinDate,
+ mMaxDate;
+ U32 mHoursAgo;
+ U32 mDateSearchDirection;
+
+ EFolderShow mShowFolderState;
+ PermissionMask mPermissions;
+ EFilterCreatorType mFilterCreatorType;
+ };
+
+ struct Params : public LLInitParam::Block<Params>
+ {
+ Optional<std::string> name;
+ Optional<FilterOps::Params> filter_ops;
+ Optional<std::string> substring;
+ Optional<bool> since_logoff;
+
+ Params()
+ : name("name"),
+ filter_ops(""),
+ substring("substring"),
+ since_logoff("since_logoff")
+ {}
+ };
+
+ LLInventoryFilter(const Params& p = Params());
+ LLInventoryFilter(const LLInventoryFilter& other) { *this = other; }
+ virtual ~LLInventoryFilter() {}
+
+ // +-------------------------------------------------------------------+
+ // + Parameters
+ // +-------------------------------------------------------------------+
+ U64 getFilterTypes() const;
+ U64 getFilterObjectTypes() const;
+ U64 getFilterCategoryTypes() const;
+ U64 getFilterWearableTypes() const;
+ U64 getFilterSettingsTypes() const;
+ U64 getSearchVisibilityTypes() const;
U64 getFilterThumbnails() const;
- bool isFilterObjectTypesWith(LLInventoryType::EType t) const;
- void setFilterObjectTypes(U64 types);
- void setFilterCategoryTypes(U64 types);
- void setFilterUUID(const LLUUID &object_id);
- void setFilterWearableTypes(U64 types);
+ bool isFilterObjectTypesWith(LLInventoryType::EType t) const;
+ void setFilterObjectTypes(U64 types);
+ void setFilterCategoryTypes(U64 types);
+ void setFilterUUID(const LLUUID &object_id);
+ void setFilterWearableTypes(U64 types);
void setFilterSettingsTypes(U64 types);
- void setFilterEmptySystemFolders();
- void setFilterWorn();
- void setFilterMarketplaceActiveFolders();
- void setFilterMarketplaceInactiveFolders();
- void setFilterMarketplaceUnassociatedFolders();
+ void setFilterEmptySystemFolders();
+ void setFilterWorn();
+ void setFilterMarketplaceActiveFolders();
+ void setFilterMarketplaceInactiveFolders();
+ void setFilterMarketplaceUnassociatedFolders();
void setFilterMarketplaceListingFolders(bool select_only_listing_folders);
void setFilterNoMarketplaceFolder();
void setFilterThumbnails(U64 filter_thumbnails);
- void updateFilterTypes(U64 types, U64& current_types);
- void setSearchType(ESearchType type);
- ESearchType getSearchType() { return mSearchType; }
- void setFilterCreator(EFilterCreatorType type);
+ void updateFilterTypes(U64 types, U64& current_types);
+ void setSearchType(ESearchType type);
+ ESearchType getSearchType() { return mSearchType; }
+ void setFilterCreator(EFilterCreatorType type);
- void toggleSearchVisibilityLinks();
- void toggleSearchVisibilityTrash();
+ void toggleSearchVisibilityLinks();
+ void toggleSearchVisibilityTrash();
void toggleSearchVisibilityOutfits();
- void toggleSearchVisibilityLibrary();
- void setSearchVisibilityTypes(U32 types);
- void setSearchVisibilityTypes(const Params& params);
+ void toggleSearchVisibilityLibrary();
+ void setSearchVisibilityTypes(U32 types);
+ void setSearchVisibilityTypes(const Params& params);
- void setFilterSubString(const std::string& string);
- const std::string& getFilterSubString(BOOL trim = FALSE) const;
- const std::string& getFilterSubStringOrig() const { return mFilterSubStringOrig; }
- bool hasFilterString() const;
+ void setFilterSubString(const std::string& string);
+ const std::string& getFilterSubString(BOOL trim = FALSE) const;
+ const std::string& getFilterSubStringOrig() const { return mFilterSubStringOrig; }
+ bool hasFilterString() const;
void setSingleFolderMode(bool is_single_folder) { mSingleFolderMode = is_single_folder; }
- void setFilterPermissions(PermissionMask perms);
- PermissionMask getFilterPermissions() const;
-
- void setDateRange(time_t min_date, time_t max_date);
- void setDateRangeLastLogoff(BOOL sl);
- time_t getMinDate() const;
- time_t getMaxDate() const;
-
- void setHoursAgo(U32 hours);
- U32 getHoursAgo() const;
- void setDateSearchDirection(U32 direction);
- U32 getDateSearchDirection() const;
-
- void setFilterLinks(U64 filter_link);
- U64 getFilterLinks() const;
-
- // sets params for Link-only search and backs up search settings for future restoration
- void setFindAllLinksMode(const std::string &search_name, const LLUUID& search_id);
-
- // +-------------------------------------------------------------------+
- // + Execution And Results
- // +-------------------------------------------------------------------+
- bool check(const LLFolderViewModelItem* listener);
- bool check(const LLInventoryItem* item);
- bool checkFolder(const LLFolderViewModelItem* listener) const;
- bool checkFolder(const LLUUID& folder_id) const;
-
- bool showAllResults() const;
-
- std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const;
- std::string::size_type getFilterStringSize() const;
- // +-------------------------------------------------------------------+
- // + Presentation
- // +-------------------------------------------------------------------+
- void setShowFolderState( EFolderShow state);
- EFolderShow getShowFolderState() const;
- EFilterCreatorType getFilterCreatorType() const;
-
- void setEmptyLookupMessage(const std::string& message);
- void setDefaultEmptyLookupMessage(const std::string& message);
- std::string getEmptyLookupMessage(bool is_empty_folder = false) const;
-
- // +-------------------------------------------------------------------+
- // + Status
- // +-------------------------------------------------------------------+
- bool isActive() const;
- bool isModified() const;
- bool isSinceLogoff() const;
- void clearModified();
- const std::string& getName() const { return mName; }
- const std::string& getFilterText();
- //RN: this is public to allow system to externally force a global refilter
- void setModified(EFilterModified behavior = FILTER_RESTART);
-
- // +-------------------------------------------------------------------+
- // + Time
- // +-------------------------------------------------------------------+
- void resetTime(S32 timeout);
+ void setFilterPermissions(PermissionMask perms);
+ PermissionMask getFilterPermissions() const;
+
+ void setDateRange(time_t min_date, time_t max_date);
+ void setDateRangeLastLogoff(BOOL sl);
+ time_t getMinDate() const;
+ time_t getMaxDate() const;
+
+ void setHoursAgo(U32 hours);
+ U32 getHoursAgo() const;
+ void setDateSearchDirection(U32 direction);
+ U32 getDateSearchDirection() const;
+
+ void setFilterLinks(U64 filter_link);
+ U64 getFilterLinks() const;
+
+ // sets params for Link-only search and backs up search settings for future restoration
+ void setFindAllLinksMode(const std::string &search_name, const LLUUID& search_id);
+
+ // +-------------------------------------------------------------------+
+ // + Execution And Results
+ // +-------------------------------------------------------------------+
+ bool check(const LLFolderViewModelItem* listener);
+ bool check(const LLInventoryItem* item);
+ bool checkFolder(const LLFolderViewModelItem* listener) const;
+ bool checkFolder(const LLUUID& folder_id) const;
+
+ bool showAllResults() const;
+
+ std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const;
+ std::string::size_type getFilterStringSize() const;
+ // +-------------------------------------------------------------------+
+ // + Presentation
+ // +-------------------------------------------------------------------+
+ void setShowFolderState( EFolderShow state);
+ EFolderShow getShowFolderState() const;
+ EFilterCreatorType getFilterCreatorType() const;
+
+ void setEmptyLookupMessage(const std::string& message);
+ void setDefaultEmptyLookupMessage(const std::string& message);
+ std::string getEmptyLookupMessage(bool is_empty_folder = false) const;
+
+ // +-------------------------------------------------------------------+
+ // + Status
+ // +-------------------------------------------------------------------+
+ bool isActive() const;
+ bool isModified() const;
+ bool isSinceLogoff() const;
+ void clearModified();
+ const std::string& getName() const { return mName; }
+ const std::string& getFilterText();
+ //RN: this is public to allow system to externally force a global refilter
+ void setModified(EFilterModified behavior = FILTER_RESTART);
+
+ // +-------------------------------------------------------------------+
+ // + Time
+ // +-------------------------------------------------------------------+
+ void resetTime(S32 timeout);
bool isTimedOut();
-
- // +-------------------------------------------------------------------+
- // + Default
- // +-------------------------------------------------------------------+
- bool isDefault() const;
- bool isNotDefault() const;
- void markDefault();
- void resetDefault();
-
- // +-------------------------------------------------------------------+
- // + Generation
- // +-------------------------------------------------------------------+
- S32 getCurrentGeneration() const;
- S32 getFirstSuccessGeneration() const;
- S32 getFirstRequiredGeneration() const;
-
-
- // +-------------------------------------------------------------------+
- // + Conversion
- // +-------------------------------------------------------------------+
- void toParams(Params& params) const;
- void fromParams(const Params& p);
-
- LLInventoryFilter& operator =(const LLInventoryFilter& other);
+
+ // +-------------------------------------------------------------------+
+ // + Default
+ // +-------------------------------------------------------------------+
+ bool isDefault() const;
+ bool isNotDefault() const;
+ void markDefault();
+ void resetDefault();
+
+ // +-------------------------------------------------------------------+
+ // + Generation
+ // +-------------------------------------------------------------------+
+ S32 getCurrentGeneration() const;
+ S32 getFirstSuccessGeneration() const;
+ S32 getFirstRequiredGeneration() const;
+
+
+ // +-------------------------------------------------------------------+
+ // + Conversion
+ // +-------------------------------------------------------------------+
+ void toParams(Params& params) const;
+ void fromParams(const Params& p);
+
+ LLInventoryFilter& operator =(const LLInventoryFilter& other);
bool checkAgainstFilterThumbnails(const LLUUID& object_id) const;
private:
- bool areDateLimitsSet();
- bool checkAgainstFilterType(const class LLFolderViewModelItemInventory* listener) const;
- bool checkAgainstFilterType(const LLInventoryItem* item) const;
- bool checkAgainstPermissions(const class LLFolderViewModelItemInventory* listener) const;
- bool checkAgainstPermissions(const LLInventoryItem* item) const;
- bool checkAgainstFilterLinks(const class LLFolderViewModelItemInventory* listener) const;
- bool checkAgainstCreator(const class LLFolderViewModelItemInventory* listener) const;
- bool checkAgainstSearchVisibility(const class LLFolderViewModelItemInventory* listener) const;
- bool checkAgainstClipboard(const LLUUID& object_id) const;
-
- FilterOps mFilterOps;
- FilterOps mDefaultFilterOps;
- FilterOps mBackupFilterOps; // for backup purposes when leaving 'search link' mode
-
- std::string mFilterSubString;
- std::string mFilterSubStringOrig;
- std::string mUsername;
- const std::string mName;
-
- S32 mCurrentGeneration;
+ bool areDateLimitsSet();
+ bool checkAgainstFilterType(const class LLFolderViewModelItemInventory* listener) const;
+ bool checkAgainstFilterType(const LLInventoryItem* item) const;
+ bool checkAgainstPermissions(const class LLFolderViewModelItemInventory* listener) const;
+ bool checkAgainstPermissions(const LLInventoryItem* item) const;
+ bool checkAgainstFilterLinks(const class LLFolderViewModelItemInventory* listener) const;
+ bool checkAgainstCreator(const class LLFolderViewModelItemInventory* listener) const;
+ bool checkAgainstSearchVisibility(const class LLFolderViewModelItemInventory* listener) const;
+ bool checkAgainstClipboard(const LLUUID& object_id) const;
+
+ FilterOps mFilterOps;
+ FilterOps mDefaultFilterOps;
+ FilterOps mBackupFilterOps; // for backup purposes when leaving 'search link' mode
+
+ std::string mFilterSubString;
+ std::string mFilterSubStringOrig;
+ std::string mUsername;
+ const std::string mName;
+
+ S32 mCurrentGeneration;
// The following makes checking for pass/no pass possible even if the item is not checked against the current generation
// Any item that *did not pass* the "required generation" will *not pass* the current one
// Any item that *passes* the "success generation" will *pass* the current one
- S32 mFirstRequiredGeneration;
- S32 mFirstSuccessGeneration;
+ S32 mFirstRequiredGeneration;
+ S32 mFirstSuccessGeneration;
+
+ EFilterModified mFilterModified;
+ LLTimer mFilterTime;
- EFilterModified mFilterModified;
- LLTimer mFilterTime;
-
- std::string mFilterText;
- std::string mEmptyLookupMessage;
- std::string mDefaultEmptyLookupMessage;
+ std::string mFilterText;
+ std::string mEmptyLookupMessage;
+ std::string mDefaultEmptyLookupMessage;
- ESearchType mSearchType;
+ ESearchType mSearchType;
- std::vector<std::string> mFilterTokens;
- std::string mExactToken;
+ std::vector<std::string> mFilterTokens;
+ std::string mExactToken;
bool mSingleFolderMode;
};
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index ea0566f5c4..168099f1e7 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventoryfunctions.cpp
* @brief Implementation of the inventory view and associated stuff.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -152,19 +152,19 @@ S32 count_stock_folders(LLInventoryModel::cat_array_t& categories)
// Helper funtion : Count the number of items (not folders) in the descending hierarchy
S32 count_descendants_items(const LLUUID& cat_id)
{
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array);
-
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array);
+
S32 count = item_array->size();
-
+
LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
- for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
+ for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
{
- LLViewerInventoryCategory* category = *iter;
+ LLViewerInventoryCategory* category = *iter;
count += count_descendants_items(category->getUUID());
}
-
+
return count;
}
@@ -179,7 +179,7 @@ bool contains_nocopy_items(const LLUUID& id)
LLInventoryModel::cat_array_t* cat_array;
LLInventoryModel::item_array_t* item_array;
gInventory.getDirectDescendentsOf(id,cat_array,item_array);
-
+
// Check all the items: returns true upon encountering a nocopy item
for (LLInventoryModel::item_array_t::iterator iter = item_array->begin(); iter != item_array->end(); iter++)
{
@@ -190,7 +190,7 @@ bool contains_nocopy_items(const LLUUID& id)
return true;
}
}
-
+
// Check all the sub folders recursively
for (LLInventoryModel::cat_array_t::iterator iter = cat_array->begin(); iter != cat_array->end(); iter++)
{
@@ -203,14 +203,14 @@ bool contains_nocopy_items(const LLUUID& id)
}
else
{
- LLInventoryItem* item = gInventory.getItem(id);
+ LLInventoryItem* item = gInventory.getItem(id);
LLViewerInventoryItem * inv_item = (LLViewerInventoryItem *) item;
if (!inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()))
{
return true;
}
}
-
+
// Exit without meeting a nocopy item
return false;
}
@@ -218,21 +218,21 @@ bool contains_nocopy_items(const LLUUID& id)
// Generates a string containing the path to the item specified by id.
void append_path(const LLUUID& id, std::string& path)
{
- std::string temp;
- const LLInventoryObject* obj = gInventory.getObject(id);
- LLUUID parent_id;
- if(obj) parent_id = obj->getParentUUID();
- std::string forward_slash("/");
- while(obj)
- {
- obj = gInventory.getCategory(parent_id);
- if(obj)
- {
- temp.assign(forward_slash + obj->getName() + temp);
- parent_id = obj->getParentUUID();
- }
- }
- path.append(temp);
+ std::string temp;
+ const LLInventoryObject* obj = gInventory.getObject(id);
+ LLUUID parent_id;
+ if(obj) parent_id = obj->getParentUUID();
+ std::string forward_slash("/");
+ while(obj)
+ {
+ obj = gInventory.getCategory(parent_id);
+ if(obj)
+ {
+ temp.assign(forward_slash + obj->getName() + temp);
+ parent_id = obj->getParentUUID();
+ }
+ }
+ path.append(temp);
}
// Generates a string containing the path name of the object.
@@ -273,10 +273,10 @@ void update_marketplace_folder_hierarchy(const LLUUID cat_id)
gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id);
// Update all descendent folders down
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array);
-
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array);
+
LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
{
@@ -291,9 +291,9 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc
// When changing the marketplace status of an item, we usually have to change the status of all
// folders in the same listing. This is because the display of each folder is affected by the
// overall status of the whole listing.
- // Consequently, the only way to correctly update an item anywhere in the marketplace is to
+ // Consequently, the only way to correctly update an item anywhere in the marketplace is to
// update the whole listing from its listing root.
- // This is not as bad as it seems as we only update folders, not items, and the folder nesting depth
+ // This is not as bad as it seems as we only update folders, not items, and the folder nesting depth
// is limited to 4.
// We also take care of degenerated cases so we don't update all folders in the inventory by mistake.
@@ -303,7 +303,7 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc
{
return;
}
-
+
// Grab marketplace listing data for this item
S32 depth = depth_nesting_in_marketplace(cur_uuid);
if (depth > 0)
@@ -312,7 +312,7 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc
LLUUID listing_uuid = nested_parent_id(cur_uuid, depth);
LLViewerInventoryCategory* listing_cat = gInventory.getCategory(listing_uuid);
bool listing_cat_loaded = listing_cat != NULL && listing_cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN;
-
+
// Verify marketplace data consistency for this listing
if (perform_consistency_enforcement
&& listing_cat_loaded
@@ -336,7 +336,7 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc
LLMarketplaceData::instance().activateListing(listing_uuid, false,1);
}
}
-
+
// Check if the count on hand needs to be updated on SLM
if (perform_consistency_enforcement
&& listing_cat_loaded
@@ -377,10 +377,10 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc
void update_all_marketplace_count(const LLUUID& cat_id)
{
// Get all descendent folders down
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array);
-
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array);
+
LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
{
@@ -412,19 +412,19 @@ void update_all_marketplace_count()
void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name)
{
- LLViewerInventoryCategory* cat;
+ LLViewerInventoryCategory* cat;
- if (!model ||
- !get_is_category_renameable(model, cat_id) ||
- (cat = model->getCategory(cat_id)) == NULL ||
- cat->getName() == new_name)
- {
- return;
- }
+ if (!model ||
+ !get_is_category_renameable(model, cat_id) ||
+ (cat = model->getCategory(cat_id)) == NULL ||
+ cat->getName() == new_name)
+ {
+ return;
+ }
- LLSD updates;
- updates["name"] = new_name;
- update_inventory_category(cat_id, updates, NULL);
+ LLSD updates;
+ updates["name"] = new_name;
+ update_inventory_category(cat_id, updates, NULL);
}
void copy_inventory_category(LLInventoryModel* model,
@@ -448,7 +448,7 @@ void copy_inventory_category(LLInventoryModel* model,
bool move_no_copy_items,
inventory_func_type callback)
{
- // Create the initial folder
+ // Create the initial folder
inventory_func_type func = [model, cat, root_copy_id, move_no_copy_items, callback](const LLUUID &new_id)
{
copy_inventory_category_content(new_id, model, cat, root_copy_id, move_no_copy_items);
@@ -457,7 +457,7 @@ void copy_inventory_category(LLInventoryModel* model,
callback(new_id);
}
};
- gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName(), func, cat->getThumbnailUUID());
+ gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName(), func, cat->getThumbnailUUID());
}
void copy_cb(const LLUUID& dest_folder, const LLUUID& root_id)
@@ -469,21 +469,21 @@ void copy_cb(const LLUUID& dest_folder, const LLUUID& root_id)
void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& root_copy_id, bool move_no_copy_items)
{
- model->notifyObservers();
+ model->notifyObservers();
- // We need to exclude the initial root of the copy to avoid recursively copying the copy, etc...
- LLUUID root_id = (root_copy_id.isNull() ? new_cat_uuid : root_copy_id);
+ // We need to exclude the initial root of the copy to avoid recursively copying the copy, etc...
+ LLUUID root_id = (root_copy_id.isNull() ? new_cat_uuid : root_copy_id);
- // Get the content of the folder
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(cat->getUUID(), cat_array, item_array);
+ // Get the content of the folder
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(cat->getUUID(), cat_array, item_array);
- // If root_copy_id is null, tell the marketplace model we'll be waiting for new items to be copied over for this folder
- if (root_copy_id.isNull())
- {
- LLMarketplaceData::instance().setValidationWaiting(root_id, count_descendants_items(cat->getUUID()));
- }
+ // If root_copy_id is null, tell the marketplace model we'll be waiting for new items to be copied over for this folder
+ if (root_copy_id.isNull())
+ {
+ LLMarketplaceData::instance().setValidationWaiting(root_id, count_descendants_items(cat->getUUID()));
+ }
LLPointer<LLInventoryCallback> cb;
if (root_copy_id.isNull())
@@ -495,348 +495,348 @@ void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryMode
cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid));
}
- // Copy all the items
- LLInventoryModel::item_array_t item_array_copy = *item_array;
- for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
- {
- LLInventoryItem* item = *iter;
-
- if (item->getIsLinkType())
- {
- link_inventory_object(new_cat_uuid, item->getLinkedUUID(), cb);
- }
- else if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()))
- {
- // If the item is nocopy, we do nothing or, optionally, move it
- if (move_no_copy_items)
- {
- // Reparent the item
- LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *)item;
- gInventory.changeItemParent(viewer_inv_item, new_cat_uuid, true);
- }
+ // Copy all the items
+ LLInventoryModel::item_array_t item_array_copy = *item_array;
+ for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
+ {
+ LLInventoryItem* item = *iter;
+
+ if (item->getIsLinkType())
+ {
+ link_inventory_object(new_cat_uuid, item->getLinkedUUID(), cb);
+ }
+ else if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()))
+ {
+ // If the item is nocopy, we do nothing or, optionally, move it
+ if (move_no_copy_items)
+ {
+ // Reparent the item
+ LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *)item;
+ gInventory.changeItemParent(viewer_inv_item, new_cat_uuid, true);
+ }
if (root_copy_id.isNull())
{
// Decrement the count in root_id since that one item won't be copied over
LLMarketplaceData::instance().decrementValidationWaiting(root_id);
}
- }
- else
- {
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- new_cat_uuid,
- std::string(),
- cb);
- }
- }
-
- // Copy all the folders
- LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
- for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
- {
- LLViewerInventoryCategory* category = *iter;
- if (category->getUUID() != root_id)
- {
- copy_inventory_category(model, category, new_cat_uuid, root_id, move_no_copy_items);
- }
- }
+ }
+ else
+ {
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ new_cat_uuid,
+ std::string(),
+ cb);
+ }
+ }
+
+ // Copy all the folders
+ LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
+ for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
+ {
+ LLViewerInventoryCategory* category = *iter;
+ if (category->getUUID() != root_id)
+ {
+ copy_inventory_category(model, category, new_cat_uuid, root_id, move_no_copy_items);
+ }
+ }
}
class LLInventoryCollectAllItems : public LLInventoryCollectFunctor
{
public:
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
- {
- return true;
- }
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+ {
+ return true;
+ }
};
BOOL get_is_parent_to_worn_item(const LLUUID& id)
{
- const LLViewerInventoryCategory* cat = gInventory.getCategory(id);
- if (!cat)
- {
- return FALSE;
- }
+ const LLViewerInventoryCategory* cat = gInventory.getCategory(id);
+ if (!cat)
+ {
+ return FALSE;
+ }
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLInventoryCollectAllItems collect_all;
- gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), cats, items, LLInventoryModel::EXCLUDE_TRASH, collect_all);
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLInventoryCollectAllItems collect_all;
+ gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), cats, items, LLInventoryModel::EXCLUDE_TRASH, collect_all);
- for (LLInventoryModel::item_array_t::const_iterator it = items.begin(); it != items.end(); ++it)
- {
- const LLViewerInventoryItem * const item = *it;
+ for (LLInventoryModel::item_array_t::const_iterator it = items.begin(); it != items.end(); ++it)
+ {
+ const LLViewerInventoryItem * const item = *it;
- llassert(item->getIsLinkType());
+ llassert(item->getIsLinkType());
- LLUUID linked_id = item->getLinkedUUID();
- const LLViewerInventoryItem * const linked_item = gInventory.getItem(linked_id);
+ LLUUID linked_id = item->getLinkedUUID();
+ const LLViewerInventoryItem * const linked_item = gInventory.getItem(linked_id);
- if (linked_item)
- {
- LLUUID parent_id = linked_item->getParentUUID();
+ if (linked_item)
+ {
+ LLUUID parent_id = linked_item->getParentUUID();
- while (!parent_id.isNull())
- {
- LLInventoryCategory * parent_cat = gInventory.getCategory(parent_id);
+ while (!parent_id.isNull())
+ {
+ LLInventoryCategory * parent_cat = gInventory.getCategory(parent_id);
- if (cat == parent_cat)
- {
- return TRUE;
- }
+ if (cat == parent_cat)
+ {
+ return TRUE;
+ }
- parent_id = parent_cat->getParentUUID();
- }
- }
- }
+ parent_id = parent_cat->getParentUUID();
+ }
+ }
+ }
- return FALSE;
+ return FALSE;
}
BOOL get_is_item_worn(const LLUUID& id)
{
- const LLViewerInventoryItem* item = gInventory.getItem(id);
- if (!item)
- return FALSE;
+ const LLViewerInventoryItem* item = gInventory.getItem(id);
+ if (!item)
+ return FALSE;
if (item->getIsLinkType() && !gInventory.getItem(item->getLinkedUUID()))
{
return FALSE;
}
- // Consider the item as worn if it has links in COF.
- if (LLAppearanceMgr::instance().isLinkedInCOF(id))
- {
- return TRUE;
- }
-
- switch(item->getType())
- {
- case LLAssetType::AT_OBJECT:
- {
- if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
- return TRUE;
- break;
- }
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_CLOTHING:
- if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
- return TRUE;
- break;
- case LLAssetType::AT_GESTURE:
- if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID()))
- return TRUE;
- break;
- default:
- break;
- }
- return FALSE;
+ // Consider the item as worn if it has links in COF.
+ if (LLAppearanceMgr::instance().isLinkedInCOF(id))
+ {
+ return TRUE;
+ }
+
+ switch(item->getType())
+ {
+ case LLAssetType::AT_OBJECT:
+ {
+ if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
+ return TRUE;
+ break;
+ }
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
+ return TRUE;
+ break;
+ case LLAssetType::AT_GESTURE:
+ if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID()))
+ return TRUE;
+ break;
+ default:
+ break;
+ }
+ return FALSE;
}
BOOL get_can_item_be_worn(const LLUUID& id)
{
- const LLViewerInventoryItem* item = gInventory.getItem(id);
- if (!item)
- return FALSE;
-
- if (LLAppearanceMgr::instance().isLinkedInCOF(item->getLinkedUUID()))
- {
- // an item having links in COF (i.e. a worn item)
- return FALSE;
- }
-
- if (gInventory.isObjectDescendentOf(id, LLAppearanceMgr::instance().getCOF()))
- {
- // a non-link object in COF (should not normally happen)
- return FALSE;
- }
-
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(
- LLFolderType::FT_TRASH);
-
- // item can't be worn if base obj in trash, see EXT-7015
- if (gInventory.isObjectDescendentOf(item->getLinkedUUID(),
- trash_id))
- {
- return false;
- }
-
- switch(item->getType())
- {
- case LLAssetType::AT_OBJECT:
- {
- if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
- {
- // Already being worn
- return FALSE;
- }
- else
- {
- // Not being worn yet.
- return TRUE;
- }
- break;
- }
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_CLOTHING:
- if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
- {
- // Already being worn
- return FALSE;
- }
- else
- {
- // Not being worn yet.
- return TRUE;
- }
- break;
- default:
- break;
- }
- return FALSE;
+ const LLViewerInventoryItem* item = gInventory.getItem(id);
+ if (!item)
+ return FALSE;
+
+ if (LLAppearanceMgr::instance().isLinkedInCOF(item->getLinkedUUID()))
+ {
+ // an item having links in COF (i.e. a worn item)
+ return FALSE;
+ }
+
+ if (gInventory.isObjectDescendentOf(id, LLAppearanceMgr::instance().getCOF()))
+ {
+ // a non-link object in COF (should not normally happen)
+ return FALSE;
+ }
+
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(
+ LLFolderType::FT_TRASH);
+
+ // item can't be worn if base obj in trash, see EXT-7015
+ if (gInventory.isObjectDescendentOf(item->getLinkedUUID(),
+ trash_id))
+ {
+ return false;
+ }
+
+ switch(item->getType())
+ {
+ case LLAssetType::AT_OBJECT:
+ {
+ if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
+ {
+ // Already being worn
+ return FALSE;
+ }
+ else
+ {
+ // Not being worn yet.
+ return TRUE;
+ }
+ break;
+ }
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
+ {
+ // Already being worn
+ return FALSE;
+ }
+ else
+ {
+ // Not being worn yet.
+ return TRUE;
+ }
+ break;
+ default:
+ break;
+ }
+ return FALSE;
}
BOOL get_is_item_removable(const LLInventoryModel* model, const LLUUID& id)
{
- if (!model)
- {
- return FALSE;
- }
-
- // Can't delete an item that's in the library.
- if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID()))
- {
- return FALSE;
- }
-
- // Disable delete from COF folder; have users explicitly choose "detach/take off",
- // unless the item is not worn but in the COF (i.e. is bugged).
- if (LLAppearanceMgr::instance().getIsProtectedCOFItem(id))
- {
- if (get_is_item_worn(id))
- {
- return FALSE;
- }
- }
-
- const LLInventoryObject *obj = model->getItem(id);
- if (obj && obj->getIsLinkType())
- {
- return TRUE;
- }
- if (get_is_item_worn(id))
- {
- return FALSE;
- }
- return TRUE;
+ if (!model)
+ {
+ return FALSE;
+ }
+
+ // Can't delete an item that's in the library.
+ if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID()))
+ {
+ return FALSE;
+ }
+
+ // Disable delete from COF folder; have users explicitly choose "detach/take off",
+ // unless the item is not worn but in the COF (i.e. is bugged).
+ if (LLAppearanceMgr::instance().getIsProtectedCOFItem(id))
+ {
+ if (get_is_item_worn(id))
+ {
+ return FALSE;
+ }
+ }
+
+ const LLInventoryObject *obj = model->getItem(id);
+ if (obj && obj->getIsLinkType())
+ {
+ return TRUE;
+ }
+ if (get_is_item_worn(id))
+ {
+ return FALSE;
+ }
+ return TRUE;
}
bool get_is_item_editable(const LLUUID& inv_item_id)
{
- if (const LLInventoryItem* inv_item = gInventory.getLinkedItem(inv_item_id))
- {
- switch (inv_item->getType())
- {
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_CLOTHING:
- return gAgentWearables.isWearableModifiable(inv_item_id);
- case LLAssetType::AT_OBJECT:
- return true;
- default:
+ if (const LLInventoryItem* inv_item = gInventory.getLinkedItem(inv_item_id))
+ {
+ switch (inv_item->getType())
+ {
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ return gAgentWearables.isWearableModifiable(inv_item_id);
+ case LLAssetType::AT_OBJECT:
+ return true;
+ default:
return false;;
- }
- }
- return gAgentAvatarp->getWornAttachment(inv_item_id) != nullptr;
+ }
+ }
+ return gAgentAvatarp->getWornAttachment(inv_item_id) != nullptr;
}
void handle_item_edit(const LLUUID& inv_item_id)
{
- if (get_is_item_editable(inv_item_id))
- {
- if (const LLInventoryItem* inv_item = gInventory.getLinkedItem(inv_item_id))
- {
- switch (inv_item->getType())
- {
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_CLOTHING:
- LLAgentWearables::editWearable(inv_item_id);
- break;
- case LLAssetType::AT_OBJECT:
- handle_attachment_edit(inv_item_id);
- break;
- default:
- break;
- }
- }
- else
- {
- handle_attachment_edit(inv_item_id);
- }
- }
+ if (get_is_item_editable(inv_item_id))
+ {
+ if (const LLInventoryItem* inv_item = gInventory.getLinkedItem(inv_item_id))
+ {
+ switch (inv_item->getType())
+ {
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ LLAgentWearables::editWearable(inv_item_id);
+ break;
+ case LLAssetType::AT_OBJECT:
+ handle_attachment_edit(inv_item_id);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ handle_attachment_edit(inv_item_id);
+ }
+ }
}
BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id)
{
- // NOTE: This function doesn't check the folder's children.
- // See LLFolderBridge::isItemRemovable for a function that does
- // consider the children.
+ // NOTE: This function doesn't check the folder's children.
+ // See LLFolderBridge::isItemRemovable for a function that does
+ // consider the children.
+
+ if (!model)
+ {
+ return FALSE;
+ }
- if (!model)
- {
- return FALSE;
- }
+ if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID()))
+ {
+ return FALSE;
+ }
- if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID()))
- {
- return FALSE;
- }
+ if (!isAgentAvatarValid()) return FALSE;
- if (!isAgentAvatarValid()) return FALSE;
+ const LLInventoryCategory* category = model->getCategory(id);
+ if (!category)
+ {
+ return FALSE;
+ }
- const LLInventoryCategory* category = model->getCategory(id);
- if (!category)
- {
- return FALSE;
- }
+ const LLFolderType::EType folder_type = category->getPreferredType();
- const LLFolderType::EType folder_type = category->getPreferredType();
-
- if (LLFolderType::lookupIsProtectedType(folder_type))
- {
- return FALSE;
- }
+ if (LLFolderType::lookupIsProtectedType(folder_type))
+ {
+ return FALSE;
+ }
- // Can't delete the outfit that is currently being worn.
- if (folder_type == LLFolderType::FT_OUTFIT)
- {
- const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink();
- if (base_outfit_link && (category == base_outfit_link->getLinkedCategory()))
- {
- return FALSE;
- }
- }
+ // Can't delete the outfit that is currently being worn.
+ if (folder_type == LLFolderType::FT_OUTFIT)
+ {
+ const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink();
+ if (base_outfit_link && (category == base_outfit_link->getLinkedCategory()))
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id)
{
- if (!model)
- {
- return FALSE;
- }
+ if (!model)
+ {
+ return FALSE;
+ }
- LLViewerInventoryCategory* cat = model->getCategory(id);
+ LLViewerInventoryCategory* cat = model->getCategory(id);
- if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()) &&
- cat->getOwnerID() == gAgent.getID())
- {
- return TRUE;
- }
- return FALSE;
+ if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()) &&
+ cat->getOwnerID() == gAgent.getID())
+ {
+ return TRUE;
+ }
+ return FALSE;
}
void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id)
@@ -844,13 +844,13 @@ void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id)
LLSD params;
params["id"] = item_uuid;
params["object"] = object_id;
-
+
LLFloaterReg::showInstance("item_properties", params);
}
void show_item_profile(const LLUUID& item_uuid)
{
- LLUUID linked_uuid = gInventory.getLinkedItemID(item_uuid);
+ LLUUID linked_uuid = gInventory.getLinkedItemID(item_uuid);
LLFloaterReg::showInstance("item_properties", LLSD().with("id", linked_uuid));
}
@@ -877,7 +877,7 @@ void show_item_original(const LLUUID& item_uuid)
LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL;
return;
}
- LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
if (sidepanel_inventory)
{
LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel();
@@ -920,20 +920,20 @@ void show_item_original(const LLUUID& item_uuid)
void reset_inventory_filter()
{
- LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
- if (sidepanel_inventory)
- {
- LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel();
- if (main_inventory)
- {
- main_inventory->onFilterEdit("");
- }
- }
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ if (sidepanel_inventory)
+ {
+ LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel();
+ if (main_inventory)
+ {
+ main_inventory->onFilterEdit("");
+ }
+ }
}
void open_marketplace_listings()
{
- LLFloaterReg::showInstance("marketplace_listings");
+ LLFloaterReg::showInstance("marketplace_listings");
}
///----------------------------------------------------------------------------
@@ -960,7 +960,7 @@ S32 depth_nesting_in_marketplace(LLUUID cur_uuid)
{
return -1;
}
-
+
// Iterate through the parents till we hit the marketplace listings root
// Note that the marketplace listings root itself will return 0
S32 depth = 0;
@@ -1062,13 +1062,13 @@ S32 compute_stock_count(LLUUID cat_uuid, bool force_count /* false */)
}
}
}
-
+
// In all other cases, the stock count is the min of stock folders count found in the descendents
// "COMPUTE_STOCK_NOT_EVALUATED" denotes that a stock folder in the hierarchy has a count that cannot be evaluated at this time (folder not up to date)
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array);
-
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array);
+
// "COMPUTE_STOCK_INFINITE" denotes a folder that doesn't countain any stock folders in its descendents
S32 curr_count = COMPUTE_STOCK_INFINITE;
@@ -1083,147 +1083,147 @@ S32 compute_stock_count(LLUUID cat_uuid, bool force_count /* false */)
curr_count = count;
}
}
-
+
return curr_count;
}
// local helper
bool can_move_to_marketplace(LLInventoryItem* inv_item, std::string& tooltip_msg, bool resolve_links)
{
- // Collapse links directly to items/folders
- LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
- LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
+ // Collapse links directly to items/folders
+ LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
+ LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory();
// Linked items and folders cannot be put for sale
if (linked_category || linked_item)
{
- tooltip_msg = LLTrans::getString("TooltipOutboxLinked");
+ tooltip_msg = LLTrans::getString("TooltipOutboxLinked");
return false;
}
-
+
// A category is always considered as passing...
if (linked_category != NULL)
- {
+ {
return true;
- }
-
+ }
+
// Take the linked item if necessary
if (linked_item != NULL)
- {
- inv_item = linked_item;
- }
-
+ {
+ inv_item = linked_item;
+ }
+
// Check that the agent has transfer permission on the item: this is required as a resident cannot
// put on sale items she cannot transfer. Proceed with move if we have permission.
- bool allow_transfer = inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
- if (!allow_transfer)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxNoTransfer");
- return false;
- }
-
+ bool allow_transfer = inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
+ if (!allow_transfer)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutboxNoTransfer");
+ return false;
+ }
+
// Check worn/not worn status: worn items cannot be put on the marketplace
- bool worn = get_is_item_worn(inv_item->getUUID());
- if (worn)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxWorn");
- return false;
- }
+ bool worn = get_is_item_worn(inv_item->getUUID());
+ if (worn)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutboxWorn");
+ return false;
+ }
// Check library status: library items cannot be put on the marketplace
- if (!gInventory.isObjectDescendentOf(inv_item->getUUID(), gInventory.getRootFolderID()))
+ if (!gInventory.isObjectDescendentOf(inv_item->getUUID(), gInventory.getRootFolderID()))
{
- tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
- return false;
+ tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory");
+ return false;
}
// Check type: for the moment, calling cards cannot be put on the marketplace
- bool calling_card = (LLAssetType::AT_CALLINGCARD == inv_item->getType());
- if (calling_card)
- {
- tooltip_msg = LLTrans::getString("TooltipOutboxCallingCard");
- return false;
- }
-
- return true;
+ bool calling_card = (LLAssetType::AT_CALLINGCARD == inv_item->getType());
+ if (calling_card)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutboxCallingCard");
+ return false;
+ }
+
+ return true;
}
// local helper
// Returns the max tree length (in folder nodes) down from the argument folder
int get_folder_levels(LLInventoryCategory* inv_cat)
{
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(inv_cat->getUUID(), cats, items);
-
- int max_child_levels = 0;
-
- for (S32 i=0; i < cats->size(); ++i)
- {
- LLInventoryCategory* category = cats->at(i);
- max_child_levels = llmax(max_child_levels, get_folder_levels(category));
- }
-
- return 1 + max_child_levels;
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ gInventory.getDirectDescendentsOf(inv_cat->getUUID(), cats, items);
+
+ int max_child_levels = 0;
+
+ for (S32 i=0; i < cats->size(); ++i)
+ {
+ LLInventoryCategory* category = cats->at(i);
+ max_child_levels = llmax(max_child_levels, get_folder_levels(category));
+ }
+
+ return 1 + max_child_levels;
}
// local helper
// Returns the distance (in folder nodes) between the ancestor and its descendant. Returns -1 if not related.
int get_folder_path_length(const LLUUID& ancestor_id, const LLUUID& descendant_id)
{
- int depth = 0;
-
- if (ancestor_id == descendant_id) return depth;
-
- const LLInventoryCategory* category = gInventory.getCategory(descendant_id);
-
- while (category)
- {
- LLUUID parent_id = category->getParentUUID();
-
- if (parent_id.isNull()) break;
-
- depth++;
-
- if (parent_id == ancestor_id) return depth;
-
- category = gInventory.getCategory(parent_id);
- }
-
- LL_WARNS("SLM") << "get_folder_path_length() couldn't trace a path from the descendant to the ancestor" << LL_ENDL;
- return -1;
+ int depth = 0;
+
+ if (ancestor_id == descendant_id) return depth;
+
+ const LLInventoryCategory* category = gInventory.getCategory(descendant_id);
+
+ while (category)
+ {
+ LLUUID parent_id = category->getParentUUID();
+
+ if (parent_id.isNull()) break;
+
+ depth++;
+
+ if (parent_id == ancestor_id) return depth;
+
+ category = gInventory.getCategory(parent_id);
+ }
+
+ LL_WARNS("SLM") << "get_folder_path_length() couldn't trace a path from the descendant to the ancestor" << LL_ENDL;
+ return -1;
}
// local helper
// Returns true if all items within the argument folder are fit for sale, false otherwise
bool has_correct_permissions_for_sale(LLInventoryCategory* cat, std::string& error_msg)
{
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array);
-
- LLInventoryModel::item_array_t item_array_copy = *item_array;
-
- for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
- {
- LLInventoryItem* item = *iter;
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array);
+
+ LLInventoryModel::item_array_t item_array_copy = *item_array;
+
+ for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
+ {
+ LLInventoryItem* item = *iter;
if (!can_move_to_marketplace(item, error_msg, false))
{
return false;
}
- }
-
- LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
-
- for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
- {
- LLInventoryCategory* category = *iter;
- if (!has_correct_permissions_for_sale(category, error_msg))
+ }
+
+ LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
+
+ for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
+ {
+ LLInventoryCategory* category = *iter;
+ if (!has_correct_permissions_for_sale(category, error_msg))
{
return false;
}
- }
+ }
return true;
}
@@ -1246,18 +1246,18 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve
{
accept = can_move_to_marketplace(inv_item, tooltip_msg, true);
}
-
+
// Check that the total amount of items won't violate the max limit on the marketplace
if (accept)
{
// If the dest folder is a stock folder, we do not count the incoming items toward the total (stock items are seen as one)
int existing_item_count = (move_in_stock ? 0 : bundle_size);
-
+
// If the dest folder is a stock folder, we do assume that the incoming items are also stock items (they should anyway)
int existing_stock_count = (move_in_stock ? bundle_size : 0);
-
+
int existing_folder_count = 0;
-
+
// Get the version folder: that's where the counts start from
const LLViewerInventoryCategory * version_folder = ((root_folder && (root_folder != dest_folder)) ? gInventory.getFirstDescendantOf(root_folder->getUUID(), dest_folder->getUUID()) : NULL);
@@ -1271,13 +1271,13 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve
LLInventoryModel::cat_array_t existing_categories;
LLInventoryModel::item_array_t existing_items;
-
+
gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, FALSE);
-
+
existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories);
existing_stock_count += count_stock_items(existing_items);
existing_folder_count += existing_categories.size();
-
+
// If the incoming item is a nocopy (stock) item, we need to consider that it will create a stock folder
if (!inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && !move_in_stock)
{
@@ -1285,7 +1285,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve
existing_folder_count += 1;
}
}
-
+
if (existing_item_count > gSavedSettings.getU32("InventoryOutboxMaxItemCount"))
{
LLStringUtil::format_map_t args;
@@ -1321,7 +1321,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve
bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size, bool check_items, bool from_paste)
{
bool accept = true;
-
+
// Compute the nested folders level we'll add into with that incoming folder
int incoming_folder_depth = get_folder_levels(inv_cat);
// Compute the nested folders level we're inserting ourselves in
@@ -1330,7 +1330,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn
// Get the version folder: that's where the folders and items counts start from
const LLViewerInventoryCategory * version_folder = (insertion_point_folder_depth >= 2 ? gInventory.getFirstDescendantOf(root_folder->getUUID(), dest_folder->getUUID()) : NULL);
-
+
// Compare the whole with the nested folders depth limit
// Note: substract 2 as we leave root and version folder out of the count threshold
if ((incoming_folder_depth + insertion_point_folder_depth - 2) > (S32)(gSavedSettings.getU32("InventoryOutboxMaxFolderDepth")))
@@ -1341,20 +1341,20 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn
tooltip_msg = LLTrans::getString("TooltipOutboxFolderLevels", args);
accept = false;
}
-
+
if (accept)
{
LLInventoryModel::cat_array_t descendent_categories;
LLInventoryModel::item_array_t descendent_items;
gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, FALSE);
-
+
int dragged_folder_count = descendent_categories.size() + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong...
int dragged_item_count = count_copyable_items(descendent_items) + count_stock_folders(descendent_categories);
int dragged_stock_count = count_stock_items(descendent_items);
int existing_item_count = 0;
int existing_stock_count = 0;
int existing_folder_count = 0;
-
+
if (version_folder)
{
if (!from_paste && gInventory.isObjectDescendentOf(inv_cat->getUUID(), version_folder->getUUID()))
@@ -1364,21 +1364,21 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn
dragged_item_count = 0;
dragged_stock_count = 0;
}
-
+
// Tally the total number of categories and items inside the root folder
LLInventoryModel::cat_array_t existing_categories;
LLInventoryModel::item_array_t existing_items;
gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, FALSE);
-
+
existing_folder_count += existing_categories.size();
existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories);
existing_stock_count += count_stock_items(existing_items);
}
-
+
const int total_folder_count = existing_folder_count + dragged_folder_count;
const int total_item_count = existing_item_count + dragged_item_count;
const int total_stock_count = existing_stock_count + dragged_stock_count;
-
+
if (total_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount"))
{
LLStringUtil::format_map_t args;
@@ -1403,7 +1403,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn
tooltip_msg = LLTrans::getString("TooltipOutboxTooManyStockItems", args);
accept = false;
}
-
+
// Now check that each item in the folder can be moved in the marketplace
if (accept && check_items)
{
@@ -1418,7 +1418,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn
}
}
}
-
+
return accept;
}
@@ -1429,33 +1429,33 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
S32 depth = depth_nesting_in_marketplace(dest_folder);
if (depth < 0)
{
- LLSD subs;
- subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Prefix") + LLTrans::getString("Marketplace Error Not Merchant");
- LLNotificationsUtil::add("MerchantPasteFailed", subs);
+ LLSD subs;
+ subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Prefix") + LLTrans::getString("Marketplace Error Not Merchant");
+ LLNotificationsUtil::add("MerchantPasteFailed", subs);
return false;
}
// We will collapse links into items/folders
- LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
- LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory();
-
- if (linked_category != NULL)
- {
+ LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
+ LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory();
+
+ if (linked_category != NULL)
+ {
// Move the linked folder directly
- return move_folder_to_marketplacelistings(linked_category, dest_folder, copy);
- }
- else
- {
+ return move_folder_to_marketplacelistings(linked_category, dest_folder, copy);
+ }
+ else
+ {
// Grab the linked item if any
- LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
+ LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
viewer_inv_item = (linked_item != NULL ? linked_item : viewer_inv_item);
-
+
// If we want to copy but the item is no copy, fail silently (this is a common case that doesn't warrant notification)
if (copy && !viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()))
{
return false;
}
-
+
// Check that the agent has transfer permission on the item: this is required as a resident cannot
// put on sale items she cannot transfer. Proceed with move if we have permission.
std::string error_msg;
@@ -1585,7 +1585,7 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
return false;
}
}
-
+
open_marketplace_listings();
return true;
}
@@ -1607,7 +1607,7 @@ bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU
LLNotificationsUtil::add("MerchantPasteFailed", subs);
return false;
}
-
+
// Get the parent folder of the moved item : we may have to update it
LLUUID src_folder = inv_cat->getParentUUID();
@@ -1638,14 +1638,14 @@ bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU
LLNotificationsUtil::add("MerchantPasteFailed", subs);
return false;
}
-
+
open_marketplace_listings();
return true;
}
bool sort_alpha(const LLViewerInventoryCategory* cat1, const LLViewerInventoryCategory* cat2)
{
- return cat1->getName().compare(cat2->getName()) < 0;
+ return cat1->getName().compare(cat2->getName()) < 0;
}
// Make all relevant business logic checks on the marketplace listings starting with the folder as argument.
@@ -1667,7 +1667,7 @@ void validate_marketplacelistings(
{
// Get the type and the depth of the folder
LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat);
- const LLFolderType::EType folder_type = cat->getPreferredType();
+ const LLFolderType::EType folder_type = cat->getPreferredType();
if (depth < 0)
{
// If the depth argument was not provided, evaluate the depth directly
@@ -1680,7 +1680,7 @@ void validate_marketplacelistings(
depth = 1;
fix_hierarchy = false;
}
-
+
// Set the indentation for print output (typically, audit button in marketplace folder floater)
std::string indent;
for (int i = 1; i < depth; i++)
@@ -1703,7 +1703,7 @@ void validate_marketplacelistings(
}
}
}
-
+
// Check out that stock folders are at the right level
if ((folder_type == LLFolderType::FT_MARKETPLACE_STOCK) && (depth <= 2))
{
@@ -1752,28 +1752,28 @@ void validate_marketplacelistings(
}
}
}
-
+
// Item sorting and validation : sorting and moving the various stock items is complicated as the set of constraints is high
// We need to:
// * separate non stock items, stock items per types in different folders
// * have stock items nested at depth 2 at least
// * never ever move the non-stock items
-
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array);
-
+
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array);
+
// We use a composite (type,permission) key on that map to store UUIDs of items of same (type,permissions)
std::map<U32, std::vector<LLUUID> > items_vector;
// Parse the items and create vectors of item UUIDs sorting copyable items and stock items of various types
bool has_bad_items = false;
- LLInventoryModel::item_array_t item_array_copy = *item_array;
- for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
- {
- LLInventoryItem* item = *iter;
+ LLInventoryModel::item_array_t item_array_copy = *item_array;
+ for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
+ {
+ LLInventoryItem* item = *iter;
LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) item;
-
+
// Test but skip items that shouldn't be there to start with, raise an error message for those
std::string error_msg;
if (!can_move_to_marketplace(item, error_msg, false))
@@ -1797,13 +1797,13 @@ void validate_marketplacelistings(
}
U32 key = (((U32)(type) & 0xFF) << 24) | (perms & 0xFFFFFF);
items_vector[key].push_back(viewer_inv_item->getUUID());
- }
-
+ }
+
// How many types of items? Which type is it if only one?
S32 count = items_vector.size();
U32 default_key = (U32)(LLInventoryType::IT_COUNT) << 24; // This is the key for any normal copyable item
U32 unique_key = (count == 1 ? items_vector.begin()->first : default_key); // The key in the case of one item type only
-
+
// If we have no items in there (only folders or empty), analyze a bit further
if ((count == 0) && !has_bad_items)
{
@@ -2029,7 +2029,7 @@ void validate_marketplacelistings(
}
}
}
-
+
// Clean up
if (viewer_cat->getDescendentCount() == 0)
{
@@ -2051,15 +2051,15 @@ void validate_marketplacelistings(
// Recursion : Perform the same validation on each nested folder
gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array);
- LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
+ LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
// Sort the folders in alphabetical order first
std::sort(cat_array_copy.begin(), cat_array_copy.end(), sort_alpha);
-
- for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
- {
- LLInventoryCategory* category = *iter;
- validate_marketplacelistings(category, cb_result, cb_msg, fix_hierarchy, depth + 1, false, pending_callbacks, result);
- }
+
+ for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
+ {
+ LLInventoryCategory* category = *iter;
+ validate_marketplacelistings(category, cb_result, cb_msg, fix_hierarchy, depth + 1, false, pending_callbacks, result);
+ }
update_marketplace_category(cat->getUUID(), true, true);
if (notify_observers)
@@ -2071,22 +2071,22 @@ void validate_marketplacelistings(
void change_item_parent(const LLUUID& item_id, const LLUUID& new_parent_id)
{
- LLInventoryItem* inv_item = gInventory.getItem(item_id);
- if (inv_item)
- {
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
+ LLInventoryItem* inv_item = gInventory.getItem(item_id);
+ if (inv_item)
+ {
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
- new_item->setParent(new_parent_id);
- new_item->updateParentOnServer(FALSE);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- }
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
+ new_item->setParent(new_parent_id);
+ new_item->updateParentOnServer(FALSE);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+ }
}
void move_items_to_folder(const LLUUID& new_cat_uuid, const uuid_vec_t& selected_uuids)
@@ -2114,7 +2114,7 @@ void move_items_to_folder(const LLUUID& new_cat_uuid, const uuid_vec_t& selected
LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL;
return;
}
- LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
if (sidepanel_inventory)
{
if (sidepanel_inventory->getActivePanel())
@@ -2301,7 +2301,7 @@ std::string get_localized_folder_name(LLUUID cat_uuid)
LLTrans::findString(localized_root_name, std::string("InvFolder ") + cat->getName(), LLSD());
}
}
-
+
return localized_root_name;
}
@@ -2531,62 +2531,62 @@ LLMarketplaceValidator::ValidationRequest::ValidationRequest(
// static
bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(const LLInventoryItem* item)
{
- if (!item)
- return false;
+ if (!item)
+ return false;
- switch(item->getType())
- {
- case LLAssetType::AT_OBJECT:
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_CLOTHING:
- if (!get_is_item_worn(item->getUUID()))
- return true;
- break;
- default:
- return true;
- break;
- }
- return false;
+ switch(item->getType())
+ {
+ case LLAssetType::AT_OBJECT:
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ if (!get_is_item_worn(item->getUUID()))
+ return true;
+ break;
+ default:
+ return true;
+ break;
+ }
+ return false;
}
bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- if(mType == LLAssetType::AT_CATEGORY)
- {
- if(cat) return TRUE;
- }
- if(item)
- {
- if(item->getType() == mType) return TRUE;
- }
- return FALSE;
+ if(mType == LLAssetType::AT_CATEGORY)
+ {
+ if(cat) return TRUE;
+ }
+ if(item)
+ {
+ if(item->getType() == mType) return TRUE;
+ }
+ return FALSE;
}
bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- if(mType == LLAssetType::AT_CATEGORY)
- {
- if(cat) return FALSE;
- }
- if(item)
- {
- if(item->getType() == mType) return FALSE;
- else return TRUE;
- }
- return TRUE;
+ if(mType == LLAssetType::AT_CATEGORY)
+ {
+ if(cat) return FALSE;
+ }
+ if(item)
+ {
+ if(item->getType() == mType) return FALSE;
+ else return TRUE;
+ }
+ return TRUE;
}
bool LLIsOfAssetType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- if(mType == LLAssetType::AT_CATEGORY)
- {
- if(cat) return TRUE;
- }
- if(item)
- {
- if(item->getActualType() == mType) return TRUE;
- }
- return FALSE;
+ if(mType == LLAssetType::AT_CATEGORY)
+ {
+ if(cat) return TRUE;
+ }
+ if(item)
+ {
+ if(item->getActualType() == mType) return TRUE;
+ }
+ return FALSE;
}
bool LLAssetIDAndTypeMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
@@ -2597,120 +2597,120 @@ bool LLAssetIDAndTypeMatches::operator()(LLInventoryCategory* cat, LLInventoryIt
bool LLIsValidItemLink::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
- if (!vitem) return false;
- return (vitem->getActualType() == LLAssetType::AT_LINK && !vitem->getIsBrokenLink());
+ LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
+ if (!vitem) return false;
+ return (vitem->getActualType() == LLAssetType::AT_LINK && !vitem->getIsBrokenLink());
}
bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- if(mType == LLAssetType::AT_CATEGORY)
- {
- if(cat)
- {
- return TRUE;
- }
- }
- if(item)
- {
- if(item->getType() == mType)
- {
- LLPermissions perm = item->getPermissions();
- if ((perm.getMaskBase() & mPerm) == mPerm)
- {
- return TRUE;
- }
- }
- }
- return FALSE;
+ if(mType == LLAssetType::AT_CATEGORY)
+ {
+ if(cat)
+ {
+ return TRUE;
+ }
+ }
+ if(item)
+ {
+ if(item->getType() == mType)
+ {
+ LLPermissions perm = item->getPermissions();
+ if ((perm.getMaskBase() & mPerm) == mPerm)
+ {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
}
bool LLBuddyCollector::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
+ LLInventoryItem* item)
{
- if(item)
- {
- if((LLAssetType::AT_CALLINGCARD == item->getType())
- && (!item->getCreatorUUID().isNull())
- && (item->getCreatorUUID() != gAgent.getID()))
- {
- return true;
- }
- }
- return false;
+ if(item)
+ {
+ if((LLAssetType::AT_CALLINGCARD == item->getType())
+ && (!item->getCreatorUUID().isNull())
+ && (item->getCreatorUUID() != gAgent.getID()))
+ {
+ return true;
+ }
+ }
+ return false;
}
bool LLUniqueBuddyCollector::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
+ LLInventoryItem* item)
{
- if(item)
- {
- if((LLAssetType::AT_CALLINGCARD == item->getType())
- && (item->getCreatorUUID().notNull())
- && (item->getCreatorUUID() != gAgent.getID()))
- {
- mSeen.insert(item->getCreatorUUID());
- return true;
- }
- }
- return false;
+ if(item)
+ {
+ if((LLAssetType::AT_CALLINGCARD == item->getType())
+ && (item->getCreatorUUID().notNull())
+ && (item->getCreatorUUID() != gAgent.getID()))
+ {
+ mSeen.insert(item->getCreatorUUID());
+ return true;
+ }
+ }
+ return false;
}
bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
+ LLInventoryItem* item)
{
- if(item)
- {
- if((LLAssetType::AT_CALLINGCARD == item->getType())
- && (item->getCreatorUUID() == mBuddyID))
- {
- return TRUE;
- }
- }
- return FALSE;
+ if(item)
+ {
+ if((LLAssetType::AT_CALLINGCARD == item->getType())
+ && (item->getCreatorUUID() == mBuddyID))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
bool LLNameCategoryCollector::operator()(
- LLInventoryCategory* cat, LLInventoryItem* item)
+ LLInventoryCategory* cat, LLInventoryItem* item)
{
- if(cat)
- {
- if (!LLStringUtil::compareInsensitive(mName, cat->getName()))
- {
- return true;
- }
- }
- return false;
+ if(cat)
+ {
+ if (!LLStringUtil::compareInsensitive(mName, cat->getName()))
+ {
+ return true;
+ }
+ }
+ return false;
}
bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
-{
- // Valid COF items are:
- // - links to wearables (body parts or clothing)
- // - links to attachments
- // - links to gestures
- // - links to ensemble folders
- LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem();
- if (linked_item)
- {
- LLAssetType::EType type = linked_item->getType();
- return (type == LLAssetType::AT_CLOTHING ||
- type == LLAssetType::AT_BODYPART ||
- type == LLAssetType::AT_GESTURE ||
- type == LLAssetType::AT_OBJECT);
- }
- else
- {
- LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory();
- // BAP remove AT_NONE support after ensembles are fully working?
- return (linked_category &&
- ((linked_category->getPreferredType() == LLFolderType::FT_NONE) ||
- (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType()))));
- }
+ LLInventoryItem* item)
+{
+ // Valid COF items are:
+ // - links to wearables (body parts or clothing)
+ // - links to attachments
+ // - links to gestures
+ // - links to ensemble folders
+ LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem();
+ if (linked_item)
+ {
+ LLAssetType::EType type = linked_item->getType();
+ return (type == LLAssetType::AT_CLOTHING ||
+ type == LLAssetType::AT_BODYPART ||
+ type == LLAssetType::AT_GESTURE ||
+ type == LLAssetType::AT_OBJECT);
+ }
+ else
+ {
+ LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory();
+ // BAP remove AT_NONE support after ensembles are fully working?
+ return (linked_category &&
+ ((linked_category->getPreferredType() == LLFolderType::FT_NONE) ||
+ (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType()))));
+ }
}
bool LLFindBrokenLinks::operator()(LLInventoryCategory* cat,
@@ -2727,68 +2727,68 @@ bool LLFindBrokenLinks::operator()(LLInventoryCategory* cat,
}
bool LLFindWearables::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
+ LLInventoryItem* item)
{
- if(item)
- {
- if((item->getType() == LLAssetType::AT_CLOTHING)
- || (item->getType() == LLAssetType::AT_BODYPART))
- {
- return TRUE;
- }
- }
- return FALSE;
+ if(item)
+ {
+ if((item->getType() == LLAssetType::AT_CLOTHING)
+ || (item->getType() == LLAssetType::AT_BODYPART))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
LLFindWearablesEx::LLFindWearablesEx(bool is_worn, bool include_body_parts)
-: mIsWorn(is_worn)
-, mIncludeBodyParts(include_body_parts)
+: mIsWorn(is_worn)
+, mIncludeBodyParts(include_body_parts)
{}
bool LLFindWearablesEx::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
- if (!vitem) return false;
+ LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
+ if (!vitem) return false;
- // Skip non-wearables.
- if (!vitem->isWearableType() && vitem->getType() != LLAssetType::AT_OBJECT && vitem->getType() != LLAssetType::AT_GESTURE)
- {
- return false;
- }
+ // Skip non-wearables.
+ if (!vitem->isWearableType() && vitem->getType() != LLAssetType::AT_OBJECT && vitem->getType() != LLAssetType::AT_GESTURE)
+ {
+ return false;
+ }
- // Skip body parts if requested.
- if (!mIncludeBodyParts && vitem->getType() == LLAssetType::AT_BODYPART)
- {
- return false;
- }
+ // Skip body parts if requested.
+ if (!mIncludeBodyParts && vitem->getType() == LLAssetType::AT_BODYPART)
+ {
+ return false;
+ }
- // Skip broken links.
- if (vitem->getIsBrokenLink())
- {
- return false;
- }
+ // Skip broken links.
+ if (vitem->getIsBrokenLink())
+ {
+ return false;
+ }
- return (bool) get_is_item_worn(item->getUUID()) == mIsWorn;
+ return (bool) get_is_item_worn(item->getUUID()) == mIsWorn;
}
bool LLFindWearablesOfType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- if (!item) return false;
- if (item->getType() != LLAssetType::AT_CLOTHING &&
- item->getType() != LLAssetType::AT_BODYPART)
- {
- return false;
- }
+ if (!item) return false;
+ if (item->getType() != LLAssetType::AT_CLOTHING &&
+ item->getType() != LLAssetType::AT_BODYPART)
+ {
+ return false;
+ }
- LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
- if (!vitem || vitem->getWearableType() != mWearableType) return false;
+ LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
+ if (!vitem || vitem->getWearableType() != mWearableType) return false;
- return true;
+ return true;
}
void LLFindWearablesOfType::setType(LLWearableType::EType type)
{
- mWearableType = type;
+ mWearableType = type;
}
bool LLIsTextureType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
@@ -2798,141 +2798,141 @@ bool LLIsTextureType::operator()(LLInventoryCategory* cat, LLInventoryItem* item
bool LLFindNonRemovableObjects::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- if (item)
- {
- return !get_is_item_removable(&gInventory, item->getUUID());
- }
- if (cat)
- {
- return !get_is_category_removable(&gInventory, cat->getUUID());
- }
+ if (item)
+ {
+ return !get_is_item_removable(&gInventory, item->getUUID());
+ }
+ if (cat)
+ {
+ return !get_is_category_removable(&gInventory, cat->getUUID());
+ }
- LL_WARNS() << "Not a category and not an item?" << LL_ENDL;
- return false;
+ LL_WARNS() << "Not a category and not an item?" << LL_ENDL;
+ return false;
}
///----------------------------------------------------------------------------
-/// LLAssetIDMatches
+/// LLAssetIDMatches
///----------------------------------------------------------------------------
bool LLAssetIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- return (item && item->getAssetUUID() == mAssetID);
+ return (item && item->getAssetUUID() == mAssetID);
}
///----------------------------------------------------------------------------
-/// LLLinkedItemIDMatches
+/// LLLinkedItemIDMatches
///----------------------------------------------------------------------------
bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- return (item &&
- (item->getIsLinkType()) &&
- (item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID.
+ return (item &&
+ (item->getIsLinkType()) &&
+ (item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID.
}
void LLSaveFolderState::setApply(BOOL apply)
{
- mApply = apply;
- // before generating new list of open folders, clear the old one
- if(!apply)
- {
- clearOpenFolders();
- }
+ mApply = apply;
+ // before generating new list of open folders, clear the old one
+ if(!apply)
+ {
+ clearOpenFolders();
+ }
}
void LLSaveFolderState::doFolder(LLFolderViewFolder* folder)
{
- LLInvFVBridge* bridge = (LLInvFVBridge*)folder->getViewModelItem();
- if(!bridge) return;
-
- if(mApply)
- {
- // we're applying the open state
- LLUUID id(bridge->getUUID());
- if(mOpenFolders.find(id) != mOpenFolders.end())
- {
- if (!folder->isOpen())
- {
- folder->setOpen(TRUE);
- }
- }
- else
- {
- // keep selected filter in its current state, this is less jarring to user
- if (!folder->isSelected() && folder->isOpen())
- {
- folder->setOpen(FALSE);
- }
- }
- }
- else
- {
- // we're recording state at this point
- if(folder->isOpen())
- {
- mOpenFolders.insert(bridge->getUUID());
- }
- }
+ LLInvFVBridge* bridge = (LLInvFVBridge*)folder->getViewModelItem();
+ if(!bridge) return;
+
+ if(mApply)
+ {
+ // we're applying the open state
+ LLUUID id(bridge->getUUID());
+ if(mOpenFolders.find(id) != mOpenFolders.end())
+ {
+ if (!folder->isOpen())
+ {
+ folder->setOpen(TRUE);
+ }
+ }
+ else
+ {
+ // keep selected filter in its current state, this is less jarring to user
+ if (!folder->isSelected() && folder->isOpen())
+ {
+ folder->setOpen(FALSE);
+ }
+ }
+ }
+ else
+ {
+ // we're recording state at this point
+ if(folder->isOpen())
+ {
+ mOpenFolders.insert(bridge->getUUID());
+ }
+ }
}
void LLOpenFilteredFolders::doItem(LLFolderViewItem *item)
{
- if (item->passedFilter())
- {
- item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
- }
+ if (item->passedFilter())
+ {
+ item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ }
}
void LLOpenFilteredFolders::doFolder(LLFolderViewFolder* folder)
{
- if (folder->LLFolderViewItem::passedFilter() && folder->getParentFolder())
- {
- folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
- }
- // if this folder didn't pass the filter, and none of its descendants did
- else if (!folder->getViewModelItem()->passedFilter() && !folder->getViewModelItem()->descendantsPassedFilter())
- {
- folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_NO);
- }
+ if (folder->LLFolderViewItem::passedFilter() && folder->getParentFolder())
+ {
+ folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ }
+ // if this folder didn't pass the filter, and none of its descendants did
+ else if (!folder->getViewModelItem()->passedFilter() && !folder->getViewModelItem()->descendantsPassedFilter())
+ {
+ folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_NO);
+ }
}
void LLSelectFirstFilteredItem::doItem(LLFolderViewItem *item)
{
- if (item->passedFilter() && !mItemSelected)
- {
- item->getRoot()->setSelection(item, FALSE, FALSE);
- if (item->getParentFolder())
- {
- item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
- }
- mItemSelected = TRUE;
- }
+ if (item->passedFilter() && !mItemSelected)
+ {
+ item->getRoot()->setSelection(item, FALSE, FALSE);
+ if (item->getParentFolder())
+ {
+ item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ }
+ mItemSelected = TRUE;
+ }
}
void LLSelectFirstFilteredItem::doFolder(LLFolderViewFolder* folder)
{
- // Skip if folder or item already found, if not filtered or if no parent (root folder is not selectable)
- if (!mFolderSelected && !mItemSelected && folder->LLFolderViewItem::passedFilter() && folder->getParentFolder())
- {
- folder->getRoot()->setSelection(folder, FALSE, FALSE);
- folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
- mFolderSelected = TRUE;
- }
+ // Skip if folder or item already found, if not filtered or if no parent (root folder is not selectable)
+ if (!mFolderSelected && !mItemSelected && folder->LLFolderViewItem::passedFilter() && folder->getParentFolder())
+ {
+ folder->getRoot()->setSelection(folder, FALSE, FALSE);
+ folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ mFolderSelected = TRUE;
+ }
}
void LLOpenFoldersWithSelection::doItem(LLFolderViewItem *item)
{
- if (item->getParentFolder() && item->isSelected())
- {
- item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
- }
+ if (item->getParentFolder() && item->isSelected())
+ {
+ item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ }
}
void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder)
{
- if (folder->getParentFolder() && folder->isSelected())
- {
- folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
- }
+ if (folder->getParentFolder() && folder->isSelected())
+ {
+ folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ }
}
// Callback for doToSelected if DAMA required...
@@ -2962,34 +2962,34 @@ void LLInventoryAction::callback_copySelected(const LLSD& notification, const LL
// case returns their corresponding uuids.
bool get_selection_object_uuids(LLFolderView *root, uuid_vec_t& ids)
{
- uuid_vec_t results;
- S32 non_object = 0;
- LLFolderView::selected_items_t selectedItems = root->getSelectedItems();
- for(LLFolderView::selected_items_t::iterator it = selectedItems.begin(); it != selectedItems.end(); ++it)
- {
- LLObjectBridge *view_model = dynamic_cast<LLObjectBridge *>((*it)->getViewModelItem());
-
- if(view_model && view_model->getUUID().notNull())
- {
- results.push_back(view_model->getUUID());
- }
- else
- {
- non_object++;
- }
- }
- if (non_object == 0)
- {
- ids = results;
- return true;
- }
- return false;
+ uuid_vec_t results;
+ S32 non_object = 0;
+ LLFolderView::selected_items_t selectedItems = root->getSelectedItems();
+ for(LLFolderView::selected_items_t::iterator it = selectedItems.begin(); it != selectedItems.end(); ++it)
+ {
+ LLObjectBridge *view_model = dynamic_cast<LLObjectBridge *>((*it)->getViewModelItem());
+
+ if(view_model && view_model->getUUID().notNull())
+ {
+ results.push_back(view_model->getUUID());
+ }
+ else
+ {
+ non_object++;
+ }
+ }
+ if (non_object == 0)
+ {
+ ids = results;
+ return true;
+ }
+ return false;
}
void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm)
{
- std::set<LLFolderViewItem*> selected_items = root->getSelectionList();
+ std::set<LLFolderViewItem*> selected_items = root->getSelectionList();
if (selected_items.empty()
&& action != "wear"
&& action != "wear_add"
@@ -3007,9 +3007,9 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
return;
}
-
+
// Prompt the user and check for authorization for some marketplace active listing edits
- if (user_confirm && (("delete" == action) || ("cut" == action) || ("rename" == action) || ("properties" == action) || ("task_properties" == action) || ("open" == action)))
+ if (user_confirm && (("delete" == action) || ("cut" == action) || ("rename" == action) || ("properties" == action) || ("task_properties" == action) || ("open" == action)))
{
std::set<LLFolderViewItem*>::iterator set_iter = selected_items.begin();
LLFolderViewModelItemInventory * viewModel = NULL;
@@ -3066,138 +3066,138 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
return;
}
}
-
+
// Keep track of the marketplace folders that will need update of their status/name after the operation is performed
buildMarketplaceFolders(root);
-
- if ("rename" == action)
- {
- root->startRenamingSelectedItem();
+
+ if ("rename" == action)
+ {
+ root->startRenamingSelectedItem();
// Update the marketplace listings that have been affected by the operation
updateMarketplaceFolders();
- return;
- }
-
- if ("delete" == action)
- {
- const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
- bool marketplacelistings_item = false;
- LLAllDescendentsPassedFilter f;
- for (std::set<LLFolderViewItem*>::iterator it = selected_items.begin(); (it != selected_items.end()) && (f.allDescendentsPassedFilter()); ++it)
- {
- if (LLFolderViewFolder* folder = dynamic_cast<LLFolderViewFolder*>(*it))
- {
- folder->applyFunctorRecursively(f);
- }
- LLFolderViewModelItemInventory * viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*it)->getViewModelItem());
- if (viewModel && gInventory.isObjectDescendentOf(viewModel->getUUID(), marketplacelistings_id))
- {
- marketplacelistings_item = true;
- break;
- }
- }
- // Fall through to the generic confirmation if the user choose to ignore the specialized one
- if ( (!f.allDescendentsPassedFilter()) && !marketplacelistings_item && (!LLNotifications::instance().getIgnored("DeleteFilteredItems")) )
- {
- LLNotificationsUtil::add("DeleteFilteredItems", LLSD(), LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle()));
- }
- else
- {
- if (!sDeleteConfirmationDisplayed) // ask for the confirmation at least once per session
- {
- LLNotifications::instance().setIgnored("DeleteItems", false);
- sDeleteConfirmationDisplayed = true;
- }
-
- LLSD args;
- args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem");
- LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle()));
- }
+ return;
+ }
+
+ if ("delete" == action)
+ {
+ const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
+ bool marketplacelistings_item = false;
+ LLAllDescendentsPassedFilter f;
+ for (std::set<LLFolderViewItem*>::iterator it = selected_items.begin(); (it != selected_items.end()) && (f.allDescendentsPassedFilter()); ++it)
+ {
+ if (LLFolderViewFolder* folder = dynamic_cast<LLFolderViewFolder*>(*it))
+ {
+ folder->applyFunctorRecursively(f);
+ }
+ LLFolderViewModelItemInventory * viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*it)->getViewModelItem());
+ if (viewModel && gInventory.isObjectDescendentOf(viewModel->getUUID(), marketplacelistings_id))
+ {
+ marketplacelistings_item = true;
+ break;
+ }
+ }
+ // Fall through to the generic confirmation if the user choose to ignore the specialized one
+ if ( (!f.allDescendentsPassedFilter()) && !marketplacelistings_item && (!LLNotifications::instance().getIgnored("DeleteFilteredItems")) )
+ {
+ LLNotificationsUtil::add("DeleteFilteredItems", LLSD(), LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle()));
+ }
+ else
+ {
+ if (!sDeleteConfirmationDisplayed) // ask for the confirmation at least once per session
+ {
+ LLNotifications::instance().setIgnored("DeleteItems", false);
+ sDeleteConfirmationDisplayed = true;
+ }
+
+ LLSD args;
+ args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem");
+ LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle()));
+ }
// Note: marketplace listings will be updated in the callback if delete confirmed
- return;
- }
- if (("copy" == action) || ("cut" == action))
- {
- // Clear the clipboard before we start adding things on it
- LLClipboard::instance().reset();
- }
- if ("replace_links" == action)
- {
- LLSD params;
- if (root->getSelectedCount() == 1)
- {
- LLFolderViewItem* folder_item = root->getSelectedItems().front();
- LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
-
- if (bridge)
- {
- LLInventoryObject* obj = bridge->getInventoryObject();
- if (obj && obj->getType() != LLAssetType::AT_CATEGORY && obj->getActualType() != LLAssetType::AT_LINK_FOLDER)
- {
- params = LLSD(obj->getUUID());
- }
- }
- }
- LLFloaterReg::showInstance("linkreplace", params);
- return;
- }
-
- static const std::string change_folder_string = "change_folder_type_";
- if (action.length() > change_folder_string.length() &&
- (action.compare(0,change_folder_string.length(),"change_folder_type_") == 0))
- {
- LLFolderType::EType new_folder_type = LLViewerFolderType::lookupTypeFromXUIName(action.substr(change_folder_string.length()));
- LLFolderViewModelItemInventory* inventory_item = static_cast<LLFolderViewModelItemInventory*>(root->getViewModelItem());
- LLViewerInventoryCategory *cat = model->getCategory(inventory_item->getUUID());
- if (!cat) return;
- cat->changeType(new_folder_type);
+ return;
+ }
+ if (("copy" == action) || ("cut" == action))
+ {
+ // Clear the clipboard before we start adding things on it
+ LLClipboard::instance().reset();
+ }
+ if ("replace_links" == action)
+ {
+ LLSD params;
+ if (root->getSelectedCount() == 1)
+ {
+ LLFolderViewItem* folder_item = root->getSelectedItems().front();
+ LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
+
+ if (bridge)
+ {
+ LLInventoryObject* obj = bridge->getInventoryObject();
+ if (obj && obj->getType() != LLAssetType::AT_CATEGORY && obj->getActualType() != LLAssetType::AT_LINK_FOLDER)
+ {
+ params = LLSD(obj->getUUID());
+ }
+ }
+ }
+ LLFloaterReg::showInstance("linkreplace", params);
+ return;
+ }
+
+ static const std::string change_folder_string = "change_folder_type_";
+ if (action.length() > change_folder_string.length() &&
+ (action.compare(0,change_folder_string.length(),"change_folder_type_") == 0))
+ {
+ LLFolderType::EType new_folder_type = LLViewerFolderType::lookupTypeFromXUIName(action.substr(change_folder_string.length()));
+ LLFolderViewModelItemInventory* inventory_item = static_cast<LLFolderViewModelItemInventory*>(root->getViewModelItem());
+ LLViewerInventoryCategory *cat = model->getCategory(inventory_item->getUUID());
+ if (!cat) return;
+ cat->changeType(new_folder_type);
// Update the marketplace listings that have been affected by the operation
updateMarketplaceFolders();
- return;
- }
-
-
- LLMultiPreview* multi_previewp = NULL;
- LLMultiItemProperties* multi_itempropertiesp = nullptr;
-
- if (("task_open" == action || "open" == action) && selected_items.size() > 1)
- {
- bool open_multi_preview = true;
-
- if ("open" == action)
- {
- for (std::set<LLFolderViewItem*>::iterator set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
- {
- LLFolderViewItem* folder_item = *set_iter;
- if (folder_item)
- {
- LLInvFVBridge* bridge = dynamic_cast<LLInvFVBridge*>(folder_item->getViewModelItem());
- if (!bridge || !bridge->isMultiPreviewAllowed())
- {
- open_multi_preview = false;
- break;
- }
- }
- }
- }
-
- if (open_multi_preview)
- {
- multi_previewp = new LLMultiPreview();
- gFloaterView->addChild(multi_previewp);
-
- LLFloater::setFloaterHost(multi_previewp);
- }
-
- }
- else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1)
- {
- multi_itempropertiesp = new LLMultiItemProperties("item_properties");
- gFloaterView->addChild(multi_itempropertiesp);
- LLFloater::setFloaterHost(multi_itempropertiesp);
- }
-
- std::set<LLUUID> selected_uuid_set = LLAvatarActions::getInventorySelectedUUIDs();
+ return;
+ }
+
+
+ LLMultiPreview* multi_previewp = NULL;
+ LLMultiItemProperties* multi_itempropertiesp = nullptr;
+
+ if (("task_open" == action || "open" == action) && selected_items.size() > 1)
+ {
+ bool open_multi_preview = true;
+
+ if ("open" == action)
+ {
+ for (std::set<LLFolderViewItem*>::iterator set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
+ {
+ LLFolderViewItem* folder_item = *set_iter;
+ if (folder_item)
+ {
+ LLInvFVBridge* bridge = dynamic_cast<LLInvFVBridge*>(folder_item->getViewModelItem());
+ if (!bridge || !bridge->isMultiPreviewAllowed())
+ {
+ open_multi_preview = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (open_multi_preview)
+ {
+ multi_previewp = new LLMultiPreview();
+ gFloaterView->addChild(multi_previewp);
+
+ LLFloater::setFloaterHost(multi_previewp);
+ }
+
+ }
+ else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1)
+ {
+ multi_itempropertiesp = new LLMultiItemProperties("item_properties");
+ gFloaterView->addChild(multi_itempropertiesp);
+ LLFloater::setFloaterHost(multi_itempropertiesp);
+ }
+
+ std::set<LLUUID> selected_uuid_set = LLAvatarActions::getInventorySelectedUUIDs();
// copy list of applicable items into a vector for bulk handling
uuid_vec_t ids;
@@ -3294,10 +3294,10 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
return;
}
}
-
+
LLSD args;
args["DESC"] = LLTrans::getString("New Folder");
-
+
LLNotificationsUtil::add("CreateSubfolder", args, LLSD(),
[ids](const LLSD& notification, const LLSD& response)
{
@@ -3345,22 +3345,22 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
// Update the marketplace listings that have been affected by the operation
updateMarketplaceFolders();
-
- LLFloater::setFloaterHost(NULL);
- if (multi_previewp)
- {
- multi_previewp->openFloater(LLSD());
- }
- else if (multi_itempropertiesp)
- {
- multi_itempropertiesp->openFloater(LLSD());
- }
+
+ LLFloater::setFloaterHost(NULL);
+ if (multi_previewp)
+ {
+ multi_previewp->openFloater(LLSD());
+ }
+ else if (multi_itempropertiesp)
+ {
+ multi_itempropertiesp->openFloater(LLSD());
+ }
}
void LLInventoryAction::saveMultipleTextures(const std::vector<std::string>& filenames, std::set<LLFolderViewItem*> selected_items, LLInventoryModel* model)
{
gSavedSettings.setString("TextureSaveLocation", filenames[0]);
-
+
LLMultiPreview* multi_previewp = new LLMultiPreview();
gFloaterView->addChild(multi_previewp);
@@ -3368,7 +3368,7 @@ void LLInventoryAction::saveMultipleTextures(const std::vector<std::string>& fil
std::map<std::string, S32> tex_names_map;
std::set<LLFolderViewItem*>::iterator set_iter;
-
+
for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
{
LLFolderViewItem* folder_item = *set_iter;
@@ -3377,10 +3377,10 @@ void LLInventoryAction::saveMultipleTextures(const std::vector<std::string>& fil
if(!bridge) continue;
std::string tex_name = bridge->getName();
- if(!tex_names_map.insert(std::pair<std::string, S32>(tex_name, 0)).second)
- {
+ if(!tex_names_map.insert(std::pair<std::string, S32>(tex_name, 0)).second)
+ {
tex_names_map[tex_name]++;
- bridge->setFileName(tex_name + llformat("_%.3d", tex_names_map[tex_name]));
+ bridge->setFileName(tex_name + llformat("_%.3d", tex_names_map[tex_name]));
}
bridge->performAction(model, "save_selected_as");
}
@@ -3417,18 +3417,18 @@ void LLInventoryAction::removeItemFromDND(LLFolderView* root)
void LLInventoryAction::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFolderView> root)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0 && !root.isDead() && !root.get()->isDead())
- {
- LLFolderView* folder_root = root.get();
- //Need to remove item from DND before item is removed from root folder view
- //because once removed from root folder view the item is no longer a selected item
- removeItemFromDND(folder_root);
- folder_root->removeSelectedItems();
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0 && !root.isDead() && !root.get()->isDead())
+ {
+ LLFolderView* folder_root = root.get();
+ //Need to remove item from DND before item is removed from root folder view
+ //because once removed from root folder view the item is no longer a selected item
+ removeItemFromDND(folder_root);
+ folder_root->removeSelectedItems();
- // Update the marketplace listings that have been affected by the operation
- updateMarketplaceFolders();
- }
+ // Update the marketplace listings that have been affected by the operation
+ updateMarketplaceFolders();
+ }
}
void LLInventoryAction::buildMarketplaceFolders(LLFolderView* root)
@@ -3444,7 +3444,7 @@ void LLInventoryAction::buildMarketplaceFolders(LLFolderView* root)
const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
if (marketplacelistings_id.isNull())
{
- return;
+ return;
}
std::set<LLFolderViewItem*> selected_items = root->getSelectionList();
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 5a833eab8c..0c4b64586d 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llinventoryfunctions.h
* @brief Miscellaneous inventory-related functions and classes
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -184,10 +184,10 @@ private:
class LLInventoryCollectFunctor
{
public:
- virtual ~LLInventoryCollectFunctor(){};
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0;
+ virtual ~LLInventoryCollectFunctor(){};
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0;
- static bool itemTransferCommonlyAllowed(const LLInventoryItem* item);
+ static bool itemTransferCommonlyAllowed(const LLInventoryItem* item);
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -200,12 +200,12 @@ class LLViewerInventoryItem;
class LLAssetIDMatches : public LLInventoryCollectFunctor
{
public:
- LLAssetIDMatches(const LLUUID& asset_id) : mAssetID(asset_id) {}
- virtual ~LLAssetIDMatches() {}
- bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
-
+ LLAssetIDMatches(const LLUUID& asset_id) : mAssetID(asset_id) {}
+ virtual ~LLAssetIDMatches() {}
+ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+
protected:
- LLUUID mAssetID;
+ LLUUID mAssetID;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -217,12 +217,12 @@ protected:
class LLLinkedItemIDMatches : public LLInventoryCollectFunctor
{
public:
- LLLinkedItemIDMatches(const LLUUID& item_id) : mBaseItemID(item_id) {}
- virtual ~LLLinkedItemIDMatches() {}
- bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
-
+ LLLinkedItemIDMatches(const LLUUID& item_id) : mBaseItemID(item_id) {}
+ virtual ~LLLinkedItemIDMatches() {}
+ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+
protected:
- LLUUID mBaseItemID;
+ LLUUID mBaseItemID;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -235,12 +235,12 @@ protected:
class LLIsType : public LLInventoryCollectFunctor
{
public:
- LLIsType(LLAssetType::EType type) : mType(type) {}
- virtual ~LLIsType() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLIsType(LLAssetType::EType type) : mType(type) {}
+ virtual ~LLIsType() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
protected:
- LLAssetType::EType mType;
+ LLAssetType::EType mType;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -252,12 +252,12 @@ protected:
class LLIsNotType : public LLInventoryCollectFunctor
{
public:
- LLIsNotType(LLAssetType::EType type) : mType(type) {}
- virtual ~LLIsNotType() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLIsNotType(LLAssetType::EType type) : mType(type) {}
+ virtual ~LLIsNotType() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
protected:
- LLAssetType::EType mType;
+ LLAssetType::EType mType;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -271,12 +271,12 @@ protected:
class LLIsOfAssetType : public LLInventoryCollectFunctor
{
public:
- LLIsOfAssetType(LLAssetType::EType type) : mType(type) {}
- virtual ~LLIsOfAssetType() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLIsOfAssetType(LLAssetType::EType type) : mType(type) {}
+ virtual ~LLIsOfAssetType() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
protected:
- LLAssetType::EType mType;
+ LLAssetType::EType mType;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -304,23 +304,23 @@ protected:
class LLIsValidItemLink : public LLInventoryCollectFunctor
{
public:
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
};
class LLIsTypeWithPermissions : public LLInventoryCollectFunctor
{
public:
- LLIsTypeWithPermissions(LLAssetType::EType type, const PermissionBit perms, const LLUUID &agent_id, const LLUUID &group_id)
- : mType(type), mPerm(perms), mAgentID(agent_id), mGroupID(group_id) {}
- virtual ~LLIsTypeWithPermissions() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLIsTypeWithPermissions(LLAssetType::EType type, const PermissionBit perms, const LLUUID &agent_id, const LLUUID &group_id)
+ : mType(type), mPerm(perms), mAgentID(agent_id), mGroupID(group_id) {}
+ virtual ~LLIsTypeWithPermissions() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
protected:
- LLAssetType::EType mType;
- PermissionBit mPerm;
- LLUUID mAgentID;
- LLUUID mGroupID;
+ LLAssetType::EType mType;
+ PermissionBit mPerm;
+ LLUUID mAgentID;
+ LLUUID mGroupID;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -332,10 +332,10 @@ protected:
class LLBuddyCollector : public LLInventoryCollectFunctor
{
public:
- LLBuddyCollector() {}
- virtual ~LLBuddyCollector() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLBuddyCollector() {}
+ virtual ~LLBuddyCollector() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -347,13 +347,13 @@ public:
class LLUniqueBuddyCollector : public LLInventoryCollectFunctor
{
public:
- LLUniqueBuddyCollector() {}
- virtual ~LLUniqueBuddyCollector() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLUniqueBuddyCollector() {}
+ virtual ~LLUniqueBuddyCollector() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
protected:
- std::set<LLUUID> mSeen;
+ std::set<LLUUID> mSeen;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -365,12 +365,12 @@ protected:
class LLParticularBuddyCollector : public LLInventoryCollectFunctor
{
public:
- LLParticularBuddyCollector(const LLUUID& id) : mBuddyID(id) {}
- virtual ~LLParticularBuddyCollector() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLParticularBuddyCollector(const LLUUID& id) : mBuddyID(id) {}
+ virtual ~LLParticularBuddyCollector() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
protected:
- LLUUID mBuddyID;
+ LLUUID mBuddyID;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -381,12 +381,12 @@ protected:
class LLNameCategoryCollector : public LLInventoryCollectFunctor
{
public:
- LLNameCategoryCollector(const std::string& name) : mName(name) {}
- virtual ~LLNameCategoryCollector() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLNameCategoryCollector(const std::string& name) : mName(name) {}
+ virtual ~LLNameCategoryCollector() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
protected:
- std::string mName;
+ std::string mName;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -397,11 +397,11 @@ protected:
class LLFindCOFValidItems : public LLInventoryCollectFunctor
{
public:
- LLFindCOFValidItems() {}
- virtual ~LLFindCOFValidItems() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
-
+ LLFindCOFValidItems() {}
+ virtual ~LLFindCOFValidItems() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
+
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -424,23 +424,23 @@ public:
class LLFindByMask : public LLInventoryCollectFunctor
{
public:
- LLFindByMask(U64 mask)
- : mFilterMask(mask)
- {}
+ LLFindByMask(U64 mask)
+ : mFilterMask(mask)
+ {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
- {
- //converting an inventory type to a bitmap filter mask
- if(item && (mFilterMask & (1LL << item->getInventoryType())) )
- {
- return true;
- }
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+ {
+ //converting an inventory type to a bitmap filter mask
+ if(item && (mFilterMask & (1LL << item->getInventoryType())) )
+ {
+ return true;
+ }
- return false;
- }
+ return false;
+ }
private:
- U64 mFilterMask;
+ U64 mFilterMask;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -451,27 +451,27 @@ private:
class LLFindNonLinksByMask : public LLInventoryCollectFunctor
{
public:
- LLFindNonLinksByMask(U64 mask)
- : mFilterMask(mask)
- {}
+ LLFindNonLinksByMask(U64 mask)
+ : mFilterMask(mask)
+ {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
- {
- if(item && !item->getIsLinkType() && (mFilterMask & (1LL << item->getInventoryType())) )
- {
- return true;
- }
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+ {
+ if(item && !item->getIsLinkType() && (mFilterMask & (1LL << item->getInventoryType())) )
+ {
+ return true;
+ }
- return false;
- }
+ return false;
+ }
- void setFilterMask(U64 mask)
- {
- mFilterMask = mask;
- }
+ void setFilterMask(U64 mask)
+ {
+ mFilterMask = mask;
+ }
private:
- U64 mFilterMask;
+ U64 mFilterMask;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -482,10 +482,10 @@ private:
class LLFindWearables : public LLInventoryCollectFunctor
{
public:
- LLFindWearables() {}
- virtual ~LLFindWearables() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLFindWearables() {}
+ virtual ~LLFindWearables() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -496,24 +496,24 @@ public:
class LLFindWearablesEx : public LLInventoryCollectFunctor
{
public:
- LLFindWearablesEx(bool is_worn, bool include_body_parts = true);
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+ LLFindWearablesEx(bool is_worn, bool include_body_parts = true);
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
private:
- bool mIncludeBodyParts;
- bool mIsWorn;
+ bool mIncludeBodyParts;
+ bool mIsWorn;
};
//Inventory collect functor collecting wearables of a specific wearable type
class LLFindWearablesOfType : public LLInventoryCollectFunctor
{
public:
- LLFindWearablesOfType(LLWearableType::EType type) : mWearableType(type) {}
- virtual ~LLFindWearablesOfType() {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
- void setType(LLWearableType::EType type);
+ LLFindWearablesOfType(LLWearableType::EType type) : mWearableType(type) {}
+ virtual ~LLFindWearablesOfType() {}
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+ void setType(LLWearableType::EType type);
private:
- LLWearableType::EType mWearableType;
+ LLWearableType::EType mWearableType;
};
class LLIsTextureType : public LLInventoryCollectFunctor
@@ -529,33 +529,33 @@ public:
class LLFindActualWearablesOfType : public LLFindWearablesOfType
{
public:
- LLFindActualWearablesOfType(LLWearableType::EType type) : LLFindWearablesOfType(type) {}
- virtual ~LLFindActualWearablesOfType() {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
- {
- if (item && item->getIsLinkType()) return false;
- return LLFindWearablesOfType::operator()(cat, item);
- }
+ LLFindActualWearablesOfType(LLWearableType::EType type) : LLFindWearablesOfType(type) {}
+ virtual ~LLFindActualWearablesOfType() {}
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+ {
+ if (item && item->getIsLinkType()) return false;
+ return LLFindWearablesOfType::operator()(cat, item);
+ }
};
/* Filters out items of a particular asset type */
class LLIsTypeActual : public LLIsType
{
public:
- LLIsTypeActual(LLAssetType::EType type) : LLIsType(type) {}
- virtual ~LLIsTypeActual() {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
- {
- if (item && item->getIsLinkType()) return false;
- return LLIsType::operator()(cat, item);
- }
+ LLIsTypeActual(LLAssetType::EType type) : LLIsType(type) {}
+ virtual ~LLIsTypeActual() {}
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+ {
+ if (item && item->getIsLinkType()) return false;
+ return LLIsType::operator()(cat, item);
+ }
};
// Collect non-removable folders and items.
class LLFindNonRemovableObjects : public LLInventoryCollectFunctor
{
public:
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
};
/** Inventory Collector Functions
@@ -569,27 +569,27 @@ class LLFolderView;
class LLInventoryState
{
public:
- // HACK: Until we can route this info through the instant message hierarchy
- static BOOL sWearNewClothing;
- static LLUUID sWearNewClothingTransactionID; // wear all clothing in this transaction
+ // HACK: Until we can route this info through the instant message hierarchy
+ static BOOL sWearNewClothing;
+ static LLUUID sWearNewClothingTransactionID; // wear all clothing in this transaction
};
struct LLInventoryAction
{
- static void doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm = TRUE);
- static void callback_doToSelected(const LLSD& notification, const LLSD& response, class LLInventoryModel* model, class LLFolderView* root, const std::string& action);
- static void callback_copySelected(const LLSD& notification, const LLSD& response, class LLInventoryModel* model, class LLFolderView* root, const std::string& action);
- static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFolderView> root);
- static void removeItemFromDND(LLFolderView* root);
+ static void doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm = TRUE);
+ static void callback_doToSelected(const LLSD& notification, const LLSD& response, class LLInventoryModel* model, class LLFolderView* root, const std::string& action);
+ static void callback_copySelected(const LLSD& notification, const LLSD& response, class LLInventoryModel* model, class LLFolderView* root, const std::string& action);
+ static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFolderView> root);
+ static void removeItemFromDND(LLFolderView* root);
static void saveMultipleTextures(const std::vector<std::string>& filenames, std::set<LLFolderViewItem*> selected_items, LLInventoryModel* model);
static bool sDeleteConfirmationDisplayed;
private:
- static void buildMarketplaceFolders(LLFolderView* root);
- static void updateMarketplaceFolders();
- static std::list<LLUUID> sMarketplaceFolders; // Marketplace folders that will need update once the action is completed
+ static void buildMarketplaceFolders(LLFolderView* root);
+ static void updateMarketplaceFolders();
+ static std::list<LLUUID> sMarketplaceFolders; // Marketplace folders that will need update once the action is completed
};
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index 230ee86fb7..16cdc14b15 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -187,7 +187,7 @@ LLInventoryGallery::~LLInventoryGallery()
mHiddenItems.pop_back();
panelp->die();
}
-
+
if (gInventory.containsObserver(mCategoriesObserver))
{
@@ -200,7 +200,7 @@ LLInventoryGallery::~LLInventoryGallery()
gInventory.removeObserver(mThumbnailsObserver);
}
delete mThumbnailsObserver;
-
+
LLGestureMgr::instance().removeObserver(mGestureObserver);
delete mGestureObserver;
}
@@ -263,7 +263,7 @@ void LLInventoryGallery::updateRootFolder()
updateRemovedItem(mHiddenItems[i]->getUUID());
}
mItemBuildQuery.clear();
-
+
if (gInventory.containsObserver(mCategoriesObserver))
{
gInventory.removeObserver(mCategoriesObserver);
@@ -284,7 +284,7 @@ void LLInventoryGallery::updateRootFolder()
mRootChangedSignal();
gInventory.addObserver(mCategoriesObserver);
-
+
// Start observing changes in selected category.
mCategoriesObserver->addCategory(mFolderID,
boost::bind(&LLInventoryGallery::refreshList, this, mFolderID));
@@ -294,7 +294,7 @@ void LLInventoryGallery::updateRootFolder()
// the observer will refresh the list as soon as the new items
// arrive.
category->fetch();
-
+
//refreshList(cat_id);
LLInventoryModel::cat_array_t* cat_array;
LLInventoryModel::item_array_t* item_array;
@@ -308,7 +308,7 @@ void LLInventoryGallery::updateRootFolder()
{
mItemBuildQuery.insert((*iter)->getUUID());
}
-
+
for (LLInventoryModel::item_array_t::const_iterator iter = item_array->begin();
iter != item_array->end();
iter++)
@@ -448,7 +448,7 @@ void LLInventoryGallery::reArrangeRows(S32 row_diff)
buf_items.push_back(*it);
}
mHiddenItems.clear();
-
+
mItemsInRow+= row_diff;
updateGalleryWidth();
@@ -458,7 +458,7 @@ void LLInventoryGallery::reArrangeRows(S32 row_diff)
{
return compareGalleryItem(item1, item2, sort_by_date, sort_folders_by_name);
});
-
+
for (std::vector<LLInventoryGalleryItem*>::const_iterator it = buf_items.begin(); it != buf_items.end(); ++it)
{
(*it)->setHidden(false);
@@ -735,7 +735,7 @@ void LLInventoryGallery::setFilterSubString(const std::string& string)
{
mFilterSubString = string;
mFilter->setFilterSubString(string);
-
+
//reArrangeRows();
}
@@ -763,7 +763,7 @@ bool LLInventoryGallery::checkAgainstFilters(LLInventoryGalleryItem* item, const
{
return false;
}
-
+
bool hidden = false;
if(mFilter->getFilterCreatorType() == LLInventoryFilter::FILTERCREATOR_SELF)
@@ -806,7 +806,7 @@ bool LLInventoryGallery::checkAgainstFilters(LLInventoryGalleryItem* item, const
desc = item->getItemName() + item->getItemNameSuffix();
break;
}
-
+
LLStringUtil::toUpper(desc);
std::string cur_filter = filter_substring;
@@ -2209,7 +2209,7 @@ void LLInventoryGallery::onCOFChanged()
LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved);
mCOFLinkedItems = vnew;
-
+
for (uuid_vec_t::const_iterator iter = vadded.begin();
iter != vadded.end();
++iter)
@@ -2240,7 +2240,7 @@ void LLInventoryGallery::onGesturesChanged()
LLCommonUtils::computeDifference(vnew, mActiveGestures, vadded, vremoved);
mActiveGestures = vnew;
-
+
for (uuid_vec_t::const_iterator iter = vadded.begin();
iter != vadded.end();
++iter)
@@ -2418,7 +2418,7 @@ void LLInventoryGallery::startDrag()
ids.push_back(selected_id);
}
- const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id);
+ const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id);
if (cat)
{
if (gInventory.isObjectDescendentOf(selected_id, gInventory.getLibraryRootFolderID()))
@@ -2496,7 +2496,7 @@ bool LLInventoryGallery::checkAgainstFilterType(const LLUUID& object_id)
break;
}
}
-
+
if (filterTypes & LLInventoryFilter::FILTERTYPE_DATE)
{
const U16 HOURS_TO_SECONDS = 3600;
@@ -2939,7 +2939,7 @@ void LLThumbnailsObserver::changed(U32 mask)
{
const LLUUID& obj_id = (*iter).first;
LLItemData& data = (*iter).second;
-
+
LLInventoryObject* obj = gInventory.getObject(obj_id);
if (!obj)
{
@@ -3150,7 +3150,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop,
//
//--------------------------------------------------------------------------------
-
+
//--------------------------------------------------------------------------------
// Determine if item can be moved & dropped
// Note: if user_confirm is false, we already went through those accept logic test and can skip them
@@ -3177,7 +3177,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop,
{
//disable dropping in or out of marketplace for now
return FALSE;
-
+
/*const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, folder_id);
LLViewerInventoryCategory * dest_folder = cat;
accept = can_move_item_to_marketplace(master_folder, dest_folder, inv_item, tooltip_msg, LLToolDragAndDrop::instance().getCargoCount() - LLToolDragAndDrop::instance().getCargoIndex());*/
@@ -3189,7 +3189,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop,
LLViewerInventoryCategory * dest_folder = cat;
accept = dest_folder->acceptItem(inv_item);
}
-
+
LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
if (accept && drop)
@@ -3263,7 +3263,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop,
gInventory.changeItemParent((LLViewerInventoryItem*)inv_item, folder_id, move_is_into_trash);
}
-
+
if (move_is_from_marketplacelistings)
{
// If we move from an active (listed) listing, checks that it's still valid, if not, unlist
@@ -3483,7 +3483,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat,
const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
//const LLUUID from_folder_uuid = inv_cat->getParentUUID();
-
+
const BOOL move_is_into_current_outfit = (dest_id == current_outfit_id);
const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(dest_id, marketplacelistings_id);
const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id);
@@ -3592,7 +3592,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat,
is_movable = FALSE;
// tooltip?
}
-
+
LLInventoryModel::cat_array_t descendent_categories;
LLInventoryModel::item_array_t descendent_items;
if (is_movable)
@@ -3658,7 +3658,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat,
}
}
}
-
+
if (is_movable && move_is_into_marketplacelistings)
{
const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, dest_id);
@@ -3731,7 +3731,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat,
{
//disable dropping in or out of marketplace for now
return FALSE;
-
+
// If we are moving a folder at the listing folder level (i.e. its parent is the marketplace listings folder)
/*if (from_folder_uuid == marketplacelistings_id)
{
diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h
index 0c52e7b713..51444d24b0 100644
--- a/indra/newview/llinventorygallery.h
+++ b/indra/newview/llinventorygallery.h
@@ -152,11 +152,11 @@ public:
LLInventoryGalleryItem* getFirstSelectedItem();
// Copy & paste (LLEditMenuHandler)
- void copy() override;
- BOOL canCopy() const override;
+ void copy() override;
+ BOOL canCopy() const override;
- void cut() override;
- BOOL canCut() const override;
+ void cut() override;
+ BOOL canCut() const override;
void paste() override;
BOOL canPaste() const override;
@@ -336,7 +336,7 @@ public:
std::string getItemName() {return mItemName;}
std::string getItemNameSuffix() {return mPermSuffix + mWornSuffix;}
bool isDefaultImage() {return mDefaultImage;}
-
+
bool isHidden() {return mHidden;}
void setHidden(bool hidden) {mHidden = hidden;}
@@ -350,7 +350,7 @@ public:
EInventorySortGroup getSortGroup() { return mSortGroup; }
void updateNameText();
-
+
private:
bool isFadeItem();
diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp
index 5f4b816b99..3cb6503a1c 100644
--- a/indra/newview/llinventorygallerymenu.cpp
+++ b/indra/newview/llinventorygallerymenu.cpp
@@ -62,7 +62,7 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu()
registrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, uuids, gFloaterView->getParentFloater(mGallery)));
enable_registrar.add("Inventory.CanSetUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::canSetUploadLocation, this, _2));
-
+
LLContextMenu* menu = createFromFile("menu_gallery_inventory.xml");
updateMenuItemsVisibility(menu);
@@ -321,7 +321,7 @@ void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLS
if (!new_name.empty())
{
LLUUID id = notification["payload"]["id"].asUUID();
-
+
LLViewerInventoryCategory* cat = gInventory.getCategory(id);
if(cat && (cat->getName() != new_name))
{
@@ -330,7 +330,7 @@ void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLS
update_inventory_category(cat->getUUID(),updates, NULL);
return;
}
-
+
LLViewerInventoryItem* item = gInventory.getItem(id);
if(item && (item->getName() != new_name))
{
@@ -379,12 +379,12 @@ bool LLInventoryGalleryContextMenu::canSetUploadLocation(const LLSD& userdata)
bool is_inbox_folder(LLUUID item_id)
{
const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
-
+
if (inbox_id.isNull())
{
return false;
}
-
+
return gInventory.isObjectDescendentOf(item_id, inbox_id);
}
@@ -616,7 +616,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
disabled_items.push_back(std::string("Open"));
disabled_items.push_back(std::string("Open Original"));
}
-
+
if(LLAssetType::AT_GESTURE == obj->getType())
{
items.push_back(std::string("Gesture Separator"));
diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp
index e9b0e8404a..a8e59b61c5 100644
--- a/indra/newview/llinventoryicon.cpp
+++ b/indra/newview/llinventoryicon.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventoryicon.cpp
* @brief Implementation of the inventory icon.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,61 +38,61 @@
struct IconEntry : public LLDictionaryEntry
{
- IconEntry(const std::string &item_name)
- :
- LLDictionaryEntry(item_name)
- {}
+ IconEntry(const std::string &item_name)
+ :
+ LLDictionaryEntry(item_name)
+ {}
};
class LLIconDictionary : public LLSingleton<LLIconDictionary>,
- public LLDictionary<LLInventoryType::EIconName, IconEntry>
+ public LLDictionary<LLInventoryType::EIconName, IconEntry>
{
- LLSINGLETON(LLIconDictionary);
+ LLSINGLETON(LLIconDictionary);
};
typedef LLPointer<LLUIImage> LLUIImagePtr;
LLIconDictionary::LLIconDictionary()
{
- addEntry(LLInventoryType::ICONNAME_TEXTURE, new IconEntry("Inv_Texture"));
- addEntry(LLInventoryType::ICONNAME_SOUND, new IconEntry("Inv_Sound"));
- addEntry(LLInventoryType::ICONNAME_CALLINGCARD_ONLINE, new IconEntry("Inv_CallingCard"));
- addEntry(LLInventoryType::ICONNAME_CALLINGCARD_OFFLINE, new IconEntry("Inv_CallingCard"));
- addEntry(LLInventoryType::ICONNAME_LANDMARK, new IconEntry("Inv_Landmark"));
- addEntry(LLInventoryType::ICONNAME_LANDMARK_VISITED, new IconEntry("Inv_Landmark"));
- addEntry(LLInventoryType::ICONNAME_SCRIPT, new IconEntry("Inv_Script"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING, new IconEntry("Inv_Clothing"));
- addEntry(LLInventoryType::ICONNAME_OBJECT, new IconEntry("Inv_Object"));
- addEntry(LLInventoryType::ICONNAME_OBJECT_MULTI, new IconEntry("Inv_Object_Multi"));
- addEntry(LLInventoryType::ICONNAME_NOTECARD, new IconEntry("Inv_Notecard"));
- addEntry(LLInventoryType::ICONNAME_BODYPART, new IconEntry("Inv_Skin"));
- addEntry(LLInventoryType::ICONNAME_SNAPSHOT, new IconEntry("Inv_Snapshot"));
-
- addEntry(LLInventoryType::ICONNAME_BODYPART_SHAPE, new IconEntry("Inv_BodyShape"));
- addEntry(LLInventoryType::ICONNAME_BODYPART_SKIN, new IconEntry("Inv_Skin"));
- addEntry(LLInventoryType::ICONNAME_BODYPART_HAIR, new IconEntry("Inv_Hair"));
- addEntry(LLInventoryType::ICONNAME_BODYPART_EYES, new IconEntry("Inv_Eye"));
-
- addEntry(LLInventoryType::ICONNAME_CLOTHING_SHIRT, new IconEntry("Inv_Shirt"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_PANTS, new IconEntry("Inv_Pants"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_SHOES, new IconEntry("Inv_Shoe"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_SOCKS, new IconEntry("Inv_Socks"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_JACKET, new IconEntry("Inv_Jacket"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_GLOVES, new IconEntry("Inv_Gloves"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, new IconEntry("Inv_Undershirt"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, new IconEntry("Inv_Underpants"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_SKIRT, new IconEntry("Inv_Skirt"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_ALPHA, new IconEntry("Inv_Alpha"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_TATTOO, new IconEntry("Inv_Tattoo"));
- addEntry(LLInventoryType::ICONNAME_CLOTHING_UNIVERSAL, new IconEntry("Inv_Universal"));
- addEntry(LLInventoryType::ICONNAME_ANIMATION, new IconEntry("Inv_Animation"));
- addEntry(LLInventoryType::ICONNAME_GESTURE, new IconEntry("Inv_Gesture"));
-
- addEntry(LLInventoryType::ICONNAME_CLOTHING_PHYSICS, new IconEntry("Inv_Physics"));
-
- addEntry(LLInventoryType::ICONNAME_LINKITEM, new IconEntry("Inv_LinkItem"));
- addEntry(LLInventoryType::ICONNAME_LINKFOLDER, new IconEntry("Inv_LinkFolder"));
- addEntry(LLInventoryType::ICONNAME_MESH, new IconEntry("Inv_Mesh"));
+ addEntry(LLInventoryType::ICONNAME_TEXTURE, new IconEntry("Inv_Texture"));
+ addEntry(LLInventoryType::ICONNAME_SOUND, new IconEntry("Inv_Sound"));
+ addEntry(LLInventoryType::ICONNAME_CALLINGCARD_ONLINE, new IconEntry("Inv_CallingCard"));
+ addEntry(LLInventoryType::ICONNAME_CALLINGCARD_OFFLINE, new IconEntry("Inv_CallingCard"));
+ addEntry(LLInventoryType::ICONNAME_LANDMARK, new IconEntry("Inv_Landmark"));
+ addEntry(LLInventoryType::ICONNAME_LANDMARK_VISITED, new IconEntry("Inv_Landmark"));
+ addEntry(LLInventoryType::ICONNAME_SCRIPT, new IconEntry("Inv_Script"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING, new IconEntry("Inv_Clothing"));
+ addEntry(LLInventoryType::ICONNAME_OBJECT, new IconEntry("Inv_Object"));
+ addEntry(LLInventoryType::ICONNAME_OBJECT_MULTI, new IconEntry("Inv_Object_Multi"));
+ addEntry(LLInventoryType::ICONNAME_NOTECARD, new IconEntry("Inv_Notecard"));
+ addEntry(LLInventoryType::ICONNAME_BODYPART, new IconEntry("Inv_Skin"));
+ addEntry(LLInventoryType::ICONNAME_SNAPSHOT, new IconEntry("Inv_Snapshot"));
+
+ addEntry(LLInventoryType::ICONNAME_BODYPART_SHAPE, new IconEntry("Inv_BodyShape"));
+ addEntry(LLInventoryType::ICONNAME_BODYPART_SKIN, new IconEntry("Inv_Skin"));
+ addEntry(LLInventoryType::ICONNAME_BODYPART_HAIR, new IconEntry("Inv_Hair"));
+ addEntry(LLInventoryType::ICONNAME_BODYPART_EYES, new IconEntry("Inv_Eye"));
+
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_SHIRT, new IconEntry("Inv_Shirt"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_PANTS, new IconEntry("Inv_Pants"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_SHOES, new IconEntry("Inv_Shoe"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_SOCKS, new IconEntry("Inv_Socks"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_JACKET, new IconEntry("Inv_Jacket"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_GLOVES, new IconEntry("Inv_Gloves"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, new IconEntry("Inv_Undershirt"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, new IconEntry("Inv_Underpants"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_SKIRT, new IconEntry("Inv_Skirt"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_ALPHA, new IconEntry("Inv_Alpha"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_TATTOO, new IconEntry("Inv_Tattoo"));
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_UNIVERSAL, new IconEntry("Inv_Universal"));
+ addEntry(LLInventoryType::ICONNAME_ANIMATION, new IconEntry("Inv_Animation"));
+ addEntry(LLInventoryType::ICONNAME_GESTURE, new IconEntry("Inv_Gesture"));
+
+ addEntry(LLInventoryType::ICONNAME_CLOTHING_PHYSICS, new IconEntry("Inv_Physics"));
+
+ addEntry(LLInventoryType::ICONNAME_LINKITEM, new IconEntry("Inv_LinkItem"));
+ addEntry(LLInventoryType::ICONNAME_LINKFOLDER, new IconEntry("Inv_LinkFolder"));
+ addEntry(LLInventoryType::ICONNAME_MESH, new IconEntry("Inv_Mesh"));
addEntry(LLInventoryType::ICONNAME_SETTINGS_SKY, new IconEntry("Inv_SettingsSky"));
addEntry(LLInventoryType::ICONNAME_SETTINGS_WATER, new IconEntry("Inv_SettingsWater"));
@@ -101,111 +101,111 @@ LLIconDictionary::LLIconDictionary()
addEntry(LLInventoryType::ICONNAME_MATERIAL, new IconEntry("Inv_Material"));
- addEntry(LLInventoryType::ICONNAME_INVALID, new IconEntry("Inv_Invalid"));
- addEntry(LLInventoryType::ICONNAME_UNKNOWN, new IconEntry("Inv_Unknown"));
+ addEntry(LLInventoryType::ICONNAME_INVALID, new IconEntry("Inv_Invalid"));
+ addEntry(LLInventoryType::ICONNAME_UNKNOWN, new IconEntry("Inv_Unknown"));
- addEntry(LLInventoryType::ICONNAME_NONE, new IconEntry("NONE"));
+ addEntry(LLInventoryType::ICONNAME_NONE, new IconEntry("NONE"));
}
LLUIImagePtr LLInventoryIcon::getIcon(LLAssetType::EType asset_type,
- LLInventoryType::EType inventory_type,
- U32 misc_flag,
- BOOL item_is_multi)
+ LLInventoryType::EType inventory_type,
+ U32 misc_flag,
+ BOOL item_is_multi)
{
- const std::string& icon_name = getIconName(asset_type, inventory_type, misc_flag, item_is_multi);
- return LLUI::getUIImage(icon_name);
+ const std::string& icon_name = getIconName(asset_type, inventory_type, misc_flag, item_is_multi);
+ return LLUI::getUIImage(icon_name);
}
LLUIImagePtr LLInventoryIcon::getIcon(LLInventoryType::EIconName idx)
{
- return LLUI::getUIImage(getIconName(idx));
+ return LLUI::getUIImage(getIconName(idx));
}
const std::string& LLInventoryIcon::getIconName(LLAssetType::EType asset_type,
- LLInventoryType::EType inventory_type,
- U32 misc_flag,
- BOOL item_is_multi)
+ LLInventoryType::EType inventory_type,
+ U32 misc_flag,
+ BOOL item_is_multi)
{
- LLInventoryType::EIconName idx = LLInventoryType::ICONNAME_OBJECT;
- if (item_is_multi)
- {
- idx = LLInventoryType::ICONNAME_OBJECT_MULTI;
- return getIconName(idx);
- }
-
- switch(asset_type)
- {
- case LLAssetType::AT_TEXTURE:
- idx = (inventory_type == LLInventoryType::IT_SNAPSHOT) ? LLInventoryType::ICONNAME_SNAPSHOT : LLInventoryType::ICONNAME_TEXTURE;
- break;
- case LLAssetType::AT_SOUND:
- idx = LLInventoryType::ICONNAME_SOUND;
- break;
- case LLAssetType::AT_CALLINGCARD:
- idx = (misc_flag != 0) ? LLInventoryType::ICONNAME_CALLINGCARD_ONLINE : LLInventoryType::ICONNAME_CALLINGCARD_OFFLINE;
- break;
- case LLAssetType::AT_LANDMARK:
- idx = (misc_flag != 0) ? LLInventoryType::ICONNAME_LANDMARK_VISITED : LLInventoryType::ICONNAME_LANDMARK;
- break;
- case LLAssetType::AT_SCRIPT:
- case LLAssetType::AT_LSL_TEXT:
- case LLAssetType::AT_LSL_BYTECODE:
- idx = LLInventoryType::ICONNAME_SCRIPT;
- break;
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_BODYPART:
- idx = assignWearableIcon(misc_flag);
- break;
- case LLAssetType::AT_NOTECARD:
- idx = LLInventoryType::ICONNAME_NOTECARD;
- break;
- case LLAssetType::AT_ANIMATION:
- idx = LLInventoryType::ICONNAME_ANIMATION;
- break;
- case LLAssetType::AT_GESTURE:
- idx = LLInventoryType::ICONNAME_GESTURE;
- break;
- case LLAssetType::AT_LINK:
- idx = LLInventoryType::ICONNAME_LINKITEM;
- break;
- case LLAssetType::AT_LINK_FOLDER:
- idx = LLInventoryType::ICONNAME_LINKFOLDER;
- break;
- case LLAssetType::AT_OBJECT:
- idx = LLInventoryType::ICONNAME_OBJECT;
- break;
- case LLAssetType::AT_MESH:
- idx = LLInventoryType::ICONNAME_MESH;
- case LLAssetType::AT_SETTINGS:
- idx = assignSettingsIcon(misc_flag);
- break;
- case LLAssetType::AT_MATERIAL:
- idx = LLInventoryType::ICONNAME_MATERIAL;
- break;
- case LLAssetType::AT_UNKNOWN:
- idx = LLInventoryType::ICONNAME_UNKNOWN;
- default:
- break;
- }
-
- return getIconName(idx);
+ LLInventoryType::EIconName idx = LLInventoryType::ICONNAME_OBJECT;
+ if (item_is_multi)
+ {
+ idx = LLInventoryType::ICONNAME_OBJECT_MULTI;
+ return getIconName(idx);
+ }
+
+ switch(asset_type)
+ {
+ case LLAssetType::AT_TEXTURE:
+ idx = (inventory_type == LLInventoryType::IT_SNAPSHOT) ? LLInventoryType::ICONNAME_SNAPSHOT : LLInventoryType::ICONNAME_TEXTURE;
+ break;
+ case LLAssetType::AT_SOUND:
+ idx = LLInventoryType::ICONNAME_SOUND;
+ break;
+ case LLAssetType::AT_CALLINGCARD:
+ idx = (misc_flag != 0) ? LLInventoryType::ICONNAME_CALLINGCARD_ONLINE : LLInventoryType::ICONNAME_CALLINGCARD_OFFLINE;
+ break;
+ case LLAssetType::AT_LANDMARK:
+ idx = (misc_flag != 0) ? LLInventoryType::ICONNAME_LANDMARK_VISITED : LLInventoryType::ICONNAME_LANDMARK;
+ break;
+ case LLAssetType::AT_SCRIPT:
+ case LLAssetType::AT_LSL_TEXT:
+ case LLAssetType::AT_LSL_BYTECODE:
+ idx = LLInventoryType::ICONNAME_SCRIPT;
+ break;
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_BODYPART:
+ idx = assignWearableIcon(misc_flag);
+ break;
+ case LLAssetType::AT_NOTECARD:
+ idx = LLInventoryType::ICONNAME_NOTECARD;
+ break;
+ case LLAssetType::AT_ANIMATION:
+ idx = LLInventoryType::ICONNAME_ANIMATION;
+ break;
+ case LLAssetType::AT_GESTURE:
+ idx = LLInventoryType::ICONNAME_GESTURE;
+ break;
+ case LLAssetType::AT_LINK:
+ idx = LLInventoryType::ICONNAME_LINKITEM;
+ break;
+ case LLAssetType::AT_LINK_FOLDER:
+ idx = LLInventoryType::ICONNAME_LINKFOLDER;
+ break;
+ case LLAssetType::AT_OBJECT:
+ idx = LLInventoryType::ICONNAME_OBJECT;
+ break;
+ case LLAssetType::AT_MESH:
+ idx = LLInventoryType::ICONNAME_MESH;
+ case LLAssetType::AT_SETTINGS:
+ idx = assignSettingsIcon(misc_flag);
+ break;
+ case LLAssetType::AT_MATERIAL:
+ idx = LLInventoryType::ICONNAME_MATERIAL;
+ break;
+ case LLAssetType::AT_UNKNOWN:
+ idx = LLInventoryType::ICONNAME_UNKNOWN;
+ default:
+ break;
+ }
+
+ return getIconName(idx);
}
const std::string& LLInventoryIcon::getIconName(LLInventoryType::EIconName idx)
{
- const IconEntry *entry = LLIconDictionary::instance().lookup(idx);
- return entry->mName;
+ const IconEntry *entry = LLIconDictionary::instance().lookup(idx);
+ return entry->mName;
}
LLInventoryType::EIconName LLInventoryIcon::assignWearableIcon(U32 misc_flag)
{
- const LLWearableType::EType wearable_type = LLWearableType::inventoryFlagsToWearableType(misc_flag);
- return LLWearableType::getInstance()->getIconName(wearable_type);
+ const LLWearableType::EType wearable_type = LLWearableType::inventoryFlagsToWearableType(misc_flag);
+ return LLWearableType::getInstance()->getIconName(wearable_type);
}
LLInventoryType::EIconName LLInventoryIcon::assignSettingsIcon(U32 misc_flag)
{
- LLSettingsType::type_e settings_type = LLSettingsType::fromInventoryFlags(misc_flag);
- return LLSettingsType::getIconName(settings_type);
+ LLSettingsType::type_e settings_type = LLSettingsType::fromInventoryFlags(misc_flag);
+ return LLSettingsType::getIconName(settings_type);
}
diff --git a/indra/newview/llinventoryicon.h b/indra/newview/llinventoryicon.h
index b8637c4e33..ca17956252 100644
--- a/indra/newview/llinventoryicon.h
+++ b/indra/newview/llinventoryicon.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llinventoryicon.h
* @brief Miscellaneous inventory-related functions and classes
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,20 +34,20 @@
class LLInventoryIcon
{
public:
- static const std::string& getIconName(LLAssetType::EType asset_type,
- LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
- U32 misc_flag = 0, // different meanings depending on item type
- BOOL item_is_multi = FALSE);
- static const std::string& getIconName(LLInventoryType::EIconName idx);
-
- static LLPointer<class LLUIImage> getIcon(LLAssetType::EType asset_type,
- LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
- U32 misc_flag = 0, // different meanings depending on item type
- BOOL item_is_multi = FALSE);
- static LLPointer<class LLUIImage> getIcon(LLInventoryType::EIconName idx);
+ static const std::string& getIconName(LLAssetType::EType asset_type,
+ LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
+ U32 misc_flag = 0, // different meanings depending on item type
+ BOOL item_is_multi = FALSE);
+ static const std::string& getIconName(LLInventoryType::EIconName idx);
+
+ static LLPointer<class LLUIImage> getIcon(LLAssetType::EType asset_type,
+ LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
+ U32 misc_flag = 0, // different meanings depending on item type
+ BOOL item_is_multi = FALSE);
+ static LLPointer<class LLUIImage> getIcon(LLInventoryType::EIconName idx);
protected:
- static LLInventoryType::EIconName assignWearableIcon(U32 misc_flag);
+ static LLInventoryType::EIconName assignWearableIcon(U32 misc_flag);
static LLInventoryType::EIconName assignSettingsIcon(U32 misc_flag);
};
#endif // LL_LLINVENTORYICON_H
diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp
index cac859387c..9e936eee5b 100644
--- a/indra/newview/llinventoryitemslist.cpp
+++ b/indra/newview/llinventoryitemslist.cpp
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,93 +44,93 @@ LLInventoryItemsList::Params::Params()
{}
LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p)
-: LLFlatListViewEx(p)
-, mRefreshState(REFRESH_COMPLETE)
-, mForceRefresh(false)
+: LLFlatListViewEx(p)
+, mRefreshState(REFRESH_COMPLETE)
+, mForceRefresh(false)
{
- // TODO: mCommitOnSelectionChange is set to "false" in LLFlatListView
- // but reset to true in all derived classes. This settings might need to
- // be added to LLFlatListView::Params() and/or set to "true" by default.
- setCommitOnSelectionChange(true);
+ // TODO: mCommitOnSelectionChange is set to "false" in LLFlatListView
+ // but reset to true in all derived classes. This settings might need to
+ // be added to LLFlatListView::Params() and/or set to "true" by default.
+ setCommitOnSelectionChange(true);
- setNoFilteredItemsMsg(LLTrans::getString("InventoryNoMatchingItems"));
+ setNoFilteredItemsMsg(LLTrans::getString("InventoryNoMatchingItems"));
- gIdleCallbacks.addFunction(idle, this);
+ gIdleCallbacks.addFunction(idle, this);
}
// virtual
LLInventoryItemsList::~LLInventoryItemsList()
{
- gIdleCallbacks.deleteFunction(idle, this);
+ gIdleCallbacks.deleteFunction(idle, this);
}
void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item_array)
{
getIDs().clear();
- LLInventoryModel::item_array_t::const_iterator it = item_array.begin();
- for( ; item_array.end() != it; ++it)
- {
- getIDs().push_back((*it)->getUUID());
- }
+ LLInventoryModel::item_array_t::const_iterator it = item_array.begin();
+ for( ; item_array.end() != it; ++it)
+ {
+ getIDs().push_back((*it)->getUUID());
+ }
mRefreshState = REFRESH_ALL;
}
boost::signals2::connection LLInventoryItemsList::setRefreshCompleteCallback(const commit_signal_t::slot_type& cb)
{
- return mRefreshCompleteSignal.connect(cb);
+ return mRefreshCompleteSignal.connect(cb);
}
bool LLInventoryItemsList::selectItemByValue(const LLSD& value, bool select)
{
- if (!LLFlatListView::selectItemByValue(value, select) && !value.isUndefined())
- {
- mSelectTheseIDs.push_back(value);
- return false;
- }
- return true;
+ if (!LLFlatListView::selectItemByValue(value, select) && !value.isUndefined())
+ {
+ mSelectTheseIDs.push_back(value);
+ return false;
+ }
+ return true;
}
void LLInventoryItemsList::updateSelection()
{
- if(mSelectTheseIDs.empty()) return;
-
- std::vector<LLSD> cur;
- getValues(cur);
-
- for(std::vector<LLSD>::const_iterator cur_id_it = cur.begin(); cur_id_it != cur.end() && !mSelectTheseIDs.empty(); ++cur_id_it)
- {
- uuid_vec_t::iterator select_ids_it = std::find(mSelectTheseIDs.begin(), mSelectTheseIDs.end(), *cur_id_it);
- if(select_ids_it != mSelectTheseIDs.end())
- {
- selectItemByUUID(*select_ids_it);
- mSelectTheseIDs.erase(select_ids_it);
- }
- }
-
- scrollToShowFirstSelectedItem();
- mSelectTheseIDs.clear();
+ if(mSelectTheseIDs.empty()) return;
+
+ std::vector<LLSD> cur;
+ getValues(cur);
+
+ for(std::vector<LLSD>::const_iterator cur_id_it = cur.begin(); cur_id_it != cur.end() && !mSelectTheseIDs.empty(); ++cur_id_it)
+ {
+ uuid_vec_t::iterator select_ids_it = std::find(mSelectTheseIDs.begin(), mSelectTheseIDs.end(), *cur_id_it);
+ if(select_ids_it != mSelectTheseIDs.end())
+ {
+ selectItemByUUID(*select_ids_it);
+ mSelectTheseIDs.erase(select_ids_it);
+ }
+ }
+
+ scrollToShowFirstSelectedItem();
+ mSelectTheseIDs.clear();
}
void LLInventoryItemsList::doIdle()
{
- if (mRefreshState == REFRESH_COMPLETE) return;
+ if (mRefreshState == REFRESH_COMPLETE) return;
- if (isInVisibleChain() || mForceRefresh )
- {
- refresh();
+ if (isInVisibleChain() || mForceRefresh )
+ {
+ refresh();
- mRefreshCompleteSignal(this, LLSD());
- }
+ mRefreshCompleteSignal(this, LLSD());
+ }
}
//static
void LLInventoryItemsList::idle(void* user_data)
{
- LLInventoryItemsList* self = static_cast<LLInventoryItemsList*>(user_data);
- if ( self )
- { // Do the real idle
- self->doIdle();
- }
+ LLInventoryItemsList* self = static_cast<LLInventoryItemsList*>(user_data);
+ if ( self )
+ { // Do the real idle
+ self->doIdle();
+ }
}
void LLInventoryItemsList::refresh()
@@ -262,20 +262,20 @@ void LLInventoryItemsList::refresh()
}
void LLInventoryItemsList::computeDifference(
- const uuid_vec_t& vnew,
- uuid_vec_t& vadded,
- uuid_vec_t& vremoved)
+ const uuid_vec_t& vnew,
+ uuid_vec_t& vadded,
+ uuid_vec_t& vremoved)
{
- uuid_vec_t vcur;
- {
- std::vector<LLSD> vcur_values;
- getValues(vcur_values);
+ uuid_vec_t vcur;
+ {
+ std::vector<LLSD> vcur_values;
+ getValues(vcur_values);
- for (size_t i=0; i<vcur_values.size(); i++)
- vcur.push_back(vcur_values[i].asUUID());
- }
+ for (size_t i=0; i<vcur_values.size(); i++)
+ vcur.push_back(vcur_values[i].asUUID());
+ }
- LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved);
+ LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved);
}
LLPanel* LLInventoryItemsList::createNewItem(LLViewerInventoryItem* item)
diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h
index 5b83298bb9..9ebeb5e52b 100644
--- a/indra/newview/llinventoryitemslist.h
+++ b/indra/newview/llinventoryitemslist.h
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,71 +37,71 @@ class LLViewerInventoryItem;
class LLInventoryItemsList : public LLFlatListViewEx
{
public:
- struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
- {
- Params();
- };
+ struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params>
+ {
+ Params();
+ };
- virtual ~LLInventoryItemsList();
+ virtual ~LLInventoryItemsList();
- void refreshList(const std::vector<LLPointer<LLViewerInventoryItem> > item_array);
+ void refreshList(const std::vector<LLPointer<LLViewerInventoryItem> > item_array);
- boost::signals2::connection setRefreshCompleteCallback(const commit_signal_t::slot_type& cb);
+ boost::signals2::connection setRefreshCompleteCallback(const commit_signal_t::slot_type& cb);
- /**
- * Let list know items need to be refreshed in next doIdle()
- */
- void setNeedsRefresh(bool needs_refresh) { mRefreshState = needs_refresh ? REFRESH_ALL : REFRESH_COMPLETE; }
+ /**
+ * Let list know items need to be refreshed in next doIdle()
+ */
+ void setNeedsRefresh(bool needs_refresh) { mRefreshState = needs_refresh ? REFRESH_ALL : REFRESH_COMPLETE; }
- U32 getNeedsRefresh() { return mRefreshState; }
+ U32 getNeedsRefresh() { return mRefreshState; }
- /**
- * Sets the flag indicating that the list needs to be refreshed even if it is
- * not currently visible.
- */
- void setForceRefresh(bool force_refresh) { mForceRefresh = force_refresh; }
+ /**
+ * Sets the flag indicating that the list needs to be refreshed even if it is
+ * not currently visible.
+ */
+ void setForceRefresh(bool force_refresh) { mForceRefresh = force_refresh; }
- /**
- * If refreshes when invisible.
- */
- bool getForceRefresh() { return mForceRefresh; }
+ /**
+ * If refreshes when invisible.
+ */
+ bool getForceRefresh() { return mForceRefresh; }
- virtual bool selectItemByValue(const LLSD& value, bool select = true);
+ virtual bool selectItemByValue(const LLSD& value, bool select = true);
- void updateSelection();
+ void updateSelection();
- /**
- * Idle routine used to refresh the list regardless of the current list
- * visibility, unlike draw() which is called only for the visible list.
- * This is needed for example to filter items of the list hidden by closed
- * accordion tab.
- */
- virtual void doIdle(); // Real idle routine
- static void idle(void* user_data); // static glue to doIdle()
+ /**
+ * Idle routine used to refresh the list regardless of the current list
+ * visibility, unlike draw() which is called only for the visible list.
+ * This is needed for example to filter items of the list hidden by closed
+ * accordion tab.
+ */
+ virtual void doIdle(); // Real idle routine
+ static void idle(void* user_data); // static glue to doIdle()
protected:
- friend class LLUICtrlFactory;
- LLInventoryItemsList(const LLInventoryItemsList::Params& p);
+ friend class LLUICtrlFactory;
+ LLInventoryItemsList(const LLInventoryItemsList::Params& p);
- uuid_vec_t& getIDs() { return mIDs; }
+ uuid_vec_t& getIDs() { return mIDs; }
- /**
- * Refreshes list items, adds new items and removes deleted items.
- * Called from doIdle() until all new items are added,
- * maximum 50 items can be added during single call.
- */
- void refresh();
+ /**
+ * Refreshes list items, adds new items and removes deleted items.
+ * Called from doIdle() until all new items are added,
+ * maximum 50 items can be added during single call.
+ */
+ void refresh();
- /**
- * Compute difference between new items and current items, fills 'vadded' with added items,
- * 'vremoved' with removed items. See LLCommonUtils::computeDifference
- */
- void computeDifference(const uuid_vec_t& vnew, uuid_vec_t& vadded, uuid_vec_t& vremoved);
+ /**
+ * Compute difference between new items and current items, fills 'vadded' with added items,
+ * 'vremoved' with removed items. See LLCommonUtils::computeDifference
+ */
+ void computeDifference(const uuid_vec_t& vnew, uuid_vec_t& vadded, uuid_vec_t& vremoved);
- /**
- * Create panel(item) from inventory item
- */
- virtual LLPanel* createNewItem(LLViewerInventoryItem* item);
+ /**
+ * Create panel(item) from inventory item
+ */
+ virtual LLPanel* createNewItem(LLViewerInventoryItem* item);
protected:
enum ERefreshStates
@@ -116,16 +116,16 @@ protected:
ERefreshStates mRefreshState;
private:
- uuid_vec_t mIDs; // IDs of items that were added in refreshList().
- // Will be used in refresh() to determine added and removed ids
+ uuid_vec_t mIDs; // IDs of items that were added in refreshList().
+ // Will be used in refresh() to determine added and removed ids
- uuid_vec_t mSelectTheseIDs; // IDs that will be selected if list is not loaded till now
- uuid_vec_t mAddedItems;
- uuid_vec_t mRemovedItems;
+ uuid_vec_t mSelectTheseIDs; // IDs that will be selected if list is not loaded till now
+ uuid_vec_t mAddedItems;
+ uuid_vec_t mRemovedItems;
- bool mForceRefresh;
+ bool mForceRefresh;
- commit_signal_t mRefreshCompleteSignal;
+ commit_signal_t mRefreshCompleteSignal;
};
#endif //LL_LLINVENTORYITEMSLIST_H
diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp
index de6a850b57..af5319587f 100644
--- a/indra/newview/llinventorylistitem.cpp
+++ b/indra/newview/llinventorylistitem.cpp
@@ -8,21 +8,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,264 +46,264 @@ static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelInventoryListItemBase
static const S32 WIDGET_SPACING = 3;
LLPanelInventoryListItemBase::Params::Params()
-: default_style("default_style"),
- worn_style("worn_style"),
- hover_image("hover_image"),
- selected_image("selected_image"),
- separator_image("separator_image"),
- item_icon("item_icon"),
- item_name("item_name")
+: default_style("default_style"),
+ worn_style("worn_style"),
+ hover_image("hover_image"),
+ selected_image("selected_image"),
+ separator_image("separator_image"),
+ item_icon("item_icon"),
+ item_name("item_name")
{};
LLPanelInventoryListItemBase* LLPanelInventoryListItemBase::create(LLViewerInventoryItem* item)
{
- LLPanelInventoryListItemBase* list_item = NULL;
- if (item)
- {
- const LLPanelInventoryListItemBase::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelInventoryListItemBase>();
- list_item = new LLPanelInventoryListItemBase(item, params);
- list_item->initFromParams(params);
- list_item->postBuild();
- }
- return list_item;
+ LLPanelInventoryListItemBase* list_item = NULL;
+ if (item)
+ {
+ const LLPanelInventoryListItemBase::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelInventoryListItemBase>();
+ list_item = new LLPanelInventoryListItemBase(item, params);
+ list_item->initFromParams(params);
+ list_item->postBuild();
+ }
+ return list_item;
}
void LLPanelInventoryListItemBase::draw()
{
- if (getNeedsRefresh())
- {
- LLViewerInventoryItem* inv_item = getItem();
- if (inv_item)
- {
- updateItem(inv_item->getName());
- }
- setNeedsRefresh(false);
- }
-
- if (mHovered && mHoverImage)
- {
- mHoverImage->draw(getLocalRect());
- }
-
- if (mSelected && mSelectedImage)
- {
- mSelectedImage->draw(getLocalRect());
- }
-
- if (mSeparatorVisible && mSeparatorImage)
- {
- // place under bottom of listitem, using image height
- // item_pad in list using the item should be >= image height
- // to avoid cropping of top of the next item.
- LLRect separator_rect = getLocalRect();
- separator_rect.mTop = separator_rect.mBottom;
- separator_rect.mBottom -= mSeparatorImage->getHeight();
- F32 alpha = getCurrentTransparency();
- mSeparatorImage->draw(separator_rect, UI_VERTEX_COLOR % alpha);
- }
-
- LLPanel::draw();
+ if (getNeedsRefresh())
+ {
+ LLViewerInventoryItem* inv_item = getItem();
+ if (inv_item)
+ {
+ updateItem(inv_item->getName());
+ }
+ setNeedsRefresh(false);
+ }
+
+ if (mHovered && mHoverImage)
+ {
+ mHoverImage->draw(getLocalRect());
+ }
+
+ if (mSelected && mSelectedImage)
+ {
+ mSelectedImage->draw(getLocalRect());
+ }
+
+ if (mSeparatorVisible && mSeparatorImage)
+ {
+ // place under bottom of listitem, using image height
+ // item_pad in list using the item should be >= image height
+ // to avoid cropping of top of the next item.
+ LLRect separator_rect = getLocalRect();
+ separator_rect.mTop = separator_rect.mBottom;
+ separator_rect.mBottom -= mSeparatorImage->getHeight();
+ F32 alpha = getCurrentTransparency();
+ mSeparatorImage->draw(separator_rect, UI_VERTEX_COLOR % alpha);
+ }
+
+ LLPanel::draw();
}
// virtual
void LLPanelInventoryListItemBase::updateItem(const std::string& name,
- EItemState item_state)
+ EItemState item_state)
{
- setIconImage(mIconImage);
- setTitle(name, mHighlightedText, item_state);
+ setIconImage(mIconImage);
+ setTitle(name, mHighlightedText, item_state);
}
void LLPanelInventoryListItemBase::addWidgetToLeftSide(const std::string& name, bool show_widget/* = true*/)
{
- LLUICtrl* ctrl = findChild<LLUICtrl>(name);
- if(ctrl)
- {
- addWidgetToLeftSide(ctrl, show_widget);
- }
+ LLUICtrl* ctrl = findChild<LLUICtrl>(name);
+ if(ctrl)
+ {
+ addWidgetToLeftSide(ctrl, show_widget);
+ }
}
void LLPanelInventoryListItemBase::addWidgetToLeftSide(LLUICtrl* ctrl, bool show_widget/* = true*/)
{
- mLeftSideWidgets.push_back(ctrl);
- setShowWidget(ctrl, show_widget);
+ mLeftSideWidgets.push_back(ctrl);
+ setShowWidget(ctrl, show_widget);
}
void LLPanelInventoryListItemBase::addWidgetToRightSide(const std::string& name, bool show_widget/* = true*/)
{
- LLUICtrl* ctrl = findChild<LLUICtrl>(name);
- if(ctrl)
- {
- addWidgetToRightSide(ctrl, show_widget);
- }
+ LLUICtrl* ctrl = findChild<LLUICtrl>(name);
+ if(ctrl)
+ {
+ addWidgetToRightSide(ctrl, show_widget);
+ }
}
void LLPanelInventoryListItemBase::addWidgetToRightSide(LLUICtrl* ctrl, bool show_widget/* = true*/)
{
- mRightSideWidgets.push_back(ctrl);
- setShowWidget(ctrl, show_widget);
+ mRightSideWidgets.push_back(ctrl);
+ setShowWidget(ctrl, show_widget);
}
void LLPanelInventoryListItemBase::setShowWidget(const std::string& name, bool show)
{
- LLUICtrl* widget = findChild<LLUICtrl>(name);
- if(widget)
- {
- setShowWidget(widget, show);
- }
+ LLUICtrl* widget = findChild<LLUICtrl>(name);
+ if(widget)
+ {
+ setShowWidget(widget, show);
+ }
}
void LLPanelInventoryListItemBase::setShowWidget(LLUICtrl* ctrl, bool show)
{
- // Enable state determines whether widget may become visible in setWidgetsVisible()
- ctrl->setEnabled(show);
+ // Enable state determines whether widget may become visible in setWidgetsVisible()
+ ctrl->setEnabled(show);
}
BOOL LLPanelInventoryListItemBase::postBuild()
{
- LLViewerInventoryItem* inv_item = getItem();
- if (inv_item)
- {
- mIconImage = LLInventoryIcon::getIcon(inv_item->getType(), inv_item->getInventoryType(), inv_item->getFlags(), FALSE);
- updateItem(inv_item->getName());
- }
+ LLViewerInventoryItem* inv_item = getItem();
+ if (inv_item)
+ {
+ mIconImage = LLInventoryIcon::getIcon(inv_item->getType(), inv_item->getInventoryType(), inv_item->getFlags(), FALSE);
+ updateItem(inv_item->getName());
+ }
- setNeedsRefresh(true);
+ setNeedsRefresh(true);
- setWidgetsVisible(false);
- reshapeWidgets();
+ setWidgetsVisible(false);
+ reshapeWidgets();
- return TRUE;
+ return TRUE;
}
void LLPanelInventoryListItemBase::setValue(const LLSD& value)
{
- if (!value.isMap()) return;
- if (!value.has("selected")) return;
- mSelected = value["selected"];
+ if (!value.isMap()) return;
+ if (!value.has("selected")) return;
+ mSelected = value["selected"];
}
BOOL LLPanelInventoryListItemBase::handleHover(S32 x, S32 y, MASK mask)
{
- mHovered = true;
- return LLPanel::handleHover(x, y, mask);
+ mHovered = true;
+ return LLPanel::handleHover(x, y, mask);
}
void LLPanelInventoryListItemBase::onMouseLeave(S32 x, S32 y, MASK mask)
{
- mHovered = false;
- LLPanel::onMouseLeave(x, y, mask);
+ mHovered = false;
+ LLPanel::onMouseLeave(x, y, mask);
}
const std::string& LLPanelInventoryListItemBase::getItemName() const
{
- LLViewerInventoryItem* inv_item = getItem();
- if (NULL == inv_item)
- {
- return LLStringUtil::null;
- }
- return inv_item->getName();
+ LLViewerInventoryItem* inv_item = getItem();
+ if (NULL == inv_item)
+ {
+ return LLStringUtil::null;
+ }
+ return inv_item->getName();
}
LLAssetType::EType LLPanelInventoryListItemBase::getType() const
{
- LLViewerInventoryItem* inv_item = getItem();
- if (NULL == inv_item)
- {
- return LLAssetType::AT_NONE;
- }
- return inv_item->getType();
+ LLViewerInventoryItem* inv_item = getItem();
+ if (NULL == inv_item)
+ {
+ return LLAssetType::AT_NONE;
+ }
+ return inv_item->getType();
}
LLWearableType::EType LLPanelInventoryListItemBase::getWearableType() const
{
- LLViewerInventoryItem* inv_item = getItem();
- if (NULL == inv_item)
- {
- return LLWearableType::WT_NONE;
- }
- return inv_item->getWearableType();
+ LLViewerInventoryItem* inv_item = getItem();
+ if (NULL == inv_item)
+ {
+ return LLWearableType::WT_NONE;
+ }
+ return inv_item->getWearableType();
}
const std::string& LLPanelInventoryListItemBase::getDescription() const
{
- LLViewerInventoryItem* inv_item = getItem();
- if (NULL == inv_item)
- {
- return LLStringUtil::null;
- }
- return inv_item->getActualDescription();
+ LLViewerInventoryItem* inv_item = getItem();
+ if (NULL == inv_item)
+ {
+ return LLStringUtil::null;
+ }
+ return inv_item->getActualDescription();
}
time_t LLPanelInventoryListItemBase::getCreationDate() const
{
- LLViewerInventoryItem* inv_item = getItem();
- if (NULL == inv_item)
- {
- return 0;
- }
+ LLViewerInventoryItem* inv_item = getItem();
+ if (NULL == inv_item)
+ {
+ return 0;
+ }
- return inv_item->getCreationDate();
+ return inv_item->getCreationDate();
}
LLViewerInventoryItem* LLPanelInventoryListItemBase::getItem() const
{
- return gInventory.getItem(mInventoryItemUUID);
+ return gInventory.getItem(mInventoryItemUUID);
}
S32 LLPanelInventoryListItemBase::notify(const LLSD& info)
{
- S32 rv = 0;
- if(info.has("match_filter"))
- {
- mHighlightedText = info["match_filter"].asString();
-
- std::string test(mTitleCtrl->getText());
- LLStringUtil::toUpper(test);
-
- if(mHighlightedText.empty() || std::string::npos != test.find(mHighlightedText))
- {
- rv = 0; // substring is found
- }
- else
- {
- rv = -1;
- }
-
- setNeedsRefresh(true);
- }
- else
- {
- rv = LLPanel::notify(info);
- }
- return rv;
+ S32 rv = 0;
+ if(info.has("match_filter"))
+ {
+ mHighlightedText = info["match_filter"].asString();
+
+ std::string test(mTitleCtrl->getText());
+ LLStringUtil::toUpper(test);
+
+ if(mHighlightedText.empty() || std::string::npos != test.find(mHighlightedText))
+ {
+ rv = 0; // substring is found
+ }
+ else
+ {
+ rv = -1;
+ }
+
+ setNeedsRefresh(true);
+ }
+ else
+ {
+ rv = LLPanel::notify(info);
+ }
+ return rv;
}
LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem* item, const LLPanelInventoryListItemBase::Params& params)
-: LLPanel(params),
- mInventoryItemUUID(item ? item->getUUID() : LLUUID::null),
- mIconCtrl(NULL),
- mTitleCtrl(NULL),
- mWidgetSpacing(WIDGET_SPACING),
- mLeftWidgetsWidth(0),
- mRightWidgetsWidth(0),
- mNeedsRefresh(false),
- mHovered(false),
- mSelected(false),
- mSeparatorVisible(false),
- mHoverImage(params.hover_image),
- mSelectedImage(params.selected_image),
- mSeparatorImage(params.separator_image)
+: LLPanel(params),
+ mInventoryItemUUID(item ? item->getUUID() : LLUUID::null),
+ mIconCtrl(NULL),
+ mTitleCtrl(NULL),
+ mWidgetSpacing(WIDGET_SPACING),
+ mLeftWidgetsWidth(0),
+ mRightWidgetsWidth(0),
+ mNeedsRefresh(false),
+ mHovered(false),
+ mSelected(false),
+ mSeparatorVisible(false),
+ mHoverImage(params.hover_image),
+ mSelectedImage(params.selected_image),
+ mSeparatorImage(params.separator_image)
{
- LLIconCtrl::Params icon_params(params.item_icon);
- applyXUILayout(icon_params, this);
+ LLIconCtrl::Params icon_params(params.item_icon);
+ applyXUILayout(icon_params, this);
- mIconCtrl = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+ mIconCtrl = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
if (!mIconCtrl)
- {
- LLIconCtrl::Params icon_params;
- icon_params.name = "item_icon";
- mIconCtrl = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
- }
+ {
+ LLIconCtrl::Params icon_params;
+ icon_params.name = "item_icon";
+ mIconCtrl = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+ }
if (mIconCtrl)
{
@@ -314,16 +314,16 @@ LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem
LL_ERRS() << "Failed to create mIconCtrl" << LL_ENDL;
}
- LLTextBox::Params text_params(params.item_name);
- applyXUILayout(text_params, this);
+ LLTextBox::Params text_params(params.item_name);
+ applyXUILayout(text_params, this);
- mTitleCtrl = LLUICtrlFactory::create<LLTextBox>(text_params);
- if (!mTitleCtrl)
- {
- LLTextBox::Params text_params;
- text_params.name = "item_title";
- mTitleCtrl = LLUICtrlFactory::create<LLTextBox>(text_params);
- }
+ mTitleCtrl = LLUICtrlFactory::create<LLTextBox>(text_params);
+ if (!mTitleCtrl)
+ {
+ LLTextBox::Params text_params;
+ text_params.name = "item_title";
+ mTitleCtrl = LLUICtrlFactory::create<LLTextBox>(text_params);
+ }
if (mTitleCtrl)
{
@@ -338,137 +338,137 @@ LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem
class WidgetVisibilityChanger
{
public:
- WidgetVisibilityChanger(bool visible) : mVisible(visible){}
- void operator()(LLUICtrl* widget)
- {
- // Disabled widgets never become visible. see LLPanelInventoryListItemBase::setShowWidget()
- widget->setVisible(mVisible && widget->getEnabled());
- }
+ WidgetVisibilityChanger(bool visible) : mVisible(visible){}
+ void operator()(LLUICtrl* widget)
+ {
+ // Disabled widgets never become visible. see LLPanelInventoryListItemBase::setShowWidget()
+ widget->setVisible(mVisible && widget->getEnabled());
+ }
private:
- bool mVisible;
+ bool mVisible;
};
void LLPanelInventoryListItemBase::setWidgetsVisible(bool visible)
{
- std::for_each(mLeftSideWidgets.begin(), mLeftSideWidgets.end(), WidgetVisibilityChanger(visible));
- std::for_each(mRightSideWidgets.begin(), mRightSideWidgets.end(), WidgetVisibilityChanger(visible));
+ std::for_each(mLeftSideWidgets.begin(), mLeftSideWidgets.end(), WidgetVisibilityChanger(visible));
+ std::for_each(mRightSideWidgets.begin(), mRightSideWidgets.end(), WidgetVisibilityChanger(visible));
}
void LLPanelInventoryListItemBase::reshapeWidgets()
{
- // disabled reshape left for now to reserve space for 'delete' button in LLPanelClothingListItem
- /*reshapeLeftWidgets();*/
- reshapeRightWidgets();
- reshapeMiddleWidgets();
+ // disabled reshape left for now to reserve space for 'delete' button in LLPanelClothingListItem
+ /*reshapeLeftWidgets();*/
+ reshapeRightWidgets();
+ reshapeMiddleWidgets();
}
void LLPanelInventoryListItemBase::setIconImage(const LLUIImagePtr& image)
{
- if(image)
- {
- mIconImage = image;
- mIconCtrl->setImage(mIconImage);
- }
+ if(image)
+ {
+ mIconImage = image;
+ mIconCtrl->setImage(mIconImage);
+ }
}
void LLPanelInventoryListItemBase::setTitle(const std::string& title,
- const std::string& highlit_text,
- EItemState item_state)
+ const std::string& highlit_text,
+ EItemState item_state)
{
- mTitleCtrl->setToolTip(title);
-
- LLStyle::Params style_params;
-
- const LLPanelInventoryListItemBase::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelInventoryListItemBase>();
-
- switch(item_state)
- {
- case IS_DEFAULT:
- style_params = params.default_style();
- break;
- case IS_WORN:
- style_params = params.worn_style();
- break;
- default:;
- }
-
- LLTextUtil::textboxSetHighlightedVal(
- mTitleCtrl,
- style_params,
- title,
- highlit_text);
+ mTitleCtrl->setToolTip(title);
+
+ LLStyle::Params style_params;
+
+ const LLPanelInventoryListItemBase::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelInventoryListItemBase>();
+
+ switch(item_state)
+ {
+ case IS_DEFAULT:
+ style_params = params.default_style();
+ break;
+ case IS_WORN:
+ style_params = params.worn_style();
+ break;
+ default:;
+ }
+
+ LLTextUtil::textboxSetHighlightedVal(
+ mTitleCtrl,
+ style_params,
+ title,
+ highlit_text);
}
BOOL LLPanelInventoryListItemBase::handleToolTip( S32 x, S32 y, MASK mask)
{
- LLRect text_box_rect = mTitleCtrl->getRect();
- if (text_box_rect.pointInRect(x, y) &&
- mTitleCtrl->getTextPixelWidth() <= text_box_rect.getWidth())
- {
- return FALSE;
- }
- return LLPanel::handleToolTip(x, y, mask);
+ LLRect text_box_rect = mTitleCtrl->getRect();
+ if (text_box_rect.pointInRect(x, y) &&
+ mTitleCtrl->getTextPixelWidth() <= text_box_rect.getWidth())
+ {
+ return FALSE;
+ }
+ return LLPanel::handleToolTip(x, y, mask);
}
void LLPanelInventoryListItemBase::reshapeLeftWidgets()
{
- S32 widget_left = 0;
- mLeftWidgetsWidth = 0;
-
- widget_array_t::const_iterator it = mLeftSideWidgets.begin();
- const widget_array_t::const_iterator it_end = mLeftSideWidgets.end();
- for( ; it_end != it; ++it)
- {
- LLUICtrl* widget = *it;
- if(!widget->getVisible())
- {
- continue;
- }
- LLRect widget_rect(widget->getRect());
- widget_rect.setLeftTopAndSize(widget_left, widget_rect.mTop, widget_rect.getWidth(), widget_rect.getHeight());
- widget->setShape(widget_rect);
-
- widget_left += widget_rect.getWidth() + getWidgetSpacing();
- mLeftWidgetsWidth = widget_rect.mRight;
- }
+ S32 widget_left = 0;
+ mLeftWidgetsWidth = 0;
+
+ widget_array_t::const_iterator it = mLeftSideWidgets.begin();
+ const widget_array_t::const_iterator it_end = mLeftSideWidgets.end();
+ for( ; it_end != it; ++it)
+ {
+ LLUICtrl* widget = *it;
+ if(!widget->getVisible())
+ {
+ continue;
+ }
+ LLRect widget_rect(widget->getRect());
+ widget_rect.setLeftTopAndSize(widget_left, widget_rect.mTop, widget_rect.getWidth(), widget_rect.getHeight());
+ widget->setShape(widget_rect);
+
+ widget_left += widget_rect.getWidth() + getWidgetSpacing();
+ mLeftWidgetsWidth = widget_rect.mRight;
+ }
}
void LLPanelInventoryListItemBase::reshapeRightWidgets()
{
- S32 widget_right = getLocalRect().getWidth();
- S32 widget_left = widget_right;
-
- widget_array_t::const_reverse_iterator it = mRightSideWidgets.rbegin();
- const widget_array_t::const_reverse_iterator it_end = mRightSideWidgets.rend();
- for( ; it_end != it; ++it)
- {
- LLUICtrl* widget = *it;
- if(!widget->getVisible())
- {
- continue;
- }
- LLRect widget_rect(widget->getRect());
- widget_left = widget_right - widget_rect.getWidth();
- widget_rect.setLeftTopAndSize(widget_left, widget_rect.mTop, widget_rect.getWidth(), widget_rect.getHeight());
- widget->setShape(widget_rect);
-
- widget_right = widget_left - getWidgetSpacing();
- }
- mRightWidgetsWidth = getLocalRect().getWidth() - widget_left;
+ S32 widget_right = getLocalRect().getWidth();
+ S32 widget_left = widget_right;
+
+ widget_array_t::const_reverse_iterator it = mRightSideWidgets.rbegin();
+ const widget_array_t::const_reverse_iterator it_end = mRightSideWidgets.rend();
+ for( ; it_end != it; ++it)
+ {
+ LLUICtrl* widget = *it;
+ if(!widget->getVisible())
+ {
+ continue;
+ }
+ LLRect widget_rect(widget->getRect());
+ widget_left = widget_right - widget_rect.getWidth();
+ widget_rect.setLeftTopAndSize(widget_left, widget_rect.mTop, widget_rect.getWidth(), widget_rect.getHeight());
+ widget->setShape(widget_rect);
+
+ widget_right = widget_left - getWidgetSpacing();
+ }
+ mRightWidgetsWidth = getLocalRect().getWidth() - widget_left;
}
void LLPanelInventoryListItemBase::reshapeMiddleWidgets()
{
- LLRect icon_rect(mIconCtrl->getRect());
- icon_rect.setLeftTopAndSize(mLeftWidgetsWidth + getWidgetSpacing(), icon_rect.mTop,
- icon_rect.getWidth(), icon_rect.getHeight());
- mIconCtrl->setShape(icon_rect);
-
- S32 name_left = icon_rect.mRight + getWidgetSpacing();
- S32 name_right = getLocalRect().getWidth() - mRightWidgetsWidth - getWidgetSpacing();
- LLRect name_rect(mTitleCtrl->getRect());
- name_rect.set(name_left, name_rect.mTop, name_right, name_rect.mBottom);
- mTitleCtrl->setShape(name_rect);
+ LLRect icon_rect(mIconCtrl->getRect());
+ icon_rect.setLeftTopAndSize(mLeftWidgetsWidth + getWidgetSpacing(), icon_rect.mTop,
+ icon_rect.getWidth(), icon_rect.getHeight());
+ mIconCtrl->setShape(icon_rect);
+
+ S32 name_left = icon_rect.mRight + getWidgetSpacing();
+ S32 name_right = getLocalRect().getWidth() - mRightWidgetsWidth - getWidgetSpacing();
+ LLRect name_rect(mTitleCtrl->getRect());
+ name_rect.set(name_left, name_rect.mTop, name_right, name_rect.mBottom);
+ mTitleCtrl->setShape(name_rect);
}
// EOF
diff --git a/indra/newview/llinventorylistitem.h b/indra/newview/llinventorylistitem.h
index cf713a6930..0d10e26633 100644
--- a/indra/newview/llinventorylistitem.h
+++ b/indra/newview/llinventorylistitem.h
@@ -8,21 +8,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,7 +49,7 @@ class LLViewerInventoryItem;
*
* Base class for Inventory flat list item. Panel consists of inventory icon
* and inventory item name.
- * This class is able to display widgets(buttons) on left(before icon) and right(after text-box) sides
+ * This class is able to display widgets(buttons) on left(before icon) and right(after text-box) sides
* of panel.
*
* How to use (see LLPanelClothingListItem for example):
@@ -61,179 +61,179 @@ class LLViewerInventoryItem;
class LLPanelInventoryListItemBase : public LLPanel
{
public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {
- Optional<LLStyle::Params> default_style,
- worn_style;
- Optional<LLUIImage*> hover_image,
- selected_image,
- separator_image;
- Optional<LLIconCtrl::Params> item_icon;
- Optional<LLTextBox::Params> item_name;
- Params();
- };
-
- typedef enum e_item_state {
- IS_DEFAULT,
- IS_WORN,
- } EItemState;
-
- static LLPanelInventoryListItemBase* create(LLViewerInventoryItem* item);
-
- virtual void draw();
-
- /**
- * Let item know it need to be refreshed in next draw()
- */
- void setNeedsRefresh(bool needs_refresh){ mNeedsRefresh = needs_refresh; }
-
- bool getNeedsRefresh(){ return mNeedsRefresh; }
-
- /**
- * Add widget to left side
- */
- void addWidgetToLeftSide(const std::string& name, bool show_widget = true);
- void addWidgetToLeftSide(LLUICtrl* ctrl, bool show_widget = true);
-
- /**
- * Add widget to right side, widget is supposed to be child of calling panel
- */
- void addWidgetToRightSide(const std::string& name, bool show_widget = true);
- void addWidgetToRightSide(LLUICtrl* ctrl, bool show_widget = true);
-
- /**
- * Mark widgets as visible. Only visible widgets take part in reshaping children
- */
- void setShowWidget(const std::string& name, bool show);
- void setShowWidget(LLUICtrl* ctrl, bool show);
-
- /**
- * Set spacing between widgets during reshape
- */
- void setWidgetSpacing(S32 spacing) { mWidgetSpacing = spacing; }
-
- S32 getWidgetSpacing() { return mWidgetSpacing; }
-
- /**
- * Inheritors need to call base implementation of postBuild()
- */
- /*virtual*/ BOOL postBuild();
-
- /**
- * Handles item selection
- */
- /*virtual*/ void setValue(const LLSD& value);
-
- /**
- * Handles filter request
- */
- /*virtual*/ S32 notify(const LLSD& info);
-
- /* Highlights item */
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /* Removes item highlight */
- /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
-
- /** Get the name of a corresponding inventory item */
- const std::string& getItemName() const;
-
- /** Get the asset type of a corresponding inventory item */
- LLAssetType::EType getType() const;
-
- /** Get the wearable type of a corresponding inventory item */
- LLWearableType::EType getWearableType() const;
-
- /** Get the description of a corresponding inventory item */
- const std::string& getDescription() const;
-
- /** Get the creation date of a corresponding inventory item */
- time_t getCreationDate() const;
-
- /** Get the associated inventory item */
- LLViewerInventoryItem* getItem() const;
-
- void setSeparatorVisible(bool visible) { mSeparatorVisible = visible; }
- void resetHighlight() { mHovered = FALSE; }
-
- virtual ~LLPanelInventoryListItemBase(){}
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<LLStyle::Params> default_style,
+ worn_style;
+ Optional<LLUIImage*> hover_image,
+ selected_image,
+ separator_image;
+ Optional<LLIconCtrl::Params> item_icon;
+ Optional<LLTextBox::Params> item_name;
+ Params();
+ };
+
+ typedef enum e_item_state {
+ IS_DEFAULT,
+ IS_WORN,
+ } EItemState;
+
+ static LLPanelInventoryListItemBase* create(LLViewerInventoryItem* item);
+
+ virtual void draw();
+
+ /**
+ * Let item know it need to be refreshed in next draw()
+ */
+ void setNeedsRefresh(bool needs_refresh){ mNeedsRefresh = needs_refresh; }
+
+ bool getNeedsRefresh(){ return mNeedsRefresh; }
+
+ /**
+ * Add widget to left side
+ */
+ void addWidgetToLeftSide(const std::string& name, bool show_widget = true);
+ void addWidgetToLeftSide(LLUICtrl* ctrl, bool show_widget = true);
+
+ /**
+ * Add widget to right side, widget is supposed to be child of calling panel
+ */
+ void addWidgetToRightSide(const std::string& name, bool show_widget = true);
+ void addWidgetToRightSide(LLUICtrl* ctrl, bool show_widget = true);
+
+ /**
+ * Mark widgets as visible. Only visible widgets take part in reshaping children
+ */
+ void setShowWidget(const std::string& name, bool show);
+ void setShowWidget(LLUICtrl* ctrl, bool show);
+
+ /**
+ * Set spacing between widgets during reshape
+ */
+ void setWidgetSpacing(S32 spacing) { mWidgetSpacing = spacing; }
+
+ S32 getWidgetSpacing() { return mWidgetSpacing; }
+
+ /**
+ * Inheritors need to call base implementation of postBuild()
+ */
+ /*virtual*/ BOOL postBuild();
+
+ /**
+ * Handles item selection
+ */
+ /*virtual*/ void setValue(const LLSD& value);
+
+ /**
+ * Handles filter request
+ */
+ /*virtual*/ S32 notify(const LLSD& info);
+
+ /* Highlights item */
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /* Removes item highlight */
+ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
+
+ /** Get the name of a corresponding inventory item */
+ const std::string& getItemName() const;
+
+ /** Get the asset type of a corresponding inventory item */
+ LLAssetType::EType getType() const;
+
+ /** Get the wearable type of a corresponding inventory item */
+ LLWearableType::EType getWearableType() const;
+
+ /** Get the description of a corresponding inventory item */
+ const std::string& getDescription() const;
+
+ /** Get the creation date of a corresponding inventory item */
+ time_t getCreationDate() const;
+
+ /** Get the associated inventory item */
+ LLViewerInventoryItem* getItem() const;
+
+ void setSeparatorVisible(bool visible) { mSeparatorVisible = visible; }
+ void resetHighlight() { mHovered = FALSE; }
+
+ virtual ~LLPanelInventoryListItemBase(){}
protected:
- LLPanelInventoryListItemBase(LLViewerInventoryItem* item, const Params& params);
+ LLPanelInventoryListItemBase(LLViewerInventoryItem* item, const Params& params);
- typedef std::vector<LLUICtrl*> widget_array_t;
+ typedef std::vector<LLUICtrl*> widget_array_t;
- /**
- * Called after inventory item was updated, update panel widgets to reflect inventory changes.
- */
- virtual void updateItem(const std::string& name,
- EItemState item_state = IS_DEFAULT);
+ /**
+ * Called after inventory item was updated, update panel widgets to reflect inventory changes.
+ */
+ virtual void updateItem(const std::string& name,
+ EItemState item_state = IS_DEFAULT);
- void setLeftWidgetsWidth(S32 width) { mLeftWidgetsWidth = width; }
- void setRightWidgetsWidth(S32 width) { mRightWidgetsWidth = width; }
+ void setLeftWidgetsWidth(S32 width) { mLeftWidgetsWidth = width; }
+ void setRightWidgetsWidth(S32 width) { mRightWidgetsWidth = width; }
- /**
- * Set all widgets from both side visible/invisible. Only enabled widgets
- * (see setShowWidget()) can become visible
- */
- virtual void setWidgetsVisible(bool visible);
+ /**
+ * Set all widgets from both side visible/invisible. Only enabled widgets
+ * (see setShowWidget()) can become visible
+ */
+ virtual void setWidgetsVisible(bool visible);
- /**
- * Reshape all child widgets - icon, text-box and side widgets
- */
- virtual void reshapeWidgets();
+ /**
+ * Reshape all child widgets - icon, text-box and side widgets
+ */
+ virtual void reshapeWidgets();
- /** set wearable type icon image */
- void setIconImage(const LLUIImagePtr& image);
+ /** set wearable type icon image */
+ void setIconImage(const LLUIImagePtr& image);
- /** Set item title - inventory item name usually */
- void setTitle(const std::string& title,
- const std::string& highlit_text,
- EItemState item_state = IS_DEFAULT);
+ /** Set item title - inventory item name usually */
+ void setTitle(const std::string& title,
+ const std::string& highlit_text,
+ EItemState item_state = IS_DEFAULT);
- /**
- * Show tool tip if item name text size > panel size
- */
- virtual BOOL handleToolTip( S32 x, S32 y, MASK mask);
+ /**
+ * Show tool tip if item name text size > panel size
+ */
+ virtual BOOL handleToolTip( S32 x, S32 y, MASK mask);
- const LLUUID mInventoryItemUUID;
+ const LLUUID mInventoryItemUUID;
bool mHovered;
private:
- /** reshape left side widgets
- * Deprecated for now. Disabled reshape left for now to reserve space for 'delete'
- * button in LLPanelClothingListItem according to Neal's comment (https://codereview.productengine.com/secondlife/r/325/)
- */
- void reshapeLeftWidgets();
+ /** reshape left side widgets
+ * Deprecated for now. Disabled reshape left for now to reserve space for 'delete'
+ * button in LLPanelClothingListItem according to Neal's comment (https://codereview.productengine.com/secondlife/r/325/)
+ */
+ void reshapeLeftWidgets();
- /** reshape right side widgets */
- void reshapeRightWidgets();
+ /** reshape right side widgets */
+ void reshapeRightWidgets();
- /** reshape remaining widgets */
- void reshapeMiddleWidgets();
+ /** reshape remaining widgets */
+ void reshapeMiddleWidgets();
- LLIconCtrl* mIconCtrl;
- LLTextBox* mTitleCtrl;
+ LLIconCtrl* mIconCtrl;
+ LLTextBox* mTitleCtrl;
- LLUIImagePtr mIconImage;
- LLUIImagePtr mHoverImage;
- LLUIImagePtr mSelectedImage;
- LLUIImagePtr mSeparatorImage;
+ LLUIImagePtr mIconImage;
+ LLUIImagePtr mHoverImage;
+ LLUIImagePtr mSelectedImage;
+ LLUIImagePtr mSeparatorImage;
- bool mSelected;
- bool mSeparatorVisible;
+ bool mSelected;
+ bool mSeparatorVisible;
- std::string mHighlightedText;
+ std::string mHighlightedText;
- widget_array_t mLeftSideWidgets;
- widget_array_t mRightSideWidgets;
- S32 mWidgetSpacing;
+ widget_array_t mLeftSideWidgets;
+ widget_array_t mRightSideWidgets;
+ S32 mWidgetSpacing;
- S32 mLeftWidgetsWidth;
- S32 mRightWidgetsWidth;
- bool mNeedsRefresh;
+ S32 mLeftWidgetsWidth;
+ S32 mRightWidgetsWidth;
+ bool mNeedsRefresh;
};
#endif //LL_LLINVENTORYLISTITEM_H
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 205e5f3489..0787266adb 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventorymodel.cpp
* @brief Implementation of the inventory model used to track agent inventory.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,7 +50,7 @@
#include "llwindow.h"
#include "llviewercontrol.h"
#include "llviewernetwork.h"
-#include "llpreview.h"
+#include "llpreview.h"
#include "llviewergenericmessage.h"
#include "llviewermessage.h"
#include "llviewerfoldertype.h"
@@ -94,49 +94,49 @@ static const char * const LOG_INV("Inventory");
struct InventoryIDPtrLess
{
- bool operator()(const LLViewerInventoryCategory* i1, const LLViewerInventoryCategory* i2) const
- {
- return (i1->getUUID() < i2->getUUID());
- }
+ bool operator()(const LLViewerInventoryCategory* i1, const LLViewerInventoryCategory* i2) const
+ {
+ return (i1->getUUID() < i2->getUUID());
+ }
};
-class LLCanCache : public LLInventoryCollectFunctor
+class LLCanCache : public LLInventoryCollectFunctor
{
public:
- LLCanCache(LLInventoryModel* model) : mModel(model) {}
- virtual ~LLCanCache() {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+ LLCanCache(LLInventoryModel* model) : mModel(model) {}
+ virtual ~LLCanCache() {}
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
protected:
- LLInventoryModel* mModel;
- std::set<LLUUID> mCachedCatIDs;
+ LLInventoryModel* mModel;
+ std::set<LLUUID> mCachedCatIDs;
};
bool LLCanCache::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
- bool rv = false;
- if(item)
- {
- if(mCachedCatIDs.find(item->getParentUUID()) != mCachedCatIDs.end())
- {
- rv = true;
- }
- }
- else if(cat)
- {
- // HACK: downcast
- LLViewerInventoryCategory* c = (LLViewerInventoryCategory*)cat;
- if(c->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN)
- {
- S32 descendents_server = c->getDescendentCount();
- S32 descendents_actual = c->getViewerDescendentCount();
- if(descendents_server == descendents_actual)
- {
- mCachedCatIDs.insert(c->getUUID());
- rv = true;
- }
- }
- }
- return rv;
+ bool rv = false;
+ if(item)
+ {
+ if(mCachedCatIDs.find(item->getParentUUID()) != mCachedCatIDs.end())
+ {
+ rv = true;
+ }
+ }
+ else if(cat)
+ {
+ // HACK: downcast
+ LLViewerInventoryCategory* c = (LLViewerInventoryCategory*)cat;
+ if(c->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN)
+ {
+ S32 descendents_server = c->getDescendentCount();
+ S32 descendents_actual = c->getViewerDescendentCount();
+ if(descendents_server == descendents_actual)
+ {
+ mCachedCatIDs.insert(c->getUUID());
+ rv = true;
+ }
+ }
+ }
+ return rv;
}
struct InventoryCallbackInfo
@@ -364,7 +364,7 @@ LLInventoryValidationInfo::LLInventoryValidationInfo()
void LLInventoryValidationInfo::toOstream(std::ostream& os) const
{
- os << "mFatalErrorCount " << mFatalErrorCount
+ os << "mFatalErrorCount " << mFatalErrorCount
<< " mWarningCount " << mWarningCount
<< " mLoopCount " << mLoopCount
<< " mOrphanedCount " << mOrphanedCount;
@@ -373,52 +373,52 @@ void LLInventoryValidationInfo::toOstream(std::ostream& os) const
std::ostream& operator<<(std::ostream& os, const LLInventoryValidationInfo& v)
{
- v.toOstream(os);
- return os;
+ v.toOstream(os);
+ return os;
}
void LLInventoryValidationInfo::asLLSD(LLSD& sd) const
{
- sd["fatal_error_count"] = mFatalErrorCount;
+ sd["fatal_error_count"] = mFatalErrorCount;
sd["loop_count"] = mLoopCount;
sd["orphaned_count"] = mOrphanedCount;
- sd["initialized"] = mInitialized;
- sd["missing_system_folders_count"] = LLSD::Integer(mMissingRequiredSystemFolders.size());
- sd["fatal_no_root_folder"] = mFatalNoRootFolder;
- sd["fatal_no_library_root_folder"] = mFatalNoLibraryRootFolder;
- sd["fatal_qa_debug_mode"] = mFatalQADebugMode;
-
- sd["warning_count"] = mWarningCount;
- if (mWarningCount>0)
- {
- sd["warnings"] = LLSD::emptyArray();
- for (auto const& it : mWarnings)
- {
- S32 val =LLSD::Integer(it.second);
- if (val>0)
- {
- sd["warnings"][it.first] = val;
- }
- }
- }
- if (mMissingRequiredSystemFolders.size()>0)
- {
- sd["missing_system_folders"] = LLSD::emptyArray();
- for(auto ft: mMissingRequiredSystemFolders)
- {
- sd["missing_system_folders"].append(LLFolderType::lookup(ft));
- }
- }
- sd["duplicate_system_folders_count"] = LLSD::Integer(mDuplicateRequiredSystemFolders.size());
- if (mDuplicateRequiredSystemFolders.size()>0)
- {
- sd["duplicate_system_folders"] = LLSD::emptyArray();
- for(auto ft: mDuplicateRequiredSystemFolders)
- {
- sd["duplicate_system_folders"].append(LLFolderType::lookup(ft));
- }
- }
-
+ sd["initialized"] = mInitialized;
+ sd["missing_system_folders_count"] = LLSD::Integer(mMissingRequiredSystemFolders.size());
+ sd["fatal_no_root_folder"] = mFatalNoRootFolder;
+ sd["fatal_no_library_root_folder"] = mFatalNoLibraryRootFolder;
+ sd["fatal_qa_debug_mode"] = mFatalQADebugMode;
+
+ sd["warning_count"] = mWarningCount;
+ if (mWarningCount>0)
+ {
+ sd["warnings"] = LLSD::emptyArray();
+ for (auto const& it : mWarnings)
+ {
+ S32 val =LLSD::Integer(it.second);
+ if (val>0)
+ {
+ sd["warnings"][it.first] = val;
+ }
+ }
+ }
+ if (mMissingRequiredSystemFolders.size()>0)
+ {
+ sd["missing_system_folders"] = LLSD::emptyArray();
+ for(auto ft: mMissingRequiredSystemFolders)
+ {
+ sd["missing_system_folders"].append(LLFolderType::lookup(ft));
+ }
+ }
+ sd["duplicate_system_folders_count"] = LLSD::Integer(mDuplicateRequiredSystemFolders.size());
+ if (mDuplicateRequiredSystemFolders.size()>0)
+ {
+ sd["duplicate_system_folders"] = LLSD::emptyArray();
+ for(auto ft: mDuplicateRequiredSystemFolders)
+ {
+ sd["duplicate_system_folders"].append(LLFolderType::lookup(ft));
+ }
+ }
+
}
///----------------------------------------------------------------------------
@@ -431,117 +431,117 @@ LLInventoryModel gInventory;
// Default constructor
LLInventoryModel::LLInventoryModel()
: // These are now ordered, keep them that way.
- mBacklinkMMap(),
- mIsAgentInvUsable(false),
- mRootFolderID(),
- mLibraryRootFolderID(),
- mLibraryOwnerID(),
- mCategoryMap(),
- mItemMap(),
- mParentChildCategoryTree(),
- mParentChildItemTree(),
- mLastItem(NULL),
- mIsNotifyObservers(FALSE),
- mModifyMask(LLInventoryObserver::ALL),
- mChangedItemIDs(),
+ mBacklinkMMap(),
+ mIsAgentInvUsable(false),
+ mRootFolderID(),
+ mLibraryRootFolderID(),
+ mLibraryOwnerID(),
+ mCategoryMap(),
+ mItemMap(),
+ mParentChildCategoryTree(),
+ mParentChildItemTree(),
+ mLastItem(NULL),
+ mIsNotifyObservers(FALSE),
+ mModifyMask(LLInventoryObserver::ALL),
+ mChangedItemIDs(),
mBulkFecthCallbackSlot(),
- mObservers(),
- mHttpRequestFG(NULL),
- mHttpRequestBG(NULL),
- mHttpOptions(),
- mHttpHeaders(),
- mHttpPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
- mCategoryLock(),
- mItemLock(),
- mValidationInfo(new LLInventoryValidationInfo)
+ mObservers(),
+ mHttpRequestFG(NULL),
+ mHttpRequestBG(NULL),
+ mHttpOptions(),
+ mHttpHeaders(),
+ mHttpPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
+ mCategoryLock(),
+ mItemLock(),
+ mValidationInfo(new LLInventoryValidationInfo)
{}
// Destroys the object
LLInventoryModel::~LLInventoryModel()
{
- cleanupInventory();
+ cleanupInventory();
}
void LLInventoryModel::cleanupInventory()
{
- empty();
- // Deleting one observer might erase others from the list, so always pop off the front
- while (!mObservers.empty())
- {
- observer_list_t::iterator iter = mObservers.begin();
- LLInventoryObserver* observer = *iter;
- mObservers.erase(iter);
- delete observer;
- }
+ empty();
+ // Deleting one observer might erase others from the list, so always pop off the front
+ while (!mObservers.empty())
+ {
+ observer_list_t::iterator iter = mObservers.begin();
+ LLInventoryObserver* observer = *iter;
+ mObservers.erase(iter);
+ delete observer;
+ }
if (mBulkFecthCallbackSlot.connected())
{
mBulkFecthCallbackSlot.disconnect();
}
- mObservers.clear();
+ mObservers.clear();
- // Run down HTTP transport
+ // Run down HTTP transport
mHttpHeaders.reset();
mHttpOptions.reset();
- delete mHttpRequestFG;
- mHttpRequestFG = NULL;
- delete mHttpRequestBG;
- mHttpRequestBG = NULL;
+ delete mHttpRequestFG;
+ mHttpRequestFG = NULL;
+ delete mHttpRequestBG;
+ mHttpRequestBG = NULL;
}
// This is a convenience function to check if one object has a parent
// chain up to the category specified by UUID.
BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id,
- const LLUUID& cat_id) const
+ const LLUUID& cat_id) const
{
- if (obj_id == cat_id) return TRUE;
-
- const LLInventoryObject* obj = getObject(obj_id);
- while(obj)
- {
- const LLUUID& parent_id = obj->getParentUUID();
- if( parent_id.isNull() )
- {
- return FALSE;
- }
- if(parent_id == cat_id)
- {
- return TRUE;
- }
- // Since we're scanning up the parents, we only need to check
- // in the category list.
- obj = getCategory(parent_id);
- }
- return FALSE;
+ if (obj_id == cat_id) return TRUE;
+
+ const LLInventoryObject* obj = getObject(obj_id);
+ while(obj)
+ {
+ const LLUUID& parent_id = obj->getParentUUID();
+ if( parent_id.isNull() )
+ {
+ return FALSE;
+ }
+ if(parent_id == cat_id)
+ {
+ return TRUE;
+ }
+ // Since we're scanning up the parents, we only need to check
+ // in the category list.
+ obj = getCategory(parent_id);
+ }
+ return FALSE;
}
const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(const LLUUID& obj_id) const
{
- const LLInventoryObject* obj = getObject(obj_id);
- if(!obj)
- {
- LL_WARNS(LOG_INV) << "Non-existent object [ id: " << obj_id << " ] " << LL_ENDL;
- return NULL;
- }
- // Search up the parent chain until we get to root or an acceptable folder.
- // This assumes there are no cycles in the tree else we'll get a hang.
- LLUUID parent_id = obj->getParentUUID();
- while (!parent_id.isNull())
- {
- const LLViewerInventoryCategory *cat = getCategory(parent_id);
- if (!cat) break;
- const LLFolderType::EType folder_type = cat->getPreferredType();
- if (folder_type != LLFolderType::FT_NONE &&
- folder_type != LLFolderType::FT_ROOT_INVENTORY &&
- !LLFolderType::lookupIsEnsembleType(folder_type))
- {
- return cat;
- }
- parent_id = cat->getParentUUID();
- }
- return NULL;
+ const LLInventoryObject* obj = getObject(obj_id);
+ if(!obj)
+ {
+ LL_WARNS(LOG_INV) << "Non-existent object [ id: " << obj_id << " ] " << LL_ENDL;
+ return NULL;
+ }
+ // Search up the parent chain until we get to root or an acceptable folder.
+ // This assumes there are no cycles in the tree else we'll get a hang.
+ LLUUID parent_id = obj->getParentUUID();
+ while (!parent_id.isNull())
+ {
+ const LLViewerInventoryCategory *cat = getCategory(parent_id);
+ if (!cat) break;
+ const LLFolderType::EType folder_type = cat->getPreferredType();
+ if (folder_type != LLFolderType::FT_NONE &&
+ folder_type != LLFolderType::FT_ROOT_INVENTORY &&
+ !LLFolderType::lookupIsEnsembleType(folder_type))
+ {
+ return cat;
+ }
+ parent_id = cat->getParentUUID();
+ }
+ return NULL;
}
//
@@ -549,36 +549,36 @@ const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(cons
//
const LLViewerInventoryCategory* LLInventoryModel::getFirstDescendantOf(const LLUUID& master_parent_id, const LLUUID& obj_id) const
{
- if (master_parent_id == obj_id)
- {
- return NULL;
- }
-
- const LLViewerInventoryCategory* current_cat = getCategory(obj_id);
-
- if (current_cat == NULL)
- {
- current_cat = getCategory(getObject(obj_id)->getParentUUID());
- }
-
- while (current_cat != NULL)
- {
- const LLUUID& current_parent_id = current_cat->getParentUUID();
-
- if (current_parent_id == master_parent_id)
- {
- return current_cat;
- }
-
- current_cat = getCategory(current_parent_id);
- }
-
- return NULL;
+ if (master_parent_id == obj_id)
+ {
+ return NULL;
+ }
+
+ const LLViewerInventoryCategory* current_cat = getCategory(obj_id);
+
+ if (current_cat == NULL)
+ {
+ current_cat = getCategory(getObject(obj_id)->getParentUUID());
+ }
+
+ while (current_cat != NULL)
+ {
+ const LLUUID& current_parent_id = current_cat->getParentUUID();
+
+ if (current_parent_id == master_parent_id)
+ {
+ return current_cat;
+ }
+
+ current_cat = getCategory(current_parent_id);
+ }
+
+ return NULL;
}
LLInventoryModel::EAncestorResult LLInventoryModel::getObjectTopmostAncestor(const LLUUID& object_id, LLUUID& result) const
{
- LLInventoryObject *object = getObject(object_id);
+ LLInventoryObject *object = getObject(object_id);
if (!object)
{
LL_WARNS(LOG_INV) << "Unable to trace topmost ancestor, initial object " << object_id << " does not exist" << LL_ENDL;
@@ -596,73 +596,73 @@ LLInventoryModel::EAncestorResult LLInventoryModel::getObjectTopmostAncestor(con
}
object_ids.insert(parent_id);
LLInventoryObject *parent_object = getObject(parent_id);
- if (!parent_object)
- {
- LL_WARNS(LOG_INV) << "unable to trace topmost ancestor of " << object_id << ", missing item for uuid " << parent_id << LL_ENDL;
- return ANCESTOR_MISSING;
- }
- object = parent_object;
- }
- result = object->getUUID();
- return ANCESTOR_OK;
+ if (!parent_object)
+ {
+ LL_WARNS(LOG_INV) << "unable to trace topmost ancestor of " << object_id << ", missing item for uuid " << parent_id << LL_ENDL;
+ return ANCESTOR_MISSING;
+ }
+ object = parent_object;
+ }
+ result = object->getUUID();
+ return ANCESTOR_OK;
}
// Get the object by id. Returns NULL if not found.
LLInventoryObject* LLInventoryModel::getObject(const LLUUID& id) const
{
- LLViewerInventoryCategory* cat = getCategory(id);
- if (cat)
- {
- return cat;
- }
- LLViewerInventoryItem* item = getItem(id);
- if (item)
- {
- return item;
- }
- return NULL;
+ LLViewerInventoryCategory* cat = getCategory(id);
+ if (cat)
+ {
+ return cat;
+ }
+ LLViewerInventoryItem* item = getItem(id);
+ if (item)
+ {
+ return item;
+ }
+ return NULL;
}
// Get the item by id. Returns NULL if not found.
LLViewerInventoryItem* LLInventoryModel::getItem(const LLUUID& id) const
{
- LLViewerInventoryItem* item = NULL;
- if(mLastItem.notNull() && mLastItem->getUUID() == id)
- {
- item = mLastItem;
- }
- else
- {
- item_map_t::const_iterator iter = mItemMap.find(id);
- if (iter != mItemMap.end())
- {
- item = iter->second;
- mLastItem = item;
- }
- }
- return item;
+ LLViewerInventoryItem* item = NULL;
+ if(mLastItem.notNull() && mLastItem->getUUID() == id)
+ {
+ item = mLastItem;
+ }
+ else
+ {
+ item_map_t::const_iterator iter = mItemMap.find(id);
+ if (iter != mItemMap.end())
+ {
+ item = iter->second;
+ mLastItem = item;
+ }
+ }
+ return item;
}
// Get the category by id. Returns NULL if not found
LLViewerInventoryCategory* LLInventoryModel::getCategory(const LLUUID& id) const
{
- LLViewerInventoryCategory* category = NULL;
- cat_map_t::const_iterator iter = mCategoryMap.find(id);
- if (iter != mCategoryMap.end())
- {
- category = iter->second;
- }
- return category;
+ LLViewerInventoryCategory* category = NULL;
+ cat_map_t::const_iterator iter = mCategoryMap.find(id);
+ if (iter != mCategoryMap.end())
+ {
+ category = iter->second;
+ }
+ return category;
}
S32 LLInventoryModel::getItemCount() const
{
- return mItemMap.size();
+ return mItemMap.size();
}
S32 LLInventoryModel::getCategoryCount() const
{
- return mCategoryMap.size();
+ return mCategoryMap.size();
}
// Return the direct descendents of the id provided. The array
@@ -671,11 +671,11 @@ S32 LLInventoryModel::getCategoryCount() const
// may invalidate the internal state of the inventory. Set passed
// in values to NULL if the call fails.
void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id,
- cat_array_t*& categories,
- item_array_t*& items) const
+ cat_array_t*& categories,
+ item_array_t*& items) const
{
- categories = get_ptr_in_map(mParentChildCategoryTree, cat_id);
- items = get_ptr_in_map(mParentChildItemTree, cat_id);
+ categories = get_ptr_in_map(mParentChildCategoryTree, cat_id);
+ items = get_ptr_in_map(mParentChildItemTree, cat_id);
}
void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id, cat_array_t& categories, item_array_t& items, LLInventoryCollectFunctor& f) const
@@ -684,10 +684,10 @@ void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id, cat_array_t&
{
for (LLViewerInventoryCategory* pFolder : *categoriesp)
{
- if (f(pFolder, nullptr))
- {
- categories.push_back(pFolder);
- }
+ if (f(pFolder, nullptr))
+ {
+ categories.push_back(pFolder);
+ }
}
}
@@ -695,56 +695,56 @@ void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id, cat_array_t&
{
for (LLViewerInventoryItem* pItem : *itemsp)
{
- if (f(nullptr, pItem))
- {
- items.push_back(pItem);
- }
+ if (f(nullptr, pItem))
+ {
+ items.push_back(pItem);
+ }
}
}
}
LLInventoryModel::digest_t LLInventoryModel::hashDirectDescendentNames(const LLUUID& cat_id) const
{
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- getDirectDescendentsOf(cat_id,cat_array,item_array);
- if (!item_array)
- {
- return LLUUID::null;
- }
- HBXXH128 item_name_hash;
- for (LLInventoryModel::item_array_t::const_iterator iter = item_array->begin();
- iter != item_array->end();
- iter++)
- {
- const LLViewerInventoryItem *item = (*iter);
- if (!item)
- continue;
- item_name_hash.update(item->getName());
- }
- return item_name_hash.digest();
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ getDirectDescendentsOf(cat_id,cat_array,item_array);
+ if (!item_array)
+ {
+ return LLUUID::null;
+ }
+ HBXXH128 item_name_hash;
+ for (LLInventoryModel::item_array_t::const_iterator iter = item_array->begin();
+ iter != item_array->end();
+ iter++)
+ {
+ const LLViewerInventoryItem *item = (*iter);
+ if (!item)
+ continue;
+ item_name_hash.update(item->getName());
+ }
+ return item_name_hash.digest();
}
// SJB: Added version to lock the arrays to catch potential logic bugs
void LLInventoryModel::lockDirectDescendentArrays(const LLUUID& cat_id,
- cat_array_t*& categories,
- item_array_t*& items)
+ cat_array_t*& categories,
+ item_array_t*& items)
{
- getDirectDescendentsOf(cat_id, categories, items);
- if (categories)
- {
- mCategoryLock[cat_id] = true;
- }
- if (items)
- {
- mItemLock[cat_id] = true;
- }
+ getDirectDescendentsOf(cat_id, categories, items);
+ if (categories)
+ {
+ mCategoryLock[cat_id] = true;
+ }
+ if (items)
+ {
+ mItemLock[cat_id] = true;
+ }
}
void LLInventoryModel::unlockDirectDescendentArrays(const LLUUID& cat_id)
{
- mCategoryLock[cat_id] = false;
- mItemLock[cat_id] = false;
+ mCategoryLock[cat_id] = false;
+ mItemLock[cat_id] = false;
}
void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::EType type)
@@ -761,15 +761,15 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E
}
// Iterate through those folders
- for (std::vector<LLUUID>::iterator folder_ids_it = folder_ids.begin(); folder_ids_it != folder_ids.end(); ++folder_ids_it)
- {
- LLUUID folder_id = (*folder_ids_it);
-
+ for (std::vector<LLUUID>::iterator folder_ids_it = folder_ids.begin(); folder_ids_it != folder_ids.end(); ++folder_ids_it)
+ {
+ LLUUID folder_id = (*folder_ids_it);
+
// Get the content of this folder
cat_array_t* cats;
item_array_t* items;
getDirectDescendentsOf(folder_id, cats, items);
-
+
// Move all items to the main folder
// Note : we get the list of UUIDs and iterate on them instead of iterating directly on item_array_t
// elements. This is because moving elements modify the maps and, consequently, invalidate iterators on them.
@@ -809,7 +809,7 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E
}
}
remove_inventory_category(folder_id, NULL);
- }
+ }
}
void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred_type)
@@ -881,49 +881,49 @@ void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred
}
const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot(
- LLFolderType::EType preferred_type,
- const LLUUID& root_id) const
+ LLFolderType::EType preferred_type,
+ const LLUUID& root_id) const
{
- LLUUID rv = LLUUID::null;
- if(LLFolderType::FT_ROOT_INVENTORY == preferred_type)
- {
- rv = root_id;
- }
- else if (root_id.notNull())
- {
- cat_array_t* cats = NULL;
- cats = get_ptr_in_map(mParentChildCategoryTree, root_id);
- if(cats)
- {
- S32 count = cats->size();
- for(S32 i = 0; i < count; ++i)
- {
- LLViewerInventoryCategory* p_cat = cats->at(i);
- if(p_cat && p_cat->getPreferredType() == preferred_type)
- {
- const LLUUID& folder_id = cats->at(i)->getUUID();
- if (rv.isNull() || folder_id < rv)
- {
- rv = folder_id;
- }
- }
- }
- }
- }
-
- if(rv.isNull()
+ LLUUID rv = LLUUID::null;
+ if(LLFolderType::FT_ROOT_INVENTORY == preferred_type)
+ {
+ rv = root_id;
+ }
+ else if (root_id.notNull())
+ {
+ cat_array_t* cats = NULL;
+ cats = get_ptr_in_map(mParentChildCategoryTree, root_id);
+ if(cats)
+ {
+ S32 count = cats->size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ LLViewerInventoryCategory* p_cat = cats->at(i);
+ if(p_cat && p_cat->getPreferredType() == preferred_type)
+ {
+ const LLUUID& folder_id = cats->at(i)->getUUID();
+ if (rv.isNull() || folder_id < rv)
+ {
+ rv = folder_id;
+ }
+ }
+ }
+ }
+ }
+
+ if(rv.isNull()
&& root_id.notNull()
&& preferred_type != LLFolderType::FT_MARKETPLACE_LISTINGS
&& preferred_type != LLFolderType::FT_OUTBOX)
- {
+ {
// if it does not exists, it should either be added
// to createCommonSystemCategories or server should
// have set it
llassert(!isInventoryUsable());
LL_WARNS("Inventory") << "Tried to find folder, type " << preferred_type
- << " but category does not exist" << LL_ENDL;
- }
- return rv;
+ << " but category does not exist" << LL_ENDL;
+ }
+ return rv;
}
// findCategoryUUIDForType() returns the uuid of the category that
@@ -932,7 +932,7 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot(
// inventory category on the fly if one does not exist.
const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type) const
{
- return findCategoryUUIDForTypeInRoot(preferred_type, gInventory.getRootFolderID());
+ return findCategoryUUIDForTypeInRoot(preferred_type, gInventory.getRootFolderID());
}
const LLUUID LLInventoryModel::findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type) const
@@ -968,7 +968,7 @@ const LLUUID LLInventoryModel::findUserDefinedCategoryUUIDForType(LLFolderType::
default:
break;
}
-
+
if (cat_id.isNull() || !getCategory(cat_id))
{
cat_id = findCategoryUUIDForTypeInRoot(preferred_type, getRootFolderID());
@@ -978,7 +978,7 @@ const LLUUID LLInventoryModel::findUserDefinedCategoryUUIDForType(LLFolderType::
const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::EType preferred_type) const
{
- return findCategoryUUIDForTypeInRoot(preferred_type, gInventory.getLibraryRootFolderID());
+ return findCategoryUUIDForTypeInRoot(preferred_type, gInventory.getLibraryRootFolderID());
}
// Convenience function to create a new category. You could call
@@ -986,56 +986,56 @@ const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::ETyp
// version will take care of details like what the name should be
// based on preferred type.
void LLInventoryModel::createNewCategory(const LLUUID& parent_id,
- LLFolderType::EType preferred_type,
- const std::string& pname,
- inventory_func_type callback,
- const LLUUID& thumbnail_id)
+ LLFolderType::EType preferred_type,
+ const std::string& pname,
+ inventory_func_type callback,
+ const LLUUID& thumbnail_id)
{
- LL_DEBUGS(LOG_INV) << "Create '" << pname << "' in '" << make_inventory_path(parent_id) << "'" << LL_ENDL;
- if (!isInventoryUsable())
- {
- LL_WARNS(LOG_INV) << "Inventory is not usable; can't create requested category of type "
- << preferred_type << LL_ENDL;
+ LL_DEBUGS(LOG_INV) << "Create '" << pname << "' in '" << make_inventory_path(parent_id) << "'" << LL_ENDL;
+ if (!isInventoryUsable())
+ {
+ LL_WARNS(LOG_INV) << "Inventory is not usable; can't create requested category of type "
+ << preferred_type << LL_ENDL;
if (callback)
{
callback(LLUUID::null);
}
- return;
- }
+ return;
+ }
- if(LLFolderType::lookup(preferred_type) == LLFolderType::badLookup())
- {
- LL_DEBUGS(LOG_INV) << "Attempt to create undefined category." << LL_ENDL;
+ if(LLFolderType::lookup(preferred_type) == LLFolderType::badLookup())
+ {
+ LL_DEBUGS(LOG_INV) << "Attempt to create undefined category." << LL_ENDL;
if (callback)
{
callback(LLUUID::null);
}
- return;
- }
-
- if (preferred_type != LLFolderType::FT_NONE)
- {
- // Ultimately this should only be done for non-singleton
- // types. Requires back-end changes to guarantee that others
- // already exist.
- LL_WARNS(LOG_INV) << "Creating new system folder, type " << preferred_type << LL_ENDL;
- }
-
- std::string name = pname;
- if (pname.empty())
- {
- name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type));
- }
-
- if (AISAPI::isAvailable())
- {
- LLSD new_inventory = LLSD::emptyMap();
- new_inventory["categories"] = LLSD::emptyArray();
- LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID());
+ return;
+ }
+
+ if (preferred_type != LLFolderType::FT_NONE)
+ {
+ // Ultimately this should only be done for non-singleton
+ // types. Requires back-end changes to guarantee that others
+ // already exist.
+ LL_WARNS(LOG_INV) << "Creating new system folder, type " << preferred_type << LL_ENDL;
+ }
+
+ std::string name = pname;
+ if (pname.empty())
+ {
+ name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type));
+ }
+
+ if (AISAPI::isAvailable())
+ {
+ LLSD new_inventory = LLSD::emptyMap();
+ new_inventory["categories"] = LLSD::emptyArray();
+ LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID());
cat.setThumbnailUUID(thumbnail_id);
- LLSD cat_sd = cat.asAISCreateCatLLSD();
- new_inventory["categories"].append(cat_sd);
- AISAPI::CreateInventory(
+ LLSD cat_sd = cat.asAISCreateCatLLSD();
+ new_inventory["categories"].append(cat_sd);
+ AISAPI::CreateInventory(
parent_id,
new_inventory,
[this, callback, parent_id, preferred_type, name] (const LLUUID& new_category)
@@ -1075,32 +1075,32 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id,
}
});
return;
- }
-
- LLViewerRegion* viewer_region = gAgent.getRegion();
- std::string url;
- if ( viewer_region )
- url = viewer_region->getCapability("CreateInventoryCategory");
-
- if (!url.empty())
- {
- //Let's use the new capability.
+ }
+
+ LLViewerRegion* viewer_region = gAgent.getRegion();
+ std::string url;
+ if ( viewer_region )
+ url = viewer_region->getCapability("CreateInventoryCategory");
+
+ if (!url.empty())
+ {
+ //Let's use the new capability.
LLUUID id;
- id.generate();
- LLSD request, body;
- body["folder_id"] = id;
- body["parent_id"] = parent_id;
- body["type"] = (LLSD::Integer) preferred_type;
- body["name"] = name;
-
- request["message"] = "CreateInventoryCategory";
- request["payload"] = body;
-
- LL_DEBUGS(LOG_INV) << "Creating category via request: " << ll_pretty_print_sd(request) << LL_ENDL;
+ id.generate();
+ LLSD request, body;
+ body["folder_id"] = id;
+ body["parent_id"] = parent_id;
+ body["type"] = (LLSD::Integer) preferred_type;
+ body["name"] = name;
+
+ request["message"] = "CreateInventoryCategory";
+ request["payload"] = body;
+
+ LL_DEBUGS(LOG_INV) << "Creating category via request: " << ll_pretty_print_sd(request) << LL_ENDL;
LLCoros::instance().launch("LLInventoryModel::createNewCategoryCoro",
boost::bind(&LLInventoryModel::createNewCategoryCoro, this, url, body, callback));
return;
- }
+ }
if (callback)
{
@@ -1115,7 +1115,7 @@ void LLInventoryModel::createNewCategoryCoro(std::string url, LLSD postData, inv
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("createNewCategoryCoro", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
-
+
httpOpts->setWantHeaders(true);
@@ -1213,36 +1213,36 @@ void LLInventoryModel::createNewCategoryCoro(std::string url, LLSD postData, inv
// category has any immediate children meeting a condition, without
// needing to recurse or build up any lists.
bool LLInventoryModel::hasMatchingDirectDescendent(const LLUUID& cat_id,
- LLInventoryCollectFunctor& filter)
+ LLInventoryCollectFunctor& filter)
{
- LLInventoryModel::cat_array_t *cats;
- LLInventoryModel::item_array_t *items;
- getDirectDescendentsOf(cat_id, cats, items);
- if (cats)
- {
- for (LLInventoryModel::cat_array_t::const_iterator it = cats->begin();
- it != cats->end(); ++it)
- {
- if (filter(*it,NULL))
- {
- return true;
- }
- }
- }
- if (items)
- {
- for (LLInventoryModel::item_array_t::const_iterator it = items->begin();
- it != items->end(); ++it)
- {
- if (filter(NULL,*it))
- {
- return true;
- }
- }
- }
- return false;
+ LLInventoryModel::cat_array_t *cats;
+ LLInventoryModel::item_array_t *items;
+ getDirectDescendentsOf(cat_id, cats, items);
+ if (cats)
+ {
+ for (LLInventoryModel::cat_array_t::const_iterator it = cats->begin();
+ it != cats->end(); ++it)
+ {
+ if (filter(*it,NULL))
+ {
+ return true;
+ }
+ }
+ }
+ if (items)
+ {
+ for (LLInventoryModel::item_array_t::const_iterator it = items->begin();
+ it != items->end(); ++it)
+ {
+ if (filter(NULL,*it))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
}
-
+
// Starting with the object specified, add its descendents to the
// array provided, but do not add the inventory object specified by
// id. There is no guaranteed order. Neither array will be erased
@@ -1253,135 +1253,135 @@ bool LLInventoryModel::hasMatchingDirectDescendent(const LLUUID& cat_id,
class LLAlwaysCollect : public LLInventoryCollectFunctor
{
public:
- virtual ~LLAlwaysCollect() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
- {
- return TRUE;
- }
+ virtual ~LLAlwaysCollect() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item)
+ {
+ return TRUE;
+ }
};
void LLInventoryModel::collectDescendents(const LLUUID& id,
- cat_array_t& cats,
- item_array_t& items,
- BOOL include_trash)
+ cat_array_t& cats,
+ item_array_t& items,
+ BOOL include_trash)
{
- LLAlwaysCollect always;
- collectDescendentsIf(id, cats, items, include_trash, always);
+ LLAlwaysCollect always;
+ collectDescendentsIf(id, cats, items, include_trash, always);
}
void LLInventoryModel::collectDescendentsIf(const LLUUID& id,
- cat_array_t& cats,
- item_array_t& items,
- BOOL include_trash,
- LLInventoryCollectFunctor& add)
+ cat_array_t& cats,
+ item_array_t& items,
+ BOOL include_trash,
+ LLInventoryCollectFunctor& add)
{
- // Start with categories
- if(!include_trash)
- {
- const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if(trash_id.notNull() && (trash_id == id))
- return;
- }
- cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id);
- if(cat_array)
- {
- S32 count = cat_array->size();
- for(S32 i = 0; i < count; ++i)
- {
- LLViewerInventoryCategory* cat = cat_array->at(i);
- if(add(cat,NULL))
- {
- cats.push_back(cat);
- }
- collectDescendentsIf(cat->getUUID(), cats, items, include_trash, add);
- }
- }
-
- LLViewerInventoryItem* item = NULL;
- item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id);
-
- // Move onto items
- if(item_array)
- {
- S32 count = item_array->size();
- for(S32 i = 0; i < count; ++i)
- {
- item = item_array->at(i);
- if(add(NULL, item))
- {
- items.push_back(item);
- }
- }
- }
+ // Start with categories
+ if(!include_trash)
+ {
+ const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if(trash_id.notNull() && (trash_id == id))
+ return;
+ }
+ cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id);
+ if(cat_array)
+ {
+ S32 count = cat_array->size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ LLViewerInventoryCategory* cat = cat_array->at(i);
+ if(add(cat,NULL))
+ {
+ cats.push_back(cat);
+ }
+ collectDescendentsIf(cat->getUUID(), cats, items, include_trash, add);
+ }
+ }
+
+ LLViewerInventoryItem* item = NULL;
+ item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id);
+
+ // Move onto items
+ if(item_array)
+ {
+ S32 count = item_array->size();
+ for(S32 i = 0; i < count; ++i)
+ {
+ item = item_array->at(i);
+ if(add(NULL, item))
+ {
+ items.push_back(item);
+ }
+ }
+ }
}
void LLInventoryModel::addChangedMaskForLinks(const LLUUID& object_id, U32 mask)
{
- const LLInventoryObject *obj = getObject(object_id);
- if (!obj || obj->getIsLinkType())
- return;
-
- LLInventoryModel::item_array_t item_array = collectLinksTo(object_id);
- for (LLInventoryModel::item_array_t::iterator iter = item_array.begin();
- iter != item_array.end();
- iter++)
- {
- LLViewerInventoryItem *linked_item = (*iter);
- addChangedMask(mask, linked_item->getUUID());
- };
+ const LLInventoryObject *obj = getObject(object_id);
+ if (!obj || obj->getIsLinkType())
+ return;
+
+ LLInventoryModel::item_array_t item_array = collectLinksTo(object_id);
+ for (LLInventoryModel::item_array_t::iterator iter = item_array.begin();
+ iter != item_array.end();
+ iter++)
+ {
+ LLViewerInventoryItem *linked_item = (*iter);
+ addChangedMask(mask, linked_item->getUUID());
+ };
}
const LLUUID& LLInventoryModel::getLinkedItemID(const LLUUID& object_id) const
{
- const LLInventoryItem *item = gInventory.getItem(object_id);
- if (!item)
- {
- return object_id;
- }
-
- // Find the base item in case this a link (if it's not a link,
- // this will just be inv_item_id)
- return item->getLinkedUUID();
+ const LLInventoryItem *item = gInventory.getItem(object_id);
+ if (!item)
+ {
+ return object_id;
+ }
+
+ // Find the base item in case this a link (if it's not a link,
+ // this will just be inv_item_id)
+ return item->getLinkedUUID();
}
LLViewerInventoryItem* LLInventoryModel::getLinkedItem(const LLUUID& object_id) const
{
- return object_id.notNull() ? getItem(getLinkedItemID(object_id)) : NULL;
+ return object_id.notNull() ? getItem(getLinkedItemID(object_id)) : NULL;
}
LLInventoryModel::item_array_t LLInventoryModel::collectLinksTo(const LLUUID& id)
{
- // Get item list via collectDescendents (slow!)
- item_array_t items;
- const LLInventoryObject *obj = getObject(id);
- // FIXME - should be as in next line, but this is causing a
- // stack-smashing crash of cause TBD... check in the REBUILD code.
- //if (obj && obj->getIsLinkType())
- if (!obj || obj->getIsLinkType())
- return items;
-
- std::pair<backlink_mmap_t::iterator, backlink_mmap_t::iterator> range = mBacklinkMMap.equal_range(id);
- for (backlink_mmap_t::iterator it = range.first; it != range.second; ++it)
- {
- LLViewerInventoryItem *item = getItem(it->second);
- if (item)
- {
- items.push_back(item);
- }
- }
-
- return items;
+ // Get item list via collectDescendents (slow!)
+ item_array_t items;
+ const LLInventoryObject *obj = getObject(id);
+ // FIXME - should be as in next line, but this is causing a
+ // stack-smashing crash of cause TBD... check in the REBUILD code.
+ //if (obj && obj->getIsLinkType())
+ if (!obj || obj->getIsLinkType())
+ return items;
+
+ std::pair<backlink_mmap_t::iterator, backlink_mmap_t::iterator> range = mBacklinkMMap.equal_range(id);
+ for (backlink_mmap_t::iterator it = range.first; it != range.second; ++it)
+ {
+ LLViewerInventoryItem *item = getItem(it->second);
+ if (item)
+ {
+ items.push_back(item);
+ }
+ }
+
+ return items;
}
bool LLInventoryModel::isInventoryUsable() const
{
- bool result = false;
- if(gInventory.getRootFolderID().notNull() && mIsAgentInvUsable)
- {
- result = true;
- }
- return result;
+ bool result = false;
+ if(gInventory.getRootFolderID().notNull() && mIsAgentInvUsable)
+ {
+ result = true;
+ }
+ return result;
}
// Calling this method with an inventory item will either change an
@@ -1389,34 +1389,34 @@ bool LLInventoryModel::isInventoryUsable() const
// current inventory.
U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask)
{
- if(item->getUUID().isNull())
- {
- return mask;
- }
-
- if(!isInventoryUsable())
- {
- LL_WARNS(LOG_INV) << "Inventory is broken." << LL_ENDL;
- return mask;
- }
-
- if (item->getType() == LLAssetType::AT_MESH)
- {
- return mask;
- }
-
- LLPointer<LLViewerInventoryItem> old_item = getItem(item->getUUID());
- LLPointer<LLViewerInventoryItem> new_item;
- if(old_item)
- {
- // We already have an old item, modify its values
- new_item = old_item;
- LLUUID old_parent_id = old_item->getParentUUID();
- LLUUID new_parent_id = item->getParentUUID();
- bool update_parent_on_server = false;
-
- if (new_parent_id.isNull() && !LLApp::isExiting())
- {
+ if(item->getUUID().isNull())
+ {
+ return mask;
+ }
+
+ if(!isInventoryUsable())
+ {
+ LL_WARNS(LOG_INV) << "Inventory is broken." << LL_ENDL;
+ return mask;
+ }
+
+ if (item->getType() == LLAssetType::AT_MESH)
+ {
+ return mask;
+ }
+
+ LLPointer<LLViewerInventoryItem> old_item = getItem(item->getUUID());
+ LLPointer<LLViewerInventoryItem> new_item;
+ if(old_item)
+ {
+ // We already have an old item, modify its values
+ new_item = old_item;
+ LLUUID old_parent_id = old_item->getParentUUID();
+ LLUUID new_parent_id = item->getParentUUID();
+ bool update_parent_on_server = false;
+
+ if (new_parent_id.isNull() && !LLApp::isExiting())
+ {
if (old_parent_id.isNull())
{
// Item with null parent will end in random location and then in Lost&Found,
@@ -1438,359 +1438,359 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask)
new_parent_id = old_parent_id;
update_parent_on_server = true;
}
- }
-
- if(old_parent_id != new_parent_id)
- {
- // need to update the parent-child tree
- item_array_t* item_array;
- item_array = get_ptr_in_map(mParentChildItemTree, old_parent_id);
- if(item_array)
- {
- vector_replace_with_last(*item_array, old_item);
- }
- item_array = get_ptr_in_map(mParentChildItemTree, new_parent_id);
- if(item_array)
- {
- if (update_parent_on_server)
- {
- LLInventoryModel::LLCategoryUpdate update(new_parent_id, 1);
- gInventory.accountForUpdate(update);
- }
- item_array->push_back(old_item);
- }
- mask |= LLInventoryObserver::STRUCTURE;
- }
- if(old_item->getName() != item->getName())
- {
- mask |= LLInventoryObserver::LABEL;
- }
+ }
+
+ if(old_parent_id != new_parent_id)
+ {
+ // need to update the parent-child tree
+ item_array_t* item_array;
+ item_array = get_ptr_in_map(mParentChildItemTree, old_parent_id);
+ if(item_array)
+ {
+ vector_replace_with_last(*item_array, old_item);
+ }
+ item_array = get_ptr_in_map(mParentChildItemTree, new_parent_id);
+ if(item_array)
+ {
+ if (update_parent_on_server)
+ {
+ LLInventoryModel::LLCategoryUpdate update(new_parent_id, 1);
+ gInventory.accountForUpdate(update);
+ }
+ item_array->push_back(old_item);
+ }
+ mask |= LLInventoryObserver::STRUCTURE;
+ }
+ if(old_item->getName() != item->getName())
+ {
+ mask |= LLInventoryObserver::LABEL;
+ }
if (old_item->getPermissions() != item->getPermissions())
{
mask |= LLInventoryObserver::INTERNAL;
}
- old_item->copyViewerItem(item);
- if (update_parent_on_server)
- {
- // Parent id at server is null, so update server even if item already is in the same folder
- old_item->setParent(new_parent_id);
- new_item->updateParentOnServer(FALSE);
- }
- mask |= LLInventoryObserver::INTERNAL;
- }
- else
- {
- // Simply add this item
- new_item = new LLViewerInventoryItem(item);
- addItem(new_item);
-
- if(item->getParentUUID().isNull())
- {
- const LLUUID category_id = findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(new_item->getType()));
- new_item->setParent(category_id);
- item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, category_id);
- if( item_array )
- {
- LLInventoryModel::LLCategoryUpdate update(category_id, 1);
- gInventory.accountForUpdate(update);
-
- // *FIX: bit of a hack to call update server from here...
- new_item->updateParentOnServer(FALSE);
- item_array->push_back(new_item);
- }
- else
- {
- LL_WARNS(LOG_INV) << "Couldn't find parent-child item tree for " << new_item->getName() << LL_ENDL;
- }
- }
- else
- {
- // *NOTE: The general scheme is that if every byte of the
- // uuid is 0, except for the last one or two,the use the
- // last two bytes of the parent id, and match that up
- // against the type. For now, we're only worried about
- // lost & found.
- LLUUID parent_id = item->getParentUUID();
- if(parent_id == CATEGORIZE_LOST_AND_FOUND_ID)
- {
- parent_id = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- new_item->setParent(parent_id);
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate new_folder(parent_id, 1);
- update.push_back(new_folder);
- accountForUpdate(update);
-
- }
- item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, parent_id);
- if(item_array)
- {
- item_array->push_back(new_item);
- }
- else
- {
- // Whoops! No such parent, make one.
- LL_INFOS(LOG_INV) << "Lost item: " << new_item->getUUID() << " - "
- << new_item->getName() << LL_ENDL;
- parent_id = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- new_item->setParent(parent_id);
- item_array = get_ptr_in_map(mParentChildItemTree, parent_id);
- if(item_array)
- {
- LLInventoryModel::LLCategoryUpdate update(parent_id, 1);
- gInventory.accountForUpdate(update);
- // *FIX: bit of a hack to call update server from
- // here...
- new_item->updateParentOnServer(FALSE);
- item_array->push_back(new_item);
- }
- else
- {
- LL_WARNS(LOG_INV) << "Lost and found Not there!!" << LL_ENDL;
- }
- }
- }
- mask |= LLInventoryObserver::ADD;
- }
- if(new_item->getType() == LLAssetType::AT_CALLINGCARD)
- {
- mask |= LLInventoryObserver::CALLING_CARD;
- // Handle user created calling cards.
- // Target ID is stored in the description field of the card.
- LLUUID id;
- std::string desc = new_item->getDescription();
- BOOL isId = desc.empty() ? FALSE : id.set(desc, FALSE);
- if (isId)
- {
- // Valid UUID; set the item UUID and rename it
- new_item->setCreator(id);
- LLAvatarName av_name;
-
- if (LLAvatarNameCache::get(id, &av_name))
- {
- new_item->rename(av_name.getUserName());
- mask |= LLInventoryObserver::LABEL;
- }
- else
- {
- // Fetch the current name
- LLAvatarNameCache::get(id,
- boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(),
- _1, _2));
- }
-
- }
- }
- else if (new_item->getType() == LLAssetType::AT_GESTURE)
- {
- mask |= LLInventoryObserver::GESTURE;
- }
- addChangedMask(mask, new_item->getUUID());
- return mask;
+ old_item->copyViewerItem(item);
+ if (update_parent_on_server)
+ {
+ // Parent id at server is null, so update server even if item already is in the same folder
+ old_item->setParent(new_parent_id);
+ new_item->updateParentOnServer(FALSE);
+ }
+ mask |= LLInventoryObserver::INTERNAL;
+ }
+ else
+ {
+ // Simply add this item
+ new_item = new LLViewerInventoryItem(item);
+ addItem(new_item);
+
+ if(item->getParentUUID().isNull())
+ {
+ const LLUUID category_id = findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(new_item->getType()));
+ new_item->setParent(category_id);
+ item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, category_id);
+ if( item_array )
+ {
+ LLInventoryModel::LLCategoryUpdate update(category_id, 1);
+ gInventory.accountForUpdate(update);
+
+ // *FIX: bit of a hack to call update server from here...
+ new_item->updateParentOnServer(FALSE);
+ item_array->push_back(new_item);
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "Couldn't find parent-child item tree for " << new_item->getName() << LL_ENDL;
+ }
+ }
+ else
+ {
+ // *NOTE: The general scheme is that if every byte of the
+ // uuid is 0, except for the last one or two,the use the
+ // last two bytes of the parent id, and match that up
+ // against the type. For now, we're only worried about
+ // lost & found.
+ LLUUID parent_id = item->getParentUUID();
+ if(parent_id == CATEGORIZE_LOST_AND_FOUND_ID)
+ {
+ parent_id = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ new_item->setParent(parent_id);
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate new_folder(parent_id, 1);
+ update.push_back(new_folder);
+ accountForUpdate(update);
+
+ }
+ item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, parent_id);
+ if(item_array)
+ {
+ item_array->push_back(new_item);
+ }
+ else
+ {
+ // Whoops! No such parent, make one.
+ LL_INFOS(LOG_INV) << "Lost item: " << new_item->getUUID() << " - "
+ << new_item->getName() << LL_ENDL;
+ parent_id = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ new_item->setParent(parent_id);
+ item_array = get_ptr_in_map(mParentChildItemTree, parent_id);
+ if(item_array)
+ {
+ LLInventoryModel::LLCategoryUpdate update(parent_id, 1);
+ gInventory.accountForUpdate(update);
+ // *FIX: bit of a hack to call update server from
+ // here...
+ new_item->updateParentOnServer(FALSE);
+ item_array->push_back(new_item);
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "Lost and found Not there!!" << LL_ENDL;
+ }
+ }
+ }
+ mask |= LLInventoryObserver::ADD;
+ }
+ if(new_item->getType() == LLAssetType::AT_CALLINGCARD)
+ {
+ mask |= LLInventoryObserver::CALLING_CARD;
+ // Handle user created calling cards.
+ // Target ID is stored in the description field of the card.
+ LLUUID id;
+ std::string desc = new_item->getDescription();
+ BOOL isId = desc.empty() ? FALSE : id.set(desc, FALSE);
+ if (isId)
+ {
+ // Valid UUID; set the item UUID and rename it
+ new_item->setCreator(id);
+ LLAvatarName av_name;
+
+ if (LLAvatarNameCache::get(id, &av_name))
+ {
+ new_item->rename(av_name.getUserName());
+ mask |= LLInventoryObserver::LABEL;
+ }
+ else
+ {
+ // Fetch the current name
+ LLAvatarNameCache::get(id,
+ boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(),
+ _1, _2));
+ }
+
+ }
+ }
+ else if (new_item->getType() == LLAssetType::AT_GESTURE)
+ {
+ mask |= LLInventoryObserver::GESTURE;
+ }
+ addChangedMask(mask, new_item->getUUID());
+ return mask;
}
LLInventoryModel::cat_array_t* LLInventoryModel::getUnlockedCatArray(const LLUUID& id)
{
- cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id);
- if (cat_array)
- {
- llassert_always(mCategoryLock[id] == false);
- }
- return cat_array;
+ cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id);
+ if (cat_array)
+ {
+ llassert_always(mCategoryLock[id] == false);
+ }
+ return cat_array;
}
LLInventoryModel::item_array_t* LLInventoryModel::getUnlockedItemArray(const LLUUID& id)
{
- item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id);
- if (item_array)
- {
- llassert_always(mItemLock[id] == false);
- }
- return item_array;
+ item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id);
+ if (item_array)
+ {
+ llassert_always(mItemLock[id] == false);
+ }
+ return item_array;
}
// Calling this method with an inventory category will either change
// an existing item with the matching id, or it will add the category.
void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat, U32 mask)
{
- if(!cat || cat->getUUID().isNull())
- {
- return;
- }
-
- if(!isInventoryUsable())
- {
- LL_WARNS(LOG_INV) << "Inventory is broken." << LL_ENDL;
- return;
- }
-
- LLPointer<LLViewerInventoryCategory> old_cat = getCategory(cat->getUUID());
- if(old_cat)
- {
- // We already have an old category, modify its values
- LLUUID old_parent_id = old_cat->getParentUUID();
- LLUUID new_parent_id = cat->getParentUUID();
- if(old_parent_id != new_parent_id)
- {
- // need to update the parent-child tree
- cat_array_t* cat_array;
- cat_array = getUnlockedCatArray(old_parent_id);
- if(cat_array)
- {
- vector_replace_with_last(*cat_array, old_cat);
- }
- cat_array = getUnlockedCatArray(new_parent_id);
- if(cat_array)
- {
- cat_array->push_back(old_cat);
- }
- mask |= LLInventoryObserver::STRUCTURE;
+ if(!cat || cat->getUUID().isNull())
+ {
+ return;
+ }
+
+ if(!isInventoryUsable())
+ {
+ LL_WARNS(LOG_INV) << "Inventory is broken." << LL_ENDL;
+ return;
+ }
+
+ LLPointer<LLViewerInventoryCategory> old_cat = getCategory(cat->getUUID());
+ if(old_cat)
+ {
+ // We already have an old category, modify its values
+ LLUUID old_parent_id = old_cat->getParentUUID();
+ LLUUID new_parent_id = cat->getParentUUID();
+ if(old_parent_id != new_parent_id)
+ {
+ // need to update the parent-child tree
+ cat_array_t* cat_array;
+ cat_array = getUnlockedCatArray(old_parent_id);
+ if(cat_array)
+ {
+ vector_replace_with_last(*cat_array, old_cat);
+ }
+ cat_array = getUnlockedCatArray(new_parent_id);
+ if(cat_array)
+ {
+ cat_array->push_back(old_cat);
+ }
+ mask |= LLInventoryObserver::STRUCTURE;
mask |= LLInventoryObserver::INTERNAL;
- }
- if(old_cat->getName() != cat->getName())
- {
- mask |= LLInventoryObserver::LABEL;
- }
+ }
+ if(old_cat->getName() != cat->getName())
+ {
+ mask |= LLInventoryObserver::LABEL;
+ }
// Under marketplace, category labels are quite complex and need extra upate
const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id))
{
- mask |= LLInventoryObserver::LABEL;
+ mask |= LLInventoryObserver::LABEL;
}
old_cat->copyViewerCategory(cat);
- addChangedMask(mask, cat->getUUID());
- }
- else
- {
- // add this category
- LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat->getOwnerID());
- new_cat->copyViewerCategory(cat);
- addCategory(new_cat);
-
- // make sure this category is correctly referenced by its parent.
- cat_array_t* cat_array;
- cat_array = getUnlockedCatArray(cat->getParentUUID());
- if(cat_array)
- {
- cat_array->push_back(new_cat);
- }
-
- // make space in the tree for this category's children.
- llassert_always(mCategoryLock[new_cat->getUUID()] == false);
- llassert_always(mItemLock[new_cat->getUUID()] == false);
- cat_array_t* catsp = new cat_array_t;
- item_array_t* itemsp = new item_array_t;
- mParentChildCategoryTree[new_cat->getUUID()] = catsp;
- mParentChildItemTree[new_cat->getUUID()] = itemsp;
- mask |= LLInventoryObserver::ADD;
- addChangedMask(mask, cat->getUUID());
- }
+ addChangedMask(mask, cat->getUUID());
+ }
+ else
+ {
+ // add this category
+ LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat->getOwnerID());
+ new_cat->copyViewerCategory(cat);
+ addCategory(new_cat);
+
+ // make sure this category is correctly referenced by its parent.
+ cat_array_t* cat_array;
+ cat_array = getUnlockedCatArray(cat->getParentUUID());
+ if(cat_array)
+ {
+ cat_array->push_back(new_cat);
+ }
+
+ // make space in the tree for this category's children.
+ llassert_always(mCategoryLock[new_cat->getUUID()] == false);
+ llassert_always(mItemLock[new_cat->getUUID()] == false);
+ cat_array_t* catsp = new cat_array_t;
+ item_array_t* itemsp = new item_array_t;
+ mParentChildCategoryTree[new_cat->getUUID()] = catsp;
+ mParentChildItemTree[new_cat->getUUID()] = itemsp;
+ mask |= LLInventoryObserver::ADD;
+ addChangedMask(mask, cat->getUUID());
+ }
}
void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
{
- LL_DEBUGS(LOG_INV) << "LLInventoryModel::moveObject()" << LL_ENDL;
- if(!isInventoryUsable())
- {
- LL_WARNS(LOG_INV) << "Inventory is broken." << LL_ENDL;
- return;
- }
-
- if((object_id == cat_id) || !is_in_map(mCategoryMap, cat_id))
- {
- LL_WARNS(LOG_INV) << "Could not move inventory object " << object_id << " to "
- << cat_id << LL_ENDL;
- return;
- }
- LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id);
- if(cat && (cat->getParentUUID() != cat_id))
- {
- LL_DEBUGS(LOG_INV) << "Move category '" << make_path(cat) << "' to '" << make_inventory_path(cat_id) << "'" << LL_ENDL;
- cat_array_t* cat_array;
- cat_array = getUnlockedCatArray(cat->getParentUUID());
- if(cat_array) vector_replace_with_last(*cat_array, cat);
- cat_array = getUnlockedCatArray(cat_id);
- cat->setParent(cat_id);
- if(cat_array) cat_array->push_back(cat);
- addChangedMask(LLInventoryObserver::STRUCTURE, object_id);
- return;
- }
- LLPointer<LLViewerInventoryItem> item = getItem(object_id);
- if(item && (item->getParentUUID() != cat_id))
- {
- LL_DEBUGS(LOG_INV) << "Move item '" << make_path(item) << "' to '" << make_inventory_path(cat_id) << "'" << LL_ENDL;
- item_array_t* item_array;
- item_array = getUnlockedItemArray(item->getParentUUID());
- if(item_array) vector_replace_with_last(*item_array, item);
- item_array = getUnlockedItemArray(cat_id);
- item->setParent(cat_id);
- if(item_array) item_array->push_back(item);
- addChangedMask(LLInventoryObserver::STRUCTURE, object_id);
- return;
- }
+ LL_DEBUGS(LOG_INV) << "LLInventoryModel::moveObject()" << LL_ENDL;
+ if(!isInventoryUsable())
+ {
+ LL_WARNS(LOG_INV) << "Inventory is broken." << LL_ENDL;
+ return;
+ }
+
+ if((object_id == cat_id) || !is_in_map(mCategoryMap, cat_id))
+ {
+ LL_WARNS(LOG_INV) << "Could not move inventory object " << object_id << " to "
+ << cat_id << LL_ENDL;
+ return;
+ }
+ LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id);
+ if(cat && (cat->getParentUUID() != cat_id))
+ {
+ LL_DEBUGS(LOG_INV) << "Move category '" << make_path(cat) << "' to '" << make_inventory_path(cat_id) << "'" << LL_ENDL;
+ cat_array_t* cat_array;
+ cat_array = getUnlockedCatArray(cat->getParentUUID());
+ if(cat_array) vector_replace_with_last(*cat_array, cat);
+ cat_array = getUnlockedCatArray(cat_id);
+ cat->setParent(cat_id);
+ if(cat_array) cat_array->push_back(cat);
+ addChangedMask(LLInventoryObserver::STRUCTURE, object_id);
+ return;
+ }
+ LLPointer<LLViewerInventoryItem> item = getItem(object_id);
+ if(item && (item->getParentUUID() != cat_id))
+ {
+ LL_DEBUGS(LOG_INV) << "Move item '" << make_path(item) << "' to '" << make_inventory_path(cat_id) << "'" << LL_ENDL;
+ item_array_t* item_array;
+ item_array = getUnlockedItemArray(item->getParentUUID());
+ if(item_array) vector_replace_with_last(*item_array, item);
+ item_array = getUnlockedItemArray(cat_id);
+ item->setParent(cat_id);
+ if(item_array) item_array->push_back(item);
+ addChangedMask(LLInventoryObserver::STRUCTURE, object_id);
+ return;
+ }
}
// Migrated from llinventoryfunctions
void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item,
- const LLUUID& new_parent_id,
- BOOL restamp)
+ const LLUUID& new_parent_id,
+ BOOL restamp)
{
- if (item->getParentUUID() == new_parent_id)
- {
- LL_DEBUGS(LOG_INV) << make_info(item) << " is already in folder " << make_inventory_info(new_parent_id) << LL_ENDL;
- }
- else
- {
- LL_INFOS(LOG_INV) << "Move item " << make_info(item)
- << " from " << make_inventory_info(item->getParentUUID())
- << " to " << make_inventory_info(new_parent_id) << LL_ENDL;
-
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
- update.push_back(new_folder);
- accountForUpdate(update);
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setParent(new_parent_id);
- new_item->updateParentOnServer(restamp);
- updateItem(new_item);
- notifyObservers();
- }
+ if (item->getParentUUID() == new_parent_id)
+ {
+ LL_DEBUGS(LOG_INV) << make_info(item) << " is already in folder " << make_inventory_info(new_parent_id) << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS(LOG_INV) << "Move item " << make_info(item)
+ << " from " << make_inventory_info(item->getParentUUID())
+ << " to " << make_inventory_info(new_parent_id) << LL_ENDL;
+
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+ update.push_back(new_folder);
+ accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setParent(new_parent_id);
+ new_item->updateParentOnServer(restamp);
+ updateItem(new_item);
+ notifyObservers();
+ }
}
// Migrated from llinventoryfunctions
void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat,
- const LLUUID& new_parent_id,
- BOOL restamp)
+ const LLUUID& new_parent_id,
+ BOOL restamp)
{
- if (!cat)
- {
- return;
- }
-
- // Can't move a folder into a child of itself.
- if (isObjectDescendentOf(new_parent_id, cat->getUUID()))
- {
- return;
- }
-
- LL_INFOS(LOG_INV) << "Move category " << make_info(cat)
- << " from " << make_inventory_info(cat->getParentUUID())
- << " to " << make_inventory_info(new_parent_id) << LL_ENDL;
-
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
- update.push_back(new_folder);
- accountForUpdate(update);
-
- LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
- new_cat->setParent(new_parent_id);
- new_cat->updateParentOnServer(restamp);
- updateCategory(new_cat);
- notifyObservers();
+ if (!cat)
+ {
+ return;
+ }
+
+ // Can't move a folder into a child of itself.
+ if (isObjectDescendentOf(new_parent_id, cat->getUUID()))
+ {
+ return;
+ }
+
+ LL_INFOS(LOG_INV) << "Move category " << make_info(cat)
+ << " from " << make_inventory_info(cat->getParentUUID())
+ << " to " << make_inventory_info(new_parent_id) << LL_ENDL;
+
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+ update.push_back(new_folder);
+ accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
+ new_cat->setParent(new_parent_id);
+ new_cat->updateParentOnServer(restamp);
+ updateCategory(new_cat);
+ notifyObservers();
}
void LLInventoryModel::rebuildBrockenLinks()
@@ -1817,262 +1817,262 @@ void LLInventoryModel::rebuildBrockenLinks()
// Does not appear to be used currently.
void LLInventoryModel::onItemUpdated(const LLUUID& item_id, const LLSD& updates, bool update_parent_version)
{
- U32 mask = LLInventoryObserver::NONE;
-
- LLPointer<LLViewerInventoryItem> item = gInventory.getItem(item_id);
- LL_DEBUGS(LOG_INV) << "item_id: [" << item_id << "] name " << (item ? item->getName() : "(NOT FOUND)") << LL_ENDL;
- if(item)
- {
- for (LLSD::map_const_iterator it = updates.beginMap();
- it != updates.endMap(); ++it)
- {
- if (it->first == "name")
- {
- LL_INFOS(LOG_INV) << "Updating name from " << item->getName() << " to " << it->second.asString() << LL_ENDL;
- item->rename(it->second.asString());
- mask |= LLInventoryObserver::LABEL;
- }
- else if (it->first == "desc")
- {
- LL_INFOS(LOG_INV) << "Updating description from " << item->getActualDescription()
- << " to " << it->second.asString() << LL_ENDL;
- item->setDescription(it->second.asString());
- }
- else
- {
- LL_ERRS(LOG_INV) << "unhandled updates for field: " << it->first << LL_ENDL;
- }
- }
- mask |= LLInventoryObserver::INTERNAL;
- addChangedMask(mask, item->getUUID());
- if (update_parent_version)
- {
- // Descendent count is unchanged, but folder version incremented.
- LLInventoryModel::LLCategoryUpdate up(item->getParentUUID(), 0);
- accountForUpdate(up);
- }
- notifyObservers(); // do we want to be able to make this optional?
- }
+ U32 mask = LLInventoryObserver::NONE;
+
+ LLPointer<LLViewerInventoryItem> item = gInventory.getItem(item_id);
+ LL_DEBUGS(LOG_INV) << "item_id: [" << item_id << "] name " << (item ? item->getName() : "(NOT FOUND)") << LL_ENDL;
+ if(item)
+ {
+ for (LLSD::map_const_iterator it = updates.beginMap();
+ it != updates.endMap(); ++it)
+ {
+ if (it->first == "name")
+ {
+ LL_INFOS(LOG_INV) << "Updating name from " << item->getName() << " to " << it->second.asString() << LL_ENDL;
+ item->rename(it->second.asString());
+ mask |= LLInventoryObserver::LABEL;
+ }
+ else if (it->first == "desc")
+ {
+ LL_INFOS(LOG_INV) << "Updating description from " << item->getActualDescription()
+ << " to " << it->second.asString() << LL_ENDL;
+ item->setDescription(it->second.asString());
+ }
+ else
+ {
+ LL_ERRS(LOG_INV) << "unhandled updates for field: " << it->first << LL_ENDL;
+ }
+ }
+ mask |= LLInventoryObserver::INTERNAL;
+ addChangedMask(mask, item->getUUID());
+ if (update_parent_version)
+ {
+ // Descendent count is unchanged, but folder version incremented.
+ LLInventoryModel::LLCategoryUpdate up(item->getParentUUID(), 0);
+ accountForUpdate(up);
+ }
+ notifyObservers(); // do we want to be able to make this optional?
+ }
}
// Not used?
void LLInventoryModel::onCategoryUpdated(const LLUUID& cat_id, const LLSD& updates)
{
- U32 mask = LLInventoryObserver::NONE;
-
- LLPointer<LLViewerInventoryCategory> cat = gInventory.getCategory(cat_id);
- LL_DEBUGS(LOG_INV) << "cat_id: [" << cat_id << "] name " << (cat ? cat->getName() : "(NOT FOUND)") << LL_ENDL;
- if(cat)
- {
- for (LLSD::map_const_iterator it = updates.beginMap();
- it != updates.endMap(); ++it)
- {
- if (it->first == "name")
- {
- LL_INFOS(LOG_INV) << "Updating name from " << cat->getName() << " to " << it->second.asString() << LL_ENDL;
- cat->rename(it->second.asString());
- mask |= LLInventoryObserver::LABEL;
- }
- else
- {
- LL_ERRS(LOG_INV) << "unhandled updates for field: " << it->first << LL_ENDL;
- }
- }
- mask |= LLInventoryObserver::INTERNAL;
- addChangedMask(mask, cat->getUUID());
- notifyObservers(); // do we want to be able to make this optional?
- }
+ U32 mask = LLInventoryObserver::NONE;
+
+ LLPointer<LLViewerInventoryCategory> cat = gInventory.getCategory(cat_id);
+ LL_DEBUGS(LOG_INV) << "cat_id: [" << cat_id << "] name " << (cat ? cat->getName() : "(NOT FOUND)") << LL_ENDL;
+ if(cat)
+ {
+ for (LLSD::map_const_iterator it = updates.beginMap();
+ it != updates.endMap(); ++it)
+ {
+ if (it->first == "name")
+ {
+ LL_INFOS(LOG_INV) << "Updating name from " << cat->getName() << " to " << it->second.asString() << LL_ENDL;
+ cat->rename(it->second.asString());
+ mask |= LLInventoryObserver::LABEL;
+ }
+ else
+ {
+ LL_ERRS(LOG_INV) << "unhandled updates for field: " << it->first << LL_ENDL;
+ }
+ }
+ mask |= LLInventoryObserver::INTERNAL;
+ addChangedMask(mask, cat->getUUID());
+ notifyObservers(); // do we want to be able to make this optional?
+ }
}
// Update model after descendents have been purged.
void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links)
{
- LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id);
- if (cat.notNull())
- {
- // do the cache accounting
- S32 descendents = cat->getDescendentCount();
- if(descendents > 0)
- {
- LLInventoryModel::LLCategoryUpdate up(object_id, -descendents);
- accountForUpdate(up);
- }
-
- // we know that descendent count is 0, however since the
- // accounting may actually not do an update, we should force
- // it here.
- cat->setDescendentCount(0);
-
- // unceremoniously remove anything we have locally stored.
- LLInventoryModel::cat_array_t categories;
- LLInventoryModel::item_array_t items;
- collectDescendents(object_id,
- categories,
- items,
- LLInventoryModel::INCLUDE_TRASH);
- S32 count = items.size();
-
- LLUUID uu_id;
- for(S32 i = 0; i < count; ++i)
- {
- uu_id = items.at(i)->getUUID();
-
- // This check prevents the deletion of a previously deleted item.
- // This is necessary because deletion is not done in a hierarchical
- // order. The current item may have been already deleted as a child
- // of its deleted parent.
- if (getItem(uu_id))
- {
- deleteObject(uu_id, fix_broken_links);
- }
- }
-
- count = categories.size();
- // Slightly kludgy way to make sure categories are removed
- // only after their child categories have gone away.
-
- // FIXME: Would probably make more sense to have this whole
- // descendent-clearing thing be a post-order recursive
- // function to get the leaf-up behavior automatically.
- S32 deleted_count;
- S32 total_deleted_count = 0;
- do
- {
- deleted_count = 0;
- for(S32 i = 0; i < count; ++i)
- {
- uu_id = categories.at(i)->getUUID();
- if (getCategory(uu_id))
- {
- cat_array_t* cat_list = getUnlockedCatArray(uu_id);
- if (!cat_list || (cat_list->size() == 0))
- {
- deleteObject(uu_id, fix_broken_links);
- deleted_count++;
- }
- }
- }
- total_deleted_count += deleted_count;
- }
- while (deleted_count > 0);
- if (total_deleted_count != count)
- {
- LL_WARNS(LOG_INV) << "Unexpected count of categories deleted, got "
- << total_deleted_count << " expected " << count << LL_ENDL;
- }
- //gInventory.validate();
- }
+ LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id);
+ if (cat.notNull())
+ {
+ // do the cache accounting
+ S32 descendents = cat->getDescendentCount();
+ if(descendents > 0)
+ {
+ LLInventoryModel::LLCategoryUpdate up(object_id, -descendents);
+ accountForUpdate(up);
+ }
+
+ // we know that descendent count is 0, however since the
+ // accounting may actually not do an update, we should force
+ // it here.
+ cat->setDescendentCount(0);
+
+ // unceremoniously remove anything we have locally stored.
+ LLInventoryModel::cat_array_t categories;
+ LLInventoryModel::item_array_t items;
+ collectDescendents(object_id,
+ categories,
+ items,
+ LLInventoryModel::INCLUDE_TRASH);
+ S32 count = items.size();
+
+ LLUUID uu_id;
+ for(S32 i = 0; i < count; ++i)
+ {
+ uu_id = items.at(i)->getUUID();
+
+ // This check prevents the deletion of a previously deleted item.
+ // This is necessary because deletion is not done in a hierarchical
+ // order. The current item may have been already deleted as a child
+ // of its deleted parent.
+ if (getItem(uu_id))
+ {
+ deleteObject(uu_id, fix_broken_links);
+ }
+ }
+
+ count = categories.size();
+ // Slightly kludgy way to make sure categories are removed
+ // only after their child categories have gone away.
+
+ // FIXME: Would probably make more sense to have this whole
+ // descendent-clearing thing be a post-order recursive
+ // function to get the leaf-up behavior automatically.
+ S32 deleted_count;
+ S32 total_deleted_count = 0;
+ do
+ {
+ deleted_count = 0;
+ for(S32 i = 0; i < count; ++i)
+ {
+ uu_id = categories.at(i)->getUUID();
+ if (getCategory(uu_id))
+ {
+ cat_array_t* cat_list = getUnlockedCatArray(uu_id);
+ if (!cat_list || (cat_list->size() == 0))
+ {
+ deleteObject(uu_id, fix_broken_links);
+ deleted_count++;
+ }
+ }
+ }
+ total_deleted_count += deleted_count;
+ }
+ while (deleted_count > 0);
+ if (total_deleted_count != count)
+ {
+ LL_WARNS(LOG_INV) << "Unexpected count of categories deleted, got "
+ << total_deleted_count << " expected " << count << LL_ENDL;
+ }
+ //gInventory.validate();
+ }
}
// Update model after an item is confirmed as removed from
// server. Works for categories or items.
void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id, bool fix_broken_links, bool update_parent_version, bool do_notify_observers)
{
- LLPointer<LLInventoryObject> obj = getObject(object_id);
- if(obj)
- {
- if (getCategory(object_id))
- {
- // For category, need to delete/update all children first.
- onDescendentsPurgedFromServer(object_id, fix_broken_links);
- }
-
-
- // From item/cat removeFromServer()
- if (update_parent_version)
- {
- LLInventoryModel::LLCategoryUpdate up(obj->getParentUUID(), -1);
- accountForUpdate(up);
- }
-
- // From purgeObject()
- LLViewerInventoryItem *item = getItem(object_id);
- if (item && (item->getType() != LLAssetType::AT_LSL_TEXT))
- {
- LLPreview::hide(object_id, TRUE);
- }
- deleteObject(object_id, fix_broken_links, do_notify_observers);
- }
+ LLPointer<LLInventoryObject> obj = getObject(object_id);
+ if(obj)
+ {
+ if (getCategory(object_id))
+ {
+ // For category, need to delete/update all children first.
+ onDescendentsPurgedFromServer(object_id, fix_broken_links);
+ }
+
+
+ // From item/cat removeFromServer()
+ if (update_parent_version)
+ {
+ LLInventoryModel::LLCategoryUpdate up(obj->getParentUUID(), -1);
+ accountForUpdate(up);
+ }
+
+ // From purgeObject()
+ LLViewerInventoryItem *item = getItem(object_id);
+ if (item && (item->getType() != LLAssetType::AT_LSL_TEXT))
+ {
+ LLPreview::hide(object_id, TRUE);
+ }
+ deleteObject(object_id, fix_broken_links, do_notify_observers);
+ }
}
// Delete a particular inventory object by ID.
void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, bool do_notify_observers)
{
- LL_DEBUGS(LOG_INV) << "LLInventoryModel::deleteObject()" << LL_ENDL;
- LLPointer<LLInventoryObject> obj = getObject(id);
- if (!obj)
- {
- LL_WARNS(LOG_INV) << "Deleting non-existent object [ id: " << id << " ] " << LL_ENDL;
- return;
- }
+ LL_DEBUGS(LOG_INV) << "LLInventoryModel::deleteObject()" << LL_ENDL;
+ LLPointer<LLInventoryObject> obj = getObject(id);
+ if (!obj)
+ {
+ LL_WARNS(LOG_INV) << "Deleting non-existent object [ id: " << id << " ] " << LL_ENDL;
+ return;
+ }
//collect the links before removing the item from mItemMap
LLInventoryModel::item_array_t links = collectLinksTo(id);
-
- LL_DEBUGS(LOG_INV) << "Deleting inventory object " << id << LL_ENDL;
- mLastItem = NULL;
- LLUUID parent_id = obj->getParentUUID();
- mCategoryMap.erase(id);
- mItemMap.erase(id);
- //mInventory.erase(id);
- item_array_t* item_list = getUnlockedItemArray(parent_id);
- if(item_list)
- {
- LLPointer<LLViewerInventoryItem> item = (LLViewerInventoryItem*)((LLInventoryObject*)obj);
- vector_replace_with_last(*item_list, item);
- }
- cat_array_t* cat_list = getUnlockedCatArray(parent_id);
- if(cat_list)
- {
- LLPointer<LLViewerInventoryCategory> cat = (LLViewerInventoryCategory*)((LLInventoryObject*)obj);
- vector_replace_with_last(*cat_list, cat);
- }
-
+
+ LL_DEBUGS(LOG_INV) << "Deleting inventory object " << id << LL_ENDL;
+ mLastItem = NULL;
+ LLUUID parent_id = obj->getParentUUID();
+ mCategoryMap.erase(id);
+ mItemMap.erase(id);
+ //mInventory.erase(id);
+ item_array_t* item_list = getUnlockedItemArray(parent_id);
+ if(item_list)
+ {
+ LLPointer<LLViewerInventoryItem> item = (LLViewerInventoryItem*)((LLInventoryObject*)obj);
+ vector_replace_with_last(*item_list, item);
+ }
+ cat_array_t* cat_list = getUnlockedCatArray(parent_id);
+ if(cat_list)
+ {
+ LLPointer<LLViewerInventoryCategory> cat = (LLViewerInventoryCategory*)((LLInventoryObject*)obj);
+ vector_replace_with_last(*cat_list, cat);
+ }
+
// Note : We need to tell the inventory observers that those things are going to be deleted *before* the tree is cleared or they won't know what to delete (in views and view models)
- addChangedMask(LLInventoryObserver::REMOVE, id);
- gInventory.notifyObservers();
-
- item_list = getUnlockedItemArray(id);
- if(item_list)
- {
- if (item_list->size())
- {
- LL_WARNS(LOG_INV) << "Deleting cat " << id << " while it still has child items" << LL_ENDL;
- }
- delete item_list;
- mParentChildItemTree.erase(id);
- }
- cat_list = getUnlockedCatArray(id);
- if(cat_list)
- {
- if (cat_list->size())
- {
- LL_WARNS(LOG_INV) << "Deleting cat " << id << " while it still has child cats" << LL_ENDL;
- }
- delete cat_list;
- mParentChildCategoryTree.erase(id);
- }
- addChangedMask(LLInventoryObserver::REMOVE, id);
-
- bool is_link_type = obj->getIsLinkType();
- if (is_link_type)
- {
- removeBacklinkInfo(obj->getUUID(), obj->getLinkedUUID());
- }
-
- // Can't have links to links, so there's no need for this update
- // if the item removed is a link. Can also skip if source of the
- // update is getting broken link info separately.
- if (fix_broken_links && !is_link_type)
- {
+ addChangedMask(LLInventoryObserver::REMOVE, id);
+ gInventory.notifyObservers();
+
+ item_list = getUnlockedItemArray(id);
+ if(item_list)
+ {
+ if (item_list->size())
+ {
+ LL_WARNS(LOG_INV) << "Deleting cat " << id << " while it still has child items" << LL_ENDL;
+ }
+ delete item_list;
+ mParentChildItemTree.erase(id);
+ }
+ cat_list = getUnlockedCatArray(id);
+ if(cat_list)
+ {
+ if (cat_list->size())
+ {
+ LL_WARNS(LOG_INV) << "Deleting cat " << id << " while it still has child cats" << LL_ENDL;
+ }
+ delete cat_list;
+ mParentChildCategoryTree.erase(id);
+ }
+ addChangedMask(LLInventoryObserver::REMOVE, id);
+
+ bool is_link_type = obj->getIsLinkType();
+ if (is_link_type)
+ {
+ removeBacklinkInfo(obj->getUUID(), obj->getLinkedUUID());
+ }
+
+ // Can't have links to links, so there's no need for this update
+ // if the item removed is a link. Can also skip if source of the
+ // update is getting broken link info separately.
+ if (fix_broken_links && !is_link_type)
+ {
rebuildLinkItems(links);
- }
- obj = nullptr; // delete obj
- if (do_notify_observers)
- {
- notifyObservers();
- }
+ }
+ obj = nullptr; // delete obj
+ if (do_notify_observers)
+ {
+ notifyObservers();
+ }
}
void LLInventoryModel::rebuildLinkItems(LLInventoryModel::item_array_t& items)
@@ -2100,23 +2100,23 @@ void LLInventoryModel::rebuildLinkItems(LLInventoryModel::item_array_t& items)
// remove it.
void LLInventoryModel::addObserver(LLInventoryObserver* observer)
{
- mObservers.insert(observer);
+ mObservers.insert(observer);
}
-
+
void LLInventoryModel::removeObserver(LLInventoryObserver* observer)
{
- mObservers.erase(observer);
+ mObservers.erase(observer);
}
BOOL LLInventoryModel::containsObserver(LLInventoryObserver* observer) const
{
- return mObservers.find(observer) != mObservers.end();
+ return mObservers.find(observer) != mObservers.end();
}
void LLInventoryModel::idleNotifyObservers()
{
- // *FIX: Think I want this conditional or moved elsewhere...
- handleResponses(true);
+ // *FIX: Think I want this conditional or moved elsewhere...
+ handleResponses(true);
if (mLinksRebuildList.size() > 0)
{
@@ -2131,78 +2131,78 @@ void LLInventoryModel::idleNotifyObservers()
mLinksRebuildList.clear();
notifyObservers();
}
-
- if (mModifyMask == LLInventoryObserver::NONE && (mChangedItemIDs.size() == 0))
- {
- return;
- }
- notifyObservers();
+
+ if (mModifyMask == LLInventoryObserver::NONE && (mChangedItemIDs.size() == 0))
+ {
+ return;
+ }
+ notifyObservers();
}
// Call this method when it's time to update everyone on a new state.
void LLInventoryModel::notifyObservers()
{
- if (mIsNotifyObservers)
- {
- // Within notifyObservers, something called notifyObservers
- // again. This type of recursion is unsafe because it causes items to be
- // processed twice, and this can easily lead to infinite loops.
- LL_WARNS(LOG_INV) << "Call was made to notifyObservers within notifyObservers!" << LL_ENDL;
- return;
- }
-
- mIsNotifyObservers = TRUE;
- for (observer_list_t::iterator iter = mObservers.begin();
- iter != mObservers.end(); )
- {
- LLInventoryObserver* observer = *iter;
- observer->changed(mModifyMask);
-
- // safe way to increment since changed may delete entries! (@!##%@!@&*!)
- iter = mObservers.upper_bound(observer);
- }
-
- // If there were any changes that arrived during notifyObservers,
- // shedule them for next loop
- mModifyMask = mModifyMaskBacklog;
- mChangedItemIDs.clear();
- mChangedItemIDs.insert(mChangedItemIDsBacklog.begin(), mChangedItemIDsBacklog.end());
- mAddedItemIDs.clear();
- mAddedItemIDs.insert(mAddedItemIDsBacklog.begin(), mAddedItemIDsBacklog.end());
-
- mModifyMaskBacklog = LLInventoryObserver::NONE;
- mChangedItemIDsBacklog.clear();
- mAddedItemIDsBacklog.clear();
-
- mIsNotifyObservers = FALSE;
+ if (mIsNotifyObservers)
+ {
+ // Within notifyObservers, something called notifyObservers
+ // again. This type of recursion is unsafe because it causes items to be
+ // processed twice, and this can easily lead to infinite loops.
+ LL_WARNS(LOG_INV) << "Call was made to notifyObservers within notifyObservers!" << LL_ENDL;
+ return;
+ }
+
+ mIsNotifyObservers = TRUE;
+ for (observer_list_t::iterator iter = mObservers.begin();
+ iter != mObservers.end(); )
+ {
+ LLInventoryObserver* observer = *iter;
+ observer->changed(mModifyMask);
+
+ // safe way to increment since changed may delete entries! (@!##%@!@&*!)
+ iter = mObservers.upper_bound(observer);
+ }
+
+ // If there were any changes that arrived during notifyObservers,
+ // shedule them for next loop
+ mModifyMask = mModifyMaskBacklog;
+ mChangedItemIDs.clear();
+ mChangedItemIDs.insert(mChangedItemIDsBacklog.begin(), mChangedItemIDsBacklog.end());
+ mAddedItemIDs.clear();
+ mAddedItemIDs.insert(mAddedItemIDsBacklog.begin(), mAddedItemIDsBacklog.end());
+
+ mModifyMaskBacklog = LLInventoryObserver::NONE;
+ mChangedItemIDsBacklog.clear();
+ mAddedItemIDsBacklog.clear();
+
+ mIsNotifyObservers = FALSE;
}
// store flag for change
// and id of object change applies to
-void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
-{
- if (mIsNotifyObservers)
- {
- // Something marked an item for change within a call to notifyObservers
- // (which is in the process of processing the list of items marked for change).
- // This means the change will have to be processed later.
- // It's preferable for this not to happen, but it's not an issue unless code
- // specifically wants to notifyObservers immediately (changes won't happen untill later)
- LL_WARNS(LOG_INV) << "Adding changed mask within notify observers! Change's processing will be performed on idle." << LL_ENDL;
- LLViewerInventoryItem *item = getItem(referent);
- if (item)
- {
- LL_WARNS(LOG_INV) << "Item " << item->getName() << LL_ENDL;
- }
- else
- {
- LLViewerInventoryCategory *cat = getCategory(referent);
- if (cat)
- {
- LL_WARNS(LOG_INV) << "Category " << cat->getName() << LL_ENDL;
- }
- }
- }
+void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
+{
+ if (mIsNotifyObservers)
+ {
+ // Something marked an item for change within a call to notifyObservers
+ // (which is in the process of processing the list of items marked for change).
+ // This means the change will have to be processed later.
+ // It's preferable for this not to happen, but it's not an issue unless code
+ // specifically wants to notifyObservers immediately (changes won't happen untill later)
+ LL_WARNS(LOG_INV) << "Adding changed mask within notify observers! Change's processing will be performed on idle." << LL_ENDL;
+ LLViewerInventoryItem *item = getItem(referent);
+ if (item)
+ {
+ LL_WARNS(LOG_INV) << "Item " << item->getName() << LL_ENDL;
+ }
+ else
+ {
+ LLViewerInventoryCategory *cat = getCategory(referent);
+ if (cat)
+ {
+ LL_WARNS(LOG_INV) << "Category " << cat->getName() << LL_ENDL;
+ }
+ }
+ }
if (mIsNotifyObservers)
{
@@ -2227,7 +2227,7 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
}
if (needs_update)
- {
+ {
if (mIsNotifyObservers)
{
mChangedItemIDsBacklog.insert(referent);
@@ -2256,42 +2256,42 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
mAddedItemIDs.insert(referent);
}
}
-
- // Update all linked items. Starting with just LABEL because I'm
- // not sure what else might need to be accounted for this.
- if (mask & LLInventoryObserver::LABEL)
- {
- addChangedMaskForLinks(referent, LLInventoryObserver::LABEL);
- }
- }
+
+ // Update all linked items. Starting with just LABEL because I'm
+ // not sure what else might need to be accounted for this.
+ if (mask & LLInventoryObserver::LABEL)
+ {
+ addChangedMaskForLinks(referent, LLInventoryObserver::LABEL);
+ }
+ }
}
bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const
{
- if(folder_id.isNull())
- {
- LL_WARNS(LOG_INV) << "Calling fetch descendents on NULL folder id!" << LL_ENDL;
- return false;
- }
- LLViewerInventoryCategory* cat = getCategory(folder_id);
- if(!cat)
- {
- LL_WARNS(LOG_INV) << "Asked to fetch descendents of non-existent folder: "
- << folder_id << LL_ENDL;
- return false;
- }
- //S32 known_descendents = 0;
- ///cat_array_t* categories = get_ptr_in_map(mParentChildCategoryTree, folder_id);
- //item_array_t* items = get_ptr_in_map(mParentChildItemTree, folder_id);
- //if(categories)
- //{
- // known_descendents += categories->size();
- //}
- //if(items)
- //{
- // known_descendents += items->size();
- //}
- return cat->fetch();
+ if(folder_id.isNull())
+ {
+ LL_WARNS(LOG_INV) << "Calling fetch descendents on NULL folder id!" << LL_ENDL;
+ return false;
+ }
+ LLViewerInventoryCategory* cat = getCategory(folder_id);
+ if(!cat)
+ {
+ LL_WARNS(LOG_INV) << "Asked to fetch descendents of non-existent folder: "
+ << folder_id << LL_ENDL;
+ return false;
+ }
+ //S32 known_descendents = 0;
+ ///cat_array_t* categories = get_ptr_in_map(mParentChildCategoryTree, folder_id);
+ //item_array_t* items = get_ptr_in_map(mParentChildItemTree, folder_id);
+ //if(categories)
+ //{
+ // known_descendents += categories->size();
+ //}
+ //if(items)
+ //{
+ // known_descendents += items->size();
+ //}
+ return cat->fetch();
}
//static
@@ -2318,138 +2318,138 @@ std::string LLInventoryModel::getInvCacheAddres(const LLUUID& owner_id)
}
void LLInventoryModel::cache(
- const LLUUID& parent_folder_id,
- const LLUUID& agent_id)
+ const LLUUID& parent_folder_id,
+ const LLUUID& agent_id)
{
- LL_DEBUGS(LOG_INV) << "Caching " << parent_folder_id << " for " << agent_id
- << LL_ENDL;
- LLViewerInventoryCategory* root_cat = getCategory(parent_folder_id);
- if(!root_cat) return;
- cat_array_t categories;
- categories.push_back(root_cat);
- item_array_t items;
-
- LLCanCache can_cache(this);
- can_cache(root_cat, NULL);
- collectDescendentsIf(
- parent_folder_id,
- categories,
- items,
- INCLUDE_TRASH,
- can_cache);
+ LL_DEBUGS(LOG_INV) << "Caching " << parent_folder_id << " for " << agent_id
+ << LL_ENDL;
+ LLViewerInventoryCategory* root_cat = getCategory(parent_folder_id);
+ if(!root_cat) return;
+ cat_array_t categories;
+ categories.push_back(root_cat);
+ item_array_t items;
+
+ LLCanCache can_cache(this);
+ can_cache(root_cat, NULL);
+ collectDescendentsIf(
+ parent_folder_id,
+ categories,
+ items,
+ INCLUDE_TRASH,
+ can_cache);
// Use temporary file to avoid potential conflicts with other
// instances (even a 'read only' instance unzips into a file)
std::string temp_file = gDirUtilp->getTempFilename();
- saveToFile(temp_file, categories, items);
+ saveToFile(temp_file, categories, items);
std::string gzip_filename = getInvCacheAddres(agent_id);
- gzip_filename.append(".gz");
- if(gzip_file(temp_file, gzip_filename))
- {
- LL_DEBUGS(LOG_INV) << "Successfully compressed " << temp_file << " to " << gzip_filename << LL_ENDL;
- LLFile::remove(temp_file);
- }
- else
- {
- LL_WARNS(LOG_INV) << "Unable to compress " << temp_file << " into " << gzip_filename << LL_ENDL;
- }
+ gzip_filename.append(".gz");
+ if(gzip_file(temp_file, gzip_filename))
+ {
+ LL_DEBUGS(LOG_INV) << "Successfully compressed " << temp_file << " to " << gzip_filename << LL_ENDL;
+ LLFile::remove(temp_file);
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "Unable to compress " << temp_file << " into " << gzip_filename << LL_ENDL;
+ }
}
void LLInventoryModel::addCategory(LLViewerInventoryCategory* category)
{
- //LL_INFOS(LOG_INV) << "LLInventoryModel::addCategory()" << LL_ENDL;
- if(category)
- {
- // We aren't displaying the Meshes folder
- if (category->mPreferredType == LLFolderType::FT_MESH)
- {
- return;
- }
-
- // try to localize default names first. See EXT-8319, EXT-7051.
- category->localizeName();
-
- // Insert category uniquely into the map
- mCategoryMap[category->getUUID()] = category; // LLPointer will deref and delete the old one
- //mInventory[category->getUUID()] = category;
- }
+ //LL_INFOS(LOG_INV) << "LLInventoryModel::addCategory()" << LL_ENDL;
+ if(category)
+ {
+ // We aren't displaying the Meshes folder
+ if (category->mPreferredType == LLFolderType::FT_MESH)
+ {
+ return;
+ }
+
+ // try to localize default names first. See EXT-8319, EXT-7051.
+ category->localizeName();
+
+ // Insert category uniquely into the map
+ mCategoryMap[category->getUUID()] = category; // LLPointer will deref and delete the old one
+ //mInventory[category->getUUID()] = category;
+ }
}
bool LLInventoryModel::hasBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id) const
{
- std::pair <backlink_mmap_t::const_iterator, backlink_mmap_t::const_iterator> range;
- range = mBacklinkMMap.equal_range(target_id);
- for (backlink_mmap_t::const_iterator it = range.first; it != range.second; ++it)
- {
- if (it->second == link_id)
- {
- return true;
- }
- }
- return false;
+ std::pair <backlink_mmap_t::const_iterator, backlink_mmap_t::const_iterator> range;
+ range = mBacklinkMMap.equal_range(target_id);
+ for (backlink_mmap_t::const_iterator it = range.first; it != range.second; ++it)
+ {
+ if (it->second == link_id)
+ {
+ return true;
+ }
+ }
+ return false;
}
void LLInventoryModel::addBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id)
{
- if (!hasBacklinkInfo(link_id, target_id))
- {
- mBacklinkMMap.insert(std::make_pair(target_id, link_id));
- }
+ if (!hasBacklinkInfo(link_id, target_id))
+ {
+ mBacklinkMMap.insert(std::make_pair(target_id, link_id));
+ }
}
void LLInventoryModel::removeBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id)
{
- std::pair <backlink_mmap_t::iterator, backlink_mmap_t::iterator> range;
- range = mBacklinkMMap.equal_range(target_id);
- for (backlink_mmap_t::iterator it = range.first; it != range.second; )
- {
- if (it->second == link_id)
- {
- backlink_mmap_t::iterator delete_it = it; // iterator will be invalidated by erase.
- ++it;
- mBacklinkMMap.erase(delete_it);
- }
- else
- {
- ++it;
- }
- }
+ std::pair <backlink_mmap_t::iterator, backlink_mmap_t::iterator> range;
+ range = mBacklinkMMap.equal_range(target_id);
+ for (backlink_mmap_t::iterator it = range.first; it != range.second; )
+ {
+ if (it->second == link_id)
+ {
+ backlink_mmap_t::iterator delete_it = it; // iterator will be invalidated by erase.
+ ++it;
+ mBacklinkMMap.erase(delete_it);
+ }
+ else
+ {
+ ++it;
+ }
+ }
}
void LLInventoryModel::addItem(LLViewerInventoryItem* item)
{
- llassert(item);
- if(item)
- {
- if (item->getType() <= LLAssetType::AT_NONE)
- {
- LL_WARNS(LOG_INV) << "Got bad asset type for item [ name: " << item->getName()
- << " type: " << item->getType()
- << " inv-type: " << item->getInventoryType() << " ], ignoring." << LL_ENDL;
- return;
- }
-
- if (LLAssetType::lookup(item->getType()) == LLAssetType::BADLOOKUP)
- {
- if (item->getType() >= LLAssetType::AT_COUNT)
- {
- // Not yet supported.
- LL_DEBUGS(LOG_INV) << "Got unknown asset type for item [ name: " << item->getName()
- << " type: " << item->getType()
- << " inv-type: " << item->getInventoryType() << " ]." << LL_ENDL;
- }
- else
- {
- LL_WARNS(LOG_INV) << "Got unknown asset type for item [ name: " << item->getName()
- << " type: " << item->getType()
- << " inv-type: " << item->getInventoryType() << " ]." << LL_ENDL;
- }
- }
-
- // This condition means that we tried to add a link without the baseobj being in memory.
- // The item will show up as a broken link.
- if (item->getIsBrokenLink())
- {
+ llassert(item);
+ if(item)
+ {
+ if (item->getType() <= LLAssetType::AT_NONE)
+ {
+ LL_WARNS(LOG_INV) << "Got bad asset type for item [ name: " << item->getName()
+ << " type: " << item->getType()
+ << " inv-type: " << item->getInventoryType() << " ], ignoring." << LL_ENDL;
+ return;
+ }
+
+ if (LLAssetType::lookup(item->getType()) == LLAssetType::BADLOOKUP)
+ {
+ if (item->getType() >= LLAssetType::AT_COUNT)
+ {
+ // Not yet supported.
+ LL_DEBUGS(LOG_INV) << "Got unknown asset type for item [ name: " << item->getName()
+ << " type: " << item->getType()
+ << " inv-type: " << item->getInventoryType() << " ]." << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "Got unknown asset type for item [ name: " << item->getName()
+ << " type: " << item->getType()
+ << " inv-type: " << item->getInventoryType() << " ]." << LL_ENDL;
+ }
+ }
+
+ // This condition means that we tried to add a link without the baseobj being in memory.
+ // The item will show up as a broken link.
+ if (item->getIsBrokenLink())
+ {
if (item->getAssetUUID().notNull()
&& LLInventoryModelBackgroundFetch::getInstance()->folderFetchActive())
{
@@ -2485,7 +2485,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item)
<< " itemID: " << item->getUUID()
<< " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << LL_ENDL;
}
- }
+ }
if (!mPossiblyBrockenLinks.empty())
{
// check if we are waiting for this item
@@ -2496,705 +2496,705 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item)
mPossiblyBrockenLinks.erase(iter);
}
}
- if (item->getIsLinkType())
- {
- // Add back-link from linked-to UUID.
- const LLUUID& link_id = item->getUUID();
- const LLUUID& target_id = item->getLinkedUUID();
- addBacklinkInfo(link_id, target_id);
- }
- mItemMap[item->getUUID()] = item;
- }
+ if (item->getIsLinkType())
+ {
+ // Add back-link from linked-to UUID.
+ const LLUUID& link_id = item->getUUID();
+ const LLUUID& target_id = item->getLinkedUUID();
+ addBacklinkInfo(link_id, target_id);
+ }
+ mItemMap[item->getUUID()] = item;
+ }
}
// Empty the entire contents
void LLInventoryModel::empty()
{
-// LL_INFOS(LOG_INV) << "LLInventoryModel::empty()" << LL_ENDL;
- std::for_each(
- mParentChildCategoryTree.begin(),
- mParentChildCategoryTree.end(),
- DeletePairedPointer());
- mParentChildCategoryTree.clear();
- std::for_each(
- mParentChildItemTree.begin(),
- mParentChildItemTree.end(),
- DeletePairedPointer());
- mParentChildItemTree.clear();
- mBacklinkMMap.clear(); // forget all backlink information.
- mCategoryMap.clear(); // remove all references (should delete entries)
- mItemMap.clear(); // remove all references (should delete entries)
- mLastItem = NULL;
- //mInventory.clear();
+// LL_INFOS(LOG_INV) << "LLInventoryModel::empty()" << LL_ENDL;
+ std::for_each(
+ mParentChildCategoryTree.begin(),
+ mParentChildCategoryTree.end(),
+ DeletePairedPointer());
+ mParentChildCategoryTree.clear();
+ std::for_each(
+ mParentChildItemTree.begin(),
+ mParentChildItemTree.end(),
+ DeletePairedPointer());
+ mParentChildItemTree.clear();
+ mBacklinkMMap.clear(); // forget all backlink information.
+ mCategoryMap.clear(); // remove all references (should delete entries)
+ mItemMap.clear(); // remove all references (should delete entries)
+ mLastItem = NULL;
+ //mInventory.clear();
}
void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const
{
- LLViewerInventoryCategory* cat = getCategory(update.mCategoryID);
- if(cat)
- {
- S32 version = cat->getVersion();
- if(version != LLViewerInventoryCategory::VERSION_UNKNOWN)
- {
- S32 descendents_server = cat->getDescendentCount();
- S32 descendents_actual = cat->getViewerDescendentCount();
- if(descendents_server == descendents_actual)
- {
- descendents_actual += update.mDescendentDelta;
- cat->setDescendentCount(descendents_actual);
- cat->setVersion(++version);
- LL_DEBUGS(LOG_INV) << "accounted: '" << cat->getName() << "' "
- << version << " with " << descendents_actual
- << " descendents." << LL_ENDL;
- }
- else
- {
- // Error condition, this means that the category did not register that
- // it got new descendents (perhaps because it is still being loaded)
- // which means its descendent count will be wrong.
- LL_WARNS(LOG_INV) << "Accounting failed for '" << cat->getName() << "' version:"
- << version << " due to mismatched descendent count: server == "
- << descendents_server << ", viewer == " << descendents_actual << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS(LOG_INV) << "Accounting failed for '" << cat->getName() << "' version: unknown ("
- << version << ")" << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS(LOG_INV) << "No category found for update " << update.mCategoryID << LL_ENDL;
- }
+ LLViewerInventoryCategory* cat = getCategory(update.mCategoryID);
+ if(cat)
+ {
+ S32 version = cat->getVersion();
+ if(version != LLViewerInventoryCategory::VERSION_UNKNOWN)
+ {
+ S32 descendents_server = cat->getDescendentCount();
+ S32 descendents_actual = cat->getViewerDescendentCount();
+ if(descendents_server == descendents_actual)
+ {
+ descendents_actual += update.mDescendentDelta;
+ cat->setDescendentCount(descendents_actual);
+ cat->setVersion(++version);
+ LL_DEBUGS(LOG_INV) << "accounted: '" << cat->getName() << "' "
+ << version << " with " << descendents_actual
+ << " descendents." << LL_ENDL;
+ }
+ else
+ {
+ // Error condition, this means that the category did not register that
+ // it got new descendents (perhaps because it is still being loaded)
+ // which means its descendent count will be wrong.
+ LL_WARNS(LOG_INV) << "Accounting failed for '" << cat->getName() << "' version:"
+ << version << " due to mismatched descendent count: server == "
+ << descendents_server << ", viewer == " << descendents_actual << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "Accounting failed for '" << cat->getName() << "' version: unknown ("
+ << version << ")" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "No category found for update " << update.mCategoryID << LL_ENDL;
+ }
}
void LLInventoryModel::accountForUpdate(
- const LLInventoryModel::update_list_t& update)
+ const LLInventoryModel::update_list_t& update)
{
- update_list_t::const_iterator it = update.begin();
- update_list_t::const_iterator end = update.end();
- for(; it != end; ++it)
- {
- accountForUpdate(*it);
- }
+ update_list_t::const_iterator it = update.begin();
+ update_list_t::const_iterator end = update.end();
+ for(; it != end; ++it)
+ {
+ accountForUpdate(*it);
+ }
}
void LLInventoryModel::accountForUpdate(
- const LLInventoryModel::update_map_t& update)
+ const LLInventoryModel::update_map_t& update)
{
- LLCategoryUpdate up;
- update_map_t::const_iterator it = update.begin();
- update_map_t::const_iterator end = update.end();
- for(; it != end; ++it)
- {
- up.mCategoryID = (*it).first;
- up.mDescendentDelta = (*it).second.mValue;
- accountForUpdate(up);
- }
+ LLCategoryUpdate up;
+ update_map_t::const_iterator it = update.begin();
+ update_map_t::const_iterator end = update.end();
+ for(; it != end; ++it)
+ {
+ up.mCategoryID = (*it).first;
+ up.mDescendentDelta = (*it).second.mValue;
+ accountForUpdate(up);
+ }
}
LLInventoryModel::EHasChildren LLInventoryModel::categoryHasChildren(
- const LLUUID& cat_id) const
+ const LLUUID& cat_id) const
{
- LLViewerInventoryCategory* cat = getCategory(cat_id);
- if(!cat) return CHILDREN_NO;
- if(cat->getDescendentCount() > 0)
- {
- return CHILDREN_YES;
- }
- if(cat->getDescendentCount() == 0)
- {
- return CHILDREN_NO;
- }
- if((cat->getDescendentCount() == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN)
- || (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN))
- {
- return CHILDREN_MAYBE;
- }
-
- // Shouldn't have to run this, but who knows.
- parent_cat_map_t::const_iterator cat_it = mParentChildCategoryTree.find(cat->getUUID());
- if (cat_it != mParentChildCategoryTree.end() && cat_it->second->size() > 0)
- {
- return CHILDREN_YES;
- }
- parent_item_map_t::const_iterator item_it = mParentChildItemTree.find(cat->getUUID());
- if (item_it != mParentChildItemTree.end() && item_it->second->size() > 0)
- {
- return CHILDREN_YES;
- }
-
- return CHILDREN_NO;
+ LLViewerInventoryCategory* cat = getCategory(cat_id);
+ if(!cat) return CHILDREN_NO;
+ if(cat->getDescendentCount() > 0)
+ {
+ return CHILDREN_YES;
+ }
+ if(cat->getDescendentCount() == 0)
+ {
+ return CHILDREN_NO;
+ }
+ if((cat->getDescendentCount() == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN)
+ || (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN))
+ {
+ return CHILDREN_MAYBE;
+ }
+
+ // Shouldn't have to run this, but who knows.
+ parent_cat_map_t::const_iterator cat_it = mParentChildCategoryTree.find(cat->getUUID());
+ if (cat_it != mParentChildCategoryTree.end() && cat_it->second->size() > 0)
+ {
+ return CHILDREN_YES;
+ }
+ parent_item_map_t::const_iterator item_it = mParentChildItemTree.find(cat->getUUID());
+ if (item_it != mParentChildItemTree.end() && item_it->second->size() > 0)
+ {
+ return CHILDREN_YES;
+ }
+
+ return CHILDREN_NO;
}
bool LLInventoryModel::isCategoryComplete(const LLUUID& cat_id) const
{
- LLViewerInventoryCategory* cat = getCategory(cat_id);
- if(cat && (cat->getVersion()!=LLViewerInventoryCategory::VERSION_UNKNOWN))
- {
- S32 descendents_server = cat->getDescendentCount();
- S32 descendents_actual = cat->getViewerDescendentCount();
- if(descendents_server == descendents_actual)
- {
- return true;
- }
- }
- return false;
+ LLViewerInventoryCategory* cat = getCategory(cat_id);
+ if(cat && (cat->getVersion()!=LLViewerInventoryCategory::VERSION_UNKNOWN))
+ {
+ S32 descendents_server = cat->getDescendentCount();
+ S32 descendents_actual = cat->getViewerDescendentCount();
+ if(descendents_server == descendents_actual)
+ {
+ return true;
+ }
+ }
+ return false;
}
bool LLInventoryModel::loadSkeleton(
- const LLSD& options,
- const LLUUID& owner_id)
+ const LLSD& options,
+ const LLUUID& owner_id)
{
LL_PROFILE_ZONE_SCOPED;
- LL_DEBUGS(LOG_INV) << "importing inventory skeleton for " << owner_id << LL_ENDL;
-
- typedef std::set<LLPointer<LLViewerInventoryCategory>, InventoryIDPtrLess> cat_set_t;
- cat_set_t temp_cats;
- bool rv = true;
-
- for(LLSD::array_const_iterator it = options.beginArray(),
- end = options.endArray(); it != end; ++it)
- {
- LLSD name = (*it)["name"];
- LLSD folder_id = (*it)["folder_id"];
- LLSD parent_id = (*it)["parent_id"];
- LLSD version = (*it)["version"];
- if(name.isDefined()
- && folder_id.isDefined()
- && parent_id.isDefined()
- && version.isDefined()
- && folder_id.asUUID().notNull() // if an id is null, it locks the viewer.
- )
- {
- LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id);
- cat->rename(name.asString());
- cat->setUUID(folder_id.asUUID());
- cat->setParent(parent_id.asUUID());
-
- LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
- LLSD type_default = (*it)["type_default"];
- if(type_default.isDefined())
+ LL_DEBUGS(LOG_INV) << "importing inventory skeleton for " << owner_id << LL_ENDL;
+
+ typedef std::set<LLPointer<LLViewerInventoryCategory>, InventoryIDPtrLess> cat_set_t;
+ cat_set_t temp_cats;
+ bool rv = true;
+
+ for(LLSD::array_const_iterator it = options.beginArray(),
+ end = options.endArray(); it != end; ++it)
+ {
+ LLSD name = (*it)["name"];
+ LLSD folder_id = (*it)["folder_id"];
+ LLSD parent_id = (*it)["parent_id"];
+ LLSD version = (*it)["version"];
+ if(name.isDefined()
+ && folder_id.isDefined()
+ && parent_id.isDefined()
+ && version.isDefined()
+ && folder_id.asUUID().notNull() // if an id is null, it locks the viewer.
+ )
+ {
+ LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id);
+ cat->rename(name.asString());
+ cat->setUUID(folder_id.asUUID());
+ cat->setParent(parent_id.asUUID());
+
+ LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
+ LLSD type_default = (*it)["type_default"];
+ if(type_default.isDefined())
{
- preferred_type = (LLFolderType::EType)type_default.asInteger();
+ preferred_type = (LLFolderType::EType)type_default.asInteger();
}
cat->setPreferredType(preferred_type);
- cat->setVersion(version.asInteger());
+ cat->setVersion(version.asInteger());
temp_cats.insert(cat);
- }
- else
- {
- LL_WARNS(LOG_INV) << "Unable to import near " << name.asString() << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "Unable to import near " << name.asString() << LL_ENDL;
rv = false;
- }
- }
-
- S32 cached_category_count = 0;
- S32 cached_item_count = 0;
- if(!temp_cats.empty())
- {
- update_map_t child_counts;
- cat_array_t categories;
- item_array_t items;
- changed_items_t categories_to_update;
- item_array_t possible_broken_links;
- cat_set_t invalid_categories; // Used to mark categories that weren't successfully loaded.
- std::string inventory_filename = getInvCacheAddres(owner_id);
- const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN;
- std::string gzip_filename(inventory_filename);
- gzip_filename.append(".gz");
- LLFILE* fp = LLFile::fopen(gzip_filename, "rb");
- bool remove_inventory_file = false;
- if(fp)
- {
- fclose(fp);
- fp = NULL;
- if(gunzip_file(gzip_filename, inventory_filename))
- {
- // we only want to remove the inventory file if it was
- // gzipped before we loaded, and we successfully
- // gunziped it.
- remove_inventory_file = true;
- }
- else
- {
- LL_INFOS(LOG_INV) << "Unable to gunzip " << gzip_filename << LL_ENDL;
- }
- }
- bool is_cache_obsolete = false;
- if (loadFromFile(inventory_filename, categories, items, categories_to_update, is_cache_obsolete))
- {
- // We were able to find a cache of files. So, use what we
- // found to generate a set of categories we should add. We
- // will go through each category loaded and if the version
- // does not match, invalidate the version.
- S32 count = categories.size();
- cat_set_t::iterator not_cached = temp_cats.end();
- std::set<LLUUID> cached_ids;
- for(S32 i = 0; i < count; ++i)
- {
- LLViewerInventoryCategory* cat = categories[i];
- cat_set_t::iterator cit = temp_cats.find(cat);
- if (cit == temp_cats.end())
- {
- continue; // cache corruption?? not sure why this happens -SJB
- }
- LLViewerInventoryCategory* tcat = *cit;
-
- if (categories_to_update.find(tcat->getUUID()) != categories_to_update.end())
- {
- tcat->setVersion(NO_VERSION);
- LL_WARNS() << "folder to update: " << tcat->getName() << LL_ENDL;
- }
-
- // we can safely ignore anything loaded from file, but
- // not sent down in the skeleton. Must have been removed from inventory.
- if (cit == not_cached)
- {
- continue;
- }
- else if (cat->getVersion() != tcat->getVersion())
- {
- // if the cached version does not match the server version,
- // throw away the version we have so we can fetch the
- // correct contents the next time the viewer opens the folder.
- tcat->setVersion(NO_VERSION);
- }
- else
- {
- cached_ids.insert(tcat->getUUID());
+ }
+ }
+
+ S32 cached_category_count = 0;
+ S32 cached_item_count = 0;
+ if(!temp_cats.empty())
+ {
+ update_map_t child_counts;
+ cat_array_t categories;
+ item_array_t items;
+ changed_items_t categories_to_update;
+ item_array_t possible_broken_links;
+ cat_set_t invalid_categories; // Used to mark categories that weren't successfully loaded.
+ std::string inventory_filename = getInvCacheAddres(owner_id);
+ const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN;
+ std::string gzip_filename(inventory_filename);
+ gzip_filename.append(".gz");
+ LLFILE* fp = LLFile::fopen(gzip_filename, "rb");
+ bool remove_inventory_file = false;
+ if(fp)
+ {
+ fclose(fp);
+ fp = NULL;
+ if(gunzip_file(gzip_filename, inventory_filename))
+ {
+ // we only want to remove the inventory file if it was
+ // gzipped before we loaded, and we successfully
+ // gunziped it.
+ remove_inventory_file = true;
+ }
+ else
+ {
+ LL_INFOS(LOG_INV) << "Unable to gunzip " << gzip_filename << LL_ENDL;
+ }
+ }
+ bool is_cache_obsolete = false;
+ if (loadFromFile(inventory_filename, categories, items, categories_to_update, is_cache_obsolete))
+ {
+ // We were able to find a cache of files. So, use what we
+ // found to generate a set of categories we should add. We
+ // will go through each category loaded and if the version
+ // does not match, invalidate the version.
+ S32 count = categories.size();
+ cat_set_t::iterator not_cached = temp_cats.end();
+ std::set<LLUUID> cached_ids;
+ for(S32 i = 0; i < count; ++i)
+ {
+ LLViewerInventoryCategory* cat = categories[i];
+ cat_set_t::iterator cit = temp_cats.find(cat);
+ if (cit == temp_cats.end())
+ {
+ continue; // cache corruption?? not sure why this happens -SJB
+ }
+ LLViewerInventoryCategory* tcat = *cit;
+
+ if (categories_to_update.find(tcat->getUUID()) != categories_to_update.end())
+ {
+ tcat->setVersion(NO_VERSION);
+ LL_WARNS() << "folder to update: " << tcat->getName() << LL_ENDL;
+ }
+
+ // we can safely ignore anything loaded from file, but
+ // not sent down in the skeleton. Must have been removed from inventory.
+ if (cit == not_cached)
+ {
+ continue;
+ }
+ else if (cat->getVersion() != tcat->getVersion())
+ {
+ // if the cached version does not match the server version,
+ // throw away the version we have so we can fetch the
+ // correct contents the next time the viewer opens the folder.
+ tcat->setVersion(NO_VERSION);
+ }
+ else
+ {
+ cached_ids.insert(tcat->getUUID());
// At the moment download does not provide a thumbnail
// uuid, use the one from cache
tcat->setThumbnailUUID(cat->getThumbnailUUID());
- }
- }
-
- // go ahead and add the cats returned during the download
- std::set<LLUUID>::const_iterator not_cached_id = cached_ids.end();
- cached_category_count = cached_ids.size();
- for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
- {
- if(cached_ids.find((*it)->getUUID()) == not_cached_id)
- {
- // this check is performed so that we do not
- // mark new folders in the skeleton (and not in cache)
- // as being cached.
- LLViewerInventoryCategory *llvic = (*it);
- llvic->setVersion(NO_VERSION);
- }
- addCategory(*it);
- ++child_counts[(*it)->getParentUUID()];
- }
-
- // Add all the items loaded which are parented to a
- // category with a correctly cached parent
- S32 bad_link_count = 0;
- S32 good_link_count = 0;
- S32 recovered_link_count = 0;
- cat_map_t::iterator unparented = mCategoryMap.end();
- for(item_array_t::const_iterator item_iter = items.begin();
- item_iter != items.end();
- ++item_iter)
- {
- LLViewerInventoryItem *item = (*item_iter).get();
- const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID());
-
- if(cit != unparented)
- {
- const LLViewerInventoryCategory* cat = cit->second.get();
- if(cat->getVersion() != NO_VERSION)
- {
- // This can happen if the linked object's baseobj is removed from the cache but the linked object is still in the cache.
- if (item->getIsBrokenLink())
- {
- //bad_link_count++;
- LL_DEBUGS(LOG_INV) << "Attempted to add cached link item without baseobj present ( name: "
- << item->getName() << " itemID: " << item->getUUID()
- << " assetID: " << item->getAssetUUID()
- << " ). Ignoring and invalidating " << cat->getName() << " . " << LL_ENDL;
- possible_broken_links.push_back(item);
- continue;
- }
- else if (item->getIsLinkType())
- {
- good_link_count++;
- }
- addItem(item);
- cached_item_count += 1;
- ++child_counts[cat->getUUID()];
- }
- }
- }
- if (possible_broken_links.size() > 0)
- {
- for(item_array_t::const_iterator item_iter = possible_broken_links.begin();
- item_iter != possible_broken_links.end();
- ++item_iter)
- {
- LLViewerInventoryItem *item = (*item_iter).get();
- const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID());
- const LLViewerInventoryCategory* cat = cit->second.get();
- if (item->getIsBrokenLink())
- {
- bad_link_count++;
- invalid_categories.insert(cit->second);
- //LL_INFOS(LOG_INV) << "link still broken: " << item->getName() << " in folder " << cat->getName() << LL_ENDL;
- }
- else
- {
- // was marked as broken because of loading order, its actually fine to load
- addItem(item);
- cached_item_count += 1;
- ++child_counts[cat->getUUID()];
- recovered_link_count++;
- }
- }
-
- LL_DEBUGS(LOG_INV) << "Attempted to add " << bad_link_count
- << " cached link items without baseobj present. "
- << good_link_count << " link items were successfully added. "
- << recovered_link_count << " links added in recovery. "
- << "The corresponding categories were invalidated." << LL_ENDL;
- }
-
- }
- else
- {
- // go ahead and add everything after stripping the version
- // information.
- for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
- {
- LLViewerInventoryCategory *llvic = (*it);
- llvic->setVersion(NO_VERSION);
- addCategory(*it);
- }
- }
-
- // Invalidate all categories that failed fetching descendents for whatever
- // reason (e.g. one of the descendents was a broken link).
- for (cat_set_t::iterator invalid_cat_it = invalid_categories.begin();
- invalid_cat_it != invalid_categories.end();
- invalid_cat_it++)
- {
- LLViewerInventoryCategory* cat = (*invalid_cat_it).get();
- cat->setVersion(NO_VERSION);
- LL_DEBUGS(LOG_INV) << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << LL_ENDL;
- }
- if (invalid_categories.size() > 0)
- {
- LL_DEBUGS(LOG_INV) << "Invalidated " << invalid_categories.size() << " categories due to invalid descendents cache" << LL_ENDL;
- }
-
- // At this point, we need to set the known descendents for each
- // category which successfully cached so that we do not
- // needlessly fetch descendents for categories which we have.
- update_map_t::const_iterator no_child_counts = child_counts.end();
- for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
- {
- LLViewerInventoryCategory* cat = (*it).get();
- if(cat->getVersion() != NO_VERSION)
- {
- update_map_t::const_iterator the_count = child_counts.find(cat->getUUID());
- if(the_count != no_child_counts)
- {
- const S32 num_descendents = (*the_count).second.mValue;
- cat->setDescendentCount(num_descendents);
- }
- else
- {
- cat->setDescendentCount(0);
- }
- }
- }
-
- if(remove_inventory_file)
- {
- // clean up the gunzipped file.
- LLFile::remove(inventory_filename);
- }
- if(is_cache_obsolete)
- {
- // If out of date, remove the gzipped file too.
- LL_WARNS(LOG_INV) << "Inv cache out of date, removing" << LL_ENDL;
- LLFile::remove(gzip_filename);
- }
- categories.clear(); // will unref and delete entries
- }
-
- LL_INFOS(LOG_INV) << "Successfully loaded " << cached_category_count
- << " categories and " << cached_item_count << " items from cache."
- << LL_ENDL;
-
- return rv;
+ }
+ }
+
+ // go ahead and add the cats returned during the download
+ std::set<LLUUID>::const_iterator not_cached_id = cached_ids.end();
+ cached_category_count = cached_ids.size();
+ for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
+ {
+ if(cached_ids.find((*it)->getUUID()) == not_cached_id)
+ {
+ // this check is performed so that we do not
+ // mark new folders in the skeleton (and not in cache)
+ // as being cached.
+ LLViewerInventoryCategory *llvic = (*it);
+ llvic->setVersion(NO_VERSION);
+ }
+ addCategory(*it);
+ ++child_counts[(*it)->getParentUUID()];
+ }
+
+ // Add all the items loaded which are parented to a
+ // category with a correctly cached parent
+ S32 bad_link_count = 0;
+ S32 good_link_count = 0;
+ S32 recovered_link_count = 0;
+ cat_map_t::iterator unparented = mCategoryMap.end();
+ for(item_array_t::const_iterator item_iter = items.begin();
+ item_iter != items.end();
+ ++item_iter)
+ {
+ LLViewerInventoryItem *item = (*item_iter).get();
+ const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID());
+
+ if(cit != unparented)
+ {
+ const LLViewerInventoryCategory* cat = cit->second.get();
+ if(cat->getVersion() != NO_VERSION)
+ {
+ // This can happen if the linked object's baseobj is removed from the cache but the linked object is still in the cache.
+ if (item->getIsBrokenLink())
+ {
+ //bad_link_count++;
+ LL_DEBUGS(LOG_INV) << "Attempted to add cached link item without baseobj present ( name: "
+ << item->getName() << " itemID: " << item->getUUID()
+ << " assetID: " << item->getAssetUUID()
+ << " ). Ignoring and invalidating " << cat->getName() << " . " << LL_ENDL;
+ possible_broken_links.push_back(item);
+ continue;
+ }
+ else if (item->getIsLinkType())
+ {
+ good_link_count++;
+ }
+ addItem(item);
+ cached_item_count += 1;
+ ++child_counts[cat->getUUID()];
+ }
+ }
+ }
+ if (possible_broken_links.size() > 0)
+ {
+ for(item_array_t::const_iterator item_iter = possible_broken_links.begin();
+ item_iter != possible_broken_links.end();
+ ++item_iter)
+ {
+ LLViewerInventoryItem *item = (*item_iter).get();
+ const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID());
+ const LLViewerInventoryCategory* cat = cit->second.get();
+ if (item->getIsBrokenLink())
+ {
+ bad_link_count++;
+ invalid_categories.insert(cit->second);
+ //LL_INFOS(LOG_INV) << "link still broken: " << item->getName() << " in folder " << cat->getName() << LL_ENDL;
+ }
+ else
+ {
+ // was marked as broken because of loading order, its actually fine to load
+ addItem(item);
+ cached_item_count += 1;
+ ++child_counts[cat->getUUID()];
+ recovered_link_count++;
+ }
+ }
+
+ LL_DEBUGS(LOG_INV) << "Attempted to add " << bad_link_count
+ << " cached link items without baseobj present. "
+ << good_link_count << " link items were successfully added. "
+ << recovered_link_count << " links added in recovery. "
+ << "The corresponding categories were invalidated." << LL_ENDL;
+ }
+
+ }
+ else
+ {
+ // go ahead and add everything after stripping the version
+ // information.
+ for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
+ {
+ LLViewerInventoryCategory *llvic = (*it);
+ llvic->setVersion(NO_VERSION);
+ addCategory(*it);
+ }
+ }
+
+ // Invalidate all categories that failed fetching descendents for whatever
+ // reason (e.g. one of the descendents was a broken link).
+ for (cat_set_t::iterator invalid_cat_it = invalid_categories.begin();
+ invalid_cat_it != invalid_categories.end();
+ invalid_cat_it++)
+ {
+ LLViewerInventoryCategory* cat = (*invalid_cat_it).get();
+ cat->setVersion(NO_VERSION);
+ LL_DEBUGS(LOG_INV) << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << LL_ENDL;
+ }
+ if (invalid_categories.size() > 0)
+ {
+ LL_DEBUGS(LOG_INV) << "Invalidated " << invalid_categories.size() << " categories due to invalid descendents cache" << LL_ENDL;
+ }
+
+ // At this point, we need to set the known descendents for each
+ // category which successfully cached so that we do not
+ // needlessly fetch descendents for categories which we have.
+ update_map_t::const_iterator no_child_counts = child_counts.end();
+ for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
+ {
+ LLViewerInventoryCategory* cat = (*it).get();
+ if(cat->getVersion() != NO_VERSION)
+ {
+ update_map_t::const_iterator the_count = child_counts.find(cat->getUUID());
+ if(the_count != no_child_counts)
+ {
+ const S32 num_descendents = (*the_count).second.mValue;
+ cat->setDescendentCount(num_descendents);
+ }
+ else
+ {
+ cat->setDescendentCount(0);
+ }
+ }
+ }
+
+ if(remove_inventory_file)
+ {
+ // clean up the gunzipped file.
+ LLFile::remove(inventory_filename);
+ }
+ if(is_cache_obsolete)
+ {
+ // If out of date, remove the gzipped file too.
+ LL_WARNS(LOG_INV) << "Inv cache out of date, removing" << LL_ENDL;
+ LLFile::remove(gzip_filename);
+ }
+ categories.clear(); // will unref and delete entries
+ }
+
+ LL_INFOS(LOG_INV) << "Successfully loaded " << cached_category_count
+ << " categories and " << cached_item_count << " items from cache."
+ << LL_ENDL;
+
+ return rv;
}
// This is a brute force method to rebuild the entire parent-child
// relations. The overall operation has O(NlogN) performance, which
-// should be sufficient for our needs.
+// should be sufficient for our needs.
void LLInventoryModel::buildParentChildMap()
{
- LL_INFOS(LOG_INV) << "LLInventoryModel::buildParentChildMap()" << LL_ENDL;
-
- // *NOTE: I am skipping the logic around folder version
- // synchronization here because it seems if a folder is lost, we
- // might actually want to invalidate it at that point - not
- // attempt to cache. More time & thought is necessary.
-
- // First the categories. We'll copy all of the categories into a
- // temporary container to iterate over (oh for real iterators.)
- // While we're at it, we'll allocate the arrays in the trees.
- cat_array_t cats;
- cat_array_t* catsp;
- item_array_t* itemsp;
-
- for(cat_map_t::iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit)
- {
- LLViewerInventoryCategory* cat = cit->second;
- cats.push_back(cat);
- if (mParentChildCategoryTree.count(cat->getUUID()) == 0)
- {
- llassert_always(mCategoryLock[cat->getUUID()] == false);
- catsp = new cat_array_t;
- mParentChildCategoryTree[cat->getUUID()] = catsp;
- }
- if (mParentChildItemTree.count(cat->getUUID()) == 0)
- {
- llassert_always(mItemLock[cat->getUUID()] == false);
- itemsp = new item_array_t;
- mParentChildItemTree[cat->getUUID()] = itemsp;
- }
- }
-
- // Insert a special parent for the root - so that lookups on
- // LLUUID::null as the parent work correctly. This is kind of a
- // blatent wastes of space since we allocate a block of memory for
- // the array, but whatever - it's not that much space.
- if (mParentChildCategoryTree.count(LLUUID::null) == 0)
- {
- catsp = new cat_array_t;
- mParentChildCategoryTree[LLUUID::null] = catsp;
- }
-
- // Now we have a structure with all of the categories that we can
- // iterate over and insert into the correct place in the child
- // category tree.
- S32 count = cats.size();
- S32 i;
- S32 lost = 0;
- cat_array_t lost_cats;
- for(i = 0; i < count; ++i)
- {
- LLViewerInventoryCategory* cat = cats.at(i);
- catsp = getUnlockedCatArray(cat->getParentUUID());
- if(catsp &&
- // Only the two root folders should be children of null.
- // Others should go to lost & found.
- (cat->getParentUUID().notNull() ||
- cat->getPreferredType() == LLFolderType::FT_ROOT_INVENTORY ))
- {
- catsp->push_back(cat);
- }
- else
- {
- // *NOTE: This process could be a lot more efficient if we
- // used the new MoveInventoryFolder message, but we would
- // have to continue to do the update & build here. So, to
- // implement it, we would need a set or map of uuid pairs
- // which would be (folder_id, new_parent_id) to be sent up
- // to the server.
- LL_INFOS(LOG_INV) << "Lost category: " << cat->getUUID() << " - "
- << cat->getName() << LL_ENDL;
- ++lost;
- lost_cats.push_back(cat);
- }
- }
- if(lost)
- {
- LL_WARNS(LOG_INV) << "Found " << lost << " lost categories." << LL_ENDL;
- }
-
- // Do moves in a separate pass to make sure we've properly filed
- // the FT_LOST_AND_FOUND category before we try to find its UUID.
- for(i = 0; i<lost_cats.size(); ++i)
- {
- LLViewerInventoryCategory *cat = lost_cats.at(i);
-
- // plop it into the lost & found.
- LLFolderType::EType pref = cat->getPreferredType();
- if(LLFolderType::FT_NONE == pref)
- {
- cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND));
- }
- else if(LLFolderType::FT_ROOT_INVENTORY == pref)
- {
- // it's the root
- cat->setParent(LLUUID::null);
- }
- else
- {
- // it's a protected folder.
- cat->setParent(gInventory.getRootFolderID());
- }
- // FIXME note that updateServer() fails with protected
- // types, so this will not work as intended in that case.
- // UpdateServer uses AIS, AIS cat move is not implemented yet
- // cat->updateServer(TRUE);
-
- // MoveInventoryFolder message, intentionally per item
- cat->updateParentOnServer(FALSE);
- catsp = getUnlockedCatArray(cat->getParentUUID());
- if(catsp)
- {
- catsp->push_back(cat);
- }
- else
- {
- LL_WARNS(LOG_INV) << "Lost and found Not there!!" << LL_ENDL;
- }
- }
-
- const BOOL COF_exists = (findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) != LLUUID::null);
- sFirstTimeInViewer2 = !COF_exists || gAgent.isFirstLogin();
-
-
- // Now the items. We allocated in the last step, so now all we
- // have to do is iterate over the items and put them in the right
- // place.
- item_array_t items;
- if(!mItemMap.empty())
- {
- LLPointer<LLViewerInventoryItem> item;
- for(item_map_t::iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit)
- {
- item = (*iit).second;
- items.push_back(item);
- }
- }
- count = items.size();
- lost = 0;
- uuid_vec_t lost_item_ids;
- for(i = 0; i < count; ++i)
- {
- LLPointer<LLViewerInventoryItem> item;
- item = items.at(i);
- itemsp = getUnlockedItemArray(item->getParentUUID());
- if(itemsp)
- {
- itemsp->push_back(item);
- }
- else
- {
- LL_INFOS(LOG_INV) << "Lost item: " << item->getUUID() << " - "
- << item->getName() << LL_ENDL;
- ++lost;
- // plop it into the lost & found.
- //
- item->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND));
- // move it later using a special message to move items. If
- // we update server here, the client might crash.
- //item->updateServer();
- lost_item_ids.push_back(item->getUUID());
- itemsp = getUnlockedItemArray(item->getParentUUID());
- if(itemsp)
- {
- itemsp->push_back(item);
- }
- else
- {
- LL_WARNS(LOG_INV) << "Lost and found Not there!!" << LL_ENDL;
- }
- }
- }
- if(lost)
- {
- LL_WARNS(LOG_INV) << "Found " << lost << " lost items." << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
- BOOL start_new_message = TRUE;
- const LLUUID lnf = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- for(uuid_vec_t::iterator it = lost_item_ids.begin() ; it < lost_item_ids.end(); ++it)
- {
- if(start_new_message)
- {
- start_new_message = FALSE;
- msg->newMessageFast(_PREHASH_MoveInventoryItem);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addBOOLFast(_PREHASH_Stamp, FALSE);
- }
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addUUIDFast(_PREHASH_ItemID, (*it));
- msg->addUUIDFast(_PREHASH_FolderID, lnf);
- msg->addString("NewName", NULL);
- if(msg->isSendFull(NULL))
- {
- start_new_message = TRUE;
- gAgent.sendReliableMessage();
- }
- }
- if(!start_new_message)
- {
- gAgent.sendReliableMessage();
- }
- }
-
- const LLUUID &agent_inv_root_id = gInventory.getRootFolderID();
- if (agent_inv_root_id.notNull())
- {
- cat_array_t* catsp = get_ptr_in_map(mParentChildCategoryTree, agent_inv_root_id);
- if(catsp)
- {
- // *HACK - fix root inventory folder
- // some accounts has pbroken inventory root folders
-
- std::string name = "My Inventory";
- for (parent_cat_map_t::const_iterator it = mParentChildCategoryTree.begin(),
- it_end = mParentChildCategoryTree.end(); it != it_end; ++it)
- {
- cat_array_t* cat_array = it->second;
- for (cat_array_t::const_iterator cat_it = cat_array->begin(),
- cat_it_end = cat_array->end(); cat_it != cat_it_end; ++cat_it)
- {
- LLPointer<LLViewerInventoryCategory> category = *cat_it;
-
- if(category && category->getPreferredType() != LLFolderType::FT_ROOT_INVENTORY)
- continue;
- if ( category && 0 == LLStringUtil::compareInsensitive(name, category->getName()) )
- {
- if(category->getUUID()!=mRootFolderID)
- {
- LLUUID& new_inv_root_folder_id = const_cast<LLUUID&>(mRootFolderID);
- new_inv_root_folder_id = category->getUUID();
- }
- }
- }
- }
-
- LLPointer<LLInventoryValidationInfo> validation_info = validate();
- if (validation_info->mFatalErrorCount > 0)
- {
- // Fatal inventory error. Will not be able to engage in many inventory operations.
- // This should be followed by an error dialog leading to logout.
- LL_WARNS("Inventory") << "Fatal errors were found in validate(): unable to initialize inventory! "
- << "Will not be able to do normal inventory operations in this session."
- << LL_ENDL;
- mIsAgentInvUsable = false;
- }
- else
- {
- mIsAgentInvUsable = true;
- }
- validation_info->mInitialized = true;
- mValidationInfo = validation_info;
-
- // notifyObservers() has been moved to
- // llstartup/idle_startup() after this func completes.
- // Allows some system categories to be created before
- // observers start firing.
- }
- }
+ LL_INFOS(LOG_INV) << "LLInventoryModel::buildParentChildMap()" << LL_ENDL;
+
+ // *NOTE: I am skipping the logic around folder version
+ // synchronization here because it seems if a folder is lost, we
+ // might actually want to invalidate it at that point - not
+ // attempt to cache. More time & thought is necessary.
+
+ // First the categories. We'll copy all of the categories into a
+ // temporary container to iterate over (oh for real iterators.)
+ // While we're at it, we'll allocate the arrays in the trees.
+ cat_array_t cats;
+ cat_array_t* catsp;
+ item_array_t* itemsp;
+
+ for(cat_map_t::iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit)
+ {
+ LLViewerInventoryCategory* cat = cit->second;
+ cats.push_back(cat);
+ if (mParentChildCategoryTree.count(cat->getUUID()) == 0)
+ {
+ llassert_always(mCategoryLock[cat->getUUID()] == false);
+ catsp = new cat_array_t;
+ mParentChildCategoryTree[cat->getUUID()] = catsp;
+ }
+ if (mParentChildItemTree.count(cat->getUUID()) == 0)
+ {
+ llassert_always(mItemLock[cat->getUUID()] == false);
+ itemsp = new item_array_t;
+ mParentChildItemTree[cat->getUUID()] = itemsp;
+ }
+ }
+
+ // Insert a special parent for the root - so that lookups on
+ // LLUUID::null as the parent work correctly. This is kind of a
+ // blatent wastes of space since we allocate a block of memory for
+ // the array, but whatever - it's not that much space.
+ if (mParentChildCategoryTree.count(LLUUID::null) == 0)
+ {
+ catsp = new cat_array_t;
+ mParentChildCategoryTree[LLUUID::null] = catsp;
+ }
+
+ // Now we have a structure with all of the categories that we can
+ // iterate over and insert into the correct place in the child
+ // category tree.
+ S32 count = cats.size();
+ S32 i;
+ S32 lost = 0;
+ cat_array_t lost_cats;
+ for(i = 0; i < count; ++i)
+ {
+ LLViewerInventoryCategory* cat = cats.at(i);
+ catsp = getUnlockedCatArray(cat->getParentUUID());
+ if(catsp &&
+ // Only the two root folders should be children of null.
+ // Others should go to lost & found.
+ (cat->getParentUUID().notNull() ||
+ cat->getPreferredType() == LLFolderType::FT_ROOT_INVENTORY ))
+ {
+ catsp->push_back(cat);
+ }
+ else
+ {
+ // *NOTE: This process could be a lot more efficient if we
+ // used the new MoveInventoryFolder message, but we would
+ // have to continue to do the update & build here. So, to
+ // implement it, we would need a set or map of uuid pairs
+ // which would be (folder_id, new_parent_id) to be sent up
+ // to the server.
+ LL_INFOS(LOG_INV) << "Lost category: " << cat->getUUID() << " - "
+ << cat->getName() << LL_ENDL;
+ ++lost;
+ lost_cats.push_back(cat);
+ }
+ }
+ if(lost)
+ {
+ LL_WARNS(LOG_INV) << "Found " << lost << " lost categories." << LL_ENDL;
+ }
+
+ // Do moves in a separate pass to make sure we've properly filed
+ // the FT_LOST_AND_FOUND category before we try to find its UUID.
+ for(i = 0; i<lost_cats.size(); ++i)
+ {
+ LLViewerInventoryCategory *cat = lost_cats.at(i);
+
+ // plop it into the lost & found.
+ LLFolderType::EType pref = cat->getPreferredType();
+ if(LLFolderType::FT_NONE == pref)
+ {
+ cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND));
+ }
+ else if(LLFolderType::FT_ROOT_INVENTORY == pref)
+ {
+ // it's the root
+ cat->setParent(LLUUID::null);
+ }
+ else
+ {
+ // it's a protected folder.
+ cat->setParent(gInventory.getRootFolderID());
+ }
+ // FIXME note that updateServer() fails with protected
+ // types, so this will not work as intended in that case.
+ // UpdateServer uses AIS, AIS cat move is not implemented yet
+ // cat->updateServer(TRUE);
+
+ // MoveInventoryFolder message, intentionally per item
+ cat->updateParentOnServer(FALSE);
+ catsp = getUnlockedCatArray(cat->getParentUUID());
+ if(catsp)
+ {
+ catsp->push_back(cat);
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "Lost and found Not there!!" << LL_ENDL;
+ }
+ }
+
+ const BOOL COF_exists = (findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) != LLUUID::null);
+ sFirstTimeInViewer2 = !COF_exists || gAgent.isFirstLogin();
+
+
+ // Now the items. We allocated in the last step, so now all we
+ // have to do is iterate over the items and put them in the right
+ // place.
+ item_array_t items;
+ if(!mItemMap.empty())
+ {
+ LLPointer<LLViewerInventoryItem> item;
+ for(item_map_t::iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit)
+ {
+ item = (*iit).second;
+ items.push_back(item);
+ }
+ }
+ count = items.size();
+ lost = 0;
+ uuid_vec_t lost_item_ids;
+ for(i = 0; i < count; ++i)
+ {
+ LLPointer<LLViewerInventoryItem> item;
+ item = items.at(i);
+ itemsp = getUnlockedItemArray(item->getParentUUID());
+ if(itemsp)
+ {
+ itemsp->push_back(item);
+ }
+ else
+ {
+ LL_INFOS(LOG_INV) << "Lost item: " << item->getUUID() << " - "
+ << item->getName() << LL_ENDL;
+ ++lost;
+ // plop it into the lost & found.
+ //
+ item->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND));
+ // move it later using a special message to move items. If
+ // we update server here, the client might crash.
+ //item->updateServer();
+ lost_item_ids.push_back(item->getUUID());
+ itemsp = getUnlockedItemArray(item->getParentUUID());
+ if(itemsp)
+ {
+ itemsp->push_back(item);
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "Lost and found Not there!!" << LL_ENDL;
+ }
+ }
+ }
+ if(lost)
+ {
+ LL_WARNS(LOG_INV) << "Found " << lost << " lost items." << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+ BOOL start_new_message = TRUE;
+ const LLUUID lnf = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ for(uuid_vec_t::iterator it = lost_item_ids.begin() ; it < lost_item_ids.end(); ++it)
+ {
+ if(start_new_message)
+ {
+ start_new_message = FALSE;
+ msg->newMessageFast(_PREHASH_MoveInventoryItem);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addBOOLFast(_PREHASH_Stamp, FALSE);
+ }
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addUUIDFast(_PREHASH_ItemID, (*it));
+ msg->addUUIDFast(_PREHASH_FolderID, lnf);
+ msg->addString("NewName", NULL);
+ if(msg->isSendFull(NULL))
+ {
+ start_new_message = TRUE;
+ gAgent.sendReliableMessage();
+ }
+ }
+ if(!start_new_message)
+ {
+ gAgent.sendReliableMessage();
+ }
+ }
+
+ const LLUUID &agent_inv_root_id = gInventory.getRootFolderID();
+ if (agent_inv_root_id.notNull())
+ {
+ cat_array_t* catsp = get_ptr_in_map(mParentChildCategoryTree, agent_inv_root_id);
+ if(catsp)
+ {
+ // *HACK - fix root inventory folder
+ // some accounts has pbroken inventory root folders
+
+ std::string name = "My Inventory";
+ for (parent_cat_map_t::const_iterator it = mParentChildCategoryTree.begin(),
+ it_end = mParentChildCategoryTree.end(); it != it_end; ++it)
+ {
+ cat_array_t* cat_array = it->second;
+ for (cat_array_t::const_iterator cat_it = cat_array->begin(),
+ cat_it_end = cat_array->end(); cat_it != cat_it_end; ++cat_it)
+ {
+ LLPointer<LLViewerInventoryCategory> category = *cat_it;
+
+ if(category && category->getPreferredType() != LLFolderType::FT_ROOT_INVENTORY)
+ continue;
+ if ( category && 0 == LLStringUtil::compareInsensitive(name, category->getName()) )
+ {
+ if(category->getUUID()!=mRootFolderID)
+ {
+ LLUUID& new_inv_root_folder_id = const_cast<LLUUID&>(mRootFolderID);
+ new_inv_root_folder_id = category->getUUID();
+ }
+ }
+ }
+ }
+
+ LLPointer<LLInventoryValidationInfo> validation_info = validate();
+ if (validation_info->mFatalErrorCount > 0)
+ {
+ // Fatal inventory error. Will not be able to engage in many inventory operations.
+ // This should be followed by an error dialog leading to logout.
+ LL_WARNS("Inventory") << "Fatal errors were found in validate(): unable to initialize inventory! "
+ << "Will not be able to do normal inventory operations in this session."
+ << LL_ENDL;
+ mIsAgentInvUsable = false;
+ }
+ else
+ {
+ mIsAgentInvUsable = true;
+ }
+ validation_info->mInitialized = true;
+ mValidationInfo = validation_info;
+
+ // notifyObservers() has been moved to
+ // llstartup/idle_startup() after this func completes.
+ // Allows some system categories to be created before
+ // observers start firing.
+ }
+ }
}
// Would normally do this at construction but that's too early
@@ -3202,22 +3202,22 @@ void LLInventoryModel::buildParentChildMap()
// call set things up.
void LLInventoryModel::initHttpRequest()
{
- if (! mHttpRequestFG)
- {
- // Haven't initialized, get to it
- LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
-
- mHttpRequestFG = new LLCore::HttpRequest;
- mHttpRequestBG = new LLCore::HttpRequest;
- mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
- mHttpOptions->setTransferTimeout(300);
- mHttpOptions->setUseRetryAfter(true);
- // mHttpOptions->setTrace(2); // Do tracing of requests
+ if (! mHttpRequestFG)
+ {
+ // Haven't initialized, get to it
+ LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
+
+ mHttpRequestFG = new LLCore::HttpRequest;
+ mHttpRequestBG = new LLCore::HttpRequest;
+ mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+ mHttpOptions->setTransferTimeout(300);
+ mHttpOptions->setUseRetryAfter(true);
+ // mHttpOptions->setTrace(2); // Do tracing of requests
mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders);
- mHttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML);
- mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML);
- mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_INVENTORY);
- }
+ mHttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML);
+ mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML);
+ mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_INVENTORY);
+ }
if (!gGenericDispatcher.isHandlerPresent("BulkUpdateInventory"))
{
@@ -3227,49 +3227,49 @@ void LLInventoryModel::initHttpRequest()
void LLInventoryModel::handleResponses(bool foreground)
{
- if (foreground && mHttpRequestFG)
- {
- mHttpRequestFG->update(0);
- }
- else if (! foreground && mHttpRequestBG)
- {
- mHttpRequestBG->update(50000L);
- }
+ if (foreground && mHttpRequestFG)
+ {
+ mHttpRequestFG->update(0);
+ }
+ else if (! foreground && mHttpRequestBG)
+ {
+ mHttpRequestBG->update(50000L);
+ }
}
LLCore::HttpHandle LLInventoryModel::requestPost(bool foreground,
- const std::string & url,
- const LLSD & body,
- const LLCore::HttpHandler::ptr_t &handler,
- const char * const message)
+ const std::string & url,
+ const LLSD & body,
+ const LLCore::HttpHandler::ptr_t &handler,
+ const char * const message)
{
- if (! mHttpRequestFG)
- {
- // We do the initialization late and lazily as this class is
- // statically-constructed and not all the bits are ready at
- // that time.
- initHttpRequest();
- }
-
- LLCore::HttpRequest * request(foreground ? mHttpRequestFG : mHttpRequestBG);
- LLCore::HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID);
-
- handle = LLCoreHttpUtil::requestPostWithLLSD(request,
- mHttpPolicyClass,
- url,
- body,
- mHttpOptions,
- mHttpHeaders,
- handler);
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- LLCore::HttpStatus status(request->getStatus());
- LL_WARNS(LOG_INV) << "HTTP POST request failed for " << message
- << ", Status: " << status.toTerseString()
- << " Reason: '" << status.toString() << "'"
- << LL_ENDL;
- }
- return handle;
+ if (! mHttpRequestFG)
+ {
+ // We do the initialization late and lazily as this class is
+ // statically-constructed and not all the bits are ready at
+ // that time.
+ initHttpRequest();
+ }
+
+ LLCore::HttpRequest * request(foreground ? mHttpRequestFG : mHttpRequestBG);
+ LLCore::HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID);
+
+ handle = LLCoreHttpUtil::requestPostWithLLSD(request,
+ mHttpPolicyClass,
+ url,
+ body,
+ mHttpOptions,
+ mHttpHeaders,
+ handler);
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ LLCore::HttpStatus status(request->getStatus());
+ LL_WARNS(LOG_INV) << "HTTP POST request failed for " << message
+ << ", Status: " << status.toTerseString()
+ << " Reason: '" << status.toString() << "'"
+ << LL_ENDL;
+ }
+ return handle;
}
void LLInventoryModel::createCommonSystemCategories()
@@ -3277,12 +3277,12 @@ void LLInventoryModel::createCommonSystemCategories()
//amount of System Folder we should wait for
sPendingSystemFolders = 9;
- gInventory.ensureCategoryForTypeExists(LLFolderType::FT_TRASH);
- gInventory.ensureCategoryForTypeExists(LLFolderType::FT_FAVORITE);
- gInventory.ensureCategoryForTypeExists(LLFolderType::FT_CALLINGCARD);
- gInventory.ensureCategoryForTypeExists(LLFolderType::FT_MY_OUTFITS);
- gInventory.ensureCategoryForTypeExists(LLFolderType::FT_CURRENT_OUTFIT);
- gInventory.ensureCategoryForTypeExists(LLFolderType::FT_LANDMARK); // folder should exist before user tries to 'landmark this'
+ gInventory.ensureCategoryForTypeExists(LLFolderType::FT_TRASH);
+ gInventory.ensureCategoryForTypeExists(LLFolderType::FT_FAVORITE);
+ gInventory.ensureCategoryForTypeExists(LLFolderType::FT_CALLINGCARD);
+ gInventory.ensureCategoryForTypeExists(LLFolderType::FT_MY_OUTFITS);
+ gInventory.ensureCategoryForTypeExists(LLFolderType::FT_CURRENT_OUTFIT);
+ gInventory.ensureCategoryForTypeExists(LLFolderType::FT_LANDMARK); // folder should exist before user tries to 'landmark this'
gInventory.ensureCategoryForTypeExists(LLFolderType::FT_SETTINGS);
gInventory.ensureCategoryForTypeExists(LLFolderType::FT_MATERIAL); // probably should be server created
gInventory.ensureCategoryForTypeExists(LLFolderType::FT_INBOX);
@@ -3290,154 +3290,154 @@ void LLInventoryModel::createCommonSystemCategories()
struct LLUUIDAndName
{
- LLUUIDAndName() {}
- LLUUIDAndName(const LLUUID& id, const std::string& name);
- bool operator==(const LLUUIDAndName& rhs) const;
- bool operator<(const LLUUIDAndName& rhs) const;
- bool operator>(const LLUUIDAndName& rhs) const;
-
- LLUUID mID;
- std::string mName;
+ LLUUIDAndName() {}
+ LLUUIDAndName(const LLUUID& id, const std::string& name);
+ bool operator==(const LLUUIDAndName& rhs) const;
+ bool operator<(const LLUUIDAndName& rhs) const;
+ bool operator>(const LLUUIDAndName& rhs) const;
+
+ LLUUID mID;
+ std::string mName;
};
LLUUIDAndName::LLUUIDAndName(const LLUUID& id, const std::string& name) :
- mID(id), mName(name)
+ mID(id), mName(name)
{
}
bool LLUUIDAndName::operator==(const LLUUIDAndName& rhs) const
{
- return ((mID == rhs.mID) && (mName == rhs.mName));
+ return ((mID == rhs.mID) && (mName == rhs.mName));
}
bool LLUUIDAndName::operator<(const LLUUIDAndName& rhs) const
{
- return (mID < rhs.mID);
+ return (mID < rhs.mID);
}
bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const
{
- return (mID > rhs.mID);
+ return (mID > rhs.mID);
}
// static
bool LLInventoryModel::loadFromFile(const std::string& filename,
- LLInventoryModel::cat_array_t& categories,
- LLInventoryModel::item_array_t& items,
- LLInventoryModel::changed_items_t& cats_to_update,
- bool &is_cache_obsolete)
+ LLInventoryModel::cat_array_t& categories,
+ LLInventoryModel::item_array_t& items,
+ LLInventoryModel::changed_items_t& cats_to_update,
+ bool &is_cache_obsolete)
{
LL_PROFILE_ZONE_NAMED("inventory load from file");
- if(filename.empty())
- {
- LL_ERRS(LOG_INV) << "filename is Null!" << LL_ENDL;
- return false;
- }
- LL_INFOS(LOG_INV) << "loading inventory from: (" << filename << ")" << LL_ENDL;
-
- llifstream file(filename.c_str());
-
- if (!file.is_open())
- {
- LL_INFOS(LOG_INV) << "unable to load inventory from: " << filename << LL_ENDL;
- return false;
- }
-
- is_cache_obsolete = true; // Obsolete until proven current
-
- //U64 lines_count = 0U;
- std::string line;
- LLPointer<LLSDParser> parser = new LLSDNotationParser();
- while (std::getline(file, line))
- {
- LLSD s_item;
- std::istringstream iss(line);
- if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
- {
- LL_WARNS(LOG_INV)<< "Parsing inventory cache failed" << LL_ENDL;
- break;
- }
-
- if (s_item.has("inv_cache_version"))
- {
- S32 version = s_item["inv_cache_version"].asInteger();
- if (version == sCurrentInvCacheVersion)
- {
- // Cache is up to date
- is_cache_obsolete = false;
- continue;
- }
- else
- {
- LL_WARNS(LOG_INV)<< "Inventory cache is out of date" << LL_ENDL;
- break;
- }
- }
- else if (s_item.has("cat_id"))
- {
- if (is_cache_obsolete)
- break;
-
- LLPointer<LLViewerInventoryCategory> inv_cat = new LLViewerInventoryCategory(LLUUID::null);
- if(inv_cat->importLLSD(s_item))
- {
- categories.push_back(inv_cat);
- }
- }
- else if (s_item.has("item_id"))
- {
- if (is_cache_obsolete)
- break;
-
- LLPointer<LLViewerInventoryItem> inv_item = new LLViewerInventoryItem;
- if( inv_item->fromLLSD(s_item) )
- {
- if(inv_item->getUUID().isNull())
- {
- LL_DEBUGS(LOG_INV) << "Ignoring inventory with null item id: "
- << inv_item->getName() << LL_ENDL;
- }
- else
- {
- if (inv_item->getType() == LLAssetType::AT_UNKNOWN)
- {
- cats_to_update.insert(inv_item->getParentUUID());
- }
- else
- {
- items.push_back(inv_item);
- }
- }
- }
- }
+ if(filename.empty())
+ {
+ LL_ERRS(LOG_INV) << "filename is Null!" << LL_ENDL;
+ return false;
+ }
+ LL_INFOS(LOG_INV) << "loading inventory from: (" << filename << ")" << LL_ENDL;
+
+ llifstream file(filename.c_str());
+
+ if (!file.is_open())
+ {
+ LL_INFOS(LOG_INV) << "unable to load inventory from: " << filename << LL_ENDL;
+ return false;
+ }
+
+ is_cache_obsolete = true; // Obsolete until proven current
+
+ //U64 lines_count = 0U;
+ std::string line;
+ LLPointer<LLSDParser> parser = new LLSDNotationParser();
+ while (std::getline(file, line))
+ {
+ LLSD s_item;
+ std::istringstream iss(line);
+ if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
+ {
+ LL_WARNS(LOG_INV)<< "Parsing inventory cache failed" << LL_ENDL;
+ break;
+ }
+
+ if (s_item.has("inv_cache_version"))
+ {
+ S32 version = s_item["inv_cache_version"].asInteger();
+ if (version == sCurrentInvCacheVersion)
+ {
+ // Cache is up to date
+ is_cache_obsolete = false;
+ continue;
+ }
+ else
+ {
+ LL_WARNS(LOG_INV)<< "Inventory cache is out of date" << LL_ENDL;
+ break;
+ }
+ }
+ else if (s_item.has("cat_id"))
+ {
+ if (is_cache_obsolete)
+ break;
+
+ LLPointer<LLViewerInventoryCategory> inv_cat = new LLViewerInventoryCategory(LLUUID::null);
+ if(inv_cat->importLLSD(s_item))
+ {
+ categories.push_back(inv_cat);
+ }
+ }
+ else if (s_item.has("item_id"))
+ {
+ if (is_cache_obsolete)
+ break;
+
+ LLPointer<LLViewerInventoryItem> inv_item = new LLViewerInventoryItem;
+ if( inv_item->fromLLSD(s_item) )
+ {
+ if(inv_item->getUUID().isNull())
+ {
+ LL_DEBUGS(LOG_INV) << "Ignoring inventory with null item id: "
+ << inv_item->getName() << LL_ENDL;
+ }
+ else
+ {
+ if (inv_item->getType() == LLAssetType::AT_UNKNOWN)
+ {
+ cats_to_update.insert(inv_item->getParentUUID());
+ }
+ else
+ {
+ items.push_back(inv_item);
+ }
+ }
+ }
+ }
// TODO(brad) - figure out how to reenable this without breaking everything else
-// static constexpr U64 BATCH_SIZE = 512U;
-// if ((++lines_count % BATCH_SIZE) == 0)
-// {
-// // SL-19968 - make sure message system code gets a chance to run every so often
-// pump_idle_startup_network();
-// }
- }
+// static constexpr U64 BATCH_SIZE = 512U;
+// if ((++lines_count % BATCH_SIZE) == 0)
+// {
+// // SL-19968 - make sure message system code gets a chance to run every so often
+// pump_idle_startup_network();
+// }
+ }
- file.close();
+ file.close();
- return !is_cache_obsolete;
+ return !is_cache_obsolete;
}
// static
bool LLInventoryModel::saveToFile(const std::string& filename,
- const cat_array_t& categories,
- const item_array_t& items)
+ const cat_array_t& categories,
+ const item_array_t& items)
{
- if (filename.empty())
- {
- LL_ERRS(LOG_INV) << "Filename is Null!" << LL_ENDL;
- return false;
- }
+ if (filename.empty())
+ {
+ LL_ERRS(LOG_INV) << "Filename is Null!" << LL_ENDL;
+ return false;
+ }
- LL_INFOS(LOG_INV) << "saving inventory to: (" << filename << ")" << LL_ENDL;
+ LL_INFOS(LOG_INV) << "saving inventory to: (" << filename << ")" << LL_ENDL;
try
{
@@ -3509,46 +3509,46 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
// static
void LLInventoryModel::registerCallbacks(LLMessageSystem* msg)
{
- //msg->setHandlerFuncFast(_PREHASH_InventoryUpdate,
- // processInventoryUpdate,
- // NULL);
- //msg->setHandlerFuncFast(_PREHASH_UseCachedInventory,
- // processUseCachedInventory,
- // NULL);
- msg->setHandlerFuncFast(_PREHASH_UpdateCreateInventoryItem,
- processUpdateCreateInventoryItem,
- NULL);
- msg->setHandlerFuncFast(_PREHASH_RemoveInventoryItem,
- processRemoveInventoryItem,
- NULL);
- msg->setHandlerFuncFast(_PREHASH_RemoveInventoryFolder,
- processRemoveInventoryFolder,
- NULL);
- msg->setHandlerFuncFast(_PREHASH_RemoveInventoryObjects,
- processRemoveInventoryObjects,
- NULL);
- msg->setHandlerFuncFast(_PREHASH_SaveAssetIntoInventory,
- processSaveAssetIntoInventory,
- NULL);
- msg->setHandlerFuncFast(_PREHASH_BulkUpdateInventory,
- processBulkUpdateInventory,
- NULL);
- msg->setHandlerFunc("MoveInventoryItem", processMoveInventoryItem);
+ //msg->setHandlerFuncFast(_PREHASH_InventoryUpdate,
+ // processInventoryUpdate,
+ // NULL);
+ //msg->setHandlerFuncFast(_PREHASH_UseCachedInventory,
+ // processUseCachedInventory,
+ // NULL);
+ msg->setHandlerFuncFast(_PREHASH_UpdateCreateInventoryItem,
+ processUpdateCreateInventoryItem,
+ NULL);
+ msg->setHandlerFuncFast(_PREHASH_RemoveInventoryItem,
+ processRemoveInventoryItem,
+ NULL);
+ msg->setHandlerFuncFast(_PREHASH_RemoveInventoryFolder,
+ processRemoveInventoryFolder,
+ NULL);
+ msg->setHandlerFuncFast(_PREHASH_RemoveInventoryObjects,
+ processRemoveInventoryObjects,
+ NULL);
+ msg->setHandlerFuncFast(_PREHASH_SaveAssetIntoInventory,
+ processSaveAssetIntoInventory,
+ NULL);
+ msg->setHandlerFuncFast(_PREHASH_BulkUpdateInventory,
+ processBulkUpdateInventory,
+ NULL);
+ msg->setHandlerFunc("MoveInventoryItem", processMoveInventoryItem);
}
-// static
+// static
void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, void**)
{
- // do accounting and highlight new items if they arrive
- if (gInventory.messageUpdateCore(msg, true, LLInventoryObserver::UPDATE_CREATE))
- {
- U32 callback_id;
- LLUUID item_id;
- msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id);
- msg->getU32Fast(_PREHASH_InventoryData, _PREHASH_CallbackID, callback_id);
+ // do accounting and highlight new items if they arrive
+ if (gInventory.messageUpdateCore(msg, true, LLInventoryObserver::UPDATE_CREATE))
+ {
+ U32 callback_id;
+ LLUUID item_id;
+ msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id);
+ msg->getU32Fast(_PREHASH_InventoryData, _PREHASH_CallbackID, callback_id);
- gInventoryCallbacks.fire(callback_id, item_id);
+ gInventoryCallbacks.fire(callback_id, item_id);
// Message system at the moment doesn't support Thumbnails and potential
// newer features so just rerequest whole item
@@ -3556,251 +3556,251 @@ void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, vo
// todo: instead of unpacking message fully,
// grab only an item_id, then fetch
LLInventoryModelBackgroundFetch::instance().scheduleItemFetch(item_id, true);
- }
+ }
}
bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, U32 mask)
{
- //make sure our added inventory observer is active
- start_new_inventory_observer();
-
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS(LOG_INV) << "Got a inventory update for the wrong agent: " << agent_id
- << LL_ENDL;
- return false;
- }
- item_array_t items;
- update_map_t update;
- S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
- // Does this loop ever execute more than once?
- for(S32 i = 0; i < count; ++i)
- {
- LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
- titem->unpackMessage(msg, _PREHASH_InventoryData, i);
- LL_DEBUGS(LOG_INV) << "LLInventoryModel::messageUpdateCore() item id: "
- << titem->getUUID() << LL_ENDL;
- items.push_back(titem);
- // examine update for changes.
- LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID());
- if(itemp)
- {
- if(titem->getParentUUID() == itemp->getParentUUID())
- {
- update[titem->getParentUUID()];
- }
- else
- {
- ++update[titem->getParentUUID()];
- --update[itemp->getParentUUID()];
- }
- }
- else
- {
- ++update[titem->getParentUUID()];
- }
- }
- if(account)
- {
- gInventory.accountForUpdate(update);
- }
-
- if (account)
- {
- mask |= LLInventoryObserver::CREATE;
- }
- //as above, this loop never seems to loop more than once per call
- for (item_array_t::iterator it = items.begin(); it != items.end(); ++it)
- {
- gInventory.updateItem(*it, mask);
- }
- gInventory.notifyObservers();
- gViewerWindow->getWindow()->decBusyCount();
-
- return true;
+ //make sure our added inventory observer is active
+ start_new_inventory_observer();
+
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ if(agent_id != gAgent.getID())
+ {
+ LL_WARNS(LOG_INV) << "Got a inventory update for the wrong agent: " << agent_id
+ << LL_ENDL;
+ return false;
+ }
+ item_array_t items;
+ update_map_t update;
+ S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
+ // Does this loop ever execute more than once?
+ for(S32 i = 0; i < count; ++i)
+ {
+ LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
+ titem->unpackMessage(msg, _PREHASH_InventoryData, i);
+ LL_DEBUGS(LOG_INV) << "LLInventoryModel::messageUpdateCore() item id: "
+ << titem->getUUID() << LL_ENDL;
+ items.push_back(titem);
+ // examine update for changes.
+ LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID());
+ if(itemp)
+ {
+ if(titem->getParentUUID() == itemp->getParentUUID())
+ {
+ update[titem->getParentUUID()];
+ }
+ else
+ {
+ ++update[titem->getParentUUID()];
+ --update[itemp->getParentUUID()];
+ }
+ }
+ else
+ {
+ ++update[titem->getParentUUID()];
+ }
+ }
+ if(account)
+ {
+ gInventory.accountForUpdate(update);
+ }
+
+ if (account)
+ {
+ mask |= LLInventoryObserver::CREATE;
+ }
+ //as above, this loop never seems to loop more than once per call
+ for (item_array_t::iterator it = items.begin(); it != items.end(); ++it)
+ {
+ gInventory.updateItem(*it, mask);
+ }
+ gInventory.notifyObservers();
+ gViewerWindow->getWindow()->decBusyCount();
+
+ return true;
}
-// static
+// static
void LLInventoryModel::removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg, const char* msg_label)
{
- LLUUID item_id;
- S32 count = msg->getNumberOfBlocksFast(msg_label);
- LL_DEBUGS(LOG_INV) << "Message has " << count << " item blocks" << LL_ENDL;
- uuid_vec_t item_ids;
- update_map_t update;
- for(S32 i = 0; i < count; ++i)
- {
- msg->getUUIDFast(msg_label, _PREHASH_ItemID, item_id, i);
- LL_DEBUGS(LOG_INV) << "Checking for item-to-be-removed " << item_id << LL_ENDL;
- LLViewerInventoryItem* itemp = gInventory.getItem(item_id);
- if(itemp)
- {
- LL_DEBUGS(LOG_INV) << "Item will be removed " << item_id << LL_ENDL;
- // we only bother with the delete and account if we found
- // the item - this is usually a back-up for permissions,
- // so frequently the item will already be gone.
- --update[itemp->getParentUUID()];
- item_ids.push_back(item_id);
- }
- }
- gInventory.accountForUpdate(update);
- for(uuid_vec_t::iterator it = item_ids.begin(); it != item_ids.end(); ++it)
- {
- LL_DEBUGS(LOG_INV) << "Calling deleteObject " << *it << LL_ENDL;
- gInventory.deleteObject(*it);
- }
+ LLUUID item_id;
+ S32 count = msg->getNumberOfBlocksFast(msg_label);
+ LL_DEBUGS(LOG_INV) << "Message has " << count << " item blocks" << LL_ENDL;
+ uuid_vec_t item_ids;
+ update_map_t update;
+ for(S32 i = 0; i < count; ++i)
+ {
+ msg->getUUIDFast(msg_label, _PREHASH_ItemID, item_id, i);
+ LL_DEBUGS(LOG_INV) << "Checking for item-to-be-removed " << item_id << LL_ENDL;
+ LLViewerInventoryItem* itemp = gInventory.getItem(item_id);
+ if(itemp)
+ {
+ LL_DEBUGS(LOG_INV) << "Item will be removed " << item_id << LL_ENDL;
+ // we only bother with the delete and account if we found
+ // the item - this is usually a back-up for permissions,
+ // so frequently the item will already be gone.
+ --update[itemp->getParentUUID()];
+ item_ids.push_back(item_id);
+ }
+ }
+ gInventory.accountForUpdate(update);
+ for(uuid_vec_t::iterator it = item_ids.begin(); it != item_ids.end(); ++it)
+ {
+ LL_DEBUGS(LOG_INV) << "Calling deleteObject " << *it << LL_ENDL;
+ gInventory.deleteObject(*it);
+ }
}
-// static
+// static
void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**)
{
- LL_DEBUGS(LOG_INV) << "LLInventoryModel::processRemoveInventoryItem()" << LL_ENDL;
- LLUUID agent_id, item_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS(LOG_INV) << "Got a RemoveInventoryItem for the wrong agent."
- << LL_ENDL;
- return;
- }
- LLInventoryModel::removeInventoryItem(agent_id, msg, _PREHASH_InventoryData);
- gInventory.notifyObservers();
+ LL_DEBUGS(LOG_INV) << "LLInventoryModel::processRemoveInventoryItem()" << LL_ENDL;
+ LLUUID agent_id, item_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ if(agent_id != gAgent.getID())
+ {
+ LL_WARNS(LOG_INV) << "Got a RemoveInventoryItem for the wrong agent."
+ << LL_ENDL;
+ return;
+ }
+ LLInventoryModel::removeInventoryItem(agent_id, msg, _PREHASH_InventoryData);
+ gInventory.notifyObservers();
}
-// static
+// static
void LLInventoryModel::removeInventoryFolder(LLUUID agent_id,
- LLMessageSystem* msg)
+ LLMessageSystem* msg)
{
- LLUUID folder_id;
- uuid_vec_t folder_ids;
- update_map_t update;
- S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData);
- for(S32 i = 0; i < count; ++i)
- {
- msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_FolderID, folder_id, i);
- LLViewerInventoryCategory* folderp = gInventory.getCategory(folder_id);
- if(folderp)
- {
- --update[folderp->getParentUUID()];
- folder_ids.push_back(folder_id);
- }
- }
- gInventory.accountForUpdate(update);
- for(uuid_vec_t::iterator it = folder_ids.begin(); it != folder_ids.end(); ++it)
- {
- gInventory.deleteObject(*it);
- }
+ LLUUID folder_id;
+ uuid_vec_t folder_ids;
+ update_map_t update;
+ S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData);
+ for(S32 i = 0; i < count; ++i)
+ {
+ msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_FolderID, folder_id, i);
+ LLViewerInventoryCategory* folderp = gInventory.getCategory(folder_id);
+ if(folderp)
+ {
+ --update[folderp->getParentUUID()];
+ folder_ids.push_back(folder_id);
+ }
+ }
+ gInventory.accountForUpdate(update);
+ for(uuid_vec_t::iterator it = folder_ids.begin(); it != folder_ids.end(); ++it)
+ {
+ gInventory.deleteObject(*it);
+ }
}
-// static
+// static
void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg,
- void**)
+ void**)
{
- LL_DEBUGS() << "LLInventoryModel::processRemoveInventoryFolder()" << LL_ENDL;
- LLUUID agent_id, session_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS() << "Got a RemoveInventoryFolder for the wrong agent."
- << LL_ENDL;
- return;
- }
- LLInventoryModel::removeInventoryFolder( agent_id, msg );
- gInventory.notifyObservers();
+ LL_DEBUGS() << "LLInventoryModel::processRemoveInventoryFolder()" << LL_ENDL;
+ LLUUID agent_id, session_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
+ if(agent_id != gAgent.getID())
+ {
+ LL_WARNS() << "Got a RemoveInventoryFolder for the wrong agent."
+ << LL_ENDL;
+ return;
+ }
+ LLInventoryModel::removeInventoryFolder( agent_id, msg );
+ gInventory.notifyObservers();
}
-// static
+// static
void LLInventoryModel::processRemoveInventoryObjects(LLMessageSystem* msg,
- void**)
+ void**)
{
- LL_DEBUGS() << "LLInventoryModel::processRemoveInventoryObjects()" << LL_ENDL;
- LLUUID agent_id, session_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS() << "Got a RemoveInventoryObjects for the wrong agent."
- << LL_ENDL;
- return;
- }
- LLInventoryModel::removeInventoryFolder( agent_id, msg );
- LLInventoryModel::removeInventoryItem( agent_id, msg, _PREHASH_ItemData );
- gInventory.notifyObservers();
+ LL_DEBUGS() << "LLInventoryModel::processRemoveInventoryObjects()" << LL_ENDL;
+ LLUUID agent_id, session_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
+ if(agent_id != gAgent.getID())
+ {
+ LL_WARNS() << "Got a RemoveInventoryObjects for the wrong agent."
+ << LL_ENDL;
+ return;
+ }
+ LLInventoryModel::removeInventoryFolder( agent_id, msg );
+ LLInventoryModel::removeInventoryItem( agent_id, msg, _PREHASH_ItemData );
+ gInventory.notifyObservers();
}
-// static
+// static
void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg,
- void**)
+ void**)
{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS() << "Got a SaveAssetIntoInventory message for the wrong agent."
- << LL_ENDL;
- return;
- }
-
- LLUUID item_id;
- msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id);
-
- // The viewer ignores the asset id because this message is only
- // used for attachments/objects, so the asset id is not used in
- // the viewer anyway.
- LL_DEBUGS() << "LLInventoryModel::processSaveAssetIntoInventory itemID="
- << item_id << LL_ENDL;
- LLViewerInventoryItem* item = gInventory.getItem( item_id );
- if( item )
- {
- LLCategoryUpdate up(item->getParentUUID(), 0);
- gInventory.accountForUpdate(up);
- gInventory.addChangedMask( LLInventoryObserver::INTERNAL, item_id);
- gInventory.notifyObservers();
- }
- else
- {
- LL_INFOS() << "LLInventoryModel::processSaveAssetIntoInventory item"
- " not found: " << item_id << LL_ENDL;
- }
- if(gViewerWindow)
- {
- gViewerWindow->getWindow()->decBusyCount();
- }
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ if(agent_id != gAgent.getID())
+ {
+ LL_WARNS() << "Got a SaveAssetIntoInventory message for the wrong agent."
+ << LL_ENDL;
+ return;
+ }
+
+ LLUUID item_id;
+ msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id);
+
+ // The viewer ignores the asset id because this message is only
+ // used for attachments/objects, so the asset id is not used in
+ // the viewer anyway.
+ LL_DEBUGS() << "LLInventoryModel::processSaveAssetIntoInventory itemID="
+ << item_id << LL_ENDL;
+ LLViewerInventoryItem* item = gInventory.getItem( item_id );
+ if( item )
+ {
+ LLCategoryUpdate up(item->getParentUUID(), 0);
+ gInventory.accountForUpdate(up);
+ gInventory.addChangedMask( LLInventoryObserver::INTERNAL, item_id);
+ gInventory.notifyObservers();
+ }
+ else
+ {
+ LL_INFOS() << "LLInventoryModel::processSaveAssetIntoInventory item"
+ " not found: " << item_id << LL_ENDL;
+ }
+ if(gViewerWindow)
+ {
+ gViewerWindow->getWindow()->decBusyCount();
+ }
}
// static
void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS() << "Got a BulkUpdateInventory for the wrong agent." << LL_ENDL;
- return;
- }
- LLUUID tid;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TransactionID, tid);
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ if(agent_id != gAgent.getID())
+ {
+ LL_WARNS() << "Got a BulkUpdateInventory for the wrong agent." << LL_ENDL;
+ return;
+ }
+ LLUUID tid;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TransactionID, tid);
#ifndef LL_RELEASE_FOR_DOWNLOAD
- LL_DEBUGS("Inventory") << "Bulk inventory: " << tid << LL_ENDL;
+ LL_DEBUGS("Inventory") << "Bulk inventory: " << tid << LL_ENDL;
#endif
- update_map_t update;
- cat_array_t folders;
- S32 count;
- S32 i;
- count = msg->getNumberOfBlocksFast(_PREHASH_FolderData);
- for(i = 0; i < count; ++i)
- {
- LLPointer<LLViewerInventoryCategory> tfolder = new LLViewerInventoryCategory(gAgent.getID());
- tfolder->unpackMessage(msg, _PREHASH_FolderData, i);
- LL_DEBUGS("Inventory") << "unpacked folder '" << tfolder->getName() << "' ("
- << tfolder->getUUID() << ") in " << tfolder->getParentUUID()
- << LL_ENDL;
-
+ update_map_t update;
+ cat_array_t folders;
+ S32 count;
+ S32 i;
+ count = msg->getNumberOfBlocksFast(_PREHASH_FolderData);
+ for(i = 0; i < count; ++i)
+ {
+ LLPointer<LLViewerInventoryCategory> tfolder = new LLViewerInventoryCategory(gAgent.getID());
+ tfolder->unpackMessage(msg, _PREHASH_FolderData, i);
+ LL_DEBUGS("Inventory") << "unpacked folder '" << tfolder->getName() << "' ("
+ << tfolder->getUUID() << ") in " << tfolder->getParentUUID()
+ << LL_ENDL;
+
// If the folder is a listing or a version folder, all we need to do is update the SLM data
int depth_folder = depth_nesting_in_marketplace(tfolder->getUUID());
if ((depth_folder == 1) || (depth_folder == 2))
@@ -3811,12 +3811,12 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
LLMarketplaceData::instance().getListing(listing_id);
// In that case, there is no item to update so no callback -> we skip the rest of the update
}
- else if(tfolder->getUUID().notNull())
- {
- folders.push_back(tfolder);
- LLViewerInventoryCategory* folderp = gInventory.getCategory(tfolder->getUUID());
- if(folderp)
- {
+ else if(tfolder->getUUID().notNull())
+ {
+ folders.push_back(tfolder);
+ LLViewerInventoryCategory* folderp = gInventory.getCategory(tfolder->getUUID());
+ if(folderp)
+ {
if (folderp->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN)
{
if (tfolder->getParentUUID() == folderp->getParentUUID())
@@ -3833,15 +3833,15 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
{
folderp->fetch();
}
- }
- else
- {
- // we could not find the folder, so it is probably
- // new. However, we only want to attempt accounting
- // for the parent if we can find the parent.
- folderp = gInventory.getCategory(tfolder->getParentUUID());
- if(folderp)
- {
+ }
+ else
+ {
+ // we could not find the folder, so it is probably
+ // new. However, we only want to attempt accounting
+ // for the parent if we can find the parent.
+ folderp = gInventory.getCategory(tfolder->getParentUUID());
+ if(folderp)
+ {
if (folderp->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN)
{
++update[tfolder->getParentUUID()];
@@ -3850,51 +3850,51 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
{
folderp->fetch();
}
- }
- }
- }
- }
-
-
- count = msg->getNumberOfBlocksFast(_PREHASH_ItemData);
- uuid_vec_t wearable_ids;
- item_array_t items;
- std::list<InventoryCallbackInfo> cblist;
- for(i = 0; i < count; ++i)
- {
- LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
- titem->unpackMessage(msg, _PREHASH_ItemData, i);
- LL_DEBUGS("Inventory") << "unpacked item '" << titem->getName() << "' in "
- << titem->getParentUUID() << LL_ENDL;
- U32 callback_id;
- msg->getU32Fast(_PREHASH_ItemData, _PREHASH_CallbackID, callback_id);
- if(titem->getUUID().notNull() ) // && callback_id.notNull() )
- {
- items.push_back(titem);
- cblist.push_back(InventoryCallbackInfo(callback_id, titem->getUUID()));
- if (titem->getInventoryType() == LLInventoryType::IT_WEARABLE)
- {
- wearable_ids.push_back(titem->getUUID());
- }
- // examine update for changes.
- LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID());
- if(itemp)
- {
- if(titem->getParentUUID() == itemp->getParentUUID())
- {
- update[titem->getParentUUID()];
- }
- else
- {
- ++update[titem->getParentUUID()];
- --update[itemp->getParentUUID()];
- }
- }
- else
- {
- LLViewerInventoryCategory* folderp = gInventory.getCategory(titem->getParentUUID());
- if(folderp)
- {
+ }
+ }
+ }
+ }
+
+
+ count = msg->getNumberOfBlocksFast(_PREHASH_ItemData);
+ uuid_vec_t wearable_ids;
+ item_array_t items;
+ std::list<InventoryCallbackInfo> cblist;
+ for(i = 0; i < count; ++i)
+ {
+ LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
+ titem->unpackMessage(msg, _PREHASH_ItemData, i);
+ LL_DEBUGS("Inventory") << "unpacked item '" << titem->getName() << "' in "
+ << titem->getParentUUID() << LL_ENDL;
+ U32 callback_id;
+ msg->getU32Fast(_PREHASH_ItemData, _PREHASH_CallbackID, callback_id);
+ if(titem->getUUID().notNull() ) // && callback_id.notNull() )
+ {
+ items.push_back(titem);
+ cblist.push_back(InventoryCallbackInfo(callback_id, titem->getUUID()));
+ if (titem->getInventoryType() == LLInventoryType::IT_WEARABLE)
+ {
+ wearable_ids.push_back(titem->getUUID());
+ }
+ // examine update for changes.
+ LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID());
+ if(itemp)
+ {
+ if(titem->getParentUUID() == itemp->getParentUUID())
+ {
+ update[titem->getParentUUID()];
+ }
+ else
+ {
+ ++update[titem->getParentUUID()];
+ --update[itemp->getParentUUID()];
+ }
+ }
+ else
+ {
+ LLViewerInventoryCategory* folderp = gInventory.getCategory(titem->getParentUUID());
+ if(folderp)
+ {
if (folderp->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN)
{
++update[titem->getParentUUID()];
@@ -3903,18 +3903,18 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
{
folderp->fetch();
}
- }
- }
- }
- else
- {
- cblist.push_back(InventoryCallbackInfo(callback_id, LLUUID::null));
- }
- }
- gInventory.accountForUpdate(update);
-
- for (cat_array_t::iterator cit = folders.begin(); cit != folders.end(); ++cit)
- {
+ }
+ }
+ }
+ else
+ {
+ cblist.push_back(InventoryCallbackInfo(callback_id, LLUUID::null));
+ }
+ }
+ gInventory.accountForUpdate(update);
+
+ for (cat_array_t::iterator cit = folders.begin(); cit != folders.end(); ++cit)
+ {
gInventory.updateCategory(*cit);
if ((*cit)->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN)
{
@@ -3924,100 +3924,100 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
LLInventoryModelBackgroundFetch::instance().scheduleFolderFetch((*cit)->getUUID(), true /*force, since it has changes*/);
}
// else already called fetch() above
- }
- for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit)
- {
- gInventory.updateItem(*iit);
+ }
+ for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit)
+ {
+ gInventory.updateItem(*iit);
// Temporary workaround: just fetch the item using AIS to get missing fields.
// If this works fine we might want to extract 'ids only' from the message
// then use AIS as a primary fetcher
LLInventoryModelBackgroundFetch::instance().scheduleItemFetch((*iit)->getUUID(), true);
- }
- gInventory.notifyObservers();
-
- // The incoming inventory could span more than one BulkInventoryUpdate packet,
- // so record the transaction ID for this purchase, then wear all clothing
- // that comes in as part of that transaction ID. JC
- if (LLInventoryState::sWearNewClothing)
- {
- LLInventoryState::sWearNewClothingTransactionID = tid;
- LLInventoryState::sWearNewClothing = FALSE;
- }
-
- if (tid.notNull() && tid == LLInventoryState::sWearNewClothingTransactionID)
- {
- count = wearable_ids.size();
- for (i = 0; i < count; ++i)
- {
- LLViewerInventoryItem* wearable_item;
- wearable_item = gInventory.getItem(wearable_ids[i]);
- LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true);
- }
- }
-
- std::list<InventoryCallbackInfo>::iterator inv_it;
- for (inv_it = cblist.begin(); inv_it != cblist.end(); ++inv_it)
- {
- InventoryCallbackInfo cbinfo = (*inv_it);
- gInventoryCallbacks.fire(cbinfo.mCallback, cbinfo.mInvID);
- }
+ }
+ gInventory.notifyObservers();
+
+ // The incoming inventory could span more than one BulkInventoryUpdate packet,
+ // so record the transaction ID for this purchase, then wear all clothing
+ // that comes in as part of that transaction ID. JC
+ if (LLInventoryState::sWearNewClothing)
+ {
+ LLInventoryState::sWearNewClothingTransactionID = tid;
+ LLInventoryState::sWearNewClothing = FALSE;
+ }
+
+ if (tid.notNull() && tid == LLInventoryState::sWearNewClothingTransactionID)
+ {
+ count = wearable_ids.size();
+ for (i = 0; i < count; ++i)
+ {
+ LLViewerInventoryItem* wearable_item;
+ wearable_item = gInventory.getItem(wearable_ids[i]);
+ LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true);
+ }
+ }
+
+ std::list<InventoryCallbackInfo>::iterator inv_it;
+ for (inv_it = cblist.begin(); inv_it != cblist.end(); ++inv_it)
+ {
+ InventoryCallbackInfo cbinfo = (*inv_it);
+ gInventoryCallbacks.fire(cbinfo.mCallback, cbinfo.mInvID);
+ }
}
// static
void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**)
{
- LL_DEBUGS() << "LLInventoryModel::processMoveInventoryItem()" << LL_ENDL;
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS() << "Got a MoveInventoryItem message for the wrong agent."
- << LL_ENDL;
- return;
- }
-
- LLUUID item_id;
- LLUUID folder_id;
- std::string new_name;
- bool anything_changed = false;
- S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
- for(S32 i = 0; i < count; ++i)
- {
- msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id, i);
- LLViewerInventoryItem* item = gInventory.getItem(item_id);
- if(item)
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_FolderID, folder_id, i);
- msg->getString("InventoryData", "NewName", new_name, i);
-
- LL_DEBUGS() << "moving item " << item_id << " to folder "
- << folder_id << LL_ENDL;
- update_list_t update;
- LLCategoryUpdate old_folder(item->getParentUUID(), -1);
- update.push_back(old_folder);
- LLCategoryUpdate new_folder(folder_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
-
- new_item->setParent(folder_id);
- if (new_name.length() > 0)
- {
- new_item->rename(new_name);
- }
- gInventory.updateItem(new_item);
- anything_changed = true;
- }
- else
- {
- LL_INFOS() << "LLInventoryModel::processMoveInventoryItem item not found: " << item_id << LL_ENDL;
- }
- }
- if(anything_changed)
- {
- gInventory.notifyObservers();
- }
+ LL_DEBUGS() << "LLInventoryModel::processMoveInventoryItem()" << LL_ENDL;
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ if(agent_id != gAgent.getID())
+ {
+ LL_WARNS() << "Got a MoveInventoryItem message for the wrong agent."
+ << LL_ENDL;
+ return;
+ }
+
+ LLUUID item_id;
+ LLUUID folder_id;
+ std::string new_name;
+ bool anything_changed = false;
+ S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
+ for(S32 i = 0; i < count; ++i)
+ {
+ msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id, i);
+ LLViewerInventoryItem* item = gInventory.getItem(item_id);
+ if(item)
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_FolderID, folder_id, i);
+ msg->getString("InventoryData", "NewName", new_name, i);
+
+ LL_DEBUGS() << "moving item " << item_id << " to folder "
+ << folder_id << LL_ENDL;
+ update_list_t update;
+ LLCategoryUpdate old_folder(item->getParentUUID(), -1);
+ update.push_back(old_folder);
+ LLCategoryUpdate new_folder(folder_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ new_item->setParent(folder_id);
+ if (new_name.length() > 0)
+ {
+ new_item->rename(new_name);
+ }
+ gInventory.updateItem(new_item);
+ anything_changed = true;
+ }
+ else
+ {
+ LL_INFOS() << "LLInventoryModel::processMoveInventoryItem item not found: " << item_id << LL_ENDL;
+ }
+ }
+ if(anything_changed)
+ {
+ gInventory.notifyObservers();
+ }
}
//----------------------------------------------------------------------------
@@ -4026,274 +4026,274 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**)
bool LLInventoryModel::callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0) // YES
- {
- const LLUUID folder_id = findCategoryUUIDForType(preferred_type);
- purge_descendents_of(folder_id, NULL);
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0) // YES
+ {
+ const LLUUID folder_id = findCategoryUUIDForType(preferred_type);
+ purge_descendents_of(folder_id, NULL);
+ }
+ return false;
}
void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderType::EType preferred_type)
{
- if (!notification.empty())
- {
- LLSD args;
- if(LLFolderType::FT_TRASH == preferred_type)
- {
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- const LLUUID trash_id = findCategoryUUIDForType(preferred_type);
- gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); //All descendants
- S32 item_count = items.size() + cats.size();
- args["COUNT"] = item_count;
- }
- LLNotificationsUtil::add(notification, args, LLSD(),
- boost::bind(&LLInventoryModel::callbackEmptyFolderType, this, _1, _2, preferred_type));
- }
- else
- {
- const LLUUID folder_id = findCategoryUUIDForType(preferred_type);
- purge_descendents_of(folder_id, NULL);
- }
+ if (!notification.empty())
+ {
+ LLSD args;
+ if(LLFolderType::FT_TRASH == preferred_type)
+ {
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ const LLUUID trash_id = findCategoryUUIDForType(preferred_type);
+ gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); //All descendants
+ S32 item_count = items.size() + cats.size();
+ args["COUNT"] = item_count;
+ }
+ LLNotificationsUtil::add(notification, args, LLSD(),
+ boost::bind(&LLInventoryModel::callbackEmptyFolderType, this, _1, _2, preferred_type));
+ }
+ else
+ {
+ const LLUUID folder_id = findCategoryUUIDForType(preferred_type);
+ purge_descendents_of(folder_id, NULL);
+ }
}
//----------------------------------------------------------------------------
void LLInventoryModel::removeItem(const LLUUID& item_id)
{
- LLViewerInventoryItem* item = getItem(item_id);
- if (! item)
- {
- LL_WARNS("Inventory") << "couldn't find inventory item " << item_id << LL_ENDL;
- }
- else
- {
- const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if (new_parent.notNull())
- {
- LL_INFOS("Inventory") << "Moving to Trash (" << new_parent << "):" << LL_ENDL;
- changeItemParent(item, new_parent, TRUE);
- }
- }
+ LLViewerInventoryItem* item = getItem(item_id);
+ if (! item)
+ {
+ LL_WARNS("Inventory") << "couldn't find inventory item " << item_id << LL_ENDL;
+ }
+ else
+ {
+ const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if (new_parent.notNull())
+ {
+ LL_INFOS("Inventory") << "Moving to Trash (" << new_parent << "):" << LL_ENDL;
+ changeItemParent(item, new_parent, TRUE);
+ }
+ }
}
void LLInventoryModel::removeCategory(const LLUUID& category_id)
{
- if (! get_is_category_removable(this, category_id))
- {
- return;
- }
-
- // Look for any gestures and deactivate them
- LLInventoryModel::cat_array_t descendent_categories;
- LLInventoryModel::item_array_t descendent_items;
- collectDescendents(category_id, descendent_categories, descendent_items, FALSE);
-
- for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin();
- iter != descendent_items.end();
- ++iter)
- {
- const LLViewerInventoryItem* item = (*iter);
- const LLUUID& item_id = item->getUUID();
- if (item->getType() == LLAssetType::AT_GESTURE
- && LLGestureMgr::instance().isGestureActive(item_id))
- {
- LLGestureMgr::instance().deactivateGesture(item_id);
- }
- }
-
- LLViewerInventoryCategory* cat = getCategory(category_id);
- if (cat)
- {
- const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if (trash_id.notNull())
- {
- changeCategoryParent(cat, trash_id, TRUE);
- }
- }
-
- checkTrashOverflow();
+ if (! get_is_category_removable(this, category_id))
+ {
+ return;
+ }
+
+ // Look for any gestures and deactivate them
+ LLInventoryModel::cat_array_t descendent_categories;
+ LLInventoryModel::item_array_t descendent_items;
+ collectDescendents(category_id, descendent_categories, descendent_items, FALSE);
+
+ for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin();
+ iter != descendent_items.end();
+ ++iter)
+ {
+ const LLViewerInventoryItem* item = (*iter);
+ const LLUUID& item_id = item->getUUID();
+ if (item->getType() == LLAssetType::AT_GESTURE
+ && LLGestureMgr::instance().isGestureActive(item_id))
+ {
+ LLGestureMgr::instance().deactivateGesture(item_id);
+ }
+ }
+
+ LLViewerInventoryCategory* cat = getCategory(category_id);
+ if (cat)
+ {
+ const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if (trash_id.notNull())
+ {
+ changeCategoryParent(cat, trash_id, TRUE);
+ }
+ }
+
+ checkTrashOverflow();
}
void LLInventoryModel::removeObject(const LLUUID& object_id)
{
- if(object_id.isNull())
- {
- return;
- }
-
- LLInventoryObject* obj = getObject(object_id);
- if (dynamic_cast<LLViewerInventoryItem*>(obj))
- {
- removeItem(object_id);
- }
- else if (dynamic_cast<LLViewerInventoryCategory*>(obj))
- {
- removeCategory(object_id);
- }
- else if (obj)
- {
- LL_WARNS("Inventory") << "object ID " << object_id
- << " is an object of unrecognized class "
- << typeid(*obj).name() << LL_ENDL;
- }
- else
- {
- LL_WARNS("Inventory") << "object ID " << object_id << " not found" << LL_ENDL;
- }
+ if(object_id.isNull())
+ {
+ return;
+ }
+
+ LLInventoryObject* obj = getObject(object_id);
+ if (dynamic_cast<LLViewerInventoryItem*>(obj))
+ {
+ removeItem(object_id);
+ }
+ else if (dynamic_cast<LLViewerInventoryCategory*>(obj))
+ {
+ removeCategory(object_id);
+ }
+ else if (obj)
+ {
+ LL_WARNS("Inventory") << "object ID " << object_id
+ << " is an object of unrecognized class "
+ << typeid(*obj).name() << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Inventory") << "object ID " << object_id << " not found" << LL_ENDL;
+ }
}
bool callback_preview_trash_folder(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0) // YES
- {
- LLFloaterPreviewTrash::show();
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0) // YES
+ {
+ LLFloaterPreviewTrash::show();
+ }
+ return false;
}
void LLInventoryModel::checkTrashOverflow()
{
- static LLCachedControl<U32> trash_max_capacity(gSavedSettings, "InventoryTrashMaxCapacity");
-
- // Collect all descendants including those in subfolders.
- //
- // Note: Do we really need content of subfolders?
- // This was made to prevent download of trash folder timeouting
- // viewer and sub-folders are supposed to download independently.
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH);
- gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH);
- S32 item_count = items.size() + cats.size();
-
- if (item_count >= trash_max_capacity)
- {
- if (LLFloaterPreviewTrash::isVisible())
- {
- // bring to front
- LLFloaterPreviewTrash::show();
- }
- else
- {
- LLNotificationsUtil::add("TrashIsFull", LLSD(), LLSD(),
- boost::bind(callback_preview_trash_folder, _1, _2));
- }
- }
+ static LLCachedControl<U32> trash_max_capacity(gSavedSettings, "InventoryTrashMaxCapacity");
+
+ // Collect all descendants including those in subfolders.
+ //
+ // Note: Do we really need content of subfolders?
+ // This was made to prevent download of trash folder timeouting
+ // viewer and sub-folders are supposed to download independently.
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH);
+ S32 item_count = items.size() + cats.size();
+
+ if (item_count >= trash_max_capacity)
+ {
+ if (LLFloaterPreviewTrash::isVisible())
+ {
+ // bring to front
+ LLFloaterPreviewTrash::show();
+ }
+ else
+ {
+ LLNotificationsUtil::add("TrashIsFull", LLSD(), LLSD(),
+ boost::bind(callback_preview_trash_folder, _1, _2));
+ }
+ }
}
const LLUUID &LLInventoryModel::getRootFolderID() const
{
- return mRootFolderID;
+ return mRootFolderID;
}
void LLInventoryModel::setRootFolderID(const LLUUID& val)
{
- mRootFolderID = val;
+ mRootFolderID = val;
}
const LLUUID &LLInventoryModel::getLibraryRootFolderID() const
{
- return mLibraryRootFolderID;
+ return mLibraryRootFolderID;
}
void LLInventoryModel::setLibraryRootFolderID(const LLUUID& val)
{
- mLibraryRootFolderID = val;
+ mLibraryRootFolderID = val;
}
const LLUUID &LLInventoryModel::getLibraryOwnerID() const
{
- return mLibraryOwnerID;
+ return mLibraryOwnerID;
}
void LLInventoryModel::setLibraryOwnerID(const LLUUID& val)
{
- mLibraryOwnerID = val;
+ mLibraryOwnerID = val;
}
// static
BOOL LLInventoryModel::getIsFirstTimeInViewer2()
{
- // Do not call this before parentchild map is built.
- if (!gInventory.mIsAgentInvUsable)
- {
- LL_WARNS() << "Parent Child Map not yet built; guessing as first time in viewer2." << LL_ENDL;
- return TRUE;
- }
-
- return sFirstTimeInViewer2;
+ // Do not call this before parentchild map is built.
+ if (!gInventory.mIsAgentInvUsable)
+ {
+ LL_WARNS() << "Parent Child Map not yet built; guessing as first time in viewer2." << LL_ENDL;
+ return TRUE;
+ }
+
+ return sFirstTimeInViewer2;
}
LLInventoryModel::item_array_t::iterator LLInventoryModel::findItemIterByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id)
{
- LLInventoryModel::item_array_t::iterator curr_item = items.begin();
-
- while (curr_item != items.end())
- {
- if ((*curr_item)->getUUID() == id)
- {
- break;
- }
- ++curr_item;
- }
-
- return curr_item;
+ LLInventoryModel::item_array_t::iterator curr_item = items.begin();
+
+ while (curr_item != items.end())
+ {
+ if ((*curr_item)->getUUID() == id)
+ {
+ break;
+ }
+ ++curr_item;
+ }
+
+ return curr_item;
}
// static
// * @param[in, out] items - vector with items to be updated. It should be sorted in a right way
// * before calling this method.
// * @param src_item_id - LLUUID of inventory item to be moved in new position
-// * @param dest_item_id - LLUUID of inventory item before (or after) which source item should
+// * @param dest_item_id - LLUUID of inventory item before (or after) which source item should
// * be placed.
-// * @param insert_before - bool indicating if src_item_id should be placed before or after
+// * @param insert_before - bool indicating if src_item_id should be placed before or after
// * dest_item_id. Default is true.
void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id, bool insert_before)
{
- LLInventoryModel::item_array_t::iterator it_src = findItemIterByUUID(items, src_item_id);
- LLInventoryModel::item_array_t::iterator it_dest = findItemIterByUUID(items, dest_item_id);
-
- // If one of the passed UUID is not in the item list, bail out
- if ((it_src == items.end()) || (it_dest == items.end()))
- return;
-
- // Erase the source element from the list, keep a copy before erasing.
- LLViewerInventoryItem* src_item = *it_src;
- items.erase(it_src);
-
- // Note: Target iterator is not valid anymore because the container was changed, so update it.
- it_dest = findItemIterByUUID(items, dest_item_id);
-
- // Go to the next element if one wishes to insert after the dest element
- if (!insert_before)
- {
- ++it_dest;
- }
-
- // Reinsert the source item in the right place
- if (it_dest != items.end())
- {
- items.insert(it_dest, src_item);
- }
- else
- {
- // Append to the list if it_dest reached the end
- items.push_back(src_item);
- }
+ LLInventoryModel::item_array_t::iterator it_src = findItemIterByUUID(items, src_item_id);
+ LLInventoryModel::item_array_t::iterator it_dest = findItemIterByUUID(items, dest_item_id);
+
+ // If one of the passed UUID is not in the item list, bail out
+ if ((it_src == items.end()) || (it_dest == items.end()))
+ return;
+
+ // Erase the source element from the list, keep a copy before erasing.
+ LLViewerInventoryItem* src_item = *it_src;
+ items.erase(it_src);
+
+ // Note: Target iterator is not valid anymore because the container was changed, so update it.
+ it_dest = findItemIterByUUID(items, dest_item_id);
+
+ // Go to the next element if one wishes to insert after the dest element
+ if (!insert_before)
+ {
+ ++it_dest;
+ }
+
+ // Reinsert the source item in the right place
+ if (it_dest != items.end())
+ {
+ items.insert(it_dest, src_item);
+ }
+ else
+ {
+ // Append to the list if it_dest reached the end
+ items.push_back(src_item);
+ }
}
// See also LLInventorySort where landmarks in the Favorites folder are sorted.
class LLViewerInventoryItemSort
{
public:
- bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
- {
- return a->getSortField() < b->getSortField();
- }
+ bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
+ {
+ return a->getSortField() < b->getSortField();
+ }
};
//----------------------------------------------------------------------------
@@ -4301,95 +4301,95 @@ public:
// *NOTE: DEBUG functionality
void LLInventoryModel::dumpInventory() const
{
- LL_INFOS() << "\nBegin Inventory Dump\n**********************:" << LL_ENDL;
- LL_INFOS() << "mCategory[] contains " << mCategoryMap.size() << " items." << LL_ENDL;
- for(cat_map_t::const_iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit)
- {
- const LLViewerInventoryCategory* cat = cit->second;
- if(cat)
- {
- LL_INFOS() << " " << cat->getUUID() << " '" << cat->getName() << "' "
- << cat->getVersion() << " " << cat->getDescendentCount()
- << LL_ENDL;
- }
- else
- {
- LL_INFOS() << " NULL!" << LL_ENDL;
- }
- }
- LL_INFOS() << "mItemMap[] contains " << mItemMap.size() << " items." << LL_ENDL;
- for(item_map_t::const_iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit)
- {
- const LLViewerInventoryItem* item = iit->second;
- if(item)
- {
- LL_INFOS() << " " << item->getUUID() << " "
- << item->getName() << LL_ENDL;
- }
- else
- {
- LL_INFOS() << " NULL!" << LL_ENDL;
- }
- }
- LL_INFOS() << "\n**********************\nEnd Inventory Dump" << LL_ENDL;
+ LL_INFOS() << "\nBegin Inventory Dump\n**********************:" << LL_ENDL;
+ LL_INFOS() << "mCategory[] contains " << mCategoryMap.size() << " items." << LL_ENDL;
+ for(cat_map_t::const_iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit)
+ {
+ const LLViewerInventoryCategory* cat = cit->second;
+ if(cat)
+ {
+ LL_INFOS() << " " << cat->getUUID() << " '" << cat->getName() << "' "
+ << cat->getVersion() << " " << cat->getDescendentCount()
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << " NULL!" << LL_ENDL;
+ }
+ }
+ LL_INFOS() << "mItemMap[] contains " << mItemMap.size() << " items." << LL_ENDL;
+ for(item_map_t::const_iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit)
+ {
+ const LLViewerInventoryItem* item = iit->second;
+ if(item)
+ {
+ LL_INFOS() << " " << item->getUUID() << " "
+ << item->getName() << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << " NULL!" << LL_ENDL;
+ }
+ }
+ LL_INFOS() << "\n**********************\nEnd Inventory Dump" << LL_ENDL;
}
// Do various integrity checks on model, logging issues found and
-// returning an overall good/bad flag.
+// returning an overall good/bad flag.
LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const
{
- LLPointer<LLInventoryValidationInfo> validation_info = new LLInventoryValidationInfo;
- S32 fatal_errs = 0;
- S32 warning_count= 0;
+ LLPointer<LLInventoryValidationInfo> validation_info = new LLInventoryValidationInfo;
+ S32 fatal_errs = 0;
+ S32 warning_count= 0;
S32 loop_count = 0;
S32 orphaned_count = 0;
- if (getRootFolderID().isNull())
- {
- LL_WARNS("Inventory") << "Fatal inventory corruption: no root folder id" << LL_ENDL;
- validation_info->mFatalNoRootFolder = true;
+ if (getRootFolderID().isNull())
+ {
+ LL_WARNS("Inventory") << "Fatal inventory corruption: no root folder id" << LL_ENDL;
+ validation_info->mFatalNoRootFolder = true;
fatal_errs++;
- }
- if (getLibraryRootFolderID().isNull())
- {
- // Probably shouldn't be a fatality, inventory can function without a library
- LL_WARNS("Inventory") << "Fatal inventory corruption: no library root folder id" << LL_ENDL;
- validation_info->mFatalNoLibraryRootFolder = true;
+ }
+ if (getLibraryRootFolderID().isNull())
+ {
+ // Probably shouldn't be a fatality, inventory can function without a library
+ LL_WARNS("Inventory") << "Fatal inventory corruption: no library root folder id" << LL_ENDL;
+ validation_info->mFatalNoLibraryRootFolder = true;
fatal_errs++;
- }
-
- if (mCategoryMap.size() + 1 != mParentChildCategoryTree.size())
- {
- // ParentChild should be one larger because of the special entry for null uuid.
- LL_INFOS("Inventory") << "unexpected sizes: cat map size " << mCategoryMap.size()
- << " parent/child " << mParentChildCategoryTree.size() << LL_ENDL;
-
- validation_info->mWarnings["category_map_size"]++;
- warning_count++;
- }
- S32 cat_lock = 0;
- S32 item_lock = 0;
- S32 desc_unknown_count = 0;
- S32 version_unknown_count = 0;
-
- typedef std::map<LLFolderType::EType, S32> ft_count_map;
- ft_count_map ft_counts_under_root;
- ft_count_map ft_counts_elsewhere;
-
- // Loop over all categories and check.
- for(cat_map_t::const_iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit)
- {
- const LLUUID& cat_id = cit->first;
- const LLViewerInventoryCategory *cat = cit->second;
- if (!cat)
- {
- LL_WARNS("Inventory") << "null cat" << LL_ENDL;
- validation_info->mWarnings["null_cat"]++;
- warning_count++;
- continue;
- }
- LLUUID topmost_ancestor_id;
- // Will leave as null uuid on failure
+ }
+
+ if (mCategoryMap.size() + 1 != mParentChildCategoryTree.size())
+ {
+ // ParentChild should be one larger because of the special entry for null uuid.
+ LL_INFOS("Inventory") << "unexpected sizes: cat map size " << mCategoryMap.size()
+ << " parent/child " << mParentChildCategoryTree.size() << LL_ENDL;
+
+ validation_info->mWarnings["category_map_size"]++;
+ warning_count++;
+ }
+ S32 cat_lock = 0;
+ S32 item_lock = 0;
+ S32 desc_unknown_count = 0;
+ S32 version_unknown_count = 0;
+
+ typedef std::map<LLFolderType::EType, S32> ft_count_map;
+ ft_count_map ft_counts_under_root;
+ ft_count_map ft_counts_elsewhere;
+
+ // Loop over all categories and check.
+ for(cat_map_t::const_iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit)
+ {
+ const LLUUID& cat_id = cit->first;
+ const LLViewerInventoryCategory *cat = cit->second;
+ if (!cat)
+ {
+ LL_WARNS("Inventory") << "null cat" << LL_ENDL;
+ validation_info->mWarnings["null_cat"]++;
+ warning_count++;
+ continue;
+ }
+ LLUUID topmost_ancestor_id;
+ // Will leave as null uuid on failure
EAncestorResult res = getObjectTopmostAncestor(cat_id, topmost_ancestor_id);
switch (res)
{
@@ -4403,361 +4403,361 @@ LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const
break;
default:
LL_WARNS("Inventory") << "Unknown ancestor error for " << cat_id << LL_ENDL;
- validation_info->mWarnings["unknown_ancestor_status"]++;
+ validation_info->mWarnings["unknown_ancestor_status"]++;
warning_count++;
break;
}
- if (cat_id != cat->getUUID())
- {
- LL_WARNS("Inventory") << "cat id/index mismatch " << cat_id << " " << cat->getUUID() << LL_ENDL;
- validation_info->mWarnings["cat_id_index_mismatch"]++;
- warning_count++;
- }
-
- if (cat->getParentUUID().isNull())
- {
- if (cat_id != getRootFolderID() && cat_id != getLibraryRootFolderID())
- {
- LL_WARNS("Inventory") << "cat " << cat_id << " has no parent, but is not root ("
- << getRootFolderID() << ") or library root ("
- << getLibraryRootFolderID() << ")" << LL_ENDL;
- validation_info->mWarnings["null_parent"]++;
- warning_count++;
- }
- }
- cat_array_t* cats;
- item_array_t* items;
- getDirectDescendentsOf(cat_id,cats,items);
- if (!cats || !items)
- {
- LL_WARNS("Inventory") << "invalid direct descendents for " << cat_id << LL_ENDL;
- validation_info->mWarnings["direct_descendents"]++;
- warning_count++;
- continue;
- }
- if (cat->getDescendentCount() == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN)
- {
- desc_unknown_count++;
- }
- else if (cats->size() + items->size() != cat->getDescendentCount())
- {
- // In the case of library this is not unexpected, since
- // different user accounts may be getting the library
- // contents from different inventory hosts.
- if (topmost_ancestor_id.isNull() || topmost_ancestor_id != getLibraryRootFolderID())
- {
- LL_WARNS("Inventory") << "invalid desc count for " << cat_id << " [" << getFullPath(cat) << "]"
- << " cached " << cat->getDescendentCount()
- << " expected " << cats->size() << "+" << items->size()
- << "=" << cats->size() +items->size() << LL_ENDL;
- validation_info->mWarnings["invalid_descendent_count"]++;
- warning_count++;
- }
- }
- if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN)
- {
- version_unknown_count++;
- }
- auto cat_lock_it = mCategoryLock.find(cat_id);
- if (cat_lock_it != mCategoryLock.end() && cat_lock_it->second)
- {
- cat_lock++;
- }
- auto item_lock_it = mItemLock.find(cat_id);
- if (item_lock_it != mItemLock.end() && item_lock_it->second)
- {
- item_lock++;
- }
- for (S32 i = 0; i<items->size(); i++)
- {
- LLViewerInventoryItem *item = items->at(i);
-
- if (!item)
- {
- LL_WARNS("Inventory") << "null item at index " << i << " for cat " << cat_id << LL_ENDL;
- validation_info->mWarnings["null_item_at_index"]++;
- warning_count++;
- continue;
- }
-
- const LLUUID& item_id = item->getUUID();
-
- if (item->getParentUUID() != cat_id)
- {
- LL_WARNS("Inventory") << "wrong parent for " << item_id << " found "
- << item->getParentUUID() << " expected " << cat_id
- << LL_ENDL;
- validation_info->mWarnings["wrong_parent_for_item"]++;
- warning_count++;
- }
-
-
- // Entries in items and mItemMap should correspond.
- item_map_t::const_iterator it = mItemMap.find(item_id);
- if (it == mItemMap.end())
- {
- LL_WARNS("Inventory") << "item " << item_id << " found as child of "
- << cat_id << " but not in top level mItemMap" << LL_ENDL;
- validation_info->mWarnings["item_not_in_top_map"]++;
- warning_count++;
- }
- else
- {
- LLViewerInventoryItem *top_item = it->second;
- if (top_item != item)
- {
- LL_WARNS("Inventory") << "item mismatch, item_id " << item_id
- << " top level entry is different, uuid " << top_item->getUUID() << LL_ENDL;
- }
- }
-
- // Topmost ancestor should be root or library.
- LLUUID topmost_ancestor_id;
+ if (cat_id != cat->getUUID())
+ {
+ LL_WARNS("Inventory") << "cat id/index mismatch " << cat_id << " " << cat->getUUID() << LL_ENDL;
+ validation_info->mWarnings["cat_id_index_mismatch"]++;
+ warning_count++;
+ }
+
+ if (cat->getParentUUID().isNull())
+ {
+ if (cat_id != getRootFolderID() && cat_id != getLibraryRootFolderID())
+ {
+ LL_WARNS("Inventory") << "cat " << cat_id << " has no parent, but is not root ("
+ << getRootFolderID() << ") or library root ("
+ << getLibraryRootFolderID() << ")" << LL_ENDL;
+ validation_info->mWarnings["null_parent"]++;
+ warning_count++;
+ }
+ }
+ cat_array_t* cats;
+ item_array_t* items;
+ getDirectDescendentsOf(cat_id,cats,items);
+ if (!cats || !items)
+ {
+ LL_WARNS("Inventory") << "invalid direct descendents for " << cat_id << LL_ENDL;
+ validation_info->mWarnings["direct_descendents"]++;
+ warning_count++;
+ continue;
+ }
+ if (cat->getDescendentCount() == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN)
+ {
+ desc_unknown_count++;
+ }
+ else if (cats->size() + items->size() != cat->getDescendentCount())
+ {
+ // In the case of library this is not unexpected, since
+ // different user accounts may be getting the library
+ // contents from different inventory hosts.
+ if (topmost_ancestor_id.isNull() || topmost_ancestor_id != getLibraryRootFolderID())
+ {
+ LL_WARNS("Inventory") << "invalid desc count for " << cat_id << " [" << getFullPath(cat) << "]"
+ << " cached " << cat->getDescendentCount()
+ << " expected " << cats->size() << "+" << items->size()
+ << "=" << cats->size() +items->size() << LL_ENDL;
+ validation_info->mWarnings["invalid_descendent_count"]++;
+ warning_count++;
+ }
+ }
+ if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN)
+ {
+ version_unknown_count++;
+ }
+ auto cat_lock_it = mCategoryLock.find(cat_id);
+ if (cat_lock_it != mCategoryLock.end() && cat_lock_it->second)
+ {
+ cat_lock++;
+ }
+ auto item_lock_it = mItemLock.find(cat_id);
+ if (item_lock_it != mItemLock.end() && item_lock_it->second)
+ {
+ item_lock++;
+ }
+ for (S32 i = 0; i<items->size(); i++)
+ {
+ LLViewerInventoryItem *item = items->at(i);
+
+ if (!item)
+ {
+ LL_WARNS("Inventory") << "null item at index " << i << " for cat " << cat_id << LL_ENDL;
+ validation_info->mWarnings["null_item_at_index"]++;
+ warning_count++;
+ continue;
+ }
+
+ const LLUUID& item_id = item->getUUID();
+
+ if (item->getParentUUID() != cat_id)
+ {
+ LL_WARNS("Inventory") << "wrong parent for " << item_id << " found "
+ << item->getParentUUID() << " expected " << cat_id
+ << LL_ENDL;
+ validation_info->mWarnings["wrong_parent_for_item"]++;
+ warning_count++;
+ }
+
+
+ // Entries in items and mItemMap should correspond.
+ item_map_t::const_iterator it = mItemMap.find(item_id);
+ if (it == mItemMap.end())
+ {
+ LL_WARNS("Inventory") << "item " << item_id << " found as child of "
+ << cat_id << " but not in top level mItemMap" << LL_ENDL;
+ validation_info->mWarnings["item_not_in_top_map"]++;
+ warning_count++;
+ }
+ else
+ {
+ LLViewerInventoryItem *top_item = it->second;
+ if (top_item != item)
+ {
+ LL_WARNS("Inventory") << "item mismatch, item_id " << item_id
+ << " top level entry is different, uuid " << top_item->getUUID() << LL_ENDL;
+ }
+ }
+
+ // Topmost ancestor should be root or library.
+ LLUUID topmost_ancestor_id;
EAncestorResult found = getObjectTopmostAncestor(item_id, topmost_ancestor_id);
- if (found != ANCESTOR_OK)
- {
- LL_WARNS("Inventory") << "unable to find topmost ancestor for " << item_id << LL_ENDL;
- validation_info->mWarnings["topmost_ancestor_not_found"]++;
- warning_count++;
- }
- else
- {
- if (topmost_ancestor_id != getRootFolderID() &&
- topmost_ancestor_id != getLibraryRootFolderID())
- {
- LL_WARNS("Inventory") << "unrecognized top level ancestor for " << item_id
- << " got " << topmost_ancestor_id
- << " expected " << getRootFolderID()
- << " or " << getLibraryRootFolderID() << LL_ENDL;
- validation_info->mWarnings["topmost_ancestor_not_recognized"]++;
- warning_count++;
- }
- }
- }
-
- // Does this category appear as a child of its supposed parent?
- const LLUUID& parent_id = cat->getParentUUID();
- if (!parent_id.isNull())
- {
- cat_array_t* cats;
- item_array_t* items;
- getDirectDescendentsOf(parent_id,cats,items);
- if (!cats)
- {
- LL_WARNS("Inventory") << "cat " << cat_id << " name [" << cat->getName()
- << "] orphaned - no child cat array for alleged parent " << parent_id << LL_ENDL;
+ if (found != ANCESTOR_OK)
+ {
+ LL_WARNS("Inventory") << "unable to find topmost ancestor for " << item_id << LL_ENDL;
+ validation_info->mWarnings["topmost_ancestor_not_found"]++;
+ warning_count++;
+ }
+ else
+ {
+ if (topmost_ancestor_id != getRootFolderID() &&
+ topmost_ancestor_id != getLibraryRootFolderID())
+ {
+ LL_WARNS("Inventory") << "unrecognized top level ancestor for " << item_id
+ << " got " << topmost_ancestor_id
+ << " expected " << getRootFolderID()
+ << " or " << getLibraryRootFolderID() << LL_ENDL;
+ validation_info->mWarnings["topmost_ancestor_not_recognized"]++;
+ warning_count++;
+ }
+ }
+ }
+
+ // Does this category appear as a child of its supposed parent?
+ const LLUUID& parent_id = cat->getParentUUID();
+ if (!parent_id.isNull())
+ {
+ cat_array_t* cats;
+ item_array_t* items;
+ getDirectDescendentsOf(parent_id,cats,items);
+ if (!cats)
+ {
+ LL_WARNS("Inventory") << "cat " << cat_id << " name [" << cat->getName()
+ << "] orphaned - no child cat array for alleged parent " << parent_id << LL_ENDL;
orphaned_count++;
- }
- else
- {
- bool found = false;
- for (S32 i = 0; i<cats->size(); i++)
- {
- LLViewerInventoryCategory *kid_cat = cats->at(i);
- if (kid_cat == cat)
- {
- found = true;
- break;
- }
- }
- if (!found)
- {
- LL_WARNS("Inventory") << "cat " << cat_id << " name [" << cat->getName()
- << "] orphaned - not found in child cat array of alleged parent " << parent_id << LL_ENDL;
+ }
+ else
+ {
+ bool found = false;
+ for (S32 i = 0; i<cats->size(); i++)
+ {
+ LLViewerInventoryCategory *kid_cat = cats->at(i);
+ if (kid_cat == cat)
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ LL_WARNS("Inventory") << "cat " << cat_id << " name [" << cat->getName()
+ << "] orphaned - not found in child cat array of alleged parent " << parent_id << LL_ENDL;
orphaned_count++;
- }
- }
- }
-
- // Update count of preferred types
- LLFolderType::EType folder_type = cat->getPreferredType();
- bool cat_is_in_library = false;
- LLUUID topmost_id;
- if (getObjectTopmostAncestor(cat->getUUID(),topmost_id) == ANCESTOR_OK && topmost_id == getLibraryRootFolderID())
- {
- cat_is_in_library = true;
- }
- if (!cat_is_in_library)
- {
- if (getRootFolderID().notNull() && (cat->getUUID()==getRootFolderID() || cat->getParentUUID()==getRootFolderID()))
- {
- ft_counts_under_root[folder_type]++;
- if (folder_type != LLFolderType::FT_NONE)
- {
- LL_DEBUGS("Inventory") << "Under root cat: " << getFullPath(cat) << " folder_type " << folder_type << LL_ENDL;
- }
- }
- else
- {
- ft_counts_elsewhere[folder_type]++;
- if (folder_type != LLFolderType::FT_NONE)
- {
- LL_DEBUGS("Inventory") << "Elsewhere cat: " << getFullPath(cat) << " folder_type " << folder_type << LL_ENDL;
- }
- }
- }
- }
-
- // Loop over all items and check
- for(item_map_t::const_iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit)
- {
- const LLUUID& item_id = iit->first;
- LLViewerInventoryItem *item = iit->second;
- if (item->getUUID() != item_id)
- {
- LL_WARNS("Inventory") << "item_id " << item_id << " does not match " << item->getUUID() << LL_ENDL;
- validation_info->mWarnings["item_id_mismatch"]++;
- warning_count++;
- }
-
- const LLUUID& parent_id = item->getParentUUID();
- if (parent_id.isNull())
- {
- LL_WARNS("Inventory") << "item " << item_id << " name [" << item->getName() << "] has null parent id!" << LL_ENDL;
+ }
+ }
+ }
+
+ // Update count of preferred types
+ LLFolderType::EType folder_type = cat->getPreferredType();
+ bool cat_is_in_library = false;
+ LLUUID topmost_id;
+ if (getObjectTopmostAncestor(cat->getUUID(),topmost_id) == ANCESTOR_OK && topmost_id == getLibraryRootFolderID())
+ {
+ cat_is_in_library = true;
+ }
+ if (!cat_is_in_library)
+ {
+ if (getRootFolderID().notNull() && (cat->getUUID()==getRootFolderID() || cat->getParentUUID()==getRootFolderID()))
+ {
+ ft_counts_under_root[folder_type]++;
+ if (folder_type != LLFolderType::FT_NONE)
+ {
+ LL_DEBUGS("Inventory") << "Under root cat: " << getFullPath(cat) << " folder_type " << folder_type << LL_ENDL;
+ }
+ }
+ else
+ {
+ ft_counts_elsewhere[folder_type]++;
+ if (folder_type != LLFolderType::FT_NONE)
+ {
+ LL_DEBUGS("Inventory") << "Elsewhere cat: " << getFullPath(cat) << " folder_type " << folder_type << LL_ENDL;
+ }
+ }
+ }
+ }
+
+ // Loop over all items and check
+ for(item_map_t::const_iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit)
+ {
+ const LLUUID& item_id = iit->first;
+ LLViewerInventoryItem *item = iit->second;
+ if (item->getUUID() != item_id)
+ {
+ LL_WARNS("Inventory") << "item_id " << item_id << " does not match " << item->getUUID() << LL_ENDL;
+ validation_info->mWarnings["item_id_mismatch"]++;
+ warning_count++;
+ }
+
+ const LLUUID& parent_id = item->getParentUUID();
+ if (parent_id.isNull())
+ {
+ LL_WARNS("Inventory") << "item " << item_id << " name [" << item->getName() << "] has null parent id!" << LL_ENDL;
orphaned_count++;
- }
- else
- {
- cat_array_t* cats;
- item_array_t* items;
- getDirectDescendentsOf(parent_id,cats,items);
- if (!items)
- {
- LL_WARNS("Inventory") << "item " << item_id << " name [" << item->getName()
- << "] orphaned - alleged parent has no child items list " << parent_id << LL_ENDL;
+ }
+ else
+ {
+ cat_array_t* cats;
+ item_array_t* items;
+ getDirectDescendentsOf(parent_id,cats,items);
+ if (!items)
+ {
+ LL_WARNS("Inventory") << "item " << item_id << " name [" << item->getName()
+ << "] orphaned - alleged parent has no child items list " << parent_id << LL_ENDL;
orphaned_count++;
- }
- else
- {
- bool found = false;
- for (S32 i=0; i<items->size(); ++i)
- {
- if (items->at(i) == item)
- {
- found = true;
- break;
- }
- }
- if (!found)
- {
- LL_WARNS("Inventory") << "item " << item_id << " name [" << item->getName()
- << "] orphaned - not found as child of alleged parent " << parent_id << LL_ENDL;
+ }
+ else
+ {
+ bool found = false;
+ for (S32 i=0; i<items->size(); ++i)
+ {
+ if (items->at(i) == item)
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ LL_WARNS("Inventory") << "item " << item_id << " name [" << item->getName()
+ << "] orphaned - not found as child of alleged parent " << parent_id << LL_ENDL;
orphaned_count++;
- }
- }
-
- }
- // Link checking
- if (item->getIsLinkType())
- {
- const LLUUID& link_id = item->getUUID();
- const LLUUID& target_id = item->getLinkedUUID();
- LLViewerInventoryItem *target_item = getItem(target_id);
- LLViewerInventoryCategory *target_cat = getCategory(target_id);
- // Linked-to UUID should have back reference to this link.
- if (!hasBacklinkInfo(link_id, target_id))
- {
- LL_WARNS("Inventory") << "link " << item->getUUID() << " type " << item->getActualType()
- << " missing backlink info at target_id " << target_id
- << LL_ENDL;
+ }
+ }
+
+ }
+ // Link checking
+ if (item->getIsLinkType())
+ {
+ const LLUUID& link_id = item->getUUID();
+ const LLUUID& target_id = item->getLinkedUUID();
+ LLViewerInventoryItem *target_item = getItem(target_id);
+ LLViewerInventoryCategory *target_cat = getCategory(target_id);
+ // Linked-to UUID should have back reference to this link.
+ if (!hasBacklinkInfo(link_id, target_id))
+ {
+ LL_WARNS("Inventory") << "link " << item->getUUID() << " type " << item->getActualType()
+ << " missing backlink info at target_id " << target_id
+ << LL_ENDL;
orphaned_count++;
- }
- // Links should have referents.
- if (item->getActualType() == LLAssetType::AT_LINK && !target_item)
- {
- LL_WARNS("Inventory") << "broken item link " << item->getName() << " id " << item->getUUID() << LL_ENDL;
+ }
+ // Links should have referents.
+ if (item->getActualType() == LLAssetType::AT_LINK && !target_item)
+ {
+ LL_WARNS("Inventory") << "broken item link " << item->getName() << " id " << item->getUUID() << LL_ENDL;
orphaned_count++;
- }
- else if (item->getActualType() == LLAssetType::AT_LINK_FOLDER && !target_cat)
- {
- LL_WARNS("Inventory") << "broken folder link " << item->getName() << " id " << item->getUUID() << LL_ENDL;
+ }
+ else if (item->getActualType() == LLAssetType::AT_LINK_FOLDER && !target_cat)
+ {
+ LL_WARNS("Inventory") << "broken folder link " << item->getName() << " id " << item->getUUID() << LL_ENDL;
orphaned_count++;
- }
- if (target_item && target_item->getIsLinkType())
- {
- LL_WARNS("Inventory") << "link " << item->getName() << " references a link item "
- << target_item->getName() << " " << target_item->getUUID() << LL_ENDL;
- }
-
- // Links should not have backlinks.
- std::pair<backlink_mmap_t::const_iterator, backlink_mmap_t::const_iterator> range = mBacklinkMMap.equal_range(link_id);
- if (range.first != range.second)
- {
- LL_WARNS("Inventory") << "Link item " << item->getName() << " has backlinks!" << LL_ENDL;
- }
- }
- else
- {
- // Check the backlinks of a non-link item.
- const LLUUID& target_id = item->getUUID();
- std::pair<backlink_mmap_t::const_iterator, backlink_mmap_t::const_iterator> range = mBacklinkMMap.equal_range(target_id);
- for (backlink_mmap_t::const_iterator it = range.first; it != range.second; ++it)
- {
- const LLUUID& link_id = it->second;
- LLViewerInventoryItem *link_item = getItem(link_id);
- if (!link_item || !link_item->getIsLinkType())
- {
- LL_WARNS("Inventory") << "invalid backlink from target " << item->getName() << " to " << link_id << LL_ENDL;
- }
- }
- }
- }
-
- // Check system folders
- for (auto fit=ft_counts_under_root.begin(); fit != ft_counts_under_root.end(); ++fit)
- {
- LL_DEBUGS("Inventory") << "Folder type " << fit->first << " count " << fit->second << " under root" << LL_ENDL;
- }
- for (auto fit=ft_counts_elsewhere.begin(); fit != ft_counts_elsewhere.end(); ++fit)
- {
- LL_DEBUGS("Inventory") << "Folder type " << fit->first << " count " << fit->second << " elsewhere" << LL_ENDL;
- }
-
- static LLCachedControl<bool> fake_system_folder_issues(gSavedSettings, "QAModeFakeSystemFolderIssues", false);
- static std::default_random_engine e{};
+ }
+ if (target_item && target_item->getIsLinkType())
+ {
+ LL_WARNS("Inventory") << "link " << item->getName() << " references a link item "
+ << target_item->getName() << " " << target_item->getUUID() << LL_ENDL;
+ }
+
+ // Links should not have backlinks.
+ std::pair<backlink_mmap_t::const_iterator, backlink_mmap_t::const_iterator> range = mBacklinkMMap.equal_range(link_id);
+ if (range.first != range.second)
+ {
+ LL_WARNS("Inventory") << "Link item " << item->getName() << " has backlinks!" << LL_ENDL;
+ }
+ }
+ else
+ {
+ // Check the backlinks of a non-link item.
+ const LLUUID& target_id = item->getUUID();
+ std::pair<backlink_mmap_t::const_iterator, backlink_mmap_t::const_iterator> range = mBacklinkMMap.equal_range(target_id);
+ for (backlink_mmap_t::const_iterator it = range.first; it != range.second; ++it)
+ {
+ const LLUUID& link_id = it->second;
+ LLViewerInventoryItem *link_item = getItem(link_id);
+ if (!link_item || !link_item->getIsLinkType())
+ {
+ LL_WARNS("Inventory") << "invalid backlink from target " << item->getName() << " to " << link_id << LL_ENDL;
+ }
+ }
+ }
+ }
+
+ // Check system folders
+ for (auto fit=ft_counts_under_root.begin(); fit != ft_counts_under_root.end(); ++fit)
+ {
+ LL_DEBUGS("Inventory") << "Folder type " << fit->first << " count " << fit->second << " under root" << LL_ENDL;
+ }
+ for (auto fit=ft_counts_elsewhere.begin(); fit != ft_counts_elsewhere.end(); ++fit)
+ {
+ LL_DEBUGS("Inventory") << "Folder type " << fit->first << " count " << fit->second << " elsewhere" << LL_ENDL;
+ }
+
+ static LLCachedControl<bool> fake_system_folder_issues(gSavedSettings, "QAModeFakeSystemFolderIssues", false);
+ static std::default_random_engine e{};
static std::uniform_int_distribution<> distrib(0, 1);
- for (S32 ft=LLFolderType::FT_TEXTURE; ft<LLFolderType::FT_COUNT; ft++)
- {
- LLFolderType::EType folder_type = static_cast<LLFolderType::EType>(ft);
- if (LLFolderType::lookup(folder_type)==LLFolderType::badLookup())
- {
- continue;
- }
- bool is_automatic = LLFolderType::lookupIsAutomaticType(folder_type);
- bool is_singleton = LLFolderType::lookupIsSingletonType(folder_type);
- S32 count_under_root = ft_counts_under_root[folder_type];
- S32 count_elsewhere = ft_counts_elsewhere[folder_type];
- if (fake_system_folder_issues)
- {
- // Force all counts to be either 0 or 2, thus flagged as an error.
- count_under_root = 2*distrib(e);
- count_elsewhere = 2*distrib(e);
- validation_info->mFatalQADebugMode = true;
- }
- if (is_singleton)
- {
- if (count_under_root==0)
- {
- LL_WARNS("Inventory") << "Expected system folder type " << ft << " was not found under root" << LL_ENDL;
- // Need to create, if allowed.
- if (is_automatic)
- {
- LL_WARNS("Inventory") << "Fatal inventory corruption: cannot create system folder of type " << ft << LL_ENDL;
- validation_info->mMissingRequiredSystemFolders.insert(folder_type);
+ for (S32 ft=LLFolderType::FT_TEXTURE; ft<LLFolderType::FT_COUNT; ft++)
+ {
+ LLFolderType::EType folder_type = static_cast<LLFolderType::EType>(ft);
+ if (LLFolderType::lookup(folder_type)==LLFolderType::badLookup())
+ {
+ continue;
+ }
+ bool is_automatic = LLFolderType::lookupIsAutomaticType(folder_type);
+ bool is_singleton = LLFolderType::lookupIsSingletonType(folder_type);
+ S32 count_under_root = ft_counts_under_root[folder_type];
+ S32 count_elsewhere = ft_counts_elsewhere[folder_type];
+ if (fake_system_folder_issues)
+ {
+ // Force all counts to be either 0 or 2, thus flagged as an error.
+ count_under_root = 2*distrib(e);
+ count_elsewhere = 2*distrib(e);
+ validation_info->mFatalQADebugMode = true;
+ }
+ if (is_singleton)
+ {
+ if (count_under_root==0)
+ {
+ LL_WARNS("Inventory") << "Expected system folder type " << ft << " was not found under root" << LL_ENDL;
+ // Need to create, if allowed.
+ if (is_automatic)
+ {
+ LL_WARNS("Inventory") << "Fatal inventory corruption: cannot create system folder of type " << ft << LL_ENDL;
+ validation_info->mMissingRequiredSystemFolders.insert(folder_type);
fatal_errs++;
- }
- else
- {
- // Can create, and will when needed.
- // (Not sure this is really a warning, but worth logging)
- validation_info->mWarnings["missing_system_folder_can_create"]++;
- warning_count++;
- }
- }
- else if (count_under_root > 1)
- {
- validation_info->mDuplicateRequiredSystemFolders.insert(folder_type);
+ }
+ else
+ {
+ // Can create, and will when needed.
+ // (Not sure this is really a warning, but worth logging)
+ validation_info->mWarnings["missing_system_folder_can_create"]++;
+ warning_count++;
+ }
+ }
+ else if (count_under_root > 1)
+ {
+ validation_info->mDuplicateRequiredSystemFolders.insert(folder_type);
if (!is_automatic
&& folder_type != LLFolderType::FT_SETTINGS
// FT_MATERIAL might need to be automatic like the rest of upload folders
@@ -4766,7 +4766,7 @@ LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const
{
// It is a fatal problem or can lead to fatal problems for COF,
// outfits, trash and other non-automatic folders.
- validation_info->mFatalSystemDuplicate++;
+ validation_info->mFatalSystemDuplicate++;
fatal_errs++;
LL_WARNS("Inventory") << "Fatal inventory corruption: system folder type has excess copies under root, type " << ft << " count " << count_under_root << LL_ENDL;
}
@@ -4775,64 +4775,64 @@ LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const
// For automatic folders it's not a fatal issue and shouldn't
// break inventory or other functionality further
// Exception: FT_SETTINGS is not automatic, but only deserves a warning.
- validation_info->mWarnings["non_fatal_system_duplicate_under_root"]++;
+ validation_info->mWarnings["non_fatal_system_duplicate_under_root"]++;
warning_count++;
LL_WARNS("Inventory") << "System folder type has excess copies under root, type " << ft << " count " << count_under_root << LL_ENDL;
}
- }
- if (count_elsewhere > 0)
- {
- LL_WARNS("Inventory") << "Found " << count_elsewhere << " extra folders of type " << ft << " outside of root" << LL_ENDL;
- validation_info->mWarnings["non_fatal_system_duplicate_elsewhere"]++;
- warning_count++;
- }
- }
- }
-
-
- if (cat_lock > 0 || item_lock > 0)
- {
- LL_INFOS("Inventory") << "Found locks on some categories: sub-cat arrays "
- << cat_lock << ", item arrays " << item_lock << LL_ENDL;
- }
- if (desc_unknown_count != 0)
- {
- LL_DEBUGS() << "Found " << desc_unknown_count << " cats with unknown descendent count" << LL_ENDL;
- }
- if (version_unknown_count != 0)
- {
- LL_DEBUGS("Inventory") << "Found " << version_unknown_count << " cats with unknown version" << LL_ENDL;
- }
-
- // FIXME need to fail login and tell user to retry, contact support if problem persists.
- bool valid = (fatal_errs == 0);
- LL_INFOS("Inventory") << "Validate done, fatal errors: " << fatal_errs << ", warnings: " << warning_count << ", valid: " << valid << LL_ENDL;
-
- validation_info->mFatalErrorCount = fatal_errs;
- validation_info->mWarningCount = warning_count;
+ }
+ if (count_elsewhere > 0)
+ {
+ LL_WARNS("Inventory") << "Found " << count_elsewhere << " extra folders of type " << ft << " outside of root" << LL_ENDL;
+ validation_info->mWarnings["non_fatal_system_duplicate_elsewhere"]++;
+ warning_count++;
+ }
+ }
+ }
+
+
+ if (cat_lock > 0 || item_lock > 0)
+ {
+ LL_INFOS("Inventory") << "Found locks on some categories: sub-cat arrays "
+ << cat_lock << ", item arrays " << item_lock << LL_ENDL;
+ }
+ if (desc_unknown_count != 0)
+ {
+ LL_DEBUGS() << "Found " << desc_unknown_count << " cats with unknown descendent count" << LL_ENDL;
+ }
+ if (version_unknown_count != 0)
+ {
+ LL_DEBUGS("Inventory") << "Found " << version_unknown_count << " cats with unknown version" << LL_ENDL;
+ }
+
+ // FIXME need to fail login and tell user to retry, contact support if problem persists.
+ bool valid = (fatal_errs == 0);
+ LL_INFOS("Inventory") << "Validate done, fatal errors: " << fatal_errs << ", warnings: " << warning_count << ", valid: " << valid << LL_ENDL;
+
+ validation_info->mFatalErrorCount = fatal_errs;
+ validation_info->mWarningCount = warning_count;
validation_info->mLoopCount = loop_count;
validation_info->mOrphanedCount = orphaned_count;
- return validation_info;
+ return validation_info;
}
// Provides a unix-style path from root, like "/My Inventory/Clothing/.../myshirt"
std::string LLInventoryModel::getFullPath(const LLInventoryObject *obj) const
{
- std::vector<std::string> path_elts;
- std::map<LLUUID,bool> visited;
- while (obj != NULL && !visited[obj->getUUID()])
- {
- path_elts.push_back(obj->getName());
- // avoid infinite loop in the unlikely event of a cycle
- visited[obj->getUUID()] = true;
- obj = getObject(obj->getParentUUID());
- }
- std::stringstream s;
- std::string delim("/");
- std::reverse(path_elts.begin(), path_elts.end());
- std::string result = "/" + boost::algorithm::join(path_elts, delim);
- return result;
+ std::vector<std::string> path_elts;
+ std::map<LLUUID,bool> visited;
+ while (obj != NULL && !visited[obj->getUUID()])
+ {
+ path_elts.push_back(obj->getName());
+ // avoid infinite loop in the unlikely event of a cycle
+ visited[obj->getUUID()] = true;
+ obj = getObject(obj->getParentUUID());
+ }
+ std::stringstream s;
+ std::string delim("/");
+ std::reverse(path_elts.begin(), path_elts.end());
+ std::string result = "/" + boost::algorithm::join(path_elts, delim);
+ return result;
}
///----------------------------------------------------------------------------
@@ -4843,41 +4843,41 @@ std::string LLInventoryModel::getFullPath(const LLInventoryObject *obj) const
#if 0
BOOL decompress_file(const char* src_filename, const char* dst_filename)
{
- BOOL rv = FALSE;
- gzFile src = NULL;
- U8* buffer = NULL;
- LLFILE* dst = NULL;
- S32 bytes = 0;
- const S32 DECOMPRESS_BUFFER_SIZE = 32000;
-
- // open the files
- src = gzopen(src_filename, "rb");
- if(!src) goto err_decompress;
- dst = LLFile::fopen(dst_filename, "wb");
- if(!dst) goto err_decompress;
-
- // decompress.
- buffer = new U8[DECOMPRESS_BUFFER_SIZE + 1];
-
- do
- {
- bytes = gzread(src, buffer, DECOMPRESS_BUFFER_SIZE);
- if (bytes < 0)
- {
- goto err_decompress;
- }
-
- fwrite(buffer, bytes, 1, dst);
- } while(gzeof(src) == 0);
-
- // success
- rv = TRUE;
+ BOOL rv = FALSE;
+ gzFile src = NULL;
+ U8* buffer = NULL;
+ LLFILE* dst = NULL;
+ S32 bytes = 0;
+ const S32 DECOMPRESS_BUFFER_SIZE = 32000;
+
+ // open the files
+ src = gzopen(src_filename, "rb");
+ if(!src) goto err_decompress;
+ dst = LLFile::fopen(dst_filename, "wb");
+ if(!dst) goto err_decompress;
+
+ // decompress.
+ buffer = new U8[DECOMPRESS_BUFFER_SIZE + 1];
+
+ do
+ {
+ bytes = gzread(src, buffer, DECOMPRESS_BUFFER_SIZE);
+ if (bytes < 0)
+ {
+ goto err_decompress;
+ }
+
+ fwrite(buffer, bytes, 1, dst);
+ } while(gzeof(src) == 0);
+
+ // success
+ rv = TRUE;
err_decompress:
- if(src != NULL) gzclose(src);
- if(buffer != NULL) delete[] buffer;
- if(dst != NULL) fclose(dst);
- return rv;
+ if(src != NULL) gzclose(src);
+ if(buffer != NULL) delete[] buffer;
+ if(dst != NULL) fclose(dst);
+ return rv;
}
#endif
@@ -4887,163 +4887,163 @@ BOOL decompress_file(const char* src_filename, const char* dst_filename)
///----------------------------------------------------------------------------
LLInventoryModel::FetchItemHttpHandler::FetchItemHttpHandler(const LLSD & request_sd)
- : LLCore::HttpHandler(),
- mRequestSD(request_sd)
+ : LLCore::HttpHandler(),
+ mRequestSD(request_sd)
{}
LLInventoryModel::FetchItemHttpHandler::~FetchItemHttpHandler()
{}
void LLInventoryModel::FetchItemHttpHandler::onCompleted(LLCore::HttpHandle handle,
- LLCore::HttpResponse * response)
+ LLCore::HttpResponse * response)
{
- do // Single-pass do-while used for common exit handling
- {
- LLCore::HttpStatus status(response->getStatus());
- // status = LLCore::HttpStatus(404); // Dev tool to force error handling
- if (! status)
- {
- processFailure(status, response);
- break; // Goto common exit
- }
-
- LLCore::BufferArray * body(response->getBody());
- // body = NULL; // Dev tool to force error handling
- if (! body || ! body->size())
- {
- LL_WARNS(LOG_INV) << "Missing data in inventory item query." << LL_ENDL;
- processFailure("HTTP response for inventory item query missing body", response);
- break; // Goto common exit
- }
-
- // body->write(0, "Garbage Response", 16); // Dev tool to force error handling
- LLSD body_llsd;
- if (! LLCoreHttpUtil::responseToLLSD(response, true, body_llsd))
- {
- // INFOS-level logging will occur on the parsed failure
- processFailure("HTTP response for inventory item query has malformed LLSD", response);
- break; // Goto common exit
- }
-
- // Expect top-level structure to be a map
- // body_llsd = LLSD::emptyArray(); // Dev tool to force error handling
- if (! body_llsd.isMap())
- {
- processFailure("LLSD response for inventory item not a map", response);
- break; // Goto common exit
- }
-
- // Check for 200-with-error failures
- //
- // Original Responder-based serivce model didn't check for these errors.
- // It may be more robust to ignore this condition. With aggregated requests,
- // an error in one inventory item might take down the entire request.
- // So if this instead broke up the aggregated items into single requests,
- // maybe that would make progress. Or perhaps there's structured information
- // that can tell us what went wrong. Need to dig into this and firm up
- // the API.
- //
- // body_llsd["error"] = LLSD::emptyMap(); // Dev tool to force error handling
- // body_llsd["error"]["identifier"] = "Development";
- // body_llsd["error"]["message"] = "You left development code in the viewer";
- if (body_llsd.has("error"))
- {
- processFailure("Inventory application error (200-with-error)", response);
- break; // Goto common exit
- }
-
- // Okay, process data if possible
- processData(body_llsd, response);
- }
- while (false);
+ do // Single-pass do-while used for common exit handling
+ {
+ LLCore::HttpStatus status(response->getStatus());
+ // status = LLCore::HttpStatus(404); // Dev tool to force error handling
+ if (! status)
+ {
+ processFailure(status, response);
+ break; // Goto common exit
+ }
+
+ LLCore::BufferArray * body(response->getBody());
+ // body = NULL; // Dev tool to force error handling
+ if (! body || ! body->size())
+ {
+ LL_WARNS(LOG_INV) << "Missing data in inventory item query." << LL_ENDL;
+ processFailure("HTTP response for inventory item query missing body", response);
+ break; // Goto common exit
+ }
+
+ // body->write(0, "Garbage Response", 16); // Dev tool to force error handling
+ LLSD body_llsd;
+ if (! LLCoreHttpUtil::responseToLLSD(response, true, body_llsd))
+ {
+ // INFOS-level logging will occur on the parsed failure
+ processFailure("HTTP response for inventory item query has malformed LLSD", response);
+ break; // Goto common exit
+ }
+
+ // Expect top-level structure to be a map
+ // body_llsd = LLSD::emptyArray(); // Dev tool to force error handling
+ if (! body_llsd.isMap())
+ {
+ processFailure("LLSD response for inventory item not a map", response);
+ break; // Goto common exit
+ }
+
+ // Check for 200-with-error failures
+ //
+ // Original Responder-based serivce model didn't check for these errors.
+ // It may be more robust to ignore this condition. With aggregated requests,
+ // an error in one inventory item might take down the entire request.
+ // So if this instead broke up the aggregated items into single requests,
+ // maybe that would make progress. Or perhaps there's structured information
+ // that can tell us what went wrong. Need to dig into this and firm up
+ // the API.
+ //
+ // body_llsd["error"] = LLSD::emptyMap(); // Dev tool to force error handling
+ // body_llsd["error"]["identifier"] = "Development";
+ // body_llsd["error"]["message"] = "You left development code in the viewer";
+ if (body_llsd.has("error"))
+ {
+ processFailure("Inventory application error (200-with-error)", response);
+ break; // Goto common exit
+ }
+
+ // Okay, process data if possible
+ processData(body_llsd, response);
+ }
+ while (false);
}
void LLInventoryModel::FetchItemHttpHandler::processData(LLSD & content, LLCore::HttpResponse * response)
{
- start_new_inventory_observer();
+ start_new_inventory_observer();
#if 0
- LLUUID agent_id;
- agent_id = content["agent_id"].asUUID();
- if (agent_id != gAgent.getID())
- {
- LL_WARNS(LOG_INV) << "Got a inventory update for the wrong agent: " << agent_id
- << LL_ENDL;
- return;
- }
+ LLUUID agent_id;
+ agent_id = content["agent_id"].asUUID();
+ if (agent_id != gAgent.getID())
+ {
+ LL_WARNS(LOG_INV) << "Got a inventory update for the wrong agent: " << agent_id
+ << LL_ENDL;
+ return;
+ }
#endif
-
- LLInventoryModel::item_array_t items;
- LLInventoryModel::update_map_t update;
- LLUUID folder_id;
- LLSD content_items(content["items"]);
- const S32 count(content_items.size());
-
- // Does this loop ever execute more than once?
- for (S32 i(0); i < count; ++i)
- {
- LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
- titem->unpackMessage(content_items[i]);
-
- LL_DEBUGS(LOG_INV) << "ItemHttpHandler::httpSuccess item id: "
- << titem->getUUID() << LL_ENDL;
- items.push_back(titem);
-
- // examine update for changes.
- LLViewerInventoryItem * itemp(gInventory.getItem(titem->getUUID()));
-
- if (itemp)
- {
- if (titem->getParentUUID() == itemp->getParentUUID())
- {
- update[titem->getParentUUID()];
- }
- else
- {
- ++update[titem->getParentUUID()];
- --update[itemp->getParentUUID()];
- }
- }
- else
- {
- ++update[titem->getParentUUID()];
- }
-
- if (folder_id.isNull())
- {
- folder_id = titem->getParentUUID();
- }
- }
-
- // as above, this loop never seems to loop more than once per call
- for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
- {
- gInventory.updateItem(*it);
- }
- gInventory.notifyObservers();
- gViewerWindow->getWindow()->decBusyCount();
+
+ LLInventoryModel::item_array_t items;
+ LLInventoryModel::update_map_t update;
+ LLUUID folder_id;
+ LLSD content_items(content["items"]);
+ const S32 count(content_items.size());
+
+ // Does this loop ever execute more than once?
+ for (S32 i(0); i < count; ++i)
+ {
+ LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
+ titem->unpackMessage(content_items[i]);
+
+ LL_DEBUGS(LOG_INV) << "ItemHttpHandler::httpSuccess item id: "
+ << titem->getUUID() << LL_ENDL;
+ items.push_back(titem);
+
+ // examine update for changes.
+ LLViewerInventoryItem * itemp(gInventory.getItem(titem->getUUID()));
+
+ if (itemp)
+ {
+ if (titem->getParentUUID() == itemp->getParentUUID())
+ {
+ update[titem->getParentUUID()];
+ }
+ else
+ {
+ ++update[titem->getParentUUID()];
+ --update[itemp->getParentUUID()];
+ }
+ }
+ else
+ {
+ ++update[titem->getParentUUID()];
+ }
+
+ if (folder_id.isNull())
+ {
+ folder_id = titem->getParentUUID();
+ }
+ }
+
+ // as above, this loop never seems to loop more than once per call
+ for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
+ {
+ gInventory.updateItem(*it);
+ }
+ gInventory.notifyObservers();
+ gViewerWindow->getWindow()->decBusyCount();
}
void LLInventoryModel::FetchItemHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::HttpResponse * response)
{
- const std::string & ct(response->getContentType());
- LL_WARNS(LOG_INV) << "Inventory item fetch failure\n"
- << "[Status: " << status.toTerseString() << "]\n"
- << "[Reason: " << status.toString() << "]\n"
- << "[Content-type: " << ct << "]\n"
- << "[Content (abridged): "
- << LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
- gInventory.notifyObservers();
+ const std::string & ct(response->getContentType());
+ LL_WARNS(LOG_INV) << "Inventory item fetch failure\n"
+ << "[Status: " << status.toTerseString() << "]\n"
+ << "[Reason: " << status.toString() << "]\n"
+ << "[Content-type: " << ct << "]\n"
+ << "[Content (abridged): "
+ << LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
+ gInventory.notifyObservers();
}
void LLInventoryModel::FetchItemHttpHandler::processFailure(const char * const reason, LLCore::HttpResponse * response)
{
- LL_WARNS(LOG_INV) << "Inventory item fetch failure\n"
- << "[Status: internal error]\n"
- << "[Reason: " << reason << "]\n"
- << "[Content (abridged): "
- << LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
- gInventory.notifyObservers();
+ LL_WARNS(LOG_INV) << "Inventory item fetch failure\n"
+ << "[Status: internal error]\n"
+ << "[Reason: " << reason << "]\n"
+ << "[Content (abridged): "
+ << LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
+ gInventory.notifyObservers();
}
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 69d987cabd..3b943dd121 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventorymodel.h
* @brief LLInventoryModel class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,182 +55,182 @@ class LLMessageSystem;
class LLInventoryCollectFunctor;
///----------------------------------------------------------------------------
-/// LLInventoryValidationInfo
+/// LLInventoryValidationInfo
///----------------------------------------------------------------------------
class LLInventoryValidationInfo: public LLRefCount
{
public:
- LLInventoryValidationInfo();
- void toOstream(std::ostream& os) const;
- void asLLSD(LLSD& sd) const;
-
- bool mInitialized{false};
- S32 mWarningCount{0};
- std::map<std::string,U32> mWarnings;
+ LLInventoryValidationInfo();
+ void toOstream(std::ostream& os) const;
+ void asLLSD(LLSD& sd) const;
+
+ bool mInitialized{false};
+ S32 mWarningCount{0};
+ std::map<std::string,U32> mWarnings;
S32 mLoopCount{0}; // Presence of folders whose ancestors loop onto themselves
S32 mOrphanedCount{0}; // Missing or orphaned items, links and folders
- S32 mFatalErrorCount{0};
- bool mFatalNoRootFolder{false};
- S32 mFatalSystemDuplicate{0};
- bool mFatalNoLibraryRootFolder{false};
- bool mFatalQADebugMode{false};
+ S32 mFatalErrorCount{0};
+ bool mFatalNoRootFolder{false};
+ S32 mFatalSystemDuplicate{0};
+ bool mFatalNoLibraryRootFolder{false};
+ bool mFatalQADebugMode{false};
- std::set<LLFolderType::EType> mMissingRequiredSystemFolders;
- std::set<LLFolderType::EType> mDuplicateRequiredSystemFolders;
+ std::set<LLFolderType::EType> mMissingRequiredSystemFolders;
+ std::set<LLFolderType::EType> mDuplicateRequiredSystemFolders;
};
std::ostream& operator<<(std::ostream& s, const LLInventoryValidationInfo& v);
///----------------------------------------------------------------------------
// LLInventoryModel
//
-// Represents a collection of inventory, and provides efficient ways to access
+// Represents a collection of inventory, and provides efficient ways to access
// that information.
-// NOTE: This class could in theory be used for any place where you need
-// inventory, though it optimizes for time efficiency - not space efficiency,
+// NOTE: This class could in theory be used for any place where you need
+// inventory, though it optimizes for time efficiency - not space efficiency,
// probably making it inappropriate for use on tasks.
///----------------------------------------------------------------------------
class LLInventoryModel
{
- LOG_CLASS(LLInventoryModel);
+ LOG_CLASS(LLInventoryModel);
public:
- enum EHasChildren
- {
- CHILDREN_NO,
- CHILDREN_YES,
- CHILDREN_MAYBE
- };
-
- typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t;
- typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
- typedef std::set<LLUUID> changed_items_t;
-
- // Rider: This is using the old responder patter. It should be refactored to
+ enum EHasChildren
+ {
+ CHILDREN_NO,
+ CHILDREN_YES,
+ CHILDREN_MAYBE
+ };
+
+ typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t;
+ typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
+ typedef std::set<LLUUID> changed_items_t;
+
+ // Rider: This is using the old responder patter. It should be refactored to
// take advantage of coroutines.
- // HTTP handler for individual item requests (inventory or library).
- // Background item requests are derived from this in the background
- // inventory system. All folder requests are also located there
- // but have their own handler derived from HttpHandler.
- class FetchItemHttpHandler : public LLCore::HttpHandler
- {
- public:
- LOG_CLASS(FetchItemHttpHandler);
+ // HTTP handler for individual item requests (inventory or library).
+ // Background item requests are derived from this in the background
+ // inventory system. All folder requests are also located there
+ // but have their own handler derived from HttpHandler.
+ class FetchItemHttpHandler : public LLCore::HttpHandler
+ {
+ public:
+ LOG_CLASS(FetchItemHttpHandler);
- FetchItemHttpHandler(const LLSD & request_sd);
- virtual ~FetchItemHttpHandler();
+ FetchItemHttpHandler(const LLSD & request_sd);
+ virtual ~FetchItemHttpHandler();
- protected:
- FetchItemHttpHandler(const FetchItemHttpHandler &); // Not defined
- void operator=(const FetchItemHttpHandler &); // Not defined
+ protected:
+ FetchItemHttpHandler(const FetchItemHttpHandler &); // Not defined
+ void operator=(const FetchItemHttpHandler &); // Not defined
- public:
- virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
+ public:
+ virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
- private:
- void processData(LLSD & body, LLCore::HttpResponse * response);
- void processFailure(LLCore::HttpStatus status, LLCore::HttpResponse * response);
- void processFailure(const char * const reason, LLCore::HttpResponse * response);
+ private:
+ void processData(LLSD & body, LLCore::HttpResponse * response);
+ void processFailure(LLCore::HttpStatus status, LLCore::HttpResponse * response);
+ void processFailure(const char * const reason, LLCore::HttpResponse * response);
- private:
- LLSD mRequestSD;
- };
+ private:
+ LLSD mRequestSD;
+ };
/********************************************************************************
** **
** INITIALIZATION/SETUP
**/
- //--------------------------------------------------------------------
- // Constructors / Destructors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Constructors / Destructors
+ //--------------------------------------------------------------------
public:
- LLInventoryModel();
- ~LLInventoryModel();
- void cleanupInventory();
+ LLInventoryModel();
+ ~LLInventoryModel();
+ void cleanupInventory();
protected:
- void empty(); // empty the entire contents
+ void empty(); // empty the entire contents
- //--------------------------------------------------------------------
- // Initialization
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Initialization
+ //--------------------------------------------------------------------
public:
- // The inventory model usage is sensitive to the initial construction of the model
- bool isInventoryUsable() const;
+ // The inventory model usage is sensitive to the initial construction of the model
+ bool isInventoryUsable() const;
private:
- bool mIsAgentInvUsable; // used to handle an invalid inventory state
-
- // One-time initialization of HTTP system.
- void initHttpRequest();
-
- //--------------------------------------------------------------------
- // Root Folders
- //--------------------------------------------------------------------
+ bool mIsAgentInvUsable; // used to handle an invalid inventory state
+
+ // One-time initialization of HTTP system.
+ void initHttpRequest();
+
+ //--------------------------------------------------------------------
+ // Root Folders
+ //--------------------------------------------------------------------
public:
- // The following are set during login with data from the server
- void setRootFolderID(const LLUUID& id);
- void setLibraryOwnerID(const LLUUID& id);
- void setLibraryRootFolderID(const LLUUID& id);
-
- const LLUUID &getRootFolderID() const;
- const LLUUID &getLibraryOwnerID() const;
- const LLUUID &getLibraryRootFolderID() const;
+ // The following are set during login with data from the server
+ void setRootFolderID(const LLUUID& id);
+ void setLibraryOwnerID(const LLUUID& id);
+ void setLibraryRootFolderID(const LLUUID& id);
+
+ const LLUUID &getRootFolderID() const;
+ const LLUUID &getLibraryOwnerID() const;
+ const LLUUID &getLibraryRootFolderID() const;
private:
- LLUUID mRootFolderID;
- LLUUID mLibraryRootFolderID;
- LLUUID mLibraryOwnerID;
-
- //--------------------------------------------------------------------
- // Structure
- //--------------------------------------------------------------------
+ LLUUID mRootFolderID;
+ LLUUID mLibraryRootFolderID;
+ LLUUID mLibraryOwnerID;
+
+ //--------------------------------------------------------------------
+ // Structure
+ //--------------------------------------------------------------------
public:
- // Methods to load up inventory skeleton & meat. These are used
- // during authentication. Returns true if everything parsed.
- bool loadSkeleton(const LLSD& options, const LLUUID& owner_id);
- void buildParentChildMap(); // brute force method to rebuild the entire parent-child relations
- void createCommonSystemCategories();
+ // Methods to load up inventory skeleton & meat. These are used
+ // during authentication. Returns true if everything parsed.
+ bool loadSkeleton(const LLSD& options, const LLUUID& owner_id);
+ void buildParentChildMap(); // brute force method to rebuild the entire parent-child relations
+ void createCommonSystemCategories();
- static std::string getInvCacheAddres(const LLUUID& owner_id);
+ static std::string getInvCacheAddres(const LLUUID& owner_id);
- // Call on logout to save a terse representation.
- void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id);
+ // Call on logout to save a terse representation.
+ void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id);
private:
- // Information for tracking the actual inventory. We index this
- // information in a lot of different ways so we can access
- // the inventory using several different identifiers.
- // mInventory member data is the 'master' list of inventory, and
- // mCategoryMap and mItemMap store uuid->object mappings.
- typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t;
- typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t;
- cat_map_t mCategoryMap;
- item_map_t mItemMap;
- // This last set of indices is used to map parents to children.
- typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
- typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
- parent_cat_map_t mParentChildCategoryTree;
- parent_item_map_t mParentChildItemTree;
-
- // Track links to items and categories. We do not store item or
- // category pointers here, because broken links are also supported.
- typedef std::multimap<LLUUID, LLUUID> backlink_mmap_t;
- backlink_mmap_t mBacklinkMMap; // key = target_id: ID of item, values = link_ids: IDs of item or folder links referencing it.
- // For internal use only
- bool hasBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id) const;
- void addBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id);
- void removeBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id);
-
- //--------------------------------------------------------------------
- // Login
- //--------------------------------------------------------------------
+ // Information for tracking the actual inventory. We index this
+ // information in a lot of different ways so we can access
+ // the inventory using several different identifiers.
+ // mInventory member data is the 'master' list of inventory, and
+ // mCategoryMap and mItemMap store uuid->object mappings.
+ typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t;
+ typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t;
+ cat_map_t mCategoryMap;
+ item_map_t mItemMap;
+ // This last set of indices is used to map parents to children.
+ typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
+ typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
+ parent_cat_map_t mParentChildCategoryTree;
+ parent_item_map_t mParentChildItemTree;
+
+ // Track links to items and categories. We do not store item or
+ // category pointers here, because broken links are also supported.
+ typedef std::multimap<LLUUID, LLUUID> backlink_mmap_t;
+ backlink_mmap_t mBacklinkMMap; // key = target_id: ID of item, values = link_ids: IDs of item or folder links referencing it.
+ // For internal use only
+ bool hasBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id) const;
+ void addBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id);
+ void removeBacklinkInfo(const LLUUID& link_id, const LLUUID& target_id);
+
+ //--------------------------------------------------------------------
+ // Login
+ //--------------------------------------------------------------------
public:
- static BOOL getIsFirstTimeInViewer2();
+ static BOOL getIsFirstTimeInViewer2();
static bool isSysFoldersReady() { return (sPendingSystemFolders == 0); }
private:
- static BOOL sFirstTimeInViewer2;
- const static S32 sCurrentInvCacheVersion; // expected inventory cache version
+ static BOOL sFirstTimeInViewer2;
+ const static S32 sCurrentInvCacheVersion; // expected inventory cache version
static S32 sPendingSystemFolders;
@@ -243,129 +243,129 @@ private:
** ACCESSORS
**/
- //--------------------------------------------------------------------
- // Descendants
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Descendants
+ //--------------------------------------------------------------------
public:
- // Make sure we have the descendants in the structure. Returns true
- // if a fetch was performed.
- bool fetchDescendentsOf(const LLUUID& folder_id) const;
-
- // Return the direct descendants of the id provided.Set passed
- // in values to NULL if the call fails.
- // NOTE: The array provided points straight into the guts of
- // this object, and should only be used for read operations, since
- // modifications may invalidate the internal state of the inventory.
- void getDirectDescendentsOf(const LLUUID& cat_id,
- cat_array_t*& categories,
- item_array_t*& items) const;
+ // Make sure we have the descendants in the structure. Returns true
+ // if a fetch was performed.
+ bool fetchDescendentsOf(const LLUUID& folder_id) const;
+
+ // Return the direct descendants of the id provided.Set passed
+ // in values to NULL if the call fails.
+ // NOTE: The array provided points straight into the guts of
+ // this object, and should only be used for read operations, since
+ // modifications may invalidate the internal state of the inventory.
+ void getDirectDescendentsOf(const LLUUID& cat_id,
+ cat_array_t*& categories,
+ item_array_t*& items) const;
void getDirectDescendentsOf(const LLUUID& cat_id, cat_array_t& categories, item_array_t& items, LLInventoryCollectFunctor& f) const;
- typedef LLUUID digest_t; // To clarify the actual usage of this "UUID"
- // Compute a hash of direct descendant names (for detecting child name changes)
- digest_t hashDirectDescendentNames(const LLUUID& cat_id) const;
-
- // Starting with the object specified, add its descendants to the
- // array provided, but do not add the inventory object specified
- // by id. There is no guaranteed order.
- // NOTE: Neither array will be erased before adding objects to it.
- // Do not store a copy of the pointers collected - use them, and
- // collect them again later if you need to reference the same objects.
- enum {
- EXCLUDE_TRASH = FALSE,
- INCLUDE_TRASH = TRUE
- };
- // Simpler existence test if matches don't actually need to be collected.
- bool hasMatchingDirectDescendent(const LLUUID& cat_id,
- LLInventoryCollectFunctor& filter);
- void collectDescendents(const LLUUID& id,
- cat_array_t& categories,
- item_array_t& items,
- BOOL include_trash);
- void collectDescendentsIf(const LLUUID& id,
- cat_array_t& categories,
- item_array_t& items,
- BOOL include_trash,
- LLInventoryCollectFunctor& add);
-
- // Collect all items in inventory that are linked to item_id.
- // Assumes item_id is itself not a linked item.
- item_array_t collectLinksTo(const LLUUID& item_id);
-
- // Check if one object has a parent chain up to the category specified by UUID.
- BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const;
-
+ typedef LLUUID digest_t; // To clarify the actual usage of this "UUID"
+ // Compute a hash of direct descendant names (for detecting child name changes)
+ digest_t hashDirectDescendentNames(const LLUUID& cat_id) const;
+
+ // Starting with the object specified, add its descendants to the
+ // array provided, but do not add the inventory object specified
+ // by id. There is no guaranteed order.
+ // NOTE: Neither array will be erased before adding objects to it.
+ // Do not store a copy of the pointers collected - use them, and
+ // collect them again later if you need to reference the same objects.
+ enum {
+ EXCLUDE_TRASH = FALSE,
+ INCLUDE_TRASH = TRUE
+ };
+ // Simpler existence test if matches don't actually need to be collected.
+ bool hasMatchingDirectDescendent(const LLUUID& cat_id,
+ LLInventoryCollectFunctor& filter);
+ void collectDescendents(const LLUUID& id,
+ cat_array_t& categories,
+ item_array_t& items,
+ BOOL include_trash);
+ void collectDescendentsIf(const LLUUID& id,
+ cat_array_t& categories,
+ item_array_t& items,
+ BOOL include_trash,
+ LLInventoryCollectFunctor& add);
+
+ // Collect all items in inventory that are linked to item_id.
+ // Assumes item_id is itself not a linked item.
+ item_array_t collectLinksTo(const LLUUID& item_id);
+
+ // Check if one object has a parent chain up to the category specified by UUID.
+ BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id) const;
+
enum EAncestorResult{
ANCESTOR_OK = 0,
ANCESTOR_MISSING = 1,
ANCESTOR_LOOP = 2,
};
- // Follow parent chain to the top.
+ // Follow parent chain to the top.
EAncestorResult getObjectTopmostAncestor(const LLUUID& object_id, LLUUID& result) const;
- //--------------------------------------------------------------------
- // Find
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Find
+ //--------------------------------------------------------------------
public:
// Checks if category exists ("My Inventory" only), if it does not, creates it
void ensureCategoryForTypeExists(LLFolderType::EType preferred_type);
- const LLUUID findCategoryUUIDForTypeInRoot(
- LLFolderType::EType preferred_type,
- const LLUUID& root_id) const;
-
- // Returns the uuid of the category that specifies 'type' as what it
- // defaults to containing. The category is not necessarily only for that type.
- // NOTE: If create_folder is true, this will create a new inventory category
- // on the fly if one does not exist. *NOTE: if find_in_library is true it
- // will search in the user's library folder instead of "My Inventory"
- const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type) const;
- // will search in the user's library folder instead of "My Inventory"
- const LLUUID findLibraryCategoryUUIDForType(LLFolderType::EType preferred_type) const;
- // Returns user specified category for uploads, returns default id if there are no
- // user specified one or it does not exist, creates default category if it is missing.
- const LLUUID findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type) const;
-
- // Get whatever special folder this object is a child of, if any.
- const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
-
- // Get first descendant of the child object under the specified parent
- const LLViewerInventoryCategory *getFirstDescendantOf(const LLUUID& master_parent_id, const LLUUID& obj_id) const;
-
- // Get the object by id. Returns NULL if not found.
- // NOTE: Use the pointer returned for read operations - do
- // not modify the object values in place or you will break stuff.
- LLInventoryObject* getObject(const LLUUID& id) const;
-
- // Get the item by id. Returns NULL if not found.
- // NOTE: Use the pointer for read operations - use the
- // updateItem() method to actually modify values.
- LLViewerInventoryItem* getItem(const LLUUID& id) const;
-
- // Get the category by id. Returns NULL if not found.
- // NOTE: Use the pointer for read operations - use the
- // updateCategory() method to actually modify values.
- LLViewerInventoryCategory* getCategory(const LLUUID& id) const;
-
- // Get the inventoryID or item that this item points to, else just return object_id
- const LLUUID& getLinkedItemID(const LLUUID& object_id) const;
- LLViewerInventoryItem* getLinkedItem(const LLUUID& object_id) const;
-
+ const LLUUID findCategoryUUIDForTypeInRoot(
+ LLFolderType::EType preferred_type,
+ const LLUUID& root_id) const;
+
+ // Returns the uuid of the category that specifies 'type' as what it
+ // defaults to containing. The category is not necessarily only for that type.
+ // NOTE: If create_folder is true, this will create a new inventory category
+ // on the fly if one does not exist. *NOTE: if find_in_library is true it
+ // will search in the user's library folder instead of "My Inventory"
+ const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type) const;
+ // will search in the user's library folder instead of "My Inventory"
+ const LLUUID findLibraryCategoryUUIDForType(LLFolderType::EType preferred_type) const;
+ // Returns user specified category for uploads, returns default id if there are no
+ // user specified one or it does not exist, creates default category if it is missing.
+ const LLUUID findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type) const;
+
+ // Get whatever special folder this object is a child of, if any.
+ const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
+
+ // Get first descendant of the child object under the specified parent
+ const LLViewerInventoryCategory *getFirstDescendantOf(const LLUUID& master_parent_id, const LLUUID& obj_id) const;
+
+ // Get the object by id. Returns NULL if not found.
+ // NOTE: Use the pointer returned for read operations - do
+ // not modify the object values in place or you will break stuff.
+ LLInventoryObject* getObject(const LLUUID& id) const;
+
+ // Get the item by id. Returns NULL if not found.
+ // NOTE: Use the pointer for read operations - use the
+ // updateItem() method to actually modify values.
+ LLViewerInventoryItem* getItem(const LLUUID& id) const;
+
+ // Get the category by id. Returns NULL if not found.
+ // NOTE: Use the pointer for read operations - use the
+ // updateCategory() method to actually modify values.
+ LLViewerInventoryCategory* getCategory(const LLUUID& id) const;
+
+ // Get the inventoryID or item that this item points to, else just return object_id
+ const LLUUID& getLinkedItemID(const LLUUID& object_id) const;
+ LLViewerInventoryItem* getLinkedItem(const LLUUID& object_id) const;
+
// Copy content of all folders of type "type" into folder "id" and delete/purge the empty folders
// Note : This method has been designed for FT_OUTBOX (aka Merchant Outbox) but can be used for other categories
void consolidateForType(const LLUUID& id, LLFolderType::EType type);
-
+
private:
- mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups
+ mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups
- //--------------------------------------------------------------------
- // Count
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Count
+ //--------------------------------------------------------------------
public:
- // Return the number of items or categories
- S32 getItemCount() const;
- S32 getCategoryCount() const;
+ // Return the number of items or categories
+ S32 getItemCount() const;
+ S32 getCategoryCount() const;
/** Accessors
** **
@@ -377,127 +377,127 @@ public:
**/
public:
- // Change an existing item with a matching item_id or add the item
- // to the current inventory. Returns the change mask generated by
- // the update. No notification will be sent to observers. This
- // method will only generate network traffic if the item had to be
- // reparented.
- // NOTE: In usage, you will want to perform cache accounting
- // operations in LLInventoryModel::accountForUpdate() or
- // LLViewerInventoryItem::updateServer() before calling this method.
- U32 updateItem(const LLViewerInventoryItem* item, U32 mask = 0);
-
- // Change an existing item with the matching id or add
- // the category. No notification will be sent to observers. This
- // method will only generate network traffic if the item had to be
- // reparented.
- // NOTE: In usage, you will want to perform cache accounting
- // operations in accountForUpdate() or LLViewerInventoryCategory::
- // updateServer() before calling this method.
- void updateCategory(const LLViewerInventoryCategory* cat, U32 mask = 0);
-
- // Move the specified object id to the specified category and
- // update the internal structures. No cache accounting,
- // observer notification, or server update is performed.
- void moveObject(const LLUUID& object_id, const LLUUID& cat_id);
-
- // Migrated from llinventoryfunctions
- void changeItemParent(LLViewerInventoryItem* item,
- const LLUUID& new_parent_id,
- BOOL restamp);
-
- // Migrated from llinventoryfunctions
- void changeCategoryParent(LLViewerInventoryCategory* cat,
- const LLUUID& new_parent_id,
- BOOL restamp);
+ // Change an existing item with a matching item_id or add the item
+ // to the current inventory. Returns the change mask generated by
+ // the update. No notification will be sent to observers. This
+ // method will only generate network traffic if the item had to be
+ // reparented.
+ // NOTE: In usage, you will want to perform cache accounting
+ // operations in LLInventoryModel::accountForUpdate() or
+ // LLViewerInventoryItem::updateServer() before calling this method.
+ U32 updateItem(const LLViewerInventoryItem* item, U32 mask = 0);
+
+ // Change an existing item with the matching id or add
+ // the category. No notification will be sent to observers. This
+ // method will only generate network traffic if the item had to be
+ // reparented.
+ // NOTE: In usage, you will want to perform cache accounting
+ // operations in accountForUpdate() or LLViewerInventoryCategory::
+ // updateServer() before calling this method.
+ void updateCategory(const LLViewerInventoryCategory* cat, U32 mask = 0);
+
+ // Move the specified object id to the specified category and
+ // update the internal structures. No cache accounting,
+ // observer notification, or server update is performed.
+ void moveObject(const LLUUID& object_id, const LLUUID& cat_id);
+
+ // Migrated from llinventoryfunctions
+ void changeItemParent(LLViewerInventoryItem* item,
+ const LLUUID& new_parent_id,
+ BOOL restamp);
+
+ // Migrated from llinventoryfunctions
+ void changeCategoryParent(LLViewerInventoryCategory* cat,
+ const LLUUID& new_parent_id,
+ BOOL restamp);
// Marks links from a "possibly" broken list for a rebuild
// clears the list
void rebuildBrockenLinks();
bool hasPosiblyBrockenLinks() const { return mPossiblyBrockenLinks.size() > 0; }
- //--------------------------------------------------------------------
- // Delete
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Delete
+ //--------------------------------------------------------------------
public:
-
- // Update model after an item is confirmed as removed from
- // server. Works for categories or items.
- void onObjectDeletedFromServer(const LLUUID& item_id,
- bool fix_broken_links = true,
- bool update_parent_version = true,
- bool do_notify_observers = true);
-
- // Update model after all descendants removed from server.
- void onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links = true);
-
- // Update model after an existing item gets updated on server.
- void onItemUpdated(const LLUUID& item_id, const LLSD& updates, bool update_parent_version);
-
- // Update model after an existing category gets updated on server.
- void onCategoryUpdated(const LLUUID& cat_id, const LLSD& updates);
-
- // Delete a particular inventory object by ID. Will purge one
- // object from the internal data structures, maintaining a
- // consistent internal state. No cache accounting, observer
- // notification, or server update is performed.
- void deleteObject(const LLUUID& id, bool fix_broken_links = true, bool do_notify_observers = true);
- /// move Item item_id to Trash
- void removeItem(const LLUUID& item_id);
- /// move Category category_id to Trash
- void removeCategory(const LLUUID& category_id);
- /// removeItem() or removeCategory(), whichever is appropriate
- void removeObject(const LLUUID& object_id);
-
- // "TrashIsFull" when trash exceeds maximum capacity
- void checkTrashOverflow();
+
+ // Update model after an item is confirmed as removed from
+ // server. Works for categories or items.
+ void onObjectDeletedFromServer(const LLUUID& item_id,
+ bool fix_broken_links = true,
+ bool update_parent_version = true,
+ bool do_notify_observers = true);
+
+ // Update model after all descendants removed from server.
+ void onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links = true);
+
+ // Update model after an existing item gets updated on server.
+ void onItemUpdated(const LLUUID& item_id, const LLSD& updates, bool update_parent_version);
+
+ // Update model after an existing category gets updated on server.
+ void onCategoryUpdated(const LLUUID& cat_id, const LLSD& updates);
+
+ // Delete a particular inventory object by ID. Will purge one
+ // object from the internal data structures, maintaining a
+ // consistent internal state. No cache accounting, observer
+ // notification, or server update is performed.
+ void deleteObject(const LLUUID& id, bool fix_broken_links = true, bool do_notify_observers = true);
+ /// move Item item_id to Trash
+ void removeItem(const LLUUID& item_id);
+ /// move Category category_id to Trash
+ void removeCategory(const LLUUID& category_id);
+ /// removeItem() or removeCategory(), whichever is appropriate
+ void removeObject(const LLUUID& object_id);
+
+ // "TrashIsFull" when trash exceeds maximum capacity
+ void checkTrashOverflow();
protected:
void rebuildLinkItems(LLInventoryModel::item_array_t& items);
-
- //--------------------------------------------------------------------
- // Reorder
- //--------------------------------------------------------------------
+
+ //--------------------------------------------------------------------
+ // Reorder
+ //--------------------------------------------------------------------
public:
- // Changes items order by insertion of the item identified by src_item_id
- // before (or after) the item identified by dest_item_id. Both items must exist in items array.
- // Sorting is stored after method is finished. Only src_item_id is moved before (or after) dest_item_id.
- // The parameter "insert_before" controls on which side of dest_item_id src_item_id gets reinserted.
- static void updateItemsOrder(LLInventoryModel::item_array_t& items,
- const LLUUID& src_item_id,
- const LLUUID& dest_item_id,
- bool insert_before = true);
- // Gets an iterator on an item vector knowing only the item UUID.
- // Returns end() of the vector if not found.
- static LLInventoryModel::item_array_t::iterator findItemIterByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id);
-
-
- // Rearranges Landmarks inside Favorites folder.
- // Moves source landmark before target one.
- void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
- //void saveItemsOrder(const LLInventoryModel::item_array_t& items);
-
- //--------------------------------------------------------------------
- // Creation
- //--------------------------------------------------------------------
+ // Changes items order by insertion of the item identified by src_item_id
+ // before (or after) the item identified by dest_item_id. Both items must exist in items array.
+ // Sorting is stored after method is finished. Only src_item_id is moved before (or after) dest_item_id.
+ // The parameter "insert_before" controls on which side of dest_item_id src_item_id gets reinserted.
+ static void updateItemsOrder(LLInventoryModel::item_array_t& items,
+ const LLUUID& src_item_id,
+ const LLUUID& dest_item_id,
+ bool insert_before = true);
+ // Gets an iterator on an item vector knowing only the item UUID.
+ // Returns end() of the vector if not found.
+ static LLInventoryModel::item_array_t::iterator findItemIterByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id);
+
+
+ // Rearranges Landmarks inside Favorites folder.
+ // Moves source landmark before target one.
+ void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
+ //void saveItemsOrder(const LLInventoryModel::item_array_t& items);
+
+ //--------------------------------------------------------------------
+ // Creation
+ //--------------------------------------------------------------------
public:
- // Returns the UUID of the new category. If you want to use the default
- // name based on type, pass in a NULL to the 'name' parameter.
- void createNewCategory(const LLUUID& parent_id,
- LLFolderType::EType preferred_type,
- const std::string& name,
- inventory_func_type callback = NULL,
- const LLUUID& thumbnail_id = LLUUID::null);
+ // Returns the UUID of the new category. If you want to use the default
+ // name based on type, pass in a NULL to the 'name' parameter.
+ void createNewCategory(const LLUUID& parent_id,
+ LLFolderType::EType preferred_type,
+ const std::string& name,
+ inventory_func_type callback = NULL,
+ const LLUUID& thumbnail_id = LLUUID::null);
protected:
- // Internal methods that add inventory and make sure that all of
- // the internal data structures are consistent. These methods
- // should be passed pointers of newly created objects, and the
- // instance will take over the memory management from there.
- void addCategory(LLViewerInventoryCategory* category);
- void addItem(LLViewerInventoryItem* item);
+ // Internal methods that add inventory and make sure that all of
+ // the internal data structures are consistent. These methods
+ // should be passed pointers of newly created objects, and the
+ // instance will take over the memory management from there.
+ void addCategory(LLViewerInventoryCategory* category);
+ void addItem(LLViewerInventoryItem* item);
void createNewCategoryCoro(std::string url, LLSD postData, inventory_func_type callback);
-
+
/** Mutators
** **
*******************************************************************************/
@@ -508,42 +508,42 @@ protected:
**/
public:
- // Represents the number of items added or removed from a category.
- struct LLCategoryUpdate
- {
- LLCategoryUpdate() : mDescendentDelta(0) {}
- LLCategoryUpdate(const LLUUID& category_id, S32 delta) :
- mCategoryID(category_id),
- mDescendentDelta(delta) {}
- LLUUID mCategoryID;
- S32 mDescendentDelta;
- };
- typedef std::vector<LLCategoryUpdate> update_list_t;
-
- // This exists to make it easier to account for deltas in a map.
- struct LLInitializedS32
- {
- LLInitializedS32() : mValue(0) {}
- LLInitializedS32(S32 value) : mValue(value) {}
- S32 mValue;
- LLInitializedS32& operator++() { ++mValue; return *this; }
- LLInitializedS32& operator--() { --mValue; return *this; }
- };
- typedef std::map<LLUUID, LLInitializedS32> update_map_t;
-
- // Call when there are category updates. Call them *before* the
- // actual update so the method can do descendent accounting correctly.
- void accountForUpdate(const LLCategoryUpdate& update) const;
- void accountForUpdate(const update_list_t& updates);
- void accountForUpdate(const update_map_t& updates);
-
- // Return (yes/no/maybe) child status of category children.
- EHasChildren categoryHasChildren(const LLUUID& cat_id) const;
-
- // Returns true if category version is known and theoretical
- // descendents == actual descendents.
- bool isCategoryComplete(const LLUUID& cat_id) const;
-
+ // Represents the number of items added or removed from a category.
+ struct LLCategoryUpdate
+ {
+ LLCategoryUpdate() : mDescendentDelta(0) {}
+ LLCategoryUpdate(const LLUUID& category_id, S32 delta) :
+ mCategoryID(category_id),
+ mDescendentDelta(delta) {}
+ LLUUID mCategoryID;
+ S32 mDescendentDelta;
+ };
+ typedef std::vector<LLCategoryUpdate> update_list_t;
+
+ // This exists to make it easier to account for deltas in a map.
+ struct LLInitializedS32
+ {
+ LLInitializedS32() : mValue(0) {}
+ LLInitializedS32(S32 value) : mValue(value) {}
+ S32 mValue;
+ LLInitializedS32& operator++() { ++mValue; return *this; }
+ LLInitializedS32& operator--() { --mValue; return *this; }
+ };
+ typedef std::map<LLUUID, LLInitializedS32> update_map_t;
+
+ // Call when there are category updates. Call them *before* the
+ // actual update so the method can do descendent accounting correctly.
+ void accountForUpdate(const LLCategoryUpdate& update) const;
+ void accountForUpdate(const update_list_t& updates);
+ void accountForUpdate(const update_map_t& updates);
+
+ // Return (yes/no/maybe) child status of category children.
+ EHasChildren categoryHasChildren(const LLUUID& cat_id) const;
+
+ // Returns true if category version is known and theoretical
+ // descendents == actual descendents.
+ bool isCategoryComplete(const LLUUID& cat_id) const;
+
/** Category Accounting
** **
*******************************************************************************/
@@ -554,32 +554,32 @@ public:
**/
public:
- // Called by the idle loop. Only updates if new state is detected. Call
- // notifyObservers() manually to update regardless of whether state change
- // has been indicated.
- void idleNotifyObservers();
-
- // Call to explicitly update everyone on a new state.
- void notifyObservers();
-
- // Allows outsiders to tell the inventory if something has
- // been changed 'under the hood', but outside the control of the
- // inventory. The next notify will include that notification.
- void addChangedMask(U32 mask, const LLUUID& referent);
-
- const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }
- const changed_items_t& getAddedIDs() const { return mAddedItemIDs; }
+ // Called by the idle loop. Only updates if new state is detected. Call
+ // notifyObservers() manually to update regardless of whether state change
+ // has been indicated.
+ void idleNotifyObservers();
+
+ // Call to explicitly update everyone on a new state.
+ void notifyObservers();
+
+ // Allows outsiders to tell the inventory if something has
+ // been changed 'under the hood', but outside the control of the
+ // inventory. The next notify will include that notification.
+ void addChangedMask(U32 mask, const LLUUID& referent);
+
+ const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }
+ const changed_items_t& getAddedIDs() const { return mAddedItemIDs; }
protected:
- // Updates all linked items pointing to this id.
- void addChangedMaskForLinks(const LLUUID& object_id, U32 mask);
+ // Updates all linked items pointing to this id.
+ void addChangedMaskForLinks(const LLUUID& object_id, U32 mask);
private:
- // Flag set when notifyObservers is being called, to look for bugs
- // where it's called recursively.
- BOOL mIsNotifyObservers;
- // Variables used to track what has changed since the last notify.
- U32 mModifyMask;
- changed_items_t mChangedItemIDs;
- changed_items_t mAddedItemIDs;
+ // Flag set when notifyObservers is being called, to look for bugs
+ // where it's called recursively.
+ BOOL mIsNotifyObservers;
+ // Variables used to track what has changed since the last notify.
+ U32 mModifyMask;
+ changed_items_t mChangedItemIDs;
+ changed_items_t mAddedItemIDs;
// Fallback when notifyObservers is in progress
U32 mModifyMaskBacklog;
changed_items_t mChangedItemIDsBacklog;
@@ -588,20 +588,20 @@ private:
broken_links_t mPossiblyBrockenLinks; // there can be multiple links per item
changed_items_t mLinksRebuildList;
boost::signals2::connection mBulkFecthCallbackSlot;
-
-
- //--------------------------------------------------------------------
- // Observers
- //--------------------------------------------------------------------
+
+
+ //--------------------------------------------------------------------
+ // Observers
+ //--------------------------------------------------------------------
public:
- // If the observer is destroyed, be sure to remove it.
- void addObserver(LLInventoryObserver* observer);
- void removeObserver(LLInventoryObserver* observer);
- BOOL containsObserver(LLInventoryObserver* observer) const;
+ // If the observer is destroyed, be sure to remove it.
+ void addObserver(LLInventoryObserver* observer);
+ void removeObserver(LLInventoryObserver* observer);
+ BOOL containsObserver(LLInventoryObserver* observer) const;
private:
- typedef std::set<LLInventoryObserver*> observer_list_t;
- observer_list_t mObservers;
-
+ typedef std::set<LLInventoryObserver*> observer_list_t;
+ observer_list_t mObservers;
+
/** Notifications
** **
*******************************************************************************/
@@ -612,29 +612,29 @@ private:
** HTTP Transport
**/
public:
- // Invoke handler completion method (onCompleted) for all
- // requests that are ready.
- void handleResponses(bool foreground);
-
- // Request an inventory HTTP operation to either the
- // foreground or background processor. These are actually
- // the same service queue but the background requests are
- // seviced more slowly effectively de-prioritizing new
- // requests.
- LLCore::HttpHandle requestPost(bool foreground,
- const std::string & url,
- const LLSD & body,
- const LLCore::HttpHandler::ptr_t &handler,
- const char * const message);
-
+ // Invoke handler completion method (onCompleted) for all
+ // requests that are ready.
+ void handleResponses(bool foreground);
+
+ // Request an inventory HTTP operation to either the
+ // foreground or background processor. These are actually
+ // the same service queue but the background requests are
+ // seviced more slowly effectively de-prioritizing new
+ // requests.
+ LLCore::HttpHandle requestPost(bool foreground,
+ const std::string & url,
+ const LLSD & body,
+ const LLCore::HttpHandler::ptr_t &handler,
+ const char * const message);
+
private:
- // Usual plumbing for LLCore:: HTTP operations.
- LLCore::HttpRequest * mHttpRequestFG;
- LLCore::HttpRequest * mHttpRequestBG;
- LLCore::HttpOptions::ptr_t mHttpOptions;
- LLCore::HttpHeaders::ptr_t mHttpHeaders;
- LLCore::HttpRequest::policy_t mHttpPolicyClass;
-
+ // Usual plumbing for LLCore:: HTTP operations.
+ LLCore::HttpRequest * mHttpRequestFG;
+ LLCore::HttpRequest * mHttpRequestBG;
+ LLCore::HttpOptions::ptr_t mHttpOptions;
+ LLCore::HttpHeaders::ptr_t mHttpHeaders;
+ LLCore::HttpRequest::policy_t mHttpPolicyClass;
+
/** HTTP Transport
** **
*******************************************************************************/
@@ -645,67 +645,67 @@ private:
** MISCELLANEOUS
**/
- //--------------------------------------------------------------------
- // Callbacks
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Callbacks
+ //--------------------------------------------------------------------
public:
- // Trigger a notification and empty the folder type (FT_TRASH or FT_LOST_AND_FOUND) if confirmed
- void emptyFolderType(const std::string notification, LLFolderType::EType folder_type);
- bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type);
- static void registerCallbacks(LLMessageSystem* msg);
-
- //--------------------------------------------------------------------
- // File I/O
- //--------------------------------------------------------------------
+ // Trigger a notification and empty the folder type (FT_TRASH or FT_LOST_AND_FOUND) if confirmed
+ void emptyFolderType(const std::string notification, LLFolderType::EType folder_type);
+ bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type);
+ static void registerCallbacks(LLMessageSystem* msg);
+
+ //--------------------------------------------------------------------
+ // File I/O
+ //--------------------------------------------------------------------
protected:
- static bool loadFromFile(const std::string& filename,
- cat_array_t& categories,
- item_array_t& items,
- changed_items_t& cats_to_update,
- bool& is_cache_obsolete);
- static bool saveToFile(const std::string& filename,
- const cat_array_t& categories,
- const item_array_t& items);
-
- //--------------------------------------------------------------------
- // Message handling functionality
- //--------------------------------------------------------------------
+ static bool loadFromFile(const std::string& filename,
+ cat_array_t& categories,
+ item_array_t& items,
+ changed_items_t& cats_to_update,
+ bool& is_cache_obsolete);
+ static bool saveToFile(const std::string& filename,
+ const cat_array_t& categories,
+ const item_array_t& items);
+
+ //--------------------------------------------------------------------
+ // Message handling functionality
+ //--------------------------------------------------------------------
public:
- static void processUpdateCreateInventoryItem(LLMessageSystem* msg, void**);
- static void removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg, const char* msg_label);
- static void processRemoveInventoryItem(LLMessageSystem* msg, void**);
- static void removeInventoryFolder(LLUUID agent_id, LLMessageSystem* msg);
- static void processRemoveInventoryFolder(LLMessageSystem* msg, void**);
- static void processRemoveInventoryObjects(LLMessageSystem* msg, void**);
- static void processSaveAssetIntoInventory(LLMessageSystem* msg, void**);
- static void processBulkUpdateInventory(LLMessageSystem* msg, void**);
- static void processMoveInventoryItem(LLMessageSystem* msg, void**);
+ static void processUpdateCreateInventoryItem(LLMessageSystem* msg, void**);
+ static void removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg, const char* msg_label);
+ static void processRemoveInventoryItem(LLMessageSystem* msg, void**);
+ static void removeInventoryFolder(LLUUID agent_id, LLMessageSystem* msg);
+ static void processRemoveInventoryFolder(LLMessageSystem* msg, void**);
+ static void processRemoveInventoryObjects(LLMessageSystem* msg, void**);
+ static void processSaveAssetIntoInventory(LLMessageSystem* msg, void**);
+ static void processBulkUpdateInventory(LLMessageSystem* msg, void**);
+ static void processMoveInventoryItem(LLMessageSystem* msg, void**);
protected:
- bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting, U32 mask = 0x0);
+ bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting, U32 mask = 0x0);
- //--------------------------------------------------------------------
- // Locks
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Locks
+ //--------------------------------------------------------------------
public:
- void lockDirectDescendentArrays(const LLUUID& cat_id,
- cat_array_t*& categories,
- item_array_t*& items);
- void unlockDirectDescendentArrays(const LLUUID& cat_id);
+ void lockDirectDescendentArrays(const LLUUID& cat_id,
+ cat_array_t*& categories,
+ item_array_t*& items);
+ void unlockDirectDescendentArrays(const LLUUID& cat_id);
protected:
- cat_array_t* getUnlockedCatArray(const LLUUID& id);
- item_array_t* getUnlockedItemArray(const LLUUID& id);
+ cat_array_t* getUnlockedCatArray(const LLUUID& id);
+ item_array_t* getUnlockedItemArray(const LLUUID& id);
private:
- std::map<LLUUID, bool> mCategoryLock;
- std::map<LLUUID, bool> mItemLock;
-
- //--------------------------------------------------------------------
- // Debugging
- //--------------------------------------------------------------------
+ std::map<LLUUID, bool> mCategoryLock;
+ std::map<LLUUID, bool> mItemLock;
+
+ //--------------------------------------------------------------------
+ // Debugging
+ //--------------------------------------------------------------------
public:
- void dumpInventory() const;
- LLPointer<LLInventoryValidationInfo> validate() const;
- LLPointer<LLInventoryValidationInfo> mValidationInfo;
- std::string getFullPath(const LLInventoryObject *obj) const;
+ void dumpInventory() const;
+ LLPointer<LLInventoryValidationInfo> validate() const;
+ LLPointer<LLInventoryValidationInfo> mValidationInfo;
+ std::string getFullPath(const LLInventoryObject *obj) const;
/** Miscellaneous
** **
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 722447b5d7..b664bfe6b9 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventorymodelbackgroundfetch.cpp
* @brief Implementation of background fetching of inventory.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -110,23 +110,23 @@ namespace
//
class BGItemHttpHandler : public LLInventoryModel::FetchItemHttpHandler
{
- LOG_CLASS(BGItemHttpHandler);
-
+ LOG_CLASS(BGItemHttpHandler);
+
public:
- BGItemHttpHandler(const LLSD & request_sd)
- : LLInventoryModel::FetchItemHttpHandler(request_sd)
- {
- LLInventoryModelBackgroundFetch::instance().incrFetchCount(1);
- }
+ BGItemHttpHandler(const LLSD & request_sd)
+ : LLInventoryModel::FetchItemHttpHandler(request_sd)
+ {
+ LLInventoryModelBackgroundFetch::instance().incrFetchCount(1);
+ }
- virtual ~BGItemHttpHandler()
- {
- LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
- }
+ virtual ~BGItemHttpHandler()
+ {
+ LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
+ }
protected:
- BGItemHttpHandler(const BGItemHttpHandler &); // Not defined
- void operator=(const BGItemHttpHandler &); // Not defined
+ BGItemHttpHandler(const BGItemHttpHandler &); // Not defined
+ void operator=(const BGItemHttpHandler &); // Not defined
};
@@ -141,39 +141,39 @@ protected:
//
class BGFolderHttpHandler : public LLCore::HttpHandler
{
- LOG_CLASS(BGFolderHttpHandler);
-
+ LOG_CLASS(BGFolderHttpHandler);
+
public:
- BGFolderHttpHandler(const LLSD & request_sd, const uuid_vec_t & recursive_cats)
- : LLCore::HttpHandler(),
- mRequestSD(request_sd),
- mRecursiveCatUUIDs(recursive_cats)
- {
- LLInventoryModelBackgroundFetch::instance().incrFetchCount(1);
- }
-
- virtual ~BGFolderHttpHandler()
- {
- LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
- }
-
+ BGFolderHttpHandler(const LLSD & request_sd, const uuid_vec_t & recursive_cats)
+ : LLCore::HttpHandler(),
+ mRequestSD(request_sd),
+ mRecursiveCatUUIDs(recursive_cats)
+ {
+ LLInventoryModelBackgroundFetch::instance().incrFetchCount(1);
+ }
+
+ virtual ~BGFolderHttpHandler()
+ {
+ LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
+ }
+
protected:
- BGFolderHttpHandler(const BGFolderHttpHandler &); // Not defined
- void operator=(const BGFolderHttpHandler &); // Not defined
+ BGFolderHttpHandler(const BGFolderHttpHandler &); // Not defined
+ void operator=(const BGFolderHttpHandler &); // Not defined
public:
- virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
+ virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
- bool getIsRecursive(const LLUUID & cat_id) const;
+ bool getIsRecursive(const LLUUID & cat_id) const;
private:
- void processData(LLSD & body, LLCore::HttpResponse * response);
- void processFailure(LLCore::HttpStatus status, LLCore::HttpResponse * response);
- void processFailure(const char * const reason, LLCore::HttpResponse * response);
+ void processData(LLSD & body, LLCore::HttpResponse * response);
+ void processFailure(LLCore::HttpStatus status, LLCore::HttpResponse * response);
+ void processFailure(const char * const reason, LLCore::HttpResponse * response);
private:
- LLSD mRequestSD;
- const uuid_vec_t mRecursiveCatUUIDs; // hack for storing away which cat fetches are recursive
+ LLSD mRequestSD;
+ const uuid_vec_t mRecursiveCatUUIDs; // hack for storing away which cat fetches are recursive
};
@@ -187,9 +187,9 @@ const char * const LOG_INV("Inventory");
///----------------------------------------------------------------------------
LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch():
- mBackgroundFetchActive(false),
- mFolderFetchActive(false),
- mFetchCount(0),
+ mBackgroundFetchActive(false),
+ mFolderFetchActive(false),
+ mFetchCount(0),
mLastFetchCount(0),
mFetchFolderCount(0),
mAllRecursiveFoldersFetched(false),
@@ -206,7 +206,7 @@ LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const
{
- return mFetchFolderQueue.empty() && mFetchItemQueue.empty() && mFetchCount <= 0;
+ return mFetchFolderQueue.empty() && mFetchItemQueue.empty() && mFetchCount <= 0;
}
bool LLInventoryModelBackgroundFetch::isFolderFetchProcessingComplete() const
@@ -216,42 +216,42 @@ bool LLInventoryModelBackgroundFetch::isFolderFetchProcessingComplete() const
bool LLInventoryModelBackgroundFetch::libraryFetchStarted() const
{
- return mRecursiveLibraryFetchStarted;
+ return mRecursiveLibraryFetchStarted;
}
bool LLInventoryModelBackgroundFetch::libraryFetchCompleted() const
{
- return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID());
+ return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID());
}
bool LLInventoryModelBackgroundFetch::libraryFetchInProgress() const
{
- return libraryFetchStarted() && !libraryFetchCompleted();
+ return libraryFetchStarted() && !libraryFetchCompleted();
}
-
+
bool LLInventoryModelBackgroundFetch::inventoryFetchStarted() const
{
- return mRecursiveInventoryFetchStarted;
+ return mRecursiveInventoryFetchStarted;
}
bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted() const
{
- return inventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID());
+ return inventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID());
}
bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress() const
{
- return inventoryFetchStarted() && ! inventoryFetchCompleted();
+ return inventoryFetchStarted() && ! inventoryFetchCompleted();
}
bool LLInventoryModelBackgroundFetch::isEverythingFetched() const
{
- return mAllRecursiveFoldersFetched;
+ return mAllRecursiveFoldersFetched;
}
BOOL LLInventoryModelBackgroundFetch::folderFetchActive() const
{
- return mFolderFetchActive;
+ return mFolderFetchActive;
}
void LLInventoryModelBackgroundFetch::addRequestAtFront(const LLUUID & id, bool recursive, bool is_category)
@@ -282,21 +282,21 @@ void LLInventoryModelBackgroundFetch::addRequestAtBack(const LLUUID & id, bool r
void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
{
- LLViewerInventoryCategory * cat(gInventory.getCategory(id));
+ LLViewerInventoryCategory * cat(gInventory.getCategory(id));
- if (cat || (id.isNull() && ! isEverythingFetched()))
- {
- // it's a folder, do a bulk fetch
- LL_DEBUGS(LOG_INV) << "Start fetching category: " << id << ", recursive: " << recursive << LL_ENDL;
+ if (cat || (id.isNull() && ! isEverythingFetched()))
+ {
+ // it's a folder, do a bulk fetch
+ LL_DEBUGS(LOG_INV) << "Start fetching category: " << id << ", recursive: " << recursive << LL_ENDL;
- mBackgroundFetchActive = true;
- mFolderFetchActive = true;
+ mBackgroundFetchActive = true;
+ mFolderFetchActive = true;
EFetchType recursion_type = recursive ? FT_RECURSIVE : FT_DEFAULT;
- if (id.isNull())
- {
- if (! mRecursiveInventoryFetchStarted)
- {
- mRecursiveInventoryFetchStarted |= recursive;
+ if (id.isNull())
+ {
+ if (! mRecursiveInventoryFetchStarted)
+ {
+ mRecursiveInventoryFetchStarted |= recursive;
if (recursive && AISAPI::isAvailable())
{
// Not only root folder can be massive, but
@@ -308,15 +308,15 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
{
mFetchFolderQueue.push_back(FetchQueueInfo(gInventory.getRootFolderID(), recursion_type));
}
- gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
- }
- if (! mRecursiveLibraryFetchStarted)
- {
- mRecursiveLibraryFetchStarted |= recursive;
+ gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+ }
+ if (! mRecursiveLibraryFetchStarted)
+ {
+ mRecursiveLibraryFetchStarted |= recursive;
mFetchFolderQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursion_type));
- gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
- }
- }
+ gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+ }
+ }
else if (recursive && cat && cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS)
{
if (mFetchFolderQueue.empty() || mFetchFolderQueue.back().mUUID != id)
@@ -334,8 +334,8 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
mRecursiveMarketplaceFetchStarted = true;
}
}
- else
- {
+ else
+ {
if (AISAPI::isAvailable())
{
if (mFetchFolderQueue.empty() || mFetchFolderQueue.back().mUUID != id)
@@ -353,23 +353,23 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
- if (id == gInventory.getLibraryRootFolderID())
- {
- mRecursiveLibraryFetchStarted |= recursive;
- }
- if (id == gInventory.getRootFolderID())
- {
- mRecursiveInventoryFetchStarted |= recursive;
- }
- }
- }
- else if (LLViewerInventoryItem * itemp = gInventory.getItem(id))
- {
- if (! itemp->mIsComplete)
- {
+ if (id == gInventory.getLibraryRootFolderID())
+ {
+ mRecursiveLibraryFetchStarted |= recursive;
+ }
+ if (id == gInventory.getRootFolderID())
+ {
+ mRecursiveInventoryFetchStarted |= recursive;
+ }
+ }
+ }
+ else if (LLViewerInventoryItem * itemp = gInventory.getItem(id))
+ {
+ if (! itemp->mIsComplete)
+ {
scheduleItemFetch(id);
- }
- }
+ }
+ }
}
void LLInventoryModelBackgroundFetch::scheduleFolderFetch(const LLUUID& cat_id, bool forced)
@@ -488,15 +488,15 @@ void LLInventoryModelBackgroundFetch::findLostItems()
void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
{
- if (mRecursiveInventoryFetchStarted &&
- mRecursiveLibraryFetchStarted)
- {
+ if (mRecursiveInventoryFetchStarted &&
+ mRecursiveLibraryFetchStarted)
+ {
mAllRecursiveFoldersFetched = true;
- //LL_INFOS(LOG_INV) << "All folders fetched, validating" << LL_ENDL;
- //gInventory.validate();
- }
+ //LL_INFOS(LOG_INV) << "All folders fetched, validating" << LL_ENDL;
+ //gInventory.validate();
+ }
- mFolderFetchActive = false;
+ mFolderFetchActive = false;
if (isBulkFetchProcessingComplete())
{
mBackgroundFetchActive = false;
@@ -505,7 +505,7 @@ void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
// For now only informs about initial fetch being done
mFoldersFetchedSignal();
- LL_INFOS(LOG_INV) << "Inventory background fetch completed" << LL_ENDL;
+ LL_INFOS(LOG_INV) << "Inventory background fetch completed" << LL_ENDL;
}
boost::signals2::connection LLInventoryModelBackgroundFetch::setFetchCompletionCallback(folders_fetched_callback_t cb)
@@ -515,13 +515,13 @@ boost::signals2::connection LLInventoryModelBackgroundFetch::setFetchCompletionC
void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *)
{
- LLInventoryModelBackgroundFetch::instance().backgroundFetch();
+ LLInventoryModelBackgroundFetch::instance().backgroundFetch();
}
void LLInventoryModelBackgroundFetch::backgroundFetch()
{
- if (mBackgroundFetchActive)
- {
+ if (mBackgroundFetchActive)
+ {
if (AISAPI::isAvailable())
{
bulkFetchViaAis();
@@ -531,17 +531,17 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
// If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
bulkFetch();
}
- }
+ }
}
-void LLInventoryModelBackgroundFetch::incrFetchCount(S32 fetching)
-{
- mFetchCount += fetching;
- if (mFetchCount < 0)
- {
- LL_WARNS_ONCE(LOG_INV) << "Inventory fetch count fell below zero (0)." << LL_ENDL;
- mFetchCount = 0;
- }
+void LLInventoryModelBackgroundFetch::incrFetchCount(S32 fetching)
+{
+ mFetchCount += fetching;
+ if (mFetchCount < 0)
+ {
+ LL_WARNS_ONCE(LOG_INV) << "Inventory fetch count fell below zero (0)." << LL_ENDL;
+ mFetchCount = 0;
+ }
}
void LLInventoryModelBackgroundFetch::incrFetchFolderCount(S32 fetching)
{
@@ -743,7 +743,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis()
F64 curent_time = LLTimer::getTotalSeconds();
const F64 max_time = LLStartUp::getStartupState() > STATE_WEARABLES_WAIT
? 0.006f // 6 ms
- : 1.f;
+ : 1.f;
const F64 end_time = curent_time + max_time;
S32 last_fetch_count = mFetchCount;
@@ -800,7 +800,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis()
LL_CONT << LL_ENDL;
}
}
-
+
if (isFolderFetchProcessingComplete() && mFolderFetchActive)
{
if (!mRecursiveInventoryFetchStarted || mRecursiveMarketplaceFetchStarted)
@@ -822,7 +822,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis()
setAllFoldersFetched();
}
}
-
+
}
if (isBulkFetchProcessingComplete())
@@ -1029,75 +1029,75 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
// Bundle up a bunch of requests to send all at once.
void LLInventoryModelBackgroundFetch::bulkFetch()
{
- LL_RECORD_BLOCK_TIME(FTM_BULK_FETCH);
- //Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
- //If there are items in mFetchQueue, we want to check the time since the last bulkFetch was
- //sent. If it exceeds our retry time, go ahead and fire off another batch.
- LLViewerRegion * region(gAgent.getRegion());
- if (! region || gDisconnected || LLApp::isExiting())
- {
- return;
- }
-
- // *TODO: These values could be tweaked at runtime to effect
- // a fast/slow fetch throttle. Once login is complete and the scene
- // is mostly loaded, we could turn up the throttle and fill missing
- // inventory more quickly.
- static const U32 max_batch_size(10);
- static const S32 max_concurrent_fetches(12); // Outstanding requests, not connections
-
- if (mFetchCount)
- {
- // Process completed background HTTP requests
- gInventory.handleResponses(false);
- // Just processed a bunch of items.
- // Note: do we really need notifyObservers() here?
- // OnIdle it will be called anyway due to Add flag for processed item.
- // It seems like in some cases we are updaiting on fail (no flag),
- // but is there anything to update?
- gInventory.notifyObservers();
- }
-
- if (mFetchCount > max_concurrent_fetches)
- {
- return;
- }
-
- U32 item_count(0);
- U32 folder_count(0);
-
- const U32 sort_order(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1);
-
- // *TODO: Think I'd like to get a shared pointer to this and share it
- // among all the folder requests.
- uuid_vec_t recursive_cats;
+ LL_RECORD_BLOCK_TIME(FTM_BULK_FETCH);
+ //Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
+ //If there are items in mFetchQueue, we want to check the time since the last bulkFetch was
+ //sent. If it exceeds our retry time, go ahead and fire off another batch.
+ LLViewerRegion * region(gAgent.getRegion());
+ if (! region || gDisconnected || LLApp::isExiting())
+ {
+ return;
+ }
+
+ // *TODO: These values could be tweaked at runtime to effect
+ // a fast/slow fetch throttle. Once login is complete and the scene
+ // is mostly loaded, we could turn up the throttle and fill missing
+ // inventory more quickly.
+ static const U32 max_batch_size(10);
+ static const S32 max_concurrent_fetches(12); // Outstanding requests, not connections
+
+ if (mFetchCount)
+ {
+ // Process completed background HTTP requests
+ gInventory.handleResponses(false);
+ // Just processed a bunch of items.
+ // Note: do we really need notifyObservers() here?
+ // OnIdle it will be called anyway due to Add flag for processed item.
+ // It seems like in some cases we are updaiting on fail (no flag),
+ // but is there anything to update?
+ gInventory.notifyObservers();
+ }
+
+ if (mFetchCount > max_concurrent_fetches)
+ {
+ return;
+ }
+
+ U32 item_count(0);
+ U32 folder_count(0);
+
+ const U32 sort_order(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1);
+
+ // *TODO: Think I'd like to get a shared pointer to this and share it
+ // among all the folder requests.
+ uuid_vec_t recursive_cats;
uuid_vec_t all_cats; // dupplicate avoidance
- LLSD folder_request_body;
- LLSD folder_request_body_lib;
- LLSD item_request_body;
- LLSD item_request_body_lib;
-
- while (! mFetchFolderQueue.empty()
- && (item_count + folder_count) < max_batch_size)
- {
- const FetchQueueInfo & fetch_info(mFetchFolderQueue.front());
- if (fetch_info.mIsCategory)
- {
- const LLUUID & cat_id(fetch_info.mUUID);
- if (cat_id.isNull()) //DEV-17797 Lost and found
- {
- LLSD folder_sd;
- folder_sd["folder_id"] = LLUUID::null.asString();
- folder_sd["owner_id"] = gAgent.getID();
- folder_sd["sort_order"] = LLSD::Integer(sort_order);
- folder_sd["fetch_folders"] = LLSD::Boolean(false);
- folder_sd["fetch_items"] = LLSD::Boolean(true);
- folder_request_body["folders"].append(folder_sd);
- folder_count++;
- }
- else
- {
+ LLSD folder_request_body;
+ LLSD folder_request_body_lib;
+ LLSD item_request_body;
+ LLSD item_request_body_lib;
+
+ while (! mFetchFolderQueue.empty()
+ && (item_count + folder_count) < max_batch_size)
+ {
+ const FetchQueueInfo & fetch_info(mFetchFolderQueue.front());
+ if (fetch_info.mIsCategory)
+ {
+ const LLUUID & cat_id(fetch_info.mUUID);
+ if (cat_id.isNull()) //DEV-17797 Lost and found
+ {
+ LLSD folder_sd;
+ folder_sd["folder_id"] = LLUUID::null.asString();
+ folder_sd["owner_id"] = gAgent.getID();
+ folder_sd["sort_order"] = LLSD::Integer(sort_order);
+ folder_sd["fetch_folders"] = LLSD::Boolean(false);
+ folder_sd["fetch_items"] = LLSD::Boolean(true);
+ folder_request_body["folders"].append(folder_sd);
+ folder_count++;
+ }
+ else
+ {
const LLViewerInventoryCategory * cat(gInventory.getCategory(cat_id));
if (cat)
{
@@ -1140,13 +1140,13 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
}
}
}
- }
- if (fetch_info.mFetchType >= FT_CONTENT_RECURSIVE)
- {
- recursive_cats.push_back(cat_id);
- }
+ }
+ if (fetch_info.mFetchType >= FT_CONTENT_RECURSIVE)
+ {
+ recursive_cats.push_back(cat_id);
+ }
all_cats.push_back(cat_id);
- }
+ }
mFetchFolderQueue.pop_front();
}
@@ -1177,84 +1177,84 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
}
mFetchItemQueue.pop_front();
- }
-
- // Issue HTTP POST requests to fetch folders and items
-
- if (item_count + folder_count > 0)
- {
- if (folder_count)
- {
- if (folder_request_body["folders"].size())
- {
- const std::string url(region->getCapability("FetchInventoryDescendents2"));
-
- if (! url.empty())
- {
+ }
+
+ // Issue HTTP POST requests to fetch folders and items
+
+ if (item_count + folder_count > 0)
+ {
+ if (folder_count)
+ {
+ if (folder_request_body["folders"].size())
+ {
+ const std::string url(region->getCapability("FetchInventoryDescendents2"));
+
+ if (! url.empty())
+ {
LLCore::HttpHandler::ptr_t handler(new BGFolderHttpHandler(folder_request_body, recursive_cats));
- gInventory.requestPost(false, url, folder_request_body, handler, "Inventory Folder");
- }
- }
-
- if (folder_request_body_lib["folders"].size())
- {
- const std::string url(region->getCapability("FetchLibDescendents2"));
-
- if (! url.empty())
- {
+ gInventory.requestPost(false, url, folder_request_body, handler, "Inventory Folder");
+ }
+ }
+
+ if (folder_request_body_lib["folders"].size())
+ {
+ const std::string url(region->getCapability("FetchLibDescendents2"));
+
+ if (! url.empty())
+ {
LLCore::HttpHandler::ptr_t handler(new BGFolderHttpHandler(folder_request_body_lib, recursive_cats));
- gInventory.requestPost(false, url, folder_request_body_lib, handler, "Library Folder");
- }
- }
- } // if (folder_count)
-
- if (item_count)
- {
- if (item_request_body.size())
- {
- const std::string url(region->getCapability("FetchInventory2"));
-
- if (! url.empty())
- {
- LLSD body;
- body["items"] = item_request_body;
+ gInventory.requestPost(false, url, folder_request_body_lib, handler, "Library Folder");
+ }
+ }
+ } // if (folder_count)
+
+ if (item_count)
+ {
+ if (item_request_body.size())
+ {
+ const std::string url(region->getCapability("FetchInventory2"));
+
+ if (! url.empty())
+ {
+ LLSD body;
+ body["items"] = item_request_body;
LLCore::HttpHandler::ptr_t handler(new BGItemHttpHandler(body));
- gInventory.requestPost(false, url, body, handler, "Inventory Item");
- }
- }
-
- if (item_request_body_lib.size())
- {
- const std::string url(region->getCapability("FetchLib2"));
-
- if (! url.empty())
- {
- LLSD body;
- body["items"] = item_request_body_lib;
+ gInventory.requestPost(false, url, body, handler, "Inventory Item");
+ }
+ }
+
+ if (item_request_body_lib.size())
+ {
+ const std::string url(region->getCapability("FetchLib2"));
+
+ if (! url.empty())
+ {
+ LLSD body;
+ body["items"] = item_request_body_lib;
LLCore::HttpHandler::ptr_t handler(new BGItemHttpHandler(body));
- gInventory.requestPost(false, url, body, handler, "Library Item");
- }
- }
- } // if (item_count)
-
- mFetchTimer.reset();
- }
- else if (isBulkFetchProcessingComplete())
- {
- setAllFoldersFetched();
- }
+ gInventory.requestPost(false, url, body, handler, "Library Item");
+ }
+ }
+ } // if (item_count)
+
+ mFetchTimer.reset();
+ }
+ else if (isBulkFetchProcessingComplete())
+ {
+ setAllFoldersFetched();
+ }
}
bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LLUUID & cat_id) const
{
- for (fetch_queue_t::const_iterator it = mFetchFolderQueue.begin();
- it != mFetchFolderQueue.end();
- ++it)
- {
- const LLUUID & fetch_id = (*it).mUUID;
- if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
- return false;
- }
+ for (fetch_queue_t::const_iterator it = mFetchFolderQueue.begin();
+ it != mFetchFolderQueue.end();
+ ++it)
+ {
+ const LLUUID & fetch_id = (*it).mUUID;
+ if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
+ return false;
+ }
for (fetch_queue_t::const_iterator it = mFetchItemQueue.begin();
it != mFetchItemQueue.end();
++it)
@@ -1263,7 +1263,7 @@ bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LL
if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
return false;
}
- return true;
+ return true;
}
@@ -1276,116 +1276,116 @@ namespace
void BGFolderHttpHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response)
{
- do // Single-pass do-while used for common exit handling
- {
- LLCore::HttpStatus status(response->getStatus());
- // status = LLCore::HttpStatus(404); // Dev tool to force error handling
- if (! status)
- {
- processFailure(status, response);
- break; // Goto common exit
- }
-
- // Response body should be present.
- LLCore::BufferArray * body(response->getBody());
- // body = NULL; // Dev tool to force error handling
- if (! body || ! body->size())
- {
- LL_WARNS(LOG_INV) << "Missing data in inventory folder query." << LL_ENDL;
- processFailure("HTTP response missing expected body", response);
- break; // Goto common exit
- }
-
- // Could test 'Content-Type' header but probably unreliable.
-
- // Convert response to LLSD
- // body->write(0, "Garbage Response", 16); // Dev tool to force error handling
- LLSD body_llsd;
- if (! LLCoreHttpUtil::responseToLLSD(response, true, body_llsd))
- {
- // INFOS-level logging will occur on the parsed failure
- processFailure("HTTP response contained malformed LLSD", response);
- break; // goto common exit
- }
-
- // Expect top-level structure to be a map
- // body_llsd = LLSD::emptyArray(); // Dev tool to force error handling
- if (! body_llsd.isMap())
- {
- processFailure("LLSD response not a map", response);
- break; // goto common exit
- }
-
- // Check for 200-with-error failures
- //
- // See comments in llinventorymodel.cpp about this mode of error.
- //
- // body_llsd["error"] = LLSD::emptyMap(); // Dev tool to force error handling
- // body_llsd["error"]["identifier"] = "Development";
- // body_llsd["error"]["message"] = "You left development code in the viewer";
- if (body_llsd.has("error"))
- {
- processFailure("Inventory application error (200-with-error)", response);
- break; // goto common exit
- }
-
- // Okay, process data if possible
- processData(body_llsd, response);
- }
- while (false);
+ do // Single-pass do-while used for common exit handling
+ {
+ LLCore::HttpStatus status(response->getStatus());
+ // status = LLCore::HttpStatus(404); // Dev tool to force error handling
+ if (! status)
+ {
+ processFailure(status, response);
+ break; // Goto common exit
+ }
+
+ // Response body should be present.
+ LLCore::BufferArray * body(response->getBody());
+ // body = NULL; // Dev tool to force error handling
+ if (! body || ! body->size())
+ {
+ LL_WARNS(LOG_INV) << "Missing data in inventory folder query." << LL_ENDL;
+ processFailure("HTTP response missing expected body", response);
+ break; // Goto common exit
+ }
+
+ // Could test 'Content-Type' header but probably unreliable.
+
+ // Convert response to LLSD
+ // body->write(0, "Garbage Response", 16); // Dev tool to force error handling
+ LLSD body_llsd;
+ if (! LLCoreHttpUtil::responseToLLSD(response, true, body_llsd))
+ {
+ // INFOS-level logging will occur on the parsed failure
+ processFailure("HTTP response contained malformed LLSD", response);
+ break; // goto common exit
+ }
+
+ // Expect top-level structure to be a map
+ // body_llsd = LLSD::emptyArray(); // Dev tool to force error handling
+ if (! body_llsd.isMap())
+ {
+ processFailure("LLSD response not a map", response);
+ break; // goto common exit
+ }
+
+ // Check for 200-with-error failures
+ //
+ // See comments in llinventorymodel.cpp about this mode of error.
+ //
+ // body_llsd["error"] = LLSD::emptyMap(); // Dev tool to force error handling
+ // body_llsd["error"]["identifier"] = "Development";
+ // body_llsd["error"]["message"] = "You left development code in the viewer";
+ if (body_llsd.has("error"))
+ {
+ processFailure("Inventory application error (200-with-error)", response);
+ break; // goto common exit
+ }
+
+ // Okay, process data if possible
+ processData(body_llsd, response);
+ }
+ while (false);
}
void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * response)
{
- LLInventoryModelBackgroundFetch * fetcher(LLInventoryModelBackgroundFetch::getInstance());
-
- // API V2 and earlier should probably be testing for "error" map
- // in response as an application-level error.
-
- // Instead, we assume success and attempt to extract information.
- if (content.has("folders"))
- {
- LLSD folders(content["folders"]);
-
- for (LLSD::array_const_iterator folder_it = folders.beginArray();
- folder_it != folders.endArray();
- ++folder_it)
- {
- LLSD folder_sd(*folder_it);
-
- //LLUUID agent_id = folder_sd["agent_id"];
-
- //if(agent_id != gAgent.getID()) //This should never happen.
- //{
- // LL_WARNS(LOG_INV) << "Got a UpdateInventoryItem for the wrong agent."
- // << LL_ENDL;
- // break;
- //}
-
- LLUUID parent_id(folder_sd["folder_id"].asUUID());
- LLUUID owner_id(folder_sd["owner_id"].asUUID());
- S32 version(folder_sd["version"].asInteger());
- S32 descendents(folder_sd["descendents"].asInteger());
- LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id);
+ LLInventoryModelBackgroundFetch * fetcher(LLInventoryModelBackgroundFetch::getInstance());
+
+ // API V2 and earlier should probably be testing for "error" map
+ // in response as an application-level error.
+
+ // Instead, we assume success and attempt to extract information.
+ if (content.has("folders"))
+ {
+ LLSD folders(content["folders"]);
+
+ for (LLSD::array_const_iterator folder_it = folders.beginArray();
+ folder_it != folders.endArray();
+ ++folder_it)
+ {
+ LLSD folder_sd(*folder_it);
+
+ //LLUUID agent_id = folder_sd["agent_id"];
+
+ //if(agent_id != gAgent.getID()) //This should never happen.
+ //{
+ // LL_WARNS(LOG_INV) << "Got a UpdateInventoryItem for the wrong agent."
+ // << LL_ENDL;
+ // break;
+ //}
+
+ LLUUID parent_id(folder_sd["folder_id"].asUUID());
+ LLUUID owner_id(folder_sd["owner_id"].asUUID());
+ S32 version(folder_sd["version"].asInteger());
+ S32 descendents(folder_sd["descendents"].asInteger());
+ LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id);
if (parent_id.isNull())
{
- LLSD items(folder_sd["items"]);
- LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
-
- for (LLSD::array_const_iterator item_it = items.beginArray();
- item_it != items.endArray();
- ++item_it)
- {
+ LLSD items(folder_sd["items"]);
+ LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
+
+ for (LLSD::array_const_iterator item_it = items.beginArray();
+ item_it != items.endArray();
+ ++item_it)
+ {
const LLUUID lost_uuid(gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND));
if (lost_uuid.notNull())
{
- LLSD item(*item_it);
+ LLSD item(*item_it);
+
+ titem->unpackMessage(item);
- titem->unpackMessage(item);
-
LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1);
update.push_back(new_folder);
@@ -1398,88 +1398,88 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res
}
}
- LLViewerInventoryCategory * pcat(gInventory.getCategory(parent_id));
- if (! pcat)
- {
- continue;
- }
-
- LLSD categories(folder_sd["categories"]);
- for (LLSD::array_const_iterator category_it = categories.beginArray();
- category_it != categories.endArray();
- ++category_it)
- {
- LLSD category(*category_it);
- tcategory->fromLLSD(category);
-
- const bool recursive(getIsRecursive(tcategory->getUUID()));
- if (recursive)
- {
- fetcher->addRequestAtBack(tcategory->getUUID(), recursive, true);
- }
- else if (! gInventory.isCategoryComplete(tcategory->getUUID()))
- {
- gInventory.updateCategory(tcategory);
- }
- }
-
- LLSD items(folder_sd["items"]);
- LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
- for (LLSD::array_const_iterator item_it = items.beginArray();
- item_it != items.endArray();
- ++item_it)
- {
- LLSD item(*item_it);
- titem->unpackMessage(item);
-
- gInventory.updateItem(titem);
- }
-
- // Set version and descendentcount according to message.
- LLViewerInventoryCategory * cat(gInventory.getCategory(parent_id));
- if (cat)
- {
- cat->setVersion(version);
- cat->setDescendentCount(descendents);
- cat->determineFolderType();
- }
- }
- }
-
- if (content.has("bad_folders"))
- {
- LLSD bad_folders(content["bad_folders"]);
- for (LLSD::array_const_iterator folder_it = bad_folders.beginArray();
- folder_it != bad_folders.endArray();
- ++folder_it)
- {
- // *TODO: Stop copying data [ed: this isn't copying data]
- LLSD folder_sd(*folder_it);
-
- // These folders failed on the dataserver. We probably don't want to retry them.
- LL_WARNS(LOG_INV) << "Folder " << folder_sd["folder_id"].asString()
- << "Error: " << folder_sd["error"].asString() << LL_ENDL;
- }
- }
-
- if (fetcher->isBulkFetchProcessingComplete())
- {
- fetcher->setAllFoldersFetched();
- }
+ LLViewerInventoryCategory * pcat(gInventory.getCategory(parent_id));
+ if (! pcat)
+ {
+ continue;
+ }
+
+ LLSD categories(folder_sd["categories"]);
+ for (LLSD::array_const_iterator category_it = categories.beginArray();
+ category_it != categories.endArray();
+ ++category_it)
+ {
+ LLSD category(*category_it);
+ tcategory->fromLLSD(category);
+
+ const bool recursive(getIsRecursive(tcategory->getUUID()));
+ if (recursive)
+ {
+ fetcher->addRequestAtBack(tcategory->getUUID(), recursive, true);
+ }
+ else if (! gInventory.isCategoryComplete(tcategory->getUUID()))
+ {
+ gInventory.updateCategory(tcategory);
+ }
+ }
+
+ LLSD items(folder_sd["items"]);
+ LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
+ for (LLSD::array_const_iterator item_it = items.beginArray();
+ item_it != items.endArray();
+ ++item_it)
+ {
+ LLSD item(*item_it);
+ titem->unpackMessage(item);
+
+ gInventory.updateItem(titem);
+ }
+
+ // Set version and descendentcount according to message.
+ LLViewerInventoryCategory * cat(gInventory.getCategory(parent_id));
+ if (cat)
+ {
+ cat->setVersion(version);
+ cat->setDescendentCount(descendents);
+ cat->determineFolderType();
+ }
+ }
+ }
+
+ if (content.has("bad_folders"))
+ {
+ LLSD bad_folders(content["bad_folders"]);
+ for (LLSD::array_const_iterator folder_it = bad_folders.beginArray();
+ folder_it != bad_folders.endArray();
+ ++folder_it)
+ {
+ // *TODO: Stop copying data [ed: this isn't copying data]
+ LLSD folder_sd(*folder_it);
+
+ // These folders failed on the dataserver. We probably don't want to retry them.
+ LL_WARNS(LOG_INV) << "Folder " << folder_sd["folder_id"].asString()
+ << "Error: " << folder_sd["error"].asString() << LL_ENDL;
+ }
+ }
+
+ if (fetcher->isBulkFetchProcessingComplete())
+ {
+ fetcher->setAllFoldersFetched();
+ }
}
void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::HttpResponse * response)
{
- const std::string & ct(response->getContentType());
- LL_WARNS(LOG_INV) << "Inventory folder fetch failure\n"
- << "[Status: " << status.toTerseString() << "]\n"
- << "[Reason: " << status.toString() << "]\n"
- << "[Content-type: " << ct << "]\n"
- << "[Content (abridged): "
- << LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
+ const std::string & ct(response->getContentType());
+ LL_WARNS(LOG_INV) << "Inventory folder fetch failure\n"
+ << "[Status: " << status.toTerseString() << "]\n"
+ << "[Reason: " << status.toString() << "]\n"
+ << "[Content-type: " << ct << "]\n"
+ << "[Content (abridged): "
+ << LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
- // Could use a 404 test here to try to detect revoked caps...
+ // Could use a 404 test here to try to detect revoked caps...
if(status == LLCore::HttpStatus(HTTP_FORBIDDEN))
{
@@ -1537,77 +1537,77 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http
LLNotificationsUtil::add("InventoryLimitReachedAIS");
}
}
-
- // This was originally the request retry logic for the inventory
- // request which tested on HTTP_INTERNAL_ERROR status. This
- // retry logic was unbounded and lacked discrimination as to the
- // cause of the retry. The new http library should be doing
- // adquately on retries but I want to keep the structure of a
- // retry for reference.
- LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance();
- if (false)
- {
- // timed out or curl failure
- for (LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
- folder_it != mRequestSD["folders"].endArray();
- ++folder_it)
- {
- LLSD folder_sd(*folder_it);
- LLUUID folder_id(folder_sd["folder_id"].asUUID());
- const BOOL recursive = getIsRecursive(folder_id);
- fetcher->addRequestAtFront(folder_id, recursive, true);
- }
- }
- else
- {
- if (fetcher->isBulkFetchProcessingComplete())
- {
- fetcher->setAllFoldersFetched();
- }
- }
+
+ // This was originally the request retry logic for the inventory
+ // request which tested on HTTP_INTERNAL_ERROR status. This
+ // retry logic was unbounded and lacked discrimination as to the
+ // cause of the retry. The new http library should be doing
+ // adquately on retries but I want to keep the structure of a
+ // retry for reference.
+ LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance();
+ if (false)
+ {
+ // timed out or curl failure
+ for (LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
+ folder_it != mRequestSD["folders"].endArray();
+ ++folder_it)
+ {
+ LLSD folder_sd(*folder_it);
+ LLUUID folder_id(folder_sd["folder_id"].asUUID());
+ const BOOL recursive = getIsRecursive(folder_id);
+ fetcher->addRequestAtFront(folder_id, recursive, true);
+ }
+ }
+ else
+ {
+ if (fetcher->isBulkFetchProcessingComplete())
+ {
+ fetcher->setAllFoldersFetched();
+ }
+ }
}
void BGFolderHttpHandler::processFailure(const char * const reason, LLCore::HttpResponse * response)
{
- LL_WARNS(LOG_INV) << "Inventory folder fetch failure\n"
- << "[Status: internal error]\n"
- << "[Reason: " << reason << "]\n"
- << "[Content (abridged): "
- << LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
-
- // Reverse of previous processFailure() method, this is invoked
- // when response structure is found to be invalid. Original
- // always re-issued the request (without limit). This does
- // the same but be aware that this may be a source of problems.
- // Philosophy is that inventory folders are so essential to
- // operation that this is a reasonable action.
- LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance();
- if (true)
- {
- for (LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
- folder_it != mRequestSD["folders"].endArray();
- ++folder_it)
- {
- LLSD folder_sd(*folder_it);
- LLUUID folder_id(folder_sd["folder_id"].asUUID());
- const BOOL recursive = getIsRecursive(folder_id);
- fetcher->addRequestAtFront(folder_id, recursive, true);
- }
- }
- else
- {
- if (fetcher->isBulkFetchProcessingComplete())
- {
- fetcher->setAllFoldersFetched();
- }
- }
+ LL_WARNS(LOG_INV) << "Inventory folder fetch failure\n"
+ << "[Status: internal error]\n"
+ << "[Reason: " << reason << "]\n"
+ << "[Content (abridged): "
+ << LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
+
+ // Reverse of previous processFailure() method, this is invoked
+ // when response structure is found to be invalid. Original
+ // always re-issued the request (without limit). This does
+ // the same but be aware that this may be a source of problems.
+ // Philosophy is that inventory folders are so essential to
+ // operation that this is a reasonable action.
+ LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance();
+ if (true)
+ {
+ for (LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
+ folder_it != mRequestSD["folders"].endArray();
+ ++folder_it)
+ {
+ LLSD folder_sd(*folder_it);
+ LLUUID folder_id(folder_sd["folder_id"].asUUID());
+ const BOOL recursive = getIsRecursive(folder_id);
+ fetcher->addRequestAtFront(folder_id, recursive, true);
+ }
+ }
+ else
+ {
+ if (fetcher->isBulkFetchProcessingComplete())
+ {
+ fetcher->setAllFoldersFetched();
+ }
+ }
}
bool BGFolderHttpHandler::getIsRecursive(const LLUUID & cat_id) const
{
- return std::find(mRecursiveCatUUIDs.begin(), mRecursiveCatUUIDs.end(), cat_id) != mRecursiveCatUUIDs.end();
+ return std::find(mRecursiveCatUUIDs.begin(), mRecursiveCatUUIDs.end(), cat_id) != mRecursiveCatUUIDs.end();
}
///----------------------------------------------------------------------------
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index 989968be53..54077b71b2 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventorymodelbackgroundfetch.h
* @brief LLInventoryModelBackgroundFetch class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,13 +43,13 @@
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackgroundFetch>
{
- LLSINGLETON(LLInventoryModelBackgroundFetch);
- ~LLInventoryModelBackgroundFetch();
+ LLSINGLETON(LLInventoryModelBackgroundFetch);
+ ~LLInventoryModelBackgroundFetch();
public:
// Start background breadth-first fetching of inventory contents.
- // This gets triggered when performing a filter-search.
- void start(const LLUUID& cat_id = LLUUID::null, bool recursive = true);
+ // This gets triggered when performing a filter-search.
+ void start(const LLUUID& cat_id = LLUUID::null, bool recursive = true);
void scheduleFolderFetch(const LLUUID& cat_id, bool forced = false);
void scheduleItemFetch(const LLUUID& item_id, bool forced = false);
@@ -60,29 +60,29 @@ public:
// AIS3 only
void fetchCOF(nullary_func_t callback);
- BOOL folderFetchActive() const;
- bool isEverythingFetched() const; // completing the fetch once per session should be sufficient
+ BOOL folderFetchActive() const;
+ bool isEverythingFetched() const; // completing the fetch once per session should be sufficient
+
+ bool libraryFetchStarted() const;
+ bool libraryFetchCompleted() const;
+ bool libraryFetchInProgress() const;
- bool libraryFetchStarted() const;
- bool libraryFetchCompleted() const;
- bool libraryFetchInProgress() const;
-
- bool inventoryFetchStarted() const;
- bool inventoryFetchCompleted() const;
- bool inventoryFetchInProgress() const;
+ bool inventoryFetchStarted() const;
+ bool inventoryFetchCompleted() const;
+ bool inventoryFetchInProgress() const;
void findLostItems();
void incrFetchCount(S32 fetching);
void incrFetchFolderCount(S32 fetching);
- bool isBulkFetchProcessingComplete() const;
- void setAllFoldersFetched();
+ bool isBulkFetchProcessingComplete() const;
+ void setAllFoldersFetched();
typedef boost::function<void()> folders_fetched_callback_t;
boost::signals2::connection setFetchCompletionCallback(folders_fetched_callback_t cb);
- void addRequestAtFront(const LLUUID & id, bool recursive, bool is_category);
- void addRequestAtBack(const LLUUID & id, bool recursive, bool is_category);
+ void addRequestAtFront(const LLUUID & id, bool recursive, bool is_category);
+ void addRequestAtBack(const LLUUID & id, bool recursive, bool is_category);
protected:
bool isFolderFetchProcessingComplete() const;
@@ -112,30 +112,30 @@ protected:
void onAISFolderCalback(const LLUUID &request_id, const LLUUID &response_id, EFetchType fetch_type);
void bulkFetchViaAis();
void bulkFetchViaAis(const FetchQueueInfo& fetch_info);
- void bulkFetch();
+ void bulkFetch();
- void backgroundFetch();
- static void backgroundFetchCB(void*); // background fetch idle function
+ void backgroundFetch();
+ static void backgroundFetchCB(void*); // background fetch idle function
- bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const;
+ bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const;
private:
- bool mRecursiveInventoryFetchStarted;
- bool mRecursiveLibraryFetchStarted;
+ bool mRecursiveInventoryFetchStarted;
+ bool mRecursiveLibraryFetchStarted;
bool mRecursiveMarketplaceFetchStarted; // AIS3 specific
- bool mAllRecursiveFoldersFetched;
+ bool mAllRecursiveFoldersFetched;
typedef boost::signals2::signal<void()> folders_fetched_signal_t;
folders_fetched_signal_t mFoldersFetchedSignal;
bool mBackgroundFetchActive;
- bool mFolderFetchActive;
- S32 mFetchCount;
+ bool mFolderFetchActive;
+ S32 mFetchCount;
S32 mLastFetchCount; // for debug
S32 mFetchFolderCount;
- LLFrameTimer mFetchTimer;
- F32 mMinTimeBetweenFetches;
- fetch_queue_t mFetchFolderQueue;
+ LLFrameTimer mFetchTimer;
+ F32 mMinTimeBetweenFetches;
+ fetch_queue_t mFetchFolderQueue;
fetch_queue_t mFetchItemQueue;
uuid_set_t mForceFetchSet;
std::list<LLUUID> mExpectedFolderIds; // for debug, should this track time?
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 15cd7957a2..1c76c154a1 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventoryobserver.cpp
* @brief Implementation of the inventory observers used to track agent inventory.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -73,94 +73,94 @@ LLInventoryObserver::~LLInventoryObserver()
LLInventoryFetchObserver::LLInventoryFetchObserver(const LLUUID& id)
{
- mIDs.clear();
- if (id != LLUUID::null)
- {
- setFetchID(id);
- }
+ mIDs.clear();
+ if (id != LLUUID::null)
+ {
+ setFetchID(id);
+ }
}
LLInventoryFetchObserver::LLInventoryFetchObserver(const uuid_vec_t& ids)
{
- setFetchIDs(ids);
+ setFetchIDs(ids);
}
BOOL LLInventoryFetchObserver::isFinished() const
{
- return mIncomplete.empty();
+ return mIncomplete.empty();
}
void LLInventoryFetchObserver::setFetchIDs(const uuid_vec_t& ids)
{
- mIDs = ids;
+ mIDs = ids;
}
void LLInventoryFetchObserver::setFetchID(const LLUUID& id)
{
- mIDs.clear();
- mIDs.push_back(id);
+ mIDs.clear();
+ mIDs.push_back(id);
}
void LLInventoryCompletionObserver::changed(U32 mask)
{
- // scan through the incomplete items and move or erase them as
- // appropriate.
- if (!mIncomplete.empty())
- {
- for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
- {
- const LLViewerInventoryItem* item = gInventory.getItem(*it);
- if (!item)
- {
- it = mIncomplete.erase(it);
- continue;
- }
- if (item->isFinished())
- {
- mComplete.push_back(*it);
- it = mIncomplete.erase(it);
- continue;
- }
- ++it;
- }
- if (mIncomplete.empty())
- {
- done();
- }
- }
+ // scan through the incomplete items and move or erase them as
+ // appropriate.
+ if (!mIncomplete.empty())
+ {
+ for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
+ {
+ const LLViewerInventoryItem* item = gInventory.getItem(*it);
+ if (!item)
+ {
+ it = mIncomplete.erase(it);
+ continue;
+ }
+ if (item->isFinished())
+ {
+ mComplete.push_back(*it);
+ it = mIncomplete.erase(it);
+ continue;
+ }
+ ++it;
+ }
+ if (mIncomplete.empty())
+ {
+ done();
+ }
+ }
}
void LLInventoryCompletionObserver::watchItem(const LLUUID& id)
{
- if (id.notNull())
- {
- mIncomplete.push_back(id);
- }
+ if (id.notNull())
+ {
+ mIncomplete.push_back(id);
+ }
}
LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id) :
- LLInventoryFetchObserver(item_id)
+ LLInventoryFetchObserver(item_id)
{
- mIDs.clear();
- mIDs.push_back(item_id);
+ mIDs.clear();
+ mIDs.push_back(item_id);
}
LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids) :
- LLInventoryFetchObserver(item_ids)
+ LLInventoryFetchObserver(item_ids)
{
}
void LLInventoryFetchItemsObserver::changed(U32 mask)
{
LL_DEBUGS("InventoryFetch") << this << " remaining incomplete " << mIncomplete.size()
- << " complete " << mComplete.size()
- << " wait period " << mFetchingPeriod.getRemainingTimeF32()
- << LL_ENDL;
-
- // scan through the incomplete items and move or erase them as
- // appropriate.
- if (!mIncomplete.empty())
- {
+ << " complete " << mComplete.size()
+ << " wait period " << mFetchingPeriod.getRemainingTimeF32()
+ << LL_ENDL;
+
+ // scan through the incomplete items and move or erase them as
+ // appropriate.
+ if (!mIncomplete.empty())
+ {
if (!LLInventoryModelBackgroundFetch::getInstance()->isEverythingFetched())
{
// Folders have a priority over items and they download items as well
@@ -171,106 +171,106 @@ void LLInventoryFetchItemsObserver::changed(U32 mask)
mFetchingPeriod.setTimerExpirySec(FETCH_TIMER_EXPIRY);
}
- // Have we exceeded max wait time?
- bool timeout_expired = mFetchingPeriod.hasExpired();
-
- for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
- {
- const LLUUID& item_id = (*it);
- LLViewerInventoryItem* item = gInventory.getItem(item_id);
- if (item && item->isFinished())
- {
- mComplete.push_back(item_id);
- it = mIncomplete.erase(it);
- }
- else
- {
- if (timeout_expired)
- {
- // Just concede that this item hasn't arrived in reasonable time and continue on.
+ // Have we exceeded max wait time?
+ bool timeout_expired = mFetchingPeriod.hasExpired();
+
+ for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
+ {
+ const LLUUID& item_id = (*it);
+ LLViewerInventoryItem* item = gInventory.getItem(item_id);
+ if (item && item->isFinished())
+ {
+ mComplete.push_back(item_id);
+ it = mIncomplete.erase(it);
+ }
+ else
+ {
+ if (timeout_expired)
+ {
+ // Just concede that this item hasn't arrived in reasonable time and continue on.
LL_WARNS("InventoryFetch") << "Fetcher timed out when fetching inventory item UUID: " << item_id << LL_ENDL;
- it = mIncomplete.erase(it);
- }
- else
- {
- // Keep trying.
- ++it;
- }
- }
- }
-
- }
-
- if (mIncomplete.empty())
- {
+ it = mIncomplete.erase(it);
+ }
+ else
+ {
+ // Keep trying.
+ ++it;
+ }
+ }
+ }
+
+ }
+
+ if (mIncomplete.empty())
+ {
LL_DEBUGS("InventoryFetch") << this << " done at remaining incomplete "
- << mIncomplete.size() << " complete " << mComplete.size() << LL_ENDL;
- done();
- }
- //LL_INFOS() << "LLInventoryFetchItemsObserver::changed() mComplete size " << mComplete.size() << LL_ENDL;
- //LL_INFOS() << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << LL_ENDL;
+ << mIncomplete.size() << " complete " << mComplete.size() << LL_ENDL;
+ done();
+ }
+ //LL_INFOS() << "LLInventoryFetchItemsObserver::changed() mComplete size " << mComplete.size() << LL_ENDL;
+ //LL_INFOS() << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << LL_ENDL;
}
void fetch_items_from_llsd(const LLSD& items_llsd)
{
- if (!items_llsd.size() || gDisconnected) return;
-
- LLSD body;
- body[0]["cap_name"] = "FetchInventory2";
- body[1]["cap_name"] = "FetchLib2";
- for (S32 i=0; i<items_llsd.size();i++)
- {
- if (items_llsd[i]["owner_id"].asString() == gAgent.getID().asString())
- {
- body[0]["items"].append(items_llsd[i]);
- continue;
- }
- else if (items_llsd[i]["owner_id"].asString() == ALEXANDRIA_LINDEN_ID.asString())
- {
- body[1]["items"].append(items_llsd[i]);
- continue;
- }
- }
-
- for (S32 i=0; i<body.size(); i++)
- {
- if (!gAgent.getRegion())
- {
- LL_WARNS() << "Agent's region is null" << LL_ENDL;
- break;
- }
-
- if (0 == body[i]["items"].size()) {
- LL_DEBUGS() << "Skipping body with no items to fetch" << LL_ENDL;
- continue;
- }
-
- std::string url = gAgent.getRegion()->getCapability(body[i]["cap_name"].asString());
- if (!url.empty())
- {
- body[i]["agent_id"] = gAgent.getID();
+ if (!items_llsd.size() || gDisconnected) return;
+
+ LLSD body;
+ body[0]["cap_name"] = "FetchInventory2";
+ body[1]["cap_name"] = "FetchLib2";
+ for (S32 i=0; i<items_llsd.size();i++)
+ {
+ if (items_llsd[i]["owner_id"].asString() == gAgent.getID().asString())
+ {
+ body[0]["items"].append(items_llsd[i]);
+ continue;
+ }
+ else if (items_llsd[i]["owner_id"].asString() == ALEXANDRIA_LINDEN_ID.asString())
+ {
+ body[1]["items"].append(items_llsd[i]);
+ continue;
+ }
+ }
+
+ for (S32 i=0; i<body.size(); i++)
+ {
+ if (!gAgent.getRegion())
+ {
+ LL_WARNS() << "Agent's region is null" << LL_ENDL;
+ break;
+ }
+
+ if (0 == body[i]["items"].size()) {
+ LL_DEBUGS() << "Skipping body with no items to fetch" << LL_ENDL;
+ continue;
+ }
+
+ std::string url = gAgent.getRegion()->getCapability(body[i]["cap_name"].asString());
+ if (!url.empty())
+ {
+ body[i]["agent_id"] = gAgent.getID();
LLCore::HttpHandler::ptr_t handler(new LLInventoryModel::FetchItemHttpHandler(body[i]));
- gInventory.requestPost(true, url, body[i], handler, (i ? "Library Item" : "Inventory Item"));
- continue;
- }
+ gInventory.requestPost(true, url, body[i], handler, (i ? "Library Item" : "Inventory Item"));
+ continue;
+ }
else
{
LL_WARNS("INVENTORY") << "Failed to get capability." << LL_ENDL;
}
- }
+ }
}
void LLInventoryFetchItemsObserver::startFetch()
{
bool aisv3 = AISAPI::isAvailable();
- LLSD items_llsd;
+ LLSD items_llsd;
typedef std::map<LLUUID, uuid_vec_t> requests_by_folders_t;
requests_by_folders_t requests;
- for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
- {
+ for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
+ {
LLViewerInventoryItem* item = gInventory.getItem(*it);
if (item && item->isFinished())
{
@@ -279,24 +279,24 @@ void LLInventoryFetchItemsObserver::startFetch()
continue;
}
- // Ignore categories since they're not items. We
- // could also just add this to mComplete but not sure what the
- // side-effects would be, so ignoring to be safe.
- LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
- if (cat)
- {
- continue;
- }
+ // Ignore categories since they're not items. We
+ // could also just add this to mComplete but not sure what the
+ // side-effects would be, so ignoring to be safe.
+ LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
+ if (cat)
+ {
+ continue;
+ }
- if ((*it).isNull())
- {
- LL_WARNS("Inventory") << "Skip fetching for a NULL uuid" << LL_ENDL;
- continue;
- }
+ if ((*it).isNull())
+ {
+ LL_WARNS("Inventory") << "Skip fetching for a NULL uuid" << LL_ENDL;
+ continue;
+ }
- // It's incomplete, so put it on the incomplete container, and
- // pack this on the message.
- mIncomplete.push_back(*it);
+ // It's incomplete, so put it on the incomplete container, and
+ // pack this on the message.
+ mIncomplete.push_back(*it);
if (aisv3)
{
@@ -328,10 +328,10 @@ void LLInventoryFetchItemsObserver::startFetch()
item_entry["item_id"] = (*it);
items_llsd.append(item_entry);
}
- }
+ }
- mFetchingPeriod.reset();
- mFetchingPeriod.setTimerExpirySec(FETCH_TIMER_EXPIRY);
+ mFetchingPeriod.reset();
+ mFetchingPeriod.setTimerExpirySec(FETCH_TIMER_EXPIRY);
if (aisv3)
{
@@ -389,34 +389,34 @@ void LLInventoryFetchItemsObserver::startFetch()
}
LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const LLUUID& cat_id) :
- LLInventoryFetchObserver(cat_id)
+ LLInventoryFetchObserver(cat_id)
{
}
LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids) :
- LLInventoryFetchObserver(cat_ids)
+ LLInventoryFetchObserver(cat_ids)
{
}
// virtual
void LLInventoryFetchDescendentsObserver::changed(U32 mask)
{
- for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();)
- {
- const LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
- if (!cat)
- {
- it = mIncomplete.erase(it);
- continue;
- }
- if (isCategoryComplete(cat))
- {
- mComplete.push_back(*it);
- it = mIncomplete.erase(it);
- continue;
- }
- ++it;
- }
+ for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();)
+ {
+ const LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
+ if (!cat)
+ {
+ it = mIncomplete.erase(it);
+ continue;
+ }
+ if (isCategoryComplete(cat))
+ {
+ mComplete.push_back(*it);
+ it = mIncomplete.erase(it);
+ continue;
+ }
+ ++it;
+ }
if (mIncomplete.empty())
{
@@ -437,180 +437,180 @@ void LLInventoryFetchDescendentsObserver::changed(U32 mask)
void LLInventoryFetchDescendentsObserver::startFetch()
{
- for (uuid_vec_t::const_iterator it = mIDs.begin(); it != mIDs.end(); ++it)
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
- if (!cat) continue;
- if (!isCategoryComplete(cat))
- {
+ for (uuid_vec_t::const_iterator it = mIDs.begin(); it != mIDs.end(); ++it)
+ {
+ LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
+ if (!cat) continue;
+ if (!isCategoryComplete(cat))
+ {
//blindly fetch it without seeing if anything else is fetching it.
LLInventoryModelBackgroundFetch::getInstance()->scheduleFolderFetch(*it, true);
- mIncomplete.push_back(*it); //Add to list of things being downloaded for this observer.
- }
- else
- {
- mComplete.push_back(*it);
- }
- }
+ mIncomplete.push_back(*it); //Add to list of things being downloaded for this observer.
+ }
+ else
+ {
+ mComplete.push_back(*it);
+ }
+ }
}
BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInventoryCategory* cat) const
{
- const S32 version = cat->getVersion();
- const S32 expected_num_descendents = cat->getDescendentCount();
- if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) ||
- (expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN))
- {
- return FALSE;
- }
- // it might be complete - check known descendents against
- // currently available.
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(cat->getUUID(), cats, items);
- if (!cats || !items)
- {
- LL_WARNS() << "Category '" << cat->getName() << "' descendents corrupted, fetch failed." << LL_ENDL;
- // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
- // that the cat just doesn't have any items or subfolders).
- // Unrecoverable, so just return done so that this observer can be cleared
- // from memory.
- return TRUE;
- }
- const S32 current_num_known_descendents = cats->size() + items->size();
-
- // Got the number of descendents that we were expecting, so we're done.
- if (current_num_known_descendents == expected_num_descendents)
- {
- return TRUE;
- }
-
- // Error condition, but recoverable. This happens if something was added to the
- // category before it was initialized, so accountForUpdate didn't update descendent
- // count and thus the category thinks it has fewer descendents than it actually has.
- if (current_num_known_descendents >= expected_num_descendents)
- {
- LL_WARNS() << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << LL_ENDL;
- const_cast<LLViewerInventoryCategory *>(cat)->setDescendentCount(current_num_known_descendents);
- return TRUE;
- }
- return FALSE;
+ const S32 version = cat->getVersion();
+ const S32 expected_num_descendents = cat->getDescendentCount();
+ if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) ||
+ (expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN))
+ {
+ return FALSE;
+ }
+ // it might be complete - check known descendents against
+ // currently available.
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ gInventory.getDirectDescendentsOf(cat->getUUID(), cats, items);
+ if (!cats || !items)
+ {
+ LL_WARNS() << "Category '" << cat->getName() << "' descendents corrupted, fetch failed." << LL_ENDL;
+ // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
+ // that the cat just doesn't have any items or subfolders).
+ // Unrecoverable, so just return done so that this observer can be cleared
+ // from memory.
+ return TRUE;
+ }
+ const S32 current_num_known_descendents = cats->size() + items->size();
+
+ // Got the number of descendents that we were expecting, so we're done.
+ if (current_num_known_descendents == expected_num_descendents)
+ {
+ return TRUE;
+ }
+
+ // Error condition, but recoverable. This happens if something was added to the
+ // category before it was initialized, so accountForUpdate didn't update descendent
+ // count and thus the category thinks it has fewer descendents than it actually has.
+ if (current_num_known_descendents >= expected_num_descendents)
+ {
+ LL_WARNS() << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << LL_ENDL;
+ const_cast<LLViewerInventoryCategory *>(cat)->setDescendentCount(current_num_known_descendents);
+ return TRUE;
+ }
+ return FALSE;
}
LLInventoryFetchComboObserver::LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids,
- const uuid_vec_t& item_ids)
+ const uuid_vec_t& item_ids)
{
- mFetchDescendents = new LLInventoryFetchDescendentsObserver(folder_ids);
+ mFetchDescendents = new LLInventoryFetchDescendentsObserver(folder_ids);
- uuid_vec_t pruned_item_ids;
- for (uuid_vec_t::const_iterator item_iter = item_ids.begin();
- item_iter != item_ids.end();
- ++item_iter)
- {
- const LLUUID& item_id = (*item_iter);
- const LLViewerInventoryItem* item = gInventory.getItem(item_id);
- if (item && std::find(folder_ids.begin(), folder_ids.end(), item->getParentUUID()) == folder_ids.end())
- {
- continue;
- }
- pruned_item_ids.push_back(item_id);
- }
+ uuid_vec_t pruned_item_ids;
+ for (uuid_vec_t::const_iterator item_iter = item_ids.begin();
+ item_iter != item_ids.end();
+ ++item_iter)
+ {
+ const LLUUID& item_id = (*item_iter);
+ const LLViewerInventoryItem* item = gInventory.getItem(item_id);
+ if (item && std::find(folder_ids.begin(), folder_ids.end(), item->getParentUUID()) == folder_ids.end())
+ {
+ continue;
+ }
+ pruned_item_ids.push_back(item_id);
+ }
- mFetchItems = new LLInventoryFetchItemsObserver(pruned_item_ids);
- mFetchDescendents = new LLInventoryFetchDescendentsObserver(folder_ids);
+ mFetchItems = new LLInventoryFetchItemsObserver(pruned_item_ids);
+ mFetchDescendents = new LLInventoryFetchDescendentsObserver(folder_ids);
}
LLInventoryFetchComboObserver::~LLInventoryFetchComboObserver()
{
- mFetchItems->done();
- mFetchDescendents->done();
- delete mFetchItems;
- delete mFetchDescendents;
+ mFetchItems->done();
+ mFetchDescendents->done();
+ delete mFetchItems;
+ delete mFetchDescendents;
}
void LLInventoryFetchComboObserver::changed(U32 mask)
{
- mFetchItems->changed(mask);
- mFetchDescendents->changed(mask);
- if (mFetchItems->isFinished() && mFetchDescendents->isFinished())
- {
- done();
- }
+ mFetchItems->changed(mask);
+ mFetchDescendents->changed(mask);
+ if (mFetchItems->isFinished() && mFetchDescendents->isFinished())
+ {
+ done();
+ }
}
void LLInventoryFetchComboObserver::startFetch()
{
- mFetchItems->startFetch();
- mFetchDescendents->startFetch();
+ mFetchItems->startFetch();
+ mFetchDescendents->startFetch();
}
// See comment preceding LLInventoryAddedObserver::changed() for some
// concerns that also apply to this observer.
void LLInventoryAddItemByAssetObserver::changed(U32 mask)
{
- if(!(mask & LLInventoryObserver::ADD) ||
- !(mask & LLInventoryObserver::CREATE) ||
- !(mask & LLInventoryObserver::UPDATE_CREATE))
- {
- return;
- }
-
- // nothing is watched
- if (mWatchedAssets.size() == 0)
- {
- return;
- }
-
- const uuid_set_t& added = gInventory.getAddedIDs();
- for (uuid_set_t::iterator it = added.begin(); it != added.end(); ++it)
- {
- LLInventoryItem *item = gInventory.getItem(*it);
+ if(!(mask & LLInventoryObserver::ADD) ||
+ !(mask & LLInventoryObserver::CREATE) ||
+ !(mask & LLInventoryObserver::UPDATE_CREATE))
+ {
+ return;
+ }
+
+ // nothing is watched
+ if (mWatchedAssets.size() == 0)
+ {
+ return;
+ }
+
+ const uuid_set_t& added = gInventory.getAddedIDs();
+ for (uuid_set_t::iterator it = added.begin(); it != added.end(); ++it)
+ {
+ LLInventoryItem *item = gInventory.getItem(*it);
if (!item)
{
continue;
}
- const LLUUID& asset_uuid = item->getAssetUUID();
- if (item->getUUID().notNull() && asset_uuid.notNull())
- {
- if (isAssetWatched(asset_uuid))
- {
- LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL;
- mAddedItems.push_back(item->getUUID());
- }
- }
- }
-
- if (mAddedItems.size() == mWatchedAssets.size())
- {
- LL_DEBUGS("Inventory_Move") << "All watched items are added & processed." << LL_ENDL;
- done();
- mAddedItems.clear();
-
- // Unable to clean watched items here due to somebody can require to check them in current frame.
- // set dirty state to clean them while next watch cycle.
- mIsDirty = true;
- }
+ const LLUUID& asset_uuid = item->getAssetUUID();
+ if (item->getUUID().notNull() && asset_uuid.notNull())
+ {
+ if (isAssetWatched(asset_uuid))
+ {
+ LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL;
+ mAddedItems.push_back(item->getUUID());
+ }
+ }
+ }
+
+ if (mAddedItems.size() == mWatchedAssets.size())
+ {
+ LL_DEBUGS("Inventory_Move") << "All watched items are added & processed." << LL_ENDL;
+ done();
+ mAddedItems.clear();
+
+ // Unable to clean watched items here due to somebody can require to check them in current frame.
+ // set dirty state to clean them while next watch cycle.
+ mIsDirty = true;
+ }
}
void LLInventoryAddItemByAssetObserver::watchAsset(const LLUUID& asset_id)
{
- if(asset_id.notNull())
- {
- if (mIsDirty)
- {
- LL_DEBUGS("Inventory_Move") << "Watched items are dirty. Clean them." << LL_ENDL;
- mWatchedAssets.clear();
- mIsDirty = false;
- }
+ if(asset_id.notNull())
+ {
+ if (mIsDirty)
+ {
+ LL_DEBUGS("Inventory_Move") << "Watched items are dirty. Clean them." << LL_ENDL;
+ mWatchedAssets.clear();
+ mIsDirty = false;
+ }
- mWatchedAssets.push_back(asset_id);
- onAssetAdded(asset_id);
- }
+ mWatchedAssets.push_back(asset_id);
+ onAssetAdded(asset_id);
+ }
}
bool LLInventoryAddItemByAssetObserver::isAssetWatched( const LLUUID& asset_id )
{
- return std::find(mWatchedAssets.begin(), mWatchedAssets.end(), asset_id) != mWatchedAssets.end();
+ return std::find(mWatchedAssets.begin(), mWatchedAssets.end(), asset_id) != mWatchedAssets.end();
}
// This observer used to explicitly check for whether it was being
@@ -627,120 +627,120 @@ bool LLInventoryAddItemByAssetObserver::isAssetWatched( const LLUUID& asset_id )
// UpdateCreateInventoryItem and the other doesn't.
void LLInventoryAddedObserver::changed(U32 mask)
{
- if (!(mask & LLInventoryObserver::ADD) ||
- !(mask & LLInventoryObserver::CREATE) ||
- !(mask & LLInventoryObserver::UPDATE_CREATE))
- {
- return;
- }
+ if (!(mask & LLInventoryObserver::ADD) ||
+ !(mask & LLInventoryObserver::CREATE) ||
+ !(mask & LLInventoryObserver::UPDATE_CREATE))
+ {
+ return;
+ }
- if (!gInventory.getAddedIDs().empty())
- {
- done();
- }
+ if (!gInventory.getAddedIDs().empty())
+ {
+ done();
+ }
}
void LLInventoryCategoryAddedObserver::changed(U32 mask)
{
- if (!(mask & LLInventoryObserver::ADD))
- {
- return;
- }
-
- const LLInventoryModel::changed_items_t& added_ids = gInventory.getAddedIDs();
-
- for (LLInventoryModel::changed_items_t::const_iterator cit = added_ids.begin(); cit != added_ids.end(); ++cit)
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(*cit);
-
- if (cat)
- {
- mAddedCategories.push_back(cat);
- }
- }
-
- if (!mAddedCategories.empty())
- {
- done();
-
- mAddedCategories.clear();
- }
+ if (!(mask & LLInventoryObserver::ADD))
+ {
+ return;
+ }
+
+ const LLInventoryModel::changed_items_t& added_ids = gInventory.getAddedIDs();
+
+ for (LLInventoryModel::changed_items_t::const_iterator cit = added_ids.begin(); cit != added_ids.end(); ++cit)
+ {
+ LLViewerInventoryCategory* cat = gInventory.getCategory(*cit);
+
+ if (cat)
+ {
+ mAddedCategories.push_back(cat);
+ }
+ }
+
+ if (!mAddedCategories.empty())
+ {
+ done();
+
+ mAddedCategories.clear();
+ }
}
void LLInventoryCategoriesObserver::changed(U32 mask)
{
- if (!mCategoryMap.size())
- return;
+ if (!mCategoryMap.size())
+ return;
+
+ std::vector<LLUUID> deleted_categories_ids;
- std::vector<LLUUID> deleted_categories_ids;
+ for (category_map_t::iterator iter = mCategoryMap.begin();
+ iter != mCategoryMap.end();
+ ++iter)
+ {
+ const LLUUID& cat_id = (*iter).first;
+ LLCategoryData& cat_data = (*iter).second;
- for (category_map_t::iterator iter = mCategoryMap.begin();
- iter != mCategoryMap.end();
- ++iter)
- {
- const LLUUID& cat_id = (*iter).first;
- LLCategoryData& cat_data = (*iter).second;
-
- LLViewerInventoryCategory* category = gInventory.getCategory(cat_id);
- if (!category)
+ LLViewerInventoryCategory* category = gInventory.getCategory(cat_id);
+ if (!category)
{
LL_WARNS() << "Category : Category id = " << cat_id << " disappeared" << LL_ENDL;
- cat_data.mCallback();
+ cat_data.mCallback();
// Keep track of those deleted categories so we can remove them
deleted_categories_ids.push_back(cat_id);
- continue;
- }
-
- const S32 version = category->getVersion();
- const S32 expected_num_descendents = category->getDescendentCount();
- if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) ||
- (expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN))
- {
- continue;
- }
-
- // Check number of known descendents to find out whether it has changed.
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(cat_id, cats, items);
- if (!cats || !items)
- {
- LL_WARNS() << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << LL_ENDL;
- // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
- // that the cat just doesn't have any items or subfolders).
- // Unrecoverable, so just skip this category.
-
- llassert(cats != NULL && items != NULL);
-
- continue;
- }
-
- const S32 current_num_known_descendents = cats->size() + items->size();
-
- bool cat_changed = false;
-
- // If category version or descendents count has changed
- // update category data in mCategoryMap
- if (version != cat_data.mVersion || current_num_known_descendents != cat_data.mDescendentsCount)
- {
- cat_data.mVersion = version;
- cat_data.mDescendentsCount = current_num_known_descendents;
- cat_changed = true;
- }
-
- // If any item names have changed, update the name hash
- // Only need to check if (a) name hash has not previously been
- // computed, or (b) a name has changed.
- if (!cat_data.mIsNameHashInitialized || (mask & LLInventoryObserver::LABEL))
- {
- digest_t item_name_hash = gInventory.hashDirectDescendentNames(cat_id);
- if (cat_data.mItemNameHash != item_name_hash)
- {
- cat_data.mIsNameHashInitialized = true;
- cat_data.mItemNameHash = item_name_hash;
- cat_changed = true;
- }
- }
+ continue;
+ }
+
+ const S32 version = category->getVersion();
+ const S32 expected_num_descendents = category->getDescendentCount();
+ if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) ||
+ (expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN))
+ {
+ continue;
+ }
+
+ // Check number of known descendents to find out whether it has changed.
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ gInventory.getDirectDescendentsOf(cat_id, cats, items);
+ if (!cats || !items)
+ {
+ LL_WARNS() << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << LL_ENDL;
+ // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
+ // that the cat just doesn't have any items or subfolders).
+ // Unrecoverable, so just skip this category.
+
+ llassert(cats != NULL && items != NULL);
+
+ continue;
+ }
+
+ const S32 current_num_known_descendents = cats->size() + items->size();
+
+ bool cat_changed = false;
+
+ // If category version or descendents count has changed
+ // update category data in mCategoryMap
+ if (version != cat_data.mVersion || current_num_known_descendents != cat_data.mDescendentsCount)
+ {
+ cat_data.mVersion = version;
+ cat_data.mDescendentsCount = current_num_known_descendents;
+ cat_changed = true;
+ }
+
+ // If any item names have changed, update the name hash
+ // Only need to check if (a) name hash has not previously been
+ // computed, or (b) a name has changed.
+ if (!cat_data.mIsNameHashInitialized || (mask & LLInventoryObserver::LABEL))
+ {
+ digest_t item_name_hash = gInventory.hashDirectDescendentNames(cat_id);
+ if (cat_data.mItemNameHash != item_name_hash)
+ {
+ cat_data.mIsNameHashInitialized = true;
+ cat_data.mItemNameHash = item_name_hash;
+ cat_changed = true;
+ }
+ }
const LLUUID thumbnail_id = category->getThumbnailUUID();
if (cat_data.mThumbnailId != thumbnail_id)
@@ -749,118 +749,118 @@ void LLInventoryCategoriesObserver::changed(U32 mask)
cat_changed = true;
}
- // If anything has changed above, fire the callback.
- if (cat_changed)
- cat_data.mCallback();
- }
-
+ // If anything has changed above, fire the callback.
+ if (cat_changed)
+ cat_data.mCallback();
+ }
+
// Remove deleted categories from the list
- for (std::vector<LLUUID>::iterator deleted_id = deleted_categories_ids.begin(); deleted_id != deleted_categories_ids.end(); ++deleted_id)
- {
- removeCategory(*deleted_id);
+ for (std::vector<LLUUID>::iterator deleted_id = deleted_categories_ids.begin(); deleted_id != deleted_categories_ids.end(); ++deleted_id)
+ {
+ removeCategory(*deleted_id);
}
}
bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t cb, bool init_name_hash)
{
- S32 version = LLViewerInventoryCategory::VERSION_UNKNOWN;
- S32 current_num_known_descendents = LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN;
- bool can_be_added = true;
+ S32 version = LLViewerInventoryCategory::VERSION_UNKNOWN;
+ S32 current_num_known_descendents = LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN;
+ bool can_be_added = true;
LLUUID thumbnail_id;
- LLViewerInventoryCategory* category = gInventory.getCategory(cat_id);
- // If category could not be retrieved it might mean that
- // inventory is unusable at the moment so the category is
- // stored with VERSION_UNKNOWN and DESCENDENT_COUNT_UNKNOWN,
- // it may be updated later.
- if (category)
- {
- // Inventory category version is used to find out if some changes
- // to a category have been made.
- version = category->getVersion();
+ LLViewerInventoryCategory* category = gInventory.getCategory(cat_id);
+ // If category could not be retrieved it might mean that
+ // inventory is unusable at the moment so the category is
+ // stored with VERSION_UNKNOWN and DESCENDENT_COUNT_UNKNOWN,
+ // it may be updated later.
+ if (category)
+ {
+ // Inventory category version is used to find out if some changes
+ // to a category have been made.
+ version = category->getVersion();
thumbnail_id = category->getThumbnailUUID();
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(cat_id, cats, items);
- if (!cats || !items)
- {
- LL_WARNS() << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << LL_ENDL;
- // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
- // that the cat just doesn't have any items or subfolders).
- // Unrecoverable, so just return "false" meaning that the category can't be observed.
- can_be_added = false;
-
- llassert(cats != NULL && items != NULL);
- }
- else
- {
- current_num_known_descendents = cats->size() + items->size();
- }
- }
-
- if (can_be_added)
- {
- if(init_name_hash)
- {
- digest_t item_name_hash = gInventory.hashDirectDescendentNames(cat_id);
- mCategoryMap.insert(category_map_value_t(cat_id,LLCategoryData(cat_id, thumbnail_id, cb, version, current_num_known_descendents,item_name_hash)));
- }
- else
- {
- mCategoryMap.insert(category_map_value_t(cat_id,LLCategoryData(cat_id, thumbnail_id, cb, version, current_num_known_descendents)));
- }
- }
-
- return can_be_added;
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ gInventory.getDirectDescendentsOf(cat_id, cats, items);
+ if (!cats || !items)
+ {
+ LL_WARNS() << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << LL_ENDL;
+ // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
+ // that the cat just doesn't have any items or subfolders).
+ // Unrecoverable, so just return "false" meaning that the category can't be observed.
+ can_be_added = false;
+
+ llassert(cats != NULL && items != NULL);
+ }
+ else
+ {
+ current_num_known_descendents = cats->size() + items->size();
+ }
+ }
+
+ if (can_be_added)
+ {
+ if(init_name_hash)
+ {
+ digest_t item_name_hash = gInventory.hashDirectDescendentNames(cat_id);
+ mCategoryMap.insert(category_map_value_t(cat_id,LLCategoryData(cat_id, thumbnail_id, cb, version, current_num_known_descendents,item_name_hash)));
+ }
+ else
+ {
+ mCategoryMap.insert(category_map_value_t(cat_id,LLCategoryData(cat_id, thumbnail_id, cb, version, current_num_known_descendents)));
+ }
+ }
+
+ return can_be_added;
}
void LLInventoryCategoriesObserver::removeCategory(const LLUUID& cat_id)
{
- mCategoryMap.erase(cat_id);
+ mCategoryMap.erase(cat_id);
}
LLInventoryCategoriesObserver::LLCategoryData::LLCategoryData(
- const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents)
-
- : mCatID(cat_id)
- , mCallback(cb)
- , mVersion(version)
- , mDescendentsCount(num_descendents)
+ const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents)
+
+ : mCatID(cat_id)
+ , mCallback(cb)
+ , mVersion(version)
+ , mDescendentsCount(num_descendents)
, mThumbnailId(thumbnail_id)
- , mIsNameHashInitialized(false)
+ , mIsNameHashInitialized(false)
{
}
LLInventoryCategoriesObserver::LLCategoryData::LLCategoryData(
- const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents, const digest_t& name_hash)
+ const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents, const digest_t& name_hash)
- : mCatID(cat_id)
- , mCallback(cb)
- , mVersion(version)
- , mDescendentsCount(num_descendents)
+ : mCatID(cat_id)
+ , mCallback(cb)
+ , mVersion(version)
+ , mDescendentsCount(num_descendents)
, mThumbnailId(thumbnail_id)
- , mIsNameHashInitialized(true)
- , mItemNameHash(name_hash)
+ , mIsNameHashInitialized(true)
+ , mItemNameHash(name_hash)
{
}
void LLScrollOnRenameObserver::changed(U32 mask)
{
- if (mask & LLInventoryObserver::LABEL)
- {
- const uuid_set_t& changed_item_ids = gInventory.getChangedIDs();
- for (uuid_set_t::const_iterator it = changed_item_ids.begin(); it != changed_item_ids.end(); ++it)
- {
- const LLUUID& id = *it;
- if (id == mUUID)
- {
- mView->scrollToShowSelection();
-
- gInventory.removeObserver(this);
- delete this;
- return;
- }
- }
- }
+ if (mask & LLInventoryObserver::LABEL)
+ {
+ const uuid_set_t& changed_item_ids = gInventory.getChangedIDs();
+ for (uuid_set_t::const_iterator it = changed_item_ids.begin(); it != changed_item_ids.end(); ++it)
+ {
+ const LLUUID& id = *it;
+ if (id == mUUID)
+ {
+ mView->scrollToShowSelection();
+
+ gInventory.removeObserver(this);
+ delete this;
+ return;
+ }
+ }
+ }
}
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h
index bec08d2cdf..43bcf14d89 100644
--- a/indra/newview/llinventoryobserver.h
+++ b/indra/newview/llinventoryobserver.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llinventoryobserver.h
* @brief LLInventoryObserver class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,35 +36,35 @@ class LLViewerInventoryCategory;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInventoryObserver
//
-// A simple abstract base class that can relay messages when the inventory
+// A simple abstract base class that can relay messages when the inventory
// changes.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryObserver
{
public:
- // This enumeration is a way to refer to what changed in a more
- // human readable format. You can mask the value provided by
- // chaged() to see if the observer is interested in the change.
- enum
- {
- NONE = 0,
- LABEL = 1, // Name changed
- INTERNAL = 2, // Internal change (e.g. asset uuid different)
- ADD = 4, // Something added
- REMOVE = 8, // Something deleted
- STRUCTURE = 16, // Structural change (e.g. item or folder moved)
- CALLING_CARD = 32, // Calling card change (e.g. online, grant status, cancel)
- GESTURE = 64,
- REBUILD = 128, // Item UI changed (e.g. item type different)
- SORT = 256, // Folder needs to be resorted.
- CREATE = 512, // With ADD, item has just been created.
- // unfortunately a particular message is still associated with some unique semantics.
- UPDATE_CREATE = 1024, // With ADD, item added via UpdateCreateInventoryItem
- ALL = 0xffffffff
- };
- LLInventoryObserver();
- virtual ~LLInventoryObserver();
- virtual void changed(U32 mask) = 0;
+ // This enumeration is a way to refer to what changed in a more
+ // human readable format. You can mask the value provided by
+ // chaged() to see if the observer is interested in the change.
+ enum
+ {
+ NONE = 0,
+ LABEL = 1, // Name changed
+ INTERNAL = 2, // Internal change (e.g. asset uuid different)
+ ADD = 4, // Something added
+ REMOVE = 8, // Something deleted
+ STRUCTURE = 16, // Structural change (e.g. item or folder moved)
+ CALLING_CARD = 32, // Calling card change (e.g. online, grant status, cancel)
+ GESTURE = 64,
+ REBUILD = 128, // Item UI changed (e.g. item type different)
+ SORT = 256, // Folder needs to be resorted.
+ CREATE = 512, // With ADD, item has just been created.
+ // unfortunately a particular message is still associated with some unique semantics.
+ UPDATE_CREATE = 1024, // With ADD, item added via UpdateCreateInventoryItem
+ ALL = 0xffffffff
+ };
+ LLInventoryObserver();
+ virtual ~LLInventoryObserver();
+ virtual void changed(U32 mask) = 0;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -75,63 +75,63 @@ public:
class LLInventoryFetchObserver : public LLInventoryObserver
{
public:
- LLInventoryFetchObserver(const LLUUID& id = LLUUID::null); // single item
- LLInventoryFetchObserver(const uuid_vec_t& ids); // multiple items
- void setFetchID(const LLUUID& id);
- void setFetchIDs(const uuid_vec_t& ids);
+ LLInventoryFetchObserver(const LLUUID& id = LLUUID::null); // single item
+ LLInventoryFetchObserver(const uuid_vec_t& ids); // multiple items
+ void setFetchID(const LLUUID& id);
+ void setFetchIDs(const uuid_vec_t& ids);
- BOOL isFinished() const;
+ BOOL isFinished() const;
- virtual void startFetch() = 0;
- virtual void changed(U32 mask) = 0;
- virtual void done() {};
+ virtual void startFetch() = 0;
+ virtual void changed(U32 mask) = 0;
+ virtual void done() {};
protected:
- uuid_vec_t mComplete;
- uuid_vec_t mIncomplete;
- uuid_vec_t mIDs;
+ uuid_vec_t mComplete;
+ uuid_vec_t mIncomplete;
+ uuid_vec_t mIDs;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInventoryFetchItemsObserver
//
-// Fetches inventory items, calls done() when all inventory has arrived.
+// Fetches inventory items, calls done() when all inventory has arrived.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryFetchItemsObserver : public LLInventoryFetchObserver
{
public:
- LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null);
- LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids);
+ LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null);
+ LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids);
- /*virtual*/ void startFetch();
- /*virtual*/ void changed(U32 mask);
+ /*virtual*/ void startFetch();
+ /*virtual*/ void changed(U32 mask);
// For attempts to group requests if too many items are requested
static const S32 MAX_INDIVIDUAL_ITEM_REQUESTS;
private:
- LLTimer mFetchingPeriod;
+ LLTimer mFetchingPeriod;
- /**
- * Period of waiting a notification when requested items get added into inventory.
- */
- static const F32 FETCH_TIMER_EXPIRY;
+ /**
+ * Period of waiting a notification when requested items get added into inventory.
+ */
+ static const F32 FETCH_TIMER_EXPIRY;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInventoryFetchDescendentsObserver
//
-// Fetches children of a category/folder, calls done() when all
-// inventory has arrived.
+// Fetches children of a category/folder, calls done() when all
+// inventory has arrived.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryFetchDescendentsObserver : public LLInventoryFetchObserver
{
public:
- LLInventoryFetchDescendentsObserver(const LLUUID& cat_id = LLUUID::null);
- LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids);
+ LLInventoryFetchDescendentsObserver(const LLUUID& cat_id = LLUUID::null);
+ LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids);
- virtual void startFetch();
- /*virtual*/ void changed(U32 mask);
+ virtual void startFetch();
+ /*virtual*/ void changed(U32 mask);
protected:
- BOOL isCategoryComplete(const LLViewerInventoryCategory* cat) const;
+ BOOL isCategoryComplete(const LLViewerInventoryCategory* cat) const;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -144,16 +144,16 @@ protected:
class LLInventoryFetchComboObserver : public LLInventoryObserver
{
public:
- LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids,
- const uuid_vec_t& item_ids);
- ~LLInventoryFetchComboObserver();
- /*virtual*/ void changed(U32 mask);
- void startFetch();
+ LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids,
+ const uuid_vec_t& item_ids);
+ ~LLInventoryFetchComboObserver();
+ /*virtual*/ void changed(U32 mask);
+ void startFetch();
- virtual void done() = 0;
+ virtual void done() = 0;
protected:
- LLInventoryFetchItemsObserver *mFetchItems;
- LLInventoryFetchDescendentsObserver *mFetchDescendents;
+ LLInventoryFetchItemsObserver *mFetchItems;
+ LLInventoryFetchDescendentsObserver *mFetchDescendents;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -168,22 +168,22 @@ protected:
class LLInventoryAddItemByAssetObserver : public LLInventoryObserver
{
public:
- LLInventoryAddItemByAssetObserver() : mIsDirty(false) {}
- virtual void changed(U32 mask);
+ LLInventoryAddItemByAssetObserver() : mIsDirty(false) {}
+ virtual void changed(U32 mask);
- void watchAsset(const LLUUID& asset_id);
- bool isAssetWatched(const LLUUID& asset_id);
+ void watchAsset(const LLUUID& asset_id);
+ bool isAssetWatched(const LLUUID& asset_id);
protected:
- virtual void onAssetAdded(const LLUUID& asset_id) {}
- virtual void done() = 0;
+ virtual void onAssetAdded(const LLUUID& asset_id) {}
+ virtual void done() = 0;
- typedef std::vector<LLUUID> item_ref_t;
- item_ref_t mAddedItems;
- item_ref_t mWatchedAssets;
+ typedef std::vector<LLUUID> item_ref_t;
+ item_ref_t mAddedItems;
+ item_ref_t mWatchedAssets;
private:
- bool mIsDirty;
+ bool mIsDirty;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -195,11 +195,11 @@ private:
class LLInventoryAddedObserver : public LLInventoryObserver
{
public:
- LLInventoryAddedObserver() {}
- /*virtual*/ void changed(U32 mask);
+ LLInventoryAddedObserver() {}
+ /*virtual*/ void changed(U32 mask);
protected:
- virtual void done() = 0;
+ virtual void done() = 0;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -212,39 +212,39 @@ protected:
class LLInventoryCategoryAddedObserver : public LLInventoryObserver
{
public:
-
- typedef std::vector<LLViewerInventoryCategory*> cat_vec_t;
-
- LLInventoryCategoryAddedObserver() : mAddedCategories() {}
- /*virtual*/ void changed(U32 mask);
-
+
+ typedef std::vector<LLViewerInventoryCategory*> cat_vec_t;
+
+ LLInventoryCategoryAddedObserver() : mAddedCategories() {}
+ /*virtual*/ void changed(U32 mask);
+
protected:
- virtual void done() = 0;
-
- cat_vec_t mAddedCategories;
+ virtual void done() = 0;
+
+ cat_vec_t mAddedCategories;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInventoryCompletionObserver
//
-// Base class for doing something when when all observed items are locally
-// complete. Implements the changed() method of LLInventoryObserver
-// and declares a new method named done() which is called when all watched items
+// Base class for doing something when when all observed items are locally
+// complete. Implements the changed() method of LLInventoryObserver
+// and declares a new method named done() which is called when all watched items
// have complete information in the inventory model.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryCompletionObserver : public LLInventoryObserver
{
public:
- LLInventoryCompletionObserver() {}
- /*virtual*/ void changed(U32 mask);
+ LLInventoryCompletionObserver() {}
+ /*virtual*/ void changed(U32 mask);
- void watchItem(const LLUUID& id);
+ void watchItem(const LLUUID& id);
protected:
- virtual void done() = 0;
+ virtual void done() = 0;
- uuid_vec_t mComplete;
- uuid_vec_t mIncomplete;
+ uuid_vec_t mComplete;
+ uuid_vec_t mIncomplete;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -257,40 +257,40 @@ protected:
class LLInventoryCategoriesObserver : public LLInventoryObserver
{
public:
- typedef boost::function<void()> callback_t;
+ typedef boost::function<void()> callback_t;
- LLInventoryCategoriesObserver() {};
- virtual void changed(U32 mask);
+ LLInventoryCategoriesObserver() {};
+ virtual void changed(U32 mask);
- /**
- * Add cat_id to the list of observed categories with a
- * callback fired on category being changed.
- *
- * @return "true" if category was added, "false" if it could
- * not be found.
- */
- bool addCategory(const LLUUID& cat_id, callback_t cb, bool init_name_hash = false);
- void removeCategory(const LLUUID& cat_id);
+ /**
+ * Add cat_id to the list of observed categories with a
+ * callback fired on category being changed.
+ *
+ * @return "true" if category was added, "false" if it could
+ * not be found.
+ */
+ bool addCategory(const LLUUID& cat_id, callback_t cb, bool init_name_hash = false);
+ void removeCategory(const LLUUID& cat_id);
protected:
- typedef LLUUID digest_t; // To clarify the actual usage of this "UUID"
- struct LLCategoryData
- {
- LLCategoryData(const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents);
- LLCategoryData(const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents, const digest_t& name_hash);
- callback_t mCallback;
- S32 mVersion;
- S32 mDescendentsCount;
- digest_t mItemNameHash;
- bool mIsNameHashInitialized;
- LLUUID mCatID;
- LLUUID mThumbnailId;
- };
-
- typedef std::map<LLUUID, LLCategoryData> category_map_t;
- typedef category_map_t::value_type category_map_value_t;
-
- category_map_t mCategoryMap;
+ typedef LLUUID digest_t; // To clarify the actual usage of this "UUID"
+ struct LLCategoryData
+ {
+ LLCategoryData(const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents);
+ LLCategoryData(const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents, const digest_t& name_hash);
+ callback_t mCallback;
+ S32 mVersion;
+ S32 mDescendentsCount;
+ digest_t mItemNameHash;
+ bool mIsNameHashInitialized;
+ LLUUID mCatID;
+ LLUUID mThumbnailId;
+ };
+
+ typedef std::map<LLUUID, LLCategoryData> category_map_t;
+ typedef category_map_t::value_type category_map_value_t;
+
+ category_map_t mCategoryMap;
};
class LLFolderView;
@@ -299,15 +299,15 @@ class LLFolderView;
class LLScrollOnRenameObserver: public LLInventoryObserver
{
public:
- LLFolderView *mView;
- LLUUID mUUID;
-
- LLScrollOnRenameObserver(const LLUUID& uuid, LLFolderView *view):
- mUUID(uuid),
- mView(view)
- {
- }
- /* virtual */ void changed(U32 mask);
+ LLFolderView *mView;
+ LLUUID mUUID;
+
+ LLScrollOnRenameObserver(const LLUUID& uuid, LLFolderView *view):
+ mUUID(uuid),
+ mView(view)
+ {
+ }
+ /* virtual */ void changed(U32 mask);
};
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index ab04a8589a..4ac43ea6b2 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -1,25 +1,25 @@
-/*
+/*
* @file llinventorypanel.cpp
* @brief Implementation of the inventory panel and associated stuff.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,7 +67,7 @@ const std::string LLInventoryPanel::RECENTITEMS_SORT_ORDER = std::string("Recent
const std::string LLInventoryPanel::INHERIT_SORT_ORDER = std::string("");
static const LLInventoryFolderViewModelBuilder INVENTORY_BRIDGE_BUILDER;
-// statics
+// statics
bool LLInventoryPanel::sColorSetInitialized = false;
LLUIColor LLInventoryPanel::sDefaultColor;
LLUIColor LLInventoryPanel::sDefaultHighlightColor;
@@ -85,14 +85,14 @@ const LLColor4U DEFAULT_WHITE(255, 255, 255);
class LLInventoryPanelObserver : public LLInventoryObserver
{
public:
- LLInventoryPanelObserver(LLInventoryPanel* ip) : mIP(ip) {}
- virtual ~LLInventoryPanelObserver() {}
- virtual void changed(U32 mask)
- {
- mIP->modelChanged(mask);
- }
+ LLInventoryPanelObserver(LLInventoryPanel* ip) : mIP(ip) {}
+ virtual ~LLInventoryPanelObserver() {}
+ virtual void changed(U32 mask)
+ {
+ mIP->modelChanged(mask);
+ }
protected:
- LLInventoryPanel* mIP;
+ LLInventoryPanel* mIP;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -111,80 +111,80 @@ protected:
class LLInvPanelComplObserver : public LLInventoryCompletionObserver
{
public:
- typedef boost::function<void()> callback_t;
+ typedef boost::function<void()> callback_t;
- LLInvPanelComplObserver(callback_t cb)
- : mCallback(cb)
- {
- }
+ LLInvPanelComplObserver(callback_t cb)
+ : mCallback(cb)
+ {
+ }
- void reset();
+ void reset();
private:
- /*virtual*/ void done();
+ /*virtual*/ void done();
- /// Called when all the items are complete.
- callback_t mCallback;
+ /// Called when all the items are complete.
+ callback_t mCallback;
};
void LLInvPanelComplObserver::reset()
{
- mIncomplete.clear();
- mComplete.clear();
+ mIncomplete.clear();
+ mComplete.clear();
}
void LLInvPanelComplObserver::done()
{
- mCallback();
+ mCallback();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInventoryPanel
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
- LLPanel(p),
- mInventoryObserver(NULL),
- mCompletionObserver(NULL),
- mScroller(NULL),
- mSortOrderSetting(p.sort_order_setting),
- mInventory(p.inventory), //inventory("", &gInventory)
- mAcceptsDragAndDrop(p.accepts_drag_and_drop),
- mAllowMultiSelect(p.allow_multi_select),
- mAllowDrag(p.allow_drag),
- mShowItemLinkOverlays(p.show_item_link_overlays),
- mShowEmptyMessage(p.show_empty_message),
- mSuppressFolderMenu(p.suppress_folder_menu),
- mSuppressOpenItemAction(false),
- mBuildViewsOnInit(p.preinitialize_views),
- mViewsInitialized(VIEWS_UNINITIALIZED),
- mInvFVBridgeBuilder(NULL),
- mInventoryViewModel(p.name),
- mGroupedItemBridge(new LLFolderViewGroupedItemBridge),
- mFocusSelection(false),
+LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
+ LLPanel(p),
+ mInventoryObserver(NULL),
+ mCompletionObserver(NULL),
+ mScroller(NULL),
+ mSortOrderSetting(p.sort_order_setting),
+ mInventory(p.inventory), //inventory("", &gInventory)
+ mAcceptsDragAndDrop(p.accepts_drag_and_drop),
+ mAllowMultiSelect(p.allow_multi_select),
+ mAllowDrag(p.allow_drag),
+ mShowItemLinkOverlays(p.show_item_link_overlays),
+ mShowEmptyMessage(p.show_empty_message),
+ mSuppressFolderMenu(p.suppress_folder_menu),
+ mSuppressOpenItemAction(false),
+ mBuildViewsOnInit(p.preinitialize_views),
+ mViewsInitialized(VIEWS_UNINITIALIZED),
+ mInvFVBridgeBuilder(NULL),
+ mInventoryViewModel(p.name),
+ mGroupedItemBridge(new LLFolderViewGroupedItemBridge),
+ mFocusSelection(false),
mBuildChildrenViews(true),
mRootInited(false)
{
- mInvFVBridgeBuilder = &INVENTORY_BRIDGE_BUILDER;
-
- if (!sColorSetInitialized)
- {
- sDefaultColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE);
- sDefaultHighlightColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
- sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE);
- sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE);
- sColorSetInitialized = true;
- }
-
- // context menu callbacks
- mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryPanel::doToSelected, this, _2));
- mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
- mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND));
- mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLInventoryPanel::doCreate, this, _2));
- mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&LLInventoryPanel::attachObject, this, _2));
- mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this));
- mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this));
- mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryPanel::fileUploadLocation, this, _2));
+ mInvFVBridgeBuilder = &INVENTORY_BRIDGE_BUILDER;
+
+ if (!sColorSetInitialized)
+ {
+ sDefaultColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE);
+ sDefaultHighlightColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
+ sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE);
+ sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE);
+ sColorSetInitialized = true;
+ }
+
+ // context menu callbacks
+ mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryPanel::doToSelected, this, _2));
+ mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
+ mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND));
+ mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLInventoryPanel::doCreate, this, _2));
+ mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&LLInventoryPanel::attachObject, this, _2));
+ mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this));
+ mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this));
+ mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryPanel::fileUploadLocation, this, _2));
mCommitCallbackRegistrar.add("Inventory.OpenNewFolderWindow", boost::bind(&LLInventoryPanel::openSingleViewInventory, this, LLUUID()));
}
@@ -196,15 +196,15 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id )
p.rect = LLRect(0, 0, getRect().getWidth(), 0);
p.parent_panel = this;
p.tool_tip = p.name;
- p.listener = mInvFVBridgeBuilder->createBridge( LLAssetType::AT_CATEGORY,
- LLAssetType::AT_CATEGORY,
- LLInventoryType::IT_CATEGORY,
- this,
- &mInventoryViewModel,
- NULL,
- root_id);
+ p.listener = mInvFVBridgeBuilder->createBridge( LLAssetType::AT_CATEGORY,
+ LLAssetType::AT_CATEGORY,
+ LLInventoryType::IT_CATEGORY,
+ this,
+ &mInventoryViewModel,
+ NULL,
+ root_id);
p.view_model = &mInventoryViewModel;
- p.grouped_item_model = mGroupedItemBridge;
+ p.grouped_item_model = mGroupedItemBridge;
p.use_label_suffix = mParams.use_label_suffix;
p.allow_multiselect = mAllowMultiSelect;
p.allow_drag = mAllowDrag;
@@ -215,18 +215,18 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id )
p.allow_drop = mParams.allow_drop_on_root;
p.options_menu = "menu_inventory.xml";
- LLFolderView* fv = LLUICtrlFactory::create<LLFolderView>(p);
- fv->setCallbackRegistrar(&mCommitCallbackRegistrar);
- fv->setEnableRegistrar(&mEnableCallbackRegistrar);
+ LLFolderView* fv = LLUICtrlFactory::create<LLFolderView>(p);
+ fv->setCallbackRegistrar(&mCommitCallbackRegistrar);
+ fv->setEnableRegistrar(&mEnableCallbackRegistrar);
- return fv;
+ return fv;
}
void LLInventoryPanel::clearFolderRoot()
{
- gIdleCallbacks.deleteFunction(idle, this);
+ gIdleCallbacks.deleteFunction(idle, this);
gIdleCallbacks.deleteFunction(onIdle, this);
-
+
if (mInventoryObserver)
{
mInventory->removeObserver(mInventoryObserver);
@@ -239,7 +239,7 @@ void LLInventoryPanel::clearFolderRoot()
delete mCompletionObserver;
mCompletionObserver = NULL;
}
-
+
if (mScroller)
{
removeChild(mScroller);
@@ -250,23 +250,23 @@ void LLInventoryPanel::clearFolderRoot()
void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
{
- // save off copy of params
- mParams = params;
+ // save off copy of params
+ mParams = params;
initFolderRoot();
- // Initialize base class params.
- LLPanel::initFromParams(mParams);
+ // Initialize base class params.
+ LLPanel::initFromParams(mParams);
}
LLInventoryPanel::~LLInventoryPanel()
{
- U32 sort_order = getFolderViewModel()->getSorter().getSortOrder();
+ U32 sort_order = getFolderViewModel()->getSorter().getSortOrder();
if (mSortOrderSetting != INHERIT_SORT_ORDER)
{
gSavedSettings.setU32(mSortOrderSetting, sort_order);
}
-
+
clearFolderRoot();
}
@@ -288,13 +288,13 @@ void LLInventoryPanel::initFolderRoot()
LLFolderView* folder_view = createFolderRoot(root_id);
mFolderRoot = folder_view->getHandle();
mRootInited = true;
-
+
addItemID(root_id, mFolderRoot.get());
}
mCommitCallbackRegistrar.popScope();
mFolderRoot.get()->setCallbackRegistrar(&mCommitCallbackRegistrar);
mFolderRoot.get()->setEnableRegistrar(&mEnableCallbackRegistrar);
-
+
// Scroller
LLRect scroller_view_rect = getRect();
scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
@@ -343,13 +343,13 @@ void LLInventoryPanel::initFolderRoot()
{
getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_MARKETPLACE_LISTINGS));
}
-
+
// set the filter for the empty folder if the debug setting is on
if (gSavedSettings.getBOOL("DebugHideEmptySystemFolders"))
{
getFilter().setFilterEmptySystemFolders();
}
-
+
// keep track of the clipboard state so that we avoid filtering too much
mClipboardState = LLClipboard::instance().getGeneration();
}
@@ -392,30 +392,30 @@ void LLInventoryPanel::onVisibilityChange(BOOL new_visibility)
void LLInventoryPanel::draw()
{
- // Select the desired item (in case it wasn't loaded when the selection was requested)
- updateSelection();
-
- LLPanel::draw();
+ // Select the desired item (in case it wasn't loaded when the selection was requested)
+ updateSelection();
+
+ LLPanel::draw();
}
const LLInventoryFilter& LLInventoryPanel::getFilter() const
{
- return getFolderViewModel()->getFilter();
+ return getFolderViewModel()->getFilter();
}
LLInventoryFilter& LLInventoryPanel::getFilter()
{
- return getFolderViewModel()->getFilter();
+ return getFolderViewModel()->getFilter();
}
void LLInventoryPanel::setFilterTypes(U64 types, LLInventoryFilter::EFilterType filter_type)
{
- if (filter_type == LLInventoryFilter::FILTERTYPE_OBJECT)
- {
- getFilter().setFilterObjectTypes(types);
- }
- if (filter_type == LLInventoryFilter::FILTERTYPE_CATEGORY)
- getFilter().setFilterCategoryTypes(types);
+ if (filter_type == LLInventoryFilter::FILTERTYPE_OBJECT)
+ {
+ getFilter().setFilterObjectTypes(types);
+ }
+ if (filter_type == LLInventoryFilter::FILTERTYPE_CATEGORY)
+ getFilter().setFilterCategoryTypes(types);
}
void LLInventoryPanel::setFilterWorn()
@@ -423,25 +423,25 @@ void LLInventoryPanel::setFilterWorn()
getFilter().setFilterWorn();
}
-U32 LLInventoryPanel::getFilterObjectTypes() const
-{
- return getFilter().getFilterObjectTypes();
+U32 LLInventoryPanel::getFilterObjectTypes() const
+{
+ return getFilter().getFilterObjectTypes();
}
-U32 LLInventoryPanel::getFilterPermMask() const
-{
- return getFilter().getFilterPermissions();
+U32 LLInventoryPanel::getFilterPermMask() const
+{
+ return getFilter().getFilterPermissions();
}
void LLInventoryPanel::setFilterPermMask(PermissionMask filter_perm_mask)
{
- getFilter().setFilterPermissions(filter_perm_mask);
+ getFilter().setFilterPermissions(filter_perm_mask);
}
void LLInventoryPanel::setFilterWearableTypes(U64 types)
{
- getFilter().setFilterWearableTypes(types);
+ getFilter().setFilterWearableTypes(types);
}
void LLInventoryPanel::setFilterSettingsTypes(U64 filter)
@@ -451,87 +451,87 @@ void LLInventoryPanel::setFilterSettingsTypes(U64 filter)
void LLInventoryPanel::setFilterSubString(const std::string& string)
{
- getFilter().setFilterSubString(string);
+ getFilter().setFilterSubString(string);
}
-const std::string LLInventoryPanel::getFilterSubString()
-{
- return getFilter().getFilterSubString();
+const std::string LLInventoryPanel::getFilterSubString()
+{
+ return getFilter().getFilterSubString();
}
void LLInventoryPanel::setSortOrder(U32 order)
{
LLInventorySort sorter(order);
- if (order != getFolderViewModel()->getSorter().getSortOrder())
- {
- getFolderViewModel()->setSorter(sorter);
- mFolderRoot.get()->arrangeAll();
- // try to keep selection onscreen, even if it wasn't to start with
- mFolderRoot.get()->scrollToShowSelection();
- }
+ if (order != getFolderViewModel()->getSorter().getSortOrder())
+ {
+ getFolderViewModel()->setSorter(sorter);
+ mFolderRoot.get()->arrangeAll();
+ // try to keep selection onscreen, even if it wasn't to start with
+ mFolderRoot.get()->scrollToShowSelection();
+ }
}
-U32 LLInventoryPanel::getSortOrder() const
-{
- return getFolderViewModel()->getSorter().getSortOrder();
+U32 LLInventoryPanel::getSortOrder() const
+{
+ return getFolderViewModel()->getSorter().getSortOrder();
}
void LLInventoryPanel::setSinceLogoff(BOOL sl)
{
- getFilter().setDateRangeLastLogoff(sl);
+ getFilter().setDateRangeLastLogoff(sl);
}
void LLInventoryPanel::setHoursAgo(U32 hours)
{
- getFilter().setHoursAgo(hours);
+ getFilter().setHoursAgo(hours);
}
void LLInventoryPanel::setDateSearchDirection(U32 direction)
{
- getFilter().setDateSearchDirection(direction);
+ getFilter().setDateSearchDirection(direction);
}
void LLInventoryPanel::setFilterLinks(U64 filter_links)
{
- getFilter().setFilterLinks(filter_links);
+ getFilter().setFilterLinks(filter_links);
}
void LLInventoryPanel::setSearchType(LLInventoryFilter::ESearchType type)
{
- getFilter().setSearchType(type);
+ getFilter().setSearchType(type);
}
LLInventoryFilter::ESearchType LLInventoryPanel::getSearchType()
{
- return getFilter().getSearchType();
+ return getFilter().getSearchType();
}
void LLInventoryPanel::setShowFolderState(LLInventoryFilter::EFolderShow show)
{
- getFilter().setShowFolderState(show);
+ getFilter().setShowFolderState(show);
}
LLInventoryFilter::EFolderShow LLInventoryPanel::getShowFolderState()
{
- return getFilter().getShowFolderState();
+ return getFilter().getShowFolderState();
}
void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInventoryObject* model_item)
{
- LLFolderViewItem* view_item = getItemByID(item_id);
- LLFolderViewModelItemInventory* viewmodel_item =
- static_cast<LLFolderViewModelItemInventory*>(view_item ? view_item->getViewModelItem() : NULL);
+ LLFolderViewItem* view_item = getItemByID(item_id);
+ LLFolderViewModelItemInventory* viewmodel_item =
+ static_cast<LLFolderViewModelItemInventory*>(view_item ? view_item->getViewModelItem() : NULL);
- // LLFolderViewFolder is derived from LLFolderViewItem so dynamic_cast from item
- // to folder is the fast way to get a folder without searching through folders tree.
- LLFolderViewFolder* view_folder = NULL;
+ // LLFolderViewFolder is derived from LLFolderViewItem so dynamic_cast from item
+ // to folder is the fast way to get a folder without searching through folders tree.
+ LLFolderViewFolder* view_folder = NULL;
- // Check requires as this item might have already been deleted
- // as a child of its deleted parent.
- if (model_item && view_item)
- {
- view_folder = dynamic_cast<LLFolderViewFolder*>(view_item);
- }
+ // Check requires as this item might have already been deleted
+ // as a child of its deleted parent.
+ if (model_item && view_item)
+ {
+ view_folder = dynamic_cast<LLFolderViewFolder*>(view_item);
+ }
// if folder is not fully initialized (likely due to delayed load on idle)
// and we are not rebuilding, try updating children
@@ -546,41 +546,41 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
}
}
- //////////////////////////////
- // LABEL Operation
- // Empty out the display name for relabel.
- if (mask & LLInventoryObserver::LABEL)
- {
- if (view_item)
- {
- // Request refresh on this item (also flags for filtering)
- LLInvFVBridge* bridge = (LLInvFVBridge*)view_item->getViewModelItem();
- if(bridge)
- {
- // Clear the display name first, so it gets properly re-built during refresh()
- bridge->clearDisplayName();
-
- view_item->refresh();
- }
- LLFolderViewFolder* parent = view_item->getParentFolder();
- if(parent)
- {
- parent->getViewModelItem()->dirtyDescendantsFilter();
- }
- }
- }
-
- //////////////////////////////
- // REBUILD Operation
- // Destroy and regenerate the UI.
- if (mask & LLInventoryObserver::REBUILD)
- {
- if (model_item && view_item && viewmodel_item)
- {
- const LLUUID& idp = viewmodel_item->getUUID();
- view_item->destroyView();
- removeItemID(idp);
- }
+ //////////////////////////////
+ // LABEL Operation
+ // Empty out the display name for relabel.
+ if (mask & LLInventoryObserver::LABEL)
+ {
+ if (view_item)
+ {
+ // Request refresh on this item (also flags for filtering)
+ LLInvFVBridge* bridge = (LLInvFVBridge*)view_item->getViewModelItem();
+ if(bridge)
+ {
+ // Clear the display name first, so it gets properly re-built during refresh()
+ bridge->clearDisplayName();
+
+ view_item->refresh();
+ }
+ LLFolderViewFolder* parent = view_item->getParentFolder();
+ if(parent)
+ {
+ parent->getViewModelItem()->dirtyDescendantsFilter();
+ }
+ }
+ }
+
+ //////////////////////////////
+ // REBUILD Operation
+ // Destroy and regenerate the UI.
+ if (mask & LLInventoryObserver::REBUILD)
+ {
+ if (model_item && view_item && viewmodel_item)
+ {
+ const LLUUID& idp = viewmodel_item->getUUID();
+ view_item->destroyView();
+ removeItemID(idp);
+ }
LLInventoryObject const* objectp = mInventory->getObject(item_id);
if (objectp)
@@ -593,48 +593,48 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
view_item = NULL;
}
- viewmodel_item =
- static_cast<LLFolderViewModelItemInventory*>(view_item ? view_item->getViewModelItem() : NULL);
- view_folder = dynamic_cast<LLFolderViewFolder *>(view_item);
- }
-
- //////////////////////////////
- // INTERNAL Operation
- // This could be anything. For now, just refresh the item.
- if (mask & LLInventoryObserver::INTERNAL)
- {
- if (view_item)
- {
- view_item->refresh();
- }
- }
-
- //////////////////////////////
- // SORT Operation
- // Sort the folder.
- if (mask & LLInventoryObserver::SORT)
- {
- if (view_folder)
- {
- view_folder->getViewModelItem()->requestSort();
- }
- }
-
- // We don't typically care which of these masks the item is actually flagged with, since the masks
- // may not be accurate (e.g. in the main inventory panel, I move an item from My Inventory into
- // Landmarks; this is a STRUCTURE change for that panel but is an ADD change for the Landmarks
- // panel). What's relevant is that the item and UI are probably out of sync and thus need to be
- // resynchronized.
- if (mask & (LLInventoryObserver::STRUCTURE |
- LLInventoryObserver::ADD |
- LLInventoryObserver::REMOVE))
- {
- //////////////////////////////
- // ADD Operation
- // Item exists in memory but a UI element hasn't been created for it.
- if (model_item && !view_item)
- {
- // Add the UI element for this item.
+ viewmodel_item =
+ static_cast<LLFolderViewModelItemInventory*>(view_item ? view_item->getViewModelItem() : NULL);
+ view_folder = dynamic_cast<LLFolderViewFolder *>(view_item);
+ }
+
+ //////////////////////////////
+ // INTERNAL Operation
+ // This could be anything. For now, just refresh the item.
+ if (mask & LLInventoryObserver::INTERNAL)
+ {
+ if (view_item)
+ {
+ view_item->refresh();
+ }
+ }
+
+ //////////////////////////////
+ // SORT Operation
+ // Sort the folder.
+ if (mask & LLInventoryObserver::SORT)
+ {
+ if (view_folder)
+ {
+ view_folder->getViewModelItem()->requestSort();
+ }
+ }
+
+ // We don't typically care which of these masks the item is actually flagged with, since the masks
+ // may not be accurate (e.g. in the main inventory panel, I move an item from My Inventory into
+ // Landmarks; this is a STRUCTURE change for that panel but is an ADD change for the Landmarks
+ // panel). What's relevant is that the item and UI are probably out of sync and thus need to be
+ // resynchronized.
+ if (mask & (LLInventoryObserver::STRUCTURE |
+ LLInventoryObserver::ADD |
+ LLInventoryObserver::REMOVE))
+ {
+ //////////////////////////////
+ // ADD Operation
+ // Item exists in memory but a UI element hasn't been created for it.
+ if (model_item && !view_item)
+ {
+ // Add the UI element for this item.
LLInventoryObject const* objectp = mInventory->getObject(item_id);
if (objectp)
{
@@ -642,82 +642,82 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
buildNewViews(item_id, objectp, NULL, BUILD_ONE_FOLDER);
}
- // Select any newly created object that has the auto rename at top of folder root set.
- if(mFolderRoot.get()->getRoot()->needsAutoRename())
- {
- setSelection(item_id, FALSE);
- }
- updateFolderLabel(model_item->getParentUUID());
- }
-
- //////////////////////////////
- // STRUCTURE Operation
- // This item already exists in both memory and UI. It was probably reparented.
- else if (model_item && view_item)
- {
- LLFolderViewFolder* old_parent = view_item->getParentFolder();
- // Don't process the item if it is the root
- if (old_parent)
- {
- LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent->getViewModelItem());
- LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID());
- // Item has been moved.
- if (old_parent != new_parent)
- {
- if (new_parent != NULL)
- {
- // Item is to be moved and we found its new parent in the panel's directory, so move the item's UI.
- view_item->addToFolder(new_parent);
- addItemID(viewmodel_item->getUUID(), view_item);
- if (mInventory)
- {
- const LLUUID trash_id = mInventory->findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if (trash_id != model_item->getParentUUID() && (mask & LLInventoryObserver::INTERNAL) && new_parent->isOpen())
- {
- setSelection(item_id, FALSE);
- }
- }
- updateFolderLabel(model_item->getParentUUID());
- }
- else
- {
- // Remove the item ID before destroying the view because the view-model-item gets
- // destroyed when the view is destroyed
- removeItemID(viewmodel_item->getUUID());
-
- // Item is to be moved outside the panel's directory (e.g. moved to trash for a panel that
- // doesn't include trash). Just remove the item's UI.
- view_item->destroyView();
- }
- if(viewmodel_folder)
- {
- updateFolderLabel(viewmodel_folder->getUUID());
- }
- old_parent->getViewModelItem()->dirtyDescendantsFilter();
- }
- }
- }
-
- //////////////////////////////
- // REMOVE Operation
- // This item has been removed from memory, but its associated UI element still exists.
- else if (!model_item && view_item && viewmodel_item)
- {
- // Remove the item's UI.
- LLFolderViewFolder* parent = view_item->getParentFolder();
- removeItemID(viewmodel_item->getUUID());
- view_item->destroyView();
- if(parent)
- {
- parent->getViewModelItem()->dirtyDescendantsFilter();
- LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent->getViewModelItem());
- if(viewmodel_folder)
- {
- updateFolderLabel(viewmodel_folder->getUUID());
- }
- }
- }
- }
+ // Select any newly created object that has the auto rename at top of folder root set.
+ if(mFolderRoot.get()->getRoot()->needsAutoRename())
+ {
+ setSelection(item_id, FALSE);
+ }
+ updateFolderLabel(model_item->getParentUUID());
+ }
+
+ //////////////////////////////
+ // STRUCTURE Operation
+ // This item already exists in both memory and UI. It was probably reparented.
+ else if (model_item && view_item)
+ {
+ LLFolderViewFolder* old_parent = view_item->getParentFolder();
+ // Don't process the item if it is the root
+ if (old_parent)
+ {
+ LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent->getViewModelItem());
+ LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID());
+ // Item has been moved.
+ if (old_parent != new_parent)
+ {
+ if (new_parent != NULL)
+ {
+ // Item is to be moved and we found its new parent in the panel's directory, so move the item's UI.
+ view_item->addToFolder(new_parent);
+ addItemID(viewmodel_item->getUUID(), view_item);
+ if (mInventory)
+ {
+ const LLUUID trash_id = mInventory->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if (trash_id != model_item->getParentUUID() && (mask & LLInventoryObserver::INTERNAL) && new_parent->isOpen())
+ {
+ setSelection(item_id, FALSE);
+ }
+ }
+ updateFolderLabel(model_item->getParentUUID());
+ }
+ else
+ {
+ // Remove the item ID before destroying the view because the view-model-item gets
+ // destroyed when the view is destroyed
+ removeItemID(viewmodel_item->getUUID());
+
+ // Item is to be moved outside the panel's directory (e.g. moved to trash for a panel that
+ // doesn't include trash). Just remove the item's UI.
+ view_item->destroyView();
+ }
+ if(viewmodel_folder)
+ {
+ updateFolderLabel(viewmodel_folder->getUUID());
+ }
+ old_parent->getViewModelItem()->dirtyDescendantsFilter();
+ }
+ }
+ }
+
+ //////////////////////////////
+ // REMOVE Operation
+ // This item has been removed from memory, but its associated UI element still exists.
+ else if (!model_item && view_item && viewmodel_item)
+ {
+ // Remove the item's UI.
+ LLFolderViewFolder* parent = view_item->getParentFolder();
+ removeItemID(viewmodel_item->getUUID());
+ view_item->destroyView();
+ if(parent)
+ {
+ parent->getViewModelItem()->dirtyDescendantsFilter();
+ LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent->getViewModelItem());
+ if(viewmodel_folder)
+ {
+ updateFolderLabel(viewmodel_folder->getUUID());
+ }
+ }
+ }
+ }
}
// Called when something changed in the global model (new item, item coming through the wire, rename, move, etc...) (CHUI-849)
@@ -725,110 +725,110 @@ void LLInventoryPanel::modelChanged(U32 mask)
{
LL_PROFILE_ZONE_SCOPED;
- if (mViewsInitialized != VIEWS_INITIALIZED) return;
-
- const LLInventoryModel* model = getModel();
- if (!model) return;
+ if (mViewsInitialized != VIEWS_INITIALIZED) return;
+
+ const LLInventoryModel* model = getModel();
+ if (!model) return;
- const LLInventoryModel::changed_items_t& changed_items = model->getChangedIDs();
- if (changed_items.empty()) return;
+ const LLInventoryModel::changed_items_t& changed_items = model->getChangedIDs();
+ if (changed_items.empty()) return;
- for (LLInventoryModel::changed_items_t::const_iterator items_iter = changed_items.begin();
- items_iter != changed_items.end();
- ++items_iter)
- {
- const LLUUID& item_id = (*items_iter);
- const LLInventoryObject* model_item = model->getObject(item_id);
- itemChanged(item_id, mask, model_item);
- }
+ for (LLInventoryModel::changed_items_t::const_iterator items_iter = changed_items.begin();
+ items_iter != changed_items.end();
+ ++items_iter)
+ {
+ const LLUUID& item_id = (*items_iter);
+ const LLInventoryObject* model_item = model->getObject(item_id);
+ itemChanged(item_id, mask, model_item);
+ }
}
LLUUID LLInventoryPanel::getRootFolderID()
{
LLUUID root_id;
- if (mFolderRoot.get() && mFolderRoot.get()->getViewModelItem())
- {
- root_id = static_cast<LLFolderViewModelItemInventory*>(mFolderRoot.get()->getViewModelItem())->getUUID();
- }
- else
- {
- if (mParams.start_folder.id.isChosen())
- {
- root_id = mParams.start_folder.id;
- }
- else
- {
- const LLFolderType::EType preferred_type = mParams.start_folder.type.isChosen()
- ? mParams.start_folder.type
- : LLViewerFolderType::lookupTypeFromNewCategoryName(mParams.start_folder.name);
-
- if ("LIBRARY" == mParams.start_folder.name())
- {
- root_id = gInventory.getLibraryRootFolderID();
- }
- else if (preferred_type != LLFolderType::FT_NONE)
- {
+ if (mFolderRoot.get() && mFolderRoot.get()->getViewModelItem())
+ {
+ root_id = static_cast<LLFolderViewModelItemInventory*>(mFolderRoot.get()->getViewModelItem())->getUUID();
+ }
+ else
+ {
+ if (mParams.start_folder.id.isChosen())
+ {
+ root_id = mParams.start_folder.id;
+ }
+ else
+ {
+ const LLFolderType::EType preferred_type = mParams.start_folder.type.isChosen()
+ ? mParams.start_folder.type
+ : LLViewerFolderType::lookupTypeFromNewCategoryName(mParams.start_folder.name);
+
+ if ("LIBRARY" == mParams.start_folder.name())
+ {
+ root_id = gInventory.getLibraryRootFolderID();
+ }
+ else if (preferred_type != LLFolderType::FT_NONE)
+ {
LLStringExplicit label(mParams.start_folder.name());
setLabel(label);
-
- root_id = gInventory.findCategoryUUIDForType(preferred_type);
- if (root_id.isNull())
- {
- LL_WARNS() << "Could not find folder of type " << preferred_type << LL_ENDL;
- root_id.generateNewID();
- }
- }
- }
- }
+
+ root_id = gInventory.findCategoryUUIDForType(preferred_type);
+ if (root_id.isNull())
+ {
+ LL_WARNS() << "Could not find folder of type " << preferred_type << LL_ENDL;
+ root_id.generateNewID();
+ }
+ }
+ }
+ }
return root_id;
}
// static
void LLInventoryPanel::onIdle(void *userdata)
{
- if (!gInventory.isInventoryUsable())
- return;
+ if (!gInventory.isInventoryUsable())
+ return;
- LLInventoryPanel *self = (LLInventoryPanel*)userdata;
- if (self->mViewsInitialized <= VIEWS_INITIALIZING)
- {
- const F64 max_time = 0.001f; // 1 ms, in this case we need only root folders
- self->initializeViews(max_time); // Shedules LLInventoryPanel::idle()
- }
- if (self->mViewsInitialized >= VIEWS_BUILDING)
- {
- gIdleCallbacks.deleteFunction(onIdle, (void*)self);
- }
+ LLInventoryPanel *self = (LLInventoryPanel*)userdata;
+ if (self->mViewsInitialized <= VIEWS_INITIALIZING)
+ {
+ const F64 max_time = 0.001f; // 1 ms, in this case we need only root folders
+ self->initializeViews(max_time); // Shedules LLInventoryPanel::idle()
+ }
+ if (self->mViewsInitialized >= VIEWS_BUILDING)
+ {
+ gIdleCallbacks.deleteFunction(onIdle, (void*)self);
+ }
}
struct DirtyFilterFunctor : public LLFolderViewFunctor
{
- /*virtual*/ void doFolder(LLFolderViewFolder* folder)
- {
- folder->getViewModelItem()->dirtyFilter();
- }
- /*virtual*/ void doItem(LLFolderViewItem* item)
- {
- item->getViewModelItem()->dirtyFilter();
- }
+ /*virtual*/ void doFolder(LLFolderViewFolder* folder)
+ {
+ folder->getViewModelItem()->dirtyFilter();
+ }
+ /*virtual*/ void doItem(LLFolderViewItem* item)
+ {
+ item->getViewModelItem()->dirtyFilter();
+ }
};
void LLInventoryPanel::idle(void* user_data)
{
- LLInventoryPanel* panel = (LLInventoryPanel*)user_data;
- // Nudge the filter if the clipboard state changed
- if (panel->mClipboardState != LLClipboard::instance().getGeneration())
- {
- panel->mClipboardState = LLClipboard::instance().getGeneration();
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- LLFolderViewFolder* trash_folder = panel->getFolderByID(trash_id);
- if (trash_folder)
- {
+ LLInventoryPanel* panel = (LLInventoryPanel*)user_data;
+ // Nudge the filter if the clipboard state changed
+ if (panel->mClipboardState != LLClipboard::instance().getGeneration())
+ {
+ panel->mClipboardState = LLClipboard::instance().getGeneration();
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLFolderViewFolder* trash_folder = panel->getFolderByID(trash_id);
+ if (trash_folder)
+ {
DirtyFilterFunctor dirtyFilterFunctor;
- trash_folder->applyFunctorToChildren(dirtyFilterFunctor);
- }
+ trash_folder->applyFunctorToChildren(dirtyFilterFunctor);
+ }
- }
+ }
bool in_visible_chain = panel->isInVisibleChain();
@@ -905,7 +905,7 @@ void LLInventoryPanel::idle(void* user_data)
void LLInventoryPanel::initializeViews(F64 max_time)
{
- if (!gInventory.isInventoryUsable()) return;
+ if (!gInventory.isInventoryUsable()) return;
if (!mRootInited) return;
mViewsInitialized = VIEWS_BUILDING;
@@ -913,83 +913,83 @@ void LLInventoryPanel::initializeViews(F64 max_time)
F64 curent_time = LLTimer::getTotalSeconds();
mBuildViewsEndTime = curent_time + max_time;
- // init everything
- LLUUID root_id = getRootFolderID();
- if (root_id.notNull())
- {
- buildNewViews(getRootFolderID());
- }
- else
- {
- // Default case: always add "My Inventory" root first, "Library" root second
- // If we run out of time, this still should create root folders
- buildNewViews(gInventory.getRootFolderID()); // My Inventory
- buildNewViews(gInventory.getLibraryRootFolderID()); // Library
- }
+ // init everything
+ LLUUID root_id = getRootFolderID();
+ if (root_id.notNull())
+ {
+ buildNewViews(getRootFolderID());
+ }
+ else
+ {
+ // Default case: always add "My Inventory" root first, "Library" root second
+ // If we run out of time, this still should create root folders
+ buildNewViews(gInventory.getRootFolderID()); // My Inventory
+ buildNewViews(gInventory.getLibraryRootFolderID()); // Library
+ }
if (mBuildViewsQueue.empty())
{
mViewsInitialized = VIEWS_INITIALIZED;
}
- gIdleCallbacks.addFunction(idle, this);
-
+ gIdleCallbacks.addFunction(idle, this);
+
if(mParams.open_first_folder)
{
openStartFolderOrMyInventory();
}
-
- // Special case for new user login
- if (gAgent.isFirstLogin())
- {
- // Auto open the user's library
- LLFolderViewFolder* lib_folder = getFolderByID(gInventory.getLibraryRootFolderID());
- if (lib_folder)
- {
- lib_folder->setOpen(TRUE);
- }
-
- // Auto close the user's my inventory folder
- LLFolderViewFolder* my_inv_folder = getFolderByID(gInventory.getRootFolderID());
- if (my_inv_folder)
- {
- my_inv_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN);
- }
- }
+
+ // Special case for new user login
+ if (gAgent.isFirstLogin())
+ {
+ // Auto open the user's library
+ LLFolderViewFolder* lib_folder = getFolderByID(gInventory.getLibraryRootFolderID());
+ if (lib_folder)
+ {
+ lib_folder->setOpen(TRUE);
+ }
+
+ // Auto close the user's my inventory folder
+ LLFolderViewFolder* my_inv_folder = getFolderByID(gInventory.getRootFolderID());
+ if (my_inv_folder)
+ {
+ my_inv_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN);
+ }
+ }
}
LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop)
{
- LLFolderViewFolder::Params params(mParams.folder);
+ LLFolderViewFolder::Params params(mParams.folder);
- params.name = bridge->getDisplayName();
- params.root = mFolderRoot.get();
- params.listener = bridge;
- params.tool_tip = params.name;
+ params.name = bridge->getDisplayName();
+ params.root = mFolderRoot.get();
+ params.listener = bridge;
+ params.tool_tip = params.name;
params.allow_drop = allow_drop;
- params.font_color = (bridge->isLibraryItem() ? sLibraryColor : sDefaultColor);
- params.font_highlight_color = (bridge->isLibraryItem() ? sLibraryColor : sDefaultHighlightColor);
-
- return LLUICtrlFactory::create<LLFolderViewFolder>(params);
+ params.font_color = (bridge->isLibraryItem() ? sLibraryColor : sDefaultColor);
+ params.font_highlight_color = (bridge->isLibraryItem() ? sLibraryColor : sDefaultHighlightColor);
+
+ return LLUICtrlFactory::create<LLFolderViewFolder>(params);
}
LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge)
{
- LLFolderViewItem::Params params(mParams.item);
-
- params.name = bridge->getDisplayName();
- params.creation_date = bridge->getCreationDate();
- params.root = mFolderRoot.get();
- params.listener = bridge;
- params.rect = LLRect (0, 0, 0, 0);
- params.tool_tip = params.name;
+ LLFolderViewItem::Params params(mParams.item);
+
+ params.name = bridge->getDisplayName();
+ params.creation_date = bridge->getCreationDate();
+ params.root = mFolderRoot.get();
+ params.listener = bridge;
+ params.rect = LLRect (0, 0, 0, 0);
+ params.tool_tip = params.name;
+
+ params.font_color = (bridge->isLibraryItem() ? sLibraryColor : sDefaultColor);
+ params.font_highlight_color = (bridge->isLibraryItem() ? sLibraryColor : sDefaultHighlightColor);
- params.font_color = (bridge->isLibraryItem() ? sLibraryColor : sDefaultColor);
- params.font_highlight_color = (bridge->isLibraryItem() ? sLibraryColor : sDefaultHighlightColor);
-
- return LLUICtrlFactory::create<LLFolderViewItem>(params);
+ return LLUICtrlFactory::create<LLFolderViewItem>(params);
}
LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
@@ -1064,88 +1064,88 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
}
}
- if (!folder_view_item && parent_folder)
- {
- if (objectp->getType() <= LLAssetType::AT_NONE)
- {
- LL_WARNS() << "LLInventoryPanel::buildViewsTree called with invalid objectp->mType : "
- << ((S32)objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
- << LL_ENDL;
- return NULL;
- }
-
- if (objectp->getType() >= LLAssetType::AT_COUNT)
- {
- // Example: Happens when we add assets of new, not yet supported type to library
- LL_DEBUGS("Inventory") << "LLInventoryPanel::buildViewsTree called with unknown objectp->mType : "
- << ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
- << LL_ENDL;
-
- LLInventoryItem* item = (LLInventoryItem*)objectp;
- if (item)
- {
- LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_UNKNOWN,
- LLAssetType::AT_UNKNOWN,
- LLInventoryType::IT_UNKNOWN,
- this,
- &mInventoryViewModel,
- mFolderRoot.get(),
- item->getUUID(),
- item->getFlags());
-
- if (new_listener)
- {
- folder_view_item = createFolderViewItem(new_listener);
- }
- }
- }
-
- if ((objectp->getType() == LLAssetType::AT_CATEGORY) &&
- (objectp->getActualType() != LLAssetType::AT_LINK_FOLDER))
- {
- LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_CATEGORY,
+ if (!folder_view_item && parent_folder)
+ {
+ if (objectp->getType() <= LLAssetType::AT_NONE)
+ {
+ LL_WARNS() << "LLInventoryPanel::buildViewsTree called with invalid objectp->mType : "
+ << ((S32)objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
+ << LL_ENDL;
+ return NULL;
+ }
+
+ if (objectp->getType() >= LLAssetType::AT_COUNT)
+ {
+ // Example: Happens when we add assets of new, not yet supported type to library
+ LL_DEBUGS("Inventory") << "LLInventoryPanel::buildViewsTree called with unknown objectp->mType : "
+ << ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
+ << LL_ENDL;
+
+ LLInventoryItem* item = (LLInventoryItem*)objectp;
+ if (item)
+ {
+ LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_UNKNOWN,
+ LLAssetType::AT_UNKNOWN,
+ LLInventoryType::IT_UNKNOWN,
+ this,
+ &mInventoryViewModel,
+ mFolderRoot.get(),
+ item->getUUID(),
+ item->getFlags());
+
+ if (new_listener)
+ {
+ folder_view_item = createFolderViewItem(new_listener);
+ }
+ }
+ }
+
+ if ((objectp->getType() == LLAssetType::AT_CATEGORY) &&
+ (objectp->getActualType() != LLAssetType::AT_LINK_FOLDER))
+ {
+ LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_CATEGORY,
(mParams.use_marketplace_folders ? LLAssetType::AT_MARKETPLACE_FOLDER : LLAssetType::AT_CATEGORY),
- LLInventoryType::IT_CATEGORY,
- this,
+ LLInventoryType::IT_CATEGORY,
+ this,
&mInventoryViewModel,
- mFolderRoot.get(),
- objectp->getUUID());
- if (new_listener)
- {
+ mFolderRoot.get(),
+ objectp->getUUID());
+ if (new_listener)
+ {
folder_view_item = createFolderViewFolder(new_listener,allow_drop);
- }
- }
- else
- {
- // Build new view for item.
- LLInventoryItem* item = (LLInventoryItem*)objectp;
- LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(item->getType(),
- item->getActualType(),
- item->getInventoryType(),
- this,
- &mInventoryViewModel,
- mFolderRoot.get(),
- item->getUUID(),
- item->getFlags());
-
- if (new_listener)
- {
- folder_view_item = createFolderViewItem(new_listener);
- }
- }
-
- if (folder_view_item)
+ }
+ }
+ else
+ {
+ // Build new view for item.
+ LLInventoryItem* item = (LLInventoryItem*)objectp;
+ LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(item->getType(),
+ item->getActualType(),
+ item->getInventoryType(),
+ this,
+ &mInventoryViewModel,
+ mFolderRoot.get(),
+ item->getUUID(),
+ item->getFlags());
+
+ if (new_listener)
+ {
+ folder_view_item = createFolderViewItem(new_listener);
+ }
+ }
+
+ if (folder_view_item)
{
llassert(parent_folder != NULL);
folder_view_item->addToFolder(parent_folder);
- addItemID(id, folder_view_item);
+ addItemID(id, folder_view_item);
// In the case of the root folder been shown, open that folder by default once the widget is created
if (create_root)
{
folder_view_item->setOpen(TRUE);
}
}
- }
+ }
bool create_children = folder_view_item && objectp->getType() == LLAssetType::AT_CATEGORY
&& (mBuildChildrenViews || depth == 0);
@@ -1209,13 +1209,13 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
}
}
- // If this is a folder, add the children of the folder and recursively add any
- // child folders.
- if (create_children)
- {
- LLViewerInventoryCategory::cat_array_t* categories;
- LLViewerInventoryItem::item_array_t* items;
- mInventory->lockDirectDescendentArrays(id, categories, items);
+ // If this is a folder, add the children of the folder and recursively add any
+ // child folders.
+ if (create_children)
+ {
+ LLViewerInventoryCategory::cat_array_t* categories;
+ LLViewerInventoryItem::item_array_t* items;
+ mInventory->lockDirectDescendentArrays(id, categories, items);
// Make sure panel won't lock in a loop over existing items if
// folder is enormous and at least some work gets done
@@ -1225,15 +1225,15 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
LLFolderViewFolder *parentp = dynamic_cast<LLFolderViewFolder*>(folder_view_item);
bool done = true;
- if(categories)
+ if(categories)
{
bool has_folders = parentp->getFoldersCount() > 0;
- for (LLViewerInventoryCategory::cat_array_t::const_iterator cat_iter = categories->begin();
- cat_iter != categories->end();
- ++cat_iter)
- {
- const LLViewerInventoryCategory* cat = (*cat_iter);
- if (typedViewsFilter(cat->getUUID(), cat))
+ for (LLViewerInventoryCategory::cat_array_t::const_iterator cat_iter = categories->begin();
+ cat_iter != categories->end();
+ ++cat_iter)
+ {
+ const LLViewerInventoryCategory* cat = (*cat_iter);
+ if (typedViewsFilter(cat->getUUID(), cat))
{
if (has_folders)
{
@@ -1254,7 +1254,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
&& MIN_ITEMS_PER_CALL + starting_item_count < mItemMap.size())
{
// Single folder view, check if we still have time
- //
+ //
// Todo: make sure this causes no dupplciates, breaks nothing,
// especially filters and arrange
F64 curent_time = LLTimer::getTotalSeconds();
@@ -1265,17 +1265,17 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
break;
}
}
- }
- }
-
- if(items)
- {
- for (LLViewerInventoryItem::item_array_t::const_iterator item_iter = items->begin();
- item_iter != items->end();
- ++item_iter)
- {
+ }
+ }
+
+ if(items)
+ {
+ for (LLViewerInventoryItem::item_array_t::const_iterator item_iter = items->begin();
+ item_iter != items->end();
+ ++item_iter)
+ {
// At the moment we have to build folder's items in bulk and ignore mBuildViewsEndTime
- const LLViewerInventoryItem* item = (*item_iter);
+ const LLViewerInventoryItem* item = (*item_iter);
if (typedViewsFilter(item->getUUID(), item))
{
// This can be optimized: we don't need to call getItemByID()
@@ -1290,7 +1290,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
&& MIN_ITEMS_PER_CALL + starting_item_count < mItemMap.size())
{
// Single folder view, check if we still have time
- //
+ //
// Todo: make sure this causes no dupplciates, breaks nothing,
// especially filters and arrange
F64 curent_time = LLTimer::getTotalSeconds();
@@ -1301,84 +1301,84 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
break;
}
}
- }
- }
+ }
+ }
if (!mBuildChildrenViews && done)
{
// flat list is done initializing folder
folder_view_item->setChildrenInited(true);
}
- mInventory->unlockDirectDescendentArrays(id);
- }
-
- return folder_view_item;
+ mInventory->unlockDirectDescendentArrays(id);
+ }
+
+ return folder_view_item;
}
// bit of a hack to make sure the inventory is open.
void LLInventoryPanel::openStartFolderOrMyInventory()
{
- // Find My Inventory folder and open it up by name
- for (LLView *child = mFolderRoot.get()->getFirstChild(); child; child = mFolderRoot.get()->findNextSibling(child))
- {
- LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child);
- if (fchild
- && fchild->getViewModelItem()
- && fchild->getViewModelItem()->getName() == "My Inventory")
- {
- fchild->setOpen(TRUE);
- break;
- }
- }
+ // Find My Inventory folder and open it up by name
+ for (LLView *child = mFolderRoot.get()->getFirstChild(); child; child = mFolderRoot.get()->findNextSibling(child))
+ {
+ LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child);
+ if (fchild
+ && fchild->getViewModelItem()
+ && fchild->getViewModelItem()->getName() == "My Inventory")
+ {
+ fchild->setOpen(TRUE);
+ break;
+ }
+ }
}
void LLInventoryPanel::onItemsCompletion()
{
- if (mFolderRoot.get()) mFolderRoot.get()->updateMenu();
+ if (mFolderRoot.get()) mFolderRoot.get()->updateMenu();
}
void LLInventoryPanel::openSelected()
{
- LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem();
- if(!folder_item) return;
- LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
- if(!bridge) return;
- bridge->openItem();
+ LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem();
+ if(!folder_item) return;
+ LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
+ if(!bridge) return;
+ bridge->openItem();
}
-void LLInventoryPanel::unSelectAll()
-{
- mFolderRoot.get()->setSelection(NULL, FALSE, FALSE);
+void LLInventoryPanel::unSelectAll()
+{
+ mFolderRoot.get()->setSelection(NULL, FALSE, FALSE);
}
BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLView::handleHover(x, y, mask);
- if(handled)
+ BOOL handled = LLView::handleHover(x, y, mask);
+ if(handled)
{
// getCursor gets current cursor, setCursor sets next cursor
// check that children didn't set own 'next' cursor
- ECursorType cursor = getWindow()->getNextCursor();
- if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() && cursor == UI_CURSOR_ARROW)
- {
- // replace arrow cursor with arrow and hourglass cursor
- getWindow()->setCursor(UI_CURSOR_WORKING);
- }
- }
- else
- {
- getWindow()->setCursor(UI_CURSOR_ARROW);
- }
- return TRUE;
+ ECursorType cursor = getWindow()->getNextCursor();
+ if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() && cursor == UI_CURSOR_ARROW)
+ {
+ // replace arrow cursor with arrow and hourglass cursor
+ getWindow()->setCursor(UI_CURSOR_WORKING);
+ }
+ }
+ else
+ {
+ getWindow()->setCursor(UI_CURSOR_ARROW);
+ }
+ return TRUE;
}
BOOL LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask)
{
- if (const LLFolderViewItem* hover_item_p = (!mFolderRoot.isDead()) ? mFolderRoot.get()->getHoveredItem() : nullptr)
- {
- if (const LLFolderViewModelItemInventory* vm_item_p = static_cast<const LLFolderViewModelItemInventory*>(hover_item_p->getViewModelItem()))
- {
+ if (const LLFolderViewItem* hover_item_p = (!mFolderRoot.isDead()) ? mFolderRoot.get()->getHoveredItem() : nullptr)
+ {
+ if (const LLFolderViewModelItemInventory* vm_item_p = static_cast<const LLFolderViewModelItemInventory*>(hover_item_p->getViewModelItem()))
+ {
LLSD params;
params["inv_type"] = vm_item_p->getInventoryType();
params["thumbnail_id"] = vm_item_p->getThumbnailUUID();
@@ -1392,64 +1392,64 @@ BOOL LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask)
actionable_rect.mBottom = actionable_rect.mTop - hover_item_p->getItemHeight();
}
- LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(hover_item_p->getToolTip())
- .sticky_rect(actionable_rect)
- .delay_time(LLView::getTooltipTimeout())
- .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1))
- .create_params(params));
- return TRUE;
- }
- }
- return LLPanel::handleToolTip(x, y, mask);
+ LLToolTipMgr::instance().show(LLToolTip::Params()
+ .message(hover_item_p->getToolTip())
+ .sticky_rect(actionable_rect)
+ .delay_time(LLView::getTooltipTimeout())
+ .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1))
+ .create_params(params));
+ return TRUE;
+ }
+ }
+ return LLPanel::handleToolTip(x, y, mask);
}
BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
{
- BOOL handled = FALSE;
+ BOOL handled = FALSE;
- if (mAcceptsDragAndDrop)
- {
- handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+ if (mAcceptsDragAndDrop)
+ {
+ handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
- // If folder view is empty the (x, y) point won't be in its rect
- // so the handler must be called explicitly.
- // but only if was not handled before. See EXT-6746.
- if (!handled && mParams.allow_drop_on_root && !mFolderRoot.get()->hasVisibleChildren())
- {
- handled = mFolderRoot.get()->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
- }
+ // If folder view is empty the (x, y) point won't be in its rect
+ // so the handler must be called explicitly.
+ // but only if was not handled before. See EXT-6746.
+ if (!handled && mParams.allow_drop_on_root && !mFolderRoot.get()->hasVisibleChildren())
+ {
+ handled = mFolderRoot.get()->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+ }
- if (handled)
- {
- mFolderRoot.get()->setDragAndDropThisFrame();
- }
- }
+ if (handled)
+ {
+ mFolderRoot.get()->setDragAndDropThisFrame();
+ }
+ }
- return handled;
+ return handled;
}
void LLInventoryPanel::onFocusLost()
{
- // inventory no longer handles cut/copy/paste/delete
- if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot.get())
- {
- LLEditMenuHandler::gEditMenuHandler = NULL;
- }
+ // inventory no longer handles cut/copy/paste/delete
+ if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot.get())
+ {
+ LLEditMenuHandler::gEditMenuHandler = NULL;
+ }
- LLPanel::onFocusLost();
+ LLPanel::onFocusLost();
}
void LLInventoryPanel::onFocusReceived()
{
- // inventory now handles cut/copy/paste/delete
- LLEditMenuHandler::gEditMenuHandler = mFolderRoot.get();
+ // inventory now handles cut/copy/paste/delete
+ LLEditMenuHandler::gEditMenuHandler = mFolderRoot.get();
- LLPanel::onFocusReceived();
+ LLPanel::onFocusReceived();
}
void LLInventoryPanel::onFolderOpening(const LLUUID &id)
@@ -1466,46 +1466,46 @@ void LLInventoryPanel::onFolderOpening(const LLUUID &id)
bool LLInventoryPanel::addBadge(LLBadge * badge)
{
- bool badge_added = false;
+ bool badge_added = false;
- if (acceptsBadge())
- {
- badge_added = badge->addToView(mFolderRoot.get());
- }
+ if (acceptsBadge())
+ {
+ badge_added = badge->addToView(mFolderRoot.get());
+ }
- return badge_added;
+ return badge_added;
}
void LLInventoryPanel::openAllFolders()
{
- mFolderRoot.get()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
- mFolderRoot.get()->arrangeAll();
+ mFolderRoot.get()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
+ mFolderRoot.get()->arrangeAll();
}
void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus)
{
- // Don't select objects in COF (e.g. to prevent refocus when items are worn).
- const LLInventoryObject *obj = mInventory->getObject(obj_id);
- if (obj && obj->getParentUUID() == LLAppearanceMgr::instance().getCOF())
- {
- return;
- }
- setSelectionByID(obj_id, take_keyboard_focus);
-}
-
-void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb)
-{
- if (mFolderRoot.get())
- {
- mFolderRoot.get()->setSelectCallback(cb);
- }
+ // Don't select objects in COF (e.g. to prevent refocus when items are worn).
+ const LLInventoryObject *obj = mInventory->getObject(obj_id);
+ if (obj && obj->getParentUUID() == LLAppearanceMgr::instance().getCOF())
+ {
+ return;
+ }
+ setSelectionByID(obj_id, take_keyboard_focus);
+}
+
+void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb)
+{
+ if (mFolderRoot.get())
+ {
+ mFolderRoot.get()->setSelectCallback(cb);
+ }
mSelectionCallback = cb;
}
void LLInventoryPanel::clearSelection()
{
- mSelectThisID.setNull();
- mFocusSelection = false;
+ mSelectThisID.setNull();
+ mFocusSelection = false;
}
LLInventoryPanel::selected_items_t LLInventoryPanel::getSelectedItems() const
@@ -1515,213 +1515,213 @@ LLInventoryPanel::selected_items_t LLInventoryPanel::getSelectedItems() const
void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action)
{
- // Schedule updating the folder view context menu when all selected items become complete (STORM-373).
- mCompletionObserver->reset();
- for (std::deque<LLFolderViewItem*>::const_iterator it = items.begin(); it != items.end(); ++it)
- {
- LLFolderViewModelItemInventory* view_model = static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem());
- if (view_model)
- {
- LLUUID id = view_model->getUUID();
+ // Schedule updating the folder view context menu when all selected items become complete (STORM-373).
+ mCompletionObserver->reset();
+ for (std::deque<LLFolderViewItem*>::const_iterator it = items.begin(); it != items.end(); ++it)
+ {
+ LLFolderViewModelItemInventory* view_model = static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem());
+ if (view_model)
+ {
+ LLUUID id = view_model->getUUID();
if (!(*it)->areChildrenInited())
{
const F64 max_time = 0.0001f;
mBuildViewsEndTime = LLTimer::getTotalSeconds() + max_time;
buildNewViews(id);
}
- LLViewerInventoryItem* inv_item = mInventory->getItem(id);
-
- if (inv_item && !inv_item->isFinished())
- {
- mCompletionObserver->watchItem(id);
- }
- }
- }
-
- LLFolderView* fv = mFolderRoot.get();
- if (fv->needsAutoRename()) // auto-selecting a new user-created asset and preparing to rename
- {
- fv->setNeedsAutoRename(FALSE);
- if (items.size()) // new asset is visible and selected
- {
- fv->startRenamingSelectedItem();
- }
+ LLViewerInventoryItem* inv_item = mInventory->getItem(id);
+
+ if (inv_item && !inv_item->isFinished())
+ {
+ mCompletionObserver->watchItem(id);
+ }
+ }
+ }
+
+ LLFolderView* fv = mFolderRoot.get();
+ if (fv->needsAutoRename()) // auto-selecting a new user-created asset and preparing to rename
+ {
+ fv->setNeedsAutoRename(FALSE);
+ if (items.size()) // new asset is visible and selected
+ {
+ fv->startRenamingSelectedItem();
+ }
else
{
LL_DEBUGS("Inventory") << "Failed to start renemr, no items selected" << LL_ENDL;
}
- }
-
- std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList();
- LLFolderViewItem* prev_folder_item = getItemByID(mPreviousSelectedFolder);
-
- if (selected_items.size() == 1)
- {
- std::set<LLFolderViewItem*>::const_iterator iter = selected_items.begin();
- LLFolderViewItem* folder_item = (*iter);
- if(folder_item && (folder_item != prev_folder_item))
- {
- LLFolderViewModelItemInventory* fve_listener = static_cast<LLFolderViewModelItemInventory*>(folder_item->getViewModelItem());
- if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY))
- {
- if (fve_listener->getInventoryObject() && fve_listener->getInventoryObject()->getIsLinkType())
- {
- return;
- }
-
- if(prev_folder_item)
- {
- LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
- if(prev_bridge)
- {
- prev_bridge->clearDisplayName();
- prev_bridge->setShowDescendantsCount(false);
- prev_folder_item->refresh();
- }
- }
-
- LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
- if(bridge)
- {
- bridge->clearDisplayName();
- bridge->setShowDescendantsCount(true);
- folder_item->refresh();
- mPreviousSelectedFolder = bridge->getUUID();
- }
- }
- }
- }
- else
- {
- if(prev_folder_item)
- {
- LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
- if(prev_bridge)
- {
- prev_bridge->clearDisplayName();
- prev_bridge->setShowDescendantsCount(false);
- prev_folder_item->refresh();
- }
- }
- mPreviousSelectedFolder = LLUUID();
- }
+ }
+
+ std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList();
+ LLFolderViewItem* prev_folder_item = getItemByID(mPreviousSelectedFolder);
+
+ if (selected_items.size() == 1)
+ {
+ std::set<LLFolderViewItem*>::const_iterator iter = selected_items.begin();
+ LLFolderViewItem* folder_item = (*iter);
+ if(folder_item && (folder_item != prev_folder_item))
+ {
+ LLFolderViewModelItemInventory* fve_listener = static_cast<LLFolderViewModelItemInventory*>(folder_item->getViewModelItem());
+ if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY))
+ {
+ if (fve_listener->getInventoryObject() && fve_listener->getInventoryObject()->getIsLinkType())
+ {
+ return;
+ }
+
+ if(prev_folder_item)
+ {
+ LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
+ if(prev_bridge)
+ {
+ prev_bridge->clearDisplayName();
+ prev_bridge->setShowDescendantsCount(false);
+ prev_folder_item->refresh();
+ }
+ }
+
+ LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
+ if(bridge)
+ {
+ bridge->clearDisplayName();
+ bridge->setShowDescendantsCount(true);
+ folder_item->refresh();
+ mPreviousSelectedFolder = bridge->getUUID();
+ }
+ }
+ }
+ }
+ else
+ {
+ if(prev_folder_item)
+ {
+ LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
+ if(prev_bridge)
+ {
+ prev_bridge->clearDisplayName();
+ prev_bridge->setShowDescendantsCount(false);
+ prev_folder_item->refresh();
+ }
+ }
+ mPreviousSelectedFolder = LLUUID();
+ }
}
void LLInventoryPanel::updateFolderLabel(const LLUUID& folder_id)
{
- if(folder_id != mPreviousSelectedFolder) return;
+ if(folder_id != mPreviousSelectedFolder) return;
- LLFolderViewItem* folder_item = getItemByID(mPreviousSelectedFolder);
- if(folder_item)
- {
- LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
- if(bridge)
- {
- bridge->clearDisplayName();
- bridge->setShowDescendantsCount(true);
- folder_item->refresh();
- }
- }
+ LLFolderViewItem* folder_item = getItemByID(mPreviousSelectedFolder);
+ if(folder_item)
+ {
+ LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
+ if(bridge)
+ {
+ bridge->clearDisplayName();
+ bridge->setShowDescendantsCount(true);
+ folder_item->refresh();
+ }
+ }
}
void LLInventoryPanel::doCreate(const LLSD& userdata)
{
- reset_inventory_filter();
- menu_create_inventory_item(this, LLFolderBridge::sSelf.get(), userdata);
+ reset_inventory_filter();
+ menu_create_inventory_item(this, LLFolderBridge::sSelf.get(), userdata);
}
bool LLInventoryPanel::beginIMSession()
{
- std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList();
-
- std::string name;
-
- std::vector<LLUUID> members;
- EInstantMessage type = IM_SESSION_CONFERENCE_START;
-
- std::set<LLFolderViewItem*>::const_iterator iter;
- for (iter = selected_items.begin(); iter != selected_items.end(); iter++)
- {
-
- LLFolderViewItem* folder_item = (*iter);
-
- if(folder_item)
- {
- LLFolderViewModelItemInventory* fve_listener = static_cast<LLFolderViewModelItemInventory*>(folder_item->getViewModelItem());
- if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY))
- {
-
- LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
- if(!bridge) return true;
- LLViewerInventoryCategory* cat = bridge->getCategory();
- if(!cat) return true;
- name = cat->getName();
- LLUniqueBuddyCollector is_buddy;
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- gInventory.collectDescendentsIf(bridge->getUUID(),
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- is_buddy);
- S32 count = item_array.size();
- if(count > 0)
- {
- //*TODO by what to replace that?
- //LLFloaterReg::showInstance("communicate");
-
- // create the session
- LLAvatarTracker& at = LLAvatarTracker::instance();
- LLUUID id;
- for(S32 i = 0; i < count; ++i)
- {
- id = item_array.at(i)->getCreatorUUID();
- if(at.isBuddyOnline(id))
- {
- members.push_back(id);
- }
- }
- }
- }
- else
- {
- LLInvFVBridge* listenerp = (LLInvFVBridge*)folder_item->getViewModelItem();
-
- if (listenerp->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
- {
- LLInventoryItem* inv_item = gInventory.getItem(listenerp->getUUID());
-
- if (inv_item)
- {
- LLAvatarTracker& at = LLAvatarTracker::instance();
- LLUUID id = inv_item->getCreatorUUID();
-
- if(at.isBuddyOnline(id))
- {
- members.push_back(id);
- }
- }
- } //if IT_CALLINGCARD
- } //if !IT_CATEGORY
- }
- } //for selected_items
-
- // the session_id is randomly generated UUID which will be replaced later
- // with a server side generated number
-
- if (name.empty())
- {
- name = LLTrans::getString("conference-title");
- }
-
- LLUUID session_id = gIMMgr->addSession(name, type, members[0], members);
- if (session_id != LLUUID::null)
- {
- LLFloaterIMContainer::getInstance()->showConversation(session_id);
- }
-
- return true;
+ std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList();
+
+ std::string name;
+
+ std::vector<LLUUID> members;
+ EInstantMessage type = IM_SESSION_CONFERENCE_START;
+
+ std::set<LLFolderViewItem*>::const_iterator iter;
+ for (iter = selected_items.begin(); iter != selected_items.end(); iter++)
+ {
+
+ LLFolderViewItem* folder_item = (*iter);
+
+ if(folder_item)
+ {
+ LLFolderViewModelItemInventory* fve_listener = static_cast<LLFolderViewModelItemInventory*>(folder_item->getViewModelItem());
+ if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY))
+ {
+
+ LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
+ if(!bridge) return true;
+ LLViewerInventoryCategory* cat = bridge->getCategory();
+ if(!cat) return true;
+ name = cat->getName();
+ LLUniqueBuddyCollector is_buddy;
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ gInventory.collectDescendentsIf(bridge->getUUID(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_buddy);
+ S32 count = item_array.size();
+ if(count > 0)
+ {
+ //*TODO by what to replace that?
+ //LLFloaterReg::showInstance("communicate");
+
+ // create the session
+ LLAvatarTracker& at = LLAvatarTracker::instance();
+ LLUUID id;
+ for(S32 i = 0; i < count; ++i)
+ {
+ id = item_array.at(i)->getCreatorUUID();
+ if(at.isBuddyOnline(id))
+ {
+ members.push_back(id);
+ }
+ }
+ }
+ }
+ else
+ {
+ LLInvFVBridge* listenerp = (LLInvFVBridge*)folder_item->getViewModelItem();
+
+ if (listenerp->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
+ {
+ LLInventoryItem* inv_item = gInventory.getItem(listenerp->getUUID());
+
+ if (inv_item)
+ {
+ LLAvatarTracker& at = LLAvatarTracker::instance();
+ LLUUID id = inv_item->getCreatorUUID();
+
+ if(at.isBuddyOnline(id))
+ {
+ members.push_back(id);
+ }
+ }
+ } //if IT_CALLINGCARD
+ } //if !IT_CATEGORY
+ }
+ } //for selected_items
+
+ // the session_id is randomly generated UUID which will be replaced later
+ // with a server side generated number
+
+ if (name.empty())
+ {
+ name = LLTrans::getString("conference-title");
+ }
+
+ LLUUID session_id = gIMMgr->addSession(name, type, members[0], members);
+ if (session_id != LLUUID::null)
+ {
+ LLFloaterIMContainer::getInstance()->showConversation(session_id);
+ }
+
+ return true;
}
void LLInventoryPanel::fileUploadLocation(const LLSD& userdata)
@@ -1795,110 +1795,110 @@ void LLInventoryPanel::callbackPurgeSelectedItems(const LLSD& notification, cons
bool LLInventoryPanel::attachObject(const LLSD& userdata)
{
- // Copy selected item UUIDs to a vector.
- std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList();
- uuid_vec_t items;
- for (std::set<LLFolderViewItem*>::const_iterator set_iter = selected_items.begin();
- set_iter != selected_items.end();
- ++set_iter)
- {
- items.push_back(static_cast<LLFolderViewModelItemInventory*>((*set_iter)->getViewModelItem())->getUUID());
- }
+ // Copy selected item UUIDs to a vector.
+ std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList();
+ uuid_vec_t items;
+ for (std::set<LLFolderViewItem*>::const_iterator set_iter = selected_items.begin();
+ set_iter != selected_items.end();
+ ++set_iter)
+ {
+ items.push_back(static_cast<LLFolderViewModelItemInventory*>((*set_iter)->getViewModelItem())->getUUID());
+ }
- // Attach selected items.
- LLViewerAttachMenu::attachObjects(items, userdata.asString());
+ // Attach selected items.
+ LLViewerAttachMenu::attachObjects(items, userdata.asString());
- gFocusMgr.setKeyboardFocus(NULL);
+ gFocusMgr.setKeyboardFocus(NULL);
- return true;
+ return true;
}
BOOL LLInventoryPanel::getSinceLogoff()
{
- return getFilter().isSinceLogoff();
+ return getFilter().isSinceLogoff();
}
// DEBUG ONLY
-// static
+// static
void LLInventoryPanel::dumpSelectionInformation(void* user_data)
{
- LLInventoryPanel* iv = (LLInventoryPanel*)user_data;
- iv->mFolderRoot.get()->dumpSelectionInformation();
+ LLInventoryPanel* iv = (LLInventoryPanel*)user_data;
+ iv->mFolderRoot.get()->dumpSelectionInformation();
}
BOOL is_inventorysp_active()
{
- LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
- if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return FALSE;
- return sidepanel_inventory->isMainInventoryPanelActive();
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return FALSE;
+ return sidepanel_inventory->isMainInventoryPanelActive();
}
// static
LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
{
- S32 z_min = S32_MAX;
- LLInventoryPanel* res = NULL;
- LLFloater* active_inv_floaterp = NULL;
-
- LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory");
- if (!floater_inventory)
- {
- LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL;
- return FALSE;
- }
-
- LLSidepanelInventory *inventory_panel = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
-
- // Iterate through the inventory floaters and return whichever is on top.
- LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
- for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
- {
- LLFloaterSidePanelContainer* inventory_floater = dynamic_cast<LLFloaterSidePanelContainer*>(*iter);
- inventory_panel = inventory_floater->findChild<LLSidepanelInventory>("main_panel");
-
- if (inventory_floater && inventory_panel && inventory_floater->getVisible())
- {
- S32 z_order = gFloaterView->getZOrder(inventory_floater);
- if (z_order < z_min)
- {
- res = inventory_panel->getActivePanel();
- z_min = z_order;
- active_inv_floaterp = inventory_floater;
- }
- }
- }
-
- if (res)
- {
- // Make sure the floater is not minimized (STORM-438).
- if (active_inv_floaterp && active_inv_floaterp->isMinimized())
- {
- active_inv_floaterp->setMinimized(FALSE);
- }
- }
- else if (auto_open)
- {
- floater_inventory->openFloater();
-
- res = inventory_panel->getActivePanel();
- }
-
- return res;
+ S32 z_min = S32_MAX;
+ LLInventoryPanel* res = NULL;
+ LLFloater* active_inv_floaterp = NULL;
+
+ LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory");
+ if (!floater_inventory)
+ {
+ LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL;
+ return FALSE;
+ }
+
+ LLSidepanelInventory *inventory_panel = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+
+ // Iterate through the inventory floaters and return whichever is on top.
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
+ {
+ LLFloaterSidePanelContainer* inventory_floater = dynamic_cast<LLFloaterSidePanelContainer*>(*iter);
+ inventory_panel = inventory_floater->findChild<LLSidepanelInventory>("main_panel");
+
+ if (inventory_floater && inventory_panel && inventory_floater->getVisible())
+ {
+ S32 z_order = gFloaterView->getZOrder(inventory_floater);
+ if (z_order < z_min)
+ {
+ res = inventory_panel->getActivePanel();
+ z_min = z_order;
+ active_inv_floaterp = inventory_floater;
+ }
+ }
+ }
+
+ if (res)
+ {
+ // Make sure the floater is not minimized (STORM-438).
+ if (active_inv_floaterp && active_inv_floaterp->isMinimized())
+ {
+ active_inv_floaterp->setMinimized(FALSE);
+ }
+ }
+ else if (auto_open)
+ {
+ floater_inventory->openFloater();
+
+ res = inventory_panel->getActivePanel();
+ }
+
+ return res;
}
//static
void LLInventoryPanel::openInventoryPanelAndSetSelection(bool auto_open, const LLUUID& obj_id,
- bool use_main_panel, bool take_keyboard_focus, bool reset_filter)
+ bool use_main_panel, bool take_keyboard_focus, bool reset_filter)
{
- LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
- sidepanel_inventory->showInventoryPanel();
+ LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ sidepanel_inventory->showInventoryPanel();
- LLUUID cat_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
- bool in_inbox = gInventory.isObjectDescendentOf(obj_id, cat_id);
- if (!in_inbox && use_main_panel)
- {
- sidepanel_inventory->selectAllItemsPanel();
- }
+ LLUUID cat_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
+ bool in_inbox = gInventory.isObjectDescendentOf(obj_id, cat_id);
+ if (!in_inbox && use_main_panel)
+ {
+ sidepanel_inventory->selectAllItemsPanel();
+ }
if (!auto_open)
{
@@ -1932,40 +1932,40 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(bool auto_open, const L
}
}
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open);
- if (active_panel)
- {
- LL_DEBUGS("Messaging", "Inventory") << "Highlighting" << obj_id << LL_ENDL;
-
- if (reset_filter)
- {
- reset_inventory_filter();
- }
-
- if (in_inbox)
- {
- sidepanel_inventory->openInbox();
- LLInventoryPanel* inventory_panel = sidepanel_inventory->getInboxPanel();
- if (inventory_panel)
- {
- inventory_panel->setSelection(obj_id, take_keyboard_focus);
- }
- }
- else if (auto_open)
- {
- LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory");
- if (floater_inventory)
- {
- floater_inventory->setFocus(TRUE);
- }
- active_panel->setSelection(obj_id, take_keyboard_focus);
- }
+ LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open);
+ if (active_panel)
+ {
+ LL_DEBUGS("Messaging", "Inventory") << "Highlighting" << obj_id << LL_ENDL;
+
+ if (reset_filter)
+ {
+ reset_inventory_filter();
+ }
+
+ if (in_inbox)
+ {
+ sidepanel_inventory->openInbox();
+ LLInventoryPanel* inventory_panel = sidepanel_inventory->getInboxPanel();
+ if (inventory_panel)
+ {
+ inventory_panel->setSelection(obj_id, take_keyboard_focus);
+ }
+ }
+ else if (auto_open)
+ {
+ LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory");
+ if (floater_inventory)
+ {
+ floater_inventory->setFocus(TRUE);
+ }
+ active_panel->setSelection(obj_id, take_keyboard_focus);
+ }
else
{
// Created items are going to receive proper focus from callbacks
active_panel->setSelection(obj_id, take_keyboard_focus);
}
- }
+ }
}
void LLInventoryPanel::setSFViewAndOpenFolder(const LLInventoryPanel* panel, const LLUUID& folder_id)
@@ -1988,66 +1988,66 @@ void LLInventoryPanel::setSFViewAndOpenFolder(const LLInventoryPanel* panel, con
void LLInventoryPanel::addHideFolderType(LLFolderType::EType folder_type)
{
- getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << folder_type));
+ getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << folder_type));
}
BOOL LLInventoryPanel::getIsHiddenFolderType(LLFolderType::EType folder_type) const
{
- return !(getFilter().getFilterCategoryTypes() & (1ULL << folder_type));
+ return !(getFilter().getFilterCategoryTypes() & (1ULL << folder_type));
}
void LLInventoryPanel::addItemID( const LLUUID& id, LLFolderViewItem* itemp )
{
- mItemMap[id] = itemp;
+ mItemMap[id] = itemp;
}
void LLInventoryPanel::removeItemID(const LLUUID& id)
{
- LLInventoryModel::cat_array_t categories;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(id, categories, items, TRUE);
+ LLInventoryModel::cat_array_t categories;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendents(id, categories, items, TRUE);
- mItemMap.erase(id);
+ mItemMap.erase(id);
- for (LLInventoryModel::cat_array_t::iterator it = categories.begin(), end_it = categories.end();
- it != end_it;
- ++it)
- {
- mItemMap.erase((*it)->getUUID());
+ for (LLInventoryModel::cat_array_t::iterator it = categories.begin(), end_it = categories.end();
+ it != end_it;
+ ++it)
+ {
+ mItemMap.erase((*it)->getUUID());
}
- for (LLInventoryModel::item_array_t::iterator it = items.begin(), end_it = items.end();
- it != end_it;
- ++it)
- {
- mItemMap.erase((*it)->getUUID());
- }
+ for (LLInventoryModel::item_array_t::iterator it = items.begin(), end_it = items.end();
+ it != end_it;
+ ++it)
+ {
+ mItemMap.erase((*it)->getUUID());
+ }
}
LLFolderViewItem* LLInventoryPanel::getItemByID(const LLUUID& id)
{
LL_PROFILE_ZONE_SCOPED;
- std::map<LLUUID, LLFolderViewItem*>::iterator map_it;
- map_it = mItemMap.find(id);
- if (map_it != mItemMap.end())
- {
- return map_it->second;
- }
+ std::map<LLUUID, LLFolderViewItem*>::iterator map_it;
+ map_it = mItemMap.find(id);
+ if (map_it != mItemMap.end())
+ {
+ return map_it->second;
+ }
- return NULL;
+ return NULL;
}
LLFolderViewFolder* LLInventoryPanel::getFolderByID(const LLUUID& id)
{
- LLFolderViewItem* item = getItemByID(id);
- return dynamic_cast<LLFolderViewFolder*>(item);
+ LLFolderViewItem* item = getItemByID(id);
+ return dynamic_cast<LLFolderViewFolder*>(item);
}
void LLInventoryPanel::setSelectionByID( const LLUUID& obj_id, BOOL take_keyboard_focus )
{
- LLFolderViewItem* itemp = getItemByID(obj_id);
+ LLFolderViewItem* itemp = getItemByID(obj_id);
if (itemp && !itemp->areChildrenInited())
{
@@ -2058,109 +2058,109 @@ void LLInventoryPanel::setSelectionByID( const LLUUID& obj_id, BOOL take_keyb
}
}
- if(itemp && itemp->getViewModelItem())
- {
- itemp->arrangeAndSet(TRUE, take_keyboard_focus);
- mSelectThisID.setNull();
- mFocusSelection = false;
- return;
- }
- else
- {
- // save the desired item to be selected later (if/when ready)
- mFocusSelection = take_keyboard_focus;
- mSelectThisID = obj_id;
- }
+ if(itemp && itemp->getViewModelItem())
+ {
+ itemp->arrangeAndSet(TRUE, take_keyboard_focus);
+ mSelectThisID.setNull();
+ mFocusSelection = false;
+ return;
+ }
+ else
+ {
+ // save the desired item to be selected later (if/when ready)
+ mFocusSelection = take_keyboard_focus;
+ mSelectThisID = obj_id;
+ }
}
void LLInventoryPanel::updateSelection()
{
- if (mSelectThisID.notNull())
- {
- setSelectionByID(mSelectThisID, mFocusSelection);
- }
+ if (mSelectThisID.notNull())
+ {
+ setSelectionByID(mSelectThisID, mFocusSelection);
+ }
}
void LLInventoryPanel::doToSelected(const LLSD& userdata)
{
- if (("purge" == userdata.asString()))
- {
- purgeSelectedItems();
- return;
- }
- LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), userdata.asString());
+ if (("purge" == userdata.asString()))
+ {
+ purgeSelectedItems();
+ return;
+ }
+ LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), userdata.asString());
- return;
+ return;
}
BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask )
{
- BOOL handled = FALSE;
- switch (key)
- {
- case KEY_RETURN:
- // Open selected items if enter key hit on the inventory panel
- if (mask == MASK_NONE)
- {
- if (mSuppressOpenItemAction)
- {
- LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem();
- if(folder_item)
- {
- LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
- if(bridge && (bridge->getInventoryType() != LLInventoryType::IT_CATEGORY))
- {
- return handled;
- }
- }
- }
- LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "open");
- handled = TRUE;
- }
- break;
- case KEY_DELETE:
+ BOOL handled = FALSE;
+ switch (key)
+ {
+ case KEY_RETURN:
+ // Open selected items if enter key hit on the inventory panel
+ if (mask == MASK_NONE)
+ {
+ if (mSuppressOpenItemAction)
+ {
+ LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem();
+ if(folder_item)
+ {
+ LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
+ if(bridge && (bridge->getInventoryType() != LLInventoryType::IT_CATEGORY))
+ {
+ return handled;
+ }
+ }
+ }
+ LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "open");
+ handled = TRUE;
+ }
+ break;
+ case KEY_DELETE:
#if LL_DARWIN
- case KEY_BACKSPACE:
+ case KEY_BACKSPACE:
#endif
- // Delete selected items if delete or backspace key hit on the inventory panel
- // Note: on Mac laptop keyboards, backspace and delete are one and the same
- if (isSelectionRemovable() && (mask == MASK_NONE))
- {
- LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "delete");
- handled = TRUE;
- }
- break;
- }
- return handled;
+ // Delete selected items if delete or backspace key hit on the inventory panel
+ // Note: on Mac laptop keyboards, backspace and delete are one and the same
+ if (isSelectionRemovable() && (mask == MASK_NONE))
+ {
+ LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "delete");
+ handled = TRUE;
+ }
+ break;
+ }
+ return handled;
}
bool LLInventoryPanel::isSelectionRemovable()
{
- bool can_delete = false;
- if (mFolderRoot.get())
- {
- std::set<LLFolderViewItem*> selection_set = mFolderRoot.get()->getSelectionList();
- if (!selection_set.empty())
- {
- can_delete = true;
- for (std::set<LLFolderViewItem*>::iterator iter = selection_set.begin();
- iter != selection_set.end();
- ++iter)
- {
- LLFolderViewItem *item = *iter;
- const LLFolderViewModelItemInventory *listener = static_cast<const LLFolderViewModelItemInventory*>(item->getViewModelItem());
- if (!listener)
- {
- can_delete = false;
- }
- else
- {
- can_delete &= listener->isItemRemovable() && !listener->isItemInTrash();
- }
- }
- }
- }
- return can_delete;
+ bool can_delete = false;
+ if (mFolderRoot.get())
+ {
+ std::set<LLFolderViewItem*> selection_set = mFolderRoot.get()->getSelectionList();
+ if (!selection_set.empty())
+ {
+ can_delete = true;
+ for (std::set<LLFolderViewItem*>::iterator iter = selection_set.begin();
+ iter != selection_set.end();
+ ++iter)
+ {
+ LLFolderViewItem *item = *iter;
+ const LLFolderViewModelItemInventory *listener = static_cast<const LLFolderViewModelItemInventory*>(item->getViewModelItem());
+ if (!listener)
+ {
+ can_delete = false;
+ }
+ else
+ {
+ can_delete &= listener->isItemRemovable() && !listener->isItemInTrash();
+ }
+ }
+ }
+ }
+ return can_delete;
}
/************************************************************************/
@@ -2170,28 +2170,28 @@ static const LLRecentInventoryBridgeBuilder RECENT_ITEMS_BUILDER;
class LLInventoryRecentItemsPanel : public LLInventoryPanel
{
public:
- struct Params : public LLInitParam::Block<Params, LLInventoryPanel::Params>
- {};
-
- void initFromParams(const Params& p)
- {
- LLInventoryPanel::initFromParams(p);
- // turn on inbox for recent items
- getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() | (1ULL << LLFolderType::FT_INBOX));
+ struct Params : public LLInitParam::Block<Params, LLInventoryPanel::Params>
+ {};
+
+ void initFromParams(const Params& p)
+ {
+ LLInventoryPanel::initFromParams(p);
+ // turn on inbox for recent items
+ getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() | (1ULL << LLFolderType::FT_INBOX));
// turn off marketplace for recent items
getFilter().setFilterNoMarketplaceFolder();
- }
+ }
protected:
- LLInventoryRecentItemsPanel (const Params&);
- friend class LLUICtrlFactory;
+ LLInventoryRecentItemsPanel (const Params&);
+ friend class LLUICtrlFactory;
};
LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params)
: LLInventoryPanel(params)
{
- // replace bridge builder to have necessary View bridges.
- mInvFVBridgeBuilder = &RECENT_ITEMS_BUILDER;
+ // replace bridge builder to have necessary View bridges.
+ mInvFVBridgeBuilder = &RECENT_ITEMS_BUILDER;
}
static LLDefaultChildRegistry::Register<LLInventorySingleFolderPanel> t_single_folder_inventory_panel("single_folder_inventory_panel");
@@ -2389,7 +2389,7 @@ void LLInventorySingleFolderPanel::updateSingleFolderRoot()
mFolderRoot.get()->setCallbackRegistrar(&mCommitCallbackRegistrar);
buildNewViews(mFolderID);
-
+
LLFloater* root_floater = gFloaterView->getParentFloater(this);
if(root_floater)
{
@@ -2553,37 +2553,37 @@ void LLAssetFilteredInventoryPanel::itemChanged(const LLUUID& id, U32 mask, cons
namespace LLInitParam
{
- void TypeValues<LLFolderType::EType>::declareValues()
- {
- declare(LLFolderType::lookup(LLFolderType::FT_TEXTURE) , LLFolderType::FT_TEXTURE);
- declare(LLFolderType::lookup(LLFolderType::FT_SOUND) , LLFolderType::FT_SOUND);
- declare(LLFolderType::lookup(LLFolderType::FT_CALLINGCARD) , LLFolderType::FT_CALLINGCARD);
- declare(LLFolderType::lookup(LLFolderType::FT_LANDMARK) , LLFolderType::FT_LANDMARK);
- declare(LLFolderType::lookup(LLFolderType::FT_CLOTHING) , LLFolderType::FT_CLOTHING);
- declare(LLFolderType::lookup(LLFolderType::FT_OBJECT) , LLFolderType::FT_OBJECT);
- declare(LLFolderType::lookup(LLFolderType::FT_NOTECARD) , LLFolderType::FT_NOTECARD);
- declare(LLFolderType::lookup(LLFolderType::FT_ROOT_INVENTORY) , LLFolderType::FT_ROOT_INVENTORY);
- declare(LLFolderType::lookup(LLFolderType::FT_LSL_TEXT) , LLFolderType::FT_LSL_TEXT);
- declare(LLFolderType::lookup(LLFolderType::FT_BODYPART) , LLFolderType::FT_BODYPART);
- declare(LLFolderType::lookup(LLFolderType::FT_TRASH) , LLFolderType::FT_TRASH);
- declare(LLFolderType::lookup(LLFolderType::FT_SNAPSHOT_CATEGORY), LLFolderType::FT_SNAPSHOT_CATEGORY);
- declare(LLFolderType::lookup(LLFolderType::FT_LOST_AND_FOUND) , LLFolderType::FT_LOST_AND_FOUND);
- declare(LLFolderType::lookup(LLFolderType::FT_ANIMATION) , LLFolderType::FT_ANIMATION);
- declare(LLFolderType::lookup(LLFolderType::FT_GESTURE) , LLFolderType::FT_GESTURE);
- declare(LLFolderType::lookup(LLFolderType::FT_FAVORITE) , LLFolderType::FT_FAVORITE);
- declare(LLFolderType::lookup(LLFolderType::FT_ENSEMBLE_START) , LLFolderType::FT_ENSEMBLE_START);
- declare(LLFolderType::lookup(LLFolderType::FT_ENSEMBLE_END) , LLFolderType::FT_ENSEMBLE_END);
- declare(LLFolderType::lookup(LLFolderType::FT_CURRENT_OUTFIT) , LLFolderType::FT_CURRENT_OUTFIT);
- declare(LLFolderType::lookup(LLFolderType::FT_OUTFIT) , LLFolderType::FT_OUTFIT);
- declare(LLFolderType::lookup(LLFolderType::FT_MY_OUTFITS) , LLFolderType::FT_MY_OUTFITS);
- declare(LLFolderType::lookup(LLFolderType::FT_MESH ) , LLFolderType::FT_MESH );
- declare(LLFolderType::lookup(LLFolderType::FT_INBOX) , LLFolderType::FT_INBOX);
- declare(LLFolderType::lookup(LLFolderType::FT_OUTBOX) , LLFolderType::FT_OUTBOX);
- declare(LLFolderType::lookup(LLFolderType::FT_BASIC_ROOT) , LLFolderType::FT_BASIC_ROOT);
+ void TypeValues<LLFolderType::EType>::declareValues()
+ {
+ declare(LLFolderType::lookup(LLFolderType::FT_TEXTURE) , LLFolderType::FT_TEXTURE);
+ declare(LLFolderType::lookup(LLFolderType::FT_SOUND) , LLFolderType::FT_SOUND);
+ declare(LLFolderType::lookup(LLFolderType::FT_CALLINGCARD) , LLFolderType::FT_CALLINGCARD);
+ declare(LLFolderType::lookup(LLFolderType::FT_LANDMARK) , LLFolderType::FT_LANDMARK);
+ declare(LLFolderType::lookup(LLFolderType::FT_CLOTHING) , LLFolderType::FT_CLOTHING);
+ declare(LLFolderType::lookup(LLFolderType::FT_OBJECT) , LLFolderType::FT_OBJECT);
+ declare(LLFolderType::lookup(LLFolderType::FT_NOTECARD) , LLFolderType::FT_NOTECARD);
+ declare(LLFolderType::lookup(LLFolderType::FT_ROOT_INVENTORY) , LLFolderType::FT_ROOT_INVENTORY);
+ declare(LLFolderType::lookup(LLFolderType::FT_LSL_TEXT) , LLFolderType::FT_LSL_TEXT);
+ declare(LLFolderType::lookup(LLFolderType::FT_BODYPART) , LLFolderType::FT_BODYPART);
+ declare(LLFolderType::lookup(LLFolderType::FT_TRASH) , LLFolderType::FT_TRASH);
+ declare(LLFolderType::lookup(LLFolderType::FT_SNAPSHOT_CATEGORY), LLFolderType::FT_SNAPSHOT_CATEGORY);
+ declare(LLFolderType::lookup(LLFolderType::FT_LOST_AND_FOUND) , LLFolderType::FT_LOST_AND_FOUND);
+ declare(LLFolderType::lookup(LLFolderType::FT_ANIMATION) , LLFolderType::FT_ANIMATION);
+ declare(LLFolderType::lookup(LLFolderType::FT_GESTURE) , LLFolderType::FT_GESTURE);
+ declare(LLFolderType::lookup(LLFolderType::FT_FAVORITE) , LLFolderType::FT_FAVORITE);
+ declare(LLFolderType::lookup(LLFolderType::FT_ENSEMBLE_START) , LLFolderType::FT_ENSEMBLE_START);
+ declare(LLFolderType::lookup(LLFolderType::FT_ENSEMBLE_END) , LLFolderType::FT_ENSEMBLE_END);
+ declare(LLFolderType::lookup(LLFolderType::FT_CURRENT_OUTFIT) , LLFolderType::FT_CURRENT_OUTFIT);
+ declare(LLFolderType::lookup(LLFolderType::FT_OUTFIT) , LLFolderType::FT_OUTFIT);
+ declare(LLFolderType::lookup(LLFolderType::FT_MY_OUTFITS) , LLFolderType::FT_MY_OUTFITS);
+ declare(LLFolderType::lookup(LLFolderType::FT_MESH ) , LLFolderType::FT_MESH );
+ declare(LLFolderType::lookup(LLFolderType::FT_INBOX) , LLFolderType::FT_INBOX);
+ declare(LLFolderType::lookup(LLFolderType::FT_OUTBOX) , LLFolderType::FT_OUTBOX);
+ declare(LLFolderType::lookup(LLFolderType::FT_BASIC_ROOT) , LLFolderType::FT_BASIC_ROOT);
declare(LLFolderType::lookup(LLFolderType::FT_SETTINGS) , LLFolderType::FT_SETTINGS);
declare(LLFolderType::lookup(LLFolderType::FT_MATERIAL) , LLFolderType::FT_MATERIAL);
- declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_LISTINGS) , LLFolderType::FT_MARKETPLACE_LISTINGS);
- declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_STOCK), LLFolderType::FT_MARKETPLACE_STOCK);
- declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_VERSION), LLFolderType::FT_MARKETPLACE_VERSION);
- }
+ declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_LISTINGS) , LLFolderType::FT_MARKETPLACE_LISTINGS);
+ declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_STOCK), LLFolderType::FT_MARKETPLACE_STOCK);
+ declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_VERSION), LLFolderType::FT_MARKETPLACE_VERSION);
+ }
}
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 97300596f9..c6984fb53b 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llinventorypanel.h
* @brief LLInventoryPanel
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,221 +47,221 @@ class LLFolderViewGroupedItemBridge;
namespace LLInitParam
{
- template<>
- struct TypeValues<LLFolderType::EType> : public TypeValuesHelper<LLFolderType::EType>
- {
- static void declareValues();
- };
+ template<>
+ struct TypeValues<LLFolderType::EType> : public TypeValuesHelper<LLFolderType::EType>
+ {
+ static void declareValues();
+ };
}
class LLInventoryPanel : public LLPanel
{
- //--------------------------------------------------------------------
- // Data
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Data
+ //--------------------------------------------------------------------
public:
- struct Filter : public LLInitParam::Block<Filter>
- {
- Optional<U32> sort_order;
- Optional<U32> types;
- Optional<std::string> search_string;
-
- Filter()
- : sort_order("sort_order"),
- types("types", 0xffffffff),
- search_string("search_string")
- {}
- };
-
- struct StartFolder : public LLInitParam::ChoiceBlock<StartFolder>
- {
- Alternative<std::string> name;
- Alternative<LLUUID> id;
- Alternative<LLFolderType::EType> type;
-
- StartFolder()
- : name("name"),
- id("id"),
- type("type")
- {}
- };
-
- struct Params
- : public LLInitParam::Block<Params, LLPanel::Params>
- {
- Optional<std::string> sort_order_setting;
- Optional<LLInventoryModel*> inventory;
- Optional<bool> allow_multi_select;
- Optional<bool> allow_drag;
- Optional<bool> show_item_link_overlays;
- Optional<Filter> filter;
- Optional<StartFolder> start_folder;
- Optional<bool> use_label_suffix;
- Optional<bool> show_empty_message;
- Optional<bool> suppress_folder_menu;
- Optional<bool> show_root_folder;
- Optional<bool> allow_drop_on_root;
- Optional<bool> use_marketplace_folders;
- Optional<LLScrollContainer::Params> scroll;
- Optional<bool> accepts_drag_and_drop;
- Optional<LLFolderView::Params> folder_view;
- Optional<LLFolderViewFolder::Params> folder;
- Optional<LLFolderViewItem::Params> item;
+ struct Filter : public LLInitParam::Block<Filter>
+ {
+ Optional<U32> sort_order;
+ Optional<U32> types;
+ Optional<std::string> search_string;
+
+ Filter()
+ : sort_order("sort_order"),
+ types("types", 0xffffffff),
+ search_string("search_string")
+ {}
+ };
+
+ struct StartFolder : public LLInitParam::ChoiceBlock<StartFolder>
+ {
+ Alternative<std::string> name;
+ Alternative<LLUUID> id;
+ Alternative<LLFolderType::EType> type;
+
+ StartFolder()
+ : name("name"),
+ id("id"),
+ type("type")
+ {}
+ };
+
+ struct Params
+ : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<std::string> sort_order_setting;
+ Optional<LLInventoryModel*> inventory;
+ Optional<bool> allow_multi_select;
+ Optional<bool> allow_drag;
+ Optional<bool> show_item_link_overlays;
+ Optional<Filter> filter;
+ Optional<StartFolder> start_folder;
+ Optional<bool> use_label_suffix;
+ Optional<bool> show_empty_message;
+ Optional<bool> suppress_folder_menu;
+ Optional<bool> show_root_folder;
+ Optional<bool> allow_drop_on_root;
+ Optional<bool> use_marketplace_folders;
+ Optional<LLScrollContainer::Params> scroll;
+ Optional<bool> accepts_drag_and_drop;
+ Optional<LLFolderView::Params> folder_view;
+ Optional<LLFolderViewFolder::Params> folder;
+ Optional<LLFolderViewItem::Params> item;
Optional<bool> open_first_folder;
// All item and folder views will be initialized on init if true (default)
// Will initialize on visibility change otherwise.
- Optional<bool> preinitialize_views;
-
- Params()
- : sort_order_setting("sort_order_setting"),
- inventory("", &gInventory),
- allow_multi_select("allow_multi_select", true),
- allow_drag("allow_drag", true),
- show_item_link_overlays("show_item_link_overlays", false),
- suppress_folder_menu("suppress_folder_menu", false),
- filter("filter"),
- start_folder("start_folder"),
- use_label_suffix("use_label_suffix", true),
+ Optional<bool> preinitialize_views;
+
+ Params()
+ : sort_order_setting("sort_order_setting"),
+ inventory("", &gInventory),
+ allow_multi_select("allow_multi_select", true),
+ allow_drag("allow_drag", true),
+ show_item_link_overlays("show_item_link_overlays", false),
+ suppress_folder_menu("suppress_folder_menu", false),
+ filter("filter"),
+ start_folder("start_folder"),
+ use_label_suffix("use_label_suffix", true),
show_empty_message("show_empty_message", true),
show_root_folder("show_root_folder", false),
allow_drop_on_root("allow_drop_on_root", true),
use_marketplace_folders("use_marketplace_folders", false),
open_first_folder("open_first_folder", true),
- scroll("scroll"),
- accepts_drag_and_drop("accepts_drag_and_drop"),
- folder_view("folder_view"),
- folder("folder"),
- item("item"),
- preinitialize_views("preinitialize_views", true)
- {}
- };
-
- struct InventoryState : public LLInitParam::Block<InventoryState>
- {
- Mandatory<LLInventoryFilter::Params> filter;
- Mandatory<LLInventorySort::Params> sort;
- };
-
- //--------------------------------------------------------------------
- // Initialization
- //--------------------------------------------------------------------
+ scroll("scroll"),
+ accepts_drag_and_drop("accepts_drag_and_drop"),
+ folder_view("folder_view"),
+ folder("folder"),
+ item("item"),
+ preinitialize_views("preinitialize_views", true)
+ {}
+ };
+
+ struct InventoryState : public LLInitParam::Block<InventoryState>
+ {
+ Mandatory<LLInventoryFilter::Params> filter;
+ Mandatory<LLInventorySort::Params> sort;
+ };
+
+ //--------------------------------------------------------------------
+ // Initialization
+ //--------------------------------------------------------------------
protected:
- LLInventoryPanel(const Params&);
- void initFromParams(const Params&);
+ LLInventoryPanel(const Params&);
+ void initFromParams(const Params&);
- friend class LLUICtrlFactory;
+ friend class LLUICtrlFactory;
public:
- virtual ~LLInventoryPanel();
+ virtual ~LLInventoryPanel();
public:
typedef std::set<LLFolderViewItem*> selected_items_t;
- LLInventoryModel* getModel() { return mInventory; }
- LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; }
-
- // LLView methods
- /*virtual*/ void onVisibilityChange(BOOL new_visibility) override;
- void draw() override;
- /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ) override;
- BOOL handleHover(S32 x, S32 y, MASK mask) override;
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg) override;
- BOOL handleToolTip(S32 x, S32 y, MASK mask) override;
- // LLUICtrl methods
- /*virtual*/ void onFocusLost() override;
- /*virtual*/ void onFocusReceived() override;
+ LLInventoryModel* getModel() { return mInventory; }
+ LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; }
+
+ // LLView methods
+ /*virtual*/ void onVisibilityChange(BOOL new_visibility) override;
+ void draw() override;
+ /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ) override;
+ BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg) override;
+ BOOL handleToolTip(S32 x, S32 y, MASK mask) override;
+ // LLUICtrl methods
+ /*virtual*/ void onFocusLost() override;
+ /*virtual*/ void onFocusReceived() override;
void onFolderOpening(const LLUUID &id);
- // LLBadgeHolder methods
- bool addBadge(LLBadge * badge) override;
+ // LLBadgeHolder methods
+ bool addBadge(LLBadge * badge) override;
- // Call this method to set the selection.
- void openAllFolders();
- void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus);
- void setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb);
- void clearSelection();
+ // Call this method to set the selection.
+ void openAllFolders();
+ void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus);
+ void setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb);
+ void clearSelection();
selected_items_t getSelectedItems() const;
- bool isSelectionRemovable();
- LLInventoryFilter& getFilter();
- const LLInventoryFilter& getFilter() const;
- void setFilterTypes(U64 filter, LLInventoryFilter::EFilterType = LLInventoryFilter::FILTERTYPE_OBJECT);
- void setFilterWorn();
- U32 getFilterObjectTypes() const;
- void setFilterPermMask(PermissionMask filter_perm_mask);
- U32 getFilterPermMask() const;
+ bool isSelectionRemovable();
+ LLInventoryFilter& getFilter();
+ const LLInventoryFilter& getFilter() const;
+ void setFilterTypes(U64 filter, LLInventoryFilter::EFilterType = LLInventoryFilter::FILTERTYPE_OBJECT);
+ void setFilterWorn();
+ U32 getFilterObjectTypes() const;
+ void setFilterPermMask(PermissionMask filter_perm_mask);
+ U32 getFilterPermMask() const;
void setFilterWearableTypes(U64 filter);
void setFilterSettingsTypes(U64 filter);
void setFilterSubString(const std::string& string);
- const std::string getFilterSubString();
- void setSinceLogoff(BOOL sl);
- void setHoursAgo(U32 hours);
- void setDateSearchDirection(U32 direction);
- BOOL getSinceLogoff();
- void setFilterLinks(U64 filter_links);
- void setSearchType(LLInventoryFilter::ESearchType type);
- LLInventoryFilter::ESearchType getSearchType();
-
- void setShowFolderState(LLInventoryFilter::EFolderShow show);
- LLInventoryFilter::EFolderShow getShowFolderState();
- // This method is called when something has changed about the inventory.
- void modelChanged(U32 mask);
- LLFolderView* getRootFolder() { return mFolderRoot.get(); }
- LLUUID getRootFolderID();
- LLScrollContainer* getScrollableContainer() { return mScroller; }
+ const std::string getFilterSubString();
+ void setSinceLogoff(BOOL sl);
+ void setHoursAgo(U32 hours);
+ void setDateSearchDirection(U32 direction);
+ BOOL getSinceLogoff();
+ void setFilterLinks(U64 filter_links);
+ void setSearchType(LLInventoryFilter::ESearchType type);
+ LLInventoryFilter::ESearchType getSearchType();
+
+ void setShowFolderState(LLInventoryFilter::EFolderShow show);
+ LLInventoryFilter::EFolderShow getShowFolderState();
+ // This method is called when something has changed about the inventory.
+ void modelChanged(U32 mask);
+ LLFolderView* getRootFolder() { return mFolderRoot.get(); }
+ LLUUID getRootFolderID();
+ LLScrollContainer* getScrollableContainer() { return mScroller; }
bool getAllowDropOnRoot() { return mParams.allow_drop_on_root; }
bool areViewsInitialized() { return mViewsInitialized == VIEWS_INITIALIZED && mFolderRoot.get() && !mFolderRoot.get()->needsArrange(); }
-
- void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
-
- LLHandle<LLInventoryPanel> getInventoryPanelHandle() const { return getDerivedHandle<LLInventoryPanel>(); }
-
- // Callbacks
- void doToSelected(const LLSD& userdata);
- void doCreate(const LLSD& userdata);
- bool beginIMSession();
- void fileUploadLocation(const LLSD& userdata);
+
+ void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
+
+ LLHandle<LLInventoryPanel> getInventoryPanelHandle() const { return getDerivedHandle<LLInventoryPanel>(); }
+
+ // Callbacks
+ void doToSelected(const LLSD& userdata);
+ void doCreate(const LLSD& userdata);
+ bool beginIMSession();
+ void fileUploadLocation(const LLSD& userdata);
void openSingleViewInventory(LLUUID folder_id = LLUUID());
- void purgeSelectedItems();
- bool attachObject(const LLSD& userdata);
- static void idle(void* user_data);
-
- void updateFolderLabel(const LLUUID& folder_id);
-
- // DEBUG ONLY:
- static void dumpSelectionInformation(void* user_data);
-
- void openSelected();
- void unSelectAll();
-
- static void onIdle(void* user_data);
-
- // Find whichever inventory panel is active / on top.
- // "Auto_open" determines if we open an inventory panel if none are open.
- static LLInventoryPanel *getActiveInventoryPanel(BOOL auto_open = TRUE);
-
- static void openInventoryPanelAndSetSelection(bool auto_open,
- const LLUUID& obj_id,
- bool use_main_panel = false,
- bool take_keyboard_focus = true,
- bool reset_filter = false);
- static void setSFViewAndOpenFolder(const LLInventoryPanel* panel, const LLUUID& folder_id);
- void addItemID(const LLUUID& id, LLFolderViewItem* itemp);
- void removeItemID(const LLUUID& id);
- LLFolderViewItem* getItemByID(const LLUUID& id);
- LLFolderViewFolder* getFolderByID(const LLUUID& id);
- void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus);
- void updateSelection();
-
- void setSuppressOpenItemAction(bool supress_open_item) { mSuppressOpenItemAction = supress_open_item; }
-
- LLFolderViewModelInventory* getFolderViewModel() { return &mInventoryViewModel; }
- const LLFolderViewModelInventory* getFolderViewModel() const { return &mInventoryViewModel; }
-
+ void purgeSelectedItems();
+ bool attachObject(const LLSD& userdata);
+ static void idle(void* user_data);
+
+ void updateFolderLabel(const LLUUID& folder_id);
+
+ // DEBUG ONLY:
+ static void dumpSelectionInformation(void* user_data);
+
+ void openSelected();
+ void unSelectAll();
+
+ static void onIdle(void* user_data);
+
+ // Find whichever inventory panel is active / on top.
+ // "Auto_open" determines if we open an inventory panel if none are open.
+ static LLInventoryPanel *getActiveInventoryPanel(BOOL auto_open = TRUE);
+
+ static void openInventoryPanelAndSetSelection(bool auto_open,
+ const LLUUID& obj_id,
+ bool use_main_panel = false,
+ bool take_keyboard_focus = true,
+ bool reset_filter = false);
+ static void setSFViewAndOpenFolder(const LLInventoryPanel* panel, const LLUUID& folder_id);
+ void addItemID(const LLUUID& id, LLFolderViewItem* itemp);
+ void removeItemID(const LLUUID& id);
+ LLFolderViewItem* getItemByID(const LLUUID& id);
+ LLFolderViewFolder* getFolderByID(const LLUUID& id);
+ void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus);
+ void updateSelection();
+
+ void setSuppressOpenItemAction(bool supress_open_item) { mSuppressOpenItemAction = supress_open_item; }
+
+ LLFolderViewModelInventory* getFolderViewModel() { return &mInventoryViewModel; }
+ const LLFolderViewModelInventory* getFolderViewModel() const { return &mInventoryViewModel; }
+
// Clean up stuff when the folder root gets deleted
void clearFolderRoot();
@@ -272,75 +272,75 @@ public:
void initializeViewBuilding();
protected:
- void openStartFolderOrMyInventory(); // open the first level of inventory
- void onItemsCompletion(); // called when selected items are complete
-
- LLUUID mSelectThisID;
- LLInventoryModel* mInventory;
- LLInventoryObserver* mInventoryObserver;
- LLInvPanelComplObserver* mCompletionObserver;
- bool mFocusSelection;
- bool mAcceptsDragAndDrop;
- bool mAllowMultiSelect;
- bool mAllowDrag;
- bool mShowItemLinkOverlays; // Shows link graphic over inventory item icons
- bool mShowEmptyMessage;
- bool mSuppressFolderMenu;
- bool mSuppressOpenItemAction;
-
- LLHandle<LLFolderView> mFolderRoot;
- LLScrollContainer* mScroller;
-
- LLUUID mPreviousSelectedFolder;
-
- LLFolderViewModelInventory mInventoryViewModel;
+ void openStartFolderOrMyInventory(); // open the first level of inventory
+ void onItemsCompletion(); // called when selected items are complete
+
+ LLUUID mSelectThisID;
+ LLInventoryModel* mInventory;
+ LLInventoryObserver* mInventoryObserver;
+ LLInvPanelComplObserver* mCompletionObserver;
+ bool mFocusSelection;
+ bool mAcceptsDragAndDrop;
+ bool mAllowMultiSelect;
+ bool mAllowDrag;
+ bool mShowItemLinkOverlays; // Shows link graphic over inventory item icons
+ bool mShowEmptyMessage;
+ bool mSuppressFolderMenu;
+ bool mSuppressOpenItemAction;
+
+ LLHandle<LLFolderView> mFolderRoot;
+ LLScrollContainer* mScroller;
+
+ LLUUID mPreviousSelectedFolder;
+
+ LLFolderViewModelInventory mInventoryViewModel;
LLPointer<LLFolderViewGroupedItemBridge> mGroupedItemBridge;
- Params mParams; // stored copy of parameter block
-
- std::map<LLUUID, LLFolderViewItem*> mItemMap;
- /**
- * Pointer to LLInventoryFolderViewModelBuilder.
- *
- * It is set in LLInventoryPanel's constructor and can be overridden in derived classes with
- * another implementation.
- * Take into account it will not be deleted by LLInventoryPanel itself.
- */
- const LLInventoryFolderViewModelBuilder* mInvFVBridgeBuilder;
+ Params mParams; // stored copy of parameter block
+
+ std::map<LLUUID, LLFolderViewItem*> mItemMap;
+ /**
+ * Pointer to LLInventoryFolderViewModelBuilder.
+ *
+ * It is set in LLInventoryPanel's constructor and can be overridden in derived classes with
+ * another implementation.
+ * Take into account it will not be deleted by LLInventoryPanel itself.
+ */
+ const LLInventoryFolderViewModelBuilder* mInvFVBridgeBuilder;
bool mBuildChildrenViews; // build root and children
bool mRootInited;
- //--------------------------------------------------------------------
- // Sorting
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Sorting
+ //--------------------------------------------------------------------
public:
- static const std::string DEFAULT_SORT_ORDER;
- static const std::string RECENTITEMS_SORT_ORDER;
- static const std::string INHERIT_SORT_ORDER;
-
- void setSortOrder(U32 order);
- U32 getSortOrder() const;
+ static const std::string DEFAULT_SORT_ORDER;
+ static const std::string RECENTITEMS_SORT_ORDER;
+ static const std::string INHERIT_SORT_ORDER;
+
+ void setSortOrder(U32 order);
+ U32 getSortOrder() const;
private:
- std::string mSortOrderSetting;
- int mClipboardState;
+ std::string mSortOrderSetting;
+ int mClipboardState;
- //--------------------------------------------------------------------
- // Hidden folders
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Hidden folders
+ //--------------------------------------------------------------------
public:
- void addHideFolderType(LLFolderType::EType folder_type);
+ void addHideFolderType(LLFolderType::EType folder_type);
protected:
- // Builds the UI. Call this once the inventory is usable.
- void initializeViews(F64 max_time);
+ // Builds the UI. Call this once the inventory is usable.
+ void initializeViews(F64 max_time);
- // Specific inventory colors
- static bool sColorSetInitialized;
- static LLUIColor sDefaultColor;
- static LLUIColor sDefaultHighlightColor;
- static LLUIColor sLibraryColor;
- static LLUIColor sLinkColor;
+ // Specific inventory colors
+ static bool sColorSetInitialized;
+ static LLUIColor sDefaultColor;
+ static LLUIColor sDefaultHighlightColor;
+ static LLUIColor sLibraryColor;
+ static LLUIColor sLinkColor;
enum EBuildModes
{
@@ -352,29 +352,29 @@ protected:
// All buildNewViews() use BUILD_TIMELIMIT by default
// and expect time limit mBuildViewsEndTime to be set
- LLFolderViewItem* buildNewViews(const LLUUID& id);
- LLFolderViewItem* buildNewViews(const LLUUID& id,
+ LLFolderViewItem* buildNewViews(const LLUUID& id);
+ LLFolderViewItem* buildNewViews(const LLUUID& id,
LLInventoryObject const* objectp);
- LLFolderViewItem* buildNewViews(const LLUUID& id,
+ LLFolderViewItem* buildNewViews(const LLUUID& id,
LLInventoryObject const* objectp,
LLFolderViewItem *target_view,
const EBuildModes &mode = BUILD_TIMELIMIT);
// if certain types are not allowed, no reason to create views
- virtual bool typedViewsFilter(const LLUUID& id, LLInventoryObject const* objectp) { return true; }
+ virtual bool typedViewsFilter(const LLUUID& id, LLInventoryObject const* objectp) { return true; }
+
+ virtual void itemChanged(const LLUUID& item_id, U32 mask, const LLInventoryObject* model_item);
+ BOOL getIsHiddenFolderType(LLFolderType::EType folder_type) const;
- virtual void itemChanged(const LLUUID& item_id, U32 mask, const LLInventoryObject* model_item);
- BOOL getIsHiddenFolderType(LLFolderType::EType folder_type) const;
-
virtual LLFolderView * createFolderRoot(LLUUID root_id );
- virtual LLFolderViewFolder* createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop);
- virtual LLFolderViewItem* createFolderViewItem(LLInvFVBridge * bridge);
+ virtual LLFolderViewFolder* createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop);
+ virtual LLFolderViewItem* createFolderViewItem(LLInvFVBridge * bridge);
boost::function<void(const std::deque<LLFolderViewItem*>& items, BOOL user_action)> mSelectionCallback;
private:
// buildViewsTree does not include some checks and is meant
// for recursive use, use buildNewViews() for first call
- LLFolderViewItem* buildViewsTree(const LLUUID& id,
+ LLFolderViewItem* buildViewsTree(const LLUUID& id,
const LLUUID& parent_id,
LLInventoryObject const* objectp,
LLFolderViewItem *target_view,
@@ -390,10 +390,10 @@ private:
VIEWS_INITIALIZED,
} EViewsInitializationState;
- bool mBuildViewsOnInit;
- EViewsInitializationState mViewsInitialized; // Whether views have been generated
- F64 mBuildViewsEndTime; // Stop building views past this timestamp
- std::deque<LLUUID> mBuildViewsQueue;
+ bool mBuildViewsOnInit;
+ EViewsInitializationState mViewsInitialized; // Whether views have been generated
+ F64 mBuildViewsEndTime; // Stop building views past this timestamp
+ std::deque<LLUUID> mBuildViewsQueue;
};
@@ -439,7 +439,7 @@ protected:
void updateSingleFolderRoot();
friend class LLUICtrlFactory;
-
+
LLUUID mFolderID;
std::list<LLUUID> mBackwardFolders;
std::list<LLUUID> mForwardFolders;
@@ -459,7 +459,7 @@ public:
struct Params
: public LLInitParam::Block<Params, LLInventoryPanel::Params>
{
- Mandatory<std::string> filter_asset_types;
+ Mandatory<std::string> filter_asset_types;
Params() : filter_asset_types("filter_asset_types") {}
};
@@ -478,8 +478,8 @@ public:
std::string& tooltip_msg) override;
protected:
- /*virtual*/ bool typedViewsFilter(const LLUUID& id, LLInventoryObject const* objectp) override;
- /*virtual*/ void itemChanged(const LLUUID& item_id, U32 mask, const LLInventoryObject* model_item) override;
+ /*virtual*/ bool typedViewsFilter(const LLUUID& id, LLInventoryObject const* objectp) override;
+ /*virtual*/ void itemChanged(const LLUUID& item_id, U32 mask, const LLInventoryObject* model_item) override;
private:
bool mAssetTypes[LLAssetType::AT_COUNT];
diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp
index 79fafade2d..70a8020d78 100644
--- a/indra/newview/lljoystickbutton.cpp
+++ b/indra/newview/lljoystickbutton.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lljoystickbutton.cpp
* @brief LLJoystick class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,7 +52,7 @@ static LLDefaultChildRegistry::Register<LLJoystickCameraTrack> r5("joystick_trac
static LLDefaultChildRegistry::Register<LLJoystickQuaternion> r6("joystick_quat");
-const F32 NUDGE_TIME = 0.25f; // in seconds
+const F32 NUDGE_TIME = 0.25f; // in seconds
const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed
const S32 CENTER_DOT_RADIUS = 7;
@@ -62,222 +62,222 @@ const S32 CENTER_DOT_RADIUS = 7;
//
void QuadrantNames::declareValues()
{
- declare("origin", JQ_ORIGIN);
- declare("up", JQ_UP);
- declare("down", JQ_DOWN);
- declare("left", JQ_LEFT);
- declare("right", JQ_RIGHT);
+ declare("origin", JQ_ORIGIN);
+ declare("up", JQ_UP);
+ declare("down", JQ_DOWN);
+ declare("left", JQ_LEFT);
+ declare("right", JQ_RIGHT);
}
LLJoystick::LLJoystick(const LLJoystick::Params& p)
-: LLButton(p),
- mInitialOffset(0, 0),
- mLastMouse(0, 0),
- mFirstMouse(0, 0),
- mVertSlopNear(0),
- mVertSlopFar(0),
- mHorizSlopNear(0),
- mHorizSlopFar(0),
- mHeldDown(FALSE),
- mHeldDownTimer(),
- mInitialQuadrant(p.quadrant)
+: LLButton(p),
+ mInitialOffset(0, 0),
+ mLastMouse(0, 0),
+ mFirstMouse(0, 0),
+ mVertSlopNear(0),
+ mVertSlopFar(0),
+ mHorizSlopNear(0),
+ mHorizSlopFar(0),
+ mHeldDown(FALSE),
+ mHeldDownTimer(),
+ mInitialQuadrant(p.quadrant)
{
- setHeldDownCallback(&LLJoystick::onBtnHeldDown, this);
+ setHeldDownCallback(&LLJoystick::onBtnHeldDown, this);
}
void LLJoystick::updateSlop()
{
- mVertSlopNear = getRect().getHeight();
- mVertSlopFar = getRect().getHeight() * 2;
-
- mHorizSlopNear = getRect().getWidth();
- mHorizSlopFar = getRect().getWidth() * 2;
-
- // Compute initial mouse offset based on initial quadrant.
- // Place the mouse evenly between the near and far zones.
- switch (mInitialQuadrant)
- {
- case JQ_ORIGIN:
- mInitialOffset.set(0, 0);
- break;
-
- case JQ_UP:
- mInitialOffset.mX = 0;
- mInitialOffset.mY = (mVertSlopNear + mVertSlopFar) / 2;
- break;
-
- case JQ_DOWN:
- mInitialOffset.mX = 0;
- mInitialOffset.mY = - (mVertSlopNear + mVertSlopFar) / 2;
- break;
-
- case JQ_LEFT:
- mInitialOffset.mX = - (mHorizSlopNear + mHorizSlopFar) / 2;
- mInitialOffset.mY = 0;
- break;
-
- case JQ_RIGHT:
- mInitialOffset.mX = (mHorizSlopNear + mHorizSlopFar) / 2;
- mInitialOffset.mY = 0;
- break;
-
- default:
- LL_ERRS() << "LLJoystick::LLJoystick() - bad switch case" << LL_ENDL;
- break;
- }
-
- return;
-}
-
-bool LLJoystick::pointInCircle(S32 x, S32 y) const
-{
- if(this->getLocalRect().getHeight() != this->getLocalRect().getWidth())
- {
- LL_WARNS() << "Joystick shape is not square"<<LL_ENDL;
- return true;
- }
- //center is x and y coordinates of center of joystick circle, and also its radius
- int center = this->getLocalRect().getHeight()/2;
- bool in_circle = (x - center) * (x - center) + (y - center) * (y - center) <= center * center;
-
- return in_circle;
+ mVertSlopNear = getRect().getHeight();
+ mVertSlopFar = getRect().getHeight() * 2;
+
+ mHorizSlopNear = getRect().getWidth();
+ mHorizSlopFar = getRect().getWidth() * 2;
+
+ // Compute initial mouse offset based on initial quadrant.
+ // Place the mouse evenly between the near and far zones.
+ switch (mInitialQuadrant)
+ {
+ case JQ_ORIGIN:
+ mInitialOffset.set(0, 0);
+ break;
+
+ case JQ_UP:
+ mInitialOffset.mX = 0;
+ mInitialOffset.mY = (mVertSlopNear + mVertSlopFar) / 2;
+ break;
+
+ case JQ_DOWN:
+ mInitialOffset.mX = 0;
+ mInitialOffset.mY = - (mVertSlopNear + mVertSlopFar) / 2;
+ break;
+
+ case JQ_LEFT:
+ mInitialOffset.mX = - (mHorizSlopNear + mHorizSlopFar) / 2;
+ mInitialOffset.mY = 0;
+ break;
+
+ case JQ_RIGHT:
+ mInitialOffset.mX = (mHorizSlopNear + mHorizSlopFar) / 2;
+ mInitialOffset.mY = 0;
+ break;
+
+ default:
+ LL_ERRS() << "LLJoystick::LLJoystick() - bad switch case" << LL_ENDL;
+ break;
+ }
+
+ return;
+}
+
+bool LLJoystick::pointInCircle(S32 x, S32 y) const
+{
+ if(this->getLocalRect().getHeight() != this->getLocalRect().getWidth())
+ {
+ LL_WARNS() << "Joystick shape is not square"<<LL_ENDL;
+ return true;
+ }
+ //center is x and y coordinates of center of joystick circle, and also its radius
+ int center = this->getLocalRect().getHeight()/2;
+ bool in_circle = (x - center) * (x - center) + (y - center) * (y - center) <= center * center;
+
+ return in_circle;
}
bool LLJoystick::pointInCenterDot(S32 x, S32 y, S32 radius) const
{
- if (this->getLocalRect().getHeight() != this->getLocalRect().getWidth())
- {
- LL_WARNS() << "Joystick shape is not square" << LL_ENDL;
- return true;
- }
+ if (this->getLocalRect().getHeight() != this->getLocalRect().getWidth())
+ {
+ LL_WARNS() << "Joystick shape is not square" << LL_ENDL;
+ return true;
+ }
- S32 center = this->getLocalRect().getHeight() / 2;
+ S32 center = this->getLocalRect().getHeight() / 2;
- bool in_center_circle = (x - center) * (x - center) + (y - center) * (y - center) <= radius * radius;
+ bool in_center_circle = (x - center) * (x - center) + (y - center) * (y - center) <= radius * radius;
- return in_center_circle;
+ return in_center_circle;
}
BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask)
{
- //LL_INFOS() << "joystick mouse down " << x << ", " << y << LL_ENDL;
- bool handles = false;
+ //LL_INFOS() << "joystick mouse down " << x << ", " << y << LL_ENDL;
+ bool handles = false;
- if(pointInCircle(x, y))
- {
- mLastMouse.set(x, y);
- mFirstMouse.set(x, y);
- mMouseDownTimer.reset();
- handles = LLButton::handleMouseDown(x, y, mask);
- }
+ if(pointInCircle(x, y))
+ {
+ mLastMouse.set(x, y);
+ mFirstMouse.set(x, y);
+ mMouseDownTimer.reset();
+ handles = LLButton::handleMouseDown(x, y, mask);
+ }
- return handles;
+ return handles;
}
BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask)
{
- // LL_INFOS() << "joystick mouse up " << x << ", " << y << LL_ENDL;
+ // LL_INFOS() << "joystick mouse up " << x << ", " << y << LL_ENDL;
- if( hasMouseCapture() )
- {
- mLastMouse.set(x, y);
- mHeldDown = FALSE;
- onMouseUp();
- }
+ if( hasMouseCapture() )
+ {
+ mLastMouse.set(x, y);
+ mHeldDown = FALSE;
+ onMouseUp();
+ }
- return LLButton::handleMouseUp(x, y, mask);
+ return LLButton::handleMouseUp(x, y, mask);
}
BOOL LLJoystick::handleHover(S32 x, S32 y, MASK mask)
{
- if( hasMouseCapture() )
- {
- mLastMouse.set(x, y);
- }
+ if( hasMouseCapture() )
+ {
+ mLastMouse.set(x, y);
+ }
- return LLButton::handleHover(x, y, mask);
+ return LLButton::handleHover(x, y, mask);
}
F32 LLJoystick::getElapsedHeldDownTime()
{
- if( mHeldDown )
- {
- return getHeldDownTime();
- }
- else
- {
- return 0.f;
- }
+ if( mHeldDown )
+ {
+ return getHeldDownTime();
+ }
+ else
+ {
+ return 0.f;
+ }
}
// static
void LLJoystick::onBtnHeldDown(void *userdata)
{
- LLJoystick *self = (LLJoystick *)userdata;
- if (self)
- {
- self->mHeldDown = TRUE;
- self->onHeldDown();
- }
+ LLJoystick *self = (LLJoystick *)userdata;
+ if (self)
+ {
+ self->mHeldDown = TRUE;
+ self->onHeldDown();
+ }
}
EJoystickQuadrant LLJoystick::selectQuadrant(LLXMLNodePtr node)
{
-
- EJoystickQuadrant quadrant = JQ_RIGHT;
- if (node->hasAttribute("quadrant"))
- {
- std::string quadrant_name;
- node->getAttributeString("quadrant", quadrant_name);
+ EJoystickQuadrant quadrant = JQ_RIGHT;
+
+ if (node->hasAttribute("quadrant"))
+ {
+ std::string quadrant_name;
+ node->getAttributeString("quadrant", quadrant_name);
- quadrant = quadrantFromName(quadrant_name);
- }
- return quadrant;
+ quadrant = quadrantFromName(quadrant_name);
+ }
+ return quadrant;
}
-std::string LLJoystick::nameFromQuadrant(EJoystickQuadrant quadrant)
+std::string LLJoystick::nameFromQuadrant(EJoystickQuadrant quadrant)
{
- if (quadrant == JQ_ORIGIN) return std::string("origin");
- else if (quadrant == JQ_UP) return std::string("up");
- else if (quadrant == JQ_DOWN) return std::string("down");
- else if (quadrant == JQ_LEFT) return std::string("left");
- else if (quadrant == JQ_RIGHT) return std::string("right");
- else return std::string();
+ if (quadrant == JQ_ORIGIN) return std::string("origin");
+ else if (quadrant == JQ_UP) return std::string("up");
+ else if (quadrant == JQ_DOWN) return std::string("down");
+ else if (quadrant == JQ_LEFT) return std::string("left");
+ else if (quadrant == JQ_RIGHT) return std::string("right");
+ else return std::string();
}
EJoystickQuadrant LLJoystick::quadrantFromName(const std::string& sQuadrant)
{
- EJoystickQuadrant quadrant = JQ_RIGHT;
-
- if (sQuadrant == "origin")
- {
- quadrant = JQ_ORIGIN;
- }
- else if (sQuadrant == "up")
- {
- quadrant = JQ_UP;
- }
- else if (sQuadrant == "down")
- {
- quadrant = JQ_DOWN;
- }
- else if (sQuadrant == "left")
- {
- quadrant = JQ_LEFT;
- }
- else if (sQuadrant == "right")
- {
- quadrant = JQ_RIGHT;
- }
-
- return quadrant;
+ EJoystickQuadrant quadrant = JQ_RIGHT;
+
+ if (sQuadrant == "origin")
+ {
+ quadrant = JQ_ORIGIN;
+ }
+ else if (sQuadrant == "up")
+ {
+ quadrant = JQ_UP;
+ }
+ else if (sQuadrant == "down")
+ {
+ quadrant = JQ_DOWN;
+ }
+ else if (sQuadrant == "left")
+ {
+ quadrant = JQ_LEFT;
+ }
+ else if (sQuadrant == "right")
+ {
+ quadrant = JQ_RIGHT;
+ }
+
+ return quadrant;
}
@@ -287,62 +287,62 @@ EJoystickQuadrant LLJoystick::quadrantFromName(const std::string& sQuadrant)
void LLJoystickAgentTurn::onHeldDown()
{
- F32 time = getElapsedHeldDownTime();
- updateSlop();
-
- //LL_INFOS() << "move forward/backward (and/or turn)" << LL_ENDL;
-
- S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
- S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
-
- float m = (float) (dx)/abs(dy);
-
- if (m > 1) {
- m = 1;
- }
- else if (m < -1) {
- m = -1;
- }
- gAgent.moveYaw(-LLFloaterMove::getYawRate(time)*m);
-
-
- // handle forward/back movement
- if (dy > mVertSlopFar)
- {
- // ...if mouse is forward of run region run forward
- gAgent.moveAt(1);
- }
- else if (dy > mVertSlopNear)
- {
- if( time < NUDGE_TIME )
- {
- gAgent.moveAtNudge(1);
- }
- else
- {
- // ...else if mouse is forward of walk region walk forward
- // JC 9/5/2002 - Always run / move quickly.
- gAgent.moveAt(1);
- }
- }
- else if (dy < -mVertSlopFar)
- {
- // ...else if mouse is behind run region run backward
- gAgent.moveAt(-1);
- }
- else if (dy < -mVertSlopNear)
- {
- if( time < NUDGE_TIME )
- {
- gAgent.moveAtNudge(-1);
- }
- else
- {
- // ...else if mouse is behind walk region walk backward
- // JC 9/5/2002 - Always run / move quickly.
- gAgent.moveAt(-1);
- }
- }
+ F32 time = getElapsedHeldDownTime();
+ updateSlop();
+
+ //LL_INFOS() << "move forward/backward (and/or turn)" << LL_ENDL;
+
+ S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
+ S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
+
+ float m = (float) (dx)/abs(dy);
+
+ if (m > 1) {
+ m = 1;
+ }
+ else if (m < -1) {
+ m = -1;
+ }
+ gAgent.moveYaw(-LLFloaterMove::getYawRate(time)*m);
+
+
+ // handle forward/back movement
+ if (dy > mVertSlopFar)
+ {
+ // ...if mouse is forward of run region run forward
+ gAgent.moveAt(1);
+ }
+ else if (dy > mVertSlopNear)
+ {
+ if( time < NUDGE_TIME )
+ {
+ gAgent.moveAtNudge(1);
+ }
+ else
+ {
+ // ...else if mouse is forward of walk region walk forward
+ // JC 9/5/2002 - Always run / move quickly.
+ gAgent.moveAt(1);
+ }
+ }
+ else if (dy < -mVertSlopFar)
+ {
+ // ...else if mouse is behind run region run backward
+ gAgent.moveAt(-1);
+ }
+ else if (dy < -mVertSlopNear)
+ {
+ if( time < NUDGE_TIME )
+ {
+ gAgent.moveAtNudge(-1);
+ }
+ else
+ {
+ // ...else if mouse is behind walk region walk backward
+ // JC 9/5/2002 - Always run / move quickly.
+ gAgent.moveAt(-1);
+ }
+ }
}
//-------------------------------------------------------------------------------
@@ -351,65 +351,65 @@ void LLJoystickAgentTurn::onHeldDown()
void LLJoystickAgentSlide::onMouseUp()
{
- F32 time = getElapsedHeldDownTime();
- if( time < NUDGE_TIME )
- {
- switch (mInitialQuadrant)
- {
- case JQ_LEFT:
- gAgent.moveLeftNudge(1);
- break;
-
- case JQ_RIGHT:
- gAgent.moveLeftNudge(-1);
- break;
-
- default:
- break;
- }
- }
+ F32 time = getElapsedHeldDownTime();
+ if( time < NUDGE_TIME )
+ {
+ switch (mInitialQuadrant)
+ {
+ case JQ_LEFT:
+ gAgent.moveLeftNudge(1);
+ break;
+
+ case JQ_RIGHT:
+ gAgent.moveLeftNudge(-1);
+ break;
+
+ default:
+ break;
+ }
+ }
}
void LLJoystickAgentSlide::onHeldDown()
{
- //LL_INFOS() << "slide left/right (and/or move forward/backward)" << LL_ENDL;
-
- updateSlop();
-
- S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
- S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
-
- // handle left-right sliding
- if (dx > mHorizSlopNear)
- {
- gAgent.moveLeft(-1);
- }
- else if (dx < -mHorizSlopNear)
- {
- gAgent.moveLeft(1);
- }
-
- // handle forward/back movement
- if (dy > mVertSlopFar)
- {
- // ...if mouse is forward of run region run forward
- gAgent.moveAt(1);
- }
- else if (dy > mVertSlopNear)
- {
- // ...else if mouse is forward of walk region walk forward
- gAgent.moveAtNudge(1);
- }
- else if (dy < -mVertSlopFar)
- {
- // ...else if mouse is behind run region run backward
- gAgent.moveAt(-1);
- }
- else if (dy < -mVertSlopNear)
- {
- // ...else if mouse is behind walk region walk backward
- gAgent.moveAtNudge(-1);
- }
+ //LL_INFOS() << "slide left/right (and/or move forward/backward)" << LL_ENDL;
+
+ updateSlop();
+
+ S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
+ S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
+
+ // handle left-right sliding
+ if (dx > mHorizSlopNear)
+ {
+ gAgent.moveLeft(-1);
+ }
+ else if (dx < -mHorizSlopNear)
+ {
+ gAgent.moveLeft(1);
+ }
+
+ // handle forward/back movement
+ if (dy > mVertSlopFar)
+ {
+ // ...if mouse is forward of run region run forward
+ gAgent.moveAt(1);
+ }
+ else if (dy > mVertSlopNear)
+ {
+ // ...else if mouse is forward of walk region walk forward
+ gAgent.moveAtNudge(1);
+ }
+ else if (dy < -mVertSlopFar)
+ {
+ // ...else if mouse is behind run region run backward
+ gAgent.moveAt(-1);
+ }
+ else if (dy < -mVertSlopNear)
+ {
+ // ...else if mouse is behind walk region walk backward
+ gAgent.moveAtNudge(-1);
+ }
}
@@ -418,240 +418,240 @@ void LLJoystickAgentSlide::onHeldDown()
//-------------------------------------------------------------------------------
LLJoystickCameraRotate::LLJoystickCameraRotate(const LLJoystickCameraRotate::Params& p)
-: LLJoystick(p),
- mInLeft( FALSE ),
- mInTop( FALSE ),
- mInRight( FALSE ),
- mInBottom( FALSE ),
- mInCenter( FALSE )
-{
- mCenterImageName = "Cam_Rotate_Center";
+: LLJoystick(p),
+ mInLeft( FALSE ),
+ mInTop( FALSE ),
+ mInRight( FALSE ),
+ mInBottom( FALSE ),
+ mInCenter( FALSE )
+{
+ mCenterImageName = "Cam_Rotate_Center";
}
void LLJoystickCameraRotate::updateSlop()
{
- // do the initial offset calculation based on mousedown location
+ // do the initial offset calculation based on mousedown location
- // small fixed slop region
- mVertSlopNear = 16;
- mVertSlopFar = 32;
+ // small fixed slop region
+ mVertSlopNear = 16;
+ mVertSlopFar = 32;
- mHorizSlopNear = 16;
- mHorizSlopFar = 32;
+ mHorizSlopNear = 16;
+ mHorizSlopFar = 32;
- return;
+ return;
}
BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask)
{
- gAgent.setMovementLocked(TRUE);
- updateSlop();
-
- // Set initial offset based on initial click location
- S32 horiz_center = getRect().getWidth() / 2;
- S32 vert_center = getRect().getHeight() / 2;
-
- S32 dx = x - horiz_center;
- S32 dy = y - vert_center;
-
- if (pointInCenterDot(x, y, CENTER_DOT_RADIUS))
- {
- mInitialOffset.mX = 0;
- mInitialOffset.mY = 0;
- mInitialQuadrant = JQ_ORIGIN;
- mInCenter = TRUE;
-
- resetJoystickCamera();
- }
- else if (dy > dx && dy > -dx)
- {
- // top
- mInitialOffset.mX = 0;
- mInitialOffset.mY = (mVertSlopNear + mVertSlopFar) / 2;
- mInitialQuadrant = JQ_UP;
- }
- else if (dy > dx && dy <= -dx)
- {
- // left
- mInitialOffset.mX = - (mHorizSlopNear + mHorizSlopFar) / 2;
- mInitialOffset.mY = 0;
- mInitialQuadrant = JQ_LEFT;
- }
- else if (dy <= dx && dy <= -dx)
- {
- // bottom
- mInitialOffset.mX = 0;
- mInitialOffset.mY = - (mVertSlopNear + mVertSlopFar) / 2;
- mInitialQuadrant = JQ_DOWN;
- }
- else
- {
- // right
- mInitialOffset.mX = (mHorizSlopNear + mHorizSlopFar) / 2;
- mInitialOffset.mY = 0;
- mInitialQuadrant = JQ_RIGHT;
- }
-
- return LLJoystick::handleMouseDown(x, y, mask);
+ gAgent.setMovementLocked(TRUE);
+ updateSlop();
+
+ // Set initial offset based on initial click location
+ S32 horiz_center = getRect().getWidth() / 2;
+ S32 vert_center = getRect().getHeight() / 2;
+
+ S32 dx = x - horiz_center;
+ S32 dy = y - vert_center;
+
+ if (pointInCenterDot(x, y, CENTER_DOT_RADIUS))
+ {
+ mInitialOffset.mX = 0;
+ mInitialOffset.mY = 0;
+ mInitialQuadrant = JQ_ORIGIN;
+ mInCenter = TRUE;
+
+ resetJoystickCamera();
+ }
+ else if (dy > dx && dy > -dx)
+ {
+ // top
+ mInitialOffset.mX = 0;
+ mInitialOffset.mY = (mVertSlopNear + mVertSlopFar) / 2;
+ mInitialQuadrant = JQ_UP;
+ }
+ else if (dy > dx && dy <= -dx)
+ {
+ // left
+ mInitialOffset.mX = - (mHorizSlopNear + mHorizSlopFar) / 2;
+ mInitialOffset.mY = 0;
+ mInitialQuadrant = JQ_LEFT;
+ }
+ else if (dy <= dx && dy <= -dx)
+ {
+ // bottom
+ mInitialOffset.mX = 0;
+ mInitialOffset.mY = - (mVertSlopNear + mVertSlopFar) / 2;
+ mInitialQuadrant = JQ_DOWN;
+ }
+ else
+ {
+ // right
+ mInitialOffset.mX = (mHorizSlopNear + mHorizSlopFar) / 2;
+ mInitialOffset.mY = 0;
+ mInitialQuadrant = JQ_RIGHT;
+ }
+
+ return LLJoystick::handleMouseDown(x, y, mask);
}
BOOL LLJoystickCameraRotate::handleMouseUp(S32 x, S32 y, MASK mask)
{
- gAgent.setMovementLocked(FALSE);
- mInCenter = FALSE;
- return LLJoystick::handleMouseUp(x, y, mask);
+ gAgent.setMovementLocked(FALSE);
+ mInCenter = FALSE;
+ return LLJoystick::handleMouseUp(x, y, mask);
}
BOOL LLJoystickCameraRotate::handleHover(S32 x, S32 y, MASK mask)
{
- if (!pointInCenterDot(x, y, CENTER_DOT_RADIUS))
- {
- mInCenter = FALSE;
- }
+ if (!pointInCenterDot(x, y, CENTER_DOT_RADIUS))
+ {
+ mInCenter = FALSE;
+ }
- return LLJoystick::handleHover(x, y, mask);
+ return LLJoystick::handleHover(x, y, mask);
}
void LLJoystickCameraRotate::onHeldDown()
{
- updateSlop();
-
- S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
- S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
-
- // left-right rotation
- if (dx > mHorizSlopNear)
- {
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitLeftKey(getOrbitRate());
- }
- else if (dx < -mHorizSlopNear)
- {
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitRightKey(getOrbitRate());
- }
-
- // over/under rotation
- if (dy > mVertSlopNear)
- {
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitUpKey(getOrbitRate());
- }
- else if (dy < -mVertSlopNear)
- {
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitDownKey(getOrbitRate());
- }
+ updateSlop();
+
+ S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
+ S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
+
+ // left-right rotation
+ if (dx > mHorizSlopNear)
+ {
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitLeftKey(getOrbitRate());
+ }
+ else if (dx < -mHorizSlopNear)
+ {
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitRightKey(getOrbitRate());
+ }
+
+ // over/under rotation
+ if (dy > mVertSlopNear)
+ {
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitUpKey(getOrbitRate());
+ }
+ else if (dy < -mVertSlopNear)
+ {
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitDownKey(getOrbitRate());
+ }
}
void LLJoystickCameraRotate::resetJoystickCamera()
{
- gAgentCamera.resetCameraOrbit();
+ gAgentCamera.resetCameraOrbit();
}
F32 LLJoystickCameraRotate::getOrbitRate()
{
- F32 time = getElapsedHeldDownTime();
- if( time < NUDGE_TIME )
- {
- F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME;
- //LL_INFOS() << rate << LL_ENDL;
- return rate;
- }
- else
- {
- return 1;
- }
+ F32 time = getElapsedHeldDownTime();
+ if( time < NUDGE_TIME )
+ {
+ F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME;
+ //LL_INFOS() << rate << LL_ENDL;
+ return rate;
+ }
+ else
+ {
+ return 1;
+ }
}
// Only used for drawing
void LLJoystickCameraRotate::setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom )
{
- mInLeft = left;
- mInTop = top;
- mInRight = right;
- mInBottom = bottom;
+ mInLeft = left;
+ mInTop = top;
+ mInRight = right;
+ mInBottom = bottom;
}
void LLJoystickCameraRotate::draw()
{
- LLGLSUIDefault gls_ui;
-
- getImageUnselected()->draw( 0, 0 );
- LLPointer<LLUIImage> image = getImageSelected();
-
- if (mInCenter)
- {
- drawRotatedImage(LLUI::getUIImage(mCenterImageName), 0);
- }
- else
- {
- if (mInTop)
- {
- drawRotatedImage(getImageSelected(), 0);
- }
-
- if (mInRight)
- {
- drawRotatedImage(getImageSelected(), 1);
- }
+ LLGLSUIDefault gls_ui;
- if (mInBottom)
- {
- drawRotatedImage(getImageSelected(), 2);
- }
+ getImageUnselected()->draw( 0, 0 );
+ LLPointer<LLUIImage> image = getImageSelected();
- if (mInLeft)
- {
- drawRotatedImage(getImageSelected(), 3);
- }
- }
+ if (mInCenter)
+ {
+ drawRotatedImage(LLUI::getUIImage(mCenterImageName), 0);
+ }
+ else
+ {
+ if (mInTop)
+ {
+ drawRotatedImage(getImageSelected(), 0);
+ }
+
+ if (mInRight)
+ {
+ drawRotatedImage(getImageSelected(), 1);
+ }
+
+ if (mInBottom)
+ {
+ drawRotatedImage(getImageSelected(), 2);
+ }
+
+ if (mInLeft)
+ {
+ drawRotatedImage(getImageSelected(), 3);
+ }
+ }
}
// Draws image rotated by multiples of 90 degrees
void LLJoystickCameraRotate::drawRotatedImage( LLPointer<LLUIImage> image, S32 rotations )
{
- S32 width = image->getWidth();
- S32 height = image->getHeight();
- LLTexture* texture = image->getImage();
+ S32 width = image->getWidth();
+ S32 height = image->getHeight();
+ LLTexture* texture = image->getImage();
+
+ /*
+ * Scale texture coordinate system
+ * to handle the different between image size and size of texture.
+ * If we will use default matrix,
+ * it may break texture mapping after rotation.
+ * see EXT-2023 Camera floater: arrows became shifted when pressed.
+ */
+ F32 uv[][2] =
+ {
+ { (F32)width/texture->getWidth(), (F32)height/texture->getHeight() },
+ { 0.f, (F32)height/texture->getHeight() },
+ { 0.f, 0.f },
+ { (F32)width/texture->getWidth(), 0.f }
+ };
- /*
- * Scale texture coordinate system
- * to handle the different between image size and size of texture.
- * If we will use default matrix,
- * it may break texture mapping after rotation.
- * see EXT-2023 Camera floater: arrows became shifted when pressed.
- */
- F32 uv[][2] =
- {
- { (F32)width/texture->getWidth(), (F32)height/texture->getHeight() },
- { 0.f, (F32)height/texture->getHeight() },
- { 0.f, 0.f },
- { (F32)width/texture->getWidth(), 0.f }
- };
+ gGL.getTexUnit(0)->bind(texture);
- gGL.getTexUnit(0)->bind(texture);
+ gGL.color4fv(UI_VERTEX_COLOR.mV);
- gGL.color4fv(UI_VERTEX_COLOR.mV);
-
- gGL.begin(LLRender::QUADS);
- {
- gGL.texCoord2fv( uv[ (rotations + 0) % 4]);
- gGL.vertex2i(width, height );
+ gGL.begin(LLRender::QUADS);
+ {
+ gGL.texCoord2fv( uv[ (rotations + 0) % 4]);
+ gGL.vertex2i(width, height );
- gGL.texCoord2fv( uv[ (rotations + 1) % 4]);
- gGL.vertex2i(0, height );
+ gGL.texCoord2fv( uv[ (rotations + 1) % 4]);
+ gGL.vertex2i(0, height );
- gGL.texCoord2fv( uv[ (rotations + 2) % 4]);
- gGL.vertex2i(0, 0);
+ gGL.texCoord2fv( uv[ (rotations + 2) % 4]);
+ gGL.vertex2i(0, 0);
- gGL.texCoord2fv( uv[ (rotations + 3) % 4]);
- gGL.vertex2i(width, 0);
- }
- gGL.end();
+ gGL.texCoord2fv( uv[ (rotations + 3) % 4]);
+ gGL.vertex2i(width, 0);
+ }
+ gGL.end();
}
@@ -662,50 +662,50 @@ void LLJoystickCameraRotate::drawRotatedImage( LLPointer<LLUIImage> image, S32 r
LLJoystickCameraTrack::Params::Params()
{
- held_down_delay.seconds(0.0);
+ held_down_delay.seconds(0.0);
}
LLJoystickCameraTrack::LLJoystickCameraTrack(const LLJoystickCameraTrack::Params& p)
-: LLJoystickCameraRotate(p)
+: LLJoystickCameraRotate(p)
{
- mCenterImageName = "Cam_Tracking_Center";
+ mCenterImageName = "Cam_Tracking_Center";
}
void LLJoystickCameraTrack::onHeldDown()
{
- updateSlop();
-
- S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
- S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
-
- if (dx > mVertSlopNear)
- {
- gAgentCamera.unlockView();
- gAgentCamera.setPanRightKey(getOrbitRate());
- }
- else if (dx < -mVertSlopNear)
- {
- gAgentCamera.unlockView();
- gAgentCamera.setPanLeftKey(getOrbitRate());
- }
-
- // over/under rotation
- if (dy > mVertSlopNear)
- {
- gAgentCamera.unlockView();
- gAgentCamera.setPanUpKey(getOrbitRate());
- }
- else if (dy < -mVertSlopNear)
- {
- gAgentCamera.unlockView();
- gAgentCamera.setPanDownKey(getOrbitRate());
- }
+ updateSlop();
+
+ S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
+ S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
+
+ if (dx > mVertSlopNear)
+ {
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanRightKey(getOrbitRate());
+ }
+ else if (dx < -mVertSlopNear)
+ {
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanLeftKey(getOrbitRate());
+ }
+
+ // over/under rotation
+ if (dy > mVertSlopNear)
+ {
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanUpKey(getOrbitRate());
+ }
+ else if (dy < -mVertSlopNear)
+ {
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanDownKey(getOrbitRate());
+ }
}
void LLJoystickCameraTrack::resetJoystickCamera()
{
- gAgentCamera.resetCameraPan();
+ gAgentCamera.resetCameraPan();
}
//-------------------------------------------------------------------------------
@@ -827,7 +827,7 @@ void LLJoystickQuaternion::onHeldDown()
axis.normalize();
LLQuaternion delta;
- delta.setAngleAxis(0.0523599f, axis); // about 3deg
+ delta.setAngleAxis(0.0523599f, axis); // about 3deg
mRotation *= delta;
setValue(mRotation.getValue());
diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h
index b7fdf63e58..053cf0348a 100644
--- a/indra/newview/lljoystickbutton.h
+++ b/indra/newview/lljoystickbutton.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lljoystickbutton.h
* @brief LLJoystick class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,159 +34,159 @@
typedef enum e_joystick_quadrant
{
- JQ_ORIGIN,
- JQ_UP,
- JQ_DOWN,
- JQ_LEFT,
- JQ_RIGHT
+ JQ_ORIGIN,
+ JQ_UP,
+ JQ_DOWN,
+ JQ_LEFT,
+ JQ_RIGHT
} EJoystickQuadrant;
struct QuadrantNames : public LLInitParam::TypeValuesHelper<EJoystickQuadrant, QuadrantNames>
{
- static void declareValues();
+ static void declareValues();
};
class LLJoystick
-: public LLButton
+: public LLButton
{
public:
- struct Params
- : public LLInitParam::Block<Params, LLButton::Params>
- {
- Optional<EJoystickQuadrant, QuadrantNames> quadrant;
-
- Params()
- : quadrant("quadrant", JQ_ORIGIN)
- {
- changeDefault(label, "");
- }
- };
- LLJoystick(const Params&);
-
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
-
- virtual void onMouseUp() {}
- virtual void onHeldDown() = 0;
- F32 getElapsedHeldDownTime();
-
- static void onBtnHeldDown(void *userdata); // called by llbutton callback handler
- void setInitialQuadrant(EJoystickQuadrant initial) { mInitialQuadrant = initial; };
-
- /**
- * Checks if click location is inside joystick circle.
- *
- * Image containing circle is square and this square has adherent points with joystick
- * circle. Make sure to change method according to shape other than square.
- */
- bool pointInCircle(S32 x, S32 y) const;
- bool pointInCenterDot(S32 x, S32 y, S32 radius) const;
-
- static std::string nameFromQuadrant(const EJoystickQuadrant quadrant);
- static EJoystickQuadrant quadrantFromName(const std::string& name);
- static EJoystickQuadrant selectQuadrant(LLXMLNodePtr node);
+ struct Params
+ : public LLInitParam::Block<Params, LLButton::Params>
+ {
+ Optional<EJoystickQuadrant, QuadrantNames> quadrant;
+
+ Params()
+ : quadrant("quadrant", JQ_ORIGIN)
+ {
+ changeDefault(label, "");
+ }
+ };
+ LLJoystick(const Params&);
+
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+
+ virtual void onMouseUp() {}
+ virtual void onHeldDown() = 0;
+ F32 getElapsedHeldDownTime();
+
+ static void onBtnHeldDown(void *userdata); // called by llbutton callback handler
+ void setInitialQuadrant(EJoystickQuadrant initial) { mInitialQuadrant = initial; };
+
+ /**
+ * Checks if click location is inside joystick circle.
+ *
+ * Image containing circle is square and this square has adherent points with joystick
+ * circle. Make sure to change method according to shape other than square.
+ */
+ bool pointInCircle(S32 x, S32 y) const;
+ bool pointInCenterDot(S32 x, S32 y, S32 radius) const;
+
+ static std::string nameFromQuadrant(const EJoystickQuadrant quadrant);
+ static EJoystickQuadrant quadrantFromName(const std::string& name);
+ static EJoystickQuadrant selectQuadrant(LLXMLNodePtr node);
protected:
- virtual void updateSlop(); // recompute slop margins
+ virtual void updateSlop(); // recompute slop margins
protected:
- EJoystickQuadrant mInitialQuadrant; // mousedown = click in this quadrant
- LLCoordGL mInitialOffset; // pretend mouse started here
- LLCoordGL mLastMouse; // where was mouse on last hover event
- LLCoordGL mFirstMouse; // when mouse clicked, where was it
- S32 mVertSlopNear; // where the slop regions end
- S32 mVertSlopFar; // where the slop regions end
- S32 mHorizSlopNear; // where the slop regions end
- S32 mHorizSlopFar; // where the slop regions end
- BOOL mHeldDown;
- LLFrameTimer mHeldDownTimer;
+ EJoystickQuadrant mInitialQuadrant; // mousedown = click in this quadrant
+ LLCoordGL mInitialOffset; // pretend mouse started here
+ LLCoordGL mLastMouse; // where was mouse on last hover event
+ LLCoordGL mFirstMouse; // when mouse clicked, where was it
+ S32 mVertSlopNear; // where the slop regions end
+ S32 mVertSlopFar; // where the slop regions end
+ S32 mHorizSlopNear; // where the slop regions end
+ S32 mHorizSlopFar; // where the slop regions end
+ BOOL mHeldDown;
+ LLFrameTimer mHeldDownTimer;
};
// Turn agent left and right, move forward and back
class LLJoystickAgentTurn
-: public LLJoystick
+: public LLJoystick
{
public:
- struct Params : public LLJoystick::Params {};
- LLJoystickAgentTurn(const Params& p) : LLJoystick(p) {}
- virtual void onHeldDown();
+ struct Params : public LLJoystick::Params {};
+ LLJoystickAgentTurn(const Params& p) : LLJoystick(p) {}
+ virtual void onHeldDown();
};
// Slide left and right, move forward and back
class LLJoystickAgentSlide
-: public LLJoystick
+: public LLJoystick
{
public:
- struct Params : public LLJoystick::Params {};
- LLJoystickAgentSlide(const Params& p) : LLJoystick(p) {}
+ struct Params : public LLJoystick::Params {};
+ LLJoystickAgentSlide(const Params& p) : LLJoystick(p) {}
- virtual void onHeldDown();
- virtual void onMouseUp();
+ virtual void onHeldDown();
+ virtual void onMouseUp();
};
// Rotate camera around the focus point
class LLJoystickCameraRotate
-: public LLJoystick
+: public LLJoystick
{
public:
- struct Params
- : public LLInitParam::Block<Params, LLJoystick::Params>
- {
- Params()
- {
- changeDefault(held_down_delay.seconds, 0.0);
- }
- };
-
- LLJoystickCameraRotate(const LLJoystickCameraRotate::Params&);
-
- virtual void setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom );
-
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual void onHeldDown();
- virtual void resetJoystickCamera();
- virtual void draw();
+ struct Params
+ : public LLInitParam::Block<Params, LLJoystick::Params>
+ {
+ Params()
+ {
+ changeDefault(held_down_delay.seconds, 0.0);
+ }
+ };
+
+ LLJoystickCameraRotate(const LLJoystickCameraRotate::Params&);
+
+ virtual void setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom );
+
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual void onHeldDown();
+ virtual void resetJoystickCamera();
+ virtual void draw();
protected:
- F32 getOrbitRate();
- virtual void updateSlop();
- void drawRotatedImage( LLPointer<LLUIImage> image, S32 rotations );
+ F32 getOrbitRate();
+ virtual void updateSlop();
+ void drawRotatedImage( LLPointer<LLUIImage> image, S32 rotations );
protected:
- BOOL mInLeft;
- BOOL mInTop;
- BOOL mInRight;
- BOOL mInBottom;
- BOOL mInCenter;
+ BOOL mInLeft;
+ BOOL mInTop;
+ BOOL mInRight;
+ BOOL mInBottom;
+ BOOL mInCenter;
- std::string mCenterImageName;
+ std::string mCenterImageName;
};
// Track the camera focus point forward/backward and side to side
class LLJoystickCameraTrack
-: public LLJoystickCameraRotate
+: public LLJoystickCameraRotate
{
public:
- struct Params
- : public LLInitParam::Block<Params, LLJoystickCameraRotate::Params>
- {
- Params();
- };
-
- LLJoystickCameraTrack(const LLJoystickCameraTrack::Params&);
- virtual void onHeldDown();
- virtual void resetJoystickCamera();
+ struct Params
+ : public LLInitParam::Block<Params, LLJoystickCameraRotate::Params>
+ {
+ Params();
+ };
+
+ LLJoystickCameraTrack(const LLJoystickCameraTrack::Params&);
+ virtual void onHeldDown();
+ virtual void resetJoystickCamera();
};
-//
+//
class LLJoystickQuaternion :
public LLJoystick
{
@@ -199,25 +199,25 @@ public:
LLJoystickQuaternion(const LLJoystickQuaternion::Params &);
- virtual void setToggleState(BOOL left, BOOL top, BOOL right, BOOL bottom);
+ virtual void setToggleState(BOOL left, BOOL top, BOOL right, BOOL bottom);
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual void onHeldDown();
- virtual void draw();
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual void onHeldDown();
+ virtual void draw();
void setRotation(const LLQuaternion &value);
LLQuaternion getRotation() const;
protected:
- F32 getOrbitRate();
- virtual void updateSlop();
- void drawRotatedImage(LLPointer<LLUIImage> image, S32 rotations);
-
- BOOL mInLeft;
- BOOL mInTop;
- BOOL mInRight;
- BOOL mInBottom;
+ F32 getOrbitRate();
+ virtual void updateSlop();
+ void drawRotatedImage(LLPointer<LLUIImage> image, S32 rotations);
+
+ BOOL mInLeft;
+ BOOL mInTop;
+ BOOL mInRight;
+ BOOL mInBottom;
S32 mXAxisIndex;
S32 mYAxisIndex;
diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp
index 4a0ee8fd0c..af70025647 100644
--- a/indra/newview/llkeyconflict.cpp
+++ b/indra/newview/llkeyconflict.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llkeyconflict.cpp
- * @brief
+ * @brief
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -839,7 +839,7 @@ void LLKeyConflictHandler::generatePlaceholders(ESourceMode load_mode)
// no autopilot
registerTemporaryControl("walk_to");
}
- else
+ else
{
// sitting related functions should only be avaliable in sitting mode
registerTemporaryControl("move_forward_sitting");
diff --git a/indra/newview/llkeyconflict.h b/indra/newview/llkeyconflict.h
index 23c1adf1e4..6c01ddb7a7 100644
--- a/indra/newview/llkeyconflict.h
+++ b/indra/newview/llkeyconflict.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llkeyconflict.h
- * @brief
+ * @brief
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index a17dc674ac..a5f53900ff 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllandmarkactions.cpp
* @brief LLLandmarkActions class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,344 +55,344 @@ void copy_slurl_to_clipboard_callback(const std::string& slurl);
class LLFetchlLandmarkByPos : public LLInventoryCollectFunctor
{
private:
- LLVector3d mPos;
+ LLVector3d mPos;
public:
- LLFetchlLandmarkByPos(const LLVector3d& pos) :
- mPos(pos)
- {}
-
- /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
- {
- if (!item || item->getType() != LLAssetType::AT_LANDMARK)
- return false;
-
- LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID());
- if (!landmark) // the landmark not been loaded yet
- return false;
-
- LLVector3d landmark_global_pos;
- if (!landmark->getGlobalPos(landmark_global_pos))
- return false;
- //we have to round off each coordinates to compare positions properly
- return ll_round(mPos.mdV[VX]) == ll_round(landmark_global_pos.mdV[VX])
- && ll_round(mPos.mdV[VY]) == ll_round(landmark_global_pos.mdV[VY])
- && ll_round(mPos.mdV[VZ]) == ll_round(landmark_global_pos.mdV[VZ]);
- }
+ LLFetchlLandmarkByPos(const LLVector3d& pos) :
+ mPos(pos)
+ {}
+
+ /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+ {
+ if (!item || item->getType() != LLAssetType::AT_LANDMARK)
+ return false;
+
+ LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID());
+ if (!landmark) // the landmark not been loaded yet
+ return false;
+
+ LLVector3d landmark_global_pos;
+ if (!landmark->getGlobalPos(landmark_global_pos))
+ return false;
+ //we have to round off each coordinates to compare positions properly
+ return ll_round(mPos.mdV[VX]) == ll_round(landmark_global_pos.mdV[VX])
+ && ll_round(mPos.mdV[VY]) == ll_round(landmark_global_pos.mdV[VY])
+ && ll_round(mPos.mdV[VZ]) == ll_round(landmark_global_pos.mdV[VZ]);
+ }
};
class LLFetchLandmarksByName : public LLInventoryCollectFunctor
{
private:
- std::string name;
- BOOL use_substring;
- //this member will be contain copy of founded items to keep the result unique
- std::set<std::string> check_duplicate;
+ std::string name;
+ BOOL use_substring;
+ //this member will be contain copy of founded items to keep the result unique
+ std::set<std::string> check_duplicate;
public:
LLFetchLandmarksByName(std::string &landmark_name, BOOL if_use_substring)
:name(landmark_name),
use_substring(if_use_substring)
- {
- LLStringUtil::toLower(name);
- }
+ {
+ LLStringUtil::toLower(name);
+ }
public:
- /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
- {
- if (!item || item->getType() != LLAssetType::AT_LANDMARK)
- return false;
-
- LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID());
- if (!landmark) // the landmark not been loaded yet
- return false;
-
- bool acceptable = false;
- std::string landmark_name = item->getName();
- LLStringUtil::toLower(landmark_name);
- if(use_substring)
- {
- acceptable = landmark_name.find( name ) != std::string::npos;
- }
- else
- {
- acceptable = landmark_name == name;
- }
- if(acceptable){
- if(check_duplicate.find(landmark_name) != check_duplicate.end()){
- // we have duplicated items in landmarks
- acceptable = false;
- }else{
- check_duplicate.insert(landmark_name);
- }
- }
-
- return acceptable;
- }
+ /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+ {
+ if (!item || item->getType() != LLAssetType::AT_LANDMARK)
+ return false;
+
+ LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID());
+ if (!landmark) // the landmark not been loaded yet
+ return false;
+
+ bool acceptable = false;
+ std::string landmark_name = item->getName();
+ LLStringUtil::toLower(landmark_name);
+ if(use_substring)
+ {
+ acceptable = landmark_name.find( name ) != std::string::npos;
+ }
+ else
+ {
+ acceptable = landmark_name == name;
+ }
+ if(acceptable){
+ if(check_duplicate.find(landmark_name) != check_duplicate.end()){
+ // we have duplicated items in landmarks
+ acceptable = false;
+ }else{
+ check_duplicate.insert(landmark_name);
+ }
+ }
+
+ return acceptable;
+ }
};
// Returns true if the given inventory item is a landmark pointing to the current parcel.
// Used to find out if there is at least one landmark from current parcel.
class LLFirstAgentParcelLandmark : public LLInventoryCollectFunctor
{
-private:
- bool mFounded;// to avoid unnecessary check
-
+private:
+ bool mFounded;// to avoid unnecessary check
+
public:
- LLFirstAgentParcelLandmark(): mFounded(false){}
-
- /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
- {
- if (mFounded || !item || item->getType() != LLAssetType::AT_LANDMARK)
- return false;
-
- LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID());
- if (!landmark) // the landmark not been loaded yet
- return false;
-
- LLVector3d landmark_global_pos;
- if (!landmark->getGlobalPos(landmark_global_pos))
- return false;
- mFounded = LLViewerParcelMgr::getInstance()->inAgentParcel(landmark_global_pos);
- return mFounded;
- }
+ LLFirstAgentParcelLandmark(): mFounded(false){}
+
+ /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+ {
+ if (mFounded || !item || item->getType() != LLAssetType::AT_LANDMARK)
+ return false;
+
+ LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID());
+ if (!landmark) // the landmark not been loaded yet
+ return false;
+
+ LLVector3d landmark_global_pos;
+ if (!landmark->getGlobalPos(landmark_global_pos))
+ return false;
+ mFounded = LLViewerParcelMgr::getInstance()->inAgentParcel(landmark_global_pos);
+ return mFounded;
+ }
};
static void fetch_landmarks(LLInventoryModel::cat_array_t& cats,
- LLInventoryModel::item_array_t& items,
- LLInventoryCollectFunctor& add)
+ LLInventoryModel::item_array_t& items,
+ LLInventoryCollectFunctor& add)
{
- // Look in "My Favorites"
- const LLUUID favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- gInventory.collectDescendentsIf(favorites_folder_id,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- add);
-
- // Look in "Landmarks"
- const LLUUID landmarks_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
- gInventory.collectDescendentsIf(landmarks_folder_id,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- add);
+ // Look in "My Favorites"
+ const LLUUID favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ gInventory.collectDescendentsIf(favorites_folder_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ add);
+
+ // Look in "Landmarks"
+ const LLUUID landmarks_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ gInventory.collectDescendentsIf(landmarks_folder_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ add);
}
LLInventoryModel::item_array_t LLLandmarkActions::fetchLandmarksByName(std::string& name, BOOL use_substring)
{
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFetchLandmarksByName by_name(name, use_substring);
- fetch_landmarks(cats, items, by_name);
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFetchLandmarksByName by_name(name, use_substring);
+ fetch_landmarks(cats, items, by_name);
- return items;
+ return items;
}
bool LLLandmarkActions::landmarkAlreadyExists()
{
- // Determine whether there are landmarks pointing to the current global agent position.
- return findLandmarkForAgentPos() != NULL;
+ // Determine whether there are landmarks pointing to the current global agent position.
+ return findLandmarkForAgentPos() != NULL;
}
//static
bool LLLandmarkActions::hasParcelLandmark()
{
- LLFirstAgentParcelLandmark get_first_agent_landmark;
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- fetch_landmarks(cats, items, get_first_agent_landmark);
- return !items.empty();
-
+ LLFirstAgentParcelLandmark get_first_agent_landmark;
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ fetch_landmarks(cats, items, get_first_agent_landmark);
+ return !items.empty();
+
}
// *TODO: This could be made more efficient by only fetching the FIRST
// landmark that meets the criteria
LLViewerInventoryItem* LLLandmarkActions::findLandmarkForGlobalPos(const LLVector3d &pos)
{
- // Determine whether there are landmarks pointing to the current parcel.
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFetchlLandmarkByPos is_current_pos_landmark(pos);
- fetch_landmarks(cats, items, is_current_pos_landmark);
-
- if(items.empty())
- {
- return NULL;
- }
-
- return items[0];
+ // Determine whether there are landmarks pointing to the current parcel.
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFetchlLandmarkByPos is_current_pos_landmark(pos);
+ fetch_landmarks(cats, items, is_current_pos_landmark);
+
+ if(items.empty())
+ {
+ return NULL;
+ }
+
+ return items[0];
}
LLViewerInventoryItem* LLLandmarkActions::findLandmarkForAgentPos()
{
- return findLandmarkForGlobalPos(gAgent.getPositionGlobal());
+ return findLandmarkForGlobalPos(gAgent.getPositionGlobal());
}
void LLLandmarkActions::createLandmarkHere(
- const std::string& name,
- const std::string& desc,
- const LLUUID& folder_id)
+ const std::string& name,
+ const std::string& desc,
+ const LLUUID& folder_id)
{
- if(!gAgent.getRegion())
- {
- LL_WARNS() << "No agent region" << LL_ENDL;
- return;
- }
- LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!agent_parcel)
- {
- LL_WARNS() << "No agent parcel" << LL_ENDL;
- return;
- }
-
- create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
- folder_id, LLTransactionID::tnull,
- name, desc,
- LLAssetType::AT_LANDMARK,
- LLInventoryType::IT_LANDMARK,
+ if(!gAgent.getRegion())
+ {
+ LL_WARNS() << "No agent region" << LL_ENDL;
+ return;
+ }
+ LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!agent_parcel)
+ {
+ LL_WARNS() << "No agent parcel" << LL_ENDL;
+ return;
+ }
+
+ create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
+ folder_id, LLTransactionID::tnull,
+ name, desc,
+ LLAssetType::AT_LANDMARK,
+ LLInventoryType::IT_LANDMARK,
NO_INV_SUBTYPE, PERM_ALL,
- NULL);
+ NULL);
}
void LLLandmarkActions::createLandmarkHere()
{
- std::string landmark_name, landmark_desc;
+ std::string landmark_name, landmark_desc;
- LLAgentUI::buildLocationString(landmark_name, LLAgentUI::LOCATION_FORMAT_LANDMARK);
- LLAgentUI::buildLocationString(landmark_desc, LLAgentUI::LOCATION_FORMAT_FULL);
- const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ LLAgentUI::buildLocationString(landmark_name, LLAgentUI::LOCATION_FORMAT_LANDMARK);
+ LLAgentUI::buildLocationString(landmark_desc, LLAgentUI::LOCATION_FORMAT_FULL);
+ const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
- createLandmarkHere(landmark_name, landmark_desc, folder_id);
+ createLandmarkHere(landmark_name, landmark_desc, folder_id);
}
void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped /* = true */)
{
- std::string sim_name;
- bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
- if (gotSimName)
- {
- std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString();
- cb(slurl);
-
- return;
- }
- else
- {
- U64 new_region_handle = to_region_handle(global_pos);
-
- LLWorldMapMessage::url_callback_t url_cb = boost::bind(&LLLandmarkActions::onRegionResponseSLURL,
- cb,
- global_pos,
- escaped,
- _2);
-
- LLWorldMapMessage::getInstance()->sendHandleRegionRequest(new_region_handle, url_cb, std::string("unused"), false);
- }
+ std::string sim_name;
+ bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
+ if (gotSimName)
+ {
+ std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+ cb(slurl);
+
+ return;
+ }
+ else
+ {
+ U64 new_region_handle = to_region_handle(global_pos);
+
+ LLWorldMapMessage::url_callback_t url_cb = boost::bind(&LLLandmarkActions::onRegionResponseSLURL,
+ cb,
+ global_pos,
+ escaped,
+ _2);
+
+ LLWorldMapMessage::getInstance()->sendHandleRegionRequest(new_region_handle, url_cb, std::string("unused"), false);
+ }
}
void LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(const LLVector3d& global_pos, region_name_and_coords_callback_t cb)
{
- std::string sim_name;
- LLSimInfo* sim_infop = LLWorldMap::getInstance()->simInfoFromPosGlobal(global_pos);
- if (sim_infop)
- {
- LLVector3 pos = sim_infop->getLocalPos(global_pos);
- std::string name = sim_infop->getName() ;
- cb(name, ll_round(pos.mV[VX]), ll_round(pos.mV[VY]),ll_round(pos.mV[VZ]));
- }
- else
- {
- U64 new_region_handle = to_region_handle(global_pos);
-
- LLWorldMapMessage::url_callback_t url_cb = boost::bind(&LLLandmarkActions::onRegionResponseNameAndCoords,
- cb,
- global_pos,
- _1);
-
- LLWorldMapMessage::getInstance()->sendHandleRegionRequest(new_region_handle, url_cb, std::string("unused"), false);
- }
+ std::string sim_name;
+ LLSimInfo* sim_infop = LLWorldMap::getInstance()->simInfoFromPosGlobal(global_pos);
+ if (sim_infop)
+ {
+ LLVector3 pos = sim_infop->getLocalPos(global_pos);
+ std::string name = sim_infop->getName() ;
+ cb(name, ll_round(pos.mV[VX]), ll_round(pos.mV[VY]),ll_round(pos.mV[VZ]));
+ }
+ else
+ {
+ U64 new_region_handle = to_region_handle(global_pos);
+
+ LLWorldMapMessage::url_callback_t url_cb = boost::bind(&LLLandmarkActions::onRegionResponseNameAndCoords,
+ cb,
+ global_pos,
+ _1);
+
+ LLWorldMapMessage::getInstance()->sendHandleRegionRequest(new_region_handle, url_cb, std::string("unused"), false);
+ }
}
void LLLandmarkActions::onRegionResponseSLURL(slurl_callback_t cb,
- const LLVector3d& global_pos,
- bool escaped,
- const std::string& url)
+ const LLVector3d& global_pos,
+ bool escaped,
+ const std::string& url)
{
- std::string sim_name;
- std::string slurl;
- bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
- if (gotSimName)
- {
- slurl = LLSLURL(sim_name, global_pos).getSLURLString();
- }
- else
- {
- slurl = "";
- }
-
- cb(slurl);
+ std::string sim_name;
+ std::string slurl;
+ bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
+ if (gotSimName)
+ {
+ slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+ }
+ else
+ {
+ slurl = "";
+ }
+
+ cb(slurl);
}
void LLLandmarkActions::onRegionResponseNameAndCoords(region_name_and_coords_callback_t cb,
- const LLVector3d& global_pos,
- U64 region_handle)
+ const LLVector3d& global_pos,
+ U64 region_handle)
{
- LLSimInfo* sim_infop = LLWorldMap::getInstance()->simInfoFromHandle(region_handle);
- if (sim_infop)
- {
- LLVector3 local_pos = sim_infop->getLocalPos(global_pos);
- std::string name = sim_infop->getName() ;
- cb(name, ll_round(local_pos.mV[VX]), ll_round(local_pos.mV[VY]), ll_round(local_pos.mV[VZ]));
- }
+ LLSimInfo* sim_infop = LLWorldMap::getInstance()->simInfoFromHandle(region_handle);
+ if (sim_infop)
+ {
+ LLVector3 local_pos = sim_infop->getLocalPos(global_pos);
+ std::string name = sim_infop->getName() ;
+ cb(name, ll_round(local_pos.mV[VX]), ll_round(local_pos.mV[VY]), ll_round(local_pos.mV[VZ]));
+ }
}
bool LLLandmarkActions::getLandmarkGlobalPos(const LLUUID& landmarkInventoryItemID, LLVector3d& posGlobal)
{
- LLViewerInventoryItem* item = gInventory.getItem(landmarkInventoryItemID);
- if (NULL == item)
- return false;
+ LLViewerInventoryItem* item = gInventory.getItem(landmarkInventoryItemID);
+ if (NULL == item)
+ return false;
- const LLUUID& asset_id = item->getAssetUUID();
+ const LLUUID& asset_id = item->getAssetUUID();
- LLLandmark* landmark = gLandmarkList.getAsset(asset_id, NULL);
- if (NULL == landmark)
- return false;
+ LLLandmark* landmark = gLandmarkList.getAsset(asset_id, NULL);
+ if (NULL == landmark)
+ return false;
- return landmark->getGlobalPos(posGlobal);
+ return landmark->getGlobalPos(posGlobal);
}
LLLandmark* LLLandmarkActions::getLandmark(const LLUUID& landmarkInventoryItemID, LLLandmarkList::loaded_callback_t cb)
{
- LLViewerInventoryItem* item = gInventory.getItem(landmarkInventoryItemID);
- if (NULL == item)
- return NULL;
+ LLViewerInventoryItem* item = gInventory.getItem(landmarkInventoryItemID);
+ if (NULL == item)
+ return NULL;
- const LLUUID& asset_id = item->getAssetUUID();
+ const LLUUID& asset_id = item->getAssetUUID();
- LLLandmark* landmark = gLandmarkList.getAsset(asset_id, cb);
- if (landmark)
- {
- return landmark;
- }
+ LLLandmark* landmark = gLandmarkList.getAsset(asset_id, cb);
+ if (landmark)
+ {
+ return landmark;
+ }
- return NULL;
+ return NULL;
}
void LLLandmarkActions::copySLURLtoClipboard(const LLUUID& landmarkInventoryItemID)
{
- LLLandmark* landmark = LLLandmarkActions::getLandmark(landmarkInventoryItemID);
- if(landmark)
- {
- LLVector3d global_pos;
- landmark->getGlobalPos(global_pos);
- LLLandmarkActions::getSLURLfromPosGlobal(global_pos,&copy_slurl_to_clipboard_callback,true);
- }
+ LLLandmark* landmark = LLLandmarkActions::getLandmark(landmarkInventoryItemID);
+ if(landmark)
+ {
+ LLVector3d global_pos;
+ landmark->getGlobalPos(global_pos);
+ LLLandmarkActions::getSLURLfromPosGlobal(global_pos,&copy_slurl_to_clipboard_callback,true);
+ }
}
void copy_slurl_to_clipboard_callback(const std::string& slurl)
{
- gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(slurl));
- LLSD args;
- args["SLURL"] = slurl;
- LLNotificationsUtil::add("CopySLURL", args);
+ gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(slurl));
+ LLSD args;
+ args["SLURL"] = slurl;
+ LLNotificationsUtil::add("CopySLURL", args);
}
diff --git a/indra/newview/lllandmarkactions.h b/indra/newview/lllandmarkactions.h
index ae7b072fcb..29ffc1dcee 100644
--- a/indra/newview/lllandmarkactions.h
+++ b/indra/newview/lllandmarkactions.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllandmarkactions.h
* @brief LLLandmark class declaration
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,57 +39,57 @@ class LLLandmark;
class LLLandmarkActions
{
public:
- typedef boost::function<void(std::string& slurl)> slurl_callback_t;
- typedef boost::function<void(std::string& slurl, S32 x, S32 y, S32 z)> region_name_and_coords_callback_t;
-
- /**
- * @brief Fetches landmark LLViewerInventoryItems for the given landmark name.
- */
- static LLInventoryModel::item_array_t fetchLandmarksByName(std::string& name, BOOL if_use_substring);
- /**
- * @brief Checks whether landmark exists for current agent position.
- */
- static bool landmarkAlreadyExists();
-
- /**
- * @brief Checks whether landmark exists for current agent parcel.
- */
- static bool hasParcelLandmark();
-
- /**
- * @brief Searches landmark for global position.
- * @return Returns landmark or NULL.
- *
- * *TODO: dzaporozhan: There can be many landmarks for single parcel.
- */
- static LLViewerInventoryItem* findLandmarkForGlobalPos(const LLVector3d &pos);
-
- /**
- * @brief Searches landmark for agent global position.
- * @return Returns landmark or NULL.
- *
- * *TODO: dzaporozhan: There can be many landmarks for single parcel.
- */
- static LLViewerInventoryItem* findLandmarkForAgentPos();
-
- /**
- * @brief Creates landmark for current parcel.
- */
- static void createLandmarkHere();
-
- /**
- * @brief Creates landmark for current parcel.
- */
- static void createLandmarkHere(
- const std::string& name,
- const std::string& desc,
- const LLUUID& folder_id);
- /**
- * @brief Creates SLURL for given global position.
- */
- static void getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped = true);
-
- static void getRegionNameAndCoordsFromPosGlobal(const LLVector3d& global_pos, region_name_and_coords_callback_t cb);
+ typedef boost::function<void(std::string& slurl)> slurl_callback_t;
+ typedef boost::function<void(std::string& slurl, S32 x, S32 y, S32 z)> region_name_and_coords_callback_t;
+
+ /**
+ * @brief Fetches landmark LLViewerInventoryItems for the given landmark name.
+ */
+ static LLInventoryModel::item_array_t fetchLandmarksByName(std::string& name, BOOL if_use_substring);
+ /**
+ * @brief Checks whether landmark exists for current agent position.
+ */
+ static bool landmarkAlreadyExists();
+
+ /**
+ * @brief Checks whether landmark exists for current agent parcel.
+ */
+ static bool hasParcelLandmark();
+
+ /**
+ * @brief Searches landmark for global position.
+ * @return Returns landmark or NULL.
+ *
+ * *TODO: dzaporozhan: There can be many landmarks for single parcel.
+ */
+ static LLViewerInventoryItem* findLandmarkForGlobalPos(const LLVector3d &pos);
+
+ /**
+ * @brief Searches landmark for agent global position.
+ * @return Returns landmark or NULL.
+ *
+ * *TODO: dzaporozhan: There can be many landmarks for single parcel.
+ */
+ static LLViewerInventoryItem* findLandmarkForAgentPos();
+
+ /**
+ * @brief Creates landmark for current parcel.
+ */
+ static void createLandmarkHere();
+
+ /**
+ * @brief Creates landmark for current parcel.
+ */
+ static void createLandmarkHere(
+ const std::string& name,
+ const std::string& desc,
+ const LLUUID& folder_id);
+ /**
+ * @brief Creates SLURL for given global position.
+ */
+ static void getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped = true);
+
+ static void getRegionNameAndCoordsFromPosGlobal(const LLVector3d& global_pos, region_name_and_coords_callback_t cb);
/**
* @brief Gets landmark global position specified by inventory LLUUID.
@@ -104,14 +104,14 @@ public:
/**
* @brief Retrieve a landmark from gLandmarkList by inventory item's id
* If a landmark is not currently in the gLandmarkList a callback "cb" is called when it is loaded.
- *
+ *
* @return pointer to loaded landmark from gLandmarkList or NULL if landmark does not exist or wasn't loaded.
*/
static LLLandmark* getLandmark(const LLUUID& landmarkInventoryItemID, LLLandmarkList::loaded_callback_t cb = NULL);
/**
* @brief Performs standard action of copying of SLURL from landmark to user's clipboard.
- * This action requires additional server request. The user will be notified by info message,
+ * This action requires additional server request. The user will be notified by info message,
* when URL is copied .
*/
static void copySLURLtoClipboard(const LLUUID& landmarkInventoryItemID);
@@ -120,13 +120,13 @@ private:
LLLandmarkActions();
LLLandmarkActions(const LLLandmarkActions&);
- static void onRegionResponseSLURL(slurl_callback_t cb,
- const LLVector3d& global_pos,
- bool escaped,
- const std::string& url);
- static void onRegionResponseNameAndCoords(region_name_and_coords_callback_t cb,
- const LLVector3d& global_pos,
- U64 region_handle);
+ static void onRegionResponseSLURL(slurl_callback_t cb,
+ const LLVector3d& global_pos,
+ bool escaped,
+ const std::string& url);
+ static void onRegionResponseNameAndCoords(region_name_and_coords_callback_t cb,
+ const LLVector3d& global_pos,
+ U64 region_handle);
};
#endif //LL_LLLANDMARKACTIONS_H
diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp
index d790c6f95e..6ec77bca86 100644
--- a/indra/newview/lllandmarklist.cpp
+++ b/indra/newview/lllandmarklist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllandmarklist.cpp
* @brief Landmark asset list class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,30 +44,30 @@ LLLandmarkList gLandmarkList;
LLLandmarkList::~LLLandmarkList()
{
- std::for_each(mList.begin(), mList.end(), DeletePairedPointer());
- mList.clear();
+ std::for_each(mList.begin(), mList.end(), DeletePairedPointer());
+ mList.clear();
}
LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t cb)
{
- LLLandmark* landmark = get_ptr_in_map(mList, asset_uuid);
- if(landmark)
- {
- LLVector3d dummy;
- if(cb && !landmark->getGlobalPos(dummy))
- {
- // landmark is not completely loaded yet
- loaded_callback_map_t::value_type vt(asset_uuid, cb);
- mLoadedCallbackMap.insert(vt);
- }
- return landmark;
- }
- else
- {
- if ( mBadList.find(asset_uuid) != mBadList.end() )
- {
- return NULL;
- }
+ LLLandmark* landmark = get_ptr_in_map(mList, asset_uuid);
+ if(landmark)
+ {
+ LLVector3d dummy;
+ if(cb && !landmark->getGlobalPos(dummy))
+ {
+ // landmark is not completely loaded yet
+ loaded_callback_map_t::value_type vt(asset_uuid, cb);
+ mLoadedCallbackMap.insert(vt);
+ }
+ return landmark;
+ }
+ else
+ {
+ if ( mBadList.find(asset_uuid) != mBadList.end() )
+ {
+ return NULL;
+ }
if (cb)
{
@@ -77,40 +77,40 @@ LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t
loaded_callback_map_t::value_type vt(asset_uuid, cb);
mLoadedCallbackMap.insert(vt);
}
-
- landmark_requested_list_t::iterator iter = mRequestedList.find(asset_uuid);
- if (iter != mRequestedList.end())
- {
- const F32 rerequest_time = 30.f; // 30 seconds between requests
- if (gFrameTimeSeconds - iter->second < rerequest_time)
- {
- return NULL;
- }
- }
+
+ landmark_requested_list_t::iterator iter = mRequestedList.find(asset_uuid);
+ if (iter != mRequestedList.end())
+ {
+ const F32 rerequest_time = 30.f; // 30 seconds between requests
+ if (gFrameTimeSeconds - iter->second < rerequest_time)
+ {
+ return NULL;
+ }
+ }
mRequestedList[asset_uuid] = gFrameTimeSeconds;
// Note that getAssetData can callback immediately and cleans mRequestedList
- gAssetStorage->getAssetData(asset_uuid,
- LLAssetType::AT_LANDMARK,
- LLLandmarkList::processGetAssetReply,
- NULL);
- }
- return NULL;
+ gAssetStorage->getAssetData(asset_uuid,
+ LLAssetType::AT_LANDMARK,
+ LLLandmarkList::processGetAssetReply,
+ NULL);
+ }
+ return NULL;
}
// static
void LLLandmarkList::processGetAssetReply(
- const LLUUID& uuid,
- LLAssetType::EType type,
- void* user_data,
- S32 status,
- LLExtStat ext_status )
+ const LLUUID& uuid,
+ LLAssetType::EType type,
+ void* user_data,
+ S32 status,
+ LLExtStat ext_status )
{
- if( status == 0 )
- {
- LLFileSystem file(uuid, type);
- S32 file_length = file.getSize();
+ if( status == 0 )
+ {
+ LLFileSystem file(uuid, type);
+ S32 file_length = file.getSize();
if (file_length > 0)
{
@@ -155,40 +155,40 @@ void LLLandmarkList::processGetAssetReply(
// got a good status, but no file, shouldn't happen
gLandmarkList.eraseCallbacks(uuid);
}
- }
- else
- {
- // SJB: No use case for a notification here. Use LL_DEBUGS() instead
- if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status )
- {
- LL_WARNS("Landmarks") << "Missing Landmark" << LL_ENDL;
- //LLNotificationsUtil::add("LandmarkMissing");
- }
- else
- {
- LL_WARNS("Landmarks") << "Unable to load Landmark" << LL_ENDL;
- //LLNotificationsUtil::add("UnableToLoadLandmark");
- }
-
- gLandmarkList.mBadList.insert(uuid);
+ }
+ else
+ {
+ // SJB: No use case for a notification here. Use LL_DEBUGS() instead
+ if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status )
+ {
+ LL_WARNS("Landmarks") << "Missing Landmark" << LL_ENDL;
+ //LLNotificationsUtil::add("LandmarkMissing");
+ }
+ else
+ {
+ LL_WARNS("Landmarks") << "Unable to load Landmark" << LL_ENDL;
+ //LLNotificationsUtil::add("UnableToLoadLandmark");
+ }
+
+ gLandmarkList.mBadList.insert(uuid);
gLandmarkList.mRequestedList.erase(uuid); //mBadList effectively blocks any load, so no point keeping id in requests
gLandmarkList.eraseCallbacks(uuid);
- }
+ }
}
BOOL LLLandmarkList::isAssetInLoadedCallbackMap(const LLUUID& asset_uuid)
{
- return mLoadedCallbackMap.find(asset_uuid) != mLoadedCallbackMap.end();
+ return mLoadedCallbackMap.find(asset_uuid) != mLoadedCallbackMap.end();
}
BOOL LLLandmarkList::assetExists(const LLUUID& asset_uuid)
{
- return mList.count(asset_uuid) != 0 || mBadList.count(asset_uuid) != 0;
+ return mList.count(asset_uuid) != 0 || mBadList.count(asset_uuid) != 0;
}
void LLLandmarkList::onRegionHandle(const LLUUID& landmark_id)
{
- LLLandmark* landmark = getAsset(landmark_id);
+ LLLandmark* landmark = getAsset(landmark_id);
if (!landmark)
{
LL_WARNS() << "Got region handle but the landmark " << landmark_id << " not found." << LL_ENDL;
@@ -196,18 +196,18 @@ void LLLandmarkList::onRegionHandle(const LLUUID& landmark_id)
return;
}
- // Calculate landmark global position.
- // This should succeed since the region handle is available.
- LLVector3d pos;
- if (!landmark->getGlobalPos(pos))
- {
+ // Calculate landmark global position.
+ // This should succeed since the region handle is available.
+ LLVector3d pos;
+ if (!landmark->getGlobalPos(pos))
+ {
LL_WARNS() << "Got region handle but the landmark " << landmark_id << " global position is still unknown." << LL_ENDL;
eraseCallbacks(landmark_id);
return;
- }
+ }
// Call this even if no landmark exists to clean mLoadedCallbackMap
- makeCallbacks(landmark_id);
+ makeCallbacks(landmark_id);
}
void LLLandmarkList::eraseCallbacks(const LLUUID& landmark_id)
@@ -217,20 +217,20 @@ void LLLandmarkList::eraseCallbacks(const LLUUID& landmark_id)
void LLLandmarkList::makeCallbacks(const LLUUID& landmark_id)
{
- LLLandmark* landmark = getAsset(landmark_id);
-
- if (!landmark)
- {
- LL_WARNS() << "Landmark " << landmark_id << " to make callbacks for not found." << LL_ENDL;
- }
-
- // make all the callbacks here.
- loaded_callback_map_t::iterator it;
- while((it = mLoadedCallbackMap.find(landmark_id)) != mLoadedCallbackMap.end())
- {
- if (landmark)
- (*it).second(landmark);
-
- mLoadedCallbackMap.erase(it);
- }
+ LLLandmark* landmark = getAsset(landmark_id);
+
+ if (!landmark)
+ {
+ LL_WARNS() << "Landmark " << landmark_id << " to make callbacks for not found." << LL_ENDL;
+ }
+
+ // make all the callbacks here.
+ loaded_callback_map_t::iterator it;
+ while((it = mLoadedCallbackMap.find(landmark_id)) != mLoadedCallbackMap.end())
+ {
+ if (landmark)
+ (*it).second(landmark);
+
+ mLoadedCallbackMap.erase(it);
+ }
}
diff --git a/indra/newview/lllandmarklist.h b/indra/newview/lllandmarklist.h
index b50332b215..bea5c84a9b 100644
--- a/indra/newview/lllandmarklist.h
+++ b/indra/newview/lllandmarklist.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllandmarklist.h
* @brief Landmark asset list class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,46 +40,46 @@ class LLInventoryItem;
class LLLandmarkList
{
public:
- typedef boost::function<void(LLLandmark*)> loaded_callback_t;
+ typedef boost::function<void(LLLandmark*)> loaded_callback_t;
- LLLandmarkList() {}
- ~LLLandmarkList();
+ LLLandmarkList() {}
+ ~LLLandmarkList();
- //S32 getLength() { return mList.getLength(); }
- //const LLLandmark* getFirst() { return mList.getFirstData(); }
- //const LLLandmark* getNext() { return mList.getNextData(); }
+ //S32 getLength() { return mList.getLength(); }
+ //const LLLandmark* getFirst() { return mList.getFirstData(); }
+ //const LLLandmark* getNext() { return mList.getNextData(); }
- BOOL assetExists(const LLUUID& asset_uuid);
- LLLandmark* getAsset(const LLUUID& asset_uuid, loaded_callback_t cb = NULL);
- static void processGetAssetReply(
- const LLUUID& uuid,
- LLAssetType::EType type,
- void* user_data,
- S32 status,
- LLExtStat ext_status );
+ BOOL assetExists(const LLUUID& asset_uuid);
+ LLLandmark* getAsset(const LLUUID& asset_uuid, loaded_callback_t cb = NULL);
+ static void processGetAssetReply(
+ const LLUUID& uuid,
+ LLAssetType::EType type,
+ void* user_data,
+ S32 status,
+ LLExtStat ext_status );
- // Returns TRUE if loading the landmark with given asset_uuid has been requested
- // but is not complete yet.
- BOOL isAssetInLoadedCallbackMap(const LLUUID& asset_uuid);
+ // Returns TRUE if loading the landmark with given asset_uuid has been requested
+ // but is not complete yet.
+ BOOL isAssetInLoadedCallbackMap(const LLUUID& asset_uuid);
protected:
- void onRegionHandle(const LLUUID& landmark_id);
- void eraseCallbacks(const LLUUID& landmark_id);
- void makeCallbacks(const LLUUID& landmark_id);
-
- typedef std::map<LLUUID, LLLandmark*> landmark_list_t;
- landmark_list_t mList;
-
- typedef std::set<LLUUID> landmark_uuid_list_t;
- landmark_uuid_list_t mBadList;
-
- typedef std::map<LLUUID,F32> landmark_requested_list_t;
- landmark_requested_list_t mRequestedList;
-
- // *TODO: make the callback multimap a template class and make use of it
- // here and in LLLandmark.
- typedef std::multimap<LLUUID, loaded_callback_t> loaded_callback_map_t;
- loaded_callback_map_t mLoadedCallbackMap;
+ void onRegionHandle(const LLUUID& landmark_id);
+ void eraseCallbacks(const LLUUID& landmark_id);
+ void makeCallbacks(const LLUUID& landmark_id);
+
+ typedef std::map<LLUUID, LLLandmark*> landmark_list_t;
+ landmark_list_t mList;
+
+ typedef std::set<LLUUID> landmark_uuid_list_t;
+ landmark_uuid_list_t mBadList;
+
+ typedef std::map<LLUUID,F32> landmark_requested_list_t;
+ landmark_requested_list_t mRequestedList;
+
+ // *TODO: make the callback multimap a template class and make use of it
+ // here and in LLLandmark.
+ typedef std::multimap<LLUUID, loaded_callback_t> loaded_callback_map_t;
+ loaded_callback_map_t mLoadedCallbackMap;
};
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp
index a34dafb19a..e5b681106a 100644
--- a/indra/newview/lllegacyatmospherics.cpp
+++ b/indra/newview/lllegacyatmospherics.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllegacyatmospherics.cpp
* @brief LLAtmospherics class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,57 +53,57 @@
class LLFastLn
{
public:
- LLFastLn()
- {
- mTable[0] = 0;
- for( S32 i = 1; i < 257; i++ )
- {
- mTable[i] = log((F32)i);
- }
- }
-
- F32 ln( F32 x )
- {
- const F32 OO_255 = 0.003921568627450980392156862745098f;
- const F32 LN_255 = 5.5412635451584261462455391880218f;
-
- if( x < OO_255 )
- {
- return log(x);
- }
- else
- if( x < 1 )
- {
- x *= 255.f;
- S32 index = llfloor(x);
- F32 t = x - index;
- F32 low = mTable[index];
- F32 high = mTable[index + 1];
- return low + t * (high - low) - LN_255;
- }
- else
- if( x <= 255 )
- {
- S32 index = llfloor(x);
- F32 t = x - index;
- F32 low = mTable[index];
- F32 high = mTable[index + 1];
- return low + t * (high - low);
- }
- else
- {
- return log( x );
- }
- }
-
- F32 pow( F32 x, F32 y )
- {
- return (F32)LL_FAST_EXP(y * ln(x));
- }
+ LLFastLn()
+ {
+ mTable[0] = 0;
+ for( S32 i = 1; i < 257; i++ )
+ {
+ mTable[i] = log((F32)i);
+ }
+ }
+
+ F32 ln( F32 x )
+ {
+ const F32 OO_255 = 0.003921568627450980392156862745098f;
+ const F32 LN_255 = 5.5412635451584261462455391880218f;
+
+ if( x < OO_255 )
+ {
+ return log(x);
+ }
+ else
+ if( x < 1 )
+ {
+ x *= 255.f;
+ S32 index = llfloor(x);
+ F32 t = x - index;
+ F32 low = mTable[index];
+ F32 high = mTable[index + 1];
+ return low + t * (high - low) - LN_255;
+ }
+ else
+ if( x <= 255 )
+ {
+ S32 index = llfloor(x);
+ F32 t = x - index;
+ F32 low = mTable[index];
+ F32 high = mTable[index + 1];
+ return low + t * (high - low);
+ }
+ else
+ {
+ return log( x );
+ }
+ }
+
+ F32 pow( F32 x, F32 y )
+ {
+ return (F32)LL_FAST_EXP(y * ln(x));
+ }
private:
- F32 mTable[257]; // index 0 is unused
+ F32 mTable[257]; // index 0 is unused
};
static LLFastLn gFastLn;
@@ -113,81 +113,81 @@ static LLFastLn gFastLn;
inline F32 LLHaze::calcPhase(const F32 cos_theta) const
{
- const F32 g2 = mG * mG;
- const F32 den = 1 + g2 - 2 * mG * cos_theta;
- return (1 - g2) * gFastLn.pow(den, -1.5);
+ const F32 g2 = mG * mG;
+ const F32 den = 1 + g2 - 2 * mG * cos_theta;
+ return (1 - g2) * gFastLn.pow(den, -1.5);
}
inline void color_pow(LLColor3 &col, const F32 e)
{
- col.mV[0] = gFastLn.pow(col.mV[0], e);
- col.mV[1] = gFastLn.pow(col.mV[1], e);
- col.mV[2] = gFastLn.pow(col.mV[2], e);
+ col.mV[0] = gFastLn.pow(col.mV[0], e);
+ col.mV[1] = gFastLn.pow(col.mV[1], e);
+ col.mV[2] = gFastLn.pow(col.mV[2], e);
}
inline LLColor3 color_norm(const LLColor3 &col)
{
- const F32 m = color_max(col);
- if (m > 1.f)
- {
- return 1.f/m * col;
- }
- else return col;
+ const F32 m = color_max(col);
+ if (m > 1.f)
+ {
+ return 1.f/m * col;
+ }
+ else return col;
}
inline void color_gamma_correct(LLColor3 &col)
{
- const F32 gamma_inv = 1.f/1.2f;
- if (col.mV[0] != 0.f)
- {
- col.mV[0] = gFastLn.pow(col.mV[0], gamma_inv);
- }
- if (col.mV[1] != 0.f)
- {
- col.mV[1] = gFastLn.pow(col.mV[1], gamma_inv);
- }
- if (col.mV[2] != 0.f)
- {
- col.mV[2] = gFastLn.pow(col.mV[2], gamma_inv);
- }
+ const F32 gamma_inv = 1.f/1.2f;
+ if (col.mV[0] != 0.f)
+ {
+ col.mV[0] = gFastLn.pow(col.mV[0], gamma_inv);
+ }
+ if (col.mV[1] != 0.f)
+ {
+ col.mV[1] = gFastLn.pow(col.mV[1], gamma_inv);
+ }
+ if (col.mV[2] != 0.f)
+ {
+ col.mV[2] = gFastLn.pow(col.mV[2], gamma_inv);
+ }
}
static LLColor3 calc_air_sca_sea_level()
{
- static LLColor3 WAVE_LEN(675, 520, 445);
- static LLColor3 refr_ind = refr_ind_calc(WAVE_LEN);
- static LLColor3 n21 = refr_ind * refr_ind - LLColor3(1, 1, 1);
- static LLColor3 n4 = n21 * n21;
- static LLColor3 wl2 = WAVE_LEN * WAVE_LEN * 1e-6f;
- static LLColor3 wl4 = wl2 * wl2;
- static LLColor3 mult_const = fsigma * 2.0f/ 3.0f * 1e24f * (F_PI * F_PI) * n4;
- static F32 dens_div_N = F32( ATM_SEA_LEVEL_NDENS / Ndens2);
- return dens_div_N * mult_const.divide(wl4);
+ static LLColor3 WAVE_LEN(675, 520, 445);
+ static LLColor3 refr_ind = refr_ind_calc(WAVE_LEN);
+ static LLColor3 n21 = refr_ind * refr_ind - LLColor3(1, 1, 1);
+ static LLColor3 n4 = n21 * n21;
+ static LLColor3 wl2 = WAVE_LEN * WAVE_LEN * 1e-6f;
+ static LLColor3 wl4 = wl2 * wl2;
+ static LLColor3 mult_const = fsigma * 2.0f/ 3.0f * 1e24f * (F_PI * F_PI) * n4;
+ static F32 dens_div_N = F32( ATM_SEA_LEVEL_NDENS / Ndens2);
+ return dens_div_N * mult_const.divide(wl4);
}
// static constants.
LLColor3 const LLHaze::sAirScaSeaLevel = calc_air_sca_sea_level();
-F32 const LLHaze::sAirScaIntense = color_intens(LLHaze::sAirScaSeaLevel);
+F32 const LLHaze::sAirScaIntense = color_intens(LLHaze::sAirScaSeaLevel);
F32 const LLHaze::sAirScaAvg = LLHaze::sAirScaIntense / 3.f;
/***************************************
- Atmospherics
+ Atmospherics
***************************************/
LLAtmospherics::LLAtmospherics()
-: mCloudDensity(0.2f),
- mWind(0.f),
- mWorldScale(1.f)
+: mCloudDensity(0.2f),
+ mWind(0.f),
+ mWorldScale(1.f)
{
- /// WL PARAMS
- mInitialized = FALSE;
- mAmbientScale = gSavedSettings.getF32("SkyAmbientScale");
- mNightColorShift = gSavedSettings.getColor3("SkyNightColorShift");
- mFogColor.mV[VRED] = mFogColor.mV[VGREEN] = mFogColor.mV[VBLUE] = 0.5f;
- mFogColor.mV[VALPHA] = 0.0f;
- mFogRatio = 1.2f;
- mHazeConcentration = 0.f;
- mInterpVal = 0.f;
+ /// WL PARAMS
+ mInitialized = FALSE;
+ mAmbientScale = gSavedSettings.getF32("SkyAmbientScale");
+ mNightColorShift = gSavedSettings.getColor3("SkyNightColorShift");
+ mFogColor.mV[VRED] = mFogColor.mV[VGREEN] = mFogColor.mV[VBLUE] = 0.5f;
+ mFogColor.mV[VALPHA] = 0.0f;
+ mFogRatio = 1.2f;
+ mHazeConcentration = 0.f;
+ mInterpVal = 0.f;
}
@@ -197,64 +197,64 @@ LLAtmospherics::~LLAtmospherics()
void LLAtmospherics::init()
{
- const F32 haze_int = color_intens(mHaze.calcSigSca(0));
- mHazeConcentration = haze_int / (color_intens(mHaze.calcAirSca(0)) + haze_int);
- mInitialized = true;
+ const F32 haze_int = color_intens(mHaze.calcSigSca(0));
+ mHazeConcentration = haze_int / (color_intens(mHaze.calcAirSca(0)) + haze_int);
+ mInitialized = true;
}
// This cubemap is used as "environmentMap" in indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny, bool low_end)
{
- const F32 sky_saturation = 0.25f;
- const F32 land_saturation = 0.1f;
-
- if (isShiny && dir.mV[VZ] < -0.02f)
- {
- LLColor4 col;
- LLColor3 desat_fog = LLColor3(mFogColor);
- F32 brightness = desat_fog.brightness();// NOTE: Linear brightness!
- // So that shiny somewhat shows up at night.
- if (brightness < 0.15f)
- {
- brightness = 0.15f;
- desat_fog = smear(0.15f);
- }
- F32 greyscale_sat = brightness * (1.0f - land_saturation);
- desat_fog = desat_fog * land_saturation + smear(greyscale_sat);
- if (low_end)
- {
- col = LLColor4(desat_fog, 0.f);
- }
- else
- {
- col = LLColor4(desat_fog * 0.5f, 0.f);
- }
- float x = 1.0f-fabsf(-0.1f-dir.mV[VZ]);
- x *= x;
- col.mV[0] *= x*x;
- col.mV[1] *= powf(x, 2.5f);
- col.mV[2] *= x*x*x;
- return col;
- }
-
- // undo OGL_TO_CFR_ROTATION and negate vertical direction.
- LLVector3 Pn = LLVector3(-dir[1] , -dir[2], -dir[0]);
-
- //calculates hazeColor
- calcSkyColorWLVert(psky, Pn, vars);
-
- if (isShiny)
- {
- F32 brightness = vars.hazeColor.brightness();
- F32 greyscale_sat = brightness * (1.0f - sky_saturation);
- LLColor3 sky_color = vars.hazeColor * sky_saturation + smear(greyscale_sat);
- //sky_color *= (0.5f + 0.5f * brightness); // SL-12574 EEP sky is being attenuated too much
- return LLColor4(sky_color, 0.0f);
- }
-
- LLColor3 sky_color = low_end ? vars.hazeColor * 2.0f : psky->gammaCorrect(vars.hazeColor * 2.0f, vars.gamma);
-
- return LLColor4(sky_color, 0.0f);
+ const F32 sky_saturation = 0.25f;
+ const F32 land_saturation = 0.1f;
+
+ if (isShiny && dir.mV[VZ] < -0.02f)
+ {
+ LLColor4 col;
+ LLColor3 desat_fog = LLColor3(mFogColor);
+ F32 brightness = desat_fog.brightness();// NOTE: Linear brightness!
+ // So that shiny somewhat shows up at night.
+ if (brightness < 0.15f)
+ {
+ brightness = 0.15f;
+ desat_fog = smear(0.15f);
+ }
+ F32 greyscale_sat = brightness * (1.0f - land_saturation);
+ desat_fog = desat_fog * land_saturation + smear(greyscale_sat);
+ if (low_end)
+ {
+ col = LLColor4(desat_fog, 0.f);
+ }
+ else
+ {
+ col = LLColor4(desat_fog * 0.5f, 0.f);
+ }
+ float x = 1.0f-fabsf(-0.1f-dir.mV[VZ]);
+ x *= x;
+ col.mV[0] *= x*x;
+ col.mV[1] *= powf(x, 2.5f);
+ col.mV[2] *= x*x*x;
+ return col;
+ }
+
+ // undo OGL_TO_CFR_ROTATION and negate vertical direction.
+ LLVector3 Pn = LLVector3(-dir[1] , -dir[2], -dir[0]);
+
+ //calculates hazeColor
+ calcSkyColorWLVert(psky, Pn, vars);
+
+ if (isShiny)
+ {
+ F32 brightness = vars.hazeColor.brightness();
+ F32 greyscale_sat = brightness * (1.0f - sky_saturation);
+ LLColor3 sky_color = vars.hazeColor * sky_saturation + smear(greyscale_sat);
+ //sky_color *= (0.5f + 0.5f * brightness); // SL-12574 EEP sky is being attenuated too much
+ return LLColor4(sky_color, 0.0f);
+ }
+
+ LLColor3 sky_color = low_end ? vars.hazeColor * 2.0f : psky->gammaCorrect(vars.hazeColor * 2.0f, vars.gamma);
+
+ return LLColor4(sky_color, 0.0f);
}
// NOTE: Keep these in sync!
@@ -272,55 +272,55 @@ void LLAtmospherics::calcSkyColorWLVert(const LLSettingsSky::ptr_t &psky, LLVect
F32 max_y = vars.max_y;
LLVector4 sun_norm = vars.sun_norm;
- // project the direction ray onto the sky dome.
- F32 phi = acos(Pn[1]);
- F32 sinA = sin(F_PI - phi);
- if (fabsf(sinA) < 0.01f)
- { //avoid division by zero
- sinA = 0.01f;
- }
-
- F32 Plen = vars.dome_radius * sin(F_PI + phi + asin(vars.dome_offset * sinA)) / sinA;
-
- Pn *= Plen;
-
- // Set altitude
- if (Pn[1] > 0.f)
- {
- Pn *= (max_y / Pn[1]);
- }
- else
- {
- Pn *= (-32000.f / Pn[1]);
- }
-
- Plen = Pn.length();
- Pn /= Plen;
-
- // Initialize temp variables
- LLColor3 sunlight = vars.sunlight;
+ // project the direction ray onto the sky dome.
+ F32 phi = acos(Pn[1]);
+ F32 sinA = sin(F_PI - phi);
+ if (fabsf(sinA) < 0.01f)
+ { //avoid division by zero
+ sinA = 0.01f;
+ }
+
+ F32 Plen = vars.dome_radius * sin(F_PI + phi + asin(vars.dome_offset * sinA)) / sinA;
+
+ Pn *= Plen;
+
+ // Set altitude
+ if (Pn[1] > 0.f)
+ {
+ Pn *= (max_y / Pn[1]);
+ }
+ else
+ {
+ Pn *= (-32000.f / Pn[1]);
+ }
+
+ Plen = Pn.length();
+ Pn /= Plen;
+
+ // Initialize temp variables
+ LLColor3 sunlight = vars.sunlight;
LLColor3 ambient = vars.ambient;
-
+
LLColor3 glow = vars.glow;
F32 cloud_shadow = vars.cloud_shadow;
- // Sunlight attenuation effect (hue and brightness) due to atmosphere
- // this is used later for sunlight modulation at various altitudes
- LLColor3 light_atten = vars.light_atten;
+ // Sunlight attenuation effect (hue and brightness) due to atmosphere
+ // this is used later for sunlight modulation at various altitudes
+ LLColor3 light_atten = vars.light_atten;
LLColor3 light_transmittance = psky->getLightTransmittanceFast(vars.total_density, vars.density_multiplier, Plen);
(void)light_transmittance; // silence Clang warn-error
- // Calculate relative weights
- LLColor3 temp2(0.f, 0.f, 0.f);
- LLColor3 temp1 = vars.total_density;
+ // Calculate relative weights
+ LLColor3 temp2(0.f, 0.f, 0.f);
+ LLColor3 temp1 = vars.total_density;
- LLColor3 blue_weight = componentDiv(blue_density, temp1);
- LLColor3 blue_factor = blue_horizon * blue_weight;
- LLColor3 haze_weight = componentDiv(smear(haze_density), temp1);
- LLColor3 haze_factor = haze_horizon * haze_weight;
+ LLColor3 blue_weight = componentDiv(blue_density, temp1);
+ LLColor3 blue_factor = blue_horizon * blue_weight;
+ LLColor3 haze_weight = componentDiv(smear(haze_density), temp1);
+ LLColor3 haze_factor = haze_horizon * haze_weight;
- // Compute sunlight from P & lightnorm (for long rays like sky)
+ // Compute sunlight from P & lightnorm (for long rays like sky)
temp2.mV[1] = llmax(F_APPROXIMATELY_ZERO, llmax(0.f, Pn[1]) * 1.0f + sun_norm.mV[1] );
temp2.mV[1] = 1.f / temp2.mV[1];
@@ -328,52 +328,52 @@ void LLAtmospherics::calcSkyColorWLVert(const LLSettingsSky::ptr_t &psky, LLVect
componentMultBy(sunlight, light_transmittance);
// Distance
- temp2.mV[2] = Plen * density_multiplier;
+ temp2.mV[2] = Plen * density_multiplier;
// Transparency (-> temp1)
- temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]);
+ temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]);
- // Compute haze glow
- temp2.mV[0] = Pn * LLVector3(sun_norm);
+ // Compute haze glow
+ temp2.mV[0] = Pn * LLVector3(sun_norm);
- temp2.mV[0] = 1.f - temp2.mV[0];
- // temp2.x is 0 at the sun and increases away from sun
- temp2.mV[0] = llmax(temp2.mV[0], .001f);
- // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
+ temp2.mV[0] = 1.f - temp2.mV[0];
+ // temp2.x is 0 at the sun and increases away from sun
+ temp2.mV[0] = llmax(temp2.mV[0], .001f);
+ // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
- // Higher glow.x gives dimmer glow (because next step is 1 / "angle")
- temp2.mV[0] *= glow.mV[0];
+ // Higher glow.x gives dimmer glow (because next step is 1 / "angle")
+ temp2.mV[0] *= glow.mV[0];
- temp2.mV[0] = pow(temp2.mV[0], glow.mV[2]);
- // glow.z should be negative, so we're doing a sort of (1 / "angle") function
+ temp2.mV[0] = pow(temp2.mV[0], glow.mV[2]);
+ // glow.z should be negative, so we're doing a sort of (1 / "angle") function
- // Add "minimum anti-solar illumination"
- temp2.mV[0] += .25f;
+ // Add "minimum anti-solar illumination"
+ temp2.mV[0] += .25f;
- // Haze color above cloud
- vars.hazeColor = (blue_factor * (sunlight + ambient) + componentMult(haze_factor, sunlight * temp2.mV[0] + ambient));
+ // Haze color above cloud
+ vars.hazeColor = (blue_factor * (sunlight + ambient) + componentMult(haze_factor, sunlight * temp2.mV[0] + ambient));
- // Increase ambient when there are more clouds
- LLColor3 tmpAmbient = ambient + (LLColor3::white - ambient) * cloud_shadow * 0.5f;
+ // Increase ambient when there are more clouds
+ LLColor3 tmpAmbient = ambient + (LLColor3::white - ambient) * cloud_shadow * 0.5f;
- // Dim sunlight by cloud shadow percentage
- sunlight *= (1.f - cloud_shadow);
+ // Dim sunlight by cloud shadow percentage
+ sunlight *= (1.f - cloud_shadow);
- // Haze color below cloud
- vars.hazeColorBelowCloud = (blue_factor * (sunlight + tmpAmbient) + componentMult(haze_factor, sunlight * temp2.mV[0] + tmpAmbient));
+ // Haze color below cloud
+ vars.hazeColorBelowCloud = (blue_factor * (sunlight + tmpAmbient) + componentMult(haze_factor, sunlight * temp2.mV[0] + tmpAmbient));
- // Final atmosphere additive
- componentMultBy(vars.hazeColor, LLColor3::white - temp1);
+ // Final atmosphere additive
+ componentMultBy(vars.hazeColor, LLColor3::white - temp1);
/*
- // SL-12574
+ // SL-12574
// Attenuate cloud color by atmosphere
- temp1 = componentSqrt(temp1); //less atmos opacity (more transparency) below clouds
+ temp1 = componentSqrt(temp1); //less atmos opacity (more transparency) below clouds
- // At horizon, blend high altitude sky color towards the darker color below the clouds
- vars.hazeColor += componentMult(vars.hazeColorBelowCloud - vars.hazeColor, LLColor3::white - componentSqrt(temp1));
+ // At horizon, blend high altitude sky color towards the darker color below the clouds
+ vars.hazeColor += componentMult(vars.hazeColorBelowCloud - vars.hazeColor, LLColor3::white - componentSqrt(temp1));
*/
}
@@ -381,44 +381,44 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
{
LLVector3 tosun = tosun_in;
- if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG))
- {
- return;
- }
+ if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG))
+ {
+ return;
+ }
- LLColor4 target_fog(0.f, 0.2f, 0.5f, 0.f);
+ LLColor4 target_fog(0.f, 0.2f, 0.5f, 0.f);
- const F32 water_height = gAgent.getRegion() ? gAgent.getRegion()->getWaterHeight() : 0.f;
- // LLWorld::getInstance()->getWaterHeight();
- F32 camera_height = gAgentCamera.getCameraPositionAgent().mV[2];
+ const F32 water_height = gAgent.getRegion() ? gAgent.getRegion()->getWaterHeight() : 0.f;
+ // LLWorld::getInstance()->getWaterHeight();
+ F32 camera_height = gAgentCamera.getCameraPositionAgent().mV[2];
- F32 near_clip_height = LLViewerCamera::getInstance()->getAtAxis().mV[VZ] * LLViewerCamera::getInstance()->getNear();
- camera_height += near_clip_height;
+ F32 near_clip_height = LLViewerCamera::getInstance()->getAtAxis().mV[VZ] * LLViewerCamera::getInstance()->getNear();
+ camera_height += near_clip_height;
- F32 fog_distance = 0.f;
- LLColor3 res_color[3];
+ F32 fog_distance = 0.f;
+ LLColor3 res_color[3];
- LLColor3 sky_fog_color = LLColor3::white;
- LLColor3 render_fog_color = LLColor3::white;
+ LLColor3 sky_fog_color = LLColor3::white;
+ LLColor3 render_fog_color = LLColor3::white;
- const F32 tosun_z = tosun.mV[VZ];
- tosun.mV[VZ] = 0.f;
- tosun.normalize();
- LLVector3 perp_tosun;
- perp_tosun.mV[VX] = -tosun.mV[VY];
- perp_tosun.mV[VY] = tosun.mV[VX];
- LLVector3 tosun_45 = tosun + perp_tosun;
- tosun_45.normalize();
+ const F32 tosun_z = tosun.mV[VZ];
+ tosun.mV[VZ] = 0.f;
+ tosun.normalize();
+ LLVector3 perp_tosun;
+ perp_tosun.mV[VX] = -tosun.mV[VY];
+ perp_tosun.mV[VY] = tosun.mV[VX];
+ LLVector3 tosun_45 = tosun + perp_tosun;
+ tosun_45.normalize();
- F32 delta = 0.06f;
- tosun.mV[VZ] = delta;
- perp_tosun.mV[VZ] = delta;
- tosun_45.mV[VZ] = delta;
- tosun.normalize();
- perp_tosun.normalize();
- tosun_45.normalize();
+ F32 delta = 0.06f;
+ tosun.mV[VZ] = delta;
+ perp_tosun.mV[VZ] = delta;
+ tosun_45.mV[VZ] = delta;
+ tosun.normalize();
+ perp_tosun.normalize();
+ tosun_45.normalize();
- // Sky colors, just slightly above the horizon in the direction of the sun, perpendicular to the sun, and at a 45 degree angle to the sun.
+ // Sky colors, just slightly above the horizon in the direction of the sun, perpendicular to the sun, and at a 45 degree angle to the sun.
AtmosphericsVars vars;
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
@@ -451,75 +451,75 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
res_color[1] = calcSkyColorInDir(psky, vars, perp_tosun);
res_color[2] = calcSkyColorInDir(psky, vars, tosun_45);
- sky_fog_color = color_norm(res_color[0] + res_color[1] + res_color[2]);
+ sky_fog_color = color_norm(res_color[0] + res_color[1] + res_color[2]);
+
+ F32 full_off = -0.25f;
+ F32 full_on = 0.00f;
+ F32 on = (tosun_z - full_off) / (full_on - full_off);
+ on = llclamp(on, 0.01f, 1.f);
+ sky_fog_color *= 0.5f * on;
- F32 full_off = -0.25f;
- F32 full_on = 0.00f;
- F32 on = (tosun_z - full_off) / (full_on - full_off);
- on = llclamp(on, 0.01f, 1.f);
- sky_fog_color *= 0.5f * on;
+ // We need to clamp these to non-zero, in order for the gamma correction to work. 0^y = ???
+ S32 i;
+ for (i = 0; i < 3; i++)
+ {
+ sky_fog_color.mV[i] = llmax(0.0001f, sky_fog_color.mV[i]);
+ }
- // We need to clamp these to non-zero, in order for the gamma correction to work. 0^y = ???
- S32 i;
- for (i = 0; i < 3; i++)
- {
- sky_fog_color.mV[i] = llmax(0.0001f, sky_fog_color.mV[i]);
- }
+ color_gamma_correct(sky_fog_color);
- color_gamma_correct(sky_fog_color);
+ render_fog_color = sky_fog_color;
- render_fog_color = sky_fog_color;
+ fog_distance = mFogRatio * distance;
- fog_distance = mFogRatio * distance;
-
- if (camera_height > water_height)
- {
- LLColor4 fog(render_fog_color);
- mGLFogCol = fog;
- }
- else
- {
+ if (camera_height > water_height)
+ {
+ LLColor4 fog(render_fog_color);
+ mGLFogCol = fog;
+ }
+ else
+ {
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
- F32 depth = water_height - camera_height;
- LLColor4 water_fog_color(pwater->getWaterFogColor());
+ F32 depth = water_height - camera_height;
+ LLColor4 water_fog_color(pwater->getWaterFogColor());
- // adjust the color based on depth. We're doing linear approximations
- float depth_scale = gSavedSettings.getF32("WaterGLFogDepthScale");
- float depth_modifier = 1.0f - llmin(llmax(depth / depth_scale, 0.01f),
- gSavedSettings.getF32("WaterGLFogDepthFloor"));
+ // adjust the color based on depth. We're doing linear approximations
+ float depth_scale = gSavedSettings.getF32("WaterGLFogDepthScale");
+ float depth_modifier = 1.0f - llmin(llmax(depth / depth_scale, 0.01f),
+ gSavedSettings.getF32("WaterGLFogDepthFloor"));
- LLColor4 fogCol = water_fog_color * depth_modifier;
- fogCol.setAlpha(1);
+ LLColor4 fogCol = water_fog_color * depth_modifier;
+ fogCol.setAlpha(1);
- // set the gl fog color
- mGLFogCol = fogCol;
- }
+ // set the gl fog color
+ mGLFogCol = fogCol;
+ }
- mFogColor = sky_fog_color;
- mFogColor.setAlpha(1);
+ mFogColor = sky_fog_color;
+ mFogColor.setAlpha(1);
- LLDrawPoolWater::sWaterFogEnd = fog_distance*2.2f;
+ LLDrawPoolWater::sWaterFogEnd = fog_distance*2.2f;
- stop_glerror();
+ stop_glerror();
}
// Functions used a lot.
F32 color_norm_pow(LLColor3& col, F32 e, BOOL postmultiply)
{
- F32 mv = color_max(col);
- if (0 == mv)
- {
- return 0;
- }
-
- col *= 1.f / mv;
- color_pow(col, e);
- if (postmultiply)
- {
- col *= mv;
- }
- return mv;
+ F32 mv = color_max(col);
+ if (0 == mv)
+ {
+ return 0;
+ }
+
+ col *= 1.f / mv;
+ color_pow(col, e);
+ if (postmultiply)
+ {
+ col *= mv;
+ }
+ return mv;
}
// Returns angle (RADIANs) between the horizontal projection of "v" and the x_axis.
@@ -527,31 +527,31 @@ F32 color_norm_pow(LLColor3& col, F32 e, BOOL postmultiply)
// Returns 0.0f when "v" = +/- z_axis.
F32 azimuth(const LLVector3 &v)
{
- F32 azimuth = 0.0f;
- if (v.mV[VX] == 0.0f)
- {
- if (v.mV[VY] > 0.0f)
- {
- azimuth = F_PI * 0.5f;
- }
- else if (v.mV[VY] < 0.0f)
- {
- azimuth = F_PI * 1.5f;// 270.f;
- }
- }
- else
- {
- azimuth = (F32) atan(v.mV[VY] / v.mV[VX]);
- if (v.mV[VX] < 0.0f)
- {
- azimuth += F_PI;
- }
- else if (v.mV[VY] < 0.0f)
- {
- azimuth += F_PI * 2;
- }
- }
- return azimuth;
+ F32 azimuth = 0.0f;
+ if (v.mV[VX] == 0.0f)
+ {
+ if (v.mV[VY] > 0.0f)
+ {
+ azimuth = F_PI * 0.5f;
+ }
+ else if (v.mV[VY] < 0.0f)
+ {
+ azimuth = F_PI * 1.5f;// 270.f;
+ }
+ }
+ else
+ {
+ azimuth = (F32) atan(v.mV[VY] / v.mV[VX]);
+ if (v.mV[VX] < 0.0f)
+ {
+ azimuth += F_PI;
+ }
+ else if (v.mV[VY] < 0.0f)
+ {
+ azimuth += F_PI * 2;
+ }
+ }
+ return azimuth;
}
bool operator==(const AtmosphericsVars& a, const AtmosphericsVars& b)
diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h
index d48f3040c3..ade6ed9569 100644
--- a/indra/newview/lllegacyatmospherics.h
+++ b/indra/newview/lllegacyatmospherics.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllegacyatmospherics.h
* @brief LLVOSky class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -75,7 +75,7 @@ class LLHaze
{
public:
LLHaze() : mG(0), mFalloff(1), mAbsCoef(0.f) {mSigSca.setToBlack();}
- LLHaze(const F32 g, const LLColor3& sca, const F32 fo = 2.f) :
+ LLHaze(const F32 g, const LLColor3& sca, const F32 fo = 2.f) :
mG(g), mSigSca(0.25f/F_PI * sca), mFalloff(fo), mAbsCoef(0.f)
{
mAbsCoef = color_intens(mSigSca) / sAirScaIntense;
@@ -111,7 +111,7 @@ public:
const LLColor3& getSigSca() const // sea level
{
return mSigSca;
- }
+ }
void setSigSca(const LLColor3& s)
{
@@ -212,9 +212,9 @@ public:
LLColor3 hazeColor;
LLColor3 hazeColorBelowCloud;
- LLColor3 cloudColorSun;
- LLColor3 cloudColorAmbient;
- F32 cloudDensity;
+ LLColor3 cloudColorSun;
+ LLColor3 cloudColorAmbient;
+ F32 cloudDensity;
LLColor3 blue_density;
LLColor3 blue_horizon;
F32 haze_density;
@@ -237,7 +237,7 @@ public:
class LLAtmospherics
{
-public:
+public:
LLAtmospherics();
~LLAtmospherics();
diff --git a/indra/newview/lllightconstants.h b/indra/newview/lllightconstants.h
index 216fd4ded5..3b16659e4e 100644
--- a/indra/newview/lllightconstants.h
+++ b/indra/newview/lllightconstants.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllightconstants.h
* @brief Constants for light functions
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
#ifndef LL_LLLIGHTCONSTANTS_H
#define LL_LLLIGHTCONSTANTS_H
-//const F32 LIGHT_MAX_RADIUS = 20.f; // Maximum range of light
-const F32 LIGHT_FADE_TIME = 0.2f;
+//const F32 LIGHT_MAX_RADIUS = 20.f; // Maximum range of light
+const F32 LIGHT_FADE_TIME = 0.2f;
#endif // LL_LLLIGHTCONSTANTS_H
diff --git a/indra/newview/lllistbrowser.cpp b/indra/newview/lllistbrowser.cpp
index 956f457730..143415adee 100644
--- a/indra/newview/lllistbrowser.cpp
+++ b/indra/newview/lllistbrowser.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lllistbrowser.cpp
* @brief UI widget showing a search filter, list view, icon action buttons,
* and verb action buttons, as usually embedded in the side tray.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/lllistbrowser.h b/indra/newview/lllistbrowser.h
index 22e8755f08..9cd5c730a9 100644
--- a/indra/newview/lllistbrowser.h
+++ b/indra/newview/lllistbrowser.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lllistbrowser.h
* @brief UI widget showing a search filter, list view, icon action buttons,
* and verb action buttons, as usually embedded in the side tray.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/lllistcontextmenu.cpp b/indra/newview/lllistcontextmenu.cpp
index 77185411c5..cf29fd0483 100644
--- a/indra/newview/lllistcontextmenu.cpp
+++ b/indra/newview/lllistcontextmenu.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllistcontextmenu.cpp
* @brief Base class of misc lists' context menus
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,74 +41,74 @@ LLListContextMenu::LLListContextMenu()
LLListContextMenu::~LLListContextMenu()
{
- // do not forget delete LLContextMenu* mMenu.
- // It can have registered Enable callbacks which are called from the LLMenuHolderGL::draw()
- // via selected item (menu_item_call) by calling LLMenuItemCallGL::buildDrawLabel.
- // we can have a crash via using callbacks of deleted instance of ContextMenu. EXT-4725
-
- // menu holder deletes its menus on viewer exit, so we have no way to determine if instance
- // of mMenu has already been deleted except of using LLHandle. EXT-4762.
- if (!mMenuHandle.isDead())
- {
- mMenuHandle.get()->die();
- mMenuHandle.markDead();
- }
+ // do not forget delete LLContextMenu* mMenu.
+ // It can have registered Enable callbacks which are called from the LLMenuHolderGL::draw()
+ // via selected item (menu_item_call) by calling LLMenuItemCallGL::buildDrawLabel.
+ // we can have a crash via using callbacks of deleted instance of ContextMenu. EXT-4725
+
+ // menu holder deletes its menus on viewer exit, so we have no way to determine if instance
+ // of mMenu has already been deleted except of using LLHandle. EXT-4762.
+ if (!mMenuHandle.isDead())
+ {
+ mMenuHandle.get()->die();
+ mMenuHandle.markDead();
+ }
}
void LLListContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
{
- LLContextMenu* menup = mMenuHandle.get();
- if (menup)
- {
- menup->die();
- mMenuHandle.markDead();
- mUUIDs.clear();
- }
-
- if ( uuids.empty() )
- {
- return;
- }
-
- mUUIDs.resize(uuids.size());
- std::copy(uuids.begin(), uuids.end(), mUUIDs.begin());
-
- menup = createMenu();
- if (!menup)
- {
- LL_WARNS() << "Context menu creation failed" << LL_ENDL;
- return;
- }
-
- mMenuHandle = menup->getHandle();
- menup->show(x, y);
- LLMenuGL::showPopup(spawning_view, menup, x, y);
+ LLContextMenu* menup = mMenuHandle.get();
+ if (menup)
+ {
+ menup->die();
+ mMenuHandle.markDead();
+ mUUIDs.clear();
+ }
+
+ if ( uuids.empty() )
+ {
+ return;
+ }
+
+ mUUIDs.resize(uuids.size());
+ std::copy(uuids.begin(), uuids.end(), mUUIDs.begin());
+
+ menup = createMenu();
+ if (!menup)
+ {
+ LL_WARNS() << "Context menu creation failed" << LL_ENDL;
+ return;
+ }
+
+ mMenuHandle = menup->getHandle();
+ menup->show(x, y);
+ LLMenuGL::showPopup(spawning_view, menup, x, y);
}
void LLListContextMenu::hide()
{
- if(mMenuHandle.get())
- {
- mMenuHandle.get()->hide();
- }
+ if(mMenuHandle.get())
+ {
+ mMenuHandle.get()->hide();
+ }
}
// static
void LLListContextMenu::handleMultiple(functor_t functor, const uuid_vec_t& ids)
{
- uuid_vec_t::const_iterator it;
- for (it = ids.begin(); it != ids.end(); ++it)
- {
- functor(*it);
- }
+ uuid_vec_t::const_iterator it;
+ for (it = ids.begin(); it != ids.end(); ++it)
+ {
+ functor(*it);
+ }
}
// static
LLContextMenu* LLListContextMenu::createFromFile(const std::string& filename)
{
- llassert(LLMenuGL::sMenuContainer != NULL);
- return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
- filename, LLContextMenu::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+ llassert(LLMenuGL::sMenuContainer != NULL);
+ return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
+ filename, LLContextMenu::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
}
// EOF
diff --git a/indra/newview/lllistcontextmenu.h b/indra/newview/lllistcontextmenu.h
index 04d3314829..4b515a3b26 100644
--- a/indra/newview/lllistcontextmenu.h
+++ b/indra/newview/lllistcontextmenu.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllistcontextmenu.h
* @brief Base class of misc lists' context menus
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,9 +36,9 @@ class LLContextMenu;
/**
* Context menu for single or multiple list items.
- *
+ *
* Derived classes must implement createMenu().
- *
+ *
* Typical usage:
* <code>
* my_context_menu->show(parent_view, selected_list_items_ids, x, y);
@@ -47,31 +47,31 @@ class LLContextMenu;
class LLListContextMenu
{
public:
- LLListContextMenu();
- virtual ~LLListContextMenu();
+ LLListContextMenu();
+ virtual ~LLListContextMenu();
- /**
- * Show the menu at specified coordinates.
- *
- * @param spawning_view View to spawn at.
- * @param uuids An array of list items ids.
- * @param x Horizontal coordinate in the spawn_view's coordinate frame.
- * @param y Vertical coordinate in the spawn_view's coordinate frame.
- */
- virtual void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
+ /**
+ * Show the menu at specified coordinates.
+ *
+ * @param spawning_view View to spawn at.
+ * @param uuids An array of list items ids.
+ * @param x Horizontal coordinate in the spawn_view's coordinate frame.
+ * @param y Vertical coordinate in the spawn_view's coordinate frame.
+ */
+ virtual void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
- virtual void hide();
+ virtual void hide();
protected:
- typedef boost::function<void (const LLUUID& id)> functor_t;
+ typedef boost::function<void (const LLUUID& id)> functor_t;
- virtual LLContextMenu* createMenu() = 0;
+ virtual LLContextMenu* createMenu() = 0;
- static LLContextMenu* createFromFile(const std::string& filename);
- static void handleMultiple(functor_t functor, const uuid_vec_t& ids);
+ static LLContextMenu* createFromFile(const std::string& filename);
+ static void handleMultiple(functor_t functor, const uuid_vec_t& ids);
- uuid_vec_t mUUIDs;
- LLHandle<LLContextMenu> mMenuHandle;
+ uuid_vec_t mUUIDs;
+ LLHandle<LLContextMenu> mMenuHandle;
};
#endif // LL_LLLISTCONTEXTMENU_H
diff --git a/indra/newview/lllistview.cpp b/indra/newview/lllistview.cpp
index 8fc3ad63bd..8e923f6eb7 100644
--- a/indra/newview/lllistview.cpp
+++ b/indra/newview/lllistview.cpp
@@ -1,26 +1,26 @@
-/**
+/**
* @file lllistview.cpp
- * @brief UI widget containing a scrollable, possibly hierarchical list of
+ * @brief UI widget containing a scrollable, possibly hierarchical list of
* folders (LLListViewFolder) and items (LLListViewItem).
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,31 +29,31 @@
#include "lllistview.h"
#include "lltextbox.h"
-#include "lluictrlfactory.h" // LLDefaultChildRegistry
+#include "lluictrlfactory.h" // LLDefaultChildRegistry
// linker optimizes this out on Windows until there is a real reference
// to this file
static LLDefaultChildRegistry::Register<LLListView> r("list_view");
LLListView::Params::Params()
-: bg_color("bg_color"),
- fg_selected_color("fg_selected_color"),
- bg_selected_color("bg_selected_color")
+: bg_color("bg_color"),
+ fg_selected_color("fg_selected_color"),
+ bg_selected_color("bg_selected_color")
{}
LLListView::LLListView(const Params& p)
-: LLUICtrl(p),
- mLabel(NULL),
- mBgColor(p.bg_color()),
- mFgSelectedColor(p.fg_selected_color()),
- mBgSelectedColor(p.bg_selected_color())
+: LLUICtrl(p),
+ mLabel(NULL),
+ mBgColor(p.bg_color()),
+ mFgSelectedColor(p.fg_selected_color()),
+ mBgSelectedColor(p.bg_selected_color())
{
- LLRect label_rect(0, 20, 300, 0);
- LLTextBox::Params text_box_params;
- text_box_params.rect(label_rect);
- text_box_params.initial_value("This is a list-view");
- mLabel = LLUICtrlFactory::create<LLTextBox>(text_box_params);
- addChild(mLabel);
+ LLRect label_rect(0, 20, 300, 0);
+ LLTextBox::Params text_box_params;
+ text_box_params.rect(label_rect);
+ text_box_params.initial_value("This is a list-view");
+ mLabel = LLUICtrlFactory::create<LLTextBox>(text_box_params);
+ addChild(mLabel);
}
LLListView::~LLListView()
@@ -63,5 +63,5 @@ LLListView::~LLListView()
// placeholder for setting a property
void LLListView::setString(const std::string& s)
{
- mLabel->setValue( LLSD(s) );
+ mLabel->setValue( LLSD(s) );
}
diff --git a/indra/newview/lllistview.h b/indra/newview/lllistview.h
index 4303672b9f..4602732fa6 100644
--- a/indra/newview/lllistview.h
+++ b/indra/newview/lllistview.h
@@ -1,60 +1,60 @@
-/**
+/**
* @file lllistview.h
- * @brief UI widget containing a scrollable, possibly hierarchical list of
+ * @brief UI widget containing a scrollable, possibly hierarchical list of
* folders (LLListViewFolder) and items (LLListViewItem).
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LLLISTVIEW_H
#define LLLISTVIEW_H
-#include "llui.h" // for LLUIColor, *TODO: use more specific header
+#include "llui.h" // for LLUIColor, *TODO: use more specific header
#include "lluictrl.h"
class LLTextBox;
class LLListView
-: public LLUICtrl
+: public LLUICtrl
{
public:
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<LLUIColor> bg_color,
- fg_selected_color,
- bg_selected_color;
- Params();
- };
- LLListView(const Params& p);
- virtual ~LLListView();
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Optional<LLUIColor> bg_color,
+ fg_selected_color,
+ bg_selected_color;
+ Params();
+ };
+ LLListView(const Params& p);
+ virtual ~LLListView();
- // placeholder for setting a property
- void setString(const std::string& s);
+ // placeholder for setting a property
+ void setString(const std::string& s);
private:
- // TODO: scroll container?
- LLTextBox* mLabel; // just for testing
- LLUIColor mBgColor;
- LLUIColor mFgSelectedColor;
- LLUIColor mBgSelectedColor;
+ // TODO: scroll container?
+ LLTextBox* mLabel; // just for testing
+ LLUIColor mBgColor;
+ LLUIColor mFgSelectedColor;
+ LLUIColor mBgSelectedColor;
};
#endif // LLLISTVIEW_H
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
index 1e42773777..5b7243ece2 100644
--- a/indra/newview/lllocalbitmaps.cpp
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lllocalbitmaps.cpp
* @author Vaalith Jinn
* @brief Local Bitmaps source
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -69,7 +69,7 @@
/*=======================================*/
/* Formal declarations, constants, etc. */
-/*=======================================*/
+/*=======================================*/
static const F32 LL_LOCAL_TIMER_HEARTBEAT = 3.0;
static const BOOL LL_LOCAL_USE_MIPMAPS = true;
@@ -80,57 +80,57 @@ static const S32 LL_LOCAL_UPDATE_RETRIES = 5;
/*=======================================*/
/* LLLocalBitmap: unit class */
-/*=======================================*/
+/*=======================================*/
LLLocalBitmap::LLLocalBitmap(std::string filename)
- : mFilename(filename)
- , mShortName(gDirUtilp->getBaseFileName(filename, true))
- , mValid(false)
- , mLastModified()
- , mLinkStatus(LS_ON)
- , mUpdateRetries(LL_LOCAL_UPDATE_RETRIES)
+ : mFilename(filename)
+ , mShortName(gDirUtilp->getBaseFileName(filename, true))
+ , mValid(false)
+ , mLastModified()
+ , mLinkStatus(LS_ON)
+ , mUpdateRetries(LL_LOCAL_UPDATE_RETRIES)
{
- mTrackingID.generate();
-
- /* extension */
- std::string temp_exten = gDirUtilp->getExtension(mFilename);
-
- if (temp_exten == "bmp")
- {
- mExtension = ET_IMG_BMP;
- }
- else if (temp_exten == "tga")
- {
- mExtension = ET_IMG_TGA;
- }
- else if (temp_exten == "jpg" || temp_exten == "jpeg")
- {
- mExtension = ET_IMG_JPG;
- }
- else if (temp_exten == "png")
- {
- mExtension = ET_IMG_PNG;
- }
- else
- {
- LL_WARNS() << "File of no valid extension given, local bitmap creation aborted." << "\n"
- << "Filename: " << mFilename << LL_ENDL;
- return; // no valid extension.
- }
-
- /* next phase of unit creation is nearly the same as an update cycle.
- we're running updateSelf as a special case with the optional UT_FIRSTUSE
- which omits the parts associated with removing the outdated texture */
- mValid = updateSelf(UT_FIRSTUSE);
+ mTrackingID.generate();
+
+ /* extension */
+ std::string temp_exten = gDirUtilp->getExtension(mFilename);
+
+ if (temp_exten == "bmp")
+ {
+ mExtension = ET_IMG_BMP;
+ }
+ else if (temp_exten == "tga")
+ {
+ mExtension = ET_IMG_TGA;
+ }
+ else if (temp_exten == "jpg" || temp_exten == "jpeg")
+ {
+ mExtension = ET_IMG_JPG;
+ }
+ else if (temp_exten == "png")
+ {
+ mExtension = ET_IMG_PNG;
+ }
+ else
+ {
+ LL_WARNS() << "File of no valid extension given, local bitmap creation aborted." << "\n"
+ << "Filename: " << mFilename << LL_ENDL;
+ return; // no valid extension.
+ }
+
+ /* next phase of unit creation is nearly the same as an update cycle.
+ we're running updateSelf as a special case with the optional UT_FIRSTUSE
+ which omits the parts associated with removing the outdated texture */
+ mValid = updateSelf(UT_FIRSTUSE);
}
LLLocalBitmap::~LLLocalBitmap()
{
- // replace IDs with defaults, if set to do so.
- if(LL_LOCAL_REPLACE_ON_DEL && mValid && gAgentAvatarp) // fix for STORM-1837
- {
- replaceIDs(mWorldID, IMG_DEFAULT);
- LLLocalBitmapMgr::getInstance()->doRebake();
- }
+ // replace IDs with defaults, if set to do so.
+ if(LL_LOCAL_REPLACE_ON_DEL && mValid && gAgentAvatarp) // fix for STORM-1837
+ {
+ replaceIDs(mWorldID, IMG_DEFAULT);
+ LLLocalBitmapMgr::getInstance()->doRebake();
+ }
for (LLPointer<LLGLTFMaterial> &mat : mGLTFMaterialWithLocalTextures)
{
@@ -140,146 +140,146 @@ LLLocalBitmap::~LLLocalBitmap()
mChangedSignal(getTrackingID(), getWorldID(), LLUUID());
mChangedSignal.disconnect_all_slots();
- // delete self from gimagelist
- LLViewerFetchedTexture* image = gTextureList.findImage(mWorldID, TEX_LIST_STANDARD);
- gTextureList.deleteImage(image);
+ // delete self from gimagelist
+ LLViewerFetchedTexture* image = gTextureList.findImage(mWorldID, TEX_LIST_STANDARD);
+ gTextureList.deleteImage(image);
- if (image)
- {
- image->unref();
- }
+ if (image)
+ {
+ image->unref();
+ }
}
/* accessors */
std::string LLLocalBitmap::getFilename() const
{
- return mFilename;
+ return mFilename;
}
std::string LLLocalBitmap::getShortName() const
{
- return mShortName;
+ return mShortName;
}
LLUUID LLLocalBitmap::getTrackingID() const
{
- return mTrackingID;
+ return mTrackingID;
}
LLUUID LLLocalBitmap::getWorldID() const
{
- return mWorldID;
+ return mWorldID;
}
bool LLLocalBitmap::getValid() const
{
- return mValid;
+ return mValid;
}
/* update functions */
bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate)
{
- bool updated = false;
-
- if (mLinkStatus == LS_ON)
- {
- // verifying that the file exists
- if (gDirUtilp->fileExists(mFilename))
- {
- // verifying that the file has indeed been modified
+ bool updated = false;
+
+ if (mLinkStatus == LS_ON)
+ {
+ // verifying that the file exists
+ if (gDirUtilp->fileExists(mFilename))
+ {
+ // verifying that the file has indeed been modified
#ifndef LL_WINDOWS
- const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(mFilename));
+ const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(mFilename));
#else
- const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(utf8str_to_utf16str(mFilename)));
+ const std::time_t temp_time = boost::filesystem::last_write_time(boost::filesystem::path(utf8str_to_utf16str(mFilename)));
#endif
- LLSD new_last_modified = asctime(localtime(&temp_time));
-
- if (mLastModified.asString() != new_last_modified.asString())
- {
- /* loading the image file and decoding it, here is a critical point which,
- if fails, invalidates the whole update (or unit creation) process. */
- LLPointer<LLImageRaw> raw_image = new LLImageRaw();
- if (decodeBitmap(raw_image))
- {
- // decode is successful, we can safely proceed.
- LLUUID old_id = LLUUID::null;
- if ((optional_firstupdate != UT_FIRSTUSE) && !mWorldID.isNull())
- {
- old_id = mWorldID;
- }
- mWorldID.generate();
- mLastModified = new_last_modified;
-
- LLPointer<LLViewerFetchedTexture> texture = new LLViewerFetchedTexture
- ("file://"+mFilename, FTT_LOCAL_FILE, mWorldID, LL_LOCAL_USE_MIPMAPS);
-
- texture->createGLTexture(LL_LOCAL_DISCARD_LEVEL, raw_image);
- texture->setCachedRawImage(LL_LOCAL_DISCARD_LEVEL, raw_image);
- texture->ref();
-
- gTextureList.addImage(texture, TEX_LIST_STANDARD);
-
- if (optional_firstupdate != UT_FIRSTUSE)
- {
- // seek out everything old_id uses and replace it with mWorldID
- replaceIDs(old_id, mWorldID);
-
- // remove old_id from gimagelist
- LLViewerFetchedTexture* image = gTextureList.findImage(old_id, TEX_LIST_STANDARD);
- if (image != NULL)
- {
- gTextureList.deleteImage(image);
- image->unref();
- }
- }
-
- mUpdateRetries = LL_LOCAL_UPDATE_RETRIES;
- updated = true;
- }
-
- // if decoding failed, we get here and it will attempt to decode it in the next cycles
- // until mUpdateRetries runs out. this is done because some software lock the bitmap while writing to it
- else
- {
- if (mUpdateRetries)
- {
- mUpdateRetries--;
- }
- else
- {
- LL_WARNS() << "During the update process the following file was found" << "\n"
- << "but could not be opened or decoded for " << LL_LOCAL_UPDATE_RETRIES << " attempts." << "\n"
- << "Filename: " << mFilename << "\n"
- << "Disabling further update attempts for this file." << LL_ENDL;
-
- LLSD notif_args;
- notif_args["FNAME"] = mFilename;
- notif_args["NRETRIES"] = LL_LOCAL_UPDATE_RETRIES;
- LLNotificationsUtil::add("LocalBitmapsUpdateFailedFinal", notif_args);
-
- mLinkStatus = LS_BROKEN;
- }
- }
- }
-
- } // end if file exists
-
- else
- {
- LL_WARNS() << "During the update process, the following file was not found." << "\n"
- << "Filename: " << mFilename << "\n"
- << "Disabling further update attempts for this file." << LL_ENDL;
-
- LLSD notif_args;
- notif_args["FNAME"] = mFilename;
- LLNotificationsUtil::add("LocalBitmapsUpdateFileNotFound", notif_args);
-
- mLinkStatus = LS_BROKEN;
- }
- }
-
- return updated;
+ LLSD new_last_modified = asctime(localtime(&temp_time));
+
+ if (mLastModified.asString() != new_last_modified.asString())
+ {
+ /* loading the image file and decoding it, here is a critical point which,
+ if fails, invalidates the whole update (or unit creation) process. */
+ LLPointer<LLImageRaw> raw_image = new LLImageRaw();
+ if (decodeBitmap(raw_image))
+ {
+ // decode is successful, we can safely proceed.
+ LLUUID old_id = LLUUID::null;
+ if ((optional_firstupdate != UT_FIRSTUSE) && !mWorldID.isNull())
+ {
+ old_id = mWorldID;
+ }
+ mWorldID.generate();
+ mLastModified = new_last_modified;
+
+ LLPointer<LLViewerFetchedTexture> texture = new LLViewerFetchedTexture
+ ("file://"+mFilename, FTT_LOCAL_FILE, mWorldID, LL_LOCAL_USE_MIPMAPS);
+
+ texture->createGLTexture(LL_LOCAL_DISCARD_LEVEL, raw_image);
+ texture->setCachedRawImage(LL_LOCAL_DISCARD_LEVEL, raw_image);
+ texture->ref();
+
+ gTextureList.addImage(texture, TEX_LIST_STANDARD);
+
+ if (optional_firstupdate != UT_FIRSTUSE)
+ {
+ // seek out everything old_id uses and replace it with mWorldID
+ replaceIDs(old_id, mWorldID);
+
+ // remove old_id from gimagelist
+ LLViewerFetchedTexture* image = gTextureList.findImage(old_id, TEX_LIST_STANDARD);
+ if (image != NULL)
+ {
+ gTextureList.deleteImage(image);
+ image->unref();
+ }
+ }
+
+ mUpdateRetries = LL_LOCAL_UPDATE_RETRIES;
+ updated = true;
+ }
+
+ // if decoding failed, we get here and it will attempt to decode it in the next cycles
+ // until mUpdateRetries runs out. this is done because some software lock the bitmap while writing to it
+ else
+ {
+ if (mUpdateRetries)
+ {
+ mUpdateRetries--;
+ }
+ else
+ {
+ LL_WARNS() << "During the update process the following file was found" << "\n"
+ << "but could not be opened or decoded for " << LL_LOCAL_UPDATE_RETRIES << " attempts." << "\n"
+ << "Filename: " << mFilename << "\n"
+ << "Disabling further update attempts for this file." << LL_ENDL;
+
+ LLSD notif_args;
+ notif_args["FNAME"] = mFilename;
+ notif_args["NRETRIES"] = LL_LOCAL_UPDATE_RETRIES;
+ LLNotificationsUtil::add("LocalBitmapsUpdateFailedFinal", notif_args);
+
+ mLinkStatus = LS_BROKEN;
+ }
+ }
+ }
+
+ } // end if file exists
+
+ else
+ {
+ LL_WARNS() << "During the update process, the following file was not found." << "\n"
+ << "Filename: " << mFilename << "\n"
+ << "Disabling further update attempts for this file." << LL_ENDL;
+
+ LLSD notif_args;
+ notif_args["FNAME"] = mFilename;
+ LLNotificationsUtil::add("LocalBitmapsUpdateFileNotFound", notif_args);
+
+ mLinkStatus = LS_BROKEN;
+ }
+ }
+
+ return updated;
}
boost::signals2::connection LLLocalBitmap::setChangedCallback(const LLLocalTextureCallback& cb)
@@ -319,114 +319,114 @@ void LLLocalBitmap::addGLTFMaterial(LLGLTFMaterial* mat)
bool LLLocalBitmap::decodeBitmap(LLPointer<LLImageRaw> rawimg)
{
- bool decode_successful = false;
-
- switch (mExtension)
- {
- case ET_IMG_BMP:
- {
- LLPointer<LLImageBMP> bmp_image = new LLImageBMP;
- if (bmp_image->load(mFilename) && bmp_image->decode(rawimg, 0.0f))
- {
- rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
- decode_successful = true;
- }
- break;
- }
-
- case ET_IMG_TGA:
- {
- LLPointer<LLImageTGA> tga_image = new LLImageTGA;
- if ((tga_image->load(mFilename) && tga_image->decode(rawimg))
- && ((tga_image->getComponents() == 3) || (tga_image->getComponents() == 4)))
- {
- rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
- decode_successful = true;
- }
- break;
- }
-
- case ET_IMG_JPG:
- {
- LLPointer<LLImageJPEG> jpeg_image = new LLImageJPEG;
- if (jpeg_image->load(mFilename) && jpeg_image->decode(rawimg, 0.0f))
- {
- rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
- decode_successful = true;
- }
- break;
- }
-
- case ET_IMG_PNG:
- {
- LLPointer<LLImagePNG> png_image = new LLImagePNG;
- if (png_image->load(mFilename) && png_image->decode(rawimg, 0.0f))
- {
- rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
- decode_successful = true;
- }
- break;
- }
-
- default:
- {
- // separating this into -several- LL_WARNS() calls because in the extremely unlikely case that this happens
- // accessing mFilename and any other object properties might very well crash the viewer.
- // getting here should be impossible, or there's been a pretty serious bug.
-
- LL_WARNS() << "During a decode attempt, the following local bitmap had no properly assigned extension." << LL_ENDL;
- LL_WARNS() << "Filename: " << mFilename << LL_ENDL;
- LL_WARNS() << "Disabling further update attempts for this file." << LL_ENDL;
- mLinkStatus = LS_BROKEN;
- }
- }
-
- return decode_successful;
+ bool decode_successful = false;
+
+ switch (mExtension)
+ {
+ case ET_IMG_BMP:
+ {
+ LLPointer<LLImageBMP> bmp_image = new LLImageBMP;
+ if (bmp_image->load(mFilename) && bmp_image->decode(rawimg, 0.0f))
+ {
+ rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
+ decode_successful = true;
+ }
+ break;
+ }
+
+ case ET_IMG_TGA:
+ {
+ LLPointer<LLImageTGA> tga_image = new LLImageTGA;
+ if ((tga_image->load(mFilename) && tga_image->decode(rawimg))
+ && ((tga_image->getComponents() == 3) || (tga_image->getComponents() == 4)))
+ {
+ rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
+ decode_successful = true;
+ }
+ break;
+ }
+
+ case ET_IMG_JPG:
+ {
+ LLPointer<LLImageJPEG> jpeg_image = new LLImageJPEG;
+ if (jpeg_image->load(mFilename) && jpeg_image->decode(rawimg, 0.0f))
+ {
+ rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
+ decode_successful = true;
+ }
+ break;
+ }
+
+ case ET_IMG_PNG:
+ {
+ LLPointer<LLImagePNG> png_image = new LLImagePNG;
+ if (png_image->load(mFilename) && png_image->decode(rawimg, 0.0f))
+ {
+ rawimg->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
+ decode_successful = true;
+ }
+ break;
+ }
+
+ default:
+ {
+ // separating this into -several- LL_WARNS() calls because in the extremely unlikely case that this happens
+ // accessing mFilename and any other object properties might very well crash the viewer.
+ // getting here should be impossible, or there's been a pretty serious bug.
+
+ LL_WARNS() << "During a decode attempt, the following local bitmap had no properly assigned extension." << LL_ENDL;
+ LL_WARNS() << "Filename: " << mFilename << LL_ENDL;
+ LL_WARNS() << "Disabling further update attempts for this file." << LL_ENDL;
+ mLinkStatus = LS_BROKEN;
+ }
+ }
+
+ return decode_successful;
}
void LLLocalBitmap::replaceIDs(const LLUUID& old_id, LLUUID new_id)
{
- // checking for misuse.
- if (old_id == new_id)
- {
- LL_INFOS() << "An attempt was made to replace a texture with itself. (matching UUIDs)" << "\n"
- << "Texture UUID: " << old_id.asString() << LL_ENDL;
- return;
- }
+ // checking for misuse.
+ if (old_id == new_id)
+ {
+ LL_INFOS() << "An attempt was made to replace a texture with itself. (matching UUIDs)" << "\n"
+ << "Texture UUID: " << old_id.asString() << LL_ENDL;
+ return;
+ }
mChangedSignal(getTrackingID(), old_id, new_id);
- // processing updates per channel; makes the process scalable.
- // the only actual difference is in SetTE* call i.e. SetTETexture, SetTENormal, etc.
- updateUserPrims(old_id, new_id, LLRender::DIFFUSE_MAP);
- updateUserPrims(old_id, new_id, LLRender::NORMAL_MAP);
- updateUserPrims(old_id, new_id, LLRender::SPECULAR_MAP);
-
- updateUserVolumes(old_id, new_id, LLRender::LIGHT_TEX);
- updateUserVolumes(old_id, new_id, LLRender::SCULPT_TEX); // isn't there supposed to be an IMG_DEFAULT_SCULPT or something?
-
- // default safeguard image for layers
- if( new_id == IMG_DEFAULT )
- {
- new_id = IMG_DEFAULT_AVATAR;
- }
-
- /* It doesn't actually update all of those, it merely checks if any of them
- contain the referenced ID and if so, updates. */
- updateUserLayers(old_id, new_id, LLWearableType::WT_ALPHA);
- updateUserLayers(old_id, new_id, LLWearableType::WT_EYES);
- updateUserLayers(old_id, new_id, LLWearableType::WT_GLOVES);
- updateUserLayers(old_id, new_id, LLWearableType::WT_JACKET);
- updateUserLayers(old_id, new_id, LLWearableType::WT_PANTS);
- updateUserLayers(old_id, new_id, LLWearableType::WT_SHIRT);
- updateUserLayers(old_id, new_id, LLWearableType::WT_SHOES);
- updateUserLayers(old_id, new_id, LLWearableType::WT_SKIN);
- updateUserLayers(old_id, new_id, LLWearableType::WT_SKIRT);
- updateUserLayers(old_id, new_id, LLWearableType::WT_SOCKS);
- updateUserLayers(old_id, new_id, LLWearableType::WT_TATTOO);
- updateUserLayers(old_id, new_id, LLWearableType::WT_UNIVERSAL);
- updateUserLayers(old_id, new_id, LLWearableType::WT_UNDERPANTS);
- updateUserLayers(old_id, new_id, LLWearableType::WT_UNDERSHIRT);
+ // processing updates per channel; makes the process scalable.
+ // the only actual difference is in SetTE* call i.e. SetTETexture, SetTENormal, etc.
+ updateUserPrims(old_id, new_id, LLRender::DIFFUSE_MAP);
+ updateUserPrims(old_id, new_id, LLRender::NORMAL_MAP);
+ updateUserPrims(old_id, new_id, LLRender::SPECULAR_MAP);
+
+ updateUserVolumes(old_id, new_id, LLRender::LIGHT_TEX);
+ updateUserVolumes(old_id, new_id, LLRender::SCULPT_TEX); // isn't there supposed to be an IMG_DEFAULT_SCULPT or something?
+
+ // default safeguard image for layers
+ if( new_id == IMG_DEFAULT )
+ {
+ new_id = IMG_DEFAULT_AVATAR;
+ }
+
+ /* It doesn't actually update all of those, it merely checks if any of them
+ contain the referenced ID and if so, updates. */
+ updateUserLayers(old_id, new_id, LLWearableType::WT_ALPHA);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_EYES);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_GLOVES);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_JACKET);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_PANTS);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_SHIRT);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_SHOES);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_SKIN);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_SKIRT);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_SOCKS);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_TATTOO);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_UNIVERSAL);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_UNDERPANTS);
+ updateUserLayers(old_id, new_id, LLWearableType::WT_UNDERSHIRT);
updateGLTFMaterials(old_id, new_id);
}
@@ -435,195 +435,195 @@ void LLLocalBitmap::replaceIDs(const LLUUID& old_id, LLUUID new_id)
// in order to prevent multiple sendTEUpdate calls per object during updateUserPrims
std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id, U32 channel)
{
- std::vector<LLViewerObject*> obj_list;
- LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_STANDARD);
-
- for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++)
- {
- // getting an object from a face
- LLFace* face_to_object = (*old_texture->getFaceList(channel))[face_iterator];
-
- if(face_to_object)
- {
- LLViewerObject* affected_object = face_to_object->getViewerObject();
-
- if(affected_object)
- {
-
- // we have an object, we'll take it's UUID and compare it to
- // whatever we already have in the returnable object list.
- // if there is a match - we do not add (to prevent duplicates)
- LLUUID mainlist_obj_id = affected_object->getID();
- bool add_object = true;
-
- // begin looking for duplicates
- std::vector<LLViewerObject*>::iterator objlist_iter = obj_list.begin();
- for(; (objlist_iter != obj_list.end()) && add_object; objlist_iter++)
- {
- LLViewerObject* obj = *objlist_iter;
- if (obj->getID() == mainlist_obj_id)
- {
- add_object = false; // duplicate found.
- }
- }
- // end looking for duplicates
-
- if(add_object)
- {
- obj_list.push_back(affected_object);
- }
-
- }
-
- }
-
- } // end of face-iterating for()
-
- return obj_list;
+ std::vector<LLViewerObject*> obj_list;
+ LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_STANDARD);
+
+ for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++)
+ {
+ // getting an object from a face
+ LLFace* face_to_object = (*old_texture->getFaceList(channel))[face_iterator];
+
+ if(face_to_object)
+ {
+ LLViewerObject* affected_object = face_to_object->getViewerObject();
+
+ if(affected_object)
+ {
+
+ // we have an object, we'll take it's UUID and compare it to
+ // whatever we already have in the returnable object list.
+ // if there is a match - we do not add (to prevent duplicates)
+ LLUUID mainlist_obj_id = affected_object->getID();
+ bool add_object = true;
+
+ // begin looking for duplicates
+ std::vector<LLViewerObject*>::iterator objlist_iter = obj_list.begin();
+ for(; (objlist_iter != obj_list.end()) && add_object; objlist_iter++)
+ {
+ LLViewerObject* obj = *objlist_iter;
+ if (obj->getID() == mainlist_obj_id)
+ {
+ add_object = false; // duplicate found.
+ }
+ }
+ // end looking for duplicates
+
+ if(add_object)
+ {
+ obj_list.push_back(affected_object);
+ }
+
+ }
+
+ }
+
+ } // end of face-iterating for()
+
+ return obj_list;
}
void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel)
{
- std::vector<LLViewerObject*> objectlist = prepUpdateObjects(old_id, channel);
-
- for(std::vector<LLViewerObject*>::iterator object_iterator = objectlist.begin();
- object_iterator != objectlist.end(); object_iterator++)
- {
- LLViewerObject* object = *object_iterator;
-
- if(object)
- {
- bool update_tex = false;
- bool update_mat = false;
- S32 num_faces = object->getNumFaces();
-
- for (U8 face_iter = 0; face_iter < num_faces; face_iter++)
- {
- if (object->mDrawable)
- {
- LLFace* face = object->mDrawable->getFace(face_iter);
- if (face && face->getTexture(channel) && face->getTexture(channel)->getID() == old_id)
- {
- // these things differ per channel, unless there already is a universal
- // texture setting function to setTE that takes channel as a param?
- // p.s.: switch for now, might become if - if an extra test is needed to verify before touching normalmap/specmap
- switch(channel)
- {
- case LLRender::DIFFUSE_MAP:
- {
+ std::vector<LLViewerObject*> objectlist = prepUpdateObjects(old_id, channel);
+
+ for(std::vector<LLViewerObject*>::iterator object_iterator = objectlist.begin();
+ object_iterator != objectlist.end(); object_iterator++)
+ {
+ LLViewerObject* object = *object_iterator;
+
+ if(object)
+ {
+ bool update_tex = false;
+ bool update_mat = false;
+ S32 num_faces = object->getNumFaces();
+
+ for (U8 face_iter = 0; face_iter < num_faces; face_iter++)
+ {
+ if (object->mDrawable)
+ {
+ LLFace* face = object->mDrawable->getFace(face_iter);
+ if (face && face->getTexture(channel) && face->getTexture(channel)->getID() == old_id)
+ {
+ // these things differ per channel, unless there already is a universal
+ // texture setting function to setTE that takes channel as a param?
+ // p.s.: switch for now, might become if - if an extra test is needed to verify before touching normalmap/specmap
+ switch(channel)
+ {
+ case LLRender::DIFFUSE_MAP:
+ {
object->setTETexture(face_iter, new_id);
update_tex = true;
- break;
- }
-
- case LLRender::NORMAL_MAP:
- {
- object->setTENormalMap(face_iter, new_id);
- update_mat = true;
- update_tex = true;
break;
- }
+ }
- case LLRender::SPECULAR_MAP:
- {
- object->setTESpecularMap(face_iter, new_id);
+ case LLRender::NORMAL_MAP:
+ {
+ object->setTENormalMap(face_iter, new_id);
update_mat = true;
- update_tex = true;
+ update_tex = true;
break;
- }
- }
- // end switch
-
- }
- }
- }
-
- if (update_tex)
- {
- object->sendTEUpdate();
- }
-
- if (update_mat)
- {
+ }
+
+ case LLRender::SPECULAR_MAP:
+ {
+ object->setTESpecularMap(face_iter, new_id);
+ update_mat = true;
+ update_tex = true;
+ break;
+ }
+ }
+ // end switch
+
+ }
+ }
+ }
+
+ if (update_tex)
+ {
+ object->sendTEUpdate();
+ }
+
+ if (update_mat)
+ {
object->mDrawable->getVOVolume()->faceMappingChanged();
- }
- }
- }
+ }
+ }
+ }
}
void LLLocalBitmap::updateUserVolumes(LLUUID old_id, LLUUID new_id, U32 channel)
{
- LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_STANDARD);
- for (U32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(channel); volume_iter++)
- {
- LLVOVolume* volobjp = (*old_texture->getVolumeList(channel))[volume_iter];
- switch (channel)
- {
- case LLRender::LIGHT_TEX:
- {
- if (volobjp->getLightTextureID() == old_id)
- {
- volobjp->setLightTextureID(new_id);
- }
- break;
- }
- case LLRender::SCULPT_TEX:
- {
- LLViewerObject* object = (LLViewerObject*)volobjp;
-
- if (object)
- {
- if (object->isSculpted() && object->getVolume() &&
- object->getVolume()->getParams().getSculptID() == old_id)
- {
- LLSculptParams* old_params = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
- LLSculptParams new_params(*old_params);
- new_params.setSculptTexture(new_id, (*old_params).getSculptType());
- object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, new_params, TRUE);
- }
- }
- }
- }
- }
+ LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_STANDARD);
+ for (U32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(channel); volume_iter++)
+ {
+ LLVOVolume* volobjp = (*old_texture->getVolumeList(channel))[volume_iter];
+ switch (channel)
+ {
+ case LLRender::LIGHT_TEX:
+ {
+ if (volobjp->getLightTextureID() == old_id)
+ {
+ volobjp->setLightTextureID(new_id);
+ }
+ break;
+ }
+ case LLRender::SCULPT_TEX:
+ {
+ LLViewerObject* object = (LLViewerObject*)volobjp;
+
+ if (object)
+ {
+ if (object->isSculpted() && object->getVolume() &&
+ object->getVolume()->getParams().getSculptID() == old_id)
+ {
+ LLSculptParams* old_params = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+ LLSculptParams new_params(*old_params);
+ new_params.setSculptTexture(new_id, (*old_params).getSculptType());
+ object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, new_params, TRUE);
+ }
+ }
+ }
+ }
+ }
}
void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type)
{
- U32 count = gAgentWearables.getWearableCount(type);
- for(U32 wearable_iter = 0; wearable_iter < count; wearable_iter++)
- {
- LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, wearable_iter);
- if (wearable)
- {
- std::vector<LLLocalTextureObject*> texture_list = wearable->getLocalTextureListSeq();
- for(std::vector<LLLocalTextureObject*>::iterator texture_iter = texture_list.begin();
- texture_iter != texture_list.end(); texture_iter++)
- {
- LLLocalTextureObject* lto = *texture_iter;
-
- if (lto && lto->getID() == old_id)
- {
- U32 local_texlayer_index = 0; /* can't keep that as static const, gives errors, so i'm leaving this var here */
- LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind =
- lto->getTexLayer(local_texlayer_index)->getTexLayerSet()->getBakedTexIndex();
-
- LLAvatarAppearanceDefines::ETextureIndex reg_texind = getTexIndex(type, baked_texind);
- if (reg_texind != LLAvatarAppearanceDefines::TEX_NUM_INDICES)
- {
- U32 index;
- if (gAgentWearables.getWearableIndex(wearable,index))
- {
- gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), FALSE, index);
- gAgentAvatarp->wearableUpdated(type);
- /* telling the manager to rebake once update cycle is fully done */
- LLLocalBitmapMgr::getInstance()->setNeedsRebake();
- }
- }
-
- }
- }
- }
- }
+ U32 count = gAgentWearables.getWearableCount(type);
+ for(U32 wearable_iter = 0; wearable_iter < count; wearable_iter++)
+ {
+ LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, wearable_iter);
+ if (wearable)
+ {
+ std::vector<LLLocalTextureObject*> texture_list = wearable->getLocalTextureListSeq();
+ for(std::vector<LLLocalTextureObject*>::iterator texture_iter = texture_list.begin();
+ texture_iter != texture_list.end(); texture_iter++)
+ {
+ LLLocalTextureObject* lto = *texture_iter;
+
+ if (lto && lto->getID() == old_id)
+ {
+ U32 local_texlayer_index = 0; /* can't keep that as static const, gives errors, so i'm leaving this var here */
+ LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind =
+ lto->getTexLayer(local_texlayer_index)->getTexLayerSet()->getBakedTexIndex();
+
+ LLAvatarAppearanceDefines::ETextureIndex reg_texind = getTexIndex(type, baked_texind);
+ if (reg_texind != LLAvatarAppearanceDefines::TEX_NUM_INDICES)
+ {
+ U32 index;
+ if (gAgentWearables.getWearableIndex(wearable,index))
+ {
+ gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), FALSE, index);
+ gAgentAvatarp->wearableUpdated(type);
+ /* telling the manager to rebake once update cycle is fully done */
+ LLLocalBitmapMgr::getInstance()->setNeedsRebake();
+ }
+ }
+
+ }
+ }
+ }
+ }
}
void LLLocalBitmap::updateGLTFMaterials(LLUUID old_id, LLUUID new_id)
@@ -688,304 +688,304 @@ void LLLocalBitmap::updateGLTFMaterials(LLUUID old_id, LLUUID new_id)
}
LLAvatarAppearanceDefines::ETextureIndex LLLocalBitmap::getTexIndex(
- LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind)
+ LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind)
{
- LLAvatarAppearanceDefines::ETextureIndex result = LLAvatarAppearanceDefines::TEX_NUM_INDICES; // using as a default/fail return.
-
- switch(type)
- {
- case LLWearableType::WT_ALPHA:
- {
- switch(baked_texind)
- {
- case LLAvatarAppearanceDefines::BAKED_EYES:
- {
- result = LLAvatarAppearanceDefines::TEX_EYES_ALPHA;
- break;
- }
-
- case LLAvatarAppearanceDefines::BAKED_HAIR:
- {
- result = LLAvatarAppearanceDefines::TEX_HAIR_ALPHA;
- break;
- }
-
- case LLAvatarAppearanceDefines::BAKED_HEAD:
- {
- result = LLAvatarAppearanceDefines::TEX_HEAD_ALPHA;
- break;
- }
-
- case LLAvatarAppearanceDefines::BAKED_LOWER:
- {
- result = LLAvatarAppearanceDefines::TEX_LOWER_ALPHA;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_UPPER:
- {
- result = LLAvatarAppearanceDefines::TEX_UPPER_ALPHA;
- break;
- }
-
- default:
- {
- break;
- }
-
- }
- break;
-
- }
-
- case LLWearableType::WT_EYES:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_EYES)
- {
- result = LLAvatarAppearanceDefines::TEX_EYES_IRIS;
- }
-
- break;
- }
-
- case LLWearableType::WT_GLOVES:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
- {
- result = LLAvatarAppearanceDefines::TEX_UPPER_GLOVES;
- }
-
- break;
- }
-
- case LLWearableType::WT_JACKET:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
- {
- result = LLAvatarAppearanceDefines::TEX_LOWER_JACKET;
- }
- else if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
- {
- result = LLAvatarAppearanceDefines::TEX_UPPER_JACKET;
- }
-
- break;
- }
-
- case LLWearableType::WT_PANTS:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
- {
- result = LLAvatarAppearanceDefines::TEX_LOWER_PANTS;
- }
-
- break;
- }
-
- case LLWearableType::WT_SHIRT:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
- {
- result = LLAvatarAppearanceDefines::TEX_UPPER_SHIRT;
- }
-
- break;
- }
-
- case LLWearableType::WT_SHOES:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
- {
- result = LLAvatarAppearanceDefines::TEX_LOWER_SHOES;
- }
-
- break;
- }
-
- case LLWearableType::WT_SKIN:
- {
- switch(baked_texind)
- {
- case LLAvatarAppearanceDefines::BAKED_HEAD:
- {
- result = LLAvatarAppearanceDefines::TEX_HEAD_BODYPAINT;
- break;
- }
-
- case LLAvatarAppearanceDefines::BAKED_LOWER:
- {
- result = LLAvatarAppearanceDefines::TEX_LOWER_BODYPAINT;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_UPPER:
- {
- result = LLAvatarAppearanceDefines::TEX_UPPER_BODYPAINT;
- break;
- }
-
- default:
- {
- break;
- }
-
- }
- break;
- }
-
- case LLWearableType::WT_SKIRT:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_SKIRT)
- {
- result = LLAvatarAppearanceDefines::TEX_SKIRT;
- }
-
- break;
- }
-
- case LLWearableType::WT_SOCKS:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
- {
- result = LLAvatarAppearanceDefines::TEX_LOWER_SOCKS;
- }
-
- break;
- }
-
- case LLWearableType::WT_TATTOO:
- {
- switch (baked_texind)
- {
- case LLAvatarAppearanceDefines::BAKED_HEAD:
- {
- result = LLAvatarAppearanceDefines::TEX_HEAD_TATTOO;
- break;
- }
-
- case LLAvatarAppearanceDefines::BAKED_LOWER:
- {
- result = LLAvatarAppearanceDefines::TEX_LOWER_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_UPPER:
- {
- result = LLAvatarAppearanceDefines::TEX_UPPER_TATTOO;
- break;
- }
- default:
- {
- break;
- }
- }
- break;
-
- }
- case LLWearableType::WT_UNIVERSAL:
- {
- switch (baked_texind)
- {
-
- case LLAvatarAppearanceDefines::BAKED_SKIRT:
- {
- result = LLAvatarAppearanceDefines::TEX_SKIRT_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_EYES:
- {
- result = LLAvatarAppearanceDefines::TEX_EYES_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_HAIR:
- {
- result = LLAvatarAppearanceDefines::TEX_HAIR_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_LEFT_ARM:
- {
- result = LLAvatarAppearanceDefines::TEX_LEFT_ARM_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_LEFT_LEG:
- {
- result = LLAvatarAppearanceDefines::TEX_LEFT_LEG_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_AUX1:
- {
- result = LLAvatarAppearanceDefines::TEX_AUX1_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_AUX2:
- {
- result = LLAvatarAppearanceDefines::TEX_AUX2_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_AUX3:
- {
- result = LLAvatarAppearanceDefines::TEX_AUX3_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_UPPER:
- {
- result = LLAvatarAppearanceDefines::TEX_UPPER_UNIVERSAL_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_LOWER:
- {
- result = LLAvatarAppearanceDefines::TEX_LOWER_UNIVERSAL_TATTOO;
- break;
- }
- case LLAvatarAppearanceDefines::BAKED_HEAD:
- {
- result = LLAvatarAppearanceDefines::TEX_HEAD_UNIVERSAL_TATTOO;
- break;
- }
-
-
- default:
- {
- break;
- }
-
- }
- break;
- }
-
- case LLWearableType::WT_UNDERPANTS:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
- {
- result = LLAvatarAppearanceDefines::TEX_LOWER_UNDERPANTS;
- }
-
- break;
- }
-
- case LLWearableType::WT_UNDERSHIRT:
- {
- if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
- {
- result = LLAvatarAppearanceDefines::TEX_UPPER_UNDERSHIRT;
- }
-
- break;
- }
-
- default:
- {
- LL_WARNS() << "Unknown wearable type: " << (int)type << "\n"
- << "Baked Texture Index: " << (int)baked_texind << "\n"
- << "Filename: " << mFilename << "\n"
- << "TrackingID: " << mTrackingID << "\n"
- << "InworldID: " << mWorldID << LL_ENDL;
- }
-
- }
- return result;
+ LLAvatarAppearanceDefines::ETextureIndex result = LLAvatarAppearanceDefines::TEX_NUM_INDICES; // using as a default/fail return.
+
+ switch(type)
+ {
+ case LLWearableType::WT_ALPHA:
+ {
+ switch(baked_texind)
+ {
+ case LLAvatarAppearanceDefines::BAKED_EYES:
+ {
+ result = LLAvatarAppearanceDefines::TEX_EYES_ALPHA;
+ break;
+ }
+
+ case LLAvatarAppearanceDefines::BAKED_HAIR:
+ {
+ result = LLAvatarAppearanceDefines::TEX_HAIR_ALPHA;
+ break;
+ }
+
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
+ {
+ result = LLAvatarAppearanceDefines::TEX_HEAD_ALPHA;
+ break;
+ }
+
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
+ {
+ result = LLAvatarAppearanceDefines::TEX_LOWER_ALPHA;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
+ {
+ result = LLAvatarAppearanceDefines::TEX_UPPER_ALPHA;
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+
+ }
+ break;
+
+ }
+
+ case LLWearableType::WT_EYES:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_EYES)
+ {
+ result = LLAvatarAppearanceDefines::TEX_EYES_IRIS;
+ }
+
+ break;
+ }
+
+ case LLWearableType::WT_GLOVES:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
+ {
+ result = LLAvatarAppearanceDefines::TEX_UPPER_GLOVES;
+ }
+
+ break;
+ }
+
+ case LLWearableType::WT_JACKET:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
+ {
+ result = LLAvatarAppearanceDefines::TEX_LOWER_JACKET;
+ }
+ else if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
+ {
+ result = LLAvatarAppearanceDefines::TEX_UPPER_JACKET;
+ }
+
+ break;
+ }
+
+ case LLWearableType::WT_PANTS:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
+ {
+ result = LLAvatarAppearanceDefines::TEX_LOWER_PANTS;
+ }
+
+ break;
+ }
+
+ case LLWearableType::WT_SHIRT:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
+ {
+ result = LLAvatarAppearanceDefines::TEX_UPPER_SHIRT;
+ }
+
+ break;
+ }
+
+ case LLWearableType::WT_SHOES:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
+ {
+ result = LLAvatarAppearanceDefines::TEX_LOWER_SHOES;
+ }
+
+ break;
+ }
+
+ case LLWearableType::WT_SKIN:
+ {
+ switch(baked_texind)
+ {
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
+ {
+ result = LLAvatarAppearanceDefines::TEX_HEAD_BODYPAINT;
+ break;
+ }
+
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
+ {
+ result = LLAvatarAppearanceDefines::TEX_LOWER_BODYPAINT;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
+ {
+ result = LLAvatarAppearanceDefines::TEX_UPPER_BODYPAINT;
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+
+ }
+ break;
+ }
+
+ case LLWearableType::WT_SKIRT:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_SKIRT)
+ {
+ result = LLAvatarAppearanceDefines::TEX_SKIRT;
+ }
+
+ break;
+ }
+
+ case LLWearableType::WT_SOCKS:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
+ {
+ result = LLAvatarAppearanceDefines::TEX_LOWER_SOCKS;
+ }
+
+ break;
+ }
+
+ case LLWearableType::WT_TATTOO:
+ {
+ switch (baked_texind)
+ {
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
+ {
+ result = LLAvatarAppearanceDefines::TEX_HEAD_TATTOO;
+ break;
+ }
+
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
+ {
+ result = LLAvatarAppearanceDefines::TEX_LOWER_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
+ {
+ result = LLAvatarAppearanceDefines::TEX_UPPER_TATTOO;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ break;
+
+ }
+ case LLWearableType::WT_UNIVERSAL:
+ {
+ switch (baked_texind)
+ {
+
+ case LLAvatarAppearanceDefines::BAKED_SKIRT:
+ {
+ result = LLAvatarAppearanceDefines::TEX_SKIRT_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_EYES:
+ {
+ result = LLAvatarAppearanceDefines::TEX_EYES_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_HAIR:
+ {
+ result = LLAvatarAppearanceDefines::TEX_HAIR_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_LEFT_ARM:
+ {
+ result = LLAvatarAppearanceDefines::TEX_LEFT_ARM_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_LEFT_LEG:
+ {
+ result = LLAvatarAppearanceDefines::TEX_LEFT_LEG_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_AUX1:
+ {
+ result = LLAvatarAppearanceDefines::TEX_AUX1_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_AUX2:
+ {
+ result = LLAvatarAppearanceDefines::TEX_AUX2_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_AUX3:
+ {
+ result = LLAvatarAppearanceDefines::TEX_AUX3_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
+ {
+ result = LLAvatarAppearanceDefines::TEX_UPPER_UNIVERSAL_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
+ {
+ result = LLAvatarAppearanceDefines::TEX_LOWER_UNIVERSAL_TATTOO;
+ break;
+ }
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
+ {
+ result = LLAvatarAppearanceDefines::TEX_HEAD_UNIVERSAL_TATTOO;
+ break;
+ }
+
+
+ default:
+ {
+ break;
+ }
+
+ }
+ break;
+ }
+
+ case LLWearableType::WT_UNDERPANTS:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
+ {
+ result = LLAvatarAppearanceDefines::TEX_LOWER_UNDERPANTS;
+ }
+
+ break;
+ }
+
+ case LLWearableType::WT_UNDERSHIRT:
+ {
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
+ {
+ result = LLAvatarAppearanceDefines::TEX_UPPER_UNDERSHIRT;
+ }
+
+ break;
+ }
+
+ default:
+ {
+ LL_WARNS() << "Unknown wearable type: " << (int)type << "\n"
+ << "Baked Texture Index: " << (int)baked_texind << "\n"
+ << "Filename: " << mFilename << "\n"
+ << "TrackingID: " << mTrackingID << "\n"
+ << "InworldID: " << mWorldID << LL_ENDL;
+ }
+
+ }
+ return result;
}
/*=======================================*/
/* LLLocalBitmapTimer: timer class */
-/*=======================================*/
+/*=======================================*/
LLLocalBitmapTimer::LLLocalBitmapTimer() : LLEventTimer(LL_LOCAL_TIMER_HEARTBEAT)
{
}
@@ -996,28 +996,28 @@ LLLocalBitmapTimer::~LLLocalBitmapTimer()
void LLLocalBitmapTimer::startTimer()
{
- mEventTimer.start();
+ mEventTimer.start();
}
void LLLocalBitmapTimer::stopTimer()
{
- mEventTimer.stop();
+ mEventTimer.stop();
}
bool LLLocalBitmapTimer::isRunning()
{
- return mEventTimer.getStarted();
+ return mEventTimer.getStarted();
}
BOOL LLLocalBitmapTimer::tick()
{
- LLLocalBitmapMgr::getInstance()->doUpdates();
- return FALSE;
+ LLLocalBitmapMgr::getInstance()->doUpdates();
+ return FALSE;
}
/*=======================================*/
/* LLLocalBitmapMgr: manager class */
-/*=======================================*/
+/*=======================================*/
LLLocalBitmapMgr::LLLocalBitmapMgr()
{
}
@@ -1075,12 +1075,12 @@ LLUUID LLLocalBitmapMgr::addUnit(const std::string& filename)
bool LLLocalBitmapMgr::checkTextureDimensions(std::string filename)
{
- std::string exten = gDirUtilp->getExtension(filename);
- U32 codec = LLImageBase::getCodecFromExtension(exten);
- std::string mImageLoadError;
- LLImageDimensionsInfo image_info;
- if (!image_info.load(filename,codec))
- {
+ std::string exten = gDirUtilp->getExtension(filename);
+ U32 codec = LLImageBase::getCodecFromExtension(exten);
+ std::string mImageLoadError;
+ LLImageDimensionsInfo image_info;
+ if (!image_info.load(filename,codec))
+ {
LLSD args;
args["NAME"] = gDirUtilp->getBaseFileName(filename);
if (!image_info.getWarningName().empty())
@@ -1088,69 +1088,69 @@ bool LLLocalBitmapMgr::checkTextureDimensions(std::string filename)
args["REASON"] = LLTrans::getString(image_info.getWarningName());
}
LLNotificationsUtil::add("CannotUploadTexture", args);
- return false;
- }
+ return false;
+ }
- S32 max_width = gSavedSettings.getS32("max_texture_dimension_X");
- S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y");
+ S32 max_width = gSavedSettings.getS32("max_texture_dimension_X");
+ S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y");
- if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height))
- {
- LLStringUtil::format_map_t args;
- args["WIDTH"] = llformat("%d", max_width);
- args["HEIGHT"] = llformat("%d", max_height);
- mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args);
+ if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height))
+ {
+ LLStringUtil::format_map_t args;
+ args["WIDTH"] = llformat("%d", max_width);
+ args["HEIGHT"] = llformat("%d", max_height);
+ mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args);
- LLSD notif_args;
- notif_args["REASON"] = mImageLoadError;
+ LLSD notif_args;
+ notif_args["REASON"] = mImageLoadError;
notif_args["NAME"] = gDirUtilp->getBaseFileName(filename);
- LLNotificationsUtil::add("CannotUploadTexture", notif_args);
+ LLNotificationsUtil::add("CannotUploadTexture", notif_args);
- return false;
- }
+ return false;
+ }
- return true;
+ return true;
}
void LLLocalBitmapMgr::delUnit(LLUUID tracking_id)
{
- if (!mBitmapList.empty())
- {
- std::vector<LLLocalBitmap*> to_delete;
- for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
- { /* finding which ones we want deleted and making a separate list */
- LLLocalBitmap* unit = *iter;
- if (unit->getTrackingID() == tracking_id)
- {
- to_delete.push_back(unit);
- }
- }
-
- for(std::vector<LLLocalBitmap*>::iterator del_iter = to_delete.begin();
- del_iter != to_delete.end(); del_iter++)
- { /* iterating over a temporary list, hence preserving the iterator validity while deleting. */
- LLLocalBitmap* unit = *del_iter;
- mBitmapList.remove(unit);
- delete unit;
- unit = NULL;
- }
- }
+ if (!mBitmapList.empty())
+ {
+ std::vector<LLLocalBitmap*> to_delete;
+ for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
+ { /* finding which ones we want deleted and making a separate list */
+ LLLocalBitmap* unit = *iter;
+ if (unit->getTrackingID() == tracking_id)
+ {
+ to_delete.push_back(unit);
+ }
+ }
+
+ for(std::vector<LLLocalBitmap*>::iterator del_iter = to_delete.begin();
+ del_iter != to_delete.end(); del_iter++)
+ { /* iterating over a temporary list, hence preserving the iterator validity while deleting. */
+ LLLocalBitmap* unit = *del_iter;
+ mBitmapList.remove(unit);
+ delete unit;
+ unit = NULL;
+ }
+ }
}
LLUUID LLLocalBitmapMgr::getWorldID(const LLUUID &tracking_id) const
{
- LLUUID world_id = LLUUID::null;
-
- for (local_list_citer iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
- {
- LLLocalBitmap* unit = *iter;
- if (unit->getTrackingID() == tracking_id)
- {
- world_id = unit->getWorldID();
- }
- }
-
- return world_id;
+ LLUUID world_id = LLUUID::null;
+
+ for (local_list_citer iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
+ {
+ LLLocalBitmap* unit = *iter;
+ if (unit->getTrackingID() == tracking_id)
+ {
+ world_id = unit->getWorldID();
+ }
+ }
+
+ return world_id;
}
bool LLLocalBitmapMgr::isLocal(const LLUUID &world_id) const
@@ -1168,18 +1168,18 @@ bool LLLocalBitmapMgr::isLocal(const LLUUID &world_id) const
std::string LLLocalBitmapMgr::getFilename(const LLUUID &tracking_id) const
{
- std::string filename = "";
-
- for (local_list_citer iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
- {
- LLLocalBitmap* unit = *iter;
- if (unit->getTrackingID() == tracking_id)
- {
- filename = unit->getFilename();
- }
- }
-
- return filename;
+ std::string filename = "";
+
+ for (local_list_citer iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
+ {
+ LLLocalBitmap* unit = *iter;
+ if (unit->getTrackingID() == tracking_id)
+ {
+ filename = unit->getFilename();
+ }
+ }
+
+ return filename;
}
boost::signals2::connection LLLocalBitmapMgr::setOnChangedCallback(const LLUUID tracking_id, const LLLocalBitmap::LLLocalTextureCallback &cb)
@@ -1210,18 +1210,18 @@ void LLLocalBitmapMgr::associateGLTFMaterial(const LLUUID tracking_id, LLGLTFMat
void LLLocalBitmapMgr::feedScrollList(LLScrollListCtrl* ctrl)
{
- if (ctrl)
- {
+ if (ctrl)
+ {
std::string icon_name = LLInventoryIcon::getIconName(
LLAssetType::AT_TEXTURE,
LLInventoryType::IT_NONE);
- if (!mBitmapList.empty())
- {
- for (local_list_iter iter = mBitmapList.begin();
- iter != mBitmapList.end(); iter++)
- {
- LLSD element;
+ if (!mBitmapList.empty())
+ {
+ for (local_list_iter iter = mBitmapList.begin();
+ iter != mBitmapList.end(); iter++)
+ {
+ LLSD element;
element["columns"][0]["column"] = "icon";
element["columns"][0]["type"] = "icon";
@@ -1236,39 +1236,39 @@ void LLLocalBitmapMgr::feedScrollList(LLScrollListCtrl* ctrl)
data["type"] = (S32)LLAssetType::AT_TEXTURE;
element["value"] = data;
- ctrl->addElement(element);
- }
- }
- }
+ ctrl->addElement(element);
+ }
+ }
+ }
}
void LLLocalBitmapMgr::doUpdates()
{
- // preventing theoretical overlap in cases with huge number of loaded images.
- mTimer.stopTimer();
- mNeedsRebake = false;
+ // preventing theoretical overlap in cases with huge number of loaded images.
+ mTimer.stopTimer();
+ mNeedsRebake = false;
- for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
- {
- (*iter)->updateSelf();
- }
+ for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
+ {
+ (*iter)->updateSelf();
+ }
- doRebake();
- mTimer.startTimer();
+ doRebake();
+ mTimer.startTimer();
}
void LLLocalBitmapMgr::setNeedsRebake()
{
- mNeedsRebake = true;
+ mNeedsRebake = true;
}
void LLLocalBitmapMgr::doRebake()
{ /* separated that from doUpdates to insure a rebake can be called separately during deletion */
- if (mNeedsRebake)
- {
- gAgentAvatarp->forceBakeAllTextures(LL_LOCAL_SLAM_FOR_DEBUG);
- mNeedsRebake = false;
- }
+ if (mNeedsRebake)
+ {
+ gAgentAvatarp->forceBakeAllTextures(LL_LOCAL_SLAM_FOR_DEBUG);
+ mNeedsRebake = false;
+ }
}
diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h
index 1fdf9dccbf..5dbc514f56 100644
--- a/indra/newview/lllocalbitmaps.h
+++ b/indra/newview/lllocalbitmaps.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lllocalbitmaps.h
* @author Vaalith Jinn
* @brief Local Bitmaps header
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,25 +40,25 @@ class LLGLTFMaterial;
class LLLocalBitmap
{
- public: /* main */
- LLLocalBitmap(std::string filename);
- ~LLLocalBitmap();
-
- public: /* accessors */
- std::string getFilename() const;
- std::string getShortName() const;
- LLUUID getTrackingID() const;
- LLUUID getWorldID() const;
- bool getValid() const;
-
- public: /* self update public section */
- enum EUpdateType
- {
- UT_FIRSTUSE,
- UT_REGUPDATE
- };
-
- bool updateSelf(EUpdateType = UT_REGUPDATE);
+ public: /* main */
+ LLLocalBitmap(std::string filename);
+ ~LLLocalBitmap();
+
+ public: /* accessors */
+ std::string getFilename() const;
+ std::string getShortName() const;
+ LLUUID getTrackingID() const;
+ LLUUID getWorldID() const;
+ bool getValid() const;
+
+ public: /* self update public section */
+ enum EUpdateType
+ {
+ UT_FIRSTUSE,
+ UT_REGUPDATE
+ };
+
+ bool updateSelf(EUpdateType = UT_REGUPDATE);
typedef boost::signals2::signal<void(const LLUUID& tracking_id,
const LLUUID& old_id,
@@ -67,42 +67,42 @@ class LLLocalBitmap
boost::signals2::connection setChangedCallback(const LLLocalTextureCallback& cb);
void addGLTFMaterial(LLGLTFMaterial* mat);
- private: /* self update private section */
- bool decodeBitmap(LLPointer<LLImageRaw> raw);
+ private: /* self update private section */
+ bool decodeBitmap(LLPointer<LLImageRaw> raw);
void replaceIDs(const LLUUID &old_id, LLUUID new_id);
- std::vector<LLViewerObject*> prepUpdateObjects(LLUUID old_id, U32 channel);
- void updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel);
- void updateUserVolumes(LLUUID old_id, LLUUID new_id, U32 channel);
- void updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type);
+ std::vector<LLViewerObject*> prepUpdateObjects(LLUUID old_id, U32 channel);
+ void updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel);
+ void updateUserVolumes(LLUUID old_id, LLUUID new_id, U32 channel);
+ void updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type);
void updateGLTFMaterials(LLUUID old_id, LLUUID new_id);
- LLAvatarAppearanceDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind);
-
- private: /* private enums */
- enum ELinkStatus
- {
- LS_ON,
- LS_BROKEN,
- };
-
- enum EExtension
- {
- ET_IMG_BMP,
- ET_IMG_TGA,
- ET_IMG_JPG,
- ET_IMG_PNG
- };
-
- private: /* members */
- std::string mFilename;
- std::string mShortName;
- LLUUID mTrackingID;
- LLUUID mWorldID;
- bool mValid;
- LLSD mLastModified;
- EExtension mExtension;
- ELinkStatus mLinkStatus;
- S32 mUpdateRetries;
- LLLocalTextureChangedSignal mChangedSignal;
+ LLAvatarAppearanceDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind);
+
+ private: /* private enums */
+ enum ELinkStatus
+ {
+ LS_ON,
+ LS_BROKEN,
+ };
+
+ enum EExtension
+ {
+ ET_IMG_BMP,
+ ET_IMG_TGA,
+ ET_IMG_JPG,
+ ET_IMG_PNG
+ };
+
+ private: /* members */
+ std::string mFilename;
+ std::string mShortName;
+ LLUUID mTrackingID;
+ LLUUID mWorldID;
+ bool mValid;
+ LLSD mLastModified;
+ EExtension mExtension;
+ ELinkStatus mLinkStatus;
+ S32 mUpdateRetries;
+ LLLocalTextureChangedSignal mChangedSignal;
// Store a list of accosiated materials
// Might be a better idea to hold this in LLGLTFMaterialList
@@ -113,44 +113,44 @@ class LLLocalBitmap
class LLLocalBitmapTimer : public LLEventTimer
{
- public:
- LLLocalBitmapTimer();
- ~LLLocalBitmapTimer();
+ public:
+ LLLocalBitmapTimer();
+ ~LLLocalBitmapTimer();
- public:
- void startTimer();
- void stopTimer();
- bool isRunning();
- BOOL tick();
+ public:
+ void startTimer();
+ void stopTimer();
+ bool isRunning();
+ BOOL tick();
};
class LLLocalBitmapMgr : public LLSingleton<LLLocalBitmapMgr>
{
- LLSINGLETON(LLLocalBitmapMgr);
- ~LLLocalBitmapMgr();
+ LLSINGLETON(LLLocalBitmapMgr);
+ ~LLLocalBitmapMgr();
public:
bool addUnit(const std::vector<std::string>& filenames);
LLUUID addUnit(const std::string& filename);
- void delUnit(LLUUID tracking_id);
- bool checkTextureDimensions(std::string filename);
+ void delUnit(LLUUID tracking_id);
+ bool checkTextureDimensions(std::string filename);
- LLUUID getWorldID(const LLUUID &tracking_id) const;
+ LLUUID getWorldID(const LLUUID &tracking_id) const;
bool isLocal(const LLUUID& world_id) const;
- std::string getFilename(const LLUUID &tracking_id) const;
+ std::string getFilename(const LLUUID &tracking_id) const;
boost::signals2::connection setOnChangedCallback(const LLUUID tracking_id, const LLLocalBitmap::LLLocalTextureCallback& cb);
void associateGLTFMaterial(const LLUUID tracking_id, LLGLTFMaterial* mat);
- void feedScrollList(LLScrollListCtrl* ctrl);
- void doUpdates();
- void setNeedsRebake();
- void doRebake();
-
+ void feedScrollList(LLScrollListCtrl* ctrl);
+ void doUpdates();
+ void setNeedsRebake();
+ void doRebake();
+
private:
- std::list<LLLocalBitmap*> mBitmapList;
- LLLocalBitmapTimer mTimer;
- bool mNeedsRebake;
- typedef std::list<LLLocalBitmap*>::iterator local_list_iter;
+ std::list<LLLocalBitmap*> mBitmapList;
+ LLLocalBitmapTimer mTimer;
+ bool mNeedsRebake;
+ typedef std::list<LLLocalBitmap*>::iterator local_list_iter;
typedef std::list<LLLocalBitmap*>::const_iterator local_list_citer;
};
diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp
index 61e0163798..58f06d7748 100644
--- a/indra/newview/lllocalgltfmaterials.cpp
+++ b/indra/newview/lllocalgltfmaterials.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllocalrendermaterials.cpp
* @brief Local GLTF materials source
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,14 +51,14 @@
/*=======================================*/
/* Formal declarations, constants, etc. */
-/*=======================================*/
+/*=======================================*/
static const F32 LL_LOCAL_TIMER_HEARTBEAT = 3.0;
static const S32 LL_LOCAL_UPDATE_RETRIES = 5;
/*=======================================*/
/* LLLocalGLTFMaterial: unit class */
-/*=======================================*/
+/*=======================================*/
LLLocalGLTFMaterial::LLLocalGLTFMaterial(std::string filename, S32 index)
: mFilename(filename)
, mShortName(gDirUtilp->getBaseFileName(filename, true))
@@ -303,7 +303,7 @@ bool LLLocalGLTFMaterialTimer::isRunning()
BOOL LLLocalGLTFMaterialTimer::tick()
{
- // todo: do on idle? No point in timer
+ // todo: do on idle? No point in timer
LLLocalGLTFMaterialMgr::getInstance()->doUpdates();
return FALSE;
}
diff --git a/indra/newview/lllocalgltfmaterials.h b/indra/newview/lllocalgltfmaterials.h
index 13b7577e96..a85bbf33ce 100644
--- a/indra/newview/lllocalgltfmaterials.h
+++ b/indra/newview/lllocalgltfmaterials.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllocalrendermaterials.h
* @brief Local GLTF materials header
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,11 +43,11 @@ public: /* main */
virtual ~LLLocalGLTFMaterial();
public: /* accessors */
- std::string getFilename() const;
- std::string getShortName() const;
- LLUUID getTrackingID() const;
- LLUUID getWorldID() const;
- S32 getIndexInFile() const;
+ std::string getFilename() const;
+ std::string getShortName() const;
+ LLUUID getTrackingID() const;
+ LLUUID getWorldID() const;
+ S32 getIndexInFile() const;
public:
bool updateSelf();
diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp
index 162d6e003e..dfc41852aa 100644
--- a/indra/newview/lllocationhistory.cpp
+++ b/indra/newview/lllocationhistory.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllocationhistory.cpp
* @brief Typed locations history
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,145 +35,145 @@
#include "llsdserialize.h"
LLLocationHistory::LLLocationHistory() :
- mFilename("typed_locations.txt")
+ mFilename("typed_locations.txt")
{
}
void LLLocationHistory::addItem(const LLLocationHistoryItem& item) {
- static LLUICachedControl<S32> max_items("LocationHistoryMaxSize", 100);
-
- // check if this item doesn't duplicate any existing one
- location_list_t::iterator item_iter = std::find(mItems.begin(), mItems.end(),item);
- if(item_iter != mItems.end()) // if it already exists, erase the old one
- {
- mItems.erase(item_iter);
- }
-
- mItems.push_back(item);
-
- // If the vector size exceeds the maximum, purge the oldest items (at the start of the mItems vector).
- if ((S32)mItems.size() > max_items)
- {
- mItems.erase(mItems.begin(), mItems.end()-max_items);
- }
- llassert((S32)mItems.size() <= max_items);
- mChangedSignal(ADD);
+ static LLUICachedControl<S32> max_items("LocationHistoryMaxSize", 100);
+
+ // check if this item doesn't duplicate any existing one
+ location_list_t::iterator item_iter = std::find(mItems.begin(), mItems.end(),item);
+ if(item_iter != mItems.end()) // if it already exists, erase the old one
+ {
+ mItems.erase(item_iter);
+ }
+
+ mItems.push_back(item);
+
+ // If the vector size exceeds the maximum, purge the oldest items (at the start of the mItems vector).
+ if ((S32)mItems.size() > max_items)
+ {
+ mItems.erase(mItems.begin(), mItems.end()-max_items);
+ }
+ llassert((S32)mItems.size() <= max_items);
+ mChangedSignal(ADD);
}
/*
- * @brief Try to find item in history.
+ * @brief Try to find item in history.
* If item has been founded, it will be places into end of history.
* @return true - item has founded
*/
bool LLLocationHistory::touchItem(const LLLocationHistoryItem& item) {
- bool result = false;
- location_list_t::iterator item_iter = std::find(mItems.begin(), mItems.end(), item);
+ bool result = false;
+ location_list_t::iterator item_iter = std::find(mItems.begin(), mItems.end(), item);
- // the last used item should be the first in the history
- if (item_iter != mItems.end()) {
- mItems.erase(item_iter);
- mItems.push_back(item);
- result = true;
- }
+ // the last used item should be the first in the history
+ if (item_iter != mItems.end()) {
+ mItems.erase(item_iter);
+ mItems.push_back(item);
+ result = true;
+ }
- return result;
+ return result;
}
void LLLocationHistory::removeItems()
{
- mItems.clear();
- mChangedSignal(CLEAR);
+ mItems.clear();
+ mChangedSignal(CLEAR);
}
bool LLLocationHistory::getMatchingItems(const std::string& substring, location_list_t& result) const
{
- // *TODO: an STL algorithm would look nicer
- result.clear();
-
- std::string needle = substring;
- LLStringUtil::toLower(needle);
-
- for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it)
- {
- std::string haystack = it->getLocation();
- LLStringUtil::toLower(haystack);
-
- if (haystack.find(needle) != std::string::npos)
- result.push_back(*it);
- }
-
- return result.size();
+ // *TODO: an STL algorithm would look nicer
+ result.clear();
+
+ std::string needle = substring;
+ LLStringUtil::toLower(needle);
+
+ for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it)
+ {
+ std::string haystack = it->getLocation();
+ LLStringUtil::toLower(haystack);
+
+ if (haystack.find(needle) != std::string::npos)
+ result.push_back(*it);
+ }
+
+ return result.size();
}
void LLLocationHistory::dump() const
{
- LL_INFOS() << "Location history dump:" << LL_ENDL;
- int i = 0;
- for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it, ++i)
- {
- LL_INFOS() << "#" << std::setw(2) << std::setfill('0') << i << ": " << it->getLocation() << LL_ENDL;
- }
+ LL_INFOS() << "Location history dump:" << LL_ENDL;
+ int i = 0;
+ for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it, ++i)
+ {
+ LL_INFOS() << "#" << std::setw(2) << std::setfill('0') << i << ": " << it->getLocation() << LL_ENDL;
+ }
}
void LLLocationHistory::save() const
{
- // build filename for each user
- std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
-
- if (resolved_filename.empty())
- {
- LL_INFOS() << "can't get path to location history filename - probably not logged in yet." << LL_ENDL;
- return;
- }
-
- // open a file for writing
- llofstream file(resolved_filename.c_str());
- if (!file.is_open())
- {
- LL_WARNS() << "can't open location history file \"" << mFilename << "\" for writing" << LL_ENDL;
- return;
- }
-
- for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it)
- {
- file << LLSDOStreamer<LLSDNotationFormatter>((*it).toLLSD()) << std::endl;
- }
-
- file.close();
+ // build filename for each user
+ std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
+
+ if (resolved_filename.empty())
+ {
+ LL_INFOS() << "can't get path to location history filename - probably not logged in yet." << LL_ENDL;
+ return;
+ }
+
+ // open a file for writing
+ llofstream file(resolved_filename.c_str());
+ if (!file.is_open())
+ {
+ LL_WARNS() << "can't open location history file \"" << mFilename << "\" for writing" << LL_ENDL;
+ return;
+ }
+
+ for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it)
+ {
+ file << LLSDOStreamer<LLSDNotationFormatter>((*it).toLLSD()) << std::endl;
+ }
+
+ file.close();
}
void LLLocationHistory::load()
{
- LL_INFOS() << "Loading location history." << LL_ENDL;
-
- // build filename for each user
- std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
- llifstream file(resolved_filename.c_str());
-
- if (!file.is_open())
- {
- LL_WARNS() << "can't load location history from file \"" << mFilename << "\"" << LL_ENDL;
- return;
- }
-
- mItems.clear();// need to use a direct call of clear() method to avoid signal invocation
-
- // add each line in the file to the list
- std::string line;
- LLPointer<LLSDParser> parser = new LLSDNotationParser();
- while (std::getline(file, line)) {
- LLSD s_item;
- std::istringstream iss(line);
- if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
- {
- LL_INFOS()<< "Parsing saved teleport history failed" << LL_ENDL;
- break;
- }
-
- mItems.push_back(s_item);
- }
-
- file.close();
-
- mChangedSignal(LOAD);
+ LL_INFOS() << "Loading location history." << LL_ENDL;
+
+ // build filename for each user
+ std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
+ llifstream file(resolved_filename.c_str());
+
+ if (!file.is_open())
+ {
+ LL_WARNS() << "can't load location history from file \"" << mFilename << "\"" << LL_ENDL;
+ return;
+ }
+
+ mItems.clear();// need to use a direct call of clear() method to avoid signal invocation
+
+ // add each line in the file to the list
+ std::string line;
+ LLPointer<LLSDParser> parser = new LLSDNotationParser();
+ while (std::getline(file, line)) {
+ LLSD s_item;
+ std::istringstream iss(line);
+ if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
+ {
+ LL_INFOS()<< "Parsing saved teleport history failed" << LL_ENDL;
+ break;
+ }
+
+ mItems.push_back(s_item);
+ }
+
+ file.close();
+
+ mChangedSignal(LOAD);
}
diff --git a/indra/newview/lllocationhistory.h b/indra/newview/lllocationhistory.h
index 1cecbabd3b..ca9b81457c 100644
--- a/indra/newview/lllocationhistory.h
+++ b/indra/newview/lllocationhistory.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llocationhistory.h
* @brief Typed locations history
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,102 +40,102 @@ class LLSD;
* This enum is responsible for identifying of history item.
*/
enum ELocationType {
- TYPED_REGION_SLURL//item added after the user had typed a region name or slurl
- ,LANDMARK // item has been loaded from landmark folder
- ,TELEPORT_HISTORY // item from session teleport history
- };
+ TYPED_REGION_SLURL//item added after the user had typed a region name or slurl
+ ,LANDMARK // item has been loaded from landmark folder
+ ,TELEPORT_HISTORY // item from session teleport history
+ };
class LLLocationHistoryItem {
-
+
public:
- LLLocationHistoryItem(){}
- LLLocationHistoryItem(std::string typed_location,
- LLVector3d global_position, std::string tooltip,ELocationType type ):
- mLocation(typed_location),
- mGlobalPos(global_position),
- mToolTip(tooltip),
- mType(type)
- {}
- LLLocationHistoryItem(const LLLocationHistoryItem& item):
- mGlobalPos(item.mGlobalPos),
- mToolTip(item.mToolTip),
- mLocation(item.mLocation),
- mType(item.mType)
- {}
- LLLocationHistoryItem(const LLSD& data):
- mLocation(data["location"]),
- mGlobalPos(data["global_pos"]),
- mToolTip(data["tooltip"]),
- mType(ELocationType(data["item_type"].asInteger()))
- {}
-
- bool operator==(const LLLocationHistoryItem& item)
- {
- // do not compare mGlobalPos,
- // because of a rounding off , the history can contain duplicates
- return mLocation == item.mLocation && (mType == item.mType);
- }
- bool operator!=(const LLLocationHistoryItem& item)
- {
- return ! (*this == item);
- }
- LLSD toLLSD() const
- {
- LLSD val;
- val["location"]= mLocation;
- val["global_pos"] = mGlobalPos.getValue();
- val["tooltip"] = mToolTip;
- val["item_type"] = mType;
- return val;
- }
- const std::string& getLocation() const { return mLocation; };
- const std::string& getToolTip() const { return mToolTip; };
- //static bool equalByRegionParcel(const LLLocationHistoryItem& item1, const LLLocationHistoryItem& item2);
- static bool equalByLocation(const LLLocationHistoryItem& item1, const std::string& item_location)
- {
- return item1.getLocation() == item_location;
- }
-
- LLVector3d mGlobalPos; // global position
- std::string mToolTip;// SURL
- std::string mLocation;// typed_location
- ELocationType mType;
+ LLLocationHistoryItem(){}
+ LLLocationHistoryItem(std::string typed_location,
+ LLVector3d global_position, std::string tooltip,ELocationType type ):
+ mLocation(typed_location),
+ mGlobalPos(global_position),
+ mToolTip(tooltip),
+ mType(type)
+ {}
+ LLLocationHistoryItem(const LLLocationHistoryItem& item):
+ mGlobalPos(item.mGlobalPos),
+ mToolTip(item.mToolTip),
+ mLocation(item.mLocation),
+ mType(item.mType)
+ {}
+ LLLocationHistoryItem(const LLSD& data):
+ mLocation(data["location"]),
+ mGlobalPos(data["global_pos"]),
+ mToolTip(data["tooltip"]),
+ mType(ELocationType(data["item_type"].asInteger()))
+ {}
+
+ bool operator==(const LLLocationHistoryItem& item)
+ {
+ // do not compare mGlobalPos,
+ // because of a rounding off , the history can contain duplicates
+ return mLocation == item.mLocation && (mType == item.mType);
+ }
+ bool operator!=(const LLLocationHistoryItem& item)
+ {
+ return ! (*this == item);
+ }
+ LLSD toLLSD() const
+ {
+ LLSD val;
+ val["location"]= mLocation;
+ val["global_pos"] = mGlobalPos.getValue();
+ val["tooltip"] = mToolTip;
+ val["item_type"] = mType;
+ return val;
+ }
+ const std::string& getLocation() const { return mLocation; };
+ const std::string& getToolTip() const { return mToolTip; };
+ //static bool equalByRegionParcel(const LLLocationHistoryItem& item1, const LLLocationHistoryItem& item2);
+ static bool equalByLocation(const LLLocationHistoryItem& item1, const std::string& item_location)
+ {
+ return item1.getLocation() == item_location;
+ }
+
+ LLVector3d mGlobalPos; // global position
+ std::string mToolTip;// SURL
+ std::string mLocation;// typed_location
+ ELocationType mType;
};
class LLLocationHistory: public LLSingleton<LLLocationHistory>
{
- LLSINGLETON(LLLocationHistory);
- LOG_CLASS(LLLocationHistory);
+ LLSINGLETON(LLLocationHistory);
+ LOG_CLASS(LLLocationHistory);
public:
- enum EChangeType
- {
- ADD
- ,CLEAR
- ,LOAD
- };
-
- typedef std::vector<LLLocationHistoryItem> location_list_t;
- typedef boost::function<void(EChangeType event)> history_changed_callback_t;
- typedef boost::signals2::signal<void(EChangeType event)> history_changed_signal_t;
-
-
- void addItem(const LLLocationHistoryItem& item);
- bool touchItem(const LLLocationHistoryItem& item);
- void removeItems();
- size_t getItemCount() const { return mItems.size(); }
- const location_list_t& getItems() const { return mItems; }
- bool getMatchingItems(const std::string& substring, location_list_t& result) const;
- boost::signals2::connection setChangedCallback(history_changed_callback_t cb) { return mChangedSignal.connect(cb); }
-
- void save() const;
- void load();
- void dump() const;
+ enum EChangeType
+ {
+ ADD
+ ,CLEAR
+ ,LOAD
+ };
+
+ typedef std::vector<LLLocationHistoryItem> location_list_t;
+ typedef boost::function<void(EChangeType event)> history_changed_callback_t;
+ typedef boost::signals2::signal<void(EChangeType event)> history_changed_signal_t;
+
+
+ void addItem(const LLLocationHistoryItem& item);
+ bool touchItem(const LLLocationHistoryItem& item);
+ void removeItems();
+ size_t getItemCount() const { return mItems.size(); }
+ const location_list_t& getItems() const { return mItems; }
+ bool getMatchingItems(const std::string& substring, location_list_t& result) const;
+ boost::signals2::connection setChangedCallback(history_changed_callback_t cb) { return mChangedSignal.connect(cb); }
+
+ void save() const;
+ void load();
+ void dump() const;
private:
- location_list_t mItems;
- std::string mFilename; /// File to store the history to.
- history_changed_signal_t mChangedSignal;
+ location_list_t mItems;
+ std::string mFilename; /// File to store the history to.
+ history_changed_signal_t mChangedSignal;
};
#endif
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 9fa35e3bd9..ed48d78c2b 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,7 +54,7 @@
#include "llpathfindingnavmeshstatus.h"
#include "llteleporthistory.h"
#include "llslurl.h"
-#include "llstatusbar.h" // getHealth()
+#include "llstatusbar.h" // getHealth()
#include "lltrans.h"
#include "llviewerinventory.h"
#include "llviewerparcelmgr.h"
@@ -70,25 +70,25 @@
//============================================================================
/*
* "ADD LANDMARK" BUTTON UPDATING LOGIC
- *
+ *
* If the current parcel has been landmarked, we should draw
* a special image on the button.
- *
+ *
* To avoid determining the appropriate image on every draw() we do that
* only in the following cases:
* 1) Navbar is shown for the first time after login.
* 2) Agent moves to another parcel.
* 3) A landmark is created or removed.
- *
+ *
* The first case is handled by the handleLoginComplete() method.
- *
+ *
* The second case is handled by setting the "agent parcel changed" callback
* on LLViewerParcelMgr.
- *
+ *
* The third case is the most complex one. We have two inventory observers for that:
* one is designated to handle adding landmarks, the other handles removal.
* Let's see how the former works.
- *
+ *
* When we get notified about landmark addition, the landmark position is unknown yet. What we can
* do at that point is initiate loading the landmark data by LLLandmarkList and set the
* "loading finished" callback on it. Finally, when the callback is triggered,
@@ -105,31 +105,31 @@
class LLAddLandmarkObserver : public LLInventoryAddedObserver
{
public:
- LLAddLandmarkObserver(LLLocationInputCtrl* input) : mInput(input) {}
+ LLAddLandmarkObserver(LLLocationInputCtrl* input) : mInput(input) {}
private:
- /*virtual*/ void done()
- {
- const uuid_set_t& added = gInventory.getAddedIDs();
- for (uuid_set_t::const_iterator it = added.begin(); it != added.end(); ++it)
- {
- LLInventoryItem* item = gInventory.getItem(*it);
- if (!item || item->getType() != LLAssetType::AT_LANDMARK)
- continue;
-
- // Start loading the landmark.
- LLLandmark* lm = gLandmarkList.getAsset(
- item->getAssetUUID(),
- boost::bind(&LLLocationInputCtrl::onLandmarkLoaded, mInput, _1));
- if (lm)
- {
- // Already loaded? Great, handle it immediately (the callback won't be called).
- mInput->onLandmarkLoaded(lm);
- }
- }
- }
-
- LLLocationInputCtrl* mInput;
+ /*virtual*/ void done()
+ {
+ const uuid_set_t& added = gInventory.getAddedIDs();
+ for (uuid_set_t::const_iterator it = added.begin(); it != added.end(); ++it)
+ {
+ LLInventoryItem* item = gInventory.getItem(*it);
+ if (!item || item->getType() != LLAssetType::AT_LANDMARK)
+ continue;
+
+ // Start loading the landmark.
+ LLLandmark* lm = gLandmarkList.getAsset(
+ item->getAssetUUID(),
+ boost::bind(&LLLocationInputCtrl::onLandmarkLoaded, mInput, _1));
+ if (lm)
+ {
+ // Already loaded? Great, handle it immediately (the callback won't be called).
+ mInput->onLandmarkLoaded(lm);
+ }
+ }
+ }
+
+ LLLocationInputCtrl* mInput;
};
/**
@@ -138,39 +138,39 @@ private:
class LLRemoveLandmarkObserver : public LLInventoryObserver
{
public:
- LLRemoveLandmarkObserver(LLLocationInputCtrl* input) : mInput(input) {}
+ LLRemoveLandmarkObserver(LLLocationInputCtrl* input) : mInput(input) {}
private:
- /*virtual*/ void changed(U32 mask)
- {
- if (mask & (~(LLInventoryObserver::LABEL|
- LLInventoryObserver::INTERNAL|
- LLInventoryObserver::ADD|
- LLInventoryObserver::CREATE|
- LLInventoryObserver::UPDATE_CREATE)))
- {
- mInput->updateAddLandmarkButton();
- }
- }
-
- LLLocationInputCtrl* mInput;
+ /*virtual*/ void changed(U32 mask)
+ {
+ if (mask & (~(LLInventoryObserver::LABEL|
+ LLInventoryObserver::INTERNAL|
+ LLInventoryObserver::ADD|
+ LLInventoryObserver::CREATE|
+ LLInventoryObserver::UPDATE_CREATE)))
+ {
+ mInput->updateAddLandmarkButton();
+ }
+ }
+
+ LLLocationInputCtrl* mInput;
};
class LLParcelChangeObserver : public LLParcelObserver
{
public:
- LLParcelChangeObserver(LLLocationInputCtrl* input) : mInput(input) {}
+ LLParcelChangeObserver(LLLocationInputCtrl* input) : mInput(input) {}
private:
- /*virtual*/ void changed()
- {
- if (mInput)
- {
- mInput->refreshParcelIcons();
- }
- }
-
- LLLocationInputCtrl* mInput;
+ /*virtual*/ void changed()
+ {
+ if (mInput)
+ {
+ mInput->refreshParcelIcons();
+ }
+ }
+
+ LLLocationInputCtrl* mInput;
};
//============================================================================
@@ -179,371 +179,371 @@ private:
static LLDefaultChildRegistry::Register<LLLocationInputCtrl> r("location_input");
LLLocationInputCtrl::Params::Params()
-: icon_maturity_general("icon_maturity_general"),
- icon_maturity_adult("icon_maturity_adult"),
- icon_maturity_moderate("icon_maturity_moderate"),
- add_landmark_image_enabled("add_landmark_image_enabled"),
- add_landmark_image_disabled("add_landmark_image_disabled"),
- add_landmark_image_hover("add_landmark_image_hover"),
- add_landmark_image_selected("add_landmark_image_selected"),
- add_landmark_hpad("add_landmark_hpad", 0),
- icon_hpad("icon_hpad", 0),
- add_landmark_button("add_landmark_button"),
- for_sale_button("for_sale_button"),
- info_button("info_button"),
- maturity_button("maturity_button"),
- voice_icon("voice_icon"),
- fly_icon("fly_icon"),
- push_icon("push_icon"),
- build_icon("build_icon"),
- scripts_icon("scripts_icon"),
- damage_icon("damage_icon"),
- damage_text("damage_text"),
- see_avatars_icon("see_avatars_icon"),
- maturity_help_topic("maturity_help_topic"),
- pathfinding_dirty_icon("pathfinding_dirty_icon"),
- pathfinding_disabled_icon("pathfinding_disabled_icon")
+: icon_maturity_general("icon_maturity_general"),
+ icon_maturity_adult("icon_maturity_adult"),
+ icon_maturity_moderate("icon_maturity_moderate"),
+ add_landmark_image_enabled("add_landmark_image_enabled"),
+ add_landmark_image_disabled("add_landmark_image_disabled"),
+ add_landmark_image_hover("add_landmark_image_hover"),
+ add_landmark_image_selected("add_landmark_image_selected"),
+ add_landmark_hpad("add_landmark_hpad", 0),
+ icon_hpad("icon_hpad", 0),
+ add_landmark_button("add_landmark_button"),
+ for_sale_button("for_sale_button"),
+ info_button("info_button"),
+ maturity_button("maturity_button"),
+ voice_icon("voice_icon"),
+ fly_icon("fly_icon"),
+ push_icon("push_icon"),
+ build_icon("build_icon"),
+ scripts_icon("scripts_icon"),
+ damage_icon("damage_icon"),
+ damage_text("damage_text"),
+ see_avatars_icon("see_avatars_icon"),
+ maturity_help_topic("maturity_help_topic"),
+ pathfinding_dirty_icon("pathfinding_dirty_icon"),
+ pathfinding_disabled_icon("pathfinding_disabled_icon")
{
}
LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
-: LLComboBox(p),
- mIconHPad(p.icon_hpad),
- mAddLandmarkHPad(p.add_landmark_hpad),
- mLocationContextMenu(NULL),
- mAddLandmarkBtn(NULL),
- mForSaleBtn(NULL),
- mInfoBtn(NULL),
- mRegionCrossingSlot(),
- mNavMeshSlot(),
- mIsNavMeshDirty(false),
- mLandmarkImageOn(NULL),
- mLandmarkImageOff(NULL),
- mIconMaturityGeneral(NULL),
- mIconMaturityAdult(NULL),
- mIconMaturityModerate(NULL),
- mMaturityHelpTopic(p.maturity_help_topic)
+: LLComboBox(p),
+ mIconHPad(p.icon_hpad),
+ mAddLandmarkHPad(p.add_landmark_hpad),
+ mLocationContextMenu(NULL),
+ mAddLandmarkBtn(NULL),
+ mForSaleBtn(NULL),
+ mInfoBtn(NULL),
+ mRegionCrossingSlot(),
+ mNavMeshSlot(),
+ mIsNavMeshDirty(false),
+ mLandmarkImageOn(NULL),
+ mLandmarkImageOff(NULL),
+ mIconMaturityGeneral(NULL),
+ mIconMaturityAdult(NULL),
+ mIconMaturityModerate(NULL),
+ mMaturityHelpTopic(p.maturity_help_topic)
{
- // Lets replace default LLLineEditor with LLLocationLineEditor
- // to make needed escaping while copying and cutting url
- delete mTextEntry;
-
- // Can't access old mTextEntry fields as they are protected, so lets build new params
- // That is C&P from LLComboBox::createLineEditor function
- static LLUICachedControl<S32> drop_shadow_button ("DropShadowButton", 0);
- S32 arrow_width = mArrowImage ? mArrowImage->getWidth() : 0;
- LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
- text_entry_rect.mRight -= llmax(8,arrow_width) + 2 * drop_shadow_button;
-
- LLLineEditor::Params params = p.combo_editor;
- params.rect(text_entry_rect);
- params.default_text(LLStringUtil::null);
- params.max_length.bytes(p.max_chars);
- params.keystroke_callback(boost::bind(&LLLocationInputCtrl::onTextEntry, this, _1));
- params.commit_on_focus_lost(false);
- params.follows.flags(FOLLOWS_ALL);
- mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params);
- mTextEntry->resetContextMenu();
- addChild(mTextEntry);
- // LLLineEditor is replaced with LLLocationLineEditor
-
- // "Place information" button.
- LLButton::Params info_params = p.info_button;
- mInfoBtn = LLUICtrlFactory::create<LLButton>(info_params);
- mInfoBtn->setClickedCallback(boost::bind(&LLLocationInputCtrl::onInfoButtonClicked, this));
- addChild(mInfoBtn);
-
- // "Add landmark" button.
- LLButton::Params al_params = p.add_landmark_button;
-
- // Image for unselected state will be set in updateAddLandmarkButton(),
- // it will be either mLandmarkOn or mLandmarkOff
- if (p.add_landmark_image_enabled())
- {
- mLandmarkImageOn = p.add_landmark_image_enabled;
- }
- if (p.add_landmark_image_disabled())
- {
- mLandmarkImageOff = p.add_landmark_image_disabled;
- }
-
- if(p.add_landmark_image_selected)
- {
- al_params.image_selected = p.add_landmark_image_selected;
- }
- if (p.add_landmark_image_hover())
- {
- al_params.image_hover_unselected = p.add_landmark_image_hover;
- }
-
- al_params.click_callback.function(boost::bind(&LLLocationInputCtrl::onAddLandmarkButtonClicked, this));
- mAddLandmarkBtn = LLUICtrlFactory::create<LLButton>(al_params);
- enableAddLandmarkButton(true);
- addChild(mAddLandmarkBtn);
-
- if (p.icon_maturity_general())
- {
- mIconMaturityGeneral = p.icon_maturity_general;
- }
- if (p.icon_maturity_adult())
- {
- mIconMaturityAdult = p.icon_maturity_adult;
- }
- if(p.icon_maturity_moderate())
- {
- mIconMaturityModerate = p.icon_maturity_moderate;
- }
-
- LLButton::Params maturity_button = p.maturity_button;
- mMaturityButton = LLUICtrlFactory::create<LLButton>(maturity_button);
- addChild(mMaturityButton);
-
- LLButton::Params for_sale_button = p.for_sale_button;
- for_sale_button.tool_tip = LLTrans::getString("LocationCtrlForSaleTooltip");
- for_sale_button.click_callback.function(
- boost::bind(&LLLocationInputCtrl::onForSaleButtonClicked, this));
- mForSaleBtn = LLUICtrlFactory::create<LLButton>( for_sale_button );
- addChild(mForSaleBtn);
-
- // Parcel property icons
- // Must be mouse-opaque so cursor stays as an arrow when hovering to
- // see tooltip.
- LLIconCtrl::Params voice_icon = p.voice_icon;
- voice_icon.tool_tip = LLTrans::getString("LocationCtrlVoiceTooltip");
- voice_icon.mouse_opaque = true;
- mParcelIcon[VOICE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(voice_icon);
- mParcelIcon[VOICE_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, VOICE_ICON));
- addChild(mParcelIcon[VOICE_ICON]);
-
- LLIconCtrl::Params fly_icon = p.fly_icon;
- fly_icon.tool_tip = LLTrans::getString("LocationCtrlFlyTooltip");
- fly_icon.mouse_opaque = true;
- mParcelIcon[FLY_ICON] = LLUICtrlFactory::create<LLIconCtrl>(fly_icon);
- mParcelIcon[FLY_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, FLY_ICON));
- addChild(mParcelIcon[FLY_ICON]);
-
- LLIconCtrl::Params push_icon = p.push_icon;
- push_icon.tool_tip = LLTrans::getString("LocationCtrlPushTooltip");
- push_icon.mouse_opaque = true;
- mParcelIcon[PUSH_ICON] = LLUICtrlFactory::create<LLIconCtrl>(push_icon);
- mParcelIcon[PUSH_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, PUSH_ICON));
- addChild(mParcelIcon[PUSH_ICON]);
-
- LLIconCtrl::Params build_icon = p.build_icon;
- build_icon.tool_tip = LLTrans::getString("LocationCtrlBuildTooltip");
- build_icon.mouse_opaque = true;
- mParcelIcon[BUILD_ICON] = LLUICtrlFactory::create<LLIconCtrl>(build_icon);
- mParcelIcon[BUILD_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, BUILD_ICON));
- addChild(mParcelIcon[BUILD_ICON]);
-
- LLIconCtrl::Params scripts_icon = p.scripts_icon;
- scripts_icon.tool_tip = LLTrans::getString("LocationCtrlScriptsTooltip");
- scripts_icon.mouse_opaque = true;
- mParcelIcon[SCRIPTS_ICON] = LLUICtrlFactory::create<LLIconCtrl>(scripts_icon);
- mParcelIcon[SCRIPTS_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, SCRIPTS_ICON));
- addChild(mParcelIcon[SCRIPTS_ICON]);
-
- LLIconCtrl::Params damage_icon = p.damage_icon;
- damage_icon.tool_tip = LLTrans::getString("LocationCtrlDamageTooltip");
- damage_icon.mouse_opaque = true;
- mParcelIcon[DAMAGE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(damage_icon);
- mParcelIcon[DAMAGE_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, DAMAGE_ICON));
- addChild(mParcelIcon[DAMAGE_ICON]);
-
- LLIconCtrl::Params pathfinding_dirty_icon = p.pathfinding_dirty_icon;
- pathfinding_dirty_icon.tool_tip = LLTrans::getString("LocationCtrlPathfindingDirtyTooltip");
- pathfinding_dirty_icon.mouse_opaque = true;
- mParcelIcon[PATHFINDING_DIRTY_ICON] = LLUICtrlFactory::create<LLIconCtrl>(pathfinding_dirty_icon);
- mParcelIcon[PATHFINDING_DIRTY_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, PATHFINDING_DIRTY_ICON));
- addChild(mParcelIcon[PATHFINDING_DIRTY_ICON]);
-
- LLIconCtrl::Params pathfinding_disabled_icon = p.pathfinding_disabled_icon;
- pathfinding_disabled_icon.tool_tip = LLTrans::getString("LocationCtrlPathfindingDisabledTooltip");
- pathfinding_disabled_icon.mouse_opaque = true;
- mParcelIcon[PATHFINDING_DISABLED_ICON] = LLUICtrlFactory::create<LLIconCtrl>(pathfinding_disabled_icon);
- mParcelIcon[PATHFINDING_DISABLED_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, PATHFINDING_DISABLED_ICON));
- addChild(mParcelIcon[PATHFINDING_DISABLED_ICON]);
-
- LLTextBox::Params damage_text = p.damage_text;
- damage_text.tool_tip = LLTrans::getString("LocationCtrlDamageTooltip");
- damage_text.mouse_opaque = true;
- mDamageText = LLUICtrlFactory::create<LLTextBox>(damage_text);
- addChild(mDamageText);
-
- LLIconCtrl::Params see_avatars_icon = p.see_avatars_icon;
- see_avatars_icon.tool_tip = LLTrans::getString("LocationCtrlSeeAVsTooltip");
- see_avatars_icon.mouse_opaque = true;
- mParcelIcon[SEE_AVATARS_ICON] = LLUICtrlFactory::create<LLIconCtrl>(see_avatars_icon);
- mParcelIcon[SEE_AVATARS_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, SEE_AVATARS_ICON));
- addChild(mParcelIcon[SEE_AVATARS_ICON]);
-
- // Register callbacks and load the location field context menu (NB: the order matters).
- LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Navbar.Action", boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemClicked, this, _2));
- LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Navbar.EnableMenuItem", boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemEnabled, this, _2));
-
- setPrearrangeCallback(boost::bind(&LLLocationInputCtrl::onLocationPrearrange, this, _2));
- getTextEntry()->setMouseUpCallback(boost::bind(&LLLocationInputCtrl::changeLocationPresentation, this));
-
- // Load the location field context menu
- mLocationContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_navbar.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if (!mLocationContextMenu)
- {
- LL_WARNS() << "Error loading navigation bar context menu" << LL_ENDL;
-
- }
+ // Lets replace default LLLineEditor with LLLocationLineEditor
+ // to make needed escaping while copying and cutting url
+ delete mTextEntry;
+
+ // Can't access old mTextEntry fields as they are protected, so lets build new params
+ // That is C&P from LLComboBox::createLineEditor function
+ static LLUICachedControl<S32> drop_shadow_button ("DropShadowButton", 0);
+ S32 arrow_width = mArrowImage ? mArrowImage->getWidth() : 0;
+ LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
+ text_entry_rect.mRight -= llmax(8,arrow_width) + 2 * drop_shadow_button;
+
+ LLLineEditor::Params params = p.combo_editor;
+ params.rect(text_entry_rect);
+ params.default_text(LLStringUtil::null);
+ params.max_length.bytes(p.max_chars);
+ params.keystroke_callback(boost::bind(&LLLocationInputCtrl::onTextEntry, this, _1));
+ params.commit_on_focus_lost(false);
+ params.follows.flags(FOLLOWS_ALL);
+ mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params);
+ mTextEntry->resetContextMenu();
+ addChild(mTextEntry);
+ // LLLineEditor is replaced with LLLocationLineEditor
+
+ // "Place information" button.
+ LLButton::Params info_params = p.info_button;
+ mInfoBtn = LLUICtrlFactory::create<LLButton>(info_params);
+ mInfoBtn->setClickedCallback(boost::bind(&LLLocationInputCtrl::onInfoButtonClicked, this));
+ addChild(mInfoBtn);
+
+ // "Add landmark" button.
+ LLButton::Params al_params = p.add_landmark_button;
+
+ // Image for unselected state will be set in updateAddLandmarkButton(),
+ // it will be either mLandmarkOn or mLandmarkOff
+ if (p.add_landmark_image_enabled())
+ {
+ mLandmarkImageOn = p.add_landmark_image_enabled;
+ }
+ if (p.add_landmark_image_disabled())
+ {
+ mLandmarkImageOff = p.add_landmark_image_disabled;
+ }
+
+ if(p.add_landmark_image_selected)
+ {
+ al_params.image_selected = p.add_landmark_image_selected;
+ }
+ if (p.add_landmark_image_hover())
+ {
+ al_params.image_hover_unselected = p.add_landmark_image_hover;
+ }
+
+ al_params.click_callback.function(boost::bind(&LLLocationInputCtrl::onAddLandmarkButtonClicked, this));
+ mAddLandmarkBtn = LLUICtrlFactory::create<LLButton>(al_params);
+ enableAddLandmarkButton(true);
+ addChild(mAddLandmarkBtn);
+
+ if (p.icon_maturity_general())
+ {
+ mIconMaturityGeneral = p.icon_maturity_general;
+ }
+ if (p.icon_maturity_adult())
+ {
+ mIconMaturityAdult = p.icon_maturity_adult;
+ }
+ if(p.icon_maturity_moderate())
+ {
+ mIconMaturityModerate = p.icon_maturity_moderate;
+ }
+
+ LLButton::Params maturity_button = p.maturity_button;
+ mMaturityButton = LLUICtrlFactory::create<LLButton>(maturity_button);
+ addChild(mMaturityButton);
+
+ LLButton::Params for_sale_button = p.for_sale_button;
+ for_sale_button.tool_tip = LLTrans::getString("LocationCtrlForSaleTooltip");
+ for_sale_button.click_callback.function(
+ boost::bind(&LLLocationInputCtrl::onForSaleButtonClicked, this));
+ mForSaleBtn = LLUICtrlFactory::create<LLButton>( for_sale_button );
+ addChild(mForSaleBtn);
+
+ // Parcel property icons
+ // Must be mouse-opaque so cursor stays as an arrow when hovering to
+ // see tooltip.
+ LLIconCtrl::Params voice_icon = p.voice_icon;
+ voice_icon.tool_tip = LLTrans::getString("LocationCtrlVoiceTooltip");
+ voice_icon.mouse_opaque = true;
+ mParcelIcon[VOICE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(voice_icon);
+ mParcelIcon[VOICE_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, VOICE_ICON));
+ addChild(mParcelIcon[VOICE_ICON]);
+
+ LLIconCtrl::Params fly_icon = p.fly_icon;
+ fly_icon.tool_tip = LLTrans::getString("LocationCtrlFlyTooltip");
+ fly_icon.mouse_opaque = true;
+ mParcelIcon[FLY_ICON] = LLUICtrlFactory::create<LLIconCtrl>(fly_icon);
+ mParcelIcon[FLY_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, FLY_ICON));
+ addChild(mParcelIcon[FLY_ICON]);
+
+ LLIconCtrl::Params push_icon = p.push_icon;
+ push_icon.tool_tip = LLTrans::getString("LocationCtrlPushTooltip");
+ push_icon.mouse_opaque = true;
+ mParcelIcon[PUSH_ICON] = LLUICtrlFactory::create<LLIconCtrl>(push_icon);
+ mParcelIcon[PUSH_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, PUSH_ICON));
+ addChild(mParcelIcon[PUSH_ICON]);
+
+ LLIconCtrl::Params build_icon = p.build_icon;
+ build_icon.tool_tip = LLTrans::getString("LocationCtrlBuildTooltip");
+ build_icon.mouse_opaque = true;
+ mParcelIcon[BUILD_ICON] = LLUICtrlFactory::create<LLIconCtrl>(build_icon);
+ mParcelIcon[BUILD_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, BUILD_ICON));
+ addChild(mParcelIcon[BUILD_ICON]);
+
+ LLIconCtrl::Params scripts_icon = p.scripts_icon;
+ scripts_icon.tool_tip = LLTrans::getString("LocationCtrlScriptsTooltip");
+ scripts_icon.mouse_opaque = true;
+ mParcelIcon[SCRIPTS_ICON] = LLUICtrlFactory::create<LLIconCtrl>(scripts_icon);
+ mParcelIcon[SCRIPTS_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, SCRIPTS_ICON));
+ addChild(mParcelIcon[SCRIPTS_ICON]);
+
+ LLIconCtrl::Params damage_icon = p.damage_icon;
+ damage_icon.tool_tip = LLTrans::getString("LocationCtrlDamageTooltip");
+ damage_icon.mouse_opaque = true;
+ mParcelIcon[DAMAGE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(damage_icon);
+ mParcelIcon[DAMAGE_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, DAMAGE_ICON));
+ addChild(mParcelIcon[DAMAGE_ICON]);
+
+ LLIconCtrl::Params pathfinding_dirty_icon = p.pathfinding_dirty_icon;
+ pathfinding_dirty_icon.tool_tip = LLTrans::getString("LocationCtrlPathfindingDirtyTooltip");
+ pathfinding_dirty_icon.mouse_opaque = true;
+ mParcelIcon[PATHFINDING_DIRTY_ICON] = LLUICtrlFactory::create<LLIconCtrl>(pathfinding_dirty_icon);
+ mParcelIcon[PATHFINDING_DIRTY_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, PATHFINDING_DIRTY_ICON));
+ addChild(mParcelIcon[PATHFINDING_DIRTY_ICON]);
+
+ LLIconCtrl::Params pathfinding_disabled_icon = p.pathfinding_disabled_icon;
+ pathfinding_disabled_icon.tool_tip = LLTrans::getString("LocationCtrlPathfindingDisabledTooltip");
+ pathfinding_disabled_icon.mouse_opaque = true;
+ mParcelIcon[PATHFINDING_DISABLED_ICON] = LLUICtrlFactory::create<LLIconCtrl>(pathfinding_disabled_icon);
+ mParcelIcon[PATHFINDING_DISABLED_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, PATHFINDING_DISABLED_ICON));
+ addChild(mParcelIcon[PATHFINDING_DISABLED_ICON]);
+
+ LLTextBox::Params damage_text = p.damage_text;
+ damage_text.tool_tip = LLTrans::getString("LocationCtrlDamageTooltip");
+ damage_text.mouse_opaque = true;
+ mDamageText = LLUICtrlFactory::create<LLTextBox>(damage_text);
+ addChild(mDamageText);
+
+ LLIconCtrl::Params see_avatars_icon = p.see_avatars_icon;
+ see_avatars_icon.tool_tip = LLTrans::getString("LocationCtrlSeeAVsTooltip");
+ see_avatars_icon.mouse_opaque = true;
+ mParcelIcon[SEE_AVATARS_ICON] = LLUICtrlFactory::create<LLIconCtrl>(see_avatars_icon);
+ mParcelIcon[SEE_AVATARS_ICON]->setMouseDownCallback(boost::bind(&LLLocationInputCtrl::onParcelIconClick, this, SEE_AVATARS_ICON));
+ addChild(mParcelIcon[SEE_AVATARS_ICON]);
+
+ // Register callbacks and load the location field context menu (NB: the order matters).
+ LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Navbar.Action", boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemClicked, this, _2));
+ LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Navbar.EnableMenuItem", boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemEnabled, this, _2));
+
+ setPrearrangeCallback(boost::bind(&LLLocationInputCtrl::onLocationPrearrange, this, _2));
+ getTextEntry()->setMouseUpCallback(boost::bind(&LLLocationInputCtrl::changeLocationPresentation, this));
+
+ // Load the location field context menu
+ mLocationContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_navbar.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (!mLocationContextMenu)
+ {
+ LL_WARNS() << "Error loading navigation bar context menu" << LL_ENDL;
+
+ }
//don't show default context menu
getTextEntry()->setShowContextMenu(false);
getTextEntry()->setRightMouseDownCallback(boost::bind(&LLLocationInputCtrl::onTextEditorRightClicked, this, _2, _3, _4));
- updateWidgetlayout();
-
- // Connecting signal for updating location on "Show Coordinates" setting change.
- LLControlVariable* coordinates_control = gSavedSettings.getControl("NavBarShowCoordinates").get();
- if (coordinates_control)
- {
- mCoordinatesControlConnection = coordinates_control->getSignal()->connect(boost::bind(&LLLocationInputCtrl::refreshLocation, this));
- }
-
- // Connecting signal for updating parcel icons on "Show Parcel Properties" setting change.
- LLControlVariable* parcel_properties_control = gSavedSettings.getControl("NavBarShowParcelProperties").get();
- if (parcel_properties_control)
- {
- mParcelPropertiesControlConnection = parcel_properties_control->getSignal()->connect(boost::bind(&LLLocationInputCtrl::refreshParcelIcons, this));
- }
-
- // - Make the "Add landmark" button updated when either current parcel gets changed
- // or a landmark gets created or removed from the inventory.
- // - Update the location string on parcel change.
- mParcelMgrConnection = gAgent.addParcelChangedCallback(
- boost::bind(&LLLocationInputCtrl::onAgentParcelChange, this));
- // LLLocationHistory instance is being created before the location input control, so we have to update initial state of button manually.
- mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0);
- mLocationHistoryConnection = LLLocationHistory::getInstance()->setChangedCallback(
- boost::bind(&LLLocationInputCtrl::onLocationHistoryChanged, this,_1));
-
- mRegionCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLLocationInputCtrl::onRegionBoundaryCrossed, this));
- createNavMeshStatusListenerForCurrentRegion();
-
- mRemoveLandmarkObserver = new LLRemoveLandmarkObserver(this);
- mAddLandmarkObserver = new LLAddLandmarkObserver(this);
- gInventory.addObserver(mRemoveLandmarkObserver);
- gInventory.addObserver(mAddLandmarkObserver);
-
- mParcelChangeObserver = new LLParcelChangeObserver(this);
- LLViewerParcelMgr::getInstance()->addObserver(mParcelChangeObserver);
-
- mAddLandmarkTooltip = LLTrans::getString("LocationCtrlAddLandmarkTooltip");
- mEditLandmarkTooltip = LLTrans::getString("LocationCtrlEditLandmarkTooltip");
- mButton->setToolTip(LLTrans::getString("LocationCtrlComboBtnTooltip"));
- mInfoBtn->setToolTip(LLTrans::getString("LocationCtrlInfoBtnTooltip"));
+ updateWidgetlayout();
+
+ // Connecting signal for updating location on "Show Coordinates" setting change.
+ LLControlVariable* coordinates_control = gSavedSettings.getControl("NavBarShowCoordinates").get();
+ if (coordinates_control)
+ {
+ mCoordinatesControlConnection = coordinates_control->getSignal()->connect(boost::bind(&LLLocationInputCtrl::refreshLocation, this));
+ }
+
+ // Connecting signal for updating parcel icons on "Show Parcel Properties" setting change.
+ LLControlVariable* parcel_properties_control = gSavedSettings.getControl("NavBarShowParcelProperties").get();
+ if (parcel_properties_control)
+ {
+ mParcelPropertiesControlConnection = parcel_properties_control->getSignal()->connect(boost::bind(&LLLocationInputCtrl::refreshParcelIcons, this));
+ }
+
+ // - Make the "Add landmark" button updated when either current parcel gets changed
+ // or a landmark gets created or removed from the inventory.
+ // - Update the location string on parcel change.
+ mParcelMgrConnection = gAgent.addParcelChangedCallback(
+ boost::bind(&LLLocationInputCtrl::onAgentParcelChange, this));
+ // LLLocationHistory instance is being created before the location input control, so we have to update initial state of button manually.
+ mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0);
+ mLocationHistoryConnection = LLLocationHistory::getInstance()->setChangedCallback(
+ boost::bind(&LLLocationInputCtrl::onLocationHistoryChanged, this,_1));
+
+ mRegionCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLLocationInputCtrl::onRegionBoundaryCrossed, this));
+ createNavMeshStatusListenerForCurrentRegion();
+
+ mRemoveLandmarkObserver = new LLRemoveLandmarkObserver(this);
+ mAddLandmarkObserver = new LLAddLandmarkObserver(this);
+ gInventory.addObserver(mRemoveLandmarkObserver);
+ gInventory.addObserver(mAddLandmarkObserver);
+
+ mParcelChangeObserver = new LLParcelChangeObserver(this);
+ LLViewerParcelMgr::getInstance()->addObserver(mParcelChangeObserver);
+
+ mAddLandmarkTooltip = LLTrans::getString("LocationCtrlAddLandmarkTooltip");
+ mEditLandmarkTooltip = LLTrans::getString("LocationCtrlEditLandmarkTooltip");
+ mButton->setToolTip(LLTrans::getString("LocationCtrlComboBtnTooltip"));
+ mInfoBtn->setToolTip(LLTrans::getString("LocationCtrlInfoBtnTooltip"));
}
LLLocationInputCtrl::~LLLocationInputCtrl()
{
- gInventory.removeObserver(mRemoveLandmarkObserver);
- gInventory.removeObserver(mAddLandmarkObserver);
- delete mRemoveLandmarkObserver;
- delete mAddLandmarkObserver;
-
- LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangeObserver);
- delete mParcelChangeObserver;
-
- mRegionCrossingSlot.disconnect();
- mNavMeshSlot.disconnect();
- mCoordinatesControlConnection.disconnect();
- mParcelPropertiesControlConnection.disconnect();
- mParcelMgrConnection.disconnect();
- mLocationHistoryConnection.disconnect();
+ gInventory.removeObserver(mRemoveLandmarkObserver);
+ gInventory.removeObserver(mAddLandmarkObserver);
+ delete mRemoveLandmarkObserver;
+ delete mAddLandmarkObserver;
+
+ LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangeObserver);
+ delete mParcelChangeObserver;
+
+ mRegionCrossingSlot.disconnect();
+ mNavMeshSlot.disconnect();
+ mCoordinatesControlConnection.disconnect();
+ mParcelPropertiesControlConnection.disconnect();
+ mParcelMgrConnection.disconnect();
+ mLocationHistoryConnection.disconnect();
}
void LLLocationInputCtrl::setEnabled(BOOL enabled)
{
- LLComboBox::setEnabled(enabled);
- mAddLandmarkBtn->setEnabled(enabled);
+ LLComboBox::setEnabled(enabled);
+ mAddLandmarkBtn->setEnabled(enabled);
}
void LLLocationInputCtrl::hideList()
{
- LLComboBox::hideList();
- if (mTextEntry && hasFocus())
- focusTextEntry();
+ LLComboBox::hideList();
+ if (mTextEntry && hasFocus())
+ focusTextEntry();
}
BOOL LLLocationInputCtrl::handleToolTip(S32 x, S32 y, MASK mask)
{
- if(mAddLandmarkBtn->parentPointInView(x,y))
- {
- updateAddLandmarkTooltip();
- }
- // Let the buttons show their tooltips.
- if (LLUICtrl::handleToolTip(x, y, mask))
- {
- if (mList->getRect().pointInRect(x, y))
- {
- S32 loc_x, loc_y;
- //x,y - contain coordinates related to the location input control, but without taking the expanded list into account
- //So we have to convert it again into local coordinates of mList
- localPointToOtherView(x,y,&loc_x,&loc_y,mList);
-
- LLScrollListItem* item = mList->hitItem(loc_x,loc_y);
- if (item)
- {
- LLSD value = item->getValue();
- if (value.has("tooltip"))
- {
- LLToolTipMgr::instance().show(value["tooltip"]);
- }
- }
- }
-
- return TRUE;
- }
-
- return FALSE;
+ if(mAddLandmarkBtn->parentPointInView(x,y))
+ {
+ updateAddLandmarkTooltip();
+ }
+ // Let the buttons show their tooltips.
+ if (LLUICtrl::handleToolTip(x, y, mask))
+ {
+ if (mList->getRect().pointInRect(x, y))
+ {
+ S32 loc_x, loc_y;
+ //x,y - contain coordinates related to the location input control, but without taking the expanded list into account
+ //So we have to convert it again into local coordinates of mList
+ localPointToOtherView(x,y,&loc_x,&loc_y,mList);
+
+ LLScrollListItem* item = mList->hitItem(loc_x,loc_y);
+ if (item)
+ {
+ LLSD value = item->getValue();
+ if (value.has("tooltip"))
+ {
+ LLToolTipMgr::instance().show(value["tooltip"]);
+ }
+ }
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
}
BOOL LLLocationInputCtrl::handleKeyHere(KEY key, MASK mask)
{
- BOOL result = LLComboBox::handleKeyHere(key, mask);
+ BOOL result = LLComboBox::handleKeyHere(key, mask);
- if (key == KEY_DOWN && hasFocus() && mList->getItemCount() != 0 && !mList->getVisible())
- {
- showList();
- }
+ if (key == KEY_DOWN && hasFocus() && mList->getItemCount() != 0 && !mList->getVisible())
+ {
+ showList();
+ }
- return result;
+ return result;
}
void LLLocationInputCtrl::onTextEntry(LLLineEditor* line_editor)
{
- KEY key = gKeyboard->currentKey();
- MASK mask = gKeyboard->currentMask(TRUE);
-
- // Typing? (moving cursor should not affect showing the list)
- bool typing = mask != MASK_CONTROL && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END;
- bool pasting = mask == MASK_CONTROL && key == 'V';
-
- if (line_editor->getText().empty())
- {
- prearrangeList(); // resets filter
- hideList();
- }
- else if (typing || pasting)
- {
- prearrangeList(line_editor->getText());
- if (mList->getItemCount() != 0)
- {
- showList();
- focusTextEntry();
- }
- else
- {
- // Hide the list if it's empty.
- hideList();
- }
- }
-
- LLComboBox::onTextEntry(line_editor);
+ KEY key = gKeyboard->currentKey();
+ MASK mask = gKeyboard->currentMask(TRUE);
+
+ // Typing? (moving cursor should not affect showing the list)
+ bool typing = mask != MASK_CONTROL && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END;
+ bool pasting = mask == MASK_CONTROL && key == 'V';
+
+ if (line_editor->getText().empty())
+ {
+ prearrangeList(); // resets filter
+ hideList();
+ }
+ else if (typing || pasting)
+ {
+ prearrangeList(line_editor->getText());
+ if (mList->getItemCount() != 0)
+ {
+ showList();
+ focusTextEntry();
+ }
+ else
+ {
+ // Hide the list if it's empty.
+ hideList();
+ }
+ }
+
+ LLComboBox::onTextEntry(line_editor);
}
/**
@@ -553,728 +553,728 @@ void LLLocationInputCtrl::onTextEntry(LLLineEditor* line_editor)
*/
void LLLocationInputCtrl::setText(const LLStringExplicit& text)
{
- if (mTextEntry)
- {
- mTextEntry->setText(text);
- }
- mHasAutocompletedText = FALSE;
+ if (mTextEntry)
+ {
+ mTextEntry->setText(text);
+ }
+ mHasAutocompletedText = FALSE;
}
void LLLocationInputCtrl::setFocus(BOOL b)
{
- LLComboBox::setFocus(b);
+ LLComboBox::setFocus(b);
- if (mTextEntry && b && !mList->getVisible())
- {
- mTextEntry->setFocus(TRUE);
- }
+ if (mTextEntry && b && !mList->getVisible())
+ {
+ mTextEntry->setFocus(TRUE);
+ }
}
void LLLocationInputCtrl::handleLoginComplete()
{
- // An agent parcel update hasn't occurred yet, so we have to
- // manually set location and the appropriate "Add landmark" icon.
- refresh();
+ // An agent parcel update hasn't occurred yet, so we have to
+ // manually set location and the appropriate "Add landmark" icon.
+ refresh();
}
//== private methods =========================================================
void LLLocationInputCtrl::onFocusReceived()
{
- prearrangeList();
+ prearrangeList();
}
void LLLocationInputCtrl::onFocusLost()
{
- LLUICtrl::onFocusLost();
- refreshLocation();
+ LLUICtrl::onFocusLost();
+ refreshLocation();
- // Setting cursor to 0 to show the left edge of the text. See STORM-370.
- mTextEntry->setCursor(0);
+ // Setting cursor to 0 to show the left edge of the text. See STORM-370.
+ mTextEntry->setCursor(0);
- if(mTextEntry->hasSelection()){
- mTextEntry->deselect();
- }
+ if(mTextEntry->hasSelection()){
+ mTextEntry->deselect();
+ }
}
void LLLocationInputCtrl::draw()
{
- static LLUICachedControl<bool> show_coords("NavBarShowCoordinates", false);
- if(!hasFocus() && show_coords)
- {
- refreshLocation();
- }
-
- static LLUICachedControl<bool> show_icons("NavBarShowParcelProperties", false);
- if (show_icons)
- {
- refreshHealth();
- }
- LLComboBox::draw();
+ static LLUICachedControl<bool> show_coords("NavBarShowCoordinates", false);
+ if(!hasFocus() && show_coords)
+ {
+ refreshLocation();
+ }
+
+ static LLUICachedControl<bool> show_icons("NavBarShowParcelProperties", false);
+ if (show_icons)
+ {
+ refreshHealth();
+ }
+ LLComboBox::draw();
}
void LLLocationInputCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- LLComboBox::reshape(width, height, called_from_parent);
-
- // Setting cursor to 0 to show the left edge of the text. See EXT-4967.
- mTextEntry->setCursor(0);
- if (mTextEntry->hasSelection())
- {
- // Deselecting because selection position is changed together with
- // cursor position change.
- mTextEntry->deselect();
- }
-
- if (isHumanReadableLocationVisible)
- {
- refreshMaturityButton();
- }
+ LLComboBox::reshape(width, height, called_from_parent);
+
+ // Setting cursor to 0 to show the left edge of the text. See EXT-4967.
+ mTextEntry->setCursor(0);
+ if (mTextEntry->hasSelection())
+ {
+ // Deselecting because selection position is changed together with
+ // cursor position change.
+ mTextEntry->deselect();
+ }
+
+ if (isHumanReadableLocationVisible)
+ {
+ refreshMaturityButton();
+ }
}
void LLLocationInputCtrl::onInfoButtonClicked()
{
- LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "agent"));
+ LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "agent"));
}
void LLLocationInputCtrl::onForSaleButtonClicked()
{
- handle_buy_land();
+ handle_buy_land();
}
void LLLocationInputCtrl::onAddLandmarkButtonClicked()
{
- LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
- // Landmark exists, open it for preview and edit
- if(landmark && landmark->getUUID().notNull())
- {
- LLSD key;
- key["type"] = "landmark";
- key["id"] = landmark->getUUID();
-
- LLFloaterSidePanelContainer::showPanel("places", key);
- }
- else
- {
- LLFloaterReg::showInstance("add_landmark");
- }
+ LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
+ // Landmark exists, open it for preview and edit
+ if(landmark && landmark->getUUID().notNull())
+ {
+ LLSD key;
+ key["type"] = "landmark";
+ key["id"] = landmark->getUUID();
+
+ LLFloaterSidePanelContainer::showPanel("places", key);
+ }
+ else
+ {
+ LLFloaterReg::showInstance("add_landmark");
+ }
}
void LLLocationInputCtrl::onAgentParcelChange()
{
- refresh();
+ refresh();
}
void LLLocationInputCtrl::onRegionBoundaryCrossed()
{
- createNavMeshStatusListenerForCurrentRegion();
+ createNavMeshStatusListenerForCurrentRegion();
}
void LLLocationInputCtrl::onNavMeshStatusChange(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
- mIsNavMeshDirty = pNavMeshStatus.isValid() && (pNavMeshStatus.getStatus() != LLPathfindingNavMeshStatus::kComplete);
- refreshParcelIcons();
+ mIsNavMeshDirty = pNavMeshStatus.isValid() && (pNavMeshStatus.getStatus() != LLPathfindingNavMeshStatus::kComplete);
+ refreshParcelIcons();
}
void LLLocationInputCtrl::onLandmarkLoaded(LLLandmark* lm)
{
- (void) lm;
- updateAddLandmarkButton();
+ (void) lm;
+ updateAddLandmarkButton();
}
void LLLocationInputCtrl::onLocationHistoryChanged(LLLocationHistory::EChangeType event)
{
- if(event == LLLocationHistory::LOAD)
- {
- rebuildLocationHistory();
- }
- mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0);
+ if(event == LLLocationHistory::LOAD)
+ {
+ rebuildLocationHistory();
+ }
+ mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0);
}
void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)
{
- std::string filter = data.asString();
- rebuildLocationHistory(filter);
-
- //Let's add landmarks to the top of the list if any
- if(!filter.empty() )
- {
- LLInventoryModel::item_array_t landmark_items = LLLandmarkActions::fetchLandmarksByName(filter, TRUE);
-
- for(U32 i=0; i < landmark_items.size(); i++)
- {
- LLSD value;
- //TODO:: DO we need tooltip for Landmark??
-
- value["item_type"] = LANDMARK;
- value["AssetUUID"] = landmark_items[i]->getAssetUUID();
- add(landmark_items[i]->getName(), value);
-
- }
- //Let's add teleport history items
- LLTeleportHistory* th = LLTeleportHistory::getInstance();
- LLTeleportHistory::slurl_list_t th_items = th->getItems();
-
- std::set<std::string> new_item_titles;// duplicate control
- LLTeleportHistory::slurl_list_t::iterator result = std::find_if(
- th_items.begin(), th_items.end(), boost::bind(
- &LLLocationInputCtrl::findTeleportItemsByTitle, this,
- _1, filter));
-
- while (result != th_items.end())
- {
- //mTitile format - region_name[, parcel_name]
- //mFullTitile format - region_name[, parcel_name] (local_x,local_y, local_z)
- if (new_item_titles.insert(result->mFullTitle).second)
- {
- LLSD value;
- value["item_type"] = TELEPORT_HISTORY;
- value["global_pos"] = result->mGlobalPos.getValue();
- std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
- //TODO*: add Surl to teleportitem or parse region name from title
- value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString();
- add(result->getTitle(), value);
- }
- result = std::find_if(result + 1, th_items.end(), boost::bind(
- &LLLocationInputCtrl::findTeleportItemsByTitle, this,
- _1, filter));
- }
- }
- sortByName();
-
- mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item.
+ std::string filter = data.asString();
+ rebuildLocationHistory(filter);
+
+ //Let's add landmarks to the top of the list if any
+ if(!filter.empty() )
+ {
+ LLInventoryModel::item_array_t landmark_items = LLLandmarkActions::fetchLandmarksByName(filter, TRUE);
+
+ for(U32 i=0; i < landmark_items.size(); i++)
+ {
+ LLSD value;
+ //TODO:: DO we need tooltip for Landmark??
+
+ value["item_type"] = LANDMARK;
+ value["AssetUUID"] = landmark_items[i]->getAssetUUID();
+ add(landmark_items[i]->getName(), value);
+
+ }
+ //Let's add teleport history items
+ LLTeleportHistory* th = LLTeleportHistory::getInstance();
+ LLTeleportHistory::slurl_list_t th_items = th->getItems();
+
+ std::set<std::string> new_item_titles;// duplicate control
+ LLTeleportHistory::slurl_list_t::iterator result = std::find_if(
+ th_items.begin(), th_items.end(), boost::bind(
+ &LLLocationInputCtrl::findTeleportItemsByTitle, this,
+ _1, filter));
+
+ while (result != th_items.end())
+ {
+ //mTitile format - region_name[, parcel_name]
+ //mFullTitile format - region_name[, parcel_name] (local_x,local_y, local_z)
+ if (new_item_titles.insert(result->mFullTitle).second)
+ {
+ LLSD value;
+ value["item_type"] = TELEPORT_HISTORY;
+ value["global_pos"] = result->mGlobalPos.getValue();
+ std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
+ //TODO*: add Surl to teleportitem or parse region name from title
+ value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString();
+ add(result->getTitle(), value);
+ }
+ result = std::find_if(result + 1, th_items.end(), boost::bind(
+ &LLLocationInputCtrl::findTeleportItemsByTitle, this,
+ _1, filter));
+ }
+ }
+ sortByName();
+
+ mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item.
}
bool LLLocationInputCtrl::findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter)
{
- return item.mTitle.find(filter) != std::string::npos;
+ return item.mTitle.find(filter) != std::string::npos;
}
void LLLocationInputCtrl::onTextEditorRightClicked(S32 x, S32 y, MASK mask)
{
- if (mLocationContextMenu)
- {
- updateContextMenu();
- mLocationContextMenu->buildDrawLabels();
- mLocationContextMenu->updateParent(LLMenuGL::sMenuContainer);
- hideList();
- setFocus(true);
- changeLocationPresentation();
- LLMenuGL::showPopup(this, mLocationContextMenu, x, y);
- }
+ if (mLocationContextMenu)
+ {
+ updateContextMenu();
+ mLocationContextMenu->buildDrawLabels();
+ mLocationContextMenu->updateParent(LLMenuGL::sMenuContainer);
+ hideList();
+ setFocus(true);
+ changeLocationPresentation();
+ LLMenuGL::showPopup(this, mLocationContextMenu, x, y);
+ }
}
void LLLocationInputCtrl::refresh()
{
- refreshLocation(); // update location string
- refreshParcelIcons();
- updateAddLandmarkButton(); // indicate whether current parcel has been landmarked
+ refreshLocation(); // update location string
+ refreshParcelIcons();
+ updateAddLandmarkButton(); // indicate whether current parcel has been landmarked
}
void LLLocationInputCtrl::refreshLocation()
{
- // Is one of our children focused?
- if (LLUICtrl::hasFocus() || mButton->hasFocus() || mList->hasFocus() ||
- (mTextEntry && mTextEntry->hasFocus()) ||
- (mAddLandmarkBtn->hasFocus()))
- {
- LL_WARNS() << "Location input should not be refreshed when having focus" << LL_ENDL;
- return;
- }
-
- // Update location field.
- std::string location_name;
- LLAgentUI::ELocationFormat format =
- (gSavedSettings.getBOOL("NavBarShowCoordinates")
- ? LLAgentUI::LOCATION_FORMAT_FULL
- : LLAgentUI::LOCATION_FORMAT_NO_COORDS);
-
- if (!LLAgentUI::buildLocationString(location_name, format))
- {
- location_name = "???";
- }
- // store human-readable location to compare it in changeLocationPresentation()
- mHumanReadableLocation = location_name;
- setText(location_name);
- isHumanReadableLocationVisible = true;
-
- refreshMaturityButton();
+ // Is one of our children focused?
+ if (LLUICtrl::hasFocus() || mButton->hasFocus() || mList->hasFocus() ||
+ (mTextEntry && mTextEntry->hasFocus()) ||
+ (mAddLandmarkBtn->hasFocus()))
+ {
+ LL_WARNS() << "Location input should not be refreshed when having focus" << LL_ENDL;
+ return;
+ }
+
+ // Update location field.
+ std::string location_name;
+ LLAgentUI::ELocationFormat format =
+ (gSavedSettings.getBOOL("NavBarShowCoordinates")
+ ? LLAgentUI::LOCATION_FORMAT_FULL
+ : LLAgentUI::LOCATION_FORMAT_NO_COORDS);
+
+ if (!LLAgentUI::buildLocationString(location_name, format))
+ {
+ location_name = "???";
+ }
+ // store human-readable location to compare it in changeLocationPresentation()
+ mHumanReadableLocation = location_name;
+ setText(location_name);
+ isHumanReadableLocationVisible = true;
+
+ refreshMaturityButton();
}
// returns new right edge
static S32 layout_widget(LLUICtrl* widget, S32 right)
{
- if (widget->getVisible())
- {
- LLRect rect = widget->getRect();
- rect.mLeft = right - rect.getWidth();
- rect.mRight = right;
- widget->setRect( rect );
- right -= rect.getWidth();
- }
- return right;
+ if (widget->getVisible())
+ {
+ LLRect rect = widget->getRect();
+ rect.mLeft = right - rect.getWidth();
+ rect.mRight = right;
+ widget->setRect( rect );
+ right -= rect.getWidth();
+ }
+ return right;
}
void LLLocationInputCtrl::refreshParcelIcons()
{
- // Our "cursor" moving right to left
- S32 x = mAddLandmarkBtn->getRect().mLeft;
-
- LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
-
- LLViewerRegion* agent_region = gAgent.getRegion();
- LLParcel* agent_parcel = vpm->getAgentParcel();
- if (!agent_region || !agent_parcel)
- return;
-
- mForSaleBtn->setVisible(vpm->canAgentBuyParcel(agent_parcel, false));
-
- x = layout_widget(mForSaleBtn, x);
-
- if (gSavedSettings.getBOOL("NavBarShowParcelProperties"))
- {
- LLParcel* current_parcel;
- LLViewerRegion* selection_region = vpm->getSelectionRegion();
- LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel();
-
- // If agent is in selected parcel we use its properties because
- // they are updated more often by LLViewerParcelMgr than agent parcel properties.
- // See LLViewerParcelMgr::processParcelProperties().
- // This is needed to reflect parcel restrictions changes without having to leave
- // the parcel and then enter it again. See EXT-2987
- if (selected_parcel && selected_parcel->getLocalID() == agent_parcel->getLocalID()
- && selection_region == agent_region)
- {
- current_parcel = selected_parcel;
- }
- else
- {
- current_parcel = agent_parcel;
- }
-
- bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel);
- bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel);
- bool allow_push = vpm->allowAgentPush(agent_region, current_parcel);
- bool allow_build = vpm->allowAgentBuild(current_parcel); // true when anyone is allowed to build. See EXT-4610.
- bool allow_scripts = vpm->allowAgentScripts(agent_region, current_parcel);
- bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel);
- bool see_avs = current_parcel->getSeeAVs();
- bool pathfinding_dynamic_enabled = agent_region->dynamicPathfindingEnabled();
-
- // Most icons are "block this ability"
- mParcelIcon[VOICE_ICON]->setVisible( !allow_voice );
- mParcelIcon[FLY_ICON]->setVisible( !allow_fly );
- mParcelIcon[PUSH_ICON]->setVisible( !allow_push );
- mParcelIcon[BUILD_ICON]->setVisible( !allow_build );
- mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts );
- mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage );
- mParcelIcon[PATHFINDING_DIRTY_ICON]->setVisible(mIsNavMeshDirty);
- mParcelIcon[PATHFINDING_DISABLED_ICON]->setVisible(!mIsNavMeshDirty && !pathfinding_dynamic_enabled);
-
- mDamageText->setVisible(allow_damage);
- mParcelIcon[SEE_AVATARS_ICON]->setVisible( !see_avs );
-
- // Padding goes to left of both landmark star and for sale btn
- x -= mAddLandmarkHPad;
-
- // Slide the parcel icons rect from right to left, adjusting rectangles
- for (S32 i = 0; i < ICON_COUNT; ++i)
- {
- x = layout_widget(mParcelIcon[i], x);
- x -= mIconHPad;
- }
- x = layout_widget(mDamageText, x);
- x -= mIconHPad;
- }
- else
- {
- for (S32 i = 0; i < ICON_COUNT; ++i)
- {
- mParcelIcon[i]->setVisible(false);
- }
- mDamageText->setVisible(false);
- }
-
- if (mTextEntry)
- {
- S32 left_pad, right_pad;
- mTextEntry->getTextPadding(&left_pad, &right_pad);
- right_pad = mTextEntry->getRect().mRight - x;
- mTextEntry->setTextPadding(left_pad, right_pad);
- }
+ // Our "cursor" moving right to left
+ S32 x = mAddLandmarkBtn->getRect().mLeft;
+
+ LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
+
+ LLViewerRegion* agent_region = gAgent.getRegion();
+ LLParcel* agent_parcel = vpm->getAgentParcel();
+ if (!agent_region || !agent_parcel)
+ return;
+
+ mForSaleBtn->setVisible(vpm->canAgentBuyParcel(agent_parcel, false));
+
+ x = layout_widget(mForSaleBtn, x);
+
+ if (gSavedSettings.getBOOL("NavBarShowParcelProperties"))
+ {
+ LLParcel* current_parcel;
+ LLViewerRegion* selection_region = vpm->getSelectionRegion();
+ LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel();
+
+ // If agent is in selected parcel we use its properties because
+ // they are updated more often by LLViewerParcelMgr than agent parcel properties.
+ // See LLViewerParcelMgr::processParcelProperties().
+ // This is needed to reflect parcel restrictions changes without having to leave
+ // the parcel and then enter it again. See EXT-2987
+ if (selected_parcel && selected_parcel->getLocalID() == agent_parcel->getLocalID()
+ && selection_region == agent_region)
+ {
+ current_parcel = selected_parcel;
+ }
+ else
+ {
+ current_parcel = agent_parcel;
+ }
+
+ bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel);
+ bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel);
+ bool allow_push = vpm->allowAgentPush(agent_region, current_parcel);
+ bool allow_build = vpm->allowAgentBuild(current_parcel); // true when anyone is allowed to build. See EXT-4610.
+ bool allow_scripts = vpm->allowAgentScripts(agent_region, current_parcel);
+ bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel);
+ bool see_avs = current_parcel->getSeeAVs();
+ bool pathfinding_dynamic_enabled = agent_region->dynamicPathfindingEnabled();
+
+ // Most icons are "block this ability"
+ mParcelIcon[VOICE_ICON]->setVisible( !allow_voice );
+ mParcelIcon[FLY_ICON]->setVisible( !allow_fly );
+ mParcelIcon[PUSH_ICON]->setVisible( !allow_push );
+ mParcelIcon[BUILD_ICON]->setVisible( !allow_build );
+ mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts );
+ mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage );
+ mParcelIcon[PATHFINDING_DIRTY_ICON]->setVisible(mIsNavMeshDirty);
+ mParcelIcon[PATHFINDING_DISABLED_ICON]->setVisible(!mIsNavMeshDirty && !pathfinding_dynamic_enabled);
+
+ mDamageText->setVisible(allow_damage);
+ mParcelIcon[SEE_AVATARS_ICON]->setVisible( !see_avs );
+
+ // Padding goes to left of both landmark star and for sale btn
+ x -= mAddLandmarkHPad;
+
+ // Slide the parcel icons rect from right to left, adjusting rectangles
+ for (S32 i = 0; i < ICON_COUNT; ++i)
+ {
+ x = layout_widget(mParcelIcon[i], x);
+ x -= mIconHPad;
+ }
+ x = layout_widget(mDamageText, x);
+ x -= mIconHPad;
+ }
+ else
+ {
+ for (S32 i = 0; i < ICON_COUNT; ++i)
+ {
+ mParcelIcon[i]->setVisible(false);
+ }
+ mDamageText->setVisible(false);
+ }
+
+ if (mTextEntry)
+ {
+ S32 left_pad, right_pad;
+ mTextEntry->getTextPadding(&left_pad, &right_pad);
+ right_pad = mTextEntry->getRect().mRight - x;
+ mTextEntry->setTextPadding(left_pad, right_pad);
+ }
}
void LLLocationInputCtrl::refreshHealth()
{
- // *FIXME: Status bar owns health information, should be in agent
- if (gStatusBar)
- {
- static S32 last_health = -1;
- S32 health = gStatusBar->getHealth();
- if (health != last_health)
- {
- std::string text = llformat("%d%%", health);
- mDamageText->setText(text);
- last_health = health;
- }
- }
+ // *FIXME: Status bar owns health information, should be in agent
+ if (gStatusBar)
+ {
+ static S32 last_health = -1;
+ S32 health = gStatusBar->getHealth();
+ if (health != last_health)
+ {
+ std::string text = llformat("%d%%", health);
+ mDamageText->setText(text);
+ last_health = health;
+ }
+ }
}
void LLLocationInputCtrl::refreshMaturityButton()
{
- // Updating maturity rating icon.
- LLViewerRegion* region = gAgent.getRegion();
- if (!region)
- return;
-
- bool button_visible = true;
- LLPointer<LLUIImage> rating_image = NULL;
- std::string rating_tooltip;
-
- U8 sim_access = region->getSimAccess();
- switch(sim_access)
- {
- case SIM_ACCESS_PG:
- rating_image = mIconMaturityGeneral;
- rating_tooltip = LLTrans::getString("LocationCtrlGeneralIconTooltip");
- break;
-
- case SIM_ACCESS_ADULT:
- rating_image = mIconMaturityAdult;
- rating_tooltip = LLTrans::getString("LocationCtrlAdultIconTooltip");
- break;
-
- case SIM_ACCESS_MATURE:
- rating_image = mIconMaturityModerate;
- rating_tooltip = LLTrans::getString("LocationCtrlModerateIconTooltip");
- break;
-
- default:
- button_visible = false;
- break;
- }
-
- mMaturityButton->setVisible(button_visible);
- mMaturityButton->setToolTip(rating_tooltip);
- if(rating_image)
- {
- mMaturityButton->setImageUnselected(rating_image);
- mMaturityButton->setImagePressed(rating_image);
- }
- if (mMaturityButton->getVisible())
- {
- positionMaturityButton();
- }
+ // Updating maturity rating icon.
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region)
+ return;
+
+ bool button_visible = true;
+ LLPointer<LLUIImage> rating_image = NULL;
+ std::string rating_tooltip;
+
+ U8 sim_access = region->getSimAccess();
+ switch(sim_access)
+ {
+ case SIM_ACCESS_PG:
+ rating_image = mIconMaturityGeneral;
+ rating_tooltip = LLTrans::getString("LocationCtrlGeneralIconTooltip");
+ break;
+
+ case SIM_ACCESS_ADULT:
+ rating_image = mIconMaturityAdult;
+ rating_tooltip = LLTrans::getString("LocationCtrlAdultIconTooltip");
+ break;
+
+ case SIM_ACCESS_MATURE:
+ rating_image = mIconMaturityModerate;
+ rating_tooltip = LLTrans::getString("LocationCtrlModerateIconTooltip");
+ break;
+
+ default:
+ button_visible = false;
+ break;
+ }
+
+ mMaturityButton->setVisible(button_visible);
+ mMaturityButton->setToolTip(rating_tooltip);
+ if(rating_image)
+ {
+ mMaturityButton->setImageUnselected(rating_image);
+ mMaturityButton->setImagePressed(rating_image);
+ }
+ if (mMaturityButton->getVisible())
+ {
+ positionMaturityButton();
+ }
}
void LLLocationInputCtrl::positionMaturityButton()
{
- const LLFontGL* font = mTextEntry->getFont();
- if (!font)
- return;
+ const LLFontGL* font = mTextEntry->getFont();
+ if (!font)
+ return;
- S32 left_pad, right_pad;
- mTextEntry->getTextPadding(&left_pad, &right_pad);
+ S32 left_pad, right_pad;
+ mTextEntry->getTextPadding(&left_pad, &right_pad);
- // Calculate the right edge of rendered text + a whitespace.
- left_pad = left_pad + font->getWidth(mTextEntry->getText()) + font->getWidth(" ");
+ // Calculate the right edge of rendered text + a whitespace.
+ left_pad = left_pad + font->getWidth(mTextEntry->getText()) + font->getWidth(" ");
- LLRect rect = mMaturityButton->getRect();
- mMaturityButton->setRect(rect.setOriginAndSize(left_pad, rect.mBottom, rect.getWidth(), rect.getHeight()));
+ LLRect rect = mMaturityButton->getRect();
+ mMaturityButton->setRect(rect.setOriginAndSize(left_pad, rect.mBottom, rect.getWidth(), rect.getHeight()));
- // Hide icon if it text area is not width enough to display it, show otherwise.
- mMaturityButton->setVisible(rect.mRight < mTextEntry->getRect().getWidth() - right_pad);
+ // Hide icon if it text area is not width enough to display it, show otherwise.
+ mMaturityButton->setVisible(rect.mRight < mTextEntry->getRect().getWidth() - right_pad);
}
void LLLocationInputCtrl::rebuildLocationHistory(const std::string& filter)
{
- LLLocationHistory::location_list_t filtered_items;
- const LLLocationHistory::location_list_t* itemsp = NULL;
- LLLocationHistory* lh = LLLocationHistory::getInstance();
-
- if (filter.empty())
- {
- itemsp = &lh->getItems();
- }
- else
- {
- lh->getMatchingItems(filter, filtered_items);
- itemsp = &filtered_items;
- }
-
- removeall();
- for (LLLocationHistory::location_list_t::const_reverse_iterator it = itemsp->rbegin(); it != itemsp->rend(); it++)
- {
- LLSD value;
- value["tooltip"] = it->getToolTip();
- //location history can contain only typed locations
- value["item_type"] = TYPED_REGION_SLURL;
- value["global_pos"] = it->mGlobalPos.getValue();
- add(it->getLocation(), value);
- }
+ LLLocationHistory::location_list_t filtered_items;
+ const LLLocationHistory::location_list_t* itemsp = NULL;
+ LLLocationHistory* lh = LLLocationHistory::getInstance();
+
+ if (filter.empty())
+ {
+ itemsp = &lh->getItems();
+ }
+ else
+ {
+ lh->getMatchingItems(filter, filtered_items);
+ itemsp = &filtered_items;
+ }
+
+ removeall();
+ for (LLLocationHistory::location_list_t::const_reverse_iterator it = itemsp->rbegin(); it != itemsp->rend(); it++)
+ {
+ LLSD value;
+ value["tooltip"] = it->getToolTip();
+ //location history can contain only typed locations
+ value["item_type"] = TYPED_REGION_SLURL;
+ value["global_pos"] = it->mGlobalPos.getValue();
+ add(it->getLocation(), value);
+ }
}
void LLLocationInputCtrl::focusTextEntry()
{
- // We can't use "mTextEntry->setFocus(TRUE)" instead because
- // if the "select_on_focus" parameter is true it places the cursor
- // at the beginning (after selecting text), thus screwing up updateSelection().
- if (mTextEntry)
- {
- gFocusMgr.setKeyboardFocus(mTextEntry);
-
- // Enable the text entry to handle accelerator keys (EXT-8104).
- LLEditMenuHandler::gEditMenuHandler = mTextEntry;
- }
+ // We can't use "mTextEntry->setFocus(TRUE)" instead because
+ // if the "select_on_focus" parameter is true it places the cursor
+ // at the beginning (after selecting text), thus screwing up updateSelection().
+ if (mTextEntry)
+ {
+ gFocusMgr.setKeyboardFocus(mTextEntry);
+
+ // Enable the text entry to handle accelerator keys (EXT-8104).
+ LLEditMenuHandler::gEditMenuHandler = mTextEntry;
+ }
}
void LLLocationInputCtrl::enableAddLandmarkButton(bool val)
{
- // We don't want to disable the button because it should be click able at any time,
- // instead switch images.
- LLUIImage* img = val ? mLandmarkImageOn : mLandmarkImageOff;
- if(img)
- {
- mAddLandmarkBtn->setImageUnselected(img);
- }
+ // We don't want to disable the button because it should be click able at any time,
+ // instead switch images.
+ LLUIImage* img = val ? mLandmarkImageOn : mLandmarkImageOff;
+ if(img)
+ {
+ mAddLandmarkBtn->setImageUnselected(img);
+ }
}
// Change the "Add landmark" button image
// depending on whether current parcel has been landmarked.
void LLLocationInputCtrl::updateAddLandmarkButton()
{
- enableAddLandmarkButton(LLLandmarkActions::hasParcelLandmark());
+ enableAddLandmarkButton(LLLandmarkActions::hasParcelLandmark());
}
void LLLocationInputCtrl::updateAddLandmarkTooltip()
{
- std::string tooltip;
- if(LLLandmarkActions::landmarkAlreadyExists())
- {
- tooltip = mEditLandmarkTooltip;
- }
- else
- {
- tooltip = mAddLandmarkTooltip;
- }
- mAddLandmarkBtn->setToolTip(tooltip);
+ std::string tooltip;
+ if(LLLandmarkActions::landmarkAlreadyExists())
+ {
+ tooltip = mEditLandmarkTooltip;
+ }
+ else
+ {
+ tooltip = mAddLandmarkTooltip;
+ }
+ mAddLandmarkBtn->setToolTip(tooltip);
}
void LLLocationInputCtrl::updateContextMenu(){
- if (mLocationContextMenu)
- {
- LLMenuItemGL* landmarkItem = mLocationContextMenu->getChild<LLMenuItemGL>("Landmark");
- if (!LLLandmarkActions::landmarkAlreadyExists())
- {
- landmarkItem->setLabel(LLTrans::getString("AddLandmarkNavBarMenu"));
- }
- else
- {
- landmarkItem->setLabel(LLTrans::getString("EditLandmarkNavBarMenu"));
- }
- }
+ if (mLocationContextMenu)
+ {
+ LLMenuItemGL* landmarkItem = mLocationContextMenu->getChild<LLMenuItemGL>("Landmark");
+ if (!LLLandmarkActions::landmarkAlreadyExists())
+ {
+ landmarkItem->setLabel(LLTrans::getString("AddLandmarkNavBarMenu"));
+ }
+ else
+ {
+ landmarkItem->setLabel(LLTrans::getString("EditLandmarkNavBarMenu"));
+ }
+ }
}
void LLLocationInputCtrl::updateWidgetlayout()
{
- const LLRect& rect = getLocalRect();
- const LLRect& hist_btn_rect = mButton->getRect();
+ const LLRect& rect = getLocalRect();
+ const LLRect& hist_btn_rect = mButton->getRect();
- // Info button is set in the XUI XML location_input.xml
+ // Info button is set in the XUI XML location_input.xml
- // "Add Landmark" button
- LLRect al_btn_rect = mAddLandmarkBtn->getRect();
- al_btn_rect.translate(
- hist_btn_rect.mLeft - mIconHPad - al_btn_rect.getWidth(),
- (rect.getHeight() - al_btn_rect.getHeight()) / 2);
- mAddLandmarkBtn->setRect(al_btn_rect);
+ // "Add Landmark" button
+ LLRect al_btn_rect = mAddLandmarkBtn->getRect();
+ al_btn_rect.translate(
+ hist_btn_rect.mLeft - mIconHPad - al_btn_rect.getWidth(),
+ (rect.getHeight() - al_btn_rect.getHeight()) / 2);
+ mAddLandmarkBtn->setRect(al_btn_rect);
}
void LLLocationInputCtrl::changeLocationPresentation()
{
- if (!mTextEntry)
- return;
-
- //change location presentation only if user does not select/paste anything and
- //human-readable region name is being displayed
- if(!mTextEntry->hasSelection() && mTextEntry->getText() == mHumanReadableLocation)
- {
- //needs unescaped one
- LLSLURL slurl;
- LLAgentUI::buildSLURL(slurl, false);
- mTextEntry->setText(LLURI::unescape(slurl.getSLURLString()));
- mTextEntry->selectAll();
-
- mMaturityButton->setVisible(FALSE);
-
- isHumanReadableLocationVisible = false;
- }
+ if (!mTextEntry)
+ return;
+
+ //change location presentation only if user does not select/paste anything and
+ //human-readable region name is being displayed
+ if(!mTextEntry->hasSelection() && mTextEntry->getText() == mHumanReadableLocation)
+ {
+ //needs unescaped one
+ LLSLURL slurl;
+ LLAgentUI::buildSLURL(slurl, false);
+ mTextEntry->setText(LLURI::unescape(slurl.getSLURLString()));
+ mTextEntry->selectAll();
+
+ mMaturityButton->setVisible(FALSE);
+
+ isHumanReadableLocationVisible = false;
+ }
}
void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata)
{
- std::string item = userdata.asString();
-
- if (item == "show_coordinates")
- {
- gSavedSettings.setBOOL("NavBarShowCoordinates",!gSavedSettings.getBOOL("NavBarShowCoordinates"));
- }
- else if (item == "show_properties")
- {
- gSavedSettings.setBOOL("NavBarShowParcelProperties",
- !gSavedSettings.getBOOL("NavBarShowParcelProperties"));
- }
- else if (item == "landmark")
- {
- LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
-
- if(!landmark)
- {
- LLFloaterReg::showInstance("add_landmark");
- }
- else
- {
- LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id",landmark->getUUID()));
-
- }
- }
- else if (item == "cut")
- {
- mTextEntry->cut();
- }
- else if (item == "copy")
- {
- mTextEntry->copy();
- }
- else if (item == "paste")
- {
- mTextEntry->paste();
- }
- else if (item == "delete")
- {
- mTextEntry->deleteSelection();
- }
- else if (item == "select_all")
- {
- mTextEntry->selectAll();
- }
+ std::string item = userdata.asString();
+
+ if (item == "show_coordinates")
+ {
+ gSavedSettings.setBOOL("NavBarShowCoordinates",!gSavedSettings.getBOOL("NavBarShowCoordinates"));
+ }
+ else if (item == "show_properties")
+ {
+ gSavedSettings.setBOOL("NavBarShowParcelProperties",
+ !gSavedSettings.getBOOL("NavBarShowParcelProperties"));
+ }
+ else if (item == "landmark")
+ {
+ LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
+
+ if(!landmark)
+ {
+ LLFloaterReg::showInstance("add_landmark");
+ }
+ else
+ {
+ LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id",landmark->getUUID()));
+
+ }
+ }
+ else if (item == "cut")
+ {
+ mTextEntry->cut();
+ }
+ else if (item == "copy")
+ {
+ mTextEntry->copy();
+ }
+ else if (item == "paste")
+ {
+ mTextEntry->paste();
+ }
+ else if (item == "delete")
+ {
+ mTextEntry->deleteSelection();
+ }
+ else if (item == "select_all")
+ {
+ mTextEntry->selectAll();
+ }
}
bool LLLocationInputCtrl::onLocationContextMenuItemEnabled(const LLSD& userdata)
{
- std::string item = userdata.asString();
-
- if (item == "can_cut")
- {
- return mTextEntry->canCut();
- }
- else if (item == "can_copy")
- {
- return mTextEntry->canCopy();
- }
- else if (item == "can_paste")
- {
- return mTextEntry->canPaste();
- }
- else if (item == "can_delete")
- {
- return mTextEntry->canDeselect();
- }
- else if (item == "can_select_all")
- {
- return mTextEntry->canSelectAll() && (mTextEntry->getLength() > 0);
- }
- else if(item == "show_coordinates")
- {
- return gSavedSettings.getBOOL("NavBarShowCoordinates");
- }
-
- return false;
+ std::string item = userdata.asString();
+
+ if (item == "can_cut")
+ {
+ return mTextEntry->canCut();
+ }
+ else if (item == "can_copy")
+ {
+ return mTextEntry->canCopy();
+ }
+ else if (item == "can_paste")
+ {
+ return mTextEntry->canPaste();
+ }
+ else if (item == "can_delete")
+ {
+ return mTextEntry->canDeselect();
+ }
+ else if (item == "can_select_all")
+ {
+ return mTextEntry->canSelectAll() && (mTextEntry->getLength() > 0);
+ }
+ else if(item == "show_coordinates")
+ {
+ return gSavedSettings.getBOOL("NavBarShowCoordinates");
+ }
+
+ return false;
}
void LLLocationInputCtrl::callbackRebakeRegion(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0) // OK
- {
- if (LLPathfindingManager::getInstance() != NULL)
- {
- LLMenuOptionPathfindingRebakeNavmesh::getInstance()->sendRequestRebakeNavmesh();
- }
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0) // OK
+ {
+ if (LLPathfindingManager::getInstance() != NULL)
+ {
+ LLMenuOptionPathfindingRebakeNavmesh::getInstance()->sendRequestRebakeNavmesh();
+ }
+ }
}
void LLLocationInputCtrl::onParcelIconClick(EParcelIcon icon)
{
- switch (icon)
- {
- case VOICE_ICON:
- LLNotificationsUtil::add("NoVoice");
- break;
- case FLY_ICON:
- LLNotificationsUtil::add("NoFly");
- break;
- case PUSH_ICON:
- LLNotificationsUtil::add("PushRestricted");
- break;
- case BUILD_ICON:
- LLNotificationsUtil::add("NoBuild");
- break;
- case PATHFINDING_DIRTY_ICON:
- if (LLPathfindingManager::getInstance() != NULL)
- {
- LLMenuOptionPathfindingRebakeNavmesh *rebakeInstance = LLMenuOptionPathfindingRebakeNavmesh::getInstance();
- if (rebakeInstance && rebakeInstance->canRebakeRegion() && (rebakeInstance->getMode() == LLMenuOptionPathfindingRebakeNavmesh::kRebakeNavMesh_Available))
- {
- LLNotificationsUtil::add("PathfindingDirtyRebake", LLSD(), LLSD(),
- boost::bind(&LLLocationInputCtrl::callbackRebakeRegion, this, _1, _2));
- break;
- }
- }
- LLNotificationsUtil::add("PathfindingDirty");
- break;
- case PATHFINDING_DISABLED_ICON:
- LLNotificationsUtil::add("DynamicPathfindingDisabled");
- break;
- case SCRIPTS_ICON:
- {
- LLViewerRegion* region = gAgent.getRegion();
- if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))
- {
- LLNotificationsUtil::add("ScriptsStopped");
- }
- else if(region && region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS))
- {
- LLNotificationsUtil::add("ScriptsNotRunning");
- }
- else
- {
- LLNotificationsUtil::add("NoOutsideScripts");
- }
- break;
- }
- case DAMAGE_ICON:
- LLNotificationsUtil::add("NotSafe");
- break;
- case SEE_AVATARS_ICON:
- LLNotificationsUtil::add("SeeAvatars");
- break;
- case ICON_COUNT:
- break;
- // no default to get compiler warning when a new icon gets added
- }
+ switch (icon)
+ {
+ case VOICE_ICON:
+ LLNotificationsUtil::add("NoVoice");
+ break;
+ case FLY_ICON:
+ LLNotificationsUtil::add("NoFly");
+ break;
+ case PUSH_ICON:
+ LLNotificationsUtil::add("PushRestricted");
+ break;
+ case BUILD_ICON:
+ LLNotificationsUtil::add("NoBuild");
+ break;
+ case PATHFINDING_DIRTY_ICON:
+ if (LLPathfindingManager::getInstance() != NULL)
+ {
+ LLMenuOptionPathfindingRebakeNavmesh *rebakeInstance = LLMenuOptionPathfindingRebakeNavmesh::getInstance();
+ if (rebakeInstance && rebakeInstance->canRebakeRegion() && (rebakeInstance->getMode() == LLMenuOptionPathfindingRebakeNavmesh::kRebakeNavMesh_Available))
+ {
+ LLNotificationsUtil::add("PathfindingDirtyRebake", LLSD(), LLSD(),
+ boost::bind(&LLLocationInputCtrl::callbackRebakeRegion, this, _1, _2));
+ break;
+ }
+ }
+ LLNotificationsUtil::add("PathfindingDirty");
+ break;
+ case PATHFINDING_DISABLED_ICON:
+ LLNotificationsUtil::add("DynamicPathfindingDisabled");
+ break;
+ case SCRIPTS_ICON:
+ {
+ LLViewerRegion* region = gAgent.getRegion();
+ if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))
+ {
+ LLNotificationsUtil::add("ScriptsStopped");
+ }
+ else if(region && region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS))
+ {
+ LLNotificationsUtil::add("ScriptsNotRunning");
+ }
+ else
+ {
+ LLNotificationsUtil::add("NoOutsideScripts");
+ }
+ break;
+ }
+ case DAMAGE_ICON:
+ LLNotificationsUtil::add("NotSafe");
+ break;
+ case SEE_AVATARS_ICON:
+ LLNotificationsUtil::add("SeeAvatars");
+ break;
+ case ICON_COUNT:
+ break;
+ // no default to get compiler warning when a new icon gets added
+ }
}
void LLLocationInputCtrl::createNavMeshStatusListenerForCurrentRegion()
{
- if (mNavMeshSlot.connected())
- {
- mNavMeshSlot.disconnect();
- }
-
- LLViewerRegion *currentRegion = gAgent.getRegion();
- if (currentRegion != NULL)
- {
- mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLLocationInputCtrl::onNavMeshStatusChange, this, _2));
- LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(currentRegion, true);
- }
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
+
+ LLViewerRegion *currentRegion = gAgent.getRegion();
+ if (currentRegion != NULL)
+ {
+ mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLLocationInputCtrl::onNavMeshStatusChange, this, _2));
+ LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(currentRegion, true);
+ }
}
diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h
index af2a9f6afd..7695ac4726 100644
--- a/indra/newview/lllocationinputctrl.h
+++ b/indra/newview/lllocationinputctrl.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllocationinputctrl.h
* @brief Combobox-like location input control
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,8 +28,8 @@
#define LL_LLLOCATIONINPUTCTRL_H
#include "llcombobox.h"
-#include "lliconctrl.h" // Params
-#include "lltextbox.h" // Params
+#include "lliconctrl.h" // Params
+#include "lltextbox.h" // Params
#include "lllocationhistory.h"
#include "llpathfindingnavmesh.h"
@@ -45,168 +45,168 @@ class LLPathfindingNavMeshStatus;
/**
* Location input control.
- *
+ *
* @see LLNavigationBar
*/
class LLLocationInputCtrl
-: public LLComboBox
+: public LLComboBox
{
- LOG_CLASS(LLLocationInputCtrl);
- friend class LLAddLandmarkObserver;
- friend class LLRemoveLandmarkObserver;
- friend class LLParcelChangeObserver;
+ LOG_CLASS(LLLocationInputCtrl);
+ friend class LLAddLandmarkObserver;
+ friend class LLRemoveLandmarkObserver;
+ friend class LLParcelChangeObserver;
public:
- struct Params
- : public LLInitParam::Block<Params, LLComboBox::Params>
- {
- Optional<LLUIImage*> icon_maturity_general,
- icon_maturity_adult,
- icon_maturity_moderate,
- add_landmark_image_enabled,
- add_landmark_image_disabled,
- add_landmark_image_hover,
- add_landmark_image_selected;
- Optional<std::string> maturity_help_topic;
- Optional<S32> icon_hpad,
- add_landmark_hpad;
- Optional<LLButton::Params> maturity_button,
- add_landmark_button,
- for_sale_button,
- info_button;
- Optional<LLIconCtrl::Params> voice_icon,
- fly_icon,
- push_icon,
- build_icon,
- scripts_icon,
- damage_icon,
- see_avatars_icon,
- pathfinding_dirty_icon,
- pathfinding_disabled_icon;
- Optional<LLTextBox::Params> damage_text;
- Params();
- };
-
- // LLView interface
- /*virtual*/ void setEnabled(BOOL enabled);
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
- /*virtual*/ void onFocusReceived();
- /*virtual*/ void onFocusLost();
- /*virtual*/ void draw();
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- //========================================================================
-
- // LLUICtrl interface
- /*virtual*/ void setFocus(BOOL b);
- //========================================================================
-
- // LLComboBox interface
- void hideList();
- void onTextEntry(LLLineEditor* line_editor);
- //========================================================================
-
- LLLineEditor* getTextEntry() const { return mTextEntry; }
- void handleLoginComplete();
+ struct Params
+ : public LLInitParam::Block<Params, LLComboBox::Params>
+ {
+ Optional<LLUIImage*> icon_maturity_general,
+ icon_maturity_adult,
+ icon_maturity_moderate,
+ add_landmark_image_enabled,
+ add_landmark_image_disabled,
+ add_landmark_image_hover,
+ add_landmark_image_selected;
+ Optional<std::string> maturity_help_topic;
+ Optional<S32> icon_hpad,
+ add_landmark_hpad;
+ Optional<LLButton::Params> maturity_button,
+ add_landmark_button,
+ for_sale_button,
+ info_button;
+ Optional<LLIconCtrl::Params> voice_icon,
+ fly_icon,
+ push_icon,
+ build_icon,
+ scripts_icon,
+ damage_icon,
+ see_avatars_icon,
+ pathfinding_dirty_icon,
+ pathfinding_disabled_icon;
+ Optional<LLTextBox::Params> damage_text;
+ Params();
+ };
+
+ // LLView interface
+ /*virtual*/ void setEnabled(BOOL enabled);
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
+ /*virtual*/ void onFocusReceived();
+ /*virtual*/ void onFocusLost();
+ /*virtual*/ void draw();
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ //========================================================================
+
+ // LLUICtrl interface
+ /*virtual*/ void setFocus(BOOL b);
+ //========================================================================
+
+ // LLComboBox interface
+ void hideList();
+ void onTextEntry(LLLineEditor* line_editor);
+ //========================================================================
+
+ LLLineEditor* getTextEntry() const { return mTextEntry; }
+ void handleLoginComplete();
bool isNavMeshDirty() { return mIsNavMeshDirty; }
private:
- enum EParcelIcon
- {
- VOICE_ICON = 0,
- FLY_ICON, // 1
- PUSH_ICON, // 2
- BUILD_ICON, // 3
- SCRIPTS_ICON, // 4
- DAMAGE_ICON, // 5
- SEE_AVATARS_ICON, // 6
- PATHFINDING_DIRTY_ICON, // 7
- PATHFINDING_DISABLED_ICON,// 8
- ICON_COUNT // 9 total
- };
-
- friend class LLUICtrlFactory;
- LLLocationInputCtrl(const Params&);
- virtual ~LLLocationInputCtrl();
-
- void focusTextEntry();
- /**
- * Changes the "Add landmark" button image
- * depending on whether current parcel has been landmarked.
- */
- void enableAddLandmarkButton(bool val);
- void refresh();
- void refreshLocation();
- void refreshParcelIcons();
- // Refresh the value in the health percentage text field
- void refreshHealth();
- void refreshMaturityButton();
- void positionMaturityButton();
-
- void rebuildLocationHistory(const std::string& filter = LLStringUtil::null);
- bool findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter);
- void setText(const LLStringExplicit& text);
- void updateAddLandmarkButton();
- void updateAddLandmarkTooltip();
- void updateContextMenu();
- void updateWidgetlayout();
- void changeLocationPresentation();
-
- void onInfoButtonClicked();
- void onLocationHistoryChanged(LLLocationHistory::EChangeType event);
- void onLocationPrearrange(const LLSD& data);
- void onTextEditorRightClicked(S32 x, S32 y, MASK mask);
- void onLandmarkLoaded(LLLandmark* lm);
- void onForSaleButtonClicked();
- void onAddLandmarkButtonClicked();
- void onAgentParcelChange();
- void onRegionBoundaryCrossed();
- void onNavMeshStatusChange(const LLPathfindingNavMeshStatus &pNavMeshStatus);
- // callbacks
- bool onLocationContextMenuItemEnabled(const LLSD& userdata);
- void onLocationContextMenuItemClicked(const LLSD& userdata);
- void callbackRebakeRegion(const LLSD& notification, const LLSD& response);
- void onParcelIconClick(EParcelIcon icon);
-
- void createNavMeshStatusListenerForCurrentRegion();
-
- LLMenuGL* mLocationContextMenu;
- LLButton* mAddLandmarkBtn;
- LLButton* mForSaleBtn;
- LLButton* mInfoBtn;
- S32 mIconHPad; // pad between all icons
- S32 mAddLandmarkHPad; // pad to left of landmark star
-
- LLButton* mMaturityButton;
- LLIconCtrl* mParcelIcon[ICON_COUNT];
- LLTextBox* mDamageText;
-
- LLAddLandmarkObserver* mAddLandmarkObserver;
- LLRemoveLandmarkObserver* mRemoveLandmarkObserver;
- LLParcelChangeObserver* mParcelChangeObserver;
-
- boost::signals2::connection mCoordinatesControlConnection;
- boost::signals2::connection mParcelPropertiesControlConnection;
- boost::signals2::connection mParcelMgrConnection;
- boost::signals2::connection mLocationHistoryConnection;
- boost::signals2::connection mRegionCrossingSlot;
- LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
- bool mIsNavMeshDirty;
- LLUIImage* mLandmarkImageOn;
- LLUIImage* mLandmarkImageOff;
- LLPointer<LLUIImage> mIconMaturityGeneral;
- LLPointer<LLUIImage> mIconMaturityAdult;
- LLPointer<LLUIImage> mIconMaturityModerate;
- LLPointer<LLUIImage> mIconPathfindingDynamic;
-
- std::string mAddLandmarkTooltip;
- std::string mEditLandmarkTooltip;
- // this field holds a human-readable form of the location string, it is needed to be able to compare copy-pated value and real location
- std::string mHumanReadableLocation;
- bool isHumanReadableLocationVisible;
- std::string mMaturityHelpTopic;
+ enum EParcelIcon
+ {
+ VOICE_ICON = 0,
+ FLY_ICON, // 1
+ PUSH_ICON, // 2
+ BUILD_ICON, // 3
+ SCRIPTS_ICON, // 4
+ DAMAGE_ICON, // 5
+ SEE_AVATARS_ICON, // 6
+ PATHFINDING_DIRTY_ICON, // 7
+ PATHFINDING_DISABLED_ICON,// 8
+ ICON_COUNT // 9 total
+ };
+
+ friend class LLUICtrlFactory;
+ LLLocationInputCtrl(const Params&);
+ virtual ~LLLocationInputCtrl();
+
+ void focusTextEntry();
+ /**
+ * Changes the "Add landmark" button image
+ * depending on whether current parcel has been landmarked.
+ */
+ void enableAddLandmarkButton(bool val);
+ void refresh();
+ void refreshLocation();
+ void refreshParcelIcons();
+ // Refresh the value in the health percentage text field
+ void refreshHealth();
+ void refreshMaturityButton();
+ void positionMaturityButton();
+
+ void rebuildLocationHistory(const std::string& filter = LLStringUtil::null);
+ bool findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter);
+ void setText(const LLStringExplicit& text);
+ void updateAddLandmarkButton();
+ void updateAddLandmarkTooltip();
+ void updateContextMenu();
+ void updateWidgetlayout();
+ void changeLocationPresentation();
+
+ void onInfoButtonClicked();
+ void onLocationHistoryChanged(LLLocationHistory::EChangeType event);
+ void onLocationPrearrange(const LLSD& data);
+ void onTextEditorRightClicked(S32 x, S32 y, MASK mask);
+ void onLandmarkLoaded(LLLandmark* lm);
+ void onForSaleButtonClicked();
+ void onAddLandmarkButtonClicked();
+ void onAgentParcelChange();
+ void onRegionBoundaryCrossed();
+ void onNavMeshStatusChange(const LLPathfindingNavMeshStatus &pNavMeshStatus);
+ // callbacks
+ bool onLocationContextMenuItemEnabled(const LLSD& userdata);
+ void onLocationContextMenuItemClicked(const LLSD& userdata);
+ void callbackRebakeRegion(const LLSD& notification, const LLSD& response);
+ void onParcelIconClick(EParcelIcon icon);
+
+ void createNavMeshStatusListenerForCurrentRegion();
+
+ LLMenuGL* mLocationContextMenu;
+ LLButton* mAddLandmarkBtn;
+ LLButton* mForSaleBtn;
+ LLButton* mInfoBtn;
+ S32 mIconHPad; // pad between all icons
+ S32 mAddLandmarkHPad; // pad to left of landmark star
+
+ LLButton* mMaturityButton;
+ LLIconCtrl* mParcelIcon[ICON_COUNT];
+ LLTextBox* mDamageText;
+
+ LLAddLandmarkObserver* mAddLandmarkObserver;
+ LLRemoveLandmarkObserver* mRemoveLandmarkObserver;
+ LLParcelChangeObserver* mParcelChangeObserver;
+
+ boost::signals2::connection mCoordinatesControlConnection;
+ boost::signals2::connection mParcelPropertiesControlConnection;
+ boost::signals2::connection mParcelMgrConnection;
+ boost::signals2::connection mLocationHistoryConnection;
+ boost::signals2::connection mRegionCrossingSlot;
+ LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
+ bool mIsNavMeshDirty;
+ LLUIImage* mLandmarkImageOn;
+ LLUIImage* mLandmarkImageOff;
+ LLPointer<LLUIImage> mIconMaturityGeneral;
+ LLPointer<LLUIImage> mIconMaturityAdult;
+ LLPointer<LLUIImage> mIconMaturityModerate;
+ LLPointer<LLUIImage> mIconPathfindingDynamic;
+
+ std::string mAddLandmarkTooltip;
+ std::string mEditLandmarkTooltip;
+ // this field holds a human-readable form of the location string, it is needed to be able to compare copy-pated value and real location
+ std::string mHumanReadableLocation;
+ bool isHumanReadableLocationVisible;
+ std::string mMaturityHelpTopic;
};
#endif
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 55a947a09d..55ce0314d7 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllogchat.cpp
* @brief LLLogChat class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,7 +44,7 @@
#include <boost/regex.hpp>
#if LL_MSVC
-#pragma warning(push)
+#pragma warning(push)
// disable warning about boost::lexical_cast unreachable code
// when it fails to parse the string
#pragma warning (disable:4702)
@@ -126,99 +126,99 @@ using namespace boost::gregorian;
void append_to_last_message(std::list<LLSD>& messages, const std::string& line)
{
- if (!messages.size()) return;
+ if (!messages.size()) return;
- std::string im_text = messages.back()[LL_IM_TEXT].asString();
- im_text.append(line);
- messages.back()[LL_IM_TEXT] = im_text;
+ std::string im_text = messages.back()[LL_IM_TEXT].asString();
+ im_text.append(line);
+ messages.back()[LL_IM_TEXT] = im_text;
}
const char* remove_utf8_bom(const char* buf)
{
const char* start = buf;
- if (start[0] == (char)0xEF && start[1] == (char)0xBB && start[2] == (char)0xBF)
- { // If string starts with the magic bytes, return pointer after it.
+ if (start[0] == (char)0xEF && start[1] == (char)0xBB && start[2] == (char)0xBF)
+ { // If string starts with the magic bytes, return pointer after it.
start += 3;
- }
- return start;
+ }
+ return start;
}
class LLLogChatTimeScanner: public LLSingleton<LLLogChatTimeScanner>
{
- LLSINGLETON(LLLogChatTimeScanner);
+ LLSINGLETON(LLLogChatTimeScanner);
public:
- date getTodayPacificDate()
- {
- typedef boost::date_time::local_adjustor<ptime, -8, no_dst> pst;
- typedef boost::date_time::local_adjustor<ptime, -7, no_dst> pdt;
- time_t t_time = time(NULL);
- ptime p_time = LLStringOps::getPacificDaylightTime()
- ? pdt::utc_to_local(from_time_t(t_time))
- : pst::utc_to_local(from_time_t(t_time));
- struct tm s_tm = to_tm(p_time);
- return date_from_tm(s_tm);
- }
-
- void checkAndCutOffDate(std::string& time_str)
- {
- // Cuts off the "%Y/%m/%d" from string for todays timestamps.
- // Assume that passed string has at least "%H:%M" time format.
- date log_date(not_a_date_time);
- date today(getTodayPacificDate());
-
- // Parse the passed date
- mDateStream.str(LLStringUtil::null);
- mDateStream << time_str;
- mDateStream >> log_date;
- mDateStream.clear();
-
- days zero_days(0);
- days days_alive = today - log_date;
-
- if ( days_alive == zero_days )
- {
- // Yep, today's so strip "%Y/%m/%d" info
- ptime stripped_time(not_a_date_time);
-
- mTimeStream.str(LLStringUtil::null);
- mTimeStream << time_str;
- mTimeStream >> stripped_time;
- mTimeStream.clear();
-
- time_str.clear();
-
- mTimeStream.str(LLStringUtil::null);
- mTimeStream << stripped_time;
- mTimeStream >> time_str;
- mTimeStream.clear();
- }
-
- LL_DEBUGS("LLChatLogParser")
- << " log_date: "
- << log_date
- << " today: "
- << today
- << " days alive: "
- << days_alive
- << " new time: "
- << time_str
- << LL_ENDL;
- }
+ date getTodayPacificDate()
+ {
+ typedef boost::date_time::local_adjustor<ptime, -8, no_dst> pst;
+ typedef boost::date_time::local_adjustor<ptime, -7, no_dst> pdt;
+ time_t t_time = time(NULL);
+ ptime p_time = LLStringOps::getPacificDaylightTime()
+ ? pdt::utc_to_local(from_time_t(t_time))
+ : pst::utc_to_local(from_time_t(t_time));
+ struct tm s_tm = to_tm(p_time);
+ return date_from_tm(s_tm);
+ }
+
+ void checkAndCutOffDate(std::string& time_str)
+ {
+ // Cuts off the "%Y/%m/%d" from string for todays timestamps.
+ // Assume that passed string has at least "%H:%M" time format.
+ date log_date(not_a_date_time);
+ date today(getTodayPacificDate());
+
+ // Parse the passed date
+ mDateStream.str(LLStringUtil::null);
+ mDateStream << time_str;
+ mDateStream >> log_date;
+ mDateStream.clear();
+
+ days zero_days(0);
+ days days_alive = today - log_date;
+
+ if ( days_alive == zero_days )
+ {
+ // Yep, today's so strip "%Y/%m/%d" info
+ ptime stripped_time(not_a_date_time);
+
+ mTimeStream.str(LLStringUtil::null);
+ mTimeStream << time_str;
+ mTimeStream >> stripped_time;
+ mTimeStream.clear();
+
+ time_str.clear();
+
+ mTimeStream.str(LLStringUtil::null);
+ mTimeStream << stripped_time;
+ mTimeStream >> time_str;
+ mTimeStream.clear();
+ }
+
+ LL_DEBUGS("LLChatLogParser")
+ << " log_date: "
+ << log_date
+ << " today: "
+ << today
+ << " days alive: "
+ << days_alive
+ << " new time: "
+ << time_str
+ << LL_ENDL;
+ }
private:
- std::stringstream mDateStream;
- std::stringstream mTimeStream;
+ std::stringstream mDateStream;
+ std::stringstream mTimeStream;
};
inline
LLLogChatTimeScanner::LLLogChatTimeScanner()
{
- // Note, date/time facets will be destroyed by string streams
- mDateStream.imbue(std::locale(mDateStream.getloc(), new date_input_facet(DATE_FORMAT)));
- mTimeStream.imbue(std::locale(mTimeStream.getloc(), new time_facet(TIME_FORMAT)));
- mTimeStream.imbue(std::locale(mTimeStream.getloc(), new time_input_facet(DATE_FORMAT)));
+ // Note, date/time facets will be destroyed by string streams
+ mDateStream.imbue(std::locale(mDateStream.getloc(), new date_input_facet(DATE_FORMAT)));
+ mTimeStream.imbue(std::locale(mTimeStream.getloc(), new time_facet(TIME_FORMAT)));
+ mTimeStream.imbue(std::locale(mTimeStream.getloc(), new time_input_facet(DATE_FORMAT)));
}
LLLogChat::LLLogChat()
@@ -244,41 +244,41 @@ LLLogChat::~LLLogChat()
//static
std::string LLLogChat::makeLogFileName(std::string filename)
{
- /**
- * Testing for in bound and out bound ad-hoc file names
- * if it is then skip date stamping.
- **/
-
- boost::match_results<std::string::const_iterator> matches;
- bool inboundConf = ll_regex_match(filename, matches, INBOUND_CONFERENCE);
- bool outboundConf = ll_regex_match(filename, matches, OUTBOUND_CONFERENCE);
- if (!(inboundConf || outboundConf))
- {
- if( gSavedPerAccountSettings.getBOOL("LogFileNamewithDate") )
- {
- time_t now;
- time(&now);
- char dbuffer[20]; /* Flawfinder: ignore */
- if (filename == "chat")
- {
- strftime(dbuffer, 20, "-%Y-%m-%d", localtime(&now));
- }
- else
- {
- strftime(dbuffer, 20, "-%Y-%m", localtime(&now));
- }
- filename += dbuffer;
- }
- }
-
- filename = cleanFileName(filename);
- filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, filename);
- if (!filename.empty())
- {
- filename += '.' + LL_TRANSCRIPT_FILE_EXTENSION;
- }
-
- return filename;
+ /**
+ * Testing for in bound and out bound ad-hoc file names
+ * if it is then skip date stamping.
+ **/
+
+ boost::match_results<std::string::const_iterator> matches;
+ bool inboundConf = ll_regex_match(filename, matches, INBOUND_CONFERENCE);
+ bool outboundConf = ll_regex_match(filename, matches, OUTBOUND_CONFERENCE);
+ if (!(inboundConf || outboundConf))
+ {
+ if( gSavedPerAccountSettings.getBOOL("LogFileNamewithDate") )
+ {
+ time_t now;
+ time(&now);
+ char dbuffer[20]; /* Flawfinder: ignore */
+ if (filename == "chat")
+ {
+ strftime(dbuffer, 20, "-%Y-%m-%d", localtime(&now));
+ }
+ else
+ {
+ strftime(dbuffer, 20, "-%Y-%m", localtime(&now));
+ }
+ filename += dbuffer;
+ }
+ }
+
+ filename = cleanFileName(filename);
+ filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, filename);
+ if (!filename.empty())
+ {
+ filename += '.' + LL_TRANSCRIPT_FILE_EXTENSION;
+ }
+
+ return filename;
}
//static
@@ -305,34 +305,34 @@ void LLLogChat::renameLogFile(const std::string& old_filename, const std::string
std::string LLLogChat::cleanFileName(std::string filename)
{
- std::string invalidChars = "\"\'\\/?*:.<>|[]{}~"; // Cannot match glob or illegal filename chars
- std::string::size_type position = filename.find_first_of(invalidChars);
- while (position != filename.npos)
- {
- filename[position] = '_';
- position = filename.find_first_of(invalidChars, position);
- }
- return filename;
+ std::string invalidChars = "\"\'\\/?*:.<>|[]{}~"; // Cannot match glob or illegal filename chars
+ std::string::size_type position = filename.find_first_of(invalidChars);
+ while (position != filename.npos)
+ {
+ filename[position] = '_';
+ position = filename.find_first_of(invalidChars, position);
+ }
+ return filename;
}
std::string LLLogChat::timestamp2LogString(U32 timestamp, bool withdate)
{
- std::string timeStr;
- if (withdate)
- {
- timeStr = "[" + LLTrans::getString ("TimeYear") + "]/["
- + LLTrans::getString ("TimeMonth") + "]/["
- + LLTrans::getString ("TimeDay") + "] ["
- + LLTrans::getString ("TimeHour") + "]:["
- + LLTrans::getString ("TimeMin") + "]";
- }
- else
- {
- timeStr = "[" + LLTrans::getString("TimeHour") + "]:["
- + LLTrans::getString ("TimeMin")+"]";
- }
-
- LLSD substitution;
+ std::string timeStr;
+ if (withdate)
+ {
+ timeStr = "[" + LLTrans::getString ("TimeYear") + "]/["
+ + LLTrans::getString ("TimeMonth") + "]/["
+ + LLTrans::getString ("TimeDay") + "] ["
+ + LLTrans::getString ("TimeHour") + "]:["
+ + LLTrans::getString ("TimeMin") + "]";
+ }
+ else
+ {
+ timeStr = "[" + LLTrans::getString("TimeHour") + "]:["
+ + LLTrans::getString ("TimeMin")+"]";
+ }
+
+ LLSD substitution;
if (timestamp == 0)
{
substitution["datetime"] = (S32)time_corrected();
@@ -342,69 +342,69 @@ std::string LLLogChat::timestamp2LogString(U32 timestamp, bool withdate)
substitution["datetime"] = (S32)timestamp;
}
- LLStringUtil::format (timeStr, substitution);
- return timeStr;
+ LLStringUtil::format (timeStr, substitution);
+ return timeStr;
}
//static
void LLLogChat::saveHistory(const std::string& filename,
- const std::string& from,
- const LLUUID& from_id,
- const std::string& line)
+ const std::string& from,
+ const LLUUID& from_id,
+ const std::string& line)
{
- std::string tmp_filename = filename;
- LLStringUtil::trim(tmp_filename);
- if (tmp_filename.empty())
- {
- std::string warn = "Chat history filename [" + filename + "] is empty!";
- LL_WARNS() << warn << LL_ENDL;
- llassert(tmp_filename.size());
- return;
- }
-
- llofstream file(LLLogChat::makeLogFileName(filename).c_str(), std::ios_base::app);
- if (!file.is_open())
- {
- LL_WARNS() << "Couldn't open chat history log! - " + filename << LL_ENDL;
- return;
- }
-
- LLSD item;
-
- if (gSavedPerAccountSettings.getBOOL("LogTimestamp"))
- item["time"] = LLLogChat::timestamp2LogString(0, gSavedPerAccountSettings.getBOOL("LogTimestampDate"));
-
- item["from_id"] = from_id;
- item["message"] = line;
-
- //adding "Second Life:" for all system messages to make chat log history parsing more reliable
- if (from.empty() && from_id.isNull())
- {
- item["from"] = SYSTEM_FROM;
- }
- else
- {
- item["from"] = from;
- }
-
- file << LLChatLogFormatter(item) << std::endl;
-
- file.close();
-
- LLLogChat::getInstance()->triggerHistorySignal();
+ std::string tmp_filename = filename;
+ LLStringUtil::trim(tmp_filename);
+ if (tmp_filename.empty())
+ {
+ std::string warn = "Chat history filename [" + filename + "] is empty!";
+ LL_WARNS() << warn << LL_ENDL;
+ llassert(tmp_filename.size());
+ return;
+ }
+
+ llofstream file(LLLogChat::makeLogFileName(filename).c_str(), std::ios_base::app);
+ if (!file.is_open())
+ {
+ LL_WARNS() << "Couldn't open chat history log! - " + filename << LL_ENDL;
+ return;
+ }
+
+ LLSD item;
+
+ if (gSavedPerAccountSettings.getBOOL("LogTimestamp"))
+ item["time"] = LLLogChat::timestamp2LogString(0, gSavedPerAccountSettings.getBOOL("LogTimestampDate"));
+
+ item["from_id"] = from_id;
+ item["message"] = line;
+
+ //adding "Second Life:" for all system messages to make chat log history parsing more reliable
+ if (from.empty() && from_id.isNull())
+ {
+ item["from"] = SYSTEM_FROM;
+ }
+ else
+ {
+ item["from"] = from;
+ }
+
+ file << LLChatLogFormatter(item) << std::endl;
+
+ file.close();
+
+ LLLogChat::getInstance()->triggerHistorySignal();
}
// static
void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params, bool is_group)
{
- if (file_name.empty())
- {
- LL_WARNS("LLLogChat::loadChatHistory") << "Local history file name is empty!" << LL_ENDL;
- return ;
- }
+ if (file_name.empty())
+ {
+ LL_WARNS("LLLogChat::loadChatHistory") << "Local history file name is empty!" << LL_ENDL;
+ return ;
+ }
- bool load_all_history = load_params.has("load_all_history") ? load_params["load_all_history"].asBoolean() : false;
+ bool load_all_history = load_params.has("load_all_history") ? load_params["load_all_history"].asBoolean() : false;
// Stat the file to find it and get the last history entry time
llstat stat_data;
@@ -438,7 +438,7 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m
if (no_stat)
{
LL_DEBUGS("ChatHistory") << "No previous conversation log file found for " << file_name << LL_ENDL;
- return; //No previous conversation with this name.
+ return; //No previous conversation with this name.
}
}
}
@@ -446,64 +446,64 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m
// If we got here, we managed to stat the file.
// Open the file to read
LLFILE* fptr = LLFile::fopen(log_file_name, "r"); /*Flawfinder: ignore*/
- if (!fptr)
- { // Ok, this is strange but not really tragic in the big picture of things
+ if (!fptr)
+ { // Ok, this is strange but not really tragic in the big picture of things
LL_WARNS("ChatHistory") << "Unable to read file " << log_file_name << " after stat was successful" << LL_ENDL;
return;
- }
+ }
S32 save_num_messages = messages.size();
- char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/
- char *bptr;
- S32 len;
- bool firstline = TRUE;
-
- if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END))
- { //We need to load the whole historyFile or it's smaller than recall size, so get it all.
- firstline = FALSE;
- if (fseek(fptr, 0, SEEK_SET))
- {
- fclose(fptr);
- return;
- }
- }
- while (fgets(buffer, LOG_RECALL_SIZE, fptr) && !feof(fptr))
- {
- len = strlen(buffer) - 1; /*Flawfinder: ignore*/
+ char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/
+ char *bptr;
+ S32 len;
+ bool firstline = TRUE;
+
+ if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END))
+ { //We need to load the whole historyFile or it's smaller than recall size, so get it all.
+ firstline = FALSE;
+ if (fseek(fptr, 0, SEEK_SET))
+ {
+ fclose(fptr);
+ return;
+ }
+ }
+ while (fgets(buffer, LOG_RECALL_SIZE, fptr) && !feof(fptr))
+ {
+ len = strlen(buffer) - 1; /*Flawfinder: ignore*/
// backfill any end of line characters with nulls
- for (bptr = (buffer + len); (*bptr == '\n' || *bptr == '\r') && bptr>buffer; bptr--) *bptr='\0';
-
- if (firstline)
- {
- firstline = FALSE;
- continue;
- }
-
- std::string line(remove_utf8_bom(buffer));
-
- //updated 1.23 plain text log format requires a space added before subsequent lines in a multilined message
- if (' ' == line[0])
- {
- line.erase(0, MULTI_LINE_PREFIX.length());
- append_to_last_message(messages, '\n' + line);
- }
- else if (0 == len && ('\n' == line[0] || '\r' == line[0]))
- {
- //to support old format's multilined messages with new lines used to divide paragraphs
- append_to_last_message(messages, line);
- }
- else
- {
- LLSD item;
- if (!LLChatLogParser::parse(line, item, load_params))
- {
- item[LL_IM_TEXT] = line;
- }
- messages.push_back(item);
- }
- }
- fclose(fptr);
+ for (bptr = (buffer + len); (*bptr == '\n' || *bptr == '\r') && bptr>buffer; bptr--) *bptr='\0';
+
+ if (firstline)
+ {
+ firstline = FALSE;
+ continue;
+ }
+
+ std::string line(remove_utf8_bom(buffer));
+
+ //updated 1.23 plain text log format requires a space added before subsequent lines in a multilined message
+ if (' ' == line[0])
+ {
+ line.erase(0, MULTI_LINE_PREFIX.length());
+ append_to_last_message(messages, '\n' + line);
+ }
+ else if (0 == len && ('\n' == line[0] || '\r' == line[0]))
+ {
+ //to support old format's multilined messages with new lines used to divide paragraphs
+ append_to_last_message(messages, line);
+ }
+ else
+ {
+ LLSD item;
+ if (!LLChatLogParser::parse(line, item, load_params))
+ {
+ item[LL_IM_TEXT] = line;
+ }
+ messages.push_back(item);
+ }
+ }
+ fclose(fptr);
LL_DEBUGS("ChatHistory") << "Read " << (messages.size() - save_num_messages)
<< " messages of chat history from " << log_file_name
@@ -512,96 +512,96 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m
bool LLLogChat::historyThreadsFinished(LLUUID session_id)
{
- LLMutexLock lock(historyThreadsMutex());
- bool finished = true;
- std::map<LLUUID,LLLoadHistoryThread *>::iterator it = mLoadHistoryThreads.find(session_id);
- if (it != mLoadHistoryThreads.end())
- {
- finished = it->second->isFinished();
- }
- if (!finished)
- {
- return false;
- }
- std::map<LLUUID,LLDeleteHistoryThread *>::iterator dit = mDeleteHistoryThreads.find(session_id);
- if (dit != mDeleteHistoryThreads.end())
- {
- finished = finished && dit->second->isFinished();
- }
- return finished;
+ LLMutexLock lock(historyThreadsMutex());
+ bool finished = true;
+ std::map<LLUUID,LLLoadHistoryThread *>::iterator it = mLoadHistoryThreads.find(session_id);
+ if (it != mLoadHistoryThreads.end())
+ {
+ finished = it->second->isFinished();
+ }
+ if (!finished)
+ {
+ return false;
+ }
+ std::map<LLUUID,LLDeleteHistoryThread *>::iterator dit = mDeleteHistoryThreads.find(session_id);
+ if (dit != mDeleteHistoryThreads.end())
+ {
+ finished = finished && dit->second->isFinished();
+ }
+ return finished;
}
LLLoadHistoryThread* LLLogChat::getLoadHistoryThread(LLUUID session_id)
{
- LLMutexLock lock(historyThreadsMutex());
- std::map<LLUUID,LLLoadHistoryThread *>::iterator it = mLoadHistoryThreads.find(session_id);
- if (it != mLoadHistoryThreads.end())
- {
- return it->second;
- }
- return NULL;
+ LLMutexLock lock(historyThreadsMutex());
+ std::map<LLUUID,LLLoadHistoryThread *>::iterator it = mLoadHistoryThreads.find(session_id);
+ if (it != mLoadHistoryThreads.end())
+ {
+ return it->second;
+ }
+ return NULL;
}
LLDeleteHistoryThread* LLLogChat::getDeleteHistoryThread(LLUUID session_id)
{
- LLMutexLock lock(historyThreadsMutex());
- std::map<LLUUID,LLDeleteHistoryThread *>::iterator it = mDeleteHistoryThreads.find(session_id);
- if (it != mDeleteHistoryThreads.end())
- {
- return it->second;
- }
- return NULL;
+ LLMutexLock lock(historyThreadsMutex());
+ std::map<LLUUID,LLDeleteHistoryThread *>::iterator it = mDeleteHistoryThreads.find(session_id);
+ if (it != mDeleteHistoryThreads.end())
+ {
+ return it->second;
+ }
+ return NULL;
}
bool LLLogChat::addLoadHistoryThread(LLUUID& session_id, LLLoadHistoryThread* lthread)
{
- LLMutexLock lock(historyThreadsMutex());
- std::map<LLUUID,LLLoadHistoryThread *>::const_iterator it = mLoadHistoryThreads.find(session_id);
- if (it != mLoadHistoryThreads.end())
- {
- return false;
- }
- mLoadHistoryThreads[session_id] = lthread;
- return true;
+ LLMutexLock lock(historyThreadsMutex());
+ std::map<LLUUID,LLLoadHistoryThread *>::const_iterator it = mLoadHistoryThreads.find(session_id);
+ if (it != mLoadHistoryThreads.end())
+ {
+ return false;
+ }
+ mLoadHistoryThreads[session_id] = lthread;
+ return true;
}
bool LLLogChat::addDeleteHistoryThread(LLUUID& session_id, LLDeleteHistoryThread* dthread)
{
- LLMutexLock lock(historyThreadsMutex());
- std::map<LLUUID,LLDeleteHistoryThread *>::const_iterator it = mDeleteHistoryThreads.find(session_id);
- if (it != mDeleteHistoryThreads.end())
- {
- return false;
- }
- mDeleteHistoryThreads[session_id] = dthread;
- return true;
+ LLMutexLock lock(historyThreadsMutex());
+ std::map<LLUUID,LLDeleteHistoryThread *>::const_iterator it = mDeleteHistoryThreads.find(session_id);
+ if (it != mDeleteHistoryThreads.end())
+ {
+ return false;
+ }
+ mDeleteHistoryThreads[session_id] = dthread;
+ return true;
}
void LLLogChat::cleanupHistoryThreads()
{
- LLMutexLock lock(historyThreadsMutex());
- std::vector<LLUUID> uuids;
- std::map<LLUUID,LLLoadHistoryThread *>::iterator lit = mLoadHistoryThreads.begin();
- for (; lit != mLoadHistoryThreads.end(); lit++)
- {
- if (lit->second->isFinished() && mDeleteHistoryThreads[lit->first]->isFinished())
- {
- delete lit->second;
- delete mDeleteHistoryThreads[lit->first];
- uuids.push_back(lit->first);
- }
- }
- std::vector<LLUUID>::iterator uuid_it = uuids.begin();
- for ( ;uuid_it != uuids.end(); uuid_it++)
- {
- mLoadHistoryThreads.erase(*uuid_it);
- mDeleteHistoryThreads.erase(*uuid_it);
- }
+ LLMutexLock lock(historyThreadsMutex());
+ std::vector<LLUUID> uuids;
+ std::map<LLUUID,LLLoadHistoryThread *>::iterator lit = mLoadHistoryThreads.begin();
+ for (; lit != mLoadHistoryThreads.end(); lit++)
+ {
+ if (lit->second->isFinished() && mDeleteHistoryThreads[lit->first]->isFinished())
+ {
+ delete lit->second;
+ delete mDeleteHistoryThreads[lit->first];
+ uuids.push_back(lit->first);
+ }
+ }
+ std::vector<LLUUID>::iterator uuid_it = uuids.begin();
+ for ( ;uuid_it != uuids.end(); uuid_it++)
+ {
+ mLoadHistoryThreads.erase(*uuid_it);
+ mDeleteHistoryThreads.erase(*uuid_it);
+ }
}
LLMutex* LLLogChat::historyThreadsMutex()
{
- return mHistoryThreadsMutex;
+ return mHistoryThreadsMutex;
}
void LLLogChat::triggerHistorySignal()
@@ -615,272 +615,272 @@ void LLLogChat::triggerHistorySignal()
// static
std::string LLLogChat::oldLogFileName(std::string filename)
{
- // get Users log directory
- std::string directory = gDirUtilp->getPerAccountChatLogsDir();
-
- // add final OS dependent delimiter
- directory += gDirUtilp->getDirDelimiter();
-
- // lest make sure the file name has no invalid characters before making the pattern
- filename = cleanFileName(filename);
-
- // create search pattern
- std::string pattern = filename + ( filename == "chat" ? "-???\?-?\?-??.txt" : "-???\?-??.txt");
-
- std::vector<std::string> allfiles;
- LLDirIterator iter(directory, pattern);
- std::string scanResult;
-
- while (iter.next(scanResult))
- {
- allfiles.push_back(scanResult);
- }
-
- if (allfiles.size() == 0) // if no result from date search, return generic filename
- {
- scanResult = directory + filename + '.' + LL_TRANSCRIPT_FILE_EXTENSION;
- }
- else
- {
- sort(allfiles.begin(), allfiles.end());
- scanResult = directory + allfiles.back();
- // this file is now the most recent version of the file.
- }
-
- return scanResult;
+ // get Users log directory
+ std::string directory = gDirUtilp->getPerAccountChatLogsDir();
+
+ // add final OS dependent delimiter
+ directory += gDirUtilp->getDirDelimiter();
+
+ // lest make sure the file name has no invalid characters before making the pattern
+ filename = cleanFileName(filename);
+
+ // create search pattern
+ std::string pattern = filename + ( filename == "chat" ? "-???\?-?\?-??.txt" : "-???\?-??.txt");
+
+ std::vector<std::string> allfiles;
+ LLDirIterator iter(directory, pattern);
+ std::string scanResult;
+
+ while (iter.next(scanResult))
+ {
+ allfiles.push_back(scanResult);
+ }
+
+ if (allfiles.size() == 0) // if no result from date search, return generic filename
+ {
+ scanResult = directory + filename + '.' + LL_TRANSCRIPT_FILE_EXTENSION;
+ }
+ else
+ {
+ sort(allfiles.begin(), allfiles.end());
+ scanResult = directory + allfiles.back();
+ // this file is now the most recent version of the file.
+ }
+
+ return scanResult;
}
// static
void LLLogChat::findTranscriptFiles(std::string pattern, std::vector<std::string>& list_of_transcriptions)
{
- // get Users log directory
- std::string dirname = gDirUtilp->getPerAccountChatLogsDir();
-
- // add final OS dependent delimiter
- dirname += gDirUtilp->getDirDelimiter();
-
- LLDirIterator iter(dirname, pattern);
- std::string filename;
- while (iter.next(filename))
- {
- std::string fullname = gDirUtilp->add(dirname, filename);
- if (isTranscriptFileFound(fullname))
- {
- list_of_transcriptions.push_back(fullname);
- }
- }
+ // get Users log directory
+ std::string dirname = gDirUtilp->getPerAccountChatLogsDir();
+
+ // add final OS dependent delimiter
+ dirname += gDirUtilp->getDirDelimiter();
+
+ LLDirIterator iter(dirname, pattern);
+ std::string filename;
+ while (iter.next(filename))
+ {
+ std::string fullname = gDirUtilp->add(dirname, filename);
+ if (isTranscriptFileFound(fullname))
+ {
+ list_of_transcriptions.push_back(fullname);
+ }
+ }
}
// static
void LLLogChat::getListOfTranscriptFiles(std::vector<std::string>& list_of_transcriptions)
{
- // create search pattern
- std::string pattern = "*." + LL_TRANSCRIPT_FILE_EXTENSION;
- findTranscriptFiles(pattern, list_of_transcriptions);
+ // create search pattern
+ std::string pattern = "*." + LL_TRANSCRIPT_FILE_EXTENSION;
+ findTranscriptFiles(pattern, list_of_transcriptions);
}
// static
void LLLogChat::getListOfTranscriptBackupFiles(std::vector<std::string>& list_of_transcriptions)
{
- // create search pattern
- std::string pattern = "*." + LL_TRANSCRIPT_FILE_EXTENSION + ".backup*";
- findTranscriptFiles(pattern, list_of_transcriptions);
+ // create search pattern
+ std::string pattern = "*." + LL_TRANSCRIPT_FILE_EXTENSION + ".backup*";
+ findTranscriptFiles(pattern, list_of_transcriptions);
}
boost::signals2::connection LLLogChat::setSaveHistorySignal(const save_history_signal_t::slot_type& cb)
{
- if (NULL == mSaveHistorySignal)
- {
- mSaveHistorySignal = new save_history_signal_t();
- }
+ if (NULL == mSaveHistorySignal)
+ {
+ mSaveHistorySignal = new save_history_signal_t();
+ }
- return mSaveHistorySignal->connect(cb);
+ return mSaveHistorySignal->connect(cb);
}
//static
-bool LLLogChat::moveTranscripts(const std::string originDirectory,
- const std::string targetDirectory,
- std::vector<std::string>& listOfFilesToMove,
- std::vector<std::string>& listOfFilesMoved)
+bool LLLogChat::moveTranscripts(const std::string originDirectory,
+ const std::string targetDirectory,
+ std::vector<std::string>& listOfFilesToMove,
+ std::vector<std::string>& listOfFilesMoved)
{
- std::string newFullPath;
- bool movedAllTranscripts = true;
- std::string backupFileName;
- unsigned backupFileCount;
-
- for (const std::string& fullpath : listOfFilesToMove)
- {
- backupFileCount = 0;
- newFullPath = targetDirectory + fullpath.substr(originDirectory.length(), std::string::npos);
-
- //The target directory contains that file already, so lets store it
- if(LLFile::isfile(newFullPath))
- {
- backupFileName = newFullPath + ".backup";
-
- //If needed store backup file as .backup1 etc.
- while(LLFile::isfile(backupFileName))
- {
- ++backupFileCount;
- backupFileName = newFullPath + ".backup" + std::to_string(backupFileCount);
- }
-
- //Rename the file to its backup name so it is not overwritten
- LLFile::rename(newFullPath, backupFileName);
- }
-
- S32 retry_count = 0;
- while (retry_count < 5)
- {
- //success is zero
- if (LLFile::rename(fullpath, newFullPath) != 0)
- {
- retry_count++;
- S32 result = errno;
- LL_WARNS("LLLogChat::moveTranscripts") << "Problem renaming " << fullpath << " - errorcode: "
- << result << " attempt " << retry_count << LL_ENDL;
-
- ms_sleep(100);
- }
- else
- {
- listOfFilesMoved.push_back(newFullPath);
-
- if (retry_count)
- {
- LL_WARNS("LLLogChat::moveTranscripts") << "Successfully renamed " << fullpath << LL_ENDL;
- }
- break;
- }
- }
- }
-
- if(listOfFilesMoved.size() != listOfFilesToMove.size())
- {
- movedAllTranscripts = false;
- }
-
- return movedAllTranscripts;
+ std::string newFullPath;
+ bool movedAllTranscripts = true;
+ std::string backupFileName;
+ unsigned backupFileCount;
+
+ for (const std::string& fullpath : listOfFilesToMove)
+ {
+ backupFileCount = 0;
+ newFullPath = targetDirectory + fullpath.substr(originDirectory.length(), std::string::npos);
+
+ //The target directory contains that file already, so lets store it
+ if(LLFile::isfile(newFullPath))
+ {
+ backupFileName = newFullPath + ".backup";
+
+ //If needed store backup file as .backup1 etc.
+ while(LLFile::isfile(backupFileName))
+ {
+ ++backupFileCount;
+ backupFileName = newFullPath + ".backup" + std::to_string(backupFileCount);
+ }
+
+ //Rename the file to its backup name so it is not overwritten
+ LLFile::rename(newFullPath, backupFileName);
+ }
+
+ S32 retry_count = 0;
+ while (retry_count < 5)
+ {
+ //success is zero
+ if (LLFile::rename(fullpath, newFullPath) != 0)
+ {
+ retry_count++;
+ S32 result = errno;
+ LL_WARNS("LLLogChat::moveTranscripts") << "Problem renaming " << fullpath << " - errorcode: "
+ << result << " attempt " << retry_count << LL_ENDL;
+
+ ms_sleep(100);
+ }
+ else
+ {
+ listOfFilesMoved.push_back(newFullPath);
+
+ if (retry_count)
+ {
+ LL_WARNS("LLLogChat::moveTranscripts") << "Successfully renamed " << fullpath << LL_ENDL;
+ }
+ break;
+ }
+ }
+ }
+
+ if(listOfFilesMoved.size() != listOfFilesToMove.size())
+ {
+ movedAllTranscripts = false;
+ }
+
+ return movedAllTranscripts;
}
//static
-bool LLLogChat::moveTranscripts(const std::string currentDirectory,
- const std::string newDirectory,
- std::vector<std::string>& listOfFilesToMove)
+bool LLLogChat::moveTranscripts(const std::string currentDirectory,
+ const std::string newDirectory,
+ std::vector<std::string>& listOfFilesToMove)
{
- std::vector<std::string> listOfFilesMoved;
- return moveTranscripts(currentDirectory, newDirectory, listOfFilesToMove, listOfFilesMoved);
+ std::vector<std::string> listOfFilesMoved;
+ return moveTranscripts(currentDirectory, newDirectory, listOfFilesToMove, listOfFilesMoved);
}
//static
void LLLogChat::deleteTranscripts()
{
- std::vector<std::string> list_of_transcriptions;
- getListOfTranscriptFiles(list_of_transcriptions);
- getListOfTranscriptBackupFiles(list_of_transcriptions);
-
- for (const std::string& fullpath : list_of_transcriptions)
- {
- S32 retry_count = 0;
- while (retry_count < 5)
- {
- if (0 != LLFile::remove(fullpath))
- {
- retry_count++;
- S32 result = errno;
- LL_WARNS("LLLogChat::deleteTranscripts") << "Problem removing " << fullpath << " - errorcode: "
- << result << " attempt " << retry_count << LL_ENDL;
-
- if(retry_count >= 5)
- {
- LL_WARNS("LLLogChat::deleteTranscripts") << "Failed to remove " << fullpath << LL_ENDL;
- return;
- }
-
- ms_sleep(100);
- }
- else
- {
- if (retry_count)
- {
- LL_WARNS("LLLogChat::deleteTranscripts") << "Successfully removed " << fullpath << LL_ENDL;
- }
- break;
- }
- }
- }
-
- LLFloaterIMSessionTab::processChatHistoryStyleUpdate(true);
+ std::vector<std::string> list_of_transcriptions;
+ getListOfTranscriptFiles(list_of_transcriptions);
+ getListOfTranscriptBackupFiles(list_of_transcriptions);
+
+ for (const std::string& fullpath : list_of_transcriptions)
+ {
+ S32 retry_count = 0;
+ while (retry_count < 5)
+ {
+ if (0 != LLFile::remove(fullpath))
+ {
+ retry_count++;
+ S32 result = errno;
+ LL_WARNS("LLLogChat::deleteTranscripts") << "Problem removing " << fullpath << " - errorcode: "
+ << result << " attempt " << retry_count << LL_ENDL;
+
+ if(retry_count >= 5)
+ {
+ LL_WARNS("LLLogChat::deleteTranscripts") << "Failed to remove " << fullpath << LL_ENDL;
+ return;
+ }
+
+ ms_sleep(100);
+ }
+ else
+ {
+ if (retry_count)
+ {
+ LL_WARNS("LLLogChat::deleteTranscripts") << "Successfully removed " << fullpath << LL_ENDL;
+ }
+ break;
+ }
+ }
+ }
+
+ LLFloaterIMSessionTab::processChatHistoryStyleUpdate(true);
}
// static
bool LLLogChat::isTranscriptExist(const LLUUID& avatar_id, bool is_group)
{
- LLAvatarName avatar_name;
- LLAvatarNameCache::get(avatar_id, &avatar_name);
- std::string avatar_user_name = avatar_name.getAccountName();
- if(!is_group)
- {
- std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_');
- return isTranscriptFileFound(makeLogFileName(avatar_user_name));
- }
- else
- {
- std::string file_name;
- gCacheName->getGroupName(avatar_id, file_name);
- file_name = makeLogFileName(file_name + GROUP_CHAT_SUFFIX);
- return isTranscriptFileFound(file_name);
- }
- return false;
+ LLAvatarName avatar_name;
+ LLAvatarNameCache::get(avatar_id, &avatar_name);
+ std::string avatar_user_name = avatar_name.getAccountName();
+ if(!is_group)
+ {
+ std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_');
+ return isTranscriptFileFound(makeLogFileName(avatar_user_name));
+ }
+ else
+ {
+ std::string file_name;
+ gCacheName->getGroupName(avatar_id, file_name);
+ file_name = makeLogFileName(file_name + GROUP_CHAT_SUFFIX);
+ return isTranscriptFileFound(file_name);
+ }
+ return false;
}
bool LLLogChat::isNearbyTranscriptExist()
{
- return isTranscriptFileFound(makeLogFileName("chat"));;
+ return isTranscriptFileFound(makeLogFileName("chat"));;
}
bool LLLogChat::isAdHocTranscriptExist(std::string file_name)
{
- return isTranscriptFileFound(makeLogFileName(file_name));;
+ return isTranscriptFileFound(makeLogFileName(file_name));;
}
// static
bool LLLogChat::isTranscriptFileFound(std::string fullname)
{
- bool result = false;
- LLFILE * filep = LLFile::fopen(fullname, "rb");
- if (NULL != filep)
- {
- if (makeLogFileName("chat") == fullname)
- {
- LLFile::close(filep);
- return true;
- }
- char buffer[LOG_RECALL_SIZE];
-
- fseek(filep, 0, SEEK_END); // seek to end of file
- S32 bytes_to_read = ftell(filep); // get current file pointer
- fseek(filep, 0, SEEK_SET); // seek back to beginning of file
-
- // limit the number characters to read from file
- if (bytes_to_read >= LOG_RECALL_SIZE)
- {
- bytes_to_read = LOG_RECALL_SIZE - 1;
- }
-
- if (bytes_to_read > 0 && NULL != fgets(buffer, bytes_to_read, filep))
- {
- //matching a timestamp
- boost::match_results<std::string::const_iterator> matches;
+ bool result = false;
+ LLFILE * filep = LLFile::fopen(fullname, "rb");
+ if (NULL != filep)
+ {
+ if (makeLogFileName("chat") == fullname)
+ {
+ LLFile::close(filep);
+ return true;
+ }
+ char buffer[LOG_RECALL_SIZE];
+
+ fseek(filep, 0, SEEK_END); // seek to end of file
+ S32 bytes_to_read = ftell(filep); // get current file pointer
+ fseek(filep, 0, SEEK_SET); // seek back to beginning of file
+
+ // limit the number characters to read from file
+ if (bytes_to_read >= LOG_RECALL_SIZE)
+ {
+ bytes_to_read = LOG_RECALL_SIZE - 1;
+ }
+
+ if (bytes_to_read > 0 && NULL != fgets(buffer, bytes_to_read, filep))
+ {
+ //matching a timestamp
+ boost::match_results<std::string::const_iterator> matches;
std::string line(remove_utf8_bom(buffer));
- if (ll_regex_match(line, matches, TIMESTAMP))
- {
- result = true;
- }
- }
- LLFile::close(filep);
- }
- return result;
+ if (ll_regex_match(line, matches, TIMESTAMP))
+ {
+ result = true;
+ }
+ }
+ LLFile::close(filep);
+ }
+ return result;
}
//*TODO mark object's names in a special way so that they will be distinguishable form avatar name
@@ -888,167 +888,167 @@ bool LLLogChat::isTranscriptFileFound(std::string fullname)
//Example, an object's name can be written like "Object <actual_object's_name>"
void LLChatLogFormatter::format(const LLSD& im, std::ostream& ostr) const
{
- if (!im.isMap())
- {
- LL_WARNS() << "invalid LLSD type of an instant message" << LL_ENDL;
- return;
- }
-
- if (im[LL_IM_TIME].isDefined())
- {
- std::string timestamp = im[LL_IM_TIME].asString();
- boost::trim(timestamp);
- ostr << '[' << timestamp << ']' << TWO_SPACES;
- }
-
- //*TODO mark object's names in a special way so that they will be distinguishable from avatar name
- //which are more strict by its nature (only firstname and secondname)
- //Example, an object's name can be written like "Object <actual_object's_name>"
- if (im[LL_IM_FROM].isDefined())
- {
- std::string from = im[LL_IM_FROM].asString();
- boost::trim(from);
-
- std::size_t found = from.find(IM_SYMBOL_SEPARATOR);
- std::size_t len = from.size();
- std::size_t start = 0;
- while (found != std::string::npos)
- {
- std::size_t sub_len = found - start;
- if (sub_len > 0)
- {
- ostr << from.substr(start, sub_len);
- }
- LLURI::encodeCharacter(ostr, IM_SYMBOL_SEPARATOR);
- start = found + 1;
- found = from.find(IM_SYMBOL_SEPARATOR, start);
- }
- if (start < len)
- {
- std::string str_end = from.substr(start, len - start);
- ostr << str_end;
- }
- if (len > 0)
- {
- ostr << IM_SEPARATOR;
- }
- }
-
- if (im[LL_IM_TEXT].isDefined())
- {
- std::string im_text = im[LL_IM_TEXT].asString();
-
- //multilined text will be saved with prepended spaces
- boost::replace_all(im_text, NEW_LINE, NEW_LINE_SPACE_PREFIX);
- ostr << im_text;
- }
+ if (!im.isMap())
+ {
+ LL_WARNS() << "invalid LLSD type of an instant message" << LL_ENDL;
+ return;
+ }
+
+ if (im[LL_IM_TIME].isDefined())
+ {
+ std::string timestamp = im[LL_IM_TIME].asString();
+ boost::trim(timestamp);
+ ostr << '[' << timestamp << ']' << TWO_SPACES;
+ }
+
+ //*TODO mark object's names in a special way so that they will be distinguishable from avatar name
+ //which are more strict by its nature (only firstname and secondname)
+ //Example, an object's name can be written like "Object <actual_object's_name>"
+ if (im[LL_IM_FROM].isDefined())
+ {
+ std::string from = im[LL_IM_FROM].asString();
+ boost::trim(from);
+
+ std::size_t found = from.find(IM_SYMBOL_SEPARATOR);
+ std::size_t len = from.size();
+ std::size_t start = 0;
+ while (found != std::string::npos)
+ {
+ std::size_t sub_len = found - start;
+ if (sub_len > 0)
+ {
+ ostr << from.substr(start, sub_len);
+ }
+ LLURI::encodeCharacter(ostr, IM_SYMBOL_SEPARATOR);
+ start = found + 1;
+ found = from.find(IM_SYMBOL_SEPARATOR, start);
+ }
+ if (start < len)
+ {
+ std::string str_end = from.substr(start, len - start);
+ ostr << str_end;
+ }
+ if (len > 0)
+ {
+ ostr << IM_SEPARATOR;
+ }
+ }
+
+ if (im[LL_IM_TEXT].isDefined())
+ {
+ std::string im_text = im[LL_IM_TEXT].asString();
+
+ //multilined text will be saved with prepended spaces
+ boost::replace_all(im_text, NEW_LINE, NEW_LINE_SPACE_PREFIX);
+ ostr << im_text;
+ }
}
bool LLChatLogParser::parse(std::string& raw, LLSD& im, const LLSD& parse_params)
{
- if (!raw.length()) return false;
-
- bool cut_off_todays_date = parse_params.has("cut_off_todays_date") ? parse_params["cut_off_todays_date"].asBoolean() : true;
- im = LLSD::emptyMap();
-
- //matching a timestamp
- boost::match_results<std::string::const_iterator> matches;
- if (!ll_regex_match(raw, matches, TIMESTAMP_AND_STUFF)) return false;
-
- bool has_timestamp = matches[IDX_TIMESTAMP].matched;
- if (has_timestamp)
- {
- //timestamp was successfully parsed
- std::string timestamp = matches[IDX_TIMESTAMP];
- boost::trim(timestamp);
- timestamp.erase(0, 1);
- timestamp.erase(timestamp.length()-1, 1);
+ if (!raw.length()) return false;
+
+ bool cut_off_todays_date = parse_params.has("cut_off_todays_date") ? parse_params["cut_off_todays_date"].asBoolean() : true;
+ im = LLSD::emptyMap();
+
+ //matching a timestamp
+ boost::match_results<std::string::const_iterator> matches;
+ if (!ll_regex_match(raw, matches, TIMESTAMP_AND_STUFF)) return false;
+
+ bool has_timestamp = matches[IDX_TIMESTAMP].matched;
+ if (has_timestamp)
+ {
+ //timestamp was successfully parsed
+ std::string timestamp = matches[IDX_TIMESTAMP];
+ boost::trim(timestamp);
+ timestamp.erase(0, 1);
+ timestamp.erase(timestamp.length()-1, 1);
im[LL_IM_DATE_TIME] = timestamp; // Retain full date-time for merging chat histories
if (cut_off_todays_date)
- {
- LLLogChatTimeScanner::instance().checkAndCutOffDate(timestamp);
- }
-
- im[LL_IM_TIME] = timestamp;
- }
- else
- { //timestamp is optional
+ {
+ LLLogChatTimeScanner::instance().checkAndCutOffDate(timestamp);
+ }
+
+ im[LL_IM_TIME] = timestamp;
+ }
+ else
+ { //timestamp is optional
im[LL_IM_DATE_TIME] = "";
im[LL_IM_TIME] = "";
- }
-
- bool has_stuff = matches[IDX_STUFF].matched;
- if (!has_stuff)
- {
- return false; //*TODO should return false or not?
- }
-
- //matching a name and a text
- std::string stuff = matches[IDX_STUFF];
- boost::match_results<std::string::const_iterator> name_and_text;
- if (!ll_regex_match(stuff, name_and_text, NAME_AND_TEXT)) return false;
-
- bool has_name = name_and_text[IDX_NAME].matched;
- std::string name = LLURI::unescape(name_and_text[IDX_NAME]);
-
- //we don't need a name/text separator
- if (has_name && name.length() && name[name.length()-1] == ':')
- {
- name.erase(name.length()-1, 1);
- }
-
- if (!has_name || name == SYSTEM_FROM)
- {
- //name is optional too
- im[LL_IM_FROM] = SYSTEM_FROM;
- im[LL_IM_FROM_ID] = LLUUID::null;
- }
-
- //possibly a case of complex object names consisting of 3+ words
- if (!has_name)
- {
- std::string::size_type divider_pos = stuff.find(NAME_TEXT_DIVIDER);
- if (divider_pos != std::string::npos && divider_pos < (stuff.length() - NAME_TEXT_DIVIDER.length()))
- {
- im[LL_IM_FROM] = LLURI::unescape(stuff.substr(0, divider_pos));
- im[LL_IM_TEXT] = stuff.substr(divider_pos + NAME_TEXT_DIVIDER.length());
- return true;
- }
- }
-
- if (!has_name)
- {
- //text is mandatory
- im[LL_IM_TEXT] = stuff;
- return true; //parse as a message from Second Life
- }
-
- bool has_text = name_and_text[IDX_TEXT].matched;
- if (!has_text) return false;
-
- //for parsing logs created in very old versions of a viewer
- if (name == "You")
- {
- std::string agent_name;
- LLAgentUI::buildFullname(agent_name);
- im[LL_IM_FROM] = agent_name;
- im[LL_IM_FROM_ID] = gAgentID;
- }
- else
- {
- im[LL_IM_FROM] = name;
- }
-
- im[LL_IM_TEXT] = name_and_text[IDX_TEXT];
- return true; //parsed name and message text, maybe have a timestamp too
+ }
+
+ bool has_stuff = matches[IDX_STUFF].matched;
+ if (!has_stuff)
+ {
+ return false; //*TODO should return false or not?
+ }
+
+ //matching a name and a text
+ std::string stuff = matches[IDX_STUFF];
+ boost::match_results<std::string::const_iterator> name_and_text;
+ if (!ll_regex_match(stuff, name_and_text, NAME_AND_TEXT)) return false;
+
+ bool has_name = name_and_text[IDX_NAME].matched;
+ std::string name = LLURI::unescape(name_and_text[IDX_NAME]);
+
+ //we don't need a name/text separator
+ if (has_name && name.length() && name[name.length()-1] == ':')
+ {
+ name.erase(name.length()-1, 1);
+ }
+
+ if (!has_name || name == SYSTEM_FROM)
+ {
+ //name is optional too
+ im[LL_IM_FROM] = SYSTEM_FROM;
+ im[LL_IM_FROM_ID] = LLUUID::null;
+ }
+
+ //possibly a case of complex object names consisting of 3+ words
+ if (!has_name)
+ {
+ std::string::size_type divider_pos = stuff.find(NAME_TEXT_DIVIDER);
+ if (divider_pos != std::string::npos && divider_pos < (stuff.length() - NAME_TEXT_DIVIDER.length()))
+ {
+ im[LL_IM_FROM] = LLURI::unescape(stuff.substr(0, divider_pos));
+ im[LL_IM_TEXT] = stuff.substr(divider_pos + NAME_TEXT_DIVIDER.length());
+ return true;
+ }
+ }
+
+ if (!has_name)
+ {
+ //text is mandatory
+ im[LL_IM_TEXT] = stuff;
+ return true; //parse as a message from Second Life
+ }
+
+ bool has_text = name_and_text[IDX_TEXT].matched;
+ if (!has_text) return false;
+
+ //for parsing logs created in very old versions of a viewer
+ if (name == "You")
+ {
+ std::string agent_name;
+ LLAgentUI::buildFullname(agent_name);
+ im[LL_IM_FROM] = agent_name;
+ im[LL_IM_FROM_ID] = gAgentID;
+ }
+ else
+ {
+ im[LL_IM_FROM] = name;
+ }
+
+ im[LL_IM_TEXT] = name_and_text[IDX_TEXT];
+ return true; //parsed name and message text, maybe have a timestamp too
}
LLDeleteHistoryThread::LLDeleteHistoryThread(std::list<LLSD>* messages, LLLoadHistoryThread* loadThread)
- : LLActionThread("delete chat history"),
- mMessages(messages),
- mLoadThread(loadThread)
+ : LLActionThread("delete chat history"),
+ mMessages(messages),
+ mLoadThread(loadThread)
{
}
LLDeleteHistoryThread::~LLDeleteHistoryThread()
@@ -1056,23 +1056,23 @@ LLDeleteHistoryThread::~LLDeleteHistoryThread()
}
void LLDeleteHistoryThread::run()
{
- if (mLoadThread != NULL)
- {
- mLoadThread->waitFinished();
- }
- if (NULL != mMessages)
- {
- delete mMessages;
- }
- mMessages = NULL;
- setFinished();
+ if (mLoadThread != NULL)
+ {
+ mLoadThread->waitFinished();
+ }
+ if (NULL != mMessages)
+ {
+ delete mMessages;
+ }
+ mMessages = NULL;
+ setFinished();
}
LLActionThread::LLActionThread(const std::string& name)
- : LLThread(name),
- mMutex(),
- mRunCondition(),
- mFinished(false)
+ : LLThread(name),
+ mMutex(),
+ mRunCondition(),
+ mFinished(false)
{
}
@@ -1082,33 +1082,33 @@ LLActionThread::~LLActionThread()
void LLActionThread::waitFinished()
{
- mMutex.lock();
- if (!mFinished)
- {
- mMutex.unlock();
- mRunCondition.wait();
- }
- else
- {
- mMutex.unlock();
- }
+ mMutex.lock();
+ if (!mFinished)
+ {
+ mMutex.unlock();
+ mRunCondition.wait();
+ }
+ else
+ {
+ mMutex.unlock();
+ }
}
void LLActionThread::setFinished()
{
- mMutex.lock();
- mFinished = true;
- mMutex.unlock();
- mRunCondition.signal();
+ mMutex.lock();
+ mFinished = true;
+ mMutex.unlock();
+ mRunCondition.signal();
}
LLLoadHistoryThread::LLLoadHistoryThread(const std::string& file_name, std::list<LLSD>* messages, const LLSD& load_params)
- : LLActionThread("load chat history"),
- mMessages(messages),
- mFileName(file_name),
- mLoadParams(load_params),
- mNewLoad(true),
- mLoadEndSignal(NULL)
+ : LLActionThread("load chat history"),
+ mMessages(messages),
+ mFileName(file_name),
+ mLoadParams(load_params),
+ mNewLoad(true),
+ mLoadEndSignal(NULL)
{
}
@@ -1118,129 +1118,129 @@ LLLoadHistoryThread::~LLLoadHistoryThread()
void LLLoadHistoryThread::run()
{
- if(mNewLoad)
- {
- loadHistory(mFileName, mMessages, mLoadParams);
- int count = mMessages->size();
- LL_INFOS() << "mMessages->size(): " << count << LL_ENDL;
- setFinished();
- }
+ if(mNewLoad)
+ {
+ loadHistory(mFileName, mMessages, mLoadParams);
+ int count = mMessages->size();
+ LL_INFOS() << "mMessages->size(): " << count << LL_ENDL;
+ setFinished();
+ }
}
void LLLoadHistoryThread::loadHistory(const std::string& file_name, std::list<LLSD>* messages, const LLSD& load_params)
{
- if (file_name.empty())
- {
- LL_WARNS("LLLogChat::loadHistory") << "Session name is Empty!" << LL_ENDL;
- return ;
- }
-
- bool load_all_history = load_params.has("load_all_history") ? load_params["load_all_history"].asBoolean() : false;
- LLFILE* fptr = LLFile::fopen(LLLogChat::makeLogFileName(file_name), "r");/*Flawfinder: ignore*/
-
- if (!fptr)
- {
- bool is_group = load_params.has("is_group") ? load_params["is_group"].asBoolean() : false;
- if (is_group)
- {
- std::string old_name(file_name);
- old_name.erase(old_name.size() - GROUP_CHAT_SUFFIX.size());
- fptr = LLFile::fopen(LLLogChat::makeLogFileName(old_name), "r");
- if (fptr)
- {
- fclose(fptr);
- LLFile::copy(LLLogChat::makeLogFileName(old_name), LLLogChat::makeLogFileName(file_name));
- }
- fptr = LLFile::fopen(LLLogChat::makeLogFileName(file_name), "r");
- }
- if (!fptr)
- {
- fptr = LLFile::fopen(LLLogChat::oldLogFileName(file_name), "r");/*Flawfinder: ignore*/
- if (!fptr)
- {
- mNewLoad = false;
- (*mLoadEndSignal)(messages, file_name);
- return; //No previous conversation with this name.
- }
- }
- }
-
- char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/
-
- char *bptr;
- S32 len;
- bool firstline = TRUE;
-
- if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END))
- { //We need to load the whole historyFile or it's smaller than recall size, so get it all.
- firstline = FALSE;
- if (fseek(fptr, 0, SEEK_SET))
- {
- fclose(fptr);
- mNewLoad = false;
- (*mLoadEndSignal)(messages, file_name);
- return;
- }
- }
-
-
- while (fgets(buffer, LOG_RECALL_SIZE, fptr) && !feof(fptr))
- {
- len = strlen(buffer) - 1; /*Flawfinder: ignore*/
-
- for (bptr = (buffer + len); (*bptr == '\n' || *bptr == '\r') && bptr>buffer; bptr--) *bptr='\0';
-
-
- if (firstline)
- {
- firstline = FALSE;
- continue;
- }
- std::string line(remove_utf8_bom(buffer));
-
- //updated 1.23 plaint text log format requires a space added before subsequent lines in a multilined message
- if (' ' == line[0])
- {
- line.erase(0, MULTI_LINE_PREFIX.length());
- append_to_last_message(*messages, '\n' + line);
- }
- else if (0 == len && ('\n' == line[0] || '\r' == line[0]))
- {
- //to support old format's multilined messages with new lines used to divide paragraphs
- append_to_last_message(*messages, line);
- }
- else
- {
- LLSD item;
- if (!LLChatLogParser::parse(line, item, load_params))
- {
- item[LL_IM_TEXT] = line;
- }
- messages->push_back(item);
- }
- }
-
- fclose(fptr);
- mNewLoad = false;
- (*mLoadEndSignal)(messages, file_name);
+ if (file_name.empty())
+ {
+ LL_WARNS("LLLogChat::loadHistory") << "Session name is Empty!" << LL_ENDL;
+ return ;
+ }
+
+ bool load_all_history = load_params.has("load_all_history") ? load_params["load_all_history"].asBoolean() : false;
+ LLFILE* fptr = LLFile::fopen(LLLogChat::makeLogFileName(file_name), "r");/*Flawfinder: ignore*/
+
+ if (!fptr)
+ {
+ bool is_group = load_params.has("is_group") ? load_params["is_group"].asBoolean() : false;
+ if (is_group)
+ {
+ std::string old_name(file_name);
+ old_name.erase(old_name.size() - GROUP_CHAT_SUFFIX.size());
+ fptr = LLFile::fopen(LLLogChat::makeLogFileName(old_name), "r");
+ if (fptr)
+ {
+ fclose(fptr);
+ LLFile::copy(LLLogChat::makeLogFileName(old_name), LLLogChat::makeLogFileName(file_name));
+ }
+ fptr = LLFile::fopen(LLLogChat::makeLogFileName(file_name), "r");
+ }
+ if (!fptr)
+ {
+ fptr = LLFile::fopen(LLLogChat::oldLogFileName(file_name), "r");/*Flawfinder: ignore*/
+ if (!fptr)
+ {
+ mNewLoad = false;
+ (*mLoadEndSignal)(messages, file_name);
+ return; //No previous conversation with this name.
+ }
+ }
+ }
+
+ char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/
+
+ char *bptr;
+ S32 len;
+ bool firstline = TRUE;
+
+ if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END))
+ { //We need to load the whole historyFile or it's smaller than recall size, so get it all.
+ firstline = FALSE;
+ if (fseek(fptr, 0, SEEK_SET))
+ {
+ fclose(fptr);
+ mNewLoad = false;
+ (*mLoadEndSignal)(messages, file_name);
+ return;
+ }
+ }
+
+
+ while (fgets(buffer, LOG_RECALL_SIZE, fptr) && !feof(fptr))
+ {
+ len = strlen(buffer) - 1; /*Flawfinder: ignore*/
+
+ for (bptr = (buffer + len); (*bptr == '\n' || *bptr == '\r') && bptr>buffer; bptr--) *bptr='\0';
+
+
+ if (firstline)
+ {
+ firstline = FALSE;
+ continue;
+ }
+ std::string line(remove_utf8_bom(buffer));
+
+ //updated 1.23 plaint text log format requires a space added before subsequent lines in a multilined message
+ if (' ' == line[0])
+ {
+ line.erase(0, MULTI_LINE_PREFIX.length());
+ append_to_last_message(*messages, '\n' + line);
+ }
+ else if (0 == len && ('\n' == line[0] || '\r' == line[0]))
+ {
+ //to support old format's multilined messages with new lines used to divide paragraphs
+ append_to_last_message(*messages, line);
+ }
+ else
+ {
+ LLSD item;
+ if (!LLChatLogParser::parse(line, item, load_params))
+ {
+ item[LL_IM_TEXT] = line;
+ }
+ messages->push_back(item);
+ }
+ }
+
+ fclose(fptr);
+ mNewLoad = false;
+ (*mLoadEndSignal)(messages, file_name);
}
-
+
boost::signals2::connection LLLoadHistoryThread::setLoadEndSignal(const load_end_signal_t::slot_type& cb)
{
- if (NULL == mLoadEndSignal)
- {
- mLoadEndSignal = new load_end_signal_t();
- }
+ if (NULL == mLoadEndSignal)
+ {
+ mLoadEndSignal = new load_end_signal_t();
+ }
- return mLoadEndSignal->connect(cb);
+ return mLoadEndSignal->connect(cb);
}
void LLLoadHistoryThread::removeLoadEndSignal(const load_end_signal_t::slot_type& cb)
{
- if (NULL != mLoadEndSignal)
- {
- mLoadEndSignal->disconnect_all_slots();
- delete mLoadEndSignal;
- }
- mLoadEndSignal = NULL;
+ if (NULL != mLoadEndSignal)
+ {
+ mLoadEndSignal->disconnect_all_slots();
+ delete mLoadEndSignal;
+ }
+ mLoadEndSignal = NULL;
}
diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h
index 5dce8ab1d2..e16cb21e8e 100644
--- a/indra/newview/lllogchat.h
+++ b/indra/newview/lllogchat.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllogchat.h
* @brief LLFloaterChat class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,50 +33,50 @@ class LLChat;
class LLActionThread : public LLThread
{
public:
- LLActionThread(const std::string& name);
- ~LLActionThread();
+ LLActionThread(const std::string& name);
+ ~LLActionThread();
- void waitFinished();
- bool isFinished() { return mFinished; }
+ void waitFinished();
+ bool isFinished() { return mFinished; }
protected:
- void setFinished();
+ void setFinished();
private:
- bool mFinished;
- LLMutex mMutex;
- LLCondition mRunCondition;
+ bool mFinished;
+ LLMutex mMutex;
+ LLCondition mRunCondition;
};
class LLLoadHistoryThread : public LLActionThread
{
private:
- const std::string& mFileName;
- std::list<LLSD>* mMessages;
- LLSD mLoadParams;
- bool mNewLoad;
+ const std::string& mFileName;
+ std::list<LLSD>* mMessages;
+ LLSD mLoadParams;
+ bool mNewLoad;
public:
- LLLoadHistoryThread(const std::string& file_name, std::list<LLSD>* messages, const LLSD& load_params);
- ~LLLoadHistoryThread();
- //void setHistoryParams(const std::string& file_name, const LLSD& load_params);
- virtual void loadHistory(const std::string& file_name, std::list<LLSD>* messages, const LLSD& load_params);
+ LLLoadHistoryThread(const std::string& file_name, std::list<LLSD>* messages, const LLSD& load_params);
+ ~LLLoadHistoryThread();
+ //void setHistoryParams(const std::string& file_name, const LLSD& load_params);
+ virtual void loadHistory(const std::string& file_name, std::list<LLSD>* messages, const LLSD& load_params);
virtual void run();
- typedef boost::signals2::signal<void (std::list<LLSD>* messages,const std::string& file_name)> load_end_signal_t;
- load_end_signal_t * mLoadEndSignal;
- boost::signals2::connection setLoadEndSignal(const load_end_signal_t::slot_type& cb);
- void removeLoadEndSignal(const load_end_signal_t::slot_type& cb);
+ typedef boost::signals2::signal<void (std::list<LLSD>* messages,const std::string& file_name)> load_end_signal_t;
+ load_end_signal_t * mLoadEndSignal;
+ boost::signals2::connection setLoadEndSignal(const load_end_signal_t::slot_type& cb);
+ void removeLoadEndSignal(const load_end_signal_t::slot_type& cb);
};
class LLDeleteHistoryThread : public LLActionThread
{
private:
- std::list<LLSD>* mMessages;
- LLLoadHistoryThread* mLoadThread;
+ std::list<LLSD>* mMessages;
+ LLLoadHistoryThread* mLoadThread;
public:
- LLDeleteHistoryThread(std::list<LLSD>* messages, LLLoadHistoryThread* loadThread);
- ~LLDeleteHistoryThread();
+ LLDeleteHistoryThread(std::list<LLSD>* messages, LLLoadHistoryThread* loadThread);
+ ~LLDeleteHistoryThread();
- virtual void run();
- static void deleteHistory();
+ virtual void run();
+ static void deleteHistory();
};
class LLLogChat : public LLSingleton<LLLogChat>
@@ -84,65 +84,65 @@ class LLLogChat : public LLSingleton<LLLogChat>
LLSINGLETON(LLLogChat);
~LLLogChat();
public:
- // status values for callback function
- enum ELogLineType {
- LOG_EMPTY,
- LOG_LINE,
- LOG_LLSD,
- LOG_END
- };
-
- static std::string timestamp2LogString(U32 timestamp, bool withdate);
- static std::string makeLogFileName(std::string(filename));
- static void renameLogFile(const std::string& old_filename, const std::string& new_filename);
- /**
- *Add functions to get old and non date stamped file names when needed
- */
- static std::string oldLogFileName(std::string(filename));
- static void saveHistory(const std::string& filename,
- const std::string& from,
- const LLUUID& from_id,
- const std::string& line);
- static void findTranscriptFiles(std::string pattern, std::vector<std::string>& list_of_transcriptions);
- static void getListOfTranscriptFiles(std::vector<std::string>& list);
- static void getListOfTranscriptBackupFiles(std::vector<std::string>& list_of_transcriptions);
-
- static void loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params = LLSD(), bool is_group = false);
-
- typedef boost::signals2::signal<void ()> save_history_signal_t;
- boost::signals2::connection setSaveHistorySignal(const save_history_signal_t::slot_type& cb);
-
- static bool moveTranscripts(const std::string currentDirectory,
- const std::string newDirectory,
- std::vector<std::string>& listOfFilesToMove,
- std::vector<std::string>& listOfFilesMoved);
- static bool moveTranscripts(const std::string currentDirectory,
- const std::string newDirectory,
- std::vector<std::string>& listOfFilesToMove);
-
- static void deleteTranscripts();
- static bool isTranscriptExist(const LLUUID& avatar_id, bool is_group=false);
- static bool isNearbyTranscriptExist();
- static bool isAdHocTranscriptExist(std::string file_name);
- static bool isTranscriptFileFound(std::string fullname);
-
- bool historyThreadsFinished(LLUUID session_id);
- LLLoadHistoryThread* getLoadHistoryThread(LLUUID session_id);
- LLDeleteHistoryThread* getDeleteHistoryThread(LLUUID session_id);
- bool addLoadHistoryThread(LLUUID& session_id, LLLoadHistoryThread* lthread);
- bool addDeleteHistoryThread(LLUUID& session_id, LLDeleteHistoryThread* dthread);
- void cleanupHistoryThreads();
+ // status values for callback function
+ enum ELogLineType {
+ LOG_EMPTY,
+ LOG_LINE,
+ LOG_LLSD,
+ LOG_END
+ };
+
+ static std::string timestamp2LogString(U32 timestamp, bool withdate);
+ static std::string makeLogFileName(std::string(filename));
+ static void renameLogFile(const std::string& old_filename, const std::string& new_filename);
+ /**
+ *Add functions to get old and non date stamped file names when needed
+ */
+ static std::string oldLogFileName(std::string(filename));
+ static void saveHistory(const std::string& filename,
+ const std::string& from,
+ const LLUUID& from_id,
+ const std::string& line);
+ static void findTranscriptFiles(std::string pattern, std::vector<std::string>& list_of_transcriptions);
+ static void getListOfTranscriptFiles(std::vector<std::string>& list);
+ static void getListOfTranscriptBackupFiles(std::vector<std::string>& list_of_transcriptions);
+
+ static void loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params = LLSD(), bool is_group = false);
+
+ typedef boost::signals2::signal<void ()> save_history_signal_t;
+ boost::signals2::connection setSaveHistorySignal(const save_history_signal_t::slot_type& cb);
+
+ static bool moveTranscripts(const std::string currentDirectory,
+ const std::string newDirectory,
+ std::vector<std::string>& listOfFilesToMove,
+ std::vector<std::string>& listOfFilesMoved);
+ static bool moveTranscripts(const std::string currentDirectory,
+ const std::string newDirectory,
+ std::vector<std::string>& listOfFilesToMove);
+
+ static void deleteTranscripts();
+ static bool isTranscriptExist(const LLUUID& avatar_id, bool is_group=false);
+ static bool isNearbyTranscriptExist();
+ static bool isAdHocTranscriptExist(std::string file_name);
+ static bool isTranscriptFileFound(std::string fullname);
+
+ bool historyThreadsFinished(LLUUID session_id);
+ LLLoadHistoryThread* getLoadHistoryThread(LLUUID session_id);
+ LLDeleteHistoryThread* getDeleteHistoryThread(LLUUID session_id);
+ bool addLoadHistoryThread(LLUUID& session_id, LLLoadHistoryThread* lthread);
+ bool addDeleteHistoryThread(LLUUID& session_id, LLDeleteHistoryThread* dthread);
+ void cleanupHistoryThreads();
private:
- static std::string cleanFileName(std::string filename);
+ static std::string cleanFileName(std::string filename);
- LLMutex* historyThreadsMutex();
- void triggerHistorySignal();
+ LLMutex* historyThreadsMutex();
+ void triggerHistorySignal();
- save_history_signal_t * mSaveHistorySignal;
- std::map<LLUUID,LLLoadHistoryThread *> mLoadHistoryThreads;
- std::map<LLUUID,LLDeleteHistoryThread *> mDeleteHistoryThreads;
- LLMutex* mHistoryThreadsMutex;
+ save_history_signal_t * mSaveHistorySignal;
+ std::map<LLUUID,LLLoadHistoryThread *> mLoadHistoryThreads;
+ std::map<LLUUID,LLDeleteHistoryThread *> mDeleteHistoryThreads;
+ LLMutex* mHistoryThreadsMutex;
};
/**
@@ -151,25 +151,25 @@ private:
class LLChatLogFormatter
{
public:
- LLChatLogFormatter(const LLSD& im) : mIM(im) {}
- virtual ~LLChatLogFormatter() {};
+ LLChatLogFormatter(const LLSD& im) : mIM(im) {}
+ virtual ~LLChatLogFormatter() {};
- friend std::ostream& operator<<(std::ostream& str, const LLChatLogFormatter& formatter)
- {
- formatter.format(formatter.mIM, str);
- return str;
- }
+ friend std::ostream& operator<<(std::ostream& str, const LLChatLogFormatter& formatter)
+ {
+ formatter.format(formatter.mIM, str);
+ return str;
+ }
protected:
- /**
- * Format an instant message to a stream
- * Timestamps and sender names are required
- * New lines of multilined messages are prepended with a space
- */
- void format(const LLSD& im, std::ostream& ostr) const;
+ /**
+ * Format an instant message to a stream
+ * Timestamps and sender names are required
+ * New lines of multilined messages are prepended with a space
+ */
+ void format(const LLSD& im, std::ostream& ostr) const;
- LLSD mIM;
+ LLSD mIM;
};
/**
@@ -179,22 +179,22 @@ class LLChatLogParser
{
public:
- /**
- * Parse a line from the plain text chat log file
- * General plain text log format is like: "[timestamp] [name]: [message]"
- * [timestamp] and [name] are optional
- * Examples of plain text chat log lines:
- * "[2009/11/20 2:53] Igor ProductEngine: howdy"
- * "Igor ProductEngine: howdy"
- * "Dserduk ProductEngine is Online"
- *
- * @return false if failed to parse mandatory data - message text
- */
- static bool parse(std::string& raw, LLSD& im, const LLSD& parse_params = LLSD());
+ /**
+ * Parse a line from the plain text chat log file
+ * General plain text log format is like: "[timestamp] [name]: [message]"
+ * [timestamp] and [name] are optional
+ * Examples of plain text chat log lines:
+ * "[2009/11/20 2:53] Igor ProductEngine: howdy"
+ * "Igor ProductEngine: howdy"
+ * "Dserduk ProductEngine is Online"
+ *
+ * @return false if failed to parse mandatory data - message text
+ */
+ static bool parse(std::string& raw, LLSD& im, const LLSD& parse_params = LLSD());
protected:
- LLChatLogParser();
- virtual ~LLChatLogParser() {};
+ LLChatLogParser();
+ virtual ~LLChatLogParser() {};
};
extern const std::string GROUP_CHAT_SUFFIX;
diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp
index 92e341ce93..323b6c9fa7 100644
--- a/indra/newview/llloginhandler.cpp
+++ b/indra/newview/llloginhandler.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llloginhandler.cpp
* @brief Handles filling in the login panel information from a SLURL
* such as secondlife:///app/login?first=Bob&last=Dobbs
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,13 +30,13 @@
// viewer includes
#include "llsecapi.h"
-#include "lllogininstance.h" // to check if logged in yet
+#include "lllogininstance.h" // to check if logged in yet
#include "llpanellogin.h"
-#include "llstartup.h" // getStartupState()
+#include "llstartup.h" // getStartupState()
#include "llslurl.h"
-#include "llviewercontrol.h" // gSavedSettings
-#include "llviewernetwork.h" // EGridInfo
-#include "llviewerwindow.h" // getWindow()
+#include "llviewercontrol.h" // gSavedSettings
+#include "llviewernetwork.h" // EGridInfo
+#include "llviewerwindow.h" // getWindow()
// library includes
#include "llmd5.h"
@@ -52,128 +52,128 @@ LLLoginHandler gLoginHandler;
//a web-login-key, firstname and lastname is set
bool LLLoginHandler::parseDirectLogin(std::string url)
{
- LLURI uri(url);
- parse(uri.queryMap());
+ LLURI uri(url);
+ parse(uri.queryMap());
- // NOTE: Need to add direct login as per identity evolution
- return true;
+ // NOTE: Need to add direct login as per identity evolution
+ return true;
}
void LLLoginHandler::parse(const LLSD& queryMap)
{
-
- if (queryMap.has("grid"))
- {
- LLGridManager::getInstance()->setGridChoice(queryMap["grid"].asString());
- }
-
-
- std::string startLocation = queryMap["location"].asString();
-
- if (startLocation == "specify")
- {
- LLStartUp::setStartSLURL(LLSLURL(LLGridManager::getInstance()->getGridLoginID(),
- queryMap["region"].asString()));
- }
- else if (startLocation == "home")
- {
- LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
- }
- else if (startLocation == "last")
- {
- LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
- }
+
+ if (queryMap.has("grid"))
+ {
+ LLGridManager::getInstance()->setGridChoice(queryMap["grid"].asString());
+ }
+
+
+ std::string startLocation = queryMap["location"].asString();
+
+ if (startLocation == "specify")
+ {
+ LLStartUp::setStartSLURL(LLSLURL(LLGridManager::getInstance()->getGridLoginID(),
+ queryMap["region"].asString()));
+ }
+ else if (startLocation == "home")
+ {
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+ }
+ else if (startLocation == "last")
+ {
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+ }
}
bool LLLoginHandler::handle(const LLSD& tokens,
- const LLSD& query_map,
- const std::string& grid,
- LLMediaCtrl* web)
+ const LLSD& query_map,
+ const std::string& grid,
+ LLMediaCtrl* web)
{
- // do nothing if we are already logged in
- if (LLLoginInstance::getInstance()->authSuccess())
- {
- LL_WARNS_ONCE("SLURL") << "Already logged in! Ignoring login SLapp." << LL_ENDL;
- return true;
- }
-
- // Make sure window is visible
- LLWindow* window = gViewerWindow->getWindow();
- if (window->getMinimized())
- {
- window->restore();
- }
-
- parse(query_map);
-
- //if we haven't initialized stuff yet, this is
- //coming in from the GURL handler, just parse
- if (STATE_FIRST == LLStartUp::getStartupState())
- {
- return true;
- }
-
- if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page
- {
- // as the login page may change from grid to grid, as well as
- // things like username/password/etc, we simply refresh the
- // login page to make sure everything is set up correctly
- LLPanelLogin::loadLoginPage();
- LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
- }
- return true;
+ // do nothing if we are already logged in
+ if (LLLoginInstance::getInstance()->authSuccess())
+ {
+ LL_WARNS_ONCE("SLURL") << "Already logged in! Ignoring login SLapp." << LL_ENDL;
+ return true;
+ }
+
+ // Make sure window is visible
+ LLWindow* window = gViewerWindow->getWindow();
+ if (window->getMinimized())
+ {
+ window->restore();
+ }
+
+ parse(query_map);
+
+ //if we haven't initialized stuff yet, this is
+ //coming in from the GURL handler, just parse
+ if (STATE_FIRST == LLStartUp::getStartupState())
+ {
+ return true;
+ }
+
+ if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page
+ {
+ // as the login page may change from grid to grid, as well as
+ // things like username/password/etc, we simply refresh the
+ // login page to make sure everything is set up correctly
+ LLPanelLogin::loadLoginPage();
+ LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+ }
+ return true;
}
-// Initialize the credentials
-// If the passed in URL contains login info, parse
-// that into a credential and web login key. Otherwise
-// check the command line. If the command line
-// does not contain any login creds, load the last saved
-// ones from the protected credential store.
-// This always returns with a credential structure set in the
-// login handler
-LLPointer<LLCredential> LLLoginHandler::initializeLoginInfo()
-{
- LLPointer<LLCredential> result = NULL;
- // so try to load it from the UserLoginInfo
- result = loadSavedUserLoginInfo();
- if (result.isNull())
- {
+// Initialize the credentials
+// If the passed in URL contains login info, parse
+// that into a credential and web login key. Otherwise
+// check the command line. If the command line
+// does not contain any login creds, load the last saved
+// ones from the protected credential store.
+// This always returns with a credential structure set in the
+// login handler
+LLPointer<LLCredential> LLLoginHandler::initializeLoginInfo()
+{
+ LLPointer<LLCredential> result = NULL;
+ // so try to load it from the UserLoginInfo
+ result = loadSavedUserLoginInfo();
+ if (result.isNull())
+ {
// Since legacy viewer store login info one per grid, newer viewers have to
// reuse same information to remember last user and for compatibility,
// but otherwise login info is stored in separate map in gSecAPIHandler
result = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
- }
-
- return result;
-}
+ }
+
+ return result;
+}
LLPointer<LLCredential> LLLoginHandler::loadSavedUserLoginInfo()
{
// load the saved user login info into a LLCredential.
// perhaps this should be moved.
- LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
- if (cmd_line_login.size() == 3)
- {
-
- LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
- char md5pass[33]; /* Flawfinder: ignore */
- pass.hex_digest(md5pass);
- LLSD identifier = LLSD::emptyMap();
- identifier["type"] = "agent";
- identifier["first_name"] = cmd_line_login[0];
- identifier["last_name"] = cmd_line_login[1];
-
- LLSD authenticator = LLSD::emptyMap();
- authenticator["type"] = "hash";
- authenticator["algorithm"] = "md5";
- authenticator["secret"] = md5pass;
- // yuck, we'll fix this with mani's changes.
- return gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(),
- identifier, authenticator);
- }
- return NULL;
+ LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
+ if (cmd_line_login.size() == 3)
+ {
+
+ LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
+ char md5pass[33]; /* Flawfinder: ignore */
+ pass.hex_digest(md5pass);
+ LLSD identifier = LLSD::emptyMap();
+ identifier["type"] = "agent";
+ identifier["first_name"] = cmd_line_login[0];
+ identifier["last_name"] = cmd_line_login[1];
+
+ LLSD authenticator = LLSD::emptyMap();
+ authenticator["type"] = "hash";
+ authenticator["algorithm"] = "md5";
+ authenticator["secret"] = md5pass;
+ // yuck, we'll fix this with mani's changes.
+ return gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(),
+ identifier, authenticator);
+ }
+ return NULL;
}
diff --git a/indra/newview/llloginhandler.h b/indra/newview/llloginhandler.h
index 2579341dbf..82aa358fd4 100644
--- a/indra/newview/llloginhandler.h
+++ b/indra/newview/llloginhandler.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llloginhandler.h
* @brief Handles filling in the login panel information from a SLURL
* such as secondlife:///app/login?first=Bob&last=Dobbs
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,22 +33,22 @@
class LLLoginHandler : public LLCommandHandler
{
public:
- // allow from external browsers
- LLLoginHandler() : LLCommandHandler("login", UNTRUSTED_ALLOW) { }
- /*virtual*/ bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web);
+ // allow from external browsers
+ LLLoginHandler() : LLCommandHandler("login", UNTRUSTED_ALLOW) { }
+ /*virtual*/ bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web);
- // Fill in our internal fields from a SLURL like
- // secondlife:///app/login?first=Bob&last=Dobbs
- bool parseDirectLogin(std::string url);
+ // Fill in our internal fields from a SLURL like
+ // secondlife:///app/login?first=Bob&last=Dobbs
+ bool parseDirectLogin(std::string url);
- // Web-based login unsupported
- //LLUUID getWebLoginKey() const { return mWebLoginKey; }
+ // Web-based login unsupported
+ //LLUUID getWebLoginKey() const { return mWebLoginKey; }
- LLPointer<LLCredential> loadSavedUserLoginInfo();
- LLPointer<LLCredential> initializeLoginInfo();
+ LLPointer<LLCredential> loadSavedUserLoginInfo();
+ LLPointer<LLCredential> initializeLoginInfo();
private:
- void parse(const LLSD& queryMap);
+ void parse(const LLSD& queryMap);
};
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index 01496fa7ce..2d9b46bf84 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllogininstance.cpp
* @brief Viewer's host for a login connection.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -71,7 +71,7 @@ const F32 LOGIN_DNS_TIMEOUT_FACTOR = 0.9; // make DNS wait shorter then retry ti
class LLLoginInstance::Disposable {
public:
- virtual ~Disposable() {}
+ virtual ~Disposable() {}
};
static const char * const TOS_REPLY_PUMP = "lllogininstance_tos_callback";
@@ -84,30 +84,30 @@ std::string construct_start_string();
LLLoginInstance::LLLoginInstance() :
- mLoginModule(new LLLogin()),
- mNotifications(NULL),
- mLoginState("offline"),
+ mLoginModule(new LLLogin()),
+ mNotifications(NULL),
+ mLoginState("offline"),
mSaveMFA(true),
- mAttemptComplete(false),
- mTransferRate(0.0f),
- mDispatcher("LLLoginInstance", "change")
+ mAttemptComplete(false),
+ mTransferRate(0.0f),
+ mDispatcher("LLLoginInstance", "change")
{
- mLoginModule->getEventPump().listen("lllogininstance",
- boost::bind(&LLLoginInstance::handleLoginEvent, this, _1));
- // This internal use of LLEventDispatcher doesn't really need
- // per-function descriptions.
- mDispatcher.add("fail.login", "", boost::bind(&LLLoginInstance::handleLoginFailure, this, _1));
- mDispatcher.add("connect", "", boost::bind(&LLLoginInstance::handleLoginSuccess, this, _1));
- mDispatcher.add("disconnect", "", boost::bind(&LLLoginInstance::handleDisconnect, this, _1));
- mDispatcher.add("indeterminate", "", boost::bind(&LLLoginInstance::handleIndeterminate, this, _1));
+ mLoginModule->getEventPump().listen("lllogininstance",
+ boost::bind(&LLLoginInstance::handleLoginEvent, this, _1));
+ // This internal use of LLEventDispatcher doesn't really need
+ // per-function descriptions.
+ mDispatcher.add("fail.login", "", boost::bind(&LLLoginInstance::handleLoginFailure, this, _1));
+ mDispatcher.add("connect", "", boost::bind(&LLLoginInstance::handleLoginSuccess, this, _1));
+ mDispatcher.add("disconnect", "", boost::bind(&LLLoginInstance::handleDisconnect, this, _1));
+ mDispatcher.add("indeterminate", "", boost::bind(&LLLoginInstance::handleIndeterminate, this, _1));
}
void LLLoginInstance::setPlatformInfo(const std::string platform,
- const std::string platform_version,
+ const std::string platform_version,
const std::string platform_name)
{
- mPlatform = platform;
- mPlatformVersion = platform_version;
+ mPlatform = platform;
+ mPlatformVersion = platform_version;
mPlatformVersionName = platform_name;
}
@@ -117,116 +117,116 @@ LLLoginInstance::~LLLoginInstance()
void LLLoginInstance::connect(LLPointer<LLCredential> credentials)
{
- std::vector<std::string> uris;
- LLGridManager::getInstance()->getLoginURIs(uris);
+ std::vector<std::string> uris;
+ LLGridManager::getInstance()->getLoginURIs(uris);
if (uris.size() < 1)
{
LL_WARNS() << "Failed to get login URIs during connect. No connect for you!" << LL_ENDL;
return;
}
- connect(uris.front(), credentials);
+ connect(uris.front(), credentials);
}
void LLLoginInstance::connect(const std::string& uri, LLPointer<LLCredential> credentials)
{
- mAttemptComplete = false; // Reset attempt complete at this point!
- constructAuthParams(credentials);
- mLoginModule->connect(uri, mRequestData);
+ mAttemptComplete = false; // Reset attempt complete at this point!
+ constructAuthParams(credentials);
+ mLoginModule->connect(uri, mRequestData);
}
void LLLoginInstance::reconnect()
{
- // Sort of like connect, only using the pre-existing
- // request params.
- std::vector<std::string> uris;
- LLGridManager::getInstance()->getLoginURIs(uris);
- mLoginModule->connect(uris.front(), mRequestData);
- gViewerWindow->setShowProgress(true);
+ // Sort of like connect, only using the pre-existing
+ // request params.
+ std::vector<std::string> uris;
+ LLGridManager::getInstance()->getLoginURIs(uris);
+ mLoginModule->connect(uris.front(), mRequestData);
+ gViewerWindow->setShowProgress(true);
}
void LLLoginInstance::disconnect()
{
- mAttemptComplete = false; // Reset attempt complete at this point!
- mRequestData.clear();
- mLoginModule->disconnect();
+ mAttemptComplete = false; // Reset attempt complete at this point!
+ mRequestData.clear();
+ mLoginModule->disconnect();
}
-LLSD LLLoginInstance::getResponse()
+LLSD LLLoginInstance::getResponse()
{
- return mResponseData;
+ return mResponseData;
}
void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credential)
{
- // Set up auth request options.
+ // Set up auth request options.
//#define LL_MINIMIAL_REQUESTED_OPTIONS
- LLSD requested_options;
- // *Note: this is where gUserAuth used to be created.
- requested_options.append("inventory-root");
- requested_options.append("inventory-skeleton");
- //requested_options.append("inventory-meat");
- //requested_options.append("inventory-skel-targets");
+ LLSD requested_options;
+ // *Note: this is where gUserAuth used to be created.
+ requested_options.append("inventory-root");
+ requested_options.append("inventory-skeleton");
+ //requested_options.append("inventory-meat");
+ //requested_options.append("inventory-skel-targets");
#if (!defined LL_MINIMIAL_REQUESTED_OPTIONS)
// Not requesting library will trigger mFatalNoLibraryRootFolder
- requested_options.append("inventory-lib-root");
- requested_options.append("inventory-lib-owner");
- requested_options.append("inventory-skel-lib");
- // requested_options.append("inventory-meat-lib");
-
- requested_options.append("initial-outfit");
- requested_options.append("gestures");
- requested_options.append("display_names");
- requested_options.append("event_categories");
- requested_options.append("event_notifications");
- requested_options.append("classified_categories");
- requested_options.append("adult_compliant");
- requested_options.append("buddy-list");
- requested_options.append("newuser-config");
- requested_options.append("ui-config");
-
- //send this info to login.cgi for stats gathering
- //since viewerstats isn't reliable enough
- requested_options.append("advanced-mode");
+ requested_options.append("inventory-lib-root");
+ requested_options.append("inventory-lib-owner");
+ requested_options.append("inventory-skel-lib");
+ // requested_options.append("inventory-meat-lib");
+
+ requested_options.append("initial-outfit");
+ requested_options.append("gestures");
+ requested_options.append("display_names");
+ requested_options.append("event_categories");
+ requested_options.append("event_notifications");
+ requested_options.append("classified_categories");
+ requested_options.append("adult_compliant");
+ requested_options.append("buddy-list");
+ requested_options.append("newuser-config");
+ requested_options.append("ui-config");
+
+ //send this info to login.cgi for stats gathering
+ //since viewerstats isn't reliable enough
+ requested_options.append("advanced-mode");
#endif
- requested_options.append("max-agent-groups");
- requested_options.append("map-server-url");
- requested_options.append("voice-config");
- requested_options.append("tutorial_setting");
- requested_options.append("login-flags");
- requested_options.append("global-textures");
- if(gSavedSettings.getBOOL("ConnectAsGod"))
- {
- gSavedSettings.setBOOL("UseDebugMenus", TRUE);
- requested_options.append("god-connect");
- }
-
- LLSD request_params;
+ requested_options.append("max-agent-groups");
+ requested_options.append("map-server-url");
+ requested_options.append("voice-config");
+ requested_options.append("tutorial_setting");
+ requested_options.append("login-flags");
+ requested_options.append("global-textures");
+ if(gSavedSettings.getBOOL("ConnectAsGod"))
+ {
+ gSavedSettings.setBOOL("UseDebugMenus", TRUE);
+ requested_options.append("god-connect");
+ }
+
+ LLSD request_params;
unsigned char hashed_unique_id_string[MD5HEX_STR_SIZE];
if ( ! llHashedUniqueID(hashed_unique_id_string) )
{
- LL_WARNS("LLLogin") << "Not providing a unique id in request params" << LL_ENDL;
-
- }
- request_params["start"] = construct_start_string();
- request_params["agree_to_tos"] = false; // Always false here. Set true in
- request_params["read_critical"] = false; // handleTOSResponse
- request_params["last_exec_event"] = mLastExecEvent;
- request_params["last_exec_duration"] = mLastExecDuration;
- request_params["mac"] = (char*)hashed_unique_id_string;
- request_params["version"] = LLVersionInfo::instance().getVersion();
- request_params["channel"] = LLVersionInfo::instance().getChannel();
- request_params["platform"] = mPlatform;
- request_params["address_size"] = ADDRESS_SIZE;
- request_params["platform_version"] = mPlatformVersion;
- request_params["platform_string"] = mPlatformVersionName;
- request_params["id0"] = mSerialNumber;
- request_params["host_id"] = gSavedSettings.getString("HostID");
- request_params["extended_errors"] = true; // request message_id and message_args
- request_params["token"] = "";
+ LL_WARNS("LLLogin") << "Not providing a unique id in request params" << LL_ENDL;
+
+ }
+ request_params["start"] = construct_start_string();
+ request_params["agree_to_tos"] = false; // Always false here. Set true in
+ request_params["read_critical"] = false; // handleTOSResponse
+ request_params["last_exec_event"] = mLastExecEvent;
+ request_params["last_exec_duration"] = mLastExecDuration;
+ request_params["mac"] = (char*)hashed_unique_id_string;
+ request_params["version"] = LLVersionInfo::instance().getVersion();
+ request_params["channel"] = LLVersionInfo::instance().getChannel();
+ request_params["platform"] = mPlatform;
+ request_params["address_size"] = ADDRESS_SIZE;
+ request_params["platform_version"] = mPlatformVersion;
+ request_params["platform_string"] = mPlatformVersionName;
+ request_params["id0"] = mSerialNumber;
+ request_params["host_id"] = gSavedSettings.getString("HostID");
+ request_params["extended_errors"] = true; // request message_id and message_args
+ request_params["token"] = "";
// log request_params _before_ adding the credentials or sensitive MFA hash data
LL_DEBUGS("LLLogin") << "Login parameters: " << LLSDOStreamer<LLSDNotationFormatter>(request_params) << LL_ENDL;
@@ -268,18 +268,18 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
request_params["mfa_hash"] = mfa_hash;
- // Specify desired timeout/retry options
- LLSD http_params;
- F32 srv_timeout = llclamp(gSavedSettings.getF32("LoginSRVTimeout"), LOGIN_SRV_TIMEOUT_MIN, LOGIN_SRV_TIMEOUT_MAX);
- http_params["timeout"] = srv_timeout;
- http_params["retries"] = LOGIN_MAX_RETRIES;
- http_params["DNSCacheTimeout"] = srv_timeout * LOGIN_DNS_TIMEOUT_FACTOR; //Default: indefinite
-
- mRequestData.clear();
- mRequestData["method"] = "login_to_simulator";
- mRequestData["params"] = request_params;
- mRequestData["options"] = requested_options;
- mRequestData["http_params"] = http_params;
+ // Specify desired timeout/retry options
+ LLSD http_params;
+ F32 srv_timeout = llclamp(gSavedSettings.getF32("LoginSRVTimeout"), LOGIN_SRV_TIMEOUT_MIN, LOGIN_SRV_TIMEOUT_MAX);
+ http_params["timeout"] = srv_timeout;
+ http_params["retries"] = LOGIN_MAX_RETRIES;
+ http_params["DNSCacheTimeout"] = srv_timeout * LOGIN_DNS_TIMEOUT_FACTOR; //Default: indefinite
+
+ mRequestData.clear();
+ mRequestData["method"] = "login_to_simulator";
+ mRequestData["params"] = request_params;
+ mRequestData["options"] = requested_options;
+ mRequestData["http_params"] = http_params;
#if LL_RELEASE_FOR_DOWNLOAD
mRequestData["wait_for_updater"] = LLAppViewer::instance()->waitForUpdater();
#else
@@ -289,25 +289,25 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
bool LLLoginInstance::handleLoginEvent(const LLSD& event)
{
- LL_DEBUGS("LLLogin") << "LoginListener called!: \n" << event << LL_ENDL;
+ LL_DEBUGS("LLLogin") << "LoginListener called!: \n" << event << LL_ENDL;
- if(!(event.has("state") && event.has("change") && event.has("progress")))
- {
- LL_ERRS("LLLogin") << "Unknown message from LLLogin: " << event << LL_ENDL;
- }
+ if(!(event.has("state") && event.has("change") && event.has("progress")))
+ {
+ LL_ERRS("LLLogin") << "Unknown message from LLLogin: " << event << LL_ENDL;
+ }
- mLoginState = event["state"].asString();
- mResponseData = event["data"];
+ mLoginState = event["state"].asString();
+ mResponseData = event["data"];
- if(event.has("transfer_rate"))
- {
- mTransferRate = event["transfer_rate"].asReal();
- }
+ if(event.has("transfer_rate"))
+ {
+ mTransferRate = event["transfer_rate"].asReal();
+ }
- // Call the method registered in constructor, if any, for more specific
- // handling
- mDispatcher.try_call(event);
- return false;
+ // Call the method registered in constructor, if any, for more specific
+ // handling
+ mDispatcher.try_call(event);
+ return false;
}
void LLLoginInstance::handleLoginFailure(const LLSD& event)
@@ -316,7 +316,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
// here and in STATE_LOGIN_PROCESS_RESPONSE processing
// consider uniting them.
- // Login has failed.
+ // Login has failed.
// Figure out why and respond...
LLSD response = event["data"];
LLSD updater = response["updater"];
@@ -335,7 +335,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
// For the cases of critical message or TOS agreement,
// start the TOS dialog. The dialog response will be handled
// by the LLLoginInstance::handleTOSResponse() callback.
- // The callback intiates the login attempt next step, either
+ // The callback intiates the login attempt next step, either
// to reconnect or to end the attempt in failure.
if(reason_response == "tos")
{
@@ -349,7 +349,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
LLFloaterReg::showInstance("message_tos", data);
LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
.listen(TOS_LISTENER_NAME,
- boost::bind(&LLLoginInstance::handleTOSResponse,
+ boost::bind(&LLLoginInstance::handleTOSResponse,
this, _1, "agree_to_tos"));
}
else if(reason_response == "critical")
@@ -374,7 +374,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
LLFloaterReg::showInstance("message_critical", data);
LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
.listen(TOS_LISTENER_NAME,
- boost::bind(&LLLoginInstance::handleTOSResponse,
+ boost::bind(&LLLoginInstance::handleTOSResponse,
this, _1, "read_critical"));
}
else if(reason_response == "update")
@@ -463,14 +463,14 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
attemptComplete();
}
else
- {
+ {
LL_WARNS("LLLogin") << "Login failed for an unknown reason: " << LLSDOStreamer<LLSDNotationFormatter>(response) << LL_ENDL;
if (gViewerWindow)
gViewerWindow->setShowProgress(FALSE);
LLNotificationsUtil::add("LoginFailedUnknown", LLSD::emptyMap(), LLSD::emptyMap(), boost::bind(&LLLoginInstance::handleLoginDisallowed, this, _1, _2));
- }
+ }
}
void LLLoginInstance::syncWithUpdater(ResponsePtr resp, const LLSD& notification, const LLSD& response)
@@ -493,36 +493,36 @@ void LLLoginInstance::handleLoginDisallowed(const LLSD& notification, const LLSD
void LLLoginInstance::handleLoginSuccess(const LLSD& event)
{
- LL_INFOS("LLLogin") << "LLLoginInstance::handleLoginSuccess" << LL_ENDL;
+ LL_INFOS("LLLogin") << "LLLoginInstance::handleLoginSuccess" << LL_ENDL;
- attemptComplete();
- mRequestData.clear();
+ attemptComplete();
+ mRequestData.clear();
}
void LLLoginInstance::handleDisconnect(const LLSD& event)
{
// placeholder
- LL_INFOS("LLLogin") << "LLLoginInstance::handleDisconnect placeholder " << LL_ENDL;
+ LL_INFOS("LLLogin") << "LLLoginInstance::handleDisconnect placeholder " << LL_ENDL;
}
void LLLoginInstance::handleIndeterminate(const LLSD& event)
{
- // The indeterminate response means that the server
- // gave the viewer a new url and params to try.
- // The login module handles the retry, but it gives us the
- // server response so that we may show
- // the user some status.
-
- LLSD message = event.get("data").get("message");
- if(message.isDefined())
- {
- LL_INFOS("LLLogin") << "LLLoginInstance::handleIndeterminate " << message.asString() << LL_ENDL;
-
- LLSD progress_update;
- progress_update["desc"] = message;
- LLEventPumps::getInstance()->obtain("LLProgressView").post(progress_update);
- }
+ // The indeterminate response means that the server
+ // gave the viewer a new url and params to try.
+ // The login module handles the retry, but it gives us the
+ // server response so that we may show
+ // the user some status.
+
+ LLSD message = event.get("data").get("message");
+ if(message.isDefined())
+ {
+ LL_INFOS("LLLogin") << "LLLoginInstance::handleIndeterminate " << message.asString() << LL_ENDL;
+
+ LLSD progress_update;
+ progress_update["desc"] = message;
+ LLEventPumps::getInstance()->obtain("LLProgressView").post(progress_update);
+ }
}
bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key)
@@ -598,33 +598,33 @@ bool LLLoginInstance::handleMFAChallenge(LLSD const & notif, LLSD const & respon
std::string construct_start_string()
{
- std::string start;
- LLSLURL start_slurl = LLStartUp::getStartSLURL();
- switch(start_slurl.getType())
- {
- case LLSLURL::LOCATION:
- {
- // a startup URL was specified
- LLVector3 position = start_slurl.getPosition();
- std::string unescaped_start =
- STRINGIZE( "uri:"
- << start_slurl.getRegion() << "&"
- << position[VX] << "&"
- << position[VY] << "&"
- << position[VZ]);
- start = xml_escape_string(unescaped_start);
- break;
- }
- case LLSLURL::HOME_LOCATION:
- {
- start = "home";
- break;
- }
- default:
- {
- start = "last";
- }
- }
- return start;
+ std::string start;
+ LLSLURL start_slurl = LLStartUp::getStartSLURL();
+ switch(start_slurl.getType())
+ {
+ case LLSLURL::LOCATION:
+ {
+ // a startup URL was specified
+ LLVector3 position = start_slurl.getPosition();
+ std::string unescaped_start =
+ STRINGIZE( "uri:"
+ << start_slurl.getRegion() << "&"
+ << position[VX] << "&"
+ << position[VY] << "&"
+ << position[VZ]);
+ start = xml_escape_string(unescaped_start);
+ break;
+ }
+ case LLSLURL::HOME_LOCATION:
+ {
+ start = "home";
+ break;
+ }
+ default:
+ {
+ start = "last";
+ }
+ }
+ return start;
}
diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h
index 74d6890d1d..0ec7b3bb24 100644
--- a/indra/newview/lllogininstance.h
+++ b/indra/newview/lllogininstance.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllogininstance.h
* @brief A host for the viewer's login connection.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,75 +37,75 @@ class LLLogin;
class LLEventStream;
class LLNotificationsInterface;
-// This class hosts the login module and is used to
+// This class hosts the login module and is used to
// negotiate user authentication attempts.
class LLLoginInstance : public LLSingleton<LLLoginInstance>
{
- LLSINGLETON(LLLoginInstance);
- ~LLLoginInstance();
+ LLSINGLETON(LLLoginInstance);
+ ~LLLoginInstance();
public:
- class Disposable;
+ class Disposable;
- void connect(LLPointer<LLCredential> credentials); // Connect to the current grid choice.
- void connect(const std::string& uri, LLPointer<LLCredential> credentials); // Connect to the given uri.
- void reconnect(); // reconnect using the current credentials.
- void disconnect();
+ void connect(LLPointer<LLCredential> credentials); // Connect to the current grid choice.
+ void connect(const std::string& uri, LLPointer<LLCredential> credentials); // Connect to the given uri.
+ void reconnect(); // reconnect using the current credentials.
+ void disconnect();
- bool authFailure() { return mAttemptComplete && mLoginState == "offline"; }
- bool authSuccess() { return mAttemptComplete && mLoginState == "online"; }
+ bool authFailure() { return mAttemptComplete && mLoginState == "offline"; }
+ bool authSuccess() { return mAttemptComplete && mLoginState == "online"; }
- const std::string& getLoginState() { return mLoginState; }
+ const std::string& getLoginState() { return mLoginState; }
bool saveMFA() const { return mSaveMFA; }
- LLSD getResponse(const std::string& key) { return getResponse()[key]; }
- LLSD getResponse();
+ LLSD getResponse(const std::string& key) { return getResponse()[key]; }
+ LLSD getResponse();
- // Only valid when authSuccess == true.
- const F64 getLastTransferRateBPS() { return mTransferRate; }
- void setSerialNumber(const std::string& sn) { mSerialNumber = sn; }
- void setLastExecEvent(int lee) { mLastExecEvent = lee; }
- void setLastExecDuration(S32 duration) { mLastExecDuration = duration; }
- void setPlatformInfo(const std::string platform, const std::string platform_version, const std::string platform_name);
+ // Only valid when authSuccess == true.
+ const F64 getLastTransferRateBPS() { return mTransferRate; }
+ void setSerialNumber(const std::string& sn) { mSerialNumber = sn; }
+ void setLastExecEvent(int lee) { mLastExecEvent = lee; }
+ void setLastExecDuration(S32 duration) { mLastExecDuration = duration; }
+ void setPlatformInfo(const std::string platform, const std::string platform_version, const std::string platform_name);
- void setNotificationsInterface(LLNotificationsInterface* ni) { mNotifications = ni; }
- LLNotificationsInterface& getNotificationsInterface() const { return *mNotifications; }
+ void setNotificationsInterface(LLNotificationsInterface* ni) { mNotifications = ni; }
+ LLNotificationsInterface& getNotificationsInterface() const { return *mNotifications; }
private:
- typedef std::shared_ptr<LLEventAPI::Response> ResponsePtr;
- void constructAuthParams(LLPointer<LLCredential> user_credentials);
- void updateApp(bool mandatory, const std::string& message);
- bool updateDialogCallback(const LLSD& notification, const LLSD& response);
-
- bool handleLoginEvent(const LLSD& event);
- void handleLoginFailure(const LLSD& event);
- void handleLoginSuccess(const LLSD& event);
- void handleDisconnect(const LLSD& event);
- void handleIndeterminate(const LLSD& event);
- void handleLoginDisallowed(const LLSD& notification, const LLSD& response);
- void syncWithUpdater(ResponsePtr resp, const LLSD& notification, const LLSD& response);
-
- bool handleTOSResponse(bool v, const std::string& key);
+ typedef std::shared_ptr<LLEventAPI::Response> ResponsePtr;
+ void constructAuthParams(LLPointer<LLCredential> user_credentials);
+ void updateApp(bool mandatory, const std::string& message);
+ bool updateDialogCallback(const LLSD& notification, const LLSD& response);
+
+ bool handleLoginEvent(const LLSD& event);
+ void handleLoginFailure(const LLSD& event);
+ void handleLoginSuccess(const LLSD& event);
+ void handleDisconnect(const LLSD& event);
+ void handleIndeterminate(const LLSD& event);
+ void handleLoginDisallowed(const LLSD& notification, const LLSD& response);
+ void syncWithUpdater(ResponsePtr resp, const LLSD& notification, const LLSD& response);
+
+ bool handleTOSResponse(bool v, const std::string& key);
void showMFAChallange(const std::string& message);
bool handleMFAChallenge(LLSD const & notif, LLSD const & response);
- void attemptComplete() { mAttemptComplete = true; } // In the future an event?
+ void attemptComplete() { mAttemptComplete = true; } // In the future an event?
- std::unique_ptr<LLLogin> mLoginModule;
- LLNotificationsInterface* mNotifications;
+ std::unique_ptr<LLLogin> mLoginModule;
+ LLNotificationsInterface* mNotifications;
- std::string mLoginState;
- LLSD mRequestData;
- LLSD mResponseData;
- bool mAttemptComplete;
+ std::string mLoginState;
+ LLSD mRequestData;
+ LLSD mResponseData;
+ bool mAttemptComplete;
bool mSaveMFA;
- F64 mTransferRate;
- std::string mSerialNumber;
- int mLastExecEvent;
- S32 mLastExecDuration;
- std::string mPlatform;
- std::string mPlatformVersion;
- std::string mPlatformVersionName;
- LLEventDispatcher mDispatcher;
+ F64 mTransferRate;
+ std::string mSerialNumber;
+ int mLastExecEvent;
+ S32 mLastExecDuration;
+ std::string mPlatform;
+ std::string mPlatformVersion;
+ std::string mPlatformVersionName;
+ LLEventDispatcher mDispatcher;
};
#endif
diff --git a/indra/newview/lllookshistorypanel.h b/indra/newview/lllookshistorypanel.h
index 965b4d8416..6293de7170 100644
--- a/indra/newview/lllookshistorypanel.h
+++ b/indra/newview/lllookshistorypanel.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelteleporthistory.h
* @brief Teleport history represented by a scrolling list
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,31 +37,31 @@
class LLLooksHistoryPanel : public LLPanelAppearanceTab
{
public:
- LLLooksHistoryPanel();
- virtual ~LLLooksHistoryPanel();
+ LLLooksHistoryPanel();
+ virtual ~LLLooksHistoryPanel();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onSearchEdit(const std::string& string);
- /*virtual*/ void onShowOnMap();
- /*virtual*/ void onLooks();
- ///*virtual*/ void onCopySLURL();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onSearchEdit(const std::string& string);
+ /*virtual*/ void onShowOnMap();
+ /*virtual*/ void onLooks();
+ ///*virtual*/ void onCopySLURL();
- void showLooksHistory();
- void handleItemSelect(const LLSD& data);
+ void showLooksHistory();
+ void handleItemSelect(const LLSD& data);
- static void onDoubleClickItem(void* user_data);
+ static void onDoubleClickItem(void* user_data);
private:
- enum LOOKS_HISTORY_COLUMN_ORDER
- {
- LIST_ICON,
- LIST_ITEM_TITLE,
- LIST_INDEX
- };
+ enum LOOKS_HISTORY_COLUMN_ORDER
+ {
+ LIST_ICON,
+ LIST_ITEM_TITLE,
+ LIST_INDEX
+ };
- LLLooksHistory* mLooksHistory;
- LLScrollListCtrl* mHistoryItems;
- std::string mFilterSubString;
+ LLLooksHistory* mLooksHistory;
+ LLScrollListCtrl* mHistoryItems;
+ std::string mFilterSubString;
};
#endif //LL_LLPANELLOOKSHISTORY_H
diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp
index 1f4418f119..d572605635 100644
--- a/indra/newview/llmachineid.cpp
+++ b/indra/newview/llmachineid.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmachineid.cpp
* @brief retrieves unique machine ids
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "lluuid.h"
#include "llmachineid.h"
-#if LL_WINDOWS
+#if LL_WINDOWS
#define _WIN32_DCOM
#include <iostream>
#include <comdef.h>
@@ -41,7 +41,7 @@ unsigned char static_legacy_id[] = {0,0,0,0,0,0};
bool static has_static_unique_id = false;
bool static has_static_legacy_id = false;
-#if LL_WINDOWS
+#if LL_WINDOWS
class LLWMIMethods
{
@@ -104,10 +104,10 @@ void LLWMIMethods::initCOMObjects()
-1, // COM authentication
NULL, // Authentication services
NULL, // Reserved
- RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication
- RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation
+ RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication
+ RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation
NULL, // Authentication info
- EOAC_NONE, // Additional capabilities
+ EOAC_NONE, // Additional capabilities
NULL // Reserved
);
@@ -147,7 +147,7 @@ void LLWMIMethods::initCOMObjects()
0, // Locale. NULL indicates current
NULL, // Security flags.
0, // Authority (e.g. Kerberos)
- 0, // Context object
+ 0, // Context object
&pSvc // pointer to IWbemServices proxy
);
@@ -168,11 +168,11 @@ void LLWMIMethods::initCOMObjects()
pSvc, // Indicates the proxy to set
RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx
RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx
- NULL, // Server principal name
- RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx
+ NULL, // Server principal name
+ RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx
RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx
NULL, // client identity
- EOAC_NONE // proxy capabilities
+ EOAC_NONE // proxy capabilities
);
if (FAILED(mHR))
@@ -359,7 +359,7 @@ bool getSerialNumber(unsigned char *unique_id, size_t len)
kCFAllocatorDefault, 0);
IOObjectRelease(platformExpert);
}
-
+
if (serial_cf_str)
{
char buffer[64] = {0};
@@ -370,7 +370,7 @@ bool getSerialNumber(unsigned char *unique_id, size_t len)
}
S32 serial_size = serial_str.size();
-
+
if(serial_str.size() > 0)
{
S32 j = 0;
@@ -401,7 +401,7 @@ S32 LLMachineID::init()
size_t len = sizeof(static_unique_id);
memset(static_unique_id, 0, len);
S32 ret_code = 0;
-#if LL_WINDOWS
+#if LL_WINDOWS
LLWMIMethods comInit;
diff --git a/indra/newview/llmachineid.h b/indra/newview/llmachineid.h
index ec1e855031..c59bda11ce 100644
--- a/indra/newview/llmachineid.h
+++ b/indra/newview/llmachineid.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmachineid.h
* @brief retrieves unique machine ids
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,11 +28,11 @@
#define LL_LLMACHINEID_H
-class LLMachineID
+class LLMachineID
{
public:
- LLMachineID();
- virtual ~LLMachineID();
+ LLMachineID();
+ virtual ~LLMachineID();
static S32 getUniqueID(unsigned char *unique_id, size_t len);
// fallback id for windows
static S32 getLegacyID(unsigned char *unique_id, size_t len);
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index feb691520f..3f03469db9 100644
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmanip.cpp
* @brief LLManip class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,7 +49,7 @@
#include "llviewerobject.h"
#include "llviewerwindow.h"
#include "llvoavatar.h"
-#include "llworld.h" // for LLWorld::getInstance()
+#include "llworld.h" // for LLWorld::getInstance()
#include "llresmgr.h"
#include "pipeline.h"
#include "llglheaders.h"
@@ -57,39 +57,39 @@
// Local constants...
const S32 VERTICAL_OFFSET = 50;
-F32 LLManip::sHelpTextVisibleTime = 2.f;
-F32 LLManip::sHelpTextFadeTime = 2.f;
-S32 LLManip::sNumTimesHelpTextShown = 0;
-S32 LLManip::sMaxTimesShowHelpText = 5;
-F32 LLManip::sGridMaxSubdivisionLevel = 32.f;
-F32 LLManip::sGridMinSubdivisionLevel = 1.f / 32.f;
+F32 LLManip::sHelpTextVisibleTime = 2.f;
+F32 LLManip::sHelpTextFadeTime = 2.f;
+S32 LLManip::sNumTimesHelpTextShown = 0;
+S32 LLManip::sMaxTimesShowHelpText = 5;
+F32 LLManip::sGridMaxSubdivisionLevel = 32.f;
+F32 LLManip::sGridMinSubdivisionLevel = 1.f / 32.f;
LLVector2 LLManip::sTickLabelSpacing(60.f, 25.f);
//static
void LLManip::rebuild(LLViewerObject* vobj)
{
- LLDrawable* drawablep = vobj->mDrawable;
- if (drawablep && drawablep->getVOVolume())
- {
- gPipeline.markRebuild(drawablep,LLDrawable::REBUILD_VOLUME);
- drawablep->setState(LLDrawable::MOVE_UNDAMPED); // force to UNDAMPED
- drawablep->updateMove();
- LLSpatialGroup* group = drawablep->getSpatialGroup();
- if (group)
- {
- group->dirtyGeom();
- gPipeline.markRebuild(group);
- }
-
- LLViewerObject::const_child_list_t& child_list = vobj->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(), endIter = child_list.end();
- iter != endIter; ++iter)
- {
- LLViewerObject* child = *iter;
- rebuild(child);
- }
- }
+ LLDrawable* drawablep = vobj->mDrawable;
+ if (drawablep && drawablep->getVOVolume())
+ {
+ gPipeline.markRebuild(drawablep,LLDrawable::REBUILD_VOLUME);
+ drawablep->setState(LLDrawable::MOVE_UNDAMPED); // force to UNDAMPED
+ drawablep->updateMove();
+ LLSpatialGroup* group = drawablep->getSpatialGroup();
+ if (group)
+ {
+ group->dirtyGeom();
+ gPipeline.markRebuild(group);
+ }
+
+ LLViewerObject::const_child_list_t& child_list = vobj->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(), endIter = child_list.end();
+ iter != endIter; ++iter)
+ {
+ LLViewerObject* child = *iter;
+ rebuild(child);
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -97,204 +97,204 @@ void LLManip::rebuild(LLViewerObject* vobj)
LLManip::LLManip( const std::string& name, LLToolComposite* composite )
- :
- LLTool( name, composite ),
- mInSnapRegime(FALSE),
- mHighlightedPart(LL_NO_PART),
- mManipPart(LL_NO_PART)
+ :
+ LLTool( name, composite ),
+ mInSnapRegime(FALSE),
+ mHighlightedPart(LL_NO_PART),
+ mManipPart(LL_NO_PART)
{
}
void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal)
{
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
-
- if (manip >= LL_X_ARROW && manip <= LL_Z_ARROW)
- {
- LLVector3 arrow_axis;
- getManipAxis(object, manip, arrow_axis);
-
- LLVector3 cross = arrow_axis % LLViewerCamera::getInstance()->getAtAxis();
- normal = cross % arrow_axis;
- normal.normVec();
- }
- else if (manip >= LL_YZ_PLANE && manip <= LL_XY_PLANE)
- {
- switch (manip)
- {
- case LL_YZ_PLANE:
- normal = LLVector3::x_axis;
- break;
- case LL_XZ_PLANE:
- normal = LLVector3::y_axis;
- break;
- case LL_XY_PLANE:
- normal = LLVector3::z_axis;
- break;
- default:
- break;
- }
- normal.rotVec(grid_rotation);
- }
- else
- {
- normal.clearVec();
- }
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+
+ if (manip >= LL_X_ARROW && manip <= LL_Z_ARROW)
+ {
+ LLVector3 arrow_axis;
+ getManipAxis(object, manip, arrow_axis);
+
+ LLVector3 cross = arrow_axis % LLViewerCamera::getInstance()->getAtAxis();
+ normal = cross % arrow_axis;
+ normal.normVec();
+ }
+ else if (manip >= LL_YZ_PLANE && manip <= LL_XY_PLANE)
+ {
+ switch (manip)
+ {
+ case LL_YZ_PLANE:
+ normal = LLVector3::x_axis;
+ break;
+ case LL_XZ_PLANE:
+ normal = LLVector3::y_axis;
+ break;
+ case LL_XY_PLANE:
+ normal = LLVector3::z_axis;
+ break;
+ default:
+ break;
+ }
+ normal.rotVec(grid_rotation);
+ }
+ else
+ {
+ normal.clearVec();
+ }
}
BOOL LLManip::getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis)
{
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
-
- if (manip == LL_X_ARROW)
- {
- axis = LLVector3::x_axis;
- }
- else if (manip == LL_Y_ARROW)
- {
- axis = LLVector3::y_axis;
- }
- else if (manip == LL_Z_ARROW)
- {
- axis = LLVector3::z_axis;
- }
- else
- {
- return FALSE;
- }
-
- axis.rotVec( grid_rotation );
- return TRUE;
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+
+ if (manip == LL_X_ARROW)
+ {
+ axis = LLVector3::x_axis;
+ }
+ else if (manip == LL_Y_ARROW)
+ {
+ axis = LLVector3::y_axis;
+ }
+ else if (manip == LL_Z_ARROW)
+ {
+ axis = LLVector3::z_axis;
+ }
+ else
+ {
+ return FALSE;
+ }
+
+ axis.rotVec( grid_rotation );
+ return TRUE;
}
F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVector3 &translate_axis, F32 grid_scale, S32 min_pixel_spacing, F32 min_subdivisions, F32 max_subdivisions)
{
- //update current snap subdivision level
- LLVector3 cam_to_reference;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- cam_to_reference = LLVector3(1.f / gAgentCamera.mHUDCurZoom, 0.f, 0.f);
- }
- else
- {
- cam_to_reference = reference_point - LLViewerCamera::getInstance()->getOrigin();
- }
- F32 current_range = cam_to_reference.normVec();
-
- F32 projected_translation_axis_length = (translate_axis % cam_to_reference).magVec();
- F32 subdivisions = llmax(projected_translation_axis_length * grid_scale / (current_range / LLViewerCamera::getInstance()->getPixelMeterRatio() * min_pixel_spacing), 0.f);
- // figure out nearest power of 2 that subdivides grid_scale with result > min_pixel_spacing
- subdivisions = llclamp((F32)pow(2.f, llfloor(log(subdivisions) / log(2.f))), min_subdivisions, max_subdivisions);
-
- return subdivisions;
+ //update current snap subdivision level
+ LLVector3 cam_to_reference;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ cam_to_reference = LLVector3(1.f / gAgentCamera.mHUDCurZoom, 0.f, 0.f);
+ }
+ else
+ {
+ cam_to_reference = reference_point - LLViewerCamera::getInstance()->getOrigin();
+ }
+ F32 current_range = cam_to_reference.normVec();
+
+ F32 projected_translation_axis_length = (translate_axis % cam_to_reference).magVec();
+ F32 subdivisions = llmax(projected_translation_axis_length * grid_scale / (current_range / LLViewerCamera::getInstance()->getPixelMeterRatio() * min_pixel_spacing), 0.f);
+ // figure out nearest power of 2 that subdivides grid_scale with result > min_pixel_spacing
+ subdivisions = llclamp((F32)pow(2.f, llfloor(log(subdivisions) / log(2.f))), min_subdivisions, max_subdivisions);
+
+ return subdivisions;
}
void LLManip::handleSelect()
{
- mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+ mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
}
void LLManip::handleDeselect()
{
- mHighlightedPart = LL_NO_PART;
- mManipPart = LL_NO_PART;
- mObjectSelection = NULL;
+ mHighlightedPart = LL_NO_PART;
+ mManipPart = LL_NO_PART;
+ mObjectSelection = NULL;
}
LLObjectSelectionHandle LLManip::getSelection()
{
- return mObjectSelection;
+ return mObjectSelection;
}
BOOL LLManip::handleHover(S32 x, S32 y, MASK mask)
{
- // We only handle the event if mousedown started with us
- if( hasMouseCapture() )
- {
- if( mObjectSelection->isEmpty() )
- {
- // Somehow the object got deselected while we were dragging it.
- // Release the mouse
- setMouseCapture( FALSE );
- }
-
- LL_DEBUGS("UserInput") << "hover handled by LLManip (active)" << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("UserInput") << "hover handled by LLManip (inactive)" << LL_ENDL;
- }
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- return TRUE;
+ // We only handle the event if mousedown started with us
+ if( hasMouseCapture() )
+ {
+ if( mObjectSelection->isEmpty() )
+ {
+ // Somehow the object got deselected while we were dragging it.
+ // Release the mouse
+ setMouseCapture( FALSE );
+ }
+
+ LL_DEBUGS("UserInput") << "hover handled by LLManip (active)" << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLManip (inactive)" << LL_ENDL;
+ }
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ return TRUE;
}
BOOL LLManip::handleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
- if( hasMouseCapture() )
- {
- handled = TRUE;
- setMouseCapture( FALSE );
- }
- return handled;
+ BOOL handled = FALSE;
+ if( hasMouseCapture() )
+ {
+ handled = TRUE;
+ setMouseCapture( FALSE );
+ }
+ return handled;
}
void LLManip::updateGridSettings()
{
- sGridMaxSubdivisionLevel = gSavedSettings.getBOOL("GridSubUnit") ? (F32)gSavedSettings.getS32("GridSubdivision") : 1.f;
+ sGridMaxSubdivisionLevel = gSavedSettings.getBOOL("GridSubUnit") ? (F32)gSavedSettings.getS32("GridSubdivision") : 1.f;
}
BOOL LLManip::getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal)
{
- LLVector3d origin_double = gAgent.getPosGlobalFromAgent(origin);
- LLVector3d global_point;
- BOOL result = getMousePointOnPlaneGlobal(global_point, x, y, origin_double, normal);
- point = gAgent.getPosAgentFromGlobal(global_point);
- return result;
+ LLVector3d origin_double = gAgent.getPosGlobalFromAgent(origin);
+ LLVector3d global_point;
+ BOOL result = getMousePointOnPlaneGlobal(global_point, x, y, origin_double, normal);
+ point = gAgent.getPosAgentFromGlobal(global_point);
+ return result;
}
BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const
{
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- BOOL result = FALSE;
- F32 mouse_x = ((F32)x / gViewerWindow->getWorldViewWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom;
- F32 mouse_y = ((F32)y / gViewerWindow->getWorldViewHeightScaled() - 0.5f) / gAgentCamera.mHUDCurZoom;
-
- LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin);
- LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y);
- if (llabs(normal.mV[VX]) < 0.001f)
- {
- // use largish value that should be outside HUD manipulation range
- mouse_pos.mV[VX] = 10.f;
- }
- else
- {
- mouse_pos.mV[VX] = (normal * (origin_agent - mouse_pos))
- / (normal.mV[VX]);
- result = TRUE;
- }
-
- point = gAgent.getPosGlobalFromAgent(mouse_pos);
- return result;
- }
- else
- {
- return gViewerWindow->mousePointOnPlaneGlobal(
- point, x, y, origin, normal );
- }
-
- //return FALSE;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ BOOL result = FALSE;
+ F32 mouse_x = ((F32)x / gViewerWindow->getWorldViewWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom;
+ F32 mouse_y = ((F32)y / gViewerWindow->getWorldViewHeightScaled() - 0.5f) / gAgentCamera.mHUDCurZoom;
+
+ LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin);
+ LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y);
+ if (llabs(normal.mV[VX]) < 0.001f)
+ {
+ // use largish value that should be outside HUD manipulation range
+ mouse_pos.mV[VX] = 10.f;
+ }
+ else
+ {
+ mouse_pos.mV[VX] = (normal * (origin_agent - mouse_pos))
+ / (normal.mV[VX]);
+ result = TRUE;
+ }
+
+ point = gAgent.getPosGlobalFromAgent(mouse_pos);
+ return result;
+ }
+ else
+ {
+ return gViewerWindow->mousePointOnPlaneGlobal(
+ point, x, y, origin, normal );
+ }
+
+ //return FALSE;
}
// Given the line defined by mouse cursor (a1 + a_param*(a2-a1)) and the line defined by b1 + b_param*(b2-b1),
@@ -302,153 +302,153 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect
// Returns false if the two lines are parallel.
BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param )
{
- LLVector3 a1;
- LLVector3 a2;
-
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidthScaled()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom;
- F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeightScaled()) - 0.5f) / gAgentCamera.mHUDCurZoom;
- a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y);
- a2 = a1 + LLVector3(1.f, 0.f, 0.f);
- }
- else
- {
- a1 = gAgentCamera.getCameraPositionAgent();
- a2 = gAgentCamera.getCameraPositionAgent() + LLVector3(gViewerWindow->mouseDirectionGlobal(x, y));
- }
-
- BOOL parallel = TRUE;
- LLVector3 a = a2 - a1;
- LLVector3 b = b2 - b1;
-
- LLVector3 normal;
- F32 dist, denom;
- normal = (b % a) % b; // normal to plane (P) through b and (shortest line between a and b)
- normal.normVec();
- dist = b1 * normal; // distance from origin to P
-
- denom = normal * a;
- if( (denom < -F_APPROXIMATELY_ZERO) || (F_APPROXIMATELY_ZERO < denom) )
- {
- a_param = (dist - normal * a1) / denom;
- parallel = FALSE;
- }
-
- normal = (a % b) % a; // normal to plane (P) through a and (shortest line between a and b)
- normal.normVec();
- dist = a1 * normal; // distance from origin to P
- denom = normal * b;
- if( (denom < -F_APPROXIMATELY_ZERO) || (F_APPROXIMATELY_ZERO < denom) )
- {
- b_param = (dist - normal * b1) / denom;
- parallel = FALSE;
- }
-
- return parallel;
+ LLVector3 a1;
+ LLVector3 a2;
+
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidthScaled()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom;
+ F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeightScaled()) - 0.5f) / gAgentCamera.mHUDCurZoom;
+ a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y);
+ a2 = a1 + LLVector3(1.f, 0.f, 0.f);
+ }
+ else
+ {
+ a1 = gAgentCamera.getCameraPositionAgent();
+ a2 = gAgentCamera.getCameraPositionAgent() + LLVector3(gViewerWindow->mouseDirectionGlobal(x, y));
+ }
+
+ BOOL parallel = TRUE;
+ LLVector3 a = a2 - a1;
+ LLVector3 b = b2 - b1;
+
+ LLVector3 normal;
+ F32 dist, denom;
+ normal = (b % a) % b; // normal to plane (P) through b and (shortest line between a and b)
+ normal.normVec();
+ dist = b1 * normal; // distance from origin to P
+
+ denom = normal * a;
+ if( (denom < -F_APPROXIMATELY_ZERO) || (F_APPROXIMATELY_ZERO < denom) )
+ {
+ a_param = (dist - normal * a1) / denom;
+ parallel = FALSE;
+ }
+
+ normal = (a % b) % a; // normal to plane (P) through a and (shortest line between a and b)
+ normal.normVec();
+ dist = a1 * normal; // distance from origin to P
+ denom = normal * b;
+ if( (denom < -F_APPROXIMATELY_ZERO) || (F_APPROXIMATELY_ZERO < denom) )
+ {
+ b_param = (dist - normal * b1) / denom;
+ parallel = FALSE;
+ }
+
+ return parallel;
}
LLVector3 LLManip::getSavedPivotPoint() const
{
- return LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
+ return LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
}
LLVector3 LLManip::getPivotPoint()
{
- if (mObjectSelection->getFirstObject() && mObjectSelection->getObjectCount() == 1 && mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
- {
- return mObjectSelection->getFirstObject()->getPivotPositionAgent();
- }
- return LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent();
+ if (mObjectSelection->getFirstObject() && mObjectSelection->getObjectCount() == 1 && mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
+ {
+ return mObjectSelection->getFirstObject()->getPivotPositionAgent();
+ }
+ return LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent();
}
void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z)
{
- LLVector3 grid_origin;
- LLQuaternion grid_rot;
- LLVector3 grid_scale;
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rot, grid_scale);
-
- const BOOL children_ok = TRUE;
- LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok);
- if (!object)
- {
- return;
- }
-
- //LLVector3 center_agent = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent();
- LLVector3 center_agent = getPivotPoint();
-
- gGL.pushMatrix();
- {
- gGL.translatef(center_agent.mV[VX], center_agent.mV[VY], center_agent.mV[VZ]);
-
- F32 angle_radians, x, y, z;
-
- grid_rot.getAngleAxis(&angle_radians, &x, &y, &z);
- gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
-
- F32 region_size = LLWorld::getInstance()->getRegionWidthInMeters();
-
- const F32 LINE_ALPHA = 0.33f;
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLUI::setLineWidth(1.5f);
-
- if (draw_x)
- {
- gGL.color4f(1.f, 0.f, 0.f, LINE_ALPHA);
- gGL.begin(LLRender::LINES);
- gGL.vertex3f( -region_size, 0.f, 0.f );
- gGL.vertex3f( region_size, 0.f, 0.f );
- gGL.end();
- }
-
- if (draw_y)
- {
- gGL.color4f(0.f, 1.f, 0.f, LINE_ALPHA);
- gGL.begin(LLRender::LINES);
- gGL.vertex3f( 0.f, -region_size, 0.f );
- gGL.vertex3f( 0.f, region_size, 0.f );
- gGL.end();
- }
-
- if (draw_z)
- {
- gGL.color4f(0.f, 0.f, 1.f, LINE_ALPHA);
- gGL.begin(LLRender::LINES);
- gGL.vertex3f( 0.f, 0.f, -region_size );
- gGL.vertex3f( 0.f, 0.f, region_size );
- gGL.end();
- }
- LLUI::setLineWidth(1.0f);
- }
- gGL.popMatrix();
+ LLVector3 grid_origin;
+ LLQuaternion grid_rot;
+ LLVector3 grid_scale;
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rot, grid_scale);
+
+ const BOOL children_ok = TRUE;
+ LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok);
+ if (!object)
+ {
+ return;
+ }
+
+ //LLVector3 center_agent = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent();
+ LLVector3 center_agent = getPivotPoint();
+
+ gGL.pushMatrix();
+ {
+ gGL.translatef(center_agent.mV[VX], center_agent.mV[VY], center_agent.mV[VZ]);
+
+ F32 angle_radians, x, y, z;
+
+ grid_rot.getAngleAxis(&angle_radians, &x, &y, &z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
+
+ F32 region_size = LLWorld::getInstance()->getRegionWidthInMeters();
+
+ const F32 LINE_ALPHA = 0.33f;
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLUI::setLineWidth(1.5f);
+
+ if (draw_x)
+ {
+ gGL.color4f(1.f, 0.f, 0.f, LINE_ALPHA);
+ gGL.begin(LLRender::LINES);
+ gGL.vertex3f( -region_size, 0.f, 0.f );
+ gGL.vertex3f( region_size, 0.f, 0.f );
+ gGL.end();
+ }
+
+ if (draw_y)
+ {
+ gGL.color4f(0.f, 1.f, 0.f, LINE_ALPHA);
+ gGL.begin(LLRender::LINES);
+ gGL.vertex3f( 0.f, -region_size, 0.f );
+ gGL.vertex3f( 0.f, region_size, 0.f );
+ gGL.end();
+ }
+
+ if (draw_z)
+ {
+ gGL.color4f(0.f, 0.f, 1.f, LINE_ALPHA);
+ gGL.begin(LLRender::LINES);
+ gGL.vertex3f( 0.f, 0.f, -region_size );
+ gGL.vertex3f( 0.f, 0.f, region_size );
+ gGL.end();
+ }
+ LLUI::setLineWidth(1.0f);
+ }
+ gGL.popMatrix();
}
-void LLManip::renderXYZ(const LLVector3 &vec)
+void LLManip::renderXYZ(const LLVector3 &vec)
{
- const S32 PAD = 10;
- std::string feedback_string;
- S32 window_center_x = gViewerWindow->getWorldViewRectScaled().getWidth() / 2;
- S32 window_center_y = gViewerWindow->getWorldViewRectScaled().getHeight() / 2;
- S32 vertical_offset = window_center_y - VERTICAL_OFFSET;
-
-
- gGL.pushMatrix();
- {
- LLUIImagePtr imagep = LLUI::getUIImage("Rounded_Square");
- gViewerWindow->setup2DRender();
- const LLVector2& display_scale = gViewerWindow->getDisplayScale();
- gGL.color4f(0.f, 0.f, 0.f, 0.7f);
-
- imagep->draw(
- (window_center_x - 115) * display_scale.mV[VX],
- (window_center_y + vertical_offset - PAD) * display_scale.mV[VY],
- 235 * display_scale.mV[VX],
- (PAD * 2 + 10) * display_scale.mV[VY],
- LLColor4(0.f, 0.f, 0.f, 0.7f) );
+ const S32 PAD = 10;
+ std::string feedback_string;
+ S32 window_center_x = gViewerWindow->getWorldViewRectScaled().getWidth() / 2;
+ S32 window_center_y = gViewerWindow->getWorldViewRectScaled().getHeight() / 2;
+ S32 vertical_offset = window_center_y - VERTICAL_OFFSET;
+
+
+ gGL.pushMatrix();
+ {
+ LLUIImagePtr imagep = LLUI::getUIImage("Rounded_Square");
+ gViewerWindow->setup2DRender();
+ const LLVector2& display_scale = gViewerWindow->getDisplayScale();
+ gGL.color4f(0.f, 0.f, 0.f, 0.7f);
+
+ imagep->draw(
+ (window_center_x - 115) * display_scale.mV[VX],
+ (window_center_y + vertical_offset - PAD) * display_scale.mV[VY],
+ 235 * display_scale.mV[VX],
+ (PAD * 2 + 10) * display_scale.mV[VY],
+ LLColor4(0.f, 0.f, 0.f, 0.7f) );
LLFontGL* font = LLFontGL::getFontSansSerif();
LLLocale locale(LLLocale::USER_LOCALE);
@@ -494,129 +494,129 @@ void LLManip::renderXYZ(const LLVector3 &vec)
void LLManip::renderTickText(const LLVector3& pos, const std::string& text, const LLColor4 &color)
{
- const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
-
- BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- LLVector3 render_pos = pos;
- if (hud_selection)
- {
- F32 zoom_amt = gAgentCamera.mHUDCurZoom;
- F32 inv_zoom_amt = 1.f / zoom_amt;
- // scale text back up to counter-act zoom level
- render_pos = pos * zoom_amt;
- gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
- }
-
- // render shadow first
- LLColor4 shadow_color = LLColor4::black;
- shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f;
- gViewerWindow->setup3DViewport(1, -1);
- hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
- gViewerWindow->setup3DViewport();
- hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
-
- gGL.popMatrix();
+ const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
+
+ BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ LLVector3 render_pos = pos;
+ if (hud_selection)
+ {
+ F32 zoom_amt = gAgentCamera.mHUDCurZoom;
+ F32 inv_zoom_amt = 1.f / zoom_amt;
+ // scale text back up to counter-act zoom level
+ render_pos = pos * zoom_amt;
+ gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
+ }
+
+ // render shadow first
+ LLColor4 shadow_color = LLColor4::black;
+ shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f;
+ gViewerWindow->setup3DViewport(1, -1);
+ hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
+ gViewerWindow->setup3DViewport();
+ hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
+
+ gGL.popMatrix();
}
void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color)
{
- LLLocale locale(LLLocale::USER_LOCALE);
-
- const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
- const LLFontGL* small_fontp = LLFontGL::getFontSansSerifSmall();
-
- std::string val_string;
- std::string fraction_string;
- F32 val_to_print = ll_round(value, 0.001f);
- S32 fractional_portion = ll_round(fmodf(llabs(val_to_print), 1.f) * 100.f);
- if (val_to_print < 0.f)
- {
- if (fractional_portion == 0)
- {
- val_string = llformat("-%d%s", lltrunc(llabs(val_to_print)), suffix.c_str());
- }
- else
- {
- val_string = llformat("-%d", lltrunc(llabs(val_to_print)));
- }
- }
- else
- {
- if (fractional_portion == 0)
- {
- val_string = llformat("%d%s", lltrunc(llabs(val_to_print)), suffix.c_str());
- }
- else
- {
- val_string = llformat("%d", lltrunc(val_to_print));
- }
- }
-
- BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- {
- LLVector3 render_pos = pos;
- if (hud_selection)
- {
- F32 zoom_amt = gAgentCamera.mHUDCurZoom;
- F32 inv_zoom_amt = 1.f / zoom_amt;
- // scale text back up to counter-act zoom level
- render_pos = pos * zoom_amt;
- gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
- }
-
- LLColor4 shadow_color = LLColor4::black;
- shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f;
-
- if (fractional_portion != 0)
- {
- fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str());
-
- hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
- hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, 1.f, 3.f, color, hud_selection);
- }
- else
- {
- hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
- }
- }
- gGL.popMatrix();
+ LLLocale locale(LLLocale::USER_LOCALE);
+
+ const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
+ const LLFontGL* small_fontp = LLFontGL::getFontSansSerifSmall();
+
+ std::string val_string;
+ std::string fraction_string;
+ F32 val_to_print = ll_round(value, 0.001f);
+ S32 fractional_portion = ll_round(fmodf(llabs(val_to_print), 1.f) * 100.f);
+ if (val_to_print < 0.f)
+ {
+ if (fractional_portion == 0)
+ {
+ val_string = llformat("-%d%s", lltrunc(llabs(val_to_print)), suffix.c_str());
+ }
+ else
+ {
+ val_string = llformat("-%d", lltrunc(llabs(val_to_print)));
+ }
+ }
+ else
+ {
+ if (fractional_portion == 0)
+ {
+ val_string = llformat("%d%s", lltrunc(llabs(val_to_print)), suffix.c_str());
+ }
+ else
+ {
+ val_string = llformat("%d", lltrunc(val_to_print));
+ }
+ }
+
+ BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ {
+ LLVector3 render_pos = pos;
+ if (hud_selection)
+ {
+ F32 zoom_amt = gAgentCamera.mHUDCurZoom;
+ F32 inv_zoom_amt = 1.f / zoom_amt;
+ // scale text back up to counter-act zoom level
+ render_pos = pos * zoom_amt;
+ gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
+ }
+
+ LLColor4 shadow_color = LLColor4::black;
+ shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f;
+
+ if (fractional_portion != 0)
+ {
+ fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str());
+
+ hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
+ hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, 1.f, 3.f, color, hud_selection);
+ }
+ else
+ {
+ hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
+ }
+ }
+ gGL.popMatrix();
}
LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass)
{
- static LLColor4 grid_color_fg = LLUIColorTable::instance().getColor("GridlineColor");
- static LLColor4 grid_color_bg = LLUIColorTable::instance().getColor("GridlineBGColor");
- static LLColor4 grid_color_shadow = LLUIColorTable::instance().getColor("GridlineShadowColor");
-
- LLColor4 line_color;
- F32 line_alpha = gSavedSettings.getF32("GridOpacity");
-
- switch(pass)
- {
- case 0:
- // shadow
- gViewerWindow->setup3DViewport(1, -1);
- line_color = grid_color_shadow;
- line_color.mV[VALPHA] *= line_alpha;
- LLUI::setLineWidth(2.f);
- break;
- case 1:
- // hidden lines
- gViewerWindow->setup3DViewport();
- line_color = grid_color_bg;
- line_color.mV[VALPHA] *= line_alpha;
- LLUI::setLineWidth(1.f);
- break;
- case 2:
- // visible lines
- line_color = grid_color_fg;
- line_color.mV[VALPHA] *= line_alpha;
- break;
- }
-
- return line_color;
+ static LLColor4 grid_color_fg = LLUIColorTable::instance().getColor("GridlineColor");
+ static LLColor4 grid_color_bg = LLUIColorTable::instance().getColor("GridlineBGColor");
+ static LLColor4 grid_color_shadow = LLUIColorTable::instance().getColor("GridlineShadowColor");
+
+ LLColor4 line_color;
+ F32 line_alpha = gSavedSettings.getF32("GridOpacity");
+
+ switch(pass)
+ {
+ case 0:
+ // shadow
+ gViewerWindow->setup3DViewport(1, -1);
+ line_color = grid_color_shadow;
+ line_color.mV[VALPHA] *= line_alpha;
+ LLUI::setLineWidth(2.f);
+ break;
+ case 1:
+ // hidden lines
+ gViewerWindow->setup3DViewport();
+ line_color = grid_color_bg;
+ line_color.mV[VALPHA] *= line_alpha;
+ LLUI::setLineWidth(1.f);
+ break;
+ case 2:
+ // visible lines
+ line_color = grid_color_fg;
+ line_color.mV[VALPHA] *= line_alpha;
+ break;
+ }
+
+ return line_color;
}
diff --git a/indra/newview/llmanip.h b/indra/newview/llmanip.h
index 69881e8589..82f85395ea 100644
--- a/indra/newview/llmanip.h
+++ b/indra/newview/llmanip.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmanip.h
* @brief LLManip class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,123 +42,123 @@ const S32 MIN_DIVISION_PIXEL_WIDTH = 3;
class LLManip : public LLTool
{
public:
- typedef enum e_manip_part
- {
- LL_NO_PART = 0,
-
- // Translation
- LL_X_ARROW,
- LL_Y_ARROW,
- LL_Z_ARROW,
-
- LL_YZ_PLANE,
- LL_XZ_PLANE,
- LL_XY_PLANE,
-
- // Scale
- LL_CORNER_NNN,
- LL_CORNER_NNP,
- LL_CORNER_NPN,
- LL_CORNER_NPP,
- LL_CORNER_PNN,
- LL_CORNER_PNP,
- LL_CORNER_PPN,
- LL_CORNER_PPP,
-
- // Faces
- LL_FACE_POSZ,
- LL_FACE_POSX,
- LL_FACE_POSY,
- LL_FACE_NEGX,
- LL_FACE_NEGY,
- LL_FACE_NEGZ,
-
- // Edges
- LL_EDGE_NEGX_NEGY,
- LL_EDGE_NEGX_POSY,
- LL_EDGE_POSX_NEGY,
- LL_EDGE_POSX_POSY,
-
- LL_EDGE_NEGY_NEGZ,
- LL_EDGE_NEGY_POSZ,
- LL_EDGE_POSY_NEGZ,
- LL_EDGE_POSY_POSZ,
-
- LL_EDGE_NEGZ_NEGX,
- LL_EDGE_NEGZ_POSX,
- LL_EDGE_POSZ_NEGX,
- LL_EDGE_POSZ_POSX,
-
- // Rotation Manip
- LL_ROT_GENERAL,
- LL_ROT_X,
- LL_ROT_Y,
- LL_ROT_Z,
- LL_ROT_ROLL
- } EManipPart;
-
- // For use in loops and range checking.
- typedef enum e_select_part_ranges
- {
- LL_ARROW_MIN = LL_X_ARROW,
- LL_ARROW_MAX = LL_Z_ARROW,
-
- LL_CORNER_MIN = LL_CORNER_NNN,
- LL_CORNER_MAX = LL_CORNER_PPP,
-
- LL_FACE_MIN = LL_FACE_POSZ,
- LL_FACE_MAX = LL_FACE_NEGZ,
-
- LL_EDGE_MIN = LL_EDGE_NEGX_NEGY,
- LL_EDGE_MAX = LL_EDGE_POSZ_POSX
- } EManipPartRanges;
+ typedef enum e_manip_part
+ {
+ LL_NO_PART = 0,
+
+ // Translation
+ LL_X_ARROW,
+ LL_Y_ARROW,
+ LL_Z_ARROW,
+
+ LL_YZ_PLANE,
+ LL_XZ_PLANE,
+ LL_XY_PLANE,
+
+ // Scale
+ LL_CORNER_NNN,
+ LL_CORNER_NNP,
+ LL_CORNER_NPN,
+ LL_CORNER_NPP,
+ LL_CORNER_PNN,
+ LL_CORNER_PNP,
+ LL_CORNER_PPN,
+ LL_CORNER_PPP,
+
+ // Faces
+ LL_FACE_POSZ,
+ LL_FACE_POSX,
+ LL_FACE_POSY,
+ LL_FACE_NEGX,
+ LL_FACE_NEGY,
+ LL_FACE_NEGZ,
+
+ // Edges
+ LL_EDGE_NEGX_NEGY,
+ LL_EDGE_NEGX_POSY,
+ LL_EDGE_POSX_NEGY,
+ LL_EDGE_POSX_POSY,
+
+ LL_EDGE_NEGY_NEGZ,
+ LL_EDGE_NEGY_POSZ,
+ LL_EDGE_POSY_NEGZ,
+ LL_EDGE_POSY_POSZ,
+
+ LL_EDGE_NEGZ_NEGX,
+ LL_EDGE_NEGZ_POSX,
+ LL_EDGE_POSZ_NEGX,
+ LL_EDGE_POSZ_POSX,
+
+ // Rotation Manip
+ LL_ROT_GENERAL,
+ LL_ROT_X,
+ LL_ROT_Y,
+ LL_ROT_Z,
+ LL_ROT_ROLL
+ } EManipPart;
+
+ // For use in loops and range checking.
+ typedef enum e_select_part_ranges
+ {
+ LL_ARROW_MIN = LL_X_ARROW,
+ LL_ARROW_MAX = LL_Z_ARROW,
+
+ LL_CORNER_MIN = LL_CORNER_NNN,
+ LL_CORNER_MAX = LL_CORNER_PPP,
+
+ LL_FACE_MIN = LL_FACE_POSZ,
+ LL_FACE_MAX = LL_FACE_NEGZ,
+
+ LL_EDGE_MIN = LL_EDGE_NEGX_NEGY,
+ LL_EDGE_MAX = LL_EDGE_POSZ_POSX
+ } EManipPartRanges;
public:
- static void rebuild(LLViewerObject* vobj);
-
- LLManip( const std::string& name, LLToolComposite* composite );
+ static void rebuild(LLViewerObject* vobj);
+
+ LLManip( const std::string& name, LLToolComposite* composite );
+
+ virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask) = 0;
+ void renderGuidelines(BOOL draw_x = TRUE, BOOL draw_y = TRUE, BOOL draw_z = TRUE);
+ static void renderXYZ(const LLVector3 &vec);
- virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask) = 0;
- void renderGuidelines(BOOL draw_x = TRUE, BOOL draw_y = TRUE, BOOL draw_z = TRUE);
- static void renderXYZ(const LLVector3 &vec);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual void highlightManipulators(S32 x, S32 y) = 0;
+ virtual void handleSelect();
+ virtual void handleDeselect();
+ virtual BOOL canAffectSelection() = 0;
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual void highlightManipulators(S32 x, S32 y) = 0;
- virtual void handleSelect();
- virtual void handleDeselect();
- virtual BOOL canAffectSelection() = 0;
+ EManipPart getHighlightedPart() { return mHighlightedPart; }
- EManipPart getHighlightedPart() { return mHighlightedPart; }
-
- LLSafeHandle<LLObjectSelection> getSelection();
+ LLSafeHandle<LLObjectSelection> getSelection();
protected:
- LLVector3 getSavedPivotPoint() const;
- LLVector3 getPivotPoint();
- void getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal);
- BOOL getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis);
- F32 getSubdivisionLevel(const LLVector3 &reference_point, const LLVector3 &translate_axis, F32 grid_scale, S32 min_pixel_spacing = MIN_DIVISION_PIXEL_WIDTH, F32 min_subdivisions = sGridMinSubdivisionLevel, F32 max_subdivisions = sGridMaxSubdivisionLevel);
- void renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color);
- void renderTickText(const LLVector3& pos, const std::string& suffix, const LLColor4 &color);
- void updateGridSettings();
- BOOL getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const;
- BOOL getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal);
- BOOL nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param );
- LLColor4 setupSnapGuideRenderPass(S32 pass);
+ LLVector3 getSavedPivotPoint() const;
+ LLVector3 getPivotPoint();
+ void getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal);
+ BOOL getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis);
+ F32 getSubdivisionLevel(const LLVector3 &reference_point, const LLVector3 &translate_axis, F32 grid_scale, S32 min_pixel_spacing = MIN_DIVISION_PIXEL_WIDTH, F32 min_subdivisions = sGridMinSubdivisionLevel, F32 max_subdivisions = sGridMaxSubdivisionLevel);
+ void renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color);
+ void renderTickText(const LLVector3& pos, const std::string& suffix, const LLColor4 &color);
+ void updateGridSettings();
+ BOOL getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const;
+ BOOL getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal);
+ BOOL nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param );
+ LLColor4 setupSnapGuideRenderPass(S32 pass);
protected:
- LLFrameTimer mHelpTextTimer;
- BOOL mInSnapRegime;
- LLSafeHandle<LLObjectSelection> mObjectSelection;
- EManipPart mHighlightedPart;
- EManipPart mManipPart;
-
- static F32 sHelpTextVisibleTime;
- static F32 sHelpTextFadeTime;
- static S32 sNumTimesHelpTextShown;
- static S32 sMaxTimesShowHelpText;
- static F32 sGridMaxSubdivisionLevel;
- static F32 sGridMinSubdivisionLevel;
- static LLVector2 sTickLabelSpacing;
+ LLFrameTimer mHelpTextTimer;
+ BOOL mInSnapRegime;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
+ EManipPart mHighlightedPart;
+ EManipPart mManipPart;
+
+ static F32 sHelpTextVisibleTime;
+ static F32 sHelpTextFadeTime;
+ static S32 sNumTimesHelpTextShown;
+ static S32 sMaxTimesShowHelpText;
+ static F32 sGridMaxSubdivisionLevel;
+ static F32 sGridMinSubdivisionLevel;
+ static LLVector2 sTickLabelSpacing;
};
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 7f37f98568..f9a2c79679 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmaniprotate.cpp
* @brief LLManipRotate class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -63,7 +63,7 @@
#include "llvoavatarself.h"
#include "llhudrender.h"
-const F32 RADIUS_PIXELS = 100.f; // size in screen space
+const F32 RADIUS_PIXELS = 100.f; // size in screen space
const F32 SQ_RADIUS = RADIUS_PIXELS * RADIUS_PIXELS;
const F32 WIDTH_PIXELS = 8;
const S32 CIRCLE_STEPS = 100;
@@ -83,523 +83,523 @@ const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f;
extern void handle_reset_rotation(void*); // in LLViewerWindow
LLManipRotate::LLManipRotate( LLToolComposite* composite )
-: LLManip( std::string("Rotate"), composite ),
- mRotationCenter(),
- mCenterScreen(),
- mRotation(),
- mMouseDown(),
- mMouseCur(),
- mRadiusMeters(0.f),
- mCenterToCam(),
- mCenterToCamNorm(),
- mCenterToCamMag(0.f),
- mCenterToProfilePlane(),
- mCenterToProfilePlaneMag(0.f),
- mSendUpdateOnMouseUp( FALSE ),
- mSmoothRotate( FALSE ),
- mCamEdgeOn(FALSE),
- mManipulatorScales(1.f, 1.f, 1.f, 1.f)
+: LLManip( std::string("Rotate"), composite ),
+ mRotationCenter(),
+ mCenterScreen(),
+ mRotation(),
+ mMouseDown(),
+ mMouseCur(),
+ mRadiusMeters(0.f),
+ mCenterToCam(),
+ mCenterToCamNorm(),
+ mCenterToCamMag(0.f),
+ mCenterToProfilePlane(),
+ mCenterToProfilePlaneMag(0.f),
+ mSendUpdateOnMouseUp( FALSE ),
+ mSmoothRotate( FALSE ),
+ mCamEdgeOn(FALSE),
+ mManipulatorScales(1.f, 1.f, 1.f, 1.f)
{ }
void LLManipRotate::handleSelect()
{
- // *FIX: put this in mouseDown?
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ // *FIX: put this in mouseDown?
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
if (gFloaterTools)
{
gFloaterTools->setStatusText("rotate");
}
- LLManip::handleSelect();
+ LLManip::handleSelect();
}
void LLManipRotate::render()
{
- LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
- LLGLDepthTest gls_depth(GL_TRUE);
- LLGLEnable gl_blend(GL_BLEND);
-
- // You can rotate if you can move
- LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE);
- if( !first_object )
- {
- return;
- }
-
- if( !updateVisiblity() )
- {
- return;
- }
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- F32 zoom = gAgentCamera.mHUDCurZoom;
- gGL.scalef(zoom, zoom, zoom);
- }
-
-
- LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
-
- LLColor4 highlight_outside( 1.f, 1.f, 0.f, 1.f );
- LLColor4 highlight_inside( 0.7f, 0.7f, 0.f, 0.5f );
- F32 width_meters = WIDTH_PIXELS * mRadiusMeters / RADIUS_PIXELS;
-
- gGL.pushMatrix();
- {
-
- // are we in the middle of a constrained drag?
- if (mManipPart >= LL_ROT_X && mManipPart <= LL_ROT_Z)
- {
- renderSnapGuides();
- }
- else
- {
- gDebugProgram.bind();
-
- LLGLEnable cull_face(GL_CULL_FACE);
- LLGLDepthTest gls_depth(GL_FALSE);
- gGL.pushMatrix();
- {
- // Draw "sphere" (intersection of sphere with tangent cone that has apex at camera)
- gGL.translatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] );
- gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
-
- // Inverse change of basis vectors
- LLVector3 forward = mCenterToCamNorm;
- LLVector3 left = gAgent.getUpAxis() % forward;
- left.normVec();
- LLVector3 up = forward % left;
-
- LLVector4 a(-forward);
- a.mV[3] = 0;
- LLVector4 b(up);
- b.mV[3] = 0;
- LLVector4 c(left);
- c.mV[3] = 0;
- LLMatrix4 mat;
- mat.initRows(a, b, c, LLVector4(0.f, 0.f, 0.f, 1.f));
-
- gGL.multMatrix( &mat.mMatrix[0][0] );
-
- gGL.rotatef( -90, 0.f, 1.f, 0.f);
- LLColor4 color;
- if (mManipPart == LL_ROT_ROLL || mHighlightedPart == LL_ROT_ROLL)
- {
- color.setVec(0.8f, 0.8f, 0.8f, 0.8f);
- gGL.scalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]);
- }
- else
- {
- color.setVec( 0.7f, 0.7f, 0.7f, 0.6f );
- }
- gGL.diffuseColor4fv(color.mV);
- gl_washer_2d(mRadiusMeters + width_meters, mRadiusMeters, CIRCLE_STEPS, color, color);
-
-
- if (mManipPart == LL_NO_PART)
- {
- gGL.color4f( 0.7f, 0.7f, 0.7f, 0.3f );
- gGL.diffuseColor4f(0.7f, 0.7f, 0.7f, 0.3f);
- gl_circle_2d( 0, 0, mRadiusMeters, CIRCLE_STEPS, TRUE );
- }
-
- gGL.flush();
- }
- gGL.popMatrix();
-
- gUIProgram.bind();
- }
-
- gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
-
- LLQuaternion rot;
- F32 angle_radians, x, y, z;
-
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
-
- grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
- gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
-
-
- gDebugProgram.bind();
-
- if (mManipPart == LL_ROT_Z)
- {
- mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- gGL.pushMatrix();
- {
- // selected part
- gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
- renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f) , LLColor4( 0.f, 0.f, 1.f, 0.3f ));
- }
- gGL.popMatrix();
- }
- else if (mManipPart == LL_ROT_Y)
- {
- mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- gGL.pushMatrix();
- {
- gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
- gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
- renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f), LLColor4( 0.f, 1.f, 0.f, 0.3f));
- }
- gGL.popMatrix();
- }
- else if (mManipPart == LL_ROT_X)
- {
- mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- gGL.pushMatrix();
- {
- gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
- gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
- renderActiveRing( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f), LLColor4( 1.f, 0.f, 0.f, 0.3f));
- }
- gGL.popMatrix();
- }
- else if (mManipPart == LL_ROT_ROLL)
- {
- mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- }
- else if (mManipPart == LL_NO_PART)
- {
- if (mHighlightedPart == LL_NO_PART)
- {
- mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- }
-
- LLGLEnable cull_face(GL_CULL_FACE);
- LLGLEnable clip_plane0(GL_CLIP_PLANE0);
- LLGLDepthTest gls_depth(GL_FALSE);
- //LLGLDisable gls_stencil(GL_STENCIL_TEST);
-
- // First pass: centers. Second pass: sides.
- for( S32 i=0; i<2; i++ )
- {
-
- gGL.pushMatrix();
- {
- if (mHighlightedPart == LL_ROT_Z)
- {
- mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
- // hovering over part
- gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f ), LLColor4( 0.f, 0.f, 1.f, 0.5f ), CIRCLE_STEPS, i);
- }
- else
- {
- // default
- gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 0.8f, 0.8f ), LLColor4( 0.f, 0.f, 0.8f, 0.4f ), CIRCLE_STEPS, i);
- }
- }
- gGL.popMatrix();
-
- gGL.pushMatrix();
- {
- gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
- if (mHighlightedPart == LL_ROT_Y)
- {
- mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
- // hovering over part
- gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f ), LLColor4( 0.f, 1.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
- }
- else
- {
- // default
- gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.8f, 0.f, 0.8f ), LLColor4( 0.f, 0.8f, 0.f, 0.4f ), CIRCLE_STEPS, i);
- }
- }
- gGL.popMatrix();
-
- gGL.pushMatrix();
- {
- gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
- if (mHighlightedPart == LL_ROT_X)
- {
- mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
-
- // hovering over part
- gl_ring( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f ), LLColor4( 1.f, 0.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
- }
- else
- {
- // default
- gl_ring( mRadiusMeters, width_meters, LLColor4( 0.8f, 0.f, 0.f, 0.8f ), LLColor4( 0.8f, 0.f, 0.f, 0.4f ), CIRCLE_STEPS, i);
- }
- }
- gGL.popMatrix();
-
- if (mHighlightedPart == LL_ROT_ROLL)
- {
- mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- }
-
- }
-
- }
-
- gUIProgram.bind();
- }
- gGL.popMatrix();
- gGL.popMatrix();
-
-
- LLVector3 euler_angles;
- LLQuaternion object_rot = first_object->getRotationEdit();
- object_rot.getEulerAngles(&(euler_angles.mV[VX]), &(euler_angles.mV[VY]), &(euler_angles.mV[VZ]));
- euler_angles *= RAD_TO_DEG;
- euler_angles.mV[VX] = ll_round(fmodf(euler_angles.mV[VX] + 360.f, 360.f), 0.05f);
- euler_angles.mV[VY] = ll_round(fmodf(euler_angles.mV[VY] + 360.f, 360.f), 0.05f);
- euler_angles.mV[VZ] = ll_round(fmodf(euler_angles.mV[VZ] + 360.f, 360.f), 0.05f);
-
- renderXYZ(euler_angles);
+ LLGLSUIDefault gls_ui;
+ gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
+ LLGLDepthTest gls_depth(GL_TRUE);
+ LLGLEnable gl_blend(GL_BLEND);
+
+ // You can rotate if you can move
+ LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE);
+ if( !first_object )
+ {
+ return;
+ }
+
+ if( !updateVisiblity() )
+ {
+ return;
+ }
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ F32 zoom = gAgentCamera.mHUDCurZoom;
+ gGL.scalef(zoom, zoom, zoom);
+ }
+
+
+ LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
+
+ LLColor4 highlight_outside( 1.f, 1.f, 0.f, 1.f );
+ LLColor4 highlight_inside( 0.7f, 0.7f, 0.f, 0.5f );
+ F32 width_meters = WIDTH_PIXELS * mRadiusMeters / RADIUS_PIXELS;
+
+ gGL.pushMatrix();
+ {
+
+ // are we in the middle of a constrained drag?
+ if (mManipPart >= LL_ROT_X && mManipPart <= LL_ROT_Z)
+ {
+ renderSnapGuides();
+ }
+ else
+ {
+ gDebugProgram.bind();
+
+ LLGLEnable cull_face(GL_CULL_FACE);
+ LLGLDepthTest gls_depth(GL_FALSE);
+ gGL.pushMatrix();
+ {
+ // Draw "sphere" (intersection of sphere with tangent cone that has apex at camera)
+ gGL.translatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] );
+ gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
+
+ // Inverse change of basis vectors
+ LLVector3 forward = mCenterToCamNorm;
+ LLVector3 left = gAgent.getUpAxis() % forward;
+ left.normVec();
+ LLVector3 up = forward % left;
+
+ LLVector4 a(-forward);
+ a.mV[3] = 0;
+ LLVector4 b(up);
+ b.mV[3] = 0;
+ LLVector4 c(left);
+ c.mV[3] = 0;
+ LLMatrix4 mat;
+ mat.initRows(a, b, c, LLVector4(0.f, 0.f, 0.f, 1.f));
+
+ gGL.multMatrix( &mat.mMatrix[0][0] );
+
+ gGL.rotatef( -90, 0.f, 1.f, 0.f);
+ LLColor4 color;
+ if (mManipPart == LL_ROT_ROLL || mHighlightedPart == LL_ROT_ROLL)
+ {
+ color.setVec(0.8f, 0.8f, 0.8f, 0.8f);
+ gGL.scalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]);
+ }
+ else
+ {
+ color.setVec( 0.7f, 0.7f, 0.7f, 0.6f );
+ }
+ gGL.diffuseColor4fv(color.mV);
+ gl_washer_2d(mRadiusMeters + width_meters, mRadiusMeters, CIRCLE_STEPS, color, color);
+
+
+ if (mManipPart == LL_NO_PART)
+ {
+ gGL.color4f( 0.7f, 0.7f, 0.7f, 0.3f );
+ gGL.diffuseColor4f(0.7f, 0.7f, 0.7f, 0.3f);
+ gl_circle_2d( 0, 0, mRadiusMeters, CIRCLE_STEPS, TRUE );
+ }
+
+ gGL.flush();
+ }
+ gGL.popMatrix();
+
+ gUIProgram.bind();
+ }
+
+ gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
+
+ LLQuaternion rot;
+ F32 angle_radians, x, y, z;
+
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+
+ grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
+
+
+ gDebugProgram.bind();
+
+ if (mManipPart == LL_ROT_Z)
+ {
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ gGL.pushMatrix();
+ {
+ // selected part
+ gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
+ renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f) , LLColor4( 0.f, 0.f, 1.f, 0.3f ));
+ }
+ gGL.popMatrix();
+ }
+ else if (mManipPart == LL_ROT_Y)
+ {
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ gGL.pushMatrix();
+ {
+ gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
+ gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
+ renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f), LLColor4( 0.f, 1.f, 0.f, 0.3f));
+ }
+ gGL.popMatrix();
+ }
+ else if (mManipPart == LL_ROT_X)
+ {
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ gGL.pushMatrix();
+ {
+ gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
+ gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
+ renderActiveRing( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f), LLColor4( 1.f, 0.f, 0.f, 0.3f));
+ }
+ gGL.popMatrix();
+ }
+ else if (mManipPart == LL_ROT_ROLL)
+ {
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ }
+ else if (mManipPart == LL_NO_PART)
+ {
+ if (mHighlightedPart == LL_NO_PART)
+ {
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ }
+
+ LLGLEnable cull_face(GL_CULL_FACE);
+ LLGLEnable clip_plane0(GL_CLIP_PLANE0);
+ LLGLDepthTest gls_depth(GL_FALSE);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
+
+ // First pass: centers. Second pass: sides.
+ for( S32 i=0; i<2; i++ )
+ {
+
+ gGL.pushMatrix();
+ {
+ if (mHighlightedPart == LL_ROT_Z)
+ {
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
+ // hovering over part
+ gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f ), LLColor4( 0.f, 0.f, 1.f, 0.5f ), CIRCLE_STEPS, i);
+ }
+ else
+ {
+ // default
+ gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 0.8f, 0.8f ), LLColor4( 0.f, 0.f, 0.8f, 0.4f ), CIRCLE_STEPS, i);
+ }
+ }
+ gGL.popMatrix();
+
+ gGL.pushMatrix();
+ {
+ gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
+ if (mHighlightedPart == LL_ROT_Y)
+ {
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
+ // hovering over part
+ gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f ), LLColor4( 0.f, 1.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
+ }
+ else
+ {
+ // default
+ gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.8f, 0.f, 0.8f ), LLColor4( 0.f, 0.8f, 0.f, 0.4f ), CIRCLE_STEPS, i);
+ }
+ }
+ gGL.popMatrix();
+
+ gGL.pushMatrix();
+ {
+ gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
+ if (mHighlightedPart == LL_ROT_X)
+ {
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
+
+ // hovering over part
+ gl_ring( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f ), LLColor4( 1.f, 0.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
+ }
+ else
+ {
+ // default
+ gl_ring( mRadiusMeters, width_meters, LLColor4( 0.8f, 0.f, 0.f, 0.8f ), LLColor4( 0.8f, 0.f, 0.f, 0.4f ), CIRCLE_STEPS, i);
+ }
+ }
+ gGL.popMatrix();
+
+ if (mHighlightedPart == LL_ROT_ROLL)
+ {
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ }
+
+ }
+
+ }
+
+ gUIProgram.bind();
+ }
+ gGL.popMatrix();
+ gGL.popMatrix();
+
+
+ LLVector3 euler_angles;
+ LLQuaternion object_rot = first_object->getRotationEdit();
+ object_rot.getEulerAngles(&(euler_angles.mV[VX]), &(euler_angles.mV[VY]), &(euler_angles.mV[VZ]));
+ euler_angles *= RAD_TO_DEG;
+ euler_angles.mV[VX] = ll_round(fmodf(euler_angles.mV[VX] + 360.f, 360.f), 0.05f);
+ euler_angles.mV[VY] = ll_round(fmodf(euler_angles.mV[VY] + 360.f, 360.f), 0.05f);
+ euler_angles.mV[VZ] = ll_round(fmodf(euler_angles.mV[VZ] + 360.f, 360.f), 0.05f);
+
+ renderXYZ(euler_angles);
}
BOOL LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
-
- LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE);
- if( first_object )
- {
- if( mHighlightedPart != LL_NO_PART )
- {
- handled = handleMouseDownOnPart( x, y, mask );
- }
- }
-
- return handled;
+ BOOL handled = FALSE;
+
+ LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE);
+ if( first_object )
+ {
+ if( mHighlightedPart != LL_NO_PART )
+ {
+ handled = handleMouseDownOnPart( x, y, mask );
+ }
+ }
+
+ return handled;
}
// Assumes that one of the parts of the manipulator was hit.
BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
{
- BOOL can_rotate = canAffectSelection();
- if (!can_rotate)
- {
- return FALSE;
- }
-
- highlightManipulators(x, y);
- S32 hit_part = mHighlightedPart;
- // we just started a drag, so save initial object positions
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_ROTATE);
-
- // save selection center
- mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() ); //LLSelectMgr::getInstance()->getSelectionCenterGlobal();
-
- mManipPart = (EManipPart)hit_part;
- LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
-
- if( mManipPart == LL_ROT_GENERAL)
- {
- mMouseDown = intersectMouseWithSphere( x, y, center, mRadiusMeters);
- }
- else
- {
- // Project onto the plane of the ring
- LLVector3 axis = getConstraintAxis();
-
- F32 axis_onto_cam = llabs( axis * mCenterToCamNorm );
- const F32 AXIS_ONTO_CAM_TOL = cos( 85.f * DEG_TO_RAD );
- if( axis_onto_cam < AXIS_ONTO_CAM_TOL )
- {
- LLVector3 up_from_axis = mCenterToCamNorm % axis;
- up_from_axis.normVec();
- LLVector3 cur_intersection;
- getMousePointOnPlaneAgent(cur_intersection, x, y, center, mCenterToCam);
- cur_intersection -= center;
- mMouseDown = projected_vec(cur_intersection, up_from_axis);
- F32 mouse_depth = SNAP_GUIDE_INNER_RADIUS * mRadiusMeters;
- F32 mouse_dist_sqrd = mMouseDown.magVecSquared();
- if (mouse_dist_sqrd > 0.0001f)
- {
- mouse_depth = sqrtf((SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) * (SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) -
- mouse_dist_sqrd);
- }
- LLVector3 projected_center_to_cam = mCenterToCamNorm - projected_vec(mCenterToCamNorm, axis);
- mMouseDown += mouse_depth * projected_center_to_cam;
-
- }
- else
- {
- mMouseDown = findNearestPointOnRing( x, y, center, axis ) - center;
- mMouseDown.normVec();
- }
- }
-
- mMouseCur = mMouseDown;
- mAgentSelfAtAxis = gAgent.getAtAxis(); // no point checking if avatar was selected, just save the value
-
- // Route future Mouse messages here preemptively. (Release on mouse up.)
- setMouseCapture( TRUE );
- LLSelectMgr::getInstance()->enableSilhouette(FALSE);
-
- mHelpTextTimer.reset();
- sNumTimesHelpTextShown++;
- return TRUE;
+ BOOL can_rotate = canAffectSelection();
+ if (!can_rotate)
+ {
+ return FALSE;
+ }
+
+ highlightManipulators(x, y);
+ S32 hit_part = mHighlightedPart;
+ // we just started a drag, so save initial object positions
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_ROTATE);
+
+ // save selection center
+ mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() ); //LLSelectMgr::getInstance()->getSelectionCenterGlobal();
+
+ mManipPart = (EManipPart)hit_part;
+ LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
+
+ if( mManipPart == LL_ROT_GENERAL)
+ {
+ mMouseDown = intersectMouseWithSphere( x, y, center, mRadiusMeters);
+ }
+ else
+ {
+ // Project onto the plane of the ring
+ LLVector3 axis = getConstraintAxis();
+
+ F32 axis_onto_cam = llabs( axis * mCenterToCamNorm );
+ const F32 AXIS_ONTO_CAM_TOL = cos( 85.f * DEG_TO_RAD );
+ if( axis_onto_cam < AXIS_ONTO_CAM_TOL )
+ {
+ LLVector3 up_from_axis = mCenterToCamNorm % axis;
+ up_from_axis.normVec();
+ LLVector3 cur_intersection;
+ getMousePointOnPlaneAgent(cur_intersection, x, y, center, mCenterToCam);
+ cur_intersection -= center;
+ mMouseDown = projected_vec(cur_intersection, up_from_axis);
+ F32 mouse_depth = SNAP_GUIDE_INNER_RADIUS * mRadiusMeters;
+ F32 mouse_dist_sqrd = mMouseDown.magVecSquared();
+ if (mouse_dist_sqrd > 0.0001f)
+ {
+ mouse_depth = sqrtf((SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) * (SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) -
+ mouse_dist_sqrd);
+ }
+ LLVector3 projected_center_to_cam = mCenterToCamNorm - projected_vec(mCenterToCamNorm, axis);
+ mMouseDown += mouse_depth * projected_center_to_cam;
+
+ }
+ else
+ {
+ mMouseDown = findNearestPointOnRing( x, y, center, axis ) - center;
+ mMouseDown.normVec();
+ }
+ }
+
+ mMouseCur = mMouseDown;
+ mAgentSelfAtAxis = gAgent.getAtAxis(); // no point checking if avatar was selected, just save the value
+
+ // Route future Mouse messages here preemptively. (Release on mouse up.)
+ setMouseCapture( TRUE );
+ LLSelectMgr::getInstance()->enableSilhouette(FALSE);
+
+ mHelpTextTimer.reset();
+ sNumTimesHelpTextShown++;
+ return TRUE;
}
LLVector3 LLManipRotate::findNearestPointOnRing( S32 x, S32 y, const LLVector3& center, const LLVector3& axis )
{
- // Project the delta onto the ring and rescale it by the radius so that it's _on_ the ring.
- LLVector3 proj_onto_ring;
- getMousePointOnPlaneAgent(proj_onto_ring, x, y, center, axis);
- proj_onto_ring -= center;
- proj_onto_ring.normVec();
+ // Project the delta onto the ring and rescale it by the radius so that it's _on_ the ring.
+ LLVector3 proj_onto_ring;
+ getMousePointOnPlaneAgent(proj_onto_ring, x, y, center, axis);
+ proj_onto_ring -= center;
+ proj_onto_ring.normVec();
- return center + proj_onto_ring * mRadiusMeters;
+ return center + proj_onto_ring * mRadiusMeters;
}
BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask)
{
- // first, perform normal processing in case this was a quick-click
- handleHover(x, y, mask);
-
- if( hasMouseCapture() )
- {
- for (LLObjectSelection::iterator iter = mObjectSelection->begin();
- iter != mObjectSelection->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject* object = selectNode->getObject();
- LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit();
-
- // have permission to move and object is root of selection or individually selected
- if (object->permMove() && !object->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- (object->isRootEdit() || selectNode->mIndividualSelection))
- {
- object->mUnselectedChildrenPositions.clear() ;
- }
- }
-
- mManipPart = LL_NO_PART;
-
- // Might have missed last update due to timing.
- LLSelectMgr::getInstance()->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION );
- LLSelectMgr::getInstance()->enableSilhouette(TRUE);
- //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
-
- LLSelectMgr::getInstance()->updateSelectionCenter();
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- }
-
- return LLManip::handleMouseUp(x, y, mask);
+ // first, perform normal processing in case this was a quick-click
+ handleHover(x, y, mask);
+
+ if( hasMouseCapture() )
+ {
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* object = selectNode->getObject();
+ LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit();
+
+ // have permission to move and object is root of selection or individually selected
+ if (object->permMove() && !object->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ (object->isRootEdit() || selectNode->mIndividualSelection))
+ {
+ object->mUnselectedChildrenPositions.clear() ;
+ }
+ }
+
+ mManipPart = LL_NO_PART;
+
+ // Might have missed last update due to timing.
+ LLSelectMgr::getInstance()->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION );
+ LLSelectMgr::getInstance()->enableSilhouette(TRUE);
+ //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
+
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ }
+
+ return LLManip::handleMouseUp(x, y, mask);
}
BOOL LLManipRotate::handleHover(S32 x, S32 y, MASK mask)
{
- if( hasMouseCapture() )
- {
- if( mObjectSelection->isEmpty() )
- {
- // Somehow the object got deselected while we were dragging it.
- setMouseCapture( FALSE );
- }
- else
- {
- drag(x, y);
- }
-
- LL_DEBUGS("UserInput") << "hover handled by LLManipRotate (active)" << LL_ENDL;
- }
- else
- {
- highlightManipulators(x, y);
- LL_DEBUGS("UserInput") << "hover handled by LLManipRotate (inactive)" << LL_ENDL;
- }
-
- gViewerWindow->setCursor(UI_CURSOR_TOOLROTATE);
- return TRUE;
+ if( hasMouseCapture() )
+ {
+ if( mObjectSelection->isEmpty() )
+ {
+ // Somehow the object got deselected while we were dragging it.
+ setMouseCapture( FALSE );
+ }
+ else
+ {
+ drag(x, y);
+ }
+
+ LL_DEBUGS("UserInput") << "hover handled by LLManipRotate (active)" << LL_ENDL;
+ }
+ else
+ {
+ highlightManipulators(x, y);
+ LL_DEBUGS("UserInput") << "hover handled by LLManipRotate (inactive)" << LL_ENDL;
+ }
+
+ gViewerWindow->setCursor(UI_CURSOR_TOOLROTATE);
+ return TRUE;
}
-LLVector3 LLManipRotate::projectToSphere( F32 x, F32 y, BOOL* on_sphere )
+LLVector3 LLManipRotate::projectToSphere( F32 x, F32 y, BOOL* on_sphere )
{
- F32 z = 0.f;
- F32 dist_squared = x*x + y*y;
+ F32 z = 0.f;
+ F32 dist_squared = x*x + y*y;
- *on_sphere = dist_squared <= SQ_RADIUS;
+ *on_sphere = dist_squared <= SQ_RADIUS;
if( *on_sphere )
- {
+ {
z = sqrt(SQ_RADIUS - dist_squared);
}
- return LLVector3( x, y, z );
+ return LLVector3( x, y, z );
}
// Freeform rotation
void LLManipRotate::drag( S32 x, S32 y )
{
- if( !updateVisiblity() )
- {
- return;
- }
-
- if( mManipPart == LL_ROT_GENERAL )
- {
- mRotation = dragUnconstrained(x, y);
- }
- else
- {
- mRotation = dragConstrained(x, y);
- }
-
- BOOL damped = mSmoothRotate;
- mSmoothRotate = FALSE;
-
- for (LLObjectSelection::iterator iter = mObjectSelection->begin();
- iter != mObjectSelection->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject* object = selectNode->getObject();
- LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit();
-
- // have permission to move and object is root of selection or individually selected
- if (object->permMove() && !object->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- (object->isRootEdit() || selectNode->mIndividualSelection))
- {
- if (!object->isRootEdit())
- {
- // child objects should not update if parent is selected
- LLViewerObject* editable_root = (LLViewerObject*)object->getParent();
- if (editable_root->isSelected())
- {
- // we will be moved properly by our parent, so skip
- continue;
- }
- }
-
- LLQuaternion new_rot = selectNode->mSavedRotation * mRotation;
- std::vector<LLVector3>& child_positions = object->mUnselectedChildrenPositions ;
- std::vector<LLQuaternion> child_rotations;
- if (object->isRootEdit() && selectNode->mIndividualSelection)
- {
- object->saveUnselectedChildrenRotation(child_rotations) ;
- object->saveUnselectedChildrenPosition(child_positions) ;
- }
-
- if (object->getParent() && object->mDrawable.notNull())
- {
- LLQuaternion invParentRotation = object->mDrawable->mXform.getParent()->getWorldRotation();
- invParentRotation.transQuat();
-
- object->setRotation(new_rot * invParentRotation, damped);
- rebuild(object);
- }
- else
- {
- object->setRotation(new_rot, damped);
+ if( !updateVisiblity() )
+ {
+ return;
+ }
+
+ if( mManipPart == LL_ROT_GENERAL )
+ {
+ mRotation = dragUnconstrained(x, y);
+ }
+ else
+ {
+ mRotation = dragConstrained(x, y);
+ }
+
+ BOOL damped = mSmoothRotate;
+ mSmoothRotate = FALSE;
+
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* object = selectNode->getObject();
+ LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit();
+
+ // have permission to move and object is root of selection or individually selected
+ if (object->permMove() && !object->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ (object->isRootEdit() || selectNode->mIndividualSelection))
+ {
+ if (!object->isRootEdit())
+ {
+ // child objects should not update if parent is selected
+ LLViewerObject* editable_root = (LLViewerObject*)object->getParent();
+ if (editable_root->isSelected())
+ {
+ // we will be moved properly by our parent, so skip
+ continue;
+ }
+ }
+
+ LLQuaternion new_rot = selectNode->mSavedRotation * mRotation;
+ std::vector<LLVector3>& child_positions = object->mUnselectedChildrenPositions ;
+ std::vector<LLQuaternion> child_rotations;
+ if (object->isRootEdit() && selectNode->mIndividualSelection)
+ {
+ object->saveUnselectedChildrenRotation(child_rotations) ;
+ object->saveUnselectedChildrenPosition(child_positions) ;
+ }
+
+ if (object->getParent() && object->mDrawable.notNull())
+ {
+ LLQuaternion invParentRotation = object->mDrawable->mXform.getParent()->getWorldRotation();
+ invParentRotation.transQuat();
+
+ object->setRotation(new_rot * invParentRotation, damped);
+ rebuild(object);
+ }
+ else
+ {
+ object->setRotation(new_rot, damped);
LLVOAvatar* avatar = object->asAvatar();
if (avatar && avatar->isSelf()
&& LLSelectMgr::getInstance()->mAllowSelectAvatar
@@ -620,1097 +620,1097 @@ void LLManipRotate::drag( S32 x, S32 y )
at_axis.normalize();
gAgent.resetAxes(at_axis);
}
- rebuild(object);
- }
-
- // for individually selected roots, we need to counterrotate all the children
- if (object->isRootEdit() && selectNode->mIndividualSelection)
- {
- //RN: must do non-damped updates on these objects so relative rotation appears constant
- // instead of having two competing slerps making the child objects appear to "wobble"
- object->resetChildrenRotationAndPosition(child_rotations, child_positions) ;
- }
- }
- }
-
- // update positions
- for (LLObjectSelection::iterator iter = mObjectSelection->begin();
- iter != mObjectSelection->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject* object = selectNode->getObject();
- LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit();
-
- // to avoid cumulative position changes we calculate the objects new position using its saved position
- if (object && object->permMove() && !object->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()))
- {
- LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
-
- LLVector3 old_position;
- LLVector3 new_position;
-
- if (object->isAttachment() && object->mDrawable.notNull())
- {
- // need to work in drawable space to handle selected items from multiple attachments
- // (which have no shared frame of reference other than their render positions)
- LLXform* parent_xform = object->mDrawable->getXform()->getParent();
- new_position = (selectNode->mSavedPositionLocal * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();
- old_position = (object->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();//object->getRenderPosition();
- }
- else
- {
- new_position = gAgent.getPosAgentFromGlobal( selectNode->mSavedPositionGlobal );
- old_position = object->getPositionAgent();
- }
-
- new_position = (new_position - center) * mRotation; // new relative rotated position
- new_position += center;
-
- if (object->isRootEdit() && !object->isAttachment())
- {
- LLVector3d new_pos_global = gAgent.getPosGlobalFromAgent(new_position);
- new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global);
- new_position = gAgent.getPosAgentFromGlobal(new_pos_global);
- }
-
- // for individually selected child objects
- if (!object->isRootEdit() && selectNode->mIndividualSelection)
- {
- LLViewerObject* parentp = (LLViewerObject*)object->getParent();
- if (!parentp->isSelected())
- {
- if (object->isAttachment() && object->mDrawable.notNull())
- {
- // find position relative to render position of parent
- object->setPosition((new_position - parentp->getRenderPosition()) * ~parentp->getRenderRotation());
- rebuild(object);
- }
- else
- {
- object->setPositionParent((new_position - parentp->getPositionAgent()) * ~parentp->getRotationRegion());
- rebuild(object);
- }
- }
- }
- else if (object->isRootEdit())
- {
- if (object->isAttachment() && object->mDrawable.notNull())
- {
- LLXform* parent_xform = object->mDrawable->getXform()->getParent();
- object->setPosition((new_position - parent_xform->getWorldPosition()) * ~parent_xform->getWorldRotation());
- rebuild(object);
- }
- else
- {
- object->setPositionAgent(new_position);
- rebuild(object);
- }
- }
-
- // for individually selected roots, we need to counter-translate all unselected children
- if (object->isRootEdit() && selectNode->mIndividualSelection)
- {
- // only offset by parent's translation as we've already countered parent's rotation
- rebuild(object);
- object->resetChildrenPosition(old_position - new_position) ;
- }
- }
- }
-
- // store changes to override updates
- for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin();
- iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject*cur = selectNode->getObject();
- LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
- if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- (!cur->isAvatar() || LLSelectMgr::getInstance()->mAllowSelectAvatar))
- {
- selectNode->mLastRotation = cur->getRotation();
- selectNode->mLastPositionLocal = cur->getPosition();
- }
- }
-
- LLSelectMgr::getInstance()->updateSelectionCenter();
-
- // RN: just clear focus so camera doesn't follow spurious object updates
- gAgentCamera.clearFocusObject();
- dialog_refresh_all();
+ rebuild(object);
+ }
+
+ // for individually selected roots, we need to counterrotate all the children
+ if (object->isRootEdit() && selectNode->mIndividualSelection)
+ {
+ //RN: must do non-damped updates on these objects so relative rotation appears constant
+ // instead of having two competing slerps making the child objects appear to "wobble"
+ object->resetChildrenRotationAndPosition(child_rotations, child_positions) ;
+ }
+ }
+ }
+
+ // update positions
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* object = selectNode->getObject();
+ LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit();
+
+ // to avoid cumulative position changes we calculate the objects new position using its saved position
+ if (object && object->permMove() && !object->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()))
+ {
+ LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
+
+ LLVector3 old_position;
+ LLVector3 new_position;
+
+ if (object->isAttachment() && object->mDrawable.notNull())
+ {
+ // need to work in drawable space to handle selected items from multiple attachments
+ // (which have no shared frame of reference other than their render positions)
+ LLXform* parent_xform = object->mDrawable->getXform()->getParent();
+ new_position = (selectNode->mSavedPositionLocal * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();
+ old_position = (object->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();//object->getRenderPosition();
+ }
+ else
+ {
+ new_position = gAgent.getPosAgentFromGlobal( selectNode->mSavedPositionGlobal );
+ old_position = object->getPositionAgent();
+ }
+
+ new_position = (new_position - center) * mRotation; // new relative rotated position
+ new_position += center;
+
+ if (object->isRootEdit() && !object->isAttachment())
+ {
+ LLVector3d new_pos_global = gAgent.getPosGlobalFromAgent(new_position);
+ new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global);
+ new_position = gAgent.getPosAgentFromGlobal(new_pos_global);
+ }
+
+ // for individually selected child objects
+ if (!object->isRootEdit() && selectNode->mIndividualSelection)
+ {
+ LLViewerObject* parentp = (LLViewerObject*)object->getParent();
+ if (!parentp->isSelected())
+ {
+ if (object->isAttachment() && object->mDrawable.notNull())
+ {
+ // find position relative to render position of parent
+ object->setPosition((new_position - parentp->getRenderPosition()) * ~parentp->getRenderRotation());
+ rebuild(object);
+ }
+ else
+ {
+ object->setPositionParent((new_position - parentp->getPositionAgent()) * ~parentp->getRotationRegion());
+ rebuild(object);
+ }
+ }
+ }
+ else if (object->isRootEdit())
+ {
+ if (object->isAttachment() && object->mDrawable.notNull())
+ {
+ LLXform* parent_xform = object->mDrawable->getXform()->getParent();
+ object->setPosition((new_position - parent_xform->getWorldPosition()) * ~parent_xform->getWorldRotation());
+ rebuild(object);
+ }
+ else
+ {
+ object->setPositionAgent(new_position);
+ rebuild(object);
+ }
+ }
+
+ // for individually selected roots, we need to counter-translate all unselected children
+ if (object->isRootEdit() && selectNode->mIndividualSelection)
+ {
+ // only offset by parent's translation as we've already countered parent's rotation
+ rebuild(object);
+ object->resetChildrenPosition(old_position - new_position) ;
+ }
+ }
+ }
+
+ // store changes to override updates
+ for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject*cur = selectNode->getObject();
+ LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
+ if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ (!cur->isAvatar() || LLSelectMgr::getInstance()->mAllowSelectAvatar))
+ {
+ selectNode->mLastRotation = cur->getRotation();
+ selectNode->mLastPositionLocal = cur->getPosition();
+ }
+ }
+
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+
+ // RN: just clear focus so camera doesn't follow spurious object updates
+ gAgentCamera.clearFocusObject();
+ dialog_refresh_all();
}
void LLManipRotate::renderActiveRing( F32 radius, F32 width, const LLColor4& front_color, const LLColor4& back_color)
{
- LLGLEnable cull_face(GL_CULL_FACE);
- {
- gl_ring(radius, width, back_color, back_color * 0.5f, CIRCLE_STEPS, FALSE);
- gl_ring(radius, width, back_color, back_color * 0.5f, CIRCLE_STEPS, TRUE);
- }
- {
- LLGLDepthTest gls_depth(GL_FALSE);
- gl_ring(radius, width, front_color, front_color * 0.5f, CIRCLE_STEPS, FALSE);
- gl_ring(radius, width, front_color, front_color * 0.5f, CIRCLE_STEPS, TRUE);
- }
+ LLGLEnable cull_face(GL_CULL_FACE);
+ {
+ gl_ring(radius, width, back_color, back_color * 0.5f, CIRCLE_STEPS, FALSE);
+ gl_ring(radius, width, back_color, back_color * 0.5f, CIRCLE_STEPS, TRUE);
+ }
+ {
+ LLGLDepthTest gls_depth(GL_FALSE);
+ gl_ring(radius, width, front_color, front_color * 0.5f, CIRCLE_STEPS, FALSE);
+ gl_ring(radius, width, front_color, front_color * 0.5f, CIRCLE_STEPS, TRUE);
+ }
}
void LLManipRotate::renderSnapGuides()
{
- static LLCachedControl<bool> snap_enabled(gSavedSettings, "SnapEnabled", true);
- if (!snap_enabled)
- {
- return;
- }
-
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale, true);
-
- LLVector3 constraint_axis = getConstraintAxis();
-
- LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
- LLVector3 cam_at_axis;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- cam_at_axis.setVec(1.f, 0.f, 0.f);
- }
- else
- {
- cam_at_axis = center - gAgentCamera.getCameraPositionAgent();
- cam_at_axis.normVec();
- }
-
- LLVector3 world_snap_axis;
- LLVector3 test_axis = constraint_axis;
-
- BOOL constrain_to_ref_object = FALSE;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
- {
- test_axis = test_axis * ~grid_rotation;
- }
- else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT)
- {
- test_axis = test_axis * ~grid_rotation;
- constrain_to_ref_object = TRUE;
- }
-
- test_axis.abs();
-
- // find closest global/reference axis to local constraint axis;
- if (test_axis.mV[VX] > test_axis.mV[VY] && test_axis.mV[VX] > test_axis.mV[VZ])
- {
- world_snap_axis = LLVector3::y_axis;
- }
- else if (test_axis.mV[VY] > test_axis.mV[VZ])
- {
- world_snap_axis = LLVector3::z_axis;
- }
- else
- {
- world_snap_axis = LLVector3::x_axis;
- }
-
- LLVector3 projected_snap_axis = world_snap_axis;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
- {
- projected_snap_axis = projected_snap_axis * grid_rotation;
- }
- else if (constrain_to_ref_object)
- {
- projected_snap_axis = projected_snap_axis * grid_rotation;
- }
-
- // project world snap axis onto constraint plane
- projected_snap_axis -= projected_vec(projected_snap_axis, constraint_axis);
- projected_snap_axis.normVec();
-
- S32 num_rings = mCamEdgeOn ? 2 : 1;
- for (S32 ring_num = 0; ring_num < num_rings; ring_num++)
- {
- LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
-
- if (mCamEdgeOn)
- {
- // draw two opposing rings
- if (ring_num == 0)
- {
- center += constraint_axis * mRadiusMeters * 0.5f;
- }
- else
- {
- center -= constraint_axis * mRadiusMeters * 0.5f;
- }
- }
-
- LLGLDepthTest gls_depth(GL_FALSE);
- for (S32 pass = 0; pass < 3; pass++)
- {
- // render snap guide ring
- gGL.pushMatrix();
-
- LLQuaternion snap_guide_rot;
- F32 angle_radians, x, y, z;
- snap_guide_rot.shortestArc(LLVector3::z_axis, getConstraintAxis());
- snap_guide_rot.getAngleAxis(&angle_radians, &x, &y, &z);
- gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]);
- gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
-
- LLColor4 line_color = setupSnapGuideRenderPass(pass);
-
- gGL.color4fv(line_color.mV);
-
- if (mCamEdgeOn)
- {
- // render an arc
- LLVector3 edge_normal = cam_at_axis % constraint_axis;
- edge_normal.normVec();
- LLVector3 x_axis_snap = LLVector3::x_axis * snap_guide_rot;
- LLVector3 y_axis_snap = LLVector3::y_axis * snap_guide_rot;
-
- F32 end_angle = atan2(y_axis_snap * edge_normal, x_axis_snap * edge_normal);
- //F32 start_angle = angle_between((-1.f * LLVector3::x_axis) * snap_guide_rot, edge_normal);
- F32 start_angle = end_angle - F_PI;
- gl_arc_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE, start_angle, end_angle);
- }
- else
- {
- gl_circle_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE);
- }
- gGL.popMatrix();
-
- for (S32 i = 0; i < 64; i++)
- {
- BOOL render_text = TRUE;
- F32 deg = 5.625f * (F32)i;
- LLVector3 inner_point;
- LLVector3 outer_point;
- LLVector3 text_point;
- LLQuaternion rot(deg * DEG_TO_RAD, constraint_axis);
- gGL.begin(LLRender::LINES);
- {
- inner_point = (projected_snap_axis * mRadiusMeters * SNAP_GUIDE_INNER_RADIUS * rot) + center;
- F32 tick_length = 0.f;
- if (i % 16 == 0)
- {
- tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_1 - SNAP_GUIDE_INNER_RADIUS);
- }
- else if (i % 8 == 0)
- {
- tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_2 - SNAP_GUIDE_INNER_RADIUS);
- }
- else if (i % 4 == 0)
- {
- tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_3 - SNAP_GUIDE_INNER_RADIUS);
- }
- else if (i % 2 == 0)
- {
- tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_4 - SNAP_GUIDE_INNER_RADIUS);
- }
- else
- {
- tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_5 - SNAP_GUIDE_INNER_RADIUS);
- }
-
- if (mCamEdgeOn)
- {
- // don't draw ticks that are on back side of circle
- F32 dot = cam_at_axis * (projected_snap_axis * rot);
- if (dot > 0.f)
- {
- outer_point = inner_point;
- render_text = FALSE;
- }
- else
- {
- if (ring_num == 0)
- {
- outer_point = inner_point + (constraint_axis * tick_length) * rot;
- }
- else
- {
- outer_point = inner_point - (constraint_axis * tick_length) * rot;
- }
- }
- }
- else
- {
- outer_point = inner_point + (projected_snap_axis * tick_length) * rot;
- }
-
- text_point = outer_point + (projected_snap_axis * mRadiusMeters * 0.1f) * rot;
-
- gGL.vertex3fv(inner_point.mV);
- gGL.vertex3fv(outer_point.mV);
- }
- gGL.end();
-
- //RN: text rendering does own shadow pass, so only render once
- if (pass == 1 && render_text && i % 16 == 0)
- {
- if (world_snap_axis.mV[VX])
- {
- if (i == 0)
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Forward") : LLTrans::getString("Direction_East"), LLColor4::white);
- }
- else if (i == 16)
- {
- if (constraint_axis.mV[VZ] > 0.f)
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Left") : LLTrans::getString("Direction_North"), LLColor4::white);
- }
- else
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Right") : LLTrans::getString("Direction_South"), LLColor4::white);
- }
- }
- else if (i == 32)
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Back") : LLTrans::getString("Direction_West"), LLColor4::white);
- }
- else
- {
- if (constraint_axis.mV[VZ] > 0.f)
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Right") : LLTrans::getString("Direction_South"), LLColor4::white);
- }
- else
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Left") : LLTrans::getString("Direction_North"), LLColor4::white);
- }
- }
- }
- else if (world_snap_axis.mV[VY])
- {
- if (i == 0)
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Left") : LLTrans::getString("Direction_North"), LLColor4::white);
- }
- else if (i == 16)
- {
- if (constraint_axis.mV[VX] > 0.f)
- {
- renderTickText(text_point, LLTrans::getString("Direction_Up"), LLColor4::white);
- }
- else
- {
- renderTickText(text_point, LLTrans::getString("Direction_Down"), LLColor4::white);
- }
- }
- else if (i == 32)
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Right") : LLTrans::getString("Direction_South"), LLColor4::white);
- }
- else
- {
- if (constraint_axis.mV[VX] > 0.f)
- {
- renderTickText(text_point, LLTrans::getString("Direction_Down"), LLColor4::white);
- }
- else
- {
- renderTickText(text_point, LLTrans::getString("Direction_Up"), LLColor4::white);
- }
- }
- }
- else if (world_snap_axis.mV[VZ])
- {
- if (i == 0)
- {
- renderTickText(text_point, LLTrans::getString("Direction_Up"), LLColor4::white);
- }
- else if (i == 16)
- {
- if (constraint_axis.mV[VY] > 0.f)
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Forward") : LLTrans::getString("Direction_East"), LLColor4::white);
- }
- else
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Back") : LLTrans::getString("Direction_West"), LLColor4::white);
- }
- }
- else if (i == 32)
- {
- renderTickText(text_point, LLTrans::getString("Direction_Down"), LLColor4::white);
- }
- else
- {
- if (constraint_axis.mV[VY] > 0.f)
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Back") : LLTrans::getString("Direction_West"), LLColor4::white);
- }
- else
- {
- renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Forward") : LLTrans::getString("Direction_East"), LLColor4::white);
- }
- }
- }
- }
- gGL.color4fv(line_color.mV);
- }
-
- // now render projected object axis
- if (mInSnapRegime)
- {
- LLVector3 object_axis;
- getObjectAxisClosestToMouse(object_axis);
-
- // project onto constraint plane
- LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE);
- object_axis = object_axis * first_node->getObject()->getRenderRotation();
- object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis();
- object_axis.normVec();
- object_axis = object_axis * SNAP_GUIDE_INNER_RADIUS * mRadiusMeters + center;
- LLVector3 line_start = center;
-
- gGL.begin(LLRender::LINES);
- {
- gGL.vertex3fv(line_start.mV);
- gGL.vertex3fv(object_axis.mV);
- }
- gGL.end();
-
- // draw snap guide arrow
- gGL.begin(LLRender::TRIANGLES);
- {
- LLVector3 arrow_dir;
- LLVector3 arrow_span = (object_axis - line_start) % getConstraintAxis();
- arrow_span.normVec();
-
- arrow_dir = mCamEdgeOn ? getConstraintAxis() : object_axis - line_start;
- arrow_dir.normVec();
- if (ring_num == 1)
- {
- arrow_dir *= -1.f;
- }
- gGL.vertex3fv((object_axis + arrow_dir * mRadiusMeters * 0.1f).mV);
- gGL.vertex3fv((object_axis + arrow_span * mRadiusMeters * 0.1f).mV);
- gGL.vertex3fv((object_axis - arrow_span * mRadiusMeters * 0.1f).mV);
- }
- gGL.end();
-
- {
- LLGLDepthTest gls_depth(GL_TRUE);
- gGL.begin(LLRender::LINES);
- {
- gGL.vertex3fv(line_start.mV);
- gGL.vertex3fv(object_axis.mV);
- }
- gGL.end();
-
- // draw snap guide arrow
- gGL.begin(LLRender::TRIANGLES);
- {
- LLVector3 arrow_dir;
- LLVector3 arrow_span = (object_axis - line_start) % getConstraintAxis();
- arrow_span.normVec();
-
- arrow_dir = mCamEdgeOn ? getConstraintAxis() : object_axis - line_start;
- arrow_dir.normVec();
- if (ring_num == 1)
- {
- arrow_dir *= -1.f;
- }
-
- gGL.vertex3fv((object_axis + arrow_dir * mRadiusMeters * 0.1f).mV);
- gGL.vertex3fv((object_axis + arrow_span * mRadiusMeters * 0.1f).mV);
- gGL.vertex3fv((object_axis - arrow_span * mRadiusMeters * 0.1f).mV);
- }
- gGL.end();
- }
- }
- }
- }
-
-
- // render help text
- if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
- {
- if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
- {
- LLVector3 selection_center_start = LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
-
- LLVector3 offset_dir = LLViewerCamera::getInstance()->getUpAxis();
-
- F32 line_alpha = gSavedSettings.getF32("GridOpacity");
-
- LLVector3 help_text_pos = selection_center_start + (mRadiusMeters * 3.f * offset_dir);
- const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
-
- std::string help_text = LLTrans::getString("manip_hint1");
- LLColor4 help_text_color = LLColor4::white;
- help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
- hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
- help_text = LLTrans::getString("manip_hint2");
- help_text_pos -= offset_dir * mRadiusMeters * 0.4f;
- hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
- }
- }
+ static LLCachedControl<bool> snap_enabled(gSavedSettings, "SnapEnabled", true);
+ if (!snap_enabled)
+ {
+ return;
+ }
+
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale, true);
+
+ LLVector3 constraint_axis = getConstraintAxis();
+
+ LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
+ LLVector3 cam_at_axis;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ cam_at_axis.setVec(1.f, 0.f, 0.f);
+ }
+ else
+ {
+ cam_at_axis = center - gAgentCamera.getCameraPositionAgent();
+ cam_at_axis.normVec();
+ }
+
+ LLVector3 world_snap_axis;
+ LLVector3 test_axis = constraint_axis;
+
+ BOOL constrain_to_ref_object = FALSE;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
+ {
+ test_axis = test_axis * ~grid_rotation;
+ }
+ else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT)
+ {
+ test_axis = test_axis * ~grid_rotation;
+ constrain_to_ref_object = TRUE;
+ }
+
+ test_axis.abs();
+
+ // find closest global/reference axis to local constraint axis;
+ if (test_axis.mV[VX] > test_axis.mV[VY] && test_axis.mV[VX] > test_axis.mV[VZ])
+ {
+ world_snap_axis = LLVector3::y_axis;
+ }
+ else if (test_axis.mV[VY] > test_axis.mV[VZ])
+ {
+ world_snap_axis = LLVector3::z_axis;
+ }
+ else
+ {
+ world_snap_axis = LLVector3::x_axis;
+ }
+
+ LLVector3 projected_snap_axis = world_snap_axis;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
+ {
+ projected_snap_axis = projected_snap_axis * grid_rotation;
+ }
+ else if (constrain_to_ref_object)
+ {
+ projected_snap_axis = projected_snap_axis * grid_rotation;
+ }
+
+ // project world snap axis onto constraint plane
+ projected_snap_axis -= projected_vec(projected_snap_axis, constraint_axis);
+ projected_snap_axis.normVec();
+
+ S32 num_rings = mCamEdgeOn ? 2 : 1;
+ for (S32 ring_num = 0; ring_num < num_rings; ring_num++)
+ {
+ LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
+
+ if (mCamEdgeOn)
+ {
+ // draw two opposing rings
+ if (ring_num == 0)
+ {
+ center += constraint_axis * mRadiusMeters * 0.5f;
+ }
+ else
+ {
+ center -= constraint_axis * mRadiusMeters * 0.5f;
+ }
+ }
+
+ LLGLDepthTest gls_depth(GL_FALSE);
+ for (S32 pass = 0; pass < 3; pass++)
+ {
+ // render snap guide ring
+ gGL.pushMatrix();
+
+ LLQuaternion snap_guide_rot;
+ F32 angle_radians, x, y, z;
+ snap_guide_rot.shortestArc(LLVector3::z_axis, getConstraintAxis());
+ snap_guide_rot.getAngleAxis(&angle_radians, &x, &y, &z);
+ gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
+
+ LLColor4 line_color = setupSnapGuideRenderPass(pass);
+
+ gGL.color4fv(line_color.mV);
+
+ if (mCamEdgeOn)
+ {
+ // render an arc
+ LLVector3 edge_normal = cam_at_axis % constraint_axis;
+ edge_normal.normVec();
+ LLVector3 x_axis_snap = LLVector3::x_axis * snap_guide_rot;
+ LLVector3 y_axis_snap = LLVector3::y_axis * snap_guide_rot;
+
+ F32 end_angle = atan2(y_axis_snap * edge_normal, x_axis_snap * edge_normal);
+ //F32 start_angle = angle_between((-1.f * LLVector3::x_axis) * snap_guide_rot, edge_normal);
+ F32 start_angle = end_angle - F_PI;
+ gl_arc_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE, start_angle, end_angle);
+ }
+ else
+ {
+ gl_circle_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE);
+ }
+ gGL.popMatrix();
+
+ for (S32 i = 0; i < 64; i++)
+ {
+ BOOL render_text = TRUE;
+ F32 deg = 5.625f * (F32)i;
+ LLVector3 inner_point;
+ LLVector3 outer_point;
+ LLVector3 text_point;
+ LLQuaternion rot(deg * DEG_TO_RAD, constraint_axis);
+ gGL.begin(LLRender::LINES);
+ {
+ inner_point = (projected_snap_axis * mRadiusMeters * SNAP_GUIDE_INNER_RADIUS * rot) + center;
+ F32 tick_length = 0.f;
+ if (i % 16 == 0)
+ {
+ tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_1 - SNAP_GUIDE_INNER_RADIUS);
+ }
+ else if (i % 8 == 0)
+ {
+ tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_2 - SNAP_GUIDE_INNER_RADIUS);
+ }
+ else if (i % 4 == 0)
+ {
+ tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_3 - SNAP_GUIDE_INNER_RADIUS);
+ }
+ else if (i % 2 == 0)
+ {
+ tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_4 - SNAP_GUIDE_INNER_RADIUS);
+ }
+ else
+ {
+ tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_5 - SNAP_GUIDE_INNER_RADIUS);
+ }
+
+ if (mCamEdgeOn)
+ {
+ // don't draw ticks that are on back side of circle
+ F32 dot = cam_at_axis * (projected_snap_axis * rot);
+ if (dot > 0.f)
+ {
+ outer_point = inner_point;
+ render_text = FALSE;
+ }
+ else
+ {
+ if (ring_num == 0)
+ {
+ outer_point = inner_point + (constraint_axis * tick_length) * rot;
+ }
+ else
+ {
+ outer_point = inner_point - (constraint_axis * tick_length) * rot;
+ }
+ }
+ }
+ else
+ {
+ outer_point = inner_point + (projected_snap_axis * tick_length) * rot;
+ }
+
+ text_point = outer_point + (projected_snap_axis * mRadiusMeters * 0.1f) * rot;
+
+ gGL.vertex3fv(inner_point.mV);
+ gGL.vertex3fv(outer_point.mV);
+ }
+ gGL.end();
+
+ //RN: text rendering does own shadow pass, so only render once
+ if (pass == 1 && render_text && i % 16 == 0)
+ {
+ if (world_snap_axis.mV[VX])
+ {
+ if (i == 0)
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Forward") : LLTrans::getString("Direction_East"), LLColor4::white);
+ }
+ else if (i == 16)
+ {
+ if (constraint_axis.mV[VZ] > 0.f)
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Left") : LLTrans::getString("Direction_North"), LLColor4::white);
+ }
+ else
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Right") : LLTrans::getString("Direction_South"), LLColor4::white);
+ }
+ }
+ else if (i == 32)
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Back") : LLTrans::getString("Direction_West"), LLColor4::white);
+ }
+ else
+ {
+ if (constraint_axis.mV[VZ] > 0.f)
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Right") : LLTrans::getString("Direction_South"), LLColor4::white);
+ }
+ else
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Left") : LLTrans::getString("Direction_North"), LLColor4::white);
+ }
+ }
+ }
+ else if (world_snap_axis.mV[VY])
+ {
+ if (i == 0)
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Left") : LLTrans::getString("Direction_North"), LLColor4::white);
+ }
+ else if (i == 16)
+ {
+ if (constraint_axis.mV[VX] > 0.f)
+ {
+ renderTickText(text_point, LLTrans::getString("Direction_Up"), LLColor4::white);
+ }
+ else
+ {
+ renderTickText(text_point, LLTrans::getString("Direction_Down"), LLColor4::white);
+ }
+ }
+ else if (i == 32)
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Right") : LLTrans::getString("Direction_South"), LLColor4::white);
+ }
+ else
+ {
+ if (constraint_axis.mV[VX] > 0.f)
+ {
+ renderTickText(text_point, LLTrans::getString("Direction_Down"), LLColor4::white);
+ }
+ else
+ {
+ renderTickText(text_point, LLTrans::getString("Direction_Up"), LLColor4::white);
+ }
+ }
+ }
+ else if (world_snap_axis.mV[VZ])
+ {
+ if (i == 0)
+ {
+ renderTickText(text_point, LLTrans::getString("Direction_Up"), LLColor4::white);
+ }
+ else if (i == 16)
+ {
+ if (constraint_axis.mV[VY] > 0.f)
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Forward") : LLTrans::getString("Direction_East"), LLColor4::white);
+ }
+ else
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Back") : LLTrans::getString("Direction_West"), LLColor4::white);
+ }
+ }
+ else if (i == 32)
+ {
+ renderTickText(text_point, LLTrans::getString("Direction_Down"), LLColor4::white);
+ }
+ else
+ {
+ if (constraint_axis.mV[VY] > 0.f)
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Back") : LLTrans::getString("Direction_West"), LLColor4::white);
+ }
+ else
+ {
+ renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Direction_Forward") : LLTrans::getString("Direction_East"), LLColor4::white);
+ }
+ }
+ }
+ }
+ gGL.color4fv(line_color.mV);
+ }
+
+ // now render projected object axis
+ if (mInSnapRegime)
+ {
+ LLVector3 object_axis;
+ getObjectAxisClosestToMouse(object_axis);
+
+ // project onto constraint plane
+ LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE);
+ object_axis = object_axis * first_node->getObject()->getRenderRotation();
+ object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis();
+ object_axis.normVec();
+ object_axis = object_axis * SNAP_GUIDE_INNER_RADIUS * mRadiusMeters + center;
+ LLVector3 line_start = center;
+
+ gGL.begin(LLRender::LINES);
+ {
+ gGL.vertex3fv(line_start.mV);
+ gGL.vertex3fv(object_axis.mV);
+ }
+ gGL.end();
+
+ // draw snap guide arrow
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ LLVector3 arrow_dir;
+ LLVector3 arrow_span = (object_axis - line_start) % getConstraintAxis();
+ arrow_span.normVec();
+
+ arrow_dir = mCamEdgeOn ? getConstraintAxis() : object_axis - line_start;
+ arrow_dir.normVec();
+ if (ring_num == 1)
+ {
+ arrow_dir *= -1.f;
+ }
+ gGL.vertex3fv((object_axis + arrow_dir * mRadiusMeters * 0.1f).mV);
+ gGL.vertex3fv((object_axis + arrow_span * mRadiusMeters * 0.1f).mV);
+ gGL.vertex3fv((object_axis - arrow_span * mRadiusMeters * 0.1f).mV);
+ }
+ gGL.end();
+
+ {
+ LLGLDepthTest gls_depth(GL_TRUE);
+ gGL.begin(LLRender::LINES);
+ {
+ gGL.vertex3fv(line_start.mV);
+ gGL.vertex3fv(object_axis.mV);
+ }
+ gGL.end();
+
+ // draw snap guide arrow
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ LLVector3 arrow_dir;
+ LLVector3 arrow_span = (object_axis - line_start) % getConstraintAxis();
+ arrow_span.normVec();
+
+ arrow_dir = mCamEdgeOn ? getConstraintAxis() : object_axis - line_start;
+ arrow_dir.normVec();
+ if (ring_num == 1)
+ {
+ arrow_dir *= -1.f;
+ }
+
+ gGL.vertex3fv((object_axis + arrow_dir * mRadiusMeters * 0.1f).mV);
+ gGL.vertex3fv((object_axis + arrow_span * mRadiusMeters * 0.1f).mV);
+ gGL.vertex3fv((object_axis - arrow_span * mRadiusMeters * 0.1f).mV);
+ }
+ gGL.end();
+ }
+ }
+ }
+ }
+
+
+ // render help text
+ if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
+ {
+ if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
+ {
+ LLVector3 selection_center_start = LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
+
+ LLVector3 offset_dir = LLViewerCamera::getInstance()->getUpAxis();
+
+ F32 line_alpha = gSavedSettings.getF32("GridOpacity");
+
+ LLVector3 help_text_pos = selection_center_start + (mRadiusMeters * 3.f * offset_dir);
+ const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
+
+ std::string help_text = LLTrans::getString("manip_hint1");
+ LLColor4 help_text_color = LLColor4::white;
+ help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
+ hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
+ help_text = LLTrans::getString("manip_hint2");
+ help_text_pos -= offset_dir * mRadiusMeters * 0.4f;
+ hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
+ }
+ }
}
// Returns TRUE if center of sphere is visible. Also sets a bunch of member variables that are used later (e.g. mCenterToCam)
BOOL LLManipRotate::updateVisiblity()
{
- // Don't want to recalculate the center of the selection during a drag.
- // Due to packet delays, sometimes half the objects in the selection have their
- // new position and half have their old one. This creates subtle errors in the
- // computed center position for that frame. Unfortunately, these errors
- // accumulate. The result is objects seem to "fly apart" during rotations.
- // JC - 03.26.2002
- if (!hasMouseCapture())
- {
- mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() );//LLSelectMgr::getInstance()->getSelectionCenterGlobal();
- }
-
- BOOL visible = FALSE;
-
- //Assume that UI scale factor is equivalent for X and Y axis
- F32 ui_scale_factor = LLUI::getScaleFactor().mV[VX];
-
- LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- mCenterToCam = LLVector3(-1.f / gAgentCamera.mHUDCurZoom, 0.f, 0.f);
- mCenterToCamNorm = mCenterToCam;
- mCenterToCamMag = mCenterToCamNorm.normVec();
-
- mRadiusMeters = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
- mRadiusMeters /= gAgentCamera.mHUDCurZoom;
- mRadiusMeters *= ui_scale_factor;
-
- mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag;
- mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm;
-
- // x axis range is (-aspect * 0.5f, +aspect * 0.5)
- // y axis range is (-0.5, 0.5)
- // so use getWorldViewHeightRaw as scale factor when converting to pixel coordinates
- mCenterScreen.set((S32)((0.5f - center.mV[VY]) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()),
- (S32)((center.mV[VZ] + 0.5f) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()));
- visible = TRUE;
- }
- else
- {
- visible = LLViewerCamera::getInstance()->projectPosAgentToScreen(center, mCenterScreen );
- if( visible )
- {
- mCenterToCam = gAgentCamera.getCameraPositionAgent() - center;
- mCenterToCamNorm = mCenterToCam;
- mCenterToCamMag = mCenterToCamNorm.normVec();
- LLVector3 cameraAtAxis = LLViewerCamera::getInstance()->getAtAxis();
- cameraAtAxis.normVec();
-
- F32 z_dist = -1.f * (mCenterToCam * cameraAtAxis);
-
- // Don't drag manip if object too far away
- if (gSavedSettings.getBOOL("LimitSelectDistance"))
- {
- F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance");
- if (dist_vec_squared(gAgent.getPositionAgent(), center) > (max_select_distance * max_select_distance))
- {
- visible = FALSE;
- }
- }
-
- if (mCenterToCamMag > 0.001f)
- {
- F32 fraction_of_fov = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
- F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians
- mRadiusMeters = z_dist * tan(apparent_angle);
- mRadiusMeters *= ui_scale_factor;
-
- mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag;
- mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm;
- }
- else
- {
- visible = FALSE;
- }
- }
- }
-
- mCamEdgeOn = FALSE;
- F32 axis_onto_cam = mManipPart >= LL_ROT_X ? llabs( getConstraintAxis() * mCenterToCamNorm ) : 0.f;
- if( axis_onto_cam < AXIS_ONTO_CAM_TOLERANCE )
- {
- mCamEdgeOn = TRUE;
- }
-
- return visible;
+ // Don't want to recalculate the center of the selection during a drag.
+ // Due to packet delays, sometimes half the objects in the selection have their
+ // new position and half have their old one. This creates subtle errors in the
+ // computed center position for that frame. Unfortunately, these errors
+ // accumulate. The result is objects seem to "fly apart" during rotations.
+ // JC - 03.26.2002
+ if (!hasMouseCapture())
+ {
+ mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() );//LLSelectMgr::getInstance()->getSelectionCenterGlobal();
+ }
+
+ BOOL visible = FALSE;
+
+ //Assume that UI scale factor is equivalent for X and Y axis
+ F32 ui_scale_factor = LLUI::getScaleFactor().mV[VX];
+
+ LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ mCenterToCam = LLVector3(-1.f / gAgentCamera.mHUDCurZoom, 0.f, 0.f);
+ mCenterToCamNorm = mCenterToCam;
+ mCenterToCamMag = mCenterToCamNorm.normVec();
+
+ mRadiusMeters = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
+ mRadiusMeters /= gAgentCamera.mHUDCurZoom;
+ mRadiusMeters *= ui_scale_factor;
+
+ mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag;
+ mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm;
+
+ // x axis range is (-aspect * 0.5f, +aspect * 0.5)
+ // y axis range is (-0.5, 0.5)
+ // so use getWorldViewHeightRaw as scale factor when converting to pixel coordinates
+ mCenterScreen.set((S32)((0.5f - center.mV[VY]) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()),
+ (S32)((center.mV[VZ] + 0.5f) / gAgentCamera.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()));
+ visible = TRUE;
+ }
+ else
+ {
+ visible = LLViewerCamera::getInstance()->projectPosAgentToScreen(center, mCenterScreen );
+ if( visible )
+ {
+ mCenterToCam = gAgentCamera.getCameraPositionAgent() - center;
+ mCenterToCamNorm = mCenterToCam;
+ mCenterToCamMag = mCenterToCamNorm.normVec();
+ LLVector3 cameraAtAxis = LLViewerCamera::getInstance()->getAtAxis();
+ cameraAtAxis.normVec();
+
+ F32 z_dist = -1.f * (mCenterToCam * cameraAtAxis);
+
+ // Don't drag manip if object too far away
+ if (gSavedSettings.getBOOL("LimitSelectDistance"))
+ {
+ F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance");
+ if (dist_vec_squared(gAgent.getPositionAgent(), center) > (max_select_distance * max_select_distance))
+ {
+ visible = FALSE;
+ }
+ }
+
+ if (mCenterToCamMag > 0.001f)
+ {
+ F32 fraction_of_fov = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
+ F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians
+ mRadiusMeters = z_dist * tan(apparent_angle);
+ mRadiusMeters *= ui_scale_factor;
+
+ mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag;
+ mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm;
+ }
+ else
+ {
+ visible = FALSE;
+ }
+ }
+ }
+
+ mCamEdgeOn = FALSE;
+ F32 axis_onto_cam = mManipPart >= LL_ROT_X ? llabs( getConstraintAxis() * mCenterToCamNorm ) : 0.f;
+ if( axis_onto_cam < AXIS_ONTO_CAM_TOLERANCE )
+ {
+ mCamEdgeOn = TRUE;
+ }
+
+ return visible;
}
LLQuaternion LLManipRotate::dragUnconstrained( S32 x, S32 y )
{
- LLVector3 cam = gAgentCamera.getCameraPositionAgent();
- LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
-
- mMouseCur = intersectMouseWithSphere( x, y, center, mRadiusMeters);
-
- F32 delta_x = (F32)(mCenterScreen.mX - x);
- F32 delta_y = (F32)(mCenterScreen.mY - y);
-
- F32 dist_from_sphere_center = sqrt(delta_x * delta_x + delta_y * delta_y);
-
- LLVector3 axis = mMouseDown % mMouseCur;
- F32 angle = atan2(sqrtf(axis * axis), mMouseDown * mMouseCur);
- axis.normVec();
- LLQuaternion sphere_rot( angle, axis );
-
- if (is_approx_zero(1.f - mMouseDown * mMouseCur))
- {
- return LLQuaternion::DEFAULT;
- }
- else if (dist_from_sphere_center < RADIUS_PIXELS)
- {
- return sphere_rot;
- }
- else
- {
- LLVector3 intersection;
- getMousePointOnPlaneAgent( intersection, x, y, center + mCenterToProfilePlane, mCenterToCamNorm );
-
- // amount dragging in sphere from center to periphery would rotate object
- F32 in_sphere_angle = F_PI_BY_TWO;
- F32 dist_to_tangent_point = mRadiusMeters;
- if( !is_approx_zero( mCenterToProfilePlaneMag ) )
- {
- dist_to_tangent_point = sqrt( mRadiusMeters * mRadiusMeters - mCenterToProfilePlaneMag * mCenterToProfilePlaneMag );
- in_sphere_angle = atan2( dist_to_tangent_point, mCenterToProfilePlaneMag );
- }
-
- LLVector3 profile_center_to_intersection = intersection - (center + mCenterToProfilePlane);
- F32 dist_to_intersection = profile_center_to_intersection.normVec();
- F32 angle = (-1.f + dist_to_intersection / dist_to_tangent_point) * in_sphere_angle;
-
- LLVector3 axis;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- axis = LLVector3(-1.f, 0.f, 0.f) % profile_center_to_intersection;
- }
- else
- {
- axis = (cam - center) % profile_center_to_intersection;
- axis.normVec();
- }
- return sphere_rot * LLQuaternion( angle, axis );
- }
+ LLVector3 cam = gAgentCamera.getCameraPositionAgent();
+ LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
+
+ mMouseCur = intersectMouseWithSphere( x, y, center, mRadiusMeters);
+
+ F32 delta_x = (F32)(mCenterScreen.mX - x);
+ F32 delta_y = (F32)(mCenterScreen.mY - y);
+
+ F32 dist_from_sphere_center = sqrt(delta_x * delta_x + delta_y * delta_y);
+
+ LLVector3 axis = mMouseDown % mMouseCur;
+ F32 angle = atan2(sqrtf(axis * axis), mMouseDown * mMouseCur);
+ axis.normVec();
+ LLQuaternion sphere_rot( angle, axis );
+
+ if (is_approx_zero(1.f - mMouseDown * mMouseCur))
+ {
+ return LLQuaternion::DEFAULT;
+ }
+ else if (dist_from_sphere_center < RADIUS_PIXELS)
+ {
+ return sphere_rot;
+ }
+ else
+ {
+ LLVector3 intersection;
+ getMousePointOnPlaneAgent( intersection, x, y, center + mCenterToProfilePlane, mCenterToCamNorm );
+
+ // amount dragging in sphere from center to periphery would rotate object
+ F32 in_sphere_angle = F_PI_BY_TWO;
+ F32 dist_to_tangent_point = mRadiusMeters;
+ if( !is_approx_zero( mCenterToProfilePlaneMag ) )
+ {
+ dist_to_tangent_point = sqrt( mRadiusMeters * mRadiusMeters - mCenterToProfilePlaneMag * mCenterToProfilePlaneMag );
+ in_sphere_angle = atan2( dist_to_tangent_point, mCenterToProfilePlaneMag );
+ }
+
+ LLVector3 profile_center_to_intersection = intersection - (center + mCenterToProfilePlane);
+ F32 dist_to_intersection = profile_center_to_intersection.normVec();
+ F32 angle = (-1.f + dist_to_intersection / dist_to_tangent_point) * in_sphere_angle;
+
+ LLVector3 axis;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ axis = LLVector3(-1.f, 0.f, 0.f) % profile_center_to_intersection;
+ }
+ else
+ {
+ axis = (cam - center) % profile_center_to_intersection;
+ axis.normVec();
+ }
+ return sphere_rot * LLQuaternion( angle, axis );
+ }
}
LLVector3 LLManipRotate::getConstraintAxis()
{
- LLVector3 axis;
- if( LL_ROT_ROLL == mManipPart )
- {
- axis = mCenterToCamNorm;
- }
- else
- {
- S32 axis_dir = mManipPart - LL_ROT_X;
- if ((axis_dir >= LL_NO_PART) && (axis_dir < LL_Z_ARROW))
- {
- axis.mV[axis_dir] = 1.f;
- }
- else
- {
+ LLVector3 axis;
+ if( LL_ROT_ROLL == mManipPart )
+ {
+ axis = mCenterToCamNorm;
+ }
+ else
+ {
+ S32 axis_dir = mManipPart - LL_ROT_X;
+ if ((axis_dir >= LL_NO_PART) && (axis_dir < LL_Z_ARROW))
+ {
+ axis.mV[axis_dir] = 1.f;
+ }
+ else
+ {
#ifndef LL_RELEASE_FOR_DOWNLOAD
- LL_ERRS() << "Got bogus hit part in LLManipRotate::getConstraintAxis():" << mManipPart << LL_ENDL;
+ LL_ERRS() << "Got bogus hit part in LLManipRotate::getConstraintAxis():" << mManipPart << LL_ENDL;
#else
- LL_WARNS() << "Got bogus hit part in LLManipRotate::getConstraintAxis():" << mManipPart << LL_ENDL;
+ LL_WARNS() << "Got bogus hit part in LLManipRotate::getConstraintAxis():" << mManipPart << LL_ENDL;
#endif
- axis.mV[0] = 1.f;
- }
-
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
-
- LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE);
- if (first_node)
- {
- // *FIX: get agent local attachment grid working
- // Put rotation into frame of first selected root object
- axis = axis * grid_rotation;
- }
- }
+ axis.mV[0] = 1.f;
+ }
+
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+
+ LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE);
+ if (first_node)
+ {
+ // *FIX: get agent local attachment grid working
+ // Put rotation into frame of first selected root object
+ axis = axis * grid_rotation;
+ }
+ }
- return axis;
+ return axis;
}
LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
{
- LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE);
- LLVector3 constraint_axis = getConstraintAxis();
- LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
-
- F32 angle = 0.f;
-
- // build snap axes
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
-
- LLVector3 axis1;
- LLVector3 axis2;
-
- LLVector3 test_axis = constraint_axis;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
- {
- test_axis = test_axis * ~grid_rotation;
- }
- else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT)
- {
- test_axis = test_axis * ~grid_rotation;
- }
- test_axis.abs();
-
- // find closest global axis to constraint axis;
- if (test_axis.mV[VX] > test_axis.mV[VY] && test_axis.mV[VX] > test_axis.mV[VZ])
- {
- axis1 = LLVector3::y_axis;
- }
- else if (test_axis.mV[VY] > test_axis.mV[VZ])
- {
- axis1 = LLVector3::z_axis;
- }
- else
- {
- axis1 = LLVector3::x_axis;
- }
-
- if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
- {
- axis1 = axis1 * grid_rotation;
- }
- else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT)
- {
- axis1 = axis1 * grid_rotation;
- }
-
- //project axis onto constraint plane
- axis1 -= (axis1 * constraint_axis) * constraint_axis;
- axis1.normVec();
-
- // calculate third and final axis
- axis2 = constraint_axis % axis1;
-
- //F32 axis_onto_cam = llabs( constraint_axis * mCenterToCamNorm );
- if( mCamEdgeOn )
- {
- // We're looking at the ring edge-on.
- LLVector3 snap_plane_center = (center + (constraint_axis * mRadiusMeters * 0.5f));
- LLVector3 cam_to_snap_plane;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- cam_to_snap_plane.setVec(1.f, 0.f, 0.f);
- }
- else
- {
- cam_to_snap_plane = snap_plane_center - gAgentCamera.getCameraPositionAgent();
- cam_to_snap_plane.normVec();
- }
-
- LLVector3 projected_mouse;
- BOOL hit = getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, constraint_axis);
- projected_mouse -= snap_plane_center;
-
- if (gSavedSettings.getBOOL("SnapEnabled")) {
- S32 snap_plane = 0;
-
- F32 dot = cam_to_snap_plane * constraint_axis;
- if (llabs(dot) < 0.01f)
- {
- // looking at ring edge on, project onto view plane and check if mouse is past ring
- getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, cam_to_snap_plane);
- projected_mouse -= snap_plane_center;
- dot = projected_mouse * constraint_axis;
- if (projected_mouse * constraint_axis > 0)
- {
- snap_plane = 1;
- }
- projected_mouse -= dot * constraint_axis;
- }
- else if (dot > 0.f)
- {
- // look for mouse position outside and in front of snap circle
- if (hit && projected_mouse.magVec() > SNAP_GUIDE_INNER_RADIUS * mRadiusMeters && projected_mouse * cam_to_snap_plane < 0.f)
- {
- snap_plane = 1;
- }
- }
- else
- {
- // look for mouse position inside or in back of snap circle
- if (projected_mouse.magVec() < SNAP_GUIDE_INNER_RADIUS * mRadiusMeters || projected_mouse * cam_to_snap_plane > 0.f || !hit)
- {
- snap_plane = 1;
- }
- }
-
- if (snap_plane == 0)
- {
- // try other plane
- snap_plane_center = (center - (constraint_axis * mRadiusMeters * 0.5f));
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- cam_to_snap_plane.setVec(1.f, 0.f, 0.f);
- }
- else
- {
- cam_to_snap_plane = snap_plane_center - gAgentCamera.getCameraPositionAgent();
- cam_to_snap_plane.normVec();
- }
-
- hit = getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, constraint_axis);
- projected_mouse -= snap_plane_center;
-
- dot = cam_to_snap_plane * constraint_axis;
- if (llabs(dot) < 0.01f)
- {
- // looking at ring edge on, project onto view plane and check if mouse is past ring
- getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, cam_to_snap_plane);
- projected_mouse -= snap_plane_center;
- dot = projected_mouse * constraint_axis;
- if (projected_mouse * constraint_axis < 0)
- {
- snap_plane = 2;
- }
- projected_mouse -= dot * constraint_axis;
- }
- else if (dot < 0.f)
- {
- // look for mouse position outside and in front of snap circle
- if (hit && projected_mouse.magVec() > SNAP_GUIDE_INNER_RADIUS * mRadiusMeters && projected_mouse * cam_to_snap_plane < 0.f)
- {
- snap_plane = 2;
- }
- }
- else
- {
- // look for mouse position inside or in back of snap circle
- if (projected_mouse.magVec() < SNAP_GUIDE_INNER_RADIUS * mRadiusMeters || projected_mouse * cam_to_snap_plane > 0.f || !hit)
- {
- snap_plane = 2;
- }
- }
- }
-
- if (snap_plane > 0)
- {
- LLVector3 cam_at_axis;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- cam_at_axis.setVec(1.f, 0.f, 0.f);
- }
- else
- {
- cam_at_axis = snap_plane_center - gAgentCamera.getCameraPositionAgent();
- cam_at_axis.normVec();
- }
-
- // first, project mouse onto screen plane at point tangent to rotation radius.
- getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, cam_at_axis);
- // project that point onto rotation plane
- projected_mouse -= snap_plane_center;
- projected_mouse -= projected_vec(projected_mouse, constraint_axis);
-
- F32 mouse_lateral_dist = llmin(SNAP_GUIDE_INNER_RADIUS * mRadiusMeters, projected_mouse.magVec());
- F32 mouse_depth = SNAP_GUIDE_INNER_RADIUS * mRadiusMeters;
- if (llabs(mouse_lateral_dist) > 0.01f)
- {
- mouse_depth = sqrtf((SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) * (SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) -
- (mouse_lateral_dist * mouse_lateral_dist));
- }
- LLVector3 projected_camera_at = cam_at_axis - projected_vec(cam_at_axis, constraint_axis);
- projected_mouse -= mouse_depth * projected_camera_at;
-
- if (!mInSnapRegime)
- {
- mSmoothRotate = TRUE;
- }
- mInSnapRegime = TRUE;
- // 0 to 360 deg
- F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f);
-
- F32 relative_mouse_angle = fmodf(mouse_angle + (SNAP_ANGLE_DETENTE / 2), SNAP_ANGLE_INCREMENT);
-
- LLVector3 object_axis;
- getObjectAxisClosestToMouse(object_axis);
+ LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE);
+ LLVector3 constraint_axis = getConstraintAxis();
+ LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
+
+ F32 angle = 0.f;
+
+ // build snap axes
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+
+ LLVector3 axis1;
+ LLVector3 axis2;
+
+ LLVector3 test_axis = constraint_axis;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
+ {
+ test_axis = test_axis * ~grid_rotation;
+ }
+ else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT)
+ {
+ test_axis = test_axis * ~grid_rotation;
+ }
+ test_axis.abs();
+
+ // find closest global axis to constraint axis;
+ if (test_axis.mV[VX] > test_axis.mV[VY] && test_axis.mV[VX] > test_axis.mV[VZ])
+ {
+ axis1 = LLVector3::y_axis;
+ }
+ else if (test_axis.mV[VY] > test_axis.mV[VZ])
+ {
+ axis1 = LLVector3::z_axis;
+ }
+ else
+ {
+ axis1 = LLVector3::x_axis;
+ }
+
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
+ {
+ axis1 = axis1 * grid_rotation;
+ }
+ else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT)
+ {
+ axis1 = axis1 * grid_rotation;
+ }
+
+ //project axis onto constraint plane
+ axis1 -= (axis1 * constraint_axis) * constraint_axis;
+ axis1.normVec();
+
+ // calculate third and final axis
+ axis2 = constraint_axis % axis1;
+
+ //F32 axis_onto_cam = llabs( constraint_axis * mCenterToCamNorm );
+ if( mCamEdgeOn )
+ {
+ // We're looking at the ring edge-on.
+ LLVector3 snap_plane_center = (center + (constraint_axis * mRadiusMeters * 0.5f));
+ LLVector3 cam_to_snap_plane;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ cam_to_snap_plane.setVec(1.f, 0.f, 0.f);
+ }
+ else
+ {
+ cam_to_snap_plane = snap_plane_center - gAgentCamera.getCameraPositionAgent();
+ cam_to_snap_plane.normVec();
+ }
+
+ LLVector3 projected_mouse;
+ BOOL hit = getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, constraint_axis);
+ projected_mouse -= snap_plane_center;
+
+ if (gSavedSettings.getBOOL("SnapEnabled")) {
+ S32 snap_plane = 0;
+
+ F32 dot = cam_to_snap_plane * constraint_axis;
+ if (llabs(dot) < 0.01f)
+ {
+ // looking at ring edge on, project onto view plane and check if mouse is past ring
+ getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, cam_to_snap_plane);
+ projected_mouse -= snap_plane_center;
+ dot = projected_mouse * constraint_axis;
+ if (projected_mouse * constraint_axis > 0)
+ {
+ snap_plane = 1;
+ }
+ projected_mouse -= dot * constraint_axis;
+ }
+ else if (dot > 0.f)
+ {
+ // look for mouse position outside and in front of snap circle
+ if (hit && projected_mouse.magVec() > SNAP_GUIDE_INNER_RADIUS * mRadiusMeters && projected_mouse * cam_to_snap_plane < 0.f)
+ {
+ snap_plane = 1;
+ }
+ }
+ else
+ {
+ // look for mouse position inside or in back of snap circle
+ if (projected_mouse.magVec() < SNAP_GUIDE_INNER_RADIUS * mRadiusMeters || projected_mouse * cam_to_snap_plane > 0.f || !hit)
+ {
+ snap_plane = 1;
+ }
+ }
+
+ if (snap_plane == 0)
+ {
+ // try other plane
+ snap_plane_center = (center - (constraint_axis * mRadiusMeters * 0.5f));
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ cam_to_snap_plane.setVec(1.f, 0.f, 0.f);
+ }
+ else
+ {
+ cam_to_snap_plane = snap_plane_center - gAgentCamera.getCameraPositionAgent();
+ cam_to_snap_plane.normVec();
+ }
+
+ hit = getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, constraint_axis);
+ projected_mouse -= snap_plane_center;
+
+ dot = cam_to_snap_plane * constraint_axis;
+ if (llabs(dot) < 0.01f)
+ {
+ // looking at ring edge on, project onto view plane and check if mouse is past ring
+ getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, cam_to_snap_plane);
+ projected_mouse -= snap_plane_center;
+ dot = projected_mouse * constraint_axis;
+ if (projected_mouse * constraint_axis < 0)
+ {
+ snap_plane = 2;
+ }
+ projected_mouse -= dot * constraint_axis;
+ }
+ else if (dot < 0.f)
+ {
+ // look for mouse position outside and in front of snap circle
+ if (hit && projected_mouse.magVec() > SNAP_GUIDE_INNER_RADIUS * mRadiusMeters && projected_mouse * cam_to_snap_plane < 0.f)
+ {
+ snap_plane = 2;
+ }
+ }
+ else
+ {
+ // look for mouse position inside or in back of snap circle
+ if (projected_mouse.magVec() < SNAP_GUIDE_INNER_RADIUS * mRadiusMeters || projected_mouse * cam_to_snap_plane > 0.f || !hit)
+ {
+ snap_plane = 2;
+ }
+ }
+ }
+
+ if (snap_plane > 0)
+ {
+ LLVector3 cam_at_axis;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ cam_at_axis.setVec(1.f, 0.f, 0.f);
+ }
+ else
+ {
+ cam_at_axis = snap_plane_center - gAgentCamera.getCameraPositionAgent();
+ cam_at_axis.normVec();
+ }
+
+ // first, project mouse onto screen plane at point tangent to rotation radius.
+ getMousePointOnPlaneAgent(projected_mouse, x, y, snap_plane_center, cam_at_axis);
+ // project that point onto rotation plane
+ projected_mouse -= snap_plane_center;
+ projected_mouse -= projected_vec(projected_mouse, constraint_axis);
+
+ F32 mouse_lateral_dist = llmin(SNAP_GUIDE_INNER_RADIUS * mRadiusMeters, projected_mouse.magVec());
+ F32 mouse_depth = SNAP_GUIDE_INNER_RADIUS * mRadiusMeters;
+ if (llabs(mouse_lateral_dist) > 0.01f)
+ {
+ mouse_depth = sqrtf((SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) * (SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) -
+ (mouse_lateral_dist * mouse_lateral_dist));
+ }
+ LLVector3 projected_camera_at = cam_at_axis - projected_vec(cam_at_axis, constraint_axis);
+ projected_mouse -= mouse_depth * projected_camera_at;
+
+ if (!mInSnapRegime)
+ {
+ mSmoothRotate = TRUE;
+ }
+ mInSnapRegime = TRUE;
+ // 0 to 360 deg
+ F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f);
+
+ F32 relative_mouse_angle = fmodf(mouse_angle + (SNAP_ANGLE_DETENTE / 2), SNAP_ANGLE_INCREMENT);
+
+ LLVector3 object_axis;
+ getObjectAxisClosestToMouse(object_axis);
if (first_object_node)
{
object_axis = object_axis * first_object_node->mSavedRotation;
}
-
- // project onto constraint plane
- object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis();
- object_axis.normVec();
-
- if (relative_mouse_angle < SNAP_ANGLE_DETENTE)
- {
- F32 quantized_mouse_angle = mouse_angle - (relative_mouse_angle - (SNAP_ANGLE_DETENTE * 0.5f));
- angle = (quantized_mouse_angle * DEG_TO_RAD) - atan2(object_axis * axis1, object_axis * axis2);
- }
- else
- {
- angle = (mouse_angle * DEG_TO_RAD) - atan2(object_axis * axis1, object_axis * axis2);
- }
- return LLQuaternion( -angle, constraint_axis );
- }
- else
- {
- if (mInSnapRegime)
- {
- mSmoothRotate = TRUE;
- }
- mInSnapRegime = FALSE;
- }
- }
- else {
- if (mInSnapRegime)
- {
- mSmoothRotate = TRUE;
- }
- mInSnapRegime = FALSE;
- }
-
- if (!mInSnapRegime)
- {
- LLVector3 up_from_axis = mCenterToCamNorm % constraint_axis;
- up_from_axis.normVec();
- LLVector3 cur_intersection;
- getMousePointOnPlaneAgent(cur_intersection, x, y, center, mCenterToCam);
- cur_intersection -= center;
- mMouseCur = projected_vec(cur_intersection, up_from_axis);
- F32 mouse_depth = SNAP_GUIDE_INNER_RADIUS * mRadiusMeters;
- F32 mouse_dist_sqrd = mMouseCur.magVecSquared();
- if (mouse_dist_sqrd > 0.0001f)
- {
- mouse_depth = sqrtf((SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) * (SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) -
- mouse_dist_sqrd);
- }
- LLVector3 projected_center_to_cam = mCenterToCamNorm - projected_vec(mCenterToCamNorm, constraint_axis);
- mMouseCur += mouse_depth * projected_center_to_cam;
-
- F32 dist = (cur_intersection * up_from_axis) - (mMouseDown * up_from_axis);
- angle = dist / (SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) * -F_PI_BY_TWO;
- }
- }
- else
- {
- LLVector3 projected_mouse;
- getMousePointOnPlaneAgent(projected_mouse, x, y, center, constraint_axis);
- projected_mouse -= center;
- mMouseCur = projected_mouse;
- mMouseCur.normVec();
-
- if (!first_object_node)
- {
- return LLQuaternion::DEFAULT;
- }
-
- if (gSavedSettings.getBOOL("SnapEnabled") && projected_mouse.magVec() > SNAP_GUIDE_INNER_RADIUS * mRadiusMeters)
- {
- if (!mInSnapRegime)
- {
- mSmoothRotate = TRUE;
- }
- mInSnapRegime = TRUE;
- // 0 to 360 deg
- F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f);
-
- F32 relative_mouse_angle = fmodf(mouse_angle + (SNAP_ANGLE_DETENTE / 2), SNAP_ANGLE_INCREMENT);
-
- LLVector3 object_axis;
- getObjectAxisClosestToMouse(object_axis);
- object_axis = object_axis * first_object_node->mSavedRotation;
-
- // project onto constraint plane
- object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis();
- object_axis.normVec();
-
- if (relative_mouse_angle < SNAP_ANGLE_DETENTE)
- {
- F32 quantized_mouse_angle = mouse_angle - (relative_mouse_angle - (SNAP_ANGLE_DETENTE * 0.5f));
- angle = (quantized_mouse_angle * DEG_TO_RAD) - atan2(object_axis * axis1, object_axis * axis2);
- }
- else
- {
- angle = (mouse_angle * DEG_TO_RAD) - atan2(object_axis * axis1, object_axis * axis2);
- }
- return LLQuaternion( -angle, constraint_axis );
- }
- else
- {
- if (mInSnapRegime)
- {
- mSmoothRotate = TRUE;
- }
- mInSnapRegime = FALSE;
- }
-
- LLVector3 cross_product = mMouseDown % mMouseCur;
- angle = atan2(sqrtf(cross_product * cross_product), mMouseCur * mMouseDown);
- F32 dir = cross_product * constraint_axis; // cross product
- if( dir < 0.f )
- {
- angle *= -1.f;
- }
- }
-
- F32 rot_step = gSavedSettings.getF32("RotationStep");
- F32 step_size = DEG_TO_RAD * rot_step;
- angle -= fmod(angle, step_size);
-
- return LLQuaternion( angle, constraint_axis );
+
+ // project onto constraint plane
+ object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis();
+ object_axis.normVec();
+
+ if (relative_mouse_angle < SNAP_ANGLE_DETENTE)
+ {
+ F32 quantized_mouse_angle = mouse_angle - (relative_mouse_angle - (SNAP_ANGLE_DETENTE * 0.5f));
+ angle = (quantized_mouse_angle * DEG_TO_RAD) - atan2(object_axis * axis1, object_axis * axis2);
+ }
+ else
+ {
+ angle = (mouse_angle * DEG_TO_RAD) - atan2(object_axis * axis1, object_axis * axis2);
+ }
+ return LLQuaternion( -angle, constraint_axis );
+ }
+ else
+ {
+ if (mInSnapRegime)
+ {
+ mSmoothRotate = TRUE;
+ }
+ mInSnapRegime = FALSE;
+ }
+ }
+ else {
+ if (mInSnapRegime)
+ {
+ mSmoothRotate = TRUE;
+ }
+ mInSnapRegime = FALSE;
+ }
+
+ if (!mInSnapRegime)
+ {
+ LLVector3 up_from_axis = mCenterToCamNorm % constraint_axis;
+ up_from_axis.normVec();
+ LLVector3 cur_intersection;
+ getMousePointOnPlaneAgent(cur_intersection, x, y, center, mCenterToCam);
+ cur_intersection -= center;
+ mMouseCur = projected_vec(cur_intersection, up_from_axis);
+ F32 mouse_depth = SNAP_GUIDE_INNER_RADIUS * mRadiusMeters;
+ F32 mouse_dist_sqrd = mMouseCur.magVecSquared();
+ if (mouse_dist_sqrd > 0.0001f)
+ {
+ mouse_depth = sqrtf((SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) * (SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) -
+ mouse_dist_sqrd);
+ }
+ LLVector3 projected_center_to_cam = mCenterToCamNorm - projected_vec(mCenterToCamNorm, constraint_axis);
+ mMouseCur += mouse_depth * projected_center_to_cam;
+
+ F32 dist = (cur_intersection * up_from_axis) - (mMouseDown * up_from_axis);
+ angle = dist / (SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) * -F_PI_BY_TWO;
+ }
+ }
+ else
+ {
+ LLVector3 projected_mouse;
+ getMousePointOnPlaneAgent(projected_mouse, x, y, center, constraint_axis);
+ projected_mouse -= center;
+ mMouseCur = projected_mouse;
+ mMouseCur.normVec();
+
+ if (!first_object_node)
+ {
+ return LLQuaternion::DEFAULT;
+ }
+
+ if (gSavedSettings.getBOOL("SnapEnabled") && projected_mouse.magVec() > SNAP_GUIDE_INNER_RADIUS * mRadiusMeters)
+ {
+ if (!mInSnapRegime)
+ {
+ mSmoothRotate = TRUE;
+ }
+ mInSnapRegime = TRUE;
+ // 0 to 360 deg
+ F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f);
+
+ F32 relative_mouse_angle = fmodf(mouse_angle + (SNAP_ANGLE_DETENTE / 2), SNAP_ANGLE_INCREMENT);
+
+ LLVector3 object_axis;
+ getObjectAxisClosestToMouse(object_axis);
+ object_axis = object_axis * first_object_node->mSavedRotation;
+
+ // project onto constraint plane
+ object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis();
+ object_axis.normVec();
+
+ if (relative_mouse_angle < SNAP_ANGLE_DETENTE)
+ {
+ F32 quantized_mouse_angle = mouse_angle - (relative_mouse_angle - (SNAP_ANGLE_DETENTE * 0.5f));
+ angle = (quantized_mouse_angle * DEG_TO_RAD) - atan2(object_axis * axis1, object_axis * axis2);
+ }
+ else
+ {
+ angle = (mouse_angle * DEG_TO_RAD) - atan2(object_axis * axis1, object_axis * axis2);
+ }
+ return LLQuaternion( -angle, constraint_axis );
+ }
+ else
+ {
+ if (mInSnapRegime)
+ {
+ mSmoothRotate = TRUE;
+ }
+ mInSnapRegime = FALSE;
+ }
+
+ LLVector3 cross_product = mMouseDown % mMouseCur;
+ angle = atan2(sqrtf(cross_product * cross_product), mMouseCur * mMouseDown);
+ F32 dir = cross_product * constraint_axis; // cross product
+ if( dir < 0.f )
+ {
+ angle *= -1.f;
+ }
+ }
+
+ F32 rot_step = gSavedSettings.getF32("RotationStep");
+ F32 step_size = DEG_TO_RAD * rot_step;
+ angle -= fmod(angle, step_size);
+
+ return LLQuaternion( angle, constraint_axis );
}
LLVector3 LLManipRotate::intersectMouseWithSphere( S32 x, S32 y, const LLVector3& sphere_center, F32 sphere_radius)
{
- LLVector3 ray_pt;
- LLVector3 ray_dir;
- mouseToRay( x, y, &ray_pt, &ray_dir);
- return intersectRayWithSphere( ray_pt, ray_dir, sphere_center, sphere_radius );
+ LLVector3 ray_pt;
+ LLVector3 ray_dir;
+ mouseToRay( x, y, &ray_pt, &ray_dir);
+ return intersectRayWithSphere( ray_pt, ray_dir, sphere_center, sphere_radius );
}
LLVector3 LLManipRotate::intersectRayWithSphere( const LLVector3& ray_pt, const LLVector3& ray_dir, const LLVector3& sphere_center, F32 sphere_radius)
{
- LLVector3 ray_pt_to_center = sphere_center - ray_pt;
- F32 center_distance = ray_pt_to_center.normVec();
-
- F32 dot = ray_dir * ray_pt_to_center;
-
- if (dot == 0.f)
- {
- return LLVector3::zero;
- }
-
- // point which ray hits plane centered on sphere origin, facing ray origin
- LLVector3 intersection_sphere_plane = ray_pt + (ray_dir * center_distance / dot);
- // vector from sphere origin to the point, normalized to sphere radius
- LLVector3 sphere_center_to_intersection = (intersection_sphere_plane - sphere_center) / sphere_radius;
-
- F32 dist_squared = sphere_center_to_intersection.magVecSquared();
- LLVector3 result;
-
- if (dist_squared > 1.f)
- {
- result = sphere_center_to_intersection;
- result.normVec();
- }
- else
- {
- result = sphere_center_to_intersection - ray_dir * sqrt(1.f - dist_squared);
- }
-
- return result;
+ LLVector3 ray_pt_to_center = sphere_center - ray_pt;
+ F32 center_distance = ray_pt_to_center.normVec();
+
+ F32 dot = ray_dir * ray_pt_to_center;
+
+ if (dot == 0.f)
+ {
+ return LLVector3::zero;
+ }
+
+ // point which ray hits plane centered on sphere origin, facing ray origin
+ LLVector3 intersection_sphere_plane = ray_pt + (ray_dir * center_distance / dot);
+ // vector from sphere origin to the point, normalized to sphere radius
+ LLVector3 sphere_center_to_intersection = (intersection_sphere_plane - sphere_center) / sphere_radius;
+
+ F32 dist_squared = sphere_center_to_intersection.magVecSquared();
+ LLVector3 result;
+
+ if (dist_squared > 1.f)
+ {
+ result = sphere_center_to_intersection;
+ result.normVec();
+ }
+ else
+ {
+ result = sphere_center_to_intersection - ray_dir * sqrt(1.f - dist_squared);
+ }
+
+ return result;
}
// Utility function. Should probably be moved to another class.
@@ -1718,233 +1718,233 @@ LLVector3 LLManipRotate::intersectRayWithSphere( const LLVector3& ray_pt, const
//static
void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir )
{
- if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD)
- {
- F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewRectScaled().getWidth()) - 0.5f) / gAgentCamera.mHUDCurZoom;
- F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewRectScaled().getHeight()) - 0.5f) / gAgentCamera.mHUDCurZoom;
-
- *ray_pt = LLVector3(-1.f, -mouse_x, mouse_y);
- *ray_dir = LLVector3(1.f, 0.f, 0.f);
- }
- else
- {
- *ray_pt = gAgentCamera.getCameraPositionAgent();
+ if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD)
+ {
+ F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewRectScaled().getWidth()) - 0.5f) / gAgentCamera.mHUDCurZoom;
+ F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewRectScaled().getHeight()) - 0.5f) / gAgentCamera.mHUDCurZoom;
+
+ *ray_pt = LLVector3(-1.f, -mouse_x, mouse_y);
+ *ray_dir = LLVector3(1.f, 0.f, 0.f);
+ }
+ else
+ {
+ *ray_pt = gAgentCamera.getCameraPositionAgent();
*ray_dir = gViewerWindow->mouseDirectionGlobal(x, y);
- }
+ }
}
void LLManipRotate::highlightManipulators( S32 x, S32 y )
{
- mHighlightedPart = LL_NO_PART;
-
- //LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
- LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE);
-
- if (!first_object)
- {
- return;
- }
-
- LLVector3 rotation_center = gAgent.getPosAgentFromGlobal(mRotationCenter);
- LLVector3 mouse_dir_x;
- LLVector3 mouse_dir_y;
- LLVector3 mouse_dir_z;
- LLVector3 intersection_roll;
-
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
-
- LLVector3 rot_x_axis = LLVector3::x_axis * grid_rotation;
- LLVector3 rot_y_axis = LLVector3::y_axis * grid_rotation;
- LLVector3 rot_z_axis = LLVector3::z_axis * grid_rotation;
-
- F32 proj_rot_x_axis = llabs(rot_x_axis * mCenterToCamNorm);
- F32 proj_rot_y_axis = llabs(rot_y_axis * mCenterToCamNorm);
- F32 proj_rot_z_axis = llabs(rot_z_axis * mCenterToCamNorm);
-
- F32 min_select_distance = 0.f;
- F32 cur_select_distance = 0.f;
-
- // test x
- getMousePointOnPlaneAgent(mouse_dir_x, x, y, rotation_center, rot_x_axis);
- mouse_dir_x -= rotation_center;
- // push intersection point out when working at obtuse angle to make ring easier to hit
- mouse_dir_x *= 1.f + (1.f - llabs(rot_x_axis * mCenterToCamNorm)) * 0.1f;
-
- // test y
- getMousePointOnPlaneAgent(mouse_dir_y, x, y, rotation_center, rot_y_axis);
- mouse_dir_y -= rotation_center;
- mouse_dir_y *= 1.f + (1.f - llabs(rot_y_axis * mCenterToCamNorm)) * 0.1f;
-
- // test z
- getMousePointOnPlaneAgent(mouse_dir_z, x, y, rotation_center, rot_z_axis);
- mouse_dir_z -= rotation_center;
- mouse_dir_z *= 1.f + (1.f - llabs(rot_z_axis * mCenterToCamNorm)) * 0.1f;
-
- // test roll
- getMousePointOnPlaneAgent(intersection_roll, x, y, rotation_center, mCenterToCamNorm);
- intersection_roll -= rotation_center;
-
- F32 dist_x = mouse_dir_x.normVec();
- F32 dist_y = mouse_dir_y.normVec();
- F32 dist_z = mouse_dir_z.normVec();
-
- F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeightScaled();
-
- if (llabs(dist_x - mRadiusMeters) * llmax(0.05f, proj_rot_x_axis) < distance_threshold)
- {
- // selected x
- cur_select_distance = dist_x * mouse_dir_x * mCenterToCamNorm;
- if (cur_select_distance >= -0.05f && (min_select_distance == 0.f || cur_select_distance > min_select_distance))
- {
- min_select_distance = cur_select_distance;
- mHighlightedPart = LL_ROT_X;
- }
- }
- if (llabs(dist_y - mRadiusMeters) * llmax(0.05f, proj_rot_y_axis) < distance_threshold)
- {
- // selected y
- cur_select_distance = dist_y * mouse_dir_y * mCenterToCamNorm;
- if (cur_select_distance >= -0.05f && (min_select_distance == 0.f || cur_select_distance > min_select_distance))
- {
- min_select_distance = cur_select_distance;
- mHighlightedPart = LL_ROT_Y;
- }
- }
- if (llabs(dist_z - mRadiusMeters) * llmax(0.05f, proj_rot_z_axis) < distance_threshold)
- {
- // selected z
- cur_select_distance = dist_z * mouse_dir_z * mCenterToCamNorm;
- if (cur_select_distance >= -0.05f && (min_select_distance == 0.f || cur_select_distance > min_select_distance))
- {
- min_select_distance = cur_select_distance;
- mHighlightedPart = LL_ROT_Z;
- }
- }
-
- // test for edge-on intersections
- if (proj_rot_x_axis < 0.05f)
- {
- if ((proj_rot_y_axis > 0.05f && (dist_y * llabs(mouse_dir_y * rot_x_axis) < distance_threshold) && dist_y < mRadiusMeters) ||
- (proj_rot_z_axis > 0.05f && (dist_z * llabs(mouse_dir_z * rot_x_axis) < distance_threshold) && dist_z < mRadiusMeters))
- {
- mHighlightedPart = LL_ROT_X;
- }
- }
-
- if (proj_rot_y_axis < 0.05f)
- {
- if ((proj_rot_x_axis > 0.05f && (dist_x * llabs(mouse_dir_x * rot_y_axis) < distance_threshold) && dist_x < mRadiusMeters) ||
- (proj_rot_z_axis > 0.05f && (dist_z * llabs(mouse_dir_z * rot_y_axis) < distance_threshold) && dist_z < mRadiusMeters))
- {
- mHighlightedPart = LL_ROT_Y;
- }
- }
-
- if (proj_rot_z_axis < 0.05f)
- {
- if ((proj_rot_x_axis > 0.05f && (dist_x * llabs(mouse_dir_x * rot_z_axis) < distance_threshold) && dist_x < mRadiusMeters) ||
- (proj_rot_y_axis > 0.05f && (dist_y * llabs(mouse_dir_y * rot_z_axis) < distance_threshold) && dist_y < mRadiusMeters))
- {
- mHighlightedPart = LL_ROT_Z;
- }
- }
-
- // test for roll
- if (mHighlightedPart == LL_NO_PART)
- {
- F32 roll_distance = intersection_roll.magVec();
- F32 width_meters = WIDTH_PIXELS * mRadiusMeters / RADIUS_PIXELS;
-
- // use larger distance threshold for roll as it is checked only if something else wasn't highlighted
- if (llabs(roll_distance - (mRadiusMeters + (width_meters * 2.f))) < distance_threshold * 2.f)
- {
- mHighlightedPart = LL_ROT_ROLL;
- }
- else if (roll_distance < mRadiusMeters)
- {
- mHighlightedPart = LL_ROT_GENERAL;
- }
- }
+ mHighlightedPart = LL_NO_PART;
+
+ //LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+ LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE);
+
+ if (!first_object)
+ {
+ return;
+ }
+
+ LLVector3 rotation_center = gAgent.getPosAgentFromGlobal(mRotationCenter);
+ LLVector3 mouse_dir_x;
+ LLVector3 mouse_dir_y;
+ LLVector3 mouse_dir_z;
+ LLVector3 intersection_roll;
+
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+
+ LLVector3 rot_x_axis = LLVector3::x_axis * grid_rotation;
+ LLVector3 rot_y_axis = LLVector3::y_axis * grid_rotation;
+ LLVector3 rot_z_axis = LLVector3::z_axis * grid_rotation;
+
+ F32 proj_rot_x_axis = llabs(rot_x_axis * mCenterToCamNorm);
+ F32 proj_rot_y_axis = llabs(rot_y_axis * mCenterToCamNorm);
+ F32 proj_rot_z_axis = llabs(rot_z_axis * mCenterToCamNorm);
+
+ F32 min_select_distance = 0.f;
+ F32 cur_select_distance = 0.f;
+
+ // test x
+ getMousePointOnPlaneAgent(mouse_dir_x, x, y, rotation_center, rot_x_axis);
+ mouse_dir_x -= rotation_center;
+ // push intersection point out when working at obtuse angle to make ring easier to hit
+ mouse_dir_x *= 1.f + (1.f - llabs(rot_x_axis * mCenterToCamNorm)) * 0.1f;
+
+ // test y
+ getMousePointOnPlaneAgent(mouse_dir_y, x, y, rotation_center, rot_y_axis);
+ mouse_dir_y -= rotation_center;
+ mouse_dir_y *= 1.f + (1.f - llabs(rot_y_axis * mCenterToCamNorm)) * 0.1f;
+
+ // test z
+ getMousePointOnPlaneAgent(mouse_dir_z, x, y, rotation_center, rot_z_axis);
+ mouse_dir_z -= rotation_center;
+ mouse_dir_z *= 1.f + (1.f - llabs(rot_z_axis * mCenterToCamNorm)) * 0.1f;
+
+ // test roll
+ getMousePointOnPlaneAgent(intersection_roll, x, y, rotation_center, mCenterToCamNorm);
+ intersection_roll -= rotation_center;
+
+ F32 dist_x = mouse_dir_x.normVec();
+ F32 dist_y = mouse_dir_y.normVec();
+ F32 dist_z = mouse_dir_z.normVec();
+
+ F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeightScaled();
+
+ if (llabs(dist_x - mRadiusMeters) * llmax(0.05f, proj_rot_x_axis) < distance_threshold)
+ {
+ // selected x
+ cur_select_distance = dist_x * mouse_dir_x * mCenterToCamNorm;
+ if (cur_select_distance >= -0.05f && (min_select_distance == 0.f || cur_select_distance > min_select_distance))
+ {
+ min_select_distance = cur_select_distance;
+ mHighlightedPart = LL_ROT_X;
+ }
+ }
+ if (llabs(dist_y - mRadiusMeters) * llmax(0.05f, proj_rot_y_axis) < distance_threshold)
+ {
+ // selected y
+ cur_select_distance = dist_y * mouse_dir_y * mCenterToCamNorm;
+ if (cur_select_distance >= -0.05f && (min_select_distance == 0.f || cur_select_distance > min_select_distance))
+ {
+ min_select_distance = cur_select_distance;
+ mHighlightedPart = LL_ROT_Y;
+ }
+ }
+ if (llabs(dist_z - mRadiusMeters) * llmax(0.05f, proj_rot_z_axis) < distance_threshold)
+ {
+ // selected z
+ cur_select_distance = dist_z * mouse_dir_z * mCenterToCamNorm;
+ if (cur_select_distance >= -0.05f && (min_select_distance == 0.f || cur_select_distance > min_select_distance))
+ {
+ min_select_distance = cur_select_distance;
+ mHighlightedPart = LL_ROT_Z;
+ }
+ }
+
+ // test for edge-on intersections
+ if (proj_rot_x_axis < 0.05f)
+ {
+ if ((proj_rot_y_axis > 0.05f && (dist_y * llabs(mouse_dir_y * rot_x_axis) < distance_threshold) && dist_y < mRadiusMeters) ||
+ (proj_rot_z_axis > 0.05f && (dist_z * llabs(mouse_dir_z * rot_x_axis) < distance_threshold) && dist_z < mRadiusMeters))
+ {
+ mHighlightedPart = LL_ROT_X;
+ }
+ }
+
+ if (proj_rot_y_axis < 0.05f)
+ {
+ if ((proj_rot_x_axis > 0.05f && (dist_x * llabs(mouse_dir_x * rot_y_axis) < distance_threshold) && dist_x < mRadiusMeters) ||
+ (proj_rot_z_axis > 0.05f && (dist_z * llabs(mouse_dir_z * rot_y_axis) < distance_threshold) && dist_z < mRadiusMeters))
+ {
+ mHighlightedPart = LL_ROT_Y;
+ }
+ }
+
+ if (proj_rot_z_axis < 0.05f)
+ {
+ if ((proj_rot_x_axis > 0.05f && (dist_x * llabs(mouse_dir_x * rot_z_axis) < distance_threshold) && dist_x < mRadiusMeters) ||
+ (proj_rot_y_axis > 0.05f && (dist_y * llabs(mouse_dir_y * rot_z_axis) < distance_threshold) && dist_y < mRadiusMeters))
+ {
+ mHighlightedPart = LL_ROT_Z;
+ }
+ }
+
+ // test for roll
+ if (mHighlightedPart == LL_NO_PART)
+ {
+ F32 roll_distance = intersection_roll.magVec();
+ F32 width_meters = WIDTH_PIXELS * mRadiusMeters / RADIUS_PIXELS;
+
+ // use larger distance threshold for roll as it is checked only if something else wasn't highlighted
+ if (llabs(roll_distance - (mRadiusMeters + (width_meters * 2.f))) < distance_threshold * 2.f)
+ {
+ mHighlightedPart = LL_ROT_ROLL;
+ }
+ else if (roll_distance < mRadiusMeters)
+ {
+ mHighlightedPart = LL_ROT_GENERAL;
+ }
+ }
}
S32 LLManipRotate::getObjectAxisClosestToMouse(LLVector3& object_axis)
{
- LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE);
-
- if (!first_object_node)
- {
- object_axis.clearVec();
- return -1;
- }
-
- LLQuaternion obj_rotation = first_object_node->mSavedRotation;
- LLVector3 mouse_down_object = mMouseDown * ~obj_rotation;
- LLVector3 mouse_down_abs = mouse_down_object;
- mouse_down_abs.abs();
-
- S32 axis_index = 0;
- if (mouse_down_abs.mV[VX] > mouse_down_abs.mV[VY] && mouse_down_abs.mV[VX] > mouse_down_abs.mV[VZ])
- {
- if (mouse_down_object.mV[VX] > 0.f)
- {
- object_axis = LLVector3::x_axis;
- }
- else
- {
- object_axis = LLVector3::x_axis_neg;
- }
- axis_index = VX;
- }
- else if (mouse_down_abs.mV[VY] > mouse_down_abs.mV[VZ])
- {
- if (mouse_down_object.mV[VY] > 0.f)
- {
- object_axis = LLVector3::y_axis;
- }
- else
- {
- object_axis = LLVector3::y_axis_neg;
- }
- axis_index = VY;
- }
- else
- {
- if (mouse_down_object.mV[VZ] > 0.f)
- {
- object_axis = LLVector3::z_axis;
- }
- else
- {
- object_axis = LLVector3::z_axis_neg;
- }
- axis_index = VZ;
- }
-
- return axis_index;
+ LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE);
+
+ if (!first_object_node)
+ {
+ object_axis.clearVec();
+ return -1;
+ }
+
+ LLQuaternion obj_rotation = first_object_node->mSavedRotation;
+ LLVector3 mouse_down_object = mMouseDown * ~obj_rotation;
+ LLVector3 mouse_down_abs = mouse_down_object;
+ mouse_down_abs.abs();
+
+ S32 axis_index = 0;
+ if (mouse_down_abs.mV[VX] > mouse_down_abs.mV[VY] && mouse_down_abs.mV[VX] > mouse_down_abs.mV[VZ])
+ {
+ if (mouse_down_object.mV[VX] > 0.f)
+ {
+ object_axis = LLVector3::x_axis;
+ }
+ else
+ {
+ object_axis = LLVector3::x_axis_neg;
+ }
+ axis_index = VX;
+ }
+ else if (mouse_down_abs.mV[VY] > mouse_down_abs.mV[VZ])
+ {
+ if (mouse_down_object.mV[VY] > 0.f)
+ {
+ object_axis = LLVector3::y_axis;
+ }
+ else
+ {
+ object_axis = LLVector3::y_axis_neg;
+ }
+ axis_index = VY;
+ }
+ else
+ {
+ if (mouse_down_object.mV[VZ] > 0.f)
+ {
+ object_axis = LLVector3::z_axis;
+ }
+ else
+ {
+ object_axis = LLVector3::z_axis_neg;
+ }
+ axis_index = VZ;
+ }
+
+ return axis_index;
}
//virtual
BOOL LLManipRotate::canAffectSelection()
{
- BOOL can_rotate = mObjectSelection->getObjectCount() != 0;
- if (can_rotate)
- {
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* objectp)
- {
- LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit();
- return objectp->permMove() && !objectp->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
- }
- } func;
- can_rotate = mObjectSelection->applyToObjects(&func);
- }
- return can_rotate;
+ BOOL can_rotate = mObjectSelection->getObjectCount() != 0;
+ if (can_rotate)
+ {
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* objectp)
+ {
+ LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit();
+ return objectp->permMove() && !objectp->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
+ }
+ } func;
+ can_rotate = mObjectSelection->applyToObjects(&func);
+ }
+ return can_rotate;
}
diff --git a/indra/newview/llmaniprotate.h b/indra/newview/llmaniprotate.h
index dc36ef796a..92a8d7fece 100644
--- a/indra/newview/llmaniprotate.h
+++ b/indra/newview/llmaniprotate.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmaniprotate.h
* @brief LLManipRotate class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,76 +41,76 @@ class LLColor4;
class LLManipRotate : public LLManip
{
public:
- class ManipulatorHandle
- {
- public:
- LLVector3 mAxisU;
- LLVector3 mAxisV;
- U32 mManipID;
-
- ManipulatorHandle(LLVector3 axis_u, LLVector3 axis_v, U32 id) : mAxisU(axis_u), mAxisV(axis_v), mManipID(id){}
- };
-
- LLManipRotate( LLToolComposite* composite );
-
- virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
- virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
- virtual BOOL handleHover( S32 x, S32 y, MASK mask );
- virtual void render();
-
- virtual void handleSelect();
-
- virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
- virtual void highlightManipulators(S32 x, S32 y);
- virtual BOOL canAffectSelection();
-
+ class ManipulatorHandle
+ {
+ public:
+ LLVector3 mAxisU;
+ LLVector3 mAxisV;
+ U32 mManipID;
+
+ ManipulatorHandle(LLVector3 axis_u, LLVector3 axis_v, U32 id) : mAxisU(axis_u), mAxisV(axis_v), mManipID(id){}
+ };
+
+ LLManipRotate( LLToolComposite* composite );
+
+ virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
+ virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
+ virtual BOOL handleHover( S32 x, S32 y, MASK mask );
+ virtual void render();
+
+ virtual void handleSelect();
+
+ virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
+ virtual void highlightManipulators(S32 x, S32 y);
+ virtual BOOL canAffectSelection();
+
private:
- void updateHoverView();
+ void updateHoverView();
- void drag( S32 x, S32 y );
- LLVector3 projectToSphere( F32 x, F32 y, BOOL* on_sphere );
+ void drag( S32 x, S32 y );
+ LLVector3 projectToSphere( F32 x, F32 y, BOOL* on_sphere );
- void renderSnapGuides();
- void renderActiveRing(F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color);
+ void renderSnapGuides();
+ void renderActiveRing(F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color);
- BOOL updateVisiblity();
- LLVector3 findNearestPointOnRing( S32 x, S32 y, const LLVector3& center, const LLVector3& axis );
+ BOOL updateVisiblity();
+ LLVector3 findNearestPointOnRing( S32 x, S32 y, const LLVector3& center, const LLVector3& axis );
- LLQuaternion dragUnconstrained( S32 x, S32 y );
- LLQuaternion dragConstrained( S32 x, S32 y );
- LLVector3 getConstraintAxis();
- S32 getObjectAxisClosestToMouse(LLVector3& axis);
+ LLQuaternion dragUnconstrained( S32 x, S32 y );
+ LLQuaternion dragConstrained( S32 x, S32 y );
+ LLVector3 getConstraintAxis();
+ S32 getObjectAxisClosestToMouse(LLVector3& axis);
- // Utility functions
- static void mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir );
- static LLVector3 intersectMouseWithSphere( S32 x, S32 y, const LLVector3& sphere_center, F32 sphere_radius );
- static LLVector3 intersectRayWithSphere( const LLVector3& ray_pt, const LLVector3& ray_dir, const LLVector3& sphere_center, F32 sphere_radius);
+ // Utility functions
+ static void mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir );
+ static LLVector3 intersectMouseWithSphere( S32 x, S32 y, const LLVector3& sphere_center, F32 sphere_radius );
+ static LLVector3 intersectRayWithSphere( const LLVector3& ray_pt, const LLVector3& ray_dir, const LLVector3& sphere_center, F32 sphere_radius);
private:
- LLVector3d mRotationCenter;
- LLCoordGL mCenterScreen;
-// S32 mLastHoverMouseX; // used to suppress hover if mouse doesn't move
-// S32 mLastHoverMouseY;
- LLQuaternion mRotation;
-
- LLVector3 mMouseDown;
- LLVector3 mMouseCur;
- LLVector3 mAgentSelfAtAxis; // Own agent uses separate rotation method
- F32 mRadiusMeters;
-
- LLVector3 mCenterToCam;
- LLVector3 mCenterToCamNorm;
- F32 mCenterToCamMag;
- LLVector3 mCenterToProfilePlane;
- F32 mCenterToProfilePlaneMag;
-
- BOOL mSendUpdateOnMouseUp;
-
- BOOL mSmoothRotate;
- BOOL mCamEdgeOn;
-
- LLVector4 mManipulatorVertices[6];
- LLVector4 mManipulatorScales;
+ LLVector3d mRotationCenter;
+ LLCoordGL mCenterScreen;
+// S32 mLastHoverMouseX; // used to suppress hover if mouse doesn't move
+// S32 mLastHoverMouseY;
+ LLQuaternion mRotation;
+
+ LLVector3 mMouseDown;
+ LLVector3 mMouseCur;
+ LLVector3 mAgentSelfAtAxis; // Own agent uses separate rotation method
+ F32 mRadiusMeters;
+
+ LLVector3 mCenterToCam;
+ LLVector3 mCenterToCamNorm;
+ F32 mCenterToCamMag;
+ LLVector3 mCenterToProfilePlane;
+ F32 mCenterToProfilePlaneMag;
+
+ BOOL mSendUpdateOnMouseUp;
+
+ BOOL mSmoothRotate;
+ BOOL mCamEdgeOn;
+
+ LLVector4 mManipulatorVertices[6];
+ LLVector4 mManipulatorScales;
};
#endif // LL_LLMANIPROTATE_H
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 6f685d4e62..3bace98b15 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmanipscale.cpp
* @brief LLManipScale class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,2033 +67,2033 @@ const F32 SNAP_GUIDE_SCREEN_LENGTH = 0.7f;
const F32 SELECTED_MANIPULATOR_SCALE = 1.2f;
const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f;
-const LLManip::EManipPart MANIPULATOR_IDS[LLManipScale::NUM_MANIPULATORS] =
+const LLManip::EManipPart MANIPULATOR_IDS[LLManipScale::NUM_MANIPULATORS] =
{
- LLManip::LL_CORNER_NNN,
- LLManip::LL_CORNER_NNP,
- LLManip::LL_CORNER_NPN,
- LLManip::LL_CORNER_NPP,
- LLManip::LL_CORNER_PNN,
- LLManip::LL_CORNER_PNP,
- LLManip::LL_CORNER_PPN,
- LLManip::LL_CORNER_PPP,
- LLManip::LL_FACE_POSZ,
- LLManip::LL_FACE_POSX,
- LLManip::LL_FACE_POSY,
- LLManip::LL_FACE_NEGX,
- LLManip::LL_FACE_NEGY,
- LLManip::LL_FACE_NEGZ
+ LLManip::LL_CORNER_NNN,
+ LLManip::LL_CORNER_NNP,
+ LLManip::LL_CORNER_NPN,
+ LLManip::LL_CORNER_NPP,
+ LLManip::LL_CORNER_PNN,
+ LLManip::LL_CORNER_PNP,
+ LLManip::LL_CORNER_PPN,
+ LLManip::LL_CORNER_PPP,
+ LLManip::LL_FACE_POSZ,
+ LLManip::LL_FACE_POSX,
+ LLManip::LL_FACE_POSY,
+ LLManip::LL_FACE_NEGX,
+ LLManip::LL_FACE_NEGY,
+ LLManip::LL_FACE_NEGZ
};
F32 get_default_max_prim_scale(bool is_flora)
{
- // a bit of a hack, but if it's foilage, we don't want to use the
- // new larger scale which would result in giant trees and grass
- if (gMeshRepo.meshRezEnabled() &&
- !is_flora)
- {
- return DEFAULT_MAX_PRIM_SCALE;
- }
- else
- {
- return DEFAULT_MAX_PRIM_SCALE_NO_MESH;
- }
+ // a bit of a hack, but if it's foilage, we don't want to use the
+ // new larger scale which would result in giant trees and grass
+ if (gMeshRepo.meshRezEnabled() &&
+ !is_flora)
+ {
+ return DEFAULT_MAX_PRIM_SCALE;
+ }
+ else
+ {
+ return DEFAULT_MAX_PRIM_SCALE_NO_MESH;
+ }
}
// static
void LLManipScale::setUniform(BOOL b)
{
- gSavedSettings.setBOOL("ScaleUniform", b);
+ gSavedSettings.setBOOL("ScaleUniform", b);
}
// static
void LLManipScale::setShowAxes(BOOL b)
{
- gSavedSettings.setBOOL("ScaleShowAxes", b);
+ gSavedSettings.setBOOL("ScaleShowAxes", b);
}
// static
void LLManipScale::setStretchTextures(BOOL b)
{
- gSavedSettings.setBOOL("ScaleStretchTextures", b);
+ gSavedSettings.setBOOL("ScaleStretchTextures", b);
}
// static
BOOL LLManipScale::getUniform()
{
- return gSavedSettings.getBOOL("ScaleUniform");
+ return gSavedSettings.getBOOL("ScaleUniform");
}
// static
BOOL LLManipScale::getShowAxes()
{
- return gSavedSettings.getBOOL("ScaleShowAxes");
+ return gSavedSettings.getBOOL("ScaleShowAxes");
}
// static
BOOL LLManipScale::getStretchTextures()
{
- return gSavedSettings.getBOOL("ScaleStretchTextures");
+ return gSavedSettings.getBOOL("ScaleStretchTextures");
}
inline void LLManipScale::conditionalHighlight( U32 part, const LLColor4* highlight, const LLColor4* normal )
{
- LLColor4 default_highlight( 1.f, 1.f, 1.f, 1.f );
- LLColor4 default_normal( 0.7f, 0.7f, 0.7f, 0.6f );
- LLColor4 invisible(0.f, 0.f, 0.f, 0.f);
-
- for (S32 i = 0; i < NUM_MANIPULATORS; i++)
- {
- if((U32)MANIPULATOR_IDS[i] == part)
- {
- mScaledBoxHandleSize = mManipulatorScales[i] * mBoxHandleSize[i];
- break;
- }
- }
-
- if (mManipPart != (S32)LL_NO_PART && mManipPart != (S32)part)
- {
- gGL.color4fv( invisible.mV );
- }
- else if( mHighlightedPart == (S32)part )
- {
- gGL.color4fv( highlight ? highlight->mV : default_highlight.mV );
- }
- else
- {
- gGL.color4fv( normal ? normal->mV : default_normal.mV );
- }
+ LLColor4 default_highlight( 1.f, 1.f, 1.f, 1.f );
+ LLColor4 default_normal( 0.7f, 0.7f, 0.7f, 0.6f );
+ LLColor4 invisible(0.f, 0.f, 0.f, 0.f);
+
+ for (S32 i = 0; i < NUM_MANIPULATORS; i++)
+ {
+ if((U32)MANIPULATOR_IDS[i] == part)
+ {
+ mScaledBoxHandleSize = mManipulatorScales[i] * mBoxHandleSize[i];
+ break;
+ }
+ }
+
+ if (mManipPart != (S32)LL_NO_PART && mManipPart != (S32)part)
+ {
+ gGL.color4fv( invisible.mV );
+ }
+ else if( mHighlightedPart == (S32)part )
+ {
+ gGL.color4fv( highlight ? highlight->mV : default_highlight.mV );
+ }
+ else
+ {
+ gGL.color4fv( normal ? normal->mV : default_normal.mV );
+ }
}
void LLManipScale::handleSelect()
{
- LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
- updateSnapGuides(bbox);
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+ updateSnapGuides(bbox);
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
if (gFloaterTools)
{
gFloaterTools->setStatusText("scale");
}
- LLManip::handleSelect();
+ LLManip::handleSelect();
}
LLManipScale::LLManipScale( LLToolComposite* composite )
- :
- LLManip( std::string("Scale"), composite ),
- mScaledBoxHandleSize( 1.f ),
- mLastMouseX( -1 ),
- mLastMouseY( -1 ),
- mSendUpdateOnMouseUp( FALSE ),
- mLastUpdateFlags( 0 ),
- mScaleSnapUnit1(1.f),
- mScaleSnapUnit2(1.f),
- mSnapRegimeOffset(0.f),
- mTickPixelSpacing1(0.f),
- mTickPixelSpacing2(0.f),
- mSnapGuideLength(0.f),
- mSnapRegime(SNAP_REGIME_NONE),
- mScaleSnappedValue(0.f)
+ :
+ LLManip( std::string("Scale"), composite ),
+ mScaledBoxHandleSize( 1.f ),
+ mLastMouseX( -1 ),
+ mLastMouseY( -1 ),
+ mSendUpdateOnMouseUp( FALSE ),
+ mLastUpdateFlags( 0 ),
+ mScaleSnapUnit1(1.f),
+ mScaleSnapUnit2(1.f),
+ mSnapRegimeOffset(0.f),
+ mTickPixelSpacing1(0.f),
+ mTickPixelSpacing2(0.f),
+ mSnapGuideLength(0.f),
+ mSnapRegime(SNAP_REGIME_NONE),
+ mScaleSnappedValue(0.f)
{
- for (S32 i = 0; i < NUM_MANIPULATORS; i++)
- {
- mManipulatorScales[i] = 1.f;
- mBoxHandleSize[i] = 1.f;
- }
+ for (S32 i = 0; i < NUM_MANIPULATORS; i++)
+ {
+ mManipulatorScales[i] = 1.f;
+ mBoxHandleSize[i] = 1.f;
+ }
}
LLManipScale::~LLManipScale()
{
- for_each(mProjectedManipulators.begin(), mProjectedManipulators.end(), DeletePointer());
+ for_each(mProjectedManipulators.begin(), mProjectedManipulators.end(), DeletePointer());
}
void LLManipScale::render()
{
- LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest gls_depth(GL_TRUE);
- LLGLEnable gl_blend(GL_BLEND);
- LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
-
- if( canAffectSelection() )
- {
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- F32 zoom = gAgentCamera.mHUDCurZoom;
- gGL.scalef(zoom, zoom, zoom);
- }
-
- ////////////////////////////////////////////////////////////////////////
- // Calculate size of drag handles
-
- const F32 BOX_HANDLE_BASE_SIZE = 50.0f; // box size in pixels = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR
- const F32 BOX_HANDLE_BASE_FACTOR = 0.2f;
-
- //Assume that UI scale factor is equivalent for X and Y axis
- F32 ui_scale_factor = LLUI::getScaleFactor().mV[VX];
-
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- for (S32 i = 0; i < NUM_MANIPULATORS; i++)
- {
- mBoxHandleSize[i] = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
- mBoxHandleSize[i] /= gAgentCamera.mHUDCurZoom;
- mBoxHandleSize[i] *= ui_scale_factor;
- }
- }
- else
- {
- for (S32 i = 0; i < NUM_MANIPULATORS; i++)
- {
- LLVector3 manipulator_pos = bbox.localToAgent(unitVectorToLocalBBoxExtent(partToUnitVector(MANIPULATOR_IDS[i]), bbox));
- F32 range_squared = dist_vec_squared(gAgentCamera.getCameraPositionAgent(), manipulator_pos);
- F32 range_from_agent_squared = dist_vec_squared(gAgent.getPositionAgent(), manipulator_pos);
-
- // Don't draw manip if object too far away
- if (gSavedSettings.getBOOL("LimitSelectDistance"))
- {
- F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance");
- if (range_from_agent_squared > max_select_distance * max_select_distance)
- {
- return;
- }
- }
-
- if (range_squared > 0.001f * 0.001f)
- {
- // range != zero
- F32 fraction_of_fov = BOX_HANDLE_BASE_SIZE / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
- F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians
- mBoxHandleSize[i] = (F32) sqrtf(range_squared) * tan(apparent_angle) * BOX_HANDLE_BASE_FACTOR;
- }
- else
- {
- // range == zero
- mBoxHandleSize[i] = BOX_HANDLE_BASE_FACTOR;
- }
- mBoxHandleSize[i] *= ui_scale_factor;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- // Draw bounding box
-
- LLVector3 pos_agent = bbox.getPositionAgent();
- LLQuaternion rot = bbox.getRotation();
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- {
- gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]);
-
- F32 angle_radians, x, y, z;
- rot.getAngleAxis(&angle_radians, &x, &y, &z);
- gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
-
-
- {
- LLGLEnable poly_offset(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset( -2.f, -2.f);
-
- renderCorners( bbox );
- renderFaces( bbox );
-
- if (mManipPart != LL_NO_PART)
- {
- renderGuidelinesPart( bbox );
- }
-
- glPolygonOffset( 0.f, 0.f);
- }
- }
- gGL.popMatrix();
-
- if (mManipPart != LL_NO_PART)
- {
- renderSnapGuides(bbox);
- }
- gGL.popMatrix();
-
- renderXYZ(bbox.getExtentLocal());
- }
+ LLGLSUIDefault gls_ui;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest gls_depth(GL_TRUE);
+ LLGLEnable gl_blend(GL_BLEND);
+ LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+
+ if( canAffectSelection() )
+ {
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ F32 zoom = gAgentCamera.mHUDCurZoom;
+ gGL.scalef(zoom, zoom, zoom);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Calculate size of drag handles
+
+ const F32 BOX_HANDLE_BASE_SIZE = 50.0f; // box size in pixels = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR
+ const F32 BOX_HANDLE_BASE_FACTOR = 0.2f;
+
+ //Assume that UI scale factor is equivalent for X and Y axis
+ F32 ui_scale_factor = LLUI::getScaleFactor().mV[VX];
+
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ for (S32 i = 0; i < NUM_MANIPULATORS; i++)
+ {
+ mBoxHandleSize[i] = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
+ mBoxHandleSize[i] /= gAgentCamera.mHUDCurZoom;
+ mBoxHandleSize[i] *= ui_scale_factor;
+ }
+ }
+ else
+ {
+ for (S32 i = 0; i < NUM_MANIPULATORS; i++)
+ {
+ LLVector3 manipulator_pos = bbox.localToAgent(unitVectorToLocalBBoxExtent(partToUnitVector(MANIPULATOR_IDS[i]), bbox));
+ F32 range_squared = dist_vec_squared(gAgentCamera.getCameraPositionAgent(), manipulator_pos);
+ F32 range_from_agent_squared = dist_vec_squared(gAgent.getPositionAgent(), manipulator_pos);
+
+ // Don't draw manip if object too far away
+ if (gSavedSettings.getBOOL("LimitSelectDistance"))
+ {
+ F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance");
+ if (range_from_agent_squared > max_select_distance * max_select_distance)
+ {
+ return;
+ }
+ }
+
+ if (range_squared > 0.001f * 0.001f)
+ {
+ // range != zero
+ F32 fraction_of_fov = BOX_HANDLE_BASE_SIZE / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
+ F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians
+ mBoxHandleSize[i] = (F32) sqrtf(range_squared) * tan(apparent_angle) * BOX_HANDLE_BASE_FACTOR;
+ }
+ else
+ {
+ // range == zero
+ mBoxHandleSize[i] = BOX_HANDLE_BASE_FACTOR;
+ }
+ mBoxHandleSize[i] *= ui_scale_factor;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Draw bounding box
+
+ LLVector3 pos_agent = bbox.getPositionAgent();
+ LLQuaternion rot = bbox.getRotation();
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ {
+ gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]);
+
+ F32 angle_radians, x, y, z;
+ rot.getAngleAxis(&angle_radians, &x, &y, &z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
+
+
+ {
+ LLGLEnable poly_offset(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset( -2.f, -2.f);
+
+ renderCorners( bbox );
+ renderFaces( bbox );
+
+ if (mManipPart != LL_NO_PART)
+ {
+ renderGuidelinesPart( bbox );
+ }
+
+ glPolygonOffset( 0.f, 0.f);
+ }
+ }
+ gGL.popMatrix();
+
+ if (mManipPart != LL_NO_PART)
+ {
+ renderSnapGuides(bbox);
+ }
+ gGL.popMatrix();
+
+ renderXYZ(bbox.getExtentLocal());
+ }
}
BOOL LLManipScale::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
+ BOOL handled = FALSE;
- if(mHighlightedPart != LL_NO_PART)
- {
- handled = handleMouseDownOnPart( x, y, mask );
- }
+ if(mHighlightedPart != LL_NO_PART)
+ {
+ handled = handleMouseDownOnPart( x, y, mask );
+ }
- return handled;
+ return handled;
}
// Assumes that one of the arrows on an object was hit.
BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
{
- BOOL can_scale = canAffectSelection();
- if (!can_scale)
- {
- return FALSE;
- }
-
- highlightManipulators(x, y);
- S32 hit_part = mHighlightedPart;
-
- LLSelectMgr::getInstance()->enableSilhouette(FALSE);
- mManipPart = (EManipPart)hit_part;
-
- LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
- LLVector3 box_center_agent = bbox.getCenterAgent();
- LLVector3 box_corner_agent = bbox.localToAgent( unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ) );
-
- updateSnapGuides(bbox);
-
- mFirstClickX = x;
- mFirstClickY = y;
- mIsFirstClick = true;
-
- mDragStartPointGlobal = gAgent.getPosGlobalFromAgent(box_corner_agent);
- mDragStartCenterGlobal = gAgent.getPosGlobalFromAgent(box_center_agent);
- LLVector3 far_corner_agent = bbox.localToAgent( unitVectorToLocalBBoxExtent( -1.f * partToUnitVector( mManipPart ), bbox ) );
- mDragFarHitGlobal = gAgent.getPosGlobalFromAgent(far_corner_agent);
- mDragPointGlobal = mDragStartPointGlobal;
-
- // we just started a drag, so save initial object positions, orientations, and scales
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE);
- // Route future Mouse messages here preemptively. (Release on mouse up.)
- setMouseCapture( TRUE );
-
- mHelpTextTimer.reset();
- sNumTimesHelpTextShown++;
- return TRUE;
+ BOOL can_scale = canAffectSelection();
+ if (!can_scale)
+ {
+ return FALSE;
+ }
+
+ highlightManipulators(x, y);
+ S32 hit_part = mHighlightedPart;
+
+ LLSelectMgr::getInstance()->enableSilhouette(FALSE);
+ mManipPart = (EManipPart)hit_part;
+
+ LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+ LLVector3 box_center_agent = bbox.getCenterAgent();
+ LLVector3 box_corner_agent = bbox.localToAgent( unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ) );
+
+ updateSnapGuides(bbox);
+
+ mFirstClickX = x;
+ mFirstClickY = y;
+ mIsFirstClick = true;
+
+ mDragStartPointGlobal = gAgent.getPosGlobalFromAgent(box_corner_agent);
+ mDragStartCenterGlobal = gAgent.getPosGlobalFromAgent(box_center_agent);
+ LLVector3 far_corner_agent = bbox.localToAgent( unitVectorToLocalBBoxExtent( -1.f * partToUnitVector( mManipPart ), bbox ) );
+ mDragFarHitGlobal = gAgent.getPosGlobalFromAgent(far_corner_agent);
+ mDragPointGlobal = mDragStartPointGlobal;
+
+ // we just started a drag, so save initial object positions, orientations, and scales
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE);
+ // Route future Mouse messages here preemptively. (Release on mouse up.)
+ setMouseCapture( TRUE );
+
+ mHelpTextTimer.reset();
+ sNumTimesHelpTextShown++;
+ return TRUE;
}
BOOL LLManipScale::handleMouseUp(S32 x, S32 y, MASK mask)
{
- // first, perform normal processing in case this was a quick-click
- handleHover(x, y, mask);
-
- if( hasMouseCapture() )
- {
- if( (LL_FACE_MIN <= (S32)mManipPart)
- && ((S32)mManipPart <= LL_FACE_MAX) )
- {
- sendUpdates(TRUE,TRUE,FALSE);
- }
- else
- if( (LL_CORNER_MIN <= (S32)mManipPart)
- && ((S32)mManipPart <= LL_CORNER_MAX) )
- {
- sendUpdates(TRUE,TRUE,TRUE);
- }
-
- //send texture update
- LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, getStretchTextures());
-
- LLSelectMgr::getInstance()->enableSilhouette(TRUE);
- mManipPart = LL_NO_PART;
-
- // Might have missed last update due to UPDATE_DELAY timing
- LLSelectMgr::getInstance()->sendMultipleUpdate( mLastUpdateFlags );
-
- //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- }
- return LLManip::handleMouseUp(x, y, mask);
+ // first, perform normal processing in case this was a quick-click
+ handleHover(x, y, mask);
+
+ if( hasMouseCapture() )
+ {
+ if( (LL_FACE_MIN <= (S32)mManipPart)
+ && ((S32)mManipPart <= LL_FACE_MAX) )
+ {
+ sendUpdates(TRUE,TRUE,FALSE);
+ }
+ else
+ if( (LL_CORNER_MIN <= (S32)mManipPart)
+ && ((S32)mManipPart <= LL_CORNER_MAX) )
+ {
+ sendUpdates(TRUE,TRUE,TRUE);
+ }
+
+ //send texture update
+ LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, getStretchTextures());
+
+ LLSelectMgr::getInstance()->enableSilhouette(TRUE);
+ mManipPart = LL_NO_PART;
+
+ // Might have missed last update due to UPDATE_DELAY timing
+ LLSelectMgr::getInstance()->sendMultipleUpdate( mLastUpdateFlags );
+
+ //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ }
+ return LLManip::handleMouseUp(x, y, mask);
}
BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask)
{
- if( hasMouseCapture() )
- {
- if( mObjectSelection->isEmpty() )
- {
- // Somehow the object got deselected while we were dragging it.
- setMouseCapture( FALSE );
- }
- else
- {
- if((mFirstClickX != x) || (mFirstClickY != y))
- {
- mIsFirstClick = false;
- }
-
- if(!mIsFirstClick)
- {
- drag( x, y );
- }
- }
- LL_DEBUGS("UserInput") << "hover handled by LLManipScale (active)" << LL_ENDL;
- }
- else
- {
- mSnapRegime = SNAP_REGIME_NONE;
- // not dragging...
- highlightManipulators(x, y);
- }
-
- // Patch up textures, if possible.
- LLSelectMgr::getInstance()->adjustTexturesByScale(FALSE, getStretchTextures());
-
- gViewerWindow->setCursor(UI_CURSOR_TOOLSCALE);
- return TRUE;
+ if( hasMouseCapture() )
+ {
+ if( mObjectSelection->isEmpty() )
+ {
+ // Somehow the object got deselected while we were dragging it.
+ setMouseCapture( FALSE );
+ }
+ else
+ {
+ if((mFirstClickX != x) || (mFirstClickY != y))
+ {
+ mIsFirstClick = false;
+ }
+
+ if(!mIsFirstClick)
+ {
+ drag( x, y );
+ }
+ }
+ LL_DEBUGS("UserInput") << "hover handled by LLManipScale (active)" << LL_ENDL;
+ }
+ else
+ {
+ mSnapRegime = SNAP_REGIME_NONE;
+ // not dragging...
+ highlightManipulators(x, y);
+ }
+
+ // Patch up textures, if possible.
+ LLSelectMgr::getInstance()->adjustTexturesByScale(FALSE, getStretchTextures());
+
+ gViewerWindow->setCursor(UI_CURSOR_TOOLSCALE);
+ return TRUE;
}
void LLManipScale::highlightManipulators(S32 x, S32 y)
{
- mHighlightedPart = LL_NO_PART;
-
- // If we have something selected, try to hit its manipulator handles.
- // Don't do this with nothing selected, as it kills the framerate.
- LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
-
- if( canAffectSelection() )
- {
- LLMatrix4 transform;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- LLVector4 translation(bbox.getPositionAgent());
- transform.initRotTrans(bbox.getRotation(), translation);
- LLMatrix4 cfr(OGL_TO_CFR_ROTATION);
- transform *= cfr;
- LLMatrix4 window_scale;
- F32 zoom_level = 2.f * gAgentCamera.mHUDCurZoom;
- window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f),
- LLQuaternion::DEFAULT,
- LLVector3::zero);
- transform *= window_scale;
- }
- else
- {
- LLMatrix4 projMatrix = LLViewerCamera::getInstance()->getProjection();
- LLMatrix4 modelView = LLViewerCamera::getInstance()->getModelview();
- transform.initAll(LLVector3(1.f, 1.f, 1.f), bbox.getRotation(), bbox.getPositionAgent());
-
- transform *= modelView;
- transform *= projMatrix;
- }
-
- LLVector3 min = bbox.getMinLocal();
- LLVector3 max = bbox.getMaxLocal();
- LLVector3 ctr = bbox.getCenterLocal();
-
- S32 numManips = 0;
- // corners
- mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], min.mV[VY], min.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], min.mV[VY], max.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], max.mV[VY], min.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], max.mV[VY], max.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], min.mV[VY], min.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], min.mV[VY], max.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], max.mV[VY], min.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], max.mV[VY], max.mV[VZ], 1.f);
-
- // 1-D highlights are applicable iff one object is selected
- if( mObjectSelection->getObjectCount() == 1 )
- {
- // face centers
- mManipulatorVertices[numManips++] = LLVector4(ctr.mV[VX], ctr.mV[VY], max.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], ctr.mV[VY], ctr.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(ctr.mV[VX], max.mV[VY], ctr.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], ctr.mV[VY], ctr.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(ctr.mV[VX], min.mV[VY], ctr.mV[VZ], 1.f);
- mManipulatorVertices[numManips++] = LLVector4(ctr.mV[VX], ctr.mV[VY], min.mV[VZ], 1.f);
- }
-
- for_each(mProjectedManipulators.begin(), mProjectedManipulators.end(), DeletePointer());
- mProjectedManipulators.clear();
-
- for (S32 i = 0; i < numManips; i++)
- {
- LLVector4 projectedVertex = mManipulatorVertices[i] * transform;
- projectedVertex = projectedVertex * (1.f / projectedVertex.mV[VW]);
-
- ManipulatorHandle* projManipulator = new ManipulatorHandle(LLVector3(projectedVertex.mV[VX], projectedVertex.mV[VY],
- projectedVertex.mV[VZ]), MANIPULATOR_IDS[i], (i < 7) ? SCALE_MANIP_CORNER : SCALE_MANIP_FACE);
- mProjectedManipulators.insert(projManipulator);
- }
-
- LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled();
- F32 half_width = (F32)world_view_rect.getWidth() / 2.f;
- F32 half_height = (F32)world_view_rect.getHeight() / 2.f;
- LLVector2 manip2d;
- LLVector2 mousePos((F32)x - half_width, (F32)y - half_height);
- LLVector2 delta;
-
- mHighlightedPart = LL_NO_PART;
-
- for (manipulator_list_t::iterator iter = mProjectedManipulators.begin();
- iter != mProjectedManipulators.end(); ++iter)
- {
- ManipulatorHandle* manipulator = *iter;
- {
- manip2d.set(manipulator->mPosition.mV[VX] * half_width, manipulator->mPosition.mV[VY] * half_height);
-
- delta = manip2d - mousePos;
- if (delta.lengthSquared() < MAX_MANIP_SELECT_DISTANCE_SQUARED)
- {
- mHighlightedPart = manipulator->mManipID;
-
- //LL_INFOS() << "Tried: " << mHighlightedPart << LL_ENDL;
- break;
- }
- }
- }
- }
-
- for (S32 i = 0; i < NUM_MANIPULATORS; i++)
- {
- if (mHighlightedPart == MANIPULATOR_IDS[i])
- {
- mManipulatorScales[i] = lerp(mManipulatorScales[i], SELECTED_MANIPULATOR_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- }
- else
- {
- mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- }
- }
-
- LL_DEBUGS("UserInput") << "hover handled by LLManipScale (inactive)" << LL_ENDL;
+ mHighlightedPart = LL_NO_PART;
+
+ // If we have something selected, try to hit its manipulator handles.
+ // Don't do this with nothing selected, as it kills the framerate.
+ LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+
+ if( canAffectSelection() )
+ {
+ LLMatrix4 transform;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ LLVector4 translation(bbox.getPositionAgent());
+ transform.initRotTrans(bbox.getRotation(), translation);
+ LLMatrix4 cfr(OGL_TO_CFR_ROTATION);
+ transform *= cfr;
+ LLMatrix4 window_scale;
+ F32 zoom_level = 2.f * gAgentCamera.mHUDCurZoom;
+ window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f),
+ LLQuaternion::DEFAULT,
+ LLVector3::zero);
+ transform *= window_scale;
+ }
+ else
+ {
+ LLMatrix4 projMatrix = LLViewerCamera::getInstance()->getProjection();
+ LLMatrix4 modelView = LLViewerCamera::getInstance()->getModelview();
+ transform.initAll(LLVector3(1.f, 1.f, 1.f), bbox.getRotation(), bbox.getPositionAgent());
+
+ transform *= modelView;
+ transform *= projMatrix;
+ }
+
+ LLVector3 min = bbox.getMinLocal();
+ LLVector3 max = bbox.getMaxLocal();
+ LLVector3 ctr = bbox.getCenterLocal();
+
+ S32 numManips = 0;
+ // corners
+ mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], min.mV[VY], min.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], min.mV[VY], max.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], max.mV[VY], min.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], max.mV[VY], max.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], min.mV[VY], min.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], min.mV[VY], max.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], max.mV[VY], min.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], max.mV[VY], max.mV[VZ], 1.f);
+
+ // 1-D highlights are applicable iff one object is selected
+ if( mObjectSelection->getObjectCount() == 1 )
+ {
+ // face centers
+ mManipulatorVertices[numManips++] = LLVector4(ctr.mV[VX], ctr.mV[VY], max.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], ctr.mV[VY], ctr.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(ctr.mV[VX], max.mV[VY], ctr.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(min.mV[VX], ctr.mV[VY], ctr.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(ctr.mV[VX], min.mV[VY], ctr.mV[VZ], 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(ctr.mV[VX], ctr.mV[VY], min.mV[VZ], 1.f);
+ }
+
+ for_each(mProjectedManipulators.begin(), mProjectedManipulators.end(), DeletePointer());
+ mProjectedManipulators.clear();
+
+ for (S32 i = 0; i < numManips; i++)
+ {
+ LLVector4 projectedVertex = mManipulatorVertices[i] * transform;
+ projectedVertex = projectedVertex * (1.f / projectedVertex.mV[VW]);
+
+ ManipulatorHandle* projManipulator = new ManipulatorHandle(LLVector3(projectedVertex.mV[VX], projectedVertex.mV[VY],
+ projectedVertex.mV[VZ]), MANIPULATOR_IDS[i], (i < 7) ? SCALE_MANIP_CORNER : SCALE_MANIP_FACE);
+ mProjectedManipulators.insert(projManipulator);
+ }
+
+ LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled();
+ F32 half_width = (F32)world_view_rect.getWidth() / 2.f;
+ F32 half_height = (F32)world_view_rect.getHeight() / 2.f;
+ LLVector2 manip2d;
+ LLVector2 mousePos((F32)x - half_width, (F32)y - half_height);
+ LLVector2 delta;
+
+ mHighlightedPart = LL_NO_PART;
+
+ for (manipulator_list_t::iterator iter = mProjectedManipulators.begin();
+ iter != mProjectedManipulators.end(); ++iter)
+ {
+ ManipulatorHandle* manipulator = *iter;
+ {
+ manip2d.set(manipulator->mPosition.mV[VX] * half_width, manipulator->mPosition.mV[VY] * half_height);
+
+ delta = manip2d - mousePos;
+ if (delta.lengthSquared() < MAX_MANIP_SELECT_DISTANCE_SQUARED)
+ {
+ mHighlightedPart = manipulator->mManipID;
+
+ //LL_INFOS() << "Tried: " << mHighlightedPart << LL_ENDL;
+ break;
+ }
+ }
+ }
+ }
+
+ for (S32 i = 0; i < NUM_MANIPULATORS; i++)
+ {
+ if (mHighlightedPart == MANIPULATOR_IDS[i])
+ {
+ mManipulatorScales[i] = lerp(mManipulatorScales[i], SELECTED_MANIPULATOR_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ }
+ else
+ {
+ mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ }
+ }
+
+ LL_DEBUGS("UserInput") << "hover handled by LLManipScale (inactive)" << LL_ENDL;
}
void LLManipScale::renderFaces( const LLBBox& bbox )
{
- // Don't bother to render the drag handles for 1-D scaling if
- // more than one object is selected or if it is an attachment
- if ( mObjectSelection->getObjectCount() > 1 )
- {
- return;
- }
-
- // This is a flattened representation of the box as render here
- // .
- // (+++) (++-) /|\t
- // +------------+ | (texture coordinates)
- // | | |
- // | 1 | (*) --->s
- // | +X |
- // | |
- // (+++) (+-+)| |(+--) (++-) (+++)
- // +------------+------------+------------+------------+
- // |0 3|3 7|7 4|4 0|
- // | 0 | 4 | 5 | 2 |
- // | +Z | -Y | -Z | +Y |
- // | | | | |
- // |1 2|2 6|6 5|5 1|
- // +------------+------------+------------+------------+
- // (-++) (--+)| |(---) (-+-) (-++)
- // | 3 |
- // | -X |
- // | |
- // | |
- // +------------+
- // (-++) (-+-)
-
- LLColor4 highlight_color( 1.f, 1.f, 1.f, 0.5f);
- LLColor4 normal_color( 1.f, 1.f, 1.f, 0.3f);
-
- LLColor4 x_highlight_color( 1.f, 0.2f, 0.2f, 1.0f);
- LLColor4 x_normal_color( 0.6f, 0.f, 0.f, 0.4f);
-
- LLColor4 y_highlight_color( 0.2f, 1.f, 0.2f, 1.0f);
- LLColor4 y_normal_color( 0.f, 0.6f, 0.f, 0.4f);
-
- LLColor4 z_highlight_color( 0.2f, 0.2f, 1.f, 1.0f);
- LLColor4 z_normal_color( 0.f, 0.f, 0.6f, 0.4f);
-
- LLColor4 default_normal_color( 0.7f, 0.7f, 0.7f, 0.15f );
-
- const LLVector3& min = bbox.getMinLocal();
- const LLVector3& max = bbox.getMaxLocal();
- LLVector3 ctr = bbox.getCenterLocal();
-
- if (mManipPart == LL_NO_PART)
- {
- gGL.color4fv( default_normal_color.mV );
- LLGLDepthTest gls_depth(GL_FALSE);
- gGL.begin(LLRender::QUADS);
- {
- // Face 0
- gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
- gGL.vertex3f(min.mV[VX], min.mV[VY], max.mV[VZ]);
- gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
-
- // Face 1
- gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
- gGL.vertex3f(max.mV[VX], min.mV[VY], min.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
-
- // Face 2
- gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
- gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
-
- // Face 3
- gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
- gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
- gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
- gGL.vertex3f(min.mV[VX], min.mV[VY], max.mV[VZ]);
-
- // Face 4
- gGL.vertex3f(min.mV[VX], min.mV[VY], max.mV[VZ]);
- gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
- gGL.vertex3f(max.mV[VX], min.mV[VY], min.mV[VZ]);
- gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
-
- // Face 5
- gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
- gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
- gGL.vertex3f(max.mV[VX], min.mV[VY], min.mV[VZ]);
- }
- gGL.end();
- }
-
- // Find nearest vertex
- LLVector3 orientWRTHead = bbox.agentToLocalBasis( bbox.getCenterAgent() - gAgentCamera.getCameraPositionAgent() );
- U32 nearest =
- (orientWRTHead.mV[0] < 0.0f ? 1 : 0) +
- (orientWRTHead.mV[1] < 0.0f ? 2 : 0) +
- (orientWRTHead.mV[2] < 0.0f ? 4 : 0);
-
- // opposite faces on Linden cubes:
- // 0 & 5
- // 1 & 3
- // 2 & 4
-
- // Table of order to draw faces, based on nearest vertex
- static U32 face_list[8][6] = {
- { 2,0,1, 4,5,3 }, // v6 F201 F453
- { 2,0,3, 4,5,1 }, // v7 F203 F451
- { 4,0,1, 2,5,3 }, // v5 F401 F253
- { 4,0,3, 2,5,1 }, // v4 F403 F251
- { 2,5,1, 4,0,3 }, // v2 F251 F403
- { 2,5,3, 4,0,1 }, // v3 F253 F401
- { 4,5,1, 2,0,3 }, // v1 F451 F203
- { 4,5,3, 2,0,1 } // v0 F453 F201
- };
-
- {
- LLGLDepthTest gls_depth(GL_FALSE);
-
- for (S32 i = 0; i < 6; i++)
- {
- U32 face = face_list[nearest][i];
- switch( face )
- {
- case 0:
- conditionalHighlight( LL_FACE_POSZ, &z_highlight_color, &z_normal_color );
- renderAxisHandle( 8, ctr, LLVector3( ctr.mV[VX], ctr.mV[VY], max.mV[VZ] ) );
- break;
-
- case 1:
- conditionalHighlight( LL_FACE_POSX, &x_highlight_color, &x_normal_color );
- renderAxisHandle( 9, ctr, LLVector3( max.mV[VX], ctr.mV[VY], ctr.mV[VZ] ) );
- break;
-
- case 2:
- conditionalHighlight( LL_FACE_POSY, &y_highlight_color, &y_normal_color );
- renderAxisHandle( 10, ctr, LLVector3( ctr.mV[VX], max.mV[VY], ctr.mV[VZ] ) );
- break;
-
- case 3:
- conditionalHighlight( LL_FACE_NEGX, &x_highlight_color, &x_normal_color );
- renderAxisHandle( 11, ctr, LLVector3( min.mV[VX], ctr.mV[VY], ctr.mV[VZ] ) );
- break;
-
- case 4:
- conditionalHighlight( LL_FACE_NEGY, &y_highlight_color, &y_normal_color );
- renderAxisHandle( 12, ctr, LLVector3( ctr.mV[VX], min.mV[VY], ctr.mV[VZ] ) );
- break;
-
- case 5:
- conditionalHighlight( LL_FACE_NEGZ, &z_highlight_color, &z_normal_color );
- renderAxisHandle( 13, ctr, LLVector3( ctr.mV[VX], ctr.mV[VY], min.mV[VZ] ) );
- break;
- }
- }
- }
+ // Don't bother to render the drag handles for 1-D scaling if
+ // more than one object is selected or if it is an attachment
+ if ( mObjectSelection->getObjectCount() > 1 )
+ {
+ return;
+ }
+
+ // This is a flattened representation of the box as render here
+ // .
+ // (+++) (++-) /|\t
+ // +------------+ | (texture coordinates)
+ // | | |
+ // | 1 | (*) --->s
+ // | +X |
+ // | |
+ // (+++) (+-+)| |(+--) (++-) (+++)
+ // +------------+------------+------------+------------+
+ // |0 3|3 7|7 4|4 0|
+ // | 0 | 4 | 5 | 2 |
+ // | +Z | -Y | -Z | +Y |
+ // | | | | |
+ // |1 2|2 6|6 5|5 1|
+ // +------------+------------+------------+------------+
+ // (-++) (--+)| |(---) (-+-) (-++)
+ // | 3 |
+ // | -X |
+ // | |
+ // | |
+ // +------------+
+ // (-++) (-+-)
+
+ LLColor4 highlight_color( 1.f, 1.f, 1.f, 0.5f);
+ LLColor4 normal_color( 1.f, 1.f, 1.f, 0.3f);
+
+ LLColor4 x_highlight_color( 1.f, 0.2f, 0.2f, 1.0f);
+ LLColor4 x_normal_color( 0.6f, 0.f, 0.f, 0.4f);
+
+ LLColor4 y_highlight_color( 0.2f, 1.f, 0.2f, 1.0f);
+ LLColor4 y_normal_color( 0.f, 0.6f, 0.f, 0.4f);
+
+ LLColor4 z_highlight_color( 0.2f, 0.2f, 1.f, 1.0f);
+ LLColor4 z_normal_color( 0.f, 0.f, 0.6f, 0.4f);
+
+ LLColor4 default_normal_color( 0.7f, 0.7f, 0.7f, 0.15f );
+
+ const LLVector3& min = bbox.getMinLocal();
+ const LLVector3& max = bbox.getMaxLocal();
+ LLVector3 ctr = bbox.getCenterLocal();
+
+ if (mManipPart == LL_NO_PART)
+ {
+ gGL.color4fv( default_normal_color.mV );
+ LLGLDepthTest gls_depth(GL_FALSE);
+ gGL.begin(LLRender::QUADS);
+ {
+ // Face 0
+ gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], min.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
+
+ // Face 1
+ gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], min.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
+
+ // Face 2
+ gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
+
+ // Face 3
+ gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], min.mV[VY], max.mV[VZ]);
+
+ // Face 4
+ gGL.vertex3f(min.mV[VX], min.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], min.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
+
+ // Face 5
+ gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], min.mV[VY], min.mV[VZ]);
+ }
+ gGL.end();
+ }
+
+ // Find nearest vertex
+ LLVector3 orientWRTHead = bbox.agentToLocalBasis( bbox.getCenterAgent() - gAgentCamera.getCameraPositionAgent() );
+ U32 nearest =
+ (orientWRTHead.mV[0] < 0.0f ? 1 : 0) +
+ (orientWRTHead.mV[1] < 0.0f ? 2 : 0) +
+ (orientWRTHead.mV[2] < 0.0f ? 4 : 0);
+
+ // opposite faces on Linden cubes:
+ // 0 & 5
+ // 1 & 3
+ // 2 & 4
+
+ // Table of order to draw faces, based on nearest vertex
+ static U32 face_list[8][6] = {
+ { 2,0,1, 4,5,3 }, // v6 F201 F453
+ { 2,0,3, 4,5,1 }, // v7 F203 F451
+ { 4,0,1, 2,5,3 }, // v5 F401 F253
+ { 4,0,3, 2,5,1 }, // v4 F403 F251
+ { 2,5,1, 4,0,3 }, // v2 F251 F403
+ { 2,5,3, 4,0,1 }, // v3 F253 F401
+ { 4,5,1, 2,0,3 }, // v1 F451 F203
+ { 4,5,3, 2,0,1 } // v0 F453 F201
+ };
+
+ {
+ LLGLDepthTest gls_depth(GL_FALSE);
+
+ for (S32 i = 0; i < 6; i++)
+ {
+ U32 face = face_list[nearest][i];
+ switch( face )
+ {
+ case 0:
+ conditionalHighlight( LL_FACE_POSZ, &z_highlight_color, &z_normal_color );
+ renderAxisHandle( 8, ctr, LLVector3( ctr.mV[VX], ctr.mV[VY], max.mV[VZ] ) );
+ break;
+
+ case 1:
+ conditionalHighlight( LL_FACE_POSX, &x_highlight_color, &x_normal_color );
+ renderAxisHandle( 9, ctr, LLVector3( max.mV[VX], ctr.mV[VY], ctr.mV[VZ] ) );
+ break;
+
+ case 2:
+ conditionalHighlight( LL_FACE_POSY, &y_highlight_color, &y_normal_color );
+ renderAxisHandle( 10, ctr, LLVector3( ctr.mV[VX], max.mV[VY], ctr.mV[VZ] ) );
+ break;
+
+ case 3:
+ conditionalHighlight( LL_FACE_NEGX, &x_highlight_color, &x_normal_color );
+ renderAxisHandle( 11, ctr, LLVector3( min.mV[VX], ctr.mV[VY], ctr.mV[VZ] ) );
+ break;
+
+ case 4:
+ conditionalHighlight( LL_FACE_NEGY, &y_highlight_color, &y_normal_color );
+ renderAxisHandle( 12, ctr, LLVector3( ctr.mV[VX], min.mV[VY], ctr.mV[VZ] ) );
+ break;
+
+ case 5:
+ conditionalHighlight( LL_FACE_NEGZ, &z_highlight_color, &z_normal_color );
+ renderAxisHandle( 13, ctr, LLVector3( ctr.mV[VX], ctr.mV[VY], min.mV[VZ] ) );
+ break;
+ }
+ }
+ }
}
void LLManipScale::renderCorners( const LLBBox& bbox )
{
- U32 part = LL_CORNER_NNN;
-
- F32 x_offset = bbox.getMinLocal().mV[VX];
- for( S32 i=0; i < 2; i++ )
- {
- F32 y_offset = bbox.getMinLocal().mV[VY];
- for( S32 j=0; j < 2; j++ )
- {
- F32 z_offset = bbox.getMinLocal().mV[VZ];
- for( S32 k=0; k < 2; k++ )
- {
- conditionalHighlight( part );
- renderBoxHandle( x_offset, y_offset, z_offset );
- part++;
-
- z_offset = bbox.getMaxLocal().mV[VZ];
-
- }
- y_offset = bbox.getMaxLocal().mV[VY];
- }
- x_offset = bbox.getMaxLocal().mV[VX];
- }
+ U32 part = LL_CORNER_NNN;
+
+ F32 x_offset = bbox.getMinLocal().mV[VX];
+ for( S32 i=0; i < 2; i++ )
+ {
+ F32 y_offset = bbox.getMinLocal().mV[VY];
+ for( S32 j=0; j < 2; j++ )
+ {
+ F32 z_offset = bbox.getMinLocal().mV[VZ];
+ for( S32 k=0; k < 2; k++ )
+ {
+ conditionalHighlight( part );
+ renderBoxHandle( x_offset, y_offset, z_offset );
+ part++;
+
+ z_offset = bbox.getMaxLocal().mV[VZ];
+
+ }
+ y_offset = bbox.getMaxLocal().mV[VY];
+ }
+ x_offset = bbox.getMaxLocal().mV[VX];
+ }
}
void LLManipScale::renderBoxHandle( F32 x, F32 y, F32 z )
{
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest gls_depth(GL_FALSE);
- //LLGLDisable gls_stencil(GL_STENCIL_TEST);
-
- gGL.pushMatrix();
- {
- gGL.translatef( x, y, z );
- gGL.scalef( mScaledBoxHandleSize, mScaledBoxHandleSize, mScaledBoxHandleSize );
- gBox.render();
- }
- gGL.popMatrix();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest gls_depth(GL_FALSE);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
+
+ gGL.pushMatrix();
+ {
+ gGL.translatef( x, y, z );
+ gGL.scalef( mScaledBoxHandleSize, mScaledBoxHandleSize, mScaledBoxHandleSize );
+ gBox.render();
+ }
+ gGL.popMatrix();
}
void LLManipScale::renderAxisHandle( U32 handle_index, const LLVector3& start, const LLVector3& end )
{
- if( getShowAxes() )
- {
- // Draws a single "jacks" style handle: a long, retangular box from start to end.
- LLVector3 offset_start = end - start;
- offset_start.normalize();
- offset_start = start + mBoxHandleSize[handle_index] * offset_start;
-
- LLVector3 delta = end - offset_start;
- LLVector3 pos = offset_start + 0.5f * delta;
-
- gGL.pushMatrix();
- {
- gGL.translatef( pos.mV[VX], pos.mV[VY], pos.mV[VZ] );
- gGL.scalef(
- mBoxHandleSize[handle_index] + llabs(delta.mV[VX]),
- mBoxHandleSize[handle_index] + llabs(delta.mV[VY]),
- mBoxHandleSize[handle_index] + llabs(delta.mV[VZ]));
- gBox.render();
- }
- gGL.popMatrix();
- }
- else
- {
- renderBoxHandle( end.mV[VX], end.mV[VY], end.mV[VZ] );
- }
+ if( getShowAxes() )
+ {
+ // Draws a single "jacks" style handle: a long, retangular box from start to end.
+ LLVector3 offset_start = end - start;
+ offset_start.normalize();
+ offset_start = start + mBoxHandleSize[handle_index] * offset_start;
+
+ LLVector3 delta = end - offset_start;
+ LLVector3 pos = offset_start + 0.5f * delta;
+
+ gGL.pushMatrix();
+ {
+ gGL.translatef( pos.mV[VX], pos.mV[VY], pos.mV[VZ] );
+ gGL.scalef(
+ mBoxHandleSize[handle_index] + llabs(delta.mV[VX]),
+ mBoxHandleSize[handle_index] + llabs(delta.mV[VY]),
+ mBoxHandleSize[handle_index] + llabs(delta.mV[VZ]));
+ gBox.render();
+ }
+ gGL.popMatrix();
+ }
+ else
+ {
+ renderBoxHandle( end.mV[VX], end.mV[VY], end.mV[VZ] );
+ }
}
// General scale call
void LLManipScale::drag( S32 x, S32 y )
{
- if( (LL_FACE_MIN <= (S32)mManipPart)
- && ((S32)mManipPart <= LL_FACE_MAX) )
- {
- dragFace( x, y );
- }
- else if( (LL_CORNER_MIN <= (S32)mManipPart)
- && ((S32)mManipPart <= LL_CORNER_MAX) )
- {
- dragCorner( x, y );
- }
-
- // store changes to override updates
- for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin();
- iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject*cur = selectNode->getObject();
- LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
- if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- !cur->isAvatar())
- {
- selectNode->mLastScale = cur->getScale();
- selectNode->mLastPositionLocal = cur->getPosition();
- }
- }
-
- LLSelectMgr::getInstance()->updateSelectionCenter();
- gAgentCamera.clearFocusObject();
+ if( (LL_FACE_MIN <= (S32)mManipPart)
+ && ((S32)mManipPart <= LL_FACE_MAX) )
+ {
+ dragFace( x, y );
+ }
+ else if( (LL_CORNER_MIN <= (S32)mManipPart)
+ && ((S32)mManipPart <= LL_CORNER_MAX) )
+ {
+ dragCorner( x, y );
+ }
+
+ // store changes to override updates
+ for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject*cur = selectNode->getObject();
+ LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
+ if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ !cur->isAvatar())
+ {
+ selectNode->mLastScale = cur->getScale();
+ selectNode->mLastPositionLocal = cur->getPosition();
+ }
+ }
+
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ gAgentCamera.clearFocusObject();
}
// Scale on three axis simultaneously
void LLManipScale::dragCorner( S32 x, S32 y )
{
- // Suppress scale if mouse hasn't moved.
- if (x == mLastMouseX && y == mLastMouseY)
- {
- return;
- }
- mLastMouseX = x;
- mLastMouseY = y;
-
- LLVector3 drag_start_point_agent = gAgent.getPosAgentFromGlobal(mDragStartPointGlobal);
- LLVector3 drag_start_center_agent = gAgent.getPosAgentFromGlobal(mDragStartCenterGlobal);
-
- LLVector3d drag_start_dir_d;
- drag_start_dir_d.set(mDragStartPointGlobal - mDragStartCenterGlobal);
-
- F32 s = 0;
- F32 t = 0;
- nearestPointOnLineFromMouse(x, y,
- drag_start_center_agent,
- drag_start_point_agent,
- s, t );
-
- if( s <= 0 ) // we only care about intersections in front of the camera
- {
- return;
- }
- mDragPointGlobal = lerp(mDragStartCenterGlobal, mDragStartPointGlobal, t);
-
- LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
- F32 scale_factor = 1.f;
- F32 max_scale = partToMaxScale(mManipPart, bbox);
- F32 min_scale = partToMinScale(mManipPart, bbox);
- BOOL uniform = LLManipScale::getUniform();
-
- // check for snapping
- LLVector3 mouse_on_plane1;
- getMousePointOnPlaneAgent(mouse_on_plane1, x, y, mScaleCenter, mScalePlaneNormal1);
- mouse_on_plane1 -= mScaleCenter;
-
- LLVector3 mouse_on_plane2;
- getMousePointOnPlaneAgent(mouse_on_plane2, x, y, mScaleCenter, mScalePlaneNormal2);
- mouse_on_plane2 -= mScaleCenter;
-
- LLVector3 projected_drag_pos1 = inverse_projected_vec(mScaleDir, orthogonal_component(mouse_on_plane1, mSnapGuideDir1));
- LLVector3 projected_drag_pos2 = inverse_projected_vec(mScaleDir, orthogonal_component(mouse_on_plane2, mSnapGuideDir2));
-
- BOOL snap_enabled = gSavedSettings.getBOOL("SnapEnabled");
- if (snap_enabled && (mouse_on_plane1 - projected_drag_pos1) * mSnapGuideDir1 > mSnapRegimeOffset)
- {
- F32 drag_dist = mScaleDir * projected_drag_pos1; // Projecting the drag position allows for negative results, vs using the length which will result in a "reverse scaling" bug.
-
- F32 cur_subdivisions = llclamp(getSubdivisionLevel(mScaleCenter + projected_drag_pos1, mScaleDir, mScaleSnapUnit1, mTickPixelSpacing1), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
- F32 snap_dist = mScaleSnapUnit1 / (2.f * cur_subdivisions);
- F32 relative_snap_dist = fmodf(drag_dist + snap_dist, mScaleSnapUnit1 / cur_subdivisions);
-
- mScaleSnappedValue = llclamp((drag_dist - (relative_snap_dist - snap_dist)), min_scale, max_scale);
- scale_factor = mScaleSnappedValue / dist_vec(drag_start_point_agent, drag_start_center_agent);
- mScaleSnappedValue /= mScaleSnapUnit1 * 2.f;
- mSnapRegime = SNAP_REGIME_UPPER;
-
- if (!uniform)
- {
- scale_factor *= 0.5f;
- }
- }
- else if (snap_enabled && (mouse_on_plane2 - projected_drag_pos2) * mSnapGuideDir2 > mSnapRegimeOffset )
- {
- F32 drag_dist = mScaleDir * projected_drag_pos2; // Projecting the drag position allows for negative results, vs using the length which will result in a "reverse scaling" bug.
-
- F32 cur_subdivisions = llclamp(getSubdivisionLevel(mScaleCenter + projected_drag_pos2, mScaleDir, mScaleSnapUnit2, mTickPixelSpacing2), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
- F32 snap_dist = mScaleSnapUnit2 / (2.f * cur_subdivisions);
- F32 relative_snap_dist = fmodf(drag_dist + snap_dist, mScaleSnapUnit2 / cur_subdivisions);
-
- mScaleSnappedValue = llclamp((drag_dist - (relative_snap_dist - snap_dist)), min_scale, max_scale);
- scale_factor = mScaleSnappedValue / dist_vec(drag_start_point_agent, drag_start_center_agent);
- mScaleSnappedValue /= mScaleSnapUnit2 * 2.f;
- mSnapRegime = SNAP_REGIME_LOWER;
-
- if (!uniform)
- {
- scale_factor *= 0.5f;
- }
- }
- else
- {
- mSnapRegime = SNAP_REGIME_NONE;
- scale_factor = t;
- if (!uniform)
- {
- scale_factor = 0.5f + (scale_factor * 0.5f);
- }
- }
-
-
- F32 max_scale_factor = get_default_max_prim_scale() / MIN_PRIM_SCALE;
- F32 min_scale_factor = MIN_PRIM_SCALE / get_default_max_prim_scale();
-
- // find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale
- for (LLObjectSelection::iterator iter = mObjectSelection->begin();
- iter != mObjectSelection->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject* cur = selectNode->getObject();
- LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
- if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- !cur->isAvatar() )
- {
- const LLVector3& scale = selectNode->mSavedScale;
-
- F32 cur_max_scale_factor = llmin( get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VX], get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VY], get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VZ] );
- max_scale_factor = llmin( max_scale_factor, cur_max_scale_factor );
-
- F32 cur_min_scale_factor = llmax( MIN_PRIM_SCALE / scale.mV[VX], MIN_PRIM_SCALE / scale.mV[VY], MIN_PRIM_SCALE / scale.mV[VZ] );
- min_scale_factor = llmax( min_scale_factor, cur_min_scale_factor );
- }
- }
-
- scale_factor = llclamp( scale_factor, min_scale_factor, max_scale_factor );
-
- LLVector3d drag_global = uniform ? mDragStartCenterGlobal : mDragFarHitGlobal;
-
- // do the root objects i.e. (TRUE == cur->isRootEdit())
- for (LLObjectSelection::iterator iter = mObjectSelection->begin();
- iter != mObjectSelection->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject* cur = selectNode->getObject();
- LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
- if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- !cur->isAvatar() && cur->isRootEdit() )
- {
- const LLVector3& scale = selectNode->mSavedScale;
- cur->setScale( scale_factor * scale );
-
- LLVector3 delta_pos;
- LLVector3 original_pos = cur->getPositionEdit();
- LLVector3d new_pos_global = drag_global + (selectNode->mSavedPositionGlobal - drag_global) * scale_factor;
- if (!cur->isAttachment())
- {
- new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global);
- }
- cur->setPositionAbsoluteGlobal( new_pos_global );
- rebuild(cur);
-
- delta_pos = cur->getPositionEdit() - original_pos;
-
- if (selectNode->mIndividualSelection)
- {
- // counter-translate child objects if we are moving the root as an individual
- LLViewerObject::const_child_list_t& child_list = cur->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* childp = *iter;
-
- if (cur->isAttachment())
- {
- LLVector3 child_pos = childp->getPosition() - (delta_pos * ~cur->getRotationEdit());
- childp->setPosition(child_pos);
- }
- else
- {
- LLVector3d child_pos_delta(delta_pos);
- // RN: this updates drawable position instantly
- childp->setPositionAbsoluteGlobal(childp->getPositionGlobal() - child_pos_delta);
- }
- rebuild(childp);
- }
- }
- }
- }
- // do the child objects i.e. (FALSE == cur->isRootEdit())
- for (LLObjectSelection::iterator iter = mObjectSelection->begin();
- iter != mObjectSelection->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject*cur = selectNode->getObject();
- LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
- if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- !cur->isAvatar() && !cur->isRootEdit() )
- {
- const LLVector3& scale = selectNode->mSavedScale;
- cur->setScale( scale_factor * scale, FALSE );
-
- if (!selectNode->mIndividualSelection)
- {
- cur->setPosition(selectNode->mSavedPositionLocal * scale_factor);
- }
-
- rebuild(cur);
- }
- }
+ // Suppress scale if mouse hasn't moved.
+ if (x == mLastMouseX && y == mLastMouseY)
+ {
+ return;
+ }
+ mLastMouseX = x;
+ mLastMouseY = y;
+
+ LLVector3 drag_start_point_agent = gAgent.getPosAgentFromGlobal(mDragStartPointGlobal);
+ LLVector3 drag_start_center_agent = gAgent.getPosAgentFromGlobal(mDragStartCenterGlobal);
+
+ LLVector3d drag_start_dir_d;
+ drag_start_dir_d.set(mDragStartPointGlobal - mDragStartCenterGlobal);
+
+ F32 s = 0;
+ F32 t = 0;
+ nearestPointOnLineFromMouse(x, y,
+ drag_start_center_agent,
+ drag_start_point_agent,
+ s, t );
+
+ if( s <= 0 ) // we only care about intersections in front of the camera
+ {
+ return;
+ }
+ mDragPointGlobal = lerp(mDragStartCenterGlobal, mDragStartPointGlobal, t);
+
+ LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+ F32 scale_factor = 1.f;
+ F32 max_scale = partToMaxScale(mManipPart, bbox);
+ F32 min_scale = partToMinScale(mManipPart, bbox);
+ BOOL uniform = LLManipScale::getUniform();
+
+ // check for snapping
+ LLVector3 mouse_on_plane1;
+ getMousePointOnPlaneAgent(mouse_on_plane1, x, y, mScaleCenter, mScalePlaneNormal1);
+ mouse_on_plane1 -= mScaleCenter;
+
+ LLVector3 mouse_on_plane2;
+ getMousePointOnPlaneAgent(mouse_on_plane2, x, y, mScaleCenter, mScalePlaneNormal2);
+ mouse_on_plane2 -= mScaleCenter;
+
+ LLVector3 projected_drag_pos1 = inverse_projected_vec(mScaleDir, orthogonal_component(mouse_on_plane1, mSnapGuideDir1));
+ LLVector3 projected_drag_pos2 = inverse_projected_vec(mScaleDir, orthogonal_component(mouse_on_plane2, mSnapGuideDir2));
+
+ BOOL snap_enabled = gSavedSettings.getBOOL("SnapEnabled");
+ if (snap_enabled && (mouse_on_plane1 - projected_drag_pos1) * mSnapGuideDir1 > mSnapRegimeOffset)
+ {
+ F32 drag_dist = mScaleDir * projected_drag_pos1; // Projecting the drag position allows for negative results, vs using the length which will result in a "reverse scaling" bug.
+
+ F32 cur_subdivisions = llclamp(getSubdivisionLevel(mScaleCenter + projected_drag_pos1, mScaleDir, mScaleSnapUnit1, mTickPixelSpacing1), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
+ F32 snap_dist = mScaleSnapUnit1 / (2.f * cur_subdivisions);
+ F32 relative_snap_dist = fmodf(drag_dist + snap_dist, mScaleSnapUnit1 / cur_subdivisions);
+
+ mScaleSnappedValue = llclamp((drag_dist - (relative_snap_dist - snap_dist)), min_scale, max_scale);
+ scale_factor = mScaleSnappedValue / dist_vec(drag_start_point_agent, drag_start_center_agent);
+ mScaleSnappedValue /= mScaleSnapUnit1 * 2.f;
+ mSnapRegime = SNAP_REGIME_UPPER;
+
+ if (!uniform)
+ {
+ scale_factor *= 0.5f;
+ }
+ }
+ else if (snap_enabled && (mouse_on_plane2 - projected_drag_pos2) * mSnapGuideDir2 > mSnapRegimeOffset )
+ {
+ F32 drag_dist = mScaleDir * projected_drag_pos2; // Projecting the drag position allows for negative results, vs using the length which will result in a "reverse scaling" bug.
+
+ F32 cur_subdivisions = llclamp(getSubdivisionLevel(mScaleCenter + projected_drag_pos2, mScaleDir, mScaleSnapUnit2, mTickPixelSpacing2), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
+ F32 snap_dist = mScaleSnapUnit2 / (2.f * cur_subdivisions);
+ F32 relative_snap_dist = fmodf(drag_dist + snap_dist, mScaleSnapUnit2 / cur_subdivisions);
+
+ mScaleSnappedValue = llclamp((drag_dist - (relative_snap_dist - snap_dist)), min_scale, max_scale);
+ scale_factor = mScaleSnappedValue / dist_vec(drag_start_point_agent, drag_start_center_agent);
+ mScaleSnappedValue /= mScaleSnapUnit2 * 2.f;
+ mSnapRegime = SNAP_REGIME_LOWER;
+
+ if (!uniform)
+ {
+ scale_factor *= 0.5f;
+ }
+ }
+ else
+ {
+ mSnapRegime = SNAP_REGIME_NONE;
+ scale_factor = t;
+ if (!uniform)
+ {
+ scale_factor = 0.5f + (scale_factor * 0.5f);
+ }
+ }
+
+
+ F32 max_scale_factor = get_default_max_prim_scale() / MIN_PRIM_SCALE;
+ F32 min_scale_factor = MIN_PRIM_SCALE / get_default_max_prim_scale();
+
+ // find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* cur = selectNode->getObject();
+ LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
+ if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ !cur->isAvatar() )
+ {
+ const LLVector3& scale = selectNode->mSavedScale;
+
+ F32 cur_max_scale_factor = llmin( get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VX], get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VY], get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VZ] );
+ max_scale_factor = llmin( max_scale_factor, cur_max_scale_factor );
+
+ F32 cur_min_scale_factor = llmax( MIN_PRIM_SCALE / scale.mV[VX], MIN_PRIM_SCALE / scale.mV[VY], MIN_PRIM_SCALE / scale.mV[VZ] );
+ min_scale_factor = llmax( min_scale_factor, cur_min_scale_factor );
+ }
+ }
+
+ scale_factor = llclamp( scale_factor, min_scale_factor, max_scale_factor );
+
+ LLVector3d drag_global = uniform ? mDragStartCenterGlobal : mDragFarHitGlobal;
+
+ // do the root objects i.e. (TRUE == cur->isRootEdit())
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* cur = selectNode->getObject();
+ LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
+ if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ !cur->isAvatar() && cur->isRootEdit() )
+ {
+ const LLVector3& scale = selectNode->mSavedScale;
+ cur->setScale( scale_factor * scale );
+
+ LLVector3 delta_pos;
+ LLVector3 original_pos = cur->getPositionEdit();
+ LLVector3d new_pos_global = drag_global + (selectNode->mSavedPositionGlobal - drag_global) * scale_factor;
+ if (!cur->isAttachment())
+ {
+ new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global);
+ }
+ cur->setPositionAbsoluteGlobal( new_pos_global );
+ rebuild(cur);
+
+ delta_pos = cur->getPositionEdit() - original_pos;
+
+ if (selectNode->mIndividualSelection)
+ {
+ // counter-translate child objects if we are moving the root as an individual
+ LLViewerObject::const_child_list_t& child_list = cur->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* childp = *iter;
+
+ if (cur->isAttachment())
+ {
+ LLVector3 child_pos = childp->getPosition() - (delta_pos * ~cur->getRotationEdit());
+ childp->setPosition(child_pos);
+ }
+ else
+ {
+ LLVector3d child_pos_delta(delta_pos);
+ // RN: this updates drawable position instantly
+ childp->setPositionAbsoluteGlobal(childp->getPositionGlobal() - child_pos_delta);
+ }
+ rebuild(childp);
+ }
+ }
+ }
+ }
+ // do the child objects i.e. (FALSE == cur->isRootEdit())
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject*cur = selectNode->getObject();
+ LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
+ if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ !cur->isAvatar() && !cur->isRootEdit() )
+ {
+ const LLVector3& scale = selectNode->mSavedScale;
+ cur->setScale( scale_factor * scale, FALSE );
+
+ if (!selectNode->mIndividualSelection)
+ {
+ cur->setPosition(selectNode->mSavedPositionLocal * scale_factor);
+ }
+
+ rebuild(cur);
+ }
+ }
}
// Scale on a single axis
void LLManipScale::dragFace( S32 x, S32 y )
{
- // Suppress scale if mouse hasn't moved.
- if (x == mLastMouseX && y == mLastMouseY)
- {
- return;
- }
-
- mLastMouseX = x;
- mLastMouseY = y;
-
- LLVector3d drag_start_point_global = mDragStartPointGlobal;
- LLVector3d drag_start_center_global = mDragStartCenterGlobal;
- LLVector3 drag_start_point_agent = gAgent.getPosAgentFromGlobal(drag_start_point_global);
- LLVector3 drag_start_center_agent = gAgent.getPosAgentFromGlobal(drag_start_center_global);
-
- LLVector3d drag_start_dir_d;
- drag_start_dir_d.set(drag_start_point_global - drag_start_center_global);
- LLVector3 drag_start_dir_f;
- drag_start_dir_f.set(drag_start_dir_d);
-
- LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
-
- F32 s = 0;
- F32 t = 0;
-
- nearestPointOnLineFromMouse(x,
- y,
- drag_start_center_agent,
- drag_start_point_agent,
- s, t );
-
- if( s <= 0 ) // we only care about intersections in front of the camera
- {
- return;
- }
-
- LLVector3d drag_point_global = drag_start_center_global + t * drag_start_dir_d;
- LLVector3 part_dir_local = partToUnitVector( mManipPart );
-
- // check for snapping
- LLVector3 mouse_on_plane;
- getMousePointOnPlaneAgent(mouse_on_plane, x, y, mScaleCenter, mScalePlaneNormal1 );
-
- LLVector3 mouse_on_scale_line = mScaleCenter + projected_vec(mouse_on_plane - mScaleCenter, mScaleDir);
- LLVector3 drag_delta(mouse_on_scale_line - drag_start_point_agent);
- F32 max_drag_dist = partToMaxScale(mManipPart, bbox);
- F32 min_drag_dist = partToMinScale(mManipPart, bbox);
-
- BOOL uniform = LLManipScale::getUniform();
- if( uniform )
- {
- drag_delta *= 2.f;
- }
-
- LLVector3 scale_center_to_mouse = mouse_on_plane - mScaleCenter;
- F32 dist_from_scale_line = dist_vec(scale_center_to_mouse, (mouse_on_scale_line - mScaleCenter));
- F32 dist_along_scale_line = scale_center_to_mouse * mScaleDir;
-
- BOOL snap_enabled = gSavedSettings.getBOOL("SnapEnabled");
-
- if (snap_enabled && dist_from_scale_line > mSnapRegimeOffset)
- {
- mSnapRegime = static_cast<ESnapRegimes>(SNAP_REGIME_UPPER | SNAP_REGIME_LOWER); // A face drag doesn't have split regimes.
-
- if (dist_along_scale_line > max_drag_dist)
- {
- mScaleSnappedValue = max_drag_dist;
-
- LLVector3 clamp_point = mScaleCenter + max_drag_dist * mScaleDir;
- drag_delta.set(clamp_point - drag_start_point_agent);
- }
- else if (dist_along_scale_line < min_drag_dist)
- {
- mScaleSnappedValue = min_drag_dist;
-
- LLVector3 clamp_point = mScaleCenter + min_drag_dist * mScaleDir;
- drag_delta.set(clamp_point - drag_start_point_agent);
- }
- else
- {
- F32 drag_dist = scale_center_to_mouse * mScaleDir;
- F32 cur_subdivisions = llclamp(getSubdivisionLevel(mScaleCenter + mScaleDir * drag_dist, mScaleDir, mScaleSnapUnit1, mTickPixelSpacing1), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
- F32 snap_dist = mScaleSnapUnit1 / (2.f * cur_subdivisions);
- F32 relative_snap_dist = fmodf(drag_dist + snap_dist, mScaleSnapUnit1 / cur_subdivisions);
- relative_snap_dist -= snap_dist;
-
- //make sure that values that the scale is "snapped to"
- //do not exceed/go under the applicable max/mins
- //this causes the box to shift displacements ever so slightly
- //although the "snap value" should go down to 0
- //see Jira 1027
- relative_snap_dist = llclamp(relative_snap_dist,
- drag_dist - max_drag_dist,
- drag_dist - min_drag_dist);
-
- mScaleSnappedValue = (drag_dist - relative_snap_dist) / (mScaleSnapUnit1 * 2.f);
-
- if (llabs(relative_snap_dist) < snap_dist)
- {
- LLVector3 drag_correction = relative_snap_dist * mScaleDir;
- if (uniform)
- {
- drag_correction *= 2.f;
- }
-
- drag_delta -= drag_correction;
- }
- }
- }
- else
- {
- mSnapRegime = SNAP_REGIME_NONE;
- }
-
- LLVector3 dir_agent;
- if( part_dir_local.mV[VX] )
- {
- dir_agent = bbox.localToAgentBasis( LLVector3::x_axis );
- }
- else if( part_dir_local.mV[VY] )
- {
- dir_agent = bbox.localToAgentBasis( LLVector3::y_axis );
- }
- else if( part_dir_local.mV[VZ] )
- {
- dir_agent = bbox.localToAgentBasis( LLVector3::z_axis );
- }
- stretchFace(
- projected_vec(drag_start_dir_f, dir_agent) + drag_start_center_agent,
- projected_vec(drag_delta, dir_agent));
-
- mDragPointGlobal = drag_point_global;
+ // Suppress scale if mouse hasn't moved.
+ if (x == mLastMouseX && y == mLastMouseY)
+ {
+ return;
+ }
+
+ mLastMouseX = x;
+ mLastMouseY = y;
+
+ LLVector3d drag_start_point_global = mDragStartPointGlobal;
+ LLVector3d drag_start_center_global = mDragStartCenterGlobal;
+ LLVector3 drag_start_point_agent = gAgent.getPosAgentFromGlobal(drag_start_point_global);
+ LLVector3 drag_start_center_agent = gAgent.getPosAgentFromGlobal(drag_start_center_global);
+
+ LLVector3d drag_start_dir_d;
+ drag_start_dir_d.set(drag_start_point_global - drag_start_center_global);
+ LLVector3 drag_start_dir_f;
+ drag_start_dir_f.set(drag_start_dir_d);
+
+ LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+
+ F32 s = 0;
+ F32 t = 0;
+
+ nearestPointOnLineFromMouse(x,
+ y,
+ drag_start_center_agent,
+ drag_start_point_agent,
+ s, t );
+
+ if( s <= 0 ) // we only care about intersections in front of the camera
+ {
+ return;
+ }
+
+ LLVector3d drag_point_global = drag_start_center_global + t * drag_start_dir_d;
+ LLVector3 part_dir_local = partToUnitVector( mManipPart );
+
+ // check for snapping
+ LLVector3 mouse_on_plane;
+ getMousePointOnPlaneAgent(mouse_on_plane, x, y, mScaleCenter, mScalePlaneNormal1 );
+
+ LLVector3 mouse_on_scale_line = mScaleCenter + projected_vec(mouse_on_plane - mScaleCenter, mScaleDir);
+ LLVector3 drag_delta(mouse_on_scale_line - drag_start_point_agent);
+ F32 max_drag_dist = partToMaxScale(mManipPart, bbox);
+ F32 min_drag_dist = partToMinScale(mManipPart, bbox);
+
+ BOOL uniform = LLManipScale::getUniform();
+ if( uniform )
+ {
+ drag_delta *= 2.f;
+ }
+
+ LLVector3 scale_center_to_mouse = mouse_on_plane - mScaleCenter;
+ F32 dist_from_scale_line = dist_vec(scale_center_to_mouse, (mouse_on_scale_line - mScaleCenter));
+ F32 dist_along_scale_line = scale_center_to_mouse * mScaleDir;
+
+ BOOL snap_enabled = gSavedSettings.getBOOL("SnapEnabled");
+
+ if (snap_enabled && dist_from_scale_line > mSnapRegimeOffset)
+ {
+ mSnapRegime = static_cast<ESnapRegimes>(SNAP_REGIME_UPPER | SNAP_REGIME_LOWER); // A face drag doesn't have split regimes.
+
+ if (dist_along_scale_line > max_drag_dist)
+ {
+ mScaleSnappedValue = max_drag_dist;
+
+ LLVector3 clamp_point = mScaleCenter + max_drag_dist * mScaleDir;
+ drag_delta.set(clamp_point - drag_start_point_agent);
+ }
+ else if (dist_along_scale_line < min_drag_dist)
+ {
+ mScaleSnappedValue = min_drag_dist;
+
+ LLVector3 clamp_point = mScaleCenter + min_drag_dist * mScaleDir;
+ drag_delta.set(clamp_point - drag_start_point_agent);
+ }
+ else
+ {
+ F32 drag_dist = scale_center_to_mouse * mScaleDir;
+ F32 cur_subdivisions = llclamp(getSubdivisionLevel(mScaleCenter + mScaleDir * drag_dist, mScaleDir, mScaleSnapUnit1, mTickPixelSpacing1), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
+ F32 snap_dist = mScaleSnapUnit1 / (2.f * cur_subdivisions);
+ F32 relative_snap_dist = fmodf(drag_dist + snap_dist, mScaleSnapUnit1 / cur_subdivisions);
+ relative_snap_dist -= snap_dist;
+
+ //make sure that values that the scale is "snapped to"
+ //do not exceed/go under the applicable max/mins
+ //this causes the box to shift displacements ever so slightly
+ //although the "snap value" should go down to 0
+ //see Jira 1027
+ relative_snap_dist = llclamp(relative_snap_dist,
+ drag_dist - max_drag_dist,
+ drag_dist - min_drag_dist);
+
+ mScaleSnappedValue = (drag_dist - relative_snap_dist) / (mScaleSnapUnit1 * 2.f);
+
+ if (llabs(relative_snap_dist) < snap_dist)
+ {
+ LLVector3 drag_correction = relative_snap_dist * mScaleDir;
+ if (uniform)
+ {
+ drag_correction *= 2.f;
+ }
+
+ drag_delta -= drag_correction;
+ }
+ }
+ }
+ else
+ {
+ mSnapRegime = SNAP_REGIME_NONE;
+ }
+
+ LLVector3 dir_agent;
+ if( part_dir_local.mV[VX] )
+ {
+ dir_agent = bbox.localToAgentBasis( LLVector3::x_axis );
+ }
+ else if( part_dir_local.mV[VY] )
+ {
+ dir_agent = bbox.localToAgentBasis( LLVector3::y_axis );
+ }
+ else if( part_dir_local.mV[VZ] )
+ {
+ dir_agent = bbox.localToAgentBasis( LLVector3::z_axis );
+ }
+ stretchFace(
+ projected_vec(drag_start_dir_f, dir_agent) + drag_start_center_agent,
+ projected_vec(drag_delta, dir_agent));
+
+ mDragPointGlobal = drag_point_global;
}
void LLManipScale::sendUpdates( BOOL send_position_update, BOOL send_scale_update, BOOL corner )
{
- // Throttle updates to 10 per second.
- static LLTimer update_timer;
- F32 elapsed_time = update_timer.getElapsedTimeF32();
- const F32 UPDATE_DELAY = 0.1f; // min time between transmitted updates
-
- if( send_scale_update || send_position_update )
- {
- U32 update_flags = UPD_NONE;
- if (send_position_update) update_flags |= UPD_POSITION;
- if (send_scale_update) update_flags |= UPD_SCALE;
-
-// BOOL send_type = SEND_INDIVIDUALS;
- if (corner)
- {
- update_flags |= UPD_UNIFORM;
- }
- // keep this up to date for sendonmouseup
- mLastUpdateFlags = update_flags;
-
- // enforce minimum update delay and don't stream updates on sub-object selections
- if( elapsed_time > UPDATE_DELAY && !gSavedSettings.getBOOL("EditLinkedParts") )
- {
- LLSelectMgr::getInstance()->sendMultipleUpdate( update_flags );
- update_timer.reset();
- mSendUpdateOnMouseUp = FALSE;
- }
- else
- {
- mSendUpdateOnMouseUp = TRUE;
- }
- dialog_refresh_all();
- }
+ // Throttle updates to 10 per second.
+ static LLTimer update_timer;
+ F32 elapsed_time = update_timer.getElapsedTimeF32();
+ const F32 UPDATE_DELAY = 0.1f; // min time between transmitted updates
+
+ if( send_scale_update || send_position_update )
+ {
+ U32 update_flags = UPD_NONE;
+ if (send_position_update) update_flags |= UPD_POSITION;
+ if (send_scale_update) update_flags |= UPD_SCALE;
+
+// BOOL send_type = SEND_INDIVIDUALS;
+ if (corner)
+ {
+ update_flags |= UPD_UNIFORM;
+ }
+ // keep this up to date for sendonmouseup
+ mLastUpdateFlags = update_flags;
+
+ // enforce minimum update delay and don't stream updates on sub-object selections
+ if( elapsed_time > UPDATE_DELAY && !gSavedSettings.getBOOL("EditLinkedParts") )
+ {
+ LLSelectMgr::getInstance()->sendMultipleUpdate( update_flags );
+ update_timer.reset();
+ mSendUpdateOnMouseUp = FALSE;
+ }
+ else
+ {
+ mSendUpdateOnMouseUp = TRUE;
+ }
+ dialog_refresh_all();
+ }
}
// Rescales in a single dimension. Either uniform (standard) or one-sided (scale plus translation)
// depending on mUniform. Handles multiple selection and objects that are not aligned to the bounding box.
void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVector3& drag_delta_agent )
{
- LLVector3 drag_start_center_agent = gAgent.getPosAgentFromGlobal(mDragStartCenterGlobal);
-
- for (LLObjectSelection::iterator iter = mObjectSelection->begin();
- iter != mObjectSelection->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject*cur = selectNode->getObject();
- LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
- if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- !cur->isAvatar() )
- {
- LLBBox cur_bbox = cur->getBoundingBoxAgent();
- LLVector3 start_local = cur_bbox.agentToLocal( drag_start_agent );
- LLVector3 end_local = cur_bbox.agentToLocal( drag_start_agent + drag_delta_agent);
- LLVector3 start_center_local = cur_bbox.agentToLocal( drag_start_center_agent );
- LLVector3 axis = nearestAxis( start_local - start_center_local );
- S32 axis_index = axis.mV[0] ? 0 : (axis.mV[1] ? 1 : 2 );
-
- LLVector3 delta_local = end_local - start_local;
- F32 delta_local_mag = delta_local.length();
- LLVector3 dir_local;
- if (delta_local_mag == 0.f)
- {
- dir_local = axis;
- }
- else
- {
- dir_local = delta_local / delta_local_mag; // normalized delta_local
- }
-
- F32 denom = axis * dir_local;
- F32 desired_delta_size = is_approx_zero(denom) ? 0.f : (delta_local_mag / denom); // in meters
- F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, MIN_PRIM_SCALE, get_default_max_prim_scale(LLPickInfo::isFlora(cur)));
- // propagate scale constraint back to position offset
- desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position
-
- LLVector3 scale = cur->getScale();
- scale.mV[axis_index] = desired_scale;
- cur->setScale(scale, FALSE);
- rebuild(cur);
- LLVector3 delta_pos;
- if( !getUniform() )
- {
- LLVector3 delta_pos_local = axis * (0.5f * desired_delta_size);
- LLVector3d delta_pos_global;
- delta_pos_global.set(cur_bbox.localToAgent( delta_pos_local ) - cur_bbox.getCenterAgent());
- LLVector3 cur_pos = cur->getPositionEdit();
-
- if (cur->isRootEdit() && !cur->isAttachment())
- {
- LLVector3d new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, selectNode->mSavedPositionGlobal + delta_pos_global);
- cur->setPositionGlobal( new_pos_global );
- }
- else
- {
- LLXform* parent_xform = cur->mDrawable->getXform()->getParent();
- LLVector3 new_pos_local;
- // this works in attachment point space using world space delta
- if (parent_xform)
- {
- new_pos_local = selectNode->mSavedPositionLocal + (LLVector3(delta_pos_global) * ~parent_xform->getWorldRotation());
- }
- else
- {
- new_pos_local = selectNode->mSavedPositionLocal + LLVector3(delta_pos_global);
- }
- cur->setPosition(new_pos_local);
- }
- delta_pos = cur->getPositionEdit() - cur_pos;
- }
- if (cur->isRootEdit() && selectNode->mIndividualSelection)
- {
- // counter-translate child objects if we are moving the root as an individual
- LLViewerObject::const_child_list_t& child_list = cur->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* childp = *iter;
- if (!getUniform())
- {
- LLVector3 child_pos = childp->getPosition() - (delta_pos * ~cur->getRotationEdit());
- childp->setPosition(child_pos);
- rebuild(childp);
- }
- }
- }
- }
- }
+ LLVector3 drag_start_center_agent = gAgent.getPosAgentFromGlobal(mDragStartCenterGlobal);
+
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject*cur = selectNode->getObject();
+ LLViewerObject *root_object = (cur == NULL) ? NULL : cur->getRootEdit();
+ if( cur->permModify() && cur->permMove() && !cur->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ !cur->isAvatar() )
+ {
+ LLBBox cur_bbox = cur->getBoundingBoxAgent();
+ LLVector3 start_local = cur_bbox.agentToLocal( drag_start_agent );
+ LLVector3 end_local = cur_bbox.agentToLocal( drag_start_agent + drag_delta_agent);
+ LLVector3 start_center_local = cur_bbox.agentToLocal( drag_start_center_agent );
+ LLVector3 axis = nearestAxis( start_local - start_center_local );
+ S32 axis_index = axis.mV[0] ? 0 : (axis.mV[1] ? 1 : 2 );
+
+ LLVector3 delta_local = end_local - start_local;
+ F32 delta_local_mag = delta_local.length();
+ LLVector3 dir_local;
+ if (delta_local_mag == 0.f)
+ {
+ dir_local = axis;
+ }
+ else
+ {
+ dir_local = delta_local / delta_local_mag; // normalized delta_local
+ }
+
+ F32 denom = axis * dir_local;
+ F32 desired_delta_size = is_approx_zero(denom) ? 0.f : (delta_local_mag / denom); // in meters
+ F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, MIN_PRIM_SCALE, get_default_max_prim_scale(LLPickInfo::isFlora(cur)));
+ // propagate scale constraint back to position offset
+ desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position
+
+ LLVector3 scale = cur->getScale();
+ scale.mV[axis_index] = desired_scale;
+ cur->setScale(scale, FALSE);
+ rebuild(cur);
+ LLVector3 delta_pos;
+ if( !getUniform() )
+ {
+ LLVector3 delta_pos_local = axis * (0.5f * desired_delta_size);
+ LLVector3d delta_pos_global;
+ delta_pos_global.set(cur_bbox.localToAgent( delta_pos_local ) - cur_bbox.getCenterAgent());
+ LLVector3 cur_pos = cur->getPositionEdit();
+
+ if (cur->isRootEdit() && !cur->isAttachment())
+ {
+ LLVector3d new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, selectNode->mSavedPositionGlobal + delta_pos_global);
+ cur->setPositionGlobal( new_pos_global );
+ }
+ else
+ {
+ LLXform* parent_xform = cur->mDrawable->getXform()->getParent();
+ LLVector3 new_pos_local;
+ // this works in attachment point space using world space delta
+ if (parent_xform)
+ {
+ new_pos_local = selectNode->mSavedPositionLocal + (LLVector3(delta_pos_global) * ~parent_xform->getWorldRotation());
+ }
+ else
+ {
+ new_pos_local = selectNode->mSavedPositionLocal + LLVector3(delta_pos_global);
+ }
+ cur->setPosition(new_pos_local);
+ }
+ delta_pos = cur->getPositionEdit() - cur_pos;
+ }
+ if (cur->isRootEdit() && selectNode->mIndividualSelection)
+ {
+ // counter-translate child objects if we are moving the root as an individual
+ LLViewerObject::const_child_list_t& child_list = cur->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* childp = *iter;
+ if (!getUniform())
+ {
+ LLVector3 child_pos = childp->getPosition() - (delta_pos * ~cur->getRotationEdit());
+ childp->setPosition(child_pos);
+ rebuild(childp);
+ }
+ }
+ }
+ }
+ }
}
void LLManipScale::renderGuidelinesPart( const LLBBox& bbox )
{
- LLVector3 guideline_start = bbox.getCenterLocal();
-
- LLVector3 guideline_end = unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox );
-
- if (!getUniform())
- {
- guideline_start = unitVectorToLocalBBoxExtent( -partToUnitVector( mManipPart ), bbox );
- }
-
- guideline_end -= guideline_start;
- guideline_end.normalize();
- guideline_end *= LLWorld::getInstance()->getRegionWidthInMeters();
- guideline_end += guideline_start;
-
- {
- LLGLDepthTest gls_depth(GL_TRUE);
- gl_line_3d( guideline_start, guideline_end, LLColor4(1.f, 1.f, 1.f, 0.5f) );
- }
- {
- LLGLDepthTest gls_depth(GL_FALSE);
- gl_line_3d( guideline_start, guideline_end, LLColor4(1.f, 1.f, 1.f, 0.25f) );
- }
+ LLVector3 guideline_start = bbox.getCenterLocal();
+
+ LLVector3 guideline_end = unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox );
+
+ if (!getUniform())
+ {
+ guideline_start = unitVectorToLocalBBoxExtent( -partToUnitVector( mManipPart ), bbox );
+ }
+
+ guideline_end -= guideline_start;
+ guideline_end.normalize();
+ guideline_end *= LLWorld::getInstance()->getRegionWidthInMeters();
+ guideline_end += guideline_start;
+
+ {
+ LLGLDepthTest gls_depth(GL_TRUE);
+ gl_line_3d( guideline_start, guideline_end, LLColor4(1.f, 1.f, 1.f, 0.5f) );
+ }
+ {
+ LLGLDepthTest gls_depth(GL_FALSE);
+ gl_line_3d( guideline_start, guideline_end, LLColor4(1.f, 1.f, 1.f, 0.25f) );
+ }
}
void LLManipScale::updateSnapGuides(const LLBBox& bbox)
{
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
-
- bool uniform = LLManipScale::getUniform();
-
- LLVector3 box_corner_agent = bbox.localToAgent(unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ));
- mScaleCenter = uniform ? bbox.getCenterAgent() : bbox.localToAgent(unitVectorToLocalBBoxExtent( -1.f * partToUnitVector( mManipPart ), bbox ));
- mScaleDir = box_corner_agent - mScaleCenter;
- mScaleDir.normalize();
-
- if(mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- mSnapRegimeOffset = SNAP_GUIDE_SCREEN_OFFSET / gAgentCamera.mHUDCurZoom;
- }
- else
- {
- F32 object_distance = dist_vec(box_corner_agent, LLViewerCamera::getInstance()->getOrigin());
- mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWorldViewWidthRaw() * object_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio();
- }
- LLVector3 cam_at_axis;
- F32 snap_guide_length;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- cam_at_axis.set(1.f, 0.f, 0.f);
- snap_guide_length = SNAP_GUIDE_SCREEN_LENGTH / gAgentCamera.mHUDCurZoom;
- }
- else
- {
- cam_at_axis = LLViewerCamera::getInstance()->getAtAxis();
- F32 manipulator_distance = dist_vec(box_corner_agent, LLViewerCamera::getInstance()->getOrigin());
- snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWorldViewWidthRaw() * manipulator_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio();
- }
-
- mSnapGuideLength = snap_guide_length / llmax(0.1f, (llmin(mSnapGuideDir1 * cam_at_axis, mSnapGuideDir2 * cam_at_axis)));
-
- LLVector3 off_axis_dir = mScaleDir % cam_at_axis;
- off_axis_dir.normalize();
-
- if( (LL_FACE_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_FACE_MAX) )
- {
- LLVector3 bbox_relative_cam_dir = off_axis_dir * ~bbox.getRotation();
- bbox_relative_cam_dir.abs();
- if (bbox_relative_cam_dir.mV[VX] > bbox_relative_cam_dir.mV[VY] && bbox_relative_cam_dir.mV[VX] > bbox_relative_cam_dir.mV[VZ])
- {
- mSnapGuideDir1 = LLVector3::x_axis * bbox.getRotation();
- }
- else if (bbox_relative_cam_dir.mV[VY] > bbox_relative_cam_dir.mV[VZ])
- {
- mSnapGuideDir1 = LLVector3::y_axis * bbox.getRotation();
- }
- else
- {
- mSnapGuideDir1 = LLVector3::z_axis * bbox.getRotation();
- }
-
- LLVector3 scale_snap = grid_scale;
- mScaleSnapUnit1 = scale_snap.scaleVec(partToUnitVector( mManipPart )).length();
- mScaleSnapUnit2 = mScaleSnapUnit1;
- mSnapGuideDir1 *= mSnapGuideDir1 * LLViewerCamera::getInstance()->getUpAxis() > 0.f ? 1.f : -1.f;
- mSnapGuideDir2 = mSnapGuideDir1 * -1.f;
- mSnapDir1 = mScaleDir;
- mSnapDir2 = mScaleDir;
- }
- else if( (LL_CORNER_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_CORNER_MAX) )
- {
- LLVector3 local_camera_dir;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- local_camera_dir = LLVector3(-1.f, 0.f, 0.f) * ~bbox.getRotation();
- }
- else
- {
- local_camera_dir = (LLViewerCamera::getInstance()->getOrigin() - box_corner_agent) * ~bbox.getRotation();
- local_camera_dir.normalize();
- }
-
- LLVector3 axis_flip;
- switch (mManipPart)
- {
- case LL_CORNER_NNN:
- axis_flip.set(1.f, 1.f, 1.f);
- break;
- case LL_CORNER_NNP:
- axis_flip.set(1.f, 1.f, -1.f);
- break;
- case LL_CORNER_NPN:
- axis_flip.set(1.f, -1.f, 1.f);
- break;
- case LL_CORNER_NPP:
- axis_flip.set(1.f, -1.f, -1.f);
- break;
- case LL_CORNER_PNN:
- axis_flip.set(-1.f, 1.f, 1.f);
- break;
- case LL_CORNER_PNP:
- axis_flip.set(-1.f, 1.f, -1.f);
- break;
- case LL_CORNER_PPN:
- axis_flip.set(-1.f, -1.f, 1.f);
- break;
- case LL_CORNER_PPP:
- axis_flip.set(-1.f, -1.f, -1.f);
- break;
- default:
- break;
- }
-
- // account for which side of the object the camera is located and negate appropriate axes
- local_camera_dir.scaleVec(axis_flip);
-
- // normalize to object scale
- LLVector3 bbox_extent = bbox.getExtentLocal();
- local_camera_dir.scaleVec(LLVector3(1.f / bbox_extent.mV[VX], 1.f / bbox_extent.mV[VY], 1.f / bbox_extent.mV[VZ]));
-
- S32 scale_face = -1;
-
- if ((local_camera_dir.mV[VX] > 0.f) == (local_camera_dir.mV[VY] > 0.f))
- {
- if ((local_camera_dir.mV[VZ] > 0.f) == (local_camera_dir.mV[VY] > 0.f))
- {
- LLVector3 local_camera_dir_abs = local_camera_dir;
- local_camera_dir_abs.abs();
- // all neighboring faces of bbox are pointing towards camera or away from camera
- // use largest magnitude face for snap guides
- if (local_camera_dir_abs.mV[VX] > local_camera_dir_abs.mV[VY])
- {
- if (local_camera_dir_abs.mV[VX] > local_camera_dir_abs.mV[VZ])
- {
- scale_face = VX;
- }
- else
- {
- scale_face = VZ;
- }
- }
- else // y > x
- {
- if (local_camera_dir_abs.mV[VY] > local_camera_dir_abs.mV[VZ])
- {
- scale_face = VY;
- }
- else
- {
- scale_face = VZ;
- }
- }
- }
- else
- {
- // z axis facing opposite direction from x and y relative to camera, use x and y for snap guides
- scale_face = VZ;
- }
- }
- else // x and y axes are facing in opposite directions relative to camera
- {
- if ((local_camera_dir.mV[VZ] > 0.f) == (local_camera_dir.mV[VY] > 0.f))
- {
- // x axis facing opposite direction from y and z relative to camera, use y and z for snap guides
- scale_face = VX;
- }
- else
- {
- // y axis facing opposite direction from x and z relative to camera, use x and z for snap guides
- scale_face = VY;
- }
- }
-
- switch(scale_face)
- {
- case VX:
- // x axis face being scaled, use y and z for snap guides
- mSnapGuideDir1 = LLVector3::y_axis.scaledVec(axis_flip);
- mScaleSnapUnit1 = grid_scale.mV[VZ];
- mSnapGuideDir2 = LLVector3::z_axis.scaledVec(axis_flip);
- mScaleSnapUnit2 = grid_scale.mV[VY];
- break;
- case VY:
- // y axis facing being scaled, use x and z for snap guides
- mSnapGuideDir1 = LLVector3::x_axis.scaledVec(axis_flip);
- mScaleSnapUnit1 = grid_scale.mV[VZ];
- mSnapGuideDir2 = LLVector3::z_axis.scaledVec(axis_flip);
- mScaleSnapUnit2 = grid_scale.mV[VX];
- break;
- case VZ:
- // z axis facing being scaled, use x and y for snap guides
- mSnapGuideDir1 = LLVector3::x_axis.scaledVec(axis_flip);
- mScaleSnapUnit1 = grid_scale.mV[VY];
- mSnapGuideDir2 = LLVector3::y_axis.scaledVec(axis_flip);
- mScaleSnapUnit2 = grid_scale.mV[VX];
- break;
- default:
- mSnapGuideDir1.setZero();
- mScaleSnapUnit1 = 0.f;
-
- mSnapGuideDir2.setZero();
- mScaleSnapUnit2 = 0.f;
- break;
- }
-
- mSnapGuideDir1.rotVec(bbox.getRotation());
- mSnapGuideDir2.rotVec(bbox.getRotation());
- mSnapDir1 = -1.f * mSnapGuideDir2;
- mSnapDir2 = -1.f * mSnapGuideDir1;
- }
-
- mScalePlaneNormal1 = mSnapGuideDir1 % mScaleDir;
- mScalePlaneNormal1.normalize();
-
- mScalePlaneNormal2 = mSnapGuideDir2 % mScaleDir;
- mScalePlaneNormal2.normalize();
-
- mScaleSnapUnit1 = mScaleSnapUnit1 / (mSnapDir1 * mScaleDir);
- mScaleSnapUnit2 = mScaleSnapUnit2 / (mSnapDir2 * mScaleDir);
-
- mTickPixelSpacing1 = ll_round((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir1).length());
- mTickPixelSpacing2 = ll_round((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir2).length());
-
- if (uniform)
- {
- mScaleSnapUnit1 *= 0.5f;
- mScaleSnapUnit2 *= 0.5f;
- }
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+
+ bool uniform = LLManipScale::getUniform();
+
+ LLVector3 box_corner_agent = bbox.localToAgent(unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ));
+ mScaleCenter = uniform ? bbox.getCenterAgent() : bbox.localToAgent(unitVectorToLocalBBoxExtent( -1.f * partToUnitVector( mManipPart ), bbox ));
+ mScaleDir = box_corner_agent - mScaleCenter;
+ mScaleDir.normalize();
+
+ if(mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ mSnapRegimeOffset = SNAP_GUIDE_SCREEN_OFFSET / gAgentCamera.mHUDCurZoom;
+ }
+ else
+ {
+ F32 object_distance = dist_vec(box_corner_agent, LLViewerCamera::getInstance()->getOrigin());
+ mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWorldViewWidthRaw() * object_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio();
+ }
+ LLVector3 cam_at_axis;
+ F32 snap_guide_length;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ cam_at_axis.set(1.f, 0.f, 0.f);
+ snap_guide_length = SNAP_GUIDE_SCREEN_LENGTH / gAgentCamera.mHUDCurZoom;
+ }
+ else
+ {
+ cam_at_axis = LLViewerCamera::getInstance()->getAtAxis();
+ F32 manipulator_distance = dist_vec(box_corner_agent, LLViewerCamera::getInstance()->getOrigin());
+ snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWorldViewWidthRaw() * manipulator_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio();
+ }
+
+ mSnapGuideLength = snap_guide_length / llmax(0.1f, (llmin(mSnapGuideDir1 * cam_at_axis, mSnapGuideDir2 * cam_at_axis)));
+
+ LLVector3 off_axis_dir = mScaleDir % cam_at_axis;
+ off_axis_dir.normalize();
+
+ if( (LL_FACE_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_FACE_MAX) )
+ {
+ LLVector3 bbox_relative_cam_dir = off_axis_dir * ~bbox.getRotation();
+ bbox_relative_cam_dir.abs();
+ if (bbox_relative_cam_dir.mV[VX] > bbox_relative_cam_dir.mV[VY] && bbox_relative_cam_dir.mV[VX] > bbox_relative_cam_dir.mV[VZ])
+ {
+ mSnapGuideDir1 = LLVector3::x_axis * bbox.getRotation();
+ }
+ else if (bbox_relative_cam_dir.mV[VY] > bbox_relative_cam_dir.mV[VZ])
+ {
+ mSnapGuideDir1 = LLVector3::y_axis * bbox.getRotation();
+ }
+ else
+ {
+ mSnapGuideDir1 = LLVector3::z_axis * bbox.getRotation();
+ }
+
+ LLVector3 scale_snap = grid_scale;
+ mScaleSnapUnit1 = scale_snap.scaleVec(partToUnitVector( mManipPart )).length();
+ mScaleSnapUnit2 = mScaleSnapUnit1;
+ mSnapGuideDir1 *= mSnapGuideDir1 * LLViewerCamera::getInstance()->getUpAxis() > 0.f ? 1.f : -1.f;
+ mSnapGuideDir2 = mSnapGuideDir1 * -1.f;
+ mSnapDir1 = mScaleDir;
+ mSnapDir2 = mScaleDir;
+ }
+ else if( (LL_CORNER_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_CORNER_MAX) )
+ {
+ LLVector3 local_camera_dir;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ local_camera_dir = LLVector3(-1.f, 0.f, 0.f) * ~bbox.getRotation();
+ }
+ else
+ {
+ local_camera_dir = (LLViewerCamera::getInstance()->getOrigin() - box_corner_agent) * ~bbox.getRotation();
+ local_camera_dir.normalize();
+ }
+
+ LLVector3 axis_flip;
+ switch (mManipPart)
+ {
+ case LL_CORNER_NNN:
+ axis_flip.set(1.f, 1.f, 1.f);
+ break;
+ case LL_CORNER_NNP:
+ axis_flip.set(1.f, 1.f, -1.f);
+ break;
+ case LL_CORNER_NPN:
+ axis_flip.set(1.f, -1.f, 1.f);
+ break;
+ case LL_CORNER_NPP:
+ axis_flip.set(1.f, -1.f, -1.f);
+ break;
+ case LL_CORNER_PNN:
+ axis_flip.set(-1.f, 1.f, 1.f);
+ break;
+ case LL_CORNER_PNP:
+ axis_flip.set(-1.f, 1.f, -1.f);
+ break;
+ case LL_CORNER_PPN:
+ axis_flip.set(-1.f, -1.f, 1.f);
+ break;
+ case LL_CORNER_PPP:
+ axis_flip.set(-1.f, -1.f, -1.f);
+ break;
+ default:
+ break;
+ }
+
+ // account for which side of the object the camera is located and negate appropriate axes
+ local_camera_dir.scaleVec(axis_flip);
+
+ // normalize to object scale
+ LLVector3 bbox_extent = bbox.getExtentLocal();
+ local_camera_dir.scaleVec(LLVector3(1.f / bbox_extent.mV[VX], 1.f / bbox_extent.mV[VY], 1.f / bbox_extent.mV[VZ]));
+
+ S32 scale_face = -1;
+
+ if ((local_camera_dir.mV[VX] > 0.f) == (local_camera_dir.mV[VY] > 0.f))
+ {
+ if ((local_camera_dir.mV[VZ] > 0.f) == (local_camera_dir.mV[VY] > 0.f))
+ {
+ LLVector3 local_camera_dir_abs = local_camera_dir;
+ local_camera_dir_abs.abs();
+ // all neighboring faces of bbox are pointing towards camera or away from camera
+ // use largest magnitude face for snap guides
+ if (local_camera_dir_abs.mV[VX] > local_camera_dir_abs.mV[VY])
+ {
+ if (local_camera_dir_abs.mV[VX] > local_camera_dir_abs.mV[VZ])
+ {
+ scale_face = VX;
+ }
+ else
+ {
+ scale_face = VZ;
+ }
+ }
+ else // y > x
+ {
+ if (local_camera_dir_abs.mV[VY] > local_camera_dir_abs.mV[VZ])
+ {
+ scale_face = VY;
+ }
+ else
+ {
+ scale_face = VZ;
+ }
+ }
+ }
+ else
+ {
+ // z axis facing opposite direction from x and y relative to camera, use x and y for snap guides
+ scale_face = VZ;
+ }
+ }
+ else // x and y axes are facing in opposite directions relative to camera
+ {
+ if ((local_camera_dir.mV[VZ] > 0.f) == (local_camera_dir.mV[VY] > 0.f))
+ {
+ // x axis facing opposite direction from y and z relative to camera, use y and z for snap guides
+ scale_face = VX;
+ }
+ else
+ {
+ // y axis facing opposite direction from x and z relative to camera, use x and z for snap guides
+ scale_face = VY;
+ }
+ }
+
+ switch(scale_face)
+ {
+ case VX:
+ // x axis face being scaled, use y and z for snap guides
+ mSnapGuideDir1 = LLVector3::y_axis.scaledVec(axis_flip);
+ mScaleSnapUnit1 = grid_scale.mV[VZ];
+ mSnapGuideDir2 = LLVector3::z_axis.scaledVec(axis_flip);
+ mScaleSnapUnit2 = grid_scale.mV[VY];
+ break;
+ case VY:
+ // y axis facing being scaled, use x and z for snap guides
+ mSnapGuideDir1 = LLVector3::x_axis.scaledVec(axis_flip);
+ mScaleSnapUnit1 = grid_scale.mV[VZ];
+ mSnapGuideDir2 = LLVector3::z_axis.scaledVec(axis_flip);
+ mScaleSnapUnit2 = grid_scale.mV[VX];
+ break;
+ case VZ:
+ // z axis facing being scaled, use x and y for snap guides
+ mSnapGuideDir1 = LLVector3::x_axis.scaledVec(axis_flip);
+ mScaleSnapUnit1 = grid_scale.mV[VY];
+ mSnapGuideDir2 = LLVector3::y_axis.scaledVec(axis_flip);
+ mScaleSnapUnit2 = grid_scale.mV[VX];
+ break;
+ default:
+ mSnapGuideDir1.setZero();
+ mScaleSnapUnit1 = 0.f;
+
+ mSnapGuideDir2.setZero();
+ mScaleSnapUnit2 = 0.f;
+ break;
+ }
+
+ mSnapGuideDir1.rotVec(bbox.getRotation());
+ mSnapGuideDir2.rotVec(bbox.getRotation());
+ mSnapDir1 = -1.f * mSnapGuideDir2;
+ mSnapDir2 = -1.f * mSnapGuideDir1;
+ }
+
+ mScalePlaneNormal1 = mSnapGuideDir1 % mScaleDir;
+ mScalePlaneNormal1.normalize();
+
+ mScalePlaneNormal2 = mSnapGuideDir2 % mScaleDir;
+ mScalePlaneNormal2.normalize();
+
+ mScaleSnapUnit1 = mScaleSnapUnit1 / (mSnapDir1 * mScaleDir);
+ mScaleSnapUnit2 = mScaleSnapUnit2 / (mSnapDir2 * mScaleDir);
+
+ mTickPixelSpacing1 = ll_round((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir1).length());
+ mTickPixelSpacing2 = ll_round((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir2).length());
+
+ if (uniform)
+ {
+ mScaleSnapUnit1 *= 0.5f;
+ mScaleSnapUnit2 *= 0.5f;
+ }
}
void LLManipScale::renderSnapGuides(const LLBBox& bbox)
{
- if (!gSavedSettings.getBOOL("SnapEnabled"))
- {
- return;
- }
-
- F32 grid_alpha = gSavedSettings.getF32("GridOpacity");
-
- F32 max_point_on_scale_line = partToMaxScale(mManipPart, bbox);
- LLVector3 drag_point = gAgent.getPosAgentFromGlobal(mDragPointGlobal);
-
- updateGridSettings();
-
- S32 pass;
- for (pass = 0; pass < 3; pass++)
- {
- LLColor4 tick_color = setupSnapGuideRenderPass(pass);
-
- gGL.begin(LLRender::LINES);
- LLVector3 line_mid = mScaleCenter + (mScaleSnappedValue * mScaleDir) + (mSnapGuideDir1 * mSnapRegimeOffset);
- LLVector3 line_start = line_mid - (mScaleDir * (llmin(mScaleSnappedValue, mSnapGuideLength * 0.5f)));
- LLVector3 line_end = line_mid + (mScaleDir * llmin(max_point_on_scale_line - mScaleSnappedValue, mSnapGuideLength * 0.5f));
-
- gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * 0.1f);
- gGL.vertex3fv(line_start.mV);
- gGL.color4fv(tick_color.mV);
- gGL.vertex3fv(line_mid.mV);
- gGL.vertex3fv(line_mid.mV);
- gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * 0.1f);
- gGL.vertex3fv(line_end.mV);
-
- line_mid = mScaleCenter + (mScaleSnappedValue * mScaleDir) + (mSnapGuideDir2 * mSnapRegimeOffset);
- line_start = line_mid - (mScaleDir * (llmin(mScaleSnappedValue, mSnapGuideLength * 0.5f)));
- line_end = line_mid + (mScaleDir * llmin(max_point_on_scale_line - mScaleSnappedValue, mSnapGuideLength * 0.5f));
- gGL.vertex3fv(line_start.mV);
- gGL.color4fv(tick_color.mV);
- gGL.vertex3fv(line_mid.mV);
- gGL.vertex3fv(line_mid.mV);
- gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * 0.1f);
- gGL.vertex3fv(line_end.mV);
- gGL.end();
- }
-
- {
- LLGLDepthTest gls_depth(GL_FALSE);
-
- F32 dist_grid_axis = llmax(0.f, (drag_point - mScaleCenter) * mScaleDir);
-
- F32 smallest_subdivision1 = mScaleSnapUnit1 / sGridMaxSubdivisionLevel;
- F32 smallest_subdivision2 = mScaleSnapUnit2 / sGridMaxSubdivisionLevel;
-
- F32 dist_scale_units_1 = dist_grid_axis / smallest_subdivision1;
- F32 dist_scale_units_2 = dist_grid_axis / smallest_subdivision2;
-
- // find distance to nearest smallest grid unit
- F32 grid_multiple1 = llfloor(dist_scale_units_1);
- F32 grid_multiple2 = llfloor(dist_scale_units_2);
- F32 grid_offset1 = fmodf(dist_grid_axis, smallest_subdivision1);
- F32 grid_offset2 = fmodf(dist_grid_axis, smallest_subdivision2);
-
- // how many smallest grid units are we away from largest grid scale?
- S32 sub_div_offset_1 = ll_round(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 / sGridMinSubdivisionLevel) / smallest_subdivision1);
- S32 sub_div_offset_2 = ll_round(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 / sGridMinSubdivisionLevel) / smallest_subdivision2);
-
- S32 num_ticks_per_side1 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision1));
- S32 num_ticks_per_side2 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision2));
- S32 ticks_from_scale_center_1 = lltrunc(dist_scale_units_1);
- S32 ticks_from_scale_center_2 = lltrunc(dist_scale_units_2);
- S32 max_ticks1 = llceil(max_point_on_scale_line / smallest_subdivision1 - dist_scale_units_1);
- S32 max_ticks2 = llceil(max_point_on_scale_line / smallest_subdivision2 - dist_scale_units_2);
- S32 start_tick = 0;
- S32 stop_tick = 0;
-
- if (mSnapRegime != SNAP_REGIME_NONE)
- {
- // draw snap guide line
- gGL.begin(LLRender::LINES);
- LLVector3 snap_line_center = bbox.localToAgent(unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ));
-
- LLVector3 snap_line_start = snap_line_center + (mSnapGuideDir1 * mSnapRegimeOffset);
- LLVector3 snap_line_end = snap_line_center + (mSnapGuideDir2 * mSnapRegimeOffset);
-
- gGL.color4f(1.f, 1.f, 1.f, grid_alpha);
- gGL.vertex3fv(snap_line_start.mV);
- gGL.vertex3fv(snap_line_center.mV);
- gGL.vertex3fv(snap_line_center.mV);
- gGL.vertex3fv(snap_line_end.mV);
- gGL.end();
-
- // draw snap guide arrow
- gGL.begin(LLRender::TRIANGLES);
- {
- //gGLSNoCullFaces.set();
- gGL.color4f(1.f, 1.f, 1.f, grid_alpha);
-
- LLVector3 arrow_dir;
- LLVector3 arrow_span = mScaleDir;
-
- arrow_dir = snap_line_start - snap_line_center;
- arrow_dir.normalize();
- gGL.vertex3fv((snap_line_start + arrow_dir * mSnapRegimeOffset * 0.1f).mV);
- gGL.vertex3fv((snap_line_start + arrow_span * mSnapRegimeOffset * 0.1f).mV);
- gGL.vertex3fv((snap_line_start - arrow_span * mSnapRegimeOffset * 0.1f).mV);
-
- arrow_dir = snap_line_end - snap_line_center;
- arrow_dir.normalize();
- gGL.vertex3fv((snap_line_end + arrow_dir * mSnapRegimeOffset * 0.1f).mV);
- gGL.vertex3fv((snap_line_end + arrow_span * mSnapRegimeOffset * 0.1f).mV);
- gGL.vertex3fv((snap_line_end - arrow_span * mSnapRegimeOffset * 0.1f).mV);
- }
- gGL.end();
- }
-
- LLVector2 screen_translate_axis(llabs(mScaleDir * LLViewerCamera::getInstance()->getLeftAxis()), llabs(mScaleDir * LLViewerCamera::getInstance()->getUpAxis()));
- screen_translate_axis.normalize();
-
- S32 tick_label_spacing = ll_round(screen_translate_axis * sTickLabelSpacing);
-
- for (pass = 0; pass < 3; pass++)
- {
- LLColor4 tick_color = setupSnapGuideRenderPass(pass);
-
- start_tick = -(llmin(ticks_from_scale_center_1, num_ticks_per_side1));
- stop_tick = llmin(max_ticks1, num_ticks_per_side1);
-
- gGL.begin(LLRender::LINES);
- // draw first row of ticks
- for (S32 i = start_tick; i <= stop_tick; i++)
- {
- F32 alpha = (1.f - (1.f * ((F32)llabs(i) / (F32)num_ticks_per_side1)));
- LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple1 + i) * smallest_subdivision1);
-
- //No need check this condition to prevent tick position scaling (FIX MAINT-5207/5208)
- //F32 cur_subdivisions = llclamp(getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, mTickPixelSpacing1), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
- /*if (fmodf((F32)(i + sub_div_offset_1), (sGridMaxSubdivisionLevel / cur_subdivisions)) != 0.f)
- {
- continue;
- }*/
-
- F32 tick_scale = 1.f;
- for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
- {
- if (fmodf((F32)(i + sub_div_offset_1), division_level) == 0.f)
- {
- break;
- }
- tick_scale *= 0.7f;
- }
-
- gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * alpha);
- LLVector3 tick_start = tick_pos + (mSnapGuideDir1 * mSnapRegimeOffset);
- LLVector3 tick_end = tick_start + (mSnapGuideDir1 * mSnapRegimeOffset * tick_scale);
- gGL.vertex3fv(tick_start.mV);
- gGL.vertex3fv(tick_end.mV);
- }
-
- // draw opposite row of ticks
- start_tick = -(llmin(ticks_from_scale_center_2, num_ticks_per_side2));
- stop_tick = llmin(max_ticks2, num_ticks_per_side2);
-
- for (S32 i = start_tick; i <= stop_tick; i++)
- {
- F32 alpha = (1.f - (1.f * ((F32)llabs(i) / (F32)num_ticks_per_side2)));
- LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple2 + i) * smallest_subdivision2);
-
- //No need check this condition to prevent tick position scaling (FIX MAINT-5207/5208)
- //F32 cur_subdivisions = llclamp(getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit2, mTickPixelSpacing2), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
- /*if (fmodf((F32)(i + sub_div_offset_2), (sGridMaxSubdivisionLevel / cur_subdivisions)) != 0.f)
- {
- continue;
- }*/
-
- F32 tick_scale = 1.f;
- for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
- {
- if (fmodf((F32)(i + sub_div_offset_2), division_level) == 0.f)
- {
- break;
- }
- tick_scale *= 0.7f;
- }
-
- gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * alpha);
- LLVector3 tick_start = tick_pos + (mSnapGuideDir2 * mSnapRegimeOffset);
- LLVector3 tick_end = tick_start + (mSnapGuideDir2 * mSnapRegimeOffset * tick_scale);
- gGL.vertex3fv(tick_start.mV);
- gGL.vertex3fv(tick_end.mV);
- }
- gGL.end();
- }
-
- // render upper tick labels
- start_tick = -(llmin(ticks_from_scale_center_1, num_ticks_per_side1));
- stop_tick = llmin(max_ticks1, num_ticks_per_side1);
-
- F32 grid_resolution = mObjectSelection->getSelectType() == SELECT_TYPE_HUD ? 0.25f : llmax(gSavedSettings.getF32("GridResolution"), 0.001f);
- S32 label_sub_div_offset_1 = ll_round(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 * 32.f) / smallest_subdivision1);
- S32 label_sub_div_offset_2 = ll_round(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 * 32.f) / smallest_subdivision2);
-
- for (S32 i = start_tick; i <= stop_tick; i++)
- {
- F32 tick_scale = 1.f;
- F32 alpha = grid_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side1)));
- LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple1 + i) * smallest_subdivision1);
-
- for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
- {
- if (fmodf((F32)(i + label_sub_div_offset_1), division_level) == 0.f)
- {
- break;
- }
- tick_scale *= 0.7f;
- }
-
- if (fmodf((F32)(i + label_sub_div_offset_1), (sGridMaxSubdivisionLevel / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, tick_label_spacing)))) == 0.f)
- {
- LLVector3 text_origin = tick_pos + (mSnapGuideDir1 * mSnapRegimeOffset * (1.f + tick_scale));
-
- EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode();
- F32 tick_value;
- if (grid_mode == GRID_MODE_WORLD)
- {
- tick_value = (grid_multiple1 + i) / (sGridMaxSubdivisionLevel / grid_resolution);
- }
- else
- {
- tick_value = (grid_multiple1 + i) / (2.f * sGridMaxSubdivisionLevel);
- }
-
- F32 text_highlight = 0.8f;
-
- // Highlight this text if the tick value matches the snapped to value, and if either the second set of ticks isn't going to be shown or cursor is in the first snap regime.
- if (is_approx_equal(tick_value, mScaleSnappedValue) && (mScaleSnapUnit2 == mScaleSnapUnit1 || (mSnapRegime & SNAP_REGIME_UPPER)))
- {
- text_highlight = 1.f;
- }
-
- renderTickValue(text_origin, tick_value, grid_mode == GRID_MODE_WORLD ? std::string("m") : std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha));
- }
- }
-
- // label ticks on opposite side, only can happen in scaling modes that effect more than one axis and when the object's axis don't have the same scale. A differing scale indicates both conditions.
- if (mScaleSnapUnit2 != mScaleSnapUnit1)
- {
- start_tick = -(llmin(ticks_from_scale_center_2, num_ticks_per_side2));
- stop_tick = llmin(max_ticks2, num_ticks_per_side2);
- for (S32 i = start_tick; i <= stop_tick; i++)
- {
- F32 tick_scale = 1.f;
- F32 alpha = grid_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side2)));
- LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple2 + i) * smallest_subdivision2);
-
- for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
- {
- if (fmodf((F32)(i + label_sub_div_offset_2), division_level) == 0.f)
- {
- break;
- }
- tick_scale *= 0.7f;
- }
-
- if (fmodf((F32)(i + label_sub_div_offset_2), (sGridMaxSubdivisionLevel / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit2, tick_label_spacing)))) == 0.f)
- {
- LLVector3 text_origin = tick_pos + (mSnapGuideDir2 * mSnapRegimeOffset * (1.f + tick_scale));
-
- EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode();
- F32 tick_value;
- if (grid_mode == GRID_MODE_WORLD)
- {
- tick_value = (grid_multiple2 + i) / (sGridMaxSubdivisionLevel / grid_resolution);
- }
- else
- {
- tick_value = (grid_multiple2 + i) / (2.f * sGridMaxSubdivisionLevel);
- }
-
- F32 text_highlight = 0.8f;
-
- if (is_approx_equal(tick_value, mScaleSnappedValue) && (mSnapRegime & SNAP_REGIME_LOWER))
- {
- text_highlight = 1.f;
- }
-
- renderTickValue(text_origin, tick_value, grid_mode == GRID_MODE_WORLD ? std::string("m") : std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha));
- }
- }
- }
-
-
- // render help text
- if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
- {
- if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
- {
- LLVector3 selection_center_start = LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
-
- LLVector3 offset_dir;
- if (mSnapGuideDir1 * LLViewerCamera::getInstance()->getAtAxis() > mSnapGuideDir2 * LLViewerCamera::getInstance()->getAtAxis())
- {
- offset_dir = mSnapGuideDir2;
- }
- else
- {
- offset_dir = mSnapGuideDir1;
- }
-
- LLVector3 help_text_pos = selection_center_start + (mSnapRegimeOffset * 5.f * offset_dir);
- const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
-
- std::string help_text = LLTrans::getString("manip_hint1");
- LLColor4 help_text_color = LLColor4::white;
- help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f);
- hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
- help_text = LLTrans::getString("manip_hint2");
- help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f;
- hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
- }
- }
- }
+ if (!gSavedSettings.getBOOL("SnapEnabled"))
+ {
+ return;
+ }
+
+ F32 grid_alpha = gSavedSettings.getF32("GridOpacity");
+
+ F32 max_point_on_scale_line = partToMaxScale(mManipPart, bbox);
+ LLVector3 drag_point = gAgent.getPosAgentFromGlobal(mDragPointGlobal);
+
+ updateGridSettings();
+
+ S32 pass;
+ for (pass = 0; pass < 3; pass++)
+ {
+ LLColor4 tick_color = setupSnapGuideRenderPass(pass);
+
+ gGL.begin(LLRender::LINES);
+ LLVector3 line_mid = mScaleCenter + (mScaleSnappedValue * mScaleDir) + (mSnapGuideDir1 * mSnapRegimeOffset);
+ LLVector3 line_start = line_mid - (mScaleDir * (llmin(mScaleSnappedValue, mSnapGuideLength * 0.5f)));
+ LLVector3 line_end = line_mid + (mScaleDir * llmin(max_point_on_scale_line - mScaleSnappedValue, mSnapGuideLength * 0.5f));
+
+ gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * 0.1f);
+ gGL.vertex3fv(line_start.mV);
+ gGL.color4fv(tick_color.mV);
+ gGL.vertex3fv(line_mid.mV);
+ gGL.vertex3fv(line_mid.mV);
+ gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * 0.1f);
+ gGL.vertex3fv(line_end.mV);
+
+ line_mid = mScaleCenter + (mScaleSnappedValue * mScaleDir) + (mSnapGuideDir2 * mSnapRegimeOffset);
+ line_start = line_mid - (mScaleDir * (llmin(mScaleSnappedValue, mSnapGuideLength * 0.5f)));
+ line_end = line_mid + (mScaleDir * llmin(max_point_on_scale_line - mScaleSnappedValue, mSnapGuideLength * 0.5f));
+ gGL.vertex3fv(line_start.mV);
+ gGL.color4fv(tick_color.mV);
+ gGL.vertex3fv(line_mid.mV);
+ gGL.vertex3fv(line_mid.mV);
+ gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * 0.1f);
+ gGL.vertex3fv(line_end.mV);
+ gGL.end();
+ }
+
+ {
+ LLGLDepthTest gls_depth(GL_FALSE);
+
+ F32 dist_grid_axis = llmax(0.f, (drag_point - mScaleCenter) * mScaleDir);
+
+ F32 smallest_subdivision1 = mScaleSnapUnit1 / sGridMaxSubdivisionLevel;
+ F32 smallest_subdivision2 = mScaleSnapUnit2 / sGridMaxSubdivisionLevel;
+
+ F32 dist_scale_units_1 = dist_grid_axis / smallest_subdivision1;
+ F32 dist_scale_units_2 = dist_grid_axis / smallest_subdivision2;
+
+ // find distance to nearest smallest grid unit
+ F32 grid_multiple1 = llfloor(dist_scale_units_1);
+ F32 grid_multiple2 = llfloor(dist_scale_units_2);
+ F32 grid_offset1 = fmodf(dist_grid_axis, smallest_subdivision1);
+ F32 grid_offset2 = fmodf(dist_grid_axis, smallest_subdivision2);
+
+ // how many smallest grid units are we away from largest grid scale?
+ S32 sub_div_offset_1 = ll_round(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 / sGridMinSubdivisionLevel) / smallest_subdivision1);
+ S32 sub_div_offset_2 = ll_round(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 / sGridMinSubdivisionLevel) / smallest_subdivision2);
+
+ S32 num_ticks_per_side1 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision1));
+ S32 num_ticks_per_side2 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision2));
+ S32 ticks_from_scale_center_1 = lltrunc(dist_scale_units_1);
+ S32 ticks_from_scale_center_2 = lltrunc(dist_scale_units_2);
+ S32 max_ticks1 = llceil(max_point_on_scale_line / smallest_subdivision1 - dist_scale_units_1);
+ S32 max_ticks2 = llceil(max_point_on_scale_line / smallest_subdivision2 - dist_scale_units_2);
+ S32 start_tick = 0;
+ S32 stop_tick = 0;
+
+ if (mSnapRegime != SNAP_REGIME_NONE)
+ {
+ // draw snap guide line
+ gGL.begin(LLRender::LINES);
+ LLVector3 snap_line_center = bbox.localToAgent(unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ));
+
+ LLVector3 snap_line_start = snap_line_center + (mSnapGuideDir1 * mSnapRegimeOffset);
+ LLVector3 snap_line_end = snap_line_center + (mSnapGuideDir2 * mSnapRegimeOffset);
+
+ gGL.color4f(1.f, 1.f, 1.f, grid_alpha);
+ gGL.vertex3fv(snap_line_start.mV);
+ gGL.vertex3fv(snap_line_center.mV);
+ gGL.vertex3fv(snap_line_center.mV);
+ gGL.vertex3fv(snap_line_end.mV);
+ gGL.end();
+
+ // draw snap guide arrow
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ //gGLSNoCullFaces.set();
+ gGL.color4f(1.f, 1.f, 1.f, grid_alpha);
+
+ LLVector3 arrow_dir;
+ LLVector3 arrow_span = mScaleDir;
+
+ arrow_dir = snap_line_start - snap_line_center;
+ arrow_dir.normalize();
+ gGL.vertex3fv((snap_line_start + arrow_dir * mSnapRegimeOffset * 0.1f).mV);
+ gGL.vertex3fv((snap_line_start + arrow_span * mSnapRegimeOffset * 0.1f).mV);
+ gGL.vertex3fv((snap_line_start - arrow_span * mSnapRegimeOffset * 0.1f).mV);
+
+ arrow_dir = snap_line_end - snap_line_center;
+ arrow_dir.normalize();
+ gGL.vertex3fv((snap_line_end + arrow_dir * mSnapRegimeOffset * 0.1f).mV);
+ gGL.vertex3fv((snap_line_end + arrow_span * mSnapRegimeOffset * 0.1f).mV);
+ gGL.vertex3fv((snap_line_end - arrow_span * mSnapRegimeOffset * 0.1f).mV);
+ }
+ gGL.end();
+ }
+
+ LLVector2 screen_translate_axis(llabs(mScaleDir * LLViewerCamera::getInstance()->getLeftAxis()), llabs(mScaleDir * LLViewerCamera::getInstance()->getUpAxis()));
+ screen_translate_axis.normalize();
+
+ S32 tick_label_spacing = ll_round(screen_translate_axis * sTickLabelSpacing);
+
+ for (pass = 0; pass < 3; pass++)
+ {
+ LLColor4 tick_color = setupSnapGuideRenderPass(pass);
+
+ start_tick = -(llmin(ticks_from_scale_center_1, num_ticks_per_side1));
+ stop_tick = llmin(max_ticks1, num_ticks_per_side1);
+
+ gGL.begin(LLRender::LINES);
+ // draw first row of ticks
+ for (S32 i = start_tick; i <= stop_tick; i++)
+ {
+ F32 alpha = (1.f - (1.f * ((F32)llabs(i) / (F32)num_ticks_per_side1)));
+ LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple1 + i) * smallest_subdivision1);
+
+ //No need check this condition to prevent tick position scaling (FIX MAINT-5207/5208)
+ //F32 cur_subdivisions = llclamp(getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, mTickPixelSpacing1), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
+ /*if (fmodf((F32)(i + sub_div_offset_1), (sGridMaxSubdivisionLevel / cur_subdivisions)) != 0.f)
+ {
+ continue;
+ }*/
+
+ F32 tick_scale = 1.f;
+ for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ {
+ if (fmodf((F32)(i + sub_div_offset_1), division_level) == 0.f)
+ {
+ break;
+ }
+ tick_scale *= 0.7f;
+ }
+
+ gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * alpha);
+ LLVector3 tick_start = tick_pos + (mSnapGuideDir1 * mSnapRegimeOffset);
+ LLVector3 tick_end = tick_start + (mSnapGuideDir1 * mSnapRegimeOffset * tick_scale);
+ gGL.vertex3fv(tick_start.mV);
+ gGL.vertex3fv(tick_end.mV);
+ }
+
+ // draw opposite row of ticks
+ start_tick = -(llmin(ticks_from_scale_center_2, num_ticks_per_side2));
+ stop_tick = llmin(max_ticks2, num_ticks_per_side2);
+
+ for (S32 i = start_tick; i <= stop_tick; i++)
+ {
+ F32 alpha = (1.f - (1.f * ((F32)llabs(i) / (F32)num_ticks_per_side2)));
+ LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple2 + i) * smallest_subdivision2);
+
+ //No need check this condition to prevent tick position scaling (FIX MAINT-5207/5208)
+ //F32 cur_subdivisions = llclamp(getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit2, mTickPixelSpacing2), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
+ /*if (fmodf((F32)(i + sub_div_offset_2), (sGridMaxSubdivisionLevel / cur_subdivisions)) != 0.f)
+ {
+ continue;
+ }*/
+
+ F32 tick_scale = 1.f;
+ for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ {
+ if (fmodf((F32)(i + sub_div_offset_2), division_level) == 0.f)
+ {
+ break;
+ }
+ tick_scale *= 0.7f;
+ }
+
+ gGL.color4f(tick_color.mV[VRED], tick_color.mV[VGREEN], tick_color.mV[VBLUE], tick_color.mV[VALPHA] * alpha);
+ LLVector3 tick_start = tick_pos + (mSnapGuideDir2 * mSnapRegimeOffset);
+ LLVector3 tick_end = tick_start + (mSnapGuideDir2 * mSnapRegimeOffset * tick_scale);
+ gGL.vertex3fv(tick_start.mV);
+ gGL.vertex3fv(tick_end.mV);
+ }
+ gGL.end();
+ }
+
+ // render upper tick labels
+ start_tick = -(llmin(ticks_from_scale_center_1, num_ticks_per_side1));
+ stop_tick = llmin(max_ticks1, num_ticks_per_side1);
+
+ F32 grid_resolution = mObjectSelection->getSelectType() == SELECT_TYPE_HUD ? 0.25f : llmax(gSavedSettings.getF32("GridResolution"), 0.001f);
+ S32 label_sub_div_offset_1 = ll_round(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 * 32.f) / smallest_subdivision1);
+ S32 label_sub_div_offset_2 = ll_round(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 * 32.f) / smallest_subdivision2);
+
+ for (S32 i = start_tick; i <= stop_tick; i++)
+ {
+ F32 tick_scale = 1.f;
+ F32 alpha = grid_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side1)));
+ LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple1 + i) * smallest_subdivision1);
+
+ for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ {
+ if (fmodf((F32)(i + label_sub_div_offset_1), division_level) == 0.f)
+ {
+ break;
+ }
+ tick_scale *= 0.7f;
+ }
+
+ if (fmodf((F32)(i + label_sub_div_offset_1), (sGridMaxSubdivisionLevel / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, tick_label_spacing)))) == 0.f)
+ {
+ LLVector3 text_origin = tick_pos + (mSnapGuideDir1 * mSnapRegimeOffset * (1.f + tick_scale));
+
+ EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode();
+ F32 tick_value;
+ if (grid_mode == GRID_MODE_WORLD)
+ {
+ tick_value = (grid_multiple1 + i) / (sGridMaxSubdivisionLevel / grid_resolution);
+ }
+ else
+ {
+ tick_value = (grid_multiple1 + i) / (2.f * sGridMaxSubdivisionLevel);
+ }
+
+ F32 text_highlight = 0.8f;
+
+ // Highlight this text if the tick value matches the snapped to value, and if either the second set of ticks isn't going to be shown or cursor is in the first snap regime.
+ if (is_approx_equal(tick_value, mScaleSnappedValue) && (mScaleSnapUnit2 == mScaleSnapUnit1 || (mSnapRegime & SNAP_REGIME_UPPER)))
+ {
+ text_highlight = 1.f;
+ }
+
+ renderTickValue(text_origin, tick_value, grid_mode == GRID_MODE_WORLD ? std::string("m") : std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha));
+ }
+ }
+
+ // label ticks on opposite side, only can happen in scaling modes that effect more than one axis and when the object's axis don't have the same scale. A differing scale indicates both conditions.
+ if (mScaleSnapUnit2 != mScaleSnapUnit1)
+ {
+ start_tick = -(llmin(ticks_from_scale_center_2, num_ticks_per_side2));
+ stop_tick = llmin(max_ticks2, num_ticks_per_side2);
+ for (S32 i = start_tick; i <= stop_tick; i++)
+ {
+ F32 tick_scale = 1.f;
+ F32 alpha = grid_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side2)));
+ LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple2 + i) * smallest_subdivision2);
+
+ for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ {
+ if (fmodf((F32)(i + label_sub_div_offset_2), division_level) == 0.f)
+ {
+ break;
+ }
+ tick_scale *= 0.7f;
+ }
+
+ if (fmodf((F32)(i + label_sub_div_offset_2), (sGridMaxSubdivisionLevel / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit2, tick_label_spacing)))) == 0.f)
+ {
+ LLVector3 text_origin = tick_pos + (mSnapGuideDir2 * mSnapRegimeOffset * (1.f + tick_scale));
+
+ EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode();
+ F32 tick_value;
+ if (grid_mode == GRID_MODE_WORLD)
+ {
+ tick_value = (grid_multiple2 + i) / (sGridMaxSubdivisionLevel / grid_resolution);
+ }
+ else
+ {
+ tick_value = (grid_multiple2 + i) / (2.f * sGridMaxSubdivisionLevel);
+ }
+
+ F32 text_highlight = 0.8f;
+
+ if (is_approx_equal(tick_value, mScaleSnappedValue) && (mSnapRegime & SNAP_REGIME_LOWER))
+ {
+ text_highlight = 1.f;
+ }
+
+ renderTickValue(text_origin, tick_value, grid_mode == GRID_MODE_WORLD ? std::string("m") : std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha));
+ }
+ }
+ }
+
+
+ // render help text
+ if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
+ {
+ if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
+ {
+ LLVector3 selection_center_start = LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
+
+ LLVector3 offset_dir;
+ if (mSnapGuideDir1 * LLViewerCamera::getInstance()->getAtAxis() > mSnapGuideDir2 * LLViewerCamera::getInstance()->getAtAxis())
+ {
+ offset_dir = mSnapGuideDir2;
+ }
+ else
+ {
+ offset_dir = mSnapGuideDir1;
+ }
+
+ LLVector3 help_text_pos = selection_center_start + (mSnapRegimeOffset * 5.f * offset_dir);
+ const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
+
+ std::string help_text = LLTrans::getString("manip_hint1");
+ LLColor4 help_text_color = LLColor4::white;
+ help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f);
+ hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
+ help_text = LLTrans::getString("manip_hint2");
+ help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f;
+ hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
+ }
+ }
+ }
}
// Returns unit vector in direction of part of an origin-centered cube
LLVector3 LLManipScale::partToUnitVector( S32 part ) const
{
- if ( (LL_FACE_MIN <= part) && (part <= LL_FACE_MAX) )
- {
- return faceToUnitVector( part );
- }
- else if ( (LL_CORNER_MIN <= part) && (part <= LL_CORNER_MAX) )
- {
- return cornerToUnitVector( part );
- }
- else if ( (LL_EDGE_MIN <= part) && (part <= LL_EDGE_MAX ) )
- {
- return edgeToUnitVector( part );
- }
- return LLVector3();
+ if ( (LL_FACE_MIN <= part) && (part <= LL_FACE_MAX) )
+ {
+ return faceToUnitVector( part );
+ }
+ else if ( (LL_CORNER_MIN <= part) && (part <= LL_CORNER_MAX) )
+ {
+ return cornerToUnitVector( part );
+ }
+ else if ( (LL_EDGE_MIN <= part) && (part <= LL_EDGE_MAX ) )
+ {
+ return edgeToUnitVector( part );
+ }
+ return LLVector3();
}
// Returns unit vector in direction of face of an origin-centered cube
LLVector3 LLManipScale::faceToUnitVector( S32 part ) const
{
- llassert( (LL_FACE_MIN <= part) && (part <= LL_FACE_MAX) );
- LLVector3 vec;
- switch( part )
- {
- case LL_FACE_POSX:
- vec.set( 1.f, 0.f, 0.f );
- break;
- case LL_FACE_NEGX:
- vec.set( -1.f, 0.f, 0.f );
- break;
- case LL_FACE_POSY:
- vec.set( 0.f, 1.f, 0.f );
- break;
- case LL_FACE_NEGY:
- vec.set( 0.f, -1.f, 0.f );
- break;
- case LL_FACE_POSZ:
- vec.set( 0.f, 0.f, 1.f );
- break;
- case LL_FACE_NEGZ:
- vec.set( 0.f, 0.f, -1.f );
- break;
- default:
- vec.clear();
- }
-
- return vec;
+ llassert( (LL_FACE_MIN <= part) && (part <= LL_FACE_MAX) );
+ LLVector3 vec;
+ switch( part )
+ {
+ case LL_FACE_POSX:
+ vec.set( 1.f, 0.f, 0.f );
+ break;
+ case LL_FACE_NEGX:
+ vec.set( -1.f, 0.f, 0.f );
+ break;
+ case LL_FACE_POSY:
+ vec.set( 0.f, 1.f, 0.f );
+ break;
+ case LL_FACE_NEGY:
+ vec.set( 0.f, -1.f, 0.f );
+ break;
+ case LL_FACE_POSZ:
+ vec.set( 0.f, 0.f, 1.f );
+ break;
+ case LL_FACE_NEGZ:
+ vec.set( 0.f, 0.f, -1.f );
+ break;
+ default:
+ vec.clear();
+ }
+
+ return vec;
}
// Returns unit vector in direction of corner of an origin-centered cube
LLVector3 LLManipScale::cornerToUnitVector( S32 part ) const
{
- llassert( (LL_CORNER_MIN <= part) && (part <= LL_CORNER_MAX) );
- LLVector3 vec;
- switch(part)
- {
- case LL_CORNER_NNN:
- vec.set(-OO_SQRT3, -OO_SQRT3, -OO_SQRT3);
- break;
- case LL_CORNER_NNP:
- vec.set(-OO_SQRT3, -OO_SQRT3, OO_SQRT3);
- break;
- case LL_CORNER_NPN:
- vec.set(-OO_SQRT3, OO_SQRT3, -OO_SQRT3);
- break;
- case LL_CORNER_NPP:
- vec.set(-OO_SQRT3, OO_SQRT3, OO_SQRT3);
- break;
- case LL_CORNER_PNN:
- vec.set(OO_SQRT3, -OO_SQRT3, -OO_SQRT3);
- break;
- case LL_CORNER_PNP:
- vec.set(OO_SQRT3, -OO_SQRT3, OO_SQRT3);
- break;
- case LL_CORNER_PPN:
- vec.set(OO_SQRT3, OO_SQRT3, -OO_SQRT3);
- break;
- case LL_CORNER_PPP:
- vec.set(OO_SQRT3, OO_SQRT3, OO_SQRT3);
- break;
- default:
- vec.clear();
- }
-
- return vec;
+ llassert( (LL_CORNER_MIN <= part) && (part <= LL_CORNER_MAX) );
+ LLVector3 vec;
+ switch(part)
+ {
+ case LL_CORNER_NNN:
+ vec.set(-OO_SQRT3, -OO_SQRT3, -OO_SQRT3);
+ break;
+ case LL_CORNER_NNP:
+ vec.set(-OO_SQRT3, -OO_SQRT3, OO_SQRT3);
+ break;
+ case LL_CORNER_NPN:
+ vec.set(-OO_SQRT3, OO_SQRT3, -OO_SQRT3);
+ break;
+ case LL_CORNER_NPP:
+ vec.set(-OO_SQRT3, OO_SQRT3, OO_SQRT3);
+ break;
+ case LL_CORNER_PNN:
+ vec.set(OO_SQRT3, -OO_SQRT3, -OO_SQRT3);
+ break;
+ case LL_CORNER_PNP:
+ vec.set(OO_SQRT3, -OO_SQRT3, OO_SQRT3);
+ break;
+ case LL_CORNER_PPN:
+ vec.set(OO_SQRT3, OO_SQRT3, -OO_SQRT3);
+ break;
+ case LL_CORNER_PPP:
+ vec.set(OO_SQRT3, OO_SQRT3, OO_SQRT3);
+ break;
+ default:
+ vec.clear();
+ }
+
+ return vec;
}
// Returns unit vector in direction of edge of an origin-centered cube
LLVector3 LLManipScale::edgeToUnitVector( S32 part ) const
{
- llassert( (LL_EDGE_MIN <= part) && (part <= LL_EDGE_MAX) );
- part -= LL_EDGE_MIN;
- S32 rotation = part >> 2; // Edge between which faces: 0 => XY, 1 => YZ, 2 => ZX
- LLVector3 v;
- v.mV[rotation] = (part & 1) ? F_SQRT2 : -F_SQRT2;
- v.mV[(rotation+1) % 3] = (part & 2) ? F_SQRT2 : -F_SQRT2;
- // v.mV[(rotation+2) % 3] defaults to 0.
- return v;
+ llassert( (LL_EDGE_MIN <= part) && (part <= LL_EDGE_MAX) );
+ part -= LL_EDGE_MIN;
+ S32 rotation = part >> 2; // Edge between which faces: 0 => XY, 1 => YZ, 2 => ZX
+ LLVector3 v;
+ v.mV[rotation] = (part & 1) ? F_SQRT2 : -F_SQRT2;
+ v.mV[(rotation+1) % 3] = (part & 2) ? F_SQRT2 : -F_SQRT2;
+ // v.mV[(rotation+2) % 3] defaults to 0.
+ return v;
}
// Non-linear scale of origin-centered unit cube to non-origin-centered, non-symetrical bounding box
LLVector3 LLManipScale::unitVectorToLocalBBoxExtent( const LLVector3& v, const LLBBox& bbox ) const
{
- const LLVector3& min = bbox.getMinLocal();
- const LLVector3& max = bbox.getMaxLocal();
- LLVector3 ctr = bbox.getCenterLocal();
-
- return LLVector3(
- v.mV[0] ? (v.mV[0]>0 ? max.mV[0] : min.mV[0] ) : ctr.mV[0],
- v.mV[1] ? (v.mV[1]>0 ? max.mV[1] : min.mV[1] ) : ctr.mV[1],
- v.mV[2] ? (v.mV[2]>0 ? max.mV[2] : min.mV[2] ) : ctr.mV[2] );
+ const LLVector3& min = bbox.getMinLocal();
+ const LLVector3& max = bbox.getMaxLocal();
+ LLVector3 ctr = bbox.getCenterLocal();
+
+ return LLVector3(
+ v.mV[0] ? (v.mV[0]>0 ? max.mV[0] : min.mV[0] ) : ctr.mV[0],
+ v.mV[1] ? (v.mV[1]>0 ? max.mV[1] : min.mV[1] ) : ctr.mV[1],
+ v.mV[2] ? (v.mV[2]>0 ? max.mV[2] : min.mV[2] ) : ctr.mV[2] );
}
// returns max allowable scale along a given stretch axis
-F32 LLManipScale::partToMaxScale( S32 part, const LLBBox &bbox ) const
+F32 LLManipScale::partToMaxScale( S32 part, const LLBBox &bbox ) const
{
- F32 max_scale_factor = 0.f;
- LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox );
- bbox_extents.abs();
- F32 max_extent = 0.f;
- for (U32 i = VX; i <= VZ; i++)
- {
- if (bbox_extents.mV[i] > max_extent)
- {
- max_extent = bbox_extents.mV[i];
- }
- }
- max_scale_factor = bbox_extents.length() * get_default_max_prim_scale() / max_extent;
-
- if (getUniform())
- {
- max_scale_factor *= 0.5f;
- }
-
- return max_scale_factor;
+ F32 max_scale_factor = 0.f;
+ LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox );
+ bbox_extents.abs();
+ F32 max_extent = 0.f;
+ for (U32 i = VX; i <= VZ; i++)
+ {
+ if (bbox_extents.mV[i] > max_extent)
+ {
+ max_extent = bbox_extents.mV[i];
+ }
+ }
+ max_scale_factor = bbox_extents.length() * get_default_max_prim_scale() / max_extent;
+
+ if (getUniform())
+ {
+ max_scale_factor *= 0.5f;
+ }
+
+ return max_scale_factor;
}
// returns min allowable scale along a given stretch axis
-F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const
+F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const
{
- LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox );
- bbox_extents.abs();
- F32 min_extent = get_default_max_prim_scale();
- for (U32 i = VX; i <= VZ; i++)
- {
- if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent)
- {
- min_extent = bbox_extents.mV[i];
- }
- }
- F32 min_scale_factor = bbox_extents.length() * MIN_PRIM_SCALE / min_extent;
-
- if (getUniform())
- {
- min_scale_factor *= 0.5f;
- }
-
- return min_scale_factor;
+ LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox );
+ bbox_extents.abs();
+ F32 min_extent = get_default_max_prim_scale();
+ for (U32 i = VX; i <= VZ; i++)
+ {
+ if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent)
+ {
+ min_extent = bbox_extents.mV[i];
+ }
+ }
+ F32 min_scale_factor = bbox_extents.length() * MIN_PRIM_SCALE / min_extent;
+
+ if (getUniform())
+ {
+ min_scale_factor *= 0.5f;
+ }
+
+ return min_scale_factor;
}
// Returns the axis aligned unit vector closest to v.
LLVector3 LLManipScale::nearestAxis( const LLVector3& v ) const
{
- // Note: yes, this is a slow but easy implementation
- // assumes v is normalized
-
- F32 coords[][3] =
- {
- { 1.f, 0.f, 0.f },
- { 0.f, 1.f, 0.f },
- { 0.f, 0.f, 1.f },
- {-1.f, 0.f, 0.f },
- { 0.f,-1.f, 0.f },
- { 0.f, 0.f,-1.f }
- };
-
- F32 cosine[6];
- cosine[0] = v * LLVector3( coords[0] );
- cosine[1] = v * LLVector3( coords[1] );
- cosine[2] = v * LLVector3( coords[2] );
- cosine[3] = -cosine[0];
- cosine[4] = -cosine[1];
- cosine[5] = -cosine[2];
-
- F32 greatest_cos = cosine[0];
- S32 greatest_index = 0;
- for( S32 i=1; i<6; i++ )
- {
- if( greatest_cos < cosine[i] )
- {
- greatest_cos = cosine[i];
- greatest_index = i;
- }
- }
-
- return LLVector3( coords[greatest_index] );
+ // Note: yes, this is a slow but easy implementation
+ // assumes v is normalized
+
+ F32 coords[][3] =
+ {
+ { 1.f, 0.f, 0.f },
+ { 0.f, 1.f, 0.f },
+ { 0.f, 0.f, 1.f },
+ {-1.f, 0.f, 0.f },
+ { 0.f,-1.f, 0.f },
+ { 0.f, 0.f,-1.f }
+ };
+
+ F32 cosine[6];
+ cosine[0] = v * LLVector3( coords[0] );
+ cosine[1] = v * LLVector3( coords[1] );
+ cosine[2] = v * LLVector3( coords[2] );
+ cosine[3] = -cosine[0];
+ cosine[4] = -cosine[1];
+ cosine[5] = -cosine[2];
+
+ F32 greatest_cos = cosine[0];
+ S32 greatest_index = 0;
+ for( S32 i=1; i<6; i++ )
+ {
+ if( greatest_cos < cosine[i] )
+ {
+ greatest_cos = cosine[i];
+ greatest_index = i;
+ }
+ }
+
+ return LLVector3( coords[greatest_index] );
}
// virtual
BOOL LLManipScale::canAffectSelection()
{
- // An selection is scalable if you are allowed to both edit and move
- // everything in it, and it does not have any sitting agents
- BOOL can_scale = mObjectSelection->getObjectCount() != 0;
- if (can_scale)
- {
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* objectp)
- {
- LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit();
- return objectp->permModify() && objectp->permMove() && !objectp->isPermanentEnforced() &&
- (root_object == NULL || (!root_object->isPermanentEnforced() && !root_object->isSeat())) &&
- !objectp->isSeat();
- }
- } func;
- can_scale = mObjectSelection->applyToObjects(&func);
- }
- return can_scale;
+ // An selection is scalable if you are allowed to both edit and move
+ // everything in it, and it does not have any sitting agents
+ BOOL can_scale = mObjectSelection->getObjectCount() != 0;
+ if (can_scale)
+ {
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* objectp)
+ {
+ LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit();
+ return objectp->permModify() && objectp->permMove() && !objectp->isPermanentEnforced() &&
+ (root_object == NULL || (!root_object->isPermanentEnforced() && !root_object->isSeat())) &&
+ !objectp->isSeat();
+ }
+ } func;
+ can_scale = mObjectSelection->applyToObjects(&func);
+ }
+ return can_scale;
}
diff --git a/indra/newview/llmanipscale.h b/indra/newview/llmanipscale.h
index 11ade9b7d0..e8735e673e 100644
--- a/indra/newview/llmanipscale.h
+++ b/indra/newview/llmanipscale.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmanipscale.h
* @brief LLManipScale class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,135 +45,135 @@ F32 get_default_max_prim_scale(bool is_flora = false);
class LLToolComposite;
class LLColor4;
-typedef enum e_scale_manipulator_type
+typedef enum e_scale_manipulator_type
{
- SCALE_MANIP_CORNER,
- SCALE_MANIP_FACE
+ SCALE_MANIP_CORNER,
+ SCALE_MANIP_FACE
} EScaleManipulatorType;
-typedef enum e_snap_regimes
+typedef enum e_snap_regimes
{
- SNAP_REGIME_NONE = 0, //!< The cursor is not in either of the snap regimes.
- SNAP_REGIME_UPPER = 0x1, //!< The cursor is, non-exclusively, in the first of the snap regimes. Prefer to treat as bitmask.
- SNAP_REGIME_LOWER = 0x2 //!< The cursor is, non-exclusively, in the second of the snap regimes. Prefer to treat as bitmask.
+ SNAP_REGIME_NONE = 0, //!< The cursor is not in either of the snap regimes.
+ SNAP_REGIME_UPPER = 0x1, //!< The cursor is, non-exclusively, in the first of the snap regimes. Prefer to treat as bitmask.
+ SNAP_REGIME_LOWER = 0x2 //!< The cursor is, non-exclusively, in the second of the snap regimes. Prefer to treat as bitmask.
} ESnapRegimes;
class LLManipScale : public LLManip
{
public:
- class ManipulatorHandle
- {
- public:
- LLVector3 mPosition;
- EManipPart mManipID;
- EScaleManipulatorType mType;
-
- ManipulatorHandle(LLVector3 pos, EManipPart id, EScaleManipulatorType type):mPosition(pos), mManipID(id), mType(type){}
- };
- static const S32 NUM_MANIPULATORS = 14;
-
- LLManipScale( LLToolComposite* composite );
- ~LLManipScale();
-
- virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
- virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
- virtual BOOL handleHover( S32 x, S32 y, MASK mask );
- virtual void render();
- virtual void handleSelect();
-
- virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
- virtual void highlightManipulators(S32 x, S32 y); // decided which manipulator, if any, should be highlighted by mouse hover
- virtual BOOL canAffectSelection();
-
- static void setUniform( BOOL b );
- static BOOL getUniform();
- static void setStretchTextures( BOOL b );
- static BOOL getStretchTextures();
- static void setShowAxes( BOOL b );
- static BOOL getShowAxes();
+ class ManipulatorHandle
+ {
+ public:
+ LLVector3 mPosition;
+ EManipPart mManipID;
+ EScaleManipulatorType mType;
+
+ ManipulatorHandle(LLVector3 pos, EManipPart id, EScaleManipulatorType type):mPosition(pos), mManipID(id), mType(type){}
+ };
+ static const S32 NUM_MANIPULATORS = 14;
+
+ LLManipScale( LLToolComposite* composite );
+ ~LLManipScale();
+
+ virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
+ virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
+ virtual BOOL handleHover( S32 x, S32 y, MASK mask );
+ virtual void render();
+ virtual void handleSelect();
+
+ virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
+ virtual void highlightManipulators(S32 x, S32 y); // decided which manipulator, if any, should be highlighted by mouse hover
+ virtual BOOL canAffectSelection();
+
+ static void setUniform( BOOL b );
+ static BOOL getUniform();
+ static void setStretchTextures( BOOL b );
+ static BOOL getStretchTextures();
+ static void setShowAxes( BOOL b );
+ static BOOL getShowAxes();
private:
- void renderCorners( const LLBBox& local_bbox );
- void renderFaces( const LLBBox& local_bbox );
- void renderBoxHandle( F32 x, F32 y, F32 z );
- void renderAxisHandle( U32 part, const LLVector3& start, const LLVector3& end );
- void renderGuidelinesPart( const LLBBox& local_bbox );
- void renderSnapGuides( const LLBBox& local_bbox );
+ void renderCorners( const LLBBox& local_bbox );
+ void renderFaces( const LLBBox& local_bbox );
+ void renderBoxHandle( F32 x, F32 y, F32 z );
+ void renderAxisHandle( U32 part, const LLVector3& start, const LLVector3& end );
+ void renderGuidelinesPart( const LLBBox& local_bbox );
+ void renderSnapGuides( const LLBBox& local_bbox );
- void revert();
+ void revert();
- inline void conditionalHighlight( U32 part, const LLColor4* highlight = NULL, const LLColor4* normal = NULL );
+ inline void conditionalHighlight( U32 part, const LLColor4* highlight = NULL, const LLColor4* normal = NULL );
- void drag( S32 x, S32 y );
- void dragFace( S32 x, S32 y );
- void dragCorner( S32 x, S32 y );
+ void drag( S32 x, S32 y );
+ void dragFace( S32 x, S32 y );
+ void dragCorner( S32 x, S32 y );
- void sendUpdates( BOOL send_position_update, BOOL send_scale_update, BOOL corner = FALSE);
+ void sendUpdates( BOOL send_position_update, BOOL send_scale_update, BOOL corner = FALSE);
- LLVector3 faceToUnitVector( S32 part ) const;
- LLVector3 cornerToUnitVector( S32 part ) const;
- LLVector3 edgeToUnitVector( S32 part ) const;
- LLVector3 partToUnitVector( S32 part ) const;
- LLVector3 unitVectorToLocalBBoxExtent( const LLVector3& v, const LLBBox& bbox ) const;
- F32 partToMaxScale( S32 part, const LLBBox& bbox ) const;
- F32 partToMinScale( S32 part, const LLBBox& bbox ) const;
- LLVector3 nearestAxis( const LLVector3& v ) const;
+ LLVector3 faceToUnitVector( S32 part ) const;
+ LLVector3 cornerToUnitVector( S32 part ) const;
+ LLVector3 edgeToUnitVector( S32 part ) const;
+ LLVector3 partToUnitVector( S32 part ) const;
+ LLVector3 unitVectorToLocalBBoxExtent( const LLVector3& v, const LLBBox& bbox ) const;
+ F32 partToMaxScale( S32 part, const LLBBox& bbox ) const;
+ F32 partToMinScale( S32 part, const LLBBox& bbox ) const;
+ LLVector3 nearestAxis( const LLVector3& v ) const;
- void stretchFace( const LLVector3& drag_start_agent, const LLVector3& drag_delta_agent);
+ void stretchFace( const LLVector3& drag_start_agent, const LLVector3& drag_delta_agent);
- void adjustTextureRepeats(); // Adjusts texture coords based on mSavedScale and current scale, only works for boxes
+ void adjustTextureRepeats(); // Adjusts texture coords based on mSavedScale and current scale, only works for boxes
- void updateSnapGuides(const LLBBox& bbox);
+ void updateSnapGuides(const LLBBox& bbox);
private:
- struct compare_manipulators
- {
- bool operator() (const ManipulatorHandle* const a, const ManipulatorHandle* const b) const
- {
- if (a->mType != b->mType)
- return a->mType < b->mType;
- else if (a->mPosition.mV[VZ] != b->mPosition.mV[VZ])
- return a->mPosition.mV[VZ] < b->mPosition.mV[VZ];
- else
- return a->mManipID < b->mManipID;
- }
- };
-
-
- F32 mScaledBoxHandleSize; //!< Handle size after scaling for selection feedback.
- LLVector3d mDragStartPointGlobal;
- LLVector3d mDragStartCenterGlobal; //!< The center of the bounding box of all selected objects at time of drag start.
- LLVector3d mDragPointGlobal;
- LLVector3d mDragFarHitGlobal;
- S32 mLastMouseX;
- S32 mLastMouseY;
- BOOL mSendUpdateOnMouseUp;
- U32 mLastUpdateFlags;
- typedef std::set<ManipulatorHandle*, compare_manipulators> manipulator_list_t;
- manipulator_list_t mProjectedManipulators;
- LLVector4 mManipulatorVertices[14];
- F32 mScaleSnapUnit1; //!< Size of snap multiples for the upper scale.
- F32 mScaleSnapUnit2; //!< Size of snap multiples for the lower scale.
- LLVector3 mScalePlaneNormal1; //!< Normal of plane in which scale occurs that most faces camera.
- LLVector3 mScalePlaneNormal2; //!< Normal of plane in which scale occurs that most faces camera.
- LLVector3 mSnapGuideDir1; //!< The direction in which the upper snap guide tick marks face.
- LLVector3 mSnapGuideDir2; //!< The direction in which the lower snap guide tick marks face.
- LLVector3 mSnapDir1; //!< The direction in which the upper snap guides face.
- LLVector3 mSnapDir2; //!< The direction in which the lower snap guides face.
- F32 mSnapRegimeOffset; //!< How far off the scale axis centerline the mouse can be before it exits/enters the snap regime.
- F32 mTickPixelSpacing1; //!< The pixel spacing between snap guide tick marks for the upper scale.
- F32 mTickPixelSpacing2; //!< The pixel spacing between snap guide tick marks for the lower scale.
- F32 mSnapGuideLength;
- LLVector3 mScaleCenter; //!< The location of the origin of the scaling operation.
- LLVector3 mScaleDir; //!< The direction of the scaling action. In face-dragging this is aligned with one of the cardinal axis relative to the prim, but in corner-dragging this is along the diagonal.
- F32 mScaleSnappedValue; //!< The distance of the current position nearest the mouse location, measured along mScaleDir. Is measured either from the center or from the far face/corner depending upon whether uniform scaling is true or false respectively.
- ESnapRegimes mSnapRegime; //<! Which, if any, snap regime the cursor is currently residing in.
- F32 mManipulatorScales[NUM_MANIPULATORS];
- F32 mBoxHandleSize[NUM_MANIPULATORS]; // The size of the handles at the corners of the bounding box
- S32 mFirstClickX;
- S32 mFirstClickY;
- bool mIsFirstClick;
+ struct compare_manipulators
+ {
+ bool operator() (const ManipulatorHandle* const a, const ManipulatorHandle* const b) const
+ {
+ if (a->mType != b->mType)
+ return a->mType < b->mType;
+ else if (a->mPosition.mV[VZ] != b->mPosition.mV[VZ])
+ return a->mPosition.mV[VZ] < b->mPosition.mV[VZ];
+ else
+ return a->mManipID < b->mManipID;
+ }
+ };
+
+
+ F32 mScaledBoxHandleSize; //!< Handle size after scaling for selection feedback.
+ LLVector3d mDragStartPointGlobal;
+ LLVector3d mDragStartCenterGlobal; //!< The center of the bounding box of all selected objects at time of drag start.
+ LLVector3d mDragPointGlobal;
+ LLVector3d mDragFarHitGlobal;
+ S32 mLastMouseX;
+ S32 mLastMouseY;
+ BOOL mSendUpdateOnMouseUp;
+ U32 mLastUpdateFlags;
+ typedef std::set<ManipulatorHandle*, compare_manipulators> manipulator_list_t;
+ manipulator_list_t mProjectedManipulators;
+ LLVector4 mManipulatorVertices[14];
+ F32 mScaleSnapUnit1; //!< Size of snap multiples for the upper scale.
+ F32 mScaleSnapUnit2; //!< Size of snap multiples for the lower scale.
+ LLVector3 mScalePlaneNormal1; //!< Normal of plane in which scale occurs that most faces camera.
+ LLVector3 mScalePlaneNormal2; //!< Normal of plane in which scale occurs that most faces camera.
+ LLVector3 mSnapGuideDir1; //!< The direction in which the upper snap guide tick marks face.
+ LLVector3 mSnapGuideDir2; //!< The direction in which the lower snap guide tick marks face.
+ LLVector3 mSnapDir1; //!< The direction in which the upper snap guides face.
+ LLVector3 mSnapDir2; //!< The direction in which the lower snap guides face.
+ F32 mSnapRegimeOffset; //!< How far off the scale axis centerline the mouse can be before it exits/enters the snap regime.
+ F32 mTickPixelSpacing1; //!< The pixel spacing between snap guide tick marks for the upper scale.
+ F32 mTickPixelSpacing2; //!< The pixel spacing between snap guide tick marks for the lower scale.
+ F32 mSnapGuideLength;
+ LLVector3 mScaleCenter; //!< The location of the origin of the scaling operation.
+ LLVector3 mScaleDir; //!< The direction of the scaling action. In face-dragging this is aligned with one of the cardinal axis relative to the prim, but in corner-dragging this is along the diagonal.
+ F32 mScaleSnappedValue; //!< The distance of the current position nearest the mouse location, measured along mScaleDir. Is measured either from the center or from the far face/corner depending upon whether uniform scaling is true or false respectively.
+ ESnapRegimes mSnapRegime; //<! Which, if any, snap regime the cursor is currently residing in.
+ F32 mManipulatorScales[NUM_MANIPULATORS];
+ F32 mBoxHandleSize[NUM_MANIPULATORS]; // The size of the handles at the corners of the bounding box
+ S32 mFirstClickX;
+ S32 mFirstClickY;
+ bool mIsFirstClick;
};
#endif // LL_MANIPSCALE_H
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index cafb3fef67..8cd7f44f70 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmaniptranslate.cpp
* @brief LLManipTranslate class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -76,202 +76,202 @@ const F32 SNAP_ARROW_SCALE = 0.7f;
static LLPointer<LLViewerTexture> sGridTex = NULL ;
-const LLManip::EManipPart MANIPULATOR_IDS[9] =
+const LLManip::EManipPart MANIPULATOR_IDS[9] =
{
- LLManip::LL_X_ARROW,
- LLManip::LL_Y_ARROW,
- LLManip::LL_Z_ARROW,
- LLManip::LL_X_ARROW,
- LLManip::LL_Y_ARROW,
- LLManip::LL_Z_ARROW,
- LLManip::LL_YZ_PLANE,
- LLManip::LL_XZ_PLANE,
- LLManip::LL_XY_PLANE
+ LLManip::LL_X_ARROW,
+ LLManip::LL_Y_ARROW,
+ LLManip::LL_Z_ARROW,
+ LLManip::LL_X_ARROW,
+ LLManip::LL_Y_ARROW,
+ LLManip::LL_Z_ARROW,
+ LLManip::LL_YZ_PLANE,
+ LLManip::LL_XZ_PLANE,
+ LLManip::LL_XY_PLANE
};
-const U32 ARROW_TO_AXIS[4] =
+const U32 ARROW_TO_AXIS[4] =
{
- VX,
- VX,
- VY,
- VZ
+ VX,
+ VX,
+ VY,
+ VZ
};
// Sort manipulator handles by their screen-space projection
struct ClosestToCamera
{
- bool operator()(const LLManipTranslate::ManipulatorHandle& a,
- const LLManipTranslate::ManipulatorHandle& b) const
- {
- return a.mEndPosition.mV[VZ] < b.mEndPosition.mV[VZ];
- }
+ bool operator()(const LLManipTranslate::ManipulatorHandle& a,
+ const LLManipTranslate::ManipulatorHandle& b) const
+ {
+ return a.mEndPosition.mV[VZ] < b.mEndPosition.mV[VZ];
+ }
};
LLManipTranslate::LLManipTranslate( LLToolComposite* composite )
-: LLManip( std::string("Move"), composite ),
- mLastHoverMouseX(-1),
- mLastHoverMouseY(-1),
- mMouseOutsideSlop(FALSE),
- mCopyMadeThisDrag(FALSE),
- mMouseDownX(-1),
- mMouseDownY(-1),
- mAxisArrowLength(50),
- mConeSize(0),
- mArrowLengthMeters(0.f),
- mGridSizeMeters(1.f),
- mPlaneManipOffsetMeters(0.f),
- mUpdateTimer(),
- mSnapOffsetMeters(0.f),
- mSubdivisions(10.f),
- mInSnapRegime(FALSE),
- mArrowScales(1.f, 1.f, 1.f),
- mPlaneScales(1.f, 1.f, 1.f),
- mPlaneManipPositions(1.f, 1.f, 1.f, 1.f)
-{
- if (sGridTex.isNull())
- {
- restoreGL();
- }
+: LLManip( std::string("Move"), composite ),
+ mLastHoverMouseX(-1),
+ mLastHoverMouseY(-1),
+ mMouseOutsideSlop(FALSE),
+ mCopyMadeThisDrag(FALSE),
+ mMouseDownX(-1),
+ mMouseDownY(-1),
+ mAxisArrowLength(50),
+ mConeSize(0),
+ mArrowLengthMeters(0.f),
+ mGridSizeMeters(1.f),
+ mPlaneManipOffsetMeters(0.f),
+ mUpdateTimer(),
+ mSnapOffsetMeters(0.f),
+ mSubdivisions(10.f),
+ mInSnapRegime(FALSE),
+ mArrowScales(1.f, 1.f, 1.f),
+ mPlaneScales(1.f, 1.f, 1.f),
+ mPlaneManipPositions(1.f, 1.f, 1.f, 1.f)
+{
+ if (sGridTex.isNull())
+ {
+ restoreGL();
+ }
}
//static
U32 LLManipTranslate::getGridTexName()
{
- if(sGridTex.isNull())
- {
- restoreGL() ;
- }
+ if(sGridTex.isNull())
+ {
+ restoreGL() ;
+ }
- return sGridTex.isNull() ? 0 : sGridTex->getTexName() ;
+ return sGridTex.isNull() ? 0 : sGridTex->getTexName() ;
}
//static
void LLManipTranslate::destroyGL()
{
- if (sGridTex)
- {
- sGridTex = NULL ;
- }
+ if (sGridTex)
+ {
+ sGridTex = NULL ;
+ }
}
//static
void LLManipTranslate::restoreGL()
{
- //generate grid texture
- U32 rez = 512;
- U32 mip = 0;
-
- destroyGL() ;
- sGridTex = LLViewerTextureManager::getLocalTexture() ;
- if(!sGridTex->createGLTexture())
- {
- sGridTex = NULL ;
- return ;
- }
-
- GLuint* d = new GLuint[rez*rez];
-
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex->getTexName(), true);
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
-
- while (rez >= 1)
- {
- for (U32 i = 0; i < rez*rez; i++)
- {
- d[i] = 0x00FFFFFF;
- }
-
- U32 subcol = 0xFFFFFFFF;
- if (rez >= 4)
- { //large grain grid
- for (U32 i = 0; i < rez; i++)
- {
- if (rez <= 16)
- {
- if (rez == 16)
- {
- subcol = 0xA0FFFFFF;
- }
- else if (rez == 8)
- {
- subcol = 0x80FFFFFF;
- }
- else
- {
- subcol = 0x40FFFFFF;
- }
- }
- else
- {
- subcol = 0xFFFFFFFF;
- }
- d[i *rez+ 0 ] = subcol;
- d[0 *rez+ i ] = subcol;
- if (rez >= 32)
- {
- d[i *rez+ (rez-1)] = subcol;
- d[(rez-1) *rez+ i ] = subcol;
- }
-
- if (rez >= 64)
- {
- subcol = 0xFFFFFFFF;
-
- if (i > 0 && i < (rez-1))
- {
- d[i *rez+ 1 ] = subcol;
- d[i *rez+ (rez-2)] = subcol;
- d[1 *rez+ i ] = subcol;
- d[(rez-2) *rez+ i ] = subcol;
- }
- }
- }
- }
-
- subcol = 0x50A0A0A0;
- if (rez >= 128)
- { //small grain grid
- for (U32 i = 8; i < rez; i+=8)
- {
- for (U32 j = 2; j < rez-2; j++)
- {
- d[i *rez+ j] = subcol;
- d[j *rez+ i] = subcol;
- }
- }
- }
- if (rez >= 64)
- { //medium grain grid
- if (rez == 64)
- {
- subcol = 0x50A0A0A0;
- }
- else
- {
- subcol = 0xA0D0D0D0;
- }
-
- for (U32 i = 32; i < rez; i+=32)
- {
- U32 pi = i-1;
- for (U32 j = 2; j < rez-2; j++)
- {
- d[i *rez+ j] = subcol;
- d[j *rez+ i] = subcol;
-
- if (rez > 128)
- {
- d[pi *rez+ j] = subcol;
- d[j *rez+ pi] = subcol;
- }
- }
- }
- }
- LLImageGL::setManualImage(GL_TEXTURE_2D, mip, GL_RGBA, rez, rez, GL_RGBA, GL_UNSIGNED_BYTE, d);
- rez = rez >> 1;
- mip++;
- }
- delete [] d;
+ //generate grid texture
+ U32 rez = 512;
+ U32 mip = 0;
+
+ destroyGL() ;
+ sGridTex = LLViewerTextureManager::getLocalTexture() ;
+ if(!sGridTex->createGLTexture())
+ {
+ sGridTex = NULL ;
+ return ;
+ }
+
+ GLuint* d = new GLuint[rez*rez];
+
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex->getTexName(), true);
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
+
+ while (rez >= 1)
+ {
+ for (U32 i = 0; i < rez*rez; i++)
+ {
+ d[i] = 0x00FFFFFF;
+ }
+
+ U32 subcol = 0xFFFFFFFF;
+ if (rez >= 4)
+ { //large grain grid
+ for (U32 i = 0; i < rez; i++)
+ {
+ if (rez <= 16)
+ {
+ if (rez == 16)
+ {
+ subcol = 0xA0FFFFFF;
+ }
+ else if (rez == 8)
+ {
+ subcol = 0x80FFFFFF;
+ }
+ else
+ {
+ subcol = 0x40FFFFFF;
+ }
+ }
+ else
+ {
+ subcol = 0xFFFFFFFF;
+ }
+ d[i *rez+ 0 ] = subcol;
+ d[0 *rez+ i ] = subcol;
+ if (rez >= 32)
+ {
+ d[i *rez+ (rez-1)] = subcol;
+ d[(rez-1) *rez+ i ] = subcol;
+ }
+
+ if (rez >= 64)
+ {
+ subcol = 0xFFFFFFFF;
+
+ if (i > 0 && i < (rez-1))
+ {
+ d[i *rez+ 1 ] = subcol;
+ d[i *rez+ (rez-2)] = subcol;
+ d[1 *rez+ i ] = subcol;
+ d[(rez-2) *rez+ i ] = subcol;
+ }
+ }
+ }
+ }
+
+ subcol = 0x50A0A0A0;
+ if (rez >= 128)
+ { //small grain grid
+ for (U32 i = 8; i < rez; i+=8)
+ {
+ for (U32 j = 2; j < rez-2; j++)
+ {
+ d[i *rez+ j] = subcol;
+ d[j *rez+ i] = subcol;
+ }
+ }
+ }
+ if (rez >= 64)
+ { //medium grain grid
+ if (rez == 64)
+ {
+ subcol = 0x50A0A0A0;
+ }
+ else
+ {
+ subcol = 0xA0D0D0D0;
+ }
+
+ for (U32 i = 32; i < rez; i+=32)
+ {
+ U32 pi = i-1;
+ for (U32 j = 2; j < rez-2; j++)
+ {
+ d[i *rez+ j] = subcol;
+ d[j *rez+ i] = subcol;
+
+ if (rez > 128)
+ {
+ d[pi *rez+ j] = subcol;
+ d[j *rez+ pi] = subcol;
+ }
+ }
+ }
+ }
+ LLImageGL::setManualImage(GL_TEXTURE_2D, mip, GL_RGBA, rez, rez, GL_RGBA, GL_UNSIGNED_BYTE, d);
+ rez = rez >> 1;
+ mip++;
+ }
+ delete [] d;
}
@@ -282,2018 +282,2018 @@ LLManipTranslate::~LLManipTranslate()
void LLManipTranslate::handleSelect()
{
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
if (gFloaterTools)
{
gFloaterTools->setStatusText("move");
}
- LLManip::handleSelect();
+ LLManip::handleSelect();
}
BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
-
- // didn't click in any UI object, so must have clicked in the world
- if( (mHighlightedPart == LL_X_ARROW ||
- mHighlightedPart == LL_Y_ARROW ||
- mHighlightedPart == LL_Z_ARROW ||
- mHighlightedPart == LL_YZ_PLANE ||
- mHighlightedPart == LL_XZ_PLANE ||
- mHighlightedPart == LL_XY_PLANE ) )
- {
- handled = handleMouseDownOnPart( x, y, mask );
- }
-
- return handled;
+ BOOL handled = FALSE;
+
+ // didn't click in any UI object, so must have clicked in the world
+ if( (mHighlightedPart == LL_X_ARROW ||
+ mHighlightedPart == LL_Y_ARROW ||
+ mHighlightedPart == LL_Z_ARROW ||
+ mHighlightedPart == LL_YZ_PLANE ||
+ mHighlightedPart == LL_XZ_PLANE ||
+ mHighlightedPart == LL_XY_PLANE ) )
+ {
+ handled = handleMouseDownOnPart( x, y, mask );
+ }
+
+ return handled;
}
// Assumes that one of the arrows on an object was hit.
BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
{
- BOOL can_move = canAffectSelection();
- if (!can_move)
- {
- return FALSE;
- }
-
- highlightManipulators(x, y);
- S32 hit_part = mHighlightedPart;
-
- if( (hit_part != LL_X_ARROW) &&
- (hit_part != LL_Y_ARROW) &&
- (hit_part != LL_Z_ARROW) &&
- (hit_part != LL_YZ_PLANE) &&
- (hit_part != LL_XZ_PLANE) &&
- (hit_part != LL_XY_PLANE) )
- {
- return TRUE;
- }
-
- mHelpTextTimer.reset();
- sNumTimesHelpTextShown++;
-
- LLSelectMgr::getInstance()->getGrid(mGridOrigin, mGridRotation, mGridScale);
-
- LLSelectMgr::getInstance()->enableSilhouette(FALSE);
-
- // we just started a drag, so save initial object positions
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_MOVE);
-
- mManipPart = (EManipPart)hit_part;
- mMouseDownX = x;
- mMouseDownY = y;
- mMouseOutsideSlop = FALSE;
-
- LLVector3 axis;
-
- LLSelectNode *selectNode = mObjectSelection->getFirstMoveableNode(TRUE);
-
- if (!selectNode)
- {
- // didn't find the object in our selection...oh well
- LL_WARNS() << "Trying to translate an unselected object" << LL_ENDL;
- return TRUE;
- }
-
- LLViewerObject *selected_object = selectNode->getObject();
- if (!selected_object)
- {
- // somehow we lost the object!
- LL_WARNS() << "Translate manip lost the object, no selected object" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
- return TRUE;
- }
-
- // Compute unit vectors for arrow hit and a plane through that vector
- BOOL axis_exists = getManipAxis(selected_object, mManipPart, axis);
- getManipNormal(selected_object, mManipPart, mManipNormal);
-
- //LLVector3 select_center_agent = gAgent.getPosAgentFromGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal());
- // TomY: The above should (?) be identical to the below
- LLVector3 select_center_agent = getPivotPoint();
- mSubdivisions = getSubdivisionLevel(select_center_agent, axis_exists ? axis : LLVector3::z_axis, getMinGridScale());
-
- // if we clicked on a planar manipulator, recenter mouse cursor
- if (mManipPart >= LL_YZ_PLANE && mManipPart <= LL_XY_PLANE)
- {
- LLCoordGL mouse_pos;
- if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(select_center_agent, mouse_pos))
- {
- // mouse_pos may be nonsense
- LL_WARNS() << "Failed to project object center to screen" << LL_ENDL;
- }
- else if (gSavedSettings.getBOOL("SnapToMouseCursor"))
- {
- LLUI::getInstance()->setMousePositionScreen(mouse_pos.mX, mouse_pos.mY);
- x = mouse_pos.mX;
- y = mouse_pos.mY;
- }
- }
-
- LLSelectMgr::getInstance()->updateSelectionCenter();
- LLVector3d object_start_global = gAgent.getPosGlobalFromAgent(getPivotPoint());
- getMousePointOnPlaneGlobal(mDragCursorStartGlobal, x, y, object_start_global, mManipNormal);
- mDragSelectionStartGlobal = object_start_global;
- mCopyMadeThisDrag = FALSE;
-
- // Route future Mouse messages here preemptively. (Release on mouse up.)
- setMouseCapture( TRUE );
-
- return TRUE;
+ BOOL can_move = canAffectSelection();
+ if (!can_move)
+ {
+ return FALSE;
+ }
+
+ highlightManipulators(x, y);
+ S32 hit_part = mHighlightedPart;
+
+ if( (hit_part != LL_X_ARROW) &&
+ (hit_part != LL_Y_ARROW) &&
+ (hit_part != LL_Z_ARROW) &&
+ (hit_part != LL_YZ_PLANE) &&
+ (hit_part != LL_XZ_PLANE) &&
+ (hit_part != LL_XY_PLANE) )
+ {
+ return TRUE;
+ }
+
+ mHelpTextTimer.reset();
+ sNumTimesHelpTextShown++;
+
+ LLSelectMgr::getInstance()->getGrid(mGridOrigin, mGridRotation, mGridScale);
+
+ LLSelectMgr::getInstance()->enableSilhouette(FALSE);
+
+ // we just started a drag, so save initial object positions
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_MOVE);
+
+ mManipPart = (EManipPart)hit_part;
+ mMouseDownX = x;
+ mMouseDownY = y;
+ mMouseOutsideSlop = FALSE;
+
+ LLVector3 axis;
+
+ LLSelectNode *selectNode = mObjectSelection->getFirstMoveableNode(TRUE);
+
+ if (!selectNode)
+ {
+ // didn't find the object in our selection...oh well
+ LL_WARNS() << "Trying to translate an unselected object" << LL_ENDL;
+ return TRUE;
+ }
+
+ LLViewerObject *selected_object = selectNode->getObject();
+ if (!selected_object)
+ {
+ // somehow we lost the object!
+ LL_WARNS() << "Translate manip lost the object, no selected object" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
+ return TRUE;
+ }
+
+ // Compute unit vectors for arrow hit and a plane through that vector
+ BOOL axis_exists = getManipAxis(selected_object, mManipPart, axis);
+ getManipNormal(selected_object, mManipPart, mManipNormal);
+
+ //LLVector3 select_center_agent = gAgent.getPosAgentFromGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal());
+ // TomY: The above should (?) be identical to the below
+ LLVector3 select_center_agent = getPivotPoint();
+ mSubdivisions = getSubdivisionLevel(select_center_agent, axis_exists ? axis : LLVector3::z_axis, getMinGridScale());
+
+ // if we clicked on a planar manipulator, recenter mouse cursor
+ if (mManipPart >= LL_YZ_PLANE && mManipPart <= LL_XY_PLANE)
+ {
+ LLCoordGL mouse_pos;
+ if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(select_center_agent, mouse_pos))
+ {
+ // mouse_pos may be nonsense
+ LL_WARNS() << "Failed to project object center to screen" << LL_ENDL;
+ }
+ else if (gSavedSettings.getBOOL("SnapToMouseCursor"))
+ {
+ LLUI::getInstance()->setMousePositionScreen(mouse_pos.mX, mouse_pos.mY);
+ x = mouse_pos.mX;
+ y = mouse_pos.mY;
+ }
+ }
+
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ LLVector3d object_start_global = gAgent.getPosGlobalFromAgent(getPivotPoint());
+ getMousePointOnPlaneGlobal(mDragCursorStartGlobal, x, y, object_start_global, mManipNormal);
+ mDragSelectionStartGlobal = object_start_global;
+ mCopyMadeThisDrag = FALSE;
+
+ // Route future Mouse messages here preemptively. (Release on mouse up.)
+ setMouseCapture( TRUE );
+
+ return TRUE;
}
BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
{
- // Translation tool only works if mouse button is down.
- // Bail out if mouse not down.
- if( !hasMouseCapture() )
- {
- LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (inactive)" << LL_ENDL;
- // Always show cursor
- // gViewerWindow->setCursor(UI_CURSOR_ARROW);
- gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
-
- highlightManipulators(x, y);
- return TRUE;
- }
-
- // Handle auto-rotation if necessary.
- LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
- const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD;
- const S32 ROTATE_H_MARGIN = world_rect.getWidth() / 20;
- const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
- BOOL rotated = FALSE;
-
- // ...build mode moves camera about focus point
- if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
- {
- if (x < ROTATE_H_MARGIN)
- {
- gAgentCamera.cameraOrbitAround(rotate_angle);
- rotated = TRUE;
- }
- else if (x > world_rect.getWidth() - ROTATE_H_MARGIN)
- {
- gAgentCamera.cameraOrbitAround(-rotate_angle);
- rotated = TRUE;
- }
- }
-
- // Suppress processing if mouse hasn't actually moved.
- // This may cause problems if the camera moves outside of the
- // rotation above.
- if( x == mLastHoverMouseX && y == mLastHoverMouseY && !rotated)
- {
- LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse unmoved)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
- return TRUE;
- }
- mLastHoverMouseX = x;
- mLastHoverMouseY = y;
-
- // Suppress if mouse hasn't moved past the initial slop region
- // Reset once we start moving
- if( !mMouseOutsideSlop )
- {
- if (abs(mMouseDownX - x) < MOUSE_DRAG_SLOP && abs(mMouseDownY - y) < MOUSE_DRAG_SLOP )
- {
- LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse inside slop)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
- return TRUE;
- }
- else
- {
- // ...just went outside the slop region
- mMouseOutsideSlop = TRUE;
- // If holding down shift, leave behind a copy.
- if (mask == MASK_COPY)
- {
- // ...we're trying to make a copy
- LLSelectMgr::getInstance()->selectDuplicate(LLVector3::zero, FALSE);
- mCopyMadeThisDrag = TRUE;
-
- // When we make the copy, we don't want to do any other processing.
- // If so, the object will also be moved, and the copy will be offset.
- LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (made copy)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
- }
- }
- }
-
- // Throttle updates to 10 per second.
-
- LLVector3 axis_f;
- LLVector3d axis_d;
-
- // pick the first object to constrain to grid w/ common origin
- // this is so we don't screw up groups
- LLSelectNode* selectNode = mObjectSelection->getFirstMoveableNode(TRUE);
- if (!selectNode)
- {
- // somehow we lost the object!
- LL_WARNS() << "Translate manip lost the object, no selectNode" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
- return TRUE;
- }
-
- LLViewerObject* object = selectNode->getObject();
- if (!object)
- {
- // somehow we lost the object!
- LL_WARNS() << "Translate manip lost the object, no object in selectNode" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
- return TRUE;
- }
-
- // Compute unit vectors for arrow hit and a plane through that vector
- BOOL axis_exists = getManipAxis(object, mManipPart, axis_f); // TODO: move this
-
- axis_d.setVec(axis_f);
-
- LLSelectMgr::getInstance()->updateSelectionCenter();
- LLVector3d current_pos_global = gAgent.getPosGlobalFromAgent(getPivotPoint());
-
- mSubdivisions = getSubdivisionLevel(getPivotPoint(), axis_f, getMinGridScale());
-
- // Project the cursor onto that plane
- LLVector3d relative_move;
- getMousePointOnPlaneGlobal(relative_move, x, y, current_pos_global, mManipNormal);\
- relative_move -= mDragCursorStartGlobal;
-
- // You can't move more than some distance from your original mousedown point.
- if (gSavedSettings.getBOOL("LimitDragDistance"))
- {
- F32 max_drag_distance = gSavedSettings.getF32("MaxDragDistance");
-
- if (relative_move.magVecSquared() > max_drag_distance * max_drag_distance)
- {
- LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (too far)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_NOLOCKED);
- return TRUE;
- }
- }
-
- F64 axis_magnitude = relative_move * axis_d; // dot product
- LLVector3d cursor_point_snap_line;
-
- F64 off_axis_magnitude;
-
- getMousePointOnPlaneGlobal(cursor_point_snap_line, x, y, current_pos_global, mSnapOffsetAxis % axis_f);
- off_axis_magnitude = axis_exists ? llabs((cursor_point_snap_line - current_pos_global) * LLVector3d(mSnapOffsetAxis)) : 0.f;
-
- if (gSavedSettings.getBOOL("SnapEnabled"))
- {
- if (off_axis_magnitude > mSnapOffsetMeters)
- {
- mInSnapRegime = TRUE;
- LLVector3 cursor_snap_agent = gAgent.getPosAgentFromGlobal(cursor_point_snap_line);
-
- F32 cursor_grid_dist = (cursor_snap_agent - mGridOrigin) * axis_f;
-
- F32 snap_dist = getMinGridScale() / (2.f * mSubdivisions);
- F32 relative_snap_dist = fmodf(llabs(cursor_grid_dist) + snap_dist, getMinGridScale() / mSubdivisions);
- if (relative_snap_dist < snap_dist * 2.f)
- {
- if (cursor_grid_dist > 0.f)
- {
- cursor_grid_dist -= relative_snap_dist - snap_dist;
- }
- else
- {
- cursor_grid_dist += relative_snap_dist - snap_dist;
- }
- }
-
- F32 object_start_on_axis = (gAgent.getPosAgentFromGlobal(mDragSelectionStartGlobal) - mGridOrigin) * axis_f;
- axis_magnitude = cursor_grid_dist - object_start_on_axis;
- }
- else if (mManipPart >= LL_YZ_PLANE && mManipPart <= LL_XY_PLANE)
- {
- // subtract offset from object center
- LLVector3d cursor_point_global;
- getMousePointOnPlaneGlobal( cursor_point_global, x, y, current_pos_global, mManipNormal );
- cursor_point_global -= (mDragCursorStartGlobal - mDragSelectionStartGlobal);
-
- // snap to planar grid
- LLVector3 cursor_point_agent = gAgent.getPosAgentFromGlobal(cursor_point_global);
- LLVector3 camera_plane_projection = LLViewerCamera::getInstance()->getAtAxis();
- camera_plane_projection -= projected_vec(camera_plane_projection, mManipNormal);
- camera_plane_projection.normVec();
- LLVector3 camera_projected_dir = camera_plane_projection;
- camera_plane_projection.rotVec(~mGridRotation);
- camera_plane_projection.scaleVec(mGridScale);
- camera_plane_projection.abs();
- F32 max_grid_scale;
- if (camera_plane_projection.mV[VX] > camera_plane_projection.mV[VY] &&
- camera_plane_projection.mV[VX] > camera_plane_projection.mV[VZ])
- {
- max_grid_scale = mGridScale.mV[VX];
- }
- else if (camera_plane_projection.mV[VY] > camera_plane_projection.mV[VZ])
- {
- max_grid_scale = mGridScale.mV[VY];
- }
- else
- {
- max_grid_scale = mGridScale.mV[VZ];
- }
-
- F32 num_subdivisions = getSubdivisionLevel(getPivotPoint(), camera_projected_dir, max_grid_scale);
-
- F32 grid_scale_a;
- F32 grid_scale_b;
- LLVector3 cursor_point_grid = (cursor_point_agent - mGridOrigin) * ~mGridRotation;
-
- switch (mManipPart)
- {
- case LL_YZ_PLANE:
- grid_scale_a = mGridScale.mV[VY] / num_subdivisions;
- grid_scale_b = mGridScale.mV[VZ] / num_subdivisions;
- cursor_point_grid.mV[VY] -= fmod(cursor_point_grid.mV[VY] + grid_scale_a * 0.5f, grid_scale_a) - grid_scale_a * 0.5f;
- cursor_point_grid.mV[VZ] -= fmod(cursor_point_grid.mV[VZ] + grid_scale_b * 0.5f, grid_scale_b) - grid_scale_b * 0.5f;
- break;
- case LL_XZ_PLANE:
- grid_scale_a = mGridScale.mV[VX] / num_subdivisions;
- grid_scale_b = mGridScale.mV[VZ] / num_subdivisions;
- cursor_point_grid.mV[VX] -= fmod(cursor_point_grid.mV[VX] + grid_scale_a * 0.5f, grid_scale_a) - grid_scale_a * 0.5f;
- cursor_point_grid.mV[VZ] -= fmod(cursor_point_grid.mV[VZ] + grid_scale_b * 0.5f, grid_scale_b) - grid_scale_b * 0.5f;
- break;
- case LL_XY_PLANE:
- grid_scale_a = mGridScale.mV[VX] / num_subdivisions;
- grid_scale_b = mGridScale.mV[VY] / num_subdivisions;
- cursor_point_grid.mV[VX] -= fmod(cursor_point_grid.mV[VX] + grid_scale_a * 0.5f, grid_scale_a) - grid_scale_a * 0.5f;
- cursor_point_grid.mV[VY] -= fmod(cursor_point_grid.mV[VY] + grid_scale_b * 0.5f, grid_scale_b) - grid_scale_b * 0.5f;
- break;
- default:
- break;
- }
- cursor_point_agent = (cursor_point_grid * mGridRotation) + mGridOrigin;
- relative_move.setVec(cursor_point_agent - gAgent.getPosAgentFromGlobal(mDragSelectionStartGlobal));
- mInSnapRegime = TRUE;
- }
- else
- {
- mInSnapRegime = FALSE;
- }
- }
- else
- {
- mInSnapRegime = FALSE;
- }
-
- // Clamp to arrow direction
- // *FIX: does this apply anymore?
- if (!axis_exists)
- {
- axis_magnitude = relative_move.normVec();
- axis_d.setVec(relative_move);
- axis_d.normVec();
- axis_f.setVec(axis_d);
- }
-
- LLVector3d clamped_relative_move = axis_magnitude * axis_d; // scalar multiply
- LLVector3 clamped_relative_move_f = (F32)axis_magnitude * axis_f; // scalar multiply
-
- for (LLObjectSelection::iterator iter = mObjectSelection->begin();
- iter != mObjectSelection->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject* object = selectNode->getObject();
-
- // Only apply motion to root objects and objects selected
- // as "individual".
- if (!object->isRootEdit() && !selectNode->mIndividualSelection)
- {
- continue;
- }
-
- if (!object->isRootEdit())
- {
- // child objects should not update if parent is selected
- LLViewerObject* editable_root = (LLViewerObject*)object->getParent();
- if (editable_root->isSelected())
- {
- // we will be moved properly by our parent, so skip
- continue;
- }
- }
-
- LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit();
- if (object->permMove() && !object->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()))
- {
- // handle attachments in local space
- if (object->isAttachment() && object->mDrawable.notNull())
- {
- // calculate local version of relative move
- LLQuaternion objWorldRotation = object->mDrawable->mXform.getParent()->getWorldRotation();
- objWorldRotation.transQuat();
-
- LLVector3 old_position_local = object->getPosition();
- LLVector3 new_position_local = selectNode->mSavedPositionLocal + (clamped_relative_move_f * objWorldRotation);
-
- //RN: I forget, but we need to do this because of snapping which doesn't often result
- // in position changes even when the mouse moves
- object->setPosition(new_position_local);
- rebuild(object);
- gAgentAvatarp->clampAttachmentPositions();
- new_position_local = object->getPosition();
-
- if (selectNode->mIndividualSelection)
- {
- // counter-translate child objects if we are moving the root as an individual
- object->resetChildrenPosition(old_position_local - new_position_local, TRUE) ;
- }
- }
- else
- {
- // compute new position to send to simulators, but don't set it yet.
- // We need the old position to know which simulator to send the move message to.
- LLVector3d new_position_global = selectNode->mSavedPositionGlobal + clamped_relative_move;
-
- // Don't let object centers go too far underground
- F64 min_height = LLWorld::getInstance()->getMinAllowedZ(object, object->getPositionGlobal());
- if (new_position_global.mdV[VZ] < min_height)
- {
- new_position_global.mdV[VZ] = min_height;
- }
-
- // For safety, cap heights where objects can be dragged
- if (new_position_global.mdV[VZ] > MAX_OBJECT_Z)
- {
- new_position_global.mdV[VZ] = MAX_OBJECT_Z;
- }
-
- // Grass is always drawn on the ground, so clamp its position to the ground
- if (object->getPCode() == LL_PCODE_LEGACY_GRASS)
- {
- new_position_global.mdV[VZ] = LLWorld::getInstance()->resolveLandHeightGlobal(new_position_global) + 1.f;
- }
-
- if (object->isRootEdit())
- {
- new_position_global = LLWorld::getInstance()->clipToVisibleRegions(object->getPositionGlobal(), new_position_global);
- }
-
- // PR: Only update if changed
- LLVector3 old_position_agent = object->getPositionAgent();
- LLVector3 new_position_agent = gAgent.getPosAgentFromGlobal(new_position_global);
- if (object->isRootEdit())
- {
- // finally, move parent object after children have calculated new offsets
- object->setPositionAgent(new_position_agent);
- rebuild(object);
- }
- else
- {
- LLViewerObject* root_object = object->getRootEdit();
- new_position_agent -= root_object->getPositionAgent();
- new_position_agent = new_position_agent * ~root_object->getRotation();
- object->setPositionParent(new_position_agent, FALSE);
- rebuild(object);
- }
-
- if (selectNode->mIndividualSelection)
- {
- // counter-translate child objects if we are moving the root as an individual
- object->resetChildrenPosition(old_position_agent - new_position_agent, TRUE) ;
- }
- }
- selectNode->mLastPositionLocal = object->getPosition();
- }
- }
-
- LLSelectMgr::getInstance()->updateSelectionCenter();
- gAgentCamera.clearFocusObject();
- dialog_refresh_all(); // ??? is this necessary?
-
- LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (active)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
- return TRUE;
+ // Translation tool only works if mouse button is down.
+ // Bail out if mouse not down.
+ if( !hasMouseCapture() )
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (inactive)" << LL_ENDL;
+ // Always show cursor
+ // gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
+
+ highlightManipulators(x, y);
+ return TRUE;
+ }
+
+ // Handle auto-rotation if necessary.
+ LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
+ const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD;
+ const S32 ROTATE_H_MARGIN = world_rect.getWidth() / 20;
+ const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
+ BOOL rotated = FALSE;
+
+ // ...build mode moves camera about focus point
+ if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
+ {
+ if (x < ROTATE_H_MARGIN)
+ {
+ gAgentCamera.cameraOrbitAround(rotate_angle);
+ rotated = TRUE;
+ }
+ else if (x > world_rect.getWidth() - ROTATE_H_MARGIN)
+ {
+ gAgentCamera.cameraOrbitAround(-rotate_angle);
+ rotated = TRUE;
+ }
+ }
+
+ // Suppress processing if mouse hasn't actually moved.
+ // This may cause problems if the camera moves outside of the
+ // rotation above.
+ if( x == mLastHoverMouseX && y == mLastHoverMouseY && !rotated)
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse unmoved)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
+ return TRUE;
+ }
+ mLastHoverMouseX = x;
+ mLastHoverMouseY = y;
+
+ // Suppress if mouse hasn't moved past the initial slop region
+ // Reset once we start moving
+ if( !mMouseOutsideSlop )
+ {
+ if (abs(mMouseDownX - x) < MOUSE_DRAG_SLOP && abs(mMouseDownY - y) < MOUSE_DRAG_SLOP )
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse inside slop)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
+ return TRUE;
+ }
+ else
+ {
+ // ...just went outside the slop region
+ mMouseOutsideSlop = TRUE;
+ // If holding down shift, leave behind a copy.
+ if (mask == MASK_COPY)
+ {
+ // ...we're trying to make a copy
+ LLSelectMgr::getInstance()->selectDuplicate(LLVector3::zero, FALSE);
+ mCopyMadeThisDrag = TRUE;
+
+ // When we make the copy, we don't want to do any other processing.
+ // If so, the object will also be moved, and the copy will be offset.
+ LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (made copy)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
+ }
+ }
+ }
+
+ // Throttle updates to 10 per second.
+
+ LLVector3 axis_f;
+ LLVector3d axis_d;
+
+ // pick the first object to constrain to grid w/ common origin
+ // this is so we don't screw up groups
+ LLSelectNode* selectNode = mObjectSelection->getFirstMoveableNode(TRUE);
+ if (!selectNode)
+ {
+ // somehow we lost the object!
+ LL_WARNS() << "Translate manip lost the object, no selectNode" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
+ return TRUE;
+ }
+
+ LLViewerObject* object = selectNode->getObject();
+ if (!object)
+ {
+ // somehow we lost the object!
+ LL_WARNS() << "Translate manip lost the object, no object in selectNode" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
+ return TRUE;
+ }
+
+ // Compute unit vectors for arrow hit and a plane through that vector
+ BOOL axis_exists = getManipAxis(object, mManipPart, axis_f); // TODO: move this
+
+ axis_d.setVec(axis_f);
+
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ LLVector3d current_pos_global = gAgent.getPosGlobalFromAgent(getPivotPoint());
+
+ mSubdivisions = getSubdivisionLevel(getPivotPoint(), axis_f, getMinGridScale());
+
+ // Project the cursor onto that plane
+ LLVector3d relative_move;
+ getMousePointOnPlaneGlobal(relative_move, x, y, current_pos_global, mManipNormal);\
+ relative_move -= mDragCursorStartGlobal;
+
+ // You can't move more than some distance from your original mousedown point.
+ if (gSavedSettings.getBOOL("LimitDragDistance"))
+ {
+ F32 max_drag_distance = gSavedSettings.getF32("MaxDragDistance");
+
+ if (relative_move.magVecSquared() > max_drag_distance * max_drag_distance)
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (too far)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_NOLOCKED);
+ return TRUE;
+ }
+ }
+
+ F64 axis_magnitude = relative_move * axis_d; // dot product
+ LLVector3d cursor_point_snap_line;
+
+ F64 off_axis_magnitude;
+
+ getMousePointOnPlaneGlobal(cursor_point_snap_line, x, y, current_pos_global, mSnapOffsetAxis % axis_f);
+ off_axis_magnitude = axis_exists ? llabs((cursor_point_snap_line - current_pos_global) * LLVector3d(mSnapOffsetAxis)) : 0.f;
+
+ if (gSavedSettings.getBOOL("SnapEnabled"))
+ {
+ if (off_axis_magnitude > mSnapOffsetMeters)
+ {
+ mInSnapRegime = TRUE;
+ LLVector3 cursor_snap_agent = gAgent.getPosAgentFromGlobal(cursor_point_snap_line);
+
+ F32 cursor_grid_dist = (cursor_snap_agent - mGridOrigin) * axis_f;
+
+ F32 snap_dist = getMinGridScale() / (2.f * mSubdivisions);
+ F32 relative_snap_dist = fmodf(llabs(cursor_grid_dist) + snap_dist, getMinGridScale() / mSubdivisions);
+ if (relative_snap_dist < snap_dist * 2.f)
+ {
+ if (cursor_grid_dist > 0.f)
+ {
+ cursor_grid_dist -= relative_snap_dist - snap_dist;
+ }
+ else
+ {
+ cursor_grid_dist += relative_snap_dist - snap_dist;
+ }
+ }
+
+ F32 object_start_on_axis = (gAgent.getPosAgentFromGlobal(mDragSelectionStartGlobal) - mGridOrigin) * axis_f;
+ axis_magnitude = cursor_grid_dist - object_start_on_axis;
+ }
+ else if (mManipPart >= LL_YZ_PLANE && mManipPart <= LL_XY_PLANE)
+ {
+ // subtract offset from object center
+ LLVector3d cursor_point_global;
+ getMousePointOnPlaneGlobal( cursor_point_global, x, y, current_pos_global, mManipNormal );
+ cursor_point_global -= (mDragCursorStartGlobal - mDragSelectionStartGlobal);
+
+ // snap to planar grid
+ LLVector3 cursor_point_agent = gAgent.getPosAgentFromGlobal(cursor_point_global);
+ LLVector3 camera_plane_projection = LLViewerCamera::getInstance()->getAtAxis();
+ camera_plane_projection -= projected_vec(camera_plane_projection, mManipNormal);
+ camera_plane_projection.normVec();
+ LLVector3 camera_projected_dir = camera_plane_projection;
+ camera_plane_projection.rotVec(~mGridRotation);
+ camera_plane_projection.scaleVec(mGridScale);
+ camera_plane_projection.abs();
+ F32 max_grid_scale;
+ if (camera_plane_projection.mV[VX] > camera_plane_projection.mV[VY] &&
+ camera_plane_projection.mV[VX] > camera_plane_projection.mV[VZ])
+ {
+ max_grid_scale = mGridScale.mV[VX];
+ }
+ else if (camera_plane_projection.mV[VY] > camera_plane_projection.mV[VZ])
+ {
+ max_grid_scale = mGridScale.mV[VY];
+ }
+ else
+ {
+ max_grid_scale = mGridScale.mV[VZ];
+ }
+
+ F32 num_subdivisions = getSubdivisionLevel(getPivotPoint(), camera_projected_dir, max_grid_scale);
+
+ F32 grid_scale_a;
+ F32 grid_scale_b;
+ LLVector3 cursor_point_grid = (cursor_point_agent - mGridOrigin) * ~mGridRotation;
+
+ switch (mManipPart)
+ {
+ case LL_YZ_PLANE:
+ grid_scale_a = mGridScale.mV[VY] / num_subdivisions;
+ grid_scale_b = mGridScale.mV[VZ] / num_subdivisions;
+ cursor_point_grid.mV[VY] -= fmod(cursor_point_grid.mV[VY] + grid_scale_a * 0.5f, grid_scale_a) - grid_scale_a * 0.5f;
+ cursor_point_grid.mV[VZ] -= fmod(cursor_point_grid.mV[VZ] + grid_scale_b * 0.5f, grid_scale_b) - grid_scale_b * 0.5f;
+ break;
+ case LL_XZ_PLANE:
+ grid_scale_a = mGridScale.mV[VX] / num_subdivisions;
+ grid_scale_b = mGridScale.mV[VZ] / num_subdivisions;
+ cursor_point_grid.mV[VX] -= fmod(cursor_point_grid.mV[VX] + grid_scale_a * 0.5f, grid_scale_a) - grid_scale_a * 0.5f;
+ cursor_point_grid.mV[VZ] -= fmod(cursor_point_grid.mV[VZ] + grid_scale_b * 0.5f, grid_scale_b) - grid_scale_b * 0.5f;
+ break;
+ case LL_XY_PLANE:
+ grid_scale_a = mGridScale.mV[VX] / num_subdivisions;
+ grid_scale_b = mGridScale.mV[VY] / num_subdivisions;
+ cursor_point_grid.mV[VX] -= fmod(cursor_point_grid.mV[VX] + grid_scale_a * 0.5f, grid_scale_a) - grid_scale_a * 0.5f;
+ cursor_point_grid.mV[VY] -= fmod(cursor_point_grid.mV[VY] + grid_scale_b * 0.5f, grid_scale_b) - grid_scale_b * 0.5f;
+ break;
+ default:
+ break;
+ }
+ cursor_point_agent = (cursor_point_grid * mGridRotation) + mGridOrigin;
+ relative_move.setVec(cursor_point_agent - gAgent.getPosAgentFromGlobal(mDragSelectionStartGlobal));
+ mInSnapRegime = TRUE;
+ }
+ else
+ {
+ mInSnapRegime = FALSE;
+ }
+ }
+ else
+ {
+ mInSnapRegime = FALSE;
+ }
+
+ // Clamp to arrow direction
+ // *FIX: does this apply anymore?
+ if (!axis_exists)
+ {
+ axis_magnitude = relative_move.normVec();
+ axis_d.setVec(relative_move);
+ axis_d.normVec();
+ axis_f.setVec(axis_d);
+ }
+
+ LLVector3d clamped_relative_move = axis_magnitude * axis_d; // scalar multiply
+ LLVector3 clamped_relative_move_f = (F32)axis_magnitude * axis_f; // scalar multiply
+
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* object = selectNode->getObject();
+
+ // Only apply motion to root objects and objects selected
+ // as "individual".
+ if (!object->isRootEdit() && !selectNode->mIndividualSelection)
+ {
+ continue;
+ }
+
+ if (!object->isRootEdit())
+ {
+ // child objects should not update if parent is selected
+ LLViewerObject* editable_root = (LLViewerObject*)object->getParent();
+ if (editable_root->isSelected())
+ {
+ // we will be moved properly by our parent, so skip
+ continue;
+ }
+ }
+
+ LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit();
+ if (object->permMove() && !object->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()))
+ {
+ // handle attachments in local space
+ if (object->isAttachment() && object->mDrawable.notNull())
+ {
+ // calculate local version of relative move
+ LLQuaternion objWorldRotation = object->mDrawable->mXform.getParent()->getWorldRotation();
+ objWorldRotation.transQuat();
+
+ LLVector3 old_position_local = object->getPosition();
+ LLVector3 new_position_local = selectNode->mSavedPositionLocal + (clamped_relative_move_f * objWorldRotation);
+
+ //RN: I forget, but we need to do this because of snapping which doesn't often result
+ // in position changes even when the mouse moves
+ object->setPosition(new_position_local);
+ rebuild(object);
+ gAgentAvatarp->clampAttachmentPositions();
+ new_position_local = object->getPosition();
+
+ if (selectNode->mIndividualSelection)
+ {
+ // counter-translate child objects if we are moving the root as an individual
+ object->resetChildrenPosition(old_position_local - new_position_local, TRUE) ;
+ }
+ }
+ else
+ {
+ // compute new position to send to simulators, but don't set it yet.
+ // We need the old position to know which simulator to send the move message to.
+ LLVector3d new_position_global = selectNode->mSavedPositionGlobal + clamped_relative_move;
+
+ // Don't let object centers go too far underground
+ F64 min_height = LLWorld::getInstance()->getMinAllowedZ(object, object->getPositionGlobal());
+ if (new_position_global.mdV[VZ] < min_height)
+ {
+ new_position_global.mdV[VZ] = min_height;
+ }
+
+ // For safety, cap heights where objects can be dragged
+ if (new_position_global.mdV[VZ] > MAX_OBJECT_Z)
+ {
+ new_position_global.mdV[VZ] = MAX_OBJECT_Z;
+ }
+
+ // Grass is always drawn on the ground, so clamp its position to the ground
+ if (object->getPCode() == LL_PCODE_LEGACY_GRASS)
+ {
+ new_position_global.mdV[VZ] = LLWorld::getInstance()->resolveLandHeightGlobal(new_position_global) + 1.f;
+ }
+
+ if (object->isRootEdit())
+ {
+ new_position_global = LLWorld::getInstance()->clipToVisibleRegions(object->getPositionGlobal(), new_position_global);
+ }
+
+ // PR: Only update if changed
+ LLVector3 old_position_agent = object->getPositionAgent();
+ LLVector3 new_position_agent = gAgent.getPosAgentFromGlobal(new_position_global);
+ if (object->isRootEdit())
+ {
+ // finally, move parent object after children have calculated new offsets
+ object->setPositionAgent(new_position_agent);
+ rebuild(object);
+ }
+ else
+ {
+ LLViewerObject* root_object = object->getRootEdit();
+ new_position_agent -= root_object->getPositionAgent();
+ new_position_agent = new_position_agent * ~root_object->getRotation();
+ object->setPositionParent(new_position_agent, FALSE);
+ rebuild(object);
+ }
+
+ if (selectNode->mIndividualSelection)
+ {
+ // counter-translate child objects if we are moving the root as an individual
+ object->resetChildrenPosition(old_position_agent - new_position_agent, TRUE) ;
+ }
+ }
+ selectNode->mLastPositionLocal = object->getPosition();
+ }
+ }
+
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ gAgentCamera.clearFocusObject();
+ dialog_refresh_all(); // ??? is this necessary?
+
+ LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (active)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
+ return TRUE;
}
void LLManipTranslate::highlightManipulators(S32 x, S32 y)
{
- mHighlightedPart = LL_NO_PART;
-
- if (!mObjectSelection->getObjectCount())
- {
- return;
- }
-
- //LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
- LLMatrix4 projMatrix = LLViewerCamera::getInstance()->getProjection();
- LLMatrix4 modelView = LLViewerCamera::getInstance()->getModelview();
-
- LLVector3 object_position = getPivotPoint();
-
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
-
- LLVector3 relative_camera_dir;
-
- LLMatrix4 transform;
-
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- relative_camera_dir = LLVector3(1.f, 0.f, 0.f) * ~grid_rotation;
- LLVector4 translation(object_position);
- transform.initRotTrans(grid_rotation, translation);
- LLMatrix4 cfr(OGL_TO_CFR_ROTATION);
- transform *= cfr;
- LLMatrix4 window_scale;
- F32 zoom_level = 2.f * gAgentCamera.mHUDCurZoom;
- window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f),
- LLQuaternion::DEFAULT,
- LLVector3::zero);
- transform *= window_scale;
- }
- else
- {
- relative_camera_dir = (object_position - LLViewerCamera::getInstance()->getOrigin()) * ~grid_rotation;
- relative_camera_dir.normVec();
-
- transform.initRotTrans(grid_rotation, LLVector4(object_position));
- transform *= modelView;
- transform *= projMatrix;
- }
-
- S32 numManips = 0;
-
- // edges
- mManipulatorVertices[numManips++] = LLVector4(mArrowLengthMeters * MANIPULATOR_HOTSPOT_START, 0.f, 0.f, 1.f);
- mManipulatorVertices[numManips++] = LLVector4(mArrowLengthMeters * MANIPULATOR_HOTSPOT_END, 0.f, 0.f, 1.f);
-
- mManipulatorVertices[numManips++] = LLVector4(0.f, mArrowLengthMeters * MANIPULATOR_HOTSPOT_START, 0.f, 1.f);
- mManipulatorVertices[numManips++] = LLVector4(0.f, mArrowLengthMeters * MANIPULATOR_HOTSPOT_END, 0.f, 1.f);
-
- mManipulatorVertices[numManips++] = LLVector4(0.f, 0.f, mArrowLengthMeters * MANIPULATOR_HOTSPOT_START, 1.f);
- mManipulatorVertices[numManips++] = LLVector4(0.f, 0.f, mArrowLengthMeters * MANIPULATOR_HOTSPOT_END, 1.f);
-
- mManipulatorVertices[numManips++] = LLVector4(mArrowLengthMeters * -MANIPULATOR_HOTSPOT_START, 0.f, 0.f, 1.f);
- mManipulatorVertices[numManips++] = LLVector4(mArrowLengthMeters * -MANIPULATOR_HOTSPOT_END, 0.f, 0.f, 1.f);
-
- mManipulatorVertices[numManips++] = LLVector4(0.f, mArrowLengthMeters * -MANIPULATOR_HOTSPOT_START, 0.f, 1.f);
- mManipulatorVertices[numManips++] = LLVector4(0.f, mArrowLengthMeters * -MANIPULATOR_HOTSPOT_END, 0.f, 1.f);
-
- mManipulatorVertices[numManips++] = LLVector4(0.f, 0.f, mArrowLengthMeters * -MANIPULATOR_HOTSPOT_START, 1.f);
- mManipulatorVertices[numManips++] = LLVector4(0.f, 0.f, mArrowLengthMeters * -MANIPULATOR_HOTSPOT_END, 1.f);
-
- S32 num_arrow_manips = numManips;
-
- // planar manipulators
- BOOL planar_manip_yz_visible = FALSE;
- BOOL planar_manip_xz_visible = FALSE;
- BOOL planar_manip_xy_visible = FALSE;
-
- mManipulatorVertices[numManips] = LLVector4(0.f, mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 1.f);
- mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
- mManipulatorVertices[numManips] = LLVector4(0.f, mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), 1.f);
- mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
- if (llabs(relative_camera_dir.mV[VX]) > MIN_PLANE_MANIP_DOT_PRODUCT)
- {
- planar_manip_yz_visible = TRUE;
- }
-
- mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 0.f, mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 1.f);
- mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
- mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), 0.f, mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), 1.f);
- mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
- if (llabs(relative_camera_dir.mV[VY]) > MIN_PLANE_MANIP_DOT_PRODUCT)
- {
- planar_manip_xz_visible = TRUE;
- }
-
- mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 0.f, 1.f);
- mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
- mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), 0.f, 1.f);
- mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
- if (llabs(relative_camera_dir.mV[VZ]) > MIN_PLANE_MANIP_DOT_PRODUCT)
- {
- planar_manip_xy_visible = TRUE;
- }
-
- // Project up to 9 manipulators to screen space 2*X, 2*Y, 2*Z, 3*planes
- std::vector<ManipulatorHandle> projected_manipulators;
- projected_manipulators.reserve(9);
-
- for (S32 i = 0; i < num_arrow_manips; i+= 2)
- {
- LLVector4 projected_start = mManipulatorVertices[i] * transform;
- projected_start = projected_start * (1.f / projected_start.mV[VW]);
-
- LLVector4 projected_end = mManipulatorVertices[i + 1] * transform;
- projected_end = projected_end * (1.f / projected_end.mV[VW]);
-
- ManipulatorHandle projected_manip(
- LLVector3(projected_start.mV[VX], projected_start.mV[VY], projected_start.mV[VZ]),
- LLVector3(projected_end.mV[VX], projected_end.mV[VY], projected_end.mV[VZ]),
- MANIPULATOR_IDS[i / 2],
- 10.f); // 10 pixel hotspot for arrows
- projected_manipulators.push_back(projected_manip);
- }
-
- if (planar_manip_yz_visible)
- {
- S32 i = num_arrow_manips;
- LLVector4 projected_start = mManipulatorVertices[i] * transform;
- projected_start = projected_start * (1.f / projected_start.mV[VW]);
-
- LLVector4 projected_end = mManipulatorVertices[i + 1] * transform;
- projected_end = projected_end * (1.f / projected_end.mV[VW]);
-
- ManipulatorHandle projected_manip(
- LLVector3(projected_start.mV[VX], projected_start.mV[VY], projected_start.mV[VZ]),
- LLVector3(projected_end.mV[VX], projected_end.mV[VY], projected_end.mV[VZ]),
- MANIPULATOR_IDS[i / 2],
- 20.f); // 20 pixels for planar manipulators
- projected_manipulators.push_back(projected_manip);
- }
-
- if (planar_manip_xz_visible)
- {
- S32 i = num_arrow_manips + 2;
- LLVector4 projected_start = mManipulatorVertices[i] * transform;
- projected_start = projected_start * (1.f / projected_start.mV[VW]);
-
- LLVector4 projected_end = mManipulatorVertices[i + 1] * transform;
- projected_end = projected_end * (1.f / projected_end.mV[VW]);
-
- ManipulatorHandle projected_manip(
- LLVector3(projected_start.mV[VX], projected_start.mV[VY], projected_start.mV[VZ]),
- LLVector3(projected_end.mV[VX], projected_end.mV[VY], projected_end.mV[VZ]),
- MANIPULATOR_IDS[i / 2],
- 20.f); // 20 pixels for planar manipulators
- projected_manipulators.push_back(projected_manip);
- }
-
- if (planar_manip_xy_visible)
- {
- S32 i = num_arrow_manips + 4;
- LLVector4 projected_start = mManipulatorVertices[i] * transform;
- projected_start = projected_start * (1.f / projected_start.mV[VW]);
-
- LLVector4 projected_end = mManipulatorVertices[i + 1] * transform;
- projected_end = projected_end * (1.f / projected_end.mV[VW]);
-
- ManipulatorHandle projected_manip(
- LLVector3(projected_start.mV[VX], projected_start.mV[VY], projected_start.mV[VZ]),
- LLVector3(projected_end.mV[VX], projected_end.mV[VY], projected_end.mV[VZ]),
- MANIPULATOR_IDS[i / 2],
- 20.f); // 20 pixels for planar manipulators
- projected_manipulators.push_back(projected_manip);
- }
-
- LLVector2 manip_start_2d;
- LLVector2 manip_end_2d;
- LLVector2 manip_dir;
- LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled();
- F32 half_width = (F32)world_view_rect.getWidth() / 2.f;
- F32 half_height = (F32)world_view_rect.getHeight() / 2.f;
- LLVector2 mousePos((F32)x - half_width, (F32)y - half_height);
- LLVector2 mouse_delta;
-
- // Keep order consistent with insertion via stable_sort
- std::stable_sort( projected_manipulators.begin(),
- projected_manipulators.end(),
- ClosestToCamera() );
-
- std::vector<ManipulatorHandle>::iterator it = projected_manipulators.begin();
- for ( ; it != projected_manipulators.end(); ++it)
- {
- ManipulatorHandle& manipulator = *it;
- {
- manip_start_2d.setVec(manipulator.mStartPosition.mV[VX] * half_width, manipulator.mStartPosition.mV[VY] * half_height);
- manip_end_2d.setVec(manipulator.mEndPosition.mV[VX] * half_width, manipulator.mEndPosition.mV[VY] * half_height);
- manip_dir = manip_end_2d - manip_start_2d;
-
- mouse_delta = mousePos - manip_start_2d;
-
- F32 manip_length = manip_dir.normVec();
-
- F32 mouse_pos_manip = mouse_delta * manip_dir;
- F32 mouse_dist_manip_squared = mouse_delta.magVecSquared() - (mouse_pos_manip * mouse_pos_manip);
-
- if (mouse_pos_manip > 0.f &&
- mouse_pos_manip < manip_length &&
- mouse_dist_manip_squared < manipulator.mHotSpotRadius * manipulator.mHotSpotRadius)
- {
- mHighlightedPart = manipulator.mManipID;
- break;
- }
- }
- }
+ mHighlightedPart = LL_NO_PART;
+
+ if (!mObjectSelection->getObjectCount())
+ {
+ return;
+ }
+
+ //LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+ LLMatrix4 projMatrix = LLViewerCamera::getInstance()->getProjection();
+ LLMatrix4 modelView = LLViewerCamera::getInstance()->getModelview();
+
+ LLVector3 object_position = getPivotPoint();
+
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+
+ LLVector3 relative_camera_dir;
+
+ LLMatrix4 transform;
+
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ relative_camera_dir = LLVector3(1.f, 0.f, 0.f) * ~grid_rotation;
+ LLVector4 translation(object_position);
+ transform.initRotTrans(grid_rotation, translation);
+ LLMatrix4 cfr(OGL_TO_CFR_ROTATION);
+ transform *= cfr;
+ LLMatrix4 window_scale;
+ F32 zoom_level = 2.f * gAgentCamera.mHUDCurZoom;
+ window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f),
+ LLQuaternion::DEFAULT,
+ LLVector3::zero);
+ transform *= window_scale;
+ }
+ else
+ {
+ relative_camera_dir = (object_position - LLViewerCamera::getInstance()->getOrigin()) * ~grid_rotation;
+ relative_camera_dir.normVec();
+
+ transform.initRotTrans(grid_rotation, LLVector4(object_position));
+ transform *= modelView;
+ transform *= projMatrix;
+ }
+
+ S32 numManips = 0;
+
+ // edges
+ mManipulatorVertices[numManips++] = LLVector4(mArrowLengthMeters * MANIPULATOR_HOTSPOT_START, 0.f, 0.f, 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(mArrowLengthMeters * MANIPULATOR_HOTSPOT_END, 0.f, 0.f, 1.f);
+
+ mManipulatorVertices[numManips++] = LLVector4(0.f, mArrowLengthMeters * MANIPULATOR_HOTSPOT_START, 0.f, 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(0.f, mArrowLengthMeters * MANIPULATOR_HOTSPOT_END, 0.f, 1.f);
+
+ mManipulatorVertices[numManips++] = LLVector4(0.f, 0.f, mArrowLengthMeters * MANIPULATOR_HOTSPOT_START, 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(0.f, 0.f, mArrowLengthMeters * MANIPULATOR_HOTSPOT_END, 1.f);
+
+ mManipulatorVertices[numManips++] = LLVector4(mArrowLengthMeters * -MANIPULATOR_HOTSPOT_START, 0.f, 0.f, 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(mArrowLengthMeters * -MANIPULATOR_HOTSPOT_END, 0.f, 0.f, 1.f);
+
+ mManipulatorVertices[numManips++] = LLVector4(0.f, mArrowLengthMeters * -MANIPULATOR_HOTSPOT_START, 0.f, 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(0.f, mArrowLengthMeters * -MANIPULATOR_HOTSPOT_END, 0.f, 1.f);
+
+ mManipulatorVertices[numManips++] = LLVector4(0.f, 0.f, mArrowLengthMeters * -MANIPULATOR_HOTSPOT_START, 1.f);
+ mManipulatorVertices[numManips++] = LLVector4(0.f, 0.f, mArrowLengthMeters * -MANIPULATOR_HOTSPOT_END, 1.f);
+
+ S32 num_arrow_manips = numManips;
+
+ // planar manipulators
+ BOOL planar_manip_yz_visible = FALSE;
+ BOOL planar_manip_xz_visible = FALSE;
+ BOOL planar_manip_xy_visible = FALSE;
+
+ mManipulatorVertices[numManips] = LLVector4(0.f, mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 1.f);
+ mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
+ mManipulatorVertices[numManips] = LLVector4(0.f, mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), 1.f);
+ mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
+ if (llabs(relative_camera_dir.mV[VX]) > MIN_PLANE_MANIP_DOT_PRODUCT)
+ {
+ planar_manip_yz_visible = TRUE;
+ }
+
+ mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 0.f, mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 1.f);
+ mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
+ mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), 0.f, mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), 1.f);
+ mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
+ if (llabs(relative_camera_dir.mV[VY]) > MIN_PLANE_MANIP_DOT_PRODUCT)
+ {
+ planar_manip_xz_visible = TRUE;
+ }
+
+ mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f - PLANE_TICK_SIZE * 0.5f), 0.f, 1.f);
+ mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
+ mManipulatorVertices[numManips] = LLVector4(mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), mPlaneManipOffsetMeters * (1.f + PLANE_TICK_SIZE * 0.5f), 0.f, 1.f);
+ mManipulatorVertices[numManips++].scaleVec(mPlaneManipPositions);
+ if (llabs(relative_camera_dir.mV[VZ]) > MIN_PLANE_MANIP_DOT_PRODUCT)
+ {
+ planar_manip_xy_visible = TRUE;
+ }
+
+ // Project up to 9 manipulators to screen space 2*X, 2*Y, 2*Z, 3*planes
+ std::vector<ManipulatorHandle> projected_manipulators;
+ projected_manipulators.reserve(9);
+
+ for (S32 i = 0; i < num_arrow_manips; i+= 2)
+ {
+ LLVector4 projected_start = mManipulatorVertices[i] * transform;
+ projected_start = projected_start * (1.f / projected_start.mV[VW]);
+
+ LLVector4 projected_end = mManipulatorVertices[i + 1] * transform;
+ projected_end = projected_end * (1.f / projected_end.mV[VW]);
+
+ ManipulatorHandle projected_manip(
+ LLVector3(projected_start.mV[VX], projected_start.mV[VY], projected_start.mV[VZ]),
+ LLVector3(projected_end.mV[VX], projected_end.mV[VY], projected_end.mV[VZ]),
+ MANIPULATOR_IDS[i / 2],
+ 10.f); // 10 pixel hotspot for arrows
+ projected_manipulators.push_back(projected_manip);
+ }
+
+ if (planar_manip_yz_visible)
+ {
+ S32 i = num_arrow_manips;
+ LLVector4 projected_start = mManipulatorVertices[i] * transform;
+ projected_start = projected_start * (1.f / projected_start.mV[VW]);
+
+ LLVector4 projected_end = mManipulatorVertices[i + 1] * transform;
+ projected_end = projected_end * (1.f / projected_end.mV[VW]);
+
+ ManipulatorHandle projected_manip(
+ LLVector3(projected_start.mV[VX], projected_start.mV[VY], projected_start.mV[VZ]),
+ LLVector3(projected_end.mV[VX], projected_end.mV[VY], projected_end.mV[VZ]),
+ MANIPULATOR_IDS[i / 2],
+ 20.f); // 20 pixels for planar manipulators
+ projected_manipulators.push_back(projected_manip);
+ }
+
+ if (planar_manip_xz_visible)
+ {
+ S32 i = num_arrow_manips + 2;
+ LLVector4 projected_start = mManipulatorVertices[i] * transform;
+ projected_start = projected_start * (1.f / projected_start.mV[VW]);
+
+ LLVector4 projected_end = mManipulatorVertices[i + 1] * transform;
+ projected_end = projected_end * (1.f / projected_end.mV[VW]);
+
+ ManipulatorHandle projected_manip(
+ LLVector3(projected_start.mV[VX], projected_start.mV[VY], projected_start.mV[VZ]),
+ LLVector3(projected_end.mV[VX], projected_end.mV[VY], projected_end.mV[VZ]),
+ MANIPULATOR_IDS[i / 2],
+ 20.f); // 20 pixels for planar manipulators
+ projected_manipulators.push_back(projected_manip);
+ }
+
+ if (planar_manip_xy_visible)
+ {
+ S32 i = num_arrow_manips + 4;
+ LLVector4 projected_start = mManipulatorVertices[i] * transform;
+ projected_start = projected_start * (1.f / projected_start.mV[VW]);
+
+ LLVector4 projected_end = mManipulatorVertices[i + 1] * transform;
+ projected_end = projected_end * (1.f / projected_end.mV[VW]);
+
+ ManipulatorHandle projected_manip(
+ LLVector3(projected_start.mV[VX], projected_start.mV[VY], projected_start.mV[VZ]),
+ LLVector3(projected_end.mV[VX], projected_end.mV[VY], projected_end.mV[VZ]),
+ MANIPULATOR_IDS[i / 2],
+ 20.f); // 20 pixels for planar manipulators
+ projected_manipulators.push_back(projected_manip);
+ }
+
+ LLVector2 manip_start_2d;
+ LLVector2 manip_end_2d;
+ LLVector2 manip_dir;
+ LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled();
+ F32 half_width = (F32)world_view_rect.getWidth() / 2.f;
+ F32 half_height = (F32)world_view_rect.getHeight() / 2.f;
+ LLVector2 mousePos((F32)x - half_width, (F32)y - half_height);
+ LLVector2 mouse_delta;
+
+ // Keep order consistent with insertion via stable_sort
+ std::stable_sort( projected_manipulators.begin(),
+ projected_manipulators.end(),
+ ClosestToCamera() );
+
+ std::vector<ManipulatorHandle>::iterator it = projected_manipulators.begin();
+ for ( ; it != projected_manipulators.end(); ++it)
+ {
+ ManipulatorHandle& manipulator = *it;
+ {
+ manip_start_2d.setVec(manipulator.mStartPosition.mV[VX] * half_width, manipulator.mStartPosition.mV[VY] * half_height);
+ manip_end_2d.setVec(manipulator.mEndPosition.mV[VX] * half_width, manipulator.mEndPosition.mV[VY] * half_height);
+ manip_dir = manip_end_2d - manip_start_2d;
+
+ mouse_delta = mousePos - manip_start_2d;
+
+ F32 manip_length = manip_dir.normVec();
+
+ F32 mouse_pos_manip = mouse_delta * manip_dir;
+ F32 mouse_dist_manip_squared = mouse_delta.magVecSquared() - (mouse_pos_manip * mouse_pos_manip);
+
+ if (mouse_pos_manip > 0.f &&
+ mouse_pos_manip < manip_length &&
+ mouse_dist_manip_squared < manipulator.mHotSpotRadius * manipulator.mHotSpotRadius)
+ {
+ mHighlightedPart = manipulator.mManipID;
+ break;
+ }
+ }
+ }
}
F32 LLManipTranslate::getMinGridScale()
{
- F32 scale;
- switch (mManipPart)
- {
- case LL_NO_PART:
- default:
- scale = 1.f;
- break;
- case LL_X_ARROW:
- scale = mGridScale.mV[VX];
- break;
- case LL_Y_ARROW:
- scale = mGridScale.mV[VY];
- break;
- case LL_Z_ARROW:
- scale = mGridScale.mV[VZ];
- break;
- case LL_YZ_PLANE:
- scale = llmin(mGridScale.mV[VY], mGridScale.mV[VZ]);
- break;
- case LL_XZ_PLANE:
- scale = llmin(mGridScale.mV[VX], mGridScale.mV[VZ]);
- break;
- case LL_XY_PLANE:
- scale = llmin(mGridScale.mV[VX], mGridScale.mV[VY]);
- break;
- }
-
- return scale;
+ F32 scale;
+ switch (mManipPart)
+ {
+ case LL_NO_PART:
+ default:
+ scale = 1.f;
+ break;
+ case LL_X_ARROW:
+ scale = mGridScale.mV[VX];
+ break;
+ case LL_Y_ARROW:
+ scale = mGridScale.mV[VY];
+ break;
+ case LL_Z_ARROW:
+ scale = mGridScale.mV[VZ];
+ break;
+ case LL_YZ_PLANE:
+ scale = llmin(mGridScale.mV[VY], mGridScale.mV[VZ]);
+ break;
+ case LL_XZ_PLANE:
+ scale = llmin(mGridScale.mV[VX], mGridScale.mV[VZ]);
+ break;
+ case LL_XY_PLANE:
+ scale = llmin(mGridScale.mV[VX], mGridScale.mV[VY]);
+ break;
+ }
+
+ return scale;
}
BOOL LLManipTranslate::handleMouseUp(S32 x, S32 y, MASK mask)
{
- // first, perform normal processing in case this was a quick-click
- handleHover(x, y, mask);
-
- if(hasMouseCapture())
- {
- // make sure arrow colors go back to normal
- mManipPart = LL_NO_PART;
- LLSelectMgr::getInstance()->enableSilhouette(TRUE);
-
- // Might have missed last update due to UPDATE_DELAY timing.
- LLSelectMgr::getInstance()->sendMultipleUpdate( UPD_POSITION );
-
- mInSnapRegime = FALSE;
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
- }
-
- return LLManip::handleMouseUp(x, y, mask);
+ // first, perform normal processing in case this was a quick-click
+ handleHover(x, y, mask);
+
+ if(hasMouseCapture())
+ {
+ // make sure arrow colors go back to normal
+ mManipPart = LL_NO_PART;
+ LLSelectMgr::getInstance()->enableSilhouette(TRUE);
+
+ // Might have missed last update due to UPDATE_DELAY timing.
+ LLSelectMgr::getInstance()->sendMultipleUpdate( UPD_POSITION );
+
+ mInSnapRegime = FALSE;
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
+ }
+
+ return LLManip::handleMouseUp(x, y, mask);
}
void LLManipTranslate::render()
{
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- F32 zoom = gAgentCamera.mHUDCurZoom;
- gGL.scalef(zoom, zoom, zoom);
- }
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- renderGuidelines();
- }
- {
- //LLGLDisable gls_stencil(GL_STENCIL_TEST);
- renderTranslationHandles();
- renderSnapGuides();
- }
- gGL.popMatrix();
-
- renderText();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ F32 zoom = gAgentCamera.mHUDCurZoom;
+ gGL.scalef(zoom, zoom, zoom);
+ }
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ renderGuidelines();
+ }
+ {
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ renderTranslationHandles();
+ renderSnapGuides();
+ }
+ gGL.popMatrix();
+
+ renderText();
}
void LLManipTranslate::renderSnapGuides()
{
- if (!gSavedSettings.getBOOL("SnapEnabled"))
- {
- return;
- }
-
- F32 max_subdivisions = sGridMaxSubdivisionLevel;//(F32)gSavedSettings.getS32("GridSubdivision");
- F32 line_alpha = gSavedSettings.getF32("GridOpacity");
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest gls_depth(GL_TRUE);
- LLGLDisable gls_cull(GL_CULL_FACE);
- LLVector3 translate_axis;
-
- if (mManipPart == LL_NO_PART)
- {
- return;
- }
-
- LLSelectNode *first_node = mObjectSelection->getFirstMoveableNode(TRUE);
- if (!first_node)
- {
- return;
- }
-
- updateGridSettings();
-
- F32 smallest_grid_unit_scale = getMinGridScale() / max_subdivisions;
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
- LLVector3 saved_selection_center = getSavedPivotPoint(); //LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
- LLVector3 selection_center = getPivotPoint();
-
- LLViewerObject *first_object = first_node->getObject();
-
- //pick appropriate projection plane for snap rulers according to relative camera position
- if (mManipPart >= LL_X_ARROW && mManipPart <= LL_Z_ARROW)
- {
- LLVector3 normal;
- LLColor4 inner_color;
- LLManip::EManipPart temp_manip = mManipPart;
- switch (mManipPart)
- {
- case LL_X_ARROW:
- normal.setVec(1,0,0);
- inner_color.setVec(0,1,1,line_alpha);
- mManipPart = LL_YZ_PLANE;
- break;
- case LL_Y_ARROW:
- normal.setVec(0,1,0);
- inner_color.setVec(1,0,1,line_alpha);
- mManipPart = LL_XZ_PLANE;
- break;
- case LL_Z_ARROW:
- normal.setVec(0,0,1);
- inner_color.setVec(1,1,0,line_alpha);
- mManipPart = LL_XY_PLANE;
- break;
- default:
- break;
- }
-
- highlightIntersection(normal, selection_center, grid_rotation, inner_color);
- mManipPart = temp_manip;
- getManipAxis(first_object, mManipPart, translate_axis);
-
- LLVector3 at_axis_abs;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- at_axis_abs = LLVector3::x_axis * ~grid_rotation;
- }
- else
- {
- at_axis_abs = saved_selection_center - LLViewerCamera::getInstance()->getOrigin();
- at_axis_abs.normVec();
-
- at_axis_abs = at_axis_abs * ~grid_rotation;
- }
- at_axis_abs.abs();
-
- if (at_axis_abs.mV[VX] > at_axis_abs.mV[VY] && at_axis_abs.mV[VX] > at_axis_abs.mV[VZ])
- {
- if (mManipPart == LL_Y_ARROW)
- {
- mSnapOffsetAxis = LLVector3::z_axis;
- }
- else if (mManipPart == LL_Z_ARROW)
- {
- mSnapOffsetAxis = LLVector3::y_axis;
- }
- else if (at_axis_abs.mV[VY] > at_axis_abs.mV[VZ])
- {
- mSnapOffsetAxis = LLVector3::z_axis;
- }
- else
- {
- mSnapOffsetAxis = LLVector3::y_axis;
- }
- }
- else if (at_axis_abs.mV[VY] > at_axis_abs.mV[VZ])
- {
- if (mManipPart == LL_X_ARROW)
- {
- mSnapOffsetAxis = LLVector3::z_axis;
- }
- else if (mManipPart == LL_Z_ARROW)
- {
- mSnapOffsetAxis = LLVector3::x_axis;
- }
- else if (at_axis_abs.mV[VX] > at_axis_abs.mV[VZ])
- {
- mSnapOffsetAxis = LLVector3::z_axis;
- }
- else
- {
- mSnapOffsetAxis = LLVector3::x_axis;
- }
- }
- else
- {
- if (mManipPart == LL_X_ARROW)
- {
- mSnapOffsetAxis = LLVector3::y_axis;
- }
- else if (mManipPart == LL_Y_ARROW)
- {
- mSnapOffsetAxis = LLVector3::x_axis;
- }
- else if (at_axis_abs.mV[VX] > at_axis_abs.mV[VY])
- {
- mSnapOffsetAxis = LLVector3::y_axis;
- }
- else
- {
- mSnapOffsetAxis = LLVector3::x_axis;
- }
- }
-
- mSnapOffsetAxis = mSnapOffsetAxis * grid_rotation;
-
- F32 guide_size_meters;
-
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- guide_size_meters = 1.f / gAgentCamera.mHUDCurZoom;
- mSnapOffsetMeters = mArrowLengthMeters * 1.5f;
- }
- else
- {
- LLVector3 cam_to_selection = getPivotPoint() - LLViewerCamera::getInstance()->getOrigin();
- F32 current_range = cam_to_selection.normVec();
- guide_size_meters = SNAP_GUIDE_SCREEN_SIZE * gViewerWindow->getWorldViewHeightRaw() * current_range / LLViewerCamera::getInstance()->getPixelMeterRatio();
-
- F32 fraction_of_fov = mAxisArrowLength / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
- F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians
- F32 offset_at_camera = tan(apparent_angle) * 1.5f;
- F32 range = dist_vec(gAgent.getPosAgentFromGlobal(first_node->mSavedPositionGlobal), LLViewerCamera::getInstance()->getOrigin());
- mSnapOffsetMeters = range * offset_at_camera;
- }
-
- LLVector3 tick_start;
- LLVector3 tick_end;
-
- // how far away from grid origin is the selection along the axis of translation?
- F32 dist_grid_axis = (selection_center - mGridOrigin) * translate_axis;
- // find distance to nearest smallest grid unit
- F32 offset_nearest_grid_unit = fmodf(dist_grid_axis, smallest_grid_unit_scale);
- // how many smallest grid units are we away from largest grid scale?
- S32 sub_div_offset = ll_round(fmodf(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() / sGridMinSubdivisionLevel) / smallest_grid_unit_scale);
- S32 num_ticks_per_side = llmax(1, llfloor(0.5f * guide_size_meters / smallest_grid_unit_scale));
-
- LLGLDepthTest gls_depth(GL_FALSE);
-
- for (S32 pass = 0; pass < 3; pass++)
- {
- LLColor4 line_color = setupSnapGuideRenderPass(pass);
- LLGLDepthTest gls_depth(pass != 1);
-
- gGL.begin(LLRender::LINES);
- {
- LLVector3 line_start = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) + (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit));
- LLVector3 line_end = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) - (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit));
- LLVector3 line_mid = (line_start + line_end) * 0.5f;
-
- gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f);
- gGL.vertex3fv(line_start.mV);
- gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
- gGL.vertex3fv(line_mid.mV);
- gGL.vertex3fv(line_mid.mV);
- gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f);
- gGL.vertex3fv(line_end.mV);
-
- line_start.setVec(selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) + (translate_axis * guide_size_meters * 0.5f));
- line_end.setVec(selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) - (translate_axis * guide_size_meters * 0.5f));
- line_mid = (line_start + line_end) * 0.5f;
-
- gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f);
- gGL.vertex3fv(line_start.mV);
- gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
- gGL.vertex3fv(line_mid.mV);
- gGL.vertex3fv(line_mid.mV);
- gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f);
- gGL.vertex3fv(line_end.mV);
-
- for (S32 i = -num_ticks_per_side; i <= num_ticks_per_side; i++)
- {
- tick_start = selection_center + (translate_axis * (smallest_grid_unit_scale * (F32)i - offset_nearest_grid_unit));
-
- //No need check this condition to prevent tick position scaling (FIX MAINT-5207/5208)
- //F32 cur_subdivisions = getSubdivisionLevel(tick_start, translate_axis, getMinGridScale());
- /*if (fmodf((F32)(i + sub_div_offset), (max_subdivisions / cur_subdivisions)) != 0.f)
- {
- continue;
- }*/
-
- // add in off-axis offset
- tick_start += (mSnapOffsetAxis * mSnapOffsetMeters);
-
- F32 tick_scale = 1.f;
- for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
- {
- if (fmodf((F32)(i + sub_div_offset), division_level) == 0.f)
- {
- break;
- }
- tick_scale *= 0.7f;
- }
-
-// S32 num_ticks_to_fade = is_sub_tick ? num_ticks_per_side / 2 : num_ticks_per_side;
-// F32 alpha = line_alpha * (1.f - (0.8f * ((F32)llabs(i) / (F32)num_ticks_to_fade)));
-
- tick_end = tick_start + (mSnapOffsetAxis * mSnapOffsetMeters * tick_scale);
-
- gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
- gGL.vertex3fv(tick_start.mV);
- gGL.vertex3fv(tick_end.mV);
-
- tick_start = selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) +
- (translate_axis * (getMinGridScale() / (F32)(max_subdivisions) * (F32)i - offset_nearest_grid_unit));
- tick_end = tick_start - (mSnapOffsetAxis * mSnapOffsetMeters * tick_scale);
-
- gGL.vertex3fv(tick_start.mV);
- gGL.vertex3fv(tick_end.mV);
- }
- }
- gGL.end();
-
- if (mInSnapRegime)
- {
- LLVector3 line_start = selection_center - mSnapOffsetAxis * mSnapOffsetMeters;
- LLVector3 line_end = selection_center + mSnapOffsetAxis * mSnapOffsetMeters;
-
- gGL.begin(LLRender::LINES);
- {
- gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
-
- gGL.vertex3fv(line_start.mV);
- gGL.vertex3fv(line_end.mV);
- }
- gGL.end();
-
- // draw snap guide arrow
- gGL.begin(LLRender::TRIANGLES);
- {
- gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
-
- LLVector3 arrow_dir;
- LLVector3 arrow_span = translate_axis;
-
- arrow_dir = -mSnapOffsetAxis;
- gGL.vertex3fv((line_start + arrow_dir * mConeSize * SNAP_ARROW_SCALE).mV);
- gGL.vertex3fv((line_start + arrow_span * mConeSize * SNAP_ARROW_SCALE).mV);
- gGL.vertex3fv((line_start - arrow_span * mConeSize * SNAP_ARROW_SCALE).mV);
-
- arrow_dir = mSnapOffsetAxis;
- gGL.vertex3fv((line_end + arrow_dir * mConeSize * SNAP_ARROW_SCALE).mV);
- gGL.vertex3fv((line_end + arrow_span * mConeSize * SNAP_ARROW_SCALE).mV);
- gGL.vertex3fv((line_end - arrow_span * mConeSize * SNAP_ARROW_SCALE).mV);
- }
- gGL.end();
- }
- }
-
- sub_div_offset = ll_round(fmod(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() * 32.f) / smallest_grid_unit_scale);
-
- LLVector2 screen_translate_axis(llabs(translate_axis * LLViewerCamera::getInstance()->getLeftAxis()), llabs(translate_axis * LLViewerCamera::getInstance()->getUpAxis()));
- screen_translate_axis.normVec();
-
- S32 tick_label_spacing = ll_round(screen_translate_axis * sTickLabelSpacing);
-
- // render tickmark values
- for (S32 i = -num_ticks_per_side; i <= num_ticks_per_side; i++)
- {
- LLVector3 tick_pos = selection_center + (translate_axis * ((smallest_grid_unit_scale * (F32)i) - offset_nearest_grid_unit));
- F32 alpha = line_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side)));
-
- F32 tick_scale = 1.f;
- for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
- {
- if (fmodf((F32)(i + sub_div_offset), division_level) == 0.f)
- {
- break;
- }
- tick_scale *= 0.7f;
- }
-
- if (fmodf((F32)(i + sub_div_offset), (max_subdivisions / getSubdivisionLevel(tick_pos, translate_axis, getMinGridScale(), tick_label_spacing))) == 0.f)
- {
- F32 snap_offset_meters;
-
- if (mSnapOffsetAxis * LLViewerCamera::getInstance()->getUpAxis() > 0.f)
- {
- snap_offset_meters = mSnapOffsetMeters;
- }
- else
- {
- snap_offset_meters = -mSnapOffsetMeters;
- }
- LLVector3 text_origin = selection_center +
- (translate_axis * ((smallest_grid_unit_scale * (F32)i) - offset_nearest_grid_unit)) +
- (mSnapOffsetAxis * snap_offset_meters * (1.f + tick_scale));
-
- LLVector3 tick_offset = (tick_pos - mGridOrigin) * ~mGridRotation;
- F32 offset_val = 0.5f * tick_offset.mV[ARROW_TO_AXIS[mManipPart]] / getMinGridScale();
- EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode();
- F32 text_highlight = 0.8f;
- if(i - ll_round(offset_nearest_grid_unit / smallest_grid_unit_scale) == 0 && mInSnapRegime)
- {
- text_highlight = 1.f;
- }
-
- if (grid_mode == GRID_MODE_WORLD)
- {
- // rescale units to meters from multiple of grid scale
- offset_val *= 2.f * grid_scale[ARROW_TO_AXIS[mManipPart]];
- renderTickValue(text_origin, offset_val, std::string("m"), LLColor4(text_highlight, text_highlight, text_highlight, alpha));
- }
- else
- {
- renderTickValue(text_origin, offset_val, std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha));
- }
- }
- }
- if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
- {
- // render helpful text
- if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
- {
- F32 snap_offset_meters_up;
- if (mSnapOffsetAxis * LLViewerCamera::getInstance()->getUpAxis() > 0.f)
- {
- snap_offset_meters_up = mSnapOffsetMeters;
- }
- else
- {
- snap_offset_meters_up = -mSnapOffsetMeters;
- }
-
- LLVector3 selection_center_start = getSavedPivotPoint();//LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
-
- LLVector3 help_text_pos = selection_center_start + (snap_offset_meters_up * 3.f * mSnapOffsetAxis);
- const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
-
- std::string help_text = LLTrans::getString("manip_hint1");
- LLColor4 help_text_color = LLColor4::white;
- help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
- hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
- help_text = LLTrans::getString("manip_hint2");
- help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapOffsetMeters * 0.2f;
- hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
- }
- }
- }
- else
- {
- // render gridlines for planar snapping
-
- F32 u = 0, v = 0;
+ if (!gSavedSettings.getBOOL("SnapEnabled"))
+ {
+ return;
+ }
+
+ F32 max_subdivisions = sGridMaxSubdivisionLevel;//(F32)gSavedSettings.getS32("GridSubdivision");
+ F32 line_alpha = gSavedSettings.getF32("GridOpacity");
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest gls_depth(GL_TRUE);
+ LLGLDisable gls_cull(GL_CULL_FACE);
+ LLVector3 translate_axis;
+
+ if (mManipPart == LL_NO_PART)
+ {
+ return;
+ }
+
+ LLSelectNode *first_node = mObjectSelection->getFirstMoveableNode(TRUE);
+ if (!first_node)
+ {
+ return;
+ }
+
+ updateGridSettings();
+
+ F32 smallest_grid_unit_scale = getMinGridScale() / max_subdivisions;
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+ LLVector3 saved_selection_center = getSavedPivotPoint(); //LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
+ LLVector3 selection_center = getPivotPoint();
+
+ LLViewerObject *first_object = first_node->getObject();
+
+ //pick appropriate projection plane for snap rulers according to relative camera position
+ if (mManipPart >= LL_X_ARROW && mManipPart <= LL_Z_ARROW)
+ {
+ LLVector3 normal;
+ LLColor4 inner_color;
+ LLManip::EManipPart temp_manip = mManipPart;
+ switch (mManipPart)
+ {
+ case LL_X_ARROW:
+ normal.setVec(1,0,0);
+ inner_color.setVec(0,1,1,line_alpha);
+ mManipPart = LL_YZ_PLANE;
+ break;
+ case LL_Y_ARROW:
+ normal.setVec(0,1,0);
+ inner_color.setVec(1,0,1,line_alpha);
+ mManipPart = LL_XZ_PLANE;
+ break;
+ case LL_Z_ARROW:
+ normal.setVec(0,0,1);
+ inner_color.setVec(1,1,0,line_alpha);
+ mManipPart = LL_XY_PLANE;
+ break;
+ default:
+ break;
+ }
+
+ highlightIntersection(normal, selection_center, grid_rotation, inner_color);
+ mManipPart = temp_manip;
+ getManipAxis(first_object, mManipPart, translate_axis);
+
+ LLVector3 at_axis_abs;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ at_axis_abs = LLVector3::x_axis * ~grid_rotation;
+ }
+ else
+ {
+ at_axis_abs = saved_selection_center - LLViewerCamera::getInstance()->getOrigin();
+ at_axis_abs.normVec();
+
+ at_axis_abs = at_axis_abs * ~grid_rotation;
+ }
+ at_axis_abs.abs();
+
+ if (at_axis_abs.mV[VX] > at_axis_abs.mV[VY] && at_axis_abs.mV[VX] > at_axis_abs.mV[VZ])
+ {
+ if (mManipPart == LL_Y_ARROW)
+ {
+ mSnapOffsetAxis = LLVector3::z_axis;
+ }
+ else if (mManipPart == LL_Z_ARROW)
+ {
+ mSnapOffsetAxis = LLVector3::y_axis;
+ }
+ else if (at_axis_abs.mV[VY] > at_axis_abs.mV[VZ])
+ {
+ mSnapOffsetAxis = LLVector3::z_axis;
+ }
+ else
+ {
+ mSnapOffsetAxis = LLVector3::y_axis;
+ }
+ }
+ else if (at_axis_abs.mV[VY] > at_axis_abs.mV[VZ])
+ {
+ if (mManipPart == LL_X_ARROW)
+ {
+ mSnapOffsetAxis = LLVector3::z_axis;
+ }
+ else if (mManipPart == LL_Z_ARROW)
+ {
+ mSnapOffsetAxis = LLVector3::x_axis;
+ }
+ else if (at_axis_abs.mV[VX] > at_axis_abs.mV[VZ])
+ {
+ mSnapOffsetAxis = LLVector3::z_axis;
+ }
+ else
+ {
+ mSnapOffsetAxis = LLVector3::x_axis;
+ }
+ }
+ else
+ {
+ if (mManipPart == LL_X_ARROW)
+ {
+ mSnapOffsetAxis = LLVector3::y_axis;
+ }
+ else if (mManipPart == LL_Y_ARROW)
+ {
+ mSnapOffsetAxis = LLVector3::x_axis;
+ }
+ else if (at_axis_abs.mV[VX] > at_axis_abs.mV[VY])
+ {
+ mSnapOffsetAxis = LLVector3::y_axis;
+ }
+ else
+ {
+ mSnapOffsetAxis = LLVector3::x_axis;
+ }
+ }
+
+ mSnapOffsetAxis = mSnapOffsetAxis * grid_rotation;
+
+ F32 guide_size_meters;
+
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ guide_size_meters = 1.f / gAgentCamera.mHUDCurZoom;
+ mSnapOffsetMeters = mArrowLengthMeters * 1.5f;
+ }
+ else
+ {
+ LLVector3 cam_to_selection = getPivotPoint() - LLViewerCamera::getInstance()->getOrigin();
+ F32 current_range = cam_to_selection.normVec();
+ guide_size_meters = SNAP_GUIDE_SCREEN_SIZE * gViewerWindow->getWorldViewHeightRaw() * current_range / LLViewerCamera::getInstance()->getPixelMeterRatio();
+
+ F32 fraction_of_fov = mAxisArrowLength / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
+ F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians
+ F32 offset_at_camera = tan(apparent_angle) * 1.5f;
+ F32 range = dist_vec(gAgent.getPosAgentFromGlobal(first_node->mSavedPositionGlobal), LLViewerCamera::getInstance()->getOrigin());
+ mSnapOffsetMeters = range * offset_at_camera;
+ }
+
+ LLVector3 tick_start;
+ LLVector3 tick_end;
+
+ // how far away from grid origin is the selection along the axis of translation?
+ F32 dist_grid_axis = (selection_center - mGridOrigin) * translate_axis;
+ // find distance to nearest smallest grid unit
+ F32 offset_nearest_grid_unit = fmodf(dist_grid_axis, smallest_grid_unit_scale);
+ // how many smallest grid units are we away from largest grid scale?
+ S32 sub_div_offset = ll_round(fmodf(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() / sGridMinSubdivisionLevel) / smallest_grid_unit_scale);
+ S32 num_ticks_per_side = llmax(1, llfloor(0.5f * guide_size_meters / smallest_grid_unit_scale));
+
+ LLGLDepthTest gls_depth(GL_FALSE);
+
+ for (S32 pass = 0; pass < 3; pass++)
+ {
+ LLColor4 line_color = setupSnapGuideRenderPass(pass);
+ LLGLDepthTest gls_depth(pass != 1);
+
+ gGL.begin(LLRender::LINES);
+ {
+ LLVector3 line_start = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) + (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit));
+ LLVector3 line_end = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) - (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit));
+ LLVector3 line_mid = (line_start + line_end) * 0.5f;
+
+ gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f);
+ gGL.vertex3fv(line_start.mV);
+ gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
+ gGL.vertex3fv(line_mid.mV);
+ gGL.vertex3fv(line_mid.mV);
+ gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f);
+ gGL.vertex3fv(line_end.mV);
+
+ line_start.setVec(selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) + (translate_axis * guide_size_meters * 0.5f));
+ line_end.setVec(selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) - (translate_axis * guide_size_meters * 0.5f));
+ line_mid = (line_start + line_end) * 0.5f;
+
+ gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f);
+ gGL.vertex3fv(line_start.mV);
+ gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
+ gGL.vertex3fv(line_mid.mV);
+ gGL.vertex3fv(line_mid.mV);
+ gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f);
+ gGL.vertex3fv(line_end.mV);
+
+ for (S32 i = -num_ticks_per_side; i <= num_ticks_per_side; i++)
+ {
+ tick_start = selection_center + (translate_axis * (smallest_grid_unit_scale * (F32)i - offset_nearest_grid_unit));
+
+ //No need check this condition to prevent tick position scaling (FIX MAINT-5207/5208)
+ //F32 cur_subdivisions = getSubdivisionLevel(tick_start, translate_axis, getMinGridScale());
+ /*if (fmodf((F32)(i + sub_div_offset), (max_subdivisions / cur_subdivisions)) != 0.f)
+ {
+ continue;
+ }*/
+
+ // add in off-axis offset
+ tick_start += (mSnapOffsetAxis * mSnapOffsetMeters);
+
+ F32 tick_scale = 1.f;
+ for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ {
+ if (fmodf((F32)(i + sub_div_offset), division_level) == 0.f)
+ {
+ break;
+ }
+ tick_scale *= 0.7f;
+ }
+
+// S32 num_ticks_to_fade = is_sub_tick ? num_ticks_per_side / 2 : num_ticks_per_side;
+// F32 alpha = line_alpha * (1.f - (0.8f * ((F32)llabs(i) / (F32)num_ticks_to_fade)));
+
+ tick_end = tick_start + (mSnapOffsetAxis * mSnapOffsetMeters * tick_scale);
+
+ gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
+ gGL.vertex3fv(tick_start.mV);
+ gGL.vertex3fv(tick_end.mV);
+
+ tick_start = selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) +
+ (translate_axis * (getMinGridScale() / (F32)(max_subdivisions) * (F32)i - offset_nearest_grid_unit));
+ tick_end = tick_start - (mSnapOffsetAxis * mSnapOffsetMeters * tick_scale);
+
+ gGL.vertex3fv(tick_start.mV);
+ gGL.vertex3fv(tick_end.mV);
+ }
+ }
+ gGL.end();
+
+ if (mInSnapRegime)
+ {
+ LLVector3 line_start = selection_center - mSnapOffsetAxis * mSnapOffsetMeters;
+ LLVector3 line_end = selection_center + mSnapOffsetAxis * mSnapOffsetMeters;
+
+ gGL.begin(LLRender::LINES);
+ {
+ gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
+
+ gGL.vertex3fv(line_start.mV);
+ gGL.vertex3fv(line_end.mV);
+ }
+ gGL.end();
+
+ // draw snap guide arrow
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]);
+
+ LLVector3 arrow_dir;
+ LLVector3 arrow_span = translate_axis;
+
+ arrow_dir = -mSnapOffsetAxis;
+ gGL.vertex3fv((line_start + arrow_dir * mConeSize * SNAP_ARROW_SCALE).mV);
+ gGL.vertex3fv((line_start + arrow_span * mConeSize * SNAP_ARROW_SCALE).mV);
+ gGL.vertex3fv((line_start - arrow_span * mConeSize * SNAP_ARROW_SCALE).mV);
+
+ arrow_dir = mSnapOffsetAxis;
+ gGL.vertex3fv((line_end + arrow_dir * mConeSize * SNAP_ARROW_SCALE).mV);
+ gGL.vertex3fv((line_end + arrow_span * mConeSize * SNAP_ARROW_SCALE).mV);
+ gGL.vertex3fv((line_end - arrow_span * mConeSize * SNAP_ARROW_SCALE).mV);
+ }
+ gGL.end();
+ }
+ }
+
+ sub_div_offset = ll_round(fmod(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() * 32.f) / smallest_grid_unit_scale);
+
+ LLVector2 screen_translate_axis(llabs(translate_axis * LLViewerCamera::getInstance()->getLeftAxis()), llabs(translate_axis * LLViewerCamera::getInstance()->getUpAxis()));
+ screen_translate_axis.normVec();
+
+ S32 tick_label_spacing = ll_round(screen_translate_axis * sTickLabelSpacing);
+
+ // render tickmark values
+ for (S32 i = -num_ticks_per_side; i <= num_ticks_per_side; i++)
+ {
+ LLVector3 tick_pos = selection_center + (translate_axis * ((smallest_grid_unit_scale * (F32)i) - offset_nearest_grid_unit));
+ F32 alpha = line_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side)));
+
+ F32 tick_scale = 1.f;
+ for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ {
+ if (fmodf((F32)(i + sub_div_offset), division_level) == 0.f)
+ {
+ break;
+ }
+ tick_scale *= 0.7f;
+ }
+
+ if (fmodf((F32)(i + sub_div_offset), (max_subdivisions / getSubdivisionLevel(tick_pos, translate_axis, getMinGridScale(), tick_label_spacing))) == 0.f)
+ {
+ F32 snap_offset_meters;
+
+ if (mSnapOffsetAxis * LLViewerCamera::getInstance()->getUpAxis() > 0.f)
+ {
+ snap_offset_meters = mSnapOffsetMeters;
+ }
+ else
+ {
+ snap_offset_meters = -mSnapOffsetMeters;
+ }
+ LLVector3 text_origin = selection_center +
+ (translate_axis * ((smallest_grid_unit_scale * (F32)i) - offset_nearest_grid_unit)) +
+ (mSnapOffsetAxis * snap_offset_meters * (1.f + tick_scale));
+
+ LLVector3 tick_offset = (tick_pos - mGridOrigin) * ~mGridRotation;
+ F32 offset_val = 0.5f * tick_offset.mV[ARROW_TO_AXIS[mManipPart]] / getMinGridScale();
+ EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode();
+ F32 text_highlight = 0.8f;
+ if(i - ll_round(offset_nearest_grid_unit / smallest_grid_unit_scale) == 0 && mInSnapRegime)
+ {
+ text_highlight = 1.f;
+ }
+
+ if (grid_mode == GRID_MODE_WORLD)
+ {
+ // rescale units to meters from multiple of grid scale
+ offset_val *= 2.f * grid_scale[ARROW_TO_AXIS[mManipPart]];
+ renderTickValue(text_origin, offset_val, std::string("m"), LLColor4(text_highlight, text_highlight, text_highlight, alpha));
+ }
+ else
+ {
+ renderTickValue(text_origin, offset_val, std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha));
+ }
+ }
+ }
+ if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
+ {
+ // render helpful text
+ if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
+ {
+ F32 snap_offset_meters_up;
+ if (mSnapOffsetAxis * LLViewerCamera::getInstance()->getUpAxis() > 0.f)
+ {
+ snap_offset_meters_up = mSnapOffsetMeters;
+ }
+ else
+ {
+ snap_offset_meters_up = -mSnapOffsetMeters;
+ }
+
+ LLVector3 selection_center_start = getSavedPivotPoint();//LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
+
+ LLVector3 help_text_pos = selection_center_start + (snap_offset_meters_up * 3.f * mSnapOffsetAxis);
+ const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
+
+ std::string help_text = LLTrans::getString("manip_hint1");
+ LLColor4 help_text_color = LLColor4::white;
+ help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
+ hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
+ help_text = LLTrans::getString("manip_hint2");
+ help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapOffsetMeters * 0.2f;
+ hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
+ }
+ }
+ }
+ else
+ {
+ // render gridlines for planar snapping
+
+ F32 u = 0, v = 0;
LLColor4 inner_color;
- LLVector3 normal;
- LLVector3 grid_center = selection_center - grid_origin;
- F32 usc = 1;
- F32 vsc = 1;
-
- grid_center *= ~grid_rotation;
-
- switch (mManipPart)
- {
- case LL_YZ_PLANE:
- u = grid_center.mV[VY];
- v = grid_center.mV[VZ];
- usc = grid_scale.mV[VY];
- vsc = grid_scale.mV[VZ];
- inner_color.setVec(0,1,1,line_alpha);
- normal.setVec(1,0,0);
- break;
- case LL_XZ_PLANE:
- u = grid_center.mV[VX];
- v = grid_center.mV[VZ];
- usc = grid_scale.mV[VX];
- vsc = grid_scale.mV[VZ];
- inner_color.setVec(1,0,1,line_alpha);
- normal.setVec(0,1,0);
- break;
- case LL_XY_PLANE:
- u = grid_center.mV[VX];
- v = grid_center.mV[VY];
- usc = grid_scale.mV[VX];
- vsc = grid_scale.mV[VY];
- inner_color.setVec(1,1,0,line_alpha);
- normal.setVec(0,0,1);
- break;
- default:
- break;
- }
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- highlightIntersection(normal, selection_center, grid_rotation, inner_color);
-
- gGL.pushMatrix();
-
- F32 x,y,z,angle_radians;
- grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
- gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
- gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
-
- F32 sz = mGridSizeMeters;
- F32 tiles = sz;
-
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.pushMatrix();
- usc = 1.0f/usc;
- vsc = 1.0f/vsc;
-
- while (usc > vsc*4.0f)
- {
- usc *= 0.5f;
- }
- while (vsc > usc * 4.0f)
- {
- vsc *= 0.5f;
- }
-
- gGL.scalef(usc, vsc, 1.0f);
- gGL.translatef(u, v, 0);
-
- float a = line_alpha;
-
- {
- //draw grid behind objects
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
-
- {
- //LLGLDisable stencil(GL_STENCIL_TEST);
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER);
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getGridTexName());
- gGL.flush();
- gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
- renderGrid(u,v,tiles,0.9f, 0.9f, 0.9f,a*0.15f);
- gGL.flush();
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
- }
-
- {
- //draw black overlay
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- renderGrid(u,v,tiles,0.0f, 0.0f, 0.0f,a*0.16f);
-
- //draw grid top
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getGridTexName());
- renderGrid(u,v,tiles,1,1,1,a);
-
- gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
- }
-
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- renderGuidelines();
- }
-
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER);
- gGL.flush();
-
- switch (mManipPart)
- {
- case LL_YZ_PLANE:
- renderGuidelines(FALSE, TRUE, TRUE);
- break;
- case LL_XZ_PLANE:
- renderGuidelines(TRUE, FALSE, TRUE);
- break;
- case LL_XY_PLANE:
- renderGuidelines(TRUE, TRUE, FALSE);
- break;
- default:
- break;
- }
- gGL.flush();
- }
- }
- }
- }
+ LLVector3 normal;
+ LLVector3 grid_center = selection_center - grid_origin;
+ F32 usc = 1;
+ F32 vsc = 1;
+
+ grid_center *= ~grid_rotation;
+
+ switch (mManipPart)
+ {
+ case LL_YZ_PLANE:
+ u = grid_center.mV[VY];
+ v = grid_center.mV[VZ];
+ usc = grid_scale.mV[VY];
+ vsc = grid_scale.mV[VZ];
+ inner_color.setVec(0,1,1,line_alpha);
+ normal.setVec(1,0,0);
+ break;
+ case LL_XZ_PLANE:
+ u = grid_center.mV[VX];
+ v = grid_center.mV[VZ];
+ usc = grid_scale.mV[VX];
+ vsc = grid_scale.mV[VZ];
+ inner_color.setVec(1,0,1,line_alpha);
+ normal.setVec(0,1,0);
+ break;
+ case LL_XY_PLANE:
+ u = grid_center.mV[VX];
+ v = grid_center.mV[VY];
+ usc = grid_scale.mV[VX];
+ vsc = grid_scale.mV[VY];
+ inner_color.setVec(1,1,0,line_alpha);
+ normal.setVec(0,0,1);
+ break;
+ default:
+ break;
+ }
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ highlightIntersection(normal, selection_center, grid_rotation, inner_color);
+
+ gGL.pushMatrix();
+
+ F32 x,y,z,angle_radians;
+ grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
+ gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
+
+ F32 sz = mGridSizeMeters;
+ F32 tiles = sz;
+
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.pushMatrix();
+ usc = 1.0f/usc;
+ vsc = 1.0f/vsc;
+
+ while (usc > vsc*4.0f)
+ {
+ usc *= 0.5f;
+ }
+ while (vsc > usc * 4.0f)
+ {
+ vsc *= 0.5f;
+ }
+
+ gGL.scalef(usc, vsc, 1.0f);
+ gGL.translatef(u, v, 0);
+
+ float a = line_alpha;
+
+ {
+ //draw grid behind objects
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+
+ {
+ //LLGLDisable stencil(GL_STENCIL_TEST);
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER);
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getGridTexName());
+ gGL.flush();
+ gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
+ renderGrid(u,v,tiles,0.9f, 0.9f, 0.9f,a*0.15f);
+ gGL.flush();
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ }
+
+ {
+ //draw black overlay
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ renderGrid(u,v,tiles,0.0f, 0.0f, 0.0f,a*0.16f);
+
+ //draw grid top
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getGridTexName());
+ renderGrid(u,v,tiles,1,1,1,a);
+
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+ }
+
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ renderGuidelines();
+ }
+
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER);
+ gGL.flush();
+
+ switch (mManipPart)
+ {
+ case LL_YZ_PLANE:
+ renderGuidelines(FALSE, TRUE, TRUE);
+ break;
+ case LL_XZ_PLANE:
+ renderGuidelines(TRUE, FALSE, TRUE);
+ break;
+ case LL_XY_PLANE:
+ renderGuidelines(TRUE, TRUE, FALSE);
+ break;
+ default:
+ break;
+ }
+ gGL.flush();
+ }
+ }
+ }
+ }
}
void LLManipTranslate::renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F32 a)
{
- F32 d = size*0.5f;
-
- for (F32 xx = -size-d; xx < size+d; xx += d)
- {
- gGL.begin(LLRender::TRIANGLE_STRIP);
- for (F32 yy = -size-d; yy < size+d; yy += d)
- {
- float dx, dy, da;
-
- dx = xx; dy = yy;
- da = sqrtf(llmax(0.0f, 1.0f-sqrtf(dx*dx+dy*dy)/size))*a;
- gGL.texCoord2f(dx, dy);
- renderGridVert(dx,dy,r,g,b,da);
-
- dx = xx+d; dy = yy;
- da = sqrtf(llmax(0.0f, 1.0f-sqrtf(dx*dx+dy*dy)/size))*a;
- gGL.texCoord2f(dx, dy);
- renderGridVert(dx,dy,r,g,b,da);
-
- dx = xx; dy = yy+d;
- da = sqrtf(llmax(0.0f, 1.0f-sqrtf(dx*dx+dy*dy)/size))*a;
- gGL.texCoord2f(dx, dy);
- renderGridVert(dx,dy,r,g,b,da);
-
- dx = xx+d; dy = yy+d;
- da = sqrtf(llmax(0.0f, 1.0f-sqrtf(dx*dx+dy*dy)/size))*a;
- gGL.texCoord2f(dx, dy);
- renderGridVert(dx,dy,r,g,b,da);
- }
- gGL.end();
- }
-
-
+ F32 d = size*0.5f;
+
+ for (F32 xx = -size-d; xx < size+d; xx += d)
+ {
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ for (F32 yy = -size-d; yy < size+d; yy += d)
+ {
+ float dx, dy, da;
+
+ dx = xx; dy = yy;
+ da = sqrtf(llmax(0.0f, 1.0f-sqrtf(dx*dx+dy*dy)/size))*a;
+ gGL.texCoord2f(dx, dy);
+ renderGridVert(dx,dy,r,g,b,da);
+
+ dx = xx+d; dy = yy;
+ da = sqrtf(llmax(0.0f, 1.0f-sqrtf(dx*dx+dy*dy)/size))*a;
+ gGL.texCoord2f(dx, dy);
+ renderGridVert(dx,dy,r,g,b,da);
+
+ dx = xx; dy = yy+d;
+ da = sqrtf(llmax(0.0f, 1.0f-sqrtf(dx*dx+dy*dy)/size))*a;
+ gGL.texCoord2f(dx, dy);
+ renderGridVert(dx,dy,r,g,b,da);
+
+ dx = xx+d; dy = yy+d;
+ da = sqrtf(llmax(0.0f, 1.0f-sqrtf(dx*dx+dy*dy)/size))*a;
+ gGL.texCoord2f(dx, dy);
+ renderGridVert(dx,dy,r,g,b,da);
+ }
+ gGL.end();
+ }
+
+
}
-void LLManipTranslate::highlightIntersection(LLVector3 normal,
- LLVector3 selection_center,
- LLQuaternion grid_rotation,
- LLColor4 inner_color)
+void LLManipTranslate::highlightIntersection(LLVector3 normal,
+ LLVector3 selection_center,
+ LLQuaternion grid_rotation,
+ LLColor4 inner_color)
{
#if 0 // DEPRECATED
- if (!gSavedSettings.getBOOL("GridCrossSections"))
- {
- return;
- }
-
-
- LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
-
-
- static const U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_ALPHA, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY };
- static const U32 num_types = LL_ARRAY_SIZE(types);
-
- GLuint stencil_mask = 0xFFFFFFFF;
- //stencil in volumes
-
- gGL.flush();
-
- if (shader)
- {
- gClipProgram.bind();
- }
-
- {
- //glStencilMask(stencil_mask); //deprecated
- //glClearStencil(1);
- //glClear(GL_STENCIL_BUFFER_BIT);
- LLGLEnable cull_face(GL_CULL_FACE);
- //LLGLEnable stencil(GL_STENCIL_TEST);
- LLGLDepthTest depth (GL_TRUE, GL_FALSE, GL_ALWAYS);
- //glStencilFunc(GL_ALWAYS, 0, stencil_mask);
- gGL.setColorMask(false, false);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- gGL.diffuseColor4f(1,1,1,1);
-
- //setup clip plane
- normal = normal * grid_rotation;
- if (normal * (LLViewerCamera::getInstance()->getOrigin()-selection_center) < 0)
- {
- normal = -normal;
- }
- F32 d = -(selection_center * normal);
- glh::vec4f plane(normal.mV[0], normal.mV[1], normal.mV[2], d );
-
- gGL.getModelviewMatrix().inverse().mult_vec_matrix(plane);
-
- static LLStaticHashedString sClipPlane("clip_plane");
- gClipProgram.uniform4fv(sClipPlane, 1, plane.v);
-
- BOOL particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
- BOOL clouds = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
-
- if (particles)
- {
- LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
- }
- if (clouds)
- {
- LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
- }
-
- //stencil in volumes
- //glStencilOp(GL_INCR, GL_INCR, GL_INCR);
- glCullFace(GL_FRONT);
- for (U32 i = 0; i < num_types; i++)
- {
- gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
- }
-
- //glStencilOp(GL_DECR, GL_DECR, GL_DECR);
- glCullFace(GL_BACK);
- for (U32 i = 0; i < num_types; i++)
- {
- gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
- }
-
- if (particles)
- {
- LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
- }
- if (clouds)
- {
- LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
- }
-
- gGL.setColorMask(true, false);
- }
- gGL.color4f(1,1,1,1);
-
- gGL.pushMatrix();
-
- F32 x,y,z,angle_radians;
- grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
- gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
- gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
-
- F32 sz = mGridSizeMeters;
- F32 tiles = sz;
-
- if (shader)
- {
- shader->bind();
- }
-
- if (shader)
- {
- shader->bind();
- }
-
- //draw volume/plane intersections
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest depth(GL_FALSE);
- //LLGLEnable stencil(GL_STENCIL_TEST);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- glStencilFunc(GL_EQUAL, 0, stencil_mask);
- renderGrid(0,0,tiles,inner_color.mV[0], inner_color.mV[1], inner_color.mV[2], 0.25f);
- }
-
- glStencilFunc(GL_ALWAYS, 255, 0xFFFFFFFF);
- glStencilMask(0xFFFFFFFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
-
- gGL.popMatrix();
+ if (!gSavedSettings.getBOOL("GridCrossSections"))
+ {
+ return;
+ }
+
+
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+
+ static const U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_ALPHA, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY };
+ static const U32 num_types = LL_ARRAY_SIZE(types);
+
+ GLuint stencil_mask = 0xFFFFFFFF;
+ //stencil in volumes
+
+ gGL.flush();
+
+ if (shader)
+ {
+ gClipProgram.bind();
+ }
+
+ {
+ //glStencilMask(stencil_mask); //deprecated
+ //glClearStencil(1);
+ //glClear(GL_STENCIL_BUFFER_BIT);
+ LLGLEnable cull_face(GL_CULL_FACE);
+ //LLGLEnable stencil(GL_STENCIL_TEST);
+ LLGLDepthTest depth (GL_TRUE, GL_FALSE, GL_ALWAYS);
+ //glStencilFunc(GL_ALWAYS, 0, stencil_mask);
+ gGL.setColorMask(false, false);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ gGL.diffuseColor4f(1,1,1,1);
+
+ //setup clip plane
+ normal = normal * grid_rotation;
+ if (normal * (LLViewerCamera::getInstance()->getOrigin()-selection_center) < 0)
+ {
+ normal = -normal;
+ }
+ F32 d = -(selection_center * normal);
+ glh::vec4f plane(normal.mV[0], normal.mV[1], normal.mV[2], d );
+
+ gGL.getModelviewMatrix().inverse().mult_vec_matrix(plane);
+
+ static LLStaticHashedString sClipPlane("clip_plane");
+ gClipProgram.uniform4fv(sClipPlane, 1, plane.v);
+
+ BOOL particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
+ BOOL clouds = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
+
+ if (particles)
+ {
+ LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
+ }
+ if (clouds)
+ {
+ LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
+ }
+
+ //stencil in volumes
+ //glStencilOp(GL_INCR, GL_INCR, GL_INCR);
+ glCullFace(GL_FRONT);
+ for (U32 i = 0; i < num_types; i++)
+ {
+ gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
+ }
+
+ //glStencilOp(GL_DECR, GL_DECR, GL_DECR);
+ glCullFace(GL_BACK);
+ for (U32 i = 0; i < num_types; i++)
+ {
+ gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
+ }
+
+ if (particles)
+ {
+ LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
+ }
+ if (clouds)
+ {
+ LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
+ }
+
+ gGL.setColorMask(true, false);
+ }
+ gGL.color4f(1,1,1,1);
+
+ gGL.pushMatrix();
+
+ F32 x,y,z,angle_radians;
+ grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
+ gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
+
+ F32 sz = mGridSizeMeters;
+ F32 tiles = sz;
+
+ if (shader)
+ {
+ shader->bind();
+ }
+
+ if (shader)
+ {
+ shader->bind();
+ }
+
+ //draw volume/plane intersections
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest depth(GL_FALSE);
+ //LLGLEnable stencil(GL_STENCIL_TEST);
+ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+ glStencilFunc(GL_EQUAL, 0, stencil_mask);
+ renderGrid(0,0,tiles,inner_color.mV[0], inner_color.mV[1], inner_color.mV[2], 0.25f);
+ }
+
+ glStencilFunc(GL_ALWAYS, 255, 0xFFFFFFFF);
+ glStencilMask(0xFFFFFFFF);
+ glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+
+ gGL.popMatrix();
#endif
}
void LLManipTranslate::renderText()
{
- if (mObjectSelection->getRootObjectCount() && !mObjectSelection->isAttachment())
- {
- LLVector3 pos = getPivotPoint();
- renderXYZ(pos);
- }
- else
- {
- const BOOL children_ok = TRUE;
- LLViewerObject* objectp = mObjectSelection->getFirstRootObject(children_ok);
- if (objectp)
- {
- renderXYZ(objectp->getPositionEdit());
- }
- }
+ if (mObjectSelection->getRootObjectCount() && !mObjectSelection->isAttachment())
+ {
+ LLVector3 pos = getPivotPoint();
+ renderXYZ(pos);
+ }
+ else
+ {
+ const BOOL children_ok = TRUE;
+ LLViewerObject* objectp = mObjectSelection->getFirstRootObject(children_ok);
+ if (objectp)
+ {
+ renderXYZ(objectp->getPositionEdit());
+ }
+ }
}
void LLManipTranslate::renderTranslationHandles()
{
- LLVector3 grid_origin;
- LLVector3 grid_scale;
- LLQuaternion grid_rotation;
- LLGLDepthTest gls_depth(GL_FALSE);
-
- LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
- LLVector3 at_axis;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- at_axis = LLVector3::x_axis * ~grid_rotation;
- }
- else
- {
- at_axis = LLViewerCamera::getInstance()->getAtAxis() * ~grid_rotation;
- }
-
- if (at_axis.mV[VX] > 0.f)
- {
- mPlaneManipPositions.mV[VX] = 1.f;
- }
- else
- {
- mPlaneManipPositions.mV[VX] = -1.f;
- }
-
- if (at_axis.mV[VY] > 0.f)
- {
- mPlaneManipPositions.mV[VY] = 1.f;
- }
- else
- {
- mPlaneManipPositions.mV[VY] = -1.f;
- }
-
- if (at_axis.mV[VZ] > 0.f)
- {
- mPlaneManipPositions.mV[VZ] = 1.f;
- }
- else
- {
- mPlaneManipPositions.mV[VZ] = -1.f;
- }
-
- LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE);
- if (!first_object) return;
-
- LLVector3 selection_center = getPivotPoint();
-
- // Drag handles
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWorldViewHeightRaw();
- mArrowLengthMeters /= gAgentCamera.mHUDCurZoom;
- }
- else
- {
- LLVector3 camera_pos_agent = gAgentCamera.getCameraPositionAgent();
- F32 range = dist_vec(camera_pos_agent, selection_center);
- F32 range_from_agent = dist_vec(gAgent.getPositionAgent(), selection_center);
-
- // Don't draw handles if you're too far away
- if (gSavedSettings.getBOOL("LimitSelectDistance"))
- {
- if (range_from_agent > gSavedSettings.getF32("MaxSelectDistance"))
- {
- return;
- }
- }
-
- if (range > 0.001f)
- {
- // range != zero
- F32 fraction_of_fov = mAxisArrowLength / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
- F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians
- mArrowLengthMeters = range * tan(apparent_angle);
- }
- else
- {
- // range == zero
- mArrowLengthMeters = 1.0f;
- }
- }
- //Assume that UI scale factor is equivalent for X and Y axis
- F32 ui_scale_factor = LLUI::getScaleFactor().mV[VX];
- mArrowLengthMeters *= ui_scale_factor;
-
- mPlaneManipOffsetMeters = mArrowLengthMeters * 1.8f;
- mGridSizeMeters = gSavedSettings.getF32("GridDrawSize");
- mConeSize = mArrowLengthMeters / 4.f;
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- {
- gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
-
- F32 angle_radians, x, y, z;
- grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
-
- gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
-
- LLQuaternion invRotation = grid_rotation;
- invRotation.conjQuat();
-
- LLVector3 relative_camera_dir;
-
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- relative_camera_dir = LLVector3::x_axis * invRotation;
- }
- else
- {
- relative_camera_dir = (selection_center - LLViewerCamera::getInstance()->getOrigin()) * invRotation;
- }
- relative_camera_dir.normVec();
-
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDisable cull_face(GL_CULL_FACE);
-
- LLColor4 color1;
- LLColor4 color2;
-
- // update manipulator sizes
- for (S32 index = 0; index < 3; index++)
- {
- if (index == mManipPart - LL_X_ARROW || index == mHighlightedPart - LL_X_ARROW)
- {
- mArrowScales.mV[index] = lerp(mArrowScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
- mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
- }
- else if (index == mManipPart - LL_YZ_PLANE || index == mHighlightedPart - LL_YZ_PLANE)
- {
- mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
- mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
- }
- else
- {
- mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
- mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
- }
- }
-
- if ((mManipPart == LL_NO_PART || mManipPart == LL_YZ_PLANE) && llabs(relative_camera_dir.mV[VX]) > MIN_PLANE_MANIP_DOT_PRODUCT)
- {
- // render YZ plane manipulator
- gGL.pushMatrix();
- gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
- gGL.translatef(0.f, mPlaneManipOffsetMeters, mPlaneManipOffsetMeters);
- gGL.scalef(mPlaneScales.mV[VX], mPlaneScales.mV[VX], mPlaneScales.mV[VX]);
- if (mHighlightedPart == LL_YZ_PLANE)
- {
- color1.setVec(0.f, 1.f, 0.f, 1.f);
- color2.setVec(0.f, 0.f, 1.f, 1.f);
- }
- else
- {
- color1.setVec(0.f, 1.f, 0.f, 0.6f);
- color2.setVec(0.f, 0.f, 1.f, 0.6f);
- }
- gGL.begin(LLRender::TRIANGLES);
- {
- gGL.color4fv(color1.mV);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f));
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f));
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
-
- gGL.color4fv(color2.mV);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f));
- }
- gGL.end();
-
- LLUI::setLineWidth(3.0f);
- gGL.begin(LLRender::LINES);
- {
- gGL.color4f(0.f, 0.f, 0.f, 0.3f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.1f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.4f);
-
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.1f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.4f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f);
- }
- gGL.end();
- LLUI::setLineWidth(1.0f);
- gGL.popMatrix();
- }
-
- if ((mManipPart == LL_NO_PART || mManipPart == LL_XZ_PLANE) && llabs(relative_camera_dir.mV[VY]) > MIN_PLANE_MANIP_DOT_PRODUCT)
- {
- // render XZ plane manipulator
- gGL.pushMatrix();
- gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
- gGL.translatef(mPlaneManipOffsetMeters, 0.f, mPlaneManipOffsetMeters);
- gGL.scalef(mPlaneScales.mV[VY], mPlaneScales.mV[VY], mPlaneScales.mV[VY]);
- if (mHighlightedPart == LL_XZ_PLANE)
- {
- color1.setVec(0.f, 0.f, 1.f, 1.f);
- color2.setVec(1.f, 0.f, 0.f, 1.f);
- }
- else
- {
- color1.setVec(0.f, 0.f, 1.f, 0.6f);
- color2.setVec(1.f, 0.f, 0.f, 0.6f);
- }
-
- gGL.begin(LLRender::TRIANGLES);
- {
- gGL.color4fv(color1.mV);
- gGL.vertex3f(mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
- gGL.vertex3f(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), 0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
- gGL.vertex3f(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f));
-
- gGL.color4fv(color2.mV);
- gGL.vertex3f(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f));
- gGL.vertex3f(mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f));
- gGL.vertex3f(mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
- }
- gGL.end();
-
- LLUI::setLineWidth(3.0f);
- gGL.begin(LLRender::LINES);
- {
- gGL.color4f(0.f, 0.f, 0.f, 0.3f);
- gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.1f);
- gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.4f);
-
- gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.1f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f);
- gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
- gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.4f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f);
- }
- gGL.end();
- LLUI::setLineWidth(1.0f);
-
- gGL.popMatrix();
- }
-
- if ((mManipPart == LL_NO_PART || mManipPart == LL_XY_PLANE) && llabs(relative_camera_dir.mV[VZ]) > MIN_PLANE_MANIP_DOT_PRODUCT)
- {
- // render XY plane manipulator
- gGL.pushMatrix();
- gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
-
-/* Y
- ^
- v1
- | \
- |<- v0
- | /| \
- v2__v__v3 > X
+ LLVector3 grid_origin;
+ LLVector3 grid_scale;
+ LLQuaternion grid_rotation;
+ LLGLDepthTest gls_depth(GL_FALSE);
+
+ LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
+ LLVector3 at_axis;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ at_axis = LLVector3::x_axis * ~grid_rotation;
+ }
+ else
+ {
+ at_axis = LLViewerCamera::getInstance()->getAtAxis() * ~grid_rotation;
+ }
+
+ if (at_axis.mV[VX] > 0.f)
+ {
+ mPlaneManipPositions.mV[VX] = 1.f;
+ }
+ else
+ {
+ mPlaneManipPositions.mV[VX] = -1.f;
+ }
+
+ if (at_axis.mV[VY] > 0.f)
+ {
+ mPlaneManipPositions.mV[VY] = 1.f;
+ }
+ else
+ {
+ mPlaneManipPositions.mV[VY] = -1.f;
+ }
+
+ if (at_axis.mV[VZ] > 0.f)
+ {
+ mPlaneManipPositions.mV[VZ] = 1.f;
+ }
+ else
+ {
+ mPlaneManipPositions.mV[VZ] = -1.f;
+ }
+
+ LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE);
+ if (!first_object) return;
+
+ LLVector3 selection_center = getPivotPoint();
+
+ // Drag handles
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWorldViewHeightRaw();
+ mArrowLengthMeters /= gAgentCamera.mHUDCurZoom;
+ }
+ else
+ {
+ LLVector3 camera_pos_agent = gAgentCamera.getCameraPositionAgent();
+ F32 range = dist_vec(camera_pos_agent, selection_center);
+ F32 range_from_agent = dist_vec(gAgent.getPositionAgent(), selection_center);
+
+ // Don't draw handles if you're too far away
+ if (gSavedSettings.getBOOL("LimitSelectDistance"))
+ {
+ if (range_from_agent > gSavedSettings.getF32("MaxSelectDistance"))
+ {
+ return;
+ }
+ }
+
+ if (range > 0.001f)
+ {
+ // range != zero
+ F32 fraction_of_fov = mAxisArrowLength / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
+ F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians
+ mArrowLengthMeters = range * tan(apparent_angle);
+ }
+ else
+ {
+ // range == zero
+ mArrowLengthMeters = 1.0f;
+ }
+ }
+ //Assume that UI scale factor is equivalent for X and Y axis
+ F32 ui_scale_factor = LLUI::getScaleFactor().mV[VX];
+ mArrowLengthMeters *= ui_scale_factor;
+
+ mPlaneManipOffsetMeters = mArrowLengthMeters * 1.8f;
+ mGridSizeMeters = gSavedSettings.getF32("GridDrawSize");
+ mConeSize = mArrowLengthMeters / 4.f;
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ {
+ gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
+
+ F32 angle_radians, x, y, z;
+ grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
+
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
+
+ LLQuaternion invRotation = grid_rotation;
+ invRotation.conjQuat();
+
+ LLVector3 relative_camera_dir;
+
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ relative_camera_dir = LLVector3::x_axis * invRotation;
+ }
+ else
+ {
+ relative_camera_dir = (selection_center - LLViewerCamera::getInstance()->getOrigin()) * invRotation;
+ }
+ relative_camera_dir.normVec();
+
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDisable cull_face(GL_CULL_FACE);
+
+ LLColor4 color1;
+ LLColor4 color2;
+
+ // update manipulator sizes
+ for (S32 index = 0; index < 3; index++)
+ {
+ if (index == mManipPart - LL_X_ARROW || index == mHighlightedPart - LL_X_ARROW)
+ {
+ mArrowScales.mV[index] = lerp(mArrowScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+ mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+ }
+ else if (index == mManipPart - LL_YZ_PLANE || index == mHighlightedPart - LL_YZ_PLANE)
+ {
+ mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+ mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+ }
+ else
+ {
+ mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+ mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+ }
+ }
+
+ if ((mManipPart == LL_NO_PART || mManipPart == LL_YZ_PLANE) && llabs(relative_camera_dir.mV[VX]) > MIN_PLANE_MANIP_DOT_PRODUCT)
+ {
+ // render YZ plane manipulator
+ gGL.pushMatrix();
+ gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
+ gGL.translatef(0.f, mPlaneManipOffsetMeters, mPlaneManipOffsetMeters);
+ gGL.scalef(mPlaneScales.mV[VX], mPlaneScales.mV[VX], mPlaneScales.mV[VX]);
+ if (mHighlightedPart == LL_YZ_PLANE)
+ {
+ color1.setVec(0.f, 1.f, 0.f, 1.f);
+ color2.setVec(0.f, 0.f, 1.f, 1.f);
+ }
+ else
+ {
+ color1.setVec(0.f, 1.f, 0.f, 0.6f);
+ color2.setVec(0.f, 0.f, 1.f, 0.6f);
+ }
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ gGL.color4fv(color1.mV);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f));
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f));
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
+
+ gGL.color4fv(color2.mV);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f));
+ }
+ gGL.end();
+
+ LLUI::setLineWidth(3.0f);
+ gGL.begin(LLRender::LINES);
+ {
+ gGL.color4f(0.f, 0.f, 0.f, 0.3f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.1f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.4f);
+
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.1f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.4f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f);
+ }
+ gGL.end();
+ LLUI::setLineWidth(1.0f);
+ gGL.popMatrix();
+ }
+
+ if ((mManipPart == LL_NO_PART || mManipPart == LL_XZ_PLANE) && llabs(relative_camera_dir.mV[VY]) > MIN_PLANE_MANIP_DOT_PRODUCT)
+ {
+ // render XZ plane manipulator
+ gGL.pushMatrix();
+ gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
+ gGL.translatef(mPlaneManipOffsetMeters, 0.f, mPlaneManipOffsetMeters);
+ gGL.scalef(mPlaneScales.mV[VY], mPlaneScales.mV[VY], mPlaneScales.mV[VY]);
+ if (mHighlightedPart == LL_XZ_PLANE)
+ {
+ color1.setVec(0.f, 0.f, 1.f, 1.f);
+ color2.setVec(1.f, 0.f, 0.f, 1.f);
+ }
+ else
+ {
+ color1.setVec(0.f, 0.f, 1.f, 0.6f);
+ color2.setVec(1.f, 0.f, 0.f, 0.6f);
+ }
+
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ gGL.color4fv(color1.mV);
+ gGL.vertex3f(mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
+ gGL.vertex3f(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), 0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
+ gGL.vertex3f(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f));
+
+ gGL.color4fv(color2.mV);
+ gGL.vertex3f(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f));
+ gGL.vertex3f(mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f));
+ gGL.vertex3f(mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f), 0.f, mPlaneManipOffsetMeters * (PLANE_TICK_SIZE * 0.25f));
+ }
+ gGL.end();
+
+ LLUI::setLineWidth(3.0f);
+ gGL.begin(LLRender::LINES);
+ {
+ gGL.color4f(0.f, 0.f, 0.f, 0.3f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.1f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.4f);
+
+ gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.1f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.25f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.25f);
+ gGL.vertex3f(mPlaneManipOffsetMeters * -PLANE_TICK_SIZE * 0.4f, 0.f, mPlaneManipOffsetMeters * PLANE_TICK_SIZE * 0.1f);
+ }
+ gGL.end();
+ LLUI::setLineWidth(1.0f);
+
+ gGL.popMatrix();
+ }
+
+ if ((mManipPart == LL_NO_PART || mManipPart == LL_XY_PLANE) && llabs(relative_camera_dir.mV[VZ]) > MIN_PLANE_MANIP_DOT_PRODUCT)
+ {
+ // render XY plane manipulator
+ gGL.pushMatrix();
+ gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
+
+/* Y
+ ^
+ v1
+ | \
+ |<- v0
+ | /| \
+ v2__v__v3 > X
*/
- LLVector3 v0,v1,v2,v3;
+ LLVector3 v0,v1,v2,v3;
#if 0
- // This should theoretically work but looks off; could be tuned later -SJB
- gGL.translatef(-mPlaneManipOffsetMeters, -mPlaneManipOffsetMeters, 0.f);
- v0 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
- v1 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.75f), 0.f);
- v2 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f);
- v3 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.75f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f);
+ // This should theoretically work but looks off; could be tuned later -SJB
+ gGL.translatef(-mPlaneManipOffsetMeters, -mPlaneManipOffsetMeters, 0.f);
+ v0 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
+ v1 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.75f), 0.f);
+ v2 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f);
+ v3 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.75f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f);
#else
- gGL.translatef(mPlaneManipOffsetMeters, mPlaneManipOffsetMeters, 0.f);
- v0 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f);
- v1 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), 0.f);
- v2 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
- v3 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
+ gGL.translatef(mPlaneManipOffsetMeters, mPlaneManipOffsetMeters, 0.f);
+ v0 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.25f), 0.f);
+ v1 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), 0.f);
+ v2 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
+ v3 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
#endif
- gGL.scalef(mPlaneScales.mV[VZ], mPlaneScales.mV[VZ], mPlaneScales.mV[VZ]);
- if (mHighlightedPart == LL_XY_PLANE)
- {
- color1.setVec(1.f, 0.f, 0.f, 1.f);
- color2.setVec(0.f, 1.f, 0.f, 1.f);
- }
- else
- {
- color1.setVec(0.8f, 0.f, 0.f, 0.6f);
- color2.setVec(0.f, 0.8f, 0.f, 0.6f);
- }
-
- gGL.begin(LLRender::TRIANGLES);
- {
- gGL.color4fv(color1.mV);
- gGL.vertex3fv(v0.mV);
- gGL.vertex3fv(v1.mV);
- gGL.vertex3fv(v2.mV);
-
- gGL.color4fv(color2.mV);
- gGL.vertex3fv(v2.mV);
- gGL.vertex3fv(v3.mV);
- gGL.vertex3fv(v0.mV);
- }
- gGL.end();
-
- LLUI::setLineWidth(3.0f);
- gGL.begin(LLRender::LINES);
- {
- gGL.color4f(0.f, 0.f, 0.f, 0.3f);
- LLVector3 v12 = (v1 + v2) * .5f;
- gGL.vertex3fv(v0.mV);
- gGL.vertex3fv(v12.mV);
- gGL.vertex3fv(v12.mV);
- gGL.vertex3fv((v12 + (v0-v12)*.3f + (v2-v12)*.3f).mV);
- gGL.vertex3fv(v12.mV);
- gGL.vertex3fv((v12 + (v0-v12)*.3f + (v1-v12)*.3f).mV);
-
- LLVector3 v23 = (v2 + v3) * .5f;
- gGL.vertex3fv(v0.mV);
- gGL.vertex3fv(v23.mV);
- gGL.vertex3fv(v23.mV);
- gGL.vertex3fv((v23 + (v0-v23)*.3f + (v3-v23)*.3f).mV);
- gGL.vertex3fv(v23.mV);
- gGL.vertex3fv((v23 + (v0-v23)*.3f + (v2-v23)*.3f).mV);
- }
- gGL.end();
- LLUI::setLineWidth(1.0f);
-
- gGL.popMatrix();
- }
- }
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- // Since we draw handles with depth testing off, we need to draw them in the
- // proper depth order.
-
- // Copied from LLDrawable::updateGeometry
- LLVector3 pos_agent = first_object->getPositionAgent();
- LLVector3 camera_agent = gAgentCamera.getCameraPositionAgent();
- LLVector3 headPos = pos_agent - camera_agent;
-
- LLVector3 orientWRTHead = headPos * invRotation;
-
- // Find nearest vertex
- U32 nearest = (orientWRTHead.mV[0] < 0.0f ? 1 : 0) +
- (orientWRTHead.mV[1] < 0.0f ? 2 : 0) +
- (orientWRTHead.mV[2] < 0.0f ? 4 : 0);
-
- // opposite faces on Linden cubes:
- // 0 & 5
- // 1 & 3
- // 2 & 4
-
- // Table of order to draw faces, based on nearest vertex
- static U32 face_list[8][NUM_AXES*2] = {
- { 2,0,1, 4,5,3 }, // v6 F201 F453
- { 2,0,3, 4,5,1 }, // v7 F203 F451
- { 4,0,1, 2,5,3 }, // v5 F401 F253
- { 4,0,3, 2,5,1 }, // v4 F403 F251
- { 2,5,1, 4,0,3 }, // v2 F251 F403
- { 2,5,3, 4,0,1 }, // v3 F253 F401
- { 4,5,1, 2,0,3 }, // v1 F451 F203
- { 4,5,3, 2,0,1 }, // v0 F453 F201
- };
- static const EManipPart which_arrow[6] = {
- LL_Z_ARROW,
- LL_X_ARROW,
- LL_Y_ARROW,
- LL_X_ARROW,
- LL_Y_ARROW,
- LL_Z_ARROW};
-
- // draw arrows for deeper faces first, closer faces last
- LLVector3 camera_axis;
- if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
- {
- camera_axis = LLVector3::x_axis;
- }
- else
- {
- camera_axis.setVec(gAgentCamera.getCameraPositionAgent() - first_object->getPositionAgent());
- }
-
- for (U32 i = 0; i < NUM_AXES*2; i++)
- {
- U32 face = face_list[nearest][i];
-
- LLVector3 arrow_axis;
- getManipAxis(first_object, which_arrow[face], arrow_axis);
-
- renderArrow(which_arrow[face],
- mManipPart,
- (face >= 3) ? -mConeSize : mConeSize,
- (face >= 3) ? -mArrowLengthMeters : mArrowLengthMeters,
- mConeSize,
- FALSE);
- }
- }
- }
- gGL.popMatrix();
+ gGL.scalef(mPlaneScales.mV[VZ], mPlaneScales.mV[VZ], mPlaneScales.mV[VZ]);
+ if (mHighlightedPart == LL_XY_PLANE)
+ {
+ color1.setVec(1.f, 0.f, 0.f, 1.f);
+ color2.setVec(0.f, 1.f, 0.f, 1.f);
+ }
+ else
+ {
+ color1.setVec(0.8f, 0.f, 0.f, 0.6f);
+ color2.setVec(0.f, 0.8f, 0.f, 0.6f);
+ }
+
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ gGL.color4fv(color1.mV);
+ gGL.vertex3fv(v0.mV);
+ gGL.vertex3fv(v1.mV);
+ gGL.vertex3fv(v2.mV);
+
+ gGL.color4fv(color2.mV);
+ gGL.vertex3fv(v2.mV);
+ gGL.vertex3fv(v3.mV);
+ gGL.vertex3fv(v0.mV);
+ }
+ gGL.end();
+
+ LLUI::setLineWidth(3.0f);
+ gGL.begin(LLRender::LINES);
+ {
+ gGL.color4f(0.f, 0.f, 0.f, 0.3f);
+ LLVector3 v12 = (v1 + v2) * .5f;
+ gGL.vertex3fv(v0.mV);
+ gGL.vertex3fv(v12.mV);
+ gGL.vertex3fv(v12.mV);
+ gGL.vertex3fv((v12 + (v0-v12)*.3f + (v2-v12)*.3f).mV);
+ gGL.vertex3fv(v12.mV);
+ gGL.vertex3fv((v12 + (v0-v12)*.3f + (v1-v12)*.3f).mV);
+
+ LLVector3 v23 = (v2 + v3) * .5f;
+ gGL.vertex3fv(v0.mV);
+ gGL.vertex3fv(v23.mV);
+ gGL.vertex3fv(v23.mV);
+ gGL.vertex3fv((v23 + (v0-v23)*.3f + (v3-v23)*.3f).mV);
+ gGL.vertex3fv(v23.mV);
+ gGL.vertex3fv((v23 + (v0-v23)*.3f + (v2-v23)*.3f).mV);
+ }
+ gGL.end();
+ LLUI::setLineWidth(1.0f);
+
+ gGL.popMatrix();
+ }
+ }
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ // Since we draw handles with depth testing off, we need to draw them in the
+ // proper depth order.
+
+ // Copied from LLDrawable::updateGeometry
+ LLVector3 pos_agent = first_object->getPositionAgent();
+ LLVector3 camera_agent = gAgentCamera.getCameraPositionAgent();
+ LLVector3 headPos = pos_agent - camera_agent;
+
+ LLVector3 orientWRTHead = headPos * invRotation;
+
+ // Find nearest vertex
+ U32 nearest = (orientWRTHead.mV[0] < 0.0f ? 1 : 0) +
+ (orientWRTHead.mV[1] < 0.0f ? 2 : 0) +
+ (orientWRTHead.mV[2] < 0.0f ? 4 : 0);
+
+ // opposite faces on Linden cubes:
+ // 0 & 5
+ // 1 & 3
+ // 2 & 4
+
+ // Table of order to draw faces, based on nearest vertex
+ static U32 face_list[8][NUM_AXES*2] = {
+ { 2,0,1, 4,5,3 }, // v6 F201 F453
+ { 2,0,3, 4,5,1 }, // v7 F203 F451
+ { 4,0,1, 2,5,3 }, // v5 F401 F253
+ { 4,0,3, 2,5,1 }, // v4 F403 F251
+ { 2,5,1, 4,0,3 }, // v2 F251 F403
+ { 2,5,3, 4,0,1 }, // v3 F253 F401
+ { 4,5,1, 2,0,3 }, // v1 F451 F203
+ { 4,5,3, 2,0,1 }, // v0 F453 F201
+ };
+ static const EManipPart which_arrow[6] = {
+ LL_Z_ARROW,
+ LL_X_ARROW,
+ LL_Y_ARROW,
+ LL_X_ARROW,
+ LL_Y_ARROW,
+ LL_Z_ARROW};
+
+ // draw arrows for deeper faces first, closer faces last
+ LLVector3 camera_axis;
+ if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ camera_axis = LLVector3::x_axis;
+ }
+ else
+ {
+ camera_axis.setVec(gAgentCamera.getCameraPositionAgent() - first_object->getPositionAgent());
+ }
+
+ for (U32 i = 0; i < NUM_AXES*2; i++)
+ {
+ U32 face = face_list[nearest][i];
+
+ LLVector3 arrow_axis;
+ getManipAxis(first_object, which_arrow[face], arrow_axis);
+
+ renderArrow(which_arrow[face],
+ mManipPart,
+ (face >= 3) ? -mConeSize : mConeSize,
+ (face >= 3) ? -mArrowLengthMeters : mArrowLengthMeters,
+ mConeSize,
+ FALSE);
+ }
+ }
+ }
+ gGL.popMatrix();
}
void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction)
{
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLEnable gls_blend(GL_BLEND);
-
- for (S32 pass = 1; pass <= 2; pass++)
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, pass == 1 ? GL_LEQUAL : GL_GREATER);
- gGL.pushMatrix();
-
- S32 index = 0;
-
- index = ARROW_TO_AXIS[which_arrow];
-
- // assign a color for this arrow
- LLColor4 color; // black
- if (which_arrow == selected_arrow || which_arrow == mHighlightedPart)
- {
- color.mV[index] = (pass == 1) ? 1.f : 0.5f;
- }
- else if (selected_arrow != LL_NO_PART)
- {
- color.mV[VALPHA] = 0.f;
- }
- else
- {
- color.mV[index] = pass == 1 ? .8f : .35f ; // red, green, or blue
- color.mV[VALPHA] = 0.6f;
- }
- gGL.color4fv( color.mV );
-
- LLVector3 vec;
-
- {
- LLUI::setLineWidth(2.0f);
- gGL.begin(LLRender::LINES);
- vec.mV[index] = box_size;
- gGL.vertex3f(vec.mV[0], vec.mV[1], vec.mV[2]);
-
- vec.mV[index] = arrow_size;
- gGL.vertex3f(vec.mV[0], vec.mV[1], vec.mV[2]);
- gGL.end();
- LLUI::setLineWidth(1.0f);
- }
-
- gGL.translatef(vec.mV[0], vec.mV[1], vec.mV[2]);
- gGL.scalef(handle_size, handle_size, handle_size);
-
- F32 rot = 0.0f;
- LLVector3 axis;
-
- switch(which_arrow)
- {
- case LL_X_ARROW:
- rot = reverse_direction ? -90.0f : 90.0f;
- axis.mV[1] = 1.0f;
- break;
- case LL_Y_ARROW:
- rot = reverse_direction ? 90.0f : -90.0f;
- axis.mV[0] = 1.0f;
- break;
- case LL_Z_ARROW:
- rot = reverse_direction ? 180.0f : 0.0f;
- axis.mV[0] = 1.0f;
- break;
- default:
- LL_ERRS() << "renderArrow called with bad arrow " << which_arrow << LL_ENDL;
- break;
- }
-
- gGL.diffuseColor4fv(color.mV);
- gGL.rotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]);
- gGL.scalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f);
-
- gCone.render();
-
- gGL.popMatrix();
- }
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLEnable gls_blend(GL_BLEND);
+
+ for (S32 pass = 1; pass <= 2; pass++)
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, pass == 1 ? GL_LEQUAL : GL_GREATER);
+ gGL.pushMatrix();
+
+ S32 index = 0;
+
+ index = ARROW_TO_AXIS[which_arrow];
+
+ // assign a color for this arrow
+ LLColor4 color; // black
+ if (which_arrow == selected_arrow || which_arrow == mHighlightedPart)
+ {
+ color.mV[index] = (pass == 1) ? 1.f : 0.5f;
+ }
+ else if (selected_arrow != LL_NO_PART)
+ {
+ color.mV[VALPHA] = 0.f;
+ }
+ else
+ {
+ color.mV[index] = pass == 1 ? .8f : .35f ; // red, green, or blue
+ color.mV[VALPHA] = 0.6f;
+ }
+ gGL.color4fv( color.mV );
+
+ LLVector3 vec;
+
+ {
+ LLUI::setLineWidth(2.0f);
+ gGL.begin(LLRender::LINES);
+ vec.mV[index] = box_size;
+ gGL.vertex3f(vec.mV[0], vec.mV[1], vec.mV[2]);
+
+ vec.mV[index] = arrow_size;
+ gGL.vertex3f(vec.mV[0], vec.mV[1], vec.mV[2]);
+ gGL.end();
+ LLUI::setLineWidth(1.0f);
+ }
+
+ gGL.translatef(vec.mV[0], vec.mV[1], vec.mV[2]);
+ gGL.scalef(handle_size, handle_size, handle_size);
+
+ F32 rot = 0.0f;
+ LLVector3 axis;
+
+ switch(which_arrow)
+ {
+ case LL_X_ARROW:
+ rot = reverse_direction ? -90.0f : 90.0f;
+ axis.mV[1] = 1.0f;
+ break;
+ case LL_Y_ARROW:
+ rot = reverse_direction ? 90.0f : -90.0f;
+ axis.mV[0] = 1.0f;
+ break;
+ case LL_Z_ARROW:
+ rot = reverse_direction ? 180.0f : 0.0f;
+ axis.mV[0] = 1.0f;
+ break;
+ default:
+ LL_ERRS() << "renderArrow called with bad arrow " << which_arrow << LL_ENDL;
+ break;
+ }
+
+ gGL.diffuseColor4fv(color.mV);
+ gGL.rotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]);
+ gGL.scalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f);
+
+ gCone.render();
+
+ gGL.popMatrix();
+ }
}
void LLManipTranslate::renderGridVert(F32 x_trans, F32 y_trans, F32 r, F32 g, F32 b, F32 alpha)
{
- gGL.color4f(r, g, b, alpha);
- switch (mManipPart)
- {
- case LL_YZ_PLANE:
- gGL.vertex3f(0, x_trans, y_trans);
- break;
- case LL_XZ_PLANE:
- gGL.vertex3f(x_trans, 0, y_trans);
- break;
- case LL_XY_PLANE:
- gGL.vertex3f(x_trans, y_trans, 0);
- break;
- default:
- gGL.vertex3f(0,0,0);
- break;
- }
+ gGL.color4f(r, g, b, alpha);
+ switch (mManipPart)
+ {
+ case LL_YZ_PLANE:
+ gGL.vertex3f(0, x_trans, y_trans);
+ break;
+ case LL_XZ_PLANE:
+ gGL.vertex3f(x_trans, 0, y_trans);
+ break;
+ case LL_XY_PLANE:
+ gGL.vertex3f(x_trans, y_trans, 0);
+ break;
+ default:
+ gGL.vertex3f(0,0,0);
+ break;
+ }
}
// virtual
BOOL LLManipTranslate::canAffectSelection()
{
- BOOL can_move = mObjectSelection->getObjectCount() != 0;
- if (can_move)
- {
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* objectp)
- {
- LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit();
- return objectp->permMove() && !objectp->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
- (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
- }
- } func;
- can_move = mObjectSelection->applyToObjects(&func);
- }
- return can_move;
+ BOOL can_move = mObjectSelection->getObjectCount() != 0;
+ if (can_move)
+ {
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* objectp)
+ {
+ LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit();
+ return objectp->permMove() && !objectp->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced()) &&
+ (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
+ }
+ } func;
+ can_move = mObjectSelection->applyToObjects(&func);
+ }
+ return can_move;
}
diff --git a/indra/newview/llmaniptranslate.h b/indra/newview/llmaniptranslate.h
index 3c37bbd698..60621c8498 100644
--- a/indra/newview/llmaniptranslate.h
+++ b/indra/newview/llmaniptranslate.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmaniptranslate.h
* @brief LLManipTranslate class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,80 +35,80 @@
class LLManipTranslate : public LLManip
{
public:
- class ManipulatorHandle
- {
- public:
- LLVector3 mStartPosition;
- LLVector3 mEndPosition;
- EManipPart mManipID;
- F32 mHotSpotRadius;
+ class ManipulatorHandle
+ {
+ public:
+ LLVector3 mStartPosition;
+ LLVector3 mEndPosition;
+ EManipPart mManipID;
+ F32 mHotSpotRadius;
- ManipulatorHandle(LLVector3 start_pos, LLVector3 end_pos, EManipPart id, F32 radius):mStartPosition(start_pos), mEndPosition(end_pos), mManipID(id), mHotSpotRadius(radius){}
- };
+ ManipulatorHandle(LLVector3 start_pos, LLVector3 end_pos, EManipPart id, F32 radius):mStartPosition(start_pos), mEndPosition(end_pos), mManipID(id), mHotSpotRadius(radius){}
+ };
- LLManipTranslate( LLToolComposite* composite );
- virtual ~LLManipTranslate();
+ LLManipTranslate( LLToolComposite* composite );
+ virtual ~LLManipTranslate();
- static U32 getGridTexName() ;
- static void destroyGL();
- static void restoreGL();
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual void render();
- virtual void handleSelect();
+ static U32 getGridTexName() ;
+ static void destroyGL();
+ static void restoreGL();
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual void render();
+ virtual void handleSelect();
- virtual void highlightManipulators(S32 x, S32 y);
- virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
- virtual BOOL canAffectSelection();
+ virtual void highlightManipulators(S32 x, S32 y);
+ virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
+ virtual BOOL canAffectSelection();
protected:
- enum EHandleType {
- HANDLE_CONE,
- HANDLE_BOX,
- HANDLE_SPHERE
- };
+ enum EHandleType {
+ HANDLE_CONE,
+ HANDLE_BOX,
+ HANDLE_SPHERE
+ };
- void renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction);
- void renderTranslationHandles();
- void renderText();
- void renderSnapGuides();
- void renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F32 a);
- void renderGridVert(F32 x_trans, F32 y_trans, F32 r, F32 g, F32 b, F32 alpha);
- void highlightIntersection(LLVector3 normal,
- LLVector3 selection_center,
- LLQuaternion grid_rotation,
- LLColor4 inner_color);
- F32 getMinGridScale();
+ void renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction);
+ void renderTranslationHandles();
+ void renderText();
+ void renderSnapGuides();
+ void renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F32 a);
+ void renderGridVert(F32 x_trans, F32 y_trans, F32 r, F32 g, F32 b, F32 alpha);
+ void highlightIntersection(LLVector3 normal,
+ LLVector3 selection_center,
+ LLQuaternion grid_rotation,
+ LLColor4 inner_color);
+ F32 getMinGridScale();
private:
- S32 mLastHoverMouseX;
- S32 mLastHoverMouseY;
- BOOL mMouseOutsideSlop; // true after mouse goes outside slop region
- BOOL mCopyMadeThisDrag;
- S32 mMouseDownX;
- S32 mMouseDownY;
- F32 mAxisArrowLength; // pixels
- F32 mConeSize; // meters, world space
- F32 mArrowLengthMeters; // meters
- F32 mGridSizeMeters;
- F32 mPlaneManipOffsetMeters;
- LLVector3 mManipNormal;
- LLVector3d mDragCursorStartGlobal;
- LLVector3d mDragSelectionStartGlobal;
- LLTimer mUpdateTimer;
- LLVector4 mManipulatorVertices[18];
- F32 mSnapOffsetMeters;
- LLVector3 mSnapOffsetAxis;
- LLQuaternion mGridRotation;
- LLVector3 mGridOrigin;
- LLVector3 mGridScale;
- F32 mSubdivisions;
- BOOL mInSnapRegime;
- LLVector3 mArrowScales;
- LLVector3 mPlaneScales;
- LLVector4 mPlaneManipPositions;
+ S32 mLastHoverMouseX;
+ S32 mLastHoverMouseY;
+ BOOL mMouseOutsideSlop; // true after mouse goes outside slop region
+ BOOL mCopyMadeThisDrag;
+ S32 mMouseDownX;
+ S32 mMouseDownY;
+ F32 mAxisArrowLength; // pixels
+ F32 mConeSize; // meters, world space
+ F32 mArrowLengthMeters; // meters
+ F32 mGridSizeMeters;
+ F32 mPlaneManipOffsetMeters;
+ LLVector3 mManipNormal;
+ LLVector3d mDragCursorStartGlobal;
+ LLVector3d mDragSelectionStartGlobal;
+ LLTimer mUpdateTimer;
+ LLVector4 mManipulatorVertices[18];
+ F32 mSnapOffsetMeters;
+ LLVector3 mSnapOffsetAxis;
+ LLQuaternion mGridRotation;
+ LLVector3 mGridOrigin;
+ LLVector3 mGridScale;
+ F32 mSubdivisions;
+ BOOL mInSnapRegime;
+ LLVector3 mArrowScales;
+ LLVector3 mPlaneScales;
+ LLVector4 mPlaneManipPositions;
};
#endif
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index d27ee941a6..c0dd8bf208 100644
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmarketplacefunctions.cpp
* @brief Implementation of assorted functions related to the marketplace
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -111,7 +111,7 @@ namespace {
{
LL_WARNS("SLM") << "SLM API : Responder to " << request << ". status : " << status << ", reason : " << reason << ", code : " << code << ", description : " << ll_pretty_print_sd(result) << LL_ENDL;
- if ((status == 422) && (result.has(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_CONTENT) &&
+ if ((status == 422) && (result.has(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_CONTENT) &&
result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_CONTENT].isArray() &&
result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_CONTENT].size() > 4))
{
@@ -180,29 +180,29 @@ namespace {
#if 1
namespace LLMarketplaceImport
{
- // Basic interface for this namespace
+ // Basic interface for this namespace
+
+ bool hasSessionCookie();
+ bool inProgress();
+ bool resultPending();
+ S32 getResultStatus();
+ const LLSD& getResults();
- bool hasSessionCookie();
- bool inProgress();
- bool resultPending();
- S32 getResultStatus();
- const LLSD& getResults();
+ bool establishMarketplaceSessionCookie();
+ bool pollStatus();
+ bool triggerImport();
- bool establishMarketplaceSessionCookie();
- bool pollStatus();
- bool triggerImport();
-
- // Internal state variables
+ // Internal state variables
- static std::string sMarketplaceCookie = "";
- static LLSD sImportId = LLSD::emptyMap();
- static bool sImportInProgress = false;
- static bool sImportPostPending = false;
- static bool sImportGetPending = false;
- static S32 sImportResultStatus = 0;
- static LLSD sImportResults = LLSD::emptyMap();
+ static std::string sMarketplaceCookie = "";
+ static LLSD sImportId = LLSD::emptyMap();
+ static bool sImportInProgress = false;
+ static bool sImportPostPending = false;
+ static bool sImportGetPending = false;
+ static S32 sImportResultStatus = 0;
+ static LLSD sImportResults = LLSD::emptyMap();
- // Responders
+ // Responders
void marketplacePostCoro(std::string url)
{
@@ -271,7 +271,7 @@ namespace LLMarketplaceImport
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("marketplaceGetCoro", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLCore::HttpHeaders::ptr_t httpHeaders;
+ LLCore::HttpHeaders::ptr_t httpHeaders;
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
httpOpts->setWantHeaders(true);
@@ -330,101 +330,101 @@ namespace LLMarketplaceImport
}
- // Basic API
+ // Basic API
+
+ bool hasSessionCookie()
+ {
+ return !sMarketplaceCookie.empty();
+ }
+
+ bool inProgress()
+ {
+ return sImportInProgress;
+ }
+
+ bool resultPending()
+ {
+ return (sImportPostPending || sImportGetPending);
+ }
- bool hasSessionCookie()
- {
- return !sMarketplaceCookie.empty();
- }
-
- bool inProgress()
- {
- return sImportInProgress;
- }
-
- bool resultPending()
- {
- return (sImportPostPending || sImportGetPending);
- }
-
- S32 getResultStatus()
- {
+ S32 getResultStatus()
+ {
return sImportResultStatus;
- }
-
- const LLSD& getResults()
- {
- return sImportResults;
- }
-
- static std::string getInventoryImportURL()
- {
- std::string url = getMarketplaceURL("MarketplaceURL");
-
- url += "api/1/";
- url += gAgent.getID().getString();
- url += "/inventory/import/";
-
- return url;
- }
-
- bool establishMarketplaceSessionCookie()
- {
- if (hasSessionCookie())
- {
- return false;
- }
-
- sImportInProgress = true;
- sImportGetPending = true;
-
- std::string url = getInventoryImportURL();
+ }
+
+ const LLSD& getResults()
+ {
+ return sImportResults;
+ }
+
+ static std::string getInventoryImportURL()
+ {
+ std::string url = getMarketplaceURL("MarketplaceURL");
+
+ url += "api/1/";
+ url += gAgent.getID().getString();
+ url += "/inventory/import/";
+
+ return url;
+ }
+
+ bool establishMarketplaceSessionCookie()
+ {
+ if (hasSessionCookie())
+ {
+ return false;
+ }
+
+ sImportInProgress = true;
+ sImportGetPending = true;
+
+ std::string url = getInventoryImportURL();
LLCoros::instance().launch("marketplaceGetCoro",
boost::bind(&marketplaceGetCoro, url, false));
- return true;
- }
-
- bool pollStatus()
- {
- if (!hasSessionCookie())
- {
- return false;
- }
-
- sImportGetPending = true;
+ return true;
+ }
- std::string url = getInventoryImportURL();
+ bool pollStatus()
+ {
+ if (!hasSessionCookie())
+ {
+ return false;
+ }
- url += sImportId.asString();
+ sImportGetPending = true;
+
+ std::string url = getInventoryImportURL();
+
+ url += sImportId.asString();
LLCoros::instance().launch("marketplaceGetCoro",
boost::bind(&marketplaceGetCoro, url, true));
-
- return true;
- }
-
- bool triggerImport()
- {
- if (!hasSessionCookie())
- {
- return false;
- }
-
- sImportId = LLSD::emptyMap();
- sImportInProgress = true;
- sImportPostPending = true;
- sImportResultStatus = MarketplaceErrorCodes::IMPORT_PROCESSING;
- sImportResults = LLSD::emptyMap();
-
- std::string url = getInventoryImportURL();
-
+
+ return true;
+ }
+
+ bool triggerImport()
+ {
+ if (!hasSessionCookie())
+ {
+ return false;
+ }
+
+ sImportId = LLSD::emptyMap();
+ sImportInProgress = true;
+ sImportPostPending = true;
+ sImportResultStatus = MarketplaceErrorCodes::IMPORT_PROCESSING;
+ sImportResults = LLSD::emptyMap();
+
+ std::string url = getInventoryImportURL();
+
LLCoros::instance().launch("marketplacePostCoro",
boost::bind(&marketplacePostCoro, url));
- return true;
- }
+ return true;
+ }
}
#endif
@@ -436,56 +436,56 @@ static const F32 MARKET_IMPORTER_UPDATE_FREQUENCY = 1.0f;
//static
void LLMarketplaceInventoryImporter::update()
{
- if (instanceExists())
- {
- static LLTimer update_timer;
- if (update_timer.hasExpired())
- {
- LLMarketplaceInventoryImporter::instance().updateImport();
- update_timer.setTimerExpirySec(MARKET_IMPORTER_UPDATE_FREQUENCY);
- }
- }
+ if (instanceExists())
+ {
+ static LLTimer update_timer;
+ if (update_timer.hasExpired())
+ {
+ LLMarketplaceInventoryImporter::instance().updateImport();
+ update_timer.setTimerExpirySec(MARKET_IMPORTER_UPDATE_FREQUENCY);
+ }
+ }
}
LLMarketplaceInventoryImporter::LLMarketplaceInventoryImporter()
- : mAutoTriggerImport(false)
- , mImportInProgress(false)
- , mInitialized(false)
- , mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
- , mErrorInitSignal(NULL)
- , mStatusChangedSignal(NULL)
- , mStatusReportSignal(NULL)
+ : mAutoTriggerImport(false)
+ , mImportInProgress(false)
+ , mInitialized(false)
+ , mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
+ , mErrorInitSignal(NULL)
+ , mStatusChangedSignal(NULL)
+ , mStatusReportSignal(NULL)
{
}
boost::signals2::connection LLMarketplaceInventoryImporter::setInitializationErrorCallback(const status_report_signal_t::slot_type& cb)
{
- if (mErrorInitSignal == NULL)
- {
- mErrorInitSignal = new status_report_signal_t();
- }
-
- return mErrorInitSignal->connect(cb);
+ if (mErrorInitSignal == NULL)
+ {
+ mErrorInitSignal = new status_report_signal_t();
+ }
+
+ return mErrorInitSignal->connect(cb);
}
boost::signals2::connection LLMarketplaceInventoryImporter::setStatusChangedCallback(const status_changed_signal_t::slot_type& cb)
{
- if (mStatusChangedSignal == NULL)
- {
- mStatusChangedSignal = new status_changed_signal_t();
- }
+ if (mStatusChangedSignal == NULL)
+ {
+ mStatusChangedSignal = new status_changed_signal_t();
+ }
- return mStatusChangedSignal->connect(cb);
+ return mStatusChangedSignal->connect(cb);
}
boost::signals2::connection LLMarketplaceInventoryImporter::setStatusReportCallback(const status_report_signal_t::slot_type& cb)
{
- if (mStatusReportSignal == NULL)
- {
- mStatusReportSignal = new status_report_signal_t();
- }
+ if (mStatusReportSignal == NULL)
+ {
+ mStatusReportSignal = new status_report_signal_t();
+ }
- return mStatusReportSignal->connect(cb);
+ return mStatusReportSignal->connect(cb);
}
void LLMarketplaceInventoryImporter::initialize()
@@ -508,45 +508,45 @@ void LLMarketplaceInventoryImporter::initialize()
void LLMarketplaceInventoryImporter::reinitializeAndTriggerImport()
{
- mInitialized = false;
- mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED;
- initialize();
- mAutoTriggerImport = true;
+ mInitialized = false;
+ mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED;
+ initialize();
+ mAutoTriggerImport = true;
}
bool LLMarketplaceInventoryImporter::triggerImport()
{
- const bool import_triggered = LLMarketplaceImport::triggerImport();
-
- if (!import_triggered)
- {
- reinitializeAndTriggerImport();
- }
-
- return import_triggered;
+ const bool import_triggered = LLMarketplaceImport::triggerImport();
+
+ if (!import_triggered)
+ {
+ reinitializeAndTriggerImport();
+ }
+
+ return import_triggered;
}
void LLMarketplaceInventoryImporter::updateImport()
{
- const bool in_progress = LLMarketplaceImport::inProgress();
-
- if (in_progress && !LLMarketplaceImport::resultPending())
- {
- const bool polling_status = LLMarketplaceImport::pollStatus();
-
- if (!polling_status)
- {
- reinitializeAndTriggerImport();
- }
- }
-
- if (mImportInProgress != in_progress)
- {
- mImportInProgress = in_progress;
-
- // If we are no longer in progress
- if (!mImportInProgress)
- {
+ const bool in_progress = LLMarketplaceImport::inProgress();
+
+ if (in_progress && !LLMarketplaceImport::resultPending())
+ {
+ const bool polling_status = LLMarketplaceImport::pollStatus();
+
+ if (!polling_status)
+ {
+ reinitializeAndTriggerImport();
+ }
+ }
+
+ if (mImportInProgress != in_progress)
+ {
+ mImportInProgress = in_progress;
+
+ // If we are no longer in progress
+ if (!mImportInProgress)
+ {
// Look for results success
mInitialized = LLMarketplaceImport::hasSessionCookie();
@@ -555,7 +555,7 @@ void LLMarketplaceInventoryImporter::updateImport()
{
(*mStatusReportSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
}
-
+
if (mInitialized)
{
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT;
@@ -587,9 +587,9 @@ void LLMarketplaceInventoryImporter::updateImport()
(*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
}
}
- }
- }
-
+ }
+ }
+
// Make sure we trigger the status change with the final state (in case of auto trigger after initialize)
if (mStatusChangedSignal)
{
@@ -603,9 +603,9 @@ void LLMarketplaceInventoryImporter::updateImport()
class LLMarketplaceInventoryObserver : public LLInventoryObserver
{
public:
- LLMarketplaceInventoryObserver() {}
- virtual ~LLMarketplaceInventoryObserver() {}
- virtual void changed(U32 mask);
+ LLMarketplaceInventoryObserver() {}
+ virtual ~LLMarketplaceInventoryObserver() {}
+ virtual void changed(U32 mask);
private:
static void onIdleProcessQueue(void *userdata);
@@ -629,7 +629,7 @@ void LLMarketplaceInventoryObserver::changed(U32 mask)
// once observers are called) we need to raise a flag in the inventory to signal that things have been dirtied.
const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
sStructureQueue.insert(changed_items.begin(), changed_items.end());
- }
+ }
if (!sProcessingQueue && !sStructureQueue.empty())
{
@@ -716,7 +716,7 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id,
// Data map
-LLMarketplaceData::LLMarketplaceData() :
+LLMarketplaceData::LLMarketplaceData() :
mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED),
mMarketPlaceDataFetched(MarketplaceFetchCodes::MARKET_FETCH_NOT_DONE),
mStatusUpdatedSignal(NULL),
@@ -729,7 +729,7 @@ LLMarketplaceData::LLMarketplaceData() :
LLMarketplaceData::~LLMarketplaceData()
{
- gInventory.removeObserver(mInventoryObserver);
+ gInventory.removeObserver(mInventoryObserver);
}
@@ -754,12 +754,12 @@ LLSD LLMarketplaceData::getMarketplaceStringSubstitutions()
void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type& cb)
{
- if (mStatusUpdatedSignal == NULL)
- {
- mStatusUpdatedSignal = new status_updated_signal_t();
- }
- mStatusUpdatedSignal->connect(cb);
-
+ if (mStatusUpdatedSignal == NULL)
+ {
+ mStatusUpdatedSignal = new status_updated_signal_t();
+ }
+ mStatusUpdatedSignal->connect(cb);
+
if (mMarketPlaceStatus != MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
{
// If already initialized, just confirm the status so the callback gets called
@@ -805,7 +805,7 @@ void LLMarketplaceData::getMerchantStatusCoro()
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
- {
+ {
S32 httpCode = status.getType();
if (httpCode == HTTP_NOT_FOUND)
@@ -842,11 +842,11 @@ void LLMarketplaceData::getMerchantStatusCoro()
void LLMarketplaceData::setDataFetchedSignal(const status_updated_signal_t::slot_type& cb)
{
- if (mDataFetchedSignal == NULL)
- {
- mDataFetchedSignal = new status_updated_signal_t();
- }
- mDataFetchedSignal->connect(cb);
+ if (mDataFetchedSignal == NULL)
+ {
+ mDataFetchedSignal = new status_updated_signal_t();
+ }
+ mDataFetchedSignal->connect(cb);
}
// Get/Post/Put requests to the SLM Server using the SLM API
@@ -893,7 +893,7 @@ void LLMarketplaceData::getSLMListingsCoro(LLUUID folderId)
// Extract the info from the results
for (LLSD::array_iterator it = result["listings"].beginArray();
it != result["listings"].endArray(); ++it)
- {
+ {
LLSD listing = *it;
int listingId = listing["id"].asInteger();
@@ -1033,7 +1033,7 @@ void LLMarketplaceData::createSLMListingCoro(LLUUID folderId, LLUUID versionId,
gInventory.notifyObservers();
return;
}
-
+
log_SLM_infos("Post /listings", status.getType(), result);
if (!result.has("listings") || !result["listings"].isArray() || result["listings"].size() == 0)
@@ -1079,7 +1079,7 @@ void LLMarketplaceData::updateSLMListingCoro(LLUUID folderId, S32 listingId, LLU
httpHeaders->append("Accept", "application/json");
httpHeaders->append("Content-Type", "application/json");
-
+
LLSD invInfo;
invInfo["listing_folder_id"] = folderId;
invInfo["version_folder_id"] = versionId;
@@ -1278,7 +1278,7 @@ void LLMarketplaceData::deleteSLMListingCoro(S32 listingId)
log_SLM_infos("Delete /listing", status.getType(), result);
- for (LLSD::array_iterator it = result["listings"].beginArray();
+ for (LLSD::array_iterator it = result["listings"].beginArray();
it != result["listings"].endArray(); ++it)
{
LLSD listing = *it;
@@ -1303,7 +1303,7 @@ std::string LLMarketplaceData::getSLMConnectURL(const std::string& route)
url += route;
}
}
- return url;
+ return url;
}
void LLMarketplaceData::setSLMStatus(U32 status)
@@ -1349,7 +1349,7 @@ bool LLMarketplaceData::createListing(const LLUUID& folder_id)
// Listing already exists -> exit with error
return false;
}
-
+
// Get the version folder: if there is only one subfolder, we will set it as a version folder immediately
S32 count = -1;
LLUUID version_id = getVersionFolderIfUnique(folder_id);
@@ -1357,7 +1357,7 @@ bool LLMarketplaceData::createListing(const LLUUID& folder_id)
{
count = compute_stock_count(version_id, true);
}
-
+
// Validate the count on hand
if (count == COMPUTE_STOCK_NOT_EVALUATED)
{
@@ -1368,7 +1368,7 @@ bool LLMarketplaceData::createListing(const LLUUID& folder_id)
// Post the listing creation request to SLM
createSLMListing(folder_id, version_id, count);
-
+
return true;
}
@@ -1384,21 +1384,21 @@ bool LLMarketplaceData::clearListing(const LLUUID& folder_id, S32 depth)
if (depth < 0)
{
depth = depth_nesting_in_marketplace(folder_id);
-
+
}
// Folder id can be the root of the listing or not so we need to retrieve the root first
LLUUID listing_uuid = (isListed(folder_id) ? folder_id : nested_parent_id(folder_id, depth));
S32 listing_id = getListingID(listing_uuid);
-
+
if (listing_id == 0)
{
// Listing doesn't exists -> exit with error
return false;
}
-
+
// Update the SLM Server so that this listing is deleted (actually, archived...)
deleteSLMListing(listing_id);
-
+
return true;
}
@@ -1409,26 +1409,26 @@ bool LLMarketplaceData::getListing(const LLUUID& folder_id, S32 depth)
// Folder doesn't exists -> exit with error
return false;
}
-
+
// Evaluate the depth if it wasn't passed as a parameter
if (depth < 0)
{
depth = depth_nesting_in_marketplace(folder_id);
-
+
}
// Folder id can be the root of the listing or not so we need to retrieve the root first
LLUUID listing_uuid = (isListed(folder_id) ? folder_id : nested_parent_id(folder_id, depth));
S32 listing_id = getListingID(listing_uuid);
-
+
if (listing_id == 0)
{
// Listing doesn't exists -> exit with error
return false;
}
-
+
// Get listing data from SLM
getSLMListing(listing_id);
-
+
return true;
}
@@ -1438,7 +1438,7 @@ bool LLMarketplaceData::getListing(S32 listing_id)
{
return false;
}
-
+
// Get listing data from SLM
getSLMListing(listing_id);
return true;
@@ -1450,7 +1450,7 @@ bool LLMarketplaceData::activateListing(const LLUUID& folder_id, bool activate,
if (depth < 0)
{
depth = depth_nesting_in_marketplace(folder_id);
-
+
}
// Folder id can be the root of the listing or not so we need to retrieve the root first
LLUUID listing_uuid = nested_parent_id(folder_id, depth);
@@ -1460,15 +1460,15 @@ bool LLMarketplaceData::activateListing(const LLUUID& folder_id, bool activate,
// Listing doesn't exists -> exit with error
return false;
}
-
+
if (getActivationState(listing_uuid) == activate)
{
// If activation state is unchanged, no point spamming SLM with an update
return true;
}
-
+
LLUUID version_uuid = getVersionFolder(listing_uuid);
-
+
// Also update the count on hand
S32 count = compute_stock_count(folder_id);
if (count == COMPUTE_STOCK_NOT_EVALUATED)
@@ -1477,10 +1477,10 @@ bool LLMarketplaceData::activateListing(const LLUUID& folder_id, bool activate,
// We are assuming that this issue is local and should not modify server side values
count = getCountOnHand(listing_uuid);
}
-
+
// Post the listing update request to SLM
updateSLMListing(listing_uuid, listing_id, version_uuid, activate, count);
-
+
return true;
}
@@ -1490,7 +1490,7 @@ bool LLMarketplaceData::setVersionFolder(const LLUUID& folder_id, const LLUUID&
if (depth < 0)
{
depth = depth_nesting_in_marketplace(folder_id);
-
+
}
// Folder id can be the root of the listing or not so we need to retrieve the root first
LLUUID listing_uuid = nested_parent_id(folder_id, depth);
@@ -1500,16 +1500,16 @@ bool LLMarketplaceData::setVersionFolder(const LLUUID& folder_id, const LLUUID&
// Listing doesn't exists -> exit with error
return false;
}
-
+
if (getVersionFolder(listing_uuid) == version_id)
{
// If version folder is unchanged, no point spamming SLM with an update
return true;
}
-
+
// Note: if the version_id is cleared, we need to unlist the listing, otherwise, state unchanged
bool is_listed = (version_id.isNull() ? false : getActivationState(listing_uuid));
-
+
// Also update the count on hand
S32 count = compute_stock_count(version_id);
if (count == COMPUTE_STOCK_NOT_EVALUATED)
@@ -1518,10 +1518,10 @@ bool LLMarketplaceData::setVersionFolder(const LLUUID& folder_id, const LLUUID&
// It will get reevaluated and updated once the items are fetched
count = 0;
}
-
+
// Post the listing update request to SLM
updateSLMListing(listing_uuid, listing_id, version_id, is_listed, count);
-
+
return true;
}
@@ -1531,7 +1531,7 @@ bool LLMarketplaceData::updateCountOnHand(const LLUUID& folder_id, S32 depth)
if (depth < 0)
{
depth = depth_nesting_in_marketplace(folder_id);
-
+
}
// Folder id can be the root of the listing or not so we need to retrieve the root first
LLUUID listing_uuid = nested_parent_id(folder_id, depth);
@@ -1541,7 +1541,7 @@ bool LLMarketplaceData::updateCountOnHand(const LLUUID& folder_id, S32 depth)
// Listing doesn't exists -> exit with error
return false;
}
-
+
// Compute the new count on hand
S32 count = compute_stock_count(folder_id);
@@ -1555,15 +1555,15 @@ bool LLMarketplaceData::updateCountOnHand(const LLUUID& folder_id, S32 depth)
// If local count on hand is not known at that point, do *not* force an update to SLM
return false;
}
-
+
// Get the unchanged values
bool is_listed = getActivationState(listing_uuid);
LLUUID version_uuid = getVersionFolder(listing_uuid);
-
+
// Post the listing update request to SLM
updateSLMListing(listing_uuid, listing_id, version_uuid, is_listed, count);
-
+
// Force the local value as it prevents spamming (count update may occur in burst when restocking)
// Note that if SLM has a good reason to return a different value, it'll be updated by the responder
setCountOnHand(listing_uuid, count, false);
@@ -1578,20 +1578,20 @@ bool LLMarketplaceData::associateListing(const LLUUID& folder_id, const LLUUID&
// Listing already exists -> exit with error
return false;
}
-
+
// Get the version folder: if there is only one subfolder, we will set it as a version folder immediately
LLUUID version_id = getVersionFolderIfUnique(folder_id);
-
+
// Post the listing associate request to SLM
associateSLMListing(folder_id, listing_id, version_id, source_folder_id);
-
+
return true;
}
// Methods privately called or called by SLM responders to perform changes
bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed, const std::string& edit_url, S32 count)
{
- mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id, listing_id, version_id, is_listed);
+ mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id, listing_id, version_id, is_listed);
mMarketplaceItems[folder_id].mEditURL = edit_url;
mMarketplaceItems[folder_id].mCountOnHand = count;
if (version_id.notNull())
@@ -1604,13 +1604,13 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, cons
bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update)
{
LLUUID version_folder = getVersionFolder(folder_id);
-
- if (mMarketplaceItems.erase(folder_id) != 1)
+
+ if (mMarketplaceItems.erase(folder_id) != 1)
{
return false;
}
mVersionFolders.erase(version_folder);
-
+
if (update)
{
update_marketplace_category(folder_id, false);
@@ -1625,7 +1625,7 @@ bool LLMarketplaceData::deleteListing(S32 listing_id, bool update)
{
return false;
}
-
+
LLUUID folder_id = getListingFolder(listing_id);
return deleteListing(folder_id, update);
}
@@ -1691,11 +1691,11 @@ std::string LLMarketplaceData::getListingURL(const LLUUID& folder_id, S32 depth)
if (depth < 0)
{
depth = depth_nesting_in_marketplace(folder_id);
-
+
}
LLUUID listing_uuid = nested_parent_id(folder_id, depth);
-
+
marketplace_items_list_t::iterator it = mMarketplaceItems.find(listing_uuid);
return (it == mMarketplaceItems.end() ? "" : (it->second).mEditURL);
}
@@ -1723,7 +1723,7 @@ bool LLMarketplaceData::isInActiveFolder(const LLUUID& obj_id, S32 depth)
if (depth < 0)
{
depth = depth_nesting_in_marketplace(obj_id);
-
+
}
LLUUID listing_uuid = nested_parent_id(obj_id, depth);
@@ -1738,9 +1738,9 @@ LLUUID LLMarketplaceData::getActiveFolder(const LLUUID& obj_id, S32 depth)
if (depth < 0)
{
depth = depth_nesting_in_marketplace(obj_id);
-
+
}
-
+
LLUUID listing_uuid = nested_parent_id(obj_id, depth);
return (getActivationState(listing_uuid) ? getVersionFolder(listing_uuid) : LLUUID::null);
}
@@ -1818,9 +1818,9 @@ bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id, bo
{
return false;
}
-
+
(it->second).mListingId = listing_id;
-
+
if (update)
{
update_marketplace_category(folder_id, false);
@@ -1836,7 +1836,7 @@ bool LLMarketplaceData::setCountOnHand(const LLUUID& folder_id, S32 count, bool
{
return false;
}
-
+
(it->second).mCountOnHand = count;
return true;
@@ -1849,20 +1849,20 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID
{
return false;
}
-
+
LLUUID old_version_id = (it->second).mVersionFolderId;
if (old_version_id == version_id)
{
return false;
}
-
+
(it->second).mVersionFolderId = version_id;
mVersionFolders.erase(old_version_id);
if (version_id.notNull())
{
mVersionFolders[version_id] = folder_id;
}
-
+
if (update)
{
update_marketplace_category(old_version_id, false);
@@ -1881,7 +1881,7 @@ bool LLMarketplaceData::setActivationState(const LLUUID& folder_id, bool activat
}
(it->second).mIsActive = activate;
-
+
if (update)
{
update_marketplace_category((it->second).mListingFolderId, false);
@@ -1897,7 +1897,7 @@ bool LLMarketplaceData::setListingURL(const LLUUID& folder_id, const std::string
{
return false;
}
-
+
(it->second).mEditURL = edit_url;
return true;
}
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index 24fdc5e0ad..281743c1d6 100644
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llmarketplacefunctions.h
* @brief Miscellaneous marketplace-related functions and classes
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,82 +40,82 @@
namespace MarketplaceErrorCodes
{
- enum eCode
- {
- IMPORT_DONE = 200,
- IMPORT_PROCESSING = 202,
- IMPORT_REDIRECT = 302,
- IMPORT_BAD_REQUEST = 400,
- IMPORT_AUTHENTICATION_ERROR = 401,
- IMPORT_FORBIDDEN = 403,
- IMPORT_NOT_FOUND = 404,
- IMPORT_DONE_WITH_ERRORS = 409,
- IMPORT_JOB_FAILED = 410,
- IMPORT_JOB_TIMEOUT = 499,
- IMPORT_SERVER_SITE_DOWN = 500,
- IMPORT_SERVER_API_DISABLED = 503,
- };
+ enum eCode
+ {
+ IMPORT_DONE = 200,
+ IMPORT_PROCESSING = 202,
+ IMPORT_REDIRECT = 302,
+ IMPORT_BAD_REQUEST = 400,
+ IMPORT_AUTHENTICATION_ERROR = 401,
+ IMPORT_FORBIDDEN = 403,
+ IMPORT_NOT_FOUND = 404,
+ IMPORT_DONE_WITH_ERRORS = 409,
+ IMPORT_JOB_FAILED = 410,
+ IMPORT_JOB_TIMEOUT = 499,
+ IMPORT_SERVER_SITE_DOWN = 500,
+ IMPORT_SERVER_API_DISABLED = 503,
+ };
}
namespace MarketplaceStatusCodes
{
- enum sCode
- {
- MARKET_PLACE_NOT_INITIALIZED = 0,
- MARKET_PLACE_INITIALIZING = 1,
- MARKET_PLACE_CONNECTION_FAILURE = 2,
- MARKET_PLACE_NOT_MERCHANT = 3,
- MARKET_PLACE_MERCHANT = 4,
+ enum sCode
+ {
+ MARKET_PLACE_NOT_INITIALIZED = 0,
+ MARKET_PLACE_INITIALIZING = 1,
+ MARKET_PLACE_CONNECTION_FAILURE = 2,
+ MARKET_PLACE_NOT_MERCHANT = 3,
+ MARKET_PLACE_MERCHANT = 4,
MARKET_PLACE_NOT_MIGRATED_MERCHANT = 5,
MARKET_PLACE_MIGRATED_MERCHANT = 6
- };
+ };
}
namespace MarketplaceFetchCodes
{
- enum sCode
- {
- MARKET_FETCH_NOT_DONE = 0,
- MARKET_FETCH_LOADING = 1,
- MARKET_FETCH_FAILED = 2,
- MARKET_FETCH_DONE = 3
- };
+ enum sCode
+ {
+ MARKET_FETCH_NOT_DONE = 0,
+ MARKET_FETCH_LOADING = 1,
+ MARKET_FETCH_FAILED = 2,
+ MARKET_FETCH_DONE = 3
+ };
}
class LLMarketplaceInventoryImporter
- : public LLSingleton<LLMarketplaceInventoryImporter>
+ : public LLSingleton<LLMarketplaceInventoryImporter>
{
- LLSINGLETON(LLMarketplaceInventoryImporter);
+ LLSINGLETON(LLMarketplaceInventoryImporter);
public:
- static void update();
-
- typedef boost::signals2::signal<void (bool)> status_changed_signal_t;
- typedef boost::signals2::signal<void (U32, const LLSD&)> status_report_signal_t;
-
- boost::signals2::connection setInitializationErrorCallback(const status_report_signal_t::slot_type& cb);
- boost::signals2::connection setStatusChangedCallback(const status_changed_signal_t::slot_type& cb);
- boost::signals2::connection setStatusReportCallback(const status_report_signal_t::slot_type& cb);
-
- void initialize();
- bool triggerImport();
- bool isImportInProgress() const { return mImportInProgress; }
- bool isInitialized() const { return mInitialized; }
- U32 getMarketPlaceStatus() const { return mMarketPlaceStatus; }
-
+ static void update();
+
+ typedef boost::signals2::signal<void (bool)> status_changed_signal_t;
+ typedef boost::signals2::signal<void (U32, const LLSD&)> status_report_signal_t;
+
+ boost::signals2::connection setInitializationErrorCallback(const status_report_signal_t::slot_type& cb);
+ boost::signals2::connection setStatusChangedCallback(const status_changed_signal_t::slot_type& cb);
+ boost::signals2::connection setStatusReportCallback(const status_report_signal_t::slot_type& cb);
+
+ void initialize();
+ bool triggerImport();
+ bool isImportInProgress() const { return mImportInProgress; }
+ bool isInitialized() const { return mInitialized; }
+ U32 getMarketPlaceStatus() const { return mMarketPlaceStatus; }
+
protected:
- void reinitializeAndTriggerImport();
- void updateImport();
-
+ void reinitializeAndTriggerImport();
+ void updateImport();
+
private:
- bool mAutoTriggerImport;
- bool mImportInProgress;
- bool mInitialized;
- U32 mMarketPlaceStatus;
-
- status_report_signal_t * mErrorInitSignal;
- status_changed_signal_t * mStatusChangedSignal;
- status_report_signal_t * mStatusReportSignal;
+ bool mAutoTriggerImport;
+ bool mImportInProgress;
+ bool mInitialized;
+ U32 mMarketPlaceStatus;
+
+ status_report_signal_t * mErrorInitSignal;
+ status_changed_signal_t * mStatusChangedSignal;
+ status_report_signal_t * mStatusReportSignal;
};
@@ -127,28 +127,28 @@ private:
// * signal Marketplace updates to inventory
namespace SLMErrorCodes
{
- enum eCode
- {
- SLM_SUCCESS = 200,
- SLM_RECORD_CREATED = 201,
- SLM_MALFORMED_PAYLOAD = 400,
- SLM_NOT_FOUND = 404,
- };
+ enum eCode
+ {
+ SLM_SUCCESS = 200,
+ SLM_RECORD_CREATED = 201,
+ SLM_MALFORMED_PAYLOAD = 400,
+ SLM_NOT_FOUND = 404,
+ };
}
class LLMarketplaceData;
class LLInventoryObserver;
// A Marketplace item is known by its tuple
-class LLMarketplaceTuple
+class LLMarketplaceTuple
{
public:
- friend class LLMarketplaceData;
+ friend class LLMarketplaceData;
LLMarketplaceTuple();
LLMarketplaceTuple(const LLUUID& folder_id);
LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed = false);
-
+
private:
// Representation of a marketplace item in the Marketplace DB (well, what we know of it...)
LLUUID mListingFolderId;
@@ -195,11 +195,11 @@ public:
static LLSD getMarketplaceStringSubstitutions();
// Public SLM API : Initialization and status
- typedef boost::signals2::signal<void ()> status_updated_signal_t;
+ typedef boost::signals2::signal<void ()> status_updated_signal_t;
void initializeSLM(const status_updated_signal_t::slot_type& cb);
- U32 getSLMStatus() const { return mMarketPlaceStatus; }
+ U32 getSLMStatus() const { return mMarketPlaceStatus; }
std::string getSLMConnectionfailureReason() { return mMarketPlaceFailureReason; }
- void setSLMStatus(U32 status);
+ void setSLMStatus(U32 status);
void setSLMConnectionFailure(const std::string& reason);
void getSLMListings();
bool isEmpty() { return (mMarketplaceItems.size() == 0); }
@@ -219,7 +219,7 @@ public:
bool getListing(const LLUUID& folder_id, S32 depth = -1);
bool getListing(S32 listing_id);
bool deleteListing(S32 listing_id, bool update = true);
-
+
// Probe the Marketplace data set to identify folders
bool isListed(const LLUUID& folder_id); // returns true if folder_id is a Listing folder
bool isListedAndActive(const LLUUID& folder_id); // returns true if folder_id is an active (listed) Listing folder
@@ -227,7 +227,7 @@ public:
bool isInActiveFolder(const LLUUID& obj_id, S32 depth = -1); // returns true if the obj_id is buried in an active version folder
LLUUID getActiveFolder(const LLUUID& obj_id, S32 depth = -1); // returns the UUID of the active version folder obj_id is in
bool isUpdating(const LLUUID& folder_id, S32 depth = -1); // returns true if we're waiting from SLM incoming data for folder_id
-
+
// Access Marketplace data set : each method returns a default value if the argument can't be found
bool getActivationState(const LLUUID& folder_id);
S32 getListingID(const LLUUID& folder_id);
@@ -235,12 +235,12 @@ public:
std::string getListingURL(const LLUUID& folder_id, S32 depth = -1);
LLUUID getListingFolder(S32 listing_id);
S32 getCountOnHand(const LLUUID& folder_id);
-
+
// Used to flag if stock count values for Marketplace have to be updated
bool checkDirtyCount() { if (mDirtyCount) { mDirtyCount = false; return true; } else { return false; } }
void setDirtyCount() { mDirtyCount = true; }
void setUpdating(const LLUUID& folder_id, bool isUpdating);
-
+
// Used to decide when to run a validation on listing folders
bool hasValidationWaiting() { return mValidationWaitingList.size() > 0; }
void setValidationWaiting(const LLUUID& folder_id, S32 count);
@@ -256,7 +256,7 @@ private:
bool setActivationState(const LLUUID& folder_id, bool activate, bool update = true);
bool setListingURL(const LLUUID& folder_id, const std::string& edit_url, bool update = true);
bool setCountOnHand(const LLUUID& folder_id, S32 count, bool update = true);
-
+
// Private SLM API : package data and get/post/put requests to the SLM Server through the SLM API
void createSLMListing(const LLUUID& folder_id, const LLUUID& version_id, S32 count);
void getSLMListing(S32 listing_id);
@@ -274,21 +274,21 @@ private:
void deleteSLMListingCoro(S32 listingId);
// Handling Marketplace connection and inventory connection
- U32 mMarketPlaceStatus;
+ U32 mMarketPlaceStatus;
std::string mMarketPlaceFailureReason;
- status_updated_signal_t* mStatusUpdatedSignal;
- LLInventoryObserver* mInventoryObserver;
+ status_updated_signal_t* mStatusUpdatedSignal;
+ LLInventoryObserver* mInventoryObserver;
bool mDirtyCount; // If true, stock count value need to be updated at the next check
-
+
// Update data
U32 mMarketPlaceDataFetched;
- status_updated_signal_t* mDataFetchedSignal;
+ status_updated_signal_t* mDataFetchedSignal;
std::set<LLUUID> mPendingUpdateSet;
// Listing folders waiting for validation
typedef std::map<LLUUID,S32> waiting_list_t;
waiting_list_t mValidationWaitingList;
-
+
// The cache of SLM data (at last...)
marketplace_items_list_t mMarketplaceItems;
// We need a list (version folder -> listing folder) because such reverse lookups are frequent
diff --git a/indra/newview/llmarketplacenotifications.cpp b/indra/newview/llmarketplacenotifications.cpp
index 02bd9e1f34..04996af8a0 100644
--- a/indra/newview/llmarketplacenotifications.cpp
+++ b/indra/newview/llmarketplacenotifications.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llmarketplacenotifications.cpp
* @brief Handler for notifications related to marketplace file I/O
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,52 +38,52 @@
namespace LLMarketplaceInventoryNotifications
{
- typedef boost::signals2::signal<void (const LLSD& param)> no_copy_payload_cb_signal_t;
-
- static no_copy_payload_cb_signal_t* no_copy_cb_action = NULL;
- static bool no_copy_notify_active = false;
- static std::list<LLSD> no_copy_payloads;
-
- void notifyNoCopyCallback(const LLSD& notification, const LLSD& response)
- {
- const S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- if (option == 0)
- {
- llassert(!no_copy_payloads.empty());
- llassert(no_copy_cb_action != NULL);
-
- for (const LLSD& payload : no_copy_payloads)
- {
- (*no_copy_cb_action)(payload);
- }
- }
-
- delete no_copy_cb_action;
- no_copy_cb_action = NULL;
-
- no_copy_notify_active = false;
- no_copy_payloads.clear();
- }
-
- void update()
- {
- if (!no_copy_notify_active && !no_copy_payloads.empty())
- {
- no_copy_notify_active = true;
-
- LLNotificationsUtil::add("ConfirmNoCopyToOutbox", LLSD(), LLSD(), boost::bind(&notifyNoCopyCallback, _1, _2));
- }
- }
-
- void addNoCopyNotification(const LLSD& payload, const NoCopyCallbackFunction& cb)
- {
- if (no_copy_cb_action == NULL)
- {
- no_copy_cb_action = new no_copy_payload_cb_signal_t;
- no_copy_cb_action->connect(boost::bind(cb, _1));
- }
-
- no_copy_payloads.push_back(payload);
- }
+ typedef boost::signals2::signal<void (const LLSD& param)> no_copy_payload_cb_signal_t;
+
+ static no_copy_payload_cb_signal_t* no_copy_cb_action = NULL;
+ static bool no_copy_notify_active = false;
+ static std::list<LLSD> no_copy_payloads;
+
+ void notifyNoCopyCallback(const LLSD& notification, const LLSD& response)
+ {
+ const S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ if (option == 0)
+ {
+ llassert(!no_copy_payloads.empty());
+ llassert(no_copy_cb_action != NULL);
+
+ for (const LLSD& payload : no_copy_payloads)
+ {
+ (*no_copy_cb_action)(payload);
+ }
+ }
+
+ delete no_copy_cb_action;
+ no_copy_cb_action = NULL;
+
+ no_copy_notify_active = false;
+ no_copy_payloads.clear();
+ }
+
+ void update()
+ {
+ if (!no_copy_notify_active && !no_copy_payloads.empty())
+ {
+ no_copy_notify_active = true;
+
+ LLNotificationsUtil::add("ConfirmNoCopyToOutbox", LLSD(), LLSD(), boost::bind(&notifyNoCopyCallback, _1, _2));
+ }
+ }
+
+ void addNoCopyNotification(const LLSD& payload, const NoCopyCallbackFunction& cb)
+ {
+ if (no_copy_cb_action == NULL)
+ {
+ no_copy_cb_action = new no_copy_payload_cb_signal_t;
+ no_copy_cb_action->connect(boost::bind(cb, _1));
+ }
+
+ no_copy_payloads.push_back(payload);
+ }
}
diff --git a/indra/newview/llmarketplacenotifications.h b/indra/newview/llmarketplacenotifications.h
index 83a4e163c7..a602b930de 100644
--- a/indra/newview/llmarketplacenotifications.h
+++ b/indra/newview/llmarketplacenotifications.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llmarketplacenotifications.h
* @brief Handler for notifications related to marketplace file I/O
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,11 +46,11 @@
namespace LLMarketplaceInventoryNotifications
{
- void update();
+ void update();
+
+ typedef boost::function<void (const LLSD&)> NoCopyCallbackFunction;
- typedef boost::function<void (const LLSD&)> NoCopyCallbackFunction;
-
- void addNoCopyNotification(const LLSD& payload, const NoCopyCallbackFunction& cb);
+ void addNoCopyNotification(const LLSD& payload, const NoCopyCallbackFunction& cb);
};
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index b7828db3a9..b7811dfb43 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmaterialeditor.cpp
* @brief Implementation of the gltf material editor
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,7 +48,7 @@
#include "llviewertexture.h"
#include "llsdutil.h"
#include "llselectmgr.h"
-#include "llstatusbar.h" // can_afford_transaction()
+#include "llstatusbar.h" // can_afford_transaction()
#include "lltoolpie.h"
#include "llviewerinventory.h"
#include "llinventory.h"
@@ -503,7 +503,7 @@ BOOL LLMaterialEditor::postBuild()
// Apply changes to object live
applyToSelection();
};
-
+
childSetCommitCallback("double sided", changes_callback, (void*)&MATERIAL_DOUBLE_SIDED_DIRTY);
// BaseColor
@@ -551,7 +551,7 @@ BOOL LLMaterialEditor::postBuild()
// Disable/enable setCanApplyImmediately() based on
// working from inventory, upload or editing inworld
- return LLPreview::postBuild();
+ return LLPreview::postBuild();
}
void LLMaterialEditor::onClickCloseBtn(bool app_quitting)
@@ -1228,7 +1228,7 @@ std::string LLMaterialEditor::getEncodedAsset()
bool LLMaterialEditor::decodeAsset(const std::vector<char>& buffer)
{
LLSD asset;
-
+
std::istrstream str(&buffer[0], buffer.size());
if (LLSDSerialize::deserialize(asset, str, buffer.size()))
{
@@ -1292,7 +1292,7 @@ const std::string LLMaterialEditor::buildMaterialDescription()
desc << LLTrans::getString("Material Texture Name Header");
// add the texture names for each just so long as the material
- // we loaded has an entry for it (i think testing the texture
+ // we loaded has an entry for it (i think testing the texture
// control UUI for NULL is a valid metric for if it was loaded
// or not but I suspect this code will change a lot so may need
// to revisit
@@ -1374,7 +1374,7 @@ bool LLMaterialEditor::saveIfNeeded()
}
}
else
- {
+ {
// Make a new inventory item and set upload permissions
LLPermissions local_permissions;
local_permissions.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
@@ -1403,7 +1403,7 @@ bool LLMaterialEditor::saveIfNeeded()
// We do not update floater with uploaded asset yet, so just close it.
closeFloater();
}
-
+
return true;
}
@@ -1818,7 +1818,7 @@ void LLMaterialEditor::onSaveAsMsgCallback(const LLSD& notification, const LLSD&
}
else
{
- LLNotificationsUtil::add("InvalidMaterialName", LLSD(), LLSD(), [this](const LLSD& notification, const LLSD& response)
+ LLNotificationsUtil::add("InvalidMaterialName", LLSD(), LLSD(), [this](const LLSD& notification, const LLSD& response)
{
LLNotificationsUtil::add("SaveMaterialAs", LLSD().with("DESC", mMaterialName), LLSD(),
boost::bind(&LLMaterialEditor::onSaveAsMsgCallback, this, _1, _2));
@@ -1978,7 +1978,7 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind
std::list<std::string> material_list;
std::vector<tinygltf::Material>::const_iterator mat_iter = model_in.materials.begin();
std::vector<tinygltf::Material>::const_iterator mat_end = model_in.materials.end();
-
+
for (; mat_iter != mat_end; mat_iter++)
{
std::string mat_name = mat_iter->name;
@@ -2617,28 +2617,28 @@ bool LLMaterialEditor::setFromGltfModel(const tinygltf::Model& model, S32 index,
}
/**
- * Build a texture name from the contents of the (in tinyGLFT parlance)
+ * Build a texture name from the contents of the (in tinyGLFT parlance)
* Image URI. This often is filepath to the original image on the users'
* local file system.
*/
const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, const std::string texture_type)
{
- // getBaseFileName() works differently on each platform and file patchs
- // can contain both types of delimiter so unify them then extract the
+ // getBaseFileName() works differently on each platform and file patchs
+ // can contain both types of delimiter so unify them then extract the
// base name (no path or extension)
std::replace(image_uri.begin(), image_uri.end(), '\\', gDirUtilp->getDirDelimiter()[0]);
std::replace(image_uri.begin(), image_uri.end(), '/', gDirUtilp->getDirDelimiter()[0]);
const bool strip_extension = true;
std::string stripped_uri = gDirUtilp->getBaseFileName(image_uri, strip_extension);
- // sometimes they can be really long and unwieldy - 64 chars is enough for anyone :)
+ // sometimes they can be really long and unwieldy - 64 chars is enough for anyone :)
const int max_texture_name_length = 64;
if (stripped_uri.length() > max_texture_name_length)
{
stripped_uri = stripped_uri.substr(0, max_texture_name_length - 1);
}
- // We intend to append the type of texture (base color, emissive etc.) to the
+ // We intend to append the type of texture (base color, emissive etc.) to the
// name of the texture but sometimes the creator already did that. To try
// to avoid repeats (not perfect), we look for the texture type in the name
// and if we find it, do not append the type, later on. One way this fails
@@ -2704,15 +2704,15 @@ const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, c
/**
* Update the metadata for the material based on what we find in the loaded
* file (along with some assumptions and interpretations...). Fields include
- * the name of the material, a material description and the names of the
+ * the name of the material, a material description and the names of the
* composite textures.
*/
void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const tinygltf::Model& model, S32 index)
{
- // Use the name (without any path/extension) of the file that was
- // uploaded as the base of the material name. Then if the name of the
+ // Use the name (without any path/extension) of the file that was
+ // uploaded as the base of the material name. Then if the name of the
// scene is present and not blank, append that and use the result as
- // the name of the material. This is a first pass at creating a
+ // the name of the material. This is a first pass at creating a
// naming scheme that is useful to real content creators and hopefully
// avoid 500 materials in your inventory called "scene" or "Default"
const bool strip_extension = true;
@@ -2743,10 +2743,10 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti
// scene name isn't present so no point using it
}
- // If we have a valid material or scene name, use it to build the short and
- // long versions of the material name. The long version is used
+ // If we have a valid material or scene name, use it to build the short and
+ // long versions of the material name. The long version is used
// as you might expect, for the material name. The short version is
- // used as part of the image/texture name - the theory is that will
+ // used as part of the image/texture name - the theory is that will
// allow content creators to track the material and the corresponding
// textures
if (material_name.length())
@@ -2754,9 +2754,9 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti
mMaterialNameShort = base_filename;
mMaterialName = STRINGIZE(
- base_filename <<
- " " <<
- "(" <<
+ base_filename <<
+ " " <<
+ "(" <<
material_name <<
")"
);
@@ -2772,14 +2772,14 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti
LLInventoryObject::correctInventoryName(mMaterialName);
LLInventoryObject::correctInventoryName(mMaterialNameShort);
- // We also set the title of the floater to match the
+ // We also set the title of the floater to match the
// name of the material
setTitle(mMaterialName);
/**
- * Extract / derive the names of each composite texture. For each, the
+ * Extract / derive the names of each composite texture. For each, the
* index is used to to determine which of the "Images" is used. If the index
- * is -1 then that texture type is not present in the material (Seems to be
+ * is -1 then that texture type is not present in the material (Seems to be
* quite common that a material is missing 1 or more types of texture)
*/
if (model.materials.size() > index)
@@ -2787,8 +2787,8 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti
const tinygltf::Material& first_material = model.materials[index];
mBaseColorName = MATERIAL_BASE_COLOR_DEFAULT_NAME;
- // note: unlike the other textures, base color doesn't have its own entry
- // in the tinyGLTF Material struct. Rather, it is taken from a
+ // note: unlike the other textures, base color doesn't have its own entry
+ // in the tinyGLTF Material struct. Rather, it is taken from a
// sub-texture in the pbrMetallicRoughness member
int index = first_material.pbrMetallicRoughness.baseColorTexture.index;
if (index > -1 && index < model.images.size())
@@ -2942,7 +2942,7 @@ public:
else
{
// mSavedGLTFOverrideMaterials[te] being present but null
- // means we need to use a default value
+ // means we need to use a default value
revert_mat = new LLGLTFMaterial();
}
}
@@ -3283,7 +3283,7 @@ bool LLMaterialEditor::setFromSelection()
// Ovverdired might have been updated,
// refresh state of local textures in overrides
- //
+ //
// Todo: this probably shouldn't be here, but in localbitmap,
// subscried to all material overrides if we want copied
// objects to get properly updated as well
@@ -3306,7 +3306,7 @@ void LLMaterialEditor::loadAsset()
{
item = getItem();
}
-
+
bool fail = false;
if (item)
@@ -3511,16 +3511,16 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con
LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLNewBufferedResourceUploadInfo>(
buffer,
asset_id,
- name,
- name,
+ name,
+ name,
0,
- LLFolderType::FT_TEXTURE,
+ LLFolderType::FT_TEXTURE,
LLInventoryType::IT_TEXTURE,
LLAssetType::AT_TEXTURE,
LLFloaterPerms::getNextOwnerPerms("Uploads"),
LLFloaterPerms::getGroupPerms("Uploads"),
LLFloaterPerms::getEveryonePerms("Uploads"),
- expected_upload_cost,
+ expected_upload_cost,
false,
cb,
failed_upload));
diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h
index 4e0350b4cc..dda65476af 100644
--- a/indra/newview/llmaterialeditor.h
+++ b/indra/newview/llmaterialeditor.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmaterialeditor.h
* @brief LLMaterialEditor class header file
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,7 +55,7 @@ public:
LLFloaterComboOptions();
virtual ~LLFloaterComboOptions();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
static LLFloaterComboOptions* showUI(
combo_callback callback,
@@ -86,7 +86,7 @@ protected:
class LLMaterialEditor : public LLPreview, public LLVOInventoryListener
{ public:
- LLMaterialEditor(const LLSD& key);
+ LLMaterialEditor(const LLSD& key);
~LLMaterialEditor();
bool setFromGltfModel(const tinygltf::Model& model, S32 index, bool set_textures = false);
@@ -163,8 +163,8 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener
void setObjectID(const LLUUID& object_id) override;
void setAuxItem(const LLInventoryItem* item) override;
- // llpanel
- BOOL postBuild() override;
+ // llpanel
+ BOOL postBuild() override;
void onClickCloseBtn(bool app_quitting = false) override;
void onClose(bool app_quitting) override;
@@ -188,7 +188,7 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener
F32 getAlphaCutoff();
void setAlphaCutoff(F32 alpha_cutoff);
-
+
void setMaterialName(const std::string &name);
LLUUID getMetallicRoughnessId();
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index 577ab0048f..271a35ba42 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -66,27 +66,27 @@
class LLMaterialHttpHandler : public LLHttpSDHandler
{
-public:
- typedef boost::function<void(bool, const LLSD&)> CallbackFunction;
- typedef std::shared_ptr<LLMaterialHttpHandler> ptr_t;
+public:
+ typedef boost::function<void(bool, const LLSD&)> CallbackFunction;
+ typedef std::shared_ptr<LLMaterialHttpHandler> ptr_t;
- LLMaterialHttpHandler(const std::string& method, CallbackFunction cback);
+ LLMaterialHttpHandler(const std::string& method, CallbackFunction cback);
- virtual ~LLMaterialHttpHandler();
+ virtual ~LLMaterialHttpHandler();
protected:
- virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content);
- virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);
+ virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content);
+ virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);
private:
- std::string mMethod;
- CallbackFunction mCallback;
+ std::string mMethod;
+ CallbackFunction mCallback;
};
LLMaterialHttpHandler::LLMaterialHttpHandler(const std::string& method, CallbackFunction cback):
- LLHttpSDHandler(),
- mMethod(method),
- mCallback(cback)
+ LLHttpSDHandler(),
+ mMethod(method),
+ mCallback(cback)
{
}
@@ -97,21 +97,21 @@ LLMaterialHttpHandler::~LLMaterialHttpHandler()
void LLMaterialHttpHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content)
{
- LL_DEBUGS("Materials") << LL_ENDL;
- mCallback(true, content);
+ LL_DEBUGS("Materials") << LL_ENDL;
+ mCallback(true, content);
}
void LLMaterialHttpHandler::onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status)
{
- LL_WARNS("Materials")
- << "\n--------------------------------------------------------------------------\n"
- << mMethod << " Error[" << status.toULong() << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME
- << "'\n with url '" << response->getRequestURL() << "' because " << status.toString()
- << "\n--------------------------------------------------------------------------"
- << LL_ENDL;
-
- LLSD emptyResult;
- mCallback(false, emptyResult);
+ LL_WARNS("Materials")
+ << "\n--------------------------------------------------------------------------\n"
+ << mMethod << " Error[" << status.toULong() << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME
+ << "'\n with url '" << response->getRequestURL() << "' because " << status.toString()
+ << "\n--------------------------------------------------------------------------"
+ << LL_ENDL;
+
+ LLSD emptyResult;
+ mCallback(false, emptyResult);
}
@@ -120,481 +120,481 @@ void LLMaterialHttpHandler::onFailure(LLCore::HttpResponse * response, LLCore::H
* LLMaterialMgr class
*/
LLMaterialMgr::LLMaterialMgr():
- mGetQueue(),
- mGetPending(),
- mGetCallbacks(),
- mGetTECallbacks(),
- mGetAllQueue(),
- mGetAllRequested(),
- mGetAllPending(),
- mGetAllCallbacks(),
- mPutQueue(),
- mMaterials(),
- mHttpRequest(),
- mHttpHeaders(),
- mHttpOptions(),
- mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID)
+ mGetQueue(),
+ mGetPending(),
+ mGetCallbacks(),
+ mGetTECallbacks(),
+ mGetAllQueue(),
+ mGetAllRequested(),
+ mGetAllPending(),
+ mGetAllCallbacks(),
+ mPutQueue(),
+ mMaterials(),
+ mHttpRequest(),
+ mHttpHeaders(),
+ mHttpOptions(),
+ mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID)
{
- LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
+ LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
- mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest());
- mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
- mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions());
- mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_MATERIALS);
+ mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest());
+ mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
+ mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions());
+ mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_MATERIALS);
- mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(LLMaterialID::null, LLMaterialPtr(NULL)));
- gIdleCallbacks.addFunction(&LLMaterialMgr::onIdle, NULL);
- LLWorld::instance().setRegionRemovedCallback(boost::bind(&LLMaterialMgr::onRegionRemoved, this, _1));
+ mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(LLMaterialID::null, LLMaterialPtr(NULL)));
+ gIdleCallbacks.addFunction(&LLMaterialMgr::onIdle, NULL);
+ LLWorld::instance().setRegionRemovedCallback(boost::bind(&LLMaterialMgr::onRegionRemoved, this, _1));
}
LLMaterialMgr::~LLMaterialMgr()
{
- gIdleCallbacks.deleteFunction(&LLMaterialMgr::onIdle, NULL);
+ gIdleCallbacks.deleteFunction(&LLMaterialMgr::onIdle, NULL);
}
bool LLMaterialMgr::isGetPending(const LLUUID& region_id, const LLMaterialID& material_id) const
{
- get_pending_map_t::const_iterator itPending = mGetPending.find(pending_material_t(region_id, material_id));
- return (mGetPending.end() != itPending) && (LLFrameTimer::getTotalSeconds() < itPending->second + MATERIALS_POST_TIMEOUT);
+ get_pending_map_t::const_iterator itPending = mGetPending.find(pending_material_t(region_id, material_id));
+ return (mGetPending.end() != itPending) && (LLFrameTimer::getTotalSeconds() < itPending->second + MATERIALS_POST_TIMEOUT);
}
void LLMaterialMgr::markGetPending(const LLUUID& region_id, const LLMaterialID& material_id)
{
- get_pending_map_t::iterator itPending = mGetPending.find(pending_material_t(region_id, material_id));
- if (mGetPending.end() == itPending)
- {
- mGetPending.insert(std::pair<pending_material_t, F64>(pending_material_t(region_id, material_id), LLFrameTimer::getTotalSeconds()));
- }
- else
- {
- itPending->second = LLFrameTimer::getTotalSeconds();
- }
+ get_pending_map_t::iterator itPending = mGetPending.find(pending_material_t(region_id, material_id));
+ if (mGetPending.end() == itPending)
+ {
+ mGetPending.insert(std::pair<pending_material_t, F64>(pending_material_t(region_id, material_id), LLFrameTimer::getTotalSeconds()));
+ }
+ else
+ {
+ itPending->second = LLFrameTimer::getTotalSeconds();
+ }
}
const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id)
{
- LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL;
- LLMaterialPtr material;
- material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
- if (mMaterials.end() != itMaterial)
- {
- material = itMaterial->second;
- LL_DEBUGS("Materials") << " found material " << LL_ENDL;
- }
- else
- {
- if (!isGetPending(region_id, material_id))
- {
- LL_DEBUGS("Materials") << " material pending " << material_id << LL_ENDL;
- get_queue_t::iterator itQueue = mGetQueue.find(region_id);
- if (mGetQueue.end() == itQueue)
- {
- LL_DEBUGS("Materials") << "mGetQueue add region " << region_id << " pending " << material_id << LL_ENDL;
- std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
- itQueue = ret.first;
- }
- itQueue->second.insert(material_id);
- markGetPending(region_id, material_id);
- }
- LL_DEBUGS("Materials") << " returning empty material " << LL_ENDL;
- material = LLMaterialPtr();
- }
- return material;
+ LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL;
+ LLMaterialPtr material;
+ material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
+ if (mMaterials.end() != itMaterial)
+ {
+ material = itMaterial->second;
+ LL_DEBUGS("Materials") << " found material " << LL_ENDL;
+ }
+ else
+ {
+ if (!isGetPending(region_id, material_id))
+ {
+ LL_DEBUGS("Materials") << " material pending " << material_id << LL_ENDL;
+ get_queue_t::iterator itQueue = mGetQueue.find(region_id);
+ if (mGetQueue.end() == itQueue)
+ {
+ LL_DEBUGS("Materials") << "mGetQueue add region " << region_id << " pending " << material_id << LL_ENDL;
+ std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
+ itQueue = ret.first;
+ }
+ itQueue->second.insert(material_id);
+ markGetPending(region_id, material_id);
+ }
+ LL_DEBUGS("Materials") << " returning empty material " << LL_ENDL;
+ material = LLMaterialPtr();
+ }
+ return material;
}
boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id, LLMaterialMgr::get_callback_t::slot_type cb)
{
- boost::signals2::connection connection;
-
- material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
- if (itMaterial != mMaterials.end())
- {
- LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL;
- get_callback_t signal;
- signal.connect(cb);
- signal(material_id, itMaterial->second);
- connection = boost::signals2::connection();
- }
- else
- {
- if (!isGetPending(region_id, material_id))
- {
- get_queue_t::iterator itQueue = mGetQueue.find(region_id);
- if (mGetQueue.end() == itQueue)
- {
- LL_DEBUGS("Materials") << "mGetQueue inserting region "<<region_id << LL_ENDL;
- std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
- itQueue = ret.first;
- }
- LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL;
- itQueue->second.insert(material_id);
- markGetPending(region_id, material_id);
- }
-
- get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
- if (itCallback == mGetCallbacks.end())
- {
- std::pair<get_callback_map_t::iterator, bool> ret = mGetCallbacks.insert(std::pair<LLMaterialID, get_callback_t*>(material_id, new get_callback_t()));
- itCallback = ret.first;
- }
- connection = itCallback->second->connect(cb);;
- }
-
- return connection;
+ boost::signals2::connection connection;
+
+ material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
+ if (itMaterial != mMaterials.end())
+ {
+ LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL;
+ get_callback_t signal;
+ signal.connect(cb);
+ signal(material_id, itMaterial->second);
+ connection = boost::signals2::connection();
+ }
+ else
+ {
+ if (!isGetPending(region_id, material_id))
+ {
+ get_queue_t::iterator itQueue = mGetQueue.find(region_id);
+ if (mGetQueue.end() == itQueue)
+ {
+ LL_DEBUGS("Materials") << "mGetQueue inserting region "<<region_id << LL_ENDL;
+ std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
+ itQueue = ret.first;
+ }
+ LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL;
+ itQueue->second.insert(material_id);
+ markGetPending(region_id, material_id);
+ }
+
+ get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
+ if (itCallback == mGetCallbacks.end())
+ {
+ std::pair<get_callback_map_t::iterator, bool> ret = mGetCallbacks.insert(std::pair<LLMaterialID, get_callback_t*>(material_id, new get_callback_t()));
+ itCallback = ret.first;
+ }
+ connection = itCallback->second->connect(cb);;
+ }
+
+ return connection;
}
boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb)
{
- boost::signals2::connection connection;
-
- material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
- if (itMaterial != mMaterials.end())
- {
- LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL;
- get_callback_te_t signal;
- signal.connect(cb);
- signal(material_id, itMaterial->second, te);
- connection = boost::signals2::connection();
- }
- else
- {
- if (!isGetPending(region_id, material_id))
- {
- get_queue_t::iterator itQueue = mGetQueue.find(region_id);
- if (mGetQueue.end() == itQueue)
- {
- LL_DEBUGS("Materials") << "mGetQueue inserting region "<<region_id << LL_ENDL;
- std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
- itQueue = ret.first;
- }
- LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL;
- itQueue->second.insert(material_id);
- markGetPending(region_id, material_id);
- }
-
- TEMaterialPair te_mat_pair;
- te_mat_pair.te = te;
- te_mat_pair.materialID = material_id;
-
- get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair);
- if (itCallback == mGetTECallbacks.end())
- {
- std::pair<get_callback_te_map_t::iterator, bool> ret = mGetTECallbacks.insert(std::pair<TEMaterialPair, get_callback_te_t*>(te_mat_pair, new get_callback_te_t()));
- itCallback = ret.first;
- }
- connection = itCallback->second->connect(cb);
- }
-
- return connection;
+ boost::signals2::connection connection;
+
+ material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
+ if (itMaterial != mMaterials.end())
+ {
+ LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL;
+ get_callback_te_t signal;
+ signal.connect(cb);
+ signal(material_id, itMaterial->second, te);
+ connection = boost::signals2::connection();
+ }
+ else
+ {
+ if (!isGetPending(region_id, material_id))
+ {
+ get_queue_t::iterator itQueue = mGetQueue.find(region_id);
+ if (mGetQueue.end() == itQueue)
+ {
+ LL_DEBUGS("Materials") << "mGetQueue inserting region "<<region_id << LL_ENDL;
+ std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
+ itQueue = ret.first;
+ }
+ LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL;
+ itQueue->second.insert(material_id);
+ markGetPending(region_id, material_id);
+ }
+
+ TEMaterialPair te_mat_pair;
+ te_mat_pair.te = te;
+ te_mat_pair.materialID = material_id;
+
+ get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair);
+ if (itCallback == mGetTECallbacks.end())
+ {
+ std::pair<get_callback_te_map_t::iterator, bool> ret = mGetTECallbacks.insert(std::pair<TEMaterialPair, get_callback_te_t*>(te_mat_pair, new get_callback_te_t()));
+ itCallback = ret.first;
+ }
+ connection = itCallback->second->connect(cb);
+ }
+
+ return connection;
}
bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const
{
- getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id);
- return (mGetAllPending.end() != itPending) && (LLFrameTimer::getTotalSeconds() < itPending->second + MATERIALS_GET_TIMEOUT);
+ getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id);
+ return (mGetAllPending.end() != itPending) && (LLFrameTimer::getTotalSeconds() < itPending->second + MATERIALS_GET_TIMEOUT);
}
void LLMaterialMgr::getAll(const LLUUID& region_id)
{
- if (!isGetAllPending(region_id))
- {
- LL_DEBUGS("Materials") << "queuing for region " << region_id << LL_ENDL;
- mGetAllQueue.insert(region_id);
- }
- else
- {
- LL_DEBUGS("Materials") << "already pending for region " << region_id << LL_ENDL;
- }
+ if (!isGetAllPending(region_id))
+ {
+ LL_DEBUGS("Materials") << "queuing for region " << region_id << LL_ENDL;
+ mGetAllQueue.insert(region_id);
+ }
+ else
+ {
+ LL_DEBUGS("Materials") << "already pending for region " << region_id << LL_ENDL;
+ }
}
boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMaterialMgr::getall_callback_t::slot_type cb)
{
- if (!isGetAllPending(region_id))
- {
- mGetAllQueue.insert(region_id);
- }
-
- getall_callback_map_t::iterator itCallback = mGetAllCallbacks.find(region_id);
- if (mGetAllCallbacks.end() == itCallback)
- {
- std::pair<getall_callback_map_t::iterator, bool> ret = mGetAllCallbacks.insert(std::pair<LLUUID, getall_callback_t*>(region_id, new getall_callback_t()));
- itCallback = ret.first;
- }
- return itCallback->second->connect(cb);;
+ if (!isGetAllPending(region_id))
+ {
+ mGetAllQueue.insert(region_id);
+ }
+
+ getall_callback_map_t::iterator itCallback = mGetAllCallbacks.find(region_id);
+ if (mGetAllCallbacks.end() == itCallback)
+ {
+ std::pair<getall_callback_map_t::iterator, bool> ret = mGetAllCallbacks.insert(std::pair<LLUUID, getall_callback_t*>(region_id, new getall_callback_t()));
+ itCallback = ret.first;
+ }
+ return itCallback->second->connect(cb);;
}
void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material)
{
- put_queue_t::iterator itQueue = mPutQueue.find(object_id);
- if (mPutQueue.end() == itQueue)
- {
- LL_DEBUGS("Materials") << "mPutQueue insert object " << object_id << LL_ENDL;
- mPutQueue.insert(std::pair<LLUUID, facematerial_map_t>(object_id, facematerial_map_t()));
- itQueue = mPutQueue.find(object_id);
- }
-
- facematerial_map_t::iterator itFace = itQueue->second.find(te);
- if (itQueue->second.end() == itFace)
- {
- itQueue->second.insert(std::pair<U8, LLMaterial>(te, material));
- }
- else
- {
- itFace->second = material;
- }
+ put_queue_t::iterator itQueue = mPutQueue.find(object_id);
+ if (mPutQueue.end() == itQueue)
+ {
+ LL_DEBUGS("Materials") << "mPutQueue insert object " << object_id << LL_ENDL;
+ mPutQueue.insert(std::pair<LLUUID, facematerial_map_t>(object_id, facematerial_map_t()));
+ itQueue = mPutQueue.find(object_id);
+ }
+
+ facematerial_map_t::iterator itFace = itQueue->second.find(te);
+ if (itQueue->second.end() == itFace)
+ {
+ itQueue->second.insert(std::pair<U8, LLMaterial>(te, material));
+ }
+ else
+ {
+ itFace->second = material;
+ }
}
void LLMaterialMgr::remove(const LLUUID& object_id, const U8 te)
{
- put(object_id, te, LLMaterial::null);
+ put(object_id, te, LLMaterial::null);
}
void LLMaterialMgr::setLocalMaterial(const LLUUID& region_id, LLMaterialPtr material_ptr)
{
- LLUUID uuid;
- uuid.generate();
- LLMaterialID material_id(uuid);
- while (mMaterials.end() != mMaterials.find(material_id))
- { //probability that this loop will executed is very, very low (one in a billion chance)
- uuid.generate();
- material_id.set(uuid.mData);
- }
+ LLUUID uuid;
+ uuid.generate();
+ LLMaterialID material_id(uuid);
+ while (mMaterials.end() != mMaterials.find(material_id))
+ { //probability that this loop will executed is very, very low (one in a billion chance)
+ uuid.generate();
+ material_id.set(uuid.mData);
+ }
- LL_DEBUGS("Materials") << "region " << region_id << "new local material id " << material_id << LL_ENDL;
- mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(material_id, material_ptr));
+ LL_DEBUGS("Materials") << "region " << region_id << "new local material id " << material_id << LL_ENDL;
+ mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(material_id, material_ptr));
- setMaterialCallbacks(material_id, material_ptr);
+ setMaterialCallbacks(material_id, material_ptr);
- mGetPending.erase(pending_material_t(region_id, material_id));
+ mGetPending.erase(pending_material_t(region_id, material_id));
}
const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data)
{
- LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL;
- material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
- if (mMaterials.end() == itMaterial)
- {
- LL_DEBUGS("Materials") << "new material" << LL_ENDL;
- LLMaterialPtr newMaterial(new LLMaterial(material_data));
- std::pair<material_map_t::const_iterator, bool> ret = mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(material_id, newMaterial));
- itMaterial = ret.first;
- }
+ LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL;
+ material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
+ if (mMaterials.end() == itMaterial)
+ {
+ LL_DEBUGS("Materials") << "new material" << LL_ENDL;
+ LLMaterialPtr newMaterial(new LLMaterial(material_data));
+ std::pair<material_map_t::const_iterator, bool> ret = mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(material_id, newMaterial));
+ itMaterial = ret.first;
+ }
- setMaterialCallbacks(material_id, itMaterial->second);
+ setMaterialCallbacks(material_id, itMaterial->second);
- mGetPending.erase(pending_material_t(region_id, material_id));
+ mGetPending.erase(pending_material_t(region_id, material_id));
- return itMaterial->second;
+ return itMaterial->second;
}
void LLMaterialMgr::setMaterialCallbacks(const LLMaterialID& material_id, const LLMaterialPtr material_ptr)
{
- TEMaterialPair te_mat_pair;
- te_mat_pair.materialID = material_id;
-
- U32 i = 0;
- while (i < LLTEContents::MAX_TES && !mGetTECallbacks.empty())
- {
- te_mat_pair.te = i++;
- get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair);
- if (itCallbackTE != mGetTECallbacks.end())
- {
- (*itCallbackTE->second)(material_id, material_ptr, te_mat_pair.te);
- delete itCallbackTE->second;
- mGetTECallbacks.erase(itCallbackTE);
- }
- }
-
- get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
- if (itCallback != mGetCallbacks.end())
- {
- (*itCallback->second)(material_id, material_ptr);
-
- delete itCallback->second;
- mGetCallbacks.erase(itCallback);
- }
+ TEMaterialPair te_mat_pair;
+ te_mat_pair.materialID = material_id;
+
+ U32 i = 0;
+ while (i < LLTEContents::MAX_TES && !mGetTECallbacks.empty())
+ {
+ te_mat_pair.te = i++;
+ get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair);
+ if (itCallbackTE != mGetTECallbacks.end())
+ {
+ (*itCallbackTE->second)(material_id, material_ptr, te_mat_pair.te);
+ delete itCallbackTE->second;
+ mGetTECallbacks.erase(itCallbackTE);
+ }
+ }
+
+ get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
+ if (itCallback != mGetCallbacks.end())
+ {
+ (*itCallback->second)(material_id, material_ptr);
+
+ delete itCallback->second;
+ mGetCallbacks.erase(itCallback);
+ }
}
void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUID& region_id)
{
- if (!success)
- {
- // *TODO: is there any kind of error handling we can do here?
- LL_WARNS("Materials")<< "failed"<<LL_ENDL;
- return;
- }
-
- llassert(content.isMap());
- llassert(content.has(MATERIALS_CAP_ZIP_FIELD));
- llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary());
-
- const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary();
-
- LLSD response_data;
- U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size());
- if (uzip_result != LLUZipHelper::ZR_OK)
- {
- LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
- return;
- }
-
- llassert(response_data.isArray());
- LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL;
- for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial)
- {
- const LLSD& material_data = *itMaterial;
- llassert(material_data.isMap());
-
- llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD));
- llassert(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].isBinary());
- LLMaterialID material_id(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].asBinary());
-
- llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD));
- llassert(material_data[MATERIALS_CAP_MATERIAL_FIELD].isMap());
-
- setMaterial(region_id, material_id, material_data[MATERIALS_CAP_MATERIAL_FIELD]);
- }
+ if (!success)
+ {
+ // *TODO: is there any kind of error handling we can do here?
+ LL_WARNS("Materials")<< "failed"<<LL_ENDL;
+ return;
+ }
+
+ llassert(content.isMap());
+ llassert(content.has(MATERIALS_CAP_ZIP_FIELD));
+ llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary());
+
+ const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary();
+
+ LLSD response_data;
+ U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size());
+ if (uzip_result != LLUZipHelper::ZR_OK)
+ {
+ LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
+ return;
+ }
+
+ llassert(response_data.isArray());
+ LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL;
+ for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial)
+ {
+ const LLSD& material_data = *itMaterial;
+ llassert(material_data.isMap());
+
+ llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD));
+ llassert(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].isBinary());
+ LLMaterialID material_id(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].asBinary());
+
+ llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD));
+ llassert(material_data[MATERIALS_CAP_MATERIAL_FIELD].isMap());
+
+ setMaterial(region_id, material_id, material_data[MATERIALS_CAP_MATERIAL_FIELD]);
+ }
}
void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LLUUID& region_id)
{
- if (!success)
- {
- // *TODO: is there any kind of error handling we can do here?
- LL_WARNS("Materials")<< "failed"<<LL_ENDL;
- return;
- }
-
- llassert(content.isMap());
- llassert(content.has(MATERIALS_CAP_ZIP_FIELD));
- llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary());
-
- const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary();
-
- LLSD response_data;
- U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size());
- if (uzip_result != LLUZipHelper::ZR_OK)
- {
- LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
- return;
- }
-
- get_queue_t::iterator itQueue = mGetQueue.find(region_id);
- material_map_t materials;
-
- llassert(response_data.isArray());
- LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL;
- for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial)
- {
- const LLSD& material_data = *itMaterial;
- llassert(material_data.isMap());
-
- llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD));
- llassert(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].isBinary());
- LLMaterialID material_id(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].asBinary());
- if (mGetQueue.end() != itQueue)
- {
- itQueue->second.erase(material_id);
- }
-
- llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD));
- llassert(material_data[MATERIALS_CAP_MATERIAL_FIELD].isMap());
- LLMaterialPtr material = setMaterial(region_id, material_id, material_data[MATERIALS_CAP_MATERIAL_FIELD]);
-
- materials[material_id] = material;
- }
-
- getall_callback_map_t::iterator itCallback = mGetAllCallbacks.find(region_id);
- if (itCallback != mGetAllCallbacks.end())
- {
- (*itCallback->second)(region_id, materials);
-
- delete itCallback->second;
- mGetAllCallbacks.erase(itCallback);
- }
-
- if ( (mGetQueue.end() != itQueue) && (itQueue->second.empty()) )
- {
- mGetQueue.erase(itQueue);
- }
-
- LL_DEBUGS("Materials")<< "recording that getAll has been done for region id " << region_id << LL_ENDL;
- mGetAllRequested.insert(region_id); // prevents subsequent getAll requests for this region
- mGetAllPending.erase(region_id); // Invalidates region_id
+ if (!success)
+ {
+ // *TODO: is there any kind of error handling we can do here?
+ LL_WARNS("Materials")<< "failed"<<LL_ENDL;
+ return;
+ }
+
+ llassert(content.isMap());
+ llassert(content.has(MATERIALS_CAP_ZIP_FIELD));
+ llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary());
+
+ const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary();
+
+ LLSD response_data;
+ U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size());
+ if (uzip_result != LLUZipHelper::ZR_OK)
+ {
+ LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
+ return;
+ }
+
+ get_queue_t::iterator itQueue = mGetQueue.find(region_id);
+ material_map_t materials;
+
+ llassert(response_data.isArray());
+ LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL;
+ for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial)
+ {
+ const LLSD& material_data = *itMaterial;
+ llassert(material_data.isMap());
+
+ llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD));
+ llassert(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].isBinary());
+ LLMaterialID material_id(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].asBinary());
+ if (mGetQueue.end() != itQueue)
+ {
+ itQueue->second.erase(material_id);
+ }
+
+ llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD));
+ llassert(material_data[MATERIALS_CAP_MATERIAL_FIELD].isMap());
+ LLMaterialPtr material = setMaterial(region_id, material_id, material_data[MATERIALS_CAP_MATERIAL_FIELD]);
+
+ materials[material_id] = material;
+ }
+
+ getall_callback_map_t::iterator itCallback = mGetAllCallbacks.find(region_id);
+ if (itCallback != mGetAllCallbacks.end())
+ {
+ (*itCallback->second)(region_id, materials);
+
+ delete itCallback->second;
+ mGetAllCallbacks.erase(itCallback);
+ }
+
+ if ( (mGetQueue.end() != itQueue) && (itQueue->second.empty()) )
+ {
+ mGetQueue.erase(itQueue);
+ }
+
+ LL_DEBUGS("Materials")<< "recording that getAll has been done for region id " << region_id << LL_ENDL;
+ mGetAllRequested.insert(region_id); // prevents subsequent getAll requests for this region
+ mGetAllPending.erase(region_id); // Invalidates region_id
}
void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)
{
- if (!success)
- {
- // *TODO: is there any kind of error handling we can do here?
- LL_WARNS("Materials")<< "failed"<<LL_ENDL;
- return;
- }
-
- llassert(content.isMap());
- llassert(content.has(MATERIALS_CAP_ZIP_FIELD));
- llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary());
-
- const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary();
-
- LLSD response_data;
- U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size());
- if (uzip_result != LLUZipHelper::ZR_OK)
- {
- LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
- return;
- }
- else
- {
- llassert(response_data.isArray());
- LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL;
- for (LLSD::array_const_iterator faceIter = response_data.beginArray(); faceIter != response_data.endArray(); ++faceIter)
- {
+ if (!success)
+ {
+ // *TODO: is there any kind of error handling we can do here?
+ LL_WARNS("Materials")<< "failed"<<LL_ENDL;
+ return;
+ }
+
+ llassert(content.isMap());
+ llassert(content.has(MATERIALS_CAP_ZIP_FIELD));
+ llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary());
+
+ const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary();
+
+ LLSD response_data;
+ U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size());
+ if (uzip_result != LLUZipHelper::ZR_OK)
+ {
+ LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
+ return;
+ }
+ else
+ {
+ llassert(response_data.isArray());
+ LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL;
+ for (LLSD::array_const_iterator faceIter = response_data.beginArray(); faceIter != response_data.endArray(); ++faceIter)
+ {
# ifdef SHOW_ASSERT // same condition that controls llassert()
- const LLSD& face_data = *faceIter; // conditional to avoid unused variable warning
+ const LLSD& face_data = *faceIter; // conditional to avoid unused variable warning
# endif
- llassert(face_data.isMap());
+ llassert(face_data.isMap());
- llassert(face_data.has(MATERIALS_CAP_OBJECT_ID_FIELD));
- llassert(face_data[MATERIALS_CAP_OBJECT_ID_FIELD].isInteger());
- // U32 local_id = face_data[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger();
+ llassert(face_data.has(MATERIALS_CAP_OBJECT_ID_FIELD));
+ llassert(face_data[MATERIALS_CAP_OBJECT_ID_FIELD].isInteger());
+ // U32 local_id = face_data[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger();
- llassert(face_data.has(MATERIALS_CAP_FACE_FIELD));
- llassert(face_data[MATERIALS_CAP_FACE_FIELD].isInteger());
- // S32 te = face_data[MATERIALS_CAP_FACE_FIELD].asInteger();
+ llassert(face_data.has(MATERIALS_CAP_FACE_FIELD));
+ llassert(face_data[MATERIALS_CAP_FACE_FIELD].isInteger());
+ // S32 te = face_data[MATERIALS_CAP_FACE_FIELD].asInteger();
- llassert(face_data.has(MATERIALS_CAP_MATERIAL_ID_FIELD));
- llassert(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].isBinary());
- // LLMaterialID material_id(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].asBinary());
+ llassert(face_data.has(MATERIALS_CAP_MATERIAL_ID_FIELD));
+ llassert(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].isBinary());
+ // LLMaterialID material_id(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].asBinary());
- // *TODO: do we really still need to process this?
- }
- }
+ // *TODO: do we really still need to process this?
+ }
+ }
}
void LLMaterialMgr::onIdle(void*)
{
LL_PROFILE_ZONE_SCOPED;
- LLMaterialMgr* instancep = LLMaterialMgr::getInstance();
+ LLMaterialMgr* instancep = LLMaterialMgr::getInstance();
- if (!instancep->mGetQueue.empty())
- {
- instancep->processGetQueue();
- }
+ if (!instancep->mGetQueue.empty())
+ {
+ instancep->processGetQueue();
+ }
- if (!instancep->mGetAllQueue.empty())
- {
- instancep->processGetAllQueue();
- }
+ if (!instancep->mGetAllQueue.empty())
+ {
+ instancep->processGetAllQueue();
+ }
- if (!instancep->mPutQueue.empty())
- {
- instancep->processPutQueue();
- }
+ if (!instancep->mPutQueue.empty())
+ {
+ instancep->processPutQueue();
+ }
- instancep->mHttpRequest->update(0L);
+ instancep->mHttpRequest->update(0L);
}
/*static*/
@@ -614,7 +614,7 @@ void LLMaterialMgr::processGetQueue()
#if 1
//* $TODO: This block is screaming to be turned into a coroutine.
// see processGetQueueCoro() below.
- //
+ //
get_queue_t::iterator itRegionQueue = loopRegionQueue++;
LLUUID region_id = itRegionQueue->first;
@@ -649,61 +649,61 @@ void LLMaterialMgr::processGetQueue()
mGetQueue.erase(itRegionQueue);
continue;
}
-
- LLSD materialsData = LLSD::emptyArray();
-
- material_queue_t& materials = itRegionQueue->second;
- U32 max_entries = regionp->getMaxMaterialsPerTransaction();
- material_queue_t::iterator loopMaterial = materials.begin();
- while ( (materials.end() != loopMaterial) && (materialsData.size() < max_entries) )
- {
- material_queue_t::iterator itMaterial = loopMaterial++;
- materialsData.append((*itMaterial).asLLSD());
- markGetPending(region_id, *itMaterial);
- materials.erase(itMaterial);
- }
- if (materials.empty())
- {
- mGetQueue.erase(itRegionQueue);
+
+ LLSD materialsData = LLSD::emptyArray();
+
+ material_queue_t& materials = itRegionQueue->second;
+ U32 max_entries = regionp->getMaxMaterialsPerTransaction();
+ material_queue_t::iterator loopMaterial = materials.begin();
+ while ( (materials.end() != loopMaterial) && (materialsData.size() < max_entries) )
+ {
+ material_queue_t::iterator itMaterial = loopMaterial++;
+ materialsData.append((*itMaterial).asLLSD());
+ markGetPending(region_id, *itMaterial);
+ materials.erase(itMaterial);
+ }
+ if (materials.empty())
+ {
+ mGetQueue.erase(itRegionQueue);
// $TODO*: We may be able to issue a continue here. Research.
- }
-
- std::string materialString = zip_llsd(materialsData);
+ }
- S32 materialSize = materialString.size();
- if (materialSize <= 0)
- {
- LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL;
- return;
- }
+ std::string materialString = zip_llsd(materialsData);
+
+ S32 materialSize = materialString.size();
+ if (materialSize <= 0)
+ {
+ LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL;
+ return;
+ }
- LLSD::Binary materialBinary;
- materialBinary.resize(materialSize);
- memcpy(materialBinary.data(), materialString.data(), materialSize);
+ LLSD::Binary materialBinary;
+ materialBinary.resize(materialSize);
+ memcpy(materialBinary.data(), materialString.data(), materialSize);
- LLSD postData = LLSD::emptyMap();
- postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary;
+ LLSD postData = LLSD::emptyMap();
+ postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary;
LLCore::HttpHandler::ptr_t handler(new LLMaterialHttpHandler("POST",
- boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id)
- ));
+ boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id)
+ ));
- LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '" << capURL << " for " << materialsData.size() << " materials."
- << "\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL;
+ LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '" << capURL << " for " << materialsData.size() << " materials."
+ << "\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL;
- LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
- mHttpPolicy, capURL,
- postData, mHttpOptions, mHttpHeaders, handler);
+ LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
+ mHttpPolicy, capURL,
+ postData, mHttpOptions, mHttpHeaders, handler);
- if (handle == LLCORE_HTTP_HANDLE_INVALID)
- {
- LLCore::HttpStatus status = mHttpRequest->getStatus();
- LL_ERRS("Meterials") << "Failed to execute material POST. Status = " <<
- status.toULong() << "\"" << status.toString() << "\"" << LL_ENDL;
- }
+ if (handle == LLCORE_HTTP_HANDLE_INVALID)
+ {
+ LLCore::HttpStatus status = mHttpRequest->getStatus();
+ LL_ERRS("Meterials") << "Failed to execute material POST. Status = " <<
+ status.toULong() << "\"" << status.toString() << "\"" << LL_ENDL;
+ }
- regionp->resetMaterialsCapThrottle();
- }
+ regionp->resetMaterialsCapThrottle();
+ }
#endif
}
@@ -805,19 +805,19 @@ void LLMaterialMgr::processGetQueueCoro()
void LLMaterialMgr::processGetAllQueue()
{
- getall_queue_t::iterator loopRegion = mGetAllQueue.begin();
- while (mGetAllQueue.end() != loopRegion)
- {
- getall_queue_t::iterator itRegion = loopRegion++;
+ getall_queue_t::iterator loopRegion = mGetAllQueue.begin();
+ while (mGetAllQueue.end() != loopRegion)
+ {
+ getall_queue_t::iterator itRegion = loopRegion++;
- const LLUUID& region_id = *itRegion;
+ const LLUUID& region_id = *itRegion;
LLCoros::instance().launch("LLMaterialMgr::processGetAllQueueCoro", boost::bind(&LLMaterialMgr::processGetAllQueueCoro,
this, region_id));
mGetAllPending.insert(std::pair<LLUUID, F64>(region_id, LLFrameTimer::getTotalSeconds()));
- mGetAllQueue.erase(itRegion); // Invalidates region_id
- }
+ mGetAllQueue.erase(itRegion); // Invalidates region_id
+ }
}
void LLMaterialMgr::processGetAllQueueCoro(LLUUID regionId)
@@ -826,17 +826,17 @@ void LLMaterialMgr::processGetAllQueueCoro(LLUUID regionId)
if (regionp == NULL)
{
LL_WARNS("Materials") << "Unknown region with id " << regionId.asString() << LL_ENDL;
- clearGetQueues(regionId); // Invalidates region_id
+ clearGetQueues(regionId); // Invalidates region_id
return;
}
- else if (!regionp->capabilitiesReceived())
+ else if (!regionp->capabilitiesReceived())
{
LLEventStream capsRecv("waitForCaps", true);
regionp->setCapabilitiesReceivedCallback(
boost::bind(&LLMaterialMgr::CapsRecvForRegion,
_1, regionId, capsRecv.getName()));
-
+
llcoro::suspendUntilEventOn(capsRecv);
// reget the region from the region ID since it may have gone away while waiting.
@@ -858,7 +858,7 @@ void LLMaterialMgr::processGetAllQueueCoro(LLUUID regionId)
{
LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME
<< "' is not defined on the current region '" << regionp->getName() << "'" << LL_ENDL;
- clearGetQueues(regionId); // Invalidates region_id
+ clearGetQueues(regionId); // Invalidates region_id
return;
}
@@ -894,133 +894,133 @@ void LLMaterialMgr::processGetAllQueueCoro(LLUUID regionId)
void LLMaterialMgr::processPutQueue()
{
- typedef std::map<LLViewerRegion*, LLSD> regionput_request_map;
- regionput_request_map requests;
-
- put_queue_t::iterator loopQueue = mPutQueue.begin();
- while (mPutQueue.end() != loopQueue)
- {
- put_queue_t::iterator itQueue = loopQueue++;
-
- const LLUUID& object_id = itQueue->first;
- const LLViewerObject* objectp = gObjectList.findObject(object_id);
- if ( !objectp )
- {
- LL_WARNS("Materials") << "Object is NULL" << LL_ENDL;
- mPutQueue.erase(itQueue);
- }
- else
- {
- LLViewerRegion* regionp = objectp->getRegion();
- if ( !regionp )
- {
- LL_WARNS("Materials") << "Object region is NULL" << LL_ENDL;
- mPutQueue.erase(itQueue);
- }
- else if ( regionp->capabilitiesReceived() && !regionp->materialsCapThrottled())
- {
- LLSD& facesData = requests[regionp];
-
- facematerial_map_t& face_map = itQueue->second;
- U32 max_entries = regionp->getMaxMaterialsPerTransaction();
- facematerial_map_t::iterator itFace = face_map.begin();
- while ( (face_map.end() != itFace) && (facesData.size() < max_entries) )
- {
- LLSD faceData = LLSD::emptyMap();
- faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(itFace->first);
- faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(objectp->getLocalID());
- if (!itFace->second.isNull())
- {
- faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD();
- }
- facesData.append(faceData);
- face_map.erase(itFace++);
- }
- if (face_map.empty())
- {
- mPutQueue.erase(itQueue);
- }
- }
- }
- }
-
- for (regionput_request_map::const_iterator itRequest = requests.begin(); itRequest != requests.end(); ++itRequest)
- {
- LLViewerRegion* regionp = itRequest->first;
- std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME);
- if (capURL.empty())
- {
- LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME
- << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL;
- continue;
- }
-
- LLSD materialsData = LLSD::emptyMap();
- materialsData[MATERIALS_CAP_FULL_PER_FACE_FIELD] = itRequest->second;
-
- std::string materialString = zip_llsd(materialsData);
-
- S32 materialSize = materialString.size();
-
- if (materialSize > 0)
- {
- LLSD::Binary materialBinary;
- materialBinary.resize(materialSize);
- memcpy(materialBinary.data(), materialString.data(), materialSize);
-
- LLSD putData = LLSD::emptyMap();
- putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary;
-
- LL_DEBUGS("Materials") << "put for " << itRequest->second.size() << " faces to region " << itRequest->first->getName() << LL_ENDL;
-
- LLCore::HttpHandler::ptr_t handler (new LLMaterialHttpHandler("PUT",
- boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2)
- ));
-
- LLCore::HttpHandle handle = LLCoreHttpUtil::requestPutWithLLSD(
- mHttpRequest, mHttpPolicy, capURL,
- putData, mHttpOptions, mHttpHeaders, handler);
-
- if (handle == LLCORE_HTTP_HANDLE_INVALID)
- {
- LLCore::HttpStatus status = mHttpRequest->getStatus();
- LL_ERRS("Meterials") << "Failed to execute material PUT. Status = " <<
- status.toULong() << "\"" << status.toString() << "\"" << LL_ENDL;
- }
-
- regionp->resetMaterialsCapThrottle();
- }
- else
- {
- LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL;
- }
- }
+ typedef std::map<LLViewerRegion*, LLSD> regionput_request_map;
+ regionput_request_map requests;
+
+ put_queue_t::iterator loopQueue = mPutQueue.begin();
+ while (mPutQueue.end() != loopQueue)
+ {
+ put_queue_t::iterator itQueue = loopQueue++;
+
+ const LLUUID& object_id = itQueue->first;
+ const LLViewerObject* objectp = gObjectList.findObject(object_id);
+ if ( !objectp )
+ {
+ LL_WARNS("Materials") << "Object is NULL" << LL_ENDL;
+ mPutQueue.erase(itQueue);
+ }
+ else
+ {
+ LLViewerRegion* regionp = objectp->getRegion();
+ if ( !regionp )
+ {
+ LL_WARNS("Materials") << "Object region is NULL" << LL_ENDL;
+ mPutQueue.erase(itQueue);
+ }
+ else if ( regionp->capabilitiesReceived() && !regionp->materialsCapThrottled())
+ {
+ LLSD& facesData = requests[regionp];
+
+ facematerial_map_t& face_map = itQueue->second;
+ U32 max_entries = regionp->getMaxMaterialsPerTransaction();
+ facematerial_map_t::iterator itFace = face_map.begin();
+ while ( (face_map.end() != itFace) && (facesData.size() < max_entries) )
+ {
+ LLSD faceData = LLSD::emptyMap();
+ faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(itFace->first);
+ faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(objectp->getLocalID());
+ if (!itFace->second.isNull())
+ {
+ faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD();
+ }
+ facesData.append(faceData);
+ face_map.erase(itFace++);
+ }
+ if (face_map.empty())
+ {
+ mPutQueue.erase(itQueue);
+ }
+ }
+ }
+ }
+
+ for (regionput_request_map::const_iterator itRequest = requests.begin(); itRequest != requests.end(); ++itRequest)
+ {
+ LLViewerRegion* regionp = itRequest->first;
+ std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME);
+ if (capURL.empty())
+ {
+ LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME
+ << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL;
+ continue;
+ }
+
+ LLSD materialsData = LLSD::emptyMap();
+ materialsData[MATERIALS_CAP_FULL_PER_FACE_FIELD] = itRequest->second;
+
+ std::string materialString = zip_llsd(materialsData);
+
+ S32 materialSize = materialString.size();
+
+ if (materialSize > 0)
+ {
+ LLSD::Binary materialBinary;
+ materialBinary.resize(materialSize);
+ memcpy(materialBinary.data(), materialString.data(), materialSize);
+
+ LLSD putData = LLSD::emptyMap();
+ putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary;
+
+ LL_DEBUGS("Materials") << "put for " << itRequest->second.size() << " faces to region " << itRequest->first->getName() << LL_ENDL;
+
+ LLCore::HttpHandler::ptr_t handler (new LLMaterialHttpHandler("PUT",
+ boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2)
+ ));
+
+ LLCore::HttpHandle handle = LLCoreHttpUtil::requestPutWithLLSD(
+ mHttpRequest, mHttpPolicy, capURL,
+ putData, mHttpOptions, mHttpHeaders, handler);
+
+ if (handle == LLCORE_HTTP_HANDLE_INVALID)
+ {
+ LLCore::HttpStatus status = mHttpRequest->getStatus();
+ LL_ERRS("Meterials") << "Failed to execute material PUT. Status = " <<
+ status.toULong() << "\"" << status.toString() << "\"" << LL_ENDL;
+ }
+
+ regionp->resetMaterialsCapThrottle();
+ }
+ else
+ {
+ LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL;
+ }
+ }
}
void LLMaterialMgr::clearGetQueues(const LLUUID& region_id)
{
- mGetQueue.erase(region_id);
-
- for (get_pending_map_t::iterator itPending = mGetPending.begin(); itPending != mGetPending.end();)
- {
- if (region_id == itPending->first.first)
- {
- mGetPending.erase(itPending++);
- }
- else
- {
- ++itPending;
- }
- }
-
- mGetAllQueue.erase(region_id);
- mGetAllRequested.erase(region_id);
- mGetAllPending.erase(region_id);
- mGetAllCallbacks.erase(region_id);
+ mGetQueue.erase(region_id);
+
+ for (get_pending_map_t::iterator itPending = mGetPending.begin(); itPending != mGetPending.end();)
+ {
+ if (region_id == itPending->first.first)
+ {
+ mGetPending.erase(itPending++);
+ }
+ else
+ {
+ ++itPending;
+ }
+ }
+
+ mGetAllQueue.erase(region_id);
+ mGetAllRequested.erase(region_id);
+ mGetAllPending.erase(region_id);
+ mGetAllCallbacks.erase(region_id);
}
void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp)
{
- clearGetQueues(regionp->getRegionID());
- // Put doesn't need clearing: objects that can't be found will clean up in processPutQueue()
+ clearGetQueues(regionp->getRegionID());
+ // Put doesn't need clearing: objects that can't be found will clean up in processPutQueue()
}
diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h
index 6e574219ae..94cb1c0e15 100644
--- a/indra/newview/llmaterialmgr.h
+++ b/indra/newview/llmaterialmgr.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,126 +38,126 @@ class LLViewerRegion;
class LLMaterialMgr : public LLSingleton<LLMaterialMgr>
{
- LLSINGLETON(LLMaterialMgr);
- virtual ~LLMaterialMgr();
+ LLSINGLETON(LLMaterialMgr);
+ virtual ~LLMaterialMgr();
public:
- typedef std::map<LLMaterialID, LLMaterialPtr> material_map_t;
+ typedef std::map<LLMaterialID, LLMaterialPtr> material_map_t;
+
+ typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr)> get_callback_t;
+ const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id);
+ boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb);
- typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr)> get_callback_t;
- const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id);
- boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb);
+ typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr, U32 te)> get_callback_te_t;
+ boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb);
- typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr, U32 te)> get_callback_te_t;
- boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb);
+ typedef boost::signals2::signal<void (const LLUUID&, const material_map_t&)> getall_callback_t;
+ void getAll(const LLUUID& region_id);
+ boost::signals2::connection getAll(const LLUUID& region_id, getall_callback_t::slot_type cb);
+ void put(const LLUUID& object_id, const U8 te, const LLMaterial& material);
+ void remove(const LLUUID& object_id, const U8 te);
- typedef boost::signals2::signal<void (const LLUUID&, const material_map_t&)> getall_callback_t;
- void getAll(const LLUUID& region_id);
- boost::signals2::connection getAll(const LLUUID& region_id, getall_callback_t::slot_type cb);
- void put(const LLUUID& object_id, const U8 te, const LLMaterial& material);
- void remove(const LLUUID& object_id, const U8 te);
-
- //explicitly add new material to material manager
- void setLocalMaterial(const LLUUID& region_id, LLMaterialPtr material_ptr);
+ //explicitly add new material to material manager
+ void setLocalMaterial(const LLUUID& region_id, LLMaterialPtr material_ptr);
private:
- void clearGetQueues(const LLUUID& region_id);
- bool isGetPending(const LLUUID& region_id, const LLMaterialID& material_id) const;
- bool isGetAllPending(const LLUUID& region_id) const;
- void markGetPending(const LLUUID& region_id, const LLMaterialID& material_id);
- const LLMaterialPtr setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data);
- void setMaterialCallbacks(const LLMaterialID& material_id, const LLMaterialPtr material_ptr);
-
- static void onIdle(void*);
+ void clearGetQueues(const LLUUID& region_id);
+ bool isGetPending(const LLUUID& region_id, const LLMaterialID& material_id) const;
+ bool isGetAllPending(const LLUUID& region_id) const;
+ void markGetPending(const LLUUID& region_id, const LLMaterialID& material_id);
+ const LLMaterialPtr setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data);
+ void setMaterialCallbacks(const LLMaterialID& material_id, const LLMaterialPtr material_ptr);
+
+ static void onIdle(void*);
static void CapsRecvForRegion(const LLUUID& regionId, LLUUID regionTest, std::string pumpname);
- void processGetQueue();
+ void processGetQueue();
void processGetQueueCoro();
- void onGetResponse(bool success, const LLSD& content, const LLUUID& region_id);
- void processGetAllQueue();
+ void onGetResponse(bool success, const LLSD& content, const LLUUID& region_id);
+ void processGetAllQueue();
void processGetAllQueueCoro(LLUUID regionId);
- void onGetAllResponse(bool success, const LLSD& content, const LLUUID& region_id);
- void processPutQueue();
- void onPutResponse(bool success, const LLSD& content);
- void onRegionRemoved(LLViewerRegion* regionp);
+ void onGetAllResponse(bool success, const LLSD& content, const LLUUID& region_id);
+ void processPutQueue();
+ void onPutResponse(bool success, const LLSD& content);
+ void onRegionRemoved(LLViewerRegion* regionp);
private:
- // struct for TE-specific material ID query
- class TEMaterialPair
- {
- public:
+ // struct for TE-specific material ID query
+ class TEMaterialPair
+ {
+ public:
- U32 te;
- LLMaterialID materialID;
+ U32 te;
+ LLMaterialID materialID;
- bool operator==(const TEMaterialPair& b) const { return (materialID == b.materialID) && (te == b.te); }
- };
+ bool operator==(const TEMaterialPair& b) const { return (materialID == b.materialID) && (te == b.te); }
+ };
- // definitions follow class
- friend std::hash<TEMaterialPair>;
- friend size_t hash_value(const TEMaterialPair&) noexcept;
+ // definitions follow class
+ friend std::hash<TEMaterialPair>;
+ friend size_t hash_value(const TEMaterialPair&) noexcept;
- friend inline bool operator<(
- const LLMaterialMgr::TEMaterialPair& lhs,
- const LLMaterialMgr::TEMaterialPair& rhs)
- {
- return (lhs.te < rhs.te) ? TRUE :
- (lhs.materialID < rhs.materialID);
- }
+ friend inline bool operator<(
+ const LLMaterialMgr::TEMaterialPair& lhs,
+ const LLMaterialMgr::TEMaterialPair& rhs)
+ {
+ return (lhs.te < rhs.te) ? TRUE :
+ (lhs.materialID < rhs.materialID);
+ }
- typedef std::set<LLMaterialID> material_queue_t;
- typedef std::map<LLUUID, material_queue_t> get_queue_t;
- typedef std::pair<const LLUUID, LLMaterialID> pending_material_t;
- typedef std::map<const pending_material_t, F64> get_pending_map_t;
- typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
+ typedef std::set<LLMaterialID> material_queue_t;
+ typedef std::map<LLUUID, material_queue_t> get_queue_t;
+ typedef std::pair<const LLUUID, LLMaterialID> pending_material_t;
+ typedef std::map<const pending_material_t, F64> get_pending_map_t;
+ typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
- typedef boost::unordered_map<TEMaterialPair, get_callback_te_t*> get_callback_te_map_t;
- typedef std::set<LLUUID> getall_queue_t;
- typedef std::map<LLUUID, F64> getall_pending_map_t;
- typedef std::map<LLUUID, getall_callback_t*> getall_callback_map_t;
- typedef std::map<U8, LLMaterial> facematerial_map_t;
- typedef std::map<LLUUID, facematerial_map_t> put_queue_t;
+ typedef boost::unordered_map<TEMaterialPair, get_callback_te_t*> get_callback_te_map_t;
+ typedef std::set<LLUUID> getall_queue_t;
+ typedef std::map<LLUUID, F64> getall_pending_map_t;
+ typedef std::map<LLUUID, getall_callback_t*> getall_callback_map_t;
+ typedef std::map<U8, LLMaterial> facematerial_map_t;
+ typedef std::map<LLUUID, facematerial_map_t> put_queue_t;
- get_queue_t mGetQueue;
+ get_queue_t mGetQueue;
uuid_set_t mRegionGets;
- get_pending_map_t mGetPending;
- get_callback_map_t mGetCallbacks;
-
- get_callback_te_map_t mGetTECallbacks;
- getall_queue_t mGetAllQueue;
- getall_queue_t mGetAllRequested;
- getall_pending_map_t mGetAllPending;
- getall_callback_map_t mGetAllCallbacks;
- put_queue_t mPutQueue;
- material_map_t mMaterials;
-
- LLCore::HttpRequest::ptr_t mHttpRequest;
- LLCore::HttpHeaders::ptr_t mHttpHeaders;
- LLCore::HttpOptions::ptr_t mHttpOptions;
- LLCore::HttpRequest::policy_t mHttpPolicy;
-
- U32 getMaxEntries(const LLViewerRegion* regionp);
+ get_pending_map_t mGetPending;
+ get_callback_map_t mGetCallbacks;
+
+ get_callback_te_map_t mGetTECallbacks;
+ getall_queue_t mGetAllQueue;
+ getall_queue_t mGetAllRequested;
+ getall_pending_map_t mGetAllPending;
+ getall_callback_map_t mGetAllCallbacks;
+ put_queue_t mPutQueue;
+ material_map_t mMaterials;
+
+ LLCore::HttpRequest::ptr_t mHttpRequest;
+ LLCore::HttpHeaders::ptr_t mHttpHeaders;
+ LLCore::HttpOptions::ptr_t mHttpOptions;
+ LLCore::HttpRequest::policy_t mHttpPolicy;
+
+ U32 getMaxEntries(const LLViewerRegion* regionp);
};
// std::hash implementation for TEMaterialPair
namespace std
{
- template<> struct hash<LLMaterialMgr::TEMaterialPair>
- {
- inline size_t operator()(const LLMaterialMgr::TEMaterialPair& p) const noexcept
- {
- return size_t((p.te + 1) * p.materialID.getDigest64());
- }
- };
+ template<> struct hash<LLMaterialMgr::TEMaterialPair>
+ {
+ inline size_t operator()(const LLMaterialMgr::TEMaterialPair& p) const noexcept
+ {
+ return size_t((p.te + 1) * p.materialID.getDigest64());
+ }
+ };
}
// For use with boost containers.
inline size_t hash_value(const LLMaterialMgr::TEMaterialPair& p) noexcept
{
- return size_t((p.te + 1) * p.materialID.getDigest64());
+ return size_t((p.te + 1) * p.materialID.getDigest64());
}
#endif // LL_LLMATERIALMGR_H
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 36ac1bdf97..72783408b8 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,7 +43,7 @@
#include "llrender.h"
#include "llpluginclassmedia.h"
#include "llslurl.h"
-#include "lluictrlfactory.h" // LLDefaultChildRegistry
+#include "lluictrlfactory.h" // LLDefaultChildRegistry
#include "llkeyboard.h"
#include "llviewermenu.h"
#include "llviewermenufile.h" // LLFilePickerThread
@@ -68,154 +68,154 @@ extern BOOL gRestoreGL;
static LLDefaultChildRegistry::Register<LLMediaCtrl> r("web_browser");
LLMediaCtrl::Params::Params()
-: start_url("start_url"),
- border_visible("border_visible", true),
- decouple_texture_size("decouple_texture_size", false),
- texture_width("texture_width", 1024),
- texture_height("texture_height", 1024),
- caret_color("caret_color"),
- initial_mime_type("initial_mime_type"),
- error_page_url("error_page_url"),
- media_id("media_id"),
- trusted_content("trusted_content", false),
- focus_on_click("focus_on_click", true)
+: start_url("start_url"),
+ border_visible("border_visible", true),
+ decouple_texture_size("decouple_texture_size", false),
+ texture_width("texture_width", 1024),
+ texture_height("texture_height", 1024),
+ caret_color("caret_color"),
+ initial_mime_type("initial_mime_type"),
+ error_page_url("error_page_url"),
+ media_id("media_id"),
+ trusted_content("trusted_content", false),
+ focus_on_click("focus_on_click", true)
{
}
LLMediaCtrl::LLMediaCtrl( const Params& p) :
- LLPanel( p ),
- LLInstanceTracker<LLMediaCtrl, LLUUID>(LLUUID::generateNewID()),
- mTextureDepthBytes( 4 ),
- mBorder(NULL),
- mFrequentUpdates( true ),
- mForceUpdate( false ),
- mHomePageUrl( "" ),
- mAlwaysRefresh( false ),
- mMediaSource( 0 ),
- mTakeFocusOnClick( p.focus_on_click ),
- mCurrentNavUrl( "" ),
- mStretchToFill( true ),
- mMaintainAspectRatio ( true ),
- mDecoupleTextureSize ( false ),
- mUpdateScrolls( false ),
- mTextureWidth ( 1024 ),
- mTextureHeight ( 1024 ),
- mClearCache(false),
- mHomePageMimeType(p.initial_mime_type),
- mErrorPageURL(p.error_page_url),
- mTrusted(p.trusted_content),
- mWindowShade(NULL),
- mHoverTextChanged(false),
+ LLPanel( p ),
+ LLInstanceTracker<LLMediaCtrl, LLUUID>(LLUUID::generateNewID()),
+ mTextureDepthBytes( 4 ),
+ mBorder(NULL),
+ mFrequentUpdates( true ),
+ mForceUpdate( false ),
+ mHomePageUrl( "" ),
+ mAlwaysRefresh( false ),
+ mMediaSource( 0 ),
+ mTakeFocusOnClick( p.focus_on_click ),
+ mCurrentNavUrl( "" ),
+ mStretchToFill( true ),
+ mMaintainAspectRatio ( true ),
+ mDecoupleTextureSize ( false ),
+ mUpdateScrolls( false ),
+ mTextureWidth ( 1024 ),
+ mTextureHeight ( 1024 ),
+ mClearCache(false),
+ mHomePageMimeType(p.initial_mime_type),
+ mErrorPageURL(p.error_page_url),
+ mTrusted(p.trusted_content),
+ mWindowShade(NULL),
+ mHoverTextChanged(false),
mAllowFileDownload(false)
{
- {
- LLColor4 color = p.caret_color().get();
- setCaretColor( (unsigned int)color.mV[0], (unsigned int)color.mV[1], (unsigned int)color.mV[2] );
- }
-
- setHomePageUrl(p.start_url, p.initial_mime_type);
-
- setBorderVisible(p.border_visible);
-
- setDecoupleTextureSize(p.decouple_texture_size);
-
- setTextureSize(p.texture_width, p.texture_height);
-
- if(!getDecoupleTextureSize())
- {
- S32 screen_width = ll_round((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]);
- S32 screen_height = ll_round((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]);
-
- setTextureSize(screen_width, screen_height);
- }
-
- mMediaTextureID = getKey();
-
- // We don't need to create the media source up front anymore unless we have a non-empty home URL to navigate to.
- if(!mHomePageUrl.empty())
- {
- navigateHome();
- }
-
- LLWindowShade::Params params;
- params.name = "notification_shade";
- params.rect = getLocalRect();
- params.follows.flags = FOLLOWS_ALL;
- params.modal = true;
-
- mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
-
- addChild(mWindowShade);
+ {
+ LLColor4 color = p.caret_color().get();
+ setCaretColor( (unsigned int)color.mV[0], (unsigned int)color.mV[1], (unsigned int)color.mV[2] );
+ }
+
+ setHomePageUrl(p.start_url, p.initial_mime_type);
+
+ setBorderVisible(p.border_visible);
+
+ setDecoupleTextureSize(p.decouple_texture_size);
+
+ setTextureSize(p.texture_width, p.texture_height);
+
+ if(!getDecoupleTextureSize())
+ {
+ S32 screen_width = ll_round((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]);
+ S32 screen_height = ll_round((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]);
+
+ setTextureSize(screen_width, screen_height);
+ }
+
+ mMediaTextureID = getKey();
+
+ // We don't need to create the media source up front anymore unless we have a non-empty home URL to navigate to.
+ if(!mHomePageUrl.empty())
+ {
+ navigateHome();
+ }
+
+ LLWindowShade::Params params;
+ params.name = "notification_shade";
+ params.rect = getLocalRect();
+ params.follows.flags = FOLLOWS_ALL;
+ params.modal = true;
+
+ mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
+
+ addChild(mWindowShade);
}
LLMediaCtrl::~LLMediaCtrl()
{
- auto menu = mContextMenuHandle.get();
- if (menu)
- {
- menu->die();
- mContextMenuHandle.markDead();
- }
-
- if (mMediaSource)
- {
- mMediaSource->remObserver( this );
- mMediaSource = NULL;
- }
+ auto menu = mContextMenuHandle.get();
+ if (menu)
+ {
+ menu->die();
+ mContextMenuHandle.markDead();
+ }
+
+ if (mMediaSource)
+ {
+ mMediaSource->remObserver( this );
+ mMediaSource = NULL;
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::setBorderVisible( BOOL border_visible )
{
- if ( mBorder )
- {
- mBorder->setVisible( border_visible );
- };
+ if ( mBorder )
+ {
+ mBorder->setVisible( border_visible );
+ };
};
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::setTakeFocusOnClick( bool take_focus )
{
- mTakeFocusOnClick = take_focus;
+ mTakeFocusOnClick = take_focus;
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask )
{
- if (LLPanel::handleHover(x, y, mask)) return TRUE;
- convertInputCoords(x, y);
-
- if (mMediaSource)
- {
- mMediaSource->mouseMove(x, y, mask);
- gViewerWindow->setCursor(mMediaSource->getLastSetCursor());
- }
-
- // TODO: Is this the right way to handle hover text changes driven by the plugin?
- if(mHoverTextChanged)
- {
- mHoverTextChanged = false;
- handleToolTip(x, y, mask);
- }
-
- return TRUE;
+ if (LLPanel::handleHover(x, y, mask)) return TRUE;
+ convertInputCoords(x, y);
+
+ if (mMediaSource)
+ {
+ mMediaSource->mouseMove(x, y, mask);
+ gViewerWindow->setCursor(mMediaSource->getLastSetCursor());
+ }
+
+ // TODO: Is this the right way to handle hover text changes driven by the plugin?
+ if(mHoverTextChanged)
+ {
+ mHoverTextChanged = false;
+ handleToolTip(x, y, mask);
+ }
+
+ return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleScrollWheel( S32 x, S32 y, S32 clicks )
{
- if (LLPanel::handleScrollWheel(x, y, clicks)) return TRUE;
- if (mMediaSource && mMediaSource->hasMedia())
- {
- convertInputCoords(x, y);
- mMediaSource->scrollWheel(x, y, 0, clicks, gKeyboard->currentMask(TRUE));
- }
-
- return TRUE;
+ if (LLPanel::handleScrollWheel(x, y, clicks)) return TRUE;
+ if (mMediaSource && mMediaSource->hasMedia())
+ {
+ convertInputCoords(x, y);
+ mMediaSource->scrollWheel(x, y, 0, clicks, gKeyboard->currentMask(TRUE));
+ }
+
+ return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
@@ -233,375 +233,375 @@ BOOL LLMediaCtrl::handleScrollHWheel(S32 x, S32 y, S32 clicks)
}
////////////////////////////////////////////////////////////////////////////////
-// virtual
+// virtual
BOOL LLMediaCtrl::handleToolTip(S32 x, S32 y, MASK mask)
{
- std::string hover_text;
-
- if (mMediaSource && mMediaSource->hasMedia())
- hover_text = mMediaSource->getMediaPlugin()->getHoverText();
-
- if(hover_text.empty())
- {
- return FALSE;
- }
- else
- {
- S32 screen_x, screen_y;
-
- localPointToScreen(x, y, &screen_x, &screen_y);
- LLRect sticky_rect_screen;
- sticky_rect_screen.setCenterAndSize(screen_x, screen_y, 20, 20);
-
- LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(hover_text)
- .sticky_rect(sticky_rect_screen));
- }
-
- return TRUE;
+ std::string hover_text;
+
+ if (mMediaSource && mMediaSource->hasMedia())
+ hover_text = mMediaSource->getMediaPlugin()->getHoverText();
+
+ if(hover_text.empty())
+ {
+ return FALSE;
+ }
+ else
+ {
+ S32 screen_x, screen_y;
+
+ localPointToScreen(x, y, &screen_x, &screen_y);
+ LLRect sticky_rect_screen;
+ sticky_rect_screen.setCenterAndSize(screen_x, screen_y, 20, 20);
+
+ LLToolTipMgr::instance().show(LLToolTip::Params()
+ .message(hover_text)
+ .sticky_rect(sticky_rect_screen));
+ }
+
+ return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask )
{
- if (LLPanel::handleMouseUp(x, y, mask)) return TRUE;
- convertInputCoords(x, y);
+ if (LLPanel::handleMouseUp(x, y, mask)) return TRUE;
+ convertInputCoords(x, y);
- if (mMediaSource)
- {
- mMediaSource->mouseUp(x, y, mask);
- }
-
- gFocusMgr.setMouseCapture( NULL );
+ if (mMediaSource)
+ {
+ mMediaSource->mouseUp(x, y, mask);
+ }
+
+ gFocusMgr.setMouseCapture( NULL );
- return TRUE;
+ return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleMouseDown( S32 x, S32 y, MASK mask )
{
- if (LLPanel::handleMouseDown(x, y, mask)) return TRUE;
- convertInputCoords(x, y);
+ if (LLPanel::handleMouseDown(x, y, mask)) return TRUE;
+ convertInputCoords(x, y);
- if (mMediaSource)
- mMediaSource->mouseDown(x, y, mask);
-
- gFocusMgr.setMouseCapture( this );
+ if (mMediaSource)
+ mMediaSource->mouseDown(x, y, mask);
- if (mTakeFocusOnClick)
- {
- setFocus( TRUE );
- }
+ gFocusMgr.setMouseCapture( this );
- return TRUE;
+ if (mTakeFocusOnClick)
+ {
+ setFocus( TRUE );
+ }
+
+ return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleRightMouseUp( S32 x, S32 y, MASK mask )
{
- if (LLPanel::handleRightMouseUp(x, y, mask)) return TRUE;
- convertInputCoords(x, y);
-
- if (mMediaSource)
- {
- mMediaSource->mouseUp(x, y, mask, 1);
-
- // *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup,
- // in addition to the onFocusReceived() call below. Undo this. JC
- if (!mTakeFocusOnClick)
- {
- mMediaSource->focus(false);
- gViewerWindow->focusClient();
- }
- }
-
- gFocusMgr.setMouseCapture( NULL );
-
- return TRUE;
+ if (LLPanel::handleRightMouseUp(x, y, mask)) return TRUE;
+ convertInputCoords(x, y);
+
+ if (mMediaSource)
+ {
+ mMediaSource->mouseUp(x, y, mask, 1);
+
+ // *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup,
+ // in addition to the onFocusReceived() call below. Undo this. JC
+ if (!mTakeFocusOnClick)
+ {
+ mMediaSource->focus(false);
+ gViewerWindow->focusClient();
+ }
+ }
+
+ gFocusMgr.setMouseCapture( NULL );
+
+ return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask )
{
- if (LLPanel::handleRightMouseDown(x, y, mask)) return TRUE;
-
- S32 media_x = x, media_y = y;
- convertInputCoords(media_x, media_y);
-
- if (mMediaSource)
- mMediaSource->mouseDown(media_x, media_y, mask, 1);
-
- gFocusMgr.setMouseCapture( this );
-
- if (mTakeFocusOnClick)
- {
- setFocus( TRUE );
- }
-
- auto menu = mContextMenuHandle.get();
- if (!menu)
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar;
- registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this));
-
- // stinson 05/05/2014 : use this as the parent of the context menu if the static menu
- // container has yet to be created
- LLPanel* menuParent = (LLMenuGL::sMenuContainer != NULL) ? dynamic_cast<LLPanel*>(LLMenuGL::sMenuContainer) : dynamic_cast<LLPanel*>(this);
- llassert(menuParent != NULL);
- menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
- "menu_media_ctrl.xml", menuParent, LLViewerMenuHolderGL::child_registry_t::instance());
- if (menu)
- {
- mContextMenuHandle = menu->getHandle();
- }
- }
-
- if (menu)
- {
- // hide/show debugging options
- bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
- menu->setItemVisible("open_webinspector", media_plugin_debugging_enabled );
- menu->setItemVisible("debug_separator", media_plugin_debugging_enabled );
-
- menu->show(x, y);
- LLMenuGL::showPopup(this, menu, x, y);
- }
-
- return TRUE;
+ if (LLPanel::handleRightMouseDown(x, y, mask)) return TRUE;
+
+ S32 media_x = x, media_y = y;
+ convertInputCoords(media_x, media_y);
+
+ if (mMediaSource)
+ mMediaSource->mouseDown(media_x, media_y, mask, 1);
+
+ gFocusMgr.setMouseCapture( this );
+
+ if (mTakeFocusOnClick)
+ {
+ setFocus( TRUE );
+ }
+
+ auto menu = mContextMenuHandle.get();
+ if (!menu)
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar;
+ registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this));
+
+ // stinson 05/05/2014 : use this as the parent of the context menu if the static menu
+ // container has yet to be created
+ LLPanel* menuParent = (LLMenuGL::sMenuContainer != NULL) ? dynamic_cast<LLPanel*>(LLMenuGL::sMenuContainer) : dynamic_cast<LLPanel*>(this);
+ llassert(menuParent != NULL);
+ menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
+ "menu_media_ctrl.xml", menuParent, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (menu)
+ {
+ mContextMenuHandle = menu->getHandle();
+ }
+ }
+
+ if (menu)
+ {
+ // hide/show debugging options
+ bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
+ menu->setItemVisible("open_webinspector", media_plugin_debugging_enabled );
+ menu->setItemVisible("debug_separator", media_plugin_debugging_enabled );
+
+ menu->show(x, y);
+ LLMenuGL::showPopup(this, menu, x, y);
+ }
+
+ return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleDoubleClick( S32 x, S32 y, MASK mask )
{
- if (LLPanel::handleDoubleClick(x, y, mask)) return TRUE;
- convertInputCoords(x, y);
+ if (LLPanel::handleDoubleClick(x, y, mask)) return TRUE;
+ convertInputCoords(x, y);
- if (mMediaSource)
- mMediaSource->mouseDoubleClick( x, y, mask);
+ if (mMediaSource)
+ mMediaSource->mouseDoubleClick( x, y, mask);
- gFocusMgr.setMouseCapture( this );
+ gFocusMgr.setMouseCapture( this );
- if (mTakeFocusOnClick)
- {
- setFocus( TRUE );
- }
+ if (mTakeFocusOnClick)
+ {
+ setFocus( TRUE );
+ }
- return TRUE;
+ return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::onFocusReceived()
{
- if (mMediaSource)
- {
- mMediaSource->focus(true);
-
- // Set focus for edit menu items
- LLEditMenuHandler::gEditMenuHandler = mMediaSource;
- }
-
- LLPanel::onFocusReceived();
+ if (mMediaSource)
+ {
+ mMediaSource->focus(true);
+
+ // Set focus for edit menu items
+ LLEditMenuHandler::gEditMenuHandler = mMediaSource;
+ }
+
+ LLPanel::onFocusReceived();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::onFocusLost()
{
- if (mMediaSource)
- {
- mMediaSource->focus(false);
+ if (mMediaSource)
+ {
+ mMediaSource->focus(false);
- if( LLEditMenuHandler::gEditMenuHandler == mMediaSource )
- {
- // Clear focus for edit menu items
- LLEditMenuHandler::gEditMenuHandler = NULL;
- }
- }
+ if( LLEditMenuHandler::gEditMenuHandler == mMediaSource )
+ {
+ // Clear focus for edit menu items
+ LLEditMenuHandler::gEditMenuHandler = NULL;
+ }
+ }
- gViewerWindow->focusClient();
+ gViewerWindow->focusClient();
- LLPanel::onFocusLost();
+ LLPanel::onFocusLost();
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::postBuild ()
{
- setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2));
+ setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2));
- return TRUE;
+ return TRUE;
}
void LLMediaCtrl::onOpenWebInspector()
{
- if (mMediaSource && mMediaSource->hasMedia())
- mMediaSource->getMediaPlugin()->showWebInspector( true );
+ if (mMediaSource && mMediaSource->hasMedia())
+ mMediaSource->getMediaPlugin()->showWebInspector( true );
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask )
{
- BOOL result = FALSE;
-
- if (mMediaSource)
- {
- result = mMediaSource->handleKeyHere(key, mask);
- }
-
- if ( ! result )
- result = LLPanel::handleKeyHere(key, mask);
-
- return result;
+ BOOL result = FALSE;
+
+ if (mMediaSource)
+ {
+ result = mMediaSource->handleKeyHere(key, mask);
+ }
+
+ if ( ! result )
+ result = LLPanel::handleKeyHere(key, mask);
+
+ return result;
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleKeyUpHere(KEY key, MASK mask)
{
- BOOL result = FALSE;
+ BOOL result = FALSE;
- if (mMediaSource)
- {
- result = mMediaSource->handleKeyUpHere(key, mask);
- }
+ if (mMediaSource)
+ {
+ result = mMediaSource->handleKeyUpHere(key, mask);
+ }
- if (!result)
- result = LLPanel::handleKeyUpHere(key, mask);
+ if (!result)
+ result = LLPanel::handleKeyUpHere(key, mask);
- return result;
+ return result;
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::onVisibilityChange ( BOOL new_visibility )
{
- LL_INFOS() << "visibility changed to " << (new_visibility?"true":"false") << LL_ENDL;
- if(mMediaSource)
- {
- mMediaSource->setVisible( new_visibility );
- }
+ LL_INFOS() << "visibility changed to " << (new_visibility?"true":"false") << LL_ENDL;
+ if(mMediaSource)
+ {
+ mMediaSource->setVisible( new_visibility );
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char)
{
- BOOL result = FALSE;
-
- if (mMediaSource)
- {
- result = mMediaSource->handleUnicodeCharHere(uni_char);
- }
+ BOOL result = FALSE;
- if ( ! result )
- result = LLPanel::handleUnicodeCharHere(uni_char);
+ if (mMediaSource)
+ {
+ result = mMediaSource->handleUnicodeCharHere(uni_char);
+ }
+
+ if ( ! result )
+ result = LLPanel::handleUnicodeCharHere(uni_char);
- return result;
+ return result;
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::onVisibilityChanged ( const LLSD& new_visibility )
{
- // set state of frequent updates automatically if visibility changes
- if ( new_visibility.asBoolean() )
- {
- mFrequentUpdates = true;
- }
- else
- {
- mFrequentUpdates = false;
- }
+ // set state of frequent updates automatically if visibility changes
+ if ( new_visibility.asBoolean() )
+ {
+ mFrequentUpdates = true;
+ }
+ else
+ {
+ mFrequentUpdates = false;
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent )
{
- if(!getDecoupleTextureSize())
- {
- S32 screen_width = ll_round((F32)width * LLUI::getScaleFactor().mV[VX]);
- S32 screen_height = ll_round((F32)height * LLUI::getScaleFactor().mV[VY]);
-
- // when floater is minimized, these sizes are negative
- if ( screen_height > 0 && screen_width > 0 )
- {
- setTextureSize(screen_width, screen_height);
- }
- }
-
- LLUICtrl::reshape( width, height, called_from_parent );
+ if(!getDecoupleTextureSize())
+ {
+ S32 screen_width = ll_round((F32)width * LLUI::getScaleFactor().mV[VX]);
+ S32 screen_height = ll_round((F32)height * LLUI::getScaleFactor().mV[VY]);
+
+ // when floater is minimized, these sizes are negative
+ if ( screen_height > 0 && screen_width > 0 )
+ {
+ setTextureSize(screen_width, screen_height);
+ }
+ }
+
+ LLUICtrl::reshape( width, height, called_from_parent );
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::navigateBack()
{
- if (mMediaSource && mMediaSource->hasMedia())
- {
- mMediaSource->getMediaPlugin()->browse_back();
- }
+ if (mMediaSource && mMediaSource->hasMedia())
+ {
+ mMediaSource->getMediaPlugin()->browse_back();
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::navigateForward()
{
- if (mMediaSource && mMediaSource->hasMedia())
- {
- mMediaSource->getMediaPlugin()->browse_forward();
- }
+ if (mMediaSource && mMediaSource->hasMedia())
+ {
+ mMediaSource->getMediaPlugin()->browse_forward();
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::navigateStop()
{
- if (mMediaSource && mMediaSource->hasMedia())
- {
- mMediaSource->getMediaPlugin()->browse_stop();
- }
+ if (mMediaSource && mMediaSource->hasMedia())
+ {
+ mMediaSource->getMediaPlugin()->browse_stop();
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
bool LLMediaCtrl::canNavigateBack()
{
- if (mMediaSource)
- return mMediaSource->canNavigateBack();
- else
- return false;
+ if (mMediaSource)
+ return mMediaSource->canNavigateBack();
+ else
+ return false;
}
////////////////////////////////////////////////////////////////////////////////
//
bool LLMediaCtrl::canNavigateForward()
{
- if (mMediaSource)
- return mMediaSource->canNavigateForward();
- else
- return false;
+ if (mMediaSource)
+ return mMediaSource->canNavigateForward();
+ else
+ return false;
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::clearCache()
{
- if(mMediaSource)
- {
- mMediaSource->clearCache();
- }
- else
- {
- mClearCache = true;
- }
+ if(mMediaSource)
+ {
+ mMediaSource->clearCache();
+ }
+ else
+ {
+ mClearCache = true;
+ }
}
@@ -609,543 +609,543 @@ void LLMediaCtrl::clearCache()
//
void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type, bool clean_browser)
{
- // don't browse to anything that starts with secondlife:// or sl://
- const std::string protocol1 = "secondlife://";
- const std::string protocol2 = "sl://";
- if ((LLStringUtil::compareInsensitive(url_in.substr(0, protocol1.length()), protocol1) == 0) ||
- (LLStringUtil::compareInsensitive(url_in.substr(0, protocol2.length()), protocol2) == 0))
- {
- // TODO: Print out/log this attempt?
- // LL_INFOS() << "Rejecting attempt to load restricted website :" << urlIn << LL_ENDL;
- return;
- }
-
- if (ensureMediaSourceExists())
- {
- mCurrentNavUrl = url_in;
- mMediaSource->setSize(mTextureWidth, mTextureHeight);
- mMediaSource->navigateTo(url_in, mime_type, mime_type.empty(), false, clean_browser);
- }
+ // don't browse to anything that starts with secondlife:// or sl://
+ const std::string protocol1 = "secondlife://";
+ const std::string protocol2 = "sl://";
+ if ((LLStringUtil::compareInsensitive(url_in.substr(0, protocol1.length()), protocol1) == 0) ||
+ (LLStringUtil::compareInsensitive(url_in.substr(0, protocol2.length()), protocol2) == 0))
+ {
+ // TODO: Print out/log this attempt?
+ // LL_INFOS() << "Rejecting attempt to load restricted website :" << urlIn << LL_ENDL;
+ return;
+ }
+
+ if (ensureMediaSourceExists())
+ {
+ mCurrentNavUrl = url_in;
+ mMediaSource->setSize(mTextureWidth, mTextureHeight);
+ mMediaSource->navigateTo(url_in, mime_type, mime_type.empty(), false, clean_browser);
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::navigateToLocalPage( const std::string& subdir, const std::string& filename_in )
{
- std::string filename(gDirUtilp->add(subdir, filename_in));
- std::string expanded_filename = gDirUtilp->findSkinnedFilename("html", filename);
-
- if (expanded_filename.empty())
- {
- LL_WARNS() << "File " << filename << "not found" << LL_ENDL;
- return;
- }
- if (ensureMediaSourceExists())
- {
- mCurrentNavUrl = expanded_filename;
- mMediaSource->setSize(mTextureWidth, mTextureHeight);
- mMediaSource->navigateTo(expanded_filename, HTTP_CONTENT_TEXT_HTML, false);
- }
+ std::string filename(gDirUtilp->add(subdir, filename_in));
+ std::string expanded_filename = gDirUtilp->findSkinnedFilename("html", filename);
+
+ if (expanded_filename.empty())
+ {
+ LL_WARNS() << "File " << filename << "not found" << LL_ENDL;
+ return;
+ }
+ if (ensureMediaSourceExists())
+ {
+ mCurrentNavUrl = expanded_filename;
+ mMediaSource->setSize(mTextureWidth, mTextureHeight);
+ mMediaSource->navigateTo(expanded_filename, HTTP_CONTENT_TEXT_HTML, false);
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::navigateHome()
{
- if (ensureMediaSourceExists())
- {
- mMediaSource->setSize(mTextureWidth, mTextureHeight);
- mMediaSource->navigateHome();
- }
+ if (ensureMediaSourceExists())
+ {
+ mMediaSource->setSize(mTextureWidth, mTextureHeight);
+ mMediaSource->navigateHome();
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::setHomePageUrl( const std::string& urlIn, const std::string& mime_type )
{
- mHomePageUrl = urlIn;
- if (mMediaSource)
- {
- mMediaSource->setHomeURL(mHomePageUrl, mime_type);
- }
+ mHomePageUrl = urlIn;
+ if (mMediaSource)
+ {
+ mMediaSource->setHomeURL(mHomePageUrl, mime_type);
+ }
}
void LLMediaCtrl::setTarget(const std::string& target)
{
- mTarget = target;
- if (mMediaSource)
- {
- mMediaSource->setTarget(mTarget);
- }
+ mTarget = target;
+ if (mMediaSource)
+ {
+ mMediaSource->setTarget(mTarget);
+ }
}
void LLMediaCtrl::setErrorPageURL(const std::string& url)
{
- mErrorPageURL = url;
+ mErrorPageURL = url;
}
const std::string& LLMediaCtrl::getErrorPageURL()
{
- return mErrorPageURL;
+ return mErrorPageURL;
}
////////////////////////////////////////////////////////////////////////////////
//
bool LLMediaCtrl::setCaretColor(unsigned int red, unsigned int green, unsigned int blue)
{
- //NOOP
- return false;
+ //NOOP
+ return false;
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::setTextureSize(S32 width, S32 height)
{
- mTextureWidth = width;
- mTextureHeight = height;
-
- if(mMediaSource)
- {
- mMediaSource->setSize(mTextureWidth, mTextureHeight);
- mForceUpdate = true;
- }
+ mTextureWidth = width;
+ mTextureHeight = height;
+
+ if(mMediaSource)
+ {
+ mMediaSource->setSize(mTextureWidth, mTextureHeight);
+ mForceUpdate = true;
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
std::string LLMediaCtrl::getHomePageUrl()
{
- return mHomePageUrl;
+ return mHomePageUrl;
}
////////////////////////////////////////////////////////////////////////////////
//
bool LLMediaCtrl::ensureMediaSourceExists()
-{
- if(mMediaSource.isNull())
- {
- // If we don't already have a media source, try to create one.
- mMediaSource = LLViewerMedia::getInstance()->newMediaImpl(mMediaTextureID, mTextureWidth, mTextureHeight);
- if ( mMediaSource )
- {
- mMediaSource->setUsedInUI(true);
- mMediaSource->setHomeURL(mHomePageUrl, mHomePageMimeType);
- mMediaSource->setTarget(mTarget);
- mMediaSource->setVisible( getVisible() );
- mMediaSource->addObserver( this );
- mMediaSource->setBackgroundColor( getBackgroundColor() );
- mMediaSource->setTrustedBrowser(mTrusted);
-
- F32 scale_factor = LLUI::getScaleFactor().mV[ VX ];
- if (scale_factor != mMediaSource->getPageZoomFactor())
- {
- mMediaSource->setPageZoomFactor( scale_factor );
- mUpdateScrolls = true;
- }
-
- if(mClearCache)
- {
- mMediaSource->clearCache();
- mClearCache = false;
- }
- }
- else
- {
- LL_WARNS() << "media source create failed " << LL_ENDL;
- // return;
- }
- }
-
- return !mMediaSource.isNull();
+{
+ if(mMediaSource.isNull())
+ {
+ // If we don't already have a media source, try to create one.
+ mMediaSource = LLViewerMedia::getInstance()->newMediaImpl(mMediaTextureID, mTextureWidth, mTextureHeight);
+ if ( mMediaSource )
+ {
+ mMediaSource->setUsedInUI(true);
+ mMediaSource->setHomeURL(mHomePageUrl, mHomePageMimeType);
+ mMediaSource->setTarget(mTarget);
+ mMediaSource->setVisible( getVisible() );
+ mMediaSource->addObserver( this );
+ mMediaSource->setBackgroundColor( getBackgroundColor() );
+ mMediaSource->setTrustedBrowser(mTrusted);
+
+ F32 scale_factor = LLUI::getScaleFactor().mV[ VX ];
+ if (scale_factor != mMediaSource->getPageZoomFactor())
+ {
+ mMediaSource->setPageZoomFactor( scale_factor );
+ mUpdateScrolls = true;
+ }
+
+ if(mClearCache)
+ {
+ mMediaSource->clearCache();
+ mClearCache = false;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "media source create failed " << LL_ENDL;
+ // return;
+ }
+ }
+
+ return !mMediaSource.isNull();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::unloadMediaSource()
{
- mMediaSource = NULL;
+ mMediaSource = NULL;
}
////////////////////////////////////////////////////////////////////////////////
//
LLPluginClassMedia* LLMediaCtrl::getMediaPlugin()
-{
- return mMediaSource.isNull() ? NULL : mMediaSource->getMediaPlugin();
+{
+ return mMediaSource.isNull() ? NULL : mMediaSource->getMediaPlugin();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::draw()
{
- F32 alpha = getDrawContext().mAlpha;
-
- if ( gRestoreGL == 1 || mUpdateScrolls)
- {
- LLRect r = getRect();
- reshape( r.getWidth(), r.getHeight(), FALSE );
- mUpdateScrolls = false;
- return;
- }
-
- // NOTE: optimization needed here - probably only need to do this once
- // unless tearoffs change the parent which they probably do.
- const LLUICtrl* ptr = findRootMostFocusRoot();
- if ( ptr && ptr->hasFocus() )
- {
- setFrequentUpdates( true );
- }
- else
- {
- setFrequentUpdates( false );
- };
-
- bool draw_media = false;
-
- LLPluginClassMedia* media_plugin = NULL;
- LLViewerMediaTexture* media_texture = NULL;
-
- if(mMediaSource && mMediaSource->hasMedia())
- {
- media_plugin = mMediaSource->getMediaPlugin();
-
- if(media_plugin && (media_plugin->textureValid()))
- {
- media_texture = LLViewerTextureManager::findMediaTexture(mMediaTextureID);
- if(media_texture)
- {
- draw_media = true;
- }
- }
- }
-
- bool background_visible = isBackgroundVisible();
- bool background_opaque = isBackgroundOpaque();
-
- if(draw_media)
- {
- gGL.pushUIMatrix();
- {
- F32 scale_factor = LLUI::getScaleFactor().mV[ VX ];
- if (scale_factor != mMediaSource->getPageZoomFactor())
- {
- mMediaSource->setPageZoomFactor( scale_factor );
- mUpdateScrolls = true;
- }
-
- // scale texture to fit the space using texture coords
- gGL.getTexUnit(0)->bind(media_texture);
- LLColor4 media_color = LLColor4::white % alpha;
- gGL.color4fv( media_color.mV );
- F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth();
- F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight();
-
- S32 x_offset, y_offset, width, height;
- calcOffsetsAndSize(&x_offset, &y_offset, &width, &height);
-
- // draw the browser
- gGL.begin( LLRender::QUADS );
- if (! media_plugin->getTextureCoordsOpenGL())
- {
- // render using web browser reported width and height, instead of trying to invert GL scale
- gGL.texCoord2f( max_u, 0.f );
- gGL.vertex2i( x_offset + width, y_offset + height );
-
- gGL.texCoord2f( 0.f, 0.f );
- gGL.vertex2i( x_offset, y_offset + height );
-
- gGL.texCoord2f( 0.f, max_v );
- gGL.vertex2i( x_offset, y_offset );
-
- gGL.texCoord2f( max_u, max_v );
- gGL.vertex2i( x_offset + width, y_offset );
- }
- else
- {
- // render using web browser reported width and height, instead of trying to invert GL scale
- gGL.texCoord2f( max_u, max_v );
- gGL.vertex2i( x_offset + width, y_offset + height );
-
- gGL.texCoord2f( 0.f, max_v );
- gGL.vertex2i( x_offset, y_offset + height );
-
- gGL.texCoord2f( 0.f, 0.f );
- gGL.vertex2i( x_offset, y_offset );
-
- gGL.texCoord2f( max_u, 0.f );
- gGL.vertex2i( x_offset + width, y_offset );
- }
- gGL.end();
- }
- gGL.popUIMatrix();
-
- }
- else
- {
- // Setting these will make LLPanel::draw draw the opaque background color.
- setBackgroundVisible(true);
- setBackgroundOpaque(true);
- }
-
- // highlight if keyboard focus here. (TODO: this needs some work)
- if ( mBorder && mBorder->getVisible() )
- mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus( this ) );
-
- LLPanel::draw();
-
- // Restore the previous values
- setBackgroundVisible(background_visible);
- setBackgroundOpaque(background_opaque);
+ F32 alpha = getDrawContext().mAlpha;
+
+ if ( gRestoreGL == 1 || mUpdateScrolls)
+ {
+ LLRect r = getRect();
+ reshape( r.getWidth(), r.getHeight(), FALSE );
+ mUpdateScrolls = false;
+ return;
+ }
+
+ // NOTE: optimization needed here - probably only need to do this once
+ // unless tearoffs change the parent which they probably do.
+ const LLUICtrl* ptr = findRootMostFocusRoot();
+ if ( ptr && ptr->hasFocus() )
+ {
+ setFrequentUpdates( true );
+ }
+ else
+ {
+ setFrequentUpdates( false );
+ };
+
+ bool draw_media = false;
+
+ LLPluginClassMedia* media_plugin = NULL;
+ LLViewerMediaTexture* media_texture = NULL;
+
+ if(mMediaSource && mMediaSource->hasMedia())
+ {
+ media_plugin = mMediaSource->getMediaPlugin();
+
+ if(media_plugin && (media_plugin->textureValid()))
+ {
+ media_texture = LLViewerTextureManager::findMediaTexture(mMediaTextureID);
+ if(media_texture)
+ {
+ draw_media = true;
+ }
+ }
+ }
+
+ bool background_visible = isBackgroundVisible();
+ bool background_opaque = isBackgroundOpaque();
+
+ if(draw_media)
+ {
+ gGL.pushUIMatrix();
+ {
+ F32 scale_factor = LLUI::getScaleFactor().mV[ VX ];
+ if (scale_factor != mMediaSource->getPageZoomFactor())
+ {
+ mMediaSource->setPageZoomFactor( scale_factor );
+ mUpdateScrolls = true;
+ }
+
+ // scale texture to fit the space using texture coords
+ gGL.getTexUnit(0)->bind(media_texture);
+ LLColor4 media_color = LLColor4::white % alpha;
+ gGL.color4fv( media_color.mV );
+ F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth();
+ F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight();
+
+ S32 x_offset, y_offset, width, height;
+ calcOffsetsAndSize(&x_offset, &y_offset, &width, &height);
+
+ // draw the browser
+ gGL.begin( LLRender::QUADS );
+ if (! media_plugin->getTextureCoordsOpenGL())
+ {
+ // render using web browser reported width and height, instead of trying to invert GL scale
+ gGL.texCoord2f( max_u, 0.f );
+ gGL.vertex2i( x_offset + width, y_offset + height );
+
+ gGL.texCoord2f( 0.f, 0.f );
+ gGL.vertex2i( x_offset, y_offset + height );
+
+ gGL.texCoord2f( 0.f, max_v );
+ gGL.vertex2i( x_offset, y_offset );
+
+ gGL.texCoord2f( max_u, max_v );
+ gGL.vertex2i( x_offset + width, y_offset );
+ }
+ else
+ {
+ // render using web browser reported width and height, instead of trying to invert GL scale
+ gGL.texCoord2f( max_u, max_v );
+ gGL.vertex2i( x_offset + width, y_offset + height );
+
+ gGL.texCoord2f( 0.f, max_v );
+ gGL.vertex2i( x_offset, y_offset + height );
+
+ gGL.texCoord2f( 0.f, 0.f );
+ gGL.vertex2i( x_offset, y_offset );
+
+ gGL.texCoord2f( max_u, 0.f );
+ gGL.vertex2i( x_offset + width, y_offset );
+ }
+ gGL.end();
+ }
+ gGL.popUIMatrix();
+
+ }
+ else
+ {
+ // Setting these will make LLPanel::draw draw the opaque background color.
+ setBackgroundVisible(true);
+ setBackgroundOpaque(true);
+ }
+
+ // highlight if keyboard focus here. (TODO: this needs some work)
+ if ( mBorder && mBorder->getVisible() )
+ mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus( this ) );
+
+ LLPanel::draw();
+
+ // Restore the previous values
+ setBackgroundVisible(background_visible);
+ setBackgroundOpaque(background_opaque);
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::calcOffsetsAndSize(S32 *x_offset, S32 *y_offset, S32 *width, S32 *height)
{
- const LLRect &r = getRect();
- *x_offset = *y_offset = 0;
-
- if (mStretchToFill)
- {
- if (mMaintainAspectRatio && mMediaSource && mMediaSource->getMediaPlugin())
- {
- F32 media_aspect = (F32)(mMediaSource->getMediaPlugin()->getWidth()) / (F32)(mMediaSource->getMediaPlugin()->getHeight());
- F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight());
- if (media_aspect > view_aspect)
- {
- // max width, adjusted height
- *width = r.getWidth();
- *height = llmin(llmax(ll_round(*width / media_aspect), 0), r.getHeight());
- }
- else
- {
- // max height, adjusted width
- *height = r.getHeight();
- *width = llmin(llmax(ll_round(*height * media_aspect), 0), r.getWidth());
- }
- }
- else
- {
- *width = r.getWidth();
- *height = r.getHeight();
- }
- }
- else
- {
- *width = llmin(mMediaSource->getMediaPlugin()->getWidth(), r.getWidth());
- *height = llmin(mMediaSource->getMediaPlugin()->getHeight(), r.getHeight());
- }
-
- *x_offset = (r.getWidth() - *width) / 2;
- *y_offset = (r.getHeight() - *height) / 2;
+ const LLRect &r = getRect();
+ *x_offset = *y_offset = 0;
+
+ if (mStretchToFill)
+ {
+ if (mMaintainAspectRatio && mMediaSource && mMediaSource->getMediaPlugin())
+ {
+ F32 media_aspect = (F32)(mMediaSource->getMediaPlugin()->getWidth()) / (F32)(mMediaSource->getMediaPlugin()->getHeight());
+ F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight());
+ if (media_aspect > view_aspect)
+ {
+ // max width, adjusted height
+ *width = r.getWidth();
+ *height = llmin(llmax(ll_round(*width / media_aspect), 0), r.getHeight());
+ }
+ else
+ {
+ // max height, adjusted width
+ *height = r.getHeight();
+ *width = llmin(llmax(ll_round(*height * media_aspect), 0), r.getWidth());
+ }
+ }
+ else
+ {
+ *width = r.getWidth();
+ *height = r.getHeight();
+ }
+ }
+ else
+ {
+ *width = llmin(mMediaSource->getMediaPlugin()->getWidth(), r.getWidth());
+ *height = llmin(mMediaSource->getMediaPlugin()->getHeight(), r.getHeight());
+ }
+
+ *x_offset = (r.getWidth() - *width) / 2;
+ *y_offset = (r.getHeight() - *height) / 2;
}
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::convertInputCoords(S32& x, S32& y)
{
- S32 x_offset, y_offset, width, height;
- calcOffsetsAndSize(&x_offset, &y_offset, &width, &height);
-
- x -= x_offset;
- y -= y_offset;
-
- bool coords_opengl = false;
-
- if(mMediaSource && mMediaSource->hasMedia())
- {
- coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL();
- }
-
- x = ll_round((F32)x * LLUI::getScaleFactor().mV[VX]);
- if ( ! coords_opengl )
- {
- y = ll_round((F32)(y) * LLUI::getScaleFactor().mV[VY]);
- }
- else
- {
- y = ll_round((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]);
- };
+ S32 x_offset, y_offset, width, height;
+ calcOffsetsAndSize(&x_offset, &y_offset, &width, &height);
+
+ x -= x_offset;
+ y -= y_offset;
+
+ bool coords_opengl = false;
+
+ if(mMediaSource && mMediaSource->hasMedia())
+ {
+ coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL();
+ }
+
+ x = ll_round((F32)x * LLUI::getScaleFactor().mV[VX]);
+ if ( ! coords_opengl )
+ {
+ y = ll_round((F32)(y) * LLUI::getScaleFactor().mV[VY]);
+ }
+ else
+ {
+ y = ll_round((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]);
+ };
}
////////////////////////////////////////////////////////////////////////////////
// inherited from LLViewerMediaObserver
-//virtual
+//virtual
void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
{
- switch(event)
- {
- case MEDIA_EVENT_CONTENT_UPDATED:
- {
- // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CONTENT_UPDATED " << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_TIME_DURATION_UPDATED:
- {
- // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_TIME_DURATION_UPDATED, time is " << self->getCurrentTime() << " of " << self->getDuration() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_SIZE_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_SIZE_CHANGED " << LL_ENDL;
- LLRect r = getRect();
- reshape( r.getWidth(), r.getHeight(), FALSE );
- };
- break;
-
- case MEDIA_EVENT_CURSOR_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CURSOR_CHANGED, new cursor is " << self->getCursorName() << LL_ENDL;
- }
- break;
-
- case MEDIA_EVENT_NAVIGATE_BEGIN:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_BEGIN, url is " << self->getNavigateURI() << LL_ENDL;
- hideNotification();
- };
- break;
-
- case MEDIA_EVENT_NAVIGATE_COMPLETE:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_COMPLETE, result string is: " << self->getNavigateResultString() << LL_ENDL;
- if(mHidingInitialLoad)
- {
- mHidingInitialLoad = false;
- }
- };
- break;
-
- case MEDIA_EVENT_PROGRESS_UPDATED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PROGRESS_UPDATED, loading at " << self->getProgressPercent() << "%" << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_STATUS_TEXT_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_STATUS_TEXT_CHANGED, new status text is: " << self->getStatusText() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_LOCATION_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LOCATION_CHANGED, new uri is: " << self->getLocation() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_NAVIGATE_ERROR_PAGE:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_ERROR_PAGE" << LL_ENDL;
- if ( mErrorPageURL.length() > 0 )
- {
- navigateTo(mErrorPageURL, HTTP_CONTENT_TEXT_HTML);
- };
- };
- break;
-
- case MEDIA_EVENT_CLICK_LINK_HREF:
- {
- // retrieve the event parameters
- std::string url = self->getClickURL();
- std::string target = self->isOverrideClickTarget() ? self->getOverrideClickTarget() : self->getClickTarget();
- std::string uuid = self->getClickUUID();
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << target << "\", uri is " << url << LL_ENDL;
-
- // try as slurl first
- if (!LLURLDispatcher::dispatch(url, "clicked", NULL, mTrusted))
- {
- LLWeb::loadURL(url, target, uuid);
- }
-
- // CP: removing this code because we no longer support popups so this breaks the flow.
- // replaced with a bare call to LLWeb::LoadURL(...)
- //LLNotification::Params notify_params;
- //notify_params.name = "PopupAttempt";
- //notify_params.payload = LLSD().with("target", target).with("url", url).with("uuid", uuid).with("media_id", mMediaTextureID);
- //notify_params.functor.function = boost::bind(&LLMediaCtrl::onPopup, this, _1, _2);
-
- //if (mTrusted)
- //{
- // LLNotifications::instance().forceResponse(notify_params, 0);
- //}
- //else
- //{
- // LLNotifications::instance().add(notify_params);
- //}
- break;
- };
-
- case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is " << self->getClickURL() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_PLUGIN_FAILED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED" << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED_LAUNCH" << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_NAME_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAME_CHANGED" << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_CLOSE_REQUEST:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL;
- }
- break;
-
- case MEDIA_EVENT_PICK_FILE_REQUEST:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PICK_FILE_REQUEST" << LL_ENDL;
- }
- break;
-
- case MEDIA_EVENT_GEOMETRY_CHANGE:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL;
- }
- break;
-
- case MEDIA_EVENT_AUTH_REQUEST:
- {
- LLNotification::Params auth_request_params;
- auth_request_params.name = "AuthRequest";
-
- // pass in host name and realm for site (may be zero length but will always exist)
- LLSD args;
- LLURL raw_url( self->getAuthURL().c_str() );
- args["HOST_NAME"] = raw_url.getAuthority();
- args["REALM"] = self->getAuthRealm();
- auth_request_params.substitutions = args;
-
- auth_request_params.payload = LLSD().with("media_id", mMediaTextureID);
- auth_request_params.functor.function = boost::bind(&LLViewerMedia::authSubmitCallback, _1, _2);
- LLNotifications::instance().add(auth_request_params);
- };
- break;
-
- case MEDIA_EVENT_LINK_HOVERED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LINK_HOVERED, hover text is: " << self->getHoverText() << LL_ENDL;
- mHoverTextChanged = true;
- };
- break;
-
- case MEDIA_EVENT_FILE_DOWNLOAD:
- {
+ switch(event)
+ {
+ case MEDIA_EVENT_CONTENT_UPDATED:
+ {
+ // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CONTENT_UPDATED " << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_TIME_DURATION_UPDATED:
+ {
+ // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_TIME_DURATION_UPDATED, time is " << self->getCurrentTime() << " of " << self->getDuration() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_SIZE_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_SIZE_CHANGED " << LL_ENDL;
+ LLRect r = getRect();
+ reshape( r.getWidth(), r.getHeight(), FALSE );
+ };
+ break;
+
+ case MEDIA_EVENT_CURSOR_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CURSOR_CHANGED, new cursor is " << self->getCursorName() << LL_ENDL;
+ }
+ break;
+
+ case MEDIA_EVENT_NAVIGATE_BEGIN:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_BEGIN, url is " << self->getNavigateURI() << LL_ENDL;
+ hideNotification();
+ };
+ break;
+
+ case MEDIA_EVENT_NAVIGATE_COMPLETE:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_COMPLETE, result string is: " << self->getNavigateResultString() << LL_ENDL;
+ if(mHidingInitialLoad)
+ {
+ mHidingInitialLoad = false;
+ }
+ };
+ break;
+
+ case MEDIA_EVENT_PROGRESS_UPDATED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PROGRESS_UPDATED, loading at " << self->getProgressPercent() << "%" << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_STATUS_TEXT_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_STATUS_TEXT_CHANGED, new status text is: " << self->getStatusText() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_LOCATION_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LOCATION_CHANGED, new uri is: " << self->getLocation() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_NAVIGATE_ERROR_PAGE:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_ERROR_PAGE" << LL_ENDL;
+ if ( mErrorPageURL.length() > 0 )
+ {
+ navigateTo(mErrorPageURL, HTTP_CONTENT_TEXT_HTML);
+ };
+ };
+ break;
+
+ case MEDIA_EVENT_CLICK_LINK_HREF:
+ {
+ // retrieve the event parameters
+ std::string url = self->getClickURL();
+ std::string target = self->isOverrideClickTarget() ? self->getOverrideClickTarget() : self->getClickTarget();
+ std::string uuid = self->getClickUUID();
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << target << "\", uri is " << url << LL_ENDL;
+
+ // try as slurl first
+ if (!LLURLDispatcher::dispatch(url, "clicked", NULL, mTrusted))
+ {
+ LLWeb::loadURL(url, target, uuid);
+ }
+
+ // CP: removing this code because we no longer support popups so this breaks the flow.
+ // replaced with a bare call to LLWeb::LoadURL(...)
+ //LLNotification::Params notify_params;
+ //notify_params.name = "PopupAttempt";
+ //notify_params.payload = LLSD().with("target", target).with("url", url).with("uuid", uuid).with("media_id", mMediaTextureID);
+ //notify_params.functor.function = boost::bind(&LLMediaCtrl::onPopup, this, _1, _2);
+
+ //if (mTrusted)
+ //{
+ // LLNotifications::instance().forceResponse(notify_params, 0);
+ //}
+ //else
+ //{
+ // LLNotifications::instance().add(notify_params);
+ //}
+ break;
+ };
+
+ case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is " << self->getClickURL() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_PLUGIN_FAILED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED" << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED_LAUNCH" << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_NAME_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAME_CHANGED" << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_CLOSE_REQUEST:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL;
+ }
+ break;
+
+ case MEDIA_EVENT_PICK_FILE_REQUEST:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PICK_FILE_REQUEST" << LL_ENDL;
+ }
+ break;
+
+ case MEDIA_EVENT_GEOMETRY_CHANGE:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL;
+ }
+ break;
+
+ case MEDIA_EVENT_AUTH_REQUEST:
+ {
+ LLNotification::Params auth_request_params;
+ auth_request_params.name = "AuthRequest";
+
+ // pass in host name and realm for site (may be zero length but will always exist)
+ LLSD args;
+ LLURL raw_url( self->getAuthURL().c_str() );
+ args["HOST_NAME"] = raw_url.getAuthority();
+ args["REALM"] = self->getAuthRealm();
+ auth_request_params.substitutions = args;
+
+ auth_request_params.payload = LLSD().with("media_id", mMediaTextureID);
+ auth_request_params.functor.function = boost::bind(&LLViewerMedia::authSubmitCallback, _1, _2);
+ LLNotifications::instance().add(auth_request_params);
+ };
+ break;
+
+ case MEDIA_EVENT_LINK_HOVERED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LINK_HOVERED, hover text is: " << self->getHoverText() << LL_ENDL;
+ mHoverTextChanged = true;
+ };
+ break;
+
+ case MEDIA_EVENT_FILE_DOWNLOAD:
+ {
if (mAllowFileDownload)
{
// pick a file from SAVE FILE dialog
@@ -1168,81 +1168,81 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
LLNotificationsUtil::add("MediaFileDownloadUnsupported");
}
- };
- break;
-
- case MEDIA_EVENT_DEBUG_MESSAGE:
- {
- LL_INFOS("media") << self->getDebugMessageText() << LL_ENDL;
- };
- break;
- };
-
- // chain all events to any potential observers of this object.
- emitEvent(self, event);
+ };
+ break;
+
+ case MEDIA_EVENT_DEBUG_MESSAGE:
+ {
+ LL_INFOS("media") << self->getDebugMessageText() << LL_ENDL;
+ };
+ break;
+ };
+
+ // chain all events to any potential observers of this object.
+ emitEvent(self, event);
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
std::string LLMediaCtrl::getCurrentNavUrl()
{
- return mCurrentNavUrl;
+ return mCurrentNavUrl;
}
void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response)
{
- if (response["open"])
- {
- LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]);
- }
- else
- {
- // Make sure the opening instance knows its window open request was denied, so it can clean things up.
- LLViewerMedia::getInstance()->proxyWindowClosed(notification["payload"]["uuid"]);
- }
+ if (response["open"])
+ {
+ LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]);
+ }
+ else
+ {
+ // Make sure the opening instance knows its window open request was denied, so it can clean things up.
+ LLViewerMedia::getInstance()->proxyWindowClosed(notification["payload"]["uuid"]);
+ }
}
void LLMediaCtrl::showNotification(LLNotificationPtr notify)
{
- LLWindowShade* shade = getChild<LLWindowShade>("notification_shade");
-
- if (notify->getIcon() == "Popup_Caution")
- {
- shade->setBackgroundImage(LLUI::getUIImage("Yellow_Gradient"));
- shade->setTextColor(LLColor4::black);
- shade->setCanClose(true);
- }
- else if (notify->getName() == "AuthRequest")
- {
- shade->setBackgroundImage(LLUI::getUIImage("Yellow_Gradient"));
- shade->setTextColor(LLColor4::black);
- shade->setCanClose(false);
- }
- else
- {
- //HACK: make this a property of the notification itself, "cancellable"
- shade->setCanClose(false);
- shade->setTextColor(LLUIColorTable::instance().getColor("LabelTextColor"));
- }
-
- mWindowShade->show(notify);
+ LLWindowShade* shade = getChild<LLWindowShade>("notification_shade");
+
+ if (notify->getIcon() == "Popup_Caution")
+ {
+ shade->setBackgroundImage(LLUI::getUIImage("Yellow_Gradient"));
+ shade->setTextColor(LLColor4::black);
+ shade->setCanClose(true);
+ }
+ else if (notify->getName() == "AuthRequest")
+ {
+ shade->setBackgroundImage(LLUI::getUIImage("Yellow_Gradient"));
+ shade->setTextColor(LLColor4::black);
+ shade->setCanClose(false);
+ }
+ else
+ {
+ //HACK: make this a property of the notification itself, "cancellable"
+ shade->setCanClose(false);
+ shade->setTextColor(LLUIColorTable::instance().getColor("LabelTextColor"));
+ }
+
+ mWindowShade->show(notify);
}
void LLMediaCtrl::hideNotification()
{
- if (mWindowShade)
- {
- mWindowShade->hide();
- }
+ if (mWindowShade)
+ {
+ mWindowShade->hide();
+ }
}
void LLMediaCtrl::setTrustedContent(bool trusted)
{
- mTrusted = trusted;
- if (mMediaSource)
- {
- mMediaSource->setTrustedBrowser(trusted);
- }
+ mTrusted = trusted;
+ if (mMediaSource)
+ {
+ mMediaSource->setTrustedBrowser(trusted);
+ }
}
bool LLMediaCtrl::wantsKeyUpKeyDown() const
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index 487c654adc..899eab1fea 100644
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,185 +40,185 @@ class LLContextMenu;
////////////////////////////////////////////////////////////////////////////////
//
class LLMediaCtrl :
- public LLPanel,
- public LLViewerMediaObserver,
- public LLViewerMediaEventEmitter,
- public LLInstanceTracker<LLMediaCtrl, LLUUID>
+ public LLPanel,
+ public LLViewerMediaObserver,
+ public LLViewerMediaEventEmitter,
+ public LLInstanceTracker<LLMediaCtrl, LLUUID>
{
- LOG_CLASS(LLMediaCtrl);
+ LOG_CLASS(LLMediaCtrl);
public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {
- Optional<std::string> start_url;
-
- Optional<bool> border_visible,
- hide_loading,
- decouple_texture_size,
- trusted_content,
- focus_on_click;
-
- Optional<S32> texture_width,
- texture_height;
-
- Optional<LLUIColor> caret_color;
-
- Optional<std::string> initial_mime_type;
- Optional<std::string> media_id;
- Optional<std::string> error_page_url;
-
- Params();
- };
-
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<std::string> start_url;
+
+ Optional<bool> border_visible,
+ hide_loading,
+ decouple_texture_size,
+ trusted_content,
+ focus_on_click;
+
+ Optional<S32> texture_width,
+ texture_height;
+
+ Optional<LLUIColor> caret_color;
+
+ Optional<std::string> initial_mime_type;
+ Optional<std::string> media_id;
+ Optional<std::string> error_page_url;
+
+ Params();
+ };
+
protected:
- LLMediaCtrl(const Params&);
- friend class LLUICtrlFactory;
+ LLMediaCtrl(const Params&);
+ friend class LLUICtrlFactory;
public:
- virtual ~LLMediaCtrl();
-
- void setBorderVisible( BOOL border_visible );
-
- // For the tutorial window, we don't want to take focus on clicks,
- // as the examples include how to move around with the arrow
- // keys. Thus we keep focus on the app by setting this false.
- // Defaults to true.
- void setTakeFocusOnClick( bool take_focus );
-
- // handle mouse related methods
- virtual BOOL handleHover( S32 x, S32 y, MASK mask );
- virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
- virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
- virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks );
- virtual BOOL handleScrollHWheel( S32 x, S32 y, S32 clicks );
- virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
-
- // navigation
- void navigateTo( std::string url_in, std::string mime_type = "", bool clean_browser = false);
- void navigateBack();
- void navigateHome();
- void navigateForward();
- void navigateStop();
- void navigateToLocalPage( const std::string& subdir, const std::string& filename_in );
- bool canNavigateBack();
- bool canNavigateForward();
- std::string getCurrentNavUrl();
-
- // By default, we do not handle "secondlife:///app/" SLURLs, because
- // those can cause teleports, open windows, etc. We cannot be sure
- // that each "click" is actually due to a user action, versus
- // Javascript or some other mechanism. However, we need the search
- // floater and login page to handle these URLs. Those are safe
- // because we control the page content. See DEV-9530. JC.
- void setHomePageUrl( const std::string& urlIn, const std::string& mime_type = LLStringUtil::null );
- std::string getHomePageUrl();
-
- void setTarget(const std::string& target);
-
- void setErrorPageURL(const std::string& url);
- const std::string& getErrorPageURL();
-
- // Clear the browser cache when the instance gets loaded
- void clearCache();
-
- // accessor/mutator for flag that indicates if frequent updates to texture happen
- bool getFrequentUpdates() { return mFrequentUpdates; };
- void setFrequentUpdates( bool frequentUpdatesIn ) { mFrequentUpdates = frequentUpdatesIn; };
-
- void setAlwaysRefresh(bool refresh) { mAlwaysRefresh = refresh; }
- bool getAlwaysRefresh() { return mAlwaysRefresh; }
-
- void setForceUpdate(bool force_update) { mForceUpdate = force_update; }
- bool getForceUpdate() { return mForceUpdate; }
-
- bool ensureMediaSourceExists();
- void unloadMediaSource();
-
- LLPluginClassMedia* getMediaPlugin();
-
- bool setCaretColor( unsigned int red, unsigned int green, unsigned int blue );
-
- void setDecoupleTextureSize(bool decouple) { mDecoupleTextureSize = decouple; }
- bool getDecoupleTextureSize() { return mDecoupleTextureSize; }
-
- void setTextureSize(S32 width, S32 height);
-
- void showNotification(LLNotificationPtr notify);
- void hideNotification();
-
- void setTrustedContent(bool trusted);
+ virtual ~LLMediaCtrl();
+
+ void setBorderVisible( BOOL border_visible );
+
+ // For the tutorial window, we don't want to take focus on clicks,
+ // as the examples include how to move around with the arrow
+ // keys. Thus we keep focus on the app by setting this false.
+ // Defaults to true.
+ void setTakeFocusOnClick( bool take_focus );
+
+ // handle mouse related methods
+ virtual BOOL handleHover( S32 x, S32 y, MASK mask );
+ virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
+ virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
+ virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks );
+ virtual BOOL handleScrollHWheel( S32 x, S32 y, S32 clicks );
+ virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
+
+ // navigation
+ void navigateTo( std::string url_in, std::string mime_type = "", bool clean_browser = false);
+ void navigateBack();
+ void navigateHome();
+ void navigateForward();
+ void navigateStop();
+ void navigateToLocalPage( const std::string& subdir, const std::string& filename_in );
+ bool canNavigateBack();
+ bool canNavigateForward();
+ std::string getCurrentNavUrl();
+
+ // By default, we do not handle "secondlife:///app/" SLURLs, because
+ // those can cause teleports, open windows, etc. We cannot be sure
+ // that each "click" is actually due to a user action, versus
+ // Javascript or some other mechanism. However, we need the search
+ // floater and login page to handle these URLs. Those are safe
+ // because we control the page content. See DEV-9530. JC.
+ void setHomePageUrl( const std::string& urlIn, const std::string& mime_type = LLStringUtil::null );
+ std::string getHomePageUrl();
+
+ void setTarget(const std::string& target);
+
+ void setErrorPageURL(const std::string& url);
+ const std::string& getErrorPageURL();
+
+ // Clear the browser cache when the instance gets loaded
+ void clearCache();
+
+ // accessor/mutator for flag that indicates if frequent updates to texture happen
+ bool getFrequentUpdates() { return mFrequentUpdates; };
+ void setFrequentUpdates( bool frequentUpdatesIn ) { mFrequentUpdates = frequentUpdatesIn; };
+
+ void setAlwaysRefresh(bool refresh) { mAlwaysRefresh = refresh; }
+ bool getAlwaysRefresh() { return mAlwaysRefresh; }
+
+ void setForceUpdate(bool force_update) { mForceUpdate = force_update; }
+ bool getForceUpdate() { return mForceUpdate; }
+
+ bool ensureMediaSourceExists();
+ void unloadMediaSource();
+
+ LLPluginClassMedia* getMediaPlugin();
+
+ bool setCaretColor( unsigned int red, unsigned int green, unsigned int blue );
+
+ void setDecoupleTextureSize(bool decouple) { mDecoupleTextureSize = decouple; }
+ bool getDecoupleTextureSize() { return mDecoupleTextureSize; }
+
+ void setTextureSize(S32 width, S32 height);
+
+ void showNotification(LLNotificationPtr notify);
+ void hideNotification();
+
+ void setTrustedContent(bool trusted);
void setAllowFileDownload(bool allow) { mAllowFileDownload = allow; }
- // over-rides
- virtual BOOL handleKeyHere( KEY key, MASK mask);
- virtual BOOL handleKeyUpHere(KEY key, MASK mask);
- virtual void onVisibilityChange ( BOOL new_visibility );
- virtual BOOL handleUnicodeCharHere(llwchar uni_char);
- virtual void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE);
- virtual void draw();
- virtual BOOL postBuild();
+ // over-rides
+ virtual BOOL handleKeyHere( KEY key, MASK mask);
+ virtual BOOL handleKeyUpHere(KEY key, MASK mask);
+ virtual void onVisibilityChange ( BOOL new_visibility );
+ virtual BOOL handleUnicodeCharHere(llwchar uni_char);
+ virtual void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE);
+ virtual void draw();
+ virtual BOOL postBuild();
- // focus overrides
- void onFocusLost();
- void onFocusReceived();
-
- // Incoming media event dispatcher
- virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+ // focus overrides
+ void onFocusLost();
+ void onFocusReceived();
- // right click debugging item
- void onOpenWebInspector();
+ // Incoming media event dispatcher
+ virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
- LLUUID getTextureID() {return mMediaTextureID;}
+ // right click debugging item
+ void onOpenWebInspector();
+
+ LLUUID getTextureID() {return mMediaTextureID;}
// The Browser windows want keyup and keydown events. Overridden from LLFocusableElement to return true.
virtual bool wantsKeyUpKeyDown() const;
virtual bool wantsReturnKey() const;
- virtual BOOL acceptsTextInput() const {return TRUE;}
+ virtual BOOL acceptsTextInput() const {return TRUE;}
+
+ protected:
+ void convertInputCoords(S32& x, S32& y);
- protected:
- void convertInputCoords(S32& x, S32& y);
+ private:
+ void calcOffsetsAndSize(S32 *x_offset, S32 *y_offset, S32 *width, S32 *height);
private:
- void calcOffsetsAndSize(S32 *x_offset, S32 *y_offset, S32 *width, S32 *height);
-
- private:
- void onVisibilityChanged ( const LLSD& new_visibility );
- void onPopup(const LLSD& notification, const LLSD& response);
-
- const S32 mTextureDepthBytes;
- LLUUID mMediaTextureID;
- LLViewBorder* mBorder;
- bool mFrequentUpdates,
- mForceUpdate,
- mTrusted,
- mAlwaysRefresh,
- mTakeFocusOnClick,
- mStretchToFill,
- mMaintainAspectRatio,
- mHideLoading,
- mHidingInitialLoad,
- mClearCache,
- mHoverTextChanged,
- mDecoupleTextureSize,
- mUpdateScrolls,
+ void onVisibilityChanged ( const LLSD& new_visibility );
+ void onPopup(const LLSD& notification, const LLSD& response);
+
+ const S32 mTextureDepthBytes;
+ LLUUID mMediaTextureID;
+ LLViewBorder* mBorder;
+ bool mFrequentUpdates,
+ mForceUpdate,
+ mTrusted,
+ mAlwaysRefresh,
+ mTakeFocusOnClick,
+ mStretchToFill,
+ mMaintainAspectRatio,
+ mHideLoading,
+ mHidingInitialLoad,
+ mClearCache,
+ mHoverTextChanged,
+ mDecoupleTextureSize,
+ mUpdateScrolls,
mAllowFileDownload;
- std::string mHomePageUrl,
- mHomePageMimeType,
- mCurrentNavUrl,
- mErrorPageURL,
- mTarget;
- viewer_media_t mMediaSource;
- S32 mTextureWidth,
- mTextureHeight;
-
- class LLWindowShade* mWindowShade;
- LLHandle<LLContextMenu> mContextMenuHandle;
+ std::string mHomePageUrl,
+ mHomePageMimeType,
+ mCurrentNavUrl,
+ mErrorPageURL,
+ mTarget;
+ viewer_media_t mMediaSource;
+ S32 mTextureWidth,
+ mTextureHeight;
+
+ class LLWindowShade* mWindowShade;
+ LLHandle<LLContextMenu> mContextMenuHandle;
};
#endif // LL_LLMediaCtrl_H
diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp
index d3b981e205..52898d1b86 100644
--- a/indra/newview/llmediadataclient.cpp
+++ b/indra/newview/llmediadataclient.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmediadataclient.cpp
* @brief class for queueing up requests for media data
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,39 +46,39 @@
//
// When making a request
-// - obtain the "overall interest score" of the object.
-// This would be the sum of the impls' interest scores.
-// - put the request onto a queue sorted by this score
-// (highest score at the front of the queue)
-// - On a timer, once a second, pull off the head of the queue and send
-// the request.
+// - obtain the "overall interest score" of the object.
+// This would be the sum of the impls' interest scores.
+// - put the request onto a queue sorted by this score
+// (highest score at the front of the queue)
+// - On a timer, once a second, pull off the head of the queue and send
+// the request.
// - Any request that gets a 503 still goes through the retry logic
//
/***************************************************************************************************************
- What's up with this queueing code?
+ What's up with this queueing code?
- First, a bit of background:
+ First, a bit of background:
- Media on a prim was added into the system in the Viewer 2.0 timeframe. In order to avoid changing the
- network format of objects, an unused field in the object (the "MediaURL" string) was repurposed to
- indicate that the object had media data, and also hold a sequence number and the UUID of the agent
- who last updated the data. The actual media data for objects is accessed via the "ObjectMedia" capability.
- Due to concerns about sim performance, requests to this capability are rate-limited to 5 requests every
- 5 seconds per agent.
+ Media on a prim was added into the system in the Viewer 2.0 timeframe. In order to avoid changing the
+ network format of objects, an unused field in the object (the "MediaURL" string) was repurposed to
+ indicate that the object had media data, and also hold a sequence number and the UUID of the agent
+ who last updated the data. The actual media data for objects is accessed via the "ObjectMedia" capability.
+ Due to concerns about sim performance, requests to this capability are rate-limited to 5 requests every
+ 5 seconds per agent.
- The initial implementation of LLMediaDataClient used a single queue to manage requests to the "ObjectMedia" cap.
- Requests to the cap were queued so that objects closer to the avatar were loaded in first, since they were most
- likely to be the ones the media performance manager would load.
+ The initial implementation of LLMediaDataClient used a single queue to manage requests to the "ObjectMedia" cap.
+ Requests to the cap were queued so that objects closer to the avatar were loaded in first, since they were most
+ likely to be the ones the media performance manager would load.
- This worked in some cases, but we found that it was possible for a scripted object that constantly updated its
- media data to starve other objects, since the same queue contained both requests to load previously unseen media
- data and requests to fetch media data in response to object updates.
+ This worked in some cases, but we found that it was possible for a scripted object that constantly updated its
+ media data to starve other objects, since the same queue contained both requests to load previously unseen media
+ data and requests to fetch media data in response to object updates.
- The solution for this we came up with was to have two queues. The sorted queue contains requests to fetch media
- data for objects that don't have it yet, and the round-robin queue contains requests to update media data for
- objects that have already completed their initial load. When both queues are non-empty, the code ping-pongs
- between them so that updates can't completely block initial load-in.
+ The solution for this we came up with was to have two queues. The sorted queue contains requests to fetch media
+ data for objects that don't have it yet, and the round-robin queue contains requests to update media data for
+ objects that have already completed their initial load. When both queues are non-empty, the code ping-pongs
+ between them so that updates can't completely block initial load-in.
**************************************************************************************************************/
//
@@ -98,7 +98,7 @@ std::ostream& operator<<(std::ostream &s, const LLMediaDataClient::Request &q);
//=========================================================================
/// Uniary Predicate for matching requests in collections by either the request
/// or by UUID
-///
+///
class PredicateMatchRequest
{
public:
@@ -121,7 +121,7 @@ PredicateMatchRequest::PredicateMatchRequest(const LLMediaDataClient::Request::p
mMatchType(matchType),
mId()
{}
-
+
PredicateMatchRequest::PredicateMatchRequest(const LLUUID &id, LLMediaDataClient::Request::Type matchType) :
mRequest(),
mMatchType(matchType),
@@ -145,7 +145,7 @@ bool PredicateMatchRequest::operator()(const LLMediaDataClient::Request::ptr_t &
}
//=========================================================================
-///
+///
template <typename T>
void mark_dead_and_remove_if(T &c, const PredicateMatchRequest &matchPred)
{
@@ -169,7 +169,7 @@ void mark_dead_and_remove_if(T &c, const PredicateMatchRequest &matchPred)
//
//////////////////////////////////////////////////////////////////////////////////////
-LLMediaDataClient::LLMediaDataClient(F32 queue_timer_delay, F32 retry_timer_delay,
+LLMediaDataClient::LLMediaDataClient(F32 queue_timer_delay, F32 retry_timer_delay,
U32 max_retries, U32 max_sorted_queue_size, U32 max_round_robin_queue_size):
mQueueTimerDelay(queue_timer_delay),
mRetryTimerDelay(retry_timer_delay),
@@ -187,12 +187,12 @@ LLMediaDataClient::LLMediaDataClient(F32 queue_timer_delay, F32 retry_timer_dela
LLMediaDataClient::~LLMediaDataClient()
{
- stopQueueTimer();
+ stopQueueTimer();
}
bool LLMediaDataClient::isEmpty() const
{
- return mQueue.empty();
+ return mQueue.empty();
}
bool LLMediaDataClient::isInQueue(const LLMediaDataClientObject::ptr_t &object)
@@ -203,114 +203,114 @@ bool LLMediaDataClient::isInQueue(const LLMediaDataClientObject::ptr_t &object)
return true;
if (std::find_if(mUnQueuedRequests.begin(), mUnQueuedRequests.end(), upred) != mUnQueuedRequests.end())
return true;
-
- return false;
+
+ return false;
}
void LLMediaDataClient::removeFromQueue(const LLMediaDataClientObject::ptr_t &object)
{
- LL_DEBUGS("LLMediaDataClient") << "removing requests matching ID " << object->getID() << LL_ENDL;
+ LL_DEBUGS("LLMediaDataClient") << "removing requests matching ID " << object->getID() << LL_ENDL;
PredicateMatchRequest upred(object->getID());
mark_dead_and_remove_if(mQueue, upred);
mark_dead_and_remove_if(mUnQueuedRequests, upred);
}
-void LLMediaDataClient::startQueueTimer()
+void LLMediaDataClient::startQueueTimer()
{
- if (! mQueueTimerIsRunning)
- {
- LL_DEBUGS("LLMediaDataClient") << "starting queue timer (delay=" << mQueueTimerDelay << " seconds)" << LL_ENDL;
- // LLEventTimer automagically takes care of the lifetime of this object
- new QueueTimer(mQueueTimerDelay, this);
- }
- else {
- LL_DEBUGS("LLMediaDataClient") << "queue timer is already running" << LL_ENDL;
- }
+ if (! mQueueTimerIsRunning)
+ {
+ LL_DEBUGS("LLMediaDataClient") << "starting queue timer (delay=" << mQueueTimerDelay << " seconds)" << LL_ENDL;
+ // LLEventTimer automagically takes care of the lifetime of this object
+ new QueueTimer(mQueueTimerDelay, this);
+ }
+ else {
+ LL_DEBUGS("LLMediaDataClient") << "queue timer is already running" << LL_ENDL;
+ }
}
void LLMediaDataClient::stopQueueTimer()
{
- mQueueTimerIsRunning = false;
+ mQueueTimerIsRunning = false;
}
bool LLMediaDataClient::processQueueTimer()
{
if (isDoneProcessing())
- return true;
+ return true;
+
+ LL_DEBUGS("LLMediaDataClient") << "QueueTimer::tick() started, queue size is: " << mQueue.size() << LL_ENDL;
+ LL_DEBUGS("LLMediaDataClientQueue") << "QueueTimer::tick() started, SORTED queue is: " << mQueue << LL_ENDL;
- LL_DEBUGS("LLMediaDataClient") << "QueueTimer::tick() started, queue size is: " << mQueue.size() << LL_ENDL;
- LL_DEBUGS("LLMediaDataClientQueue") << "QueueTimer::tick() started, SORTED queue is: " << mQueue << LL_ENDL;
-
- serviceQueue();
+ serviceQueue();
serviceHttp();
- LL_DEBUGS("LLMediaDataClient") << "QueueTimer::tick() finished, queue size is: " << mQueue.size() << LL_ENDL;
- LL_DEBUGS("LLMediaDataClientQueue") << "QueueTimer::tick() finished, SORTED queue is: " << mQueue << LL_ENDL;
-
+ LL_DEBUGS("LLMediaDataClient") << "QueueTimer::tick() finished, queue size is: " << mQueue.size() << LL_ENDL;
+ LL_DEBUGS("LLMediaDataClientQueue") << "QueueTimer::tick() finished, SORTED queue is: " << mQueue << LL_ENDL;
+
return isDoneProcessing();
}
LLMediaDataClient::Request::ptr_t LLMediaDataClient::dequeue()
{
- Request::ptr_t request;
- request_queue_t *queue_p = getQueue();
-
- if (queue_p->empty())
- {
- LL_DEBUGS("LLMediaDataClient") << "queue empty: " << (*queue_p) << LL_ENDL;
- }
- else
- {
- request = queue_p->front();
-
- if(canServiceRequest(request))
- {
- // We will be returning this request, so remove it from the queue.
- queue_p->pop_front();
- }
- else
- {
- // Don't return this request -- it's not ready to be serviced.
+ Request::ptr_t request;
+ request_queue_t *queue_p = getQueue();
+
+ if (queue_p->empty())
+ {
+ LL_DEBUGS("LLMediaDataClient") << "queue empty: " << (*queue_p) << LL_ENDL;
+ }
+ else
+ {
+ request = queue_p->front();
+
+ if(canServiceRequest(request))
+ {
+ // We will be returning this request, so remove it from the queue.
+ queue_p->pop_front();
+ }
+ else
+ {
+ // Don't return this request -- it's not ready to be serviced.
request.reset();
- }
- }
+ }
+ }
- return request;
+ return request;
}
void LLMediaDataClient::pushBack(Request::ptr_t request)
{
- request_queue_t *queue_p = getQueue();
- queue_p->push_front(request);
+ request_queue_t *queue_p = getQueue();
+ queue_p->push_front(request);
}
void LLMediaDataClient::trackRequest(Request::ptr_t request)
{
- request_set_t::iterator iter = mUnQueuedRequests.find(request);
-
- if(iter != mUnQueuedRequests.end())
- {
- LL_WARNS("LLMediaDataClient") << "Tracking already tracked request: " << *request << LL_ENDL;
- }
- else
- {
- mUnQueuedRequests.insert(request);
- }
+ request_set_t::iterator iter = mUnQueuedRequests.find(request);
+
+ if(iter != mUnQueuedRequests.end())
+ {
+ LL_WARNS("LLMediaDataClient") << "Tracking already tracked request: " << *request << LL_ENDL;
+ }
+ else
+ {
+ mUnQueuedRequests.insert(request);
+ }
}
void LLMediaDataClient::stopTrackingRequest(Request::ptr_t request)
{
- request_set_t::iterator iter = mUnQueuedRequests.find(request);
-
- if (iter != mUnQueuedRequests.end())
- {
- mUnQueuedRequests.erase(iter);
- }
- else
- {
- LL_WARNS("LLMediaDataClient") << "Removing an untracked request: " << *request << LL_ENDL;
- }
+ request_set_t::iterator iter = mUnQueuedRequests.find(request);
+
+ if (iter != mUnQueuedRequests.end())
+ {
+ mUnQueuedRequests.erase(iter);
+ }
+ else
+ {
+ LL_WARNS("LLMediaDataClient") << "Removing an untracked request: " << *request << LL_ENDL;
+ }
}
bool LLMediaDataClient::isDoneProcessing() const
@@ -320,39 +320,39 @@ bool LLMediaDataClient::isDoneProcessing() const
void LLMediaDataClient::serviceQueue()
-{
- // Peel one off of the items from the queue and execute it
- Request::ptr_t request;
-
- do
- {
- request = dequeue();
-
- if(!request)
- {
- // Queue is empty.
- return;
- }
-
- if(request->isDead())
- {
- LL_INFOS("LLMediaDataClient") << "Skipping dead request " << *request << LL_ENDL;
- continue;
- }
-
- } while(false);
-
- // try to send the HTTP message to the cap url
- std::string url = request->getCapability();
- if (!url.empty())
- {
- const LLSD &sd_payload = request->getPayload();
- LL_INFOS("LLMediaDataClient") << "Sending request for " << *request << LL_ENDL;
-
- // Add this request to the non-queued tracking list
- trackRequest(request);
-
- // and make the post
+{
+ // Peel one off of the items from the queue and execute it
+ Request::ptr_t request;
+
+ do
+ {
+ request = dequeue();
+
+ if(!request)
+ {
+ // Queue is empty.
+ return;
+ }
+
+ if(request->isDead())
+ {
+ LL_INFOS("LLMediaDataClient") << "Skipping dead request " << *request << LL_ENDL;
+ continue;
+ }
+
+ } while(false);
+
+ // try to send the HTTP message to the cap url
+ std::string url = request->getCapability();
+ if (!url.empty())
+ {
+ const LLSD &sd_payload = request->getPayload();
+ LL_INFOS("LLMediaDataClient") << "Sending request for " << *request << LL_ENDL;
+
+ // Add this request to the non-queued tracking list
+ trackRequest(request);
+
+ // and make the post
LLCore::HttpHandler::ptr_t handler = request->createHandler();
LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, mHttpPolicy,
url, sd_payload, mHttpOpts, mHttpHeaders, handler);
@@ -363,25 +363,25 @@ void LLMediaDataClient::serviceQueue()
LL_WARNS("LLMediaDataClient") << "'" << url << "' request POST failed. Reason "
<< status.toTerseString() << " \"" << status.toString() << "\"" << LL_ENDL;
}
- }
- else
- {
- // Cap url doesn't exist.
-
- if(request->getRetryCount() < mMaxNumRetries)
- {
- LL_WARNS("LLMediaDataClient") << "Could not send request " << *request << " (empty cap url), will retry." << LL_ENDL;
- // Put this request back at the head of its queue, and retry next time the queue timer fires.
- request->incRetryCount();
- pushBack(request);
- }
- else
- {
- // This request has exceeded its maximum retry count. It will be dropped.
- LL_WARNS("LLMediaDataClient") << "Could not send request " << *request << " for " << mMaxNumRetries << " tries, dropping request." << LL_ENDL;
- }
-
- }
+ }
+ else
+ {
+ // Cap url doesn't exist.
+
+ if(request->getRetryCount() < mMaxNumRetries)
+ {
+ LL_WARNS("LLMediaDataClient") << "Could not send request " << *request << " (empty cap url), will retry." << LL_ENDL;
+ // Put this request back at the head of its queue, and retry next time the queue timer fires.
+ request->incRetryCount();
+ pushBack(request);
+ }
+ else
+ {
+ // This request has exceeded its maximum retry count. It will be dropped.
+ LL_WARNS("LLMediaDataClient") << "Could not send request " << *request << " for " << mMaxNumRetries << " tries, dropping request." << LL_ENDL;
+ }
+
+ }
}
void LLMediaDataClient::serviceHttp()
@@ -392,16 +392,16 @@ void LLMediaDataClient::serviceHttp()
// dump the queue
std::ostream& operator<<(std::ostream &s, const LLMediaDataClient::request_queue_t &q)
{
- int i = 0;
- LLMediaDataClient::request_queue_t::const_iterator iter = q.begin();
- LLMediaDataClient::request_queue_t::const_iterator end = q.end();
- while (iter != end)
- {
- s << "\t" << i << "]: " << (*iter)->getID().asString() << "(" << (*iter)->getObject()->getMediaInterest() << ")";
- iter++;
- i++;
- }
- return s;
+ int i = 0;
+ LLMediaDataClient::request_queue_t::const_iterator iter = q.begin();
+ LLMediaDataClient::request_queue_t::const_iterator end = q.end();
+ while (iter != end)
+ {
+ s << "\t" << i << "]: " << (*iter)->getID().asString() << "(" << (*iter)->getObject()->getMediaInterest() << ")";
+ iter++;
+ i++;
+ }
+ return s;
}
//////////////////////////////////////////////////////////////////////////////////////
@@ -414,27 +414,27 @@ std::ostream& operator<<(std::ostream &s, const LLMediaDataClient::request_queue
LLMediaDataClient::QueueTimer::QueueTimer(F32 time, LLMediaDataClient *mdc)
: LLEventTimer(time), mMDC(mdc)
{
- mMDC->setIsRunning(true);
+ mMDC->setIsRunning(true);
}
// virtual
BOOL LLMediaDataClient::QueueTimer::tick()
{
- BOOL result = TRUE;
-
- if (!mMDC.isNull())
- {
- result = mMDC->processQueueTimer();
-
- if(result)
- {
- // This timer won't fire again.
- mMDC->setIsRunning(false);
- mMDC = NULL;
- }
- }
+ BOOL result = TRUE;
+
+ if (!mMDC.isNull())
+ {
+ result = mMDC->processQueueTimer();
+
+ if(result)
+ {
+ // This timer won't fire again.
+ mMDC->setIsRunning(false);
+ mMDC = NULL;
+ }
+ }
- return result;
+ return result;
}
@@ -447,29 +447,29 @@ BOOL LLMediaDataClient::QueueTimer::tick()
LLMediaDataClient::RetryTimer::RetryTimer(F32 time, Request::ptr_t request)
: LLEventTimer(time), mRequest(request)
{
- mRequest->startTracking();
+ mRequest->startTracking();
}
// virtual
BOOL LLMediaDataClient::RetryTimer::tick()
{
- mRequest->stopTracking();
-
- if(mRequest->isDead())
- {
- LL_INFOS("LLMediaDataClient") << "RetryTimer fired for dead request: " << *mRequest << ", aborting." << LL_ENDL;
- }
- else
- {
- LL_INFOS("LLMediaDataClient") << "RetryTimer fired for: " << *mRequest << ", retrying." << LL_ENDL;
- mRequest->reEnqueue();
- }
-
- // Release the ref to the request.
+ mRequest->stopTracking();
+
+ if(mRequest->isDead())
+ {
+ LL_INFOS("LLMediaDataClient") << "RetryTimer fired for dead request: " << *mRequest << ", aborting." << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS("LLMediaDataClient") << "RetryTimer fired for: " << *mRequest << ", retrying." << LL_ENDL;
+ mRequest->reEnqueue();
+ }
+
+ // Release the ref to the request.
mRequest.reset();
- // Don't fire again
- return TRUE;
+ // Don't fire again
+ return TRUE;
}
@@ -481,124 +481,124 @@ BOOL LLMediaDataClient::RetryTimer::tick()
/*static*/U32 LLMediaDataClient::Request::sNum = 0;
LLMediaDataClient::Request::Request(Type in_type,
- LLMediaDataClientObject *obj,
- LLMediaDataClient *mdc,
- S32 face)
+ LLMediaDataClientObject *obj,
+ LLMediaDataClient *mdc,
+ S32 face)
: mType(in_type),
mObject(obj),
- mNum(++sNum),
+ mNum(++sNum),
mRetryCount(0),
mMDC(mdc),
mScore((F64)0.0),
mFace(face)
{
- mObjectID = mObject->getID();
+ mObjectID = mObject->getID();
}
const char *LLMediaDataClient::Request::getCapName() const
{
- if(mMDC)
- return mMDC->getCapabilityName();
-
- return "";
+ if(mMDC)
+ return mMDC->getCapabilityName();
+
+ return "";
}
std::string LLMediaDataClient::Request::getCapability() const
{
- if(mMDC)
- {
- return getObject()->getCapabilityUrl(getCapName());
- }
-
- return "";
+ if(mMDC)
+ {
+ return getObject()->getCapabilityUrl(getCapName());
+ }
+
+ return "";
}
const char *LLMediaDataClient::Request::getTypeAsString() const
{
- Type t = getType();
- switch (t)
- {
- case GET:
- return "GET";
- break;
- case UPDATE:
- return "UPDATE";
- break;
- case NAVIGATE:
- return "NAVIGATE";
- break;
- case ANY:
- return "ANY";
- break;
- }
- return "";
+ Type t = getType();
+ switch (t)
+ {
+ case GET:
+ return "GET";
+ break;
+ case UPDATE:
+ return "UPDATE";
+ break;
+ case NAVIGATE:
+ return "NAVIGATE";
+ break;
+ case ANY:
+ return "ANY";
+ break;
+ }
+ return "";
}
void LLMediaDataClient::Request::reEnqueue()
{
- if(mMDC)
- {
- mMDC->enqueue(shared_from_this());
- }
+ if(mMDC)
+ {
+ mMDC->enqueue(shared_from_this());
+ }
}
F32 LLMediaDataClient::Request::getRetryTimerDelay() const
{
- if(mMDC)
- return mMDC->mRetryTimerDelay;
-
- return 0.0f;
+ if(mMDC)
+ return mMDC->mRetryTimerDelay;
+
+ return 0.0f;
}
U32 LLMediaDataClient::Request::getMaxNumRetries() const
{
- if(mMDC)
- return mMDC->mMaxNumRetries;
-
- return 0;
+ if(mMDC)
+ return mMDC->mMaxNumRetries;
+
+ return 0;
}
void LLMediaDataClient::Request::updateScore()
-{
- F64 tmp = mObject->getMediaInterest();
- if (tmp != mScore)
- {
- LL_DEBUGS("LLMediaDataClient") << "Score for " << mObject->getID() << " changed from " << mScore << " to " << tmp << LL_ENDL;
- mScore = tmp;
- }
+{
+ F64 tmp = mObject->getMediaInterest();
+ if (tmp != mScore)
+ {
+ LL_DEBUGS("LLMediaDataClient") << "Score for " << mObject->getID() << " changed from " << mScore << " to " << tmp << LL_ENDL;
+ mScore = tmp;
+ }
}
-
-void LLMediaDataClient::Request::markDead()
-{
- mMDC = NULL;
+
+void LLMediaDataClient::Request::markDead()
+{
+ mMDC = NULL;
}
-bool LLMediaDataClient::Request::isDead()
-{
- return ((mMDC == NULL) || mObject->isDead());
+bool LLMediaDataClient::Request::isDead()
+{
+ return ((mMDC == NULL) || mObject->isDead());
}
-void LLMediaDataClient::Request::startTracking()
-{
- if(mMDC)
+void LLMediaDataClient::Request::startTracking()
+{
+ if(mMDC)
mMDC->trackRequest(shared_from_this());
}
-void LLMediaDataClient::Request::stopTracking()
-{
- if(mMDC)
+void LLMediaDataClient::Request::stopTracking()
+{
+ if(mMDC)
mMDC->stopTrackingRequest(shared_from_this());
}
std::ostream& operator<<(std::ostream &s, const LLMediaDataClient::Request &r)
{
- s << "request: num=" << r.getNum()
- << " type=" << r.getTypeAsString()
- << " ID=" << r.getID()
- << " face=" << r.getFace()
- << " #retries=" << r.getRetryCount();
- return s;
+ s << "request: num=" << r.getNum()
+ << " type=" << r.getTypeAsString()
+ << " ID=" << r.getID()
+ << " face=" << r.getFace()
+ << " #retries=" << r.getRetryCount();
+ return s;
}
//========================================================================
@@ -634,7 +634,7 @@ void LLMediaDataClient::Handler::onFailure(LLCore::HttpResponse * response, LLCo
mRequest->incRetryCount();
- if (mRequest->getRetryCount() < mRequest->getMaxNumRetries())
+ if (mRequest->getRetryCount() < mRequest->getMaxNumRetries())
{
LL_INFOS("LLMediaDataClient") << *mRequest << " got SERVICE_UNAVAILABLE...retrying in " << retry_timeout << " seconds" << LL_ENDL;
@@ -642,9 +642,9 @@ void LLMediaDataClient::Handler::onFailure(LLCore::HttpResponse * response, LLCo
// InstanceTracker<> and LLEventTimer)
new RetryTimer(F32(retry_timeout/*secs*/), mRequest);
}
- else
+ else
{
- LL_INFOS("LLMediaDataClient") << *mRequest << " got SERVICE_UNAVAILABLE...retry count "
+ LL_INFOS("LLMediaDataClient") << *mRequest << " got SERVICE_UNAVAILABLE...retry count "
<< mRequest->getRetryCount() << " exceeds " << mRequest->getMaxNumRetries() << ", not retrying" << LL_ENDL;
}
}
@@ -664,223 +664,223 @@ void LLMediaDataClient::Handler::onFailure(LLCore::HttpResponse * response, LLCo
void LLObjectMediaDataClient::fetchMedia(LLMediaDataClientObject *object)
{
- // Create a get request and put it in the queue.
- enqueue(Request::ptr_t(new RequestGet(object, this)));
+ // Create a get request and put it in the queue.
+ enqueue(Request::ptr_t(new RequestGet(object, this)));
}
-const char *LLObjectMediaDataClient::getCapabilityName() const
+const char *LLObjectMediaDataClient::getCapabilityName() const
{
- return "ObjectMedia";
+ return "ObjectMedia";
}
LLObjectMediaDataClient::request_queue_t *LLObjectMediaDataClient::getQueue()
{
- return (mCurrentQueueIsTheSortedQueue) ? &mQueue : &mRoundRobinQueue;
+ return (mCurrentQueueIsTheSortedQueue) ? &mQueue : &mRoundRobinQueue;
}
void LLObjectMediaDataClient::sortQueue()
{
- if(!mQueue.empty())
- {
- // score all elements in the sorted queue.
- for(request_queue_t::iterator iter = mQueue.begin(); iter != mQueue.end(); iter++)
- {
- (*iter)->updateScore();
- }
-
- // Re-sort the list...
- mQueue.sort(compareRequestScores);
-
- // ...then cull items over the max
- U32 size = mQueue.size();
- if (size > mMaxSortedQueueSize)
- {
- U32 num_to_cull = (size - mMaxSortedQueueSize);
- LL_INFOS_ONCE("LLMediaDataClient") << "sorted queue MAXED OUT! Culling "
- << num_to_cull << " items" << LL_ENDL;
- while (num_to_cull-- > 0)
- {
- mQueue.back()->markDead();
- mQueue.pop_back();
- }
- }
- }
-
+ if(!mQueue.empty())
+ {
+ // score all elements in the sorted queue.
+ for(request_queue_t::iterator iter = mQueue.begin(); iter != mQueue.end(); iter++)
+ {
+ (*iter)->updateScore();
+ }
+
+ // Re-sort the list...
+ mQueue.sort(compareRequestScores);
+
+ // ...then cull items over the max
+ U32 size = mQueue.size();
+ if (size > mMaxSortedQueueSize)
+ {
+ U32 num_to_cull = (size - mMaxSortedQueueSize);
+ LL_INFOS_ONCE("LLMediaDataClient") << "sorted queue MAXED OUT! Culling "
+ << num_to_cull << " items" << LL_ENDL;
+ while (num_to_cull-- > 0)
+ {
+ mQueue.back()->markDead();
+ mQueue.pop_back();
+ }
+ }
+ }
+
}
// static
bool LLObjectMediaDataClient::compareRequestScores(const Request::ptr_t &o1, const Request::ptr_t &o2)
{
- if (!o2) return true;
- if (!o1) return false;
- return ( o1->getScore() > o2->getScore() );
+ if (!o2) return true;
+ if (!o1) return false;
+ return ( o1->getScore() > o2->getScore() );
}
void LLObjectMediaDataClient::enqueue(Request::ptr_t request)
{
- static LLCachedControl<bool> audio_streaming_enabled(gSavedSettings, "AudioStreamingMedia", true);
- if (!audio_streaming_enabled)
- {
- LL_DEBUGS("LLMediaDataClient") << "not queueing request when Media is disabled " << *request << LL_ENDL;
- return;
- }
-
- if(request->isDead())
- {
- LL_DEBUGS("LLMediaDataClient") << "not queueing dead request " << *request << LL_ENDL;
- return;
- }
-
- // Invariants:
- // new requests always go into the sorted queue.
- //
-
- bool is_new = request->isNew();
-
- if(!is_new && (request->getType() == Request::GET))
- {
- // For GET requests that are not new, if a matching request is already in the round robin queue,
- // in flight, or being retried, leave it at its current position.
+ static LLCachedControl<bool> audio_streaming_enabled(gSavedSettings, "AudioStreamingMedia", true);
+ if (!audio_streaming_enabled)
+ {
+ LL_DEBUGS("LLMediaDataClient") << "not queueing request when Media is disabled " << *request << LL_ENDL;
+ return;
+ }
+
+ if(request->isDead())
+ {
+ LL_DEBUGS("LLMediaDataClient") << "not queueing dead request " << *request << LL_ENDL;
+ return;
+ }
+
+ // Invariants:
+ // new requests always go into the sorted queue.
+ //
+
+ bool is_new = request->isNew();
+
+ if(!is_new && (request->getType() == Request::GET))
+ {
+ // For GET requests that are not new, if a matching request is already in the round robin queue,
+ // in flight, or being retried, leave it at its current position.
PredicateMatchRequest upred(request->getID(), Request::GET);
request_queue_t::iterator iter = std::find_if(mRoundRobinQueue.begin(), mRoundRobinQueue.end(), upred);
request_set_t::iterator iter2 = std::find_if(mUnQueuedRequests.begin(), mUnQueuedRequests.end(), upred);
- if( (iter != mRoundRobinQueue.end()) || (iter2 != mUnQueuedRequests.end()) )
- {
- LL_DEBUGS("LLMediaDataClient") << "ALREADY THERE: NOT Queuing request for " << *request << LL_ENDL;
-
- return;
- }
- }
-
- // TODO: should an UPDATE cause pending GET requests for the same object to be removed from the queue?
- // IF the update will cause an object update message to be sent out at some point in the future, it probably should.
-
- // Remove any existing requests of this type for this object
+ if( (iter != mRoundRobinQueue.end()) || (iter2 != mUnQueuedRequests.end()) )
+ {
+ LL_DEBUGS("LLMediaDataClient") << "ALREADY THERE: NOT Queuing request for " << *request << LL_ENDL;
+
+ return;
+ }
+ }
+
+ // TODO: should an UPDATE cause pending GET requests for the same object to be removed from the queue?
+ // IF the update will cause an object update message to be sent out at some point in the future, it probably should.
+
+ // Remove any existing requests of this type for this object
PredicateMatchRequest upred(request->getID(), request->getType());
mark_dead_and_remove_if(mQueue, upred);
mark_dead_and_remove_if(mRoundRobinQueue, upred);
mark_dead_and_remove_if(mUnQueuedRequests, upred);
- if (is_new)
- {
- LL_DEBUGS("LLMediaDataClient") << "Queuing SORTED request for " << *request << LL_ENDL;
-
- mQueue.push_back(request);
-
- LL_DEBUGS("LLMediaDataClientQueue") << "SORTED queue:" << mQueue << LL_ENDL;
- }
- else
- {
- if (mRoundRobinQueue.size() > mMaxRoundRobinQueueSize)
- {
- LL_INFOS_ONCE("LLMediaDataClient") << "RR QUEUE MAXED OUT!!!" << LL_ENDL;
- LL_DEBUGS("LLMediaDataClient") << "Not queuing " << *request << LL_ENDL;
- return;
- }
-
- LL_DEBUGS("LLMediaDataClient") << "Queuing RR request for " << *request << LL_ENDL;
- // Push the request on the pending queue
- mRoundRobinQueue.push_back(request);
-
- LL_DEBUGS("LLMediaDataClientQueue") << "RR queue:" << mRoundRobinQueue << LL_ENDL;
- }
- // Start the timer if not already running
- startQueueTimer();
-}
-
-bool LLObjectMediaDataClient::canServiceRequest(Request::ptr_t request)
-{
- if(mCurrentQueueIsTheSortedQueue)
- {
- if(!request->getObject()->isInterestingEnough())
- {
- LL_DEBUGS("LLMediaDataClient") << "Not fetching " << *request << ": not interesting enough" << LL_ENDL;
- return false;
- }
- }
-
- return true;
+ if (is_new)
+ {
+ LL_DEBUGS("LLMediaDataClient") << "Queuing SORTED request for " << *request << LL_ENDL;
+
+ mQueue.push_back(request);
+
+ LL_DEBUGS("LLMediaDataClientQueue") << "SORTED queue:" << mQueue << LL_ENDL;
+ }
+ else
+ {
+ if (mRoundRobinQueue.size() > mMaxRoundRobinQueueSize)
+ {
+ LL_INFOS_ONCE("LLMediaDataClient") << "RR QUEUE MAXED OUT!!!" << LL_ENDL;
+ LL_DEBUGS("LLMediaDataClient") << "Not queuing " << *request << LL_ENDL;
+ return;
+ }
+
+ LL_DEBUGS("LLMediaDataClient") << "Queuing RR request for " << *request << LL_ENDL;
+ // Push the request on the pending queue
+ mRoundRobinQueue.push_back(request);
+
+ LL_DEBUGS("LLMediaDataClientQueue") << "RR queue:" << mRoundRobinQueue << LL_ENDL;
+ }
+ // Start the timer if not already running
+ startQueueTimer();
+}
+
+bool LLObjectMediaDataClient::canServiceRequest(Request::ptr_t request)
+{
+ if(mCurrentQueueIsTheSortedQueue)
+ {
+ if(!request->getObject()->isInterestingEnough())
+ {
+ LL_DEBUGS("LLMediaDataClient") << "Not fetching " << *request << ": not interesting enough" << LL_ENDL;
+ return false;
+ }
+ }
+
+ return true;
};
void LLObjectMediaDataClient::swapCurrentQueue()
{
- // Swap
- mCurrentQueueIsTheSortedQueue = !mCurrentQueueIsTheSortedQueue;
- // If its empty, swap back
- if (getQueue()->empty())
- {
- mCurrentQueueIsTheSortedQueue = !mCurrentQueueIsTheSortedQueue;
- }
+ // Swap
+ mCurrentQueueIsTheSortedQueue = !mCurrentQueueIsTheSortedQueue;
+ // If its empty, swap back
+ if (getQueue()->empty())
+ {
+ mCurrentQueueIsTheSortedQueue = !mCurrentQueueIsTheSortedQueue;
+ }
}
bool LLObjectMediaDataClient::isEmpty() const
{
- return mQueue.empty() && mRoundRobinQueue.empty();
+ return mQueue.empty() && mRoundRobinQueue.empty();
}
bool LLObjectMediaDataClient::isInQueue(const LLMediaDataClientObject::ptr_t &object)
{
- // First, call parent impl.
- if(LLMediaDataClient::isInQueue(object))
- return true;
+ // First, call parent impl.
+ if(LLMediaDataClient::isInQueue(object))
+ return true;
if (std::find_if(mRoundRobinQueue.begin(), mRoundRobinQueue.end(), PredicateMatchRequest(object->getID())) != mRoundRobinQueue.end())
return true;
- return false;
+ return false;
}
void LLObjectMediaDataClient::removeFromQueue(const LLMediaDataClientObject::ptr_t &object)
{
- // First, call parent impl.
- LLMediaDataClient::removeFromQueue(object);
-
+ // First, call parent impl.
+ LLMediaDataClient::removeFromQueue(object);
+
mark_dead_and_remove_if(mRoundRobinQueue, PredicateMatchRequest(object->getID()));
}
bool LLObjectMediaDataClient::processQueueTimer()
{
if (isDoneProcessing())
- return true;
-
- LL_DEBUGS("LLMediaDataClient") << "started, SORTED queue size is: " << mQueue.size()
- << ", RR queue size is: " << mRoundRobinQueue.size() << LL_ENDL;
- LL_DEBUGS("LLMediaDataClientQueue") << " SORTED queue is: " << mQueue << LL_ENDL;
- LL_DEBUGS("LLMediaDataClientQueue") << " RR queue is: " << mRoundRobinQueue << LL_ENDL;
+ return true;
+
+ LL_DEBUGS("LLMediaDataClient") << "started, SORTED queue size is: " << mQueue.size()
+ << ", RR queue size is: " << mRoundRobinQueue.size() << LL_ENDL;
+ LL_DEBUGS("LLMediaDataClientQueue") << " SORTED queue is: " << mQueue << LL_ENDL;
+ LL_DEBUGS("LLMediaDataClientQueue") << " RR queue is: " << mRoundRobinQueue << LL_ENDL;
+
+// purgeDeadRequests();
-// purgeDeadRequests();
+ sortQueue();
- sortQueue();
+ LL_DEBUGS("LLMediaDataClientQueue") << "after sort, SORTED queue is: " << mQueue << LL_ENDL;
- LL_DEBUGS("LLMediaDataClientQueue") << "after sort, SORTED queue is: " << mQueue << LL_ENDL;
-
- serviceQueue();
+ serviceQueue();
serviceHttp();
- swapCurrentQueue();
-
- LL_DEBUGS("LLMediaDataClient") << "finished, SORTED queue size is: " << mQueue.size()
- << ", RR queue size is: " << mRoundRobinQueue.size() << LL_ENDL;
- LL_DEBUGS("LLMediaDataClientQueue") << " SORTED queue is: " << mQueue << LL_ENDL;
- LL_DEBUGS("LLMediaDataClientQueue") << " RR queue is: " << mRoundRobinQueue << LL_ENDL;
-
+ swapCurrentQueue();
+
+ LL_DEBUGS("LLMediaDataClient") << "finished, SORTED queue size is: " << mQueue.size()
+ << ", RR queue size is: " << mRoundRobinQueue.size() << LL_ENDL;
+ LL_DEBUGS("LLMediaDataClientQueue") << " SORTED queue is: " << mQueue << LL_ENDL;
+ LL_DEBUGS("LLMediaDataClientQueue") << " RR queue is: " << mRoundRobinQueue << LL_ENDL;
+
return isDoneProcessing();
}
LLObjectMediaDataClient::RequestGet::RequestGet(LLMediaDataClientObject *obj, LLMediaDataClient *mdc):
- LLMediaDataClient::Request(LLMediaDataClient::Request::GET, obj, mdc)
+ LLMediaDataClient::Request(LLMediaDataClient::Request::GET, obj, mdc)
{
}
LLSD LLObjectMediaDataClient::RequestGet::getPayload() const
{
- LLSD result;
- result["verb"] = "GET";
- result[LLTextureEntry::OBJECT_ID_KEY] = mObject->getID();
-
- return result;
+ LLSD result;
+ result["verb"] = "GET";
+ result[LLTextureEntry::OBJECT_ID_KEY] = mObject->getID();
+
+ return result;
}
LLCore::HttpHandler::ptr_t LLObjectMediaDataClient::RequestGet::createHandler()
@@ -891,37 +891,37 @@ LLCore::HttpHandler::ptr_t LLObjectMediaDataClient::RequestGet::createHandler()
void LLObjectMediaDataClient::updateMedia(LLMediaDataClientObject *object)
{
- // Create an update request and put it in the queue.
- enqueue(Request::ptr_t(new RequestUpdate(object, this)));
+ // Create an update request and put it in the queue.
+ enqueue(Request::ptr_t(new RequestUpdate(object, this)));
}
LLObjectMediaDataClient::RequestUpdate::RequestUpdate(LLMediaDataClientObject *obj, LLMediaDataClient *mdc):
- LLMediaDataClient::Request(LLMediaDataClient::Request::UPDATE, obj, mdc)
+ LLMediaDataClient::Request(LLMediaDataClient::Request::UPDATE, obj, mdc)
{
}
LLSD LLObjectMediaDataClient::RequestUpdate::getPayload() const
{
- LLSD result;
- result["verb"] = "UPDATE";
- result[LLTextureEntry::OBJECT_ID_KEY] = mObject->getID();
+ LLSD result;
+ result["verb"] = "UPDATE";
+ result[LLTextureEntry::OBJECT_ID_KEY] = mObject->getID();
+
+ LLSD object_media_data;
+ int i = 0;
+ int end = mObject->getMediaDataCount();
+ for ( ; i < end ; ++i)
+ {
+ object_media_data.append(mObject->getMediaDataLLSD(i));
+ }
+
+ result[LLTextureEntry::OBJECT_MEDIA_DATA_KEY] = object_media_data;
- LLSD object_media_data;
- int i = 0;
- int end = mObject->getMediaDataCount();
- for ( ; i < end ; ++i)
- {
- object_media_data.append(mObject->getMediaDataLLSD(i));
- }
-
- result[LLTextureEntry::OBJECT_MEDIA_DATA_KEY] = object_media_data;
-
- return result;
+ return result;
}
LLCore::HttpHandler::ptr_t LLObjectMediaDataClient::RequestUpdate::createHandler()
{
- // This just uses the base class's responder.
+ // This just uses the base class's responder.
return LLCore::HttpHandler::ptr_t(new LLMediaDataClient::Handler(shared_from_this()));
}
@@ -947,16 +947,16 @@ void LLObjectMediaDataClient::Handler::onSuccess(LLCore::HttpResponse * response
if (content.has("error"))
{
const LLSD &error = content["error"];
- LL_WARNS("LLMediaDataClient") << *(getRequest()) << " Error getting media data for object: code=" <<
+ LL_WARNS("LLMediaDataClient") << *(getRequest()) << " Error getting media data for object: code=" <<
error["code"].asString() << ": " << error["message"].asString() << LL_ENDL;
// XXX Warn user?
}
- else
+ else
{
// Check the data
const LLUUID &object_id = content[LLTextureEntry::OBJECT_ID_KEY];
- if (object_id != getRequest()->getObject()->getID())
+ if (object_id != getRequest()->getObject()->getID())
{
// NOT good, wrong object id!!
LL_WARNS("LLMediaDataClient") << *(getRequest()) << " DROPPING response with wrong object id (" << object_id << ")" << LL_ENDL;
@@ -978,87 +978,87 @@ void LLObjectMediaDataClient::Handler::onSuccess(LLCore::HttpResponse * response
//
//////////////////////////////////////////////////////////////////////////////////////
-const char *LLObjectMediaNavigateClient::getCapabilityName() const
+const char *LLObjectMediaNavigateClient::getCapabilityName() const
{
- return "ObjectMediaNavigate";
+ return "ObjectMediaNavigate";
}
void LLObjectMediaNavigateClient::enqueue(Request::ptr_t request)
{
- static LLCachedControl<bool> audio_streaming_enabled(gSavedSettings, "AudioStreamingMedia", true);
- if (!audio_streaming_enabled)
- {
- LL_DEBUGS("LLMediaDataClient") << "not queueing request when Media is disabled " << *request << LL_ENDL;
- return;
- }
-
- if(request->isDead())
- {
- LL_DEBUGS("LLMediaDataClient") << "not queuing dead request " << *request << LL_ENDL;
- return;
- }
-
+ static LLCachedControl<bool> audio_streaming_enabled(gSavedSettings, "AudioStreamingMedia", true);
+ if (!audio_streaming_enabled)
+ {
+ LL_DEBUGS("LLMediaDataClient") << "not queueing request when Media is disabled " << *request << LL_ENDL;
+ return;
+ }
+
+ if(request->isDead())
+ {
+ LL_DEBUGS("LLMediaDataClient") << "not queuing dead request " << *request << LL_ENDL;
+ return;
+ }
+
PredicateMatchRequest upred(request);
- // If there's already a matching request in the queue, remove it.
+ // If there's already a matching request in the queue, remove it.
request_queue_t::iterator iter = std::find_if(mQueue.begin(), mQueue.end(), upred);
- if(iter != mQueue.end())
- {
- LL_DEBUGS("LLMediaDataClient") << "removing matching queued request " << (**iter) << LL_ENDL;
- mQueue.erase(iter);
- }
- else
- {
+ if(iter != mQueue.end())
+ {
+ LL_DEBUGS("LLMediaDataClient") << "removing matching queued request " << (**iter) << LL_ENDL;
+ mQueue.erase(iter);
+ }
+ else
+ {
request_set_t::iterator set_iter = std::find_if(mUnQueuedRequests.begin(), mUnQueuedRequests.end(), upred);
- if(set_iter != mUnQueuedRequests.end())
- {
- LL_DEBUGS("LLMediaDataClient") << "removing matching unqueued request " << (**set_iter) << LL_ENDL;
- mUnQueuedRequests.erase(set_iter);
- }
- }
+ if(set_iter != mUnQueuedRequests.end())
+ {
+ LL_DEBUGS("LLMediaDataClient") << "removing matching unqueued request " << (**set_iter) << LL_ENDL;
+ mUnQueuedRequests.erase(set_iter);
+ }
+ }
#if 0
- // Sadly, this doesn't work. It ends up creating a race condition when the user navigates and then hits the "back" button
- // where the navigate-back appears to be spurious and doesn't get broadcast.
- if(request->getObject()->isCurrentMediaUrl(request->getFace(), request->getURL()))
- {
- // This navigate request is trying to send the face to the current URL. Drop it.
- LL_DEBUGS("LLMediaDataClient") << "dropping spurious request " << (*request) << LL_ENDL;
- }
- else
+ // Sadly, this doesn't work. It ends up creating a race condition when the user navigates and then hits the "back" button
+ // where the navigate-back appears to be spurious and doesn't get broadcast.
+ if(request->getObject()->isCurrentMediaUrl(request->getFace(), request->getURL()))
+ {
+ // This navigate request is trying to send the face to the current URL. Drop it.
+ LL_DEBUGS("LLMediaDataClient") << "dropping spurious request " << (*request) << LL_ENDL;
+ }
+ else
#endif
- {
- LL_DEBUGS("LLMediaDataClient") << "queuing new request " << (*request) << LL_ENDL;
- mQueue.push_back(request);
-
- // Start the timer if not already running
- startQueueTimer();
- }
+ {
+ LL_DEBUGS("LLMediaDataClient") << "queuing new request " << (*request) << LL_ENDL;
+ mQueue.push_back(request);
+
+ // Start the timer if not already running
+ startQueueTimer();
+ }
}
void LLObjectMediaNavigateClient::navigate(LLMediaDataClientObject *object, U8 texture_index, const std::string &url)
{
-// LL_INFOS("LLMediaDataClient") << "navigate() initiated: " << ll_print_sd(sd_payload) << LL_ENDL;
-
- // Create a get request and put it in the queue.
- enqueue(Request::ptr_t(new RequestNavigate(object, this, texture_index, url)));
+// LL_INFOS("LLMediaDataClient") << "navigate() initiated: " << ll_print_sd(sd_payload) << LL_ENDL;
+
+ // Create a get request and put it in the queue.
+ enqueue(Request::ptr_t(new RequestNavigate(object, this, texture_index, url)));
}
LLObjectMediaNavigateClient::RequestNavigate::RequestNavigate(LLMediaDataClientObject *obj, LLMediaDataClient *mdc, U8 texture_index, const std::string &url):
- LLMediaDataClient::Request(LLMediaDataClient::Request::NAVIGATE, obj, mdc, (S32)texture_index),
- mURL(url)
+ LLMediaDataClient::Request(LLMediaDataClient::Request::NAVIGATE, obj, mdc, (S32)texture_index),
+ mURL(url)
{
}
LLSD LLObjectMediaNavigateClient::RequestNavigate::getPayload() const
{
- LLSD result;
- result[LLTextureEntry::OBJECT_ID_KEY] = getID();
- result[LLMediaEntry::CURRENT_URL_KEY] = mURL;
- result[LLTextureEntry::TEXTURE_INDEX_KEY] = (LLSD::Integer)getFace();
-
- return result;
+ LLSD result;
+ result[LLTextureEntry::OBJECT_ID_KEY] = getID();
+ result[LLMediaEntry::CURRENT_URL_KEY] = mURL;
+ result[LLTextureEntry::TEXTURE_INDEX_KEY] = (LLSD::Integer)getFace();
+
+ return result;
}
LLCore::HttpHandler::ptr_t LLObjectMediaNavigateClient::RequestNavigate::createHandler()
@@ -1121,7 +1121,7 @@ void LLObjectMediaNavigateClient::Handler::mediaNavigateBounceBack()
{
LL_WARNS("LLMediaDataClient") << *(getRequest()) << " Error navigating or denied." << LL_ENDL;
const LLSD &payload = getRequest()->getPayload();
-
+
// bounce the face back
getRequest()->getObject()->mediaNavigateBounceBack((LLSD::Integer)payload[LLTextureEntry::TEXTURE_INDEX_KEY]);
}
diff --git a/indra/newview/llmediadataclient.h b/indra/newview/llmediadataclient.h
index 8cd4793106..ae5e5cd5d4 100644
--- a/indra/newview/llmediadataclient.h
+++ b/indra/newview/llmediadataclient.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmediadataclient.h
* @brief class for queueing up requests to the media service
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,35 +41,35 @@
class LLMediaDataClientObject : public LLRefCount
{
public:
- // Get the number of media data items
- virtual U8 getMediaDataCount() const = 0;
- // Get the media data at index, as an LLSD
- virtual LLSD getMediaDataLLSD(U8 index) const = 0;
- // Return true if the current URL for the face in the media data matches the specified URL.
- virtual bool isCurrentMediaUrl(U8 index, const std::string &url) const = 0;
- // Get this object's UUID
- virtual LLUUID getID() const = 0;
- // Navigate back to previous URL
- virtual void mediaNavigateBounceBack(U8 index) = 0;
- // Does this object have media?
- virtual bool hasMedia() const = 0;
- // Update the object's media data to the given array
- virtual void updateObjectMediaData(LLSD const &media_data_array, const std::string &version_string) = 0;
- // Return the total "interest" of the media (on-screen area)
- virtual F64 getMediaInterest() const = 0;
- // Return the given cap url
- virtual std::string getCapabilityUrl(const std::string &name) const = 0;
- // Return whether the object has been marked dead
- virtual bool isDead() const = 0;
- // Returns a media version number for the object
- virtual U32 getMediaVersion() const = 0;
- // Returns whether the object is "interesting enough" to fetch
- virtual bool isInterestingEnough() const = 0;
- // Returns whether we've seen this object yet or not
- virtual bool isNew() const = 0;
-
- // smart pointer
- typedef LLPointer<LLMediaDataClientObject> ptr_t;
+ // Get the number of media data items
+ virtual U8 getMediaDataCount() const = 0;
+ // Get the media data at index, as an LLSD
+ virtual LLSD getMediaDataLLSD(U8 index) const = 0;
+ // Return true if the current URL for the face in the media data matches the specified URL.
+ virtual bool isCurrentMediaUrl(U8 index, const std::string &url) const = 0;
+ // Get this object's UUID
+ virtual LLUUID getID() const = 0;
+ // Navigate back to previous URL
+ virtual void mediaNavigateBounceBack(U8 index) = 0;
+ // Does this object have media?
+ virtual bool hasMedia() const = 0;
+ // Update the object's media data to the given array
+ virtual void updateObjectMediaData(LLSD const &media_data_array, const std::string &version_string) = 0;
+ // Return the total "interest" of the media (on-screen area)
+ virtual F64 getMediaInterest() const = 0;
+ // Return the given cap url
+ virtual std::string getCapabilityUrl(const std::string &name) const = 0;
+ // Return whether the object has been marked dead
+ virtual bool isDead() const = 0;
+ // Returns a media version number for the object
+ virtual U32 getMediaVersion() const = 0;
+ // Returns whether the object is "interesting enough" to fetch
+ virtual bool isInterestingEnough() const = 0;
+ // Returns whether we've seen this object yet or not
+ virtual bool isNew() const = 0;
+
+ // smart pointer
+ typedef LLPointer<LLMediaDataClientObject> ptr_t;
};
@@ -82,40 +82,40 @@ class LLMediaDataClient : public LLRefCount
protected:
LOG_CLASS(LLMediaDataClient);
public:
-
+
const static F32 QUEUE_TIMER_DELAY;// = 1.0; // seconds(s)
- const static F32 UNAVAILABLE_RETRY_TIMER_DELAY;// = 5.0; // secs
- const static U32 MAX_RETRIES;// = 4;
- const static U32 MAX_SORTED_QUEUE_SIZE;// = 10000;
- const static U32 MAX_ROUND_ROBIN_QUEUE_SIZE;// = 10000;
-
- // Constructor
- LLMediaDataClient(F32 queue_timer_delay = QUEUE_TIMER_DELAY,
- F32 retry_timer_delay = UNAVAILABLE_RETRY_TIMER_DELAY,
- U32 max_retries = MAX_RETRIES,
- U32 max_sorted_queue_size = MAX_SORTED_QUEUE_SIZE,
- U32 max_round_robin_queue_size = MAX_ROUND_ROBIN_QUEUE_SIZE);
-
- F32 getRetryTimerDelay() const { return mRetryTimerDelay; }
-
- // Returns true iff the queue is empty
- virtual bool isEmpty() const;
-
- // Returns true iff the given object is in the queue
- virtual bool isInQueue(const LLMediaDataClientObject::ptr_t &object);
-
- // Remove the given object from the queue. Returns true iff the given object is removed.
- virtual void removeFromQueue(const LLMediaDataClientObject::ptr_t &object);
-
- // Called only by the Queue timer and tests (potentially)
- virtual bool processQueueTimer();
-
+ const static F32 UNAVAILABLE_RETRY_TIMER_DELAY;// = 5.0; // secs
+ const static U32 MAX_RETRIES;// = 4;
+ const static U32 MAX_SORTED_QUEUE_SIZE;// = 10000;
+ const static U32 MAX_ROUND_ROBIN_QUEUE_SIZE;// = 10000;
+
+ // Constructor
+ LLMediaDataClient(F32 queue_timer_delay = QUEUE_TIMER_DELAY,
+ F32 retry_timer_delay = UNAVAILABLE_RETRY_TIMER_DELAY,
+ U32 max_retries = MAX_RETRIES,
+ U32 max_sorted_queue_size = MAX_SORTED_QUEUE_SIZE,
+ U32 max_round_robin_queue_size = MAX_ROUND_ROBIN_QUEUE_SIZE);
+
+ F32 getRetryTimerDelay() const { return mRetryTimerDelay; }
+
+ // Returns true iff the queue is empty
+ virtual bool isEmpty() const;
+
+ // Returns true iff the given object is in the queue
+ virtual bool isInQueue(const LLMediaDataClientObject::ptr_t &object);
+
+ // Remove the given object from the queue. Returns true iff the given object is removed.
+ virtual void removeFromQueue(const LLMediaDataClientObject::ptr_t &object);
+
+ // Called only by the Queue timer and tests (potentially)
+ virtual bool processQueueTimer();
+
protected:
- // Destructor
- virtual ~LLMediaDataClient(); // use unref
-
- // Request (pure virtual base class for requests in the queue)
- class Request:
+ // Destructor
+ virtual ~LLMediaDataClient(); // use unref
+
+ // Request (pure virtual base class for requests in the queue)
+ class Request:
public std::enable_shared_from_this<Request>
{
public:
@@ -138,66 +138,66 @@ protected:
virtual ~Request()
{ }
- protected:
- // The only way to create one of these is through a subclass.
- Request(Type in_type, LLMediaDataClientObject *obj, LLMediaDataClient *mdc, S32 face = -1);
- public:
- LLMediaDataClientObject *getObject() const { return mObject; }
+ protected:
+ // The only way to create one of these is through a subclass.
+ Request(Type in_type, LLMediaDataClientObject *obj, LLMediaDataClient *mdc, S32 face = -1);
+ public:
+ LLMediaDataClientObject *getObject() const { return mObject; }
U32 getNum() const { return mNum; }
- U32 getRetryCount() const { return mRetryCount; }
- void incRetryCount() { mRetryCount++; }
+ U32 getRetryCount() const { return mRetryCount; }
+ void incRetryCount() { mRetryCount++; }
Type getType() const { return mType; }
- F64 getScore() const { return mScore; }
-
- // Note: may return empty string!
- std::string getCapability() const;
- const char *getCapName() const;
- const char *getTypeAsString() const;
-
- // Re-enqueue thyself
- void reEnqueue();
-
- F32 getRetryTimerDelay() const;
- U32 getMaxNumRetries() const;
-
- bool isObjectValid() const { return mObject.notNull() && (!mObject->isDead()); }
- bool isNew() const { return isObjectValid() && mObject->isNew(); }
- void updateScore();
-
- void markDead();
- bool isDead();
- void startTracking();
- void stopTracking();
-
- friend std::ostream& operator<<(std::ostream &s, const Request &q);
-
- const LLUUID &getID() const { return mObjectID; }
- S32 getFace() const { return mFace; }
-
- bool isMatch (const Request::ptr_t &other, Type match_type = ANY) const
- {
- return ((match_type == ANY) || (mType == other->mType)) &&
- (mFace == other->mFace) &&
- (mObjectID == other->mObjectID);
- }
- protected:
- LLMediaDataClientObject::ptr_t mObject;
- private:
- Type mType;
- // Simple tracking
- U32 mNum;
- static U32 sNum;
+ F64 getScore() const { return mScore; }
+
+ // Note: may return empty string!
+ std::string getCapability() const;
+ const char *getCapName() const;
+ const char *getTypeAsString() const;
+
+ // Re-enqueue thyself
+ void reEnqueue();
+
+ F32 getRetryTimerDelay() const;
+ U32 getMaxNumRetries() const;
+
+ bool isObjectValid() const { return mObject.notNull() && (!mObject->isDead()); }
+ bool isNew() const { return isObjectValid() && mObject->isNew(); }
+ void updateScore();
+
+ void markDead();
+ bool isDead();
+ void startTracking();
+ void stopTracking();
+
+ friend std::ostream& operator<<(std::ostream &s, const Request &q);
+
+ const LLUUID &getID() const { return mObjectID; }
+ S32 getFace() const { return mFace; }
+
+ bool isMatch (const Request::ptr_t &other, Type match_type = ANY) const
+ {
+ return ((match_type == ANY) || (mType == other->mType)) &&
+ (mFace == other->mFace) &&
+ (mObjectID == other->mObjectID);
+ }
+ protected:
+ LLMediaDataClientObject::ptr_t mObject;
+ private:
+ Type mType;
+ // Simple tracking
+ U32 mNum;
+ static U32 sNum;
U32 mRetryCount;
- F64 mScore;
-
- LLUUID mObjectID;
- S32 mFace;
+ F64 mScore;
+
+ LLUUID mObjectID;
+ S32 mFace;
- // Back pointer to the MDC...not a ref!
- LLMediaDataClient *mMDC;
- };
- //typedef LLPointer<Request> request_ptr_t;
+ // Back pointer to the MDC...not a ref!
+ LLMediaDataClient *mMDC;
+ };
+ //typedef LLPointer<Request> request_ptr_t;
class Handler : public LLHttpSDHandler
{
@@ -215,60 +215,60 @@ protected:
};
- class RetryTimer : public LLEventTimer
- {
- public:
- RetryTimer(F32 time, Request::ptr_t);
- virtual BOOL tick();
- private:
- // back-pointer
- Request::ptr_t mRequest;
- };
-
-
+ class RetryTimer : public LLEventTimer
+ {
+ public:
+ RetryTimer(F32 time, Request::ptr_t);
+ virtual BOOL tick();
+ private:
+ // back-pointer
+ Request::ptr_t mRequest;
+ };
+
+
protected:
- typedef std::list<Request::ptr_t> request_queue_t;
- typedef std::set<Request::ptr_t> request_set_t;
+ typedef std::list<Request::ptr_t> request_queue_t;
+ typedef std::set<Request::ptr_t> request_set_t;
- // Subclasses must override to return a cap name
- virtual const char *getCapabilityName() const = 0;
+ // Subclasses must override to return a cap name
+ virtual const char *getCapabilityName() const = 0;
- // Puts the request into a queue, appropriately handling duplicates, etc.
+ // Puts the request into a queue, appropriately handling duplicates, etc.
virtual void enqueue(Request::ptr_t) = 0;
-
- virtual void serviceQueue();
+
+ virtual void serviceQueue();
virtual void serviceHttp();
- virtual request_queue_t *getQueue() { return &mQueue; };
+ virtual request_queue_t *getQueue() { return &mQueue; };
+
+ // Gets the next request, removing it from the queue
+ virtual Request::ptr_t dequeue();
- // Gets the next request, removing it from the queue
- virtual Request::ptr_t dequeue();
-
- virtual bool canServiceRequest(Request::ptr_t request) { return true; };
+ virtual bool canServiceRequest(Request::ptr_t request) { return true; };
- // Returns a request to the head of the queue (should only be used for requests that came from dequeue
- virtual void pushBack(Request::ptr_t request);
-
- void trackRequest(Request::ptr_t request);
- void stopTrackingRequest(Request::ptr_t request);
+ // Returns a request to the head of the queue (should only be used for requests that came from dequeue
+ virtual void pushBack(Request::ptr_t request);
+
+ void trackRequest(Request::ptr_t request);
+ void stopTrackingRequest(Request::ptr_t request);
bool isDoneProcessing() const;
-
- request_queue_t mQueue;
-
- const F32 mQueueTimerDelay;
- const F32 mRetryTimerDelay;
- const U32 mMaxNumRetries;
- const U32 mMaxSortedQueueSize;
- const U32 mMaxRoundRobinQueueSize;
-
- // Set for keeping track of requests that aren't in either queue. This includes:
- // Requests that have been sent and are awaiting a response (pointer held by the Responder)
- // Requests that are waiting for their retry timers to fire (pointer held by the retry timer)
- request_set_t mUnQueuedRequests;
-
- void startQueueTimer();
- void stopQueueTimer();
+
+ request_queue_t mQueue;
+
+ const F32 mQueueTimerDelay;
+ const F32 mRetryTimerDelay;
+ const U32 mMaxNumRetries;
+ const U32 mMaxSortedQueueSize;
+ const U32 mMaxRoundRobinQueueSize;
+
+ // Set for keeping track of requests that aren't in either queue. This includes:
+ // Requests that have been sent and are awaiting a response (pointer held by the Responder)
+ // Requests that are waiting for their retry timers to fire (pointer held by the retry timer)
+ request_set_t mUnQueuedRequests;
+
+ void startQueueTimer();
+ void stopQueueTimer();
LLCore::HttpRequest::ptr_t mHttpRequest;
LLCore::HttpHeaders::ptr_t mHttpHeaders;
@@ -276,29 +276,29 @@ protected:
LLCore::HttpRequest::policy_t mHttpPolicy;
private:
-
- static F64 getObjectScore(const LLMediaDataClientObject::ptr_t &obj);
-
- friend std::ostream& operator<<(std::ostream &s, const Request &q);
- friend std::ostream& operator<<(std::ostream &s, const request_queue_t &q);
-
- class QueueTimer : public LLEventTimer
- {
- public:
- QueueTimer(F32 time, LLMediaDataClient *mdc);
- virtual BOOL tick();
- private:
- // back-pointer
- LLPointer<LLMediaDataClient> mMDC;
- };
-
- void setIsRunning(bool val) { mQueueTimerIsRunning = val; }
-
- bool mQueueTimerIsRunning;
-
-// template <typename T> friend typename T::iterator find_matching_request(T &c, const LLMediaDataClient::Request *request, LLMediaDataClient::Request::Type match_type);
-// template <typename T> friend typename T::iterator find_matching_request(T &c, const LLUUID &id, LLMediaDataClient::Request::Type match_type);
-// template <typename T> friend void remove_matching_requests(T &c, const LLUUID &id, LLMediaDataClient::Request::Type match_type);
+
+ static F64 getObjectScore(const LLMediaDataClientObject::ptr_t &obj);
+
+ friend std::ostream& operator<<(std::ostream &s, const Request &q);
+ friend std::ostream& operator<<(std::ostream &s, const request_queue_t &q);
+
+ class QueueTimer : public LLEventTimer
+ {
+ public:
+ QueueTimer(F32 time, LLMediaDataClient *mdc);
+ virtual BOOL tick();
+ private:
+ // back-pointer
+ LLPointer<LLMediaDataClient> mMDC;
+ };
+
+ void setIsRunning(bool val) { mQueueTimerIsRunning = val; }
+
+ bool mQueueTimerIsRunning;
+
+// template <typename T> friend typename T::iterator find_matching_request(T &c, const LLMediaDataClient::Request *request, LLMediaDataClient::Request::Type match_type);
+// template <typename T> friend typename T::iterator find_matching_request(T &c, const LLUUID &id, LLMediaDataClient::Request::Type match_type);
+// template <typename T> friend void remove_matching_requests(T &c, const LLUUID &id, LLMediaDataClient::Request::Type match_type);
};
// MediaDataClient specific for the ObjectMedia cap
@@ -308,55 +308,55 @@ protected:
LOG_CLASS(LLObjectMediaDataClient);
public:
LLObjectMediaDataClient(F32 queue_timer_delay = QUEUE_TIMER_DELAY,
- F32 retry_timer_delay = UNAVAILABLE_RETRY_TIMER_DELAY,
- U32 max_retries = MAX_RETRIES,
- U32 max_sorted_queue_size = MAX_SORTED_QUEUE_SIZE,
- U32 max_round_robin_queue_size = MAX_ROUND_ROBIN_QUEUE_SIZE)
- : LLMediaDataClient(queue_timer_delay, retry_timer_delay, max_retries),
- mCurrentQueueIsTheSortedQueue(true)
- {}
-
- void fetchMedia(LLMediaDataClientObject *object);
+ F32 retry_timer_delay = UNAVAILABLE_RETRY_TIMER_DELAY,
+ U32 max_retries = MAX_RETRIES,
+ U32 max_sorted_queue_size = MAX_SORTED_QUEUE_SIZE,
+ U32 max_round_robin_queue_size = MAX_ROUND_ROBIN_QUEUE_SIZE)
+ : LLMediaDataClient(queue_timer_delay, retry_timer_delay, max_retries),
+ mCurrentQueueIsTheSortedQueue(true)
+ {}
+
+ void fetchMedia(LLMediaDataClientObject *object);
void updateMedia(LLMediaDataClientObject *object);
- class RequestGet: public Request
- {
- public:
- RequestGet(LLMediaDataClientObject *obj, LLMediaDataClient *mdc);
- /*virtual*/ LLSD getPayload() const;
+ class RequestGet: public Request
+ {
+ public:
+ RequestGet(LLMediaDataClientObject *obj, LLMediaDataClient *mdc);
+ /*virtual*/ LLSD getPayload() const;
/*virtual*/ LLCore::HttpHandler::ptr_t createHandler();
- };
+ };
- class RequestUpdate: public Request
- {
- public:
- RequestUpdate(LLMediaDataClientObject *obj, LLMediaDataClient *mdc);
- /*virtual*/ LLSD getPayload() const;
+ class RequestUpdate: public Request
+ {
+ public:
+ RequestUpdate(LLMediaDataClientObject *obj, LLMediaDataClient *mdc);
+ /*virtual*/ LLSD getPayload() const;
/*virtual*/ LLCore::HttpHandler::ptr_t createHandler();
- };
+ };
+
+ // Returns true iff the queue is empty
+ virtual bool isEmpty() const;
- // Returns true iff the queue is empty
- virtual bool isEmpty() const;
-
- // Returns true iff the given object is in the queue
- virtual bool isInQueue(const LLMediaDataClientObject::ptr_t &object);
-
- // Remove the given object from the queue. Returns true iff the given object is removed.
- virtual void removeFromQueue(const LLMediaDataClientObject::ptr_t &object);
+ // Returns true iff the given object is in the queue
+ virtual bool isInQueue(const LLMediaDataClientObject::ptr_t &object);
- virtual bool processQueueTimer();
+ // Remove the given object from the queue. Returns true iff the given object is removed.
+ virtual void removeFromQueue(const LLMediaDataClientObject::ptr_t &object);
- virtual bool canServiceRequest(Request::ptr_t request);
+ virtual bool processQueueTimer();
+
+ virtual bool canServiceRequest(Request::ptr_t request);
protected:
- // Subclasses must override to return a cap name
- virtual const char *getCapabilityName() const;
-
- virtual request_queue_t *getQueue();
-
- // Puts the request into the appropriate queue
- virtual void enqueue(Request::ptr_t);
-
+ // Subclasses must override to return a cap name
+ virtual const char *getCapabilityName() const;
+
+ virtual request_queue_t *getQueue();
+
+ // Puts the request into the appropriate queue
+ virtual void enqueue(Request::ptr_t);
+
class Handler: public LLMediaDataClient::Handler
{
LOG_CLASS(Handler);
@@ -370,15 +370,15 @@ protected:
};
private:
- // The Get/Update data client needs a second queue to avoid object updates starving load-ins.
- void swapCurrentQueue();
-
- request_queue_t mRoundRobinQueue;
- bool mCurrentQueueIsTheSortedQueue;
-
- // Comparator for sorting
- static bool compareRequestScores(const Request::ptr_t &o1, const Request::ptr_t &o2);
- void sortQueue();
+ // The Get/Update data client needs a second queue to avoid object updates starving load-ins.
+ void swapCurrentQueue();
+
+ request_queue_t mRoundRobinQueue;
+ bool mCurrentQueueIsTheSortedQueue;
+
+ // Comparator for sorting
+ static bool compareRequestScores(const Request::ptr_t &o1, const Request::ptr_t &o2);
+ void sortQueue();
};
@@ -388,36 +388,36 @@ class LLObjectMediaNavigateClient : public LLMediaDataClient
protected:
LOG_CLASS(LLObjectMediaNavigateClient);
public:
- // NOTE: from llmediaservice.h
- static const int ERROR_PERMISSION_DENIED_CODE = 8002;
-
+ // NOTE: from llmediaservice.h
+ static const int ERROR_PERMISSION_DENIED_CODE = 8002;
+
LLObjectMediaNavigateClient(F32 queue_timer_delay = QUEUE_TIMER_DELAY,
- F32 retry_timer_delay = UNAVAILABLE_RETRY_TIMER_DELAY,
- U32 max_retries = MAX_RETRIES,
- U32 max_sorted_queue_size = MAX_SORTED_QUEUE_SIZE,
- U32 max_round_robin_queue_size = MAX_ROUND_ROBIN_QUEUE_SIZE)
- : LLMediaDataClient(queue_timer_delay, retry_timer_delay, max_retries)
- {}
-
+ F32 retry_timer_delay = UNAVAILABLE_RETRY_TIMER_DELAY,
+ U32 max_retries = MAX_RETRIES,
+ U32 max_sorted_queue_size = MAX_SORTED_QUEUE_SIZE,
+ U32 max_round_robin_queue_size = MAX_ROUND_ROBIN_QUEUE_SIZE)
+ : LLMediaDataClient(queue_timer_delay, retry_timer_delay, max_retries)
+ {}
+
void navigate(LLMediaDataClientObject *object, U8 texture_index, const std::string &url);
- // Puts the request into the appropriate queue
+ // Puts the request into the appropriate queue
virtual void enqueue(Request::ptr_t);
- class RequestNavigate: public Request
- {
- public:
- RequestNavigate(LLMediaDataClientObject *obj, LLMediaDataClient *mdc, U8 texture_index, const std::string &url);
- /*virtual*/ LLSD getPayload() const;
+ class RequestNavigate: public Request
+ {
+ public:
+ RequestNavigate(LLMediaDataClientObject *obj, LLMediaDataClient *mdc, U8 texture_index, const std::string &url);
+ /*virtual*/ LLSD getPayload() const;
/*virtual*/ LLCore::HttpHandler::ptr_t createHandler();
- /*virtual*/ std::string getURL() { return mURL; }
- private:
- std::string mURL;
- };
-
+ /*virtual*/ std::string getURL() { return mURL; }
+ private:
+ std::string mURL;
+ };
+
protected:
- // Subclasses must override to return a cap name
- virtual const char *getCapabilityName() const;
+ // Subclasses must override to return a cap name
+ virtual const char *getCapabilityName() const;
class Handler : public LLMediaDataClient::Handler
{
diff --git a/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp b/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp
index 0663dd41ee..1555db6830 100644
--- a/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp
+++ b/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llmenuoptionpathfindingrebakenavmesh.cpp
* @brief Implementation of llmenuoptionpathfindingrebakenavmesh
* @author Prep@lindenlab.com
@@ -41,203 +41,203 @@
#include "llviewerregion.h"
LLMenuOptionPathfindingRebakeNavmesh::LLMenuOptionPathfindingRebakeNavmesh() :
- mIsInitialized(false),
- mCanRebakeRegion(false),
- mRebakeNavMeshMode(kRebakeNavMesh_Default),
- mNavMeshSlot(),
- mRegionCrossingSlot(),
- mAgentStateSlot()
+ mIsInitialized(false),
+ mCanRebakeRegion(false),
+ mRebakeNavMeshMode(kRebakeNavMesh_Default),
+ mNavMeshSlot(),
+ mRegionCrossingSlot(),
+ mAgentStateSlot()
{
}
-LLMenuOptionPathfindingRebakeNavmesh::~LLMenuOptionPathfindingRebakeNavmesh()
+LLMenuOptionPathfindingRebakeNavmesh::~LLMenuOptionPathfindingRebakeNavmesh()
{
- if (mIsInitialized)
- {
- if (mRebakeNavMeshMode == kRebakeNavMesh_RequestSent)
- {
- LL_WARNS("navmeshRebaking") << "During destruction of the LLMenuOptionPathfindingRebakeNavmesh "
- << "singleton, the mode indicates that a request has been sent for which a response has yet "
- << "to be received. This could contribute to a crash on exit." << LL_ENDL;
- }
-
- quit();
- }
+ if (mIsInitialized)
+ {
+ if (mRebakeNavMeshMode == kRebakeNavMesh_RequestSent)
+ {
+ LL_WARNS("navmeshRebaking") << "During destruction of the LLMenuOptionPathfindingRebakeNavmesh "
+ << "singleton, the mode indicates that a request has been sent for which a response has yet "
+ << "to be received. This could contribute to a crash on exit." << LL_ENDL;
+ }
+
+ quit();
+ }
}
void LLMenuOptionPathfindingRebakeNavmesh::initialize()
{
- if (!mIsInitialized)
- {
- mIsInitialized = true;
+ if (!mIsInitialized)
+ {
+ mIsInitialized = true;
- setMode(kRebakeNavMesh_Default);
+ setMode(kRebakeNavMesh_Default);
- createNavMeshStatusListenerForCurrentRegion();
+ createNavMeshStatusListenerForCurrentRegion();
- if ( !mRegionCrossingSlot.connected() )
- {
- mRegionCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleRegionBoundaryCrossed, this));
- }
+ if ( !mRegionCrossingSlot.connected() )
+ {
+ mRegionCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleRegionBoundaryCrossed, this));
+ }
- if (!mAgentStateSlot.connected())
- {
- mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleAgentState, this, _1));
- }
- LLPathfindingManager::getInstance()->requestGetAgentState();
- }
+ if (!mAgentStateSlot.connected())
+ {
+ mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleAgentState, this, _1));
+ }
+ LLPathfindingManager::getInstance()->requestGetAgentState();
+ }
}
void LLMenuOptionPathfindingRebakeNavmesh::quit()
{
- if (mIsInitialized) // Quitting from the login screen leaves this uninitialized
- {
- if (mNavMeshSlot.connected())
- {
- mNavMeshSlot.disconnect();
- }
-
- if (mRegionCrossingSlot.connected())
- {
- mRegionCrossingSlot.disconnect();
- }
-
- if (mAgentStateSlot.connected())
- {
- mAgentStateSlot.disconnect();
- }
-
- mIsInitialized = false;
- }
+ if (mIsInitialized) // Quitting from the login screen leaves this uninitialized
+ {
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
+
+ if (mRegionCrossingSlot.connected())
+ {
+ mRegionCrossingSlot.disconnect();
+ }
+
+ if (mAgentStateSlot.connected())
+ {
+ mAgentStateSlot.disconnect();
+ }
+
+ mIsInitialized = false;
+ }
}
bool LLMenuOptionPathfindingRebakeNavmesh::canRebakeRegion() const
{
- if (!mIsInitialized)
- {
- LL_ERRS("navmeshRebaking") << "LLMenuOptionPathfindingRebakeNavmesh class has not been initialized "
- << "when the ability to rebake navmesh is being requested." << LL_ENDL;
- }
- return mCanRebakeRegion;
+ if (!mIsInitialized)
+ {
+ LL_ERRS("navmeshRebaking") << "LLMenuOptionPathfindingRebakeNavmesh class has not been initialized "
+ << "when the ability to rebake navmesh is being requested." << LL_ENDL;
+ }
+ return mCanRebakeRegion;
}
LLMenuOptionPathfindingRebakeNavmesh::ERebakeNavMeshMode LLMenuOptionPathfindingRebakeNavmesh::getMode() const
{
- if (!mIsInitialized)
- {
- LL_ERRS("navmeshRebaking") << "LLMenuOptionPathfindingRebakeNavmesh class has not been initialized "
- << "when the mode is being requested." << LL_ENDL;
- }
- return mRebakeNavMeshMode;
+ if (!mIsInitialized)
+ {
+ LL_ERRS("navmeshRebaking") << "LLMenuOptionPathfindingRebakeNavmesh class has not been initialized "
+ << "when the mode is being requested." << LL_ENDL;
+ }
+ return mRebakeNavMeshMode;
}
void LLMenuOptionPathfindingRebakeNavmesh::sendRequestRebakeNavmesh()
{
- if (!mIsInitialized)
- {
- LL_ERRS("navmeshRebaking") << "LLMenuOptionPathfindingRebakeNavmesh class has not been initialized "
- << "when the request is being made to rebake the navmesh." << LL_ENDL;
- }
- else
- {
- if (!canRebakeRegion())
- {
- LL_WARNS("navmeshRebaking") << "attempting to rebake navmesh when user does not have permissions "
- << "on this region" << LL_ENDL;
- }
- if (getMode() != kRebakeNavMesh_Available)
- {
- LL_WARNS("navmeshRebaking") << "attempting to rebake navmesh when mode is not available"
- << LL_ENDL;
- }
-
- setMode(kRebakeNavMesh_RequestSent);
- LLPathfindingManager::getInstance()->requestRebakeNavMesh(boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleRebakeNavMeshResponse, this, _1));
- }
+ if (!mIsInitialized)
+ {
+ LL_ERRS("navmeshRebaking") << "LLMenuOptionPathfindingRebakeNavmesh class has not been initialized "
+ << "when the request is being made to rebake the navmesh." << LL_ENDL;
+ }
+ else
+ {
+ if (!canRebakeRegion())
+ {
+ LL_WARNS("navmeshRebaking") << "attempting to rebake navmesh when user does not have permissions "
+ << "on this region" << LL_ENDL;
+ }
+ if (getMode() != kRebakeNavMesh_Available)
+ {
+ LL_WARNS("navmeshRebaking") << "attempting to rebake navmesh when mode is not available"
+ << LL_ENDL;
+ }
+
+ setMode(kRebakeNavMesh_RequestSent);
+ LLPathfindingManager::getInstance()->requestRebakeNavMesh(boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleRebakeNavMeshResponse, this, _1));
+ }
}
void LLMenuOptionPathfindingRebakeNavmesh::setMode(ERebakeNavMeshMode pRebakeNavMeshMode)
{
- mRebakeNavMeshMode = pRebakeNavMeshMode;
+ mRebakeNavMeshMode = pRebakeNavMeshMode;
}
void LLMenuOptionPathfindingRebakeNavmesh::handleAgentState(BOOL pCanRebakeRegion)
{
- llassert(mIsInitialized);
- mCanRebakeRegion = pCanRebakeRegion;
+ llassert(mIsInitialized);
+ mCanRebakeRegion = pCanRebakeRegion;
}
void LLMenuOptionPathfindingRebakeNavmesh::handleRebakeNavMeshResponse(bool pResponseStatus)
{
- llassert(mIsInitialized);
- if (mIsInitialized)
- {
- if (getMode() == kRebakeNavMesh_RequestSent)
- {
- setMode(pResponseStatus ? kRebakeNavMesh_InProgress : kRebakeNavMesh_Default);
- }
-
- if (!pResponseStatus)
- {
- LLNotificationsUtil::add("PathfindingCannotRebakeNavmesh");
- }
- }
+ llassert(mIsInitialized);
+ if (mIsInitialized)
+ {
+ if (getMode() == kRebakeNavMesh_RequestSent)
+ {
+ setMode(pResponseStatus ? kRebakeNavMesh_InProgress : kRebakeNavMesh_Default);
+ }
+
+ if (!pResponseStatus)
+ {
+ LLNotificationsUtil::add("PathfindingCannotRebakeNavmesh");
+ }
+ }
}
void LLMenuOptionPathfindingRebakeNavmesh::handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
- llassert(mIsInitialized);
- if (mIsInitialized)
- {
- ERebakeNavMeshMode rebakeNavMeshMode = kRebakeNavMesh_Default;
- if (pNavMeshStatus.isValid())
- {
- switch (pNavMeshStatus.getStatus())
- {
- case LLPathfindingNavMeshStatus::kPending :
- case LLPathfindingNavMeshStatus::kRepending :
- rebakeNavMeshMode = kRebakeNavMesh_Available;
- break;
- case LLPathfindingNavMeshStatus::kBuilding :
- rebakeNavMeshMode = kRebakeNavMesh_InProgress;
- break;
- case LLPathfindingNavMeshStatus::kComplete :
- rebakeNavMeshMode = kRebakeNavMesh_NotAvailable;
- break;
- default :
- rebakeNavMeshMode = kRebakeNavMesh_Default;
- llassert(0);
- break;
- }
- }
-
- setMode(rebakeNavMeshMode);
- }
+ llassert(mIsInitialized);
+ if (mIsInitialized)
+ {
+ ERebakeNavMeshMode rebakeNavMeshMode = kRebakeNavMesh_Default;
+ if (pNavMeshStatus.isValid())
+ {
+ switch (pNavMeshStatus.getStatus())
+ {
+ case LLPathfindingNavMeshStatus::kPending :
+ case LLPathfindingNavMeshStatus::kRepending :
+ rebakeNavMeshMode = kRebakeNavMesh_Available;
+ break;
+ case LLPathfindingNavMeshStatus::kBuilding :
+ rebakeNavMeshMode = kRebakeNavMesh_InProgress;
+ break;
+ case LLPathfindingNavMeshStatus::kComplete :
+ rebakeNavMeshMode = kRebakeNavMesh_NotAvailable;
+ break;
+ default :
+ rebakeNavMeshMode = kRebakeNavMesh_Default;
+ llassert(0);
+ break;
+ }
+ }
+
+ setMode(rebakeNavMeshMode);
+ }
}
void LLMenuOptionPathfindingRebakeNavmesh::handleRegionBoundaryCrossed()
{
- llassert(mIsInitialized);
- if (mIsInitialized)
- {
- createNavMeshStatusListenerForCurrentRegion();
- mCanRebakeRegion = FALSE;
- LLPathfindingManager::getInstance()->requestGetAgentState();
- }
+ llassert(mIsInitialized);
+ if (mIsInitialized)
+ {
+ createNavMeshStatusListenerForCurrentRegion();
+ mCanRebakeRegion = FALSE;
+ LLPathfindingManager::getInstance()->requestGetAgentState();
+ }
}
void LLMenuOptionPathfindingRebakeNavmesh::createNavMeshStatusListenerForCurrentRegion()
{
- if (mNavMeshSlot.connected())
- {
- mNavMeshSlot.disconnect();
- }
-
- LLViewerRegion *currentRegion = gAgent.getRegion();
- if (currentRegion != NULL)
- {
- mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleNavMeshStatus, this, _2));
- LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(currentRegion, true);
- }
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
+
+ LLViewerRegion *currentRegion = gAgent.getRegion();
+ if (currentRegion != NULL)
+ {
+ mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleNavMeshStatus, this, _2));
+ LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(currentRegion, true);
+ }
}
diff --git a/indra/newview/llmenuoptionpathfindingrebakenavmesh.h b/indra/newview/llmenuoptionpathfindingrebakenavmesh.h
index 649a387dd3..22eda5b8f8 100644
--- a/indra/newview/llmenuoptionpathfindingrebakenavmesh.h
+++ b/indra/newview/llmenuoptionpathfindingrebakenavmesh.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llmenuoptionpathfindingrebakenavmesh.h
* @brief Header file for llmenuoptionpathfindingrebakenavmesh
* @author Prep@lindenlab.com
@@ -37,49 +37,49 @@ class LLPathfindingNavMeshStatus;
class LLMenuOptionPathfindingRebakeNavmesh : public LLSingleton<LLMenuOptionPathfindingRebakeNavmesh>
{
- LLSINGLETON(LLMenuOptionPathfindingRebakeNavmesh);
- virtual ~LLMenuOptionPathfindingRebakeNavmesh();
- LOG_CLASS(LLMenuOptionPathfindingRebakeNavmesh);
+ LLSINGLETON(LLMenuOptionPathfindingRebakeNavmesh);
+ virtual ~LLMenuOptionPathfindingRebakeNavmesh();
+ LOG_CLASS(LLMenuOptionPathfindingRebakeNavmesh);
public:
- typedef enum
- {
- kRebakeNavMesh_Available,
- kRebakeNavMesh_RequestSent,
- kRebakeNavMesh_InProgress,
- kRebakeNavMesh_NotAvailable,
- kRebakeNavMesh_Default = kRebakeNavMesh_NotAvailable
- } ERebakeNavMeshMode;
+ typedef enum
+ {
+ kRebakeNavMesh_Available,
+ kRebakeNavMesh_RequestSent,
+ kRebakeNavMesh_InProgress,
+ kRebakeNavMesh_NotAvailable,
+ kRebakeNavMesh_Default = kRebakeNavMesh_NotAvailable
+ } ERebakeNavMeshMode;
- void initialize();
- void quit();
+ void initialize();
+ void quit();
- bool canRebakeRegion() const;
- ERebakeNavMeshMode getMode() const;
-
- void sendRequestRebakeNavmesh();
+ bool canRebakeRegion() const;
+ ERebakeNavMeshMode getMode() const;
+
+ void sendRequestRebakeNavmesh();
protected:
private:
- void setMode(ERebakeNavMeshMode pRebakeNavMeshMode);
+ void setMode(ERebakeNavMeshMode pRebakeNavMeshMode);
+
+ void handleAgentState(BOOL pCanRebakeRegion);
+ void handleRebakeNavMeshResponse(bool pResponseStatus);
+ void handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus);
+ void handleRegionBoundaryCrossed();
- void handleAgentState(BOOL pCanRebakeRegion);
- void handleRebakeNavMeshResponse(bool pResponseStatus);
- void handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus);
- void handleRegionBoundaryCrossed();
+ void createNavMeshStatusListenerForCurrentRegion();
- void createNavMeshStatusListenerForCurrentRegion();
+ bool mIsInitialized;
- bool mIsInitialized;
+ bool mCanRebakeRegion;
+ ERebakeNavMeshMode mRebakeNavMeshMode;
- bool mCanRebakeRegion;
- ERebakeNavMeshMode mRebakeNavMeshMode;
-
- LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
- boost::signals2::connection mRegionCrossingSlot;
- LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
+ LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
+ boost::signals2::connection mRegionCrossingSlot;
+ LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
};
#endif // LL_LLMENUOPTIONPATHFINDINGREBAKENAVMESH_H
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index a5601dafbe..f6441f8404 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010-2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -324,17 +324,17 @@ static LLFastTimer::DeclareTimer FTM_MESH_FETCH("Mesh Fetch");
// suitable number. In production, all must be false.
//
// Example:
-// #define MESH_HTTP_RESPONSE_FAILED MESH_RANDOM_NTH_TRUE(9)
+// #define MESH_HTTP_RESPONSE_FAILED MESH_RANDOM_NTH_TRUE(9)
// 1-in-N calls will test true
-#define MESH_RANDOM_NTH_TRUE(_N) ( ll_rand(S32(_N)) == 0 )
+#define MESH_RANDOM_NTH_TRUE(_N) ( ll_rand(S32(_N)) == 0 )
-#define MESH_HTTP_RESPONSE_FAILED false
-#define MESH_HEADER_PROCESS_FAILED false
-#define MESH_LOD_PROCESS_FAILED false
-#define MESH_SKIN_INFO_PROCESS_FAILED false
-#define MESH_DECOMP_PROCESS_FAILED false
-#define MESH_PHYS_SHAPE_PROCESS_FAILED false
+#define MESH_HTTP_RESPONSE_FAILED false
+#define MESH_HEADER_PROCESS_FAILED false
+#define MESH_LOD_PROCESS_FAILED false
+#define MESH_SKIN_INFO_PROCESS_FAILED false
+#define MESH_DECOMP_PROCESS_FAILED false
+#define MESH_PHYS_SHAPE_PROCESS_FAILED false
// --------------------------------------------------------------------------
@@ -344,14 +344,14 @@ LLMeshRepository gMeshRepo;
const S32 MESH_HEADER_SIZE = 4096; // Important: assumption is that headers fit in this space
-const S32 REQUEST2_HIGH_WATER_MIN = 32; // Limits for GetMesh2 regions
+const S32 REQUEST2_HIGH_WATER_MIN = 32; // Limits for GetMesh2 regions
const S32 REQUEST2_HIGH_WATER_MAX = 100;
const S32 REQUEST2_LOW_WATER_MIN = 16;
const S32 REQUEST2_LOW_WATER_MAX = 50;
-const U32 LARGE_MESH_FETCH_THRESHOLD = 1U << 21; // Size at which requests goes to narrow/slow queue
-const long SMALL_MESH_XFER_TIMEOUT = 120L; // Seconds to complete xfer, small mesh downloads
-const long LARGE_MESH_XFER_TIMEOUT = 600L; // Seconds to complete xfer, large downloads
+const U32 LARGE_MESH_FETCH_THRESHOLD = 1U << 21; // Size at which requests goes to narrow/slow queue
+const long SMALL_MESH_XFER_TIMEOUT = 120L; // Seconds to complete xfer, small mesh downloads
+const long LARGE_MESH_XFER_TIMEOUT = 600L; // Seconds to complete xfer, large downloads
const U32 DOWNLOAD_RETRY_LIMIT = 8;
const F32 DOWNLOAD_RETRY_DELAY = 0.5f; // seconds
@@ -366,10 +366,10 @@ const F32 DOWNLOAD_RETRY_DELAY = 0.5f; // seconds
// upload retries to the user as in the past. SH-4667.
const long UPLOAD_RETRY_LIMIT = 0L;
-// Maximum mesh version to support. Three least significant digits are reserved for the minor version,
+// Maximum mesh version to support. Three least significant digits are reserved for the minor version,
// with major version changes indicating a format change that is not backwards compatible and should not
-// be parsed by viewers that don't specifically support that version. For example, if the integer "1" is
-// present, the version is 0.001. A viewer that can parse version 0.001 can also parse versions up to 0.999,
+// be parsed by viewers that don't specifically support that version. For example, if the integer "1" is
+// present, the version is 0.001. A viewer that can parse version 0.001 can also parse versions up to 0.999,
// but not 1.0 (integer 1000).
// See wiki at https://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format
const S32 MAX_MESH_VERSION = 999;
@@ -391,16 +391,16 @@ U32 LLMeshRepository::sCacheBytesDecomps = 0;
U32 LLMeshRepository::sCacheReads = 0;
U32 LLMeshRepository::sCacheWrites = 0;
U32 LLMeshRepository::sMaxLockHoldoffs = 0;
-
-LLDeadmanTimer LLMeshRepository::sQuiescentTimer(15.0, false); // true -> gather cpu metrics
+
+LLDeadmanTimer LLMeshRepository::sQuiescentTimer(15.0, false); // true -> gather cpu metrics
namespace {
- // The NoOpDeletor is used when passing certain objects (generally the LLMeshUploadThread)
- // in a smart pointer below for passage into the LLCore::Http libararies.
- // When the smart pointer is destroyed, no action will be taken since we
+ // The NoOpDeletor is used when passing certain objects (generally the LLMeshUploadThread)
+ // in a smart pointer below for passage into the LLCore::Http libararies.
+ // When the smart pointer is destroyed, no action will be taken since we
// do not in these cases want the object to be destroyed at the end of the call.
- //
- // *NOTE$: Yes! It is "Deletor"
+ //
+ // *NOTE$: Yes! It is "Deletor"
// http://english.stackexchange.com/questions/4733/what-s-the-rule-for-adding-er-vs-or-when-nouning-a-verb
// "delete" derives from Latin "deletus"
@@ -411,17 +411,17 @@ namespace {
static S32 dump_num = 0;
std::string make_dump_name(std::string prefix, S32 num)
{
- return prefix + std::to_string(num) + std::string(".xml");
+ return prefix + std::to_string(num) + std::string(".xml");
}
void dump_llsd_to_file(const LLSD& content, std::string filename);
LLSD llsd_from_file(std::string filename);
-const std::string header_lod[] =
+const std::string header_lod[] =
{
- "lowest_lod",
- "low_lod",
- "medium_lod",
- "high_lod"
+ "lowest_lod",
+ "low_lod",
+ "medium_lod",
+ "high_lod"
};
const char * const LOG_MESH = "Mesh";
@@ -445,81 +445,81 @@ void on_new_single_inventory_upload_complete(
//get the number of bytes resident in memory for given volume
U32 get_volume_memory_size(const LLVolume* volume)
{
- U32 indices = 0;
- U32 vertices = 0;
+ U32 indices = 0;
+ U32 vertices = 0;
- for (U32 i = 0; i < volume->getNumVolumeFaces(); ++i)
- {
- const LLVolumeFace& face = volume->getVolumeFace(i);
- indices += face.mNumIndices;
- vertices += face.mNumVertices;
- }
+ for (U32 i = 0; i < volume->getNumVolumeFaces(); ++i)
+ {
+ const LLVolumeFace& face = volume->getVolumeFace(i);
+ indices += face.mNumIndices;
+ vertices += face.mNumVertices;
+ }
- return indices*2+vertices*11+sizeof(LLVolume)+sizeof(LLVolumeFace)*volume->getNumVolumeFaces();
+ return indices*2+vertices*11+sizeof(LLVolume)+sizeof(LLVolumeFace)*volume->getNumVolumeFaces();
}
void get_vertex_buffer_from_mesh(LLCDMeshData& mesh, LLModel::PhysicsMesh& res, F32 scale = 1.f)
{
- res.mPositions.clear();
- res.mNormals.clear();
-
- const F32* v = mesh.mVertexBase;
-
- if (mesh.mIndexType == LLCDMeshData::INT_16)
- {
- U16* idx = (U16*) mesh.mIndexBase;
- for (S32 j = 0; j < mesh.mNumTriangles; ++j)
- {
- F32* mp0 = (F32*) ((U8*)v+idx[0]*mesh.mVertexStrideBytes);
- F32* mp1 = (F32*) ((U8*)v+idx[1]*mesh.mVertexStrideBytes);
- F32* mp2 = (F32*) ((U8*)v+idx[2]*mesh.mVertexStrideBytes);
-
- idx = (U16*) (((U8*)idx)+mesh.mIndexStrideBytes);
-
- LLVector3 v0(mp0);
- LLVector3 v1(mp1);
- LLVector3 v2(mp2);
-
- LLVector3 n = (v1-v0)%(v2-v0);
- n.normalize();
-
- res.mPositions.push_back(v0*scale);
- res.mPositions.push_back(v1*scale);
- res.mPositions.push_back(v2*scale);
-
- res.mNormals.push_back(n);
- res.mNormals.push_back(n);
- res.mNormals.push_back(n);
- }
- }
- else
- {
- U32* idx = (U32*) mesh.mIndexBase;
- for (S32 j = 0; j < mesh.mNumTriangles; ++j)
- {
- F32* mp0 = (F32*) ((U8*)v+idx[0]*mesh.mVertexStrideBytes);
- F32* mp1 = (F32*) ((U8*)v+idx[1]*mesh.mVertexStrideBytes);
- F32* mp2 = (F32*) ((U8*)v+idx[2]*mesh.mVertexStrideBytes);
-
- idx = (U32*) (((U8*)idx)+mesh.mIndexStrideBytes);
-
- LLVector3 v0(mp0);
- LLVector3 v1(mp1);
- LLVector3 v2(mp2);
-
- LLVector3 n = (v1-v0)%(v2-v0);
- n.normalize();
-
- res.mPositions.push_back(v0*scale);
- res.mPositions.push_back(v1*scale);
- res.mPositions.push_back(v2*scale);
-
- res.mNormals.push_back(n);
- res.mNormals.push_back(n);
- res.mNormals.push_back(n);
- }
- }
+ res.mPositions.clear();
+ res.mNormals.clear();
+
+ const F32* v = mesh.mVertexBase;
+
+ if (mesh.mIndexType == LLCDMeshData::INT_16)
+ {
+ U16* idx = (U16*) mesh.mIndexBase;
+ for (S32 j = 0; j < mesh.mNumTriangles; ++j)
+ {
+ F32* mp0 = (F32*) ((U8*)v+idx[0]*mesh.mVertexStrideBytes);
+ F32* mp1 = (F32*) ((U8*)v+idx[1]*mesh.mVertexStrideBytes);
+ F32* mp2 = (F32*) ((U8*)v+idx[2]*mesh.mVertexStrideBytes);
+
+ idx = (U16*) (((U8*)idx)+mesh.mIndexStrideBytes);
+
+ LLVector3 v0(mp0);
+ LLVector3 v1(mp1);
+ LLVector3 v2(mp2);
+
+ LLVector3 n = (v1-v0)%(v2-v0);
+ n.normalize();
+
+ res.mPositions.push_back(v0*scale);
+ res.mPositions.push_back(v1*scale);
+ res.mPositions.push_back(v2*scale);
+
+ res.mNormals.push_back(n);
+ res.mNormals.push_back(n);
+ res.mNormals.push_back(n);
+ }
+ }
+ else
+ {
+ U32* idx = (U32*) mesh.mIndexBase;
+ for (S32 j = 0; j < mesh.mNumTriangles; ++j)
+ {
+ F32* mp0 = (F32*) ((U8*)v+idx[0]*mesh.mVertexStrideBytes);
+ F32* mp1 = (F32*) ((U8*)v+idx[1]*mesh.mVertexStrideBytes);
+ F32* mp2 = (F32*) ((U8*)v+idx[2]*mesh.mVertexStrideBytes);
+
+ idx = (U32*) (((U8*)idx)+mesh.mIndexStrideBytes);
+
+ LLVector3 v0(mp0);
+ LLVector3 v1(mp1);
+ LLVector3 v2(mp2);
+
+ LLVector3 n = (v1-v0)%(v2-v0);
+ n.normalize();
+
+ res.mPositions.push_back(v0*scale);
+ res.mPositions.push_back(v1*scale);
+ res.mPositions.push_back(v2*scale);
+
+ res.mNormals.push_back(n);
+ res.mNormals.push_back(n);
+ res.mNormals.push_back(n);
+ }
+ }
}
void RequestStats::updateTime()
@@ -542,13 +542,13 @@ bool RequestStats::isDelayed() const
LLViewerFetchedTexture* LLMeshUploadThread::FindViewerTexture(const LLImportMaterial& material)
{
- LLPointer< LLViewerFetchedTexture > * ppTex = static_cast< LLPointer< LLViewerFetchedTexture > * >(material.mOpaqueData);
- return ppTex ? (*ppTex).get() : NULL;
+ LLPointer< LLViewerFetchedTexture > * ppTex = static_cast< LLPointer< LLViewerFetchedTexture > * >(material.mOpaqueData);
+ return ppTex ? (*ppTex).get() : NULL;
}
volatile S32 LLMeshRepoThread::sActiveHeaderRequests = 0;
volatile S32 LLMeshRepoThread::sActiveLODRequests = 0;
-U32 LLMeshRepoThread::sMaxConcurrentRequests = 1;
+U32 LLMeshRepoThread::sMaxConcurrentRequests = 1;
S32 LLMeshRepoThread::sRequestLowWater = REQUEST2_LOW_WATER_MIN;
S32 LLMeshRepoThread::sRequestHighWater = REQUEST2_HIGH_WATER_MIN;
S32 LLMeshRepoThread::sRequestWaterLevel = 0;
@@ -577,34 +577,34 @@ class LLMeshHandlerBase : public LLCore::HttpHandler,
public:
typedef std::shared_ptr<LLMeshHandlerBase> ptr_t;
- LOG_CLASS(LLMeshHandlerBase);
- LLMeshHandlerBase(U32 offset, U32 requested_bytes)
- : LLCore::HttpHandler(),
- mMeshParams(),
- mProcessed(false),
- mHttpHandle(LLCORE_HTTP_HANDLE_INVALID),
- mOffset(offset),
- mRequestedBytes(requested_bytes)
- {}
+ LOG_CLASS(LLMeshHandlerBase);
+ LLMeshHandlerBase(U32 offset, U32 requested_bytes)
+ : LLCore::HttpHandler(),
+ mMeshParams(),
+ mProcessed(false),
+ mHttpHandle(LLCORE_HTTP_HANDLE_INVALID),
+ mOffset(offset),
+ mRequestedBytes(requested_bytes)
+ {}
- virtual ~LLMeshHandlerBase()
- {}
+ virtual ~LLMeshHandlerBase()
+ {}
protected:
- LLMeshHandlerBase(const LLMeshHandlerBase &); // Not defined
- void operator=(const LLMeshHandlerBase &); // Not defined
-
+ LLMeshHandlerBase(const LLMeshHandlerBase &); // Not defined
+ void operator=(const LLMeshHandlerBase &); // Not defined
+
public:
- virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
- virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size) = 0;
- virtual void processFailure(LLCore::HttpStatus status) = 0;
-
+ virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
+ virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size) = 0;
+ virtual void processFailure(LLCore::HttpStatus status) = 0;
+
public:
- LLVolumeParams mMeshParams;
- bool mProcessed;
- LLCore::HttpHandle mHttpHandle;
- U32 mOffset;
- U32 mRequestedBytes;
+ LLVolumeParams mMeshParams;
+ bool mProcessed;
+ LLCore::HttpHandle mHttpHandle;
+ U32 mOffset;
+ U32 mRequestedBytes;
};
@@ -614,22 +614,22 @@ public:
class LLMeshHeaderHandler : public LLMeshHandlerBase
{
public:
- LOG_CLASS(LLMeshHeaderHandler);
- LLMeshHeaderHandler(const LLVolumeParams & mesh_params, U32 offset, U32 requested_bytes)
- : LLMeshHandlerBase(offset, requested_bytes)
- {
- mMeshParams = mesh_params;
- LLMeshRepoThread::incActiveHeaderRequests();
- }
- virtual ~LLMeshHeaderHandler();
+ LOG_CLASS(LLMeshHeaderHandler);
+ LLMeshHeaderHandler(const LLVolumeParams & mesh_params, U32 offset, U32 requested_bytes)
+ : LLMeshHandlerBase(offset, requested_bytes)
+ {
+ mMeshParams = mesh_params;
+ LLMeshRepoThread::incActiveHeaderRequests();
+ }
+ virtual ~LLMeshHeaderHandler();
protected:
- LLMeshHeaderHandler(const LLMeshHeaderHandler &); // Not defined
- void operator=(const LLMeshHeaderHandler &); // Not defined
-
+ LLMeshHeaderHandler(const LLMeshHeaderHandler &); // Not defined
+ void operator=(const LLMeshHeaderHandler &); // Not defined
+
public:
- virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
- virtual void processFailure(LLCore::HttpStatus status);
+ virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
+ virtual void processFailure(LLCore::HttpStatus status);
};
@@ -639,26 +639,26 @@ public:
class LLMeshLODHandler : public LLMeshHandlerBase
{
public:
- LOG_CLASS(LLMeshLODHandler);
- LLMeshLODHandler(const LLVolumeParams & mesh_params, S32 lod, U32 offset, U32 requested_bytes)
- : LLMeshHandlerBase(offset, requested_bytes),
- mLOD(lod)
- {
- mMeshParams = mesh_params;
- LLMeshRepoThread::incActiveLODRequests();
- }
- virtual ~LLMeshLODHandler();
-
+ LOG_CLASS(LLMeshLODHandler);
+ LLMeshLODHandler(const LLVolumeParams & mesh_params, S32 lod, U32 offset, U32 requested_bytes)
+ : LLMeshHandlerBase(offset, requested_bytes),
+ mLOD(lod)
+ {
+ mMeshParams = mesh_params;
+ LLMeshRepoThread::incActiveLODRequests();
+ }
+ virtual ~LLMeshLODHandler();
+
protected:
- LLMeshLODHandler(const LLMeshLODHandler &); // Not defined
- void operator=(const LLMeshLODHandler &); // Not defined
-
+ LLMeshLODHandler(const LLMeshLODHandler &); // Not defined
+ void operator=(const LLMeshLODHandler &); // Not defined
+
public:
- virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
- virtual void processFailure(LLCore::HttpStatus status);
+ virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
+ virtual void processFailure(LLCore::HttpStatus status);
public:
- S32 mLOD;
+ S32 mLOD;
};
@@ -668,23 +668,23 @@ public:
class LLMeshSkinInfoHandler : public LLMeshHandlerBase
{
public:
- LOG_CLASS(LLMeshSkinInfoHandler);
- LLMeshSkinInfoHandler(const LLUUID& id, U32 offset, U32 requested_bytes)
- : LLMeshHandlerBase(offset, requested_bytes),
- mMeshID(id)
- {}
- virtual ~LLMeshSkinInfoHandler();
+ LOG_CLASS(LLMeshSkinInfoHandler);
+ LLMeshSkinInfoHandler(const LLUUID& id, U32 offset, U32 requested_bytes)
+ : LLMeshHandlerBase(offset, requested_bytes),
+ mMeshID(id)
+ {}
+ virtual ~LLMeshSkinInfoHandler();
protected:
- LLMeshSkinInfoHandler(const LLMeshSkinInfoHandler &); // Not defined
- void operator=(const LLMeshSkinInfoHandler &); // Not defined
+ LLMeshSkinInfoHandler(const LLMeshSkinInfoHandler &); // Not defined
+ void operator=(const LLMeshSkinInfoHandler &); // Not defined
public:
- virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
- virtual void processFailure(LLCore::HttpStatus status);
+ virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
+ virtual void processFailure(LLCore::HttpStatus status);
public:
- LLUUID mMeshID;
+ LLUUID mMeshID;
};
@@ -694,23 +694,23 @@ public:
class LLMeshDecompositionHandler : public LLMeshHandlerBase
{
public:
- LOG_CLASS(LLMeshDecompositionHandler);
- LLMeshDecompositionHandler(const LLUUID& id, U32 offset, U32 requested_bytes)
- : LLMeshHandlerBase(offset, requested_bytes),
- mMeshID(id)
- {}
- virtual ~LLMeshDecompositionHandler();
+ LOG_CLASS(LLMeshDecompositionHandler);
+ LLMeshDecompositionHandler(const LLUUID& id, U32 offset, U32 requested_bytes)
+ : LLMeshHandlerBase(offset, requested_bytes),
+ mMeshID(id)
+ {}
+ virtual ~LLMeshDecompositionHandler();
protected:
- LLMeshDecompositionHandler(const LLMeshDecompositionHandler &); // Not defined
- void operator=(const LLMeshDecompositionHandler &); // Not defined
+ LLMeshDecompositionHandler(const LLMeshDecompositionHandler &); // Not defined
+ void operator=(const LLMeshDecompositionHandler &); // Not defined
public:
- virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
- virtual void processFailure(LLCore::HttpStatus status);
+ virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
+ virtual void processFailure(LLCore::HttpStatus status);
public:
- LLUUID mMeshID;
+ LLUUID mMeshID;
};
@@ -720,105 +720,105 @@ public:
class LLMeshPhysicsShapeHandler : public LLMeshHandlerBase
{
public:
- LOG_CLASS(LLMeshPhysicsShapeHandler);
- LLMeshPhysicsShapeHandler(const LLUUID& id, U32 offset, U32 requested_bytes)
- : LLMeshHandlerBase(offset, requested_bytes),
- mMeshID(id)
- {}
- virtual ~LLMeshPhysicsShapeHandler();
+ LOG_CLASS(LLMeshPhysicsShapeHandler);
+ LLMeshPhysicsShapeHandler(const LLUUID& id, U32 offset, U32 requested_bytes)
+ : LLMeshHandlerBase(offset, requested_bytes),
+ mMeshID(id)
+ {}
+ virtual ~LLMeshPhysicsShapeHandler();
protected:
- LLMeshPhysicsShapeHandler(const LLMeshPhysicsShapeHandler &); // Not defined
- void operator=(const LLMeshPhysicsShapeHandler &); // Not defined
+ LLMeshPhysicsShapeHandler(const LLMeshPhysicsShapeHandler &); // Not defined
+ void operator=(const LLMeshPhysicsShapeHandler &); // Not defined
public:
- virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
- virtual void processFailure(LLCore::HttpStatus status);
+ virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size);
+ virtual void processFailure(LLCore::HttpStatus status);
public:
- LLUUID mMeshID;
+ LLUUID mMeshID;
};
void log_upload_error(LLCore::HttpStatus status, const LLSD& content,
- const char * const stage, const std::string & model_name)
-{
- // Add notification popup.
- LLSD args;
- std::string message = content["error"]["message"].asString();
- std::string identifier = content["error"]["identifier"].asString();
- args["MESSAGE"] = message;
- args["IDENTIFIER"] = identifier;
- args["LABEL"] = model_name;
-
- // Log details.
- LL_WARNS(LOG_MESH) << "Error in stage: " << stage
- << ", Reason: " << status.toString()
- << " (" << status.toTerseString() << ")" << LL_ENDL;
-
- std::ostringstream details;
- typedef std::set<std::string> mav_errors_set_t;
- mav_errors_set_t mav_errors;
-
- if (content.has("error"))
- {
- const LLSD& err = content["error"];
- LL_WARNS(LOG_MESH) << "error: " << err << LL_ENDL;
- LL_WARNS(LOG_MESH) << " mesh upload failed, stage '" << stage
- << "', error '" << err["error"].asString()
- << "', message '" << err["message"].asString()
- << "', id '" << err["identifier"].asString()
- << "'" << LL_ENDL;
-
- if (err.has("errors"))
- {
- details << std::endl << std::endl;
-
- S32 error_num = 0;
- const LLSD& err_list = err["errors"];
- for (LLSD::array_const_iterator it = err_list.beginArray();
- it != err_list.endArray();
- ++it)
- {
- const LLSD& err_entry = *it;
- std::string message = err_entry["message"];
-
- if (message.length() > 0)
- {
- mav_errors.insert(message);
- }
-
- LL_WARNS(LOG_MESH) << " error[" << error_num << "]:" << LL_ENDL;
- for (LLSD::map_const_iterator map_it = err_entry.beginMap();
- map_it != err_entry.endMap();
- ++map_it)
- {
- LL_WARNS(LOG_MESH) << " " << map_it->first << ": "
- << map_it->second << LL_ENDL;
- }
- error_num++;
- }
- }
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Bad response to mesh request, no additional error information available." << LL_ENDL;
- }
-
- mav_errors_set_t::iterator mav_errors_it = mav_errors.begin();
- for (; mav_errors_it != mav_errors.end(); ++mav_errors_it)
- {
- std::string mav_details = "Mav_Details_" + *mav_errors_it;
- details << "Message: '" << *mav_errors_it << "': " << LLTrans::getString(mav_details) << std::endl << std::endl;
- }
-
- std::string details_str = details.str();
- if (details_str.length() > 0)
- {
- args["DETAILS"] = details_str;
- }
-
- gMeshRepo.uploadError(args);
+ const char * const stage, const std::string & model_name)
+{
+ // Add notification popup.
+ LLSD args;
+ std::string message = content["error"]["message"].asString();
+ std::string identifier = content["error"]["identifier"].asString();
+ args["MESSAGE"] = message;
+ args["IDENTIFIER"] = identifier;
+ args["LABEL"] = model_name;
+
+ // Log details.
+ LL_WARNS(LOG_MESH) << "Error in stage: " << stage
+ << ", Reason: " << status.toString()
+ << " (" << status.toTerseString() << ")" << LL_ENDL;
+
+ std::ostringstream details;
+ typedef std::set<std::string> mav_errors_set_t;
+ mav_errors_set_t mav_errors;
+
+ if (content.has("error"))
+ {
+ const LLSD& err = content["error"];
+ LL_WARNS(LOG_MESH) << "error: " << err << LL_ENDL;
+ LL_WARNS(LOG_MESH) << " mesh upload failed, stage '" << stage
+ << "', error '" << err["error"].asString()
+ << "', message '" << err["message"].asString()
+ << "', id '" << err["identifier"].asString()
+ << "'" << LL_ENDL;
+
+ if (err.has("errors"))
+ {
+ details << std::endl << std::endl;
+
+ S32 error_num = 0;
+ const LLSD& err_list = err["errors"];
+ for (LLSD::array_const_iterator it = err_list.beginArray();
+ it != err_list.endArray();
+ ++it)
+ {
+ const LLSD& err_entry = *it;
+ std::string message = err_entry["message"];
+
+ if (message.length() > 0)
+ {
+ mav_errors.insert(message);
+ }
+
+ LL_WARNS(LOG_MESH) << " error[" << error_num << "]:" << LL_ENDL;
+ for (LLSD::map_const_iterator map_it = err_entry.beginMap();
+ map_it != err_entry.endMap();
+ ++map_it)
+ {
+ LL_WARNS(LOG_MESH) << " " << map_it->first << ": "
+ << map_it->second << LL_ENDL;
+ }
+ error_num++;
+ }
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Bad response to mesh request, no additional error information available." << LL_ENDL;
+ }
+
+ mav_errors_set_t::iterator mav_errors_it = mav_errors.begin();
+ for (; mav_errors_it != mav_errors.end(); ++mav_errors_it)
+ {
+ std::string mav_details = "Mav_Details_" + *mav_errors_it;
+ details << "Message: '" << *mav_errors_it << "': " << LLTrans::getString(mav_details) << std::endl << std::endl;
+ }
+
+ std::string details_str = details.str();
+ if (details_str.length() > 0)
+ {
+ args["DETAILS"] = details_str;
+ }
+
+ gMeshRepo.uploadError(args);
}
LLMeshRepoThread::LLMeshRepoThread()
@@ -830,36 +830,36 @@ LLMeshRepoThread::LLMeshRepoThread()
mHttpPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
mHttpLargePolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID)
{
- LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
+ LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
- mMutex = new LLMutex();
- mHeaderMutex = new LLMutex();
- mSignal = new LLCondition();
- mHttpRequest = new LLCore::HttpRequest;
- mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
- mHttpOptions->setTransferTimeout(SMALL_MESH_XFER_TIMEOUT);
- mHttpOptions->setUseRetryAfter(gSavedSettings.getBOOL("MeshUseHttpRetryAfter"));
- mHttpLargeOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
- mHttpLargeOptions->setTransferTimeout(LARGE_MESH_XFER_TIMEOUT);
- mHttpLargeOptions->setUseRetryAfter(gSavedSettings.getBOOL("MeshUseHttpRetryAfter"));
- mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders);
- mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_VND_LL_MESH);
- mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_MESH2);
- mHttpLargePolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_LARGE_MESH);
+ mMutex = new LLMutex();
+ mHeaderMutex = new LLMutex();
+ mSignal = new LLCondition();
+ mHttpRequest = new LLCore::HttpRequest;
+ mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+ mHttpOptions->setTransferTimeout(SMALL_MESH_XFER_TIMEOUT);
+ mHttpOptions->setUseRetryAfter(gSavedSettings.getBOOL("MeshUseHttpRetryAfter"));
+ mHttpLargeOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+ mHttpLargeOptions->setTransferTimeout(LARGE_MESH_XFER_TIMEOUT);
+ mHttpLargeOptions->setUseRetryAfter(gSavedSettings.getBOOL("MeshUseHttpRetryAfter"));
+ mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders);
+ mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_VND_LL_MESH);
+ mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_MESH2);
+ mHttpLargePolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_LARGE_MESH);
}
LLMeshRepoThread::~LLMeshRepoThread()
{
- LL_INFOS(LOG_MESH) << "Small GETs issued: " << LLMeshRepository::sHTTPRequestCount
- << ", Large GETs issued: " << LLMeshRepository::sHTTPLargeRequestCount
- << ", Max Lock Holdoffs: " << LLMeshRepository::sMaxLockHoldoffs
- << LL_ENDL;
+ LL_INFOS(LOG_MESH) << "Small GETs issued: " << LLMeshRepository::sHTTPRequestCount
+ << ", Large GETs issued: " << LLMeshRepository::sHTTPLargeRequestCount
+ << ", Max Lock Holdoffs: " << LLMeshRepository::sMaxLockHoldoffs
+ << LL_ENDL;
- mHttpRequestSet.clear();
+ mHttpRequestSet.clear();
mHttpHeaders.reset();
- while (!mSkinInfoQ.empty())
+ while (!mSkinInfoQ.empty())
{
delete mSkinInfoQ.front();
mSkinInfoQ.pop_front();
@@ -872,56 +872,56 @@ LLMeshRepoThread::~LLMeshRepoThread()
}
delete mHttpRequest;
- mHttpRequest = NULL;
- delete mMutex;
- mMutex = NULL;
- delete mHeaderMutex;
- mHeaderMutex = NULL;
- delete mSignal;
- mSignal = NULL;
+ mHttpRequest = NULL;
+ delete mMutex;
+ mMutex = NULL;
+ delete mHeaderMutex;
+ mHeaderMutex = NULL;
+ delete mSignal;
+ mSignal = NULL;
}
void LLMeshRepoThread::run()
{
- LLCDResult res = LLConvexDecomposition::initThread();
- if (res != LLCD_OK && LLConvexDecomposition::isFunctional())
- {
- LL_WARNS(LOG_MESH) << "Convex decomposition unable to be loaded. Expect severe problems." << LL_ENDL;
- }
-
- while (!LLApp::isExiting())
- {
- // *TODO: Revise sleep/wake strategy and try to move away
- // from polling operations in this thread. We can sleep
- // this thread hard when:
- // * All Http requests are serviced
- // * LOD request queue empty
- // * Header request queue empty
- // * Skin info request queue empty
- // * Decomposition request queue empty
- // * Physics shape request queue empty
- // We wake the thread when any of the above become untrue.
- // Will likely need a correctly-implemented condition variable to do this.
- // On the other hand, this may actually be an effective and efficient scheme...
-
- mSignal->wait();
-
- if (LLApp::isExiting())
- {
- break;
- }
-
- if (! mHttpRequestSet.empty())
- {
- // Dispatch all HttpHandler notifications
- mHttpRequest->update(0L);
- }
- sRequestWaterLevel = mHttpRequestSet.size(); // Stats data update
-
- // NOTE: order of queue processing intentionally favors LOD requests over header requests
- // Todo: we are processing mLODReqQ, mHeaderReqQ, mSkinRequests, mDecompositionRequests and mPhysicsShapeRequests
- // in relatively similar manners, remake code to simplify/unify the process,
- // like processRequests(&requestQ, fetchFunction); which does same thing for each element
+ LLCDResult res = LLConvexDecomposition::initThread();
+ if (res != LLCD_OK && LLConvexDecomposition::isFunctional())
+ {
+ LL_WARNS(LOG_MESH) << "Convex decomposition unable to be loaded. Expect severe problems." << LL_ENDL;
+ }
+
+ while (!LLApp::isExiting())
+ {
+ // *TODO: Revise sleep/wake strategy and try to move away
+ // from polling operations in this thread. We can sleep
+ // this thread hard when:
+ // * All Http requests are serviced
+ // * LOD request queue empty
+ // * Header request queue empty
+ // * Skin info request queue empty
+ // * Decomposition request queue empty
+ // * Physics shape request queue empty
+ // We wake the thread when any of the above become untrue.
+ // Will likely need a correctly-implemented condition variable to do this.
+ // On the other hand, this may actually be an effective and efficient scheme...
+
+ mSignal->wait();
+
+ if (LLApp::isExiting())
+ {
+ break;
+ }
+
+ if (! mHttpRequestSet.empty())
+ {
+ // Dispatch all HttpHandler notifications
+ mHttpRequest->update(0L);
+ }
+ sRequestWaterLevel = mHttpRequestSet.size(); // Stats data update
+
+ // NOTE: order of queue processing intentionally favors LOD requests over header requests
+ // Todo: we are processing mLODReqQ, mHeaderReqQ, mSkinRequests, mDecompositionRequests and mPhysicsShapeRequests
+ // in relatively similar manners, remake code to simplify/unify the process,
+ // like processRequests(&requestQ, fetchFunction); which does same thing for each element
if (!mLODReqQ.empty() && mHttpRequestSet.size() < sRequestHighWater)
{
@@ -954,7 +954,7 @@ void LLMeshRepoThread::run()
else
{
// too many fails
- LLMutexLock lock(mMutex);
+ LLMutexLock lock(mMutex);
mUnavailableQ.push_back(req);
LL_WARNS() << "Failed to load " << req.mMeshParams << " , skip" << LL_ENDL;
}
@@ -1031,42 +1031,42 @@ void LLMeshRepoThread::run()
if (!mSkinRequests.empty())
{
- std::list<UUIDBasedRequest> incomplete;
- while (!mSkinRequests.empty() && mHttpRequestSet.size() < sRequestHighWater)
- {
-
- mMutex->lock();
- auto req = mSkinRequests.front();
- mSkinRequests.pop_front();
- mMutex->unlock();
- if (req.isDelayed())
- {
- incomplete.emplace_back(req);
- }
- else if (!fetchMeshSkinInfo(req.mId, req.canRetry()))
- {
- if (req.canRetry())
- {
- req.updateTime();
- incomplete.emplace_back(req);
- }
- else
- {
- LLMutexLock locker(mMutex);
- mSkinUnavailableQ.push_back(req);
- LL_DEBUGS() << "mSkinReqQ failed: " << req.mId << LL_ENDL;
- }
- }
- }
-
- if (!incomplete.empty())
- {
- LLMutexLock locker(mMutex);
- for (const auto& req : incomplete)
- {
- mSkinRequests.push_back(req);
- }
- }
+ std::list<UUIDBasedRequest> incomplete;
+ while (!mSkinRequests.empty() && mHttpRequestSet.size() < sRequestHighWater)
+ {
+
+ mMutex->lock();
+ auto req = mSkinRequests.front();
+ mSkinRequests.pop_front();
+ mMutex->unlock();
+ if (req.isDelayed())
+ {
+ incomplete.emplace_back(req);
+ }
+ else if (!fetchMeshSkinInfo(req.mId, req.canRetry()))
+ {
+ if (req.canRetry())
+ {
+ req.updateTime();
+ incomplete.emplace_back(req);
+ }
+ else
+ {
+ LLMutexLock locker(mMutex);
+ mSkinUnavailableQ.push_back(req);
+ LL_DEBUGS() << "mSkinReqQ failed: " << req.mId << LL_ENDL;
+ }
+ }
+ }
+
+ if (!incomplete.empty())
+ {
+ LLMutexLock locker(mMutex);
+ for (const auto& req : incomplete)
+ {
+ mSkinRequests.push_back(req);
+ }
+ }
}
// holding lock, try next list
@@ -1145,87 +1145,87 @@ void LLMeshRepoThread::run()
}
}
- // For dev purposes only. A dynamic change could make this false
- // and that shouldn't assert.
- // llassert_always(mHttpRequestSet.size() <= sRequestHighWater);
- }
-
- if (mSignal->isLocked())
- { //make sure to let go of the mutex associated with the given signal before shutting down
- mSignal->unlock();
- }
+ // For dev purposes only. A dynamic change could make this false
+ // and that shouldn't assert.
+ // llassert_always(mHttpRequestSet.size() <= sRequestHighWater);
+ }
+
+ if (mSignal->isLocked())
+ { //make sure to let go of the mutex associated with the given signal before shutting down
+ mSignal->unlock();
+ }
- res = LLConvexDecomposition::quitThread();
- if (res != LLCD_OK && LLConvexDecomposition::isFunctional())
- {
- LL_WARNS(LOG_MESH) << "Convex decomposition unable to be quit." << LL_ENDL;
- }
+ res = LLConvexDecomposition::quitThread();
+ if (res != LLCD_OK && LLConvexDecomposition::isFunctional())
+ {
+ LL_WARNS(LOG_MESH) << "Convex decomposition unable to be quit." << LL_ENDL;
+ }
}
// Mutex: LLMeshRepoThread::mMutex must be held on entry
void LLMeshRepoThread::loadMeshSkinInfo(const LLUUID& mesh_id)
{
- mSkinRequests.push_back(UUIDBasedRequest(mesh_id));
+ mSkinRequests.push_back(UUIDBasedRequest(mesh_id));
}
// Mutex: LLMeshRepoThread::mMutex must be held on entry
void LLMeshRepoThread::loadMeshDecomposition(const LLUUID& mesh_id)
{
- mDecompositionRequests.insert(UUIDBasedRequest(mesh_id));
+ mDecompositionRequests.insert(UUIDBasedRequest(mesh_id));
}
// Mutex: LLMeshRepoThread::mMutex must be held on entry
void LLMeshRepoThread::loadMeshPhysicsShape(const LLUUID& mesh_id)
{
- mPhysicsShapeRequests.insert(UUIDBasedRequest(mesh_id));
+ mPhysicsShapeRequests.insert(UUIDBasedRequest(mesh_id));
}
void LLMeshRepoThread::lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
{
- if (!LLAppViewer::isExiting())
- {
- loadMeshLOD(mesh_params, lod);
- }
+ if (!LLAppViewer::isExiting())
+ {
+ loadMeshLOD(mesh_params, lod);
+ }
}
void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
{ //could be called from any thread
- const LLUUID& mesh_id = mesh_params.getSculptID();
- LLMutexLock lock(mMutex);
- LLMutexLock header_lock(mHeaderMutex);
- mesh_header_map::iterator iter = mMeshHeader.find(mesh_id);
- if (iter != mMeshHeader.end())
- { //if we have the header, request LOD byte range
-
- LODRequest req(mesh_params, lod);
- {
- mLODReqQ.push(req);
- LLMeshRepository::sLODProcessing++;
- }
- }
- else
- {
- HeaderRequest req(mesh_params);
- pending_lod_map::iterator pending = mPendingLOD.find(mesh_id);
-
- if (pending != mPendingLOD.end())
- { //append this lod request to existing header request
- pending->second.push_back(lod);
- llassert(pending->second.size() <= LLModel::NUM_LODS);
- }
- else
- { //if no header request is pending, fetch header
- mHeaderReqQ.push(req);
- mPendingLOD[mesh_id].push_back(lod);
- }
- }
+ const LLUUID& mesh_id = mesh_params.getSculptID();
+ LLMutexLock lock(mMutex);
+ LLMutexLock header_lock(mHeaderMutex);
+ mesh_header_map::iterator iter = mMeshHeader.find(mesh_id);
+ if (iter != mMeshHeader.end())
+ { //if we have the header, request LOD byte range
+
+ LODRequest req(mesh_params, lod);
+ {
+ mLODReqQ.push(req);
+ LLMeshRepository::sLODProcessing++;
+ }
+ }
+ else
+ {
+ HeaderRequest req(mesh_params);
+ pending_lod_map::iterator pending = mPendingLOD.find(mesh_id);
+
+ if (pending != mPendingLOD.end())
+ { //append this lod request to existing header request
+ pending->second.push_back(lod);
+ llassert(pending->second.size() <= LLModel::NUM_LODS);
+ }
+ else
+ { //if no header request is pending, fetch header
+ mHeaderReqQ.push(req);
+ mPendingLOD[mesh_id].push_back(lod);
+ }
+ }
}
// Mutex: must be holding mMutex when called
void LLMeshRepoThread::setGetMeshCap(const std::string & mesh_cap)
{
- mGetMeshCapability = mesh_cap;
+ mGetMeshCapability = mesh_cap;
}
@@ -1235,740 +1235,740 @@ void LLMeshRepoThread::setGetMeshCap(const std::string & mesh_cap)
// Mutex: acquires mMutex
void LLMeshRepoThread::constructUrl(LLUUID mesh_id, std::string * url)
{
- std::string res_url;
-
- if (gAgent.getRegion())
- {
- {
- LLMutexLock lock(mMutex);
- res_url = mGetMeshCapability;
- }
-
- if (!res_url.empty())
- {
- res_url += "/?mesh_id=";
- res_url += mesh_id.asString().c_str();
- }
- else
- {
- LL_WARNS_ONCE(LOG_MESH) << "Current region does not have ViewerAsset capability! Cannot load meshes. Region id: "
- << gAgent.getRegion()->getRegionID() << LL_ENDL;
- LL_DEBUGS_ONCE(LOG_MESH) << "Cannot load mesh " << mesh_id << " due to missing capability." << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS_ONCE(LOG_MESH) << "Current region is not loaded so there is no capability to load from! Cannot load meshes." << LL_ENDL;
- LL_DEBUGS_ONCE(LOG_MESH) << "Cannot load mesh " << mesh_id << " due to missing capability." << LL_ENDL;
- }
-
- *url = res_url;
+ std::string res_url;
+
+ if (gAgent.getRegion())
+ {
+ {
+ LLMutexLock lock(mMutex);
+ res_url = mGetMeshCapability;
+ }
+
+ if (!res_url.empty())
+ {
+ res_url += "/?mesh_id=";
+ res_url += mesh_id.asString().c_str();
+ }
+ else
+ {
+ LL_WARNS_ONCE(LOG_MESH) << "Current region does not have ViewerAsset capability! Cannot load meshes. Region id: "
+ << gAgent.getRegion()->getRegionID() << LL_ENDL;
+ LL_DEBUGS_ONCE(LOG_MESH) << "Cannot load mesh " << mesh_id << " due to missing capability." << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS_ONCE(LOG_MESH) << "Current region is not loaded so there is no capability to load from! Cannot load meshes." << LL_ENDL;
+ LL_DEBUGS_ONCE(LOG_MESH) << "Cannot load mesh " << mesh_id << " due to missing capability." << LL_ENDL;
+ }
+
+ *url = res_url;
}
// Issue an HTTP GET request with byte range using the right
-// policy class.
+// policy class.
//
-// @return Valid handle or LLCORE_HTTP_HANDLE_INVALID.
-// If the latter, actual status is found in
-// mHttpStatus member which is valid until the
-// next call to this method.
+// @return Valid handle or LLCORE_HTTP_HANDLE_INVALID.
+// If the latter, actual status is found in
+// mHttpStatus member which is valid until the
+// next call to this method.
//
// Thread: repo
LLCore::HttpHandle LLMeshRepoThread::getByteRange(const std::string & url,
- size_t offset, size_t len,
- const LLCore::HttpHandler::ptr_t &handler)
-{
- // Also used in lltexturefetch.cpp
- static LLCachedControl<bool> disable_range_req(gSavedSettings, "HttpRangeRequestsDisable", false);
-
- LLCore::HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID);
-
- if (len < LARGE_MESH_FETCH_THRESHOLD)
- {
- handle = mHttpRequest->requestGetByteRange( mHttpPolicyClass,
+ size_t offset, size_t len,
+ const LLCore::HttpHandler::ptr_t &handler)
+{
+ // Also used in lltexturefetch.cpp
+ static LLCachedControl<bool> disable_range_req(gSavedSettings, "HttpRangeRequestsDisable", false);
+
+ LLCore::HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID);
+
+ if (len < LARGE_MESH_FETCH_THRESHOLD)
+ {
+ handle = mHttpRequest->requestGetByteRange( mHttpPolicyClass,
url,
(disable_range_req ? size_t(0) : offset),
(disable_range_req ? size_t(0) : len),
mHttpOptions,
mHttpHeaders,
handler);
- if (LLCORE_HTTP_HANDLE_INVALID != handle)
- {
- ++LLMeshRepository::sHTTPRequestCount;
- }
- }
- else
- {
- handle = mHttpRequest->requestGetByteRange(mHttpLargePolicyClass,
- url,
- (disable_range_req ? size_t(0) : offset),
- (disable_range_req ? size_t(0) : len),
- mHttpLargeOptions,
- mHttpHeaders,
- handler);
- if (LLCORE_HTTP_HANDLE_INVALID != handle)
- {
- ++LLMeshRepository::sHTTPLargeRequestCount;
- }
- }
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- // Something went wrong, capture the error code for caller.
- mHttpStatus = mHttpRequest->getStatus();
- }
- return handle;
+ if (LLCORE_HTTP_HANDLE_INVALID != handle)
+ {
+ ++LLMeshRepository::sHTTPRequestCount;
+ }
+ }
+ else
+ {
+ handle = mHttpRequest->requestGetByteRange(mHttpLargePolicyClass,
+ url,
+ (disable_range_req ? size_t(0) : offset),
+ (disable_range_req ? size_t(0) : len),
+ mHttpLargeOptions,
+ mHttpHeaders,
+ handler);
+ if (LLCORE_HTTP_HANDLE_INVALID != handle)
+ {
+ ++LLMeshRepository::sHTTPLargeRequestCount;
+ }
+ }
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ // Something went wrong, capture the error code for caller.
+ mHttpStatus = mHttpRequest->getStatus();
+ }
+ return handle;
}
bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry)
{
-
- if (!mHeaderMutex)
- {
- return false;
- }
-
- mHeaderMutex->lock();
-
- auto header_it = mMeshHeader.find(mesh_id);
- if (header_it == mMeshHeader.end())
- { //we have no header info for this mesh, do nothing
- mHeaderMutex->unlock();
- return false;
- }
-
- ++LLMeshRepository::sMeshRequestCount;
- bool ret = true;
- U32 header_size = header_it->second.first;
-
- if (header_size > 0)
- {
- const LLMeshHeader& header = header_it->second.second;
+
+ if (!mHeaderMutex)
+ {
+ return false;
+ }
+
+ mHeaderMutex->lock();
+
+ auto header_it = mMeshHeader.find(mesh_id);
+ if (header_it == mMeshHeader.end())
+ { //we have no header info for this mesh, do nothing
+ mHeaderMutex->unlock();
+ return false;
+ }
+
+ ++LLMeshRepository::sMeshRequestCount;
+ bool ret = true;
+ U32 header_size = header_it->second.first;
+
+ if (header_size > 0)
+ {
+ const LLMeshHeader& header = header_it->second.second;
S32 version = header.mVersion;
- S32 offset = header_size + header.mSkinOffset;
- S32 size = header.mSkinSize;
-
- mHeaderMutex->unlock();
-
- if (version <= MAX_MESH_VERSION && offset >= 0 && size > 0)
- {
- //check cache for mesh skin info
- LLFileSystem file(mesh_id, LLAssetType::AT_MESH);
- if (file.getSize() >= offset+size)
- {
- U8* buffer = new(std::nothrow) U8[size];
- if (!buffer)
- {
- LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL;
- return false;
- }
- LLMeshRepository::sCacheBytesRead += size;
- ++LLMeshRepository::sCacheReads;
- file.seek(offset);
- file.read(buffer, size);
-
- //make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
- bool zero = true;
- for (S32 i = 0; i < llmin(size, 1024) && zero; ++i)
- {
- zero = buffer[i] > 0 ? false : true;
- }
-
- if (!zero)
- { //attempt to parse
- if (skinInfoReceived(mesh_id, buffer, size))
- {
- delete[] buffer;
- return true;
- }
- }
-
- delete[] buffer;
- }
-
- //reading from cache failed for whatever reason, fetch from sim
- std::string http_url;
- constructUrl(mesh_id, &http_url);
-
- if (!http_url.empty())
- {
+ S32 offset = header_size + header.mSkinOffset;
+ S32 size = header.mSkinSize;
+
+ mHeaderMutex->unlock();
+
+ if (version <= MAX_MESH_VERSION && offset >= 0 && size > 0)
+ {
+ //check cache for mesh skin info
+ LLFileSystem file(mesh_id, LLAssetType::AT_MESH);
+ if (file.getSize() >= offset+size)
+ {
+ U8* buffer = new(std::nothrow) U8[size];
+ if (!buffer)
+ {
+ LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL;
+ return false;
+ }
+ LLMeshRepository::sCacheBytesRead += size;
+ ++LLMeshRepository::sCacheReads;
+ file.seek(offset);
+ file.read(buffer, size);
+
+ //make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
+ bool zero = true;
+ for (S32 i = 0; i < llmin(size, 1024) && zero; ++i)
+ {
+ zero = buffer[i] > 0 ? false : true;
+ }
+
+ if (!zero)
+ { //attempt to parse
+ if (skinInfoReceived(mesh_id, buffer, size))
+ {
+ delete[] buffer;
+ return true;
+ }
+ }
+
+ delete[] buffer;
+ }
+
+ //reading from cache failed for whatever reason, fetch from sim
+ std::string http_url;
+ constructUrl(mesh_id, &http_url);
+
+ if (!http_url.empty())
+ {
LLMeshHandlerBase::ptr_t handler(new LLMeshSkinInfoHandler(mesh_id, offset, size));
- LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler);
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- LL_WARNS(LOG_MESH) << "HTTP GET request failed for skin info on mesh " << mID
- << ". Reason: " << mHttpStatus.toString()
- << " (" << mHttpStatus.toTerseString() << ")"
- << LL_ENDL;
- ret = false;
- }
- else if(can_retry)
- {
- handler->mHttpHandle = handle;
- mHttpRequestSet.insert(handler);
- }
- else
- {
- LLMutexLock locker(mMutex);
- mSkinUnavailableQ.emplace_back(mesh_id);
- }
- }
- else
- {
- LLMutexLock locker(mMutex);
- mSkinUnavailableQ.emplace_back(mesh_id);
- }
- }
- else
- {
- LLMutexLock locker(mMutex);
- mSkinUnavailableQ.emplace_back(mesh_id);
- }
- }
- else
- {
- mHeaderMutex->unlock();
- }
-
- //early out was not hit, effectively fetched
- return ret;
+ LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler);
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ LL_WARNS(LOG_MESH) << "HTTP GET request failed for skin info on mesh " << mID
+ << ". Reason: " << mHttpStatus.toString()
+ << " (" << mHttpStatus.toTerseString() << ")"
+ << LL_ENDL;
+ ret = false;
+ }
+ else if(can_retry)
+ {
+ handler->mHttpHandle = handle;
+ mHttpRequestSet.insert(handler);
+ }
+ else
+ {
+ LLMutexLock locker(mMutex);
+ mSkinUnavailableQ.emplace_back(mesh_id);
+ }
+ }
+ else
+ {
+ LLMutexLock locker(mMutex);
+ mSkinUnavailableQ.emplace_back(mesh_id);
+ }
+ }
+ else
+ {
+ LLMutexLock locker(mMutex);
+ mSkinUnavailableQ.emplace_back(mesh_id);
+ }
+ }
+ else
+ {
+ mHeaderMutex->unlock();
+ }
+
+ //early out was not hit, effectively fetched
+ return ret;
}
bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
{
- if (!mHeaderMutex)
- {
- return false;
- }
-
- mHeaderMutex->lock();
-
- auto header_it = mMeshHeader.find(mesh_id);
- if (header_it == mMeshHeader.end())
- { //we have no header info for this mesh, do nothing
- mHeaderMutex->unlock();
- return false;
- }
-
- ++LLMeshRepository::sMeshRequestCount;
- U32 header_size = header_it->second.first;
- bool ret = true;
-
- if (header_size > 0)
- {
- const auto& header = header_it->second.second;
+ if (!mHeaderMutex)
+ {
+ return false;
+ }
+
+ mHeaderMutex->lock();
+
+ auto header_it = mMeshHeader.find(mesh_id);
+ if (header_it == mMeshHeader.end())
+ { //we have no header info for this mesh, do nothing
+ mHeaderMutex->unlock();
+ return false;
+ }
+
+ ++LLMeshRepository::sMeshRequestCount;
+ U32 header_size = header_it->second.first;
+ bool ret = true;
+
+ if (header_size > 0)
+ {
+ const auto& header = header_it->second.second;
S32 version = header.mVersion;
S32 offset = header_size + header.mPhysicsConvexOffset;
S32 size = header.mPhysicsConvexSize;
- mHeaderMutex->unlock();
-
- if (version <= MAX_MESH_VERSION && offset >= 0 && size > 0)
- {
- //check cache for mesh skin info
- LLFileSystem file(mesh_id, LLAssetType::AT_MESH);
- if (file.getSize() >= offset+size)
- {
- U8* buffer = new(std::nothrow) U8[size];
- if (!buffer)
- {
- LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL;
- return false;
- }
- LLMeshRepository::sCacheBytesRead += size;
- ++LLMeshRepository::sCacheReads;
-
- file.seek(offset);
- file.read(buffer, size);
-
- //make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
- bool zero = true;
- for (S32 i = 0; i < llmin(size, 1024) && zero; ++i)
- {
- zero = buffer[i] > 0 ? false : true;
- }
-
- if (!zero)
- { //attempt to parse
- if (decompositionReceived(mesh_id, buffer, size))
- {
- delete[] buffer;
- return true;
- }
- }
-
- delete[] buffer;
- }
-
- //reading from cache failed for whatever reason, fetch from sim
- std::string http_url;
- constructUrl(mesh_id, &http_url);
-
- if (!http_url.empty())
- {
+ mHeaderMutex->unlock();
+
+ if (version <= MAX_MESH_VERSION && offset >= 0 && size > 0)
+ {
+ //check cache for mesh skin info
+ LLFileSystem file(mesh_id, LLAssetType::AT_MESH);
+ if (file.getSize() >= offset+size)
+ {
+ U8* buffer = new(std::nothrow) U8[size];
+ if (!buffer)
+ {
+ LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL;
+ return false;
+ }
+ LLMeshRepository::sCacheBytesRead += size;
+ ++LLMeshRepository::sCacheReads;
+
+ file.seek(offset);
+ file.read(buffer, size);
+
+ //make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
+ bool zero = true;
+ for (S32 i = 0; i < llmin(size, 1024) && zero; ++i)
+ {
+ zero = buffer[i] > 0 ? false : true;
+ }
+
+ if (!zero)
+ { //attempt to parse
+ if (decompositionReceived(mesh_id, buffer, size))
+ {
+ delete[] buffer;
+ return true;
+ }
+ }
+
+ delete[] buffer;
+ }
+
+ //reading from cache failed for whatever reason, fetch from sim
+ std::string http_url;
+ constructUrl(mesh_id, &http_url);
+
+ if (!http_url.empty())
+ {
LLMeshHandlerBase::ptr_t handler(new LLMeshDecompositionHandler(mesh_id, offset, size));
- LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler);
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- LL_WARNS(LOG_MESH) << "HTTP GET request failed for decomposition mesh " << mID
- << ". Reason: " << mHttpStatus.toString()
- << " (" << mHttpStatus.toTerseString() << ")"
- << LL_ENDL;
- ret = false;
- }
- else
- {
- handler->mHttpHandle = handle;
- mHttpRequestSet.insert(handler);
- }
- }
- }
- }
- else
- {
- mHeaderMutex->unlock();
- }
-
- //early out was not hit, effectively fetched
- return ret;
+ LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler);
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ LL_WARNS(LOG_MESH) << "HTTP GET request failed for decomposition mesh " << mID
+ << ". Reason: " << mHttpStatus.toString()
+ << " (" << mHttpStatus.toTerseString() << ")"
+ << LL_ENDL;
+ ret = false;
+ }
+ else
+ {
+ handler->mHttpHandle = handle;
+ mHttpRequestSet.insert(handler);
+ }
+ }
+ }
+ }
+ else
+ {
+ mHeaderMutex->unlock();
+ }
+
+ //early out was not hit, effectively fetched
+ return ret;
}
bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
{
- if (!mHeaderMutex)
- {
- return false;
- }
+ if (!mHeaderMutex)
+ {
+ return false;
+ }
- mHeaderMutex->lock();
+ mHeaderMutex->lock();
- auto header_it = mMeshHeader.find(mesh_id);
- if (header_it == mMeshHeader.end())
- { //we have no header info for this mesh, do nothing
- mHeaderMutex->unlock();
- return false;
- }
+ auto header_it = mMeshHeader.find(mesh_id);
+ if (header_it == mMeshHeader.end())
+ { //we have no header info for this mesh, do nothing
+ mHeaderMutex->unlock();
+ return false;
+ }
- ++LLMeshRepository::sMeshRequestCount;
- U32 header_size = header_it->second.first;
- bool ret = true;
+ ++LLMeshRepository::sMeshRequestCount;
+ U32 header_size = header_it->second.first;
+ bool ret = true;
- if (header_size > 0)
- {
- const auto& header = header_it->second.second;
+ if (header_size > 0)
+ {
+ const auto& header = header_it->second.second;
S32 version = header.mVersion;
S32 offset = header_size + header.mPhysicsMeshOffset;
- S32 size = header.mPhysicsMeshSize;
-
- mHeaderMutex->unlock();
-
- if (version <= MAX_MESH_VERSION && offset >= 0 && size > 0)
- {
- //check cache for mesh physics shape info
- LLFileSystem file(mesh_id, LLAssetType::AT_MESH);
- if (file.getSize() >= offset+size)
- {
- LLMeshRepository::sCacheBytesRead += size;
- ++LLMeshRepository::sCacheReads;
- file.seek(offset);
- U8* buffer = new(std::nothrow) U8[size];
- if (!buffer)
- {
- LL_WARNS(LOG_MESH) << "Failed to allocate memory for physics shape, size: " << size << LL_ENDL;
- return false;
- }
- file.read(buffer, size);
-
- //make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
- bool zero = true;
- for (S32 i = 0; i < llmin(size, 1024) && zero; ++i)
- {
- zero = buffer[i] > 0 ? false : true;
- }
-
- if (!zero)
- { //attempt to parse
- if (physicsShapeReceived(mesh_id, buffer, size) == MESH_OK)
- {
- delete[] buffer;
- return true;
- }
- }
-
- delete[] buffer;
- }
-
- //reading from cache failed for whatever reason, fetch from sim
- std::string http_url;
- constructUrl(mesh_id, &http_url);
-
- if (!http_url.empty())
- {
+ S32 size = header.mPhysicsMeshSize;
+
+ mHeaderMutex->unlock();
+
+ if (version <= MAX_MESH_VERSION && offset >= 0 && size > 0)
+ {
+ //check cache for mesh physics shape info
+ LLFileSystem file(mesh_id, LLAssetType::AT_MESH);
+ if (file.getSize() >= offset+size)
+ {
+ LLMeshRepository::sCacheBytesRead += size;
+ ++LLMeshRepository::sCacheReads;
+ file.seek(offset);
+ U8* buffer = new(std::nothrow) U8[size];
+ if (!buffer)
+ {
+ LL_WARNS(LOG_MESH) << "Failed to allocate memory for physics shape, size: " << size << LL_ENDL;
+ return false;
+ }
+ file.read(buffer, size);
+
+ //make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
+ bool zero = true;
+ for (S32 i = 0; i < llmin(size, 1024) && zero; ++i)
+ {
+ zero = buffer[i] > 0 ? false : true;
+ }
+
+ if (!zero)
+ { //attempt to parse
+ if (physicsShapeReceived(mesh_id, buffer, size) == MESH_OK)
+ {
+ delete[] buffer;
+ return true;
+ }
+ }
+
+ delete[] buffer;
+ }
+
+ //reading from cache failed for whatever reason, fetch from sim
+ std::string http_url;
+ constructUrl(mesh_id, &http_url);
+
+ if (!http_url.empty())
+ {
LLMeshHandlerBase::ptr_t handler(new LLMeshPhysicsShapeHandler(mesh_id, offset, size));
- LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler);
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- LL_WARNS(LOG_MESH) << "HTTP GET request failed for physics shape on mesh " << mID
- << ". Reason: " << mHttpStatus.toString()
- << " (" << mHttpStatus.toTerseString() << ")"
- << LL_ENDL;
- ret = false;
- }
- else
- {
- handler->mHttpHandle = handle;
- mHttpRequestSet.insert(handler);
- }
- }
- }
- else
- { //no physics shape whatsoever, report back NULL
- physicsShapeReceived(mesh_id, NULL, 0);
- }
- }
- else
- {
- mHeaderMutex->unlock();
- }
-
- //early out was not hit, effectively fetched
- return ret;
+ LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler);
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ LL_WARNS(LOG_MESH) << "HTTP GET request failed for physics shape on mesh " << mID
+ << ". Reason: " << mHttpStatus.toString()
+ << " (" << mHttpStatus.toTerseString() << ")"
+ << LL_ENDL;
+ ret = false;
+ }
+ else
+ {
+ handler->mHttpHandle = handle;
+ mHttpRequestSet.insert(handler);
+ }
+ }
+ }
+ else
+ { //no physics shape whatsoever, report back NULL
+ physicsShapeReceived(mesh_id, NULL, 0);
+ }
+ }
+ else
+ {
+ mHeaderMutex->unlock();
+ }
+
+ //early out was not hit, effectively fetched
+ return ret;
}
//static
void LLMeshRepoThread::incActiveLODRequests()
{
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- ++LLMeshRepoThread::sActiveLODRequests;
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ ++LLMeshRepoThread::sActiveLODRequests;
}
//static
void LLMeshRepoThread::decActiveLODRequests()
{
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- --LLMeshRepoThread::sActiveLODRequests;
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ --LLMeshRepoThread::sActiveLODRequests;
}
//static
void LLMeshRepoThread::incActiveHeaderRequests()
{
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- ++LLMeshRepoThread::sActiveHeaderRequests;
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ ++LLMeshRepoThread::sActiveHeaderRequests;
}
//static
void LLMeshRepoThread::decActiveHeaderRequests()
{
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- --LLMeshRepoThread::sActiveHeaderRequests;
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ --LLMeshRepoThread::sActiveHeaderRequests;
}
//return false if failed to get header
bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params, bool can_retry)
{
- ++LLMeshRepository::sMeshRequestCount;
-
- {
- //look for mesh in asset in cache
- LLFileSystem file(mesh_params.getSculptID(), LLAssetType::AT_MESH);
-
- S32 size = file.getSize();
-
- if (size > 0)
- {
- // *NOTE: if the header size is ever more than 4KB, this will break
- U8 buffer[MESH_HEADER_SIZE];
- S32 bytes = llmin(size, MESH_HEADER_SIZE);
- LLMeshRepository::sCacheBytesRead += bytes;
- ++LLMeshRepository::sCacheReads;
- file.read(buffer, bytes);
- if (headerReceived(mesh_params, buffer, bytes) == MESH_OK)
- {
- std::string mid;
- mesh_params.getSculptID().toString(mid);
- LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh header for ID " << mid << " - was retrieved from the cache." << LL_ENDL;
-
- // Found mesh in cache
- return true;
- }
- }
- }
-
- //either cache entry doesn't exist or is corrupt, request header from simulator
- bool retval = true;
- std::string http_url;
- constructUrl(mesh_params.getSculptID(), &http_url);
-
-
- if (!http_url.empty())
- {
- std::string mid;
- mesh_params.getSculptID().toString(mid);
- LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh header for ID " << mid << " - was retrieved from the simulator." << LL_ENDL;
-
- //grab first 4KB if we're going to bother with a fetch. Cache will prevent future fetches if a full mesh fits
- //within the first 4KB
- //NOTE -- this will break of headers ever exceed 4KB
+ ++LLMeshRepository::sMeshRequestCount;
+
+ {
+ //look for mesh in asset in cache
+ LLFileSystem file(mesh_params.getSculptID(), LLAssetType::AT_MESH);
+
+ S32 size = file.getSize();
+
+ if (size > 0)
+ {
+ // *NOTE: if the header size is ever more than 4KB, this will break
+ U8 buffer[MESH_HEADER_SIZE];
+ S32 bytes = llmin(size, MESH_HEADER_SIZE);
+ LLMeshRepository::sCacheBytesRead += bytes;
+ ++LLMeshRepository::sCacheReads;
+ file.read(buffer, bytes);
+ if (headerReceived(mesh_params, buffer, bytes) == MESH_OK)
+ {
+ std::string mid;
+ mesh_params.getSculptID().toString(mid);
+ LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh header for ID " << mid << " - was retrieved from the cache." << LL_ENDL;
+
+ // Found mesh in cache
+ return true;
+ }
+ }
+ }
+
+ //either cache entry doesn't exist or is corrupt, request header from simulator
+ bool retval = true;
+ std::string http_url;
+ constructUrl(mesh_params.getSculptID(), &http_url);
+
+
+ if (!http_url.empty())
+ {
+ std::string mid;
+ mesh_params.getSculptID().toString(mid);
+ LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh header for ID " << mid << " - was retrieved from the simulator." << LL_ENDL;
+
+ //grab first 4KB if we're going to bother with a fetch. Cache will prevent future fetches if a full mesh fits
+ //within the first 4KB
+ //NOTE -- this will break of headers ever exceed 4KB
LLMeshHandlerBase::ptr_t handler(new LLMeshHeaderHandler(mesh_params, 0, MESH_HEADER_SIZE));
- LLCore::HttpHandle handle = getByteRange(http_url, 0, MESH_HEADER_SIZE, handler);
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- LL_WARNS(LOG_MESH) << "HTTP GET request failed for mesh header " << mID
- << ". Reason: " << mHttpStatus.toString()
- << " (" << mHttpStatus.toTerseString() << ")"
- << LL_ENDL;
- retval = false;
- }
- else if (can_retry)
- {
- handler->mHttpHandle = handle;
- mHttpRequestSet.insert(handler);
- }
- }
-
- return retval;
+ LLCore::HttpHandle handle = getByteRange(http_url, 0, MESH_HEADER_SIZE, handler);
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ LL_WARNS(LOG_MESH) << "HTTP GET request failed for mesh header " << mID
+ << ". Reason: " << mHttpStatus.toString()
+ << " (" << mHttpStatus.toTerseString() << ")"
+ << LL_ENDL;
+ retval = false;
+ }
+ else if (can_retry)
+ {
+ handler->mHttpHandle = handle;
+ mHttpRequestSet.insert(handler);
+ }
+ }
+
+ return retval;
}
//return false if failed to get mesh lod.
bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, bool can_retry)
{
- if (!mHeaderMutex)
- {
- return false;
- }
-
- const LLUUID& mesh_id = mesh_params.getSculptID();
-
- mHeaderMutex->lock();
- auto header_it = mMeshHeader.find(mesh_id);
- if (header_it == mMeshHeader.end())
- { //we have no header info for this mesh, do nothing
- mHeaderMutex->unlock();
- return false;
- }
- ++LLMeshRepository::sMeshRequestCount;
- bool retval = true;
-
- U32 header_size = header_it->second.first;
- if (header_size > 0)
- {
- const auto& header = header_it->second.second;
+ if (!mHeaderMutex)
+ {
+ return false;
+ }
+
+ const LLUUID& mesh_id = mesh_params.getSculptID();
+
+ mHeaderMutex->lock();
+ auto header_it = mMeshHeader.find(mesh_id);
+ if (header_it == mMeshHeader.end())
+ { //we have no header info for this mesh, do nothing
+ mHeaderMutex->unlock();
+ return false;
+ }
+ ++LLMeshRepository::sMeshRequestCount;
+ bool retval = true;
+
+ U32 header_size = header_it->second.first;
+ if (header_size > 0)
+ {
+ const auto& header = header_it->second.second;
S32 version = header.mVersion;
S32 offset = header_size + header.mLodOffset[lod];
S32 size = header.mLodSize[lod];
- mHeaderMutex->unlock();
-
- if (version <= MAX_MESH_VERSION && offset >= 0 && size > 0)
- {
-
- //check cache for mesh asset
- LLFileSystem file(mesh_id, LLAssetType::AT_MESH);
- if (file.getSize() >= offset+size)
- {
- U8* buffer = new(std::nothrow) U8[size];
- if (!buffer)
- {
- LL_WARNS(LOG_MESH) << "Can't allocate memory for mesh " << mesh_id << " LOD " << lod << ", size: " << size << LL_ENDL;
- // todo: for now it will result in indefinite constant retries, should result in timeout
- // or in retry-count and disabling mesh. (but usually viewer is beyond saving at this point)
- return false;
- }
- LLMeshRepository::sCacheBytesRead += size;
- ++LLMeshRepository::sCacheReads;
- file.seek(offset);
- file.read(buffer, size);
-
- //make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
- bool zero = true;
- for (S32 i = 0; i < llmin(size, 1024) && zero; ++i)
- {
- zero = buffer[i] > 0 ? false : true;
- }
-
- if (!zero)
- { //attempt to parse
- if (lodReceived(mesh_params, lod, buffer, size) == MESH_OK)
- {
- delete[] buffer;
-
- std::string mid;
- mesh_id.toString(mid);
- LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh body for ID " << mid << " - was retrieved from the cache." << LL_ENDL;
-
- return true;
- }
- }
-
- delete[] buffer;
- }
-
- //reading from cache failed for whatever reason, fetch from sim
- std::string http_url;
- constructUrl(mesh_id, &http_url);
-
- if (!http_url.empty())
- {
- std::string mid;
- mesh_id.toString(mid);
- LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh body for ID " << mid << " - was retrieved from the simulator." << LL_ENDL;
+ mHeaderMutex->unlock();
+
+ if (version <= MAX_MESH_VERSION && offset >= 0 && size > 0)
+ {
+
+ //check cache for mesh asset
+ LLFileSystem file(mesh_id, LLAssetType::AT_MESH);
+ if (file.getSize() >= offset+size)
+ {
+ U8* buffer = new(std::nothrow) U8[size];
+ if (!buffer)
+ {
+ LL_WARNS(LOG_MESH) << "Can't allocate memory for mesh " << mesh_id << " LOD " << lod << ", size: " << size << LL_ENDL;
+ // todo: for now it will result in indefinite constant retries, should result in timeout
+ // or in retry-count and disabling mesh. (but usually viewer is beyond saving at this point)
+ return false;
+ }
+ LLMeshRepository::sCacheBytesRead += size;
+ ++LLMeshRepository::sCacheReads;
+ file.seek(offset);
+ file.read(buffer, size);
+
+ //make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
+ bool zero = true;
+ for (S32 i = 0; i < llmin(size, 1024) && zero; ++i)
+ {
+ zero = buffer[i] > 0 ? false : true;
+ }
+
+ if (!zero)
+ { //attempt to parse
+ if (lodReceived(mesh_params, lod, buffer, size) == MESH_OK)
+ {
+ delete[] buffer;
+
+ std::string mid;
+ mesh_id.toString(mid);
+ LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh body for ID " << mid << " - was retrieved from the cache." << LL_ENDL;
+
+ return true;
+ }
+ }
+
+ delete[] buffer;
+ }
+
+ //reading from cache failed for whatever reason, fetch from sim
+ std::string http_url;
+ constructUrl(mesh_id, &http_url);
+
+ if (!http_url.empty())
+ {
+ std::string mid;
+ mesh_id.toString(mid);
+ LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh body for ID " << mid << " - was retrieved from the simulator." << LL_ENDL;
LLMeshHandlerBase::ptr_t handler(new LLMeshLODHandler(mesh_params, lod, offset, size));
- LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler);
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- LL_WARNS(LOG_MESH) << "HTTP GET request failed for LOD on mesh " << mID
- << ". Reason: " << mHttpStatus.toString()
- << " (" << mHttpStatus.toTerseString() << ")"
- << LL_ENDL;
- retval = false;
- }
- else if (can_retry)
- {
- handler->mHttpHandle = handle;
- mHttpRequestSet.insert(handler);
- // *NOTE: Allowing a re-request, not marking as unavailable. Is that correct?
- }
- else
- {
- LLMutexLock lock(mMutex);
- mUnavailableQ.push_back(LODRequest(mesh_params, lod));
- }
- }
- else
- {
- LLMutexLock lock(mMutex);
- mUnavailableQ.push_back(LODRequest(mesh_params, lod));
- }
- }
- else
- {
- LLMutexLock lock(mMutex);
- mUnavailableQ.push_back(LODRequest(mesh_params, lod));
- }
- }
- else
- {
- mHeaderMutex->unlock();
- }
-
- return retval;
+ LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler);
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ LL_WARNS(LOG_MESH) << "HTTP GET request failed for LOD on mesh " << mID
+ << ". Reason: " << mHttpStatus.toString()
+ << " (" << mHttpStatus.toTerseString() << ")"
+ << LL_ENDL;
+ retval = false;
+ }
+ else if (can_retry)
+ {
+ handler->mHttpHandle = handle;
+ mHttpRequestSet.insert(handler);
+ // *NOTE: Allowing a re-request, not marking as unavailable. Is that correct?
+ }
+ else
+ {
+ LLMutexLock lock(mMutex);
+ mUnavailableQ.push_back(LODRequest(mesh_params, lod));
+ }
+ }
+ else
+ {
+ LLMutexLock lock(mMutex);
+ mUnavailableQ.push_back(LODRequest(mesh_params, lod));
+ }
+ }
+ else
+ {
+ LLMutexLock lock(mMutex);
+ mUnavailableQ.push_back(LODRequest(mesh_params, lod));
+ }
+ }
+ else
+ {
+ mHeaderMutex->unlock();
+ }
+
+ return retval;
}
EMeshProcessingResult LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* data, S32 data_size)
{
- const LLUUID mesh_id = mesh_params.getSculptID();
- LLSD header_data;
-
+ const LLUUID mesh_id = mesh_params.getSculptID();
+ LLSD header_data;
+
LLMeshHeader header;
-
- llssize header_size = 0;
- if (data_size > 0)
- {
- llssize dsize = data_size;
- char* result_ptr = strip_deprecated_header((char*)data, dsize, &header_size);
-
- data_size = dsize;
-
- boost::iostreams::stream<boost::iostreams::array_source> stream(result_ptr, data_size);
-
- if (!LLSDSerialize::fromBinary(header_data, stream, data_size))
- {
- LL_WARNS(LOG_MESH) << "Mesh header parse error. Not a valid mesh asset! ID: " << mesh_id
- << LL_ENDL;
- return MESH_PARSE_FAILURE;
- }
-
- if (!header_data.isMap())
- {
- LL_WARNS(LOG_MESH) << "Mesh header is invalid for ID: " << mesh_id << LL_ENDL;
- return MESH_INVALID;
- }
+
+ llssize header_size = 0;
+ if (data_size > 0)
+ {
+ llssize dsize = data_size;
+ char* result_ptr = strip_deprecated_header((char*)data, dsize, &header_size);
+
+ data_size = dsize;
+
+ boost::iostreams::stream<boost::iostreams::array_source> stream(result_ptr, data_size);
+
+ if (!LLSDSerialize::fromBinary(header_data, stream, data_size))
+ {
+ LL_WARNS(LOG_MESH) << "Mesh header parse error. Not a valid mesh asset! ID: " << mesh_id
+ << LL_ENDL;
+ return MESH_PARSE_FAILURE;
+ }
+
+ if (!header_data.isMap())
+ {
+ LL_WARNS(LOG_MESH) << "Mesh header is invalid for ID: " << mesh_id << LL_ENDL;
+ return MESH_INVALID;
+ }
header.fromLLSD(header_data);
- if (header.mVersion > MAX_MESH_VERSION)
- {
- LL_INFOS(LOG_MESH) << "Wrong version in header for " << mesh_id << LL_ENDL;
- header.m404 = true;
- }
- // make sure there is at least one lod, function returns -1 and marks as 404 otherwise
- else if (LLMeshRepository::getActualMeshLOD(header, 0) >= 0)
- {
- header_size += stream.tellg();
- }
- }
- else
- {
- LL_INFOS(LOG_MESH) << "Non-positive data size. Marking header as non-existent, will not retry. ID: " << mesh_id
- << LL_ENDL;
- header.m404 = 1;
- }
-
- {
-
- {
- LLMutexLock lock(mHeaderMutex);
- mMeshHeader[mesh_id] = { header_size, header };
+ if (header.mVersion > MAX_MESH_VERSION)
+ {
+ LL_INFOS(LOG_MESH) << "Wrong version in header for " << mesh_id << LL_ENDL;
+ header.m404 = true;
+ }
+ // make sure there is at least one lod, function returns -1 and marks as 404 otherwise
+ else if (LLMeshRepository::getActualMeshLOD(header, 0) >= 0)
+ {
+ header_size += stream.tellg();
+ }
+ }
+ else
+ {
+ LL_INFOS(LOG_MESH) << "Non-positive data size. Marking header as non-existent, will not retry. ID: " << mesh_id
+ << LL_ENDL;
+ header.m404 = 1;
+ }
+
+ {
+
+ {
+ LLMutexLock lock(mHeaderMutex);
+ mMeshHeader[mesh_id] = { header_size, header };
LLMeshRepository::sCacheBytesHeaders += header_size;
- }
-
- LLMutexLock lock(mMutex); // make sure only one thread access mPendingLOD at the same time.
-
- //check for pending requests
- pending_lod_map::iterator iter = mPendingLOD.find(mesh_id);
- if (iter != mPendingLOD.end())
- {
- for (U32 i = 0; i < iter->second.size(); ++i)
- {
- LODRequest req(mesh_params, iter->second[i]);
- mLODReqQ.push(req);
- LLMeshRepository::sLODProcessing++;
- }
- mPendingLOD.erase(iter);
- }
- }
-
- return MESH_OK;
+ }
+
+ LLMutexLock lock(mMutex); // make sure only one thread access mPendingLOD at the same time.
+
+ //check for pending requests
+ pending_lod_map::iterator iter = mPendingLOD.find(mesh_id);
+ if (iter != mPendingLOD.end())
+ {
+ for (U32 i = 0; i < iter->second.size(); ++i)
+ {
+ LODRequest req(mesh_params, iter->second[i]);
+ mLODReqQ.push(req);
+ LLMeshRepository::sLODProcessing++;
+ }
+ mPendingLOD.erase(iter);
+ }
+ }
+
+ return MESH_OK;
}
EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size)
{
- if (data == NULL || data_size == 0)
- {
- return MESH_NO_DATA;
- }
-
- LLPointer<LLVolume> volume = new LLVolume(mesh_params, LLVolumeLODGroup::getVolumeScaleFromDetail(lod));
- if (volume->unpackVolumeFaces(data, data_size))
- {
- if (volume->getNumFaces() > 0)
- {
- LoadedMesh mesh(volume, mesh_params, lod);
- {
- LLMutexLock lock(mMutex);
- mLoadedQ.push_back(mesh);
- // LLPointer is not thread safe, since we added this pointer into
- // threaded list, make sure counter gets decreased inside mutex lock
- // and won't affect mLoadedQ processing
- volume = NULL;
- // might be good idea to turn mesh into pointer to avoid making a copy
- mesh.mVolume = NULL;
- }
- return MESH_OK;
- }
- }
-
- return MESH_UNKNOWN;
+ if (data == NULL || data_size == 0)
+ {
+ return MESH_NO_DATA;
+ }
+
+ LLPointer<LLVolume> volume = new LLVolume(mesh_params, LLVolumeLODGroup::getVolumeScaleFromDetail(lod));
+ if (volume->unpackVolumeFaces(data, data_size))
+ {
+ if (volume->getNumFaces() > 0)
+ {
+ LoadedMesh mesh(volume, mesh_params, lod);
+ {
+ LLMutexLock lock(mMutex);
+ mLoadedQ.push_back(mesh);
+ // LLPointer is not thread safe, since we added this pointer into
+ // threaded list, make sure counter gets decreased inside mutex lock
+ // and won't affect mLoadedQ processing
+ volume = NULL;
+ // might be good idea to turn mesh into pointer to avoid making a copy
+ mesh.mVolume = NULL;
+ }
+ return MESH_OK;
+ }
+ }
+
+ return MESH_UNKNOWN;
}
bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 data_size)
{
- LLSD skin;
+ LLSD skin;
- if (data_size > 0)
- {
+ if (data_size > 0)
+ {
try
{
U32 uzip_result = LLUZipHelper::unzip_llsd(skin, data, data_size);
@@ -1985,35 +1985,35 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat
LL_WARNS(LOG_MESH) << "Out of memory for mesh ID " << mesh_id << " of size: " << data_size << LL_ENDL;
return false;
}
- }
-
- {
- LLMeshSkinInfo* info = nullptr;
- try
- {
- info = new LLMeshSkinInfo(mesh_id, skin);
- }
- catch (const std::bad_alloc& ex)
- {
- LL_WARNS() << "Failed to allocate skin info with exception: " << ex.what() << LL_ENDL;
- return false;
- }
+ }
+
+ {
+ LLMeshSkinInfo* info = nullptr;
+ try
+ {
+ info = new LLMeshSkinInfo(mesh_id, skin);
+ }
+ catch (const std::bad_alloc& ex)
+ {
+ LL_WARNS() << "Failed to allocate skin info with exception: " << ex.what() << LL_ENDL;
+ return false;
+ }
// LL_DEBUGS(LOG_MESH) << "info pelvis offset" << info.mPelvisOffset << LL_ENDL;
- {
- LLMutexLock lock(mMutex);
- mSkinInfoQ.push_back(info);
- }
- }
+ {
+ LLMutexLock lock(mMutex);
+ mSkinInfoQ.push_back(info);
+ }
+ }
- return true;
+ return true;
}
bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S32 data_size)
{
- LLSD decomp;
+ LLSD decomp;
- if (data_size > 0)
+ if (data_size > 0)
{
try
{
@@ -2031,1006 +2031,1006 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3
LL_WARNS(LOG_MESH) << "Out of memory for mesh ID " << mesh_id << " of size: " << data_size << LL_ENDL;
return false;
}
- }
-
- {
- LLModel::Decomposition* d = new LLModel::Decomposition(decomp);
- d->mMeshID = mesh_id;
- {
- LLMutexLock lock(mMutex);
- mDecompositionQ.push_back(d);
- }
- }
+ }
+
+ {
+ LLModel::Decomposition* d = new LLModel::Decomposition(decomp);
+ d->mMeshID = mesh_id;
+ {
+ LLMutexLock lock(mMutex);
+ mDecompositionQ.push_back(d);
+ }
+ }
- return true;
+ return true;
}
EMeshProcessingResult LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 data_size)
{
- LLSD physics_shape;
-
- LLModel::Decomposition* d = new LLModel::Decomposition();
- d->mMeshID = mesh_id;
-
- if (data == NULL)
- { //no data, no physics shape exists
- d->mPhysicsShapeMesh.clear();
- }
- else
- {
- LLVolumeParams volume_params;
- volume_params.setType(LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE);
- volume_params.setSculptID(mesh_id, LL_SCULPT_TYPE_MESH);
- LLPointer<LLVolume> volume = new LLVolume(volume_params,0);
-
- if (volume->unpackVolumeFaces(data, data_size))
- {
- d->mPhysicsShapeMesh.clear();
-
- std::vector<LLVector3>& pos = d->mPhysicsShapeMesh.mPositions;
- std::vector<LLVector3>& norm = d->mPhysicsShapeMesh.mNormals;
-
- for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
- {
- const LLVolumeFace& face = volume->getVolumeFace(i);
-
- for (S32 i = 0; i < face.mNumIndices; ++i)
- {
- U16 idx = face.mIndices[i];
-
- pos.push_back(LLVector3(face.mPositions[idx].getF32ptr()));
- norm.push_back(LLVector3(face.mNormals[idx].getF32ptr()));
- }
- }
- }
- }
-
- {
- LLMutexLock lock(mMutex);
- mDecompositionQ.push_back(d);
- }
- return MESH_OK;
+ LLSD physics_shape;
+
+ LLModel::Decomposition* d = new LLModel::Decomposition();
+ d->mMeshID = mesh_id;
+
+ if (data == NULL)
+ { //no data, no physics shape exists
+ d->mPhysicsShapeMesh.clear();
+ }
+ else
+ {
+ LLVolumeParams volume_params;
+ volume_params.setType(LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE);
+ volume_params.setSculptID(mesh_id, LL_SCULPT_TYPE_MESH);
+ LLPointer<LLVolume> volume = new LLVolume(volume_params,0);
+
+ if (volume->unpackVolumeFaces(data, data_size))
+ {
+ d->mPhysicsShapeMesh.clear();
+
+ std::vector<LLVector3>& pos = d->mPhysicsShapeMesh.mPositions;
+ std::vector<LLVector3>& norm = d->mPhysicsShapeMesh.mNormals;
+
+ for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
+ {
+ const LLVolumeFace& face = volume->getVolumeFace(i);
+
+ for (S32 i = 0; i < face.mNumIndices; ++i)
+ {
+ U16 idx = face.mIndices[i];
+
+ pos.push_back(LLVector3(face.mPositions[idx].getF32ptr()));
+ norm.push_back(LLVector3(face.mNormals[idx].getF32ptr()));
+ }
+ }
+ }
+ }
+
+ {
+ LLMutexLock lock(mMutex);
+ mDecompositionQ.push_back(d);
+ }
+ return MESH_OK;
}
LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, LLVector3& scale, bool upload_textures,
- bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position,
+ bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position,
const std::string & upload_url, bool do_upload,
- LLHandle<LLWholeModelFeeObserver> fee_observer,
- LLHandle<LLWholeModelUploadObserver> upload_observer)
+ LLHandle<LLWholeModelFeeObserver> fee_observer,
+ LLHandle<LLWholeModelUploadObserver> upload_observer)
: LLThread("mesh upload"),
- LLCore::HttpHandler(),
- mDiscarded(false),
- mDoUpload(do_upload),
- mWholeModelUploadURL(upload_url),
- mFeeObserverHandle(fee_observer),
- mUploadObserverHandle(upload_observer)
-{
- mInstanceList = data;
- mUploadTextures = upload_textures;
- mUploadSkin = upload_skin;
- mUploadJoints = upload_joints;
+ LLCore::HttpHandler(),
+ mDiscarded(false),
+ mDoUpload(do_upload),
+ mWholeModelUploadURL(upload_url),
+ mFeeObserverHandle(fee_observer),
+ mUploadObserverHandle(upload_observer)
+{
+ mInstanceList = data;
+ mUploadTextures = upload_textures;
+ mUploadSkin = upload_skin;
+ mUploadJoints = upload_joints;
mLockScaleIfJointPosition = lock_scale_if_joint_position;
- mMutex = new LLMutex();
- mPendingUploads = 0;
- mFinished = false;
- mOrigin = gAgent.getPositionAgent();
- mHost = gAgent.getRegionHost();
-
- mWholeModelFeeCapability = gAgent.getRegionCapability("NewFileAgentInventory");
+ mMutex = new LLMutex();
+ mPendingUploads = 0;
+ mFinished = false;
+ mOrigin = gAgent.getPositionAgent();
+ mHost = gAgent.getRegionHost();
+
+ mWholeModelFeeCapability = gAgent.getRegionCapability("NewFileAgentInventory");
- mOrigin += gAgent.getAtAxis() * scale.magVec();
+ mOrigin += gAgent.getAtAxis() * scale.magVec();
- mMeshUploadTimeOut = gSavedSettings.getS32("MeshUploadTimeOut");
+ mMeshUploadTimeOut = gSavedSettings.getS32("MeshUploadTimeOut");
- mHttpRequest = new LLCore::HttpRequest;
- mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
- mHttpOptions->setTransferTimeout(mMeshUploadTimeOut);
- mHttpOptions->setUseRetryAfter(gSavedSettings.getBOOL("MeshUseHttpRetryAfter"));
- mHttpOptions->setRetries(UPLOAD_RETRY_LIMIT);
- mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders);
- mHttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML);
- mHttpPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicy(LLAppCoreHttp::AP_UPLOADS);
+ mHttpRequest = new LLCore::HttpRequest;
+ mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+ mHttpOptions->setTransferTimeout(mMeshUploadTimeOut);
+ mHttpOptions->setUseRetryAfter(gSavedSettings.getBOOL("MeshUseHttpRetryAfter"));
+ mHttpOptions->setRetries(UPLOAD_RETRY_LIMIT);
+ mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders);
+ mHttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML);
+ mHttpPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicy(LLAppCoreHttp::AP_UPLOADS);
}
LLMeshUploadThread::~LLMeshUploadThread()
{
- delete mHttpRequest;
- mHttpRequest = NULL;
- delete mMutex;
- mMutex = NULL;
+ delete mHttpRequest;
+ mHttpRequest = NULL;
+ delete mMutex;
+ mMutex = NULL;
}
LLMeshUploadThread::DecompRequest::DecompRequest(LLModel* mdl, LLModel* base_model, LLMeshUploadThread* thread)
{
- mStage = "single_hull";
- mModel = mdl;
- mDecompID = &mdl->mDecompID;
- mBaseModel = base_model;
- mThread = thread;
-
- //copy out positions and indices
- assignData(mdl) ;
+ mStage = "single_hull";
+ mModel = mdl;
+ mDecompID = &mdl->mDecompID;
+ mBaseModel = base_model;
+ mThread = thread;
+
+ //copy out positions and indices
+ assignData(mdl) ;
- mThread->mFinalDecomp = this;
- mThread->mPhysicsComplete = false;
+ mThread->mFinalDecomp = this;
+ mThread->mPhysicsComplete = false;
}
void LLMeshUploadThread::DecompRequest::completed()
{
- if (mThread->mFinalDecomp == this)
- {
- mThread->mPhysicsComplete = true;
- }
+ if (mThread->mFinalDecomp == this)
+ {
+ mThread->mPhysicsComplete = true;
+ }
+
+ llassert(mHull.size() == 1);
- llassert(mHull.size() == 1);
-
- mThread->mHullMap[mBaseModel] = mHull[0];
+ mThread->mHullMap[mBaseModel] = mHull[0];
}
//called in the main thread.
void LLMeshUploadThread::preStart()
{
- //build map of LLModel refs to instances for callbacks
- for (instance_list::iterator iter = mInstanceList.begin(); iter != mInstanceList.end(); ++iter)
- {
- mInstance[iter->mModel].push_back(*iter);
- }
+ //build map of LLModel refs to instances for callbacks
+ for (instance_list::iterator iter = mInstanceList.begin(); iter != mInstanceList.end(); ++iter)
+ {
+ mInstance[iter->mModel].push_back(*iter);
+ }
}
void LLMeshUploadThread::discard()
{
- LLMutexLock lock(mMutex);
- mDiscarded = true;
+ LLMutexLock lock(mMutex);
+ mDiscarded = true;
}
bool LLMeshUploadThread::isDiscarded() const
{
- LLMutexLock lock(mMutex);
- return mDiscarded;
+ LLMutexLock lock(mMutex);
+ return mDiscarded;
}
void LLMeshUploadThread::run()
{
- if (mDoUpload)
- {
- doWholeModelUpload();
- }
- else
- {
- requestWholeModelFee();
- }
+ if (mDoUpload)
+ {
+ doWholeModelUpload();
+ }
+ else
+ {
+ requestWholeModelFee();
+ }
}
void dump_llsd_to_file(const LLSD& content, std::string filename)
{
- if (gSavedSettings.getBOOL("MeshUploadLogXML"))
- {
- llofstream of(filename.c_str());
- LLSDSerialize::toPrettyXML(content,of);
- }
+ if (gSavedSettings.getBOOL("MeshUploadLogXML"))
+ {
+ llofstream of(filename.c_str());
+ LLSDSerialize::toPrettyXML(content,of);
+ }
}
LLSD llsd_from_file(std::string filename)
{
- llifstream ifs(filename.c_str());
- LLSD result;
- LLSDSerialize::fromXML(result,ifs);
- return result;
+ llifstream ifs(filename.c_str());
+ LLSD result;
+ LLSDSerialize::fromXML(result,ifs);
+ return result;
}
void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
{
- LLSD result;
-
- LLSD res;
- result["folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_OBJECT);
- result["texture_folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE);
- result["asset_type"] = "mesh";
- result["inventory_type"] = "object";
- result["description"] = "(No Description)";
- result["next_owner_mask"] = LLSD::Integer(LLFloaterPerms::getNextOwnerPerms("Uploads"));
- result["group_mask"] = LLSD::Integer(LLFloaterPerms::getGroupPerms("Uploads"));
- result["everyone_mask"] = LLSD::Integer(LLFloaterPerms::getEveryonePerms("Uploads"));
-
- res["mesh_list"] = LLSD::emptyArray();
- res["texture_list"] = LLSD::emptyArray();
- res["instance_list"] = LLSD::emptyArray();
- S32 mesh_num = 0;
- S32 texture_num = 0;
-
- std::set<LLViewerTexture* > textures;
- std::map<LLViewerTexture*,S32> texture_index;
-
- std::map<LLModel*,S32> mesh_index;
- std::string model_name;
-
- S32 instance_num = 0;
-
- for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter)
- {
- LLMeshUploadData data;
- data.mBaseModel = iter->first;
-
- if (data.mBaseModel->mSubmodelID)
- {
- // These are handled below to insure correct parenting order on creation
- // due to map walking being based on model address (aka random)
- continue;
- }
-
- LLModelInstance& first_instance = *(iter->second.begin());
- for (S32 i = 0; i < 5; i++)
- {
- data.mModel[i] = first_instance.mLOD[i];
- }
-
- if (mesh_index.find(data.mBaseModel) == mesh_index.end())
- {
- // Have not seen this model before - create a new mesh_list entry for it.
- if (model_name.empty())
- {
- model_name = data.mBaseModel->getName();
- }
-
- std::stringstream ostr;
-
- LLModel::Decomposition& decomp =
- data.mModel[LLModel::LOD_PHYSICS].notNull() ?
- data.mModel[LLModel::LOD_PHYSICS]->mPhysics :
- data.mBaseModel->mPhysics;
-
- decomp.mBaseHull = mHullMap[data.mBaseModel];
-
- LLSD mesh_header = LLModel::writeModel(
- ostr,
- data.mModel[LLModel::LOD_PHYSICS],
- data.mModel[LLModel::LOD_HIGH],
- data.mModel[LLModel::LOD_MEDIUM],
- data.mModel[LLModel::LOD_LOW],
- data.mModel[LLModel::LOD_IMPOSTOR],
- decomp,
- mUploadSkin,
- mUploadJoints,
+ LLSD result;
+
+ LLSD res;
+ result["folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_OBJECT);
+ result["texture_folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE);
+ result["asset_type"] = "mesh";
+ result["inventory_type"] = "object";
+ result["description"] = "(No Description)";
+ result["next_owner_mask"] = LLSD::Integer(LLFloaterPerms::getNextOwnerPerms("Uploads"));
+ result["group_mask"] = LLSD::Integer(LLFloaterPerms::getGroupPerms("Uploads"));
+ result["everyone_mask"] = LLSD::Integer(LLFloaterPerms::getEveryonePerms("Uploads"));
+
+ res["mesh_list"] = LLSD::emptyArray();
+ res["texture_list"] = LLSD::emptyArray();
+ res["instance_list"] = LLSD::emptyArray();
+ S32 mesh_num = 0;
+ S32 texture_num = 0;
+
+ std::set<LLViewerTexture* > textures;
+ std::map<LLViewerTexture*,S32> texture_index;
+
+ std::map<LLModel*,S32> mesh_index;
+ std::string model_name;
+
+ S32 instance_num = 0;
+
+ for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter)
+ {
+ LLMeshUploadData data;
+ data.mBaseModel = iter->first;
+
+ if (data.mBaseModel->mSubmodelID)
+ {
+ // These are handled below to insure correct parenting order on creation
+ // due to map walking being based on model address (aka random)
+ continue;
+ }
+
+ LLModelInstance& first_instance = *(iter->second.begin());
+ for (S32 i = 0; i < 5; i++)
+ {
+ data.mModel[i] = first_instance.mLOD[i];
+ }
+
+ if (mesh_index.find(data.mBaseModel) == mesh_index.end())
+ {
+ // Have not seen this model before - create a new mesh_list entry for it.
+ if (model_name.empty())
+ {
+ model_name = data.mBaseModel->getName();
+ }
+
+ std::stringstream ostr;
+
+ LLModel::Decomposition& decomp =
+ data.mModel[LLModel::LOD_PHYSICS].notNull() ?
+ data.mModel[LLModel::LOD_PHYSICS]->mPhysics :
+ data.mBaseModel->mPhysics;
+
+ decomp.mBaseHull = mHullMap[data.mBaseModel];
+
+ LLSD mesh_header = LLModel::writeModel(
+ ostr,
+ data.mModel[LLModel::LOD_PHYSICS],
+ data.mModel[LLModel::LOD_HIGH],
+ data.mModel[LLModel::LOD_MEDIUM],
+ data.mModel[LLModel::LOD_LOW],
+ data.mModel[LLModel::LOD_IMPOSTOR],
+ decomp,
+ mUploadSkin,
+ mUploadJoints,
mLockScaleIfJointPosition,
- FALSE,
- FALSE,
- data.mBaseModel->mSubmodelID);
-
- data.mAssetData = ostr.str();
- std::string str = ostr.str();
-
- res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(),str.end());
- mesh_index[data.mBaseModel] = mesh_num;
- mesh_num++;
- }
-
- // For all instances that use this model
- for (instance_list::iterator instance_iter = iter->second.begin();
- instance_iter != iter->second.end();
- ++instance_iter)
- {
-
- LLModelInstance& instance = *instance_iter;
-
- LLSD instance_entry;
-
- for (S32 i = 0; i < 5; i++)
- {
- data.mModel[i] = instance.mLOD[i];
- }
-
- LLVector3 pos, scale;
- LLQuaternion rot;
- LLMatrix4 transformation = instance.mTransform;
- decomposeMeshMatrix(transformation,pos,rot,scale);
- instance_entry["position"] = ll_sd_from_vector3(pos);
- instance_entry["rotation"] = ll_sd_from_quaternion(rot);
- instance_entry["scale"] = ll_sd_from_vector3(scale);
-
- instance_entry["material"] = LL_MCODE_WOOD;
- instance_entry["physics_shape_type"] = data.mModel[LLModel::LOD_PHYSICS].notNull() ? (U8)(LLViewerObject::PHYSICS_SHAPE_PRIM) : (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL);
- instance_entry["mesh"] = mesh_index[data.mBaseModel];
- instance_entry["mesh_name"] = instance.mLabel;
-
- instance_entry["face_list"] = LLSD::emptyArray();
-
- // We want to be able to allow more than 8 materials...
- //
- S32 end = llmin((S32)instance.mMaterial.size(), instance.mModel->getNumVolumeFaces()) ;
-
- for (S32 face_num = 0; face_num < end; face_num++)
- {
- LLImportMaterial& material = instance.mMaterial[data.mBaseModel->mMaterialList[face_num]];
- LLSD face_entry = LLSD::emptyMap();
-
- LLViewerFetchedTexture *texture = NULL;
-
- if (material.mDiffuseMapFilename.size())
- {
- texture = FindViewerTexture(material);
- }
-
- if ((texture != NULL) &&
- (textures.find(texture) == textures.end()))
- {
- textures.insert(texture);
- }
-
- std::stringstream texture_str;
- if (texture != NULL && include_textures && mUploadTextures)
- {
- if(texture->hasSavedRawImage())
- {
- LLPointer<LLImageJ2C> upload_file =
- LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage());
-
- if (!upload_file.isNull() && upload_file->getDataSize())
- {
- texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
- }
- }
- }
-
- if (texture != NULL &&
- mUploadTextures &&
- texture_index.find(texture) == texture_index.end())
- {
- texture_index[texture] = texture_num;
- std::string str = texture_str.str();
- res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end());
- texture_num++;
- }
-
- // Subset of TextureEntry fields.
- if (texture != NULL && mUploadTextures)
- {
- face_entry["image"] = texture_index[texture];
- face_entry["scales"] = 1.0;
- face_entry["scalet"] = 1.0;
- face_entry["offsets"] = 0.0;
- face_entry["offsett"] = 0.0;
- face_entry["imagerot"] = 0.0;
- }
- face_entry["diffuse_color"] = ll_sd_from_color4(material.mDiffuseColor);
- face_entry["fullbright"] = material.mFullbright;
- instance_entry["face_list"][face_num] = face_entry;
- }
-
- res["instance_list"][instance_num] = instance_entry;
- instance_num++;
- }
- }
-
- for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter)
- {
- LLMeshUploadData data;
- data.mBaseModel = iter->first;
-
- if (!data.mBaseModel->mSubmodelID)
- {
- // These were handled above already...
- //
- continue;
- }
-
- LLModelInstance& first_instance = *(iter->second.begin());
- for (S32 i = 0; i < 5; i++)
- {
- data.mModel[i] = first_instance.mLOD[i];
- }
-
- if (mesh_index.find(data.mBaseModel) == mesh_index.end())
- {
- // Have not seen this model before - create a new mesh_list entry for it.
- if (model_name.empty())
- {
- model_name = data.mBaseModel->getName();
- }
-
- std::stringstream ostr;
-
- LLModel::Decomposition& decomp =
- data.mModel[LLModel::LOD_PHYSICS].notNull() ?
- data.mModel[LLModel::LOD_PHYSICS]->mPhysics :
- data.mBaseModel->mPhysics;
-
- decomp.mBaseHull = mHullMap[data.mBaseModel];
-
- LLSD mesh_header = LLModel::writeModel(
- ostr,
- data.mModel[LLModel::LOD_PHYSICS],
- data.mModel[LLModel::LOD_HIGH],
- data.mModel[LLModel::LOD_MEDIUM],
- data.mModel[LLModel::LOD_LOW],
- data.mModel[LLModel::LOD_IMPOSTOR],
- decomp,
- mUploadSkin,
- mUploadJoints,
+ FALSE,
+ FALSE,
+ data.mBaseModel->mSubmodelID);
+
+ data.mAssetData = ostr.str();
+ std::string str = ostr.str();
+
+ res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(),str.end());
+ mesh_index[data.mBaseModel] = mesh_num;
+ mesh_num++;
+ }
+
+ // For all instances that use this model
+ for (instance_list::iterator instance_iter = iter->second.begin();
+ instance_iter != iter->second.end();
+ ++instance_iter)
+ {
+
+ LLModelInstance& instance = *instance_iter;
+
+ LLSD instance_entry;
+
+ for (S32 i = 0; i < 5; i++)
+ {
+ data.mModel[i] = instance.mLOD[i];
+ }
+
+ LLVector3 pos, scale;
+ LLQuaternion rot;
+ LLMatrix4 transformation = instance.mTransform;
+ decomposeMeshMatrix(transformation,pos,rot,scale);
+ instance_entry["position"] = ll_sd_from_vector3(pos);
+ instance_entry["rotation"] = ll_sd_from_quaternion(rot);
+ instance_entry["scale"] = ll_sd_from_vector3(scale);
+
+ instance_entry["material"] = LL_MCODE_WOOD;
+ instance_entry["physics_shape_type"] = data.mModel[LLModel::LOD_PHYSICS].notNull() ? (U8)(LLViewerObject::PHYSICS_SHAPE_PRIM) : (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL);
+ instance_entry["mesh"] = mesh_index[data.mBaseModel];
+ instance_entry["mesh_name"] = instance.mLabel;
+
+ instance_entry["face_list"] = LLSD::emptyArray();
+
+ // We want to be able to allow more than 8 materials...
+ //
+ S32 end = llmin((S32)instance.mMaterial.size(), instance.mModel->getNumVolumeFaces()) ;
+
+ for (S32 face_num = 0; face_num < end; face_num++)
+ {
+ LLImportMaterial& material = instance.mMaterial[data.mBaseModel->mMaterialList[face_num]];
+ LLSD face_entry = LLSD::emptyMap();
+
+ LLViewerFetchedTexture *texture = NULL;
+
+ if (material.mDiffuseMapFilename.size())
+ {
+ texture = FindViewerTexture(material);
+ }
+
+ if ((texture != NULL) &&
+ (textures.find(texture) == textures.end()))
+ {
+ textures.insert(texture);
+ }
+
+ std::stringstream texture_str;
+ if (texture != NULL && include_textures && mUploadTextures)
+ {
+ if(texture->hasSavedRawImage())
+ {
+ LLPointer<LLImageJ2C> upload_file =
+ LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage());
+
+ if (!upload_file.isNull() && upload_file->getDataSize())
+ {
+ texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
+ }
+ }
+ }
+
+ if (texture != NULL &&
+ mUploadTextures &&
+ texture_index.find(texture) == texture_index.end())
+ {
+ texture_index[texture] = texture_num;
+ std::string str = texture_str.str();
+ res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end());
+ texture_num++;
+ }
+
+ // Subset of TextureEntry fields.
+ if (texture != NULL && mUploadTextures)
+ {
+ face_entry["image"] = texture_index[texture];
+ face_entry["scales"] = 1.0;
+ face_entry["scalet"] = 1.0;
+ face_entry["offsets"] = 0.0;
+ face_entry["offsett"] = 0.0;
+ face_entry["imagerot"] = 0.0;
+ }
+ face_entry["diffuse_color"] = ll_sd_from_color4(material.mDiffuseColor);
+ face_entry["fullbright"] = material.mFullbright;
+ instance_entry["face_list"][face_num] = face_entry;
+ }
+
+ res["instance_list"][instance_num] = instance_entry;
+ instance_num++;
+ }
+ }
+
+ for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter)
+ {
+ LLMeshUploadData data;
+ data.mBaseModel = iter->first;
+
+ if (!data.mBaseModel->mSubmodelID)
+ {
+ // These were handled above already...
+ //
+ continue;
+ }
+
+ LLModelInstance& first_instance = *(iter->second.begin());
+ for (S32 i = 0; i < 5; i++)
+ {
+ data.mModel[i] = first_instance.mLOD[i];
+ }
+
+ if (mesh_index.find(data.mBaseModel) == mesh_index.end())
+ {
+ // Have not seen this model before - create a new mesh_list entry for it.
+ if (model_name.empty())
+ {
+ model_name = data.mBaseModel->getName();
+ }
+
+ std::stringstream ostr;
+
+ LLModel::Decomposition& decomp =
+ data.mModel[LLModel::LOD_PHYSICS].notNull() ?
+ data.mModel[LLModel::LOD_PHYSICS]->mPhysics :
+ data.mBaseModel->mPhysics;
+
+ decomp.mBaseHull = mHullMap[data.mBaseModel];
+
+ LLSD mesh_header = LLModel::writeModel(
+ ostr,
+ data.mModel[LLModel::LOD_PHYSICS],
+ data.mModel[LLModel::LOD_HIGH],
+ data.mModel[LLModel::LOD_MEDIUM],
+ data.mModel[LLModel::LOD_LOW],
+ data.mModel[LLModel::LOD_IMPOSTOR],
+ decomp,
+ mUploadSkin,
+ mUploadJoints,
mLockScaleIfJointPosition,
- FALSE,
- FALSE,
- data.mBaseModel->mSubmodelID);
-
- data.mAssetData = ostr.str();
- std::string str = ostr.str();
-
- res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(),str.end());
- mesh_index[data.mBaseModel] = mesh_num;
- mesh_num++;
- }
-
- // For all instances that use this model
- for (instance_list::iterator instance_iter = iter->second.begin();
- instance_iter != iter->second.end();
- ++instance_iter)
- {
-
- LLModelInstance& instance = *instance_iter;
-
- LLSD instance_entry;
-
- for (S32 i = 0; i < 5; i++)
- {
- data.mModel[i] = instance.mLOD[i];
- }
-
- LLVector3 pos, scale;
- LLQuaternion rot;
- LLMatrix4 transformation = instance.mTransform;
- decomposeMeshMatrix(transformation,pos,rot,scale);
- instance_entry["position"] = ll_sd_from_vector3(pos);
- instance_entry["rotation"] = ll_sd_from_quaternion(rot);
- instance_entry["scale"] = ll_sd_from_vector3(scale);
-
- instance_entry["material"] = LL_MCODE_WOOD;
- instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_NONE);
- instance_entry["mesh"] = mesh_index[data.mBaseModel];
-
- instance_entry["face_list"] = LLSD::emptyArray();
-
- // We want to be able to allow more than 8 materials...
- //
- S32 end = llmin((S32)instance.mMaterial.size(), instance.mModel->getNumVolumeFaces()) ;
-
- for (S32 face_num = 0; face_num < end; face_num++)
- {
- LLImportMaterial& material = instance.mMaterial[data.mBaseModel->mMaterialList[face_num]];
- LLSD face_entry = LLSD::emptyMap();
-
- LLViewerFetchedTexture *texture = NULL;
-
- if (material.mDiffuseMapFilename.size())
- {
- texture = FindViewerTexture(material);
- }
-
- if ((texture != NULL) &&
- (textures.find(texture) == textures.end()))
- {
- textures.insert(texture);
- }
-
- std::stringstream texture_str;
- if (texture != NULL && include_textures && mUploadTextures)
- {
- if(texture->hasSavedRawImage())
- {
- LLPointer<LLImageJ2C> upload_file =
- LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage());
-
- if (!upload_file.isNull() && upload_file->getDataSize())
- {
- texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
- }
- }
- }
-
- if (texture != NULL &&
- mUploadTextures &&
- texture_index.find(texture) == texture_index.end())
- {
- texture_index[texture] = texture_num;
- std::string str = texture_str.str();
- res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end());
- texture_num++;
- }
-
- // Subset of TextureEntry fields.
- if (texture != NULL && mUploadTextures)
- {
- face_entry["image"] = texture_index[texture];
- face_entry["scales"] = 1.0;
- face_entry["scalet"] = 1.0;
- face_entry["offsets"] = 0.0;
- face_entry["offsett"] = 0.0;
- face_entry["imagerot"] = 0.0;
- }
- face_entry["diffuse_color"] = ll_sd_from_color4(material.mDiffuseColor);
- face_entry["fullbright"] = material.mFullbright;
- instance_entry["face_list"][face_num] = face_entry;
- }
-
- res["instance_list"][instance_num] = instance_entry;
- instance_num++;
- }
- }
-
- if (model_name.empty()) model_name = "mesh model";
- result["name"] = model_name;
- res["metric"] = "MUT_Unspecified";
- result["asset_resources"] = res;
- dump_llsd_to_file(result,make_dump_name("whole_model_",dump_num));
-
- dest = result;
+ FALSE,
+ FALSE,
+ data.mBaseModel->mSubmodelID);
+
+ data.mAssetData = ostr.str();
+ std::string str = ostr.str();
+
+ res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(),str.end());
+ mesh_index[data.mBaseModel] = mesh_num;
+ mesh_num++;
+ }
+
+ // For all instances that use this model
+ for (instance_list::iterator instance_iter = iter->second.begin();
+ instance_iter != iter->second.end();
+ ++instance_iter)
+ {
+
+ LLModelInstance& instance = *instance_iter;
+
+ LLSD instance_entry;
+
+ for (S32 i = 0; i < 5; i++)
+ {
+ data.mModel[i] = instance.mLOD[i];
+ }
+
+ LLVector3 pos, scale;
+ LLQuaternion rot;
+ LLMatrix4 transformation = instance.mTransform;
+ decomposeMeshMatrix(transformation,pos,rot,scale);
+ instance_entry["position"] = ll_sd_from_vector3(pos);
+ instance_entry["rotation"] = ll_sd_from_quaternion(rot);
+ instance_entry["scale"] = ll_sd_from_vector3(scale);
+
+ instance_entry["material"] = LL_MCODE_WOOD;
+ instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_NONE);
+ instance_entry["mesh"] = mesh_index[data.mBaseModel];
+
+ instance_entry["face_list"] = LLSD::emptyArray();
+
+ // We want to be able to allow more than 8 materials...
+ //
+ S32 end = llmin((S32)instance.mMaterial.size(), instance.mModel->getNumVolumeFaces()) ;
+
+ for (S32 face_num = 0; face_num < end; face_num++)
+ {
+ LLImportMaterial& material = instance.mMaterial[data.mBaseModel->mMaterialList[face_num]];
+ LLSD face_entry = LLSD::emptyMap();
+
+ LLViewerFetchedTexture *texture = NULL;
+
+ if (material.mDiffuseMapFilename.size())
+ {
+ texture = FindViewerTexture(material);
+ }
+
+ if ((texture != NULL) &&
+ (textures.find(texture) == textures.end()))
+ {
+ textures.insert(texture);
+ }
+
+ std::stringstream texture_str;
+ if (texture != NULL && include_textures && mUploadTextures)
+ {
+ if(texture->hasSavedRawImage())
+ {
+ LLPointer<LLImageJ2C> upload_file =
+ LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage());
+
+ if (!upload_file.isNull() && upload_file->getDataSize())
+ {
+ texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
+ }
+ }
+ }
+
+ if (texture != NULL &&
+ mUploadTextures &&
+ texture_index.find(texture) == texture_index.end())
+ {
+ texture_index[texture] = texture_num;
+ std::string str = texture_str.str();
+ res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end());
+ texture_num++;
+ }
+
+ // Subset of TextureEntry fields.
+ if (texture != NULL && mUploadTextures)
+ {
+ face_entry["image"] = texture_index[texture];
+ face_entry["scales"] = 1.0;
+ face_entry["scalet"] = 1.0;
+ face_entry["offsets"] = 0.0;
+ face_entry["offsett"] = 0.0;
+ face_entry["imagerot"] = 0.0;
+ }
+ face_entry["diffuse_color"] = ll_sd_from_color4(material.mDiffuseColor);
+ face_entry["fullbright"] = material.mFullbright;
+ instance_entry["face_list"][face_num] = face_entry;
+ }
+
+ res["instance_list"][instance_num] = instance_entry;
+ instance_num++;
+ }
+ }
+
+ if (model_name.empty()) model_name = "mesh model";
+ result["name"] = model_name;
+ res["metric"] = "MUT_Unspecified";
+ result["asset_resources"] = res;
+ dump_llsd_to_file(result,make_dump_name("whole_model_",dump_num));
+
+ dest = result;
}
void LLMeshUploadThread::generateHulls()
{
- bool has_valid_requests = false ;
-
- for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter)
- {
- LLMeshUploadData data;
- data.mBaseModel = iter->first;
-
- LLModelInstance& instance = *(iter->second.begin());
-
- for (S32 i = 0; i < 5; i++)
- {
- data.mModel[i] = instance.mLOD[i];
- }
-
- //queue up models for hull generation
- LLModel* physics = NULL;
-
- if (data.mModel[LLModel::LOD_PHYSICS].notNull())
- {
- physics = data.mModel[LLModel::LOD_PHYSICS];
- }
- else if (data.mModel[LLModel::LOD_LOW].notNull())
- {
- physics = data.mModel[LLModel::LOD_LOW];
- }
- else if (data.mModel[LLModel::LOD_MEDIUM].notNull())
- {
- physics = data.mModel[LLModel::LOD_MEDIUM];
- }
- else
- {
- physics = data.mModel[LLModel::LOD_HIGH];
- }
-
- llassert(physics != NULL);
-
- DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this);
- if(request->isValid())
- {
- gMeshRepo.mDecompThread->submitRequest(request);
- has_valid_requests = true ;
- }
- }
-
- if (has_valid_requests)
- {
- // *NOTE: Interesting livelock condition on shutdown. If there
- // is an upload request in generateHulls() when shutdown starts,
- // the main thread isn't available to manage communication between
- // the decomposition thread and the upload thread and this loop
- // wouldn't complete in turn stalling the main thread. The check
- // on isDiscarded() prevents that.
- while (! mPhysicsComplete && ! isDiscarded())
- {
- apr_sleep(100);
- }
- }
+ bool has_valid_requests = false ;
+
+ for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter)
+ {
+ LLMeshUploadData data;
+ data.mBaseModel = iter->first;
+
+ LLModelInstance& instance = *(iter->second.begin());
+
+ for (S32 i = 0; i < 5; i++)
+ {
+ data.mModel[i] = instance.mLOD[i];
+ }
+
+ //queue up models for hull generation
+ LLModel* physics = NULL;
+
+ if (data.mModel[LLModel::LOD_PHYSICS].notNull())
+ {
+ physics = data.mModel[LLModel::LOD_PHYSICS];
+ }
+ else if (data.mModel[LLModel::LOD_LOW].notNull())
+ {
+ physics = data.mModel[LLModel::LOD_LOW];
+ }
+ else if (data.mModel[LLModel::LOD_MEDIUM].notNull())
+ {
+ physics = data.mModel[LLModel::LOD_MEDIUM];
+ }
+ else
+ {
+ physics = data.mModel[LLModel::LOD_HIGH];
+ }
+
+ llassert(physics != NULL);
+
+ DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this);
+ if(request->isValid())
+ {
+ gMeshRepo.mDecompThread->submitRequest(request);
+ has_valid_requests = true ;
+ }
+ }
+
+ if (has_valid_requests)
+ {
+ // *NOTE: Interesting livelock condition on shutdown. If there
+ // is an upload request in generateHulls() when shutdown starts,
+ // the main thread isn't available to manage communication between
+ // the decomposition thread and the upload thread and this loop
+ // wouldn't complete in turn stalling the main thread. The check
+ // on isDiscarded() prevents that.
+ while (! mPhysicsComplete && ! isDiscarded())
+ {
+ apr_sleep(100);
+ }
+ }
}
void LLMeshUploadThread::doWholeModelUpload()
{
- LL_DEBUGS(LOG_MESH) << "Starting model upload. Instances: " << mInstance.size() << LL_ENDL;
-
- if (mWholeModelUploadURL.empty())
- {
- LL_WARNS(LOG_MESH) << "Missing mesh upload capability, unable to upload, fee request failed."
- << LL_ENDL;
- }
- else
- {
- generateHulls();
- LL_DEBUGS(LOG_MESH) << "Hull generation completed." << LL_ENDL;
-
- mModelData = LLSD::emptyMap();
- wholeModelToLLSD(mModelData, true);
- LLSD body = mModelData["asset_resources"];
-
- dump_llsd_to_file(body, make_dump_name("whole_model_body_", dump_num));
-
- LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
- mHttpPolicyClass,
- mWholeModelUploadURL,
- body,
- mHttpOptions,
- mHttpHeaders,
+ LL_DEBUGS(LOG_MESH) << "Starting model upload. Instances: " << mInstance.size() << LL_ENDL;
+
+ if (mWholeModelUploadURL.empty())
+ {
+ LL_WARNS(LOG_MESH) << "Missing mesh upload capability, unable to upload, fee request failed."
+ << LL_ENDL;
+ }
+ else
+ {
+ generateHulls();
+ LL_DEBUGS(LOG_MESH) << "Hull generation completed." << LL_ENDL;
+
+ mModelData = LLSD::emptyMap();
+ wholeModelToLLSD(mModelData, true);
+ LLSD body = mModelData["asset_resources"];
+
+ dump_llsd_to_file(body, make_dump_name("whole_model_body_", dump_num));
+
+ LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
+ mHttpPolicyClass,
+ mWholeModelUploadURL,
+ body,
+ mHttpOptions,
+ mHttpHeaders,
LLCore::HttpHandler::ptr_t(this, &NoOpDeletor));
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- mHttpStatus = mHttpRequest->getStatus();
-
- LL_WARNS(LOG_MESH) << "Couldn't issue request for full model upload. Reason: " << mHttpStatus.toString()
- << " (" << mHttpStatus.toTerseString() << ")"
- << LL_ENDL;
- }
- else
- {
- U32 sleep_time(10);
-
- LL_DEBUGS(LOG_MESH) << "POST request issued." << LL_ENDL;
-
- mHttpRequest->update(0);
- while (! LLApp::isExiting() && ! finished() && ! isDiscarded())
- {
- ms_sleep(sleep_time);
- sleep_time = llmin(250U, sleep_time + sleep_time);
- mHttpRequest->update(0);
- }
-
- if (isDiscarded())
- {
- LL_DEBUGS(LOG_MESH) << "Mesh upload operation discarded." << LL_ENDL;
- }
- else
- {
- LL_DEBUGS(LOG_MESH) << "Mesh upload operation completed." << LL_ENDL;
- }
- }
- }
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ mHttpStatus = mHttpRequest->getStatus();
+
+ LL_WARNS(LOG_MESH) << "Couldn't issue request for full model upload. Reason: " << mHttpStatus.toString()
+ << " (" << mHttpStatus.toTerseString() << ")"
+ << LL_ENDL;
+ }
+ else
+ {
+ U32 sleep_time(10);
+
+ LL_DEBUGS(LOG_MESH) << "POST request issued." << LL_ENDL;
+
+ mHttpRequest->update(0);
+ while (! LLApp::isExiting() && ! finished() && ! isDiscarded())
+ {
+ ms_sleep(sleep_time);
+ sleep_time = llmin(250U, sleep_time + sleep_time);
+ mHttpRequest->update(0);
+ }
+
+ if (isDiscarded())
+ {
+ LL_DEBUGS(LOG_MESH) << "Mesh upload operation discarded." << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS(LOG_MESH) << "Mesh upload operation completed." << LL_ENDL;
+ }
+ }
+ }
}
void LLMeshUploadThread::requestWholeModelFee()
{
- dump_num++;
+ dump_num++;
- generateHulls();
+ generateHulls();
- mModelData = LLSD::emptyMap();
- wholeModelToLLSD(mModelData, false);
- dump_llsd_to_file(mModelData, make_dump_name("whole_model_fee_request_", dump_num));
- LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
- mHttpPolicyClass,
- mWholeModelFeeCapability,
- mModelData,
- mHttpOptions,
- mHttpHeaders,
+ mModelData = LLSD::emptyMap();
+ wholeModelToLLSD(mModelData, false);
+ dump_llsd_to_file(mModelData, make_dump_name("whole_model_fee_request_", dump_num));
+ LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
+ mHttpPolicyClass,
+ mWholeModelFeeCapability,
+ mModelData,
+ mHttpOptions,
+ mHttpHeaders,
LLCore::HttpHandler::ptr_t(this, &NoOpDeletor));
- if (LLCORE_HTTP_HANDLE_INVALID == handle)
- {
- mHttpStatus = mHttpRequest->getStatus();
-
- LL_WARNS(LOG_MESH) << "Couldn't issue request for model fee. Reason: " << mHttpStatus.toString()
- << " (" << mHttpStatus.toTerseString() << ")"
- << LL_ENDL;
- }
- else
- {
- U32 sleep_time(10);
-
- mHttpRequest->update(0);
- while (! LLApp::isExiting() && ! finished() && ! isDiscarded())
- {
- ms_sleep(sleep_time);
- sleep_time = llmin(250U, sleep_time + sleep_time);
- mHttpRequest->update(0);
- }
- if (isDiscarded())
- {
- LL_DEBUGS(LOG_MESH) << "Mesh fee query operation discarded." << LL_ENDL;
- }
- }
+ if (LLCORE_HTTP_HANDLE_INVALID == handle)
+ {
+ mHttpStatus = mHttpRequest->getStatus();
+
+ LL_WARNS(LOG_MESH) << "Couldn't issue request for model fee. Reason: " << mHttpStatus.toString()
+ << " (" << mHttpStatus.toTerseString() << ")"
+ << LL_ENDL;
+ }
+ else
+ {
+ U32 sleep_time(10);
+
+ mHttpRequest->update(0);
+ while (! LLApp::isExiting() && ! finished() && ! isDiscarded())
+ {
+ ms_sleep(sleep_time);
+ sleep_time = llmin(250U, sleep_time + sleep_time);
+ mHttpRequest->update(0);
+ }
+ if (isDiscarded())
+ {
+ LL_DEBUGS(LOG_MESH) << "Mesh fee query operation discarded." << LL_ENDL;
+ }
+ }
}
// Does completion duty for both fee queries and actual uploads.
void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response)
{
- // QA/Devel: 0x2 to enable fake error import on upload, 0x1 on fee check
- const S32 fake_error(gSavedSettings.getS32("MeshUploadFakeErrors") & (mDoUpload ? 0xa : 0x5));
- LLCore::HttpStatus status(response->getStatus());
- if (fake_error)
- {
- status = (fake_error & 0x0c) ? LLCore::HttpStatus(500) : LLCore::HttpStatus(200);
- }
- std::string reason(status.toString());
- LLSD body;
-
- mFinished = true;
-
- if (mDoUpload)
- {
- // model upload case
- LLWholeModelUploadObserver * observer(mUploadObserverHandle.get());
-
- if (! status)
- {
- LL_WARNS(LOG_MESH) << "Upload failed. Reason: " << reason
- << " (" << status.toTerseString() << ")"
- << LL_ENDL;
-
- // Build a fake body for the alert generator
- body["error"] = LLSD::emptyMap();
- body["error"]["message"] = reason;
- body["error"]["identifier"] = "NetworkError"; // from asset-upload/upload_util.py
- log_upload_error(status, body, "upload", mModelData["name"].asString());
-
- if (observer)
- {
- doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadFailure, observer));
- }
- }
- else
- {
- if (fake_error & 0x2)
- {
- body = llsd_from_file("fake_upload_error.xml");
- }
- else
- {
- // *TODO: handle error in conversion process
- LLCoreHttpUtil::responseToLLSD(response, true, body);
- }
- dump_llsd_to_file(body, make_dump_name("whole_model_upload_response_", dump_num));
-
- if (body["state"].asString() == "complete")
- {
- // requested "mesh" asset type isn't actually the type
- // of the resultant object, fix it up here.
- mModelData["asset_type"] = "object";
- gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mModelData, body));
-
- if (observer)
- {
- doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadSuccess, observer));
- }
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Upload failed. Not in expected 'complete' state." << LL_ENDL;
- log_upload_error(status, body, "upload", mModelData["name"].asString());
-
- if (observer)
- {
- doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadFailure, observer));
- }
- }
- }
- }
- else
- {
- // model fee case
- LLWholeModelFeeObserver* observer(mFeeObserverHandle.get());
- mWholeModelUploadURL.clear();
-
- if (! status)
- {
- LL_WARNS(LOG_MESH) << "Fee request failed. Reason: " << reason
- << " (" << status.toTerseString() << ")"
- << LL_ENDL;
-
- // Build a fake body for the alert generator
- body["error"] = LLSD::emptyMap();
- body["error"]["message"] = reason;
- body["error"]["identifier"] = "NetworkError"; // from asset-upload/upload_util.py
- log_upload_error(status, body, "fee", mModelData["name"].asString());
-
- if (observer)
- {
- observer->setModelPhysicsFeeErrorStatus(status.toULong(), reason, body["error"]);
- }
- }
- else
- {
- if (fake_error & 0x1)
- {
- body = llsd_from_file("fake_upload_error.xml");
- }
- else
- {
- // *TODO: handle error in conversion process
- LLCoreHttpUtil::responseToLLSD(response, true, body);
- }
- dump_llsd_to_file(body, make_dump_name("whole_model_fee_response_", dump_num));
-
- if (body["state"].asString() == "upload")
- {
- mWholeModelUploadURL = body["uploader"].asString();
-
- if (observer)
- {
- body["data"]["upload_price"] = body["upload_price"];
- observer->onModelPhysicsFeeReceived(body["data"], mWholeModelUploadURL);
- }
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Fee request failed. Not in expected 'upload' state." << LL_ENDL;
- log_upload_error(status, body, "fee", mModelData["name"].asString());
-
- if (observer)
- {
- observer->setModelPhysicsFeeErrorStatus(status.toULong(), reason, body["error"]);
- }
- }
- }
- }
+ // QA/Devel: 0x2 to enable fake error import on upload, 0x1 on fee check
+ const S32 fake_error(gSavedSettings.getS32("MeshUploadFakeErrors") & (mDoUpload ? 0xa : 0x5));
+ LLCore::HttpStatus status(response->getStatus());
+ if (fake_error)
+ {
+ status = (fake_error & 0x0c) ? LLCore::HttpStatus(500) : LLCore::HttpStatus(200);
+ }
+ std::string reason(status.toString());
+ LLSD body;
+
+ mFinished = true;
+
+ if (mDoUpload)
+ {
+ // model upload case
+ LLWholeModelUploadObserver * observer(mUploadObserverHandle.get());
+
+ if (! status)
+ {
+ LL_WARNS(LOG_MESH) << "Upload failed. Reason: " << reason
+ << " (" << status.toTerseString() << ")"
+ << LL_ENDL;
+
+ // Build a fake body for the alert generator
+ body["error"] = LLSD::emptyMap();
+ body["error"]["message"] = reason;
+ body["error"]["identifier"] = "NetworkError"; // from asset-upload/upload_util.py
+ log_upload_error(status, body, "upload", mModelData["name"].asString());
+
+ if (observer)
+ {
+ doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadFailure, observer));
+ }
+ }
+ else
+ {
+ if (fake_error & 0x2)
+ {
+ body = llsd_from_file("fake_upload_error.xml");
+ }
+ else
+ {
+ // *TODO: handle error in conversion process
+ LLCoreHttpUtil::responseToLLSD(response, true, body);
+ }
+ dump_llsd_to_file(body, make_dump_name("whole_model_upload_response_", dump_num));
+
+ if (body["state"].asString() == "complete")
+ {
+ // requested "mesh" asset type isn't actually the type
+ // of the resultant object, fix it up here.
+ mModelData["asset_type"] = "object";
+ gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mModelData, body));
+
+ if (observer)
+ {
+ doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadSuccess, observer));
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Upload failed. Not in expected 'complete' state." << LL_ENDL;
+ log_upload_error(status, body, "upload", mModelData["name"].asString());
+
+ if (observer)
+ {
+ doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadFailure, observer));
+ }
+ }
+ }
+ }
+ else
+ {
+ // model fee case
+ LLWholeModelFeeObserver* observer(mFeeObserverHandle.get());
+ mWholeModelUploadURL.clear();
+
+ if (! status)
+ {
+ LL_WARNS(LOG_MESH) << "Fee request failed. Reason: " << reason
+ << " (" << status.toTerseString() << ")"
+ << LL_ENDL;
+
+ // Build a fake body for the alert generator
+ body["error"] = LLSD::emptyMap();
+ body["error"]["message"] = reason;
+ body["error"]["identifier"] = "NetworkError"; // from asset-upload/upload_util.py
+ log_upload_error(status, body, "fee", mModelData["name"].asString());
+
+ if (observer)
+ {
+ observer->setModelPhysicsFeeErrorStatus(status.toULong(), reason, body["error"]);
+ }
+ }
+ else
+ {
+ if (fake_error & 0x1)
+ {
+ body = llsd_from_file("fake_upload_error.xml");
+ }
+ else
+ {
+ // *TODO: handle error in conversion process
+ LLCoreHttpUtil::responseToLLSD(response, true, body);
+ }
+ dump_llsd_to_file(body, make_dump_name("whole_model_fee_response_", dump_num));
+
+ if (body["state"].asString() == "upload")
+ {
+ mWholeModelUploadURL = body["uploader"].asString();
+
+ if (observer)
+ {
+ body["data"]["upload_price"] = body["upload_price"];
+ observer->onModelPhysicsFeeReceived(body["data"], mWholeModelUploadURL);
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Fee request failed. Not in expected 'upload' state." << LL_ENDL;
+ log_upload_error(status, body, "fee", mModelData["name"].asString());
+
+ if (observer)
+ {
+ observer->setModelPhysicsFeeErrorStatus(status.toULong(), reason, body["error"]);
+ }
+ }
+ }
+ }
}
void LLMeshRepoThread::notifyLoadedMeshes()
{
- bool update_metrics(false);
-
- if (!mMutex)
- {
- return;
- }
-
- if (!mLoadedQ.empty())
- {
- std::deque<LoadedMesh> loaded_queue;
-
- mMutex->lock();
- if (!mLoadedQ.empty())
- {
- loaded_queue.swap(mLoadedQ);
- mMutex->unlock();
-
- update_metrics = true;
-
- // Process the elements free of the lock
- for (const auto& mesh : loaded_queue)
- {
- if (mesh.mVolume->getNumVolumeFaces() > 0)
- {
- gMeshRepo.notifyMeshLoaded(mesh.mMeshParams, mesh.mVolume);
- }
- else
- {
- gMeshRepo.notifyMeshUnavailable(mesh.mMeshParams,
- LLVolumeLODGroup::getVolumeDetailFromScale(mesh.mVolume->getDetail()));
- }
- }
- }
- }
-
- if (!mUnavailableQ.empty())
- {
- std::deque<LODRequest> unavil_queue;
-
- mMutex->lock();
- if (!mUnavailableQ.empty())
- {
- unavil_queue.swap(mUnavailableQ);
- mMutex->unlock();
-
- update_metrics = true;
-
- // Process the elements free of the lock
- for (const auto& req : unavil_queue)
- {
- gMeshRepo.notifyMeshUnavailable(req.mMeshParams, req.mLOD);
- }
- }
- }
-
- if (!mSkinInfoQ.empty() || !mSkinUnavailableQ.empty() || ! mDecompositionQ.empty())
- {
- if (mMutex->trylock())
- {
- std::deque<LLMeshSkinInfo*> skin_info_q;
- std::deque<UUIDBasedRequest> skin_info_unavail_q;
- std::list<LLModel::Decomposition*> decomp_q;
-
- if (! mSkinInfoQ.empty())
- {
- skin_info_q.swap(mSkinInfoQ);
- }
-
- if (! mSkinUnavailableQ.empty())
- {
- skin_info_unavail_q.swap(mSkinUnavailableQ);
- }
-
- if (! mDecompositionQ.empty())
- {
- decomp_q.swap(mDecompositionQ);
- }
-
- mMutex->unlock();
-
- // Process the elements free of the lock
- while (! skin_info_q.empty())
- {
- gMeshRepo.notifySkinInfoReceived(skin_info_q.front());
- skin_info_q.pop_front();
- }
- while (! skin_info_unavail_q.empty())
- {
- gMeshRepo.notifySkinInfoUnavailable(skin_info_unavail_q.front().mId);
- skin_info_unavail_q.pop_front();
- }
-
- while (! decomp_q.empty())
- {
- gMeshRepo.notifyDecompositionReceived(decomp_q.front());
- decomp_q.pop_front();
- }
- }
- }
-
- if (update_metrics)
- {
- // Ping time-to-load metrics for mesh download operations.
- LLMeshRepository::metricsProgress(0);
- }
-
-}
-
-S32 LLMeshRepoThread::getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
+ bool update_metrics(false);
+
+ if (!mMutex)
+ {
+ return;
+ }
+
+ if (!mLoadedQ.empty())
+ {
+ std::deque<LoadedMesh> loaded_queue;
+
+ mMutex->lock();
+ if (!mLoadedQ.empty())
+ {
+ loaded_queue.swap(mLoadedQ);
+ mMutex->unlock();
+
+ update_metrics = true;
+
+ // Process the elements free of the lock
+ for (const auto& mesh : loaded_queue)
+ {
+ if (mesh.mVolume->getNumVolumeFaces() > 0)
+ {
+ gMeshRepo.notifyMeshLoaded(mesh.mMeshParams, mesh.mVolume);
+ }
+ else
+ {
+ gMeshRepo.notifyMeshUnavailable(mesh.mMeshParams,
+ LLVolumeLODGroup::getVolumeDetailFromScale(mesh.mVolume->getDetail()));
+ }
+ }
+ }
+ }
+
+ if (!mUnavailableQ.empty())
+ {
+ std::deque<LODRequest> unavil_queue;
+
+ mMutex->lock();
+ if (!mUnavailableQ.empty())
+ {
+ unavil_queue.swap(mUnavailableQ);
+ mMutex->unlock();
+
+ update_metrics = true;
+
+ // Process the elements free of the lock
+ for (const auto& req : unavil_queue)
+ {
+ gMeshRepo.notifyMeshUnavailable(req.mMeshParams, req.mLOD);
+ }
+ }
+ }
+
+ if (!mSkinInfoQ.empty() || !mSkinUnavailableQ.empty() || ! mDecompositionQ.empty())
+ {
+ if (mMutex->trylock())
+ {
+ std::deque<LLMeshSkinInfo*> skin_info_q;
+ std::deque<UUIDBasedRequest> skin_info_unavail_q;
+ std::list<LLModel::Decomposition*> decomp_q;
+
+ if (! mSkinInfoQ.empty())
+ {
+ skin_info_q.swap(mSkinInfoQ);
+ }
+
+ if (! mSkinUnavailableQ.empty())
+ {
+ skin_info_unavail_q.swap(mSkinUnavailableQ);
+ }
+
+ if (! mDecompositionQ.empty())
+ {
+ decomp_q.swap(mDecompositionQ);
+ }
+
+ mMutex->unlock();
+
+ // Process the elements free of the lock
+ while (! skin_info_q.empty())
+ {
+ gMeshRepo.notifySkinInfoReceived(skin_info_q.front());
+ skin_info_q.pop_front();
+ }
+ while (! skin_info_unavail_q.empty())
+ {
+ gMeshRepo.notifySkinInfoUnavailable(skin_info_unavail_q.front().mId);
+ skin_info_unavail_q.pop_front();
+ }
+
+ while (! decomp_q.empty())
+ {
+ gMeshRepo.notifyDecompositionReceived(decomp_q.front());
+ decomp_q.pop_front();
+ }
+ }
+ }
+
+ if (update_metrics)
+ {
+ // Ping time-to-load metrics for mesh download operations.
+ LLMeshRepository::metricsProgress(0);
+ }
+
+}
+
+S32 LLMeshRepoThread::getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
{ //only ever called from main thread
- LLMutexLock lock(mHeaderMutex);
- mesh_header_map::iterator iter = mMeshHeader.find(mesh_params.getSculptID());
+ LLMutexLock lock(mHeaderMutex);
+ mesh_header_map::iterator iter = mMeshHeader.find(mesh_params.getSculptID());
- if (iter != mMeshHeader.end())
- {
- auto& header = iter->second.second;
+ if (iter != mMeshHeader.end())
+ {
+ auto& header = iter->second.second;
- return LLMeshRepository::getActualMeshLOD(header, lod);
- }
+ return LLMeshRepository::getActualMeshLOD(header, lod);
+ }
- return lod;
+ return lod;
}
//static
S32 LLMeshRepository::getActualMeshLOD(LLMeshHeader& header, S32 lod)
{
- lod = llclamp(lod, 0, 3);
-
- if (header.m404)
- {
- return -1;
- }
-
- S32 version = header.mVersion;
-
- if (version > MAX_MESH_VERSION)
- {
- return -1;
- }
-
- if (header.mLodSize[lod] > 0)
- {
- return lod;
- }
-
- //search down to find the next available lower lod
- for (S32 i = lod-1; i >= 0; --i)
- {
- if (header.mLodSize[i] > 0)
- {
- return i;
- }
- }
-
- //search up to find then ext available higher lod
- for (S32 i = lod+1; i < LLVolumeLODGroup::NUM_LODS; ++i)
- {
- if (header.mLodSize[i] > 0)
- {
- return i;
- }
- }
-
- //header exists and no good lod found, treat as 404
+ lod = llclamp(lod, 0, 3);
+
+ if (header.m404)
+ {
+ return -1;
+ }
+
+ S32 version = header.mVersion;
+
+ if (version > MAX_MESH_VERSION)
+ {
+ return -1;
+ }
+
+ if (header.mLodSize[lod] > 0)
+ {
+ return lod;
+ }
+
+ //search down to find the next available lower lod
+ for (S32 i = lod-1; i >= 0; --i)
+ {
+ if (header.mLodSize[i] > 0)
+ {
+ return i;
+ }
+ }
+
+ //search up to find then ext available higher lod
+ for (S32 i = lod+1; i < LLVolumeLODGroup::NUM_LODS; ++i)
+ {
+ if (header.mLodSize[i] > 0)
+ {
+ return i;
+ }
+ }
+
+ //header exists and no good lod found, treat as 404
header.m404 = true;
return -1;
@@ -3049,335 +3049,335 @@ S32 LLMeshRepository::getActualMeshLOD(LLMeshHeader& header, S32 lod)
// are cases far off the norm.
void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response)
{
- mProcessed = true;
-
- unsigned int retries(0U);
- response->getRetries(NULL, &retries);
- LLMeshRepository::sHTTPRetryCount += retries;
-
- LLCore::HttpStatus status(response->getStatus());
- if (! status || MESH_HTTP_RESPONSE_FAILED)
- {
- processFailure(status);
- ++LLMeshRepository::sHTTPErrorCount;
- }
- else
- {
- // From texture fetch code and may apply here:
- //
- // A warning about partial (HTTP 206) data. Some grid services
- // do *not* return a 'Content-Range' header in the response to
- // Range requests with a 206 status. We're forced to assume
- // we get what we asked for in these cases until we can fix
- // the services.
- //
- // May also need to deal with 200 status (full asset returned
- // rather than partial) and 416 (request completely unsatisfyable).
- // Always been exposed to these but are less likely here where
- // speculative loads aren't done.
- LLCore::BufferArray * body(response->getBody());
- S32 body_offset(0);
- U8 * data(NULL);
- S32 data_size(body ? body->size() : 0);
-
- if (data_size > 0)
- {
- static const LLCore::HttpStatus par_status(HTTP_PARTIAL_CONTENT);
-
- unsigned int offset(0), length(0), full_length(0);
-
- if (par_status == status)
- {
- // 206 case
- response->getRange(&offset, &length, &full_length);
- if (! offset && ! length)
- {
- // This is the case where we receive a 206 status but
- // there wasn't a useful Content-Range header in the response.
- // This could be because it was badly formatted but is more
- // likely due to capabilities services which scrub headers
- // from responses. Assume we got what we asked for...`
- // length = data_size;
- offset = mOffset;
- }
- }
- else
- {
- // 200 case, typically
- offset = 0;
- }
-
- // *DEBUG: To test validation below
- // offset += 1;
-
- // Validate that what we think we received is consistent with
- // what we've asked for. I.e. first byte we wanted lies somewhere
- // in the response.
- if (offset > mOffset
- || (offset + data_size) <= mOffset
- || (mOffset - offset) >= data_size)
- {
- // No overlap with requested range. Fail request with
- // suitable error. Shouldn't happen unless server/cache/ISP
- // is doing something awful.
- LL_WARNS(LOG_MESH) << "Mesh response (bytes ["
- << offset << ".." << (offset + length - 1)
- << "]) didn't overlap with request's origin (bytes ["
- << mOffset << ".." << (mOffset + mRequestedBytes - 1)
- << "])." << LL_ENDL;
- processFailure(LLCore::HttpStatus(LLCore::HttpStatus::LLCORE, LLCore::HE_INV_CONTENT_RANGE_HDR));
- ++LLMeshRepository::sHTTPErrorCount;
- goto common_exit;
- }
-
- // *TODO: Try to get rid of data copying and add interfaces
- // that support BufferArray directly. Introduce a two-phase
- // handler, optional first that takes a body, fallback second
- // that requires a temporary allocation and data copy.
- body_offset = mOffset - offset;
- data = new(std::nothrow) U8[data_size - body_offset];
- if (data)
- {
- body->read(body_offset, (char *) data, data_size - body_offset);
- LLMeshRepository::sBytesReceived += data_size;
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Failed to allocate " << data_size - body_offset << " memory for mesh response" << LL_ENDL;
- processFailure(LLCore::HttpStatus(LLCore::HttpStatus::LLCORE, LLCore::HE_BAD_ALLOC));
- }
- }
-
- processData(body, body_offset, data, data_size - body_offset);
-
- delete [] data;
- }
-
- // Release handler
+ mProcessed = true;
+
+ unsigned int retries(0U);
+ response->getRetries(NULL, &retries);
+ LLMeshRepository::sHTTPRetryCount += retries;
+
+ LLCore::HttpStatus status(response->getStatus());
+ if (! status || MESH_HTTP_RESPONSE_FAILED)
+ {
+ processFailure(status);
+ ++LLMeshRepository::sHTTPErrorCount;
+ }
+ else
+ {
+ // From texture fetch code and may apply here:
+ //
+ // A warning about partial (HTTP 206) data. Some grid services
+ // do *not* return a 'Content-Range' header in the response to
+ // Range requests with a 206 status. We're forced to assume
+ // we get what we asked for in these cases until we can fix
+ // the services.
+ //
+ // May also need to deal with 200 status (full asset returned
+ // rather than partial) and 416 (request completely unsatisfyable).
+ // Always been exposed to these but are less likely here where
+ // speculative loads aren't done.
+ LLCore::BufferArray * body(response->getBody());
+ S32 body_offset(0);
+ U8 * data(NULL);
+ S32 data_size(body ? body->size() : 0);
+
+ if (data_size > 0)
+ {
+ static const LLCore::HttpStatus par_status(HTTP_PARTIAL_CONTENT);
+
+ unsigned int offset(0), length(0), full_length(0);
+
+ if (par_status == status)
+ {
+ // 206 case
+ response->getRange(&offset, &length, &full_length);
+ if (! offset && ! length)
+ {
+ // This is the case where we receive a 206 status but
+ // there wasn't a useful Content-Range header in the response.
+ // This could be because it was badly formatted but is more
+ // likely due to capabilities services which scrub headers
+ // from responses. Assume we got what we asked for...`
+ // length = data_size;
+ offset = mOffset;
+ }
+ }
+ else
+ {
+ // 200 case, typically
+ offset = 0;
+ }
+
+ // *DEBUG: To test validation below
+ // offset += 1;
+
+ // Validate that what we think we received is consistent with
+ // what we've asked for. I.e. first byte we wanted lies somewhere
+ // in the response.
+ if (offset > mOffset
+ || (offset + data_size) <= mOffset
+ || (mOffset - offset) >= data_size)
+ {
+ // No overlap with requested range. Fail request with
+ // suitable error. Shouldn't happen unless server/cache/ISP
+ // is doing something awful.
+ LL_WARNS(LOG_MESH) << "Mesh response (bytes ["
+ << offset << ".." << (offset + length - 1)
+ << "]) didn't overlap with request's origin (bytes ["
+ << mOffset << ".." << (mOffset + mRequestedBytes - 1)
+ << "])." << LL_ENDL;
+ processFailure(LLCore::HttpStatus(LLCore::HttpStatus::LLCORE, LLCore::HE_INV_CONTENT_RANGE_HDR));
+ ++LLMeshRepository::sHTTPErrorCount;
+ goto common_exit;
+ }
+
+ // *TODO: Try to get rid of data copying and add interfaces
+ // that support BufferArray directly. Introduce a two-phase
+ // handler, optional first that takes a body, fallback second
+ // that requires a temporary allocation and data copy.
+ body_offset = mOffset - offset;
+ data = new(std::nothrow) U8[data_size - body_offset];
+ if (data)
+ {
+ body->read(body_offset, (char *) data, data_size - body_offset);
+ LLMeshRepository::sBytesReceived += data_size;
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Failed to allocate " << data_size - body_offset << " memory for mesh response" << LL_ENDL;
+ processFailure(LLCore::HttpStatus(LLCore::HttpStatus::LLCORE, LLCore::HE_BAD_ALLOC));
+ }
+ }
+
+ processData(body, body_offset, data, data_size - body_offset);
+
+ delete [] data;
+ }
+
+ // Release handler
common_exit:
- gMeshRepo.mThread->mHttpRequestSet.erase(this->shared_from_this());
+ gMeshRepo.mThread->mHttpRequestSet.erase(this->shared_from_this());
}
LLMeshHeaderHandler::~LLMeshHeaderHandler()
{
- if (!LLApp::isExiting())
- {
- if (! mProcessed)
- {
- // something went wrong, retry
- LL_WARNS(LOG_MESH) << "Mesh header fetch canceled unexpectedly, retrying." << LL_ENDL;
- LLMeshRepoThread::HeaderRequest req(mMeshParams);
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- gMeshRepo.mThread->mHeaderReqQ.push(req);
- }
- LLMeshRepoThread::decActiveHeaderRequests();
- }
+ if (!LLApp::isExiting())
+ {
+ if (! mProcessed)
+ {
+ // something went wrong, retry
+ LL_WARNS(LOG_MESH) << "Mesh header fetch canceled unexpectedly, retrying." << LL_ENDL;
+ LLMeshRepoThread::HeaderRequest req(mMeshParams);
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ gMeshRepo.mThread->mHeaderReqQ.push(req);
+ }
+ LLMeshRepoThread::decActiveHeaderRequests();
+ }
}
void LLMeshHeaderHandler::processFailure(LLCore::HttpStatus status)
{
- LL_WARNS(LOG_MESH) << "Error during mesh header handling. ID: " << mMeshParams.getSculptID()
- << ", Reason: " << status.toString()
- << " (" << status.toTerseString() << "). Not retrying."
- << LL_ENDL;
+ LL_WARNS(LOG_MESH) << "Error during mesh header handling. ID: " << mMeshParams.getSculptID()
+ << ", Reason: " << status.toString()
+ << " (" << status.toTerseString() << "). Not retrying."
+ << LL_ENDL;
- // Can't get the header so none of the LODs will be available
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- for (int i(0); i < LLVolumeLODGroup::NUM_LODS; ++i)
- {
- gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i));
- }
+ // Can't get the header so none of the LODs will be available
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ for (int i(0); i < LLVolumeLODGroup::NUM_LODS; ++i)
+ {
+ gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i));
+ }
}
void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
- U8 * data, S32 data_size)
+ U8 * data, S32 data_size)
{
- LLUUID mesh_id = mMeshParams.getSculptID();
+ LLUUID mesh_id = mMeshParams.getSculptID();
bool success = (!MESH_HEADER_PROCESS_FAILED)
&& ((data != NULL) == (data_size > 0)); // if we have data but no size or have size but no data, something is wrong;
- llassert(success);
+ llassert(success);
EMeshProcessingResult res = MESH_UNKNOWN;
if (success)
{
res = gMeshRepo.mThread->headerReceived(mMeshParams, data, data_size);
success = (res == MESH_OK);
}
- if (! success)
- {
- // *TODO: Get real reason for parse failure here. Might we want to retry?
- LL_WARNS(LOG_MESH) << "Unable to parse mesh header. ID: " << mesh_id
- << ", Size: " << data_size
- << ", Reason: " << res << " Not retrying."
- << LL_ENDL;
-
- // Can't get the header so none of the LODs will be available
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- for (int i(0); i < LLVolumeLODGroup::NUM_LODS; ++i)
- {
- gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i));
- }
- }
- else if (data && data_size > 0)
- {
- // header was successfully retrieved from sim and parsed and is in cache
- S32 header_bytes = 0;
- LLMeshHeader header;
-
- gMeshRepo.mThread->mHeaderMutex->lock();
- LLMeshRepoThread::mesh_header_map::iterator iter = gMeshRepo.mThread->mMeshHeader.find(mesh_id);
- if (iter != gMeshRepo.mThread->mMeshHeader.end())
- {
- header_bytes = (S32)iter->second.first;
- header = iter->second.second;
- }
-
- if (header_bytes > 0
- && !header.m404
- && (header.mVersion <= MAX_MESH_VERSION))
- {
- std::stringstream str;
-
- S32 lod_bytes = 0;
-
- for (U32 i = 0; i < LLModel::LOD_PHYSICS; ++i)
- {
- // figure out how many bytes we'll need to reserve in the file
- lod_bytes = llmax(lod_bytes, header.mLodOffset[i]+header.mLodSize[i]);
- }
-
- // just in case skin info or decomposition is at the end of the file (which it shouldn't be)
- lod_bytes = llmax(lod_bytes, header.mSkinOffset+header.mSkinSize);
+ if (! success)
+ {
+ // *TODO: Get real reason for parse failure here. Might we want to retry?
+ LL_WARNS(LOG_MESH) << "Unable to parse mesh header. ID: " << mesh_id
+ << ", Size: " << data_size
+ << ", Reason: " << res << " Not retrying."
+ << LL_ENDL;
+
+ // Can't get the header so none of the LODs will be available
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ for (int i(0); i < LLVolumeLODGroup::NUM_LODS; ++i)
+ {
+ gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i));
+ }
+ }
+ else if (data && data_size > 0)
+ {
+ // header was successfully retrieved from sim and parsed and is in cache
+ S32 header_bytes = 0;
+ LLMeshHeader header;
+
+ gMeshRepo.mThread->mHeaderMutex->lock();
+ LLMeshRepoThread::mesh_header_map::iterator iter = gMeshRepo.mThread->mMeshHeader.find(mesh_id);
+ if (iter != gMeshRepo.mThread->mMeshHeader.end())
+ {
+ header_bytes = (S32)iter->second.first;
+ header = iter->second.second;
+ }
+
+ if (header_bytes > 0
+ && !header.m404
+ && (header.mVersion <= MAX_MESH_VERSION))
+ {
+ std::stringstream str;
+
+ S32 lod_bytes = 0;
+
+ for (U32 i = 0; i < LLModel::LOD_PHYSICS; ++i)
+ {
+ // figure out how many bytes we'll need to reserve in the file
+ lod_bytes = llmax(lod_bytes, header.mLodOffset[i]+header.mLodSize[i]);
+ }
+
+ // just in case skin info or decomposition is at the end of the file (which it shouldn't be)
+ lod_bytes = llmax(lod_bytes, header.mSkinOffset+header.mSkinSize);
lod_bytes = llmax(lod_bytes, header.mPhysicsConvexOffset + header.mPhysicsConvexSize);
// Do not unlock mutex untill we are done with LLSD.
// LLSD is smart and can work like smart pointer, is not thread safe.
gMeshRepo.mThread->mHeaderMutex->unlock();
- S32 bytes = lod_bytes + header_bytes;
-
-
- // It's possible for the remote asset to have more data than is needed for the local cache
- // only allocate as much space in the cache as is needed for the local cache
- data_size = llmin(data_size, bytes);
-
- // <FS:Ansariel> Fix asset caching
- //LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::WRITE);
- LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
- if (file.getMaxSize() >= bytes)
- {
- LLMeshRepository::sCacheBytesWritten += data_size;
- ++LLMeshRepository::sCacheWrites;
-
- file.write(data, data_size);
-
- // <FS:Ansariel> Fix asset caching
- S32 remaining = bytes - file.tell();
- if (remaining > 0)
- {
- U8* block = new(std::nothrow) U8[remaining];
- if (block)
- {
- memset(block, 0, remaining);
- file.write(block, remaining);
- delete[] block;
- }
- }
- // </FS:Ansariel>
- }
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Trying to cache nonexistent mesh, mesh id: " << mesh_id << LL_ENDL;
-
- gMeshRepo.mThread->mHeaderMutex->unlock();
-
- // headerReceived() parsed header, but header's data is invalid so none of the LODs will be available
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- for (int i(0); i < LLVolumeLODGroup::NUM_LODS; ++i)
- {
- gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i));
- }
- }
- }
+ S32 bytes = lod_bytes + header_bytes;
+
+
+ // It's possible for the remote asset to have more data than is needed for the local cache
+ // only allocate as much space in the cache as is needed for the local cache
+ data_size = llmin(data_size, bytes);
+
+ // <FS:Ansariel> Fix asset caching
+ //LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::WRITE);
+ LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
+ if (file.getMaxSize() >= bytes)
+ {
+ LLMeshRepository::sCacheBytesWritten += data_size;
+ ++LLMeshRepository::sCacheWrites;
+
+ file.write(data, data_size);
+
+ // <FS:Ansariel> Fix asset caching
+ S32 remaining = bytes - file.tell();
+ if (remaining > 0)
+ {
+ U8* block = new(std::nothrow) U8[remaining];
+ if (block)
+ {
+ memset(block, 0, remaining);
+ file.write(block, remaining);
+ delete[] block;
+ }
+ }
+ // </FS:Ansariel>
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Trying to cache nonexistent mesh, mesh id: " << mesh_id << LL_ENDL;
+
+ gMeshRepo.mThread->mHeaderMutex->unlock();
+
+ // headerReceived() parsed header, but header's data is invalid so none of the LODs will be available
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ for (int i(0); i < LLVolumeLODGroup::NUM_LODS; ++i)
+ {
+ gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i));
+ }
+ }
+ }
}
LLMeshLODHandler::~LLMeshLODHandler()
{
- if (! LLApp::isExiting())
- {
- if (! mProcessed)
- {
- LL_WARNS(LOG_MESH) << "Mesh LOD fetch canceled unexpectedly, retrying." << LL_ENDL;
- gMeshRepo.mThread->lockAndLoadMeshLOD(mMeshParams, mLOD);
- }
- LLMeshRepoThread::decActiveLODRequests();
- }
+ if (! LLApp::isExiting())
+ {
+ if (! mProcessed)
+ {
+ LL_WARNS(LOG_MESH) << "Mesh LOD fetch canceled unexpectedly, retrying." << LL_ENDL;
+ gMeshRepo.mThread->lockAndLoadMeshLOD(mMeshParams, mLOD);
+ }
+ LLMeshRepoThread::decActiveLODRequests();
+ }
}
void LLMeshLODHandler::processFailure(LLCore::HttpStatus status)
{
- LL_WARNS(LOG_MESH) << "Error during mesh LOD handling. ID: " << mMeshParams.getSculptID()
- << ", Reason: " << status.toString()
- << " (" << status.toTerseString() << "). Not retrying."
- << LL_ENDL;
+ LL_WARNS(LOG_MESH) << "Error during mesh LOD handling. ID: " << mMeshParams.getSculptID()
+ << ", Reason: " << status.toString()
+ << " (" << status.toTerseString() << "). Not retrying."
+ << LL_ENDL;
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, mLOD));
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, mLOD));
}
void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
- U8 * data, S32 data_size)
-{
- if ((!MESH_LOD_PROCESS_FAILED)
- && ((data != NULL) == (data_size > 0))) // if we have data but no size or have size but no data, something is wrong
- {
- EMeshProcessingResult result = gMeshRepo.mThread->lodReceived(mMeshParams, mLOD, data, data_size);
- if (result == MESH_OK)
- {
- // good fetch from sim, write to cache
- // <FS:Ansariel> Fix asset caching
- //LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::WRITE);
- LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
-
- S32 offset = mOffset;
- S32 size = mRequestedBytes;
-
- if (file.getSize() >= offset+size)
- {
- file.seek(offset);
- file.write(data, size);
- LLMeshRepository::sCacheBytesWritten += size;
- ++LLMeshRepository::sCacheWrites;
- }
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Error during mesh LOD processing. ID: " << mMeshParams.getSculptID()
- << ", Reason: " << result
- << " LOD: " << mLOD
- << " Data size: " << data_size
- << " Not retrying."
- << LL_ENDL;
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, mLOD));
- }
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Error during mesh LOD processing. ID: " << mMeshParams.getSculptID()
- << ", Unknown reason. Not retrying."
- << " LOD: " << mLOD
- << " Data size: " << data_size
- << LL_ENDL;
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, mLOD));
- }
+ U8 * data, S32 data_size)
+{
+ if ((!MESH_LOD_PROCESS_FAILED)
+ && ((data != NULL) == (data_size > 0))) // if we have data but no size or have size but no data, something is wrong
+ {
+ EMeshProcessingResult result = gMeshRepo.mThread->lodReceived(mMeshParams, mLOD, data, data_size);
+ if (result == MESH_OK)
+ {
+ // good fetch from sim, write to cache
+ // <FS:Ansariel> Fix asset caching
+ //LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::WRITE);
+ LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
+
+ S32 offset = mOffset;
+ S32 size = mRequestedBytes;
+
+ if (file.getSize() >= offset+size)
+ {
+ file.seek(offset);
+ file.write(data, size);
+ LLMeshRepository::sCacheBytesWritten += size;
+ ++LLMeshRepository::sCacheWrites;
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Error during mesh LOD processing. ID: " << mMeshParams.getSculptID()
+ << ", Reason: " << result
+ << " LOD: " << mLOD
+ << " Data size: " << data_size
+ << " Not retrying."
+ << LL_ENDL;
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, mLOD));
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Error during mesh LOD processing. ID: " << mMeshParams.getSculptID()
+ << ", Unknown reason. Not retrying."
+ << " LOD: " << mLOD
+ << " Data size: " << data_size
+ << LL_ENDL;
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, mLOD));
+ }
}
LLMeshSkinInfoHandler::~LLMeshSkinInfoHandler()
{
- if (!mProcessed)
+ if (!mProcessed)
{
LL_WARNS(LOG_MESH) << "deleting unprocessed request handler (may be ok on exit)" << LL_ENDL;
}
@@ -3385,50 +3385,50 @@ LLMeshSkinInfoHandler::~LLMeshSkinInfoHandler()
void LLMeshSkinInfoHandler::processFailure(LLCore::HttpStatus status)
{
- LL_WARNS(LOG_MESH) << "Error during mesh skin info handling. ID: " << mMeshID
- << ", Reason: " << status.toString()
- << " (" << status.toTerseString() << "). Not retrying."
- << LL_ENDL;
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- gMeshRepo.mThread->mSkinUnavailableQ.emplace_back(mMeshID);
+ LL_WARNS(LOG_MESH) << "Error during mesh skin info handling. ID: " << mMeshID
+ << ", Reason: " << status.toString()
+ << " (" << status.toTerseString() << "). Not retrying."
+ << LL_ENDL;
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ gMeshRepo.mThread->mSkinUnavailableQ.emplace_back(mMeshID);
}
void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
- U8 * data, S32 data_size)
-{
- if ((!MESH_SKIN_INFO_PROCESS_FAILED)
- && ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
- && gMeshRepo.mThread->skinInfoReceived(mMeshID, data, data_size))
- {
- // good fetch from sim, write to cache
- // <FS:Ansariel> Fix asset caching
- //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
- LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
-
- S32 offset = mOffset;
- S32 size = mRequestedBytes;
-
- if (file.getSize() >= offset+size)
- {
- LLMeshRepository::sCacheBytesWritten += size;
- ++LLMeshRepository::sCacheWrites;
- file.seek(offset);
- file.write(data, size);
- }
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Error during mesh skin info processing. ID: " << mMeshID
- << ", Unknown reason. Not retrying."
- << LL_ENDL;
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- gMeshRepo.mThread->mSkinUnavailableQ.emplace_back(mMeshID);
- }
+ U8 * data, S32 data_size)
+{
+ if ((!MESH_SKIN_INFO_PROCESS_FAILED)
+ && ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
+ && gMeshRepo.mThread->skinInfoReceived(mMeshID, data, data_size))
+ {
+ // good fetch from sim, write to cache
+ // <FS:Ansariel> Fix asset caching
+ //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
+ LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
+
+ S32 offset = mOffset;
+ S32 size = mRequestedBytes;
+
+ if (file.getSize() >= offset+size)
+ {
+ LLMeshRepository::sCacheBytesWritten += size;
+ ++LLMeshRepository::sCacheWrites;
+ file.seek(offset);
+ file.write(data, size);
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Error during mesh skin info processing. ID: " << mMeshID
+ << ", Unknown reason. Not retrying."
+ << LL_ENDL;
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ gMeshRepo.mThread->mSkinUnavailableQ.emplace_back(mMeshID);
+ }
}
LLMeshDecompositionHandler::~LLMeshDecompositionHandler()
{
- if (!mProcessed)
+ if (!mProcessed)
{
LL_WARNS(LOG_MESH) << "deleting unprocessed request handler (may be ok on exit)" << LL_ENDL;
}
@@ -3436,49 +3436,49 @@ LLMeshDecompositionHandler::~LLMeshDecompositionHandler()
void LLMeshDecompositionHandler::processFailure(LLCore::HttpStatus status)
{
- LL_WARNS(LOG_MESH) << "Error during mesh decomposition handling. ID: " << mMeshID
- << ", Reason: " << status.toString()
- << " (" << status.toTerseString() << "). Not retrying."
- << LL_ENDL;
- // *TODO: Mark mesh unavailable on error. For now, simply leave
- // request unfulfilled rather than retry forever.
+ LL_WARNS(LOG_MESH) << "Error during mesh decomposition handling. ID: " << mMeshID
+ << ", Reason: " << status.toString()
+ << " (" << status.toTerseString() << "). Not retrying."
+ << LL_ENDL;
+ // *TODO: Mark mesh unavailable on error. For now, simply leave
+ // request unfulfilled rather than retry forever.
}
void LLMeshDecompositionHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
- U8 * data, S32 data_size)
-{
- if ((!MESH_DECOMP_PROCESS_FAILED)
- && ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
- && gMeshRepo.mThread->decompositionReceived(mMeshID, data, data_size))
- {
- // good fetch from sim, write to cache
- // <FS:Ansariel> Fix asset caching
- //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
- LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
-
- S32 offset = mOffset;
- S32 size = mRequestedBytes;
-
- if (file.getSize() >= offset+size)
- {
- LLMeshRepository::sCacheBytesWritten += size;
- ++LLMeshRepository::sCacheWrites;
- file.seek(offset);
- file.write(data, size);
- }
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Error during mesh decomposition processing. ID: " << mMeshID
- << ", Unknown reason. Not retrying."
- << LL_ENDL;
- // *TODO: Mark mesh unavailable on error
- }
+ U8 * data, S32 data_size)
+{
+ if ((!MESH_DECOMP_PROCESS_FAILED)
+ && ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
+ && gMeshRepo.mThread->decompositionReceived(mMeshID, data, data_size))
+ {
+ // good fetch from sim, write to cache
+ // <FS:Ansariel> Fix asset caching
+ //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
+ LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
+
+ S32 offset = mOffset;
+ S32 size = mRequestedBytes;
+
+ if (file.getSize() >= offset+size)
+ {
+ LLMeshRepository::sCacheBytesWritten += size;
+ ++LLMeshRepository::sCacheWrites;
+ file.seek(offset);
+ file.write(data, size);
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Error during mesh decomposition processing. ID: " << mMeshID
+ << ", Unknown reason. Not retrying."
+ << LL_ENDL;
+ // *TODO: Mark mesh unavailable on error
+ }
}
LLMeshPhysicsShapeHandler::~LLMeshPhysicsShapeHandler()
{
- if (!mProcessed)
+ if (!mProcessed)
{
LL_WARNS(LOG_MESH) << "deleting unprocessed request handler (may be ok on exit)" << LL_ENDL;
}
@@ -3486,43 +3486,43 @@ LLMeshPhysicsShapeHandler::~LLMeshPhysicsShapeHandler()
void LLMeshPhysicsShapeHandler::processFailure(LLCore::HttpStatus status)
{
- LL_WARNS(LOG_MESH) << "Error during mesh physics shape handling. ID: " << mMeshID
- << ", Reason: " << status.toString()
- << " (" << status.toTerseString() << "). Not retrying."
- << LL_ENDL;
- // *TODO: Mark mesh unavailable on error
+ LL_WARNS(LOG_MESH) << "Error during mesh physics shape handling. ID: " << mMeshID
+ << ", Reason: " << status.toString()
+ << " (" << status.toTerseString() << "). Not retrying."
+ << LL_ENDL;
+ // *TODO: Mark mesh unavailable on error
}
void LLMeshPhysicsShapeHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
- U8 * data, S32 data_size)
-{
- if ((!MESH_PHYS_SHAPE_PROCESS_FAILED)
- && ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
- && gMeshRepo.mThread->physicsShapeReceived(mMeshID, data, data_size) == MESH_OK)
- {
- // good fetch from sim, write to cache for caching
- // <FS:Ansariel> Fix asset caching
- //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
- LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
-
- S32 offset = mOffset;
- S32 size = mRequestedBytes;
-
- if (file.getSize() >= offset+size)
- {
- LLMeshRepository::sCacheBytesWritten += size;
- ++LLMeshRepository::sCacheWrites;
- file.seek(offset);
- file.write(data, size);
- }
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Error during mesh physics shape processing. ID: " << mMeshID
- << ", Unknown reason. Not retrying."
- << LL_ENDL;
- // *TODO: Mark mesh unavailable on error
- }
+ U8 * data, S32 data_size)
+{
+ if ((!MESH_PHYS_SHAPE_PROCESS_FAILED)
+ && ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
+ && gMeshRepo.mThread->physicsShapeReceived(mMeshID, data, data_size) == MESH_OK)
+ {
+ // good fetch from sim, write to cache for caching
+ // <FS:Ansariel> Fix asset caching
+ //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE);
+ LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE);
+
+ S32 offset = mOffset;
+ S32 size = mRequestedBytes;
+
+ if (file.getSize() >= offset+size)
+ {
+ LLMeshRepository::sCacheBytesWritten += size;
+ ++LLMeshRepository::sCacheWrites;
+ file.seek(offset);
+ file.write(data, size);
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Error during mesh physics shape processing. ID: " << mMeshID
+ << ", Unknown reason. Not retrying."
+ << LL_ENDL;
+ // *TODO: Mark mesh unavailable on error
+ }
}
LLMeshRepository::LLMeshRepository()
@@ -3531,208 +3531,208 @@ LLMeshRepository::LLMeshRepository()
mMeshThreadCount(0),
mThread(NULL)
{
- mSkinInfoCullTimer.resetWithExpiry(10.f);
+ mSkinInfoCullTimer.resetWithExpiry(10.f);
}
void LLMeshRepository::init()
{
- mMeshMutex = new LLMutex();
-
- LLConvexDecomposition::getInstance()->initSystem();
+ mMeshMutex = new LLMutex();
+
+ LLConvexDecomposition::getInstance()->initSystem();
if (!LLConvexDecomposition::isFunctional())
{
LL_INFOS(LOG_MESH) << "Using STUB for LLConvexDecomposition" << LL_ENDL;
}
- mDecompThread = new LLPhysicsDecomp();
- mDecompThread->start();
+ mDecompThread = new LLPhysicsDecomp();
+ mDecompThread->start();
+
+ while (!mDecompThread->mInited)
+ { //wait for physics decomp thread to init
+ apr_sleep(100);
+ }
- while (!mDecompThread->mInited)
- { //wait for physics decomp thread to init
- apr_sleep(100);
- }
+ metrics_teleport_started_signal = LLViewerMessage::getInstance()->setTeleportStartedCallback(teleport_started);
- metrics_teleport_started_signal = LLViewerMessage::getInstance()->setTeleportStartedCallback(teleport_started);
-
- mThread = new LLMeshRepoThread();
- mThread->start();
+ mThread = new LLMeshRepoThread();
+ mThread->start();
}
void LLMeshRepository::shutdown()
{
- LL_INFOS(LOG_MESH) << "Shutting down mesh repository." << LL_ENDL;
- llassert(mThread != NULL);
- llassert(mThread->mSignal != NULL);
+ LL_INFOS(LOG_MESH) << "Shutting down mesh repository." << LL_ENDL;
+ llassert(mThread != NULL);
+ llassert(mThread->mSignal != NULL);
- metrics_teleport_started_signal.disconnect();
+ metrics_teleport_started_signal.disconnect();
- for (U32 i = 0; i < mUploads.size(); ++i)
- {
- LL_INFOS(LOG_MESH) << "Discard the pending mesh uploads." << LL_ENDL;
- mUploads[i]->discard() ; //discard the uploading requests.
- }
+ for (U32 i = 0; i < mUploads.size(); ++i)
+ {
+ LL_INFOS(LOG_MESH) << "Discard the pending mesh uploads." << LL_ENDL;
+ mUploads[i]->discard() ; //discard the uploading requests.
+ }
- mThread->mSignal->broadcast();
-
- while (!mThread->isStopped())
- {
- apr_sleep(10);
- }
- delete mThread;
- mThread = NULL;
+ mThread->mSignal->broadcast();
- for (U32 i = 0; i < mUploads.size(); ++i)
- {
- LL_INFOS(LOG_MESH) << "Waiting for pending mesh upload " << (i + 1) << "/" << mUploads.size() << LL_ENDL;
- while (!mUploads[i]->isStopped())
- {
- apr_sleep(10);
- }
- delete mUploads[i];
- }
+ while (!mThread->isStopped())
+ {
+ apr_sleep(10);
+ }
+ delete mThread;
+ mThread = NULL;
- mUploads.clear();
+ for (U32 i = 0; i < mUploads.size(); ++i)
+ {
+ LL_INFOS(LOG_MESH) << "Waiting for pending mesh upload " << (i + 1) << "/" << mUploads.size() << LL_ENDL;
+ while (!mUploads[i]->isStopped())
+ {
+ apr_sleep(10);
+ }
+ delete mUploads[i];
+ }
- delete mMeshMutex;
- mMeshMutex = NULL;
+ mUploads.clear();
- LL_INFOS(LOG_MESH) << "Shutting down decomposition system." << LL_ENDL;
+ delete mMeshMutex;
+ mMeshMutex = NULL;
- if (mDecompThread)
- {
- mDecompThread->shutdown();
- delete mDecompThread;
- mDecompThread = NULL;
- }
+ LL_INFOS(LOG_MESH) << "Shutting down decomposition system." << LL_ENDL;
+
+ if (mDecompThread)
+ {
+ mDecompThread->shutdown();
+ delete mDecompThread;
+ mDecompThread = NULL;
+ }
- LLConvexDecomposition::quitSystem();
+ LLConvexDecomposition::quitSystem();
}
//called in the main thread.
S32 LLMeshRepository::update()
{
- // Conditionally log a mesh metrics event
- metricsUpdate();
-
- if(mUploadWaitList.empty())
- {
- return 0 ;
- }
+ // Conditionally log a mesh metrics event
+ metricsUpdate();
- S32 size = mUploadWaitList.size() ;
- for (S32 i = 0; i < size; ++i)
- {
- mUploads.push_back(mUploadWaitList[i]);
- mUploadWaitList[i]->preStart() ;
- mUploadWaitList[i]->start() ;
- }
- mUploadWaitList.clear() ;
+ if(mUploadWaitList.empty())
+ {
+ return 0 ;
+ }
+
+ S32 size = mUploadWaitList.size() ;
+ for (S32 i = 0; i < size; ++i)
+ {
+ mUploads.push_back(mUploadWaitList[i]);
+ mUploadWaitList[i]->preStart() ;
+ mUploadWaitList[i]->start() ;
+ }
+ mUploadWaitList.clear() ;
- return size ;
+ return size ;
}
void LLMeshRepository::unregisterMesh(LLVOVolume* vobj)
{
- for (auto& lod : mLoadingMeshes)
- {
- for (auto& param : lod)
- {
- vector_replace_with_last(param.second, vobj);
- }
- }
+ for (auto& lod : mLoadingMeshes)
+ {
+ for (auto& param : lod)
+ {
+ vector_replace_with_last(param.second, vobj);
+ }
+ }
- for (auto& skin_pair : mLoadingSkins)
- {
- vector_replace_with_last(skin_pair.second, vobj);
- }
+ for (auto& skin_pair : mLoadingSkins)
+ {
+ vector_replace_with_last(skin_pair.second, vobj);
+ }
}
S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 detail, S32 last_lod)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; //LL_LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH);
-
- // Manage time-to-load metrics for mesh download operations.
- metricsProgress(1);
-
- if (detail < 0 || detail >= LLVolumeLODGroup::NUM_LODS)
- {
- return detail;
- }
-
- {
- LLMutexLock lock(mMeshMutex);
- //add volume to list of loading meshes
- const auto& mesh_id = mesh_params.getSculptID();
- mesh_load_map::iterator iter = mLoadingMeshes[detail].find(mesh_id);
- if (iter != mLoadingMeshes[detail].end())
- { //request pending for this mesh, append volume id to list
- auto it = std::find(iter->second.begin(), iter->second.end(), vobj);
- if (it == iter->second.end()) {
- iter->second.push_back(vobj);
- }
- }
- else
- {
- //first request for this mesh
- mLoadingMeshes[detail][mesh_id].push_back(vobj);
- mPendingRequests.push_back(LLMeshRepoThread::LODRequest(mesh_params, detail));
- LLMeshRepository::sLODPending++;
- }
- }
-
- //do a quick search to see if we can't display something while we wait for this mesh to load
- LLVolume* volume = vobj->getVolume();
-
- if (volume)
- {
- LLVolumeParams params = volume->getParams();
-
- LLVolumeLODGroup* group = LLPrimitive::getVolumeManager()->getGroup(params);
-
- if (group)
- {
- //first, see if last_lod is available (don't transition down to avoid funny popping a la SH-641)
- if (last_lod >= 0)
- {
- LLVolume* lod = group->refLOD(last_lod);
- if (lod && lod->isMeshAssetLoaded() && lod->getNumVolumeFaces() > 0)
- {
- group->derefLOD(lod);
- return last_lod;
- }
- group->derefLOD(lod);
- }
-
- //next, see what the next lowest LOD available might be
- for (S32 i = detail-1; i >= 0; --i)
- {
- LLVolume* lod = group->refLOD(i);
- if (lod && lod->isMeshAssetLoaded() && lod->getNumVolumeFaces() > 0)
- {
- group->derefLOD(lod);
- return i;
- }
-
- group->derefLOD(lod);
- }
-
- //no lower LOD is a available, is a higher lod available?
- for (S32 i = detail+1; i < LLVolumeLODGroup::NUM_LODS; ++i)
- {
- LLVolume* lod = group->refLOD(i);
- if (lod && lod->isMeshAssetLoaded() && lod->getNumVolumeFaces() > 0)
- {
- group->derefLOD(lod);
- return i;
- }
-
- group->derefLOD(lod);
- }
- }
- }
-
- return detail;
+
+ // Manage time-to-load metrics for mesh download operations.
+ metricsProgress(1);
+
+ if (detail < 0 || detail >= LLVolumeLODGroup::NUM_LODS)
+ {
+ return detail;
+ }
+
+ {
+ LLMutexLock lock(mMeshMutex);
+ //add volume to list of loading meshes
+ const auto& mesh_id = mesh_params.getSculptID();
+ mesh_load_map::iterator iter = mLoadingMeshes[detail].find(mesh_id);
+ if (iter != mLoadingMeshes[detail].end())
+ { //request pending for this mesh, append volume id to list
+ auto it = std::find(iter->second.begin(), iter->second.end(), vobj);
+ if (it == iter->second.end()) {
+ iter->second.push_back(vobj);
+ }
+ }
+ else
+ {
+ //first request for this mesh
+ mLoadingMeshes[detail][mesh_id].push_back(vobj);
+ mPendingRequests.push_back(LLMeshRepoThread::LODRequest(mesh_params, detail));
+ LLMeshRepository::sLODPending++;
+ }
+ }
+
+ //do a quick search to see if we can't display something while we wait for this mesh to load
+ LLVolume* volume = vobj->getVolume();
+
+ if (volume)
+ {
+ LLVolumeParams params = volume->getParams();
+
+ LLVolumeLODGroup* group = LLPrimitive::getVolumeManager()->getGroup(params);
+
+ if (group)
+ {
+ //first, see if last_lod is available (don't transition down to avoid funny popping a la SH-641)
+ if (last_lod >= 0)
+ {
+ LLVolume* lod = group->refLOD(last_lod);
+ if (lod && lod->isMeshAssetLoaded() && lod->getNumVolumeFaces() > 0)
+ {
+ group->derefLOD(lod);
+ return last_lod;
+ }
+ group->derefLOD(lod);
+ }
+
+ //next, see what the next lowest LOD available might be
+ for (S32 i = detail-1; i >= 0; --i)
+ {
+ LLVolume* lod = group->refLOD(i);
+ if (lod && lod->isMeshAssetLoaded() && lod->getNumVolumeFaces() > 0)
+ {
+ group->derefLOD(lod);
+ return i;
+ }
+
+ group->derefLOD(lod);
+ }
+
+ //no lower LOD is a available, is a higher lod available?
+ for (S32 i = detail+1; i < LLVolumeLODGroup::NUM_LODS; ++i)
+ {
+ LLVolume* lod = group->refLOD(i);
+ if (lod && lod->isMeshAssetLoaded() && lod->getNumVolumeFaces() > 0)
+ {
+ group->derefLOD(lod);
+ return i;
+ }
+
+ group->derefLOD(lod);
+ }
+ }
+ }
+
+ return detail;
}
void LLMeshRepository::notifyLoadedMeshes()
@@ -3754,353 +3754,353 @@ void LLMeshRepository::notifyLoadedMeshes()
LLMeshRepoThread::sRequestLowWater = llclamp(LLMeshRepoThread::sRequestHighWater / 2,
REQUEST2_LOW_WATER_MIN,
REQUEST2_LOW_WATER_MAX);
-
- //clean up completed upload threads
- for (std::vector<LLMeshUploadThread*>::iterator iter = mUploads.begin(); iter != mUploads.end(); )
- {
- LLMeshUploadThread* thread = *iter;
-
- if (thread->isStopped() && thread->finished())
- {
- iter = mUploads.erase(iter);
- delete thread;
- }
- else
- {
- ++iter;
- }
- }
-
- //update inventory
- if (!mInventoryQ.empty())
- {
- LLMutexLock lock(mMeshMutex);
- while (!mInventoryQ.empty())
- {
- inventory_data& data = mInventoryQ.front();
-
- LLAssetType::EType asset_type = LLAssetType::lookup(data.mPostData["asset_type"].asString());
- LLInventoryType::EType inventory_type = LLInventoryType::lookup(data.mPostData["inventory_type"].asString());
-
- // Handle addition of texture, if any.
- if ( data.mResponse.has("new_texture_folder_id") )
- {
- const LLUUID& new_folder_id = data.mResponse["new_texture_folder_id"].asUUID();
-
- if ( new_folder_id.notNull() )
- {
- LLUUID parent_id = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE);
-
- std::string name;
- // Check if the server built a different name for the texture folder
- if ( data.mResponse.has("new_texture_folder_name") )
- {
- name = data.mResponse["new_texture_folder_name"].asString();
- }
- else
- {
- name = data.mPostData["name"].asString();
- }
-
- // Add the category to the internal representation
- LLPointer<LLViewerInventoryCategory> cat =
- new LLViewerInventoryCategory(new_folder_id, parent_id,
- LLFolderType::FT_NONE, name, gAgent.getID());
- cat->setVersion(LLViewerInventoryCategory::VERSION_UNKNOWN);
-
- LLInventoryModel::LLCategoryUpdate update(cat->getParentUUID(), 1);
- gInventory.accountForUpdate(update);
- gInventory.updateCategory(cat);
- }
- }
-
- on_new_single_inventory_upload_complete(
- asset_type,
- inventory_type,
- data.mPostData["asset_type"].asString(),
- data.mPostData["folder_id"].asUUID(),
- data.mPostData["name"],
- data.mPostData["description"],
- data.mResponse,
- data.mResponse["upload_price"]);
- //}
-
- mInventoryQ.pop();
- }
- }
-
- //call completed callbacks on finished decompositions
- mDecompThread->notifyCompleted();
-
- if (mSkinInfoCullTimer.checkExpirationAndReset(10.f))
- {
- //// Clean up dead skin info
- //U64Bytes skinbytes(0);
- for (auto iter = mSkinMap.begin(), ender = mSkinMap.end(); iter != ender;)
- {
- auto copy_iter = iter++;
-
- //skinbytes += U64Bytes(sizeof(LLMeshSkinInfo));
- //skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(std::string));
- //skinbytes += U64Bytes(copy_iter->second->mJointNums.size() * sizeof(S32));
- //skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(LLMatrix4a));
- //skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(LLMatrix4));
-
- if (copy_iter->second->getNumRefs() == 1)
- {
- mSkinMap.erase(copy_iter);
- }
- }
- //LL_INFOS() << "Skin info cache elements:" << mSkinMap.size() << " Memory: " << U64Kilobytes(skinbytes) << LL_ENDL;
- }
-
- // For major operations, attempt to get the required locks
- // without blocking and punt if they're not available. The
- // longest run of holdoffs is kept in sMaxLockHoldoffs just
- // to collect the data. In testing, I've never seen a value
- // greater than 2 (written to log on exit).
- {
- LLMutexTrylock lock1(mMeshMutex);
- LLMutexTrylock lock2(mThread->mMutex);
-
- static U32 hold_offs(0);
- if (! lock1.isLocked() || ! lock2.isLocked())
- {
- // If we can't get the locks, skip and pick this up later.
- ++hold_offs;
- sMaxLockHoldoffs = llmax(sMaxLockHoldoffs, hold_offs);
- return;
- }
- hold_offs = 0;
-
- if (gAgent.getRegion())
- {
- // Update capability urls
- static std::string region_name("never name a region this");
-
- if (gAgent.getRegion()->getName() != region_name && gAgent.getRegion()->capabilitiesReceived())
- {
- region_name = gAgent.getRegion()->getName();
- const std::string mesh_cap(gAgent.getRegion()->getViewerAssetUrl());
- mThread->setGetMeshCap(mesh_cap);
- LL_DEBUGS(LOG_MESH) << "Retrieving caps for region '" << region_name
- << "', ViewerAsset cap: " << mesh_cap
- << LL_ENDL;
- }
- }
-
- //popup queued error messages from background threads
- while (!mUploadErrorQ.empty())
- {
- LLSD substitutions(mUploadErrorQ.front());
- if (substitutions.has("DETAILS"))
- {
- LLNotificationsUtil::add("MeshUploadErrorDetails", substitutions);
- }
- else
- {
- LLNotificationsUtil::add("MeshUploadError", substitutions);
- }
- mUploadErrorQ.pop();
- }
-
- S32 active_count = LLMeshRepoThread::sActiveHeaderRequests + LLMeshRepoThread::sActiveLODRequests;
- if (active_count < LLMeshRepoThread::sRequestLowWater)
- {
- S32 push_count = LLMeshRepoThread::sRequestHighWater - active_count;
-
- if (mPendingRequests.size() > push_count)
- {
- // More requests than the high-water limit allows so
- // sort and forward the most important.
-
- //calculate "score" for pending requests
-
- //create score map
- std::map<LLUUID, F32> score_map;
-
- for (U32 i = 0; i < LLVolumeLODGroup::NUM_LODS; ++i)
- {
- for (mesh_load_map::iterator iter = mLoadingMeshes[i].begin(); iter != mLoadingMeshes[i].end(); ++iter)
- {
- F32 max_score = 0.f;
- for (auto obj_iter = iter->second.begin(); obj_iter != iter->second.end(); ++obj_iter)
- {
- LLVOVolume* object = *obj_iter;
- if (object)
- {
- LLDrawable* drawable = object->mDrawable;
- if (drawable)
- {
- F32 cur_score = drawable->getRadius()/llmax(drawable->mDistanceWRTCamera, 1.f);
- max_score = llmax(max_score, cur_score);
- }
- }
- }
-
- score_map[iter->first] = max_score;
- }
- }
-
- //set "score" for pending requests
- for (std::vector<LLMeshRepoThread::LODRequest>::iterator iter = mPendingRequests.begin(); iter != mPendingRequests.end(); ++iter)
- {
- iter->mScore = score_map[iter->mMeshParams.getSculptID()];
- }
-
- //sort by "score"
- std::partial_sort(mPendingRequests.begin(), mPendingRequests.begin() + push_count,
- mPendingRequests.end(), LLMeshRepoThread::CompareScoreGreater());
- }
-
- while (!mPendingRequests.empty() && push_count > 0)
- {
- LLMeshRepoThread::LODRequest& request = mPendingRequests.front();
- mThread->loadMeshLOD(request.mMeshParams, request.mLOD);
- mPendingRequests.erase(mPendingRequests.begin());
- LLMeshRepository::sLODPending--;
- push_count--;
- }
- }
-
- //send skin info requests
- while (!mPendingSkinRequests.empty())
- {
- mThread->loadMeshSkinInfo(mPendingSkinRequests.front());
- mPendingSkinRequests.pop();
- }
-
- //send decomposition requests
- while (!mPendingDecompositionRequests.empty())
- {
- mThread->loadMeshDecomposition(mPendingDecompositionRequests.front());
- mPendingDecompositionRequests.pop();
- }
-
- //send physics shapes decomposition requests
- while (!mPendingPhysicsShapeRequests.empty())
- {
- mThread->loadMeshPhysicsShape(mPendingPhysicsShapeRequests.front());
- mPendingPhysicsShapeRequests.pop();
- }
-
- mThread->notifyLoadedMeshes();
- }
-
- mThread->mSignal->signal();
+
+ //clean up completed upload threads
+ for (std::vector<LLMeshUploadThread*>::iterator iter = mUploads.begin(); iter != mUploads.end(); )
+ {
+ LLMeshUploadThread* thread = *iter;
+
+ if (thread->isStopped() && thread->finished())
+ {
+ iter = mUploads.erase(iter);
+ delete thread;
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+
+ //update inventory
+ if (!mInventoryQ.empty())
+ {
+ LLMutexLock lock(mMeshMutex);
+ while (!mInventoryQ.empty())
+ {
+ inventory_data& data = mInventoryQ.front();
+
+ LLAssetType::EType asset_type = LLAssetType::lookup(data.mPostData["asset_type"].asString());
+ LLInventoryType::EType inventory_type = LLInventoryType::lookup(data.mPostData["inventory_type"].asString());
+
+ // Handle addition of texture, if any.
+ if ( data.mResponse.has("new_texture_folder_id") )
+ {
+ const LLUUID& new_folder_id = data.mResponse["new_texture_folder_id"].asUUID();
+
+ if ( new_folder_id.notNull() )
+ {
+ LLUUID parent_id = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE);
+
+ std::string name;
+ // Check if the server built a different name for the texture folder
+ if ( data.mResponse.has("new_texture_folder_name") )
+ {
+ name = data.mResponse["new_texture_folder_name"].asString();
+ }
+ else
+ {
+ name = data.mPostData["name"].asString();
+ }
+
+ // Add the category to the internal representation
+ LLPointer<LLViewerInventoryCategory> cat =
+ new LLViewerInventoryCategory(new_folder_id, parent_id,
+ LLFolderType::FT_NONE, name, gAgent.getID());
+ cat->setVersion(LLViewerInventoryCategory::VERSION_UNKNOWN);
+
+ LLInventoryModel::LLCategoryUpdate update(cat->getParentUUID(), 1);
+ gInventory.accountForUpdate(update);
+ gInventory.updateCategory(cat);
+ }
+ }
+
+ on_new_single_inventory_upload_complete(
+ asset_type,
+ inventory_type,
+ data.mPostData["asset_type"].asString(),
+ data.mPostData["folder_id"].asUUID(),
+ data.mPostData["name"],
+ data.mPostData["description"],
+ data.mResponse,
+ data.mResponse["upload_price"]);
+ //}
+
+ mInventoryQ.pop();
+ }
+ }
+
+ //call completed callbacks on finished decompositions
+ mDecompThread->notifyCompleted();
+
+ if (mSkinInfoCullTimer.checkExpirationAndReset(10.f))
+ {
+ //// Clean up dead skin info
+ //U64Bytes skinbytes(0);
+ for (auto iter = mSkinMap.begin(), ender = mSkinMap.end(); iter != ender;)
+ {
+ auto copy_iter = iter++;
+
+ //skinbytes += U64Bytes(sizeof(LLMeshSkinInfo));
+ //skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(std::string));
+ //skinbytes += U64Bytes(copy_iter->second->mJointNums.size() * sizeof(S32));
+ //skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(LLMatrix4a));
+ //skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(LLMatrix4));
+
+ if (copy_iter->second->getNumRefs() == 1)
+ {
+ mSkinMap.erase(copy_iter);
+ }
+ }
+ //LL_INFOS() << "Skin info cache elements:" << mSkinMap.size() << " Memory: " << U64Kilobytes(skinbytes) << LL_ENDL;
+ }
+
+ // For major operations, attempt to get the required locks
+ // without blocking and punt if they're not available. The
+ // longest run of holdoffs is kept in sMaxLockHoldoffs just
+ // to collect the data. In testing, I've never seen a value
+ // greater than 2 (written to log on exit).
+ {
+ LLMutexTrylock lock1(mMeshMutex);
+ LLMutexTrylock lock2(mThread->mMutex);
+
+ static U32 hold_offs(0);
+ if (! lock1.isLocked() || ! lock2.isLocked())
+ {
+ // If we can't get the locks, skip and pick this up later.
+ ++hold_offs;
+ sMaxLockHoldoffs = llmax(sMaxLockHoldoffs, hold_offs);
+ return;
+ }
+ hold_offs = 0;
+
+ if (gAgent.getRegion())
+ {
+ // Update capability urls
+ static std::string region_name("never name a region this");
+
+ if (gAgent.getRegion()->getName() != region_name && gAgent.getRegion()->capabilitiesReceived())
+ {
+ region_name = gAgent.getRegion()->getName();
+ const std::string mesh_cap(gAgent.getRegion()->getViewerAssetUrl());
+ mThread->setGetMeshCap(mesh_cap);
+ LL_DEBUGS(LOG_MESH) << "Retrieving caps for region '" << region_name
+ << "', ViewerAsset cap: " << mesh_cap
+ << LL_ENDL;
+ }
+ }
+
+ //popup queued error messages from background threads
+ while (!mUploadErrorQ.empty())
+ {
+ LLSD substitutions(mUploadErrorQ.front());
+ if (substitutions.has("DETAILS"))
+ {
+ LLNotificationsUtil::add("MeshUploadErrorDetails", substitutions);
+ }
+ else
+ {
+ LLNotificationsUtil::add("MeshUploadError", substitutions);
+ }
+ mUploadErrorQ.pop();
+ }
+
+ S32 active_count = LLMeshRepoThread::sActiveHeaderRequests + LLMeshRepoThread::sActiveLODRequests;
+ if (active_count < LLMeshRepoThread::sRequestLowWater)
+ {
+ S32 push_count = LLMeshRepoThread::sRequestHighWater - active_count;
+
+ if (mPendingRequests.size() > push_count)
+ {
+ // More requests than the high-water limit allows so
+ // sort and forward the most important.
+
+ //calculate "score" for pending requests
+
+ //create score map
+ std::map<LLUUID, F32> score_map;
+
+ for (U32 i = 0; i < LLVolumeLODGroup::NUM_LODS; ++i)
+ {
+ for (mesh_load_map::iterator iter = mLoadingMeshes[i].begin(); iter != mLoadingMeshes[i].end(); ++iter)
+ {
+ F32 max_score = 0.f;
+ for (auto obj_iter = iter->second.begin(); obj_iter != iter->second.end(); ++obj_iter)
+ {
+ LLVOVolume* object = *obj_iter;
+ if (object)
+ {
+ LLDrawable* drawable = object->mDrawable;
+ if (drawable)
+ {
+ F32 cur_score = drawable->getRadius()/llmax(drawable->mDistanceWRTCamera, 1.f);
+ max_score = llmax(max_score, cur_score);
+ }
+ }
+ }
+
+ score_map[iter->first] = max_score;
+ }
+ }
+
+ //set "score" for pending requests
+ for (std::vector<LLMeshRepoThread::LODRequest>::iterator iter = mPendingRequests.begin(); iter != mPendingRequests.end(); ++iter)
+ {
+ iter->mScore = score_map[iter->mMeshParams.getSculptID()];
+ }
+
+ //sort by "score"
+ std::partial_sort(mPendingRequests.begin(), mPendingRequests.begin() + push_count,
+ mPendingRequests.end(), LLMeshRepoThread::CompareScoreGreater());
+ }
+
+ while (!mPendingRequests.empty() && push_count > 0)
+ {
+ LLMeshRepoThread::LODRequest& request = mPendingRequests.front();
+ mThread->loadMeshLOD(request.mMeshParams, request.mLOD);
+ mPendingRequests.erase(mPendingRequests.begin());
+ LLMeshRepository::sLODPending--;
+ push_count--;
+ }
+ }
+
+ //send skin info requests
+ while (!mPendingSkinRequests.empty())
+ {
+ mThread->loadMeshSkinInfo(mPendingSkinRequests.front());
+ mPendingSkinRequests.pop();
+ }
+
+ //send decomposition requests
+ while (!mPendingDecompositionRequests.empty())
+ {
+ mThread->loadMeshDecomposition(mPendingDecompositionRequests.front());
+ mPendingDecompositionRequests.pop();
+ }
+
+ //send physics shapes decomposition requests
+ while (!mPendingPhysicsShapeRequests.empty())
+ {
+ mThread->loadMeshPhysicsShape(mPendingPhysicsShapeRequests.front());
+ mPendingPhysicsShapeRequests.pop();
+ }
+
+ mThread->notifyLoadedMeshes();
+ }
+
+ mThread->mSignal->signal();
}
void LLMeshRepository::notifySkinInfoReceived(LLMeshSkinInfo* info)
{
- mSkinMap[info->mMeshID] = info; // Cache into LLPointer
+ mSkinMap[info->mMeshID] = info; // Cache into LLPointer
// Alternative: We can get skin size from header
sCacheBytesSkins += info->sizeBytes();
- skin_load_map::iterator iter = mLoadingSkins.find(info->mMeshID);
- if (iter != mLoadingSkins.end())
- {
- for (LLVOVolume* vobj : iter->second)
- {
- if (vobj)
- {
- vobj->notifySkinInfoLoaded(info);
- }
- }
- mLoadingSkins.erase(iter);
- }
+ skin_load_map::iterator iter = mLoadingSkins.find(info->mMeshID);
+ if (iter != mLoadingSkins.end())
+ {
+ for (LLVOVolume* vobj : iter->second)
+ {
+ if (vobj)
+ {
+ vobj->notifySkinInfoLoaded(info);
+ }
+ }
+ mLoadingSkins.erase(iter);
+ }
}
void LLMeshRepository::notifySkinInfoUnavailable(const LLUUID& mesh_id)
{
- skin_load_map::iterator iter = mLoadingSkins.find(mesh_id);
- if (iter != mLoadingSkins.end())
- {
- for (LLVOVolume* vobj : iter->second)
- {
- if (vobj)
- {
- vobj->notifySkinInfoUnavailable();
- }
- }
- mLoadingSkins.erase(iter);
- }
+ skin_load_map::iterator iter = mLoadingSkins.find(mesh_id);
+ if (iter != mLoadingSkins.end())
+ {
+ for (LLVOVolume* vobj : iter->second)
+ {
+ if (vobj)
+ {
+ vobj->notifySkinInfoUnavailable();
+ }
+ }
+ mLoadingSkins.erase(iter);
+ }
}
void LLMeshRepository::notifyDecompositionReceived(LLModel::Decomposition* decomp)
{
- decomposition_map::iterator iter = mDecompositionMap.find(decomp->mMeshID);
- if (iter == mDecompositionMap.end())
- { //just insert decomp into map
- mDecompositionMap[decomp->mMeshID] = decomp;
- mLoadingDecompositions.erase(decomp->mMeshID);
+ decomposition_map::iterator iter = mDecompositionMap.find(decomp->mMeshID);
+ if (iter == mDecompositionMap.end())
+ { //just insert decomp into map
+ mDecompositionMap[decomp->mMeshID] = decomp;
+ mLoadingDecompositions.erase(decomp->mMeshID);
sCacheBytesDecomps += decomp->sizeBytes();
- }
- else
- { //merge decomp with existing entry
+ }
+ else
+ { //merge decomp with existing entry
sCacheBytesDecomps -= iter->second->sizeBytes();
- iter->second->merge(decomp);
+ iter->second->merge(decomp);
sCacheBytesDecomps += iter->second->sizeBytes();
- mLoadingDecompositions.erase(decomp->mMeshID);
- delete decomp;
- }
+ mLoadingDecompositions.erase(decomp->mMeshID);
+ delete decomp;
+ }
}
void LLMeshRepository::notifyMeshLoaded(const LLVolumeParams& mesh_params, LLVolume* volume)
{ //called from main thread
- S32 detail = LLVolumeLODGroup::getVolumeDetailFromScale(volume->getDetail());
-
- //get list of objects waiting to be notified this mesh is loaded
- const auto& mesh_id = mesh_params.getSculptID();
- mesh_load_map::iterator obj_iter = mLoadingMeshes[detail].find(mesh_id);
-
- if (volume && obj_iter != mLoadingMeshes[detail].end())
- {
- //make sure target volume is still valid
- if (volume->getNumVolumeFaces() <= 0)
- {
- LL_WARNS(LOG_MESH) << "Mesh loading returned empty volume. ID: " << mesh_id
- << LL_ENDL;
- }
-
- { //update system volume
- LLVolume* sys_volume = LLPrimitive::getVolumeManager()->refVolume(mesh_params, detail);
- if (sys_volume)
- {
- sys_volume->copyVolumeFaces(volume);
- sys_volume->setMeshAssetLoaded(true);
- LLPrimitive::getVolumeManager()->unrefVolume(sys_volume);
- }
- else
- {
- LL_WARNS(LOG_MESH) << "Couldn't find system volume for mesh " << mesh_id
- << LL_ENDL;
- }
- }
-
- //notify waiting LLVOVolume instances that their requested mesh is available
- for (LLVOVolume* vobj : obj_iter->second)
- {
- if (vobj)
- {
- vobj->notifyMeshLoaded();
- }
- }
-
- mLoadingMeshes[detail].erase(obj_iter);
-
- LLViewerStatsRecorder::instance().meshLoaded();
- }
+ S32 detail = LLVolumeLODGroup::getVolumeDetailFromScale(volume->getDetail());
+
+ //get list of objects waiting to be notified this mesh is loaded
+ const auto& mesh_id = mesh_params.getSculptID();
+ mesh_load_map::iterator obj_iter = mLoadingMeshes[detail].find(mesh_id);
+
+ if (volume && obj_iter != mLoadingMeshes[detail].end())
+ {
+ //make sure target volume is still valid
+ if (volume->getNumVolumeFaces() <= 0)
+ {
+ LL_WARNS(LOG_MESH) << "Mesh loading returned empty volume. ID: " << mesh_id
+ << LL_ENDL;
+ }
+
+ { //update system volume
+ LLVolume* sys_volume = LLPrimitive::getVolumeManager()->refVolume(mesh_params, detail);
+ if (sys_volume)
+ {
+ sys_volume->copyVolumeFaces(volume);
+ sys_volume->setMeshAssetLoaded(true);
+ LLPrimitive::getVolumeManager()->unrefVolume(sys_volume);
+ }
+ else
+ {
+ LL_WARNS(LOG_MESH) << "Couldn't find system volume for mesh " << mesh_id
+ << LL_ENDL;
+ }
+ }
+
+ //notify waiting LLVOVolume instances that their requested mesh is available
+ for (LLVOVolume* vobj : obj_iter->second)
+ {
+ if (vobj)
+ {
+ vobj->notifyMeshLoaded();
+ }
+ }
+
+ mLoadingMeshes[detail].erase(obj_iter);
+
+ LLViewerStatsRecorder::instance().meshLoaded();
+ }
}
void LLMeshRepository::notifyMeshUnavailable(const LLVolumeParams& mesh_params, S32 lod)
{ //called from main thread
- //get list of objects waiting to be notified this mesh is loaded
- const auto& mesh_id = mesh_params.getSculptID();
- mesh_load_map::iterator obj_iter = mLoadingMeshes[lod].find(mesh_id);
- if (obj_iter != mLoadingMeshes[lod].end())
- {
- F32 detail = LLVolumeLODGroup::getVolumeScaleFromDetail(lod);
+ //get list of objects waiting to be notified this mesh is loaded
+ const auto& mesh_id = mesh_params.getSculptID();
+ mesh_load_map::iterator obj_iter = mLoadingMeshes[lod].find(mesh_id);
+ if (obj_iter != mLoadingMeshes[lod].end())
+ {
+ F32 detail = LLVolumeLODGroup::getVolumeScaleFromDetail(lod);
LLVolume* sys_volume = LLPrimitive::getVolumeManager()->refVolume(mesh_params, lod);
if (sys_volume)
@@ -4109,28 +4109,28 @@ void LLMeshRepository::notifyMeshUnavailable(const LLVolumeParams& mesh_params,
LLPrimitive::getVolumeManager()->unrefVolume(sys_volume);
}
- for (LLVOVolume* vobj : obj_iter->second)
- {
- if (vobj)
- {
- LLVolume* obj_volume = vobj->getVolume();
+ for (LLVOVolume* vobj : obj_iter->second)
+ {
+ if (vobj)
+ {
+ LLVolume* obj_volume = vobj->getVolume();
+
+ if (obj_volume &&
+ obj_volume->getDetail() == detail &&
+ obj_volume->getParams() == mesh_params)
+ { //should force volume to find most appropriate LOD
+ vobj->setVolume(obj_volume->getParams(), lod);
+ }
+ }
+ }
- if (obj_volume &&
- obj_volume->getDetail() == detail &&
- obj_volume->getParams() == mesh_params)
- { //should force volume to find most appropriate LOD
- vobj->setVolume(obj_volume->getParams(), lod);
- }
- }
- }
-
- mLoadingMeshes[lod].erase(obj_iter);
- }
+ mLoadingMeshes[lod].erase(obj_iter);
+ }
}
S32 LLMeshRepository::getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
-{
- return mThread->getActualMeshLOD(mesh_params, lod);
+{
+ return mThread->getActualMeshLOD(mesh_params, lod);
}
const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj)
@@ -4150,98 +4150,98 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, LLVOV
LLMutexLock lock(mMeshMutex);
//add volume to list of loading meshes
skin_load_map::iterator iter = mLoadingSkins.find(mesh_id);
- if (iter != mLoadingSkins.end())
- { //request pending for this mesh, append volume id to list
- auto it = std::find(iter->second.begin(), iter->second.end(), requesting_obj);
- if (it == iter->second.end()) {
- iter->second.push_back(requesting_obj);
- }
- }
- else
- {
- //first request for this mesh
- mLoadingSkins[mesh_id].push_back(requesting_obj);
+ if (iter != mLoadingSkins.end())
+ { //request pending for this mesh, append volume id to list
+ auto it = std::find(iter->second.begin(), iter->second.end(), requesting_obj);
+ if (it == iter->second.end()) {
+ iter->second.push_back(requesting_obj);
+ }
+ }
+ else
+ {
+ //first request for this mesh
+ mLoadingSkins[mesh_id].push_back(requesting_obj);
mPendingSkinRequests.push(mesh_id);
}
}
}
- return nullptr;
+ return nullptr;
}
void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; //LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH);
- if (mesh_id.notNull())
- {
- LLModel::Decomposition* decomp = NULL;
- decomposition_map::iterator iter = mDecompositionMap.find(mesh_id);
- if (iter != mDecompositionMap.end())
- {
- decomp = iter->second;
- }
-
- //decomposition block hasn't been fetched yet
- if (!decomp || decomp->mPhysicsShapeMesh.empty())
- {
- LLMutexLock lock(mMeshMutex);
- //add volume to list of loading meshes
- std::set<LLUUID>::iterator iter = mLoadingPhysicsShapes.find(mesh_id);
- if (iter == mLoadingPhysicsShapes.end())
- { //no request pending for this skin info
- // *FIXME: Nothing ever deletes entries, can't be right
- mLoadingPhysicsShapes.insert(mesh_id);
- mPendingPhysicsShapeRequests.push(mesh_id);
- }
- }
- }
+ if (mesh_id.notNull())
+ {
+ LLModel::Decomposition* decomp = NULL;
+ decomposition_map::iterator iter = mDecompositionMap.find(mesh_id);
+ if (iter != mDecompositionMap.end())
+ {
+ decomp = iter->second;
+ }
+
+ //decomposition block hasn't been fetched yet
+ if (!decomp || decomp->mPhysicsShapeMesh.empty())
+ {
+ LLMutexLock lock(mMeshMutex);
+ //add volume to list of loading meshes
+ std::set<LLUUID>::iterator iter = mLoadingPhysicsShapes.find(mesh_id);
+ if (iter == mLoadingPhysicsShapes.end())
+ { //no request pending for this skin info
+ // *FIXME: Nothing ever deletes entries, can't be right
+ mLoadingPhysicsShapes.insert(mesh_id);
+ mPendingPhysicsShapeRequests.push(mesh_id);
+ }
+ }
+ }
}
LLModel::Decomposition* LLMeshRepository::getDecomposition(const LLUUID& mesh_id)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; //LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH);
- LLModel::Decomposition* ret = NULL;
-
- if (mesh_id.notNull())
- {
- decomposition_map::iterator iter = mDecompositionMap.find(mesh_id);
- if (iter != mDecompositionMap.end())
- {
- ret = iter->second;
- }
-
- //decomposition block hasn't been fetched yet
- if (!ret || ret->mBaseHullMesh.empty())
- {
- LLMutexLock lock(mMeshMutex);
- //add volume to list of loading meshes
- std::set<LLUUID>::iterator iter = mLoadingDecompositions.find(mesh_id);
- if (iter == mLoadingDecompositions.end())
- { //no request pending for this skin info
- mLoadingDecompositions.insert(mesh_id);
- mPendingDecompositionRequests.push(mesh_id);
- }
- }
- }
-
- return ret;
+ LLModel::Decomposition* ret = NULL;
+
+ if (mesh_id.notNull())
+ {
+ decomposition_map::iterator iter = mDecompositionMap.find(mesh_id);
+ if (iter != mDecompositionMap.end())
+ {
+ ret = iter->second;
+ }
+
+ //decomposition block hasn't been fetched yet
+ if (!ret || ret->mBaseHullMesh.empty())
+ {
+ LLMutexLock lock(mMeshMutex);
+ //add volume to list of loading meshes
+ std::set<LLUUID>::iterator iter = mLoadingDecompositions.find(mesh_id);
+ if (iter == mLoadingDecompositions.end())
+ { //no request pending for this skin info
+ mLoadingDecompositions.insert(mesh_id);
+ mPendingDecompositionRequests.push(mesh_id);
+ }
+ }
+ }
+
+ return ret;
}
void LLMeshRepository::buildHull(const LLVolumeParams& params, S32 detail)
{
- LLVolume* volume = LLPrimitive::sVolumeManager->refVolume(params, detail);
+ LLVolume* volume = LLPrimitive::sVolumeManager->refVolume(params, detail);
- if (!volume->mHullPoints)
- {
- //all default params
- //execute first stage
- //set simplify mode to retain
- //set retain percentage to zero
- //run second stage
- }
+ if (!volume->mHullPoints)
+ {
+ //all default params
+ //execute first stage
+ //set simplify mode to retain
+ //set retain percentage to zero
+ //run second stage
+ }
- LLPrimitive::sVolumeManager->unrefVolume(volume);
+ LLPrimitive::sVolumeManager->unrefVolume(volume);
}
bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id)
@@ -4337,93 +4337,93 @@ bool LLMeshRepoThread::hasHeader(const LLUUID& mesh_id)
}
void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures,
- bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position,
+ bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position,
std::string upload_url, bool do_upload,
- LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer)
+ LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer)
{
- LLMeshUploadThread* thread = new LLMeshUploadThread(data, scale, upload_textures,
- upload_skin, upload_joints, lock_scale_if_joint_position,
+ LLMeshUploadThread* thread = new LLMeshUploadThread(data, scale, upload_textures,
+ upload_skin, upload_joints, lock_scale_if_joint_position,
upload_url, do_upload, fee_observer, upload_observer);
- mUploadWaitList.push_back(thread);
+ mUploadWaitList.push_back(thread);
}
S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- if (mThread && mesh_id.notNull() && LLPrimitive::NO_LOD != lod)
- {
- LLMutexLock lock(mThread->mHeaderMutex);
- LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id);
- if (iter != mThread->mMeshHeader.end() && iter->second.first > 0)
- {
- const LLMeshHeader& header = iter->second.second;
-
- if (header.m404)
- {
- return -1;
- }
+ if (mThread && mesh_id.notNull() && LLPrimitive::NO_LOD != lod)
+ {
+ LLMutexLock lock(mThread->mHeaderMutex);
+ LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id);
+ if (iter != mThread->mMeshHeader.end() && iter->second.first > 0)
+ {
+ const LLMeshHeader& header = iter->second.second;
+
+ if (header.m404)
+ {
+ return -1;
+ }
S32 size = header.mLodSize[lod];
- return size;
- }
+ return size;
+ }
- }
+ }
- return -1;
+ return -1;
}
void LLMeshUploadThread::decomposeMeshMatrix(LLMatrix4& transformation,
- LLVector3& result_pos,
- LLQuaternion& result_rot,
- LLVector3& result_scale)
+ LLVector3& result_pos,
+ LLQuaternion& result_rot,
+ LLVector3& result_scale)
{
- // check for reflection
- BOOL reflected = (transformation.determinant() < 0);
+ // check for reflection
+ BOOL reflected = (transformation.determinant() < 0);
- // compute position
- LLVector3 position = LLVector3(0, 0, 0) * transformation;
+ // compute position
+ LLVector3 position = LLVector3(0, 0, 0) * transformation;
- // compute scale
- LLVector3 x_transformed = LLVector3(1, 0, 0) * transformation - position;
- LLVector3 y_transformed = LLVector3(0, 1, 0) * transformation - position;
- LLVector3 z_transformed = LLVector3(0, 0, 1) * transformation - position;
- F32 x_length = x_transformed.normalize();
- F32 y_length = y_transformed.normalize();
- F32 z_length = z_transformed.normalize();
- LLVector3 scale = LLVector3(x_length, y_length, z_length);
+ // compute scale
+ LLVector3 x_transformed = LLVector3(1, 0, 0) * transformation - position;
+ LLVector3 y_transformed = LLVector3(0, 1, 0) * transformation - position;
+ LLVector3 z_transformed = LLVector3(0, 0, 1) * transformation - position;
+ F32 x_length = x_transformed.normalize();
+ F32 y_length = y_transformed.normalize();
+ F32 z_length = z_transformed.normalize();
+ LLVector3 scale = LLVector3(x_length, y_length, z_length);
// adjust for "reflected" geometry
- LLVector3 x_transformed_reflected = x_transformed;
- if (reflected)
- {
- x_transformed_reflected *= -1.0;
- }
-
- // compute rotation
- LLMatrix3 rotation_matrix;
- rotation_matrix.setRows(x_transformed_reflected, y_transformed, z_transformed);
- LLQuaternion quat_rotation = rotation_matrix.quaternion();
- quat_rotation.normalize(); // the rotation_matrix might not have been orthoginal. make it so here.
- LLVector3 euler_rotation;
- quat_rotation.getEulerAngles(&euler_rotation.mV[VX], &euler_rotation.mV[VY], &euler_rotation.mV[VZ]);
-
- result_pos = position + mOrigin;
- result_scale = scale;
- result_rot = quat_rotation;
+ LLVector3 x_transformed_reflected = x_transformed;
+ if (reflected)
+ {
+ x_transformed_reflected *= -1.0;
+ }
+
+ // compute rotation
+ LLMatrix3 rotation_matrix;
+ rotation_matrix.setRows(x_transformed_reflected, y_transformed, z_transformed);
+ LLQuaternion quat_rotation = rotation_matrix.quaternion();
+ quat_rotation.normalize(); // the rotation_matrix might not have been orthoginal. make it so here.
+ LLVector3 euler_rotation;
+ quat_rotation.getEulerAngles(&euler_rotation.mV[VX], &euler_rotation.mV[VY], &euler_rotation.mV[VZ]);
+
+ result_pos = position + mOrigin;
+ result_scale = scale;
+ result_rot = quat_rotation;
}
void LLMeshRepository::updateInventory(inventory_data data)
{
- LLMutexLock lock(mMeshMutex);
- dump_llsd_to_file(data.mPostData,make_dump_name("update_inventory_post_data_",dump_num));
- dump_llsd_to_file(data.mResponse,make_dump_name("update_inventory_response_",dump_num));
- mInventoryQ.push(data);
+ LLMutexLock lock(mMeshMutex);
+ dump_llsd_to_file(data.mPostData,make_dump_name("update_inventory_post_data_",dump_num));
+ dump_llsd_to_file(data.mResponse,make_dump_name("update_inventory_response_",dump_num));
+ mInventoryQ.push(data);
}
void LLMeshRepository::uploadError(LLSD& args)
{
- LLMutexLock lock(mMeshMutex);
- mUploadErrorQ.push(args);
+ LLMutexLock lock(mMeshMutex);
+ mUploadErrorQ.push(args);
}
F32 LLMeshRepository::getEstTrianglesMax(LLUUID mesh_id)
@@ -4455,7 +4455,7 @@ F32 LLMeshRepository::getEstTrianglesStreamingCost(LLUUID mesh_id)
// FIXME replace with calc based on LLMeshCostData
F32 LLMeshRepository::getStreamingCostLegacy(LLUUID mesh_id, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value)
{
- F32 result = 0.f;
+ F32 result = 0.f;
if (mThread && mesh_id.notNull())
{
LLMutexLock lock(mThread->mHeaderMutex);
@@ -4501,109 +4501,109 @@ F32 LLMeshRepository::getStreamingCostLegacy(LLUUID mesh_id, F32 radius, S32* by
//static
F32 LLMeshRepository::getStreamingCostLegacy(LLMeshHeader& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value)
{
- if (header.m404
- || header.mLodSize[0] <= 0
- || (header.mVersion > MAX_MESH_VERSION))
- {
- return 0.f;
- }
-
- F32 max_distance = 512.f;
-
- F32 dlowest = llmin(radius/0.03f, max_distance);
- F32 dlow = llmin(radius/0.06f, max_distance);
- F32 dmid = llmin(radius/0.24f, max_distance);
-
- static LLCachedControl<U32> metadata_discount_ch(gSavedSettings, "MeshMetaDataDiscount", 384); //discount 128 bytes to cover the cost of LLSD tags and compression domain overhead
- static LLCachedControl<U32> minimum_size_ch(gSavedSettings, "MeshMinimumByteSize", 16); //make sure nothing is "free"
- static LLCachedControl<U32> bytes_per_triangle_ch(gSavedSettings, "MeshBytesPerTriangle", 16);
-
- F32 metadata_discount = (F32)metadata_discount_ch;
- F32 minimum_size = (F32)minimum_size_ch;
- F32 bytes_per_triangle = (F32)bytes_per_triangle_ch;
-
- S32 bytes_lowest = header.mLodSize[0];
- S32 bytes_low = header.mLodSize[1];
- S32 bytes_mid = header.mLodSize[2];
- S32 bytes_high = header.mLodSize[3];
-
- if (bytes_high == 0)
- {
- return 0.f;
- }
-
- if (bytes_mid == 0)
- {
- bytes_mid = bytes_high;
- }
-
- if (bytes_low == 0)
- {
- bytes_low = bytes_mid;
- }
-
- if (bytes_lowest == 0)
- {
- bytes_lowest = bytes_low;
- }
-
- F32 triangles_lowest = llmax((F32) bytes_lowest-metadata_discount, minimum_size)/bytes_per_triangle;
- F32 triangles_low = llmax((F32) bytes_low-metadata_discount, minimum_size)/bytes_per_triangle;
- F32 triangles_mid = llmax((F32) bytes_mid-metadata_discount, minimum_size)/bytes_per_triangle;
- F32 triangles_high = llmax((F32) bytes_high-metadata_discount, minimum_size)/bytes_per_triangle;
-
- if (bytes)
- {
- *bytes = 0;
- *bytes += header.mLodSize[0];
- *bytes += header.mLodSize[1];
- *bytes += header.mLodSize[2];
- *bytes += header.mLodSize[3];
- }
-
- if (bytes_visible)
- {
- lod = LLMeshRepository::getActualMeshLOD(header, lod);
- if (lod >= 0 && lod <= 3)
- {
- *bytes_visible = header.mLodSize[lod];
- }
- }
-
- F32 max_area = 102944.f; //area of circle that encompasses region (see MAINT-6559)
- F32 min_area = 1.f;
-
- F32 high_area = llmin(F_PI*dmid*dmid, max_area);
- F32 mid_area = llmin(F_PI*dlow*dlow, max_area);
- F32 low_area = llmin(F_PI*dlowest*dlowest, max_area);
- F32 lowest_area = max_area;
-
- lowest_area -= low_area;
- low_area -= mid_area;
- mid_area -= high_area;
-
- high_area = llclamp(high_area, min_area, max_area);
- mid_area = llclamp(mid_area, min_area, max_area);
- low_area = llclamp(low_area, min_area, max_area);
- lowest_area = llclamp(lowest_area, min_area, max_area);
-
- F32 total_area = high_area + mid_area + low_area + lowest_area;
- high_area /= total_area;
- mid_area /= total_area;
- low_area /= total_area;
- lowest_area /= total_area;
-
- F32 weighted_avg = triangles_high*high_area +
- triangles_mid*mid_area +
- triangles_low*low_area +
- triangles_lowest*lowest_area;
-
- if (unscaled_value)
- {
- *unscaled_value = weighted_avg;
- }
-
- return weighted_avg/gSavedSettings.getU32("MeshTriangleBudget")*15000.f;
+ if (header.m404
+ || header.mLodSize[0] <= 0
+ || (header.mVersion > MAX_MESH_VERSION))
+ {
+ return 0.f;
+ }
+
+ F32 max_distance = 512.f;
+
+ F32 dlowest = llmin(radius/0.03f, max_distance);
+ F32 dlow = llmin(radius/0.06f, max_distance);
+ F32 dmid = llmin(radius/0.24f, max_distance);
+
+ static LLCachedControl<U32> metadata_discount_ch(gSavedSettings, "MeshMetaDataDiscount", 384); //discount 128 bytes to cover the cost of LLSD tags and compression domain overhead
+ static LLCachedControl<U32> minimum_size_ch(gSavedSettings, "MeshMinimumByteSize", 16); //make sure nothing is "free"
+ static LLCachedControl<U32> bytes_per_triangle_ch(gSavedSettings, "MeshBytesPerTriangle", 16);
+
+ F32 metadata_discount = (F32)metadata_discount_ch;
+ F32 minimum_size = (F32)minimum_size_ch;
+ F32 bytes_per_triangle = (F32)bytes_per_triangle_ch;
+
+ S32 bytes_lowest = header.mLodSize[0];
+ S32 bytes_low = header.mLodSize[1];
+ S32 bytes_mid = header.mLodSize[2];
+ S32 bytes_high = header.mLodSize[3];
+
+ if (bytes_high == 0)
+ {
+ return 0.f;
+ }
+
+ if (bytes_mid == 0)
+ {
+ bytes_mid = bytes_high;
+ }
+
+ if (bytes_low == 0)
+ {
+ bytes_low = bytes_mid;
+ }
+
+ if (bytes_lowest == 0)
+ {
+ bytes_lowest = bytes_low;
+ }
+
+ F32 triangles_lowest = llmax((F32) bytes_lowest-metadata_discount, minimum_size)/bytes_per_triangle;
+ F32 triangles_low = llmax((F32) bytes_low-metadata_discount, minimum_size)/bytes_per_triangle;
+ F32 triangles_mid = llmax((F32) bytes_mid-metadata_discount, minimum_size)/bytes_per_triangle;
+ F32 triangles_high = llmax((F32) bytes_high-metadata_discount, minimum_size)/bytes_per_triangle;
+
+ if (bytes)
+ {
+ *bytes = 0;
+ *bytes += header.mLodSize[0];
+ *bytes += header.mLodSize[1];
+ *bytes += header.mLodSize[2];
+ *bytes += header.mLodSize[3];
+ }
+
+ if (bytes_visible)
+ {
+ lod = LLMeshRepository::getActualMeshLOD(header, lod);
+ if (lod >= 0 && lod <= 3)
+ {
+ *bytes_visible = header.mLodSize[lod];
+ }
+ }
+
+ F32 max_area = 102944.f; //area of circle that encompasses region (see MAINT-6559)
+ F32 min_area = 1.f;
+
+ F32 high_area = llmin(F_PI*dmid*dmid, max_area);
+ F32 mid_area = llmin(F_PI*dlow*dlow, max_area);
+ F32 low_area = llmin(F_PI*dlowest*dlowest, max_area);
+ F32 lowest_area = max_area;
+
+ lowest_area -= low_area;
+ low_area -= mid_area;
+ mid_area -= high_area;
+
+ high_area = llclamp(high_area, min_area, max_area);
+ mid_area = llclamp(mid_area, min_area, max_area);
+ low_area = llclamp(low_area, min_area, max_area);
+ lowest_area = llclamp(lowest_area, min_area, max_area);
+
+ F32 total_area = high_area + mid_area + low_area + lowest_area;
+ high_area /= total_area;
+ mid_area /= total_area;
+ low_area /= total_area;
+ lowest_area /= total_area;
+
+ F32 weighted_avg = triangles_high*high_area +
+ triangles_mid*mid_area +
+ triangles_low*low_area +
+ triangles_lowest*lowest_area;
+
+ if (unscaled_value)
+ {
+ *unscaled_value = weighted_avg;
+ }
+
+ return weighted_avg/gSavedSettings.getU32("MeshTriangleBudget")*15000.f;
}
LLMeshCostData::LLMeshCostData()
@@ -4615,10 +4615,10 @@ LLMeshCostData::LLMeshCostData()
bool LLMeshCostData::init(const LLMeshHeader& header)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
-
+
std::fill(mSizeByLOD.begin(), mSizeByLOD.end(), 0);
std::fill(mEstTrisByLOD.begin(), mEstTrisByLOD.end(), 0.f);
-
+
S32 bytes_high = header.mLodSize[3];
S32 bytes_med = header.mLodSize[2];
if (bytes_med == 0)
@@ -4683,44 +4683,44 @@ F32 LLMeshCostData::getEstTrisMax()
F32 LLMeshCostData::getRadiusWeightedTris(F32 radius)
{
- F32 max_distance = 512.f;
-
- F32 dlowest = llmin(radius/0.03f, max_distance);
- F32 dlow = llmin(radius/0.06f, max_distance);
- F32 dmid = llmin(radius/0.24f, max_distance);
-
- F32 triangles_lowest = mEstTrisByLOD[0];
- F32 triangles_low = mEstTrisByLOD[1];
- F32 triangles_mid = mEstTrisByLOD[2];
- F32 triangles_high = mEstTrisByLOD[3];
-
- F32 max_area = 102944.f; //area of circle that encompasses region (see MAINT-6559)
- F32 min_area = 1.f;
-
- F32 high_area = llmin(F_PI*dmid*dmid, max_area);
- F32 mid_area = llmin(F_PI*dlow*dlow, max_area);
- F32 low_area = llmin(F_PI*dlowest*dlowest, max_area);
- F32 lowest_area = max_area;
-
- lowest_area -= low_area;
- low_area -= mid_area;
- mid_area -= high_area;
-
- high_area = llclamp(high_area, min_area, max_area);
- mid_area = llclamp(mid_area, min_area, max_area);
- low_area = llclamp(low_area, min_area, max_area);
- lowest_area = llclamp(lowest_area, min_area, max_area);
-
- F32 total_area = high_area + mid_area + low_area + lowest_area;
- high_area /= total_area;
- mid_area /= total_area;
- low_area /= total_area;
- lowest_area /= total_area;
-
- F32 weighted_avg = triangles_high*high_area +
- triangles_mid*mid_area +
- triangles_low*low_area +
- triangles_lowest*lowest_area;
+ F32 max_distance = 512.f;
+
+ F32 dlowest = llmin(radius/0.03f, max_distance);
+ F32 dlow = llmin(radius/0.06f, max_distance);
+ F32 dmid = llmin(radius/0.24f, max_distance);
+
+ F32 triangles_lowest = mEstTrisByLOD[0];
+ F32 triangles_low = mEstTrisByLOD[1];
+ F32 triangles_mid = mEstTrisByLOD[2];
+ F32 triangles_high = mEstTrisByLOD[3];
+
+ F32 max_area = 102944.f; //area of circle that encompasses region (see MAINT-6559)
+ F32 min_area = 1.f;
+
+ F32 high_area = llmin(F_PI*dmid*dmid, max_area);
+ F32 mid_area = llmin(F_PI*dlow*dlow, max_area);
+ F32 low_area = llmin(F_PI*dlowest*dlowest, max_area);
+ F32 lowest_area = max_area;
+
+ lowest_area -= low_area;
+ low_area -= mid_area;
+ mid_area -= high_area;
+
+ high_area = llclamp(high_area, min_area, max_area);
+ mid_area = llclamp(mid_area, min_area, max_area);
+ low_area = llclamp(low_area, min_area, max_area);
+ lowest_area = llclamp(lowest_area, min_area, max_area);
+
+ F32 total_area = high_area + mid_area + low_area + lowest_area;
+ high_area /= total_area;
+ mid_area /= total_area;
+ low_area /= total_area;
+ lowest_area /= total_area;
+
+ F32 weighted_avg = triangles_high*high_area +
+ triangles_mid*mid_area +
+ triangles_low*low_area +
+ triangles_lowest*lowest_area;
return weighted_avg;
}
@@ -4754,7 +4754,7 @@ F32 LLMeshCostData::getEstTrisForStreamingCost()
F32 LLMeshCostData::getRadiusBasedStreamingCost(F32 radius)
{
- return getRadiusWeightedTris(radius)/gSavedSettings.getU32("MeshTriangleBudget")*15000.f;
+ return getRadiusWeightedTris(radius)/gSavedSettings.getU32("MeshTriangleBudget")*15000.f;
}
F32 LLMeshCostData::getTriangleBasedStreamingCost()
@@ -4767,7 +4767,7 @@ bool LLMeshRepository::getCostData(LLUUID mesh_id, LLMeshCostData& data)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
data = LLMeshCostData();
-
+
if (mThread && mesh_id.notNull())
{
LLMutexLock lock(mThread->mHeaderMutex);
@@ -4798,606 +4798,606 @@ bool LLMeshRepository::getCostData(LLMeshHeader& header, LLMeshCostData& data)
{
return false;
}
-
+
return true;
}
LLPhysicsDecomp::LLPhysicsDecomp()
: LLThread("Physics Decomp")
{
- mInited = false;
- mQuitting = false;
- mDone = false;
+ mInited = false;
+ mQuitting = false;
+ mDone = false;
- mSignal = new LLCondition();
- mMutex = new LLMutex();
+ mSignal = new LLCondition();
+ mMutex = new LLMutex();
}
LLPhysicsDecomp::~LLPhysicsDecomp()
{
- shutdown();
+ shutdown();
- delete mSignal;
- mSignal = NULL;
- delete mMutex;
- mMutex = NULL;
+ delete mSignal;
+ mSignal = NULL;
+ delete mMutex;
+ mMutex = NULL;
}
void LLPhysicsDecomp::shutdown()
{
- if (mSignal)
- {
- mQuitting = true;
- // There is only one wait(), but just in case 'broadcast'
- mSignal->broadcast();
+ if (mSignal)
+ {
+ mQuitting = true;
+ // There is only one wait(), but just in case 'broadcast'
+ mSignal->broadcast();
- while (!isStopped())
- {
- apr_sleep(10);
- }
- }
+ while (!isStopped())
+ {
+ apr_sleep(10);
+ }
+ }
}
void LLPhysicsDecomp::submitRequest(LLPhysicsDecomp::Request* request)
{
- LLMutexLock lock(mMutex);
- mRequestQ.push(request);
- mSignal->signal();
+ LLMutexLock lock(mMutex);
+ mRequestQ.push(request);
+ mSignal->signal();
}
//static
S32 LLPhysicsDecomp::llcdCallback(const char* status, S32 p1, S32 p2)
-{
- if (gMeshRepo.mDecompThread && gMeshRepo.mDecompThread->mCurRequest.notNull())
- {
- return gMeshRepo.mDecompThread->mCurRequest->statusCallback(status, p1, p2);
- }
+{
+ if (gMeshRepo.mDecompThread && gMeshRepo.mDecompThread->mCurRequest.notNull())
+ {
+ return gMeshRepo.mDecompThread->mCurRequest->statusCallback(status, p1, p2);
+ }
- return 1;
+ return 1;
}
void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based)
{
- mesh.mVertexBase = mCurRequest->mPositions[0].mV;
- mesh.mVertexStrideBytes = 12;
- mesh.mNumVertices = mCurRequest->mPositions.size();
-
- if(!vertex_based)
- {
- mesh.mIndexType = LLCDMeshData::INT_16;
- mesh.mIndexBase = &(mCurRequest->mIndices[0]);
- mesh.mIndexStrideBytes = 6;
-
- mesh.mNumTriangles = mCurRequest->mIndices.size()/3;
- }
-
- if ((vertex_based || mesh.mNumTriangles > 0) && mesh.mNumVertices > 2)
- {
- LLCDResult ret = LLCD_OK;
- if (LLConvexDecomposition::getInstance() != NULL)
- {
- ret = LLConvexDecomposition::getInstance()->setMeshData(&mesh, vertex_based);
- }
-
- if (ret)
- {
- LL_ERRS(LOG_MESH) << "Convex Decomposition thread valid but could not set mesh data." << LL_ENDL;
- }
- }
+ mesh.mVertexBase = mCurRequest->mPositions[0].mV;
+ mesh.mVertexStrideBytes = 12;
+ mesh.mNumVertices = mCurRequest->mPositions.size();
+
+ if(!vertex_based)
+ {
+ mesh.mIndexType = LLCDMeshData::INT_16;
+ mesh.mIndexBase = &(mCurRequest->mIndices[0]);
+ mesh.mIndexStrideBytes = 6;
+
+ mesh.mNumTriangles = mCurRequest->mIndices.size()/3;
+ }
+
+ if ((vertex_based || mesh.mNumTriangles > 0) && mesh.mNumVertices > 2)
+ {
+ LLCDResult ret = LLCD_OK;
+ if (LLConvexDecomposition::getInstance() != NULL)
+ {
+ ret = LLConvexDecomposition::getInstance()->setMeshData(&mesh, vertex_based);
+ }
+
+ if (ret)
+ {
+ LL_ERRS(LOG_MESH) << "Convex Decomposition thread valid but could not set mesh data." << LL_ENDL;
+ }
+ }
}
void LLPhysicsDecomp::doDecomposition()
{
- LLCDMeshData mesh;
- S32 stage = mStageID[mCurRequest->mStage];
-
- if (LLConvexDecomposition::getInstance() == NULL)
- {
- // stub library. do nothing.
- return;
- }
-
- //load data intoLLCD
- if (stage == 0)
- {
- setMeshData(mesh, false);
- }
-
- //build parameter map
- std::map<std::string, const LLCDParam*> param_map;
-
- static const LLCDParam* params = NULL;
- static S32 param_count = 0;
- if (!params)
- {
- param_count = LLConvexDecomposition::getInstance()->getParameters(&params);
- }
-
- for (S32 i = 0; i < param_count; ++i)
- {
- param_map[params[i].mName] = params+i;
- }
-
- U32 ret = LLCD_OK;
- //set parameter values
- for (decomp_params::iterator iter = mCurRequest->mParams.begin(); iter != mCurRequest->mParams.end(); ++iter)
- {
- const std::string& name = iter->first;
- const LLSD& value = iter->second;
-
- const LLCDParam* param = param_map[name];
-
- if (param == NULL)
- { //couldn't find valid parameter
- continue;
- }
-
-
- if (param->mType == LLCDParam::LLCD_FLOAT)
- {
- ret = LLConvexDecomposition::getInstance()->setParam(param->mName, (F32) value.asReal());
- }
- else if (param->mType == LLCDParam::LLCD_INTEGER ||
- param->mType == LLCDParam::LLCD_ENUM)
- {
- ret = LLConvexDecomposition::getInstance()->setParam(param->mName, value.asInteger());
- }
- else if (param->mType == LLCDParam::LLCD_BOOLEAN)
- {
- ret = LLConvexDecomposition::getInstance()->setParam(param->mName, value.asBoolean());
- }
- }
-
- mCurRequest->setStatusMessage("Executing.");
-
- if (LLConvexDecomposition::getInstance() != NULL)
- {
- ret = LLConvexDecomposition::getInstance()->executeStage(stage);
- }
-
- if (ret)
- {
- LL_WARNS(LOG_MESH) << "Convex Decomposition thread valid but could not execute stage " << stage << "."
- << LL_ENDL;
- LLMutexLock lock(mMutex);
-
- mCurRequest->mHull.clear();
- mCurRequest->mHullMesh.clear();
-
- mCurRequest->setStatusMessage("FAIL");
-
- completeCurrent();
- }
- else
- {
- mCurRequest->setStatusMessage("Reading results");
-
- S32 num_hulls =0;
- if (LLConvexDecomposition::getInstance() != NULL)
- {
- num_hulls = LLConvexDecomposition::getInstance()->getNumHullsFromStage(stage);
- }
-
- {
- LLMutexLock lock(mMutex);
- mCurRequest->mHull.clear();
- mCurRequest->mHull.resize(num_hulls);
-
- mCurRequest->mHullMesh.clear();
- mCurRequest->mHullMesh.resize(num_hulls);
- }
-
- for (S32 i = 0; i < num_hulls; ++i)
- {
- std::vector<LLVector3> p;
- LLCDHull hull;
- // if LLConvexDecomposition is a stub, num_hulls should have been set to 0 above, and we should not reach this code
- LLConvexDecomposition::getInstance()->getHullFromStage(stage, i, &hull);
-
- const F32* v = hull.mVertexBase;
-
- for (S32 j = 0; j < hull.mNumVertices; ++j)
- {
- LLVector3 vert(v[0], v[1], v[2]);
- p.push_back(vert);
- v = (F32*) (((U8*) v) + hull.mVertexStrideBytes);
- }
-
- LLCDMeshData mesh;
- // if LLConvexDecomposition is a stub, num_hulls should have been set to 0 above, and we should not reach this code
- LLConvexDecomposition::getInstance()->getMeshFromStage(stage, i, &mesh);
-
- get_vertex_buffer_from_mesh(mesh, mCurRequest->mHullMesh[i]);
-
- {
- LLMutexLock lock(mMutex);
- mCurRequest->mHull[i] = p;
- }
- }
-
- {
- LLMutexLock lock(mMutex);
- mCurRequest->setStatusMessage("FAIL");
- completeCurrent();
- }
- }
+ LLCDMeshData mesh;
+ S32 stage = mStageID[mCurRequest->mStage];
+
+ if (LLConvexDecomposition::getInstance() == NULL)
+ {
+ // stub library. do nothing.
+ return;
+ }
+
+ //load data intoLLCD
+ if (stage == 0)
+ {
+ setMeshData(mesh, false);
+ }
+
+ //build parameter map
+ std::map<std::string, const LLCDParam*> param_map;
+
+ static const LLCDParam* params = NULL;
+ static S32 param_count = 0;
+ if (!params)
+ {
+ param_count = LLConvexDecomposition::getInstance()->getParameters(&params);
+ }
+
+ for (S32 i = 0; i < param_count; ++i)
+ {
+ param_map[params[i].mName] = params+i;
+ }
+
+ U32 ret = LLCD_OK;
+ //set parameter values
+ for (decomp_params::iterator iter = mCurRequest->mParams.begin(); iter != mCurRequest->mParams.end(); ++iter)
+ {
+ const std::string& name = iter->first;
+ const LLSD& value = iter->second;
+
+ const LLCDParam* param = param_map[name];
+
+ if (param == NULL)
+ { //couldn't find valid parameter
+ continue;
+ }
+
+
+ if (param->mType == LLCDParam::LLCD_FLOAT)
+ {
+ ret = LLConvexDecomposition::getInstance()->setParam(param->mName, (F32) value.asReal());
+ }
+ else if (param->mType == LLCDParam::LLCD_INTEGER ||
+ param->mType == LLCDParam::LLCD_ENUM)
+ {
+ ret = LLConvexDecomposition::getInstance()->setParam(param->mName, value.asInteger());
+ }
+ else if (param->mType == LLCDParam::LLCD_BOOLEAN)
+ {
+ ret = LLConvexDecomposition::getInstance()->setParam(param->mName, value.asBoolean());
+ }
+ }
+
+ mCurRequest->setStatusMessage("Executing.");
+
+ if (LLConvexDecomposition::getInstance() != NULL)
+ {
+ ret = LLConvexDecomposition::getInstance()->executeStage(stage);
+ }
+
+ if (ret)
+ {
+ LL_WARNS(LOG_MESH) << "Convex Decomposition thread valid but could not execute stage " << stage << "."
+ << LL_ENDL;
+ LLMutexLock lock(mMutex);
+
+ mCurRequest->mHull.clear();
+ mCurRequest->mHullMesh.clear();
+
+ mCurRequest->setStatusMessage("FAIL");
+
+ completeCurrent();
+ }
+ else
+ {
+ mCurRequest->setStatusMessage("Reading results");
+
+ S32 num_hulls =0;
+ if (LLConvexDecomposition::getInstance() != NULL)
+ {
+ num_hulls = LLConvexDecomposition::getInstance()->getNumHullsFromStage(stage);
+ }
+
+ {
+ LLMutexLock lock(mMutex);
+ mCurRequest->mHull.clear();
+ mCurRequest->mHull.resize(num_hulls);
+
+ mCurRequest->mHullMesh.clear();
+ mCurRequest->mHullMesh.resize(num_hulls);
+ }
+
+ for (S32 i = 0; i < num_hulls; ++i)
+ {
+ std::vector<LLVector3> p;
+ LLCDHull hull;
+ // if LLConvexDecomposition is a stub, num_hulls should have been set to 0 above, and we should not reach this code
+ LLConvexDecomposition::getInstance()->getHullFromStage(stage, i, &hull);
+
+ const F32* v = hull.mVertexBase;
+
+ for (S32 j = 0; j < hull.mNumVertices; ++j)
+ {
+ LLVector3 vert(v[0], v[1], v[2]);
+ p.push_back(vert);
+ v = (F32*) (((U8*) v) + hull.mVertexStrideBytes);
+ }
+
+ LLCDMeshData mesh;
+ // if LLConvexDecomposition is a stub, num_hulls should have been set to 0 above, and we should not reach this code
+ LLConvexDecomposition::getInstance()->getMeshFromStage(stage, i, &mesh);
+
+ get_vertex_buffer_from_mesh(mesh, mCurRequest->mHullMesh[i]);
+
+ {
+ LLMutexLock lock(mMutex);
+ mCurRequest->mHull[i] = p;
+ }
+ }
+
+ {
+ LLMutexLock lock(mMutex);
+ mCurRequest->setStatusMessage("FAIL");
+ completeCurrent();
+ }
+ }
}
void LLPhysicsDecomp::completeCurrent()
{
- LLMutexLock lock(mMutex);
- mCompletedQ.push(mCurRequest);
- mCurRequest = NULL;
+ LLMutexLock lock(mMutex);
+ mCompletedQ.push(mCurRequest);
+ mCurRequest = NULL;
}
void LLPhysicsDecomp::notifyCompleted()
{
- if (!mCompletedQ.empty())
- {
- LLMutexLock lock(mMutex);
- while (!mCompletedQ.empty())
- {
- Request* req = mCompletedQ.front();
- req->completed();
- mCompletedQ.pop();
- }
- }
+ if (!mCompletedQ.empty())
+ {
+ LLMutexLock lock(mMutex);
+ while (!mCompletedQ.empty())
+ {
+ Request* req = mCompletedQ.front();
+ req->completed();
+ mCompletedQ.pop();
+ }
+ }
}
void make_box(LLPhysicsDecomp::Request * request)
{
- LLVector3 min,max;
- min = request->mPositions[0];
- max = min;
+ LLVector3 min,max;
+ min = request->mPositions[0];
+ max = min;
+
+ for (U32 i = 0; i < request->mPositions.size(); ++i)
+ {
+ update_min_max(min, max, request->mPositions[i]);
+ }
- for (U32 i = 0; i < request->mPositions.size(); ++i)
- {
- update_min_max(min, max, request->mPositions[i]);
- }
+ request->mHull.clear();
- request->mHull.clear();
-
- LLModel::hull box;
- box.push_back(LLVector3(min[0],min[1],min[2]));
- box.push_back(LLVector3(max[0],min[1],min[2]));
- box.push_back(LLVector3(min[0],max[1],min[2]));
- box.push_back(LLVector3(max[0],max[1],min[2]));
- box.push_back(LLVector3(min[0],min[1],max[2]));
- box.push_back(LLVector3(max[0],min[1],max[2]));
- box.push_back(LLVector3(min[0],max[1],max[2]));
- box.push_back(LLVector3(max[0],max[1],max[2]));
+ LLModel::hull box;
+ box.push_back(LLVector3(min[0],min[1],min[2]));
+ box.push_back(LLVector3(max[0],min[1],min[2]));
+ box.push_back(LLVector3(min[0],max[1],min[2]));
+ box.push_back(LLVector3(max[0],max[1],min[2]));
+ box.push_back(LLVector3(min[0],min[1],max[2]));
+ box.push_back(LLVector3(max[0],min[1],max[2]));
+ box.push_back(LLVector3(min[0],max[1],max[2]));
+ box.push_back(LLVector3(max[0],max[1],max[2]));
- request->mHull.push_back(box);
+ request->mHull.push_back(box);
}
void LLPhysicsDecomp::doDecompositionSingleHull()
{
- LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
-
- if (decomp == NULL)
- {
- //stub. do nothing.
- return;
- }
-
- LLCDMeshData mesh;
-
- setMeshData(mesh, true);
-
- LLCDResult ret = decomp->buildSingleHull() ;
- if (ret)
- {
- LL_WARNS(LOG_MESH) << "Could not execute decomposition stage when attempting to create single hull." << LL_ENDL;
- make_box(mCurRequest);
- }
- else
- {
- {
- LLMutexLock lock(mMutex);
- mCurRequest->mHull.clear();
- mCurRequest->mHull.resize(1);
- mCurRequest->mHullMesh.clear();
- }
-
- std::vector<LLVector3> p;
- LLCDHull hull;
-
- // if LLConvexDecomposition is a stub, num_hulls should have been set to 0 above, and we should not reach this code
- decomp->getSingleHull(&hull);
-
- const F32* v = hull.mVertexBase;
-
- for (S32 j = 0; j < hull.mNumVertices; ++j)
- {
- LLVector3 vert(v[0], v[1], v[2]);
- p.push_back(vert);
- v = (F32*) (((U8*) v) + hull.mVertexStrideBytes);
- }
-
- {
- LLMutexLock lock(mMutex);
- mCurRequest->mHull[0] = p;
- }
- }
-
- {
- completeCurrent();
-
- }
+ LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
+
+ if (decomp == NULL)
+ {
+ //stub. do nothing.
+ return;
+ }
+
+ LLCDMeshData mesh;
+
+ setMeshData(mesh, true);
+
+ LLCDResult ret = decomp->buildSingleHull() ;
+ if (ret)
+ {
+ LL_WARNS(LOG_MESH) << "Could not execute decomposition stage when attempting to create single hull." << LL_ENDL;
+ make_box(mCurRequest);
+ }
+ else
+ {
+ {
+ LLMutexLock lock(mMutex);
+ mCurRequest->mHull.clear();
+ mCurRequest->mHull.resize(1);
+ mCurRequest->mHullMesh.clear();
+ }
+
+ std::vector<LLVector3> p;
+ LLCDHull hull;
+
+ // if LLConvexDecomposition is a stub, num_hulls should have been set to 0 above, and we should not reach this code
+ decomp->getSingleHull(&hull);
+
+ const F32* v = hull.mVertexBase;
+
+ for (S32 j = 0; j < hull.mNumVertices; ++j)
+ {
+ LLVector3 vert(v[0], v[1], v[2]);
+ p.push_back(vert);
+ v = (F32*) (((U8*) v) + hull.mVertexStrideBytes);
+ }
+
+ {
+ LLMutexLock lock(mMutex);
+ mCurRequest->mHull[0] = p;
+ }
+ }
+
+ {
+ completeCurrent();
+
+ }
}
void LLPhysicsDecomp::run()
{
- LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
- if (decomp == NULL)
- {
- // stub library. Set init to true so the main thread
- // doesn't wait for this to finish.
- mInited = true;
- return;
- }
-
- decomp->initThread();
- mInited = true;
-
- static const LLCDStageData* stages = NULL;
- static S32 num_stages = 0;
-
- if (!stages)
- {
- num_stages = decomp->getStages(&stages);
- }
-
- for (S32 i = 0; i < num_stages; i++)
- {
- mStageID[stages[i].mName] = i;
- }
-
- while (!mQuitting)
- {
- mSignal->wait();
- while (!mQuitting && !mRequestQ.empty())
- {
- {
- LLMutexLock lock(mMutex);
- mCurRequest = mRequestQ.front();
- mRequestQ.pop();
- }
-
- S32& id = *(mCurRequest->mDecompID);
- if (id == -1)
- {
- decomp->genDecomposition(id);
- }
- decomp->bindDecomposition(id);
-
- if (mCurRequest->mStage == "single_hull")
- {
- doDecompositionSingleHull();
- }
- else
- {
- doDecomposition();
- }
- }
- }
-
- decomp->quitThread();
-
- if (mSignal->isLocked())
- { //let go of mSignal's associated mutex
- mSignal->unlock();
- }
-
- mDone = true;
-}
-
-void LLPhysicsDecomp::Request::assignData(LLModel* mdl)
-{
- if (!mdl)
- {
- return ;
- }
-
- U16 index_offset = 0;
- U16 tri[3] ;
-
- mPositions.clear();
- mIndices.clear();
- mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ;
- mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ;
-
- //queue up vertex positions and indices
- for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i)
- {
- const LLVolumeFace& face = mdl->getVolumeFace(i);
- if (mPositions.size() + face.mNumVertices > 65535)
- {
- continue;
- }
-
- for (U32 j = 0; j < face.mNumVertices; ++j)
- {
- mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr()));
- for(U32 k = 0 ; k < 3 ; k++)
- {
- mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ;
- mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ;
- }
- }
-
- updateTriangleAreaThreshold() ;
-
- for (U32 j = 0; j+2 < face.mNumIndices; j += 3)
- {
- tri[0] = face.mIndices[j] + index_offset ;
- tri[1] = face.mIndices[j + 1] + index_offset ;
- tri[2] = face.mIndices[j + 2] + index_offset ;
-
- if(isValidTriangle(tri[0], tri[1], tri[2]))
- {
- mIndices.push_back(tri[0]);
- mIndices.push_back(tri[1]);
- mIndices.push_back(tri[2]);
- }
- }
-
- index_offset += face.mNumVertices;
- }
-
- return ;
-}
-
-void LLPhysicsDecomp::Request::updateTriangleAreaThreshold()
-{
- F32 range = mBBox[1].mV[0] - mBBox[0].mV[0] ;
- range = llmin(range, mBBox[1].mV[1] - mBBox[0].mV[1]) ;
- range = llmin(range, mBBox[1].mV[2] - mBBox[0].mV[2]) ;
-
- mTriangleAreaThreshold = llmin(0.0002f, range * 0.000002f) ;
+ LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
+ if (decomp == NULL)
+ {
+ // stub library. Set init to true so the main thread
+ // doesn't wait for this to finish.
+ mInited = true;
+ return;
+ }
+
+ decomp->initThread();
+ mInited = true;
+
+ static const LLCDStageData* stages = NULL;
+ static S32 num_stages = 0;
+
+ if (!stages)
+ {
+ num_stages = decomp->getStages(&stages);
+ }
+
+ for (S32 i = 0; i < num_stages; i++)
+ {
+ mStageID[stages[i].mName] = i;
+ }
+
+ while (!mQuitting)
+ {
+ mSignal->wait();
+ while (!mQuitting && !mRequestQ.empty())
+ {
+ {
+ LLMutexLock lock(mMutex);
+ mCurRequest = mRequestQ.front();
+ mRequestQ.pop();
+ }
+
+ S32& id = *(mCurRequest->mDecompID);
+ if (id == -1)
+ {
+ decomp->genDecomposition(id);
+ }
+ decomp->bindDecomposition(id);
+
+ if (mCurRequest->mStage == "single_hull")
+ {
+ doDecompositionSingleHull();
+ }
+ else
+ {
+ doDecomposition();
+ }
+ }
+ }
+
+ decomp->quitThread();
+
+ if (mSignal->isLocked())
+ { //let go of mSignal's associated mutex
+ mSignal->unlock();
+ }
+
+ mDone = true;
+}
+
+void LLPhysicsDecomp::Request::assignData(LLModel* mdl)
+{
+ if (!mdl)
+ {
+ return ;
+ }
+
+ U16 index_offset = 0;
+ U16 tri[3] ;
+
+ mPositions.clear();
+ mIndices.clear();
+ mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ;
+ mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ;
+
+ //queue up vertex positions and indices
+ for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i)
+ {
+ const LLVolumeFace& face = mdl->getVolumeFace(i);
+ if (mPositions.size() + face.mNumVertices > 65535)
+ {
+ continue;
+ }
+
+ for (U32 j = 0; j < face.mNumVertices; ++j)
+ {
+ mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr()));
+ for(U32 k = 0 ; k < 3 ; k++)
+ {
+ mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ;
+ mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ;
+ }
+ }
+
+ updateTriangleAreaThreshold() ;
+
+ for (U32 j = 0; j+2 < face.mNumIndices; j += 3)
+ {
+ tri[0] = face.mIndices[j] + index_offset ;
+ tri[1] = face.mIndices[j + 1] + index_offset ;
+ tri[2] = face.mIndices[j + 2] + index_offset ;
+
+ if(isValidTriangle(tri[0], tri[1], tri[2]))
+ {
+ mIndices.push_back(tri[0]);
+ mIndices.push_back(tri[1]);
+ mIndices.push_back(tri[2]);
+ }
+ }
+
+ index_offset += face.mNumVertices;
+ }
+
+ return ;
+}
+
+void LLPhysicsDecomp::Request::updateTriangleAreaThreshold()
+{
+ F32 range = mBBox[1].mV[0] - mBBox[0].mV[0] ;
+ range = llmin(range, mBBox[1].mV[1] - mBBox[0].mV[1]) ;
+ range = llmin(range, mBBox[1].mV[2] - mBBox[0].mV[2]) ;
+
+ mTriangleAreaThreshold = llmin(0.0002f, range * 0.000002f) ;
}
//check if the triangle area is large enough to qualify for a valid triangle
-bool LLPhysicsDecomp::Request::isValidTriangle(U16 idx1, U16 idx2, U16 idx3)
+bool LLPhysicsDecomp::Request::isValidTriangle(U16 idx1, U16 idx2, U16 idx3)
{
- LLVector3 a = mPositions[idx2] - mPositions[idx1] ;
- LLVector3 b = mPositions[idx3] - mPositions[idx1] ;
- F32 c = a * b ;
+ LLVector3 a = mPositions[idx2] - mPositions[idx1] ;
+ LLVector3 b = mPositions[idx3] - mPositions[idx1] ;
+ F32 c = a * b ;
- return ((a*a) * (b*b) - c * c) > mTriangleAreaThreshold ;
+ return ((a*a) * (b*b) - c * c) > mTriangleAreaThreshold ;
}
void LLPhysicsDecomp::Request::setStatusMessage(const std::string& msg)
{
- mStatusMessage = msg;
+ mStatusMessage = msg;
}
void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp)
{
- decomp.mMesh.resize(decomp.mHull.size());
-
- for (U32 i = 0; i < decomp.mHull.size(); ++i)
- {
- LLCDHull hull;
- hull.mNumVertices = decomp.mHull[i].size();
- hull.mVertexBase = decomp.mHull[i][0].mV;
- hull.mVertexStrideBytes = 12;
-
- LLCDMeshData mesh;
- LLCDResult res = LLCD_OK;
- if (LLConvexDecomposition::getInstance() != NULL)
- {
- res = LLConvexDecomposition::getInstance()->getMeshFromHull(&hull, &mesh);
- }
- if (res == LLCD_OK)
- {
- get_vertex_buffer_from_mesh(mesh, decomp.mMesh[i]);
- }
- }
-
- if (!decomp.mBaseHull.empty() && decomp.mBaseHullMesh.empty())
- { //get mesh for base hull
- LLCDHull hull;
- hull.mNumVertices = decomp.mBaseHull.size();
- hull.mVertexBase = decomp.mBaseHull[0].mV;
- hull.mVertexStrideBytes = 12;
-
- LLCDMeshData mesh;
- LLCDResult res = LLCD_OK;
- if (LLConvexDecomposition::getInstance() != NULL)
- {
- res = LLConvexDecomposition::getInstance()->getMeshFromHull(&hull, &mesh);
- }
- if (res == LLCD_OK)
- {
- get_vertex_buffer_from_mesh(mesh, decomp.mBaseHullMesh);
- }
- }
+ decomp.mMesh.resize(decomp.mHull.size());
+
+ for (U32 i = 0; i < decomp.mHull.size(); ++i)
+ {
+ LLCDHull hull;
+ hull.mNumVertices = decomp.mHull[i].size();
+ hull.mVertexBase = decomp.mHull[i][0].mV;
+ hull.mVertexStrideBytes = 12;
+
+ LLCDMeshData mesh;
+ LLCDResult res = LLCD_OK;
+ if (LLConvexDecomposition::getInstance() != NULL)
+ {
+ res = LLConvexDecomposition::getInstance()->getMeshFromHull(&hull, &mesh);
+ }
+ if (res == LLCD_OK)
+ {
+ get_vertex_buffer_from_mesh(mesh, decomp.mMesh[i]);
+ }
+ }
+
+ if (!decomp.mBaseHull.empty() && decomp.mBaseHullMesh.empty())
+ { //get mesh for base hull
+ LLCDHull hull;
+ hull.mNumVertices = decomp.mBaseHull.size();
+ hull.mVertexBase = decomp.mBaseHull[0].mV;
+ hull.mVertexStrideBytes = 12;
+
+ LLCDMeshData mesh;
+ LLCDResult res = LLCD_OK;
+ if (LLConvexDecomposition::getInstance() != NULL)
+ {
+ res = LLConvexDecomposition::getInstance()->getMeshFromHull(&hull, &mesh);
+ }
+ if (res == LLCD_OK)
+ {
+ get_vertex_buffer_from_mesh(mesh, decomp.mBaseHullMesh);
+ }
+ }
}
bool LLMeshRepository::meshUploadEnabled()
{
- LLViewerRegion *region = gAgent.getRegion();
- if(gSavedSettings.getBOOL("MeshEnabled") &&
- region)
- {
- return region->meshUploadEnabled();
- }
- return false;
+ LLViewerRegion *region = gAgent.getRegion();
+ if(gSavedSettings.getBOOL("MeshEnabled") &&
+ region)
+ {
+ return region->meshUploadEnabled();
+ }
+ return false;
}
bool LLMeshRepository::meshRezEnabled()
{
- LLViewerRegion *region = gAgent.getRegion();
- if(gSavedSettings.getBOOL("MeshEnabled") &&
- region)
- {
- return region->meshRezEnabled();
- }
- return false;
+ LLViewerRegion *region = gAgent.getRegion();
+ if(gSavedSettings.getBOOL("MeshEnabled") &&
+ region)
+ {
+ return region->meshRezEnabled();
+ }
+ return false;
}
// Threading: main thread only
// static
void LLMeshRepository::metricsStart()
{
- ++metrics_teleport_start_count;
- sQuiescentTimer.start(0);
+ ++metrics_teleport_start_count;
+ sQuiescentTimer.start(0);
}
// Threading: main thread only
// static
void LLMeshRepository::metricsStop()
{
- sQuiescentTimer.stop(0);
+ sQuiescentTimer.stop(0);
}
// Threading: main thread only
// static
void LLMeshRepository::metricsProgress(unsigned int this_count)
{
- static bool first_start(true);
+ static bool first_start(true);
- if (first_start)
- {
- metricsStart();
- first_start = false;
- }
- sQuiescentTimer.ringBell(0, this_count);
+ if (first_start)
+ {
+ metricsStart();
+ first_start = false;
+ }
+ sQuiescentTimer.ringBell(0, this_count);
}
// Threading: main thread only
// static
void LLMeshRepository::metricsUpdate()
{
- F64 started, stopped;
- U64 total_count(U64L(0)), user_cpu(U64L(0)), sys_cpu(U64L(0));
-
- if (sQuiescentTimer.isExpired(0, started, stopped, total_count, user_cpu, sys_cpu))
- {
- LLSD metrics;
-
- metrics["reason"] = "Mesh Download Quiescent";
- metrics["scope"] = metrics_teleport_start_count > 1 ? "Teleport" : "Login";
- metrics["start"] = started;
- metrics["stop"] = stopped;
- metrics["fetches"] = LLSD::Integer(total_count);
- metrics["teleports"] = LLSD::Integer(metrics_teleport_start_count);
- metrics["user_cpu"] = double(user_cpu) / 1.0e6;
- metrics["sys_cpu"] = double(sys_cpu) / 1.0e6;
- LL_INFOS(LOG_MESH) << "EventMarker " << metrics << LL_ENDL;
- }
+ F64 started, stopped;
+ U64 total_count(U64L(0)), user_cpu(U64L(0)), sys_cpu(U64L(0));
+
+ if (sQuiescentTimer.isExpired(0, started, stopped, total_count, user_cpu, sys_cpu))
+ {
+ LLSD metrics;
+
+ metrics["reason"] = "Mesh Download Quiescent";
+ metrics["scope"] = metrics_teleport_start_count > 1 ? "Teleport" : "Login";
+ metrics["start"] = started;
+ metrics["stop"] = stopped;
+ metrics["fetches"] = LLSD::Integer(total_count);
+ metrics["teleports"] = LLSD::Integer(metrics_teleport_start_count);
+ metrics["user_cpu"] = double(user_cpu) / 1.0e6;
+ metrics["sys_cpu"] = double(sys_cpu) / 1.0e6;
+ LL_INFOS(LOG_MESH) << "EventMarker " << metrics << LL_ENDL;
+ }
}
// Threading: main thread only
// static
void teleport_started()
{
- LLMeshRepository::metricsStart();
+ LLMeshRepository::metricsStart();
}
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index 89cd2d867f..b31d726004 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmeshrepository.h
* @brief Client-side repository of mesh assets.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010-2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -65,117 +65,117 @@ typedef enum e_mesh_processing_result_enum
class LLMeshUploadData
{
public:
- LLPointer<LLModel> mBaseModel;
- LLPointer<LLModel> mModel[5];
- LLUUID mUUID;
- U32 mRetries;
- std::string mRSVP;
- std::string mAssetData;
- LLSD mPostData;
-
- LLMeshUploadData()
- {
- mRetries = 0;
- }
+ LLPointer<LLModel> mBaseModel;
+ LLPointer<LLModel> mModel[5];
+ LLUUID mUUID;
+ U32 mRetries;
+ std::string mRSVP;
+ std::string mAssetData;
+ LLSD mPostData;
+
+ LLMeshUploadData()
+ {
+ mRetries = 0;
+ }
};
class LLTextureUploadData
{
public:
- LLViewerFetchedTexture* mTexture;
- LLUUID mUUID;
- std::string mRSVP;
- std::string mLabel;
- U32 mRetries;
- std::string mAssetData;
- LLSD mPostData;
-
- LLTextureUploadData()
- {
- mRetries = 0;
- }
-
- LLTextureUploadData(LLViewerFetchedTexture* texture, std::string& label)
- : mTexture(texture), mLabel(label)
- {
- mRetries = 0;
- }
+ LLViewerFetchedTexture* mTexture;
+ LLUUID mUUID;
+ std::string mRSVP;
+ std::string mLabel;
+ U32 mRetries;
+ std::string mAssetData;
+ LLSD mPostData;
+
+ LLTextureUploadData()
+ {
+ mRetries = 0;
+ }
+
+ LLTextureUploadData(LLViewerFetchedTexture* texture, std::string& label)
+ : mTexture(texture), mLabel(label)
+ {
+ mRetries = 0;
+ }
};
class LLPhysicsDecomp : public LLThread
{
public:
- typedef std::map<std::string, LLSD> decomp_params;
-
- class Request : public LLRefCount
- {
- public:
- //input params
- S32* mDecompID;
- std::string mStage;
- std::vector<LLVector3> mPositions;
- std::vector<U16> mIndices;
- decomp_params mParams;
-
- //output state
- std::string mStatusMessage;
- std::vector<LLModel::PhysicsMesh> mHullMesh;
- LLModel::convex_hull_decomposition mHull;
-
- //status message callback, called from decomposition thread
- virtual S32 statusCallback(const char* status, S32 p1, S32 p2) = 0;
-
- //completed callback, called from the main thread
- virtual void completed() = 0;
-
- virtual void setStatusMessage(const std::string& msg);
-
- bool isValid() const {return mPositions.size() > 2 && mIndices.size() > 2 ;}
-
- protected:
- //internal use
- LLVector3 mBBox[2] ;
- F32 mTriangleAreaThreshold ;
-
- void assignData(LLModel* mdl) ;
- void updateTriangleAreaThreshold() ;
- bool isValidTriangle(U16 idx1, U16 idx2, U16 idx3) ;
- };
-
- LLCondition* mSignal;
- LLMutex* mMutex;
-
- bool mInited;
- bool mQuitting;
- bool mDone;
-
- LLPhysicsDecomp();
- ~LLPhysicsDecomp();
-
- void shutdown();
-
- void submitRequest(Request* request);
- static S32 llcdCallback(const char*, S32, S32);
- void cancel();
-
- void setMeshData(LLCDMeshData& mesh, bool vertex_based);
- void doDecomposition();
- void doDecompositionSingleHull();
-
- virtual void run();
-
- void completeCurrent();
- void notifyCompleted();
-
- std::map<std::string, S32> mStageID;
-
- typedef std::queue<LLPointer<Request> > request_queue;
- request_queue mRequestQ;
-
- LLPointer<Request> mCurRequest;
-
- std::queue<LLPointer<Request> > mCompletedQ;
+ typedef std::map<std::string, LLSD> decomp_params;
+
+ class Request : public LLRefCount
+ {
+ public:
+ //input params
+ S32* mDecompID;
+ std::string mStage;
+ std::vector<LLVector3> mPositions;
+ std::vector<U16> mIndices;
+ decomp_params mParams;
+
+ //output state
+ std::string mStatusMessage;
+ std::vector<LLModel::PhysicsMesh> mHullMesh;
+ LLModel::convex_hull_decomposition mHull;
+
+ //status message callback, called from decomposition thread
+ virtual S32 statusCallback(const char* status, S32 p1, S32 p2) = 0;
+
+ //completed callback, called from the main thread
+ virtual void completed() = 0;
+
+ virtual void setStatusMessage(const std::string& msg);
+
+ bool isValid() const {return mPositions.size() > 2 && mIndices.size() > 2 ;}
+
+ protected:
+ //internal use
+ LLVector3 mBBox[2] ;
+ F32 mTriangleAreaThreshold ;
+
+ void assignData(LLModel* mdl) ;
+ void updateTriangleAreaThreshold() ;
+ bool isValidTriangle(U16 idx1, U16 idx2, U16 idx3) ;
+ };
+
+ LLCondition* mSignal;
+ LLMutex* mMutex;
+
+ bool mInited;
+ bool mQuitting;
+ bool mDone;
+
+ LLPhysicsDecomp();
+ ~LLPhysicsDecomp();
+
+ void shutdown();
+
+ void submitRequest(Request* request);
+ static S32 llcdCallback(const char*, S32, S32);
+ void cancel();
+
+ void setMeshData(LLCDMeshData& mesh, bool vertex_based);
+ void doDecomposition();
+ void doDecompositionSingleHull();
+
+ virtual void run();
+
+ void completeCurrent();
+ void notifyCompleted();
+
+ std::map<std::string, S32> mStageID;
+
+ typedef std::queue<LLPointer<Request> > request_queue;
+ request_queue mRequestQ;
+
+ LLPointer<Request> mCurRequest;
+
+ std::queue<LLPointer<Request> > mCompletedQ;
};
@@ -255,198 +255,198 @@ class LLMeshRepoThread : public LLThread
{
public:
- volatile static S32 sActiveHeaderRequests;
- volatile static S32 sActiveLODRequests;
- static U32 sMaxConcurrentRequests;
- static S32 sRequestLowWater;
- static S32 sRequestHighWater;
- static S32 sRequestWaterLevel; // Stats-use only, may read outside of thread
-
- LLMutex* mMutex;
- LLMutex* mHeaderMutex;
- LLCondition* mSignal;
-
- //map of known mesh headers
- typedef boost::unordered_map<LLUUID, std::pair<U32, LLMeshHeader>> mesh_header_map; // pair is header_size and data
- mesh_header_map mMeshHeader;
-
- class HeaderRequest : public RequestStats
- {
- public:
- const LLVolumeParams mMeshParams;
-
- HeaderRequest(const LLVolumeParams& mesh_params)
- : RequestStats(), mMeshParams(mesh_params)
- {
- }
-
- bool operator<(const HeaderRequest& rhs) const
- {
- return mMeshParams < rhs.mMeshParams;
- }
- };
-
- class LODRequest : public RequestStats
- {
- public:
- LLVolumeParams mMeshParams;
- S32 mLOD;
- F32 mScore;
-
- LODRequest(const LLVolumeParams& mesh_params, S32 lod)
- : RequestStats(), mMeshParams(mesh_params), mLOD(lod), mScore(0.f)
- {
- }
- };
-
- struct CompareScoreGreater
- {
- bool operator()(const LODRequest& lhs, const LODRequest& rhs)
- {
- return lhs.mScore > rhs.mScore; // greatest = first
- }
- };
-
- class UUIDBasedRequest : public RequestStats
- {
- public:
- LLUUID mId;
-
- UUIDBasedRequest(const LLUUID& id)
- : RequestStats(), mId(id)
- {
+ volatile static S32 sActiveHeaderRequests;
+ volatile static S32 sActiveLODRequests;
+ static U32 sMaxConcurrentRequests;
+ static S32 sRequestLowWater;
+ static S32 sRequestHighWater;
+ static S32 sRequestWaterLevel; // Stats-use only, may read outside of thread
+
+ LLMutex* mMutex;
+ LLMutex* mHeaderMutex;
+ LLCondition* mSignal;
+
+ //map of known mesh headers
+ typedef boost::unordered_map<LLUUID, std::pair<U32, LLMeshHeader>> mesh_header_map; // pair is header_size and data
+ mesh_header_map mMeshHeader;
+
+ class HeaderRequest : public RequestStats
+ {
+ public:
+ const LLVolumeParams mMeshParams;
+
+ HeaderRequest(const LLVolumeParams& mesh_params)
+ : RequestStats(), mMeshParams(mesh_params)
+ {
+ }
+
+ bool operator<(const HeaderRequest& rhs) const
+ {
+ return mMeshParams < rhs.mMeshParams;
+ }
+ };
+
+ class LODRequest : public RequestStats
+ {
+ public:
+ LLVolumeParams mMeshParams;
+ S32 mLOD;
+ F32 mScore;
+
+ LODRequest(const LLVolumeParams& mesh_params, S32 lod)
+ : RequestStats(), mMeshParams(mesh_params), mLOD(lod), mScore(0.f)
+ {
+ }
+ };
+
+ struct CompareScoreGreater
+ {
+ bool operator()(const LODRequest& lhs, const LODRequest& rhs)
+ {
+ return lhs.mScore > rhs.mScore; // greatest = first
+ }
+ };
+
+ class UUIDBasedRequest : public RequestStats
+ {
+ public:
+ LLUUID mId;
+
+ UUIDBasedRequest(const LLUUID& id)
+ : RequestStats(), mId(id)
+ {
}
bool operator<(const UUIDBasedRequest& rhs) const
{
return mId < rhs.mId;
}
- };
+ };
+
+ class LoadedMesh
+ {
+ public:
+ LLPointer<LLVolume> mVolume;
+ LLVolumeParams mMeshParams;
+ S32 mLOD;
- class LoadedMesh
- {
- public:
- LLPointer<LLVolume> mVolume;
- LLVolumeParams mMeshParams;
- S32 mLOD;
+ LoadedMesh(LLVolume* volume, const LLVolumeParams& mesh_params, S32 lod)
+ : mVolume(volume), mMeshParams(mesh_params), mLOD(lod)
+ {
+ }
- LoadedMesh(LLVolume* volume, const LLVolumeParams& mesh_params, S32 lod)
- : mVolume(volume), mMeshParams(mesh_params), mLOD(lod)
- {
- }
+ };
- };
+ //set of requested skin info
+ std::deque<UUIDBasedRequest> mSkinRequests;
- //set of requested skin info
- std::deque<UUIDBasedRequest> mSkinRequests;
-
- // list of completed skin info requests
- std::deque<LLMeshSkinInfo*> mSkinInfoQ;
+ // list of completed skin info requests
+ std::deque<LLMeshSkinInfo*> mSkinInfoQ;
- // list of skin info requests that have failed or are unavailaibe
- std::deque<UUIDBasedRequest> mSkinUnavailableQ;
+ // list of skin info requests that have failed or are unavailaibe
+ std::deque<UUIDBasedRequest> mSkinUnavailableQ;
- //set of requested decompositions
- std::set<UUIDBasedRequest> mDecompositionRequests;
+ //set of requested decompositions
+ std::set<UUIDBasedRequest> mDecompositionRequests;
- //set of requested physics shapes
- std::set<UUIDBasedRequest> mPhysicsShapeRequests;
+ //set of requested physics shapes
+ std::set<UUIDBasedRequest> mPhysicsShapeRequests;
- // list of completed Decomposition info requests
- std::list<LLModel::Decomposition*> mDecompositionQ;
+ // list of completed Decomposition info requests
+ std::list<LLModel::Decomposition*> mDecompositionQ;
- //queue of requested headers
- std::queue<HeaderRequest> mHeaderReqQ;
+ //queue of requested headers
+ std::queue<HeaderRequest> mHeaderReqQ;
- //queue of requested LODs
- std::queue<LODRequest> mLODReqQ;
+ //queue of requested LODs
+ std::queue<LODRequest> mLODReqQ;
- //queue of unavailable LODs (either asset doesn't exist or asset doesn't have desired LOD)
- std::deque<LODRequest> mUnavailableQ;
+ //queue of unavailable LODs (either asset doesn't exist or asset doesn't have desired LOD)
+ std::deque<LODRequest> mUnavailableQ;
- //queue of successfully loaded meshes
- std::deque<LoadedMesh> mLoadedQ;
+ //queue of successfully loaded meshes
+ std::deque<LoadedMesh> mLoadedQ;
- //map of pending header requests and currently desired LODs
- typedef boost::unordered_map<LLUUID, std::vector<S32> > pending_lod_map;
- pending_lod_map mPendingLOD;
+ //map of pending header requests and currently desired LODs
+ typedef boost::unordered_map<LLUUID, std::vector<S32> > pending_lod_map;
+ pending_lod_map mPendingLOD;
- // llcorehttp library interface objects.
- LLCore::HttpStatus mHttpStatus;
- LLCore::HttpRequest * mHttpRequest;
- LLCore::HttpOptions::ptr_t mHttpOptions;
- LLCore::HttpOptions::ptr_t mHttpLargeOptions;
- LLCore::HttpHeaders::ptr_t mHttpHeaders;
- LLCore::HttpRequest::policy_t mHttpPolicyClass;
- LLCore::HttpRequest::policy_t mHttpLargePolicyClass;
+ // llcorehttp library interface objects.
+ LLCore::HttpStatus mHttpStatus;
+ LLCore::HttpRequest * mHttpRequest;
+ LLCore::HttpOptions::ptr_t mHttpOptions;
+ LLCore::HttpOptions::ptr_t mHttpLargeOptions;
+ LLCore::HttpHeaders::ptr_t mHttpHeaders;
+ LLCore::HttpRequest::policy_t mHttpPolicyClass;
+ LLCore::HttpRequest::policy_t mHttpLargePolicyClass;
- typedef std::set<LLCore::HttpHandler::ptr_t> http_request_set;
- http_request_set mHttpRequestSet; // Outstanding HTTP requests
+ typedef std::set<LLCore::HttpHandler::ptr_t> http_request_set;
+ http_request_set mHttpRequestSet; // Outstanding HTTP requests
- std::string mGetMeshCapability;
+ std::string mGetMeshCapability;
- LLMeshRepoThread();
- ~LLMeshRepoThread();
+ LLMeshRepoThread();
+ ~LLMeshRepoThread();
- virtual void run();
+ virtual void run();
- void lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
- void loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
+ void lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
+ void loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
- bool fetchMeshHeader(const LLVolumeParams& mesh_params, bool can_retry = true);
- bool fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, bool can_retry = true);
- EMeshProcessingResult headerReceived(const LLVolumeParams& mesh_params, U8* data, S32 data_size);
- EMeshProcessingResult lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size);
- bool skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
- bool decompositionReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
- EMeshProcessingResult physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
- bool hasPhysicsShapeInHeader(const LLUUID& mesh_id);
+ bool fetchMeshHeader(const LLVolumeParams& mesh_params, bool can_retry = true);
+ bool fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, bool can_retry = true);
+ EMeshProcessingResult headerReceived(const LLVolumeParams& mesh_params, U8* data, S32 data_size);
+ EMeshProcessingResult lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size);
+ bool skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
+ bool decompositionReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
+ EMeshProcessingResult physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
+ bool hasPhysicsShapeInHeader(const LLUUID& mesh_id);
bool hasSkinInfoInHeader(const LLUUID& mesh_id);
bool hasHeader(const LLUUID& mesh_id);
- void notifyLoadedMeshes();
- S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
-
- void loadMeshSkinInfo(const LLUUID& mesh_id);
- void loadMeshDecomposition(const LLUUID& mesh_id);
- void loadMeshPhysicsShape(const LLUUID& mesh_id);
+ void notifyLoadedMeshes();
+ S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
- //send request for skin info, returns true if header info exists
- // (should hold onto mesh_id and try again later if header info does not exist)
- bool fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry = true);
+ void loadMeshSkinInfo(const LLUUID& mesh_id);
+ void loadMeshDecomposition(const LLUUID& mesh_id);
+ void loadMeshPhysicsShape(const LLUUID& mesh_id);
- //send request for decomposition, returns true if header info exists
- // (should hold onto mesh_id and try again later if header info does not exist)
- bool fetchMeshDecomposition(const LLUUID& mesh_id);
+ //send request for skin info, returns true if header info exists
+ // (should hold onto mesh_id and try again later if header info does not exist)
+ bool fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry = true);
- //send request for PhysicsShape, returns true if header info exists
- // (should hold onto mesh_id and try again later if header info does not exist)
- bool fetchMeshPhysicsShape(const LLUUID& mesh_id);
+ //send request for decomposition, returns true if header info exists
+ // (should hold onto mesh_id and try again later if header info does not exist)
+ bool fetchMeshDecomposition(const LLUUID& mesh_id);
- static void incActiveLODRequests();
- static void decActiveLODRequests();
- static void incActiveHeaderRequests();
- static void decActiveHeaderRequests();
+ //send request for PhysicsShape, returns true if header info exists
+ // (should hold onto mesh_id and try again later if header info does not exist)
+ bool fetchMeshPhysicsShape(const LLUUID& mesh_id);
- // Set the caps strings and preferred version for constructing
- // mesh fetch URLs.
- //
- // Mutex: must be holding mMutex when called
- void setGetMeshCap(const std::string & get_mesh);
+ static void incActiveLODRequests();
+ static void decActiveLODRequests();
+ static void incActiveHeaderRequests();
+ static void decActiveHeaderRequests();
- // Mutex: acquires mMutex
- void constructUrl(LLUUID mesh_id, std::string * url);
+ // Set the caps strings and preferred version for constructing
+ // mesh fetch URLs.
+ //
+ // Mutex: must be holding mMutex when called
+ void setGetMeshCap(const std::string & get_mesh);
+
+ // Mutex: acquires mMutex
+ void constructUrl(LLUUID mesh_id, std::string * url);
private:
- // Issue a GET request to a URL with 'Range' header using
- // the correct policy class and other attributes. If an invalid
- // handle is returned, the request failed and caller must retry
- // or dispose of handler.
- //
- // Threads: Repo thread only
- LLCore::HttpHandle getByteRange(const std::string & url,
- size_t offset, size_t len,
- const LLCore::HttpHandler::ptr_t &handler);
+ // Issue a GET request to a URL with 'Range' header using
+ // the correct policy class and other attributes. If an invalid
+ // handle is returned, the request failed and caller must retry
+ // or dispose of handler.
+ //
+ // Threads: Repo thread only
+ LLCore::HttpHandle getByteRange(const std::string & url,
+ size_t offset, size_t len,
+ const LLCore::HttpHandler::ptr_t &handler);
};
@@ -456,98 +456,98 @@ private:
// trivially serve as the HttpHandler object for request completion
// notifications.
-class LLMeshUploadThread : public LLThread, public LLCore::HttpHandler
+class LLMeshUploadThread : public LLThread, public LLCore::HttpHandler
{
private:
- S32 mMeshUploadTimeOut ; //maximum time in seconds to execute an uploading request.
+ S32 mMeshUploadTimeOut ; //maximum time in seconds to execute an uploading request.
public:
- class DecompRequest : public LLPhysicsDecomp::Request
- {
- public:
- LLPointer<LLModel> mModel;
- LLPointer<LLModel> mBaseModel;
+ class DecompRequest : public LLPhysicsDecomp::Request
+ {
+ public:
+ LLPointer<LLModel> mModel;
+ LLPointer<LLModel> mBaseModel;
- LLMeshUploadThread* mThread;
+ LLMeshUploadThread* mThread;
- DecompRequest(LLModel* mdl, LLModel* base_model, LLMeshUploadThread* thread);
+ DecompRequest(LLModel* mdl, LLModel* base_model, LLMeshUploadThread* thread);
- S32 statusCallback(const char* status, S32 p1, S32 p2) { return 1; }
- void completed();
- };
+ S32 statusCallback(const char* status, S32 p1, S32 p2) { return 1; }
+ void completed();
+ };
- LLPointer<DecompRequest> mFinalDecomp;
- volatile bool mPhysicsComplete;
+ LLPointer<DecompRequest> mFinalDecomp;
+ volatile bool mPhysicsComplete;
- typedef std::map<LLPointer<LLModel>, std::vector<LLVector3> > hull_map;
- hull_map mHullMap;
+ typedef std::map<LLPointer<LLModel>, std::vector<LLVector3> > hull_map;
+ hull_map mHullMap;
- typedef std::vector<LLModelInstance> instance_list;
- instance_list mInstanceList;
+ typedef std::vector<LLModelInstance> instance_list;
+ instance_list mInstanceList;
- typedef std::map<LLPointer<LLModel>, instance_list> instance_map;
- instance_map mInstance;
+ typedef std::map<LLPointer<LLModel>, instance_list> instance_map;
+ instance_map mInstance;
- LLMutex* mMutex;
- S32 mPendingUploads;
- LLVector3 mOrigin;
- bool mFinished;
- bool mUploadTextures;
- bool mUploadSkin;
- bool mUploadJoints;
- bool mLockScaleIfJointPosition;
- volatile bool mDiscarded;
+ LLMutex* mMutex;
+ S32 mPendingUploads;
+ LLVector3 mOrigin;
+ bool mFinished;
+ bool mUploadTextures;
+ bool mUploadSkin;
+ bool mUploadJoints;
+ bool mLockScaleIfJointPosition;
+ volatile bool mDiscarded;
- LLHost mHost;
- std::string mWholeModelFeeCapability;
- std::string mWholeModelUploadURL;
+ LLHost mHost;
+ std::string mWholeModelFeeCapability;
+ std::string mWholeModelUploadURL;
- LLMeshUploadThread(instance_list& data, LLVector3& scale, bool upload_textures,
- bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position,
+ LLMeshUploadThread(instance_list& data, LLVector3& scale, bool upload_textures,
+ bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position,
const std::string & upload_url, bool do_upload = true,
- LLHandle<LLWholeModelFeeObserver> fee_observer = (LLHandle<LLWholeModelFeeObserver>()),
- LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
- ~LLMeshUploadThread();
+ LLHandle<LLWholeModelFeeObserver> fee_observer = (LLHandle<LLWholeModelFeeObserver>()),
+ LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
+ ~LLMeshUploadThread();
- bool finished() const { return mFinished; }
- virtual void run();
- void preStart();
- void discard() ;
- bool isDiscarded() const;
+ bool finished() const { return mFinished; }
+ virtual void run();
+ void preStart();
+ void discard() ;
+ bool isDiscarded() const;
- void generateHulls();
+ void generateHulls();
- void doWholeModelUpload();
- void requestWholeModelFee();
+ void doWholeModelUpload();
+ void requestWholeModelFee();
- void wholeModelToLLSD(LLSD& dest, bool include_textures);
+ void wholeModelToLLSD(LLSD& dest, bool include_textures);
- void decomposeMeshMatrix(LLMatrix4& transformation,
- LLVector3& result_pos,
- LLQuaternion& result_rot,
- LLVector3& result_scale);
+ void decomposeMeshMatrix(LLMatrix4& transformation,
+ LLVector3& result_pos,
+ LLQuaternion& result_rot,
+ LLVector3& result_scale);
- void setFeeObserverHandle(LLHandle<LLWholeModelFeeObserver> observer_handle) { mFeeObserverHandle = observer_handle; }
- void setUploadObserverHandle(LLHandle<LLWholeModelUploadObserver> observer_handle) { mUploadObserverHandle = observer_handle; }
+ void setFeeObserverHandle(LLHandle<LLWholeModelFeeObserver> observer_handle) { mFeeObserverHandle = observer_handle; }
+ void setUploadObserverHandle(LLHandle<LLWholeModelUploadObserver> observer_handle) { mUploadObserverHandle = observer_handle; }
- // Inherited from LLCore::HttpHandler
- virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
+ // Inherited from LLCore::HttpHandler
+ virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
LLViewerFetchedTexture* FindViewerTexture(const LLImportMaterial& material);
private:
- LLHandle<LLWholeModelFeeObserver> mFeeObserverHandle;
- LLHandle<LLWholeModelUploadObserver> mUploadObserverHandle;
-
- bool mDoUpload; // if FALSE only model data will be requested, otherwise the model will be uploaded
- LLSD mModelData;
-
- // llcorehttp library interface objects.
- LLCore::HttpStatus mHttpStatus;
- LLCore::HttpRequest * mHttpRequest;
- LLCore::HttpOptions::ptr_t mHttpOptions;
- LLCore::HttpHeaders::ptr_t mHttpHeaders;
- LLCore::HttpRequest::policy_t mHttpPolicyClass;
+ LLHandle<LLWholeModelFeeObserver> mFeeObserverHandle;
+ LLHandle<LLWholeModelUploadObserver> mUploadObserverHandle;
+
+ bool mDoUpload; // if FALSE only model data will be requested, otherwise the model will be uploaded
+ LLSD mModelData;
+
+ // llcorehttp library interface objects.
+ LLCore::HttpStatus mHttpStatus;
+ LLCore::HttpRequest * mHttpRequest;
+ LLCore::HttpOptions::ptr_t mHttpOptions;
+ LLCore::HttpHeaders::ptr_t mHttpHeaders;
+ LLCore::HttpRequest::policy_t mHttpPolicyClass;
};
// Params related to streaming cost, render cost, and scene complexity tracking.
@@ -557,7 +557,7 @@ public:
LLMeshCostData();
bool init(const LLMeshHeader& header);
-
+
// Size for given LOD
S32 getSizeByLOD(S32 lod);
@@ -566,7 +566,7 @@ public:
// Estimated triangle counts for the given LOD.
F32 getEstTrisByLOD(S32 lod);
-
+
// Estimated triangle counts for the largest LOD. Typically this
// is also the "high" LOD, but not necessarily.
F32 getEstTrisMax();
@@ -601,140 +601,140 @@ class LLMeshRepository
{
public:
- //metrics
- static U32 sBytesReceived;
- static U32 sMeshRequestCount; // Total request count, http or cached, all component types
- static U32 sHTTPRequestCount; // Http GETs issued (not large)
- static U32 sHTTPLargeRequestCount; // Http GETs issued for large requests
- static U32 sHTTPRetryCount; // Total request retries whether successful or failed
- static U32 sHTTPErrorCount; // Requests ending in error
- static U32 sLODPending;
- static U32 sLODProcessing;
- static U32 sCacheBytesRead;
- static U32 sCacheBytesWritten;
+ //metrics
+ static U32 sBytesReceived;
+ static U32 sMeshRequestCount; // Total request count, http or cached, all component types
+ static U32 sHTTPRequestCount; // Http GETs issued (not large)
+ static U32 sHTTPLargeRequestCount; // Http GETs issued for large requests
+ static U32 sHTTPRetryCount; // Total request retries whether successful or failed
+ static U32 sHTTPErrorCount; // Requests ending in error
+ static U32 sLODPending;
+ static U32 sLODProcessing;
+ static U32 sCacheBytesRead;
+ static U32 sCacheBytesWritten;
static U32 sCacheBytesHeaders;
static U32 sCacheBytesSkins;
static U32 sCacheBytesDecomps;
- static U32 sCacheReads;
- static U32 sCacheWrites;
- static U32 sMaxLockHoldoffs; // Maximum sequential locking failures
-
- static LLDeadmanTimer sQuiescentTimer; // Time-to-complete-mesh-downloads after significant events
+ static U32 sCacheReads;
+ static U32 sCacheWrites;
+ static U32 sMaxLockHoldoffs; // Maximum sequential locking failures
+
+ static LLDeadmanTimer sQuiescentTimer; // Time-to-complete-mesh-downloads after significant events
// Estimated triangle count of the largest LOD
F32 getEstTrianglesMax(LLUUID mesh_id);
F32 getEstTrianglesStreamingCost(LLUUID mesh_id);
- F32 getStreamingCostLegacy(LLUUID mesh_id, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL);
- static F32 getStreamingCostLegacy(LLMeshHeader& header, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL);
+ F32 getStreamingCostLegacy(LLUUID mesh_id, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL);
+ static F32 getStreamingCostLegacy(LLMeshHeader& header, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL);
bool getCostData(LLUUID mesh_id, LLMeshCostData& data);
bool getCostData(LLMeshHeader& header, LLMeshCostData& data);
- LLMeshRepository();
-
- void init();
- void shutdown();
- S32 update();
-
- void unregisterMesh(LLVOVolume* volume);
- //mesh management functions
- S32 loadMesh(LLVOVolume* volume, const LLVolumeParams& mesh_params, S32 detail = 0, S32 last_lod = -1);
-
- void notifyLoadedMeshes();
- void notifyMeshLoaded(const LLVolumeParams& mesh_params, LLVolume* volume);
- void notifyMeshUnavailable(const LLVolumeParams& mesh_params, S32 lod);
- void notifySkinInfoReceived(LLMeshSkinInfo* info);
- void notifySkinInfoUnavailable(const LLUUID& info);
- void notifyDecompositionReceived(LLModel::Decomposition* info);
-
- S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
- static S32 getActualMeshLOD(LLMeshHeader& header, S32 lod);
- const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj = nullptr);
- LLModel::Decomposition* getDecomposition(const LLUUID& mesh_id);
- void fetchPhysicsShape(const LLUUID& mesh_id);
- bool hasPhysicsShape(const LLUUID& mesh_id);
+ LLMeshRepository();
+
+ void init();
+ void shutdown();
+ S32 update();
+
+ void unregisterMesh(LLVOVolume* volume);
+ //mesh management functions
+ S32 loadMesh(LLVOVolume* volume, const LLVolumeParams& mesh_params, S32 detail = 0, S32 last_lod = -1);
+
+ void notifyLoadedMeshes();
+ void notifyMeshLoaded(const LLVolumeParams& mesh_params, LLVolume* volume);
+ void notifyMeshUnavailable(const LLVolumeParams& mesh_params, S32 lod);
+ void notifySkinInfoReceived(LLMeshSkinInfo* info);
+ void notifySkinInfoUnavailable(const LLUUID& info);
+ void notifyDecompositionReceived(LLModel::Decomposition* info);
+
+ S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
+ static S32 getActualMeshLOD(LLMeshHeader& header, S32 lod);
+ const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj = nullptr);
+ LLModel::Decomposition* getDecomposition(const LLUUID& mesh_id);
+ void fetchPhysicsShape(const LLUUID& mesh_id);
+ bool hasPhysicsShape(const LLUUID& mesh_id);
bool hasSkinInfo(const LLUUID& mesh_id);
bool hasHeader(const LLUUID& mesh_id);
-
- void buildHull(const LLVolumeParams& params, S32 detail);
- void buildPhysicsMesh(LLModel::Decomposition& decomp);
-
- bool meshUploadEnabled();
- bool meshRezEnabled();
-
- void uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures,
+
+ void buildHull(const LLVolumeParams& params, S32 detail);
+ void buildPhysicsMesh(LLModel::Decomposition& decomp);
+
+ bool meshUploadEnabled();
+ bool meshRezEnabled();
+
+ void uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures,
bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position,
std::string upload_url, bool do_upload = true,
- LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()),
+ LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()),
LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
- S32 getMeshSize(const LLUUID& mesh_id, S32 lod);
-
- // Quiescent timer management, main thread only.
- static void metricsStart();
- static void metricsStop();
- static void metricsProgress(unsigned int count);
- static void metricsUpdate();
-
- typedef boost::unordered_map<LLUUID, std::vector<LLVOVolume*> > mesh_load_map;
- mesh_load_map mLoadingMeshes[4];
-
- typedef std::unordered_map<LLUUID, LLPointer<LLMeshSkinInfo>> skin_map;
- skin_map mSkinMap;
-
- typedef std::map<LLUUID, LLModel::Decomposition*> decomposition_map;
- decomposition_map mDecompositionMap;
-
- LLMutex* mMeshMutex;
-
- std::vector<LLMeshRepoThread::LODRequest> mPendingRequests;
-
- //list of mesh ids awaiting skin info
- typedef boost::unordered_map<LLUUID, std::vector<LLVOVolume*> > skin_load_map;
- skin_load_map mLoadingSkins;
-
- //list of mesh ids that need to send skin info fetch requests
- std::queue<LLUUID> mPendingSkinRequests;
-
- //list of mesh ids awaiting decompositions
- std::set<LLUUID> mLoadingDecompositions;
-
- //list of mesh ids that need to send decomposition fetch requests
- std::queue<LLUUID> mPendingDecompositionRequests;
-
- //list of mesh ids awaiting physics shapes
- std::set<LLUUID> mLoadingPhysicsShapes;
-
- //list of mesh ids that need to send physics shape fetch requests
- std::queue<LLUUID> mPendingPhysicsShapeRequests;
-
- U32 mMeshThreadCount;
-
- LLMeshRepoThread* mThread;
- std::vector<LLMeshUploadThread*> mUploads;
- std::vector<LLMeshUploadThread*> mUploadWaitList;
-
- LLPhysicsDecomp* mDecompThread;
-
- LLFrameTimer mSkinInfoCullTimer;
-
- class inventory_data
- {
- public:
- LLSD mPostData;
- LLSD mResponse;
-
- inventory_data(const LLSD& data, const LLSD& content)
- : mPostData(data), mResponse(content)
- {
- }
- };
-
- std::queue<inventory_data> mInventoryQ;
-
- std::queue<LLSD> mUploadErrorQ;
-
- void uploadError(LLSD& args);
- void updateInventory(inventory_data data);
+ S32 getMeshSize(const LLUUID& mesh_id, S32 lod);
+
+ // Quiescent timer management, main thread only.
+ static void metricsStart();
+ static void metricsStop();
+ static void metricsProgress(unsigned int count);
+ static void metricsUpdate();
+
+ typedef boost::unordered_map<LLUUID, std::vector<LLVOVolume*> > mesh_load_map;
+ mesh_load_map mLoadingMeshes[4];
+
+ typedef std::unordered_map<LLUUID, LLPointer<LLMeshSkinInfo>> skin_map;
+ skin_map mSkinMap;
+
+ typedef std::map<LLUUID, LLModel::Decomposition*> decomposition_map;
+ decomposition_map mDecompositionMap;
+
+ LLMutex* mMeshMutex;
+
+ std::vector<LLMeshRepoThread::LODRequest> mPendingRequests;
+
+ //list of mesh ids awaiting skin info
+ typedef boost::unordered_map<LLUUID, std::vector<LLVOVolume*> > skin_load_map;
+ skin_load_map mLoadingSkins;
+
+ //list of mesh ids that need to send skin info fetch requests
+ std::queue<LLUUID> mPendingSkinRequests;
+
+ //list of mesh ids awaiting decompositions
+ std::set<LLUUID> mLoadingDecompositions;
+
+ //list of mesh ids that need to send decomposition fetch requests
+ std::queue<LLUUID> mPendingDecompositionRequests;
+
+ //list of mesh ids awaiting physics shapes
+ std::set<LLUUID> mLoadingPhysicsShapes;
+
+ //list of mesh ids that need to send physics shape fetch requests
+ std::queue<LLUUID> mPendingPhysicsShapeRequests;
+
+ U32 mMeshThreadCount;
+
+ LLMeshRepoThread* mThread;
+ std::vector<LLMeshUploadThread*> mUploads;
+ std::vector<LLMeshUploadThread*> mUploadWaitList;
+
+ LLPhysicsDecomp* mDecompThread;
+
+ LLFrameTimer mSkinInfoCullTimer;
+
+ class inventory_data
+ {
+ public:
+ LLSD mPostData;
+ LLSD mResponse;
+
+ inventory_data(const LLSD& data, const LLSD& content)
+ : mPostData(data), mResponse(content)
+ {
+ }
+ };
+
+ std::queue<inventory_data> mInventoryQ;
+
+ std::queue<LLSD> mUploadErrorQ;
+
+ void uploadError(LLSD& args);
+ void updateInventory(inventory_data data);
};
extern LLMeshRepository gMeshRepo;
diff --git a/indra/newview/llmimetypes.cpp b/indra/newview/llmimetypes.cpp
index 790a184068..33d7ec2fc0 100644
--- a/indra/newview/llmimetypes.cpp
+++ b/indra/newview/llmimetypes.cpp
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,12 +37,12 @@ LLMIMETypes::mime_info_map_t LLMIMETypes::sMap;
LLMIMETypes::mime_widget_set_map_t LLMIMETypes::sWidgetMap;
std::string sDefaultLabel;
- // Returned when we don't know what to do with the mime type
+ // Returned when we don't know what to do with the mime type
std::string sDefaultWidgetType;
- // Returned when we don't know what widget set to use
+ // Returned when we don't know what widget set to use
std::string sDefaultImpl;
- // Returned when we don't know what impl to use
-std::string sXMLFilename;
+ // Returned when we don't know what impl to use
+std::string sXMLFilename;
// Squirrel away XML filename so we know how to reset
std::string DEFAULT_MIME_TYPE = "none/none";
@@ -51,252 +51,252 @@ std::string DEFAULT_MIME_TYPE = "none/none";
// static
bool LLMIMETypes::parseMIMETypes(const std::string& xml_filename)
{
- LLXMLNodePtr root;
- bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
- if ( ! success || root.isNull() || ! root->hasName( "mimetypes" ) )
- {
- LL_WARNS() << "Unable to read MIME type file: "
- << xml_filename << LL_ENDL;
- return false;
- }
+ LLXMLNodePtr root;
+ bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
+ if ( ! success || root.isNull() || ! root->hasName( "mimetypes" ) )
+ {
+ LL_WARNS() << "Unable to read MIME type file: "
+ << xml_filename << LL_ENDL;
+ return false;
+ }
- for (LLXMLNode* node = root->getFirstChild();
- node != NULL;
- node = node->getNextSibling())
- {
- if (node->hasName("defaultlabel"))
- {
- sDefaultLabel = node->getTextContents();
- }
- else if (node->hasName("defaultwidget"))
- {
- sDefaultWidgetType = node->getTextContents();
- }
- else if (node->hasName("defaultimpl"))
- {
- sDefaultImpl = node->getTextContents();
- }
- else if (node->hasName("mimetype") || node->hasName("scheme"))
- {
- std::string mime_type;
- node->getAttributeString("name", mime_type);
- LLMIMEInfo info;
- for (LLXMLNode* child = node->getFirstChild();
- child != NULL;
- child = child->getNextSibling())
- {
- if (child->hasName("label"))
- {
- info.mLabel = child->getTextContents();
- }
- else if (child->hasName("widgettype"))
- {
- info.mWidgetType = child->getTextContents();
- }
- else if (child->hasName("impl"))
- {
- info.mImpl = child->getTextContents();
- }
- }
- sMap[mime_type] = info;
- }
- else if (node->hasName("widgetset"))
- {
- std::string set_name;
- node->getAttributeString("name", set_name);
- LLMIMEWidgetSet info;
- for (LLXMLNode* child = node->getFirstChild();
- child != NULL;
- child = child->getNextSibling())
- {
- if (child->hasName("label"))
- {
- info.mLabel = child->getTextContents();
- }
- if (child->hasName("icon"))
- {
- info.mIcon = child->getTextContents();
- }
- if (child->hasName("default_type"))
- {
- info.mDefaultMimeType = child->getTextContents();
- }
- if (child->hasName("tooltip"))
- {
- info.mToolTip = child->getTextContents();
- }
- if (child->hasName("playtip"))
- {
- info.mPlayTip = child->getTextContents();
- }
- if (child->hasName("allow_resize"))
- {
- BOOL allow_resize = FALSE;
- child->getBoolValue( 1, &allow_resize );
- info.mAllowResize = (bool)allow_resize;
- }
- if (child->hasName("allow_looping"))
- {
- BOOL allow_looping = FALSE;
- child->getBoolValue( 1, &allow_looping );
- info.mAllowLooping = (bool)allow_looping;
- }
- }
- sWidgetMap[set_name] = info;
- }
- }
+ for (LLXMLNode* node = root->getFirstChild();
+ node != NULL;
+ node = node->getNextSibling())
+ {
+ if (node->hasName("defaultlabel"))
+ {
+ sDefaultLabel = node->getTextContents();
+ }
+ else if (node->hasName("defaultwidget"))
+ {
+ sDefaultWidgetType = node->getTextContents();
+ }
+ else if (node->hasName("defaultimpl"))
+ {
+ sDefaultImpl = node->getTextContents();
+ }
+ else if (node->hasName("mimetype") || node->hasName("scheme"))
+ {
+ std::string mime_type;
+ node->getAttributeString("name", mime_type);
+ LLMIMEInfo info;
+ for (LLXMLNode* child = node->getFirstChild();
+ child != NULL;
+ child = child->getNextSibling())
+ {
+ if (child->hasName("label"))
+ {
+ info.mLabel = child->getTextContents();
+ }
+ else if (child->hasName("widgettype"))
+ {
+ info.mWidgetType = child->getTextContents();
+ }
+ else if (child->hasName("impl"))
+ {
+ info.mImpl = child->getTextContents();
+ }
+ }
+ sMap[mime_type] = info;
+ }
+ else if (node->hasName("widgetset"))
+ {
+ std::string set_name;
+ node->getAttributeString("name", set_name);
+ LLMIMEWidgetSet info;
+ for (LLXMLNode* child = node->getFirstChild();
+ child != NULL;
+ child = child->getNextSibling())
+ {
+ if (child->hasName("label"))
+ {
+ info.mLabel = child->getTextContents();
+ }
+ if (child->hasName("icon"))
+ {
+ info.mIcon = child->getTextContents();
+ }
+ if (child->hasName("default_type"))
+ {
+ info.mDefaultMimeType = child->getTextContents();
+ }
+ if (child->hasName("tooltip"))
+ {
+ info.mToolTip = child->getTextContents();
+ }
+ if (child->hasName("playtip"))
+ {
+ info.mPlayTip = child->getTextContents();
+ }
+ if (child->hasName("allow_resize"))
+ {
+ BOOL allow_resize = FALSE;
+ child->getBoolValue( 1, &allow_resize );
+ info.mAllowResize = (bool)allow_resize;
+ }
+ if (child->hasName("allow_looping"))
+ {
+ BOOL allow_looping = FALSE;
+ child->getBoolValue( 1, &allow_looping );
+ info.mAllowLooping = (bool)allow_looping;
+ }
+ }
+ sWidgetMap[set_name] = info;
+ }
+ }
- sXMLFilename = xml_filename;
- return true;
+ sXMLFilename = xml_filename;
+ return true;
}
// static
std::string LLMIMETypes::translate(const std::string& mime_type)
{
- mime_info_map_t::const_iterator it = sMap.find(mime_type);
- if (it != sMap.end())
- {
- return it->second.mLabel;
- }
- else
- {
- return sDefaultLabel;
- }
+ mime_info_map_t::const_iterator it = sMap.find(mime_type);
+ if (it != sMap.end())
+ {
+ return it->second.mLabel;
+ }
+ else
+ {
+ return sDefaultLabel;
+ }
}
// static
std::string LLMIMETypes::widgetType(const std::string& mime_type)
{
- mime_info_map_t::const_iterator it = sMap.find(mime_type);
- if (it != sMap.end())
- {
- return it->second.mWidgetType;
- }
- else
- {
- return sDefaultWidgetType;
- }
+ mime_info_map_t::const_iterator it = sMap.find(mime_type);
+ if (it != sMap.end())
+ {
+ return it->second.mWidgetType;
+ }
+ else
+ {
+ return sDefaultWidgetType;
+ }
}
// static
std::string LLMIMETypes::implType(const std::string& mime_type)
{
- mime_info_map_t::const_iterator it = sMap.find(mime_type);
- if (it != sMap.end())
- {
- return it->second.mImpl;
- }
- else
- {
- return sDefaultImpl;
- }
+ mime_info_map_t::const_iterator it = sMap.find(mime_type);
+ if (it != sMap.end())
+ {
+ return it->second.mImpl;
+ }
+ else
+ {
+ return sDefaultImpl;
+ }
}
// static
std::string LLMIMETypes::findIcon(const std::string& mime_type)
{
- std::string icon = "";
- std::string widget_type = LLMIMETypes::widgetType(mime_type);
- mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
- if(it != sWidgetMap.end())
- {
- icon = it->second.mIcon;
- }
- return icon;
+ std::string icon = "";
+ std::string widget_type = LLMIMETypes::widgetType(mime_type);
+ mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
+ if(it != sWidgetMap.end())
+ {
+ icon = it->second.mIcon;
+ }
+ return icon;
}
// static
std::string LLMIMETypes::findDefaultMimeType(const std::string& widget_type)
{
- std::string mime_type = getDefaultMimeType();
- mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
- if(it != sWidgetMap.end())
- {
- mime_type = it->second.mDefaultMimeType;
- }
- return mime_type;
+ std::string mime_type = getDefaultMimeType();
+ mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
+ if(it != sWidgetMap.end())
+ {
+ mime_type = it->second.mDefaultMimeType;
+ }
+ return mime_type;
}
// static
const std::string& LLMIMETypes::getDefaultMimeType()
{
- return DEFAULT_MIME_TYPE;
+ return DEFAULT_MIME_TYPE;
}
const std::string& LLMIMETypes::getDefaultMimeTypeTranslation()
{
- static std::string mime_type = LLTrans::getString("DefaultMimeType");
- return mime_type;
+ static std::string mime_type = LLTrans::getString("DefaultMimeType");
+ return mime_type;
}
// static
std::string LLMIMETypes::findToolTip(const std::string& mime_type)
{
- std::string tool_tip = "";
- std::string widget_type = LLMIMETypes::widgetType(mime_type);
- mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
- if(it != sWidgetMap.end())
- {
- tool_tip = it->second.mToolTip;
- }
- return tool_tip;
+ std::string tool_tip = "";
+ std::string widget_type = LLMIMETypes::widgetType(mime_type);
+ mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
+ if(it != sWidgetMap.end())
+ {
+ tool_tip = it->second.mToolTip;
+ }
+ return tool_tip;
}
// static
std::string LLMIMETypes::findPlayTip(const std::string& mime_type)
{
- std::string play_tip = "";
- std::string widget_type = LLMIMETypes::widgetType(mime_type);
- mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
- if(it != sWidgetMap.end())
- {
- play_tip = it->second.mPlayTip;
- }
- return play_tip;
+ std::string play_tip = "";
+ std::string widget_type = LLMIMETypes::widgetType(mime_type);
+ mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
+ if(it != sWidgetMap.end())
+ {
+ play_tip = it->second.mPlayTip;
+ }
+ return play_tip;
}
// static
bool LLMIMETypes::findAllowResize(const std::string& mime_type)
{
- bool allow_resize = false;
- std::string widget_type = LLMIMETypes::widgetType(mime_type);
- mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
- if(it != sWidgetMap.end())
- {
- allow_resize = it->second.mAllowResize;
- }
- return allow_resize;
+ bool allow_resize = false;
+ std::string widget_type = LLMIMETypes::widgetType(mime_type);
+ mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
+ if(it != sWidgetMap.end())
+ {
+ allow_resize = it->second.mAllowResize;
+ }
+ return allow_resize;
}
// static
bool LLMIMETypes::findAllowLooping(const std::string& mime_type)
{
- bool allow_looping = false;
- std::string widget_type = LLMIMETypes::widgetType(mime_type);
- mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
- if(it != sWidgetMap.end())
- {
- allow_looping = it->second.mAllowLooping;
- }
- return allow_looping;
+ bool allow_looping = false;
+ std::string widget_type = LLMIMETypes::widgetType(mime_type);
+ mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
+ if(it != sWidgetMap.end())
+ {
+ allow_looping = it->second.mAllowLooping;
+ }
+ return allow_looping;
}
// static
bool LLMIMETypes::isTypeHandled(const std::string& mime_type)
{
- mime_info_map_t::const_iterator it = sMap.find(mime_type);
- if (it != sMap.end())
- {
- return true;
- }
- return false;
+ mime_info_map_t::const_iterator it = sMap.find(mime_type);
+ if (it != sMap.end())
+ {
+ return true;
+ }
+ return false;
}
// static
void LLMIMETypes::reload(void*)
{
- sMap.clear();
- sWidgetMap.clear();
- (void)LLMIMETypes::parseMIMETypes(sXMLFilename);
+ sMap.clear();
+ sWidgetMap.clear();
+ (void)LLMIMETypes::parseMIMETypes(sXMLFilename);
}
diff --git a/indra/newview/llmimetypes.h b/indra/newview/llmimetypes.h
index ab629fd965..c38ed18871 100644
--- a/indra/newview/llmimetypes.h
+++ b/indra/newview/llmimetypes.h
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,89 +34,89 @@
class LLMIMETypes
{
public:
- static bool parseMIMETypes(const std::string& xml_file_path);
- // Loads the MIME string definition XML file, usually
- // from the application skins directory
+ static bool parseMIMETypes(const std::string& xml_file_path);
+ // Loads the MIME string definition XML file, usually
+ // from the application skins directory
- static std::string translate(const std::string& mime_type);
- // Returns "QuickTime Movie" from "video/quicktime"
+ static std::string translate(const std::string& mime_type);
+ // Returns "QuickTime Movie" from "video/quicktime"
- static std::string widgetType(const std::string& mime_type);
- // Type of control widgets for this MIME type
- // Returns "movie" from "video/quicktime"
+ static std::string widgetType(const std::string& mime_type);
+ // Type of control widgets for this MIME type
+ // Returns "movie" from "video/quicktime"
- static std::string implType(const std::string& mime_type);
- // Type of Impl to use for decoding media.
+ static std::string implType(const std::string& mime_type);
+ // Type of Impl to use for decoding media.
- static std::string findIcon(const std::string& mime_type);
- // Icon from control widget type for this MIME type
+ static std::string findIcon(const std::string& mime_type);
+ // Icon from control widget type for this MIME type
- static std::string findToolTip(const std::string& mime_type);
- // Tool tip from control widget type for this MIME type
+ static std::string findToolTip(const std::string& mime_type);
+ // Tool tip from control widget type for this MIME type
- static std::string findPlayTip(const std::string& mime_type);
- // Play button tool tip from control widget type for this MIME type
+ static std::string findPlayTip(const std::string& mime_type);
+ // Play button tool tip from control widget type for this MIME type
- static std::string findDefaultMimeType(const std::string& widget_type);
- // Canonical mime type associated with this widget set
+ static std::string findDefaultMimeType(const std::string& widget_type);
+ // Canonical mime type associated with this widget set
- static const std::string& getDefaultMimeType();
+ static const std::string& getDefaultMimeType();
- static const std::string& getDefaultMimeTypeTranslation();
+ static const std::string& getDefaultMimeTypeTranslation();
- static bool findAllowResize(const std::string& mime_type);
- // accessor for flag to enable/disable media size edit fields
+ static bool findAllowResize(const std::string& mime_type);
+ // accessor for flag to enable/disable media size edit fields
- static bool findAllowLooping(const std::string& mime_type);
- // accessor for flag to enable/disable media looping checkbox
+ static bool findAllowLooping(const std::string& mime_type);
+ // accessor for flag to enable/disable media looping checkbox
- static bool isTypeHandled(const std::string& mime_type);
- // determines if the specific mime type is handled by the media system
+ static bool isTypeHandled(const std::string& mime_type);
+ // determines if the specific mime type is handled by the media system
- static void reload(void*);
- // re-loads the MIME types file from the file path last passed into parseMIMETypes
+ static void reload(void*);
+ // re-loads the MIME types file from the file path last passed into parseMIMETypes
public:
- struct LLMIMEInfo
- {
- std::string mLabel;
- // friendly label like "QuickTime Movie"
-
- std::string mWidgetType;
- // "web" means use web media UI widgets
-
- std::string mImpl;
- // which impl to use with this mime type
- };
- struct LLMIMEWidgetSet
- {
- std::string mLabel;
- // friendly label like "QuickTime Movie"
-
- std::string mIcon;
- // Name of icon asset to display in toolbar
-
- std::string mDefaultMimeType;
- // Mime type string to use in absence of a specific one
-
- std::string mToolTip;
- // custom tool tip for this mime type
-
- std::string mPlayTip;
- // custom tool tip to display for Play button
-
- BOOL mAllowResize;
- // enable/disable media size edit fields
-
- BOOL mAllowLooping;
- // enable/disable media looping checkbox
- };
- typedef std::map< std::string, LLMIMEInfo > mime_info_map_t;
- typedef std::map< std::string, LLMIMEWidgetSet > mime_widget_set_map_t;
-
- // Public so users can iterate over it
- static mime_info_map_t sMap;
- static mime_widget_set_map_t sWidgetMap;
+ struct LLMIMEInfo
+ {
+ std::string mLabel;
+ // friendly label like "QuickTime Movie"
+
+ std::string mWidgetType;
+ // "web" means use web media UI widgets
+
+ std::string mImpl;
+ // which impl to use with this mime type
+ };
+ struct LLMIMEWidgetSet
+ {
+ std::string mLabel;
+ // friendly label like "QuickTime Movie"
+
+ std::string mIcon;
+ // Name of icon asset to display in toolbar
+
+ std::string mDefaultMimeType;
+ // Mime type string to use in absence of a specific one
+
+ std::string mToolTip;
+ // custom tool tip for this mime type
+
+ std::string mPlayTip;
+ // custom tool tip to display for Play button
+
+ BOOL mAllowResize;
+ // enable/disable media size edit fields
+
+ BOOL mAllowLooping;
+ // enable/disable media looping checkbox
+ };
+ typedef std::map< std::string, LLMIMEInfo > mime_info_map_t;
+ typedef std::map< std::string, LLMIMEWidgetSet > mime_widget_set_map_t;
+
+ // Public so users can iterate over it
+ static mime_info_map_t sMap;
+ static mime_widget_set_map_t sWidgetMap;
private:
};
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index a3eab3c26d..897eb07b5c 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -2784,7 +2784,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
LLVertexBuffer* vb = NULL;
-
+
U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
@@ -3144,7 +3144,7 @@ BOOL LLModelPreview::render()
LLGLDisable no_blend(GL_BLEND);
LLGLEnable cull(GL_CULL_FACE);
LLGLDepthTest depth(GL_FALSE); // SL-12781 disable z-buffer to render background color
-
+
{
gUIProgram.bind();
@@ -3331,9 +3331,9 @@ BOOL LLModelPreview::render()
LLQuaternion av_rot = camera_rot;
F32 camera_distance = skin_weight ? SKIN_WEIGHT_CAMERA_DISTANCE : mCameraDistance;
LLViewerCamera::getInstance()->setOriginAndLookAt(
- target_pos + ((LLVector3(camera_distance, 0.f, 0.f) + offset) * av_rot), // camera
- LLVector3::z_axis, // up
- target_pos); // point of interest
+ target_pos + ((LLVector3(camera_distance, 0.f, 0.f) + offset) * av_rot), // camera
+ LLVector3::z_axis, // up
+ target_pos); // point of interest
z_near = llclamp(z_far * 0.001f, 0.001f, 0.1f);
@@ -3399,7 +3399,7 @@ BOOL LLModelPreview::render()
LLMatrix4 mat = instance.mTransform;
gGL.multMatrix((GLfloat*)mat.mMatrix);
-
+
U32 num_models = mVertexBuffer[mPreviewLOD][model].size();
for (U32 i = 0; i < num_models; ++i)
{
@@ -3664,9 +3664,9 @@ BOOL LLModelPreview::render()
bool pelvis_recalc = false;
LLViewerCamera::getInstance()->setOriginAndLookAt(
- target_pos + ((LLVector3(camera_distance, 0.f, 0.f) + offset) * av_rot), // camera
- LLVector3::z_axis, // up
- target_pos); // point of interest
+ target_pos + ((LLVector3(camera_distance, 0.f, 0.f) + offset) * av_rot), // camera
+ LLVector3::z_axis, // up
+ target_pos); // point of interest
for (LLModelLoader::scene::iterator iter = mScene[mPreviewLOD].begin(); iter != mScene[mPreviewLOD].end(); ++iter)
{
@@ -3817,22 +3817,22 @@ BOOL LLModelPreview::render()
void LLModelPreview::renderGroundPlane(float z_offset)
{ // Not necesarilly general - beware - but it seems to meet the needs of LLModelPreview::render
- gGL.diffuseColor3f( 1.0f, 0.0f, 1.0f );
+ gGL.diffuseColor3f( 1.0f, 0.0f, 1.0f );
- gGL.begin(LLRender::LINES);
- gGL.vertex3fv(mGroundPlane[0].mV);
- gGL.vertex3fv(mGroundPlane[1].mV);
+ gGL.begin(LLRender::LINES);
+ gGL.vertex3fv(mGroundPlane[0].mV);
+ gGL.vertex3fv(mGroundPlane[1].mV);
- gGL.vertex3fv(mGroundPlane[1].mV);
- gGL.vertex3fv(mGroundPlane[2].mV);
+ gGL.vertex3fv(mGroundPlane[1].mV);
+ gGL.vertex3fv(mGroundPlane[2].mV);
- gGL.vertex3fv(mGroundPlane[2].mV);
- gGL.vertex3fv(mGroundPlane[3].mV);
+ gGL.vertex3fv(mGroundPlane[2].mV);
+ gGL.vertex3fv(mGroundPlane[3].mV);
- gGL.vertex3fv(mGroundPlane[3].mV);
- gGL.vertex3fv(mGroundPlane[0].mV);
+ gGL.vertex3fv(mGroundPlane[3].mV);
+ gGL.vertex3fv(mGroundPlane[0].mV);
- gGL.end();
+ gGL.end();
}
diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h
index d4d5d087bd..064623ac6a 100644
--- a/indra/newview/llmodelpreview.h
+++ b/indra/newview/llmodelpreview.h
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -190,7 +190,7 @@ public:
U32 getLegacyRigFlags() const { return mLegacyRigFlags; }
void setLegacyRigFlags(U32 rigFlags) { mLegacyRigFlags = rigFlags; }
- static void textureLoadedCallback(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata);
+ static void textureLoadedCallback(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata);
static bool lodQueryCallback();
boost::signals2::connection setDetailsCallback(const details_signal_t::slot_type& cb){ return mDetailsSignal.connect(cb); }
@@ -200,18 +200,18 @@ public:
void setLoadState(U32 state) { mLoadState = state; }
U32 getLoadState() { return mLoadState; }
- static bool sIgnoreLoadedCallback;
+ static bool sIgnoreLoadedCallback;
std::vector<S32> mLodsQuery;
std::vector<S32> mLodsWithParsingError;
bool mHasDegenerate;
protected:
- static void loadedCallback(LLModelLoader::scene& scene, LLModelLoader::model_list& model_list, S32 lod, void* opaque);
- static void stateChangedCallback(U32 state, void* opaque);
+ static void loadedCallback(LLModelLoader::scene& scene, LLModelLoader::model_list& model_list, S32 lod, void* opaque);
+ static void stateChangedCallback(U32 state, void* opaque);
- static LLJoint* lookupJointByName(const std::string&, void* opaque);
- static U32 loadTextures(LLImportMaterial& material, void* opaque);
+ static LLJoint* lookupJointByName(const std::string&, void* opaque);
+ static U32 loadTextures(LLImportMaterial& material, void* opaque);
void lookupLODModelFiles(S32 lod);
@@ -219,13 +219,13 @@ private:
//Utility function for controller vertex compare
bool verifyCount(int expected, int result);
//Creates the dummy avatar for the preview window
- void createPreviewAvatar(void);
+ void createPreviewAvatar(void);
//Accessor for the dummy avatar
LLVOAvatar* getPreviewAvatar(void) { return mPreviewAvatar; }
// Count amount of original models, excluding sub-models
static U32 countRootModels(LLModelLoader::model_list models);
LLVector3 mGroundPlane[4];
- void renderGroundPlane(float z_offset = 0.0f);
+ void renderGroundPlane(float z_offset = 0.0f);
/// Indicates whether we should warn of high-lod meshes that do not have a corresponding physics mesh.
/// Reset when resetting the modelpreview (i.e., when the uploader dialog is created or reset), and when
/// about to process a physics file. Set to true immediately after the file is loaded (before rebuildUploadData()).
@@ -267,24 +267,24 @@ protected:
LLFloater* mFMP;
BOOL mNeedsUpdate;
- bool mDirty;
- bool mGenLOD;
+ bool mDirty;
+ bool mGenLOD;
U32 mTextureName;
- F32 mCameraDistance;
- F32 mCameraYaw;
- F32 mCameraPitch;
- F32 mCameraZoom;
- LLVector3 mCameraOffset;
- LLVector3 mPreviewTarget;
- LLVector3 mPreviewScale;
- S32 mPreviewLOD;
- S32 mPhysicsSearchLOD;
+ F32 mCameraDistance;
+ F32 mCameraYaw;
+ F32 mCameraPitch;
+ F32 mCameraZoom;
+ LLVector3 mCameraOffset;
+ LLVector3 mPreviewTarget;
+ LLVector3 mPreviewScale;
+ S32 mPreviewLOD;
+ S32 mPhysicsSearchLOD;
std::string mLODFile[LLModel::NUM_LODS];
- bool mLoading;
- U32 mLoadState;
- bool mResetJoints;
- bool mModelNoErrors;
- bool mLookUpLodFiles;
+ bool mLoading;
+ U32 mLoadState;
+ bool mResetJoints;
+ bool mModelNoErrors;
+ bool mLookUpLodFiles;
std::map<std::string, bool> mViewOption;
@@ -303,8 +303,8 @@ protected:
LLModelLoader::model_list mModel[LLModel::NUM_LODS];
LLModelLoader::model_list mBaseModel;
- typedef std::vector<LLVolumeFace> v_LLVolumeFace_t;
- typedef std::vector<v_LLVolumeFace_t> vv_LLVolumeFace_t;
+ typedef std::vector<LLVolumeFace> v_LLVolumeFace_t;
+ typedef std::vector<v_LLVolumeFace_t> vv_LLVolumeFace_t;
vv_LLVolumeFace_t mModelFacesCopy[LLModel::NUM_LODS];
vv_LLVolumeFace_t mBaseModelFacesCopy;
@@ -324,22 +324,22 @@ protected:
model_loaded_signal_t mModelLoadedSignal;
model_updated_signal_t mModelUpdatedSignal;
- LLVector3 mModelPivot;
- bool mHasPivot;
+ LLVector3 mModelPivot;
+ bool mHasPivot;
- float mPelvisZOffset;
+ float mPelvisZOffset;
- bool mRigValidJointUpload;
- U32 mLegacyRigFlags;
+ bool mRigValidJointUpload;
+ U32 mLegacyRigFlags;
- bool mLastJointUpdate;
- bool mFirstSkinUpdate;
+ bool mLastJointUpdate;
+ bool mFirstSkinUpdate;
- JointNameSet mJointsFromNode;
- JointTransformMap mJointTransformMap;
+ JointNameSet mJointsFromNode;
+ JointTransformMap mJointTransformMap;
- LLPointer<LLVOAvatar> mPreviewAvatar;
- LLCachedControl<bool> mImporterDebug;
+ LLPointer<LLVOAvatar> mPreviewAvatar;
+ LLCachedControl<bool> mImporterDebug;
};
#endif // LL_LLMODELPREVIEW_H
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index ff86400a56..95c55f8a0c 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmorphview.cpp
* @brief Container for Morph functionality
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,50 +53,50 @@ const F32 MORPH_NEAR_CLIP = 0.1f;
// LLMorphView()
//-----------------------------------------------------------------------------
LLMorphView::LLMorphView(const LLMorphView::Params& p)
-: LLView(p),
- mCameraTargetJoint( NULL ),
- mCameraOffset(-0.5f, 0.05f, 0.07f ),
- mCameraTargetOffset(0.f, 0.f, 0.05f ),
- mOldCameraNearClip( 0.f ),
- mCameraPitch( 0.f ),
- mCameraYaw( 0.f ),
- mCameraDrivenByKeys( FALSE )
+: LLView(p),
+ mCameraTargetJoint( NULL ),
+ mCameraOffset(-0.5f, 0.05f, 0.07f ),
+ mCameraTargetOffset(0.f, 0.f, 0.05f ),
+ mOldCameraNearClip( 0.f ),
+ mCameraPitch( 0.f ),
+ mCameraYaw( 0.f ),
+ mCameraDrivenByKeys( FALSE )
{}
//-----------------------------------------------------------------------------
// initialize()
//-----------------------------------------------------------------------------
-void LLMorphView::initialize()
+void LLMorphView::initialize()
{
- mCameraPitch = 0.f;
- mCameraYaw = 0.f;
-
- if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
- {
- gAgentCamera.changeCameraToDefault();
- return;
- }
-
- gAgentAvatarp->stopMotion( ANIM_AGENT_BODY_NOISE );
- gAgentAvatarp->mSpecialRenderMode = 3;
-
- // set up camera for close look at avatar
- mOldCameraNearClip = LLViewerCamera::getInstance()->getNear();
- LLViewerCamera::getInstance()->setNear(MORPH_NEAR_CLIP);
+ mCameraPitch = 0.f;
+ mCameraYaw = 0.f;
+
+ if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
+ {
+ gAgentCamera.changeCameraToDefault();
+ return;
+ }
+
+ gAgentAvatarp->stopMotion( ANIM_AGENT_BODY_NOISE );
+ gAgentAvatarp->mSpecialRenderMode = 3;
+
+ // set up camera for close look at avatar
+ mOldCameraNearClip = LLViewerCamera::getInstance()->getNear();
+ LLViewerCamera::getInstance()->setNear(MORPH_NEAR_CLIP);
}
//-----------------------------------------------------------------------------
// shutdown()
//-----------------------------------------------------------------------------
-void LLMorphView::shutdown()
+void LLMorphView::shutdown()
{
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE );
- gAgentAvatarp->mSpecialRenderMode = 0;
- // reset camera
- LLViewerCamera::getInstance()->setNear(mOldCameraNearClip);
- }
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE );
+ gAgentAvatarp->mSpecialRenderMode = 0;
+ // reset camera
+ LLViewerCamera::getInstance()->setNear(mOldCameraNearClip);
+ }
}
@@ -105,62 +105,62 @@ void LLMorphView::shutdown()
//-----------------------------------------------------------------------------
void LLMorphView::setVisible(BOOL visible)
{
- if( visible != getVisible() )
- {
- LLView::setVisible(visible);
-
- if (visible)
- {
- // TODO: verify some user action has already opened outfit editor? - Nyx
- initialize();
-
- // First run dialog
- //LLFirstUse::useAppearance();
- }
- else
- {
- // TODO: verify some user action has already closed outfit editor ? - Nyx
- shutdown();
- }
- }
+ if( visible != getVisible() )
+ {
+ LLView::setVisible(visible);
+
+ if (visible)
+ {
+ // TODO: verify some user action has already opened outfit editor? - Nyx
+ initialize();
+
+ // First run dialog
+ //LLFirstUse::useAppearance();
+ }
+ else
+ {
+ // TODO: verify some user action has already closed outfit editor ? - Nyx
+ shutdown();
+ }
+ }
}
void LLMorphView::updateCamera()
{
- if (!mCameraTargetJoint)
- {
- setCameraTargetJoint(gAgentAvatarp->getJoint("mHead"));
- }
- if (!isAgentAvatarValid()) return;
+ if (!mCameraTargetJoint)
+ {
+ setCameraTargetJoint(gAgentAvatarp->getJoint("mHead"));
+ }
+ if (!isAgentAvatarValid()) return;
- LLJoint* root_joint = gAgentAvatarp->getRootJoint();
- if( !root_joint )
- {
- return;
- }
+ LLJoint* root_joint = gAgentAvatarp->getRootJoint();
+ if( !root_joint )
+ {
+ return;
+ }
- const LLQuaternion& avatar_rot = root_joint->getWorldRotation();
+ const LLQuaternion& avatar_rot = root_joint->getWorldRotation();
- LLVector3d joint_pos = gAgent.getPosGlobalFromAgent(mCameraTargetJoint->getWorldPosition());
- LLVector3d target_pos = joint_pos + mCameraTargetOffset * avatar_rot;
+ LLVector3d joint_pos = gAgent.getPosGlobalFromAgent(mCameraTargetJoint->getWorldPosition());
+ LLVector3d target_pos = joint_pos + mCameraTargetOffset * avatar_rot;
- LLQuaternion camera_rot_yaw(mCameraYaw, LLVector3::z_axis);
- LLQuaternion camera_rot_pitch(mCameraPitch, LLVector3::y_axis);
+ LLQuaternion camera_rot_yaw(mCameraYaw, LLVector3::z_axis);
+ LLQuaternion camera_rot_pitch(mCameraPitch, LLVector3::y_axis);
- LLVector3d camera_pos = joint_pos + mCameraOffset * camera_rot_pitch * camera_rot_yaw * avatar_rot;
+ LLVector3d camera_pos = joint_pos + mCameraOffset * camera_rot_pitch * camera_rot_yaw * avatar_rot;
- gAgentCamera.setCameraPosAndFocusGlobal( camera_pos, target_pos, gAgent.getID() );
+ gAgentCamera.setCameraPosAndFocusGlobal( camera_pos, target_pos, gAgent.getID() );
}
void LLMorphView::setCameraDrivenByKeys(BOOL b)
{
- if( mCameraDrivenByKeys != b )
- {
- if( b )
- {
- // Reset to the default camera position specified by mCameraPitch, mCameraYaw, etc.
- updateCamera();
- }
- mCameraDrivenByKeys = b;
- }
+ if( mCameraDrivenByKeys != b )
+ {
+ if( b )
+ {
+ // Reset to the default camera position specified by mCameraPitch, mCameraYaw, etc.
+ updateCamera();
+ }
+ mCameraDrivenByKeys = b;
+ }
}
diff --git a/indra/newview/llmorphview.h b/indra/newview/llmorphview.h
index 318d49bba5..f3af581a85 100644
--- a/indra/newview/llmorphview.h
+++ b/indra/newview/llmorphview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmorphview.h
* @brief Container for character morph controls
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,46 +36,46 @@ class LLJoint;
class LLMorphView : public LLView
{
public:
- struct Params : public LLInitParam::Block<Params, LLView::Params>
- {
- Params()
- {
- changeDefault(mouse_opaque, false);
- changeDefault(follows.flags, FOLLOWS_ALL);
- }
- };
- LLMorphView(const LLMorphView::Params&);
-
- void shutdown();
-
- // inherited methods
- /*virtual*/ void setVisible(BOOL visible);
-
- void setCameraTargetJoint(LLJoint *joint) {mCameraTargetJoint = joint;}
- LLJoint* getCameraTargetJoint() {return mCameraTargetJoint;}
-
- void setCameraOffset(const LLVector3d& camera_offset) {mCameraOffset = camera_offset;}
- void setCameraTargetOffset(const LLVector3d& camera_target_offset) {mCameraTargetOffset = camera_target_offset;}
-
- void updateCamera();
- void setCameraDrivenByKeys( BOOL b );
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ Params()
+ {
+ changeDefault(mouse_opaque, false);
+ changeDefault(follows.flags, FOLLOWS_ALL);
+ }
+ };
+ LLMorphView(const LLMorphView::Params&);
+
+ void shutdown();
+
+ // inherited methods
+ /*virtual*/ void setVisible(BOOL visible);
+
+ void setCameraTargetJoint(LLJoint *joint) {mCameraTargetJoint = joint;}
+ LLJoint* getCameraTargetJoint() {return mCameraTargetJoint;}
+
+ void setCameraOffset(const LLVector3d& camera_offset) {mCameraOffset = camera_offset;}
+ void setCameraTargetOffset(const LLVector3d& camera_target_offset) {mCameraTargetOffset = camera_target_offset;}
+
+ void updateCamera();
+ void setCameraDrivenByKeys( BOOL b );
protected:
- void initialize();
+ void initialize();
- LLJoint* mCameraTargetJoint;
- LLVector3d mCameraOffset;
- LLVector3d mCameraTargetOffset;
- LLVector3d mOldCameraPos;
- LLVector3d mOldTargetPos;
- F32 mOldCameraNearClip;
- LLFrameTimer mCameraMoveTimer;
+ LLJoint* mCameraTargetJoint;
+ LLVector3d mCameraOffset;
+ LLVector3d mCameraTargetOffset;
+ LLVector3d mOldCameraPos;
+ LLVector3d mOldTargetPos;
+ F32 mOldCameraNearClip;
+ LLFrameTimer mCameraMoveTimer;
- // camera rotation
- F32 mCameraPitch;
- F32 mCameraYaw;
+ // camera rotation
+ F32 mCameraPitch;
+ F32 mCameraYaw;
- BOOL mCameraDrivenByKeys;
+ BOOL mCameraDrivenByKeys;
};
//
@@ -84,4 +84,4 @@ protected:
extern LLMorphView *gMorphView;
-#endif
+#endif
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index 54409a6994..640c7ef766 100644
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmoveview.cpp
* @brief Container for movement buttons like forward, left, fly
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,8 +56,8 @@
//
const F32 MOVE_BUTTON_DELAY = 0.0f;
-const F32 YAW_NUDGE_RATE = 0.05f; // fraction of normal speed
-const F32 NUDGE_TIME = 0.25f; // in seconds
+const F32 YAW_NUDGE_RATE = 0.05f; // fraction of normal speed
+const F32 NUDGE_TIME = 0.25f; // in seconds
//
// Member functions
@@ -65,222 +65,222 @@ const F32 NUDGE_TIME = 0.25f; // in seconds
// protected
LLFloaterMove::LLFloaterMove(const LLSD& key)
-: LLFloater(key),
- mForwardButton(NULL),
- mBackwardButton(NULL),
- mTurnLeftButton(NULL),
- mTurnRightButton(NULL),
- mMoveUpButton(NULL),
- mMoveDownButton(NULL),
- mModeActionsPanel(NULL),
- mCurrentMode(MM_WALK)
+: LLFloater(key),
+ mForwardButton(NULL),
+ mBackwardButton(NULL),
+ mTurnLeftButton(NULL),
+ mTurnRightButton(NULL),
+ mMoveUpButton(NULL),
+ mMoveDownButton(NULL),
+ mModeActionsPanel(NULL),
+ mCurrentMode(MM_WALK)
{
}
LLFloaterMove::~LLFloaterMove()
{
- // Ensure LLPanelStandStopFlying panel is not among floater's children. See EXT-8458.
- setVisible(FALSE);
+ // Ensure LLPanelStandStopFlying panel is not among floater's children. See EXT-8458.
+ setVisible(FALSE);
- // Otherwise it can be destroyed and static pointer in LLPanelStandStopFlying::getInstance() will become invalid.
- // Such situation was possible when LLFloaterReg returns "dead" instance of floater.
- // Should not happen after LLFloater::destroy was modified to remove "dead" instances from LLFloaterReg.
+ // Otherwise it can be destroyed and static pointer in LLPanelStandStopFlying::getInstance() will become invalid.
+ // Such situation was possible when LLFloaterReg returns "dead" instance of floater.
+ // Should not happen after LLFloater::destroy was modified to remove "dead" instances from LLFloaterReg.
}
// virtual
BOOL LLFloaterMove::postBuild()
{
- updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
-
- // Code that implements floater buttons toggling when user moves via keyboard is located in LLAgent::propagate()
+ updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
+
+ // Code that implements floater buttons toggling when user moves via keyboard is located in LLAgent::propagate()
- mForwardButton = getChild<LLJoystickAgentTurn>("forward btn");
- mForwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+ mForwardButton = getChild<LLJoystickAgentTurn>("forward btn");
+ mForwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
- mBackwardButton = getChild<LLJoystickAgentTurn>("backward btn");
- mBackwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+ mBackwardButton = getChild<LLJoystickAgentTurn>("backward btn");
+ mBackwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
- mSlideLeftButton = getChild<LLJoystickAgentSlide>("move left btn");
- mSlideLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+ mSlideLeftButton = getChild<LLJoystickAgentSlide>("move left btn");
+ mSlideLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
- mSlideRightButton = getChild<LLJoystickAgentSlide>("move right btn");
- mSlideRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+ mSlideRightButton = getChild<LLJoystickAgentSlide>("move right btn");
+ mSlideRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
- mTurnLeftButton = getChild<LLButton>("turn left btn");
- mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
- mTurnLeftButton->setHeldDownCallback(boost::bind(&LLFloaterMove::turnLeft, this));
- mTurnRightButton = getChild<LLButton>("turn right btn");
- mTurnRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
- mTurnRightButton->setHeldDownCallback(boost::bind(&LLFloaterMove::turnRight, this));
+ mTurnLeftButton = getChild<LLButton>("turn left btn");
+ mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+ mTurnLeftButton->setHeldDownCallback(boost::bind(&LLFloaterMove::turnLeft, this));
+ mTurnRightButton = getChild<LLButton>("turn right btn");
+ mTurnRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+ mTurnRightButton->setHeldDownCallback(boost::bind(&LLFloaterMove::turnRight, this));
- mMoveUpButton = getChild<LLButton>("move up btn");
- mMoveUpButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
- mMoveUpButton->setHeldDownCallback(boost::bind(&LLFloaterMove::moveUp, this));
+ mMoveUpButton = getChild<LLButton>("move up btn");
+ mMoveUpButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+ mMoveUpButton->setHeldDownCallback(boost::bind(&LLFloaterMove::moveUp, this));
- mMoveDownButton = getChild<LLButton>("move down btn");
- mMoveDownButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
- mMoveDownButton->setHeldDownCallback(boost::bind(&LLFloaterMove::moveDown, this));
+ mMoveDownButton = getChild<LLButton>("move down btn");
+ mMoveDownButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
+ mMoveDownButton->setHeldDownCallback(boost::bind(&LLFloaterMove::moveDown, this));
- mModeActionsPanel = getChild<LLPanel>("panel_modes");
+ mModeActionsPanel = getChild<LLPanel>("panel_modes");
- LLButton* btn;
- btn = getChild<LLButton>("mode_walk_btn");
- btn->setCommitCallback(boost::bind(&LLFloaterMove::onWalkButtonClick, this));
+ LLButton* btn;
+ btn = getChild<LLButton>("mode_walk_btn");
+ btn->setCommitCallback(boost::bind(&LLFloaterMove::onWalkButtonClick, this));
- btn = getChild<LLButton>("mode_run_btn");
- btn->setCommitCallback(boost::bind(&LLFloaterMove::onRunButtonClick, this));
+ btn = getChild<LLButton>("mode_run_btn");
+ btn->setCommitCallback(boost::bind(&LLFloaterMove::onRunButtonClick, this));
- btn = getChild<LLButton>("mode_fly_btn");
- btn->setCommitCallback(boost::bind(&LLFloaterMove::onFlyButtonClick, this));
+ btn = getChild<LLButton>("mode_fly_btn");
+ btn->setCommitCallback(boost::bind(&LLFloaterMove::onFlyButtonClick, this));
- initModeTooltips();
+ initModeTooltips();
- initModeButtonMap();
+ initModeButtonMap();
- initMovementMode();
+ initMovementMode();
- gAgent.addParcelChangedCallback(LLFloaterMove::sUpdateFlyingStatus);
+ gAgent.addParcelChangedCallback(LLFloaterMove::sUpdateFlyingStatus);
- return TRUE;
+ return TRUE;
}
// *NOTE: we assume that setVisible() is called on floater close.
// virtual
void LLFloaterMove::setVisible(BOOL visible)
{
- // Do nothing with Stand/Stop Flying panel in excessive calls of this method.
- if (getVisible() == visible)
- {
- LLFloater::setVisible(visible);
- return;
- }
-
- if (visible)
- {
- LLFirstUse::notMoving(false);
- // Attach the Stand/Stop Flying panel.
- LLPanelStandStopFlying* ssf_panel = LLPanelStandStopFlying::getInstance();
- ssf_panel->reparent(this);
- const LLRect& mode_actions_rect = mModeActionsPanel->getRect();
- ssf_panel->setOrigin(mode_actions_rect.mLeft, mode_actions_rect.mBottom);
- }
- else
- {
- // Detach the Stand/Stop Flying panel.
- LLPanelStandStopFlying::getInstance()->reparent(NULL);
- }
-
- LLFloater::setVisible(visible);
-}
-
-// static
+ // Do nothing with Stand/Stop Flying panel in excessive calls of this method.
+ if (getVisible() == visible)
+ {
+ LLFloater::setVisible(visible);
+ return;
+ }
+
+ if (visible)
+ {
+ LLFirstUse::notMoving(false);
+ // Attach the Stand/Stop Flying panel.
+ LLPanelStandStopFlying* ssf_panel = LLPanelStandStopFlying::getInstance();
+ ssf_panel->reparent(this);
+ const LLRect& mode_actions_rect = mModeActionsPanel->getRect();
+ ssf_panel->setOrigin(mode_actions_rect.mLeft, mode_actions_rect.mBottom);
+ }
+ else
+ {
+ // Detach the Stand/Stop Flying panel.
+ LLPanelStandStopFlying::getInstance()->reparent(NULL);
+ }
+
+ LLFloater::setVisible(visible);
+}
+
+// static
F32 LLFloaterMove::getYawRate( F32 time )
{
- if( time < NUDGE_TIME )
- {
- F32 rate = YAW_NUDGE_RATE + time * (1 - YAW_NUDGE_RATE)/ NUDGE_TIME;
- return rate;
- }
- else
- {
- return 1.f;
- }
+ if( time < NUDGE_TIME )
+ {
+ F32 rate = YAW_NUDGE_RATE + time * (1 - YAW_NUDGE_RATE)/ NUDGE_TIME;
+ return rate;
+ }
+ else
+ {
+ return 1.f;
+ }
}
-// static
+// static
void LLFloaterMove::setFlyingMode(BOOL fly)
{
- LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
- if (instance)
- {
- instance->setFlyingModeImpl(fly);
- LLVOAvatarSelf* avatar_object = gAgentAvatarp;
- bool is_sitting = avatar_object
- && (avatar_object->getRegion() != NULL)
- && (!avatar_object->isDead())
- && avatar_object->isSitting();
- instance->showModeButtons(!fly && !is_sitting);
- }
- if (fly)
- {
- LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING);
- }
- else
- {
- LLPanelStandStopFlying::clearStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING);
- }
+ LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
+ if (instance)
+ {
+ instance->setFlyingModeImpl(fly);
+ LLVOAvatarSelf* avatar_object = gAgentAvatarp;
+ bool is_sitting = avatar_object
+ && (avatar_object->getRegion() != NULL)
+ && (!avatar_object->isDead())
+ && avatar_object->isSitting();
+ instance->showModeButtons(!fly && !is_sitting);
+ }
+ if (fly)
+ {
+ LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING);
+ }
+ else
+ {
+ LLPanelStandStopFlying::clearStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING);
+ }
}
//static
void LLFloaterMove::setAlwaysRunMode(bool run)
{
- LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
- if (instance)
- {
- instance->setAlwaysRunModeImpl(run);
- }
+ LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
+ if (instance)
+ {
+ instance->setAlwaysRunModeImpl(run);
+ }
}
void LLFloaterMove::setFlyingModeImpl(BOOL fly)
{
- updateButtonsWithMovementMode(fly ? MM_FLY : (gAgent.getAlwaysRun() ? MM_RUN : MM_WALK));
+ updateButtonsWithMovementMode(fly ? MM_FLY : (gAgent.getAlwaysRun() ? MM_RUN : MM_WALK));
}
void LLFloaterMove::setAlwaysRunModeImpl(bool run)
{
- if (!gAgent.getFlying())
- {
- updateButtonsWithMovementMode(run ? MM_RUN : MM_WALK);
- }
+ if (!gAgent.getFlying())
+ {
+ updateButtonsWithMovementMode(run ? MM_RUN : MM_WALK);
+ }
}
//static
void LLFloaterMove::setSittingMode(BOOL bSitting)
{
- if (bSitting)
- {
- LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STAND);
- }
- else
- {
- LLPanelStandStopFlying::clearStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STAND);
+ if (bSitting)
+ {
+ LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STAND);
+ }
+ else
+ {
+ LLPanelStandStopFlying::clearStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STAND);
- // show "Stop Flying" button if needed. EXT-871
- if (gAgent.getFlying())
- {
- LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING);
- }
- }
- enableInstance();
+ // show "Stop Flying" button if needed. EXT-871
+ if (gAgent.getFlying())
+ {
+ LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING);
+ }
+ }
+ enableInstance();
}
-// protected
+// protected
void LLFloaterMove::turnLeft()
{
- F32 time = mTurnLeftButton->getHeldDownTime();
- gAgent.moveYaw( getYawRate( time ) );
+ F32 time = mTurnLeftButton->getHeldDownTime();
+ gAgent.moveYaw( getYawRate( time ) );
}
// protected
void LLFloaterMove::turnRight()
{
- F32 time = mTurnRightButton->getHeldDownTime();
- gAgent.moveYaw( -getYawRate( time ) );
+ F32 time = mTurnRightButton->getHeldDownTime();
+ gAgent.moveYaw( -getYawRate( time ) );
}
// protected
void LLFloaterMove::moveUp()
{
- // Jumps or flys up, depending on fly state
- gAgent.moveUp(1);
+ // Jumps or flys up, depending on fly state
+ gAgent.moveUp(1);
}
// protected
void LLFloaterMove::moveDown()
{
- // Crouches or flys down, depending on fly state
- gAgent.moveUp(-1);
+ // Crouches or flys down, depending on fly state
+ gAgent.moveUp(-1);
}
//////////////////////////////////////////////////////////////////////////
@@ -289,220 +289,220 @@ void LLFloaterMove::moveDown()
void LLFloaterMove::onWalkButtonClick()
{
- setMovementMode(MM_WALK);
+ setMovementMode(MM_WALK);
}
void LLFloaterMove::onRunButtonClick()
{
- setMovementMode(MM_RUN);
+ setMovementMode(MM_RUN);
}
void LLFloaterMove::onFlyButtonClick()
{
- setMovementMode(MM_FLY);
+ setMovementMode(MM_FLY);
}
void LLFloaterMove::setMovementMode(const EMovementMode mode)
{
- mCurrentMode = mode;
-
- if(MM_FLY == mode)
- {
- LLAgent::toggleFlying();
- }
- else
- {
- gAgent.setFlying(FALSE);
- }
-
- // attempts to set avatar flying can not set it real flying in some cases.
- // For ex. when avatar fell down & is standing up.
- // So, no need to continue processing FLY mode. See EXT-1079
- if (MM_FLY == mode && !gAgent.getFlying())
- {
- return;
- }
-
- switch (mode)
- {
- case MM_RUN:
- gAgent.setAlwaysRun();
- gAgent.setRunning();
- break;
- case MM_WALK:
- gAgent.clearAlwaysRun();
- gAgent.clearRunning();
- break;
- default:
- //do nothing for other modes (MM_FLY)
- break;
- }
- // tell the simulator.
- gAgent.sendWalkRun(gAgent.getAlwaysRun());
-
- updateButtonsWithMovementMode(mode);
-
- bool bHideModeButtons = MM_FLY == mode
- || (isAgentAvatarValid() && gAgentAvatarp->isSitting());
-
- showModeButtons(!bHideModeButtons);
+ mCurrentMode = mode;
+
+ if(MM_FLY == mode)
+ {
+ LLAgent::toggleFlying();
+ }
+ else
+ {
+ gAgent.setFlying(FALSE);
+ }
+
+ // attempts to set avatar flying can not set it real flying in some cases.
+ // For ex. when avatar fell down & is standing up.
+ // So, no need to continue processing FLY mode. See EXT-1079
+ if (MM_FLY == mode && !gAgent.getFlying())
+ {
+ return;
+ }
+
+ switch (mode)
+ {
+ case MM_RUN:
+ gAgent.setAlwaysRun();
+ gAgent.setRunning();
+ break;
+ case MM_WALK:
+ gAgent.clearAlwaysRun();
+ gAgent.clearRunning();
+ break;
+ default:
+ //do nothing for other modes (MM_FLY)
+ break;
+ }
+ // tell the simulator.
+ gAgent.sendWalkRun(gAgent.getAlwaysRun());
+
+ updateButtonsWithMovementMode(mode);
+
+ bool bHideModeButtons = MM_FLY == mode
+ || (isAgentAvatarValid() && gAgentAvatarp->isSitting());
+
+ showModeButtons(!bHideModeButtons);
}
void LLFloaterMove::updateButtonsWithMovementMode(const EMovementMode newMode)
{
- setModeTooltip(newMode);
- setModeButtonToggleState(newMode);
- setModeTitle(newMode);
+ setModeTooltip(newMode);
+ setModeButtonToggleState(newMode);
+ setModeTitle(newMode);
}
void LLFloaterMove::initModeTooltips()
{
- control_tooltip_map_t walkTipMap;
- walkTipMap.insert(std::make_pair(mForwardButton, getString("walk_forward_tooltip")));
- walkTipMap.insert(std::make_pair(mBackwardButton, getString("walk_back_tooltip")));
- walkTipMap.insert(std::make_pair(mSlideLeftButton, getString("walk_left_tooltip")));
- walkTipMap.insert(std::make_pair(mSlideRightButton, getString("walk_right_tooltip")));
- walkTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip")));
- walkTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip")));
- mModeControlTooltipsMap[MM_WALK] = walkTipMap;
-
- control_tooltip_map_t runTipMap;
- runTipMap.insert(std::make_pair(mForwardButton, getString("run_forward_tooltip")));
- runTipMap.insert(std::make_pair(mBackwardButton, getString("run_back_tooltip")));
- runTipMap.insert(std::make_pair(mSlideLeftButton, getString("run_left_tooltip")));
- runTipMap.insert(std::make_pair(mSlideRightButton, getString("run_right_tooltip")));
- runTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip")));
- runTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip")));
- mModeControlTooltipsMap[MM_RUN] = runTipMap;
-
- control_tooltip_map_t flyTipMap;
- flyTipMap.insert(std::make_pair(mForwardButton, getString("fly_forward_tooltip")));
- flyTipMap.insert(std::make_pair(mBackwardButton, getString("fly_back_tooltip")));
- flyTipMap.insert(std::make_pair(mSlideLeftButton, getString("fly_left_tooltip")));
- flyTipMap.insert(std::make_pair(mSlideRightButton, getString("fly_right_tooltip")));
- flyTipMap.insert(std::make_pair(mMoveUpButton, getString("fly_up_tooltip")));
- flyTipMap.insert(std::make_pair(mMoveDownButton, getString("fly_down_tooltip")));
- mModeControlTooltipsMap[MM_FLY] = flyTipMap;
-
- setModeTooltip(MM_WALK);
+ control_tooltip_map_t walkTipMap;
+ walkTipMap.insert(std::make_pair(mForwardButton, getString("walk_forward_tooltip")));
+ walkTipMap.insert(std::make_pair(mBackwardButton, getString("walk_back_tooltip")));
+ walkTipMap.insert(std::make_pair(mSlideLeftButton, getString("walk_left_tooltip")));
+ walkTipMap.insert(std::make_pair(mSlideRightButton, getString("walk_right_tooltip")));
+ walkTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip")));
+ walkTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip")));
+ mModeControlTooltipsMap[MM_WALK] = walkTipMap;
+
+ control_tooltip_map_t runTipMap;
+ runTipMap.insert(std::make_pair(mForwardButton, getString("run_forward_tooltip")));
+ runTipMap.insert(std::make_pair(mBackwardButton, getString("run_back_tooltip")));
+ runTipMap.insert(std::make_pair(mSlideLeftButton, getString("run_left_tooltip")));
+ runTipMap.insert(std::make_pair(mSlideRightButton, getString("run_right_tooltip")));
+ runTipMap.insert(std::make_pair(mMoveUpButton, getString("jump_tooltip")));
+ runTipMap.insert(std::make_pair(mMoveDownButton, getString("crouch_tooltip")));
+ mModeControlTooltipsMap[MM_RUN] = runTipMap;
+
+ control_tooltip_map_t flyTipMap;
+ flyTipMap.insert(std::make_pair(mForwardButton, getString("fly_forward_tooltip")));
+ flyTipMap.insert(std::make_pair(mBackwardButton, getString("fly_back_tooltip")));
+ flyTipMap.insert(std::make_pair(mSlideLeftButton, getString("fly_left_tooltip")));
+ flyTipMap.insert(std::make_pair(mSlideRightButton, getString("fly_right_tooltip")));
+ flyTipMap.insert(std::make_pair(mMoveUpButton, getString("fly_up_tooltip")));
+ flyTipMap.insert(std::make_pair(mMoveDownButton, getString("fly_down_tooltip")));
+ mModeControlTooltipsMap[MM_FLY] = flyTipMap;
+
+ setModeTooltip(MM_WALK);
}
void LLFloaterMove::initModeButtonMap()
{
- mModeControlButtonMap[MM_WALK] = getChild<LLButton>("mode_walk_btn");
- mModeControlButtonMap[MM_RUN] = getChild<LLButton>("mode_run_btn");
- mModeControlButtonMap[MM_FLY] = getChild<LLButton>("mode_fly_btn");
+ mModeControlButtonMap[MM_WALK] = getChild<LLButton>("mode_walk_btn");
+ mModeControlButtonMap[MM_RUN] = getChild<LLButton>("mode_run_btn");
+ mModeControlButtonMap[MM_FLY] = getChild<LLButton>("mode_fly_btn");
}
void LLFloaterMove::initMovementMode()
{
- EMovementMode initMovementMode = gAgent.getAlwaysRun() ? MM_RUN : MM_WALK;
- if (gAgent.getFlying())
- {
- initMovementMode = MM_FLY;
- }
-
- mCurrentMode = initMovementMode;
- bool hide_mode_buttons = (MM_FLY == mCurrentMode) || (isAgentAvatarValid() && gAgentAvatarp->isSitting());
+ EMovementMode initMovementMode = gAgent.getAlwaysRun() ? MM_RUN : MM_WALK;
+ if (gAgent.getFlying())
+ {
+ initMovementMode = MM_FLY;
+ }
+
+ mCurrentMode = initMovementMode;
+ bool hide_mode_buttons = (MM_FLY == mCurrentMode) || (isAgentAvatarValid() && gAgentAvatarp->isSitting());
- updateButtonsWithMovementMode(mCurrentMode);
- showModeButtons(!hide_mode_buttons);
+ updateButtonsWithMovementMode(mCurrentMode);
+ showModeButtons(!hide_mode_buttons);
}
void LLFloaterMove::setModeTooltip(const EMovementMode mode)
{
- llassert_always(mModeControlTooltipsMap.end() != mModeControlTooltipsMap.find(mode));
- control_tooltip_map_t controlsTipMap = mModeControlTooltipsMap[mode];
- control_tooltip_map_t::const_iterator it = controlsTipMap.begin();
- for (; it != controlsTipMap.end(); ++it)
- {
- LLView* ctrl = it->first;
- std::string tooltip = it->second;
- ctrl->setToolTip(tooltip);
- }
+ llassert_always(mModeControlTooltipsMap.end() != mModeControlTooltipsMap.find(mode));
+ control_tooltip_map_t controlsTipMap = mModeControlTooltipsMap[mode];
+ control_tooltip_map_t::const_iterator it = controlsTipMap.begin();
+ for (; it != controlsTipMap.end(); ++it)
+ {
+ LLView* ctrl = it->first;
+ std::string tooltip = it->second;
+ ctrl->setToolTip(tooltip);
+ }
}
void LLFloaterMove::setModeTitle(const EMovementMode mode)
{
- std::string title;
- switch(mode)
- {
- case MM_WALK:
- title = getString("walk_title");
- break;
- case MM_RUN:
- title = getString("run_title");
- break;
- case MM_FLY:
- title = getString("fly_title");
- break;
- default:
- // title should be provided for all modes
- llassert(false);
- break;
- }
- setTitle(title);
+ std::string title;
+ switch(mode)
+ {
+ case MM_WALK:
+ title = getString("walk_title");
+ break;
+ case MM_RUN:
+ title = getString("run_title");
+ break;
+ case MM_FLY:
+ title = getString("fly_title");
+ break;
+ default:
+ // title should be provided for all modes
+ llassert(false);
+ break;
+ }
+ setTitle(title);
}
//static
void LLFloaterMove::sUpdateFlyingStatus()
{
- LLFloaterMove *floater = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
- if (floater) floater->mModeControlButtonMap[MM_FLY]->setEnabled(gAgent.canFly());
-
+ LLFloaterMove *floater = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
+ if (floater) floater->mModeControlButtonMap[MM_FLY]->setEnabled(gAgent.canFly());
+
}
void LLFloaterMove::showModeButtons(BOOL bShow)
{
- if (mModeActionsPanel->getVisible() == bShow)
- return;
- mModeActionsPanel->setVisible(bShow);
+ if (mModeActionsPanel->getVisible() == bShow)
+ return;
+ mModeActionsPanel->setVisible(bShow);
}
//static
void LLFloaterMove::enableInstance()
{
- LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
- if (instance)
- {
- if (gAgent.getFlying())
- {
- instance->showModeButtons(FALSE);
- }
- else
- {
+ LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
+ if (instance)
+ {
+ if (gAgent.getFlying())
+ {
+ instance->showModeButtons(FALSE);
+ }
+ else
+ {
instance->showModeButtons(isAgentAvatarValid() && !gAgentAvatarp->isSitting());
- }
- }
+ }
+ }
}
void LLFloaterMove::onOpen(const LLSD& key)
{
- if (gAgent.getFlying())
- {
- setFlyingMode(TRUE);
- showModeButtons(FALSE);
- }
+ if (gAgent.getFlying())
+ {
+ setFlyingMode(TRUE);
+ showModeButtons(FALSE);
+ }
- if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
- {
- setSittingMode(TRUE);
- showModeButtons(FALSE);
- }
+ if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
+ {
+ setSittingMode(TRUE);
+ showModeButtons(FALSE);
+ }
- sUpdateFlyingStatus();
+ sUpdateFlyingStatus();
}
void LLFloaterMove::setModeButtonToggleState(const EMovementMode mode)
{
- llassert_always(mModeControlButtonMap.end() != mModeControlButtonMap.find(mode));
+ llassert_always(mModeControlButtonMap.end() != mModeControlButtonMap.find(mode));
- mode_control_button_map_t::const_iterator it = mModeControlButtonMap.begin();
- for (; it != mModeControlButtonMap.end(); ++it)
- {
- it->second->setToggleState(FALSE);
- }
+ mode_control_button_map_t::const_iterator it = mModeControlButtonMap.begin();
+ for (; it != mModeControlButtonMap.end(); ++it)
+ {
+ it->second->setToggleState(FALSE);
+ }
- mModeControlButtonMap[mode]->setToggleState(TRUE);
+ mModeControlButtonMap[mode]->setToggleState(TRUE);
}
@@ -511,154 +511,154 @@ void LLFloaterMove::setModeButtonToggleState(const EMovementMode mode)
/* LLPanelStandStopFlying */
/************************************************************************/
LLPanelStandStopFlying::LLPanelStandStopFlying() :
- mStandButton(NULL),
- mStopFlyingButton(NULL),
- mAttached(false)
+ mStandButton(NULL),
+ mStopFlyingButton(NULL),
+ mAttached(false)
{
- // make sure we have the only instance of this class
- static bool b = true;
- llassert_always(b);
- b=false;
+ // make sure we have the only instance of this class
+ static bool b = true;
+ llassert_always(b);
+ b=false;
}
// static
LLPanelStandStopFlying* LLPanelStandStopFlying::getInstance()
{
- static LLPanelStandStopFlying* panel = getStandStopFlyingPanel();
- return panel;
+ static LLPanelStandStopFlying* panel = getStandStopFlyingPanel();
+ return panel;
}
//static
void LLPanelStandStopFlying::setStandStopFlyingMode(EStandStopFlyingMode mode)
{
- LLPanelStandStopFlying* panel = getInstance();
+ LLPanelStandStopFlying* panel = getInstance();
- if (mode == SSFM_STAND)
- {
- LLFirstUse::sit();
- LLFirstUse::notMoving(false);
- }
- panel->mStandButton->setVisible(SSFM_STAND == mode);
- panel->mStopFlyingButton->setVisible(SSFM_STOP_FLYING == mode);
+ if (mode == SSFM_STAND)
+ {
+ LLFirstUse::sit();
+ LLFirstUse::notMoving(false);
+ }
+ panel->mStandButton->setVisible(SSFM_STAND == mode);
+ panel->mStopFlyingButton->setVisible(SSFM_STOP_FLYING == mode);
- //visibility of it should be updated after updating visibility of the buttons
- panel->setVisible(TRUE);
+ //visibility of it should be updated after updating visibility of the buttons
+ panel->setVisible(TRUE);
}
//static
void LLPanelStandStopFlying::clearStandStopFlyingMode(EStandStopFlyingMode mode)
{
- LLPanelStandStopFlying* panel = getInstance();
- switch(mode) {
- case SSFM_STAND:
- panel->mStandButton->setVisible(FALSE);
- break;
- case SSFM_STOP_FLYING:
- panel->mStopFlyingButton->setVisible(FALSE);
- break;
- default:
- LL_ERRS() << "Unexpected EStandStopFlyingMode is passed: " << mode << LL_ENDL;
- }
+ LLPanelStandStopFlying* panel = getInstance();
+ switch(mode) {
+ case SSFM_STAND:
+ panel->mStandButton->setVisible(FALSE);
+ break;
+ case SSFM_STOP_FLYING:
+ panel->mStopFlyingButton->setVisible(FALSE);
+ break;
+ default:
+ LL_ERRS() << "Unexpected EStandStopFlyingMode is passed: " << mode << LL_ENDL;
+ }
}
BOOL LLPanelStandStopFlying::postBuild()
{
- mStandButton = getChild<LLButton>("stand_btn");
- mStandButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStandButtonClick, this));
- mStandButton->setCommitCallback(boost::bind(&LLFloaterMove::enableInstance));
- mStandButton->setVisible(FALSE);
- LLHints::getInstance()->registerHintTarget("stand_btn", mStandButton->getHandle());
-
- mStopFlyingButton = getChild<LLButton>("stop_fly_btn");
- //mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE));
- mStopFlyingButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStopFlyingButtonClick, this));
- mStopFlyingButton->setVisible(FALSE);
+ mStandButton = getChild<LLButton>("stand_btn");
+ mStandButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStandButtonClick, this));
+ mStandButton->setCommitCallback(boost::bind(&LLFloaterMove::enableInstance));
+ mStandButton->setVisible(FALSE);
+ LLHints::getInstance()->registerHintTarget("stand_btn", mStandButton->getHandle());
+
+ mStopFlyingButton = getChild<LLButton>("stop_fly_btn");
+ //mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE));
+ mStopFlyingButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStopFlyingButtonClick, this));
+ mStopFlyingButton->setVisible(FALSE);
+
+ gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLPanelStandStopFlying::updatePosition, this));
- gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLPanelStandStopFlying::updatePosition, this));
-
- return TRUE;
+ return TRUE;
}
//virtual
void LLPanelStandStopFlying::setVisible(BOOL visible)
{
- //we dont need to show the panel if these buttons are not activated
- if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false;
+ //we dont need to show the panel if these buttons are not activated
+ if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false;
- if (visible)
- {
- updatePosition();
- }
+ if (visible)
+ {
+ updatePosition();
+ }
- // do not change parent visibility in case panel is attached into Move Floater: EXT-3632, EXT-4646
- if (!mAttached)
- {
- //change visibility of parent layout_panel to animate in/out. EXT-2504
- if (getParent()) getParent()->setVisible(visible);
- }
+ // do not change parent visibility in case panel is attached into Move Floater: EXT-3632, EXT-4646
+ if (!mAttached)
+ {
+ //change visibility of parent layout_panel to animate in/out. EXT-2504
+ if (getParent()) getParent()->setVisible(visible);
+ }
- // also change own visibility to avoid displaying the panel in mouselook (broken when EXT-2504 was implemented).
- // See EXT-4718.
- LLPanel::setVisible(visible);
+ // also change own visibility to avoid displaying the panel in mouselook (broken when EXT-2504 was implemented).
+ // See EXT-4718.
+ LLPanel::setVisible(visible);
}
BOOL LLPanelStandStopFlying::handleToolTip(S32 x, S32 y, MASK mask)
{
- LLToolTipMgr::instance().unblockToolTips();
+ LLToolTipMgr::instance().unblockToolTips();
- if (mStandButton->getVisible())
- {
- LLToolTipMgr::instance().show(mStandButton->getToolTip());
- }
- else if (mStopFlyingButton->getVisible())
- {
- LLToolTipMgr::instance().show(mStopFlyingButton->getToolTip());
- }
+ if (mStandButton->getVisible())
+ {
+ LLToolTipMgr::instance().show(mStandButton->getToolTip());
+ }
+ else if (mStopFlyingButton->getVisible())
+ {
+ LLToolTipMgr::instance().show(mStopFlyingButton->getToolTip());
+ }
- return LLPanel::handleToolTip(x, y, mask);
+ return LLPanel::handleToolTip(x, y, mask);
}
void LLPanelStandStopFlying::reparent(LLFloaterMove* move_view)
{
- LLPanel* parent = dynamic_cast<LLPanel*>(getParent());
- if (!parent)
- {
- LL_WARNS() << "Stand/stop flying panel parent is unset, already attached?: " << mAttached << ", new parent: " << (move_view == NULL ? "NULL" : "Move Floater") << LL_ENDL;
- return;
- }
-
- if (move_view != NULL)
- {
- llassert(move_view != parent); // sanity check
-
- // Save our original container.
- if (!mOriginalParent.get())
- mOriginalParent = parent->getHandle();
-
- // Attach to movement controls.
- parent->removeChild(this);
- move_view->addChild(this);
- // Origin must be set by movement controls.
- mAttached = true;
- }
- else
- {
- if (!mOriginalParent.get())
- {
- LL_WARNS() << "Original parent of the stand / stop flying panel not found" << LL_ENDL;
- return;
- }
-
- // Detach from movement controls.
- parent->removeChild(this);
- mOriginalParent.get()->addChild(this);
- // update parent with self visibility (it is changed in setVisible()). EXT-4743
- mOriginalParent.get()->setVisible(getVisible());
-
- mAttached = false;
- updatePosition(); // don't defer until next draw() to avoid flicker
- }
+ LLPanel* parent = dynamic_cast<LLPanel*>(getParent());
+ if (!parent)
+ {
+ LL_WARNS() << "Stand/stop flying panel parent is unset, already attached?: " << mAttached << ", new parent: " << (move_view == NULL ? "NULL" : "Move Floater") << LL_ENDL;
+ return;
+ }
+
+ if (move_view != NULL)
+ {
+ llassert(move_view != parent); // sanity check
+
+ // Save our original container.
+ if (!mOriginalParent.get())
+ mOriginalParent = parent->getHandle();
+
+ // Attach to movement controls.
+ parent->removeChild(this);
+ move_view->addChild(this);
+ // Origin must be set by movement controls.
+ mAttached = true;
+ }
+ else
+ {
+ if (!mOriginalParent.get())
+ {
+ LL_WARNS() << "Original parent of the stand / stop flying panel not found" << LL_ENDL;
+ return;
+ }
+
+ // Detach from movement controls.
+ parent->removeChild(this);
+ mOriginalParent.get()->addChild(this);
+ // update parent with self visibility (it is changed in setVisible()). EXT-4743
+ mOriginalParent.get()->setVisible(getVisible());
+
+ mAttached = false;
+ updatePosition(); // don't defer until next draw() to avoid flicker
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -668,33 +668,33 @@ void LLPanelStandStopFlying::reparent(LLFloaterMove* move_view)
//static
LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel()
{
- LLPanelStandStopFlying* panel = new LLPanelStandStopFlying();
- panel->buildFromFile("panel_stand_stop_flying.xml");
+ LLPanelStandStopFlying* panel = new LLPanelStandStopFlying();
+ panel->buildFromFile("panel_stand_stop_flying.xml");
- panel->setVisible(FALSE);
- //LLUI::getInstance()->getRootView()->addChild(panel);
+ panel->setVisible(FALSE);
+ //LLUI::getInstance()->getRootView()->addChild(panel);
- LL_INFOS() << "Build LLPanelStandStopFlying panel" << LL_ENDL;
+ LL_INFOS() << "Build LLPanelStandStopFlying panel" << LL_ENDL;
- panel->updatePosition();
- return panel;
+ panel->updatePosition();
+ return panel;
}
void LLPanelStandStopFlying::onStandButtonClick()
{
- LLFirstUse::sit(false);
+ LLFirstUse::sit(false);
- LLSelectMgr::getInstance()->deselectAllForStandingUp();
- gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
+ LLSelectMgr::getInstance()->deselectAllForStandingUp();
+ gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
- setFocus(FALSE);
+ setFocus(FALSE);
}
void LLPanelStandStopFlying::onStopFlyingButtonClick()
{
- gAgent.setFlying(FALSE);
+ gAgent.setFlying(FALSE);
- setFocus(FALSE); // EXT-482
+ setFocus(FALSE); // EXT-482
}
/**
@@ -702,30 +702,30 @@ void LLPanelStandStopFlying::onStopFlyingButtonClick()
*/
void LLPanelStandStopFlying::updatePosition()
{
- if (mAttached) return;
-
- S32 bottom_tb_center = 0;
- if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_BOTTOM))
- {
- bottom_tb_center = toolbar_bottom->getRect().getCenterX();
- }
-
- S32 left_tb_width = 0;
- if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT))
- {
- left_tb_width = toolbar_left->getRect().getWidth();
- }
-
- if (gToolBarView != NULL && gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT)->hasButtons())
- {
- S32 x_pos = bottom_tb_center - getRect().getWidth() / 2 - left_tb_width;
- setOrigin( x_pos, 0);
- }
- else
- {
- S32 x_pos = bottom_tb_center - getRect().getWidth() / 2;
- setOrigin( x_pos, 0);
- }
+ if (mAttached) return;
+
+ S32 bottom_tb_center = 0;
+ if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_BOTTOM))
+ {
+ bottom_tb_center = toolbar_bottom->getRect().getCenterX();
+ }
+
+ S32 left_tb_width = 0;
+ if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT))
+ {
+ left_tb_width = toolbar_left->getRect().getWidth();
+ }
+
+ if (gToolBarView != NULL && gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT)->hasButtons())
+ {
+ S32 x_pos = bottom_tb_center - getRect().getWidth() / 2 - left_tb_width;
+ setOrigin( x_pos, 0);
+ }
+ else
+ {
+ S32 x_pos = bottom_tb_center - getRect().getWidth() / 2;
+ setOrigin( x_pos, 0);
+ }
}
// EOF
diff --git a/indra/newview/llmoveview.h b/indra/newview/llmoveview.h
index e8b9a6fdb2..642e6a41be 100644
--- a/indra/newview/llmoveview.h
+++ b/indra/newview/llmoveview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmoveview.h
* @brief Container for buttons for walking, turning, flying
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,76 +38,76 @@ class LLJoystickAgentSlide;
// Classes
//
class LLFloaterMove
-: public LLFloater
+: public LLFloater
{
- LOG_CLASS(LLFloaterMove);
- friend class LLFloaterReg;
+ LOG_CLASS(LLFloaterMove);
+ friend class LLFloaterReg;
private:
- LLFloaterMove(const LLSD& key);
- ~LLFloaterMove();
+ LLFloaterMove(const LLSD& key);
+ ~LLFloaterMove();
public:
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void setVisible(BOOL visible);
- static F32 getYawRate(F32 time);
- static void setFlyingMode(BOOL fly);
- void setFlyingModeImpl(BOOL fly);
- static void setAlwaysRunMode(bool run);
- void setAlwaysRunModeImpl(bool run);
- static void setSittingMode(BOOL bSitting);
- static void enableInstance();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void setVisible(BOOL visible);
+ static F32 getYawRate(F32 time);
+ static void setFlyingMode(BOOL fly);
+ void setFlyingModeImpl(BOOL fly);
+ static void setAlwaysRunMode(bool run);
+ void setAlwaysRunModeImpl(bool run);
+ static void setSittingMode(BOOL bSitting);
+ static void enableInstance();
+ /*virtual*/ void onOpen(const LLSD& key);
- static void sUpdateFlyingStatus();
+ static void sUpdateFlyingStatus();
protected:
- void turnLeft();
- void turnRight();
+ void turnLeft();
+ void turnRight();
- void moveUp();
- void moveDown();
+ void moveUp();
+ void moveDown();
private:
- typedef enum movement_mode_t
- {
- MM_WALK,
- MM_RUN,
- MM_FLY
- } EMovementMode;
- void onWalkButtonClick();
- void onRunButtonClick();
- void onFlyButtonClick();
- void initMovementMode();
- void setMovementMode(const EMovementMode mode);
- void initModeTooltips();
- void setModeTooltip(const EMovementMode mode);
- void setModeTitle(const EMovementMode mode);
- void initModeButtonMap();
- void setModeButtonToggleState(const EMovementMode mode);
- void updateButtonsWithMovementMode(const EMovementMode newMode);
- void showModeButtons(BOOL bShow);
+ typedef enum movement_mode_t
+ {
+ MM_WALK,
+ MM_RUN,
+ MM_FLY
+ } EMovementMode;
+ void onWalkButtonClick();
+ void onRunButtonClick();
+ void onFlyButtonClick();
+ void initMovementMode();
+ void setMovementMode(const EMovementMode mode);
+ void initModeTooltips();
+ void setModeTooltip(const EMovementMode mode);
+ void setModeTitle(const EMovementMode mode);
+ void initModeButtonMap();
+ void setModeButtonToggleState(const EMovementMode mode);
+ void updateButtonsWithMovementMode(const EMovementMode newMode);
+ void showModeButtons(BOOL bShow);
public:
- LLJoystickAgentTurn* mForwardButton;
- LLJoystickAgentTurn* mBackwardButton;
- LLJoystickAgentSlide* mSlideLeftButton;
- LLJoystickAgentSlide* mSlideRightButton;
- LLButton* mTurnLeftButton;
- LLButton* mTurnRightButton;
- LLButton* mMoveUpButton;
- LLButton* mMoveDownButton;
+ LLJoystickAgentTurn* mForwardButton;
+ LLJoystickAgentTurn* mBackwardButton;
+ LLJoystickAgentSlide* mSlideLeftButton;
+ LLJoystickAgentSlide* mSlideRightButton;
+ LLButton* mTurnLeftButton;
+ LLButton* mTurnRightButton;
+ LLButton* mMoveUpButton;
+ LLButton* mMoveDownButton;
private:
- LLPanel* mModeActionsPanel;
-
- typedef std::map<LLView*, std::string> control_tooltip_map_t;
- typedef std::map<EMovementMode, control_tooltip_map_t> mode_control_tooltip_map_t;
- mode_control_tooltip_map_t mModeControlTooltipsMap;
+ LLPanel* mModeActionsPanel;
+
+ typedef std::map<LLView*, std::string> control_tooltip_map_t;
+ typedef std::map<EMovementMode, control_tooltip_map_t> mode_control_tooltip_map_t;
+ mode_control_tooltip_map_t mModeControlTooltipsMap;
- typedef std::map<EMovementMode, LLButton*> mode_control_button_map_t;
- mode_control_button_map_t mModeControlButtonMap;
- EMovementMode mCurrentMode;
+ typedef std::map<EMovementMode, LLButton*> mode_control_button_map_t;
+ mode_control_button_map_t mModeControlButtonMap;
+ EMovementMode mCurrentMode;
};
@@ -117,68 +117,68 @@ private:
*/
class LLPanelStandStopFlying : public LLPanel
{
- LOG_CLASS(LLPanelStandStopFlying);
+ LOG_CLASS(LLPanelStandStopFlying);
public:
- typedef enum stand_stop_flying_mode_t
- {
- SSFM_STAND,
- SSFM_STOP_FLYING
- } EStandStopFlyingMode;
-
- /**
- * Attach or detach the panel to/from the movement controls floater.
- *
- * Called when the floater gets opened/closed, user sits, stands up or starts/stops flying.
- *
- * @param move_view The floater to attach to (not always accessible via floater registry).
- * If NULL is passed, the panel gets reparented to its original container.
- *
- * @see mAttached
- * @see mOriginalParent
- */
- void reparent(LLFloaterMove* move_view);
-
- static LLPanelStandStopFlying* getInstance();
- static void setStandStopFlyingMode(EStandStopFlyingMode mode);
- static void clearStandStopFlyingMode(EStandStopFlyingMode mode);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void setVisible(BOOL visible);
-
- // *HACK: due to hard enough to have this control aligned with "Move" button while resizing
- // let update its position in each frame
- /*virtual*/ void draw(){updatePosition(); LLPanel::draw();}
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ typedef enum stand_stop_flying_mode_t
+ {
+ SSFM_STAND,
+ SSFM_STOP_FLYING
+ } EStandStopFlyingMode;
+
+ /**
+ * Attach or detach the panel to/from the movement controls floater.
+ *
+ * Called when the floater gets opened/closed, user sits, stands up or starts/stops flying.
+ *
+ * @param move_view The floater to attach to (not always accessible via floater registry).
+ * If NULL is passed, the panel gets reparented to its original container.
+ *
+ * @see mAttached
+ * @see mOriginalParent
+ */
+ void reparent(LLFloaterMove* move_view);
+
+ static LLPanelStandStopFlying* getInstance();
+ static void setStandStopFlyingMode(EStandStopFlyingMode mode);
+ static void clearStandStopFlyingMode(EStandStopFlyingMode mode);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void setVisible(BOOL visible);
+
+ // *HACK: due to hard enough to have this control aligned with "Move" button while resizing
+ // let update its position in each frame
+ /*virtual*/ void draw(){updatePosition(); LLPanel::draw();}
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
protected:
- LLPanelStandStopFlying();
+ LLPanelStandStopFlying();
private:
- static LLPanelStandStopFlying* getStandStopFlyingPanel();
- void onStandButtonClick();
- void onStopFlyingButtonClick();
- void updatePosition();
-
- LLButton* mStandButton;
- LLButton* mStopFlyingButton;
-
- /**
- * The original parent of the panel.
- *
- * Makes it possible to move (reparent) the panel to the movement controls floater and back.
- *
- * @see reparent()
- */
- LLHandle<LLPanel> mOriginalParent;
-
- /**
- * True if the panel is currently attached to the movement controls floater.
- *
- * @see reparent()
- * @see updatePosition()
- */
- bool mAttached;
+ static LLPanelStandStopFlying* getStandStopFlyingPanel();
+ void onStandButtonClick();
+ void onStopFlyingButtonClick();
+ void updatePosition();
+
+ LLButton* mStandButton;
+ LLButton* mStopFlyingButton;
+
+ /**
+ * The original parent of the panel.
+ *
+ * Makes it possible to move (reparent) the panel to the movement controls floater and back.
+ *
+ * @see reparent()
+ */
+ LLHandle<LLPanel> mOriginalParent;
+
+ /**
+ * True if the panel is currently attached to the movement controls floater.
+ *
+ * @see reparent()
+ * @see updatePosition()
+ */
+ bool mAttached;
};
diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp
index a7a7ed1b70..6c0ba06032 100644
--- a/indra/newview/llmutelist.cpp
+++ b/indra/newview/llmutelist.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llmutelist.cpp
* @author Richard Nelson, James Cook
* @brief Management of list of muted players
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,7 +55,7 @@
#include "llagent.h"
#include "llavatarnamecache.h"
-#include "llviewergenericmessage.h" // for gGenericDispatcher
+#include "llviewergenericmessage.h" // for gGenericDispatcher
#include "llworld.h" //for particle system banning
#include "llimview.h"
#include "llnotifications.h"
@@ -63,38 +63,38 @@
#include "llviewerobjectlist.h"
#include "lltrans.h"
-namespace
-{
- // This method is used to return an object to mute given an object id.
- // Its used by the LLMute constructor and LLMuteList::isMuted.
- LLViewerObject* get_object_to_mute_from_id(LLUUID object_id)
- {
- LLViewerObject *objectp = gObjectList.findObject(object_id);
- if ((objectp) && (!objectp->isAvatar()))
- {
- LLViewerObject *parentp = (LLViewerObject *)objectp->getParent();
- if (parentp && parentp->getID() != gAgent.getID())
- {
- objectp = parentp;
- }
- }
- return objectp;
- }
+namespace
+{
+ // This method is used to return an object to mute given an object id.
+ // Its used by the LLMute constructor and LLMuteList::isMuted.
+ LLViewerObject* get_object_to_mute_from_id(LLUUID object_id)
+ {
+ LLViewerObject *objectp = gObjectList.findObject(object_id);
+ if ((objectp) && (!objectp->isAvatar()))
+ {
+ LLViewerObject *parentp = (LLViewerObject *)objectp->getParent();
+ if (parentp && parentp->getID() != gAgent.getID())
+ {
+ objectp = parentp;
+ }
+ }
+ return objectp;
+ }
}
// "emptymutelist"
class LLDispatchEmptyMuteList : public LLDispatchHandler
{
public:
- virtual bool operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings)
- {
- LLMuteList::getInstance()->setLoaded();
- return true;
- }
+ virtual bool operator()(
+ const LLDispatcher* dispatcher,
+ const std::string& key,
+ const LLUUID& invoice,
+ const sparam_t& strings)
+ {
+ LLMuteList::getInstance()->setLoaded();
+ return true;
+ }
};
static LLDispatchEmptyMuteList sDispatchEmptyMuteList;
@@ -105,70 +105,70 @@ static LLDispatchEmptyMuteList sDispatchEmptyMuteList;
LLMute::LLMute(const LLUUID& id, const std::string& name, EType type, U32 flags)
: mID(id),
- mName(name),
- mType(type),
- mFlags(flags)
+ mName(name),
+ mType(type),
+ mFlags(flags)
{
- // muting is done by root objects only - try to find this objects root
- LLViewerObject* mute_object = get_object_to_mute_from_id(id);
- if(mute_object && mute_object->getID() != id)
- {
- mID = mute_object->getID();
- LLNameValue* firstname = mute_object->getNVPair("FirstName");
- LLNameValue* lastname = mute_object->getNVPair("LastName");
- if (firstname && lastname)
- {
- mName = LLCacheName::buildFullName(
- firstname->getString(), lastname->getString());
- }
- mType = mute_object->isAvatar() ? AGENT : OBJECT;
- }
+ // muting is done by root objects only - try to find this objects root
+ LLViewerObject* mute_object = get_object_to_mute_from_id(id);
+ if(mute_object && mute_object->getID() != id)
+ {
+ mID = mute_object->getID();
+ LLNameValue* firstname = mute_object->getNVPair("FirstName");
+ LLNameValue* lastname = mute_object->getNVPair("LastName");
+ if (firstname && lastname)
+ {
+ mName = LLCacheName::buildFullName(
+ firstname->getString(), lastname->getString());
+ }
+ mType = mute_object->isAvatar() ? AGENT : OBJECT;
+ }
}
std::string LLMute::getDisplayType() const
{
- switch (mType)
- {
- case BY_NAME:
- default:
- return LLTrans::getString("MuteByName");
- break;
- case AGENT:
- return LLTrans::getString("MuteAgent");
- break;
- case OBJECT:
- return LLTrans::getString("MuteObject");
- break;
- case GROUP:
- return LLTrans::getString("MuteGroup");
- break;
- case EXTERNAL:
- return LLTrans::getString("MuteExternal");
- break;
- }
+ switch (mType)
+ {
+ case BY_NAME:
+ default:
+ return LLTrans::getString("MuteByName");
+ break;
+ case AGENT:
+ return LLTrans::getString("MuteAgent");
+ break;
+ case OBJECT:
+ return LLTrans::getString("MuteObject");
+ break;
+ case GROUP:
+ return LLTrans::getString("MuteGroup");
+ break;
+ case EXTERNAL:
+ return LLTrans::getString("MuteExternal");
+ break;
+ }
}
//-----------------------------------------------------------------------------
// LLMuteList()
//-----------------------------------------------------------------------------
LLMuteList::LLMuteList() :
- mIsLoaded(FALSE)
-{
- gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList);
-
- // Register our callbacks. We may be constructed before gMessageSystem, so
- // use callWhenReady() to register them as soon as gMessageSystem becomes
- // available.
- // When using bind(), must be explicit about default arguments such as
- // that last NULL.
- gMessageSystem.callWhenReady(boost::bind(&LLMessageSystem::setHandlerFuncFast, _1,
- _PREHASH_MuteListUpdate, processMuteListUpdate,
- static_cast<void**>(NULL)));
- gMessageSystem.callWhenReady(boost::bind(&LLMessageSystem::setHandlerFuncFast, _1,
- _PREHASH_UseCachedMuteList, processUseCachedMuteList,
- static_cast<void**>(NULL)));
+ mIsLoaded(FALSE)
+{
+ gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList);
+
+ // Register our callbacks. We may be constructed before gMessageSystem, so
+ // use callWhenReady() to register them as soon as gMessageSystem becomes
+ // available.
+ // When using bind(), must be explicit about default arguments such as
+ // that last NULL.
+ gMessageSystem.callWhenReady(boost::bind(&LLMessageSystem::setHandlerFuncFast, _1,
+ _PREHASH_MuteListUpdate, processMuteListUpdate,
+ static_cast<void**>(NULL)));
+ gMessageSystem.callWhenReady(boost::bind(&LLMessageSystem::setHandlerFuncFast, _1,
+ _PREHASH_UseCachedMuteList, processUseCachedMuteList,
+ static_cast<void**>(NULL)));
// make sure mute list's instance gets initialized before we start any name requests
LLAvatarNameCache::getInstance()->setAccountNameChangedCallback([this](const LLUUID& id, const LLAvatarName& av_name)
@@ -194,366 +194,366 @@ void LLMuteList::cleanupSingleton()
bool LLMuteList::isLinden(const std::string& name)
{
- std::string username = boost::replace_all_copy(name, ".", " ");
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep(" ");
- tokenizer tokens(username, sep);
- tokenizer::iterator token_iter = tokens.begin();
-
- if (token_iter == tokens.end()) return false;
- token_iter++;
- if (token_iter == tokens.end()) return false;
-
- std::string last_name = *token_iter;
- LLStringUtil::toLower(last_name);
- return last_name == "linden";
+ std::string username = boost::replace_all_copy(name, ".", " ");
+ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+ boost::char_separator<char> sep(" ");
+ tokenizer tokens(username, sep);
+ tokenizer::iterator token_iter = tokens.begin();
+
+ if (token_iter == tokens.end()) return false;
+ token_iter++;
+ if (token_iter == tokens.end()) return false;
+
+ std::string last_name = *token_iter;
+ LLStringUtil::toLower(last_name);
+ return last_name == "linden";
}
static LLVOAvatar* find_avatar(const LLUUID& id)
{
- LLViewerObject *obj = gObjectList.findObject(id);
- while (obj && obj->isAttachment())
- {
- obj = (LLViewerObject *)obj->getParent();
- }
+ LLViewerObject *obj = gObjectList.findObject(id);
+ while (obj && obj->isAttachment())
+ {
+ obj = (LLViewerObject *)obj->getParent();
+ }
- if (obj && obj->isAvatar())
- {
- return (LLVOAvatar*)obj;
- }
- else
- {
- return NULL;
- }
+ if (obj && obj->isAvatar())
+ {
+ return (LLVOAvatar*)obj;
+ }
+ else
+ {
+ return NULL;
+ }
}
BOOL LLMuteList::add(const LLMute& mute, U32 flags)
{
- // Can't mute text from Lindens
- if ((mute.mType == LLMute::AGENT)
- && isLinden(mute.mName) && (flags & LLMute::flagTextChat || flags == 0))
- {
+ // Can't mute text from Lindens
+ if ((mute.mType == LLMute::AGENT)
+ && isLinden(mute.mName) && (flags & LLMute::flagTextChat || flags == 0))
+ {
LL_WARNS() << "Trying to mute a Linden; ignored" << LL_ENDL;
- LLNotifications::instance().add("MuteLinden", LLSD(), LLSD());
- return FALSE;
- }
-
- // Can't mute self.
- if (mute.mType == LLMute::AGENT
- && mute.mID == gAgent.getID())
- {
+ LLNotifications::instance().add("MuteLinden", LLSD(), LLSD());
+ return FALSE;
+ }
+
+ // Can't mute self.
+ if (mute.mType == LLMute::AGENT
+ && mute.mID == gAgent.getID())
+ {
LL_WARNS() << "Trying to self; ignored" << LL_ENDL;
- return FALSE;
- }
-
- static LLCachedControl<S32> mute_list_limit(gSavedSettings, "MuteListLimit", 1000);
- if (getMutes().size() >= mute_list_limit)
- {
- LL_WARNS() << "Mute limit is reached; ignored" << LL_ENDL;
- LLSD args;
- args["MUTE_LIMIT"] = mute_list_limit;
- LLNotifications::instance().add(LLNotification::Params("MuteLimitReached").substitutions(args));
- return FALSE;
- }
-
- if (mute.mType == LLMute::BY_NAME)
- {
- // Can't mute empty string by name
- if (mute.mName.empty())
- {
- LL_WARNS() << "Trying to mute empty string by-name" << LL_ENDL;
- return FALSE;
- }
-
- // Null mutes must have uuid null
- if (mute.mID.notNull())
- {
- LL_WARNS() << "Trying to add by-name mute with non-null id" << LL_ENDL;
- return FALSE;
- }
-
- std::pair<string_set_t::iterator, bool> result = mLegacyMutes.insert(mute.mName);
- if (result.second)
- {
- LL_INFOS() << "Muting by name " << mute.mName << LL_ENDL;
- updateAdd(mute);
- notifyObservers();
- notifyObserversDetailed(mute);
- return TRUE;
- }
- else
- {
- LL_INFOS() << "duplicate mute ignored" << LL_ENDL;
- // was duplicate
- return FALSE;
- }
- }
- else
- {
- // Need a local (non-const) copy to set up flags properly.
- LLMute localmute = mute;
-
- // If an entry for the same entity is already in the list, remove it, saving flags as necessary.
- mute_set_t::iterator it = mMutes.find(localmute);
- if (it != mMutes.end())
- {
- // This mute is already in the list. Save the existing entry's flags if that's warranted.
- localmute.mFlags = it->mFlags;
-
- mMutes.erase(it);
- // Don't need to call notifyObservers() here, since it will happen after the entry has been re-added below.
- }
- else
- {
- // There was no entry in the list previously. Fake things up by making it look like the previous entry had all properties unmuted.
- localmute.mFlags = LLMute::flagAll;
- }
-
- if(flags)
- {
- // The user passed some combination of flags. Make sure those flag bits are turned off (i.e. those properties will be muted).
- localmute.mFlags &= (~flags);
- }
- else
- {
- // The user passed 0. Make sure all flag bits are turned off (i.e. all properties will be muted).
- localmute.mFlags = 0;
- }
-
- // (re)add the mute entry.
- {
- std::pair<mute_set_t::iterator, bool> result = mMutes.insert(localmute);
- if (result.second)
- {
- LL_INFOS() << "Muting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << LL_ENDL;
- updateAdd(localmute);
- notifyObservers();
- notifyObserversDetailed(localmute);
-
- //mute local lights that are attached to the avatar
- LLVOAvatar *avatarp = find_avatar(localmute.mID);
- if (avatarp)
- {
- LLPipeline::removeMutedAVsLights(avatarp);
- }
- //remove agent's notifications as well
- if (localmute.mType == LLMute::AGENT)
- {
- LLNotifications::instance().cancelByOwner(localmute.mID);
- }
- return TRUE;
- }
- }
- }
-
- // If we were going to return success, we'd have done it by now.
- return FALSE;
+ return FALSE;
+ }
+
+ static LLCachedControl<S32> mute_list_limit(gSavedSettings, "MuteListLimit", 1000);
+ if (getMutes().size() >= mute_list_limit)
+ {
+ LL_WARNS() << "Mute limit is reached; ignored" << LL_ENDL;
+ LLSD args;
+ args["MUTE_LIMIT"] = mute_list_limit;
+ LLNotifications::instance().add(LLNotification::Params("MuteLimitReached").substitutions(args));
+ return FALSE;
+ }
+
+ if (mute.mType == LLMute::BY_NAME)
+ {
+ // Can't mute empty string by name
+ if (mute.mName.empty())
+ {
+ LL_WARNS() << "Trying to mute empty string by-name" << LL_ENDL;
+ return FALSE;
+ }
+
+ // Null mutes must have uuid null
+ if (mute.mID.notNull())
+ {
+ LL_WARNS() << "Trying to add by-name mute with non-null id" << LL_ENDL;
+ return FALSE;
+ }
+
+ std::pair<string_set_t::iterator, bool> result = mLegacyMutes.insert(mute.mName);
+ if (result.second)
+ {
+ LL_INFOS() << "Muting by name " << mute.mName << LL_ENDL;
+ updateAdd(mute);
+ notifyObservers();
+ notifyObserversDetailed(mute);
+ return TRUE;
+ }
+ else
+ {
+ LL_INFOS() << "duplicate mute ignored" << LL_ENDL;
+ // was duplicate
+ return FALSE;
+ }
+ }
+ else
+ {
+ // Need a local (non-const) copy to set up flags properly.
+ LLMute localmute = mute;
+
+ // If an entry for the same entity is already in the list, remove it, saving flags as necessary.
+ mute_set_t::iterator it = mMutes.find(localmute);
+ if (it != mMutes.end())
+ {
+ // This mute is already in the list. Save the existing entry's flags if that's warranted.
+ localmute.mFlags = it->mFlags;
+
+ mMutes.erase(it);
+ // Don't need to call notifyObservers() here, since it will happen after the entry has been re-added below.
+ }
+ else
+ {
+ // There was no entry in the list previously. Fake things up by making it look like the previous entry had all properties unmuted.
+ localmute.mFlags = LLMute::flagAll;
+ }
+
+ if(flags)
+ {
+ // The user passed some combination of flags. Make sure those flag bits are turned off (i.e. those properties will be muted).
+ localmute.mFlags &= (~flags);
+ }
+ else
+ {
+ // The user passed 0. Make sure all flag bits are turned off (i.e. all properties will be muted).
+ localmute.mFlags = 0;
+ }
+
+ // (re)add the mute entry.
+ {
+ std::pair<mute_set_t::iterator, bool> result = mMutes.insert(localmute);
+ if (result.second)
+ {
+ LL_INFOS() << "Muting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << LL_ENDL;
+ updateAdd(localmute);
+ notifyObservers();
+ notifyObserversDetailed(localmute);
+
+ //mute local lights that are attached to the avatar
+ LLVOAvatar *avatarp = find_avatar(localmute.mID);
+ if (avatarp)
+ {
+ LLPipeline::removeMutedAVsLights(avatarp);
+ }
+ //remove agent's notifications as well
+ if (localmute.mType == LLMute::AGENT)
+ {
+ LLNotifications::instance().cancelByOwner(localmute.mID);
+ }
+ return TRUE;
+ }
+ }
+ }
+
+ // If we were going to return success, we'd have done it by now.
+ return FALSE;
}
void LLMuteList::updateAdd(const LLMute& mute)
{
- // External mutes are local only, don't send them to the server.
- if (mute.mType == LLMute::EXTERNAL)
- {
- return;
- }
-
- // Update the database
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_UpdateMuteListEntry);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MuteData);
- msg->addUUIDFast(_PREHASH_MuteID, mute.mID);
- msg->addStringFast(_PREHASH_MuteName, mute.mName);
- msg->addS32("MuteType", mute.mType);
- msg->addU32("MuteFlags", mute.mFlags);
- gAgent.sendReliableMessage();
+ // External mutes are local only, don't send them to the server.
+ if (mute.mType == LLMute::EXTERNAL)
+ {
+ return;
+ }
+
+ // Update the database
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_UpdateMuteListEntry);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_MuteData);
+ msg->addUUIDFast(_PREHASH_MuteID, mute.mID);
+ msg->addStringFast(_PREHASH_MuteName, mute.mName);
+ msg->addS32("MuteType", mute.mType);
+ msg->addU32("MuteFlags", mute.mFlags);
+ gAgent.sendReliableMessage();
if (!mIsLoaded)
{
LL_WARNS() << "Added elements to non-initialized block list" << LL_ENDL;
}
- mIsLoaded = TRUE; // why is this here? -MG
+ mIsLoaded = TRUE; // why is this here? -MG
}
BOOL LLMuteList::remove(const LLMute& mute, U32 flags)
{
- BOOL found = FALSE;
-
- // First, remove from main list.
- mute_set_t::iterator it = mMutes.find(mute);
- if (it != mMutes.end())
- {
- LLMute localmute = *it;
- bool remove = true;
- if(flags)
- {
- // If the user passed mute flags, we may only want to turn some flags on.
- localmute.mFlags |= flags;
-
- if(localmute.mFlags == LLMute::flagAll)
- {
- // Every currently available mute property has been masked out.
- // Remove the mute entry entirely.
- }
- else
- {
- // Only some of the properties are masked out. Update the entry.
- remove = false;
- }
- }
- else
- {
- // The caller didn't pass any flags -- just remove the mute entry entirely.
- // set flags to notify observers with (flag being present means that something is allowed)
- localmute.mFlags = LLMute::flagAll;
- }
-
- // Always remove the entry from the set -- it will be re-added with new flags if necessary.
- mMutes.erase(it);
-
- if(remove)
- {
- // The entry was actually removed. Notify the server.
- updateRemove(localmute);
- LL_INFOS() << "Unmuting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << LL_ENDL;
- }
- else
- {
- // Flags were updated, the mute entry needs to be retransmitted to the server and re-added to the list.
- mMutes.insert(localmute);
- updateAdd(localmute);
- LL_INFOS() << "Updating mute entry " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << LL_ENDL;
- }
-
- // Must be after erase.
- notifyObservers();
- notifyObserversDetailed(localmute);
- }
- else
- {
- // Clean up any legacy mutes
- string_set_t::iterator legacy_it = mLegacyMutes.find(mute.mName);
- if (legacy_it != mLegacyMutes.end())
- {
- // Database representation of legacy mute is UUID null.
- LLMute mute(LLUUID::null, *legacy_it, LLMute::BY_NAME);
- updateRemove(mute);
- mLegacyMutes.erase(legacy_it);
- // Must be after erase.
- notifyObservers();
- notifyObserversDetailed(mute);
- }
- }
-
- return found;
+ BOOL found = FALSE;
+
+ // First, remove from main list.
+ mute_set_t::iterator it = mMutes.find(mute);
+ if (it != mMutes.end())
+ {
+ LLMute localmute = *it;
+ bool remove = true;
+ if(flags)
+ {
+ // If the user passed mute flags, we may only want to turn some flags on.
+ localmute.mFlags |= flags;
+
+ if(localmute.mFlags == LLMute::flagAll)
+ {
+ // Every currently available mute property has been masked out.
+ // Remove the mute entry entirely.
+ }
+ else
+ {
+ // Only some of the properties are masked out. Update the entry.
+ remove = false;
+ }
+ }
+ else
+ {
+ // The caller didn't pass any flags -- just remove the mute entry entirely.
+ // set flags to notify observers with (flag being present means that something is allowed)
+ localmute.mFlags = LLMute::flagAll;
+ }
+
+ // Always remove the entry from the set -- it will be re-added with new flags if necessary.
+ mMutes.erase(it);
+
+ if(remove)
+ {
+ // The entry was actually removed. Notify the server.
+ updateRemove(localmute);
+ LL_INFOS() << "Unmuting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << LL_ENDL;
+ }
+ else
+ {
+ // Flags were updated, the mute entry needs to be retransmitted to the server and re-added to the list.
+ mMutes.insert(localmute);
+ updateAdd(localmute);
+ LL_INFOS() << "Updating mute entry " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << LL_ENDL;
+ }
+
+ // Must be after erase.
+ notifyObservers();
+ notifyObserversDetailed(localmute);
+ }
+ else
+ {
+ // Clean up any legacy mutes
+ string_set_t::iterator legacy_it = mLegacyMutes.find(mute.mName);
+ if (legacy_it != mLegacyMutes.end())
+ {
+ // Database representation of legacy mute is UUID null.
+ LLMute mute(LLUUID::null, *legacy_it, LLMute::BY_NAME);
+ updateRemove(mute);
+ mLegacyMutes.erase(legacy_it);
+ // Must be after erase.
+ notifyObservers();
+ notifyObserversDetailed(mute);
+ }
+ }
+
+ return found;
}
void LLMuteList::updateRemove(const LLMute& mute)
{
- // External mutes are not sent to the server anyway, no need to remove them.
- if (mute.mType == LLMute::EXTERNAL)
- {
- return;
- }
+ // External mutes are not sent to the server anyway, no need to remove them.
+ if (mute.mType == LLMute::EXTERNAL)
+ {
+ return;
+ }
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RemoveMuteListEntry);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MuteData);
- msg->addUUIDFast(_PREHASH_MuteID, mute.mID);
- msg->addString("MuteName", mute.mName);
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RemoveMuteListEntry);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_MuteData);
+ msg->addUUIDFast(_PREHASH_MuteID, mute.mID);
+ msg->addString("MuteName", mute.mName);
+ gAgent.sendReliableMessage();
}
void notify_automute_callback(const LLUUID& agent_id, const LLAvatarName& full_name, LLMuteList::EAutoReason reason)
{
- std::string notif_name;
- switch (reason)
- {
- default:
- case LLMuteList::AR_IM:
- notif_name = "AutoUnmuteByIM";
- break;
- case LLMuteList::AR_INVENTORY:
- notif_name = "AutoUnmuteByInventory";
- break;
- case LLMuteList::AR_MONEY:
- notif_name = "AutoUnmuteByMoney";
- break;
- }
-
- LLSD args;
- args["NAME"] = full_name.getUserName();
-
- LLNotificationPtr notif_ptr = LLNotifications::instance().add(notif_name, args, LLSD());
- if (notif_ptr)
- {
- std::string message = notif_ptr->getMessage();
-
- if (reason == LLMuteList::AR_IM)
- {
- LLIMModel::getInstance()->addMessage(agent_id, SYSTEM_FROM, LLUUID::null, message);
- }
- }
+ std::string notif_name;
+ switch (reason)
+ {
+ default:
+ case LLMuteList::AR_IM:
+ notif_name = "AutoUnmuteByIM";
+ break;
+ case LLMuteList::AR_INVENTORY:
+ notif_name = "AutoUnmuteByInventory";
+ break;
+ case LLMuteList::AR_MONEY:
+ notif_name = "AutoUnmuteByMoney";
+ break;
+ }
+
+ LLSD args;
+ args["NAME"] = full_name.getUserName();
+
+ LLNotificationPtr notif_ptr = LLNotifications::instance().add(notif_name, args, LLSD());
+ if (notif_ptr)
+ {
+ std::string message = notif_ptr->getMessage();
+
+ if (reason == LLMuteList::AR_IM)
+ {
+ LLIMModel::getInstance()->addMessage(agent_id, SYSTEM_FROM, LLUUID::null, message);
+ }
+ }
}
BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason)
{
- BOOL removed = FALSE;
+ BOOL removed = FALSE;
- if (isMuted(agent_id))
- {
- LLMute automute(agent_id, LLStringUtil::null, LLMute::AGENT);
- removed = TRUE;
- remove(automute);
+ if (isMuted(agent_id))
+ {
+ LLMute automute(agent_id, LLStringUtil::null, LLMute::AGENT);
+ removed = TRUE;
+ remove(automute);
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(agent_id, &av_name))
- {
- // name in cache, call callback directly
- notify_automute_callback(agent_id, av_name, reason);
- }
- else
- {
- // not in cache, lookup name from cache
- LLAvatarNameCache::get(agent_id,
- boost::bind(&notify_automute_callback, _1, _2, reason));
- }
- }
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(agent_id, &av_name))
+ {
+ // name in cache, call callback directly
+ notify_automute_callback(agent_id, av_name, reason);
+ }
+ else
+ {
+ // not in cache, lookup name from cache
+ LLAvatarNameCache::get(agent_id,
+ boost::bind(&notify_automute_callback, _1, _2, reason));
+ }
+ }
- return removed;
+ return removed;
}
std::vector<LLMute> LLMuteList::getMutes() const
{
- std::vector<LLMute> mutes;
-
- for (mute_set_t::const_iterator it = mMutes.begin();
- it != mMutes.end();
- ++it)
- {
- mutes.push_back(*it);
- }
-
- for (string_set_t::const_iterator it = mLegacyMutes.begin();
- it != mLegacyMutes.end();
- ++it)
- {
- LLMute legacy(LLUUID::null, *it);
- mutes.push_back(legacy);
- }
-
- std::sort(mutes.begin(), mutes.end(), compare_by_name());
- return mutes;
+ std::vector<LLMute> mutes;
+
+ for (mute_set_t::const_iterator it = mMutes.begin();
+ it != mMutes.end();
+ ++it)
+ {
+ mutes.push_back(*it);
+ }
+
+ for (string_set_t::const_iterator it = mLegacyMutes.begin();
+ it != mLegacyMutes.end();
+ ++it)
+ {
+ LLMute legacy(LLUUID::null, *it);
+ mutes.push_back(legacy);
+ }
+
+ std::sort(mutes.begin(), mutes.end(), compare_by_name());
+ return mutes;
}
//-----------------------------------------------------------------------------
@@ -561,48 +561,48 @@ std::vector<LLMute> LLMuteList::getMutes() const
//-----------------------------------------------------------------------------
BOOL LLMuteList::loadFromFile(const std::string& filename)
{
- if(!filename.size())
- {
- LL_WARNS() << "Mute List Filename is Empty!" << LL_ENDL;
- return FALSE;
- }
-
- LLFILE* fp = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/
- if (!fp)
- {
- LL_WARNS() << "Couldn't open mute list " << filename << LL_ENDL;
- return FALSE;
- }
-
- // *NOTE: Changing the size of these buffers will require changes
- // in the scanf below.
- char id_buffer[MAX_STRING]; /*Flawfinder: ignore*/
- char name_buffer[MAX_STRING]; /*Flawfinder: ignore*/
- char buffer[MAX_STRING]; /*Flawfinder: ignore*/
- while (!feof(fp)
- && fgets(buffer, MAX_STRING, fp))
- {
- id_buffer[0] = '\0';
- name_buffer[0] = '\0';
- S32 type = 0;
- U32 flags = 0;
- sscanf( /* Flawfinder: ignore */
- buffer, " %d %254s %254[^|]| %u\n", &type, id_buffer, name_buffer,
- &flags);
- LLUUID id = LLUUID(id_buffer);
- LLMute mute(id, std::string(name_buffer), (LLMute::EType)type, flags);
- if (mute.mID.isNull()
- || mute.mType == LLMute::BY_NAME)
- {
- mLegacyMutes.insert(mute.mName);
- }
- else
- {
- mMutes.insert(mute);
- }
- }
- fclose(fp);
- setLoaded();
+ if(!filename.size())
+ {
+ LL_WARNS() << "Mute List Filename is Empty!" << LL_ENDL;
+ return FALSE;
+ }
+
+ LLFILE* fp = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/
+ if (!fp)
+ {
+ LL_WARNS() << "Couldn't open mute list " << filename << LL_ENDL;
+ return FALSE;
+ }
+
+ // *NOTE: Changing the size of these buffers will require changes
+ // in the scanf below.
+ char id_buffer[MAX_STRING]; /*Flawfinder: ignore*/
+ char name_buffer[MAX_STRING]; /*Flawfinder: ignore*/
+ char buffer[MAX_STRING]; /*Flawfinder: ignore*/
+ while (!feof(fp)
+ && fgets(buffer, MAX_STRING, fp))
+ {
+ id_buffer[0] = '\0';
+ name_buffer[0] = '\0';
+ S32 type = 0;
+ U32 flags = 0;
+ sscanf( /* Flawfinder: ignore */
+ buffer, " %d %254s %254[^|]| %u\n", &type, id_buffer, name_buffer,
+ &flags);
+ LLUUID id = LLUUID(id_buffer);
+ LLMute mute(id, std::string(name_buffer), (LLMute::EType)type, flags);
+ if (mute.mID.isNull()
+ || mute.mType == LLMute::BY_NAME)
+ {
+ mLegacyMutes.insert(mute.mName);
+ }
+ else
+ {
+ mMutes.insert(mute);
+ }
+ }
+ fclose(fp);
+ setLoaded();
// server does not maintain up-to date account names (not display names!)
// in this list, so it falls to viewer.
@@ -616,7 +616,7 @@ BOOL LLMuteList::loadFromFile(const std::string& filename)
}
mPendingAgentNameUpdates.clear();
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -624,87 +624,87 @@ BOOL LLMuteList::loadFromFile(const std::string& filename)
//-----------------------------------------------------------------------------
BOOL LLMuteList::saveToFile(const std::string& filename)
{
- if(!filename.size())
- {
- LL_WARNS() << "Mute List Filename is Empty!" << LL_ENDL;
- return FALSE;
- }
-
- LLFILE* fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/
- if (!fp)
- {
- LL_WARNS() << "Couldn't open mute list " << filename << LL_ENDL;
- return FALSE;
- }
- // legacy mutes have null uuid
- std::string id_string;
- LLUUID::null.toString(id_string);
- for (string_set_t::iterator it = mLegacyMutes.begin();
- it != mLegacyMutes.end();
- ++it)
- {
- fprintf(fp, "%d %s %s|\n", (S32)LLMute::BY_NAME, id_string.c_str(), it->c_str());
- }
- for (mute_set_t::iterator it = mMutes.begin();
- it != mMutes.end();
- ++it)
- {
- // Don't save external mutes as they are not sent to the server and probably won't
- //be valid next time anyway.
- if (it->mType != LLMute::EXTERNAL)
- {
- it->mID.toString(id_string);
- const std::string& name = it->mName;
- fprintf(fp, "%d %s %s|%u\n", (S32)it->mType, id_string.c_str(), name.c_str(), it->mFlags);
- }
- }
- fclose(fp);
- return TRUE;
+ if(!filename.size())
+ {
+ LL_WARNS() << "Mute List Filename is Empty!" << LL_ENDL;
+ return FALSE;
+ }
+
+ LLFILE* fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/
+ if (!fp)
+ {
+ LL_WARNS() << "Couldn't open mute list " << filename << LL_ENDL;
+ return FALSE;
+ }
+ // legacy mutes have null uuid
+ std::string id_string;
+ LLUUID::null.toString(id_string);
+ for (string_set_t::iterator it = mLegacyMutes.begin();
+ it != mLegacyMutes.end();
+ ++it)
+ {
+ fprintf(fp, "%d %s %s|\n", (S32)LLMute::BY_NAME, id_string.c_str(), it->c_str());
+ }
+ for (mute_set_t::iterator it = mMutes.begin();
+ it != mMutes.end();
+ ++it)
+ {
+ // Don't save external mutes as they are not sent to the server and probably won't
+ //be valid next time anyway.
+ if (it->mType != LLMute::EXTERNAL)
+ {
+ it->mID.toString(id_string);
+ const std::string& name = it->mName;
+ fprintf(fp, "%d %s %s|%u\n", (S32)it->mType, id_string.c_str(), name.c_str(), it->mFlags);
+ }
+ }
+ fclose(fp);
+ return TRUE;
}
BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) const
{
- // for objects, check for muting on their parent prim
- LLViewerObject* mute_object = get_object_to_mute_from_id(id);
- LLUUID id_to_check = (mute_object) ? mute_object->getID() : id;
+ // for objects, check for muting on their parent prim
+ LLViewerObject* mute_object = get_object_to_mute_from_id(id);
+ LLUUID id_to_check = (mute_object) ? mute_object->getID() : id;
- // don't need name or type for lookup
- LLMute mute(id_to_check);
- mute_set_t::const_iterator mute_it = mMutes.find(mute);
- if (mute_it != mMutes.end())
- {
- // If any of the flags the caller passed are set, this item isn't considered muted for this caller.
- if(flags & mute_it->mFlags)
- {
- return FALSE;
- }
- return TRUE;
- }
+ // don't need name or type for lookup
+ LLMute mute(id_to_check);
+ mute_set_t::const_iterator mute_it = mMutes.find(mute);
+ if (mute_it != mMutes.end())
+ {
+ // If any of the flags the caller passed are set, this item isn't considered muted for this caller.
+ if(flags & mute_it->mFlags)
+ {
+ return FALSE;
+ }
+ return TRUE;
+ }
- // empty names can't be legacy-muted
- bool avatar = mute_object && mute_object->isAvatar();
- if (name.empty() || avatar) return FALSE;
+ // empty names can't be legacy-muted
+ bool avatar = mute_object && mute_object->isAvatar();
+ if (name.empty() || avatar) return FALSE;
- // Look in legacy pile
- string_set_t::const_iterator legacy_it = mLegacyMutes.find(name);
- return legacy_it != mLegacyMutes.end();
+ // Look in legacy pile
+ string_set_t::const_iterator legacy_it = mLegacyMutes.find(name);
+ return legacy_it != mLegacyMutes.end();
}
BOOL LLMuteList::isMuted(const std::string& username, U32 flags) const
{
- mute_set_t::const_iterator mute_iter = mMutes.begin();
- while(mute_iter != mMutes.end())
- {
- // can't convert "leha.test" into "LeHa TesT" so username comparison is more reliable
- if (mute_iter->mType == LLMute::AGENT
- && LLCacheName::buildUsername(mute_iter->mName) == username)
- {
- return TRUE;
- }
- mute_iter++;
- }
- return FALSE;
+ mute_set_t::const_iterator mute_iter = mMutes.begin();
+ while(mute_iter != mMutes.end())
+ {
+ // can't convert "leha.test" into "LeHa TesT" so username comparison is more reliable
+ if (mute_iter->mType == LLMute::AGENT
+ && LLCacheName::buildUsername(mute_iter->mName) == username)
+ {
+ return TRUE;
+ }
+ mute_iter++;
+ }
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -712,20 +712,20 @@ BOOL LLMuteList::isMuted(const std::string& username, U32 flags) const
//-----------------------------------------------------------------------------
void LLMuteList::requestFromServer(const LLUUID& agent_id)
{
- std::string agent_id_string;
- std::string filename;
- agent_id.toString(agent_id_string);
- filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute";
- LLCRC crc;
- crc.update(filename);
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MuteListRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, agent_id);
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MuteData);
- msg->addU32Fast(_PREHASH_MuteCRC, crc.getCRC());
+ std::string agent_id_string;
+ std::string filename;
+ agent_id.toString(agent_id_string);
+ filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute";
+ LLCRC crc;
+ crc.update(filename);
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_MuteListRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, agent_id);
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_MuteData);
+ msg->addU32Fast(_PREHASH_MuteCRC, crc.getCRC());
if (gDisconnected)
{
@@ -748,15 +748,15 @@ void LLMuteList::requestFromServer(const LLUUID& agent_id)
void LLMuteList::cache(const LLUUID& agent_id)
{
- // Write to disk even if empty.
- if(mIsLoaded)
- {
- std::string agent_id_string;
- std::string filename;
- agent_id.toString(agent_id_string);
- filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute";
- saveToFile(filename);
- }
+ // Write to disk even if empty.
+ if(mIsLoaded)
+ {
+ std::string agent_id_string;
+ std::string filename;
+ agent_id.toString(agent_id_string);
+ filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute";
+ saveToFile(filename);
+ }
}
//-----------------------------------------------------------------------------
@@ -765,51 +765,51 @@ void LLMuteList::cache(const LLUUID& agent_id)
void LLMuteList::processMuteListUpdate(LLMessageSystem* msg, void**)
{
- LL_INFOS() << "LLMuteList::processMuteListUpdate()" << LL_ENDL;
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_MuteData, _PREHASH_AgentID, agent_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS() << "Got an mute list update for the wrong agent." << LL_ENDL;
- return;
- }
- std::string unclean_filename;
- msg->getStringFast(_PREHASH_MuteData, _PREHASH_Filename, unclean_filename);
- std::string filename = LLDir::getScrubbedFileName(unclean_filename);
-
- std::string *local_filename_and_path = new std::string(gDirUtilp->getExpandedFilename( LL_PATH_CACHE, filename ));
- gXferManager->requestFile(*local_filename_and_path,
- filename,
- LL_PATH_CACHE,
- msg->getSender(),
- TRUE, // make the remote file temporary.
- onFileMuteList,
- (void**)local_filename_and_path,
- LLXferManager::HIGH_PRIORITY);
+ LL_INFOS() << "LLMuteList::processMuteListUpdate()" << LL_ENDL;
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_MuteData, _PREHASH_AgentID, agent_id);
+ if(agent_id != gAgent.getID())
+ {
+ LL_WARNS() << "Got an mute list update for the wrong agent." << LL_ENDL;
+ return;
+ }
+ std::string unclean_filename;
+ msg->getStringFast(_PREHASH_MuteData, _PREHASH_Filename, unclean_filename);
+ std::string filename = LLDir::getScrubbedFileName(unclean_filename);
+
+ std::string *local_filename_and_path = new std::string(gDirUtilp->getExpandedFilename( LL_PATH_CACHE, filename ));
+ gXferManager->requestFile(*local_filename_and_path,
+ filename,
+ LL_PATH_CACHE,
+ msg->getSender(),
+ TRUE, // make the remote file temporary.
+ onFileMuteList,
+ (void**)local_filename_and_path,
+ LLXferManager::HIGH_PRIORITY);
}
void LLMuteList::processUseCachedMuteList(LLMessageSystem* msg, void**)
{
- LL_INFOS() << "LLMuteList::processUseCachedMuteList()" << LL_ENDL;
+ LL_INFOS() << "LLMuteList::processUseCachedMuteList()" << LL_ENDL;
- std::string agent_id_string;
- gAgent.getID().toString(agent_id_string);
- std::string filename;
- filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute";
- LLMuteList::getInstance()->loadFromFile(filename);
+ std::string agent_id_string;
+ gAgent.getID().toString(agent_id_string);
+ std::string filename;
+ filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute";
+ LLMuteList::getInstance()->loadFromFile(filename);
}
void LLMuteList::onFileMuteList(void** user_data, S32 error_code, LLExtStat ext_status)
{
- LL_INFOS() << "LLMuteList::processMuteListFile()" << LL_ENDL;
+ LL_INFOS() << "LLMuteList::processMuteListFile()" << LL_ENDL;
- std::string* local_filename_and_path = (std::string*)user_data;
- if(local_filename_and_path && !local_filename_and_path->empty() && (error_code == 0))
- {
- LLMuteList::getInstance()->loadFromFile(*local_filename_and_path);
- LLFile::remove(*local_filename_and_path);
- }
- delete local_filename_and_path;
+ std::string* local_filename_and_path = (std::string*)user_data;
+ if(local_filename_and_path && !local_filename_and_path->empty() && (error_code == 0))
+ {
+ LLMuteList::getInstance()->loadFromFile(*local_filename_and_path);
+ LLFile::remove(*local_filename_and_path);
+ }
+ delete local_filename_and_path;
}
void LLMuteList::onAccountNameChanged(const LLUUID& id, const std::string& username)
@@ -856,44 +856,44 @@ void LLMuteList::onAccountNameChanged(const LLUUID& id, const std::string& usern
void LLMuteList::addObserver(LLMuteListObserver* observer)
{
- mObservers.insert(observer);
+ mObservers.insert(observer);
}
void LLMuteList::removeObserver(LLMuteListObserver* observer)
{
- mObservers.erase(observer);
+ mObservers.erase(observer);
}
void LLMuteList::setLoaded()
{
- mIsLoaded = TRUE;
- notifyObservers();
+ mIsLoaded = TRUE;
+ notifyObservers();
}
void LLMuteList::notifyObservers()
{
- for (observer_set_t::iterator it = mObservers.begin();
- it != mObservers.end();
- )
- {
- LLMuteListObserver* observer = *it;
- observer->onChange();
- // In case onChange() deleted an entry.
- it = mObservers.upper_bound(observer);
- }
+ for (observer_set_t::iterator it = mObservers.begin();
+ it != mObservers.end();
+ )
+ {
+ LLMuteListObserver* observer = *it;
+ observer->onChange();
+ // In case onChange() deleted an entry.
+ it = mObservers.upper_bound(observer);
+ }
}
void LLMuteList::notifyObserversDetailed(const LLMute& mute)
{
- for (observer_set_t::iterator it = mObservers.begin();
- it != mObservers.end();
- )
- {
- LLMuteListObserver* observer = *it;
- observer->onChangeDetailed(mute);
- // In case onChange() deleted an entry.
- it = mObservers.upper_bound(observer);
- }
+ for (observer_set_t::iterator it = mObservers.begin();
+ it != mObservers.end();
+ )
+ {
+ LLMuteListObserver* observer = *it;
+ observer->onChangeDetailed(mute);
+ // In case onChange() deleted an entry.
+ it = mObservers.upper_bound(observer);
+ }
}
LLRenderMuteList::LLRenderMuteList()
@@ -924,26 +924,26 @@ bool LLRenderMuteList::saveToFile()
bool LLRenderMuteList::loadFromFile()
{
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "render_mute_settings.txt");
- LLFILE* fp = LLFile::fopen(filename, "rb");
- if (!fp)
- {
- LL_WARNS() << "Couldn't open render mute list file: " << filename << LL_ENDL;
- return false;
- }
-
- char id_buffer[MAX_STRING];
- char buffer[MAX_STRING];
- while (!feof(fp) && fgets(buffer, MAX_STRING, fp))
- {
- id_buffer[0] = '\0';
- S32 setting = 0;
- S32 time = 0;
- sscanf(buffer, " %d %254s [%d]\n", &setting, id_buffer, &time);
- sVisuallyMuteSettingsMap[LLUUID(id_buffer)] = setting;
- sVisuallyMuteDateMap[LLUUID(id_buffer)] = (time == 0) ? (S32)time_corrected() : time;
- }
- fclose(fp);
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "render_mute_settings.txt");
+ LLFILE* fp = LLFile::fopen(filename, "rb");
+ if (!fp)
+ {
+ LL_WARNS() << "Couldn't open render mute list file: " << filename << LL_ENDL;
+ return false;
+ }
+
+ char id_buffer[MAX_STRING];
+ char buffer[MAX_STRING];
+ while (!feof(fp) && fgets(buffer, MAX_STRING, fp))
+ {
+ id_buffer[0] = '\0';
+ S32 setting = 0;
+ S32 time = 0;
+ sscanf(buffer, " %d %254s [%d]\n", &setting, id_buffer, &time);
+ sVisuallyMuteSettingsMap[LLUUID(id_buffer)] = setting;
+ sVisuallyMuteDateMap[LLUUID(id_buffer)] = (time == 0) ? (S32)time_corrected() : time;
+ }
+ fclose(fp);
return true;
}
diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h
index dda407e708..fc47e507c3 100644
--- a/indra/newview/llmutelist.h
+++ b/indra/newview/llmutelist.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmutelist.h
* @brief Management of list of muted players
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,168 +39,168 @@ class LLMuteListObserver;
class LLMute
{
public:
- // Legacy mutes are BY_NAME and have null UUID.
- // EXTERNAL mutes are only processed through an external system (e.g. Voice) and not stored.
- enum EType { BY_NAME = 0, AGENT = 1, OBJECT = 2, GROUP = 3, EXTERNAL = 4, COUNT = 5 };
-
- // Bits in the mute flags. For backwards compatibility (since any mute list entries that were created before the flags existed
- // will have a flags field of 0), some of the flags are "inverted".
- // Note that it's possible, through flags, to completely disable an entry in the mute list. The code should detect this case
- // and remove the mute list entry instead.
- enum
- {
- flagTextChat = 0x00000001, // If set, don't mute user's text chat
- flagVoiceChat = 0x00000002, // If set, don't mute user's voice chat
- flagParticles = 0x00000004, // If set, don't mute user's particles
- flagObjectSounds = 0x00000008, // If set, mute user's object sounds
-
- flagAll = 0x0000000F // Mask of all currently defined flags
- };
-
- LLMute(const LLUUID& id, const std::string& name = std::string(), EType type = BY_NAME, U32 flags = 0);
-
- // Returns localized type name of muted item
- std::string getDisplayType() const;
-
+ // Legacy mutes are BY_NAME and have null UUID.
+ // EXTERNAL mutes are only processed through an external system (e.g. Voice) and not stored.
+ enum EType { BY_NAME = 0, AGENT = 1, OBJECT = 2, GROUP = 3, EXTERNAL = 4, COUNT = 5 };
+
+ // Bits in the mute flags. For backwards compatibility (since any mute list entries that were created before the flags existed
+ // will have a flags field of 0), some of the flags are "inverted".
+ // Note that it's possible, through flags, to completely disable an entry in the mute list. The code should detect this case
+ // and remove the mute list entry instead.
+ enum
+ {
+ flagTextChat = 0x00000001, // If set, don't mute user's text chat
+ flagVoiceChat = 0x00000002, // If set, don't mute user's voice chat
+ flagParticles = 0x00000004, // If set, don't mute user's particles
+ flagObjectSounds = 0x00000008, // If set, mute user's object sounds
+
+ flagAll = 0x0000000F // Mask of all currently defined flags
+ };
+
+ LLMute(const LLUUID& id, const std::string& name = std::string(), EType type = BY_NAME, U32 flags = 0);
+
+ // Returns localized type name of muted item
+ std::string getDisplayType() const;
+
public:
- LLUUID mID; // agent or object id
- std::string mName; // agent or object name, does not store last name "Resident"
- EType mType; // needed for UI display of existing mutes
- U32 mFlags; // flags pertaining to this mute entry
+ LLUUID mID; // agent or object id
+ std::string mName; // agent or object name, does not store last name "Resident"
+ EType mType; // needed for UI display of existing mutes
+ U32 mFlags; // flags pertaining to this mute entry
};
class LLMuteList : public LLSingleton<LLMuteList>
{
- LLSINGLETON(LLMuteList);
- ~LLMuteList();
- /*virtual*/ void cleanupSingleton() override;
+ LLSINGLETON(LLMuteList);
+ ~LLMuteList();
+ /*virtual*/ void cleanupSingleton() override;
public:
- // reasons for auto-unmuting a resident
- enum EAutoReason
- {
- AR_IM = 0, // agent IMed a muted resident
- AR_MONEY = 1, // agent paid L$ to a muted resident
- AR_INVENTORY = 2, // agent offered inventory to a muted resident
- AR_COUNT // enum count
- };
-
-
- void addObserver(LLMuteListObserver* observer);
- void removeObserver(LLMuteListObserver* observer);
-
- // Add either a normal or a BY_NAME mute, for any or all properties.
- BOOL add(const LLMute& mute, U32 flags = 0);
-
- // Remove both normal and legacy mutes, for any or all properties.
- BOOL remove(const LLMute& mute, U32 flags = 0);
- BOOL autoRemove(const LLUUID& agent_id, const EAutoReason reason);
-
- // Name is required to test against legacy text-only mutes.
- BOOL isMuted(const LLUUID& id, const std::string& name = LLStringUtil::null, U32 flags = 0) const;
-
- // Workaround for username-based mute search, a lot of string conversions so use cautiously
+ // reasons for auto-unmuting a resident
+ enum EAutoReason
+ {
+ AR_IM = 0, // agent IMed a muted resident
+ AR_MONEY = 1, // agent paid L$ to a muted resident
+ AR_INVENTORY = 2, // agent offered inventory to a muted resident
+ AR_COUNT // enum count
+ };
+
+
+ void addObserver(LLMuteListObserver* observer);
+ void removeObserver(LLMuteListObserver* observer);
+
+ // Add either a normal or a BY_NAME mute, for any or all properties.
+ BOOL add(const LLMute& mute, U32 flags = 0);
+
+ // Remove both normal and legacy mutes, for any or all properties.
+ BOOL remove(const LLMute& mute, U32 flags = 0);
+ BOOL autoRemove(const LLUUID& agent_id, const EAutoReason reason);
+
+ // Name is required to test against legacy text-only mutes.
+ BOOL isMuted(const LLUUID& id, const std::string& name = LLStringUtil::null, U32 flags = 0) const;
+
+ // Workaround for username-based mute search, a lot of string conversions so use cautiously
// Expects lower case username
- BOOL isMuted(const std::string& username, U32 flags = 0) const;
+ BOOL isMuted(const std::string& username, U32 flags = 0) const;
+
+ // Alternate (convenience) form for places we don't need to pass the name, but do need flags
+ BOOL isMuted(const LLUUID& id, U32 flags) const { return isMuted(id, LLStringUtil::null, flags); };
+
+ static bool isLinden(const std::string& name);
+
+ BOOL isLoaded() const { return mIsLoaded; }
- // Alternate (convenience) form for places we don't need to pass the name, but do need flags
- BOOL isMuted(const LLUUID& id, U32 flags) const { return isMuted(id, LLStringUtil::null, flags); };
-
- static bool isLinden(const std::string& name);
-
- BOOL isLoaded() const { return mIsLoaded; }
+ std::vector<LLMute> getMutes() const;
- std::vector<LLMute> getMutes() const;
-
- // request the mute list
- void requestFromServer(const LLUUID& agent_id);
+ // request the mute list
+ void requestFromServer(const LLUUID& agent_id);
- // call this method on logout to save everything.
- void cache(const LLUUID& agent_id);
+ // call this method on logout to save everything.
+ void cache(const LLUUID& agent_id);
private:
- BOOL loadFromFile(const std::string& filename);
- BOOL saveToFile(const std::string& filename);
+ BOOL loadFromFile(const std::string& filename);
+ BOOL saveToFile(const std::string& filename);
- void setLoaded();
- void notifyObservers();
- void notifyObserversDetailed(const LLMute &mute);
+ void setLoaded();
+ void notifyObservers();
+ void notifyObserversDetailed(const LLMute &mute);
- void updateAdd(const LLMute& mute);
- void updateRemove(const LLMute& mute);
+ void updateAdd(const LLMute& mute);
+ void updateRemove(const LLMute& mute);
- // TODO: NULL out mute_id in database
- static void processMuteListUpdate(LLMessageSystem* msg, void**);
- static void processUseCachedMuteList(LLMessageSystem* msg, void**);
+ // TODO: NULL out mute_id in database
+ static void processMuteListUpdate(LLMessageSystem* msg, void**);
+ static void processUseCachedMuteList(LLMessageSystem* msg, void**);
- static void onFileMuteList(void** user_data, S32 code, LLExtStat ext_status);
- void onAccountNameChanged(const LLUUID& id, const std::string& username);
+ static void onFileMuteList(void** user_data, S32 code, LLExtStat ext_status);
+ void onAccountNameChanged(const LLUUID& id, const std::string& username);
private:
- struct compare_by_name
- {
- bool operator()(const LLMute& a, const LLMute& b) const
- {
- std::string name1 = a.mName;
- std::string name2 = b.mName;
-
- LLStringUtil::toUpper(name1);
- LLStringUtil::toUpper(name2);
-
- return name1 < name2;
- }
- };
- struct compare_by_id
- {
- bool operator()(const LLMute& a, const LLMute& b) const
- {
- return a.mID < b.mID;
- }
- };
- typedef std::set<LLMute, compare_by_id> mute_set_t;
- mute_set_t mMutes;
- typedef std::map<LLUUID, std::string> pending_names_t;
- pending_names_t mPendingAgentNameUpdates;
-
- typedef std::set<std::string> string_set_t;
- string_set_t mLegacyMutes;
-
- typedef std::set<LLMuteListObserver*> observer_set_t;
- observer_set_t mObservers;
-
- BOOL mIsLoaded;
-
- friend class LLDispatchEmptyMuteList;
+ struct compare_by_name
+ {
+ bool operator()(const LLMute& a, const LLMute& b) const
+ {
+ std::string name1 = a.mName;
+ std::string name2 = b.mName;
+
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
+
+ return name1 < name2;
+ }
+ };
+ struct compare_by_id
+ {
+ bool operator()(const LLMute& a, const LLMute& b) const
+ {
+ return a.mID < b.mID;
+ }
+ };
+ typedef std::set<LLMute, compare_by_id> mute_set_t;
+ mute_set_t mMutes;
+ typedef std::map<LLUUID, std::string> pending_names_t;
+ pending_names_t mPendingAgentNameUpdates;
+
+ typedef std::set<std::string> string_set_t;
+ string_set_t mLegacyMutes;
+
+ typedef std::set<LLMuteListObserver*> observer_set_t;
+ observer_set_t mObservers;
+
+ BOOL mIsLoaded;
+
+ friend class LLDispatchEmptyMuteList;
};
class LLMuteListObserver
{
public:
- virtual ~LLMuteListObserver() { }
- virtual void onChange() = 0;
- virtual void onChangeDetailed(const LLMute& ) { }
+ virtual ~LLMuteListObserver() { }
+ virtual void onChange() = 0;
+ virtual void onChangeDetailed(const LLMute& ) { }
};
class LLRenderMuteList : public LLSingleton<LLRenderMuteList>
{
LLSINGLETON(LLRenderMuteList);
public:
- bool loadFromFile();
- bool saveToFile();
- S32 getSavedVisualMuteSetting(const LLUUID& agent_id);
- void saveVisualMuteSetting(const LLUUID& agent_id, S32 setting);
+ bool loadFromFile();
+ bool saveToFile();
+ S32 getSavedVisualMuteSetting(const LLUUID& agent_id);
+ void saveVisualMuteSetting(const LLUUID& agent_id, S32 setting);
- S32 getVisualMuteDate(const LLUUID& agent_id);
+ S32 getVisualMuteDate(const LLUUID& agent_id);
- void addObserver(LLMuteListObserver* observer);
- void removeObserver(LLMuteListObserver* observer);
+ void addObserver(LLMuteListObserver* observer);
+ void removeObserver(LLMuteListObserver* observer);
- std::map<LLUUID, S32> sVisuallyMuteSettingsMap;
- std::map<LLUUID, S32> sVisuallyMuteDateMap;
+ std::map<LLUUID, S32> sVisuallyMuteSettingsMap;
+ std::map<LLUUID, S32> sVisuallyMuteDateMap;
private:
- void notifyObservers();
- typedef std::set<LLMuteListObserver*> observer_set_t;
- observer_set_t mObservers;
+ void notifyObservers();
+ typedef std::set<LLMuteListObserver*> observer_set_t;
+ observer_set_t mObservers;
};
diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp
index 8d32fb1d5c..ba4fcbb3cb 100644
--- a/indra/newview/llnamebox.cpp
+++ b/indra/newview/llnamebox.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnamebox.cpp
* @brief A text display widget
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,82 +44,82 @@ static LLDefaultChildRegistry::Register<LLNameBox> r("name_box");
LLNameBox::LLNameBox(const Params& p)
-: LLTextBox(p)
+: LLTextBox(p)
{
- mNameID = LLUUID::null;
- mLink = p.link;
- mParseHTML = mLink; // STORM-215
- mInitialValue = p.initial_value().asString();
- LLNameBox::sInstances.insert(this);
- setText(LLStringUtil::null);
+ mNameID = LLUUID::null;
+ mLink = p.link;
+ mParseHTML = mLink; // STORM-215
+ mInitialValue = p.initial_value().asString();
+ LLNameBox::sInstances.insert(this);
+ setText(LLStringUtil::null);
}
LLNameBox::~LLNameBox()
{
- LLNameBox::sInstances.erase(this);
+ LLNameBox::sInstances.erase(this);
}
void LLNameBox::setNameID(const LLUUID& name_id, BOOL is_group)
{
- mNameID = name_id;
-
- std::string name;
- BOOL got_name = FALSE;
-
- if (!is_group)
- {
- LLAvatarName av_name;
- got_name = LLAvatarNameCache::get(name_id, &av_name);
- name = av_name.getUserName();
- }
- else
- {
- got_name = gCacheName->getGroupName(name_id, name);
- }
-
- // Got the name already? Set it.
- // Otherwise it will be set later in refresh().
- if (got_name)
- setName(name, is_group);
- else
- setText(mInitialValue);
+ mNameID = name_id;
+
+ std::string name;
+ BOOL got_name = FALSE;
+
+ if (!is_group)
+ {
+ LLAvatarName av_name;
+ got_name = LLAvatarNameCache::get(name_id, &av_name);
+ name = av_name.getUserName();
+ }
+ else
+ {
+ got_name = gCacheName->getGroupName(name_id, name);
+ }
+
+ // Got the name already? Set it.
+ // Otherwise it will be set later in refresh().
+ if (got_name)
+ setName(name, is_group);
+ else
+ setText(mInitialValue);
}
void LLNameBox::refresh(const LLUUID& id, const std::string& full_name, bool is_group)
{
- if (id == mNameID)
- {
- setName(full_name, is_group);
- }
+ if (id == mNameID)
+ {
+ setName(full_name, is_group);
+ }
}
void LLNameBox::refreshAll(const LLUUID& id, const std::string& full_name, bool is_group)
{
- std::set<LLNameBox*>::iterator it;
- for (it = LLNameBox::sInstances.begin();
- it != LLNameBox::sInstances.end();
- ++it)
- {
- LLNameBox* box = *it;
- box->refresh(id, full_name, is_group);
- }
+ std::set<LLNameBox*>::iterator it;
+ for (it = LLNameBox::sInstances.begin();
+ it != LLNameBox::sInstances.end();
+ ++it)
+ {
+ LLNameBox* box = *it;
+ box->refresh(id, full_name, is_group);
+ }
}
void LLNameBox::setName(const std::string& name, BOOL is_group)
{
- if (mLink)
- {
- std::string url;
-
- if (is_group)
- url = "[secondlife:///app/group/" + mNameID.asString() + "/about " + name + "]";
- else
- url = "[secondlife:///app/agent/" + mNameID.asString() + "/about " + name + "]";
-
- setText(url);
- }
- else
- {
- setText(name);
- }
+ if (mLink)
+ {
+ std::string url;
+
+ if (is_group)
+ url = "[secondlife:///app/group/" + mNameID.asString() + "/about " + name + "]";
+ else
+ url = "[secondlife:///app/agent/" + mNameID.asString() + "/about " + name + "]";
+
+ setText(url);
+ }
+ else
+ {
+ setText(name);
+ }
}
diff --git a/indra/newview/llnamebox.h b/indra/newview/llnamebox.h
index 76e8551268..d98d26d755 100644
--- a/indra/newview/llnamebox.h
+++ b/indra/newview/llnamebox.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnamebox.h
* @brief display and refresh a name from the name cache
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,41 +35,41 @@
#include "lltextbox.h"
class LLNameBox
-: public LLTextBox
+: public LLTextBox
{
public:
- struct Params : public LLInitParam::Block<Params, LLTextBox::Params>
- {
- Optional<bool> is_group;
- Optional<bool> link;
+ struct Params : public LLInitParam::Block<Params, LLTextBox::Params>
+ {
+ Optional<bool> is_group;
+ Optional<bool> link;
- Params()
- : is_group("is_group", false)
- , link("link", false)
- {}
- };
+ Params()
+ : is_group("is_group", false)
+ , link("link", false)
+ {}
+ };
- virtual ~LLNameBox();
+ virtual ~LLNameBox();
- void setNameID(const LLUUID& name_id, BOOL is_group);
+ void setNameID(const LLUUID& name_id, BOOL is_group);
- void refresh(const LLUUID& id, const std::string& full_name, bool is_group);
+ void refresh(const LLUUID& id, const std::string& full_name, bool is_group);
- static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group);
+ static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group);
protected:
- LLNameBox (const Params&);
+ LLNameBox (const Params&);
- friend class LLUICtrlFactory;
+ friend class LLUICtrlFactory;
private:
- void setName(const std::string& name, BOOL is_group);
+ void setName(const std::string& name, BOOL is_group);
- static std::set<LLNameBox*> sInstances;
+ static std::set<LLNameBox*> sInstances;
private:
- LLUUID mNameID;
- BOOL mLink;
- std::string mInitialValue;
+ LLUUID mNameID;
+ BOOL mLink;
+ std::string mInitialValue;
};
diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp
index 055754f270..b9dcc98a28 100644
--- a/indra/newview/llnameeditor.cpp
+++ b/indra/newview/llnameeditor.cpp
@@ -1,31 +1,31 @@
-/**
+/**
* @file llnameeditor.cpp
* @brief Name Editor to refresh a name.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
-
+
#include "llnameeditor.h"
#include "llcachename.h"
#include "llavatarnamecache.h"
@@ -43,68 +43,68 @@ static LLDefaultChildRegistry::Register<LLNameEditor> r("name_editor");
std::set<LLNameEditor*> LLNameEditor::sInstances;
LLNameEditor::LLNameEditor(const LLNameEditor::Params& p)
-: LLLineEditor(p)
+: LLLineEditor(p)
{
- LLNameEditor::sInstances.insert(this);
+ LLNameEditor::sInstances.insert(this);
- if(!p.name_id().isNull())
- {
- setNameID(p.name_id, p.is_group);
- }
+ if(!p.name_id().isNull())
+ {
+ setNameID(p.name_id, p.is_group);
+ }
}
LLNameEditor::~LLNameEditor()
{
- LLNameEditor::sInstances.erase(this);
+ LLNameEditor::sInstances.erase(this);
}
void LLNameEditor::setNameID(const LLUUID& name_id, BOOL is_group)
{
- mNameID = name_id;
-
- std::string name;
-
- if (!is_group)
- {
- LLAvatarName av_name;
- LLAvatarNameCache::get(name_id, &av_name);
- name = av_name.getUserName();
- }
- else
- {
- gCacheName->getGroupName(name_id, name);
- }
-
- setText(name);
+ mNameID = name_id;
+
+ std::string name;
+
+ if (!is_group)
+ {
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(name_id, &av_name);
+ name = av_name.getUserName();
+ }
+ else
+ {
+ gCacheName->getGroupName(name_id, name);
+ }
+
+ setText(name);
}
void LLNameEditor::refresh(const LLUUID& id, const std::string& full_name, bool is_group)
{
- if (id == mNameID)
- {
- setText(full_name);
- }
+ if (id == mNameID)
+ {
+ setText(full_name);
+ }
}
void LLNameEditor::refreshAll(const LLUUID& id, const std::string& full_name, bool is_group)
{
- std::set<LLNameEditor*>::iterator it;
- for (it = LLNameEditor::sInstances.begin();
- it != LLNameEditor::sInstances.end();
- ++it)
- {
- LLNameEditor* box = *it;
- box->refresh(id, full_name, is_group);
- }
+ std::set<LLNameEditor*>::iterator it;
+ for (it = LLNameEditor::sInstances.begin();
+ it != LLNameEditor::sInstances.end();
+ ++it)
+ {
+ LLNameEditor* box = *it;
+ box->refresh(id, full_name, is_group);
+ }
}
void LLNameEditor::setValue( const LLSD& value )
{
- setNameID(value.asUUID(), FALSE);
+ setNameID(value.asUUID(), FALSE);
}
LLSD LLNameEditor::getValue() const
{
- return LLSD(mNameID);
+ return LLSD(mNameID);
}
diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h
index b8c4a6042e..84dd347008 100644
--- a/indra/newview/llnameeditor.h
+++ b/indra/newview/llnameeditor.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnameeditor.h
* @brief display and refresh a name from the name cache
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,42 +37,42 @@
class LLNameEditor
-: public LLLineEditor
+: public LLLineEditor
{
public:
- struct Params : public LLInitParam::Block<Params, LLLineEditor::Params>
- {
- Optional<bool> is_group;
- Optional<LLUUID> name_id;
+ struct Params : public LLInitParam::Block<Params, LLLineEditor::Params>
+ {
+ Optional<bool> is_group;
+ Optional<LLUUID> name_id;
- Params()
- : is_group("is_group"),
- name_id("name_id")
- {}
- };
+ Params()
+ : is_group("is_group"),
+ name_id("name_id")
+ {}
+ };
protected:
- LLNameEditor(const Params&);
- friend class LLUICtrlFactory;
+ LLNameEditor(const Params&);
+ friend class LLUICtrlFactory;
public:
- virtual ~LLNameEditor();
+ virtual ~LLNameEditor();
- void setNameID(const LLUUID& name_id, BOOL is_group);
+ void setNameID(const LLUUID& name_id, BOOL is_group);
- void refresh(const LLUUID& id, const std::string& full_name, bool is_group);
+ void refresh(const LLUUID& id, const std::string& full_name, bool is_group);
- static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group);
+ static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group);
- // Take/return agent UUIDs
- virtual void setValue( const LLSD& value );
- virtual LLSD getValue() const;
+ // Take/return agent UUIDs
+ virtual void setValue( const LLSD& value );
+ virtual LLSD getValue() const;
private:
- static std::set<LLNameEditor*> sInstances;
+ static std::set<LLNameEditor*> sInstances;
private:
- LLUUID mNameID;
+ LLUUID mNameID;
};
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index d7d6fa1893..dc0f5f89fd 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnamelistctrl.cpp
* @brief A list of names, automatically refreshed from name cache.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,89 +49,89 @@ static const S32 info_icon_size = 16;
void LLNameListCtrl::NameTypeNames::declareValues()
{
- declare("INDIVIDUAL", LLNameListCtrl::INDIVIDUAL);
- declare("GROUP", LLNameListCtrl::GROUP);
- declare("SPECIAL", LLNameListCtrl::SPECIAL);
+ declare("INDIVIDUAL", LLNameListCtrl::INDIVIDUAL);
+ declare("GROUP", LLNameListCtrl::GROUP);
+ declare("SPECIAL", LLNameListCtrl::SPECIAL);
}
LLNameListCtrl::Params::Params()
-: name_column(""),
- allow_calling_card_drop("allow_calling_card_drop", false),
- short_names("short_names", false)
+: name_column(""),
+ allow_calling_card_drop("allow_calling_card_drop", false),
+ short_names("short_names", false)
{
}
LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p)
-: LLScrollListCtrl(p),
- mNameColumnIndex(p.name_column.column_index),
- mNameColumn(p.name_column.column_name),
- mAllowCallingCardDrop(p.allow_calling_card_drop),
- mShortNames(p.short_names),
- mPendingLookupsRemaining(0),
+: LLScrollListCtrl(p),
+ mNameColumnIndex(p.name_column.column_index),
+ mNameColumn(p.name_column.column_name),
+ mAllowCallingCardDrop(p.allow_calling_card_drop),
+ mShortNames(p.short_names),
+ mPendingLookupsRemaining(0),
mHoverIconName("Info_Small"),
mNameListType(INDIVIDUAL)
{}
// public
LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos,
- BOOL enabled, const std::string& suffix, const std::string& prefix)
+ BOOL enabled, const std::string& suffix, const std::string& prefix)
{
- //LL_INFOS() << "LLNameListCtrl::addNameItem " << agent_id << LL_ENDL;
+ //LL_INFOS() << "LLNameListCtrl::addNameItem " << agent_id << LL_ENDL;
- NameItem item;
- item.value = agent_id;
- item.enabled = enabled;
- item.target = INDIVIDUAL;
+ NameItem item;
+ item.value = agent_id;
+ item.enabled = enabled;
+ item.target = INDIVIDUAL;
- return addNameItemRow(item, pos, suffix, prefix);
+ return addNameItemRow(item, pos, suffix, prefix);
}
// virtual, public
-BOOL LLNameListCtrl::handleDragAndDrop(
- S32 x, S32 y, MASK mask,
- BOOL drop,
- EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg)
+BOOL LLNameListCtrl::handleDragAndDrop(
+ S32 x, S32 y, MASK mask,
+ BOOL drop,
+ EDragAndDropType cargo_type, void *cargo_data,
+ EAcceptance *accept,
+ std::string& tooltip_msg)
{
- if (!mAllowCallingCardDrop)
- {
- return FALSE;
- }
-
- BOOL handled = FALSE;
-
- if (cargo_type == DAD_CALLINGCARD)
- {
- if (drop)
- {
- LLInventoryItem* item = (LLInventoryItem *)cargo_data;
- addNameItem(item->getCreatorUUID());
- }
-
- *accept = ACCEPT_YES_MULTI;
- }
- else
- {
- *accept = ACCEPT_NO;
- if (tooltip_msg.empty())
- {
- if (!getToolTip().empty())
- {
- tooltip_msg = getToolTip();
- }
- else
- {
- // backwards compatable English tooltip (should be overridden in xml)
- tooltip_msg.assign("Drag a calling card here\nto add a resident.");
- }
- }
- }
-
- handled = TRUE;
- LL_DEBUGS("UserInput") << "dragAndDrop handled by LLNameListCtrl " << getName() << LL_ENDL;
-
- return handled;
+ if (!mAllowCallingCardDrop)
+ {
+ return FALSE;
+ }
+
+ BOOL handled = FALSE;
+
+ if (cargo_type == DAD_CALLINGCARD)
+ {
+ if (drop)
+ {
+ LLInventoryItem* item = (LLInventoryItem *)cargo_data;
+ addNameItem(item->getCreatorUUID());
+ }
+
+ *accept = ACCEPT_YES_MULTI;
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ if (tooltip_msg.empty())
+ {
+ if (!getToolTip().empty())
+ {
+ tooltip_msg = getToolTip();
+ }
+ else
+ {
+ // backwards compatable English tooltip (should be overridden in xml)
+ tooltip_msg.assign("Drag a calling card here\nto add a resident.");
+ }
+ }
+ }
+
+ handled = TRUE;
+ LL_DEBUGS("UserInput") << "dragAndDrop handled by LLNameListCtrl " << getName() << LL_ENDL;
+
+ return handled;
}
void LLNameListCtrl::showInspector(const LLUUID& avatar_id, bool is_group, bool is_experience)
@@ -142,142 +142,142 @@ void LLNameListCtrl::showInspector(const LLUUID& avatar_id, bool is_group, bool
return;
}
if(is_experience)
- {
- LLFloaterReg::showInstance("experience_profile", avatar_id, true);
- return;
- }
-
- if (is_group)
- LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", avatar_id));
- else
- LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
+ {
+ LLFloaterReg::showInstance("experience_profile", avatar_id, true);
+ return;
+ }
+
+ if (is_group)
+ LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", avatar_id));
+ else
+ LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
}
-void LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index )
+void LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index )
{
- S32 cur_index = getHighlightedItemInx();
- if (cur_index != target_index)
- {
- bool is_mouse_over_name_cell = false;
-
- S32 mouse_x, mouse_y;
- LLUI::getInstance()->getMousePositionLocal(this, &mouse_x, &mouse_y);
-
- S32 column_index = getColumnIndexFromOffset(mouse_x);
- LLScrollListItem* hit_item = hitItem(mouse_x, mouse_y);
- if (hit_item && column_index == mNameColumnIndex)
- {
- // Get the name cell which is currently under the mouse pointer.
- LLScrollListCell* hit_cell = hit_item->getColumn(column_index);
- if (hit_cell)
- {
- is_mouse_over_name_cell = getCellRect(cur_index, column_index).pointInRect(mouse_x, mouse_y);
- }
- }
-
- // If the tool tip is visible and the mouse is over the currently highlighted item's name cell,
- // we should not reset the highlighted item index i.e. set mHighlightedItem = -1
- // and should not increase the width of the text inside the cell because it may
- // overlap the tool tip icon.
- if (LLToolTipMgr::getInstance()->toolTipVisible() && is_mouse_over_name_cell)
- return;
-
- if(0 <= cur_index && cur_index < (S32)getItemList().size())
- {
- LLScrollListItem* item = getItemList()[cur_index];
- if (item)
- {
- LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
- if (cell)
- cell->setTextWidth(cell->getTextWidth() + info_icon_size);
- }
- else
- {
- LL_WARNS() << "highlighted name list item is NULL" << LL_ENDL;
- }
- }
- if(target_index != -1)
- {
- LLScrollListItem* item = getItemList()[target_index];
- LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
- if (item)
- {
- if (cell)
- cell->setTextWidth(cell->getTextWidth() - info_icon_size);
- }
- else
- {
- LL_WARNS() << "target name item is NULL" << LL_ENDL;
- }
- }
- }
-
- LLScrollListCtrl::mouseOverHighlightNthItem(target_index);
+ S32 cur_index = getHighlightedItemInx();
+ if (cur_index != target_index)
+ {
+ bool is_mouse_over_name_cell = false;
+
+ S32 mouse_x, mouse_y;
+ LLUI::getInstance()->getMousePositionLocal(this, &mouse_x, &mouse_y);
+
+ S32 column_index = getColumnIndexFromOffset(mouse_x);
+ LLScrollListItem* hit_item = hitItem(mouse_x, mouse_y);
+ if (hit_item && column_index == mNameColumnIndex)
+ {
+ // Get the name cell which is currently under the mouse pointer.
+ LLScrollListCell* hit_cell = hit_item->getColumn(column_index);
+ if (hit_cell)
+ {
+ is_mouse_over_name_cell = getCellRect(cur_index, column_index).pointInRect(mouse_x, mouse_y);
+ }
+ }
+
+ // If the tool tip is visible and the mouse is over the currently highlighted item's name cell,
+ // we should not reset the highlighted item index i.e. set mHighlightedItem = -1
+ // and should not increase the width of the text inside the cell because it may
+ // overlap the tool tip icon.
+ if (LLToolTipMgr::getInstance()->toolTipVisible() && is_mouse_over_name_cell)
+ return;
+
+ if(0 <= cur_index && cur_index < (S32)getItemList().size())
+ {
+ LLScrollListItem* item = getItemList()[cur_index];
+ if (item)
+ {
+ LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
+ if (cell)
+ cell->setTextWidth(cell->getTextWidth() + info_icon_size);
+ }
+ else
+ {
+ LL_WARNS() << "highlighted name list item is NULL" << LL_ENDL;
+ }
+ }
+ if(target_index != -1)
+ {
+ LLScrollListItem* item = getItemList()[target_index];
+ LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
+ if (item)
+ {
+ if (cell)
+ cell->setTextWidth(cell->getTextWidth() - info_icon_size);
+ }
+ else
+ {
+ LL_WARNS() << "target name item is NULL" << LL_ENDL;
+ }
+ }
+ }
+
+ LLScrollListCtrl::mouseOverHighlightNthItem(target_index);
}
//virtual
BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
- S32 column_index = getColumnIndexFromOffset(x);
- LLNameListItem* hit_item = dynamic_cast<LLNameListItem*>(hitItem(x, y));
- LLFloater* floater = gFloaterView->getParentFloater(this);
+ BOOL handled = FALSE;
+ S32 column_index = getColumnIndexFromOffset(x);
+ LLNameListItem* hit_item = dynamic_cast<LLNameListItem*>(hitItem(x, y));
+ LLFloater* floater = gFloaterView->getParentFloater(this);
- if (floater
- && floater->isFrontmost()
- && hit_item
- && ((column_index == mNameColumnIndex) || isSpecialType()))
- {
+ if (floater
+ && floater->isFrontmost()
+ && hit_item
+ && ((column_index == mNameColumnIndex) || isSpecialType()))
+ {
// ...this is the column with the avatar name
- LLUUID item_id = isSpecialType() ? hit_item->getSpecialID() : hit_item->getUUID();
- if (item_id.notNull())
- {
- // ...valid avatar id
-
- LLScrollListCell* hit_cell = hit_item->getColumn(column_index);
- if (hit_cell)
- {
- S32 row_index = getItemIndex(hit_item);
- LLRect cell_rect = getCellRect(row_index, isSpecialType() ? getNumColumns() - 1 : column_index);
- // Convert rect local to screen coordinates
- LLRect sticky_rect;
- localRectToScreen(cell_rect, &sticky_rect);
-
- // Spawn at right side of cell
- LLPointer<LLUIImage> icon = LLUI::getUIImage(mHoverIconName);
- S32 screenX = sticky_rect.mRight - info_icon_size;
- S32 screenY = sticky_rect.mTop - (sticky_rect.getHeight() - icon->getHeight()) / 2;
- LLCoordGL pos(screenX, screenY);
-
- LLFloater* snapshot_floatr = gSnapshotFloaterView->getFrontmostClosableFloater();
- if (!snapshot_floatr || !snapshot_floatr->getRect().pointInRect(screenX + icon->getWidth(), screenY))
- {
- // Should we show a group or an avatar inspector?
- bool is_group = hit_item->isGroup();
- bool is_experience = hit_item->isExperience();
-
- LLToolTip::Params params;
- params.background_visible(false);
- params.click_callback(boost::bind(&LLNameListCtrl::showInspector, this, item_id, is_group, is_experience));
- params.delay_time(0.0f); // spawn instantly on hover
- params.image(icon);
- params.message("");
- params.padding(0);
- params.pos(pos);
- params.sticky_rect(sticky_rect);
-
- LLToolTipMgr::getInstance()->show(params);
- handled = TRUE;
- }
- }
- }
- }
- if (!handled)
- {
- handled = LLScrollListCtrl::handleToolTip(x, y, mask);
- }
- return handled;
+ LLUUID item_id = isSpecialType() ? hit_item->getSpecialID() : hit_item->getUUID();
+ if (item_id.notNull())
+ {
+ // ...valid avatar id
+
+ LLScrollListCell* hit_cell = hit_item->getColumn(column_index);
+ if (hit_cell)
+ {
+ S32 row_index = getItemIndex(hit_item);
+ LLRect cell_rect = getCellRect(row_index, isSpecialType() ? getNumColumns() - 1 : column_index);
+ // Convert rect local to screen coordinates
+ LLRect sticky_rect;
+ localRectToScreen(cell_rect, &sticky_rect);
+
+ // Spawn at right side of cell
+ LLPointer<LLUIImage> icon = LLUI::getUIImage(mHoverIconName);
+ S32 screenX = sticky_rect.mRight - info_icon_size;
+ S32 screenY = sticky_rect.mTop - (sticky_rect.getHeight() - icon->getHeight()) / 2;
+ LLCoordGL pos(screenX, screenY);
+
+ LLFloater* snapshot_floatr = gSnapshotFloaterView->getFrontmostClosableFloater();
+ if (!snapshot_floatr || !snapshot_floatr->getRect().pointInRect(screenX + icon->getWidth(), screenY))
+ {
+ // Should we show a group or an avatar inspector?
+ bool is_group = hit_item->isGroup();
+ bool is_experience = hit_item->isExperience();
+
+ LLToolTip::Params params;
+ params.background_visible(false);
+ params.click_callback(boost::bind(&LLNameListCtrl::showInspector, this, item_id, is_group, is_experience));
+ params.delay_time(0.0f); // spawn instantly on hover
+ params.image(icon);
+ params.message("");
+ params.padding(0);
+ params.pos(pos);
+ params.sticky_rect(sticky_rect);
+
+ LLToolTipMgr::getInstance()->show(params);
+ handled = TRUE;
+ }
+ }
+ }
+ }
+ if (!handled)
+ {
+ handled = LLScrollListCtrl::handleToolTip(x, y, mask);
+ }
+ return handled;
}
// virtual
@@ -296,192 +296,192 @@ BOOL LLNameListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
return handled;
}
}
- return LLScrollListCtrl::handleRightMouseDown(x, y, mask);
+ return LLScrollListCtrl::handleRightMouseDown(x, y, mask);
}
// public
void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos,
- BOOL enabled)
+ BOOL enabled)
{
- NameItem item;
- item.value = group_id;
- item.enabled = enabled;
- item.target = GROUP;
+ NameItem item;
+ item.value = group_id;
+ item.enabled = enabled;
+ item.target = GROUP;
- addNameItemRow(item, pos);
+ addNameItemRow(item, pos);
}
// public
void LLNameListCtrl::addGroupNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos)
{
- item.target = GROUP;
- addNameItemRow(item, pos);
+ item.target = GROUP;
+ addNameItemRow(item, pos);
}
LLScrollListItem* LLNameListCtrl::addNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos)
{
- item.target = INDIVIDUAL;
- return addNameItemRow(item, pos);
+ item.target = INDIVIDUAL;
+ return addNameItemRow(item, pos);
}
LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition pos, void* userdata)
{
- LLNameListCtrl::NameItem item_params;
- LLParamSDParser parser;
- parser.readSD(element, item_params);
- item_params.userdata = userdata;
- return addNameItemRow(item_params, pos);
+ LLNameListCtrl::NameItem item_params;
+ LLParamSDParser parser;
+ parser.readSD(element, item_params);
+ item_params.userdata = userdata;
+ return addNameItemRow(item_params, pos);
}
LLScrollListItem* LLNameListCtrl::addNameItemRow(
- const LLNameListCtrl::NameItem& name_item,
- EAddPosition pos,
- const std::string& suffix,
- const std::string& prefix)
+ const LLNameListCtrl::NameItem& name_item,
+ EAddPosition pos,
+ const std::string& suffix,
+ const std::string& prefix)
{
- LLUUID id = name_item.value().asUUID();
- LLNameListItem* item = new LLNameListItem(name_item,name_item.target() == GROUP, name_item.target() == EXPERIENCE);
-
- if (!item) return NULL;
-
- LLScrollListCtrl::addRow(item, name_item, pos);
-
- // use supplied name by default
- std::string fullname = name_item.name;
-
- switch(name_item.target)
- {
- case GROUP:
- if (!gCacheName->getGroupName(id, fullname))
- {
- avatar_name_cache_connection_map_t::iterator it = mGroupNameCacheConnections.find(id);
- if (it != mGroupNameCacheConnections.end())
- {
- if (it->second.connected())
- {
- it->second.disconnect();
- }
- mGroupNameCacheConnections.erase(it);
- }
- mGroupNameCacheConnections[id] = gCacheName->getGroup(id, boost::bind(&LLNameListCtrl::onGroupNameCache, this, _1, _2, item->getHandle()));
- }
- break;
- case SPECIAL:
+ LLUUID id = name_item.value().asUUID();
+ LLNameListItem* item = new LLNameListItem(name_item,name_item.target() == GROUP, name_item.target() == EXPERIENCE);
+
+ if (!item) return NULL;
+
+ LLScrollListCtrl::addRow(item, name_item, pos);
+
+ // use supplied name by default
+ std::string fullname = name_item.name;
+
+ switch(name_item.target)
+ {
+ case GROUP:
+ if (!gCacheName->getGroupName(id, fullname))
+ {
+ avatar_name_cache_connection_map_t::iterator it = mGroupNameCacheConnections.find(id);
+ if (it != mGroupNameCacheConnections.end())
+ {
+ if (it->second.connected())
+ {
+ it->second.disconnect();
+ }
+ mGroupNameCacheConnections.erase(it);
+ }
+ mGroupNameCacheConnections[id] = gCacheName->getGroup(id, boost::bind(&LLNameListCtrl::onGroupNameCache, this, _1, _2, item->getHandle()));
+ }
+ break;
+ case SPECIAL:
{
item->setSpecialID(name_item.special_id());
return item;
}
- case INDIVIDUAL:
- {
- LLAvatarName av_name;
- if (id.isNull())
- {
- fullname = LLTrans::getString("AvatarNameNobody");
- }
- else if (LLAvatarNameCache::get(id, &av_name))
- {
- if (mShortNames)
- fullname = av_name.getDisplayName(true);
- else
- fullname = av_name.getCompleteName();
- }
- else
- {
- // ...schedule a callback
- avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id);
- if (it != mAvatarNameCacheConnections.end())
- {
- if (it->second.connected())
- {
- it->second.disconnect();
- }
- mAvatarNameCacheConnections.erase(it);
- }
- mAvatarNameCacheConnections[id] = LLAvatarNameCache::get(id,boost::bind(&LLNameListCtrl::onAvatarNameCache,this, _1, _2, suffix, prefix, item->getHandle()));
-
- if(mPendingLookupsRemaining <= 0)
- {
- // BAKER TODO:
- // We might get into a state where mPendingLookupsRemaining might
- // go negative. So just reset it right now and figure out if it's
- // possible later :)
- mPendingLookupsRemaining = 0;
- mNameListCompleteSignal(false);
- }
- mPendingLookupsRemaining++;
- }
- break;
- }
- case EXPERIENCE:
- // just use supplied name
- default:
- break;
- }
-
- // Append optional suffix.
- if (!suffix.empty())
- {
- fullname.append(suffix);
- }
-
- LLScrollListCell* cell = item->getColumn(mNameColumnIndex);
- if (cell)
- {
- cell->setValue(prefix + fullname);
- cell->setAltValue(name_item.alt_value());
- }
-
- dirtyColumns();
-
- // this column is resizable
- LLScrollListColumn* columnp = getColumn(mNameColumnIndex);
- if (columnp && columnp->mHeader)
- {
- columnp->mHeader->setHasResizableElement(TRUE);
- }
-
- return item;
+ case INDIVIDUAL:
+ {
+ LLAvatarName av_name;
+ if (id.isNull())
+ {
+ fullname = LLTrans::getString("AvatarNameNobody");
+ }
+ else if (LLAvatarNameCache::get(id, &av_name))
+ {
+ if (mShortNames)
+ fullname = av_name.getDisplayName(true);
+ else
+ fullname = av_name.getCompleteName();
+ }
+ else
+ {
+ // ...schedule a callback
+ avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id);
+ if (it != mAvatarNameCacheConnections.end())
+ {
+ if (it->second.connected())
+ {
+ it->second.disconnect();
+ }
+ mAvatarNameCacheConnections.erase(it);
+ }
+ mAvatarNameCacheConnections[id] = LLAvatarNameCache::get(id,boost::bind(&LLNameListCtrl::onAvatarNameCache,this, _1, _2, suffix, prefix, item->getHandle()));
+
+ if(mPendingLookupsRemaining <= 0)
+ {
+ // BAKER TODO:
+ // We might get into a state where mPendingLookupsRemaining might
+ // go negative. So just reset it right now and figure out if it's
+ // possible later :)
+ mPendingLookupsRemaining = 0;
+ mNameListCompleteSignal(false);
+ }
+ mPendingLookupsRemaining++;
+ }
+ break;
+ }
+ case EXPERIENCE:
+ // just use supplied name
+ default:
+ break;
+ }
+
+ // Append optional suffix.
+ if (!suffix.empty())
+ {
+ fullname.append(suffix);
+ }
+
+ LLScrollListCell* cell = item->getColumn(mNameColumnIndex);
+ if (cell)
+ {
+ cell->setValue(prefix + fullname);
+ cell->setAltValue(name_item.alt_value());
+ }
+
+ dirtyColumns();
+
+ // this column is resizable
+ LLScrollListColumn* columnp = getColumn(mNameColumnIndex);
+ if (columnp && columnp->mHeader)
+ {
+ columnp->mHeader->setHasResizableElement(TRUE);
+ }
+
+ return item;
}
// public
void LLNameListCtrl::removeNameItem(const LLUUID& agent_id)
{
- // Find the item specified with agent_id.
- S32 idx = -1;
- for (item_list::iterator it = getItemList().begin(); it != getItemList().end(); it++)
- {
- LLScrollListItem* item = *it;
+ // Find the item specified with agent_id.
+ S32 idx = -1;
+ for (item_list::iterator it = getItemList().begin(); it != getItemList().end(); it++)
+ {
+ LLScrollListItem* item = *it;
LLUUID cur_id = isSpecialType() ? dynamic_cast<LLNameListItem*>(item)->getSpecialID() : item->getUUID();
if (cur_id == agent_id)
- {
- idx = getItemIndex(item);
- break;
- }
- }
-
- // Remove it.
- if (idx >= 0)
- {
- selectNthItem(idx); // not sure whether this is needed, taken from previous implementation
- deleteSingleItem(idx);
-
- mPendingLookupsRemaining--;
- }
+ {
+ idx = getItemIndex(item);
+ break;
+ }
+ }
+
+ // Remove it.
+ if (idx >= 0)
+ {
+ selectNthItem(idx); // not sure whether this is needed, taken from previous implementation
+ deleteSingleItem(idx);
+
+ mPendingLookupsRemaining--;
+ }
}
// public
LLScrollListItem* LLNameListCtrl::getNameItemByAgentId(const LLUUID& agent_id)
{
- for (item_list::iterator it = getItemList().begin(); it != getItemList().end(); it++)
- {
- LLScrollListItem* item = *it;
- if (item && item->getUUID() == agent_id)
- {
- return item;
- }
- }
- return NULL;
+ for (item_list::iterator it = getItemList().begin(); it != getItemList().end(); it++)
+ {
+ LLScrollListItem* item = *it;
+ if (item && item->getUUID() == agent_id)
+ {
+ return item;
+ }
+ }
+ return NULL;
}
void LLNameListCtrl::selectItemBySpecialId(const LLUUID& special_id)
@@ -513,110 +513,110 @@ LLUUID LLNameListCtrl::getSelectedSpecialId()
}
void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- std::string suffix,
- std::string prefix,
- LLHandle<LLNameListItem> item)
+ const LLAvatarName& av_name,
+ std::string suffix,
+ std::string prefix,
+ LLHandle<LLNameListItem> item)
{
- avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id);
- if (it != mAvatarNameCacheConnections.end())
- {
- if (it->second.connected())
- {
- it->second.disconnect();
- }
- mAvatarNameCacheConnections.erase(it);
- }
-
- std::string name;
- if (mShortNames)
- name = av_name.getDisplayName();
- else
- name = av_name.getCompleteName();
-
- // Append optional suffix.
- if (!suffix.empty())
- {
- name.append(suffix);
- }
-
- if (!prefix.empty())
- {
- name.insert(0, prefix);
- }
-
- LLNameListItem* list_item = item.get();
- if (list_item && list_item->getUUID() == agent_id)
- {
- LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex);
- if (cell)
- {
- cell->setValue(name);
- setNeedsSort();
- }
- }
-
- //////////////////////////////////////////////////////////////////////////
- // BAKER - FIX NameListCtrl
- //if (mPendingLookupsRemaining <= 0)
- {
- // We might get into a state where mPendingLookupsRemaining might
- // go negative. So just reset it right now and figure out if it's
- // possible later :)
- //mPendingLookupsRemaining = 0;
-
- mNameListCompleteSignal(true);
- }
- //else
- {
- // mPendingLookupsRemaining--;
- }
- //////////////////////////////////////////////////////////////////////////
-
- dirtyColumns();
+ avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id);
+ if (it != mAvatarNameCacheConnections.end())
+ {
+ if (it->second.connected())
+ {
+ it->second.disconnect();
+ }
+ mAvatarNameCacheConnections.erase(it);
+ }
+
+ std::string name;
+ if (mShortNames)
+ name = av_name.getDisplayName();
+ else
+ name = av_name.getCompleteName();
+
+ // Append optional suffix.
+ if (!suffix.empty())
+ {
+ name.append(suffix);
+ }
+
+ if (!prefix.empty())
+ {
+ name.insert(0, prefix);
+ }
+
+ LLNameListItem* list_item = item.get();
+ if (list_item && list_item->getUUID() == agent_id)
+ {
+ LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex);
+ if (cell)
+ {
+ cell->setValue(name);
+ setNeedsSort();
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // BAKER - FIX NameListCtrl
+ //if (mPendingLookupsRemaining <= 0)
+ {
+ // We might get into a state where mPendingLookupsRemaining might
+ // go negative. So just reset it right now and figure out if it's
+ // possible later :)
+ //mPendingLookupsRemaining = 0;
+
+ mNameListCompleteSignal(true);
+ }
+ //else
+ {
+ // mPendingLookupsRemaining--;
+ }
+ //////////////////////////////////////////////////////////////////////////
+
+ dirtyColumns();
}
void LLNameListCtrl::onGroupNameCache(const LLUUID& group_id, const std::string name, LLHandle<LLNameListItem> item)
{
- avatar_name_cache_connection_map_t::iterator it = mGroupNameCacheConnections.find(group_id);
- if (it != mGroupNameCacheConnections.end())
- {
- if (it->second.connected())
- {
- it->second.disconnect();
- }
- mGroupNameCacheConnections.erase(it);
- }
-
- LLNameListItem* list_item = item.get();
- if (list_item && list_item->getUUID() == group_id)
- {
- LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex);
- if (cell)
- {
- cell->setValue(name);
- setNeedsSort();
- }
- }
-
- dirtyColumns();
+ avatar_name_cache_connection_map_t::iterator it = mGroupNameCacheConnections.find(group_id);
+ if (it != mGroupNameCacheConnections.end())
+ {
+ if (it->second.connected())
+ {
+ it->second.disconnect();
+ }
+ mGroupNameCacheConnections.erase(it);
+ }
+
+ LLNameListItem* list_item = item.get();
+ if (list_item && list_item->getUUID() == group_id)
+ {
+ LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex);
+ if (cell)
+ {
+ cell->setValue(name);
+ setNeedsSort();
+ }
+ }
+
+ dirtyColumns();
}
void LLNameListCtrl::updateColumns(bool force_update)
{
- LLScrollListCtrl::updateColumns(force_update);
-
- if (!mNameColumn.empty())
- {
- LLScrollListColumn* name_column = getColumn(mNameColumn);
- if (name_column)
- {
- mNameColumnIndex = name_column->mIndex;
- }
- }
+ LLScrollListCtrl::updateColumns(force_update);
+
+ if (!mNameColumn.empty())
+ {
+ LLScrollListColumn* name_column = getColumn(mNameColumn);
+ if (name_column)
+ {
+ mNameColumnIndex = name_column->mIndex;
+ }
+ }
}
void LLNameListCtrl::sortByName(BOOL ascending)
{
- sortByColumnIndex(mNameColumnIndex,ascending);
+ sortByColumnIndex(mNameColumnIndex,ascending);
}
diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h
index 4a4bd4ba09..111b8d1077 100644
--- a/indra/newview/llnamelistctrl.h
+++ b/indra/newview/llnamelistctrl.h
@@ -42,143 +42,143 @@ class LLAvatarName;
class LLNameListItem : public LLScrollListItem, public LLHandleProvider<LLNameListItem>
{
public:
- bool isGroup() const { return mIsGroup; }
- void setIsGroup(bool is_group) { mIsGroup = is_group; }
- bool isExperience() const { return mIsExperience; }
- void setIsExperience(bool is_experience) { mIsExperience = is_experience; }
+ bool isGroup() const { return mIsGroup; }
+ void setIsGroup(bool is_group) { mIsGroup = is_group; }
+ bool isExperience() const { return mIsExperience; }
+ void setIsExperience(bool is_experience) { mIsExperience = is_experience; }
void setSpecialID(const LLUUID& special_id) { mSpecialID = special_id; }
const LLUUID& getSpecialID() const { return mSpecialID; }
protected:
- friend class LLNameListCtrl;
+ friend class LLNameListCtrl;
- LLNameListItem( const LLScrollListItem::Params& p )
- : LLScrollListItem(p), mIsGroup(false), mIsExperience(false)
- {
- }
+ LLNameListItem( const LLScrollListItem::Params& p )
+ : LLScrollListItem(p), mIsGroup(false), mIsExperience(false)
+ {
+ }
- LLNameListItem( const LLScrollListItem::Params& p, bool is_group )
- : LLScrollListItem(p), mIsGroup(is_group), mIsExperience(false)
- {
- }
+ LLNameListItem( const LLScrollListItem::Params& p, bool is_group )
+ : LLScrollListItem(p), mIsGroup(is_group), mIsExperience(false)
+ {
+ }
- LLNameListItem( const LLScrollListItem::Params& p, bool is_group, bool is_experience )
- : LLScrollListItem(p), mIsGroup(is_group), mIsExperience(is_experience)
- {
- }
+ LLNameListItem( const LLScrollListItem::Params& p, bool is_group, bool is_experience )
+ : LLScrollListItem(p), mIsGroup(is_group), mIsExperience(is_experience)
+ {
+ }
private:
- bool mIsGroup;
- bool mIsExperience;
+ bool mIsGroup;
+ bool mIsExperience;
LLUUID mSpecialID;
};
class LLNameListCtrl
-: public LLScrollListCtrl, public LLInstanceTracker<LLNameListCtrl>
+: public LLScrollListCtrl, public LLInstanceTracker<LLNameListCtrl>
{
public:
- typedef boost::signals2::signal<void(bool)> namelist_complete_signal_t;
-
- typedef enum e_name_type
- {
- INDIVIDUAL,
- GROUP,
- SPECIAL,
- EXPERIENCE
- } ENameType;
-
- // provide names for enums
- struct NameTypeNames : public LLInitParam::TypeValuesHelper<LLNameListCtrl::ENameType, NameTypeNames>
- {
- static void declareValues();
- };
-
- struct NameItem : public LLInitParam::Block<NameItem, LLScrollListItem::Params>
- {
- Optional<std::string> name;
- Optional<ENameType, NameTypeNames> target;
+ typedef boost::signals2::signal<void(bool)> namelist_complete_signal_t;
+
+ typedef enum e_name_type
+ {
+ INDIVIDUAL,
+ GROUP,
+ SPECIAL,
+ EXPERIENCE
+ } ENameType;
+
+ // provide names for enums
+ struct NameTypeNames : public LLInitParam::TypeValuesHelper<LLNameListCtrl::ENameType, NameTypeNames>
+ {
+ static void declareValues();
+ };
+
+ struct NameItem : public LLInitParam::Block<NameItem, LLScrollListItem::Params>
+ {
+ Optional<std::string> name;
+ Optional<ENameType, NameTypeNames> target;
Optional<LLUUID> special_id;
- NameItem()
- : name("name"),
- target("target", INDIVIDUAL),
+ NameItem()
+ : name("name"),
+ target("target", INDIVIDUAL),
special_id("special_id", LLUUID())
- {}
- };
-
- struct NameColumn : public LLInitParam::ChoiceBlock<NameColumn>
- {
- Alternative<S32> column_index;
- Alternative<std::string> column_name;
- NameColumn()
- : column_name("name_column"),
- column_index("name_column_index", 0)
- {}
- };
-
- struct Params : public LLInitParam::Block<Params, LLScrollListCtrl::Params>
- {
- Optional<NameColumn> name_column;
- Optional<bool> allow_calling_card_drop;
- Optional<bool> short_names;
- Params();
- };
+ {}
+ };
+
+ struct NameColumn : public LLInitParam::ChoiceBlock<NameColumn>
+ {
+ Alternative<S32> column_index;
+ Alternative<std::string> column_name;
+ NameColumn()
+ : column_name("name_column"),
+ column_index("name_column_index", 0)
+ {}
+ };
+
+ struct Params : public LLInitParam::Block<Params, LLScrollListCtrl::Params>
+ {
+ Optional<NameColumn> name_column;
+ Optional<bool> allow_calling_card_drop;
+ Optional<bool> short_names;
+ Params();
+ };
protected:
- LLNameListCtrl(const Params&);
- virtual ~LLNameListCtrl()
- {
- for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it)
- {
- if (it->second.connected())
- {
- it->second.disconnect();
- }
- }
- mAvatarNameCacheConnections.clear();
- }
- friend class LLUICtrlFactory;
+ LLNameListCtrl(const Params&);
+ virtual ~LLNameListCtrl()
+ {
+ for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it)
+ {
+ if (it->second.connected())
+ {
+ it->second.disconnect();
+ }
+ }
+ mAvatarNameCacheConnections.clear();
+ }
+ friend class LLUICtrlFactory;
public:
- // Add a user to the list by name. It will be added, the name
- // requested from the cache, and updated as necessary.
- LLScrollListItem* addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM,
- BOOL enabled = TRUE, const std::string& suffix = LLStringUtil::null, const std::string& prefix = LLStringUtil::null);
- LLScrollListItem* addNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM);
+ // Add a user to the list by name. It will be added, the name
+ // requested from the cache, and updated as necessary.
+ LLScrollListItem* addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM,
+ BOOL enabled = TRUE, const std::string& suffix = LLStringUtil::null, const std::string& prefix = LLStringUtil::null);
+ LLScrollListItem* addNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM);
- /*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
- LLScrollListItem* addNameItemRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM, const std::string& suffix = LLStringUtil::null,
- const std::string& prefix = LLStringUtil::null);
+ /*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
+ LLScrollListItem* addNameItemRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM, const std::string& suffix = LLStringUtil::null,
+ const std::string& prefix = LLStringUtil::null);
- // Add a user to the list by name. It will be added, the name
- // requested from the cache, and updated as necessary.
- void addGroupNameItem(const LLUUID& group_id, EAddPosition pos = ADD_BOTTOM,
- BOOL enabled = TRUE);
- void addGroupNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM);
+ // Add a user to the list by name. It will be added, the name
+ // requested from the cache, and updated as necessary.
+ void addGroupNameItem(const LLUUID& group_id, EAddPosition pos = ADD_BOTTOM,
+ BOOL enabled = TRUE);
+ void addGroupNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM);
- void removeNameItem(const LLUUID& agent_id);
+ void removeNameItem(const LLUUID& agent_id);
- LLScrollListItem* getNameItemByAgentId(const LLUUID& agent_id);
+ LLScrollListItem* getNameItemByAgentId(const LLUUID& agent_id);
void selectItemBySpecialId(const LLUUID& special_id);
LLUUID getSelectedSpecialId();
- // LLView interface
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg);
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ // LLView interface
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
+ BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
+ EAcceptance *accept,
+ std::string& tooltip_msg);
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
- void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; }
+ void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; }
- void sortByName(BOOL ascending);
+ void sortByName(BOOL ascending);
- /*virtual*/ void updateColumns(bool force_update);
+ /*virtual*/ void updateColumns(bool force_update);
- /*virtual*/ void mouseOverHighlightNthItem( S32 index );
+ /*virtual*/ void mouseOverHighlightNthItem( S32 index );
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
@@ -188,36 +188,36 @@ public:
void setHoverIconName(std::string icon_name) { mHoverIconName = icon_name; }
private:
- void showInspector(const LLUUID& avatar_id, bool is_group, bool is_experience = false);
- void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, std::string suffix, std::string prefix, LLHandle<LLNameListItem> item);
- void onGroupNameCache(const LLUUID& group_id, const std::string name, LLHandle<LLNameListItem> item);
+ void showInspector(const LLUUID& avatar_id, bool is_group, bool is_experience = false);
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, std::string suffix, std::string prefix, LLHandle<LLNameListItem> item);
+ void onGroupNameCache(const LLUUID& group_id, const std::string name, LLHandle<LLNameListItem> item);
private:
- S32 mNameColumnIndex;
- std::string mNameColumn;
- BOOL mAllowCallingCardDrop;
- bool mShortNames; // display name only, no SLID
- typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
- avatar_name_cache_connection_map_t mAvatarNameCacheConnections;
- avatar_name_cache_connection_map_t mGroupNameCacheConnections;
+ S32 mNameColumnIndex;
+ std::string mNameColumn;
+ BOOL mAllowCallingCardDrop;
+ bool mShortNames; // display name only, no SLID
+ typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
+ avatar_name_cache_connection_map_t mAvatarNameCacheConnections;
+ avatar_name_cache_connection_map_t mGroupNameCacheConnections;
- S32 mPendingLookupsRemaining;
- namelist_complete_signal_t mNameListCompleteSignal;
+ S32 mPendingLookupsRemaining;
+ namelist_complete_signal_t mNameListCompleteSignal;
std::string mHoverIconName;
e_name_type mNameListType;
boost::signals2::signal<void(const LLUUID &)> mIconClickedSignal;
-
+
public:
- boost::signals2::connection setOnNameListCompleteCallback(boost::function<void(bool)> onNameListCompleteCallback)
- {
- return mNameListCompleteSignal.connect(onNameListCompleteCallback);
- }
-
- boost::signals2::connection setIconClickedCallback(boost::function<void(const LLUUID &)> cb)
- {
- return mIconClickedSignal.connect(cb);
+ boost::signals2::connection setOnNameListCompleteCallback(boost::function<void(bool)> onNameListCompleteCallback)
+ {
+ return mNameListCompleteSignal.connect(onNameListCompleteCallback);
+ }
+
+ boost::signals2::connection setIconClickedCallback(boost::function<void(const LLUUID &)> cb)
+ {
+ return mIconClickedSignal.connect(cb);
}
};
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index f5ee1171d9..67dbd57745 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnavigationbar.cpp
* @brief Navigation bar implementation
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -70,190 +70,190 @@
//-- LLTeleportHistoryMenuItem -----------------------------------------------
/**
- * Item look varies depending on the type (backward/current/forward).
+ * Item look varies depending on the type (backward/current/forward).
*/
class LLTeleportHistoryMenuItem : public LLMenuItemCallGL
{
public:
- typedef enum e_item_type
- {
- TYPE_BACKWARD,
- TYPE_CURRENT,
- TYPE_FORWARD,
- } EType;
-
- struct Params : public LLInitParam::Block<Params, LLMenuItemCallGL::Params>
- {
- Mandatory<EType> item_type;
- Optional<const LLFontGL*> back_item_font,
- current_item_font,
- forward_item_font;
- Optional<std::string> back_item_image,
- forward_item_image;
- Optional<S32> image_hpad,
- image_vpad;
- Params()
- : item_type(),
- back_item_font("back_item_font"),
- current_item_font("current_item_font"),
- forward_item_font("forward_item_font"),
- back_item_image("back_item_image"),
- forward_item_image("forward_item_image"),
- image_hpad("image_hpad"),
- image_vpad("image_vpad")
- {}
- };
-
- /*virtual*/ void draw();
- /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
- /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
+ typedef enum e_item_type
+ {
+ TYPE_BACKWARD,
+ TYPE_CURRENT,
+ TYPE_FORWARD,
+ } EType;
+
+ struct Params : public LLInitParam::Block<Params, LLMenuItemCallGL::Params>
+ {
+ Mandatory<EType> item_type;
+ Optional<const LLFontGL*> back_item_font,
+ current_item_font,
+ forward_item_font;
+ Optional<std::string> back_item_image,
+ forward_item_image;
+ Optional<S32> image_hpad,
+ image_vpad;
+ Params()
+ : item_type(),
+ back_item_font("back_item_font"),
+ current_item_font("current_item_font"),
+ forward_item_font("forward_item_font"),
+ back_item_image("back_item_image"),
+ forward_item_image("forward_item_image"),
+ image_hpad("image_hpad"),
+ image_vpad("image_vpad")
+ {}
+ };
+
+ /*virtual*/ void draw();
+ /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
+ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
private:
- LLTeleportHistoryMenuItem(const Params&);
- friend class LLUICtrlFactory;
+ LLTeleportHistoryMenuItem(const Params&);
+ friend class LLUICtrlFactory;
- static const S32 ICON_WIDTH = 16;
- static const S32 ICON_HEIGHT = 16;
+ static const S32 ICON_WIDTH = 16;
+ static const S32 ICON_HEIGHT = 16;
- LLIconCtrl* mArrowIcon;
+ LLIconCtrl* mArrowIcon;
};
static LLDefaultChildRegistry::Register<LLTeleportHistoryMenuItem> r("teleport_history_menu_item");
LLTeleportHistoryMenuItem::LLTeleportHistoryMenuItem(const Params& p)
-: LLMenuItemCallGL(p),
- mArrowIcon(NULL)
-{
- // Set appearance depending on the item type.
- if (p.item_type == TYPE_BACKWARD)
- {
- setFont( p.back_item_font );
- }
- else if (p.item_type == TYPE_CURRENT)
- {
- setFont( p.current_item_font );
- }
- else
- {
- setFont( p.forward_item_font );
- }
-
- LLIconCtrl::Params icon_params;
- icon_params.name("icon");
- LLRect rect(0, ICON_HEIGHT, ICON_WIDTH, 0);
- rect.translate( p.image_hpad, p.image_vpad );
- icon_params.rect( rect );
- icon_params.mouse_opaque(false);
- icon_params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP);
- icon_params.visible(false);
-
- mArrowIcon = LLUICtrlFactory::create<LLIconCtrl> (icon_params);
-
- // no image for the current item
- if (p.item_type == TYPE_BACKWARD)
- mArrowIcon->setValue( p.back_item_image() );
- else if (p.item_type == TYPE_FORWARD)
- mArrowIcon->setValue( p.forward_item_image() );
-
- addChild(mArrowIcon);
+: LLMenuItemCallGL(p),
+ mArrowIcon(NULL)
+{
+ // Set appearance depending on the item type.
+ if (p.item_type == TYPE_BACKWARD)
+ {
+ setFont( p.back_item_font );
+ }
+ else if (p.item_type == TYPE_CURRENT)
+ {
+ setFont( p.current_item_font );
+ }
+ else
+ {
+ setFont( p.forward_item_font );
+ }
+
+ LLIconCtrl::Params icon_params;
+ icon_params.name("icon");
+ LLRect rect(0, ICON_HEIGHT, ICON_WIDTH, 0);
+ rect.translate( p.image_hpad, p.image_vpad );
+ icon_params.rect( rect );
+ icon_params.mouse_opaque(false);
+ icon_params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP);
+ icon_params.visible(false);
+
+ mArrowIcon = LLUICtrlFactory::create<LLIconCtrl> (icon_params);
+
+ // no image for the current item
+ if (p.item_type == TYPE_BACKWARD)
+ mArrowIcon->setValue( p.back_item_image() );
+ else if (p.item_type == TYPE_FORWARD)
+ mArrowIcon->setValue( p.forward_item_image() );
+
+ addChild(mArrowIcon);
}
void LLTeleportHistoryMenuItem::draw()
{
- // Draw menu item itself.
- LLMenuItemCallGL::draw();
+ // Draw menu item itself.
+ LLMenuItemCallGL::draw();
- // Draw children if any. *TODO: move this to LLMenuItemGL?
- LLUICtrl::draw();
+ // Draw children if any. *TODO: move this to LLMenuItemGL?
+ LLUICtrl::draw();
}
void LLTeleportHistoryMenuItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
- mArrowIcon->setVisible(TRUE);
+ mArrowIcon->setVisible(TRUE);
}
void LLTeleportHistoryMenuItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
- mArrowIcon->setVisible(FALSE);
+ mArrowIcon->setVisible(FALSE);
}
static LLDefaultChildRegistry::Register<LLPullButton> menu_button("pull_button");
LLPullButton::LLPullButton(const LLPullButton::Params& params) :
- LLButton(params)
+ LLButton(params)
{
- setDirectionFromName(params.direction);
+ setDirectionFromName(params.direction);
}
boost::signals2::connection LLPullButton::setClickDraggingCallback(const commit_signal_t::slot_type& cb)
{
- return mClickDraggingSignal.connect(cb);
+ return mClickDraggingSignal.connect(cb);
}
/*virtual*/
void LLPullButton::onMouseLeave(S32 x, S32 y, MASK mask)
{
- LLButton::onMouseLeave(x, y, mask);
+ LLButton::onMouseLeave(x, y, mask);
- if (mMouseDownTimer.getStarted()) //an user have done a mouse down, if the timer started. see LLButton::handleMouseDown for details
- {
- const LLVector2 cursor_direction = LLVector2(F32(x), F32(y)) - mLastMouseDown;
- /* For now cursor_direction points to the direction of mouse movement
- * Need to decide whether should we fire a signal.
- * We fire if angle between mDraggingDirection and cursor_direction is less that 45 degree
- * Note:
- * 0.5 * F_PI_BY_TWO equals to PI/4 radian that equals to angle of 45 degrees
- */
- if (angle_between(mDraggingDirection, cursor_direction) < 0.5 * F_PI_BY_TWO)//call if angle < pi/4
- {
- mClickDraggingSignal(this, LLSD());
- }
- }
+ if (mMouseDownTimer.getStarted()) //an user have done a mouse down, if the timer started. see LLButton::handleMouseDown for details
+ {
+ const LLVector2 cursor_direction = LLVector2(F32(x), F32(y)) - mLastMouseDown;
+ /* For now cursor_direction points to the direction of mouse movement
+ * Need to decide whether should we fire a signal.
+ * We fire if angle between mDraggingDirection and cursor_direction is less that 45 degree
+ * Note:
+ * 0.5 * F_PI_BY_TWO equals to PI/4 radian that equals to angle of 45 degrees
+ */
+ if (angle_between(mDraggingDirection, cursor_direction) < 0.5 * F_PI_BY_TWO)//call if angle < pi/4
+ {
+ mClickDraggingSignal(this, LLSD());
+ }
+ }
}
/*virtual*/
BOOL LLPullButton::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLButton::handleMouseDown(x, y, mask);
- if (handled)
- {
- //if mouse down was handled by button,
- //capture mouse position to calculate the direction of mouse move after mouseLeave event
- mLastMouseDown.set(F32(x), F32(y));
- }
- return handled;
+ BOOL handled = LLButton::handleMouseDown(x, y, mask);
+ if (handled)
+ {
+ //if mouse down was handled by button,
+ //capture mouse position to calculate the direction of mouse move after mouseLeave event
+ mLastMouseDown.set(F32(x), F32(y));
+ }
+ return handled;
}
/*virtual*/
BOOL LLPullButton::handleMouseUp(S32 x, S32 y, MASK mask)
{
- // reset data to get ready for next circle
- mLastMouseDown.clear();
- return LLButton::handleMouseUp(x, y, mask);
+ // reset data to get ready for next circle
+ mLastMouseDown.clear();
+ return LLButton::handleMouseUp(x, y, mask);
}
/**
- * this function is setting up dragging direction vector.
- * Last one is just unit vector. It points to direction of mouse drag that we need to handle
+ * this function is setting up dragging direction vector.
+ * Last one is just unit vector. It points to direction of mouse drag that we need to handle
*/
void LLPullButton::setDirectionFromName(const std::string& name)
{
- if (name == "left")
- {
- mDraggingDirection.set(F32(-1), F32(0));
- }
- else if (name == "right")
- {
- mDraggingDirection.set(F32(0), F32(1));
- }
- else if (name == "down")
- {
- mDraggingDirection.set(F32(0), F32(-1));
- }
- else if (name == "up")
- {
- mDraggingDirection.set(F32(0), F32(1));
- }
+ if (name == "left")
+ {
+ mDraggingDirection.set(F32(-1), F32(0));
+ }
+ else if (name == "right")
+ {
+ mDraggingDirection.set(F32(0), F32(1));
+ }
+ else if (name == "down")
+ {
+ mDraggingDirection.set(F32(0), F32(-1));
+ }
+ else if (name == "up")
+ {
+ mDraggingDirection.set(F32(0), F32(1));
+ }
}
//-- LNavigationBar ----------------------------------------------------------
@@ -264,415 +264,415 @@ TODO:
*/
LLNavigationBar::LLNavigationBar()
-: mTeleportHistoryMenu(NULL),
- mBtnBack(NULL),
- mBtnForward(NULL),
- mBtnHome(NULL),
- mCmbLocation(NULL),
- mSaveToLocationHistory(false),
- mNavigationPanel(NULL),
- mFavoritePanel(NULL),
- mNavPanWidth(0)
+: mTeleportHistoryMenu(NULL),
+ mBtnBack(NULL),
+ mBtnForward(NULL),
+ mBtnHome(NULL),
+ mCmbLocation(NULL),
+ mSaveToLocationHistory(false),
+ mNavigationPanel(NULL),
+ mFavoritePanel(NULL),
+ mNavPanWidth(0)
{
- buildFromFile( "panel_navigation_bar.xml");
+ buildFromFile( "panel_navigation_bar.xml");
- // set a listener function for LoginComplete event
- LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLNavigationBar::handleLoginComplete, this));
+ // set a listener function for LoginComplete event
+ LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLNavigationBar::handleLoginComplete, this));
}
LLNavigationBar::~LLNavigationBar()
{
- mTeleportFinishConnection.disconnect();
- mTeleportFailedConnection.disconnect();
+ mTeleportFinishConnection.disconnect();
+ mTeleportFailedConnection.disconnect();
}
BOOL LLNavigationBar::postBuild()
{
- mBtnBack = getChild<LLPullButton>("back_btn");
- mBtnForward = getChild<LLPullButton>("forward_btn");
- mBtnHome = getChild<LLButton>("home_btn");
- mBtnLandmarks = getChild<LLButton>("landmarks_btn");
+ mBtnBack = getChild<LLPullButton>("back_btn");
+ mBtnForward = getChild<LLPullButton>("forward_btn");
+ mBtnHome = getChild<LLButton>("home_btn");
+ mBtnLandmarks = getChild<LLButton>("landmarks_btn");
+
+ mCmbLocation= getChild<LLLocationInputCtrl>("location_combo");
- mCmbLocation= getChild<LLLocationInputCtrl>("location_combo");
+ mBtnBack->setEnabled(FALSE);
+ mBtnBack->setClickedCallback(boost::bind(&LLNavigationBar::onBackButtonClicked, this));
+ mBtnBack->setHeldDownCallback(boost::bind(&LLNavigationBar::onBackOrForwardButtonHeldDown, this,_1, _2));
+ mBtnBack->setClickDraggingCallback(boost::bind(&LLNavigationBar::showTeleportHistoryMenu, this,_1));
- mBtnBack->setEnabled(FALSE);
- mBtnBack->setClickedCallback(boost::bind(&LLNavigationBar::onBackButtonClicked, this));
- mBtnBack->setHeldDownCallback(boost::bind(&LLNavigationBar::onBackOrForwardButtonHeldDown, this,_1, _2));
- mBtnBack->setClickDraggingCallback(boost::bind(&LLNavigationBar::showTeleportHistoryMenu, this,_1));
-
- mBtnForward->setEnabled(FALSE);
- mBtnForward->setClickedCallback(boost::bind(&LLNavigationBar::onForwardButtonClicked, this));
- mBtnForward->setHeldDownCallback(boost::bind(&LLNavigationBar::onBackOrForwardButtonHeldDown, this, _1, _2));
- mBtnForward->setClickDraggingCallback(boost::bind(&LLNavigationBar::showTeleportHistoryMenu, this,_1));
+ mBtnForward->setEnabled(FALSE);
+ mBtnForward->setClickedCallback(boost::bind(&LLNavigationBar::onForwardButtonClicked, this));
+ mBtnForward->setHeldDownCallback(boost::bind(&LLNavigationBar::onBackOrForwardButtonHeldDown, this, _1, _2));
+ mBtnForward->setClickDraggingCallback(boost::bind(&LLNavigationBar::showTeleportHistoryMenu, this,_1));
- mBtnHome->setClickedCallback(boost::bind(&LLNavigationBar::onHomeButtonClicked, this));
+ mBtnHome->setClickedCallback(boost::bind(&LLNavigationBar::onHomeButtonClicked, this));
- mBtnLandmarks->setClickedCallback(boost::bind(&LLNavigationBar::onLandmarksButtonClicked, this));
+ mBtnLandmarks->setClickedCallback(boost::bind(&LLNavigationBar::onLandmarksButtonClicked, this));
- mCmbLocation->setCommitCallback(boost::bind(&LLNavigationBar::onLocationSelection, this));
+ mCmbLocation->setCommitCallback(boost::bind(&LLNavigationBar::onLocationSelection, this));
- mTeleportFinishConnection = LLViewerParcelMgr::getInstance()->
- setTeleportFinishedCallback(boost::bind(&LLNavigationBar::onTeleportFinished, this, _1));
+ mTeleportFinishConnection = LLViewerParcelMgr::getInstance()->
+ setTeleportFinishedCallback(boost::bind(&LLNavigationBar::onTeleportFinished, this, _1));
- mTeleportFailedConnection = LLViewerParcelMgr::getInstance()->
- setTeleportFailedCallback(boost::bind(&LLNavigationBar::onTeleportFailed, this));
-
- mDefaultNbRect = getRect();
- mDefaultFpRect = getChild<LLFavoritesBarCtrl>("favorite")->getRect();
+ mTeleportFailedConnection = LLViewerParcelMgr::getInstance()->
+ setTeleportFailedCallback(boost::bind(&LLNavigationBar::onTeleportFailed, this));
- // we'll be notified on teleport history changes
- LLTeleportHistory::getInstance()->setHistoryChangedCallback(
- boost::bind(&LLNavigationBar::onTeleportHistoryChanged, this));
+ mDefaultNbRect = getRect();
+ mDefaultFpRect = getChild<LLFavoritesBarCtrl>("favorite")->getRect();
- LLHints::getInstance()->registerHintTarget("nav_bar", getHandle());
+ // we'll be notified on teleport history changes
+ LLTeleportHistory::getInstance()->setHistoryChangedCallback(
+ boost::bind(&LLNavigationBar::onTeleportHistoryChanged, this));
- mNavigationPanel = getChild<LLLayoutPanel>("navigation_layout_panel");
- mFavoritePanel = getChild<LLLayoutPanel>("favorites_layout_panel");
- mNavigationPanel->getResizeBar()->setResizeListener(boost::bind(&LLNavigationBar::onNavbarResized, this));
- mFavoritePanel->getResizeBar()->setResizeListener(boost::bind(&LLNavigationBar::onNavbarResized, this));
+ LLHints::getInstance()->registerHintTarget("nav_bar", getHandle());
- return TRUE;
+ mNavigationPanel = getChild<LLLayoutPanel>("navigation_layout_panel");
+ mFavoritePanel = getChild<LLLayoutPanel>("favorites_layout_panel");
+ mNavigationPanel->getResizeBar()->setResizeListener(boost::bind(&LLNavigationBar::onNavbarResized, this));
+ mFavoritePanel->getResizeBar()->setResizeListener(boost::bind(&LLNavigationBar::onNavbarResized, this));
+
+ return TRUE;
}
void LLNavigationBar::setVisible(BOOL visible)
{
- // change visibility of grandparent layout_panel to animate in and out
- if (getParent())
- {
- //to avoid some mysterious bugs like EXT-3352, at least try to log an incorrect parent to ping about a problem.
- if(getParent()->getName() != "nav_bar_container")
- {
- LL_WARNS("LLNavigationBar")<<"NavigationBar has an unknown name of the parent: "<<getParent()->getName()<< LL_ENDL;
- }
- getParent()->setVisible(visible);
- }
+ // change visibility of grandparent layout_panel to animate in and out
+ if (getParent())
+ {
+ //to avoid some mysterious bugs like EXT-3352, at least try to log an incorrect parent to ping about a problem.
+ if(getParent()->getName() != "nav_bar_container")
+ {
+ LL_WARNS("LLNavigationBar")<<"NavigationBar has an unknown name of the parent: "<<getParent()->getName()<< LL_ENDL;
+ }
+ getParent()->setVisible(visible);
+ }
}
void LLNavigationBar::draw()
{
- if (isBackgroundVisible())
- {
- static LLUICachedControl<S32> drop_shadow_floater ("DropShadowFloater", 0);
- static LLUIColor color_drop_shadow = LLUIColorTable::instance().getColor("ColorDropShadow");
- gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
+ if (isBackgroundVisible())
+ {
+ static LLUICachedControl<S32> drop_shadow_floater ("DropShadowFloater", 0);
+ static LLUIColor color_drop_shadow = LLUIColorTable::instance().getColor("ColorDropShadow");
+ gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
color_drop_shadow, drop_shadow_floater );
- }
+ }
- LLPanel::draw();
+ LLPanel::draw();
}
BOOL LLNavigationBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = childrenHandleRightMouseDown( x, y, mask) != NULL;
- if(!handled && !gMenuHolder->hasVisibleMenu())
- {
- show_navbar_context_menu(this,x,y);
- handled = true;
- }
- return handled;
+ BOOL handled = childrenHandleRightMouseDown( x, y, mask) != NULL;
+ if(!handled && !gMenuHolder->hasVisibleMenu())
+ {
+ show_navbar_context_menu(this,x,y);
+ handled = true;
+ }
+ return handled;
}
void LLNavigationBar::onBackButtonClicked()
{
- LLTeleportHistory::getInstance()->goBack();
+ LLTeleportHistory::getInstance()->goBack();
}
void LLNavigationBar::onNavbarResized()
{
- S32 new_nav_pan_width = mNavigationPanel->getRect().getWidth();
- if(mNavPanWidth != new_nav_pan_width)
- {
- S32 new_stack_width = new_nav_pan_width + mFavoritePanel->getRect().getWidth();
- F32 ratio = (F32)new_nav_pan_width / (F32)new_stack_width;
- gSavedPerAccountSettings.setF32("NavigationBarRatio", ratio);
- mNavPanWidth = new_nav_pan_width;
- }
+ S32 new_nav_pan_width = mNavigationPanel->getRect().getWidth();
+ if(mNavPanWidth != new_nav_pan_width)
+ {
+ S32 new_stack_width = new_nav_pan_width + mFavoritePanel->getRect().getWidth();
+ F32 ratio = (F32)new_nav_pan_width / (F32)new_stack_width;
+ gSavedPerAccountSettings.setF32("NavigationBarRatio", ratio);
+ mNavPanWidth = new_nav_pan_width;
+ }
}
void LLNavigationBar::onBackOrForwardButtonHeldDown(LLUICtrl* ctrl, const LLSD& param)
{
- if (param["count"].asInteger() == 0)
- showTeleportHistoryMenu(ctrl);
+ if (param["count"].asInteger() == 0)
+ showTeleportHistoryMenu(ctrl);
}
void LLNavigationBar::onForwardButtonClicked()
{
- LLTeleportHistory::getInstance()->goForward();
+ LLTeleportHistory::getInstance()->goForward();
}
void LLNavigationBar::onHomeButtonClicked()
{
- gAgent.teleportHome();
+ gAgent.teleportHome();
}
void LLNavigationBar::onLandmarksButtonClicked()
{
- LLFloaterReg::toggleInstanceOrBringToFront("places");
- LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "open_landmark_tab"));
+ LLFloaterReg::toggleInstanceOrBringToFront("places");
+ LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "open_landmark_tab"));
}
void LLNavigationBar::onTeleportHistoryMenuItemClicked(const LLSD& userdata)
{
- int idx = userdata.asInteger();
- LLTeleportHistory::getInstance()->goToItem(idx);
+ int idx = userdata.asInteger();
+ LLTeleportHistory::getInstance()->goToItem(idx);
}
// This is called when user presses enter in the location input
// or selects a location from the typed locations dropdown.
void LLNavigationBar::onLocationSelection()
{
- std::string typed_location = mCmbLocation->getSimple();
- LLStringUtil::trim(typed_location);
-
- // Will not teleport to empty location.
- if (typed_location.empty())
- return;
- //get selected item from combobox item
- LLSD value = mCmbLocation->getSelectedValue();
- if(value.isUndefined() && !mCmbLocation->getTextEntry()->isDirty())
- {
- // At this point we know that: there is no selected item in list and text field has NOT been changed
- // So there is no sense to try to change the location
- return;
- }
- /* since navbar list support autocompletion it contains several types of item: landmark, teleport hystory item,
- * typed by user slurl or region name. Let's find out which type of item the user has selected
- * to make decision about adding this location into typed history. see mSaveToLocationHistory
- * Note:
- * Only TYPED_REGION_SLURL item will be added into LLLocationHistory
- */
-
- if(value.has("item_type"))
- {
-
- switch(value["item_type"].asInteger())
- {
- case LANDMARK:
-
- if(value.has("AssetUUID"))
- {
- gAgent.teleportViaLandmark( LLUUID(value["AssetUUID"].asString()));
+ std::string typed_location = mCmbLocation->getSimple();
+ LLStringUtil::trim(typed_location);
+
+ // Will not teleport to empty location.
+ if (typed_location.empty())
+ return;
+ //get selected item from combobox item
+ LLSD value = mCmbLocation->getSelectedValue();
+ if(value.isUndefined() && !mCmbLocation->getTextEntry()->isDirty())
+ {
+ // At this point we know that: there is no selected item in list and text field has NOT been changed
+ // So there is no sense to try to change the location
+ return;
+ }
+ /* since navbar list support autocompletion it contains several types of item: landmark, teleport hystory item,
+ * typed by user slurl or region name. Let's find out which type of item the user has selected
+ * to make decision about adding this location into typed history. see mSaveToLocationHistory
+ * Note:
+ * Only TYPED_REGION_SLURL item will be added into LLLocationHistory
+ */
+
+ if(value.has("item_type"))
+ {
+
+ switch(value["item_type"].asInteger())
+ {
+ case LANDMARK:
+
+ if(value.has("AssetUUID"))
+ {
+ gAgent.teleportViaLandmark( LLUUID(value["AssetUUID"].asString()));
// user teleported by manually inputting inventory landmark's name
- mSaveToLocationHistory = false;
- return;
- }
- else
- {
- LLInventoryModel::item_array_t landmark_items =
- LLLandmarkActions::fetchLandmarksByName(typed_location,
- FALSE);
- if (!landmark_items.empty())
- {
- gAgent.teleportViaLandmark( landmark_items[0]->getAssetUUID());
- mSaveToLocationHistory = true;
- return;
- }
- }
- break;
-
- case TELEPORT_HISTORY:
- //in case of teleport item was selected, teleport by position too.
- case TYPED_REGION_SLURL:
- if(value.has("global_pos"))
- {
- gAgent.teleportViaLocation(LLVector3d(value["global_pos"]));
- return;
- }
- break;
-
- default:
- break;
- }
- }
- //Let's parse slurl or region name
-
- std::string region_name;
- LLVector3 local_coords(128, 128, 0);
- // Is the typed location a SLURL?
- LLSLURL slurl = LLSLURL(typed_location);
- if (slurl.getType() == LLSLURL::LOCATION)
- {
- region_name = slurl.getRegion();
- local_coords = slurl.getPosition();
- }
- else if(!slurl.isValid())
- {
- // we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too
- // but we need to know whether typed_location is a simple http url.
- if (LLUrlRegistry::instance().isUrl(typed_location))
- {
- // display http:// URLs in the media browser, or
- // anything else is sent to the search floater
- LLWeb::loadURL(typed_location);
- return;
- }
- else
- {
- // assume that an user has typed the {region name} or possible {region_name, parcel}
- region_name = typed_location.substr(0,typed_location.find(','));
- }
- }
- else
- {
- // was an app slurl, home, whatever. Bail
- return;
- }
-
- // Resolve the region name to its global coordinates.
- // If resolution succeeds we'll teleport.
- LLWorldMapMessage::url_callback_t cb = boost::bind(
- &LLNavigationBar::onRegionNameResponse, this,
- typed_location, region_name, local_coords, _1, _2, _3, _4);
- mSaveToLocationHistory = true;
- LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name, cb, std::string("unused"), false);
+ mSaveToLocationHistory = false;
+ return;
+ }
+ else
+ {
+ LLInventoryModel::item_array_t landmark_items =
+ LLLandmarkActions::fetchLandmarksByName(typed_location,
+ FALSE);
+ if (!landmark_items.empty())
+ {
+ gAgent.teleportViaLandmark( landmark_items[0]->getAssetUUID());
+ mSaveToLocationHistory = true;
+ return;
+ }
+ }
+ break;
+
+ case TELEPORT_HISTORY:
+ //in case of teleport item was selected, teleport by position too.
+ case TYPED_REGION_SLURL:
+ if(value.has("global_pos"))
+ {
+ gAgent.teleportViaLocation(LLVector3d(value["global_pos"]));
+ return;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ //Let's parse slurl or region name
+
+ std::string region_name;
+ LLVector3 local_coords(128, 128, 0);
+ // Is the typed location a SLURL?
+ LLSLURL slurl = LLSLURL(typed_location);
+ if (slurl.getType() == LLSLURL::LOCATION)
+ {
+ region_name = slurl.getRegion();
+ local_coords = slurl.getPosition();
+ }
+ else if(!slurl.isValid())
+ {
+ // we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too
+ // but we need to know whether typed_location is a simple http url.
+ if (LLUrlRegistry::instance().isUrl(typed_location))
+ {
+ // display http:// URLs in the media browser, or
+ // anything else is sent to the search floater
+ LLWeb::loadURL(typed_location);
+ return;
+ }
+ else
+ {
+ // assume that an user has typed the {region name} or possible {region_name, parcel}
+ region_name = typed_location.substr(0,typed_location.find(','));
+ }
+ }
+ else
+ {
+ // was an app slurl, home, whatever. Bail
+ return;
+ }
+
+ // Resolve the region name to its global coordinates.
+ // If resolution succeeds we'll teleport.
+ LLWorldMapMessage::url_callback_t cb = boost::bind(
+ &LLNavigationBar::onRegionNameResponse, this,
+ typed_location, region_name, local_coords, _1, _2, _3, _4);
+ mSaveToLocationHistory = true;
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name, cb, std::string("unused"), false);
}
void LLNavigationBar::onTeleportFailed()
{
- mSaveToLocationHistory = false;
+ mSaveToLocationHistory = false;
}
void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
{
- if (!mSaveToLocationHistory)
- return;
- LLLocationHistory* lh = LLLocationHistory::getInstance();
-
- //TODO*: do we need convert slurl into readable format?
- std::string location;
- /*NOTE:
- * We can't use gAgent.getPositionAgent() in case of local teleport to build location.
- * At this moment gAgent.getPositionAgent() contains previous coordinates.
- * according to EXT-65 agent position is being reseted on each frame.
- */
- LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY,
- gAgent.getPosAgentFromGlobal(global_agent_pos));
- std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString());
-
- LLLocationHistoryItem item (location,
- global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location
- //Touch it, if it is at list already, add new location otherwise
- if ( !lh->touchItem(item) ) {
- lh->addItem(item);
- }
-
- lh->save();
-
- mSaveToLocationHistory = false;
-
+ if (!mSaveToLocationHistory)
+ return;
+ LLLocationHistory* lh = LLLocationHistory::getInstance();
+
+ //TODO*: do we need convert slurl into readable format?
+ std::string location;
+ /*NOTE:
+ * We can't use gAgent.getPositionAgent() in case of local teleport to build location.
+ * At this moment gAgent.getPositionAgent() contains previous coordinates.
+ * according to EXT-65 agent position is being reseted on each frame.
+ */
+ LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY,
+ gAgent.getPosAgentFromGlobal(global_agent_pos));
+ std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString());
+
+ LLLocationHistoryItem item (location,
+ global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location
+ //Touch it, if it is at list already, add new location otherwise
+ if ( !lh->touchItem(item) ) {
+ lh->addItem(item);
+ }
+
+ lh->save();
+
+ mSaveToLocationHistory = false;
+
}
void LLNavigationBar::onTeleportHistoryChanged()
{
- // Update navigation controls.
- LLTeleportHistory* h = LLTeleportHistory::getInstance();
- int cur_item = h->getCurrentItemIndex();
- mBtnBack->setEnabled(cur_item > 0);
- mBtnForward->setEnabled(cur_item < ((int)h->getItems().size() - 1));
+ // Update navigation controls.
+ LLTeleportHistory* h = LLTeleportHistory::getInstance();
+ int cur_item = h->getCurrentItemIndex();
+ mBtnBack->setEnabled(cur_item > 0);
+ mBtnForward->setEnabled(cur_item < ((int)h->getItems().size() - 1));
}
void LLNavigationBar::rebuildTeleportHistoryMenu()
{
- // Has the pop-up menu been built?
- if (mTeleportHistoryMenu)
- {
- // Clear it.
- mTeleportHistoryMenu->empty();
- }
- else
- {
- // Create it.
- LLMenuGL::Params menu_p;
- menu_p.name("popup");
- menu_p.can_tear_off(false);
- menu_p.visible(false);
- menu_p.bg_visible(true);
- menu_p.scrollable(true);
- mTeleportHistoryMenu = LLUICtrlFactory::create<LLMenuGL>(menu_p);
-
- addChild(mTeleportHistoryMenu);
- }
-
- // Populate the menu with teleport history items.
- LLTeleportHistory* hist = LLTeleportHistory::getInstance();
- const LLTeleportHistory::slurl_list_t& hist_items = hist->getItems();
- int cur_item = hist->getCurrentItemIndex();
-
- // Items will be shown in the reverse order, just like in Firefox.
- for (int i = (int)hist_items.size()-1; i >= 0; i--)
- {
- LLTeleportHistoryMenuItem::EType type;
- if (i < cur_item)
- type = LLTeleportHistoryMenuItem::TYPE_BACKWARD;
- else if (i > cur_item)
- type = LLTeleportHistoryMenuItem::TYPE_FORWARD;
- else
- type = LLTeleportHistoryMenuItem::TYPE_CURRENT;
-
- LLTeleportHistoryMenuItem::Params item_params;
- item_params.label = item_params.name = hist_items[i].mTitle;
- item_params.item_type = type;
- item_params.on_click.function(boost::bind(&LLNavigationBar::onTeleportHistoryMenuItemClicked, this, i));
- LLTeleportHistoryMenuItem* new_itemp = LLUICtrlFactory::create<LLTeleportHistoryMenuItem>(item_params);
- //new_itemp->setFont()
- mTeleportHistoryMenu->addChild(new_itemp);
- }
+ // Has the pop-up menu been built?
+ if (mTeleportHistoryMenu)
+ {
+ // Clear it.
+ mTeleportHistoryMenu->empty();
+ }
+ else
+ {
+ // Create it.
+ LLMenuGL::Params menu_p;
+ menu_p.name("popup");
+ menu_p.can_tear_off(false);
+ menu_p.visible(false);
+ menu_p.bg_visible(true);
+ menu_p.scrollable(true);
+ mTeleportHistoryMenu = LLUICtrlFactory::create<LLMenuGL>(menu_p);
+
+ addChild(mTeleportHistoryMenu);
+ }
+
+ // Populate the menu with teleport history items.
+ LLTeleportHistory* hist = LLTeleportHistory::getInstance();
+ const LLTeleportHistory::slurl_list_t& hist_items = hist->getItems();
+ int cur_item = hist->getCurrentItemIndex();
+
+ // Items will be shown in the reverse order, just like in Firefox.
+ for (int i = (int)hist_items.size()-1; i >= 0; i--)
+ {
+ LLTeleportHistoryMenuItem::EType type;
+ if (i < cur_item)
+ type = LLTeleportHistoryMenuItem::TYPE_BACKWARD;
+ else if (i > cur_item)
+ type = LLTeleportHistoryMenuItem::TYPE_FORWARD;
+ else
+ type = LLTeleportHistoryMenuItem::TYPE_CURRENT;
+
+ LLTeleportHistoryMenuItem::Params item_params;
+ item_params.label = item_params.name = hist_items[i].mTitle;
+ item_params.item_type = type;
+ item_params.on_click.function(boost::bind(&LLNavigationBar::onTeleportHistoryMenuItemClicked, this, i));
+ LLTeleportHistoryMenuItem* new_itemp = LLUICtrlFactory::create<LLTeleportHistoryMenuItem>(item_params);
+ //new_itemp->setFont()
+ mTeleportHistoryMenu->addChild(new_itemp);
+ }
}
void LLNavigationBar::onRegionNameResponse(
- std::string typed_location,
- std::string region_name,
- LLVector3 local_coords,
- U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
-{
- // Invalid location?
- if (region_handle)
- {
- // Teleport to the location.
- LLVector3d region_pos = from_region_handle(region_handle);
- LLVector3d global_pos = region_pos + (LLVector3d) local_coords;
-
- LL_INFOS() << "Teleporting to: " << LLSLURL(region_name, global_pos).getSLURLString() << LL_ENDL;
- gAgent.teleportViaLocation(global_pos);
- }
- else if (gSavedSettings.getBOOL("SearchFromAddressBar"))
- {
- invokeSearch(typed_location);
- }
-}
-
-void LLNavigationBar::showTeleportHistoryMenu(LLUICtrl* btn_ctrl)
-{
- // Don't show the popup if teleport history is empty.
- if (LLTeleportHistory::getInstance()->isEmpty())
- {
- LL_DEBUGS() << "Teleport history is empty, will not show the menu." << LL_ENDL;
- return;
- }
-
- rebuildTeleportHistoryMenu();
-
- if (mTeleportHistoryMenu == NULL)
- return;
-
- mTeleportHistoryMenu->updateParent(LLMenuGL::sMenuContainer);
- const S32 MENU_SPAWN_PAD = -1;
- LLMenuGL::showPopup(btn_ctrl, mTeleportHistoryMenu, 0, MENU_SPAWN_PAD);
- LLButton* nav_button = dynamic_cast<LLButton*>(btn_ctrl);
- if(nav_button)
- {
- if(mHistoryMenuConnection.connected())
- {
- LL_WARNS("Navgationbar")<<"mHistoryMenuConnection should be disconnected at this moment."<<LL_ENDL;
- mHistoryMenuConnection.disconnect();
- }
- mHistoryMenuConnection = gMenuHolder->setMouseUpCallback(boost::bind(&LLNavigationBar::onNavigationButtonHeldUp, this, nav_button));
- // pressed state will be update after mouseUp in onBackOrForwardButtonHeldUp();
- nav_button->setForcePressedState(true);
- }
- // *HACK pass the mouse capturing to the drop-down menu
- // it need to let menu handle mouseup event
- gFocusMgr.setMouseCapture(gMenuHolder);
+ std::string typed_location,
+ std::string region_name,
+ LLVector3 local_coords,
+ U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
+{
+ // Invalid location?
+ if (region_handle)
+ {
+ // Teleport to the location.
+ LLVector3d region_pos = from_region_handle(region_handle);
+ LLVector3d global_pos = region_pos + (LLVector3d) local_coords;
+
+ LL_INFOS() << "Teleporting to: " << LLSLURL(region_name, global_pos).getSLURLString() << LL_ENDL;
+ gAgent.teleportViaLocation(global_pos);
+ }
+ else if (gSavedSettings.getBOOL("SearchFromAddressBar"))
+ {
+ invokeSearch(typed_location);
+ }
+}
+
+void LLNavigationBar::showTeleportHistoryMenu(LLUICtrl* btn_ctrl)
+{
+ // Don't show the popup if teleport history is empty.
+ if (LLTeleportHistory::getInstance()->isEmpty())
+ {
+ LL_DEBUGS() << "Teleport history is empty, will not show the menu." << LL_ENDL;
+ return;
+ }
+
+ rebuildTeleportHistoryMenu();
+
+ if (mTeleportHistoryMenu == NULL)
+ return;
+
+ mTeleportHistoryMenu->updateParent(LLMenuGL::sMenuContainer);
+ const S32 MENU_SPAWN_PAD = -1;
+ LLMenuGL::showPopup(btn_ctrl, mTeleportHistoryMenu, 0, MENU_SPAWN_PAD);
+ LLButton* nav_button = dynamic_cast<LLButton*>(btn_ctrl);
+ if(nav_button)
+ {
+ if(mHistoryMenuConnection.connected())
+ {
+ LL_WARNS("Navgationbar")<<"mHistoryMenuConnection should be disconnected at this moment."<<LL_ENDL;
+ mHistoryMenuConnection.disconnect();
+ }
+ mHistoryMenuConnection = gMenuHolder->setMouseUpCallback(boost::bind(&LLNavigationBar::onNavigationButtonHeldUp, this, nav_button));
+ // pressed state will be update after mouseUp in onBackOrForwardButtonHeldUp();
+ nav_button->setForcePressedState(true);
+ }
+ // *HACK pass the mouse capturing to the drop-down menu
+ // it need to let menu handle mouseup event
+ gFocusMgr.setMouseCapture(gMenuHolder);
}
/**
* Taking into account the HACK above, this callback-function is responsible for correct handling of mouseUp event in case of holding-down the navigation buttons..
@@ -680,58 +680,58 @@ void LLNavigationBar::showTeleportHistoryMenu(LLUICtrl* btn_ctrl)
*/
void LLNavigationBar::onNavigationButtonHeldUp(LLButton* nav_button)
{
- if(nav_button)
- {
- nav_button->setForcePressedState(false);
- }
- if(gFocusMgr.getMouseCapture() == gMenuHolder)
- {
- // we had passed mouseCapture in showTeleportHistoryMenu()
- // now we MUST release mouseCapture to continue a proper mouseevent workflow.
- gFocusMgr.setMouseCapture(NULL);
- }
- //gMenuHolder is using to display bunch of menus. Disconnect signal to avoid unnecessary calls.
- mHistoryMenuConnection.disconnect();
+ if(nav_button)
+ {
+ nav_button->setForcePressedState(false);
+ }
+ if(gFocusMgr.getMouseCapture() == gMenuHolder)
+ {
+ // we had passed mouseCapture in showTeleportHistoryMenu()
+ // now we MUST release mouseCapture to continue a proper mouseevent workflow.
+ gFocusMgr.setMouseCapture(NULL);
+ }
+ //gMenuHolder is using to display bunch of menus. Disconnect signal to avoid unnecessary calls.
+ mHistoryMenuConnection.disconnect();
}
void LLNavigationBar::handleLoginComplete()
{
- LLTeleportHistory::getInstance()->handleLoginComplete();
- LLPanelTopInfoBar::instance().handleLoginComplete();
- mCmbLocation->handleLoginComplete();
- resizeLayoutPanel();
+ LLTeleportHistory::getInstance()->handleLoginComplete();
+ LLPanelTopInfoBar::instance().handleLoginComplete();
+ mCmbLocation->handleLoginComplete();
+ resizeLayoutPanel();
}
void LLNavigationBar::resizeLayoutPanel()
{
- LLRect nav_bar_rect = mNavigationPanel->getRect();
+ LLRect nav_bar_rect = mNavigationPanel->getRect();
- S32 nav_panel_width = (nav_bar_rect.getWidth() + mFavoritePanel->getRect().getWidth()) * gSavedPerAccountSettings.getF32("NavigationBarRatio");
+ S32 nav_panel_width = (nav_bar_rect.getWidth() + mFavoritePanel->getRect().getWidth()) * gSavedPerAccountSettings.getF32("NavigationBarRatio");
- nav_bar_rect.setLeftTopAndSize(nav_bar_rect.mLeft, nav_bar_rect.mTop, nav_panel_width, nav_bar_rect.getHeight());
- mNavigationPanel->handleReshape(nav_bar_rect,true);
+ nav_bar_rect.setLeftTopAndSize(nav_bar_rect.mLeft, nav_bar_rect.mTop, nav_panel_width, nav_bar_rect.getHeight());
+ mNavigationPanel->handleReshape(nav_bar_rect,true);
}
void LLNavigationBar::invokeSearch(std::string search_text)
{
- LLFloaterReg::showInstance("search", LLSD().with("category", "standard").with("query", LLSD(search_text)));
+ LLFloaterReg::showInstance("search", LLSD().with("category", "standard").with("query", LLSD(search_text)));
}
void LLNavigationBar::clearHistoryCache()
{
- mCmbLocation->removeall();
- LLLocationHistory* lh = LLLocationHistory::getInstance();
- lh->removeItems();
- lh->save();
- LLTeleportHistory::getInstance()->purgeItems();
+ mCmbLocation->removeall();
+ LLLocationHistory* lh = LLLocationHistory::getInstance();
+ lh->removeItems();
+ lh->save();
+ LLTeleportHistory::getInstance()->purgeItems();
}
int LLNavigationBar::getDefNavBarHeight()
{
- return mDefaultNbRect.getHeight();
+ return mDefaultNbRect.getHeight();
}
int LLNavigationBar::getDefFavBarHeight()
{
- return mDefaultFpRect.getHeight();
+ return mDefaultFpRect.getHeight();
}
bool LLNavigationBar::isRebakeNavMeshAvailable()
diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h
index 4649f5bcb0..56af1c134f 100755
--- a/indra/newview/llnavigationbar.h
+++ b/indra/newview/llnavigationbar.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnavigationbar.h
* @brief Navigation bar definition
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,123 +41,123 @@ class LLSearchComboBox;
* This button is able to handle click-dragging mouse event.
* It has appropriated signal for this event.
* Dragging direction can be set from xml attribute called 'direction'
- *
- * *TODO: move to llui?
+ *
+ * *TODO: move to llui?
*/
class LLPullButton: public LLButton
{
- LOG_CLASS(LLPullButton);
+ LOG_CLASS(LLPullButton);
public:
- struct Params: public LLInitParam::Block<Params, LLButton::Params>
- {
- Optional<std::string> direction; // left, right, down, up
+ struct Params: public LLInitParam::Block<Params, LLButton::Params>
+ {
+ Optional<std::string> direction; // left, right, down, up
+
+ Params()
+ : direction("direction", "down")
+ {
+ }
+ };
- Params()
- : direction("direction", "down")
- {
- }
- };
-
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
+ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
- boost::signals2::connection setClickDraggingCallback(const commit_signal_t::slot_type& cb);
+ boost::signals2::connection setClickDraggingCallback(const commit_signal_t::slot_type& cb);
protected:
- friend class LLUICtrlFactory;
- // convert string name into direction vector
- void setDirectionFromName(const std::string& name);
- LLPullButton(const LLPullButton::Params& params);
-
- commit_signal_t mClickDraggingSignal;
- LLVector2 mLastMouseDown;
- LLVector2 mDraggingDirection;
+ friend class LLUICtrlFactory;
+ // convert string name into direction vector
+ void setDirectionFromName(const std::string& name);
+ LLPullButton(const LLPullButton::Params& params);
+
+ commit_signal_t mClickDraggingSignal;
+ LLVector2 mLastMouseDown;
+ LLVector2 mDraggingDirection;
};
/**
* Web browser-like navigation bar.
- */
+ */
class LLNavigationBar
- : public LLPanel, public LLSingleton<LLNavigationBar>, private LLDestroyClass<LLNavigationBar>
+ : public LLPanel, public LLSingleton<LLNavigationBar>, private LLDestroyClass<LLNavigationBar>
{
- LLSINGLETON(LLNavigationBar);
- virtual ~LLNavigationBar();
- LOG_CLASS(LLNavigationBar);
- friend class LLDestroyClass<LLNavigationBar>;
+ LLSINGLETON(LLNavigationBar);
+ virtual ~LLNavigationBar();
+ LOG_CLASS(LLNavigationBar);
+ friend class LLDestroyClass<LLNavigationBar>;
public:
-
- /*virtual*/ void draw() override;
- /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
- /*virtual*/ BOOL postBuild() override;
- /*virtual*/ void setVisible(BOOL visible) override;
- void handleLoginComplete();
- void clearHistoryCache();
+ /*virtual*/ void draw() override;
+ /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
+ /*virtual*/ BOOL postBuild() override;
+ /*virtual*/ void setVisible(BOOL visible) override;
- int getDefNavBarHeight();
- int getDefFavBarHeight();
+ void handleLoginComplete();
+ void clearHistoryCache();
+
+ int getDefNavBarHeight();
+ int getDefFavBarHeight();
bool isRebakeNavMeshAvailable();
-
+
private:
- // the distance between navigation panel and favorites panel in pixels
- const static S32 FAVBAR_TOP_PADDING = 10;
-
- void rebuildTeleportHistoryMenu();
- void showTeleportHistoryMenu(LLUICtrl* btn_ctrl);
- void invokeSearch(std::string search_text);
- void resizeLayoutPanel();
- // callbacks
- void onTeleportHistoryMenuItemClicked(const LLSD& userdata);
- void onTeleportHistoryChanged();
- void onBackButtonClicked();
- void onBackOrForwardButtonHeldDown(LLUICtrl* ctrl, const LLSD& param);
- void onNavigationButtonHeldUp(LLButton* nav_button);
- void onForwardButtonClicked();
- void onHomeButtonClicked();
- void onLandmarksButtonClicked();
- void onLocationSelection();
- void onLocationPrearrange(const LLSD& data);
- void onTeleportFinished(const LLVector3d& global_agent_pos);
- void onTeleportFailed();
- void onNavbarResized();
- void onRegionNameResponse(
- std::string typed_location,
- std::string region_name,
- LLVector3 local_coords,
- U64 region_handle, const std::string& url,
- const LLUUID& snapshot_id, bool teleport);
-
- static void destroyClass()
- {
- if (LLNavigationBar::instanceExists())
- {
- LLNavigationBar::getInstance()->setEnabled(FALSE);
- }
- }
-
- S32 mNavPanWidth;
- LLMenuGL* mTeleportHistoryMenu;
- LLPullButton* mBtnBack;
- LLPullButton* mBtnForward;
- LLButton* mBtnHome;
- LLButton* mBtnLandmarks;
- LLLocationInputCtrl* mCmbLocation;
- LLRect mDefaultNbRect;
- LLRect mDefaultFpRect;
- LLLayoutPanel* mNavigationPanel;
- LLLayoutPanel* mFavoritePanel;
- boost::signals2::connection mTeleportFailedConnection;
- boost::signals2::connection mTeleportFinishConnection;
- boost::signals2::connection mHistoryMenuConnection;
- // if true, save location to location history when teleport finishes
- bool mSaveToLocationHistory;
+ // the distance between navigation panel and favorites panel in pixels
+ const static S32 FAVBAR_TOP_PADDING = 10;
+
+ void rebuildTeleportHistoryMenu();
+ void showTeleportHistoryMenu(LLUICtrl* btn_ctrl);
+ void invokeSearch(std::string search_text);
+ void resizeLayoutPanel();
+ // callbacks
+ void onTeleportHistoryMenuItemClicked(const LLSD& userdata);
+ void onTeleportHistoryChanged();
+ void onBackButtonClicked();
+ void onBackOrForwardButtonHeldDown(LLUICtrl* ctrl, const LLSD& param);
+ void onNavigationButtonHeldUp(LLButton* nav_button);
+ void onForwardButtonClicked();
+ void onHomeButtonClicked();
+ void onLandmarksButtonClicked();
+ void onLocationSelection();
+ void onLocationPrearrange(const LLSD& data);
+ void onTeleportFinished(const LLVector3d& global_agent_pos);
+ void onTeleportFailed();
+ void onNavbarResized();
+ void onRegionNameResponse(
+ std::string typed_location,
+ std::string region_name,
+ LLVector3 local_coords,
+ U64 region_handle, const std::string& url,
+ const LLUUID& snapshot_id, bool teleport);
+
+ static void destroyClass()
+ {
+ if (LLNavigationBar::instanceExists())
+ {
+ LLNavigationBar::getInstance()->setEnabled(FALSE);
+ }
+ }
+
+ S32 mNavPanWidth;
+ LLMenuGL* mTeleportHistoryMenu;
+ LLPullButton* mBtnBack;
+ LLPullButton* mBtnForward;
+ LLButton* mBtnHome;
+ LLButton* mBtnLandmarks;
+ LLLocationInputCtrl* mCmbLocation;
+ LLRect mDefaultNbRect;
+ LLRect mDefaultFpRect;
+ LLLayoutPanel* mNavigationPanel;
+ LLLayoutPanel* mFavoritePanel;
+ boost::signals2::connection mTeleportFailedConnection;
+ boost::signals2::connection mTeleportFinishConnection;
+ boost::signals2::connection mHistoryMenuConnection;
+ // if true, save location to location history when teleport finishes
+ bool mSaveToLocationHistory;
};
#endif
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 0ba3c3d691..d8ac641e56 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -1,26 +1,26 @@
-/**
+/**
* @file llnetmap.cpp
* @author James Cook
- * @brief Display of surrounding regions, objects, and agents.
+ * @brief Display of surrounding regions, objects, and agents.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2001-2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -65,7 +65,7 @@
#include "llviewerregion.h"
#include "llviewerwindow.h"
#include "llworld.h"
-#include "llworldmapview.h" // shared draw code
+#include "llworldmapview.h" // shared draw code
static LLDefaultChildRegistry::Register<LLNetMap> r1("net_map");
@@ -80,31 +80,31 @@ const F32 MAP_SCALE_ZOOM_FACTOR = 1.04f; // Zoom in factor per click of scroll w
const F32 MIN_DOT_RADIUS = 3.5f;
const F32 DOT_SCALE = 0.75f;
const F32 MIN_PICK_SCALE = 2.f;
-const S32 MOUSE_DRAG_SLOP = 2; // How far the mouse needs to move before we think it's a drag
+const S32 MOUSE_DRAG_SLOP = 2; // How far the mouse needs to move before we think it's a drag
const F64 COARSEUPDATE_MAX_Z = 1020.0f;
LLNetMap::LLNetMap (const Params & p)
-: LLUICtrl (p),
- mBackgroundColor (p.bg_color()),
+: LLUICtrl (p),
+ mBackgroundColor (p.bg_color()),
mScale( MAP_SCALE_MEDIUM ),
mPixelsPerMeter( MAP_SCALE_MEDIUM / REGION_WIDTH_METERS ),
- mObjectMapTPM(0.f),
- mObjectMapPixels(0.f),
- mCurPan(0.f, 0.f),
- mStartPan(0.f, 0.f),
+ mObjectMapTPM(0.f),
+ mObjectMapPixels(0.f),
+ mCurPan(0.f, 0.f),
+ mStartPan(0.f, 0.f),
mPopupWorldPos(0.f, 0.f, 0.f),
- mMouseDown(0, 0),
- mPanning(false),
- mUpdateNow(false),
- mObjectImageCenterGlobal( gAgentCamera.getCameraPositionGlobal() ),
- mObjectRawImagep(),
- mObjectImagep(),
- mClosestAgentToCursor(),
- mClosestAgentAtLastRightClick(),
- mToolTipMsg()
+ mMouseDown(0, 0),
+ mPanning(false),
+ mUpdateNow(false),
+ mObjectImageCenterGlobal( gAgentCamera.getCameraPositionGlobal() ),
+ mObjectRawImagep(),
+ mObjectImagep(),
+ mClosestAgentToCursor(),
+ mClosestAgentAtLastRightClick(),
+ mToolTipMsg()
{
- mScale = gSavedSettings.getF32("MiniMapScale");
+ mScale = gSavedSettings.getF32("MiniMapScale");
if (gAgent.isFirstLogin())
{
// *HACK: On first run, set this to false for new users, otherwise the
@@ -112,8 +112,8 @@ LLNetMap::LLNetMap (const Params & p)
// users.
gSavedSettings.setBOOL("MiniMapRotate", false);
}
- mPixelsPerMeter = mScale / REGION_WIDTH_METERS;
- mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
+ mPixelsPerMeter = mScale / REGION_WIDTH_METERS;
+ mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
}
LLNetMap::~LLNetMap()
@@ -142,33 +142,33 @@ BOOL LLNetMap::postBuild()
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mPopupMenuHandle = menu->getHandle();
menu->setItemEnabled("Re-center map", false);
- return TRUE;
+ return TRUE;
}
void LLNetMap::setScale( F32 scale )
{
- scale = llclamp(scale, MAP_SCALE_MIN, MAP_SCALE_MAX);
- mCurPan *= scale / mScale;
- mScale = scale;
-
- if (mObjectImagep.notNull())
- {
- F32 width = (F32)(getRect().getWidth());
- F32 height = (F32)(getRect().getHeight());
- F32 diameter = sqrt(width * width + height * height);
- F32 region_widths = diameter / mScale;
- F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters();
- F32 num_pixels = (F32)mObjectImagep->getWidth();
- mObjectMapTPM = num_pixels / meters;
- mObjectMapPixels = diameter;
- }
-
- mPixelsPerMeter = mScale / REGION_WIDTH_METERS;
- mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
-
- gSavedSettings.setF32("MiniMapScale", mScale);
-
- mUpdateNow = true;
+ scale = llclamp(scale, MAP_SCALE_MIN, MAP_SCALE_MAX);
+ mCurPan *= scale / mScale;
+ mScale = scale;
+
+ if (mObjectImagep.notNull())
+ {
+ F32 width = (F32)(getRect().getWidth());
+ F32 height = (F32)(getRect().getHeight());
+ F32 diameter = sqrt(width * width + height * height);
+ F32 region_widths = diameter / mScale;
+ F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters();
+ F32 num_pixels = (F32)mObjectImagep->getWidth();
+ mObjectMapTPM = num_pixels / meters;
+ mObjectMapPixels = diameter;
+ }
+
+ mPixelsPerMeter = mScale / REGION_WIDTH_METERS;
+ mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
+
+ gSavedSettings.setF32("MiniMapScale", mScale);
+
+ mUpdateNow = true;
}
@@ -181,27 +181,27 @@ void LLNetMap::draw()
return;
}
LL_PROFILE_ZONE_SCOPED;
- static LLFrameTimer map_timer;
- static LLUIColor map_avatar_color = LLUIColorTable::instance().getColor("MapAvatarColor", LLColor4::white);
- static LLUIColor map_avatar_friend_color = LLUIColorTable::instance().getColor("MapAvatarFriendColor", LLColor4::white);
- static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
- //static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white);
- static LLUIColor map_frustum_color = LLUIColorTable::instance().getColor("MapFrustumColor", LLColor4::white);
- static LLUIColor map_parcel_outline_color = LLUIColorTable::instance().getColor("MapParcelOutlineColor", LLColor4(LLColor3(LLColor4::yellow), 0.5f));
-
- if (mObjectImagep.isNull())
- {
- createObjectImage();
- }
+ static LLFrameTimer map_timer;
+ static LLUIColor map_avatar_color = LLUIColorTable::instance().getColor("MapAvatarColor", LLColor4::white);
+ static LLUIColor map_avatar_friend_color = LLUIColorTable::instance().getColor("MapAvatarFriendColor", LLColor4::white);
+ static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
+ //static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white);
+ static LLUIColor map_frustum_color = LLUIColorTable::instance().getColor("MapFrustumColor", LLColor4::white);
+ static LLUIColor map_parcel_outline_color = LLUIColorTable::instance().getColor("MapParcelOutlineColor", LLColor4(LLColor3(LLColor4::yellow), 0.5f));
+
+ if (mObjectImagep.isNull())
+ {
+ createObjectImage();
+ }
static LLUICachedControl<bool> auto_center("MiniMapAutoCenter", true);
bool auto_centering = auto_center && !mPanning;
mCentering = mCentering && !mPanning;
if (auto_centering || mCentering)
- {
+ {
mCurPan = lerp(mCurPan, LLVector2(0.0f, 0.0f) , LLSmoothInterpolation::getInterpolant(0.1f));
- }
+ }
bool centered = abs(mCurPan.mV[VX]) < 0.5f && abs(mCurPan.mV[VY]) < 0.5f;
if (centered)
{
@@ -218,296 +218,296 @@ void LLNetMap::draw()
}
updateAboutLandPopupButton();
- // Prepare a scissor region
- F32 rotation = 0;
+ // Prepare a scissor region
+ F32 rotation = 0;
+
+ gGL.pushMatrix();
+ gGL.pushUIMatrix();
- gGL.pushMatrix();
- gGL.pushUIMatrix();
-
- LLVector3 offset = gGL.getUITranslation();
- LLVector3 scale = gGL.getUIScale();
+ LLVector3 offset = gGL.getUITranslation();
+ LLVector3 scale = gGL.getUIScale();
- gGL.loadIdentity();
- gGL.loadUIIdentity();
+ gGL.loadIdentity();
+ gGL.loadUIIdentity();
- gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]);
- gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
-
- {
- LLLocalClipRect clip(getLocalRect());
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]);
+ gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
+ {
+ LLLocalClipRect clip(getLocalRect());
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- // Draw background rectangle
- LLColor4 background_color = mBackgroundColor.get();
- gGL.color4fv( background_color.mV );
- gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0);
- }
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
- // region 0,0 is in the middle
- S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPan.mV[VX]);
- S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPan.mV[VY]);
+ // Draw background rectangle
+ LLColor4 background_color = mBackgroundColor.get();
+ gGL.color4fv( background_color.mV );
+ gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0);
+ }
- gGL.pushMatrix();
+ // region 0,0 is in the middle
+ S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPan.mV[VX]);
+ S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPan.mV[VY]);
- gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
+ gGL.pushMatrix();
- static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
- if( rotate_map )
- {
- // rotate subsequent draws to agent rotation
- rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
- gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
- }
+ gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
- // figure out where agent is
- const S32 region_width = ll_round(LLWorld::getInstance()->getRegionWidthInMeters());
+ static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
+ if( rotate_map )
+ {
+ // rotate subsequent draws to agent rotation
+ rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
+ gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
+ }
+
+ // figure out where agent is
+ const S32 region_width = ll_round(LLWorld::getInstance()->getRegionWidthInMeters());
const F32 scale_pixels_per_meter = mScale / region_width;
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- // Find x and y position relative to camera's center.
- LLVector3 origin_agent = regionp->getOriginAgent();
- LLVector3 rel_region_pos = origin_agent - gAgentCamera.getCameraPositionAgent();
- F32 relative_x = rel_region_pos.mV[0] * scale_pixels_per_meter;
- F32 relative_y = rel_region_pos.mV[1] * scale_pixels_per_meter;
-
- // background region rectangle
- F32 bottom = relative_y;
- F32 left = relative_x;
- F32 top = bottom + mScale ;
- F32 right = left + mScale ;
-
- if (regionp == gAgent.getRegion())
- {
- gGL.color4f(1.f, 1.f, 1.f, 1.f);
- }
- else
- {
- gGL.color4f(0.8f, 0.8f, 0.8f, 1.f);
- }
-
- if (!regionp->isAlive())
- {
- gGL.color4f(1.f, 0.5f, 0.5f, 1.f);
- }
-
-
-
- // Draw using texture.
- gGL.getTexUnit(0)->bind(regionp->getLand().getSTexture());
- gGL.begin(LLRender::QUADS);
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex2f(left, top);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2f(left, bottom);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex2f(right, bottom);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex2f(right, top);
- gGL.end();
-
- // Draw water
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ // Find x and y position relative to camera's center.
+ LLVector3 origin_agent = regionp->getOriginAgent();
+ LLVector3 rel_region_pos = origin_agent - gAgentCamera.getCameraPositionAgent();
+ F32 relative_x = rel_region_pos.mV[0] * scale_pixels_per_meter;
+ F32 relative_y = rel_region_pos.mV[1] * scale_pixels_per_meter;
+
+ // background region rectangle
+ F32 bottom = relative_y;
+ F32 left = relative_x;
+ F32 top = bottom + mScale ;
+ F32 right = left + mScale ;
+
+ if (regionp == gAgent.getRegion())
+ {
+ gGL.color4f(1.f, 1.f, 1.f, 1.f);
+ }
+ else
+ {
+ gGL.color4f(0.8f, 0.8f, 0.8f, 1.f);
+ }
+
+ if (!regionp->isAlive())
+ {
+ gGL.color4f(1.f, 0.5f, 0.5f, 1.f);
+ }
+
+
+
+ // Draw using texture.
+ gGL.getTexUnit(0)->bind(regionp->getLand().getSTexture());
+ gGL.begin(LLRender::QUADS);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2f(left, top);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2f(left, bottom);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2f(right, bottom);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2f(right, top);
+ gGL.end();
+
+ // Draw water
gGL.flush();
- {
- if (regionp->getLand().getWaterTexture())
- {
- gGL.getTexUnit(0)->bind(regionp->getLand().getWaterTexture());
- gGL.begin(LLRender::QUADS);
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex2f(left, top);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2f(left, bottom);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex2f(right, bottom);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex2f(right, top);
- gGL.end();
- }
- }
+ {
+ if (regionp->getLand().getWaterTexture())
+ {
+ gGL.getTexUnit(0)->bind(regionp->getLand().getWaterTexture());
+ gGL.begin(LLRender::QUADS);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2f(left, top);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2f(left, bottom);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2f(right, bottom);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2f(right, top);
+ gGL.end();
+ }
+ }
gGL.flush();
- }
-
- // Redraw object layer periodically
- if (mUpdateNow || (map_timer.getElapsedTimeF32() > 0.5f))
- {
- mUpdateNow = false;
-
- // Locate the centre of the object layer, accounting for panning
- LLVector3 new_center = globalPosToView(gAgentCamera.getCameraPositionGlobal());
- new_center.mV[VX] -= mCurPan.mV[VX];
- new_center.mV[VY] -= mCurPan.mV[VY];
- new_center.mV[VZ] = 0.f;
- mObjectImageCenterGlobal = viewPosToGlobal(llfloor(new_center.mV[VX]), llfloor(new_center.mV[VY]));
-
- // Create the base texture.
- U8 *default_texture = mObjectRawImagep->getData();
- memset( default_texture, 0, mObjectImagep->getWidth() * mObjectImagep->getHeight() * mObjectImagep->getComponents() );
-
- // Draw objects
- gObjectList.renderObjectsForMap(*this);
-
- mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight());
-
- map_timer.reset();
- }
-
- LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
- LLVector3 camera_position = gAgentCamera.getCameraPositionAgent();
- map_center_agent -= camera_position;
- map_center_agent.mV[VX] *= scale_pixels_per_meter;
- map_center_agent.mV[VY] *= scale_pixels_per_meter;
-
- gGL.getTexUnit(0)->bind(mObjectImagep);
- F32 image_half_width = 0.5f*mObjectMapPixels;
- F32 image_half_height = 0.5f*mObjectMapPixels;
-
- gGL.begin(LLRender::QUADS);
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, map_center_agent.mV[VY] - image_half_height);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex2f(image_half_width + map_center_agent.mV[VX], map_center_agent.mV[VY] - image_half_height);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex2f(image_half_width + map_center_agent.mV[VX], image_half_height + map_center_agent.mV[VY]);
- gGL.end();
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
+ }
+
+ // Redraw object layer periodically
+ if (mUpdateNow || (map_timer.getElapsedTimeF32() > 0.5f))
+ {
+ mUpdateNow = false;
+
+ // Locate the centre of the object layer, accounting for panning
+ LLVector3 new_center = globalPosToView(gAgentCamera.getCameraPositionGlobal());
+ new_center.mV[VX] -= mCurPan.mV[VX];
+ new_center.mV[VY] -= mCurPan.mV[VY];
+ new_center.mV[VZ] = 0.f;
+ mObjectImageCenterGlobal = viewPosToGlobal(llfloor(new_center.mV[VX]), llfloor(new_center.mV[VY]));
+
+ // Create the base texture.
+ U8 *default_texture = mObjectRawImagep->getData();
+ memset( default_texture, 0, mObjectImagep->getWidth() * mObjectImagep->getHeight() * mObjectImagep->getComponents() );
+
+ // Draw objects
+ gObjectList.renderObjectsForMap(*this);
+
+ mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight());
+
+ map_timer.reset();
+ }
+
+ LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
+ LLVector3 camera_position = gAgentCamera.getCameraPositionAgent();
+ map_center_agent -= camera_position;
+ map_center_agent.mV[VX] *= scale_pixels_per_meter;
+ map_center_agent.mV[VY] *= scale_pixels_per_meter;
+
+ gGL.getTexUnit(0)->bind(mObjectImagep);
+ F32 image_half_width = 0.5f*mObjectMapPixels;
+ F32 image_half_height = 0.5f*mObjectMapPixels;
+
+ gGL.begin(LLRender::QUADS);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, map_center_agent.mV[VY] - image_half_height);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2f(image_half_width + map_center_agent.mV[VX], map_center_agent.mV[VY] - image_half_height);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2f(image_half_width + map_center_agent.mV[VX], image_half_height + map_center_agent.mV[VY]);
+ gGL.end();
+
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
regionp->renderPropertyLinesOnMinimap(scale_pixels_per_meter, map_parcel_outline_color.get().mV);
}
- gGL.popMatrix();
-
- // Mouse pointer in local coordinates
- S32 local_mouse_x;
- S32 local_mouse_y;
- //localMouse(&local_mouse_x, &local_mouse_y);
- LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
- mClosestAgentToCursor.setNull();
- F32 closest_dist_squared = F32_MAX; // value will be overridden in the loop
- F32 min_pick_dist_squared = (mDotRadius * MIN_PICK_SCALE) * (mDotRadius * MIN_PICK_SCALE);
-
- LLVector3 pos_map;
- uuid_vec_t avatar_ids;
- std::vector<LLVector3d> positions;
- bool unknown_relative_z;
-
- LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgentCamera.getCameraPositionGlobal());
-
- // Draw avatars
- for (U32 i = 0; i < avatar_ids.size(); i++)
- {
- LLUUID uuid = avatar_ids[i];
- // Skip self, we'll draw it later
- if (uuid == gAgent.getID()) continue;
-
- pos_map = globalPosToView(positions[i]);
-
- bool show_as_friend = (LLAvatarTracker::instance().getBuddyInfo(uuid) != NULL);
-
- LLColor4 color = show_as_friend ? map_avatar_friend_color : map_avatar_color;
-
- unknown_relative_z = positions[i].mdV[VZ] >= COARSEUPDATE_MAX_Z &&
- camera_position.mV[VZ] >= COARSEUPDATE_MAX_Z;
-
- LLWorldMapView::drawAvatar(
- pos_map.mV[VX], pos_map.mV[VY],
- color,
- pos_map.mV[VZ], mDotRadius,
- unknown_relative_z);
-
- if(uuid.notNull())
- {
- bool selected = false;
- uuid_vec_t::iterator sel_iter = gmSelected.begin();
- for (; sel_iter != gmSelected.end(); sel_iter++)
- {
- if(*sel_iter == uuid)
- {
- selected = true;
- break;
- }
- }
- if(selected)
- {
- if( (pos_map.mV[VX] < 0) ||
- (pos_map.mV[VY] < 0) ||
- (pos_map.mV[VX] >= getRect().getWidth()) ||
- (pos_map.mV[VY] >= getRect().getHeight()) )
- {
- S32 x = ll_round( pos_map.mV[VX] );
- S32 y = ll_round( pos_map.mV[VY] );
- LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10);
- } else
- {
- LLWorldMapView::drawTrackingDot(pos_map.mV[VX],pos_map.mV[VY],color,0.f);
- }
- }
- }
-
- F32 dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
- LLVector2(local_mouse_x,local_mouse_y));
- if(dist_to_cursor_squared < min_pick_dist_squared && dist_to_cursor_squared < closest_dist_squared)
- {
- closest_dist_squared = dist_to_cursor_squared;
- mClosestAgentToCursor = uuid;
- }
- }
-
- // Draw dot for autopilot target
- if (gAgent.getAutoPilot())
- {
- drawTracking( gAgent.getAutoPilotTargetGlobal(), map_track_color );
- }
- else
- {
- LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
- if ( LLTracker::TRACKING_AVATAR == tracking_status )
- {
- drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color );
- }
- else if ( LLTracker::TRACKING_LANDMARK == tracking_status
- || LLTracker::TRACKING_LOCATION == tracking_status )
- {
- drawTracking( LLTracker::getTrackedPositionGlobal(), map_track_color );
- }
- }
-
- // Draw dot for self avatar position
- LLVector3d pos_global = gAgent.getPositionGlobal();
- pos_map = globalPosToView(pos_global);
- S32 dot_width = ll_round(mDotRadius * 2.f);
- LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
- if (you)
- {
- you->draw(ll_round(pos_map.mV[VX] - mDotRadius),
- ll_round(pos_map.mV[VY] - mDotRadius),
- dot_width,
- dot_width);
-
- F32 dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
- LLVector2(local_mouse_x,local_mouse_y));
- if(dist_to_cursor_squared < min_pick_dist_squared && dist_to_cursor_squared < closest_dist_squared)
- {
- mClosestAgentToCursor = gAgent.getID();
- }
- }
-
- // Draw frustum
- F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
-
- F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();
- F32 far_clip_meters = LLViewerCamera::getInstance()->getFar();
- F32 far_clip_pixels = far_clip_meters * meters_to_pixels;
-
+ gGL.popMatrix();
+
+ // Mouse pointer in local coordinates
+ S32 local_mouse_x;
+ S32 local_mouse_y;
+ //localMouse(&local_mouse_x, &local_mouse_y);
+ LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
+ mClosestAgentToCursor.setNull();
+ F32 closest_dist_squared = F32_MAX; // value will be overridden in the loop
+ F32 min_pick_dist_squared = (mDotRadius * MIN_PICK_SCALE) * (mDotRadius * MIN_PICK_SCALE);
+
+ LLVector3 pos_map;
+ uuid_vec_t avatar_ids;
+ std::vector<LLVector3d> positions;
+ bool unknown_relative_z;
+
+ LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgentCamera.getCameraPositionGlobal());
+
+ // Draw avatars
+ for (U32 i = 0; i < avatar_ids.size(); i++)
+ {
+ LLUUID uuid = avatar_ids[i];
+ // Skip self, we'll draw it later
+ if (uuid == gAgent.getID()) continue;
+
+ pos_map = globalPosToView(positions[i]);
+
+ bool show_as_friend = (LLAvatarTracker::instance().getBuddyInfo(uuid) != NULL);
+
+ LLColor4 color = show_as_friend ? map_avatar_friend_color : map_avatar_color;
+
+ unknown_relative_z = positions[i].mdV[VZ] >= COARSEUPDATE_MAX_Z &&
+ camera_position.mV[VZ] >= COARSEUPDATE_MAX_Z;
+
+ LLWorldMapView::drawAvatar(
+ pos_map.mV[VX], pos_map.mV[VY],
+ color,
+ pos_map.mV[VZ], mDotRadius,
+ unknown_relative_z);
+
+ if(uuid.notNull())
+ {
+ bool selected = false;
+ uuid_vec_t::iterator sel_iter = gmSelected.begin();
+ for (; sel_iter != gmSelected.end(); sel_iter++)
+ {
+ if(*sel_iter == uuid)
+ {
+ selected = true;
+ break;
+ }
+ }
+ if(selected)
+ {
+ if( (pos_map.mV[VX] < 0) ||
+ (pos_map.mV[VY] < 0) ||
+ (pos_map.mV[VX] >= getRect().getWidth()) ||
+ (pos_map.mV[VY] >= getRect().getHeight()) )
+ {
+ S32 x = ll_round( pos_map.mV[VX] );
+ S32 y = ll_round( pos_map.mV[VY] );
+ LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10);
+ } else
+ {
+ LLWorldMapView::drawTrackingDot(pos_map.mV[VX],pos_map.mV[VY],color,0.f);
+ }
+ }
+ }
+
+ F32 dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
+ LLVector2(local_mouse_x,local_mouse_y));
+ if(dist_to_cursor_squared < min_pick_dist_squared && dist_to_cursor_squared < closest_dist_squared)
+ {
+ closest_dist_squared = dist_to_cursor_squared;
+ mClosestAgentToCursor = uuid;
+ }
+ }
+
+ // Draw dot for autopilot target
+ if (gAgent.getAutoPilot())
+ {
+ drawTracking( gAgent.getAutoPilotTargetGlobal(), map_track_color );
+ }
+ else
+ {
+ LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
+ if ( LLTracker::TRACKING_AVATAR == tracking_status )
+ {
+ drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color );
+ }
+ else if ( LLTracker::TRACKING_LANDMARK == tracking_status
+ || LLTracker::TRACKING_LOCATION == tracking_status )
+ {
+ drawTracking( LLTracker::getTrackedPositionGlobal(), map_track_color );
+ }
+ }
+
+ // Draw dot for self avatar position
+ LLVector3d pos_global = gAgent.getPositionGlobal();
+ pos_map = globalPosToView(pos_global);
+ S32 dot_width = ll_round(mDotRadius * 2.f);
+ LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
+ if (you)
+ {
+ you->draw(ll_round(pos_map.mV[VX] - mDotRadius),
+ ll_round(pos_map.mV[VY] - mDotRadius),
+ dot_width,
+ dot_width);
+
+ F32 dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
+ LLVector2(local_mouse_x,local_mouse_y));
+ if(dist_to_cursor_squared < min_pick_dist_squared && dist_to_cursor_squared < closest_dist_squared)
+ {
+ mClosestAgentToCursor = gAgent.getID();
+ }
+ }
+
+ // Draw frustum
+ F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
+
+ F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();
+ F32 far_clip_meters = LLViewerCamera::getInstance()->getFar();
+ F32 far_clip_pixels = far_clip_meters * meters_to_pixels;
+
F32 ctr_x = (F32)center_sw_left;
F32 ctr_y = (F32)center_sw_bottom;
@@ -535,70 +535,70 @@ void LLNetMap::draw()
gl_washer_segment_2d(far_clip_pixels, 0, arc_start, arc_end, steps, map_frustum_color(), map_frustum_color());
gGL.popMatrix();
}
- }
-
- gGL.popMatrix();
- gGL.popUIMatrix();
+ }
- LLUICtrl::draw();
+ gGL.popMatrix();
+ gGL.popUIMatrix();
+
+ LLUICtrl::draw();
}
void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- LLUICtrl::reshape(width, height, called_from_parent);
- createObjectImage();
+ LLUICtrl::reshape(width, height, called_from_parent);
+ createObjectImage();
}
LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos)
{
- LLVector3d camera_position = gAgentCamera.getCameraPositionGlobal();
+ LLVector3d camera_position = gAgentCamera.getCameraPositionGlobal();
- LLVector3d relative_pos_global = global_pos - camera_position;
- LLVector3 pos_local;
- pos_local.setVec(relative_pos_global); // convert to floats from doubles
+ LLVector3d relative_pos_global = global_pos - camera_position;
+ LLVector3 pos_local;
+ pos_local.setVec(relative_pos_global); // convert to floats from doubles
- pos_local.mV[VX] *= mPixelsPerMeter;
- pos_local.mV[VY] *= mPixelsPerMeter;
- // leave Z component in meters
+ pos_local.mV[VX] *= mPixelsPerMeter;
+ pos_local.mV[VY] *= mPixelsPerMeter;
+ // leave Z component in meters
- static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
- if( rotate_map )
- {
- F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
- LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
- pos_local.rotVec( rot );
- }
+ static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
+ if( rotate_map )
+ {
+ F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
+ LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
+ pos_local.rotVec( rot );
+ }
- pos_local.mV[VX] += getRect().getWidth() / 2 + mCurPan.mV[VX];
- pos_local.mV[VY] += getRect().getHeight() / 2 + mCurPan.mV[VY];
+ pos_local.mV[VX] += getRect().getWidth() / 2 + mCurPan.mV[VX];
+ pos_local.mV[VY] += getRect().getHeight() / 2 + mCurPan.mV[VY];
- return pos_local;
+ return pos_local;
}
-void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
- BOOL draw_arrow )
+void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
+ BOOL draw_arrow )
{
- LLVector3 pos_local = globalPosToView(pos_global);
- if( (pos_local.mV[VX] < 0) ||
- (pos_local.mV[VY] < 0) ||
- (pos_local.mV[VX] >= getRect().getWidth()) ||
- (pos_local.mV[VY] >= getRect().getHeight()) )
- {
- if (draw_arrow)
- {
- S32 x = ll_round( pos_local.mV[VX] );
- S32 y = ll_round( pos_local.mV[VY] );
- LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10 );
- LLWorldMapView::drawTrackingArrow( getRect(), x, y, color );
- }
- }
- else
- {
- LLWorldMapView::drawTrackingDot(pos_local.mV[VX],
- pos_local.mV[VY],
- color,
- pos_local.mV[VZ]);
- }
+ LLVector3 pos_local = globalPosToView(pos_global);
+ if( (pos_local.mV[VX] < 0) ||
+ (pos_local.mV[VY] < 0) ||
+ (pos_local.mV[VX] >= getRect().getWidth()) ||
+ (pos_local.mV[VY] >= getRect().getHeight()) )
+ {
+ if (draw_arrow)
+ {
+ S32 x = ll_round( pos_local.mV[VX] );
+ S32 y = ll_round( pos_local.mV[VY] );
+ LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10 );
+ LLWorldMapView::drawTrackingArrow( getRect(), x, y, color );
+ }
+ }
+ else
+ {
+ LLWorldMapView::drawTrackingDot(pos_local.mV[VX],
+ pos_local.mV[VY],
+ color,
+ pos_local.mV[VZ]);
+ }
}
bool LLNetMap::isMouseOnPopupMenu()
@@ -664,34 +664,34 @@ void LLNetMap::updateAboutLandPopupButton()
LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )
{
- x -= ll_round(getRect().getWidth() / 2 + mCurPan.mV[VX]);
- y -= ll_round(getRect().getHeight() / 2 + mCurPan.mV[VY]);
+ x -= ll_round(getRect().getWidth() / 2 + mCurPan.mV[VX]);
+ y -= ll_round(getRect().getHeight() / 2 + mCurPan.mV[VY]);
+
+ LLVector3 pos_local( (F32)x, (F32)y, 0 );
- LLVector3 pos_local( (F32)x, (F32)y, 0 );
+ F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
- F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
+ static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
+ if( rotate_map )
+ {
+ LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
+ pos_local.rotVec( rot );
+ }
- static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
- if( rotate_map )
- {
- LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
- pos_local.rotVec( rot );
- }
+ pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / mScale );
- pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / mScale );
-
- LLVector3d pos_global;
- pos_global.setVec( pos_local );
- pos_global += gAgentCamera.getCameraPositionGlobal();
+ LLVector3d pos_global;
+ pos_global.setVec( pos_local );
+ pos_global += gAgentCamera.getCameraPositionGlobal();
- return pos_global;
+ return pos_global;
}
BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
// note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in
F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks);
- F32 old_scale = mScale;
+ F32 old_scale = mScale;
setScale(new_scale);
@@ -839,172 +839,172 @@ BOOL LLNetMap::handleToolTip(S32 x, S32 y, MASK mask)
BOOL LLNetMap::handleToolTipAgent(const LLUUID& avatar_id)
{
- LLAvatarName av_name;
- if (avatar_id.isNull() || !LLAvatarNameCache::get(avatar_id, &av_name))
- {
- return FALSE;
- }
-
- // only show tooltip if same inspector not already open
- LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_avatar");
- if (!existing_inspector
- || !existing_inspector->getVisible()
- || existing_inspector->getKey()["avatar_id"].asUUID() != avatar_id)
- {
- LLInspector::Params p;
- p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
- p.message(av_name.getCompleteName());
- p.image.name("Inspector_I");
- p.click_callback(boost::bind(showAvatarInspector, avatar_id));
- p.visible_time_near(6.f);
- p.visible_time_far(3.f);
- p.delay_time(0.35f);
- p.wrap(false);
-
- LLToolTipMgr::instance().show(p);
- }
- return TRUE;
+ LLAvatarName av_name;
+ if (avatar_id.isNull() || !LLAvatarNameCache::get(avatar_id, &av_name))
+ {
+ return FALSE;
+ }
+
+ // only show tooltip if same inspector not already open
+ LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_avatar");
+ if (!existing_inspector
+ || !existing_inspector->getVisible()
+ || existing_inspector->getKey()["avatar_id"].asUUID() != avatar_id)
+ {
+ LLInspector::Params p;
+ p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
+ p.message(av_name.getCompleteName());
+ p.image.name("Inspector_I");
+ p.click_callback(boost::bind(showAvatarInspector, avatar_id));
+ p.visible_time_near(6.f);
+ p.visible_time_far(3.f);
+ p.delay_time(0.35f);
+ p.wrap(false);
+
+ LLToolTipMgr::instance().show(p);
+ }
+ return TRUE;
}
// static
void LLNetMap::showAvatarInspector(const LLUUID& avatar_id)
{
- LLSD params;
- params["avatar_id"] = avatar_id;
+ LLSD params;
+ params["avatar_id"] = avatar_id;
- if (LLToolTipMgr::instance().toolTipVisible())
- {
- LLRect rect = LLToolTipMgr::instance().getToolTipRect();
- params["pos"]["x"] = rect.mLeft;
- params["pos"]["y"] = rect.mTop;
- }
+ if (LLToolTipMgr::instance().toolTipVisible())
+ {
+ LLRect rect = LLToolTipMgr::instance().getToolTipRect();
+ params["pos"]["x"] = rect.mLeft;
+ params["pos"]["y"] = rect.mTop;
+ }
- LLFloaterReg::showInstance("inspect_avatar", params);
+ LLFloaterReg::showInstance("inspect_avatar", params);
}
void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius_meters )
{
- LLVector3 local_pos;
- local_pos.setVec( pos - mObjectImageCenterGlobal );
+ LLVector3 local_pos;
+ local_pos.setVec( pos - mObjectImageCenterGlobal );
- S32 diameter_pixels = ll_round(2 * radius_meters * mObjectMapTPM);
- renderPoint( local_pos, color, diameter_pixels );
+ S32 diameter_pixels = ll_round(2 * radius_meters * mObjectMapTPM);
+ renderPoint( local_pos, color, diameter_pixels );
}
-void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color,
- S32 diameter, S32 relative_height)
+void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color,
+ S32 diameter, S32 relative_height)
{
- if (diameter <= 0)
- {
- return;
- }
-
- const S32 image_width = (S32)mObjectImagep->getWidth();
- const S32 image_height = (S32)mObjectImagep->getHeight();
-
- S32 x_offset = ll_round(pos_local.mV[VX] * mObjectMapTPM + image_width / 2);
- S32 y_offset = ll_round(pos_local.mV[VY] * mObjectMapTPM + image_height / 2);
-
- if ((x_offset < 0) || (x_offset >= image_width))
- {
- return;
- }
- if ((y_offset < 0) || (y_offset >= image_height))
- {
- return;
- }
-
- U8 *datap = mObjectRawImagep->getData();
-
- S32 neg_radius = diameter / 2;
- S32 pos_radius = diameter - neg_radius;
- S32 x, y;
-
- if (relative_height > 0)
- {
- // ...point above agent
- S32 px, py;
-
- // vertical line
- px = x_offset;
- for (y = -neg_radius; y < pos_radius; y++)
- {
- py = y_offset + y;
- if ((py < 0) || (py >= image_height))
- {
- continue;
- }
- S32 offset = px + py * image_width;
- ((U32*)datap)[offset] = color.asRGBA();
- }
-
- // top line
- py = y_offset + pos_radius - 1;
- for (x = -neg_radius; x < pos_radius; x++)
- {
- px = x_offset + x;
- if ((px < 0) || (px >= image_width))
- {
- continue;
- }
- S32 offset = px + py * image_width;
- ((U32*)datap)[offset] = color.asRGBA();
- }
- }
- else
- {
- // ...point level with agent
- for (x = -neg_radius; x < pos_radius; x++)
- {
- S32 p_x = x_offset + x;
- if ((p_x < 0) || (p_x >= image_width))
- {
- continue;
- }
-
- for (y = -neg_radius; y < pos_radius; y++)
- {
- S32 p_y = y_offset + y;
- if ((p_y < 0) || (p_y >= image_height))
- {
- continue;
- }
- S32 offset = p_x + p_y * image_width;
- ((U32*)datap)[offset] = color.asRGBA();
- }
- }
- }
+ if (diameter <= 0)
+ {
+ return;
+ }
+
+ const S32 image_width = (S32)mObjectImagep->getWidth();
+ const S32 image_height = (S32)mObjectImagep->getHeight();
+
+ S32 x_offset = ll_round(pos_local.mV[VX] * mObjectMapTPM + image_width / 2);
+ S32 y_offset = ll_round(pos_local.mV[VY] * mObjectMapTPM + image_height / 2);
+
+ if ((x_offset < 0) || (x_offset >= image_width))
+ {
+ return;
+ }
+ if ((y_offset < 0) || (y_offset >= image_height))
+ {
+ return;
+ }
+
+ U8 *datap = mObjectRawImagep->getData();
+
+ S32 neg_radius = diameter / 2;
+ S32 pos_radius = diameter - neg_radius;
+ S32 x, y;
+
+ if (relative_height > 0)
+ {
+ // ...point above agent
+ S32 px, py;
+
+ // vertical line
+ px = x_offset;
+ for (y = -neg_radius; y < pos_radius; y++)
+ {
+ py = y_offset + y;
+ if ((py < 0) || (py >= image_height))
+ {
+ continue;
+ }
+ S32 offset = px + py * image_width;
+ ((U32*)datap)[offset] = color.asRGBA();
+ }
+
+ // top line
+ py = y_offset + pos_radius - 1;
+ for (x = -neg_radius; x < pos_radius; x++)
+ {
+ px = x_offset + x;
+ if ((px < 0) || (px >= image_width))
+ {
+ continue;
+ }
+ S32 offset = px + py * image_width;
+ ((U32*)datap)[offset] = color.asRGBA();
+ }
+ }
+ else
+ {
+ // ...point level with agent
+ for (x = -neg_radius; x < pos_radius; x++)
+ {
+ S32 p_x = x_offset + x;
+ if ((p_x < 0) || (p_x >= image_width))
+ {
+ continue;
+ }
+
+ for (y = -neg_radius; y < pos_radius; y++)
+ {
+ S32 p_y = y_offset + y;
+ if ((p_y < 0) || (p_y >= image_height))
+ {
+ continue;
+ }
+ S32 offset = p_x + p_y * image_width;
+ ((U32*)datap)[offset] = color.asRGBA();
+ }
+ }
+ }
}
void LLNetMap::createObjectImage()
{
- // Find the size of the side of a square that surrounds the circle that surrounds getRect().
- // ... which is, the diagonal of the rect.
- F32 width = (F32)getRect().getWidth();
- F32 height = (F32)getRect().getHeight();
- S32 square_size = ll_round( sqrt(width*width + height*height) );
-
- // Find the least power of two >= the minimum size.
- const S32 MIN_SIZE = 64;
- const S32 MAX_SIZE = 256;
- S32 img_size = MIN_SIZE;
- while( (img_size*2 < square_size ) && (img_size < MAX_SIZE) )
- {
- img_size <<= 1;
- }
-
- if( mObjectImagep.isNull() ||
- (mObjectImagep->getWidth() != img_size) ||
- (mObjectImagep->getHeight() != img_size) )
- {
- mObjectRawImagep = new LLImageRaw(img_size, img_size, 4);
- U8* data = mObjectRawImagep->getData();
- memset( data, 0, img_size * img_size * 4 );
- mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE);
- }
- setScale(mScale);
- mUpdateNow = true;
+ // Find the size of the side of a square that surrounds the circle that surrounds getRect().
+ // ... which is, the diagonal of the rect.
+ F32 width = (F32)getRect().getWidth();
+ F32 height = (F32)getRect().getHeight();
+ S32 square_size = ll_round( sqrt(width*width + height*height) );
+
+ // Find the least power of two >= the minimum size.
+ const S32 MIN_SIZE = 64;
+ const S32 MAX_SIZE = 256;
+ S32 img_size = MIN_SIZE;
+ while( (img_size*2 < square_size ) && (img_size < MAX_SIZE) )
+ {
+ img_size <<= 1;
+ }
+
+ if( mObjectImagep.isNull() ||
+ (mObjectImagep->getWidth() != img_size) ||
+ (mObjectImagep->getHeight() != img_size) )
+ {
+ mObjectRawImagep = new LLImageRaw(img_size, img_size, 4);
+ U8* data = mObjectRawImagep->getData();
+ memset( data, 0, img_size * img_size * 4 );
+ mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE);
+ }
+ setScale(mScale);
+ mUpdateNow = true;
}
BOOL LLNetMap::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -1055,56 +1055,56 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get());
if (menu)
- {
- mPopupWorldPos = viewPosToGlobal(x, y);
+ {
+ mPopupWorldPos = viewPosToGlobal(x, y);
menu->buildDrawLabels();
menu->updateParent(LLMenuGL::sMenuContainer);
menu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0));
- LLMenuGL::showPopup(this, menu, x, y);
- }
- return TRUE;
+ LLMenuGL::showPopup(this, menu, x, y);
+ }
+ return TRUE;
}
BOOL LLNetMap::handleClick(S32 x, S32 y, MASK mask)
{
- // TODO: allow clicking an avatar on minimap to select avatar in the nearby avatar list
- // if(mClosestAgentToCursor.notNull())
- // mNearbyList->selectUser(mClosestAgentToCursor);
- // Needs a registered observer i guess to accomplish this without using
- // globals to tell the mNearbyList in llpeoplepanel to select the user
- return TRUE;
+ // TODO: allow clicking an avatar on minimap to select avatar in the nearby avatar list
+ // if(mClosestAgentToCursor.notNull())
+ // mNearbyList->selectUser(mClosestAgentToCursor);
+ // Needs a registered observer i guess to accomplish this without using
+ // globals to tell the mNearbyList in llpeoplepanel to select the user
+ return TRUE;
}
BOOL LLNetMap::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- LLVector3d pos_global = viewPosToGlobal(x, y);
-
- bool double_click_teleport = gSavedSettings.getBOOL("DoubleClickTeleport");
- bool double_click_show_world_map = gSavedSettings.getBOOL("DoubleClickShowWorldMap");
-
- if (double_click_teleport || double_click_show_world_map)
- {
- // If we're not tracking a beacon already, double-click will set one
- if (!LLTracker::isTracking(NULL))
- {
- LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance();
- if (world_map)
- {
- world_map->trackLocation(pos_global);
- }
- }
- }
-
- if (double_click_teleport)
- {
- // If DoubleClickTeleport is on, double clicking the minimap will teleport there
- gAgent.teleportViaLocationLookAt(pos_global);
- }
- else if (double_click_show_world_map)
- {
- LLFloaterReg::showInstance("world_map");
- }
- return TRUE;
+ LLVector3d pos_global = viewPosToGlobal(x, y);
+
+ bool double_click_teleport = gSavedSettings.getBOOL("DoubleClickTeleport");
+ bool double_click_show_world_map = gSavedSettings.getBOOL("DoubleClickShowWorldMap");
+
+ if (double_click_teleport || double_click_show_world_map)
+ {
+ // If we're not tracking a beacon already, double-click will set one
+ if (!LLTracker::isTracking(NULL))
+ {
+ LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance();
+ if (world_map)
+ {
+ world_map->trackLocation(pos_global);
+ }
+ }
+ }
+
+ if (double_click_teleport)
+ {
+ // If DoubleClickTeleport is on, double clicking the minimap will teleport there
+ gAgent.teleportViaLocationLookAt(pos_global);
+ }
+ else if (double_click_show_world_map)
+ {
+ LLFloaterReg::showInstance("world_map");
+ }
+ return TRUE;
}
F32 LLNetMap::getScaleForName(std::string scale_name)
@@ -1131,34 +1131,34 @@ F32 LLNetMap::getScaleForName(std::string scale_name)
// static
bool LLNetMap::outsideSlop( S32 x, S32 y, S32 start_x, S32 start_y, S32 slop )
{
- S32 dx = x - start_x;
- S32 dy = y - start_y;
+ S32 dx = x - start_x;
+ S32 dy = y - start_y;
- return (dx <= -slop || slop <= dx || dy <= -slop || slop <= dy);
+ return (dx <= -slop || slop <= dx || dy <= -slop || slop <= dy);
}
BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask )
{
- if (hasMouseCapture())
- {
- if (mPanning || outsideSlop(x, y, mMouseDown.mX, mMouseDown.mY, MOUSE_DRAG_SLOP))
- {
- if (!mPanning)
- {
+ if (hasMouseCapture())
+ {
+ if (mPanning || outsideSlop(x, y, mMouseDown.mX, mMouseDown.mY, MOUSE_DRAG_SLOP))
+ {
+ if (!mPanning)
+ {
// Just started panning. Hide cursor.
- mPanning = true;
- gViewerWindow->hideCursor();
- }
+ mPanning = true;
+ gViewerWindow->hideCursor();
+ }
- LLVector2 delta(static_cast<F32>(gViewerWindow->getCurrentMouseDX()),
- static_cast<F32>(gViewerWindow->getCurrentMouseDY()));
+ LLVector2 delta(static_cast<F32>(gViewerWindow->getCurrentMouseDX()),
+ static_cast<F32>(gViewerWindow->getCurrentMouseDY()));
- // Set pan to value at start of drag + offset
- mCurPan += delta;
+ // Set pan to value at start of drag + offset
+ mCurPan += delta;
- gViewerWindow->moveCursorToCenter();
- }
- }
+ gViewerWindow->moveCursorToCenter();
+ }
+ }
if (mask & MASK_SHIFT)
{
@@ -1171,7 +1171,7 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask )
gViewerWindow->setCursor( UI_CURSOR_CROSS );
}
- return TRUE;
+ return TRUE;
}
bool LLNetMap::isZoomChecked(const LLSD &userdata)
@@ -1195,10 +1195,10 @@ void LLNetMap::handleStopTracking (const LLSD& userdata)
{
auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get());
if (menu)
- {
+ {
menu->setItemEnabled ("Stop Tracking", false);
- LLTracker::stopTracking (LLTracker::isTracking(NULL));
- }
+ LLTracker::stopTracking (LLTracker::isTracking(NULL));
+ }
}
void LLNetMap::activateCenterMap(const LLSD &userdata) { mCentering = true; }
diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h
index 75c1abc4ed..7e8339acf0 100644
--- a/indra/newview/llnetmap.h
+++ b/indra/newview/llnetmap.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnetmap.h
* @brief A little map of the world with network information
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,23 +44,23 @@ class LLMenuGL;
class LLNetMap : public LLUICtrl
{
public:
- struct Params
- : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<LLUIColor> bg_color;
+ struct Params
+ : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Optional<LLUIColor> bg_color;
- Params()
- : bg_color("bg_color")
- {}
- };
+ Params()
+ : bg_color("bg_color")
+ {}
+ };
protected:
- LLNetMap (const Params & p);
- friend class LLUICtrlFactory;
- friend class LLFloaterMap;
+ LLNetMap (const Params & p);
+ friend class LLUICtrlFactory;
+ friend class LLFloaterMap;
public:
- virtual ~LLNetMap();
+ virtual ~LLNetMap();
static const F32 MAP_SCALE_MIN;
static const F32 MAP_SCALE_FAR;
@@ -69,18 +69,18 @@ public:
static const F32 MAP_SCALE_VERY_CLOSE;
static const F32 MAP_SCALE_MAX;
- /*virtual*/ void draw();
- /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask );
- /*virtual*/ BOOL handleToolTip( S32 x, S32 y, MASK mask);
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL handleToolTip( S32 x, S32 y, MASK mask);
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
- /*virtual*/ BOOL handleClick(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL handleClick(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
void setScale(F32 scale);
@@ -93,39 +93,39 @@ public:
void setToolTipHintMsg(const std::string& msg) { mToolTipHintMsg = msg; }
void setAltToolTipHintMsg(const std::string& msg) { mAltToolTipHintMsg = msg; }
- void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius );
+ void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius );
private:
- const LLVector3d& getObjectImageCenterGlobal() { return mObjectImageCenterGlobal; }
- void renderPoint(const LLVector3 &pos, const LLColor4U &color,
- S32 diameter, S32 relative_height = 0);
+ const LLVector3d& getObjectImageCenterGlobal() { return mObjectImageCenterGlobal; }
+ void renderPoint(const LLVector3 &pos, const LLColor4U &color,
+ S32 diameter, S32 relative_height = 0);
- LLVector3 globalPosToView(const LLVector3d& global_pos);
- LLVector3d viewPosToGlobal(S32 x,S32 y);
+ LLVector3 globalPosToView(const LLVector3d& global_pos);
+ LLVector3d viewPosToGlobal(S32 x,S32 y);
- void drawTracking( const LLVector3d& pos_global,
- const LLColor4& color,
- BOOL draw_arrow = TRUE);
+ void drawTracking( const LLVector3d& pos_global,
+ const LLColor4& color,
+ BOOL draw_arrow = TRUE);
bool isMouseOnPopupMenu();
void updateAboutLandPopupButton();
- BOOL handleToolTipAgent(const LLUUID& avatar_id);
- static void showAvatarInspector(const LLUUID& avatar_id);
+ BOOL handleToolTipAgent(const LLUUID& avatar_id);
+ static void showAvatarInspector(const LLUUID& avatar_id);
- void createObjectImage();
+ void createObjectImage();
F32 getScaleForName(std::string scale_name);
- static bool outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y, S32 slop);
+ static bool outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y, S32 slop);
private:
- bool mUpdateNow;
+ bool mUpdateNow;
- LLUIColor mBackgroundColor;
+ LLUIColor mBackgroundColor;
- F32 mScale; // Size of a region in pixels
- F32 mPixelsPerMeter; // world meters to map pixels
- F32 mObjectMapTPM; // texels per meter on map
- F32 mObjectMapPixels; // Width of object map in pixels
- F32 mDotRadius; // Size of avatar markers
+ F32 mScale; // Size of a region in pixels
+ F32 mPixelsPerMeter; // world meters to map pixels
+ F32 mObjectMapTPM; // texels per meter on map
+ F32 mObjectMapPixels; // Width of object map in pixels
+ F32 mDotRadius; // Size of avatar markers
bool mPanning; // map is being dragged
bool mCentering; // map is being re-centered around the agent
@@ -134,12 +134,12 @@ private:
LLVector3d mPopupWorldPos; // world position picked under mouse when context menu is opened
LLCoordGL mMouseDown; // pointer position at start of drag
- LLVector3d mObjectImageCenterGlobal;
- LLPointer<LLImageRaw> mObjectRawImagep;
- LLPointer<LLViewerTexture> mObjectImagep;
+ LLVector3d mObjectImageCenterGlobal;
+ LLPointer<LLImageRaw> mObjectRawImagep;
+ LLPointer<LLViewerTexture> mObjectImagep;
- LLUUID mClosestAgentToCursor;
- LLUUID mClosestAgentAtLastRightClick;
+ LLUUID mClosestAgentToCursor;
+ LLUUID mClosestAgentAtLastRightClick;
std::string mToolTipMsg;
std::string mParcelNameMsg;
@@ -151,7 +151,7 @@ private:
std::string mAltToolTipHintMsg;
public:
- void setSelected(uuid_vec_t uuids) { gmSelected=uuids; };
+ void setSelected(uuid_vec_t uuids) { gmSelected=uuids; };
private:
bool isZoomChecked(const LLSD& userdata);
@@ -163,7 +163,7 @@ private:
void popupShowAboutLand(const LLSD& userdata);
LLHandle<LLView> mPopupMenuHandle;
- uuid_vec_t gmSelected;
+ uuid_vec_t gmSelected;
};
diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp
index 90b9cdc133..792a7fd745 100644
--- a/indra/newview/llnotificationalerthandler.cpp
+++ b/indra/newview/llnotificationalerthandler.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationalerthandler.cpp
* @brief Notification Handler Class for Alert Notifications
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,19 +41,19 @@
using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
-LLAlertHandler::LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal)
-: LLSystemNotificationHandler(name, notification_type),
- mIsModal(is_modal)
+LLAlertHandler::LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal)
+: LLSystemNotificationHandler(name, notification_type),
+ mIsModal(is_modal)
{
- LLScreenChannelBase::Params p;
- p.id = LLUUID(gSavedSettings.getString("AlertChannelUUID"));
- p.display_toasts_always = true;
- p.toast_align = NA_CENTRE;
- p.channel_align = CA_CENTRE;
-
- // Getting a Channel for our notifications
- mChannel = LLChannelManager::getInstance()->getChannel(p)->getHandle();
- mChannel.get()->setCanStoreToasts(false);
+ LLScreenChannelBase::Params p;
+ p.id = LLUUID(gSavedSettings.getString("AlertChannelUUID"));
+ p.display_toasts_always = true;
+ p.toast_align = NA_CENTRE;
+ p.channel_align = CA_CENTRE;
+
+ // Getting a Channel for our notifications
+ mChannel = LLChannelManager::getInstance()->getChannel(p)->getHandle();
+ mChannel.get()->setCanStoreToasts(false);
}
//--------------------------------------------------------------------------
@@ -64,88 +64,88 @@ LLAlertHandler::~LLAlertHandler()
//--------------------------------------------------------------------------
void LLAlertHandler::initChannel()
{
- S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().getWidth() / 2;
- mChannel.get()->init(channel_right_bound, channel_right_bound);
+ S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().getWidth() / 2;
+ mChannel.get()->init(channel_right_bound, channel_right_bound);
}
//--------------------------------------------------------------------------
bool LLAlertHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
{
- if(mChannel.isDead())
- {
- return false;
- }
-
- // arrange a channel on a screen
- if(!mChannel.get()->getVisible())
- {
- initChannel();
- }
-
- if (notification->canLogToIM() && notification->hasFormElements())
- {
- const std::string name = LLHandlerUtil::getSubstitutionName(notification);
-
- LLUUID from_id = notification->getPayload()["from_id"];
-
- // firstly create session...
- LLHandlerUtil::spawnIMSession(name, from_id);
-
- // ...then log message to have IM Well notified about new message
- LLHandlerUtil::logToIMP2P(notification);
- }
-
- LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = dynamic_cast<LLToastPanel*>(alert_dialog);
- p.enable_hide_btn = false;
- p.can_fade = false;
- p.is_modal = mIsModal;
- p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1);
-
- // Show alert in middle of progress view (during teleport) (EXT-1093)
- LLProgressView* progress = gViewerWindow->getProgressView();
- LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled();
- mChannel.get()->updatePositionAndSize(rc);
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
- if(channel)
- channel->addToast(p);
-
- return false;
+ if(mChannel.isDead())
+ {
+ return false;
+ }
+
+ // arrange a channel on a screen
+ if(!mChannel.get()->getVisible())
+ {
+ initChannel();
+ }
+
+ if (notification->canLogToIM() && notification->hasFormElements())
+ {
+ const std::string name = LLHandlerUtil::getSubstitutionName(notification);
+
+ LLUUID from_id = notification->getPayload()["from_id"];
+
+ // firstly create session...
+ LLHandlerUtil::spawnIMSession(name, from_id);
+
+ // ...then log message to have IM Well notified about new message
+ LLHandlerUtil::logToIMP2P(notification);
+ }
+
+ LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.panel = dynamic_cast<LLToastPanel*>(alert_dialog);
+ p.enable_hide_btn = false;
+ p.can_fade = false;
+ p.is_modal = mIsModal;
+ p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1);
+
+ // Show alert in middle of progress view (during teleport) (EXT-1093)
+ LLProgressView* progress = gViewerWindow->getProgressView();
+ LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled();
+ mChannel.get()->updatePositionAndSize(rc);
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if(channel)
+ channel->addToast(p);
+
+ return false;
}
void LLAlertHandler::onChange( LLNotificationPtr notification )
{
- LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
- if(channel)
- channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog);
+ LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if(channel)
+ channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog);
}
//--------------------------------------------------------------------------
LLViewerAlertHandler::LLViewerAlertHandler(const std::string& name, const std::string& notification_type)
- : LLSystemNotificationHandler(name, notification_type)
+ : LLSystemNotificationHandler(name, notification_type)
{
}
bool LLViewerAlertHandler::processNotification(const LLNotificationPtr& p, bool should_log)
{
- if (gHeadlessClient)
- {
- LL_INFOS("LLViewerAlertHandler") << "Alert: " << p->getName() << LL_ENDL;
- }
-
- // If we're in mouselook, the mouse is hidden and so the user can't click
- // the dialog buttons. In that case, change to First Person instead.
- if( gAgentCamera.cameraMouselook() )
- {
- gAgentCamera.changeCameraToDefault();
- }
-
- return false;
+ if (gHeadlessClient)
+ {
+ LL_INFOS("LLViewerAlertHandler") << "Alert: " << p->getName() << LL_ENDL;
+ }
+
+ // If we're in mouselook, the mouse is hidden and so the user can't click
+ // the dialog buttons. In that case, change to First Person instead.
+ if( gAgentCamera.cameraMouselook() )
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+
+ return false;
}
diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp
index f87ebf219b..db640bdcab 100644
--- a/indra/newview/llnotificationgrouphandler.cpp
+++ b/indra/newview/llnotificationgrouphandler.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationgrouphandler.cpp
* @brief Notification Handler Class for Group Notifications
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,14 +38,14 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLGroupHandler::LLGroupHandler()
-: LLCommunicationNotificationHandler("Group Notifications", "groupnotify")
+: LLCommunicationNotificationHandler("Group Notifications", "groupnotify")
{
- // Getting a Channel for our notifications
- LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
- if(channel)
- {
- mChannel = channel->getHandle();
- }
+ // Getting a Channel for our notifications
+ LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
+ if(channel)
+ {
+ mChannel = channel->getHandle();
+ }
}
//--------------------------------------------------------------------------
@@ -56,41 +56,41 @@ LLGroupHandler::~LLGroupHandler()
//--------------------------------------------------------------------------
void LLGroupHandler::initChannel()
{
- S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
- S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
- mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
+ S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
+ S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
+ mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
}
//--------------------------------------------------------------------------
bool LLGroupHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
{
- if(mChannel.isDead())
- {
- return false;
- }
-
- // arrange a channel on a screen
- if(!mChannel.get()->getVisible())
- {
- initChannel();
- }
-
- LLHandlerUtil::logGroupNoticeToIMGroup(notification);
-
- LLPanel* notify_box = new LLToastGroupNotifyPanel(notification);
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = notify_box;
- p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1);
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
- if(channel)
- channel->addToast(p);
-
- LLGroupActions::refresh_notices();
-
- return false;
+ if(mChannel.isDead())
+ {
+ return false;
+ }
+
+ // arrange a channel on a screen
+ if(!mChannel.get()->getVisible())
+ {
+ initChannel();
+ }
+
+ LLHandlerUtil::logGroupNoticeToIMGroup(notification);
+
+ LLPanel* notify_box = new LLToastGroupNotifyPanel(notification);
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.panel = notify_box;
+ p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1);
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if(channel)
+ channel->addToast(p);
+
+ LLGroupActions::refresh_notices();
+
+ return false;
}
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index ddc957c941..a259a4b248 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationhandler.h
* @brief Here are implemented Notification Handling Classes.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,80 +51,80 @@ namespace LLNotificationsUI
// LLEventHandler is a base class that specifies a common interface for all
// notification handlers. It states, that every handler must react on the follofing
// events:
-// - deleting of a toast;
-// - initialization of a corresponding channel;
+// - deleting of a toast;
+// - initialization of a corresponding channel;
// Also every handler must have the following attributes:
-// - type of the notification that this handler is responsible to;
-// - pointer to a correspondent screen channel, in which all toasts of the handled notification's
-// type should be displayed
+// - type of the notification that this handler is responsible to;
+// - pointer to a correspondent screen channel, in which all toasts of the handled notification's
+// type should be displayed
// This class also provides the following signald:
-// - increment counter signal
-// - decrement counter signal
-// - update counter signal
-// - signal, that emits ID of the notification that is being processed
+// - increment counter signal
+// - decrement counter signal
+// - update counter signal
+// - signal, that emits ID of the notification that is being processed
//
class LLEventHandler
{
public:
- virtual ~LLEventHandler() {};
+ virtual ~LLEventHandler() {};
protected:
- virtual void onDeleteToast(LLToast* toast) {}
+ virtual void onDeleteToast(LLToast* toast) {}
- // arrange handler's channel on a screen
- // is necessary to unbind a moment of creation of a channel and a moment of positioning of it
- // it is useful when positioning depends on positions of other controls, that could not be created
- // at the moment, when a handlers creates a channel.
- virtual void initChannel()=0;
+ // arrange handler's channel on a screen
+ // is necessary to unbind a moment of creation of a channel and a moment of positioning of it
+ // it is useful when positioning depends on positions of other controls, that could not be created
+ // at the moment, when a handlers creates a channel.
+ virtual void initChannel()=0;
- LLHandle<LLScreenChannelBase> mChannel;
+ LLHandle<LLScreenChannelBase> mChannel;
};
// LLSysHandler and LLChatHandler are more specific base classes
// that divide all notification handlers on to groups:
-// - handlers for different system notifications (script dialogs, tips, group notices, alerts and IMs);
-// - handlers for different messaging notifications (nearby chat)
+// - handlers for different system notifications (script dialogs, tips, group notices, alerts and IMs);
+// - handlers for different messaging notifications (nearby chat)
/**
* Handler for system notifications.
*/
class LLNotificationHandler : public LLEventHandler, public LLNotificationChannel
{
public:
- LLNotificationHandler(const std::string& name, const std::string& notification_type, const std::string& parentName);
- virtual ~LLNotificationHandler() {};
+ LLNotificationHandler(const std::string& name, const std::string& notification_type, const std::string& parentName);
+ virtual ~LLNotificationHandler() {};
- // base interface functions
- virtual void onAdd(LLNotificationPtr p) { processNotification(p); }
- virtual void onChange(LLNotificationPtr p) { processNotification(p); }
- virtual void onLoad(LLNotificationPtr p) { processNotification(p, false); }
- virtual void onDelete(LLNotificationPtr p) { if (mChannel.get()) mChannel.get()->removeToastByNotificationID(p->getID());}
+ // base interface functions
+ virtual void onAdd(LLNotificationPtr p) { processNotification(p); }
+ virtual void onChange(LLNotificationPtr p) { processNotification(p); }
+ virtual void onLoad(LLNotificationPtr p) { processNotification(p, false); }
+ virtual void onDelete(LLNotificationPtr p) { if (mChannel.get()) mChannel.get()->removeToastByNotificationID(p->getID());}
- virtual bool processNotification(const LLNotificationPtr& notify, bool should_log = true) = 0;
+ virtual bool processNotification(const LLNotificationPtr& notify, bool should_log = true) = 0;
};
class LLSystemNotificationHandler : public LLNotificationHandler
{
public:
- LLSystemNotificationHandler(const std::string& name, const std::string& notification_type);
- virtual ~LLSystemNotificationHandler() {};
+ LLSystemNotificationHandler(const std::string& name, const std::string& notification_type);
+ virtual ~LLSystemNotificationHandler() {};
};
class LLCommunicationNotificationHandler : public LLNotificationHandler
{
public:
- LLCommunicationNotificationHandler(const std::string& name, const std::string& notification_type);
- virtual ~LLCommunicationNotificationHandler() {};
+ LLCommunicationNotificationHandler(const std::string& name, const std::string& notification_type);
+ virtual ~LLCommunicationNotificationHandler() {};
};
/**
- * Handler for chat message notifications.
+ * Handler for chat message notifications.
*/
class LLChatHandler : public LLEventHandler
{
public:
- virtual ~LLChatHandler() {};
+ virtual ~LLChatHandler() {};
- virtual void processChat(const LLChat& chat_msg, const LLSD &args)=0;
+ virtual void processChat(const LLChat& chat_msg, const LLSD &args)=0;
};
/**
@@ -134,12 +134,12 @@ public:
class LLIMHandler : public LLCommunicationNotificationHandler
{
public:
- LLIMHandler();
- virtual ~LLIMHandler();
- bool processNotification(const LLNotificationPtr& p, bool should_log = true);
+ LLIMHandler();
+ virtual ~LLIMHandler();
+ bool processNotification(const LLNotificationPtr& p, bool should_log = true);
protected:
- virtual void initChannel();
+ virtual void initChannel();
};
/**
@@ -149,13 +149,13 @@ protected:
class LLTipHandler : public LLSystemNotificationHandler
{
public:
- LLTipHandler();
- virtual ~LLTipHandler();
+ LLTipHandler();
+ virtual ~LLTipHandler();
- virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
+ virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
protected:
- virtual void initChannel();
+ virtual void initChannel();
};
/**
@@ -165,17 +165,17 @@ protected:
class LLScriptHandler : public LLSystemNotificationHandler
{
public:
- LLScriptHandler();
- virtual ~LLScriptHandler();
+ LLScriptHandler();
+ virtual ~LLScriptHandler();
- virtual void onDelete(LLNotificationPtr p);
- virtual void onChange(LLNotificationPtr p);
- virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
- virtual void addToastWithNotification(const LLNotificationPtr& p);
+ virtual void onDelete(LLNotificationPtr p);
+ virtual void onChange(LLNotificationPtr p);
+ virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
+ virtual void addToastWithNotification(const LLNotificationPtr& p);
protected:
- virtual void onDeleteToast(LLToast* toast);
- virtual void initChannel();
+ virtual void onDeleteToast(LLToast* toast);
+ virtual void initChannel();
};
@@ -185,13 +185,13 @@ protected:
class LLGroupHandler : public LLCommunicationNotificationHandler
{
public:
- LLGroupHandler();
- virtual ~LLGroupHandler();
-
- virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
+ LLGroupHandler();
+ virtual ~LLGroupHandler();
+
+ virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
protected:
- virtual void initChannel();
+ virtual void initChannel();
};
/**
@@ -200,30 +200,30 @@ protected:
class LLAlertHandler : public LLSystemNotificationHandler
{
public:
- LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal);
- virtual ~LLAlertHandler();
+ LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal);
+ virtual ~LLAlertHandler();
- virtual void onChange(LLNotificationPtr p);
- virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
+ virtual void onChange(LLNotificationPtr p);
+ virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
protected:
- virtual void initChannel();
+ virtual void initChannel();
- bool mIsModal;
+ bool mIsModal;
};
class LLViewerAlertHandler : public LLSystemNotificationHandler
{
- LOG_CLASS(LLViewerAlertHandler);
+ LOG_CLASS(LLViewerAlertHandler);
public:
- LLViewerAlertHandler(const std::string& name, const std::string& notification_type);
- virtual ~LLViewerAlertHandler() {};
+ LLViewerAlertHandler(const std::string& name, const std::string& notification_type);
+ virtual ~LLViewerAlertHandler() {};
- virtual void onDelete(LLNotificationPtr p) {};
- virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
+ virtual void onDelete(LLNotificationPtr p) {};
+ virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
protected:
- virtual void initChannel() {};
+ virtual void initChannel() {};
};
/**
@@ -233,15 +233,15 @@ protected:
class LLOfferHandler : public LLCommunicationNotificationHandler
{
public:
- LLOfferHandler();
- virtual ~LLOfferHandler();
+ LLOfferHandler();
+ virtual ~LLOfferHandler();
- virtual void onChange(LLNotificationPtr p);
- virtual void onDelete(LLNotificationPtr notification);
- virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
+ virtual void onChange(LLNotificationPtr p);
+ virtual void onDelete(LLNotificationPtr notification);
+ virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
protected:
- virtual void initChannel();
+ virtual void initChannel();
};
/**
@@ -250,16 +250,16 @@ protected:
class LLHintHandler : public LLSystemNotificationHandler
{
public:
- LLHintHandler();
- virtual ~LLHintHandler() {}
+ LLHintHandler();
+ virtual ~LLHintHandler() {}
- virtual void onAdd(LLNotificationPtr p);
- virtual void onLoad(LLNotificationPtr p);
- virtual void onDelete(LLNotificationPtr p);
- virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
+ virtual void onAdd(LLNotificationPtr p);
+ virtual void onLoad(LLNotificationPtr p);
+ virtual void onDelete(LLNotificationPtr p);
+ virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
protected:
- virtual void initChannel() {};
+ virtual void initChannel() {};
};
/**
@@ -268,82 +268,82 @@ protected:
class LLBrowserNotification : public LLSystemNotificationHandler
{
public:
- LLBrowserNotification();
- virtual ~LLBrowserNotification() {}
+ LLBrowserNotification();
+ virtual ~LLBrowserNotification() {}
- virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
+ virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
protected:
- virtual void initChannel() {};
+ virtual void initChannel() {};
};
-
+
class LLHandlerUtil
{
public:
- /**
- * Determines whether IM floater is opened.
- */
- static bool isIMFloaterOpened(const LLNotificationPtr& notification);
-
- /**
- * Writes notification message to IM session.
- */
- static void logToIM(const EInstantMessage& session_type,
- const std::string& session_name, const std::string& from_name,
- const std::string& message, const LLUUID& session_owner_id,
- const LLUUID& from_id);
-
- /**
- * Writes notification message to IM p2p session.
- */
- static void logToIMP2P(const LLNotificationPtr& notification, bool to_file_only = false);
- static void logToIMP2P(const LLUUID& from_id, const std::string& message, bool to_file_only = false);
-
- /**
- * Writes group notice notification message to IM group session.
- */
- static void logGroupNoticeToIMGroup(const LLNotificationPtr& notification);
-
- /**
- * Writes notification message to nearby chat.
- */
- static void logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type);
-
- /**
- * Spawns IM session.
- */
- static LLUUID spawnIMSession(const std::string& name, const LLUUID& from_id);
-
- /**
- * Returns name from the notification's substitution.
- *
- * Methods gets "NAME" or "[NAME]" from the substitution map.
- *
- * @param notification - Notification which substitution's name will be returned.
- */
- static std::string getSubstitutionName(const LLNotificationPtr& notification);
-
- static std::string getSubstitutionOriginalName(const LLNotificationPtr& notification);
-
- /**
- * Adds notification panel to the IM floater.
- */
- static void addNotifPanelToIM(const LLNotificationPtr& notification);
-
- /**
- * Updates messages of IM floater.
- */
- static void updateIMFLoaterMesages(const LLUUID& session_id);
-
- /**
- * Updates messages of visible IM floater.
- */
- static void updateVisibleIMFLoaterMesages(const LLNotificationPtr& notification);
-
- /**
- * Decrements counter of IM messages.
- */
- static void decIMMesageCounter(const LLNotificationPtr& notification);
+ /**
+ * Determines whether IM floater is opened.
+ */
+ static bool isIMFloaterOpened(const LLNotificationPtr& notification);
+
+ /**
+ * Writes notification message to IM session.
+ */
+ static void logToIM(const EInstantMessage& session_type,
+ const std::string& session_name, const std::string& from_name,
+ const std::string& message, const LLUUID& session_owner_id,
+ const LLUUID& from_id);
+
+ /**
+ * Writes notification message to IM p2p session.
+ */
+ static void logToIMP2P(const LLNotificationPtr& notification, bool to_file_only = false);
+ static void logToIMP2P(const LLUUID& from_id, const std::string& message, bool to_file_only = false);
+
+ /**
+ * Writes group notice notification message to IM group session.
+ */
+ static void logGroupNoticeToIMGroup(const LLNotificationPtr& notification);
+
+ /**
+ * Writes notification message to nearby chat.
+ */
+ static void logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type);
+
+ /**
+ * Spawns IM session.
+ */
+ static LLUUID spawnIMSession(const std::string& name, const LLUUID& from_id);
+
+ /**
+ * Returns name from the notification's substitution.
+ *
+ * Methods gets "NAME" or "[NAME]" from the substitution map.
+ *
+ * @param notification - Notification which substitution's name will be returned.
+ */
+ static std::string getSubstitutionName(const LLNotificationPtr& notification);
+
+ static std::string getSubstitutionOriginalName(const LLNotificationPtr& notification);
+
+ /**
+ * Adds notification panel to the IM floater.
+ */
+ static void addNotifPanelToIM(const LLNotificationPtr& notification);
+
+ /**
+ * Updates messages of IM floater.
+ */
+ static void updateIMFLoaterMesages(const LLUUID& session_id);
+
+ /**
+ * Updates messages of visible IM floater.
+ */
+ static void updateVisibleIMFLoaterMesages(const LLNotificationPtr& notification);
+
+ /**
+ * Decrements counter of IM messages.
+ */
+ static void decIMMesageCounter(const LLNotificationPtr& notification);
};
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 85adfaab55..77ab242d3b 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,290 +42,290 @@
using namespace LLNotificationsUI;
LLNotificationHandler::LLNotificationHandler(const std::string& name, const std::string& notification_type, const std::string& parentName)
-: LLNotificationChannel(name, parentName, LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, notification_type))
+: LLNotificationChannel(name, parentName, LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, notification_type))
{}
LLSystemNotificationHandler::LLSystemNotificationHandler(const std::string& name, const std::string& notification_type)
- : LLNotificationHandler(name, notification_type, "System")
+ : LLNotificationHandler(name, notification_type, "System")
{}
LLCommunicationNotificationHandler::LLCommunicationNotificationHandler(const std::string& name, const std::string& notification_type)
- : LLNotificationHandler(name, notification_type, "Communication")
+ : LLNotificationHandler(name, notification_type, "Communication")
{}
// static
bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification)
{
- bool res = false;
+ bool res = false;
- LLUUID from_id = notification->getPayload()["from_id"];
- LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
- LLFloaterIMSession* im_floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id);
+ LLUUID from_id = notification->getPayload()["from_id"];
+ LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
+ LLFloaterIMSession* im_floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id);
- if (im_floater != NULL)
- {
- res = im_floater->getVisible() == TRUE;
- }
+ if (im_floater != NULL)
+ {
+ res = im_floater->getVisible() == TRUE;
+ }
- return res;
+ return res;
}
// static
void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
- const std::string& session_name, const std::string& from_name,
- const std::string& message, const LLUUID& session_owner_id,
- const LLUUID& from_id)
+ const std::string& session_name, const std::string& from_name,
+ const std::string& message, const LLUUID& session_owner_id,
+ const LLUUID& from_id)
{
- std::string from = from_name;
- if (from_name.empty())
- {
- from = SYSTEM_FROM;
- }
-
- LLUUID session_id = LLIMMgr::computeSessionID(session_type,
- session_owner_id);
- LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
- session_id);
- if (session == NULL)
- {
- // replace interactive system message marker with correct from string value
- if (INTERACTIVE_SYSTEM_FROM == from_name)
- {
- from = SYSTEM_FROM;
- }
-
- // Build a new format username or firstname_lastname for legacy names
- // to use it for a history log filename.
- std::string user_name = LLCacheName::buildUsername(session_name);
- LLIMModel::instance().logToFile(user_name, from, from_id, message);
- }
- else
- {
- S32 unread = session->mNumUnread;
- S32 participant_unread = session->mParticipantUnreadMessageCount;
- LLIMModel::instance().addMessageSilently(session_id, from, from_id,
- message);
- // we shouldn't increment counters when logging, so restore them
- session->mNumUnread = unread;
- session->mParticipantUnreadMessageCount = participant_unread;
-
- // update IM floater messages
- updateIMFLoaterMesages(session_id);
- }
+ std::string from = from_name;
+ if (from_name.empty())
+ {
+ from = SYSTEM_FROM;
+ }
+
+ LLUUID session_id = LLIMMgr::computeSessionID(session_type,
+ session_owner_id);
+ LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
+ session_id);
+ if (session == NULL)
+ {
+ // replace interactive system message marker with correct from string value
+ if (INTERACTIVE_SYSTEM_FROM == from_name)
+ {
+ from = SYSTEM_FROM;
+ }
+
+ // Build a new format username or firstname_lastname for legacy names
+ // to use it for a history log filename.
+ std::string user_name = LLCacheName::buildUsername(session_name);
+ LLIMModel::instance().logToFile(user_name, from, from_id, message);
+ }
+ else
+ {
+ S32 unread = session->mNumUnread;
+ S32 participant_unread = session->mParticipantUnreadMessageCount;
+ LLIMModel::instance().addMessageSilently(session_id, from, from_id,
+ message);
+ // we shouldn't increment counters when logging, so restore them
+ session->mNumUnread = unread;
+ session->mParticipantUnreadMessageCount = participant_unread;
+
+ // update IM floater messages
+ updateIMFLoaterMesages(session_id);
+ }
}
-void log_name_callback(const LLAvatarName& av_name, const std::string& from_name,
- const std::string& message, const LLUUID& from_id)
+void log_name_callback(const LLAvatarName& av_name, const std::string& from_name,
+ const std::string& message, const LLUUID& from_id)
{
- LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, av_name.getUserName(), from_name, message,
- from_id, LLUUID());
+ LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, av_name.getUserName(), from_name, message,
+ from_id, LLUUID());
}
// static
void LLHandlerUtil::logToIMP2P(const LLUUID& from_id, const std::string& message, bool to_file_only)
{
- if (!gCacheName)
- {
- return;
- }
-
- if (from_id.isNull())
- {
- // Normal behavior for system generated messages, don't spam.
- // LL_WARNS() << " from_id for notification " << notification->getName() << " is null " << LL_ENDL;
- return;
- }
-
- if(to_file_only)
- {
- LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, "", message, LLUUID()));
- }
- else
- {
- LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, message, from_id));
- }
+ if (!gCacheName)
+ {
+ return;
+ }
+
+ if (from_id.isNull())
+ {
+ // Normal behavior for system generated messages, don't spam.
+ // LL_WARNS() << " from_id for notification " << notification->getName() << " is null " << LL_ENDL;
+ return;
+ }
+
+ if(to_file_only)
+ {
+ LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, "", message, LLUUID()));
+ }
+ else
+ {
+ LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, message, from_id));
+ }
}
// static
void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only)
{
- LLUUID from_id = notification->getPayload()["from_id"];
- logToIMP2P(from_id, notification->getMessage(), to_file_only);
+ LLUUID from_id = notification->getPayload()["from_id"];
+ logToIMP2P(from_id, notification->getMessage(), to_file_only);
}
// static
void LLHandlerUtil::logGroupNoticeToIMGroup(
- const LLNotificationPtr& notification)
+ const LLNotificationPtr& notification)
{
- const LLSD& payload = notification->getPayload();
- LLGroupData groupData;
- if (!gAgent.getGroupData(payload["group_id"].asUUID(), groupData))
- {
- LL_WARNS()
- << "Group notice for unknown group: "
- << payload["group_id"].asUUID() << LL_ENDL;
- return;
- }
-
- const std::string group_name = groupData.mName;
- const std::string sender_name = payload["sender_name"].asString();
-
- LLUUID sender_id;
- if (payload.has("sender_id"))
- {
- sender_id = payload["sender_id"].asUUID();
- }
-
- if (sender_id.notNull())
- {
- // Legacy support and fallback method
- // if we can't retrieve sender id from group notice system message, try to lookup it from cache
- sender_id = LLAvatarNameCache::getInstance()->findIdByName(sender_name);
- }
-
- logToIM(IM_SESSION_GROUP_START, group_name, sender_name, payload["message"],
- payload["group_id"], sender_id);
+ const LLSD& payload = notification->getPayload();
+ LLGroupData groupData;
+ if (!gAgent.getGroupData(payload["group_id"].asUUID(), groupData))
+ {
+ LL_WARNS()
+ << "Group notice for unknown group: "
+ << payload["group_id"].asUUID() << LL_ENDL;
+ return;
+ }
+
+ const std::string group_name = groupData.mName;
+ const std::string sender_name = payload["sender_name"].asString();
+
+ LLUUID sender_id;
+ if (payload.has("sender_id"))
+ {
+ sender_id = payload["sender_id"].asUUID();
+ }
+
+ if (sender_id.notNull())
+ {
+ // Legacy support and fallback method
+ // if we can't retrieve sender id from group notice system message, try to lookup it from cache
+ sender_id = LLAvatarNameCache::getInstance()->findIdByName(sender_name);
+ }
+
+ logToIM(IM_SESSION_GROUP_START, group_name, sender_name, payload["message"],
+ payload["group_id"], sender_id);
}
// static
void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type)
{
LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if (nearby_chat)
- {
- LLChat chat_msg(notification->getMessage());
- chat_msg.mSourceType = type;
- chat_msg.mFromName = SYSTEM_FROM;
- chat_msg.mFromID = LLUUID::null;
- nearby_chat->addMessage(chat_msg);
- }
+ if (nearby_chat)
+ {
+ LLChat chat_msg(notification->getMessage());
+ chat_msg.mSourceType = type;
+ chat_msg.mFromName = SYSTEM_FROM;
+ chat_msg.mFromID = LLUUID::null;
+ nearby_chat->addMessage(chat_msg);
+ }
}
// static
LLUUID LLHandlerUtil::spawnIMSession(const std::string& name, const LLUUID& from_id)
{
- LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
+ LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
- LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
- session_id);
- if (session == NULL)
- {
- session_id = LLIMMgr::instance().addSession(name, IM_NOTHING_SPECIAL, from_id);
- }
+ LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
+ session_id);
+ if (session == NULL)
+ {
+ session_id = LLIMMgr::instance().addSession(name, IM_NOTHING_SPECIAL, from_id);
+ }
- return session_id;
+ return session_id;
}
// static
std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notification)
{
- std::string res = notification->getSubstitutions().has("NAME")
- ? notification->getSubstitutions()["NAME"]
- : notification->getSubstitutions()["[NAME]"];
- if (res.empty())
- {
- LLUUID from_id = notification->getPayload()["FROM_ID"];
-
- //*TODO all keys everywhere should be made of the same case, there is a mix of keys in lower and upper cases
- if (from_id.isNull())
- {
- from_id = notification->getPayload()["from_id"];
- }
- LLAvatarName av_name;
- if(LLAvatarNameCache::get(from_id, &av_name))
- {
- res = av_name.getUserName();
- }
- else
- {
- res = "";
- }
- }
- return res;
+ std::string res = notification->getSubstitutions().has("NAME")
+ ? notification->getSubstitutions()["NAME"]
+ : notification->getSubstitutions()["[NAME]"];
+ if (res.empty())
+ {
+ LLUUID from_id = notification->getPayload()["FROM_ID"];
+
+ //*TODO all keys everywhere should be made of the same case, there is a mix of keys in lower and upper cases
+ if (from_id.isNull())
+ {
+ from_id = notification->getPayload()["from_id"];
+ }
+ LLAvatarName av_name;
+ if(LLAvatarNameCache::get(from_id, &av_name))
+ {
+ res = av_name.getUserName();
+ }
+ else
+ {
+ res = "";
+ }
+ }
+ return res;
}
// static
std::string LLHandlerUtil::getSubstitutionOriginalName(const LLNotificationPtr& notification)
{
- if(notification->getSubstitutions().has("ORIGINAL_NAME"))
- {
- std::string name = notification->getSubstitutions()["ORIGINAL_NAME"];
- if(!name.empty())
- {
- return name;
- }
- }
- return LLHandlerUtil::getSubstitutionName(notification);
+ if(notification->getSubstitutions().has("ORIGINAL_NAME"))
+ {
+ std::string name = notification->getSubstitutions()["ORIGINAL_NAME"];
+ if(!name.empty())
+ {
+ return name;
+ }
+ }
+ return LLHandlerUtil::getSubstitutionName(notification);
}
// static
void LLHandlerUtil::addNotifPanelToIM(const LLNotificationPtr& notification)
{
- const std::string name = LLHandlerUtil::getSubstitutionName(notification);
- LLUUID from_id = notification->getPayload()["from_id"];
-
- LLUUID session_id = spawnIMSession(name, from_id);
- // add offer to session
- LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession(
- session_id);
- llassert_always(session != NULL);
-
- LLSD offer;
- offer["notification_id"] = notification->getID();
- offer["from"] = SYSTEM_FROM;
- offer["time"] = LLLogChat::timestamp2LogString(0, false); // Use current time
- offer["index"] = (LLSD::Integer)session->mMsgs.size();
- session->mMsgs.push_front(offer);
-
-
- // update IM floater and counters
- LLSD arg;
- arg["session_id"] = session_id;
- arg["num_unread"] = ++(session->mNumUnread);
- arg["participant_unread"] = ++(session->mParticipantUnreadMessageCount);
- LLIMModel::getInstance()->mNewMsgSignal(arg);
+ const std::string name = LLHandlerUtil::getSubstitutionName(notification);
+ LLUUID from_id = notification->getPayload()["from_id"];
+
+ LLUUID session_id = spawnIMSession(name, from_id);
+ // add offer to session
+ LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession(
+ session_id);
+ llassert_always(session != NULL);
+
+ LLSD offer;
+ offer["notification_id"] = notification->getID();
+ offer["from"] = SYSTEM_FROM;
+ offer["time"] = LLLogChat::timestamp2LogString(0, false); // Use current time
+ offer["index"] = (LLSD::Integer)session->mMsgs.size();
+ session->mMsgs.push_front(offer);
+
+
+ // update IM floater and counters
+ LLSD arg;
+ arg["session_id"] = session_id;
+ arg["num_unread"] = ++(session->mNumUnread);
+ arg["participant_unread"] = ++(session->mParticipantUnreadMessageCount);
+ LLIMModel::getInstance()->mNewMsgSignal(arg);
}
// static
void LLHandlerUtil::updateIMFLoaterMesages(const LLUUID& session_id)
{
- LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
- if (im_floater != NULL && im_floater->getVisible())
- {
- im_floater->updateMessages();
- }
+ LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
+ if (im_floater != NULL && im_floater->getVisible())
+ {
+ im_floater->updateMessages();
+ }
}
// static
void LLHandlerUtil::updateVisibleIMFLoaterMesages(const LLNotificationPtr& notification)
{
- const std::string name = LLHandlerUtil::getSubstitutionName(notification);
- LLUUID from_id = notification->getPayload()["from_id"];
- LLUUID session_id = spawnIMSession(name, from_id);
+ const std::string name = LLHandlerUtil::getSubstitutionName(notification);
+ LLUUID from_id = notification->getPayload()["from_id"];
+ LLUUID session_id = spawnIMSession(name, from_id);
- updateIMFLoaterMesages(session_id);
+ updateIMFLoaterMesages(session_id);
}
// static
void LLHandlerUtil::decIMMesageCounter(const LLNotificationPtr& notification)
{
- const std::string name = LLHandlerUtil::getSubstitutionName(notification);
- LLUUID from_id = notification->getPayload()["from_id"];
- LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
-
- LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession(session_id);
-
- if (session)
- {
- LLSD arg;
- arg["session_id"] = session_id;
- session->mNumUnread--;
- arg["num_unread"] = session->mNumUnread;
- session->mParticipantUnreadMessageCount--;
- arg["participant_unread"] = session->mParticipantUnreadMessageCount;
- LLIMModel::getInstance()->mNewMsgSignal(arg);
+ const std::string name = LLHandlerUtil::getSubstitutionName(notification);
+ LLUUID from_id = notification->getPayload()["from_id"];
+ LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
+
+ LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession(session_id);
+
+ if (session)
+ {
+ LLSD arg;
+ arg["session_id"] = session_id;
+ session->mNumUnread--;
+ arg["num_unread"] = session->mNumUnread;
+ session->mParticipantUnreadMessageCount--;
+ arg["participant_unread"] = session->mParticipantUnreadMessageCount;
+ LLIMModel::getInstance()->mNewMsgSignal(arg);
}
}
diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp
index 44ebc5ed47..2ced7f29a3 100644
--- a/indra/newview/llnotificationhinthandler.cpp
+++ b/indra/newview/llnotificationhinthandler.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,26 +34,26 @@
using namespace LLNotificationsUI;
LLHintHandler::LLHintHandler()
- : LLSystemNotificationHandler("Hints", "hint")
+ : LLSystemNotificationHandler("Hints", "hint")
{
}
void LLHintHandler::onAdd(LLNotificationPtr p)
{
- LLHints::getInstance()->show(p);
+ LLHints::getInstance()->show(p);
}
void LLHintHandler::onLoad(LLNotificationPtr p)
{
- LLHints::getInstance()->show(p);
+ LLHints::getInstance()->show(p);
}
void LLHintHandler::onDelete(LLNotificationPtr p)
{
- LLHints::getInstance()->hide(p);
+ LLHints::getInstance()->hide(p);
}
bool LLHintHandler::processNotification(const LLNotificationPtr& p, bool should_log)
{
- return false;
+ return false;
}
diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp
index f86edfd0cf..62349f43b1 100644
--- a/indra/newview/llnotificationlistitem.cpp
+++ b/indra/newview/llnotificationlistitem.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationlistitem.cpp
- * @brief
+ * @brief
*
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -60,7 +60,7 @@ BOOL LLNotificationListItem::postBuild()
{
BOOL rv = LLPanel::postBuild();
mTitleBox = getChild<LLTextBox>("notification_title");
- mTitleBoxExp = getChild<LLTextBox>("notification_title_exp");
+ mTitleBoxExp = getChild<LLTextBox>("notification_title_exp");
mNoticeTextExp = getChild<LLChatEntry>("notification_text_exp");
mTimeBox = getChild<LLTextBox>("notification_time");
@@ -98,7 +98,7 @@ BOOL LLNotificationListItem::postBuild()
mExpandedHeight = (S32)atoi(expanded_height_str.c_str());
mCondensedHeight = (S32)atoi(condensed_height_str.c_str());
-
+
setExpanded(FALSE);
return rv;
@@ -112,33 +112,33 @@ LLNotificationListItem::~LLNotificationListItem()
std::string LLNotificationListItem::buildNotificationDate(const LLDate& time_stamp, ETimeType time_type)
{
std::string timeStr;
- switch(time_type)
- {
- case Local:
- timeStr = "[" + LLTrans::getString("LTimeMthNum") + "]/["
- +LLTrans::getString("LTimeDay")+"]/["
- +LLTrans::getString("LTimeYear")+"] ["
- +LLTrans::getString("LTimeHour")+"]:["
- +LLTrans::getString("LTimeMin")+ "]";
- break;
- case UTC:
- timeStr = "[" + LLTrans::getString("UTCTimeMth") + "]/["
- +LLTrans::getString("UTCTimeDay")+"]/["
- +LLTrans::getString("UTCTimeYr")+"] ["
- +LLTrans::getString("UTCTimeHr")+"]:["
- +LLTrans::getString("UTCTimeMin")+"] ["
- +LLTrans::getString("UTCTimeTimezone")+"]";
- break;
- case SLT:
- default:
- timeStr = "[" + LLTrans::getString("TimeMonth") + "]/["
- +LLTrans::getString("TimeDay")+"]/["
- +LLTrans::getString("TimeYear")+"] ["
- +LLTrans::getString("TimeHour")+"]:["
- +LLTrans::getString("TimeMin")+"] ["
- +LLTrans::getString("TimeTimezone")+"]";
- break;
- }
+ switch(time_type)
+ {
+ case Local:
+ timeStr = "[" + LLTrans::getString("LTimeMthNum") + "]/["
+ +LLTrans::getString("LTimeDay")+"]/["
+ +LLTrans::getString("LTimeYear")+"] ["
+ +LLTrans::getString("LTimeHour")+"]:["
+ +LLTrans::getString("LTimeMin")+ "]";
+ break;
+ case UTC:
+ timeStr = "[" + LLTrans::getString("UTCTimeMth") + "]/["
+ +LLTrans::getString("UTCTimeDay")+"]/["
+ +LLTrans::getString("UTCTimeYr")+"] ["
+ +LLTrans::getString("UTCTimeHr")+"]:["
+ +LLTrans::getString("UTCTimeMin")+"] ["
+ +LLTrans::getString("UTCTimeTimezone")+"]";
+ break;
+ case SLT:
+ default:
+ timeStr = "[" + LLTrans::getString("TimeMonth") + "]/["
+ +LLTrans::getString("TimeDay")+"]/["
+ +LLTrans::getString("TimeYear")+"] ["
+ +LLTrans::getString("TimeHour")+"]:["
+ +LLTrans::getString("TimeMin")+"] ["
+ +LLTrans::getString("TimeTimezone")+"]";
+ break;
+ }
LLSD substitution;
substitution["datetime"] = time_stamp;
LLStringUtil::format(timeStr, substitution);
@@ -160,14 +160,14 @@ BOOL LLNotificationListItem::handleMouseUp(S32 x, S32 y, MASK mask)
void LLNotificationListItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
- mCondensedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "ScrollHoveredColor" ));
- mExpandedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "ScrollHoveredColor" ));
+ mCondensedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "ScrollHoveredColor" ));
+ mExpandedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "ScrollHoveredColor" ));
}
void LLNotificationListItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
- mCondensedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" ));
- mExpandedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" ));
+ mCondensedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" ));
+ mExpandedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" ));
}
//static
@@ -189,7 +189,7 @@ LLNotificationListItem* LLNotificationListItem::create(const Params& p)
}
//static
-std::set<std::string> LLNotificationListItem::getGroupInviteTypes()
+std::set<std::string> LLNotificationListItem::getGroupInviteTypes()
{
return LLGroupInviteNotificationListItem::getTypes();
}
@@ -308,27 +308,27 @@ BOOL LLGroupInviteNotificationListItem::postBuild()
void LLGroupInviteNotificationListItem::onClickJoinBtn()
{
- if (!gAgent.canJoinGroups())
- {
- LLNotificationsUtil::add("JoinedTooManyGroups");
- return;
- }
+ if (!gAgent.canJoinGroups())
+ {
+ LLNotificationsUtil::add("JoinedTooManyGroups");
+ return;
+ }
- send_join_group_response(mParams.group_id, mParams.transaction_id, true, mParams.fee, mParams.use_offline_cap);
+ send_join_group_response(mParams.group_id, mParams.transaction_id, true, mParams.fee, mParams.use_offline_cap);
- LLNotificationListItem::onClickCloseBtn();
+ LLNotificationListItem::onClickCloseBtn();
}
void LLGroupInviteNotificationListItem::onClickDeclineBtn()
{
- send_join_group_response(mParams.group_id, mParams.transaction_id, false, mParams.fee, mParams.use_offline_cap);
+ send_join_group_response(mParams.group_id, mParams.transaction_id, false, mParams.fee, mParams.use_offline_cap);
- LLNotificationListItem::onClickCloseBtn();
+ LLNotificationListItem::onClickCloseBtn();
}
void LLGroupInviteNotificationListItem::onClickInfoBtn()
{
- LLGroupActions::show(mParams.group_id);
+ LLGroupActions::show(mParams.group_id);
}
void LLGroupInviteNotificationListItem::setFee(S32 fee)
@@ -360,7 +360,7 @@ LLGroupNoticeNotificationListItem::LLGroupNoticeNotificationListItem(const Param
LLGroupNotificationListItem::~LLGroupNotificationListItem()
{
- LLGroupMgr::getInstance()->removeObserver(this);
+ LLGroupMgr::getInstance()->removeObserver(this);
}
BOOL LLGroupNoticeNotificationListItem::postBuild()
@@ -439,7 +439,7 @@ void LLGroupNotificationListItem::changed(LLGroupChange gc)
{
if (GC_PROPERTIES == gc)
{
- updateFromCache();
+ updateFromCache();
LLGroupMgr::getInstance()->removeObserver(this);
}
}
@@ -454,8 +454,8 @@ bool LLGroupNotificationListItem::updateFromCache()
void LLGroupNotificationListItem::setGroupId(const LLUUID& value)
{
- LLGroupMgr* gm = LLGroupMgr::getInstance();
- if (mGroupId.notNull())
+ LLGroupMgr* gm = LLGroupMgr::getInstance();
+ if (mGroupId.notNull())
{
gm->removeObserver(this);
@@ -465,8 +465,8 @@ void LLGroupNotificationListItem::setGroupId(const LLUUID& value)
// Check if cache already contains image_id for that group
if (!updateFromCache())
{
- gm->addObserver(this);
- gm->sendGroupPropertiesRequest(mGroupId);
+ gm->addObserver(this);
+ gm->sendGroupPropertiesRequest(mGroupId);
}
}
}
diff --git a/indra/newview/llnotificationlistitem.h b/indra/newview/llnotificationlistitem.h
index 3d564fed0e..1c454c5556 100644
--- a/indra/newview/llnotificationlistitem.h
+++ b/indra/newview/llnotificationlistitem.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationlistitem.h
- * @brief
+ * @brief
*
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,7 +46,7 @@ public:
struct Params : public LLInitParam::Block<Params, LLPanel::Params>
{
LLUUID notification_id;
- LLUUID transaction_id;
+ LLUUID transaction_id;
LLUUID group_id;
LLUUID paid_from_id;
LLUUID paid_to_id;
@@ -80,8 +80,8 @@ public:
// handlers
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual void onMouseEnter(S32 x, S32 y, MASK mask);
- virtual void onMouseLeave(S32 x, S32 y, MASK mask);
+ virtual void onMouseEnter(S32 x, S32 y, MASK mask);
+ virtual void onMouseLeave(S32 x, S32 y, MASK mask);
//callbacks
typedef boost::function<void (LLNotificationListItem* item)> item_callback_t;
@@ -90,18 +90,18 @@ public:
item_signal_t mOnItemClick;
boost::signals2::connection setOnItemCloseCallback(item_callback_t cb) { return mOnItemClose.connect(cb); }
boost::signals2::connection setOnItemClickCallback(item_callback_t cb) { return mOnItemClick.connect(cb); }
-
+
virtual bool showPopup() { return true; }
void setExpanded(BOOL value);
virtual BOOL postBuild();
void reshapeNotification();
typedef enum e_time_type
- {
- SLT = 1,
- Local = 2,
- UTC = 3,
- }ETimeType;
+ {
+ SLT = 1,
+ Local = 2,
+ UTC = 3,
+ }ETimeType;
protected:
LLNotificationListItem(const Params& p);
@@ -137,7 +137,7 @@ class LLGroupNotificationListItem
: public LLNotificationListItem, public LLGroupMgrObserver
{
public:
- virtual ~LLGroupNotificationListItem();
+ virtual ~LLGroupNotificationListItem();
virtual BOOL postBuild();
void setGroupId(const LLUUID& value);
@@ -185,9 +185,9 @@ private:
void onClickInfoBtn();
LLPanel* mInviteButtonPanel;
- LLButton* mJoinBtn;
- LLButton* mDeclineBtn;
- LLButton* mInfoBtn;
+ LLButton* mJoinBtn;
+ LLButton* mDeclineBtn;
+ LLButton* mInfoBtn;
};
class LLGroupNoticeNotificationListItem
diff --git a/indra/newview/llnotificationlistview.cpp b/indra/newview/llnotificationlistview.cpp
index 9dce68c9c6..ac52dd91bb 100644
--- a/indra/newview/llnotificationlistview.cpp
+++ b/indra/newview/llnotificationlistview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationlistview.cpp
* @brief
*
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llnotificationlistview.h b/indra/newview/llnotificationlistview.h
index 307ad87789..67e9f98b5c 100644
--- a/indra/newview/llnotificationlistview.h
+++ b/indra/newview/llnotificationlistview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationlistview.h
* @brief LLNotificationListView class to support notifications list contained in enclosing floater.
*
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,7 +35,7 @@
*/
class LLNotificationListView : public LLFlatListView
{
- LOG_CLASS(LLNotificationListView);
+ LOG_CLASS(LLNotificationListView);
public:
struct Params : public LLInitParam::Block<Params, LLFlatListView::Params> {};
diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp
index 3f6a86106a..505f276f8c 100644
--- a/indra/newview/llnotificationmanager.cpp
+++ b/indra/newview/llnotificationmanager.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationmanager.cpp
* @brief Class implements a brige between the old and a new notification sistems
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,7 +39,7 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLNotificationManager::LLNotificationManager()
{
- init();
+ init();
}
//--------------------------------------------------------------------------
@@ -50,17 +50,17 @@ LLNotificationManager::~LLNotificationManager()
//--------------------------------------------------------------------------
void LLNotificationManager::init()
{
- mChannels.emplace_back(new LLScriptHandler());
- mChannels.emplace_back(new LLTipHandler());
- mChannels.emplace_back(new LLGroupHandler());
- mChannels.emplace_back(new LLAlertHandler("Alerts", "alert", false));
- mChannels.emplace_back(new LLAlertHandler("AlertModal", "alertmodal", true));
- mChannels.emplace_back(new LLOfferHandler());
- mChannels.emplace_back(new LLHintHandler());
- mChannels.emplace_back(new LLBrowserNotification());
- mChannels.emplace_back(new LLIMHandler());
-
- mChatHandler = std::shared_ptr<LLFloaterIMNearbyChatHandler>(new LLFloaterIMNearbyChatHandler());
+ mChannels.emplace_back(new LLScriptHandler());
+ mChannels.emplace_back(new LLTipHandler());
+ mChannels.emplace_back(new LLGroupHandler());
+ mChannels.emplace_back(new LLAlertHandler("Alerts", "alert", false));
+ mChannels.emplace_back(new LLAlertHandler("AlertModal", "alertmodal", true));
+ mChannels.emplace_back(new LLOfferHandler());
+ mChannels.emplace_back(new LLHintHandler());
+ mChannels.emplace_back(new LLBrowserNotification());
+ mChannels.emplace_back(new LLIMHandler());
+
+ mChatHandler = std::shared_ptr<LLFloaterIMNearbyChatHandler>(new LLFloaterIMNearbyChatHandler());
}
//--------------------------------------------------------------------------
diff --git a/indra/newview/llnotificationmanager.h b/indra/newview/llnotificationmanager.h
index cf987ff4e9..d7d192eca0 100644
--- a/indra/newview/llnotificationmanager.h
+++ b/indra/newview/llnotificationmanager.h
@@ -1,26 +1,26 @@
// Notification Manager Class
-/**
+/**
* @file llnotificationmanager.h
* @brief Class implements a brige between the old and a new notification sistems
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,22 +44,22 @@ class LLToast;
*/
class LLNotificationManager : public LLSingleton<LLNotificationManager>
{
- LLSINGLETON(LLNotificationManager);
- virtual ~LLNotificationManager();
- typedef std::pair<std::string, LLEventHandler*> eventhandlers;
+ LLSINGLETON(LLNotificationManager);
+ virtual ~LLNotificationManager();
+ typedef std::pair<std::string, LLEventHandler*> eventhandlers;
public:
- //TODO: make private
- // this method initialize handlers' map for different types of notifications
- void init(void);
- //TODO: combine processing and storage (*)
-
- // this method reacts on chat notifications and calls an appropriate handler
- void onChat(const LLChat& msg, const LLSD &args);
+ //TODO: make private
+ // this method initialize handlers' map for different types of notifications
+ void init(void);
+ //TODO: combine processing and storage (*)
+
+ // this method reacts on chat notifications and calls an appropriate handler
+ void onChat(const LLChat& msg, const LLSD &args);
private:
- std::shared_ptr<class LLFloaterIMNearbyChatHandler> mChatHandler;
- std::vector<LLNotificationChannelPtr> mChannels;
+ std::shared_ptr<class LLFloaterIMNearbyChatHandler> mChatHandler;
+ std::vector<LLNotificationChannelPtr> mChannels;
};
}
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index 3f22467544..2da8f1fa1c 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,15 +43,15 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLOfferHandler::LLOfferHandler()
-: LLCommunicationNotificationHandler("Offer", "offer")
+: LLCommunicationNotificationHandler("Offer", "offer")
{
- // Getting a Channel for our notifications
- LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
- if(channel)
- {
- channel->setControlHovering(true);
- mChannel = channel->getHandle();
- }
+ // Getting a Channel for our notifications
+ LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
+ if(channel)
+ {
+ channel->setControlHovering(true);
+ mChannel = channel->getHandle();
+ }
}
//--------------------------------------------------------------------------
@@ -62,147 +62,147 @@ LLOfferHandler::~LLOfferHandler()
//--------------------------------------------------------------------------
void LLOfferHandler::initChannel()
{
- S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
- S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
- mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
+ S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
+ S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
+ mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
}
//--------------------------------------------------------------------------
bool LLOfferHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
{
- if(mChannel.isDead())
- {
- return false;
- }
-
- // arrange a channel on a screen
- if(!mChannel.get()->getVisible())
- {
- initChannel();
- }
-
-
- if( notification->getPayload().has("give_inventory_notification")
- && notification->getPayload()["give_inventory_notification"].asBoolean() == false)
- {
- // This is an original inventory offer, so add a script floater
- LLScriptFloaterManager::instance().onAddNotification(notification->getID());
- }
- else
- {
- bool add_notif_to_im = notification->canLogToIM() && notification->hasFormElements();
-
- if (add_notif_to_im)
- {
- const std::string name = LLHandlerUtil::getSubstitutionName(notification);
-
- LLUUID from_id = notification->getPayload()["from_id"];
-
- if (!notification->isDND())
- {
- //Will not play a notification sound for inventory and teleport offer based upon chat preference
- bool playSound = (notification->getName() == "UserGiveItem"
- && gSavedSettings.getBOOL("PlaySoundInventoryOffer"))
- || ((notification->getName() == "TeleportOffered"
- || notification->getName() == "TeleportOffered_MaturityExceeded"
- || notification->getName() == "TeleportOffered_MaturityBlocked")
- && gSavedSettings.getBOOL("PlaySoundTeleportOffer"));
-
- if (playSound)
- {
- notification->playSound();
- }
- }
-
- LLHandlerUtil::spawnIMSession(name, from_id);
- LLHandlerUtil::addNotifPanelToIM(notification);
-
- }
-
- if (!notification->canShowToast())
- {
- LLNotificationsUtil::cancel(notification);
- }
- else if(!notification->canLogToIM() || !LLHandlerUtil::isIMFloaterOpened(notification))
- {
- LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = notify_box;
- // we not save offer notifications to the syswell floater that should be added to the IM floater
- p.can_be_stored = !add_notif_to_im;
- p.force_show = notification->getOfferFromAgent();
- p.can_fade = notification->canFadeToast();
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
- if(channel)
- channel->addToast(p);
-
- }
-
- if (notification->canLogToIM())
- {
- // log only to file if notif panel can be embedded to IM and IM is opened
- bool file_only = add_notif_to_im && LLHandlerUtil::isIMFloaterOpened(notification);
- if ((notification->getName() == "TeleportOffered"
- || notification->getName() == "TeleportOffered_MaturityExceeded"
- || notification->getName() == "TeleportOffered_MaturityBlocked"))
- {
- boost::regex r("<icon\\s*>\\s*([^<]*)?\\s*</icon\\s*>( - )?",
- boost::regex::perl|boost::regex::icase);
- std::string stripped_msg = boost::regex_replace(notification->getMessage(), r, "");
- LLHandlerUtil::logToIMP2P(notification->getPayload()["from_id"], stripped_msg,file_only);
- }
- else
- {
- LLHandlerUtil::logToIMP2P(notification, file_only);
- }
- }
- }
-
- return false;
+ if(mChannel.isDead())
+ {
+ return false;
+ }
+
+ // arrange a channel on a screen
+ if(!mChannel.get()->getVisible())
+ {
+ initChannel();
+ }
+
+
+ if( notification->getPayload().has("give_inventory_notification")
+ && notification->getPayload()["give_inventory_notification"].asBoolean() == false)
+ {
+ // This is an original inventory offer, so add a script floater
+ LLScriptFloaterManager::instance().onAddNotification(notification->getID());
+ }
+ else
+ {
+ bool add_notif_to_im = notification->canLogToIM() && notification->hasFormElements();
+
+ if (add_notif_to_im)
+ {
+ const std::string name = LLHandlerUtil::getSubstitutionName(notification);
+
+ LLUUID from_id = notification->getPayload()["from_id"];
+
+ if (!notification->isDND())
+ {
+ //Will not play a notification sound for inventory and teleport offer based upon chat preference
+ bool playSound = (notification->getName() == "UserGiveItem"
+ && gSavedSettings.getBOOL("PlaySoundInventoryOffer"))
+ || ((notification->getName() == "TeleportOffered"
+ || notification->getName() == "TeleportOffered_MaturityExceeded"
+ || notification->getName() == "TeleportOffered_MaturityBlocked")
+ && gSavedSettings.getBOOL("PlaySoundTeleportOffer"));
+
+ if (playSound)
+ {
+ notification->playSound();
+ }
+ }
+
+ LLHandlerUtil::spawnIMSession(name, from_id);
+ LLHandlerUtil::addNotifPanelToIM(notification);
+
+ }
+
+ if (!notification->canShowToast())
+ {
+ LLNotificationsUtil::cancel(notification);
+ }
+ else if(!notification->canLogToIM() || !LLHandlerUtil::isIMFloaterOpened(notification))
+ {
+ LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.panel = notify_box;
+ // we not save offer notifications to the syswell floater that should be added to the IM floater
+ p.can_be_stored = !add_notif_to_im;
+ p.force_show = notification->getOfferFromAgent();
+ p.can_fade = notification->canFadeToast();
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if(channel)
+ channel->addToast(p);
+
+ }
+
+ if (notification->canLogToIM())
+ {
+ // log only to file if notif panel can be embedded to IM and IM is opened
+ bool file_only = add_notif_to_im && LLHandlerUtil::isIMFloaterOpened(notification);
+ if ((notification->getName() == "TeleportOffered"
+ || notification->getName() == "TeleportOffered_MaturityExceeded"
+ || notification->getName() == "TeleportOffered_MaturityBlocked"))
+ {
+ boost::regex r("<icon\\s*>\\s*([^<]*)?\\s*</icon\\s*>( - )?",
+ boost::regex::perl|boost::regex::icase);
+ std::string stripped_msg = boost::regex_replace(notification->getMessage(), r, "");
+ LLHandlerUtil::logToIMP2P(notification->getPayload()["from_id"], stripped_msg,file_only);
+ }
+ else
+ {
+ LLHandlerUtil::logToIMP2P(notification, file_only);
+ }
+ }
+ }
+
+ return false;
}
/*virtual*/ void LLOfferHandler::onChange(LLNotificationPtr p)
{
- auto panelp = LLToastNotifyPanel::getInstance(p->getID());
- if (panelp)
- {
- //
- // HACK: if we're dealing with a notification embedded in IM, update it
- // otherwise remove its toast
- //
- if (dynamic_cast<LLIMToastNotifyPanel*>(panelp.get()))
- {
- panelp->updateNotification();
- }
- else
- {
- // if notification has changed, hide it
- mChannel.get()->removeToastByNotificationID(p->getID());
- }
- }
+ auto panelp = LLToastNotifyPanel::getInstance(p->getID());
+ if (panelp)
+ {
+ //
+ // HACK: if we're dealing with a notification embedded in IM, update it
+ // otherwise remove its toast
+ //
+ if (dynamic_cast<LLIMToastNotifyPanel*>(panelp.get()))
+ {
+ panelp->updateNotification();
+ }
+ else
+ {
+ // if notification has changed, hide it
+ mChannel.get()->removeToastByNotificationID(p->getID());
+ }
+ }
}
/*virtual*/ void LLOfferHandler::onDelete(LLNotificationPtr notification)
{
- if( notification->getPayload().has("give_inventory_notification")
- && !notification->getPayload()["give_inventory_notification"] )
- {
- // Remove original inventory offer script floater
- LLScriptFloaterManager::instance().onRemoveNotification(notification->getID());
- }
- else
- {
- if (notification->canLogToIM()
- && notification->hasFormElements()
- && !LLHandlerUtil::isIMFloaterOpened(notification))
- {
- LLHandlerUtil::decIMMesageCounter(notification);
- }
- mChannel.get()->removeToastByNotificationID(notification->getID());
- }
+ if( notification->getPayload().has("give_inventory_notification")
+ && !notification->getPayload()["give_inventory_notification"] )
+ {
+ // Remove original inventory offer script floater
+ LLScriptFloaterManager::instance().onRemoveNotification(notification->getID());
+ }
+ else
+ {
+ if (notification->canLogToIM()
+ && notification->hasFormElements()
+ && !LLHandlerUtil::isIMFloaterOpened(notification))
+ {
+ LLHandlerUtil::decIMMesageCounter(notification);
+ }
+ mChannel.get()->removeToastByNotificationID(notification->getID());
+ }
}
diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp
index bb39d8f362..bda6402413 100644
--- a/indra/newview/llnotificationscripthandler.cpp
+++ b/indra/newview/llnotificationscripthandler.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationscripthandler.cpp
* @brief Notification Handler Class for Simple Notifications and Notification Tips
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,15 +42,15 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLScriptHandler::LLScriptHandler()
-: LLSystemNotificationHandler("Notifications", "notify")
+: LLSystemNotificationHandler("Notifications", "notify")
{
- // Getting a Channel for our notifications
- LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
- if(channel)
- {
- channel->setControlHovering(true);
- mChannel = channel->getHandle();
- }
+ // Getting a Channel for our notifications
+ LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
+ if(channel)
+ {
+ channel->setControlHovering(true);
+ mChannel = channel->getHandle();
+ }
}
//--------------------------------------------------------------------------
@@ -61,9 +61,9 @@ LLScriptHandler::~LLScriptHandler()
//--------------------------------------------------------------------------
void LLScriptHandler::initChannel()
{
- S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
- S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
- mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
+ S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
+ S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
+ mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
}
//--------------------------------------------------------------------------
@@ -72,77 +72,77 @@ void LLScriptHandler::addToastWithNotification(const LLNotificationPtr& notifica
LL_PROFILE_ZONE_SCOPED
LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = notify_box;
- p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1);
- p.can_fade = notification->canFadeToast();
- if(gAgent.isDoNotDisturb())
- {
- p.force_show = notification->getName() == "SystemMessage"
- || notification->getName() == "GodMessage"
- || notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH;
- }
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
- if(channel)
- {
- channel->addToast(p);
- }
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.panel = notify_box;
+ p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1);
+ p.can_fade = notification->canFadeToast();
+ if(gAgent.isDoNotDisturb())
+ {
+ p.force_show = notification->getName() == "SystemMessage"
+ || notification->getName() == "GodMessage"
+ || notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH;
+ }
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if(channel)
+ {
+ channel->addToast(p);
+ }
}
//--------------------------------------------------------------------------
bool LLScriptHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
{
- if(mChannel.isDead())
- {
- return false;
- }
-
- // arrange a channel on a screen
- if(!mChannel.get()->getVisible())
- {
- initChannel();
- }
-
- if (should_log && notification->canLogToIM())
- {
- LLHandlerUtil::logToIMP2P(notification);
- }
-
- if(notification->hasFormElements() && !notification->canShowToast())
- {
- LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID());
- }
- else if (notification->canShowToast())
- {
- addToastWithNotification(notification);
- }
-
- return false;
+ if(mChannel.isDead())
+ {
+ return false;
+ }
+
+ // arrange a channel on a screen
+ if(!mChannel.get()->getVisible())
+ {
+ initChannel();
+ }
+
+ if (should_log && notification->canLogToIM())
+ {
+ LLHandlerUtil::logToIMP2P(notification);
+ }
+
+ if(notification->hasFormElements() && !notification->canShowToast())
+ {
+ LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID());
+ }
+ else if (notification->canShowToast())
+ {
+ addToastWithNotification(notification);
+ }
+
+ return false;
}
void LLScriptHandler::onChange( LLNotificationPtr notification )
{
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
- if (channel)
- {
- channel->removeToastByNotificationID(notification->getID());
- addToastWithNotification(notification);
- }
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if (channel)
+ {
+ channel->removeToastByNotificationID(notification->getID());
+ addToastWithNotification(notification);
+ }
}
void LLScriptHandler::onDelete( LLNotificationPtr notification )
{
- if(notification->hasFormElements() && !notification->canShowToast())
- {
- LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
- }
- else
- {
- mChannel.get()->removeToastByNotificationID(notification->getID());
- }
+ if(notification->hasFormElements() && !notification->canShowToast())
+ {
+ LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
+ }
+ else
+ {
+ mChannel.get()->removeToastByNotificationID(notification->getID());
+ }
}
@@ -150,14 +150,14 @@ void LLScriptHandler::onDelete( LLNotificationPtr notification )
void LLScriptHandler::onDeleteToast(LLToast* toast)
{
- // send a signal to a listener to let him perform some action
- // in this case listener is a SysWellWindow and it will remove a corresponding item from its list
- LLNotificationPtr notification = LLNotifications::getInstance()->find(toast->getNotificationID());
-
- if( notification && notification->hasFormElements() && !notification->canShowToast())
- {
- LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
- }
+ // send a signal to a listener to let him perform some action
+ // in this case listener is a SysWellWindow and it will remove a corresponding item from its list
+ LLNotificationPtr notification = LLNotifications::getInstance()->find(toast->getNotificationID());
+
+ if( notification && notification->hasFormElements() && !notification->canShowToast())
+ {
+ LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
+ }
}
diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp
index 35fdfa88bb..75bafb8785 100644
--- a/indra/newview/llnotificationstorage.cpp
+++ b/indra/newview/llnotificationstorage.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,7 +39,7 @@
#include "llsdserialize.h"
#include "llsingleton.h"
#include "llregistry.h"
-#include "llviewermessage.h"
+#include "llviewermessage.h"
typedef boost::function<LLNotificationResponderInterface * (const LLSD& pParams)> responder_constructor_t;
@@ -67,7 +67,7 @@ LLNotificationResponderInterface * LLResponderRegistry::createResponder(const st
{
return (*factoryFunc)(pParams);
}
-
+
return NULL;
}
@@ -77,7 +77,7 @@ LLResponderRegistry::StaticRegistrar sRegisterOfferInfo("offer_info", &LLRespond
LLNotificationStorage::LLNotificationStorage(std::string pFileName)
- : mFileName(pFileName)
+ : mFileName(pFileName)
{
}
@@ -88,71 +88,71 @@ LLNotificationStorage::~LLNotificationStorage()
bool LLNotificationStorage::writeNotifications(const LLSD& pNotificationData) const
{
- llofstream notifyFile(mFileName.c_str());
- bool didFileOpen = notifyFile.is_open();
+ llofstream notifyFile(mFileName.c_str());
+ bool didFileOpen = notifyFile.is_open();
- if (!didFileOpen)
- {
- LL_WARNS("LLNotificationStorage") << "Failed to open file '" << mFileName << "'" << LL_ENDL;
- }
- else
- {
- LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
- formatter->format(pNotificationData, notifyFile, LLSDFormatter::OPTIONS_PRETTY);
- }
+ if (!didFileOpen)
+ {
+ LL_WARNS("LLNotificationStorage") << "Failed to open file '" << mFileName << "'" << LL_ENDL;
+ }
+ else
+ {
+ LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+ formatter->format(pNotificationData, notifyFile, LLSDFormatter::OPTIONS_PRETTY);
+ }
- return didFileOpen;
+ return didFileOpen;
}
bool LLNotificationStorage::readNotifications(LLSD& pNotificationData, bool is_new_filename) const
{
- std::string filename = is_new_filename? mFileName : mOldFileName;
+ std::string filename = is_new_filename? mFileName : mOldFileName;
- LL_INFOS("LLNotificationStorage") << "starting read '" << filename << "'" << LL_ENDL;
+ LL_INFOS("LLNotificationStorage") << "starting read '" << filename << "'" << LL_ENDL;
- bool didFileRead;
+ bool didFileRead;
- pNotificationData.clear();
+ pNotificationData.clear();
- llifstream notifyFile(filename.c_str());
- didFileRead = notifyFile.is_open();
- if (!didFileRead)
- {
- LL_WARNS("LLNotificationStorage") << "Failed to open file '" << filename << "'" << LL_ENDL;
- }
- else
- {
- LLPointer<LLSDParser> parser = new LLSDXMLParser();
- didFileRead = (parser->parse(notifyFile, pNotificationData, LLSDSerialize::SIZE_UNLIMITED) >= 0);
+ llifstream notifyFile(filename.c_str());
+ didFileRead = notifyFile.is_open();
+ if (!didFileRead)
+ {
+ LL_WARNS("LLNotificationStorage") << "Failed to open file '" << filename << "'" << LL_ENDL;
+ }
+ else
+ {
+ LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ didFileRead = (parser->parse(notifyFile, pNotificationData, LLSDSerialize::SIZE_UNLIMITED) >= 0);
notifyFile.close();
- if (!didFileRead)
- {
- LL_WARNS("LLNotificationStorage") << "Failed to parse open notifications from file '" << mFileName
+ if (!didFileRead)
+ {
+ LL_WARNS("LLNotificationStorage") << "Failed to parse open notifications from file '" << mFileName
<< "'" << LL_ENDL;
LLFile::remove(filename);
- LL_WARNS("LLNotificationStorage") << "Removed invalid open notifications file '" << mFileName
+ LL_WARNS("LLNotificationStorage") << "Removed invalid open notifications file '" << mFileName
<< "'" << LL_ENDL;
- }
- }
-
- if (!didFileRead)
- {
- if(is_new_filename)
- {
- didFileRead = readNotifications(pNotificationData, false);
- if(didFileRead)
- {
- writeNotifications(pNotificationData);
- LLFile::remove(mOldFileName);
- }
- }
- }
-
- return didFileRead;
+ }
+ }
+
+ if (!didFileRead)
+ {
+ if(is_new_filename)
+ {
+ didFileRead = readNotifications(pNotificationData, false);
+ if(didFileRead)
+ {
+ writeNotifications(pNotificationData);
+ LLFile::remove(mOldFileName);
+ }
+ }
+ }
+
+ return didFileRead;
}
LLNotificationResponderInterface * LLNotificationStorage::createResponder(const std::string& pNotificationName, const LLSD& pParams) const
{
- return LLResponderRegistry::getInstance()->createResponder(pNotificationName, pParams);
+ return LLResponderRegistry::getInstance()->createResponder(pNotificationName, pParams);
}
diff --git a/indra/newview/llnotificationstorage.h b/indra/newview/llnotificationstorage.h
index 21d7123747..6d7c3f79f3 100644
--- a/indra/newview/llnotificationstorage.h
+++ b/indra/newview/llnotificationstorage.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,22 +36,22 @@ class LLSD;
class LLNotificationStorage
{
- LOG_CLASS(LLNotificationStorage);
+ LOG_CLASS(LLNotificationStorage);
public:
- LLNotificationStorage(std::string pFileName);
- ~LLNotificationStorage();
+ LLNotificationStorage(std::string pFileName);
+ ~LLNotificationStorage();
protected:
- bool writeNotifications(const LLSD& pNotificationData) const;
- bool readNotifications(LLSD& pNotificationData, bool is_new_filename = true) const;
- void setFileName(std::string pFileName) {mFileName = pFileName;}
- void setOldFileName(std::string pFileName) {mOldFileName = pFileName;}
+ bool writeNotifications(const LLSD& pNotificationData) const;
+ bool readNotifications(LLSD& pNotificationData, bool is_new_filename = true) const;
+ void setFileName(std::string pFileName) {mFileName = pFileName;}
+ void setOldFileName(std::string pFileName) {mOldFileName = pFileName;}
- LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams) const;
+ LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams) const;
private:
- std::string mFileName;
- std::string mOldFileName;
+ std::string mFileName;
+ std::string mOldFileName;
};
#endif // LL_NOTIFICATIONSTORAGE_H
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 91f93067de..9443b6cb93 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llnotificationtiphandler.cpp
* @brief Notification Handler Class for Notification Tips
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,14 +42,14 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLTipHandler::LLTipHandler()
-: LLSystemNotificationHandler("NotificationTips", "notifytip")
+: LLSystemNotificationHandler("NotificationTips", "notifytip")
{
- // Getting a Channel for our notifications
- LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
- if(channel)
- {
- mChannel = channel->getHandle();
- }
+ // Getting a Channel for our notifications
+ LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
+ if(channel)
+ {
+ mChannel = channel->getHandle();
+ }
}
//--------------------------------------------------------------------------
@@ -60,78 +60,78 @@ LLTipHandler::~LLTipHandler()
//--------------------------------------------------------------------------
void LLTipHandler::initChannel()
{
- S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
- S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
- mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
+ S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
+ S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
+ mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
}
//--------------------------------------------------------------------------
bool LLTipHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
{
- if(mChannel.isDead())
- {
- return false;
- }
-
- // arrange a channel on a screen
- if(!mChannel.get()->getVisible())
- {
- initChannel();
- }
-
- // archive message in nearby chat
- if (notification->canLogToChat())
- {
- LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
- }
-
- std::string session_name = notification->getPayload()["SESSION_NAME"];
- const std::string name = LLHandlerUtil::getSubstitutionOriginalName(notification);
- if (session_name.empty())
- {
- session_name = name;
- }
- LLUUID from_id = notification->getPayload()["from_id"];
- if (notification->canLogToIM())
- {
- LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name,
- notification->getMessage(), from_id, from_id);
- }
-
- if (notification->canLogToIM() && notification->hasFormElements())
- {
- LLHandlerUtil::spawnIMSession(name, from_id);
- }
-
- if (notification->canLogToIM() && LLHandlerUtil::isIMFloaterOpened(notification))
- {
- return false;
- }
-
- LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
-
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = notify_box;
- p.is_tip = true;
- p.can_be_stored = false;
-
- LLDate cur_time = LLDate::now();
- LLDate exp_time = notification->getExpiration();
- if (exp_time > cur_time)
- {
- // we have non-default expiration time - keep visible until expires
- p.lifetime_secs = exp_time.secondsSinceEpoch() - cur_time.secondsSinceEpoch();
- }
- else
- {
- // use default time
- p.lifetime_secs = gSavedSettings.getS32("NotificationTipToastLifeTime");
- }
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
- if(channel)
- channel->addToast(p);
- return false;
+ if(mChannel.isDead())
+ {
+ return false;
+ }
+
+ // arrange a channel on a screen
+ if(!mChannel.get()->getVisible())
+ {
+ initChannel();
+ }
+
+ // archive message in nearby chat
+ if (notification->canLogToChat())
+ {
+ LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
+ }
+
+ std::string session_name = notification->getPayload()["SESSION_NAME"];
+ const std::string name = LLHandlerUtil::getSubstitutionOriginalName(notification);
+ if (session_name.empty())
+ {
+ session_name = name;
+ }
+ LLUUID from_id = notification->getPayload()["from_id"];
+ if (notification->canLogToIM())
+ {
+ LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name,
+ notification->getMessage(), from_id, from_id);
+ }
+
+ if (notification->canLogToIM() && notification->hasFormElements())
+ {
+ LLHandlerUtil::spawnIMSession(name, from_id);
+ }
+
+ if (notification->canLogToIM() && LLHandlerUtil::isIMFloaterOpened(notification))
+ {
+ return false;
+ }
+
+ LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
+
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.panel = notify_box;
+ p.is_tip = true;
+ p.can_be_stored = false;
+
+ LLDate cur_time = LLDate::now();
+ LLDate exp_time = notification->getExpiration();
+ if (exp_time > cur_time)
+ {
+ // we have non-default expiration time - keep visible until expires
+ p.lifetime_secs = exp_time.secondsSinceEpoch() - cur_time.secondsSinceEpoch();
+ }
+ else
+ {
+ // use default time
+ p.lifetime_secs = gSavedSettings.getS32("NotificationTipToastLifeTime");
+ }
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if(channel)
+ channel->addToast(p);
+ return false;
}
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index efffcefc4a..0b127b1b93 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lloutfitgallery.cpp
* @author Pavlo Kryvych
* @brief Visual gallery of agent's outfits for My Appearance side panel
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -431,7 +431,7 @@ bool compareGalleryItem(LLOutfitGalleryItem* item1, LLOutfitGalleryItem* item2)
}
void LLOutfitGallery::reArrangeRows(S32 row_diff)
-{
+{
std::vector<LLOutfitGalleryItem*> buf_items = mItems;
for (std::vector<LLOutfitGalleryItem*>::const_reverse_iterator it = buf_items.rbegin(); it != buf_items.rend(); ++it)
{
@@ -442,7 +442,7 @@ void LLOutfitGallery::reArrangeRows(S32 row_diff)
buf_items.push_back(*it);
}
mHiddenItems.clear();
-
+
mItemsInRow += row_diff;
updateGalleryWidth();
std::sort(buf_items.begin(), buf_items.end(), compareGalleryItem);
@@ -458,7 +458,7 @@ void LLOutfitGallery::reArrangeRows(S32 row_diff)
bool hidden = (std::string::npos == outfit_name.find(cur_filter));
(*it)->setHidden(hidden);
- addToGallery(*it);
+ addToGallery(*it);
}
updateMessageVisibility();
@@ -949,7 +949,7 @@ BOOL LLOutfitGalleryItem::postBuild()
void LLOutfitGalleryItem::draw()
{
LLPanel::draw();
-
+
// Draw border
LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "OutfitGalleryItemSelected" : "OutfitGalleryItemUnselected", LLColor4::white);
LLRect border = getChildView("preview_outfit")->getRect();
@@ -979,7 +979,7 @@ void LLOutfitGalleryItem::draw()
mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight()));
}
}
-
+
}
void LLOutfitGalleryItem::setOutfitName(std::string name)
@@ -1137,7 +1137,7 @@ LLContextMenu* LLOutfitGalleryContextMenu::createMenu()
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
LLUUID selected_id = mUUIDs.front();
-
+
registrar.add("Outfit.WearReplace",
boost::bind(&LLAppearanceMgr::replaceCurrentOutfit, &LLAppearanceMgr::instance(), selected_id));
registrar.add("Outfit.WearAdd",
@@ -1152,7 +1152,7 @@ LLContextMenu* LLOutfitGalleryContextMenu::createMenu()
registrar.add("Outfit.Save", boost::bind(&LLOutfitGalleryContextMenu::onSave, this, selected_id));
enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitGalleryContextMenu::onEnable, this, _2));
enable_registrar.add("Outfit.OnVisible", boost::bind(&LLOutfitGalleryContextMenu::onVisible, this, _2));
-
+
return createFromFile("menu_gallery_outfit_tab.xml");
}
@@ -1164,7 +1164,7 @@ void LLOutfitGalleryContextMenu::onCreate(const LLSD& data)
LL_WARNS() << "Invalid wearable type" << LL_ENDL;
return;
}
-
+
LLAgentWearables::createWearable(type, true);
}
@@ -1298,7 +1298,7 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id)
mOutfitMap[category_id]->setImageAssetId(asset_id);
}
}
-
+
if (mGalleryCreated && !LLApp::isExiting())
{
reArrangeRows();
diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h
index 99371b1cec..97a902ce6a 100644
--- a/indra/newview/lloutfitgallery.h
+++ b/indra/newview/lloutfitgallery.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lloutfitgallery.h
* @author Pavlo Kryvych
* @brief Visual gallery of agent's outfits for My Appearance side panel
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2015&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2015, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -173,7 +173,7 @@ private:
int mGalleryWidth;
int mRowPanWidthFactor;
int mGalleryWidthFactor;
-
+
LLListContextMenu* mOutfitGalleryMenu;
typedef std::map<LLUUID, LLOutfitGalleryItem*> outfit_map_t;
@@ -185,12 +185,12 @@ private:
std::map<S32, LLOutfitGalleryItem*> mIndexToItemMap;
- LLInventoryCategoriesObserver* mOutfitsObserver;
+ LLInventoryCategoriesObserver* mOutfitsObserver;
};
class LLOutfitGalleryContextMenu : public LLOutfitContextMenu
{
public:
-
+
friend class LLOutfitGallery;
LLOutfitGalleryContextMenu(LLOutfitListBase* outfit_list)
: LLOutfitContextMenu(outfit_list){}
@@ -246,13 +246,13 @@ public:
void setSelected(bool value);
void setUUID(const LLUUID &outfit_id) {mUUID = outfit_id;}
LLUUID getUUID() const { return mUUID; }
-
+
std::string getItemName() {return mOutfitName;}
bool isDefaultImage() {return mDefaultImage;}
-
+
bool isHidden() {return mHidden;}
void setHidden(bool hidden) {mHidden = hidden;}
-
+
private:
LLOutfitGallery* mGallery;
LLPointer<LLViewerFetchedTexture> mTexturep;
@@ -265,7 +265,7 @@ private:
bool mWorn;
bool mDefaultImage;
bool mImageUpdatePending;
- bool mHidden;
+ bool mHidden;
std::string mOutfitName;
};
diff --git a/indra/newview/lloutfitobserver.cpp b/indra/newview/lloutfitobserver.cpp
index 3ec5bcd9fc..d140387de1 100644
--- a/indra/newview/lloutfitobserver.cpp
+++ b/indra/newview/lloutfitobserver.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,121 +32,121 @@
#include "llviewerinventory.h"
LLOutfitObserver::LLOutfitObserver() :
- mCOFLastVersion(LLViewerInventoryCategory::VERSION_UNKNOWN)
+ mCOFLastVersion(LLViewerInventoryCategory::VERSION_UNKNOWN)
{
- gInventory.addObserver(this);
+ gInventory.addObserver(this);
}
LLOutfitObserver::~LLOutfitObserver()
{
- if (gInventory.containsObserver(this))
- {
- gInventory.removeObserver(this);
- }
+ if (gInventory.containsObserver(this))
+ {
+ gInventory.removeObserver(this);
+ }
}
void LLOutfitObserver::changed(U32 mask)
{
- if (!gInventory.isInventoryUsable())
- return;
+ if (!gInventory.isInventoryUsable())
+ return;
- checkCOF();
+ checkCOF();
- checkBaseOutfit();
+ checkBaseOutfit();
}
// static
S32 LLOutfitObserver::getCategoryVersion(const LLUUID& cat_id)
{
- LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
- if (!cat)
- return LLViewerInventoryCategory::VERSION_UNKNOWN;
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (!cat)
+ return LLViewerInventoryCategory::VERSION_UNKNOWN;
- return cat->getVersion();
+ return cat->getVersion();
}
// static
const std::string& LLOutfitObserver::getCategoryName(const LLUUID& cat_id)
{
- LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
- if (!cat)
- return LLStringUtil::null;
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (!cat)
+ return LLStringUtil::null;
- return cat->getName();
+ return cat->getName();
}
bool LLOutfitObserver::checkCOF()
{
- LLUUID cof = LLAppearanceMgr::getInstance()->getCOF();
- if (cof.isNull())
- return false;
-
- bool cof_changed = false;
- LLUUID item_name_hash = gInventory.hashDirectDescendentNames(cof);
- if (item_name_hash != mItemNameHash)
- {
- cof_changed = true;
- mItemNameHash = item_name_hash;
- }
-
- S32 cof_version = getCategoryVersion(cof);
- if (cof_version != mCOFLastVersion)
- {
- cof_changed = true;
- mCOFLastVersion = cof_version;
- }
-
- if (!cof_changed)
- return false;
-
- // dirtiness state should be updated before sending signal
- LLAppearanceMgr::getInstance()->updateIsDirty();
- mCOFChanged();
-
- return true;
+ LLUUID cof = LLAppearanceMgr::getInstance()->getCOF();
+ if (cof.isNull())
+ return false;
+
+ bool cof_changed = false;
+ LLUUID item_name_hash = gInventory.hashDirectDescendentNames(cof);
+ if (item_name_hash != mItemNameHash)
+ {
+ cof_changed = true;
+ mItemNameHash = item_name_hash;
+ }
+
+ S32 cof_version = getCategoryVersion(cof);
+ if (cof_version != mCOFLastVersion)
+ {
+ cof_changed = true;
+ mCOFLastVersion = cof_version;
+ }
+
+ if (!cof_changed)
+ return false;
+
+ // dirtiness state should be updated before sending signal
+ LLAppearanceMgr::getInstance()->updateIsDirty();
+ mCOFChanged();
+
+ return true;
}
void LLOutfitObserver::checkBaseOutfit()
{
- LLUUID baseoutfit_id =
- LLAppearanceMgr::getInstance()->getBaseOutfitUUID();
-
- if (baseoutfit_id == mBaseOutfitId)
- {
- if (baseoutfit_id.isNull())
- return;
-
- const S32 baseoutfit_ver = getCategoryVersion(baseoutfit_id);
- const std::string& baseoutfit_name = getCategoryName(baseoutfit_id);
-
- if (baseoutfit_ver == mBaseOutfitLastVersion
- // renaming category doesn't change version, so it's need to check it
- && baseoutfit_name == mLastBaseOutfitName)
- return;
- }
- else
- {
- mBaseOutfitId = baseoutfit_id;
- mBOFReplaced();
-
- if (baseoutfit_id.isNull())
- return;
- }
-
- mBaseOutfitLastVersion = getCategoryVersion(mBaseOutfitId);
- mLastBaseOutfitName = getCategoryName(baseoutfit_id);
-
- LLAppearanceMgr& app_mgr = LLAppearanceMgr::instance();
- // dirtiness state should be updated before sending signal
- app_mgr.updateIsDirty();
- mBOFChanged();
-
- if (mLastOutfitDirtiness != app_mgr.isOutfitDirty())
- {
- if(!app_mgr.isOutfitDirty())
- {
- mCOFSaved();
- }
- mLastOutfitDirtiness = app_mgr.isOutfitDirty();
- }
+ LLUUID baseoutfit_id =
+ LLAppearanceMgr::getInstance()->getBaseOutfitUUID();
+
+ if (baseoutfit_id == mBaseOutfitId)
+ {
+ if (baseoutfit_id.isNull())
+ return;
+
+ const S32 baseoutfit_ver = getCategoryVersion(baseoutfit_id);
+ const std::string& baseoutfit_name = getCategoryName(baseoutfit_id);
+
+ if (baseoutfit_ver == mBaseOutfitLastVersion
+ // renaming category doesn't change version, so it's need to check it
+ && baseoutfit_name == mLastBaseOutfitName)
+ return;
+ }
+ else
+ {
+ mBaseOutfitId = baseoutfit_id;
+ mBOFReplaced();
+
+ if (baseoutfit_id.isNull())
+ return;
+ }
+
+ mBaseOutfitLastVersion = getCategoryVersion(mBaseOutfitId);
+ mLastBaseOutfitName = getCategoryName(baseoutfit_id);
+
+ LLAppearanceMgr& app_mgr = LLAppearanceMgr::instance();
+ // dirtiness state should be updated before sending signal
+ app_mgr.updateIsDirty();
+ mBOFChanged();
+
+ if (mLastOutfitDirtiness != app_mgr.isOutfitDirty())
+ {
+ if(!app_mgr.isOutfitDirty())
+ {
+ mCOFSaved();
+ }
+ mLastOutfitDirtiness = app_mgr.isOutfitDirty();
+ }
}
diff --git a/indra/newview/lloutfitobserver.h b/indra/newview/lloutfitobserver.h
index 56f2ceb8b1..ebf0ba1a12 100644
--- a/indra/newview/lloutfitobserver.h
+++ b/indra/newview/lloutfitobserver.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,60 +35,60 @@
*/
class LLOutfitObserver: public LLInventoryObserver, public LLSingleton<LLOutfitObserver>
{
- LLSINGLETON(LLOutfitObserver);
- virtual ~LLOutfitObserver();
+ LLSINGLETON(LLOutfitObserver);
+ virtual ~LLOutfitObserver();
public:
- virtual void changed(U32 mask) override;
+ virtual void changed(U32 mask) override;
- void notifyOutfitLockChanged() { mOutfitLockChanged(); }
+ void notifyOutfitLockChanged() { mOutfitLockChanged(); }
- typedef boost::signals2::signal<void (void)> signal_t;
+ typedef boost::signals2::signal<void (void)> signal_t;
- void addBOFReplacedCallback(const signal_t::slot_type& cb) { mBOFReplaced.connect(cb); }
+ void addBOFReplacedCallback(const signal_t::slot_type& cb) { mBOFReplaced.connect(cb); }
- void addBOFChangedCallback(const signal_t::slot_type& cb) { mBOFChanged.connect(cb); }
+ void addBOFChangedCallback(const signal_t::slot_type& cb) { mBOFChanged.connect(cb); }
- void addCOFChangedCallback(const signal_t::slot_type& cb) { mCOFChanged.connect(cb); }
+ void addCOFChangedCallback(const signal_t::slot_type& cb) { mCOFChanged.connect(cb); }
- void addCOFSavedCallback(const signal_t::slot_type& cb) { mCOFSaved.connect(cb); }
+ void addCOFSavedCallback(const signal_t::slot_type& cb) { mCOFSaved.connect(cb); }
- void addOutfitLockChangedCallback(const signal_t::slot_type& cb) { mOutfitLockChanged.connect(cb); }
+ void addOutfitLockChangedCallback(const signal_t::slot_type& cb) { mOutfitLockChanged.connect(cb); }
protected:
- /** Get a version of an inventory category specified by its UUID */
- static S32 getCategoryVersion(const LLUUID& cat_id);
+ /** Get a version of an inventory category specified by its UUID */
+ static S32 getCategoryVersion(const LLUUID& cat_id);
- static const std::string& getCategoryName(const LLUUID& cat_id);
+ static const std::string& getCategoryName(const LLUUID& cat_id);
- bool checkCOF();
+ bool checkCOF();
- void checkBaseOutfit();
+ void checkBaseOutfit();
- //last version number of a COF category
- S32 mCOFLastVersion;
+ //last version number of a COF category
+ S32 mCOFLastVersion;
- LLUUID mBaseOutfitId;
+ LLUUID mBaseOutfitId;
- S32 mBaseOutfitLastVersion;
- std::string mLastBaseOutfitName;
+ S32 mBaseOutfitLastVersion;
+ std::string mLastBaseOutfitName;
- bool mLastOutfitDirtiness;
+ bool mLastOutfitDirtiness;
- LLUUID mItemNameHash;
+ LLUUID mItemNameHash;
private:
- signal_t mBOFReplaced;
- signal_t mBOFChanged;
- signal_t mCOFChanged;
- signal_t mCOFSaved;
-
- /**
- * Signal for changing state of outfit lock.
- */
- signal_t mOutfitLockChanged;
+ signal_t mBOFReplaced;
+ signal_t mBOFChanged;
+ signal_t mCOFChanged;
+ signal_t mCOFSaved;
+
+ /**
+ * Signal for changing state of outfit lock.
+ */
+ signal_t mOutfitLockChanged;
};
#endif /* LL_OUTFITOBSERVER_H */
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 1a6c5db535..f4cd9b2647 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,42 +57,42 @@ static const LLOutfitTabNameComparator OUTFIT_TAB_NAME_COMPARATOR;
/*virtual*/
bool LLOutfitTabNameComparator::compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const
{
- std::string name1 = tab1->getTitle();
- std::string name2 = tab2->getTitle();
+ std::string name1 = tab1->getTitle();
+ std::string name2 = tab2->getTitle();
return (LLStringUtil::compareDict(name1, name2) < 0);
}
struct outfit_accordion_tab_params : public LLInitParam::Block<outfit_accordion_tab_params, LLOutfitAccordionCtrlTab::Params>
{
- Mandatory<LLWearableItemsList::Params> wearable_list;
+ Mandatory<LLWearableItemsList::Params> wearable_list;
- outfit_accordion_tab_params()
- : wearable_list("wearable_items_list")
- {}
+ outfit_accordion_tab_params()
+ : wearable_list("wearable_items_list")
+ {}
};
const outfit_accordion_tab_params& get_accordion_tab_params()
{
- static outfit_accordion_tab_params tab_params;
- static bool initialized = false;
- if (!initialized)
- {
- initialized = true;
+ static outfit_accordion_tab_params tab_params;
+ static bool initialized = false;
+ if (!initialized)
+ {
+ initialized = true;
- LLXMLNodePtr xmlNode;
- if (LLUICtrlFactory::getLayeredXMLNode("outfit_accordion_tab.xml", xmlNode))
- {
- LLXUIParser parser;
- parser.readXUI(xmlNode, tab_params, "outfit_accordion_tab.xml");
- }
- else
- {
- LL_WARNS() << "Failed to read xml of Outfit's Accordion Tab from outfit_accordion_tab.xml" << LL_ENDL;
- }
- }
+ LLXMLNodePtr xmlNode;
+ if (LLUICtrlFactory::getLayeredXMLNode("outfit_accordion_tab.xml", xmlNode))
+ {
+ LLXUIParser parser;
+ parser.readXUI(xmlNode, tab_params, "outfit_accordion_tab.xml");
+ }
+ else
+ {
+ LL_WARNS() << "Failed to read xml of Outfit's Accordion Tab from outfit_accordion_tab.xml" << LL_ENDL;
+ }
+ }
- return tab_params;
+ return tab_params;
}
@@ -101,8 +101,8 @@ static LLPanelInjector<LLOutfitsList> t_outfits_list("outfits_list");
LLOutfitsList::LLOutfitsList()
: LLOutfitListBase()
, mAccordion(NULL)
- , mListCommands(NULL)
- , mItemSelected(false)
+ , mListCommands(NULL)
+ , mItemSelected(false)
{
}
@@ -112,8 +112,8 @@ LLOutfitsList::~LLOutfitsList()
BOOL LLOutfitsList::postBuild()
{
- mAccordion = getChild<LLAccordionCtrl>("outfits_accordion");
- mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR);
+ mAccordion = getChild<LLAccordionCtrl>("outfits_accordion");
+ mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR);
return LLOutfitListBase::postBuild();
}
@@ -129,11 +129,11 @@ void LLOutfitsList::onOpen(const LLSD& info)
LLOutfitListBase::onOpen(info);
- LLAccordionCtrlTab* selected_tab = mAccordion->getSelectedTab();
- if (!selected_tab) return;
+ LLAccordionCtrlTab* selected_tab = mAccordion->getSelectedTab();
+ if (!selected_tab) return;
- // Pass focus to the selected outfit tab.
- selected_tab->showAndFocusHeader();
+ // Pass focus to the selected outfit tab.
+ selected_tab->showAndFocusHeader();
}
@@ -220,27 +220,27 @@ void LLOutfitsList::updateRemovedCategory(LLUUID cat_id)
outfits_map_t::iterator outfits_iter = mOutfitsMap.find(cat_id);
if (outfits_iter != mOutfitsMap.end())
{
- const LLUUID& outfit_id = outfits_iter->first;
- LLAccordionCtrlTab* tab = outfits_iter->second;
+ const LLUUID& outfit_id = outfits_iter->first;
+ LLAccordionCtrlTab* tab = outfits_iter->second;
- // An outfit is removed from the list. Do the following:
- // 1. Remove outfit category from observer to stop monitoring its changes.
- mCategoriesObserver->removeCategory(outfit_id);
+ // An outfit is removed from the list. Do the following:
+ // 1. Remove outfit category from observer to stop monitoring its changes.
+ mCategoriesObserver->removeCategory(outfit_id);
- // 2. Remove the outfit from selection.
- deselectOutfit(outfit_id);
+ // 2. Remove the outfit from selection.
+ deselectOutfit(outfit_id);
- // 3. Remove category UUID to accordion tab mapping.
- mOutfitsMap.erase(outfits_iter);
+ // 3. Remove category UUID to accordion tab mapping.
+ mOutfitsMap.erase(outfits_iter);
- // 4. Remove outfit tab from accordion.
- mAccordion->removeCollapsibleCtrl(tab);
+ // 4. Remove outfit tab from accordion.
+ mAccordion->removeCollapsibleCtrl(tab);
- // kill removed tab
- if (tab != NULL)
- {
- tab->die();
- }
+ // kill removed tab
+ if (tab != NULL)
+ {
+ tab->die();
+ }
}
}
@@ -253,166 +253,166 @@ void LLOutfitsList::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)
mOutfitsMap[prev_id]->setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor"));
}
if (mOutfitsMap[base_id])
- {
- mOutfitsMap[base_id]->setTitleFontStyle("BOLD");
- mOutfitsMap[base_id]->setTitleColor(LLUIColorTable::instance().getColor("SelectedOutfitTextColor"));
- }
+ {
+ mOutfitsMap[base_id]->setTitleFontStyle("BOLD");
+ mOutfitsMap[base_id]->setTitleColor(LLUIColorTable::instance().getColor("SelectedOutfitTextColor"));
+ }
}
void LLOutfitsList::onListSelectionChange(LLUICtrl* ctrl)
{
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(ctrl);
- if (!list) return;
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(ctrl);
+ if (!list) return;
- LLViewerInventoryItem *item = gInventory.getItem(list->getSelectedUUID());
- if (!item) return;
+ LLViewerInventoryItem *item = gInventory.getItem(list->getSelectedUUID());
+ if (!item) return;
- ChangeOutfitSelection(list, item->getParentUUID());
+ ChangeOutfitSelection(list, item->getParentUUID());
}
void LLOutfitListBase::performAction(std::string action)
{
- if (mSelectedOutfitUUID.isNull()) return;
+ if (mSelectedOutfitUUID.isNull()) return;
- LLViewerInventoryCategory* cat = gInventory.getCategory(mSelectedOutfitUUID);
- if (!cat) return;
+ LLViewerInventoryCategory* cat = gInventory.getCategory(mSelectedOutfitUUID);
+ if (!cat) return;
- if ("replaceoutfit" == action)
- {
- LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, FALSE );
- }
- else if ("addtooutfit" == action)
- {
- LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, TRUE );
- }
- else if ("rename_outfit" == action)
- {
- LLAppearanceMgr::instance().renameOutfit(mSelectedOutfitUUID);
- }
+ if ("replaceoutfit" == action)
+ {
+ LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, FALSE );
+ }
+ else if ("addtooutfit" == action)
+ {
+ LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, TRUE );
+ }
+ else if ("rename_outfit" == action)
+ {
+ LLAppearanceMgr::instance().renameOutfit(mSelectedOutfitUUID);
+ }
}
void LLOutfitsList::onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid)
{
- for (outfits_map_t::iterator iter = mOutfitsMap.begin();
- iter != mOutfitsMap.end();
- ++iter)
- {
- if (outfit_uuid == iter->first)
- {
- LLAccordionCtrlTab* tab = iter->second;
- if (!tab) continue;
+ for (outfits_map_t::iterator iter = mOutfitsMap.begin();
+ iter != mOutfitsMap.end();
+ ++iter)
+ {
+ if (outfit_uuid == iter->first)
+ {
+ LLAccordionCtrlTab* tab = iter->second;
+ if (!tab) continue;
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
- if (!list) continue;
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
+ if (!list) continue;
- tab->setFocus(TRUE);
- ChangeOutfitSelection(list, outfit_uuid);
+ tab->setFocus(TRUE);
+ ChangeOutfitSelection(list, outfit_uuid);
- tab->changeOpenClose(false);
- }
- }
+ tab->changeOpenClose(false);
+ }
+ }
}
// virtual
bool LLOutfitListBase::isActionEnabled(const LLSD& userdata)
{
- if (mSelectedOutfitUUID.isNull()) return false;
+ if (mSelectedOutfitUUID.isNull()) return false;
- const std::string command_name = userdata.asString();
- if (command_name == "delete")
- {
+ const std::string command_name = userdata.asString();
+ if (command_name == "delete")
+ {
return !hasItemSelected() && LLAppearanceMgr::instance().getCanRemoveOutfit(mSelectedOutfitUUID);
- }
- if (command_name == "rename")
- {
- return get_is_category_renameable(&gInventory, mSelectedOutfitUUID);
- }
- if (command_name == "save_outfit")
- {
- bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked();
- bool outfit_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
- // allow save only if outfit isn't locked and is dirty
- return !outfit_locked && outfit_dirty;
- }
- if (command_name == "wear")
- {
- if (gAgentWearables.isCOFChangeInProgress())
- {
- return false;
- }
-
- if (hasItemSelected())
- {
- return canWearSelected();
- }
-
- // outfit selected
- return LLAppearanceMgr::instance().getCanReplaceCOF(mSelectedOutfitUUID);
- }
- if (command_name == "take_off")
- {
- // Enable "Take Off" if any of selected items can be taken off
- // or the selected outfit contains items that can be taken off.
- return ( hasItemSelected() && canTakeOffSelected() )
- || ( !hasItemSelected() && LLAppearanceMgr::getCanRemoveFromCOF(mSelectedOutfitUUID) );
- }
-
- if (command_name == "wear_add")
- {
- // *TODO: do we ever get here?
- return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID);
- }
-
- return false;
+ }
+ if (command_name == "rename")
+ {
+ return get_is_category_renameable(&gInventory, mSelectedOutfitUUID);
+ }
+ if (command_name == "save_outfit")
+ {
+ bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked();
+ bool outfit_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
+ // allow save only if outfit isn't locked and is dirty
+ return !outfit_locked && outfit_dirty;
+ }
+ if (command_name == "wear")
+ {
+ if (gAgentWearables.isCOFChangeInProgress())
+ {
+ return false;
+ }
+
+ if (hasItemSelected())
+ {
+ return canWearSelected();
+ }
+
+ // outfit selected
+ return LLAppearanceMgr::instance().getCanReplaceCOF(mSelectedOutfitUUID);
+ }
+ if (command_name == "take_off")
+ {
+ // Enable "Take Off" if any of selected items can be taken off
+ // or the selected outfit contains items that can be taken off.
+ return ( hasItemSelected() && canTakeOffSelected() )
+ || ( !hasItemSelected() && LLAppearanceMgr::getCanRemoveFromCOF(mSelectedOutfitUUID) );
+ }
+
+ if (command_name == "wear_add")
+ {
+ // *TODO: do we ever get here?
+ return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID);
+ }
+
+ return false;
}
void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const
{
- // Collect selected items from all selected lists.
- for (wearables_lists_map_t::const_iterator iter = mSelectedListsMap.begin();
- iter != mSelectedListsMap.end();
- ++iter)
- {
- uuid_vec_t uuids;
- (*iter).second->getSelectedUUIDs(uuids);
+ // Collect selected items from all selected lists.
+ for (wearables_lists_map_t::const_iterator iter = mSelectedListsMap.begin();
+ iter != mSelectedListsMap.end();
+ ++iter)
+ {
+ uuid_vec_t uuids;
+ (*iter).second->getSelectedUUIDs(uuids);
- S32 prev_size = selected_uuids.size();
- selected_uuids.resize(prev_size + uuids.size());
- std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size);
- }
+ S32 prev_size = selected_uuids.size();
+ selected_uuids.resize(prev_size + uuids.size());
+ std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size);
+ }
}
void LLOutfitsList::onCollapseAllFolders()
{
- for (outfits_map_t::iterator iter = mOutfitsMap.begin();
- iter != mOutfitsMap.end();
- ++iter)
- {
- LLAccordionCtrlTab* tab = iter->second;
- if(tab && tab->isExpanded())
- {
- tab->changeOpenClose(true);
- }
- }
+ for (outfits_map_t::iterator iter = mOutfitsMap.begin();
+ iter != mOutfitsMap.end();
+ ++iter)
+ {
+ LLAccordionCtrlTab* tab = iter->second;
+ if(tab && tab->isExpanded())
+ {
+ tab->changeOpenClose(true);
+ }
+ }
}
void LLOutfitsList::onExpandAllFolders()
{
- for (outfits_map_t::iterator iter = mOutfitsMap.begin();
- iter != mOutfitsMap.end();
- ++iter)
- {
- LLAccordionCtrlTab* tab = iter->second;
- if(tab && !tab->isExpanded())
- {
- tab->changeOpenClose(false);
- }
- }
+ for (outfits_map_t::iterator iter = mOutfitsMap.begin();
+ iter != mOutfitsMap.end();
+ ++iter)
+ {
+ LLAccordionCtrlTab* tab = iter->second;
+ if(tab && !tab->isExpanded())
+ {
+ tab->changeOpenClose(false);
+ }
+ }
}
bool LLOutfitsList::hasItemSelected()
{
- return mItemSelected;
+ return mItemSelected;
}
//////////////////////////////////////////////////////////////////////////
@@ -422,285 +422,285 @@ bool LLOutfitsList::hasItemSelected()
void LLOutfitsList::updateChangedCategoryName(LLViewerInventoryCategory *cat, std::string name)
{
outfits_map_t::iterator outfits_iter = mOutfitsMap.find(cat->getUUID());
- if (outfits_iter != mOutfitsMap.end())
- {
- // Update tab name with the new category name.
- LLAccordionCtrlTab* tab = outfits_iter->second;
- if (tab)
- {
- tab->setName(name);
- tab->setTitle(name);
- }
- }
+ if (outfits_iter != mOutfitsMap.end())
+ {
+ // Update tab name with the new category name.
+ LLAccordionCtrlTab* tab = outfits_iter->second;
+ if (tab)
+ {
+ tab->setName(name);
+ tab->setTitle(name);
+ }
+ }
}
void LLOutfitsList::resetItemSelection(LLWearableItemsList* list, const LLUUID& category_id)
{
- list->resetSelection();
- mItemSelected = false;
- signalSelectionOutfitUUID(category_id);
+ list->resetSelection();
+ mItemSelected = false;
+ signalSelectionOutfitUUID(category_id);
}
void LLOutfitsList::onChangeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id)
{
- MASK mask = gKeyboard->currentMask(TRUE);
+ MASK mask = gKeyboard->currentMask(TRUE);
- // Reset selection in all previously selected tabs except for the current
- // if new selection is started.
- if (list && !(mask & MASK_CONTROL))
- {
- for (wearables_lists_map_t::iterator iter = mSelectedListsMap.begin();
- iter != mSelectedListsMap.end();
- ++iter)
- {
- LLWearableItemsList* selected_list = (*iter).second;
- if (selected_list != list)
- {
- selected_list->resetSelection();
- }
- }
+ // Reset selection in all previously selected tabs except for the current
+ // if new selection is started.
+ if (list && !(mask & MASK_CONTROL))
+ {
+ for (wearables_lists_map_t::iterator iter = mSelectedListsMap.begin();
+ iter != mSelectedListsMap.end();
+ ++iter)
+ {
+ LLWearableItemsList* selected_list = (*iter).second;
+ if (selected_list != list)
+ {
+ selected_list->resetSelection();
+ }
+ }
- // Clear current selection.
- mSelectedListsMap.clear();
- }
+ // Clear current selection.
+ mSelectedListsMap.clear();
+ }
- mItemSelected = list && (list->getSelectedItem() != NULL);
+ mItemSelected = list && (list->getSelectedItem() != NULL);
- mSelectedListsMap.insert(wearables_lists_map_value_t(category_id, list));
+ mSelectedListsMap.insert(wearables_lists_map_value_t(category_id, list));
}
void LLOutfitsList::deselectOutfit(const LLUUID& category_id)
{
- // Remove selected lists map entry.
- mSelectedListsMap.erase(category_id);
-
+ // Remove selected lists map entry.
+ mSelectedListsMap.erase(category_id);
+
LLOutfitListBase::deselectOutfit(category_id);
}
void LLOutfitsList::restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id)
{
- // Try restoring outfit selection after filtering.
- if (mAccordion->getSelectedTab() == tab)
- {
- signalSelectionOutfitUUID(category_id);
- }
+ // Try restoring outfit selection after filtering.
+ if (mAccordion->getSelectedTab() == tab)
+ {
+ signalSelectionOutfitUUID(category_id);
+ }
}
void LLOutfitsList::onRefreshComplete(LLUICtrl* ctrl)
{
- if (!ctrl || getFilterSubString().empty())
- return;
+ if (!ctrl || getFilterSubString().empty())
+ return;
- for (outfits_map_t::iterator
- iter = mOutfitsMap.begin(),
- iter_end = mOutfitsMap.end();
- iter != iter_end; ++iter)
- {
- LLAccordionCtrlTab* tab = iter->second;
- if (!tab) continue;
+ for (outfits_map_t::iterator
+ iter = mOutfitsMap.begin(),
+ iter_end = mOutfitsMap.end();
+ iter != iter_end; ++iter)
+ {
+ LLAccordionCtrlTab* tab = iter->second;
+ if (!tab) continue;
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
- if (list != ctrl) continue;
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
+ if (list != ctrl) continue;
- applyFilterToTab(iter->first, tab, getFilterSubString());
- }
+ applyFilterToTab(iter->first, tab, getFilterSubString());
+ }
}
// virtual
void LLOutfitsList::onFilterSubStringChanged(const std::string& new_string, const std::string& old_string)
{
- mAccordion->setFilterSubString(new_string);
+ mAccordion->setFilterSubString(new_string);
- outfits_map_t::iterator iter = mOutfitsMap.begin(), iter_end = mOutfitsMap.end();
- while (iter != iter_end)
- {
- const LLUUID& category_id = iter->first;
- LLAccordionCtrlTab* tab = iter++->second;
- if (!tab) continue;
+ outfits_map_t::iterator iter = mOutfitsMap.begin(), iter_end = mOutfitsMap.end();
+ while (iter != iter_end)
+ {
+ const LLUUID& category_id = iter->first;
+ LLAccordionCtrlTab* tab = iter++->second;
+ if (!tab) continue;
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
- if (list)
- {
- list->setFilterSubString(new_string, tab->getDisplayChildren());
- }
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
+ if (list)
+ {
+ list->setFilterSubString(new_string, tab->getDisplayChildren());
+ }
- if (old_string.empty())
- {
- // Store accordion tab state when filter is not empty
- tab->notifyChildren(LLSD().with("action", "store_state"));
- }
+ if (old_string.empty())
+ {
+ // Store accordion tab state when filter is not empty
+ tab->notifyChildren(LLSD().with("action", "store_state"));
+ }
- if (!new_string.empty())
- {
- applyFilterToTab(category_id, tab, new_string);
- }
- else
- {
- tab->setVisible(TRUE);
+ if (!new_string.empty())
+ {
+ applyFilterToTab(category_id, tab, new_string);
+ }
+ else
+ {
+ tab->setVisible(TRUE);
- // Restore tab title when filter is empty
- tab->setTitle(tab->getTitle());
+ // Restore tab title when filter is empty
+ tab->setTitle(tab->getTitle());
- // Restore accordion state after all those accodrion tab manipulations
- tab->notifyChildren(LLSD().with("action", "restore_state"));
+ // Restore accordion state after all those accodrion tab manipulations
+ tab->notifyChildren(LLSD().with("action", "restore_state"));
- // Try restoring the tab selection.
- restoreOutfitSelection(tab, category_id);
- }
- }
+ // Try restoring the tab selection.
+ restoreOutfitSelection(tab, category_id);
+ }
+ }
- mAccordion->arrange();
+ mAccordion->arrange();
}
void LLOutfitsList::applyFilterToTab(
- const LLUUID& category_id,
- LLAccordionCtrlTab* tab,
- const std::string& filter_substring)
+ const LLUUID& category_id,
+ LLAccordionCtrlTab* tab,
+ const std::string& filter_substring)
{
- if (!tab) return;
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
- if (!list) return;
+ if (!tab) return;
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
+ if (!list) return;
- std::string title = tab->getTitle();
- LLStringUtil::toUpper(title);
+ std::string title = tab->getTitle();
+ LLStringUtil::toUpper(title);
- std::string cur_filter = filter_substring;
- LLStringUtil::toUpper(cur_filter);
+ std::string cur_filter = filter_substring;
+ LLStringUtil::toUpper(cur_filter);
- tab->setTitle(tab->getTitle(), cur_filter);
+ tab->setTitle(tab->getTitle(), cur_filter);
- if (std::string::npos == title.find(cur_filter))
- {
- // Hide tab if its title doesn't pass filter
- // and it has no matched items
- tab->setVisible(list->hasMatchedItems());
+ if (std::string::npos == title.find(cur_filter))
+ {
+ // Hide tab if its title doesn't pass filter
+ // and it has no matched items
+ tab->setVisible(list->hasMatchedItems());
- // Remove title highlighting because it might
- // have been previously highlighted by less restrictive filter
- tab->setTitle(tab->getTitle());
+ // Remove title highlighting because it might
+ // have been previously highlighted by less restrictive filter
+ tab->setTitle(tab->getTitle());
- // Remove the tab from selection.
- deselectOutfit(category_id);
- }
- else
- {
- // Try restoring the tab selection.
- restoreOutfitSelection(tab, category_id);
- }
+ // Remove the tab from selection.
+ deselectOutfit(category_id);
+ }
+ else
+ {
+ // Try restoring the tab selection.
+ restoreOutfitSelection(tab, category_id);
+ }
}
bool LLOutfitsList::canWearSelected()
{
- if (!isAgentAvatarValid())
- {
- return false;
- }
+ if (!isAgentAvatarValid())
+ {
+ return false;
+ }
- uuid_vec_t selected_items;
- getSelectedItemsUUIDs(selected_items);
- S32 nonreplacable_objects = 0;
+ uuid_vec_t selected_items;
+ getSelectedItemsUUIDs(selected_items);
+ S32 nonreplacable_objects = 0;
- for (uuid_vec_t::const_iterator it = selected_items.begin(); it != selected_items.end(); ++it)
- {
- const LLUUID& id = *it;
+ for (uuid_vec_t::const_iterator it = selected_items.begin(); it != selected_items.end(); ++it)
+ {
+ const LLUUID& id = *it;
- // Check whether the item is worn.
- if (!get_can_item_be_worn(id))
- {
- return false;
- }
+ // Check whether the item is worn.
+ if (!get_can_item_be_worn(id))
+ {
+ return false;
+ }
- const LLViewerInventoryItem* item = gInventory.getItem(id);
- if (!item)
- {
- return false;
- }
+ const LLViewerInventoryItem* item = gInventory.getItem(id);
+ if (!item)
+ {
+ return false;
+ }
- if (item->getType() == LLAssetType::AT_OBJECT)
- {
- nonreplacable_objects++;
- }
- }
+ if (item->getType() == LLAssetType::AT_OBJECT)
+ {
+ nonreplacable_objects++;
+ }
+ }
- // All selected items can be worn. But do we have enough space for them?
- return nonreplacable_objects == 0 || gAgentAvatarp->canAttachMoreObjects(nonreplacable_objects);
+ // All selected items can be worn. But do we have enough space for them?
+ return nonreplacable_objects == 0 || gAgentAvatarp->canAttachMoreObjects(nonreplacable_objects);
}
void LLOutfitsList::wearSelectedItems()
{
- uuid_vec_t selected_uuids;
- getSelectedItemsUUIDs(selected_uuids);
+ uuid_vec_t selected_uuids;
+ getSelectedItemsUUIDs(selected_uuids);
- if(selected_uuids.empty())
- {
- return;
- }
+ if(selected_uuids.empty())
+ {
+ return;
+ }
- wear_multiple(selected_uuids, false);
+ wear_multiple(selected_uuids, false);
}
void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y)
{
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(ctrl);
- if (!list) return;
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(ctrl);
+ if (!list) return;
- uuid_vec_t selected_uuids;
+ uuid_vec_t selected_uuids;
- getSelectedItemsUUIDs(selected_uuids);
+ getSelectedItemsUUIDs(selected_uuids);
- LLWearableItemsList::ContextMenu::instance().show(list, selected_uuids, x, y);
+ LLWearableItemsList::ContextMenu::instance().show(list, selected_uuids, x, y);
}
void LLOutfitsList::onCOFChanged()
{
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
-
- // Collect current COF items
- gInventory.collectDescendents(
- LLAppearanceMgr::instance().getCOF(),
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH);
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
- uuid_vec_t vnew;
- uuid_vec_t vadded;
- uuid_vec_t vremoved;
+ // Collect current COF items
+ gInventory.collectDescendents(
+ LLAppearanceMgr::instance().getCOF(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
- // From gInventory we get the UUIDs of links that are currently in COF.
- // These links UUIDs are not the same UUIDs that we have in each wearable items list.
- // So we collect base items' UUIDs to find them or links that point to them in wearable
- // items lists and update their worn state there.
- LLInventoryModel::item_array_t::const_iterator array_iter = item_array.begin(), array_end = item_array.end();
- while (array_iter < array_end)
- {
- vnew.push_back((*(array_iter++))->getLinkedUUID());
- }
+ uuid_vec_t vnew;
+ uuid_vec_t vadded;
+ uuid_vec_t vremoved;
+
+ // From gInventory we get the UUIDs of links that are currently in COF.
+ // These links UUIDs are not the same UUIDs that we have in each wearable items list.
+ // So we collect base items' UUIDs to find them or links that point to them in wearable
+ // items lists and update their worn state there.
+ LLInventoryModel::item_array_t::const_iterator array_iter = item_array.begin(), array_end = item_array.end();
+ while (array_iter < array_end)
+ {
+ vnew.push_back((*(array_iter++))->getLinkedUUID());
+ }
- // We need to update only items that were added or removed from COF.
- LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved);
+ // We need to update only items that were added or removed from COF.
+ LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved);
- // Store the ids of items currently linked from COF.
- mCOFLinkedItems = vnew;
+ // Store the ids of items currently linked from COF.
+ mCOFLinkedItems = vnew;
- // Append removed ids to added ids because we should update all of them.
- vadded.reserve(vadded.size() + vremoved.size());
- vadded.insert(vadded.end(), vremoved.begin(), vremoved.end());
- vremoved.clear();
+ // Append removed ids to added ids because we should update all of them.
+ vadded.reserve(vadded.size() + vremoved.size());
+ vadded.insert(vadded.end(), vremoved.begin(), vremoved.end());
+ vremoved.clear();
- outfits_map_t::iterator map_iter = mOutfitsMap.begin(), map_end = mOutfitsMap.end();
- while (map_iter != map_end)
- {
- LLAccordionCtrlTab* tab = (map_iter++)->second;
- if (!tab) continue;
+ outfits_map_t::iterator map_iter = mOutfitsMap.begin(), map_end = mOutfitsMap.end();
+ while (map_iter != map_end)
+ {
+ LLAccordionCtrlTab* tab = (map_iter++)->second;
+ if (!tab) continue;
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
- if (!list) continue;
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
+ if (!list) continue;
- // Every list updates the labels of changed items or
- // the links that point to these items.
- list->updateChangedItems(vadded);
- }
+ // Every list updates the labels of changed items or
+ // the links that point to these items.
+ list->updateChangedItems(vadded);
+ }
}
void LLOutfitsList::getCurrentCategories(uuid_vec_t& vcur)
@@ -746,10 +746,10 @@ LLOutfitListGearMenuBase* LLOutfitsList::createGearMenu()
bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y)
{
- if(!tab || !tab->getHeaderVisible()) return false;
+ if(!tab || !tab->getHeaderVisible()) return false;
- S32 header_bottom = tab->getLocalRect().getHeight() - tab->getHeaderHeight();
- return y >= header_bottom;
+ S32 header_bottom = tab->getLocalRect().getHeight() - tab->getHeaderHeight();
+ return y >= header_bottom;
}
LLOutfitListBase::LLOutfitListBase()
@@ -1342,7 +1342,7 @@ void LLOutfitListGearMenu::onUpdateItemsVisibility()
BOOL LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask)
{
- if (y >= getLocalRect().getHeight() - getHeaderHeight())
+ if (y >= getLocalRect().getHeight() - getHeaderHeight())
{
LLSD params;
params["inv_type"] = LLInventoryType::IT_CATEGORY;
diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h
index 89821f9333..7067a30b12 100644
--- a/indra/newview/lloutfitslist.h
+++ b/indra/newview/lloutfitslist.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,13 +52,13 @@ class LLListContextMenu;
*/
class LLOutfitTabNameComparator : public LLAccordionCtrl::LLTabComparator
{
- LOG_CLASS(LLOutfitTabNameComparator);
+ LOG_CLASS(LLOutfitTabNameComparator);
public:
- LLOutfitTabNameComparator() {};
- virtual ~LLOutfitTabNameComparator() {};
+ LLOutfitTabNameComparator() {};
+ virtual ~LLOutfitTabNameComparator() {};
- /*virtual*/ bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const;
+ /*virtual*/ bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const;
};
class LLOutfitListBase : public LLPanelAppearanceTab
@@ -122,21 +122,21 @@ protected:
struct
{
- LLUUID CategoryUUID;
- uuid_vec_t Added;
- uuid_vec_t Removed;
- uuid_vec_t::const_iterator AddedIterator;
- uuid_vec_t::const_iterator RemovedIterator;
+ LLUUID CategoryUUID;
+ uuid_vec_t Added;
+ uuid_vec_t Removed;
+ uuid_vec_t::const_iterator AddedIterator;
+ uuid_vec_t::const_iterator RemovedIterator;
} mRefreshListState;
bool mIsInitialized;
- LLInventoryCategoriesObserver* mCategoriesObserver;
- LLUUID mSelectedOutfitUUID;
+ LLInventoryCategoriesObserver* mCategoriesObserver;
+ LLUUID mSelectedOutfitUUID;
// id of currently highlited outfit
- LLUUID mHighlightedOutfitUUID;
- selection_change_signal_t mSelectionChangeSignal;
- LLListContextMenu* mOutfitMenu;
- LLOutfitListGearMenuBase* mGearMenu;
+ LLUUID mHighlightedOutfitUUID;
+ selection_change_signal_t mSelectionChangeSignal;
+ LLListContextMenu* mOutfitMenu;
+ LLOutfitListGearMenuBase* mGearMenu;
};
//////////////////////////////////////////////////////////////////////////
@@ -164,7 +164,7 @@ protected:
void onSave(const LLUUID &outfit_cat_id);
private:
- LLOutfitListBase* mOutfitList;
+ LLOutfitListBase* mOutfitList;
};
class LLOutfitListGearMenuBase
@@ -172,7 +172,7 @@ class LLOutfitListGearMenuBase
public:
LLOutfitListGearMenuBase(LLOutfitListBase* olist);
virtual ~LLOutfitListGearMenuBase();
-
+
void updateItemsVisibility();
LLToggleableMenu* getMenu();
@@ -184,8 +184,8 @@ protected:
const LLUUID& getSelectedOutfitID();
- LLOutfitListBase* mOutfitList;
- LLToggleableMenu* mMenu;
+ LLOutfitListBase* mOutfitList;
+ LLToggleableMenu* mMenu;
private:
LLViewerInventoryCategory* getSelectedOutfit();
@@ -222,8 +222,8 @@ public:
virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
protected:
- LLOutfitAccordionCtrlTab(const LLOutfitAccordionCtrlTab::Params &p)
- : LLAccordionCtrlTab(p),
+ LLOutfitAccordionCtrlTab(const LLOutfitAccordionCtrlTab::Params &p)
+ : LLAccordionCtrlTab(p),
mFolderID(p.cat_id)
{}
friend class LLUICtrlFactory;
@@ -243,12 +243,12 @@ class LLOutfitsList : public LLOutfitListBase
{
public:
- LLOutfitsList();
- virtual ~LLOutfitsList();
+ LLOutfitsList();
+ virtual ~LLOutfitsList();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& info);
+ /*virtual*/ void onOpen(const LLSD& info);
//virtual void refreshList(const LLUUID& category_id);
@@ -256,32 +256,32 @@ public:
/*virtual*/ void updateAddedCategory(LLUUID cat_id);
/*virtual*/ void updateRemovedCategory(LLUUID cat_id);
- // highlits currently worn outfit tab text and unhighlights previously worn
+ // highlits currently worn outfit tab text and unhighlights previously worn
/*virtual*/ void onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id);
- //void performAction(std::string action);
+ //void performAction(std::string action);
- /*virtual*/ void onFilterSubStringChanged(const std::string& new_string, const std::string& old_string);
+ /*virtual*/ void onFilterSubStringChanged(const std::string& new_string, const std::string& old_string);
- /*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
+ /*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
// Collects selected items from all selected lists and wears them(if possible- adds, else replaces)
- void wearSelectedItems();
+ void wearSelectedItems();
- /**
- * Returns true if there is a selection inside currently selected outfit
- */
+ /**
+ * Returns true if there is a selection inside currently selected outfit
+ */
/*virtual*/ bool hasItemSelected();
- /**
- Collapses all outfit accordions.
- */
- /*virtual*/ void onCollapseAllFolders();
- /**
- Expands all outfit accordions.
- */
- void onExpandAllFolders();
+ /**
+ Collapses all outfit accordions.
+ */
+ /*virtual*/ void onCollapseAllFolders();
+ /**
+ Expands all outfit accordions.
+ */
+ void onExpandAllFolders();
/*virtual*/ bool getHasExpandableFolders() { return TRUE; }
@@ -290,95 +290,95 @@ protected:
private:
- /**
- * Wrapper for LLCommonUtils::computeDifference. @see LLCommonUtils::computeDifference
- */
- //void computeDifference(const LLInventoryModel::cat_array_t& vcats, uuid_vec_t& vadded, uuid_vec_t& vremoved);
+ /**
+ * Wrapper for LLCommonUtils::computeDifference. @see LLCommonUtils::computeDifference
+ */
+ //void computeDifference(const LLInventoryModel::cat_array_t& vcats, uuid_vec_t& vadded, uuid_vec_t& vremoved);
void getCurrentCategories(uuid_vec_t& vcur);
- /**
- * Updates tab displaying outfit identified by category_id.
- */
+ /**
+ * Updates tab displaying outfit identified by category_id.
+ */
/*virtual*/ void updateChangedCategoryName(LLViewerInventoryCategory *cat, std::string name);
/*virtual*/ void sortOutfits();
/*virtual*/ void onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid);
- /**
- * Resets previous selection and stores newly selected list and outfit id.
- */
+ /**
+ * Resets previous selection and stores newly selected list and outfit id.
+ */
/*virtual*/ void onChangeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id);
- /**
- *Resets items selection inside outfit
- */
- void resetItemSelection(LLWearableItemsList* list, const LLUUID& category_id);
-
- /**
- * Removes the outfit from selection.
- */
- /*virtual*/ void deselectOutfit(const LLUUID& category_id);
-
- /**
- * Try restoring selection for a temporary hidden tab.
- *
- * A tab may be hidden if it doesn't match current filter.
- */
- void restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id);
-
- /**
- * Called upon list refresh event to update tab visibility depending on
- * the results of applying filter to the title and list items of the tab.
- */
- void onRefreshComplete(LLUICtrl* ctrl);
-
- /**
- * Applies filter to the given tab
- *
- * @see applyFilter()
- */
- void applyFilterToTab(const LLUUID& category_id, LLAccordionCtrlTab* tab, const std::string& filter_substring);
-
- /**
- * Returns true if all selected items can be worn.
- */
- bool canWearSelected();
-
- void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
- void onCOFChanged();
-
- void onListSelectionChange(LLUICtrl* ctrl);
+ /**
+ *Resets items selection inside outfit
+ */
+ void resetItemSelection(LLWearableItemsList* list, const LLUUID& category_id);
+
+ /**
+ * Removes the outfit from selection.
+ */
+ /*virtual*/ void deselectOutfit(const LLUUID& category_id);
+
+ /**
+ * Try restoring selection for a temporary hidden tab.
+ *
+ * A tab may be hidden if it doesn't match current filter.
+ */
+ void restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id);
+
+ /**
+ * Called upon list refresh event to update tab visibility depending on
+ * the results of applying filter to the title and list items of the tab.
+ */
+ void onRefreshComplete(LLUICtrl* ctrl);
+
+ /**
+ * Applies filter to the given tab
+ *
+ * @see applyFilter()
+ */
+ void applyFilterToTab(const LLUUID& category_id, LLAccordionCtrlTab* tab, const std::string& filter_substring);
+
+ /**
+ * Returns true if all selected items can be worn.
+ */
+ bool canWearSelected();
+
+ void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
+ void onCOFChanged();
+
+ void onListSelectionChange(LLUICtrl* ctrl);
/*virtual*/ void onOutfitRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id);
- static void onOutfitRename(const LLSD& notification, const LLSD& response);
+ static void onOutfitRename(const LLSD& notification, const LLSD& response);
- //LLInventoryCategoriesObserver* mCategoriesObserver;
+ //LLInventoryCategoriesObserver* mCategoriesObserver;
- LLAccordionCtrl* mAccordion;
- LLPanel* mListCommands;
+ LLAccordionCtrl* mAccordion;
+ LLPanel* mListCommands;
- typedef std::map<LLUUID, LLWearableItemsList*> wearables_lists_map_t;
- typedef wearables_lists_map_t::value_type wearables_lists_map_value_t;
- wearables_lists_map_t mSelectedListsMap;
+ typedef std::map<LLUUID, LLWearableItemsList*> wearables_lists_map_t;
+ typedef wearables_lists_map_t::value_type wearables_lists_map_value_t;
+ wearables_lists_map_t mSelectedListsMap;
- typedef std::map<LLUUID, LLAccordionCtrlTab*> outfits_map_t;
- typedef outfits_map_t::value_type outfits_map_value_t;
- outfits_map_t mOutfitsMap;
+ typedef std::map<LLUUID, LLAccordionCtrlTab*> outfits_map_t;
+ typedef outfits_map_t::value_type outfits_map_value_t;
+ outfits_map_t mOutfitsMap;
- // IDs of original items which are worn and linked in COF.
- // Used to monitor COF changes for updating items worn state. See EXT-8636.
- uuid_vec_t mCOFLinkedItems;
+ // IDs of original items which are worn and linked in COF.
+ // Used to monitor COF changes for updating items worn state. See EXT-8636.
+ uuid_vec_t mCOFLinkedItems;
- //LLOutfitListGearMenu* mGearMenu;
+ //LLOutfitListGearMenu* mGearMenu;
- //bool mIsInitialized;
- /**
- * True if there is a selection inside currently selected outfit
- */
- bool mItemSelected;
+ //bool mIsInitialized;
+ /**
+ * True if there is a selection inside currently selected outfit
+ */
+ bool mItemSelected;
};
#endif //LL_LLOUTFITSLIST_H
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp
index 7129641c20..db43c57139 100644
--- a/indra/newview/lloutputmonitorctrl.cpp
+++ b/indra/newview/lloutputmonitorctrl.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lloutputmonitorctrl.cpp
* @brief LLOutputMonitorCtrl base class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "lloutputmonitorctrl.h"
-// library includes
+// library includes
#include "llfloaterreg.h"
#include "llui.h"
@@ -40,221 +40,221 @@
static LLDefaultChildRegistry::Register<LLOutputMonitorCtrl> r("output_monitor");
// The defaults will be initialized in the constructor.
-//LLColor4 LLOutputMonitorCtrl::sColorMuted;
-//LLColor4 LLOutputMonitorCtrl::sColorOverdriven;
-//LLColor4 LLOutputMonitorCtrl::sColorNormal;
-LLColor4 LLOutputMonitorCtrl::sColorBound;
-//S32 LLOutputMonitorCtrl::sRectsNumber = 0;
-//F32 LLOutputMonitorCtrl::sRectWidthRatio = 0.f;
-//F32 LLOutputMonitorCtrl::sRectHeightRatio = 0.f;
+//LLColor4 LLOutputMonitorCtrl::sColorMuted;
+//LLColor4 LLOutputMonitorCtrl::sColorOverdriven;
+//LLColor4 LLOutputMonitorCtrl::sColorNormal;
+LLColor4 LLOutputMonitorCtrl::sColorBound;
+//S32 LLOutputMonitorCtrl::sRectsNumber = 0;
+//F32 LLOutputMonitorCtrl::sRectWidthRatio = 0.f;
+//F32 LLOutputMonitorCtrl::sRectHeightRatio = 0.f;
LLOutputMonitorCtrl::Params::Params()
-: draw_border("draw_border"),
- image_mute("image_mute"),
- image_off("image_off"),
- image_on("image_on"),
- image_level_1("image_level_1"),
- image_level_2("image_level_2"),
- image_level_3("image_level_3"),
- auto_update("auto_update"),
- speaker_id("speaker_id")
+: draw_border("draw_border"),
+ image_mute("image_mute"),
+ image_off("image_off"),
+ image_on("image_on"),
+ image_level_1("image_level_1"),
+ image_level_2("image_level_2"),
+ image_level_3("image_level_3"),
+ auto_update("auto_update"),
+ speaker_id("speaker_id")
{
};
LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p)
-: LLView(p),
- mPower(0),
- mImageMute(p.image_mute),
- mImageOff(p.image_off),
- mImageOn(p.image_on),
- mImageLevel1(p.image_level_1),
- mImageLevel2(p.image_level_2),
- mImageLevel3(p.image_level_3),
- mAutoUpdate(p.auto_update),
- mSpeakerId(p.speaker_id),
- mIsModeratorMuted(false),
- mIsAgentControl(false),
- mIndicatorToggled(false),
- mShowParticipantsSpeaking(false),
- mChannelState(INACTIVE_CHANNEL)
+: LLView(p),
+ mPower(0),
+ mImageMute(p.image_mute),
+ mImageOff(p.image_off),
+ mImageOn(p.image_on),
+ mImageLevel1(p.image_level_1),
+ mImageLevel2(p.image_level_2),
+ mImageLevel3(p.image_level_3),
+ mAutoUpdate(p.auto_update),
+ mSpeakerId(p.speaker_id),
+ mIsModeratorMuted(false),
+ mIsAgentControl(false),
+ mIndicatorToggled(false),
+ mShowParticipantsSpeaking(false),
+ mChannelState(INACTIVE_CHANNEL)
{
- //static LLUIColor output_monitor_muted_color = LLUIColorTable::instance().getColor("OutputMonitorMutedColor", LLColor4::orange);
- //static LLUIColor output_monitor_overdriven_color = LLUIColorTable::instance().getColor("OutputMonitorOverdrivenColor", LLColor4::red);
- //static LLUIColor output_monitor_normal_color = LLUIColorTable::instance().getColor("OutputMonitorNotmalColor", LLColor4::green);
- static LLUIColor output_monitor_bound_color = LLUIColorTable::instance().getColor("OutputMonitorBoundColor", LLColor4::white);
- //static LLUICachedControl<S32> output_monitor_rects_number("OutputMonitorRectanglesNumber", 20);
- //static LLUICachedControl<F32> output_monitor_rect_width_ratio("OutputMonitorRectangleWidthRatio", 0.5f);
- //static LLUICachedControl<F32> output_monitor_rect_height_ratio("OutputMonitorRectangleHeightRatio", 0.8f);
-
- // IAN BUG compare to existing pattern where these are members - some will change per-widget and need to be anyway
- // sent feedback to PE
-
- // *TODO: it looks suboptimal to load the defaults every time an output monitor is constructed.
- //sColorMuted = output_monitor_muted_color;
- //sColorOverdriven = output_monitor_overdriven_color;
- //sColorNormal = output_monitor_normal_color;
- sColorBound = output_monitor_bound_color;
- //sRectsNumber = output_monitor_rects_number;
- //sRectWidthRatio = output_monitor_rect_width_ratio;
- //sRectHeightRatio = output_monitor_rect_height_ratio;
-
- mBorder = p.draw_border;
-
- //with checking mute state
- setSpeakerId(mSpeakerId);
+ //static LLUIColor output_monitor_muted_color = LLUIColorTable::instance().getColor("OutputMonitorMutedColor", LLColor4::orange);
+ //static LLUIColor output_monitor_overdriven_color = LLUIColorTable::instance().getColor("OutputMonitorOverdrivenColor", LLColor4::red);
+ //static LLUIColor output_monitor_normal_color = LLUIColorTable::instance().getColor("OutputMonitorNotmalColor", LLColor4::green);
+ static LLUIColor output_monitor_bound_color = LLUIColorTable::instance().getColor("OutputMonitorBoundColor", LLColor4::white);
+ //static LLUICachedControl<S32> output_monitor_rects_number("OutputMonitorRectanglesNumber", 20);
+ //static LLUICachedControl<F32> output_monitor_rect_width_ratio("OutputMonitorRectangleWidthRatio", 0.5f);
+ //static LLUICachedControl<F32> output_monitor_rect_height_ratio("OutputMonitorRectangleHeightRatio", 0.8f);
+
+ // IAN BUG compare to existing pattern where these are members - some will change per-widget and need to be anyway
+ // sent feedback to PE
+
+ // *TODO: it looks suboptimal to load the defaults every time an output monitor is constructed.
+ //sColorMuted = output_monitor_muted_color;
+ //sColorOverdriven = output_monitor_overdriven_color;
+ //sColorNormal = output_monitor_normal_color;
+ sColorBound = output_monitor_bound_color;
+ //sRectsNumber = output_monitor_rects_number;
+ //sRectWidthRatio = output_monitor_rect_width_ratio;
+ //sRectHeightRatio = output_monitor_rect_height_ratio;
+
+ mBorder = p.draw_border;
+
+ //with checking mute state
+ setSpeakerId(mSpeakerId);
}
LLOutputMonitorCtrl::~LLOutputMonitorCtrl()
{
- LLMuteList::getInstance()->removeObserver(this);
- LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
+ LLMuteList::getInstance()->removeObserver(this);
+ LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
}
void LLOutputMonitorCtrl::setPower(F32 val)
{
- mPower = llmax(0.f, llmin(1.f, val));
+ mPower = llmax(0.f, llmin(1.f, val));
}
void LLOutputMonitorCtrl::draw()
{
- // Copied from llmediaremotectrl.cpp
- // *TODO: Give the LLOutputMonitorCtrl an agent-id to monitor, then
- // call directly into LLVoiceClient::getInstance() to ask if that agent-id is muted, is
- // speaking, and what power. This avoids duplicating data, which can get
- // out of sync.
- const F32 LEVEL_0 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL / 3.f;
- const F32 LEVEL_1 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL * 2.f / 3.f;
- const F32 LEVEL_2 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
-
- if (getVisible() && mAutoUpdate && !getIsMuted() && mSpeakerId.notNull())
- {
- setPower(LLVoiceClient::getInstance()->getCurrentPower(mSpeakerId));
- if(mIsAgentControl)
- {
- setIsTalking(LLVoiceClient::getInstance()->getUserPTTState());
- }
- else
- {
- setIsTalking(LLVoiceClient::getInstance()->getIsSpeaking(mSpeakerId));
- }
- }
-
- if ((mPower == 0.f && !mIsTalking) && mShowParticipantsSpeaking)
- {
- std::set<LLUUID> participant_uuids;
- LLVoiceClient::instance().getParticipantList(participant_uuids);
- std::set<LLUUID>::const_iterator part_it = participant_uuids.begin();
-
- F32 power = 0;
- for (; part_it != participant_uuids.end(); ++part_it)
- {
- power = LLVoiceClient::instance().getCurrentPower(*part_it);
- if (power)
- {
- mPower = power;
- break;
- }
- }
- }
-
- LLPointer<LLUIImage> icon;
- if (getIsMuted())
- {
- icon = mImageMute;
- }
- else if (mPower == 0.f && !mIsTalking)
- {
- // only show off if PTT is not engaged
- icon = mImageOff;
- }
- else if (mPower < LEVEL_0)
- {
- // PTT is on, possibly with quiet background noise
- icon = mImageOn;
- }
- else if (mPower < LEVEL_1)
- {
- icon = mImageLevel1;
- }
- else if (mPower < LEVEL_2)
- {
- icon = mImageLevel2;
- }
- else
- {
- // overdriven
- icon = mImageLevel3;
- }
-
- if (icon)
- {
- icon->draw(0, 0);
- }
-
- //
- // Fill the monitor with a bunch of small rectangles.
- // The rectangles will be filled with gradient color,
- // beginning with sColorNormal and ending with sColorOverdriven.
- //
- // *TODO: would using a (partially drawn) pixmap instead be faster?
- //
- const int monh = getRect().getHeight();
- const int monw = getRect().getWidth();
- //int maxrects = sRectsNumber;
- //const int period = llmax(1, monw / maxrects, 0, 0); // "1" - min value for the period
- //const int rectw = llmax(1, llfloor(period * sRectWidthRatio), 0, 0); // "1" - min value for the rect's width
- //const int recth = llfloor(monh * sRectHeightRatio);
-
- //if(period == 1 && rectw == 1) //if we have so small control, then "maxrects = monitor's_width - 2*monitor_border's_width
- // maxrects = monw-2;
-
- //const int nrects = mIsMuted ? maxrects : llfloor(mPower * maxrects); // how many rects to draw?
- //const int rectbtm = (monh - recth) / 2;
- //const int recttop = rectbtm + recth;
- //
- //LLColor4 rect_color;
- //
- //for (int i=1, xpos = 0; i <= nrects; i++)
- //{
- // // Calculate color to use for the current rectangle.
- // if (mIsMuted)
- // {
- // rect_color = sColorMuted;
- // }
- // else
- // {
- // F32 frac = (mPower * i/nrects) / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
- // // Use overdriven color if the power exceeds overdriven level.
- // if (frac > 1.0f)
- // frac = 1.0f;
- // rect_color = lerp(sColorNormal, sColorOverdriven, frac);
- // }
-
- // // Draw rectangle filled with the color.
- // gl_rect_2d(xpos, recttop, xpos+rectw, rectbtm, rect_color, TRUE);
- // xpos += period;
- //}
-
- //
- // Draw bounding box.
- //
- if(mBorder)
- gl_rect_2d(0, monh, monw, 0, sColorBound, FALSE);
+ // Copied from llmediaremotectrl.cpp
+ // *TODO: Give the LLOutputMonitorCtrl an agent-id to monitor, then
+ // call directly into LLVoiceClient::getInstance() to ask if that agent-id is muted, is
+ // speaking, and what power. This avoids duplicating data, which can get
+ // out of sync.
+ const F32 LEVEL_0 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL / 3.f;
+ const F32 LEVEL_1 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL * 2.f / 3.f;
+ const F32 LEVEL_2 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
+
+ if (getVisible() && mAutoUpdate && !getIsMuted() && mSpeakerId.notNull())
+ {
+ setPower(LLVoiceClient::getInstance()->getCurrentPower(mSpeakerId));
+ if(mIsAgentControl)
+ {
+ setIsTalking(LLVoiceClient::getInstance()->getUserPTTState());
+ }
+ else
+ {
+ setIsTalking(LLVoiceClient::getInstance()->getIsSpeaking(mSpeakerId));
+ }
+ }
+
+ if ((mPower == 0.f && !mIsTalking) && mShowParticipantsSpeaking)
+ {
+ std::set<LLUUID> participant_uuids;
+ LLVoiceClient::instance().getParticipantList(participant_uuids);
+ std::set<LLUUID>::const_iterator part_it = participant_uuids.begin();
+
+ F32 power = 0;
+ for (; part_it != participant_uuids.end(); ++part_it)
+ {
+ power = LLVoiceClient::instance().getCurrentPower(*part_it);
+ if (power)
+ {
+ mPower = power;
+ break;
+ }
+ }
+ }
+
+ LLPointer<LLUIImage> icon;
+ if (getIsMuted())
+ {
+ icon = mImageMute;
+ }
+ else if (mPower == 0.f && !mIsTalking)
+ {
+ // only show off if PTT is not engaged
+ icon = mImageOff;
+ }
+ else if (mPower < LEVEL_0)
+ {
+ // PTT is on, possibly with quiet background noise
+ icon = mImageOn;
+ }
+ else if (mPower < LEVEL_1)
+ {
+ icon = mImageLevel1;
+ }
+ else if (mPower < LEVEL_2)
+ {
+ icon = mImageLevel2;
+ }
+ else
+ {
+ // overdriven
+ icon = mImageLevel3;
+ }
+
+ if (icon)
+ {
+ icon->draw(0, 0);
+ }
+
+ //
+ // Fill the monitor with a bunch of small rectangles.
+ // The rectangles will be filled with gradient color,
+ // beginning with sColorNormal and ending with sColorOverdriven.
+ //
+ // *TODO: would using a (partially drawn) pixmap instead be faster?
+ //
+ const int monh = getRect().getHeight();
+ const int monw = getRect().getWidth();
+ //int maxrects = sRectsNumber;
+ //const int period = llmax(1, monw / maxrects, 0, 0); // "1" - min value for the period
+ //const int rectw = llmax(1, llfloor(period * sRectWidthRatio), 0, 0); // "1" - min value for the rect's width
+ //const int recth = llfloor(monh * sRectHeightRatio);
+
+ //if(period == 1 && rectw == 1) //if we have so small control, then "maxrects = monitor's_width - 2*monitor_border's_width
+ // maxrects = monw-2;
+
+ //const int nrects = mIsMuted ? maxrects : llfloor(mPower * maxrects); // how many rects to draw?
+ //const int rectbtm = (monh - recth) / 2;
+ //const int recttop = rectbtm + recth;
+ //
+ //LLColor4 rect_color;
+ //
+ //for (int i=1, xpos = 0; i <= nrects; i++)
+ //{
+ // // Calculate color to use for the current rectangle.
+ // if (mIsMuted)
+ // {
+ // rect_color = sColorMuted;
+ // }
+ // else
+ // {
+ // F32 frac = (mPower * i/nrects) / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
+ // // Use overdriven color if the power exceeds overdriven level.
+ // if (frac > 1.0f)
+ // frac = 1.0f;
+ // rect_color = lerp(sColorNormal, sColorOverdriven, frac);
+ // }
+
+ // // Draw rectangle filled with the color.
+ // gl_rect_2d(xpos, recttop, xpos+rectw, rectbtm, rect_color, TRUE);
+ // xpos += period;
+ //}
+
+ //
+ // Draw bounding box.
+ //
+ if(mBorder)
+ gl_rect_2d(0, monh, monw, 0, sColorBound, FALSE);
}
// virtual
BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask)
{
- if (mSpeakerId != gAgentID)
- {
- LLFloaterReg::showInstance("floater_voice_volume", LLSD().with("avatar_id", mSpeakerId));
- }
- else if (mShowParticipantsSpeaking)
- {
- LLFloaterReg::showInstance("chat_voice", LLSD());
- }
-
- return TRUE;
+ if (mSpeakerId != gAgentID)
+ {
+ LLFloaterReg::showInstance("floater_voice_volume", LLSD().with("avatar_id", mSpeakerId));
+ }
+ else if (mShowParticipantsSpeaking)
+ {
+ LLFloaterReg::showInstance("chat_voice", LLSD());
+ }
+
+ return TRUE;
}
void LLOutputMonitorCtrl::setIsActiveChannel(bool val)
@@ -274,42 +274,42 @@ void LLOutputMonitorCtrl::setChannelState(EChannelState state)
void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id/* = LLUUID::null*/, bool show_other_participants_speaking /* = false */)
{
- if (speaker_id.isNull() && mSpeakerId.notNull())
- {
- LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
+ if (speaker_id.isNull() && mSpeakerId.notNull())
+ {
+ LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
switchIndicator(false);
mSpeakerId = speaker_id;
- }
-
- if (speaker_id.isNull() || (speaker_id == mSpeakerId))
- {
- return;
- }
-
- if (mSpeakerId.notNull())
- {
- // Unregister previous registration to avoid crash. EXT-4782.
- LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
- }
-
- mShowParticipantsSpeaking = show_other_participants_speaking;
- mSpeakerId = speaker_id;
- LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this, session_id);
-
- //mute management
- if (mAutoUpdate)
- {
- if (speaker_id == gAgentID)
- {
- mIsMuted = false;
- }
- else
- {
- // check only blocking on voice. EXT-3542
- mIsMuted = LLMuteList::getInstance()->isMuted(mSpeakerId, LLMute::flagVoiceChat);
- LLMuteList::getInstance()->addObserver(this);
- }
- }
+ }
+
+ if (speaker_id.isNull() || (speaker_id == mSpeakerId))
+ {
+ return;
+ }
+
+ if (mSpeakerId.notNull())
+ {
+ // Unregister previous registration to avoid crash. EXT-4782.
+ LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
+ }
+
+ mShowParticipantsSpeaking = show_other_participants_speaking;
+ mSpeakerId = speaker_id;
+ LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this, session_id);
+
+ //mute management
+ if (mAutoUpdate)
+ {
+ if (speaker_id == gAgentID)
+ {
+ mIsMuted = false;
+ }
+ else
+ {
+ // check only blocking on voice. EXT-3542
+ mIsMuted = LLMuteList::getInstance()->isMuted(mSpeakerId, LLMute::flagVoiceChat);
+ LLMuteList::getInstance()->addObserver(this);
+ }
+ }
}
void LLOutputMonitorCtrl::onChangeDetailed(const LLMute& mute)
@@ -328,10 +328,10 @@ void LLOutputMonitorCtrl::switchIndicator(bool switch_on)
if ((mChannelState != INACTIVE_CHANNEL) && (getVisible() != (BOOL)switch_on))
{
setVisible(switch_on);
-
+
//Let parent adjust positioning of icons adjacent to speaker indicator
//(when speaker indicator hidden, adjacent icons move to right and when speaker
- //indicator visible, adjacent icons move to the left)
+ //indicator visible, adjacent icons move to the left)
if (getParent() && getParent()->isInVisibleChain())
{
notifyParentVisibilityChanged();
@@ -353,11 +353,11 @@ void LLOutputMonitorCtrl::switchIndicator(bool switch_on)
//////////////////////////////////////////////////////////////////////////
void LLOutputMonitorCtrl::notifyParentVisibilityChanged()
{
- LL_DEBUGS("SpeakingIndicator") << "Notify parent that visibility was changed: " << mSpeakerId << ", new_visibility: " << getVisible() << LL_ENDL;
+ LL_DEBUGS("SpeakingIndicator") << "Notify parent that visibility was changed: " << mSpeakerId << ", new_visibility: " << getVisible() << LL_ENDL;
- LLSD params = LLSD().with("visibility_changed", getVisible());
+ LLSD params = LLSD().with("visibility_changed", getVisible());
- notifyParent(params);
+ notifyParent(params);
}
// EOF
diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h
index e80745e1df..eefe9800aa 100644
--- a/indra/newview/lloutputmonitorctrl.h
+++ b/indra/newview/lloutputmonitorctrl.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lloutputmonitorctrl.h
* @brief LLOutputMonitorCtrl base class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,127 +44,127 @@ class LLOutputMonitorCtrl
: public LLView, public LLSpeakingIndicator, LLMuteListObserver
{
public:
- struct Params : public LLInitParam::Block<Params, LLView::Params>
- {
- Optional<bool> draw_border;
- Mandatory<LLUIImage*> image_mute,
- image_off,
- image_on,
- image_level_1,
- image_level_2,
- image_level_3;
- Optional<bool> auto_update;
- Optional<LLUUID> speaker_id;
-
- Params();
- };
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ Optional<bool> draw_border;
+ Mandatory<LLUIImage*> image_mute,
+ image_off,
+ image_on,
+ image_level_1,
+ image_level_2,
+ image_level_3;
+ Optional<bool> auto_update;
+ Optional<LLUUID> speaker_id;
+
+ Params();
+ };
protected:
- bool mBorder;
- LLOutputMonitorCtrl(const Params&);
- friend class LLUICtrlFactory;
+ bool mBorder;
+ LLOutputMonitorCtrl(const Params&);
+ friend class LLUICtrlFactory;
public:
- virtual ~LLOutputMonitorCtrl();
-
- // llview overrides
- virtual void draw();
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
-
- void setPower(F32 val);
- F32 getPower(F32 val) const { return mPower; }
-
- bool getIsMuted() const { return (mIsMuted || mIsModeratorMuted); }
- void setIsModeratorMuted(bool val) { mIsModeratorMuted = val; }
-
- // For the current user, need to know the PTT state to show
- // correct button image.
- void setIsAgentControl(bool val) { mIsAgentControl = val; }
- void setIsTalking(bool val) { mIsTalking = val; }
-
- enum EChannelState
- {
- ACTIVE_CHANNEL,
- INACTIVE_CHANNEL,
- UNDEFINED_CHANNEL
- };
-
- // switchIndicator controls visibility, 'active channel' governs if we are allowed to show indicator
- void setIsActiveChannel(bool val);
- void setChannelState(EChannelState state);
-
- void setShowParticipantsSpeaking(bool show) { mShowParticipantsSpeaking = show; }
-
- /**
- * Sets avatar UUID to interact with voice channel.
- *
- * @param speaker_id LLUUID of an avatar whose voice level is displayed.
- * @param session_id session UUID for which indicator should be shown only. Passed to LLSpeakingIndicatorManager
- * If this parameter is set registered indicator will be shown only in voice channel
- * which has the same session id (EXT-5562).
- */
- void setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id = LLUUID::null, bool show_other_participants_speaking = false);
-
- //called by mute list
+ virtual ~LLOutputMonitorCtrl();
+
+ // llview overrides
+ virtual void draw();
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+
+ void setPower(F32 val);
+ F32 getPower(F32 val) const { return mPower; }
+
+ bool getIsMuted() const { return (mIsMuted || mIsModeratorMuted); }
+ void setIsModeratorMuted(bool val) { mIsModeratorMuted = val; }
+
+ // For the current user, need to know the PTT state to show
+ // correct button image.
+ void setIsAgentControl(bool val) { mIsAgentControl = val; }
+ void setIsTalking(bool val) { mIsTalking = val; }
+
+ enum EChannelState
+ {
+ ACTIVE_CHANNEL,
+ INACTIVE_CHANNEL,
+ UNDEFINED_CHANNEL
+ };
+
+ // switchIndicator controls visibility, 'active channel' governs if we are allowed to show indicator
+ void setIsActiveChannel(bool val);
+ void setChannelState(EChannelState state);
+
+ void setShowParticipantsSpeaking(bool show) { mShowParticipantsSpeaking = show; }
+
+ /**
+ * Sets avatar UUID to interact with voice channel.
+ *
+ * @param speaker_id LLUUID of an avatar whose voice level is displayed.
+ * @param session_id session UUID for which indicator should be shown only. Passed to LLSpeakingIndicatorManager
+ * If this parameter is set registered indicator will be shown only in voice channel
+ * which has the same session id (EXT-5562).
+ */
+ void setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id = LLUUID::null, bool show_other_participants_speaking = false);
+
+ //called by mute list
virtual void onChange() {};
- virtual void onChangeDetailed(const LLMute& mute);
-
- /**
- * Implementation of LLSpeakingIndicator interface.
- * Behavior is implemented via changing visibility.
- *
- * If instance is in visible chain now (all parents are visible) it changes visibility
- * and notify parent about this.
- *
- * Otherwise it marks an instance as dirty and stores necessary visibility.
- * It will be applied in next draw and parent will be notified.
- */
- virtual void switchIndicator(bool switch_on);
+ virtual void onChangeDetailed(const LLMute& mute);
+
+ /**
+ * Implementation of LLSpeakingIndicator interface.
+ * Behavior is implemented via changing visibility.
+ *
+ * If instance is in visible chain now (all parents are visible) it changes visibility
+ * and notify parent about this.
+ *
+ * Otherwise it marks an instance as dirty and stores necessary visibility.
+ * It will be applied in next draw and parent will be notified.
+ */
+ virtual void switchIndicator(bool switch_on);
bool getIndicatorToggled() { return mIndicatorToggled;}
void setIndicatorToggled(bool value) { mIndicatorToggled = value;}
private:
- /**
- * Notifies parent about changed visibility.
- *
- * Passes LLSD with "visibility_changed" => <current visibility> value.
- * For now it is processed by LLAvatarListItem to update (reshape) its children.
- * Implemented fo complete EXT-3976
- */
- void notifyParentVisibilityChanged();
-
- //static LLColor4 sColorMuted;
- //static LLColor4 sColorNormal;
- //static LLColor4 sColorOverdriven;
- static LLColor4 sColorBound;
- //static S32 sRectsNumber;
- //static F32 sRectWidthRatio;
- //static F32 sRectHeightRatio;
-
-
-
- F32 mPower;
- bool mIsAgentControl;
- bool mIsModeratorMuted;
- bool mIsMuted;
- bool mIsTalking;
- bool mShowParticipantsSpeaking;
- LLPointer<LLUIImage> mImageMute;
- LLPointer<LLUIImage> mImageOff;
- LLPointer<LLUIImage> mImageOn;
- LLPointer<LLUIImage> mImageLevel1;
- LLPointer<LLUIImage> mImageLevel2;
- LLPointer<LLUIImage> mImageLevel3;
-
- /** whether to deal with LLVoiceClient::getInstance() directly */
- bool mAutoUpdate;
-
- /** uuid of a speaker being monitored */
- LLUUID mSpeakerId;
+ /**
+ * Notifies parent about changed visibility.
+ *
+ * Passes LLSD with "visibility_changed" => <current visibility> value.
+ * For now it is processed by LLAvatarListItem to update (reshape) its children.
+ * Implemented fo complete EXT-3976
+ */
+ void notifyParentVisibilityChanged();
+
+ //static LLColor4 sColorMuted;
+ //static LLColor4 sColorNormal;
+ //static LLColor4 sColorOverdriven;
+ static LLColor4 sColorBound;
+ //static S32 sRectsNumber;
+ //static F32 sRectWidthRatio;
+ //static F32 sRectHeightRatio;
+
+
+
+ F32 mPower;
+ bool mIsAgentControl;
+ bool mIsModeratorMuted;
+ bool mIsMuted;
+ bool mIsTalking;
+ bool mShowParticipantsSpeaking;
+ LLPointer<LLUIImage> mImageMute;
+ LLPointer<LLUIImage> mImageOff;
+ LLPointer<LLUIImage> mImageOn;
+ LLPointer<LLUIImage> mImageLevel1;
+ LLPointer<LLUIImage> mImageLevel2;
+ LLPointer<LLUIImage> mImageLevel3;
+
+ /** whether to deal with LLVoiceClient::getInstance() directly */
+ bool mAutoUpdate;
+
+ /** uuid of a speaker being monitored */
+ LLUUID mSpeakerId;
bool mIndicatorToggled;
- EChannelState mChannelState;
+ EChannelState mChannelState;
};
#endif
diff --git a/indra/newview/llpanelappearancetab.cpp b/indra/newview/llpanelappearancetab.cpp
index 16bd8a1380..3ee4ab8e51 100644
--- a/indra/newview/llpanelappearancetab.cpp
+++ b/indra/newview/llpanelappearancetab.cpp
@@ -59,17 +59,17 @@ void LLPanelAppearanceTab::checkFilterSubString()
// virtual
bool LLPanelAppearanceTab::canTakeOffSelected()
{
- uuid_vec_t selected_uuids;
- getSelectedItemsUUIDs(selected_uuids);
+ uuid_vec_t selected_uuids;
+ getSelectedItemsUUIDs(selected_uuids);
- LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
+ LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
- for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it)
- {
- LLViewerInventoryItem* item = gInventory.getItem(*it);
- if (!item) continue;
+ for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(*it);
+ if (!item) continue;
- if (is_worn(NULL, item)) return true;
- }
- return false;
+ if (is_worn(NULL, item)) return true;
+ }
+ return false;
}
diff --git a/indra/newview/llpanelappearancetab.h b/indra/newview/llpanelappearancetab.h
index e81394dd3c..e4d16582de 100644
--- a/indra/newview/llpanelappearancetab.h
+++ b/indra/newview/llpanelappearancetab.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelappearancetab.h
* @brief Tabs interface for Side Bar "My Appearance" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,27 +32,27 @@
class LLPanelAppearanceTab : public LLPanel
{
public:
- LLPanelAppearanceTab() : LLPanel() {}
- virtual ~LLPanelAppearanceTab() {}
+ LLPanelAppearanceTab() : LLPanel() {}
+ virtual ~LLPanelAppearanceTab() {}
- void setFilterSubString(const std::string& new_string);
+ void setFilterSubString(const std::string& new_string);
void checkFilterSubString();
virtual void onFilterSubStringChanged(const std::string& new_string, const std::string& old_string) = 0;
- virtual bool isActionEnabled(const LLSD& userdata) = 0;
+ virtual bool isActionEnabled(const LLSD& userdata) = 0;
- virtual void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const {}
+ virtual void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const {}
- const std::string& getFilterSubString() { return mFilterSubString; }
+ const std::string& getFilterSubString() { return mFilterSubString; }
protected:
- /**
- * Returns true if there are any items that can be taken off among currently selected, otherwise false.
- */
- bool canTakeOffSelected();
+ /**
+ * Returns true if there are any items that can be taken off among currently selected, otherwise false.
+ */
+ bool canTakeOffSelected();
private:
std::string mFilterSubString;
diff --git a/indra/newview/llpanelavatartag.cpp b/indra/newview/llpanelavatartag.cpp
index 4ac818eb26..2c11364dcc 100644
--- a/indra/newview/llpanelavatartag.cpp
+++ b/indra/newview/llpanelavatartag.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelavatartag.cpp
* @brief Avatar tag panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,27 +33,27 @@
#include "lltextbox.h"
LLPanelAvatarTag::LLPanelAvatarTag(const LLUUID& key, const std::string im_time)
- : LLPanel()
- , mAvatarId(LLUUID::null)
-// , mFadeTimer()
+ : LLPanel()
+ , mAvatarId(LLUUID::null)
+// , mFadeTimer()
{
- buildFromFile( "panel_avatar_tag.xml");
- setLeftButtonClickCallback(boost::bind(&LLPanelAvatarTag::onClick, this));
- setAvatarId(key);
- setTime(im_time);
+ buildFromFile( "panel_avatar_tag.xml");
+ setLeftButtonClickCallback(boost::bind(&LLPanelAvatarTag::onClick, this));
+ setAvatarId(key);
+ setTime(im_time);
}
LLPanelAvatarTag::~LLPanelAvatarTag()
{
- // Name callbacks will be automatically disconnected since LLPanel is trackable
+ // Name callbacks will be automatically disconnected since LLPanel is trackable
}
BOOL LLPanelAvatarTag::postBuild()
{
- mIcon = getChild<LLAvatarIconCtrl>("avatar_tag_icon");
- mName = getChild<LLTextBox>("sender_tag_name");
- mTime = getChild<LLTextBox>("tag_time");
- return TRUE;
+ mIcon = getChild<LLAvatarIconCtrl>("avatar_tag_icon");
+ mName = getChild<LLTextBox>("sender_tag_name");
+ mTime = getChild<LLTextBox>("tag_time");
+ return TRUE;
}
void LLPanelAvatarTag::draw()
@@ -62,40 +62,40 @@ void LLPanelAvatarTag::draw()
}
void LLPanelAvatarTag::setName(const std::string& name)
{
- if (mName)
- mName->setText(name);
+ if (mName)
+ mName->setText(name);
}
void LLPanelAvatarTag::setTime(const std::string& time)
{
- if (mTime)
- mTime->setText(time);
+ if (mTime)
+ mTime->setText(time);
}
void LLPanelAvatarTag::setAvatarId(const LLUUID& avatar_id)
{
- mAvatarId = avatar_id;
- if (mIcon)
- {
- mIcon->setValue(avatar_id);
- }
- setName(std::string(mIcon->getFullName()));
+ mAvatarId = avatar_id;
+ if (mIcon)
+ {
+ mIcon->setValue(avatar_id);
+ }
+ setName(std::string(mIcon->getFullName()));
}
boost::signals2::connection LLPanelAvatarTag::setLeftButtonClickCallback(
- const commit_callback_t& cb)
+ const commit_callback_t& cb)
{
- return setCommitCallback(cb);
+ return setCommitCallback(cb);
}
BOOL LLPanelAvatarTag::handleMouseDown(S32 x, S32 y, MASK mask)
{
- onCommit();
- return TRUE;
+ onCommit();
+ return TRUE;
}
void LLPanelAvatarTag::onClick()
{
- // Do the on click stuff.
+ // Do the on click stuff.
}
diff --git a/indra/newview/llpanelavatartag.h b/indra/newview/llpanelavatartag.h
index 1068ae0b4f..a14b7e9dd2 100644
--- a/indra/newview/llpanelavatartag.h
+++ b/indra/newview/llpanelavatartag.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelavatartag.h
* @brief Avatar row panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,53 +35,53 @@ class LLTextBox;
/**
* Avatar Tag panel.
- *
+ *
* Test.
- *
- * Contains avatar name
+ *
+ * Contains avatar name
* Provide methods for setting avatar id, state, muted status and speech power.
- */
+ */
class LLPanelAvatarTag : public LLPanel
{
public:
- LLPanelAvatarTag(const LLUUID& key, const std::string im_time);
- virtual ~LLPanelAvatarTag();
-
- /**
- * Set avatar ID.
- *
- * After the ID is set, it is possible to track the avatar status and get its name.
- */
- void setAvatarId(const LLUUID& avatar_id);
- void setTime (const std::string& time);
+ LLPanelAvatarTag(const LLUUID& key, const std::string im_time);
+ virtual ~LLPanelAvatarTag();
+
+ /**
+ * Set avatar ID.
+ *
+ * After the ID is set, it is possible to track the avatar status and get its name.
+ */
+ void setAvatarId(const LLUUID& avatar_id);
+ void setTime (const std::string& time);
- const LLUUID& getAvatarId() const { return mAvatarId; }
+ const LLUUID& getAvatarId() const { return mAvatarId; }
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void draw();
-
- virtual boost::signals2::connection setLeftButtonClickCallback(
- const commit_callback_t& cb);
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
- void onClick();
+ virtual boost::signals2::connection setLeftButtonClickCallback(
+ const commit_callback_t& cb);
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+
+ void onClick();
private:
- void setName(const std::string& name);
+ void setName(const std::string& name);
+
+ /**
+ * Called by LLCacheName when the avatar name gets updated.
+ */
+ void nameUpdatedCallback(
+ const LLUUID& id,
+ const std::string& first,
+ const std::string& last,
+ BOOL is_group);
- /**
- * Called by LLCacheName when the avatar name gets updated.
- */
- void nameUpdatedCallback(
- const LLUUID& id,
- const std::string& first,
- const std::string& last,
- BOOL is_group);
-
- LLAvatarIconCtrl* mIcon; /// status tracking avatar icon
- LLTextBox* mName; /// displays avatar name
- LLTextBox* mTime; /// displays time
- LLUUID mAvatarId;
-// LLFrameTimer mFadeTimer;
+ LLAvatarIconCtrl* mIcon; /// status tracking avatar icon
+ LLTextBox* mName; /// displays avatar name
+ LLTextBox* mTime; /// displays time
+ LLUUID mAvatarId;
+// LLFrameTimer mFadeTimer;
};
#endif
diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp
index 3a4fc613b7..5cc567395c 100644
--- a/indra/newview/llpanelblockedlist.cpp
+++ b/indra/newview/llpanelblockedlist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelblockedlist.cpp
* @brief Container for blocked Residents & Objects list
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -60,10 +60,10 @@ const std::string BLOCKED_PARAM_NAME = "blocked_to_select";
//-----------------------------------------------------------------------------
LLPanelBlockedList::LLPanelBlockedList()
-: LLPanel()
+: LLPanel()
{
- mCommitCallbackRegistrar.add("Block.Action", boost::bind(&LLPanelBlockedList::onCustomAction, this, _2));
- mEnableCallbackRegistrar.add("Block.Check", boost::bind(&LLPanelBlockedList::isActionChecked, this, _2));
+ mCommitCallbackRegistrar.add("Block.Action", boost::bind(&LLPanelBlockedList::onCustomAction, this, _2));
+ mEnableCallbackRegistrar.add("Block.Check", boost::bind(&LLPanelBlockedList::isActionChecked, this, _2));
}
void LLPanelBlockedList::removePicker()
@@ -76,61 +76,61 @@ void LLPanelBlockedList::removePicker()
BOOL LLPanelBlockedList::postBuild()
{
- mBlockedList = getChild<LLBlockList>("blocked");
- mBlockedList->setCommitOnSelectionChange(TRUE);
+ mBlockedList = getChild<LLBlockList>("blocked");
+ mBlockedList->setCommitOnSelectionChange(TRUE);
this->setVisibleCallback(boost::bind(&LLPanelBlockedList::removePicker, this));
- switch (gSavedSettings.getU32("BlockPeopleSortOrder"))
- {
- case E_SORT_BY_NAME:
- mBlockedList->sortByName();
- break;
-
- case E_SORT_BY_TYPE:
- mBlockedList->sortByType();
- break;
- default:
- LL_WARNS() << "Unrecognized sort order for blocked list" << LL_ENDL;
- break;
- }
-
- // Use the context menu of the Block list for the Block tab gear menu.
- LLToggleableMenu* blocked_gear_menu = mBlockedList->getContextMenu();
- if (blocked_gear_menu)
- {
- getChild<LLMenuButton>("blocked_gear_btn")->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT);
- }
-
- getChild<LLButton>("unblock_btn")->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this));
- getChild<LLFilterEditor>("blocked_filter_input")->setCommitCallback(boost::bind(&LLPanelBlockedList::onFilterEdit, this, _2));
-
- return LLPanel::postBuild();
+ switch (gSavedSettings.getU32("BlockPeopleSortOrder"))
+ {
+ case E_SORT_BY_NAME:
+ mBlockedList->sortByName();
+ break;
+
+ case E_SORT_BY_TYPE:
+ mBlockedList->sortByType();
+ break;
+ default:
+ LL_WARNS() << "Unrecognized sort order for blocked list" << LL_ENDL;
+ break;
+ }
+
+ // Use the context menu of the Block list for the Block tab gear menu.
+ LLToggleableMenu* blocked_gear_menu = mBlockedList->getContextMenu();
+ if (blocked_gear_menu)
+ {
+ getChild<LLMenuButton>("blocked_gear_btn")->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT);
+ }
+
+ getChild<LLButton>("unblock_btn")->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this));
+ getChild<LLFilterEditor>("blocked_filter_input")->setCommitCallback(boost::bind(&LLPanelBlockedList::onFilterEdit, this, _2));
+
+ return LLPanel::postBuild();
}
void LLPanelBlockedList::draw()
{
- updateButtons();
- LLPanel::draw();
+ updateButtons();
+ LLPanel::draw();
}
void LLPanelBlockedList::onOpen(const LLSD& key)
{
- if (key.has(BLOCKED_PARAM_NAME) && key[BLOCKED_PARAM_NAME].asUUID().notNull())
- {
- selectBlocked(key[BLOCKED_PARAM_NAME].asUUID());
- }
+ if (key.has(BLOCKED_PARAM_NAME) && key[BLOCKED_PARAM_NAME].asUUID().notNull())
+ {
+ selectBlocked(key[BLOCKED_PARAM_NAME].asUUID());
+ }
}
void LLPanelBlockedList::selectBlocked(const LLUUID& mute_id)
{
- mBlockedList->resetSelection();
- mBlockedList->selectItemByUUID(mute_id);
+ mBlockedList->resetSelection();
+ mBlockedList->selectItemByUUID(mute_id);
}
void LLPanelBlockedList::showPanelAndSelect(const LLUUID& idToSelect)
{
- LLFloaterSidePanelContainer::showPanel("people", "panel_people",
- LLSD().with("people_panel_tab_name", "blocked_panel").with(BLOCKED_PARAM_NAME, idToSelect));
+ LLFloaterSidePanelContainer::showPanel("people", "panel_people",
+ LLSD().with("people_panel_tab_name", "blocked_panel").with(BLOCKED_PARAM_NAME, idToSelect));
}
@@ -139,75 +139,75 @@ void LLPanelBlockedList::showPanelAndSelect(const LLUUID& idToSelect)
//////////////////////////////////////////////////////////////////////////
void LLPanelBlockedList::updateButtons()
{
- bool hasSelected = NULL != mBlockedList->getSelectedItem();
- getChildView("unblock_btn")->setEnabled(hasSelected);
- getChildView("blocked_gear_btn")->setEnabled(hasSelected);
+ bool hasSelected = NULL != mBlockedList->getSelectedItem();
+ getChildView("unblock_btn")->setEnabled(hasSelected);
+ getChildView("blocked_gear_btn")->setEnabled(hasSelected);
- getChild<LLUICtrl>("block_limit")->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize()));
- getChild<LLUICtrl>("block_limit")->setTextArg("[LIMIT]", llformat("%d", gSavedSettings.getS32("MuteListLimit")));
+ getChild<LLUICtrl>("block_limit")->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize()));
+ getChild<LLUICtrl>("block_limit")->setTextArg("[LIMIT]", llformat("%d", gSavedSettings.getS32("MuteListLimit")));
}
void LLPanelBlockedList::unblockItem()
{
- LLBlockedListItem* item = mBlockedList->getBlockedItem();
- if (item)
- {
- LLMute mute(item->getUUID(), item->getName());
- LLMuteList::instance().remove(mute);
- }
+ LLBlockedListItem* item = mBlockedList->getBlockedItem();
+ if (item)
+ {
+ LLMute mute(item->getUUID(), item->getName());
+ LLMuteList::instance().remove(mute);
+ }
}
void LLPanelBlockedList::onCustomAction(const LLSD& userdata)
{
- const std::string command_name = userdata.asString();
-
- if ("block_obj_by_name" == command_name)
- {
- blockObjectByName();
- }
- else if ("block_res_by_name" == command_name)
- {
- blockResidentByName();
- }
- else if ("sort_by_name" == command_name)
- {
- mBlockedList->sortByName();
- gSavedSettings.setU32("BlockPeopleSortOrder", E_SORT_BY_NAME);
- }
- else if ("sort_by_type" == command_name)
- {
- mBlockedList->sortByType();
- gSavedSettings.setU32("BlockPeopleSortOrder", E_SORT_BY_TYPE);
- }
+ const std::string command_name = userdata.asString();
+
+ if ("block_obj_by_name" == command_name)
+ {
+ blockObjectByName();
+ }
+ else if ("block_res_by_name" == command_name)
+ {
+ blockResidentByName();
+ }
+ else if ("sort_by_name" == command_name)
+ {
+ mBlockedList->sortByName();
+ gSavedSettings.setU32("BlockPeopleSortOrder", E_SORT_BY_NAME);
+ }
+ else if ("sort_by_type" == command_name)
+ {
+ mBlockedList->sortByType();
+ gSavedSettings.setU32("BlockPeopleSortOrder", E_SORT_BY_TYPE);
+ }
}
BOOL LLPanelBlockedList::isActionChecked(const LLSD& userdata)
{
- std::string item = userdata.asString();
- U32 sort_order = gSavedSettings.getU32("BlockPeopleSortOrder");
-
- if ("sort_by_name" == item)
- {
- return E_SORT_BY_NAME == sort_order;
- }
- else if ("sort_by_type" == item)
- {
- return E_SORT_BY_TYPE == sort_order;
- }
-
- return false;
+ std::string item = userdata.asString();
+ U32 sort_order = gSavedSettings.getU32("BlockPeopleSortOrder");
+
+ if ("sort_by_name" == item)
+ {
+ return E_SORT_BY_NAME == sort_order;
+ }
+ else if ("sort_by_type" == item)
+ {
+ return E_SORT_BY_TYPE == sort_order;
+ }
+
+ return false;
}
void LLPanelBlockedList::blockResidentByName()
{
- const BOOL allow_multiple = FALSE;
- const BOOL close_on_select = TRUE;
-
+ const BOOL allow_multiple = FALSE;
+ const BOOL close_on_select = TRUE;
+
LLView * button = findChild<LLButton>("plus_btn", TRUE);
LLFloater* root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2),
+ LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2),
allow_multiple, close_on_select, FALSE, root_floater->getName(), button);
-
+
if (root_floater)
{
root_floater->addDependentFloater(picker);
@@ -218,40 +218,40 @@ void LLPanelBlockedList::blockResidentByName()
void LLPanelBlockedList::blockObjectByName()
{
- LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName);
+ LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName);
}
void LLPanelBlockedList::onFilterEdit(const std::string& search_string)
{
- std::string filter = search_string;
- LLStringUtil::trimHead(filter);
+ std::string filter = search_string;
+ LLStringUtil::trimHead(filter);
- mBlockedList->setNameFilter(filter);
+ mBlockedList->setNameFilter(filter);
}
void LLPanelBlockedList::callbackBlockPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
{
- if (names.empty() || ids.empty()) return;
+ if (names.empty() || ids.empty()) return;
LLMute mute(ids[0], names[0].getUserName(), LLMute::AGENT);
- LLMuteList::getInstance()->add(mute);
- showPanelAndSelect(mute.mID);
+ LLMuteList::getInstance()->add(mute);
+ showPanelAndSelect(mute.mID);
}
//static
void LLPanelBlockedList::callbackBlockByName(const std::string& text)
{
- if (text.empty()) return;
-
- LLMute mute(LLUUID::null, text, LLMute::BY_NAME);
- BOOL success = LLMuteList::getInstance()->add(mute);
- if (!success)
- {
- LLNotificationsUtil::add("MuteByNameFailed");
- }
+ if (text.empty()) return;
+
+ LLMute mute(LLUUID::null, text, LLMute::BY_NAME);
+ BOOL success = LLMuteList::getInstance()->add(mute);
+ if (!success)
+ {
+ LLNotificationsUtil::add("MuteByNameFailed");
+ }
}
//////////////////////////////////////////////////////////////////////////
-// LLFloaterGetBlockedObjectName
+// LLFloaterGetBlockedObjectName
//////////////////////////////////////////////////////////////////////////
// Constructor/Destructor
@@ -264,63 +264,63 @@ LLFloaterGetBlockedObjectName::LLFloaterGetBlockedObjectName(const LLSD& key)
// Destroys the object
LLFloaterGetBlockedObjectName::~LLFloaterGetBlockedObjectName()
{
- gFocusMgr.releaseFocusIfNeeded( this );
+ gFocusMgr.releaseFocusIfNeeded( this );
}
BOOL LLFloaterGetBlockedObjectName::postBuild()
{
- getChild<LLButton>("OK")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::applyBlocking, this));
- getChild<LLButton>("Cancel")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::cancelBlocking, this));
- center();
+ getChild<LLButton>("OK")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::applyBlocking, this));
+ getChild<LLButton>("Cancel")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::cancelBlocking, this));
+ center();
- return LLFloater::postBuild();
+ return LLFloater::postBuild();
}
BOOL LLFloaterGetBlockedObjectName::handleKeyHere(KEY key, MASK mask)
{
- if (key == KEY_RETURN && mask == MASK_NONE)
- {
- applyBlocking();
- return TRUE;
- }
- else if (key == KEY_ESCAPE && mask == MASK_NONE)
- {
- cancelBlocking();
- return TRUE;
- }
-
- return LLFloater::handleKeyHere(key, mask);
+ if (key == KEY_RETURN && mask == MASK_NONE)
+ {
+ applyBlocking();
+ return TRUE;
+ }
+ else if (key == KEY_ESCAPE && mask == MASK_NONE)
+ {
+ cancelBlocking();
+ return TRUE;
+ }
+
+ return LLFloater::handleKeyHere(key, mask);
}
// static
LLFloaterGetBlockedObjectName* LLFloaterGetBlockedObjectName::show(get_object_name_callback_t callback)
{
- LLFloaterGetBlockedObjectName* floater = LLFloaterReg::showTypedInstance<LLFloaterGetBlockedObjectName>("mute_object_by_name");
+ LLFloaterGetBlockedObjectName* floater = LLFloaterReg::showTypedInstance<LLFloaterGetBlockedObjectName>("mute_object_by_name");
- floater->mGetObjectNameCallback = callback;
+ floater->mGetObjectNameCallback = callback;
- // *TODO: mantipov: should LLFloaterGetBlockedObjectName be closed when panel is closed?
- // old Floater dependency is not enable in panel
- // addDependentFloater(floater);
+ // *TODO: mantipov: should LLFloaterGetBlockedObjectName be closed when panel is closed?
+ // old Floater dependency is not enable in panel
+ // addDependentFloater(floater);
- return floater;
+ return floater;
}
//////////////////////////////////////////////////////////////////////////
// Private Section
void LLFloaterGetBlockedObjectName::applyBlocking()
{
- if (mGetObjectNameCallback)
- {
- const std::string& text = getChild<LLUICtrl>("object_name")->getValue().asString();
- mGetObjectNameCallback(text);
- }
- closeFloater();
+ if (mGetObjectNameCallback)
+ {
+ const std::string& text = getChild<LLUICtrl>("object_name")->getValue().asString();
+ mGetObjectNameCallback(text);
+ }
+ closeFloater();
}
void LLFloaterGetBlockedObjectName::cancelBlocking()
{
- closeFloater();
+ closeFloater();
}
//EOF
diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h
index 07f0437656..59bdd1b6a6 100644
--- a/indra/newview/llpanelblockedlist.h
+++ b/indra/newview/llpanelblockedlist.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelblockedlist.h
* @brief Container for blocked Residents & Objects list
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,48 +37,48 @@ class LLBlockList;
class LLPanelBlockedList : public LLPanel
{
public:
- LLPanelBlockedList();
- ~LLPanelBlockedList(){};
-
- virtual BOOL postBuild();
- virtual void draw();
- virtual void onOpen(const LLSD& key);
-
- void selectBlocked(const LLUUID& id);
-
- /**
- * Shows current Panel in side tray and select passed blocked item.
- *
- * @param idToSelect - LLUUID of blocked Resident or Object to be selected.
- * If it is LLUUID::null, nothing will be selected.
- */
- static void showPanelAndSelect(const LLUUID& idToSelect);
-
+ LLPanelBlockedList();
+ ~LLPanelBlockedList(){};
+
+ virtual BOOL postBuild();
+ virtual void draw();
+ virtual void onOpen(const LLSD& key);
+
+ void selectBlocked(const LLUUID& id);
+
+ /**
+ * Shows current Panel in side tray and select passed blocked item.
+ *
+ * @param idToSelect - LLUUID of blocked Resident or Object to be selected.
+ * If it is LLUUID::null, nothing will be selected.
+ */
+ static void showPanelAndSelect(const LLUUID& idToSelect);
+
private:
- typedef enum e_sort_oder{
- E_SORT_BY_NAME = 0,
- E_SORT_BY_TYPE = 1,
- } ESortOrder;
+ typedef enum e_sort_oder{
+ E_SORT_BY_NAME = 0,
+ E_SORT_BY_TYPE = 1,
+ } ESortOrder;
void removePicker();
- void updateButtons();
+ void updateButtons();
- // UI callbacks
- void unblockItem();
- void blockResidentByName();
- void blockObjectByName();
- void onFilterEdit(const std::string& search_string);
+ // UI callbacks
+ void unblockItem();
+ void blockResidentByName();
+ void blockObjectByName();
+ void onFilterEdit(const std::string& search_string);
- // List commnads
- void onCustomAction(const LLSD& userdata);
- BOOL isActionChecked(const LLSD& userdata);
+ // List commnads
+ void onCustomAction(const LLSD& userdata);
+ BOOL isActionChecked(const LLSD& userdata);
- void callbackBlockPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
- static void callbackBlockByName(const std::string& text);
+ void callbackBlockPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
+ static void callbackBlockByName(const std::string& text);
private:
- LLBlockList* mBlockedList;
+ LLBlockList* mBlockedList;
LLHandle<LLFloater> mPicker;
};
@@ -88,25 +88,25 @@ private:
// Class for handling mute object by name floater.
class LLFloaterGetBlockedObjectName : public LLFloater
{
- friend class LLFloaterReg;
+ friend class LLFloaterReg;
public:
- typedef boost::function<void (const std::string&)> get_object_name_callback_t;
+ typedef boost::function<void (const std::string&)> get_object_name_callback_t;
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- virtual BOOL handleKeyHere(KEY key, MASK mask);
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
- static LLFloaterGetBlockedObjectName* show(get_object_name_callback_t callback);
+ static LLFloaterGetBlockedObjectName* show(get_object_name_callback_t callback);
private:
- LLFloaterGetBlockedObjectName(const LLSD& key);
- virtual ~LLFloaterGetBlockedObjectName();
+ LLFloaterGetBlockedObjectName(const LLSD& key);
+ virtual ~LLFloaterGetBlockedObjectName();
- // UI Callbacks
- void applyBlocking();
- void cancelBlocking();
+ // UI Callbacks
+ void applyBlocking();
+ void cancelBlocking();
- get_object_name_callback_t mGetObjectNameCallback;
+ get_object_name_callback_t mGetObjectNameCallback;
};
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index 183000ceac..393f809953 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelclassified.cpp
* @brief LLPanelClassifiedInfo class implementation
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,7 +41,7 @@
#include "lliconctrl.h"
#include "lltexturectrl.h"
#include "llfloaterworldmap.h"
-#include "llviewergenericmessage.h" // send_generic_message
+#include "llviewergenericmessage.h" // send_generic_message
#include "llviewerregion.h"
#include "llscrollcontainer.h"
#include "llcorehttputil.h"
@@ -58,23 +58,23 @@ static LLPanelInjector<LLPanelClassifiedInfo> t_panel_panel_classified_info("pan
class LLDispatchClassifiedClickThrough : public LLDispatchHandler
{
public:
- virtual bool operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings)
- {
- if (strings.size() != 4) return false;
- LLUUID classified_id(strings[0]);
- S32 teleport_clicks = atoi(strings[1].c_str());
- S32 map_clicks = atoi(strings[2].c_str());
- S32 profile_clicks = atoi(strings[3].c_str());
-
- LLPanelClassifiedInfo::setClickThrough(
- classified_id, teleport_clicks, map_clicks, profile_clicks, false);
-
- return true;
- }
+ virtual bool operator()(
+ const LLDispatcher* dispatcher,
+ const std::string& key,
+ const LLUUID& invoice,
+ const sparam_t& strings)
+ {
+ if (strings.size() != 4) return false;
+ LLUUID classified_id(strings[0]);
+ S32 teleport_clicks = atoi(strings[1].c_str());
+ S32 map_clicks = atoi(strings[2].c_str());
+ S32 profile_clicks = atoi(strings[3].c_str());
+
+ LLPanelClassifiedInfo::setClickThrough(
+ classified_id, teleport_clicks, map_clicks, profile_clicks, false);
+
+ return true;
+ }
};
static LLDispatchClassifiedClickThrough sClassifiedClickThrough;
@@ -98,105 +98,105 @@ LLPanelClassifiedInfo::LLPanelClassifiedInfo()
, mProfileClicksNew(0)
, mSnapshotCtrl(NULL)
{
- sAllPanels.push_back(this);
+ sAllPanels.push_back(this);
}
LLPanelClassifiedInfo::~LLPanelClassifiedInfo()
{
- sAllPanels.remove(this);
+ sAllPanels.remove(this);
}
BOOL LLPanelClassifiedInfo::postBuild()
{
- childSetAction("show_on_map_btn", boost::bind(&LLPanelClassifiedInfo::onMapClick, this));
- childSetAction("teleport_btn", boost::bind(&LLPanelClassifiedInfo::onTeleportClick, this));
+ childSetAction("show_on_map_btn", boost::bind(&LLPanelClassifiedInfo::onMapClick, this));
+ childSetAction("teleport_btn", boost::bind(&LLPanelClassifiedInfo::onTeleportClick, this));
- mScrollingPanel = getChild<LLPanel>("scroll_content_panel");
- mScrollContainer = getChild<LLScrollContainer>("profile_scroll");
+ mScrollingPanel = getChild<LLPanel>("scroll_content_panel");
+ mScrollContainer = getChild<LLScrollContainer>("profile_scroll");
- mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight();
- mScrollingPanelWidth = mScrollingPanel->getRect().getWidth();
+ mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight();
+ mScrollingPanelWidth = mScrollingPanel->getRect().getWidth();
- mSnapshotCtrl = getChild<LLTextureCtrl>("classified_snapshot");
- mSnapshotRect = getDefaultSnapshotRect();
+ mSnapshotCtrl = getChild<LLTextureCtrl>("classified_snapshot");
+ mSnapshotRect = getDefaultSnapshotRect();
- return TRUE;
+ return TRUE;
}
void LLPanelClassifiedInfo::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
{
- LLPanel::reshape(width, height, called_from_parent);
+ LLPanel::reshape(width, height, called_from_parent);
- if (!mScrollContainer || !mScrollingPanel)
- return;
+ if (!mScrollContainer || !mScrollingPanel)
+ return;
- static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
- S32 scroll_height = mScrollContainer->getRect().getHeight();
- if (mScrollingPanelMinHeight >= scroll_height)
- {
- mScrollingPanel->reshape(mScrollingPanelWidth, mScrollingPanelMinHeight);
- }
- else
- {
- mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height);
- }
+ S32 scroll_height = mScrollContainer->getRect().getHeight();
+ if (mScrollingPanelMinHeight >= scroll_height)
+ {
+ mScrollingPanel->reshape(mScrollingPanelWidth, mScrollingPanelMinHeight);
+ }
+ else
+ {
+ mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height);
+ }
- mSnapshotRect = getDefaultSnapshotRect();
- stretchSnapshot();
+ mSnapshotRect = getDefaultSnapshotRect();
+ stretchSnapshot();
}
void LLPanelClassifiedInfo::onOpen(const LLSD& key)
{
- LLUUID avatar_id = key["classified_creator_id"];
- if(avatar_id.isNull())
- {
- return;
- }
-
- if(getAvatarId().notNull())
- {
- LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
- }
-
- setAvatarId(avatar_id);
-
- resetData();
- resetControls();
- scrollToTop();
-
- setClassifiedId(key["classified_id"]);
- setClassifiedName(key["classified_name"]);
- setDescription(key["classified_desc"]);
- setSnapshotId(key["classified_snapshot_id"]);
- setFromSearch(key["from_search"]);
-
- LL_INFOS() << "Opening classified [" << getClassifiedName() << "] (" << getClassifiedId() << ")" << LL_ENDL;
-
- LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this);
- LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId());
- gGenericDispatcher.addHandler("classifiedclickthrough", &sClassifiedClickThrough);
-
- if (gAgent.getRegion())
- {
- // While we're at it let's get the stats from the new table if that
- // capability exists.
- std::string url = gAgent.getRegion()->getCapability("SearchStatRequest");
- if (!url.empty())
- {
- LL_INFOS() << "Classified stat request via capability" << LL_ENDL;
- LLSD body;
- LLUUID classifiedId = getClassifiedId();
- body["classified_id"] = classifiedId;
- LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost(url, body,
- boost::bind(&LLPanelClassifiedInfo::handleSearchStatResponse, classifiedId, _1));
- }
- }
- // Update classified click stats.
- // *TODO: Should we do this when opening not from search?
- sendClickMessage("profile");
-
- setInfoLoaded(false);
+ LLUUID avatar_id = key["classified_creator_id"];
+ if(avatar_id.isNull())
+ {
+ return;
+ }
+
+ if(getAvatarId().notNull())
+ {
+ LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
+ }
+
+ setAvatarId(avatar_id);
+
+ resetData();
+ resetControls();
+ scrollToTop();
+
+ setClassifiedId(key["classified_id"]);
+ setClassifiedName(key["classified_name"]);
+ setDescription(key["classified_desc"]);
+ setSnapshotId(key["classified_snapshot_id"]);
+ setFromSearch(key["from_search"]);
+
+ LL_INFOS() << "Opening classified [" << getClassifiedName() << "] (" << getClassifiedId() << ")" << LL_ENDL;
+
+ LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this);
+ LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId());
+ gGenericDispatcher.addHandler("classifiedclickthrough", &sClassifiedClickThrough);
+
+ if (gAgent.getRegion())
+ {
+ // While we're at it let's get the stats from the new table if that
+ // capability exists.
+ std::string url = gAgent.getRegion()->getCapability("SearchStatRequest");
+ if (!url.empty())
+ {
+ LL_INFOS() << "Classified stat request via capability" << LL_ENDL;
+ LLSD body;
+ LLUUID classifiedId = getClassifiedId();
+ body["classified_id"] = classifiedId;
+ LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost(url, body,
+ boost::bind(&LLPanelClassifiedInfo::handleSearchStatResponse, classifiedId, _1));
+ }
+ }
+ // Update classified click stats.
+ // *TODO: Should we do this when opening not from search?
+ sendClickMessage("profile");
+
+ setInfoLoaded(false);
}
/*static*/
@@ -218,347 +218,347 @@ void LLPanelClassifiedInfo::handleSearchStatResponse(LLUUID classifiedId, LLSD r
void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType type)
{
- if(APT_CLASSIFIED_INFO == type)
- {
- LLAvatarClassifiedInfo* c_info = static_cast<LLAvatarClassifiedInfo*>(data);
- if(c_info && getClassifiedId() == c_info->classified_id)
- {
- setClassifiedName(c_info->name);
- setDescription(c_info->description);
- setSnapshotId(c_info->snapshot_id);
- setParcelId(c_info->parcel_id);
- setPosGlobal(c_info->pos_global);
- setSimName(c_info->sim_name);
-
- setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global));
- getChild<LLUICtrl>("category")->setValue(LLClassifiedInfo::sCategories[c_info->category]);
-
- static std::string mature_str = getString("type_mature");
- static std::string pg_str = getString("type_pg");
- static LLUIString price_str = getString("l$_price");
- static std::string date_fmt = getString("date_fmt");
-
- bool mature = is_cf_mature(c_info->flags);
- getChild<LLUICtrl>("content_type")->setValue(mature ? mature_str : pg_str);
- getChild<LLIconCtrl>("content_type_moderate")->setVisible(mature);
- getChild<LLIconCtrl>("content_type_general")->setVisible(!mature);
-
- std::string auto_renew_str = is_cf_auto_renew(c_info->flags) ?
- getString("auto_renew_on") : getString("auto_renew_off");
- getChild<LLUICtrl>("auto_renew")->setValue(auto_renew_str);
-
- price_str.setArg("[PRICE]", llformat("%d", c_info->price_for_listing));
- getChild<LLUICtrl>("price_for_listing")->setValue(LLSD(price_str));
-
- std::string date_str = date_fmt;
- LLStringUtil::format(date_str, LLSD().with("datetime", (S32) c_info->creation_date));
- getChild<LLUICtrl>("creation_date")->setValue(date_str);
-
- setInfoLoaded(true);
-
- LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
- }
- }
+ if(APT_CLASSIFIED_INFO == type)
+ {
+ LLAvatarClassifiedInfo* c_info = static_cast<LLAvatarClassifiedInfo*>(data);
+ if(c_info && getClassifiedId() == c_info->classified_id)
+ {
+ setClassifiedName(c_info->name);
+ setDescription(c_info->description);
+ setSnapshotId(c_info->snapshot_id);
+ setParcelId(c_info->parcel_id);
+ setPosGlobal(c_info->pos_global);
+ setSimName(c_info->sim_name);
+
+ setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global));
+ getChild<LLUICtrl>("category")->setValue(LLClassifiedInfo::sCategories[c_info->category]);
+
+ static std::string mature_str = getString("type_mature");
+ static std::string pg_str = getString("type_pg");
+ static LLUIString price_str = getString("l$_price");
+ static std::string date_fmt = getString("date_fmt");
+
+ bool mature = is_cf_mature(c_info->flags);
+ getChild<LLUICtrl>("content_type")->setValue(mature ? mature_str : pg_str);
+ getChild<LLIconCtrl>("content_type_moderate")->setVisible(mature);
+ getChild<LLIconCtrl>("content_type_general")->setVisible(!mature);
+
+ std::string auto_renew_str = is_cf_auto_renew(c_info->flags) ?
+ getString("auto_renew_on") : getString("auto_renew_off");
+ getChild<LLUICtrl>("auto_renew")->setValue(auto_renew_str);
+
+ price_str.setArg("[PRICE]", llformat("%d", c_info->price_for_listing));
+ getChild<LLUICtrl>("price_for_listing")->setValue(LLSD(price_str));
+
+ std::string date_str = date_fmt;
+ LLStringUtil::format(date_str, LLSD().with("datetime", (S32) c_info->creation_date));
+ getChild<LLUICtrl>("creation_date")->setValue(date_str);
+
+ setInfoLoaded(true);
+
+ LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
+ }
+ }
}
void LLPanelClassifiedInfo::resetData()
{
- setClassifiedName(LLStringUtil::null);
- setDescription(LLStringUtil::null);
- setClassifiedLocation(LLStringUtil::null);
- setClassifiedId(LLUUID::null);
- setSnapshotId(LLUUID::null);
- setPosGlobal(LLVector3d::zero);
- setParcelId(LLUUID::null);
- setSimName(LLStringUtil::null);
- setFromSearch(false);
-
- // reset click stats
- mTeleportClicksOld = 0;
- mMapClicksOld = 0;
- mProfileClicksOld = 0;
- mTeleportClicksNew = 0;
- mMapClicksNew = 0;
- mProfileClicksNew = 0;
-
- getChild<LLUICtrl>("category")->setValue(LLStringUtil::null);
- getChild<LLUICtrl>("content_type")->setValue(LLStringUtil::null);
- getChild<LLUICtrl>("click_through_text")->setValue(LLStringUtil::null);
- getChild<LLUICtrl>("price_for_listing")->setValue(LLStringUtil::null);
- getChild<LLUICtrl>("auto_renew")->setValue(LLStringUtil::null);
- getChild<LLUICtrl>("creation_date")->setValue(LLStringUtil::null);
- getChild<LLUICtrl>("click_through_text")->setValue(LLStringUtil::null);
- getChild<LLIconCtrl>("content_type_moderate")->setVisible(FALSE);
- getChild<LLIconCtrl>("content_type_general")->setVisible(FALSE);
+ setClassifiedName(LLStringUtil::null);
+ setDescription(LLStringUtil::null);
+ setClassifiedLocation(LLStringUtil::null);
+ setClassifiedId(LLUUID::null);
+ setSnapshotId(LLUUID::null);
+ setPosGlobal(LLVector3d::zero);
+ setParcelId(LLUUID::null);
+ setSimName(LLStringUtil::null);
+ setFromSearch(false);
+
+ // reset click stats
+ mTeleportClicksOld = 0;
+ mMapClicksOld = 0;
+ mProfileClicksOld = 0;
+ mTeleportClicksNew = 0;
+ mMapClicksNew = 0;
+ mProfileClicksNew = 0;
+
+ getChild<LLUICtrl>("category")->setValue(LLStringUtil::null);
+ getChild<LLUICtrl>("content_type")->setValue(LLStringUtil::null);
+ getChild<LLUICtrl>("click_through_text")->setValue(LLStringUtil::null);
+ getChild<LLUICtrl>("price_for_listing")->setValue(LLStringUtil::null);
+ getChild<LLUICtrl>("auto_renew")->setValue(LLStringUtil::null);
+ getChild<LLUICtrl>("creation_date")->setValue(LLStringUtil::null);
+ getChild<LLUICtrl>("click_through_text")->setValue(LLStringUtil::null);
+ getChild<LLIconCtrl>("content_type_moderate")->setVisible(FALSE);
+ getChild<LLIconCtrl>("content_type_general")->setVisible(FALSE);
}
void LLPanelClassifiedInfo::resetControls()
{
- bool is_self = getAvatarId() == gAgent.getID();
+ bool is_self = getAvatarId() == gAgent.getID();
- getChildView("edit_btn")->setEnabled(is_self);
- getChildView("edit_btn")->setVisible( is_self);
- getChildView("price_layout_panel")->setVisible( is_self);
- getChildView("clickthrough_layout_panel")->setVisible( is_self);
+ getChildView("edit_btn")->setEnabled(is_self);
+ getChildView("edit_btn")->setVisible( is_self);
+ getChildView("price_layout_panel")->setVisible( is_self);
+ getChildView("clickthrough_layout_panel")->setVisible( is_self);
}
void LLPanelClassifiedInfo::setClassifiedName(const std::string& name)
{
- getChild<LLUICtrl>("classified_name")->setValue(name);
+ getChild<LLUICtrl>("classified_name")->setValue(name);
}
std::string LLPanelClassifiedInfo::getClassifiedName()
{
- return getChild<LLUICtrl>("classified_name")->getValue().asString();
+ return getChild<LLUICtrl>("classified_name")->getValue().asString();
}
void LLPanelClassifiedInfo::setDescription(const std::string& desc)
{
- getChild<LLUICtrl>("classified_desc")->setValue(desc);
+ getChild<LLUICtrl>("classified_desc")->setValue(desc);
}
std::string LLPanelClassifiedInfo::getDescription()
{
- return getChild<LLUICtrl>("classified_desc")->getValue().asString();
+ return getChild<LLUICtrl>("classified_desc")->getValue().asString();
}
void LLPanelClassifiedInfo::setClassifiedLocation(const std::string& location)
{
- getChild<LLUICtrl>("classified_location")->setValue(location);
+ getChild<LLUICtrl>("classified_location")->setValue(location);
}
std::string LLPanelClassifiedInfo::getClassifiedLocation()
{
- return getChild<LLUICtrl>("classified_location")->getValue().asString();
+ return getChild<LLUICtrl>("classified_location")->getValue().asString();
}
void LLPanelClassifiedInfo::setSnapshotId(const LLUUID& id)
{
- mSnapshotCtrl->setValue(id);
- mSnapshotStreched = false;
+ mSnapshotCtrl->setValue(id);
+ mSnapshotStreched = false;
}
void LLPanelClassifiedInfo::draw()
{
- LLPanel::draw();
-
- // Stretch in draw because it takes some time to load a texture,
- // going to try to stretch snapshot until texture is loaded
- if(!mSnapshotStreched)
- {
- stretchSnapshot();
- }
+ LLPanel::draw();
+
+ // Stretch in draw because it takes some time to load a texture,
+ // going to try to stretch snapshot until texture is loaded
+ if(!mSnapshotStreched)
+ {
+ stretchSnapshot();
+ }
}
LLUUID LLPanelClassifiedInfo::getSnapshotId()
{
- return getChild<LLUICtrl>("classified_snapshot")->getValue().asUUID();
+ return getChild<LLUICtrl>("classified_snapshot")->getValue().asUUID();
}
// static
void LLPanelClassifiedInfo::setClickThrough(
- const LLUUID& classified_id,
- S32 teleport,
- S32 map,
- S32 profile,
- bool from_new_table)
+ const LLUUID& classified_id,
+ S32 teleport,
+ S32 map,
+ S32 profile,
+ bool from_new_table)
{
- LL_INFOS() << "Click-through data for classified " << classified_id << " arrived: ["
- << teleport << ", " << map << ", " << profile << "] ("
- << (from_new_table ? "new" : "old") << ")" << LL_ENDL;
-
- for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter)
- {
- LLPanelClassifiedInfo* self = *iter;
- if (self->getClassifiedId() != classified_id)
- {
- continue;
- }
-
- // *HACK: Skip LLPanelClassifiedEdit instances: they don't display clicks data.
- // Those instances should not be in the list at all.
- if (typeid(*self) != typeid(LLPanelClassifiedInfo))
- {
- continue;
- }
-
- LL_INFOS() << "Updating classified info panel" << LL_ENDL;
-
- // We need to check to see if the data came from the new stat_table
- // or the old classified table. We also need to cache the data from
- // the two separate sources so as to display the aggregate totals.
-
- if (from_new_table)
- {
- self->mTeleportClicksNew = teleport;
- self->mMapClicksNew = map;
- self->mProfileClicksNew = profile;
- }
- else
- {
- self->mTeleportClicksOld = teleport;
- self->mMapClicksOld = map;
- self->mProfileClicksOld = profile;
- }
-
- static LLUIString ct_str = self->getString("click_through_text_fmt");
-
- ct_str.setArg("[TELEPORT]", llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld));
- ct_str.setArg("[MAP]", llformat("%d", self->mMapClicksNew + self->mMapClicksOld));
- ct_str.setArg("[PROFILE]", llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld));
-
- self->getChild<LLUICtrl>("click_through_text")->setValue(ct_str.getString());
- // *HACK: remove this when there is enough room for click stats in the info panel
- self->getChildView("click_through_text")->setToolTip(ct_str.getString());
-
- LL_INFOS() << "teleport: " << llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld)
- << ", map: " << llformat("%d", self->mMapClicksNew + self->mMapClicksOld)
- << ", profile: " << llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld)
- << LL_ENDL;
- }
+ LL_INFOS() << "Click-through data for classified " << classified_id << " arrived: ["
+ << teleport << ", " << map << ", " << profile << "] ("
+ << (from_new_table ? "new" : "old") << ")" << LL_ENDL;
+
+ for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter)
+ {
+ LLPanelClassifiedInfo* self = *iter;
+ if (self->getClassifiedId() != classified_id)
+ {
+ continue;
+ }
+
+ // *HACK: Skip LLPanelClassifiedEdit instances: they don't display clicks data.
+ // Those instances should not be in the list at all.
+ if (typeid(*self) != typeid(LLPanelClassifiedInfo))
+ {
+ continue;
+ }
+
+ LL_INFOS() << "Updating classified info panel" << LL_ENDL;
+
+ // We need to check to see if the data came from the new stat_table
+ // or the old classified table. We also need to cache the data from
+ // the two separate sources so as to display the aggregate totals.
+
+ if (from_new_table)
+ {
+ self->mTeleportClicksNew = teleport;
+ self->mMapClicksNew = map;
+ self->mProfileClicksNew = profile;
+ }
+ else
+ {
+ self->mTeleportClicksOld = teleport;
+ self->mMapClicksOld = map;
+ self->mProfileClicksOld = profile;
+ }
+
+ static LLUIString ct_str = self->getString("click_through_text_fmt");
+
+ ct_str.setArg("[TELEPORT]", llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld));
+ ct_str.setArg("[MAP]", llformat("%d", self->mMapClicksNew + self->mMapClicksOld));
+ ct_str.setArg("[PROFILE]", llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld));
+
+ self->getChild<LLUICtrl>("click_through_text")->setValue(ct_str.getString());
+ // *HACK: remove this when there is enough room for click stats in the info panel
+ self->getChildView("click_through_text")->setToolTip(ct_str.getString());
+
+ LL_INFOS() << "teleport: " << llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld)
+ << ", map: " << llformat("%d", self->mMapClicksNew + self->mMapClicksOld)
+ << ", profile: " << llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld)
+ << LL_ENDL;
+ }
}
// static
std::string LLPanelClassifiedInfo::createLocationText(
- const std::string& original_name,
- const std::string& sim_name,
- const LLVector3d& pos_global)
+ const std::string& original_name,
+ const std::string& sim_name,
+ const LLVector3d& pos_global)
{
- std::string location_text;
-
- location_text.append(original_name);
-
- if (!sim_name.empty())
- {
- if (!location_text.empty())
- location_text.append(", ");
- location_text.append(sim_name);
- }
-
- if (!location_text.empty())
- location_text.append(" ");
-
- if (!pos_global.isNull())
- {
- S32 region_x = ll_round((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
- S32 region_y = ll_round((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
- S32 region_z = ll_round((F32)pos_global.mdV[VZ]);
- location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
- }
-
- return location_text;
+ std::string location_text;
+
+ location_text.append(original_name);
+
+ if (!sim_name.empty())
+ {
+ if (!location_text.empty())
+ location_text.append(", ");
+ location_text.append(sim_name);
+ }
+
+ if (!location_text.empty())
+ location_text.append(" ");
+
+ if (!pos_global.isNull())
+ {
+ S32 region_x = ll_round((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
+ S32 region_y = ll_round((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
+ S32 region_z = ll_round((F32)pos_global.mdV[VZ]);
+ location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
+ }
+
+ return location_text;
}
void LLPanelClassifiedInfo::stretchSnapshot()
{
- // *NOTE dzaporozhan
- // Could be moved to LLTextureCtrl
+ // *NOTE dzaporozhan
+ // Could be moved to LLTextureCtrl
- LLViewerFetchedTexture* texture = mSnapshotCtrl->getTexture();
+ LLViewerFetchedTexture* texture = mSnapshotCtrl->getTexture();
- if(!texture)
- {
- return;
- }
+ if(!texture)
+ {
+ return;
+ }
- if(0 == texture->getOriginalWidth() || 0 == texture->getOriginalHeight())
- {
- // looks like texture is not loaded yet
- return;
- }
+ if(0 == texture->getOriginalWidth() || 0 == texture->getOriginalHeight())
+ {
+ // looks like texture is not loaded yet
+ return;
+ }
- LLRect rc = mSnapshotRect;
- // *HACK dzaporozhan
- // LLTextureCtrl uses BTN_HEIGHT_SMALL as bottom for texture which causes
- // drawn texture to be smaller than expected. (see LLTextureCtrl::draw())
- // Lets increase texture height to force texture look as expected.
- rc.mBottom -= BTN_HEIGHT_SMALL;
+ LLRect rc = mSnapshotRect;
+ // *HACK dzaporozhan
+ // LLTextureCtrl uses BTN_HEIGHT_SMALL as bottom for texture which causes
+ // drawn texture to be smaller than expected. (see LLTextureCtrl::draw())
+ // Lets increase texture height to force texture look as expected.
+ rc.mBottom -= BTN_HEIGHT_SMALL;
- F32 t_width = texture->getFullWidth();
- F32 t_height = texture->getFullHeight();
+ F32 t_width = texture->getFullWidth();
+ F32 t_height = texture->getFullHeight();
- F32 ratio = llmin<F32>( (rc.getWidth() / t_width), (rc.getHeight() / t_height) );
+ F32 ratio = llmin<F32>( (rc.getWidth() / t_width), (rc.getHeight() / t_height) );
- t_width *= ratio;
- t_height *= ratio;
+ t_width *= ratio;
+ t_height *= ratio;
- rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), llfloor(t_width), llfloor(t_height));
- mSnapshotCtrl->setShape(rc);
+ rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), llfloor(t_width), llfloor(t_height));
+ mSnapshotCtrl->setShape(rc);
- mSnapshotStreched = true;
+ mSnapshotStreched = true;
}
LLRect LLPanelClassifiedInfo::getDefaultSnapshotRect()
{
- // Using scroll container makes getting default rect a hard task
- // because rect in postBuild() and in first reshape() is not the same.
- // Using snapshot_panel makes it easier to reshape snapshot.
- return getChild<LLUICtrl>("snapshot_panel")->getLocalRect();
+ // Using scroll container makes getting default rect a hard task
+ // because rect in postBuild() and in first reshape() is not the same.
+ // Using snapshot_panel makes it easier to reshape snapshot.
+ return getChild<LLUICtrl>("snapshot_panel")->getLocalRect();
}
void LLPanelClassifiedInfo::scrollToTop()
{
- LLScrollContainer* scrollContainer = findChild<LLScrollContainer>("profile_scroll");
- if (scrollContainer)
- scrollContainer->goToTop();
+ LLScrollContainer* scrollContainer = findChild<LLScrollContainer>("profile_scroll");
+ if (scrollContainer)
+ scrollContainer->goToTop();
}
// static
// *TODO: move out of the panel
void LLPanelClassifiedInfo::sendClickMessage(
- const std::string& type,
- bool from_search,
- const LLUUID& classified_id,
- const LLUUID& parcel_id,
- const LLVector3d& global_pos,
- const std::string& sim_name)
+ const std::string& type,
+ bool from_search,
+ const LLUUID& classified_id,
+ const LLUUID& parcel_id,
+ const LLVector3d& global_pos,
+ const std::string& sim_name)
{
- if (gAgent.getRegion())
- {
- // You're allowed to click on your own ads to reassure yourself
- // that the system is working.
- LLSD body;
- body["type"] = type;
- body["from_search"] = from_search;
- body["classified_id"] = classified_id;
- body["parcel_id"] = parcel_id;
- body["dest_pos_global"] = global_pos.getValue();
- body["region_name"] = sim_name;
-
- std::string url = gAgent.getRegion()->getCapability("SearchStatTracking");
- LL_INFOS() << "Sending click msg via capability (url=" << url << ")" << LL_ENDL;
- LL_INFOS() << "body: [" << body << "]" << LL_ENDL;
+ if (gAgent.getRegion())
+ {
+ // You're allowed to click on your own ads to reassure yourself
+ // that the system is working.
+ LLSD body;
+ body["type"] = type;
+ body["from_search"] = from_search;
+ body["classified_id"] = classified_id;
+ body["parcel_id"] = parcel_id;
+ body["dest_pos_global"] = global_pos.getValue();
+ body["region_name"] = sim_name;
+
+ std::string url = gAgent.getRegion()->getCapability("SearchStatTracking");
+ LL_INFOS() << "Sending click msg via capability (url=" << url << ")" << LL_ENDL;
+ LL_INFOS() << "body: [" << body << "]" << LL_ENDL;
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body,
"SearchStatTracking Click report sent.", "SearchStatTracking Click report NOT sent.");
- }
+ }
}
void LLPanelClassifiedInfo::sendClickMessage(const std::string& type)
{
- sendClickMessage(
- type,
- fromSearch(),
- getClassifiedId(),
- getParcelId(),
- getPosGlobal(),
- getSimName());
+ sendClickMessage(
+ type,
+ fromSearch(),
+ getClassifiedId(),
+ getParcelId(),
+ getPosGlobal(),
+ getSimName());
}
void LLPanelClassifiedInfo::onMapClick()
{
- sendClickMessage("map");
- LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
- LLFloaterReg::showInstance("world_map", "center");
+ sendClickMessage("map");
+ LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
+ LLFloaterReg::showInstance("world_map", "center");
}
void LLPanelClassifiedInfo::onTeleportClick()
{
- if (!getPosGlobal().isExactlyZero())
- {
- sendClickMessage("teleport");
- gAgent.teleportViaLocation(getPosGlobal());
- LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
- }
+ if (!getPosGlobal().isExactlyZero())
+ {
+ sendClickMessage("teleport");
+ gAgent.teleportViaLocation(getPosGlobal());
+ LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
+ }
}
//EOF
diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h
index 471becd0f7..88346df6c3 100644
--- a/indra/newview/llpanelclassified.h
+++ b/indra/newview/llpanelclassified.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelclassified.h
* @brief LLPanelClassifiedInfo class definition
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,135 +41,135 @@ class LLTextureCtrl;
class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver
{
- LOG_CLASS(LLPanelClassifiedInfo);
+ LOG_CLASS(LLPanelClassifiedInfo);
public:
- LLPanelClassifiedInfo();
- virtual ~LLPanelClassifiedInfo();
+ LLPanelClassifiedInfo();
+ virtual ~LLPanelClassifiedInfo();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
+ /*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
- void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; }
+ void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; }
- LLUUID& getAvatarId() { return mAvatarId; }
+ LLUUID& getAvatarId() { return mAvatarId; }
- void setSnapshotId(const LLUUID& id);
+ void setSnapshotId(const LLUUID& id);
- LLUUID getSnapshotId();
+ LLUUID getSnapshotId();
- void setClassifiedId(const LLUUID& id) { mClassifiedId = id; }
+ void setClassifiedId(const LLUUID& id) { mClassifiedId = id; }
- LLUUID& getClassifiedId() { return mClassifiedId; }
+ LLUUID& getClassifiedId() { return mClassifiedId; }
- void setClassifiedName(const std::string& name);
+ void setClassifiedName(const std::string& name);
- std::string getClassifiedName();
+ std::string getClassifiedName();
- void setDescription(const std::string& desc);
+ void setDescription(const std::string& desc);
- std::string getDescription();
+ std::string getDescription();
- void setClassifiedLocation(const std::string& location);
+ void setClassifiedLocation(const std::string& location);
- std::string getClassifiedLocation();
+ std::string getClassifiedLocation();
- void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
+ void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
- LLVector3d& getPosGlobal() { return mPosGlobal; }
+ LLVector3d& getPosGlobal() { return mPosGlobal; }
- void setParcelId(const LLUUID& id) { mParcelId = id; }
+ void setParcelId(const LLUUID& id) { mParcelId = id; }
- LLUUID getParcelId() { return mParcelId; }
+ LLUUID getParcelId() { return mParcelId; }
- void setSimName(const std::string& sim_name) { mSimName = sim_name; }
+ void setSimName(const std::string& sim_name) { mSimName = sim_name; }
- std::string getSimName() { return mSimName; }
+ std::string getSimName() { return mSimName; }
- void setFromSearch(bool val) { mFromSearch = val; }
+ void setFromSearch(bool val) { mFromSearch = val; }
- bool fromSearch() { return mFromSearch; }
+ bool fromSearch() { return mFromSearch; }
- bool getInfoLoaded() { return mInfoLoaded; }
+ bool getInfoLoaded() { return mInfoLoaded; }
- void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; }
+ void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; }
- static void setClickThrough(
- const LLUUID& classified_id,
- S32 teleport,
- S32 map,
- S32 profile,
- bool from_new_table);
+ static void setClickThrough(
+ const LLUUID& classified_id,
+ S32 teleport,
+ S32 map,
+ S32 profile,
+ bool from_new_table);
- static void sendClickMessage(
- const std::string& type,
- bool from_search,
- const LLUUID& classified_id,
- const LLUUID& parcel_id,
- const LLVector3d& global_pos,
- const std::string& sim_name);
+ static void sendClickMessage(
+ const std::string& type,
+ bool from_search,
+ const LLUUID& classified_id,
+ const LLUUID& parcel_id,
+ const LLVector3d& global_pos,
+ const std::string& sim_name);
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- /*virtual*/ void draw();
+ /*virtual*/ void draw();
protected:
- virtual void resetData();
+ virtual void resetData();
- virtual void resetControls();
+ virtual void resetControls();
- static std::string createLocationText(
- const std::string& original_name,
- const std::string& sim_name,
- const LLVector3d& pos_global);
+ static std::string createLocationText(
+ const std::string& original_name,
+ const std::string& sim_name,
+ const LLVector3d& pos_global);
- void stretchSnapshot();
- void sendClickMessage(const std::string& type);
+ void stretchSnapshot();
+ void sendClickMessage(const std::string& type);
- LLRect getDefaultSnapshotRect();
+ LLRect getDefaultSnapshotRect();
- void scrollToTop();
+ void scrollToTop();
- void onMapClick();
- void onTeleportClick();
+ void onMapClick();
+ void onTeleportClick();
- bool mSnapshotStreched;
- LLRect mSnapshotRect;
- LLTextureCtrl* mSnapshotCtrl;
+ bool mSnapshotStreched;
+ LLRect mSnapshotRect;
+ LLTextureCtrl* mSnapshotCtrl;
private:
- LLUUID mAvatarId;
- LLUUID mClassifiedId;
- LLVector3d mPosGlobal;
- LLUUID mParcelId;
- std::string mSimName;
- bool mFromSearch;
- bool mInfoLoaded;
+ LLUUID mAvatarId;
+ LLUUID mClassifiedId;
+ LLVector3d mPosGlobal;
+ LLUUID mParcelId;
+ std::string mSimName;
+ bool mFromSearch;
+ bool mInfoLoaded;
- LLScrollContainer* mScrollContainer;
- LLPanel* mScrollingPanel;
+ LLScrollContainer* mScrollContainer;
+ LLPanel* mScrollingPanel;
- S32 mScrollingPanelMinHeight;
- S32 mScrollingPanelWidth;
+ S32 mScrollingPanelMinHeight;
+ S32 mScrollingPanelWidth;
- // Needed for stat tracking
- S32 mTeleportClicksOld;
- S32 mMapClicksOld;
- S32 mProfileClicksOld;
- S32 mTeleportClicksNew;
- S32 mMapClicksNew;
- S32 mProfileClicksNew;
+ // Needed for stat tracking
+ S32 mTeleportClicksOld;
+ S32 mMapClicksOld;
+ S32 mProfileClicksOld;
+ S32 mTeleportClicksNew;
+ S32 mMapClicksNew;
+ S32 mProfileClicksNew;
static void handleSearchStatResponse(LLUUID classifiedId, LLSD result);
- typedef std::list<LLPanelClassifiedInfo*> panel_list_t;
- static panel_list_t sAllPanels;
+ typedef std::list<LLPanelClassifiedInfo*> panel_list_t;
+ static panel_list_t sAllPanels;
};
#endif // LL_LLPANELCLASSIFIED_H
diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp
index 3bae0cebfb..489289e814 100644
--- a/indra/newview/llpanelcontents.cpp
+++ b/indra/newview/llpanelcontents.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -78,75 +78,75 @@ const char* LLPanelContents::PERMS_ANYONE_CONTROL_KEY = "perms_anyone_control";
BOOL LLPanelContents::postBuild()
{
- setMouseOpaque(FALSE);
+ setMouseOpaque(FALSE);
- childSetAction("button new script",&LLPanelContents::onClickNewScript, this);
- childSetAction("button permissions",&LLPanelContents::onClickPermissions, this);
+ childSetAction("button new script",&LLPanelContents::onClickNewScript, this);
+ childSetAction("button permissions",&LLPanelContents::onClickPermissions, this);
- mPanelInventoryObject = getChild<LLPanelObjectInventory>("contents_inventory");
+ mPanelInventoryObject = getChild<LLPanelObjectInventory>("contents_inventory");
- return TRUE;
+ return TRUE;
}
LLPanelContents::LLPanelContents()
- : LLPanel(),
- mPanelInventoryObject(NULL)
+ : LLPanel(),
+ mPanelInventoryObject(NULL)
{
}
LLPanelContents::~LLPanelContents()
{
- // Children all cleaned up by default view destructor.
+ // Children all cleaned up by default view destructor.
}
void LLPanelContents::getState(LLViewerObject *objectp )
{
- if( !objectp )
- {
- getChildView("button new script")->setEnabled(FALSE);
- return;
- }
-
- LLUUID group_id; // used for SL-23488
- LLSelectMgr::getInstance()->selectGetGroup(group_id); // sets group_id as a side effect SL-23488
-
- // BUG? Check for all objects being editable?
- bool editable = gAgent.isGodlike()
- || (objectp->permModify() && !objectp->isPermanentEnforced()
- && ( objectp->permYouOwner() || ( !group_id.isNull() && gAgent.isInGroup(group_id) ))); // solves SL-23488
- BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
-
- // Edit script button - ok if object is editable and there's an unambiguous destination for the object.
- getChildView("button new script")->setEnabled(
- editable &&
- all_volume &&
- ((LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() == 1)
- || (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1)));
-
- getChildView("button permissions")->setEnabled(!objectp->isPermanentEnforced());
- mPanelInventoryObject->setEnabled(!objectp->isPermanentEnforced());
+ if( !objectp )
+ {
+ getChildView("button new script")->setEnabled(FALSE);
+ return;
+ }
+
+ LLUUID group_id; // used for SL-23488
+ LLSelectMgr::getInstance()->selectGetGroup(group_id); // sets group_id as a side effect SL-23488
+
+ // BUG? Check for all objects being editable?
+ bool editable = gAgent.isGodlike()
+ || (objectp->permModify() && !objectp->isPermanentEnforced()
+ && ( objectp->permYouOwner() || ( !group_id.isNull() && gAgent.isInGroup(group_id) ))); // solves SL-23488
+ BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
+
+ // Edit script button - ok if object is editable and there's an unambiguous destination for the object.
+ getChildView("button new script")->setEnabled(
+ editable &&
+ all_volume &&
+ ((LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() == 1)
+ || (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1)));
+
+ getChildView("button permissions")->setEnabled(!objectp->isPermanentEnforced());
+ mPanelInventoryObject->setEnabled(!objectp->isPermanentEnforced());
}
void LLPanelContents::refresh()
{
- const BOOL children_ok = TRUE;
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok);
-
- getState(object);
- if (mPanelInventoryObject)
- {
- mPanelInventoryObject->refresh();
- }
+ const BOOL children_ok = TRUE;
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok);
+
+ getState(object);
+ if (mPanelInventoryObject)
+ {
+ mPanelInventoryObject->refresh();
+ }
}
void LLPanelContents::clearContents()
{
- if (mPanelInventoryObject)
- {
- mPanelInventoryObject->clearInventoryTask();
- }
+ if (mPanelInventoryObject)
+ {
+ mPanelInventoryObject->clearInventoryTask();
+ }
}
@@ -157,52 +157,52 @@ void LLPanelContents::clearContents()
// static
void LLPanelContents::onClickNewScript(void *userdata)
{
- const BOOL children_ok = TRUE;
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok);
- if(object)
- {
- LLPermissions perm;
- perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
-
- // Parameters are base, owner, everyone, group, next
- perm.initMasks(
- PERM_ALL,
- PERM_ALL,
- LLFloaterPerms::getEveryonePerms("Scripts"),
- LLFloaterPerms::getGroupPerms("Scripts"),
- PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Scripts"));
- std::string desc;
- LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc);
- LLPointer<LLViewerInventoryItem> new_item =
- new LLViewerInventoryItem(
- LLUUID::null,
- LLUUID::null,
- perm,
- LLUUID::null,
- LLAssetType::AT_LSL_TEXT,
- LLInventoryType::IT_LSL,
- "New Script",
- desc,
- LLSaleInfo::DEFAULT,
- LLInventoryItemFlags::II_FLAGS_NONE,
- time_corrected());
- object->saveScript(new_item, TRUE, true);
-
- std::string name = new_item->getName();
-
- // *NOTE: In order to resolve SL-22177, we needed to create
- // the script first, and then you have to click it in
- // inventory to edit it.
- // *TODO: The script creation should round-trip back to the
- // viewer so the viewer can auto-open the script and start
- // editing ASAP.
- }
+ const BOOL children_ok = TRUE;
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok);
+ if(object)
+ {
+ LLPermissions perm;
+ perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
+
+ // Parameters are base, owner, everyone, group, next
+ perm.initMasks(
+ PERM_ALL,
+ PERM_ALL,
+ LLFloaterPerms::getEveryonePerms("Scripts"),
+ LLFloaterPerms::getGroupPerms("Scripts"),
+ PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Scripts"));
+ std::string desc;
+ LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc);
+ LLPointer<LLViewerInventoryItem> new_item =
+ new LLViewerInventoryItem(
+ LLUUID::null,
+ LLUUID::null,
+ perm,
+ LLUUID::null,
+ LLAssetType::AT_LSL_TEXT,
+ LLInventoryType::IT_LSL,
+ "New Script",
+ desc,
+ LLSaleInfo::DEFAULT,
+ LLInventoryItemFlags::II_FLAGS_NONE,
+ time_corrected());
+ object->saveScript(new_item, TRUE, true);
+
+ std::string name = new_item->getName();
+
+ // *NOTE: In order to resolve SL-22177, we needed to create
+ // the script first, and then you have to click it in
+ // inventory to edit it.
+ // *TODO: The script creation should round-trip back to the
+ // viewer so the viewer can auto-open the script and start
+ // editing ASAP.
+ }
}
// static
void LLPanelContents::onClickPermissions(void *userdata)
{
- LLPanelContents* self = (LLPanelContents*)userdata;
- gFloaterView->getParentFloater(self)->addDependentFloater(LLFloaterReg::showInstance("bulk_perms"));
+ LLPanelContents* self = (LLPanelContents*)userdata;
+ gFloaterView->getParentFloater(self)->addDependentFloater(LLFloaterReg::showInstance("bulk_perms"));
}
diff --git a/indra/newview/llpanelcontents.h b/indra/newview/llpanelcontents.h
index 6ecc78afa0..70e9b092cb 100644
--- a/indra/newview/llpanelcontents.h
+++ b/indra/newview/llpanelcontents.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelcontents.h
* @brief Object contents panel in the tools floater.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,17 +43,17 @@ class LLSpinCtrl;
class LLPanelContents : public LLPanel
{
public:
- virtual BOOL postBuild();
- LLPanelContents();
- virtual ~LLPanelContents();
+ virtual BOOL postBuild();
+ LLPanelContents();
+ virtual ~LLPanelContents();
+
+ void refresh();
+ void clearContents();
- void refresh();
- void clearContents();
+ static void onClickNewScript(void*);
+ static void onClickPermissions(void*);
- static void onClickNewScript(void*);
- static void onClickPermissions(void*);
-
// Key suffix for "tentative" fields
static const char* TENTATIVE_SUFFIX;
@@ -66,10 +66,10 @@ public:
static const char* PERMS_ANYONE_CONTROL_KEY;
protected:
- void getState(LLViewerObject *object);
+ void getState(LLViewerObject *object);
public:
- LLPanelObjectInventory* mPanelInventoryObject;
+ LLPanelObjectInventory* mPanelInventoryObject;
};
#endif // LL_LLPANELCONTENTS_H
diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp
index 839f25761a..75d1b46e57 100644
--- a/indra/newview/llpaneleditsky.cpp
+++ b/indra/newview/llpaneleditsky.cpp
@@ -39,7 +39,7 @@
#include "llviewercontrol.h"
namespace
-{
+{
// Atmosphere Tab
const std::string FIELD_SKY_AMBIENT_LIGHT("ambient_light");
const std::string FIELD_SKY_BLUE_HORIZON("blue_horizon");
@@ -484,10 +484,10 @@ void LLPanelSettingsSkyCloudTab::onCloudMapChanged()
void LLPanelSettingsSkyCloudTab::onCloudDensityChanged()
{
if (!mSkySettings) return;
- LLColor3 density(getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_X)->getValue().asReal(),
- getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_Y)->getValue().asReal(),
+ LLColor3 density(getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_X)->getValue().asReal(),
+ getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_Y)->getValue().asReal(),
getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_D)->getValue().asReal());
-
+
mSkySettings->setCloudPosDensity1(density);
setIsDirty();
}
@@ -566,7 +566,7 @@ void LLPanelSettingsSkySunMoonTab::refresh()
getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(FALSE);
getChildView(FIELD_SKY_SUN_BEACON)->setEnabled(TRUE);
getChildView(FIELD_SKY_MOON_BEACON)->setEnabled(TRUE);
-
+
if (!mSkySettings)
return;
}
@@ -579,7 +579,7 @@ void LLPanelSettingsSkySunMoonTab::refresh()
getChild<LLColorSwatchCtrl>(FIELD_SKY_SUN_MOON_COLOR)->set(mSkySettings->getSunlightColor() / SLIDER_SCALE_SUN_AMBIENT);
LLColor3 glow(mSkySettings->getGlow());
-
+
// takes 40 - 0.2 range -> 0 - 1.99 UI range
getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->setValue(2.0 - (glow.mV[0] / SLIDER_SCALE_GLOW_R));
getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setValue(glow.mV[2] / SLIDER_SCALE_GLOW_B);
@@ -629,7 +629,7 @@ void LLPanelSettingsSkySunMoonTab::onGlowChanged()
LLColor3 glow(getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->getValue().asReal(), 0.0f, getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->getValue().asReal());
// takes 0 - 1.99 UI range -> 40 -> 0.2 range
- glow.mV[0] = (2.0f - glow.mV[0]) * SLIDER_SCALE_GLOW_R;
+ glow.mV[0] = (2.0f - glow.mV[0]) * SLIDER_SCALE_GLOW_R;
glow.mV[2] *= SLIDER_SCALE_GLOW_B;
mSkySettings->setGlow(glow);
@@ -775,9 +775,9 @@ void LLPanelSettingsSkySunMoonTab::onMoonBrightnessChanged()
mSkySettings->update();
setIsDirty();
}
-
+
LLPanelSettingsSkyDensityTab::LLPanelSettingsSkyDensityTab()
-{
+{
}
BOOL LLPanelSettingsSkyDensityTab::postBuild()
diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h
index 523cc134a8..05cd866f28 100644
--- a/indra/newview/llpaneleditsky.h
+++ b/indra/newview/llpaneleditsky.h
@@ -60,8 +60,8 @@ class LLPanelSettingsSkyAtmosTab : public LLPanelSettingsSky
public:
LLPanelSettingsSkyAtmosTab();
- virtual BOOL postBuild() override;
- virtual void setEnabled(BOOL enabled) override;
+ virtual BOOL postBuild() override;
+ virtual void setEnabled(BOOL enabled) override;
protected:
virtual void refresh() override;
@@ -91,8 +91,8 @@ class LLPanelSettingsSkyCloudTab : public LLPanelSettingsSky
public:
LLPanelSettingsSkyCloudTab();
- virtual BOOL postBuild() override;
- void setEnabled(BOOL enabled) override;
+ virtual BOOL postBuild() override;
+ void setEnabled(BOOL enabled) override;
protected:
virtual void refresh() override;
@@ -115,8 +115,8 @@ class LLPanelSettingsSkySunMoonTab : public LLPanelSettingsSky
public:
LLPanelSettingsSkySunMoonTab();
- virtual BOOL postBuild() override;
- virtual void setEnabled(BOOL enabled) override;
+ virtual BOOL postBuild() override;
+ virtual void setEnabled(BOOL enabled) override;
protected:
virtual void refresh() override;
diff --git a/indra/newview/llpaneleditwater.h b/indra/newview/llpaneleditwater.h
index 4b7ec903c9..f35a5ce2c2 100644
--- a/indra/newview/llpaneleditwater.h
+++ b/indra/newview/llpaneleditwater.h
@@ -55,8 +55,8 @@ protected:
LLSettingsWater::ptr_t mWaterSettings;
};
-// *RIDER* In this case this split is unecessary since there is only a single
-// tab page for water settings at this point. However more may be added in the
+// *RIDER* In this case this split is unecessary since there is only a single
+// tab page for water settings at this point. However more may be added in the
// future and I want to reinforce the pattern used for sky/atmosphere tabs.
class LLPanelSettingsWaterMainTab : public LLPanelSettingsWater
{
@@ -65,8 +65,8 @@ class LLPanelSettingsWaterMainTab : public LLPanelSettingsWater
public:
LLPanelSettingsWaterMainTab();
- virtual BOOL postBuild() override;
- virtual void setEnabled(BOOL enabled) override;
+ virtual BOOL postBuild() override;
+ virtual void setEnabled(BOOL enabled) override;
protected:
virtual void refresh() override;
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index c06d17410e..0c69e68639 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpaneleditwearable.cpp
* @brief UI panel for editing of a particular wearable item.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -216,7 +216,7 @@ LLEditWearableDictionary::LLEditWearableDictionary()
{
}
-//virtual
+//virtual
LLEditWearableDictionary::~LLEditWearableDictionary()
{
}
@@ -709,7 +709,7 @@ void LLPanelEditWearable::setWearablePanelVisibilityChangeCallback(LLPanel* body
}
}
-// virtual
+// virtual
BOOL LLPanelEditWearable::postBuild()
{
// buttons
@@ -828,7 +828,7 @@ BOOL LLPanelEditWearable::postBuild()
return TRUE;
}
-// virtual
+// virtual
// LLUICtrl
BOOL LLPanelEditWearable::isDirty() const
{
@@ -880,7 +880,7 @@ void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, BOOL disable_c
showWearable(mWearablePtr, TRUE, disable_camera_switch);
}
-//static
+//static
void LLPanelEditWearable::onBackButtonClicked(void* userdata)
{
LLPanelEditWearable* panel = (LLPanelEditWearable*)userdata;
@@ -890,7 +890,7 @@ void LLPanelEditWearable::onBackButtonClicked(void* userdata)
}
}
-//static
+//static
void LLPanelEditWearable::onRevertButtonClicked(void* userdata)
{
LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata;
@@ -1480,9 +1480,9 @@ void LLPanelEditWearable::getSortedParams(value_map_t &sorted_params, const std:
{
LLViewerVisualParam *param = (LLViewerVisualParam*) *iter;
- if (param->getID() == -1
+ if (param->getID() == -1
|| !param->isTweakable()
- || param->getEditGroup() != edit_group
+ || param->getEditGroup() != edit_group
|| !(param->getSex() & avatar_sex))
{
continue;
@@ -1596,7 +1596,7 @@ void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LL
{
LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
mPreviousAlphaTexture[te] = lto->getID();
-
+
LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( IMG_INVISIBLE );
gAgentAvatarp->setLocalTexture(te, image, FALSE, index);
gAgentAvatarp->wearableUpdated(getWearable()->getType());
diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h
index 5a40e945c2..56bc64cc7d 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpaneleditwearable.h
* @brief A LLPanel dedicated to the editing of wearables.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,133 +48,133 @@ class LLLineEditor;
class LLPanelEditWearable : public LLPanel
{
public:
- LLPanelEditWearable( );
- virtual ~LLPanelEditWearable();
+ LLPanelEditWearable( );
+ virtual ~LLPanelEditWearable();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ BOOL isDirty() const; // LLUICtrl
- /*virtual*/ void draw();
- void onClose();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL isDirty() const; // LLUICtrl
+ /*virtual*/ void draw();
+ void onClose();
- // changes camera angle to default for selected subpart
- void changeCamera(U8 subpart);
+ // changes camera angle to default for selected subpart
+ void changeCamera(U8 subpart);
- LLViewerWearable* getWearable() { return mWearablePtr; }
- void setWearable(LLViewerWearable *wearable, BOOL disable_camera_switch = FALSE);
+ LLViewerWearable* getWearable() { return mWearablePtr; }
+ void setWearable(LLViewerWearable *wearable, BOOL disable_camera_switch = FALSE);
- void saveChanges(bool force_save_as = false);
- void revertChanges();
+ void saveChanges(bool force_save_as = false);
+ void revertChanges();
- void showDefaultSubpart();
- void onTabExpandedCollapsed(const LLSD& param, U8 index);
+ void showDefaultSubpart();
+ void onTabExpandedCollapsed(const LLSD& param, U8 index);
- void updateScrollingPanelList();
+ void updateScrollingPanelList();
- static void onRevertButtonClicked(void* userdata);
- static void onBackButtonClicked(void* userdata);
- void onCommitSexChange();
- void onSaveAsButtonClicked();
- void saveAsCallback(const LLSD& notification, const LLSD& response);
+ static void onRevertButtonClicked(void* userdata);
+ static void onBackButtonClicked(void* userdata);
+ void onCommitSexChange();
+ void onSaveAsButtonClicked();
+ void saveAsCallback(const LLSD& notification, const LLSD& response);
- virtual void setVisible(BOOL visible);
+ virtual void setVisible(BOOL visible);
private:
- typedef std::map<F32, LLViewerVisualParam*> value_map_t;
-
- void showWearable(LLViewerWearable* wearable, BOOL show, BOOL disable_camera_switch = FALSE);
- void updateScrollingPanelUI();
- LLPanel* getPanel(LLWearableType::EType type);
- void getSortedParams(value_map_t &sorted_params, const std::string &edit_group);
- void buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab, LLJoint* jointp);
- // update bottom bar buttons ("Save", "Revert", etc)
- void updateVerbs();
-
- void onColorSwatchCommit(const LLUICtrl*);
- void onTexturePickerCommit(const LLUICtrl*);
- void updatePanelPickerControls(LLWearableType::EType type);
- void toggleTypeSpecificControls(LLWearableType::EType type);
- void updateTypeSpecificControls(LLWearableType::EType type);
-
- //alpha mask checkboxes
- void configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name);
- void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te);
- void updateAlphaCheckboxes();
- void initPreviousAlphaTextures();
- void initPreviousAlphaTextureEntry(LLAvatarAppearanceDefines::ETextureIndex te);
-
- // callback for HeightUnits parameter.
- bool changeHeightUnits(const LLSD& new_value);
-
- // updates current metric and replacement metric label text
- void updateMetricLayout(BOOL new_value);
-
- // updates avatar height label
- void updateAvatarHeightLabel();
-
- void onWearablePanelVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl);
-
- void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel);
-
- // *HACK Remove this when serverside texture baking is available on all regions.
- void incrementCofVersionLegacy();
-
- // the pointer to the wearable we're editing. NULL means we're not editing a wearable.
- LLViewerWearable *mWearablePtr;
- LLViewerInventoryItem* mWearableItem;
-
- // these are constant no matter what wearable we're editing
- LLButton *mBtnRevert;
- LLButton *mBtnBack;
- std::string mBackBtnLabel;
-
- LLTextBox *mPanelTitle;
- LLTextBox *mDescTitle;
- LLTextBox *mTxtAvatarHeight;
-
-
- // localized and parameterized strings that used to build avatar_height_label
- std::string mMeters;
- std::string mFeet;
- std::string mHeight;
- LLUIString mHeightValue;
- LLUIString mReplacementMetricUrl;
-
- // color for mHeight string
- LLUIColor mAvatarHeightLabelColor;
- // color for mHeightValue string
- LLUIColor mAvatarHeightValueLabelColor;
-
- // This text editor reference will change each time we edit a new wearable -
- // it will be grabbed from the currently visible panel
- LLLineEditor *mNameEditor;
-
- // The following panels will be shown/hidden based on what wearable we're editing
- // body parts
- LLPanel *mPanelShape;
- LLPanel *mPanelSkin;
- LLPanel *mPanelEyes;
- LLPanel *mPanelHair;
-
- //clothes
- LLPanel *mPanelShirt;
- LLPanel *mPanelPants;
- LLPanel *mPanelShoes;
- LLPanel *mPanelSocks;
- LLPanel *mPanelJacket;
- LLPanel *mPanelGloves;
- LLPanel *mPanelUndershirt;
- LLPanel *mPanelUnderpants;
- LLPanel *mPanelSkirt;
- LLPanel *mPanelAlpha;
- LLPanel *mPanelTattoo;
- LLPanel *mPanelUniversal;
- LLPanel *mPanelPhysics;
-
- typedef std::map<std::string, LLAvatarAppearanceDefines::ETextureIndex> string_texture_index_map_t;
- string_texture_index_map_t mAlphaCheckbox2Index;
-
- typedef std::map<LLAvatarAppearanceDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
- s32_uuid_map_t mPreviousAlphaTexture;
+ typedef std::map<F32, LLViewerVisualParam*> value_map_t;
+
+ void showWearable(LLViewerWearable* wearable, BOOL show, BOOL disable_camera_switch = FALSE);
+ void updateScrollingPanelUI();
+ LLPanel* getPanel(LLWearableType::EType type);
+ void getSortedParams(value_map_t &sorted_params, const std::string &edit_group);
+ void buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab, LLJoint* jointp);
+ // update bottom bar buttons ("Save", "Revert", etc)
+ void updateVerbs();
+
+ void onColorSwatchCommit(const LLUICtrl*);
+ void onTexturePickerCommit(const LLUICtrl*);
+ void updatePanelPickerControls(LLWearableType::EType type);
+ void toggleTypeSpecificControls(LLWearableType::EType type);
+ void updateTypeSpecificControls(LLWearableType::EType type);
+
+ //alpha mask checkboxes
+ void configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name);
+ void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te);
+ void updateAlphaCheckboxes();
+ void initPreviousAlphaTextures();
+ void initPreviousAlphaTextureEntry(LLAvatarAppearanceDefines::ETextureIndex te);
+
+ // callback for HeightUnits parameter.
+ bool changeHeightUnits(const LLSD& new_value);
+
+ // updates current metric and replacement metric label text
+ void updateMetricLayout(BOOL new_value);
+
+ // updates avatar height label
+ void updateAvatarHeightLabel();
+
+ void onWearablePanelVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl);
+
+ void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel);
+
+ // *HACK Remove this when serverside texture baking is available on all regions.
+ void incrementCofVersionLegacy();
+
+ // the pointer to the wearable we're editing. NULL means we're not editing a wearable.
+ LLViewerWearable *mWearablePtr;
+ LLViewerInventoryItem* mWearableItem;
+
+ // these are constant no matter what wearable we're editing
+ LLButton *mBtnRevert;
+ LLButton *mBtnBack;
+ std::string mBackBtnLabel;
+
+ LLTextBox *mPanelTitle;
+ LLTextBox *mDescTitle;
+ LLTextBox *mTxtAvatarHeight;
+
+
+ // localized and parameterized strings that used to build avatar_height_label
+ std::string mMeters;
+ std::string mFeet;
+ std::string mHeight;
+ LLUIString mHeightValue;
+ LLUIString mReplacementMetricUrl;
+
+ // color for mHeight string
+ LLUIColor mAvatarHeightLabelColor;
+ // color for mHeightValue string
+ LLUIColor mAvatarHeightValueLabelColor;
+
+ // This text editor reference will change each time we edit a new wearable -
+ // it will be grabbed from the currently visible panel
+ LLLineEditor *mNameEditor;
+
+ // The following panels will be shown/hidden based on what wearable we're editing
+ // body parts
+ LLPanel *mPanelShape;
+ LLPanel *mPanelSkin;
+ LLPanel *mPanelEyes;
+ LLPanel *mPanelHair;
+
+ //clothes
+ LLPanel *mPanelShirt;
+ LLPanel *mPanelPants;
+ LLPanel *mPanelShoes;
+ LLPanel *mPanelSocks;
+ LLPanel *mPanelJacket;
+ LLPanel *mPanelGloves;
+ LLPanel *mPanelUndershirt;
+ LLPanel *mPanelUnderpants;
+ LLPanel *mPanelSkirt;
+ LLPanel *mPanelAlpha;
+ LLPanel *mPanelTattoo;
+ LLPanel *mPanelUniversal;
+ LLPanel *mPanelPhysics;
+
+ typedef std::map<std::string, LLAvatarAppearanceDefines::ETextureIndex> string_texture_index_map_t;
+ string_texture_index_map_t mAlphaCheckbox2Index;
+
+ typedef std::map<LLAvatarAppearanceDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
+ s32_uuid_map_t mPreviousAlphaTexture;
};
#endif
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 2ad7a23278..5f9ff2c5ad 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelenvironment.cpp
* @brief LLPanelExperiences class implementation
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,7 +52,7 @@
#include "llinventorymodel.h"
//=========================================================================
-namespace
+namespace
{
const std::string FLOATER_DAY_CYCLE_EDIT("env_edit_extdaycycle");
const std::string STRING_REGION_ENV("str_region_env");
@@ -104,8 +104,8 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET(0x01 << 2);
const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES(0x01 << 3);
const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK(
- LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE |
- LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH |
+ LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE |
+ LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH |
LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET |
LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES);
@@ -141,7 +141,7 @@ const std::string alt_panels[] = {
static LLDefaultChildRegistry::Register<LLSettingsDropTarget> r("settings_drop_target");
//=========================================================================
-LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
+LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
mCurrentEnvironment(),
mDirtyFlag(0),
mEditorLastParcelId(INVALID_PARCEL_ID),
@@ -264,7 +264,7 @@ void LLPanelEnvironmentInfo::refresh()
getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setValue(daylength.value());
getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setValue(dayoffset.value());
-
+
udpateApparentTimeOfDay();
updateEditFloater(mCurrentEnvironment, canEdit());
@@ -1134,10 +1134,10 @@ LLSettingsDropTarget::LLSettingsDropTarget(const LLSettingsDropTarget::Params& p
{}
BOOL LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
{
BOOL handled = FALSE;
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index 38e3f09e34..41c89bdf5a 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelenvironment.h
* @brief LLPanelExperiences class definition
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llpanelexperiencelisteditor.cpp b/indra/newview/llpanelexperiencelisteditor.cpp
index 854a32621a..fd5678e446 100644
--- a/indra/newview/llpanelexperiencelisteditor.cpp
+++ b/indra/newview/llpanelexperiencelisteditor.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,225 +46,225 @@ static LLPanelInjector<LLPanelExperienceListEditor> t_panel_experience_list_edit
LLPanelExperienceListEditor::LLPanelExperienceListEditor()
- :mItems(NULL)
- ,mProfile(NULL)
- ,mRemove(NULL)
- ,mReadonly(false)
- ,mMaxExperienceIDs(0)
+ :mItems(NULL)
+ ,mProfile(NULL)
+ ,mRemove(NULL)
+ ,mReadonly(false)
+ ,mMaxExperienceIDs(0)
{
}
BOOL LLPanelExperienceListEditor::postBuild()
{
- mItems = getChild<LLNameListCtrl>("experience_list");
- mAdd = getChild<LLButton>("btn_add");
- mRemove = getChild<LLButton>("btn_remove");
- mProfile = getChild<LLButton>("btn_profile");
-
- childSetAction("btn_add", boost::bind(&LLPanelExperienceListEditor::onAdd, this));
- childSetAction("btn_remove", boost::bind(&LLPanelExperienceListEditor::onRemove, this));
- childSetAction("btn_profile", boost::bind(&LLPanelExperienceListEditor::onProfile, this));
-
- mItems->setCommitCallback(boost::bind(&LLPanelExperienceListEditor::checkButtonsEnabled, this));
-
- checkButtonsEnabled();
- return TRUE;
+ mItems = getChild<LLNameListCtrl>("experience_list");
+ mAdd = getChild<LLButton>("btn_add");
+ mRemove = getChild<LLButton>("btn_remove");
+ mProfile = getChild<LLButton>("btn_profile");
+
+ childSetAction("btn_add", boost::bind(&LLPanelExperienceListEditor::onAdd, this));
+ childSetAction("btn_remove", boost::bind(&LLPanelExperienceListEditor::onRemove, this));
+ childSetAction("btn_profile", boost::bind(&LLPanelExperienceListEditor::onProfile, this));
+
+ mItems->setCommitCallback(boost::bind(&LLPanelExperienceListEditor::checkButtonsEnabled, this));
+
+ checkButtonsEnabled();
+ return TRUE;
}
const uuid_list_t& LLPanelExperienceListEditor::getExperienceIds() const
{
- return mExperienceIds;
+ return mExperienceIds;
}
void LLPanelExperienceListEditor::addExperienceIds( const uuid_vec_t& experience_ids )
{
- // the commented out code in this function is handled by the callback and no longer necessary!
-
- //mExperienceIds.insert(experience_ids.begin(), experience_ids.end());
- //onItems();
- if(!mAddedCallback.empty())
- {
- for(uuid_vec_t::const_iterator it = experience_ids.begin(); it != experience_ids.end(); ++it)
- {
- mAddedCallback(*it);
- }
- }
+ // the commented out code in this function is handled by the callback and no longer necessary!
+
+ //mExperienceIds.insert(experience_ids.begin(), experience_ids.end());
+ //onItems();
+ if(!mAddedCallback.empty())
+ {
+ for(uuid_vec_t::const_iterator it = experience_ids.begin(); it != experience_ids.end(); ++it)
+ {
+ mAddedCallback(*it);
+ }
+ }
}
void LLPanelExperienceListEditor::setExperienceIds( const LLSD& experience_ids )
{
- mExperienceIds.clear();
- for (LLSD uuid : llsd::inArray(experience_ids))
- {
- // Using insert(range) doesn't work here because the conversion from
- // LLSD to LLUUID is ambiguous: have to specify asUUID() for each entry.
- mExperienceIds.insert(uuid.asUUID());
- }
- onItems();
+ mExperienceIds.clear();
+ for (LLSD uuid : llsd::inArray(experience_ids))
+ {
+ // Using insert(range) doesn't work here because the conversion from
+ // LLSD to LLUUID is ambiguous: have to specify asUUID() for each entry.
+ mExperienceIds.insert(uuid.asUUID());
+ }
+ onItems();
}
void LLPanelExperienceListEditor::addExperience( const LLUUID& id )
{
- mExperienceIds.insert(id);
- onItems();
+ mExperienceIds.insert(id);
+ onItems();
}
void LLPanelExperienceListEditor::onAdd()
{
- if(!mPicker.isDead())
- {
- mPicker.markDead();
- }
+ if(!mPicker.isDead())
+ {
+ mPicker.markDead();
+ }
- mKey.generateNewID();
+ mKey.generateNewID();
- LLFloaterExperiencePicker* picker=LLFloaterExperiencePicker::show(boost::bind(&LLPanelExperienceListEditor::addExperienceIds, this, _1), mKey, FALSE, TRUE, mFilters, mAdd);
- mPicker = picker->getDerivedHandle<LLFloaterExperiencePicker>();
+ LLFloaterExperiencePicker* picker=LLFloaterExperiencePicker::show(boost::bind(&LLPanelExperienceListEditor::addExperienceIds, this, _1), mKey, FALSE, TRUE, mFilters, mAdd);
+ mPicker = picker->getDerivedHandle<LLFloaterExperiencePicker>();
}
void LLPanelExperienceListEditor::onRemove()
{
- // the commented out code in this function is handled by the callback and no longer necessary!
-
- std::vector<LLScrollListItem*> items= mItems->getAllSelected();
- std::vector<LLScrollListItem*>::iterator it = items.begin();
- for(/**/; it != items.end(); ++it)
- {
- if((*it) != NULL)
- {
- //mExperienceIds.erase((*it)->getValue());
- mRemovedCallback((*it)->getValue());
- }
- }
- mItems->selectFirstItem();
- checkButtonsEnabled();
- //onItems();
+ // the commented out code in this function is handled by the callback and no longer necessary!
+
+ std::vector<LLScrollListItem*> items= mItems->getAllSelected();
+ std::vector<LLScrollListItem*>::iterator it = items.begin();
+ for(/**/; it != items.end(); ++it)
+ {
+ if((*it) != NULL)
+ {
+ //mExperienceIds.erase((*it)->getValue());
+ mRemovedCallback((*it)->getValue());
+ }
+ }
+ mItems->selectFirstItem();
+ checkButtonsEnabled();
+ //onItems();
}
void LLPanelExperienceListEditor::onProfile()
{
- LLScrollListItem* item = mItems->getFirstSelected();
- if(item)
- {
- LLFloaterReg::showInstance("experience_profile", item->getUUID(), true);
- }
+ LLScrollListItem* item = mItems->getFirstSelected();
+ if(item)
+ {
+ LLFloaterReg::showInstance("experience_profile", item->getUUID(), true);
+ }
}
void LLPanelExperienceListEditor::checkButtonsEnabled()
{
- mAdd->setEnabled(!mReadonly);
- int selected = mItems->getNumSelected();
-
- bool remove_enabled = !mReadonly && selected>0;
- if(remove_enabled && mSticky)
- {
- std::vector<LLScrollListItem*> items= mItems->getAllSelected();
- std::vector<LLScrollListItem*>::iterator it = items.begin();
- for(/**/; it != items.end() && remove_enabled; ++it)
- {
- if((*it) != NULL)
- {
- remove_enabled = !mSticky((*it)->getValue());
- }
- }
-
-
- }
- mRemove->setEnabled(remove_enabled);
- mProfile->setEnabled(selected==1);
+ mAdd->setEnabled(!mReadonly);
+ int selected = mItems->getNumSelected();
+
+ bool remove_enabled = !mReadonly && selected>0;
+ if(remove_enabled && mSticky)
+ {
+ std::vector<LLScrollListItem*> items= mItems->getAllSelected();
+ std::vector<LLScrollListItem*>::iterator it = items.begin();
+ for(/**/; it != items.end() && remove_enabled; ++it)
+ {
+ if((*it) != NULL)
+ {
+ remove_enabled = !mSticky((*it)->getValue());
+ }
+ }
+
+
+ }
+ mRemove->setEnabled(remove_enabled);
+ mProfile->setEnabled(selected==1);
}
void LLPanelExperienceListEditor::onItems()
{
- mItems->deleteAllItems();
-
- LLSD item;
- uuid_list_t::iterator it = mExperienceIds.begin();
- for(/**/; it != mExperienceIds.end(); ++it)
- {
- const LLUUID& experience = *it;
- item["id"]=experience;
- item["target"] = LLNameListCtrl::EXPERIENCE;
- LLSD& columns = item["columns"];
- columns[0]["column"] = "experience_name";
- columns[0]["value"] = getString("loading");
- mItems->addElement(item);
+ mItems->deleteAllItems();
+
+ LLSD item;
+ uuid_list_t::iterator it = mExperienceIds.begin();
+ for(/**/; it != mExperienceIds.end(); ++it)
+ {
+ const LLUUID& experience = *it;
+ item["id"]=experience;
+ item["target"] = LLNameListCtrl::EXPERIENCE;
+ LLSD& columns = item["columns"];
+ columns[0]["column"] = "experience_name";
+ columns[0]["value"] = getString("loading");
+ mItems->addElement(item);
LLExperienceCache::instance().get(experience, boost::bind(&LLPanelExperienceListEditor::experienceDetailsCallback,
- getDerivedHandle<LLPanelExperienceListEditor>(), _1));
- }
+ getDerivedHandle<LLPanelExperienceListEditor>(), _1));
+ }
- if(mItems->getItemCount() == 0)
- {
- mItems->setCommentText(getString("no_results"));
- }
+ if(mItems->getItemCount() == 0)
+ {
+ mItems->setCommentText(getString("no_results"));
+ }
- checkButtonsEnabled();
+ checkButtonsEnabled();
}
void LLPanelExperienceListEditor::experienceDetailsCallback( LLHandle<LLPanelExperienceListEditor> panel, const LLSD& experience )
{
- if(!panel.isDead())
- {
- panel.get()->onExperienceDetails(experience);
- }
+ if(!panel.isDead())
+ {
+ panel.get()->onExperienceDetails(experience);
+ }
}
void LLPanelExperienceListEditor::onExperienceDetails( const LLSD& experience )
{
- LLScrollListItem* item = mItems->getItem(experience[LLExperienceCache::EXPERIENCE_ID]);
- if(!item)
- return;
-
- std::string experience_name_string = experience[LLExperienceCache::NAME].asString();
- if (experience_name_string.empty())
- {
- experience_name_string = LLTrans::getString("ExperienceNameUntitled");
- }
-
- item->getColumn(0)->setValue(experience_name_string);
+ LLScrollListItem* item = mItems->getItem(experience[LLExperienceCache::EXPERIENCE_ID]);
+ if(!item)
+ return;
+
+ std::string experience_name_string = experience[LLExperienceCache::NAME].asString();
+ if (experience_name_string.empty())
+ {
+ experience_name_string = LLTrans::getString("ExperienceNameUntitled");
+ }
+
+ item->getColumn(0)->setValue(experience_name_string);
}
LLPanelExperienceListEditor::~LLPanelExperienceListEditor()
{
- if(!mPicker.isDead())
- {
- mPicker.get()->closeFloater();
- }
+ if(!mPicker.isDead())
+ {
+ mPicker.get()->closeFloater();
+ }
}
void LLPanelExperienceListEditor::loading()
{
- mItems->clear();
- mItems->setCommentText( getString("loading"));
+ mItems->clear();
+ mItems->setCommentText( getString("loading"));
}
void LLPanelExperienceListEditor::setReadonly( bool val )
{
- mReadonly = val;
- checkButtonsEnabled();
+ mReadonly = val;
+ checkButtonsEnabled();
}
void LLPanelExperienceListEditor::refreshExperienceCounter()
{
- if(mMaxExperienceIDs > 0)
- {
- LLStringUtil::format_map_t args;
- args["[EXPERIENCES]"] = llformat("%d", mItems->getItemCount());
- args["[MAXEXPERIENCES]"] = llformat("%d", mMaxExperienceIDs);
- getChild<LLTextBox>("text_count")->setText(LLTrans::getString("ExperiencesCounter", args));
- }
+ if(mMaxExperienceIDs > 0)
+ {
+ LLStringUtil::format_map_t args;
+ args["[EXPERIENCES]"] = llformat("%d", mItems->getItemCount());
+ args["[MAXEXPERIENCES]"] = llformat("%d", mMaxExperienceIDs);
+ getChild<LLTextBox>("text_count")->setText(LLTrans::getString("ExperiencesCounter", args));
+ }
}
boost::signals2::connection LLPanelExperienceListEditor::setAddedCallback( list_changed_signal_t::slot_type cb )
{
- return mAddedCallback.connect(cb);
+ return mAddedCallback.connect(cb);
}
boost::signals2::connection LLPanelExperienceListEditor::setRemovedCallback( list_changed_signal_t::slot_type cb )
{
- return mRemovedCallback.connect(cb);
+ return mRemovedCallback.connect(cb);
}
diff --git a/indra/newview/llpanelexperiencelisteditor.h b/indra/newview/llpanelexperiencelisteditor.h
index bc9867752d..d2e72e7f19 100644
--- a/indra/newview/llpanelexperiencelisteditor.h
+++ b/indra/newview/llpanelexperiencelisteditor.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,61 +40,61 @@ class LLPanelExperienceListEditor : public LLPanel
{
public:
- typedef boost::signals2::signal<void (const LLUUID&) > list_changed_signal_t;
- // filter function for experiences, return true if the experience should be hidden.
- typedef boost::function<bool (const LLSD&)> experience_function;
- typedef std::vector<experience_function> filter_list;
- typedef LLHandle<LLFloaterExperiencePicker> PickerHandle;
- LLPanelExperienceListEditor();
- ~LLPanelExperienceListEditor();
- BOOL postBuild();
+ typedef boost::signals2::signal<void (const LLUUID&) > list_changed_signal_t;
+ // filter function for experiences, return true if the experience should be hidden.
+ typedef boost::function<bool (const LLSD&)> experience_function;
+ typedef std::vector<experience_function> filter_list;
+ typedef LLHandle<LLFloaterExperiencePicker> PickerHandle;
+ LLPanelExperienceListEditor();
+ ~LLPanelExperienceListEditor();
+ BOOL postBuild();
- void loading();
+ void loading();
- const uuid_list_t& getExperienceIds()const;
- void setExperienceIds(const LLSD& experience_ids);
- void addExperienceIds(const uuid_vec_t& experience_ids);
+ const uuid_list_t& getExperienceIds()const;
+ void setExperienceIds(const LLSD& experience_ids);
+ void addExperienceIds(const uuid_vec_t& experience_ids);
- void addExperience(const LLUUID& id);
+ void addExperience(const LLUUID& id);
- boost::signals2::connection setAddedCallback(list_changed_signal_t::slot_type cb );
- boost::signals2::connection setRemovedCallback(list_changed_signal_t::slot_type cb );
+ boost::signals2::connection setAddedCallback(list_changed_signal_t::slot_type cb );
+ boost::signals2::connection setRemovedCallback(list_changed_signal_t::slot_type cb );
- bool getReadonly() const { return mReadonly; }
- void setReadonly(bool val);
+ bool getReadonly() const { return mReadonly; }
+ void setReadonly(bool val);
- void refreshExperienceCounter();
+ void refreshExperienceCounter();
- void addFilter(experience_function func){mFilters.push_back(func);}
- void setStickyFunction(experience_function func){mSticky = func;}
- U32 getMaxExperienceIDs() const { return mMaxExperienceIDs; }
- void setMaxExperienceIDs(U32 val) { mMaxExperienceIDs = val; }
+ void addFilter(experience_function func){mFilters.push_back(func);}
+ void setStickyFunction(experience_function func){mSticky = func;}
+ U32 getMaxExperienceIDs() const { return mMaxExperienceIDs; }
+ void setMaxExperienceIDs(U32 val) { mMaxExperienceIDs = val; }
private:
- void onItems();
- void onRemove();
- void onAdd();
- void onProfile();
-
- void checkButtonsEnabled();
- static void experienceDetailsCallback( LLHandle<LLPanelExperienceListEditor> panel, const LLSD& experience );
- void onExperienceDetails( const LLSD& experience );
- void processResponse( const LLSD& content );
- uuid_list_t mExperienceIds;
-
-
- LLNameListCtrl* mItems;
- filter_list mFilters;
- LLButton* mAdd;
- LLButton* mRemove;
- LLButton* mProfile;
- PickerHandle mPicker;
- list_changed_signal_t mAddedCallback;
- list_changed_signal_t mRemovedCallback;
- LLUUID mKey;
- bool mReadonly;
- experience_function mSticky;
- U32 mMaxExperienceIDs;
+ void onItems();
+ void onRemove();
+ void onAdd();
+ void onProfile();
+
+ void checkButtonsEnabled();
+ static void experienceDetailsCallback( LLHandle<LLPanelExperienceListEditor> panel, const LLSD& experience );
+ void onExperienceDetails( const LLSD& experience );
+ void processResponse( const LLSD& content );
+ uuid_list_t mExperienceIds;
+
+
+ LLNameListCtrl* mItems;
+ filter_list mFilters;
+ LLButton* mAdd;
+ LLButton* mRemove;
+ LLButton* mProfile;
+ PickerHandle mPicker;
+ list_changed_signal_t mAddedCallback;
+ list_changed_signal_t mRemovedCallback;
+ LLUUID mKey;
+ bool mReadonly;
+ experience_function mSticky;
+ U32 mMaxExperienceIDs;
};
diff --git a/indra/newview/llpanelexperiencelog.cpp b/indra/newview/llpanelexperiencelog.cpp
index e5c637938f..b4ca76c4b1 100644
--- a/indra/newview/llpanelexperiencelog.cpp
+++ b/indra/newview/llpanelexperiencelog.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelexperiencelog.cpp
* @brief llpanelexperiencelog
*
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,221 +47,221 @@ static LLPanelInjector<LLPanelExperienceLog> register_experiences_panel("experie
LLPanelExperienceLog::LLPanelExperienceLog( )
- : mEventList(NULL)
- , mPageSize(25)
- , mCurrentPage(0)
+ : mEventList(NULL)
+ , mPageSize(25)
+ , mCurrentPage(0)
{
- buildFromFile("panel_experience_log.xml");
+ buildFromFile("panel_experience_log.xml");
}
BOOL LLPanelExperienceLog::postBuild( void )
{
- LLExperienceLog* log = LLExperienceLog::getInstance();
- mEventList = getChild<LLScrollListCtrl>("experience_log_list");
- mEventList->setCommitCallback(boost::bind(&LLPanelExperienceLog::onSelectionChanged, this));
- mEventList->setDoubleClickCallback( boost::bind(&LLPanelExperienceLog::onProfileExperience, this));
+ LLExperienceLog* log = LLExperienceLog::getInstance();
+ mEventList = getChild<LLScrollListCtrl>("experience_log_list");
+ mEventList->setCommitCallback(boost::bind(&LLPanelExperienceLog::onSelectionChanged, this));
+ mEventList->setDoubleClickCallback( boost::bind(&LLPanelExperienceLog::onProfileExperience, this));
- getChild<LLButton>("btn_clear")->setCommitCallback(boost::bind(&LLExperienceLog::clear, log));
- getChild<LLButton>("btn_clear")->setCommitCallback(boost::bind(&LLPanelExperienceLog::refresh, this));
+ getChild<LLButton>("btn_clear")->setCommitCallback(boost::bind(&LLExperienceLog::clear, log));
+ getChild<LLButton>("btn_clear")->setCommitCallback(boost::bind(&LLPanelExperienceLog::refresh, this));
- getChild<LLButton>(BTN_PROFILE_XP)->setCommitCallback(boost::bind(&LLPanelExperienceLog::onProfileExperience, this));
- getChild<LLButton>(BTN_REPORT_XP )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onReportExperience, this));
- getChild<LLButton>("btn_notify" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onNotify, this));
- getChild<LLButton>("btn_next" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onNext, this));
- getChild<LLButton>("btn_prev" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onPrev, this));
+ getChild<LLButton>(BTN_PROFILE_XP)->setCommitCallback(boost::bind(&LLPanelExperienceLog::onProfileExperience, this));
+ getChild<LLButton>(BTN_REPORT_XP )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onReportExperience, this));
+ getChild<LLButton>("btn_notify" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onNotify, this));
+ getChild<LLButton>("btn_next" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onNext, this));
+ getChild<LLButton>("btn_prev" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onPrev, this));
- LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("notify_all");
- check->set(log->getNotifyNewEvent());
- check->setCommitCallback(boost::bind(&LLPanelExperienceLog::notifyChanged, this));
+ LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("notify_all");
+ check->set(log->getNotifyNewEvent());
+ check->setCommitCallback(boost::bind(&LLPanelExperienceLog::notifyChanged, this));
- LLSpinCtrl* spin = getChild<LLSpinCtrl>("logsizespinner");
- spin->set(log->getMaxDays());
- spin->setCommitCallback(boost::bind(&LLPanelExperienceLog::logSizeChanged, this));
+ LLSpinCtrl* spin = getChild<LLSpinCtrl>("logsizespinner");
+ spin->set(log->getMaxDays());
+ spin->setCommitCallback(boost::bind(&LLPanelExperienceLog::logSizeChanged, this));
- mPageSize = log->getPageSize();
- refresh();
- mNewEvent = LLExperienceLog::instance().addUpdateSignal(boost::bind(&LLPanelExperienceLog::refresh, this));
- return TRUE;
+ mPageSize = log->getPageSize();
+ refresh();
+ mNewEvent = LLExperienceLog::instance().addUpdateSignal(boost::bind(&LLPanelExperienceLog::refresh, this));
+ return TRUE;
}
LLPanelExperienceLog* LLPanelExperienceLog::create()
{
- return new LLPanelExperienceLog();
+ return new LLPanelExperienceLog();
}
void LLPanelExperienceLog::refresh()
{
- S32 selected = mEventList->getFirstSelectedIndex();
- mEventList->deleteAllItems();
- const LLSD events = LLExperienceLog::instance().getEvents();
-
- if(events.size() == 0)
- {
- mEventList->setCommentText(getString("no_events"));
- return;
- }
-
- setAllChildrenEnabled(FALSE);
-
- LLSD item;
- bool waiting = false;
- LLUUID waiting_id;
-
- int itemsToSkip = mPageSize*mCurrentPage;
- int items = 0;
- bool moreItems = false;
- LLSD events_to_save = events;
- if (events.isMap() && events.size() != 0)
- {
- LLSD::map_const_iterator day = events.endMap();
- do
- {
- --day;
- const LLSD& dayArray = day->second;
-
- std::string date = day->first;
- if(!LLExperienceLog::instance().isNotExpired(date))
- {
- events_to_save.erase(day->first);
- continue;
- }
- int size = dayArray.size();
- if(itemsToSkip > size)
- {
- itemsToSkip -= size;
- continue;
- }
- if(items >= mPageSize && size > 0)
- {
- moreItems = true;
- break;
- }
- for(int i = dayArray.size() - itemsToSkip - 1; i >= 0; i--)
- {
- if(items >= mPageSize)
- {
- moreItems = true;
- break;
- }
- const LLSD event = dayArray[i];
- LLUUID id = event[LLExperienceCache::EXPERIENCE_ID].asUUID();
+ S32 selected = mEventList->getFirstSelectedIndex();
+ mEventList->deleteAllItems();
+ const LLSD events = LLExperienceLog::instance().getEvents();
+
+ if(events.size() == 0)
+ {
+ mEventList->setCommentText(getString("no_events"));
+ return;
+ }
+
+ setAllChildrenEnabled(FALSE);
+
+ LLSD item;
+ bool waiting = false;
+ LLUUID waiting_id;
+
+ int itemsToSkip = mPageSize*mCurrentPage;
+ int items = 0;
+ bool moreItems = false;
+ LLSD events_to_save = events;
+ if (events.isMap() && events.size() != 0)
+ {
+ LLSD::map_const_iterator day = events.endMap();
+ do
+ {
+ --day;
+ const LLSD& dayArray = day->second;
+
+ std::string date = day->first;
+ if(!LLExperienceLog::instance().isNotExpired(date))
+ {
+ events_to_save.erase(day->first);
+ continue;
+ }
+ int size = dayArray.size();
+ if(itemsToSkip > size)
+ {
+ itemsToSkip -= size;
+ continue;
+ }
+ if(items >= mPageSize && size > 0)
+ {
+ moreItems = true;
+ break;
+ }
+ for(int i = dayArray.size() - itemsToSkip - 1; i >= 0; i--)
+ {
+ if(items >= mPageSize)
+ {
+ moreItems = true;
+ break;
+ }
+ const LLSD event = dayArray[i];
+ LLUUID id = event[LLExperienceCache::EXPERIENCE_ID].asUUID();
const LLSD& experience = LLExperienceCache::instance().get(id);
- if(experience.isUndefined()){
- waiting = true;
- waiting_id = id;
- }
- if(!waiting)
- {
- item["id"] = event;
-
- LLSD& columns = item["columns"];
- columns[0]["column"] = "time";
- columns[0]["value"] = day->first+event["Time"].asString();
- columns[1]["column"] = "event";
- columns[1]["value"] = LLExperienceLog::getPermissionString(event, "ExperiencePermissionShort");
- columns[2]["column"] = "experience_name";
- columns[2]["value"] = experience[LLExperienceCache::NAME].asString();
- columns[3]["column"] = "object_name";
- columns[3]["value"] = event["ObjectName"].asString();
- mEventList->addElement(item);
- }
- ++items;
- }
- } while (day != events.beginMap());
- }
- LLExperienceLog::getInstance()->setEventsToSave(events_to_save);
- if(waiting)
- {
- mEventList->deleteAllItems();
- mEventList->setCommentText(getString("loading"));
+ if(experience.isUndefined()){
+ waiting = true;
+ waiting_id = id;
+ }
+ if(!waiting)
+ {
+ item["id"] = event;
+
+ LLSD& columns = item["columns"];
+ columns[0]["column"] = "time";
+ columns[0]["value"] = day->first+event["Time"].asString();
+ columns[1]["column"] = "event";
+ columns[1]["value"] = LLExperienceLog::getPermissionString(event, "ExperiencePermissionShort");
+ columns[2]["column"] = "experience_name";
+ columns[2]["value"] = experience[LLExperienceCache::NAME].asString();
+ columns[3]["column"] = "object_name";
+ columns[3]["value"] = event["ObjectName"].asString();
+ mEventList->addElement(item);
+ }
+ ++items;
+ }
+ } while (day != events.beginMap());
+ }
+ LLExperienceLog::getInstance()->setEventsToSave(events_to_save);
+ if(waiting)
+ {
+ mEventList->deleteAllItems();
+ mEventList->setCommentText(getString("loading"));
LLExperienceCache::instance().get(waiting_id, boost::bind(&LLPanelExperienceLog::refresh, this));
- }
- else
- {
- setAllChildrenEnabled(TRUE);
-
- mEventList->setEnabled(TRUE);
- getChild<LLButton>("btn_next")->setEnabled(moreItems);
- getChild<LLButton>("btn_prev")->setEnabled(mCurrentPage>0);
- getChild<LLButton>("btn_clear")->setEnabled(mEventList->getItemCount()>0);
- if(selected<0)
- {
- selected = 0;
- }
- mEventList->selectNthItem(selected);
- onSelectionChanged();
- }
+ }
+ else
+ {
+ setAllChildrenEnabled(TRUE);
+
+ mEventList->setEnabled(TRUE);
+ getChild<LLButton>("btn_next")->setEnabled(moreItems);
+ getChild<LLButton>("btn_prev")->setEnabled(mCurrentPage>0);
+ getChild<LLButton>("btn_clear")->setEnabled(mEventList->getItemCount()>0);
+ if(selected<0)
+ {
+ selected = 0;
+ }
+ mEventList->selectNthItem(selected);
+ onSelectionChanged();
+ }
}
void LLPanelExperienceLog::onProfileExperience()
{
- LLSD event = getSelectedEvent();
- if(event.isDefined())
- {
- LLFloaterReg::showInstance("experience_profile", event[LLExperienceCache::EXPERIENCE_ID].asUUID(), true);
- }
+ LLSD event = getSelectedEvent();
+ if(event.isDefined())
+ {
+ LLFloaterReg::showInstance("experience_profile", event[LLExperienceCache::EXPERIENCE_ID].asUUID(), true);
+ }
}
void LLPanelExperienceLog::onReportExperience()
{
- LLSD event = getSelectedEvent();
- if(event.isDefined())
- {
- LLFloaterReporter::showFromExperience(event[LLExperienceCache::EXPERIENCE_ID].asUUID());
- }
+ LLSD event = getSelectedEvent();
+ if(event.isDefined())
+ {
+ LLFloaterReporter::showFromExperience(event[LLExperienceCache::EXPERIENCE_ID].asUUID());
+ }
}
void LLPanelExperienceLog::onNotify()
{
- LLSD event = getSelectedEvent();
- if(event.isDefined())
- {
- LLExperienceLog::instance().notify(event);
- }
+ LLSD event = getSelectedEvent();
+ if(event.isDefined())
+ {
+ LLExperienceLog::instance().notify(event);
+ }
}
void LLPanelExperienceLog::onNext()
{
- mCurrentPage++;
- refresh();
+ mCurrentPage++;
+ refresh();
}
void LLPanelExperienceLog::onPrev()
{
- if(mCurrentPage>0)
- {
- mCurrentPage--;
- refresh();
- }
+ if(mCurrentPage>0)
+ {
+ mCurrentPage--;
+ refresh();
+ }
}
void LLPanelExperienceLog::notifyChanged()
{
- LLExperienceLog::instance().setNotifyNewEvent(getChild<LLCheckBoxCtrl>("notify_all")->get());
+ LLExperienceLog::instance().setNotifyNewEvent(getChild<LLCheckBoxCtrl>("notify_all")->get());
}
void LLPanelExperienceLog::logSizeChanged()
{
- int value = (int)(getChild<LLSpinCtrl>("logsizespinner")->get());
- LLExperienceLog::instance().setMaxDays(value);
- refresh();
+ int value = (int)(getChild<LLSpinCtrl>("logsizespinner")->get());
+ LLExperienceLog::instance().setMaxDays(value);
+ refresh();
}
void LLPanelExperienceLog::onSelectionChanged()
{
- bool enabled = (1 == mEventList->getNumSelected());
- getChild<LLButton>(BTN_REPORT_XP)->setEnabled(enabled);
- getChild<LLButton>(BTN_PROFILE_XP)->setEnabled(enabled);
- getChild<LLButton>("btn_notify")->setEnabled(enabled);
+ bool enabled = (1 == mEventList->getNumSelected());
+ getChild<LLButton>(BTN_REPORT_XP)->setEnabled(enabled);
+ getChild<LLButton>(BTN_PROFILE_XP)->setEnabled(enabled);
+ getChild<LLButton>("btn_notify")->setEnabled(enabled);
}
LLSD LLPanelExperienceLog::getSelectedEvent()
{
- LLScrollListItem* item = mEventList->getFirstSelected();
- if(item)
- {
- return item->getValue();
- }
- return LLSD();
+ LLScrollListItem* item = mEventList->getFirstSelected();
+ if(item)
+ {
+ return item->getValue();
+ }
+ return LLSD();
}
diff --git a/indra/newview/llpanelexperiencelog.h b/indra/newview/llpanelexperiencelog.h
index 4135d9cac9..f99e424d81 100644
--- a/indra/newview/llpanelexperiencelog.h
+++ b/indra/newview/llpanelexperiencelog.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelexperiencelog.h
* @brief llpanelexperiencelog and related class definitions
*
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,33 +32,33 @@
class LLScrollListCtrl;
class LLPanelExperienceLog
- : public LLPanel
+ : public LLPanel
{
public:
- LLPanelExperienceLog();
+ LLPanelExperienceLog();
- static LLPanelExperienceLog* create();
+ static LLPanelExperienceLog* create();
- /*virtual*/ BOOL postBuild(void);
+ /*virtual*/ BOOL postBuild(void);
- void refresh();
+ void refresh();
protected:
- void logSizeChanged();
- void notifyChanged();
- void onNext();
- void onNotify();
- void onPrev();
- void onProfileExperience();
- void onReportExperience();
- void onSelectionChanged();
+ void logSizeChanged();
+ void notifyChanged();
+ void onNext();
+ void onNotify();
+ void onPrev();
+ void onProfileExperience();
+ void onReportExperience();
+ void onSelectionChanged();
- LLSD getSelectedEvent();
+ LLSD getSelectedEvent();
private:
- LLScrollListCtrl* mEventList;
- U32 mPageSize;
- U32 mCurrentPage;
- boost::signals2::scoped_connection mNewEvent;
+ LLScrollListCtrl* mEventList;
+ U32 mPageSize;
+ U32 mCurrentPage;
+ boost::signals2::scoped_connection mNewEvent;
};
#endif // LL_LLPANELEXPERIENCELOG_H
diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp
index 6dfdbaf63f..396f1341a2 100644
--- a/indra/newview/llpanelexperiencepicker.cpp
+++ b/indra/newview/llpanelexperiencepicker.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelexperiencepicker.cpp
* @brief Implementation of llpanelexperiencepicker
* @author dolphin@lindenlab.com
@@ -44,26 +44,26 @@
#include "llregex.h"
#include "lltrans.h"
-#define BTN_FIND "find"
-#define BTN_OK "ok_btn"
-#define BTN_CANCEL "cancel_btn"
-#define BTN_PROFILE "profile_btn"
-#define BTN_LEFT "left_btn"
-#define BTN_RIGHT "right_btn"
-#define TEXT_EDIT "edit"
-#define TEXT_MATURITY "maturity"
-#define LIST_RESULTS "search_results"
-#define PANEL_SEARCH "search_panel"
+#define BTN_FIND "find"
+#define BTN_OK "ok_btn"
+#define BTN_CANCEL "cancel_btn"
+#define BTN_PROFILE "profile_btn"
+#define BTN_LEFT "left_btn"
+#define BTN_RIGHT "right_btn"
+#define TEXT_EDIT "edit"
+#define TEXT_MATURITY "maturity"
+#define LIST_RESULTS "search_results"
+#define PANEL_SEARCH "search_panel"
const static std::string columnSpace = " ";
static LLPanelInjector<LLPanelExperiencePicker> t_panel_status("llpanelexperiencepicker");
LLPanelExperiencePicker::LLPanelExperiencePicker()
- :LLPanel()
+ :LLPanel()
{
- buildFromFile("panel_experience_search.xml");
- setDefaultFilters();
+ buildFromFile("panel_experience_search.xml");
+ setDefaultFilters();
}
LLPanelExperiencePicker::~LLPanelExperiencePicker()
@@ -72,115 +72,115 @@ LLPanelExperiencePicker::~LLPanelExperiencePicker()
BOOL LLPanelExperiencePicker::postBuild()
{
- getChild<LLLineEditor>(TEXT_EDIT)->setKeystrokeCallback( boost::bind(&LLPanelExperiencePicker::editKeystroke, this, _1, _2),NULL);
-
- childSetAction(BTN_FIND, boost::bind(&LLPanelExperiencePicker::onBtnFind, this));
- getChildView(BTN_FIND)->setEnabled(TRUE);
-
- LLScrollListCtrl* searchresults = getChild<LLScrollListCtrl>(LIST_RESULTS);
- searchresults->setDoubleClickCallback( boost::bind(&LLPanelExperiencePicker::onBtnSelect, this));
- searchresults->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onList, this));
- getChildView(LIST_RESULTS)->setEnabled(FALSE);
- getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("no_results"));
-
- childSetAction(BTN_OK, boost::bind(&LLPanelExperiencePicker::onBtnSelect, this));
- getChildView(BTN_OK)->setEnabled(FALSE);
- childSetAction(BTN_CANCEL, boost::bind(&LLPanelExperiencePicker::onBtnClose, this));
- childSetAction(BTN_PROFILE, boost::bind(&LLPanelExperiencePicker::onBtnProfile, this));
- getChildView(BTN_PROFILE)->setEnabled(FALSE);
-
- getChild<LLComboBox>(TEXT_MATURITY)->setCurrentByIndex(gSavedPerAccountSettings.getU32("ExperienceSearchMaturity"));
- getChild<LLComboBox>(TEXT_MATURITY)->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onMaturity, this));
- getChild<LLUICtrl>(TEXT_EDIT)->setFocus(TRUE);
-
- childSetAction(BTN_LEFT, boost::bind(&LLPanelExperiencePicker::onPage, this, -1));
- childSetAction(BTN_RIGHT, boost::bind(&LLPanelExperiencePicker::onPage, this, 1));
-
- LLPanel* search_panel = getChild<LLPanel>(PANEL_SEARCH);
- if (search_panel)
- {
- // Start searching when Return is pressed in the line editor.
- search_panel->setDefaultBtn(BTN_FIND);
- }
- return TRUE;
+ getChild<LLLineEditor>(TEXT_EDIT)->setKeystrokeCallback( boost::bind(&LLPanelExperiencePicker::editKeystroke, this, _1, _2),NULL);
+
+ childSetAction(BTN_FIND, boost::bind(&LLPanelExperiencePicker::onBtnFind, this));
+ getChildView(BTN_FIND)->setEnabled(TRUE);
+
+ LLScrollListCtrl* searchresults = getChild<LLScrollListCtrl>(LIST_RESULTS);
+ searchresults->setDoubleClickCallback( boost::bind(&LLPanelExperiencePicker::onBtnSelect, this));
+ searchresults->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onList, this));
+ getChildView(LIST_RESULTS)->setEnabled(FALSE);
+ getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("no_results"));
+
+ childSetAction(BTN_OK, boost::bind(&LLPanelExperiencePicker::onBtnSelect, this));
+ getChildView(BTN_OK)->setEnabled(FALSE);
+ childSetAction(BTN_CANCEL, boost::bind(&LLPanelExperiencePicker::onBtnClose, this));
+ childSetAction(BTN_PROFILE, boost::bind(&LLPanelExperiencePicker::onBtnProfile, this));
+ getChildView(BTN_PROFILE)->setEnabled(FALSE);
+
+ getChild<LLComboBox>(TEXT_MATURITY)->setCurrentByIndex(gSavedPerAccountSettings.getU32("ExperienceSearchMaturity"));
+ getChild<LLComboBox>(TEXT_MATURITY)->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onMaturity, this));
+ getChild<LLUICtrl>(TEXT_EDIT)->setFocus(TRUE);
+
+ childSetAction(BTN_LEFT, boost::bind(&LLPanelExperiencePicker::onPage, this, -1));
+ childSetAction(BTN_RIGHT, boost::bind(&LLPanelExperiencePicker::onPage, this, 1));
+
+ LLPanel* search_panel = getChild<LLPanel>(PANEL_SEARCH);
+ if (search_panel)
+ {
+ // Start searching when Return is pressed in the line editor.
+ search_panel->setDefaultBtn(BTN_FIND);
+ }
+ return TRUE;
}
void LLPanelExperiencePicker::editKeystroke( class LLLineEditor* caller, void* user_data )
{
- getChildView(BTN_FIND)->setEnabled(true);
+ getChildView(BTN_FIND)->setEnabled(true);
}
void LLPanelExperiencePicker::onBtnFind()
{
- mCurrentPage=1;
- boost::cmatch what;
- std::string text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
- const boost::regex expression("secondlife:///app/experience/[\\da-f-]+/profile");
- if (ll_regex_match(text.c_str(), what, expression))
- {
- LLURI uri(text);
- LLSD path_array = uri.pathArray();
- if (path_array.size() == 4)
- {
- std::string exp_id = path_array.get(2).asString();
- LLUUID experience_id(exp_id);
- if (!experience_id.isNull())
- {
- const LLSD& experience_details = LLExperienceCache::instance().get(experience_id);
- if(!experience_details.isUndefined())
- {
- std::string experience_name_string = experience_details[LLExperienceCache::NAME].asString();
- if(!experience_name_string.empty())
- {
- getChild<LLUICtrl>(TEXT_EDIT)->setValue(experience_name_string);
- }
- }
- else
- {
- getChild<LLScrollListCtrl>(LIST_RESULTS)->deleteAllItems();
- getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("searching"));
-
- getChildView(BTN_OK)->setEnabled(FALSE);
- getChildView(BTN_PROFILE)->setEnabled(FALSE);
-
- getChildView(BTN_RIGHT)->setEnabled(FALSE);
- getChildView(BTN_LEFT)->setEnabled(FALSE);
+ mCurrentPage=1;
+ boost::cmatch what;
+ std::string text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
+ const boost::regex expression("secondlife:///app/experience/[\\da-f-]+/profile");
+ if (ll_regex_match(text.c_str(), what, expression))
+ {
+ LLURI uri(text);
+ LLSD path_array = uri.pathArray();
+ if (path_array.size() == 4)
+ {
+ std::string exp_id = path_array.get(2).asString();
+ LLUUID experience_id(exp_id);
+ if (!experience_id.isNull())
+ {
+ const LLSD& experience_details = LLExperienceCache::instance().get(experience_id);
+ if(!experience_details.isUndefined())
+ {
+ std::string experience_name_string = experience_details[LLExperienceCache::NAME].asString();
+ if(!experience_name_string.empty())
+ {
+ getChild<LLUICtrl>(TEXT_EDIT)->setValue(experience_name_string);
+ }
+ }
+ else
+ {
+ getChild<LLScrollListCtrl>(LIST_RESULTS)->deleteAllItems();
+ getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("searching"));
+
+ getChildView(BTN_OK)->setEnabled(FALSE);
+ getChildView(BTN_PROFILE)->setEnabled(FALSE);
+
+ getChildView(BTN_RIGHT)->setEnabled(FALSE);
+ getChildView(BTN_LEFT)->setEnabled(FALSE);
LLExperienceCache::instance().get(experience_id, boost::bind(&LLPanelExperiencePicker::onBtnFind, this));
- return;
- }
- }
- }
- }
+ return;
+ }
+ }
+ }
+ }
- find();
+ find();
}
void LLPanelExperiencePicker::onList()
{
- bool enabled = isSelectButtonEnabled();
- getChildView(BTN_OK)->setEnabled(enabled);
+ bool enabled = isSelectButtonEnabled();
+ getChildView(BTN_OK)->setEnabled(enabled);
- enabled = enabled && getChild<LLScrollListCtrl>(LIST_RESULTS)->getNumSelected() == 1;
- getChildView(BTN_PROFILE)->setEnabled(enabled);
+ enabled = enabled && getChild<LLScrollListCtrl>(LIST_RESULTS)->getNumSelected() == 1;
+ getChildView(BTN_PROFILE)->setEnabled(enabled);
}
void LLPanelExperiencePicker::find()
{
- std::string text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
- mQueryID.generate();
+ std::string text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
+ mQueryID.generate();
LLExperienceCache::instance().findExperienceByName(text, mCurrentPage,
boost::bind(&LLPanelExperiencePicker::findResults, getDerivedHandle<LLPanelExperiencePicker>(), mQueryID, _1));
getChild<LLScrollListCtrl>(LIST_RESULTS)->deleteAllItems();
- getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("searching"));
-
- getChildView(BTN_OK)->setEnabled(FALSE);
- getChildView(BTN_PROFILE)->setEnabled(FALSE);
+ getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("searching"));
+
+ getChildView(BTN_OK)->setEnabled(FALSE);
+ getChildView(BTN_PROFILE)->setEnabled(FALSE);
- getChildView(BTN_RIGHT)->setEnabled(FALSE);
- getChildView(BTN_LEFT)->setEnabled(FALSE);
+ getChildView(BTN_RIGHT)->setEnabled(FALSE);
+ getChildView(BTN_LEFT)->setEnabled(FALSE);
}
/*static*/
@@ -198,252 +198,252 @@ void LLPanelExperiencePicker::findResults(LLHandle<LLPanelExperiencePicker> hpar
bool LLPanelExperiencePicker::isSelectButtonEnabled()
{
- LLScrollListCtrl* list=getChild<LLScrollListCtrl>(LIST_RESULTS);
- return list->getFirstSelectedIndex() >=0;
+ LLScrollListCtrl* list=getChild<LLScrollListCtrl>(LIST_RESULTS);
+ return list->getFirstSelectedIndex() >=0;
}
void LLPanelExperiencePicker::getSelectedExperienceIds( const LLScrollListCtrl* results, uuid_vec_t &experience_ids )
{
- std::vector<LLScrollListItem*> items = results->getAllSelected();
- for(std::vector<LLScrollListItem*>::iterator it = items.begin(); it != items.end(); ++it)
- {
- LLScrollListItem* item = *it;
- if (item->getUUID().notNull())
- {
- experience_ids.push_back(item->getUUID());
- }
- }
+ std::vector<LLScrollListItem*> items = results->getAllSelected();
+ for(std::vector<LLScrollListItem*>::iterator it = items.begin(); it != items.end(); ++it)
+ {
+ LLScrollListItem* item = *it;
+ if (item->getUUID().notNull())
+ {
+ experience_ids.push_back(item->getUUID());
+ }
+ }
}
void LLPanelExperiencePicker::setAllowMultiple( bool allow_multiple )
{
- getChild<LLScrollListCtrl>(LIST_RESULTS)->setAllowMultipleSelection(allow_multiple);
+ getChild<LLScrollListCtrl>(LIST_RESULTS)->setAllowMultipleSelection(allow_multiple);
}
void name_callback(const LLHandle<LLPanelExperiencePicker>& floater, const LLUUID& experience_id, const LLUUID& agent_id, const LLAvatarName& av_name)
{
- if(floater.isDead())
- return;
- LLPanelExperiencePicker* picker = floater.get();
- LLScrollListCtrl* search_results = picker->getChild<LLScrollListCtrl>(LIST_RESULTS);
+ if(floater.isDead())
+ return;
+ LLPanelExperiencePicker* picker = floater.get();
+ LLScrollListCtrl* search_results = picker->getChild<LLScrollListCtrl>(LIST_RESULTS);
- LLScrollListItem* item = search_results->getItem(experience_id);
- if(!item)
- return;
+ LLScrollListItem* item = search_results->getItem(experience_id);
+ if(!item)
+ return;
- item->getColumn(2)->setValue(columnSpace+av_name.getDisplayName());
+ item->getColumn(2)->setValue(columnSpace+av_name.getDisplayName());
}
void LLPanelExperiencePicker::processResponse( const LLUUID& query_id, const LLSD& content )
{
- if(query_id != mQueryID)
- {
- return;
- }
+ if(query_id != mQueryID)
+ {
+ return;
+ }
- mResponse = content;
+ mResponse = content;
- getChildView(BTN_RIGHT)->setEnabled(content.has("next_page_url"));
- getChildView(BTN_LEFT)->setEnabled(content.has("previous_page_url"));
+ getChildView(BTN_RIGHT)->setEnabled(content.has("next_page_url"));
+ getChildView(BTN_LEFT)->setEnabled(content.has("previous_page_url"));
- filterContent();
+ filterContent();
}
void LLPanelExperiencePicker::onBtnSelect()
{
- if(!isSelectButtonEnabled())
- {
- return;
- }
-
- if(mSelectionCallback)
- {
- const LLScrollListCtrl* results = getChild<LLScrollListCtrl>(LIST_RESULTS);
- uuid_vec_t experience_ids;
-
- getSelectedExperienceIds(results, experience_ids);
- mSelectionCallback(experience_ids);
- getChild<LLScrollListCtrl>(LIST_RESULTS)->deselectAllItems(TRUE);
- if(mCloseOnSelect)
- {
- mCloseOnSelect = FALSE;
- onBtnClose();
- }
- }
- else
- {
- onBtnProfile();
- }
+ if(!isSelectButtonEnabled())
+ {
+ return;
+ }
+
+ if(mSelectionCallback)
+ {
+ const LLScrollListCtrl* results = getChild<LLScrollListCtrl>(LIST_RESULTS);
+ uuid_vec_t experience_ids;
+
+ getSelectedExperienceIds(results, experience_ids);
+ mSelectionCallback(experience_ids);
+ getChild<LLScrollListCtrl>(LIST_RESULTS)->deselectAllItems(TRUE);
+ if(mCloseOnSelect)
+ {
+ mCloseOnSelect = FALSE;
+ onBtnClose();
+ }
+ }
+ else
+ {
+ onBtnProfile();
+ }
}
void LLPanelExperiencePicker::onBtnClose()
{
- LLFloater* floater = getParentByType<LLFloater>();
- if (floater)
- {
- floater->closeFloater();
- }
+ LLFloater* floater = getParentByType<LLFloater>();
+ if (floater)
+ {
+ floater->closeFloater();
+ }
}
void LLPanelExperiencePicker::onBtnProfile()
{
- LLScrollListItem* item = getChild<LLScrollListCtrl>(LIST_RESULTS)->getFirstSelected();
- if(item)
- {
- LLFloaterReg::showInstance("experience_profile", item->getUUID(), true);
- }
+ LLScrollListItem* item = getChild<LLScrollListCtrl>(LIST_RESULTS)->getFirstSelected();
+ if(item)
+ {
+ LLFloaterReg::showInstance("experience_profile", item->getUUID(), true);
+ }
}
std::string LLPanelExperiencePicker::getMaturityString(int maturity)
{
- if(maturity <= SIM_ACCESS_PG)
- {
- return getString("maturity_icon_general");
- }
- else if(maturity <= SIM_ACCESS_MATURE)
- {
- return getString("maturity_icon_moderate");
- }
- return getString("maturity_icon_adult");
+ if(maturity <= SIM_ACCESS_PG)
+ {
+ return getString("maturity_icon_general");
+ }
+ else if(maturity <= SIM_ACCESS_MATURE)
+ {
+ return getString("maturity_icon_moderate");
+ }
+ return getString("maturity_icon_adult");
}
void LLPanelExperiencePicker::filterContent()
{
- LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>(LIST_RESULTS);
-
- const LLSD& experiences=mResponse["experience_keys"];
-
- search_results->deleteAllItems();
-
- LLSD item;
- LLSD::array_const_iterator it = experiences.beginArray();
- for ( ; it != experiences.endArray(); ++it)
- {
- const LLSD& experience = *it;
-
- if(isExperienceHidden(experience))
- continue;
-
- std::string experience_name_string = experience[LLExperienceCache::NAME].asString();
- if (experience_name_string.empty())
- {
- experience_name_string = LLTrans::getString("ExperienceNameUntitled");
- }
-
- item["id"]=experience[LLExperienceCache::EXPERIENCE_ID];
- LLSD& columns = item["columns"];
- columns[0]["column"] = "maturity";
- columns[0]["value"] = getMaturityString(experience[LLExperienceCache::MATURITY].asInteger());
- columns[0]["type"]="icon";
- columns[0]["halign"]="right";
- columns[1]["column"] = "experience_name";
- columns[1]["value"] = columnSpace+experience_name_string;
- columns[2]["column"] = "owner";
- columns[2]["value"] = columnSpace+getString("loading");
- search_results->addElement(item);
- LLAvatarNameCache::get(experience[LLExperienceCache::AGENT_ID], boost::bind(name_callback, getDerivedHandle<LLPanelExperiencePicker>(), experience[LLExperienceCache::EXPERIENCE_ID], _1, _2));
- }
-
- if (search_results->isEmpty())
- {
- LLStringUtil::format_map_t map;
- std::string search_text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
- map["[TEXT]"] = search_text;
- if (search_text.empty())
- {
- getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("no_results"));
- }
- else
- {
- getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("not_found", map));
- }
- search_results->setEnabled(false);
- getChildView(BTN_OK)->setEnabled(false);
- getChildView(BTN_PROFILE)->setEnabled(false);
- }
- else
- {
- getChildView(BTN_OK)->setEnabled(true);
- search_results->setEnabled(true);
- search_results->sortByColumnIndex(1, TRUE);
- std::string text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
- if (!search_results->selectItemByLabel(text, TRUE, 1))
- {
- search_results->selectFirstItem();
- }
- onList();
- search_results->setFocus(TRUE);
- }
+ LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>(LIST_RESULTS);
+
+ const LLSD& experiences=mResponse["experience_keys"];
+
+ search_results->deleteAllItems();
+
+ LLSD item;
+ LLSD::array_const_iterator it = experiences.beginArray();
+ for ( ; it != experiences.endArray(); ++it)
+ {
+ const LLSD& experience = *it;
+
+ if(isExperienceHidden(experience))
+ continue;
+
+ std::string experience_name_string = experience[LLExperienceCache::NAME].asString();
+ if (experience_name_string.empty())
+ {
+ experience_name_string = LLTrans::getString("ExperienceNameUntitled");
+ }
+
+ item["id"]=experience[LLExperienceCache::EXPERIENCE_ID];
+ LLSD& columns = item["columns"];
+ columns[0]["column"] = "maturity";
+ columns[0]["value"] = getMaturityString(experience[LLExperienceCache::MATURITY].asInteger());
+ columns[0]["type"]="icon";
+ columns[0]["halign"]="right";
+ columns[1]["column"] = "experience_name";
+ columns[1]["value"] = columnSpace+experience_name_string;
+ columns[2]["column"] = "owner";
+ columns[2]["value"] = columnSpace+getString("loading");
+ search_results->addElement(item);
+ LLAvatarNameCache::get(experience[LLExperienceCache::AGENT_ID], boost::bind(name_callback, getDerivedHandle<LLPanelExperiencePicker>(), experience[LLExperienceCache::EXPERIENCE_ID], _1, _2));
+ }
+
+ if (search_results->isEmpty())
+ {
+ LLStringUtil::format_map_t map;
+ std::string search_text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
+ map["[TEXT]"] = search_text;
+ if (search_text.empty())
+ {
+ getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("no_results"));
+ }
+ else
+ {
+ getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("not_found", map));
+ }
+ search_results->setEnabled(false);
+ getChildView(BTN_OK)->setEnabled(false);
+ getChildView(BTN_PROFILE)->setEnabled(false);
+ }
+ else
+ {
+ getChildView(BTN_OK)->setEnabled(true);
+ search_results->setEnabled(true);
+ search_results->sortByColumnIndex(1, TRUE);
+ std::string text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
+ if (!search_results->selectItemByLabel(text, TRUE, 1))
+ {
+ search_results->selectFirstItem();
+ }
+ onList();
+ search_results->setFocus(TRUE);
+ }
}
void LLPanelExperiencePicker::onMaturity()
{
- gSavedPerAccountSettings.setU32("ExperienceSearchMaturity", getChild<LLComboBox>(TEXT_MATURITY)->getCurrentIndex());
- if(mResponse.has("experience_keys") && mResponse["experience_keys"].beginArray() != mResponse["experience_keys"].endArray())
- {
- filterContent();
- }
+ gSavedPerAccountSettings.setU32("ExperienceSearchMaturity", getChild<LLComboBox>(TEXT_MATURITY)->getCurrentIndex());
+ if(mResponse.has("experience_keys") && mResponse["experience_keys"].beginArray() != mResponse["experience_keys"].endArray())
+ {
+ filterContent();
+ }
}
bool LLPanelExperiencePicker::isExperienceHidden( const LLSD& experience) const
{
- bool hide=false;
- filter_list::const_iterator it = mFilters.begin();
- for(/**/;it != mFilters.end(); ++it)
- {
- if((*it)(experience)){
- return true;
- }
- }
-
- return hide;
+ bool hide=false;
+ filter_list::const_iterator it = mFilters.begin();
+ for(/**/;it != mFilters.end(); ++it)
+ {
+ if((*it)(experience)){
+ return true;
+ }
+ }
+
+ return hide;
}
bool LLPanelExperiencePicker::FilterOverRating( const LLSD& experience )
{
- int maturity = getChild<LLComboBox>(TEXT_MATURITY)->getSelectedValue().asInteger();
- return experience[LLExperienceCache::MATURITY].asInteger() > maturity;
+ int maturity = getChild<LLComboBox>(TEXT_MATURITY)->getSelectedValue().asInteger();
+ return experience[LLExperienceCache::MATURITY].asInteger() > maturity;
}
bool LLPanelExperiencePicker::FilterWithProperty( const LLSD& experience, S32 prop)
{
- return (experience[LLExperienceCache::PROPERTIES].asInteger() & prop) != 0;
+ return (experience[LLExperienceCache::PROPERTIES].asInteger() & prop) != 0;
}
bool LLPanelExperiencePicker::FilterWithoutProperties( const LLSD& experience, S32 prop)
{
- return ((experience[LLExperienceCache::PROPERTIES].asInteger() & prop) == prop);
+ return ((experience[LLExperienceCache::PROPERTIES].asInteger() & prop) == prop);
}
bool LLPanelExperiencePicker::FilterWithoutProperty( const LLSD& experience, S32 prop )
{
- return (experience[LLExperienceCache::PROPERTIES].asInteger() & prop) == 0;
+ return (experience[LLExperienceCache::PROPERTIES].asInteger() & prop) == 0;
}
void LLPanelExperiencePicker::setDefaultFilters()
{
- mFilters.clear();
- addFilter(boost::bind(&LLPanelExperiencePicker::FilterOverRating, this, _1));
+ mFilters.clear();
+ addFilter(boost::bind(&LLPanelExperiencePicker::FilterOverRating, this, _1));
}
bool LLPanelExperiencePicker::FilterMatching( const LLSD& experience, const LLUUID& id )
{
- if(experience.isUUID())
- {
- return experience.asUUID() == id;
- }
- return experience[LLExperienceCache::EXPERIENCE_ID].asUUID() == id;
+ if(experience.isUUID())
+ {
+ return experience.asUUID() == id;
+ }
+ return experience[LLExperienceCache::EXPERIENCE_ID].asUUID() == id;
}
void LLPanelExperiencePicker::onPage( S32 direction )
{
- mCurrentPage += direction;
- if(mCurrentPage < 1)
- {
- mCurrentPage = 1;
- }
- find();
+ mCurrentPage += direction;
+ if(mCurrentPage < 1)
+ {
+ mCurrentPage = 1;
+ }
+ find();
}
diff --git a/indra/newview/llpanelexperiencepicker.h b/indra/newview/llpanelexperiencepicker.h
index 97aa04cf4c..fc8b1d5418 100644
--- a/indra/newview/llpanelexperiencepicker.h
+++ b/indra/newview/llpanelexperiencepicker.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelexperiencepicker.h
* @brief Header file for llpanelexperiencepicker
* @author dolphin@lindenlab.com
@@ -36,61 +36,61 @@ class LLLineEditor;
class LLPanelExperiencePicker : public LLPanel
{
public:
- friend class LLExperienceSearchResponder;
- friend class LLFloaterExperiencePicker;
+ friend class LLExperienceSearchResponder;
+ friend class LLFloaterExperiencePicker;
- typedef boost::function<void (const uuid_vec_t&)> select_callback_t;
- // filter function for experiences, return true if the experience should be hidden.
- typedef boost::function<bool (const LLSD&)> filter_function;
- typedef std::vector<filter_function> filter_list;
+ typedef boost::function<void (const uuid_vec_t&)> select_callback_t;
+ // filter function for experiences, return true if the experience should be hidden.
+ typedef boost::function<bool (const LLSD&)> filter_function;
+ typedef std::vector<filter_function> filter_list;
- LLPanelExperiencePicker();
- virtual ~LLPanelExperiencePicker();
+ LLPanelExperiencePicker();
+ virtual ~LLPanelExperiencePicker();
- BOOL postBuild();
+ BOOL postBuild();
- void addFilter(filter_function func){mFilters.push_back(func);}
- template <class IT>
- void addFilters(IT begin, IT end){mFilters.insert(mFilters.end(), begin, end);}
- void setDefaultFilters();
+ void addFilter(filter_function func){mFilters.push_back(func);}
+ template <class IT>
+ void addFilters(IT begin, IT end){mFilters.insert(mFilters.end(), begin, end);}
+ void setDefaultFilters();
- static bool FilterWithProperty(const LLSD& experience, S32 prop);
- static bool FilterWithoutProperties(const LLSD& experience, S32 prop);
- static bool FilterWithoutProperty(const LLSD& experience, S32 prop);
- static bool FilterMatching(const LLSD& experience, const LLUUID& id);
- bool FilterOverRating(const LLSD& experience);
+ static bool FilterWithProperty(const LLSD& experience, S32 prop);
+ static bool FilterWithoutProperties(const LLSD& experience, S32 prop);
+ static bool FilterWithoutProperty(const LLSD& experience, S32 prop);
+ static bool FilterMatching(const LLSD& experience, const LLUUID& id);
+ bool FilterOverRating(const LLSD& experience);
private:
- void editKeystroke(LLLineEditor* caller, void* user_data);
+ void editKeystroke(LLLineEditor* caller, void* user_data);
- void onBtnFind();
- void onBtnSelect();
- void onBtnClose();
- void onBtnProfile();
- void onList();
- void onMaturity();
- void onPage(S32 direction);
+ void onBtnFind();
+ void onBtnSelect();
+ void onBtnClose();
+ void onBtnProfile();
+ void onList();
+ void onMaturity();
+ void onPage(S32 direction);
- void getSelectedExperienceIds( const LLScrollListCtrl* results, uuid_vec_t &experience_ids );
- void setAllowMultiple(bool allow_multiple);
+ void getSelectedExperienceIds( const LLScrollListCtrl* results, uuid_vec_t &experience_ids );
+ void setAllowMultiple(bool allow_multiple);
- void find();
+ void find();
static void findResults(LLHandle<LLPanelExperiencePicker> hparent, LLUUID queryId, LLSD foundResult);
- bool isSelectButtonEnabled();
- void processResponse( const LLUUID& query_id, const LLSD& content );
+ bool isSelectButtonEnabled();
+ void processResponse( const LLUUID& query_id, const LLSD& content );
- void filterContent();
- bool isExperienceHidden(const LLSD& experience) const ;
- std::string getMaturityString(int maturity);
+ void filterContent();
+ bool isExperienceHidden(const LLSD& experience) const ;
+ std::string getMaturityString(int maturity);
- select_callback_t mSelectionCallback;
- filter_list mFilters;
- LLUUID mQueryID;
- LLSD mResponse;
- bool mCloseOnSelect;
- S32 mCurrentPage;
+ select_callback_t mSelectionCallback;
+ filter_list mFilters;
+ LLUUID mQueryID;
+ LLSD mResponse;
+ bool mCloseOnSelect;
+ S32 mCurrentPage;
};
#endif // LL_LLPANELEXPERIENCEPICKER_H
diff --git a/indra/newview/llpanelexperiences.cpp b/indra/newview/llpanelexperiences.cpp
index 91d3b523fb..7080aaa3db 100644
--- a/indra/newview/llpanelexperiences.cpp
+++ b/indra/newview/llpanelexperiences.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelexperiences.cpp
* @brief LLPanelExperiences class implementation
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,43 +46,43 @@ static LLPanelInjector<LLPanelExperiences> register_experiences_panel("experienc
static const LLExperienceItemComparator NAME_COMPARATOR;
LLPanelExperiences::LLPanelExperiences( )
- : mExperiencesList(NULL)
+ : mExperiencesList(NULL)
{
buildFromFile("panel_experiences.xml");
}
BOOL LLPanelExperiences::postBuild( void )
{
- mExperiencesList = getChild<LLFlatListView>("experiences_list");
- if (hasString("loading_experiences"))
- {
- mExperiencesList->setNoItemsCommentText(getString("loading_experiences"));
- }
- else if (hasString("no_experiences"))
- {
- mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
- }
- mExperiencesList->setComparator(&NAME_COMPARATOR);
+ mExperiencesList = getChild<LLFlatListView>("experiences_list");
+ if (hasString("loading_experiences"))
+ {
+ mExperiencesList->setNoItemsCommentText(getString("loading_experiences"));
+ }
+ else if (hasString("no_experiences"))
+ {
+ mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
+ }
+ mExperiencesList->setComparator(&NAME_COMPARATOR);
- return TRUE;
+ return TRUE;
}
LLExperienceItem* LLPanelExperiences::getSelectedExperienceItem()
{
- LLPanel* selected_item = mExperiencesList->getSelectedItem();
- if (!selected_item) return NULL;
+ LLPanel* selected_item = mExperiencesList->getSelectedItem();
+ if (!selected_item) return NULL;
- return dynamic_cast<LLExperienceItem*>(selected_item);
+ return dynamic_cast<LLExperienceItem*>(selected_item);
}
void LLPanelExperiences::setExperienceList( const LLSD& experiences )
{
- if (hasString("no_experiences"))
- {
- mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
- }
+ if (hasString("no_experiences"))
+ {
+ mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
+ }
mExperiencesList->clear();
LLSD::array_const_iterator it = experiences.beginArray();
@@ -148,41 +148,41 @@ void LLPanelExperiences::addExperience( const LLUUID& id )
item->init(id);
mExperiencesList->addItem(item, id);
- mExperiencesList->sort();
+ mExperiencesList->sort();
}
}
void LLPanelExperiences::setButtonAction(const std::string& label, const commit_signal_t::slot_type& cb )
{
- if(label.empty())
- {
- getChild<LLLayoutPanel>("button_panel")->setVisible(false);
- }
- else
- {
- getChild<LLLayoutPanel>("button_panel")->setVisible(true);
- LLButton* child = getChild<LLButton>("btn_action");
- child->setCommitCallback(cb);
- child->setLabel(getString(label));
- }
+ if(label.empty())
+ {
+ getChild<LLLayoutPanel>("button_panel")->setVisible(false);
+ }
+ else
+ {
+ getChild<LLLayoutPanel>("button_panel")->setVisible(true);
+ LLButton* child = getChild<LLButton>("btn_action");
+ child->setCommitCallback(cb);
+ child->setLabel(getString(label));
+ }
}
void LLPanelExperiences::enableButton( bool enable )
{
- getChild<LLButton>("btn_action")->setEnabled(enable);
+ getChild<LLButton>("btn_action")->setEnabled(enable);
}
LLExperienceItem::LLExperienceItem()
- : mName(NULL)
+ : mName(NULL)
{
- buildFromFile("panel_experience_list_item.xml");
+ buildFromFile("panel_experience_list_item.xml");
}
void LLExperienceItem::init( const LLUUID& id)
{
mName = getChild<LLUICtrl>("experience_name");
- mName->setValue(LLSLURL("experience", id, "profile").getSLURLString());
+ mName->setValue(LLSLURL("experience", id, "profile").getSLURLString());
}
LLExperienceItem::~LLExperienceItem()
@@ -192,12 +192,12 @@ LLExperienceItem::~LLExperienceItem()
std::string LLExperienceItem::getExperienceName() const
{
- if (mName)
- {
- return mName->getValue();
- }
-
- return "";
+ if (mName)
+ {
+ return mName->getValue();
+ }
+
+ return "";
}
void LLPanelSearchExperiences::doSearch()
@@ -220,20 +220,20 @@ BOOL LLPanelSearchExperiences::postBuild( void )
bool LLExperienceItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const
{
- const LLExperienceItem* experience_item1 = dynamic_cast<const LLExperienceItem*>(item1);
- const LLExperienceItem* experience_item2 = dynamic_cast<const LLExperienceItem*>(item2);
-
- if (!experience_item1 || !experience_item2)
- {
- LL_ERRS() << "item1 and item2 cannot be null" << LL_ENDL;
- return true;
- }
+ const LLExperienceItem* experience_item1 = dynamic_cast<const LLExperienceItem*>(item1);
+ const LLExperienceItem* experience_item2 = dynamic_cast<const LLExperienceItem*>(item2);
+
+ if (!experience_item1 || !experience_item2)
+ {
+ LL_ERRS() << "item1 and item2 cannot be null" << LL_ENDL;
+ return true;
+ }
- std::string name1 = experience_item1->getExperienceName();
- std::string name2 = experience_item2->getExperienceName();
+ std::string name1 = experience_item1->getExperienceName();
+ std::string name2 = experience_item2->getExperienceName();
- LLStringUtil::toUpper(name1);
- LLStringUtil::toUpper(name2);
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
- return name1 < name2;
+ return name1 < name2;
}
diff --git a/indra/newview/llpanelexperiences.h b/indra/newview/llpanelexperiences.h
index 11111f2a2e..7a50ab7666 100644
--- a/indra/newview/llpanelexperiences.h
+++ b/indra/newview/llpanelexperiences.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelexperiences.h
* @brief LLPanelExperiences class definition
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,10 +31,10 @@
#include "llflatlistview.h"
class LLExperienceItem;
-class LLPanelProfile;
+class LLPanelProfile;
-class LLPanelSearchExperiences
+class LLPanelSearchExperiences
: public LLPanel
{
public:
@@ -46,15 +46,15 @@ public:
};
class LLPanelExperiences
- : public LLPanel
+ : public LLPanel
{
public:
LLPanelExperiences();
static LLPanelExperiences* create(const std::string& name);
- /*virtual*/ BOOL postBuild(void);
- /*virtual*/ void onClosePanel();
+ /*virtual*/ BOOL postBuild(void);
+ /*virtual*/ void onClosePanel();
void setExperienceList(const LLSD& experiences);
void getExperienceIdsList(std::vector<LLUUID>& result);
@@ -65,35 +65,35 @@ public:
void removeExperiences( const LLSD& ids );
void removeExperience( const LLUUID& id);
void addExperience( const LLUUID& id);
- void setButtonAction(const std::string& label, const commit_signal_t::slot_type& cb);
- void enableButton(bool enable);
+ void setButtonAction(const std::string& label, const commit_signal_t::slot_type& cb);
+ void enableButton(bool enable);
protected:
private:
- LLFlatListView* mExperiencesList;
+ LLFlatListView* mExperiencesList;
};
class LLExperienceItemComparator : public LLFlatListView::ItemComparator
{
- LOG_CLASS(LLExperienceItemComparator);
+ LOG_CLASS(LLExperienceItemComparator);
public:
- LLExperienceItemComparator() {};
- virtual ~LLExperienceItemComparator() {};
-
- virtual bool compare(const LLPanel* item1, const LLPanel* item2) const;
+ LLExperienceItemComparator() {};
+ virtual ~LLExperienceItemComparator() {};
+
+ virtual bool compare(const LLPanel* item1, const LLPanel* item2) const;
};
-class LLExperienceItem
- : public LLPanel
+class LLExperienceItem
+ : public LLPanel
{
public:
- LLExperienceItem();
- ~LLExperienceItem();
+ LLExperienceItem();
+ ~LLExperienceItem();
- void init(const LLUUID& experience_id);
- std::string getExperienceName() const;
+ void init(const LLUUID& experience_id);
+ std::string getExperienceName() const;
protected:
- LLUICtrl* mName;
+ LLUICtrl* mName;
};
#endif // LL_LLPANELEXPERIENCES_H
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index a527ebe47f..9761c6ae10 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelface.cpp
* @brief Panel in the tools floater for editing face textures, colors, etc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,7 +28,7 @@
// file include
#include "llpanelface.h"
-
+
// library includes
#include "llcalc.h"
#include "llerror.h"
@@ -102,15 +102,15 @@ LLPanelFace::Selection LLPanelFace::sMaterialOverrideSelection;
// Constant definitions for comboboxes
// Must match the commbobox definitions in panel_tools_texture.xml
//
-const S32 MATMEDIA_MATERIAL = 0; // Material
-const S32 MATMEDIA_PBR = 1; // PBR
-const S32 MATMEDIA_MEDIA = 2; // Media
-const S32 MATTYPE_DIFFUSE = 0; // Diffuse material texture
-const S32 MATTYPE_NORMAL = 1; // Normal map
-const S32 MATTYPE_SPECULAR = 2; // Specular map
-const S32 ALPHAMODE_MASK = 2; // Alpha masking mode
-const S32 BUMPY_TEXTURE = 18; // use supplied normal map
-const S32 SHINY_TEXTURE = 4; // use supplied specular map
+const S32 MATMEDIA_MATERIAL = 0; // Material
+const S32 MATMEDIA_PBR = 1; // PBR
+const S32 MATMEDIA_MEDIA = 2; // Media
+const S32 MATTYPE_DIFFUSE = 0; // Diffuse material texture
+const S32 MATTYPE_NORMAL = 1; // Normal map
+const S32 MATTYPE_SPECULAR = 2; // Specular map
+const S32 ALPHAMODE_MASK = 2; // Alpha masking mode
+const S32 BUMPY_TEXTURE = 18; // use supplied normal map
+const S32 SHINY_TEXTURE = 4; // use supplied specular map
const S32 PBRTYPE_RENDER_MATERIAL_ID = 0; // Render Material ID
const S32 PBRTYPE_BASE_COLOR = 1; // PBR Base Color
const S32 PBRTYPE_METALLIC_ROUGHNESS = 2; // PBR Metallic
@@ -159,7 +159,7 @@ void LLPanelFace::updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*
return true;
}
- std::function<void(LLGLTFMaterial*)> mFunc;
+ std::function<void(LLGLTFMaterial*)> mFunc;
} select_func(func);
LLSelectMgr::getInstance()->getSelection()->applyToTEs(&select_func);
@@ -176,7 +176,7 @@ void readSelectedGLTFMaterial(std::function<T(const LLGLTFMaterial*)> func, T& v
{
const LLTextureEntry* tep = object->getTE(face);
const LLGLTFMaterial* render_material = tep->getGLTFRenderMaterial();
-
+
return mFunc(render_material);
}
@@ -211,9 +211,9 @@ LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit()
}
}
- channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
- channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
- return channel_to_edit;
+ channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
+ channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
+ return channel_to_edit;
}
LLRender::eTexIndex LLPanelFace::getTextureDropChannel()
@@ -240,55 +240,55 @@ LLGLTFMaterial::TextureInfo LLPanelFace::getPBRDropChannel()
// Things the UI provides...
//
-LLUUID LLPanelFace::getCurrentNormalMap() { return getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID(); }
-LLUUID LLPanelFace::getCurrentSpecularMap() { return getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID(); }
-U32 LLPanelFace::getCurrentShininess() { return getChild<LLComboBox>("combobox shininess")->getCurrentIndex(); }
-U32 LLPanelFace::getCurrentBumpiness() { return getChild<LLComboBox>("combobox bumpiness")->getCurrentIndex(); }
-U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)getChild<LLComboBox>("combobox alphamode")->getCurrentIndex(); }
-U8 LLPanelFace::getCurrentAlphaMaskCutoff() { return (U8)getChild<LLUICtrl>("maskcutoff")->getValue().asInteger(); }
-U8 LLPanelFace::getCurrentEnvIntensity() { return (U8)getChild<LLUICtrl>("environment")->getValue().asInteger(); }
-U8 LLPanelFace::getCurrentGlossiness() { return (U8)getChild<LLUICtrl>("glossiness")->getValue().asInteger(); }
-F32 LLPanelFace::getCurrentBumpyRot() { return getChild<LLUICtrl>("bumpyRot")->getValue().asReal(); }
-F32 LLPanelFace::getCurrentBumpyScaleU() { return getChild<LLUICtrl>("bumpyScaleU")->getValue().asReal(); }
-F32 LLPanelFace::getCurrentBumpyScaleV() { return getChild<LLUICtrl>("bumpyScaleV")->getValue().asReal(); }
-F32 LLPanelFace::getCurrentBumpyOffsetU() { return getChild<LLUICtrl>("bumpyOffsetU")->getValue().asReal(); }
-F32 LLPanelFace::getCurrentBumpyOffsetV() { return getChild<LLUICtrl>("bumpyOffsetV")->getValue().asReal(); }
-F32 LLPanelFace::getCurrentShinyRot() { return getChild<LLUICtrl>("shinyRot")->getValue().asReal(); }
-F32 LLPanelFace::getCurrentShinyScaleU() { return getChild<LLUICtrl>("shinyScaleU")->getValue().asReal(); }
-F32 LLPanelFace::getCurrentShinyScaleV() { return getChild<LLUICtrl>("shinyScaleV")->getValue().asReal(); }
-F32 LLPanelFace::getCurrentShinyOffsetU() { return getChild<LLUICtrl>("shinyOffsetU")->getValue().asReal(); }
-F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild<LLUICtrl>("shinyOffsetV")->getValue().asReal(); }
+LLUUID LLPanelFace::getCurrentNormalMap() { return getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID(); }
+LLUUID LLPanelFace::getCurrentSpecularMap() { return getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID(); }
+U32 LLPanelFace::getCurrentShininess() { return getChild<LLComboBox>("combobox shininess")->getCurrentIndex(); }
+U32 LLPanelFace::getCurrentBumpiness() { return getChild<LLComboBox>("combobox bumpiness")->getCurrentIndex(); }
+U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)getChild<LLComboBox>("combobox alphamode")->getCurrentIndex(); }
+U8 LLPanelFace::getCurrentAlphaMaskCutoff() { return (U8)getChild<LLUICtrl>("maskcutoff")->getValue().asInteger(); }
+U8 LLPanelFace::getCurrentEnvIntensity() { return (U8)getChild<LLUICtrl>("environment")->getValue().asInteger(); }
+U8 LLPanelFace::getCurrentGlossiness() { return (U8)getChild<LLUICtrl>("glossiness")->getValue().asInteger(); }
+F32 LLPanelFace::getCurrentBumpyRot() { return getChild<LLUICtrl>("bumpyRot")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentBumpyScaleU() { return getChild<LLUICtrl>("bumpyScaleU")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentBumpyScaleV() { return getChild<LLUICtrl>("bumpyScaleV")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentBumpyOffsetU() { return getChild<LLUICtrl>("bumpyOffsetU")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentBumpyOffsetV() { return getChild<LLUICtrl>("bumpyOffsetV")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyRot() { return getChild<LLUICtrl>("shinyRot")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyScaleU() { return getChild<LLUICtrl>("shinyScaleU")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyScaleV() { return getChild<LLUICtrl>("shinyScaleV")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyOffsetU() { return getChild<LLUICtrl>("shinyOffsetU")->getValue().asReal(); }
+F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild<LLUICtrl>("shinyOffsetV")->getValue().asReal(); }
//
// Methods
//
-BOOL LLPanelFace::postBuild()
-{
- childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this);
- childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this);
- childSetCommitCallback("combobox alphamode",&LLPanelFace::onCommitAlphaMode,this);
- childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureScaleX, this);
- childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureScaleY, this);
- childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureRot, this);
- childSetCommitCallback("rptctrl",&LLPanelFace::onCommitRepeatsPerMeter, this);
- childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this);
- childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureOffsetX, this);
- childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureOffsetY, this);
-
- childSetCommitCallback("bumpyScaleU",&LLPanelFace::onCommitMaterialBumpyScaleX, this);
- childSetCommitCallback("bumpyScaleV",&LLPanelFace::onCommitMaterialBumpyScaleY, this);
- childSetCommitCallback("bumpyRot",&LLPanelFace::onCommitMaterialBumpyRot, this);
- childSetCommitCallback("bumpyOffsetU",&LLPanelFace::onCommitMaterialBumpyOffsetX, this);
- childSetCommitCallback("bumpyOffsetV",&LLPanelFace::onCommitMaterialBumpyOffsetY, this);
- childSetCommitCallback("shinyScaleU",&LLPanelFace::onCommitMaterialShinyScaleX, this);
- childSetCommitCallback("shinyScaleV",&LLPanelFace::onCommitMaterialShinyScaleY, this);
- childSetCommitCallback("shinyRot",&LLPanelFace::onCommitMaterialShinyRot, this);
- childSetCommitCallback("shinyOffsetU",&LLPanelFace::onCommitMaterialShinyOffsetX, this);
- childSetCommitCallback("shinyOffsetV",&LLPanelFace::onCommitMaterialShinyOffsetY, this);
- childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterialGloss, this);
- childSetCommitCallback("environment",&LLPanelFace::onCommitMaterialEnv, this);
- childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this);
+BOOL LLPanelFace::postBuild()
+{
+ childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this);
+ childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this);
+ childSetCommitCallback("combobox alphamode",&LLPanelFace::onCommitAlphaMode,this);
+ childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureScaleX, this);
+ childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureScaleY, this);
+ childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureRot, this);
+ childSetCommitCallback("rptctrl",&LLPanelFace::onCommitRepeatsPerMeter, this);
+ childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this);
+ childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureOffsetX, this);
+ childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureOffsetY, this);
+
+ childSetCommitCallback("bumpyScaleU",&LLPanelFace::onCommitMaterialBumpyScaleX, this);
+ childSetCommitCallback("bumpyScaleV",&LLPanelFace::onCommitMaterialBumpyScaleY, this);
+ childSetCommitCallback("bumpyRot",&LLPanelFace::onCommitMaterialBumpyRot, this);
+ childSetCommitCallback("bumpyOffsetU",&LLPanelFace::onCommitMaterialBumpyOffsetX, this);
+ childSetCommitCallback("bumpyOffsetV",&LLPanelFace::onCommitMaterialBumpyOffsetY, this);
+ childSetCommitCallback("shinyScaleU",&LLPanelFace::onCommitMaterialShinyScaleX, this);
+ childSetCommitCallback("shinyScaleV",&LLPanelFace::onCommitMaterialShinyScaleY, this);
+ childSetCommitCallback("shinyRot",&LLPanelFace::onCommitMaterialShinyRot, this);
+ childSetCommitCallback("shinyOffsetU",&LLPanelFace::onCommitMaterialShinyOffsetX, this);
+ childSetCommitCallback("shinyOffsetV",&LLPanelFace::onCommitMaterialShinyOffsetY, this);
+ childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterialGloss, this);
+ childSetCommitCallback("environment",&LLPanelFace::onCommitMaterialEnv, this);
+ childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this);
childSetCommitCallback("add_media", &LLPanelFace::onClickBtnAddMedia, this);
childSetCommitCallback("delete_media", &LLPanelFace::onClickBtnDeleteMedia, this);
@@ -301,30 +301,30 @@ BOOL LLPanelFace::postBuild()
LLGLTFMaterialList::addSelectionUpdateCallback(&LLPanelFace::onMaterialOverrideReceived);
sMaterialOverrideSelection.connect();
- childSetAction("button align",&LLPanelFace::onClickAutoFix,this);
- childSetAction("button align textures", &LLPanelFace::onAlignTexture, this);
+ childSetAction("button align",&LLPanelFace::onClickAutoFix,this);
+ childSetAction("button align textures", &LLPanelFace::onAlignTexture, this);
childSetAction("pbr_from_inventory", &LLPanelFace::onClickBtnLoadInvPBR, this);
childSetAction("edit_selected_pbr", &LLPanelFace::onClickBtnEditPBR, this);
childSetAction("save_selected_pbr", &LLPanelFace::onClickBtnSavePBR, this);
- LLTextureCtrl* mTextureCtrl;
- LLTextureCtrl* mShinyTextureCtrl;
- LLTextureCtrl* mBumpyTextureCtrl;
- LLColorSwatchCtrl* mColorSwatch;
- LLColorSwatchCtrl* mShinyColorSwatch;
+ LLTextureCtrl* mTextureCtrl;
+ LLTextureCtrl* mShinyTextureCtrl;
+ LLTextureCtrl* mBumpyTextureCtrl;
+ LLColorSwatchCtrl* mColorSwatch;
+ LLColorSwatchCtrl* mShinyColorSwatch;
- LLComboBox* mComboTexGen;
+ LLComboBox* mComboTexGen;
- LLCheckBoxCtrl *mCheckFullbright;
-
- LLTextBox* mLabelColorTransp;
- LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha
+ LLCheckBoxCtrl *mCheckFullbright;
- LLSpinCtrl* mCtrlGlow;
+ LLTextBox* mLabelColorTransp;
+ LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha
- setMouseOpaque(FALSE);
+ LLSpinCtrl* mCtrlGlow;
- LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control");
+ setMouseOpaque(FALSE);
+
+ LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control");
if (pbr_ctrl)
{
pbr_ctrl->setDefaultImageAssetID(LLUUID::null);
@@ -344,117 +344,117 @@ BOOL LLPanelFace::postBuild()
pbr_ctrl->setInventoryPickType(PICK_MATERIAL);
}
- mTextureCtrl = getChild<LLTextureCtrl>("texture control");
- if(mTextureCtrl)
- {
- mTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_TEXTURE);
- mTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitTexture, this, _2) );
- mTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelTexture, this, _2) );
- mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) );
- mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
- mTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
- mTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
-
- mTextureCtrl->setFollowsTop();
- mTextureCtrl->setFollowsLeft();
- mTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
- mTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
- }
-
- mShinyTextureCtrl = getChild<LLTextureCtrl>("shinytexture control");
- if(mShinyTextureCtrl)
- {
- mShinyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_SPECULAR);
- mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) );
- mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) );
- mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) );
- mShinyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
-
- mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
- mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
- mShinyTextureCtrl->setFollowsTop();
- mShinyTextureCtrl->setFollowsLeft();
- mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
- mShinyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
- }
-
- mBumpyTextureCtrl = getChild<LLTextureCtrl>("bumpytexture control");
- if(mBumpyTextureCtrl)
- {
- mBumpyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_NORMAL);
- mBumpyTextureCtrl->setBlankImageAssetID(BLANK_OBJECT_NORMAL);
- mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) );
- mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) );
- mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) );
- mBumpyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
-
- mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
- mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
- mBumpyTextureCtrl->setFollowsTop();
- mBumpyTextureCtrl->setFollowsLeft();
- mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
- mBumpyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
- }
-
- mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- if(mColorSwatch)
- {
- mColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitColor, this, _2));
- mColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelColor, this, _2));
- mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2));
- mColorSwatch->setFollowsTop();
- mColorSwatch->setFollowsLeft();
- mColorSwatch->setCanApplyImmediately(TRUE);
- }
-
- mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch");
- if(mShinyColorSwatch)
- {
- mShinyColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitShinyColor, this, _2));
- mShinyColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelShinyColor, this, _2));
- mShinyColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectShinyColor, this, _2));
- mShinyColorSwatch->setFollowsTop();
- mShinyColorSwatch->setFollowsLeft();
- mShinyColorSwatch->setCanApplyImmediately(TRUE);
- }
-
- mLabelColorTransp = getChild<LLTextBox>("color trans");
- if(mLabelColorTransp)
- {
- mLabelColorTransp->setFollowsTop();
- mLabelColorTransp->setFollowsLeft();
- }
-
- mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans");
- if(mCtrlColorTransp)
- {
- mCtrlColorTransp->setCommitCallback(boost::bind(&LLPanelFace::onCommitAlpha, this, _2));
- mCtrlColorTransp->setPrecision(0);
- mCtrlColorTransp->setFollowsTop();
- mCtrlColorTransp->setFollowsLeft();
- }
-
- mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright");
- if (mCheckFullbright)
- {
- mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright, this);
- }
-
- mComboTexGen = getChild<LLComboBox>("combobox texgen");
- if(mComboTexGen)
- {
- mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen, this);
- mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
- }
+ mTextureCtrl = getChild<LLTextureCtrl>("texture control");
+ if(mTextureCtrl)
+ {
+ mTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_TEXTURE);
+ mTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitTexture, this, _2) );
+ mTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelTexture, this, _2) );
+ mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) );
+ mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
+ mTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
+ mTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
+
+ mTextureCtrl->setFollowsTop();
+ mTextureCtrl->setFollowsLeft();
+ mTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
+ mTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ }
+
+ mShinyTextureCtrl = getChild<LLTextureCtrl>("shinytexture control");
+ if(mShinyTextureCtrl)
+ {
+ mShinyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_SPECULAR);
+ mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) );
+ mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) );
+ mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) );
+ mShinyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
+
+ mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
+ mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
+ mShinyTextureCtrl->setFollowsTop();
+ mShinyTextureCtrl->setFollowsLeft();
+ mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
+ mShinyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ }
+
+ mBumpyTextureCtrl = getChild<LLTextureCtrl>("bumpytexture control");
+ if(mBumpyTextureCtrl)
+ {
+ mBumpyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_NORMAL);
+ mBumpyTextureCtrl->setBlankImageAssetID(BLANK_OBJECT_NORMAL);
+ mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) );
+ mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) );
+ mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) );
+ mBumpyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
+
+ mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
+ mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
+ mBumpyTextureCtrl->setFollowsTop();
+ mBumpyTextureCtrl->setFollowsLeft();
+ mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
+ mBumpyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ }
+
+ mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ if(mColorSwatch)
+ {
+ mColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitColor, this, _2));
+ mColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelColor, this, _2));
+ mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2));
+ mColorSwatch->setFollowsTop();
+ mColorSwatch->setFollowsLeft();
+ mColorSwatch->setCanApplyImmediately(TRUE);
+ }
+
+ mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch");
+ if(mShinyColorSwatch)
+ {
+ mShinyColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitShinyColor, this, _2));
+ mShinyColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelShinyColor, this, _2));
+ mShinyColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectShinyColor, this, _2));
+ mShinyColorSwatch->setFollowsTop();
+ mShinyColorSwatch->setFollowsLeft();
+ mShinyColorSwatch->setCanApplyImmediately(TRUE);
+ }
+
+ mLabelColorTransp = getChild<LLTextBox>("color trans");
+ if(mLabelColorTransp)
+ {
+ mLabelColorTransp->setFollowsTop();
+ mLabelColorTransp->setFollowsLeft();
+ }
+
+ mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans");
+ if(mCtrlColorTransp)
+ {
+ mCtrlColorTransp->setCommitCallback(boost::bind(&LLPanelFace::onCommitAlpha, this, _2));
+ mCtrlColorTransp->setPrecision(0);
+ mCtrlColorTransp->setFollowsTop();
+ mCtrlColorTransp->setFollowsLeft();
+ }
+
+ mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright");
+ if (mCheckFullbright)
+ {
+ mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright, this);
+ }
+
+ mComboTexGen = getChild<LLComboBox>("combobox texgen");
+ if(mComboTexGen)
+ {
+ mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen, this);
+ mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
+ }
mComboMatMedia = getChild<LLComboBox>("combobox matmedia");
- if(mComboMatMedia)
- {
+ if(mComboMatMedia)
+ {
mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this);
mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL);
- }
+ }
- LLRadioGroup* radio_mat_type = findChild<LLRadioGroup>("radio_material_type");
+ LLRadioGroup* radio_mat_type = findChild<LLRadioGroup>("radio_material_type");
if(radio_mat_type)
{
radio_mat_type->setCommitCallback(LLPanelFace::onCommitMaterialType, this);
@@ -468,25 +468,25 @@ BOOL LLPanelFace::postBuild()
radio_pbr_type->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID);
}
- mCtrlGlow = getChild<LLSpinCtrl>("glow");
- if(mCtrlGlow)
- {
- mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this);
- }
+ mCtrlGlow = getChild<LLSpinCtrl>("glow");
+ if(mCtrlGlow)
+ {
+ mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this);
+ }
mMenuClipboardColor = getChild<LLMenuButton>("clipboard_color_params_btn");
mMenuClipboardTexture = getChild<LLMenuButton>("clipboard_texture_params_btn");
-
+
mTitleMedia = getChild<LLMediaCtrl>("title_media");
mTitleMediaText = getChild<LLTextBox>("media_info");
- clearCtrls();
+ clearCtrls();
- return TRUE;
+ return TRUE;
}
LLPanelFace::LLPanelFace()
-: LLPanel(),
+: LLPanel(),
mIsAlpha(false),
mComboMatMedia(NULL),
mTitleMedia(NULL),
@@ -532,131 +532,131 @@ void LLPanelFace::draw()
void LLPanelFace::sendTexture()
{
- LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("texture control");
- if(!mTextureCtrl) return;
- if( !mTextureCtrl->getTentative() )
- {
- // we grab the item id first, because we want to do a
- // permissions check in the selection manager. ARGH!
- LLUUID id = mTextureCtrl->getImageItemID();
- if(id.isNull())
- {
- id = mTextureCtrl->getImageAssetID();
- }
+ LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("texture control");
+ if(!mTextureCtrl) return;
+ if( !mTextureCtrl->getTentative() )
+ {
+ // we grab the item id first, because we want to do a
+ // permissions check in the selection manager. ARGH!
+ LLUUID id = mTextureCtrl->getImageItemID();
+ if(id.isNull())
+ {
+ id = mTextureCtrl->getImageAssetID();
+ }
if (!LLSelectMgr::getInstance()->selectionSetImage(id))
{
// need to refresh value in texture ctrl
refresh();
}
- }
+ }
}
void LLPanelFace::sendBump(U32 bumpiness)
-{
- LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
- if (bumpiness < BUMPY_TEXTURE)
-{
- LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL;
- bumpytexture_ctrl->clear();
- bumpytexture_ctrl->setImageAssetID(LLUUID());
- }
+{
+ LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
+ if (bumpiness < BUMPY_TEXTURE)
+{
+ LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL;
+ bumpytexture_ctrl->clear();
+ bumpytexture_ctrl->setImageAssetID(LLUUID());
+ }
- updateBumpyControls(bumpiness == BUMPY_TEXTURE, true);
+ updateBumpyControls(bumpiness == BUMPY_TEXTURE, true);
- LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID();
+ LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID();
- U8 bump = (U8) bumpiness & TEM_BUMP_MASK;
+ U8 bump = (U8) bumpiness & TEM_BUMP_MASK;
- // Clear legacy bump to None when using an actual normal map
- //
- if (!current_normal_map.isNull())
- bump = 0;
+ // Clear legacy bump to None when using an actual normal map
+ //
+ if (!current_normal_map.isNull())
+ bump = 0;
- // Set the normal map or reset it to null as appropriate
- //
- LLSelectedTEMaterial::setNormalID(this, current_normal_map);
+ // Set the normal map or reset it to null as appropriate
+ //
+ LLSelectedTEMaterial::setNormalID(this, current_normal_map);
- LLSelectMgr::getInstance()->selectionSetBumpmap( bump, bumpytexture_ctrl->getImageItemID() );
+ LLSelectMgr::getInstance()->selectionSetBumpmap( bump, bumpytexture_ctrl->getImageItemID() );
}
void LLPanelFace::sendTexGen()
{
- LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen");
- if(!mComboTexGen)return;
- U8 tex_gen = (U8) mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT;
- LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen );
+ LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen");
+ if(!mComboTexGen)return;
+ U8 tex_gen = (U8) mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT;
+ LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen );
}
void LLPanelFace::sendShiny(U32 shininess)
{
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
- if (shininess < SHINY_TEXTURE)
+ if (shininess < SHINY_TEXTURE)
{
- texture_ctrl->clear();
- texture_ctrl->setImageAssetID(LLUUID());
- }
+ texture_ctrl->clear();
+ texture_ctrl->setImageAssetID(LLUUID());
+ }
+
+ LLUUID specmap = getCurrentSpecularMap();
- LLUUID specmap = getCurrentSpecularMap();
+ U8 shiny = (U8) shininess & TEM_SHINY_MASK;
+ if (!specmap.isNull())
+ shiny = 0;
- U8 shiny = (U8) shininess & TEM_SHINY_MASK;
- if (!specmap.isNull())
- shiny = 0;
+ LLSelectedTEMaterial::setSpecularID(this, specmap);
- LLSelectedTEMaterial::setSpecularID(this, specmap);
+ LLSelectMgr::getInstance()->selectionSetShiny( shiny, texture_ctrl->getImageItemID() );
- LLSelectMgr::getInstance()->selectionSetShiny( shiny, texture_ctrl->getImageItemID() );
+ updateShinyControls(!specmap.isNull(), true);
- updateShinyControls(!specmap.isNull(), true);
-
}
void LLPanelFace::sendFullbright()
{
- LLCheckBoxCtrl* mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright");
- if(!mCheckFullbright)return;
- U8 fullbright = mCheckFullbright->get() ? TEM_FULLBRIGHT_MASK : 0;
- LLSelectMgr::getInstance()->selectionSetFullbright( fullbright );
+ LLCheckBoxCtrl* mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright");
+ if(!mCheckFullbright)return;
+ U8 fullbright = mCheckFullbright->get() ? TEM_FULLBRIGHT_MASK : 0;
+ LLSelectMgr::getInstance()->selectionSetFullbright( fullbright );
}
void LLPanelFace::sendColor()
{
-
- LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- if(!mColorSwatch)return;
- LLColor4 color = mColorSwatch->get();
- LLSelectMgr::getInstance()->selectionSetColorOnly( color );
+ LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ if(!mColorSwatch)return;
+ LLColor4 color = mColorSwatch->get();
+
+ LLSelectMgr::getInstance()->selectionSetColorOnly( color );
}
void LLPanelFace::sendAlpha()
-{
- LLSpinCtrl* mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans");
- if(!mCtrlColorTransp)return;
- F32 alpha = (100.f - mCtrlColorTransp->get()) / 100.f;
+{
+ LLSpinCtrl* mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans");
+ if(!mCtrlColorTransp)return;
+ F32 alpha = (100.f - mCtrlColorTransp->get()) / 100.f;
- LLSelectMgr::getInstance()->selectionSetAlphaOnly( alpha );
+ LLSelectMgr::getInstance()->selectionSetAlphaOnly( alpha );
}
void LLPanelFace::sendGlow()
{
- LLSpinCtrl* mCtrlGlow = getChild<LLSpinCtrl>("glow");
- llassert(mCtrlGlow);
- if (mCtrlGlow)
- {
- F32 glow = mCtrlGlow->get();
- LLSelectMgr::getInstance()->selectionSetGlow( glow );
- }
+ LLSpinCtrl* mCtrlGlow = getChild<LLSpinCtrl>("glow");
+ llassert(mCtrlGlow);
+ if (mCtrlGlow)
+ {
+ F32 glow = mCtrlGlow->get();
+ LLSelectMgr::getInstance()->selectionSetGlow( glow );
+ }
}
struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
{
- LLPanelFaceSetTEFunctor(LLPanelFace* panel) : mPanel(panel) {}
- virtual bool apply(LLViewerObject* object, S32 te)
- {
- BOOL valid;
- F32 value;
+ LLPanelFaceSetTEFunctor(LLPanelFace* panel) : mPanel(panel) {}
+ virtual bool apply(LLViewerObject* object, S32 te)
+ {
+ BOOL valid;
+ F32 value;
std::string prefix;
// Effectively the same as MATMEDIA_PBR sans using different radio,
@@ -674,179 +674,179 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
prefix = "shiny";
break;
}
-
+
LLSpinCtrl * ctrlTexScaleS = mPanel->getChild<LLSpinCtrl>(prefix + "ScaleU");
LLSpinCtrl * ctrlTexScaleT = mPanel->getChild<LLSpinCtrl>(prefix + "ScaleV");
LLSpinCtrl * ctrlTexOffsetS = mPanel->getChild<LLSpinCtrl>(prefix + "OffsetU");
LLSpinCtrl * ctrlTexOffsetT = mPanel->getChild<LLSpinCtrl>(prefix + "OffsetV");
LLSpinCtrl * ctrlTexRotation = mPanel->getChild<LLSpinCtrl>(prefix + "Rot");
- LLComboBox* comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen");
- LLCheckBoxCtrl* cb_planar_align = mPanel->getChild<LLCheckBoxCtrl>("checkbox planar align");
- bool align_planar = (cb_planar_align && cb_planar_align->get());
-
- llassert(comboTexGen);
- llassert(object);
-
- if (ctrlTexScaleS)
- {
- valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative();
- if (valid || align_planar)
- {
- value = ctrlTexScaleS->get();
- if (comboTexGen &&
- comboTexGen->getCurrentIndex() == 1)
- {
- value *= 0.5f;
- }
- object->setTEScaleS( te, value );
-
- if (align_planar)
- {
- LLPanelFace::LLSelectedTEMaterial::setNormalRepeatX(mPanel, value, te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatX(mPanel, value, te, object->getID());
- }
- }
- }
-
- if (ctrlTexScaleT)
- {
- valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative();
- if (valid || align_planar)
- {
- value = ctrlTexScaleT->get();
- //if( checkFlipScaleT->get() )
- //{
- // value = -value;
- //}
- if (comboTexGen &&
- comboTexGen->getCurrentIndex() == 1)
- {
- value *= 0.5f;
- }
- object->setTEScaleT( te, value );
-
- if (align_planar)
- {
- LLPanelFace::LLSelectedTEMaterial::setNormalRepeatY(mPanel, value, te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatY(mPanel, value, te, object->getID());
- }
- }
- }
-
- if (ctrlTexOffsetS)
- {
- valid = !ctrlTexOffsetS->getTentative();
- if (valid || align_planar)
- {
- value = ctrlTexOffsetS->get();
- object->setTEOffsetS( te, value );
-
- if (align_planar)
- {
- LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, value, te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, value, te, object->getID());
- }
- }
- }
-
- if (ctrlTexOffsetT)
- {
- valid = !ctrlTexOffsetT->getTentative();
- if (valid || align_planar)
- {
- value = ctrlTexOffsetT->get();
- object->setTEOffsetT( te, value );
-
- if (align_planar)
- {
- LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, value, te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, value, te, object->getID());
- }
- }
- }
-
- if (ctrlTexRotation)
- {
- valid = !ctrlTexRotation->getTentative();
- if (valid || align_planar)
- {
- value = ctrlTexRotation->get() * DEG_TO_RAD;
- object->setTERotation( te, value );
-
- if (align_planar)
- {
- LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, value, te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, value, te, object->getID());
- }
- }
- }
- return true;
- }
+ LLComboBox* comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen");
+ LLCheckBoxCtrl* cb_planar_align = mPanel->getChild<LLCheckBoxCtrl>("checkbox planar align");
+ bool align_planar = (cb_planar_align && cb_planar_align->get());
+
+ llassert(comboTexGen);
+ llassert(object);
+
+ if (ctrlTexScaleS)
+ {
+ valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative();
+ if (valid || align_planar)
+ {
+ value = ctrlTexScaleS->get();
+ if (comboTexGen &&
+ comboTexGen->getCurrentIndex() == 1)
+ {
+ value *= 0.5f;
+ }
+ object->setTEScaleS( te, value );
+
+ if (align_planar)
+ {
+ LLPanelFace::LLSelectedTEMaterial::setNormalRepeatX(mPanel, value, te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatX(mPanel, value, te, object->getID());
+ }
+ }
+ }
+
+ if (ctrlTexScaleT)
+ {
+ valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative();
+ if (valid || align_planar)
+ {
+ value = ctrlTexScaleT->get();
+ //if( checkFlipScaleT->get() )
+ //{
+ // value = -value;
+ //}
+ if (comboTexGen &&
+ comboTexGen->getCurrentIndex() == 1)
+ {
+ value *= 0.5f;
+ }
+ object->setTEScaleT( te, value );
+
+ if (align_planar)
+ {
+ LLPanelFace::LLSelectedTEMaterial::setNormalRepeatY(mPanel, value, te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatY(mPanel, value, te, object->getID());
+ }
+ }
+ }
+
+ if (ctrlTexOffsetS)
+ {
+ valid = !ctrlTexOffsetS->getTentative();
+ if (valid || align_planar)
+ {
+ value = ctrlTexOffsetS->get();
+ object->setTEOffsetS( te, value );
+
+ if (align_planar)
+ {
+ LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, value, te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, value, te, object->getID());
+ }
+ }
+ }
+
+ if (ctrlTexOffsetT)
+ {
+ valid = !ctrlTexOffsetT->getTentative();
+ if (valid || align_planar)
+ {
+ value = ctrlTexOffsetT->get();
+ object->setTEOffsetT( te, value );
+
+ if (align_planar)
+ {
+ LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, value, te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, value, te, object->getID());
+ }
+ }
+ }
+
+ if (ctrlTexRotation)
+ {
+ valid = !ctrlTexRotation->getTentative();
+ if (valid || align_planar)
+ {
+ value = ctrlTexRotation->get() * DEG_TO_RAD;
+ object->setTERotation( te, value );
+
+ if (align_planar)
+ {
+ LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, value, te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, value, te, object->getID());
+ }
+ }
+ }
+ return true;
+ }
private:
- LLPanelFace* mPanel;
+ LLPanelFace* mPanel;
};
// Functor that aligns a face to mCenterFace
struct LLPanelFaceSetAlignedTEFunctor : public LLSelectedTEFunctor
{
- LLPanelFaceSetAlignedTEFunctor(LLPanelFace* panel, LLFace* center_face) :
- mPanel(panel),
- mCenterFace(center_face) {}
-
- virtual bool apply(LLViewerObject* object, S32 te)
- {
- LLFace* facep = object->mDrawable->getFace(te);
- if (!facep)
- {
- return true;
- }
-
- if (facep->getViewerObject()->getVolume()->getNumVolumeFaces() <= te)
- {
- return true;
- }
-
- bool set_aligned = true;
- if (facep == mCenterFace)
- {
- set_aligned = false;
- }
- if (set_aligned)
- {
- LLVector2 uv_offset, uv_scale;
- F32 uv_rot;
- set_aligned = facep->calcAlignedPlanarTE(mCenterFace, &uv_offset, &uv_scale, &uv_rot);
- if (set_aligned)
- {
- object->setTEOffset(te, uv_offset.mV[VX], uv_offset.mV[VY]);
- object->setTEScale(te, uv_scale.mV[VX], uv_scale.mV[VY]);
- object->setTERotation(te, uv_rot);
-
- LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, uv_rot, te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, uv_rot, te, object->getID());
-
- LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, uv_offset.mV[VX], te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, uv_offset.mV[VY], te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setNormalRepeatX(mPanel, uv_scale.mV[VX], te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setNormalRepeatY(mPanel, uv_scale.mV[VY], te, object->getID());
-
- LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, uv_offset.mV[VX], te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, uv_offset.mV[VY], te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatX(mPanel, uv_scale.mV[VX], te, object->getID());
- LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatY(mPanel, uv_scale.mV[VY], te, object->getID());
- }
- }
- if (!set_aligned)
- {
- LLPanelFaceSetTEFunctor setfunc(mPanel);
- setfunc.apply(object, te);
- }
- return true;
- }
+ LLPanelFaceSetAlignedTEFunctor(LLPanelFace* panel, LLFace* center_face) :
+ mPanel(panel),
+ mCenterFace(center_face) {}
+
+ virtual bool apply(LLViewerObject* object, S32 te)
+ {
+ LLFace* facep = object->mDrawable->getFace(te);
+ if (!facep)
+ {
+ return true;
+ }
+
+ if (facep->getViewerObject()->getVolume()->getNumVolumeFaces() <= te)
+ {
+ return true;
+ }
+
+ bool set_aligned = true;
+ if (facep == mCenterFace)
+ {
+ set_aligned = false;
+ }
+ if (set_aligned)
+ {
+ LLVector2 uv_offset, uv_scale;
+ F32 uv_rot;
+ set_aligned = facep->calcAlignedPlanarTE(mCenterFace, &uv_offset, &uv_scale, &uv_rot);
+ if (set_aligned)
+ {
+ object->setTEOffset(te, uv_offset.mV[VX], uv_offset.mV[VY]);
+ object->setTEScale(te, uv_scale.mV[VX], uv_scale.mV[VY]);
+ object->setTERotation(te, uv_rot);
+
+ LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, uv_rot, te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, uv_rot, te, object->getID());
+
+ LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, uv_offset.mV[VX], te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, uv_offset.mV[VY], te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setNormalRepeatX(mPanel, uv_scale.mV[VX], te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setNormalRepeatY(mPanel, uv_scale.mV[VY], te, object->getID());
+
+ LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, uv_offset.mV[VX], te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, uv_offset.mV[VY], te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatX(mPanel, uv_scale.mV[VX], te, object->getID());
+ LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatY(mPanel, uv_scale.mV[VY], te, object->getID());
+ }
+ }
+ if (!set_aligned)
+ {
+ LLPanelFaceSetTEFunctor setfunc(mPanel);
+ setfunc.apply(object, te);
+ }
+ return true;
+ }
private:
- LLPanelFace* mPanel;
- LLFace* mCenterFace;
+ LLPanelFace* mPanel;
+ LLFace* mCenterFace;
};
struct LLPanelFaceSetAlignedConcreteTEFunctor : public LLSelectedTEFunctor
@@ -902,7 +902,7 @@ struct LLPanelFaceSetAlignedConcreteTEFunctor : public LLSelectedTEFunctor
}
}
}
-
+
return true;
}
private:
@@ -914,36 +914,36 @@ private:
// Functor that tests if a face is aligned to mCenterFace
struct LLPanelFaceGetIsAlignedTEFunctor : public LLSelectedTEFunctor
{
- LLPanelFaceGetIsAlignedTEFunctor(LLFace* center_face) :
- mCenterFace(center_face) {}
-
- virtual bool apply(LLViewerObject* object, S32 te)
- {
- LLFace* facep = object->mDrawable->getFace(te);
- if (!facep)
- {
- return false;
- }
-
- if (facep->getViewerObject()->getVolume()->getNumVolumeFaces() <= te)
- { //volume face does not exist, can't be aligned
- return false;
- }
-
- if (facep == mCenterFace)
- {
- return true;
- }
-
- LLVector2 aligned_st_offset, aligned_st_scale;
- F32 aligned_st_rot;
- if ( facep->calcAlignedPlanarTE(mCenterFace, &aligned_st_offset, &aligned_st_scale, &aligned_st_rot) )
- {
- const LLTextureEntry* tep = facep->getTextureEntry();
- LLVector2 st_offset, st_scale;
- tep->getOffset(&st_offset.mV[VX], &st_offset.mV[VY]);
- tep->getScale(&st_scale.mV[VX], &st_scale.mV[VY]);
- F32 st_rot = tep->getRotation();
+ LLPanelFaceGetIsAlignedTEFunctor(LLFace* center_face) :
+ mCenterFace(center_face) {}
+
+ virtual bool apply(LLViewerObject* object, S32 te)
+ {
+ LLFace* facep = object->mDrawable->getFace(te);
+ if (!facep)
+ {
+ return false;
+ }
+
+ if (facep->getViewerObject()->getVolume()->getNumVolumeFaces() <= te)
+ { //volume face does not exist, can't be aligned
+ return false;
+ }
+
+ if (facep == mCenterFace)
+ {
+ return true;
+ }
+
+ LLVector2 aligned_st_offset, aligned_st_scale;
+ F32 aligned_st_rot;
+ if ( facep->calcAlignedPlanarTE(mCenterFace, &aligned_st_offset, &aligned_st_scale, &aligned_st_rot) )
+ {
+ const LLTextureEntry* tep = facep->getTextureEntry();
+ LLVector2 st_offset, st_scale;
+ tep->getOffset(&st_offset.mV[VX], &st_offset.mV[VY]);
+ tep->getScale(&st_scale.mV[VX], &st_scale.mV[VY]);
+ F32 st_rot = tep->getRotation();
bool eq_offset_x = is_approx_equal_fraction(st_offset.mV[VX], aligned_st_offset.mV[VX], 12);
bool eq_offset_y = is_approx_equal_fraction(st_offset.mV[VY], aligned_st_offset.mV[VY], 12);
@@ -951,49 +951,49 @@ struct LLPanelFaceGetIsAlignedTEFunctor : public LLSelectedTEFunctor
bool eq_scale_y = is_approx_equal_fraction(st_scale.mV[VY], aligned_st_scale.mV[VY], 12);
bool eq_rot = is_approx_equal_fraction(st_rot, aligned_st_rot, 6);
- // needs a fuzzy comparison, because of fp errors
- if (eq_offset_x &&
- eq_offset_y &&
- eq_scale_x &&
- eq_scale_y &&
- eq_rot)
- {
- return true;
- }
- }
- return false;
- }
+ // needs a fuzzy comparison, because of fp errors
+ if (eq_offset_x &&
+ eq_offset_y &&
+ eq_scale_x &&
+ eq_scale_y &&
+ eq_rot)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
private:
- LLFace* mCenterFace;
+ LLFace* mCenterFace;
};
struct LLPanelFaceSendFunctor : public LLSelectedObjectFunctor
{
- virtual bool apply(LLViewerObject* object)
- {
- object->sendTEUpdate();
- return true;
- }
+ virtual bool apply(LLViewerObject* object)
+ {
+ object->sendTEUpdate();
+ return true;
+ }
};
void LLPanelFace::sendTextureInfo()
{
- if ((bool)childGetValue("checkbox planar align").asBoolean())
- {
- LLFace* last_face = NULL;
- bool identical_face =false;
- LLSelectedTE::getFace(last_face, identical_face);
- LLPanelFaceSetAlignedTEFunctor setfunc(this, last_face);
- LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc);
- }
- else
- {
- LLPanelFaceSetTEFunctor setfunc(this);
- LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc);
- }
+ if ((bool)childGetValue("checkbox planar align").asBoolean())
+ {
+ LLFace* last_face = NULL;
+ bool identical_face =false;
+ LLSelectedTE::getFace(last_face, identical_face);
+ LLPanelFaceSetAlignedTEFunctor setfunc(this, last_face);
+ LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc);
+ }
+ else
+ {
+ LLPanelFaceSetTEFunctor setfunc(this);
+ LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc);
+ }
- LLPanelFaceSendFunctor sendfunc;
- LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc);
+ LLPanelFaceSendFunctor sendfunc;
+ LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc);
}
void LLPanelFace::alignTestureLayer()
@@ -1009,19 +1009,19 @@ void LLPanelFace::alignTestureLayer()
void LLPanelFace::getState()
{
- updateUI();
+ updateUI();
}
void LLPanelFace::updateUI(bool force_set_values /*false*/)
{ //set state of UI to match state of texture entry(ies) (calls setEnabled, setValue, etc, but NOT setVisible)
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode();
- LLViewerObject* objectp = node ? node->getObject() : NULL;
+ LLViewerObject* objectp = node ? node->getObject() : NULL;
- if (objectp
- && objectp->getPCode() == LL_PCODE_VOLUME
- && objectp->permModify())
- {
- BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced();
+ if (objectp
+ && objectp->getPCode() == LL_PCODE_VOLUME
+ && objectp->permModify())
+ {
+ BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced();
BOOL attachment = objectp->isAttachment();
bool has_pbr_material;
@@ -1030,9 +1030,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
const bool has_material = !has_pbr_material;
- // only turn on auto-adjust button if there is a media renderer and the media is loaded
+ // only turn on auto-adjust button if there is a media renderer and the media is loaded
childSetEnabled("button align", editable);
-
+
if (mComboMatMedia->getCurrentIndex() < MATMEDIA_MATERIAL)
{
// When selecting an object with a pbr and UI combo is not set,
@@ -1069,8 +1069,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
static S32 selected_te = -1;
static LLUUID prev_obj_id;
- if ((LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()) &&
- !LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected())
+ if ((LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()) &&
+ !LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected())
{
S32 new_selection = -1; // Don't use getLastSelectedTE, it could have been deselected
S32 num_tes = llmin((S32)objectp->getNumTEs(), (S32)objectp->getNumFaces());
@@ -1093,11 +1093,11 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
{
mComboMatMedia->selectNthItem(MATMEDIA_PBR);
}
- else if (te_has_media)
+ else if (te_has_media)
{
mComboMatMedia->selectNthItem(MATMEDIA_MEDIA);
}
- else if (id.notNull() || normmap_id.notNull() || specmap_id.notNull())
+ else if (id.notNull() || normmap_id.notNull() || specmap_id.notNull())
{
mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL);
}
@@ -1105,11 +1105,11 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
prev_obj_id = objectp->getID();
}
}
- else
+ else
{
if (prev_obj_id != objectp->getID())
{
- if (has_pbr_material && (mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL))
+ if (has_pbr_material && (mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL))
{
mComboMatMedia->selectNthItem(MATMEDIA_PBR);
}
@@ -1138,24 +1138,24 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
const bool pbr_selected = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR;
const bool texture_info_selected = pbr_selected && radio_pbr_type->getSelectedIndex() != PBRTYPE_RENDER_MATERIAL_ID;
- getChildView("checkbox_sync_settings")->setEnabled(editable);
- childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings"));
+ getChildView("checkbox_sync_settings")->setEnabled(editable);
+ childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings"));
- updateVisibility(objectp);
+ updateVisibility(objectp);
- // Color swatch
- {
- getChildView("color label")->setEnabled(editable);
- }
- LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>("colorswatch");
+ // Color swatch
+ {
+ getChildView("color label")->setEnabled(editable);
+ }
+ LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>("colorswatch");
- LLColor4 color = LLColor4::white;
- bool identical_color = false;
+ LLColor4 color = LLColor4::white;
+ bool identical_color = false;
- if (color_swatch)
- {
- LLSelectedTE::getColor(color, identical_color);
- LLColor4 prev_color = color_swatch->get();
+ if (color_swatch)
+ {
+ LLSelectedTE::getColor(color, identical_color);
+ LLColor4 prev_color = color_swatch->get();
color_swatch->setOriginal(color);
color_swatch->set(color, force_set_values || (prev_color != color) || !editable);
@@ -1163,179 +1163,179 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
color_swatch->setValid(editable && !has_pbr_material);
color_swatch->setEnabled( editable && !has_pbr_material);
color_swatch->setCanApplyImmediately( editable && !has_pbr_material);
- }
-
- // Color transparency
- getChildView("color trans")->setEnabled(editable);
-
- F32 transparency = (1.f - color.mV[VALPHA]) * 100.f;
- getChild<LLUICtrl>("ColorTrans")->setValue(editable ? transparency : 0);
- getChildView("ColorTrans")->setEnabled(editable && has_material);
-
- U8 shiny = 0;
- bool identical_shiny = false;
-
- // Shiny
- LLSelectedTE::getShiny(shiny, identical_shiny);
- identical = identical && identical_shiny;
-
- shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE;
-
- LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess");
- if (combobox_shininess)
- {
- combobox_shininess->selectNthItem((S32)shiny);
- }
-
- getChildView("label shininess")->setEnabled(editable);
- getChildView("combobox shininess")->setEnabled(editable);
-
- getChildView("label glossiness")->setEnabled(editable);
- getChildView("glossiness")->setEnabled(editable);
-
- getChildView("label environment")->setEnabled(editable);
- getChildView("environment")->setEnabled(editable);
- getChildView("label shinycolor")->setEnabled(editable);
-
- getChild<LLUICtrl>("combobox shininess")->setTentative(!identical_spec);
- getChild<LLUICtrl>("glossiness")->setTentative(!identical_spec);
- getChild<LLUICtrl>("environment")->setTentative(!identical_spec);
- getChild<LLUICtrl>("shinycolorswatch")->setTentative(!identical_spec);
-
- LLColorSwatchCtrl* mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch");
- if (mShinyColorSwatch)
- {
- mShinyColorSwatch->setValid(editable);
- mShinyColorSwatch->setEnabled( editable );
- mShinyColorSwatch->setCanApplyImmediately( editable );
- }
-
- U8 bumpy = 0;
- // Bumpy
- {
- bool identical_bumpy = false;
- LLSelectedTE::getBumpmap(bumpy,identical_bumpy);
-
- LLUUID norm_map_id = getCurrentNormalMap();
- LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness");
-
- bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE;
-
- if (combobox_bumpiness)
- {
- combobox_bumpiness->selectNthItem((S32)bumpy);
- }
- else
- {
- LL_WARNS() << "failed childGetSelectionInterface for 'combobox bumpiness'" << LL_ENDL;
- }
-
- getChildView("combobox bumpiness")->setEnabled(editable);
- getChild<LLUICtrl>("combobox bumpiness")->setTentative(!identical_bumpy);
- getChildView("label bumpiness")->setEnabled(editable);
- }
-
- // Texture
- {
- mIsAlpha = FALSE;
- LLGLenum image_format = GL_RGB;
- bool identical_image_format = false;
- LLSelectedTE::getImageFormat(image_format, identical_image_format);
-
- mIsAlpha = FALSE;
- switch (image_format)
- {
- case GL_RGBA:
- case GL_ALPHA:
- {
- mIsAlpha = TRUE;
- }
- break;
-
- case GL_RGB: break;
- default:
- {
- LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL;
- }
- break;
- }
-
- if (LLViewerMedia::getInstance()->textureHasMedia(id))
- {
- getChildView("button align")->setEnabled(editable);
- }
-
- // Diffuse Alpha Mode
-
- // Init to the default that is appropriate for the alpha content of the asset
- //
- U8 alpha_mode = mIsAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
-
- bool identical_alpha_mode = false;
-
- // See if that's been overridden by a material setting for same...
- //
- LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(alpha_mode, identical_alpha_mode, mIsAlpha);
-
- LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode");
- if (combobox_alphamode)
- {
- //it is invalid to have any alpha mode other than blend if transparency is greater than zero ...
- // Want masking? Want emissive? Tough! You get BLEND!
- alpha_mode = (transparency > 0.f) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : alpha_mode;
-
- // ... unless there is no alpha channel in the texture, in which case alpha mode MUST be none
- alpha_mode = mIsAlpha ? alpha_mode : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
-
- combobox_alphamode->selectNthItem(alpha_mode);
- }
- else
- {
- LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL;
- }
-
- updateAlphaControls();
-
- if (texture_ctrl)
- {
- if (identical_diffuse)
- {
- texture_ctrl->setTentative(FALSE);
- texture_ctrl->setEnabled(editable && !has_pbr_material);
- texture_ctrl->setImageAssetID(id);
- getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material);
- getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material);
- getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
- getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
-
- texture_ctrl->setBakeTextureEnabled(TRUE);
- }
- else if (id.isNull())
- {
- // None selected
- texture_ctrl->setTentative(FALSE);
- texture_ctrl->setEnabled(FALSE);
- texture_ctrl->setImageAssetID(LLUUID::null);
- getChildView("combobox alphamode")->setEnabled(FALSE);
- getChildView("label alphamode")->setEnabled(FALSE);
- getChildView("maskcutoff")->setEnabled(FALSE);
- getChildView("label maskcutoff")->setEnabled(FALSE);
-
- texture_ctrl->setBakeTextureEnabled(false);
- }
- else
- {
- // Tentative: multiple selected with different textures
- texture_ctrl->setTentative(TRUE);
- texture_ctrl->setEnabled(editable && !has_pbr_material);
- texture_ctrl->setImageAssetID(id);
- getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material);
- getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material);
- getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
- getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
-
- texture_ctrl->setBakeTextureEnabled(TRUE);
- }
+ }
+
+ // Color transparency
+ getChildView("color trans")->setEnabled(editable);
+
+ F32 transparency = (1.f - color.mV[VALPHA]) * 100.f;
+ getChild<LLUICtrl>("ColorTrans")->setValue(editable ? transparency : 0);
+ getChildView("ColorTrans")->setEnabled(editable && has_material);
+
+ U8 shiny = 0;
+ bool identical_shiny = false;
+
+ // Shiny
+ LLSelectedTE::getShiny(shiny, identical_shiny);
+ identical = identical && identical_shiny;
+
+ shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE;
+
+ LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess");
+ if (combobox_shininess)
+ {
+ combobox_shininess->selectNthItem((S32)shiny);
+ }
+
+ getChildView("label shininess")->setEnabled(editable);
+ getChildView("combobox shininess")->setEnabled(editable);
+
+ getChildView("label glossiness")->setEnabled(editable);
+ getChildView("glossiness")->setEnabled(editable);
+
+ getChildView("label environment")->setEnabled(editable);
+ getChildView("environment")->setEnabled(editable);
+ getChildView("label shinycolor")->setEnabled(editable);
+
+ getChild<LLUICtrl>("combobox shininess")->setTentative(!identical_spec);
+ getChild<LLUICtrl>("glossiness")->setTentative(!identical_spec);
+ getChild<LLUICtrl>("environment")->setTentative(!identical_spec);
+ getChild<LLUICtrl>("shinycolorswatch")->setTentative(!identical_spec);
+
+ LLColorSwatchCtrl* mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch");
+ if (mShinyColorSwatch)
+ {
+ mShinyColorSwatch->setValid(editable);
+ mShinyColorSwatch->setEnabled( editable );
+ mShinyColorSwatch->setCanApplyImmediately( editable );
+ }
+
+ U8 bumpy = 0;
+ // Bumpy
+ {
+ bool identical_bumpy = false;
+ LLSelectedTE::getBumpmap(bumpy,identical_bumpy);
+
+ LLUUID norm_map_id = getCurrentNormalMap();
+ LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness");
+
+ bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE;
+
+ if (combobox_bumpiness)
+ {
+ combobox_bumpiness->selectNthItem((S32)bumpy);
+ }
+ else
+ {
+ LL_WARNS() << "failed childGetSelectionInterface for 'combobox bumpiness'" << LL_ENDL;
+ }
+
+ getChildView("combobox bumpiness")->setEnabled(editable);
+ getChild<LLUICtrl>("combobox bumpiness")->setTentative(!identical_bumpy);
+ getChildView("label bumpiness")->setEnabled(editable);
+ }
+
+ // Texture
+ {
+ mIsAlpha = FALSE;
+ LLGLenum image_format = GL_RGB;
+ bool identical_image_format = false;
+ LLSelectedTE::getImageFormat(image_format, identical_image_format);
+
+ mIsAlpha = FALSE;
+ switch (image_format)
+ {
+ case GL_RGBA:
+ case GL_ALPHA:
+ {
+ mIsAlpha = TRUE;
+ }
+ break;
+
+ case GL_RGB: break;
+ default:
+ {
+ LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL;
+ }
+ break;
+ }
+
+ if (LLViewerMedia::getInstance()->textureHasMedia(id))
+ {
+ getChildView("button align")->setEnabled(editable);
+ }
+
+ // Diffuse Alpha Mode
+
+ // Init to the default that is appropriate for the alpha content of the asset
+ //
+ U8 alpha_mode = mIsAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+
+ bool identical_alpha_mode = false;
+
+ // See if that's been overridden by a material setting for same...
+ //
+ LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(alpha_mode, identical_alpha_mode, mIsAlpha);
+
+ LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode");
+ if (combobox_alphamode)
+ {
+ //it is invalid to have any alpha mode other than blend if transparency is greater than zero ...
+ // Want masking? Want emissive? Tough! You get BLEND!
+ alpha_mode = (transparency > 0.f) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : alpha_mode;
+
+ // ... unless there is no alpha channel in the texture, in which case alpha mode MUST be none
+ alpha_mode = mIsAlpha ? alpha_mode : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+
+ combobox_alphamode->selectNthItem(alpha_mode);
+ }
+ else
+ {
+ LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL;
+ }
+
+ updateAlphaControls();
+
+ if (texture_ctrl)
+ {
+ if (identical_diffuse)
+ {
+ texture_ctrl->setTentative(FALSE);
+ texture_ctrl->setEnabled(editable && !has_pbr_material);
+ texture_ctrl->setImageAssetID(id);
+ getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material);
+ getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material);
+ getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
+ getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
+
+ texture_ctrl->setBakeTextureEnabled(TRUE);
+ }
+ else if (id.isNull())
+ {
+ // None selected
+ texture_ctrl->setTentative(FALSE);
+ texture_ctrl->setEnabled(FALSE);
+ texture_ctrl->setImageAssetID(LLUUID::null);
+ getChildView("combobox alphamode")->setEnabled(FALSE);
+ getChildView("label alphamode")->setEnabled(FALSE);
+ getChildView("maskcutoff")->setEnabled(FALSE);
+ getChildView("label maskcutoff")->setEnabled(FALSE);
+
+ texture_ctrl->setBakeTextureEnabled(false);
+ }
+ else
+ {
+ // Tentative: multiple selected with different textures
+ texture_ctrl->setTentative(TRUE);
+ texture_ctrl->setEnabled(editable && !has_pbr_material);
+ texture_ctrl->setImageAssetID(id);
+ getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material);
+ getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material);
+ getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
+ getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material);
+
+ texture_ctrl->setBakeTextureEnabled(TRUE);
+ }
if (attachment)
{
@@ -1348,13 +1348,13 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
{
texture_ctrl->setImmediateFilterPermMask(PERM_NONE);
}
- }
+ }
- if (shinytexture_ctrl)
- {
- shinytexture_ctrl->setTentative( !identical_spec );
- shinytexture_ctrl->setEnabled( editable && !has_pbr_material);
- shinytexture_ctrl->setImageAssetID( specmap_id );
+ if (shinytexture_ctrl)
+ {
+ shinytexture_ctrl->setTentative( !identical_spec );
+ shinytexture_ctrl->setEnabled( editable && !has_pbr_material);
+ shinytexture_ctrl->setImageAssetID( specmap_id );
if (attachment)
{
@@ -1364,13 +1364,13 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
{
shinytexture_ctrl->setImmediateFilterPermMask(PERM_NONE);
}
- }
+ }
- if (bumpytexture_ctrl)
- {
- bumpytexture_ctrl->setTentative( !identical_norm );
- bumpytexture_ctrl->setEnabled( editable && !has_pbr_material);
- bumpytexture_ctrl->setImageAssetID( normmap_id );
+ if (bumpytexture_ctrl)
+ {
+ bumpytexture_ctrl->setTentative( !identical_norm );
+ bumpytexture_ctrl->setEnabled( editable && !has_pbr_material);
+ bumpytexture_ctrl->setImageAssetID( normmap_id );
if (attachment)
{
@@ -1380,292 +1380,292 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
{
bumpytexture_ctrl->setImmediateFilterPermMask(PERM_NONE);
}
- }
- }
-
- // planar align
- bool align_planar = false;
- bool identical_planar_aligned = false;
- {
- LLCheckBoxCtrl* cb_planar_align = getChild<LLCheckBoxCtrl>("checkbox planar align");
- align_planar = (cb_planar_align && cb_planar_align->get());
-
- bool enabled = (editable && isIdenticalPlanarTexgen() && !texture_info_selected);
- childSetValue("checkbox planar align", align_planar && enabled);
+ }
+ }
+
+ // planar align
+ bool align_planar = false;
+ bool identical_planar_aligned = false;
+ {
+ LLCheckBoxCtrl* cb_planar_align = getChild<LLCheckBoxCtrl>("checkbox planar align");
+ align_planar = (cb_planar_align && cb_planar_align->get());
+
+ bool enabled = (editable && isIdenticalPlanarTexgen() && !texture_info_selected);
+ childSetValue("checkbox planar align", align_planar && enabled);
childSetVisible("checkbox planar align", enabled);
- childSetEnabled("checkbox planar align", enabled);
- childSetEnabled("button align textures", enabled && LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1);
-
- if (align_planar && enabled)
- {
- LLFace* last_face = NULL;
- bool identical_face = false;
- LLSelectedTE::getFace(last_face, identical_face);
-
- LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face);
- // this will determine if the texture param controls are tentative:
- identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func);
- }
- }
-
- // Needs to be public and before tex scale settings below to properly reflect
- // behavior when in planar vs default texgen modes in the
- // NORSPEC-84 et al
- //
- LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT;
- bool identical_texgen = true;
- bool identical_planar_texgen = false;
-
- {
- LLSelectedTE::getTexGen(selected_texgen, identical_texgen);
- identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR));
- }
-
- // Texture scale
- {
- bool identical_diff_scale_s = false;
- bool identical_spec_scale_s = false;
- bool identical_norm_scale_s = false;
-
- identical = align_planar ? identical_planar_aligned : identical;
-
- F32 diff_scale_s = 1.f;
- F32 spec_scale_s = 1.f;
- F32 norm_scale_s = 1.f;
-
- LLSelectedTE::getScaleS(diff_scale_s, identical_diff_scale_s);
- LLSelectedTEMaterial::getSpecularRepeatX(spec_scale_s, identical_spec_scale_s);
- LLSelectedTEMaterial::getNormalRepeatX(norm_scale_s, identical_norm_scale_s);
-
- diff_scale_s = editable ? diff_scale_s : 1.0f;
- diff_scale_s *= identical_planar_texgen ? 2.0f : 1.0f;
-
- norm_scale_s = editable ? norm_scale_s : 1.0f;
- norm_scale_s *= identical_planar_texgen ? 2.0f : 1.0f;
-
- spec_scale_s = editable ? spec_scale_s : 1.0f;
- spec_scale_s *= identical_planar_texgen ? 2.0f : 1.0f;
-
- getChild<LLUICtrl>("TexScaleU")->setValue(diff_scale_s);
- getChild<LLUICtrl>("shinyScaleU")->setValue(spec_scale_s);
- getChild<LLUICtrl>("bumpyScaleU")->setValue(norm_scale_s);
+ childSetEnabled("checkbox planar align", enabled);
+ childSetEnabled("button align textures", enabled && LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1);
+
+ if (align_planar && enabled)
+ {
+ LLFace* last_face = NULL;
+ bool identical_face = false;
+ LLSelectedTE::getFace(last_face, identical_face);
+
+ LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face);
+ // this will determine if the texture param controls are tentative:
+ identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func);
+ }
+ }
+
+ // Needs to be public and before tex scale settings below to properly reflect
+ // behavior when in planar vs default texgen modes in the
+ // NORSPEC-84 et al
+ //
+ LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT;
+ bool identical_texgen = true;
+ bool identical_planar_texgen = false;
+
+ {
+ LLSelectedTE::getTexGen(selected_texgen, identical_texgen);
+ identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR));
+ }
+
+ // Texture scale
+ {
+ bool identical_diff_scale_s = false;
+ bool identical_spec_scale_s = false;
+ bool identical_norm_scale_s = false;
+
+ identical = align_planar ? identical_planar_aligned : identical;
+
+ F32 diff_scale_s = 1.f;
+ F32 spec_scale_s = 1.f;
+ F32 norm_scale_s = 1.f;
+
+ LLSelectedTE::getScaleS(diff_scale_s, identical_diff_scale_s);
+ LLSelectedTEMaterial::getSpecularRepeatX(spec_scale_s, identical_spec_scale_s);
+ LLSelectedTEMaterial::getNormalRepeatX(norm_scale_s, identical_norm_scale_s);
+
+ diff_scale_s = editable ? diff_scale_s : 1.0f;
+ diff_scale_s *= identical_planar_texgen ? 2.0f : 1.0f;
+
+ norm_scale_s = editable ? norm_scale_s : 1.0f;
+ norm_scale_s *= identical_planar_texgen ? 2.0f : 1.0f;
+
+ spec_scale_s = editable ? spec_scale_s : 1.0f;
+ spec_scale_s *= identical_planar_texgen ? 2.0f : 1.0f;
+
+ getChild<LLUICtrl>("TexScaleU")->setValue(diff_scale_s);
+ getChild<LLUICtrl>("shinyScaleU")->setValue(spec_scale_s);
+ getChild<LLUICtrl>("bumpyScaleU")->setValue(norm_scale_s);
getChildView("TexScaleU")->setEnabled(editable && has_material);
getChildView("shinyScaleU")->setEnabled(editable && has_material && specmap_id.notNull());
getChildView("bumpyScaleU")->setEnabled(editable && has_material && normmap_id.notNull());
- BOOL diff_scale_tentative = !(identical && identical_diff_scale_s);
- BOOL norm_scale_tentative = !(identical && identical_norm_scale_s);
- BOOL spec_scale_tentative = !(identical && identical_spec_scale_s);
+ BOOL diff_scale_tentative = !(identical && identical_diff_scale_s);
+ BOOL norm_scale_tentative = !(identical && identical_norm_scale_s);
+ BOOL spec_scale_tentative = !(identical && identical_spec_scale_s);
- getChild<LLUICtrl>("TexScaleU")->setTentative( LLSD(diff_scale_tentative));
- getChild<LLUICtrl>("shinyScaleU")->setTentative(LLSD(spec_scale_tentative));
- getChild<LLUICtrl>("bumpyScaleU")->setTentative(LLSD(norm_scale_tentative));
- }
+ getChild<LLUICtrl>("TexScaleU")->setTentative( LLSD(diff_scale_tentative));
+ getChild<LLUICtrl>("shinyScaleU")->setTentative(LLSD(spec_scale_tentative));
+ getChild<LLUICtrl>("bumpyScaleU")->setTentative(LLSD(norm_scale_tentative));
+ }
- {
- bool identical_diff_scale_t = false;
- bool identical_spec_scale_t = false;
- bool identical_norm_scale_t = false;
+ {
+ bool identical_diff_scale_t = false;
+ bool identical_spec_scale_t = false;
+ bool identical_norm_scale_t = false;
- F32 diff_scale_t = 1.f;
- F32 spec_scale_t = 1.f;
- F32 norm_scale_t = 1.f;
+ F32 diff_scale_t = 1.f;
+ F32 spec_scale_t = 1.f;
+ F32 norm_scale_t = 1.f;
- LLSelectedTE::getScaleT(diff_scale_t, identical_diff_scale_t);
- LLSelectedTEMaterial::getSpecularRepeatY(spec_scale_t, identical_spec_scale_t);
- LLSelectedTEMaterial::getNormalRepeatY(norm_scale_t, identical_norm_scale_t);
+ LLSelectedTE::getScaleT(diff_scale_t, identical_diff_scale_t);
+ LLSelectedTEMaterial::getSpecularRepeatY(spec_scale_t, identical_spec_scale_t);
+ LLSelectedTEMaterial::getNormalRepeatY(norm_scale_t, identical_norm_scale_t);
- diff_scale_t = editable ? diff_scale_t : 1.0f;
- diff_scale_t *= identical_planar_texgen ? 2.0f : 1.0f;
+ diff_scale_t = editable ? diff_scale_t : 1.0f;
+ diff_scale_t *= identical_planar_texgen ? 2.0f : 1.0f;
- norm_scale_t = editable ? norm_scale_t : 1.0f;
- norm_scale_t *= identical_planar_texgen ? 2.0f : 1.0f;
+ norm_scale_t = editable ? norm_scale_t : 1.0f;
+ norm_scale_t *= identical_planar_texgen ? 2.0f : 1.0f;
- spec_scale_t = editable ? spec_scale_t : 1.0f;
- spec_scale_t *= identical_planar_texgen ? 2.0f : 1.0f;
+ spec_scale_t = editable ? spec_scale_t : 1.0f;
+ spec_scale_t *= identical_planar_texgen ? 2.0f : 1.0f;
- BOOL diff_scale_tentative = !identical_diff_scale_t;
- BOOL norm_scale_tentative = !identical_norm_scale_t;
- BOOL spec_scale_tentative = !identical_spec_scale_t;
+ BOOL diff_scale_tentative = !identical_diff_scale_t;
+ BOOL norm_scale_tentative = !identical_norm_scale_t;
+ BOOL spec_scale_tentative = !identical_spec_scale_t;
getChildView("TexScaleV")->setEnabled(editable && has_material);
getChildView("shinyScaleV")->setEnabled(editable && has_material && specmap_id.notNull());
getChildView("bumpyScaleV")->setEnabled(editable && has_material && normmap_id.notNull());
- if (force_set_values)
- {
- getChild<LLSpinCtrl>("TexScaleV")->forceSetValue(diff_scale_t);
- }
- else
- {
- getChild<LLSpinCtrl>("TexScaleV")->setValue(diff_scale_t);
- }
- getChild<LLUICtrl>("shinyScaleV")->setValue(norm_scale_t);
- getChild<LLUICtrl>("bumpyScaleV")->setValue(spec_scale_t);
-
- getChild<LLUICtrl>("TexScaleV")->setTentative(LLSD(diff_scale_tentative));
- getChild<LLUICtrl>("shinyScaleV")->setTentative(LLSD(norm_scale_tentative));
- getChild<LLUICtrl>("bumpyScaleV")->setTentative(LLSD(spec_scale_tentative));
- }
-
- // Texture offset
- {
- bool identical_diff_offset_s = false;
- bool identical_norm_offset_s = false;
- bool identical_spec_offset_s = false;
-
- F32 diff_offset_s = 0.0f;
- F32 norm_offset_s = 0.0f;
- F32 spec_offset_s = 0.0f;
-
- LLSelectedTE::getOffsetS(diff_offset_s, identical_diff_offset_s);
- LLSelectedTEMaterial::getNormalOffsetX(norm_offset_s, identical_norm_offset_s);
- LLSelectedTEMaterial::getSpecularOffsetX(spec_offset_s, identical_spec_offset_s);
-
- BOOL diff_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_s);
- BOOL norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s);
- BOOL spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s);
-
- getChild<LLUICtrl>("TexOffsetU")->setValue( editable ? diff_offset_s : 0.0f);
- getChild<LLUICtrl>("bumpyOffsetU")->setValue(editable ? norm_offset_s : 0.0f);
- getChild<LLUICtrl>("shinyOffsetU")->setValue(editable ? spec_offset_s : 0.0f);
-
- getChild<LLUICtrl>("TexOffsetU")->setTentative(LLSD(diff_offset_u_tentative));
- getChild<LLUICtrl>("shinyOffsetU")->setTentative(LLSD(norm_offset_u_tentative));
- getChild<LLUICtrl>("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative));
+ if (force_set_values)
+ {
+ getChild<LLSpinCtrl>("TexScaleV")->forceSetValue(diff_scale_t);
+ }
+ else
+ {
+ getChild<LLSpinCtrl>("TexScaleV")->setValue(diff_scale_t);
+ }
+ getChild<LLUICtrl>("shinyScaleV")->setValue(norm_scale_t);
+ getChild<LLUICtrl>("bumpyScaleV")->setValue(spec_scale_t);
+
+ getChild<LLUICtrl>("TexScaleV")->setTentative(LLSD(diff_scale_tentative));
+ getChild<LLUICtrl>("shinyScaleV")->setTentative(LLSD(norm_scale_tentative));
+ getChild<LLUICtrl>("bumpyScaleV")->setTentative(LLSD(spec_scale_tentative));
+ }
+
+ // Texture offset
+ {
+ bool identical_diff_offset_s = false;
+ bool identical_norm_offset_s = false;
+ bool identical_spec_offset_s = false;
+
+ F32 diff_offset_s = 0.0f;
+ F32 norm_offset_s = 0.0f;
+ F32 spec_offset_s = 0.0f;
+
+ LLSelectedTE::getOffsetS(diff_offset_s, identical_diff_offset_s);
+ LLSelectedTEMaterial::getNormalOffsetX(norm_offset_s, identical_norm_offset_s);
+ LLSelectedTEMaterial::getSpecularOffsetX(spec_offset_s, identical_spec_offset_s);
+
+ BOOL diff_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_s);
+ BOOL norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s);
+ BOOL spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s);
+
+ getChild<LLUICtrl>("TexOffsetU")->setValue( editable ? diff_offset_s : 0.0f);
+ getChild<LLUICtrl>("bumpyOffsetU")->setValue(editable ? norm_offset_s : 0.0f);
+ getChild<LLUICtrl>("shinyOffsetU")->setValue(editable ? spec_offset_s : 0.0f);
+
+ getChild<LLUICtrl>("TexOffsetU")->setTentative(LLSD(diff_offset_u_tentative));
+ getChild<LLUICtrl>("shinyOffsetU")->setTentative(LLSD(norm_offset_u_tentative));
+ getChild<LLUICtrl>("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative));
getChildView("TexOffsetU")->setEnabled(editable && has_material);
getChildView("shinyOffsetU")->setEnabled(editable && has_material && specmap_id.notNull());
getChildView("bumpyOffsetU")->setEnabled(editable && has_material && normmap_id.notNull());
- }
+ }
- {
- bool identical_diff_offset_t = false;
- bool identical_norm_offset_t = false;
- bool identical_spec_offset_t = false;
+ {
+ bool identical_diff_offset_t = false;
+ bool identical_norm_offset_t = false;
+ bool identical_spec_offset_t = false;
+
+ F32 diff_offset_t = 0.0f;
+ F32 norm_offset_t = 0.0f;
+ F32 spec_offset_t = 0.0f;
- F32 diff_offset_t = 0.0f;
- F32 norm_offset_t = 0.0f;
- F32 spec_offset_t = 0.0f;
+ LLSelectedTE::getOffsetT(diff_offset_t, identical_diff_offset_t);
+ LLSelectedTEMaterial::getNormalOffsetY(norm_offset_t, identical_norm_offset_t);
+ LLSelectedTEMaterial::getSpecularOffsetY(spec_offset_t, identical_spec_offset_t);
- LLSelectedTE::getOffsetT(diff_offset_t, identical_diff_offset_t);
- LLSelectedTEMaterial::getNormalOffsetY(norm_offset_t, identical_norm_offset_t);
- LLSelectedTEMaterial::getSpecularOffsetY(spec_offset_t, identical_spec_offset_t);
-
- BOOL diff_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_t);
- BOOL norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t);
- BOOL spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t);
+ BOOL diff_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_t);
+ BOOL norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t);
+ BOOL spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t);
- getChild<LLUICtrl>("TexOffsetV")->setValue( editable ? diff_offset_t : 0.0f);
- getChild<LLUICtrl>("bumpyOffsetV")->setValue(editable ? norm_offset_t : 0.0f);
- getChild<LLUICtrl>("shinyOffsetV")->setValue(editable ? spec_offset_t : 0.0f);
+ getChild<LLUICtrl>("TexOffsetV")->setValue( editable ? diff_offset_t : 0.0f);
+ getChild<LLUICtrl>("bumpyOffsetV")->setValue(editable ? norm_offset_t : 0.0f);
+ getChild<LLUICtrl>("shinyOffsetV")->setValue(editable ? spec_offset_t : 0.0f);
- getChild<LLUICtrl>("TexOffsetV")->setTentative(LLSD(diff_offset_v_tentative));
- getChild<LLUICtrl>("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative));
- getChild<LLUICtrl>("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative));
+ getChild<LLUICtrl>("TexOffsetV")->setTentative(LLSD(diff_offset_v_tentative));
+ getChild<LLUICtrl>("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative));
+ getChild<LLUICtrl>("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative));
getChildView("TexOffsetV")->setEnabled(editable && has_material);
getChildView("shinyOffsetV")->setEnabled(editable && has_material && specmap_id.notNull());
getChildView("bumpyOffsetV")->setEnabled(editable && has_material && normmap_id.notNull());
- }
+ }
- // Texture rotation
- {
- bool identical_diff_rotation = false;
- bool identical_norm_rotation = false;
- bool identical_spec_rotation = false;
+ // Texture rotation
+ {
+ bool identical_diff_rotation = false;
+ bool identical_norm_rotation = false;
+ bool identical_spec_rotation = false;
- F32 diff_rotation = 0.f;
- F32 norm_rotation = 0.f;
- F32 spec_rotation = 0.f;
+ F32 diff_rotation = 0.f;
+ F32 norm_rotation = 0.f;
+ F32 spec_rotation = 0.f;
- LLSelectedTE::getRotation(diff_rotation,identical_diff_rotation);
- LLSelectedTEMaterial::getSpecularRotation(spec_rotation,identical_spec_rotation);
- LLSelectedTEMaterial::getNormalRotation(norm_rotation,identical_norm_rotation);
+ LLSelectedTE::getRotation(diff_rotation,identical_diff_rotation);
+ LLSelectedTEMaterial::getSpecularRotation(spec_rotation,identical_spec_rotation);
+ LLSelectedTEMaterial::getNormalRotation(norm_rotation,identical_norm_rotation);
- BOOL diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation);
- BOOL norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation);
- BOOL spec_rot_tentative = !(align_planar ? identical_planar_aligned : identical_spec_rotation);
+ BOOL diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation);
+ BOOL norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation);
+ BOOL spec_rot_tentative = !(align_planar ? identical_planar_aligned : identical_spec_rotation);
- F32 diff_rot_deg = diff_rotation * RAD_TO_DEG;
- F32 norm_rot_deg = norm_rotation * RAD_TO_DEG;
- F32 spec_rot_deg = spec_rotation * RAD_TO_DEG;
+ F32 diff_rot_deg = diff_rotation * RAD_TO_DEG;
+ F32 norm_rot_deg = norm_rotation * RAD_TO_DEG;
+ F32 spec_rot_deg = spec_rotation * RAD_TO_DEG;
getChildView("TexRot")->setEnabled(editable && has_material);
getChildView("shinyRot")->setEnabled(editable && has_material && specmap_id.notNull());
getChildView("bumpyRot")->setEnabled(editable && has_material && normmap_id.notNull());
- getChild<LLUICtrl>("TexRot")->setTentative(diff_rot_tentative);
- getChild<LLUICtrl>("shinyRot")->setTentative(LLSD(norm_rot_tentative));
- getChild<LLUICtrl>("bumpyRot")->setTentative(LLSD(spec_rot_tentative));
-
- getChild<LLUICtrl>("TexRot")->setValue( editable ? diff_rot_deg : 0.0f);
- getChild<LLUICtrl>("shinyRot")->setValue(editable ? spec_rot_deg : 0.0f);
- getChild<LLUICtrl>("bumpyRot")->setValue(editable ? norm_rot_deg : 0.0f);
- }
-
- {
- F32 glow = 0.f;
- bool identical_glow = false;
- LLSelectedTE::getGlow(glow,identical_glow);
- getChild<LLUICtrl>("glow")->setValue(glow);
- getChild<LLUICtrl>("glow")->setTentative(!identical_glow);
- getChildView("glow")->setEnabled(editable);
- getChildView("glow label")->setEnabled(editable);
- }
-
- {
- LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen");
- if (combobox_texgen)
- {
- // Maps from enum to combobox entry index
- combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1);
- }
- else
- {
- LL_WARNS() << "failed childGetSelectionInterface for 'combobox texgen'" << LL_ENDL;
- }
-
- getChildView("combobox texgen")->setEnabled(editable);
- getChild<LLUICtrl>("combobox texgen")->setTentative(!identical);
- getChildView("tex gen")->setEnabled(editable);
- }
-
- {
- U8 fullbright_flag = 0;
- bool identical_fullbright = false;
-
- LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright);
-
- getChild<LLUICtrl>("checkbox fullbright")->setValue((S32)(fullbright_flag != 0));
- getChildView("checkbox fullbright")->setEnabled(editable && !has_pbr_material);
- getChild<LLUICtrl>("checkbox fullbright")->setTentative(!identical_fullbright);
+ getChild<LLUICtrl>("TexRot")->setTentative(diff_rot_tentative);
+ getChild<LLUICtrl>("shinyRot")->setTentative(LLSD(norm_rot_tentative));
+ getChild<LLUICtrl>("bumpyRot")->setTentative(LLSD(spec_rot_tentative));
+
+ getChild<LLUICtrl>("TexRot")->setValue( editable ? diff_rot_deg : 0.0f);
+ getChild<LLUICtrl>("shinyRot")->setValue(editable ? spec_rot_deg : 0.0f);
+ getChild<LLUICtrl>("bumpyRot")->setValue(editable ? norm_rot_deg : 0.0f);
+ }
+
+ {
+ F32 glow = 0.f;
+ bool identical_glow = false;
+ LLSelectedTE::getGlow(glow,identical_glow);
+ getChild<LLUICtrl>("glow")->setValue(glow);
+ getChild<LLUICtrl>("glow")->setTentative(!identical_glow);
+ getChildView("glow")->setEnabled(editable);
+ getChildView("glow label")->setEnabled(editable);
+ }
+
+ {
+ LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen");
+ if (combobox_texgen)
+ {
+ // Maps from enum to combobox entry index
+ combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1);
+ }
+ else
+ {
+ LL_WARNS() << "failed childGetSelectionInterface for 'combobox texgen'" << LL_ENDL;
+ }
+
+ getChildView("combobox texgen")->setEnabled(editable);
+ getChild<LLUICtrl>("combobox texgen")->setTentative(!identical);
+ getChildView("tex gen")->setEnabled(editable);
+ }
+
+ {
+ U8 fullbright_flag = 0;
+ bool identical_fullbright = false;
+
+ LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright);
+
+ getChild<LLUICtrl>("checkbox fullbright")->setValue((S32)(fullbright_flag != 0));
+ getChildView("checkbox fullbright")->setEnabled(editable && !has_pbr_material);
+ getChild<LLUICtrl>("checkbox fullbright")->setTentative(!identical_fullbright);
mComboMatMedia->setEnabledByValue("Materials", !has_pbr_material);
- }
-
- // Repeats per meter
- {
- F32 repeats_diff = 1.f;
- F32 repeats_norm = 1.f;
- F32 repeats_spec = 1.f;
-
- bool identical_diff_repeats = false;
- bool identical_norm_repeats = false;
- bool identical_spec_repeats = false;
-
- LLSelectedTE::getMaxDiffuseRepeats(repeats_diff, identical_diff_repeats);
- LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats);
- LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats);
-
- LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen");
- if (mComboTexGen)
- {
- S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0;
+ }
+
+ // Repeats per meter
+ {
+ F32 repeats_diff = 1.f;
+ F32 repeats_norm = 1.f;
+ F32 repeats_spec = 1.f;
+
+ bool identical_diff_repeats = false;
+ bool identical_norm_repeats = false;
+ bool identical_spec_repeats = false;
+
+ LLSelectedTE::getMaxDiffuseRepeats(repeats_diff, identical_diff_repeats);
+ LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats);
+ LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats);
+
+ LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen");
+ if (mComboTexGen)
+ {
+ S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0;
bool enabled = editable && (index != 1);
bool identical_repeats = true;
S32 material_selection = mComboMatMedia->getCurrentIndex();
- F32 repeats = 1.0f;
+ F32 repeats = 1.0f;
U32 material_type = MATTYPE_DIFFUSE;
if (material_selection == MATMEDIA_MATERIAL)
@@ -1715,194 +1715,194 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
break;
}
- BOOL repeats_tentative = !identical_repeats;
-
- LLSpinCtrl* rpt_ctrl = getChild<LLSpinCtrl>("rptctrl");
- if (force_set_values)
- {
- //onCommit, previosly edited element updates related ones
- rpt_ctrl->forceSetValue(editable ? repeats : 1.0f);
- }
- else
- {
- rpt_ctrl->setValue(editable ? repeats : 1.0f);
- }
- rpt_ctrl->setTentative(LLSD(repeats_tentative));
+ BOOL repeats_tentative = !identical_repeats;
+
+ LLSpinCtrl* rpt_ctrl = getChild<LLSpinCtrl>("rptctrl");
+ if (force_set_values)
+ {
+ //onCommit, previosly edited element updates related ones
+ rpt_ctrl->forceSetValue(editable ? repeats : 1.0f);
+ }
+ else
+ {
+ rpt_ctrl->setValue(editable ? repeats : 1.0f);
+ }
+ rpt_ctrl->setTentative(LLSD(repeats_tentative));
rpt_ctrl->setEnabled(has_material && !identical_planar_texgen && enabled);
- }
- }
+ }
+ }
- // Materials
- {
- LLMaterialPtr material;
- LLSelectedTEMaterial::getCurrent(material, identical);
+ // Materials
+ {
+ LLMaterialPtr material;
+ LLSelectedTEMaterial::getCurrent(material, identical);
if (material && editable)
- {
- LL_DEBUGS("Materials") << material->asLLSD() << LL_ENDL;
-
- // Alpha
- LLCtrlSelectionInterface* combobox_alphamode =
- childGetSelectionInterface("combobox alphamode");
- if (combobox_alphamode)
- {
- U32 alpha_mode = material->getDiffuseAlphaMode();
-
- if (transparency > 0.f)
- { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ...
- alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
- }
-
- if (!mIsAlpha)
- { // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none
- alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
- }
-
- combobox_alphamode->selectNthItem(alpha_mode);
- }
- else
- {
- LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL;
- }
- getChild<LLUICtrl>("maskcutoff")->setValue(material->getAlphaMaskCutoff());
- updateAlphaControls();
-
- identical_planar_texgen = isIdenticalPlanarTexgen();
-
- // Shiny (specular)
- F32 offset_x, offset_y, repeat_x, repeat_y, rot;
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
- texture_ctrl->setImageAssetID(material->getSpecularID());
-
- if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE))
- {
- material->getSpecularOffset(offset_x,offset_y);
- material->getSpecularRepeat(repeat_x,repeat_y);
-
- if (identical_planar_texgen)
- {
- repeat_x *= 2.0f;
- repeat_y *= 2.0f;
- }
-
- rot = material->getSpecularRotation();
- getChild<LLUICtrl>("shinyScaleU")->setValue(repeat_x);
- getChild<LLUICtrl>("shinyScaleV")->setValue(repeat_y);
- getChild<LLUICtrl>("shinyRot")->setValue(rot*RAD_TO_DEG);
- getChild<LLUICtrl>("shinyOffsetU")->setValue(offset_x);
- getChild<LLUICtrl>("shinyOffsetV")->setValue(offset_y);
- getChild<LLUICtrl>("glossiness")->setValue(material->getSpecularLightExponent());
- getChild<LLUICtrl>("environment")->setValue(material->getEnvironmentIntensity());
-
- updateShinyControls(!material->getSpecularID().isNull(), true);
- }
-
- // Assert desired colorswatch color to match material AFTER updateShinyControls
- // to avoid getting overwritten with the default on some UI state changes.
- //
- if (!material->getSpecularID().isNull())
- {
- LLColorSwatchCtrl* shiny_swatch = getChild<LLColorSwatchCtrl>("shinycolorswatch");
- LLColor4 new_color = material->getSpecularLightColor();
- LLColor4 old_color = shiny_swatch->get();
-
- shiny_swatch->setOriginal(new_color);
- shiny_swatch->set(new_color, force_set_values || old_color != new_color || !editable);
- }
-
- // Bumpy (normal)
- texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
- texture_ctrl->setImageAssetID(material->getNormalID());
-
- if (!material->getNormalID().isNull())
- {
- material->getNormalOffset(offset_x,offset_y);
- material->getNormalRepeat(repeat_x,repeat_y);
-
- if (identical_planar_texgen)
- {
- repeat_x *= 2.0f;
- repeat_y *= 2.0f;
- }
-
- rot = material->getNormalRotation();
- getChild<LLUICtrl>("bumpyScaleU")->setValue(repeat_x);
- getChild<LLUICtrl>("bumpyScaleV")->setValue(repeat_y);
- getChild<LLUICtrl>("bumpyRot")->setValue(rot*RAD_TO_DEG);
- getChild<LLUICtrl>("bumpyOffsetU")->setValue(offset_x);
- getChild<LLUICtrl>("bumpyOffsetV")->setValue(offset_y);
-
- updateBumpyControls(!material->getNormalID().isNull(), true);
- }
- }
- }
+ {
+ LL_DEBUGS("Materials") << material->asLLSD() << LL_ENDL;
+
+ // Alpha
+ LLCtrlSelectionInterface* combobox_alphamode =
+ childGetSelectionInterface("combobox alphamode");
+ if (combobox_alphamode)
+ {
+ U32 alpha_mode = material->getDiffuseAlphaMode();
+
+ if (transparency > 0.f)
+ { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ...
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
+ }
+
+ if (!mIsAlpha)
+ { // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+ }
+
+ combobox_alphamode->selectNthItem(alpha_mode);
+ }
+ else
+ {
+ LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL;
+ }
+ getChild<LLUICtrl>("maskcutoff")->setValue(material->getAlphaMaskCutoff());
+ updateAlphaControls();
+
+ identical_planar_texgen = isIdenticalPlanarTexgen();
+
+ // Shiny (specular)
+ F32 offset_x, offset_y, repeat_x, repeat_y, rot;
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
+ texture_ctrl->setImageAssetID(material->getSpecularID());
+
+ if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE))
+ {
+ material->getSpecularOffset(offset_x,offset_y);
+ material->getSpecularRepeat(repeat_x,repeat_y);
+
+ if (identical_planar_texgen)
+ {
+ repeat_x *= 2.0f;
+ repeat_y *= 2.0f;
+ }
+
+ rot = material->getSpecularRotation();
+ getChild<LLUICtrl>("shinyScaleU")->setValue(repeat_x);
+ getChild<LLUICtrl>("shinyScaleV")->setValue(repeat_y);
+ getChild<LLUICtrl>("shinyRot")->setValue(rot*RAD_TO_DEG);
+ getChild<LLUICtrl>("shinyOffsetU")->setValue(offset_x);
+ getChild<LLUICtrl>("shinyOffsetV")->setValue(offset_y);
+ getChild<LLUICtrl>("glossiness")->setValue(material->getSpecularLightExponent());
+ getChild<LLUICtrl>("environment")->setValue(material->getEnvironmentIntensity());
+
+ updateShinyControls(!material->getSpecularID().isNull(), true);
+ }
+
+ // Assert desired colorswatch color to match material AFTER updateShinyControls
+ // to avoid getting overwritten with the default on some UI state changes.
+ //
+ if (!material->getSpecularID().isNull())
+ {
+ LLColorSwatchCtrl* shiny_swatch = getChild<LLColorSwatchCtrl>("shinycolorswatch");
+ LLColor4 new_color = material->getSpecularLightColor();
+ LLColor4 old_color = shiny_swatch->get();
+
+ shiny_swatch->setOriginal(new_color);
+ shiny_swatch->set(new_color, force_set_values || old_color != new_color || !editable);
+ }
+
+ // Bumpy (normal)
+ texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
+ texture_ctrl->setImageAssetID(material->getNormalID());
+
+ if (!material->getNormalID().isNull())
+ {
+ material->getNormalOffset(offset_x,offset_y);
+ material->getNormalRepeat(repeat_x,repeat_y);
+
+ if (identical_planar_texgen)
+ {
+ repeat_x *= 2.0f;
+ repeat_y *= 2.0f;
+ }
+
+ rot = material->getNormalRotation();
+ getChild<LLUICtrl>("bumpyScaleU")->setValue(repeat_x);
+ getChild<LLUICtrl>("bumpyScaleV")->setValue(repeat_y);
+ getChild<LLUICtrl>("bumpyRot")->setValue(rot*RAD_TO_DEG);
+ getChild<LLUICtrl>("bumpyOffsetU")->setValue(offset_x);
+ getChild<LLUICtrl>("bumpyOffsetV")->setValue(offset_y);
+
+ updateBumpyControls(!material->getNormalID().isNull(), true);
+ }
+ }
+ }
S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
BOOL single_volume = (selected_count == 1);
mMenuClipboardColor->setEnabled(editable && single_volume);
- // Set variable values for numeric expressions
- LLCalc* calcp = LLCalc::getInstance();
- calcp->setVar(LLCalc::TEX_U_SCALE, childGetValue("TexScaleU").asReal());
- calcp->setVar(LLCalc::TEX_V_SCALE, childGetValue("TexScaleV").asReal());
- calcp->setVar(LLCalc::TEX_U_OFFSET, childGetValue("TexOffsetU").asReal());
- calcp->setVar(LLCalc::TEX_V_OFFSET, childGetValue("TexOffsetV").asReal());
- calcp->setVar(LLCalc::TEX_ROTATION, childGetValue("TexRot").asReal());
- calcp->setVar(LLCalc::TEX_TRANSPARENCY, childGetValue("ColorTrans").asReal());
- calcp->setVar(LLCalc::TEX_GLOW, childGetValue("glow").asReal());
- }
- else
- {
- // Disable all UICtrls
- clearCtrls();
-
- // Disable non-UICtrls
- LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control");
+ // Set variable values for numeric expressions
+ LLCalc* calcp = LLCalc::getInstance();
+ calcp->setVar(LLCalc::TEX_U_SCALE, childGetValue("TexScaleU").asReal());
+ calcp->setVar(LLCalc::TEX_V_SCALE, childGetValue("TexScaleV").asReal());
+ calcp->setVar(LLCalc::TEX_U_OFFSET, childGetValue("TexOffsetU").asReal());
+ calcp->setVar(LLCalc::TEX_V_OFFSET, childGetValue("TexOffsetV").asReal());
+ calcp->setVar(LLCalc::TEX_ROTATION, childGetValue("TexRot").asReal());
+ calcp->setVar(LLCalc::TEX_TRANSPARENCY, childGetValue("ColorTrans").asReal());
+ calcp->setVar(LLCalc::TEX_GLOW, childGetValue("glow").asReal());
+ }
+ else
+ {
+ // Disable all UICtrls
+ clearCtrls();
+
+ // Disable non-UICtrls
+ LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control");
if (pbr_ctrl)
{
pbr_ctrl->setImageAssetID(LLUUID::null);
pbr_ctrl->setEnabled(FALSE);
}
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control");
- if (texture_ctrl)
- {
- texture_ctrl->setImageAssetID( LLUUID::null );
- texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl.
-// texture_ctrl->setValid(FALSE);
- }
- LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- if (mColorSwatch)
- {
- mColorSwatch->setEnabled( FALSE );
- mColorSwatch->setFallbackImage(LLUI::getUIImage("locked_image.j2c") );
- mColorSwatch->setValid(FALSE);
- }
- LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
- if (radio_mat_type)
- {
- radio_mat_type->setSelectedIndex(0);
- }
- getChildView("color trans")->setEnabled(FALSE);
- getChildView("rptctrl")->setEnabled(FALSE);
- getChildView("tex gen")->setEnabled(FALSE);
- getChildView("label shininess")->setEnabled(FALSE);
- getChildView("label bumpiness")->setEnabled(FALSE);
- getChildView("button align")->setEnabled(FALSE);
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control");
+ if (texture_ctrl)
+ {
+ texture_ctrl->setImageAssetID( LLUUID::null );
+ texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl.
+// texture_ctrl->setValid(FALSE);
+ }
+ LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ if (mColorSwatch)
+ {
+ mColorSwatch->setEnabled( FALSE );
+ mColorSwatch->setFallbackImage(LLUI::getUIImage("locked_image.j2c") );
+ mColorSwatch->setValid(FALSE);
+ }
+ LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
+ if (radio_mat_type)
+ {
+ radio_mat_type->setSelectedIndex(0);
+ }
+ getChildView("color trans")->setEnabled(FALSE);
+ getChildView("rptctrl")->setEnabled(FALSE);
+ getChildView("tex gen")->setEnabled(FALSE);
+ getChildView("label shininess")->setEnabled(FALSE);
+ getChildView("label bumpiness")->setEnabled(FALSE);
+ getChildView("button align")->setEnabled(FALSE);
getChildView("pbr_from_inventory")->setEnabled(FALSE);
getChildView("edit_selected_pbr")->setEnabled(FALSE);
getChildView("save_selected_pbr")->setEnabled(FALSE);
-
- updateVisibility();
- // Set variable values for numeric expressions
- LLCalc* calcp = LLCalc::getInstance();
- calcp->clearVar(LLCalc::TEX_U_SCALE);
- calcp->clearVar(LLCalc::TEX_V_SCALE);
- calcp->clearVar(LLCalc::TEX_U_OFFSET);
- calcp->clearVar(LLCalc::TEX_V_OFFSET);
- calcp->clearVar(LLCalc::TEX_ROTATION);
- calcp->clearVar(LLCalc::TEX_TRANSPARENCY);
- calcp->clearVar(LLCalc::TEX_GLOW);
- }
+ updateVisibility();
+
+ // Set variable values for numeric expressions
+ LLCalc* calcp = LLCalc::getInstance();
+ calcp->clearVar(LLCalc::TEX_U_SCALE);
+ calcp->clearVar(LLCalc::TEX_V_SCALE);
+ calcp->clearVar(LLCalc::TEX_U_OFFSET);
+ calcp->clearVar(LLCalc::TEX_V_OFFSET);
+ calcp->clearVar(LLCalc::TEX_ROTATION);
+ calcp->clearVar(LLCalc::TEX_TRANSPARENCY);
+ calcp->clearVar(LLCalc::TEX_GLOW);
+ }
}
// One-off listener that updates the build floater UI when the agent inventory adds or removes an item
@@ -1911,7 +1911,7 @@ class PBRPickerAgentListener : public LLInventoryObserver
protected:
bool mChangePending = true;
public:
- PBRPickerAgentListener() : LLInventoryObserver()
+ PBRPickerAgentListener() : LLInventoryObserver()
{
gInventory.addObserver(this);
}
@@ -1921,7 +1921,7 @@ public:
return mChangePending;
}
- void changed(U32 mask) override
+ void changed(U32 mask) override
{
if (!(mask & (ADD | REMOVE)))
{
@@ -2091,8 +2091,8 @@ void LLPanelFace::updateVisibilityGLTF(LLViewerObject* objectp /*= nullptr */)
void LLPanelFace::updateCopyTexButton()
{
LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
- mMenuClipboardTexture->setEnabled(objectp && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()
- && !objectp->isPermanentEnforced() && !objectp->isInventoryPending()
+ mMenuClipboardTexture->setEnabled(objectp && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()
+ && !objectp->isPermanentEnforced() && !objectp->isInventoryPending()
&& (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1)
&& LLMaterialEditor::canClipboardObjectsMaterial());
std::string tooltip = (objectp && objectp->isInventoryPending()) ? LLTrans::getString("LoadingContents") : getString("paste_options");
@@ -2101,8 +2101,8 @@ void LLPanelFace::updateCopyTexButton()
void LLPanelFace::refresh()
{
- LL_DEBUGS("Materials") << LL_ENDL;
- getState();
+ LL_DEBUGS("Materials") << LL_ENDL;
+ getState();
}
void LLPanelFace::refreshMedia()
@@ -2223,7 +2223,7 @@ void LLPanelFace::refreshMedia()
// initial media title is the media URL (until we get the name)
media_title = media_data_get.getHomeURL();
}
- // else all faces might be empty.
+ // else all faces might be empty.
}
else // there' re Different Medias' been set on on the faces.
{
@@ -2295,19 +2295,19 @@ void LLPanelFace::onMaterialOverrideReceived(const LLUUID& object_id, S32 side)
//
void LLPanelFace::navigateToTitleMedia( const std::string url )
{
- std::string multi_media_info_str = LLTrans::getString("Multiple Media");
- if (url.empty() || multi_media_info_str == url)
- {
- // nothing to show
- mNeedMediaTitle = false;
- }
- else if (mTitleMedia)
- {
- LLPluginClassMedia* media_plugin = mTitleMedia->getMediaPlugin();
- // check if url changed or if we need a new media source
- if (mTitleMedia->getCurrentNavUrl() != url || media_plugin == NULL)
- {
- mTitleMedia->navigateTo( url );
+ std::string multi_media_info_str = LLTrans::getString("Multiple Media");
+ if (url.empty() || multi_media_info_str == url)
+ {
+ // nothing to show
+ mNeedMediaTitle = false;
+ }
+ else if (mTitleMedia)
+ {
+ LLPluginClassMedia* media_plugin = mTitleMedia->getMediaPlugin();
+ // check if url changed or if we need a new media source
+ if (mTitleMedia->getCurrentNavUrl() != url || media_plugin == NULL)
+ {
+ mTitleMedia->navigateTo( url );
LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mTitleMedia->getTextureID());
if (impl)
@@ -2315,11 +2315,11 @@ void LLPanelFace::navigateToTitleMedia( const std::string url )
// if it's a page with a movie, we don't want to hear it
impl->setVolume(0);
};
- }
+ }
- // flag that we need to update the title (even if no request were made)
- mNeedMediaTitle = true;
- }
+ // flag that we need to update the title (even if no request were made)
+ mNeedMediaTitle = true;
+ }
}
bool LLPanelFace::selectedMediaEditable()
@@ -2378,7 +2378,7 @@ void LLPanelFace::updateMediaSettings()
const LLMediaEntry default_media_data;
- // controls
+ // controls
U8 value_u8 = default_media_data.getControls();
struct functor_getter_controls : public LLSelectedTEGetFunctor< U8 >
{
@@ -2867,58 +2867,58 @@ void LLPanelFace::updateMediaTitle()
// static
F32 LLPanelFace::valueGlow(LLViewerObject* object, S32 face)
{
- return (F32)(object->getTE(face)->getGlow());
+ return (F32)(object->getTE(face)->getGlow());
}
void LLPanelFace::onCommitColor(const LLSD& data)
{
- sendColor();
+ sendColor();
}
void LLPanelFace::onCommitShinyColor(const LLSD& data)
{
- LLSelectedTEMaterial::setSpecularLightColor(this, getChild<LLColorSwatchCtrl>("shinycolorswatch")->get());
+ LLSelectedTEMaterial::setSpecularLightColor(this, getChild<LLColorSwatchCtrl>("shinycolorswatch")->get());
}
void LLPanelFace::onCommitAlpha(const LLSD& data)
{
- sendAlpha();
+ sendAlpha();
}
void LLPanelFace::onCancelColor(const LLSD& data)
{
- LLSelectMgr::getInstance()->selectionRevertColors();
+ LLSelectMgr::getInstance()->selectionRevertColors();
}
void LLPanelFace::onCancelShinyColor(const LLSD& data)
{
- LLSelectMgr::getInstance()->selectionRevertShinyColors();
+ LLSelectMgr::getInstance()->selectionRevertShinyColors();
}
void LLPanelFace::onSelectColor(const LLSD& data)
{
- LLSelectMgr::getInstance()->saveSelectedObjectColors();
- sendColor();
+ LLSelectMgr::getInstance()->saveSelectedObjectColors();
+ sendColor();
}
void LLPanelFace::onSelectShinyColor(const LLSD& data)
{
- LLSelectedTEMaterial::setSpecularLightColor(this, getChild<LLColorSwatchCtrl>("shinycolorswatch")->get());
- LLSelectMgr::getInstance()->saveSelectedShinyColors();
+ LLSelectedTEMaterial::setSpecularLightColor(this, getChild<LLColorSwatchCtrl>("shinycolorswatch")->get());
+ LLSelectMgr::getInstance()->saveSelectedShinyColors();
}
// static
void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- // Force to default states to side-step problems with menu contents
- // and generally reflecting old state when switching tabs or objects
- //
- self->updateShinyControls(false,true);
- self->updateBumpyControls(false,true);
- self->updateUI();
- self->refreshMedia();
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ // Force to default states to side-step problems with menu contents
+ // and generally reflecting old state when switching tabs or objects
+ //
+ self->updateShinyControls(false,true);
+ self->updateBumpyControls(false,true);
+ self->updateUI();
+ self->refreshMedia();
}
void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */)
@@ -2927,18 +2927,18 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */)
LLRadioGroup* radio_pbr_type = findChild<LLRadioGroup>("radio_pbr_type");
LLComboBox* combo_shininess = findChild<LLComboBox>("combobox shininess");
LLComboBox* combo_bumpiness = findChild<LLComboBox>("combobox bumpiness");
- if (!radio_mat_type || !radio_pbr_type || !mComboMatMedia || !combo_shininess || !combo_bumpiness)
- {
- LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL;
- return;
- }
- U32 materials_media = mComboMatMedia->getCurrentIndex();
- U32 material_type = radio_mat_type->getSelectedIndex();
- bool show_media = (materials_media == MATMEDIA_MEDIA) && mComboMatMedia->getEnabled();
+ if (!radio_mat_type || !radio_pbr_type || !mComboMatMedia || !combo_shininess || !combo_bumpiness)
+ {
+ LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL;
+ return;
+ }
+ U32 materials_media = mComboMatMedia->getCurrentIndex();
+ U32 material_type = radio_mat_type->getSelectedIndex();
+ bool show_media = (materials_media == MATMEDIA_MEDIA) && mComboMatMedia->getEnabled();
bool show_material = materials_media == MATMEDIA_MATERIAL;
- bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled()));
- bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled();
- bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled();
+ bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled()));
+ bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled();
+ bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled();
const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled();
const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex();
const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type);
@@ -2952,62 +2952,62 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */)
getChildView("combobox texgen")->setVisible(show_material || show_media || show_pbr_asset);
getChildView("button align textures")->setVisible(show_material || show_media);
- // Media controls
+ // Media controls
mTitleMediaText->setVisible(show_media);
- getChildView("add_media")->setVisible(show_media);
- getChildView("delete_media")->setVisible(show_media);
- getChildView("button align")->setVisible(show_media);
-
- // Diffuse texture controls
- getChildView("texture control")->setVisible(show_texture && show_material);
- getChildView("label alphamode")->setVisible(show_texture && show_material);
- getChildView("combobox alphamode")->setVisible(show_texture && show_material);
- getChildView("label maskcutoff")->setVisible(false);
- getChildView("maskcutoff")->setVisible(false);
- if (show_texture && show_material)
- {
- updateAlphaControls();
- }
+ getChildView("add_media")->setVisible(show_media);
+ getChildView("delete_media")->setVisible(show_media);
+ getChildView("button align")->setVisible(show_media);
+
+ // Diffuse texture controls
+ getChildView("texture control")->setVisible(show_texture && show_material);
+ getChildView("label alphamode")->setVisible(show_texture && show_material);
+ getChildView("combobox alphamode")->setVisible(show_texture && show_material);
+ getChildView("label maskcutoff")->setVisible(false);
+ getChildView("maskcutoff")->setVisible(false);
+ if (show_texture && show_material)
+ {
+ updateAlphaControls();
+ }
// texture scale and position controls
- getChildView("TexScaleU")->setVisible(show_texture);
- getChildView("TexScaleV")->setVisible(show_texture);
- getChildView("TexRot")->setVisible(show_texture);
- getChildView("TexOffsetU")->setVisible(show_texture);
- getChildView("TexOffsetV")->setVisible(show_texture);
-
- // Specular map controls
- getChildView("shinytexture control")->setVisible(show_shininess);
- getChildView("combobox shininess")->setVisible(show_shininess);
- getChildView("label shininess")->setVisible(show_shininess);
- getChildView("label glossiness")->setVisible(false);
- getChildView("glossiness")->setVisible(false);
- getChildView("label environment")->setVisible(false);
- getChildView("environment")->setVisible(false);
- getChildView("label shinycolor")->setVisible(false);
- getChildView("shinycolorswatch")->setVisible(false);
- if (show_shininess)
- {
- updateShinyControls();
- }
- getChildView("shinyScaleU")->setVisible(show_shininess);
- getChildView("shinyScaleV")->setVisible(show_shininess);
- getChildView("shinyRot")->setVisible(show_shininess);
- getChildView("shinyOffsetU")->setVisible(show_shininess);
- getChildView("shinyOffsetV")->setVisible(show_shininess);
-
- // Normal map controls
- if (show_bumpiness)
- {
- updateBumpyControls();
- }
- getChildView("bumpytexture control")->setVisible(show_bumpiness);
- getChildView("combobox bumpiness")->setVisible(show_bumpiness);
- getChildView("label bumpiness")->setVisible(show_bumpiness);
- getChildView("bumpyScaleU")->setVisible(show_bumpiness);
- getChildView("bumpyScaleV")->setVisible(show_bumpiness);
- getChildView("bumpyRot")->setVisible(show_bumpiness);
- getChildView("bumpyOffsetU")->setVisible(show_bumpiness);
- getChildView("bumpyOffsetV")->setVisible(show_bumpiness);
+ getChildView("TexScaleU")->setVisible(show_texture);
+ getChildView("TexScaleV")->setVisible(show_texture);
+ getChildView("TexRot")->setVisible(show_texture);
+ getChildView("TexOffsetU")->setVisible(show_texture);
+ getChildView("TexOffsetV")->setVisible(show_texture);
+
+ // Specular map controls
+ getChildView("shinytexture control")->setVisible(show_shininess);
+ getChildView("combobox shininess")->setVisible(show_shininess);
+ getChildView("label shininess")->setVisible(show_shininess);
+ getChildView("label glossiness")->setVisible(false);
+ getChildView("glossiness")->setVisible(false);
+ getChildView("label environment")->setVisible(false);
+ getChildView("environment")->setVisible(false);
+ getChildView("label shinycolor")->setVisible(false);
+ getChildView("shinycolorswatch")->setVisible(false);
+ if (show_shininess)
+ {
+ updateShinyControls();
+ }
+ getChildView("shinyScaleU")->setVisible(show_shininess);
+ getChildView("shinyScaleV")->setVisible(show_shininess);
+ getChildView("shinyRot")->setVisible(show_shininess);
+ getChildView("shinyOffsetU")->setVisible(show_shininess);
+ getChildView("shinyOffsetV")->setVisible(show_shininess);
+
+ // Normal map controls
+ if (show_bumpiness)
+ {
+ updateBumpyControls();
+ }
+ getChildView("bumpytexture control")->setVisible(show_bumpiness);
+ getChildView("combobox bumpiness")->setVisible(show_bumpiness);
+ getChildView("label bumpiness")->setVisible(show_bumpiness);
+ getChildView("bumpyScaleU")->setVisible(show_bumpiness);
+ getChildView("bumpyScaleV")->setVisible(show_bumpiness);
+ getChildView("bumpyRot")->setVisible(show_bumpiness);
+ getChildView("bumpyOffsetU")->setVisible(show_bumpiness);
+ getChildView("bumpyOffsetV")->setVisible(show_bumpiness);
getChild<LLSpinCtrl>("rptctrl")->setVisible(show_material || show_media);
@@ -3019,11 +3019,11 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */)
void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
- // Force to default states to side-step problems with menu contents
- // and generally reflecting old state when switching tabs or objects
- //
- self->updateShinyControls(false,true);
- self->updateBumpyControls(false,true);
+ // Force to default states to side-step problems with menu contents
+ // and generally reflecting old state when switching tabs or objects
+ //
+ self->updateShinyControls(false,true);
+ self->updateBumpyControls(false,true);
self->updateUI();
}
@@ -3040,149 +3040,149 @@ void LLPanelFace::onCommitPbrType(LLUICtrl* ctrl, void* userdata)
// static
void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
+ LLPanelFace* self = (LLPanelFace*) userdata;
- LLComboBox* mComboBumpiness = self->getChild<LLComboBox>("combobox bumpiness");
- if(!mComboBumpiness)
- return;
+ LLComboBox* mComboBumpiness = self->getChild<LLComboBox>("combobox bumpiness");
+ if(!mComboBumpiness)
+ return;
- U32 bumpiness = mComboBumpiness->getCurrentIndex();
+ U32 bumpiness = mComboBumpiness->getCurrentIndex();
- self->sendBump(bumpiness);
+ self->sendBump(bumpiness);
}
// static
void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- self->sendTexGen();
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ self->sendTexGen();
}
// static
void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_shiny_combobox)
{
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
- LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID();
- LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL;
- LLComboBox* comboShiny = getChild<LLComboBox>("combobox shininess");
-
- if(mess_with_shiny_combobox)
- {
- if (!comboShiny)
- {
- return;
- }
- if (!shiny_texture_ID.isNull() && is_setting_texture)
- {
- if (!comboShiny->itemExists(USE_TEXTURE))
- {
- comboShiny->add(USE_TEXTURE);
- }
- comboShiny->setSimple(USE_TEXTURE);
- }
- else
- {
- if (comboShiny->itemExists(USE_TEXTURE))
- {
- comboShiny->remove(SHINY_TEXTURE);
- comboShiny->selectFirstItem();
- }
- }
- }
- else
- {
- if (shiny_texture_ID.isNull() && comboShiny && comboShiny->itemExists(USE_TEXTURE))
- {
- comboShiny->remove(SHINY_TEXTURE);
- comboShiny->selectFirstItem();
- }
- }
-
-
- LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
- U32 materials_media = mComboMatMedia->getCurrentIndex();
- U32 material_type = radio_mat_type->getSelectedIndex();
- bool show_material = (materials_media == MATMEDIA_MATERIAL);
- bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled();
- U32 shiny_value = comboShiny->getCurrentIndex();
- bool show_shinyctrls = (shiny_value == SHINY_TEXTURE) && show_shininess; // Use texture
- getChildView("label glossiness")->setVisible(show_shinyctrls);
- getChildView("glossiness")->setVisible(show_shinyctrls);
- getChildView("label environment")->setVisible(show_shinyctrls);
- getChildView("environment")->setVisible(show_shinyctrls);
- getChildView("label shinycolor")->setVisible(show_shinyctrls);
- getChildView("shinycolorswatch")->setVisible(show_shinyctrls);
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
+ LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID();
+ LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL;
+ LLComboBox* comboShiny = getChild<LLComboBox>("combobox shininess");
+
+ if(mess_with_shiny_combobox)
+ {
+ if (!comboShiny)
+ {
+ return;
+ }
+ if (!shiny_texture_ID.isNull() && is_setting_texture)
+ {
+ if (!comboShiny->itemExists(USE_TEXTURE))
+ {
+ comboShiny->add(USE_TEXTURE);
+ }
+ comboShiny->setSimple(USE_TEXTURE);
+ }
+ else
+ {
+ if (comboShiny->itemExists(USE_TEXTURE))
+ {
+ comboShiny->remove(SHINY_TEXTURE);
+ comboShiny->selectFirstItem();
+ }
+ }
+ }
+ else
+ {
+ if (shiny_texture_ID.isNull() && comboShiny && comboShiny->itemExists(USE_TEXTURE))
+ {
+ comboShiny->remove(SHINY_TEXTURE);
+ comboShiny->selectFirstItem();
+ }
+ }
+
+
+ LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
+ U32 materials_media = mComboMatMedia->getCurrentIndex();
+ U32 material_type = radio_mat_type->getSelectedIndex();
+ bool show_material = (materials_media == MATMEDIA_MATERIAL);
+ bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled();
+ U32 shiny_value = comboShiny->getCurrentIndex();
+ bool show_shinyctrls = (shiny_value == SHINY_TEXTURE) && show_shininess; // Use texture
+ getChildView("label glossiness")->setVisible(show_shinyctrls);
+ getChildView("glossiness")->setVisible(show_shinyctrls);
+ getChildView("label environment")->setVisible(show_shinyctrls);
+ getChildView("environment")->setVisible(show_shinyctrls);
+ getChildView("label shinycolor")->setVisible(show_shinyctrls);
+ getChildView("shinycolorswatch")->setVisible(show_shinyctrls);
}
// static
void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_combobox)
{
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
- LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID();
- LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL;
- LLComboBox* comboBumpy = getChild<LLComboBox>("combobox bumpiness");
- if (!comboBumpy)
- {
- return;
- }
-
- if (mess_with_combobox)
- {
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
- LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID();
- LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL;
-
- if (!bumpy_texture_ID.isNull() && is_setting_texture)
- {
- if (!comboBumpy->itemExists(USE_TEXTURE))
- {
- comboBumpy->add(USE_TEXTURE);
- }
- comboBumpy->setSimple(USE_TEXTURE);
- }
- else
- {
- if (comboBumpy->itemExists(USE_TEXTURE))
- {
- comboBumpy->remove(BUMPY_TEXTURE);
- comboBumpy->selectFirstItem();
- }
- }
- }
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
+ LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID();
+ LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL;
+ LLComboBox* comboBumpy = getChild<LLComboBox>("combobox bumpiness");
+ if (!comboBumpy)
+ {
+ return;
+ }
+
+ if (mess_with_combobox)
+ {
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
+ LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID();
+ LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL;
+
+ if (!bumpy_texture_ID.isNull() && is_setting_texture)
+ {
+ if (!comboBumpy->itemExists(USE_TEXTURE))
+ {
+ comboBumpy->add(USE_TEXTURE);
+ }
+ comboBumpy->setSimple(USE_TEXTURE);
+ }
+ else
+ {
+ if (comboBumpy->itemExists(USE_TEXTURE))
+ {
+ comboBumpy->remove(BUMPY_TEXTURE);
+ comboBumpy->selectFirstItem();
+ }
+ }
+ }
}
// static
void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
+ LLPanelFace* self = (LLPanelFace*) userdata;
- LLComboBox* mComboShininess = self->getChild<LLComboBox>("combobox shininess");
- if(!mComboShininess)
- return;
-
- U32 shininess = mComboShininess->getCurrentIndex();
+ LLComboBox* mComboShininess = self->getChild<LLComboBox>("combobox shininess");
+ if(!mComboShininess)
+ return;
+
+ U32 shininess = mComboShininess->getCurrentIndex();
- self->sendShiny(shininess);
+ self->sendShiny(shininess);
}
// static
void LLPanelFace::updateAlphaControls()
{
- LLComboBox* comboAlphaMode = getChild<LLComboBox>("combobox alphamode");
- if (!comboAlphaMode)
- {
- return;
- }
- U32 alpha_value = comboAlphaMode->getCurrentIndex();
- bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking
-
+ LLComboBox* comboAlphaMode = getChild<LLComboBox>("combobox alphamode");
+ if (!comboAlphaMode)
+ {
+ return;
+ }
+ U32 alpha_value = comboAlphaMode->getCurrentIndex();
+ bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking
+
U32 mat_media = MATMEDIA_MATERIAL;
if (mComboMatMedia)
{
mat_media = mComboMatMedia->getCurrentIndex();
}
-
+
U32 mat_type = MATTYPE_DIFFUSE;
LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
if(radio_mat_type)
@@ -3192,31 +3192,31 @@ void LLPanelFace::updateAlphaControls()
show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL);
show_alphactrls = show_alphactrls && (mat_type == MATTYPE_DIFFUSE);
-
- getChildView("label maskcutoff")->setVisible(show_alphactrls);
- getChildView("maskcutoff")->setVisible(show_alphactrls);
+
+ getChildView("label maskcutoff")->setVisible(show_alphactrls);
+ getChildView("maskcutoff")->setVisible(show_alphactrls);
}
// static
void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- self->updateAlphaControls();
- LLSelectedTEMaterial::setDiffuseAlphaMode(self,self->getCurrentDiffuseAlphaMode());
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ self->updateAlphaControls();
+ LLSelectedTEMaterial::setDiffuseAlphaMode(self,self->getCurrentDiffuseAlphaMode());
}
// static
void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- self->sendFullbright();
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ self->sendFullbright();
}
// static
void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- self->sendGlow();
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ self->sendGlow();
}
// static
@@ -3305,102 +3305,102 @@ BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item)
void LLPanelFace::onCommitTexture( const LLSD& data )
{
- add(LLStatViewer::EDIT_TEXTURE, 1);
- sendTexture();
+ add(LLStatViewer::EDIT_TEXTURE, 1);
+ sendTexture();
}
void LLPanelFace::onCancelTexture(const LLSD& data)
{
- LLSelectMgr::getInstance()->selectionRevertTextures();
+ LLSelectMgr::getInstance()->selectionRevertTextures();
}
void LLPanelFace::onSelectTexture(const LLSD& data)
{
- LLSelectMgr::getInstance()->saveSelectedObjectTextures();
- sendTexture();
-
- LLGLenum image_format;
- bool identical_image_format = false;
- LLSelectedTE::getImageFormat(image_format, identical_image_format);
-
- LLCtrlSelectionInterface* combobox_alphamode =
- childGetSelectionInterface("combobox alphamode");
-
- U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
- if (combobox_alphamode)
- {
- switch (image_format)
- {
- case GL_RGBA:
- case GL_ALPHA:
- {
- alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
- }
- break;
-
- case GL_RGB: break;
- default:
- {
- LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL;
- }
- break;
- }
-
- combobox_alphamode->selectNthItem(alpha_mode);
- }
- LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode());
+ LLSelectMgr::getInstance()->saveSelectedObjectTextures();
+ sendTexture();
+
+ LLGLenum image_format;
+ bool identical_image_format = false;
+ LLSelectedTE::getImageFormat(image_format, identical_image_format);
+
+ LLCtrlSelectionInterface* combobox_alphamode =
+ childGetSelectionInterface("combobox alphamode");
+
+ U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+ if (combobox_alphamode)
+ {
+ switch (image_format)
+ {
+ case GL_RGBA:
+ case GL_ALPHA:
+ {
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
+ }
+ break;
+
+ case GL_RGB: break;
+ default:
+ {
+ LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL;
+ }
+ break;
+ }
+
+ combobox_alphamode->selectNthItem(alpha_mode);
+ }
+ LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode());
}
void LLPanelFace::onCloseTexturePicker(const LLSD& data)
{
- LL_DEBUGS("Materials") << data << LL_ENDL;
- updateUI();
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ updateUI();
}
void LLPanelFace::onCommitSpecularTexture( const LLSD& data )
{
- LL_DEBUGS("Materials") << data << LL_ENDL;
- sendShiny(SHINY_TEXTURE);
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ sendShiny(SHINY_TEXTURE);
}
void LLPanelFace::onCommitNormalTexture( const LLSD& data )
{
- LL_DEBUGS("Materials") << data << LL_ENDL;
- LLUUID nmap_id = getCurrentNormalMap();
- sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ LLUUID nmap_id = getCurrentNormalMap();
+ sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
}
void LLPanelFace::onCancelSpecularTexture(const LLSD& data)
{
- U8 shiny = 0;
- bool identical_shiny = false;
- LLSelectedTE::getShiny(shiny, identical_shiny);
- LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID();
- shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE;
- sendShiny(shiny);
+ U8 shiny = 0;
+ bool identical_shiny = false;
+ LLSelectedTE::getShiny(shiny, identical_shiny);
+ LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID();
+ shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE;
+ sendShiny(shiny);
}
void LLPanelFace::onCancelNormalTexture(const LLSD& data)
{
- U8 bumpy = 0;
- bool identical_bumpy = false;
- LLSelectedTE::getBumpmap(bumpy, identical_bumpy);
- LLUUID spec_map_id = getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID();
- bumpy = spec_map_id.isNull() ? bumpy : BUMPY_TEXTURE;
- sendBump(bumpy);
+ U8 bumpy = 0;
+ bool identical_bumpy = false;
+ LLSelectedTE::getBumpmap(bumpy, identical_bumpy);
+ LLUUID spec_map_id = getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID();
+ bumpy = spec_map_id.isNull() ? bumpy : BUMPY_TEXTURE;
+ sendBump(bumpy);
}
void LLPanelFace::onSelectSpecularTexture(const LLSD& data)
{
- LL_DEBUGS("Materials") << data << LL_ENDL;
- sendShiny(SHINY_TEXTURE);
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ sendShiny(SHINY_TEXTURE);
}
void LLPanelFace::onSelectNormalTexture(const LLSD& data)
{
- LL_DEBUGS("Materials") << data << LL_ENDL;
- LLUUID nmap_id = getCurrentNormalMap();
- sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ LLUUID nmap_id = getCurrentNormalMap();
+ sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
}
//////////////////////////////////////////////////////////////////////////////
@@ -3477,212 +3477,212 @@ bool LLPanelFace::multipleFacesSelectedConfirm(const LLSD& notification, const L
//static
void LLPanelFace::syncOffsetX(LLPanelFace* self, F32 offsetU)
{
- LLSelectedTEMaterial::setNormalOffsetX(self,offsetU);
- LLSelectedTEMaterial::setSpecularOffsetX(self,offsetU);
- self->getChild<LLSpinCtrl>("TexOffsetU")->forceSetValue(offsetU);
- self->sendTextureInfo();
+ LLSelectedTEMaterial::setNormalOffsetX(self,offsetU);
+ LLSelectedTEMaterial::setSpecularOffsetX(self,offsetU);
+ self->getChild<LLSpinCtrl>("TexOffsetU")->forceSetValue(offsetU);
+ self->sendTextureInfo();
}
//static
void LLPanelFace::syncOffsetY(LLPanelFace* self, F32 offsetV)
{
- LLSelectedTEMaterial::setNormalOffsetY(self,offsetV);
- LLSelectedTEMaterial::setSpecularOffsetY(self,offsetV);
- self->getChild<LLSpinCtrl>("TexOffsetV")->forceSetValue(offsetV);
- self->sendTextureInfo();
+ LLSelectedTEMaterial::setNormalOffsetY(self,offsetV);
+ LLSelectedTEMaterial::setSpecularOffsetY(self,offsetV);
+ self->getChild<LLSpinCtrl>("TexOffsetV")->forceSetValue(offsetV);
+ self->sendTextureInfo();
}
//static
void LLPanelFace::onCommitMaterialBumpyOffsetX(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- syncOffsetX(self,self->getCurrentBumpyOffsetU());
- }
- else
- {
- LLSelectedTEMaterial::setNormalOffsetX(self,self->getCurrentBumpyOffsetU());
- }
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ syncOffsetX(self,self->getCurrentBumpyOffsetU());
+ }
+ else
+ {
+ LLSelectedTEMaterial::setNormalOffsetX(self,self->getCurrentBumpyOffsetU());
+ }
}
//static
void LLPanelFace::onCommitMaterialBumpyOffsetY(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- syncOffsetY(self,self->getCurrentBumpyOffsetV());
- }
- else
- {
- LLSelectedTEMaterial::setNormalOffsetY(self,self->getCurrentBumpyOffsetV());
- }
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ syncOffsetY(self,self->getCurrentBumpyOffsetV());
+ }
+ else
+ {
+ LLSelectedTEMaterial::setNormalOffsetY(self,self->getCurrentBumpyOffsetV());
+ }
}
//static
void LLPanelFace::onCommitMaterialShinyOffsetX(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- syncOffsetX(self, self->getCurrentShinyOffsetU());
- }
- else
- {
- LLSelectedTEMaterial::setSpecularOffsetX(self,self->getCurrentShinyOffsetU());
- }
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ syncOffsetX(self, self->getCurrentShinyOffsetU());
+ }
+ else
+ {
+ LLSelectedTEMaterial::setSpecularOffsetX(self,self->getCurrentShinyOffsetU());
+ }
}
//static
void LLPanelFace::onCommitMaterialShinyOffsetY(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- syncOffsetY(self,self->getCurrentShinyOffsetV());
- }
- else
- {
- LLSelectedTEMaterial::setSpecularOffsetY(self,self->getCurrentShinyOffsetV());
- }
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ syncOffsetY(self,self->getCurrentShinyOffsetV());
+ }
+ else
+ {
+ LLSelectedTEMaterial::setSpecularOffsetY(self,self->getCurrentShinyOffsetV());
+ }
}
//static
void LLPanelFace::syncRepeatX(LLPanelFace* self, F32 scaleU)
{
- LLSelectedTEMaterial::setNormalRepeatX(self,scaleU);
- LLSelectedTEMaterial::setSpecularRepeatX(self,scaleU);
- self->sendTextureInfo();
+ LLSelectedTEMaterial::setNormalRepeatX(self,scaleU);
+ LLSelectedTEMaterial::setSpecularRepeatX(self,scaleU);
+ self->sendTextureInfo();
}
//static
void LLPanelFace::syncRepeatY(LLPanelFace* self, F32 scaleV)
{
- LLSelectedTEMaterial::setNormalRepeatY(self,scaleV);
- LLSelectedTEMaterial::setSpecularRepeatY(self,scaleV);
- self->sendTextureInfo();
+ LLSelectedTEMaterial::setNormalRepeatY(self,scaleV);
+ LLSelectedTEMaterial::setSpecularRepeatY(self,scaleV);
+ self->sendTextureInfo();
}
//static
void LLPanelFace::onCommitMaterialBumpyScaleX(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
- F32 bumpy_scale_u = self->getCurrentBumpyScaleU();
- if (self->isIdenticalPlanarTexgen())
- {
- bumpy_scale_u *= 0.5f;
- }
-
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- self->getChild<LLSpinCtrl>("TexScaleU")->forceSetValue(self->getCurrentBumpyScaleU());
- syncRepeatX(self, bumpy_scale_u);
- }
- else
- {
- LLSelectedTEMaterial::setNormalRepeatX(self,bumpy_scale_u);
- }
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ F32 bumpy_scale_u = self->getCurrentBumpyScaleU();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ bumpy_scale_u *= 0.5f;
+ }
+
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ self->getChild<LLSpinCtrl>("TexScaleU")->forceSetValue(self->getCurrentBumpyScaleU());
+ syncRepeatX(self, bumpy_scale_u);
+ }
+ else
+ {
+ LLSelectedTEMaterial::setNormalRepeatX(self,bumpy_scale_u);
+ }
}
//static
void LLPanelFace::onCommitMaterialBumpyScaleY(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
- F32 bumpy_scale_v = self->getCurrentBumpyScaleV();
- if (self->isIdenticalPlanarTexgen())
- {
- bumpy_scale_v *= 0.5f;
- }
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ F32 bumpy_scale_v = self->getCurrentBumpyScaleV();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ bumpy_scale_v *= 0.5f;
+ }
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- self->getChild<LLSpinCtrl>("TexScaleV")->forceSetValue(self->getCurrentBumpyScaleV());
- syncRepeatY(self, bumpy_scale_v);
- }
- else
- {
- LLSelectedTEMaterial::setNormalRepeatY(self,bumpy_scale_v);
- }
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ self->getChild<LLSpinCtrl>("TexScaleV")->forceSetValue(self->getCurrentBumpyScaleV());
+ syncRepeatY(self, bumpy_scale_v);
+ }
+ else
+ {
+ LLSelectedTEMaterial::setNormalRepeatY(self,bumpy_scale_v);
+ }
}
//static
void LLPanelFace::onCommitMaterialShinyScaleX(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
- F32 shiny_scale_u = self->getCurrentShinyScaleU();
- if (self->isIdenticalPlanarTexgen())
- {
- shiny_scale_u *= 0.5f;
- }
-
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- self->getChild<LLSpinCtrl>("TexScaleU")->forceSetValue(self->getCurrentShinyScaleU());
- syncRepeatX(self, shiny_scale_u);
- }
- else
- {
- LLSelectedTEMaterial::setSpecularRepeatX(self,shiny_scale_u);
- }
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ F32 shiny_scale_u = self->getCurrentShinyScaleU();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ shiny_scale_u *= 0.5f;
+ }
+
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ self->getChild<LLSpinCtrl>("TexScaleU")->forceSetValue(self->getCurrentShinyScaleU());
+ syncRepeatX(self, shiny_scale_u);
+ }
+ else
+ {
+ LLSelectedTEMaterial::setSpecularRepeatX(self,shiny_scale_u);
+ }
}
//static
void LLPanelFace::onCommitMaterialShinyScaleY(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
- F32 shiny_scale_v = self->getCurrentShinyScaleV();
- if (self->isIdenticalPlanarTexgen())
- {
- shiny_scale_v *= 0.5f;
- }
-
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- self->getChild<LLSpinCtrl>("TexScaleV")->forceSetValue(self->getCurrentShinyScaleV());
- syncRepeatY(self, shiny_scale_v);
- }
- else
- {
- LLSelectedTEMaterial::setSpecularRepeatY(self,shiny_scale_v);
- }
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ F32 shiny_scale_v = self->getCurrentShinyScaleV();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ shiny_scale_v *= 0.5f;
+ }
+
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ self->getChild<LLSpinCtrl>("TexScaleV")->forceSetValue(self->getCurrentShinyScaleV());
+ syncRepeatY(self, shiny_scale_v);
+ }
+ else
+ {
+ LLSelectedTEMaterial::setSpecularRepeatY(self,shiny_scale_v);
+ }
}
//static
void LLPanelFace::syncMaterialRot(LLPanelFace* self, F32 rot, int te)
{
- LLSelectedTEMaterial::setNormalRotation(self,rot * DEG_TO_RAD, te);
- LLSelectedTEMaterial::setSpecularRotation(self,rot * DEG_TO_RAD, te);
- self->sendTextureInfo();
+ LLSelectedTEMaterial::setNormalRotation(self,rot * DEG_TO_RAD, te);
+ LLSelectedTEMaterial::setSpecularRotation(self,rot * DEG_TO_RAD, te);
+ self->sendTextureInfo();
}
//static
void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- self->getChild<LLSpinCtrl>("TexRot")->forceSetValue(self->getCurrentBumpyRot());
- syncMaterialRot(self, self->getCurrentBumpyRot());
- }
- else
- {
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ self->getChild<LLSpinCtrl>("TexRot")->forceSetValue(self->getCurrentBumpyRot());
+ syncMaterialRot(self, self->getCurrentBumpyRot());
+ }
+ else
+ {
if ((bool)self->childGetValue("checkbox planar align").asBoolean())
{
LLFace* last_face = NULL;
@@ -3695,22 +3695,22 @@ void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata)
{
LLSelectedTEMaterial::setNormalRotation(self, self->getCurrentBumpyRot() * DEG_TO_RAD);
}
- }
+ }
}
//static
void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- self->getChild<LLSpinCtrl>("TexRot")->forceSetValue(self->getCurrentShinyRot());
- syncMaterialRot(self, self->getCurrentShinyRot());
- }
- else
- {
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ self->getChild<LLSpinCtrl>("TexRot")->forceSetValue(self->getCurrentShinyRot());
+ syncMaterialRot(self, self->getCurrentShinyRot());
+ }
+ else
+ {
if ((bool)self->childGetValue("checkbox planar align").asBoolean())
{
LLFace* last_face = NULL;
@@ -3723,136 +3723,136 @@ void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata)
{
LLSelectedTEMaterial::setSpecularRotation(self, self->getCurrentShinyRot() * DEG_TO_RAD);
}
- }
+ }
}
//static
void LLPanelFace::onCommitMaterialGloss(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
- LLSelectedTEMaterial::setSpecularLightExponent(self,self->getCurrentGlossiness());
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setSpecularLightExponent(self,self->getCurrentGlossiness());
}
//static
void LLPanelFace::onCommitMaterialEnv(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- llassert_always(self);
- LLSelectedTEMaterial::setEnvironmentIntensity(self,self->getCurrentEnvIntensity());
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ llassert_always(self);
+ LLSelectedTEMaterial::setEnvironmentIntensity(self,self->getCurrentEnvIntensity());
}
//static
void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- LLSelectedTEMaterial::setAlphaMaskCutoff(self,self->getCurrentAlphaMaskCutoff());
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ LLSelectedTEMaterial::setAlphaMaskCutoff(self,self->getCurrentAlphaMaskCutoff());
}
// static
void LLPanelFace::onCommitTextureInfo( LLUICtrl* ctrl, void* userdata )
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- self->sendTextureInfo();
- // vertical scale and repeats per meter depends on each other, so force set on changes
- self->updateUI(true);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ self->sendTextureInfo();
+ // vertical scale and repeats per meter depends on each other, so force set on changes
+ self->updateUI(true);
}
// static
void LLPanelFace::onCommitTextureScaleX( LLUICtrl* ctrl, void* userdata )
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- F32 bumpy_scale_u = self->getChild<LLUICtrl>("TexScaleU")->getValue().asReal();
- if (self->isIdenticalPlanarTexgen())
- {
- bumpy_scale_u *= 0.5f;
- }
- syncRepeatX(self, bumpy_scale_u);
- }
- else
- {
- self->sendTextureInfo();
- }
- self->updateUI(true);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ F32 bumpy_scale_u = self->getChild<LLUICtrl>("TexScaleU")->getValue().asReal();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ bumpy_scale_u *= 0.5f;
+ }
+ syncRepeatX(self, bumpy_scale_u);
+ }
+ else
+ {
+ self->sendTextureInfo();
+ }
+ self->updateUI(true);
}
// static
void LLPanelFace::onCommitTextureScaleY( LLUICtrl* ctrl, void* userdata )
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- F32 bumpy_scale_v = self->getChild<LLUICtrl>("TexScaleV")->getValue().asReal();
- if (self->isIdenticalPlanarTexgen())
- {
- bumpy_scale_v *= 0.5f;
- }
- syncRepeatY(self, bumpy_scale_v);
- }
- else
- {
- self->sendTextureInfo();
- }
- self->updateUI(true);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ F32 bumpy_scale_v = self->getChild<LLUICtrl>("TexScaleV")->getValue().asReal();
+ if (self->isIdenticalPlanarTexgen())
+ {
+ bumpy_scale_v *= 0.5f;
+ }
+ syncRepeatY(self, bumpy_scale_v);
+ }
+ else
+ {
+ self->sendTextureInfo();
+ }
+ self->updateUI(true);
}
// static
void LLPanelFace::onCommitTextureRot( LLUICtrl* ctrl, void* userdata )
{
- LLPanelFace* self = (LLPanelFace*) userdata;
+ LLPanelFace* self = (LLPanelFace*) userdata;
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- syncMaterialRot(self, self->getChild<LLUICtrl>("TexRot")->getValue().asReal());
- }
- else
- {
- self->sendTextureInfo();
- }
- self->updateUI(true);
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ syncMaterialRot(self, self->getChild<LLUICtrl>("TexRot")->getValue().asReal());
+ }
+ else
+ {
+ self->sendTextureInfo();
+ }
+ self->updateUI(true);
}
// static
void LLPanelFace::onCommitTextureOffsetX( LLUICtrl* ctrl, void* userdata )
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- syncOffsetX(self, self->getChild<LLUICtrl>("TexOffsetU")->getValue().asReal());
- }
- else
- {
- self->sendTextureInfo();
- }
- self->updateUI(true);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ syncOffsetX(self, self->getChild<LLUICtrl>("TexOffsetU")->getValue().asReal());
+ }
+ else
+ {
+ self->sendTextureInfo();
+ }
+ self->updateUI(true);
}
// static
void LLPanelFace::onCommitTextureOffsetY( LLUICtrl* ctrl, void* userdata )
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- syncOffsetY(self, self->getChild<LLUICtrl>("TexOffsetV")->getValue().asReal());
- }
- else
- {
- self->sendTextureInfo();
- }
- self->updateUI(true);
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ syncOffsetY(self, self->getChild<LLUICtrl>("TexOffsetV")->getValue().asReal());
+ }
+ else
+ {
+ self->sendTextureInfo();
+ }
+ self->updateUI(true);
}
// Commit the number of repeats per meter
// static
void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
-
- LLUICtrl* repeats_ctrl = self->getChild<LLUICtrl>("rptctrl");
-
- U32 materials_media = self->mComboMatMedia->getCurrentIndex();
+ LLPanelFace* self = (LLPanelFace*) userdata;
+
+ LLUICtrl* repeats_ctrl = self->getChild<LLUICtrl>("rptctrl");
+
+ U32 materials_media = self->mComboMatMedia->getCurrentIndex();
U32 material_type = 0;
if (materials_media == MATMEDIA_PBR)
{
@@ -3865,126 +3865,126 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata)
material_type = radio_mat_type->getSelectedIndex();
}
- F32 repeats_per_meter = repeats_ctrl->getValue().asReal();
-
+ F32 repeats_per_meter = repeats_ctrl->getValue().asReal();
+
F32 obj_scale_s = 1.0f;
F32 obj_scale_t = 1.0f;
- bool identical_scale_s = false;
- bool identical_scale_t = false;
-
- LLSelectedTE::getObjectScaleS(obj_scale_s, identical_scale_s);
- LLSelectedTE::getObjectScaleS(obj_scale_t, identical_scale_t);
-
- LLUICtrl* bumpy_scale_u = self->getChild<LLUICtrl>("bumpyScaleU");
- LLUICtrl* bumpy_scale_v = self->getChild<LLUICtrl>("bumpyScaleV");
- LLUICtrl* shiny_scale_u = self->getChild<LLUICtrl>("shinyScaleU");
- LLUICtrl* shiny_scale_v = self->getChild<LLUICtrl>("shinyScaleV");
-
- if (gSavedSettings.getBOOL("SyncMaterialSettings"))
- {
- LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter );
-
- bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter);
- bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter);
-
- LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter);
- LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter);
-
- shiny_scale_u->setValue(obj_scale_s * repeats_per_meter);
- shiny_scale_v->setValue(obj_scale_t * repeats_per_meter);
-
- LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter);
- LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter);
- }
- else
- {
- switch (material_type)
- {
- case MATTYPE_DIFFUSE:
- {
- LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter );
- }
- break;
-
- case MATTYPE_NORMAL:
- {
- bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter);
- bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter);
-
- LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter);
- LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter);
- }
- break;
-
- case MATTYPE_SPECULAR:
- {
- shiny_scale_u->setValue(obj_scale_s * repeats_per_meter);
- shiny_scale_v->setValue(obj_scale_t * repeats_per_meter);
-
- LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter);
- LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter);
- }
- break;
-
- default:
- llassert(false);
- break;
- }
- }
- // vertical scale and repeats per meter depends on each other, so force set on changes
- self->updateUI(true);
+ bool identical_scale_s = false;
+ bool identical_scale_t = false;
+
+ LLSelectedTE::getObjectScaleS(obj_scale_s, identical_scale_s);
+ LLSelectedTE::getObjectScaleS(obj_scale_t, identical_scale_t);
+
+ LLUICtrl* bumpy_scale_u = self->getChild<LLUICtrl>("bumpyScaleU");
+ LLUICtrl* bumpy_scale_v = self->getChild<LLUICtrl>("bumpyScaleV");
+ LLUICtrl* shiny_scale_u = self->getChild<LLUICtrl>("shinyScaleU");
+ LLUICtrl* shiny_scale_v = self->getChild<LLUICtrl>("shinyScaleV");
+
+ if (gSavedSettings.getBOOL("SyncMaterialSettings"))
+ {
+ LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter );
+
+ bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter);
+ bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter);
+
+ LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter);
+ LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter);
+
+ shiny_scale_u->setValue(obj_scale_s * repeats_per_meter);
+ shiny_scale_v->setValue(obj_scale_t * repeats_per_meter);
+
+ LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter);
+ LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter);
+ }
+ else
+ {
+ switch (material_type)
+ {
+ case MATTYPE_DIFFUSE:
+ {
+ LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter );
+ }
+ break;
+
+ case MATTYPE_NORMAL:
+ {
+ bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter);
+ bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter);
+
+ LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter);
+ LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter);
+ }
+ break;
+
+ case MATTYPE_SPECULAR:
+ {
+ shiny_scale_u->setValue(obj_scale_s * repeats_per_meter);
+ shiny_scale_v->setValue(obj_scale_t * repeats_per_meter);
+
+ LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter);
+ LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter);
+ }
+ break;
+
+ default:
+ llassert(false);
+ break;
+ }
+ }
+ // vertical scale and repeats per meter depends on each other, so force set on changes
+ self->updateUI(true);
}
struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor
{
- virtual bool apply(LLViewerObject* object, S32 te)
- {
- viewer_media_t pMediaImpl;
-
- const LLTextureEntry* tep = object->getTE(te);
- const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
- if ( mep )
- {
- pMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
- }
-
- if ( pMediaImpl.isNull())
- {
- // If we didn't find face media for this face, check whether this face is showing parcel media.
- pMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(tep->getID());
- }
-
- if ( pMediaImpl.notNull())
- {
- LLPluginClassMedia *media = pMediaImpl->getMediaPlugin();
- if(media)
- {
- S32 media_width = media->getWidth();
- S32 media_height = media->getHeight();
- S32 texture_width = media->getTextureWidth();
- S32 texture_height = media->getTextureHeight();
- F32 scale_s = (F32)media_width / (F32)texture_width;
- F32 scale_t = (F32)media_height / (F32)texture_height;
-
- // set scale and adjust offset
- object->setTEScaleS( te, scale_s );
- object->setTEScaleT( te, scale_t ); // don't need to flip Y anymore since QT does this for us now.
- object->setTEOffsetS( te, -( 1.0f - scale_s ) / 2.0f );
- object->setTEOffsetT( te, -( 1.0f - scale_t ) / 2.0f );
- }
- }
- return true;
- };
+ virtual bool apply(LLViewerObject* object, S32 te)
+ {
+ viewer_media_t pMediaImpl;
+
+ const LLTextureEntry* tep = object->getTE(te);
+ const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
+ if ( mep )
+ {
+ pMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
+ }
+
+ if ( pMediaImpl.isNull())
+ {
+ // If we didn't find face media for this face, check whether this face is showing parcel media.
+ pMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(tep->getID());
+ }
+
+ if ( pMediaImpl.notNull())
+ {
+ LLPluginClassMedia *media = pMediaImpl->getMediaPlugin();
+ if(media)
+ {
+ S32 media_width = media->getWidth();
+ S32 media_height = media->getHeight();
+ S32 texture_width = media->getTextureWidth();
+ S32 texture_height = media->getTextureHeight();
+ F32 scale_s = (F32)media_width / (F32)texture_width;
+ F32 scale_t = (F32)media_height / (F32)texture_height;
+
+ // set scale and adjust offset
+ object->setTEScaleS( te, scale_s );
+ object->setTEScaleT( te, scale_t ); // don't need to flip Y anymore since QT does this for us now.
+ object->setTEOffsetS( te, -( 1.0f - scale_s ) / 2.0f );
+ object->setTEOffsetT( te, -( 1.0f - scale_t ) / 2.0f );
+ }
+ }
+ return true;
+ };
};
void LLPanelFace::onClickAutoFix(void* userdata)
{
- LLPanelFaceSetMediaFunctor setfunc;
- LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc);
+ LLPanelFaceSetMediaFunctor setfunc;
+ LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc);
- LLPanelFaceSendFunctor sendfunc;
- LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc);
+ LLPanelFaceSendFunctor sendfunc;
+ LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc);
}
void LLPanelFace::onAlignTexture(void* userdata)
@@ -4361,7 +4361,7 @@ void LLPanelFace::onCopyTexture()
{
te_data["te"]["itemfullperm"] = full_perm;
- te_data["te"]["fromlibrary"] = from_library;
+ te_data["te"]["fromlibrary"] = from_library;
// If full permission object, texture is free to copy,
// but otherwise we need to check inventory and extract permissions
@@ -4489,7 +4489,7 @@ void LLPanelFace::onPasteTexture()
}
// we can copy if single face was copied in edit face mode or if face count matches
- if (!((clipboard.size() == 1) && mClipboardParams["texture_all_tes"].asBoolean())
+ if (!((clipboard.size() == 1) && mClipboardParams["texture_all_tes"].asBoolean())
&& compare_tes != clipboard.size())
{
LLSD notif_args;
@@ -4871,9 +4871,9 @@ bool LLPanelFace::menuEnableItem(const LLSD& userdata)
// static
void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- self->getState();
- self->sendTextureInfo();
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ self->getState();
+ self->sendTextureInfo();
}
void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::function<void(LLGLTFMaterial::TextureTransform*)> edit)
@@ -5122,54 +5122,54 @@ void LLPanelFace::onCommitGLTFTextureOffsetV(LLUICtrl* ctrl)
void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp)
{
- LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL;
- LLRadioGroup* radio_mat_type = findChild<LLRadioGroup>("radio_material_type");
- if(!radio_mat_type)
- {
- return;
- }
- U32 mattype = radio_mat_type->getSelectedIndex();
- std::string which_control="texture control";
- switch (mattype)
- {
- case MATTYPE_SPECULAR:
- which_control = "shinytexture control";
- break;
- case MATTYPE_NORMAL:
- which_control = "bumpytexture control";
- break;
- // no default needed
- }
- LL_DEBUGS("Materials") << "control " << which_control << LL_ENDL;
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(which_control);
- if (texture_ctrl)
- {
- LLUUID obj_owner_id;
- std::string obj_owner_name;
- LLSelectMgr::instance().selectGetOwner(obj_owner_id, obj_owner_name);
-
- LLSaleInfo sale_info;
- LLSelectMgr::instance().selectGetSaleInfo(sale_info);
-
- bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture?
- bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture?
- bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent?
- bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply texture not for sale?
-
- if (can_copy && can_transfer)
- {
- texture_ctrl->setCanApply(true, true);
- return;
- }
-
- // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale
- texture_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale);
-
- if (gSavedSettings.getBOOL("TextureLivePreview"))
- {
- LLNotificationsUtil::add("LivePreviewUnavailable");
- }
- }
+ LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL;
+ LLRadioGroup* radio_mat_type = findChild<LLRadioGroup>("radio_material_type");
+ if(!radio_mat_type)
+ {
+ return;
+ }
+ U32 mattype = radio_mat_type->getSelectedIndex();
+ std::string which_control="texture control";
+ switch (mattype)
+ {
+ case MATTYPE_SPECULAR:
+ which_control = "shinytexture control";
+ break;
+ case MATTYPE_NORMAL:
+ which_control = "bumpytexture control";
+ break;
+ // no default needed
+ }
+ LL_DEBUGS("Materials") << "control " << which_control << LL_ENDL;
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(which_control);
+ if (texture_ctrl)
+ {
+ LLUUID obj_owner_id;
+ std::string obj_owner_name;
+ LLSelectMgr::instance().selectGetOwner(obj_owner_id, obj_owner_name);
+
+ LLSaleInfo sale_info;
+ LLSelectMgr::instance().selectGetSaleInfo(sale_info);
+
+ bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture?
+ bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture?
+ bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent?
+ bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply texture not for sale?
+
+ if (can_copy && can_transfer)
+ {
+ texture_ctrl->setCanApply(true, true);
+ return;
+ }
+
+ // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale
+ texture_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale);
+
+ if (gSavedSettings.getBOOL("TextureLivePreview"))
+ {
+ LLNotificationsUtil::add("LivePreviewUnavailable");
+ }
+ }
}
void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp)
@@ -5209,81 +5209,81 @@ void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp)
bool LLPanelFace::isIdenticalPlanarTexgen()
{
- LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT;
- bool identical_texgen = false;
- LLSelectedTE::getTexGen(selected_texgen, identical_texgen);
- return (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR));
+ LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT;
+ bool identical_texgen = false;
+ LLSelectedTE::getTexGen(selected_texgen, identical_texgen);
+ return (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR));
}
void LLPanelFace::LLSelectedTE::getFace(LLFace*& face_to_return, bool& identical_face)
-{
- struct LLSelectedTEGetFace : public LLSelectedTEGetFunctor<LLFace *>
- {
- LLFace* get(LLViewerObject* object, S32 te)
- {
- return (object->mDrawable) ? object->mDrawable->getFace(te): NULL;
- }
- } get_te_face_func;
- identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, face_to_return, false, (LLFace*)nullptr);
+{
+ struct LLSelectedTEGetFace : public LLSelectedTEGetFunctor<LLFace *>
+ {
+ LLFace* get(LLViewerObject* object, S32 te)
+ {
+ return (object->mDrawable) ? object->mDrawable->getFace(te): NULL;
+ }
+ } get_te_face_func;
+ identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, face_to_return, false, (LLFace*)nullptr);
}
void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face)
{
- LLGLenum image_format;
- struct LLSelectedTEGetImageFormat : public LLSelectedTEGetFunctor<LLGLenum>
- {
- LLGLenum get(LLViewerObject* object, S32 te_index)
- {
- LLViewerTexture* image = object->getTEImage(te_index);
- return image ? image->getPrimaryFormat() : GL_RGB;
- }
- } get_glenum;
- identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_glenum, image_format);
- image_format_to_return = image_format;
+ LLGLenum image_format;
+ struct LLSelectedTEGetImageFormat : public LLSelectedTEGetFunctor<LLGLenum>
+ {
+ LLGLenum get(LLViewerObject* object, S32 te_index)
+ {
+ LLViewerTexture* image = object->getTEImage(te_index);
+ return image ? image->getPrimaryFormat() : GL_RGB;
+ }
+ } get_glenum;
+ identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_glenum, image_format);
+ image_format_to_return = image_format;
}
void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical)
-{
- struct LLSelectedTEGetTexId : public LLSelectedTEGetFunctor<LLUUID>
- {
- LLUUID get(LLViewerObject* object, S32 te_index)
- {
- LLTextureEntry *te = object->getTE(te_index);
- if (te)
- {
- if ((te->getID() == IMG_USE_BAKED_EYES) || (te->getID() == IMG_USE_BAKED_HAIR) || (te->getID() == IMG_USE_BAKED_HEAD) || (te->getID() == IMG_USE_BAKED_LOWER) || (te->getID() == IMG_USE_BAKED_SKIRT) || (te->getID() == IMG_USE_BAKED_UPPER)
- || (te->getID() == IMG_USE_BAKED_LEFTARM) || (te->getID() == IMG_USE_BAKED_LEFTLEG) || (te->getID() == IMG_USE_BAKED_AUX1) || (te->getID() == IMG_USE_BAKED_AUX2) || (te->getID() == IMG_USE_BAKED_AUX3))
- {
- return te->getID();
- }
- }
-
- LLUUID id;
- LLViewerTexture* image = object->getTEImage(te_index);
- if (image)
- {
- id = image->getID();
- }
-
- if (!id.isNull() && LLViewerMedia::getInstance()->textureHasMedia(id))
- {
- if (te)
- {
- LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), TEX_LIST_STANDARD) : NULL;
- if(!tex)
- {
- tex = LLViewerFetchedTexture::sDefaultImagep;
- }
- if (tex)
- {
- id = tex->getID();
- }
- }
- }
- return id;
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id );
+{
+ struct LLSelectedTEGetTexId : public LLSelectedTEGetFunctor<LLUUID>
+ {
+ LLUUID get(LLViewerObject* object, S32 te_index)
+ {
+ LLTextureEntry *te = object->getTE(te_index);
+ if (te)
+ {
+ if ((te->getID() == IMG_USE_BAKED_EYES) || (te->getID() == IMG_USE_BAKED_HAIR) || (te->getID() == IMG_USE_BAKED_HEAD) || (te->getID() == IMG_USE_BAKED_LOWER) || (te->getID() == IMG_USE_BAKED_SKIRT) || (te->getID() == IMG_USE_BAKED_UPPER)
+ || (te->getID() == IMG_USE_BAKED_LEFTARM) || (te->getID() == IMG_USE_BAKED_LEFTLEG) || (te->getID() == IMG_USE_BAKED_AUX1) || (te->getID() == IMG_USE_BAKED_AUX2) || (te->getID() == IMG_USE_BAKED_AUX3))
+ {
+ return te->getID();
+ }
+ }
+
+ LLUUID id;
+ LLViewerTexture* image = object->getTEImage(te_index);
+ if (image)
+ {
+ id = image->getID();
+ }
+
+ if (!id.isNull() && LLViewerMedia::getInstance()->textureHasMedia(id))
+ {
+ if (te)
+ {
+ LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), TEX_LIST_STANDARD) : NULL;
+ if(!tex)
+ {
+ tex = LLViewerFetchedTexture::sDefaultImagep;
+ }
+ if (tex)
+ {
+ id = tex->getID();
+ }
+ }
+ }
+ return id;
+ }
+ } func;
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id );
}
void LLPanelFace::LLSelectedTE::getPbrMaterialId(LLUUID& id, bool& identical, bool& has_faces_with_pbr, bool& has_faces_without_pbr)
@@ -5316,7 +5316,7 @@ void LLPanelFace::LLSelectedTE::getPbrMaterialId(LLUUID& id, bool& identical, bo
{
mIdenticalId = false;
}
-
+
LLGLTFMaterial* te_override = object->getTE(te_index)->getGLTFMaterialOverride();
if (te_override)
{
@@ -5359,140 +5359,140 @@ void LLPanelFace::LLSelectedTE::getPbrMaterialId(LLUUID& id, bool& identical, bo
void LLPanelFace::LLSelectedTEMaterial::getCurrent(LLMaterialPtr& material_ptr, bool& identical_material)
{
- struct MaterialFunctor : public LLSelectedTEGetFunctor<LLMaterialPtr>
- {
- LLMaterialPtr get(LLViewerObject* object, S32 te_index)
- {
- return object->getTE(te_index)->getMaterialParams();
- }
- } func;
- identical_material = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_ptr);
+ struct MaterialFunctor : public LLSelectedTEGetFunctor<LLMaterialPtr>
+ {
+ LLMaterialPtr get(LLViewerObject* object, S32 te_index)
+ {
+ return object->getTE(te_index)->getMaterialParams();
+ }
+ } func;
+ identical_material = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_ptr);
}
void LLPanelFace::LLSelectedTEMaterial::getMaxSpecularRepeats(F32& repeats, bool& identical)
{
- struct LLSelectedTEGetMaxSpecRepeats : public LLSelectedTEGetFunctor<F32>
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
- U32 s_axis = VX;
- U32 t_axis = VY;
- F32 repeats_s = 1.0f;
- F32 repeats_t = 1.0f;
- if (mat)
- {
- mat->getSpecularRepeat(repeats_s, repeats_t);
- repeats_s /= object->getScale().mV[s_axis];
- repeats_t /= object->getScale().mV[t_axis];
- }
- return llmax(repeats_s, repeats_t);
- }
-
- } max_spec_repeats_func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_spec_repeats_func, repeats);
+ struct LLSelectedTEGetMaxSpecRepeats : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ U32 s_axis = VX;
+ U32 t_axis = VY;
+ F32 repeats_s = 1.0f;
+ F32 repeats_t = 1.0f;
+ if (mat)
+ {
+ mat->getSpecularRepeat(repeats_s, repeats_t);
+ repeats_s /= object->getScale().mV[s_axis];
+ repeats_t /= object->getScale().mV[t_axis];
+ }
+ return llmax(repeats_s, repeats_t);
+ }
+
+ } max_spec_repeats_func;
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_spec_repeats_func, repeats);
}
void LLPanelFace::LLSelectedTEMaterial::getMaxNormalRepeats(F32& repeats, bool& identical)
{
- struct LLSelectedTEGetMaxNormRepeats : public LLSelectedTEGetFunctor<F32>
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
- U32 s_axis = VX;
- U32 t_axis = VY;
- F32 repeats_s = 1.0f;
- F32 repeats_t = 1.0f;
- if (mat)
- {
- mat->getNormalRepeat(repeats_s, repeats_t);
- repeats_s /= object->getScale().mV[s_axis];
- repeats_t /= object->getScale().mV[t_axis];
- }
- return llmax(repeats_s, repeats_t);
- }
-
- } max_norm_repeats_func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_norm_repeats_func, repeats);
+ struct LLSelectedTEGetMaxNormRepeats : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
+ U32 s_axis = VX;
+ U32 t_axis = VY;
+ F32 repeats_s = 1.0f;
+ F32 repeats_t = 1.0f;
+ if (mat)
+ {
+ mat->getNormalRepeat(repeats_s, repeats_t);
+ repeats_s /= object->getScale().mV[s_axis];
+ repeats_t /= object->getScale().mV[t_axis];
+ }
+ return llmax(repeats_s, repeats_t);
+ }
+
+ } max_norm_repeats_func;
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_norm_repeats_func, repeats);
}
void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha)
{
- struct LLSelectedTEGetDiffuseAlphaMode : public LLSelectedTEGetFunctor<U8>
- {
- LLSelectedTEGetDiffuseAlphaMode() : _isAlpha(false) {}
- LLSelectedTEGetDiffuseAlphaMode(bool diffuse_texture_has_alpha) : _isAlpha(diffuse_texture_has_alpha) {}
- virtual ~LLSelectedTEGetDiffuseAlphaMode() {}
-
- U8 get(LLViewerObject* object, S32 face)
- {
- U8 diffuse_mode = _isAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
-
- LLTextureEntry* tep = object->getTE(face);
- if (tep)
- {
- LLMaterial* mat = tep->getMaterialParams().get();
- if (mat)
- {
- diffuse_mode = mat->getDiffuseAlphaMode();
- }
- }
-
- return diffuse_mode;
- }
- bool _isAlpha; // whether or not the diffuse texture selected contains alpha information
- } get_diff_mode(diffuse_texture_has_alpha);
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &get_diff_mode, diffuse_alpha_mode);
+ struct LLSelectedTEGetDiffuseAlphaMode : public LLSelectedTEGetFunctor<U8>
+ {
+ LLSelectedTEGetDiffuseAlphaMode() : _isAlpha(false) {}
+ LLSelectedTEGetDiffuseAlphaMode(bool diffuse_texture_has_alpha) : _isAlpha(diffuse_texture_has_alpha) {}
+ virtual ~LLSelectedTEGetDiffuseAlphaMode() {}
+
+ U8 get(LLViewerObject* object, S32 face)
+ {
+ U8 diffuse_mode = _isAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+
+ LLTextureEntry* tep = object->getTE(face);
+ if (tep)
+ {
+ LLMaterial* mat = tep->getMaterialParams().get();
+ if (mat)
+ {
+ diffuse_mode = mat->getDiffuseAlphaMode();
+ }
+ }
+
+ return diffuse_mode;
+ }
+ bool _isAlpha; // whether or not the diffuse texture selected contains alpha information
+ } get_diff_mode(diffuse_texture_has_alpha);
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &get_diff_mode, diffuse_alpha_mode);
}
void LLPanelFace::LLSelectedTE::getObjectScaleS(F32& scale_s, bool& identical)
-{
- struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor<F32>
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- U32 s_axis = VX;
- U32 t_axis = VY;
- LLPrimitive::getTESTAxes(face, &s_axis, &t_axis);
- return object->getScale().mV[s_axis];
- }
+{
+ struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ U32 s_axis = VX;
+ U32 t_axis = VY;
+ LLPrimitive::getTESTAxes(face, &s_axis, &t_axis);
+ return object->getScale().mV[s_axis];
+ }
- } scale_s_func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_s_func, scale_s );
+ } scale_s_func;
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_s_func, scale_s );
}
void LLPanelFace::LLSelectedTE::getObjectScaleT(F32& scale_t, bool& identical)
-{
- struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor<F32>
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- U32 s_axis = VX;
- U32 t_axis = VY;
- LLPrimitive::getTESTAxes(face, &s_axis, &t_axis);
- return object->getScale().mV[t_axis];
- }
+{
+ struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ U32 s_axis = VX;
+ U32 t_axis = VY;
+ LLPrimitive::getTESTAxes(face, &s_axis, &t_axis);
+ return object->getScale().mV[t_axis];
+ }
- } scale_t_func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_t_func, scale_t );
+ } scale_t_func;
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_t_func, scale_t );
}
void LLPanelFace::LLSelectedTE::getMaxDiffuseRepeats(F32& repeats, bool& identical)
{
- struct LLSelectedTEGetMaxDiffuseRepeats : public LLSelectedTEGetFunctor<F32>
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- U32 s_axis = VX;
- U32 t_axis = VY;
- LLPrimitive::getTESTAxes(face, &s_axis, &t_axis);
- F32 repeats_s = object->getTE(face)->mScaleS / object->getScale().mV[s_axis];
- F32 repeats_t = object->getTE(face)->mScaleT / object->getScale().mV[t_axis];
- return llmax(repeats_s, repeats_t);
- }
-
- } max_diff_repeats_func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_diff_repeats_func, repeats );
+ struct LLSelectedTEGetMaxDiffuseRepeats : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ U32 s_axis = VX;
+ U32 t_axis = VY;
+ LLPrimitive::getTESTAxes(face, &s_axis, &t_axis);
+ F32 repeats_s = object->getTE(face)->mScaleS / object->getScale().mV[s_axis];
+ F32 repeats_t = object->getTE(face)->mScaleT / object->getScale().mV[t_axis];
+ return llmax(repeats_s, repeats_t);
+ }
+
+ } max_diff_repeats_func;
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_diff_repeats_func, repeats );
}
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index a64b85815f..1cdb9950d6 100644
--- a/indra/newview/llpanelface.h
+++ b/indra/newview/llpanelface.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelface.h
* @brief Panel in the tools floater for editing face textures, colors, etc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -65,178 +65,178 @@ class PBRPickerObjectListener;
// boost who?
//
template<
- typename DataType,
- typename SetValueType,
- void (LLMaterial::*MaterialEditFunc)(SetValueType data) >
+ typename DataType,
+ typename SetValueType,
+ void (LLMaterial::*MaterialEditFunc)(SetValueType data) >
class LLMaterialEditFunctor
{
public:
- LLMaterialEditFunctor(const DataType& data) : _data(data) {}
- virtual ~LLMaterialEditFunctor() {}
- virtual void apply(LLMaterialPtr& material) { (material->*(MaterialEditFunc))(_data); }
- DataType _data;
+ LLMaterialEditFunctor(const DataType& data) : _data(data) {}
+ virtual ~LLMaterialEditFunctor() {}
+ virtual void apply(LLMaterialPtr& material) { (material->*(MaterialEditFunc))(_data); }
+ DataType _data;
};
template<
- typename DataType,
- DataType (LLMaterial::*MaterialGetFunc)() >
+ typename DataType,
+ DataType (LLMaterial::*MaterialGetFunc)() >
class LLMaterialGetFunctor
{
public:
- LLMaterialGetFunctor() {}
- virtual DataType get(LLMaterialPtr& material) { return (material->*(MaterialGetFunc)); }
+ LLMaterialGetFunctor() {}
+ virtual DataType get(LLMaterialPtr& material) { return (material->*(MaterialGetFunc)); }
};
template<
- typename DataType,
- DataType (LLTextureEntry::*TEGetFunc)() >
+ typename DataType,
+ DataType (LLTextureEntry::*TEGetFunc)() >
class LLTEGetFunctor
{
public:
- LLTEGetFunctor() {}
- virtual DataType get(LLTextureEntry* entry) { return (entry*(TEGetFunc)); }
+ LLTEGetFunctor() {}
+ virtual DataType get(LLTextureEntry* entry) { return (entry*(TEGetFunc)); }
};
class LLPanelFace : public LLPanel
{
public:
- virtual BOOL postBuild();
- LLPanelFace();
- virtual ~LLPanelFace();
+ virtual BOOL postBuild();
+ LLPanelFace();
+ virtual ~LLPanelFace();
- void refresh();
- void refreshMedia();
- void unloadMedia();
+ void refresh();
+ void refreshMedia();
+ void unloadMedia();
static void onMaterialOverrideReceived(const LLUUID& object_id, S32 side);
/*virtual*/ void onVisibilityChange(BOOL new_visibility);
/*virtual*/ void draw();
- LLMaterialPtr createDefaultMaterial(LLMaterialPtr current_material)
- {
- LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial());
- llassert_always(new_material);
+ LLMaterialPtr createDefaultMaterial(LLMaterialPtr current_material)
+ {
+ LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial());
+ llassert_always(new_material);
- // Preserve old diffuse alpha mode or assert correct default blend mode as appropriate for the alpha channel content of the diffuse texture
- //
- new_material->setDiffuseAlphaMode(current_material.isNull() ? (isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE) : current_material->getDiffuseAlphaMode());
- return new_material;
- }
+ // Preserve old diffuse alpha mode or assert correct default blend mode as appropriate for the alpha channel content of the diffuse texture
+ //
+ new_material->setDiffuseAlphaMode(current_material.isNull() ? (isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE) : current_material->getDiffuseAlphaMode());
+ return new_material;
+ }
- LLRender::eTexIndex getTextureChannelToEdit();
+ LLRender::eTexIndex getTextureChannelToEdit();
LLRender::eTexIndex getTextureDropChannel();
LLGLTFMaterial::TextureInfo getPBRDropChannel();
protected:
- void navigateToTitleMedia(const std::string url);
- bool selectedMediaEditable();
- void clearMediaSettings();
- void updateMediaSettings();
- void updateMediaTitle();
-
- void getState();
-
- void sendTexture(); // applies and sends texture
- void sendTextureInfo(); // applies and sends texture scale, offset, etc.
- void sendColor(); // applies and sends color
- void sendAlpha(); // applies and sends transparency
- void sendBump(U32 bumpiness); // applies and sends bump map
- void sendTexGen(); // applies and sends bump map
- void sendShiny(U32 shininess); // applies and sends shininess
- void sendFullbright(); // applies and sends full bright
- void sendGlow();
+ void navigateToTitleMedia(const std::string url);
+ bool selectedMediaEditable();
+ void clearMediaSettings();
+ void updateMediaSettings();
+ void updateMediaTitle();
+
+ void getState();
+
+ void sendTexture(); // applies and sends texture
+ void sendTextureInfo(); // applies and sends texture scale, offset, etc.
+ void sendColor(); // applies and sends color
+ void sendAlpha(); // applies and sends transparency
+ void sendBump(U32 bumpiness); // applies and sends bump map
+ void sendTexGen(); // applies and sends bump map
+ void sendShiny(U32 shininess); // applies and sends shininess
+ void sendFullbright(); // applies and sends full bright
+ void sendGlow();
void alignTestureLayer();
void updateCopyTexButton();
- void onCommitPbr(const LLSD& data);
- void onCancelPbr(const LLSD& data);
- void onSelectPbr(const LLSD& data);
+ void onCommitPbr(const LLSD& data);
+ void onCancelPbr(const LLSD& data);
+ void onSelectPbr(const LLSD& data);
static BOOL onDragPbr(LLUICtrl* ctrl, LLInventoryItem* item);
- // this function is to return TRUE if the drag should succeed.
- static BOOL onDragTexture(LLUICtrl* ctrl, LLInventoryItem* item);
-
- void onCommitTexture(const LLSD& data);
- void onCancelTexture(const LLSD& data);
- void onSelectTexture(const LLSD& data);
- void onCommitSpecularTexture(const LLSD& data);
- void onCancelSpecularTexture(const LLSD& data);
- void onSelectSpecularTexture(const LLSD& data);
- void onCommitNormalTexture(const LLSD& data);
- void onCancelNormalTexture(const LLSD& data);
- void onSelectNormalTexture(const LLSD& data);
- void onCommitColor(const LLSD& data);
- void onCommitShinyColor(const LLSD& data);
- void onCommitAlpha(const LLSD& data);
- void onCancelColor(const LLSD& data);
- void onCancelShinyColor(const LLSD& data);
- void onSelectColor(const LLSD& data);
- void onSelectShinyColor(const LLSD& data);
-
- void onCloseTexturePicker(const LLSD& data);
+ // this function is to return TRUE if the drag should succeed.
+ static BOOL onDragTexture(LLUICtrl* ctrl, LLInventoryItem* item);
+
+ void onCommitTexture(const LLSD& data);
+ void onCancelTexture(const LLSD& data);
+ void onSelectTexture(const LLSD& data);
+ void onCommitSpecularTexture(const LLSD& data);
+ void onCancelSpecularTexture(const LLSD& data);
+ void onSelectSpecularTexture(const LLSD& data);
+ void onCommitNormalTexture(const LLSD& data);
+ void onCancelNormalTexture(const LLSD& data);
+ void onSelectNormalTexture(const LLSD& data);
+ void onCommitColor(const LLSD& data);
+ void onCommitShinyColor(const LLSD& data);
+ void onCommitAlpha(const LLSD& data);
+ void onCancelColor(const LLSD& data);
+ void onCancelShinyColor(const LLSD& data);
+ void onSelectColor(const LLSD& data);
+ void onSelectShinyColor(const LLSD& data);
+
+ void onCloseTexturePicker(const LLSD& data);
static bool deleteMediaConfirm(const LLSD& notification, const LLSD& response);
static bool multipleFacesSelectedConfirm(const LLSD& notification, const LLSD& response);
- // Make UI reflect state of currently selected material (refresh)
- // and UI mode (e.g. editing normal map v diffuse map)
- //
- // @param force_set_values forces spinners to set value even if they are focused
- void updateUI(bool force_set_values = false);
-
- // Convenience func to determine if all faces in selection have
- // identical planar texgen settings during edits
- //
- bool isIdenticalPlanarTexgen();
-
- // Callback funcs for individual controls
- //
- static void onCommitTextureInfo(LLUICtrl* ctrl, void* userdata);
- static void onCommitTextureScaleX(LLUICtrl* ctrl, void* userdata);
- static void onCommitTextureScaleY(LLUICtrl* ctrl, void* userdata);
- static void onCommitTextureRot(LLUICtrl* ctrl, void* userdata);
- static void onCommitTextureOffsetX(LLUICtrl* ctrl, void* userdata);
- static void onCommitTextureOffsetY(LLUICtrl* ctrl, void* userdata);
-
- static void onCommitMaterialBumpyScaleX( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialBumpyScaleY( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialBumpyRot( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialBumpyOffsetX( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialBumpyOffsetY( LLUICtrl* ctrl, void* userdata);
-
- static void syncRepeatX(LLPanelFace* self, F32 scaleU);
- static void syncRepeatY(LLPanelFace* self, F32 scaleV);
- static void syncOffsetX(LLPanelFace* self, F32 offsetU);
- static void syncOffsetY(LLPanelFace* self, F32 offsetV);
- static void syncMaterialRot(LLPanelFace* self, F32 rot, int te = -1);
-
- static void onCommitMaterialShinyScaleX( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialShinyScaleY( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialShinyRot( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialShinyOffsetX( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialShinyOffsetY( LLUICtrl* ctrl, void* userdata);
-
- static void onCommitMaterialGloss( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialEnv( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialMaskCutoff( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialID( LLUICtrl* ctrl, void* userdata);
-
- static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata);
- static void onCommitPbrType(LLUICtrl* ctrl, void* userdata);
- static void onClickBtnEditMedia(LLUICtrl* ctrl, void* userdata);
- static void onClickBtnDeleteMedia(LLUICtrl* ctrl, void* userdata);
- static void onClickBtnAddMedia(LLUICtrl* ctrl, void* userdata);
- static void onCommitBump( LLUICtrl* ctrl, void* userdata);
- static void onCommitTexGen( LLUICtrl* ctrl, void* userdata);
- static void onCommitShiny( LLUICtrl* ctrl, void* userdata);
- static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata);
- static void onCommitFullbright( LLUICtrl* ctrl, void* userdata);
- static void onCommitGlow( LLUICtrl* ctrl, void *userdata);
- static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata);
- static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo);
+ // Make UI reflect state of currently selected material (refresh)
+ // and UI mode (e.g. editing normal map v diffuse map)
+ //
+ // @param force_set_values forces spinners to set value even if they are focused
+ void updateUI(bool force_set_values = false);
+
+ // Convenience func to determine if all faces in selection have
+ // identical planar texgen settings during edits
+ //
+ bool isIdenticalPlanarTexgen();
+
+ // Callback funcs for individual controls
+ //
+ static void onCommitTextureInfo(LLUICtrl* ctrl, void* userdata);
+ static void onCommitTextureScaleX(LLUICtrl* ctrl, void* userdata);
+ static void onCommitTextureScaleY(LLUICtrl* ctrl, void* userdata);
+ static void onCommitTextureRot(LLUICtrl* ctrl, void* userdata);
+ static void onCommitTextureOffsetX(LLUICtrl* ctrl, void* userdata);
+ static void onCommitTextureOffsetY(LLUICtrl* ctrl, void* userdata);
+
+ static void onCommitMaterialBumpyScaleX( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialBumpyScaleY( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialBumpyRot( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialBumpyOffsetX( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialBumpyOffsetY( LLUICtrl* ctrl, void* userdata);
+
+ static void syncRepeatX(LLPanelFace* self, F32 scaleU);
+ static void syncRepeatY(LLPanelFace* self, F32 scaleV);
+ static void syncOffsetX(LLPanelFace* self, F32 offsetU);
+ static void syncOffsetY(LLPanelFace* self, F32 offsetV);
+ static void syncMaterialRot(LLPanelFace* self, F32 rot, int te = -1);
+
+ static void onCommitMaterialShinyScaleX( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialShinyScaleY( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialShinyRot( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialShinyOffsetX( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialShinyOffsetY( LLUICtrl* ctrl, void* userdata);
+
+ static void onCommitMaterialGloss( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialEnv( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialMaskCutoff( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialID( LLUICtrl* ctrl, void* userdata);
+
+ static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata);
+ static void onCommitPbrType(LLUICtrl* ctrl, void* userdata);
+ static void onClickBtnEditMedia(LLUICtrl* ctrl, void* userdata);
+ static void onClickBtnDeleteMedia(LLUICtrl* ctrl, void* userdata);
+ static void onClickBtnAddMedia(LLUICtrl* ctrl, void* userdata);
+ static void onCommitBump( LLUICtrl* ctrl, void* userdata);
+ static void onCommitTexGen( LLUICtrl* ctrl, void* userdata);
+ static void onCommitShiny( LLUICtrl* ctrl, void* userdata);
+ static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata);
+ static void onCommitFullbright( LLUICtrl* ctrl, void* userdata);
+ static void onCommitGlow( LLUICtrl* ctrl, void *userdata);
+ static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata);
+ static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo);
void onCommitGLTFTextureScaleU(LLUICtrl* ctrl);
void onCommitGLTFTextureScaleV(LLUICtrl* ctrl);
@@ -244,11 +244,11 @@ protected:
void onCommitGLTFTextureOffsetU(LLUICtrl* ctrl);
void onCommitGLTFTextureOffsetV(LLUICtrl* ctrl);
- static void onClickAutoFix(void*);
- static void onAlignTexture(void*);
- static void onClickBtnLoadInvPBR(void* userdata);
- static void onClickBtnEditPBR(void* userdata);
- static void onClickBtnSavePBR(void* userdata);
+ static void onClickAutoFix(void*);
+ static void onAlignTexture(void*);
+ static void onClickBtnLoadInvPBR(void* userdata);
+ static void onClickBtnEditPBR(void* userdata);
+ static void onClickBtnSavePBR(void* userdata);
public: // needs to be accessible to selection manager
void onCopyColor(); // records all selected faces
@@ -262,200 +262,200 @@ protected:
void menuDoToSelected(const LLSD& userdata);
bool menuEnableItem(const LLSD& userdata);
- static F32 valueGlow(LLViewerObject* object, S32 face);
+ static F32 valueGlow(LLViewerObject* object, S32 face);
+
-
private:
- bool isAlpha() { return mIsAlpha; }
-
- // Convenience funcs to keep the visual flack to a minimum
- //
- LLUUID getCurrentNormalMap();
- LLUUID getCurrentSpecularMap();
- U32 getCurrentShininess();
- U32 getCurrentBumpiness();
- U8 getCurrentDiffuseAlphaMode();
- U8 getCurrentAlphaMaskCutoff();
- U8 getCurrentEnvIntensity();
- U8 getCurrentGlossiness();
- F32 getCurrentBumpyRot();
- F32 getCurrentBumpyScaleU();
- F32 getCurrentBumpyScaleV();
- F32 getCurrentBumpyOffsetU();
- F32 getCurrentBumpyOffsetV();
- F32 getCurrentShinyRot();
- F32 getCurrentShinyScaleU();
- F32 getCurrentShinyScaleV();
- F32 getCurrentShinyOffsetU();
- F32 getCurrentShinyOffsetV();
+ bool isAlpha() { return mIsAlpha; }
+
+ // Convenience funcs to keep the visual flack to a minimum
+ //
+ LLUUID getCurrentNormalMap();
+ LLUUID getCurrentSpecularMap();
+ U32 getCurrentShininess();
+ U32 getCurrentBumpiness();
+ U8 getCurrentDiffuseAlphaMode();
+ U8 getCurrentAlphaMaskCutoff();
+ U8 getCurrentEnvIntensity();
+ U8 getCurrentGlossiness();
+ F32 getCurrentBumpyRot();
+ F32 getCurrentBumpyScaleU();
+ F32 getCurrentBumpyScaleV();
+ F32 getCurrentBumpyOffsetU();
+ F32 getCurrentBumpyOffsetV();
+ F32 getCurrentShinyRot();
+ F32 getCurrentShinyScaleU();
+ F32 getCurrentShinyScaleV();
+ F32 getCurrentShinyOffsetU();
+ F32 getCurrentShinyOffsetV();
LLComboBox *mComboMatMedia;
LLMediaCtrl *mTitleMedia;
LLTextBox *mTitleMediaText;
- // Update visibility of controls to match current UI mode
- // (e.g. materials vs media editing)
- //
- // Do NOT call updateUI from within this function.
- //
- void updateVisibility(LLViewerObject* objectp = nullptr);
-
- // Hey look everyone, a type-safe alternative to copy and paste! :)
- //
-
- // Update material parameters by applying 'edit_func' to selected TEs
- //
- template<
- typename DataType,
- typename SetValueType,
- void (LLMaterial::*MaterialEditFunc)(SetValueType data) >
- static void edit(LLPanelFace* p, DataType data, int te = -1, const LLUUID &only_for_object_id = LLUUID())
- {
- LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc > edit(data);
- struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor
- {
- LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* editp, const LLUUID &only_for_object_id) : _panel(panel), _edit(editp), _only_for_object_id(only_for_object_id) {}
- virtual ~LLSelectedTEEditMaterial() {};
- virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material)
- {
- if (_edit && (_only_for_object_id.isNull() || _only_for_object_id == object->getID()))
- {
- LLMaterialPtr new_material = _panel->createDefaultMaterial(current_material);
- llassert_always(new_material);
-
- // Determine correct alpha mode for current diffuse texture
- // (i.e. does it have an alpha channel that makes alpha mode useful)
- //
- // _panel->isAlpha() "lies" when one face has alpha and the rest do not (NORSPEC-329)
- // need to get per-face answer to this question for sane alpha mode retention on updates.
- //
- bool is_alpha_face = object->isImageAlphaBlended(face);
-
- // need to keep this original answer for valid comparisons in logic below
- //
- U8 original_default_alpha_mode = is_alpha_face ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
-
- U8 default_alpha_mode = original_default_alpha_mode;
-
- if (!current_material.isNull())
- {
- default_alpha_mode = current_material->getDiffuseAlphaMode();
- }
-
- // Insure we don't inherit the default of blend by accident...
- // this will be stomped by a legit request to change the alpha mode by the apply() below
- //
- new_material->setDiffuseAlphaMode(default_alpha_mode);
-
- // Do "It"!
- //
- _edit->apply(new_material);
-
- U32 new_alpha_mode = new_material->getDiffuseAlphaMode();
- LLUUID new_normal_map_id = new_material->getNormalID();
- LLUUID new_spec_map_id = new_material->getSpecularID();
-
- if ((new_alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) && !is_alpha_face)
- {
- new_alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
- new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE);
- }
-
- bool is_default_blend_mode = (new_alpha_mode == original_default_alpha_mode);
- bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull();
-
- if (!is_need_material)
- {
- LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
- LLMaterialMgr::getInstance()->remove(object->getID(),face);
- new_material = NULL;
- }
- else
- {
- LL_DEBUGS("Materials") << "Putting material on object " << object->getID() << " face " << face << ", material: " << new_material->asLLSD() << LL_ENDL;
- LLMaterialMgr::getInstance()->put(object->getID(),face,*new_material);
- }
-
- object->setTEMaterialParams(face, new_material);
- return new_material;
- }
- return NULL;
- }
- LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit;
- LLPanelFace *_panel;
- const LLUUID & _only_for_object_id;
- } editor(p, &edit, only_for_object_id);
- LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te);
- }
-
- template<
- typename DataType,
- typename ReturnType,
- ReturnType (LLMaterial::* const MaterialGetFunc)() const >
- static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
- {
- DataType data_value;
- struct GetTEMaterialVal : public LLSelectedTEGetFunctor<DataType>
- {
- GetTEMaterialVal(DataType default_value) : _default(default_value) {}
- virtual ~GetTEMaterialVal() {}
-
- DataType get(LLViewerObject* object, S32 face)
- {
- DataType ret = _default;
- LLMaterialPtr material_ptr;
- LLTextureEntry* tep = object ? object->getTE(face) : NULL;
- if (tep)
- {
- material_ptr = tep->getMaterialParams();
- if (!material_ptr.isNull())
- {
- ret = (material_ptr->*(MaterialGetFunc))();
- }
- }
- return ret;
- }
- DataType _default;
- } GetFunc(default_value);
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_value, has_tolerance, tolerance);
- data_to_return = data_value;
- }
-
- template<
- typename DataType,
- typename ReturnType, // some kids just have to different...
- ReturnType (LLTextureEntry::* const TEGetFunc)() const >
- static void getTEValue(DataType& data_to_return, bool& identical, DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
- {
- DataType data_value;
- struct GetTEVal : public LLSelectedTEGetFunctor<DataType>
- {
- GetTEVal(DataType default_value) : _default(default_value) {}
- virtual ~GetTEVal() {}
-
- DataType get(LLViewerObject* object, S32 face) {
- LLTextureEntry* tep = object ? object->getTE(face) : NULL;
- return tep ? ((tep->*(TEGetFunc))()) : _default;
- }
- DataType _default;
- } GetTEValFunc(default_value);
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_value, has_tolerance, tolerance );
- data_to_return = data_value;
- }
-
- // Update vis and enabling of specific subsets of controls based on material params
- // (e.g. hide the spec controls if no spec texture is applied)
- //
- void updateShinyControls(bool is_setting_texture = false, bool mess_with_combobox = false);
- void updateBumpyControls(bool is_setting_texture = false, bool mess_with_combobox = false);
- void updateAlphaControls();
-
- /*
- * Checks whether the selected texture from the LLFloaterTexturePicker can be applied to the currently selected object.
- * If agent selects texture which is not allowed to be applied for the currently selected object,
- * all controls of the floater texture picker which allow to apply the texture will be disabled.
- */
+ // Update visibility of controls to match current UI mode
+ // (e.g. materials vs media editing)
+ //
+ // Do NOT call updateUI from within this function.
+ //
+ void updateVisibility(LLViewerObject* objectp = nullptr);
+
+ // Hey look everyone, a type-safe alternative to copy and paste! :)
+ //
+
+ // Update material parameters by applying 'edit_func' to selected TEs
+ //
+ template<
+ typename DataType,
+ typename SetValueType,
+ void (LLMaterial::*MaterialEditFunc)(SetValueType data) >
+ static void edit(LLPanelFace* p, DataType data, int te = -1, const LLUUID &only_for_object_id = LLUUID())
+ {
+ LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc > edit(data);
+ struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor
+ {
+ LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* editp, const LLUUID &only_for_object_id) : _panel(panel), _edit(editp), _only_for_object_id(only_for_object_id) {}
+ virtual ~LLSelectedTEEditMaterial() {};
+ virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material)
+ {
+ if (_edit && (_only_for_object_id.isNull() || _only_for_object_id == object->getID()))
+ {
+ LLMaterialPtr new_material = _panel->createDefaultMaterial(current_material);
+ llassert_always(new_material);
+
+ // Determine correct alpha mode for current diffuse texture
+ // (i.e. does it have an alpha channel that makes alpha mode useful)
+ //
+ // _panel->isAlpha() "lies" when one face has alpha and the rest do not (NORSPEC-329)
+ // need to get per-face answer to this question for sane alpha mode retention on updates.
+ //
+ bool is_alpha_face = object->isImageAlphaBlended(face);
+
+ // need to keep this original answer for valid comparisons in logic below
+ //
+ U8 original_default_alpha_mode = is_alpha_face ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+
+ U8 default_alpha_mode = original_default_alpha_mode;
+
+ if (!current_material.isNull())
+ {
+ default_alpha_mode = current_material->getDiffuseAlphaMode();
+ }
+
+ // Insure we don't inherit the default of blend by accident...
+ // this will be stomped by a legit request to change the alpha mode by the apply() below
+ //
+ new_material->setDiffuseAlphaMode(default_alpha_mode);
+
+ // Do "It"!
+ //
+ _edit->apply(new_material);
+
+ U32 new_alpha_mode = new_material->getDiffuseAlphaMode();
+ LLUUID new_normal_map_id = new_material->getNormalID();
+ LLUUID new_spec_map_id = new_material->getSpecularID();
+
+ if ((new_alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) && !is_alpha_face)
+ {
+ new_alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+ new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE);
+ }
+
+ bool is_default_blend_mode = (new_alpha_mode == original_default_alpha_mode);
+ bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull();
+
+ if (!is_need_material)
+ {
+ LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
+ LLMaterialMgr::getInstance()->remove(object->getID(),face);
+ new_material = NULL;
+ }
+ else
+ {
+ LL_DEBUGS("Materials") << "Putting material on object " << object->getID() << " face " << face << ", material: " << new_material->asLLSD() << LL_ENDL;
+ LLMaterialMgr::getInstance()->put(object->getID(),face,*new_material);
+ }
+
+ object->setTEMaterialParams(face, new_material);
+ return new_material;
+ }
+ return NULL;
+ }
+ LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit;
+ LLPanelFace *_panel;
+ const LLUUID & _only_for_object_id;
+ } editor(p, &edit, only_for_object_id);
+ LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te);
+ }
+
+ template<
+ typename DataType,
+ typename ReturnType,
+ ReturnType (LLMaterial::* const MaterialGetFunc)() const >
+ static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
+ {
+ DataType data_value;
+ struct GetTEMaterialVal : public LLSelectedTEGetFunctor<DataType>
+ {
+ GetTEMaterialVal(DataType default_value) : _default(default_value) {}
+ virtual ~GetTEMaterialVal() {}
+
+ DataType get(LLViewerObject* object, S32 face)
+ {
+ DataType ret = _default;
+ LLMaterialPtr material_ptr;
+ LLTextureEntry* tep = object ? object->getTE(face) : NULL;
+ if (tep)
+ {
+ material_ptr = tep->getMaterialParams();
+ if (!material_ptr.isNull())
+ {
+ ret = (material_ptr->*(MaterialGetFunc))();
+ }
+ }
+ return ret;
+ }
+ DataType _default;
+ } GetFunc(default_value);
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_value, has_tolerance, tolerance);
+ data_to_return = data_value;
+ }
+
+ template<
+ typename DataType,
+ typename ReturnType, // some kids just have to different...
+ ReturnType (LLTextureEntry::* const TEGetFunc)() const >
+ static void getTEValue(DataType& data_to_return, bool& identical, DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
+ {
+ DataType data_value;
+ struct GetTEVal : public LLSelectedTEGetFunctor<DataType>
+ {
+ GetTEVal(DataType default_value) : _default(default_value) {}
+ virtual ~GetTEVal() {}
+
+ DataType get(LLViewerObject* object, S32 face) {
+ LLTextureEntry* tep = object ? object->getTE(face) : NULL;
+ return tep ? ((tep->*(TEGetFunc))()) : _default;
+ }
+ DataType _default;
+ } GetTEValFunc(default_value);
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_value, has_tolerance, tolerance );
+ data_to_return = data_value;
+ }
+
+ // Update vis and enabling of specific subsets of controls based on material params
+ // (e.g. hide the spec controls if no spec texture is applied)
+ //
+ void updateShinyControls(bool is_setting_texture = false, bool mess_with_combobox = false);
+ void updateBumpyControls(bool is_setting_texture = false, bool mess_with_combobox = false);
+ void updateAlphaControls();
+
+ /*
+ * Checks whether the selected texture from the LLFloaterTexturePicker can be applied to the currently selected object.
+ * If agent selects texture which is not allowed to be applied for the currently selected object,
+ * all controls of the floater texture picker which allow to apply the texture will be disabled.
+ */
void onTextureSelectionChanged(LLInventoryItem* itemp);
void onPbrSelectionChanged(LLInventoryItem* itemp);
@@ -470,8 +470,8 @@ private:
LLMenuButton* mMenuClipboardColor;
LLMenuButton* mMenuClipboardTexture;
- bool mIsAlpha;
-
+ bool mIsAlpha;
+
LLSD mClipboardParams;
LLSD mMediaSettings;
@@ -514,17 +514,17 @@ private:
std::unique_ptr<PBRPickerObjectListener> mVOInventoryListener;
public:
- #if defined(DEF_GET_MAT_STATE)
- #undef DEF_GET_MAT_STATE
- #endif
+ #if defined(DEF_GET_MAT_STATE)
+ #undef DEF_GET_MAT_STATE
+ #endif
- #if defined(DEF_GET_TE_STATE)
- #undef DEF_GET_TE_STATE
- #endif
+ #if defined(DEF_GET_TE_STATE)
+ #undef DEF_GET_TE_STATE
+ #endif
- #if defined(DEF_EDIT_MAT_STATE)
- DEF_EDIT_MAT_STATE
- #endif
+ #if defined(DEF_EDIT_MAT_STATE)
+ DEF_EDIT_MAT_STATE
+ #endif
// Accessors for selected TE material state
//
@@ -550,74 +550,74 @@ public:
getTEValue< DataType, ReturnType, &LLTextureEntry::TexEntryMemberFunc >(data, identical, DefaultValue, has_tolerance, tolerance); \
}
- class LLSelectedTEMaterial
- {
- public:
- static void getCurrent(LLMaterialPtr& material_ptr, bool& identical_material);
- static void getMaxSpecularRepeats(F32& repeats, bool& identical);
- static void getMaxNormalRepeats(F32& repeats, bool& identical);
- static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha);
-
- DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null, false, LLUUID::null)
- DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null, false, LLUUID::null)
- DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f, true, 0.001f)
- DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f, true, 0.001f)
- DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f, true, 0.001f)
- DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY,0.0f, true, 0.001f)
- DEF_GET_MAT_STATE(F32,F32,getSpecularRotation,0.0f, true, 0.001f)
-
- DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX,1.0f, true, 0.001f)
- DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY,1.0f, true, 0.001f)
- DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX,0.0f, true, 0.001f)
- DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY,0.0f, true, 0.001f)
- DEF_GET_MAT_STATE(F32,F32,getNormalRotation,0.0f, true, 0.001f)
-
- DEF_EDIT_MAT_STATE(U8,U8,setDiffuseAlphaMode);
- DEF_EDIT_MAT_STATE(U8,U8,setAlphaMaskCutoff);
-
- DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetX);
- DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetY);
- DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatX);
- DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatY);
- DEF_EDIT_MAT_STATE(F32,F32,setNormalRotation);
-
- DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetX);
- DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetY);
- DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatX);
- DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatY);
- DEF_EDIT_MAT_STATE(F32,F32,setSpecularRotation);
-
- DEF_EDIT_MAT_STATE(U8,U8,setEnvironmentIntensity);
- DEF_EDIT_MAT_STATE(U8,U8,setSpecularLightExponent);
-
- DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setNormalID);
- DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setSpecularID);
- DEF_EDIT_MAT_STATE(LLColor4U, const LLColor4U&,setSpecularLightColor);
- };
-
- class LLSelectedTE
- {
- public:
- static void getFace(class LLFace*& face_to_return, bool& identical_face);
- static void getImageFormat(LLGLenum& image_format_to_return, bool& identical_face);
- static void getTexId(LLUUID& id, bool& identical);
+ class LLSelectedTEMaterial
+ {
+ public:
+ static void getCurrent(LLMaterialPtr& material_ptr, bool& identical_material);
+ static void getMaxSpecularRepeats(F32& repeats, bool& identical);
+ static void getMaxNormalRepeats(F32& repeats, bool& identical);
+ static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha);
+
+ DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null, false, LLUUID::null)
+ DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null, false, LLUUID::null)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY,0.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularRotation,0.0f, true, 0.001f)
+
+ DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX,1.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY,1.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX,0.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY,0.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getNormalRotation,0.0f, true, 0.001f)
+
+ DEF_EDIT_MAT_STATE(U8,U8,setDiffuseAlphaMode);
+ DEF_EDIT_MAT_STATE(U8,U8,setAlphaMaskCutoff);
+
+ DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetX);
+ DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetY);
+ DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatX);
+ DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatY);
+ DEF_EDIT_MAT_STATE(F32,F32,setNormalRotation);
+
+ DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetX);
+ DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetY);
+ DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatX);
+ DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatY);
+ DEF_EDIT_MAT_STATE(F32,F32,setSpecularRotation);
+
+ DEF_EDIT_MAT_STATE(U8,U8,setEnvironmentIntensity);
+ DEF_EDIT_MAT_STATE(U8,U8,setSpecularLightExponent);
+
+ DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setNormalID);
+ DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setSpecularID);
+ DEF_EDIT_MAT_STATE(LLColor4U, const LLColor4U&,setSpecularLightColor);
+ };
+
+ class LLSelectedTE
+ {
+ public:
+ static void getFace(class LLFace*& face_to_return, bool& identical_face);
+ static void getImageFormat(LLGLenum& image_format_to_return, bool& identical_face);
+ static void getTexId(LLUUID& id, bool& identical);
static void getPbrMaterialId(LLUUID& id, bool& identical, bool& has_pbr, bool& has_faces_without_pbr);
- static void getObjectScaleS(F32& scale_s, bool& identical);
- static void getObjectScaleT(F32& scale_t, bool& identical);
- static void getMaxDiffuseRepeats(F32& repeats, bool& identical);
-
- DEF_GET_TE_STATE(U8,U8,getBumpmap,0, false, 0)
- DEF_GET_TE_STATE(U8,U8,getShiny,0, false, 0)
- DEF_GET_TE_STATE(U8,U8,getFullbright,0, false, 0)
- DEF_GET_TE_STATE(F32,F32,getRotation,0.0f, true, 0.001f)
- DEF_GET_TE_STATE(F32,F32,getOffsetS,0.0f, true, 0.001f)
- DEF_GET_TE_STATE(F32,F32,getOffsetT,0.0f, true, 0.001f)
- DEF_GET_TE_STATE(F32,F32,getScaleS,1.0f, true, 0.001f)
- DEF_GET_TE_STATE(F32,F32,getScaleT,1.0f, true, 0.001f)
- DEF_GET_TE_STATE(F32,F32,getGlow,0.0f, true, 0.001f)
- DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen,LLTextureEntry::TEX_GEN_DEFAULT, false, LLTextureEntry::TEX_GEN_DEFAULT)
- DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor,LLColor4::white, false, LLColor4::black);
- };
+ static void getObjectScaleS(F32& scale_s, bool& identical);
+ static void getObjectScaleT(F32& scale_t, bool& identical);
+ static void getMaxDiffuseRepeats(F32& repeats, bool& identical);
+
+ DEF_GET_TE_STATE(U8,U8,getBumpmap,0, false, 0)
+ DEF_GET_TE_STATE(U8,U8,getShiny,0, false, 0)
+ DEF_GET_TE_STATE(U8,U8,getFullbright,0, false, 0)
+ DEF_GET_TE_STATE(F32,F32,getRotation,0.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getOffsetS,0.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getOffsetT,0.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getScaleS,1.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getScaleT,1.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getGlow,0.0f, true, 0.001f)
+ DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen,LLTextureEntry::TEX_GEN_DEFAULT, false, LLTextureEntry::TEX_GEN_DEFAULT)
+ DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor,LLColor4::white, false, LLColor4::black);
+ };
};
#endif
diff --git a/indra/newview/llpanelgenerictip.cpp b/indra/newview/llpanelgenerictip.cpp
index 4ccdaa78f3..bc2b28269f 100644
--- a/indra/newview/llpanelgenerictip.cpp
+++ b/indra/newview/llpanelgenerictip.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelgenerictip.cpp
* @brief Represents a generic panel for a notifytip notifications. As example:
* "SystemMessageTip", "Cancelled", "UploadWebSnapshotDone".
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,15 +33,15 @@
LLPanelGenericTip::LLPanelGenericTip(
- const LLNotificationPtr& notification) :
- LLPanelTipToast(notification)
+ const LLNotificationPtr& notification) :
+ LLPanelTipToast(notification)
{
- buildFromFile( "panel_generic_tip.xml");
+ buildFromFile( "panel_generic_tip.xml");
- getChild<LLUICtrl>("message")->setValue(notification->getMessage());
+ getChild<LLUICtrl>("message")->setValue(notification->getMessage());
- S32 max_line_count = gSavedSettings.getS32("TipToastMessageLineCount");
- snapToMessageHeight(getChild<LLTextBox> ("message"), max_line_count);
+ S32 max_line_count = gSavedSettings.getS32("TipToastMessageLineCount");
+ snapToMessageHeight(getChild<LLTextBox> ("message"), max_line_count);
}
diff --git a/indra/newview/llpanelgenerictip.h b/indra/newview/llpanelgenerictip.h
index f8a3413fe4..01d6c00d85 100644
--- a/indra/newview/llpanelgenerictip.h
+++ b/indra/newview/llpanelgenerictip.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelgenerictip.h
* @brief Represents a generic panel for a notifytip notifications. As example:
* "SystemMessageTip", "Cancelled", "UploadWebSnapshotDone".
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,16 +36,16 @@
*/
class LLPanelGenericTip: public LLPanelTipToast
{
- // disallow instantiation of this class
+ // disallow instantiation of this class
private:
- // grant privileges to instantiate this class to LLToastPanel
- friend class LLToastPanel;
- /**
- * Generic toast tip panel.
- * This is particular case of toast panel that decoupled from LLToastNotifyPanel.
- * From now LLToastNotifyPanel is deprecated and will be removed after all panel
- * types are represented in separate classes.
- */
- LLPanelGenericTip(const LLNotificationPtr& notification);
+ // grant privileges to instantiate this class to LLToastPanel
+ friend class LLToastPanel;
+ /**
+ * Generic toast tip panel.
+ * This is particular case of toast panel that decoupled from LLToastNotifyPanel.
+ * From now LLToastNotifyPanel is deprecated and will be removed after all panel
+ * types are represented in separate classes.
+ */
+ LLPanelGenericTip(const LLNotificationPtr& notification);
};
#endif /* LL_PANELGENERICTIP_H */
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index ab255d5215..de35aea35a 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llpanelgroup.cpp
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,7 +43,7 @@
#include "llfloater.h"
#include "llgroupactions.h"
-#include "llagent.h"
+#include "llagent.h"
#include "llsidetraypanelcontainer.h"
@@ -61,11 +61,11 @@ static LLPanelInjector<LLPanelGroup> t_panel_group("panel_group_info_sidetray");
LLPanelGroupTab::LLPanelGroupTab()
- : LLPanel(),
- mAllowEdit(TRUE),
- mHasModal(FALSE)
+ : LLPanel(),
+ mAllowEdit(TRUE),
+ mHasModal(FALSE)
{
- mGroupID = LLUUID::null;
+ mGroupID = LLUUID::null;
}
LLPanelGroupTab::~LLPanelGroupTab()
@@ -74,530 +74,530 @@ LLPanelGroupTab::~LLPanelGroupTab()
BOOL LLPanelGroupTab::isVisibleByAgent(LLAgent* agentp)
{
- //default to being visible
- return TRUE;
+ //default to being visible
+ return TRUE;
}
BOOL LLPanelGroupTab::postBuild()
{
- return TRUE;
+ return TRUE;
}
LLPanelGroup::LLPanelGroup()
-: LLPanel(),
- LLGroupMgrObserver( LLUUID() ),
- mSkipRefresh(FALSE),
- mButtonJoin(NULL)
+: LLPanel(),
+ LLGroupMgrObserver( LLUUID() ),
+ mSkipRefresh(FALSE),
+ mButtonJoin(NULL)
{
- // Set up the factory callbacks.
- // Roles sub tabs
- LLGroupMgr::getInstance()->addObserver(this);
+ // Set up the factory callbacks.
+ // Roles sub tabs
+ LLGroupMgr::getInstance()->addObserver(this);
}
LLPanelGroup::~LLPanelGroup()
{
- LLGroupMgr::getInstance()->removeObserver(this);
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->removeObserver(this);
- }
+ LLGroupMgr::getInstance()->removeObserver(this);
+ if(LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->removeObserver(this);
+ }
}
void LLPanelGroup::onOpen(const LLSD& key)
{
- if(!key.has("group_id"))
- return;
-
- LLUUID group_id = key["group_id"];
- if(!key.has("action"))
- {
- setGroupID(group_id);
- getChild<LLAccordionCtrl>("groups_accordion")->expandDefaultTab();
- return;
- }
-
- std::string str_action = key["action"];
-
- if(str_action == "refresh")
- {
- if(mID == group_id || group_id == LLUUID::null)
- refreshData();
- }
- else if(str_action == "close")
- {
- onBackBtnClick();
- }
- else if(str_action == "refresh_notices")
- {
- LLPanelGroupNotices* panel_notices = findChild<LLPanelGroupNotices>("group_notices_tab_panel");
- if(panel_notices)
- panel_notices->refreshNotices();
- }
+ if(!key.has("group_id"))
+ return;
+
+ LLUUID group_id = key["group_id"];
+ if(!key.has("action"))
+ {
+ setGroupID(group_id);
+ getChild<LLAccordionCtrl>("groups_accordion")->expandDefaultTab();
+ return;
+ }
+
+ std::string str_action = key["action"];
+
+ if(str_action == "refresh")
+ {
+ if(mID == group_id || group_id == LLUUID::null)
+ refreshData();
+ }
+ else if(str_action == "close")
+ {
+ onBackBtnClick();
+ }
+ else if(str_action == "refresh_notices")
+ {
+ LLPanelGroupNotices* panel_notices = findChild<LLPanelGroupNotices>("group_notices_tab_panel");
+ if(panel_notices)
+ panel_notices->refreshNotices();
+ }
}
BOOL LLPanelGroup::postBuild()
{
- mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
- mWantApplyMesg = getString("want_apply_text");
-
- LLButton* button;
-
- button = getChild<LLButton>("btn_apply");
- button->setClickedCallback(onBtnApply, this);
- button->setVisible(true);
- button->setEnabled(false);
-
- button = getChild<LLButton>("btn_call");
- button->setClickedCallback(onBtnGroupCallClicked, this);
-
- button = getChild<LLButton>("btn_chat");
- button->setClickedCallback(onBtnGroupChatClicked, this);
-
- button = getChild<LLButton>("btn_refresh");
- button->setClickedCallback(onBtnRefresh, this);
-
- childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL);
-
- LLPanelGroupTab* panel_general = findChild<LLPanelGroupTab>("group_general_tab_panel");
- LLPanelGroupTab* panel_roles = findChild<LLPanelGroupTab>("group_roles_tab_panel");
- LLPanelGroupTab* panel_notices = findChild<LLPanelGroupTab>("group_notices_tab_panel");
- LLPanelGroupTab* panel_land = findChild<LLPanelGroupTab>("group_land_tab_panel");
- LLPanelGroupTab* panel_experiences = findChild<LLPanelGroupTab>("group_experiences_tab_panel");
-
- if(panel_general) mTabs.push_back(panel_general);
- if(panel_roles) mTabs.push_back(panel_roles);
- if(panel_notices) mTabs.push_back(panel_notices);
- if(panel_land) mTabs.push_back(panel_land);
- if(panel_experiences) mTabs.push_back(panel_experiences);
-
- if(panel_general)
- {
- panel_general->setupCtrls(this);
- button = panel_general->getChild<LLButton>("btn_join");
- button->setVisible(false);
- button->setEnabled(true);
-
- mButtonJoin = button;
- mButtonJoin->setCommitCallback(boost::bind(&LLPanelGroup::onBtnJoin,this));
-
- mJoinText = panel_general->getChild<LLUICtrl>("join_cost_text");
- }
-
- LLVoiceClient::getInstance()->addObserver(this);
-
- return TRUE;
+ mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
+ mWantApplyMesg = getString("want_apply_text");
+
+ LLButton* button;
+
+ button = getChild<LLButton>("btn_apply");
+ button->setClickedCallback(onBtnApply, this);
+ button->setVisible(true);
+ button->setEnabled(false);
+
+ button = getChild<LLButton>("btn_call");
+ button->setClickedCallback(onBtnGroupCallClicked, this);
+
+ button = getChild<LLButton>("btn_chat");
+ button->setClickedCallback(onBtnGroupChatClicked, this);
+
+ button = getChild<LLButton>("btn_refresh");
+ button->setClickedCallback(onBtnRefresh, this);
+
+ childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL);
+
+ LLPanelGroupTab* panel_general = findChild<LLPanelGroupTab>("group_general_tab_panel");
+ LLPanelGroupTab* panel_roles = findChild<LLPanelGroupTab>("group_roles_tab_panel");
+ LLPanelGroupTab* panel_notices = findChild<LLPanelGroupTab>("group_notices_tab_panel");
+ LLPanelGroupTab* panel_land = findChild<LLPanelGroupTab>("group_land_tab_panel");
+ LLPanelGroupTab* panel_experiences = findChild<LLPanelGroupTab>("group_experiences_tab_panel");
+
+ if(panel_general) mTabs.push_back(panel_general);
+ if(panel_roles) mTabs.push_back(panel_roles);
+ if(panel_notices) mTabs.push_back(panel_notices);
+ if(panel_land) mTabs.push_back(panel_land);
+ if(panel_experiences) mTabs.push_back(panel_experiences);
+
+ if(panel_general)
+ {
+ panel_general->setupCtrls(this);
+ button = panel_general->getChild<LLButton>("btn_join");
+ button->setVisible(false);
+ button->setEnabled(true);
+
+ mButtonJoin = button;
+ mButtonJoin->setCommitCallback(boost::bind(&LLPanelGroup::onBtnJoin,this));
+
+ mJoinText = panel_general->getChild<LLUICtrl>("join_cost_text");
+ }
+
+ LLVoiceClient::getInstance()->addObserver(this);
+
+ return TRUE;
}
void LLPanelGroup::reposButton(const std::string& name)
{
- LLButton* button = findChild<LLButton>(name);
- if(!button)
- return;
- LLRect btn_rect = button->getRect();
- btn_rect.setLeftTopAndSize( btn_rect.mLeft, btn_rect.getHeight() + 2, btn_rect.getWidth(), btn_rect.getHeight());
- button->setRect(btn_rect);
+ LLButton* button = findChild<LLButton>(name);
+ if(!button)
+ return;
+ LLRect btn_rect = button->getRect();
+ btn_rect.setLeftTopAndSize( btn_rect.mLeft, btn_rect.getHeight() + 2, btn_rect.getWidth(), btn_rect.getHeight());
+ button->setRect(btn_rect);
}
void LLPanelGroup::reposButtons()
{
- LLButton* button_refresh = findChild<LLButton>("btn_refresh");
- LLButton* button_cancel = findChild<LLButton>("btn_cancel");
-
- if(button_refresh && button_cancel && button_refresh->getVisible() && button_cancel->getVisible())
- {
- LLRect btn_refresh_rect = button_refresh->getRect();
- LLRect btn_cancel_rect = button_cancel->getRect();
- btn_refresh_rect.setLeftTopAndSize( btn_cancel_rect.mLeft + btn_cancel_rect.getWidth() + 2,
- btn_refresh_rect.getHeight() + 2, btn_refresh_rect.getWidth(), btn_refresh_rect.getHeight());
- button_refresh->setRect(btn_refresh_rect);
- }
-
- reposButton("btn_apply");
- reposButton("btn_refresh");
- reposButton("btn_cancel");
- reposButton("btn_chat");
- reposButton("btn_call");
+ LLButton* button_refresh = findChild<LLButton>("btn_refresh");
+ LLButton* button_cancel = findChild<LLButton>("btn_cancel");
+
+ if(button_refresh && button_cancel && button_refresh->getVisible() && button_cancel->getVisible())
+ {
+ LLRect btn_refresh_rect = button_refresh->getRect();
+ LLRect btn_cancel_rect = button_cancel->getRect();
+ btn_refresh_rect.setLeftTopAndSize( btn_cancel_rect.mLeft + btn_cancel_rect.getWidth() + 2,
+ btn_refresh_rect.getHeight() + 2, btn_refresh_rect.getWidth(), btn_refresh_rect.getHeight());
+ button_refresh->setRect(btn_refresh_rect);
+ }
+
+ reposButton("btn_apply");
+ reposButton("btn_refresh");
+ reposButton("btn_cancel");
+ reposButton("btn_chat");
+ reposButton("btn_call");
}
void LLPanelGroup::reshape(S32 width, S32 height, BOOL called_from_parent )
{
- LLPanel::reshape(width, height, called_from_parent );
+ LLPanel::reshape(width, height, called_from_parent );
- reposButtons();
+ reposButtons();
}
void LLPanelGroup::onBackBtnClick()
{
- LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
- if(parent)
- {
- parent->openPreviousPanel();
- }
+ LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
+ if(parent)
+ {
+ parent->openPreviousPanel();
+ }
}
void LLPanelGroup::onBtnRefresh(void* user_data)
{
- LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
- self->refreshData();
+ LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
+ self->refreshData();
}
void LLPanelGroup::onBtnApply(void* user_data)
{
- LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
- self->apply();
- self->refreshData();
+ LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
+ self->apply();
+ self->refreshData();
}
void LLPanelGroup::onBtnGroupCallClicked(void* user_data)
{
- LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
- self->callGroup();
+ LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
+ self->callGroup();
}
void LLPanelGroup::onBtnGroupChatClicked(void* user_data)
{
- LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
- self->chatGroup();
+ LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
+ self->chatGroup();
}
void LLPanelGroup::onBtnJoin()
{
- LL_DEBUGS() << "joining group: " << mID << LL_ENDL;
- LLGroupActions::join(mID);
+ LL_DEBUGS() << "joining group: " << mID << LL_ENDL;
+ LLGroupActions::join(mID);
}
void LLPanelGroup::changed(LLGroupChange gc)
{
- for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
- (*it)->update(gc);
- update(gc);
+ for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+ (*it)->update(gc);
+ update(gc);
}
// virtual
void LLPanelGroup::onChange(EStatusType status, const std::string &channelURI, bool proximal)
{
- if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
- {
- return;
- }
+ if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
+ {
+ return;
+ }
- childSetEnabled("btn_call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
+ childSetEnabled("btn_call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
}
void LLPanelGroup::notifyObservers()
{
- changed(GC_ALL);
+ changed(GC_ALL);
}
void LLPanelGroup::update(LLGroupChange gc)
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
- if(gdatap)
- {
- std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
- LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name");
- group_name_ctrl->setValue(group_name);
- group_name_ctrl->setToolTip(group_name);
-
- LLGroupData agent_gdatap;
- bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlikeWithoutAdminMenuFakery();
- bool join_btn_visible = !is_member && gdatap->mOpenEnrollment;
-
- mButtonJoin->setVisible(join_btn_visible);
- mJoinText->setVisible(join_btn_visible);
-
- if(join_btn_visible)
- {
- LLStringUtil::format_map_t string_args;
- std::string fee_buff;
- if(gdatap->mMembershipFee)
- {
- string_args["[AMOUNT]"] = llformat("%d", gdatap->mMembershipFee);
- fee_buff = getString("group_join_btn", string_args);
-
- }
- else
- {
- fee_buff = getString("group_join_free", string_args);
- }
- mJoinText->setValue(fee_buff);
- }
- }
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
+ if(gdatap)
+ {
+ std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
+ LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name");
+ group_name_ctrl->setValue(group_name);
+ group_name_ctrl->setToolTip(group_name);
+
+ LLGroupData agent_gdatap;
+ bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlikeWithoutAdminMenuFakery();
+ bool join_btn_visible = !is_member && gdatap->mOpenEnrollment;
+
+ mButtonJoin->setVisible(join_btn_visible);
+ mJoinText->setVisible(join_btn_visible);
+
+ if(join_btn_visible)
+ {
+ LLStringUtil::format_map_t string_args;
+ std::string fee_buff;
+ if(gdatap->mMembershipFee)
+ {
+ string_args["[AMOUNT]"] = llformat("%d", gdatap->mMembershipFee);
+ fee_buff = getString("group_join_btn", string_args);
+
+ }
+ else
+ {
+ fee_buff = getString("group_join_free", string_args);
+ }
+ mJoinText->setValue(fee_buff);
+ }
+ }
}
void LLPanelGroup::setGroupID(const LLUUID& group_id)
{
- std::string str_group_id;
- group_id.toString(str_group_id);
-
- bool is_same_id = group_id == mID;
-
- LLGroupMgr::getInstance()->removeObserver(this);
- mID = group_id;
- LLGroupMgr::getInstance()->addObserver(this);
-
- for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
- (*it)->setGroupID(group_id);
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
- if(gdatap)
- {
- std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
- LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name");
- group_name_ctrl->setValue(group_name);
- group_name_ctrl->setToolTip(group_name);
- }
-
- LLButton* button_apply = findChild<LLButton>("btn_apply");
- LLButton* button_refresh = findChild<LLButton>("btn_refresh");
-
- LLButton* button_cancel = findChild<LLButton>("btn_cancel");
- LLButton* button_call = findChild<LLButton>("btn_call");
- LLButton* button_chat = findChild<LLButton>("btn_chat");
-
-
- bool is_null_group_id = group_id == LLUUID::null;
- if(button_apply)
- button_apply->setVisible(!is_null_group_id);
- if(button_refresh)
- button_refresh->setVisible(!is_null_group_id);
-
- if(button_cancel)
- button_cancel->setVisible(!is_null_group_id);
-
- if(button_call)
- button_call->setVisible(!is_null_group_id);
- if(button_chat)
- button_chat->setVisible(!is_null_group_id);
-
- getChild<LLUICtrl>("prepend_founded_by")->setVisible(!is_null_group_id);
-
- LLAccordionCtrl* tab_ctrl = getChild<LLAccordionCtrl>("groups_accordion");
- tab_ctrl->reset();
-
- LLAccordionCtrlTab* tab_general = getChild<LLAccordionCtrlTab>("group_general_tab");
- LLAccordionCtrlTab* tab_roles = getChild<LLAccordionCtrlTab>("group_roles_tab");
- LLAccordionCtrlTab* tab_notices = getChild<LLAccordionCtrlTab>("group_notices_tab");
- LLAccordionCtrlTab* tab_land = getChild<LLAccordionCtrlTab>("group_land_tab");
- LLAccordionCtrlTab* tab_experiences = getChild<LLAccordionCtrlTab>("group_experiences_tab");
-
- if(mButtonJoin)
- mButtonJoin->setVisible(false);
-
-
- if(is_null_group_id)//creating new group
- {
- if(!tab_general->getDisplayChildren())
- tab_general->changeOpenClose(tab_general->getDisplayChildren());
-
- if(tab_roles->getDisplayChildren())
- tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
- if(tab_notices->getDisplayChildren())
- tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
- if(tab_land->getDisplayChildren())
- tab_land->changeOpenClose(tab_land->getDisplayChildren());
- if(tab_experiences->getDisplayChildren())
- tab_experiences->changeOpenClose(tab_land->getDisplayChildren());
-
- tab_roles->setVisible(false);
- tab_notices->setVisible(false);
- tab_land->setVisible(false);
- tab_experiences->setVisible(false);
-
- getChild<LLUICtrl>("group_name")->setVisible(false);
- getChild<LLUICtrl>("group_name_editor")->setVisible(true);
-
- if(button_call)
- button_call->setVisible(false);
- if(button_chat)
- button_chat->setVisible(false);
- }
- else
- {
- if(!is_same_id)
- {
- if(!tab_general->getDisplayChildren())
- tab_general->changeOpenClose(tab_general->getDisplayChildren());
- if(tab_roles->getDisplayChildren())
- tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
- if(tab_notices->getDisplayChildren())
- tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
- if(tab_land->getDisplayChildren())
- tab_land->changeOpenClose(tab_land->getDisplayChildren());
- if(tab_experiences->getDisplayChildren())
- tab_experiences->changeOpenClose(tab_land->getDisplayChildren());
- }
-
- LLGroupData agent_gdatap;
- bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlikeWithoutAdminMenuFakery();
-
- tab_roles->setVisible(is_member);
- tab_notices->setVisible(is_member);
- tab_land->setVisible(is_member);
- tab_experiences->setVisible(is_member);
-
- getChild<LLUICtrl>("group_name")->setVisible(true);
- getChild<LLUICtrl>("group_name_editor")->setVisible(false);
-
- if(button_apply)
- button_apply->setVisible(is_member);
- if(button_call)
- button_call->setVisible(is_member);
- if(button_chat)
- button_chat->setVisible(is_member);
- }
-
- tab_ctrl->arrange();
-
- reposButtons();
- update(GC_ALL);//show/hide "join" button if data is already ready
+ std::string str_group_id;
+ group_id.toString(str_group_id);
+
+ bool is_same_id = group_id == mID;
+
+ LLGroupMgr::getInstance()->removeObserver(this);
+ mID = group_id;
+ LLGroupMgr::getInstance()->addObserver(this);
+
+ for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+ (*it)->setGroupID(group_id);
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
+ if(gdatap)
+ {
+ std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
+ LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name");
+ group_name_ctrl->setValue(group_name);
+ group_name_ctrl->setToolTip(group_name);
+ }
+
+ LLButton* button_apply = findChild<LLButton>("btn_apply");
+ LLButton* button_refresh = findChild<LLButton>("btn_refresh");
+
+ LLButton* button_cancel = findChild<LLButton>("btn_cancel");
+ LLButton* button_call = findChild<LLButton>("btn_call");
+ LLButton* button_chat = findChild<LLButton>("btn_chat");
+
+
+ bool is_null_group_id = group_id == LLUUID::null;
+ if(button_apply)
+ button_apply->setVisible(!is_null_group_id);
+ if(button_refresh)
+ button_refresh->setVisible(!is_null_group_id);
+
+ if(button_cancel)
+ button_cancel->setVisible(!is_null_group_id);
+
+ if(button_call)
+ button_call->setVisible(!is_null_group_id);
+ if(button_chat)
+ button_chat->setVisible(!is_null_group_id);
+
+ getChild<LLUICtrl>("prepend_founded_by")->setVisible(!is_null_group_id);
+
+ LLAccordionCtrl* tab_ctrl = getChild<LLAccordionCtrl>("groups_accordion");
+ tab_ctrl->reset();
+
+ LLAccordionCtrlTab* tab_general = getChild<LLAccordionCtrlTab>("group_general_tab");
+ LLAccordionCtrlTab* tab_roles = getChild<LLAccordionCtrlTab>("group_roles_tab");
+ LLAccordionCtrlTab* tab_notices = getChild<LLAccordionCtrlTab>("group_notices_tab");
+ LLAccordionCtrlTab* tab_land = getChild<LLAccordionCtrlTab>("group_land_tab");
+ LLAccordionCtrlTab* tab_experiences = getChild<LLAccordionCtrlTab>("group_experiences_tab");
+
+ if(mButtonJoin)
+ mButtonJoin->setVisible(false);
+
+
+ if(is_null_group_id)//creating new group
+ {
+ if(!tab_general->getDisplayChildren())
+ tab_general->changeOpenClose(tab_general->getDisplayChildren());
+
+ if(tab_roles->getDisplayChildren())
+ tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
+ if(tab_notices->getDisplayChildren())
+ tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
+ if(tab_land->getDisplayChildren())
+ tab_land->changeOpenClose(tab_land->getDisplayChildren());
+ if(tab_experiences->getDisplayChildren())
+ tab_experiences->changeOpenClose(tab_land->getDisplayChildren());
+
+ tab_roles->setVisible(false);
+ tab_notices->setVisible(false);
+ tab_land->setVisible(false);
+ tab_experiences->setVisible(false);
+
+ getChild<LLUICtrl>("group_name")->setVisible(false);
+ getChild<LLUICtrl>("group_name_editor")->setVisible(true);
+
+ if(button_call)
+ button_call->setVisible(false);
+ if(button_chat)
+ button_chat->setVisible(false);
+ }
+ else
+ {
+ if(!is_same_id)
+ {
+ if(!tab_general->getDisplayChildren())
+ tab_general->changeOpenClose(tab_general->getDisplayChildren());
+ if(tab_roles->getDisplayChildren())
+ tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
+ if(tab_notices->getDisplayChildren())
+ tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
+ if(tab_land->getDisplayChildren())
+ tab_land->changeOpenClose(tab_land->getDisplayChildren());
+ if(tab_experiences->getDisplayChildren())
+ tab_experiences->changeOpenClose(tab_land->getDisplayChildren());
+ }
+
+ LLGroupData agent_gdatap;
+ bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlikeWithoutAdminMenuFakery();
+
+ tab_roles->setVisible(is_member);
+ tab_notices->setVisible(is_member);
+ tab_land->setVisible(is_member);
+ tab_experiences->setVisible(is_member);
+
+ getChild<LLUICtrl>("group_name")->setVisible(true);
+ getChild<LLUICtrl>("group_name_editor")->setVisible(false);
+
+ if(button_apply)
+ button_apply->setVisible(is_member);
+ if(button_call)
+ button_call->setVisible(is_member);
+ if(button_chat)
+ button_chat->setVisible(is_member);
+ }
+
+ tab_ctrl->arrange();
+
+ reposButtons();
+ update(GC_ALL);//show/hide "join" button if data is already ready
}
bool LLPanelGroup::apply(LLPanelGroupTab* tab)
{
- if(!tab)
- return false;
-
- std::string mesg;
- if ( !tab->needsApply(mesg) )
- return true;
-
- std::string apply_mesg;
- if(tab->apply( apply_mesg ) )
- {
- //we skip refreshing group after ew manually apply changes since its very annoying
- //for those who are editing group
-
- LLPanelGroupRoles * roles_tab = dynamic_cast<LLPanelGroupRoles*>(tab);
- if (roles_tab)
- {
- LLGroupMgr* gmgrp = LLGroupMgr::getInstance();
- LLGroupMgrGroupData* gdatap = gmgrp->getGroupData(roles_tab->getGroupID());
-
- // allow refresh only for one specific case:
- // there is only one member in group and it is not owner
- // it's a wrong situation and need refresh panels from server
- if (gdatap && gdatap->isSingleMemberNotOwner())
- {
- return true;
- }
- }
-
- mSkipRefresh = TRUE;
- return true;
- }
-
- if ( !apply_mesg.empty() )
- {
- LLSD args;
- args["MESSAGE"] = apply_mesg;
- LLNotificationsUtil::add("GenericAlert", args);
- }
- return false;
+ if(!tab)
+ return false;
+
+ std::string mesg;
+ if ( !tab->needsApply(mesg) )
+ return true;
+
+ std::string apply_mesg;
+ if(tab->apply( apply_mesg ) )
+ {
+ //we skip refreshing group after ew manually apply changes since its very annoying
+ //for those who are editing group
+
+ LLPanelGroupRoles * roles_tab = dynamic_cast<LLPanelGroupRoles*>(tab);
+ if (roles_tab)
+ {
+ LLGroupMgr* gmgrp = LLGroupMgr::getInstance();
+ LLGroupMgrGroupData* gdatap = gmgrp->getGroupData(roles_tab->getGroupID());
+
+ // allow refresh only for one specific case:
+ // there is only one member in group and it is not owner
+ // it's a wrong situation and need refresh panels from server
+ if (gdatap && gdatap->isSingleMemberNotOwner())
+ {
+ return true;
+ }
+ }
+
+ mSkipRefresh = TRUE;
+ return true;
+ }
+
+ if ( !apply_mesg.empty() )
+ {
+ LLSD args;
+ args["MESSAGE"] = apply_mesg;
+ LLNotificationsUtil::add("GenericAlert", args);
+ }
+ return false;
}
bool LLPanelGroup::apply()
{
- return apply(findChild<LLPanelGroupTab>("group_general_tab_panel"))
- && apply(findChild<LLPanelGroupTab>("group_roles_tab_panel"))
- && apply(findChild<LLPanelGroupTab>("group_notices_tab_panel"))
- && apply(findChild<LLPanelGroupTab>("group_land_tab_panel"))
- && apply(findChild<LLPanelGroupTab>("group_experiences_tab_panel"))
- ;
+ return apply(findChild<LLPanelGroupTab>("group_general_tab_panel"))
+ && apply(findChild<LLPanelGroupTab>("group_roles_tab_panel"))
+ && apply(findChild<LLPanelGroupTab>("group_notices_tab_panel"))
+ && apply(findChild<LLPanelGroupTab>("group_land_tab_panel"))
+ && apply(findChild<LLPanelGroupTab>("group_experiences_tab_panel"))
+ ;
}
// virtual
void LLPanelGroup::draw()
{
- LLPanel::draw();
-
- if (mRefreshTimer.hasExpired())
- {
- mRefreshTimer.stop();
- childEnable("btn_refresh");
- childEnable("groups_accordion");
- }
-
- LLButton* button_apply = findChild<LLButton>("btn_apply");
-
- if(button_apply && button_apply->getVisible())
- {
- bool enable = false;
- std::string mesg;
- for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
- enable = enable || (*it)->needsApply(mesg);
-
- childSetEnabled("btn_apply", enable);
- }
+ LLPanel::draw();
+
+ if (mRefreshTimer.hasExpired())
+ {
+ mRefreshTimer.stop();
+ childEnable("btn_refresh");
+ childEnable("groups_accordion");
+ }
+
+ LLButton* button_apply = findChild<LLButton>("btn_apply");
+
+ if(button_apply && button_apply->getVisible())
+ {
+ bool enable = false;
+ std::string mesg;
+ for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+ enable = enable || (*it)->needsApply(mesg);
+
+ childSetEnabled("btn_apply", enable);
+ }
}
void LLPanelGroup::refreshData()
{
- if(mSkipRefresh)
- {
- mSkipRefresh = FALSE;
- return;
- }
- LLGroupMgr::getInstance()->clearGroupData(getID());
-
- setGroupID(getID());
-
- // 5 second timeout
- childDisable("btn_refresh");
- childDisable("groups_accordion");
-
- mRefreshTimer.start();
- mRefreshTimer.setTimerExpirySec(5);
+ if(mSkipRefresh)
+ {
+ mSkipRefresh = FALSE;
+ return;
+ }
+ LLGroupMgr::getInstance()->clearGroupData(getID());
+
+ setGroupID(getID());
+
+ // 5 second timeout
+ childDisable("btn_refresh");
+ childDisable("groups_accordion");
+
+ mRefreshTimer.start();
+ mRefreshTimer.setTimerExpirySec(5);
}
void LLPanelGroup::callGroup()
{
- LLGroupActions::startCall(getID());
+ LLGroupActions::startCall(getID());
}
void LLPanelGroup::chatGroup()
{
- LLGroupActions::startIM(getID());
+ LLGroupActions::startIM(getID());
}
void LLPanelGroup::showNotice(const std::string& subject,
- const std::string& message,
- const bool& has_inventory,
- const std::string& inventory_name,
- LLOfferInfo* inventory_offer)
+ const std::string& message,
+ const bool& has_inventory,
+ const std::string& inventory_name,
+ LLOfferInfo* inventory_offer)
{
- LLPanelGroupNotices* panel_notices = findChild<LLPanelGroupNotices>("group_notices_tab_panel");
- if(!panel_notices)
- {
- // We need to clean up that inventory offer.
- if (inventory_offer)
- {
- inventory_offer->forceResponse(IOR_DECLINE);
- }
- return;
- }
- panel_notices->showNotice(subject,message,has_inventory,inventory_name,inventory_offer);
+ LLPanelGroupNotices* panel_notices = findChild<LLPanelGroupNotices>("group_notices_tab_panel");
+ if(!panel_notices)
+ {
+ // We need to clean up that inventory offer.
+ if (inventory_offer)
+ {
+ inventory_offer->forceResponse(IOR_DECLINE);
+ }
+ return;
+ }
+ panel_notices->showNotice(subject,message,has_inventory,inventory_name,inventory_offer);
}
//static
void LLPanelGroup::showNotice(const std::string& subject,
- const std::string& message,
- const LLUUID& group_id,
- const bool& has_inventory,
- const std::string& inventory_name,
- LLOfferInfo* inventory_offer)
+ const std::string& message,
+ const LLUUID& group_id,
+ const bool& has_inventory,
+ const std::string& inventory_name,
+ LLOfferInfo* inventory_offer)
{
- LLPanelGroup* panel = LLFloaterSidePanelContainer::getPanel<LLPanelGroup>("people", "panel_group_info_sidetray");
- if(!panel)
- return;
+ LLPanelGroup* panel = LLFloaterSidePanelContainer::getPanel<LLPanelGroup>("people", "panel_group_info_sidetray");
+ if(!panel)
+ return;
- if(panel->getID() != group_id)//???? only for current group_id or switch panels? FIXME
- return;
- panel->showNotice(subject,message,has_inventory,inventory_name,inventory_offer);
+ if(panel->getID() != group_id)//???? only for current group_id or switch panels? FIXME
+ return;
+ panel->showNotice(subject,message,has_inventory,inventory_name,inventory_offer);
}
diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h
index be40b08a6d..d329a9561f 100644
--- a/indra/newview/llpanelgroup.h
+++ b/indra/newview/llpanelgroup.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llpanelgroup.h
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,130 +42,130 @@ class LLAgent;
class LLPanelGroup : public LLPanel,
- public LLGroupMgrObserver,
- public LLVoiceClientStatusObserver
+ public LLGroupMgrObserver,
+ public LLVoiceClientStatusObserver
{
public:
- LLPanelGroup();
- virtual ~LLPanelGroup();
+ LLPanelGroup();
+ virtual ~LLPanelGroup();
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- void setGroupID(const LLUUID& group_id);
+ void setGroupID(const LLUUID& group_id);
- void draw();
+ void draw();
- void onOpen(const LLSD& key);
+ void onOpen(const LLSD& key);
- // Group manager observer trigger.
- virtual void changed(LLGroupChange gc);
+ // Group manager observer trigger.
+ virtual void changed(LLGroupChange gc);
- // Implements LLVoiceClientStatusObserver::onChange() to enable the call
- // button when voice is available
- /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
+ // Implements LLVoiceClientStatusObserver::onChange() to enable the call
+ // button when voice is available
+ /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
- void showNotice(const std::string& subject,
- const std::string& message,
- const bool& has_inventory,
- const std::string& inventory_name,
- LLOfferInfo* inventory_offer);
+ void showNotice(const std::string& subject,
+ const std::string& message,
+ const bool& has_inventory,
+ const std::string& inventory_name,
+ LLOfferInfo* inventory_offer);
- void notifyObservers();
+ void notifyObservers();
- bool apply();
- void refreshData();
- void callGroup();
- void chatGroup();
+ bool apply();
+ void refreshData();
+ void callGroup();
+ void chatGroup();
- virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- static void showNotice(const std::string& subject,
- const std::string& message,
- const LLUUID& group_id,
- const bool& has_inventory,
- const std::string& inventory_name,
- LLOfferInfo* inventory_offer);
+ static void showNotice(const std::string& subject,
+ const std::string& message,
+ const LLUUID& group_id,
+ const bool& has_inventory,
+ const std::string& inventory_name,
+ LLOfferInfo* inventory_offer);
protected:
- virtual void update(LLGroupChange gc);
+ virtual void update(LLGroupChange gc);
+
+ void onBackBtnClick();
+ void onBtnJoin();
- void onBackBtnClick();
- void onBtnJoin();
+ static void onBtnApply(void*);
+ static void onBtnRefresh(void*);
+ static void onBtnGroupCallClicked(void*);
+ static void onBtnGroupChatClicked(void*);
- static void onBtnApply(void*);
- static void onBtnRefresh(void*);
- static void onBtnGroupCallClicked(void*);
- static void onBtnGroupChatClicked(void*);
+ void reposButton(const std::string& name);
+ void reposButtons();
- void reposButton(const std::string& name);
- void reposButtons();
-
protected:
- bool apply(LLPanelGroupTab* tab);
+ bool apply(LLPanelGroupTab* tab);
- LLTimer mRefreshTimer;
+ LLTimer mRefreshTimer;
- BOOL mSkipRefresh;
+ BOOL mSkipRefresh;
- std::string mDefaultNeedsApplyMesg;
- std::string mWantApplyMesg;
+ std::string mDefaultNeedsApplyMesg;
+ std::string mWantApplyMesg;
- std::vector<LLPanelGroupTab* > mTabs;
+ std::vector<LLPanelGroupTab* > mTabs;
- LLButton* mButtonJoin;
- LLUICtrl* mJoinText;
+ LLButton* mButtonJoin;
+ LLUICtrl* mJoinText;
};
class LLPanelGroupTab : public LLPanel
{
public:
- LLPanelGroupTab();
- virtual ~LLPanelGroupTab();
+ LLPanelGroupTab();
+ virtual ~LLPanelGroupTab();
+
+ // Triggered when the tab becomes active.
+ virtual void activate() { }
- // Triggered when the tab becomes active.
- virtual void activate() { }
-
- // Triggered when the tab becomes inactive.
- virtual void deactivate() { }
+ // Triggered when the tab becomes inactive.
+ virtual void deactivate() { }
- // Asks if something needs to be applied.
- // If returning true, this function should modify the message to the user.
- virtual bool needsApply(std::string& mesg) { return false; }
+ // Asks if something needs to be applied.
+ // If returning true, this function should modify the message to the user.
+ virtual bool needsApply(std::string& mesg) { return false; }
- // Asks if there is currently a modal dialog being shown.
- virtual BOOL hasModal() { return mHasModal; }
+ // Asks if there is currently a modal dialog being shown.
+ virtual BOOL hasModal() { return mHasModal; }
- // Request to apply current data.
- // If returning fail, this function should modify the message to the user.
- virtual bool apply(std::string& mesg) { return true; }
+ // Request to apply current data.
+ // If returning fail, this function should modify the message to the user.
+ virtual bool apply(std::string& mesg) { return true; }
- // Request a cancel of changes
- virtual void cancel() { }
+ // Request a cancel of changes
+ virtual void cancel() { }
- // Triggered when group information changes in the group manager.
- virtual void update(LLGroupChange gc) { }
+ // Triggered when group information changes in the group manager.
+ virtual void update(LLGroupChange gc) { }
- // This just connects the help button callback.
- virtual BOOL postBuild();
+ // This just connects the help button callback.
+ virtual BOOL postBuild();
- virtual BOOL isVisibleByAgent(LLAgent* agentp);
+ virtual BOOL isVisibleByAgent(LLAgent* agentp);
- virtual void setGroupID(const LLUUID& id) {mGroupID = id;};
+ virtual void setGroupID(const LLUUID& id) {mGroupID = id;};
- void notifyObservers() {};
+ void notifyObservers() {};
- const LLUUID& getGroupID() const { return mGroupID;}
+ const LLUUID& getGroupID() const { return mGroupID;}
- virtual void setupCtrls (LLPanel* parent) {};
+ virtual void setupCtrls (LLPanel* parent) {};
- virtual void onFilterChanged() { }
+ virtual void onFilterChanged() { }
protected:
- LLUUID mGroupID;
- BOOL mAllowEdit;
- BOOL mHasModal;
+ LLUUID mGroupID;
+ BOOL mAllowEdit;
+ BOOL mHasModal;
};
#endif // LL_LLPANELGROUP_H
diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp
index cffda02aa0..e2758524f3 100644
--- a/indra/newview/llpanelgroupbulk.cpp
+++ b/indra/newview/llpanelgroupbulk.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelgroupbulk.cpp
* @brief Implementation of llpanelgroupbulk
* @author Baker@lindenlab.com
@@ -53,370 +53,370 @@
// Implementation of llpanelgroupbulkimpl.h functions
//////////////////////////////////////////////////////////////////////////
LLPanelGroupBulkImpl::LLPanelGroupBulkImpl(const LLUUID& group_id) :
- mGroupID(group_id),
- mBulkAgentList(NULL),
- mOKButton(NULL),
- mRemoveButton(NULL),
- mGroupName(NULL),
- mLoadingText(),
- mTooManySelected(),
- mCloseCallback(NULL),
- mCloseCallbackUserData(NULL),
- mAvatarNameCacheConnection(),
- mRoleNames(NULL),
- mOwnerWarning(),
- mAlreadyInGroup(),
- mConfirmedOwnerInvite(false),
- mListFullNotificationSent(false)
+ mGroupID(group_id),
+ mBulkAgentList(NULL),
+ mOKButton(NULL),
+ mRemoveButton(NULL),
+ mGroupName(NULL),
+ mLoadingText(),
+ mTooManySelected(),
+ mCloseCallback(NULL),
+ mCloseCallbackUserData(NULL),
+ mAvatarNameCacheConnection(),
+ mRoleNames(NULL),
+ mOwnerWarning(),
+ mAlreadyInGroup(),
+ mConfirmedOwnerInvite(false),
+ mListFullNotificationSent(false)
{}
LLPanelGroupBulkImpl::~LLPanelGroupBulkImpl()
{
- if(mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ if(mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
}
void LLPanelGroupBulkImpl::callbackClickAdd(void* userdata)
{
- LLPanelGroupBulk* panelp = (LLPanelGroupBulk*)userdata;
-
- if(panelp)
- {
- //Right now this is hard coded with some knowledge that it is part
- //of a floater since the avatar picker needs to be added as a dependent
- //floater to the parent floater.
- //Soon the avatar picker will be embedded into this panel
- //instead of being it's own separate floater. But that is next week.
- //This will do for now. -jwolk May 10, 2006
- LLView* button = panelp->findChild<LLButton>("add_button");
- LLFloater* root_floater = gFloaterView->getParentFloater(panelp);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
- boost::bind(callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button);
- if(picker)
- {
- root_floater->addDependentFloater(picker);
- LLGroupMgr::getInstance()->sendCapGroupMembersRequest(panelp->mImplementation->mGroupID);
- }
- }
+ LLPanelGroupBulk* panelp = (LLPanelGroupBulk*)userdata;
+
+ if(panelp)
+ {
+ //Right now this is hard coded with some knowledge that it is part
+ //of a floater since the avatar picker needs to be added as a dependent
+ //floater to the parent floater.
+ //Soon the avatar picker will be embedded into this panel
+ //instead of being it's own separate floater. But that is next week.
+ //This will do for now. -jwolk May 10, 2006
+ LLView* button = panelp->findChild<LLButton>("add_button");
+ LLFloater* root_floater = gFloaterView->getParentFloater(panelp);
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+ boost::bind(callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button);
+ if(picker)
+ {
+ root_floater->addDependentFloater(picker);
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(panelp->mImplementation->mGroupID);
+ }
+ }
}
void LLPanelGroupBulkImpl::callbackClickRemove(void* userdata)
{
- LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata;
- if (selfp)
- selfp->handleRemove();
+ LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata;
+ if (selfp)
+ selfp->handleRemove();
}
void LLPanelGroupBulkImpl::callbackClickCancel(void* userdata)
{
- LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata;
- if(selfp)
- (*(selfp->mCloseCallback))(selfp->mCloseCallbackUserData);
+ LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata;
+ if(selfp)
+ (*(selfp->mCloseCallback))(selfp->mCloseCallbackUserData);
}
void LLPanelGroupBulkImpl::callbackSelect(LLUICtrl* ctrl, void* userdata)
{
- LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata;
- if (selfp)
- selfp->handleSelection();
+ LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata;
+ if (selfp)
+ selfp->handleSelection();
}
void LLPanelGroupBulkImpl::callbackAddUsers(const uuid_vec_t& agent_ids, void* user_data)
{
- std::vector<std::string> names;
- for (S32 i = 0; i < (S32)agent_ids.size(); i++)
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(agent_ids[i], &av_name))
- {
- onAvatarNameCache(agent_ids[i], av_name, user_data);
- }
- else
- {
- LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*) user_data;
- if (selfp)
- {
- if (selfp->mAvatarNameCacheConnection.connected())
- {
- selfp->mAvatarNameCacheConnection.disconnect();
- }
- // *TODO : Add a callback per avatar name being fetched.
- selfp->mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_ids[i],boost::bind(onAvatarNameCache, _1, _2, user_data));
- }
- }
- }
+ std::vector<std::string> names;
+ for (S32 i = 0; i < (S32)agent_ids.size(); i++)
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(agent_ids[i], &av_name))
+ {
+ onAvatarNameCache(agent_ids[i], av_name, user_data);
+ }
+ else
+ {
+ LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*) user_data;
+ if (selfp)
+ {
+ if (selfp->mAvatarNameCacheConnection.connected())
+ {
+ selfp->mAvatarNameCacheConnection.disconnect();
+ }
+ // *TODO : Add a callback per avatar name being fetched.
+ selfp->mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_ids[i],boost::bind(onAvatarNameCache, _1, _2, user_data));
+ }
+ }
+ }
}
void LLPanelGroupBulkImpl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, void* user_data)
{
- LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*) user_data;
-
- if (selfp)
- {
- if (selfp->mAvatarNameCacheConnection.connected())
- {
- selfp->mAvatarNameCacheConnection.disconnect();
- }
- std::vector<std::string> names;
- uuid_vec_t agent_ids;
- agent_ids.push_back(agent_id);
- names.push_back(av_name.getCompleteName());
-
- selfp->addUsers(names, agent_ids);
- }
+ LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*) user_data;
+
+ if (selfp)
+ {
+ if (selfp->mAvatarNameCacheConnection.connected())
+ {
+ selfp->mAvatarNameCacheConnection.disconnect();
+ }
+ std::vector<std::string> names;
+ uuid_vec_t agent_ids;
+ agent_ids.push_back(agent_id);
+ names.push_back(av_name.getCompleteName());
+
+ selfp->addUsers(names, agent_ids);
+ }
}
void LLPanelGroupBulkImpl::handleRemove()
{
- std::vector<LLScrollListItem*> selection = mBulkAgentList->getAllSelected();
- if (selection.empty())
- return;
-
- std::vector<LLScrollListItem*>::iterator iter;
- for(iter = selection.begin(); iter != selection.end(); ++iter)
- {
- mInviteeIDs.erase((*iter)->getUUID());
- }
-
- mBulkAgentList->deleteSelectedItems();
- mRemoveButton->setEnabled(FALSE);
-
- if( mOKButton && mOKButton->getEnabled() &&
- mBulkAgentList->isEmpty())
- {
- mOKButton->setEnabled(FALSE);
- }
+ std::vector<LLScrollListItem*> selection = mBulkAgentList->getAllSelected();
+ if (selection.empty())
+ return;
+
+ std::vector<LLScrollListItem*>::iterator iter;
+ for(iter = selection.begin(); iter != selection.end(); ++iter)
+ {
+ mInviteeIDs.erase((*iter)->getUUID());
+ }
+
+ mBulkAgentList->deleteSelectedItems();
+ mRemoveButton->setEnabled(FALSE);
+
+ if( mOKButton && mOKButton->getEnabled() &&
+ mBulkAgentList->isEmpty())
+ {
+ mOKButton->setEnabled(FALSE);
+ }
}
void LLPanelGroupBulkImpl::handleSelection()
{
- std::vector<LLScrollListItem*> selection = mBulkAgentList->getAllSelected();
- if (selection.empty())
- mRemoveButton->setEnabled(FALSE);
- else
- mRemoveButton->setEnabled(TRUE);
+ std::vector<LLScrollListItem*> selection = mBulkAgentList->getAllSelected();
+ if (selection.empty())
+ mRemoveButton->setEnabled(FALSE);
+ else
+ mRemoveButton->setEnabled(TRUE);
}
void LLPanelGroupBulkImpl::addUsers(const std::vector<std::string>& names, const uuid_vec_t& agent_ids)
{
- std::string name;
- LLUUID id;
-
- if(mListFullNotificationSent)
- {
- return;
- }
-
- if( !mListFullNotificationSent &&
- (names.size() + mInviteeIDs.size() > MAX_GROUP_INVITES))
- {
- mListFullNotificationSent = true;
-
- // Fail! Show a warning and don't add any names.
- LLSD msg;
- msg["MESSAGE"] = mTooManySelected;
- LLNotificationsUtil::add("GenericAlert", msg);
- return;
- }
-
- for (S32 i = 0; i < (S32)names.size(); ++i)
- {
- name = names[i];
- id = agent_ids[i];
-
- if(mInviteeIDs.find(id) != mInviteeIDs.end())
- {
- continue;
- }
-
- //add the name to the names list
- LLSD row;
- row["id"] = id;
- row["columns"][0]["value"] = name;
-
- mBulkAgentList->addElement(row);
- mInviteeIDs.insert(id);
-
- // We've successfully added someone to the list.
- if(mOKButton && !mOKButton->getEnabled())
- mOKButton->setEnabled(TRUE);
- }
+ std::string name;
+ LLUUID id;
+
+ if(mListFullNotificationSent)
+ {
+ return;
+ }
+
+ if( !mListFullNotificationSent &&
+ (names.size() + mInviteeIDs.size() > MAX_GROUP_INVITES))
+ {
+ mListFullNotificationSent = true;
+
+ // Fail! Show a warning and don't add any names.
+ LLSD msg;
+ msg["MESSAGE"] = mTooManySelected;
+ LLNotificationsUtil::add("GenericAlert", msg);
+ return;
+ }
+
+ for (S32 i = 0; i < (S32)names.size(); ++i)
+ {
+ name = names[i];
+ id = agent_ids[i];
+
+ if(mInviteeIDs.find(id) != mInviteeIDs.end())
+ {
+ continue;
+ }
+
+ //add the name to the names list
+ LLSD row;
+ row["id"] = id;
+ row["columns"][0]["value"] = name;
+
+ mBulkAgentList->addElement(row);
+ mInviteeIDs.insert(id);
+
+ // We've successfully added someone to the list.
+ if(mOKButton && !mOKButton->getEnabled())
+ mOKButton->setEnabled(TRUE);
+ }
}
void LLPanelGroupBulkImpl::setGroupName(std::string name)
{
- if(mGroupName)
- mGroupName->setText(name);
+ if(mGroupName)
+ mGroupName->setText(name);
}
-LLPanelGroupBulk::LLPanelGroupBulk(const LLUUID& group_id) :
- LLPanel(),
- mImplementation(new LLPanelGroupBulkImpl(group_id)),
- mPendingGroupPropertiesUpdate(false),
- mPendingRoleDataUpdate(false),
- mPendingMemberDataUpdate(false)
+LLPanelGroupBulk::LLPanelGroupBulk(const LLUUID& group_id) :
+ LLPanel(),
+ mImplementation(new LLPanelGroupBulkImpl(group_id)),
+ mPendingGroupPropertiesUpdate(false),
+ mPendingRoleDataUpdate(false),
+ mPendingMemberDataUpdate(false)
{}
LLPanelGroupBulk::~LLPanelGroupBulk()
{
- delete mImplementation;
+ delete mImplementation;
}
void LLPanelGroupBulk::clear()
{
- mImplementation->mInviteeIDs.clear();
+ mImplementation->mInviteeIDs.clear();
- if(mImplementation->mBulkAgentList)
- mImplementation->mBulkAgentList->deleteAllItems();
-
- if(mImplementation->mOKButton)
- mImplementation->mOKButton->setEnabled(FALSE);
+ if(mImplementation->mBulkAgentList)
+ mImplementation->mBulkAgentList->deleteAllItems();
+
+ if(mImplementation->mOKButton)
+ mImplementation->mOKButton->setEnabled(FALSE);
}
void LLPanelGroupBulk::update()
{
- updateGroupName();
- updateGroupData();
+ updateGroupName();
+ updateGroupData();
}
void LLPanelGroupBulk::draw()
{
- LLPanel::draw();
- update();
+ LLPanel::draw();
+ update();
}
void LLPanelGroupBulk::updateGroupName()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
-
- if( gdatap &&
- gdatap->isGroupPropertiesDataComplete())
- {
- // Only do work if the current group name differs
- if(mImplementation->mGroupName->getText().compare(gdatap->mName) != 0)
- mImplementation->setGroupName(gdatap->mName);
- }
- else
- {
- mImplementation->setGroupName(mImplementation->mLoadingText);
- }
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
+
+ if( gdatap &&
+ gdatap->isGroupPropertiesDataComplete())
+ {
+ // Only do work if the current group name differs
+ if(mImplementation->mGroupName->getText().compare(gdatap->mName) != 0)
+ mImplementation->setGroupName(gdatap->mName);
+ }
+ else
+ {
+ mImplementation->setGroupName(mImplementation->mLoadingText);
+ }
}
void LLPanelGroupBulk::updateGroupData()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
- if(gdatap && gdatap->isGroupPropertiesDataComplete())
- {
- mPendingGroupPropertiesUpdate = false;
- }
- else
- {
- if(!mPendingGroupPropertiesUpdate)
- {
- mPendingGroupPropertiesUpdate = true;
- LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID);
- }
- }
-
- if(gdatap && gdatap->isRoleDataComplete())
- {
- mPendingRoleDataUpdate = false;
- }
- else
- {
- if(!mPendingRoleDataUpdate)
- {
- mPendingRoleDataUpdate = true;
- LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID);
- }
- }
-
- if(gdatap && gdatap->isMemberDataComplete())
- {
- mPendingMemberDataUpdate = false;
- }
- else
- {
- if(!mPendingMemberDataUpdate)
- {
- mPendingMemberDataUpdate = true;
- LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID);
- }
- }
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
+ if(gdatap && gdatap->isGroupPropertiesDataComplete())
+ {
+ mPendingGroupPropertiesUpdate = false;
+ }
+ else
+ {
+ if(!mPendingGroupPropertiesUpdate)
+ {
+ mPendingGroupPropertiesUpdate = true;
+ LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID);
+ }
+ }
+
+ if(gdatap && gdatap->isRoleDataComplete())
+ {
+ mPendingRoleDataUpdate = false;
+ }
+ else
+ {
+ if(!mPendingRoleDataUpdate)
+ {
+ mPendingRoleDataUpdate = true;
+ LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID);
+ }
+ }
+
+ if(gdatap && gdatap->isMemberDataComplete())
+ {
+ mPendingMemberDataUpdate = false;
+ }
+ else
+ {
+ if(!mPendingMemberDataUpdate)
+ {
+ mPendingMemberDataUpdate = true;
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID);
+ }
+ }
}
void LLPanelGroupBulk::addUserCallback(const LLUUID& id, const LLAvatarName& av_name)
{
- std::vector<std::string> names;
- uuid_vec_t agent_ids;
- agent_ids.push_back(id);
- names.push_back(av_name.getAccountName());
+ std::vector<std::string> names;
+ uuid_vec_t agent_ids;
+ agent_ids.push_back(id);
+ names.push_back(av_name.getAccountName());
- mImplementation->addUsers(names, agent_ids);
+ mImplementation->addUsers(names, agent_ids);
}
void LLPanelGroupBulk::setCloseCallback(void (*close_callback)(void*), void* data)
{
- mImplementation->mCloseCallback = close_callback;
- mImplementation->mCloseCallbackUserData = data;
+ mImplementation->mCloseCallback = close_callback;
+ mImplementation->mCloseCallbackUserData = data;
}
void LLPanelGroupBulk::addUsers(uuid_vec_t& agent_ids)
{
- std::vector<std::string> names;
- for (S32 i = 0; i < (S32)agent_ids.size(); i++)
- {
- std::string fullname;
- LLUUID agent_id = agent_ids[i];
- LLViewerObject* dest = gObjectList.findObject(agent_id);
- if(dest && dest->isAvatar())
- {
- LLNameValue* nvfirst = dest->getNVPair("FirstName");
- LLNameValue* nvlast = dest->getNVPair("LastName");
- if(nvfirst && nvlast)
- {
- fullname = LLCacheName::buildFullName(
- nvfirst->getString(), nvlast->getString());
-
- }
- if (!fullname.empty())
- {
- names.push_back(fullname);
- }
- else
- {
- LL_WARNS() << "llPanelGroupBulk: Selected avatar has no name: " << dest->getID() << LL_ENDL;
- names.push_back("(Unknown)");
- }
- }
- else
- {
- //looks like user try to invite offline friend
- //for offline avatar_id gObjectList.findObject() will return null
- //so we need to do this additional search in avatar tracker, see EXT-4732
- if (LLAvatarTracker::instance().isBuddy(agent_id))
- {
- LLAvatarName av_name;
- if (!LLAvatarNameCache::get(agent_id, &av_name))
- {
- // actually it should happen, just in case
- LLAvatarNameCache::get(LLUUID(agent_id), boost::bind(&LLPanelGroupBulk::addUserCallback, this, _1, _2));
- // for this special case!
- //when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence
- // removed id will be added in callback
- agent_ids.erase(agent_ids.begin() + i);
- }
- else
- {
- names.push_back(av_name.getAccountName());
- }
- }
- }
- }
- mImplementation->mListFullNotificationSent = false;
- mImplementation->addUsers(names, agent_ids);
+ std::vector<std::string> names;
+ for (S32 i = 0; i < (S32)agent_ids.size(); i++)
+ {
+ std::string fullname;
+ LLUUID agent_id = agent_ids[i];
+ LLViewerObject* dest = gObjectList.findObject(agent_id);
+ if(dest && dest->isAvatar())
+ {
+ LLNameValue* nvfirst = dest->getNVPair("FirstName");
+ LLNameValue* nvlast = dest->getNVPair("LastName");
+ if(nvfirst && nvlast)
+ {
+ fullname = LLCacheName::buildFullName(
+ nvfirst->getString(), nvlast->getString());
+
+ }
+ if (!fullname.empty())
+ {
+ names.push_back(fullname);
+ }
+ else
+ {
+ LL_WARNS() << "llPanelGroupBulk: Selected avatar has no name: " << dest->getID() << LL_ENDL;
+ names.push_back("(Unknown)");
+ }
+ }
+ else
+ {
+ //looks like user try to invite offline friend
+ //for offline avatar_id gObjectList.findObject() will return null
+ //so we need to do this additional search in avatar tracker, see EXT-4732
+ if (LLAvatarTracker::instance().isBuddy(agent_id))
+ {
+ LLAvatarName av_name;
+ if (!LLAvatarNameCache::get(agent_id, &av_name))
+ {
+ // actually it should happen, just in case
+ LLAvatarNameCache::get(LLUUID(agent_id), boost::bind(&LLPanelGroupBulk::addUserCallback, this, _1, _2));
+ // for this special case!
+ //when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence
+ // removed id will be added in callback
+ agent_ids.erase(agent_ids.begin() + i);
+ }
+ else
+ {
+ names.push_back(av_name.getAccountName());
+ }
+ }
+ }
+ }
+ mImplementation->mListFullNotificationSent = false;
+ mImplementation->addUsers(names, agent_ids);
}
diff --git a/indra/newview/llpanelgroupbulk.h b/indra/newview/llpanelgroupbulk.h
index 25ae71ab86..96cc17d086 100644
--- a/indra/newview/llpanelgroupbulk.h
+++ b/indra/newview/llpanelgroupbulk.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelgroupbulk.h
* @brief Header file for llpanelgroupbulk
* @author Baker@lindenlab.com
@@ -38,36 +38,36 @@ class LLPanelGroupBulkImpl;
class LLPanelGroupBulk : public LLPanel
{
public:
- LLPanelGroupBulk(const LLUUID& group_id);
- /*virtual*/ ~LLPanelGroupBulk();
+ LLPanelGroupBulk(const LLUUID& group_id);
+ /*virtual*/ ~LLPanelGroupBulk();
-public:
- static void callbackClickSubmit(void* userdata) {}
- virtual void submit() = 0;
+public:
+ static void callbackClickSubmit(void* userdata) {}
+ virtual void submit() = 0;
public:
- virtual void clear();
- virtual void update();
- virtual void draw();
+ virtual void clear();
+ virtual void update();
+ virtual void draw();
protected:
- virtual void updateGroupName();
- virtual void updateGroupData();
+ virtual void updateGroupName();
+ virtual void updateGroupData();
public:
- // this callback is being used to add a user whose fullname isn't been loaded before invoking of addUsers().
- virtual void addUserCallback(const LLUUID& id, const LLAvatarName& av_name);
- virtual void setCloseCallback(void (*close_callback)(void*), void* data);
+ // this callback is being used to add a user whose fullname isn't been loaded before invoking of addUsers().
+ virtual void addUserCallback(const LLUUID& id, const LLAvatarName& av_name);
+ virtual void setCloseCallback(void (*close_callback)(void*), void* data);
- virtual void addUsers(uuid_vec_t& agent_ids);
+ virtual void addUsers(uuid_vec_t& agent_ids);
public:
- LLPanelGroupBulkImpl* mImplementation;
+ LLPanelGroupBulkImpl* mImplementation;
protected:
- bool mPendingGroupPropertiesUpdate;
- bool mPendingRoleDataUpdate;
- bool mPendingMemberDataUpdate;
+ bool mPendingGroupPropertiesUpdate;
+ bool mPendingRoleDataUpdate;
+ bool mPendingMemberDataUpdate;
};
#endif // LL_LLPANELGROUPBULK_H
diff --git a/indra/newview/llpanelgroupbulkban.cpp b/indra/newview/llpanelgroupbulkban.cpp
index 2b6bf1bcd6..6a17a6e56d 100644
--- a/indra/newview/llpanelgroupbulkban.cpp
+++ b/indra/newview/llpanelgroupbulkban.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelgroupbulkban.cpp
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
@@ -51,206 +51,206 @@
LLPanelGroupBulkBan::LLPanelGroupBulkBan(const LLUUID& group_id) : LLPanelGroupBulk(group_id)
{
- // Pass on construction of this panel to the control factory.
- buildFromFile( "panel_group_bulk_ban.xml");
+ // Pass on construction of this panel to the control factory.
+ buildFromFile( "panel_group_bulk_ban.xml");
}
BOOL LLPanelGroupBulkBan::postBuild()
{
- BOOL recurse = TRUE;
+ BOOL recurse = TRUE;
- mImplementation->mLoadingText = getString("loading");
- mImplementation->mGroupName = getChild<LLTextBox>("group_name_text", recurse);
- mImplementation->mBulkAgentList = getChild<LLNameListCtrl>("banned_agent_list", recurse);
- if ( mImplementation->mBulkAgentList )
- {
- mImplementation->mBulkAgentList->setCommitOnSelectionChange(TRUE);
- mImplementation->mBulkAgentList->setCommitCallback(LLPanelGroupBulkImpl::callbackSelect, mImplementation);
- }
+ mImplementation->mLoadingText = getString("loading");
+ mImplementation->mGroupName = getChild<LLTextBox>("group_name_text", recurse);
+ mImplementation->mBulkAgentList = getChild<LLNameListCtrl>("banned_agent_list", recurse);
+ if ( mImplementation->mBulkAgentList )
+ {
+ mImplementation->mBulkAgentList->setCommitOnSelectionChange(TRUE);
+ mImplementation->mBulkAgentList->setCommitCallback(LLPanelGroupBulkImpl::callbackSelect, mImplementation);
+ }
- LLButton* button = getChild<LLButton>("add_button", recurse);
- if ( button )
- {
- // default to opening avatarpicker automatically
- // (*impl::callbackClickAdd)((void*)this);
- button->setClickedCallback(LLPanelGroupBulkImpl::callbackClickAdd, this);
- }
+ LLButton* button = getChild<LLButton>("add_button", recurse);
+ if ( button )
+ {
+ // default to opening avatarpicker automatically
+ // (*impl::callbackClickAdd)((void*)this);
+ button->setClickedCallback(LLPanelGroupBulkImpl::callbackClickAdd, this);
+ }
- mImplementation->mRemoveButton =
- getChild<LLButton>("remove_button", recurse);
- if ( mImplementation->mRemoveButton )
- {
- mImplementation->mRemoveButton->setClickedCallback(LLPanelGroupBulkImpl::callbackClickRemove, mImplementation);
- mImplementation->mRemoveButton->setEnabled(FALSE);
- }
+ mImplementation->mRemoveButton =
+ getChild<LLButton>("remove_button", recurse);
+ if ( mImplementation->mRemoveButton )
+ {
+ mImplementation->mRemoveButton->setClickedCallback(LLPanelGroupBulkImpl::callbackClickRemove, mImplementation);
+ mImplementation->mRemoveButton->setEnabled(FALSE);
+ }
- mImplementation->mOKButton =
- getChild<LLButton>("ban_button", recurse);
- if ( mImplementation->mOKButton )
- {
- mImplementation->mOKButton->setClickedCallback(LLPanelGroupBulkBan::callbackClickSubmit, this);
- mImplementation->mOKButton->setEnabled(FALSE);
- }
+ mImplementation->mOKButton =
+ getChild<LLButton>("ban_button", recurse);
+ if ( mImplementation->mOKButton )
+ {
+ mImplementation->mOKButton->setClickedCallback(LLPanelGroupBulkBan::callbackClickSubmit, this);
+ mImplementation->mOKButton->setEnabled(FALSE);
+ }
- button = getChild<LLButton>("cancel_button", recurse);
- if ( button )
- {
- button->setClickedCallback(LLPanelGroupBulkImpl::callbackClickCancel, mImplementation);
- }
+ button = getChild<LLButton>("cancel_button", recurse);
+ if ( button )
+ {
+ button->setClickedCallback(LLPanelGroupBulkImpl::callbackClickCancel, mImplementation);
+ }
- mImplementation->mTooManySelected = getString("ban_selection_too_large");
- mImplementation->mBanNotPermitted = getString("ban_not_permitted");
- mImplementation->mBanLimitFail = getString("ban_limit_fail");
- mImplementation->mCannotBanYourself = getString("cant_ban_yourself");
+ mImplementation->mTooManySelected = getString("ban_selection_too_large");
+ mImplementation->mBanNotPermitted = getString("ban_not_permitted");
+ mImplementation->mBanLimitFail = getString("ban_limit_fail");
+ mImplementation->mCannotBanYourself = getString("cant_ban_yourself");
- update();
- return TRUE;
+ update();
+ return TRUE;
}
// TODO: Refactor the shitty callback functions with void* -- just use boost::bind to call submit() instead.
void LLPanelGroupBulkBan::callbackClickSubmit(void* userdata)
{
- LLPanelGroupBulkBan* selfp = (LLPanelGroupBulkBan*)userdata;
+ LLPanelGroupBulkBan* selfp = (LLPanelGroupBulkBan*)userdata;
- if(selfp)
- selfp->submit();
+ if(selfp)
+ selfp->submit();
}
void LLPanelGroupBulkBan::submit()
{
- if (!gAgent.hasPowerInGroup(mImplementation->mGroupID, GP_GROUP_BAN_ACCESS))
- {
- // Fail! Agent no longer have ban rights. Permissions could have changed after button was pressed.
- LLSD msg;
- msg["MESSAGE"] = mImplementation->mBanNotPermitted;
- LLNotificationsUtil::add("GenericAlert", msg);
- (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData);
- return;
- }
- LLGroupMgrGroupData * group_datap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
- if (group_datap && group_datap->mBanList.size() >= GB_MAX_BANNED_AGENTS)
- {
- // Fail! Size limit exceeded. List could have updated after button was pressed.
- LLSD msg;
- msg["MESSAGE"] = mImplementation->mBanLimitFail;
- LLNotificationsUtil::add("GenericAlert", msg);
- (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData);
- return;
- }
- std::vector<LLUUID> banned_agent_list;
- std::vector<LLScrollListItem*> agents = mImplementation->mBulkAgentList->getAllData();
- std::vector<LLScrollListItem*>::iterator iter = agents.begin();
- for(;iter != agents.end(); ++iter)
- {
- LLScrollListItem* agent = *iter;
- banned_agent_list.push_back(agent->getUUID());
- }
+ if (!gAgent.hasPowerInGroup(mImplementation->mGroupID, GP_GROUP_BAN_ACCESS))
+ {
+ // Fail! Agent no longer have ban rights. Permissions could have changed after button was pressed.
+ LLSD msg;
+ msg["MESSAGE"] = mImplementation->mBanNotPermitted;
+ LLNotificationsUtil::add("GenericAlert", msg);
+ (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData);
+ return;
+ }
+ LLGroupMgrGroupData * group_datap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
+ if (group_datap && group_datap->mBanList.size() >= GB_MAX_BANNED_AGENTS)
+ {
+ // Fail! Size limit exceeded. List could have updated after button was pressed.
+ LLSD msg;
+ msg["MESSAGE"] = mImplementation->mBanLimitFail;
+ LLNotificationsUtil::add("GenericAlert", msg);
+ (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData);
+ return;
+ }
+ std::vector<LLUUID> banned_agent_list;
+ std::vector<LLScrollListItem*> agents = mImplementation->mBulkAgentList->getAllData();
+ std::vector<LLScrollListItem*>::iterator iter = agents.begin();
+ for(;iter != agents.end(); ++iter)
+ {
+ LLScrollListItem* agent = *iter;
+ banned_agent_list.push_back(agent->getUUID());
+ }
- const S32 MAX_BANS_PER_REQUEST = 100; // Max bans per request. 100 to match server cap.
- if (banned_agent_list.size() > MAX_BANS_PER_REQUEST)
- {
- // Fail!
- LLSD msg;
- msg["MESSAGE"] = mImplementation->mTooManySelected;
- LLNotificationsUtil::add("GenericAlert", msg);
- (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData);
- return;
- }
+ const S32 MAX_BANS_PER_REQUEST = 100; // Max bans per request. 100 to match server cap.
+ if (banned_agent_list.size() > MAX_BANS_PER_REQUEST)
+ {
+ // Fail!
+ LLSD msg;
+ msg["MESSAGE"] = mImplementation->mTooManySelected;
+ LLNotificationsUtil::add("GenericAlert", msg);
+ (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData);
+ return;
+ }
- // remove already banned users and yourself from request.
- std::vector<LLAvatarName> banned_avatar_names;
- std::vector<LLAvatarName> out_of_limit_names;
- bool banning_self{ false };
- std::vector<LLUUID>::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), gAgentID);
- if (conflict != banned_agent_list.end())
- {
- banned_agent_list.erase(conflict);
- banning_self = TRUE;
- }
- if (group_datap)
- {
- for (const auto& [group_ban_agent_id, group_ban_data] : group_datap->mBanList)
- {
- std::vector<LLUUID>::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), group_ban_agent_id);
- if (conflict != banned_agent_list.end())
- {
- LLAvatarName av_name;
- LLAvatarNameCache::get(group_ban_agent_id, &av_name);
- banned_avatar_names.emplace_back(av_name);
+ // remove already banned users and yourself from request.
+ std::vector<LLAvatarName> banned_avatar_names;
+ std::vector<LLAvatarName> out_of_limit_names;
+ bool banning_self{ false };
+ std::vector<LLUUID>::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), gAgentID);
+ if (conflict != banned_agent_list.end())
+ {
+ banned_agent_list.erase(conflict);
+ banning_self = TRUE;
+ }
+ if (group_datap)
+ {
+ for (const auto& [group_ban_agent_id, group_ban_data] : group_datap->mBanList)
+ {
+ std::vector<LLUUID>::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), group_ban_agent_id);
+ if (conflict != banned_agent_list.end())
+ {
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(group_ban_agent_id, &av_name);
+ banned_avatar_names.emplace_back(av_name);
- banned_agent_list.erase(conflict);
- if (banned_agent_list.empty())
- {
- break;
- }
- }
- }
- // this check should always be the last one before we send the request.
- // Otherwise we have a possibility of cutting more then we need to.
- if (banned_agent_list.size() > GB_MAX_BANNED_AGENTS - group_datap->mBanList.size())
- {
- std::vector<LLUUID>::iterator exeedes_limit = banned_agent_list.begin() + GB_MAX_BANNED_AGENTS - group_datap->mBanList.size();
- for (std::vector<LLUUID>::iterator itor = exeedes_limit ;
- itor != banned_agent_list.end(); ++itor)
- {
- LLAvatarName av_name;
- LLAvatarNameCache::get(*itor, &av_name);
- out_of_limit_names.push_back(av_name);
- }
- banned_agent_list.erase(exeedes_limit,banned_agent_list.end());
- }
- }
+ banned_agent_list.erase(conflict);
+ if (banned_agent_list.empty())
+ {
+ break;
+ }
+ }
+ }
+ // this check should always be the last one before we send the request.
+ // Otherwise we have a possibility of cutting more then we need to.
+ if (banned_agent_list.size() > GB_MAX_BANNED_AGENTS - group_datap->mBanList.size())
+ {
+ std::vector<LLUUID>::iterator exeedes_limit = banned_agent_list.begin() + GB_MAX_BANNED_AGENTS - group_datap->mBanList.size();
+ for (std::vector<LLUUID>::iterator itor = exeedes_limit ;
+ itor != banned_agent_list.end(); ++itor)
+ {
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(*itor, &av_name);
+ out_of_limit_names.push_back(av_name);
+ }
+ banned_agent_list.erase(exeedes_limit,banned_agent_list.end());
+ }
+ }
- // sending request and ejecting members
- if (banned_agent_list.size() != 0)
- {
- LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mImplementation->mGroupID, LLGroupMgr::BAN_CREATE | LLGroupMgr::BAN_UPDATE, banned_agent_list);
- LLGroupMgr::getInstance()->sendGroupMemberEjects(mImplementation->mGroupID, banned_agent_list);
- }
+ // sending request and ejecting members
+ if (banned_agent_list.size() != 0)
+ {
+ LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mImplementation->mGroupID, LLGroupMgr::BAN_CREATE | LLGroupMgr::BAN_UPDATE, banned_agent_list);
+ LLGroupMgr::getInstance()->sendGroupMemberEjects(mImplementation->mGroupID, banned_agent_list);
+ }
- // building notification
- if (banned_avatar_names.size() > 0 || banning_self || out_of_limit_names.size() > 0)
- {
- std::string reasons;
- if(banned_avatar_names.size() > 0)
- {
- reasons = "\n " + buildResidentsArgument(banned_avatar_names, "residents_already_banned");
- }
+ // building notification
+ if (banned_avatar_names.size() > 0 || banning_self || out_of_limit_names.size() > 0)
+ {
+ std::string reasons;
+ if(banned_avatar_names.size() > 0)
+ {
+ reasons = "\n " + buildResidentsArgument(banned_avatar_names, "residents_already_banned");
+ }
- if(banning_self)
- {
- reasons += "\n " + mImplementation->mCannotBanYourself;
- }
+ if(banning_self)
+ {
+ reasons += "\n " + mImplementation->mCannotBanYourself;
+ }
- if(out_of_limit_names.size() > 0)
- {
- reasons += "\n " + buildResidentsArgument(out_of_limit_names, "ban_limit_reached");
- }
+ if(out_of_limit_names.size() > 0)
+ {
+ reasons += "\n " + buildResidentsArgument(out_of_limit_names, "ban_limit_reached");
+ }
- LLStringUtil::format_map_t msg_args;
- msg_args["[REASONS]"] = reasons;
- LLSD msg;
- if (banned_agent_list.size() == 0)
- {
- msg["MESSAGE"] = getString("ban_failed", msg_args);
- }
- else
- {
- msg["MESSAGE"] = getString("partial_ban", msg_args);
- }
- LLNotificationsUtil::add("GenericAlert", msg);
- }
-
- //then close
- (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData);
+ LLStringUtil::format_map_t msg_args;
+ msg_args["[REASONS]"] = reasons;
+ LLSD msg;
+ if (banned_agent_list.size() == 0)
+ {
+ msg["MESSAGE"] = getString("ban_failed", msg_args);
+ }
+ else
+ {
+ msg["MESSAGE"] = getString("partial_ban", msg_args);
+ }
+ LLNotificationsUtil::add("GenericAlert", msg);
+ }
+
+ //then close
+ (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData);
}
std::string LLPanelGroupBulkBan::buildResidentsArgument(std::vector<LLAvatarName> avatar_names, const std::string &format)
{
- std::string names_string;
- LLAvatarActions::buildResidentsString(avatar_names, names_string);
- LLStringUtil::format_map_t args;
- args["[RESIDENTS]"] = names_string;
- return getString(format, args);
+ std::string names_string;
+ LLAvatarActions::buildResidentsString(avatar_names, names_string);
+ LLStringUtil::format_map_t args;
+ args["[RESIDENTS]"] = names_string;
+ return getString(format, args);
}
diff --git a/indra/newview/llpanelgroupbulkban.h b/indra/newview/llpanelgroupbulkban.h
index 9060d275f9..d7b2ed6e67 100644
--- a/indra/newview/llpanelgroupbulkban.h
+++ b/indra/newview/llpanelgroupbulkban.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelgroupbulkban.h
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
@@ -35,15 +35,15 @@ class LLAvatarName;
class LLPanelGroupBulkBan : public LLPanelGroupBulk
{
public:
- LLPanelGroupBulkBan(const LLUUID& group_id);
- ~LLPanelGroupBulkBan() {}
+ LLPanelGroupBulkBan(const LLUUID& group_id);
+ ~LLPanelGroupBulkBan() {}
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- static void callbackClickSubmit(void* userdata);
- virtual void submit();
+ static void callbackClickSubmit(void* userdata);
+ virtual void submit();
private:
- std::string buildResidentsArgument(std::vector<LLAvatarName> avatar_names, const std::string &format);
+ std::string buildResidentsArgument(std::vector<LLAvatarName> avatar_names, const std::string &format);
};
#endif // LL_LLPANELGROUPBULKBAN_H
diff --git a/indra/newview/llpanelgroupbulkimpl.h b/indra/newview/llpanelgroupbulkimpl.h
index d3a48e5a9a..963780200a 100644
--- a/indra/newview/llpanelgroupbulkimpl.h
+++ b/indra/newview/llpanelgroupbulkimpl.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelgroupbulkimpl.h
* @brief Class definition for implementation class of LLPanelGroupBulk
* @author Baker@lindenlab.com
@@ -36,63 +36,63 @@ class LLTextBox;
class LLComboBox;
//////////////////////////////////////////////////////////////////////////
-// Implementation found in llpanelgroupbulk.cpp
+// Implementation found in llpanelgroupbulk.cpp
//////////////////////////////////////////////////////////////////////////
class LLPanelGroupBulkImpl
{
public:
- LLPanelGroupBulkImpl(const LLUUID& group_id);
- ~LLPanelGroupBulkImpl();
+ LLPanelGroupBulkImpl(const LLUUID& group_id);
+ ~LLPanelGroupBulkImpl();
- static void callbackClickAdd(void* userdata);
- static void callbackClickRemove(void* userdata);
+ static void callbackClickAdd(void* userdata);
+ static void callbackClickRemove(void* userdata);
- static void callbackClickCancel(void* userdata);
+ static void callbackClickCancel(void* userdata);
- static void callbackSelect(LLUICtrl* ctrl, void* userdata);
- static void callbackAddUsers(const uuid_vec_t& agent_ids, void* user_data);
+ static void callbackSelect(LLUICtrl* ctrl, void* userdata);
+ static void callbackAddUsers(const uuid_vec_t& agent_ids, void* user_data);
- static void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, void* user_data);
+ static void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, void* user_data);
- void handleRemove();
- void handleSelection();
+ void handleRemove();
+ void handleSelection();
- void addUsers(const std::vector<std::string>& names, const uuid_vec_t& agent_ids);
- void setGroupName(std::string name);
+ void addUsers(const std::vector<std::string>& names, const uuid_vec_t& agent_ids);
+ void setGroupName(std::string name);
public:
- static const S32 MAX_GROUP_INVITES = 100; // Max invites per request. 100 to match server cap.
-
+ static const S32 MAX_GROUP_INVITES = 100; // Max invites per request. 100 to match server cap.
- LLUUID mGroupID;
- LLNameListCtrl* mBulkAgentList;
- LLButton* mOKButton;
- LLButton* mRemoveButton;
- LLTextBox* mGroupName;
+ LLUUID mGroupID;
- std::string mLoadingText;
- std::string mTooManySelected;
- std::string mBanNotPermitted;
- std::string mBanLimitFail;
- std::string mCannotBanYourself;
+ LLNameListCtrl* mBulkAgentList;
+ LLButton* mOKButton;
+ LLButton* mRemoveButton;
+ LLTextBox* mGroupName;
- std::set<LLUUID> mInviteeIDs;
+ std::string mLoadingText;
+ std::string mTooManySelected;
+ std::string mBanNotPermitted;
+ std::string mBanLimitFail;
+ std::string mCannotBanYourself;
- void (*mCloseCallback)(void* data);
- void* mCloseCallbackUserData;
- boost::signals2::connection mAvatarNameCacheConnection;
+ std::set<LLUUID> mInviteeIDs;
- // The following are for the LLPanelGroupInvite subclass only.
- // These aren't needed for LLPanelGroupBulkBan, but if we have to add another
- // group bulk floater for some reason, we'll have these objects too.
+ void (*mCloseCallback)(void* data);
+ void* mCloseCallbackUserData;
+ boost::signals2::connection mAvatarNameCacheConnection;
+
+ // The following are for the LLPanelGroupInvite subclass only.
+ // These aren't needed for LLPanelGroupBulkBan, but if we have to add another
+ // group bulk floater for some reason, we'll have these objects too.
public:
- LLComboBox* mRoleNames;
- std::string mOwnerWarning;
- std::string mAlreadyInGroup;
- bool mConfirmedOwnerInvite;
- bool mListFullNotificationSent;
+ LLComboBox* mRoleNames;
+ std::string mOwnerWarning;
+ std::string mAlreadyInGroup;
+ bool mConfirmedOwnerInvite;
+ bool mListFullNotificationSent;
};
#endif // LL_LLPANELGROUPBULKIMPL_H
diff --git a/indra/newview/llpanelgroupcreate.cpp b/indra/newview/llpanelgroupcreate.cpp
index 01a4ab0455..1b8947caee 100644
--- a/indra/newview/llpanelgroupcreate.cpp
+++ b/indra/newview/llpanelgroupcreate.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llpanelgroupcreate.cpp
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llpanelgroupcreate.h b/indra/newview/llpanelgroupcreate.h
index 3ae2e7f24a..239258f074 100644
--- a/indra/newview/llpanelgroupcreate.h
+++ b/indra/newview/llpanelgroupcreate.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llpanelgroupcreate.h
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llpanelgroupexperiences.cpp b/indra/newview/llpanelgroupexperiences.cpp
index 6c40499208..5f564fc870 100644
--- a/indra/newview/llpanelgroupexperiences.cpp
+++ b/indra/newview/llpanelgroupexperiences.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelgroupexperiences.cpp
* @brief List of experiences owned by a group.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,7 +42,7 @@ static LLPanelInjector<LLPanelGroupExperiences> t_panel_group_experiences("panel
LLPanelGroupExperiences::LLPanelGroupExperiences()
-: LLPanelGroupTab(), mExperiencesList(NULL)
+: LLPanelGroupTab(), mExperiencesList(NULL)
{
}
@@ -52,25 +52,25 @@ LLPanelGroupExperiences::~LLPanelGroupExperiences()
BOOL LLPanelGroupExperiences::postBuild()
{
- mExperiencesList = getChild<LLFlatListView>("experiences_list");
- if (hasString("loading_experiences"))
- {
- mExperiencesList->setNoItemsCommentText(getString("loading_experiences"));
- }
- else if (hasString("no_experiences"))
- {
- mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
- }
-
- return LLPanelGroupTab::postBuild();
+ mExperiencesList = getChild<LLFlatListView>("experiences_list");
+ if (hasString("loading_experiences"))
+ {
+ mExperiencesList->setNoItemsCommentText(getString("loading_experiences"));
+ }
+ else if (hasString("no_experiences"))
+ {
+ mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
+ }
+
+ return LLPanelGroupTab::postBuild();
}
void LLPanelGroupExperiences::activate()
{
- if ((getGroupID() == LLUUID::null) || gDisconnected)
- {
- return;
- }
+ if ((getGroupID() == LLUUID::null) || gDisconnected)
+ {
+ return;
+ }
LLExperienceCache::instance().getGroupExperiences(getGroupID(),
boost::bind(&LLPanelGroupExperiences::groupExperiencesResults, getDerivedHandle<LLPanelGroupExperiences>(), _1));
@@ -78,22 +78,22 @@ void LLPanelGroupExperiences::activate()
void LLPanelGroupExperiences::setGroupID(const LLUUID& id)
{
- LLPanelGroupTab::setGroupID(id);
+ LLPanelGroupTab::setGroupID(id);
- if(id == LLUUID::null)
- {
- return;
- }
+ if(id == LLUUID::null)
+ {
+ return;
+ }
- activate();
+ activate();
}
void LLPanelGroupExperiences::setExperienceList(const LLSD& experiences)
{
- if (hasString("no_experiences"))
- {
- mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
- }
+ if (hasString("no_experiences"))
+ {
+ mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
+ }
mExperiencesList->clear();
LLSD::array_const_iterator it = experiences.beginArray();
diff --git a/indra/newview/llpanelgroupexperiences.h b/indra/newview/llpanelgroupexperiences.h
index 7c79f77332..caf91015ec 100644
--- a/indra/newview/llpanelgroupexperiences.h
+++ b/indra/newview/llpanelgroupexperiences.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelgroupexperiences.h
* @brief List of experiences owned by a group.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,20 +34,20 @@ class LLFlatListView;
class LLPanelGroupExperiences : public LLPanelGroupTab
{
public:
- LLPanelGroupExperiences();
- virtual ~LLPanelGroupExperiences();
-
- // LLPanelGroupTab
- virtual void activate();
-
- virtual BOOL postBuild();
-
- virtual void setGroupID(const LLUUID& id);
-
+ LLPanelGroupExperiences();
+ virtual ~LLPanelGroupExperiences();
+
+ // LLPanelGroupTab
+ virtual void activate();
+
+ virtual BOOL postBuild();
+
+ virtual void setGroupID(const LLUUID& id);
+
void setExperienceList(const LLSD& experiences);
protected:
- LLFlatListView* mExperiencesList;
+ LLFlatListView* mExperiencesList;
private:
static void groupExperiencesResults(LLHandle<LLPanelGroupExperiences>, const LLSD &);
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 04d3236bf1..9c6f16ee9e 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelgroupgeneral.cpp
* @brief General information about a group.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -63,22 +63,22 @@ const S32 DECLINE_TO_STATE = 0;
LLPanelGroupGeneral::LLPanelGroupGeneral()
-: LLPanelGroupTab(),
- mChanged(FALSE),
- mFirstUse(TRUE),
- mGroupNameEditor(NULL),
- mFounderName(NULL),
- mInsignia(NULL),
- mEditCharter(NULL),
- mCtrlShowInGroupList(NULL),
- mComboMature(NULL),
- mCtrlOpenEnrollment(NULL),
- mCtrlEnrollmentFee(NULL),
- mSpinEnrollmentFee(NULL),
- mCtrlReceiveNotices(NULL),
- mCtrlListGroup(NULL),
- mActiveTitleLabel(NULL),
- mComboActiveTitle(NULL)
+: LLPanelGroupTab(),
+ mChanged(FALSE),
+ mFirstUse(TRUE),
+ mGroupNameEditor(NULL),
+ mFounderName(NULL),
+ mInsignia(NULL),
+ mEditCharter(NULL),
+ mCtrlShowInGroupList(NULL),
+ mComboMature(NULL),
+ mCtrlOpenEnrollment(NULL),
+ mCtrlEnrollmentFee(NULL),
+ mSpinEnrollmentFee(NULL),
+ mCtrlReceiveNotices(NULL),
+ mCtrlListGroup(NULL),
+ mActiveTitleLabel(NULL),
+ mComboActiveTitle(NULL)
{
}
@@ -89,658 +89,658 @@ LLPanelGroupGeneral::~LLPanelGroupGeneral()
BOOL LLPanelGroupGeneral::postBuild()
{
- bool recurse = true;
-
- mEditCharter = getChild<LLTextEditor>("charter", recurse);
- if(mEditCharter)
- {
- mEditCharter->setCommitCallback(onCommitAny, this);
- mEditCharter->setFocusReceivedCallback(boost::bind(onFocusEdit, _1, this));
- mEditCharter->setFocusChangedCallback(boost::bind(onFocusEdit, _1, this));
+ bool recurse = true;
+
+ mEditCharter = getChild<LLTextEditor>("charter", recurse);
+ if(mEditCharter)
+ {
+ mEditCharter->setCommitCallback(onCommitAny, this);
+ mEditCharter->setFocusReceivedCallback(boost::bind(onFocusEdit, _1, this));
+ mEditCharter->setFocusChangedCallback(boost::bind(onFocusEdit, _1, this));
mEditCharter->setContentTrusted(false);
- }
-
- // Options
- mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse);
- if (mCtrlShowInGroupList)
- {
- mCtrlShowInGroupList->setCommitCallback(onCommitAny, this);
- }
-
- mComboMature = getChild<LLComboBox>("group_mature_check", recurse);
- if(mComboMature)
- {
- mComboMature->setCurrentByIndex(0);
- mComboMature->setCommitCallback(onCommitAny, this);
- if (gAgent.isTeen())
- {
- // Teens don't get to set mature flag. JC
- mComboMature->setVisible(FALSE);
- mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
- }
- }
- mCtrlOpenEnrollment = getChild<LLCheckBoxCtrl>("open_enrollement", recurse);
- if (mCtrlOpenEnrollment)
- {
- mCtrlOpenEnrollment->setCommitCallback(onCommitAny, this);
- }
-
- mCtrlEnrollmentFee = getChild<LLCheckBoxCtrl>("check_enrollment_fee", recurse);
- if (mCtrlEnrollmentFee)
- {
- mCtrlEnrollmentFee->setCommitCallback(onCommitEnrollment, this);
- }
-
- mSpinEnrollmentFee = getChild<LLSpinCtrl>("spin_enrollment_fee", recurse);
- if (mSpinEnrollmentFee)
- {
- mSpinEnrollmentFee->setCommitCallback(onCommitAny, this);
- mSpinEnrollmentFee->setPrecision(0);
- mSpinEnrollmentFee->resetDirty();
- }
-
- BOOL accept_notices = FALSE;
- BOOL list_in_profile = FALSE;
- LLGroupData data;
- if(gAgent.getGroupData(mGroupID,data))
- {
- accept_notices = data.mAcceptNotices;
- list_in_profile = data.mListInProfile;
- }
- mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices", recurse);
- if (mCtrlReceiveNotices)
- {
- mCtrlReceiveNotices->setCommitCallback(onCommitUserOnly, this);
- mCtrlReceiveNotices->set(accept_notices);
- mCtrlReceiveNotices->setEnabled(data.mID.notNull());
- }
-
- mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse);
- if (mCtrlListGroup)
- {
- mCtrlListGroup->setCommitCallback(onCommitUserOnly, this);
- mCtrlListGroup->set(list_in_profile);
- mCtrlListGroup->setEnabled(data.mID.notNull());
- mCtrlListGroup->resetDirty();
- }
-
- mActiveTitleLabel = getChild<LLTextBox>("active_title_label", recurse);
-
- mComboActiveTitle = getChild<LLComboBox>("active_title", recurse);
- if (mComboActiveTitle)
- {
- mComboActiveTitle->setCommitCallback(onCommitAny, this);
- }
-
- mIncompleteMemberDataStr = getString("incomplete_member_data_str");
-
- // If the group_id is null, then we are creating a new group
- if (mGroupID.isNull())
- {
- mEditCharter->setEnabled(TRUE);
-
- mCtrlShowInGroupList->setEnabled(TRUE);
- mComboMature->setEnabled(TRUE);
- mCtrlOpenEnrollment->setEnabled(TRUE);
- mCtrlEnrollmentFee->setEnabled(TRUE);
- mSpinEnrollmentFee->setEnabled(TRUE);
-
- }
-
- return LLPanelGroupTab::postBuild();
+ }
+
+ // Options
+ mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse);
+ if (mCtrlShowInGroupList)
+ {
+ mCtrlShowInGroupList->setCommitCallback(onCommitAny, this);
+ }
+
+ mComboMature = getChild<LLComboBox>("group_mature_check", recurse);
+ if(mComboMature)
+ {
+ mComboMature->setCurrentByIndex(0);
+ mComboMature->setCommitCallback(onCommitAny, this);
+ if (gAgent.isTeen())
+ {
+ // Teens don't get to set mature flag. JC
+ mComboMature->setVisible(FALSE);
+ mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
+ }
+ }
+ mCtrlOpenEnrollment = getChild<LLCheckBoxCtrl>("open_enrollement", recurse);
+ if (mCtrlOpenEnrollment)
+ {
+ mCtrlOpenEnrollment->setCommitCallback(onCommitAny, this);
+ }
+
+ mCtrlEnrollmentFee = getChild<LLCheckBoxCtrl>("check_enrollment_fee", recurse);
+ if (mCtrlEnrollmentFee)
+ {
+ mCtrlEnrollmentFee->setCommitCallback(onCommitEnrollment, this);
+ }
+
+ mSpinEnrollmentFee = getChild<LLSpinCtrl>("spin_enrollment_fee", recurse);
+ if (mSpinEnrollmentFee)
+ {
+ mSpinEnrollmentFee->setCommitCallback(onCommitAny, this);
+ mSpinEnrollmentFee->setPrecision(0);
+ mSpinEnrollmentFee->resetDirty();
+ }
+
+ BOOL accept_notices = FALSE;
+ BOOL list_in_profile = FALSE;
+ LLGroupData data;
+ if(gAgent.getGroupData(mGroupID,data))
+ {
+ accept_notices = data.mAcceptNotices;
+ list_in_profile = data.mListInProfile;
+ }
+ mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices", recurse);
+ if (mCtrlReceiveNotices)
+ {
+ mCtrlReceiveNotices->setCommitCallback(onCommitUserOnly, this);
+ mCtrlReceiveNotices->set(accept_notices);
+ mCtrlReceiveNotices->setEnabled(data.mID.notNull());
+ }
+
+ mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse);
+ if (mCtrlListGroup)
+ {
+ mCtrlListGroup->setCommitCallback(onCommitUserOnly, this);
+ mCtrlListGroup->set(list_in_profile);
+ mCtrlListGroup->setEnabled(data.mID.notNull());
+ mCtrlListGroup->resetDirty();
+ }
+
+ mActiveTitleLabel = getChild<LLTextBox>("active_title_label", recurse);
+
+ mComboActiveTitle = getChild<LLComboBox>("active_title", recurse);
+ if (mComboActiveTitle)
+ {
+ mComboActiveTitle->setCommitCallback(onCommitAny, this);
+ }
+
+ mIncompleteMemberDataStr = getString("incomplete_member_data_str");
+
+ // If the group_id is null, then we are creating a new group
+ if (mGroupID.isNull())
+ {
+ mEditCharter->setEnabled(TRUE);
+
+ mCtrlShowInGroupList->setEnabled(TRUE);
+ mComboMature->setEnabled(TRUE);
+ mCtrlOpenEnrollment->setEnabled(TRUE);
+ mCtrlEnrollmentFee->setEnabled(TRUE);
+ mSpinEnrollmentFee->setEnabled(TRUE);
+
+ }
+
+ return LLPanelGroupTab::postBuild();
}
void LLPanelGroupGeneral::setupCtrls(LLPanel* panel_group)
{
- mInsignia = getChild<LLTextureCtrl>("insignia");
- if (mInsignia)
- {
- mInsignia->setCommitCallback(onCommitAny, this);
- mInsignia->setAllowLocalTexture(FALSE);
- }
- mFounderName = getChild<LLTextBox>("founder_name");
+ mInsignia = getChild<LLTextureCtrl>("insignia");
+ if (mInsignia)
+ {
+ mInsignia->setCommitCallback(onCommitAny, this);
+ mInsignia->setAllowLocalTexture(FALSE);
+ }
+ mFounderName = getChild<LLTextBox>("founder_name");
+
+ mGroupNameEditor = panel_group->getChild<LLLineEditor>("group_name_editor");
+ mGroupNameEditor->setPrevalidate( LLTextValidate::validateASCIINoLeadingSpace );
- mGroupNameEditor = panel_group->getChild<LLLineEditor>("group_name_editor");
- mGroupNameEditor->setPrevalidate( LLTextValidate::validateASCIINoLeadingSpace );
-
}
// static
void LLPanelGroupGeneral::onFocusEdit(LLFocusableElement* ctrl, void* data)
{
- LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
- self->updateChanged();
- self->notifyObservers();
+ LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
+ self->updateChanged();
+ self->notifyObservers();
}
// static
void LLPanelGroupGeneral::onCommitAny(LLUICtrl* ctrl, void* data)
{
- LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
- self->updateChanged();
- self->notifyObservers();
+ LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
+ self->updateChanged();
+ self->notifyObservers();
}
// static
void LLPanelGroupGeneral::onCommitUserOnly(LLUICtrl* ctrl, void* data)
{
- LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
- self->mChanged = TRUE;
- self->notifyObservers();
+ LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
+ self->mChanged = TRUE;
+ self->notifyObservers();
}
// static
void LLPanelGroupGeneral::onCommitEnrollment(LLUICtrl* ctrl, void* data)
{
- onCommitAny(ctrl, data);
-
- LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
- // Make sure both enrollment related widgets are there.
- if (!self->mCtrlEnrollmentFee || !self->mSpinEnrollmentFee)
- {
- return;
- }
-
- // Make sure the agent can change enrollment info.
- if (!gAgent.hasPowerInGroup(self->mGroupID,GP_MEMBER_OPTIONS)
- || !self->mAllowEdit)
- {
- return;
- }
-
- if (self->mCtrlEnrollmentFee->get())
- {
- self->mSpinEnrollmentFee->setEnabled(TRUE);
- }
- else
- {
- self->mSpinEnrollmentFee->setEnabled(FALSE);
- self->mSpinEnrollmentFee->set(0);
- }
+ onCommitAny(ctrl, data);
+
+ LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
+ // Make sure both enrollment related widgets are there.
+ if (!self->mCtrlEnrollmentFee || !self->mSpinEnrollmentFee)
+ {
+ return;
+ }
+
+ // Make sure the agent can change enrollment info.
+ if (!gAgent.hasPowerInGroup(self->mGroupID,GP_MEMBER_OPTIONS)
+ || !self->mAllowEdit)
+ {
+ return;
+ }
+
+ if (self->mCtrlEnrollmentFee->get())
+ {
+ self->mSpinEnrollmentFee->setEnabled(TRUE);
+ }
+ else
+ {
+ self->mSpinEnrollmentFee->setEnabled(FALSE);
+ self->mSpinEnrollmentFee->set(0);
+ }
}
// static
void LLPanelGroupGeneral::onClickInfo(void *userdata)
{
- LLPanelGroupGeneral *self = (LLPanelGroupGeneral *)userdata;
+ LLPanelGroupGeneral *self = (LLPanelGroupGeneral *)userdata;
- if ( !self ) return;
+ if ( !self ) return;
- LL_DEBUGS() << "open group info: " << self->mGroupID << LL_ENDL;
+ LL_DEBUGS() << "open group info: " << self->mGroupID << LL_ENDL;
- LLGroupActions::show(self->mGroupID);
+ LLGroupActions::show(self->mGroupID);
}
bool LLPanelGroupGeneral::needsApply(std::string& mesg)
-{
- updateChanged();
- mesg = getString("group_info_unchanged");
- return mChanged || mGroupID.isNull();
+{
+ updateChanged();
+ mesg = getString("group_info_unchanged");
+ return mChanged || mGroupID.isNull();
}
void LLPanelGroupGeneral::activate()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (mGroupID.notNull()
- && (!gdatap || mFirstUse))
- {
- LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID);
- LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID);
-
- mFirstUse = FALSE;
- }
- mChanged = FALSE;
-
- update(GC_ALL);
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (mGroupID.notNull()
+ && (!gdatap || mFirstUse))
+ {
+ LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID);
+ LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID);
+
+ mFirstUse = FALSE;
+ }
+ mChanged = FALSE;
+
+ update(GC_ALL);
}
void LLPanelGroupGeneral::draw()
{
- LLPanelGroupTab::draw();
+ LLPanelGroupTab::draw();
}
bool LLPanelGroupGeneral::apply(std::string& mesg)
{
- if (mGroupID.isNull())
- {
- return false;
- }
-
- if (!mGroupID.isNull() && mAllowEdit && mComboActiveTitle && mComboActiveTitle->isDirty())
- {
- LLGroupMgr::getInstance()->sendGroupTitleUpdate(mGroupID,mComboActiveTitle->getCurrentID());
- update(GC_TITLES);
- mComboActiveTitle->resetDirty();
- }
-
- BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
-
- if (has_power_in_group)
- {
- LL_INFOS() << "LLPanelGroupGeneral::apply" << LL_ENDL;
-
- // Check to make sure mature has been set
- if(mComboMature &&
- mComboMature->getCurrentIndex() == DECLINE_TO_STATE)
- {
- LLNotificationsUtil::add("SetGroupMature", LLSD(), LLSD(),
- boost::bind(&LLPanelGroupGeneral::confirmMatureApply, this, _1, _2));
- return false;
- }
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- mesg = LLTrans::getString("NoGroupDataFound");
- mesg.append(mGroupID.asString());
- return false;
- }
- bool can_change_ident = false;
- bool can_change_member_opts = false;
- can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
- can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);
-
- if (can_change_ident)
- {
- if (mEditCharter) gdatap->mCharter = mEditCharter->getText();
- if (mInsignia) gdatap->mInsigniaID = mInsignia->getImageAssetID();
- if (mComboMature)
- {
- if (!gAgent.isTeen())
- {
- gdatap->mMaturePublish =
- mComboMature->getCurrentIndex() == MATURE_CONTENT;
- }
- else
- {
- gdatap->mMaturePublish = FALSE;
- }
- }
- if (mCtrlShowInGroupList) gdatap->mShowInList = mCtrlShowInGroupList->get();
- }
-
- if (can_change_member_opts)
- {
- if (mCtrlOpenEnrollment) gdatap->mOpenEnrollment = mCtrlOpenEnrollment->get();
- if (mCtrlEnrollmentFee && mSpinEnrollmentFee)
- {
- gdatap->mMembershipFee = (mCtrlEnrollmentFee->get()) ?
- (S32) mSpinEnrollmentFee->get() : 0;
- // Set to the used value, and reset initial value used for isdirty check
- mSpinEnrollmentFee->set( (F32)gdatap->mMembershipFee );
- }
- }
-
- if (can_change_ident || can_change_member_opts)
- {
- LLGroupMgr::getInstance()->sendUpdateGroupInfo(mGroupID);
- }
- }
-
- BOOL receive_notices = false;
- BOOL list_in_profile = false;
- if (mCtrlReceiveNotices)
- receive_notices = mCtrlReceiveNotices->get();
- if (mCtrlListGroup)
- list_in_profile = mCtrlListGroup->get();
-
- gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);
-
- resetDirty();
-
- mChanged = FALSE;
-
- return true;
+ if (mGroupID.isNull())
+ {
+ return false;
+ }
+
+ if (!mGroupID.isNull() && mAllowEdit && mComboActiveTitle && mComboActiveTitle->isDirty())
+ {
+ LLGroupMgr::getInstance()->sendGroupTitleUpdate(mGroupID,mComboActiveTitle->getCurrentID());
+ update(GC_TITLES);
+ mComboActiveTitle->resetDirty();
+ }
+
+ BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
+
+ if (has_power_in_group)
+ {
+ LL_INFOS() << "LLPanelGroupGeneral::apply" << LL_ENDL;
+
+ // Check to make sure mature has been set
+ if(mComboMature &&
+ mComboMature->getCurrentIndex() == DECLINE_TO_STATE)
+ {
+ LLNotificationsUtil::add("SetGroupMature", LLSD(), LLSD(),
+ boost::bind(&LLPanelGroupGeneral::confirmMatureApply, this, _1, _2));
+ return false;
+ }
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ mesg = LLTrans::getString("NoGroupDataFound");
+ mesg.append(mGroupID.asString());
+ return false;
+ }
+ bool can_change_ident = false;
+ bool can_change_member_opts = false;
+ can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
+ can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);
+
+ if (can_change_ident)
+ {
+ if (mEditCharter) gdatap->mCharter = mEditCharter->getText();
+ if (mInsignia) gdatap->mInsigniaID = mInsignia->getImageAssetID();
+ if (mComboMature)
+ {
+ if (!gAgent.isTeen())
+ {
+ gdatap->mMaturePublish =
+ mComboMature->getCurrentIndex() == MATURE_CONTENT;
+ }
+ else
+ {
+ gdatap->mMaturePublish = FALSE;
+ }
+ }
+ if (mCtrlShowInGroupList) gdatap->mShowInList = mCtrlShowInGroupList->get();
+ }
+
+ if (can_change_member_opts)
+ {
+ if (mCtrlOpenEnrollment) gdatap->mOpenEnrollment = mCtrlOpenEnrollment->get();
+ if (mCtrlEnrollmentFee && mSpinEnrollmentFee)
+ {
+ gdatap->mMembershipFee = (mCtrlEnrollmentFee->get()) ?
+ (S32) mSpinEnrollmentFee->get() : 0;
+ // Set to the used value, and reset initial value used for isdirty check
+ mSpinEnrollmentFee->set( (F32)gdatap->mMembershipFee );
+ }
+ }
+
+ if (can_change_ident || can_change_member_opts)
+ {
+ LLGroupMgr::getInstance()->sendUpdateGroupInfo(mGroupID);
+ }
+ }
+
+ BOOL receive_notices = false;
+ BOOL list_in_profile = false;
+ if (mCtrlReceiveNotices)
+ receive_notices = mCtrlReceiveNotices->get();
+ if (mCtrlListGroup)
+ list_in_profile = mCtrlListGroup->get();
+
+ gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);
+
+ resetDirty();
+
+ mChanged = FALSE;
+
+ return true;
}
void LLPanelGroupGeneral::cancel()
{
- mChanged = FALSE;
+ mChanged = FALSE;
- //cancel out all of the click changes to, although since we are
- //shifting tabs or closing the floater, this need not be done...yet
- notifyObservers();
+ //cancel out all of the click changes to, although since we are
+ //shifting tabs or closing the floater, this need not be done...yet
+ notifyObservers();
}
// invoked from callbackConfirmMature
bool LLPanelGroupGeneral::confirmMatureApply(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- // 0 == Yes
- // 1 == No
- // 2 == Cancel
- switch(option)
- {
- case 0:
- mComboMature->setCurrentByIndex(MATURE_CONTENT);
- break;
- case 1:
- mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
- break;
- default:
- return false;
- }
-
- // If we got here it means they set a valid value
- std::string mesg = "";
- bool ret = apply(mesg);
- if ( !mesg.empty() )
- {
- LLSD args;
- args["MESSAGE"] = mesg;
- LLNotificationsUtil::add("GenericAlert", args);
- }
-
- return ret;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ // 0 == Yes
+ // 1 == No
+ // 2 == Cancel
+ switch(option)
+ {
+ case 0:
+ mComboMature->setCurrentByIndex(MATURE_CONTENT);
+ break;
+ case 1:
+ mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
+ break;
+ default:
+ return false;
+ }
+
+ // If we got here it means they set a valid value
+ std::string mesg = "";
+ bool ret = apply(mesg);
+ if ( !mesg.empty() )
+ {
+ LLSD args;
+ args["MESSAGE"] = mesg;
+ LLNotificationsUtil::add("GenericAlert", args);
+ }
+
+ return ret;
}
// virtual
void LLPanelGroupGeneral::update(LLGroupChange gc)
{
- if (mGroupID.isNull()) return;
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
-
- if (!gdatap) return;
-
- LLGroupData agent_gdatap;
- bool is_member = false;
- if (gAgent.getGroupData(mGroupID,agent_gdatap)) is_member = true;
-
- if (mComboActiveTitle)
- {
- mComboActiveTitle->setVisible(is_member);
- mComboActiveTitle->setEnabled(mAllowEdit);
-
- if ( mActiveTitleLabel) mActiveTitleLabel->setVisible(is_member);
-
- if (is_member)
- {
- LLUUID current_title_role;
-
- mComboActiveTitle->clear();
- mComboActiveTitle->removeall();
- bool has_selected_title = false;
-
- if (1 == gdatap->mTitles.size())
- {
- // Only the everyone title. Don't bother letting them try changing this.
- mComboActiveTitle->setEnabled(FALSE);
- }
- else
- {
- mComboActiveTitle->setEnabled(TRUE);
- }
-
- std::vector<LLGroupTitle>::const_iterator citer = gdatap->mTitles.begin();
- std::vector<LLGroupTitle>::const_iterator end = gdatap->mTitles.end();
-
- for ( ; citer != end; ++citer)
- {
- mComboActiveTitle->add(citer->mTitle,citer->mRoleID, (citer->mSelected ? ADD_TOP : ADD_BOTTOM));
- if (citer->mSelected)
- {
- mComboActiveTitle->setCurrentByID(citer->mRoleID);
- has_selected_title = true;
- }
- }
-
- if (!has_selected_title)
- {
- mComboActiveTitle->setCurrentByID(LLUUID::null);
- }
- }
-
- }
-
- // After role member data was changed in Roles->Members
- // need to update role titles. See STORM-918.
- if (gc == GC_ROLE_MEMBER_DATA)
- LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID);
-
- // If this was just a titles update, we are done.
- if (gc == GC_TITLES) return;
-
- bool can_change_ident = false;
- bool can_change_member_opts = false;
- can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
- can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);
-
- if (mCtrlShowInGroupList)
- {
- mCtrlShowInGroupList->set(gdatap->mShowInList);
- mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident);
- }
- if (mComboMature)
- {
- if(gdatap->mMaturePublish)
- {
- mComboMature->setCurrentByIndex(MATURE_CONTENT);
- }
- else
- {
- mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
- }
- mComboMature->setEnabled(mAllowEdit && can_change_ident);
- mComboMature->setVisible( !gAgent.isTeen() );
- }
- if (mCtrlOpenEnrollment)
- {
- mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment);
- mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts);
- }
- if (mCtrlEnrollmentFee)
- {
- mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0);
- mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts);
- }
-
- if (mSpinEnrollmentFee)
- {
- S32 fee = gdatap->mMembershipFee;
- mSpinEnrollmentFee->set((F32)fee);
- mSpinEnrollmentFee->setEnabled( mAllowEdit &&
- (fee > 0) &&
- can_change_member_opts);
- }
- if (mCtrlReceiveNotices)
- {
- mCtrlReceiveNotices->setVisible(is_member);
- if (is_member)
- {
- mCtrlReceiveNotices->setEnabled(mAllowEdit);
- }
- }
-
-
- if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
- if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
-
- if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE);
- if (mFounderName) mFounderName->setText(LLSLURL("agent", gdatap->mFounderID, "inspect").getSLURLString());
- if (mInsignia)
- {
- if (gdatap->mInsigniaID.notNull())
- {
- mInsignia->setImageAssetID(gdatap->mInsigniaID);
- }
- else
- {
- mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
- }
- }
-
- if (mEditCharter)
- {
+ if (mGroupID.isNull()) return;
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+
+ if (!gdatap) return;
+
+ LLGroupData agent_gdatap;
+ bool is_member = false;
+ if (gAgent.getGroupData(mGroupID,agent_gdatap)) is_member = true;
+
+ if (mComboActiveTitle)
+ {
+ mComboActiveTitle->setVisible(is_member);
+ mComboActiveTitle->setEnabled(mAllowEdit);
+
+ if ( mActiveTitleLabel) mActiveTitleLabel->setVisible(is_member);
+
+ if (is_member)
+ {
+ LLUUID current_title_role;
+
+ mComboActiveTitle->clear();
+ mComboActiveTitle->removeall();
+ bool has_selected_title = false;
+
+ if (1 == gdatap->mTitles.size())
+ {
+ // Only the everyone title. Don't bother letting them try changing this.
+ mComboActiveTitle->setEnabled(FALSE);
+ }
+ else
+ {
+ mComboActiveTitle->setEnabled(TRUE);
+ }
+
+ std::vector<LLGroupTitle>::const_iterator citer = gdatap->mTitles.begin();
+ std::vector<LLGroupTitle>::const_iterator end = gdatap->mTitles.end();
+
+ for ( ; citer != end; ++citer)
+ {
+ mComboActiveTitle->add(citer->mTitle,citer->mRoleID, (citer->mSelected ? ADD_TOP : ADD_BOTTOM));
+ if (citer->mSelected)
+ {
+ mComboActiveTitle->setCurrentByID(citer->mRoleID);
+ has_selected_title = true;
+ }
+ }
+
+ if (!has_selected_title)
+ {
+ mComboActiveTitle->setCurrentByID(LLUUID::null);
+ }
+ }
+
+ }
+
+ // After role member data was changed in Roles->Members
+ // need to update role titles. See STORM-918.
+ if (gc == GC_ROLE_MEMBER_DATA)
+ LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID);
+
+ // If this was just a titles update, we are done.
+ if (gc == GC_TITLES) return;
+
+ bool can_change_ident = false;
+ bool can_change_member_opts = false;
+ can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
+ can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);
+
+ if (mCtrlShowInGroupList)
+ {
+ mCtrlShowInGroupList->set(gdatap->mShowInList);
+ mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident);
+ }
+ if (mComboMature)
+ {
+ if(gdatap->mMaturePublish)
+ {
+ mComboMature->setCurrentByIndex(MATURE_CONTENT);
+ }
+ else
+ {
+ mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
+ }
+ mComboMature->setEnabled(mAllowEdit && can_change_ident);
+ mComboMature->setVisible( !gAgent.isTeen() );
+ }
+ if (mCtrlOpenEnrollment)
+ {
+ mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment);
+ mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts);
+ }
+ if (mCtrlEnrollmentFee)
+ {
+ mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0);
+ mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts);
+ }
+
+ if (mSpinEnrollmentFee)
+ {
+ S32 fee = gdatap->mMembershipFee;
+ mSpinEnrollmentFee->set((F32)fee);
+ mSpinEnrollmentFee->setEnabled( mAllowEdit &&
+ (fee > 0) &&
+ can_change_member_opts);
+ }
+ if (mCtrlReceiveNotices)
+ {
+ mCtrlReceiveNotices->setVisible(is_member);
+ if (is_member)
+ {
+ mCtrlReceiveNotices->setEnabled(mAllowEdit);
+ }
+ }
+
+
+ if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
+ if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
+
+ if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE);
+ if (mFounderName) mFounderName->setText(LLSLURL("agent", gdatap->mFounderID, "inspect").getSLURLString());
+ if (mInsignia)
+ {
+ if (gdatap->mInsigniaID.notNull())
+ {
+ mInsignia->setImageAssetID(gdatap->mInsigniaID);
+ }
+ else
+ {
+ mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
+ }
+ }
+
+ if (mEditCharter)
+ {
mEditCharter->setParseURLs(!mAllowEdit || !can_change_ident);
mEditCharter->setText(gdatap->mCharter);
- }
-
- resetDirty();
+ }
+
+ resetDirty();
}
void LLPanelGroupGeneral::updateChanged()
{
- // List all the controls we want to check for changes...
- LLUICtrl *check_list[] =
- {
- mGroupNameEditor,
- mFounderName,
- mInsignia,
- mEditCharter,
- mCtrlShowInGroupList,
- mComboMature,
- mCtrlOpenEnrollment,
- mCtrlEnrollmentFee,
- mSpinEnrollmentFee,
- mCtrlReceiveNotices,
- mCtrlListGroup,
- mActiveTitleLabel,
- mComboActiveTitle
- };
-
- mChanged = FALSE;
-
- for( size_t i=0; i<LL_ARRAY_SIZE(check_list); i++ )
- {
- if( check_list[i] && check_list[i]->isDirty() )
- {
- mChanged = TRUE;
- break;
- }
- }
+ // List all the controls we want to check for changes...
+ LLUICtrl *check_list[] =
+ {
+ mGroupNameEditor,
+ mFounderName,
+ mInsignia,
+ mEditCharter,
+ mCtrlShowInGroupList,
+ mComboMature,
+ mCtrlOpenEnrollment,
+ mCtrlEnrollmentFee,
+ mSpinEnrollmentFee,
+ mCtrlReceiveNotices,
+ mCtrlListGroup,
+ mActiveTitleLabel,
+ mComboActiveTitle
+ };
+
+ mChanged = FALSE;
+
+ for( size_t i=0; i<LL_ARRAY_SIZE(check_list); i++ )
+ {
+ if( check_list[i] && check_list[i]->isDirty() )
+ {
+ mChanged = TRUE;
+ break;
+ }
+ }
}
void LLPanelGroupGeneral::reset()
{
- mFounderName->setVisible(false);
-
-
- mCtrlReceiveNotices->set(false);
-
-
- mCtrlListGroup->set(true);
-
- mCtrlReceiveNotices->setEnabled(false);
- mCtrlReceiveNotices->setVisible(true);
-
- mCtrlListGroup->setEnabled(false);
-
- mGroupNameEditor->setEnabled(TRUE);
- mEditCharter->setEnabled(TRUE);
-
- mCtrlShowInGroupList->setEnabled(false);
- mComboMature->setEnabled(TRUE);
-
- mCtrlOpenEnrollment->setEnabled(TRUE);
-
- mCtrlEnrollmentFee->setEnabled(TRUE);
-
- mSpinEnrollmentFee->setEnabled(TRUE);
- mSpinEnrollmentFee->set((F32)0);
-
- mGroupNameEditor->setVisible(true);
-
- mComboActiveTitle->setVisible(false);
-
- mInsignia->setImageAssetID(LLUUID::null);
-
- mInsignia->setEnabled(true);
-
- mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
-
- {
- std::string empty_str = "";
- mEditCharter->setText(empty_str);
- mGroupNameEditor->setText(empty_str);
- }
-
- {
- mComboMature->setEnabled(true);
- mComboMature->setVisible( !gAgent.isTeen() );
- mComboMature->selectFirstItem();
- }
-
-
- resetDirty();
+ mFounderName->setVisible(false);
+
+
+ mCtrlReceiveNotices->set(false);
+
+
+ mCtrlListGroup->set(true);
+
+ mCtrlReceiveNotices->setEnabled(false);
+ mCtrlReceiveNotices->setVisible(true);
+
+ mCtrlListGroup->setEnabled(false);
+
+ mGroupNameEditor->setEnabled(TRUE);
+ mEditCharter->setEnabled(TRUE);
+
+ mCtrlShowInGroupList->setEnabled(false);
+ mComboMature->setEnabled(TRUE);
+
+ mCtrlOpenEnrollment->setEnabled(TRUE);
+
+ mCtrlEnrollmentFee->setEnabled(TRUE);
+
+ mSpinEnrollmentFee->setEnabled(TRUE);
+ mSpinEnrollmentFee->set((F32)0);
+
+ mGroupNameEditor->setVisible(true);
+
+ mComboActiveTitle->setVisible(false);
+
+ mInsignia->setImageAssetID(LLUUID::null);
+
+ mInsignia->setEnabled(true);
+
+ mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
+
+ {
+ std::string empty_str = "";
+ mEditCharter->setText(empty_str);
+ mGroupNameEditor->setText(empty_str);
+ }
+
+ {
+ mComboMature->setEnabled(true);
+ mComboMature->setVisible( !gAgent.isTeen() );
+ mComboMature->selectFirstItem();
+ }
+
+
+ resetDirty();
}
-void LLPanelGroupGeneral::resetDirty()
+void LLPanelGroupGeneral::resetDirty()
{
- // List all the controls we want to check for changes...
- LLUICtrl *check_list[] =
- {
- mGroupNameEditor,
- mFounderName,
- mInsignia,
- mEditCharter,
- mCtrlShowInGroupList,
- mComboMature,
- mCtrlOpenEnrollment,
- mCtrlEnrollmentFee,
- mSpinEnrollmentFee,
- mCtrlReceiveNotices,
- mCtrlListGroup,
- mActiveTitleLabel,
- mComboActiveTitle
- };
-
- for( size_t i=0; i<LL_ARRAY_SIZE(check_list); i++ )
- {
- if( check_list[i] )
- check_list[i]->resetDirty() ;
- }
+ // List all the controls we want to check for changes...
+ LLUICtrl *check_list[] =
+ {
+ mGroupNameEditor,
+ mFounderName,
+ mInsignia,
+ mEditCharter,
+ mCtrlShowInGroupList,
+ mComboMature,
+ mCtrlOpenEnrollment,
+ mCtrlEnrollmentFee,
+ mSpinEnrollmentFee,
+ mCtrlReceiveNotices,
+ mCtrlListGroup,
+ mActiveTitleLabel,
+ mComboActiveTitle
+ };
+
+ for( size_t i=0; i<LL_ARRAY_SIZE(check_list); i++ )
+ {
+ if( check_list[i] )
+ check_list[i]->resetDirty() ;
+ }
}
void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
{
- LLPanelGroupTab::setGroupID(id);
-
- if(id == LLUUID::null)
- {
- reset();
- return;
- }
-
- BOOL accept_notices = FALSE;
- BOOL list_in_profile = FALSE;
- LLGroupData data;
- if(gAgent.getGroupData(mGroupID,data))
- {
- accept_notices = data.mAcceptNotices;
- list_in_profile = data.mListInProfile;
- }
- mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices");
- if (mCtrlReceiveNotices)
- {
- mCtrlReceiveNotices->set(accept_notices);
- mCtrlReceiveNotices->setEnabled(data.mID.notNull());
- }
-
- mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile");
- if (mCtrlListGroup)
- {
- mCtrlListGroup->set(list_in_profile);
- mCtrlListGroup->setEnabled(data.mID.notNull());
- }
-
- mCtrlShowInGroupList->setEnabled(data.mID.notNull());
-
- mActiveTitleLabel = getChild<LLTextBox>("active_title_label");
-
- mComboActiveTitle = getChild<LLComboBox>("active_title");
-
- mFounderName->setVisible(true);
-
- mInsignia->setImageAssetID(LLUUID::null);
-
- resetDirty();
-
- activate();
+ LLPanelGroupTab::setGroupID(id);
+
+ if(id == LLUUID::null)
+ {
+ reset();
+ return;
+ }
+
+ BOOL accept_notices = FALSE;
+ BOOL list_in_profile = FALSE;
+ LLGroupData data;
+ if(gAgent.getGroupData(mGroupID,data))
+ {
+ accept_notices = data.mAcceptNotices;
+ list_in_profile = data.mListInProfile;
+ }
+ mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices");
+ if (mCtrlReceiveNotices)
+ {
+ mCtrlReceiveNotices->set(accept_notices);
+ mCtrlReceiveNotices->setEnabled(data.mID.notNull());
+ }
+
+ mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile");
+ if (mCtrlListGroup)
+ {
+ mCtrlListGroup->set(list_in_profile);
+ mCtrlListGroup->setEnabled(data.mID.notNull());
+ }
+
+ mCtrlShowInGroupList->setEnabled(data.mID.notNull());
+
+ mActiveTitleLabel = getChild<LLTextBox>("active_title_label");
+
+ mComboActiveTitle = getChild<LLComboBox>("active_title");
+
+ mFounderName->setVisible(true);
+
+ mInsignia->setImageAssetID(LLUUID::null);
+
+ resetDirty();
+
+ activate();
}
diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h
index 1d0789521c..487d6501a7 100644
--- a/indra/newview/llpanelgroupgeneral.h
+++ b/indra/newview/llpanelgroupgeneral.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelgroupgeneral.h
* @brief General information about a group.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,61 +43,61 @@ class LLAvatarName;
class LLPanelGroupGeneral : public LLPanelGroupTab
{
public:
- LLPanelGroupGeneral();
- virtual ~LLPanelGroupGeneral();
-
- // LLPanelGroupTab
- virtual void activate();
- virtual bool needsApply(std::string& mesg);
- virtual bool apply(std::string& mesg);
- virtual void cancel();
-
- virtual void update(LLGroupChange gc);
-
- virtual BOOL postBuild();
-
- virtual void draw();
-
- virtual void setGroupID(const LLUUID& id);
-
- virtual void setupCtrls (LLPanel* parent);
+ LLPanelGroupGeneral();
+ virtual ~LLPanelGroupGeneral();
+
+ // LLPanelGroupTab
+ virtual void activate();
+ virtual bool needsApply(std::string& mesg);
+ virtual bool apply(std::string& mesg);
+ virtual void cancel();
+
+ virtual void update(LLGroupChange gc);
+
+ virtual BOOL postBuild();
+
+ virtual void draw();
+
+ virtual void setGroupID(const LLUUID& id);
+
+ virtual void setupCtrls (LLPanel* parent);
private:
- void reset();
+ void reset();
- void resetDirty();
+ void resetDirty();
- static void onFocusEdit(LLFocusableElement* ctrl, void* data);
- static void onCommitAny(LLUICtrl* ctrl, void* data);
- static void onCommitUserOnly(LLUICtrl* ctrl, void* data);
- static void onCommitEnrollment(LLUICtrl* ctrl, void* data);
- static void onClickInfo(void* userdata);
- static void onReceiveNotices(LLUICtrl* ctrl, void* data);
+ static void onFocusEdit(LLFocusableElement* ctrl, void* data);
+ static void onCommitAny(LLUICtrl* ctrl, void* data);
+ static void onCommitUserOnly(LLUICtrl* ctrl, void* data);
+ static void onCommitEnrollment(LLUICtrl* ctrl, void* data);
+ static void onClickInfo(void* userdata);
+ static void onReceiveNotices(LLUICtrl* ctrl, void* data);
static bool joinDlgCB(const LLSD& notification, const LLSD& response);
- void updateChanged();
- bool confirmMatureApply(const LLSD& notification, const LLSD& response);
-
- BOOL mChanged;
- BOOL mFirstUse;
- std::string mIncompleteMemberDataStr;
-
- // Group information (include any updates in updateChanged)
- LLLineEditor *mGroupNameEditor;
- LLTextBox *mFounderName;
- LLTextureCtrl *mInsignia;
- LLTextEditor *mEditCharter;
-
- // Options (include any updates in updateChanged)
- LLCheckBoxCtrl *mCtrlShowInGroupList;
- LLCheckBoxCtrl *mCtrlOpenEnrollment;
- LLCheckBoxCtrl *mCtrlEnrollmentFee;
- LLSpinCtrl *mSpinEnrollmentFee;
- LLCheckBoxCtrl *mCtrlReceiveNotices;
- LLCheckBoxCtrl *mCtrlListGroup;
- LLTextBox *mActiveTitleLabel;
- LLComboBox *mComboActiveTitle;
- LLComboBox *mComboMature;
+ void updateChanged();
+ bool confirmMatureApply(const LLSD& notification, const LLSD& response);
+
+ BOOL mChanged;
+ BOOL mFirstUse;
+ std::string mIncompleteMemberDataStr;
+
+ // Group information (include any updates in updateChanged)
+ LLLineEditor *mGroupNameEditor;
+ LLTextBox *mFounderName;
+ LLTextureCtrl *mInsignia;
+ LLTextEditor *mEditCharter;
+
+ // Options (include any updates in updateChanged)
+ LLCheckBoxCtrl *mCtrlShowInGroupList;
+ LLCheckBoxCtrl *mCtrlOpenEnrollment;
+ LLCheckBoxCtrl *mCtrlEnrollmentFee;
+ LLSpinCtrl *mSpinEnrollmentFee;
+ LLCheckBoxCtrl *mCtrlReceiveNotices;
+ LLCheckBoxCtrl *mCtrlListGroup;
+ LLTextBox *mActiveTitleLabel;
+ LLComboBox *mComboActiveTitle;
+ LLComboBox *mComboMature;
};
#endif
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index d6b66ee622..5327e21571 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llpanelgroupinvite.cpp
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,570 +48,570 @@
class LLPanelGroupInvite::impl
{
public:
- impl(const LLUUID& group_id);
- ~impl();
-
- void addUsers(const std::vector<std::string>& names,
- const uuid_vec_t& agent_ids);
- void submitInvitations();
- void addRoleNames(LLGroupMgrGroupData* gdatap);
- void handleRemove();
- void handleSelection();
-
- static void callbackClickCancel(void* userdata);
- static void callbackClickOK(void* userdata);
- static void callbackClickAdd(void* userdata);
- static void callbackClickRemove(void* userdata);
- static void callbackSelect(LLUICtrl* ctrl, void* userdata);
- static void callbackAddUsers(const uuid_vec_t& agent_ids,
- void* user_data);
-
- static void onAvatarNameCache(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- void* user_data);
-
- bool inviteOwnerCallback(const LLSD& notification, const LLSD& response);
+ impl(const LLUUID& group_id);
+ ~impl();
+
+ void addUsers(const std::vector<std::string>& names,
+ const uuid_vec_t& agent_ids);
+ void submitInvitations();
+ void addRoleNames(LLGroupMgrGroupData* gdatap);
+ void handleRemove();
+ void handleSelection();
+
+ static void callbackClickCancel(void* userdata);
+ static void callbackClickOK(void* userdata);
+ static void callbackClickAdd(void* userdata);
+ static void callbackClickRemove(void* userdata);
+ static void callbackSelect(LLUICtrl* ctrl, void* userdata);
+ static void callbackAddUsers(const uuid_vec_t& agent_ids,
+ void* user_data);
+
+ static void onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name,
+ void* user_data);
+
+ bool inviteOwnerCallback(const LLSD& notification, const LLSD& response);
public:
- LLUUID mGroupID;
+ LLUUID mGroupID;
- std::string mLoadingText;
- LLNameListCtrl *mInvitees;
- LLComboBox *mRoleNames;
- LLButton *mOKButton;
- LLButton *mRemoveButton;
- LLTextBox *mGroupName;
- std::string mOwnerWarning;
- std::string mAlreadyInGroup;
- std::string mTooManySelected;
- bool mConfirmedOwnerInvite;
- std::set<LLUUID> mInviteeIDs;
+ std::string mLoadingText;
+ LLNameListCtrl *mInvitees;
+ LLComboBox *mRoleNames;
+ LLButton *mOKButton;
+ LLButton *mRemoveButton;
+ LLTextBox *mGroupName;
+ std::string mOwnerWarning;
+ std::string mAlreadyInGroup;
+ std::string mTooManySelected;
+ bool mConfirmedOwnerInvite;
+ std::set<LLUUID> mInviteeIDs;
- void (*mCloseCallback)(void* data);
+ void (*mCloseCallback)(void* data);
- void* mCloseCallbackUserData;
+ void* mCloseCallbackUserData;
- boost::signals2::connection mAvatarNameCacheConnection;
+ boost::signals2::connection mAvatarNameCacheConnection;
};
LLPanelGroupInvite::impl::impl(const LLUUID& group_id):
- mGroupID( group_id ),
- mLoadingText (),
- mInvitees ( NULL ),
- mRoleNames( NULL ),
- mOKButton ( NULL ),
- mRemoveButton( NULL ),
- mGroupName( NULL ),
- mConfirmedOwnerInvite( false ),
- mCloseCallback( NULL ),
- mCloseCallbackUserData( NULL ),
- mAvatarNameCacheConnection()
+ mGroupID( group_id ),
+ mLoadingText (),
+ mInvitees ( NULL ),
+ mRoleNames( NULL ),
+ mOKButton ( NULL ),
+ mRemoveButton( NULL ),
+ mGroupName( NULL ),
+ mConfirmedOwnerInvite( false ),
+ mCloseCallback( NULL ),
+ mCloseCallbackUserData( NULL ),
+ mAvatarNameCacheConnection()
{
}
LLPanelGroupInvite::impl::~impl()
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
}
const S32 MAX_GROUP_INVITES = 100; // Max invites per request. 100 to match server cap.
void LLPanelGroupInvite::impl::addUsers(const std::vector<std::string>& names,
- const uuid_vec_t& agent_ids)
+ const uuid_vec_t& agent_ids)
{
- std::string name;
- LLUUID id;
-
- if (names.size() + mInviteeIDs.size() > MAX_GROUP_INVITES)
- {
- // Fail! Show a warning and don't add any names.
- LLSD msg;
- msg["MESSAGE"] = mTooManySelected;
- LLNotificationsUtil::add("GenericAlert", msg);
- return;
- }
-
- for (S32 i = 0; i < (S32)names.size(); i++)
- {
- name = names[i];
- id = agent_ids[i];
-
- // Make sure this agent isn't already in the list.
- if (mInviteeIDs.find(id) != mInviteeIDs.end())
- {
- continue;
- }
-
- //add the name to the names list
- LLSD row;
- row["id"] = id;
- row["columns"][0]["value"] = name;
-
- mInvitees->addElement(row);
- mInviteeIDs.insert(id);
- }
+ std::string name;
+ LLUUID id;
+
+ if (names.size() + mInviteeIDs.size() > MAX_GROUP_INVITES)
+ {
+ // Fail! Show a warning and don't add any names.
+ LLSD msg;
+ msg["MESSAGE"] = mTooManySelected;
+ LLNotificationsUtil::add("GenericAlert", msg);
+ return;
+ }
+
+ for (S32 i = 0; i < (S32)names.size(); i++)
+ {
+ name = names[i];
+ id = agent_ids[i];
+
+ // Make sure this agent isn't already in the list.
+ if (mInviteeIDs.find(id) != mInviteeIDs.end())
+ {
+ continue;
+ }
+
+ //add the name to the names list
+ LLSD row;
+ row["id"] = id;
+ row["columns"][0]["value"] = name;
+
+ mInvitees->addElement(row);
+ mInviteeIDs.insert(id);
+ }
}
void LLPanelGroupInvite::impl::submitInvitations()
{
- std::map<LLUUID, LLUUID> role_member_pairs;
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
-
- // Default to everyone role.
- LLUUID role_id = LLUUID::null;
-
- if (mRoleNames)
- {
- role_id = mRoleNames->getCurrentID();
-
- // owner role: display confirmation and wait for callback
- if ((role_id == gdatap->mOwnerRole) && (!mConfirmedOwnerInvite))
- {
- LLSD args;
- args["MESSAGE"] = mOwnerWarning;
- LLNotificationsUtil::add("GenericAlertYesCancel", args, LLSD(), boost::bind(&LLPanelGroupInvite::impl::inviteOwnerCallback, this, _1, _2));
- return; // we'll be called again if user confirms
- }
- }
-
- bool already_in_group = false;
- //loop over the users
- std::vector<LLScrollListItem*> items = mInvitees->getAllData();
- for (std::vector<LLScrollListItem*>::iterator iter = items.begin();
- iter != items.end(); ++iter)
- {
- LLScrollListItem* item = *iter;
- if(LLGroupActions::isAvatarMemberOfGroup(mGroupID, item->getUUID()))
- {
- already_in_group = true;
- continue;
- }
- role_member_pairs[item->getUUID()] = role_id;
- }
-
- if (role_member_pairs.size() > MAX_GROUP_INVITES)
- {
- // Fail!
- LLSD msg;
- msg["MESSAGE"] = mTooManySelected;
- LLNotificationsUtil::add("GenericAlert", msg);
- (*mCloseCallback)(mCloseCallbackUserData);
- return;
- }
-
- LLGroupMgr::getInstance()->sendGroupMemberInvites(mGroupID, role_member_pairs);
-
- if(already_in_group)
- {
- LLSD msg;
- msg["MESSAGE"] = mAlreadyInGroup;
- LLNotificationsUtil::add("GenericAlert", msg);
- }
-
- //then close
- (*mCloseCallback)(mCloseCallbackUserData);
+ std::map<LLUUID, LLUUID> role_member_pairs;
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+
+ // Default to everyone role.
+ LLUUID role_id = LLUUID::null;
+
+ if (mRoleNames)
+ {
+ role_id = mRoleNames->getCurrentID();
+
+ // owner role: display confirmation and wait for callback
+ if ((role_id == gdatap->mOwnerRole) && (!mConfirmedOwnerInvite))
+ {
+ LLSD args;
+ args["MESSAGE"] = mOwnerWarning;
+ LLNotificationsUtil::add("GenericAlertYesCancel", args, LLSD(), boost::bind(&LLPanelGroupInvite::impl::inviteOwnerCallback, this, _1, _2));
+ return; // we'll be called again if user confirms
+ }
+ }
+
+ bool already_in_group = false;
+ //loop over the users
+ std::vector<LLScrollListItem*> items = mInvitees->getAllData();
+ for (std::vector<LLScrollListItem*>::iterator iter = items.begin();
+ iter != items.end(); ++iter)
+ {
+ LLScrollListItem* item = *iter;
+ if(LLGroupActions::isAvatarMemberOfGroup(mGroupID, item->getUUID()))
+ {
+ already_in_group = true;
+ continue;
+ }
+ role_member_pairs[item->getUUID()] = role_id;
+ }
+
+ if (role_member_pairs.size() > MAX_GROUP_INVITES)
+ {
+ // Fail!
+ LLSD msg;
+ msg["MESSAGE"] = mTooManySelected;
+ LLNotificationsUtil::add("GenericAlert", msg);
+ (*mCloseCallback)(mCloseCallbackUserData);
+ return;
+ }
+
+ LLGroupMgr::getInstance()->sendGroupMemberInvites(mGroupID, role_member_pairs);
+
+ if(already_in_group)
+ {
+ LLSD msg;
+ msg["MESSAGE"] = mAlreadyInGroup;
+ LLNotificationsUtil::add("GenericAlert", msg);
+ }
+
+ //then close
+ (*mCloseCallback)(mCloseCallbackUserData);
}
bool LLPanelGroupInvite::impl::inviteOwnerCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- switch(option)
- {
- case 0:
- // user confirmed that they really want a new group owner
- mConfirmedOwnerInvite = true;
- submitInvitations();
- break;
- case 1:
- // fall through
- default:
- break;
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ switch(option)
+ {
+ case 0:
+ // user confirmed that they really want a new group owner
+ mConfirmedOwnerInvite = true;
+ submitInvitations();
+ break;
+ case 1:
+ // fall through
+ default:
+ break;
+ }
+ return false;
}
void LLPanelGroupInvite::impl::addRoleNames(LLGroupMgrGroupData* gdatap)
{
- LLGroupMgrGroupData::member_list_t::iterator agent_iter =
- gdatap->mMembers.find(gAgent.getID());
-
- //loop over the agent's roles in the group
- //then add those roles to the list of roles that the agent
- //can invite people to be.
- //if the user is the owner then we add
- //all of the roles in the group,
- //else if they have the add to roles power
- //we add every role but owner,
- //else if they have the limited add to roles power
- //we add every role the user is in,
- //else we just add to everyone
- bool is_owner = FALSE;
- bool can_assign_any = gAgent.hasPowerInGroup(mGroupID,
- GP_ROLE_ASSIGN_MEMBER);
- bool can_assign_limited = gAgent.hasPowerInGroup(mGroupID,
- GP_ROLE_ASSIGN_MEMBER_LIMITED);
- LLGroupMemberData* member_data = NULL;
- //get the member data for the agent if it exists
- if (agent_iter != gdatap->mMembers.end())
- {
- member_data = (*agent_iter).second;
- if (member_data && mRoleNames)
- {
- is_owner = member_data->isOwner();
- }//end if member data is not null
- }//end if agent is in the group
-
-
-
- LLGroupMgrGroupData::role_list_t::iterator rit = gdatap->mRoles.begin();
- LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end();
-
- //populate the role list:
- for ( ; rit != end; ++rit)
- {
- LLUUID role_id = (*rit).first;
- LLRoleData rd;
- if ( gdatap->getRoleData(role_id,rd) )
- {
- // Owners can add any role.
- if ( is_owner
- // Even 'can_assign_any' can't add owner role.
- || (can_assign_any && role_id != gdatap->mOwnerRole)
- // Add all roles user is in
- || (can_assign_limited && member_data && member_data->isInRole(role_id))
- // Everyone role.
- || role_id == LLUUID::null )
- {
- mRoleNames->add(rd.mRoleName,
- role_id,
- ADD_BOTTOM);
- }
- }
- }
+ LLGroupMgrGroupData::member_list_t::iterator agent_iter =
+ gdatap->mMembers.find(gAgent.getID());
+
+ //loop over the agent's roles in the group
+ //then add those roles to the list of roles that the agent
+ //can invite people to be.
+ //if the user is the owner then we add
+ //all of the roles in the group,
+ //else if they have the add to roles power
+ //we add every role but owner,
+ //else if they have the limited add to roles power
+ //we add every role the user is in,
+ //else we just add to everyone
+ bool is_owner = FALSE;
+ bool can_assign_any = gAgent.hasPowerInGroup(mGroupID,
+ GP_ROLE_ASSIGN_MEMBER);
+ bool can_assign_limited = gAgent.hasPowerInGroup(mGroupID,
+ GP_ROLE_ASSIGN_MEMBER_LIMITED);
+ LLGroupMemberData* member_data = NULL;
+ //get the member data for the agent if it exists
+ if (agent_iter != gdatap->mMembers.end())
+ {
+ member_data = (*agent_iter).second;
+ if (member_data && mRoleNames)
+ {
+ is_owner = member_data->isOwner();
+ }//end if member data is not null
+ }//end if agent is in the group
+
+
+
+ LLGroupMgrGroupData::role_list_t::iterator rit = gdatap->mRoles.begin();
+ LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end();
+
+ //populate the role list:
+ for ( ; rit != end; ++rit)
+ {
+ LLUUID role_id = (*rit).first;
+ LLRoleData rd;
+ if ( gdatap->getRoleData(role_id,rd) )
+ {
+ // Owners can add any role.
+ if ( is_owner
+ // Even 'can_assign_any' can't add owner role.
+ || (can_assign_any && role_id != gdatap->mOwnerRole)
+ // Add all roles user is in
+ || (can_assign_limited && member_data && member_data->isInRole(role_id))
+ // Everyone role.
+ || role_id == LLUUID::null )
+ {
+ mRoleNames->add(rd.mRoleName,
+ role_id,
+ ADD_BOTTOM);
+ }
+ }
+ }
}
//static
void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata)
{
- LLPanelGroupInvite* panelp = (LLPanelGroupInvite*) userdata;
-
- if ( panelp )
- {
- //Right now this is hard coded with some knowledge that it is part
- //of a floater since the avatar picker needs to be added as a dependent
- //floater to the parent floater.
- //Soon the avatar picker will be embedded into this panel
- //instead of being it's own separate floater. But that is next week.
- //This will do for now. -jwolk May 10, 2006
+ LLPanelGroupInvite* panelp = (LLPanelGroupInvite*) userdata;
+
+ if ( panelp )
+ {
+ //Right now this is hard coded with some knowledge that it is part
+ //of a floater since the avatar picker needs to be added as a dependent
+ //floater to the parent floater.
+ //Soon the avatar picker will be embedded into this panel
+ //instead of being it's own separate floater. But that is next week.
+ //This will do for now. -jwolk May 10, 2006
LLView * button = panelp->findChild<LLButton>("add_button");
LLFloater * root_floater = gFloaterView->getParentFloater(panelp);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
- boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button);
- if (picker)
- {
- root_floater->addDependentFloater(picker);
- }
- }
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+ boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button);
+ if (picker)
+ {
+ root_floater->addDependentFloater(picker);
+ }
+ }
}
//static
void LLPanelGroupInvite::impl::callbackClickRemove(void* userdata)
{
- impl* selfp = (impl*) userdata;
+ impl* selfp = (impl*) userdata;
- if ( selfp ) selfp->handleRemove();
+ if ( selfp ) selfp->handleRemove();
}
void LLPanelGroupInvite::impl::handleRemove()
{
- // Check if there is anything selected.
- std::vector<LLScrollListItem*> selection =
- mInvitees->getAllSelected();
- if (selection.empty()) return;
-
- std::vector<LLScrollListItem*>::iterator iter;
- for(iter = selection.begin(); iter != selection.end(); ++iter)
- {
- mInviteeIDs.erase( (*iter)->getUUID() );
- }
-
- // Remove all selected invitees.
- mInvitees->deleteSelectedItems();
- mRemoveButton->setEnabled(FALSE);
+ // Check if there is anything selected.
+ std::vector<LLScrollListItem*> selection =
+ mInvitees->getAllSelected();
+ if (selection.empty()) return;
+
+ std::vector<LLScrollListItem*>::iterator iter;
+ for(iter = selection.begin(); iter != selection.end(); ++iter)
+ {
+ mInviteeIDs.erase( (*iter)->getUUID() );
+ }
+
+ // Remove all selected invitees.
+ mInvitees->deleteSelectedItems();
+ mRemoveButton->setEnabled(FALSE);
}
// static
void LLPanelGroupInvite::impl::callbackSelect(
- LLUICtrl* ctrl, void* userdata)
+ LLUICtrl* ctrl, void* userdata)
{
- impl* selfp = (impl*) userdata;
- if ( selfp ) selfp->handleSelection();
+ impl* selfp = (impl*) userdata;
+ if ( selfp ) selfp->handleSelection();
}
void LLPanelGroupInvite::impl::handleSelection()
{
- // Check if there is anything selected.
- std::vector<LLScrollListItem*> selection =
- mInvitees->getAllSelected();
- if (selection.empty())
- {
- mRemoveButton->setEnabled(FALSE);
- }
- else
- {
- mRemoveButton->setEnabled(TRUE);
- }
+ // Check if there is anything selected.
+ std::vector<LLScrollListItem*> selection =
+ mInvitees->getAllSelected();
+ if (selection.empty())
+ {
+ mRemoveButton->setEnabled(FALSE);
+ }
+ else
+ {
+ mRemoveButton->setEnabled(TRUE);
+ }
}
void LLPanelGroupInvite::impl::callbackClickCancel(void* userdata)
{
- impl* selfp = (impl*) userdata;
+ impl* selfp = (impl*) userdata;
- if ( selfp )
- {
- (*(selfp->mCloseCallback))(selfp->mCloseCallbackUserData);
- }
+ if ( selfp )
+ {
+ (*(selfp->mCloseCallback))(selfp->mCloseCallbackUserData);
+ }
}
void LLPanelGroupInvite::impl::callbackClickOK(void* userdata)
{
- impl* selfp = (impl*) userdata;
+ impl* selfp = (impl*) userdata;
- if ( selfp ) selfp->submitInvitations();
+ if ( selfp ) selfp->submitInvitations();
}
//static
void LLPanelGroupInvite::impl::callbackAddUsers(const uuid_vec_t& agent_ids, void* user_data)
-{
- std::vector<std::string> names;
- for (S32 i = 0; i < (S32)agent_ids.size(); i++)
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(agent_ids[i], &av_name))
- {
- LLPanelGroupInvite::impl::onAvatarNameCache(agent_ids[i], av_name, user_data);
- }
- else
- {
- impl* selfp = (impl*) user_data;
- if (selfp)
- {
- if (selfp->mAvatarNameCacheConnection.connected())
- {
- selfp->mAvatarNameCacheConnection.disconnect();
- }
- // *TODO : Add a callback per avatar name being fetched.
- selfp->mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_ids[i],boost::bind(&LLPanelGroupInvite::impl::onAvatarNameCache, _1, _2, user_data));
- }
- }
- }
-
+{
+ std::vector<std::string> names;
+ for (S32 i = 0; i < (S32)agent_ids.size(); i++)
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(agent_ids[i], &av_name))
+ {
+ LLPanelGroupInvite::impl::onAvatarNameCache(agent_ids[i], av_name, user_data);
+ }
+ else
+ {
+ impl* selfp = (impl*) user_data;
+ if (selfp)
+ {
+ if (selfp->mAvatarNameCacheConnection.connected())
+ {
+ selfp->mAvatarNameCacheConnection.disconnect();
+ }
+ // *TODO : Add a callback per avatar name being fetched.
+ selfp->mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_ids[i],boost::bind(&LLPanelGroupInvite::impl::onAvatarNameCache, _1, _2, user_data));
+ }
+ }
+ }
+
}
void LLPanelGroupInvite::impl::onAvatarNameCache(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- void* user_data)
+ const LLAvatarName& av_name,
+ void* user_data)
{
- impl* selfp = (impl*) user_data;
-
- if (selfp)
- {
- if (selfp->mAvatarNameCacheConnection.connected())
- {
- selfp->mAvatarNameCacheConnection.disconnect();
- }
- std::vector<std::string> names;
- uuid_vec_t agent_ids;
- agent_ids.push_back(agent_id);
- names.push_back(av_name.getCompleteName());
-
- selfp->addUsers(names, agent_ids);
- }
+ impl* selfp = (impl*) user_data;
+
+ if (selfp)
+ {
+ if (selfp->mAvatarNameCacheConnection.connected())
+ {
+ selfp->mAvatarNameCacheConnection.disconnect();
+ }
+ std::vector<std::string> names;
+ uuid_vec_t agent_ids;
+ agent_ids.push_back(agent_id);
+ names.push_back(av_name.getCompleteName());
+
+ selfp->addUsers(names, agent_ids);
+ }
}
LLPanelGroupInvite::LLPanelGroupInvite(const LLUUID& group_id)
- : LLPanel(),
- mImplementation(new impl(group_id)),
- mPendingUpdate(FALSE)
+ : LLPanel(),
+ mImplementation(new impl(group_id)),
+ mPendingUpdate(FALSE)
{
- // Pass on construction of this panel to the control factory.
- buildFromFile( "panel_group_invite.xml");
+ // Pass on construction of this panel to the control factory.
+ buildFromFile( "panel_group_invite.xml");
}
LLPanelGroupInvite::~LLPanelGroupInvite()
{
- delete mImplementation;
+ delete mImplementation;
}
void LLPanelGroupInvite::setCloseCallback(void (*close_callback)(void*),
- void* data)
+ void* data)
{
- mImplementation->mCloseCallback = close_callback;
- mImplementation->mCloseCallbackUserData = data;
+ mImplementation->mCloseCallback = close_callback;
+ mImplementation->mCloseCallbackUserData = data;
}
void LLPanelGroupInvite::clear()
{
- mStoreSelected = LLUUID::null;
- mImplementation->mInvitees->deleteAllItems();
- mImplementation->mRoleNames->clear();
- mImplementation->mRoleNames->removeall();
- mImplementation->mOKButton->setEnabled(FALSE);
- mImplementation->mInviteeIDs.clear();
+ mStoreSelected = LLUUID::null;
+ mImplementation->mInvitees->deleteAllItems();
+ mImplementation->mRoleNames->clear();
+ mImplementation->mRoleNames->removeall();
+ mImplementation->mOKButton->setEnabled(FALSE);
+ mImplementation->mInviteeIDs.clear();
}
void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
{
- std::vector<std::string> names;
- for (S32 i = 0; i < (S32)agent_ids.size(); i++)
- {
- std::string fullname;
- LLUUID agent_id = agent_ids[i];
- LLViewerObject* dest = gObjectList.findObject(agent_id);
- if(dest && dest->isAvatar())
- {
- LLNameValue* nvfirst = dest->getNVPair("FirstName");
- LLNameValue* nvlast = dest->getNVPair("LastName");
- if(nvfirst && nvlast)
- {
- fullname = LLCacheName::buildFullName(
- nvfirst->getString(), nvlast->getString());
-
- }
- if (!fullname.empty())
- {
- names.push_back(fullname);
- }
- else
- {
- LL_WARNS() << "llPanelGroupInvite: Selected avatar has no name: " << dest->getID() << LL_ENDL;
- names.push_back("(Unknown)");
- }
- }
- else
- {
- //looks like user try to invite offline avatar (or the avatar from the other region)
- //for offline avatar_id gObjectList.findObject() will return null
- //so we need to do this additional search in avatar tracker, see EXT-4732
- LLAvatarName av_name;
- if (!LLAvatarNameCache::get(agent_id, &av_name))
- {
- // actually it should happen, just in case
- //LLAvatarNameCache::get(LLUUID(agent_id), boost::bind(&LLPanelGroupInvite::addUserCallback, this, _1, _2));
- // for this special case!
- //when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence
- // removed id will be added in callback
- agent_ids.erase(agent_ids.begin() + i);
- }
- else
- {
- names.push_back(av_name.getAccountName());
- }
- }
- }
- mImplementation->addUsers(names, agent_ids);
+ std::vector<std::string> names;
+ for (S32 i = 0; i < (S32)agent_ids.size(); i++)
+ {
+ std::string fullname;
+ LLUUID agent_id = agent_ids[i];
+ LLViewerObject* dest = gObjectList.findObject(agent_id);
+ if(dest && dest->isAvatar())
+ {
+ LLNameValue* nvfirst = dest->getNVPair("FirstName");
+ LLNameValue* nvlast = dest->getNVPair("LastName");
+ if(nvfirst && nvlast)
+ {
+ fullname = LLCacheName::buildFullName(
+ nvfirst->getString(), nvlast->getString());
+
+ }
+ if (!fullname.empty())
+ {
+ names.push_back(fullname);
+ }
+ else
+ {
+ LL_WARNS() << "llPanelGroupInvite: Selected avatar has no name: " << dest->getID() << LL_ENDL;
+ names.push_back("(Unknown)");
+ }
+ }
+ else
+ {
+ //looks like user try to invite offline avatar (or the avatar from the other region)
+ //for offline avatar_id gObjectList.findObject() will return null
+ //so we need to do this additional search in avatar tracker, see EXT-4732
+ LLAvatarName av_name;
+ if (!LLAvatarNameCache::get(agent_id, &av_name))
+ {
+ // actually it should happen, just in case
+ //LLAvatarNameCache::get(LLUUID(agent_id), boost::bind(&LLPanelGroupInvite::addUserCallback, this, _1, _2));
+ // for this special case!
+ //when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence
+ // removed id will be added in callback
+ agent_ids.erase(agent_ids.begin() + i);
+ }
+ else
+ {
+ names.push_back(av_name.getAccountName());
+ }
+ }
+ }
+ mImplementation->addUsers(names, agent_ids);
}
void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const LLAvatarName& av_name)
{
- std::vector<std::string> names;
- uuid_vec_t agent_ids;
- agent_ids.push_back(id);
- names.push_back(av_name.getAccountName());
+ std::vector<std::string> names;
+ uuid_vec_t agent_ids;
+ agent_ids.push_back(id);
+ names.push_back(av_name.getAccountName());
- mImplementation->addUsers(names, agent_ids);
+ mImplementation->addUsers(names, agent_ids);
}
void LLPanelGroupInvite::draw()
{
- LLPanel::draw();
- if (mPendingUpdate)
- {
- updateLists();
- }
+ LLPanel::draw();
+ if (mPendingUpdate)
+ {
+ updateLists();
+ }
}
-
+
void LLPanelGroupInvite::update()
{
- mPendingUpdate = FALSE;
- if (mImplementation->mGroupName)
- {
- mImplementation->mGroupName->setText(mImplementation->mLoadingText);
- }
- if ( mImplementation->mRoleNames )
- {
- mStoreSelected = mImplementation->mRoleNames->getCurrentID();
- mImplementation->mRoleNames->clear();
- mImplementation->mRoleNames->removeall();
- mImplementation->mRoleNames->add(mImplementation->mLoadingText, LLUUID::null, ADD_BOTTOM);
- mImplementation->mRoleNames->setCurrentByID(LLUUID::null);
- }
-
- updateLists();
+ mPendingUpdate = FALSE;
+ if (mImplementation->mGroupName)
+ {
+ mImplementation->mGroupName->setText(mImplementation->mLoadingText);
+ }
+ if ( mImplementation->mRoleNames )
+ {
+ mStoreSelected = mImplementation->mRoleNames->getCurrentID();
+ mImplementation->mRoleNames->clear();
+ mImplementation->mRoleNames->removeall();
+ mImplementation->mRoleNames->add(mImplementation->mLoadingText, LLUUID::null, ADD_BOTTOM);
+ mImplementation->mRoleNames->setCurrentByID(LLUUID::null);
+ }
+
+ updateLists();
}
void LLPanelGroupInvite::updateLists()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
- bool waiting = false;
-
- if (gdatap)
- {
- if (gdatap->isGroupPropertiesDataComplete())
- {
- if (mImplementation->mGroupName)
- {
- mImplementation->mGroupName->setText(gdatap->mName);
- }
- }
- else
- {
- waiting = true;
- }
- if (gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete()
- && (gdatap->isRoleMemberDataComplete() || !gdatap->mMembers.size())) // MAINT-5270: large groups receives an empty members list without some powers, so RoleMemberData wouldn't be complete for them
- {
- if ( mImplementation->mRoleNames )
- {
- mImplementation->mRoleNames->clear();
- mImplementation->mRoleNames->removeall();
-
- //add the role names and select the everybody role by default
- mImplementation->addRoleNames(gdatap);
- mImplementation->mRoleNames->setCurrentByID(mStoreSelected);
- }
- }
- else
- {
- waiting = true;
- }
- }
- else
- {
- waiting = true;
- }
-
- if (waiting)
- {
- if (!mPendingUpdate)
- {
- // Note: this will partially fail if some requests are already in progress
- LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID);
- LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID);
- LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(mImplementation->mGroupID);
- LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID);
- }
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
+ bool waiting = false;
+
+ if (gdatap)
+ {
+ if (gdatap->isGroupPropertiesDataComplete())
+ {
+ if (mImplementation->mGroupName)
+ {
+ mImplementation->mGroupName->setText(gdatap->mName);
+ }
+ }
+ else
+ {
+ waiting = true;
+ }
+ if (gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete()
+ && (gdatap->isRoleMemberDataComplete() || !gdatap->mMembers.size())) // MAINT-5270: large groups receives an empty members list without some powers, so RoleMemberData wouldn't be complete for them
+ {
+ if ( mImplementation->mRoleNames )
+ {
+ mImplementation->mRoleNames->clear();
+ mImplementation->mRoleNames->removeall();
+
+ //add the role names and select the everybody role by default
+ mImplementation->addRoleNames(gdatap);
+ mImplementation->mRoleNames->setCurrentByID(mStoreSelected);
+ }
+ }
+ else
+ {
+ waiting = true;
+ }
+ }
+ else
+ {
+ waiting = true;
+ }
+
+ if (waiting)
+ {
+ if (!mPendingUpdate)
+ {
+ // Note: this will partially fail if some requests are already in progress
+ LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID);
+ LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID);
+ LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(mImplementation->mGroupID);
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID);
+ }
else if (gdatap)
{
// restart requests that were interrupted/dropped/failed to start
@@ -630,71 +630,71 @@ void LLPanelGroupInvite::updateLists()
LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID);
}
}
- mPendingUpdate = TRUE;
- }
- else
- {
- mPendingUpdate = FALSE;
- if (mImplementation->mOKButton && mImplementation->mRoleNames->getItemCount())
- {
- mImplementation->mOKButton->setEnabled(TRUE);
- }
- }
+ mPendingUpdate = TRUE;
+ }
+ else
+ {
+ mPendingUpdate = FALSE;
+ if (mImplementation->mOKButton && mImplementation->mRoleNames->getItemCount())
+ {
+ mImplementation->mOKButton->setEnabled(TRUE);
+ }
+ }
}
BOOL LLPanelGroupInvite::postBuild()
{
- BOOL recurse = TRUE;
-
- mImplementation->mLoadingText = getString("loading");
- mImplementation->mRoleNames = getChild<LLComboBox>("role_name",
- recurse);
- mImplementation->mGroupName = getChild<LLTextBox>("group_name_text", recurse);
- mImplementation->mInvitees =
- getChild<LLNameListCtrl>("invitee_list", recurse);
- if ( mImplementation->mInvitees )
- {
- mImplementation->mInvitees->setCommitOnSelectionChange(TRUE);
- mImplementation->mInvitees->setCommitCallback(impl::callbackSelect, mImplementation);
- }
-
- LLButton* button = getChild<LLButton>("add_button", recurse);
- if ( button )
- {
- // default to opening avatarpicker automatically
- // (*impl::callbackClickAdd)((void*)this);
- button->setClickedCallback(impl::callbackClickAdd, this);
- }
-
- mImplementation->mRemoveButton =
- getChild<LLButton>("remove_button", recurse);
- if ( mImplementation->mRemoveButton )
- {
- mImplementation->mRemoveButton->setClickedCallback(impl::callbackClickRemove, mImplementation);
- mImplementation->mRemoveButton->setEnabled(FALSE);
- }
-
- mImplementation->mOKButton =
- getChild<LLButton>("invite_button", recurse);
- if ( mImplementation->mOKButton )
- {
- mImplementation->mOKButton->setClickedCallback(impl::callbackClickOK, mImplementation);
- mImplementation->mOKButton->setEnabled(FALSE);
- }
-
- button = getChild<LLButton>("cancel_button", recurse);
- if ( button )
- {
- button->setClickedCallback(impl::callbackClickCancel, mImplementation);
- }
-
- mImplementation->mOwnerWarning = getString("confirm_invite_owner_str");
- mImplementation->mAlreadyInGroup = getString("already_in_group");
- mImplementation->mTooManySelected = getString("invite_selection_too_large");
-
- update();
-
- return (mImplementation->mRoleNames &&
- mImplementation->mInvitees &&
- mImplementation->mRemoveButton);
+ BOOL recurse = TRUE;
+
+ mImplementation->mLoadingText = getString("loading");
+ mImplementation->mRoleNames = getChild<LLComboBox>("role_name",
+ recurse);
+ mImplementation->mGroupName = getChild<LLTextBox>("group_name_text", recurse);
+ mImplementation->mInvitees =
+ getChild<LLNameListCtrl>("invitee_list", recurse);
+ if ( mImplementation->mInvitees )
+ {
+ mImplementation->mInvitees->setCommitOnSelectionChange(TRUE);
+ mImplementation->mInvitees->setCommitCallback(impl::callbackSelect, mImplementation);
+ }
+
+ LLButton* button = getChild<LLButton>("add_button", recurse);
+ if ( button )
+ {
+ // default to opening avatarpicker automatically
+ // (*impl::callbackClickAdd)((void*)this);
+ button->setClickedCallback(impl::callbackClickAdd, this);
+ }
+
+ mImplementation->mRemoveButton =
+ getChild<LLButton>("remove_button", recurse);
+ if ( mImplementation->mRemoveButton )
+ {
+ mImplementation->mRemoveButton->setClickedCallback(impl::callbackClickRemove, mImplementation);
+ mImplementation->mRemoveButton->setEnabled(FALSE);
+ }
+
+ mImplementation->mOKButton =
+ getChild<LLButton>("invite_button", recurse);
+ if ( mImplementation->mOKButton )
+ {
+ mImplementation->mOKButton->setClickedCallback(impl::callbackClickOK, mImplementation);
+ mImplementation->mOKButton->setEnabled(FALSE);
+ }
+
+ button = getChild<LLButton>("cancel_button", recurse);
+ if ( button )
+ {
+ button->setClickedCallback(impl::callbackClickCancel, mImplementation);
+ }
+
+ mImplementation->mOwnerWarning = getString("confirm_invite_owner_str");
+ mImplementation->mAlreadyInGroup = getString("already_in_group");
+ mImplementation->mTooManySelected = getString("invite_selection_too_large");
+
+ update();
+
+ return (mImplementation->mRoleNames &&
+ mImplementation->mInvitees &&
+ mImplementation->mRemoveButton);
}
diff --git a/indra/newview/llpanelgroupinvite.h b/indra/newview/llpanelgroupinvite.h
index 9f7b5ae9be..e79f81226b 100644
--- a/indra/newview/llpanelgroupinvite.h
+++ b/indra/newview/llpanelgroupinvite.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file llpanelgroupinvite.h
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,28 +35,28 @@ class LLPanelGroupInvite
: public LLPanel
{
public:
- LLPanelGroupInvite(const LLUUID& group_id);
- ~LLPanelGroupInvite();
-
- void addUsers(uuid_vec_t& agent_ids);
- /**
- * this callback is being used to add a user whose fullname isn't been loaded before invoking of addUsers().
- */
- void addUserCallback(const LLUUID& id, const LLAvatarName& av_name);
- void clear();
- void update();
-
- void setCloseCallback(void (*close_callback)(void*), void* data);
-
- virtual void draw();
- virtual BOOL postBuild();
+ LLPanelGroupInvite(const LLUUID& group_id);
+ ~LLPanelGroupInvite();
+
+ void addUsers(uuid_vec_t& agent_ids);
+ /**
+ * this callback is being used to add a user whose fullname isn't been loaded before invoking of addUsers().
+ */
+ void addUserCallback(const LLUUID& id, const LLAvatarName& av_name);
+ void clear();
+ void update();
+
+ void setCloseCallback(void (*close_callback)(void*), void* data);
+
+ virtual void draw();
+ virtual BOOL postBuild();
protected:
- class impl;
- impl* mImplementation;
+ class impl;
+ impl* mImplementation;
- BOOL mPendingUpdate;
- LLUUID mStoreSelected;
- void updateLists();
+ BOOL mPendingUpdate;
+ LLUUID mStoreSelected;
+ void updateLists();
};
#endif
diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index f276d6d785..f104eb12c3 100644
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelgrouplandmoney.cpp
* @brief Panel for group land and L$.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,121 +67,121 @@ static LLPanelInjector<LLPanelGroupLandMoney> t_panel_group_money("panel_group_l
class LLGroupMoneyTabEventHandlerImpl
{
public:
- LLGroupMoneyTabEventHandlerImpl(LLButton* earlier_buttonp,
- LLButton* later_buttonp,
- LLTextEditor* text_editorp,
- LLPanel* tabpanelp,
- const std::string& loading_text,
- S32 interval_length_days,
- S32 max_interval_days);
- ~LLGroupMoneyTabEventHandlerImpl();
+ LLGroupMoneyTabEventHandlerImpl(LLButton* earlier_buttonp,
+ LLButton* later_buttonp,
+ LLTextEditor* text_editorp,
+ LLPanel* tabpanelp,
+ const std::string& loading_text,
+ S32 interval_length_days,
+ S32 max_interval_days);
+ ~LLGroupMoneyTabEventHandlerImpl();
- bool getCanClickLater();
- bool getCanClickEarlier();
+ bool getCanClickLater();
+ bool getCanClickEarlier();
- void updateButtons();
+ void updateButtons();
- void setGroupID(const LLUUID& group_id) { mGroupID = group_id; } ;
- const LLUUID& getGroupID() const { return mGroupID;}
+ void setGroupID(const LLUUID& group_id) { mGroupID = group_id; } ;
+ const LLUUID& getGroupID() const { return mGroupID;}
//member variables
public:
- LLUUID mPanelID;
- LLUUID mGroupID;
+ LLUUID mPanelID;
+ LLUUID mGroupID;
- LLPanel* mTabPanelp;
+ LLPanel* mTabPanelp;
- int mIntervalLength;
- int mMaxInterval;
- int mCurrentInterval;
+ int mIntervalLength;
+ int mMaxInterval;
+ int mCurrentInterval;
- LLTextEditor* mTextEditorp;
- LLButton* mEarlierButtonp;
- LLButton* mLaterButtonp;
+ LLTextEditor* mTextEditorp;
+ LLButton* mEarlierButtonp;
+ LLButton* mLaterButtonp;
- std::string mLoadingText;
+ std::string mLoadingText;
};
class LLGroupMoneyTabEventHandler
{
public:
- LLGroupMoneyTabEventHandler(LLButton* earlier_button,
- LLButton* later_button,
- LLTextEditor* text_editor,
- LLTabContainer* tab_containerp,
- LLPanel* panelp,
- const std::string& loading_text,
- S32 interval_length_days,
- S32 max_interval_days);
- virtual ~LLGroupMoneyTabEventHandler();
+ LLGroupMoneyTabEventHandler(LLButton* earlier_button,
+ LLButton* later_button,
+ LLTextEditor* text_editor,
+ LLTabContainer* tab_containerp,
+ LLPanel* panelp,
+ const std::string& loading_text,
+ S32 interval_length_days,
+ S32 max_interval_days);
+ virtual ~LLGroupMoneyTabEventHandler();
- virtual void requestData(LLMessageSystem* msg);
- virtual void processReply(LLMessageSystem* msg, void** data);
+ virtual void requestData(LLMessageSystem* msg);
+ virtual void processReply(LLMessageSystem* msg, void** data);
- virtual void onClickEarlier();
- virtual void onClickLater();
- virtual void onClickTab();
+ virtual void onClickEarlier();
+ virtual void onClickLater();
+ virtual void onClickTab();
- void setGroupID(const LLUUID& group_id) { if(mImplementationp) mImplementationp->setGroupID(group_id); } ;
+ void setGroupID(const LLUUID& group_id) { if(mImplementationp) mImplementationp->setGroupID(group_id); } ;
- static void clickEarlierCallback(void* data);
- static void clickLaterCallback(void* data);
+ static void clickEarlierCallback(void* data);
+ static void clickLaterCallback(void* data);
- static std::map<LLUUID, LLGroupMoneyTabEventHandler*> sInstanceIDs;
- static std::map<LLPanel*, LLGroupMoneyTabEventHandler*> sTabsToHandlers;
+ static std::map<LLUUID, LLGroupMoneyTabEventHandler*> sInstanceIDs;
+ static std::map<LLPanel*, LLGroupMoneyTabEventHandler*> sTabsToHandlers;
protected:
- LLGroupMoneyTabEventHandlerImpl* mImplementationp;
+ LLGroupMoneyTabEventHandlerImpl* mImplementationp;
};
class LLGroupMoneyDetailsTabEventHandler : public LLGroupMoneyTabEventHandler
{
public:
- LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp,
- LLButton* later_buttonp,
- LLTextEditor* text_editorp,
- LLTabContainer* tab_containerp,
- LLPanel* panelp,
- const std::string& loading_text
- );
- virtual ~LLGroupMoneyDetailsTabEventHandler();
-
- virtual void requestData(LLMessageSystem* msg);
- virtual void processReply(LLMessageSystem* msg, void** data);
+ LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp,
+ LLButton* later_buttonp,
+ LLTextEditor* text_editorp,
+ LLTabContainer* tab_containerp,
+ LLPanel* panelp,
+ const std::string& loading_text
+ );
+ virtual ~LLGroupMoneyDetailsTabEventHandler();
+
+ virtual void requestData(LLMessageSystem* msg);
+ virtual void processReply(LLMessageSystem* msg, void** data);
};
class LLGroupMoneySalesTabEventHandler : public LLGroupMoneyTabEventHandler
{
public:
- LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp,
- LLButton* later_buttonp,
- LLTextEditor* text_editorp,
- LLTabContainer* tab_containerp,
- LLPanel* panelp,
- const std::string& loading_text
- );
- virtual ~LLGroupMoneySalesTabEventHandler();
-
- virtual void requestData(LLMessageSystem* msg);
- virtual void processReply(LLMessageSystem* msg, void** data);
+ LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp,
+ LLButton* later_buttonp,
+ LLTextEditor* text_editorp,
+ LLTabContainer* tab_containerp,
+ LLPanel* panelp,
+ const std::string& loading_text
+ );
+ virtual ~LLGroupMoneySalesTabEventHandler();
+
+ virtual void requestData(LLMessageSystem* msg);
+ virtual void processReply(LLMessageSystem* msg, void** data);
};
class LLGroupMoneyPlanningTabEventHandler : public LLGroupMoneyTabEventHandler
{
public:
- LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editor,
- LLTabContainer* tab_containerp,
- LLPanel* panelp,
- const std::string& loading_text
- );
- virtual ~LLGroupMoneyPlanningTabEventHandler();
-
- virtual void requestData(LLMessageSystem* msg);
- virtual void processReply(LLMessageSystem* msg, void** data);
+ LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editor,
+ LLTabContainer* tab_containerp,
+ LLPanel* panelp,
+ const std::string& loading_text
+ );
+ virtual ~LLGroupMoneyPlanningTabEventHandler();
+
+ virtual void requestData(LLMessageSystem* msg);
+ virtual void processReply(LLMessageSystem* msg, void** data);
};
////////////////////////////////////////////////////////////////////////////
@@ -189,363 +189,363 @@ public:
class LLPanelGroupLandMoney::impl
{
public:
- impl(LLPanelGroupLandMoney& panel); //constructor
- virtual ~impl();
+ impl(LLPanelGroupLandMoney& panel); //constructor
+ virtual ~impl();
- void requestGroupLandInfo();
+ void requestGroupLandInfo();
- int getStoredContribution();
- void setYourContributionTextField(int contrib);
- void setYourMaxContributionTextBox(int max);
+ int getStoredContribution();
+ void setYourContributionTextField(int contrib);
+ void setYourMaxContributionTextBox(int max);
- virtual void onMapButton();
- virtual bool applyContribution();
- virtual void processGroupLand(LLMessageSystem* msg);
+ virtual void onMapButton();
+ virtual bool applyContribution();
+ virtual void processGroupLand(LLMessageSystem* msg);
- static void mapCallback(void* data);
- static void contributionCommitCallback(LLUICtrl* ctrl, void* userdata);
- static void contributionKeystrokeCallback(LLLineEditor* caller, void* userdata);
+ static void mapCallback(void* data);
+ static void contributionCommitCallback(LLUICtrl* ctrl, void* userdata);
+ static void contributionKeystrokeCallback(LLLineEditor* caller, void* userdata);
//member variables
public:
- LLPanelGroupLandMoney& mPanel;
-
- LLTextBox* mGroupOverLimitTextp;
- LLIconCtrl* mGroupOverLimitIconp;
+ LLPanelGroupLandMoney& mPanel;
+
+ LLTextBox* mGroupOverLimitTextp;
+ LLIconCtrl* mGroupOverLimitIconp;
- LLLineEditor* mYourContributionEditorp;
+ LLLineEditor* mYourContributionEditorp;
- LLButton* mMapButtonp;
+ LLButton* mMapButtonp;
- LLGroupMoneyTabEventHandler* mMoneyDetailsTabEHp;
- LLGroupMoneyTabEventHandler* mMoneyPlanningTabEHp;
- LLGroupMoneyTabEventHandler* mMoneySalesTabEHp;
+ LLGroupMoneyTabEventHandler* mMoneyDetailsTabEHp;
+ LLGroupMoneyTabEventHandler* mMoneyPlanningTabEHp;
+ LLGroupMoneyTabEventHandler* mMoneySalesTabEHp;
- LLScrollListCtrl* mGroupParcelsp;
+ LLScrollListCtrl* mGroupParcelsp;
- LLUUID mTransID;
+ LLUUID mTransID;
- bool mBeenActivated;
- bool mNeedsSendGroupLandRequest;
- bool mNeedsApply;
+ bool mBeenActivated;
+ bool mNeedsSendGroupLandRequest;
+ bool mNeedsApply;
- std::string mCantViewParcelsText;
- std::string mCantViewAccountsText;
- std::string mEmptyParcelsText;
+ std::string mCantViewParcelsText;
+ std::string mCantViewAccountsText;
+ std::string mEmptyParcelsText;
};
//*******************************************
//** LLPanelGroupLandMoney::impl Functions **
//*******************************************
LLPanelGroupLandMoney::impl::impl(LLPanelGroupLandMoney& panel)
- : mPanel(panel)
+ : mPanel(panel)
{
- mTransID = LLUUID::null;
+ mTransID = LLUUID::null;
- mBeenActivated = false;
- mNeedsSendGroupLandRequest = true;
- mNeedsApply = false;
+ mBeenActivated = false;
+ mNeedsSendGroupLandRequest = true;
+ mNeedsApply = false;
- mYourContributionEditorp = NULL;
- mMapButtonp = NULL;
- mGroupParcelsp = NULL;
- mGroupOverLimitTextp = NULL;
- mGroupOverLimitIconp = NULL;
+ mYourContributionEditorp = NULL;
+ mMapButtonp = NULL;
+ mGroupParcelsp = NULL;
+ mGroupOverLimitTextp = NULL;
+ mGroupOverLimitIconp = NULL;
- mMoneySalesTabEHp = NULL;
- mMoneyPlanningTabEHp = NULL;
- mMoneyDetailsTabEHp = NULL;
+ mMoneySalesTabEHp = NULL;
+ mMoneyPlanningTabEHp = NULL;
+ mMoneyDetailsTabEHp = NULL;
}
LLPanelGroupLandMoney::impl::~impl()
{
- if ( mMoneySalesTabEHp ) delete mMoneySalesTabEHp;
- if ( mMoneyDetailsTabEHp ) delete mMoneyDetailsTabEHp;
- if ( mMoneyPlanningTabEHp ) delete mMoneyPlanningTabEHp;
+ if ( mMoneySalesTabEHp ) delete mMoneySalesTabEHp;
+ if ( mMoneyDetailsTabEHp ) delete mMoneyDetailsTabEHp;
+ if ( mMoneyPlanningTabEHp ) delete mMoneyPlanningTabEHp;
}
void LLPanelGroupLandMoney::impl::requestGroupLandInfo()
{
- U32 query_flags = DFQ_GROUP_OWNED;
+ U32 query_flags = DFQ_GROUP_OWNED;
- mTransID.generate();
- mGroupParcelsp->deleteAllItems();
+ mTransID.generate();
+ mGroupParcelsp->deleteAllItems();
- send_places_query(mPanel.mGroupID, mTransID, "", query_flags, LLParcel::C_ANY, "");
+ send_places_query(mPanel.mGroupID, mTransID, "", query_flags, LLParcel::C_ANY, "");
}
void LLPanelGroupLandMoney::impl::onMapButton()
{
- LLScrollListItem* itemp;
- itemp = mGroupParcelsp->getFirstSelected();
- if (!itemp) return;
+ LLScrollListItem* itemp;
+ itemp = mGroupParcelsp->getFirstSelected();
+ if (!itemp) return;
- const LLScrollListCell* cellp;
- cellp = itemp->getColumn(itemp->getNumColumns() - 1); // hidden column is last
+ const LLScrollListCell* cellp;
+ cellp = itemp->getColumn(itemp->getNumColumns() - 1); // hidden column is last
- F32 global_x = 0.f;
- F32 global_y = 0.f;
- sscanf(cellp->getValue().asString().c_str(), "%f %f", &global_x, &global_y);
+ F32 global_x = 0.f;
+ F32 global_y = 0.f;
+ sscanf(cellp->getValue().asString().c_str(), "%f %f", &global_x, &global_y);
- // Hack: Use the agent's z-height
- F64 global_z = gAgent.getPositionGlobal().mdV[VZ];
+ // Hack: Use the agent's z-height
+ F64 global_z = gAgent.getPositionGlobal().mdV[VZ];
- LLVector3d pos_global(global_x, global_y, global_z);
- LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+ LLVector3d pos_global(global_x, global_y, global_z);
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
if(worldmap_instance)
- {
- worldmap_instance->trackLocation(pos_global);
- LLFloaterReg::showInstance("world_map", "center");
- }
+ {
+ worldmap_instance->trackLocation(pos_global);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
}
bool LLPanelGroupLandMoney::impl::applyContribution()
{
- // calculate max donation, which is sum of available and current.
- S32 your_contribution = 0;
- S32 sqm_avail;
-
- your_contribution = getStoredContribution();
- sqm_avail = your_contribution;
-
- if(gStatusBar)
- {
- sqm_avail += gStatusBar->getSquareMetersLeft();
- }
-
- // get new contribution and compare to available
- S32 new_contribution = atoi(mYourContributionEditorp->getText().c_str());
-
- if( new_contribution != your_contribution &&
- new_contribution >= 0 &&
- new_contribution <= sqm_avail )
- {
- // update group info and server
- if(!gAgent.setGroupContribution(mPanel.mGroupID, new_contribution))
- {
- // should never happen...
- LL_WARNS() << "Unable to set contribution." << LL_ENDL;
- return false;
- }
- }
- else
- {
- //TODO: throw up some error message here and return? right now we just
- //fail silently and force the previous value -jwolk
- new_contribution = your_contribution;
- }
-
- //set your contribution
- setYourContributionTextField(new_contribution);
-
- return true;
+ // calculate max donation, which is sum of available and current.
+ S32 your_contribution = 0;
+ S32 sqm_avail;
+
+ your_contribution = getStoredContribution();
+ sqm_avail = your_contribution;
+
+ if(gStatusBar)
+ {
+ sqm_avail += gStatusBar->getSquareMetersLeft();
+ }
+
+ // get new contribution and compare to available
+ S32 new_contribution = atoi(mYourContributionEditorp->getText().c_str());
+
+ if( new_contribution != your_contribution &&
+ new_contribution >= 0 &&
+ new_contribution <= sqm_avail )
+ {
+ // update group info and server
+ if(!gAgent.setGroupContribution(mPanel.mGroupID, new_contribution))
+ {
+ // should never happen...
+ LL_WARNS() << "Unable to set contribution." << LL_ENDL;
+ return false;
+ }
+ }
+ else
+ {
+ //TODO: throw up some error message here and return? right now we just
+ //fail silently and force the previous value -jwolk
+ new_contribution = your_contribution;
+ }
+
+ //set your contribution
+ setYourContributionTextField(new_contribution);
+
+ return true;
}
// Retrieves the land contribution for this agent that is currently
// stored in the database, NOT what is currently entered in the text field
int LLPanelGroupLandMoney::impl::getStoredContribution()
{
- LLGroupData group_data;
+ LLGroupData group_data;
- group_data.mContribution = 0;
- gAgent.getGroupData(mPanel.mGroupID, group_data);
+ group_data.mContribution = 0;
+ gAgent.getGroupData(mPanel.mGroupID, group_data);
- return group_data.mContribution;
+ return group_data.mContribution;
}
// Fills in the text field with the contribution, contrib
void LLPanelGroupLandMoney::impl::setYourContributionTextField(int contrib)
{
- std::string buffer = llformat("%d", contrib);
+ std::string buffer = llformat("%d", contrib);
- if ( mYourContributionEditorp )
- {
- mYourContributionEditorp->setText(buffer);
- }
+ if ( mYourContributionEditorp )
+ {
+ mYourContributionEditorp->setText(buffer);
+ }
}
void LLPanelGroupLandMoney::impl::setYourMaxContributionTextBox(int max)
{
- mPanel.getChild<LLUICtrl>("your_contribution_max_value")->setTextArg("[AMOUNT]", llformat("%d", max));
+ mPanel.getChild<LLUICtrl>("your_contribution_max_value")->setTextArg("[AMOUNT]", llformat("%d", max));
}
//static
void LLPanelGroupLandMoney::impl::mapCallback(void* data)
{
- LLPanelGroupLandMoney::impl* selfp = (LLPanelGroupLandMoney::impl*) data;
+ LLPanelGroupLandMoney::impl* selfp = (LLPanelGroupLandMoney::impl*) data;
- if ( selfp ) selfp->onMapButton();
+ if ( selfp ) selfp->onMapButton();
}
-void LLPanelGroupLandMoney::impl::contributionCommitCallback(LLUICtrl* ctrl,
- void* userdata)
+void LLPanelGroupLandMoney::impl::contributionCommitCallback(LLUICtrl* ctrl,
+ void* userdata)
{
- LLPanelGroupLandMoney* tabp = (LLPanelGroupLandMoney*) userdata;
- LLLineEditor* editorp = (LLLineEditor*) ctrl;
+ LLPanelGroupLandMoney* tabp = (LLPanelGroupLandMoney*) userdata;
+ LLLineEditor* editorp = (LLLineEditor*) ctrl;
- if ( tabp && editorp )
- {
- impl* self = tabp->mImplementationp;
- int your_contribution = 0;
- int new_contribution = 0;
+ if ( tabp && editorp )
+ {
+ impl* self = tabp->mImplementationp;
+ int your_contribution = 0;
+ int new_contribution = 0;
- new_contribution= atoi(editorp->getText().c_str());
- your_contribution = self->getStoredContribution();
+ new_contribution= atoi(editorp->getText().c_str());
+ your_contribution = self->getStoredContribution();
- //reset their junk data to be "good" data to us
- self->setYourContributionTextField(new_contribution);
+ //reset their junk data to be "good" data to us
+ self->setYourContributionTextField(new_contribution);
- //check to see if they're contribution text has changed
- self->mNeedsApply = new_contribution != your_contribution;
- tabp->notifyObservers();
- }
+ //check to see if they're contribution text has changed
+ self->mNeedsApply = new_contribution != your_contribution;
+ tabp->notifyObservers();
+ }
}
void LLPanelGroupLandMoney::impl::contributionKeystrokeCallback(LLLineEditor* caller,
- void* userdata)
+ void* userdata)
{
- impl::contributionCommitCallback(caller, userdata);
+ impl::contributionCommitCallback(caller, userdata);
}
//static
void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)
{
- S32 count = msg->getNumberOfBlocks("QueryData");
- if(count > 0)
- {
- S32 first_block = 0;
-
- LLUUID owner_id;
- LLUUID trans_id;
-
- msg->getUUID("QueryData", "OwnerID", owner_id, 0);
- msg->getUUID("TransactionData", "TransactionID", trans_id);
-
- if(owner_id.isNull())
- {
- // special block which has total contribution
- ++first_block;
-
- S32 committed = 0;
- S32 billable_area = 0;
-
- if(count == 1)
- {
- msg->getS32("QueryData", "BillableArea", committed, 0);
- }
- else
- {
- for(S32 i = first_block; i < count; ++i)
- {
- msg->getS32("QueryData", "BillableArea", billable_area, i);
- committed+=billable_area;
- }
- }
-
- S32 total_contribution;
- msg->getS32("QueryData", "ActualArea", total_contribution, 0);
- mPanel.getChild<LLUICtrl>("total_contributed_land_value")->setTextArg("[AREA]", llformat("%d", total_contribution));
-
- mPanel.getChild<LLUICtrl>("total_land_in_use_value")->setTextArg("[AREA]", llformat("%d", committed));
- S32 available = total_contribution - committed;
- mPanel.getChild<LLUICtrl>("land_available_value")->setTextArg("[AREA]", llformat("%d", available));
-
-
- if ( mGroupOverLimitTextp && mGroupOverLimitIconp )
-
- {
- mGroupOverLimitIconp->setVisible(available < 0);
- mGroupOverLimitTextp->setVisible(available < 0);
- }
-
- }
-
- if ( trans_id != mTransID ) return;
-
- // This power was removed to make group roles simpler
- //if ( !gAgent.hasPowerInGroup(mGroupID, GP_LAND_VIEW_OWNED) ) return;
- if (!gAgent.isInGroup(mPanel.mGroupID)) return;
-
- mGroupParcelsp->setCommentText(mEmptyParcelsText);
-
- std::string name;
- std::string desc;
- S32 actual_area;
- S32 billable_area;
- U8 flags;
- F32 global_x;
- F32 global_y;
- std::string sim_name;
- std::string land_sku;
- std::string land_type;
-
- for(S32 i = first_block; i < count; ++i)
- {
- msg->getUUID("QueryData", "OwnerID", owner_id, i);
- msg->getString("QueryData", "Name", name, i);
- msg->getString("QueryData", "Desc", desc, i);
- msg->getS32("QueryData", "ActualArea", actual_area, i);
- msg->getS32("QueryData", "BillableArea", billable_area, i);
- msg->getU8("QueryData", "Flags", flags, i);
- msg->getF32("QueryData", "GlobalX", global_x, i);
- msg->getF32("QueryData", "GlobalY", global_y, i);
- msg->getString("QueryData", "SimName", sim_name, i);
-
- if ( msg->getSizeFast(_PREHASH_QueryData, i, _PREHASH_ProductSKU) > 0 )
- {
- msg->getStringFast( _PREHASH_QueryData, _PREHASH_ProductSKU, land_sku, i);
- LL_INFOS() << "Land sku: " << land_sku << LL_ENDL;
- land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku);
- }
- else
- {
- land_sku.clear();
- land_type = LLTrans::getString("land_type_unknown");
- }
-
- S32 region_x = ll_round(global_x) % REGION_WIDTH_UNITS;
- S32 region_y = ll_round(global_y) % REGION_WIDTH_UNITS;
- std::string location = sim_name + llformat(" (%d, %d)", region_x, region_y);
- std::string area;
-
-
- if(billable_area == actual_area)
- {
- area = llformat("%d", billable_area);
- }
- else
- {
- area = llformat("%d / %d", billable_area, actual_area);
- }
-
- std::string hidden;
- hidden = llformat("%f %f", global_x, global_y);
-
- LLSD row;
-
- row["columns"][0]["column"] = "name";
- row["columns"][0]["value"] = name;
- row["columns"][0]["font"] = "SANSSERIF_SMALL";
-
- row["columns"][1]["column"] = "location";
- row["columns"][1]["value"] = location;
- row["columns"][1]["font"] = "SANSSERIF_SMALL";
-
- row["columns"][2]["column"] = "area";
- row["columns"][2]["value"] = area;
- row["columns"][2]["font"] = "SANSSERIF_SMALL";
-
- row["columns"][3]["column"] = "type";
- row["columns"][3]["value"] = land_type;
- row["columns"][3]["font"] = "SANSSERIF_SMALL";
-
- // hidden is always last column
- row["columns"][4]["column"] = "hidden";
- row["columns"][4]["value"] = hidden;
-
- mGroupParcelsp->addElement(row);
- }
- }
+ S32 count = msg->getNumberOfBlocks("QueryData");
+ if(count > 0)
+ {
+ S32 first_block = 0;
+
+ LLUUID owner_id;
+ LLUUID trans_id;
+
+ msg->getUUID("QueryData", "OwnerID", owner_id, 0);
+ msg->getUUID("TransactionData", "TransactionID", trans_id);
+
+ if(owner_id.isNull())
+ {
+ // special block which has total contribution
+ ++first_block;
+
+ S32 committed = 0;
+ S32 billable_area = 0;
+
+ if(count == 1)
+ {
+ msg->getS32("QueryData", "BillableArea", committed, 0);
+ }
+ else
+ {
+ for(S32 i = first_block; i < count; ++i)
+ {
+ msg->getS32("QueryData", "BillableArea", billable_area, i);
+ committed+=billable_area;
+ }
+ }
+
+ S32 total_contribution;
+ msg->getS32("QueryData", "ActualArea", total_contribution, 0);
+ mPanel.getChild<LLUICtrl>("total_contributed_land_value")->setTextArg("[AREA]", llformat("%d", total_contribution));
+
+ mPanel.getChild<LLUICtrl>("total_land_in_use_value")->setTextArg("[AREA]", llformat("%d", committed));
+ S32 available = total_contribution - committed;
+ mPanel.getChild<LLUICtrl>("land_available_value")->setTextArg("[AREA]", llformat("%d", available));
+
+
+ if ( mGroupOverLimitTextp && mGroupOverLimitIconp )
+
+ {
+ mGroupOverLimitIconp->setVisible(available < 0);
+ mGroupOverLimitTextp->setVisible(available < 0);
+ }
+
+ }
+
+ if ( trans_id != mTransID ) return;
+
+ // This power was removed to make group roles simpler
+ //if ( !gAgent.hasPowerInGroup(mGroupID, GP_LAND_VIEW_OWNED) ) return;
+ if (!gAgent.isInGroup(mPanel.mGroupID)) return;
+
+ mGroupParcelsp->setCommentText(mEmptyParcelsText);
+
+ std::string name;
+ std::string desc;
+ S32 actual_area;
+ S32 billable_area;
+ U8 flags;
+ F32 global_x;
+ F32 global_y;
+ std::string sim_name;
+ std::string land_sku;
+ std::string land_type;
+
+ for(S32 i = first_block; i < count; ++i)
+ {
+ msg->getUUID("QueryData", "OwnerID", owner_id, i);
+ msg->getString("QueryData", "Name", name, i);
+ msg->getString("QueryData", "Desc", desc, i);
+ msg->getS32("QueryData", "ActualArea", actual_area, i);
+ msg->getS32("QueryData", "BillableArea", billable_area, i);
+ msg->getU8("QueryData", "Flags", flags, i);
+ msg->getF32("QueryData", "GlobalX", global_x, i);
+ msg->getF32("QueryData", "GlobalY", global_y, i);
+ msg->getString("QueryData", "SimName", sim_name, i);
+
+ if ( msg->getSizeFast(_PREHASH_QueryData, i, _PREHASH_ProductSKU) > 0 )
+ {
+ msg->getStringFast( _PREHASH_QueryData, _PREHASH_ProductSKU, land_sku, i);
+ LL_INFOS() << "Land sku: " << land_sku << LL_ENDL;
+ land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku);
+ }
+ else
+ {
+ land_sku.clear();
+ land_type = LLTrans::getString("land_type_unknown");
+ }
+
+ S32 region_x = ll_round(global_x) % REGION_WIDTH_UNITS;
+ S32 region_y = ll_round(global_y) % REGION_WIDTH_UNITS;
+ std::string location = sim_name + llformat(" (%d, %d)", region_x, region_y);
+ std::string area;
+
+
+ if(billable_area == actual_area)
+ {
+ area = llformat("%d", billable_area);
+ }
+ else
+ {
+ area = llformat("%d / %d", billable_area, actual_area);
+ }
+
+ std::string hidden;
+ hidden = llformat("%f %f", global_x, global_y);
+
+ LLSD row;
+
+ row["columns"][0]["column"] = "name";
+ row["columns"][0]["value"] = name;
+ row["columns"][0]["font"] = "SANSSERIF_SMALL";
+
+ row["columns"][1]["column"] = "location";
+ row["columns"][1]["value"] = location;
+ row["columns"][1]["font"] = "SANSSERIF_SMALL";
+
+ row["columns"][2]["column"] = "area";
+ row["columns"][2]["value"] = area;
+ row["columns"][2]["font"] = "SANSSERIF_SMALL";
+
+ row["columns"][3]["column"] = "type";
+ row["columns"][3]["value"] = land_type;
+ row["columns"][3]["font"] = "SANSSERIF_SMALL";
+
+ // hidden is always last column
+ row["columns"][4]["column"] = "hidden";
+ row["columns"][4]["value"] = hidden;
+
+ mGroupParcelsp->addElement(row);
+ }
+ }
}
//*************************************
@@ -557,322 +557,322 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)
std::map<LLUUID, LLPanelGroupLandMoney*> LLPanelGroupLandMoney::sGroupIDs;
LLPanelGroupLandMoney::LLPanelGroupLandMoney() :
- LLPanelGroupTab()
+ LLPanelGroupTab()
{
- //FIXME - add setGroupID();
- mImplementationp = new impl(*this);
+ //FIXME - add setGroupID();
+ mImplementationp = new impl(*this);
- //problem what if someone has both the group floater open and the finder
- //open to the same group? Some maps that map group ids to panels
- //will then only be working for the last panel for a given group id :(
+ //problem what if someone has both the group floater open and the finder
+ //open to the same group? Some maps that map group ids to panels
+ //will then only be working for the last panel for a given group id :(
- //FIXME - add to setGroupID()
- //LLPanelGroupLandMoney::sGroupIDs.insert(group_id, this);
+ //FIXME - add to setGroupID()
+ //LLPanelGroupLandMoney::sGroupIDs.insert(group_id, this);
}
LLPanelGroupLandMoney::~LLPanelGroupLandMoney()
{
- delete mImplementationp;
- LLPanelGroupLandMoney::sGroupIDs.erase(mGroupID);
+ delete mImplementationp;
+ LLPanelGroupLandMoney::sGroupIDs.erase(mGroupID);
}
void LLPanelGroupLandMoney::activate()
{
- if ( !mImplementationp->mBeenActivated )
- {
- //select the first tab
- LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container");
-
- if ( tabp )
- {
- tabp->selectFirstTab();
- mImplementationp->mBeenActivated = true;
- }
-
- //fill in the max contribution
-
- //This calculation is unfortunately based on
- //the status bar's concept of how much land the user has
- //which can change dynamically if the user buys new land, gives
- //more land to a group, etc.
- //A race condition can occur if we want to update the UI's
- //concept of the user's max contribution before the status
- //bar has been updated from a change in the user's group contribution.
-
- //Since the max contribution should not change solely on changing
- //a user's group contribution, (it would only change through
- //purchasing of new land) this code is placed here
- //and only updated once to prevent the race condition
- //at the price of having stale data.
- //We need to have the status bar have observers
- //or find better way of distributing up to date land data. - jwolk
- S32 max_avail = mImplementationp->getStoredContribution();
- if(gStatusBar)
- {
- max_avail += gStatusBar->getSquareMetersLeft();
- }
- mImplementationp->setYourMaxContributionTextBox(max_avail);
- }
-
- mImplementationp->mMapButtonp->setEnabled(false);
- update(GC_ALL);
+ if ( !mImplementationp->mBeenActivated )
+ {
+ //select the first tab
+ LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container");
+
+ if ( tabp )
+ {
+ tabp->selectFirstTab();
+ mImplementationp->mBeenActivated = true;
+ }
+
+ //fill in the max contribution
+
+ //This calculation is unfortunately based on
+ //the status bar's concept of how much land the user has
+ //which can change dynamically if the user buys new land, gives
+ //more land to a group, etc.
+ //A race condition can occur if we want to update the UI's
+ //concept of the user's max contribution before the status
+ //bar has been updated from a change in the user's group contribution.
+
+ //Since the max contribution should not change solely on changing
+ //a user's group contribution, (it would only change through
+ //purchasing of new land) this code is placed here
+ //and only updated once to prevent the race condition
+ //at the price of having stale data.
+ //We need to have the status bar have observers
+ //or find better way of distributing up to date land data. - jwolk
+ S32 max_avail = mImplementationp->getStoredContribution();
+ if(gStatusBar)
+ {
+ max_avail += gStatusBar->getSquareMetersLeft();
+ }
+ mImplementationp->setYourMaxContributionTextBox(max_avail);
+ }
+
+ mImplementationp->mMapButtonp->setEnabled(false);
+ update(GC_ALL);
}
void LLPanelGroupLandMoney::update(LLGroupChange gc)
{
- if (gc != GC_ALL) return; //Don't update if it's the wrong panel!
+ if (gc != GC_ALL) return; //Don't update if it's the wrong panel!
- LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container");
+ LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container");
- if ( tabp )
- {
- LLPanel* panelp;
- LLGroupMoneyTabEventHandler* eh;
+ if ( tabp )
+ {
+ LLPanel* panelp;
+ LLGroupMoneyTabEventHandler* eh;
- panelp = tabp->getCurrentPanel();
+ panelp = tabp->getCurrentPanel();
- //now pull the event handler associated with that L$ tab
- if ( panelp )
- {
- eh = get_if_there(LLGroupMoneyTabEventHandler::sTabsToHandlers,
- panelp,
- (LLGroupMoneyTabEventHandler*)NULL);
- if ( eh ) eh->onClickTab();
- }
- }
+ //now pull the event handler associated with that L$ tab
+ if ( panelp )
+ {
+ eh = get_if_there(LLGroupMoneyTabEventHandler::sTabsToHandlers,
+ panelp,
+ (LLGroupMoneyTabEventHandler*)NULL);
+ if ( eh ) eh->onClickTab();
+ }
+ }
- mImplementationp->requestGroupLandInfo();
- mImplementationp->setYourContributionTextField(mImplementationp->getStoredContribution());
+ mImplementationp->requestGroupLandInfo();
+ mImplementationp->setYourContributionTextField(mImplementationp->getStoredContribution());
}
bool LLPanelGroupLandMoney::needsApply(std::string& mesg)
{
- return mImplementationp->mNeedsApply;
+ return mImplementationp->mNeedsApply;
}
bool LLPanelGroupLandMoney::apply(std::string& mesg)
{
- if (!mImplementationp->applyContribution() )
- {
- mesg = getString("land_contrib_error");
- return false;
- }
+ if (!mImplementationp->applyContribution() )
+ {
+ mesg = getString("land_contrib_error");
+ return false;
+ }
- mImplementationp->mNeedsApply = false;
- notifyObservers();
+ mImplementationp->mNeedsApply = false;
+ notifyObservers();
- return true;
+ return true;
}
void LLPanelGroupLandMoney::cancel()
{
- //set the contribution back to the "stored value"
- mImplementationp->setYourContributionTextField(mImplementationp->getStoredContribution());
+ //set the contribution back to the "stored value"
+ mImplementationp->setYourContributionTextField(mImplementationp->getStoredContribution());
- mImplementationp->mNeedsApply = false;
- notifyObservers();
+ mImplementationp->mNeedsApply = false;
+ notifyObservers();
}
BOOL LLPanelGroupLandMoney::postBuild()
{
- /* This power was removed to make group roles simpler
- bool has_parcel_view = gAgent.hasPowerInGroup(mGroupID,
- GP_LAND_VIEW_OWNED);
- bool has_accounting_view = gAgent.hasPowerInGroup(mGroupID,
- GP_ACCOUNTING_VIEW);
- */
-
- bool can_view = gAgent.isInGroup(mGroupID);
-
- mImplementationp->mGroupOverLimitIconp =
- getChild<LLIconCtrl>("group_over_limit_icon");
- mImplementationp->mGroupOverLimitTextp =
- getChild<LLTextBox>("group_over_limit_text");
-
- mImplementationp->mYourContributionEditorp
- = getChild<LLLineEditor>("your_contribution_line_editor");
- if ( mImplementationp->mYourContributionEditorp )
- {
- LLLineEditor* editor = mImplementationp->mYourContributionEditorp;
-
- editor->setCommitCallback(mImplementationp->contributionCommitCallback, this);
- editor->setKeystrokeCallback(mImplementationp->contributionKeystrokeCallback, this);
- }
-
- mImplementationp->mMapButtonp = getChild<LLButton>("map_button");
-
- mImplementationp->mGroupParcelsp =
- getChild<LLScrollListCtrl>("group_parcel_list");
-
- if ( mImplementationp->mGroupParcelsp )
- {
- mImplementationp->mGroupParcelsp->setCommitCallback(boost::bind(&LLPanelGroupLandMoney::onLandSelectionChanged, this));
- mImplementationp->mGroupParcelsp->setCommitOnSelectionChange(true);
- }
-
- mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text");
- mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text");
- mImplementationp->mEmptyParcelsText = getString("epmty_view_group_land_text");
-
- if ( mImplementationp->mMapButtonp )
- {
- mImplementationp->mMapButtonp->setClickedCallback(LLPanelGroupLandMoney::impl::mapCallback, mImplementationp);
- }
-
- if ( mImplementationp->mGroupOverLimitTextp )
- {
- mImplementationp->mGroupOverLimitTextp->setVisible(FALSE);
- }
-
- if ( mImplementationp->mGroupOverLimitIconp )
- {
- mImplementationp->mGroupOverLimitIconp->setVisible(FALSE);
- }
-
- if ( !can_view )
- {
- if ( mImplementationp->mGroupParcelsp )
- {
- mImplementationp->mGroupParcelsp->setCommentText(
- mImplementationp->mCantViewParcelsText);
- mImplementationp->mGroupParcelsp->setEnabled(FALSE);
- }
- }
-
-
-
- LLButton* earlierp, *laterp;
- LLTextEditor* textp;
- LLPanel* panelp;
-
- LLTabContainer* tabcp = getChild<LLTabContainer>("group_money_tab_container");
-
- if ( !can_view )
- {
- if ( tabcp )
- {
- S32 i;
- S32 tab_count = tabcp->getTabCount();
-
- for (i = tab_count - 1; i >=0; --i)
- {
- tabcp->enableTabButton(i, false);
- }
- }
- }
-
- std::string loading_text = getString("loading_txt");
-
- //pull out the widgets for the L$ details tab
- earlierp = getChild<LLButton>("earlier_details_button", true);
- laterp = getChild<LLButton>("later_details_button", true);
- textp = getChild<LLTextEditor>("group_money_details_text", true);
- panelp = getChild<LLPanel>("group_money_details_tab", true);
-
- if ( !can_view )
- {
- textp->setText(mImplementationp->mCantViewAccountsText);
- }
- else
- {
- mImplementationp->mMoneyDetailsTabEHp =
- new LLGroupMoneyDetailsTabEventHandler(earlierp,
- laterp,
- textp,
- tabcp,
- panelp,
- loading_text);
- }
-
- textp = getChild<LLTextEditor>("group_money_planning_text", true);
- panelp = getChild<LLPanel>("group_money_planning_tab", true);
-
- if ( !can_view )
- {
- textp->setText(mImplementationp->mCantViewAccountsText);
- }
- else
- {
- //Temporally disabled for DEV-11287.
- mImplementationp->mMoneyPlanningTabEHp =
- new LLGroupMoneyPlanningTabEventHandler(textp,
- tabcp,
- panelp,
- loading_text);
- }
-
- //pull out the widgets for the L$ sales tab
- earlierp = getChild<LLButton>("earlier_sales_button", true);
- laterp = getChild<LLButton>("later_sales_button", true);
- textp = getChild<LLTextEditor>("group_money_sales_text", true);
- panelp = getChild<LLPanel>("group_money_sales_tab", true);
-
- if ( !can_view )
- {
- textp->setText(mImplementationp->mCantViewAccountsText);
- }
- else
- {
- mImplementationp->mMoneySalesTabEHp =
- new LLGroupMoneySalesTabEventHandler(earlierp,
- laterp,
- textp,
- tabcp,
- panelp,
- loading_text);
- }
-
- return LLPanelGroupTab::postBuild();
+ /* This power was removed to make group roles simpler
+ bool has_parcel_view = gAgent.hasPowerInGroup(mGroupID,
+ GP_LAND_VIEW_OWNED);
+ bool has_accounting_view = gAgent.hasPowerInGroup(mGroupID,
+ GP_ACCOUNTING_VIEW);
+ */
+
+ bool can_view = gAgent.isInGroup(mGroupID);
+
+ mImplementationp->mGroupOverLimitIconp =
+ getChild<LLIconCtrl>("group_over_limit_icon");
+ mImplementationp->mGroupOverLimitTextp =
+ getChild<LLTextBox>("group_over_limit_text");
+
+ mImplementationp->mYourContributionEditorp
+ = getChild<LLLineEditor>("your_contribution_line_editor");
+ if ( mImplementationp->mYourContributionEditorp )
+ {
+ LLLineEditor* editor = mImplementationp->mYourContributionEditorp;
+
+ editor->setCommitCallback(mImplementationp->contributionCommitCallback, this);
+ editor->setKeystrokeCallback(mImplementationp->contributionKeystrokeCallback, this);
+ }
+
+ mImplementationp->mMapButtonp = getChild<LLButton>("map_button");
+
+ mImplementationp->mGroupParcelsp =
+ getChild<LLScrollListCtrl>("group_parcel_list");
+
+ if ( mImplementationp->mGroupParcelsp )
+ {
+ mImplementationp->mGroupParcelsp->setCommitCallback(boost::bind(&LLPanelGroupLandMoney::onLandSelectionChanged, this));
+ mImplementationp->mGroupParcelsp->setCommitOnSelectionChange(true);
+ }
+
+ mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text");
+ mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text");
+ mImplementationp->mEmptyParcelsText = getString("epmty_view_group_land_text");
+
+ if ( mImplementationp->mMapButtonp )
+ {
+ mImplementationp->mMapButtonp->setClickedCallback(LLPanelGroupLandMoney::impl::mapCallback, mImplementationp);
+ }
+
+ if ( mImplementationp->mGroupOverLimitTextp )
+ {
+ mImplementationp->mGroupOverLimitTextp->setVisible(FALSE);
+ }
+
+ if ( mImplementationp->mGroupOverLimitIconp )
+ {
+ mImplementationp->mGroupOverLimitIconp->setVisible(FALSE);
+ }
+
+ if ( !can_view )
+ {
+ if ( mImplementationp->mGroupParcelsp )
+ {
+ mImplementationp->mGroupParcelsp->setCommentText(
+ mImplementationp->mCantViewParcelsText);
+ mImplementationp->mGroupParcelsp->setEnabled(FALSE);
+ }
+ }
+
+
+
+ LLButton* earlierp, *laterp;
+ LLTextEditor* textp;
+ LLPanel* panelp;
+
+ LLTabContainer* tabcp = getChild<LLTabContainer>("group_money_tab_container");
+
+ if ( !can_view )
+ {
+ if ( tabcp )
+ {
+ S32 i;
+ S32 tab_count = tabcp->getTabCount();
+
+ for (i = tab_count - 1; i >=0; --i)
+ {
+ tabcp->enableTabButton(i, false);
+ }
+ }
+ }
+
+ std::string loading_text = getString("loading_txt");
+
+ //pull out the widgets for the L$ details tab
+ earlierp = getChild<LLButton>("earlier_details_button", true);
+ laterp = getChild<LLButton>("later_details_button", true);
+ textp = getChild<LLTextEditor>("group_money_details_text", true);
+ panelp = getChild<LLPanel>("group_money_details_tab", true);
+
+ if ( !can_view )
+ {
+ textp->setText(mImplementationp->mCantViewAccountsText);
+ }
+ else
+ {
+ mImplementationp->mMoneyDetailsTabEHp =
+ new LLGroupMoneyDetailsTabEventHandler(earlierp,
+ laterp,
+ textp,
+ tabcp,
+ panelp,
+ loading_text);
+ }
+
+ textp = getChild<LLTextEditor>("group_money_planning_text", true);
+ panelp = getChild<LLPanel>("group_money_planning_tab", true);
+
+ if ( !can_view )
+ {
+ textp->setText(mImplementationp->mCantViewAccountsText);
+ }
+ else
+ {
+ //Temporally disabled for DEV-11287.
+ mImplementationp->mMoneyPlanningTabEHp =
+ new LLGroupMoneyPlanningTabEventHandler(textp,
+ tabcp,
+ panelp,
+ loading_text);
+ }
+
+ //pull out the widgets for the L$ sales tab
+ earlierp = getChild<LLButton>("earlier_sales_button", true);
+ laterp = getChild<LLButton>("later_sales_button", true);
+ textp = getChild<LLTextEditor>("group_money_sales_text", true);
+ panelp = getChild<LLPanel>("group_money_sales_tab", true);
+
+ if ( !can_view )
+ {
+ textp->setText(mImplementationp->mCantViewAccountsText);
+ }
+ else
+ {
+ mImplementationp->mMoneySalesTabEHp =
+ new LLGroupMoneySalesTabEventHandler(earlierp,
+ laterp,
+ textp,
+ tabcp,
+ panelp,
+ loading_text);
+ }
+
+ return LLPanelGroupTab::postBuild();
}
void LLPanelGroupLandMoney::onLandSelectionChanged()
{
- mImplementationp->mMapButtonp->setEnabled( mImplementationp->mGroupParcelsp->getItemCount() > 0 );
+ mImplementationp->mMapButtonp->setEnabled( mImplementationp->mGroupParcelsp->getItemCount() > 0 );
}
BOOL LLPanelGroupLandMoney::isVisibleByAgent(LLAgent* agentp)
{
- return mAllowEdit && agentp->isInGroup(mGroupID);
+ return mAllowEdit && agentp->isInGroup(mGroupID);
}
void LLPanelGroupLandMoney::processPlacesReply(LLMessageSystem* msg, void**)
{
- LLUUID group_id;
- msg->getUUID("AgentData", "QueryID", group_id);
-
- group_id_map_t::iterator found_it = sGroupIDs.find(group_id);
- if(found_it == sGroupIDs.end())
- {
- LL_INFOS() << "Group Panel Land L$ " << group_id << " no longer in existence."
- << LL_ENDL;
- return;
- }
-
- found_it->second->mImplementationp->processGroupLand(msg);
+ LLUUID group_id;
+ msg->getUUID("AgentData", "QueryID", group_id);
+
+ group_id_map_t::iterator found_it = sGroupIDs.find(group_id);
+ if(found_it == sGroupIDs.end())
+ {
+ LL_INFOS() << "Group Panel Land L$ " << group_id << " no longer in existence."
+ << LL_ENDL;
+ return;
+ }
+
+ found_it->second->mImplementationp->processGroupLand(msg);
}
LLGroupMoneyTabEventHandlerImpl::LLGroupMoneyTabEventHandlerImpl(LLButton* earlier_buttonp,
- LLButton* later_buttonp,
- LLTextEditor* text_editorp,
- LLPanel* tabpanelp,
- const std::string& loading_text,
- S32 interval_length_days,
- S32 max_interval_days)
+ LLButton* later_buttonp,
+ LLTextEditor* text_editorp,
+ LLPanel* tabpanelp,
+ const std::string& loading_text,
+ S32 interval_length_days,
+ S32 max_interval_days)
{
- mPanelID.generate();
+ mPanelID.generate();
- mIntervalLength = interval_length_days;
- mMaxInterval = max_interval_days;
- mCurrentInterval = 0;
+ mIntervalLength = interval_length_days;
+ mMaxInterval = max_interval_days;
+ mCurrentInterval = 0;
- mTextEditorp = text_editorp;
- mEarlierButtonp = earlier_buttonp;
- mLaterButtonp = later_buttonp;
- mTabPanelp = tabpanelp;
+ mTextEditorp = text_editorp;
+ mEarlierButtonp = earlier_buttonp;
+ mLaterButtonp = later_buttonp;
+ mTabPanelp = tabpanelp;
- mLoadingText = loading_text;
+ mLoadingText = loading_text;
}
LLGroupMoneyTabEventHandlerImpl::~LLGroupMoneyTabEventHandlerImpl()
@@ -881,24 +881,24 @@ LLGroupMoneyTabEventHandlerImpl::~LLGroupMoneyTabEventHandlerImpl()
bool LLGroupMoneyTabEventHandlerImpl::getCanClickEarlier()
{
- return (mCurrentInterval < mMaxInterval);
+ return (mCurrentInterval < mMaxInterval);
}
bool LLGroupMoneyTabEventHandlerImpl::getCanClickLater()
{
- return ( mCurrentInterval > 0 );
+ return ( mCurrentInterval > 0 );
}
void LLGroupMoneyTabEventHandlerImpl::updateButtons()
{
- if ( mEarlierButtonp )
- {
- mEarlierButtonp->setEnabled(getCanClickEarlier());
- }
- if ( mLaterButtonp )
- {
- mLaterButtonp->setEnabled(getCanClickLater());
- }
+ if ( mEarlierButtonp )
+ {
+ mEarlierButtonp->setEnabled(getCanClickEarlier());
+ }
+ if ( mLaterButtonp )
+ {
+ mLaterButtonp->setEnabled(getCanClickLater());
+ }
}
//*******************************************
@@ -909,106 +909,106 @@ std::map<LLUUID, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sIns
std::map<LLPanel*, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sTabsToHandlers;
LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_buttonp,
- LLButton* later_buttonp,
- LLTextEditor* text_editorp,
- LLTabContainer* tab_containerp,
- LLPanel* panelp,
- const std::string& loading_text,
- S32 interval_length_days,
- S32 max_interval_days)
+ LLButton* later_buttonp,
+ LLTextEditor* text_editorp,
+ LLTabContainer* tab_containerp,
+ LLPanel* panelp,
+ const std::string& loading_text,
+ S32 interval_length_days,
+ S32 max_interval_days)
{
- mImplementationp = new LLGroupMoneyTabEventHandlerImpl(earlier_buttonp,
- later_buttonp,
- text_editorp,
- panelp,
- loading_text,
- interval_length_days,
- max_interval_days);
-
- if ( earlier_buttonp )
- {
- earlier_buttonp->setClickedCallback(clickEarlierCallback, this);
- }
-
- if ( later_buttonp )
- {
- later_buttonp->setClickedCallback(clickLaterCallback, this);
- }
-
- mImplementationp->updateButtons();
-
- if ( tab_containerp && panelp )
- {
- tab_containerp->setCommitCallback(boost::bind(&LLGroupMoneyTabEventHandler::onClickTab, this));
- }
-
- sInstanceIDs.insert(std::make_pair(mImplementationp->mPanelID, this));
- sTabsToHandlers[panelp] = this;
+ mImplementationp = new LLGroupMoneyTabEventHandlerImpl(earlier_buttonp,
+ later_buttonp,
+ text_editorp,
+ panelp,
+ loading_text,
+ interval_length_days,
+ max_interval_days);
+
+ if ( earlier_buttonp )
+ {
+ earlier_buttonp->setClickedCallback(clickEarlierCallback, this);
+ }
+
+ if ( later_buttonp )
+ {
+ later_buttonp->setClickedCallback(clickLaterCallback, this);
+ }
+
+ mImplementationp->updateButtons();
+
+ if ( tab_containerp && panelp )
+ {
+ tab_containerp->setCommitCallback(boost::bind(&LLGroupMoneyTabEventHandler::onClickTab, this));
+ }
+
+ sInstanceIDs.insert(std::make_pair(mImplementationp->mPanelID, this));
+ sTabsToHandlers[panelp] = this;
}
LLGroupMoneyTabEventHandler::~LLGroupMoneyTabEventHandler()
{
- sInstanceIDs.erase(mImplementationp->mPanelID);
- sTabsToHandlers.erase(mImplementationp->mTabPanelp);
+ sInstanceIDs.erase(mImplementationp->mPanelID);
+ sTabsToHandlers.erase(mImplementationp->mTabPanelp);
- delete mImplementationp;
+ delete mImplementationp;
}
void LLGroupMoneyTabEventHandler::onClickTab()
{
- requestData(gMessageSystem);
+ requestData(gMessageSystem);
}
void LLGroupMoneyTabEventHandler::requestData(LLMessageSystem* msg)
{
- //do nothing
+ //do nothing
}
void LLGroupMoneyTabEventHandler::processReply(LLMessageSystem* msg, void** data)
{
- //do nothing
+ //do nothing
}
void LLGroupMoneyTabEventHandler::onClickEarlier()
{
- if ( mImplementationp->mTextEditorp)
- {
- mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
- }
- mImplementationp->mCurrentInterval++;
+ if ( mImplementationp->mTextEditorp)
+ {
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
+ }
+ mImplementationp->mCurrentInterval++;
- mImplementationp->updateButtons();
+ mImplementationp->updateButtons();
- requestData(gMessageSystem);
+ requestData(gMessageSystem);
}
void LLGroupMoneyTabEventHandler::onClickLater()
{
- if ( mImplementationp->mTextEditorp )
- {
- mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
- }
- mImplementationp->mCurrentInterval--;
+ if ( mImplementationp->mTextEditorp )
+ {
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
+ }
+ mImplementationp->mCurrentInterval--;
- mImplementationp->updateButtons();
+ mImplementationp->updateButtons();
- requestData(gMessageSystem);
+ requestData(gMessageSystem);
}
//static
void LLGroupMoneyTabEventHandler::clickEarlierCallback(void* data)
{
- LLGroupMoneyTabEventHandler* selfp = (LLGroupMoneyTabEventHandler*) data;
+ LLGroupMoneyTabEventHandler* selfp = (LLGroupMoneyTabEventHandler*) data;
- if ( selfp ) selfp->onClickEarlier();
+ if ( selfp ) selfp->onClickEarlier();
}
//static
void LLGroupMoneyTabEventHandler::clickLaterCallback(void* data)
{
- LLGroupMoneyTabEventHandler* selfp = (LLGroupMoneyTabEventHandler*) data;
- if ( selfp ) selfp->onClickLater();
+ LLGroupMoneyTabEventHandler* selfp = (LLGroupMoneyTabEventHandler*) data;
+ if ( selfp ) selfp->onClickLater();
}
//**************************************************
@@ -1016,19 +1016,19 @@ void LLGroupMoneyTabEventHandler::clickLaterCallback(void* data)
//**************************************************
LLGroupMoneyDetailsTabEventHandler::LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp,
- LLButton* later_buttonp,
- LLTextEditor* text_editorp,
- LLTabContainer* tab_containerp,
- LLPanel* panelp,
- const std::string& loading_text)
- : LLGroupMoneyTabEventHandler(earlier_buttonp,
- later_buttonp,
- text_editorp,
- tab_containerp,
- panelp,
- loading_text,
- SUMMARY_INTERVAL,
- SUMMARY_MAX)
+ LLButton* later_buttonp,
+ LLTextEditor* text_editorp,
+ LLTabContainer* tab_containerp,
+ LLPanel* panelp,
+ const std::string& loading_text)
+ : LLGroupMoneyTabEventHandler(earlier_buttonp,
+ later_buttonp,
+ text_editorp,
+ tab_containerp,
+ panelp,
+ loading_text,
+ SUMMARY_INTERVAL,
+ SUMMARY_MAX)
{
}
@@ -1038,118 +1038,118 @@ LLGroupMoneyDetailsTabEventHandler::~LLGroupMoneyDetailsTabEventHandler()
void LLGroupMoneyDetailsTabEventHandler::requestData(LLMessageSystem* msg)
{
- msg->newMessageFast(_PREHASH_GroupAccountDetailsRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->getGroupID() );
- msg->nextBlockFast(_PREHASH_MoneyData);
- msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID );
- msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength );
- msg->addS32Fast(_PREHASH_CurrentInterval, mImplementationp->mCurrentInterval);
-
- gAgent.sendReliableMessage();
-
- if ( mImplementationp->mTextEditorp )
- {
- mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
- }
-
- LLGroupMoneyTabEventHandler::requestData(msg);
+ msg->newMessageFast(_PREHASH_GroupAccountDetailsRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->getGroupID() );
+ msg->nextBlockFast(_PREHASH_MoneyData);
+ msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID );
+ msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength );
+ msg->addS32Fast(_PREHASH_CurrentInterval, mImplementationp->mCurrentInterval);
+
+ gAgent.sendReliableMessage();
+
+ if ( mImplementationp->mTextEditorp )
+ {
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
+ }
+
+ LLGroupMoneyTabEventHandler::requestData(msg);
}
-void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg,
- void** data)
+void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg,
+ void** data)
{
- LLUUID group_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
- if (mImplementationp->getGroupID() != group_id)
- {
- LL_WARNS() << "Group Account details not for this group!" << LL_ENDL;
- return;
- }
-
- std::string start_date;
- S32 interval_days;
- S32 current_interval;
-
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval );
- msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, start_date);
-
- std::string time_str = LLTrans::getString("GroupMoneyStartDate");
- LLSD substitution;
-
- // We don't do time zone corrections of the calculated number of seconds
- // because we don't have a full time stamp, only a date.
- substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", start_date);
- LLStringUtil::format (time_str, substitution);
-
- if ( interval_days != mImplementationp->mIntervalLength ||
- current_interval != mImplementationp->mCurrentInterval )
- {
- LL_INFOS() << "Out of date details packet " << interval_days << " "
- << current_interval << LL_ENDL;
- return;
- }
-
- std::string text = time_str;
- text.append("\n\n");
-
- S32 total_amount = 0;
- S32 transactions = msg->getNumberOfBlocksFast(_PREHASH_HistoryData);
- for(S32 i = 0; i < transactions; i++)
- {
- S32 amount = 0;
- std::string desc;
-
- msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Description, desc, i );
- msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i);
-
- if (amount != 0)
- {
- text.append(llformat("%-24s %6d\n", desc.c_str(), amount));
- }
- else
- {
- // skip it
- }
-
- total_amount += amount;
- }
-
- text.append(1, '\n');
-
- text.append(llformat("%-24s %6d\n", LLTrans::getString("GroupMoneyTotal").c_str(), total_amount));
-
- if ( mImplementationp->mTextEditorp )
- {
- mImplementationp->mTextEditorp->setText(text);
- }
+ LLUUID group_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
+ if (mImplementationp->getGroupID() != group_id)
+ {
+ LL_WARNS() << "Group Account details not for this group!" << LL_ENDL;
+ return;
+ }
+
+ std::string start_date;
+ S32 interval_days;
+ S32 current_interval;
+
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval );
+ msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, start_date);
+
+ std::string time_str = LLTrans::getString("GroupMoneyStartDate");
+ LLSD substitution;
+
+ // We don't do time zone corrections of the calculated number of seconds
+ // because we don't have a full time stamp, only a date.
+ substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", start_date);
+ LLStringUtil::format (time_str, substitution);
+
+ if ( interval_days != mImplementationp->mIntervalLength ||
+ current_interval != mImplementationp->mCurrentInterval )
+ {
+ LL_INFOS() << "Out of date details packet " << interval_days << " "
+ << current_interval << LL_ENDL;
+ return;
+ }
+
+ std::string text = time_str;
+ text.append("\n\n");
+
+ S32 total_amount = 0;
+ S32 transactions = msg->getNumberOfBlocksFast(_PREHASH_HistoryData);
+ for(S32 i = 0; i < transactions; i++)
+ {
+ S32 amount = 0;
+ std::string desc;
+
+ msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Description, desc, i );
+ msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i);
+
+ if (amount != 0)
+ {
+ text.append(llformat("%-24s %6d\n", desc.c_str(), amount));
+ }
+ else
+ {
+ // skip it
+ }
+
+ total_amount += amount;
+ }
+
+ text.append(1, '\n');
+
+ text.append(llformat("%-24s %6d\n", LLTrans::getString("GroupMoneyTotal").c_str(), total_amount));
+
+ if ( mImplementationp->mTextEditorp )
+ {
+ mImplementationp->mTextEditorp->setText(text);
+ }
}
//static
-void LLPanelGroupLandMoney::processGroupAccountDetailsReply(LLMessageSystem* msg,
- void** data)
+void LLPanelGroupLandMoney::processGroupAccountDetailsReply(LLMessageSystem* msg,
+ void** data)
{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- if (gAgent.getID() != agent_id)
- {
- LL_WARNS() << "Got group L$ history reply for another agent!" << LL_ENDL;
- return;
- }
-
- LLUUID request_id;
- msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
- LLGroupMoneyTabEventHandler* selfp = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id);
- if (!selfp)
- {
- LL_WARNS() << "GroupAccountDetails received for non-existent group panel." << LL_ENDL;
- return;
- }
-
- selfp->processReply(msg, data);
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ if (gAgent.getID() != agent_id)
+ {
+ LL_WARNS() << "Got group L$ history reply for another agent!" << LL_ENDL;
+ return;
+ }
+
+ LLUUID request_id;
+ msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
+ LLGroupMoneyTabEventHandler* selfp = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id);
+ if (!selfp)
+ {
+ LL_WARNS() << "GroupAccountDetails received for non-existent group panel." << LL_ENDL;
+ return;
+ }
+
+ selfp->processReply(msg, data);
}
//************************************************
@@ -1157,19 +1157,19 @@ void LLPanelGroupLandMoney::processGroupAccountDetailsReply(LLMessageSystem* msg
//************************************************
LLGroupMoneySalesTabEventHandler::LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp,
- LLButton* later_buttonp,
- LLTextEditor* text_editorp,
- LLTabContainer* tab_containerp,
- LLPanel* panelp,
- const std::string& loading_text)
- : LLGroupMoneyTabEventHandler(earlier_buttonp,
- later_buttonp,
- text_editorp,
- tab_containerp,
- panelp,
- loading_text,
- SUMMARY_INTERVAL,
- SUMMARY_MAX)
+ LLButton* later_buttonp,
+ LLTextEditor* text_editorp,
+ LLTabContainer* tab_containerp,
+ LLPanel* panelp,
+ const std::string& loading_text)
+ : LLGroupMoneyTabEventHandler(earlier_buttonp,
+ later_buttonp,
+ text_editorp,
+ tab_containerp,
+ panelp,
+ loading_text,
+ SUMMARY_INTERVAL,
+ SUMMARY_MAX)
{
}
@@ -1179,157 +1179,157 @@ LLGroupMoneySalesTabEventHandler::~LLGroupMoneySalesTabEventHandler()
void LLGroupMoneySalesTabEventHandler::requestData(LLMessageSystem* msg)
{
- msg->newMessageFast(_PREHASH_GroupAccountTransactionsRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->getGroupID() );
- msg->nextBlockFast(_PREHASH_MoneyData);
- msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID );
- msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength );
- msg->addS32Fast(_PREHASH_CurrentInterval, mImplementationp->mCurrentInterval);
-
- gAgent.sendReliableMessage();
-
- if ( mImplementationp->mTextEditorp )
- {
- mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
- }
-
- LLGroupMoneyTabEventHandler::requestData(msg);
+ msg->newMessageFast(_PREHASH_GroupAccountTransactionsRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->getGroupID() );
+ msg->nextBlockFast(_PREHASH_MoneyData);
+ msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID );
+ msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength );
+ msg->addS32Fast(_PREHASH_CurrentInterval, mImplementationp->mCurrentInterval);
+
+ gAgent.sendReliableMessage();
+
+ if ( mImplementationp->mTextEditorp )
+ {
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
+ }
+
+ LLGroupMoneyTabEventHandler::requestData(msg);
}
-void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg,
- void** data)
+void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg,
+ void** data)
{
- LLUUID group_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
- if (mImplementationp->getGroupID() != group_id)
- {
- LL_WARNS() << "Group Account Transactions not for this group!" << LL_ENDL;
- return;
- }
-
- std::string text = mImplementationp->mTextEditorp->getText();
-
- std::string start_date;
- S32 interval_days;
- S32 current_interval;
-
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval );
- msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, start_date);
-
- if (interval_days != mImplementationp->mIntervalLength ||
- current_interval != mImplementationp->mCurrentInterval)
- {
- LL_INFOS() << "Out of date details packet " << interval_days << " "
- << current_interval << LL_ENDL;
- return;
- }
-
- // If this is the first packet, clear the text, don't append.
- // Start with the date.
- if (text == mImplementationp->mLoadingText)
- {
- std::string time_str = LLTrans::getString("GroupMoneyStartDate");
- LLSD substitution;
-
- // We don't do time zone corrections of the calculated number of seconds
- // because we don't have a full time stamp, only a date.
- substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", start_date);
- LLStringUtil::format (time_str, substitution);
-
- text = time_str + "\n\n";
- }
-
- S32 transactions = msg->getNumberOfBlocksFast(_PREHASH_HistoryData);
- if (transactions == 0)
- {
- text.append(LLTrans::getString("none_text"));
- }
- else
- {
- for(S32 i = 0; i < transactions; i++)
- {
- std::string time;
- S32 type = 0;
- S32 amount = 0;
- std::string user;
- std::string item;
-
- msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Time, time, i);
- msg->getStringFast(_PREHASH_HistoryData, _PREHASH_User, user, i );
- msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Type, type, i);
- msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Item, item, i );
- msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i);
-
- if (amount != 0)
- {
- std::string verb;
-
- switch(type)
- {
- case TRANS_OBJECT_SALE:
- verb = LLTrans::getString("GroupMoneyBought").c_str();
- break;
- case TRANS_GIFT:
- verb = LLTrans::getString("GroupMoneyPaidYou").c_str();
- break;
- case TRANS_PAY_OBJECT:
- verb = LLTrans::getString("GroupMoneyPaidInto").c_str();
- break;
- case TRANS_LAND_PASS_SALE:
- verb = LLTrans::getString("GroupMoneyBoughtPassTo").c_str();
- break;
- case TRANS_EVENT_FEE:
- verb = LLTrans::getString("GroupMoneyPaidFeeForEvent").c_str();
- break;
- case TRANS_EVENT_PRIZE:
- verb = LLTrans::getString("GroupMoneyPaidPrizeForEvent").c_str();
- break;
- default:
- verb = "";
- break;
- }
-
- std::string line = llformat("%s %6d - %s %s %s\n", time.c_str(), amount, user.c_str(), verb.c_str(), item.c_str());
- text.append(line);
- }
- }
- }
-
- if ( mImplementationp->mTextEditorp)
- {
- mImplementationp->mTextEditorp->setText(text);
- }
+ LLUUID group_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
+ if (mImplementationp->getGroupID() != group_id)
+ {
+ LL_WARNS() << "Group Account Transactions not for this group!" << LL_ENDL;
+ return;
+ }
+
+ std::string text = mImplementationp->mTextEditorp->getText();
+
+ std::string start_date;
+ S32 interval_days;
+ S32 current_interval;
+
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval );
+ msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, start_date);
+
+ if (interval_days != mImplementationp->mIntervalLength ||
+ current_interval != mImplementationp->mCurrentInterval)
+ {
+ LL_INFOS() << "Out of date details packet " << interval_days << " "
+ << current_interval << LL_ENDL;
+ return;
+ }
+
+ // If this is the first packet, clear the text, don't append.
+ // Start with the date.
+ if (text == mImplementationp->mLoadingText)
+ {
+ std::string time_str = LLTrans::getString("GroupMoneyStartDate");
+ LLSD substitution;
+
+ // We don't do time zone corrections of the calculated number of seconds
+ // because we don't have a full time stamp, only a date.
+ substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", start_date);
+ LLStringUtil::format (time_str, substitution);
+
+ text = time_str + "\n\n";
+ }
+
+ S32 transactions = msg->getNumberOfBlocksFast(_PREHASH_HistoryData);
+ if (transactions == 0)
+ {
+ text.append(LLTrans::getString("none_text"));
+ }
+ else
+ {
+ for(S32 i = 0; i < transactions; i++)
+ {
+ std::string time;
+ S32 type = 0;
+ S32 amount = 0;
+ std::string user;
+ std::string item;
+
+ msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Time, time, i);
+ msg->getStringFast(_PREHASH_HistoryData, _PREHASH_User, user, i );
+ msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Type, type, i);
+ msg->getStringFast(_PREHASH_HistoryData, _PREHASH_Item, item, i );
+ msg->getS32Fast(_PREHASH_HistoryData, _PREHASH_Amount, amount, i);
+
+ if (amount != 0)
+ {
+ std::string verb;
+
+ switch(type)
+ {
+ case TRANS_OBJECT_SALE:
+ verb = LLTrans::getString("GroupMoneyBought").c_str();
+ break;
+ case TRANS_GIFT:
+ verb = LLTrans::getString("GroupMoneyPaidYou").c_str();
+ break;
+ case TRANS_PAY_OBJECT:
+ verb = LLTrans::getString("GroupMoneyPaidInto").c_str();
+ break;
+ case TRANS_LAND_PASS_SALE:
+ verb = LLTrans::getString("GroupMoneyBoughtPassTo").c_str();
+ break;
+ case TRANS_EVENT_FEE:
+ verb = LLTrans::getString("GroupMoneyPaidFeeForEvent").c_str();
+ break;
+ case TRANS_EVENT_PRIZE:
+ verb = LLTrans::getString("GroupMoneyPaidPrizeForEvent").c_str();
+ break;
+ default:
+ verb = "";
+ break;
+ }
+
+ std::string line = llformat("%s %6d - %s %s %s\n", time.c_str(), amount, user.c_str(), verb.c_str(), item.c_str());
+ text.append(line);
+ }
+ }
+ }
+
+ if ( mImplementationp->mTextEditorp)
+ {
+ mImplementationp->mTextEditorp->setText(text);
+ }
}
//static
-void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem* msg,
- void** data)
+void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem* msg,
+ void** data)
{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- if (gAgent.getID() != agent_id)
- {
- LL_WARNS() << "Got group L$ history reply for another agent!" << LL_ENDL;
- return;
- }
-
- LLUUID request_id;
- msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
-
- LLGroupMoneyTabEventHandler* self;
-
- self = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id);
- if (!self)
- {
- LL_WARNS() << "GroupAccountTransactions recieved for non-existent group panel." << LL_ENDL;
- return;
- }
-
- self->processReply(msg, data);
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ if (gAgent.getID() != agent_id)
+ {
+ LL_WARNS() << "Got group L$ history reply for another agent!" << LL_ENDL;
+ return;
+ }
+
+ LLUUID request_id;
+ msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
+
+ LLGroupMoneyTabEventHandler* self;
+
+ self = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id);
+ if (!self)
+ {
+ LL_WARNS() << "GroupAccountTransactions recieved for non-existent group panel." << LL_ENDL;
+ return;
+ }
+
+ self->processReply(msg, data);
}
//***************************************************
@@ -1337,17 +1337,17 @@ void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem
//***************************************************
LLGroupMoneyPlanningTabEventHandler::LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editorp,
- LLTabContainer* tab_containerp,
- LLPanel* panelp,
- const std::string& loading_text)
- : LLGroupMoneyTabEventHandler(NULL,
- NULL,
- text_editorp,
- tab_containerp,
- panelp,
- loading_text,
- SUMMARY_INTERVAL,
- SUMMARY_MAX)
+ LLTabContainer* tab_containerp,
+ LLPanel* panelp,
+ const std::string& loading_text)
+ : LLGroupMoneyTabEventHandler(NULL,
+ NULL,
+ text_editorp,
+ tab_containerp,
+ panelp,
+ loading_text,
+ SUMMARY_INTERVAL,
+ SUMMARY_MAX)
{
}
@@ -1357,296 +1357,296 @@ LLGroupMoneyPlanningTabEventHandler::~LLGroupMoneyPlanningTabEventHandler()
void LLGroupMoneyPlanningTabEventHandler::requestData(LLMessageSystem* msg)
{
- msg->newMessageFast(_PREHASH_GroupAccountSummaryRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->getGroupID() );
- msg->nextBlockFast(_PREHASH_MoneyData);
- msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID );
- msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength);
- msg->addS32Fast(_PREHASH_CurrentInterval, 0); //planning has 0 interval
-
- gAgent.sendReliableMessage();
-
- if ( mImplementationp->mTextEditorp )
- {
- mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
- }
-
- LLGroupMoneyTabEventHandler::requestData(msg);
+ msg->newMessageFast(_PREHASH_GroupAccountSummaryRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->addUUIDFast(_PREHASH_GroupID, mImplementationp->getGroupID() );
+ msg->nextBlockFast(_PREHASH_MoneyData);
+ msg->addUUIDFast(_PREHASH_RequestID, mImplementationp->mPanelID );
+ msg->addS32Fast(_PREHASH_IntervalDays, mImplementationp->mIntervalLength);
+ msg->addS32Fast(_PREHASH_CurrentInterval, 0); //planning has 0 interval
+
+ gAgent.sendReliableMessage();
+
+ if ( mImplementationp->mTextEditorp )
+ {
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
+ }
+
+ LLGroupMoneyTabEventHandler::requestData(msg);
}
-void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg,
- void** data)
+void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg,
+ void** data)
{
- LLUUID group_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
- if (mImplementationp->getGroupID() != group_id)
- {
- LL_WARNS() << "Group Account Summary received not for this group!" << LL_ENDL;
- return;
- }
-
- std::string text;
-
- std::string start_date;
- std::string last_stipend_date;
- std::string next_stipend_date;
- S32 interval_days;
- S32 current_interval;
- S32 balance;
- S32 total_credits;
- S32 total_debits;
- S32 cur_object_tax;
- S32 cur_light_tax;
- S32 cur_land_tax;
- S32 cur_group_tax;
- S32 cur_parcel_dir_fee;
- S32 proj_object_tax;
- S32 proj_light_tax;
- S32 proj_land_tax;
- S32 proj_group_tax;
- S32 proj_parcel_dir_fee;
- S32 non_exempt_members;
-
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_Balance, balance );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_TotalCredits, total_credits );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_TotalDebits, total_debits );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ObjectTaxCurrent, cur_object_tax );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LightTaxCurrent, cur_light_tax );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LandTaxCurrent, cur_land_tax );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_GroupTaxCurrent, cur_group_tax );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ParcelDirFeeCurrent, cur_parcel_dir_fee );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ObjectTaxEstimate, proj_object_tax );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LightTaxEstimate, proj_light_tax );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LandTaxEstimate, proj_land_tax );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_GroupTaxEstimate, proj_group_tax );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ParcelDirFeeEstimate, proj_parcel_dir_fee );
- msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_NonExemptMembers, non_exempt_members );
-
- msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, start_date);
- msg->getStringFast(_PREHASH_MoneyData, _PREHASH_LastTaxDate, last_stipend_date);
- msg->getStringFast(_PREHASH_MoneyData, _PREHASH_TaxDate, next_stipend_date);
-
-
- if (interval_days != mImplementationp->mIntervalLength ||
- current_interval != mImplementationp->mCurrentInterval)
- {
- LL_INFOS() << "Out of date summary packet " << interval_days << " "
- << current_interval << LL_ENDL;
- return;
- }
-
- text.append(LLTrans::getString("SummaryForTheWeek"));
-
- std::string date_format_str = LLTrans::getString("GroupPlanningDate");
- std::string time_str = date_format_str;
- LLSD substitution;
- // We don't do time zone corrections of the calculated number of seconds
- // because we don't have a full time stamp, only a date.
- substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", start_date);
- LLStringUtil::format (time_str, substitution);
-
- text.append(time_str);
- text.append(". ");
-
- if (current_interval == 0)
- {
- text.append(LLTrans::getString("NextStipendDay"));
-
- time_str = date_format_str;
- substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", next_stipend_date);
- LLStringUtil::format (time_str, substitution);
-
- text.append(time_str);
- text.append(".\n\n");
- text.append(llformat("%-23sL$%6d\n", LLTrans::getString("GroupMoneyBalance").c_str(), balance ));
- text.append(1, '\n');
- }
-
- // [DEV-29503] Hide the individual info since
- // non_exempt_member here is a wrong choice to calculate individual shares.
-// text.append( LLTrans::getString("GroupIndividualShare"));
-// text.append(llformat( "%-24s %6d %6d \n", LLTrans::getString("GroupMoneyCredits").c_str(), total_credits, (S32)floor((F32)total_credits/(F32)non_exempt_members)));
-// text.append(llformat( "%-24s %6d %6d \n", LLTrans::getString("GroupMoneyDebits").c_str(), total_debits, (S32)floor((F32)total_debits/(F32)non_exempt_members)));
-// text.append(llformat( "%-24s %6d %6d \n", LLTrans::getString("GroupMoneyTotal").c_str(), total_credits + total_debits, (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members)));
-
- text.append(llformat( "%s\n", LLTrans::getString("GroupColumn").c_str()));
- text.append(llformat( "%-24s %6d\n", LLTrans::getString("GroupMoneyCredits").c_str(), total_credits));
- text.append(llformat( "%-24s %6d\n", LLTrans::getString("GroupMoneyDebits").c_str(), total_debits));
- text.append(llformat( "%-24s %6d\n", LLTrans::getString("GroupMoneyTotal").c_str(), total_credits + total_debits));
-
- if ( mImplementationp->mTextEditorp )
- {
- mImplementationp->mTextEditorp->setText(text);
- }
+ LLUUID group_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id );
+ if (mImplementationp->getGroupID() != group_id)
+ {
+ LL_WARNS() << "Group Account Summary received not for this group!" << LL_ENDL;
+ return;
+ }
+
+ std::string text;
+
+ std::string start_date;
+ std::string last_stipend_date;
+ std::string next_stipend_date;
+ S32 interval_days;
+ S32 current_interval;
+ S32 balance;
+ S32 total_credits;
+ S32 total_debits;
+ S32 cur_object_tax;
+ S32 cur_light_tax;
+ S32 cur_land_tax;
+ S32 cur_group_tax;
+ S32 cur_parcel_dir_fee;
+ S32 proj_object_tax;
+ S32 proj_light_tax;
+ S32 proj_land_tax;
+ S32 proj_group_tax;
+ S32 proj_parcel_dir_fee;
+ S32 non_exempt_members;
+
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_IntervalDays, interval_days );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_CurrentInterval, current_interval );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_Balance, balance );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_TotalCredits, total_credits );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_TotalDebits, total_debits );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ObjectTaxCurrent, cur_object_tax );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LightTaxCurrent, cur_light_tax );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LandTaxCurrent, cur_land_tax );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_GroupTaxCurrent, cur_group_tax );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ParcelDirFeeCurrent, cur_parcel_dir_fee );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ObjectTaxEstimate, proj_object_tax );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LightTaxEstimate, proj_light_tax );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_LandTaxEstimate, proj_land_tax );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_GroupTaxEstimate, proj_group_tax );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_ParcelDirFeeEstimate, proj_parcel_dir_fee );
+ msg->getS32Fast(_PREHASH_MoneyData, _PREHASH_NonExemptMembers, non_exempt_members );
+
+ msg->getStringFast(_PREHASH_MoneyData, _PREHASH_StartDate, start_date);
+ msg->getStringFast(_PREHASH_MoneyData, _PREHASH_LastTaxDate, last_stipend_date);
+ msg->getStringFast(_PREHASH_MoneyData, _PREHASH_TaxDate, next_stipend_date);
+
+
+ if (interval_days != mImplementationp->mIntervalLength ||
+ current_interval != mImplementationp->mCurrentInterval)
+ {
+ LL_INFOS() << "Out of date summary packet " << interval_days << " "
+ << current_interval << LL_ENDL;
+ return;
+ }
+
+ text.append(LLTrans::getString("SummaryForTheWeek"));
+
+ std::string date_format_str = LLTrans::getString("GroupPlanningDate");
+ std::string time_str = date_format_str;
+ LLSD substitution;
+ // We don't do time zone corrections of the calculated number of seconds
+ // because we don't have a full time stamp, only a date.
+ substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", start_date);
+ LLStringUtil::format (time_str, substitution);
+
+ text.append(time_str);
+ text.append(". ");
+
+ if (current_interval == 0)
+ {
+ text.append(LLTrans::getString("NextStipendDay"));
+
+ time_str = date_format_str;
+ substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", next_stipend_date);
+ LLStringUtil::format (time_str, substitution);
+
+ text.append(time_str);
+ text.append(".\n\n");
+ text.append(llformat("%-23sL$%6d\n", LLTrans::getString("GroupMoneyBalance").c_str(), balance ));
+ text.append(1, '\n');
+ }
+
+ // [DEV-29503] Hide the individual info since
+ // non_exempt_member here is a wrong choice to calculate individual shares.
+// text.append( LLTrans::getString("GroupIndividualShare"));
+// text.append(llformat( "%-24s %6d %6d \n", LLTrans::getString("GroupMoneyCredits").c_str(), total_credits, (S32)floor((F32)total_credits/(F32)non_exempt_members)));
+// text.append(llformat( "%-24s %6d %6d \n", LLTrans::getString("GroupMoneyDebits").c_str(), total_debits, (S32)floor((F32)total_debits/(F32)non_exempt_members)));
+// text.append(llformat( "%-24s %6d %6d \n", LLTrans::getString("GroupMoneyTotal").c_str(), total_credits + total_debits, (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members)));
+
+ text.append(llformat( "%s\n", LLTrans::getString("GroupColumn").c_str()));
+ text.append(llformat( "%-24s %6d\n", LLTrans::getString("GroupMoneyCredits").c_str(), total_credits));
+ text.append(llformat( "%-24s %6d\n", LLTrans::getString("GroupMoneyDebits").c_str(), total_debits));
+ text.append(llformat( "%-24s %6d\n", LLTrans::getString("GroupMoneyTotal").c_str(), total_credits + total_debits));
+
+ if ( mImplementationp->mTextEditorp )
+ {
+ mImplementationp->mTextEditorp->setText(text);
+ }
}
//static
-void LLPanelGroupLandMoney::processGroupAccountSummaryReply(LLMessageSystem* msg,
- void** data)
+void LLPanelGroupLandMoney::processGroupAccountSummaryReply(LLMessageSystem* msg,
+ void** data)
{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
- if (gAgent.getID() != agent_id)
- {
- LL_WARNS() << "Got group L$ history reply for another agent!" << LL_ENDL;
- return;
- }
-
- LLUUID request_id;
- msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
-
- LLGroupMoneyTabEventHandler* self;
-
- self = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id);
- if (!self)
- {
- LL_WARNS() << "GroupAccountSummary recieved for non-existent group L$ planning tab." << LL_ENDL;
- return;
- }
-
- self->processReply(msg, data);
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+ if (gAgent.getID() != agent_id)
+ {
+ LL_WARNS() << "Got group L$ history reply for another agent!" << LL_ENDL;
+ return;
+ }
+
+ LLUUID request_id;
+ msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
+
+ LLGroupMoneyTabEventHandler* self;
+
+ self = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id);
+ if (!self)
+ {
+ LL_WARNS() << "GroupAccountSummary recieved for non-existent group L$ planning tab." << LL_ENDL;
+ return;
+ }
+
+ self->processReply(msg, data);
}
void LLPanelGroupLandMoney::setGroupID(const LLUUID& id)
{
- LLPanelGroupLandMoney::sGroupIDs.erase(mGroupID);
- LLPanelGroupTab::setGroupID(id);
- LLPanelGroupLandMoney::sGroupIDs.insert(std::make_pair(mGroupID, this));
-
-
- bool can_view = gAgent.isInGroup(mGroupID);
-
- mImplementationp->mGroupOverLimitIconp =
- getChild<LLIconCtrl>("group_over_limit_icon");
- mImplementationp->mGroupOverLimitTextp =
- getChild<LLTextBox>("group_over_limit_text");
-
- mImplementationp->mYourContributionEditorp
- = getChild<LLLineEditor>("your_contribution_line_editor");
- if ( mImplementationp->mYourContributionEditorp )
- {
- LLLineEditor* editor = mImplementationp->mYourContributionEditorp;
-
- editor->setCommitCallback(mImplementationp->contributionCommitCallback, this);
- editor->setKeystrokeCallback(mImplementationp->contributionKeystrokeCallback, this);
- }
-
- mImplementationp->mMapButtonp = getChild<LLButton>("map_button");
-
- mImplementationp->mGroupParcelsp =
- getChild<LLScrollListCtrl>("group_parcel_list");
-
- if ( mImplementationp->mGroupParcelsp )
- {
- mImplementationp->mGroupParcelsp->setCommitCallback(boost::bind(&LLPanelGroupLandMoney::onLandSelectionChanged, this));
- mImplementationp->mGroupParcelsp->setCommitOnSelectionChange(true);
- }
-
- mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text");
- mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text");
-
- if ( mImplementationp->mMapButtonp )
- {
- mImplementationp->mMapButtonp->setClickedCallback(LLPanelGroupLandMoney::impl::mapCallback, mImplementationp);
- }
-
- if ( mImplementationp->mGroupOverLimitTextp )
- {
- mImplementationp->mGroupOverLimitTextp->setVisible(FALSE);
- }
-
- if ( mImplementationp->mGroupOverLimitIconp )
- {
- mImplementationp->mGroupOverLimitIconp->setVisible(FALSE);
- }
-
- if ( mImplementationp->mGroupParcelsp )
- {
- mImplementationp->mGroupParcelsp->setEnabled(can_view);
- }
-
- if ( !can_view && mImplementationp->mGroupParcelsp )
- {
- mImplementationp->mGroupParcelsp->setEnabled(FALSE);
- }
-
-
- LLButton* earlierp, *laterp;
- LLTextEditor* textp;
- LLPanel* panelp;
-
- LLTabContainer* tabcp = getChild<LLTabContainer>("group_money_tab_container");
-
- if ( tabcp )
- {
- S32 i;
- S32 tab_count = tabcp->getTabCount();
-
- for (i = tab_count - 1; i >=0; --i)
- {
- tabcp->enableTabButton(i, can_view );
- }
- }
-
- std::string loading_text = getString("loading_txt");
-
- //pull out the widgets for the L$ details tab
- earlierp = getChild<LLButton>("earlier_details_button", true);
- laterp = getChild<LLButton>("later_details_button", true);
- textp = getChild<LLTextEditor>("group_money_details_text", true);
- panelp = getChild<LLPanel>("group_money_details_tab", true);
-
- if ( !can_view )
- {
- textp->setText(mImplementationp->mCantViewAccountsText);
- }
- else
- {
- if(mImplementationp->mMoneyDetailsTabEHp == 0)
- mImplementationp->mMoneyDetailsTabEHp = new LLGroupMoneyDetailsTabEventHandler(earlierp,laterp,textp,tabcp,panelp,loading_text);
- mImplementationp->mMoneyDetailsTabEHp->setGroupID(mGroupID);
- }
-
- textp = getChild<LLTextEditor>("group_money_planning_text", true);
-
-
- if ( !can_view )
- {
- textp->setText(mImplementationp->mCantViewAccountsText);
- }
- else
- {
- panelp = getChild<LLPanel>("group_money_planning_tab", true);
- if(mImplementationp->mMoneyPlanningTabEHp == 0)
- mImplementationp->mMoneyPlanningTabEHp = new LLGroupMoneyPlanningTabEventHandler(textp,tabcp,panelp,loading_text);
- mImplementationp->mMoneyPlanningTabEHp->setGroupID(mGroupID);
- }
-
- //pull out the widgets for the L$ sales tab
- textp = getChild<LLTextEditor>("group_money_sales_text", true);
-
-
- if ( !can_view )
- {
- textp->setText(mImplementationp->mCantViewAccountsText);
- }
- else
- {
- earlierp = getChild<LLButton>("earlier_sales_button", true);
- laterp = getChild<LLButton>("later_sales_button", true);
- panelp = getChild<LLPanel>("group_money_sales_tab", true);
- if(mImplementationp->mMoneySalesTabEHp == NULL)
- mImplementationp->mMoneySalesTabEHp = new LLGroupMoneySalesTabEventHandler(earlierp,laterp,textp,tabcp,panelp,loading_text);
- mImplementationp->mMoneySalesTabEHp->setGroupID(mGroupID);
- }
-
- mImplementationp->mBeenActivated = false;
-
- activate();
+ LLPanelGroupLandMoney::sGroupIDs.erase(mGroupID);
+ LLPanelGroupTab::setGroupID(id);
+ LLPanelGroupLandMoney::sGroupIDs.insert(std::make_pair(mGroupID, this));
+
+
+ bool can_view = gAgent.isInGroup(mGroupID);
+
+ mImplementationp->mGroupOverLimitIconp =
+ getChild<LLIconCtrl>("group_over_limit_icon");
+ mImplementationp->mGroupOverLimitTextp =
+ getChild<LLTextBox>("group_over_limit_text");
+
+ mImplementationp->mYourContributionEditorp
+ = getChild<LLLineEditor>("your_contribution_line_editor");
+ if ( mImplementationp->mYourContributionEditorp )
+ {
+ LLLineEditor* editor = mImplementationp->mYourContributionEditorp;
+
+ editor->setCommitCallback(mImplementationp->contributionCommitCallback, this);
+ editor->setKeystrokeCallback(mImplementationp->contributionKeystrokeCallback, this);
+ }
+
+ mImplementationp->mMapButtonp = getChild<LLButton>("map_button");
+
+ mImplementationp->mGroupParcelsp =
+ getChild<LLScrollListCtrl>("group_parcel_list");
+
+ if ( mImplementationp->mGroupParcelsp )
+ {
+ mImplementationp->mGroupParcelsp->setCommitCallback(boost::bind(&LLPanelGroupLandMoney::onLandSelectionChanged, this));
+ mImplementationp->mGroupParcelsp->setCommitOnSelectionChange(true);
+ }
+
+ mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text");
+ mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text");
+
+ if ( mImplementationp->mMapButtonp )
+ {
+ mImplementationp->mMapButtonp->setClickedCallback(LLPanelGroupLandMoney::impl::mapCallback, mImplementationp);
+ }
+
+ if ( mImplementationp->mGroupOverLimitTextp )
+ {
+ mImplementationp->mGroupOverLimitTextp->setVisible(FALSE);
+ }
+
+ if ( mImplementationp->mGroupOverLimitIconp )
+ {
+ mImplementationp->mGroupOverLimitIconp->setVisible(FALSE);
+ }
+
+ if ( mImplementationp->mGroupParcelsp )
+ {
+ mImplementationp->mGroupParcelsp->setEnabled(can_view);
+ }
+
+ if ( !can_view && mImplementationp->mGroupParcelsp )
+ {
+ mImplementationp->mGroupParcelsp->setEnabled(FALSE);
+ }
+
+
+ LLButton* earlierp, *laterp;
+ LLTextEditor* textp;
+ LLPanel* panelp;
+
+ LLTabContainer* tabcp = getChild<LLTabContainer>("group_money_tab_container");
+
+ if ( tabcp )
+ {
+ S32 i;
+ S32 tab_count = tabcp->getTabCount();
+
+ for (i = tab_count - 1; i >=0; --i)
+ {
+ tabcp->enableTabButton(i, can_view );
+ }
+ }
+
+ std::string loading_text = getString("loading_txt");
+
+ //pull out the widgets for the L$ details tab
+ earlierp = getChild<LLButton>("earlier_details_button", true);
+ laterp = getChild<LLButton>("later_details_button", true);
+ textp = getChild<LLTextEditor>("group_money_details_text", true);
+ panelp = getChild<LLPanel>("group_money_details_tab", true);
+
+ if ( !can_view )
+ {
+ textp->setText(mImplementationp->mCantViewAccountsText);
+ }
+ else
+ {
+ if(mImplementationp->mMoneyDetailsTabEHp == 0)
+ mImplementationp->mMoneyDetailsTabEHp = new LLGroupMoneyDetailsTabEventHandler(earlierp,laterp,textp,tabcp,panelp,loading_text);
+ mImplementationp->mMoneyDetailsTabEHp->setGroupID(mGroupID);
+ }
+
+ textp = getChild<LLTextEditor>("group_money_planning_text", true);
+
+
+ if ( !can_view )
+ {
+ textp->setText(mImplementationp->mCantViewAccountsText);
+ }
+ else
+ {
+ panelp = getChild<LLPanel>("group_money_planning_tab", true);
+ if(mImplementationp->mMoneyPlanningTabEHp == 0)
+ mImplementationp->mMoneyPlanningTabEHp = new LLGroupMoneyPlanningTabEventHandler(textp,tabcp,panelp,loading_text);
+ mImplementationp->mMoneyPlanningTabEHp->setGroupID(mGroupID);
+ }
+
+ //pull out the widgets for the L$ sales tab
+ textp = getChild<LLTextEditor>("group_money_sales_text", true);
+
+
+ if ( !can_view )
+ {
+ textp->setText(mImplementationp->mCantViewAccountsText);
+ }
+ else
+ {
+ earlierp = getChild<LLButton>("earlier_sales_button", true);
+ laterp = getChild<LLButton>("later_sales_button", true);
+ panelp = getChild<LLPanel>("group_money_sales_tab", true);
+ if(mImplementationp->mMoneySalesTabEHp == NULL)
+ mImplementationp->mMoneySalesTabEHp = new LLGroupMoneySalesTabEventHandler(earlierp,laterp,textp,tabcp,panelp,loading_text);
+ mImplementationp->mMoneySalesTabEHp->setGroupID(mGroupID);
+ }
+
+ mImplementationp->mBeenActivated = false;
+
+ activate();
}
diff --git a/indra/newview/llpanelgrouplandmoney.h b/indra/newview/llpanelgrouplandmoney.h
index 3cec6065e7..0147acd768 100644
--- a/indra/newview/llpanelgrouplandmoney.h
+++ b/indra/newview/llpanelgrouplandmoney.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelgrouplandmoney.h
* @brief Panel for group land and L$.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,33 +34,33 @@
class LLPanelGroupLandMoney : public LLPanelGroupTab
{
public:
- LLPanelGroupLandMoney();
- virtual ~LLPanelGroupLandMoney();
- virtual BOOL postBuild();
- virtual BOOL isVisibleByAgent(LLAgent* agentp);
+ LLPanelGroupLandMoney();
+ virtual ~LLPanelGroupLandMoney();
+ virtual BOOL postBuild();
+ virtual BOOL isVisibleByAgent(LLAgent* agentp);
+
+ virtual void activate();
+ virtual bool needsApply(std::string& mesg);
+ virtual bool apply(std::string& mesg);
+ virtual void cancel();
+ virtual void update(LLGroupChange gc);
- virtual void activate();
- virtual bool needsApply(std::string& mesg);
- virtual bool apply(std::string& mesg);
- virtual void cancel();
- virtual void update(LLGroupChange gc);
+ static void processPlacesReply(LLMessageSystem* msg, void**);
- static void processPlacesReply(LLMessageSystem* msg, void**);
+ typedef std::map<LLUUID, LLPanelGroupLandMoney*> group_id_map_t;
+ static group_id_map_t sGroupIDs;
- typedef std::map<LLUUID, LLPanelGroupLandMoney*> group_id_map_t;
- static group_id_map_t sGroupIDs;
+ static void processGroupAccountDetailsReply(LLMessageSystem* msg, void** data);
+ static void processGroupAccountTransactionsReply(LLMessageSystem* msg, void** data);
+ static void processGroupAccountSummaryReply(LLMessageSystem* msg, void** data);
- static void processGroupAccountDetailsReply(LLMessageSystem* msg, void** data);
- static void processGroupAccountTransactionsReply(LLMessageSystem* msg, void** data);
- static void processGroupAccountSummaryReply(LLMessageSystem* msg, void** data);
+ virtual void setGroupID(const LLUUID& id);
- virtual void setGroupID(const LLUUID& id);
+ virtual void onLandSelectionChanged();
- virtual void onLandSelectionChanged();
-
protected:
- class impl;
- impl* mImplementationp;
+ class impl;
+ impl* mImplementationp;
};
#endif // LL_PANEL_GROUP_LAND_MONEY_H
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 82f880c9ee..0ef43715a3 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelgroupnotices.cpp
* @brief A panel to display group notices.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -72,120 +72,120 @@ static LLPanelInjector<LLPanelGroupNotices> t_panel_group_notices("panel_group_n
class LLGroupDropTarget : public LLView
{
public:
- struct Params : public LLInitParam::Block<Params, LLView::Params>
- {
- // *NOTE: These parameters logically Mandatory, but are not
- // specified in XML files, hence Optional
- Optional<LLPanelGroupNotices*> panel;
- Optional<LLUUID> group_id;
- Params()
- : panel("panel"),
- group_id("group_id")
- {
- changeDefault(mouse_opaque, false);
- changeDefault(follows.flags, FOLLOWS_ALL);
- }
- };
- LLGroupDropTarget(const Params&);
- ~LLGroupDropTarget() {};
-
- void doDrop(EDragAndDropType cargo_type, void* cargo_data);
-
- //
- // LLView functionality
- virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
- void setPanel (LLPanelGroupNotices* panel) {mGroupNoticesPanel = panel;};
- void setGroup (LLUUID group) {mGroupID = group;};
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ // *NOTE: These parameters logically Mandatory, but are not
+ // specified in XML files, hence Optional
+ Optional<LLPanelGroupNotices*> panel;
+ Optional<LLUUID> group_id;
+ Params()
+ : panel("panel"),
+ group_id("group_id")
+ {
+ changeDefault(mouse_opaque, false);
+ changeDefault(follows.flags, FOLLOWS_ALL);
+ }
+ };
+ LLGroupDropTarget(const Params&);
+ ~LLGroupDropTarget() {};
+
+ void doDrop(EDragAndDropType cargo_type, void* cargo_data);
+
+ //
+ // LLView functionality
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+ void setPanel (LLPanelGroupNotices* panel) {mGroupNoticesPanel = panel;};
+ void setGroup (LLUUID group) {mGroupID = group;};
protected:
- LLPanelGroupNotices* mGroupNoticesPanel;
- LLUUID mGroupID;
+ LLPanelGroupNotices* mGroupNoticesPanel;
+ LLUUID mGroupID;
};
static LLDefaultChildRegistry::Register<LLGroupDropTarget> r("group_drop_target");
-LLGroupDropTarget::LLGroupDropTarget(const LLGroupDropTarget::Params& p)
-: LLView(p),
- mGroupNoticesPanel(p.panel),
- mGroupID(p.group_id)
+LLGroupDropTarget::LLGroupDropTarget(const LLGroupDropTarget::Params& p)
+: LLView(p),
+ mGroupNoticesPanel(p.panel),
+ mGroupID(p.group_id)
{}
void LLGroupDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data)
{
- LL_INFOS() << "LLGroupDropTarget::doDrop()" << LL_ENDL;
+ LL_INFOS() << "LLGroupDropTarget::doDrop()" << LL_ENDL;
}
BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
{
- BOOL handled = FALSE;
-
- if (!gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_SEND))
- {
- *accept = ACCEPT_NO;
- return TRUE;
- }
-
- if(getParent())
- {
- // check if inside
- //LLRect parent_rect = mParentView->getRect();
- //getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0);
- handled = TRUE;
-
- // check the type
- switch(cargo_type)
- {
- case DAD_TEXTURE:
- case DAD_SOUND:
- case DAD_LANDMARK:
- case DAD_SCRIPT:
- case DAD_OBJECT:
- case DAD_NOTECARD:
- case DAD_CLOTHING:
- case DAD_BODYPART:
- case DAD_ANIMATION:
- case DAD_GESTURE:
- case DAD_CALLINGCARD:
- case DAD_MESH:
+ BOOL handled = FALSE;
+
+ if (!gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_SEND))
+ {
+ *accept = ACCEPT_NO;
+ return TRUE;
+ }
+
+ if(getParent())
+ {
+ // check if inside
+ //LLRect parent_rect = mParentView->getRect();
+ //getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0);
+ handled = TRUE;
+
+ // check the type
+ switch(cargo_type)
+ {
+ case DAD_TEXTURE:
+ case DAD_SOUND:
+ case DAD_LANDMARK:
+ case DAD_SCRIPT:
+ case DAD_OBJECT:
+ case DAD_NOTECARD:
+ case DAD_CLOTHING:
+ case DAD_BODYPART:
+ case DAD_ANIMATION:
+ case DAD_GESTURE:
+ case DAD_CALLINGCARD:
+ case DAD_MESH:
case DAD_SETTINGS:
case DAD_MATERIAL:
- {
- LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
- if(gInventory.getItem(inv_item->getUUID())
- && LLGiveInventory::isInventoryGroupGiveAcceptable(inv_item))
- {
- // *TODO: get multiple object transfers working
- *accept = ACCEPT_YES_COPY_SINGLE;
- if(drop)
- {
- mGroupNoticesPanel->setItem(inv_item);
- }
- }
- else
- {
- // It's not in the user's inventory (it's probably
- // in an object's contents), so disallow dragging
- // it here. You can't give something you don't
- // yet have.
- *accept = ACCEPT_NO;
- }
- break;
- }
- case DAD_CATEGORY:
- default:
- *accept = ACCEPT_NO;
- break;
- }
- }
- return handled;
+ {
+ LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
+ if(gInventory.getItem(inv_item->getUUID())
+ && LLGiveInventory::isInventoryGroupGiveAcceptable(inv_item))
+ {
+ // *TODO: get multiple object transfers working
+ *accept = ACCEPT_YES_COPY_SINGLE;
+ if(drop)
+ {
+ mGroupNoticesPanel->setItem(inv_item);
+ }
+ }
+ else
+ {
+ // It's not in the user's inventory (it's probably
+ // in an object's contents), so disallow dragging
+ // it here. You can't give something you don't
+ // yet have.
+ *accept = ACCEPT_NO;
+ }
+ break;
+ }
+ case DAD_CATEGORY:
+ default:
+ *accept = ACCEPT_NO;
+ break;
+ }
+ }
+ return handled;
}
//-----------------------------------------------------------------------------
@@ -193,115 +193,115 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
//-----------------------------------------------------------------------------
std::string build_notice_date(const U32& the_time)
{
- // ISO 8601 date format
-
- time_t t = (time_t)the_time;
-
- if (!t)
- {
- time(&t);
- }
-
- std::string dateStr = "["+ LLTrans::getString("LTimeYear") + "]/["
- + LLTrans::getString("LTimeMthNum") + "]/["
- + LLTrans::getString("LTimeDay") + "] ["
- + LLTrans::getString("LTimeHour") + "]:["
- + LLTrans::getString("LTimeMin") + "]:["
- + LLTrans::getString("LTimeSec") + "]";
- LLSD substitution;
- substitution["datetime"] = (S32) t;
- LLStringUtil::format (dateStr, substitution);
- return dateStr;
+ // ISO 8601 date format
+
+ time_t t = (time_t)the_time;
+
+ if (!t)
+ {
+ time(&t);
+ }
+
+ std::string dateStr = "["+ LLTrans::getString("LTimeYear") + "]/["
+ + LLTrans::getString("LTimeMthNum") + "]/["
+ + LLTrans::getString("LTimeDay") + "] ["
+ + LLTrans::getString("LTimeHour") + "]:["
+ + LLTrans::getString("LTimeMin") + "]:["
+ + LLTrans::getString("LTimeSec") + "]";
+ LLSD substitution;
+ substitution["datetime"] = (S32) t;
+ LLStringUtil::format (dateStr, substitution);
+ return dateStr;
}
LLPanelGroupNotices::LLPanelGroupNotices() :
- LLPanelGroupTab(),
- mInventoryItem(NULL),
- mInventoryOffer(NULL)
+ LLPanelGroupTab(),
+ mInventoryItem(NULL),
+ mInventoryOffer(NULL)
{
-
-
+
+
}
LLPanelGroupNotices::~LLPanelGroupNotices()
{
- sInstances.erase(mGroupID);
+ sInstances.erase(mGroupID);
- if (mInventoryOffer)
- {
- // Cancel the inventory offer.
- mInventoryOffer->forceResponse(IOR_DECLINE);
+ if (mInventoryOffer)
+ {
+ // Cancel the inventory offer.
+ mInventoryOffer->forceResponse(IOR_DECLINE);
- mInventoryOffer = NULL;
- }
+ mInventoryOffer = NULL;
+ }
}
BOOL LLPanelGroupNotices::isVisibleByAgent(LLAgent* agentp)
{
- return mAllowEdit &&
- agentp->hasPowerInGroup(mGroupID, GP_NOTICES_SEND | GP_NOTICES_RECEIVE);
+ return mAllowEdit &&
+ agentp->hasPowerInGroup(mGroupID, GP_NOTICES_SEND | GP_NOTICES_RECEIVE);
}
BOOL LLPanelGroupNotices::postBuild()
{
- bool recurse = true;
+ bool recurse = true;
- mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse);
- mNoticesList->setCommitOnSelectionChange(TRUE);
- mNoticesList->setCommitCallback(onSelectNotice, this);
+ mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse);
+ mNoticesList->setCommitOnSelectionChange(TRUE);
+ mNoticesList->setCommitCallback(onSelectNotice, this);
- mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse);
- mBtnNewMessage->setClickedCallback(onClickNewMessage, this);
- mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND));
+ mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse);
+ mBtnNewMessage->setClickedCallback(onClickNewMessage, this);
+ mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND));
- mBtnGetPastNotices = getChild<LLButton>("refresh_notices",recurse);
- mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices, this);
+ mBtnGetPastNotices = getChild<LLButton>("refresh_notices",recurse);
+ mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices, this);
- // Create
- mCreateSubject = getChild<LLLineEditor>("create_subject",recurse);
- mCreateMessage = getChild<LLTextEditor>("create_message",recurse);
+ // Create
+ mCreateSubject = getChild<LLLineEditor>("create_subject",recurse);
+ mCreateMessage = getChild<LLTextEditor>("create_message",recurse);
- mCreateInventoryName = getChild<LLLineEditor>("create_inventory_name",recurse);
- mCreateInventoryName->setTabStop(FALSE);
- mCreateInventoryName->setEnabled(FALSE);
+ mCreateInventoryName = getChild<LLLineEditor>("create_inventory_name",recurse);
+ mCreateInventoryName->setTabStop(FALSE);
+ mCreateInventoryName->setEnabled(FALSE);
- mCreateInventoryIcon = getChild<LLIconCtrl>("create_inv_icon",recurse);
- mCreateInventoryIcon->setVisible(FALSE);
+ mCreateInventoryIcon = getChild<LLIconCtrl>("create_inv_icon",recurse);
+ mCreateInventoryIcon->setVisible(FALSE);
- mBtnSendMessage = getChild<LLButton>("send_notice",recurse);
- mBtnSendMessage->setClickedCallback(onClickSendMessage, this);
+ mBtnSendMessage = getChild<LLButton>("send_notice",recurse);
+ mBtnSendMessage->setClickedCallback(onClickSendMessage, this);
- mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",recurse);
- mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment, this);
- mBtnRemoveAttachment->setEnabled(FALSE);
+ mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",recurse);
+ mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment, this);
+ mBtnRemoveAttachment->setEnabled(FALSE);
- // View
- mViewSubject = getChild<LLLineEditor>("view_subject",recurse);
- mViewMessage = getChild<LLTextEditor>("view_message",recurse);
+ // View
+ mViewSubject = getChild<LLLineEditor>("view_subject",recurse);
+ mViewMessage = getChild<LLTextEditor>("view_message",recurse);
- mViewInventoryName = getChild<LLLineEditor>("view_inventory_name",recurse);
- mViewInventoryName->setTabStop(FALSE);
- mViewInventoryName->setEnabled(FALSE);
+ mViewInventoryName = getChild<LLLineEditor>("view_inventory_name",recurse);
+ mViewInventoryName->setTabStop(FALSE);
+ mViewInventoryName->setEnabled(FALSE);
- mViewInventoryIcon = getChild<LLIconCtrl>("view_inv_icon",recurse);
- mViewInventoryIcon->setVisible(FALSE);
+ mViewInventoryIcon = getChild<LLIconCtrl>("view_inv_icon",recurse);
+ mViewInventoryIcon->setVisible(FALSE);
- mBtnOpenAttachment = getChild<LLButton>("open_attachment",recurse);
- mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment, this);
+ mBtnOpenAttachment = getChild<LLButton>("open_attachment",recurse);
+ mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment, this);
- mNoNoticesStr = getString("no_notices_text");
+ mNoNoticesStr = getString("no_notices_text");
- mPanelCreateNotice = getChild<LLPanel>("panel_create_new_notice",recurse);
- mPanelViewNotice = getChild<LLPanel>("panel_view_past_notice",recurse);
+ mPanelCreateNotice = getChild<LLPanel>("panel_create_new_notice",recurse);
+ mPanelViewNotice = getChild<LLPanel>("panel_view_past_notice",recurse);
- LLGroupDropTarget* target = getChild<LLGroupDropTarget> ("drop_target");
- target->setPanel (this);
- target->setGroup (mGroupID);
+ LLGroupDropTarget* target = getChild<LLGroupDropTarget> ("drop_target");
+ target->setPanel (this);
+ target->setGroup (mGroupID);
- arrangeNoticeView(VIEW_PAST_NOTICE);
+ arrangeNoticeView(VIEW_PAST_NOTICE);
- return LLPanelGroupTab::postBuild();
+ return LLPanelGroupTab::postBuild();
}
void LLPanelGroupNotices::activate()
@@ -312,166 +312,166 @@ void LLPanelGroupNotices::activate()
mKnownNoticeIds.clear();
}
- mPrevSelectedNotice = LLUUID();
-
- BOOL can_send = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_SEND);
- BOOL can_receive = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_RECEIVE);
+ mPrevSelectedNotice = LLUUID();
- mPanelViewNotice->setEnabled(can_receive);
- mPanelCreateNotice->setEnabled(can_send);
+ BOOL can_send = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_SEND);
+ BOOL can_receive = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_RECEIVE);
- // Always disabled to stop direct editing of attachment names
- mCreateInventoryName->setEnabled(FALSE);
- mViewInventoryName->setEnabled(FALSE);
+ mPanelViewNotice->setEnabled(can_receive);
+ mPanelCreateNotice->setEnabled(can_send);
- // If we can receive notices, grab them right away.
- if (can_receive)
- {
- onClickRefreshNotices(this);
- }
+ // Always disabled to stop direct editing of attachment names
+ mCreateInventoryName->setEnabled(FALSE);
+ mViewInventoryName->setEnabled(FALSE);
+
+ // If we can receive notices, grab them right away.
+ if (can_receive)
+ {
+ onClickRefreshNotices(this);
+ }
}
void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item)
{
- mInventoryItem = inv_item;
+ mInventoryItem = inv_item;
- BOOL item_is_multi = FALSE;
- if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
- {
- item_is_multi = TRUE;
- };
+ BOOL item_is_multi = FALSE;
+ if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
+ {
+ item_is_multi = TRUE;
+ };
- std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
- inv_item->getInventoryType(),
- inv_item->getFlags(),
- item_is_multi );
+ std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
+ inv_item->getInventoryType(),
+ inv_item->getFlags(),
+ item_is_multi );
- mCreateInventoryIcon->setValue(icon_name);
- mCreateInventoryIcon->setVisible(TRUE);
+ mCreateInventoryIcon->setValue(icon_name);
+ mCreateInventoryIcon->setVisible(TRUE);
- std::stringstream ss;
- ss << " " << mInventoryItem->getName();
+ std::stringstream ss;
+ ss << " " << mInventoryItem->getName();
- mCreateInventoryName->setText(ss.str());
- mBtnRemoveAttachment->setEnabled(TRUE);
+ mCreateInventoryName->setText(ss.str());
+ mBtnRemoveAttachment->setEnabled(TRUE);
}
void LLPanelGroupNotices::onClickRemoveAttachment(void* data)
{
- LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
- self->mInventoryItem = NULL;
- self->mCreateInventoryName->clear();
- self->mCreateInventoryIcon->setVisible(FALSE);
- self->mBtnRemoveAttachment->setEnabled(FALSE);
+ LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
+ self->mInventoryItem = NULL;
+ self->mCreateInventoryName->clear();
+ self->mCreateInventoryIcon->setVisible(FALSE);
+ self->mBtnRemoveAttachment->setEnabled(FALSE);
}
-//static
+//static
void LLPanelGroupNotices::onClickOpenAttachment(void* data)
{
- LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
+ LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
- self->mInventoryOffer->forceResponse(IOR_ACCEPT);
- self->mInventoryOffer = NULL;
- self->mBtnOpenAttachment->setEnabled(FALSE);
+ self->mInventoryOffer->forceResponse(IOR_ACCEPT);
+ self->mInventoryOffer = NULL;
+ self->mBtnOpenAttachment->setEnabled(FALSE);
}
void LLPanelGroupNotices::onClickSendMessage(void* data)
{
- LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
-
- if (self->mCreateSubject->getText().empty())
- {
- // Must supply a subject
- LLNotificationsUtil::add("MustSpecifyGroupNoticeSubject");
- return;
- }
- send_group_notice(
- self->mGroupID,
- self->mCreateSubject->getText(),
- self->mCreateMessage->getText(),
- self->mInventoryItem);
-
-
- //instantly add new notice. actual notice will be added after ferreshNotices call
- LLUUID id = LLUUID::generateNewID();
- std::string subj = self->mCreateSubject->getText();
- std::string name ;
- LLAgentUI::buildFullname(name);
- U32 timestamp = 0;
-
- LLSD row;
- row["id"] = id;
-
- row["columns"][0]["column"] = "icon";
-
- row["columns"][1]["column"] = "subject";
- row["columns"][1]["value"] = subj;
-
- row["columns"][2]["column"] = "from";
- row["columns"][2]["value"] = name;
-
- row["columns"][3]["column"] = "date";
- row["columns"][3]["value"] = build_notice_date(timestamp);
-
- row["columns"][4]["column"] = "sort";
- row["columns"][4]["value"] = llformat( "%u", timestamp);
-
- self->mNoticesList->addElement(row, ADD_BOTTOM);
- self->mKnownNoticeIds.insert(id);
-
- self->mCreateMessage->clear();
- self->mCreateSubject->clear();
- onClickRemoveAttachment(data);
-
- self->arrangeNoticeView(VIEW_PAST_NOTICE);
+ LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
+
+ if (self->mCreateSubject->getText().empty())
+ {
+ // Must supply a subject
+ LLNotificationsUtil::add("MustSpecifyGroupNoticeSubject");
+ return;
+ }
+ send_group_notice(
+ self->mGroupID,
+ self->mCreateSubject->getText(),
+ self->mCreateMessage->getText(),
+ self->mInventoryItem);
+
+
+ //instantly add new notice. actual notice will be added after ferreshNotices call
+ LLUUID id = LLUUID::generateNewID();
+ std::string subj = self->mCreateSubject->getText();
+ std::string name ;
+ LLAgentUI::buildFullname(name);
+ U32 timestamp = 0;
+
+ LLSD row;
+ row["id"] = id;
+
+ row["columns"][0]["column"] = "icon";
+
+ row["columns"][1]["column"] = "subject";
+ row["columns"][1]["value"] = subj;
+
+ row["columns"][2]["column"] = "from";
+ row["columns"][2]["value"] = name;
+
+ row["columns"][3]["column"] = "date";
+ row["columns"][3]["value"] = build_notice_date(timestamp);
+
+ row["columns"][4]["column"] = "sort";
+ row["columns"][4]["value"] = llformat( "%u", timestamp);
+
+ self->mNoticesList->addElement(row, ADD_BOTTOM);
+ self->mKnownNoticeIds.insert(id);
+
+ self->mCreateMessage->clear();
+ self->mCreateSubject->clear();
+ onClickRemoveAttachment(data);
+
+ self->arrangeNoticeView(VIEW_PAST_NOTICE);
}
-//static
+//static
void LLPanelGroupNotices::onClickNewMessage(void* data)
{
- LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
+ LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
- self->arrangeNoticeView(CREATE_NEW_NOTICE);
+ self->arrangeNoticeView(CREATE_NEW_NOTICE);
- if (self->mInventoryOffer)
- {
- self->mInventoryOffer->forceResponse(IOR_DECLINE);
- self->mInventoryOffer = NULL;
- }
+ if (self->mInventoryOffer)
+ {
+ self->mInventoryOffer->forceResponse(IOR_DECLINE);
+ self->mInventoryOffer = NULL;
+ }
- self->mCreateSubject->clear();
- self->mCreateMessage->clear();
- if (self->mInventoryItem) onClickRemoveAttachment(self);
- self->mNoticesList->deselectAllItems(TRUE); // TRUE == don't commit on chnage
+ self->mCreateSubject->clear();
+ self->mCreateMessage->clear();
+ if (self->mInventoryItem) onClickRemoveAttachment(self);
+ self->mNoticesList->deselectAllItems(TRUE); // TRUE == don't commit on chnage
}
void LLPanelGroupNotices::refreshNotices()
{
- onClickRefreshNotices(this);
+ onClickRefreshNotices(this);
}
void LLPanelGroupNotices::clearNoticeList()
{
- mPrevSelectedNotice = mNoticesList->getStringUUIDSelectedItem();
- mNoticesList->deleteAllItems();
- mKnownNoticeIds.clear();
+ mPrevSelectedNotice = mNoticesList->getStringUUIDSelectedItem();
+ mNoticesList->deleteAllItems();
+ mKnownNoticeIds.clear();
}
void LLPanelGroupNotices::onClickRefreshNotices(void* data)
{
- LL_DEBUGS() << "LLPanelGroupNotices::onClickGetPastNotices" << LL_ENDL;
- LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
-
- self->clearNoticeList();
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GroupNoticesListRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addUUID("GroupID",self->mGroupID);
- gAgent.sendReliableMessage();
+ LL_DEBUGS() << "LLPanelGroupNotices::onClickGetPastNotices" << LL_ENDL;
+ LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
+
+ self->clearNoticeList();
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GroupNoticesListRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addUUID("GroupID",self->mGroupID);
+ gAgent.sendReliableMessage();
}
//static
@@ -480,57 +480,57 @@ std::map<LLUUID,LLPanelGroupNotices*> LLPanelGroupNotices::sInstances;
// static
void LLPanelGroupNotices::processGroupNoticesListReply(LLMessageSystem* msg, void** data)
{
- LLUUID group_id;
- msg->getUUID("AgentData", "GroupID", group_id);
-
- std::map<LLUUID,LLPanelGroupNotices*>::iterator it = sInstances.find(group_id);
- if (it == sInstances.end())
- {
- LL_INFOS() << "Group Panel Notices " << group_id << " no longer in existence."
- << LL_ENDL;
- return;
- }
-
- LLPanelGroupNotices* selfp = it->second;
- if(!selfp)
- {
- LL_INFOS() << "Group Panel Notices " << group_id << " no longer in existence."
- << LL_ENDL;
- return;
- }
-
- selfp->processNotices(msg);
+ LLUUID group_id;
+ msg->getUUID("AgentData", "GroupID", group_id);
+
+ std::map<LLUUID,LLPanelGroupNotices*>::iterator it = sInstances.find(group_id);
+ if (it == sInstances.end())
+ {
+ LL_INFOS() << "Group Panel Notices " << group_id << " no longer in existence."
+ << LL_ENDL;
+ return;
+ }
+
+ LLPanelGroupNotices* selfp = it->second;
+ if(!selfp)
+ {
+ LL_INFOS() << "Group Panel Notices " << group_id << " no longer in existence."
+ << LL_ENDL;
+ return;
+ }
+
+ selfp->processNotices(msg);
}
void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
{
- LLUUID id;
- std::string subj;
- std::string name;
- U32 timestamp;
- BOOL has_attachment;
- U8 asset_type;
-
- S32 i=0;
- S32 count = msg->getNumberOfBlocks("Data");
-
- mNoticesList->setEnabled(TRUE);
-
- //save sort state and set unsorted state to prevent unnecessary
- //sorting while adding notices
- bool save_sort = mNoticesList->isSorted();
- mNoticesList->setNeedsSort(false);
-
- for (;i<count;++i)
- {
- msg->getUUID("Data","NoticeID",id,i);
- if (1 == count && id.isNull())
- {
- // Only one entry, the dummy entry.
- mNoticesList->setCommentText(mNoNoticesStr);
- mNoticesList->setEnabled(FALSE);
- return;
- }
+ LLUUID id;
+ std::string subj;
+ std::string name;
+ U32 timestamp;
+ BOOL has_attachment;
+ U8 asset_type;
+
+ S32 i=0;
+ S32 count = msg->getNumberOfBlocks("Data");
+
+ mNoticesList->setEnabled(TRUE);
+
+ //save sort state and set unsorted state to prevent unnecessary
+ //sorting while adding notices
+ bool save_sort = mNoticesList->isSorted();
+ mNoticesList->setNeedsSort(false);
+
+ for (;i<count;++i)
+ {
+ msg->getUUID("Data","NoticeID",id,i);
+ if (1 == count && id.isNull())
+ {
+ // Only one entry, the dummy entry.
+ mNoticesList->setCommentText(mNoNoticesStr);
+ mNoticesList->setEnabled(FALSE);
+ return;
+ }
// Due to some network delays we can receive notice list more than once...
// So add only unique notices
@@ -540,147 +540,147 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
continue;
}
- msg->getString("Data","Subject",subj,i);
- msg->getString("Data","FromName",name,i);
- msg->getBOOL("Data","HasAttachment",has_attachment,i);
- msg->getU8("Data","AssetType",asset_type,i);
- msg->getU32("Data","Timestamp",timestamp,i);
-
- // we only have the legacy name here, convert it to a username
- name = LLCacheName::buildUsername(name);
-
- LLSD row;
- row["id"] = id;
- row["columns"][0]["column"] = "icon";
- if (has_attachment)
- {
- std::string icon_name = LLInventoryIcon::getIconName(
- (LLAssetType::EType)asset_type,
- LLInventoryType::IT_NONE);
- row["columns"][0]["type"] = "icon";
- row["columns"][0]["value"] = icon_name;
- }
-
- row["columns"][1]["column"] = "subject";
- row["columns"][1]["value"] = subj;
-
- row["columns"][2]["column"] = "from";
- row["columns"][2]["value"] = name;
-
- row["columns"][3]["column"] = "date";
- row["columns"][3]["value"] = build_notice_date(timestamp);
-
- row["columns"][4]["column"] = "sort";
- row["columns"][4]["value"] = llformat( "%u", timestamp);
-
- mNoticesList->addElement(row, ADD_BOTTOM);
- mKnownNoticeIds.insert(id);
- }
-
- mNoticesList->setNeedsSort(save_sort);
- mNoticesList->updateSort();
- if (mPanelViewNotice->getVisible())
- {
- if (!mNoticesList->selectByID(mPrevSelectedNotice))
- {
- mNoticesList->selectFirstItem();
- }
- }
+ msg->getString("Data","Subject",subj,i);
+ msg->getString("Data","FromName",name,i);
+ msg->getBOOL("Data","HasAttachment",has_attachment,i);
+ msg->getU8("Data","AssetType",asset_type,i);
+ msg->getU32("Data","Timestamp",timestamp,i);
+
+ // we only have the legacy name here, convert it to a username
+ name = LLCacheName::buildUsername(name);
+
+ LLSD row;
+ row["id"] = id;
+ row["columns"][0]["column"] = "icon";
+ if (has_attachment)
+ {
+ std::string icon_name = LLInventoryIcon::getIconName(
+ (LLAssetType::EType)asset_type,
+ LLInventoryType::IT_NONE);
+ row["columns"][0]["type"] = "icon";
+ row["columns"][0]["value"] = icon_name;
+ }
+
+ row["columns"][1]["column"] = "subject";
+ row["columns"][1]["value"] = subj;
+
+ row["columns"][2]["column"] = "from";
+ row["columns"][2]["value"] = name;
+
+ row["columns"][3]["column"] = "date";
+ row["columns"][3]["value"] = build_notice_date(timestamp);
+
+ row["columns"][4]["column"] = "sort";
+ row["columns"][4]["value"] = llformat( "%u", timestamp);
+
+ mNoticesList->addElement(row, ADD_BOTTOM);
+ mKnownNoticeIds.insert(id);
+ }
+
+ mNoticesList->setNeedsSort(save_sort);
+ mNoticesList->updateSort();
+ if (mPanelViewNotice->getVisible())
+ {
+ if (!mNoticesList->selectByID(mPrevSelectedNotice))
+ {
+ mNoticesList->selectFirstItem();
+ }
+ }
}
void LLPanelGroupNotices::onSelectNotice(LLUICtrl* ctrl, void* data)
{
- LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
-
- if(!self) return;
- LLScrollListItem* item = self->mNoticesList->getFirstSelected();
- if (!item) return;
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GroupNoticeRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID",gAgent.getID());
- msg->addUUID("SessionID",gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addUUID("GroupNoticeID",item->getUUID());
- gAgent.sendReliableMessage();
-
- LL_DEBUGS() << "Item " << item->getUUID() << " selected." << LL_ENDL;
+ LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
+
+ if(!self) return;
+ LLScrollListItem* item = self->mNoticesList->getFirstSelected();
+ if (!item) return;
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GroupNoticeRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID",gAgent.getID());
+ msg->addUUID("SessionID",gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addUUID("GroupNoticeID",item->getUUID());
+ gAgent.sendReliableMessage();
+
+ LL_DEBUGS() << "Item " << item->getUUID() << " selected." << LL_ENDL;
}
void LLPanelGroupNotices::showNotice(const std::string& subject,
- const std::string& message,
- const bool& has_inventory,
- const std::string& inventory_name,
- LLOfferInfo* inventory_offer)
+ const std::string& message,
+ const bool& has_inventory,
+ const std::string& inventory_name,
+ LLOfferInfo* inventory_offer)
{
- arrangeNoticeView(VIEW_PAST_NOTICE);
-
- if(mViewSubject) mViewSubject->setText(subject);
- if(mViewMessage) mViewMessage->setText(message);
-
- if (mInventoryOffer)
- {
- // Cancel the inventory offer for the previously viewed notice
- mInventoryOffer->forceResponse(IOR_DECLINE);
- mInventoryOffer = NULL;
- }
-
- if (inventory_offer)
- {
- mInventoryOffer = inventory_offer;
-
- std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType,
- LLInventoryType::IT_TEXTURE);
-
- mViewInventoryIcon->setValue(icon_name);
- mViewInventoryIcon->setVisible(TRUE);
-
- std::stringstream ss;
- ss << " " << inventory_name;
-
- mViewInventoryName->setText(ss.str());
- mBtnOpenAttachment->setEnabled(TRUE);
- }
- else
- {
- mViewInventoryName->clear();
- mViewInventoryIcon->setVisible(FALSE);
- mBtnOpenAttachment->setEnabled(FALSE);
- }
+ arrangeNoticeView(VIEW_PAST_NOTICE);
+
+ if(mViewSubject) mViewSubject->setText(subject);
+ if(mViewMessage) mViewMessage->setText(message);
+
+ if (mInventoryOffer)
+ {
+ // Cancel the inventory offer for the previously viewed notice
+ mInventoryOffer->forceResponse(IOR_DECLINE);
+ mInventoryOffer = NULL;
+ }
+
+ if (inventory_offer)
+ {
+ mInventoryOffer = inventory_offer;
+
+ std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType,
+ LLInventoryType::IT_TEXTURE);
+
+ mViewInventoryIcon->setValue(icon_name);
+ mViewInventoryIcon->setVisible(TRUE);
+
+ std::stringstream ss;
+ ss << " " << inventory_name;
+
+ mViewInventoryName->setText(ss.str());
+ mBtnOpenAttachment->setEnabled(TRUE);
+ }
+ else
+ {
+ mViewInventoryName->clear();
+ mViewInventoryIcon->setVisible(FALSE);
+ mBtnOpenAttachment->setEnabled(FALSE);
+ }
}
void LLPanelGroupNotices::arrangeNoticeView(ENoticeView view_type)
{
- if (CREATE_NEW_NOTICE == view_type)
- {
+ if (CREATE_NEW_NOTICE == view_type)
+ {
mPanelCreateNotice->setVisible(TRUE);
- mPanelViewNotice->setVisible(FALSE);
- }
- else
- {
- mPanelCreateNotice->setVisible(FALSE);
- mPanelViewNotice->setVisible(TRUE);
- mBtnOpenAttachment->setEnabled(FALSE);
- }
+ mPanelViewNotice->setVisible(FALSE);
+ }
+ else
+ {
+ mPanelCreateNotice->setVisible(FALSE);
+ mPanelViewNotice->setVisible(TRUE);
+ mBtnOpenAttachment->setEnabled(FALSE);
+ }
}
void LLPanelGroupNotices::setGroupID(const LLUUID& id)
{
- sInstances.erase(mGroupID);
- LLPanelGroupTab::setGroupID(id);
- sInstances[mGroupID] = this;
+ sInstances.erase(mGroupID);
+ LLPanelGroupTab::setGroupID(id);
+ sInstances[mGroupID] = this;
+
+ mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND));
- mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND));
+ LLGroupDropTarget* target = getChild<LLGroupDropTarget> ("drop_target");
+ target->setPanel (this);
+ target->setGroup (mGroupID);
- LLGroupDropTarget* target = getChild<LLGroupDropTarget> ("drop_target");
- target->setPanel (this);
- target->setGroup (mGroupID);
+ if(mViewMessage)
+ mViewMessage->clear();
- if(mViewMessage)
- mViewMessage->clear();
+ if(mViewInventoryName)
+ mViewInventoryName->clear();
- if(mViewInventoryName)
- mViewInventoryName->clear();
-
- activate();
+ activate();
}
diff --git a/indra/newview/llpanelgroupnotices.h b/indra/newview/llpanelgroupnotices.h
index 55319cb9ae..11578eef01 100644
--- a/indra/newview/llpanelgroupnotices.h
+++ b/indra/newview/llpanelgroupnotices.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelgroupnotices.h
* @brief A panel to display group notices.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,84 +41,84 @@ class LLScrollListCtrl;
class LLPanelGroupNotices : public LLPanelGroupTab
{
public:
- LLPanelGroupNotices();
- virtual ~LLPanelGroupNotices();
+ LLPanelGroupNotices();
+ virtual ~LLPanelGroupNotices();
- // LLPanelGroupTab
- virtual void activate();
- //virtual bool needsApply(std::string& mesg);
- //virtual bool apply(std::string& mesg);
- //virtual void update();
-
- virtual BOOL postBuild();
- virtual BOOL isVisibleByAgent(LLAgent* agentp);
+ // LLPanelGroupTab
+ virtual void activate();
+ //virtual bool needsApply(std::string& mesg);
+ //virtual bool apply(std::string& mesg);
+ //virtual void update();
- void setItem(LLPointer<LLInventoryItem> inv_item);
+ virtual BOOL postBuild();
+ virtual BOOL isVisibleByAgent(LLAgent* agentp);
- static void processGroupNoticesListReply(LLMessageSystem* msg, void** data);
+ void setItem(LLPointer<LLInventoryItem> inv_item);
- void showNotice(const std::string& subject,
- const std::string& message,
- const bool& has_inventory,
- const std::string& inventory_name,
- LLOfferInfo* inventory_offer);
+ static void processGroupNoticesListReply(LLMessageSystem* msg, void** data);
- void refreshNotices();
+ void showNotice(const std::string& subject,
+ const std::string& message,
+ const bool& has_inventory,
+ const std::string& inventory_name,
+ LLOfferInfo* inventory_offer);
- void clearNoticeList();
+ void refreshNotices();
- virtual void setGroupID(const LLUUID& id);
+ void clearNoticeList();
+
+ virtual void setGroupID(const LLUUID& id);
private:
- static void onClickRemoveAttachment(void* data);
- static void onClickOpenAttachment(void* data);
- static void onClickSendMessage(void* data);
- static void onClickNewMessage(void* data);
- static void onClickRefreshNotices(void* data);
-
- void processNotices(LLMessageSystem* msg);
- static void onSelectNotice(LLUICtrl* ctrl, void* data);
-
- enum ENoticeView
- {
- VIEW_PAST_NOTICE,
- CREATE_NEW_NOTICE
- };
-
- void arrangeNoticeView(ENoticeView view_type);
-
- LLPointer<LLInventoryItem> mInventoryItem;
-
- LLLineEditor *mCreateSubject;
- LLLineEditor *mCreateInventoryName;
- LLTextEditor *mCreateMessage;
-
- LLLineEditor *mViewSubject;
- LLLineEditor *mViewInventoryName;
- LLTextEditor *mViewMessage;
-
- LLButton *mBtnSendMessage;
- LLButton *mBtnNewMessage;
- LLButton *mBtnRemoveAttachment;
- LLButton *mBtnOpenAttachment;
- LLButton *mBtnGetPastNotices;
-
- LLPanel *mPanelCreateNotice;
- LLPanel *mPanelViewNotice;
-
- LLIconCtrl *mCreateInventoryIcon;
- LLIconCtrl *mViewInventoryIcon;
-
- LLScrollListCtrl *mNoticesList;
+ static void onClickRemoveAttachment(void* data);
+ static void onClickOpenAttachment(void* data);
+ static void onClickSendMessage(void* data);
+ static void onClickNewMessage(void* data);
+ static void onClickRefreshNotices(void* data);
+
+ void processNotices(LLMessageSystem* msg);
+ static void onSelectNotice(LLUICtrl* ctrl, void* data);
+
+ enum ENoticeView
+ {
+ VIEW_PAST_NOTICE,
+ CREATE_NEW_NOTICE
+ };
+
+ void arrangeNoticeView(ENoticeView view_type);
+
+ LLPointer<LLInventoryItem> mInventoryItem;
+
+ LLLineEditor *mCreateSubject;
+ LLLineEditor *mCreateInventoryName;
+ LLTextEditor *mCreateMessage;
+
+ LLLineEditor *mViewSubject;
+ LLLineEditor *mViewInventoryName;
+ LLTextEditor *mViewMessage;
+
+ LLButton *mBtnSendMessage;
+ LLButton *mBtnNewMessage;
+ LLButton *mBtnRemoveAttachment;
+ LLButton *mBtnOpenAttachment;
+ LLButton *mBtnGetPastNotices;
+
+ LLPanel *mPanelCreateNotice;
+ LLPanel *mPanelViewNotice;
+
+ LLIconCtrl *mCreateInventoryIcon;
+ LLIconCtrl *mViewInventoryIcon;
+
+ LLScrollListCtrl *mNoticesList;
std::set<LLUUID> mKnownNoticeIds; // Dupplicate avoidance, to avoid searching and inserting dupplciates into mNoticesList
- std::string mNoNoticesStr;
+ std::string mNoNoticesStr;
- LLOfferInfo* mInventoryOffer;
+ LLOfferInfo* mInventoryOffer;
- LLUUID mPrevSelectedNotice;
+ LLUUID mPrevSelectedNotice;
- static std::map<LLUUID,LLPanelGroupNotices*> sInstances;
+ static std::map<LLUUID,LLPanelGroupNotices*> sInstances;
};
#endif
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index e3d75d5604..89dcd9182e 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -59,55 +59,55 @@
static LLPanelInjector<LLPanelGroupRoles> t_panel_group_roles("panel_group_roles");
bool agentCanRemoveFromRole(const LLUUID& group_id,
- const LLUUID& role_id)
+ const LLUUID& role_id)
{
- return gAgent.hasPowerInGroup(group_id, GP_ROLE_REMOVE_MEMBER);
+ return gAgent.hasPowerInGroup(group_id, GP_ROLE_REMOVE_MEMBER);
}
bool agentCanAddToRole(const LLUUID& group_id,
- const LLUUID& role_id)
-{
- if (gAgent.isGodlike())
- return true;
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (!gdatap)
- {
- LL_WARNS() << "agentCanAddToRole "
- << "-- No group data!" << LL_ENDL;
- return false;
- }
-
- //make sure the agent is in the group
- LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(gAgent.getID());
- if (mi == gdatap->mMembers.end())
- {
- return false;
- }
-
- LLGroupMemberData* member_data = (*mi).second;
-
- // Owners can add to any role.
- if ( member_data->isInRole(gdatap->mOwnerRole) )
- {
- return true;
- }
-
- // 'Limited assign members' can add to roles the user is in.
- if ( gAgent.hasPowerInGroup(group_id, GP_ROLE_ASSIGN_MEMBER_LIMITED) &&
- member_data->isInRole(role_id) )
- {
- return true;
- }
-
- // 'assign members' can add to non-owner roles.
- if ( gAgent.hasPowerInGroup(group_id, GP_ROLE_ASSIGN_MEMBER) &&
- role_id != gdatap->mOwnerRole )
- {
- return true;
- }
-
- return false;
+ const LLUUID& role_id)
+{
+ if (gAgent.isGodlike())
+ return true;
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ if (!gdatap)
+ {
+ LL_WARNS() << "agentCanAddToRole "
+ << "-- No group data!" << LL_ENDL;
+ return false;
+ }
+
+ //make sure the agent is in the group
+ LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(gAgent.getID());
+ if (mi == gdatap->mMembers.end())
+ {
+ return false;
+ }
+
+ LLGroupMemberData* member_data = (*mi).second;
+
+ // Owners can add to any role.
+ if ( member_data->isInRole(gdatap->mOwnerRole) )
+ {
+ return true;
+ }
+
+ // 'Limited assign members' can add to roles the user is in.
+ if ( gAgent.hasPowerInGroup(group_id, GP_ROLE_ASSIGN_MEMBER_LIMITED) &&
+ member_data->isInRole(role_id) )
+ {
+ return true;
+ }
+
+ // 'assign members' can add to non-owner roles.
+ if ( gAgent.hasPowerInGroup(group_id, GP_ROLE_ASSIGN_MEMBER) &&
+ role_id != gdatap->mOwnerRole )
+ {
+ return true;
+ }
+
+ return false;
}
@@ -115,11 +115,11 @@ bool agentCanAddToRole(const LLUUID& group_id,
// static
LLPanelGroupRoles::LLPanelGroupRoles()
-: LLPanelGroupTab(),
- mCurrentTab(NULL),
- mRequestedTab( NULL ),
- mSubTabContainer( NULL ),
- mFirstUse( TRUE )
+: LLPanelGroupTab(),
+ mCurrentTab(NULL),
+ mRequestedTab( NULL ),
+ mSubTabContainer( NULL ),
+ mFirstUse( TRUE )
{
}
@@ -129,309 +129,309 @@ LLPanelGroupRoles::~LLPanelGroupRoles()
BOOL LLPanelGroupRoles::postBuild()
{
- LL_DEBUGS() << "LLPanelGroupRoles::postBuild()" << LL_ENDL;
+ LL_DEBUGS() << "LLPanelGroupRoles::postBuild()" << LL_ENDL;
- mSubTabContainer = getChild<LLTabContainer>("roles_tab_container");
+ mSubTabContainer = getChild<LLTabContainer>("roles_tab_container");
- if (!mSubTabContainer) return FALSE;
+ if (!mSubTabContainer) return FALSE;
- // Hook up each sub-tabs callback and widgets.
- for (S32 i = 0; i < mSubTabContainer->getTabCount(); ++i)
- {
- LLPanel* panel = mSubTabContainer->getPanelByIndex(i);
- LLPanelGroupSubTab* subtabp = dynamic_cast<LLPanelGroupSubTab*>(panel);
- if (!subtabp)
- {
- LL_WARNS() << "Invalid subtab panel: " << panel->getName() << LL_ENDL;
- return FALSE;
- }
+ // Hook up each sub-tabs callback and widgets.
+ for (S32 i = 0; i < mSubTabContainer->getTabCount(); ++i)
+ {
+ LLPanel* panel = mSubTabContainer->getPanelByIndex(i);
+ LLPanelGroupSubTab* subtabp = dynamic_cast<LLPanelGroupSubTab*>(panel);
+ if (!subtabp)
+ {
+ LL_WARNS() << "Invalid subtab panel: " << panel->getName() << LL_ENDL;
+ return FALSE;
+ }
- // Hand the subtab a pointer to this LLPanelGroupRoles, so that it can
- // look around for the widgets it is interested in.
- if (!subtabp->postBuildSubTab(this))
- return FALSE;
+ // Hand the subtab a pointer to this LLPanelGroupRoles, so that it can
+ // look around for the widgets it is interested in.
+ if (!subtabp->postBuildSubTab(this))
+ return FALSE;
- //subtabp->addObserver(this);
- }
- // Add click callbacks to tab switching.
- mSubTabContainer->setValidateBeforeCommit(boost::bind(&LLPanelGroupRoles::handleSubTabSwitch, this, _1));
+ //subtabp->addObserver(this);
+ }
+ // Add click callbacks to tab switching.
+ mSubTabContainer->setValidateBeforeCommit(boost::bind(&LLPanelGroupRoles::handleSubTabSwitch, this, _1));
- // Set the current tab to whatever is currently being shown.
- mCurrentTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
- if (!mCurrentTab)
- {
- // Need to select a tab.
- mSubTabContainer->selectFirstTab();
- mCurrentTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
- }
+ // Set the current tab to whatever is currently being shown.
+ mCurrentTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
+ if (!mCurrentTab)
+ {
+ // Need to select a tab.
+ mSubTabContainer->selectFirstTab();
+ mCurrentTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
+ }
- if (!mCurrentTab) return FALSE;
+ if (!mCurrentTab) return FALSE;
- // Act as though this tab was just activated.
- mCurrentTab->activate();
+ // Act as though this tab was just activated.
+ mCurrentTab->activate();
- // Read apply text from the xml file.
- mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
- mWantApplyMesg = getString("want_apply_text");
+ // Read apply text from the xml file.
+ mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
+ mWantApplyMesg = getString("want_apply_text");
- return LLPanelGroupTab::postBuild();
+ return LLPanelGroupTab::postBuild();
}
BOOL LLPanelGroupRoles::isVisibleByAgent(LLAgent* agentp)
{
- /* This power was removed to make group roles simpler
- return agentp->hasPowerInGroup(mGroupID,
- GP_ROLE_CREATE |
- GP_ROLE_DELETE |
- GP_ROLE_PROPERTIES |
- GP_ROLE_VIEW |
- GP_ROLE_ASSIGN_MEMBER |
- GP_ROLE_REMOVE_MEMBER |
- GP_ROLE_CHANGE_ACTIONS |
- GP_MEMBER_INVITE |
- GP_MEMBER_EJECT |
- GP_MEMBER_OPTIONS );
- */
- return mAllowEdit && agentp->isInGroup(mGroupID);
-
+ /* This power was removed to make group roles simpler
+ return agentp->hasPowerInGroup(mGroupID,
+ GP_ROLE_CREATE |
+ GP_ROLE_DELETE |
+ GP_ROLE_PROPERTIES |
+ GP_ROLE_VIEW |
+ GP_ROLE_ASSIGN_MEMBER |
+ GP_ROLE_REMOVE_MEMBER |
+ GP_ROLE_CHANGE_ACTIONS |
+ GP_MEMBER_INVITE |
+ GP_MEMBER_EJECT |
+ GP_MEMBER_OPTIONS );
+ */
+ return mAllowEdit && agentp->isInGroup(mGroupID);
+
}
bool LLPanelGroupRoles::handleSubTabSwitch(const LLSD& data)
{
- std::string panel_name = data.asString();
-
- if(mRequestedTab != NULL)//we already have tab change request
- {
- return false;
- }
-
- mRequestedTab = static_cast<LLPanelGroupTab*>(mSubTabContainer->getPanelByName(panel_name));
-
- std::string mesg;
- if (mCurrentTab && mCurrentTab->needsApply(mesg))
- {
- // If no message was provided, give a generic one.
- if (mesg.empty())
- {
- mesg = mDefaultNeedsApplyMesg;
- }
- // Create a notify box, telling the user about the unapplied tab.
- LLSD args;
- args["NEEDS_APPLY_MESSAGE"] = mesg;
- args["WANT_APPLY_MESSAGE"] = mWantApplyMesg;
- LLNotificationsUtil::add("PanelGroupApply", args, LLSD(),
- boost::bind(&LLPanelGroupRoles::handleNotifyCallback, this, _1, _2));
- mHasModal = TRUE;
-
- // Returning FALSE will block a close action from finishing until
- // we get a response back from the user.
- return false;
- }
-
- transitionToTab();
- return true;
+ std::string panel_name = data.asString();
+
+ if(mRequestedTab != NULL)//we already have tab change request
+ {
+ return false;
+ }
+
+ mRequestedTab = static_cast<LLPanelGroupTab*>(mSubTabContainer->getPanelByName(panel_name));
+
+ std::string mesg;
+ if (mCurrentTab && mCurrentTab->needsApply(mesg))
+ {
+ // If no message was provided, give a generic one.
+ if (mesg.empty())
+ {
+ mesg = mDefaultNeedsApplyMesg;
+ }
+ // Create a notify box, telling the user about the unapplied tab.
+ LLSD args;
+ args["NEEDS_APPLY_MESSAGE"] = mesg;
+ args["WANT_APPLY_MESSAGE"] = mWantApplyMesg;
+ LLNotificationsUtil::add("PanelGroupApply", args, LLSD(),
+ boost::bind(&LLPanelGroupRoles::handleNotifyCallback, this, _1, _2));
+ mHasModal = TRUE;
+
+ // Returning FALSE will block a close action from finishing until
+ // we get a response back from the user.
+ return false;
+ }
+
+ transitionToTab();
+ return true;
}
void LLPanelGroupRoles::transitionToTab()
{
- // Tell the current panel that it is being deactivated.
- if (mCurrentTab)
- {
- mCurrentTab->deactivate();
- }
-
- // Tell the new panel that it is being activated.
- if (mRequestedTab)
- {
- // This is now the current tab;
- mCurrentTab = mRequestedTab;
- mCurrentTab->activate();
- mRequestedTab = 0;
- }
+ // Tell the current panel that it is being deactivated.
+ if (mCurrentTab)
+ {
+ mCurrentTab->deactivate();
+ }
+
+ // Tell the new panel that it is being activated.
+ if (mRequestedTab)
+ {
+ // This is now the current tab;
+ mCurrentTab = mRequestedTab;
+ mCurrentTab->activate();
+ mRequestedTab = 0;
+ }
}
bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- mHasModal = FALSE;
- LLPanelGroupTab* transition_tab = mRequestedTab;
- switch (option)
- {
- case 0: // "Apply Changes"
- {
- // Try to apply changes, and switch to the requested tab.
- std::string apply_mesg;
- if ( !apply( apply_mesg ) )
- {
- // There was a problem doing the apply.
- if ( !apply_mesg.empty() )
- {
- mHasModal = TRUE;
- LLSD args;
- args["MESSAGE"] = apply_mesg;
- LLNotificationsUtil::add("GenericAlert", args, LLSD(), boost::bind(&LLPanelGroupRoles::onModalClose, this, _1, _2));
- }
- // Skip switching tabs.
- break;
- }
- transitionToTab();
- mSubTabContainer->selectTabPanel( transition_tab );
-
- break;
- }
- case 1: // "Ignore Changes"
- // Switch to the requested panel without applying changes
- cancel();
- transitionToTab();
- mSubTabContainer->selectTabPanel( transition_tab );
- break;
- case 2: // "Cancel"
- default:
- mRequestedTab = NULL;
- // Do nothing. The user is canceling the action.
- break;
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ mHasModal = FALSE;
+ LLPanelGroupTab* transition_tab = mRequestedTab;
+ switch (option)
+ {
+ case 0: // "Apply Changes"
+ {
+ // Try to apply changes, and switch to the requested tab.
+ std::string apply_mesg;
+ if ( !apply( apply_mesg ) )
+ {
+ // There was a problem doing the apply.
+ if ( !apply_mesg.empty() )
+ {
+ mHasModal = TRUE;
+ LLSD args;
+ args["MESSAGE"] = apply_mesg;
+ LLNotificationsUtil::add("GenericAlert", args, LLSD(), boost::bind(&LLPanelGroupRoles::onModalClose, this, _1, _2));
+ }
+ // Skip switching tabs.
+ break;
+ }
+ transitionToTab();
+ mSubTabContainer->selectTabPanel( transition_tab );
+
+ break;
+ }
+ case 1: // "Ignore Changes"
+ // Switch to the requested panel without applying changes
+ cancel();
+ transitionToTab();
+ mSubTabContainer->selectTabPanel( transition_tab );
+ break;
+ case 2: // "Cancel"
+ default:
+ mRequestedTab = NULL;
+ // Do nothing. The user is canceling the action.
+ break;
+ }
+ return false;
}
bool LLPanelGroupRoles::onModalClose(const LLSD& notification, const LLSD& response)
{
- mHasModal = FALSE;
- return false;
+ mHasModal = FALSE;
+ return false;
}
bool LLPanelGroupRoles::apply(std::string& mesg)
{
- // Pass this along to the currently visible sub tab.
- if (!mSubTabContainer) return false;
+ // Pass this along to the currently visible sub tab.
+ if (!mSubTabContainer) return false;
- LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
- if (!panelp) return false;
-
- // Ignore the needs apply message.
- std::string ignore_mesg;
- if ( !panelp->needsApply(ignore_mesg) )
- {
- // We don't need to apply anything.
- // We're done.
- return true;
- }
+ LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
+ if (!panelp) return false;
- // Try to do the actual apply.
- return panelp->apply(mesg);
+ // Ignore the needs apply message.
+ std::string ignore_mesg;
+ if ( !panelp->needsApply(ignore_mesg) )
+ {
+ // We don't need to apply anything.
+ // We're done.
+ return true;
+ }
+
+ // Try to do the actual apply.
+ return panelp->apply(mesg);
}
void LLPanelGroupRoles::cancel()
{
- // Pass this along to the currently visible sub tab.
- if (!mSubTabContainer) return;
+ // Pass this along to the currently visible sub tab.
+ if (!mSubTabContainer) return;
- LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
- if (!panelp) return;
+ LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
+ if (!panelp) return;
- panelp->cancel();
+ panelp->cancel();
}
void LLPanelGroupRoles::update(LLGroupChange gc)
{
- if (mGroupID.isNull()) return;
-
- LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
- if (panelp)
- {
- panelp->update(gc);
- }
- else
- {
- LL_WARNS() << "LLPanelGroupRoles::update() -- No subtab to update!" << LL_ENDL;
- }
-
+ if (mGroupID.isNull()) return;
+
+ LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
+ if (panelp)
+ {
+ panelp->update(gc);
+ }
+ else
+ {
+ LL_WARNS() << "LLPanelGroupRoles::update() -- No subtab to update!" << LL_ENDL;
+ }
+
}
void LLPanelGroupRoles::activate()
{
- if (!gAgent.isInGroup(mGroupID)) return;
+ if (!gAgent.isInGroup(mGroupID)) return;
- // Start requesting member and role data if needed.
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ // Start requesting member and role data if needed.
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap || !gdatap->isRoleDataComplete() )
- {
- // Mildly hackish - clear all pending changes
- cancel();
+ if (!gdatap || !gdatap->isRoleDataComplete() )
+ {
+ // Mildly hackish - clear all pending changes
+ cancel();
- LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID);
- }
-
- // Need this to get base group member powers
- if (!gdatap || !gdatap->isGroupPropertiesDataComplete() )
- {
- LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID);
- }
+ LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID);
+ }
- mFirstUse = FALSE;
+ // Need this to get base group member powers
+ if (!gdatap || !gdatap->isGroupPropertiesDataComplete() )
+ {
+ LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID);
+ }
- LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
- if (panelp) panelp->activate();
+ mFirstUse = FALSE;
+
+ LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
+ if (panelp) panelp->activate();
}
void LLPanelGroupRoles::deactivate()
{
- LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
- if (panelp) panelp->deactivate();
+ LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
+ if (panelp) panelp->deactivate();
}
bool LLPanelGroupRoles::needsApply(std::string& mesg)
{
- LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
- if (!panelp) return false;
-
- return panelp->needsApply(mesg);
+ LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
+ if (!panelp) return false;
+
+ return panelp->needsApply(mesg);
}
BOOL LLPanelGroupRoles::hasModal()
{
- if (mHasModal) return TRUE;
+ if (mHasModal) return TRUE;
- LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
- if (!panelp) return FALSE;
-
- return panelp->hasModal();
+ LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel();
+ if (!panelp) return FALSE;
+
+ return panelp->hasModal();
}
void LLPanelGroupRoles::setGroupID(const LLUUID& id)
{
- LLPanelGroupTab::setGroupID(id);
+ LLPanelGroupTab::setGroupID(id);
- LLPanelGroupMembersSubTab* group_members_tab = findChild<LLPanelGroupMembersSubTab>("members_sub_tab");
- LLPanelGroupRolesSubTab* group_roles_tab = findChild<LLPanelGroupRolesSubTab>("roles_sub_tab");
- LLPanelGroupActionsSubTab* group_actions_tab = findChild<LLPanelGroupActionsSubTab>("actions_sub_tab");
- LLPanelGroupBanListSubTab* group_ban_tab = findChild<LLPanelGroupBanListSubTab>("banlist_sub_tab");
+ LLPanelGroupMembersSubTab* group_members_tab = findChild<LLPanelGroupMembersSubTab>("members_sub_tab");
+ LLPanelGroupRolesSubTab* group_roles_tab = findChild<LLPanelGroupRolesSubTab>("roles_sub_tab");
+ LLPanelGroupActionsSubTab* group_actions_tab = findChild<LLPanelGroupActionsSubTab>("actions_sub_tab");
+ LLPanelGroupBanListSubTab* group_ban_tab = findChild<LLPanelGroupBanListSubTab>("banlist_sub_tab");
- if(group_members_tab) group_members_tab->setGroupID(id);
- if(group_roles_tab) group_roles_tab->setGroupID(id);
- if(group_actions_tab) group_actions_tab->setGroupID(id);
- if(group_ban_tab) group_ban_tab->setGroupID(id);
+ if(group_members_tab) group_members_tab->setGroupID(id);
+ if(group_roles_tab) group_roles_tab->setGroupID(id);
+ if(group_actions_tab) group_actions_tab->setGroupID(id);
+ if(group_ban_tab) group_ban_tab->setGroupID(id);
- LLButton* button = getChild<LLButton>("member_invite");
- if ( button )
- button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE));
+ LLButton* button = getChild<LLButton>("member_invite");
+ if ( button )
+ button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE));
- if(mSubTabContainer)
- mSubTabContainer->selectTab(1);
- group_roles_tab->mFirstOpen = TRUE;
- activate();
+ if(mSubTabContainer)
+ mSubTabContainer->selectTab(1);
+ group_roles_tab->mFirstOpen = TRUE;
+ activate();
}
// LLPanelGroupSubTab ////////////////////////////////////////////////////
LLPanelGroupSubTab::LLPanelGroupSubTab()
-: LLPanelGroupTab(),
- mHeader(NULL),
- mFooter(NULL),
- mActivated(false),
- mHasGroupBanPower(false),
- mSearchEditor(NULL)
+: LLPanelGroupTab(),
+ mHeader(NULL),
+ mFooter(NULL),
+ mActivated(false),
+ mHasGroupBanPower(false),
+ mSearchEditor(NULL)
{
}
@@ -439,339 +439,339 @@ LLPanelGroupSubTab::~LLPanelGroupSubTab()
{
}
-BOOL LLPanelGroupSubTab::postBuildSubTab(LLView* root)
-{
- // Get icons for later use.
- mActionIcons.clear();
+BOOL LLPanelGroupSubTab::postBuildSubTab(LLView* root)
+{
+ // Get icons for later use.
+ mActionIcons.clear();
- if (hasString("power_folder_icon"))
- {
- mActionIcons["folder"] = getString("power_folder_icon");
- }
+ if (hasString("power_folder_icon"))
+ {
+ mActionIcons["folder"] = getString("power_folder_icon");
+ }
- if (hasString("power_all_have_icon"))
- {
- mActionIcons["full"] = getString("power_all_have_icon");
- }
+ if (hasString("power_all_have_icon"))
+ {
+ mActionIcons["full"] = getString("power_all_have_icon");
+ }
- if (hasString("power_partial_icon"))
- {
- mActionIcons["partial"] = getString("power_partial_icon");
- }
- return TRUE;
+ if (hasString("power_partial_icon"))
+ {
+ mActionIcons["partial"] = getString("power_partial_icon");
+ }
+ return TRUE;
}
BOOL LLPanelGroupSubTab::postBuild()
{
- // Hook up the search widgets.
- bool recurse = true;
+ // Hook up the search widgets.
+ bool recurse = true;
- mSearchEditor = findChild<LLFilterEditor>("filter_input", recurse);
- if (mSearchEditor) // SubTab doesn't implement this, only some of derived classes
- {
- mSearchEditor->setCommitCallback(boost::bind(&LLPanelGroupSubTab::setSearchFilter, this, _2));
- }
+ mSearchEditor = findChild<LLFilterEditor>("filter_input", recurse);
+ if (mSearchEditor) // SubTab doesn't implement this, only some of derived classes
+ {
+ mSearchEditor->setCommitCallback(boost::bind(&LLPanelGroupSubTab::setSearchFilter, this, _2));
+ }
- return LLPanelGroupTab::postBuild();
+ return LLPanelGroupTab::postBuild();
}
void LLPanelGroupSubTab::setGroupID(const LLUUID& id)
{
- LLPanelGroupTab::setGroupID(id);
- if(mSearchEditor)
- {
- mSearchEditor->clear();
- setSearchFilter("");
- }
+ LLPanelGroupTab::setGroupID(id);
+ if(mSearchEditor)
+ {
+ mSearchEditor->clear();
+ setSearchFilter("");
+ }
- mActivated = false;
+ mActivated = false;
}
void LLPanelGroupSubTab::setSearchFilter(const std::string& filter)
{
- if(mSearchFilter == filter)
- return;
- mSearchFilter = filter;
- LLStringUtil::toLower(mSearchFilter);
- update(GC_ALL);
- onFilterChanged();
+ if(mSearchFilter == filter)
+ return;
+ mSearchFilter = filter;
+ LLStringUtil::toLower(mSearchFilter);
+ update(GC_ALL);
+ onFilterChanged();
}
void LLPanelGroupSubTab::activate()
{
- setOthersVisible(TRUE);
+ setOthersVisible(TRUE);
}
void LLPanelGroupSubTab::deactivate()
{
- setOthersVisible(FALSE);
+ setOthersVisible(FALSE);
}
void LLPanelGroupSubTab::setOthersVisible(BOOL b)
{
- if (mHeader)
- {
- mHeader->setVisible( b );
- }
+ if (mHeader)
+ {
+ mHeader->setVisible( b );
+ }
- if (mFooter)
- {
- mFooter->setVisible( b );
- }
+ if (mFooter)
+ {
+ mFooter->setVisible( b );
+ }
}
bool LLPanelGroupSubTab::matchesActionSearchFilter(std::string action)
{
- // If the search filter is empty, everything passes.
- if (mSearchFilter.empty()) return true;
-
- LLStringUtil::toLower(action);
- std::string::size_type match = action.find(mSearchFilter);
-
- if (std::string::npos == match)
- {
- // not found
- return false;
- }
- else
- {
- return true;
- }
-}
-
-void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl,
- U64 allowed_by_some,
- U64 allowed_by_all,
- LLUICtrl::commit_callback_t commit_callback,
- BOOL show_all,
- BOOL filter,
- BOOL is_owner_role)
-{
- if (LLGroupMgr::getInstance()->mRoleActionSets.empty())
- {
- LL_WARNS() << "Can't build action list - no actions found." << LL_ENDL;
- return;
- }
-
- mHasGroupBanPower = false;
-
- std::vector<LLRoleActionSet*>::iterator ras_it = LLGroupMgr::getInstance()->mRoleActionSets.begin();
- std::vector<LLRoleActionSet*>::iterator ras_end = LLGroupMgr::getInstance()->mRoleActionSets.end();
- for ( ; ras_it != ras_end; ++ras_it)
- {
- buildActionCategory(ctrl,
- allowed_by_some,
- allowed_by_all,
- (*ras_it),
- commit_callback,
- show_all,
- filter,
- is_owner_role);
- }
+ // If the search filter is empty, everything passes.
+ if (mSearchFilter.empty()) return true;
+
+ LLStringUtil::toLower(action);
+ std::string::size_type match = action.find(mSearchFilter);
+
+ if (std::string::npos == match)
+ {
+ // not found
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+}
+
+void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl,
+ U64 allowed_by_some,
+ U64 allowed_by_all,
+ LLUICtrl::commit_callback_t commit_callback,
+ BOOL show_all,
+ BOOL filter,
+ BOOL is_owner_role)
+{
+ if (LLGroupMgr::getInstance()->mRoleActionSets.empty())
+ {
+ LL_WARNS() << "Can't build action list - no actions found." << LL_ENDL;
+ return;
+ }
+
+ mHasGroupBanPower = false;
+
+ std::vector<LLRoleActionSet*>::iterator ras_it = LLGroupMgr::getInstance()->mRoleActionSets.begin();
+ std::vector<LLRoleActionSet*>::iterator ras_end = LLGroupMgr::getInstance()->mRoleActionSets.end();
+ for ( ; ras_it != ras_end; ++ras_it)
+ {
+ buildActionCategory(ctrl,
+ allowed_by_some,
+ allowed_by_all,
+ (*ras_it),
+ commit_callback,
+ show_all,
+ filter,
+ is_owner_role);
+ }
}
void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
- U64 allowed_by_some,
- U64 allowed_by_all,
- LLRoleActionSet* action_set,
- LLUICtrl::commit_callback_t commit_callback,
- BOOL show_all,
- BOOL filter,
- BOOL is_owner_role)
-{
- LL_DEBUGS() << "Building role list for: " << action_set->mActionSetData->mName << LL_ENDL;
- // See if the allow mask matches anything in this category.
- if (show_all || (allowed_by_some & action_set->mActionSetData->mPowerBit))
- {
- // List all the actions in this category that at least some members have.
- LLSD row;
-
- row["columns"][0]["column"] = "icon";
- row["columns"][0]["type"] = "icon";
-
- icon_map_t::iterator iter = mActionIcons.find("folder");
- if (iter != mActionIcons.end())
- {
- row["columns"][0]["value"] = (*iter).second;
- }
-
- row["columns"][1]["column"] = "action";
- row["columns"][1]["type"] = "text";
- row["columns"][1]["value"] = LLTrans::getString(action_set->mActionSetData->mName);
- row["columns"][1]["font"]["name"] = "SANSSERIF_SMALL";
-
-
- LLScrollListItem* title_row = ctrl->addElement(row, ADD_BOTTOM, action_set->mActionSetData);
-
- LLScrollListText* name_textp = dynamic_cast<LLScrollListText*>(title_row->getColumn(2)); //?? I have no idea fix getColumn(1) return column spacer...
- if (name_textp)
- name_textp->setFontStyle(LLFontGL::BOLD);
-
- bool category_matches_filter = (filter) ? matchesActionSearchFilter(action_set->mActionSetData->mName) : true;
-
- std::vector<LLRoleAction*>::iterator ra_it = action_set->mActions.begin();
- std::vector<LLRoleAction*>::iterator ra_end = action_set->mActions.end();
-
- bool items_match_filter = false;
- BOOL can_change_actions = (!is_owner_role && gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CHANGE_ACTIONS));
-
- for ( ; ra_it != ra_end; ++ra_it)
- {
- // See if anyone has these action.
- if (!show_all && !(allowed_by_some & (*ra_it)->mPowerBit))
- {
- continue;
- }
-
- // See if we are filtering out these actions
- // If we aren't using filters, category_matches_filter will be true.
- if (!category_matches_filter
- && !matchesActionSearchFilter((*ra_it)->mDescription))
- {
- continue;
- }
-
- items_match_filter = true;
-
- // See if everyone has these actions.
- bool show_full_strength = false;
- if ( (allowed_by_some & (*ra_it)->mPowerBit) == (allowed_by_all & (*ra_it)->mPowerBit) )
- {
- show_full_strength = true;
- }
-
- LLSD row;
-
- S32 column_index = 0;
- row["columns"][column_index]["column"] = "icon";
- ++column_index;
-
-
- S32 check_box_index = -1;
- if (commit_callback)
- {
- row["columns"][column_index]["column"] = "checkbox";
- row["columns"][column_index]["type"] = "checkbox";
- check_box_index = column_index;
- ++column_index;
- }
- else
- {
- if (show_full_strength)
- {
- icon_map_t::iterator iter = mActionIcons.find("full");
- if (iter != mActionIcons.end())
- {
- row["columns"][column_index]["column"] = "checkbox";
- row["columns"][column_index]["type"] = "icon";
- row["columns"][column_index]["value"] = (*iter).second;
- ++column_index;
- }
- }
- else
- {
- icon_map_t::iterator iter = mActionIcons.find("partial");
- if (iter != mActionIcons.end())
- {
- row["columns"][column_index]["column"] = "checkbox";
- row["columns"][column_index]["type"] = "icon";
- row["columns"][column_index]["value"] = (*iter).second;
- ++column_index;
- }
- row["enabled"] = false;
- }
- }
-
- row["columns"][column_index]["column"] = "action";
- row["columns"][column_index]["value"] = (*ra_it)->mDescription;
- row["columns"][column_index]["font"] = "SANSSERIF_SMALL";
-
- if(mHasGroupBanPower)
- {
- // The ban ability is being set. Prevent these abilities from being manipulated
- if((*ra_it)->mPowerBit == GP_MEMBER_EJECT)
- {
- row["enabled"] = false;
- }
- else if((*ra_it)->mPowerBit == GP_ROLE_REMOVE_MEMBER)
- {
- row["enabled"] = false;
- }
- }
- else
- {
- // The ban ability is not set. Allow these abilities to be manipulated
- if((*ra_it)->mPowerBit == GP_MEMBER_EJECT)
- {
- row["enabled"] = true;
- }
- else if((*ra_it)->mPowerBit == GP_ROLE_REMOVE_MEMBER)
- {
- row["enabled"] = true;
- }
- }
-
- LLScrollListItem* item = ctrl->addElement(row, ADD_BOTTOM, (*ra_it));
-
- if (-1 != check_box_index)
- {
- // Extract the checkbox that was created.
- LLScrollListCheck* check_cell = (LLScrollListCheck*) item->getColumn(check_box_index);
- LLCheckBoxCtrl* check = check_cell->getCheckBox();
- check->setEnabled(can_change_actions);
- check->setCommitCallback(commit_callback);
- check->setToolTip( check->getLabel() );
-
- if (show_all)
- {
- check->setTentative(FALSE);
- if (allowed_by_some & (*ra_it)->mPowerBit)
- {
- check->set(TRUE);
- }
- else
- {
- check->set(FALSE);
- }
- }
- else
- {
- check->set(TRUE);
- if (show_full_strength)
- {
- check->setTentative(FALSE);
- }
- else
- {
- check->setTentative(TRUE);
- }
- }
-
- // Regardless of whether or not this ability is allowed by all or some, we want to prevent
- // the group managers from accidentally disabling either of the two additional abilities
- // tied with GP_GROUP_BAN_ACCESS.
- if( (allowed_by_all & GP_GROUP_BAN_ACCESS) == GP_GROUP_BAN_ACCESS ||
- (allowed_by_some & GP_GROUP_BAN_ACCESS) == GP_GROUP_BAN_ACCESS)
- {
- mHasGroupBanPower = true;
- }
- }
- }
-
- if (!items_match_filter)
- {
- S32 title_index = ctrl->getItemIndex(title_row);
- ctrl->deleteSingleItem(title_index);
- }
- }
+ U64 allowed_by_some,
+ U64 allowed_by_all,
+ LLRoleActionSet* action_set,
+ LLUICtrl::commit_callback_t commit_callback,
+ BOOL show_all,
+ BOOL filter,
+ BOOL is_owner_role)
+{
+ LL_DEBUGS() << "Building role list for: " << action_set->mActionSetData->mName << LL_ENDL;
+ // See if the allow mask matches anything in this category.
+ if (show_all || (allowed_by_some & action_set->mActionSetData->mPowerBit))
+ {
+ // List all the actions in this category that at least some members have.
+ LLSD row;
+
+ row["columns"][0]["column"] = "icon";
+ row["columns"][0]["type"] = "icon";
+
+ icon_map_t::iterator iter = mActionIcons.find("folder");
+ if (iter != mActionIcons.end())
+ {
+ row["columns"][0]["value"] = (*iter).second;
+ }
+
+ row["columns"][1]["column"] = "action";
+ row["columns"][1]["type"] = "text";
+ row["columns"][1]["value"] = LLTrans::getString(action_set->mActionSetData->mName);
+ row["columns"][1]["font"]["name"] = "SANSSERIF_SMALL";
+
+
+ LLScrollListItem* title_row = ctrl->addElement(row, ADD_BOTTOM, action_set->mActionSetData);
+
+ LLScrollListText* name_textp = dynamic_cast<LLScrollListText*>(title_row->getColumn(2)); //?? I have no idea fix getColumn(1) return column spacer...
+ if (name_textp)
+ name_textp->setFontStyle(LLFontGL::BOLD);
+
+ bool category_matches_filter = (filter) ? matchesActionSearchFilter(action_set->mActionSetData->mName) : true;
+
+ std::vector<LLRoleAction*>::iterator ra_it = action_set->mActions.begin();
+ std::vector<LLRoleAction*>::iterator ra_end = action_set->mActions.end();
+
+ bool items_match_filter = false;
+ BOOL can_change_actions = (!is_owner_role && gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CHANGE_ACTIONS));
+
+ for ( ; ra_it != ra_end; ++ra_it)
+ {
+ // See if anyone has these action.
+ if (!show_all && !(allowed_by_some & (*ra_it)->mPowerBit))
+ {
+ continue;
+ }
+
+ // See if we are filtering out these actions
+ // If we aren't using filters, category_matches_filter will be true.
+ if (!category_matches_filter
+ && !matchesActionSearchFilter((*ra_it)->mDescription))
+ {
+ continue;
+ }
+
+ items_match_filter = true;
+
+ // See if everyone has these actions.
+ bool show_full_strength = false;
+ if ( (allowed_by_some & (*ra_it)->mPowerBit) == (allowed_by_all & (*ra_it)->mPowerBit) )
+ {
+ show_full_strength = true;
+ }
+
+ LLSD row;
+
+ S32 column_index = 0;
+ row["columns"][column_index]["column"] = "icon";
+ ++column_index;
+
+
+ S32 check_box_index = -1;
+ if (commit_callback)
+ {
+ row["columns"][column_index]["column"] = "checkbox";
+ row["columns"][column_index]["type"] = "checkbox";
+ check_box_index = column_index;
+ ++column_index;
+ }
+ else
+ {
+ if (show_full_strength)
+ {
+ icon_map_t::iterator iter = mActionIcons.find("full");
+ if (iter != mActionIcons.end())
+ {
+ row["columns"][column_index]["column"] = "checkbox";
+ row["columns"][column_index]["type"] = "icon";
+ row["columns"][column_index]["value"] = (*iter).second;
+ ++column_index;
+ }
+ }
+ else
+ {
+ icon_map_t::iterator iter = mActionIcons.find("partial");
+ if (iter != mActionIcons.end())
+ {
+ row["columns"][column_index]["column"] = "checkbox";
+ row["columns"][column_index]["type"] = "icon";
+ row["columns"][column_index]["value"] = (*iter).second;
+ ++column_index;
+ }
+ row["enabled"] = false;
+ }
+ }
+
+ row["columns"][column_index]["column"] = "action";
+ row["columns"][column_index]["value"] = (*ra_it)->mDescription;
+ row["columns"][column_index]["font"] = "SANSSERIF_SMALL";
+
+ if(mHasGroupBanPower)
+ {
+ // The ban ability is being set. Prevent these abilities from being manipulated
+ if((*ra_it)->mPowerBit == GP_MEMBER_EJECT)
+ {
+ row["enabled"] = false;
+ }
+ else if((*ra_it)->mPowerBit == GP_ROLE_REMOVE_MEMBER)
+ {
+ row["enabled"] = false;
+ }
+ }
+ else
+ {
+ // The ban ability is not set. Allow these abilities to be manipulated
+ if((*ra_it)->mPowerBit == GP_MEMBER_EJECT)
+ {
+ row["enabled"] = true;
+ }
+ else if((*ra_it)->mPowerBit == GP_ROLE_REMOVE_MEMBER)
+ {
+ row["enabled"] = true;
+ }
+ }
+
+ LLScrollListItem* item = ctrl->addElement(row, ADD_BOTTOM, (*ra_it));
+
+ if (-1 != check_box_index)
+ {
+ // Extract the checkbox that was created.
+ LLScrollListCheck* check_cell = (LLScrollListCheck*) item->getColumn(check_box_index);
+ LLCheckBoxCtrl* check = check_cell->getCheckBox();
+ check->setEnabled(can_change_actions);
+ check->setCommitCallback(commit_callback);
+ check->setToolTip( check->getLabel() );
+
+ if (show_all)
+ {
+ check->setTentative(FALSE);
+ if (allowed_by_some & (*ra_it)->mPowerBit)
+ {
+ check->set(TRUE);
+ }
+ else
+ {
+ check->set(FALSE);
+ }
+ }
+ else
+ {
+ check->set(TRUE);
+ if (show_full_strength)
+ {
+ check->setTentative(FALSE);
+ }
+ else
+ {
+ check->setTentative(TRUE);
+ }
+ }
+
+ // Regardless of whether or not this ability is allowed by all or some, we want to prevent
+ // the group managers from accidentally disabling either of the two additional abilities
+ // tied with GP_GROUP_BAN_ACCESS.
+ if( (allowed_by_all & GP_GROUP_BAN_ACCESS) == GP_GROUP_BAN_ACCESS ||
+ (allowed_by_some & GP_GROUP_BAN_ACCESS) == GP_GROUP_BAN_ACCESS)
+ {
+ mHasGroupBanPower = true;
+ }
+ }
+ }
+
+ if (!items_match_filter)
+ {
+ S32 title_index = ctrl->getItemIndex(title_row);
+ ctrl->deleteSingleItem(title_index);
+ }
+ }
}
void LLPanelGroupSubTab::setFooterEnabled(BOOL enable)
{
- if (mFooter)
- {
- mFooter->setAllChildrenEnabled(enable);
- }
+ if (mFooter)
+ {
+ mFooter->setAllChildrenEnabled(enable);
+ }
}
@@ -779,1173 +779,1173 @@ void LLPanelGroupSubTab::setFooterEnabled(BOOL enable)
static LLPanelInjector<LLPanelGroupMembersSubTab> t_panel_group_members_subtab("panel_group_members_subtab");
LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab()
-: LLPanelGroupSubTab(),
- mMembersList(NULL),
- mAssignedRolesList(NULL),
- mAllowedActionsList(NULL),
- mChanged(FALSE),
- mPendingMemberUpdate(FALSE),
- mHasMatch(FALSE),
- mNumOwnerAdditions(0)
+: LLPanelGroupSubTab(),
+ mMembersList(NULL),
+ mAssignedRolesList(NULL),
+ mAllowedActionsList(NULL),
+ mChanged(FALSE),
+ mPendingMemberUpdate(FALSE),
+ mHasMatch(FALSE),
+ mNumOwnerAdditions(0)
{
}
LLPanelGroupMembersSubTab::~LLPanelGroupMembersSubTab()
{
- for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it)
- {
- if (it->second.connected())
- {
- it->second.disconnect();
- }
- }
- mAvatarNameCacheConnections.clear();
- if (mMembersList)
- {
- gSavedSettings.setString("GroupMembersSortOrder", mMembersList->getSortColumnName());
- }
+ for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it)
+ {
+ if (it->second.connected())
+ {
+ it->second.disconnect();
+ }
+ }
+ mAvatarNameCacheConnections.clear();
+ if (mMembersList)
+ {
+ gSavedSettings.setString("GroupMembersSortOrder", mMembersList->getSortColumnName());
+ }
}
BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
{
- LLPanelGroupSubTab::postBuildSubTab(root);
-
- // Upcast parent so we can ask it for sibling controls.
- LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root;
-
- // Look recursively from the parent to find all our widgets.
- bool recurse = true;
- mHeader = parent->findChild<LLPanel>("members_header", recurse);
- mFooter = parent->findChild<LLPanel>("members_footer", recurse);
-
- mMembersList = parent->getChild<LLNameListCtrl>("member_list", recurse);
- mAssignedRolesList = parent->getChild<LLScrollListCtrl>("member_assigned_roles", recurse);
- mAllowedActionsList = parent->getChild<LLScrollListCtrl>("member_allowed_actions", recurse);
- mActionDescription = parent->getChild<LLTextEditor>("member_action_description", recurse);
-
- if (!mMembersList || !mAssignedRolesList || !mAllowedActionsList || !mActionDescription) return FALSE;
-
- mAllowedActionsList->setCommitOnSelectionChange(TRUE);
- mAllowedActionsList->setCommitCallback(boost::bind(&LLPanelGroupMembersSubTab::updateActionDescription, this));
-
- // We want to be notified whenever a member is selected.
- mMembersList->setCommitOnSelectionChange(TRUE);
- mMembersList->setCommitCallback(onMemberSelect, this);
- // Show the member's profile on double click.
- mMembersList->setDoubleClickCallback(onMemberDoubleClick, this);
- mMembersList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
- mMembersList->setIsFriendCallback(LLAvatarActions::isFriend);
-
- LLSD row;
- row["columns"][0]["column"] = "name";
- row["columns"][1]["column"] = "donated";
- row["columns"][2]["column"] = "online";
- mMembersList->addElement(row);
- std::string order_by = gSavedSettings.getString("GroupMembersSortOrder");
- if(!order_by.empty())
- {
- mMembersList->sortByColumn(order_by, TRUE);
- }
-
- LLButton* button = parent->getChild<LLButton>("member_invite", recurse);
- if ( button )
- {
- button->setClickedCallback(onInviteMember, this);
- button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE));
- }
-
- mEjectBtn = parent->getChild<LLButton>("member_eject", recurse);
- if ( mEjectBtn )
- {
- mEjectBtn->setClickedCallback(onEjectMembers, this);
- mEjectBtn->setEnabled(FALSE);
- }
-
- mBanBtn = parent->getChild<LLButton>("member_ban", recurse);
- if(mBanBtn)
- {
- mBanBtn->setClickedCallback(onBanMember, this);
- mBanBtn->setEnabled(FALSE);
- }
-
- return TRUE;
+ LLPanelGroupSubTab::postBuildSubTab(root);
+
+ // Upcast parent so we can ask it for sibling controls.
+ LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root;
+
+ // Look recursively from the parent to find all our widgets.
+ bool recurse = true;
+ mHeader = parent->findChild<LLPanel>("members_header", recurse);
+ mFooter = parent->findChild<LLPanel>("members_footer", recurse);
+
+ mMembersList = parent->getChild<LLNameListCtrl>("member_list", recurse);
+ mAssignedRolesList = parent->getChild<LLScrollListCtrl>("member_assigned_roles", recurse);
+ mAllowedActionsList = parent->getChild<LLScrollListCtrl>("member_allowed_actions", recurse);
+ mActionDescription = parent->getChild<LLTextEditor>("member_action_description", recurse);
+
+ if (!mMembersList || !mAssignedRolesList || !mAllowedActionsList || !mActionDescription) return FALSE;
+
+ mAllowedActionsList->setCommitOnSelectionChange(TRUE);
+ mAllowedActionsList->setCommitCallback(boost::bind(&LLPanelGroupMembersSubTab::updateActionDescription, this));
+
+ // We want to be notified whenever a member is selected.
+ mMembersList->setCommitOnSelectionChange(TRUE);
+ mMembersList->setCommitCallback(onMemberSelect, this);
+ // Show the member's profile on double click.
+ mMembersList->setDoubleClickCallback(onMemberDoubleClick, this);
+ mMembersList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+ mMembersList->setIsFriendCallback(LLAvatarActions::isFriend);
+
+ LLSD row;
+ row["columns"][0]["column"] = "name";
+ row["columns"][1]["column"] = "donated";
+ row["columns"][2]["column"] = "online";
+ mMembersList->addElement(row);
+ std::string order_by = gSavedSettings.getString("GroupMembersSortOrder");
+ if(!order_by.empty())
+ {
+ mMembersList->sortByColumn(order_by, TRUE);
+ }
+
+ LLButton* button = parent->getChild<LLButton>("member_invite", recurse);
+ if ( button )
+ {
+ button->setClickedCallback(onInviteMember, this);
+ button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE));
+ }
+
+ mEjectBtn = parent->getChild<LLButton>("member_eject", recurse);
+ if ( mEjectBtn )
+ {
+ mEjectBtn->setClickedCallback(onEjectMembers, this);
+ mEjectBtn->setEnabled(FALSE);
+ }
+
+ mBanBtn = parent->getChild<LLButton>("member_ban", recurse);
+ if(mBanBtn)
+ {
+ mBanBtn->setClickedCallback(onBanMember, this);
+ mBanBtn->setEnabled(FALSE);
+ }
+
+ return TRUE;
}
void LLPanelGroupMembersSubTab::setGroupID(const LLUUID& id)
{
- //clear members list
- if(mMembersList) mMembersList->deleteAllItems();
- if(mAssignedRolesList) mAssignedRolesList->deleteAllItems();
- if(mAllowedActionsList) mAllowedActionsList->deleteAllItems();
+ //clear members list
+ if(mMembersList) mMembersList->deleteAllItems();
+ if(mAssignedRolesList) mAssignedRolesList->deleteAllItems();
+ if(mAllowedActionsList) mAllowedActionsList->deleteAllItems();
- LLPanelGroupSubTab::setGroupID(id);
+ LLPanelGroupSubTab::setGroupID(id);
}
// static
void LLPanelGroupMembersSubTab::onMemberSelect(LLUICtrl* ctrl, void* user_data)
{
- LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
- self->handleMemberSelect();
+ LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
+ self->handleMemberSelect();
}
void LLPanelGroupMembersSubTab::handleMemberSelect()
{
- LL_DEBUGS() << "LLPanelGroupMembersSubTab::handleMemberSelect" << LL_ENDL;
-
- mAssignedRolesList->deleteAllItems();
- mAllowedActionsList->deleteAllItems();
- mActionDescription->clear();
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "LLPanelGroupMembersSubTab::handleMemberSelect() "
- << "-- No group data!" << LL_ENDL;
- return;
- }
-
- // Check if there is anything selected.
- std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
- if (selection.empty()) return;
-
- // Build a vector of all selected members, and gather allowed actions.
- uuid_vec_t selected_members;
- U64 allowed_by_all = GP_ALL_POWERS; //0xFFFFffffFFFFffffLL;
- U64 allowed_by_some = 0;
-
- std::vector<LLScrollListItem*>::iterator itor;
- for (itor = selection.begin();
- itor != selection.end(); ++itor)
- {
- LLUUID member_id = (*itor)->getUUID();
-
- selected_members.push_back( member_id );
- // Get this member's power mask including any unsaved changes
-
- U64 powers = getAgentPowersBasedOnRoleChanges( member_id );
-
- allowed_by_all &= powers;
- allowed_by_some |= powers;
- }
- std::sort(selected_members.begin(), selected_members.end());
-
- //////////////////////////////////
- // Build the allowed actions list.
- //////////////////////////////////
- buildActionsList(mAllowedActionsList,
- allowed_by_some,
- allowed_by_all,
- NULL,
- FALSE,
- FALSE,
- FALSE);
-
- //////////////////////////////////
- // Build the assigned roles list.
- //////////////////////////////////
- // Add each role to the assigned roles list.
- LLGroupMgrGroupData::role_list_t::iterator iter = gdatap->mRoles.begin();
- LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end();
-
- BOOL can_ban_members = gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS);
- BOOL can_eject_members = gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_EJECT);
- BOOL member_is_owner = FALSE;
-
- for( ; iter != end; ++iter)
- {
- // Count how many selected users are in this role.
- const LLUUID& role_id = iter->first;
- LLGroupRoleData* group_role_data = iter->second;
-
- if (group_role_data)
- {
- const BOOL needs_sort = FALSE;
- S32 count = group_role_data->getMembersInRole(
- selected_members, needs_sort);
- //check if the user has permissions to assign/remove
- //members to/from the role (but the ability to add/remove
- //should only be based on the "saved" changes to the role
- //not in the temp/meta data. -jwolk
- BOOL cb_enable = ( (count > 0) ?
- agentCanRemoveFromRole(mGroupID, role_id) :
- agentCanAddToRole(mGroupID, role_id) );
-
-
- // Owner role has special enabling permissions for removal.
- if (cb_enable && (count > 0) && role_id == gdatap->mOwnerRole)
- {
- // Check if any owners besides this agent are selected.
- uuid_vec_t::const_iterator member_iter;
- uuid_vec_t::const_iterator member_end =
- selected_members.end();
- for (member_iter = selected_members.begin();
- member_iter != member_end;
- ++member_iter)
- {
- // Don't count the agent.
- if ((*member_iter) == gAgent.getID()) continue;
-
- // Look up the member data.
- LLGroupMgrGroupData::member_list_t::iterator mi =
- gdatap->mMembers.find((*member_iter));
- if (mi == gdatap->mMembers.end()) continue;
- LLGroupMemberData* member_data = (*mi).second;
- // Is the member an owner?
- if ( member_data && member_data->isInRole(gdatap->mOwnerRole) )
- {
- // Can't remove other owners.
- cb_enable = FALSE;
- can_ban_members = FALSE;
- break;
- }
- }
- }
-
- //now see if there are any role changes for the selected
- //members and remember to include them
- uuid_vec_t::iterator sel_mem_iter = selected_members.begin();
- for (; sel_mem_iter != selected_members.end(); sel_mem_iter++)
- {
- LLRoleMemberChangeType type;
- if ( getRoleChangeType(*sel_mem_iter, role_id, type) )
- {
- if ( type == RMC_ADD ) count++;
- else if ( type == RMC_REMOVE ) count--;
- }
- }
-
- // If anyone selected is in any role besides 'Everyone' then they can't be ejected.
- if (role_id.notNull() && (count > 0))
- {
- can_eject_members = FALSE;
- if (role_id == gdatap->mOwnerRole)
- {
- member_is_owner = TRUE;
- }
- }
-
- LLRoleData rd;
- if (gdatap->getRoleData(role_id,rd))
- {
- std::ostringstream label;
- label << rd.mRoleName;
- // Don't bother showing a count, if there is only 0 or 1.
- if (count > 1)
- {
- label << ": " << count ;
- }
-
- LLSD row;
- row["id"] = role_id;
-
- row["columns"][0]["column"] = "checkbox";
- row["columns"][0]["type"] = "checkbox";
-
- row["columns"][1]["column"] = "role";
- row["columns"][1]["value"] = label.str();
-
- if (row["id"].asUUID().isNull())
- {
- // This is the everyone role, you can't take people out of the everyone role!
- row["enabled"] = false;
- }
-
- LLScrollListItem* item = mAssignedRolesList->addElement(row);
-
- // Extract the checkbox that was created.
- LLScrollListCheck* check_cell = (LLScrollListCheck*) item->getColumn(0);
- LLCheckBoxCtrl* check = check_cell->getCheckBox();
- check->setCommitCallback(onRoleCheck, this);
- check->set( count > 0 );
- check->setTentative(
- (0 != count)
- && (selected_members.size() !=
- (uuid_vec_t::size_type)count));
-
- //NOTE: as of right now a user can break the group
- //by removing himself from a role if he is the
- //last owner. We should check for this special case
- // -jwolk
- check->setEnabled(cb_enable);
- item->setEnabled(cb_enable);
- }
- }
- else
- {
- // This could happen if changes are not synced right on sub-panel change.
- LL_WARNS() << "No group role data for " << iter->second << LL_ENDL;
- }
- }
- mAssignedRolesList->setEnabled(TRUE);
-
- if (gAgent.isGodlike())
- {
- can_eject_members = TRUE;
- // can_ban_members = TRUE;
- }
-
- if (!can_eject_members && !member_is_owner)
- {
- // Maybe we can eject them because we are an owner...
- LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(gAgent.getID());
- if (mi != gdatap->mMembers.end())
- {
- LLGroupMemberData* member_data = (*mi).second;
-
- if ( member_data && member_data->isInRole(gdatap->mOwnerRole) )
- {
- can_eject_members = TRUE;
- //can_ban_members = TRUE;
- }
- }
-
- }
-
- // ... or we can eject them because we have all the requisite powers...
- if( gAgent.hasPowerInGroup(mGroupID, GP_ROLE_REMOVE_MEMBER) &&
- !member_is_owner)
- {
- if( gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_EJECT))
- {
- can_eject_members = TRUE;
- }
-
- if( gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS))
- {
- can_ban_members = TRUE;
- }
- }
-
-
- uuid_vec_t::const_iterator member_iter = selected_members.begin();
- uuid_vec_t::const_iterator member_end = selected_members.end();
- for ( ; member_iter != member_end; ++member_iter)
- {
- // Don't count the agent.
- if ((*member_iter) == gAgent.getID())
- {
- can_eject_members = FALSE;
- can_ban_members = FALSE;
- }
- }
-
- mBanBtn->setEnabled(can_ban_members);
- mEjectBtn->setEnabled(can_eject_members);
+ LL_DEBUGS() << "LLPanelGroupMembersSubTab::handleMemberSelect" << LL_ENDL;
+
+ mAssignedRolesList->deleteAllItems();
+ mAllowedActionsList->deleteAllItems();
+ mActionDescription->clear();
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "LLPanelGroupMembersSubTab::handleMemberSelect() "
+ << "-- No group data!" << LL_ENDL;
+ return;
+ }
+
+ // Check if there is anything selected.
+ std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
+ if (selection.empty()) return;
+
+ // Build a vector of all selected members, and gather allowed actions.
+ uuid_vec_t selected_members;
+ U64 allowed_by_all = GP_ALL_POWERS; //0xFFFFffffFFFFffffLL;
+ U64 allowed_by_some = 0;
+
+ std::vector<LLScrollListItem*>::iterator itor;
+ for (itor = selection.begin();
+ itor != selection.end(); ++itor)
+ {
+ LLUUID member_id = (*itor)->getUUID();
+
+ selected_members.push_back( member_id );
+ // Get this member's power mask including any unsaved changes
+
+ U64 powers = getAgentPowersBasedOnRoleChanges( member_id );
+
+ allowed_by_all &= powers;
+ allowed_by_some |= powers;
+ }
+ std::sort(selected_members.begin(), selected_members.end());
+
+ //////////////////////////////////
+ // Build the allowed actions list.
+ //////////////////////////////////
+ buildActionsList(mAllowedActionsList,
+ allowed_by_some,
+ allowed_by_all,
+ NULL,
+ FALSE,
+ FALSE,
+ FALSE);
+
+ //////////////////////////////////
+ // Build the assigned roles list.
+ //////////////////////////////////
+ // Add each role to the assigned roles list.
+ LLGroupMgrGroupData::role_list_t::iterator iter = gdatap->mRoles.begin();
+ LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end();
+
+ BOOL can_ban_members = gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS);
+ BOOL can_eject_members = gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_EJECT);
+ BOOL member_is_owner = FALSE;
+
+ for( ; iter != end; ++iter)
+ {
+ // Count how many selected users are in this role.
+ const LLUUID& role_id = iter->first;
+ LLGroupRoleData* group_role_data = iter->second;
+
+ if (group_role_data)
+ {
+ const BOOL needs_sort = FALSE;
+ S32 count = group_role_data->getMembersInRole(
+ selected_members, needs_sort);
+ //check if the user has permissions to assign/remove
+ //members to/from the role (but the ability to add/remove
+ //should only be based on the "saved" changes to the role
+ //not in the temp/meta data. -jwolk
+ BOOL cb_enable = ( (count > 0) ?
+ agentCanRemoveFromRole(mGroupID, role_id) :
+ agentCanAddToRole(mGroupID, role_id) );
+
+
+ // Owner role has special enabling permissions for removal.
+ if (cb_enable && (count > 0) && role_id == gdatap->mOwnerRole)
+ {
+ // Check if any owners besides this agent are selected.
+ uuid_vec_t::const_iterator member_iter;
+ uuid_vec_t::const_iterator member_end =
+ selected_members.end();
+ for (member_iter = selected_members.begin();
+ member_iter != member_end;
+ ++member_iter)
+ {
+ // Don't count the agent.
+ if ((*member_iter) == gAgent.getID()) continue;
+
+ // Look up the member data.
+ LLGroupMgrGroupData::member_list_t::iterator mi =
+ gdatap->mMembers.find((*member_iter));
+ if (mi == gdatap->mMembers.end()) continue;
+ LLGroupMemberData* member_data = (*mi).second;
+ // Is the member an owner?
+ if ( member_data && member_data->isInRole(gdatap->mOwnerRole) )
+ {
+ // Can't remove other owners.
+ cb_enable = FALSE;
+ can_ban_members = FALSE;
+ break;
+ }
+ }
+ }
+
+ //now see if there are any role changes for the selected
+ //members and remember to include them
+ uuid_vec_t::iterator sel_mem_iter = selected_members.begin();
+ for (; sel_mem_iter != selected_members.end(); sel_mem_iter++)
+ {
+ LLRoleMemberChangeType type;
+ if ( getRoleChangeType(*sel_mem_iter, role_id, type) )
+ {
+ if ( type == RMC_ADD ) count++;
+ else if ( type == RMC_REMOVE ) count--;
+ }
+ }
+
+ // If anyone selected is in any role besides 'Everyone' then they can't be ejected.
+ if (role_id.notNull() && (count > 0))
+ {
+ can_eject_members = FALSE;
+ if (role_id == gdatap->mOwnerRole)
+ {
+ member_is_owner = TRUE;
+ }
+ }
+
+ LLRoleData rd;
+ if (gdatap->getRoleData(role_id,rd))
+ {
+ std::ostringstream label;
+ label << rd.mRoleName;
+ // Don't bother showing a count, if there is only 0 or 1.
+ if (count > 1)
+ {
+ label << ": " << count ;
+ }
+
+ LLSD row;
+ row["id"] = role_id;
+
+ row["columns"][0]["column"] = "checkbox";
+ row["columns"][0]["type"] = "checkbox";
+
+ row["columns"][1]["column"] = "role";
+ row["columns"][1]["value"] = label.str();
+
+ if (row["id"].asUUID().isNull())
+ {
+ // This is the everyone role, you can't take people out of the everyone role!
+ row["enabled"] = false;
+ }
+
+ LLScrollListItem* item = mAssignedRolesList->addElement(row);
+
+ // Extract the checkbox that was created.
+ LLScrollListCheck* check_cell = (LLScrollListCheck*) item->getColumn(0);
+ LLCheckBoxCtrl* check = check_cell->getCheckBox();
+ check->setCommitCallback(onRoleCheck, this);
+ check->set( count > 0 );
+ check->setTentative(
+ (0 != count)
+ && (selected_members.size() !=
+ (uuid_vec_t::size_type)count));
+
+ //NOTE: as of right now a user can break the group
+ //by removing himself from a role if he is the
+ //last owner. We should check for this special case
+ // -jwolk
+ check->setEnabled(cb_enable);
+ item->setEnabled(cb_enable);
+ }
+ }
+ else
+ {
+ // This could happen if changes are not synced right on sub-panel change.
+ LL_WARNS() << "No group role data for " << iter->second << LL_ENDL;
+ }
+ }
+ mAssignedRolesList->setEnabled(TRUE);
+
+ if (gAgent.isGodlike())
+ {
+ can_eject_members = TRUE;
+ // can_ban_members = TRUE;
+ }
+
+ if (!can_eject_members && !member_is_owner)
+ {
+ // Maybe we can eject them because we are an owner...
+ LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(gAgent.getID());
+ if (mi != gdatap->mMembers.end())
+ {
+ LLGroupMemberData* member_data = (*mi).second;
+
+ if ( member_data && member_data->isInRole(gdatap->mOwnerRole) )
+ {
+ can_eject_members = TRUE;
+ //can_ban_members = TRUE;
+ }
+ }
+
+ }
+
+ // ... or we can eject them because we have all the requisite powers...
+ if( gAgent.hasPowerInGroup(mGroupID, GP_ROLE_REMOVE_MEMBER) &&
+ !member_is_owner)
+ {
+ if( gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_EJECT))
+ {
+ can_eject_members = TRUE;
+ }
+
+ if( gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS))
+ {
+ can_ban_members = TRUE;
+ }
+ }
+
+
+ uuid_vec_t::const_iterator member_iter = selected_members.begin();
+ uuid_vec_t::const_iterator member_end = selected_members.end();
+ for ( ; member_iter != member_end; ++member_iter)
+ {
+ // Don't count the agent.
+ if ((*member_iter) == gAgent.getID())
+ {
+ can_eject_members = FALSE;
+ can_ban_members = FALSE;
+ }
+ }
+
+ mBanBtn->setEnabled(can_ban_members);
+ mEjectBtn->setEnabled(can_eject_members);
}
// static
void LLPanelGroupMembersSubTab::onMemberDoubleClick(void* user_data)
{
- LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
- self->handleMemberDoubleClick();
+ LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
+ self->handleMemberDoubleClick();
}
//static
void LLPanelGroupMembersSubTab::onInviteMember(void *userdata)
{
- LLPanelGroupMembersSubTab* selfp = (LLPanelGroupMembersSubTab*) userdata;
+ LLPanelGroupMembersSubTab* selfp = (LLPanelGroupMembersSubTab*) userdata;
- if ( selfp )
- {
- selfp->handleInviteMember();
- }
+ if ( selfp )
+ {
+ selfp->handleInviteMember();
+ }
}
void LLPanelGroupMembersSubTab::handleInviteMember()
{
- LLFloaterGroupInvite::showForGroup(mGroupID, NULL, false);
+ LLFloaterGroupInvite::showForGroup(mGroupID, NULL, false);
}
void LLPanelGroupMembersSubTab::onEjectMembers(void *userdata)
{
- LLPanelGroupMembersSubTab* selfp = (LLPanelGroupMembersSubTab*) userdata;
+ LLPanelGroupMembersSubTab* selfp = (LLPanelGroupMembersSubTab*) userdata;
- if ( selfp )
- {
- selfp->confirmEjectMembers();
- }
+ if ( selfp )
+ {
+ selfp->confirmEjectMembers();
+ }
}
void LLPanelGroupMembersSubTab::confirmEjectMembers()
{
- std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
- if (selection.empty()) return;
-
- S32 selection_count = selection.size();
- if (selection_count == 1)
- {
- LLSD args;
- LLAvatarName av_name;
- LLAvatarNameCache::get(mMembersList->getValue(), &av_name);
- args["AVATAR_NAME"] = av_name.getUserName();
- LLSD payload;
- LLNotificationsUtil::add("EjectGroupMemberWarning",
- args,
- payload,
- boost::bind(&LLPanelGroupMembersSubTab::handleEjectCallback, this, _1, _2));
- }
- else
- {
- LLSD args;
- args["COUNT"] = llformat("%d", selection_count);
- LLSD payload;
- LLNotificationsUtil::add("EjectGroupMembersWarning",
- args,
- payload,
- boost::bind(&LLPanelGroupMembersSubTab::handleEjectCallback, this, _1, _2));
- }
+ std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
+ if (selection.empty()) return;
+
+ S32 selection_count = selection.size();
+ if (selection_count == 1)
+ {
+ LLSD args;
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(mMembersList->getValue(), &av_name);
+ args["AVATAR_NAME"] = av_name.getUserName();
+ LLSD payload;
+ LLNotificationsUtil::add("EjectGroupMemberWarning",
+ args,
+ payload,
+ boost::bind(&LLPanelGroupMembersSubTab::handleEjectCallback, this, _1, _2));
+ }
+ else
+ {
+ LLSD args;
+ args["COUNT"] = llformat("%d", selection_count);
+ LLSD payload;
+ LLNotificationsUtil::add("EjectGroupMembersWarning",
+ args,
+ payload,
+ boost::bind(&LLPanelGroupMembersSubTab::handleEjectCallback, this, _1, _2));
+ }
}
void LLPanelGroupMembersSubTab::handleEjectMembers()
{
- //send down an eject message
- uuid_vec_t selected_members;
+ //send down an eject message
+ uuid_vec_t selected_members;
- std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
- if (selection.empty()) return;
+ std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
+ if (selection.empty()) return;
- std::vector<LLScrollListItem*>::iterator itor;
- for (itor = selection.begin() ;
- itor != selection.end(); ++itor)
- {
- LLUUID member_id = (*itor)->getUUID();
- selected_members.push_back( member_id );
- }
+ std::vector<LLScrollListItem*>::iterator itor;
+ for (itor = selection.begin() ;
+ itor != selection.end(); ++itor)
+ {
+ LLUUID member_id = (*itor)->getUUID();
+ selected_members.push_back( member_id );
+ }
- mMembersList->deleteSelectedItems();
+ mMembersList->deleteSelectedItems();
- sendEjectNotifications(mGroupID, selected_members);
+ sendEjectNotifications(mGroupID, selected_members);
- LLGroupMgr::getInstance()->sendGroupMemberEjects(mGroupID, selected_members);
+ LLGroupMgr::getInstance()->sendGroupMemberEjects(mGroupID, selected_members);
}
bool LLPanelGroupMembersSubTab::handleEjectCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option) // Eject button
- {
- handleEjectMembers();
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option) // Eject button
+ {
+ handleEjectMembers();
+ }
+ return false;
}
void LLPanelGroupMembersSubTab::sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members)
{
- LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id);
+ LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (group_data)
- {
- for (uuid_vec_t::const_iterator i = selected_members.begin(); i != selected_members.end(); ++i)
- {
- LLSD args;
- args["AVATAR_NAME"] = LLSLURL("agent", *i, "completename").getSLURLString();
- args["GROUP_NAME"] = group_data->mName;
-
- LLNotifications::instance().add(LLNotification::Params("EjectAvatarFromGroup").substitutions(args));
- }
- }
+ if (group_data)
+ {
+ for (uuid_vec_t::const_iterator i = selected_members.begin(); i != selected_members.end(); ++i)
+ {
+ LLSD args;
+ args["AVATAR_NAME"] = LLSLURL("agent", *i, "completename").getSLURLString();
+ args["GROUP_NAME"] = group_data->mName;
+
+ LLNotifications::instance().add(LLNotification::Params("EjectAvatarFromGroup").substitutions(args));
+ }
+ }
}
void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id,
- LLRoleMemberChangeType type)
-{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap) return;
-
- //add that the user is requesting to change the roles for selected
- //members
- U64 powers_all_have = GP_ALL_POWERS;
- U64 powers_some_have = 0;
-
- BOOL is_owner_role = ( gdatap->mOwnerRole == role_id );
- LLUUID member_id;
-
- std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
- if (selection.empty())
- {
- return;
- }
-
- for (std::vector<LLScrollListItem*>::iterator itor = selection.begin() ;
- itor != selection.end(); ++itor)
- {
- member_id = (*itor)->getUUID();
-
- //see if we requested a change for this member before
- if ( mMemberRoleChangeData.find(member_id) == mMemberRoleChangeData.end() )
- {
- mMemberRoleChangeData[member_id] = new role_change_data_map_t;
- }
- role_change_data_map_t* role_change_datap = mMemberRoleChangeData[member_id];
-
- //now check to see if the selected group member
- //had changed his association with the selected role before
-
- role_change_data_map_t::iterator role = role_change_datap->find(role_id);
- if ( role != role_change_datap->end() )
- {
- //see if the new change type cancels out the previous change
- if (role->second != type)
- {
- role_change_datap->erase(role_id);
- if ( is_owner_role ) mNumOwnerAdditions--;
- }
- //else do nothing
-
- if ( role_change_datap->empty() )
- {
- //the current member now has no role changes
- //so erase the role change and erase the member's entry
- delete role_change_datap;
+ LLRoleMemberChangeType type)
+{
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap) return;
+
+ //add that the user is requesting to change the roles for selected
+ //members
+ U64 powers_all_have = GP_ALL_POWERS;
+ U64 powers_some_have = 0;
+
+ BOOL is_owner_role = ( gdatap->mOwnerRole == role_id );
+ LLUUID member_id;
+
+ std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
+ if (selection.empty())
+ {
+ return;
+ }
+
+ for (std::vector<LLScrollListItem*>::iterator itor = selection.begin() ;
+ itor != selection.end(); ++itor)
+ {
+ member_id = (*itor)->getUUID();
+
+ //see if we requested a change for this member before
+ if ( mMemberRoleChangeData.find(member_id) == mMemberRoleChangeData.end() )
+ {
+ mMemberRoleChangeData[member_id] = new role_change_data_map_t;
+ }
+ role_change_data_map_t* role_change_datap = mMemberRoleChangeData[member_id];
+
+ //now check to see if the selected group member
+ //had changed his association with the selected role before
+
+ role_change_data_map_t::iterator role = role_change_datap->find(role_id);
+ if ( role != role_change_datap->end() )
+ {
+ //see if the new change type cancels out the previous change
+ if (role->second != type)
+ {
+ role_change_datap->erase(role_id);
+ if ( is_owner_role ) mNumOwnerAdditions--;
+ }
+ //else do nothing
+
+ if ( role_change_datap->empty() )
+ {
+ //the current member now has no role changes
+ //so erase the role change and erase the member's entry
+ delete role_change_datap;
role_change_datap = NULL;
- mMemberRoleChangeData.erase(member_id);
- }
- }
- else
- {
- //a previously unchanged role is being changed
- (*role_change_datap)[role_id] = type;
- if ( is_owner_role && type == RMC_ADD ) mNumOwnerAdditions++;
- }
-
- //we need to calculate what powers the selected members
- //have (including the role changes we're making)
- //so that we can rebuild the action list
- U64 new_powers = getAgentPowersBasedOnRoleChanges(member_id);
-
- powers_all_have &= new_powers;
- powers_some_have |= new_powers;
- }
-
-
- mChanged = !mMemberRoleChangeData.empty();
- notifyObservers();
-
- //alrighty now we need to update the actions list
- //to reflect the changes
- mAllowedActionsList->deleteAllItems();
- buildActionsList(mAllowedActionsList,
- powers_some_have,
- powers_all_have,
- NULL,
- FALSE,
- FALSE,
- FALSE);
-}
-
-// static
+ mMemberRoleChangeData.erase(member_id);
+ }
+ }
+ else
+ {
+ //a previously unchanged role is being changed
+ (*role_change_datap)[role_id] = type;
+ if ( is_owner_role && type == RMC_ADD ) mNumOwnerAdditions++;
+ }
+
+ //we need to calculate what powers the selected members
+ //have (including the role changes we're making)
+ //so that we can rebuild the action list
+ U64 new_powers = getAgentPowersBasedOnRoleChanges(member_id);
+
+ powers_all_have &= new_powers;
+ powers_some_have |= new_powers;
+ }
+
+
+ mChanged = !mMemberRoleChangeData.empty();
+ notifyObservers();
+
+ //alrighty now we need to update the actions list
+ //to reflect the changes
+ mAllowedActionsList->deleteAllItems();
+ buildActionsList(mAllowedActionsList,
+ powers_some_have,
+ powers_all_have,
+ NULL,
+ FALSE,
+ FALSE,
+ FALSE);
+}
+
+// static
void LLPanelGroupMembersSubTab::onRoleCheck(LLUICtrl* ctrl, void* user_data)
{
- LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
- LLCheckBoxCtrl* check_box = static_cast<LLCheckBoxCtrl*>(ctrl);
- if (!check_box || !self) return;
+ LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
+ LLCheckBoxCtrl* check_box = static_cast<LLCheckBoxCtrl*>(ctrl);
+ if (!check_box || !self) return;
+
+ LLScrollListItem* first_selected =
+ self->mAssignedRolesList->getFirstSelected();
+ if (first_selected)
+ {
+ LLUUID role_id = first_selected->getUUID();
+ LLRoleMemberChangeType change_type = (check_box->get() ?
+ RMC_ADD :
+ RMC_REMOVE);
- LLScrollListItem* first_selected =
- self->mAssignedRolesList->getFirstSelected();
- if (first_selected)
- {
- LLUUID role_id = first_selected->getUUID();
- LLRoleMemberChangeType change_type = (check_box->get() ?
- RMC_ADD :
- RMC_REMOVE);
-
- self->handleRoleCheck(role_id, change_type);
- }
+ self->handleRoleCheck(role_id, change_type);
+ }
}
void LLPanelGroupMembersSubTab::handleMemberDoubleClick()
{
- LLScrollListItem* selected = mMembersList->getFirstSelected();
- if (selected)
- {
- LLUUID member_id = selected->getUUID();
- LLAvatarActions::showProfile( member_id );
- }
+ LLScrollListItem* selected = mMembersList->getFirstSelected();
+ if (selected)
+ {
+ LLUUID member_id = selected->getUUID();
+ LLAvatarActions::showProfile( member_id );
+ }
}
void LLPanelGroupMembersSubTab::activate()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
-
- LLPanelGroupSubTab::activate();
- if(!mActivated)
- {
- if (!gdatap || !gdatap->isMemberDataComplete())
- {
- LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID);
- }
-
- if (!gdatap || !gdatap->isRoleMemberDataComplete())
- {
- LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(mGroupID);
- }
-
- update(GC_ALL);
- mActivated = true;
- }
- else
- {
- // Members can be removed outside of this tab, checking changes
- if (!gdatap || (gdatap->isMemberDataComplete() && gdatap->mMembers.size() != mMembersList->getItemCount()))
- {
- update(GC_MEMBER_DATA);
- }
- }
- mActionDescription->clear();
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+
+ LLPanelGroupSubTab::activate();
+ if(!mActivated)
+ {
+ if (!gdatap || !gdatap->isMemberDataComplete())
+ {
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID);
+ }
+
+ if (!gdatap || !gdatap->isRoleMemberDataComplete())
+ {
+ LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(mGroupID);
+ }
+
+ update(GC_ALL);
+ mActivated = true;
+ }
+ else
+ {
+ // Members can be removed outside of this tab, checking changes
+ if (!gdatap || (gdatap->isMemberDataComplete() && gdatap->mMembers.size() != mMembersList->getItemCount()))
+ {
+ update(GC_MEMBER_DATA);
+ }
+ }
+ mActionDescription->clear();
}
void LLPanelGroupMembersSubTab::deactivate()
{
- LLPanelGroupSubTab::deactivate();
+ LLPanelGroupSubTab::deactivate();
}
bool LLPanelGroupMembersSubTab::needsApply(std::string& mesg)
{
- return mChanged;
+ return mChanged;
}
void LLPanelGroupMembersSubTab::cancel()
{
- if ( mChanged )
- {
- std::for_each(mMemberRoleChangeData.begin(),
- mMemberRoleChangeData.end(),
- DeletePairedPointer());
- mMemberRoleChangeData.clear();
+ if ( mChanged )
+ {
+ std::for_each(mMemberRoleChangeData.begin(),
+ mMemberRoleChangeData.end(),
+ DeletePairedPointer());
+ mMemberRoleChangeData.clear();
- mChanged = FALSE;
- notifyObservers();
- }
+ mChanged = FALSE;
+ notifyObservers();
+ }
}
bool LLPanelGroupMembersSubTab::apply(std::string& mesg)
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "Unable to get group data for group " << mGroupID << LL_ENDL;
-
- mesg.assign("Unable to save member data. Try again later.");
- return false;
- }
-
- if (mChanged)
- {
- //figure out if we are somehow adding an owner or not and alert
- //the user...possibly make it ignorable
- if ( mNumOwnerAdditions > 0 )
- {
- LLRoleData rd;
- LLSD args;
-
- if ( gdatap->getRoleData(gdatap->mOwnerRole, rd) )
- {
- mHasModal = TRUE;
- args["ROLE_NAME"] = rd.mRoleName;
- LLNotificationsUtil::add("AddGroupOwnerWarning",
- args,
- LLSD(),
- boost::bind(&LLPanelGroupMembersSubTab::addOwnerCB, this, _1, _2));
- }
- else
- {
- LL_WARNS() << "Unable to get role information for the owner role in group " << mGroupID << LL_ENDL;
-
- mesg.assign("Unable to retried specific group information. Try again later");
- return false;
- }
-
- }
- else
- {
- applyMemberChanges();
- }
- }
-
- return true;
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "Unable to get group data for group " << mGroupID << LL_ENDL;
+
+ mesg.assign("Unable to save member data. Try again later.");
+ return false;
+ }
+
+ if (mChanged)
+ {
+ //figure out if we are somehow adding an owner or not and alert
+ //the user...possibly make it ignorable
+ if ( mNumOwnerAdditions > 0 )
+ {
+ LLRoleData rd;
+ LLSD args;
+
+ if ( gdatap->getRoleData(gdatap->mOwnerRole, rd) )
+ {
+ mHasModal = TRUE;
+ args["ROLE_NAME"] = rd.mRoleName;
+ LLNotificationsUtil::add("AddGroupOwnerWarning",
+ args,
+ LLSD(),
+ boost::bind(&LLPanelGroupMembersSubTab::addOwnerCB, this, _1, _2));
+ }
+ else
+ {
+ LL_WARNS() << "Unable to get role information for the owner role in group " << mGroupID << LL_ENDL;
+
+ mesg.assign("Unable to retried specific group information. Try again later");
+ return false;
+ }
+
+ }
+ else
+ {
+ applyMemberChanges();
+ }
+ }
+
+ return true;
}
bool LLPanelGroupMembersSubTab::addOwnerCB(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- mHasModal = FALSE;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ mHasModal = FALSE;
- if (0 == option)
- {
- // User clicked "Yes"
- applyMemberChanges();
- }
- return false;
+ if (0 == option)
+ {
+ // User clicked "Yes"
+ applyMemberChanges();
+ }
+ return false;
}
void LLPanelGroupMembersSubTab::applyMemberChanges()
{
- //sucks to do a find again here, but it is in constant time, so, could
- //be worse
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "Unable to get group data for group " << mGroupID << LL_ENDL;
- return;
- }
-
- //we need to add all of the changed roles data
- //for each member whose role changed
- for (member_role_changes_map_t::iterator member = mMemberRoleChangeData.begin();
- member != mMemberRoleChangeData.end(); ++member)
- {
- for (role_change_data_map_t::iterator role = member->second->begin();
- role != member->second->end(); ++role)
- {
- gdatap->changeRoleMember(role->first, //role_id
- member->first, //member_id
- role->second); //add/remove
- }
-
- member->second->clear();
- delete member->second;
- }
- mMemberRoleChangeData.clear();
-
- LLGroupMgr::getInstance()->sendGroupRoleMemberChanges(mGroupID);
- //force a UI update
- handleMemberSelect();
-
- mChanged = FALSE;
- mNumOwnerAdditions = 0;
- notifyObservers();
+ //sucks to do a find again here, but it is in constant time, so, could
+ //be worse
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "Unable to get group data for group " << mGroupID << LL_ENDL;
+ return;
+ }
+
+ //we need to add all of the changed roles data
+ //for each member whose role changed
+ for (member_role_changes_map_t::iterator member = mMemberRoleChangeData.begin();
+ member != mMemberRoleChangeData.end(); ++member)
+ {
+ for (role_change_data_map_t::iterator role = member->second->begin();
+ role != member->second->end(); ++role)
+ {
+ gdatap->changeRoleMember(role->first, //role_id
+ member->first, //member_id
+ role->second); //add/remove
+ }
+
+ member->second->clear();
+ delete member->second;
+ }
+ mMemberRoleChangeData.clear();
+
+ LLGroupMgr::getInstance()->sendGroupRoleMemberChanges(mGroupID);
+ //force a UI update
+ handleMemberSelect();
+
+ mChanged = FALSE;
+ mNumOwnerAdditions = 0;
+ notifyObservers();
}
bool LLPanelGroupMembersSubTab::matchesSearchFilter(const std::string& fullname)
{
- // If the search filter is empty, everything passes.
- if (mSearchFilter.empty()) return true;
+ // If the search filter is empty, everything passes.
+ if (mSearchFilter.empty()) return true;
- // Create a full name, and compare it to the search filter.
- std::string fullname_lc(fullname);
- LLStringUtil::toLower(fullname_lc);
+ // Create a full name, and compare it to the search filter.
+ std::string fullname_lc(fullname);
+ LLStringUtil::toLower(fullname_lc);
- std::string::size_type match = fullname_lc.find(mSearchFilter);
+ std::string::size_type match = fullname_lc.find(mSearchFilter);
- if (std::string::npos == match)
- {
- // not found
- return false;
- }
- else
- {
- return true;
- }
+ if (std::string::npos == match)
+ {
+ // not found
+ return false;
+ }
+ else
+ {
+ return true;
+ }
}
U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id)
{
- //we loop over all of the changes
- //if we are adding a role, then we simply add the role's powers
- //if we are removing a role, we store that role id away
- //and then we have to build the powers up bases on the roles the agent
- //is in
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No group data!" << LL_ENDL;
- return GP_NO_POWERS;
- }
-
- LLGroupMgrGroupData::member_list_t::iterator iter = gdatap->mMembers.find(agent_id);
- if ( iter == gdatap->mMembers.end() )
- {
- LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No member data for member with UUID " << agent_id << LL_ENDL;
- return GP_NO_POWERS;
- }
-
- LLGroupMemberData* member_data = (*iter).second;
- if (!member_data)
- {
- LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- Null member data for member with UUID " << agent_id << LL_ENDL;
- return GP_NO_POWERS;
- }
-
- //see if there are unsaved role changes for this agent
- role_change_data_map_t* role_change_datap = NULL;
- member_role_changes_map_t::iterator member = mMemberRoleChangeData.find(agent_id);
- if ( member != mMemberRoleChangeData.end() )
- {
- //this member has unsaved role changes
- //so grab them
- role_change_datap = (*member).second;
- }
-
- U64 new_powers = GP_NO_POWERS;
-
- if ( role_change_datap )
- {
- uuid_vec_t roles_to_be_removed;
-
- for (role_change_data_map_t::iterator role = role_change_datap->begin();
- role != role_change_datap->end(); ++ role)
- {
- if ( role->second == RMC_ADD )
- {
- new_powers |= gdatap->getRolePowers(role->first);
- }
- else
- {
- roles_to_be_removed.push_back(role->first);
- }
- }
-
- //loop over the member's current roles, summing up
- //the powers (not including the role we are removing)
- for (LLGroupMemberData::role_list_t::iterator current_role = member_data->roleBegin();
- current_role != member_data->roleEnd(); ++current_role)
- {
- bool role_in_remove_list =
- (std::find(roles_to_be_removed.begin(),
- roles_to_be_removed.end(),
- current_role->second->getID()) !=
- roles_to_be_removed.end());
-
- if ( !role_in_remove_list )
- {
- new_powers |=
- current_role->second->getRoleData().mRolePowers;
- }
- }
- }
- else
- {
- //there are no changes for this member
- //the member's powers are just the ones stored in the group
- //manager
- new_powers = member_data->getAgentPowers();
- }
-
- return new_powers;
+ //we loop over all of the changes
+ //if we are adding a role, then we simply add the role's powers
+ //if we are removing a role, we store that role id away
+ //and then we have to build the powers up bases on the roles the agent
+ //is in
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No group data!" << LL_ENDL;
+ return GP_NO_POWERS;
+ }
+
+ LLGroupMgrGroupData::member_list_t::iterator iter = gdatap->mMembers.find(agent_id);
+ if ( iter == gdatap->mMembers.end() )
+ {
+ LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No member data for member with UUID " << agent_id << LL_ENDL;
+ return GP_NO_POWERS;
+ }
+
+ LLGroupMemberData* member_data = (*iter).second;
+ if (!member_data)
+ {
+ LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- Null member data for member with UUID " << agent_id << LL_ENDL;
+ return GP_NO_POWERS;
+ }
+
+ //see if there are unsaved role changes for this agent
+ role_change_data_map_t* role_change_datap = NULL;
+ member_role_changes_map_t::iterator member = mMemberRoleChangeData.find(agent_id);
+ if ( member != mMemberRoleChangeData.end() )
+ {
+ //this member has unsaved role changes
+ //so grab them
+ role_change_datap = (*member).second;
+ }
+
+ U64 new_powers = GP_NO_POWERS;
+
+ if ( role_change_datap )
+ {
+ uuid_vec_t roles_to_be_removed;
+
+ for (role_change_data_map_t::iterator role = role_change_datap->begin();
+ role != role_change_datap->end(); ++ role)
+ {
+ if ( role->second == RMC_ADD )
+ {
+ new_powers |= gdatap->getRolePowers(role->first);
+ }
+ else
+ {
+ roles_to_be_removed.push_back(role->first);
+ }
+ }
+
+ //loop over the member's current roles, summing up
+ //the powers (not including the role we are removing)
+ for (LLGroupMemberData::role_list_t::iterator current_role = member_data->roleBegin();
+ current_role != member_data->roleEnd(); ++current_role)
+ {
+ bool role_in_remove_list =
+ (std::find(roles_to_be_removed.begin(),
+ roles_to_be_removed.end(),
+ current_role->second->getID()) !=
+ roles_to_be_removed.end());
+
+ if ( !role_in_remove_list )
+ {
+ new_powers |=
+ current_role->second->getRoleData().mRolePowers;
+ }
+ }
+ }
+ else
+ {
+ //there are no changes for this member
+ //the member's powers are just the ones stored in the group
+ //manager
+ new_powers = member_data->getAgentPowers();
+ }
+
+ return new_powers;
}
//If there is no change, returns false be sure to verify
//that there is a role change before attempting to get it or else
//the data will make no sense. Stores the role change type
bool LLPanelGroupMembersSubTab::getRoleChangeType(const LLUUID& member_id,
- const LLUUID& role_id,
- LLRoleMemberChangeType& type)
+ const LLUUID& role_id,
+ LLRoleMemberChangeType& type)
{
- member_role_changes_map_t::iterator member_changes_iter = mMemberRoleChangeData.find(member_id);
- if ( member_changes_iter != mMemberRoleChangeData.end() )
- {
- role_change_data_map_t::iterator role_changes_iter = member_changes_iter->second->find(role_id);
- if ( role_changes_iter != member_changes_iter->second->end() )
- {
- type = role_changes_iter->second;
- return true;
- }
- }
+ member_role_changes_map_t::iterator member_changes_iter = mMemberRoleChangeData.find(member_id);
+ if ( member_changes_iter != mMemberRoleChangeData.end() )
+ {
+ role_change_data_map_t::iterator role_changes_iter = member_changes_iter->second->find(role_id);
+ if ( role_changes_iter != member_changes_iter->second->end() )
+ {
+ type = role_changes_iter->second;
+ return true;
+ }
+ }
- return false;
+ return false;
}
void LLPanelGroupMembersSubTab::draw()
{
- LLPanelGroupSubTab::draw();
+ LLPanelGroupSubTab::draw();
- if (mPendingMemberUpdate)
- {
- updateMembers();
- }
+ if (mPendingMemberUpdate)
+ {
+ updateMembers();
+ }
}
void LLPanelGroupMembersSubTab::update(LLGroupChange gc)
{
- if (mGroupID.isNull()) return;
-
- if ( GC_TITLES == gc || GC_PROPERTIES == gc )
- {
- // Don't care about title or general group properties updates.
- return;
- }
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "LLPanelGroupMembersSubTab::update() -- No group data!" << LL_ENDL;
- return;
- }
-
- // Wait for both all data to be retrieved before displaying anything.
- if ( gdatap->isMemberDataComplete()
- && gdatap->isRoleDataComplete()
- && gdatap->isRoleMemberDataComplete())
- {
- mMemberProgress = gdatap->mMembers.begin();
- mPendingMemberUpdate = TRUE;
- mHasMatch = FALSE;
- }
- else
- {
- // Build a string with info on retrieval progress.
- std::ostringstream retrieved;
-
- if ( gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete() && !gdatap->mMembers.size() )
- {
- // MAINT-5237
- retrieved << "Member list not available.";
- }
- else if ( !gdatap->isMemberDataComplete() )
- {
- // Still busy retreiving member list.
- retrieved << "Retrieving member list (" << gdatap->mMembers.size()
- << " / " << gdatap->mMemberCount << ")...";
- }
- else if( !gdatap->isRoleDataComplete() )
- {
- // Still busy retreiving role list.
- retrieved << "Retrieving role list (" << gdatap->mRoles.size()
- << " / " << gdatap->mRoleCount << ")...";
- }
- else // (!gdatap->isRoleMemberDataComplete())
- {
- // Still busy retreiving role/member mappings.
- retrieved << "Retrieving role member mappings...";
- }
- mMembersList->setEnabled(FALSE);
- mMembersList->setCommentText(retrieved.str());
- }
+ if (mGroupID.isNull()) return;
+
+ if ( GC_TITLES == gc || GC_PROPERTIES == gc )
+ {
+ // Don't care about title or general group properties updates.
+ return;
+ }
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "LLPanelGroupMembersSubTab::update() -- No group data!" << LL_ENDL;
+ return;
+ }
+
+ // Wait for both all data to be retrieved before displaying anything.
+ if ( gdatap->isMemberDataComplete()
+ && gdatap->isRoleDataComplete()
+ && gdatap->isRoleMemberDataComplete())
+ {
+ mMemberProgress = gdatap->mMembers.begin();
+ mPendingMemberUpdate = TRUE;
+ mHasMatch = FALSE;
+ }
+ else
+ {
+ // Build a string with info on retrieval progress.
+ std::ostringstream retrieved;
+
+ if ( gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete() && !gdatap->mMembers.size() )
+ {
+ // MAINT-5237
+ retrieved << "Member list not available.";
+ }
+ else if ( !gdatap->isMemberDataComplete() )
+ {
+ // Still busy retreiving member list.
+ retrieved << "Retrieving member list (" << gdatap->mMembers.size()
+ << " / " << gdatap->mMemberCount << ")...";
+ }
+ else if( !gdatap->isRoleDataComplete() )
+ {
+ // Still busy retreiving role list.
+ retrieved << "Retrieving role list (" << gdatap->mRoles.size()
+ << " / " << gdatap->mRoleCount << ")...";
+ }
+ else // (!gdatap->isRoleMemberDataComplete())
+ {
+ // Still busy retreiving role/member mappings.
+ retrieved << "Retrieving role member mappings...";
+ }
+ mMembersList->setEnabled(FALSE);
+ mMembersList->setCommentText(retrieved.str());
+ }
}
void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data)
{
- if (!data) return;
- LLUIString donated = getString("donation_area");
- donated.setArg("[AREA]", llformat("%d", data->getContribution()));
+ if (!data) return;
+ LLUIString donated = getString("donation_area");
+ donated.setArg("[AREA]", llformat("%d", data->getContribution()));
- LLNameListCtrl::NameItem item_params;
- item_params.value = data->getID();
+ LLNameListCtrl::NameItem item_params;
+ item_params.value = data->getID();
- item_params.columns.add().column("name").font.name("SANSSERIF_SMALL").style("NORMAL");
+ item_params.columns.add().column("name").font.name("SANSSERIF_SMALL").style("NORMAL");
- item_params.columns.add().column("donated").value(donated.getString())
- .font.name("SANSSERIF_SMALL").style("NORMAL");
+ item_params.columns.add().column("donated").value(donated.getString())
+ .font.name("SANSSERIF_SMALL").style("NORMAL");
- item_params.columns.add().column("online").value(data->getOnlineStatus())
- .font.name("SANSSERIF_SMALL").style("NORMAL");
+ item_params.columns.add().column("online").value(data->getOnlineStatus())
+ .font.name("SANSSERIF_SMALL").style("NORMAL");
- item_params.columns.add().column("title").value(data->getTitle()).font.name("SANSSERIF_SMALL").style("NORMAL");;
+ item_params.columns.add().column("title").value(data->getTitle()).font.name("SANSSERIF_SMALL").style("NORMAL");;
- mMembersList->addNameItemRow(item_params);
+ mMembersList->addNameItemRow(item_params);
- mHasMatch = TRUE;
+ mHasMatch = TRUE;
}
void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name, const LLUUID& av_id)
{
- avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(av_id);
- if (it != mAvatarNameCacheConnections.end())
- {
- if (it->second.connected())
- {
- it->second.disconnect();
- }
- mAvatarNameCacheConnections.erase(it);
- }
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap
- || gdatap->getMemberVersion() != update_id
- || !member)
- {
- return;
- }
-
- // trying to avoid unnecessary hash lookups
- if (matchesSearchFilter(av_name.getAccountName()))
- {
- addMemberToList(member);
- if(!mMembersList->getEnabled())
- {
- mMembersList->setEnabled(TRUE);
- }
- }
-
+ avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(av_id);
+ if (it != mAvatarNameCacheConnections.end())
+ {
+ if (it->second.connected())
+ {
+ it->second.disconnect();
+ }
+ mAvatarNameCacheConnections.erase(it);
+ }
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap
+ || gdatap->getMemberVersion() != update_id
+ || !member)
+ {
+ return;
+ }
+
+ // trying to avoid unnecessary hash lookups
+ if (matchesSearchFilter(av_name.getAccountName()))
+ {
+ addMemberToList(member);
+ if(!mMembersList->getEnabled())
+ {
+ mMembersList->setEnabled(TRUE);
+ }
+ }
+
}
void LLPanelGroupMembersSubTab::updateMembers()
{
- mPendingMemberUpdate = FALSE;
-
- // Rebuild the members list.
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "LLPanelGroupMembersSubTab::updateMembers() -- No group data!" << LL_ENDL;
- return;
- }
-
- // Make sure all data is still complete. Incomplete data
- // may occur if we refresh.
- if ( !gdatap->isMemberDataComplete()
- || !gdatap->isRoleDataComplete()
- || !gdatap->isRoleMemberDataComplete())
- {
- return;
- }
-
- //cleanup list only for first iteration
- if(mMemberProgress == gdatap->mMembers.begin())
- {
- mMembersList->deleteAllItems();
- }
-
- LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
-
- LLTimer update_time;
- update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME);
-
- for( ; mMemberProgress != end && !update_time.hasExpired(); ++mMemberProgress)
- {
- if (!mMemberProgress->second)
- continue;
-
- // Do filtering on name if it is already in the cache.
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(mMemberProgress->first, &av_name))
- {
- if (matchesSearchFilter(av_name.getAccountName()))
- {
- addMemberToList(mMemberProgress->second);
- }
- }
- else
- {
- // If name is not cached, onNameCache() should be called when it is cached and add this member to list.
- avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(mMemberProgress->first);
- if (it != mAvatarNameCacheConnections.end())
- {
- if (it->second.connected())
- {
- it->second.disconnect();
- }
- mAvatarNameCacheConnections.erase(it);
- }
- mAvatarNameCacheConnections[mMemberProgress->first] = LLAvatarNameCache::get(mMemberProgress->first, boost::bind(&LLPanelGroupMembersSubTab::onNameCache, this, gdatap->getMemberVersion(), mMemberProgress->second, _2, _1));
- }
- }
-
- if (mMemberProgress == end)
- {
- if (mHasMatch)
- {
- mMembersList->setEnabled(TRUE);
- }
- else if (gdatap->mMembers.size())
- {
- mMembersList->setEnabled(FALSE);
- mMembersList->setCommentText(std::string("No match."));
- }
- }
- else
- {
- mPendingMemberUpdate = TRUE;
- }
-
- // This should clear the other two lists, since nothing is selected.
- handleMemberSelect();
+ mPendingMemberUpdate = FALSE;
+
+ // Rebuild the members list.
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "LLPanelGroupMembersSubTab::updateMembers() -- No group data!" << LL_ENDL;
+ return;
+ }
+
+ // Make sure all data is still complete. Incomplete data
+ // may occur if we refresh.
+ if ( !gdatap->isMemberDataComplete()
+ || !gdatap->isRoleDataComplete()
+ || !gdatap->isRoleMemberDataComplete())
+ {
+ return;
+ }
+
+ //cleanup list only for first iteration
+ if(mMemberProgress == gdatap->mMembers.begin())
+ {
+ mMembersList->deleteAllItems();
+ }
+
+ LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
+
+ LLTimer update_time;
+ update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME);
+
+ for( ; mMemberProgress != end && !update_time.hasExpired(); ++mMemberProgress)
+ {
+ if (!mMemberProgress->second)
+ continue;
+
+ // Do filtering on name if it is already in the cache.
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(mMemberProgress->first, &av_name))
+ {
+ if (matchesSearchFilter(av_name.getAccountName()))
+ {
+ addMemberToList(mMemberProgress->second);
+ }
+ }
+ else
+ {
+ // If name is not cached, onNameCache() should be called when it is cached and add this member to list.
+ avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(mMemberProgress->first);
+ if (it != mAvatarNameCacheConnections.end())
+ {
+ if (it->second.connected())
+ {
+ it->second.disconnect();
+ }
+ mAvatarNameCacheConnections.erase(it);
+ }
+ mAvatarNameCacheConnections[mMemberProgress->first] = LLAvatarNameCache::get(mMemberProgress->first, boost::bind(&LLPanelGroupMembersSubTab::onNameCache, this, gdatap->getMemberVersion(), mMemberProgress->second, _2, _1));
+ }
+ }
+
+ if (mMemberProgress == end)
+ {
+ if (mHasMatch)
+ {
+ mMembersList->setEnabled(TRUE);
+ }
+ else if (gdatap->mMembers.size())
+ {
+ mMembersList->setEnabled(FALSE);
+ mMembersList->setCommentText(std::string("No match."));
+ }
+ }
+ else
+ {
+ mPendingMemberUpdate = TRUE;
+ }
+
+ // This should clear the other two lists, since nothing is selected.
+ handleMemberSelect();
}
void LLPanelGroupMembersSubTab::onBanMember(void* user_data)
{
- LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
- self->confirmBanMembers();
+ LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
+ self->confirmBanMembers();
}
void LLPanelGroupMembersSubTab::confirmBanMembers()
{
- std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
- if (selection.empty()) return;
-
- S32 selection_count = selection.size();
- if (selection_count == 1)
- {
- LLSD args;
- LLAvatarName av_name;
- LLAvatarNameCache::get(mMembersList->getValue(), &av_name);
- args["AVATAR_NAME"] = av_name.getUserName();
- LLSD payload;
- LLNotificationsUtil::add("BanGroupMemberWarning",
- args,
- payload,
- boost::bind(&LLPanelGroupMembersSubTab::handleBanCallback, this, _1, _2));
- }
- else
- {
- LLSD args;
- args["COUNT"] = llformat("%d", selection_count);
- LLSD payload;
- LLNotificationsUtil::add("BanGroupMembersWarning",
- args,
- payload,
- boost::bind(&LLPanelGroupMembersSubTab::handleBanCallback, this, _1, _2));
- }
+ std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
+ if (selection.empty()) return;
+
+ S32 selection_count = selection.size();
+ if (selection_count == 1)
+ {
+ LLSD args;
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(mMembersList->getValue(), &av_name);
+ args["AVATAR_NAME"] = av_name.getUserName();
+ LLSD payload;
+ LLNotificationsUtil::add("BanGroupMemberWarning",
+ args,
+ payload,
+ boost::bind(&LLPanelGroupMembersSubTab::handleBanCallback, this, _1, _2));
+ }
+ else
+ {
+ LLSD args;
+ args["COUNT"] = llformat("%d", selection_count);
+ LLSD payload;
+ LLNotificationsUtil::add("BanGroupMembersWarning",
+ args,
+ payload,
+ boost::bind(&LLPanelGroupMembersSubTab::handleBanCallback, this, _1, _2));
+ }
}
bool LLPanelGroupMembersSubTab::handleBanCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option) // Eject button
- {
- handleBanMember();
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option) // Eject button
+ {
+ handleBanMember();
+ }
+ return false;
}
void LLPanelGroupMembersSubTab::updateActionDescription()
{
- mActionDescription->setText(std::string());
- LLScrollListItem* action_item = mAllowedActionsList->getFirstSelected();
- if (!action_item || !mAllowedActionsList->getCanSelect())
- {
- return;
- }
+ mActionDescription->setText(std::string());
+ LLScrollListItem* action_item = mAllowedActionsList->getFirstSelected();
+ if (!action_item || !mAllowedActionsList->getCanSelect())
+ {
+ return;
+ }
- LLRoleAction* rap = (LLRoleAction*)action_item->getUserdata();
- if (rap)
- {
- std::string desc = rap->mLongDescription.empty() ? rap->mDescription : rap->mLongDescription;
- mActionDescription->setText(desc);
- }
+ LLRoleAction* rap = (LLRoleAction*)action_item->getUserdata();
+ if (rap)
+ {
+ std::string desc = rap->mLongDescription.empty() ? rap->mDescription : rap->mLongDescription;
+ mActionDescription->setText(desc);
+ }
}
void LLPanelGroupMembersSubTab::handleBanMember()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if(!gdatap)
- {
- LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL;
- return;
- }
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if(!gdatap)
+ {
+ LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL;
+ return;
+ }
+
+ std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
+ if(selection.empty())
+ {
+ return;
+ }
- std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
- if(selection.empty())
- {
- return;
- }
+ uuid_vec_t ban_ids;
+ std::vector<LLScrollListItem*>::iterator itor;
+ for(itor = selection.begin(); itor != selection.end(); ++itor)
+ {
+ LLUUID ban_id = (*itor)->getUUID();
+ ban_ids.push_back(ban_id);
- uuid_vec_t ban_ids;
- std::vector<LLScrollListItem*>::iterator itor;
- for(itor = selection.begin(); itor != selection.end(); ++itor)
- {
- LLUUID ban_id = (*itor)->getUUID();
- ban_ids.push_back(ban_id);
-
- LLGroupBanData ban_data;
- gdatap->createBanEntry(ban_id, ban_data);
- }
+ LLGroupBanData ban_data;
+ gdatap->createBanEntry(ban_id, ban_data);
+ }
- LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_CREATE, ban_ids);
- handleEjectMembers();
+ LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_CREATE, ban_ids);
+ handleEjectMembers();
}
@@ -1954,18 +1954,18 @@ static LLPanelInjector<LLPanelGroupRolesSubTab> t_panel_group_roles_subtab("pane
LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab()
: LLPanelGroupSubTab(),
- mRolesList(NULL),
- mAssignedMembersList(NULL),
- mAllowedActionsList(NULL),
- mRoleName(NULL),
- mRoleTitle(NULL),
- mRoleDescription(NULL),
- mMemberVisibleCheck(NULL),
- mDeleteRoleButton(NULL),
- mCopyRoleButton(NULL),
- mCreateRoleButton(NULL),
- mFirstOpen(TRUE),
- mHasRoleChange(FALSE)
+ mRolesList(NULL),
+ mAssignedMembersList(NULL),
+ mAllowedActionsList(NULL),
+ mRoleName(NULL),
+ mRoleTitle(NULL),
+ mRoleDescription(NULL),
+ mMemberVisibleCheck(NULL),
+ mDeleteRoleButton(NULL),
+ mCopyRoleButton(NULL),
+ mCreateRoleButton(NULL),
+ mFirstOpen(TRUE),
+ mHasRoleChange(FALSE)
{
}
@@ -1975,859 +1975,859 @@ LLPanelGroupRolesSubTab::~LLPanelGroupRolesSubTab()
BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
{
- LLPanelGroupSubTab::postBuildSubTab(root);
+ LLPanelGroupSubTab::postBuildSubTab(root);
- // Upcast parent so we can ask it for sibling controls.
- LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root;
+ // Upcast parent so we can ask it for sibling controls.
+ LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root;
- // Look recursively from the parent to find all our widgets.
- bool recurse = true;
- mHeader = parent->findChild<LLPanel>("roles_header", recurse);
- mFooter = parent->findChild<LLPanel>("roles_footer", recurse);
+ // Look recursively from the parent to find all our widgets.
+ bool recurse = true;
+ mHeader = parent->findChild<LLPanel>("roles_header", recurse);
+ mFooter = parent->findChild<LLPanel>("roles_footer", recurse);
- mRolesList = parent->getChild<LLScrollListCtrl>("role_list", recurse);
- mAssignedMembersList = parent->getChild<LLNameListCtrl>("role_assigned_members", recurse);
- mAllowedActionsList = parent->getChild<LLScrollListCtrl>("role_allowed_actions", recurse);
- mActionDescription = parent->getChild<LLTextEditor>("role_action_description", recurse);
+ mRolesList = parent->getChild<LLScrollListCtrl>("role_list", recurse);
+ mAssignedMembersList = parent->getChild<LLNameListCtrl>("role_assigned_members", recurse);
+ mAllowedActionsList = parent->getChild<LLScrollListCtrl>("role_allowed_actions", recurse);
+ mActionDescription = parent->getChild<LLTextEditor>("role_action_description", recurse);
- mRoleName = parent->getChild<LLLineEditor>("role_name", recurse);
- mRoleTitle = parent->getChild<LLLineEditor>("role_title", recurse);
- mRoleDescription = parent->getChild<LLTextEditor>("role_description", recurse);
+ mRoleName = parent->getChild<LLLineEditor>("role_name", recurse);
+ mRoleTitle = parent->getChild<LLLineEditor>("role_title", recurse);
+ mRoleDescription = parent->getChild<LLTextEditor>("role_description", recurse);
- mMemberVisibleCheck = parent->getChild<LLCheckBoxCtrl>("role_visible_in_list", recurse);
+ mMemberVisibleCheck = parent->getChild<LLCheckBoxCtrl>("role_visible_in_list", recurse);
- if (!mRolesList || !mAssignedMembersList || !mAllowedActionsList || !mActionDescription
- || !mRoleName || !mRoleTitle || !mRoleDescription || !mMemberVisibleCheck)
- {
- LL_WARNS() << "ARG! element not found." << LL_ENDL;
- return FALSE;
- }
+ if (!mRolesList || !mAssignedMembersList || !mAllowedActionsList || !mActionDescription
+ || !mRoleName || !mRoleTitle || !mRoleDescription || !mMemberVisibleCheck)
+ {
+ LL_WARNS() << "ARG! element not found." << LL_ENDL;
+ return FALSE;
+ }
- mRemoveEveryoneTxt = getString("cant_delete_role");
+ mRemoveEveryoneTxt = getString("cant_delete_role");
- mCreateRoleButton =
- parent->getChild<LLButton>("role_create", recurse);
- if ( mCreateRoleButton )
- {
- mCreateRoleButton->setClickedCallback(onCreateRole, this);
- mCreateRoleButton->setEnabled(FALSE);
- }
+ mCreateRoleButton =
+ parent->getChild<LLButton>("role_create", recurse);
+ if ( mCreateRoleButton )
+ {
+ mCreateRoleButton->setClickedCallback(onCreateRole, this);
+ mCreateRoleButton->setEnabled(FALSE);
+ }
- mCopyRoleButton =
- parent->getChild<LLButton>("role_copy", recurse);
- if ( mCopyRoleButton )
- {
- mCopyRoleButton->setClickedCallback(onCopyRole, this);
- mCopyRoleButton->setEnabled(FALSE);
- }
-
- mDeleteRoleButton =
- parent->getChild<LLButton>("role_delete", recurse);
- if ( mDeleteRoleButton )
- {
- mDeleteRoleButton->setClickedCallback(onDeleteRole, this);
- mDeleteRoleButton->setEnabled(FALSE);
- }
+ mCopyRoleButton =
+ parent->getChild<LLButton>("role_copy", recurse);
+ if ( mCopyRoleButton )
+ {
+ mCopyRoleButton->setClickedCallback(onCopyRole, this);
+ mCopyRoleButton->setEnabled(FALSE);
+ }
- mRolesList->setCommitOnSelectionChange(TRUE);
- mRolesList->setCommitCallback(onRoleSelect, this);
+ mDeleteRoleButton =
+ parent->getChild<LLButton>("role_delete", recurse);
+ if ( mDeleteRoleButton )
+ {
+ mDeleteRoleButton->setClickedCallback(onDeleteRole, this);
+ mDeleteRoleButton->setEnabled(FALSE);
+ }
- mAssignedMembersList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+ mRolesList->setCommitOnSelectionChange(TRUE);
+ mRolesList->setCommitCallback(onRoleSelect, this);
- mMemberVisibleCheck->setCommitCallback(onMemberVisibilityChange, this);
+ mAssignedMembersList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
- mAllowedActionsList->setCommitOnSelectionChange(TRUE);
- mAllowedActionsList->setCommitCallback(boost::bind(&LLPanelGroupRolesSubTab::updateActionDescription, this));
+ mMemberVisibleCheck->setCommitCallback(onMemberVisibilityChange, this);
- mRoleName->setCommitOnFocusLost(TRUE);
- mRoleName->setKeystrokeCallback(onPropertiesKey, this);
+ mAllowedActionsList->setCommitOnSelectionChange(TRUE);
+ mAllowedActionsList->setCommitCallback(boost::bind(&LLPanelGroupRolesSubTab::updateActionDescription, this));
- mRoleTitle->setCommitOnFocusLost(TRUE);
- mRoleTitle->setKeystrokeCallback(onPropertiesKey, this);
+ mRoleName->setCommitOnFocusLost(TRUE);
+ mRoleName->setKeystrokeCallback(onPropertiesKey, this);
- mRoleDescription->setCommitOnFocusLost(TRUE);
- mRoleDescription->setKeystrokeCallback(boost::bind(&LLPanelGroupRolesSubTab::onDescriptionKeyStroke, this, _1));
+ mRoleTitle->setCommitOnFocusLost(TRUE);
+ mRoleTitle->setKeystrokeCallback(onPropertiesKey, this);
- setFooterEnabled(FALSE);
+ mRoleDescription->setCommitOnFocusLost(TRUE);
+ mRoleDescription->setKeystrokeCallback(boost::bind(&LLPanelGroupRolesSubTab::onDescriptionKeyStroke, this, _1));
- return TRUE;
+ setFooterEnabled(FALSE);
+
+ return TRUE;
}
void LLPanelGroupRolesSubTab::activate()
{
- LLPanelGroupSubTab::activate();
+ LLPanelGroupSubTab::activate();
- mActionDescription->clear();
- mRolesList->deselectAllItems();
- mAssignedMembersList->deleteAllItems();
- mAllowedActionsList->deleteAllItems();
- mRoleName->clear();
- mRoleDescription->clear();
- mRoleTitle->clear();
+ mActionDescription->clear();
+ mRolesList->deselectAllItems();
+ mAssignedMembersList->deleteAllItems();
+ mAllowedActionsList->deleteAllItems();
+ mRoleName->clear();
+ mRoleDescription->clear();
+ mRoleTitle->clear();
- setFooterEnabled(FALSE);
+ setFooterEnabled(FALSE);
- mHasRoleChange = FALSE;
- update(GC_ALL);
+ mHasRoleChange = FALSE;
+ update(GC_ALL);
}
void LLPanelGroupRolesSubTab::deactivate()
{
- LL_DEBUGS() << "LLPanelGroupRolesSubTab::deactivate()" << LL_ENDL;
+ LL_DEBUGS() << "LLPanelGroupRolesSubTab::deactivate()" << LL_ENDL;
- LLPanelGroupSubTab::deactivate();
- mFirstOpen = FALSE;
+ LLPanelGroupSubTab::deactivate();
+ mFirstOpen = FALSE;
}
bool LLPanelGroupRolesSubTab::needsApply(std::string& mesg)
{
- LL_DEBUGS() << "LLPanelGroupRolesSubTab::needsApply()" << LL_ENDL;
+ LL_DEBUGS() << "LLPanelGroupRolesSubTab::needsApply()" << LL_ENDL;
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if(!gdatap)
- {
- LL_WARNS() << "Unable to get group data for group " << mGroupID << LL_ENDL;
- return false;
- }
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if(!gdatap)
+ {
+ LL_WARNS() << "Unable to get group data for group " << mGroupID << LL_ENDL;
+ return false;
+ }
- return (mHasRoleChange // Text changed in current role
- || (gdatap && gdatap->pendingRoleChanges())); // Pending role changes in the group
+ return (mHasRoleChange // Text changed in current role
+ || (gdatap && gdatap->pendingRoleChanges())); // Pending role changes in the group
}
bool LLPanelGroupRolesSubTab::apply(std::string& mesg)
{
- LL_DEBUGS() << "LLPanelGroupRolesSubTab::apply()" << LL_ENDL;
+ LL_DEBUGS() << "LLPanelGroupRolesSubTab::apply()" << LL_ENDL;
- saveRoleChanges(true);
- mFirstOpen = FALSE;
- LLGroupMgr::getInstance()->sendGroupRoleChanges(mGroupID);
+ saveRoleChanges(true);
+ mFirstOpen = FALSE;
+ LLGroupMgr::getInstance()->sendGroupRoleChanges(mGroupID);
- notifyObservers();
+ notifyObservers();
- return true;
+ return true;
}
void LLPanelGroupRolesSubTab::cancel()
{
- mHasRoleChange = FALSE;
- LLGroupMgr::getInstance()->cancelGroupRoleChanges(mGroupID);
+ mHasRoleChange = FALSE;
+ LLGroupMgr::getInstance()->cancelGroupRoleChanges(mGroupID);
- notifyObservers();
+ notifyObservers();
}
-LLSD LLPanelGroupRolesSubTab::createRoleItem(const LLUUID& role_id,
- std::string name,
- std::string title,
- S32 members)
+LLSD LLPanelGroupRolesSubTab::createRoleItem(const LLUUID& role_id,
+ std::string name,
+ std::string title,
+ S32 members)
{
- LLSD row;
- row["id"] = role_id;
+ LLSD row;
+ row["id"] = role_id;
+
+ row["columns"][0]["column"] = "name";
+ row["columns"][0]["value"] = name;
- row["columns"][0]["column"] = "name";
- row["columns"][0]["value"] = name;
+ row["columns"][1]["column"] = "title";
+ row["columns"][1]["value"] = title;
- row["columns"][1]["column"] = "title";
- row["columns"][1]["value"] = title;
+ row["columns"][2]["column"] = "members";
+ row["columns"][2]["value"] = members;
- row["columns"][2]["column"] = "members";
- row["columns"][2]["value"] = members;
-
- return row;
+ return row;
}
bool LLPanelGroupRolesSubTab::matchesSearchFilter(std::string rolename, std::string roletitle)
{
- // If the search filter is empty, everything passes.
- if (mSearchFilter.empty()) return true;
+ // If the search filter is empty, everything passes.
+ if (mSearchFilter.empty()) return true;
- LLStringUtil::toLower(rolename);
- LLStringUtil::toLower(roletitle);
- std::string::size_type match_name = rolename.find(mSearchFilter);
- std::string::size_type match_title = roletitle.find(mSearchFilter);
+ LLStringUtil::toLower(rolename);
+ LLStringUtil::toLower(roletitle);
+ std::string::size_type match_name = rolename.find(mSearchFilter);
+ std::string::size_type match_title = roletitle.find(mSearchFilter);
- if ( (std::string::npos == match_name)
- && (std::string::npos == match_title))
- {
- // not found
- return false;
- }
- else
- {
- return true;
- }
+ if ( (std::string::npos == match_name)
+ && (std::string::npos == match_title))
+ {
+ // not found
+ return false;
+ }
+ else
+ {
+ return true;
+ }
}
void LLPanelGroupRolesSubTab::update(LLGroupChange gc)
{
- LL_DEBUGS() << "LLPanelGroupRolesSubTab::update()" << LL_ENDL;
-
- if (mGroupID.isNull()) return;
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
-
- if (!gdatap || !gdatap->isRoleDataComplete())
- {
- LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID);
- }
- else
- {
- bool had_selection = false;
- LLUUID last_selected;
- if (mRolesList->getFirstSelected())
- {
- last_selected = mRolesList->getFirstSelected()->getUUID();
- had_selection = true;
- }
- mRolesList->deleteAllItems();
-
- LLScrollListItem* item = NULL;
-
- LLGroupMgrGroupData::role_list_t::iterator rit = gdatap->mRoles.begin();
- LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end();
-
- for ( ; rit != end; ++rit)
- {
- LLRoleData rd;
- if (gdatap->getRoleData((*rit).first,rd))
- {
- if (matchesSearchFilter(rd.mRoleName, rd.mRoleTitle))
- {
- // If this is the everyone role, then EVERYONE is in it.
- S32 members_in_role = (*rit).first.isNull() ? gdatap->mMembers.size() : (*rit).second->getTotalMembersInRole();
- LLSD row = createRoleItem((*rit).first,rd.mRoleName, rd.mRoleTitle, members_in_role);
- item = mRolesList->addElement(row, ((*rit).first.isNull()) ? ADD_TOP : ADD_BOTTOM, this);
- if (had_selection && ((*rit).first == last_selected))
- {
- item->setSelected(TRUE);
- }
- }
- }
- else
- {
- LL_WARNS() << "LLPanelGroupRolesSubTab::update() No role data for role " << (*rit).first << LL_ENDL;
- }
- }
-
- mRolesList->sortByColumn(std::string("name"), TRUE);
-
- if ( (gdatap->mRoles.size() < (U32)MAX_ROLES)
- && gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CREATE) )
- {
- mCreateRoleButton->setEnabled(TRUE);
- }
- else
- {
- mCreateRoleButton->setEnabled(FALSE);
- }
-
- if (had_selection)
- {
- handleRoleSelect();
- }
- else
- {
- mAssignedMembersList->deleteAllItems();
- mAllowedActionsList->deleteAllItems();
- mRoleName->clear();
- mRoleDescription->clear();
- mRoleTitle->clear();
- setFooterEnabled(FALSE);
- mDeleteRoleButton->setEnabled(FALSE);
- mCopyRoleButton->setEnabled(FALSE);
- }
- }
-
- if ((GC_ROLE_MEMBER_DATA == gc || GC_MEMBER_DATA == gc)
- && gdatap
- && gdatap->isMemberDataComplete()
- && gdatap->isRoleMemberDataComplete())
- {
- buildMembersList();
- }
+ LL_DEBUGS() << "LLPanelGroupRolesSubTab::update()" << LL_ENDL;
+
+ if (mGroupID.isNull()) return;
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+
+ if (!gdatap || !gdatap->isRoleDataComplete())
+ {
+ LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID);
+ }
+ else
+ {
+ bool had_selection = false;
+ LLUUID last_selected;
+ if (mRolesList->getFirstSelected())
+ {
+ last_selected = mRolesList->getFirstSelected()->getUUID();
+ had_selection = true;
+ }
+ mRolesList->deleteAllItems();
+
+ LLScrollListItem* item = NULL;
+
+ LLGroupMgrGroupData::role_list_t::iterator rit = gdatap->mRoles.begin();
+ LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end();
+
+ for ( ; rit != end; ++rit)
+ {
+ LLRoleData rd;
+ if (gdatap->getRoleData((*rit).first,rd))
+ {
+ if (matchesSearchFilter(rd.mRoleName, rd.mRoleTitle))
+ {
+ // If this is the everyone role, then EVERYONE is in it.
+ S32 members_in_role = (*rit).first.isNull() ? gdatap->mMembers.size() : (*rit).second->getTotalMembersInRole();
+ LLSD row = createRoleItem((*rit).first,rd.mRoleName, rd.mRoleTitle, members_in_role);
+ item = mRolesList->addElement(row, ((*rit).first.isNull()) ? ADD_TOP : ADD_BOTTOM, this);
+ if (had_selection && ((*rit).first == last_selected))
+ {
+ item->setSelected(TRUE);
+ }
+ }
+ }
+ else
+ {
+ LL_WARNS() << "LLPanelGroupRolesSubTab::update() No role data for role " << (*rit).first << LL_ENDL;
+ }
+ }
+
+ mRolesList->sortByColumn(std::string("name"), TRUE);
+
+ if ( (gdatap->mRoles.size() < (U32)MAX_ROLES)
+ && gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CREATE) )
+ {
+ mCreateRoleButton->setEnabled(TRUE);
+ }
+ else
+ {
+ mCreateRoleButton->setEnabled(FALSE);
+ }
+
+ if (had_selection)
+ {
+ handleRoleSelect();
+ }
+ else
+ {
+ mAssignedMembersList->deleteAllItems();
+ mAllowedActionsList->deleteAllItems();
+ mRoleName->clear();
+ mRoleDescription->clear();
+ mRoleTitle->clear();
+ setFooterEnabled(FALSE);
+ mDeleteRoleButton->setEnabled(FALSE);
+ mCopyRoleButton->setEnabled(FALSE);
+ }
+ }
+
+ if ((GC_ROLE_MEMBER_DATA == gc || GC_MEMBER_DATA == gc)
+ && gdatap
+ && gdatap->isMemberDataComplete()
+ && gdatap->isRoleMemberDataComplete())
+ {
+ buildMembersList();
+ }
}
// static
void LLPanelGroupRolesSubTab::onRoleSelect(LLUICtrl* ctrl, void* user_data)
{
- LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
- if (!self)
- return;
+ LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
+ if (!self)
+ return;
- self->handleRoleSelect();
+ self->handleRoleSelect();
}
void LLPanelGroupRolesSubTab::handleRoleSelect()
{
- BOOL can_delete = TRUE;
- LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleRoleSelect()" << LL_ENDL;
-
- mAssignedMembersList->deleteAllItems();
- mAllowedActionsList->deleteAllItems();
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() "
- << "-- No group data!" << LL_ENDL;
- return;
- }
-
- saveRoleChanges(false);
-
- // Check if there is anything selected.
- LLScrollListItem* item = mRolesList->getFirstSelected();
- if (!item)
- {
- setFooterEnabled(FALSE);
- return;
- }
-
- setFooterEnabled(TRUE);
-
- LLRoleData rd;
- if (gdatap->getRoleData(item->getUUID(),rd))
- {
- BOOL is_owner_role = ( gdatap->mOwnerRole == item->getUUID() );
- mRoleName->setText(rd.mRoleName);
- mRoleTitle->setText(rd.mRoleTitle);
- mRoleDescription->setText(rd.mRoleDescription);
-
- mAllowedActionsList->setEnabled(gAgent.hasPowerInGroup(mGroupID,
- GP_ROLE_CHANGE_ACTIONS));
- buildActionsList(mAllowedActionsList,
- rd.mRolePowers,
- 0LL,
- boost::bind(&LLPanelGroupRolesSubTab::handleActionCheck, this, _1, false),
- TRUE,
- FALSE,
- is_owner_role);
-
-
- mMemberVisibleCheck->set((rd.mRolePowers & GP_MEMBER_VISIBLE_IN_DIR) == GP_MEMBER_VISIBLE_IN_DIR);
- mRoleName->setEnabled(!is_owner_role &&
- gAgent.hasPowerInGroup(mGroupID, GP_ROLE_PROPERTIES));
- mRoleTitle->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_ROLE_PROPERTIES));
- mRoleDescription->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_ROLE_PROPERTIES));
-
- if ( is_owner_role )
- {
- // you can't delete the owner role
- can_delete = FALSE;
- // ... or hide members with this role
- mMemberVisibleCheck->setEnabled(FALSE);
- }
- else
- {
- mMemberVisibleCheck->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_ROLE_PROPERTIES));
- }
-
- if (item->getUUID().isNull())
- {
- // Everyone role, can't edit description or name or delete
- mRoleDescription->setEnabled(FALSE);
- mRoleName->setEnabled(FALSE);
- can_delete = FALSE;
- }
- }
- else
- {
- mRolesList->deselectAllItems();
- mAssignedMembersList->deleteAllItems();
- mAllowedActionsList->deleteAllItems();
- mRoleName->clear();
- mRoleDescription->clear();
- mRoleTitle->clear();
- setFooterEnabled(FALSE);
-
- can_delete = FALSE;
- }
- mSelectedRole = item->getUUID();
- buildMembersList();
-
- mCopyRoleButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CREATE));
- can_delete = can_delete && gAgent.hasPowerInGroup(mGroupID,
- GP_ROLE_DELETE);
- mDeleteRoleButton->setEnabled(can_delete);
+ BOOL can_delete = TRUE;
+ LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleRoleSelect()" << LL_ENDL;
+
+ mAssignedMembersList->deleteAllItems();
+ mAllowedActionsList->deleteAllItems();
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() "
+ << "-- No group data!" << LL_ENDL;
+ return;
+ }
+
+ saveRoleChanges(false);
+
+ // Check if there is anything selected.
+ LLScrollListItem* item = mRolesList->getFirstSelected();
+ if (!item)
+ {
+ setFooterEnabled(FALSE);
+ return;
+ }
+
+ setFooterEnabled(TRUE);
+
+ LLRoleData rd;
+ if (gdatap->getRoleData(item->getUUID(),rd))
+ {
+ BOOL is_owner_role = ( gdatap->mOwnerRole == item->getUUID() );
+ mRoleName->setText(rd.mRoleName);
+ mRoleTitle->setText(rd.mRoleTitle);
+ mRoleDescription->setText(rd.mRoleDescription);
+
+ mAllowedActionsList->setEnabled(gAgent.hasPowerInGroup(mGroupID,
+ GP_ROLE_CHANGE_ACTIONS));
+ buildActionsList(mAllowedActionsList,
+ rd.mRolePowers,
+ 0LL,
+ boost::bind(&LLPanelGroupRolesSubTab::handleActionCheck, this, _1, false),
+ TRUE,
+ FALSE,
+ is_owner_role);
+
+
+ mMemberVisibleCheck->set((rd.mRolePowers & GP_MEMBER_VISIBLE_IN_DIR) == GP_MEMBER_VISIBLE_IN_DIR);
+ mRoleName->setEnabled(!is_owner_role &&
+ gAgent.hasPowerInGroup(mGroupID, GP_ROLE_PROPERTIES));
+ mRoleTitle->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_ROLE_PROPERTIES));
+ mRoleDescription->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_ROLE_PROPERTIES));
+
+ if ( is_owner_role )
+ {
+ // you can't delete the owner role
+ can_delete = FALSE;
+ // ... or hide members with this role
+ mMemberVisibleCheck->setEnabled(FALSE);
+ }
+ else
+ {
+ mMemberVisibleCheck->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_ROLE_PROPERTIES));
+ }
+
+ if (item->getUUID().isNull())
+ {
+ // Everyone role, can't edit description or name or delete
+ mRoleDescription->setEnabled(FALSE);
+ mRoleName->setEnabled(FALSE);
+ can_delete = FALSE;
+ }
+ }
+ else
+ {
+ mRolesList->deselectAllItems();
+ mAssignedMembersList->deleteAllItems();
+ mAllowedActionsList->deleteAllItems();
+ mRoleName->clear();
+ mRoleDescription->clear();
+ mRoleTitle->clear();
+ setFooterEnabled(FALSE);
+
+ can_delete = FALSE;
+ }
+ mSelectedRole = item->getUUID();
+ buildMembersList();
+
+ mCopyRoleButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_ROLE_CREATE));
+ can_delete = can_delete && gAgent.hasPowerInGroup(mGroupID,
+ GP_ROLE_DELETE);
+ mDeleteRoleButton->setEnabled(can_delete);
}
void LLPanelGroupRolesSubTab::buildMembersList()
{
- mAssignedMembersList->deleteAllItems();
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() "
- << "-- No group data!" << LL_ENDL;
- return;
- }
-
- // Check if there is anything selected.
- LLScrollListItem* item = mRolesList->getFirstSelected();
- if (!item) return;
-
- if (item->getUUID().isNull())
- {
- // Special cased 'Everyone' role
- LLGroupMgrGroupData::member_list_t::iterator mit = gdatap->mMembers.begin();
- LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
- for ( ; mit != end; ++mit)
- {
- mAssignedMembersList->addNameItem((*mit).first);
- }
- }
- else
- {
- LLGroupMgrGroupData::role_list_t::iterator rit = gdatap->mRoles.find(item->getUUID());
- if (rit != gdatap->mRoles.end())
- {
- LLGroupRoleData* rdatap = (*rit).second;
- if (rdatap)
- {
- uuid_vec_t::const_iterator mit = rdatap->getMembersBegin();
- uuid_vec_t::const_iterator end = rdatap->getMembersEnd();
- for ( ; mit != end; ++mit)
- {
- mAssignedMembersList->addNameItem((*mit));
- }
- }
- }
- }
+ mAssignedMembersList->deleteAllItems();
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() "
+ << "-- No group data!" << LL_ENDL;
+ return;
+ }
+
+ // Check if there is anything selected.
+ LLScrollListItem* item = mRolesList->getFirstSelected();
+ if (!item) return;
+
+ if (item->getUUID().isNull())
+ {
+ // Special cased 'Everyone' role
+ LLGroupMgrGroupData::member_list_t::iterator mit = gdatap->mMembers.begin();
+ LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
+ for ( ; mit != end; ++mit)
+ {
+ mAssignedMembersList->addNameItem((*mit).first);
+ }
+ }
+ else
+ {
+ LLGroupMgrGroupData::role_list_t::iterator rit = gdatap->mRoles.find(item->getUUID());
+ if (rit != gdatap->mRoles.end())
+ {
+ LLGroupRoleData* rdatap = (*rit).second;
+ if (rdatap)
+ {
+ uuid_vec_t::const_iterator mit = rdatap->getMembersBegin();
+ uuid_vec_t::const_iterator end = rdatap->getMembersEnd();
+ for ( ; mit != end; ++mit)
+ {
+ mAssignedMembersList->addNameItem((*mit));
+ }
+ }
+ }
+ }
}
struct ActionCBData
{
- LLPanelGroupRolesSubTab* mSelf;
- LLCheckBoxCtrl* mCheck;
+ LLPanelGroupRolesSubTab* mSelf;
+ LLCheckBoxCtrl* mCheck;
};
void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force)
{
- LLCheckBoxCtrl* check = dynamic_cast<LLCheckBoxCtrl*>(ctrl);
- if (!check)
- return;
-
- LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleActionSelect()" << LL_ENDL;
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() "
- << "-- No group data!" << LL_ENDL;
- return;
- }
-
- LLScrollListItem* action_item = mAllowedActionsList->getFirstSelected();
- if (!action_item)
- {
- return;
- }
-
- LLScrollListItem* role_item = mRolesList->getFirstSelected();
- if (!role_item)
- {
- return;
- }
- LLUUID role_id = role_item->getUUID();
-
- LLRoleAction* rap = (LLRoleAction*)action_item->getUserdata();
- U64 power = rap->mPowerBit;
-
- bool isEnablingAbility = check->get();
- LLRoleData rd;
- LLSD args;
-
- if (isEnablingAbility &&
- !force &&
- ((GP_ROLE_ASSIGN_MEMBER == power) || (GP_ROLE_CHANGE_ACTIONS == power) ))
- {
- // Uncheck the item, for now. It will be
- // checked if they click 'Yes', below.
- check->set(FALSE);
-
- LLRoleData rd;
- LLSD args;
-
- if ( gdatap->getRoleData(role_id, rd) )
- {
- args["ACTION_NAME"] = rap->mDescription;
- args["ROLE_NAME"] = rd.mRoleName;
- mHasModal = TRUE;
- std::string warning = "AssignDangerousActionWarning";
- if (GP_ROLE_CHANGE_ACTIONS == power)
- {
- warning = "AssignDangerousAbilityWarning";
- }
- LLNotificationsUtil::add(warning, args, LLSD(), boost::bind(&LLPanelGroupRolesSubTab::addActionCB, this, _1, _2, check));
- }
- else
- {
- LL_WARNS() << "Unable to look up role information for role id: "
- << role_id << LL_ENDL;
- }
- }
-
- if(GP_GROUP_BAN_ACCESS == power)
- {
- std::string warning = isEnablingAbility ? "AssignBanAbilityWarning" : "RemoveBanAbilityWarning";
-
- //////////////////////////////////////////////////////////////////////////
- // Get role data for both GP_ROLE_REMOVE_MEMBER and GP_MEMBER_EJECT
- // Add description and role name to LLSD
- // Pop up dialog saying "Yo, you also granted these other abilities when you did this!"
- if ( gdatap->getRoleData(role_id, rd) )
- {
- args["ACTION_NAME"] = rap->mDescription;
- args["ROLE_NAME"] = rd.mRoleName;
- mHasModal = TRUE;
-
- std::vector<LLScrollListItem*> all_data = mAllowedActionsList->getAllData();
- std::vector<LLScrollListItem*>::iterator ad_it = all_data.begin();
- std::vector<LLScrollListItem*>::iterator ad_end = all_data.end();
- LLRoleAction* adp;
- for( ; ad_it != ad_end; ++ad_it)
- {
- adp = (LLRoleAction*)(*ad_it)->getUserdata();
- if(adp->mPowerBit == GP_MEMBER_EJECT)
- {
- args["ACTION_NAME_2"] = adp->mDescription;
- }
- else if(adp->mPowerBit == GP_ROLE_REMOVE_MEMBER)
- {
- args["ACTION_NAME_3"] = adp->mDescription;
- }
- }
-
- LLNotificationsUtil::add(warning, args);
- }
- else
- {
- LL_WARNS() << "Unable to look up role information for role id: "
- << role_id << LL_ENDL;
- }
-
- //////////////////////////////////////////////////////////////////////////
-
- U64 current_role_powers = gdatap->getRolePowers(role_id);
-
- if(isEnablingAbility)
- {
- power |= (GP_ROLE_REMOVE_MEMBER | GP_MEMBER_EJECT);
- current_role_powers |= power;
- }
- else
- {
- current_role_powers &= ~GP_GROUP_BAN_ACCESS;
- }
-
- mAllowedActionsList->deleteAllItems();
- buildActionsList( mAllowedActionsList,
- current_role_powers,
- current_role_powers,
- boost::bind(&LLPanelGroupRolesSubTab::handleActionCheck, this, _1, false),
- TRUE,
- FALSE,
- FALSE);
-
- }
-
- //////////////////////////////////////////////////////////////////////////
- // Adding non-specific ability to role
- //////////////////////////////////////////////////////////////////////////
- if(isEnablingAbility)
- {
- gdatap->addRolePower(role_id, power);
- }
- else
- {
- gdatap->removeRolePower(role_id,power);
- }
-
- mHasRoleChange = TRUE;
- notifyObservers();
+ LLCheckBoxCtrl* check = dynamic_cast<LLCheckBoxCtrl*>(ctrl);
+ if (!check)
+ return;
+
+ LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleActionSelect()" << LL_ENDL;
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() "
+ << "-- No group data!" << LL_ENDL;
+ return;
+ }
+
+ LLScrollListItem* action_item = mAllowedActionsList->getFirstSelected();
+ if (!action_item)
+ {
+ return;
+ }
+
+ LLScrollListItem* role_item = mRolesList->getFirstSelected();
+ if (!role_item)
+ {
+ return;
+ }
+ LLUUID role_id = role_item->getUUID();
+
+ LLRoleAction* rap = (LLRoleAction*)action_item->getUserdata();
+ U64 power = rap->mPowerBit;
+
+ bool isEnablingAbility = check->get();
+ LLRoleData rd;
+ LLSD args;
+
+ if (isEnablingAbility &&
+ !force &&
+ ((GP_ROLE_ASSIGN_MEMBER == power) || (GP_ROLE_CHANGE_ACTIONS == power) ))
+ {
+ // Uncheck the item, for now. It will be
+ // checked if they click 'Yes', below.
+ check->set(FALSE);
+
+ LLRoleData rd;
+ LLSD args;
+
+ if ( gdatap->getRoleData(role_id, rd) )
+ {
+ args["ACTION_NAME"] = rap->mDescription;
+ args["ROLE_NAME"] = rd.mRoleName;
+ mHasModal = TRUE;
+ std::string warning = "AssignDangerousActionWarning";
+ if (GP_ROLE_CHANGE_ACTIONS == power)
+ {
+ warning = "AssignDangerousAbilityWarning";
+ }
+ LLNotificationsUtil::add(warning, args, LLSD(), boost::bind(&LLPanelGroupRolesSubTab::addActionCB, this, _1, _2, check));
+ }
+ else
+ {
+ LL_WARNS() << "Unable to look up role information for role id: "
+ << role_id << LL_ENDL;
+ }
+ }
+
+ if(GP_GROUP_BAN_ACCESS == power)
+ {
+ std::string warning = isEnablingAbility ? "AssignBanAbilityWarning" : "RemoveBanAbilityWarning";
+
+ //////////////////////////////////////////////////////////////////////////
+ // Get role data for both GP_ROLE_REMOVE_MEMBER and GP_MEMBER_EJECT
+ // Add description and role name to LLSD
+ // Pop up dialog saying "Yo, you also granted these other abilities when you did this!"
+ if ( gdatap->getRoleData(role_id, rd) )
+ {
+ args["ACTION_NAME"] = rap->mDescription;
+ args["ROLE_NAME"] = rd.mRoleName;
+ mHasModal = TRUE;
+
+ std::vector<LLScrollListItem*> all_data = mAllowedActionsList->getAllData();
+ std::vector<LLScrollListItem*>::iterator ad_it = all_data.begin();
+ std::vector<LLScrollListItem*>::iterator ad_end = all_data.end();
+ LLRoleAction* adp;
+ for( ; ad_it != ad_end; ++ad_it)
+ {
+ adp = (LLRoleAction*)(*ad_it)->getUserdata();
+ if(adp->mPowerBit == GP_MEMBER_EJECT)
+ {
+ args["ACTION_NAME_2"] = adp->mDescription;
+ }
+ else if(adp->mPowerBit == GP_ROLE_REMOVE_MEMBER)
+ {
+ args["ACTION_NAME_3"] = adp->mDescription;
+ }
+ }
+
+ LLNotificationsUtil::add(warning, args);
+ }
+ else
+ {
+ LL_WARNS() << "Unable to look up role information for role id: "
+ << role_id << LL_ENDL;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+
+ U64 current_role_powers = gdatap->getRolePowers(role_id);
+
+ if(isEnablingAbility)
+ {
+ power |= (GP_ROLE_REMOVE_MEMBER | GP_MEMBER_EJECT);
+ current_role_powers |= power;
+ }
+ else
+ {
+ current_role_powers &= ~GP_GROUP_BAN_ACCESS;
+ }
+
+ mAllowedActionsList->deleteAllItems();
+ buildActionsList( mAllowedActionsList,
+ current_role_powers,
+ current_role_powers,
+ boost::bind(&LLPanelGroupRolesSubTab::handleActionCheck, this, _1, false),
+ TRUE,
+ FALSE,
+ FALSE);
+
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Adding non-specific ability to role
+ //////////////////////////////////////////////////////////////////////////
+ if(isEnablingAbility)
+ {
+ gdatap->addRolePower(role_id, power);
+ }
+ else
+ {
+ gdatap->removeRolePower(role_id,power);
+ }
+
+ mHasRoleChange = TRUE;
+ notifyObservers();
}
bool LLPanelGroupRolesSubTab::addActionCB(const LLSD& notification, const LLSD& response, LLCheckBoxCtrl* check)
{
- if (!check) return false;
+ if (!check) return false;
- mHasModal = FALSE;
+ mHasModal = FALSE;
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- // User clicked "Yes"
- check->set(TRUE);
- const bool force_add = true;
- handleActionCheck(check, force_add);
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ // User clicked "Yes"
+ check->set(TRUE);
+ const bool force_add = true;
+ handleActionCheck(check, force_add);
+ }
+ return false;
}
// static
void LLPanelGroupRolesSubTab::onPropertiesKey(LLLineEditor* ctrl, void* user_data)
{
- LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
- if (!self) return;
+ LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
+ if (!self) return;
- self->mHasRoleChange = TRUE;
- self->notifyObservers();
+ self->mHasRoleChange = TRUE;
+ self->notifyObservers();
}
void LLPanelGroupRolesSubTab::onDescriptionKeyStroke(LLTextEditor* caller)
{
- mHasRoleChange = TRUE;
- notifyObservers();
+ mHasRoleChange = TRUE;
+ notifyObservers();
}
-// static
+// static
void LLPanelGroupRolesSubTab::onDescriptionCommit(LLUICtrl* ctrl, void* user_data)
{
- LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
- if (!self) return;
+ LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
+ if (!self) return;
- self->mHasRoleChange = TRUE;
- self->notifyObservers();
+ self->mHasRoleChange = TRUE;
+ self->notifyObservers();
}
-// static
+// static
void LLPanelGroupRolesSubTab::onMemberVisibilityChange(LLUICtrl* ctrl, void* user_data)
{
- LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
- LLCheckBoxCtrl* check = static_cast<LLCheckBoxCtrl*>(ctrl);
- if (!check || !self) return;
+ LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
+ LLCheckBoxCtrl* check = static_cast<LLCheckBoxCtrl*>(ctrl);
+ if (!check || !self) return;
- self->handleMemberVisibilityChange(check->get());
+ self->handleMemberVisibilityChange(check->get());
}
void LLPanelGroupRolesSubTab::handleMemberVisibilityChange(bool value)
{
- LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleMemberVisibilityChange()" << LL_ENDL;
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
- {
- LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() "
- << "-- No group data!" << LL_ENDL;
- return;
- }
-
- LLScrollListItem* role_item = mRolesList->getFirstSelected();
- if (!role_item)
- {
- return;
- }
-
- if (value)
- {
- gdatap->addRolePower(role_item->getUUID(),GP_MEMBER_VISIBLE_IN_DIR);
- }
- else
- {
- gdatap->removeRolePower(role_item->getUUID(),GP_MEMBER_VISIBLE_IN_DIR);
- }
-}
-
-// static
+ LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleMemberVisibilityChange()" << LL_ENDL;
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (!gdatap)
+ {
+ LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() "
+ << "-- No group data!" << LL_ENDL;
+ return;
+ }
+
+ LLScrollListItem* role_item = mRolesList->getFirstSelected();
+ if (!role_item)
+ {
+ return;
+ }
+
+ if (value)
+ {
+ gdatap->addRolePower(role_item->getUUID(),GP_MEMBER_VISIBLE_IN_DIR);
+ }
+ else
+ {
+ gdatap->removeRolePower(role_item->getUUID(),GP_MEMBER_VISIBLE_IN_DIR);
+ }
+}
+
+// static
void LLPanelGroupRolesSubTab::onCreateRole(void* user_data)
{
- LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
- if (!self) return;
+ LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
+ if (!self) return;
- self->handleCreateRole();
+ self->handleCreateRole();
}
void LLPanelGroupRolesSubTab::handleCreateRole()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap) return;
+ if (!gdatap) return;
- LLUUID new_role_id;
- new_role_id.generate();
+ LLUUID new_role_id;
+ new_role_id.generate();
- LLRoleData rd;
- rd.mRoleName = "New Role";
- gdatap->createRole(new_role_id,rd);
+ LLRoleData rd;
+ rd.mRoleName = "New Role";
+ gdatap->createRole(new_role_id,rd);
- mRolesList->deselectAllItems(TRUE);
- LLSD row;
- row["id"] = new_role_id;
- row["columns"][0]["column"] = "name";
- row["columns"][0]["value"] = rd.mRoleName;
- mRolesList->addElement(row, ADD_BOTTOM, this);
- mRolesList->selectByID(new_role_id);
+ mRolesList->deselectAllItems(TRUE);
+ LLSD row;
+ row["id"] = new_role_id;
+ row["columns"][0]["column"] = "name";
+ row["columns"][0]["value"] = rd.mRoleName;
+ mRolesList->addElement(row, ADD_BOTTOM, this);
+ mRolesList->selectByID(new_role_id);
- // put focus on name field and select its contents
- if(mRoleName)
- {
- mRoleName->setFocus(TRUE);
- mRoleName->onTabInto();
- gFocusMgr.triggerFocusFlash();
- }
+ // put focus on name field and select its contents
+ if(mRoleName)
+ {
+ mRoleName->setFocus(TRUE);
+ mRoleName->onTabInto();
+ gFocusMgr.triggerFocusFlash();
+ }
- notifyObservers();
+ notifyObservers();
}
-// static
+// static
void LLPanelGroupRolesSubTab::onCopyRole(void* user_data)
{
- LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
- if (!self) return;
+ LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
+ if (!self) return;
- self->handleCopyRole();
+ self->handleCopyRole();
}
void LLPanelGroupRolesSubTab::handleCopyRole()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap) return;
+ if (!gdatap) return;
- LLScrollListItem* role_item = mRolesList->getFirstSelected();
- if (!role_item || role_item->getUUID().isNull())
- {
- return;
- }
+ LLScrollListItem* role_item = mRolesList->getFirstSelected();
+ if (!role_item || role_item->getUUID().isNull())
+ {
+ return;
+ }
- LLRoleData rd;
- if (!gdatap->getRoleData(role_item->getUUID(), rd))
- {
- return;
- }
+ LLRoleData rd;
+ if (!gdatap->getRoleData(role_item->getUUID(), rd))
+ {
+ return;
+ }
- LLUUID new_role_id;
- new_role_id.generate();
- rd.mRoleName += "(Copy)";
- gdatap->createRole(new_role_id,rd);
+ LLUUID new_role_id;
+ new_role_id.generate();
+ rd.mRoleName += "(Copy)";
+ gdatap->createRole(new_role_id,rd);
- mRolesList->deselectAllItems(TRUE);
- LLSD row;
- row["id"] = new_role_id;
- row["columns"][0]["column"] = "name";
- row["columns"][0]["value"] = rd.mRoleName;
- mRolesList->addElement(row, ADD_BOTTOM, this);
- mRolesList->selectByID(new_role_id);
+ mRolesList->deselectAllItems(TRUE);
+ LLSD row;
+ row["id"] = new_role_id;
+ row["columns"][0]["column"] = "name";
+ row["columns"][0]["value"] = rd.mRoleName;
+ mRolesList->addElement(row, ADD_BOTTOM, this);
+ mRolesList->selectByID(new_role_id);
- // put focus on name field and select its contents
- if(mRoleName)
- {
- mRoleName->setFocus(TRUE);
- mRoleName->onTabInto();
- gFocusMgr.triggerFocusFlash();
- }
+ // put focus on name field and select its contents
+ if(mRoleName)
+ {
+ mRoleName->setFocus(TRUE);
+ mRoleName->onTabInto();
+ gFocusMgr.triggerFocusFlash();
+ }
- notifyObservers();
+ notifyObservers();
}
-// static
+// static
void LLPanelGroupRolesSubTab::onDeleteRole(void* user_data)
{
- LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
- if (!self) return;
+ LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
+ if (!self) return;
- self->handleDeleteRole();
+ self->handleDeleteRole();
}
void LLPanelGroupRolesSubTab::handleDeleteRole()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap) return;
+ if (!gdatap) return;
- LLScrollListItem* role_item = mRolesList->getFirstSelected();
- if (!role_item)
- {
- return;
- }
+ LLScrollListItem* role_item = mRolesList->getFirstSelected();
+ if (!role_item)
+ {
+ return;
+ }
- if (role_item->getUUID().isNull() || role_item->getUUID() == gdatap->mOwnerRole)
- {
- LLSD args;
- args["MESSAGE"] = mRemoveEveryoneTxt;
- LLNotificationsUtil::add("GenericAlert", args);
- return;
- }
+ if (role_item->getUUID().isNull() || role_item->getUUID() == gdatap->mOwnerRole)
+ {
+ LLSD args;
+ args["MESSAGE"] = mRemoveEveryoneTxt;
+ LLNotificationsUtil::add("GenericAlert", args);
+ return;
+ }
- gdatap->deleteRole(role_item->getUUID());
- mRolesList->deleteSingleItem(mRolesList->getFirstSelectedIndex());
- mRolesList->selectFirstItem();
+ gdatap->deleteRole(role_item->getUUID());
+ mRolesList->deleteSingleItem(mRolesList->getFirstSelectedIndex());
+ mRolesList->selectFirstItem();
- notifyObservers();
+ notifyObservers();
}
void LLPanelGroupRolesSubTab::saveRoleChanges(bool select_saved_role)
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+
+ if (!gdatap) return;
- if (!gdatap) return;
+ if (mHasRoleChange)
+ {
+ LLRoleData rd;
+ if (!gdatap->getRoleData(mSelectedRole,rd)) return;
- if (mHasRoleChange)
- {
- LLRoleData rd;
- if (!gdatap->getRoleData(mSelectedRole,rd)) return;
+ rd.mRoleName = mRoleName->getText();
+ rd.mRoleDescription = mRoleDescription->getText();
+ rd.mRoleTitle = mRoleTitle->getText();
- rd.mRoleName = mRoleName->getText();
- rd.mRoleDescription = mRoleDescription->getText();
- rd.mRoleTitle = mRoleTitle->getText();
+ S32 role_members_count = 0;
+ if (mSelectedRole.isNull())
+ {
+ role_members_count = gdatap->mMemberCount;
+ }
+ else if(LLGroupRoleData* grd = get_ptr_in_map(gdatap->mRoles, mSelectedRole))
+ {
+ role_members_count = grd->getTotalMembersInRole();
+ }
- S32 role_members_count = 0;
- if (mSelectedRole.isNull())
- {
- role_members_count = gdatap->mMemberCount;
- }
- else if(LLGroupRoleData* grd = get_ptr_in_map(gdatap->mRoles, mSelectedRole))
- {
- role_members_count = grd->getTotalMembersInRole();
- }
+ gdatap->setRoleData(mSelectedRole,rd);
- gdatap->setRoleData(mSelectedRole,rd);
+ mRolesList->deleteSingleItem(mRolesList->getItemIndex(mSelectedRole));
- mRolesList->deleteSingleItem(mRolesList->getItemIndex(mSelectedRole));
-
- LLSD row = createRoleItem(mSelectedRole,rd.mRoleName,rd.mRoleTitle,role_members_count);
- LLScrollListItem* item = mRolesList->addElement(row, ADD_BOTTOM, this);
- item->setSelected(select_saved_role);
+ LLSD row = createRoleItem(mSelectedRole,rd.mRoleName,rd.mRoleTitle,role_members_count);
+ LLScrollListItem* item = mRolesList->addElement(row, ADD_BOTTOM, this);
+ item->setSelected(select_saved_role);
- mHasRoleChange = FALSE;
- }
+ mHasRoleChange = FALSE;
+ }
}
void LLPanelGroupRolesSubTab::updateActionDescription()
{
- mActionDescription->setText(std::string());
- LLScrollListItem* action_item = mAllowedActionsList->getFirstSelected();
- if (!action_item || !mAllowedActionsList->getCanSelect())
- {
- return;
- }
+ mActionDescription->setText(std::string());
+ LLScrollListItem* action_item = mAllowedActionsList->getFirstSelected();
+ if (!action_item || !mAllowedActionsList->getCanSelect())
+ {
+ return;
+ }
- LLRoleAction* rap = (LLRoleAction*)action_item->getUserdata();
- if (rap)
- {
- std::string desc = rap->mLongDescription.empty() ? rap->mDescription : rap->mLongDescription;
- mActionDescription->setText(desc);
- }
+ LLRoleAction* rap = (LLRoleAction*)action_item->getUserdata();
+ if (rap)
+ {
+ std::string desc = rap->mLongDescription.empty() ? rap->mDescription : rap->mLongDescription;
+ mActionDescription->setText(desc);
+ }
}
void LLPanelGroupRolesSubTab::setGroupID(const LLUUID& id)
{
- if(mRolesList) mRolesList->deleteAllItems();
- if(mAssignedMembersList) mAssignedMembersList->deleteAllItems();
- if(mAllowedActionsList) mAllowedActionsList->deleteAllItems();
+ if(mRolesList) mRolesList->deleteAllItems();
+ if(mAssignedMembersList) mAssignedMembersList->deleteAllItems();
+ if(mAllowedActionsList) mAllowedActionsList->deleteAllItems();
- if(mRoleName) mRoleName->clear();
- if(mRoleDescription) mRoleDescription->clear();
- if(mRoleTitle) mRoleTitle->clear();
+ if(mRoleName) mRoleName->clear();
+ if(mRoleDescription) mRoleDescription->clear();
+ if(mRoleTitle) mRoleTitle->clear();
- mHasRoleChange = FALSE;
+ mHasRoleChange = FALSE;
- setFooterEnabled(FALSE);
+ setFooterEnabled(FALSE);
- LLPanelGroupSubTab::setGroupID(id);
+ LLPanelGroupSubTab::setGroupID(id);
}
@@ -2845,198 +2845,198 @@ LLPanelGroupActionsSubTab::~LLPanelGroupActionsSubTab()
BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root)
{
- LLPanelGroupSubTab::postBuildSubTab(root);
+ LLPanelGroupSubTab::postBuildSubTab(root);
- // Upcast parent so we can ask it for sibling controls.
- LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root;
+ // Upcast parent so we can ask it for sibling controls.
+ LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root;
- // Look recursively from the parent to find all our widgets.
- bool recurse = true;
- mHeader = parent->findChild<LLPanel>("actions_header", recurse);
- mFooter = parent->findChild<LLPanel>("actions_footer", recurse);
+ // Look recursively from the parent to find all our widgets.
+ bool recurse = true;
+ mHeader = parent->findChild<LLPanel>("actions_header", recurse);
+ mFooter = parent->findChild<LLPanel>("actions_footer", recurse);
- mActionDescription = parent->getChild<LLTextEditor>("action_description", recurse);
+ mActionDescription = parent->getChild<LLTextEditor>("action_description", recurse);
- mActionList = parent->getChild<LLScrollListCtrl>("action_list",recurse);
- mActionRoles = parent->getChild<LLScrollListCtrl>("action_roles",recurse);
- mActionMembers = parent->getChild<LLNameListCtrl>("action_members",recurse);
+ mActionList = parent->getChild<LLScrollListCtrl>("action_list",recurse);
+ mActionRoles = parent->getChild<LLScrollListCtrl>("action_roles",recurse);
+ mActionMembers = parent->getChild<LLNameListCtrl>("action_members",recurse);
- if (!mActionList || !mActionDescription || !mActionRoles || !mActionMembers) return FALSE;
+ if (!mActionList || !mActionDescription || !mActionRoles || !mActionMembers) return FALSE;
- mActionList->setCommitOnSelectionChange(TRUE);
- mActionList->setCommitCallback(boost::bind(&LLPanelGroupActionsSubTab::handleActionSelect, this));
- mActionList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+ mActionList->setCommitOnSelectionChange(TRUE);
+ mActionList->setCommitCallback(boost::bind(&LLPanelGroupActionsSubTab::handleActionSelect, this));
+ mActionList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
- update(GC_ALL);
+ update(GC_ALL);
- return TRUE;
+ return TRUE;
}
void LLPanelGroupActionsSubTab::activate()
{
- LLPanelGroupSubTab::activate();
+ LLPanelGroupSubTab::activate();
- update(GC_ALL);
- mActionDescription->clear();
- mActionList->deselectAllItems();
- mActionList->deleteAllItems();
- buildActionsList(mActionList,
- GP_ALL_POWERS,
- GP_ALL_POWERS,
- NULL,
- FALSE,
- TRUE,
- FALSE);
+ update(GC_ALL);
+ mActionDescription->clear();
+ mActionList->deselectAllItems();
+ mActionList->deleteAllItems();
+ buildActionsList(mActionList,
+ GP_ALL_POWERS,
+ GP_ALL_POWERS,
+ NULL,
+ FALSE,
+ TRUE,
+ FALSE);
}
void LLPanelGroupActionsSubTab::deactivate()
{
- LL_DEBUGS() << "LLPanelGroupActionsSubTab::deactivate()" << LL_ENDL;
+ LL_DEBUGS() << "LLPanelGroupActionsSubTab::deactivate()" << LL_ENDL;
- LLPanelGroupSubTab::deactivate();
+ LLPanelGroupSubTab::deactivate();
}
bool LLPanelGroupActionsSubTab::needsApply(std::string& mesg)
{
- LL_DEBUGS() << "LLPanelGroupActionsSubTab::needsApply()" << LL_ENDL;
+ LL_DEBUGS() << "LLPanelGroupActionsSubTab::needsApply()" << LL_ENDL;
- return false;
+ return false;
}
bool LLPanelGroupActionsSubTab::apply(std::string& mesg)
{
- LL_DEBUGS() << "LLPanelGroupActionsSubTab::apply()" << LL_ENDL;
- return true;
+ LL_DEBUGS() << "LLPanelGroupActionsSubTab::apply()" << LL_ENDL;
+ return true;
}
void LLPanelGroupActionsSubTab::update(LLGroupChange gc)
{
- LL_DEBUGS() << "LLPanelGroupActionsSubTab::update()" << LL_ENDL;
+ LL_DEBUGS() << "LLPanelGroupActionsSubTab::update()" << LL_ENDL;
- if (mGroupID.isNull()) return;
+ if (mGroupID.isNull()) return;
- mActionMembers->deleteAllItems();
- mActionRoles->deleteAllItems();
+ mActionMembers->deleteAllItems();
+ mActionRoles->deleteAllItems();
- if(mActionList->hasSelectedItem())
- {
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (gdatap && gdatap->isMemberDataComplete() && gdatap->isRoleDataComplete())
- {
- handleActionSelect();
- }
- }
+ if(mActionList->hasSelectedItem())
+ {
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (gdatap && gdatap->isMemberDataComplete() && gdatap->isRoleDataComplete())
+ {
+ handleActionSelect();
+ }
+ }
}
void LLPanelGroupActionsSubTab::onFilterChanged()
{
- mActionDescription->clear();
- mActionList->deselectAllItems();
- mActionList->deleteAllItems();
- buildActionsList(mActionList,
- GP_ALL_POWERS,
- GP_ALL_POWERS,
- NULL,
- FALSE,
- TRUE,
- FALSE);
+ mActionDescription->clear();
+ mActionList->deselectAllItems();
+ mActionList->deleteAllItems();
+ buildActionsList(mActionList,
+ GP_ALL_POWERS,
+ GP_ALL_POWERS,
+ NULL,
+ FALSE,
+ TRUE,
+ FALSE);
}
void LLPanelGroupActionsSubTab::handleActionSelect()
{
- mActionMembers->deleteAllItems();
- mActionRoles->deleteAllItems();
-
- U64 power_mask = GP_NO_POWERS;
- std::vector<LLScrollListItem*> selection =
- mActionList->getAllSelected();
- if (selection.empty()) return;
-
- LLRoleAction* rap;
-
- std::vector<LLScrollListItem*>::iterator itor;
- for (itor = selection.begin() ;
- itor != selection.end(); ++itor)
- {
- rap = (LLRoleAction*)( (*itor)->getUserdata() );
- power_mask |= rap->mPowerBit;
- }
-
- if (selection.size() == 1)
- {
- LLScrollListItem* item = selection[0];
- rap = (LLRoleAction*)(item->getUserdata());
-
- if (rap->mLongDescription.empty())
- {
- mActionDescription->setText(rap->mDescription);
- }
- else
- {
- mActionDescription->setText(rap->mLongDescription);
- }
- }
- else
- {
- mActionDescription->clear();
- }
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
-
- if (!gdatap) return;
-
- if (gdatap->isMemberDataComplete())
- {
- LLGroupMgrGroupData::member_list_t::iterator it = gdatap->mMembers.begin();
- LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
- LLGroupMemberData* gmd;
-
- for ( ; it != end; ++it)
- {
- gmd = (*it).second;
- if (!gmd) continue;
- if ((gmd->getAgentPowers() & power_mask) == power_mask)
- {
- mActionMembers->addNameItem(gmd->getID());
- }
- }
- }
- else
- {
- LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID);
- }
-
- if (gdatap->isRoleDataComplete())
- {
- LLGroupMgrGroupData::role_list_t::iterator it = gdatap->mRoles.begin();
- LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end();
- LLGroupRoleData* rmd;
-
- for ( ; it != end; ++it)
- {
- rmd = (*it).second;
- if (!rmd) continue;
- if ((rmd->getRoleData().mRolePowers & power_mask) == power_mask)
- {
- mActionRoles->addSimpleElement(rmd->getRoleData().mRoleName);
- }
- }
- }
- else
- {
- LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID);
- }
+ mActionMembers->deleteAllItems();
+ mActionRoles->deleteAllItems();
+
+ U64 power_mask = GP_NO_POWERS;
+ std::vector<LLScrollListItem*> selection =
+ mActionList->getAllSelected();
+ if (selection.empty()) return;
+
+ LLRoleAction* rap;
+
+ std::vector<LLScrollListItem*>::iterator itor;
+ for (itor = selection.begin() ;
+ itor != selection.end(); ++itor)
+ {
+ rap = (LLRoleAction*)( (*itor)->getUserdata() );
+ power_mask |= rap->mPowerBit;
+ }
+
+ if (selection.size() == 1)
+ {
+ LLScrollListItem* item = selection[0];
+ rap = (LLRoleAction*)(item->getUserdata());
+
+ if (rap->mLongDescription.empty())
+ {
+ mActionDescription->setText(rap->mDescription);
+ }
+ else
+ {
+ mActionDescription->setText(rap->mLongDescription);
+ }
+ }
+ else
+ {
+ mActionDescription->clear();
+ }
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+
+ if (!gdatap) return;
+
+ if (gdatap->isMemberDataComplete())
+ {
+ LLGroupMgrGroupData::member_list_t::iterator it = gdatap->mMembers.begin();
+ LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
+ LLGroupMemberData* gmd;
+
+ for ( ; it != end; ++it)
+ {
+ gmd = (*it).second;
+ if (!gmd) continue;
+ if ((gmd->getAgentPowers() & power_mask) == power_mask)
+ {
+ mActionMembers->addNameItem(gmd->getID());
+ }
+ }
+ }
+ else
+ {
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID);
+ }
+
+ if (gdatap->isRoleDataComplete())
+ {
+ LLGroupMgrGroupData::role_list_t::iterator it = gdatap->mRoles.begin();
+ LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end();
+ LLGroupRoleData* rmd;
+
+ for ( ; it != end; ++it)
+ {
+ rmd = (*it).second;
+ if (!rmd) continue;
+ if ((rmd->getRoleData().mRolePowers & power_mask) == power_mask)
+ {
+ mActionRoles->addSimpleElement(rmd->getRoleData().mRoleName);
+ }
+ }
+ }
+ else
+ {
+ LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID);
+ }
}
void LLPanelGroupActionsSubTab::setGroupID(const LLUUID& id)
{
- if(mActionList) mActionList->deleteAllItems();
- if(mActionRoles) mActionRoles->deleteAllItems();
- if(mActionMembers) mActionMembers->deleteAllItems();
+ if(mActionList) mActionList->deleteAllItems();
+ if(mActionRoles) mActionRoles->deleteAllItems();
+ if(mActionMembers) mActionMembers->deleteAllItems();
- if(mActionDescription) mActionDescription->clear();
-
- LLPanelGroupSubTab::setGroupID(id);
+ if(mActionDescription) mActionDescription->clear();
+
+ LLPanelGroupSubTab::setGroupID(id);
}
@@ -3044,282 +3044,282 @@ void LLPanelGroupActionsSubTab::setGroupID(const LLUUID& id)
static LLPanelInjector<LLPanelGroupBanListSubTab> t_panel_group_ban_subtab("panel_group_banlist_subtab");
LLPanelGroupBanListSubTab::LLPanelGroupBanListSubTab()
- : LLPanelGroupSubTab(),
- mBanList(NULL),
- mCreateBanButton(NULL),
- mDeleteBanButton(NULL)
+ : LLPanelGroupSubTab(),
+ mBanList(NULL),
+ mCreateBanButton(NULL),
+ mDeleteBanButton(NULL)
{}
BOOL LLPanelGroupBanListSubTab::postBuildSubTab(LLView* root)
{
- LLPanelGroupSubTab::postBuildSubTab(root);
+ LLPanelGroupSubTab::postBuildSubTab(root);
+
+ // Upcast parent so we can ask it for sibling controls.
+ LLPanelGroupRoles* parent = (LLPanelGroupRoles*)root;
- // Upcast parent so we can ask it for sibling controls.
- LLPanelGroupRoles* parent = (LLPanelGroupRoles*)root;
+ // Look recursively from the parent to find all our widgets.
+ bool recurse = true;
- // Look recursively from the parent to find all our widgets.
- bool recurse = true;
+ mHeader = parent->findChild<LLPanel>("banlist_header", recurse);
+ mFooter = parent->findChild<LLPanel>("banlist_footer", recurse);
- mHeader = parent->findChild<LLPanel>("banlist_header", recurse);
- mFooter = parent->findChild<LLPanel>("banlist_footer", recurse);
+ mBanList = parent->getChild<LLNameListCtrl>("ban_list", recurse);
- mBanList = parent->getChild<LLNameListCtrl>("ban_list", recurse);
-
- mCreateBanButton = parent->getChild<LLButton>("ban_create", recurse);
- mDeleteBanButton = parent->getChild<LLButton>("ban_delete", recurse);
- mRefreshBanListButton = parent->getChild<LLButton>("ban_refresh", recurse);
- mBanCountText = parent->getChild<LLTextBase>("ban_count", recurse);
+ mCreateBanButton = parent->getChild<LLButton>("ban_create", recurse);
+ mDeleteBanButton = parent->getChild<LLButton>("ban_delete", recurse);
+ mRefreshBanListButton = parent->getChild<LLButton>("ban_refresh", recurse);
+ mBanCountText = parent->getChild<LLTextBase>("ban_count", recurse);
- if(!mBanList || !mCreateBanButton || !mDeleteBanButton || !mRefreshBanListButton || !mBanCountText)
- return FALSE;
+ if(!mBanList || !mCreateBanButton || !mDeleteBanButton || !mRefreshBanListButton || !mBanCountText)
+ return FALSE;
- mBanList->setCommitOnSelectionChange(TRUE);
- mBanList->setCommitCallback(onBanEntrySelect, this);
+ mBanList->setCommitOnSelectionChange(TRUE);
+ mBanList->setCommitCallback(onBanEntrySelect, this);
- mCreateBanButton->setClickedCallback(onCreateBanEntry, this);
- mCreateBanButton->setEnabled(FALSE);
+ mCreateBanButton->setClickedCallback(onCreateBanEntry, this);
+ mCreateBanButton->setEnabled(FALSE);
- mDeleteBanButton->setClickedCallback(onDeleteBanEntry, this);
- mDeleteBanButton->setEnabled(FALSE);
-
- mRefreshBanListButton->setClickedCallback(onRefreshBanList, this);
- mRefreshBanListButton->setEnabled(FALSE);
+ mDeleteBanButton->setClickedCallback(onDeleteBanEntry, this);
+ mDeleteBanButton->setEnabled(FALSE);
- setBanCount(0);
+ mRefreshBanListButton->setClickedCallback(onRefreshBanList, this);
+ mRefreshBanListButton->setEnabled(FALSE);
- mBanList->setOnNameListCompleteCallback(boost::bind(&LLPanelGroupBanListSubTab::onBanListCompleted, this, _1));
-
- populateBanList();
+ setBanCount(0);
- setFooterEnabled(FALSE);
- return TRUE;
+ mBanList->setOnNameListCompleteCallback(boost::bind(&LLPanelGroupBanListSubTab::onBanListCompleted, this, _1));
+
+ populateBanList();
+
+ setFooterEnabled(FALSE);
+ return TRUE;
}
void LLPanelGroupBanListSubTab::activate()
{
- LLPanelGroupSubTab::activate();
+ LLPanelGroupSubTab::activate();
- mBanList->deselectAllItems();
- mDeleteBanButton->setEnabled(FALSE);
+ mBanList->deselectAllItems();
+ mDeleteBanButton->setEnabled(FALSE);
- LLGroupMgrGroupData * group_datap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (group_datap)
- {
- mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) &&
- group_datap->mBanList.size() < GB_MAX_BANNED_AGENTS);
- setBanCount(group_datap->mBanList.size());
- }
- else
- {
- mCreateBanButton->setEnabled(FALSE);
- setBanCount(0);
- }
+ LLGroupMgrGroupData * group_datap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if (group_datap)
+ {
+ mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) &&
+ group_datap->mBanList.size() < GB_MAX_BANNED_AGENTS);
+ setBanCount(group_datap->mBanList.size());
+ }
+ else
+ {
+ mCreateBanButton->setEnabled(FALSE);
+ setBanCount(0);
+ }
- // BAKER: Should I really request everytime activate() is called?
- // Perhaps I should only do it on a force refresh, or if an action on the list happens...
- // Because it's not going to live-update the list anyway... You'd have to refresh if you
- // wanted to see someone else's additions anyway...
- //
- LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID);
+ // BAKER: Should I really request everytime activate() is called?
+ // Perhaps I should only do it on a force refresh, or if an action on the list happens...
+ // Because it's not going to live-update the list anyway... You'd have to refresh if you
+ // wanted to see someone else's additions anyway...
+ //
+ LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID);
- setFooterEnabled(FALSE);
- update(GC_ALL);
+ setFooterEnabled(FALSE);
+ update(GC_ALL);
}
void LLPanelGroupBanListSubTab::update(LLGroupChange gc)
{
- populateBanList();
+ populateBanList();
}
void LLPanelGroupBanListSubTab::draw()
{
- LLPanelGroupSubTab::draw();
+ LLPanelGroupSubTab::draw();
- // BAKER: Might be good to put it here instead of update, maybe.. See how often draw gets hit.
- //if(
- // populateBanList();
+ // BAKER: Might be good to put it here instead of update, maybe.. See how often draw gets hit.
+ //if(
+ // populateBanList();
}
void LLPanelGroupBanListSubTab::onBanEntrySelect(LLUICtrl* ctrl, void* user_data)
{
- LLPanelGroupBanListSubTab* self = static_cast<LLPanelGroupBanListSubTab*>(user_data);
- if (!self)
- return;
+ LLPanelGroupBanListSubTab* self = static_cast<LLPanelGroupBanListSubTab*>(user_data);
+ if (!self)
+ return;
- self->handleBanEntrySelect();
+ self->handleBanEntrySelect();
}
void LLPanelGroupBanListSubTab::handleBanEntrySelect()
{
- if (gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS))
- {
- mDeleteBanButton->setEnabled(TRUE);
- }
+ if (gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS))
+ {
+ mDeleteBanButton->setEnabled(TRUE);
+ }
}
void LLPanelGroupBanListSubTab::onCreateBanEntry(void* user_data)
{
- LLPanelGroupBanListSubTab* self = static_cast<LLPanelGroupBanListSubTab*>(user_data);
- if (!self)
- return;
+ LLPanelGroupBanListSubTab* self = static_cast<LLPanelGroupBanListSubTab*>(user_data);
+ if (!self)
+ return;
- self->handleCreateBanEntry();
+ self->handleCreateBanEntry();
}
void LLPanelGroupBanListSubTab::handleCreateBanEntry()
{
- LLFloaterGroupBulkBan::showForGroup(mGroupID);
- //populateBanList();
+ LLFloaterGroupBulkBan::showForGroup(mGroupID);
+ //populateBanList();
}
void LLPanelGroupBanListSubTab::onDeleteBanEntry(void* user_data)
{
- LLPanelGroupBanListSubTab* self = static_cast<LLPanelGroupBanListSubTab*>(user_data);
- if (!self)
- return;
+ LLPanelGroupBanListSubTab* self = static_cast<LLPanelGroupBanListSubTab*>(user_data);
+ if (!self)
+ return;
- self->handleDeleteBanEntry();
+ self->handleDeleteBanEntry();
}
void LLPanelGroupBanListSubTab::handleDeleteBanEntry()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if(!gdatap)
- {
- LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL;
- return;
- }
-
- std::vector<LLScrollListItem*> selection = mBanList->getAllSelected();
- if(selection.empty())
- {
- return;
- }
-
- bool can_ban_members = false;
- if (gAgent.isGodlike() ||
- gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS))
- {
- can_ban_members = true;
- }
-
- // Owners can ban anyone in the group.
- LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(gAgent.getID());
- if (mi != gdatap->mMembers.end())
- {
- LLGroupMemberData* member_data = (*mi).second;
- if ( member_data && member_data->isInRole(gdatap->mOwnerRole) )
- {
- can_ban_members = true;
- }
- }
-
- if(!can_ban_members)
- return;
-
- std::vector<LLUUID> ban_ids;
- std::vector<LLScrollListItem*>::iterator itor;
- for(itor = selection.begin(); itor != selection.end(); ++itor)
- {
- LLUUID ban_id = (*itor)->getUUID();
- ban_ids.push_back(ban_id);
-
- gdatap->removeBanEntry(ban_id);
- mBanList->removeNameItem(ban_id);
-
- // Removing an item removes the selection, we shouldn't be able to click
- // the button anymore until we reselect another entry.
- mDeleteBanButton->setEnabled(FALSE);
- }
-
- // update ban-count related elements
- mCreateBanButton->setEnabled(TRUE);
- setBanCount(gdatap->mBanList.size());
-
- LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_DELETE, ban_ids);
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if(!gdatap)
+ {
+ LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL;
+ return;
+ }
+
+ std::vector<LLScrollListItem*> selection = mBanList->getAllSelected();
+ if(selection.empty())
+ {
+ return;
+ }
+
+ bool can_ban_members = false;
+ if (gAgent.isGodlike() ||
+ gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS))
+ {
+ can_ban_members = true;
+ }
+
+ // Owners can ban anyone in the group.
+ LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(gAgent.getID());
+ if (mi != gdatap->mMembers.end())
+ {
+ LLGroupMemberData* member_data = (*mi).second;
+ if ( member_data && member_data->isInRole(gdatap->mOwnerRole) )
+ {
+ can_ban_members = true;
+ }
+ }
+
+ if(!can_ban_members)
+ return;
+
+ std::vector<LLUUID> ban_ids;
+ std::vector<LLScrollListItem*>::iterator itor;
+ for(itor = selection.begin(); itor != selection.end(); ++itor)
+ {
+ LLUUID ban_id = (*itor)->getUUID();
+ ban_ids.push_back(ban_id);
+
+ gdatap->removeBanEntry(ban_id);
+ mBanList->removeNameItem(ban_id);
+
+ // Removing an item removes the selection, we shouldn't be able to click
+ // the button anymore until we reselect another entry.
+ mDeleteBanButton->setEnabled(FALSE);
+ }
+
+ // update ban-count related elements
+ mCreateBanButton->setEnabled(TRUE);
+ setBanCount(gdatap->mBanList.size());
+
+ LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_DELETE, ban_ids);
}
void LLPanelGroupBanListSubTab::onRefreshBanList(void* user_data)
{
- LLPanelGroupBanListSubTab* self = static_cast<LLPanelGroupBanListSubTab*>(user_data);
- if (!self)
- return;
+ LLPanelGroupBanListSubTab* self = static_cast<LLPanelGroupBanListSubTab*>(user_data);
+ if (!self)
+ return;
- self->handleRefreshBanList();
+ self->handleRefreshBanList();
}
void LLPanelGroupBanListSubTab::handleRefreshBanList()
{
- mRefreshBanListButton->setEnabled(FALSE);
- LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID);
+ mRefreshBanListButton->setEnabled(FALSE);
+ LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID);
}
void LLPanelGroupBanListSubTab::onBanListCompleted(bool isComplete)
{
- if(isComplete)
- {
- mRefreshBanListButton->setEnabled(TRUE);
- populateBanList();
- }
+ if(isComplete)
+ {
+ mRefreshBanListButton->setEnabled(TRUE);
+ populateBanList();
+ }
}
void LLPanelGroupBanListSubTab::setBanCount(U32 ban_count)
{
- LLStringUtil::format_map_t args;
- args["[COUNT]"] = llformat("%d", ban_count);
- args["[LIMIT]"] = llformat("%d", GB_MAX_BANNED_AGENTS);
- mBanCountText->setText(getString("ban_count_template", args));
+ LLStringUtil::format_map_t args;
+ args["[COUNT]"] = llformat("%d", ban_count);
+ args["[LIMIT]"] = llformat("%d", GB_MAX_BANNED_AGENTS);
+ mBanCountText->setText(getString("ban_count_template", args));
}
void LLPanelGroupBanListSubTab::populateBanList()
{
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if(!gdatap)
- {
- LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL;
- return;
- }
-
- mBanList->deleteAllItems();
- std::map<LLUUID,LLGroupBanData>::const_iterator entry = gdatap->mBanList.begin();
- for(; entry != gdatap->mBanList.end(); entry++)
- {
- LLNameListCtrl::NameItem ban_entry;
- ban_entry.value = entry->first;
- LLGroupBanData bd = entry->second;
-
- ban_entry.columns.add().column("name").font.name("SANSSERIF_SMALL").style("NORMAL");
-
- // Baker TODO: MAINT-
- // Check out utc_to_pacific_time()
-
- std::string ban_date_str = bd.mBanDate.toHTTPDateString("%Y/%m/%d");
-// time_t utc_time;
-// utc_time = time_corrected();
-// LLSD substitution;
-// substitution["datetime"] = (S32) utc_time;
-// LLStringUtil::format (ban_date_str, substitution);
-
- //LL_INFOS("BAKER") << "[BAKER] BAN_DATE: " << bd.mBanDate.toHTTPDateString("%Y/%m/%d") << LL_ENDL;
- //LL_INFOS("BAKER") << "[BAKER] BAN_DATE_MODIFIED: " << ban_date_str << LL_ENDL;
-
- //ban_entry.columns.add().column("ban_date").value(ban_date_str.font.name("SANSSERIF_SMALL").style("NORMAL");
- ban_entry.columns.add().column("ban_date").value(bd.mBanDate.toHTTPDateString("%Y/%m/%d")).font.name("SANSSERIF_SMALL").style("NORMAL");
-
- mBanList->addNameItemRow(ban_entry);
- }
-
- mRefreshBanListButton->setEnabled(TRUE);
- mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) &&
- gdatap->mBanList.size() < GB_MAX_BANNED_AGENTS);
- setBanCount(gdatap->mBanList.size());
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+ if(!gdatap)
+ {
+ LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL;
+ return;
+ }
+
+ mBanList->deleteAllItems();
+ std::map<LLUUID,LLGroupBanData>::const_iterator entry = gdatap->mBanList.begin();
+ for(; entry != gdatap->mBanList.end(); entry++)
+ {
+ LLNameListCtrl::NameItem ban_entry;
+ ban_entry.value = entry->first;
+ LLGroupBanData bd = entry->second;
+
+ ban_entry.columns.add().column("name").font.name("SANSSERIF_SMALL").style("NORMAL");
+
+ // Baker TODO: MAINT-
+ // Check out utc_to_pacific_time()
+
+ std::string ban_date_str = bd.mBanDate.toHTTPDateString("%Y/%m/%d");
+// time_t utc_time;
+// utc_time = time_corrected();
+// LLSD substitution;
+// substitution["datetime"] = (S32) utc_time;
+// LLStringUtil::format (ban_date_str, substitution);
+
+ //LL_INFOS("BAKER") << "[BAKER] BAN_DATE: " << bd.mBanDate.toHTTPDateString("%Y/%m/%d") << LL_ENDL;
+ //LL_INFOS("BAKER") << "[BAKER] BAN_DATE_MODIFIED: " << ban_date_str << LL_ENDL;
+
+ //ban_entry.columns.add().column("ban_date").value(ban_date_str.font.name("SANSSERIF_SMALL").style("NORMAL");
+ ban_entry.columns.add().column("ban_date").value(bd.mBanDate.toHTTPDateString("%Y/%m/%d")).font.name("SANSSERIF_SMALL").style("NORMAL");
+
+ mBanList->addNameItemRow(ban_entry);
+ }
+
+ mRefreshBanListButton->setEnabled(TRUE);
+ mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) &&
+ gdatap->mBanList.size() < GB_MAX_BANNED_AGENTS);
+ setBanCount(gdatap->mBanList.size());
}
void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id)
{
- if(mBanList)
- mBanList->deleteAllItems();
+ if(mBanList)
+ mBanList->deleteAllItems();
- setFooterEnabled(FALSE);
- LLPanelGroupSubTab::setGroupID(id);
+ setFooterEnabled(FALSE);
+ LLPanelGroupSubTab::setGroupID(id);
}
diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h
index 459b77703f..da384032cf 100644
--- a/indra/newview/llpanelgrouproles.h
+++ b/indra/newview/llpanelgrouproles.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelgrouproles.h
* @brief Panel for roles information about a particular group.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,335 +45,335 @@ typedef std::map<std::string,std::string> icon_map_t;
class LLPanelGroupRoles : public LLPanelGroupTab
{
public:
- LLPanelGroupRoles();
- virtual ~LLPanelGroupRoles();
+ LLPanelGroupRoles();
+ virtual ~LLPanelGroupRoles();
+
+ // Allow sub tabs to ask for sibling controls.
+ friend class LLPanelGroupMembersSubTab;
+ friend class LLPanelGroupRolesSubTab;
+ friend class LLPanelGroupActionsSubTab;
+
+ virtual BOOL postBuild();
+ virtual BOOL isVisibleByAgent(LLAgent* agentp);
- // Allow sub tabs to ask for sibling controls.
- friend class LLPanelGroupMembersSubTab;
- friend class LLPanelGroupRolesSubTab;
- friend class LLPanelGroupActionsSubTab;
- virtual BOOL postBuild();
- virtual BOOL isVisibleByAgent(LLAgent* agentp);
+ bool handleSubTabSwitch(const LLSD& data);
-
- bool handleSubTabSwitch(const LLSD& data);
+ // Checks if the current tab needs to be applied, and tries to switch to the requested tab.
+ BOOL attemptTransition();
- // Checks if the current tab needs to be applied, and tries to switch to the requested tab.
- BOOL attemptTransition();
-
- // Switches to the requested tab (will close() if requested is NULL)
- void transitionToTab();
+ // Switches to the requested tab (will close() if requested is NULL)
+ void transitionToTab();
- // Used by attemptTransition to query the user's response to a tab that needs to apply.
- bool handleNotifyCallback(const LLSD& notification, const LLSD& response);
- bool onModalClose(const LLSD& notification, const LLSD& response);
+ // Used by attemptTransition to query the user's response to a tab that needs to apply.
+ bool handleNotifyCallback(const LLSD& notification, const LLSD& response);
+ bool onModalClose(const LLSD& notification, const LLSD& response);
- // Most of these messages are just passed on to the current sub-tab.
- virtual void activate();
- virtual void deactivate();
- virtual bool needsApply(std::string& mesg);
- virtual BOOL hasModal();
- virtual bool apply(std::string& mesg);
- virtual void cancel();
- virtual void update(LLGroupChange gc);
+ // Most of these messages are just passed on to the current sub-tab.
+ virtual void activate();
+ virtual void deactivate();
+ virtual bool needsApply(std::string& mesg);
+ virtual BOOL hasModal();
+ virtual bool apply(std::string& mesg);
+ virtual void cancel();
+ virtual void update(LLGroupChange gc);
- virtual void setGroupID(const LLUUID& id);
+ virtual void setGroupID(const LLUUID& id);
protected:
- LLPanelGroupTab* mCurrentTab;
- LLPanelGroupTab* mRequestedTab;
- LLTabContainer* mSubTabContainer;
- BOOL mFirstUse;
+ LLPanelGroupTab* mCurrentTab;
+ LLPanelGroupTab* mRequestedTab;
+ LLTabContainer* mSubTabContainer;
+ BOOL mFirstUse;
- std::string mDefaultNeedsApplyMesg;
- std::string mWantApplyMesg;
+ std::string mDefaultNeedsApplyMesg;
+ std::string mWantApplyMesg;
};
class LLPanelGroupSubTab : public LLPanelGroupTab
{
public:
- LLPanelGroupSubTab();
- virtual ~LLPanelGroupSubTab();
+ LLPanelGroupSubTab();
+ virtual ~LLPanelGroupSubTab();
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- // This allows sub-tabs to collect child widgets from a higher level in the view hierarchy.
- virtual BOOL postBuildSubTab(LLView* root);
+ // This allows sub-tabs to collect child widgets from a higher level in the view hierarchy.
+ virtual BOOL postBuildSubTab(LLView* root);
- virtual void setSearchFilter( const std::string& filter );
+ virtual void setSearchFilter( const std::string& filter );
- virtual void activate();
- virtual void deactivate();
+ virtual void activate();
+ virtual void deactivate();
- // Helper functions
- bool matchesActionSearchFilter(std::string action);
+ // Helper functions
+ bool matchesActionSearchFilter(std::string action);
- void setFooterEnabled(BOOL enable);
+ void setFooterEnabled(BOOL enable);
- virtual void setGroupID(const LLUUID& id);
+ virtual void setGroupID(const LLUUID& id);
protected:
- void buildActionsList(LLScrollListCtrl* ctrl,
- U64 allowed_by_some,
- U64 allowed_by_all,
- LLUICtrl::commit_callback_t commit_callback,
- BOOL show_all,
- BOOL filter,
- BOOL is_owner_role);
- void buildActionCategory(LLScrollListCtrl* ctrl,
- U64 allowed_by_some,
- U64 allowed_by_all,
- LLRoleActionSet* action_set,
- LLUICtrl::commit_callback_t commit_callback,
- BOOL show_all,
- BOOL filter,
- BOOL is_owner_role);
+ void buildActionsList(LLScrollListCtrl* ctrl,
+ U64 allowed_by_some,
+ U64 allowed_by_all,
+ LLUICtrl::commit_callback_t commit_callback,
+ BOOL show_all,
+ BOOL filter,
+ BOOL is_owner_role);
+ void buildActionCategory(LLScrollListCtrl* ctrl,
+ U64 allowed_by_some,
+ U64 allowed_by_all,
+ LLRoleActionSet* action_set,
+ LLUICtrl::commit_callback_t commit_callback,
+ BOOL show_all,
+ BOOL filter,
+ BOOL is_owner_role);
protected:
- LLPanel* mHeader; // Might not be present in xui of derived class (NULL)
- LLPanel* mFooter;
+ LLPanel* mHeader; // Might not be present in xui of derived class (NULL)
+ LLPanel* mFooter;
- LLFilterEditor* mSearchEditor;
+ LLFilterEditor* mSearchEditor;
- std::string mSearchFilter;
+ std::string mSearchFilter;
- icon_map_t mActionIcons;
+ icon_map_t mActionIcons;
- bool mActivated;
-
- bool mHasGroupBanPower; // Used to communicate between action sets due to the dependency between
- // GP_GROUP_BAN_ACCESS and GP_EJECT_MEMBER and GP_ROLE_REMOVE_MEMBER
-
- void setOthersVisible(BOOL b);
+ bool mActivated;
+
+ bool mHasGroupBanPower; // Used to communicate between action sets due to the dependency between
+ // GP_GROUP_BAN_ACCESS and GP_EJECT_MEMBER and GP_ROLE_REMOVE_MEMBER
+
+ void setOthersVisible(BOOL b);
};
class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab
{
public:
- LLPanelGroupMembersSubTab();
- virtual ~LLPanelGroupMembersSubTab();
+ LLPanelGroupMembersSubTab();
+ virtual ~LLPanelGroupMembersSubTab();
- virtual BOOL postBuildSubTab(LLView* root);
+ virtual BOOL postBuildSubTab(LLView* root);
- static void onMemberSelect(LLUICtrl*, void*);
- void handleMemberSelect();
+ static void onMemberSelect(LLUICtrl*, void*);
+ void handleMemberSelect();
- static void onMemberDoubleClick(void*);
- void handleMemberDoubleClick();
+ static void onMemberDoubleClick(void*);
+ void handleMemberDoubleClick();
- static void onInviteMember(void*);
- void handleInviteMember();
+ static void onInviteMember(void*);
+ void handleInviteMember();
- static void onEjectMembers(void*);
- void handleEjectMembers();
- void sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members);
- bool handleEjectCallback(const LLSD& notification, const LLSD& response);
- void confirmEjectMembers();
+ static void onEjectMembers(void*);
+ void handleEjectMembers();
+ void sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members);
+ bool handleEjectCallback(const LLSD& notification, const LLSD& response);
+ void confirmEjectMembers();
- static void onRoleCheck(LLUICtrl* check, void* user_data);
- void handleRoleCheck(const LLUUID& role_id,
- LLRoleMemberChangeType type);
+ static void onRoleCheck(LLUICtrl* check, void* user_data);
+ void handleRoleCheck(const LLUUID& role_id,
+ LLRoleMemberChangeType type);
- static void onBanMember(void* user_data);
- void handleBanMember();
- bool handleBanCallback(const LLSD& notification, const LLSD& response);
- void confirmBanMembers();
+ static void onBanMember(void* user_data);
+ void handleBanMember();
+ bool handleBanCallback(const LLSD& notification, const LLSD& response);
+ void confirmBanMembers();
- void updateActionDescription();
+ void updateActionDescription();
- void applyMemberChanges();
- bool addOwnerCB(const LLSD& notification, const LLSD& response);
+ void applyMemberChanges();
+ bool addOwnerCB(const LLSD& notification, const LLSD& response);
- virtual void activate();
- virtual void deactivate();
- virtual void cancel();
- virtual bool needsApply(std::string& mesg);
- virtual bool apply(std::string& mesg);
- virtual void update(LLGroupChange gc);
- void updateMembers();
+ virtual void activate();
+ virtual void deactivate();
+ virtual void cancel();
+ virtual bool needsApply(std::string& mesg);
+ virtual bool apply(std::string& mesg);
+ virtual void update(LLGroupChange gc);
+ void updateMembers();
- virtual void draw();
+ virtual void draw();
- virtual void setGroupID(const LLUUID& id);
+ virtual void setGroupID(const LLUUID& id);
- void addMemberToList(LLGroupMemberData* data);
- void onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name, const LLUUID& av_id);
+ void addMemberToList(LLGroupMemberData* data);
+ void onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name, const LLUUID& av_id);
protected:
- typedef std::map<LLUUID, LLRoleMemberChangeType> role_change_data_map_t;
- typedef std::map<LLUUID, role_change_data_map_t*> member_role_changes_map_t;
+ typedef std::map<LLUUID, LLRoleMemberChangeType> role_change_data_map_t;
+ typedef std::map<LLUUID, role_change_data_map_t*> member_role_changes_map_t;
- bool matchesSearchFilter(const std::string& fullname);
+ bool matchesSearchFilter(const std::string& fullname);
- U64 getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id);
- bool getRoleChangeType(const LLUUID& member_id,
- const LLUUID& role_id,
- LLRoleMemberChangeType& type);
+ U64 getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id);
+ bool getRoleChangeType(const LLUUID& member_id,
+ const LLUUID& role_id,
+ LLRoleMemberChangeType& type);
- LLNameListCtrl* mMembersList;
- LLScrollListCtrl* mAssignedRolesList;
- LLScrollListCtrl* mAllowedActionsList;
- LLButton* mEjectBtn;
- LLButton* mBanBtn;
+ LLNameListCtrl* mMembersList;
+ LLScrollListCtrl* mAssignedRolesList;
+ LLScrollListCtrl* mAllowedActionsList;
+ LLButton* mEjectBtn;
+ LLButton* mBanBtn;
- BOOL mChanged;
- BOOL mPendingMemberUpdate;
- BOOL mHasMatch;
+ BOOL mChanged;
+ BOOL mPendingMemberUpdate;
+ BOOL mHasMatch;
- LLTextEditor* mActionDescription;
+ LLTextEditor* mActionDescription;
- member_role_changes_map_t mMemberRoleChangeData;
- U32 mNumOwnerAdditions;
+ member_role_changes_map_t mMemberRoleChangeData;
+ U32 mNumOwnerAdditions;
- LLGroupMgrGroupData::member_list_t::iterator mMemberProgress;
- typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
- avatar_name_cache_connection_map_t mAvatarNameCacheConnections;
+ LLGroupMgrGroupData::member_list_t::iterator mMemberProgress;
+ typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
+ avatar_name_cache_connection_map_t mAvatarNameCacheConnections;
};
class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab
{
public:
- LLPanelGroupRolesSubTab();
- virtual ~LLPanelGroupRolesSubTab();
+ LLPanelGroupRolesSubTab();
+ virtual ~LLPanelGroupRolesSubTab();
+
+ virtual BOOL postBuildSubTab(LLView* root);
- virtual BOOL postBuildSubTab(LLView* root);
+ virtual void activate();
+ virtual void deactivate();
+ virtual bool needsApply(std::string& mesg);
+ virtual bool apply(std::string& mesg);
+ virtual void cancel();
+ bool matchesSearchFilter(std::string rolename, std::string roletitle);
+ virtual void update(LLGroupChange gc);
- virtual void activate();
- virtual void deactivate();
- virtual bool needsApply(std::string& mesg);
- virtual bool apply(std::string& mesg);
- virtual void cancel();
- bool matchesSearchFilter(std::string rolename, std::string roletitle);
- virtual void update(LLGroupChange gc);
+ static void onRoleSelect(LLUICtrl*, void*);
+ void handleRoleSelect();
+ void buildMembersList();
- static void onRoleSelect(LLUICtrl*, void*);
- void handleRoleSelect();
- void buildMembersList();
+ static void onActionCheck(LLUICtrl*, void*);
+ bool addActionCB(const LLSD& notification, const LLSD& response, LLCheckBoxCtrl* check);
- static void onActionCheck(LLUICtrl*, void*);
- bool addActionCB(const LLSD& notification, const LLSD& response, LLCheckBoxCtrl* check);
-
- static void onPropertiesKey(LLLineEditor*, void*);
+ static void onPropertiesKey(LLLineEditor*, void*);
- void onDescriptionKeyStroke(LLTextEditor* caller);
+ void onDescriptionKeyStroke(LLTextEditor* caller);
- static void onDescriptionCommit(LLUICtrl*, void*);
+ static void onDescriptionCommit(LLUICtrl*, void*);
- static void onMemberVisibilityChange(LLUICtrl*, void*);
- void handleMemberVisibilityChange(bool value);
+ static void onMemberVisibilityChange(LLUICtrl*, void*);
+ void handleMemberVisibilityChange(bool value);
- static void onCreateRole(void*);
- void handleCreateRole();
+ static void onCreateRole(void*);
+ void handleCreateRole();
- static void onCopyRole(void*);
- void handleCopyRole();
+ static void onCopyRole(void*);
+ void handleCopyRole();
- static void onDeleteRole(void*);
- void handleDeleteRole();
+ static void onDeleteRole(void*);
+ void handleDeleteRole();
- void updateActionDescription();
+ void updateActionDescription();
- void saveRoleChanges(bool select_saved_role);
+ void saveRoleChanges(bool select_saved_role);
- virtual void setGroupID(const LLUUID& id);
+ virtual void setGroupID(const LLUUID& id);
- BOOL mFirstOpen;
+ BOOL mFirstOpen;
protected:
- void handleActionCheck(LLUICtrl* ctrl, bool force);
- LLSD createRoleItem(const LLUUID& role_id, std::string name, std::string title, S32 members);
-
- LLScrollListCtrl* mRolesList;
- LLNameListCtrl* mAssignedMembersList;
- LLScrollListCtrl* mAllowedActionsList;
- LLTextEditor* mActionDescription;
-
- LLLineEditor* mRoleName;
- LLLineEditor* mRoleTitle;
- LLTextEditor* mRoleDescription;
-
- LLCheckBoxCtrl* mMemberVisibleCheck;
- LLButton* mDeleteRoleButton;
- LLButton* mCreateRoleButton;
- LLButton* mCopyRoleButton;
-
- LLUUID mSelectedRole;
- BOOL mHasRoleChange;
- std::string mRemoveEveryoneTxt;
+ void handleActionCheck(LLUICtrl* ctrl, bool force);
+ LLSD createRoleItem(const LLUUID& role_id, std::string name, std::string title, S32 members);
+
+ LLScrollListCtrl* mRolesList;
+ LLNameListCtrl* mAssignedMembersList;
+ LLScrollListCtrl* mAllowedActionsList;
+ LLTextEditor* mActionDescription;
+
+ LLLineEditor* mRoleName;
+ LLLineEditor* mRoleTitle;
+ LLTextEditor* mRoleDescription;
+
+ LLCheckBoxCtrl* mMemberVisibleCheck;
+ LLButton* mDeleteRoleButton;
+ LLButton* mCreateRoleButton;
+ LLButton* mCopyRoleButton;
+
+ LLUUID mSelectedRole;
+ BOOL mHasRoleChange;
+ std::string mRemoveEveryoneTxt;
};
class LLPanelGroupActionsSubTab : public LLPanelGroupSubTab
{
public:
- LLPanelGroupActionsSubTab();
- virtual ~LLPanelGroupActionsSubTab();
+ LLPanelGroupActionsSubTab();
+ virtual ~LLPanelGroupActionsSubTab();
- virtual BOOL postBuildSubTab(LLView* root);
+ virtual BOOL postBuildSubTab(LLView* root);
- virtual void activate();
- virtual void deactivate();
- virtual bool needsApply(std::string& mesg);
- virtual bool apply(std::string& mesg);
- virtual void update(LLGroupChange gc);
- virtual void onFilterChanged();
+ virtual void activate();
+ virtual void deactivate();
+ virtual bool needsApply(std::string& mesg);
+ virtual bool apply(std::string& mesg);
+ virtual void update(LLGroupChange gc);
+ virtual void onFilterChanged();
- void handleActionSelect();
+ void handleActionSelect();
- virtual void setGroupID(const LLUUID& id);
+ virtual void setGroupID(const LLUUID& id);
protected:
- LLScrollListCtrl* mActionList;
- LLScrollListCtrl* mActionRoles;
- LLNameListCtrl* mActionMembers;
+ LLScrollListCtrl* mActionList;
+ LLScrollListCtrl* mActionRoles;
+ LLNameListCtrl* mActionMembers;
- LLTextEditor* mActionDescription;
+ LLTextEditor* mActionDescription;
};
class LLPanelGroupBanListSubTab : public LLPanelGroupSubTab
{
public:
- LLPanelGroupBanListSubTab();
- virtual ~LLPanelGroupBanListSubTab() {}
+ LLPanelGroupBanListSubTab();
+ virtual ~LLPanelGroupBanListSubTab() {}
+
+ virtual BOOL postBuildSubTab(LLView* root);
+
+ virtual void activate();
+ virtual void update(LLGroupChange gc);
+ virtual void draw();
- virtual BOOL postBuildSubTab(LLView* root);
+ static void onBanEntrySelect(LLUICtrl* ctrl, void* user_data);
+ void handleBanEntrySelect();
- virtual void activate();
- virtual void update(LLGroupChange gc);
- virtual void draw();
+ static void onCreateBanEntry(void* user_data);
+ void handleCreateBanEntry();
- static void onBanEntrySelect(LLUICtrl* ctrl, void* user_data);
- void handleBanEntrySelect();
-
- static void onCreateBanEntry(void* user_data);
- void handleCreateBanEntry();
-
- static void onDeleteBanEntry(void* user_data);
- void handleDeleteBanEntry();
+ static void onDeleteBanEntry(void* user_data);
+ void handleDeleteBanEntry();
- static void onRefreshBanList(void* user_data);
- void handleRefreshBanList();
+ static void onRefreshBanList(void* user_data);
+ void handleRefreshBanList();
- void onBanListCompleted(bool isComplete);
+ void onBanListCompleted(bool isComplete);
protected:
- void setBanCount(U32 ban_count);
- void populateBanList();
+ void setBanCount(U32 ban_count);
+ void populateBanList();
public:
- virtual void setGroupID(const LLUUID& id);
+ virtual void setGroupID(const LLUUID& id);
protected:
- LLNameListCtrl* mBanList;
- LLButton* mCreateBanButton;
- LLButton* mDeleteBanButton;
- LLButton* mRefreshBanListButton;
- LLTextBase* mBanCountText;
+ LLNameListCtrl* mBanList;
+ LLButton* mCreateBanButton;
+ LLButton* mDeleteBanButton;
+ LLButton* mRefreshBanListButton;
+ LLTextBase* mBanCountText;
};
diff --git a/indra/newview/llpanelhome.cpp b/indra/newview/llpanelhome.cpp
index ab0ccffae4..bce7ea2c00 100644
--- a/indra/newview/llpanelhome.cpp
+++ b/indra/newview/llpanelhome.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelhome.cpp
* @author Martin Reddy
* @brief The Home side tray panel
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,35 +34,35 @@
static LLPanelInjector<LLPanelHome> t_home("panel_sidetray_home");
LLPanelHome::LLPanelHome() :
- LLPanel(),
- LLViewerMediaObserver(),
- mBrowser(NULL),
- mFirstView(true)
+ LLPanel(),
+ LLViewerMediaObserver(),
+ mBrowser(NULL),
+ mFirstView(true)
{
}
void LLPanelHome::onOpen(const LLSD& key)
{
- // display the home page the first time we open the panel
- // *NOTE: this seems to happen during login. Can we avoid that?
- if (mFirstView && mBrowser)
- {
- mBrowser->navigateHome();
- }
- mFirstView = false;
+ // display the home page the first time we open the panel
+ // *NOTE: this seems to happen during login. Can we avoid that?
+ if (mFirstView && mBrowser)
+ {
+ mBrowser->navigateHome();
+ }
+ mFirstView = false;
}
BOOL LLPanelHome::postBuild()
{
mBrowser = getChild<LLMediaCtrl>("browser");
if (mBrowser)
- {
- // read the URL to display from settings.xml
- std::string url = LLViewerHome::getHomeURL();
+ {
+ // read the URL to display from settings.xml
+ std::string url = LLViewerHome::getHomeURL();
- mBrowser->addObserver(this);
- mBrowser->setHomePageUrl(url);
- }
+ mBrowser->addObserver(this);
+ mBrowser->setHomePageUrl(url);
+ }
return TRUE;
}
diff --git a/indra/newview/llpanelhome.h b/indra/newview/llpanelhome.h
index 748566326f..bdb65eb17b 100644
--- a/indra/newview/llpanelhome.h
+++ b/indra/newview/llpanelhome.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelhome.h
* @author Martin Reddy
* @brief The Home side tray panel
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,21 +38,21 @@ class LLMediaCtrl;
* Base class for web-based Home side tray
*/
class LLPanelHome :
- public LLPanel,
- public LLViewerMediaObserver
+ public LLPanel,
+ public LLViewerMediaObserver
{
public:
- LLPanelHome();
+ LLPanelHome();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
private:
- // inherited from LLViewerMediaObserver
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event);
+ // inherited from LLViewerMediaObserver
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event);
LLMediaCtrl *mBrowser;
- bool mFirstView;
+ bool mFirstView;
};
#endif //LL_LLPANELHOME_H
diff --git a/indra/newview/llpanelimcontrolpanel.h b/indra/newview/llpanelimcontrolpanel.h
index 02915ec4bb..c7f5263bec 100644
--- a/indra/newview/llpanelimcontrolpanel.h
+++ b/indra/newview/llpanelimcontrolpanel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelimcontrolpanel.h
* @brief LLPanelIMControlPanel and related class definitions
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,51 +33,51 @@
class LLParticipantList;
class LLPanelChatControlPanel
- : public LLPanel
+ : public LLPanel
{
public:
- LLPanelChatControlPanel() :
- mSessionId(LLUUID()) {};
- ~LLPanelChatControlPanel();
+ LLPanelChatControlPanel() :
+ mSessionId(LLUUID()) {};
+ ~LLPanelChatControlPanel();
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- virtual void setSessionId(const LLUUID& session_id);
- const LLUUID& getSessionId() { return mSessionId; }
+ virtual void setSessionId(const LLUUID& session_id);
+ const LLUUID& getSessionId() { return mSessionId; }
private:
- LLUUID mSessionId;
+ LLUUID mSessionId;
- // connection to voice channel state change signal
- boost::signals2::connection mVoiceChannelStateChangeConnection;
+ // connection to voice channel state change signal
+ boost::signals2::connection mVoiceChannelStateChangeConnection;
};
class LLPanelGroupControlPanel : public LLPanelChatControlPanel
{
public:
- LLPanelGroupControlPanel(const LLUUID& session_id);
- ~LLPanelGroupControlPanel();
+ LLPanelGroupControlPanel(const LLUUID& session_id);
+ ~LLPanelGroupControlPanel();
- BOOL postBuild();
+ BOOL postBuild();
- void setSessionId(const LLUUID& session_id);
- /*virtual*/ void draw();
+ void setSessionId(const LLUUID& session_id);
+ /*virtual*/ void draw();
protected:
- LLUUID mGroupID;
+ LLUUID mGroupID;
- LLParticipantList* mParticipantList;
+ LLParticipantList* mParticipantList;
private:
- void onSortMenuItemClicked(const LLSD& userdata);
+ void onSortMenuItemClicked(const LLSD& userdata);
};
class LLPanelAdHocControlPanel : public LLPanelGroupControlPanel
{
public:
- LLPanelAdHocControlPanel(const LLUUID& session_id);
+ LLPanelAdHocControlPanel(const LLUUID& session_id);
- BOOL postBuild();
+ BOOL postBuild();
};
diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp
index acdb16f432..ea0114afe7 100644
--- a/indra/newview/llpanelland.cpp
+++ b/indra/newview/llpanelland.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelland.cpp
* @brief Land information in the tool floater, NOT the "About Land" floater
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,41 +50,41 @@ LLPanelLandInfo* LLPanelLandInfo::sInstance = NULL;
class LLPanelLandSelectObserver : public LLParcelObserver
{
public:
- LLPanelLandSelectObserver() {}
- virtual ~LLPanelLandSelectObserver() {}
- virtual void changed() { LLPanelLandInfo::refreshAll(); }
+ LLPanelLandSelectObserver() {}
+ virtual ~LLPanelLandSelectObserver() {}
+ virtual void changed() { LLPanelLandInfo::refreshAll(); }
};
-BOOL LLPanelLandInfo::postBuild()
+BOOL LLPanelLandInfo::postBuild()
{
- childSetAction("button buy land",boost::bind(onClickClaim));
- childSetAction("button abandon land", boost::bind(onClickRelease));
- childSetAction("button subdivide land", boost::bind(onClickDivide));
- childSetAction("button join land", boost::bind(onClickJoin));
- childSetAction("button about land", boost::bind(onClickAbout));
+ childSetAction("button buy land",boost::bind(onClickClaim));
+ childSetAction("button abandon land", boost::bind(onClickRelease));
+ childSetAction("button subdivide land", boost::bind(onClickDivide));
+ childSetAction("button join land", boost::bind(onClickJoin));
+ childSetAction("button about land", boost::bind(onClickAbout));
- mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners");
- getChild<LLUICtrl>("checkbox show owners")->setValue(gSavedSettings.getBOOL("ShowParcelOwners"));
+ mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners");
+ getChild<LLUICtrl>("checkbox show owners")->setValue(gSavedSettings.getBOOL("ShowParcelOwners"));
- return TRUE;
+ return TRUE;
}
//
// Methods
//
LLPanelLandInfo::LLPanelLandInfo()
-: LLPanel(),
- mCheckShowOwners(NULL)
+: LLPanel(),
+ mCheckShowOwners(NULL)
{
- if (!sInstance)
- {
- sInstance = this;
- }
- if (!sObserver)
- {
- sObserver = new LLPanelLandSelectObserver();
- LLViewerParcelMgr::getInstance()->addObserver( sObserver );
- }
+ if (!sInstance)
+ {
+ sInstance = this;
+ }
+ if (!sObserver)
+ {
+ sObserver = new LLPanelLandSelectObserver();
+ LLViewerParcelMgr::getInstance()->addObserver( sObserver );
+ }
}
@@ -92,168 +92,168 @@ LLPanelLandInfo::LLPanelLandInfo()
// virtual
LLPanelLandInfo::~LLPanelLandInfo()
{
- LLViewerParcelMgr::getInstance()->removeObserver( sObserver );
- delete sObserver;
- sObserver = NULL;
+ LLViewerParcelMgr::getInstance()->removeObserver( sObserver );
+ delete sObserver;
+ sObserver = NULL;
- sInstance = NULL;
+ sInstance = NULL;
}
// static
void LLPanelLandInfo::refreshAll()
{
- if (sInstance)
- {
- sInstance->refresh();
- }
+ if (sInstance)
+ {
+ sInstance->refresh();
+ }
}
// public
void LLPanelLandInfo::refresh()
{
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
- LLViewerRegion *regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
-
- if (!parcel || !regionp)
- {
- // nothing selected, disable panel
- getChildView("label_area_price")->setVisible(false);
- getChildView("label_area")->setVisible(false);
-
- //mTextPrice->setText(LLStringUtil::null);
- getChild<LLUICtrl>("textbox price")->setValue(LLStringUtil::null);
-
- getChildView("button buy land")->setEnabled(FALSE);
- getChildView("button abandon land")->setEnabled(FALSE);
- getChildView("button subdivide land")->setEnabled(FALSE);
- getChildView("button join land")->setEnabled(FALSE);
- getChildView("button about land")->setEnabled(FALSE);
- }
- else
- {
- // something selected, hooray!
- const LLUUID& owner_id = parcel->getOwnerID();
- const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
-
- BOOL is_public = parcel->isPublic();
- BOOL is_for_sale = parcel->getForSale()
- && ((parcel->getSalePrice() > 0) || (auth_buyer_id.notNull()));
- BOOL can_buy = (is_for_sale
- && (owner_id != gAgent.getID())
- && ((gAgent.getID() == auth_buyer_id)
- || (auth_buyer_id.isNull())));
-
- if (is_public && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getMultipleOwners())
- {
- getChildView("button buy land")->setEnabled(TRUE);
- }
- else
- {
- getChildView("button buy land")->setEnabled(can_buy);
- }
-
- BOOL owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE);
- BOOL owner_divide = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_DIVIDE_JOIN);
-
- BOOL manager_releaseable = ( gAgent.canManageEstate()
- && (parcel->getOwnerID() == regionp->getOwner()) );
-
- BOOL manager_divideable = ( gAgent.canManageEstate()
- && ((parcel->getOwnerID() == regionp->getOwner()) || owner_divide) );
-
- getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike());
-
- // only mainland sims are subdividable by owner
- if (regionp->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
- {
- getChildView("button subdivide land")->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike());
- }
- else
- {
- getChildView("button subdivide land")->setEnabled(manager_divideable || gAgent.isGodlike());
- }
-
- // To join land, must have something selected,
- // not just a single unit of land,
- // you must own part of it,
- // and it must not be a whole parcel.
- if (LLViewerParcelMgr::getInstance()->getSelectedArea() > PARCEL_UNIT_AREA
- //&& LLViewerParcelMgr::getInstance()->getSelfCount() > 1
- && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())
- {
- getChildView("button join land")->setEnabled(TRUE);
- }
- else
- {
- LL_DEBUGS() << "Invalid selection for joining land" << LL_ENDL;
- getChildView("button join land")->setEnabled(FALSE);
- }
-
- getChildView("button about land")->setEnabled(TRUE);
-
- // show pricing information
- S32 area;
- S32 claim_price;
- S32 rent_price;
- BOOL for_sale;
- F32 dwell;
- LLViewerParcelMgr::getInstance()->getDisplayInfo(&area,
- &claim_price,
- &rent_price,
- &for_sale,
- &dwell);
- if(is_public || (is_for_sale && LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()))
- {
- getChild<LLUICtrl>("label_area_price")->setTextArg("[PRICE]", llformat("%d",claim_price));
- getChild<LLUICtrl>("label_area_price")->setTextArg("[AREA]", llformat("%d",area));
- getChildView("label_area_price")->setVisible(true);
- getChildView("label_area")->setVisible(false);
- }
- else
- {
- getChildView("label_area_price")->setVisible(false);
- getChild<LLUICtrl>("label_area")->setTextArg("[AREA]", llformat("%d",area));
- getChildView("label_area")->setVisible(true);
- }
- }
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+ LLViewerRegion *regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+
+ if (!parcel || !regionp)
+ {
+ // nothing selected, disable panel
+ getChildView("label_area_price")->setVisible(false);
+ getChildView("label_area")->setVisible(false);
+
+ //mTextPrice->setText(LLStringUtil::null);
+ getChild<LLUICtrl>("textbox price")->setValue(LLStringUtil::null);
+
+ getChildView("button buy land")->setEnabled(FALSE);
+ getChildView("button abandon land")->setEnabled(FALSE);
+ getChildView("button subdivide land")->setEnabled(FALSE);
+ getChildView("button join land")->setEnabled(FALSE);
+ getChildView("button about land")->setEnabled(FALSE);
+ }
+ else
+ {
+ // something selected, hooray!
+ const LLUUID& owner_id = parcel->getOwnerID();
+ const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
+
+ BOOL is_public = parcel->isPublic();
+ BOOL is_for_sale = parcel->getForSale()
+ && ((parcel->getSalePrice() > 0) || (auth_buyer_id.notNull()));
+ BOOL can_buy = (is_for_sale
+ && (owner_id != gAgent.getID())
+ && ((gAgent.getID() == auth_buyer_id)
+ || (auth_buyer_id.isNull())));
+
+ if (is_public && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getMultipleOwners())
+ {
+ getChildView("button buy land")->setEnabled(TRUE);
+ }
+ else
+ {
+ getChildView("button buy land")->setEnabled(can_buy);
+ }
+
+ BOOL owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE);
+ BOOL owner_divide = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_DIVIDE_JOIN);
+
+ BOOL manager_releaseable = ( gAgent.canManageEstate()
+ && (parcel->getOwnerID() == regionp->getOwner()) );
+
+ BOOL manager_divideable = ( gAgent.canManageEstate()
+ && ((parcel->getOwnerID() == regionp->getOwner()) || owner_divide) );
+
+ getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike());
+
+ // only mainland sims are subdividable by owner
+ if (regionp->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
+ {
+ getChildView("button subdivide land")->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike());
+ }
+ else
+ {
+ getChildView("button subdivide land")->setEnabled(manager_divideable || gAgent.isGodlike());
+ }
+
+ // To join land, must have something selected,
+ // not just a single unit of land,
+ // you must own part of it,
+ // and it must not be a whole parcel.
+ if (LLViewerParcelMgr::getInstance()->getSelectedArea() > PARCEL_UNIT_AREA
+ //&& LLViewerParcelMgr::getInstance()->getSelfCount() > 1
+ && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())
+ {
+ getChildView("button join land")->setEnabled(TRUE);
+ }
+ else
+ {
+ LL_DEBUGS() << "Invalid selection for joining land" << LL_ENDL;
+ getChildView("button join land")->setEnabled(FALSE);
+ }
+
+ getChildView("button about land")->setEnabled(TRUE);
+
+ // show pricing information
+ S32 area;
+ S32 claim_price;
+ S32 rent_price;
+ BOOL for_sale;
+ F32 dwell;
+ LLViewerParcelMgr::getInstance()->getDisplayInfo(&area,
+ &claim_price,
+ &rent_price,
+ &for_sale,
+ &dwell);
+ if(is_public || (is_for_sale && LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()))
+ {
+ getChild<LLUICtrl>("label_area_price")->setTextArg("[PRICE]", llformat("%d",claim_price));
+ getChild<LLUICtrl>("label_area_price")->setTextArg("[AREA]", llformat("%d",area));
+ getChildView("label_area_price")->setVisible(true);
+ getChildView("label_area")->setVisible(false);
+ }
+ else
+ {
+ getChildView("label_area_price")->setVisible(false);
+ getChild<LLUICtrl>("label_area")->setTextArg("[AREA]", llformat("%d",area));
+ getChildView("label_area")->setVisible(true);
+ }
+ }
}
//static
void LLPanelLandInfo::onClickClaim()
{
- LLViewerParcelMgr::getInstance()->startBuyLand();
+ LLViewerParcelMgr::getInstance()->startBuyLand();
}
//static
void LLPanelLandInfo::onClickRelease()
{
- LLViewerParcelMgr::getInstance()->startReleaseLand();
+ LLViewerParcelMgr::getInstance()->startReleaseLand();
}
// static
void LLPanelLandInfo::onClickDivide()
{
- LLViewerParcelMgr::getInstance()->startDivideLand();
+ LLViewerParcelMgr::getInstance()->startDivideLand();
}
// static
void LLPanelLandInfo::onClickJoin()
{
- LLViewerParcelMgr::getInstance()->startJoinLand();
+ LLViewerParcelMgr::getInstance()->startJoinLand();
}
//static
void LLPanelLandInfo::onClickAbout()
{
- // Promote the rectangle selection to a parcel selection
- if (!LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())
- {
- LLViewerParcelMgr::getInstance()->selectParcelInRectangle();
- }
+ // Promote the rectangle selection to a parcel selection
+ if (!LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())
+ {
+ LLViewerParcelMgr::getInstance()->selectParcelInRectangle();
+ }
- LLFloaterReg::showInstance("about_land");
+ LLFloaterReg::showInstance("about_land");
}
diff --git a/indra/newview/llpanelland.h b/indra/newview/llpanelland.h
index 2ab1618d47..0beb579cd6 100644
--- a/indra/newview/llpanelland.h
+++ b/indra/newview/llpanelland.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelland.h
* @brief Land information in the tool floater, NOT the "About Land" floater
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,29 +37,29 @@ class LLLineEditor;
class LLPanelLandSelectObserver;
class LLPanelLandInfo
-: public LLPanel
+: public LLPanel
{
public:
- LLPanelLandInfo();
- virtual ~LLPanelLandInfo();
+ LLPanelLandInfo();
+ virtual ~LLPanelLandInfo();
+
+ void refresh();
+ static void refreshAll();
- void refresh();
- static void refreshAll();
-
- LLCheckBoxCtrl *mCheckShowOwners;
+ LLCheckBoxCtrl *mCheckShowOwners;
protected:
- static void onClickClaim();
- static void onClickRelease();
- static void onClickDivide();
- static void onClickJoin();
- static void onClickAbout();
+ static void onClickClaim();
+ static void onClickRelease();
+ static void onClickDivide();
+ static void onClickJoin();
+ static void onClickAbout();
protected:
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- static LLPanelLandSelectObserver* sObserver;
- static LLPanelLandInfo* sInstance;
+ static LLPanelLandSelectObserver* sObserver;
+ static LLPanelLandInfo* sInstance;
};
#endif
diff --git a/indra/newview/llpanellandaudio.cpp b/indra/newview/llpanellandaudio.cpp
index 9e3fc54477..bad9c651a2 100644
--- a/indra/newview/llpanellandaudio.cpp
+++ b/indra/newview/llpanellandaudio.cpp
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,9 +53,9 @@
// Values for the parcel voice settings radio group
enum
{
- kRadioVoiceChatEstate = 0,
- kRadioVoiceChatPrivate = 1,
- kRadioVoiceChatDisable = 2
+ kRadioVoiceChatEstate = 0,
+ kRadioVoiceChatPrivate = 1,
+ kRadioVoiceChatDisable = 2
};
//---------------------------------------------------------------------------
@@ -63,7 +63,7 @@ enum
//---------------------------------------------------------------------------
LLPanelLandAudio::LLPanelLandAudio(LLParcelSelectionHandle& parcel)
-: LLPanel(/*std::string("land_media_panel")*/), mParcel(parcel)
+: LLPanel(/*std::string("land_media_panel")*/), mParcel(parcel)
{
}
@@ -76,137 +76,137 @@ LLPanelLandAudio::~LLPanelLandAudio()
BOOL LLPanelLandAudio::postBuild()
{
- mCheckSoundLocal = getChild<LLCheckBoxCtrl>("check sound local");
- childSetCommitCallback("check sound local", onCommitAny, this);
+ mCheckSoundLocal = getChild<LLCheckBoxCtrl>("check sound local");
+ childSetCommitCallback("check sound local", onCommitAny, this);
- mCheckParcelEnableVoice = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel");
- childSetCommitCallback("parcel_enable_voice_channel", onCommitAny, this);
+ mCheckParcelEnableVoice = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel");
+ childSetCommitCallback("parcel_enable_voice_channel", onCommitAny, this);
- // This one is always disabled so no need for a commit callback
- mCheckEstateDisabledVoice = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel_is_estate_disabled");
+ // This one is always disabled so no need for a commit callback
+ mCheckEstateDisabledVoice = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel_is_estate_disabled");
- mCheckParcelVoiceLocal = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel_local");
- childSetCommitCallback("parcel_enable_voice_channel_local", onCommitAny, this);
+ mCheckParcelVoiceLocal = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel_local");
+ childSetCommitCallback("parcel_enable_voice_channel_local", onCommitAny, this);
- mMusicURLEdit = getChild<LLLineEditor>("music_url");
- childSetCommitCallback("music_url", onCommitAny, this);
+ mMusicURLEdit = getChild<LLLineEditor>("music_url");
+ childSetCommitCallback("music_url", onCommitAny, this);
- mCheckAVSoundAny = getChild<LLCheckBoxCtrl>("all av sound check");
- childSetCommitCallback("all av sound check", onCommitAny, this);
+ mCheckAVSoundAny = getChild<LLCheckBoxCtrl>("all av sound check");
+ childSetCommitCallback("all av sound check", onCommitAny, this);
- mCheckAVSoundGroup = getChild<LLCheckBoxCtrl>("group av sound check");
- childSetCommitCallback("group av sound check", onCommitAny, this);
+ mCheckAVSoundGroup = getChild<LLCheckBoxCtrl>("group av sound check");
+ childSetCommitCallback("group av sound check", onCommitAny, this);
mCheckObscureMOAP = getChild<LLCheckBoxCtrl>("obscure_moap");
childSetCommitCallback("obscure_moap", onCommitAny, this);
- return TRUE;
+ return TRUE;
}
// public
void LLPanelLandAudio::refresh()
{
- LLParcel *parcel = mParcel->getParcel();
+ LLParcel *parcel = mParcel->getParcel();
- if (!parcel)
- {
- clearCtrls();
- }
- else
- {
- // something selected, hooray!
+ if (!parcel)
+ {
+ clearCtrls();
+ }
+ else
+ {
+ // something selected, hooray!
- // Display options
- BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA);
+ // Display options
+ BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA);
- mCheckSoundLocal->set( parcel->getSoundLocal() );
- mCheckSoundLocal->setEnabled( can_change_media );
+ mCheckSoundLocal->set( parcel->getSoundLocal() );
+ mCheckSoundLocal->setEnabled( can_change_media );
- bool allow_voice = parcel->getParcelFlagAllowVoice();
+ bool allow_voice = parcel->getParcelFlagAllowVoice();
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (region && region->isVoiceEnabled())
- {
- mCheckEstateDisabledVoice->setVisible(false);
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (region && region->isVoiceEnabled())
+ {
+ mCheckEstateDisabledVoice->setVisible(false);
- mCheckParcelEnableVoice->setVisible(true);
- mCheckParcelEnableVoice->setEnabled( can_change_media );
- mCheckParcelEnableVoice->set(allow_voice);
+ mCheckParcelEnableVoice->setVisible(true);
+ mCheckParcelEnableVoice->setEnabled( can_change_media );
+ mCheckParcelEnableVoice->set(allow_voice);
- mCheckParcelVoiceLocal->setEnabled( can_change_media && allow_voice );
- }
- else
- {
- // Voice disabled at estate level, overrides parcel settings
- // Replace the parcel voice checkbox with a disabled one
- // labelled with an explanatory message
- mCheckEstateDisabledVoice->setVisible(true);
+ mCheckParcelVoiceLocal->setEnabled( can_change_media && allow_voice );
+ }
+ else
+ {
+ // Voice disabled at estate level, overrides parcel settings
+ // Replace the parcel voice checkbox with a disabled one
+ // labelled with an explanatory message
+ mCheckEstateDisabledVoice->setVisible(true);
- mCheckParcelEnableVoice->setVisible(false);
- mCheckParcelEnableVoice->setEnabled(false);
- mCheckParcelVoiceLocal->setEnabled(false);
- }
+ mCheckParcelEnableVoice->setVisible(false);
+ mCheckParcelEnableVoice->setEnabled(false);
+ mCheckParcelVoiceLocal->setEnabled(false);
+ }
- mCheckParcelEnableVoice->set(allow_voice);
- mCheckParcelVoiceLocal->set(!parcel->getParcelFlagUseEstateVoiceChannel());
+ mCheckParcelEnableVoice->set(allow_voice);
+ mCheckParcelVoiceLocal->set(!parcel->getParcelFlagUseEstateVoiceChannel());
- mMusicURLEdit->setText(parcel->getMusicURL());
- mMusicURLEdit->setEnabled( can_change_media );
+ mMusicURLEdit->setText(parcel->getMusicURL());
+ mMusicURLEdit->setEnabled( can_change_media );
- BOOL can_change_av_sounds = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS) && parcel->getHaveNewParcelLimitData();
- mCheckAVSoundAny->set(parcel->getAllowAnyAVSounds());
- mCheckAVSoundAny->setEnabled(can_change_av_sounds);
+ BOOL can_change_av_sounds = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS) && parcel->getHaveNewParcelLimitData();
+ mCheckAVSoundAny->set(parcel->getAllowAnyAVSounds());
+ mCheckAVSoundAny->setEnabled(can_change_av_sounds);
- mCheckAVSoundGroup->set(parcel->getAllowGroupAVSounds() || parcel->getAllowAnyAVSounds()); // On if "Everyone" is on
- mCheckAVSoundGroup->setEnabled(can_change_av_sounds && !parcel->getAllowAnyAVSounds()); // Enabled if "Everyone" is off
+ mCheckAVSoundGroup->set(parcel->getAllowGroupAVSounds() || parcel->getAllowAnyAVSounds()); // On if "Everyone" is on
+ mCheckAVSoundGroup->setEnabled(can_change_av_sounds && !parcel->getAllowAnyAVSounds()); // Enabled if "Everyone" is off
mCheckObscureMOAP->set(parcel->getObscureMOAP());
mCheckObscureMOAP->setEnabled(can_change_media);
- }
+ }
}
// static
void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata)
{
- LLPanelLandAudio *self = (LLPanelLandAudio *)userdata;
+ LLPanelLandAudio *self = (LLPanelLandAudio *)userdata;
- LLParcel* parcel = self->mParcel->getParcel();
- if (!parcel)
- {
- return;
- }
+ LLParcel* parcel = self->mParcel->getParcel();
+ if (!parcel)
+ {
+ return;
+ }
- // Extract data from UI
- BOOL sound_local = self->mCheckSoundLocal->get();
- std::string music_url = self->mMusicURLEdit->getText();
+ // Extract data from UI
+ BOOL sound_local = self->mCheckSoundLocal->get();
+ std::string music_url = self->mMusicURLEdit->getText();
- BOOL voice_enabled = self->mCheckParcelEnableVoice->get();
- BOOL voice_estate_chan = !self->mCheckParcelVoiceLocal->get();
+ BOOL voice_enabled = self->mCheckParcelEnableVoice->get();
+ BOOL voice_estate_chan = !self->mCheckParcelVoiceLocal->get();
- BOOL any_av_sound = self->mCheckAVSoundAny->get();
- BOOL group_av_sound = TRUE; // If set to "Everyone" then group is checked as well
- if (!any_av_sound)
- { // If "Everyone" is off, use the value from the checkbox
- group_av_sound = self->mCheckAVSoundGroup->get();
- }
+ BOOL any_av_sound = self->mCheckAVSoundAny->get();
+ BOOL group_av_sound = TRUE; // If set to "Everyone" then group is checked as well
+ if (!any_av_sound)
+ { // If "Everyone" is off, use the value from the checkbox
+ group_av_sound = self->mCheckAVSoundGroup->get();
+ }
bool obscure_moap = self->mCheckObscureMOAP->get();
- // Remove leading/trailing whitespace (common when copying/pasting)
- LLStringUtil::trim(music_url);
+ // Remove leading/trailing whitespace (common when copying/pasting)
+ LLStringUtil::trim(music_url);
- // Push data into current parcel
- parcel->setParcelFlag(PF_ALLOW_VOICE_CHAT, voice_enabled);
- parcel->setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, voice_estate_chan);
- parcel->setParcelFlag(PF_SOUND_LOCAL, sound_local);
- parcel->setMusicURL(music_url);
- parcel->setAllowAnyAVSounds(any_av_sound);
- parcel->setAllowGroupAVSounds(group_av_sound);
+ // Push data into current parcel
+ parcel->setParcelFlag(PF_ALLOW_VOICE_CHAT, voice_enabled);
+ parcel->setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, voice_estate_chan);
+ parcel->setParcelFlag(PF_SOUND_LOCAL, sound_local);
+ parcel->setMusicURL(music_url);
+ parcel->setAllowAnyAVSounds(any_av_sound);
+ parcel->setAllowGroupAVSounds(group_av_sound);
parcel->setObscureMOAP(obscure_moap);
- // Send current parcel data upstream to server
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+ // Send current parcel data upstream to server
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
- // Might have changed properties, so let's redraw!
- self->refresh();
+ // Might have changed properties, so let's redraw!
+ self->refresh();
}
diff --git a/indra/newview/llpanellandaudio.h b/indra/newview/llpanellandaudio.h
index b54fe62179..6a2f6c19fe 100644
--- a/indra/newview/llpanellandaudio.h
+++ b/indra/newview/llpanellandaudio.h
@@ -1,26 +1,26 @@
/**
* @file llpanellandaudio.h
* @brief Allows configuration of "audio" for a land parcel.
- *
+ *
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,31 +31,31 @@
#include "lllineeditor.h"
#include "llpanel.h"
#include "llparcelselection.h"
-#include "lluifwd.h" // widget pointer types
+#include "lluifwd.h" // widget pointer types
class LLPanelLandAudio
- : public LLPanel
+ : public LLPanel
{
public:
- LLPanelLandAudio(LLSafeHandle<LLParcelSelection>& parcelp);
- /*virtual*/ ~LLPanelLandAudio();
- /*virtual*/ BOOL postBuild();
- void refresh();
+ LLPanelLandAudio(LLSafeHandle<LLParcelSelection>& parcelp);
+ /*virtual*/ ~LLPanelLandAudio();
+ /*virtual*/ BOOL postBuild();
+ void refresh();
private:
- static void onCommitAny(LLUICtrl* ctrl, void *userdata);
+ static void onCommitAny(LLUICtrl* ctrl, void *userdata);
private:
- LLCheckBoxCtrl* mCheckSoundLocal;
- LLCheckBoxCtrl* mCheckParcelEnableVoice;
- LLCheckBoxCtrl* mCheckEstateDisabledVoice;
- LLCheckBoxCtrl* mCheckParcelVoiceLocal;
- LLLineEditor* mMusicURLEdit;
- LLCheckBoxCtrl* mCheckAVSoundAny;
- LLCheckBoxCtrl* mCheckAVSoundGroup;
+ LLCheckBoxCtrl* mCheckSoundLocal;
+ LLCheckBoxCtrl* mCheckParcelEnableVoice;
+ LLCheckBoxCtrl* mCheckEstateDisabledVoice;
+ LLCheckBoxCtrl* mCheckParcelVoiceLocal;
+ LLLineEditor* mMusicURLEdit;
+ LLCheckBoxCtrl* mCheckAVSoundAny;
+ LLCheckBoxCtrl* mCheckAVSoundGroup;
LLCheckBoxCtrl* mCheckObscureMOAP;
- LLSafeHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
#endif
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index cc3c51dd83..f30be3faf3 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -61,7 +61,7 @@ static std::string icon_m;
static std::string icon_r;
LLPanelLandmarkInfo::LLPanelLandmarkInfo()
-: LLPanelPlaceInfo()
+: LLPanelPlaceInfo()
{}
// virtual
@@ -71,36 +71,36 @@ LLPanelLandmarkInfo::~LLPanelLandmarkInfo()
// virtual
BOOL LLPanelLandmarkInfo::postBuild()
{
- LLPanelPlaceInfo::postBuild();
+ LLPanelPlaceInfo::postBuild();
- mOwner = getChild<LLTextBox>("owner");
- mCreator = getChild<LLTextBox>("creator");
- mCreated = getChild<LLTextBox>("created");
+ mOwner = getChild<LLTextBox>("owner");
+ mCreator = getChild<LLTextBox>("creator");
+ mCreated = getChild<LLTextBox>("created");
- mLandmarkTitle = getChild<LLLineEditor>("title_value");
- mLandmarkTitleEditor = getChild<LLLineEditor>("title_editor");
- mNotesEditor = getChild<LLTextEditor>("notes_editor");
- mFolderCombo = getChild<LLComboBox>("folder_combo");
+ mLandmarkTitle = getChild<LLLineEditor>("title_value");
+ mLandmarkTitleEditor = getChild<LLLineEditor>("title_editor");
+ mNotesEditor = getChild<LLTextEditor>("notes_editor");
+ mFolderCombo = getChild<LLComboBox>("folder_combo");
- icon_pg = getString("icon_PG");
- icon_m = getString("icon_M");
- icon_r = getString("icon_R");
+ icon_pg = getString("icon_PG");
+ icon_m = getString("icon_M");
+ icon_r = getString("icon_R");
- return TRUE;
+ return TRUE;
}
// virtual
void LLPanelLandmarkInfo::resetLocation()
{
- LLPanelPlaceInfo::resetLocation();
-
- std::string loading = LLTrans::getString("LoadingData");
- mCreator->setText(loading);
- mOwner->setText(loading);
- mCreated->setText(loading);
- mLandmarkTitle->setText(LLStringUtil::null);
- mLandmarkTitleEditor->setText(LLStringUtil::null);
- mNotesEditor->setText(LLStringUtil::null);
+ LLPanelPlaceInfo::resetLocation();
+
+ std::string loading = LLTrans::getString("LoadingData");
+ mCreator->setText(loading);
+ mOwner->setText(loading);
+ mCreated->setText(loading);
+ mLandmarkTitle->setText(LLStringUtil::null);
+ mLandmarkTitleEditor->setText(LLStringUtil::null);
+ mNotesEditor->setText(LLStringUtil::null);
}
// virtual
@@ -118,57 +118,57 @@ void LLPanelLandmarkInfo::setInfoAndCreateLandmark(const LLUUID& folder_id)
void LLPanelLandmarkInfo::setInfoType(EInfoType type, const LLUUID &folder_id)
{
- LLPanel* landmark_info_panel = getChild<LLPanel>("landmark_info_panel");
+ LLPanel* landmark_info_panel = getChild<LLPanel>("landmark_info_panel");
- bool is_info_type_create_landmark = type == CREATE_LANDMARK;
+ bool is_info_type_create_landmark = type == CREATE_LANDMARK;
- landmark_info_panel->setVisible(type == LANDMARK);
+ landmark_info_panel->setVisible(type == LANDMARK);
- getChild<LLTextBox>("folder_label")->setVisible(is_info_type_create_landmark);
+ getChild<LLTextBox>("folder_label")->setVisible(is_info_type_create_landmark);
getChild<LLButton>("edit_btn")->setVisible(!is_info_type_create_landmark);
- mFolderCombo->setVisible(is_info_type_create_landmark);
-
- switch(type)
- {
- case CREATE_LANDMARK:
- {
- mCurrentTitle = getString("title_create_landmark");
-
- mLandmarkTitle->setVisible(FALSE);
- mLandmarkTitleEditor->setVisible(TRUE);
- mNotesEditor->setEnabled(TRUE);
-
- LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
- LLParcel* parcel = parcel_mgr->getAgentParcel();
- std::string name = parcel->getName();
- LLVector3 agent_pos = gAgent.getPositionAgent();
-
- if (name.empty())
- {
- S32 region_x = ll_round(agent_pos.mV[VX]);
- S32 region_y = ll_round(agent_pos.mV[VY]);
- S32 region_z = ll_round(agent_pos.mV[VZ]);
-
- std::string region_name;
- LLViewerRegion* region = parcel_mgr->getSelectionRegion();
- if (region)
- {
- region_name = region->getName();
- }
- else
- {
- std::string desc;
- LLAgentUI::buildLocationString(desc, LLAgentUI::LOCATION_FORMAT_NORMAL, agent_pos);
- region_name = desc;
- }
-
- mLandmarkTitleEditor->setText(llformat("%s (%d, %d, %d)",
- region_name.c_str(), region_x, region_y, region_z));
- }
- else
- {
- mLandmarkTitleEditor->setText(name);
- }
+ mFolderCombo->setVisible(is_info_type_create_landmark);
+
+ switch(type)
+ {
+ case CREATE_LANDMARK:
+ {
+ mCurrentTitle = getString("title_create_landmark");
+
+ mLandmarkTitle->setVisible(FALSE);
+ mLandmarkTitleEditor->setVisible(TRUE);
+ mNotesEditor->setEnabled(TRUE);
+
+ LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+ LLParcel* parcel = parcel_mgr->getAgentParcel();
+ std::string name = parcel->getName();
+ LLVector3 agent_pos = gAgent.getPositionAgent();
+
+ if (name.empty())
+ {
+ S32 region_x = ll_round(agent_pos.mV[VX]);
+ S32 region_y = ll_round(agent_pos.mV[VY]);
+ S32 region_z = ll_round(agent_pos.mV[VZ]);
+
+ std::string region_name;
+ LLViewerRegion* region = parcel_mgr->getSelectionRegion();
+ if (region)
+ {
+ region_name = region->getName();
+ }
+ else
+ {
+ std::string desc;
+ LLAgentUI::buildLocationString(desc, LLAgentUI::LOCATION_FORMAT_NORMAL, agent_pos);
+ region_name = desc;
+ }
+
+ mLandmarkTitleEditor->setText(llformat("%s (%d, %d, %d)",
+ region_name.c_str(), region_x, region_y, region_z));
+ }
+ else
+ {
+ mLandmarkTitleEditor->setText(name);
+ }
LLUUID owner_id = parcel->getOwnerID();
if (owner_id.notNull())
@@ -189,56 +189,56 @@ void LLPanelLandmarkInfo::setInfoType(EInfoType type, const LLUUID &folder_id)
mParcelOwner->setText(getString("public"));
}
- // Moved landmark creation here from LLPanelLandmarkInfo::processParcelInfo()
- // because we use only agent's current coordinates instead of waiting for
- // remote parcel request to complete.
- if (!LLLandmarkActions::landmarkAlreadyExists())
- {
- createLandmark(folder_id);
- }
- }
- break;
+ // Moved landmark creation here from LLPanelLandmarkInfo::processParcelInfo()
+ // because we use only agent's current coordinates instead of waiting for
+ // remote parcel request to complete.
+ if (!LLLandmarkActions::landmarkAlreadyExists())
+ {
+ createLandmark(folder_id);
+ }
+ }
+ break;
- case LANDMARK:
- default:
- mCurrentTitle = getString("title_landmark");
+ case LANDMARK:
+ default:
+ mCurrentTitle = getString("title_landmark");
- mLandmarkTitle->setVisible(TRUE);
- mLandmarkTitleEditor->setVisible(FALSE);
- mNotesEditor->setEnabled(FALSE);
- break;
- }
+ mLandmarkTitle->setVisible(TRUE);
+ mLandmarkTitleEditor->setVisible(FALSE);
+ mNotesEditor->setEnabled(FALSE);
+ break;
+ }
- populateFoldersList();
+ populateFoldersList();
- // Prevent the floater from losing focus (if the sidepanel is undocked).
- setFocus(TRUE);
+ // Prevent the floater from losing focus (if the sidepanel is undocked).
+ setFocus(TRUE);
- LLPanelPlaceInfo::setInfoType(type);
+ LLPanelPlaceInfo::setInfoType(type);
}
// virtual
void LLPanelLandmarkInfo::processParcelInfo(const LLParcelData& parcel_data)
{
- LLPanelPlaceInfo::processParcelInfo(parcel_data);
-
- // HACK: Flag 0x2 == adult region,
- // Flag 0x1 == mature region, otherwise assume PG
- if (parcel_data.flags & 0x2)
- {
- mMaturityRatingIcon->setValue(icon_r);
- mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_ADULT));
- }
- else if (parcel_data.flags & 0x1)
- {
- mMaturityRatingIcon->setValue(icon_m);
- mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_MATURE));
- }
- else
- {
- mMaturityRatingIcon->setValue(icon_pg);
- mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_PG));
- }
+ LLPanelPlaceInfo::processParcelInfo(parcel_data);
+
+ // HACK: Flag 0x2 == adult region,
+ // Flag 0x1 == mature region, otherwise assume PG
+ if (parcel_data.flags & 0x2)
+ {
+ mMaturityRatingIcon->setValue(icon_r);
+ mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_ADULT));
+ }
+ else if (parcel_data.flags & 0x1)
+ {
+ mMaturityRatingIcon->setValue(icon_m);
+ mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_MATURE));
+ }
+ else
+ {
+ mMaturityRatingIcon->setValue(icon_pg);
+ mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_PG));
+ }
if (parcel_data.owner_id.notNull())
{
@@ -258,117 +258,117 @@ void LLPanelLandmarkInfo::processParcelInfo(const LLParcelData& parcel_data)
mParcelOwner->setText(getString("public"));
}
- LLSD info;
- info["update_verbs"] = true;
- info["global_x"] = parcel_data.global_x;
- info["global_y"] = parcel_data.global_y;
- info["global_z"] = parcel_data.global_z;
- notifyParent(info);
+ LLSD info;
+ info["update_verbs"] = true;
+ info["global_x"] = parcel_data.global_x;
+ info["global_y"] = parcel_data.global_y;
+ info["global_z"] = parcel_data.global_z;
+ notifyParent(info);
}
void LLPanelLandmarkInfo::displayItemInfo(const LLInventoryItem* pItem)
{
- if (!pItem)
- return;
-
- if(!gCacheName)
- return;
-
- const LLPermissions& perm = pItem->getPermissions();
-
- //////////////////
- // CREATOR NAME //
- //////////////////
- if (pItem->getCreatorUUID().notNull())
- {
- // IDEVO
- LLUUID creator_id = pItem->getCreatorUUID();
- std::string name =
- LLSLURL("agent", creator_id, "inspect").getSLURLString();
- mCreator->setText(name);
- }
- else
- {
- mCreator->setText(getString("unknown"));
- }
-
- ////////////////
- // OWNER NAME //
- ////////////////
- if(perm.isOwned())
- {
- std::string name;
- if (perm.isGroupOwned())
- {
- LLUUID group_id = perm.getGroup();
- name = LLSLURL("group", group_id, "inspect").getSLURLString();
- }
- else
- {
- LLUUID owner_id = perm.getOwner();
- name = LLSLURL("agent", owner_id, "inspect").getSLURLString();
- }
- mOwner->setText(name);
- }
- else
- {
- std::string public_str = getString("public");
- mOwner->setText(public_str);
- }
-
- //////////////////
- // ACQUIRE DATE //
- //////////////////
- time_t time_utc = pItem->getCreationDate();
- if (0 == time_utc)
- {
- mCreated->setText(getString("unknown"));
- }
- else
- {
- std::string timeStr = getString("acquired_date");
- LLSD substitution;
- substitution["datetime"] = (S32) time_utc;
- LLStringUtil::format (timeStr, substitution);
- mCreated->setText(timeStr);
- }
-
- mLandmarkTitle->setText(pItem->getName());
- mLandmarkTitleEditor->setText(pItem->getName());
- mNotesEditor->setText(pItem->getDescription());
+ if (!pItem)
+ return;
+
+ if(!gCacheName)
+ return;
+
+ const LLPermissions& perm = pItem->getPermissions();
+
+ //////////////////
+ // CREATOR NAME //
+ //////////////////
+ if (pItem->getCreatorUUID().notNull())
+ {
+ // IDEVO
+ LLUUID creator_id = pItem->getCreatorUUID();
+ std::string name =
+ LLSLURL("agent", creator_id, "inspect").getSLURLString();
+ mCreator->setText(name);
+ }
+ else
+ {
+ mCreator->setText(getString("unknown"));
+ }
+
+ ////////////////
+ // OWNER NAME //
+ ////////////////
+ if(perm.isOwned())
+ {
+ std::string name;
+ if (perm.isGroupOwned())
+ {
+ LLUUID group_id = perm.getGroup();
+ name = LLSLURL("group", group_id, "inspect").getSLURLString();
+ }
+ else
+ {
+ LLUUID owner_id = perm.getOwner();
+ name = LLSLURL("agent", owner_id, "inspect").getSLURLString();
+ }
+ mOwner->setText(name);
+ }
+ else
+ {
+ std::string public_str = getString("public");
+ mOwner->setText(public_str);
+ }
+
+ //////////////////
+ // ACQUIRE DATE //
+ //////////////////
+ time_t time_utc = pItem->getCreationDate();
+ if (0 == time_utc)
+ {
+ mCreated->setText(getString("unknown"));
+ }
+ else
+ {
+ std::string timeStr = getString("acquired_date");
+ LLSD substitution;
+ substitution["datetime"] = (S32) time_utc;
+ LLStringUtil::format (timeStr, substitution);
+ mCreated->setText(timeStr);
+ }
+
+ mLandmarkTitle->setText(pItem->getName());
+ mLandmarkTitleEditor->setText(pItem->getName());
+ mNotesEditor->setText(pItem->getDescription());
}
void LLPanelLandmarkInfo::toggleLandmarkEditMode(BOOL enabled)
{
- // If switching to edit mode while creating landmark
- // the "Create Landmark" title remains.
- if (enabled && mInfoType != CREATE_LANDMARK)
- {
- mTitle->setText(getString("title_edit_landmark"));
- }
- else
- {
- mTitle->setText(mCurrentTitle);
-
- mLandmarkTitle->setText(mLandmarkTitleEditor->getText());
- }
-
- if (mNotesEditor->getReadOnly() == (enabled == TRUE))
- {
- mLandmarkTitle->setVisible(!enabled);
- mLandmarkTitleEditor->setVisible(enabled);
- mNotesEditor->setReadOnly(!enabled);
- mFolderCombo->setVisible(enabled);
- getChild<LLTextBox>("folder_label")->setVisible(enabled);
- getChild<LLButton>("edit_btn")->setVisible(!enabled);
-
- // HACK: To change the text color in a text editor
- // when it was enabled/disabled we set the text once again.
- mNotesEditor->setText(mNotesEditor->getText());
- }
-
- // Prevent the floater from losing focus (if the sidepanel is undocked).
- setFocus(TRUE);
+ // If switching to edit mode while creating landmark
+ // the "Create Landmark" title remains.
+ if (enabled && mInfoType != CREATE_LANDMARK)
+ {
+ mTitle->setText(getString("title_edit_landmark"));
+ }
+ else
+ {
+ mTitle->setText(mCurrentTitle);
+
+ mLandmarkTitle->setText(mLandmarkTitleEditor->getText());
+ }
+
+ if (mNotesEditor->getReadOnly() == (enabled == TRUE))
+ {
+ mLandmarkTitle->setVisible(!enabled);
+ mLandmarkTitleEditor->setVisible(enabled);
+ mNotesEditor->setReadOnly(!enabled);
+ mFolderCombo->setVisible(enabled);
+ getChild<LLTextBox>("folder_label")->setVisible(enabled);
+ getChild<LLButton>("edit_btn")->setVisible(!enabled);
+
+ // HACK: To change the text color in a text editor
+ // when it was enabled/disabled we set the text once again.
+ mNotesEditor->setText(mNotesEditor->getText());
+ }
+
+ // Prevent the floater from losing focus (if the sidepanel is undocked).
+ setFocus(TRUE);
}
void LLPanelLandmarkInfo::setCanEdit(BOOL enabled)
@@ -378,175 +378,175 @@ void LLPanelLandmarkInfo::setCanEdit(BOOL enabled)
const std::string& LLPanelLandmarkInfo::getLandmarkTitle() const
{
- return mLandmarkTitleEditor->getText();
+ return mLandmarkTitleEditor->getText();
}
const std::string LLPanelLandmarkInfo::getLandmarkNotes() const
{
- return mNotesEditor->getText();
+ return mNotesEditor->getText();
}
const LLUUID LLPanelLandmarkInfo::getLandmarkFolder() const
{
- return mFolderCombo->getValue().asUUID();
+ return mFolderCombo->getValue().asUUID();
}
BOOL LLPanelLandmarkInfo::setLandmarkFolder(const LLUUID& id)
{
- return mFolderCombo->setCurrentByID(id);
+ return mFolderCombo->setCurrentByID(id);
}
void LLPanelLandmarkInfo::createLandmark(const LLUUID& folder_id)
{
- std::string name = mLandmarkTitleEditor->getText();
- std::string desc = mNotesEditor->getText();
+ std::string name = mLandmarkTitleEditor->getText();
+ std::string desc = mNotesEditor->getText();
- LLStringUtil::trim(name);
- LLStringUtil::trim(desc);
+ LLStringUtil::trim(name);
+ LLStringUtil::trim(desc);
- // If typed name is empty use the parcel name instead.
- if (name.empty())
- {
- name = mParcelName->getText();
+ // If typed name is empty use the parcel name instead.
+ if (name.empty())
+ {
+ name = mParcelName->getText();
- // If no parcel exists use the region name instead.
- if (name.empty())
- {
- name = mRegionTitle;
- }
- }
+ // If no parcel exists use the region name instead.
+ if (name.empty())
+ {
+ name = mRegionTitle;
+ }
+ }
- LLStringUtil::replaceChar(desc, '\n', ' ');
+ LLStringUtil::replaceChar(desc, '\n', ' ');
- // If no folder chosen use the "Landmarks" folder.
- LLLandmarkActions::createLandmarkHere(name, desc,
- folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));
+ // If no folder chosen use the "Landmarks" folder.
+ LLLandmarkActions::createLandmarkHere(name, desc,
+ folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));
}
// static
std::string LLPanelLandmarkInfo::getFullFolderName(const LLViewerInventoryCategory* cat)
{
- std::string name;
- LLUUID parent_id;
-
- llassert(cat);
- if (cat)
- {
- name = cat->getName();
- parent_id = cat->getParentUUID();
- bool is_under_root_category = parent_id == gInventory.getRootFolderID();
-
- // we don't want "My Inventory" to appear in the name
- while ((parent_id = cat->getParentUUID()).notNull())
- {
- cat = gInventory.getCategory(parent_id);
- llassert(cat);
- if (cat)
- {
- if (is_under_root_category || cat->getParentUUID() == gInventory.getRootFolderID())
- {
- std::string localized_name;
-
- // Looking for translation only for protected type categories
- // to avoid warnings about non existent string in strings.xml.
- bool is_protected_type = LLFolderType::lookupIsProtectedType(cat->getPreferredType());
-
- if (is_under_root_category)
- {
- // translate category name, if it's right below the root
- bool is_found = is_protected_type && LLTrans::findString(localized_name, "InvFolder " + name);
- name = is_found ? localized_name : name;
- }
- else
- {
- bool is_found = is_protected_type && LLTrans::findString(localized_name, "InvFolder " + cat->getName());
-
- // add translated category name to folder's full name
- name = (is_found ? localized_name : cat->getName()) + "/" + name;
- }
-
- break;
- }
- else
- {
- name = cat->getName() + "/" + name;
- }
- }
- }
- }
-
- return name;
+ std::string name;
+ LLUUID parent_id;
+
+ llassert(cat);
+ if (cat)
+ {
+ name = cat->getName();
+ parent_id = cat->getParentUUID();
+ bool is_under_root_category = parent_id == gInventory.getRootFolderID();
+
+ // we don't want "My Inventory" to appear in the name
+ while ((parent_id = cat->getParentUUID()).notNull())
+ {
+ cat = gInventory.getCategory(parent_id);
+ llassert(cat);
+ if (cat)
+ {
+ if (is_under_root_category || cat->getParentUUID() == gInventory.getRootFolderID())
+ {
+ std::string localized_name;
+
+ // Looking for translation only for protected type categories
+ // to avoid warnings about non existent string in strings.xml.
+ bool is_protected_type = LLFolderType::lookupIsProtectedType(cat->getPreferredType());
+
+ if (is_under_root_category)
+ {
+ // translate category name, if it's right below the root
+ bool is_found = is_protected_type && LLTrans::findString(localized_name, "InvFolder " + name);
+ name = is_found ? localized_name : name;
+ }
+ else
+ {
+ bool is_found = is_protected_type && LLTrans::findString(localized_name, "InvFolder " + cat->getName());
+
+ // add translated category name to folder's full name
+ name = (is_found ? localized_name : cat->getName()) + "/" + name;
+ }
+
+ break;
+ }
+ else
+ {
+ name = cat->getName() + "/" + name;
+ }
+ }
+ }
+ }
+
+ return name;
}
void LLPanelLandmarkInfo::populateFoldersList()
{
- // Collect all folders that can contain landmarks.
- LLInventoryModel::cat_array_t cats;
- collectLandmarkFolders(cats);
-
- mFolderCombo->removeall();
-
- // Put the "Landmarks" folder first in list.
- LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
- const LLViewerInventoryCategory* lmcat = gInventory.getCategory(landmarks_id);
- if (!lmcat)
- {
- LL_WARNS() << "Cannot find the landmarks folder" << LL_ENDL;
- }
- else
- {
- std::string cat_full_name = getFullFolderName(lmcat);
- mFolderCombo->add(cat_full_name, lmcat->getUUID());
- }
-
- typedef std::vector<folder_pair_t> folder_vec_t;
- folder_vec_t folders;
- // Sort the folders by their full name.
- for (S32 i = 0; i < cats.size(); i++)
- {
- const LLViewerInventoryCategory* cat = cats.at(i);
- std::string cat_full_name = getFullFolderName(cat);
- folders.push_back(folder_pair_t(cat->getUUID(), cat_full_name));
- }
- sort(folders.begin(), folders.end(), cmp_folders);
-
- // Finally, populate the combobox.
- for (folder_vec_t::const_iterator it = folders.begin(); it != folders.end(); it++)
- mFolderCombo->add(it->second, LLSD(it->first));
+ // Collect all folders that can contain landmarks.
+ LLInventoryModel::cat_array_t cats;
+ collectLandmarkFolders(cats);
+
+ mFolderCombo->removeall();
+
+ // Put the "Landmarks" folder first in list.
+ LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ const LLViewerInventoryCategory* lmcat = gInventory.getCategory(landmarks_id);
+ if (!lmcat)
+ {
+ LL_WARNS() << "Cannot find the landmarks folder" << LL_ENDL;
+ }
+ else
+ {
+ std::string cat_full_name = getFullFolderName(lmcat);
+ mFolderCombo->add(cat_full_name, lmcat->getUUID());
+ }
+
+ typedef std::vector<folder_pair_t> folder_vec_t;
+ folder_vec_t folders;
+ // Sort the folders by their full name.
+ for (S32 i = 0; i < cats.size(); i++)
+ {
+ const LLViewerInventoryCategory* cat = cats.at(i);
+ std::string cat_full_name = getFullFolderName(cat);
+ folders.push_back(folder_pair_t(cat->getUUID(), cat_full_name));
+ }
+ sort(folders.begin(), folders.end(), cmp_folders);
+
+ // Finally, populate the combobox.
+ for (folder_vec_t::const_iterator it = folders.begin(); it != folders.end(); it++)
+ mFolderCombo->add(it->second, LLSD(it->first));
}
static bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right)
{
- return left.second < right.second;
+ return left.second < right.second;
}
void LLPanelLandmarkInfo::collectLandmarkFolders(LLInventoryModel::cat_array_t& cats)
{
- LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
-
- // Add descendent folders of the "Landmarks" category.
- LLInventoryModel::item_array_t items; // unused
- LLIsType is_category(LLAssetType::AT_CATEGORY);
- gInventory.collectDescendentsIf(
- landmarks_id,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_category);
+ LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+
+ // Add descendent folders of the "Landmarks" category.
+ LLInventoryModel::item_array_t items; // unused
+ LLIsType is_category(LLAssetType::AT_CATEGORY);
+ gInventory.collectDescendentsIf(
+ landmarks_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_category);
}
/* virtual */ void LLUpdateLandmarkParent::fire(const LLUUID& inv_item_id)
{
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(), -1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(mNewParentId, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
-
- mItem->setParent(mNewParentId);
- mItem->updateParentOnServer(FALSE);
-
- gInventory.updateItem(mItem);
- gInventory.notifyObservers();
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(), -1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(mNewParentId, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ mItem->setParent(mNewParentId);
+ mItem->updateParentOnServer(FALSE);
+
+ gInventory.updateItem(mItem);
+ gInventory.notifyObservers();
}
diff --git a/indra/newview/llpanellandmarkinfo.h b/indra/newview/llpanellandmarkinfo.h
index 8802ce066e..f849adada3 100644
--- a/indra/newview/llpanellandmarkinfo.h
+++ b/indra/newview/llpanellandmarkinfo.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,37 +37,37 @@ class LLTextEditor;
class LLPanelLandmarkInfo : public LLPanelPlaceInfo
{
public:
- LLPanelLandmarkInfo();
- /*virtual*/ ~LLPanelLandmarkInfo();
+ LLPanelLandmarkInfo();
+ /*virtual*/ ~LLPanelLandmarkInfo();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /*virtual*/ void resetLocation();
+ /*virtual*/ void resetLocation();
// If landmark doesn't exists, will create it at default folder
- /*virtual*/ void setInfoType(EInfoType type);
+ /*virtual*/ void setInfoType(EInfoType type);
// Sets CREATE_LANDMARK infotype and creates landmark at desired folder
void setInfoAndCreateLandmark(const LLUUID& folder_id);
- /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
+ /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
- // Displays landmark owner, creator and creation date info.
- void displayItemInfo(const LLInventoryItem* pItem);
+ // Displays landmark owner, creator and creation date info.
+ void displayItemInfo(const LLInventoryItem* pItem);
- void toggleLandmarkEditMode(BOOL enabled);
- void setCanEdit(BOOL enabled);
+ void toggleLandmarkEditMode(BOOL enabled);
+ void setCanEdit(BOOL enabled);
- const std::string& getLandmarkTitle() const;
- const std::string getLandmarkNotes() const;
- const LLUUID getLandmarkFolder() const;
+ const std::string& getLandmarkTitle() const;
+ const std::string getLandmarkNotes() const;
+ const LLUUID getLandmarkFolder() const;
- // Select current landmark folder in combobox.
- BOOL setLandmarkFolder(const LLUUID& id);
+ // Select current landmark folder in combobox.
+ BOOL setLandmarkFolder(const LLUUID& id);
- typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t;
- static std::string getFullFolderName(const LLViewerInventoryCategory* cat);
- static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats);
+ typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t;
+ static std::string getFullFolderName(const LLViewerInventoryCategory* cat);
+ static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats);
private:
// Create a landmark for the current location
@@ -78,28 +78,28 @@ private:
// If landmark doesn't exists, will create it at specified folder
void setInfoType(EInfoType type, const LLUUID &folder_id);
- void populateFoldersList();
+ void populateFoldersList();
- LLTextBox* mOwner;
- LLTextBox* mCreator;
- LLTextBox* mCreated;
- LLLineEditor* mLandmarkTitle;
- LLLineEditor* mLandmarkTitleEditor;
- LLTextEditor* mNotesEditor;
- LLComboBox* mFolderCombo;
+ LLTextBox* mOwner;
+ LLTextBox* mCreator;
+ LLTextBox* mCreated;
+ LLLineEditor* mLandmarkTitle;
+ LLLineEditor* mLandmarkTitleEditor;
+ LLTextEditor* mNotesEditor;
+ LLComboBox* mFolderCombo;
};
class LLUpdateLandmarkParent : public LLInventoryCallback
{
public:
- LLUpdateLandmarkParent(LLPointer<LLViewerInventoryItem> item, LLUUID new_parent) :
- mItem(item),
- mNewParentId(new_parent)
- {};
- /* virtual */ void fire(const LLUUID& inv_item_id);
+ LLUpdateLandmarkParent(LLPointer<LLViewerInventoryItem> item, LLUUID new_parent) :
+ mItem(item),
+ mNewParentId(new_parent)
+ {};
+ /* virtual */ void fire(const LLUUID& inv_item_id);
private:
- LLPointer<LLViewerInventoryItem> mItem;
- LLUUID mNewParentId;
+ LLPointer<LLViewerInventoryItem> mItem;
+ LLUUID mNewParentId;
};
#endif // LL_LLPANELLANDMARKINFO_H
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index c3334605ae..2a726e3092 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -75,38 +75,38 @@ static void toggle_restore_menu(LLMenuGL* menu, BOOL visible, BOOL enabled);
class LLCheckFolderState : public LLFolderViewFunctor
{
public:
- LLCheckFolderState()
- : mCollapsedFolders(0),
- mExpandedFolders(0)
- {}
- virtual ~LLCheckFolderState() {}
- virtual void doFolder(LLFolderViewFolder* folder);
- virtual void doItem(LLFolderViewItem* item) {}
- S32 getCollapsedFolders() { return mCollapsedFolders; }
- S32 getExpandedFolders() { return mExpandedFolders; }
+ LLCheckFolderState()
+ : mCollapsedFolders(0),
+ mExpandedFolders(0)
+ {}
+ virtual ~LLCheckFolderState() {}
+ virtual void doFolder(LLFolderViewFolder* folder);
+ virtual void doItem(LLFolderViewItem* item) {}
+ S32 getCollapsedFolders() { return mCollapsedFolders; }
+ S32 getExpandedFolders() { return mExpandedFolders; }
private:
- S32 mCollapsedFolders;
- S32 mExpandedFolders;
+ S32 mCollapsedFolders;
+ S32 mExpandedFolders;
};
// virtual
void LLCheckFolderState::doFolder(LLFolderViewFolder* folder)
{
- // Counting only folders that pass the filter.
- // The listener check allow us to avoid counting the folder view
- // object itself because it has no listener assigned.
- if (folder->getViewModelItem()->descendantsPassedFilter())
- {
- if (folder->isOpen())
- {
- ++mExpandedFolders;
- }
- else
- {
- ++mCollapsedFolders;
- }
- }
+ // Counting only folders that pass the filter.
+ // The listener check allow us to avoid counting the folder view
+ // object itself because it has no listener assigned.
+ if (folder->getViewModelItem()->descendantsPassedFilter())
+ {
+ if (folder->isOpen())
+ {
+ ++mExpandedFolders;
+ }
+ else
+ {
+ ++mCollapsedFolders;
+ }
+ }
}
// Functor searching and opening a folder specified by UUID
@@ -114,61 +114,61 @@ void LLCheckFolderState::doFolder(LLFolderViewFolder* folder)
class LLOpenFolderByID : public LLFolderViewFunctor
{
public:
- LLOpenFolderByID(const LLUUID& folder_id)
- : mFolderID(folder_id)
- , mIsFolderOpen(false)
- {}
- virtual ~LLOpenFolderByID() {}
- /*virtual*/ void doFolder(LLFolderViewFolder* folder);
- /*virtual*/ void doItem(LLFolderViewItem* item) {}
+ LLOpenFolderByID(const LLUUID& folder_id)
+ : mFolderID(folder_id)
+ , mIsFolderOpen(false)
+ {}
+ virtual ~LLOpenFolderByID() {}
+ /*virtual*/ void doFolder(LLFolderViewFolder* folder);
+ /*virtual*/ void doItem(LLFolderViewItem* item) {}
- bool isFolderOpen() { return mIsFolderOpen; }
+ bool isFolderOpen() { return mIsFolderOpen; }
private:
- bool mIsFolderOpen;
- LLUUID mFolderID;
+ bool mIsFolderOpen;
+ LLUUID mFolderID;
};
// virtual
void LLOpenFolderByID::doFolder(LLFolderViewFolder* folder)
{
- if (folder->getViewModelItem() && static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem())->getUUID() == mFolderID)
- {
- if (!folder->isOpen())
- {
- folder->setOpen(TRUE);
- mIsFolderOpen = true;
- }
- }
+ if (folder->getViewModelItem() && static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem())->getUUID() == mFolderID)
+ {
+ if (!folder->isOpen())
+ {
+ folder->setOpen(TRUE);
+ mIsFolderOpen = true;
+ }
+ }
}
LLLandmarksPanel::LLLandmarksPanel()
- : LLPanelPlacesTab()
- , mLandmarksInventoryPanel(NULL)
- , mCurrentSelectedList(NULL)
- , mGearFolderMenu(NULL)
- , mGearLandmarkMenu(NULL)
- , mSortingMenu(NULL)
- , mAddMenu(NULL)
- , isLandmarksPanel(true)
+ : LLPanelPlacesTab()
+ , mLandmarksInventoryPanel(NULL)
+ , mCurrentSelectedList(NULL)
+ , mGearFolderMenu(NULL)
+ , mGearLandmarkMenu(NULL)
+ , mSortingMenu(NULL)
+ , mAddMenu(NULL)
+ , isLandmarksPanel(true)
{
- buildFromFile("panel_landmarks.xml");
+ buildFromFile("panel_landmarks.xml");
}
LLLandmarksPanel::LLLandmarksPanel(bool is_landmark_panel)
- : LLPanelPlacesTab()
- , mLandmarksInventoryPanel(NULL)
- , mCurrentSelectedList(NULL)
- , mGearFolderMenu(NULL)
- , mGearLandmarkMenu(NULL)
- , mSortingMenu(NULL)
- , mAddMenu(NULL)
- , isLandmarksPanel(is_landmark_panel)
+ : LLPanelPlacesTab()
+ , mLandmarksInventoryPanel(NULL)
+ , mCurrentSelectedList(NULL)
+ , mGearFolderMenu(NULL)
+ , mGearLandmarkMenu(NULL)
+ , mSortingMenu(NULL)
+ , mAddMenu(NULL)
+ , isLandmarksPanel(is_landmark_panel)
{
- if (is_landmark_panel)
- {
- buildFromFile("panel_landmarks.xml");
- }
+ if (is_landmark_panel)
+ {
+ buildFromFile("panel_landmarks.xml");
+ }
}
LLLandmarksPanel::~LLLandmarksPanel()
@@ -177,56 +177,56 @@ LLLandmarksPanel::~LLLandmarksPanel()
BOOL LLLandmarksPanel::postBuild()
{
- if (!gInventory.isInventoryUsable())
- return FALSE;
+ if (!gInventory.isInventoryUsable())
+ return FALSE;
- // mast be called before any other initXXX methods to init Gear menu
- initListCommandsHandlers();
- initLandmarksInventoryPanel();
+ // mast be called before any other initXXX methods to init Gear menu
+ initListCommandsHandlers();
+ initLandmarksInventoryPanel();
- return TRUE;
+ return TRUE;
}
// virtual
void LLLandmarksPanel::onSearchEdit(const std::string& string)
{
- filter_list(mCurrentSelectedList, string);
+ filter_list(mCurrentSelectedList, string);
- if (sFilterSubString != string)
- sFilterSubString = string;
+ if (sFilterSubString != string)
+ sFilterSubString = string;
}
// virtual
void LLLandmarksPanel::onShowOnMap()
{
- if (NULL == mCurrentSelectedList)
- {
- LL_WARNS() << "There are no selected list. No actions are performed." << LL_ENDL;
- return;
- }
+ if (NULL == mCurrentSelectedList)
+ {
+ LL_WARNS() << "There are no selected list. No actions are performed." << LL_ENDL;
+ return;
+ }
- doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doShowOnMap, this, _1));
+ doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doShowOnMap, this, _1));
}
//virtual
void LLLandmarksPanel::onShowProfile()
{
- LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
+ LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
- if(!cur_item)
- return;
+ if(!cur_item)
+ return;
- cur_item->performAction(mCurrentSelectedList->getModel(),"about");
+ cur_item->performAction(mCurrentSelectedList->getModel(),"about");
}
// virtual
void LLLandmarksPanel::onTeleport()
{
- LLFolderViewModelItemInventory* view_model_item = getCurSelectedViewModelItem();
- if (view_model_item && view_model_item->getInventoryType() == LLInventoryType::IT_LANDMARK)
- {
- view_model_item->openItem();
- }
+ LLFolderViewModelItemInventory* view_model_item = getCurSelectedViewModelItem();
+ if (view_model_item && view_model_item->getInventoryType() == LLInventoryType::IT_LANDMARK)
+ {
+ view_model_item->openItem();
+ }
}
/*virtual*/
@@ -238,19 +238,19 @@ void LLLandmarksPanel::onRemoveSelected()
// virtual
bool LLLandmarksPanel::isSingleItemSelected()
{
- bool result = false;
+ bool result = false;
- if (mCurrentSelectedList != NULL)
- {
- LLFolderView* root_view = mCurrentSelectedList->getRootFolder();
+ if (mCurrentSelectedList != NULL)
+ {
+ LLFolderView* root_view = mCurrentSelectedList->getRootFolder();
- if (root_view->getSelectedCount() == 1)
- {
- result = isLandmarkSelected();
- }
- }
+ if (root_view->getSelectedCount() == 1)
+ {
+ result = isLandmarkSelected();
+ }
+ }
- return result;
+ return result;
}
// virtual
@@ -286,83 +286,83 @@ LLToggleableMenu* LLLandmarksPanel::getCreateMenu()
void LLLandmarksPanel::updateVerbs()
{
- if (sRemoveBtn)
- {
- sRemoveBtn->setEnabled(isActionEnabled("delete") && (isFolderSelected() || isLandmarkSelected()));
- }
+ if (sRemoveBtn)
+ {
+ sRemoveBtn->setEnabled(isActionEnabled("delete") && (isFolderSelected() || isLandmarkSelected()));
+ }
}
void LLLandmarksPanel::setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus)
{
- if (!mCurrentSelectedList)
- return;
-
- LLFolderView* root = mCurrentSelectedList->getRootFolder();
- LLFolderViewItem* item = mCurrentSelectedList->getItemByID(obj_id);
- if (!item)
- return;
- root->setSelection(item, FALSE, take_keyboard_focus);
- root->scrollToShowSelection();
+ if (!mCurrentSelectedList)
+ return;
+
+ LLFolderView* root = mCurrentSelectedList->getRootFolder();
+ LLFolderViewItem* item = mCurrentSelectedList->getItemByID(obj_id);
+ if (!item)
+ return;
+ root->setSelection(item, FALSE, take_keyboard_focus);
+ root->scrollToShowSelection();
}
//////////////////////////////////////////////////////////////////////////
// PROTECTED METHODS
//////////////////////////////////////////////////////////////////////////
-bool LLLandmarksPanel::isLandmarkSelected() const
+bool LLLandmarksPanel::isLandmarkSelected() const
{
- LLFolderViewModelItemInventory* current_item = getCurSelectedViewModelItem();
- return current_item && (current_item->getInventoryType() == LLInventoryType::IT_LANDMARK);
+ LLFolderViewModelItemInventory* current_item = getCurSelectedViewModelItem();
+ return current_item && (current_item->getInventoryType() == LLInventoryType::IT_LANDMARK);
}
bool LLLandmarksPanel::isFolderSelected() const
{
- LLFolderViewModelItemInventory* current_item = getCurSelectedViewModelItem();
- return current_item && (current_item->getInventoryType() == LLInventoryType::IT_CATEGORY);
+ LLFolderViewModelItemInventory* current_item = getCurSelectedViewModelItem();
+ return current_item && (current_item->getInventoryType() == LLInventoryType::IT_CATEGORY);
}
void LLLandmarksPanel::doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb)
{
- LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
- if(cur_item && cur_item->getInventoryType() == LLInventoryType::IT_LANDMARK)
- {
- LLLandmark* landmark = LLLandmarkActions::getLandmark(cur_item->getUUID(), cb);
- if (landmark)
- {
- cb(landmark);
- }
- }
+ LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
+ if(cur_item && cur_item->getInventoryType() == LLInventoryType::IT_LANDMARK)
+ {
+ LLLandmark* landmark = LLLandmarkActions::getLandmark(cur_item->getUUID(), cb);
+ if (landmark)
+ {
+ cb(landmark);
+ }
+ }
}
-LLFolderViewItem* LLLandmarksPanel::getCurSelectedItem() const
+LLFolderViewItem* LLLandmarksPanel::getCurSelectedItem() const
{
- return mCurrentSelectedList ? mCurrentSelectedList->getRootFolder()->getCurSelectedItem() : NULL;
+ return mCurrentSelectedList ? mCurrentSelectedList->getRootFolder()->getCurSelectedItem() : NULL;
}
LLFolderViewModelItemInventory* LLLandmarksPanel::getCurSelectedViewModelItem() const
{
- LLFolderViewItem* cur_item = getCurSelectedItem();
- if (cur_item)
- {
- return static_cast<LLFolderViewModelItemInventory*>(cur_item->getViewModelItem());
- }
- return NULL;
+ LLFolderViewItem* cur_item = getCurSelectedItem();
+ if (cur_item)
+ {
+ return static_cast<LLFolderViewModelItemInventory*>(cur_item->getViewModelItem());
+ }
+ return NULL;
}
void LLLandmarksPanel::updateSortOrder(LLInventoryPanel* panel, bool byDate)
{
- if(!panel) return;
-
- U32 order = panel->getSortOrder();
- if (byDate)
- {
- panel->setSortOrder( order | LLInventoryFilter::SO_DATE );
- }
- else
- {
- panel->setSortOrder( order & ~LLInventoryFilter::SO_DATE );
- }
+ if(!panel) return;
+
+ U32 order = panel->getSortOrder();
+ if (byDate)
+ {
+ panel->setSortOrder( order | LLInventoryFilter::SO_DATE );
+ }
+ else
+ {
+ panel->setSortOrder( order & ~LLInventoryFilter::SO_DATE );
+ }
}
void LLLandmarksPanel::resetSelection()
@@ -372,11 +372,11 @@ void LLLandmarksPanel::resetSelection()
// virtual
void LLLandmarksPanel::processParcelInfo(const LLParcelData& parcel_data)
{
- //this function will be called after user will try to create a pick for selected landmark.
- // We have to make request to sever to get parcel_id and snaption_id.
- if(mCreatePickItemId.notNull())
- {
- LLInventoryItem* inv_item = gInventory.getItem(mCreatePickItemId);
+ //this function will be called after user will try to create a pick for selected landmark.
+ // We have to make request to sever to get parcel_id and snaption_id.
+ if(mCreatePickItemId.notNull())
+ {
+ LLInventoryItem* inv_item = gInventory.getItem(mCreatePickItemId);
if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_LANDMARK)
{
@@ -388,23 +388,23 @@ void LLLandmarksPanel::processParcelInfo(const LLParcelData& parcel_data)
}
}
mCreatePickItemId.setNull();
- }
+ }
}
// virtual
void LLLandmarksPanel::setParcelID(const LLUUID& parcel_id)
{
- if (!parcel_id.isNull())
- {
- LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this);
- LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id);
- }
+ if (!parcel_id.isNull())
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this);
+ LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id);
+ }
}
// virtual
void LLLandmarksPanel::setErrorStatus(S32 status, const std::string& reason)
{
- LL_WARNS() << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<LL_ENDL;
+ LL_WARNS() << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<LL_ENDL;
}
@@ -414,31 +414,31 @@ void LLLandmarksPanel::setErrorStatus(S32 status, const std::string& reason)
void LLLandmarksPanel::initLandmarksInventoryPanel()
{
- mLandmarksInventoryPanel = getChild<LLPlacesInventoryPanel>("landmarks_list");
+ mLandmarksInventoryPanel = getChild<LLPlacesInventoryPanel>("landmarks_list");
- initLandmarksPanel(mLandmarksInventoryPanel);
+ initLandmarksPanel(mLandmarksInventoryPanel);
- mLandmarksInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS);
+ mLandmarksInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS);
- // subscribe to have auto-rename functionality while creating New Folder
- mLandmarksInventoryPanel->setSelectCallback(boost::bind(&LLInventoryPanel::onSelectionChange, mLandmarksInventoryPanel, _1, _2));
+ // subscribe to have auto-rename functionality while creating New Folder
+ mLandmarksInventoryPanel->setSelectCallback(boost::bind(&LLInventoryPanel::onSelectionChange, mLandmarksInventoryPanel, _1, _2));
- mCurrentSelectedList = mLandmarksInventoryPanel;
+ mCurrentSelectedList = mLandmarksInventoryPanel;
}
void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list)
{
- inventory_list->getFilter().setEmptyLookupMessage("PlacesNoMatchingItems");
- inventory_list->setFilterTypes(0x1 << LLInventoryType::IT_LANDMARK);
- inventory_list->setSelectCallback(boost::bind(&LLLandmarksPanel::updateVerbs, this));
+ inventory_list->getFilter().setEmptyLookupMessage("PlacesNoMatchingItems");
+ inventory_list->setFilterTypes(0x1 << LLInventoryType::IT_LANDMARK);
+ inventory_list->setSelectCallback(boost::bind(&LLLandmarksPanel::updateVerbs, this));
- inventory_list->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
- updateSortOrder(inventory_list, sorting_order);
+ inventory_list->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+ bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
+ updateSortOrder(inventory_list, sorting_order);
- LLPlacesFolderView* root_folder = dynamic_cast<LLPlacesFolderView*>(inventory_list->getRootFolder());
- if (root_folder)
- {
+ LLPlacesFolderView* root_folder = dynamic_cast<LLPlacesFolderView*>(inventory_list->getRootFolder());
+ if (root_folder)
+ {
if (mGearFolderMenu)
{
root_folder->setupMenuHandle(LLInventoryType::IT_CATEGORY, mGearFolderMenu->getHandle());
@@ -448,26 +448,26 @@ void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list
root_folder->setupMenuHandle(LLInventoryType::IT_LANDMARK, mGearLandmarkMenu->getHandle());
}
- root_folder->setParentLandmarksPanel(this);
- }
+ root_folder->setParentLandmarksPanel(this);
+ }
- inventory_list->saveFolderState();
+ inventory_list->saveFolderState();
}
// List Commands Handlers
void LLLandmarksPanel::initListCommandsHandlers()
{
- mCommitCallbackRegistrar.add("Places.LandmarksGear.Add.Action", boost::bind(&LLLandmarksPanel::onAddAction, this, _2));
- mCommitCallbackRegistrar.add("Places.LandmarksGear.CopyPaste.Action", boost::bind(&LLLandmarksPanel::onClipboardAction, this, _2));
- mCommitCallbackRegistrar.add("Places.LandmarksGear.Custom.Action", boost::bind(&LLLandmarksPanel::onCustomAction, this, _2));
- mCommitCallbackRegistrar.add("Places.LandmarksGear.Folding.Action", boost::bind(&LLLandmarksPanel::onFoldingAction, this, _2));
- mEnableCallbackRegistrar.add("Places.LandmarksGear.Check", boost::bind(&LLLandmarksPanel::isActionChecked, this, _2));
- mEnableCallbackRegistrar.add("Places.LandmarksGear.Enable", boost::bind(&LLLandmarksPanel::isActionEnabled, this, _2));
- mGearLandmarkMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_places_gear_landmark.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- mGearFolderMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_places_gear_folder.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- mSortingMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_places_gear_sorting.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- mAddMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_place_add_button.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mCommitCallbackRegistrar.add("Places.LandmarksGear.Add.Action", boost::bind(&LLLandmarksPanel::onAddAction, this, _2));
+ mCommitCallbackRegistrar.add("Places.LandmarksGear.CopyPaste.Action", boost::bind(&LLLandmarksPanel::onClipboardAction, this, _2));
+ mCommitCallbackRegistrar.add("Places.LandmarksGear.Custom.Action", boost::bind(&LLLandmarksPanel::onCustomAction, this, _2));
+ mCommitCallbackRegistrar.add("Places.LandmarksGear.Folding.Action", boost::bind(&LLLandmarksPanel::onFoldingAction, this, _2));
+ mEnableCallbackRegistrar.add("Places.LandmarksGear.Check", boost::bind(&LLLandmarksPanel::isActionChecked, this, _2));
+ mEnableCallbackRegistrar.add("Places.LandmarksGear.Enable", boost::bind(&LLLandmarksPanel::isActionEnabled, this, _2));
+ mGearLandmarkMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_places_gear_landmark.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mGearFolderMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_places_gear_folder.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mSortingMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_places_gear_sorting.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mAddMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_place_add_button.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if (mGearLandmarkMenu)
{
@@ -490,30 +490,30 @@ void LLLandmarksPanel::initListCommandsHandlers()
void LLLandmarksPanel::updateMenuVisibility(LLUICtrl* menu)
{
- onMenuVisibilityChange(menu, LLSD().with("visibility", true));
+ onMenuVisibilityChange(menu, LLSD().with("visibility", true));
}
void LLLandmarksPanel::onTrashButtonClick() const
{
- onClipboardAction("delete");
+ onClipboardAction("delete");
}
void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
{
- LLFolderViewModelItemInventory* view_model = getCurSelectedViewModelItem();
- LLFolderViewItem* item = getCurSelectedItem();
+ LLFolderViewModelItemInventory* view_model = getCurSelectedViewModelItem();
+ LLFolderViewItem* item = getCurSelectedItem();
- std::string command_name = userdata.asString();
- if("add_landmark" == command_name
+ std::string command_name = userdata.asString();
+ if("add_landmark" == command_name
|| "add_landmark_root" == command_name)
- {
- LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
- if(landmark)
- {
- LLNotificationsUtil::add("LandmarkAlreadyExists");
- }
- else
- {
+ {
+ LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
+ if(landmark)
+ {
+ LLNotificationsUtil::add("LandmarkAlreadyExists");
+ }
+ else
+ {
LLSD args;
args["type"] = "create_landmark";
if ("add_landmark" == command_name
@@ -527,40 +527,40 @@ void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
args["dest_folder"] = mLandmarksInventoryPanel->getRootFolderID();
}
// else will end up in favorites
- LLFloaterReg::showInstance("add_landmark", args);
- }
- }
- else if ("category" == command_name)
- {
- if (item && mCurrentSelectedList == mLandmarksInventoryPanel)
- {
- LLFolderViewModelItem* folder_bridge = NULL;
-
- if (view_model->getInventoryType()
- == LLInventoryType::IT_LANDMARK)
- {
- // for a landmark get parent folder bridge
- folder_bridge = item->getParentFolder()->getViewModelItem();
- }
- else if (view_model->getInventoryType()
- == LLInventoryType::IT_CATEGORY)
- {
- // for a folder get its own bridge
- folder_bridge = view_model;
- }
-
- menu_create_inventory_item(mCurrentSelectedList,
- dynamic_cast<LLFolderBridge*> (folder_bridge), LLSD(
- "category"), gInventory.findCategoryUUIDForType(
- LLFolderType::FT_LANDMARK));
- }
- else
- {
- //in case My Landmarks tab is completely empty (thus cannot be determined as being selected)
- menu_create_inventory_item(mLandmarksInventoryPanel, NULL, LLSD("category"),
- gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));
- }
- }
+ LLFloaterReg::showInstance("add_landmark", args);
+ }
+ }
+ else if ("category" == command_name)
+ {
+ if (item && mCurrentSelectedList == mLandmarksInventoryPanel)
+ {
+ LLFolderViewModelItem* folder_bridge = NULL;
+
+ if (view_model->getInventoryType()
+ == LLInventoryType::IT_LANDMARK)
+ {
+ // for a landmark get parent folder bridge
+ folder_bridge = item->getParentFolder()->getViewModelItem();
+ }
+ else if (view_model->getInventoryType()
+ == LLInventoryType::IT_CATEGORY)
+ {
+ // for a folder get its own bridge
+ folder_bridge = view_model;
+ }
+
+ menu_create_inventory_item(mCurrentSelectedList,
+ dynamic_cast<LLFolderBridge*> (folder_bridge), LLSD(
+ "category"), gInventory.findCategoryUUIDForType(
+ LLFolderType::FT_LANDMARK));
+ }
+ else
+ {
+ //in case My Landmarks tab is completely empty (thus cannot be determined as being selected)
+ menu_create_inventory_item(mLandmarksInventoryPanel, NULL, LLSD("category"),
+ gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));
+ }
+ }
else if ("category_root" == command_name)
{
//in case My Landmarks tab is completely empty (thus cannot be determined as being selected)
@@ -571,180 +571,180 @@ void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
void LLLandmarksPanel::onClipboardAction(const LLSD& userdata) const
{
- if(!mCurrentSelectedList)
- return;
- std::string command_name = userdata.asString();
+ if(!mCurrentSelectedList)
+ return;
+ std::string command_name = userdata.asString();
if("copy_slurl" == command_name)
- {
- LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
- if(cur_item)
- LLLandmarkActions::copySLURLtoClipboard(cur_item->getUUID());
- }
- else if ( "paste" == command_name)
- {
- mCurrentSelectedList->getRootFolder()->paste();
- }
- else if ( "cut" == command_name)
- {
- mCurrentSelectedList->getRootFolder()->cut();
- }
- else
- {
- mCurrentSelectedList->doToSelected(command_name);
- }
+ {
+ LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
+ if(cur_item)
+ LLLandmarkActions::copySLURLtoClipboard(cur_item->getUUID());
+ }
+ else if ( "paste" == command_name)
+ {
+ mCurrentSelectedList->getRootFolder()->paste();
+ }
+ else if ( "cut" == command_name)
+ {
+ mCurrentSelectedList->getRootFolder()->cut();
+ }
+ else
+ {
+ mCurrentSelectedList->doToSelected(command_name);
+ }
}
void LLLandmarksPanel::onFoldingAction(const LLSD& userdata)
{
- std::string command_name = userdata.asString();
-
- if ("expand_all" == command_name)
- {
- expand_all_folders(mCurrentSelectedList->getRootFolder());
- }
- else if ("collapse_all" == command_name)
- {
- collapse_all_folders(mCurrentSelectedList->getRootFolder());
- }
- else if ("sort_by_date" == command_name)
- {
- bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
- sorting_order=!sorting_order;
- gSavedSettings.setBOOL("LandmarksSortedByDate",sorting_order);
- updateSortOrder(mLandmarksInventoryPanel, sorting_order);
- }
- else
- {
- if(mCurrentSelectedList)
- {
- mCurrentSelectedList->doToSelected(userdata);
- }
- }
+ std::string command_name = userdata.asString();
+
+ if ("expand_all" == command_name)
+ {
+ expand_all_folders(mCurrentSelectedList->getRootFolder());
+ }
+ else if ("collapse_all" == command_name)
+ {
+ collapse_all_folders(mCurrentSelectedList->getRootFolder());
+ }
+ else if ("sort_by_date" == command_name)
+ {
+ bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
+ sorting_order=!sorting_order;
+ gSavedSettings.setBOOL("LandmarksSortedByDate",sorting_order);
+ updateSortOrder(mLandmarksInventoryPanel, sorting_order);
+ }
+ else
+ {
+ if(mCurrentSelectedList)
+ {
+ mCurrentSelectedList->doToSelected(userdata);
+ }
+ }
}
bool LLLandmarksPanel::isActionChecked(const LLSD& userdata) const
{
- const std::string command_name = userdata.asString();
+ const std::string command_name = userdata.asString();
- if ( "sort_by_date" == command_name)
- {
- bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
- return sorting_order;
- }
+ if ( "sort_by_date" == command_name)
+ {
+ bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
+ return sorting_order;
+ }
- return false;
+ return false;
}
bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
{
- std::string command_name = userdata.asString();
-
- LLFolderView* root_folder_view = mCurrentSelectedList
- ? mCurrentSelectedList->getRootFolder()
- : NULL;
-
- bool is_single_selection = root_folder_view && root_folder_view->getSelectedCount() == 1;
-
- if ("collapse_all" == command_name)
- {
- return has_expanded_folders(mCurrentSelectedList->getRootFolder());
- }
- else if ("expand_all" == command_name)
- {
- return has_collapsed_folders(mCurrentSelectedList->getRootFolder());
- }
- else if ("sort_by_date" == command_name)
- {
- // disable "sort_by_date" for Favorites tab because
- // it has its own items order. EXT-1758
- if (!isLandmarksPanel)
- {
- return false;
- }
- }
- else if ( "paste" == command_name
- || "cut" == command_name
- || "copy" == command_name
- || "delete" == command_name
- || "collapse" == command_name
- || "expand" == command_name
- )
- {
- if (!root_folder_view) return false;
-
- std::set<LLFolderViewItem*> selected_uuids = root_folder_view->getSelectionList();
-
- if (selected_uuids.empty())
- {
- return false;
- }
-
- // Allow to execute the command only if it can be applied to all selected items.
- for (std::set<LLFolderViewItem*>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
- {
- LLFolderViewItem* item = *iter;
-
- if (!item) return false;
-
- if (!canItemBeModified(command_name, item)) return false;
- }
-
- return true;
- }
- else if ( "teleport" == command_name
- || "more_info" == command_name
- || "show_on_map" == command_name
- || "copy_slurl" == command_name
- || "rename" == command_name
- )
- {
- // disable some commands for multi-selection. EXT-1757
- if (!is_single_selection)
- {
- return false;
- }
-
- if ("show_on_map" == command_name)
- {
- LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
- if (!cur_item) return false;
-
- LLViewerInventoryItem* inv_item = dynamic_cast<LLViewerInventoryItem*>(cur_item->getInventoryObject());
- if (!inv_item) return false;
-
- LLUUID asset_uuid = inv_item->getAssetUUID();
- if (asset_uuid.isNull()) return false;
-
- // Disable "Show on Map" if landmark loading is in progress.
- return !gLandmarkList.isAssetInLoadedCallbackMap(asset_uuid);
- }
- else if ("rename" == command_name)
- {
- LLFolderViewItem* selected_item = getCurSelectedItem();
- if (!selected_item) return false;
-
- return canItemBeModified(command_name, selected_item);
- }
-
- return true;
- }
+ std::string command_name = userdata.asString();
+
+ LLFolderView* root_folder_view = mCurrentSelectedList
+ ? mCurrentSelectedList->getRootFolder()
+ : NULL;
+
+ bool is_single_selection = root_folder_view && root_folder_view->getSelectedCount() == 1;
+
+ if ("collapse_all" == command_name)
+ {
+ return has_expanded_folders(mCurrentSelectedList->getRootFolder());
+ }
+ else if ("expand_all" == command_name)
+ {
+ return has_collapsed_folders(mCurrentSelectedList->getRootFolder());
+ }
+ else if ("sort_by_date" == command_name)
+ {
+ // disable "sort_by_date" for Favorites tab because
+ // it has its own items order. EXT-1758
+ if (!isLandmarksPanel)
+ {
+ return false;
+ }
+ }
+ else if ( "paste" == command_name
+ || "cut" == command_name
+ || "copy" == command_name
+ || "delete" == command_name
+ || "collapse" == command_name
+ || "expand" == command_name
+ )
+ {
+ if (!root_folder_view) return false;
+
+ std::set<LLFolderViewItem*> selected_uuids = root_folder_view->getSelectionList();
+
+ if (selected_uuids.empty())
+ {
+ return false;
+ }
+
+ // Allow to execute the command only if it can be applied to all selected items.
+ for (std::set<LLFolderViewItem*>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
+ {
+ LLFolderViewItem* item = *iter;
+
+ if (!item) return false;
+
+ if (!canItemBeModified(command_name, item)) return false;
+ }
+
+ return true;
+ }
+ else if ( "teleport" == command_name
+ || "more_info" == command_name
+ || "show_on_map" == command_name
+ || "copy_slurl" == command_name
+ || "rename" == command_name
+ )
+ {
+ // disable some commands for multi-selection. EXT-1757
+ if (!is_single_selection)
+ {
+ return false;
+ }
+
+ if ("show_on_map" == command_name)
+ {
+ LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
+ if (!cur_item) return false;
+
+ LLViewerInventoryItem* inv_item = dynamic_cast<LLViewerInventoryItem*>(cur_item->getInventoryObject());
+ if (!inv_item) return false;
+
+ LLUUID asset_uuid = inv_item->getAssetUUID();
+ if (asset_uuid.isNull()) return false;
+
+ // Disable "Show on Map" if landmark loading is in progress.
+ return !gLandmarkList.isAssetInLoadedCallbackMap(asset_uuid);
+ }
+ else if ("rename" == command_name)
+ {
+ LLFolderViewItem* selected_item = getCurSelectedItem();
+ if (!selected_item) return false;
+
+ return canItemBeModified(command_name, selected_item);
+ }
+
+ return true;
+ }
if ("category_root" == command_name || "category" == command_name)
{
- // we can add folder only in Landmarks tab
- return isLandmarksPanel;
- }
- else if("create_pick" == command_name)
- {
- if (mCurrentSelectedList)
- {
- std::set<LLFolderViewItem*> selection = mCurrentSelectedList->getRootFolder()->getSelectionList();
- if (!selection.empty())
- {
- return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() );
- }
- }
- return false;
- }
+ // we can add folder only in Landmarks tab
+ return isLandmarksPanel;
+ }
+ else if("create_pick" == command_name)
+ {
+ if (mCurrentSelectedList)
+ {
+ std::set<LLFolderViewItem*> selection = mCurrentSelectedList->getRootFolder()->getSelectionList();
+ if (!selection.empty())
+ {
+ return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() );
+ }
+ }
+ return false;
+ }
else if ("add_landmark" == command_name)
{
if (!is_single_selection)
@@ -787,143 +787,143 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
}
return true;
}
- else if (command_name == "move_to_landmarks" || command_name == "move_to_favorites")
- {
- LLFolderViewModelItemInventory* cur_item_model = getCurSelectedViewModelItem();
- if (cur_item_model)
- {
- LLFolderType::EType folder_type = command_name == "move_to_landmarks" ? LLFolderType::FT_FAVORITE : LLFolderType::FT_LANDMARK;
- if (!gInventory.isObjectDescendentOf(cur_item_model->getUUID(), gInventory.findCategoryUUIDForType(folder_type)))
- {
- return false;
- }
-
- if (root_folder_view)
- {
- std::set<LLFolderViewItem*> selected_uuids = root_folder_view->getSelectionList();
- for (std::set<LLFolderViewItem*>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
- {
- LLFolderViewItem* item = *iter;
- if (!item) return false;
-
- cur_item_model = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
- if (!cur_item_model || cur_item_model->getInventoryType() != LLInventoryType::IT_LANDMARK)
- {
- return false;
- }
- }
- return true;
- }
- }
- return false;
- }
- else
- {
- LL_WARNS() << "Unprocessed command has come: " << command_name << LL_ENDL;
- }
-
- return true;
+ else if (command_name == "move_to_landmarks" || command_name == "move_to_favorites")
+ {
+ LLFolderViewModelItemInventory* cur_item_model = getCurSelectedViewModelItem();
+ if (cur_item_model)
+ {
+ LLFolderType::EType folder_type = command_name == "move_to_landmarks" ? LLFolderType::FT_FAVORITE : LLFolderType::FT_LANDMARK;
+ if (!gInventory.isObjectDescendentOf(cur_item_model->getUUID(), gInventory.findCategoryUUIDForType(folder_type)))
+ {
+ return false;
+ }
+
+ if (root_folder_view)
+ {
+ std::set<LLFolderViewItem*> selected_uuids = root_folder_view->getSelectionList();
+ for (std::set<LLFolderViewItem*>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
+ {
+ LLFolderViewItem* item = *iter;
+ if (!item) return false;
+
+ cur_item_model = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
+ if (!cur_item_model || cur_item_model->getInventoryType() != LLInventoryType::IT_LANDMARK)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+ else
+ {
+ LL_WARNS() << "Unprocessed command has come: " << command_name << LL_ENDL;
+ }
+
+ return true;
}
void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
{
- std::string command_name = userdata.asString();
- if("more_info" == command_name)
- {
- onShowProfile();
- }
- else if ("teleport" == command_name)
- {
- onTeleport();
- }
- else if ("show_on_map" == command_name)
- {
- onShowOnMap();
- }
- else if ("create_pick" == command_name)
- {
+ std::string command_name = userdata.asString();
+ if("more_info" == command_name)
+ {
+ onShowProfile();
+ }
+ else if ("teleport" == command_name)
+ {
+ onTeleport();
+ }
+ else if ("show_on_map" == command_name)
+ {
+ onShowOnMap();
+ }
+ else if ("create_pick" == command_name)
+ {
LLFolderViewModelItemInventory* cur_item = getCurSelectedViewModelItem();
if (cur_item)
{
doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doCreatePick, this, _1, cur_item->getUUID()));
}
- }
+ }
else if ("share" == command_name && mCurrentSelectedList)
{
LLAvatarActions::shareWithAvatars(mCurrentSelectedList);
}
- else if ("restore" == command_name && mCurrentSelectedList)
- {
- mCurrentSelectedList->doToSelected(userdata);
- }
- else if (command_name == "move_to_landmarks" || command_name == "move_to_favorites")
- {
- LLFolderView* root_folder_view = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : NULL;
- if (root_folder_view)
- {
- LLFolderType::EType folder_type = command_name == "move_to_landmarks" ? LLFolderType::FT_LANDMARK : LLFolderType::FT_FAVORITE;
- std::set<LLFolderViewItem*> selected_uuids = root_folder_view->getSelectionList();
- for (std::set<LLFolderViewItem*>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
- {
- LLFolderViewItem* item = *iter;
- if (item)
- {
- LLFolderViewModelItemInventory* item_model = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
- if (item_model)
- {
- change_item_parent(item_model->getUUID(), gInventory.findCategoryUUIDForType(folder_type));
- }
- }
- }
- }
-
- }
+ else if ("restore" == command_name && mCurrentSelectedList)
+ {
+ mCurrentSelectedList->doToSelected(userdata);
+ }
+ else if (command_name == "move_to_landmarks" || command_name == "move_to_favorites")
+ {
+ LLFolderView* root_folder_view = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : NULL;
+ if (root_folder_view)
+ {
+ LLFolderType::EType folder_type = command_name == "move_to_landmarks" ? LLFolderType::FT_LANDMARK : LLFolderType::FT_FAVORITE;
+ std::set<LLFolderViewItem*> selected_uuids = root_folder_view->getSelectionList();
+ for (std::set<LLFolderViewItem*>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
+ {
+ LLFolderViewItem* item = *iter;
+ if (item)
+ {
+ LLFolderViewModelItemInventory* item_model = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
+ if (item_model)
+ {
+ change_item_parent(item_model->getUUID(), gInventory.findCategoryUUIDForType(folder_type));
+ }
+ }
+ }
+ }
+
+ }
}
void LLLandmarksPanel::onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param)
{
- bool new_visibility = param["visibility"].asBoolean();
+ bool new_visibility = param["visibility"].asBoolean();
- // We don't have to update items visibility if the menu is hiding.
- if (!new_visibility) return;
+ // We don't have to update items visibility if the menu is hiding.
+ if (!new_visibility) return;
- BOOL are_any_items_in_trash = FALSE;
- BOOL are_all_items_in_trash = TRUE;
+ BOOL are_any_items_in_trash = FALSE;
+ BOOL are_all_items_in_trash = TRUE;
- LLFolderView* root_folder_view = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : NULL;
- if(root_folder_view)
- {
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLFolderView* root_folder_view = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : NULL;
+ if(root_folder_view)
+ {
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- std::set<LLFolderViewItem*> selected_items = root_folder_view->getSelectionList();
+ std::set<LLFolderViewItem*> selected_items = root_folder_view->getSelectionList();
- // Iterate through selected items to find out if any of these items are in Trash
- // or all the items are in Trash category.
- for (std::set<LLFolderViewItem*>::const_iterator iter = selected_items.begin(); iter != selected_items.end(); ++iter)
- {
- LLFolderViewItem* item = *iter;
+ // Iterate through selected items to find out if any of these items are in Trash
+ // or all the items are in Trash category.
+ for (std::set<LLFolderViewItem*>::const_iterator iter = selected_items.begin(); iter != selected_items.end(); ++iter)
+ {
+ LLFolderViewItem* item = *iter;
- // If no item is found it might be a folder id.
- if (!item) continue;
+ // If no item is found it might be a folder id.
+ if (!item) continue;
- LLFolderViewModelItemInventory* listenerp = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
- if(!listenerp) continue;
+ LLFolderViewModelItemInventory* listenerp = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
+ if(!listenerp) continue;
- // Trash category itself should not be included because it can't be
- // actually restored from trash.
- are_all_items_in_trash &= listenerp->isItemInTrash() && listenerp->getUUID() != trash_id;
+ // Trash category itself should not be included because it can't be
+ // actually restored from trash.
+ are_all_items_in_trash &= listenerp->isItemInTrash() && listenerp->getUUID() != trash_id;
- // If there are any selected items in Trash including the Trash category itself
- // we show "Restore Item" in context menu and hide other irrelevant items.
- are_any_items_in_trash |= listenerp->isItemInTrash();
- }
- }
+ // If there are any selected items in Trash including the Trash category itself
+ // we show "Restore Item" in context menu and hide other irrelevant items.
+ are_any_items_in_trash |= listenerp->isItemInTrash();
+ }
+ }
- // Display "Restore Item" menu entry if at least one of the selected items
- // is in Trash or the Trash category itself is among selected items.
- // Hide other menu entries in this case.
- // Enable this menu entry only if all selected items are in the Trash category.
- toggle_restore_menu((LLMenuGL*)ctrl, are_any_items_in_trash, are_all_items_in_trash);
+ // Display "Restore Item" menu entry if at least one of the selected items
+ // is in Trash or the Trash category itself is among selected items.
+ // Hide other menu entries in this case.
+ // Enable this menu entry only if all selected items are in the Trash category.
+ toggle_restore_menu((LLMenuGL*)ctrl, are_any_items_in_trash, are_all_items_in_trash);
}
/*
@@ -932,133 +932,133 @@ Processes such actions: cut/rename/delete/paste actions
Rules:
1. We can't perform any action in Library
2. For Landmarks we can:
- - cut/rename/delete in any other accordions
- - paste - only in Favorites, Landmarks accordions
+ - cut/rename/delete in any other accordions
+ - paste - only in Favorites, Landmarks accordions
3. For Folders we can: perform any action in Landmarks accordion, except Received folder
4. We can paste folders from Clipboard (processed by LLFolderView::canPaste())
5. Check LLFolderView/Inventory Bridges rules
*/
bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFolderViewItem* item) const
{
- // validate own rules first
-
- if (!item) return false;
-
- bool can_be_modified = false;
-
- // landmarks can be modified in any other accordion...
- if (static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem())->getInventoryType() == LLInventoryType::IT_LANDMARK)
- {
- can_be_modified = true;
- }
- else
- {
- // ...folders only in the Landmarks accordion...
- can_be_modified = isLandmarksPanel;
- }
-
- // then ask LLFolderView permissions
-
- LLFolderView* root_folder = mCurrentSelectedList->getRootFolder();
-
- if ("copy" == command_name)
- {
- // we shouldn't be able to copy folders from My Inventory Panel
- return can_be_modified && root_folder->canCopy();
- }
- else if ("collapse" == command_name)
- {
- return item->isOpen();
- }
- else if ("expand" == command_name)
- {
- return !item->isOpen();
- }
-
- if (can_be_modified)
- {
- LLFolderViewModelItemInventory* listenerp = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
-
- if ("cut" == command_name)
- {
- can_be_modified = root_folder->canCut();
- }
- else if ("rename" == command_name)
- {
- can_be_modified = listenerp ? listenerp->isItemRenameable() : false;
- }
- else if ("delete" == command_name)
- {
- can_be_modified = listenerp ? listenerp->isItemRemovable() && !listenerp->isItemInTrash() : false;
- }
- else if("paste" == command_name)
- {
- can_be_modified = root_folder->canPaste();
- }
- else
- {
- LL_WARNS() << "Unprocessed command has come: " << command_name << LL_ENDL;
- }
- }
-
- return can_be_modified;
+ // validate own rules first
+
+ if (!item) return false;
+
+ bool can_be_modified = false;
+
+ // landmarks can be modified in any other accordion...
+ if (static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem())->getInventoryType() == LLInventoryType::IT_LANDMARK)
+ {
+ can_be_modified = true;
+ }
+ else
+ {
+ // ...folders only in the Landmarks accordion...
+ can_be_modified = isLandmarksPanel;
+ }
+
+ // then ask LLFolderView permissions
+
+ LLFolderView* root_folder = mCurrentSelectedList->getRootFolder();
+
+ if ("copy" == command_name)
+ {
+ // we shouldn't be able to copy folders from My Inventory Panel
+ return can_be_modified && root_folder->canCopy();
+ }
+ else if ("collapse" == command_name)
+ {
+ return item->isOpen();
+ }
+ else if ("expand" == command_name)
+ {
+ return !item->isOpen();
+ }
+
+ if (can_be_modified)
+ {
+ LLFolderViewModelItemInventory* listenerp = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
+
+ if ("cut" == command_name)
+ {
+ can_be_modified = root_folder->canCut();
+ }
+ else if ("rename" == command_name)
+ {
+ can_be_modified = listenerp ? listenerp->isItemRenameable() : false;
+ }
+ else if ("delete" == command_name)
+ {
+ can_be_modified = listenerp ? listenerp->isItemRemovable() && !listenerp->isItemInTrash() : false;
+ }
+ else if("paste" == command_name)
+ {
+ can_be_modified = root_folder->canPaste();
+ }
+ else
+ {
+ LL_WARNS() << "Unprocessed command has come: " << command_name << LL_ENDL;
+ }
+ }
+
+ return can_be_modified;
}
bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data , EAcceptance* accept)
{
- *accept = ACCEPT_NO;
-
- switch (cargo_type)
- {
-
- case DAD_LANDMARK:
- case DAD_CATEGORY:
- {
- bool is_enabled = isActionEnabled("delete");
-
- if (is_enabled) *accept = ACCEPT_YES_MULTI;
-
- if (is_enabled && drop)
- {
- // don't call onClipboardAction("delete")
- // this lead to removing (N * 2 - 1) items if drag N>1 items into trash. EXT-6757
- // So, let remove items one by one.
- LLInventoryItem* item = static_cast<LLInventoryItem*>(cargo_data);
- if (item)
- {
- LLFolderViewItem* fv_item = mCurrentSelectedList
- ? mCurrentSelectedList->getItemByID(item->getUUID())
- : NULL;
-
- if (fv_item)
- {
- // is Item Removable checked inside of remove()
- fv_item->remove();
- }
- }
- }
- }
- break;
- default:
- break;
- }
-
- updateVerbs();
- return true;
+ *accept = ACCEPT_NO;
+
+ switch (cargo_type)
+ {
+
+ case DAD_LANDMARK:
+ case DAD_CATEGORY:
+ {
+ bool is_enabled = isActionEnabled("delete");
+
+ if (is_enabled) *accept = ACCEPT_YES_MULTI;
+
+ if (is_enabled && drop)
+ {
+ // don't call onClipboardAction("delete")
+ // this lead to removing (N * 2 - 1) items if drag N>1 items into trash. EXT-6757
+ // So, let remove items one by one.
+ LLInventoryItem* item = static_cast<LLInventoryItem*>(cargo_data);
+ if (item)
+ {
+ LLFolderViewItem* fv_item = mCurrentSelectedList
+ ? mCurrentSelectedList->getItemByID(item->getUUID())
+ : NULL;
+
+ if (fv_item)
+ {
+ // is Item Removable checked inside of remove()
+ fv_item->remove();
+ }
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ updateVerbs();
+ return true;
}
void LLLandmarksPanel::doShowOnMap(LLLandmark* landmark)
{
- LLVector3d landmark_global_pos;
- if (!landmark->getGlobalPos(landmark_global_pos))
- return;
+ LLVector3d landmark_global_pos;
+ if (!landmark->getGlobalPos(landmark_global_pos))
+ return;
- LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
- if (!landmark_global_pos.isExactlyZero() && worldmap_instance)
- {
- worldmap_instance->trackLocation(landmark_global_pos);
- LLFloaterReg::showInstance("world_map", "center");
- }
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+ if (!landmark_global_pos.isExactlyZero() && worldmap_instance)
+ {
+ worldmap_instance->trackLocation(landmark_global_pos);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
if (mGearLandmarkMenu)
{
@@ -1067,18 +1067,18 @@ void LLLandmarksPanel::doShowOnMap(LLLandmark* landmark)
}
void LLLandmarksPanel::doProcessParcelInfo(LLLandmark* landmark,
- LLInventoryItem* inv_item,
- const LLParcelData& parcel_data)
+ LLInventoryItem* inv_item,
+ const LLParcelData& parcel_data)
{
- LLVector3d landmark_global_pos;
- landmark->getGlobalPos(landmark_global_pos);
+ LLVector3d landmark_global_pos;
+ landmark->getGlobalPos(landmark_global_pos);
- LLPickData data;
- data.pos_global = landmark_global_pos;
- data.name = inv_item->getName();
- data.desc = inv_item->getDescription();
- data.snapshot_id = parcel_data.snapshot_id;
- data.parcel_id = parcel_data.parcel_id;
+ LLPickData data;
+ data.pos_global = landmark_global_pos;
+ data.name = inv_item->getName();
+ data.desc = inv_item->getDescription();
+ data.snapshot_id = parcel_data.snapshot_id;
+ data.parcel_id = parcel_data.parcel_id;
LLFloaterProfile* profile_floater = dynamic_cast<LLFloaterProfile*>(LLFloaterReg::showInstance("profile", LLSD().with("id", gAgentID)));
if (profile_floater)
@@ -1089,32 +1089,32 @@ void LLLandmarksPanel::doProcessParcelInfo(LLLandmark* landmark,
void LLLandmarksPanel::doCreatePick(LLLandmark* landmark, const LLUUID &item_id)
{
- LLViewerRegion* region = gAgent.getRegion();
- if (!region) return;
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region) return;
mCreatePickItemId = item_id;
- LLGlobalVec pos_global;
- LLUUID region_id;
- landmark->getGlobalPos(pos_global);
- landmark->getRegionID(region_id);
- LLVector3 region_pos((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
- (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
- (F32)pos_global.mdV[VZ]);
-
- LLSD body;
- std::string url = region->getCapability("RemoteParcelRequest");
- if (!url.empty())
- {
+ LLGlobalVec pos_global;
+ LLUUID region_id;
+ landmark->getGlobalPos(pos_global);
+ landmark->getRegionID(region_id);
+ LLVector3 region_pos((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
+ (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
+ (F32)pos_global.mdV[VZ]);
+
+ LLSD body;
+ std::string url = region->getCapability("RemoteParcelRequest");
+ if (!url.empty())
+ {
LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url,
region_id, region_pos, pos_global, getObserverHandle());
- }
- else
- {
- LL_WARNS() << "Can't create pick for landmark for region" << region_id
- << ". Region: " << region->getName()
- << " does not support RemoteParcelRequest" << LL_ENDL;
- }
+ }
+ else
+ {
+ LL_WARNS() << "Can't create pick for landmark for region" << region_id
+ << ". Region: " << region->getName()
+ << " does not support RemoteParcelRequest" << LL_ENDL;
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -1122,74 +1122,74 @@ void LLLandmarksPanel::doCreatePick(LLLandmark* landmark, const LLUUID &item_id)
//////////////////////////////////////////////////////////////////////////
static void filter_list(LLPlacesInventoryPanel* inventory_list, const std::string& string)
{
- // When search is cleared, restore the old folder state.
- if (!inventory_list->getFilterSubString().empty() && string == "")
- {
- inventory_list->setFilterSubString(LLStringUtil::null);
- // Re-open folders that were open before
- inventory_list->restoreFolderState();
- }
-
- if (inventory_list->getFilterSubString().empty() && string.empty())
- {
- // current filter and new filter empty, do nothing
- return;
- }
-
- // save current folder open state if no filter currently applied
- if (inventory_list->getFilterSubString().empty())
- {
- inventory_list->saveFolderState();
- }
-
- // Set new filter string
- inventory_list->setFilterSubString(string);
+ // When search is cleared, restore the old folder state.
+ if (!inventory_list->getFilterSubString().empty() && string == "")
+ {
+ inventory_list->setFilterSubString(LLStringUtil::null);
+ // Re-open folders that were open before
+ inventory_list->restoreFolderState();
+ }
+
+ if (inventory_list->getFilterSubString().empty() && string.empty())
+ {
+ // current filter and new filter empty, do nothing
+ return;
+ }
+
+ // save current folder open state if no filter currently applied
+ if (inventory_list->getFilterSubString().empty())
+ {
+ inventory_list->saveFolderState();
+ }
+
+ // Set new filter string
+ inventory_list->setFilterSubString(string);
}
static void collapse_all_folders(LLFolderView* root_folder)
{
- if (!root_folder)
- return;
+ if (!root_folder)
+ return;
- root_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN);
- root_folder->arrangeAll();
+ root_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN);
+ root_folder->arrangeAll();
}
static void expand_all_folders(LLFolderView* root_folder)
{
- if (!root_folder)
- return;
+ if (!root_folder)
+ return;
- root_folder->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
- root_folder->arrangeAll();
+ root_folder->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
+ root_folder->arrangeAll();
}
static bool has_expanded_folders(LLFolderView* root_folder)
{
- LLCheckFolderState checker;
- root_folder->applyFunctorRecursively(checker);
+ LLCheckFolderState checker;
+ root_folder->applyFunctorRecursively(checker);
- // We assume that the root folder is always expanded so we enable "collapse_all"
- // command when we have at least one more expanded folder.
- if (checker.getExpandedFolders() < 2)
- {
- return false;
- }
+ // We assume that the root folder is always expanded so we enable "collapse_all"
+ // command when we have at least one more expanded folder.
+ if (checker.getExpandedFolders() < 2)
+ {
+ return false;
+ }
- return true;
+ return true;
}
static bool has_collapsed_folders(LLFolderView* root_folder)
{
- LLCheckFolderState checker;
- root_folder->applyFunctorRecursively(checker);
+ LLCheckFolderState checker;
+ root_folder->applyFunctorRecursively(checker);
- if (checker.getCollapsedFolders() < 1)
- {
- return false;
- }
+ if (checker.getCollapsedFolders() < 1)
+ {
+ return false;
+ }
- return true;
+ return true;
}
// Displays "Restore Item" context menu entry while hiding
@@ -1197,52 +1197,52 @@ static bool has_collapsed_folders(LLFolderView* root_folder)
// Sets "Restore Item" enabled state.
void toggle_restore_menu(LLMenuGL *menu, BOOL visible, BOOL enabled)
{
- if (!menu) return;
-
- const LLView::child_list_t *list = menu->getChildList();
- for (LLView::child_list_t::const_iterator itor = list->begin();
- itor != list->end();
- ++itor)
- {
- LLView *menu_item = (*itor);
- std::string name = menu_item->getName();
-
- if ("restore_item" == name)
- {
- menu_item->setVisible(visible);
- menu_item->setEnabled(enabled);
- }
- else
- {
- menu_item->setVisible(!visible);
- }
- }
+ if (!menu) return;
+
+ const LLView::child_list_t *list = menu->getChildList();
+ for (LLView::child_list_t::const_iterator itor = list->begin();
+ itor != list->end();
+ ++itor)
+ {
+ LLView *menu_item = (*itor);
+ std::string name = menu_item->getName();
+
+ if ("restore_item" == name)
+ {
+ menu_item->setVisible(visible);
+ menu_item->setEnabled(enabled);
+ }
+ else
+ {
+ menu_item->setVisible(!visible);
+ }
+ }
}
LLFavoritesPanel::LLFavoritesPanel()
- : LLLandmarksPanel(false)
+ : LLLandmarksPanel(false)
{
- buildFromFile("panel_favorites.xml");
+ buildFromFile("panel_favorites.xml");
}
BOOL LLFavoritesPanel::postBuild()
{
- if (!gInventory.isInventoryUsable())
- return FALSE;
+ if (!gInventory.isInventoryUsable())
+ return FALSE;
- // mast be called before any other initXXX methods to init Gear menu
- LLLandmarksPanel::initListCommandsHandlers();
+ // mast be called before any other initXXX methods to init Gear menu
+ LLLandmarksPanel::initListCommandsHandlers();
- initFavoritesInventoryPanel();
+ initFavoritesInventoryPanel();
- return TRUE;
+ return TRUE;
}
void LLFavoritesPanel::initFavoritesInventoryPanel()
{
- mCurrentSelectedList = getChild<LLPlacesInventoryPanel>("favorites_list");
+ mCurrentSelectedList = getChild<LLPlacesInventoryPanel>("favorites_list");
- LLLandmarksPanel::initLandmarksPanel(mCurrentSelectedList);
- mCurrentSelectedList->getFilter().setEmptyLookupMessage("FavoritesNoMatchingItems");
+ LLLandmarksPanel::initLandmarksPanel(mCurrentSelectedList);
+ mCurrentSelectedList->getFilter().setEmptyLookupMessage("FavoritesNoMatchingItems");
}
// EOF
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index 16f3a5dc24..227451607e 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,18 +48,18 @@ class LLFolderViewModelItemInventory;
class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
{
public:
- LLLandmarksPanel();
- LLLandmarksPanel(bool is_landmark_panel);
- virtual ~LLLandmarksPanel();
-
- BOOL postBuild() override;
- void onSearchEdit(const std::string& string) override;
- void onShowOnMap() override;
- void onShowProfile() override;
- void onTeleport() override;
- void onRemoveSelected() override;
- void updateVerbs() override;
- bool isSingleItemSelected() override;
+ LLLandmarksPanel();
+ LLLandmarksPanel(bool is_landmark_panel);
+ virtual ~LLLandmarksPanel();
+
+ BOOL postBuild() override;
+ void onSearchEdit(const std::string& string) override;
+ void onShowOnMap() override;
+ void onShowProfile() override;
+ void onTeleport() override;
+ void onRemoveSelected() override;
+ void updateVerbs() override;
+ bool isSingleItemSelected() override;
LLToggleableMenu* getSelectionMenu() override;
LLToggleableMenu* getSortingMenu() override;
@@ -70,89 +70,89 @@ public:
*/
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) override;
- void setCurrentSelectedList(LLPlacesInventoryPanel* inventory_list)
- {
- mCurrentSelectedList = inventory_list;
- }
+ void setCurrentSelectedList(LLPlacesInventoryPanel* inventory_list)
+ {
+ mCurrentSelectedList = inventory_list;
+ }
- /**
- * Selects item with "obj_id" in one of accordion tabs.
- */
- void setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus);
+ /**
+ * Selects item with "obj_id" in one of accordion tabs.
+ */
+ void setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus);
- void updateMenuVisibility(LLUICtrl* menu);
+ void updateMenuVisibility(LLUICtrl* menu);
- void doCreatePick(LLLandmark* landmark, const LLUUID &item_id );
+ void doCreatePick(LLLandmark* landmark, const LLUUID &item_id );
- void resetSelection();
+ void resetSelection();
protected:
- /**
- * @return true - if current selected panel is not null and selected item is a landmark
- */
- bool isLandmarkSelected() const;
- bool isFolderSelected() const;
- void doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb);
- LLFolderViewItem* getCurSelectedItem() const;
- LLFolderViewModelItemInventory* getCurSelectedViewModelItem() const;
-
- void updateSortOrder(LLInventoryPanel* panel, bool byDate);
-
- //LLRemoteParcelInfoObserver interface
- void processParcelInfo(const LLParcelData& parcel_data) override;
- void setParcelID(const LLUUID& parcel_id) override;
- void setErrorStatus(S32 status, const std::string& reason) override;
-
- // List Commands Handlers
- void initListCommandsHandlers();
- void initLandmarksPanel(LLPlacesInventoryPanel* inventory_list);
-
- LLPlacesInventoryPanel* mCurrentSelectedList;
-
+ /**
+ * @return true - if current selected panel is not null and selected item is a landmark
+ */
+ bool isLandmarkSelected() const;
+ bool isFolderSelected() const;
+ void doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb);
+ LLFolderViewItem* getCurSelectedItem() const;
+ LLFolderViewModelItemInventory* getCurSelectedViewModelItem() const;
+
+ void updateSortOrder(LLInventoryPanel* panel, bool byDate);
+
+ //LLRemoteParcelInfoObserver interface
+ void processParcelInfo(const LLParcelData& parcel_data) override;
+ void setParcelID(const LLUUID& parcel_id) override;
+ void setErrorStatus(S32 status, const std::string& reason) override;
+
+ // List Commands Handlers
+ void initListCommandsHandlers();
+ void initLandmarksPanel(LLPlacesInventoryPanel* inventory_list);
+
+ LLPlacesInventoryPanel* mCurrentSelectedList;
+
private:
- void initLandmarksInventoryPanel();
-
- void onTrashButtonClick() const;
- void onAddAction(const LLSD& command_name) const;
- void onClipboardAction(const LLSD& command_name) const;
- void onFoldingAction(const LLSD& command_name);
- bool isActionChecked(const LLSD& userdata) const;
- bool isActionEnabled(const LLSD& command_name) const;
- void onCustomAction(const LLSD& command_name);
-
- /**
- * Updates context menu depending on the selected items location.
- *
- * For items in Trash category the menu includes the "Restore Item"
- * context menu entry.
- */
- void onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param);
-
- /**
- * Determines if an item can be modified via context/gear menu.
- *
- * It validates Places Landmarks rules first. And then LLFolderView permissions.
- * For now it checks cut/rename/delete/paste actions.
- */
- bool canItemBeModified(const std::string& command_name, LLFolderViewItem* item) const;
-
- /**
- * Landmark actions callbacks. Fire when a landmark is loaded from the list.
- */
- void doShowOnMap(LLLandmark* landmark);
- void doProcessParcelInfo(LLLandmark* landmark,
- LLInventoryItem* inv_item,
- const LLParcelData& parcel_data);
+ void initLandmarksInventoryPanel();
+
+ void onTrashButtonClick() const;
+ void onAddAction(const LLSD& command_name) const;
+ void onClipboardAction(const LLSD& command_name) const;
+ void onFoldingAction(const LLSD& command_name);
+ bool isActionChecked(const LLSD& userdata) const;
+ bool isActionEnabled(const LLSD& command_name) const;
+ void onCustomAction(const LLSD& command_name);
+
+ /**
+ * Updates context menu depending on the selected items location.
+ *
+ * For items in Trash category the menu includes the "Restore Item"
+ * context menu entry.
+ */
+ void onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param);
+
+ /**
+ * Determines if an item can be modified via context/gear menu.
+ *
+ * It validates Places Landmarks rules first. And then LLFolderView permissions.
+ * For now it checks cut/rename/delete/paste actions.
+ */
+ bool canItemBeModified(const std::string& command_name, LLFolderViewItem* item) const;
+
+ /**
+ * Landmark actions callbacks. Fire when a landmark is loaded from the list.
+ */
+ void doShowOnMap(LLLandmark* landmark);
+ void doProcessParcelInfo(LLLandmark* landmark,
+ LLInventoryItem* inv_item,
+ const LLParcelData& parcel_data);
private:
- LLPlacesInventoryPanel* mLandmarksInventoryPanel;
- LLToggleableMenu* mGearLandmarkMenu;
- LLToggleableMenu* mGearFolderMenu;
- LLToggleableMenu* mSortingMenu;
- LLToggleableMenu* mAddMenu;
-
- bool isLandmarksPanel;
-
+ LLPlacesInventoryPanel* mLandmarksInventoryPanel;
+ LLToggleableMenu* mGearLandmarkMenu;
+ LLToggleableMenu* mGearFolderMenu;
+ LLToggleableMenu* mSortingMenu;
+ LLToggleableMenu* mAddMenu;
+
+ bool isLandmarksPanel;
+
LLUUID mCreatePickItemId; // item we requested a pick for
};
@@ -160,10 +160,10 @@ private:
class LLFavoritesPanel : public LLLandmarksPanel
{
public:
- LLFavoritesPanel();
+ LLFavoritesPanel();
- BOOL postBuild() override;
- void initFavoritesInventoryPanel();
+ BOOL postBuild() override;
+ void initFavoritesInventoryPanel();
};
#endif //LL_LLPANELLANDMARKS_H
diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp
index ca252d1455..9aff1661ff 100644
--- a/indra/newview/llpanellandmedia.cpp
+++ b/indra/newview/llpanellandmedia.cpp
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,18 +57,18 @@
//---------------------------------------------------------------------------
LLPanelLandMedia::LLPanelLandMedia(LLParcelSelectionHandle& parcel)
-: LLPanel(),
- mParcel(parcel),
- mMediaURLEdit(NULL),
- mMediaDescEdit(NULL),
- mMediaTypeCombo(NULL),
- mSetURLButton(NULL),
- mMediaHeightCtrl(NULL),
- mMediaWidthCtrl(NULL),
- mMediaSizeCtrlLabel(NULL),
- mMediaTextureCtrl(NULL),
- mMediaAutoScaleCheck(NULL),
- mMediaLoopCheck(NULL)
+: LLPanel(),
+ mParcel(parcel),
+ mMediaURLEdit(NULL),
+ mMediaDescEdit(NULL),
+ mMediaTypeCombo(NULL),
+ mSetURLButton(NULL),
+ mMediaHeightCtrl(NULL),
+ mMediaWidthCtrl(NULL),
+ mMediaSizeCtrlLabel(NULL),
+ mMediaTextureCtrl(NULL),
+ mMediaAutoScaleCheck(NULL),
+ mMediaLoopCheck(NULL)
{
}
@@ -81,249 +81,249 @@ LLPanelLandMedia::~LLPanelLandMedia()
BOOL LLPanelLandMedia::postBuild()
{
- mMediaTextureCtrl = getChild<LLTextureCtrl>("media texture");
- mMediaTextureCtrl->setCommitCallback( onCommitAny, this );
- mMediaTextureCtrl->setAllowNoTexture ( TRUE );
- mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
- mMediaTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ mMediaTextureCtrl = getChild<LLTextureCtrl>("media texture");
+ mMediaTextureCtrl->setCommitCallback( onCommitAny, this );
+ mMediaTextureCtrl->setAllowNoTexture ( TRUE );
+ mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ mMediaTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
- mMediaAutoScaleCheck = getChild<LLCheckBoxCtrl>("media_auto_scale");
- childSetCommitCallback("media_auto_scale", onCommitAny, this);
+ mMediaAutoScaleCheck = getChild<LLCheckBoxCtrl>("media_auto_scale");
+ childSetCommitCallback("media_auto_scale", onCommitAny, this);
- mMediaLoopCheck = getChild<LLCheckBoxCtrl>("media_loop");
- childSetCommitCallback("media_loop", onCommitAny, this );
+ mMediaLoopCheck = getChild<LLCheckBoxCtrl>("media_loop");
+ childSetCommitCallback("media_loop", onCommitAny, this );
- mMediaURLEdit = getChild<LLLineEditor>("media_url");
- childSetCommitCallback("media_url", onCommitAny, this );
+ mMediaURLEdit = getChild<LLLineEditor>("media_url");
+ childSetCommitCallback("media_url", onCommitAny, this );
- mMediaDescEdit = getChild<LLLineEditor>("url_description");
- childSetCommitCallback("url_description", onCommitAny, this);
+ mMediaDescEdit = getChild<LLLineEditor>("url_description");
+ childSetCommitCallback("url_description", onCommitAny, this);
- mMediaTypeCombo = getChild<LLComboBox>("media type");
- childSetCommitCallback("media type", onCommitType, this);
- populateMIMECombo();
+ mMediaTypeCombo = getChild<LLComboBox>("media type");
+ childSetCommitCallback("media type", onCommitType, this);
+ populateMIMECombo();
- mMediaWidthCtrl = getChild<LLSpinCtrl>("media_size_width");
- childSetCommitCallback("media_size_width", onCommitAny, this);
- mMediaHeightCtrl = getChild<LLSpinCtrl>("media_size_height");
- childSetCommitCallback("media_size_height", onCommitAny, this);
- mMediaSizeCtrlLabel = getChild<LLTextBox>("media_size");
+ mMediaWidthCtrl = getChild<LLSpinCtrl>("media_size_width");
+ childSetCommitCallback("media_size_width", onCommitAny, this);
+ mMediaHeightCtrl = getChild<LLSpinCtrl>("media_size_height");
+ childSetCommitCallback("media_size_height", onCommitAny, this);
+ mMediaSizeCtrlLabel = getChild<LLTextBox>("media_size");
- mSetURLButton = getChild<LLButton>("set_media_url");
- childSetAction("set_media_url", onSetBtn, this);
+ mSetURLButton = getChild<LLButton>("set_media_url");
+ childSetAction("set_media_url", onSetBtn, this);
- return TRUE;
+ return TRUE;
}
// public
void LLPanelLandMedia::refresh()
{
- LLParcel *parcel = mParcel->getParcel();
-
- if (!parcel)
- {
- clearCtrls();
- }
- else
- {
- // something selected, hooray!
-
- // Display options
- BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA);
-
- mMediaURLEdit->setText(parcel->getMediaURL());
- mMediaURLEdit->setEnabled( FALSE );
-
- getChild<LLUICtrl>("current_url")->setValue(parcel->getMediaCurrentURL());
-
- mMediaDescEdit->setText(parcel->getMediaDesc());
- mMediaDescEdit->setEnabled( can_change_media );
-
- std::string mime_type = parcel->getMediaType();
- if (mime_type.empty() || mime_type == LLMIMETypes::getDefaultMimeType())
- {
- mime_type = LLMIMETypes::getDefaultMimeTypeTranslation();
- }
- setMediaType(mime_type);
- mMediaTypeCombo->setEnabled( can_change_media );
- getChild<LLUICtrl>("mime_type")->setValue(mime_type);
-
- mMediaAutoScaleCheck->set( parcel->getMediaAutoScale () );
- mMediaAutoScaleCheck->setEnabled ( can_change_media );
-
- // Special code to disable looping checkbox for HTML MIME type
- // (DEV-10042 -- Parcel Media: "Loop Media" should be disabled for static media types)
- bool allow_looping = LLMIMETypes::findAllowLooping( mime_type );
- if ( allow_looping )
- mMediaLoopCheck->set( parcel->getMediaLoop () );
- else
- mMediaLoopCheck->set( false );
- mMediaLoopCheck->setEnabled ( can_change_media && allow_looping );
-
- // disallow media size change for mime types that don't allow it
- bool allow_resize = LLMIMETypes::findAllowResize( mime_type );
- if ( allow_resize )
- mMediaWidthCtrl->setValue( parcel->getMediaWidth() );
- else
- mMediaWidthCtrl->setValue( 0 );
- mMediaWidthCtrl->setEnabled ( can_change_media && allow_resize );
-
- if ( allow_resize )
- mMediaHeightCtrl->setValue( parcel->getMediaHeight() );
- else
- mMediaHeightCtrl->setValue( 0 );
- mMediaHeightCtrl->setEnabled ( can_change_media && allow_resize );
-
- // enable/disable for text label for completeness
- mMediaSizeCtrlLabel->setEnabled( can_change_media && allow_resize );
-
- mMediaTextureCtrl->setImageAssetID ( parcel->getMediaID() );
- mMediaTextureCtrl->setEnabled( can_change_media );
-
- mSetURLButton->setEnabled( can_change_media );
-
- }
+ LLParcel *parcel = mParcel->getParcel();
+
+ if (!parcel)
+ {
+ clearCtrls();
+ }
+ else
+ {
+ // something selected, hooray!
+
+ // Display options
+ BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA);
+
+ mMediaURLEdit->setText(parcel->getMediaURL());
+ mMediaURLEdit->setEnabled( FALSE );
+
+ getChild<LLUICtrl>("current_url")->setValue(parcel->getMediaCurrentURL());
+
+ mMediaDescEdit->setText(parcel->getMediaDesc());
+ mMediaDescEdit->setEnabled( can_change_media );
+
+ std::string mime_type = parcel->getMediaType();
+ if (mime_type.empty() || mime_type == LLMIMETypes::getDefaultMimeType())
+ {
+ mime_type = LLMIMETypes::getDefaultMimeTypeTranslation();
+ }
+ setMediaType(mime_type);
+ mMediaTypeCombo->setEnabled( can_change_media );
+ getChild<LLUICtrl>("mime_type")->setValue(mime_type);
+
+ mMediaAutoScaleCheck->set( parcel->getMediaAutoScale () );
+ mMediaAutoScaleCheck->setEnabled ( can_change_media );
+
+ // Special code to disable looping checkbox for HTML MIME type
+ // (DEV-10042 -- Parcel Media: "Loop Media" should be disabled for static media types)
+ bool allow_looping = LLMIMETypes::findAllowLooping( mime_type );
+ if ( allow_looping )
+ mMediaLoopCheck->set( parcel->getMediaLoop () );
+ else
+ mMediaLoopCheck->set( false );
+ mMediaLoopCheck->setEnabled ( can_change_media && allow_looping );
+
+ // disallow media size change for mime types that don't allow it
+ bool allow_resize = LLMIMETypes::findAllowResize( mime_type );
+ if ( allow_resize )
+ mMediaWidthCtrl->setValue( parcel->getMediaWidth() );
+ else
+ mMediaWidthCtrl->setValue( 0 );
+ mMediaWidthCtrl->setEnabled ( can_change_media && allow_resize );
+
+ if ( allow_resize )
+ mMediaHeightCtrl->setValue( parcel->getMediaHeight() );
+ else
+ mMediaHeightCtrl->setValue( 0 );
+ mMediaHeightCtrl->setEnabled ( can_change_media && allow_resize );
+
+ // enable/disable for text label for completeness
+ mMediaSizeCtrlLabel->setEnabled( can_change_media && allow_resize );
+
+ mMediaTextureCtrl->setImageAssetID ( parcel->getMediaID() );
+ mMediaTextureCtrl->setEnabled( can_change_media );
+
+ mSetURLButton->setEnabled( can_change_media );
+
+ }
}
void LLPanelLandMedia::populateMIMECombo()
{
- std::string default_mime_type = LLMIMETypes::getDefaultMimeType();
- std::string default_label;
- LLMIMETypes::mime_widget_set_map_t::const_iterator it;
- for (it = LLMIMETypes::sWidgetMap.begin(); it != LLMIMETypes::sWidgetMap.end(); ++it)
- {
- const std::string& mime_type = it->first;
- const LLMIMETypes::LLMIMEWidgetSet& info = it->second;
- if (info.mDefaultMimeType == default_mime_type)
- {
- // Add this label at the end to make UI look cleaner
- default_label = info.mLabel;
- }
- else
- {
- mMediaTypeCombo->add(info.mLabel, mime_type);
- }
- }
-
- mMediaTypeCombo->add( default_label, default_mime_type, ADD_BOTTOM );
+ std::string default_mime_type = LLMIMETypes::getDefaultMimeType();
+ std::string default_label;
+ LLMIMETypes::mime_widget_set_map_t::const_iterator it;
+ for (it = LLMIMETypes::sWidgetMap.begin(); it != LLMIMETypes::sWidgetMap.end(); ++it)
+ {
+ const std::string& mime_type = it->first;
+ const LLMIMETypes::LLMIMEWidgetSet& info = it->second;
+ if (info.mDefaultMimeType == default_mime_type)
+ {
+ // Add this label at the end to make UI look cleaner
+ default_label = info.mLabel;
+ }
+ else
+ {
+ mMediaTypeCombo->add(info.mLabel, mime_type);
+ }
+ }
+
+ mMediaTypeCombo->add( default_label, default_mime_type, ADD_BOTTOM );
}
void LLPanelLandMedia::setMediaType(const std::string& mime_type)
{
- LLParcel *parcel = mParcel->getParcel();
- if(parcel)
- parcel->setMediaType(mime_type);
-
- std::string media_key = LLMIMETypes::widgetType(mime_type);
- mMediaTypeCombo->setValue(media_key);
-
- std::string mime_str = mime_type;
- if(LLMIMETypes::getDefaultMimeType() == mime_type)
- {
- // Instead of showing predefined "none/none" we are going to show something
- // localizable - "none" for example (see EXT-6542)
- mime_str = LLMIMETypes::getDefaultMimeTypeTranslation();
- }
- getChild<LLUICtrl>("mime_type")->setValue(mime_str);
+ LLParcel *parcel = mParcel->getParcel();
+ if(parcel)
+ parcel->setMediaType(mime_type);
+
+ std::string media_key = LLMIMETypes::widgetType(mime_type);
+ mMediaTypeCombo->setValue(media_key);
+
+ std::string mime_str = mime_type;
+ if(LLMIMETypes::getDefaultMimeType() == mime_type)
+ {
+ // Instead of showing predefined "none/none" we are going to show something
+ // localizable - "none" for example (see EXT-6542)
+ mime_str = LLMIMETypes::getDefaultMimeTypeTranslation();
+ }
+ getChild<LLUICtrl>("mime_type")->setValue(mime_str);
}
void LLPanelLandMedia::setMediaURL(const std::string& media_url)
{
- mMediaURLEdit->setText(media_url);
- LLParcel *parcel = mParcel->getParcel();
- if(parcel)
- parcel->setMediaCurrentURL(media_url);
- // LLViewerMedia::navigateHome();
+ mMediaURLEdit->setText(media_url);
+ LLParcel *parcel = mParcel->getParcel();
+ if(parcel)
+ parcel->setMediaCurrentURL(media_url);
+ // LLViewerMedia::navigateHome();
- mMediaURLEdit->onCommit();
- // LLViewerParcelMedia::sendMediaNavigateMessage(media_url);
- getChild<LLUICtrl>("current_url")->setValue(media_url);
+ mMediaURLEdit->onCommit();
+ // LLViewerParcelMedia::sendMediaNavigateMessage(media_url);
+ getChild<LLUICtrl>("current_url")->setValue(media_url);
}
std::string LLPanelLandMedia::getMediaURL()
{
- return mMediaURLEdit->getText();
+ return mMediaURLEdit->getText();
}
// static
void LLPanelLandMedia::onCommitType(LLUICtrl *ctrl, void *userdata)
{
- LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
- std::string current_type = LLMIMETypes::widgetType(self->getChild<LLUICtrl>("mime_type")->getValue().asString());
- std::string new_type = self->mMediaTypeCombo->getValue();
- if(current_type != new_type)
- {
- self->getChild<LLUICtrl>("mime_type")->setValue(LLMIMETypes::findDefaultMimeType(new_type));
- }
- onCommitAny(ctrl, userdata);
+ LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
+ std::string current_type = LLMIMETypes::widgetType(self->getChild<LLUICtrl>("mime_type")->getValue().asString());
+ std::string new_type = self->mMediaTypeCombo->getValue();
+ if(current_type != new_type)
+ {
+ self->getChild<LLUICtrl>("mime_type")->setValue(LLMIMETypes::findDefaultMimeType(new_type));
+ }
+ onCommitAny(ctrl, userdata);
}
// static
void LLPanelLandMedia::onCommitAny(LLUICtrl*, void *userdata)
{
- LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
-
- LLParcel* parcel = self->mParcel->getParcel();
- if (!parcel)
- {
- return;
- }
-
- // Extract data from UI
- std::string media_url = self->mMediaURLEdit->getText();
- std::string media_desc = self->mMediaDescEdit->getText();
- std::string mime_type = self->getChild<LLUICtrl>("mime_type")->getValue().asString();
- U8 media_auto_scale = self->mMediaAutoScaleCheck->get();
- U8 media_loop = self->mMediaLoopCheck->get();
- S32 media_width = (S32)self->mMediaWidthCtrl->get();
- S32 media_height = (S32)self->mMediaHeightCtrl->get();
- LLUUID media_id = self->mMediaTextureCtrl->getImageAssetID();
-
-
- self->getChild<LLUICtrl>("mime_type")->setValue(mime_type);
-
- // Remove leading/trailing whitespace (common when copying/pasting)
- LLStringUtil::trim(media_url);
-
- // Push data into current parcel
- parcel->setMediaURL(media_url);
- parcel->setMediaType(mime_type);
- parcel->setMediaDesc(media_desc);
- parcel->setMediaWidth(media_width);
- parcel->setMediaHeight(media_height);
- parcel->setMediaID(media_id);
- parcel->setMediaAutoScale ( media_auto_scale );
- parcel->setMediaLoop ( media_loop );
-
- // Send current parcel data upstream to server
- LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
-
- // Might have changed properties, so let's redraw!
- self->refresh();
+ LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
+
+ LLParcel* parcel = self->mParcel->getParcel();
+ if (!parcel)
+ {
+ return;
+ }
+
+ // Extract data from UI
+ std::string media_url = self->mMediaURLEdit->getText();
+ std::string media_desc = self->mMediaDescEdit->getText();
+ std::string mime_type = self->getChild<LLUICtrl>("mime_type")->getValue().asString();
+ U8 media_auto_scale = self->mMediaAutoScaleCheck->get();
+ U8 media_loop = self->mMediaLoopCheck->get();
+ S32 media_width = (S32)self->mMediaWidthCtrl->get();
+ S32 media_height = (S32)self->mMediaHeightCtrl->get();
+ LLUUID media_id = self->mMediaTextureCtrl->getImageAssetID();
+
+
+ self->getChild<LLUICtrl>("mime_type")->setValue(mime_type);
+
+ // Remove leading/trailing whitespace (common when copying/pasting)
+ LLStringUtil::trim(media_url);
+
+ // Push data into current parcel
+ parcel->setMediaURL(media_url);
+ parcel->setMediaType(mime_type);
+ parcel->setMediaDesc(media_desc);
+ parcel->setMediaWidth(media_width);
+ parcel->setMediaHeight(media_height);
+ parcel->setMediaID(media_id);
+ parcel->setMediaAutoScale ( media_auto_scale );
+ parcel->setMediaLoop ( media_loop );
+
+ // Send current parcel data upstream to server
+ LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
+
+ // Might have changed properties, so let's redraw!
+ self->refresh();
}
// static
void LLPanelLandMedia::onSetBtn(void *userdata)
{
- LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
- self->mURLEntryFloater = LLFloaterURLEntry::show( self->getHandle(), self->getMediaURL() );
- LLFloater* parent_floater = gFloaterView->getParentFloater(self);
- if (parent_floater)
- {
- parent_floater->addDependentFloater(self->mURLEntryFloater.get());
- }
+ LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
+ self->mURLEntryFloater = LLFloaterURLEntry::show( self->getHandle(), self->getMediaURL() );
+ LLFloater* parent_floater = gFloaterView->getParentFloater(self);
+ if (parent_floater)
+ {
+ parent_floater->addDependentFloater(self->mURLEntryFloater.get());
+ }
}
// static
void LLPanelLandMedia::onResetBtn(void *userdata)
{
- LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
- LLParcel* parcel = self->mParcel->getParcel();
- // LLViewerMedia::navigateHome();
- self->refresh();
- self->getChild<LLUICtrl>("current_url")->setValue(parcel->getMediaURL());
- // LLViewerParcelMedia::sendMediaNavigateMessage(parcel->getMediaURL());
+ LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
+ LLParcel* parcel = self->mParcel->getParcel();
+ // LLViewerMedia::navigateHome();
+ self->refresh();
+ self->getChild<LLUICtrl>("current_url")->setValue(parcel->getMediaURL());
+ // LLViewerParcelMedia::sendMediaNavigateMessage(parcel->getMediaURL());
}
diff --git a/indra/newview/llpanellandmedia.h b/indra/newview/llpanellandmedia.h
index 63cfa01470..2bcd1fa14d 100644
--- a/indra/newview/llpanellandmedia.h
+++ b/indra/newview/llpanellandmedia.h
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,43 +31,43 @@
#include "lllineeditor.h"
#include "llpanel.h"
#include "llparcelselection.h"
-#include "lluifwd.h" // widget pointer types
+#include "lluifwd.h" // widget pointer types
class LLPanelLandMedia
-: public LLPanel
+: public LLPanel
{
public:
- LLPanelLandMedia(LLSafeHandle<LLParcelSelection>& parcelp);
- /*virtual*/ ~LLPanelLandMedia();
- /*virtual*/ BOOL postBuild();
- void refresh();
- void setMediaType(const std::string& media_type);
- void setMediaURL(const std::string& media_type);
- std::string getMediaURL();
+ LLPanelLandMedia(LLSafeHandle<LLParcelSelection>& parcelp);
+ /*virtual*/ ~LLPanelLandMedia();
+ /*virtual*/ BOOL postBuild();
+ void refresh();
+ void setMediaType(const std::string& media_type);
+ void setMediaURL(const std::string& media_type);
+ std::string getMediaURL();
private:
- void populateMIMECombo();
- static void onCommitAny(LLUICtrl* ctrl, void *userdata);
- static void onCommitType(LLUICtrl* ctrl, void *userdata);
- static void onSetBtn(void* userdata);
- static void onResetBtn(void* userdata);
-
+ void populateMIMECombo();
+ static void onCommitAny(LLUICtrl* ctrl, void *userdata);
+ static void onCommitType(LLUICtrl* ctrl, void *userdata);
+ static void onSetBtn(void* userdata);
+ static void onResetBtn(void* userdata);
+
private:
- LLLineEditor* mMediaURLEdit;
- LLLineEditor* mMediaDescEdit;
- LLComboBox* mMediaTypeCombo;
- LLButton* mSetURLButton;
- LLSpinCtrl* mMediaHeightCtrl;
- LLSpinCtrl* mMediaWidthCtrl;
- LLTextBox* mMediaSizeCtrlLabel;
- LLTextureCtrl* mMediaTextureCtrl;
- LLCheckBoxCtrl* mMediaAutoScaleCheck;
- LLCheckBoxCtrl* mMediaLoopCheck;
- LLHandle<LLFloater> mURLEntryFloater;
+ LLLineEditor* mMediaURLEdit;
+ LLLineEditor* mMediaDescEdit;
+ LLComboBox* mMediaTypeCombo;
+ LLButton* mSetURLButton;
+ LLSpinCtrl* mMediaHeightCtrl;
+ LLSpinCtrl* mMediaWidthCtrl;
+ LLTextBox* mMediaSizeCtrlLabel;
+ LLTextureCtrl* mMediaTextureCtrl;
+ LLCheckBoxCtrl* mMediaAutoScaleCheck;
+ LLCheckBoxCtrl* mMediaLoopCheck;
+ LLHandle<LLFloater> mURLEntryFloater;
+
-
- LLSafeHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
#endif
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 025a653c47..86f56f0949 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanellogin.cpp
* @brief Login dialog and logo display
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,7 +29,7 @@
#include "llpanellogin.h"
#include "lllayoutstack.h"
-#include "indra_constants.h" // for key and mask constants
+#include "indra_constants.h" // for key and mask constants
#include "llfloaterreg.h"
#include "llfontgl.h"
#include "llmd5.h"
@@ -38,7 +38,7 @@
#include "llappviewer.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
-#include "llcommandhandler.h" // for secondlife:///app/login/
+#include "llcommandhandler.h" // for secondlife:///app/login/
#include "llcombobox.h"
#include "llviewercontrol.h"
#include "llfocusmgr.h"
@@ -53,9 +53,9 @@
#include "llversioninfo.h"
#include "llviewerhelp.h"
#include "llviewertexturelist.h"
-#include "llviewermenu.h" // for handle_preferences()
+#include "llviewermenu.h" // for handle_preferences()
#include "llviewernetwork.h"
-#include "llviewerwindow.h" // to link into child list
+#include "llviewerwindow.h" // to link into child list
#include "lluictrlfactory.h"
#include "llweb.h"
#include "llmediactrl.h"
@@ -96,81 +96,81 @@ LLPointer<LLCredential> load_user_credentials(std::string &user_key)
class LLLoginLocationAutoHandler : public LLCommandHandler
{
public:
- // don't allow from external browsers
- LLLoginLocationAutoHandler() : LLCommandHandler("location_login", UNTRUSTED_BLOCK) { }
- bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
- {
- if ( tokens.size() == 0 || tokens.size() > 4 )
- return false;
-
- // unescape is important - uris with spaces are escaped in this code path
- // (e.g. space -> %20) and the code to log into a region doesn't support that.
- const std::string region = LLURI::unescape( tokens[0].asString() );
-
- // just region name as payload
- if ( tokens.size() == 1 )
- {
- // region name only - slurl will end up as center of region
- LLSLURL slurl(region);
- LLPanelLogin::autologinToLocation(slurl);
- }
- else
- // region name and x coord as payload
- if ( tokens.size() == 2 )
- {
- // invalid to only specify region and x coordinate
- // slurl code will revert to same as region only, so do this anyway
- LLSLURL slurl(region);
- LLPanelLogin::autologinToLocation(slurl);
- }
- else
- // region name and x/y coord as payload
- if ( tokens.size() == 3 )
- {
- // region and x/y specified - default z to 0
- F32 xpos;
- std::istringstream codec(tokens[1].asString());
- codec >> xpos;
-
- F32 ypos;
- codec.clear();
- codec.str(tokens[2].asString());
- codec >> ypos;
-
- const LLVector3 location(xpos, ypos, 0.0f);
- LLSLURL slurl(region, location);
-
- LLPanelLogin::autologinToLocation(slurl);
- }
- else
- // region name and x/y/z coord as payload
- if ( tokens.size() == 4 )
- {
- // region and x/y/z specified - ok
- F32 xpos;
- std::istringstream codec(tokens[1].asString());
- codec >> xpos;
-
- F32 ypos;
- codec.clear();
- codec.str(tokens[2].asString());
- codec >> ypos;
-
- F32 zpos;
- codec.clear();
- codec.str(tokens[3].asString());
- codec >> zpos;
-
- const LLVector3 location(xpos, ypos, zpos);
- LLSLURL slurl(region, location);
-
- LLPanelLogin::autologinToLocation(slurl);
- };
- }
- return true;
- }
+ // don't allow from external browsers
+ LLLoginLocationAutoHandler() : LLCommandHandler("location_login", UNTRUSTED_BLOCK) { }
+ bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
+ {
+ if ( tokens.size() == 0 || tokens.size() > 4 )
+ return false;
+
+ // unescape is important - uris with spaces are escaped in this code path
+ // (e.g. space -> %20) and the code to log into a region doesn't support that.
+ const std::string region = LLURI::unescape( tokens[0].asString() );
+
+ // just region name as payload
+ if ( tokens.size() == 1 )
+ {
+ // region name only - slurl will end up as center of region
+ LLSLURL slurl(region);
+ LLPanelLogin::autologinToLocation(slurl);
+ }
+ else
+ // region name and x coord as payload
+ if ( tokens.size() == 2 )
+ {
+ // invalid to only specify region and x coordinate
+ // slurl code will revert to same as region only, so do this anyway
+ LLSLURL slurl(region);
+ LLPanelLogin::autologinToLocation(slurl);
+ }
+ else
+ // region name and x/y coord as payload
+ if ( tokens.size() == 3 )
+ {
+ // region and x/y specified - default z to 0
+ F32 xpos;
+ std::istringstream codec(tokens[1].asString());
+ codec >> xpos;
+
+ F32 ypos;
+ codec.clear();
+ codec.str(tokens[2].asString());
+ codec >> ypos;
+
+ const LLVector3 location(xpos, ypos, 0.0f);
+ LLSLURL slurl(region, location);
+
+ LLPanelLogin::autologinToLocation(slurl);
+ }
+ else
+ // region name and x/y/z coord as payload
+ if ( tokens.size() == 4 )
+ {
+ // region and x/y/z specified - ok
+ F32 xpos;
+ std::istringstream codec(tokens[1].asString());
+ codec >> xpos;
+
+ F32 ypos;
+ codec.clear();
+ codec.str(tokens[2].asString());
+ codec >> ypos;
+
+ F32 zpos;
+ codec.clear();
+ codec.str(tokens[3].asString());
+ codec >> zpos;
+
+ const LLVector3 location(xpos, ypos, zpos);
+ LLSLURL slurl(region, location);
+
+ LLPanelLogin::autologinToLocation(slurl);
+ };
+ }
+ return true;
+ }
};
LLLoginLocationAutoHandler gLoginLocationAutoHandler;
@@ -178,50 +178,50 @@ LLLoginLocationAutoHandler gLoginLocationAutoHandler;
// Public methods
//---------------------------------------------------------------------------
LLPanelLogin::LLPanelLogin(const LLRect &rect,
- void (*callback)(S32 option, void* user_data),
- void *cb_data)
-: LLPanel(),
- mCallback(callback),
- mCallbackData(cb_data),
- mListener(new LLPanelLoginListener(this)),
- mFirstLoginThisInstall(gSavedSettings.getBOOL("FirstLoginThisInstall")),
- mUsernameLength(0),
- mPasswordLength(0),
- mLocationLength(0),
- mShowFavorites(false)
+ void (*callback)(S32 option, void* user_data),
+ void *cb_data)
+: LLPanel(),
+ mCallback(callback),
+ mCallbackData(cb_data),
+ mListener(new LLPanelLoginListener(this)),
+ mFirstLoginThisInstall(gSavedSettings.getBOOL("FirstLoginThisInstall")),
+ mUsernameLength(0),
+ mPasswordLength(0),
+ mLocationLength(0),
+ mShowFavorites(false)
{
- setBackgroundVisible(FALSE);
- setBackgroundOpaque(TRUE);
+ setBackgroundVisible(FALSE);
+ setBackgroundOpaque(TRUE);
- mPasswordModified = FALSE;
+ mPasswordModified = FALSE;
- sInstance = this;
+ sInstance = this;
- LLView* login_holder = gViewerWindow->getLoginPanelHolder();
- if (login_holder)
- {
- login_holder->addChild(this);
- }
+ LLView* login_holder = gViewerWindow->getLoginPanelHolder();
+ if (login_holder)
+ {
+ login_holder->addChild(this);
+ }
- if (mFirstLoginThisInstall)
- {
- buildFromFile( "panel_login_first.xml");
- }
- else
- {
- buildFromFile( "panel_login.xml");
- }
+ if (mFirstLoginThisInstall)
+ {
+ buildFromFile( "panel_login_first.xml");
+ }
+ else
+ {
+ buildFromFile( "panel_login.xml");
+ }
- reshape(rect.getWidth(), rect.getHeight());
+ reshape(rect.getWidth(), rect.getHeight());
- LLLineEditor* password_edit(getChild<LLLineEditor>("password_edit"));
- password_edit->setKeystrokeCallback(onPassKey, this);
- // STEAM-14: When user presses Enter with this field in focus, initiate login
- password_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, false));
+ LLLineEditor* password_edit(getChild<LLLineEditor>("password_edit"));
+ password_edit->setKeystrokeCallback(onPassKey, this);
+ // STEAM-14: When user presses Enter with this field in focus, initiate login
+ password_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, false));
- // change z sort of clickable text to be behind buttons
- sendChildToBack(getChildView("forgot_password_text"));
- sendChildToBack(getChildView("sign_up_text"));
+ // change z sort of clickable text to be behind buttons
+ sendChildToBack(getChildView("forgot_password_text"));
+ sendChildToBack(getChildView("sign_up_text"));
std::string current_grid = LLGridManager::getInstance()->getGrid();
if (!mFirstLoginThisInstall)
@@ -257,71 +257,71 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
server_choice_combo->selectFirstItem();
}
- LLSLURL start_slurl(LLStartUp::getStartSLURL());
- // The StartSLURL might have been set either by an explicit command-line
- // argument (CmdLineLoginLocation) or by default.
- // current_grid might have been set either by an explicit command-line
- // argument (CmdLineGridChoice) or by default.
- // If the grid specified by StartSLURL is the same as current_grid, the
- // distinction is moot.
- // If we have an explicit command-line SLURL, use that.
- // If we DON'T have an explicit command-line SLURL but we DO have an
- // explicit command-line grid, which is different from the default SLURL's
- // -- do NOT override the explicit command-line grid with the grid from
- // the default SLURL!
- bool force_grid{ start_slurl.getGrid() != current_grid &&
- gSavedSettings.getString("CmdLineLoginLocation").empty() &&
- ! gSavedSettings.getString("CmdLineGridChoice").empty() };
- if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ?
- {
- // no, so get the preference setting
- std::string defaultStartLocation = gSavedSettings.getString("LoginLocation");
- LL_INFOS("AppInit")<<"default LoginLocation '"<<defaultStartLocation<<"'"<<LL_ENDL;
- LLSLURL defaultStart(defaultStartLocation);
- if ( defaultStart.isSpatial() && ! force_grid )
- {
- LLStartUp::setStartSLURL(defaultStart);
- }
- else
- {
- LL_INFOS("AppInit") << (force_grid? "--grid specified" : "no valid LoginLocation")
- << ", using home" << LL_ENDL;
- LLSLURL homeStart(LLSLURL::SIM_LOCATION_HOME);
- LLStartUp::setStartSLURL(homeStart);
- }
- }
- else if (! force_grid)
- {
- onUpdateStartSLURL(start_slurl); // updates grid if needed
- }
-
- childSetAction("connect_btn", onClickConnect, this);
-
- LLButton* def_btn = getChild<LLButton>("connect_btn");
- setDefaultBtn(def_btn);
-
- std::string channel = LLVersionInfo::instance().getChannel();
- std::string version = stringize(LLVersionInfo::instance().getShortVersion(), " (",
- LLVersionInfo::instance().getBuild(), ')');
-
- LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text");
- forgot_password_text->setClickedCallback(onClickForgotPassword, NULL);
-
- LLTextBox* sign_up_text = getChild<LLTextBox>("sign_up_text");
- sign_up_text->setClickedCallback(onClickSignUp, NULL);
-
- // get the web browser control
- LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html");
- web_browser->addObserver(this);
-
- loadLoginPage();
-
- LLComboBox* username_combo(getChild<LLComboBox>("username_combo"));
- username_combo->setTextChangedCallback(boost::bind(&LLPanelLogin::onUserNameTextEnty, this));
- // STEAM-14: When user presses Enter with this field in focus, initiate login
- username_combo->setCommitCallback(boost::bind(&LLPanelLogin::onUserListCommit, this));
- username_combo->setReturnCallback(boost::bind(&LLPanelLogin::onClickConnect, this));
- username_combo->setKeystrokeOnEsc(TRUE);
+ LLSLURL start_slurl(LLStartUp::getStartSLURL());
+ // The StartSLURL might have been set either by an explicit command-line
+ // argument (CmdLineLoginLocation) or by default.
+ // current_grid might have been set either by an explicit command-line
+ // argument (CmdLineGridChoice) or by default.
+ // If the grid specified by StartSLURL is the same as current_grid, the
+ // distinction is moot.
+ // If we have an explicit command-line SLURL, use that.
+ // If we DON'T have an explicit command-line SLURL but we DO have an
+ // explicit command-line grid, which is different from the default SLURL's
+ // -- do NOT override the explicit command-line grid with the grid from
+ // the default SLURL!
+ bool force_grid{ start_slurl.getGrid() != current_grid &&
+ gSavedSettings.getString("CmdLineLoginLocation").empty() &&
+ ! gSavedSettings.getString("CmdLineGridChoice").empty() };
+ if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ?
+ {
+ // no, so get the preference setting
+ std::string defaultStartLocation = gSavedSettings.getString("LoginLocation");
+ LL_INFOS("AppInit")<<"default LoginLocation '"<<defaultStartLocation<<"'"<<LL_ENDL;
+ LLSLURL defaultStart(defaultStartLocation);
+ if ( defaultStart.isSpatial() && ! force_grid )
+ {
+ LLStartUp::setStartSLURL(defaultStart);
+ }
+ else
+ {
+ LL_INFOS("AppInit") << (force_grid? "--grid specified" : "no valid LoginLocation")
+ << ", using home" << LL_ENDL;
+ LLSLURL homeStart(LLSLURL::SIM_LOCATION_HOME);
+ LLStartUp::setStartSLURL(homeStart);
+ }
+ }
+ else if (! force_grid)
+ {
+ onUpdateStartSLURL(start_slurl); // updates grid if needed
+ }
+
+ childSetAction("connect_btn", onClickConnect, this);
+
+ LLButton* def_btn = getChild<LLButton>("connect_btn");
+ setDefaultBtn(def_btn);
+
+ std::string channel = LLVersionInfo::instance().getChannel();
+ std::string version = stringize(LLVersionInfo::instance().getShortVersion(), " (",
+ LLVersionInfo::instance().getBuild(), ')');
+
+ LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text");
+ forgot_password_text->setClickedCallback(onClickForgotPassword, NULL);
+
+ LLTextBox* sign_up_text = getChild<LLTextBox>("sign_up_text");
+ sign_up_text->setClickedCallback(onClickSignUp, NULL);
+
+ // get the web browser control
+ LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html");
+ web_browser->addObserver(this);
+
+ loadLoginPage();
+
+ LLComboBox* username_combo(getChild<LLComboBox>("username_combo"));
+ username_combo->setTextChangedCallback(boost::bind(&LLPanelLogin::onUserNameTextEnty, this));
+ // STEAM-14: When user presses Enter with this field in focus, initiate login
+ username_combo->setCommitCallback(boost::bind(&LLPanelLogin::onUserListCommit, this));
+ username_combo->setReturnCallback(boost::bind(&LLPanelLogin::onClickConnect, this));
+ username_combo->setKeystrokeOnEsc(TRUE);
LLCheckBoxCtrl* remember_name = getChild<LLCheckBoxCtrl>("remember_name");
@@ -340,69 +340,69 @@ void LLPanelLogin::addFavoritesToStartLocation()
return;
}
- // Clear the combo.
- LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
- if (!combo) return;
- int num_items = combo->getItemCount();
- for (int i = num_items - 1; i > 1; i--)
- {
- combo->remove(i);
- }
-
- // Load favorites into the combo.
- std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
- LLStringUtil::trim(user_defined_name);
- LLStringUtil::toLower(user_defined_name);
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml");
- std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
- mUsernameLength = user_defined_name.length();
- updateLoginButtons();
-
- std::string::size_type index = user_defined_name.find_first_of(" ._");
- if (index != std::string::npos)
- {
- std::string username = user_defined_name.substr(0, index);
- std::string lastname = user_defined_name.substr(index+1);
- if (lastname == "resident")
- {
- user_defined_name = username;
- }
- else
- {
- user_defined_name = username + " " + lastname;
- }
- }
-
- LLSD fav_llsd;
- llifstream file;
- file.open(filename.c_str());
- if (!file.is_open())
- {
- file.open(old_filename.c_str());
- if (!file.is_open()) return;
- }
- LLSDSerialize::fromXML(fav_llsd, file);
-
- for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
- iter != fav_llsd.endMap(); ++iter)
- {
- // The account name in stored_favorites.xml has Resident last name even if user has
- // a single word account name, so it can be compared case-insensitive with the
- // user defined "firstname lastname".
- S32 res = LLStringUtil::compareInsensitive(user_defined_name, iter->first);
- if (res != 0)
- {
- LL_DEBUGS() << "Skipping favorites for " << iter->first << LL_ENDL;
- continue;
- }
-
- combo->addSeparator();
- LL_DEBUGS() << "Loading favorites for " << iter->first << LL_ENDL;
- LLSD user_llsd = iter->second;
+ // Clear the combo.
+ LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
+ if (!combo) return;
+ int num_items = combo->getItemCount();
+ for (int i = num_items - 1; i > 1; i--)
+ {
+ combo->remove(i);
+ }
+
+ // Load favorites into the combo.
+ std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
+ LLStringUtil::trim(user_defined_name);
+ LLStringUtil::toLower(user_defined_name);
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml");
+ std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
+ mUsernameLength = user_defined_name.length();
+ updateLoginButtons();
+
+ std::string::size_type index = user_defined_name.find_first_of(" ._");
+ if (index != std::string::npos)
+ {
+ std::string username = user_defined_name.substr(0, index);
+ std::string lastname = user_defined_name.substr(index+1);
+ if (lastname == "resident")
+ {
+ user_defined_name = username;
+ }
+ else
+ {
+ user_defined_name = username + " " + lastname;
+ }
+ }
+
+ LLSD fav_llsd;
+ llifstream file;
+ file.open(filename.c_str());
+ if (!file.is_open())
+ {
+ file.open(old_filename.c_str());
+ if (!file.is_open()) return;
+ }
+ LLSDSerialize::fromXML(fav_llsd, file);
+
+ for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
+ iter != fav_llsd.endMap(); ++iter)
+ {
+ // The account name in stored_favorites.xml has Resident last name even if user has
+ // a single word account name, so it can be compared case-insensitive with the
+ // user defined "firstname lastname".
+ S32 res = LLStringUtil::compareInsensitive(user_defined_name, iter->first);
+ if (res != 0)
+ {
+ LL_DEBUGS() << "Skipping favorites for " << iter->first << LL_ENDL;
+ continue;
+ }
+
+ combo->addSeparator();
+ LL_DEBUGS() << "Loading favorites for " << iter->first << LL_ENDL;
+ LLSD user_llsd = iter->second;
bool update_password_setting = true;
- for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
- iter1 != user_llsd.endArray(); ++iter1)
- {
+ for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
+ iter1 != user_llsd.endArray(); ++iter1)
+ {
if ((*iter1).has("save_password"))
{
bool save_password = (*iter1)["save_password"].asBoolean();
@@ -415,113 +415,113 @@ void LLPanelLogin::addFavoritesToStartLocation()
}
std::string label = (*iter1)["name"].asString();
- std::string value = (*iter1)["slurl"].asString();
- if(label != "" && value != "")
- {
- mShowFavorites = true;
- combo->add(label, value);
- if ( LLStartUp::getStartSLURL().getSLURLString() == value)
- {
- combo->selectByValue(value);
- }
- }
- }
+ std::string value = (*iter1)["slurl"].asString();
+ if(label != "" && value != "")
+ {
+ mShowFavorites = true;
+ combo->add(label, value);
+ if ( LLStartUp::getStartSLURL().getSLURLString() == value)
+ {
+ combo->selectByValue(value);
+ }
+ }
+ }
if (update_password_setting)
{
gSavedSettings.setBOOL("UpdateRememberPasswordSetting", TRUE);
}
- break;
- }
- if (combo->getValue().asString().empty())
- {
- combo->selectFirstItem();
+ break;
+ }
+ if (combo->getValue().asString().empty())
+ {
+ combo->selectFirstItem();
// Value 'home' or 'last' should have been taken from NextLoginLocation
// but NextLoginLocation was not set, so init it from combo explicitly
onLocationSLURL();
- }
+ }
}
LLPanelLogin::~LLPanelLogin()
{
- LLPanelLogin::sInstance = NULL;
+ LLPanelLogin::sInstance = NULL;
- // Controls having keyboard focus by default
- // must reset it on destroy. (EXT-2748)
- gFocusMgr.setDefaultKeyboardFocus(NULL);
+ // Controls having keyboard focus by default
+ // must reset it on destroy. (EXT-2748)
+ gFocusMgr.setDefaultKeyboardFocus(NULL);
}
// virtual
void LLPanelLogin::setFocus(BOOL b)
{
- if(b != hasFocus())
- {
- if(b)
- {
- giveFocus();
- }
- else
- {
- LLPanel::setFocus(b);
- }
- }
+ if(b != hasFocus())
+ {
+ if(b)
+ {
+ giveFocus();
+ }
+ else
+ {
+ LLPanel::setFocus(b);
+ }
+ }
}
// static
void LLPanelLogin::giveFocus()
{
- if( sInstance )
- {
- // Grab focus and move cursor to first blank input field
- std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
- std::string pass = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
-
- BOOL have_username = !username.empty();
- BOOL have_pass = !pass.empty();
-
- LLLineEditor* edit = NULL;
- LLComboBox* combo = NULL;
- if (have_username && !have_pass)
- {
- // User saved his name but not his password. Move
- // focus to password field.
- edit = sInstance->getChild<LLLineEditor>("password_edit");
- }
- else
- {
- // User doesn't have a name, so start there.
- combo = sInstance->getChild<LLComboBox>("username_combo");
- }
-
- if (edit)
- {
- edit->setFocus(TRUE);
- edit->selectAll();
- }
- else if (combo)
- {
- combo->setFocus(TRUE);
- }
- }
+ if( sInstance )
+ {
+ // Grab focus and move cursor to first blank input field
+ std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
+ std::string pass = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
+
+ BOOL have_username = !username.empty();
+ BOOL have_pass = !pass.empty();
+
+ LLLineEditor* edit = NULL;
+ LLComboBox* combo = NULL;
+ if (have_username && !have_pass)
+ {
+ // User saved his name but not his password. Move
+ // focus to password field.
+ edit = sInstance->getChild<LLLineEditor>("password_edit");
+ }
+ else
+ {
+ // User doesn't have a name, so start there.
+ combo = sInstance->getChild<LLComboBox>("username_combo");
+ }
+
+ if (edit)
+ {
+ edit->setFocus(TRUE);
+ edit->selectAll();
+ }
+ else if (combo)
+ {
+ combo->setFocus(TRUE);
+ }
+ }
}
// static
void LLPanelLogin::show(const LLRect &rect,
- void (*callback)(S32 option, void* user_data),
- void* callback_data)
+ void (*callback)(S32 option, void* user_data),
+ void* callback_data)
{
if (!LLPanelLogin::sInstance)
{
new LLPanelLogin(rect, callback, callback_data);
}
- if( !gFocusMgr.getKeyboardFocus() )
- {
- // Grab focus and move cursor to first enabled control
- sInstance->setFocus(TRUE);
- }
+ if( !gFocusMgr.getKeyboardFocus() )
+ {
+ // Grab focus and move cursor to first enabled control
+ sInstance->setFocus(TRUE);
+ }
- // Make sure that focus always goes here (and use the latest sInstance that was just created)
- gFocusMgr.setDefaultKeyboardFocus(sInstance);
+ // Make sure that focus always goes here (and use the latest sInstance that was just created)
+ gFocusMgr.setDefaultKeyboardFocus(sInstance);
}
//static
@@ -574,127 +574,127 @@ void LLPanelLogin::resetFields()
// static
void LLPanelLogin::setFields(LLPointer<LLCredential> credential)
{
- if (!sInstance)
- {
- LL_WARNS() << "Attempted fillFields with no login view shown" << LL_ENDL;
- return;
- }
- sCredentialSet = TRUE;
- LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;
-
- LLSD identifier = credential.notNull() ? credential->getIdentifier() : LLSD();
-
- if(identifier.has("type") && (std::string)identifier["type"] == "agent")
- {
- // not nessesary for panel_login.xml, needed for panel_login_first.xml
- std::string firstname = identifier["first_name"].asString();
- std::string lastname = identifier["last_name"].asString();
- std::string login_id = firstname;
- if (!lastname.empty() && lastname != "Resident" && lastname != "resident")
- {
- // support traditional First Last name SLURLs
- login_id += " ";
- login_id += lastname;
- }
- sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id);
- sInstance->mUsernameLength = login_id.length();
- }
- else if(identifier.has("type") && (std::string)identifier["type"] == "account")
- {
- std::string login_id = identifier["account_name"].asString();
- sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id);
- sInstance->mUsernameLength = login_id.length();
- }
- else
- {
- sInstance->getChild<LLComboBox>("username_combo")->setLabel(std::string());
- sInstance->mUsernameLength = 0;
- }
-
- sInstance->addFavoritesToStartLocation();
- // if the password exists in the credential, set the password field with
- // a filler to get some stars
- LLSD authenticator = credential.notNull() ? credential->getAuthenticator() : LLSD();
- LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
- if(authenticator.isMap() &&
- authenticator.has("secret") &&
- (authenticator["secret"].asString().size() > 0))
- {
-
- // This is a MD5 hex digest of a password.
- // We don't actually use the password input field,
- // fill it with MAX_PASSWORD characters so we get a
- // nice row of asterisks.
- const std::string filler("123456789!123456");
- sInstance->getChild<LLUICtrl>("password_edit")->setValue(filler);
- sInstance->mPasswordLength = filler.length();
- sInstance->updateLoginButtons();
- }
- else
- {
- sInstance->getChild<LLUICtrl>("password_edit")->setValue(std::string());
- sInstance->mPasswordLength = 0;
- }
+ if (!sInstance)
+ {
+ LL_WARNS() << "Attempted fillFields with no login view shown" << LL_ENDL;
+ return;
+ }
+ sCredentialSet = TRUE;
+ LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;
+
+ LLSD identifier = credential.notNull() ? credential->getIdentifier() : LLSD();
+
+ if(identifier.has("type") && (std::string)identifier["type"] == "agent")
+ {
+ // not nessesary for panel_login.xml, needed for panel_login_first.xml
+ std::string firstname = identifier["first_name"].asString();
+ std::string lastname = identifier["last_name"].asString();
+ std::string login_id = firstname;
+ if (!lastname.empty() && lastname != "Resident" && lastname != "resident")
+ {
+ // support traditional First Last name SLURLs
+ login_id += " ";
+ login_id += lastname;
+ }
+ sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id);
+ sInstance->mUsernameLength = login_id.length();
+ }
+ else if(identifier.has("type") && (std::string)identifier["type"] == "account")
+ {
+ std::string login_id = identifier["account_name"].asString();
+ sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id);
+ sInstance->mUsernameLength = login_id.length();
+ }
+ else
+ {
+ sInstance->getChild<LLComboBox>("username_combo")->setLabel(std::string());
+ sInstance->mUsernameLength = 0;
+ }
+
+ sInstance->addFavoritesToStartLocation();
+ // if the password exists in the credential, set the password field with
+ // a filler to get some stars
+ LLSD authenticator = credential.notNull() ? credential->getAuthenticator() : LLSD();
+ LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
+ if(authenticator.isMap() &&
+ authenticator.has("secret") &&
+ (authenticator["secret"].asString().size() > 0))
+ {
+
+ // This is a MD5 hex digest of a password.
+ // We don't actually use the password input field,
+ // fill it with MAX_PASSWORD characters so we get a
+ // nice row of asterisks.
+ const std::string filler("123456789!123456");
+ sInstance->getChild<LLUICtrl>("password_edit")->setValue(filler);
+ sInstance->mPasswordLength = filler.length();
+ sInstance->updateLoginButtons();
+ }
+ else
+ {
+ sInstance->getChild<LLUICtrl>("password_edit")->setValue(std::string());
+ sInstance->mPasswordLength = 0;
+ }
}
// static
void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
- bool& remember_user,
- bool& remember_psswrd)
+ bool& remember_user,
+ bool& remember_psswrd)
{
- if (!sInstance)
- {
- LL_WARNS() << "Attempted getFields with no login view shown" << LL_ENDL;
- return;
- }
-
- LLSD identifier = LLSD::emptyMap();
- LLSD authenticator = LLSD::emptyMap();
-
- std::string username = sInstance->getChild<LLComboBox>("username_combo")->getSimple();
- std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
- LLStringUtil::trim(username);
-
- LL_INFOS("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL;
- // determine if the username is a first/last form or not.
- size_t separator_index = username.find_first_of(' ');
- {
- // Be lenient in terms of what separators we allow for two-word names
- // and allow legacy users to login with firstname.lastname
- separator_index = username.find_first_of(" ._");
- std::string first = username.substr(0, separator_index);
- std::string last;
- if (separator_index != username.npos)
- {
- last = username.substr(separator_index+1, username.npos);
- LLStringUtil::trim(last);
- }
- else
- {
- // ...on Linden grids, single username users as considered to have
- // last name "Resident"
- // *TODO: Make login.cgi support "account_name" like above
- last = "Resident";
- }
-
- if (last.find_first_of(' ') == last.npos)
- {
- LL_INFOS("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
- // traditional firstname / lastname
- identifier["type"] = CRED_IDENTIFIER_TYPE_AGENT;
- identifier["first_name"] = first;
- identifier["last_name"] = last;
-
- if (LLPanelLogin::sInstance->mPasswordModified)
- {
- authenticator = LLSD::emptyMap();
- authenticator["type"] = CRED_AUTHENTICATOR_TYPE_HASH;
- authenticator["algorithm"] = "md5";
- LLMD5 pass((const U8 *)password.c_str());
- char md5pass[33]; /* Flawfinder: ignore */
- pass.hex_digest(md5pass);
- authenticator["secret"] = md5pass;
- }
+ if (!sInstance)
+ {
+ LL_WARNS() << "Attempted getFields with no login view shown" << LL_ENDL;
+ return;
+ }
+
+ LLSD identifier = LLSD::emptyMap();
+ LLSD authenticator = LLSD::emptyMap();
+
+ std::string username = sInstance->getChild<LLComboBox>("username_combo")->getSimple();
+ std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
+ LLStringUtil::trim(username);
+
+ LL_INFOS("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL;
+ // determine if the username is a first/last form or not.
+ size_t separator_index = username.find_first_of(' ');
+ {
+ // Be lenient in terms of what separators we allow for two-word names
+ // and allow legacy users to login with firstname.lastname
+ separator_index = username.find_first_of(" ._");
+ std::string first = username.substr(0, separator_index);
+ std::string last;
+ if (separator_index != username.npos)
+ {
+ last = username.substr(separator_index+1, username.npos);
+ LLStringUtil::trim(last);
+ }
+ else
+ {
+ // ...on Linden grids, single username users as considered to have
+ // last name "Resident"
+ // *TODO: Make login.cgi support "account_name" like above
+ last = "Resident";
+ }
+
+ if (last.find_first_of(' ') == last.npos)
+ {
+ LL_INFOS("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
+ // traditional firstname / lastname
+ identifier["type"] = CRED_IDENTIFIER_TYPE_AGENT;
+ identifier["first_name"] = first;
+ identifier["last_name"] = last;
+
+ if (LLPanelLogin::sInstance->mPasswordModified)
+ {
+ authenticator = LLSD::emptyMap();
+ authenticator["type"] = CRED_AUTHENTICATOR_TYPE_HASH;
+ authenticator["algorithm"] = "md5";
+ LLMD5 pass((const U8 *)password.c_str());
+ char md5pass[33]; /* Flawfinder: ignore */
+ pass.hex_digest(md5pass);
+ authenticator["secret"] = md5pass;
+ }
else
{
std::string key = first + "_" + last;
@@ -705,9 +705,9 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
authenticator = credential->getAuthenticator();
}
}
- }
- }
- credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), identifier, authenticator);
+ }
+ }
+ credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), identifier, authenticator);
remember_psswrd = sInstance->getChild<LLUICtrl>("remember_password")->getValue();
remember_user = sInstance->getChild<LLUICtrl>("remember_name")->getValue();
@@ -717,213 +717,213 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
// static
BOOL LLPanelLogin::areCredentialFieldsDirty()
{
- if (!sInstance)
- {
- LL_WARNS() << "Attempted getServer with no login view shown" << LL_ENDL;
- }
- else
- {
- LLComboBox* combo = sInstance->getChild<LLComboBox>("username_combo");
- if (combo && combo->getCurrentIndex() == -1 && !combo->getValue().asString().empty())
- {
- return true;
- }
- LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("password_edit");
- if(ctrl && ctrl->isDirty())
- {
- return true;
- }
- }
- return false;
+ if (!sInstance)
+ {
+ LL_WARNS() << "Attempted getServer with no login view shown" << LL_ENDL;
+ }
+ else
+ {
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("username_combo");
+ if (combo && combo->getCurrentIndex() == -1 && !combo->getValue().asString().empty())
+ {
+ return true;
+ }
+ LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("password_edit");
+ if(ctrl && ctrl->isDirty())
+ {
+ return true;
+ }
+ }
+ return false;
}
// static
void LLPanelLogin::updateLocationSelectorsVisibility()
{
- if (sInstance)
- {
- BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
- LLComboBox* server_combo = sInstance->getChild<LLComboBox>("server_combo");
- if ( server_combo )
- {
- server_combo->setVisible(show_server);
- }
- }
+ if (sInstance)
+ {
+ BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
+ LLComboBox* server_combo = sInstance->getChild<LLComboBox>("server_combo");
+ if ( server_combo )
+ {
+ server_combo->setVisible(show_server);
+ }
+ }
}
// static - called from LLStartUp::setStartSLURL
void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl)
{
- if (!sInstance) return;
-
- LL_DEBUGS("AppInit")<<new_start_slurl.asString()<<LL_ENDL;
-
- LLComboBox* location_combo = sInstance->getChild<LLComboBox>("start_location_combo");
- /*
- * Determine whether or not the new_start_slurl modifies the grid.
- *
- * Note that some forms that could be in the slurl are grid-agnostic.,
- * such as "home". Other forms, such as
- * https://grid.example.com/region/Party%20Town/20/30/5
- * specify a particular grid; in those cases we want to change the grid
- * and the grid selector to match the new value.
- */
- enum LLSLURL::SLURL_TYPE new_slurl_type = new_start_slurl.getType();
- switch ( new_slurl_type )
- {
- case LLSLURL::LOCATION:
- {
- std::string slurl_grid = LLGridManager::getInstance()->getGrid(new_start_slurl.getGrid());
- if ( ! slurl_grid.empty() ) // is that a valid grid?
- {
- if ( slurl_grid != LLGridManager::getInstance()->getGrid() ) // new grid?
- {
- // the slurl changes the grid, so update everything to match
- LLGridManager::getInstance()->setGridChoice(slurl_grid);
-
- // update the grid selector to match the slurl
- LLComboBox* server_combo = sInstance->getChild<LLComboBox>("server_combo");
- std::string server_label(LLGridManager::getInstance()->getGridLabel(slurl_grid));
- server_combo->setSimple(server_label);
-
- updateServer(); // to change the links and splash screen
- }
- if ( new_start_slurl.getLocationString().length() )
- {
-
- location_combo->setLabel(new_start_slurl.getLocationString());
- sInstance->mLocationLength = new_start_slurl.getLocationString().length();
- sInstance->updateLoginButtons();
- }
- }
- else
- {
- // the grid specified by the slurl is not known
- LLNotificationsUtil::add("InvalidLocationSLURL");
- LL_WARNS("AppInit")<<"invalid LoginLocation:"<<new_start_slurl.asString()<<LL_ENDL;
- location_combo->setTextEntry(LLStringUtil::null);
- }
- }
- break;
-
- case LLSLURL::HOME_LOCATION:
- //location_combo->setCurrentByIndex(0); // home location
- break;
-
- default:
- LL_WARNS("AppInit")<<"invalid login slurl, using home"<<LL_ENDL;
- //location_combo->setCurrentByIndex(0); // home location
- break;
- }
+ if (!sInstance) return;
+
+ LL_DEBUGS("AppInit")<<new_start_slurl.asString()<<LL_ENDL;
+
+ LLComboBox* location_combo = sInstance->getChild<LLComboBox>("start_location_combo");
+ /*
+ * Determine whether or not the new_start_slurl modifies the grid.
+ *
+ * Note that some forms that could be in the slurl are grid-agnostic.,
+ * such as "home". Other forms, such as
+ * https://grid.example.com/region/Party%20Town/20/30/5
+ * specify a particular grid; in those cases we want to change the grid
+ * and the grid selector to match the new value.
+ */
+ enum LLSLURL::SLURL_TYPE new_slurl_type = new_start_slurl.getType();
+ switch ( new_slurl_type )
+ {
+ case LLSLURL::LOCATION:
+ {
+ std::string slurl_grid = LLGridManager::getInstance()->getGrid(new_start_slurl.getGrid());
+ if ( ! slurl_grid.empty() ) // is that a valid grid?
+ {
+ if ( slurl_grid != LLGridManager::getInstance()->getGrid() ) // new grid?
+ {
+ // the slurl changes the grid, so update everything to match
+ LLGridManager::getInstance()->setGridChoice(slurl_grid);
+
+ // update the grid selector to match the slurl
+ LLComboBox* server_combo = sInstance->getChild<LLComboBox>("server_combo");
+ std::string server_label(LLGridManager::getInstance()->getGridLabel(slurl_grid));
+ server_combo->setSimple(server_label);
+
+ updateServer(); // to change the links and splash screen
+ }
+ if ( new_start_slurl.getLocationString().length() )
+ {
+
+ location_combo->setLabel(new_start_slurl.getLocationString());
+ sInstance->mLocationLength = new_start_slurl.getLocationString().length();
+ sInstance->updateLoginButtons();
+ }
+ }
+ else
+ {
+ // the grid specified by the slurl is not known
+ LLNotificationsUtil::add("InvalidLocationSLURL");
+ LL_WARNS("AppInit")<<"invalid LoginLocation:"<<new_start_slurl.asString()<<LL_ENDL;
+ location_combo->setTextEntry(LLStringUtil::null);
+ }
+ }
+ break;
+
+ case LLSLURL::HOME_LOCATION:
+ //location_combo->setCurrentByIndex(0); // home location
+ break;
+
+ default:
+ LL_WARNS("AppInit")<<"invalid login slurl, using home"<<LL_ENDL;
+ //location_combo->setCurrentByIndex(0); // home location
+ break;
+ }
}
void LLPanelLogin::setLocation(const LLSLURL& slurl)
{
- LL_DEBUGS("AppInit")<<"setting Location "<<slurl.asString()<<LL_ENDL;
- LLStartUp::setStartSLURL(slurl); // calls onUpdateStartSLURL, above
+ LL_DEBUGS("AppInit")<<"setting Location "<<slurl.asString()<<LL_ENDL;
+ LLStartUp::setStartSLURL(slurl); // calls onUpdateStartSLURL, above
}
void LLPanelLogin::autologinToLocation(const LLSLURL& slurl)
{
- LL_DEBUGS("AppInit")<<"automatically logging into Location "<<slurl.asString()<<LL_ENDL;
- LLStartUp::setStartSLURL(slurl); // calls onUpdateStartSLURL, above
-
- if ( LLPanelLogin::sInstance != NULL )
- {
- void* unused_parameter = 0;
- LLPanelLogin::sInstance->onClickConnect(unused_parameter);
- }
+ LL_DEBUGS("AppInit")<<"automatically logging into Location "<<slurl.asString()<<LL_ENDL;
+ LLStartUp::setStartSLURL(slurl); // calls onUpdateStartSLURL, above
+
+ if ( LLPanelLogin::sInstance != NULL )
+ {
+ void* unused_parameter = 0;
+ LLPanelLogin::sInstance->onClickConnect(unused_parameter);
+ }
}
// static
void LLPanelLogin::closePanel()
{
- if (sInstance)
- {
- if (LLPanelLogin::sInstance->getParent())
- {
- LLPanelLogin::sInstance->getParent()->removeChild(LLPanelLogin::sInstance);
- }
-
- delete sInstance;
- sInstance = NULL;
- }
+ if (sInstance)
+ {
+ if (LLPanelLogin::sInstance->getParent())
+ {
+ LLPanelLogin::sInstance->getParent()->removeChild(LLPanelLogin::sInstance);
+ }
+
+ delete sInstance;
+ sInstance = NULL;
+ }
}
// static
void LLPanelLogin::setAlwaysRefresh(bool refresh)
{
- if (sInstance && LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
- {
- LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
-
- if (web_browser)
- {
- web_browser->setAlwaysRefresh(refresh);
- }
- }
+ if (sInstance && LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
+ {
+ LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
+
+ if (web_browser)
+ {
+ web_browser->setAlwaysRefresh(refresh);
+ }
+ }
}
void LLPanelLogin::loadLoginPage()
{
- if (!sInstance) return;
+ if (!sInstance) return;
- LLURI login_page = LLURI(LLGridManager::getInstance()->getLoginPage());
- LLSD params(login_page.queryMap());
+ LLURI login_page = LLURI(LLGridManager::getInstance()->getLoginPage());
+ LLSD params(login_page.queryMap());
- LL_DEBUGS("AppInit") << "login_page: " << login_page << LL_ENDL;
+ LL_DEBUGS("AppInit") << "login_page: " << login_page << LL_ENDL;
- // allow users (testers really) to specify a different login content URL
- std::string force_login_url = gSavedSettings.getString("ForceLoginURL");
- if ( force_login_url.length() > 0 )
- {
- login_page = LLURI(force_login_url);
- }
+ // allow users (testers really) to specify a different login content URL
+ std::string force_login_url = gSavedSettings.getString("ForceLoginURL");
+ if ( force_login_url.length() > 0 )
+ {
+ login_page = LLURI(force_login_url);
+ }
- // Language
- params["lang"] = LLUI::getLanguage();
+ // Language
+ params["lang"] = LLUI::getLanguage();
- // First Login?
- if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
- {
- params["firstlogin"] = "TRUE"; // not bool: server expects string TRUE
- }
+ // First Login?
+ if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
+ {
+ params["firstlogin"] = "TRUE"; // not bool: server expects string TRUE
+ }
- // Channel and Version
- params["version"] = stringize(LLVersionInfo::instance().getShortVersion(), " (",
- LLVersionInfo::instance().getBuild(), ')');
- params["channel"] = LLVersionInfo::instance().getChannel();
+ // Channel and Version
+ params["version"] = stringize(LLVersionInfo::instance().getShortVersion(), " (",
+ LLVersionInfo::instance().getBuild(), ')');
+ params["channel"] = LLVersionInfo::instance().getChannel();
- // Grid
- params["grid"] = LLGridManager::getInstance()->getGridId();
+ // Grid
+ params["grid"] = LLGridManager::getInstance()->getGridId();
- // add OS info
- params["os"] = LLOSInfo::instance().getOSStringSimple();
+ // add OS info
+ params["os"] = LLOSInfo::instance().getOSStringSimple();
- // sourceid
- params["sourceid"] = gSavedSettings.getString("sourceid");
+ // sourceid
+ params["sourceid"] = gSavedSettings.getString("sourceid");
- // login page (web) content version
- params["login_content_version"] = gSavedSettings.getString("LoginContentVersion");
+ // login page (web) content version
+ params["login_content_version"] = gSavedSettings.getString("LoginContentVersion");
- // Make an LLURI with this augmented info
- std::string url = login_page.scheme().empty()? login_page.authority() : login_page.scheme() + "://" + login_page.authority();
- LLURI login_uri(LLURI::buildHTTP(url,
- login_page.path(),
- params));
+ // Make an LLURI with this augmented info
+ std::string url = login_page.scheme().empty()? login_page.authority() : login_page.scheme() + "://" + login_page.authority();
+ LLURI login_uri(LLURI::buildHTTP(url,
+ login_page.path(),
+ params));
- gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
+ gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
- LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
- if (web_browser->getCurrentNavUrl() != login_uri.asString())
- {
- LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL;
- web_browser->navigateTo( login_uri.asString(), "text/html" );
- }
+ LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
+ if (web_browser->getCurrentNavUrl() != login_uri.asString())
+ {
+ LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL;
+ web_browser->navigateTo( login_uri.asString(), "text/html" );
+ }
}
void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent event)
@@ -936,101 +936,101 @@ void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev
// static
void LLPanelLogin::onClickConnect(bool commit_fields)
{
- if (sInstance && sInstance->mCallback)
- {
- if (commit_fields)
- {
- // JC - Make sure the fields all get committed.
- sInstance->setFocus(FALSE);
- }
-
- LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
- LLSD combo_val = combo->getSelectedValue();
-
- // the grid definitions may come from a user-supplied grids.xml, so they may not be good
- LL_DEBUGS("AppInit")<<"grid "<<combo_val.asString()<<LL_ENDL;
- try
- {
- LLGridManager::getInstance()->setGridChoice(combo_val.asString());
- }
- catch (LLInvalidGridName ex)
- {
- LLSD args;
- args["GRID"] = ex.name();
- LLNotificationsUtil::add("InvalidGrid", args);
- return;
- }
-
- // The start location SLURL has already been sent to LLStartUp::setStartSLURL
-
- std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
- std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
-
- if(username.empty())
- {
- // user must type in something into the username field
- LLNotificationsUtil::add("MustHaveAccountToLogIn");
- }
- else if(password.empty())
- {
- LLNotificationsUtil::add("MustEnterPasswordToLogIn");
- }
- else
- {
- sCredentialSet = FALSE;
- LLPointer<LLCredential> cred;
- bool remember_1, remember_2;
- getFields(cred, remember_1, remember_2);
- std::string identifier_type;
- cred->identifierType(identifier_type);
- LLSD allowed_credential_types;
- LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
-
- // check the typed in credential type against the credential types expected by the server.
- for(LLSD::array_iterator i = allowed_credential_types.beginArray();
- i != allowed_credential_types.endArray();
- i++)
- {
-
- if(i->asString() == identifier_type)
- {
- // yay correct credential type
- sInstance->mCallback(0, sInstance->mCallbackData);
- return;
- }
- }
-
- // Right now, maingrid is the only thing that is picky about
- // credential format, as it doesn't yet allow account (single username)
- // format creds. - Rox. James, we wanna fix the message when we change
- // this.
- LLNotificationsUtil::add("InvalidCredentialFormat");
- }
- }
+ if (sInstance && sInstance->mCallback)
+ {
+ if (commit_fields)
+ {
+ // JC - Make sure the fields all get committed.
+ sInstance->setFocus(FALSE);
+ }
+
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+ LLSD combo_val = combo->getSelectedValue();
+
+ // the grid definitions may come from a user-supplied grids.xml, so they may not be good
+ LL_DEBUGS("AppInit")<<"grid "<<combo_val.asString()<<LL_ENDL;
+ try
+ {
+ LLGridManager::getInstance()->setGridChoice(combo_val.asString());
+ }
+ catch (LLInvalidGridName ex)
+ {
+ LLSD args;
+ args["GRID"] = ex.name();
+ LLNotificationsUtil::add("InvalidGrid", args);
+ return;
+ }
+
+ // The start location SLURL has already been sent to LLStartUp::setStartSLURL
+
+ std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
+ std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
+
+ if(username.empty())
+ {
+ // user must type in something into the username field
+ LLNotificationsUtil::add("MustHaveAccountToLogIn");
+ }
+ else if(password.empty())
+ {
+ LLNotificationsUtil::add("MustEnterPasswordToLogIn");
+ }
+ else
+ {
+ sCredentialSet = FALSE;
+ LLPointer<LLCredential> cred;
+ bool remember_1, remember_2;
+ getFields(cred, remember_1, remember_2);
+ std::string identifier_type;
+ cred->identifierType(identifier_type);
+ LLSD allowed_credential_types;
+ LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
+
+ // check the typed in credential type against the credential types expected by the server.
+ for(LLSD::array_iterator i = allowed_credential_types.beginArray();
+ i != allowed_credential_types.endArray();
+ i++)
+ {
+
+ if(i->asString() == identifier_type)
+ {
+ // yay correct credential type
+ sInstance->mCallback(0, sInstance->mCallbackData);
+ return;
+ }
+ }
+
+ // Right now, maingrid is the only thing that is picky about
+ // credential format, as it doesn't yet allow account (single username)
+ // format creds. - Rox. James, we wanna fix the message when we change
+ // this.
+ LLNotificationsUtil::add("InvalidCredentialFormat");
+ }
+ }
}
// static
void LLPanelLogin::onClickVersion(void*)
{
- LLFloaterReg::showInstance("sl_about");
+ LLFloaterReg::showInstance("sl_about");
}
//static
void LLPanelLogin::onClickForgotPassword(void*)
{
- if (sInstance )
- {
- LLWeb::loadURLExternal(sInstance->getString( "forgot_password_url" ));
- }
+ if (sInstance )
+ {
+ LLWeb::loadURLExternal(sInstance->getString( "forgot_password_url" ));
+ }
}
//static
void LLPanelLogin::onClickSignUp(void*)
{
- if (sInstance)
- {
- LLWeb::loadURLExternal(sInstance->getString("sign_up_url"));
- }
+ if (sInstance)
+ {
+ LLWeb::loadURLExternal(sInstance->getString("sign_up_url"));
+ }
}
// static
@@ -1093,7 +1093,7 @@ void LLPanelLogin::onRememberUserCheck(void*)
{
remember_psswrd->setValue(false);
}
- remember_psswrd->setEnabled(remember);
+ remember_psswrd->setEnabled(remember);
}
}
@@ -1115,99 +1115,99 @@ void LLPanelLogin::onRememberPasswordCheck(void*)
// static
void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
{
- LLPanelLogin *self = (LLPanelLogin *)user_data;
- self->mPasswordModified = TRUE;
- if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
- {
- // *TODO: use another way to notify user about enabled caps lock, see EXT-6858
- sCapslockDidNotification = TRUE;
- }
-
- LLLineEditor* password_edit(self->getChild<LLLineEditor>("password_edit"));
- self->mPasswordLength = password_edit->getText().length();
- self->updateLoginButtons();
+ LLPanelLogin *self = (LLPanelLogin *)user_data;
+ self->mPasswordModified = TRUE;
+ if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
+ {
+ // *TODO: use another way to notify user about enabled caps lock, see EXT-6858
+ sCapslockDidNotification = TRUE;
+ }
+
+ LLLineEditor* password_edit(self->getChild<LLLineEditor>("password_edit"));
+ self->mPasswordLength = password_edit->getText().length();
+ self->updateLoginButtons();
}
void LLPanelLogin::updateServer()
{
- if (sInstance)
- {
- try
- {
- // if they've selected another grid, we should load the credentials
- // for that grid and set them to the UI. But if there were any modifications to
- // fields, modifications should carry over.
- // Not sure if it should carry over password but it worked like this before login changes
- // Example: you started typing in and found that your are under wrong grid,
- // you switch yet don't lose anything
- if (sInstance->areCredentialFieldsDirty())
- {
- // save modified creds
- LLComboBox* user_combo = sInstance->getChild<LLComboBox>("username_combo");
- LLLineEditor* pswd_edit = sInstance->getChild<LLLineEditor>("password_edit");
- std::string username = user_combo->getSimple();
- LLStringUtil::trim(username);
- std::string password = pswd_edit->getValue().asString();
-
- // populate dropbox and setFields
- // Note: following call is related to initializeLoginInfo()
- LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
- sInstance->populateUserList(credential);
-
- // restore creds
- user_combo->setTextEntry(username);
- pswd_edit->setValue(password);
- sInstance->mUsernameLength = username.length();
- sInstance->mPasswordLength = password.length();
- }
- else
- {
- // populate dropbox and setFields
- // Note: following call is related to initializeLoginInfo()
- LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
- sInstance->populateUserList(credential);
- }
-
- // update the login panel links
- bool system_grid = LLGridManager::getInstance()->isSystemGrid();
-
- // Want to vanish not only create_new_account_btn, but also the
- // title text over it, so turn on/off the whole layout_panel element.
- sInstance->getChild<LLLayoutPanel>("links")->setVisible(system_grid);
- sInstance->getChildView("forgot_password_text")->setVisible(system_grid);
-
- // grid changed so show new splash screen (possibly)
- loadLoginPage();
- }
- catch (LLInvalidGridName ex)
- {
- LL_WARNS("AppInit")<<"server '"<<ex.name()<<"' selection failed"<<LL_ENDL;
- LLSD args;
- args["GRID"] = ex.name();
- LLNotificationsUtil::add("InvalidGrid", args);
- return;
- }
- }
+ if (sInstance)
+ {
+ try
+ {
+ // if they've selected another grid, we should load the credentials
+ // for that grid and set them to the UI. But if there were any modifications to
+ // fields, modifications should carry over.
+ // Not sure if it should carry over password but it worked like this before login changes
+ // Example: you started typing in and found that your are under wrong grid,
+ // you switch yet don't lose anything
+ if (sInstance->areCredentialFieldsDirty())
+ {
+ // save modified creds
+ LLComboBox* user_combo = sInstance->getChild<LLComboBox>("username_combo");
+ LLLineEditor* pswd_edit = sInstance->getChild<LLLineEditor>("password_edit");
+ std::string username = user_combo->getSimple();
+ LLStringUtil::trim(username);
+ std::string password = pswd_edit->getValue().asString();
+
+ // populate dropbox and setFields
+ // Note: following call is related to initializeLoginInfo()
+ LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
+ sInstance->populateUserList(credential);
+
+ // restore creds
+ user_combo->setTextEntry(username);
+ pswd_edit->setValue(password);
+ sInstance->mUsernameLength = username.length();
+ sInstance->mPasswordLength = password.length();
+ }
+ else
+ {
+ // populate dropbox and setFields
+ // Note: following call is related to initializeLoginInfo()
+ LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
+ sInstance->populateUserList(credential);
+ }
+
+ // update the login panel links
+ bool system_grid = LLGridManager::getInstance()->isSystemGrid();
+
+ // Want to vanish not only create_new_account_btn, but also the
+ // title text over it, so turn on/off the whole layout_panel element.
+ sInstance->getChild<LLLayoutPanel>("links")->setVisible(system_grid);
+ sInstance->getChildView("forgot_password_text")->setVisible(system_grid);
+
+ // grid changed so show new splash screen (possibly)
+ loadLoginPage();
+ }
+ catch (LLInvalidGridName ex)
+ {
+ LL_WARNS("AppInit")<<"server '"<<ex.name()<<"' selection failed"<<LL_ENDL;
+ LLSD args;
+ args["GRID"] = ex.name();
+ LLNotificationsUtil::add("InvalidGrid", args);
+ return;
+ }
+ }
}
void LLPanelLogin::updateLoginButtons()
{
- LLButton* login_btn = getChild<LLButton>("connect_btn");
-
- login_btn->setEnabled(mUsernameLength != 0 && mPasswordLength != 0);
-
- if (!mFirstLoginThisInstall)
- {
- LLComboBox* user_combo = getChild<LLComboBox>("username_combo");
- LLCheckBoxCtrl* remember_name = getChild<LLCheckBoxCtrl>("remember_name");
- if (user_combo->getCurrentIndex() != -1)
- {
- remember_name->setValue(true);
- LLCheckBoxCtrl* remember_pass = getChild<LLCheckBoxCtrl>("remember_password");
- remember_pass->setEnabled(TRUE);
- } // Note: might be good idea to do "else remember_name->setValue(mRememberedState)" but it might behave 'weird' to user
- }
+ LLButton* login_btn = getChild<LLButton>("connect_btn");
+
+ login_btn->setEnabled(mUsernameLength != 0 && mPasswordLength != 0);
+
+ if (!mFirstLoginThisInstall)
+ {
+ LLComboBox* user_combo = getChild<LLComboBox>("username_combo");
+ LLCheckBoxCtrl* remember_name = getChild<LLCheckBoxCtrl>("remember_name");
+ if (user_combo->getCurrentIndex() != -1)
+ {
+ remember_name->setValue(true);
+ LLCheckBoxCtrl* remember_pass = getChild<LLCheckBoxCtrl>("remember_password");
+ remember_pass->setEnabled(TRUE);
+ } // Note: might be good idea to do "else remember_name->setValue(mRememberedState)" but it might behave 'weird' to user
+ }
}
void LLPanelLogin::populateUserList(LLPointer<LLCredential> credential)
@@ -1273,68 +1273,68 @@ void LLPanelLogin::populateUserList(LLPointer<LLCredential> credential)
void LLPanelLogin::onSelectServer()
{
- // The user twiddled with the grid choice ui.
- // apply the selection to the grid setting.
- LLComboBox* server_combo = getChild<LLComboBox>("server_combo");
- LLSD server_combo_val = server_combo->getSelectedValue();
- LL_INFOS("AppInit") << "grid "<<server_combo_val.asString()<< LL_ENDL;
- LLGridManager::getInstance()->setGridChoice(server_combo_val.asString());
- addFavoritesToStartLocation();
-
- /*
- * Determine whether or not the value in the start_location_combo makes sense
- * with the new grid value.
- *
- * Note that some forms that could be in the location combo are grid-agnostic,
- * such as "MyRegion/128/128/0". There could be regions with that name on any
- * number of grids, so leave them alone. Other forms, such as
- * https://grid.example.com/region/Party%20Town/20/30/5 specify a particular
- * grid; in those cases we want to clear the location.
- */
- LLComboBox* location_combo = getChild<LLComboBox>("start_location_combo");
- S32 index = location_combo->getCurrentIndex();
- switch (index)
- {
- case 0: // last location
+ // The user twiddled with the grid choice ui.
+ // apply the selection to the grid setting.
+ LLComboBox* server_combo = getChild<LLComboBox>("server_combo");
+ LLSD server_combo_val = server_combo->getSelectedValue();
+ LL_INFOS("AppInit") << "grid "<<server_combo_val.asString()<< LL_ENDL;
+ LLGridManager::getInstance()->setGridChoice(server_combo_val.asString());
+ addFavoritesToStartLocation();
+
+ /*
+ * Determine whether or not the value in the start_location_combo makes sense
+ * with the new grid value.
+ *
+ * Note that some forms that could be in the location combo are grid-agnostic,
+ * such as "MyRegion/128/128/0". There could be regions with that name on any
+ * number of grids, so leave them alone. Other forms, such as
+ * https://grid.example.com/region/Party%20Town/20/30/5 specify a particular
+ * grid; in those cases we want to clear the location.
+ */
+ LLComboBox* location_combo = getChild<LLComboBox>("start_location_combo");
+ S32 index = location_combo->getCurrentIndex();
+ switch (index)
+ {
+ case 0: // last location
LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
break;
- case 1: // home location
+ case 1: // home location
LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
- break;
-
- default:
- {
- std::string location = location_combo->getValue().asString();
- LLSLURL slurl(location); // generata a slurl from the location combo contents
- if (location.empty()
- || (slurl.getType() == LLSLURL::LOCATION
- && slurl.getGrid() != LLGridManager::getInstance()->getGrid())
- )
- {
- // the grid specified by the location is not this one, so clear the combo
- location_combo->setCurrentByIndex(0); // last location on the new grid
- onLocationSLURL();
- }
- }
- break;
- }
-
- updateServer();
+ break;
+
+ default:
+ {
+ std::string location = location_combo->getValue().asString();
+ LLSLURL slurl(location); // generata a slurl from the location combo contents
+ if (location.empty()
+ || (slurl.getType() == LLSLURL::LOCATION
+ && slurl.getGrid() != LLGridManager::getInstance()->getGrid())
+ )
+ {
+ // the grid specified by the location is not this one, so clear the combo
+ location_combo->setCurrentByIndex(0); // last location on the new grid
+ onLocationSLURL();
+ }
+ }
+ break;
+ }
+
+ updateServer();
}
void LLPanelLogin::onLocationSLURL()
{
- LLComboBox* location_combo = getChild<LLComboBox>("start_location_combo");
- std::string location = location_combo->getValue().asString();
- LL_DEBUGS("AppInit")<<location<<LL_ENDL;
+ LLComboBox* location_combo = getChild<LLComboBox>("start_location_combo");
+ std::string location = location_combo->getValue().asString();
+ LL_DEBUGS("AppInit")<<location<<LL_ENDL;
- LLStartUp::setStartSLURL(location); // calls onUpdateStartSLURL, above
+ LLStartUp::setStartSLURL(location); // calls onUpdateStartSLURL, above
}
// static
bool LLPanelLogin::getShowFavorites()
{
- return gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin");
+ return gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin");
}
// static
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index 5c4f8e9135..7f4c2487bf 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanellogin.h
* @brief Login username entry fields.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,8 +28,8 @@
#define LL_LLPANELLOGIN_H
#include "llpanel.h"
-#include "llpointer.h" // LLPointer<>
-#include "llmediactrl.h" // LLMediaCtrlObserver
+#include "llpointer.h" // LLPointer<>
+#include "llmediactrl.h" // LLMediaCtrlObserver
#include <boost/scoped_ptr.hpp>
class LLLineEditor;
@@ -38,100 +38,100 @@ class LLPanelLoginListener;
class LLSLURL;
class LLCredential;
-class LLPanelLogin:
- public LLPanel,
- public LLViewerMediaObserver
+class LLPanelLogin:
+ public LLPanel,
+ public LLViewerMediaObserver
{
- LOG_CLASS(LLPanelLogin);
+ LOG_CLASS(LLPanelLogin);
public:
- LLPanelLogin(const LLRect &rect,
- void (*callback)(S32 option, void* user_data),
- void *callback_data);
- ~LLPanelLogin();
+ LLPanelLogin(const LLRect &rect,
+ void (*callback)(S32 option, void* user_data),
+ void *callback_data);
+ ~LLPanelLogin();
- virtual void setFocus( BOOL b );
+ virtual void setFocus( BOOL b );
- static void show(const LLRect &rect,
- void (*callback)(S32 option, void* user_data),
- void* callback_data);
- static void reshapePanel();
+ static void show(const LLRect &rect,
+ void (*callback)(S32 option, void* user_data),
+ void* callback_data);
+ static void reshapePanel();
- static void populateFields(LLPointer<LLCredential> credential, bool remember_user, bool remember_psswrd);
- static void resetFields();
- static void getFields(LLPointer<LLCredential>& credential, bool& remember_user, bool& remember_psswrd);
+ static void populateFields(LLPointer<LLCredential> credential, bool remember_user, bool remember_psswrd);
+ static void resetFields();
+ static void getFields(LLPointer<LLCredential>& credential, bool& remember_user, bool& remember_psswrd);
- static BOOL isCredentialSet() { return sCredentialSet; }
+ static BOOL isCredentialSet() { return sCredentialSet; }
- static BOOL areCredentialFieldsDirty();
- static void setLocation(const LLSLURL& slurl);
- static void autologinToLocation(const LLSLURL& slurl);
-
- /// Call when preferences that control visibility may have changed
- static void updateLocationSelectorsVisibility();
+ static BOOL areCredentialFieldsDirty();
+ static void setLocation(const LLSLURL& slurl);
+ static void autologinToLocation(const LLSLURL& slurl);
- static void closePanel();
+ /// Call when preferences that control visibility may have changed
+ static void updateLocationSelectorsVisibility();
- void setSiteIsAlive( bool alive );
+ static void closePanel();
- static void loadLoginPage();
- static void giveFocus();
- static void setAlwaysRefresh(bool refresh);
-
- // inherited from LLViewerMediaObserver
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
- static void updateServer(); // update the combo box, change the login page to the new server, clear the combo
+ void setSiteIsAlive( bool alive );
- /// to be called from LLStartUp::setStartSLURL
- static void onUpdateStartSLURL(const LLSLURL& new_start_slurl);
+ static void loadLoginPage();
+ static void giveFocus();
+ static void setAlwaysRefresh(bool refresh);
- // called from prefs when initializing panel
- static bool getShowFavorites();
+ // inherited from LLViewerMediaObserver
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+ static void updateServer(); // update the combo box, change the login page to the new server, clear the combo
- // extract name from cred in a format apropriate for username field
- static std::string getUserName(LLPointer<LLCredential> &cred);
+ /// to be called from LLStartUp::setStartSLURL
+ static void onUpdateStartSLURL(const LLSLURL& new_start_slurl);
+
+ // called from prefs when initializing panel
+ static bool getShowFavorites();
+
+ // extract name from cred in a format apropriate for username field
+ static std::string getUserName(LLPointer<LLCredential> &cred);
private:
- friend class LLPanelLoginListener;
- void addFavoritesToStartLocation();
- void addUsersWithFavoritesToUsername();
- void onSelectServer();
- void onLocationSLURL();
-
- static void setFields(LLPointer<LLCredential> credential);
-
- static void onClickConnect(bool commit_fields = true);
- static void onClickNewAccount(void*);
- static void onClickVersion(void*);
- static void onClickForgotPassword(void*);
- static void onClickSignUp(void*);
- static void onUserNameTextEnty(void*);
- static void onUserListCommit(void*);
- static void onRememberUserCheck(void*);
+ friend class LLPanelLoginListener;
+ void addFavoritesToStartLocation();
+ void addUsersWithFavoritesToUsername();
+ void onSelectServer();
+ void onLocationSLURL();
+
+ static void setFields(LLPointer<LLCredential> credential);
+
+ static void onClickConnect(bool commit_fields = true);
+ static void onClickNewAccount(void*);
+ static void onClickVersion(void*);
+ static void onClickForgotPassword(void*);
+ static void onClickSignUp(void*);
+ static void onUserNameTextEnty(void*);
+ static void onUserListCommit(void*);
+ static void onRememberUserCheck(void*);
static void onRememberPasswordCheck(void*);
- static void onPassKey(LLLineEditor* caller, void* user_data);
- static void updateServerCombo();
+ static void onPassKey(LLLineEditor* caller, void* user_data);
+ static void updateServerCombo();
private:
- std::unique_ptr<LLPanelLoginListener> mListener;
+ std::unique_ptr<LLPanelLoginListener> mListener;
+
+ void updateLoginButtons();
+ void populateUserList(LLPointer<LLCredential> credential);
- void updateLoginButtons();
- void populateUserList(LLPointer<LLCredential> credential);
+ void (*mCallback)(S32 option, void *userdata);
+ void* mCallbackData;
- void (*mCallback)(S32 option, void *userdata);
- void* mCallbackData;
+ BOOL mPasswordModified;
+ bool mShowFavorites;
- BOOL mPasswordModified;
- bool mShowFavorites;
+ static LLPanelLogin* sInstance;
+ static BOOL sCapslockDidNotification;
+ bool mFirstLoginThisInstall;
- static LLPanelLogin* sInstance;
- static BOOL sCapslockDidNotification;
- bool mFirstLoginThisInstall;
-
static BOOL sCredentialSet;
- unsigned int mUsernameLength;
- unsigned int mPasswordLength;
- unsigned int mLocationLength;
+ unsigned int mUsernameLength;
+ unsigned int mPasswordLength;
+ unsigned int mLocationLength;
};
#endif
diff --git a/indra/newview/llpanelloginlistener.cpp b/indra/newview/llpanelloginlistener.cpp
index fb3e8dc244..fb6f034b7f 100644
--- a/indra/newview/llpanelloginlistener.cpp
+++ b/indra/newview/llpanelloginlistener.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-12-10
* @brief Implementation for llpanelloginlistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llpanelloginlistener.h b/indra/newview/llpanelloginlistener.h
index 45dcea269c..b552ccd5b0 100644
--- a/indra/newview/llpanelloginlistener.h
+++ b/indra/newview/llpanelloginlistener.h
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-12-10
* @brief LLEventAPI for LLPanelLogin
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 20241aac24..5887e793e1 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelmaininventory.cpp
* @brief Implementation of llpanelmaininventory.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -77,29 +77,29 @@ static LLPanelInjector<LLPanelMainInventory> t_inventory("panel_main_inventory")
class LLFloaterInventoryFinder : public LLFloater
{
public:
- LLFloaterInventoryFinder( LLPanelMainInventory* inventory_view);
- virtual void draw();
- /*virtual*/ BOOL postBuild();
- void changeFilter(LLInventoryFilter* filter);
- void updateElementsFromFilter();
- BOOL getCheckShowEmpty();
- BOOL getCheckSinceLogoff();
- U32 getDateSearchDirection();
-
- void onCreatorSelfFilterCommit();
- void onCreatorOtherFilterCommit();
-
- static void onTimeAgo(LLUICtrl*, void *);
- static void onCloseBtn(void* user_data);
- static void selectAllTypes(void* user_data);
- static void selectNoTypes(void* user_data);
+ LLFloaterInventoryFinder( LLPanelMainInventory* inventory_view);
+ virtual void draw();
+ /*virtual*/ BOOL postBuild();
+ void changeFilter(LLInventoryFilter* filter);
+ void updateElementsFromFilter();
+ BOOL getCheckShowEmpty();
+ BOOL getCheckSinceLogoff();
+ U32 getDateSearchDirection();
+
+ void onCreatorSelfFilterCommit();
+ void onCreatorOtherFilterCommit();
+
+ static void onTimeAgo(LLUICtrl*, void *);
+ static void onCloseBtn(void* user_data);
+ static void selectAllTypes(void* user_data);
+ static void selectNoTypes(void* user_data);
private:
- LLPanelMainInventory* mPanelMainInventory;
- LLSpinCtrl* mSpinSinceDays;
- LLSpinCtrl* mSpinSinceHours;
- LLCheckBoxCtrl* mCreatorSelf;
- LLCheckBoxCtrl* mCreatorOthers;
- LLInventoryFilter* mFilter;
+ LLPanelMainInventory* mPanelMainInventory;
+ LLSpinCtrl* mSpinSinceDays;
+ LLSpinCtrl* mSpinSinceHours;
+ LLCheckBoxCtrl* mCreatorSelf;
+ LLCheckBoxCtrl* mCreatorOthers;
+ LLInventoryFilter* mFilter;
};
///----------------------------------------------------------------------------
@@ -107,15 +107,15 @@ private:
///----------------------------------------------------------------------------
LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
- : LLPanel(p),
- mActivePanel(NULL),
- mWornItemsPanel(NULL),
- mSavedFolderState(NULL),
- mFilterText(""),
- mMenuGearDefault(NULL),
- mMenuVisibility(NULL),
- mMenuAddHandle(),
- mNeedUploadCost(true),
+ : LLPanel(p),
+ mActivePanel(NULL),
+ mWornItemsPanel(NULL),
+ mSavedFolderState(NULL),
+ mFilterText(""),
+ mMenuGearDefault(NULL),
+ mMenuVisibility(NULL),
+ mMenuAddHandle(),
+ mNeedUploadCost(true),
mMenuViewDefault(NULL),
mSingleFolderMode(false),
mForceShowInvLayout(false),
@@ -123,128 +123,128 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
mListViewRootUpdatedConnection(),
mGalleryRootUpdatedConnection()
{
- // Menu Callbacks (non contex menus)
- mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelMainInventory::doToSelected, this, _2));
- mCommitCallbackRegistrar.add("Inventory.CloseAllFolders", boost::bind(&LLPanelMainInventory::closeAllFolders, this));
- mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
- mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND));
- mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLPanelMainInventory::doCreate, this, _2));
- mCommitCallbackRegistrar.add("Inventory.ShowFilters", boost::bind(&LLPanelMainInventory::toggleFindOptions, this));
- mCommitCallbackRegistrar.add("Inventory.ResetFilters", boost::bind(&LLPanelMainInventory::resetFilters, this));
- mCommitCallbackRegistrar.add("Inventory.SetSortBy", boost::bind(&LLPanelMainInventory::setSortBy, this, _2));
+ // Menu Callbacks (non contex menus)
+ mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelMainInventory::doToSelected, this, _2));
+ mCommitCallbackRegistrar.add("Inventory.CloseAllFolders", boost::bind(&LLPanelMainInventory::closeAllFolders, this));
+ mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
+ mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND));
+ mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLPanelMainInventory::doCreate, this, _2));
+ mCommitCallbackRegistrar.add("Inventory.ShowFilters", boost::bind(&LLPanelMainInventory::toggleFindOptions, this));
+ mCommitCallbackRegistrar.add("Inventory.ResetFilters", boost::bind(&LLPanelMainInventory::resetFilters, this));
+ mCommitCallbackRegistrar.add("Inventory.SetSortBy", boost::bind(&LLPanelMainInventory::setSortBy, this, _2));
mEnableCallbackRegistrar.add("Inventory.EnvironmentEnabled", [](LLUICtrl *, const LLSD &) { return LLPanelMainInventory::hasSettingsInventory(); });
mEnableCallbackRegistrar.add("Inventory.MaterialsEnabled", [](LLUICtrl *, const LLSD &) { return LLPanelMainInventory::hasMaterialsInventory(); });
- mSavedFolderState = new LLSaveFolderState();
- mSavedFolderState->setApply(FALSE);
+ mSavedFolderState = new LLSaveFolderState();
+ mSavedFolderState->setApply(FALSE);
}
BOOL LLPanelMainInventory::postBuild()
{
- gInventory.addObserver(this);
-
- mFilterTabs = getChild<LLTabContainer>("inventory filter tabs");
- mFilterTabs->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterSelected, this));
-
+ gInventory.addObserver(this);
+
+ mFilterTabs = getChild<LLTabContainer>("inventory filter tabs");
+ mFilterTabs->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterSelected, this));
+
mCounterCtrl = getChild<LLUICtrl>("ItemcountText");
-
- //panel->getFilter().markDefault();
-
- // Set up the default inv. panel/filter settings.
- mActivePanel = getChild<LLInventoryPanel>(ALL_ITEMS);
- if (mActivePanel)
- {
- // "All Items" is the previous only view, so it gets the InventorySortOrder
- mActivePanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER));
- mActivePanel->getFilter().markDefault();
- mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
- mActivePanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mActivePanel, _1, _2));
- mResortActivePanel = true;
- }
- LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>(RECENT_ITEMS);
- if (recent_items_panel)
- {
- // assign default values until we will be sure that we have setting to restore
- recent_items_panel->setSinceLogoff(TRUE);
- recent_items_panel->setSortOrder(LLInventoryFilter::SO_DATE);
- recent_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- LLInventoryFilter& recent_filter = recent_items_panel->getFilter();
- recent_filter.setFilterObjectTypes(recent_filter.getFilterObjectTypes() & ~(0x1 << LLInventoryType::IT_CATEGORY));
- recent_filter.setEmptyLookupMessage("InventoryNoMatchingRecentItems");
- recent_filter.markDefault();
- recent_items_panel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, recent_items_panel, _1, _2));
- }
-
- mWornItemsPanel = getChild<LLInventoryPanel>(WORN_ITEMS);
- if (mWornItemsPanel)
- {
- U32 filter_types = 0x0;
- filter_types |= 0x1 << LLInventoryType::IT_WEARABLE;
- filter_types |= 0x1 << LLInventoryType::IT_ATTACHMENT;
- filter_types |= 0x1 << LLInventoryType::IT_OBJECT;
- mWornItemsPanel->setFilterTypes(filter_types);
- mWornItemsPanel->setFilterWorn();
- mWornItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- mWornItemsPanel->setFilterLinks(LLInventoryFilter::FILTERLINK_EXCLUDE_LINKS);
- LLInventoryFilter& worn_filter = mWornItemsPanel->getFilter();
- worn_filter.setFilterCategoryTypes(worn_filter.getFilterCategoryTypes() | (1ULL << LLFolderType::FT_INBOX));
- worn_filter.markDefault();
- mWornItemsPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mWornItemsPanel, _1, _2));
- }
- mSearchTypeCombo = getChild<LLComboBox>("search_type");
- if(mSearchTypeCombo)
- {
- mSearchTypeCombo->setCommitCallback(boost::bind(&LLPanelMainInventory::onSelectSearchType, this));
- }
- // Now load the stored settings from disk, if available.
- std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME));
- LL_INFOS("Inventory") << "LLPanelMainInventory::init: reading from " << filterSaveName << LL_ENDL;
- llifstream file(filterSaveName.c_str());
- LLSD savedFilterState;
- if (file.is_open())
- {
- LLSDSerialize::fromXML(savedFilterState, file);
- file.close();
-
- // Load the persistent "Recent Items" settings.
- // Note that the "All Items" settings do not persist.
- if(recent_items_panel)
- {
- if(savedFilterState.has(recent_items_panel->getFilter().getName()))
- {
- LLSD recent_items = savedFilterState.get(
- recent_items_panel->getFilter().getName());
- LLInventoryFilter::Params p;
- LLParamSDParser parser;
- parser.readSD(recent_items, p);
- recent_items_panel->getFilter().fromParams(p);
- recent_items_panel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::RECENTITEMS_SORT_ORDER));
- }
- }
- if(mActivePanel)
- {
- if(savedFilterState.has(mActivePanel->getFilter().getName()))
- {
- LLSD items = savedFilterState.get(mActivePanel->getFilter().getName());
- LLInventoryFilter::Params p;
- LLParamSDParser parser;
- parser.readSD(items, p);
- mActivePanel->getFilter().setSearchVisibilityTypes(p);
- }
- }
-
- }
-
- mFilterEditor = getChild<LLFilterEditor>("inventory search editor");
- if (mFilterEditor)
- {
- mFilterEditor->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterEdit, this, _2));
- }
-
- mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
- mVisibilityMenuButton = getChild<LLMenuButton>("options_visibility_btn");
+
+ //panel->getFilter().markDefault();
+
+ // Set up the default inv. panel/filter settings.
+ mActivePanel = getChild<LLInventoryPanel>(ALL_ITEMS);
+ if (mActivePanel)
+ {
+ // "All Items" is the previous only view, so it gets the InventorySortOrder
+ mActivePanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER));
+ mActivePanel->getFilter().markDefault();
+ mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+ mActivePanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mActivePanel, _1, _2));
+ mResortActivePanel = true;
+ }
+ LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>(RECENT_ITEMS);
+ if (recent_items_panel)
+ {
+ // assign default values until we will be sure that we have setting to restore
+ recent_items_panel->setSinceLogoff(TRUE);
+ recent_items_panel->setSortOrder(LLInventoryFilter::SO_DATE);
+ recent_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+ LLInventoryFilter& recent_filter = recent_items_panel->getFilter();
+ recent_filter.setFilterObjectTypes(recent_filter.getFilterObjectTypes() & ~(0x1 << LLInventoryType::IT_CATEGORY));
+ recent_filter.setEmptyLookupMessage("InventoryNoMatchingRecentItems");
+ recent_filter.markDefault();
+ recent_items_panel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, recent_items_panel, _1, _2));
+ }
+
+ mWornItemsPanel = getChild<LLInventoryPanel>(WORN_ITEMS);
+ if (mWornItemsPanel)
+ {
+ U32 filter_types = 0x0;
+ filter_types |= 0x1 << LLInventoryType::IT_WEARABLE;
+ filter_types |= 0x1 << LLInventoryType::IT_ATTACHMENT;
+ filter_types |= 0x1 << LLInventoryType::IT_OBJECT;
+ mWornItemsPanel->setFilterTypes(filter_types);
+ mWornItemsPanel->setFilterWorn();
+ mWornItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+ mWornItemsPanel->setFilterLinks(LLInventoryFilter::FILTERLINK_EXCLUDE_LINKS);
+ LLInventoryFilter& worn_filter = mWornItemsPanel->getFilter();
+ worn_filter.setFilterCategoryTypes(worn_filter.getFilterCategoryTypes() | (1ULL << LLFolderType::FT_INBOX));
+ worn_filter.markDefault();
+ mWornItemsPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mWornItemsPanel, _1, _2));
+ }
+ mSearchTypeCombo = getChild<LLComboBox>("search_type");
+ if(mSearchTypeCombo)
+ {
+ mSearchTypeCombo->setCommitCallback(boost::bind(&LLPanelMainInventory::onSelectSearchType, this));
+ }
+ // Now load the stored settings from disk, if available.
+ std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME));
+ LL_INFOS("Inventory") << "LLPanelMainInventory::init: reading from " << filterSaveName << LL_ENDL;
+ llifstream file(filterSaveName.c_str());
+ LLSD savedFilterState;
+ if (file.is_open())
+ {
+ LLSDSerialize::fromXML(savedFilterState, file);
+ file.close();
+
+ // Load the persistent "Recent Items" settings.
+ // Note that the "All Items" settings do not persist.
+ if(recent_items_panel)
+ {
+ if(savedFilterState.has(recent_items_panel->getFilter().getName()))
+ {
+ LLSD recent_items = savedFilterState.get(
+ recent_items_panel->getFilter().getName());
+ LLInventoryFilter::Params p;
+ LLParamSDParser parser;
+ parser.readSD(recent_items, p);
+ recent_items_panel->getFilter().fromParams(p);
+ recent_items_panel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::RECENTITEMS_SORT_ORDER));
+ }
+ }
+ if(mActivePanel)
+ {
+ if(savedFilterState.has(mActivePanel->getFilter().getName()))
+ {
+ LLSD items = savedFilterState.get(mActivePanel->getFilter().getName());
+ LLInventoryFilter::Params p;
+ LLParamSDParser parser;
+ parser.readSD(items, p);
+ mActivePanel->getFilter().setSearchVisibilityTypes(p);
+ }
+ }
+
+ }
+
+ mFilterEditor = getChild<LLFilterEditor>("inventory search editor");
+ if (mFilterEditor)
+ {
+ mFilterEditor->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterEdit, this, _2));
+ }
+
+ mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
+ mVisibilityMenuButton = getChild<LLMenuButton>("options_visibility_btn");
mViewMenuButton = getChild<LLMenuButton>("view_btn");
mBackBtn = getChild<LLButton>("back_btn");
@@ -274,75 +274,75 @@ BOOL LLPanelMainInventory::postBuild()
mGalleryRootUpdatedConnection = mCombinationGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, true));
mCombinationGalleryPanel->setSelectionChangeCallback(boost::bind(&LLPanelMainInventory::onCombinationGallerySelectionChanged, this, _1));
- initListCommandsHandlers();
+ initListCommandsHandlers();
- const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
- const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost());
- const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost());
+ const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
+ const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost());
+ const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost());
- LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
- if (menu)
- {
- menu->getChild<LLMenuItemGL>("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str);
- menu->getChild<LLMenuItemGL>("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str);
- menu->getChild<LLMenuItemGL>("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str);
- }
+ LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
+ if (menu)
+ {
+ menu->getChild<LLMenuItemGL>("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str);
+ menu->getChild<LLMenuItemGL>("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str);
+ menu->getChild<LLMenuItemGL>("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str);
+ }
- // Trigger callback for focus received so we can deselect items in inbox/outbox
- LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMainInventory::onFocusReceived, this));
+ // Trigger callback for focus received so we can deselect items in inbox/outbox
+ LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMainInventory::onFocusReceived, this));
- return TRUE;
+ return TRUE;
}
// Destroys the object
LLPanelMainInventory::~LLPanelMainInventory( void )
{
- // Save the filters state.
- // Some params types cannot be saved this way
- // for example, LLParamSDParser doesn't know about U64,
- // so some FilterOps params should be revised.
- LLSD filterRoot;
- LLInventoryPanel* all_items_panel = getChild<LLInventoryPanel>(ALL_ITEMS);
- if (all_items_panel)
- {
- LLSD filterState;
- LLInventoryPanel::InventoryState p;
- all_items_panel->getFilter().toParams(p.filter);
- all_items_panel->getRootViewModel().getSorter().toParams(p.sort);
- if (p.validateBlock(false))
- {
- LLParamSDParser().writeSD(filterState, p);
- filterRoot[all_items_panel->getName()] = filterState;
- }
- }
-
- LLInventoryPanel* panel = findChild<LLInventoryPanel>(RECENT_ITEMS);
- if (panel)
- {
- LLSD filterState;
- LLInventoryPanel::InventoryState p;
- panel->getFilter().toParams(p.filter);
- panel->getRootViewModel().getSorter().toParams(p.sort);
- if (p.validateBlock(false))
- {
- LLParamSDParser().writeSD(filterState, p);
- filterRoot[panel->getName()] = filterState;
- }
- }
-
- std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME));
- llofstream filtersFile(filterSaveName.c_str());
- if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile))
- {
- LL_WARNS() << "Could not write to filters save file " << filterSaveName << LL_ENDL;
- }
- else
- {
- filtersFile.close();
- }
-
- gInventory.removeObserver(this);
- delete mSavedFolderState;
+ // Save the filters state.
+ // Some params types cannot be saved this way
+ // for example, LLParamSDParser doesn't know about U64,
+ // so some FilterOps params should be revised.
+ LLSD filterRoot;
+ LLInventoryPanel* all_items_panel = getChild<LLInventoryPanel>(ALL_ITEMS);
+ if (all_items_panel)
+ {
+ LLSD filterState;
+ LLInventoryPanel::InventoryState p;
+ all_items_panel->getFilter().toParams(p.filter);
+ all_items_panel->getRootViewModel().getSorter().toParams(p.sort);
+ if (p.validateBlock(false))
+ {
+ LLParamSDParser().writeSD(filterState, p);
+ filterRoot[all_items_panel->getName()] = filterState;
+ }
+ }
+
+ LLInventoryPanel* panel = findChild<LLInventoryPanel>(RECENT_ITEMS);
+ if (panel)
+ {
+ LLSD filterState;
+ LLInventoryPanel::InventoryState p;
+ panel->getFilter().toParams(p.filter);
+ panel->getRootViewModel().getSorter().toParams(p.sort);
+ if (p.validateBlock(false))
+ {
+ LLParamSDParser().writeSD(filterState, p);
+ filterRoot[panel->getName()] = filterState;
+ }
+ }
+
+ std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME));
+ llofstream filtersFile(filterSaveName.c_str());
+ if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile))
+ {
+ LL_WARNS() << "Could not write to filters save file " << filterSaveName << LL_ENDL;
+ }
+ else
+ {
+ filtersFile.close();
+ }
+
+ gInventory.removeObserver(this);
+ delete mSavedFolderState;
auto menu = mMenuAddHandle.get();
if(menu)
@@ -363,57 +363,57 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel()
{
- return getChild<LLInventoryPanel>(ALL_ITEMS);
+ return getChild<LLInventoryPanel>(ALL_ITEMS);
}
void LLPanelMainInventory::selectAllItemsPanel()
{
- mFilterTabs->selectFirstTab();
+ mFilterTabs->selectFirstTab();
}
bool LLPanelMainInventory::isRecentItemsPanelSelected()
{
- return (RECENT_ITEMS == getActivePanel()->getName());
+ return (RECENT_ITEMS == getActivePanel()->getName());
}
void LLPanelMainInventory::startSearch()
{
- // this forces focus to line editor portion of search editor
- if (mFilterEditor)
- {
- mFilterEditor->focusFirstItem(TRUE);
- }
+ // this forces focus to line editor portion of search editor
+ if (mFilterEditor)
+ {
+ mFilterEditor->focusFirstItem(TRUE);
+ }
}
BOOL LLPanelMainInventory::handleKeyHere(KEY key, MASK mask)
{
- LLFolderView* root_folder = mActivePanel ? mActivePanel->getRootFolder() : NULL;
- if (root_folder)
- {
- // first check for user accepting current search results
- if (mFilterEditor
- && mFilterEditor->hasFocus()
- && (key == KEY_RETURN
- || key == KEY_DOWN)
- && mask == MASK_NONE)
- {
- // move focus to inventory proper
- mActivePanel->setFocus(TRUE);
- root_folder->scrollToShowSelection();
- return TRUE;
- }
-
- if (mActivePanel->hasFocus() && key == KEY_UP)
- {
- startSearch();
- }
+ LLFolderView* root_folder = mActivePanel ? mActivePanel->getRootFolder() : NULL;
+ if (root_folder)
+ {
+ // first check for user accepting current search results
+ if (mFilterEditor
+ && mFilterEditor->hasFocus()
+ && (key == KEY_RETURN
+ || key == KEY_DOWN)
+ && mask == MASK_NONE)
+ {
+ // move focus to inventory proper
+ mActivePanel->setFocus(TRUE);
+ root_folder->scrollToShowSelection();
+ return TRUE;
+ }
+
+ if (mActivePanel->hasFocus() && key == KEY_UP)
+ {
+ startSearch();
+ }
if(mSingleFolderMode && key == KEY_LEFT)
{
onBackFolderClicked();
}
- }
+ }
- return LLPanel::handleKeyHere(key, mask);
+ return LLPanel::handleKeyHere(key, mask);
}
@@ -422,12 +422,12 @@ BOOL LLPanelMainInventory::handleKeyHere(KEY key, MASK mask)
void LLPanelMainInventory::doToSelected(const LLSD& userdata)
{
- getPanel()->doToSelected(userdata);
+ getPanel()->doToSelected(userdata);
}
void LLPanelMainInventory::closeAllFolders()
{
- getPanel()->getRootFolder()->closeAllFolders();
+ getPanel()->getRootFolder()->closeAllFolders();
}
S32 get_instance_num()
@@ -442,13 +442,13 @@ LLFloaterSidePanelContainer* LLPanelMainInventory::newWindow()
{
S32 instance_num = get_instance_num();
- if (!gAgentCamera.cameraMouselook())
- {
+ if (!gAgentCamera.cameraMouselook())
+ {
LLFloaterSidePanelContainer* floater = LLFloaterReg::showTypedInstance<LLFloaterSidePanelContainer>("inventory", LLSD(instance_num));
LLSidepanelInventory* sidepanel_inventory = floater->findChild<LLSidepanelInventory>("main_panel");
sidepanel_inventory->initInventoryViews();
- return floater;
- }
+ return floater;
+ }
return NULL;
}
@@ -478,7 +478,7 @@ void LLPanelMainInventory::newFolderWindow(LLUUID folder_id, LLUUID item_to_sele
}
}
}
-
+
S32 instance_num = get_instance_num();
LLFloaterSidePanelContainer* inventory_container = LLFloaterReg::showTypedInstance<LLFloaterSidePanelContainer>("inventory", LLSD(instance_num));
@@ -506,7 +506,7 @@ void LLPanelMainInventory::newFolderWindow(LLUUID folder_id, LLUUID item_to_sele
void LLPanelMainInventory::doCreate(const LLSD& userdata)
{
- reset_inventory_filter();
+ reset_inventory_filter();
if(mSingleFolderMode)
{
if(isListViewMode() || isCombinationViewMode())
@@ -567,14 +567,14 @@ void LLPanelMainInventory::doCreate(const LLSD& userdata)
void LLPanelMainInventory::resetFilters()
{
- LLFloaterInventoryFinder *finder = getFinder();
- getCurrentFilter().resetDefault();
- if (finder)
- {
- finder->updateElementsFromFilter();
- }
+ LLFloaterInventoryFinder *finder = getFinder();
+ getCurrentFilter().resetDefault();
+ if (finder)
+ {
+ finder->updateElementsFromFilter();
+ }
- setFilterTextFromFilter();
+ setFilterTextFromFilter();
}
void LLPanelMainInventory::resetAllItemsFilters()
@@ -602,44 +602,44 @@ void LLPanelMainInventory::findLinks(const LLUUID& item_id, const std::string& i
void LLPanelMainInventory::setSortBy(const LLSD& userdata)
{
- U32 sort_order_mask = getActivePanel()->getSortOrder();
- std::string sort_type = userdata.asString();
- if (sort_type == "name")
- {
- sort_order_mask &= ~LLInventoryFilter::SO_DATE;
- }
- else if (sort_type == "date")
- {
- sort_order_mask |= LLInventoryFilter::SO_DATE;
- }
- else if (sort_type == "foldersalwaysbyname")
- {
- if ( sort_order_mask & LLInventoryFilter::SO_FOLDERS_BY_NAME )
- {
- sort_order_mask &= ~LLInventoryFilter::SO_FOLDERS_BY_NAME;
- }
- else
- {
- sort_order_mask |= LLInventoryFilter::SO_FOLDERS_BY_NAME;
- }
- }
- else if (sort_type == "systemfolderstotop")
- {
- if ( sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP )
- {
- sort_order_mask &= ~LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
- }
- else
- {
- sort_order_mask |= LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
- }
- }
+ U32 sort_order_mask = getActivePanel()->getSortOrder();
+ std::string sort_type = userdata.asString();
+ if (sort_type == "name")
+ {
+ sort_order_mask &= ~LLInventoryFilter::SO_DATE;
+ }
+ else if (sort_type == "date")
+ {
+ sort_order_mask |= LLInventoryFilter::SO_DATE;
+ }
+ else if (sort_type == "foldersalwaysbyname")
+ {
+ if ( sort_order_mask & LLInventoryFilter::SO_FOLDERS_BY_NAME )
+ {
+ sort_order_mask &= ~LLInventoryFilter::SO_FOLDERS_BY_NAME;
+ }
+ else
+ {
+ sort_order_mask |= LLInventoryFilter::SO_FOLDERS_BY_NAME;
+ }
+ }
+ else if (sort_type == "systemfolderstotop")
+ {
+ if ( sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP )
+ {
+ sort_order_mask &= ~LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
+ }
+ else
+ {
+ sort_order_mask |= LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
+ }
+ }
if(mSingleFolderMode && !isListViewMode())
{
mCombinationGalleryPanel->setSortOrder(sort_order_mask, true);
}
- getActivePanel()->setSortOrder(sort_order_mask);
+ getActivePanel()->setSortOrder(sort_order_mask);
if (isRecentItemsPanelSelected())
{
gSavedSettings.setU32("RecentItemsSortOrder", sort_order_mask);
@@ -652,23 +652,23 @@ void LLPanelMainInventory::setSortBy(const LLSD& userdata)
void LLPanelMainInventory::onSelectSearchType()
{
- std::string new_type = mSearchTypeCombo->getValue();
- if (new_type == "search_by_name")
- {
- setSearchType(LLInventoryFilter::SEARCHTYPE_NAME);
- }
- if (new_type == "search_by_creator")
- {
- setSearchType(LLInventoryFilter::SEARCHTYPE_CREATOR);
- }
- if (new_type == "search_by_description")
- {
- setSearchType(LLInventoryFilter::SEARCHTYPE_DESCRIPTION);
- }
- if (new_type == "search_by_UUID")
- {
- setSearchType(LLInventoryFilter::SEARCHTYPE_UUID);
- }
+ std::string new_type = mSearchTypeCombo->getValue();
+ if (new_type == "search_by_name")
+ {
+ setSearchType(LLInventoryFilter::SEARCHTYPE_NAME);
+ }
+ if (new_type == "search_by_creator")
+ {
+ setSearchType(LLInventoryFilter::SEARCHTYPE_CREATOR);
+ }
+ if (new_type == "search_by_description")
+ {
+ setSearchType(LLInventoryFilter::SEARCHTYPE_DESCRIPTION);
+ }
+ if (new_type == "search_by_UUID")
+ {
+ setSearchType(LLInventoryFilter::SEARCHTYPE_UUID);
+ }
}
void LLPanelMainInventory::setSearchType(LLInventoryFilter::ESearchType type)
@@ -705,70 +705,70 @@ void LLPanelMainInventory::updateSearchTypeCombo()
search_type = getActivePanel()->getSearchType();
}
- switch(search_type)
- {
- case LLInventoryFilter::SEARCHTYPE_CREATOR:
- mSearchTypeCombo->setValue("search_by_creator");
- break;
- case LLInventoryFilter::SEARCHTYPE_DESCRIPTION:
- mSearchTypeCombo->setValue("search_by_description");
- break;
- case LLInventoryFilter::SEARCHTYPE_UUID:
- mSearchTypeCombo->setValue("search_by_UUID");
- break;
- case LLInventoryFilter::SEARCHTYPE_NAME:
- default:
- mSearchTypeCombo->setValue("search_by_name");
- break;
- }
+ switch(search_type)
+ {
+ case LLInventoryFilter::SEARCHTYPE_CREATOR:
+ mSearchTypeCombo->setValue("search_by_creator");
+ break;
+ case LLInventoryFilter::SEARCHTYPE_DESCRIPTION:
+ mSearchTypeCombo->setValue("search_by_description");
+ break;
+ case LLInventoryFilter::SEARCHTYPE_UUID:
+ mSearchTypeCombo->setValue("search_by_UUID");
+ break;
+ case LLInventoryFilter::SEARCHTYPE_NAME:
+ default:
+ mSearchTypeCombo->setValue("search_by_name");
+ break;
+ }
}
// static
BOOL LLPanelMainInventory::filtersVisible(void* user_data)
{
- LLPanelMainInventory* self = (LLPanelMainInventory*)user_data;
- if(!self) return FALSE;
+ LLPanelMainInventory* self = (LLPanelMainInventory*)user_data;
+ if(!self) return FALSE;
- return self->getFinder() != NULL;
+ return self->getFinder() != NULL;
}
void LLPanelMainInventory::onClearSearch()
{
- BOOL initially_active = FALSE;
- LLFloater *finder = getFinder();
- if (mActivePanel && (getActivePanel() != mWornItemsPanel))
- {
- initially_active = mActivePanel->getFilter().isNotDefault();
- setFilterSubString(LLStringUtil::null);
- mActivePanel->setFilterTypes(0xffffffffffffffffULL);
- mActivePanel->setFilterLinks(LLInventoryFilter::FILTERLINK_INCLUDE_LINKS);
- }
-
- if (finder)
- {
- LLFloaterInventoryFinder::selectAllTypes(finder);
- }
-
- // re-open folders that were initially open in case filter was active
- if (mActivePanel && (mFilterSubString.size() || initially_active) && !mSingleFolderMode)
- {
- mSavedFolderState->setApply(TRUE);
- mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
- LLOpenFoldersWithSelection opener;
- mActivePanel->getRootFolder()->applyFunctorRecursively(opener);
- mActivePanel->getRootFolder()->scrollToShowSelection();
- }
- mFilterSubString = "";
-
- LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory();
- if (sidepanel_inventory)
- {
- LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
- if (inbox_panel)
- {
- inbox_panel->onClearSearch();
- }
- }
+ BOOL initially_active = FALSE;
+ LLFloater *finder = getFinder();
+ if (mActivePanel && (getActivePanel() != mWornItemsPanel))
+ {
+ initially_active = mActivePanel->getFilter().isNotDefault();
+ setFilterSubString(LLStringUtil::null);
+ mActivePanel->setFilterTypes(0xffffffffffffffffULL);
+ mActivePanel->setFilterLinks(LLInventoryFilter::FILTERLINK_INCLUDE_LINKS);
+ }
+
+ if (finder)
+ {
+ LLFloaterInventoryFinder::selectAllTypes(finder);
+ }
+
+ // re-open folders that were initially open in case filter was active
+ if (mActivePanel && (mFilterSubString.size() || initially_active) && !mSingleFolderMode)
+ {
+ mSavedFolderState->setApply(TRUE);
+ mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+ LLOpenFoldersWithSelection opener;
+ mActivePanel->getRootFolder()->applyFunctorRecursively(opener);
+ mActivePanel->getRootFolder()->scrollToShowSelection();
+ }
+ mFilterSubString = "";
+
+ LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory();
+ if (sidepanel_inventory)
+ {
+ LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
+ if (inbox_panel)
+ {
+ inbox_panel->onClearSearch();
+ }
+ }
}
void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
@@ -784,15 +784,15 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
mCombinationGalleryPanel->setFilterSubString(search_string);
}
- if (search_string == "")
- {
- onClearSearch();
- }
+ if (search_string == "")
+ {
+ onClearSearch();
+ }
- if (!mActivePanel)
- {
- return;
- }
+ if (!mActivePanel)
+ {
+ return;
+ }
if (!LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted())
{
@@ -800,215 +800,215 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
LLInventoryModelBackgroundFetch::instance().start();
}
- mFilterSubString = search_string;
- if (mActivePanel->getFilterSubString().empty() && mFilterSubString.empty())
- {
- // current filter and new filter empty, do nothing
- return;
- }
+ mFilterSubString = search_string;
+ if (mActivePanel->getFilterSubString().empty() && mFilterSubString.empty())
+ {
+ // current filter and new filter empty, do nothing
+ return;
+ }
- // save current folder open state if no filter currently applied
- if (!mActivePanel->getFilter().isNotDefault())
- {
- mSavedFolderState->setApply(FALSE);
- mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
- }
+ // save current folder open state if no filter currently applied
+ if (!mActivePanel->getFilter().isNotDefault())
+ {
+ mSavedFolderState->setApply(FALSE);
+ mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+ }
- // set new filter string
- setFilterSubString(mFilterSubString);
+ // set new filter string
+ setFilterSubString(mFilterSubString);
LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory();
- if (sidepanel_inventory)
- {
- LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
- if (inbox_panel)
- {
- inbox_panel->onFilterEdit(search_string);
- }
- }
+ if (sidepanel_inventory)
+ {
+ LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
+ if (inbox_panel)
+ {
+ inbox_panel->onFilterEdit(search_string);
+ }
+ }
}
//static
BOOL LLPanelMainInventory::incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward)
{
- LLPanelMainInventory* active_view = NULL;
-
- LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
- for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
- {
- LLPanelMainInventory* iv = dynamic_cast<LLPanelMainInventory*>(*iter);
- if (iv)
- {
- if (gFocusMgr.childHasKeyboardFocus(iv))
- {
- active_view = iv;
- break;
- }
- }
- }
-
- if (!active_view)
- {
- return FALSE;
- }
-
- std::string search_string(find_text);
-
- if (search_string.empty())
- {
- return FALSE;
- }
-
- if (active_view->getPanel() &&
- active_view->getPanel()->getRootFolder()->search(first_item, search_string, backward))
- {
- return TRUE;
- }
-
- return FALSE;
+ LLPanelMainInventory* active_view = NULL;
+
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
+ {
+ LLPanelMainInventory* iv = dynamic_cast<LLPanelMainInventory*>(*iter);
+ if (iv)
+ {
+ if (gFocusMgr.childHasKeyboardFocus(iv))
+ {
+ active_view = iv;
+ break;
+ }
+ }
+ }
+
+ if (!active_view)
+ {
+ return FALSE;
+ }
+
+ std::string search_string(find_text);
+
+ if (search_string.empty())
+ {
+ return FALSE;
+ }
+
+ if (active_view->getPanel() &&
+ active_view->getPanel()->getRootFolder()->search(first_item, search_string, backward))
+ {
+ return TRUE;
+ }
+
+ return FALSE;
}
void LLPanelMainInventory::onFilterSelected()
{
- // Find my index
+ // Find my index
setActivePanel();
- if (!mActivePanel)
- {
- return;
- }
-
- if (getActivePanel() == mWornItemsPanel)
- {
- mActivePanel->openAllFolders();
- }
- updateSearchTypeCombo();
- setFilterSubString(mFilterSubString);
- LLInventoryFilter& filter = getCurrentFilter();
- LLFloaterInventoryFinder *finder = getFinder();
- if (finder)
- {
- finder->changeFilter(&filter);
+ if (!mActivePanel)
+ {
+ return;
+ }
+
+ if (getActivePanel() == mWornItemsPanel)
+ {
+ mActivePanel->openAllFolders();
+ }
+ updateSearchTypeCombo();
+ setFilterSubString(mFilterSubString);
+ LLInventoryFilter& filter = getCurrentFilter();
+ LLFloaterInventoryFinder *finder = getFinder();
+ if (finder)
+ {
+ finder->changeFilter(&filter);
if (mSingleFolderMode)
{
finder->setTitle(getLocalizedRootName());
}
- }
- if (filter.isActive() && !LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted())
- {
+ }
+ if (filter.isActive() && !LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted())
+ {
llassert(false); // this should have been done on startup
- LLInventoryModelBackgroundFetch::instance().start();
- }
- setFilterTextFromFilter();
+ LLInventoryModelBackgroundFetch::instance().start();
+ }
+ setFilterTextFromFilter();
}
-const std::string LLPanelMainInventory::getFilterSubString()
-{
- return mActivePanel->getFilterSubString();
+const std::string LLPanelMainInventory::getFilterSubString()
+{
+ return mActivePanel->getFilterSubString();
}
-void LLPanelMainInventory::setFilterSubString(const std::string& string)
-{
- mActivePanel->setFilterSubString(string);
+void LLPanelMainInventory::setFilterSubString(const std::string& string)
+{
+ mActivePanel->setFilterSubString(string);
}
BOOL LLPanelMainInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
-{
- // Check to see if we are auto scrolling from the last frame
- LLInventoryPanel* panel = (LLInventoryPanel*)this->getActivePanel();
- BOOL needsToScroll = panel->getScrollableContainer()->canAutoScroll(x, y);
- if(mFilterTabs)
- {
- if(needsToScroll)
- {
- mFilterTabs->startDragAndDropDelayTimer();
- }
- }
-
- BOOL handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
-
- return handled;
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
+{
+ // Check to see if we are auto scrolling from the last frame
+ LLInventoryPanel* panel = (LLInventoryPanel*)this->getActivePanel();
+ BOOL needsToScroll = panel->getScrollableContainer()->canAutoScroll(x, y);
+ if(mFilterTabs)
+ {
+ if(needsToScroll)
+ {
+ mFilterTabs->startDragAndDropDelayTimer();
+ }
+ }
+
+ BOOL handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+
+ return handled;
}
// virtual
void LLPanelMainInventory::changed(U32)
{
- updateItemcountText();
+ updateItemcountText();
}
void LLPanelMainInventory::setFocusFilterEditor()
{
- if(mFilterEditor)
- {
- mFilterEditor->setFocus(true);
- }
+ if(mFilterEditor)
+ {
+ mFilterEditor->setFocus(true);
+ }
}
// virtual
void LLPanelMainInventory::draw()
{
- if (mActivePanel && mFilterEditor)
- {
- mFilterEditor->setText(mFilterSubString);
- }
- if (mActivePanel && mResortActivePanel)
- {
- // EXP-756: Force resorting of the list the first time we draw the list:
- // In the case of date sorting, we don't have enough information at initialization time
- // to correctly sort the folders. Later manual resort doesn't do anything as the order value is
- // set correctly. The workaround is to reset the order to alphabetical (or anything) then to the correct order.
- U32 order = mActivePanel->getSortOrder();
- mActivePanel->setSortOrder(LLInventoryFilter::SO_NAME);
- mActivePanel->setSortOrder(order);
- mResortActivePanel = false;
- }
- LLPanel::draw();
- updateItemcountText();
+ if (mActivePanel && mFilterEditor)
+ {
+ mFilterEditor->setText(mFilterSubString);
+ }
+ if (mActivePanel && mResortActivePanel)
+ {
+ // EXP-756: Force resorting of the list the first time we draw the list:
+ // In the case of date sorting, we don't have enough information at initialization time
+ // to correctly sort the folders. Later manual resort doesn't do anything as the order value is
+ // set correctly. The workaround is to reset the order to alphabetical (or anything) then to the correct order.
+ U32 order = mActivePanel->getSortOrder();
+ mActivePanel->setSortOrder(LLInventoryFilter::SO_NAME);
+ mActivePanel->setSortOrder(order);
+ mResortActivePanel = false;
+ }
+ LLPanel::draw();
+ updateItemcountText();
updateCombinationVisibility();
}
void LLPanelMainInventory::updateItemcountText()
{
- if(mItemCount != gInventory.getItemCount())
- {
- mItemCount = gInventory.getItemCount();
- mItemCountString = "";
- LLLocale locale(LLLocale::USER_LOCALE);
- LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount);
- }
-
- if(mCategoryCount != gInventory.getCategoryCount())
- {
- mCategoryCount = gInventory.getCategoryCount();
- mCategoryCountString = "";
- LLLocale locale(LLLocale::USER_LOCALE);
- LLResMgr::getInstance()->getIntegerString(mCategoryCountString, mCategoryCount);
- }
-
- LLStringUtil::format_map_t string_args;
- string_args["[ITEM_COUNT]"] = mItemCountString;
- string_args["[CATEGORY_COUNT]"] = mCategoryCountString;
- string_args["[FILTER]"] = getFilterText();
-
- std::string text = "";
-
- if (LLInventoryModelBackgroundFetch::instance().folderFetchActive())
- {
- text = getString("ItemcountFetching", string_args);
- }
- else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched())
- {
- text = getString("ItemcountCompleted", string_args);
- }
- else
- {
- text = getString("ItemcountUnknown", string_args);
- }
+ if(mItemCount != gInventory.getItemCount())
+ {
+ mItemCount = gInventory.getItemCount();
+ mItemCountString = "";
+ LLLocale locale(LLLocale::USER_LOCALE);
+ LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount);
+ }
+
+ if(mCategoryCount != gInventory.getCategoryCount())
+ {
+ mCategoryCount = gInventory.getCategoryCount();
+ mCategoryCountString = "";
+ LLLocale locale(LLLocale::USER_LOCALE);
+ LLResMgr::getInstance()->getIntegerString(mCategoryCountString, mCategoryCount);
+ }
+
+ LLStringUtil::format_map_t string_args;
+ string_args["[ITEM_COUNT]"] = mItemCountString;
+ string_args["[CATEGORY_COUNT]"] = mCategoryCountString;
+ string_args["[FILTER]"] = getFilterText();
+
+ std::string text = "";
+
+ if (LLInventoryModelBackgroundFetch::instance().folderFetchActive())
+ {
+ text = getString("ItemcountFetching", string_args);
+ }
+ else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched())
+ {
+ text = getString("ItemcountCompleted", string_args);
+ }
+ else
+ {
+ text = getString("ItemcountUnknown", string_args);
+ }
if (mSingleFolderMode)
{
@@ -1024,40 +1024,40 @@ void LLPanelMainInventory::updateItemcountText()
text = getString("ItemcountCompleted", string_args);
}
}
-
+
mCounterCtrl->setValue(text);
mCounterCtrl->setToolTip(text);
}
void LLPanelMainInventory::onFocusReceived()
{
- LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
- if (!sidepanel_inventory)
- {
- LL_WARNS() << "Could not find Inventory Panel in My Inventory floater" << LL_ENDL;
- return;
- }
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ if (!sidepanel_inventory)
+ {
+ LL_WARNS() << "Could not find Inventory Panel in My Inventory floater" << LL_ENDL;
+ return;
+ }
- sidepanel_inventory->clearSelections(false, true);
+ sidepanel_inventory->clearSelections(false, true);
}
-void LLPanelMainInventory::setFilterTextFromFilter()
-{
- mFilterText = getCurrentFilter().getFilterText();
+void LLPanelMainInventory::setFilterTextFromFilter()
+{
+ mFilterText = getCurrentFilter().getFilterText();
}
void LLPanelMainInventory::toggleFindOptions()
{
- LLFloater *floater = getFinder();
- if (!floater)
- {
- LLFloaterInventoryFinder * finder = new LLFloaterInventoryFinder(this);
- mFinderHandle = finder->getHandle();
- finder->openFloater();
+ LLFloater *floater = getFinder();
+ if (!floater)
+ {
+ LLFloaterInventoryFinder * finder = new LLFloaterInventoryFinder(this);
+ mFinderHandle = finder->getHandle();
+ finder->openFloater();
- LLFloater* parent_floater = gFloaterView->getParentFloater(this);
- if (parent_floater)
- parent_floater->addDependentFloater(mFinderHandle);
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+ if (parent_floater)
+ parent_floater->addDependentFloater(mFinderHandle);
if (!LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted())
{
@@ -1069,232 +1069,232 @@ void LLPanelMainInventory::toggleFindOptions()
{
finder->setTitle(getLocalizedRootName());
}
- }
- else
- {
- floater->closeFloater();
- }
+ }
+ else
+ {
+ floater->closeFloater();
+ }
}
void LLPanelMainInventory::setSelectCallback(const LLFolderView::signal_t::slot_type& cb)
{
- getChild<LLInventoryPanel>(ALL_ITEMS)->setSelectCallback(cb);
- getChild<LLInventoryPanel>(RECENT_ITEMS)->setSelectCallback(cb);
+ getChild<LLInventoryPanel>(ALL_ITEMS)->setSelectCallback(cb);
+ getChild<LLInventoryPanel>(RECENT_ITEMS)->setSelectCallback(cb);
}
void LLPanelMainInventory::onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action)
{
- updateListCommands();
- panel->onSelectionChange(items, user_action);
+ updateListCommands();
+ panel->onSelectionChange(items, user_action);
}
///----------------------------------------------------------------------------
/// LLFloaterInventoryFinder
///----------------------------------------------------------------------------
-LLFloaterInventoryFinder* LLPanelMainInventory::getFinder()
-{
- return (LLFloaterInventoryFinder*)mFinderHandle.get();
+LLFloaterInventoryFinder* LLPanelMainInventory::getFinder()
+{
+ return (LLFloaterInventoryFinder*)mFinderHandle.get();
}
-LLFloaterInventoryFinder::LLFloaterInventoryFinder(LLPanelMainInventory* inventory_view) :
- LLFloater(LLSD()),
- mPanelMainInventory(inventory_view),
- mFilter(&inventory_view->getPanel()->getFilter())
+LLFloaterInventoryFinder::LLFloaterInventoryFinder(LLPanelMainInventory* inventory_view) :
+ LLFloater(LLSD()),
+ mPanelMainInventory(inventory_view),
+ mFilter(&inventory_view->getPanel()->getFilter())
{
- buildFromFile("floater_inventory_view_finder.xml");
- updateElementsFromFilter();
+ buildFromFile("floater_inventory_view_finder.xml");
+ updateElementsFromFilter();
}
BOOL LLFloaterInventoryFinder::postBuild()
{
- const LLRect& viewrect = mPanelMainInventory->getRect();
- setRect(LLRect(viewrect.mLeft - getRect().getWidth(), viewrect.mTop, viewrect.mLeft, viewrect.mTop - getRect().getHeight()));
+ const LLRect& viewrect = mPanelMainInventory->getRect();
+ setRect(LLRect(viewrect.mLeft - getRect().getWidth(), viewrect.mTop, viewrect.mLeft, viewrect.mTop - getRect().getHeight()));
- childSetAction("All", selectAllTypes, this);
- childSetAction("None", selectNoTypes, this);
+ childSetAction("All", selectAllTypes, this);
+ childSetAction("None", selectNoTypes, this);
- mSpinSinceHours = getChild<LLSpinCtrl>("spin_hours_ago");
- childSetCommitCallback("spin_hours_ago", onTimeAgo, this);
+ mSpinSinceHours = getChild<LLSpinCtrl>("spin_hours_ago");
+ childSetCommitCallback("spin_hours_ago", onTimeAgo, this);
- mSpinSinceDays = getChild<LLSpinCtrl>("spin_days_ago");
- childSetCommitCallback("spin_days_ago", onTimeAgo, this);
+ mSpinSinceDays = getChild<LLSpinCtrl>("spin_days_ago");
+ childSetCommitCallback("spin_days_ago", onTimeAgo, this);
- mCreatorSelf = getChild<LLCheckBoxCtrl>("check_created_by_me");
- mCreatorOthers = getChild<LLCheckBoxCtrl>("check_created_by_others");
- mCreatorSelf->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorSelfFilterCommit, this));
- mCreatorOthers->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorOtherFilterCommit, this));
+ mCreatorSelf = getChild<LLCheckBoxCtrl>("check_created_by_me");
+ mCreatorOthers = getChild<LLCheckBoxCtrl>("check_created_by_others");
+ mCreatorSelf->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorSelfFilterCommit, this));
+ mCreatorOthers->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorOtherFilterCommit, this));
- childSetAction("Close", onCloseBtn, this);
+ childSetAction("Close", onCloseBtn, this);
- updateElementsFromFilter();
- return TRUE;
+ updateElementsFromFilter();
+ return TRUE;
}
void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data)
{
- LLFloaterInventoryFinder *self = (LLFloaterInventoryFinder *)user_data;
- if (!self) return;
-
- if ( self->mSpinSinceDays->get() || self->mSpinSinceHours->get() )
- {
- self->getChild<LLUICtrl>("check_since_logoff")->setValue(false);
-
- U32 days = (U32)self->mSpinSinceDays->get();
- U32 hours = (U32)self->mSpinSinceHours->get();
- if (hours >= 24)
- {
- // Try to handle both cases of spinner clicking and text input in a sensible fashion as best as possible.
- // There is no way to tell if someone has clicked the spinner to get to 24 or input 24 manually, so in
- // this case add to days. Any value > 24 means they have input the hours manually, so do not add to the
- // current day value.
- if (24 == hours) // Got to 24 via spinner clicking or text input of 24
- {
- days = days + hours / 24;
- }
- else // Text input, so do not add to days
- {
- days = hours / 24;
- }
- hours = (U32)hours % 24;
- self->mSpinSinceHours->setFocus(false);
- self->mSpinSinceDays->setFocus(false);
- self->mSpinSinceDays->set((F32)days);
- self->mSpinSinceHours->set((F32)hours);
- self->mSpinSinceHours->setFocus(true);
- }
- }
+ LLFloaterInventoryFinder *self = (LLFloaterInventoryFinder *)user_data;
+ if (!self) return;
+
+ if ( self->mSpinSinceDays->get() || self->mSpinSinceHours->get() )
+ {
+ self->getChild<LLUICtrl>("check_since_logoff")->setValue(false);
+
+ U32 days = (U32)self->mSpinSinceDays->get();
+ U32 hours = (U32)self->mSpinSinceHours->get();
+ if (hours >= 24)
+ {
+ // Try to handle both cases of spinner clicking and text input in a sensible fashion as best as possible.
+ // There is no way to tell if someone has clicked the spinner to get to 24 or input 24 manually, so in
+ // this case add to days. Any value > 24 means they have input the hours manually, so do not add to the
+ // current day value.
+ if (24 == hours) // Got to 24 via spinner clicking or text input of 24
+ {
+ days = days + hours / 24;
+ }
+ else // Text input, so do not add to days
+ {
+ days = hours / 24;
+ }
+ hours = (U32)hours % 24;
+ self->mSpinSinceHours->setFocus(false);
+ self->mSpinSinceDays->setFocus(false);
+ self->mSpinSinceDays->set((F32)days);
+ self->mSpinSinceHours->set((F32)hours);
+ self->mSpinSinceHours->setFocus(true);
+ }
+ }
}
void LLFloaterInventoryFinder::changeFilter(LLInventoryFilter* filter)
{
- mFilter = filter;
- updateElementsFromFilter();
+ mFilter = filter;
+ updateElementsFromFilter();
}
void LLFloaterInventoryFinder::updateElementsFromFilter()
{
- if (!mFilter)
- return;
-
- // Get data needed for filter display
- U32 filter_types = mFilter->getFilterObjectTypes();
- LLInventoryFilter::EFolderShow show_folders = mFilter->getShowFolderState();
- U32 hours = mFilter->getHoursAgo();
- U32 date_search_direction = mFilter->getDateSearchDirection();
-
- LLInventoryFilter::EFilterCreatorType filter_creator = mFilter->getFilterCreatorType();
- bool show_created_by_me = ((filter_creator == LLInventoryFilter::FILTERCREATOR_ALL) || (filter_creator == LLInventoryFilter::FILTERCREATOR_SELF));
- bool show_created_by_others = ((filter_creator == LLInventoryFilter::FILTERCREATOR_ALL) || (filter_creator == LLInventoryFilter::FILTERCREATOR_OTHERS));
-
- // update the ui elements
- setTitle(mFilter->getName());
-
- getChild<LLUICtrl>("check_animation")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_ANIMATION));
-
- getChild<LLUICtrl>("check_calling_card")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_CALLINGCARD));
- getChild<LLUICtrl>("check_clothing")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE));
- getChild<LLUICtrl>("check_gesture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE));
- getChild<LLUICtrl>("check_landmark")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK));
- getChild<LLUICtrl>("check_material")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_MATERIAL));
- getChild<LLUICtrl>("check_notecard")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD));
- getChild<LLUICtrl>("check_object")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT));
- getChild<LLUICtrl>("check_script")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LSL));
- getChild<LLUICtrl>("check_sound")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND));
- getChild<LLUICtrl>("check_texture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE));
- getChild<LLUICtrl>("check_snapshot")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT));
+ if (!mFilter)
+ return;
+
+ // Get data needed for filter display
+ U32 filter_types = mFilter->getFilterObjectTypes();
+ LLInventoryFilter::EFolderShow show_folders = mFilter->getShowFolderState();
+ U32 hours = mFilter->getHoursAgo();
+ U32 date_search_direction = mFilter->getDateSearchDirection();
+
+ LLInventoryFilter::EFilterCreatorType filter_creator = mFilter->getFilterCreatorType();
+ bool show_created_by_me = ((filter_creator == LLInventoryFilter::FILTERCREATOR_ALL) || (filter_creator == LLInventoryFilter::FILTERCREATOR_SELF));
+ bool show_created_by_others = ((filter_creator == LLInventoryFilter::FILTERCREATOR_ALL) || (filter_creator == LLInventoryFilter::FILTERCREATOR_OTHERS));
+
+ // update the ui elements
+ setTitle(mFilter->getName());
+
+ getChild<LLUICtrl>("check_animation")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_ANIMATION));
+
+ getChild<LLUICtrl>("check_calling_card")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_CALLINGCARD));
+ getChild<LLUICtrl>("check_clothing")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE));
+ getChild<LLUICtrl>("check_gesture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE));
+ getChild<LLUICtrl>("check_landmark")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK));
+ getChild<LLUICtrl>("check_material")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_MATERIAL));
+ getChild<LLUICtrl>("check_notecard")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD));
+ getChild<LLUICtrl>("check_object")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT));
+ getChild<LLUICtrl>("check_script")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LSL));
+ getChild<LLUICtrl>("check_sound")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND));
+ getChild<LLUICtrl>("check_texture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE));
+ getChild<LLUICtrl>("check_snapshot")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT));
getChild<LLUICtrl>("check_settings")->setValue((S32)(filter_types & 0x1 << LLInventoryType::IT_SETTINGS));
- getChild<LLUICtrl>("check_show_empty")->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS);
+ getChild<LLUICtrl>("check_show_empty")->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS);
- getChild<LLUICtrl>("check_created_by_me")->setValue(show_created_by_me);
- getChild<LLUICtrl>("check_created_by_others")->setValue(show_created_by_others);
+ getChild<LLUICtrl>("check_created_by_me")->setValue(show_created_by_me);
+ getChild<LLUICtrl>("check_created_by_others")->setValue(show_created_by_others);
- getChild<LLUICtrl>("check_since_logoff")->setValue(mFilter->isSinceLogoff());
- mSpinSinceHours->set((F32)(hours % 24));
- mSpinSinceDays->set((F32)(hours / 24));
- getChild<LLRadioGroup>("date_search_direction")->setSelectedIndex(date_search_direction);
+ getChild<LLUICtrl>("check_since_logoff")->setValue(mFilter->isSinceLogoff());
+ mSpinSinceHours->set((F32)(hours % 24));
+ mSpinSinceDays->set((F32)(hours / 24));
+ getChild<LLRadioGroup>("date_search_direction")->setSelectedIndex(date_search_direction);
}
void LLFloaterInventoryFinder::draw()
{
- U64 filter = 0xffffffffffffffffULL;
- BOOL filtered_by_all_types = TRUE;
-
- if (!getChild<LLUICtrl>("check_animation")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_ANIMATION);
- filtered_by_all_types = FALSE;
- }
-
-
- if (!getChild<LLUICtrl>("check_calling_card")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_clothing")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_WEARABLE);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_gesture")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_GESTURE);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_landmark")->getValue())
-
-
- {
- filter &= ~(0x1 << LLInventoryType::IT_LANDMARK);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_material")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_MATERIAL);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_notecard")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_NOTECARD);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_object")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_OBJECT);
- filter &= ~(0x1 << LLInventoryType::IT_ATTACHMENT);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_script")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_LSL);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_sound")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_SOUND);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_texture")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_TEXTURE);
- filtered_by_all_types = FALSE;
- }
-
- if (!getChild<LLUICtrl>("check_snapshot")->getValue())
- {
- filter &= ~(0x1 << LLInventoryType::IT_SNAPSHOT);
- filtered_by_all_types = FALSE;
- }
+ U64 filter = 0xffffffffffffffffULL;
+ BOOL filtered_by_all_types = TRUE;
+
+ if (!getChild<LLUICtrl>("check_animation")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_ANIMATION);
+ filtered_by_all_types = FALSE;
+ }
+
+
+ if (!getChild<LLUICtrl>("check_calling_card")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_clothing")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_WEARABLE);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_gesture")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_GESTURE);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_landmark")->getValue())
+
+
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_LANDMARK);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_material")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_MATERIAL);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_notecard")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_NOTECARD);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_object")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_OBJECT);
+ filter &= ~(0x1 << LLInventoryType::IT_ATTACHMENT);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_script")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_LSL);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_sound")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_SOUND);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_texture")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_TEXTURE);
+ filtered_by_all_types = FALSE;
+ }
+
+ if (!getChild<LLUICtrl>("check_snapshot")->getValue())
+ {
+ filter &= ~(0x1 << LLInventoryType::IT_SNAPSHOT);
+ filtered_by_all_types = FALSE;
+ }
if (!getChild<LLUICtrl>("check_settings")->getValue())
{
@@ -1302,11 +1302,11 @@ void LLFloaterInventoryFinder::draw()
filtered_by_all_types = FALSE;
}
- if (!filtered_by_all_types || (mPanelMainInventory->getPanel()->getFilter().getFilterTypes() & LLInventoryFilter::FILTERTYPE_DATE))
- {
- // don't include folders in filter, unless I've selected everything or filtering by date
- filter &= ~(0x1 << LLInventoryType::IT_CATEGORY);
- }
+ if (!filtered_by_all_types || (mPanelMainInventory->getPanel()->getFilter().getFilterTypes() & LLInventoryFilter::FILTERTYPE_DATE))
+ {
+ // don't include folders in filter, unless I've selected everything or filtering by date
+ filter &= ~(0x1 << LLInventoryType::IT_CATEGORY);
+ }
bool is_sf_mode = mPanelMainInventory->isSingleFolderMode();
@@ -1330,28 +1330,28 @@ void LLFloaterInventoryFinder::draw()
mPanelMainInventory->getPanel()->setFilterTypes(filter);
}
- if (getCheckSinceLogoff())
- {
- mSpinSinceDays->set(0);
- mSpinSinceHours->set(0);
- }
- U32 days = (U32)mSpinSinceDays->get();
- U32 hours = (U32)mSpinSinceHours->get();
- if (hours >= 24)
- {
- days = hours / 24;
- hours = (U32)hours % 24;
- // A UI element that has focus will not display a new value set to it
- mSpinSinceHours->setFocus(false);
- mSpinSinceDays->setFocus(false);
- mSpinSinceDays->set((F32)days);
- mSpinSinceHours->set((F32)hours);
- mSpinSinceHours->setFocus(true);
- }
- hours += days * 24;
-
-
- mPanelMainInventory->setFilterTextFromFilter();
+ if (getCheckSinceLogoff())
+ {
+ mSpinSinceDays->set(0);
+ mSpinSinceHours->set(0);
+ }
+ U32 days = (U32)mSpinSinceDays->get();
+ U32 hours = (U32)mSpinSinceHours->get();
+ if (hours >= 24)
+ {
+ days = hours / 24;
+ hours = (U32)hours % 24;
+ // A UI element that has focus will not display a new value set to it
+ mSpinSinceHours->setFocus(false);
+ mSpinSinceDays->setFocus(false);
+ mSpinSinceDays->set((F32)days);
+ mSpinSinceHours->set((F32)hours);
+ mSpinSinceHours->setFocus(true);
+ }
+ hours += days * 24;
+
+
+ mPanelMainInventory->setFilterTextFromFilter();
if(is_sf_mode && mPanelMainInventory->isGalleryViewMode())
{
mPanelMainInventory->mCombinationGalleryPanel->getFilter().setHoursAgo(hours);
@@ -1371,109 +1371,109 @@ void LLFloaterInventoryFinder::draw()
mPanelMainInventory->getPanel()->setDateSearchDirection(getDateSearchDirection());
}
- LLPanel::draw();
+ LLPanel::draw();
}
void LLFloaterInventoryFinder::onCreatorSelfFilterCommit()
{
- bool show_creator_self = mCreatorSelf->getValue();
- bool show_creator_other = mCreatorOthers->getValue();
+ bool show_creator_self = mCreatorSelf->getValue();
+ bool show_creator_other = mCreatorOthers->getValue();
- if(show_creator_self && show_creator_other)
- {
+ if(show_creator_self && show_creator_other)
+ {
mPanelMainInventory->getCurrentFilter().setFilterCreator(LLInventoryFilter::FILTERCREATOR_ALL);
- }
- else if(show_creator_self)
- {
+ }
+ else if(show_creator_self)
+ {
mPanelMainInventory->getCurrentFilter().setFilterCreator(LLInventoryFilter::FILTERCREATOR_SELF);
- }
- else if(!show_creator_self || !show_creator_other)
- {
+ }
+ else if(!show_creator_self || !show_creator_other)
+ {
mPanelMainInventory->getCurrentFilter().setFilterCreator(LLInventoryFilter::FILTERCREATOR_OTHERS);
- mCreatorOthers->set(TRUE);
- }
+ mCreatorOthers->set(TRUE);
+ }
}
void LLFloaterInventoryFinder::onCreatorOtherFilterCommit()
{
- bool show_creator_self = mCreatorSelf->getValue();
- bool show_creator_other = mCreatorOthers->getValue();
+ bool show_creator_self = mCreatorSelf->getValue();
+ bool show_creator_other = mCreatorOthers->getValue();
- if(show_creator_self && show_creator_other)
- {
+ if(show_creator_self && show_creator_other)
+ {
mPanelMainInventory->getCurrentFilter().setFilterCreator(LLInventoryFilter::FILTERCREATOR_ALL);
- }
- else if(show_creator_other)
- {
+ }
+ else if(show_creator_other)
+ {
mPanelMainInventory->getCurrentFilter().setFilterCreator(LLInventoryFilter::FILTERCREATOR_OTHERS);
- }
- else if(!show_creator_other || !show_creator_self)
- {
+ }
+ else if(!show_creator_other || !show_creator_self)
+ {
mPanelMainInventory->getCurrentFilter().setFilterCreator(LLInventoryFilter::FILTERCREATOR_SELF);
- mCreatorSelf->set(TRUE);
- }
+ mCreatorSelf->set(TRUE);
+ }
}
BOOL LLFloaterInventoryFinder::getCheckShowEmpty()
{
- return getChild<LLUICtrl>("check_show_empty")->getValue();
+ return getChild<LLUICtrl>("check_show_empty")->getValue();
}
BOOL LLFloaterInventoryFinder::getCheckSinceLogoff()
{
- return getChild<LLUICtrl>("check_since_logoff")->getValue();
+ return getChild<LLUICtrl>("check_since_logoff")->getValue();
}
U32 LLFloaterInventoryFinder::getDateSearchDirection()
{
- return getChild<LLRadioGroup>("date_search_direction")->getSelectedIndex();
+ return getChild<LLRadioGroup>("date_search_direction")->getSelectedIndex();
}
void LLFloaterInventoryFinder::onCloseBtn(void* user_data)
{
- LLFloaterInventoryFinder* finderp = (LLFloaterInventoryFinder*)user_data;
- finderp->closeFloater();
+ LLFloaterInventoryFinder* finderp = (LLFloaterInventoryFinder*)user_data;
+ finderp->closeFloater();
}
// static
void LLFloaterInventoryFinder::selectAllTypes(void* user_data)
{
- LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data;
- if(!self) return;
-
- self->getChild<LLUICtrl>("check_animation")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_calling_card")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_clothing")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_gesture")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_landmark")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_material")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_notecard")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_object")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_script")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_sound")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_texture")->setValue(TRUE);
- self->getChild<LLUICtrl>("check_snapshot")->setValue(TRUE);
+ LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data;
+ if(!self) return;
+
+ self->getChild<LLUICtrl>("check_animation")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_calling_card")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_clothing")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_gesture")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_landmark")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_material")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_notecard")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_object")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_script")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_sound")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_texture")->setValue(TRUE);
+ self->getChild<LLUICtrl>("check_snapshot")->setValue(TRUE);
self->getChild<LLUICtrl>("check_settings")->setValue(TRUE);
}
//static
void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
{
- LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data;
- if(!self) return;
-
- self->getChild<LLUICtrl>("check_animation")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_calling_card")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_clothing")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_gesture")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_landmark")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_material")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_notecard")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_object")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_script")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_sound")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_texture")->setValue(FALSE);
- self->getChild<LLUICtrl>("check_snapshot")->setValue(FALSE);
+ LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data;
+ if(!self) return;
+
+ self->getChild<LLUICtrl>("check_animation")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_calling_card")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_clothing")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_gesture")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_landmark")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_material")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_notecard")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_object")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_script")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_sound")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_texture")->setValue(FALSE);
+ self->getChild<LLUICtrl>("check_snapshot")->setValue(FALSE);
self->getChild<LLUICtrl>("check_settings")->setValue(FALSE);
}
@@ -1482,28 +1482,28 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
void LLPanelMainInventory::initListCommandsHandlers()
{
- childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
+ childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
childSetAction("view_mode_btn", boost::bind(&LLPanelMainInventory::onViewModeClick, this));
childSetAction("up_btn", boost::bind(&LLPanelMainInventory::onUpFolderClicked, this));
childSetAction("back_btn", boost::bind(&LLPanelMainInventory::onBackFolderClicked, this));
childSetAction("forward_btn", boost::bind(&LLPanelMainInventory::onForwardFolderClicked, this));
- mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2));
- mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2));
- mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2));
+ mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2));
+ mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2));
+ mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2));
mEnableCallbackRegistrar.add("Inventory.GearDefault.Visible", boost::bind(&LLPanelMainInventory::isActionVisible, this, _2));
- mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- mGearMenuButton->setMenu(mMenuGearDefault, LLMenuButton::MP_BOTTOM_LEFT, true);
+ mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mGearMenuButton->setMenu(mMenuGearDefault, LLMenuButton::MP_BOTTOM_LEFT, true);
mMenuViewDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_view_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mViewMenuButton->setMenu(mMenuViewDefault, LLMenuButton::MP_BOTTOM_LEFT, true);
- LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- mMenuAddHandle = menu->getHandle();
+ LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mMenuAddHandle = menu->getHandle();
- mMenuVisibility = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_search_visibility.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mMenuVisibility = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_search_visibility.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mVisibilityMenuButton->setMenu(mMenuVisibility, LLMenuButton::MP_BOTTOM_LEFT, true);
- // Update the trash button when selected item(s) get worn or taken off.
- LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLPanelMainInventory::updateListCommands, this));
+ // Update the trash button when selected item(s) get worn or taken off.
+ LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLPanelMainInventory::updateListCommands, this));
}
void LLPanelMainInventory::updateListCommands()
@@ -1515,15 +1515,15 @@ void LLPanelMainInventory::onAddButtonClick()
// Gray out the "New Folder" option when the Recent tab is active as new folders will not be displayed
// unless "Always show folders" is checked in the filter options.
- LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
- if (menu)
- {
+ LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
+ if (menu)
+ {
disableAddIfNeeded();
- setUploadCostIfNeeded();
+ setUploadCostIfNeeded();
- showActionMenu(menu,"add_btn");
- }
+ showActionMenu(menu,"add_btn");
+ }
}
void LLPanelMainInventory::setActivePanel()
@@ -1737,22 +1737,22 @@ LLUUID LLPanelMainInventory::getSingleFolderViewRoot()
void LLPanelMainInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)
{
- if (menu)
- {
- menu->buildDrawLabels();
- menu->updateParent(LLMenuGL::sMenuContainer);
- LLView* spawning_view = getChild<LLView> (spawning_view_name);
- S32 menu_x, menu_y;
- //show menu in co-ordinates of panel
- spawning_view->localPointToOtherView(0, 0, &menu_x, &menu_y, this);
- LLMenuGL::showPopup(this, menu, menu_x, menu_y);
- }
+ if (menu)
+ {
+ menu->buildDrawLabels();
+ menu->updateParent(LLMenuGL::sMenuContainer);
+ LLView* spawning_view = getChild<LLView> (spawning_view_name);
+ S32 menu_x, menu_y;
+ //show menu in co-ordinates of panel
+ spawning_view->localPointToOtherView(0, 0, &menu_x, &menu_y, this);
+ LLMenuGL::showPopup(this, menu, menu_x, menu_y);
+ }
}
void LLPanelMainInventory::onClipboardAction(const LLSD& userdata)
{
- std::string command_name = userdata.asString();
- getActivePanel()->doToSelected(command_name);
+ std::string command_name = userdata.asString();
+ getActivePanel()->doToSelected(command_name);
}
void LLPanelMainInventory::saveTexture(const LLSD& userdata)
@@ -1773,89 +1773,89 @@ void LLPanelMainInventory::saveTexture(const LLSD& userdata)
item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
}
- LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item_id), TAKE_FOCUS_YES);
- if (preview_texture)
- {
- preview_texture->openToSave();
- }
+ LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item_id), TAKE_FOCUS_YES);
+ if (preview_texture)
+ {
+ preview_texture->openToSave();
+ }
}
void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
{
- if (!isActionEnabled(userdata))
- return;
-
- const std::string command_name = userdata.asString();
-
- if (command_name == "new_window")
- {
- newWindow();
- }
- if (command_name == "sort_by_name")
- {
- const LLSD arg = "name";
- setSortBy(arg);
- }
- if (command_name == "sort_by_recent")
- {
- const LLSD arg = "date";
- setSortBy(arg);
- }
- if (command_name == "sort_folders_by_name")
- {
- const LLSD arg = "foldersalwaysbyname";
- setSortBy(arg);
- }
- if (command_name == "sort_system_folders_to_top")
- {
- const LLSD arg = "systemfolderstotop";
- setSortBy(arg);
- }
- if (command_name == "show_filters")
- {
- toggleFindOptions();
- }
- if (command_name == "reset_filters")
- {
- resetFilters();
- }
- if (command_name == "close_folders")
- {
- closeAllFolders();
- }
- if (command_name == "empty_trash")
- {
- const std::string notification = "ConfirmEmptyTrash";
- gInventory.emptyFolderType(notification, LLFolderType::FT_TRASH);
- }
- if (command_name == "empty_lostnfound")
- {
- const std::string notification = "ConfirmEmptyLostAndFound";
- gInventory.emptyFolderType(notification, LLFolderType::FT_LOST_AND_FOUND);
- }
- if (command_name == "save_texture")
- {
- saveTexture(userdata);
- }
- // This doesn't currently work, since the viewer can't change an assetID an item.
- if (command_name == "regenerate_link")
- {
- LLInventoryPanel *active_panel = getActivePanel();
- LLFolderViewItem* current_item = active_panel->getRootFolder()->getCurSelectedItem();
- if (!current_item)
- {
- return;
- }
- const LLUUID item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- if (item)
- {
- item->regenerateLink();
- }
- active_panel->setSelection(item_id, TAKE_FOCUS_NO);
- }
- if (command_name == "find_original")
- {
+ if (!isActionEnabled(userdata))
+ return;
+
+ const std::string command_name = userdata.asString();
+
+ if (command_name == "new_window")
+ {
+ newWindow();
+ }
+ if (command_name == "sort_by_name")
+ {
+ const LLSD arg = "name";
+ setSortBy(arg);
+ }
+ if (command_name == "sort_by_recent")
+ {
+ const LLSD arg = "date";
+ setSortBy(arg);
+ }
+ if (command_name == "sort_folders_by_name")
+ {
+ const LLSD arg = "foldersalwaysbyname";
+ setSortBy(arg);
+ }
+ if (command_name == "sort_system_folders_to_top")
+ {
+ const LLSD arg = "systemfolderstotop";
+ setSortBy(arg);
+ }
+ if (command_name == "show_filters")
+ {
+ toggleFindOptions();
+ }
+ if (command_name == "reset_filters")
+ {
+ resetFilters();
+ }
+ if (command_name == "close_folders")
+ {
+ closeAllFolders();
+ }
+ if (command_name == "empty_trash")
+ {
+ const std::string notification = "ConfirmEmptyTrash";
+ gInventory.emptyFolderType(notification, LLFolderType::FT_TRASH);
+ }
+ if (command_name == "empty_lostnfound")
+ {
+ const std::string notification = "ConfirmEmptyLostAndFound";
+ gInventory.emptyFolderType(notification, LLFolderType::FT_LOST_AND_FOUND);
+ }
+ if (command_name == "save_texture")
+ {
+ saveTexture(userdata);
+ }
+ // This doesn't currently work, since the viewer can't change an assetID an item.
+ if (command_name == "regenerate_link")
+ {
+ LLInventoryPanel *active_panel = getActivePanel();
+ LLFolderViewItem* current_item = active_panel->getRootFolder()->getCurSelectedItem();
+ if (!current_item)
+ {
+ return;
+ }
+ const LLUUID item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ if (item)
+ {
+ item->regenerateLink();
+ }
+ active_panel->setSelection(item_id, TAKE_FOCUS_NO);
+ }
+ if (command_name == "find_original")
+ {
if(mSingleFolderMode && isGalleryViewMode())
{
LLInventoryObject *obj = gInventory.getObject(mCombinationGalleryPanel->getFirstSelectedItemID());
@@ -1866,17 +1866,17 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
}
else
{
- LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
- if (!current_item)
- {
- return;
- }
- static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->performAction(getActivePanel()->getModel(), "goto");
+ LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
+ if (!current_item)
+ {
+ return;
+ }
+ static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->performAction(getActivePanel()->getModel(), "goto");
}
- }
+ }
- if (command_name == "find_links")
- {
+ if (command_name == "find_links")
+ {
if(mSingleFolderMode && isGalleryViewMode())
{
LLFloaterSidePanelContainer* inventory_container = newWindow();
@@ -1908,10 +1908,10 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
const std::string &item_name = current_item->getViewModelItem()->getName();
findLinks(item_id, item_name);
}
- }
+ }
- if (command_name == "replace_links")
- {
+ if (command_name == "replace_links")
+ {
LLSD params;
if(mSingleFolderMode && isGalleryViewMode())
{
@@ -1919,23 +1919,23 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
}
else
{
- LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
- if (current_item)
- {
- LLInvFVBridge* bridge = (LLInvFVBridge*)current_item->getViewModelItem();
+ LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
+ if (current_item)
+ {
+ LLInvFVBridge* bridge = (LLInvFVBridge*)current_item->getViewModelItem();
- if (bridge)
- {
- LLInventoryObject* obj = bridge->getInventoryObject();
- if (obj && obj->getType() != LLAssetType::AT_CATEGORY && obj->getActualType() != LLAssetType::AT_LINK_FOLDER)
- {
- params = LLSD(obj->getUUID());
- }
- }
- }
+ if (bridge)
+ {
+ LLInventoryObject* obj = bridge->getInventoryObject();
+ if (obj && obj->getType() != LLAssetType::AT_CATEGORY && obj->getActualType() != LLAssetType::AT_LINK_FOLDER)
+ {
+ params = LLSD(obj->getUUID());
+ }
+ }
}
- LLFloaterReg::showInstance("linkreplace", params);
- }
+ }
+ LLFloaterReg::showInstance("linkreplace", params);
+ }
if (command_name == "close_inv_windows")
{
@@ -1956,20 +1956,20 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
getCurrentFilter().toggleSearchVisibilityOutfits();
}
- if (command_name == "toggle_search_trash")
- {
+ if (command_name == "toggle_search_trash")
+ {
getCurrentFilter().toggleSearchVisibilityTrash();
- }
+ }
- if (command_name == "toggle_search_library")
- {
+ if (command_name == "toggle_search_library")
+ {
getCurrentFilter().toggleSearchVisibilityLibrary();
- }
+ }
- if (command_name == "include_links")
- {
+ if (command_name == "include_links")
+ {
getCurrentFilter().toggleSearchVisibilityLinks();
- }
+ }
if (command_name == "share")
{
@@ -2003,15 +2003,15 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
void LLPanelMainInventory::onVisibilityChange( BOOL new_visibility )
{
- if(!new_visibility)
- {
- LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
- if (menu)
- {
- menu->setVisible(FALSE);
- }
- getActivePanel()->getRootFolder()->finishRenamingItem();
- }
+ if(!new_visibility)
+ {
+ LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
+ if (menu)
+ {
+ menu->setVisible(FALSE);
+ }
+ getActivePanel()->getRootFolder()->finishRenamingItem();
+ }
}
bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata)
@@ -2029,124 +2029,124 @@ bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata)
inv_item = dynamic_cast<LLViewerInventoryItem*>(static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getInventoryObject());
}
}
- if(inv_item)
- {
- bool can_save = inv_item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED);
+ if(inv_item)
+ {
+ bool can_save = inv_item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED);
LLInventoryType::EType curr_type = inv_item->getInventoryType();
- return can_save && (curr_type == LLInventoryType::IT_TEXTURE || curr_type == LLInventoryType::IT_SNAPSHOT);
- }
+ return can_save && (curr_type == LLInventoryType::IT_TEXTURE || curr_type == LLInventoryType::IT_SNAPSHOT);
+ }
- return false;
+ return false;
}
BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
{
- const std::string command_name = userdata.asString();
- if (command_name == "not_empty")
- {
- BOOL status = FALSE;
- LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
- if (current_item)
- {
- const LLUUID& item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
- LLInventoryModel::cat_array_t* cat_array;
- LLInventoryModel::item_array_t* item_array;
- gInventory.getDirectDescendentsOf(item_id, cat_array, item_array);
- status = (0 == cat_array->size() && 0 == item_array->size());
- }
- return status;
- }
- if (command_name == "delete")
- {
- return getActivePanel()->isSelectionRemovable();
- }
- if (command_name == "save_texture")
- {
- return isSaveTextureEnabled(userdata);
- }
- if (command_name == "find_original")
- {
+ const std::string command_name = userdata.asString();
+ if (command_name == "not_empty")
+ {
+ BOOL status = FALSE;
+ LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
+ if (current_item)
+ {
+ const LLUUID& item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
+ LLInventoryModel::cat_array_t* cat_array;
+ LLInventoryModel::item_array_t* item_array;
+ gInventory.getDirectDescendentsOf(item_id, cat_array, item_array);
+ status = (0 == cat_array->size() && 0 == item_array->size());
+ }
+ return status;
+ }
+ if (command_name == "delete")
+ {
+ return getActivePanel()->isSelectionRemovable();
+ }
+ if (command_name == "save_texture")
+ {
+ return isSaveTextureEnabled(userdata);
+ }
+ if (command_name == "find_original")
+ {
LLUUID item_id;
if(mSingleFolderMode && isGalleryViewMode())
{
item_id = mCombinationGalleryPanel->getFirstSelectedItemID();
}
else{
- LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
- if (!current_item) return FALSE;
+ LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
+ if (!current_item) return FALSE;
item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
}
- const LLViewerInventoryItem *item = gInventory.getItem(item_id);
- if (item && item->getIsLinkType() && !item->getIsBrokenLink())
- {
- return TRUE;
- }
- return FALSE;
- }
+ const LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ if (item && item->getIsLinkType() && !item->getIsBrokenLink())
+ {
+ return TRUE;
+ }
+ return FALSE;
+ }
- if (command_name == "find_links")
- {
+ if (command_name == "find_links")
+ {
LLUUID item_id;
if(mSingleFolderMode && isGalleryViewMode())
{
item_id = mCombinationGalleryPanel->getFirstSelectedItemID();
}
else{
- LLFolderView* root = getActivePanel()->getRootFolder();
- std::set<LLFolderViewItem*> selection_set = root->getSelectionList();
- if (selection_set.size() != 1) return FALSE;
- LLFolderViewItem* current_item = root->getCurSelectedItem();
- if (!current_item) return FALSE;
- item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
- }
- const LLInventoryObject *obj = gInventory.getObject(item_id);
- if (obj && !obj->getIsLinkType() && LLAssetType::lookupCanLink(obj->getType()))
- {
- return TRUE;
- }
- return FALSE;
- }
- // This doesn't currently work, since the viewer can't change an assetID an item.
- if (command_name == "regenerate_link")
- {
- LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
- if (!current_item) return FALSE;
- const LLUUID& item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
- const LLViewerInventoryItem *item = gInventory.getItem(item_id);
- if (item && item->getIsBrokenLink())
- {
- return TRUE;
- }
- return FALSE;
- }
-
- if (command_name == "share")
- {
+ LLFolderView* root = getActivePanel()->getRootFolder();
+ std::set<LLFolderViewItem*> selection_set = root->getSelectionList();
+ if (selection_set.size() != 1) return FALSE;
+ LLFolderViewItem* current_item = root->getCurSelectedItem();
+ if (!current_item) return FALSE;
+ item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
+ }
+ const LLInventoryObject *obj = gInventory.getObject(item_id);
+ if (obj && !obj->getIsLinkType() && LLAssetType::lookupCanLink(obj->getType()))
+ {
+ return TRUE;
+ }
+ return FALSE;
+ }
+ // This doesn't currently work, since the viewer can't change an assetID an item.
+ if (command_name == "regenerate_link")
+ {
+ LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
+ if (!current_item) return FALSE;
+ const LLUUID& item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
+ const LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ if (item && item->getIsBrokenLink())
+ {
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ if (command_name == "share")
+ {
if(mSingleFolderMode && isGalleryViewMode())
{
return can_share_item(mCombinationGalleryPanel->getFirstSelectedItemID());
}
else{
- LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
- if (!current_item) return FALSE;
- LLSidepanelInventory* parent = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
- return parent ? parent->canShare() : FALSE;
- }
- }
- if (command_name == "empty_trash")
- {
- const LLUUID &trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(trash_id);
- return children != LLInventoryModel::CHILDREN_NO && gInventory.isCategoryComplete(trash_id);
- }
- if (command_name == "empty_lostnfound")
- {
- const LLUUID &trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(trash_id);
- return children != LLInventoryModel::CHILDREN_NO && gInventory.isCategoryComplete(trash_id);
- }
-
- return TRUE;
+ LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
+ if (!current_item) return FALSE;
+ LLSidepanelInventory* parent = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ return parent ? parent->canShare() : FALSE;
+ }
+ }
+ if (command_name == "empty_trash")
+ {
+ const LLUUID &trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(trash_id);
+ return children != LLInventoryModel::CHILDREN_NO && gInventory.isCategoryComplete(trash_id);
+ }
+ if (command_name == "empty_lostnfound")
+ {
+ const LLUUID &trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(trash_id);
+ return children != LLInventoryModel::CHILDREN_NO && gInventory.isCategoryComplete(trash_id);
+ }
+
+ return TRUE;
}
bool LLPanelMainInventory::isActionVisible(const LLSD& userdata)
@@ -2166,47 +2166,47 @@ bool LLPanelMainInventory::isActionVisible(const LLSD& userdata)
BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
{
- U32 sort_order_mask = (mSingleFolderMode && isGalleryViewMode()) ? mCombinationGalleryPanel->getSortOrder() : getActivePanel()->getSortOrder();
- const std::string command_name = userdata.asString();
- if (command_name == "sort_by_name")
- {
- return ~sort_order_mask & LLInventoryFilter::SO_DATE;
- }
+ U32 sort_order_mask = (mSingleFolderMode && isGalleryViewMode()) ? mCombinationGalleryPanel->getSortOrder() : getActivePanel()->getSortOrder();
+ const std::string command_name = userdata.asString();
+ if (command_name == "sort_by_name")
+ {
+ return ~sort_order_mask & LLInventoryFilter::SO_DATE;
+ }
- if (command_name == "sort_by_recent")
- {
- return sort_order_mask & LLInventoryFilter::SO_DATE;
- }
+ if (command_name == "sort_by_recent")
+ {
+ return sort_order_mask & LLInventoryFilter::SO_DATE;
+ }
- if (command_name == "sort_folders_by_name")
- {
- return sort_order_mask & LLInventoryFilter::SO_FOLDERS_BY_NAME;
- }
+ if (command_name == "sort_folders_by_name")
+ {
+ return sort_order_mask & LLInventoryFilter::SO_FOLDERS_BY_NAME;
+ }
- if (command_name == "sort_system_folders_to_top")
- {
- return sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
- }
+ if (command_name == "sort_system_folders_to_top")
+ {
+ return sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
+ }
if (command_name == "toggle_search_outfits")
{
return (getCurrentFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_OUTFITS) != 0;
}
- if (command_name == "toggle_search_trash")
- {
- return (getCurrentFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_TRASH) != 0;
- }
+ if (command_name == "toggle_search_trash")
+ {
+ return (getCurrentFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_TRASH) != 0;
+ }
- if (command_name == "toggle_search_library")
- {
- return (getCurrentFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_LIBRARY) != 0;
- }
+ if (command_name == "toggle_search_library")
+ {
+ return (getCurrentFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_LIBRARY) != 0;
+ }
- if (command_name == "include_links")
- {
+ if (command_name == "include_links")
+ {
return (getCurrentFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_LINKS) != 0;
- }
+ }
if (command_name == "list_view")
{
@@ -2221,22 +2221,22 @@ BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
return isCombinationViewMode();
}
- return FALSE;
+ return FALSE;
}
void LLPanelMainInventory::setUploadCostIfNeeded()
{
- LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
- if(mNeedUploadCost && menu)
- {
- const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
- const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost());
- const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost());
+ LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
+ if(mNeedUploadCost && menu)
+ {
+ const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
+ const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost());
+ const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost());
- menu->getChild<LLView>("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str);
- menu->getChild<LLView>("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str);
- menu->getChild<LLView>("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str);
- }
+ menu->getChild<LLView>("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str);
+ menu->getChild<LLView>("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str);
+ menu->getChild<LLView>("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str);
+ }
}
bool is_add_allowed(LLUUID folder_id)
@@ -2416,7 +2416,7 @@ void LLPanelMainInventory::updateCombinationVisibility()
{
mCombinationGalleryPanel->handleModifiedFilter();
}
-
+
getActivePanel()->getRootFolder();
if (mReshapeInvLayout
@@ -2540,7 +2540,7 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode)
sort_order = mCombinationInventoryPanel->getSortOrder();
break;
}
-
+
LLUUID cur_root = getCurrentSFVRoot();
mViewMode = mode;
diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h
index fbfca43f64..33205fc062 100644
--- a/indra/newview/llpanelmaininventory.h
+++ b/indra/newview/llpanelmaininventory.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelmaininventory.h
* @brief llpanelmaininventory.h
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -60,12 +60,12 @@ class LLFloaterSidePanelContainer;
class LLPanelMainInventory : public LLPanel, LLInventoryObserver
{
public:
- friend class LLFloaterInventoryFinder;
+ friend class LLFloaterInventoryFinder;
- LLPanelMainInventory(const LLPanel::Params& p = getDefaultParams());
- ~LLPanelMainInventory();
+ LLPanelMainInventory(const LLPanel::Params& p = getDefaultParams());
+ ~LLPanelMainInventory();
- BOOL postBuild();
+ BOOL postBuild();
enum EViewModeType
{
@@ -74,39 +74,39 @@ public:
MODE_COMBINATION
};
- virtual BOOL handleKeyHere(KEY key, MASK mask);
-
- // Inherited functionality
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
- /*virtual*/ void changed(U32);
- /*virtual*/ void draw();
- /*virtual*/ void onVisibilityChange ( BOOL new_visibility );
-
- LLInventoryPanel* getPanel() { return mActivePanel; }
- LLInventoryPanel* getActivePanel() { return mActivePanel; }
- LLInventoryPanel* getAllItemsPanel();
- void selectAllItemsPanel();
- const LLInventoryPanel* getActivePanel() const { return mActivePanel; }
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
+
+ // Inherited functionality
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+ /*virtual*/ void changed(U32);
+ /*virtual*/ void draw();
+ /*virtual*/ void onVisibilityChange ( BOOL new_visibility );
+
+ LLInventoryPanel* getPanel() { return mActivePanel; }
+ LLInventoryPanel* getActivePanel() { return mActivePanel; }
+ LLInventoryPanel* getAllItemsPanel();
+ void selectAllItemsPanel();
+ const LLInventoryPanel* getActivePanel() const { return mActivePanel; }
void setActivePanel();
- bool isRecentItemsPanelSelected();
+ bool isRecentItemsPanelSelected();
+
+ const std::string& getFilterText() const { return mFilterText; }
- const std::string& getFilterText() const { return mFilterText; }
-
- void setSelectCallback(const LLFolderView::signal_t::slot_type& cb);
+ void setSelectCallback(const LLFolderView::signal_t::slot_type& cb);
- void onFilterEdit(const std::string& search_string );
+ void onFilterEdit(const std::string& search_string );
- void setFocusFilterEditor();
+ void setFocusFilterEditor();
- static LLFloaterSidePanelContainer* newWindow();
+ static LLFloaterSidePanelContainer* newWindow();
static void newFolderWindow(LLUUID folder_id = LLUUID(), LLUUID item_to_select = LLUUID());
- void toggleFindOptions();
+ void toggleFindOptions();
void resetFilters();
void resetAllItemsFilters();
@@ -138,62 +138,62 @@ public:
LLInventoryFilter& getCurrentFilter();
protected:
- //
- // Misc functions
- //
- void setFilterTextFromFilter();
- void startSearch();
-
- void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action);
-
- static BOOL filtersVisible(void* user_data);
- void onClearSearch();
- static void onFoldersByName(void *user_data);
- static BOOL checkFoldersByName(void *user_data);
-
- static BOOL incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward);
- void onFilterSelected();
-
- const std::string getFilterSubString();
- void setFilterSubString(const std::string& string);
-
- // menu callbacks
- void doToSelected(const LLSD& userdata);
- void closeAllFolders();
- void doCreate(const LLSD& userdata);
- void setSortBy(const LLSD& userdata);
- void saveTexture(const LLSD& userdata);
- bool isSaveTextureEnabled(const LLSD& userdata);
- void updateItemcountText();
+ //
+ // Misc functions
+ //
+ void setFilterTextFromFilter();
+ void startSearch();
+
+ void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action);
+
+ static BOOL filtersVisible(void* user_data);
+ void onClearSearch();
+ static void onFoldersByName(void *user_data);
+ static BOOL checkFoldersByName(void *user_data);
+
+ static BOOL incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward);
+ void onFilterSelected();
+
+ const std::string getFilterSubString();
+ void setFilterSubString(const std::string& string);
+
+ // menu callbacks
+ void doToSelected(const LLSD& userdata);
+ void closeAllFolders();
+ void doCreate(const LLSD& userdata);
+ void setSortBy(const LLSD& userdata);
+ void saveTexture(const LLSD& userdata);
+ bool isSaveTextureEnabled(const LLSD& userdata);
+ void updateItemcountText();
void updatePanelVisibility();
void updateCombinationVisibility();
- void onFocusReceived();
- void onSelectSearchType();
- void updateSearchTypeCombo();
+ void onFocusReceived();
+ void onSelectSearchType();
+ void updateSearchTypeCombo();
void setSearchType(LLInventoryFilter::ESearchType type);
LLSidepanelInventory* getParentSidepanelInventory();
private:
- LLFloaterInventoryFinder* getFinder();
-
- LLFilterEditor* mFilterEditor;
- LLTabContainer* mFilterTabs;
- LLUICtrl* mCounterCtrl;
- LLHandle<LLFloater> mFinderHandle;
- LLInventoryPanel* mActivePanel;
- LLInventoryPanel* mWornItemsPanel;
- bool mResortActivePanel;
- LLSaveFolderState* mSavedFolderState;
- std::string mFilterText;
- std::string mFilterSubString;
- S32 mItemCount;
- std::string mItemCountString;
- S32 mCategoryCount;
- std::string mCategoryCountString;
- LLComboBox* mSearchTypeCombo;
+ LLFloaterInventoryFinder* getFinder();
+
+ LLFilterEditor* mFilterEditor;
+ LLTabContainer* mFilterTabs;
+ LLUICtrl* mCounterCtrl;
+ LLHandle<LLFloater> mFinderHandle;
+ LLInventoryPanel* mActivePanel;
+ LLInventoryPanel* mWornItemsPanel;
+ bool mResortActivePanel;
+ LLSaveFolderState* mSavedFolderState;
+ std::string mFilterText;
+ std::string mFilterSubString;
+ S32 mItemCount;
+ std::string mItemCountString;
+ S32 mCategoryCount;
+ std::string mCategoryCountString;
+ LLComboBox* mSearchTypeCombo;
LLButton* mBackBtn;
LLButton* mForwardBtn;
@@ -216,47 +216,47 @@ private:
boost::signals2::connection mListViewRootUpdatedConnection;
boost::signals2::connection mGalleryRootUpdatedConnection;
- //////////////////////////////////////////////////////////////////////////////////
- // List Commands //
+ //////////////////////////////////////////////////////////////////////////////////
+ // List Commands //
protected:
- void initListCommandsHandlers();
- void updateListCommands();
- void onAddButtonClick();
- void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
- void onClipboardAction(const LLSD& userdata);
- BOOL isActionEnabled(const LLSD& command_name);
- BOOL isActionChecked(const LLSD& userdata);
- void onCustomAction(const LLSD& command_name);
+ void initListCommandsHandlers();
+ void updateListCommands();
+ void onAddButtonClick();
+ void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
+ void onClipboardAction(const LLSD& userdata);
+ BOOL isActionEnabled(const LLSD& command_name);
+ BOOL isActionChecked(const LLSD& userdata);
+ void onCustomAction(const LLSD& command_name);
bool isActionVisible(const LLSD& userdata);
static bool hasSettingsInventory();
static bool hasMaterialsInventory();
void updateTitle();
void updateNavButtons();
-
+
void onCombinationRootChanged(bool gallery_clicked);
void onCombinationGallerySelectionChanged(const LLUUID& category_id);
void onCombinationInventorySelectionChanged(const std::deque<LLFolderViewItem*>& items, BOOL user_action);
- /**
- * Set upload cost in "Upload" sub menu.
- */
- void setUploadCostIfNeeded();
+ /**
+ * Set upload cost in "Upload" sub menu.
+ */
+ void setUploadCostIfNeeded();
void disableAddIfNeeded();
private:
- LLToggleableMenu* mMenuGearDefault;
+ LLToggleableMenu* mMenuGearDefault;
LLToggleableMenu* mMenuViewDefault;
- LLToggleableMenu* mMenuVisibility;
- LLMenuButton* mGearMenuButton;
+ LLToggleableMenu* mMenuVisibility;
+ LLMenuButton* mGearMenuButton;
LLMenuButton* mViewMenuButton;
- LLMenuButton* mVisibilityMenuButton;
- LLHandle<LLView> mMenuAddHandle;
+ LLMenuButton* mVisibilityMenuButton;
+ LLHandle<LLView> mMenuAddHandle;
- bool mNeedUploadCost;
+ bool mNeedUploadCost;
bool mForceShowInvLayout;
bool mReshapeInvLayout;
LLUUID mCombInvUUIDNeedsRename;
- // List Commands //
- ////////////////////////////////////////////////////////////////////////////////
+ // List Commands //
+ ////////////////////////////////////////////////////////////////////////////////
};
#endif // LL_LLPANELMAININVENTORY_H
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index 3638ee14fc..331bc96275 100644
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelmarketplaceinbox.cpp
* @brief Panel for marketplace inbox
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,37 +40,37 @@
static LLPanelInjector<LLPanelMarketplaceInbox> t_panel_marketplace_inbox("panel_marketplace_inbox");
-const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams()
-{
- return LLUICtrlFactory::getDefaultParams<LLPanelMarketplaceInbox>();
+const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams()
+{
+ return LLUICtrlFactory::getDefaultParams<LLPanelMarketplaceInbox>();
}
// protected
LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
- : LLPanel(p)
- , mFreshCountCtrl(NULL)
- , mInboxButton(NULL)
- , mInventoryPanel(NULL)
- , mSavedFolderState(NULL)
+ : LLPanel(p)
+ , mFreshCountCtrl(NULL)
+ , mInboxButton(NULL)
+ , mInventoryPanel(NULL)
+ , mSavedFolderState(NULL)
{
- mSavedFolderState = new LLSaveFolderState();
- mSavedFolderState->setApply(FALSE);
+ mSavedFolderState = new LLSaveFolderState();
+ mSavedFolderState->setApply(FALSE);
}
LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox()
{
- delete mSavedFolderState;
+ delete mSavedFolderState;
}
// virtual
BOOL LLPanelMarketplaceInbox::postBuild()
{
- LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this));
+ LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this));
+
+ mFreshCountCtrl = getChild<LLUICtrl>("inbox_fresh_new_count");
+ mInboxButton = getChild<LLButton>("inbox_btn");
- mFreshCountCtrl = getChild<LLUICtrl>("inbox_fresh_new_count");
- mInboxButton = getChild<LLButton>("inbox_btn");
-
- return TRUE;
+ return TRUE;
}
void LLPanelMarketplaceInbox::onSelectionChange()
@@ -80,202 +80,202 @@ void LLPanelMarketplaceInbox::onSelectionChange()
LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel()
{
- LLView * inbox_inventory_placeholder = getChild<LLView>("inbox_inventory_placeholder");
- LLView * inbox_inventory_parent = inbox_inventory_placeholder->getParent();
-
- mInventoryPanel =
- LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_inbox_inventory.xml",
- inbox_inventory_parent,
- LLInventoryPanel::child_registry_t::instance());
-
- llassert(mInventoryPanel);
-
- // Reshape the inventory to the proper size
- LLRect inventory_placeholder_rect = inbox_inventory_placeholder->getRect();
- mInventoryPanel->setShape(inventory_placeholder_rect);
-
- // Set the sort order newest to oldest
- mInventoryPanel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_DATE);
- mInventoryPanel->getFilter().markDefault();
- mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
-
- // Set selection callback for proper update of inventory status buttons
- mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this));
-
- // Set up the note to display when the inbox is empty
- mInventoryPanel->getFilter().setEmptyLookupMessage("InventoryInboxNoItems");
-
- // Hide the placeholder text
- inbox_inventory_placeholder->setVisible(FALSE);
-
- return mInventoryPanel;
+ LLView * inbox_inventory_placeholder = getChild<LLView>("inbox_inventory_placeholder");
+ LLView * inbox_inventory_parent = inbox_inventory_placeholder->getParent();
+
+ mInventoryPanel =
+ LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_inbox_inventory.xml",
+ inbox_inventory_parent,
+ LLInventoryPanel::child_registry_t::instance());
+
+ llassert(mInventoryPanel);
+
+ // Reshape the inventory to the proper size
+ LLRect inventory_placeholder_rect = inbox_inventory_placeholder->getRect();
+ mInventoryPanel->setShape(inventory_placeholder_rect);
+
+ // Set the sort order newest to oldest
+ mInventoryPanel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_DATE);
+ mInventoryPanel->getFilter().markDefault();
+ mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+
+ // Set selection callback for proper update of inventory status buttons
+ mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this));
+
+ // Set up the note to display when the inbox is empty
+ mInventoryPanel->getFilter().setEmptyLookupMessage("InventoryInboxNoItems");
+
+ // Hide the placeholder text
+ inbox_inventory_placeholder->setVisible(FALSE);
+
+ return mInventoryPanel;
}
void LLPanelMarketplaceInbox::onFocusReceived()
{
- LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
- if (sidepanel_inventory)
- {
- sidepanel_inventory->clearSelections(true, false);
- }
-
- gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ if (sidepanel_inventory)
+ {
+ sidepanel_inventory->clearSelections(true, false);
+ }
+
+ gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
}
BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg)
{
- *accept = ACCEPT_NO;
- return TRUE;
+ *accept = ACCEPT_NO;
+ return TRUE;
}
U32 LLPanelMarketplaceInbox::getFreshItemCount() const
{
-
- //
- // NOTE: When turning this on, be sure to test the no inbox/outbox case because this code probably
- // will return "2" for the Inventory and LIBRARY top-levels when that happens.
- //
-
- U32 fresh_item_count = 0;
-
- if (mInventoryPanel)
- {
- LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
-
- if (inbox_folder)
- {
- LLFolderViewFolder::folders_t::const_iterator folders_it = inbox_folder->getFoldersBegin();
- LLFolderViewFolder::folders_t::const_iterator folders_end = inbox_folder->getFoldersEnd();
-
- for (; folders_it != folders_end; ++folders_it)
- {
- const LLFolderViewFolder * folder_view = *folders_it;
- const LLInboxFolderViewFolder * inbox_folder_view = dynamic_cast<const LLInboxFolderViewFolder*>(folder_view);
-
- if (inbox_folder_view && inbox_folder_view->isFresh())
- {
- fresh_item_count++;
- }
- }
-
- LLFolderViewFolder::items_t::const_iterator items_it = inbox_folder->getItemsBegin();
- LLFolderViewFolder::items_t::const_iterator items_end = inbox_folder->getItemsEnd();
-
- for (; items_it != items_end; ++items_it)
- {
- const LLFolderViewItem * item_view = *items_it;
- const LLInboxFolderViewItem * inbox_item_view = dynamic_cast<const LLInboxFolderViewItem*>(item_view);
-
- if (inbox_item_view && inbox_item_view->isFresh())
- {
- fresh_item_count++;
- }
- }
- }
- }
-
- return fresh_item_count;
+
+ //
+ // NOTE: When turning this on, be sure to test the no inbox/outbox case because this code probably
+ // will return "2" for the Inventory and LIBRARY top-levels when that happens.
+ //
+
+ U32 fresh_item_count = 0;
+
+ if (mInventoryPanel)
+ {
+ LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
+
+ if (inbox_folder)
+ {
+ LLFolderViewFolder::folders_t::const_iterator folders_it = inbox_folder->getFoldersBegin();
+ LLFolderViewFolder::folders_t::const_iterator folders_end = inbox_folder->getFoldersEnd();
+
+ for (; folders_it != folders_end; ++folders_it)
+ {
+ const LLFolderViewFolder * folder_view = *folders_it;
+ const LLInboxFolderViewFolder * inbox_folder_view = dynamic_cast<const LLInboxFolderViewFolder*>(folder_view);
+
+ if (inbox_folder_view && inbox_folder_view->isFresh())
+ {
+ fresh_item_count++;
+ }
+ }
+
+ LLFolderViewFolder::items_t::const_iterator items_it = inbox_folder->getItemsBegin();
+ LLFolderViewFolder::items_t::const_iterator items_end = inbox_folder->getItemsEnd();
+
+ for (; items_it != items_end; ++items_it)
+ {
+ const LLFolderViewItem * item_view = *items_it;
+ const LLInboxFolderViewItem * inbox_item_view = dynamic_cast<const LLInboxFolderViewItem*>(item_view);
+
+ if (inbox_item_view && inbox_item_view->isFresh())
+ {
+ fresh_item_count++;
+ }
+ }
+ }
+ }
+
+ return fresh_item_count;
}
U32 LLPanelMarketplaceInbox::getTotalItemCount() const
{
- U32 item_count = 0;
-
- if (mInventoryPanel)
- {
- const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
-
- if (inbox_folder)
- {
- item_count += inbox_folder->getFoldersCount();
- item_count += inbox_folder->getItemsCount();
- }
- }
-
- return item_count;
+ U32 item_count = 0;
+
+ if (mInventoryPanel)
+ {
+ const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
+
+ if (inbox_folder)
+ {
+ item_count += inbox_folder->getFoldersCount();
+ item_count += inbox_folder->getItemsCount();
+ }
+ }
+
+ return item_count;
}
void LLPanelMarketplaceInbox::onClearSearch()
{
- if (mInventoryPanel)
- {
- mInventoryPanel->setFilterSubString(LLStringUtil::null);
- mSavedFolderState->setApply(TRUE);
- mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
- LLOpenFoldersWithSelection opener;
- mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener);
- mInventoryPanel->getRootFolder()->scrollToShowSelection();
- }
+ if (mInventoryPanel)
+ {
+ mInventoryPanel->setFilterSubString(LLStringUtil::null);
+ mSavedFolderState->setApply(TRUE);
+ mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+ LLOpenFoldersWithSelection opener;
+ mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener);
+ mInventoryPanel->getRootFolder()->scrollToShowSelection();
+ }
}
void LLPanelMarketplaceInbox::onFilterEdit(const std::string& search_string)
{
- if (mInventoryPanel)
- {
-
- if (search_string == "")
- {
- onClearSearch();
- }
-
- if (!mInventoryPanel->getFilter().isNotDefault())
- {
- mSavedFolderState->setApply(FALSE);
- mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
- }
- mInventoryPanel->setFilterSubString(search_string);
- }
+ if (mInventoryPanel)
+ {
+
+ if (search_string == "")
+ {
+ onClearSearch();
+ }
+
+ if (!mInventoryPanel->getFilter().isNotDefault())
+ {
+ mSavedFolderState->setApply(FALSE);
+ mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+ }
+ mInventoryPanel->setFilterSubString(search_string);
+ }
}
std::string LLPanelMarketplaceInbox::getBadgeString() const
{
- std::string item_count_str("");
+ std::string item_count_str("");
- LLPanel *inventory_panel = LLFloaterSidePanelContainer::getPanel("inventory");
+ LLPanel *inventory_panel = LLFloaterSidePanelContainer::getPanel("inventory");
- // If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel
- if (getParent()->getVisible() && inventory_panel && !inventory_panel->isInVisibleChain())
- {
- U32 item_count = getFreshItemCount();
+ // If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel
+ if (getParent()->getVisible() && inventory_panel && !inventory_panel->isInVisibleChain())
+ {
+ U32 item_count = getFreshItemCount();
- if (item_count)
- {
- item_count_str = llformat("%d", item_count);
- }
- }
+ if (item_count)
+ {
+ item_count_str = llformat("%d", item_count);
+ }
+ }
- return item_count_str;
+ return item_count_str;
}
void LLPanelMarketplaceInbox::draw()
{
- U32 item_count = getTotalItemCount();
-
- llassert(mFreshCountCtrl != NULL);
-
- if (item_count > 0)
- {
- std::string item_count_str = llformat("%d", item_count);
-
- LLStringUtil::format_map_t args;
- args["[NUM]"] = item_count_str;
- mInboxButton->setLabel(getString("InboxLabelWithArg", args));
-
- // set green text to fresh item count
- U32 fresh_item_count = getFreshItemCount();
- mFreshCountCtrl->setVisible((fresh_item_count > 0));
-
- if (fresh_item_count > 0)
- {
- mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count));
- }
- }
- else
- {
- mInboxButton->setLabel(getString("InboxLabelNoArg"));
-
- mFreshCountCtrl->setVisible(FALSE);
- }
-
- LLPanel::draw();
+ U32 item_count = getTotalItemCount();
+
+ llassert(mFreshCountCtrl != NULL);
+
+ if (item_count > 0)
+ {
+ std::string item_count_str = llformat("%d", item_count);
+
+ LLStringUtil::format_map_t args;
+ args["[NUM]"] = item_count_str;
+ mInboxButton->setLabel(getString("InboxLabelWithArg", args));
+
+ // set green text to fresh item count
+ U32 fresh_item_count = getFreshItemCount();
+ mFreshCountCtrl->setVisible((fresh_item_count > 0));
+
+ if (fresh_item_count > 0)
+ {
+ mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count));
+ }
+ }
+ else
+ {
+ mInboxButton->setLabel(getString("InboxLabelNoArg"));
+
+ mFreshCountCtrl->setVisible(FALSE);
+ }
+
+ LLPanel::draw();
}
diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h
index 952e3a333a..1393bc1efe 100644
--- a/indra/newview/llpanelmarketplaceinbox.h
+++ b/indra/newview/llpanelmarketplaceinbox.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelmarketplaceinbox.h
* @brief Panel for marketplace inbox
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,44 +37,44 @@ class LLPanelMarketplaceInbox : public LLPanel
{
public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {};
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {};
+
+ LOG_CLASS(LLPanelMarketplaceInbox);
+
+ // RN: for some reason you can't just use LLUICtrlFactory::getDefaultParams as a default argument in VC8
+ static const LLPanelMarketplaceInbox::Params& getDefaultParams();
- LOG_CLASS(LLPanelMarketplaceInbox);
+ LLPanelMarketplaceInbox(const Params& p = getDefaultParams());
+ ~LLPanelMarketplaceInbox();
- // RN: for some reason you can't just use LLUICtrlFactory::getDefaultParams as a default argument in VC8
- static const LLPanelMarketplaceInbox::Params& getDefaultParams();
+ /*virtual*/ BOOL postBuild();
- LLPanelMarketplaceInbox(const Params& p = getDefaultParams());
- ~LLPanelMarketplaceInbox();
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg);
- /*virtual*/ BOOL postBuild();
-
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg);
+ /*virtual*/ void draw();
- /*virtual*/ void draw();
-
- LLInventoryPanel * setupInventoryPanel();
+ LLInventoryPanel * setupInventoryPanel();
- void onClearSearch();
- void onFilterEdit(const std::string& search_string);
+ void onClearSearch();
+ void onFilterEdit(const std::string& search_string);
- U32 getFreshItemCount() const;
- U32 getTotalItemCount() const;
+ U32 getFreshItemCount() const;
+ U32 getTotalItemCount() const;
- std::string getBadgeString() const;
+ std::string getBadgeString() const;
private:
- void onSelectionChange();
+ void onSelectionChange();
- void onFocusReceived();
+ void onFocusReceived();
private:
- LLUICtrl * mFreshCountCtrl;
- LLButton * mInboxButton;
- LLInventoryPanel * mInventoryPanel;
- LLSaveFolderState* mSavedFolderState;
+ LLUICtrl * mFreshCountCtrl;
+ LLButton * mInboxButton;
+ LLInventoryPanel * mInventoryPanel;
+ LLSaveFolderState* mSavedFolderState;
};
diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp
index e13bd0412d..6fd2b7e964 100644
--- a/indra/newview/llpanelmarketplaceinboxinventory.cpp
+++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelmarketplaceinboxinventory.cpp
* @brief LLInboxInventoryPanel class definition
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,7 +39,7 @@
#include "llsdserialize.h"
-#define DEBUGGING_FRESHNESS 0
+#define DEBUGGING_FRESHNESS 0
const LLColor4U DEFAULT_WHITE(255, 255, 255);
@@ -59,9 +59,9 @@ static LLDefaultChildRegistry::Register<LLInboxFolderViewItem> r3("inbox_folder_
//
LLInboxInventoryPanel::LLInboxInventoryPanel(const LLInboxInventoryPanel::Params& p)
-: LLInventoryPanel(p)
+: LLInventoryPanel(p)
{
- LLInboxNewItemsStorage::getInstance()->load();
+ LLInboxNewItemsStorage::getInstance()->load();
LLInboxNewItemsStorage::getInstance()->addInboxPanel(this);
}
@@ -72,43 +72,43 @@ LLInboxInventoryPanel::~LLInboxInventoryPanel()
void LLInboxInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
{
- LLInventoryPanel::initFromParams(params);
- getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() | (1ULL << LLFolderType::FT_INBOX));
+ LLInventoryPanel::initFromParams(params);
+ getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() | (1ULL << LLFolderType::FT_INBOX));
}
LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop)
{
- LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
-
- LLInboxFolderViewFolder::Params params;
-
- params.name = bridge->getDisplayName();
- params.root = mFolderRoot.get();
- params.listener = bridge;
- params.tool_tip = params.name;
- params.font_color = item_color;
- params.font_highlight_color = item_color;
+ LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+
+ LLInboxFolderViewFolder::Params params;
+
+ params.name = bridge->getDisplayName();
+ params.root = mFolderRoot.get();
+ params.listener = bridge;
+ params.tool_tip = params.name;
+ params.font_color = item_color;
+ params.font_highlight_color = item_color;
params.allow_drop = allow_drop;
-
- return LLUICtrlFactory::create<LLInboxFolderViewFolder>(params);
+
+ return LLUICtrlFactory::create<LLInboxFolderViewFolder>(params);
}
LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge)
{
- LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+ LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
- LLInboxFolderViewItem::Params params;
+ LLInboxFolderViewItem::Params params;
- params.name = bridge->getDisplayName();
- params.creation_date = bridge->getCreationDate();
- params.root = mFolderRoot.get();
- params.listener = bridge;
- params.rect = LLRect (0, 0, 0, 0);
- params.tool_tip = params.name;
- params.font_color = item_color;
- params.font_highlight_color = item_color;
+ params.name = bridge->getDisplayName();
+ params.creation_date = bridge->getCreationDate();
+ params.root = mFolderRoot.get();
+ params.listener = bridge;
+ params.rect = LLRect (0, 0, 0, 0);
+ params.tool_tip = params.name;
+ params.font_color = item_color;
+ params.font_highlight_color = item_color;
- return LLUICtrlFactory::create<LLInboxFolderViewItem>(params);
+ return LLUICtrlFactory::create<LLInboxFolderViewItem>(params);
}
void LLInboxInventoryPanel::onRemoveItemFreshness(const LLUUID& item_id)
@@ -131,11 +131,11 @@ void LLInboxInventoryPanel::onRemoveItemFreshness(const LLUUID& item_id)
//
LLInboxFolderViewFolder::LLInboxFolderViewFolder(const Params& p)
-: LLFolderViewFolder(p),
- LLBadgeOwner(getHandle()),
- mFresh(false)
+: LLFolderViewFolder(p),
+ LLBadgeOwner(getHandle()),
+ mFresh(false)
{
- initBadgeParams(p.new_badge());
+ initBadgeParams(p.new_badge());
}
void LLInboxFolderViewFolder::addItem(LLFolderViewItem* item)
@@ -159,74 +159,74 @@ void LLInboxFolderViewFolder::addItem(LLFolderViewItem* item)
// virtual
void LLInboxFolderViewFolder::draw()
{
- if (!hasBadgeHolderParent())
- {
- addBadgeToParentHolder();
- setDrawBadgeAtTop(true);
- }
+ if (!hasBadgeHolderParent())
+ {
+ addBadgeToParentHolder();
+ setDrawBadgeAtTop(true);
+ }
- setBadgeVisibility(mFresh);
+ setBadgeVisibility(mFresh);
- LLFolderViewFolder::draw();
+ LLFolderViewFolder::draw();
- if (mFresh)
- {
- reshapeBadge(getRect());
- }
+ if (mFresh)
+ {
+ reshapeBadge(getRect());
+ }
}
BOOL LLInboxFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask )
{
- deFreshify();
- return LLFolderViewFolder::handleMouseDown(x, y, mask);
+ deFreshify();
+ return LLFolderViewFolder::handleMouseDown(x, y, mask);
}
BOOL LLInboxFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
{
- deFreshify();
- return LLFolderViewFolder::handleDoubleClick(x, y, mask);
+ deFreshify();
+ return LLFolderViewFolder::handleDoubleClick(x, y, mask);
}
void LLInboxFolderViewFolder::selectItem()
{
- deFreshify();
- LLFolderViewFolder::selectItem();
+ deFreshify();
+ LLFolderViewFolder::selectItem();
}
void LLInboxFolderViewFolder::computeFreshness()
{
- LLFolderViewModelItemInventory* view_model = static_cast<LLFolderViewModelItemInventory*>(getViewModelItem());
- const U32 last_expansion_utc = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity");
+ LLFolderViewModelItemInventory* view_model = static_cast<LLFolderViewModelItemInventory*>(getViewModelItem());
+ const U32 last_expansion_utc = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity");
- if (last_expansion_utc > 0)
- {
- mFresh = (view_model->getCreationDate() > last_expansion_utc) || LLInboxNewItemsStorage::getInstance()->isItemFresh(view_model->getUUID());
+ if (last_expansion_utc > 0)
+ {
+ mFresh = (view_model->getCreationDate() > last_expansion_utc) || LLInboxNewItemsStorage::getInstance()->isItemFresh(view_model->getUUID());
#if DEBUGGING_FRESHNESS
- if (mFresh)
- {
- LL_INFOS() << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << LL_ENDL;
- }
+ if (mFresh)
+ {
+ LL_INFOS() << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << LL_ENDL;
+ }
#endif
- }
- else
- {
- mFresh = true;
- }
-
- if (mFresh)
- {
- LLInboxNewItemsStorage::getInstance()->addFreshItem(view_model->getUUID());
- }
+ }
+ else
+ {
+ mFresh = true;
+ }
+
+ if (mFresh)
+ {
+ LLInboxNewItemsStorage::getInstance()->addFreshItem(view_model->getUUID());
+ }
}
void LLInboxFolderViewFolder::deFreshify()
{
- mFresh = false;
+ mFresh = false;
- gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
- LLInboxNewItemsStorage::getInstance()->removeItem(static_cast<LLFolderViewModelItemInventory*>(getViewModelItem())->getUUID());
+ gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
+ LLInboxNewItemsStorage::getInstance()->removeItem(static_cast<LLFolderViewModelItemInventory*>(getViewModelItem())->getUUID());
}
//
@@ -234,77 +234,77 @@ void LLInboxFolderViewFolder::deFreshify()
//
LLInboxFolderViewItem::LLInboxFolderViewItem(const Params& p)
- : LLFolderViewItem(p)
- , LLBadgeOwner(getHandle())
- , mFresh(false)
+ : LLFolderViewItem(p)
+ , LLBadgeOwner(getHandle())
+ , mFresh(false)
{
- initBadgeParams(p.new_badge());
+ initBadgeParams(p.new_badge());
}
void LLInboxFolderViewItem::addToFolder(LLFolderViewFolder* folder)
{
- LLFolderViewItem::addToFolder(folder);
+ LLFolderViewItem::addToFolder(folder);
- // Compute freshness if our parent is the root folder for the inbox
- if (mParentFolder == mRoot)
- {
- computeFreshness();
- }
+ // Compute freshness if our parent is the root folder for the inbox
+ if (mParentFolder == mRoot)
+ {
+ computeFreshness();
+ }
}
BOOL LLInboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- deFreshify();
-
- return LLFolderViewItem::handleDoubleClick(x, y, mask);
+ deFreshify();
+
+ return LLFolderViewItem::handleDoubleClick(x, y, mask);
}
// virtual
void LLInboxFolderViewItem::draw()
{
- if (!hasBadgeHolderParent())
- {
- addBadgeToParentHolder();
- }
+ if (!hasBadgeHolderParent())
+ {
+ addBadgeToParentHolder();
+ }
- setBadgeVisibility(mFresh);
+ setBadgeVisibility(mFresh);
- LLFolderViewItem::draw();
+ LLFolderViewItem::draw();
}
void LLInboxFolderViewItem::selectItem()
{
- deFreshify();
+ deFreshify();
- LLFolderViewItem::selectItem();
+ LLFolderViewItem::selectItem();
}
void LLInboxFolderViewItem::computeFreshness()
{
- const U32 last_expansion_utc = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity");
+ const U32 last_expansion_utc = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity");
- if (last_expansion_utc > 0)
- {
- mFresh = (static_cast<LLFolderViewModelItemInventory*>(getViewModelItem())->getCreationDate() > last_expansion_utc);
+ if (last_expansion_utc > 0)
+ {
+ mFresh = (static_cast<LLFolderViewModelItemInventory*>(getViewModelItem())->getCreationDate() > last_expansion_utc);
#if DEBUGGING_FRESHNESS
- if (mFresh)
- {
- LL_INFOS() << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << LL_ENDL;
- }
+ if (mFresh)
+ {
+ LL_INFOS() << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << LL_ENDL;
+ }
#endif
- }
- else
- {
- mFresh = true;
- }
+ }
+ else
+ {
+ mFresh = true;
+ }
}
void LLInboxFolderViewItem::deFreshify()
{
- mFresh = false;
+ mFresh = false;
- gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
+ gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
}
LLInboxNewItemsStorage::LLInboxNewItemsStorage()
@@ -314,49 +314,49 @@ LLInboxNewItemsStorage::LLInboxNewItemsStorage()
// static
void LLInboxNewItemsStorage::destroyClass()
{
- LLInboxNewItemsStorage::getInstance()->saveNewItemsIds();
+ LLInboxNewItemsStorage::getInstance()->saveNewItemsIds();
}
void LLInboxNewItemsStorage::saveNewItemsIds()
{
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, NEW_INBOX_FILENAME);
- if (!filename.empty())
- {
- LLSD uuids_data;
- for (std::set<LLUUID>::const_iterator it = mNewItemsIDs.begin(); it != mNewItemsIDs.end(); it++)
- {
- uuids_data.append((*it));
- }
-
- llofstream file;
- file.open(filename.c_str());
- if ( file.is_open() )
- {
- LLSDSerialize::toPrettyXML(uuids_data, file);
- file.close();
- }
- }
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, NEW_INBOX_FILENAME);
+ if (!filename.empty())
+ {
+ LLSD uuids_data;
+ for (std::set<LLUUID>::const_iterator it = mNewItemsIDs.begin(); it != mNewItemsIDs.end(); it++)
+ {
+ uuids_data.append((*it));
+ }
+
+ llofstream file;
+ file.open(filename.c_str());
+ if ( file.is_open() )
+ {
+ LLSDSerialize::toPrettyXML(uuids_data, file);
+ file.close();
+ }
+ }
}
void LLInboxNewItemsStorage::load()
{
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, NEW_INBOX_FILENAME);
- if (!filename.empty())
- {
- llifstream in_file;
- in_file.open(filename.c_str());
-
- LLSD uuids_data;
- if (in_file.is_open())
- {
- LLSDSerialize::fromXML(uuids_data, in_file);
- in_file.close();
- for (LLSD::array_iterator i = uuids_data.beginArray(); i != uuids_data.endArray(); ++i)
- {
- mNewItemsIDs.insert((*i).asUUID());
- }
- }
- }
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, NEW_INBOX_FILENAME);
+ if (!filename.empty())
+ {
+ llifstream in_file;
+ in_file.open(filename.c_str());
+
+ LLSD uuids_data;
+ if (in_file.is_open())
+ {
+ LLSDSerialize::fromXML(uuids_data, in_file);
+ in_file.close();
+ for (LLSD::array_iterator i = uuids_data.beginArray(); i != uuids_data.endArray(); ++i)
+ {
+ mNewItemsIDs.insert((*i).asUUID());
+ }
+ }
+ }
}
void LLInboxNewItemsStorage::removeItem(const LLUUID& id)
diff --git a/indra/newview/llpanelmarketplaceinboxinventory.h b/indra/newview/llpanelmarketplaceinboxinventory.h
index 9eef5f209c..eb5d809db1 100644
--- a/indra/newview/llpanelmarketplaceinboxinventory.h
+++ b/indra/newview/llpanelmarketplaceinboxinventory.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelmarketplaceinboxinventory.h
* @brief LLInboxInventoryPanel class declaration
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,16 +39,16 @@
class LLInboxInventoryPanel : public LLInventoryPanel
{
public:
- struct Params : public LLInitParam::Block<Params, LLInventoryPanel::Params>
- {};
-
- LLInboxInventoryPanel(const Params& p);
- ~LLInboxInventoryPanel();
+ struct Params : public LLInitParam::Block<Params, LLInventoryPanel::Params>
+ {};
+
+ LLInboxInventoryPanel(const Params& p);
+ ~LLInboxInventoryPanel();
- // virtual
- void initFromParams(const LLInventoryPanel::Params&);
- LLFolderViewFolder* createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop);
- LLFolderViewItem * createFolderViewItem(LLInvFVBridge * bridge);
+ // virtual
+ void initFromParams(const LLInventoryPanel::Params&);
+ LLFolderViewFolder* createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop);
+ LLFolderViewItem * createFolderViewItem(LLInvFVBridge * bridge);
void onRemoveItemFreshness(const LLUUID& item_id);
};
@@ -57,86 +57,86 @@ public:
class LLInboxFolderViewFolder : public LLFolderViewFolder, public LLBadgeOwner
{
public:
- struct Params : public LLInitParam::Block<Params, LLFolderViewFolder::Params>
- {
- Optional<LLBadge::Params> new_badge;
-
- Params()
- : new_badge("new_badge")
- {}
- };
-
- LLInboxFolderViewFolder(const Params& p);
-
+ struct Params : public LLInitParam::Block<Params, LLFolderViewFolder::Params>
+ {
+ Optional<LLBadge::Params> new_badge;
+
+ Params()
+ : new_badge("new_badge")
+ {}
+ };
+
+ LLInboxFolderViewFolder(const Params& p);
+
void addItem(LLFolderViewItem* item);
- void draw();
-
- BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
- void selectItem();
+ void draw();
+
+ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+ void selectItem();
- void computeFreshness();
- void deFreshify();
+ void computeFreshness();
+ void deFreshify();
- bool isFresh() const { return mFresh; }
+ bool isFresh() const { return mFresh; }
void setFresh(bool is_fresh) { mFresh = is_fresh; }
-
+
protected:
- bool mFresh;
+ bool mFresh;
};
class LLInboxFolderViewItem : public LLFolderViewItem, public LLBadgeOwner
{
public:
- struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>
- {
- Optional<LLBadge::Params> new_badge;
+ struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>
+ {
+ Optional<LLBadge::Params> new_badge;
- Params()
- : new_badge("new_badge")
- {}
- };
+ Params()
+ : new_badge("new_badge")
+ {}
+ };
- LLInboxFolderViewItem(const Params& p);
+ LLInboxFolderViewItem(const Params& p);
- void addToFolder(LLFolderViewFolder* folder);
- BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+ void addToFolder(LLFolderViewFolder* folder);
+ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
- void draw();
+ void draw();
- void selectItem();
+ void selectItem();
- void computeFreshness();
- void deFreshify();
+ void computeFreshness();
+ void deFreshify();
- bool isFresh() const { return mFresh; }
+ bool isFresh() const { return mFresh; }
void setFresh(bool is_fresh) { mFresh = is_fresh; }
protected:
- bool mFresh;
+ bool mFresh;
};
class LLInboxNewItemsStorage : public LLSingleton<LLInboxNewItemsStorage>
- , public LLDestroyClass<LLInboxNewItemsStorage>
+ , public LLDestroyClass<LLInboxNewItemsStorage>
{
- LLSINGLETON(LLInboxNewItemsStorage);
- LOG_CLASS(LLInboxNewItemsStorage);
+ LLSINGLETON(LLInboxNewItemsStorage);
+ LOG_CLASS(LLInboxNewItemsStorage);
public:
- static void destroyClass();
- void saveNewItemsIds();
+ static void destroyClass();
+ void saveNewItemsIds();
+
+ void load();
- void load();
-
- void addFreshItem(const LLUUID& id) { mNewItemsIDs.insert(id); }
+ void addFreshItem(const LLUUID& id) { mNewItemsIDs.insert(id); }
void removeItem(const LLUUID& id);
- bool isItemFresh(const LLUUID& id) { return (mNewItemsIDs.find(id) != mNewItemsIDs.end()); }
+ bool isItemFresh(const LLUUID& id) { return (mNewItemsIDs.find(id) != mNewItemsIDs.end()); }
void addInboxPanel(LLInboxInventoryPanel* inbox) { mInboxPanels.insert(inbox); }
void removeInboxPanel(LLInboxInventoryPanel* inbox) { mInboxPanels.erase(inbox); }
private:
- std::set<LLUUID> mNewItemsIDs;
+ std::set<LLUUID> mNewItemsIDs;
std::set<LLInboxInventoryPanel*> mInboxPanels;
};
diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp
index 8380394f2c..43012d85f4 100644
--- a/indra/newview/llpanelmediasettingsgeneral.cpp
+++ b/indra/newview/llpanelmediasettingsgeneral.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -62,44 +62,44 @@ const char *CHECKERBOARD_DATA_URL = "data:image/svg+xml,%3Csvg xmlns=%22http://w
////////////////////////////////////////////////////////////////////////////////
//
LLPanelMediaSettingsGeneral::LLPanelMediaSettingsGeneral() :
- mAutoLoop( NULL ),
- mFirstClick( NULL ),
- mAutoZoom( NULL ),
- mAutoPlay( NULL ),
- mAutoScale( NULL ),
- mWidthPixels( NULL ),
- mHeightPixels( NULL ),
- mHomeURL( NULL ),
- mCurrentURL( NULL ),
- mParent( NULL ),
- mMediaEditable(false)
+ mAutoLoop( NULL ),
+ mFirstClick( NULL ),
+ mAutoZoom( NULL ),
+ mAutoPlay( NULL ),
+ mAutoScale( NULL ),
+ mWidthPixels( NULL ),
+ mHeightPixels( NULL ),
+ mHomeURL( NULL ),
+ mCurrentURL( NULL ),
+ mParent( NULL ),
+ mMediaEditable(false)
{
- // build dialog from XML
- buildFromFile( "panel_media_settings_general.xml");
+ // build dialog from XML
+ buildFromFile( "panel_media_settings_general.xml");
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLPanelMediaSettingsGeneral::postBuild()
{
- // connect member vars with UI widgets
- mAutoLoop = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_LOOP_KEY );
- mAutoPlay = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_PLAY_KEY );
- mAutoScale = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_SCALE_KEY );
- mAutoZoom = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_ZOOM_KEY );
- mCurrentURL = getChild< LLTextBox >( LLMediaEntry::CURRENT_URL_KEY );
- mFirstClick = getChild< LLCheckBoxCtrl >( LLMediaEntry::FIRST_CLICK_INTERACT_KEY );
- mHeightPixels = getChild< LLSpinCtrl >( LLMediaEntry::HEIGHT_PIXELS_KEY );
- mHomeURL = getChild< LLLineEditor >( LLMediaEntry::HOME_URL_KEY );
- mWidthPixels = getChild< LLSpinCtrl >( LLMediaEntry::WIDTH_PIXELS_KEY );
- mPreviewMedia = getChild<LLMediaCtrl>("preview_media");
- mFailWhiteListText = getChild<LLTextBox>( "home_fails_whitelist_label" );
-
- // watch commit action for HOME URL
- childSetCommitCallback( LLMediaEntry::HOME_URL_KEY, onCommitHomeURL, this);
- childSetCommitCallback( "current_url_reset_btn",onBtnResetCurrentUrl, this);
-
- return true;
+ // connect member vars with UI widgets
+ mAutoLoop = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_LOOP_KEY );
+ mAutoPlay = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_PLAY_KEY );
+ mAutoScale = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_SCALE_KEY );
+ mAutoZoom = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_ZOOM_KEY );
+ mCurrentURL = getChild< LLTextBox >( LLMediaEntry::CURRENT_URL_KEY );
+ mFirstClick = getChild< LLCheckBoxCtrl >( LLMediaEntry::FIRST_CLICK_INTERACT_KEY );
+ mHeightPixels = getChild< LLSpinCtrl >( LLMediaEntry::HEIGHT_PIXELS_KEY );
+ mHomeURL = getChild< LLLineEditor >( LLMediaEntry::HOME_URL_KEY );
+ mWidthPixels = getChild< LLSpinCtrl >( LLMediaEntry::WIDTH_PIXELS_KEY );
+ mPreviewMedia = getChild<LLMediaCtrl>("preview_media");
+ mFailWhiteListText = getChild<LLTextBox>( "home_fails_whitelist_label" );
+
+ // watch commit action for HOME URL
+ childSetCommitCallback( LLMediaEntry::HOME_URL_KEY, onCommitHomeURL, this);
+ childSetCommitCallback( "current_url_reset_btn",onBtnResetCurrentUrl, this);
+
+ return true;
}
////////////////////////////////////////////////////////////////////////////////
@@ -112,231 +112,231 @@ LLPanelMediaSettingsGeneral::~LLPanelMediaSettingsGeneral()
// static
void LLPanelMediaSettingsGeneral::draw()
{
- // housekeeping
- LLPanel::draw();
-
- // TODO: we need to call this repeatedly until the floater panels are fully
- // created but once we have a valid answer, we should stop looking here - the
- // commit callback will handle it
- checkHomeUrlPassesWhitelist();
-
- // enable/disable pixel values image entry based on auto scale checkbox
- if ( mAutoScale->getValue().asBoolean() == false )
- {
- getChildView( LLMediaEntry::WIDTH_PIXELS_KEY )->setEnabled( true );
- getChildView( LLMediaEntry::HEIGHT_PIXELS_KEY )->setEnabled( true );
- }
- else
- {
- getChildView( LLMediaEntry::WIDTH_PIXELS_KEY )->setEnabled( false );
- getChildView( LLMediaEntry::HEIGHT_PIXELS_KEY )->setEnabled( false );
- };
-
- // enable/disable UI based on type of media
- bool reset_button_is_active = true;
- if( mPreviewMedia )
- {
- LLPluginClassMedia* media_plugin = mPreviewMedia->getMediaPlugin();
- if( media_plugin )
- {
- // turn off volume (if we can) for preview. Note: this really only
- // works for QuickTime movies right now - no way to control the
- // volume of a flash app embedded in a page for example
- media_plugin->setVolume( 0 );
-
- // some controls are only appropriate for time or browser type plugins
- // so we selectively enable/disable them - need to do it in draw
- // because the information from plugins arrives assynchronously
- bool show_time_controls = media_plugin->pluginSupportsMediaTime();
- if ( show_time_controls )
- {
- getChildView( LLMediaEntry::CURRENT_URL_KEY )->setEnabled( false );
- reset_button_is_active = false;
- getChildView("current_url_label")->setEnabled(false );
- getChildView( LLMediaEntry::AUTO_LOOP_KEY )->setEnabled( true );
- }
- else
- {
- getChildView( LLMediaEntry::CURRENT_URL_KEY )->setEnabled( true );
- reset_button_is_active = true;
- getChildView("current_url_label")->setEnabled(true );
- getChildView( LLMediaEntry::AUTO_LOOP_KEY )->setEnabled( false );
- };
- };
- };
-
- // current URL can change over time, update it here
- updateCurrentUrl();
-
- LLPermissions perm;
- bool user_can_press_reset = mMediaEditable;
-
- // several places modify this widget so we must collect states in one place
- if ( reset_button_is_active )
- {
- // user has perms to press reset button and it is active
- if ( user_can_press_reset )
- {
- getChildView("current_url_reset_btn")->setEnabled(true );
- }
- // user does not has perms to press reset button and it is active
- else
- {
- getChildView("current_url_reset_btn")->setEnabled(false );
- };
- }
- else
- // reset button is inactive so we just slam it to off - other states don't matter
- {
- getChildView("current_url_reset_btn")->setEnabled(false );
- };
+ // housekeeping
+ LLPanel::draw();
+
+ // TODO: we need to call this repeatedly until the floater panels are fully
+ // created but once we have a valid answer, we should stop looking here - the
+ // commit callback will handle it
+ checkHomeUrlPassesWhitelist();
+
+ // enable/disable pixel values image entry based on auto scale checkbox
+ if ( mAutoScale->getValue().asBoolean() == false )
+ {
+ getChildView( LLMediaEntry::WIDTH_PIXELS_KEY )->setEnabled( true );
+ getChildView( LLMediaEntry::HEIGHT_PIXELS_KEY )->setEnabled( true );
+ }
+ else
+ {
+ getChildView( LLMediaEntry::WIDTH_PIXELS_KEY )->setEnabled( false );
+ getChildView( LLMediaEntry::HEIGHT_PIXELS_KEY )->setEnabled( false );
+ };
+
+ // enable/disable UI based on type of media
+ bool reset_button_is_active = true;
+ if( mPreviewMedia )
+ {
+ LLPluginClassMedia* media_plugin = mPreviewMedia->getMediaPlugin();
+ if( media_plugin )
+ {
+ // turn off volume (if we can) for preview. Note: this really only
+ // works for QuickTime movies right now - no way to control the
+ // volume of a flash app embedded in a page for example
+ media_plugin->setVolume( 0 );
+
+ // some controls are only appropriate for time or browser type plugins
+ // so we selectively enable/disable them - need to do it in draw
+ // because the information from plugins arrives assynchronously
+ bool show_time_controls = media_plugin->pluginSupportsMediaTime();
+ if ( show_time_controls )
+ {
+ getChildView( LLMediaEntry::CURRENT_URL_KEY )->setEnabled( false );
+ reset_button_is_active = false;
+ getChildView("current_url_label")->setEnabled(false );
+ getChildView( LLMediaEntry::AUTO_LOOP_KEY )->setEnabled( true );
+ }
+ else
+ {
+ getChildView( LLMediaEntry::CURRENT_URL_KEY )->setEnabled( true );
+ reset_button_is_active = true;
+ getChildView("current_url_label")->setEnabled(true );
+ getChildView( LLMediaEntry::AUTO_LOOP_KEY )->setEnabled( false );
+ };
+ };
+ };
+
+ // current URL can change over time, update it here
+ updateCurrentUrl();
+
+ LLPermissions perm;
+ bool user_can_press_reset = mMediaEditable;
+
+ // several places modify this widget so we must collect states in one place
+ if ( reset_button_is_active )
+ {
+ // user has perms to press reset button and it is active
+ if ( user_can_press_reset )
+ {
+ getChildView("current_url_reset_btn")->setEnabled(true );
+ }
+ // user does not has perms to press reset button and it is active
+ else
+ {
+ getChildView("current_url_reset_btn")->setEnabled(false );
+ };
+ }
+ else
+ // reset button is inactive so we just slam it to off - other states don't matter
+ {
+ getChildView("current_url_reset_btn")->setEnabled(false );
+ };
}
////////////////////////////////////////////////////////////////////////////////
-// static
+// static
void LLPanelMediaSettingsGeneral::clearValues( void* userdata, bool editable, bool update_preview)
-{
- LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;
- self->mAutoLoop->clear();
- self->mAutoPlay->clear();
- self->mAutoScale->clear();
- self->mAutoZoom ->clear();
- self->mCurrentURL->clear();
- self->mFirstClick->clear();
- self->mHeightPixels->clear();
- self->mHomeURL->clear();
- self->mWidthPixels->clear();
- self->mAutoLoop ->setEnabled(editable);
- self->mAutoPlay ->setEnabled(editable);
- self->mAutoScale ->setEnabled(editable);
- self->mAutoZoom ->setEnabled(editable);
- self->mCurrentURL ->setEnabled(editable);
- self->mFirstClick ->setEnabled(editable);
- self->mHeightPixels ->setEnabled(editable);
- self->mHomeURL ->setEnabled(editable);
- self->mWidthPixels ->setEnabled(editable);
- if (update_preview)
- {
- self->updateMediaPreview();
- }
+{
+ LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;
+ self->mAutoLoop->clear();
+ self->mAutoPlay->clear();
+ self->mAutoScale->clear();
+ self->mAutoZoom ->clear();
+ self->mCurrentURL->clear();
+ self->mFirstClick->clear();
+ self->mHeightPixels->clear();
+ self->mHomeURL->clear();
+ self->mWidthPixels->clear();
+ self->mAutoLoop ->setEnabled(editable);
+ self->mAutoPlay ->setEnabled(editable);
+ self->mAutoScale ->setEnabled(editable);
+ self->mAutoZoom ->setEnabled(editable);
+ self->mCurrentURL ->setEnabled(editable);
+ self->mFirstClick ->setEnabled(editable);
+ self->mHeightPixels ->setEnabled(editable);
+ self->mHomeURL ->setEnabled(editable);
+ self->mWidthPixels ->setEnabled(editable);
+ if (update_preview)
+ {
+ self->updateMediaPreview();
+ }
}
// static
bool LLPanelMediaSettingsGeneral::isMultiple()
{
- // IF all the faces have media (or all dont have media)
- if ( LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo )
- {
- if(LLFloaterMediaSettings::getInstance()->mMultipleMedia)
- {
- return true;
- }
-
- }
- else
- {
- if(LLFloaterMediaSettings::getInstance()->mMultipleValidMedia)
- {
- return true;
- }
- }
- return false;
-}
+ // IF all the faces have media (or all dont have media)
+ if ( LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo )
+ {
+ if(LLFloaterMediaSettings::getInstance()->mMultipleMedia)
+ {
+ return true;
+ }
+
+ }
+ else
+ {
+ if(LLFloaterMediaSettings::getInstance()->mMultipleValidMedia)
+ {
+ return true;
+ }
+ }
+ return false;
+}
////////////////////////////////////////////////////////////////////////////////
-// static
+// static
void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& _media_settings, bool editable)
{
- LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;
- self->mMediaEditable = editable;
-
- LLSD media_settings = _media_settings;
-
- if ( LLPanelMediaSettingsGeneral::isMultiple() )
- {
- // *HACK: "edit" the incoming media_settings
- media_settings[LLMediaEntry::CURRENT_URL_KEY] = LLTrans::getString("Multiple Media");
- media_settings[LLMediaEntry::HOME_URL_KEY] = LLTrans::getString("Multiple Media");
- }
-
- std::string base_key( "" );
- std::string tentative_key( "" );
-
- struct
- {
- std::string key_name;
- LLUICtrl* ctrl_ptr;
- std::string ctrl_type;
-
- } data_set [] =
- {
- { LLMediaEntry::AUTO_LOOP_KEY, self->mAutoLoop, "LLCheckBoxCtrl" },
- { LLMediaEntry::AUTO_PLAY_KEY, self->mAutoPlay, "LLCheckBoxCtrl" },
- { LLMediaEntry::AUTO_SCALE_KEY, self->mAutoScale, "LLCheckBoxCtrl" },
- { LLMediaEntry::AUTO_ZOOM_KEY, self->mAutoZoom, "LLCheckBoxCtrl" },
- { LLMediaEntry::CURRENT_URL_KEY, self->mCurrentURL, "LLTextBox" },
- { LLMediaEntry::HEIGHT_PIXELS_KEY, self->mHeightPixels, "LLSpinCtrl" },
- { LLMediaEntry::HOME_URL_KEY, self->mHomeURL, "LLLineEditor" },
- { LLMediaEntry::FIRST_CLICK_INTERACT_KEY, self->mFirstClick, "LLCheckBoxCtrl" },
- { LLMediaEntry::WIDTH_PIXELS_KEY, self->mWidthPixels, "LLSpinCtrl" },
- { "", NULL , "" }
- };
-
- for( int i = 0; data_set[ i ].key_name.length() > 0; ++i )
- {
- base_key = std::string( data_set[ i ].key_name );
- tentative_key = base_key + std::string( LLPanelContents::TENTATIVE_SUFFIX );
- // TODO: CP - I bet there is a better way to do this using Boost
- if ( media_settings[ base_key ].isDefined() )
- {
- if ( data_set[ i ].ctrl_type == "LLLineEditor" )
- {
- static_cast< LLLineEditor* >( data_set[ i ].ctrl_ptr )->
- setText( media_settings[ base_key ].asString() );
- }
- else
- if ( data_set[ i ].ctrl_type == "LLCheckBoxCtrl" )
- static_cast< LLCheckBoxCtrl* >( data_set[ i ].ctrl_ptr )->
- setValue( media_settings[ base_key ].asBoolean() );
- else
- if ( data_set[ i ].ctrl_type == "LLComboBox" )
- static_cast< LLComboBox* >( data_set[ i ].ctrl_ptr )->
- setCurrentByIndex( media_settings[ base_key ].asInteger() );
- else
- if ( data_set[ i ].ctrl_type == "LLSpinCtrl" )
- static_cast< LLSpinCtrl* >( data_set[ i ].ctrl_ptr )->
- setValue( media_settings[ base_key ].asInteger() );
-
- data_set[ i ].ctrl_ptr->setEnabled(self->mMediaEditable);
- data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );
- };
- };
+ LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;
+ self->mMediaEditable = editable;
+
+ LLSD media_settings = _media_settings;
+
+ if ( LLPanelMediaSettingsGeneral::isMultiple() )
+ {
+ // *HACK: "edit" the incoming media_settings
+ media_settings[LLMediaEntry::CURRENT_URL_KEY] = LLTrans::getString("Multiple Media");
+ media_settings[LLMediaEntry::HOME_URL_KEY] = LLTrans::getString("Multiple Media");
+ }
+
+ std::string base_key( "" );
+ std::string tentative_key( "" );
+
+ struct
+ {
+ std::string key_name;
+ LLUICtrl* ctrl_ptr;
+ std::string ctrl_type;
+
+ } data_set [] =
+ {
+ { LLMediaEntry::AUTO_LOOP_KEY, self->mAutoLoop, "LLCheckBoxCtrl" },
+ { LLMediaEntry::AUTO_PLAY_KEY, self->mAutoPlay, "LLCheckBoxCtrl" },
+ { LLMediaEntry::AUTO_SCALE_KEY, self->mAutoScale, "LLCheckBoxCtrl" },
+ { LLMediaEntry::AUTO_ZOOM_KEY, self->mAutoZoom, "LLCheckBoxCtrl" },
+ { LLMediaEntry::CURRENT_URL_KEY, self->mCurrentURL, "LLTextBox" },
+ { LLMediaEntry::HEIGHT_PIXELS_KEY, self->mHeightPixels, "LLSpinCtrl" },
+ { LLMediaEntry::HOME_URL_KEY, self->mHomeURL, "LLLineEditor" },
+ { LLMediaEntry::FIRST_CLICK_INTERACT_KEY, self->mFirstClick, "LLCheckBoxCtrl" },
+ { LLMediaEntry::WIDTH_PIXELS_KEY, self->mWidthPixels, "LLSpinCtrl" },
+ { "", NULL , "" }
+ };
+
+ for( int i = 0; data_set[ i ].key_name.length() > 0; ++i )
+ {
+ base_key = std::string( data_set[ i ].key_name );
+ tentative_key = base_key + std::string( LLPanelContents::TENTATIVE_SUFFIX );
+ // TODO: CP - I bet there is a better way to do this using Boost
+ if ( media_settings[ base_key ].isDefined() )
+ {
+ if ( data_set[ i ].ctrl_type == "LLLineEditor" )
+ {
+ static_cast< LLLineEditor* >( data_set[ i ].ctrl_ptr )->
+ setText( media_settings[ base_key ].asString() );
+ }
+ else
+ if ( data_set[ i ].ctrl_type == "LLCheckBoxCtrl" )
+ static_cast< LLCheckBoxCtrl* >( data_set[ i ].ctrl_ptr )->
+ setValue( media_settings[ base_key ].asBoolean() );
+ else
+ if ( data_set[ i ].ctrl_type == "LLComboBox" )
+ static_cast< LLComboBox* >( data_set[ i ].ctrl_ptr )->
+ setCurrentByIndex( media_settings[ base_key ].asInteger() );
+ else
+ if ( data_set[ i ].ctrl_type == "LLSpinCtrl" )
+ static_cast< LLSpinCtrl* >( data_set[ i ].ctrl_ptr )->
+ setValue( media_settings[ base_key ].asInteger() );
+
+ data_set[ i ].ctrl_ptr->setEnabled(self->mMediaEditable);
+ data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );
+ };
+ };
}
////////////////////////////////////////////////////////////////////////////////
// Helper to set media control to media URL as required
void LLPanelMediaSettingsGeneral::updateMediaPreview()
{
- if(LLTrans::getString("Multiple Media") == mHomeURL->getValue().asString())
- {
- return;
- }
- if ( mHomeURL->getValue().asString().length() > 0 )
- {
- if(mPreviewMedia->getCurrentNavUrl() != mHomeURL->getValue().asString())
- {
- mPreviewMedia->navigateTo( mHomeURL->getValue().asString() );
- }
- }
- else
- // new home URL will be empty if media is deleted so display a
- // "preview goes here" data url page
- {
- if(mPreviewMedia->getCurrentNavUrl() != CHECKERBOARD_DATA_URL)
- {
- mPreviewMedia->navigateTo( CHECKERBOARD_DATA_URL );
- }
- };
+ if(LLTrans::getString("Multiple Media") == mHomeURL->getValue().asString())
+ {
+ return;
+ }
+ if ( mHomeURL->getValue().asString().length() > 0 )
+ {
+ if(mPreviewMedia->getCurrentNavUrl() != mHomeURL->getValue().asString())
+ {
+ mPreviewMedia->navigateTo( mHomeURL->getValue().asString() );
+ }
+ }
+ else
+ // new home URL will be empty if media is deleted so display a
+ // "preview goes here" data url page
+ {
+ if(mPreviewMedia->getCurrentNavUrl() != CHECKERBOARD_DATA_URL)
+ {
+ mPreviewMedia->navigateTo( CHECKERBOARD_DATA_URL );
+ }
+ };
}
////////////////////////////////////////////////////////////////////////////////
@@ -344,87 +344,87 @@ void LLPanelMediaSettingsGeneral::updateMediaPreview()
// virtual
void LLPanelMediaSettingsGeneral::onClose(bool app_quitting)
{
- if(mPreviewMedia)
- {
- mPreviewMedia->unloadMediaSource();
- }
+ if(mPreviewMedia)
+ {
+ mPreviewMedia->unloadMediaSource();
+ }
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
void LLPanelMediaSettingsGeneral::checkHomeUrlPassesWhitelist()
{
- // parent floater has not constructed the security panel yet
- if ( mParent->getPanelSecurity() == 0 )
- return;
-
- std::string home_url = getHomeUrl();
- if ( home_url.empty() || mParent->getPanelSecurity()->urlPassesWhiteList( home_url ) )
- {
- // Home URL is empty or passes the white list so hide the warning message
- mFailWhiteListText->setVisible( false );
- }
- else
- {
- // Home URL does not pass the white list so show the warning message
- mFailWhiteListText->setVisible( true );
- };
+ // parent floater has not constructed the security panel yet
+ if ( mParent->getPanelSecurity() == 0 )
+ return;
+
+ std::string home_url = getHomeUrl();
+ if ( home_url.empty() || mParent->getPanelSecurity()->urlPassesWhiteList( home_url ) )
+ {
+ // Home URL is empty or passes the white list so hide the warning message
+ mFailWhiteListText->setVisible( false );
+ }
+ else
+ {
+ // Home URL does not pass the white list so show the warning message
+ mFailWhiteListText->setVisible( true );
+ };
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsGeneral::onCommitHomeURL( LLUICtrl* ctrl, void *userdata )
{
- LLPanelMediaSettingsGeneral* self =(LLPanelMediaSettingsGeneral *)userdata;
+ LLPanelMediaSettingsGeneral* self =(LLPanelMediaSettingsGeneral *)userdata;
- // check home url passes whitelist and display warning if not
- self->checkHomeUrlPassesWhitelist();
+ // check home url passes whitelist and display warning if not
+ self->checkHomeUrlPassesWhitelist();
- self->updateMediaPreview();
+ self->updateMediaPreview();
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsGeneral::onBtnResetCurrentUrl(LLUICtrl* ctrl, void *userdata)
{
- LLPanelMediaSettingsGeneral* self =(LLPanelMediaSettingsGeneral *)userdata;
- self->navigateHomeSelectedFace(false);
+ LLPanelMediaSettingsGeneral* self =(LLPanelMediaSettingsGeneral *)userdata;
+ self->navigateHomeSelectedFace(false);
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
void LLPanelMediaSettingsGeneral::preApply()
{
- // Make sure the home URL entry is committed
- mHomeURL->onCommit();
+ // Make sure the home URL entry is committed
+ mHomeURL->onCommit();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsGeneral::getValues( LLSD &fill_me_in, bool include_tentative )
{
- if (include_tentative || !mAutoLoop->getTentative()) fill_me_in[LLMediaEntry::AUTO_LOOP_KEY] = (LLSD::Boolean)mAutoLoop->getValue();
- if (include_tentative || !mAutoPlay->getTentative()) fill_me_in[LLMediaEntry::AUTO_PLAY_KEY] = (LLSD::Boolean)mAutoPlay->getValue();
- if (include_tentative || !mAutoScale->getTentative()) fill_me_in[LLMediaEntry::AUTO_SCALE_KEY] = (LLSD::Boolean)mAutoScale->getValue();
- if (include_tentative || !mAutoZoom->getTentative()) fill_me_in[LLMediaEntry::AUTO_ZOOM_KEY] = (LLSD::Boolean)mAutoZoom->getValue();
- //Don't fill in current URL: this is only supposed to get changed via navigate
- // if (include_tentative || !mCurrentURL->getTentative()) fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue();
- if (include_tentative || !mHeightPixels->getTentative()) fill_me_in[LLMediaEntry::HEIGHT_PIXELS_KEY] = (LLSD::Integer)mHeightPixels->getValue();
- // Don't fill in the home URL if it is the special "Multiple Media" string!
- if ((include_tentative || !mHomeURL->getTentative())
- && LLTrans::getString("Multiple Media") != mHomeURL->getValue())
- fill_me_in[LLMediaEntry::HOME_URL_KEY] = (LLSD::String)mHomeURL->getValue();
- if (include_tentative || !mFirstClick->getTentative()) fill_me_in[LLMediaEntry::FIRST_CLICK_INTERACT_KEY] = (LLSD::Boolean)mFirstClick->getValue();
- if (include_tentative || !mWidthPixels->getTentative()) fill_me_in[LLMediaEntry::WIDTH_PIXELS_KEY] = (LLSD::Integer)mWidthPixels->getValue();
+ if (include_tentative || !mAutoLoop->getTentative()) fill_me_in[LLMediaEntry::AUTO_LOOP_KEY] = (LLSD::Boolean)mAutoLoop->getValue();
+ if (include_tentative || !mAutoPlay->getTentative()) fill_me_in[LLMediaEntry::AUTO_PLAY_KEY] = (LLSD::Boolean)mAutoPlay->getValue();
+ if (include_tentative || !mAutoScale->getTentative()) fill_me_in[LLMediaEntry::AUTO_SCALE_KEY] = (LLSD::Boolean)mAutoScale->getValue();
+ if (include_tentative || !mAutoZoom->getTentative()) fill_me_in[LLMediaEntry::AUTO_ZOOM_KEY] = (LLSD::Boolean)mAutoZoom->getValue();
+ //Don't fill in current URL: this is only supposed to get changed via navigate
+ // if (include_tentative || !mCurrentURL->getTentative()) fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue();
+ if (include_tentative || !mHeightPixels->getTentative()) fill_me_in[LLMediaEntry::HEIGHT_PIXELS_KEY] = (LLSD::Integer)mHeightPixels->getValue();
+ // Don't fill in the home URL if it is the special "Multiple Media" string!
+ if ((include_tentative || !mHomeURL->getTentative())
+ && LLTrans::getString("Multiple Media") != mHomeURL->getValue())
+ fill_me_in[LLMediaEntry::HOME_URL_KEY] = (LLSD::String)mHomeURL->getValue();
+ if (include_tentative || !mFirstClick->getTentative()) fill_me_in[LLMediaEntry::FIRST_CLICK_INTERACT_KEY] = (LLSD::Boolean)mFirstClick->getValue();
+ if (include_tentative || !mWidthPixels->getTentative()) fill_me_in[LLMediaEntry::WIDTH_PIXELS_KEY] = (LLSD::Integer)mWidthPixels->getValue();
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
void LLPanelMediaSettingsGeneral::postApply()
-{
- // Make sure to navigate to the home URL if the current URL is empty and
- // autoplay is on
- navigateHomeSelectedFace(true);
+{
+ // Make sure to navigate to the home URL if the current URL is empty and
+ // autoplay is on
+ navigateHomeSelectedFace(true);
}
@@ -432,27 +432,27 @@ void LLPanelMediaSettingsGeneral::postApply()
//
void LLPanelMediaSettingsGeneral::setParent( LLFloaterMediaSettings* parent )
{
- mParent = parent;
+ mParent = parent;
};
////////////////////////////////////////////////////////////////////////////////
//
bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace(bool only_if_current_is_empty)
{
- struct functor_navigate_media : public LLSelectedTEGetFunctor< bool>
- {
- functor_navigate_media(bool flag) : only_if_current_is_empty(flag) {}
- bool get( LLViewerObject* object, S32 face )
- {
- if ( object && object->getTE(face) && object->permModify() )
- {
- const LLMediaEntry *media_data = object->getTE(face)->getMediaData();
- if ( media_data )
- {
- if (!only_if_current_is_empty || (media_data->getCurrentURL().empty() && media_data->getAutoPlay()))
- {
- viewer_media_t media_impl =
- LLViewerMedia::getInstance()->getMediaImplFromTextureID(object->getTE(face)->getMediaData()->getMediaID());
+ struct functor_navigate_media : public LLSelectedTEGetFunctor< bool>
+ {
+ functor_navigate_media(bool flag) : only_if_current_is_empty(flag) {}
+ bool get( LLViewerObject* object, S32 face )
+ {
+ if ( object && object->getTE(face) && object->permModify() )
+ {
+ const LLMediaEntry *media_data = object->getTE(face)->getMediaData();
+ if ( media_data )
+ {
+ if (!only_if_current_is_empty || (media_data->getCurrentURL().empty() && media_data->getAutoPlay()))
+ {
+ viewer_media_t media_impl =
+ LLViewerMedia::getInstance()->getMediaImplFromTextureID(object->getTE(face)->getMediaData()->getMediaID());
if (media_impl)
{
media_impl->setPriority(LLPluginClassMedia::PRIORITY_NORMAL);
@@ -464,21 +464,21 @@ bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace(bool only_if_current_
media_data[LLMediaEntry::CURRENT_URL_KEY] = std::string();
object->getTE(face)->mergeIntoMediaData(media_data);
}
- return true;
- }
- }
- }
- }
- return false;
- };
- bool only_if_current_is_empty;
-
- } functor_navigate_media(only_if_current_is_empty);
-
- bool all_face_media_navigated = false;
- LLObjectSelectionHandle selected_objects =LLSelectMgr::getInstance()->getSelection();
- selected_objects->getSelectedTEValue( &functor_navigate_media, all_face_media_navigated );
-
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ };
+ bool only_if_current_is_empty;
+
+ } functor_navigate_media(only_if_current_is_empty);
+
+ bool all_face_media_navigated = false;
+ LLObjectSelectionHandle selected_objects =LLSelectMgr::getInstance()->getSelection();
+ selected_objects->getSelectedTEValue( &functor_navigate_media, all_face_media_navigated );
+
if (all_face_media_navigated)
{
struct functor_sync_to_server : public LLSelectedObjectFunctor
@@ -496,47 +496,47 @@ bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace(bool only_if_current_
selected_objects->applyToObjects(&sendfunc);
}
- // Note: we don't update the 'current URL' field until the media data itself changes
+ // Note: we don't update the 'current URL' field until the media data itself changes
- return all_face_media_navigated;
+ return all_face_media_navigated;
}
////////////////////////////////////////////////////////////////////////////////
//
const std::string LLPanelMediaSettingsGeneral::getHomeUrl()
{
- return mHomeURL->getValue().asString();
+ return mHomeURL->getValue().asString();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsGeneral::updateCurrentUrl()
{
- // Get the current URL from the selection
- const LLMediaEntry default_media_data;
- std::string value_str = default_media_data.getCurrentURL();
- struct functor_getter_current_url : public LLSelectedTEGetFunctor< std::string >
- {
- functor_getter_current_url(const LLMediaEntry& entry): mMediaEntry(entry) {}
-
- std::string get( LLViewerObject* object, S32 face )
- {
- if ( object )
- if ( object->getTE(face) )
- if ( object->getTE(face)->getMediaData() )
- return object->getTE(face)->getMediaData()->getCurrentURL();
- return mMediaEntry.getCurrentURL();
- };
-
- const LLMediaEntry & mMediaEntry;
-
- } func_current_url(default_media_data);
- bool identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_current_url, value_str );
- mCurrentURL->setText(value_str);
- mCurrentURL->setTentative(identical);
-
- if ( LLPanelMediaSettingsGeneral::isMultiple() )
- {
- mCurrentURL->setText(LLTrans::getString("Multiple Media"));
- }
-}
+ // Get the current URL from the selection
+ const LLMediaEntry default_media_data;
+ std::string value_str = default_media_data.getCurrentURL();
+ struct functor_getter_current_url : public LLSelectedTEGetFunctor< std::string >
+ {
+ functor_getter_current_url(const LLMediaEntry& entry): mMediaEntry(entry) {}
+
+ std::string get( LLViewerObject* object, S32 face )
+ {
+ if ( object )
+ if ( object->getTE(face) )
+ if ( object->getTE(face)->getMediaData() )
+ return object->getTE(face)->getMediaData()->getCurrentURL();
+ return mMediaEntry.getCurrentURL();
+ };
+
+ const LLMediaEntry & mMediaEntry;
+
+ } func_current_url(default_media_data);
+ bool identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_current_url, value_str );
+ mCurrentURL->setText(value_str);
+ mCurrentURL->setTentative(identical);
+
+ if ( LLPanelMediaSettingsGeneral::isMultiple() )
+ {
+ mCurrentURL->setText(LLTrans::getString("Multiple Media"));
+ }
+}
diff --git a/indra/newview/llpanelmediasettingsgeneral.h b/indra/newview/llpanelmediasettingsgeneral.h
index 06793d91fc..10ce565800 100644
--- a/indra/newview/llpanelmediasettingsgeneral.h
+++ b/indra/newview/llpanelmediasettingsgeneral.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,60 +41,60 @@ class LLFloaterMediaSettings;
class LLPanelMediaSettingsGeneral : public LLPanel
{
public:
- LLPanelMediaSettingsGeneral();
- ~LLPanelMediaSettingsGeneral();
-
- // XXX TODO: put these into a common parent class?
- // Hook that the floater calls before applying changes from the panel
- void preApply();
- // Function that asks the panel to fill in values associated with the panel
- // 'include_tentative' means fill in tentative values as well, otherwise do not
- void getValues(LLSD &fill_me_in, bool include_tentative = true);
- // Hook that the floater calls after applying changes to the panel
- void postApply();
-
- BOOL postBuild();
- /*virtual*/ void draw();
- /*virtual*/ void onClose(bool app_quitting);
-
- void setParent( LLFloaterMediaSettings* parent );
- static void initValues( void* userdata, const LLSD& media_settings ,bool editable);
- static void clearValues( void* userdata, bool editable, bool update_preview = true);
-
- // Navigates the current selected face to the Home URL.
- // If 'only_if_current_is_empty' is "true", it only performs
- // the operation if: 1) the current URL is empty, and 2) auto play is true.
- bool navigateHomeSelectedFace(bool only_if_current_is_empty);
-
- void updateMediaPreview();
-
- const std::string getHomeUrl();
-
+ LLPanelMediaSettingsGeneral();
+ ~LLPanelMediaSettingsGeneral();
+
+ // XXX TODO: put these into a common parent class?
+ // Hook that the floater calls before applying changes from the panel
+ void preApply();
+ // Function that asks the panel to fill in values associated with the panel
+ // 'include_tentative' means fill in tentative values as well, otherwise do not
+ void getValues(LLSD &fill_me_in, bool include_tentative = true);
+ // Hook that the floater calls after applying changes to the panel
+ void postApply();
+
+ BOOL postBuild();
+ /*virtual*/ void draw();
+ /*virtual*/ void onClose(bool app_quitting);
+
+ void setParent( LLFloaterMediaSettings* parent );
+ static void initValues( void* userdata, const LLSD& media_settings ,bool editable);
+ static void clearValues( void* userdata, bool editable, bool update_preview = true);
+
+ // Navigates the current selected face to the Home URL.
+ // If 'only_if_current_is_empty' is "true", it only performs
+ // the operation if: 1) the current URL is empty, and 2) auto play is true.
+ bool navigateHomeSelectedFace(bool only_if_current_is_empty);
+
+ void updateMediaPreview();
+
+ const std::string getHomeUrl();
+
protected:
- LLFloaterMediaSettings* mParent;
- bool mMediaEditable;
+ LLFloaterMediaSettings* mParent;
+ bool mMediaEditable;
private:
- void updateCurrentUrl();
-
- static void onBtnResetCurrentUrl(LLUICtrl* ctrl, void *userdata);
- static void onCommitHomeURL(LLUICtrl* ctrl, void *userdata );
-
- static bool isMultiple();
-
- void checkHomeUrlPassesWhitelist();
-
- LLCheckBoxCtrl* mAutoLoop;
- LLCheckBoxCtrl* mFirstClick;
- LLCheckBoxCtrl* mAutoZoom;
- LLCheckBoxCtrl* mAutoPlay;
- LLCheckBoxCtrl* mAutoScale;
- LLSpinCtrl* mWidthPixels;
- LLSpinCtrl* mHeightPixels;
- LLLineEditor* mHomeURL;
- LLTextBox* mCurrentURL;
- LLMediaCtrl* mPreviewMedia;
- LLTextBox* mFailWhiteListText;
+ void updateCurrentUrl();
+
+ static void onBtnResetCurrentUrl(LLUICtrl* ctrl, void *userdata);
+ static void onCommitHomeURL(LLUICtrl* ctrl, void *userdata );
+
+ static bool isMultiple();
+
+ void checkHomeUrlPassesWhitelist();
+
+ LLCheckBoxCtrl* mAutoLoop;
+ LLCheckBoxCtrl* mFirstClick;
+ LLCheckBoxCtrl* mAutoZoom;
+ LLCheckBoxCtrl* mAutoPlay;
+ LLCheckBoxCtrl* mAutoScale;
+ LLSpinCtrl* mWidthPixels;
+ LLSpinCtrl* mHeightPixels;
+ LLLineEditor* mHomeURL;
+ LLTextBox* mCurrentURL;
+ LLMediaCtrl* mPreviewMedia;
+ LLTextBox* mFailWhiteListText;
};
#endif // LL_LLPANELMEDIAMEDIASETTINGSGENERAL_H
diff --git a/indra/newview/llpanelmediasettingspermissions.cpp b/indra/newview/llpanelmediasettingspermissions.cpp
index cb0b7789ff..437bd2816e 100644
--- a/indra/newview/llpanelmediasettingspermissions.cpp
+++ b/indra/newview/llpanelmediasettingspermissions.cpp
@@ -3,27 +3,27 @@
* @brief LLPanelMediaSettingsPermissions class implementation
*
* note that "permissions" tab is really "Controls" tab - refs to 'perms' and
- * 'permissions' not changed to 'controls' since we don't want to change
+ * 'permissions' not changed to 'controls' since we don't want to change
* shared files in server code and keeping everything the same seemed best.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,10 +49,10 @@
////////////////////////////////////////////////////////////////////////////////
//
LLPanelMediaSettingsPermissions::LLPanelMediaSettingsPermissions() :
- mControls( NULL ),
+ mControls( NULL ),
mPermsOwnerInteract( 0 ),
mPermsOwnerControl( 0 ),
- mPermsGroupName( 0 ),
+ mPermsGroupName( 0 ),
mPermsGroupInteract( 0 ),
mPermsGroupControl( 0 ),
mPermsWorldInteract( 0 ),
@@ -67,7 +67,7 @@ LLPanelMediaSettingsPermissions::LLPanelMediaSettingsPermissions() :
BOOL LLPanelMediaSettingsPermissions::postBuild()
{
// connect member vars with UI widgets
- mControls = getChild< LLComboBox >( LLMediaEntry::CONTROLS_KEY );
+ mControls = getChild< LLComboBox >( LLMediaEntry::CONTROLS_KEY );
mPermsOwnerInteract = getChild< LLCheckBoxCtrl >( LLPanelContents::PERMS_OWNER_INTERACT_KEY );
mPermsOwnerControl = getChild< LLCheckBoxCtrl >( LLPanelContents::PERMS_OWNER_CONTROL_KEY );
mPermsGroupInteract = getChild< LLCheckBoxCtrl >( LLPanelContents::PERMS_GROUP_INTERACT_KEY );
@@ -75,7 +75,7 @@ BOOL LLPanelMediaSettingsPermissions::postBuild()
mPermsWorldInteract = getChild< LLCheckBoxCtrl >( LLPanelContents::PERMS_ANYONE_INTERACT_KEY );
mPermsWorldControl = getChild< LLCheckBoxCtrl >( LLPanelContents::PERMS_ANYONE_CONTROL_KEY );
- mPermsGroupName = getChild< LLNameBox >( "perms_group_name" );
+ mPermsGroupName = getChild< LLNameBox >( "perms_group_name" );
return true;
}
@@ -90,75 +90,75 @@ LLPanelMediaSettingsPermissions::~LLPanelMediaSettingsPermissions()
// virtual
void LLPanelMediaSettingsPermissions::draw()
{
- // housekeeping
- LLPanel::draw();
+ // housekeeping
+ LLPanel::draw();
- getChild<LLUICtrl>("perms_group_name")->setValue(LLStringUtil::null);
- LLUUID group_id;
- BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
- if (groups_identical)
- {
- if(mPermsGroupName)
- {
- mPermsGroupName->setNameID(group_id, true);
- }
- }
- else
- {
- if(mPermsGroupName)
- {
- mPermsGroupName->setNameID(LLUUID::null, TRUE);
- mPermsGroupName->refresh(LLUUID::null, std::string(), true);
- }
- }
+ getChild<LLUICtrl>("perms_group_name")->setValue(LLStringUtil::null);
+ LLUUID group_id;
+ BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
+ if (groups_identical)
+ {
+ if(mPermsGroupName)
+ {
+ mPermsGroupName->setNameID(group_id, true);
+ }
+ }
+ else
+ {
+ if(mPermsGroupName)
+ {
+ mPermsGroupName->setNameID(LLUUID::null, TRUE);
+ mPermsGroupName->refresh(LLUUID::null, std::string(), true);
+ }
+ }
}
////////////////////////////////////////////////////////////////////////////////
-// static
+// static
void LLPanelMediaSettingsPermissions::clearValues( void* userdata, bool editable)
-{
- LLPanelMediaSettingsPermissions *self =(LLPanelMediaSettingsPermissions *)userdata;
+{
+ LLPanelMediaSettingsPermissions *self =(LLPanelMediaSettingsPermissions *)userdata;
+
+ self->mControls->clear();
+ self->mPermsOwnerInteract->clear();
+ self->mPermsOwnerControl->clear();
+ self->mPermsGroupInteract->clear();
+ self->mPermsGroupControl->clear();
+ self->mPermsWorldInteract->clear();
+ self->mPermsWorldControl->clear();
- self->mControls->clear();
- self->mPermsOwnerInteract->clear();
- self->mPermsOwnerControl->clear();
- self->mPermsGroupInteract->clear();
- self->mPermsGroupControl->clear();
- self->mPermsWorldInteract->clear();
- self->mPermsWorldControl->clear();
-
- self->mControls->setEnabled(editable);
- self->mPermsOwnerInteract->setEnabled(editable);
- self->mPermsOwnerControl->setEnabled(editable);
- self->mPermsGroupInteract->setEnabled(editable);
- self->mPermsGroupControl->setEnabled(editable);
- self->mPermsWorldInteract->setEnabled(editable);
- self->mPermsWorldControl->setEnabled(editable);
+ self->mControls->setEnabled(editable);
+ self->mPermsOwnerInteract->setEnabled(editable);
+ self->mPermsOwnerControl->setEnabled(editable);
+ self->mPermsGroupInteract->setEnabled(editable);
+ self->mPermsGroupControl->setEnabled(editable);
+ self->mPermsWorldInteract->setEnabled(editable);
+ self->mPermsWorldControl->setEnabled(editable);
- self->getChild< LLTextBox >("controls_label")->setEnabled(editable);
- self->getChild< LLTextBox >("owner_label")->setEnabled(editable);
- self->getChild< LLTextBox >("group_label")->setEnabled(editable);
- self->getChild< LLNameBox >("perms_group_name")->setEnabled(editable);
- self->getChild< LLTextBox >("anyone_label")->setEnabled(editable);
+ self->getChild< LLTextBox >("controls_label")->setEnabled(editable);
+ self->getChild< LLTextBox >("owner_label")->setEnabled(editable);
+ self->getChild< LLTextBox >("group_label")->setEnabled(editable);
+ self->getChild< LLNameBox >("perms_group_name")->setEnabled(editable);
+ self->getChild< LLTextBox >("anyone_label")->setEnabled(editable);
}
////////////////////////////////////////////////////////////////////////////////
-// static
+// static
void LLPanelMediaSettingsPermissions::initValues( void* userdata, const LLSD& media_settings , bool editable)
{
LLPanelMediaSettingsPermissions *self =(LLPanelMediaSettingsPermissions *)userdata;
std::string base_key( "" );
std::string tentative_key( "" );
- struct
+ struct
{
std::string key_name;
LLUICtrl* ctrl_ptr;
std::string ctrl_type;
- } data_set [] =
- {
- { LLMediaEntry::CONTROLS_KEY, self->mControls, "LLComboBox" },
+ } data_set [] =
+ {
+ { LLMediaEntry::CONTROLS_KEY, self->mControls, "LLComboBox" },
{ LLPanelContents::PERMS_OWNER_INTERACT_KEY, self->mPermsOwnerInteract, "LLCheckBoxCtrl" },
{ LLPanelContents::PERMS_OWNER_CONTROL_KEY, self->mPermsOwnerControl, "LLCheckBoxCtrl" },
{ LLPanelContents::PERMS_GROUP_INTERACT_KEY, self->mPermsGroupInteract, "LLCheckBoxCtrl" },
@@ -178,8 +178,8 @@ void LLPanelMediaSettingsPermissions::initValues( void* userdata, const LLSD& me
{
if ( data_set[ i ].ctrl_type == "LLCheckBoxCtrl" )
{
- // Most recent change to the "sense" of these checkboxes
- // means the value in the checkbox matches that on the server
+ // Most recent change to the "sense" of these checkboxes
+ // means the value in the checkbox matches that on the server
static_cast< LLCheckBoxCtrl* >( data_set[ i ].ctrl_ptr )->
setValue( media_settings[ base_key ].asBoolean() );
}
@@ -188,41 +188,41 @@ void LLPanelMediaSettingsPermissions::initValues( void* userdata, const LLSD& me
static_cast< LLComboBox* >( data_set[ i ].ctrl_ptr )->
setCurrentByIndex( media_settings[ base_key ].asInteger() );
- data_set[ i ].ctrl_ptr->setEnabled(editable);
+ data_set[ i ].ctrl_ptr->setEnabled(editable);
data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );
};
};
- // *NOTE: If any of a particular flavor is tentative, we have to disable
- // them all because of an architectural issue: namely that we represent
- // these as a bit field, and we can't selectively apply only one bit to all selected
- // faces if they don't match. Also see the *NOTE below.
- if ( self->mPermsOwnerInteract->getTentative() ||
- self->mPermsGroupInteract->getTentative() ||
- self->mPermsWorldInteract->getTentative())
- {
- self->mPermsOwnerInteract->setEnabled(false);
- self->mPermsGroupInteract->setEnabled(false);
- self->mPermsWorldInteract->setEnabled(false);
- }
- if ( self->mPermsOwnerControl->getTentative() ||
- self->mPermsGroupControl->getTentative() ||
- self->mPermsWorldControl->getTentative())
- {
- self->mPermsOwnerControl->setEnabled(false);
- self->mPermsGroupControl->setEnabled(false);
- self->mPermsWorldControl->setEnabled(false);
- }
-
- self->getChild< LLTextBox >("controls_label")->setEnabled(editable);
- self->getChild< LLTextBox >("owner_label")->setEnabled(editable);
- self->getChild< LLTextBox >("group_label")->setEnabled(editable);
- self->getChild< LLNameBox >("perms_group_name")->setEnabled(editable);
- self->getChild< LLTextBox >("anyone_label")->setEnabled(editable);
+ // *NOTE: If any of a particular flavor is tentative, we have to disable
+ // them all because of an architectural issue: namely that we represent
+ // these as a bit field, and we can't selectively apply only one bit to all selected
+ // faces if they don't match. Also see the *NOTE below.
+ if ( self->mPermsOwnerInteract->getTentative() ||
+ self->mPermsGroupInteract->getTentative() ||
+ self->mPermsWorldInteract->getTentative())
+ {
+ self->mPermsOwnerInteract->setEnabled(false);
+ self->mPermsGroupInteract->setEnabled(false);
+ self->mPermsWorldInteract->setEnabled(false);
+ }
+ if ( self->mPermsOwnerControl->getTentative() ||
+ self->mPermsGroupControl->getTentative() ||
+ self->mPermsWorldControl->getTentative())
+ {
+ self->mPermsOwnerControl->setEnabled(false);
+ self->mPermsGroupControl->setEnabled(false);
+ self->mPermsWorldControl->setEnabled(false);
+ }
+
+ self->getChild< LLTextBox >("controls_label")->setEnabled(editable);
+ self->getChild< LLTextBox >("owner_label")->setEnabled(editable);
+ self->getChild< LLTextBox >("group_label")->setEnabled(editable);
+ self->getChild< LLNameBox >("perms_group_name")->setEnabled(editable);
+ self->getChild< LLTextBox >("anyone_label")->setEnabled(editable);
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
void LLPanelMediaSettingsPermissions::preApply()
{
// no-op
@@ -232,50 +232,50 @@ void LLPanelMediaSettingsPermissions::preApply()
//
void LLPanelMediaSettingsPermissions::getValues( LLSD &fill_me_in, bool include_tentative )
{
- // moved over from the 'General settings' tab
- if (include_tentative || !mControls->getTentative()) fill_me_in[LLMediaEntry::CONTROLS_KEY] = (LLSD::Integer)mControls->getCurrentIndex();
-
- // *NOTE: For some reason, gcc does not like these symbol references in the
- // expressions below (inside the static_casts). I have NO idea why :(.
- // For some reason, assigning them to const temp vars here fixes the link
- // error. Bizarre.
- const U8 none = LLMediaEntry::PERM_NONE;
- const U8 owner = LLMediaEntry::PERM_OWNER;
- const U8 group = LLMediaEntry::PERM_GROUP;
- const U8 anyone = LLMediaEntry::PERM_ANYONE;
- const LLSD::Integer control = static_cast<LLSD::Integer>(
- (mPermsOwnerControl->getValue() ? owner : none ) |
- (mPermsGroupControl->getValue() ? group: none ) |
- (mPermsWorldControl->getValue() ? anyone : none ));
- const LLSD::Integer interact = static_cast<LLSD::Integer>(
- (mPermsOwnerInteract->getValue() ? owner: none ) |
- (mPermsGroupInteract->getValue() ? group : none ) |
- (mPermsWorldInteract->getValue() ? anyone : none ));
-
- // *TODO: This will fill in the values of all permissions values, even if
- // one or more is tentative. This is not quite the user expectation...what
- // it should do is only change the bit that was made "untentative", but in
- // a multiple-selection situation, this isn't possible given the architecture
- // for how settings are applied.
- if (include_tentative ||
- !mPermsOwnerControl->getTentative() ||
- !mPermsGroupControl->getTentative() ||
- !mPermsWorldControl->getTentative())
- {
- fill_me_in[LLMediaEntry::PERMS_CONTROL_KEY] = control;
- }
- if (include_tentative ||
- !mPermsOwnerInteract->getTentative() ||
- !mPermsGroupInteract->getTentative() ||
- !mPermsWorldInteract->getTentative())
- {
- fill_me_in[LLMediaEntry::PERMS_INTERACT_KEY] = interact;
- }
+ // moved over from the 'General settings' tab
+ if (include_tentative || !mControls->getTentative()) fill_me_in[LLMediaEntry::CONTROLS_KEY] = (LLSD::Integer)mControls->getCurrentIndex();
+
+ // *NOTE: For some reason, gcc does not like these symbol references in the
+ // expressions below (inside the static_casts). I have NO idea why :(.
+ // For some reason, assigning them to const temp vars here fixes the link
+ // error. Bizarre.
+ const U8 none = LLMediaEntry::PERM_NONE;
+ const U8 owner = LLMediaEntry::PERM_OWNER;
+ const U8 group = LLMediaEntry::PERM_GROUP;
+ const U8 anyone = LLMediaEntry::PERM_ANYONE;
+ const LLSD::Integer control = static_cast<LLSD::Integer>(
+ (mPermsOwnerControl->getValue() ? owner : none ) |
+ (mPermsGroupControl->getValue() ? group: none ) |
+ (mPermsWorldControl->getValue() ? anyone : none ));
+ const LLSD::Integer interact = static_cast<LLSD::Integer>(
+ (mPermsOwnerInteract->getValue() ? owner: none ) |
+ (mPermsGroupInteract->getValue() ? group : none ) |
+ (mPermsWorldInteract->getValue() ? anyone : none ));
+
+ // *TODO: This will fill in the values of all permissions values, even if
+ // one or more is tentative. This is not quite the user expectation...what
+ // it should do is only change the bit that was made "untentative", but in
+ // a multiple-selection situation, this isn't possible given the architecture
+ // for how settings are applied.
+ if (include_tentative ||
+ !mPermsOwnerControl->getTentative() ||
+ !mPermsGroupControl->getTentative() ||
+ !mPermsWorldControl->getTentative())
+ {
+ fill_me_in[LLMediaEntry::PERMS_CONTROL_KEY] = control;
+ }
+ if (include_tentative ||
+ !mPermsOwnerInteract->getTentative() ||
+ !mPermsGroupInteract->getTentative() ||
+ !mPermsWorldInteract->getTentative())
+ {
+ fill_me_in[LLMediaEntry::PERMS_INTERACT_KEY] = interact;
+ }
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
void LLPanelMediaSettingsPermissions::postApply()
{
// no-op
diff --git a/indra/newview/llpanelmediasettingspermissions.h b/indra/newview/llpanelmediasettingspermissions.h
index f976720180..707c5af61d 100644
--- a/indra/newview/llpanelmediasettingspermissions.h
+++ b/indra/newview/llpanelmediasettingspermissions.h
@@ -3,27 +3,27 @@
* @brief LLPanelMediaSettingsPermissions class definition
*
* note that "permissions" tab is really "Controls" tab - refs to 'perms' and
- * 'permissions' not changed to 'controls' since we don't want to change
+ * 'permissions' not changed to 'controls' since we don't want to change
* shared files in server code and keeping everything the same seemed best.
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,33 +41,33 @@ class LLNameBox;
class LLPanelMediaSettingsPermissions : public LLPanel
{
public:
- LLPanelMediaSettingsPermissions();
- ~LLPanelMediaSettingsPermissions();
-
- BOOL postBuild();
- virtual void draw();
-
- // XXX TODO: put these into a common parent class?
- // Hook that the floater calls before applying changes from the panel
- void preApply();
- // Function that asks the panel to fill in values associated with the panel
- // 'include_tentative' means fill in tentative values as well, otherwise do not
- void getValues(LLSD &fill_me_in, bool include_tentative = true);
- // Hook that the floater calls after applying changes to the panel
- void postApply();
-
- static void initValues( void* userdata, const LLSD& media_settings, bool editable );
- static void clearValues( void* userdata, bool editable);
-
+ LLPanelMediaSettingsPermissions();
+ ~LLPanelMediaSettingsPermissions();
+
+ BOOL postBuild();
+ virtual void draw();
+
+ // XXX TODO: put these into a common parent class?
+ // Hook that the floater calls before applying changes from the panel
+ void preApply();
+ // Function that asks the panel to fill in values associated with the panel
+ // 'include_tentative' means fill in tentative values as well, otherwise do not
+ void getValues(LLSD &fill_me_in, bool include_tentative = true);
+ // Hook that the floater calls after applying changes to the panel
+ void postApply();
+
+ static void initValues( void* userdata, const LLSD& media_settings, bool editable );
+ static void clearValues( void* userdata, bool editable);
+
private:
- LLComboBox* mControls;
- LLCheckBoxCtrl* mPermsOwnerInteract;
- LLCheckBoxCtrl* mPermsOwnerControl;
- LLNameBox* mPermsGroupName;
- LLCheckBoxCtrl* mPermsGroupInteract;
- LLCheckBoxCtrl* mPermsGroupControl;
- LLCheckBoxCtrl* mPermsWorldInteract;
- LLCheckBoxCtrl* mPermsWorldControl;
+ LLComboBox* mControls;
+ LLCheckBoxCtrl* mPermsOwnerInteract;
+ LLCheckBoxCtrl* mPermsOwnerControl;
+ LLNameBox* mPermsGroupName;
+ LLCheckBoxCtrl* mPermsGroupInteract;
+ LLCheckBoxCtrl* mPermsGroupControl;
+ LLCheckBoxCtrl* mPermsWorldInteract;
+ LLCheckBoxCtrl* mPermsWorldControl;
};
#endif // LL_LLPANELMEDIAMEDIASETTINGSPERMISSIONS_H
diff --git a/indra/newview/llpanelmediasettingssecurity.cpp b/indra/newview/llpanelmediasettingssecurity.cpp
index b588e8f930..96ec1b17eb 100644
--- a/indra/newview/llpanelmediasettingssecurity.cpp
+++ b/indra/newview/llpanelmediasettingssecurity.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,26 +47,26 @@
////////////////////////////////////////////////////////////////////////////////
//
LLPanelMediaSettingsSecurity::LLPanelMediaSettingsSecurity() :
- mParent( NULL )
+ mParent( NULL )
{
- mCommitCallbackRegistrar.add("Media.whitelistAdd", boost::bind(&LLPanelMediaSettingsSecurity::onBtnAdd, this));
- mCommitCallbackRegistrar.add("Media.whitelistDelete", boost::bind(&LLPanelMediaSettingsSecurity::onBtnDel, this));
+ mCommitCallbackRegistrar.add("Media.whitelistAdd", boost::bind(&LLPanelMediaSettingsSecurity::onBtnAdd, this));
+ mCommitCallbackRegistrar.add("Media.whitelistDelete", boost::bind(&LLPanelMediaSettingsSecurity::onBtnDel, this));
- // build dialog from XML
- buildFromFile( "panel_media_settings_security.xml");
+ // build dialog from XML
+ buildFromFile( "panel_media_settings_security.xml");
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLPanelMediaSettingsSecurity::postBuild()
{
- mEnableWhiteList = getChild< LLCheckBoxCtrl >( LLMediaEntry::WHITELIST_ENABLE_KEY );
- mWhiteListList = getChild< LLScrollListCtrl >( LLMediaEntry::WHITELIST_KEY );
- mHomeUrlFailsWhiteListText = getChild<LLTextBox>( "home_url_fails_whitelist" );
-
- setDefaultBtn("whitelist_add");
+ mEnableWhiteList = getChild< LLCheckBoxCtrl >( LLMediaEntry::WHITELIST_ENABLE_KEY );
+ mWhiteListList = getChild< LLScrollListCtrl >( LLMediaEntry::WHITELIST_KEY );
+ mHomeUrlFailsWhiteListText = getChild<LLTextBox>( "home_url_fails_whitelist" );
+
+ setDefaultBtn("whitelist_add");
- return true;
+ return true;
}
////////////////////////////////////////////////////////////////////////////////
@@ -76,138 +76,138 @@ LLPanelMediaSettingsSecurity::~LLPanelMediaSettingsSecurity()
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
void LLPanelMediaSettingsSecurity::draw()
{
- // housekeeping
- LLPanel::draw();
+ // housekeeping
+ LLPanel::draw();
}
////////////////////////////////////////////////////////////////////////////////
-// static
+// static
void LLPanelMediaSettingsSecurity::initValues( void* userdata, const LLSD& media_settings , bool editable)
{
- LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
- std::string base_key( "" );
- std::string tentative_key( "" );
-
- struct
- {
- std::string key_name;
- LLUICtrl* ctrl_ptr;
- std::string ctrl_type;
-
- } data_set [] =
- {
- { LLMediaEntry::WHITELIST_ENABLE_KEY, self->mEnableWhiteList, "LLCheckBoxCtrl" },
- { LLMediaEntry::WHITELIST_KEY, self->mWhiteListList, "LLScrollListCtrl" },
- { "", NULL , "" }
- };
-
- for( int i = 0; data_set[ i ].key_name.length() > 0; ++i )
- {
- base_key = std::string( data_set[ i ].key_name );
+ LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
+ std::string base_key( "" );
+ std::string tentative_key( "" );
+
+ struct
+ {
+ std::string key_name;
+ LLUICtrl* ctrl_ptr;
+ std::string ctrl_type;
+
+ } data_set [] =
+ {
+ { LLMediaEntry::WHITELIST_ENABLE_KEY, self->mEnableWhiteList, "LLCheckBoxCtrl" },
+ { LLMediaEntry::WHITELIST_KEY, self->mWhiteListList, "LLScrollListCtrl" },
+ { "", NULL , "" }
+ };
+
+ for( int i = 0; data_set[ i ].key_name.length() > 0; ++i )
+ {
+ base_key = std::string( data_set[ i ].key_name );
tentative_key = base_key + std::string( LLPanelContents::TENTATIVE_SUFFIX );
- bool enabled_overridden = false;
-
- // TODO: CP - I bet there is a better way to do this using Boost
- if ( media_settings[ base_key ].isDefined() )
- {
- if ( data_set[ i ].ctrl_type == "LLCheckBoxCtrl" )
- {
- static_cast< LLCheckBoxCtrl* >( data_set[ i ].ctrl_ptr )->
- setValue( media_settings[ base_key ].asBoolean() );
- }
- else
- if ( data_set[ i ].ctrl_type == "LLScrollListCtrl" )
- {
- // get control
- LLScrollListCtrl* list = static_cast< LLScrollListCtrl* >( data_set[ i ].ctrl_ptr );
- list->deleteAllItems();
-
- // points to list of white list URLs
- LLSD url_list = media_settings[ base_key ];
-
- // better be the whitelist
- llassert(data_set[ i ].ctrl_ptr == self->mWhiteListList);
-
- // If tentative, don't add entries
- if (media_settings[ tentative_key ].asBoolean())
- {
- self->mWhiteListList->setEnabled(false);
- enabled_overridden = true;
- }
- else {
- // iterate over them and add to scroll list
- LLSD::array_iterator iter = url_list.beginArray();
- while( iter != url_list.endArray() )
- {
- std::string entry = *iter;
- self->addWhiteListEntry( entry );
- ++iter;
- }
- }
- };
- if ( ! enabled_overridden) data_set[ i ].ctrl_ptr->setEnabled(editable);
- data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );
- };
- };
-
- // initial update - hides/shows status messages etc.
- self->updateWhitelistEnableStatus();
+ bool enabled_overridden = false;
+
+ // TODO: CP - I bet there is a better way to do this using Boost
+ if ( media_settings[ base_key ].isDefined() )
+ {
+ if ( data_set[ i ].ctrl_type == "LLCheckBoxCtrl" )
+ {
+ static_cast< LLCheckBoxCtrl* >( data_set[ i ].ctrl_ptr )->
+ setValue( media_settings[ base_key ].asBoolean() );
+ }
+ else
+ if ( data_set[ i ].ctrl_type == "LLScrollListCtrl" )
+ {
+ // get control
+ LLScrollListCtrl* list = static_cast< LLScrollListCtrl* >( data_set[ i ].ctrl_ptr );
+ list->deleteAllItems();
+
+ // points to list of white list URLs
+ LLSD url_list = media_settings[ base_key ];
+
+ // better be the whitelist
+ llassert(data_set[ i ].ctrl_ptr == self->mWhiteListList);
+
+ // If tentative, don't add entries
+ if (media_settings[ tentative_key ].asBoolean())
+ {
+ self->mWhiteListList->setEnabled(false);
+ enabled_overridden = true;
+ }
+ else {
+ // iterate over them and add to scroll list
+ LLSD::array_iterator iter = url_list.beginArray();
+ while( iter != url_list.endArray() )
+ {
+ std::string entry = *iter;
+ self->addWhiteListEntry( entry );
+ ++iter;
+ }
+ }
+ };
+ if ( ! enabled_overridden) data_set[ i ].ctrl_ptr->setEnabled(editable);
+ data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );
+ };
+ };
+
+ // initial update - hides/shows status messages etc.
+ self->updateWhitelistEnableStatus();
}
////////////////////////////////////////////////////////////////////////////////
-// static
+// static
void LLPanelMediaSettingsSecurity::clearValues( void* userdata , bool editable)
{
- LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
- self->mEnableWhiteList->clear();
- self->mWhiteListList->deleteAllItems();
- self->mEnableWhiteList->setEnabled(editable);
- self->mWhiteListList->setEnabled(editable);
+ LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
+ self->mEnableWhiteList->clear();
+ self->mWhiteListList->deleteAllItems();
+ self->mEnableWhiteList->setEnabled(editable);
+ self->mWhiteListList->setEnabled(editable);
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
void LLPanelMediaSettingsSecurity::preApply()
{
- // no-op
+ // no-op
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in, bool include_tentative )
{
- if (include_tentative || !mEnableWhiteList->getTentative())
- fill_me_in[LLMediaEntry::WHITELIST_ENABLE_KEY] = (LLSD::Boolean)mEnableWhiteList->getValue();
-
- if (include_tentative || !mWhiteListList->getTentative())
- {
- // iterate over white list and extract items
- std::vector< LLScrollListItem* > whitelist_items = mWhiteListList->getAllData();
- std::vector< LLScrollListItem* >::iterator iter = whitelist_items.begin();
-
- // *NOTE: need actually set the key to be an emptyArray(), or the merge
- // we do with this LLSD will think there's nothing to change.
- fill_me_in[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
- while( iter != whitelist_items.end() )
- {
- LLScrollListCell* cell = (*iter)->getColumn( ENTRY_COLUMN );
- std::string whitelist_url = cell->getValue().asString();
-
- fill_me_in[ LLMediaEntry::WHITELIST_KEY ].append( whitelist_url );
- ++iter;
- };
- }
+ if (include_tentative || !mEnableWhiteList->getTentative())
+ fill_me_in[LLMediaEntry::WHITELIST_ENABLE_KEY] = (LLSD::Boolean)mEnableWhiteList->getValue();
+
+ if (include_tentative || !mWhiteListList->getTentative())
+ {
+ // iterate over white list and extract items
+ std::vector< LLScrollListItem* > whitelist_items = mWhiteListList->getAllData();
+ std::vector< LLScrollListItem* >::iterator iter = whitelist_items.begin();
+
+ // *NOTE: need actually set the key to be an emptyArray(), or the merge
+ // we do with this LLSD will think there's nothing to change.
+ fill_me_in[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
+ while( iter != whitelist_items.end() )
+ {
+ LLScrollListCell* cell = (*iter)->getColumn( ENTRY_COLUMN );
+ std::string whitelist_url = cell->getValue().asString();
+
+ fill_me_in[ LLMediaEntry::WHITELIST_KEY ].append( whitelist_url );
+ ++iter;
+ };
+ }
}
////////////////////////////////////////////////////////////////////////////////
-//
+//
void LLPanelMediaSettingsSecurity::postApply()
{
- // no-op
+ // no-op
}
///////////////////////////////////////////////////////////////////////////////
@@ -215,77 +215,77 @@ void LLPanelMediaSettingsSecurity::postApply()
// white list list box widget and build a list to test against. Can also
const std::string LLPanelMediaSettingsSecurity::makeValidUrl( const std::string& src_url )
{
- // use LLURI to determine if we have a valid scheme
- LLURI candidate_url( src_url );
- if ( candidate_url.scheme().empty() )
- {
- // build a URL comprised of default scheme and the original fragment
- const std::string default_scheme( "http://" );
- return default_scheme + src_url;
- };
-
- // we *could* test the "default scheme" + "original fragment" URL again
- // using LLURI to see if it's valid but I think the outcome is the same
- // in either case - our only option is to return the original URL
-
- // we *think* the original url passed in was valid
- return src_url;
+ // use LLURI to determine if we have a valid scheme
+ LLURI candidate_url( src_url );
+ if ( candidate_url.scheme().empty() )
+ {
+ // build a URL comprised of default scheme and the original fragment
+ const std::string default_scheme( "http://" );
+ return default_scheme + src_url;
+ };
+
+ // we *could* test the "default scheme" + "original fragment" URL again
+ // using LLURI to see if it's valid but I think the outcome is the same
+ // in either case - our only option is to return the original URL
+
+ // we *think* the original url passed in was valid
+ return src_url;
}
///////////////////////////////////////////////////////////////////////////////
// wrapper for testing a URL against the whitelist. We grab entries from
-// white list list box widget and build a list to test against.
+// white list list box widget and build a list to test against.
bool LLPanelMediaSettingsSecurity::urlPassesWhiteList( const std::string& test_url )
{
- // If the whitlelist list is tentative, it means we have multiple settings.
- // In that case, we have no choice but to return true
- if ( mWhiteListList->getTentative() ) return true;
-
- // the checkUrlAgainstWhitelist(..) function works on a vector
- // of strings for the white list entries - in this panel, the white list
- // is stored in the widgets themselves so we need to build something compatible.
- std::vector< std::string > whitelist_strings;
- whitelist_strings.clear(); // may not be required - I forget what the spec says.
-
- // step through whitelist widget entries and grab them as strings
+ // If the whitlelist list is tentative, it means we have multiple settings.
+ // In that case, we have no choice but to return true
+ if ( mWhiteListList->getTentative() ) return true;
+
+ // the checkUrlAgainstWhitelist(..) function works on a vector
+ // of strings for the white list entries - in this panel, the white list
+ // is stored in the widgets themselves so we need to build something compatible.
+ std::vector< std::string > whitelist_strings;
+ whitelist_strings.clear(); // may not be required - I forget what the spec says.
+
+ // step through whitelist widget entries and grab them as strings
std::vector< LLScrollListItem* > whitelist_items = mWhiteListList->getAllData();
- std::vector< LLScrollListItem* >::iterator iter = whitelist_items.begin();
- while( iter != whitelist_items.end() )
+ std::vector< LLScrollListItem* >::iterator iter = whitelist_items.begin();
+ while( iter != whitelist_items.end() )
{
- LLScrollListCell* cell = (*iter)->getColumn( ENTRY_COLUMN );
- std::string whitelist_url = cell->getValue().asString();
+ LLScrollListCell* cell = (*iter)->getColumn( ENTRY_COLUMN );
+ std::string whitelist_url = cell->getValue().asString();
- whitelist_strings.push_back( whitelist_url );
+ whitelist_strings.push_back( whitelist_url );
- ++iter;
+ ++iter;
};
- // possible the URL is just a fragment so we validize it
- const std::string valid_url = makeValidUrl( test_url );
+ // possible the URL is just a fragment so we validize it
+ const std::string valid_url = makeValidUrl( test_url );
- // indicate if the URL passes whitelist
- return LLMediaEntry::checkUrlAgainstWhitelist( valid_url, whitelist_strings );
+ // indicate if the URL passes whitelist
+ return LLMediaEntry::checkUrlAgainstWhitelist( valid_url, whitelist_strings );
}
///////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::updateWhitelistEnableStatus()
{
- // get the value for home URL and make it a valid URL
- const std::string valid_url = makeValidUrl( mParent->getHomeUrl() );
-
- // now check to see if the home url passes the whitelist in its entirity
- if ( urlPassesWhiteList( valid_url ) )
- {
- mEnableWhiteList->setEnabled( true );
- mHomeUrlFailsWhiteListText->setVisible( false );
- }
- else
- {
- mEnableWhiteList->set( false );
- mEnableWhiteList->setEnabled( false );
- mHomeUrlFailsWhiteListText->setVisible( true );
- };
+ // get the value for home URL and make it a valid URL
+ const std::string valid_url = makeValidUrl( mParent->getHomeUrl() );
+
+ // now check to see if the home url passes the whitelist in its entirity
+ if ( urlPassesWhiteList( valid_url ) )
+ {
+ mEnableWhiteList->setEnabled( true );
+ mHomeUrlFailsWhiteListText->setVisible( false );
+ }
+ else
+ {
+ mEnableWhiteList->set( false );
+ mEnableWhiteList->setEnabled( false );
+ mHomeUrlFailsWhiteListText->setVisible( true );
+ };
}
///////////////////////////////////////////////////////////////////////////////
@@ -293,64 +293,64 @@ void LLPanelMediaSettingsSecurity::updateWhitelistEnableStatus()
// home URL passes this entry or not using an icon
void LLPanelMediaSettingsSecurity::addWhiteListEntry( const std::string& entry )
{
- // grab the home url
- std::string home_url( "" );
- if ( mParent )
- home_url = mParent->getHomeUrl();
-
- // try to make a valid URL based on what the user entered - missing scheme for example
- const std::string valid_url = makeValidUrl( home_url );
-
- // check the home url against this single whitelist entry
- std::vector< std::string > whitelist_entries;
- whitelist_entries.push_back( entry );
- bool home_url_passes_entry = LLMediaEntry::checkUrlAgainstWhitelist( valid_url, whitelist_entries );
-
- // build an icon cell based on whether or not the home url pases it or not
- LLSD row;
- if ( home_url_passes_entry || home_url.empty() )
- {
- row[ "columns" ][ ICON_COLUMN ][ "type" ] = "icon";
- row[ "columns" ][ ICON_COLUMN ][ "value" ] = "";
- row[ "columns" ][ ICON_COLUMN ][ "width" ] = 20;
- }
- else
- {
- row[ "columns" ][ ICON_COLUMN ][ "type" ] = "icon";
- row[ "columns" ][ ICON_COLUMN ][ "value" ] = "Parcel_Exp_Color";
- row[ "columns" ][ ICON_COLUMN ][ "width" ] = 20;
- };
-
- // always add in the entry itself
- row[ "columns" ][ ENTRY_COLUMN ][ "type" ] = "text";
- row[ "columns" ][ ENTRY_COLUMN ][ "value" ] = entry;
-
- // add to the white list scroll box
- mWhiteListList->addElement( row );
+ // grab the home url
+ std::string home_url( "" );
+ if ( mParent )
+ home_url = mParent->getHomeUrl();
+
+ // try to make a valid URL based on what the user entered - missing scheme for example
+ const std::string valid_url = makeValidUrl( home_url );
+
+ // check the home url against this single whitelist entry
+ std::vector< std::string > whitelist_entries;
+ whitelist_entries.push_back( entry );
+ bool home_url_passes_entry = LLMediaEntry::checkUrlAgainstWhitelist( valid_url, whitelist_entries );
+
+ // build an icon cell based on whether or not the home url pases it or not
+ LLSD row;
+ if ( home_url_passes_entry || home_url.empty() )
+ {
+ row[ "columns" ][ ICON_COLUMN ][ "type" ] = "icon";
+ row[ "columns" ][ ICON_COLUMN ][ "value" ] = "";
+ row[ "columns" ][ ICON_COLUMN ][ "width" ] = 20;
+ }
+ else
+ {
+ row[ "columns" ][ ICON_COLUMN ][ "type" ] = "icon";
+ row[ "columns" ][ ICON_COLUMN ][ "value" ] = "Parcel_Exp_Color";
+ row[ "columns" ][ ICON_COLUMN ][ "width" ] = 20;
+ };
+
+ // always add in the entry itself
+ row[ "columns" ][ ENTRY_COLUMN ][ "type" ] = "text";
+ row[ "columns" ][ ENTRY_COLUMN ][ "value" ] = entry;
+
+ // add to the white list scroll box
+ mWhiteListList->addElement( row );
};
///////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::onBtnAdd( void* userdata )
{
- LLFloaterReg::showInstance("whitelist_entry");
+ LLFloaterReg::showInstance("whitelist_entry");
}
///////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::onBtnDel( void* userdata )
{
- LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
+ LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
- self->mWhiteListList->deleteSelectedItems();
+ self->mWhiteListList->deleteSelectedItems();
- // contents of whitelist changed so recheck it against home url
- self->updateWhitelistEnableStatus();
+ // contents of whitelist changed so recheck it against home url
+ self->updateWhitelistEnableStatus();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::setParent( LLFloaterMediaSettings* parent )
{
- mParent = parent;
+ mParent = parent;
};
diff --git a/indra/newview/llpanelmediasettingssecurity.h b/indra/newview/llpanelmediasettingssecurity.h
index fe8e843571..ecb4218e01 100644
--- a/indra/newview/llpanelmediasettingssecurity.h
+++ b/indra/newview/llpanelmediasettingssecurity.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,46 +37,46 @@ class LLFloaterMediaSettings;
class LLPanelMediaSettingsSecurity : public LLPanel
{
public:
- LLPanelMediaSettingsSecurity();
- ~LLPanelMediaSettingsSecurity();
-
- BOOL postBuild();
- virtual void draw();
-
- // XXX TODO: put these into a common parent class?
- // Hook that the floater calls before applying changes from the panel
- void preApply();
- // Function that asks the panel to fill in values associated with the panel
- // 'include_tentative' means fill in tentative values as well, otherwise do not
- void getValues(LLSD &fill_me_in, bool include_tentative = true);
- // Hook that the floater calls after applying changes to the panel
- void postApply();
-
- static void initValues( void* userdata, const LLSD& media_settings, bool editable);
- static void clearValues( void* userdata, bool editable);
- void addWhiteListEntry( const std::string& url );
- void setParent( LLFloaterMediaSettings* parent );
- bool urlPassesWhiteList( const std::string& test_url );
- const std::string makeValidUrl( const std::string& src_url );
+ LLPanelMediaSettingsSecurity();
+ ~LLPanelMediaSettingsSecurity();
- void updateWhitelistEnableStatus();
+ BOOL postBuild();
+ virtual void draw();
+
+ // XXX TODO: put these into a common parent class?
+ // Hook that the floater calls before applying changes from the panel
+ void preApply();
+ // Function that asks the panel to fill in values associated with the panel
+ // 'include_tentative' means fill in tentative values as well, otherwise do not
+ void getValues(LLSD &fill_me_in, bool include_tentative = true);
+ // Hook that the floater calls after applying changes to the panel
+ void postApply();
+
+ static void initValues( void* userdata, const LLSD& media_settings, bool editable);
+ static void clearValues( void* userdata, bool editable);
+ void addWhiteListEntry( const std::string& url );
+ void setParent( LLFloaterMediaSettings* parent );
+ bool urlPassesWhiteList( const std::string& test_url );
+ const std::string makeValidUrl( const std::string& src_url );
+
+ void updateWhitelistEnableStatus();
protected:
- LLFloaterMediaSettings* mParent;
-
+ LLFloaterMediaSettings* mParent;
+
private:
- enum ColumnIndex
- {
- ICON_COLUMN = 0,
- ENTRY_COLUMN = 1,
- };
+ enum ColumnIndex
+ {
+ ICON_COLUMN = 0,
+ ENTRY_COLUMN = 1,
+ };
- LLCheckBoxCtrl* mEnableWhiteList;
- LLScrollListCtrl* mWhiteListList;
- LLTextBox* mHomeUrlFailsWhiteListText;
+ LLCheckBoxCtrl* mEnableWhiteList;
+ LLScrollListCtrl* mWhiteListList;
+ LLTextBox* mHomeUrlFailsWhiteListText;
- static void onBtnAdd(void*);
- static void onBtnDel(void*);
+ static void onBtnAdd(void*);
+ static void onBtnDel(void*);
};
#endif // LL_LLPANELMEDIAMEDIASETTINGSSECURITY_H
diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp
index 3c3cd5d522..a46894988c 100644
--- a/indra/newview/llpanelnearbymedia.cpp
+++ b/indra/newview/llpanelnearbymedia.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelnearbymedia.cpp
* @brief Management interface for muting and controlling nearby media
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -72,12 +72,12 @@ static const LLUUID PARCEL_AUDIO_LIST_ITEM_UUID = LLUUID("DF4B020D-8A24-4B95-AB5
LLPanelNearByMedia::LLPanelNearByMedia()
-: mMediaList(NULL),
- mEnableAllCtrl(NULL),
- mAllMediaDisabled(false),
- mDebugInfoVisible(false),
- mParcelMediaItem(NULL),
- mParcelAudioItem(NULL)
+: mMediaList(NULL),
+ mEnableAllCtrl(NULL),
+ mAllMediaDisabled(false),
+ mDebugInfoVisible(false),
+ mParcelMediaItem(NULL),
+ mParcelAudioItem(NULL)
{
// This is just an initial value, mParcelAudioAutoStart does not affect ParcelMediaAutoPlayEnable
mParcelAudioAutoStart = gSavedSettings.getS32("ParcelMediaAutoPlayEnable") != 0
@@ -85,19 +85,19 @@ LLPanelNearByMedia::LLPanelNearByMedia()
gSavedSettings.getControl("ParcelMediaAutoPlayEnable")->getSignal()->connect(boost::bind(&LLPanelNearByMedia::handleMediaAutoPlayChanged, this, _2));
- mCommitCallbackRegistrar.add("MediaListCtrl.EnableAll", boost::bind(&LLPanelNearByMedia::onClickEnableAll, this));
- mCommitCallbackRegistrar.add("MediaListCtrl.DisableAll", boost::bind(&LLPanelNearByMedia::onClickDisableAll, this));
- mCommitCallbackRegistrar.add("MediaListCtrl.GoMediaPrefs", boost::bind(&LLPanelNearByMedia::onAdvancedButtonClick, this));
- mCommitCallbackRegistrar.add("MediaListCtrl.MoreLess", boost::bind(&LLPanelNearByMedia::onMoreLess, this));
- mCommitCallbackRegistrar.add("SelectedMediaCtrl.Stop", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaStop, this));
- mCommitCallbackRegistrar.add("SelectedMediaCtrl.Play", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaPlay, this));
- mCommitCallbackRegistrar.add("SelectedMediaCtrl.Pause", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaPause, this));
- mCommitCallbackRegistrar.add("SelectedMediaCtrl.Mute", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaMute, this));
- mCommitCallbackRegistrar.add("SelectedMediaCtrl.Volume", boost::bind(&LLPanelNearByMedia::onCommitSelectedMediaVolume, this));
- mCommitCallbackRegistrar.add("SelectedMediaCtrl.Zoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaZoom, this));
- mCommitCallbackRegistrar.add("SelectedMediaCtrl.Unzoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaUnzoom, this));
-
- buildFromFile( "panel_nearby_media.xml");
+ mCommitCallbackRegistrar.add("MediaListCtrl.EnableAll", boost::bind(&LLPanelNearByMedia::onClickEnableAll, this));
+ mCommitCallbackRegistrar.add("MediaListCtrl.DisableAll", boost::bind(&LLPanelNearByMedia::onClickDisableAll, this));
+ mCommitCallbackRegistrar.add("MediaListCtrl.GoMediaPrefs", boost::bind(&LLPanelNearByMedia::onAdvancedButtonClick, this));
+ mCommitCallbackRegistrar.add("MediaListCtrl.MoreLess", boost::bind(&LLPanelNearByMedia::onMoreLess, this));
+ mCommitCallbackRegistrar.add("SelectedMediaCtrl.Stop", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaStop, this));
+ mCommitCallbackRegistrar.add("SelectedMediaCtrl.Play", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaPlay, this));
+ mCommitCallbackRegistrar.add("SelectedMediaCtrl.Pause", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaPause, this));
+ mCommitCallbackRegistrar.add("SelectedMediaCtrl.Mute", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaMute, this));
+ mCommitCallbackRegistrar.add("SelectedMediaCtrl.Volume", boost::bind(&LLPanelNearByMedia::onCommitSelectedMediaVolume, this));
+ mCommitCallbackRegistrar.add("SelectedMediaCtrl.Zoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaZoom, this));
+ mCommitCallbackRegistrar.add("SelectedMediaCtrl.Unzoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaUnzoom, this));
+
+ buildFromFile( "panel_nearby_media.xml");
}
LLPanelNearByMedia::~LLPanelNearByMedia()
@@ -106,75 +106,75 @@ LLPanelNearByMedia::~LLPanelNearByMedia()
BOOL LLPanelNearByMedia::postBuild()
{
- LLPanelPulldown::postBuild();
-
- const S32 RESIZE_BAR_THICKNESS = 6;
- LLResizeBar::Params p;
- p.rect = LLRect(0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0);
- p.name = "resizebar_bottom";
- p.min_size = getRect().getHeight();
- p.side = LLResizeBar::BOTTOM;
- p.resizing_view = this;
- addChild( LLUICtrlFactory::create<LLResizeBar>(p) );
-
- p.rect = LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0);
- p.name = "resizebar_left";
- p.min_size = getRect().getWidth();
- p.side = LLResizeBar::LEFT;
- addChild( LLUICtrlFactory::create<LLResizeBar>(p) );
-
- LLResizeHandle::Params resize_handle_p;
- resize_handle_p.rect = LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 );
- resize_handle_p.mouse_opaque(false);
- resize_handle_p.min_width(getRect().getWidth());
- resize_handle_p.min_height(getRect().getHeight());
- resize_handle_p.corner(LLResizeHandle::LEFT_BOTTOM);
- addChild(LLUICtrlFactory::create<LLResizeHandle>(resize_handle_p));
-
- mNearbyMediaPanel = getChild<LLUICtrl>("nearby_media_panel");
- mMediaList = getChild<LLScrollListCtrl>("media_list");
- mEnableAllCtrl = getChild<LLUICtrl>("all_nearby_media_enable_btn");
- mDisableAllCtrl = getChild<LLUICtrl>("all_nearby_media_disable_btn");
- mShowCtrl = getChild<LLComboBox>("show_combo");
-
- // Dynamic (selection-dependent) controls
- mStopCtrl = getChild<LLUICtrl>("stop");
- mPlayCtrl = getChild<LLUICtrl>("play");
- mPauseCtrl = getChild<LLUICtrl>("pause");
- mMuteCtrl = getChild<LLUICtrl>("mute");
- mVolumeSliderCtrl = getChild<LLUICtrl>("volume_slider_ctrl");
- mZoomCtrl = getChild<LLUICtrl>("zoom");
- mUnzoomCtrl = getChild<LLUICtrl>("unzoom");
- mVolumeSlider = getChild<LLSlider>("volume_slider");
- mMuteBtn = getChild<LLButton>("mute_btn");
-
- mEmptyNameString = getString("empty_item_text");
- mParcelMediaName = getString("parcel_media_name");
- mParcelAudioName = getString("parcel_audio_name");
- mPlayingString = getString("playing_suffix");
-
- mMediaList->setDoubleClickCallback(onZoomMedia, this);
- mMediaList->sortByColumnIndex(PROXIMITY_COLUMN, TRUE);
- mMediaList->sortByColumnIndex(VISIBILITY_COLUMN, FALSE);
-
- refreshList();
- updateControls();
- updateColumns();
-
- LLView* minimized_controls = getChildView("minimized_controls");
- mMoreRect = getRect();
- mLessRect = getRect();
- mLessRect.mBottom = minimized_controls->getRect().mBottom;
-
- getChild<LLUICtrl>("more_btn")->setVisible(false);
- onMoreLess();
-
- return TRUE;
+ LLPanelPulldown::postBuild();
+
+ const S32 RESIZE_BAR_THICKNESS = 6;
+ LLResizeBar::Params p;
+ p.rect = LLRect(0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0);
+ p.name = "resizebar_bottom";
+ p.min_size = getRect().getHeight();
+ p.side = LLResizeBar::BOTTOM;
+ p.resizing_view = this;
+ addChild( LLUICtrlFactory::create<LLResizeBar>(p) );
+
+ p.rect = LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0);
+ p.name = "resizebar_left";
+ p.min_size = getRect().getWidth();
+ p.side = LLResizeBar::LEFT;
+ addChild( LLUICtrlFactory::create<LLResizeBar>(p) );
+
+ LLResizeHandle::Params resize_handle_p;
+ resize_handle_p.rect = LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 );
+ resize_handle_p.mouse_opaque(false);
+ resize_handle_p.min_width(getRect().getWidth());
+ resize_handle_p.min_height(getRect().getHeight());
+ resize_handle_p.corner(LLResizeHandle::LEFT_BOTTOM);
+ addChild(LLUICtrlFactory::create<LLResizeHandle>(resize_handle_p));
+
+ mNearbyMediaPanel = getChild<LLUICtrl>("nearby_media_panel");
+ mMediaList = getChild<LLScrollListCtrl>("media_list");
+ mEnableAllCtrl = getChild<LLUICtrl>("all_nearby_media_enable_btn");
+ mDisableAllCtrl = getChild<LLUICtrl>("all_nearby_media_disable_btn");
+ mShowCtrl = getChild<LLComboBox>("show_combo");
+
+ // Dynamic (selection-dependent) controls
+ mStopCtrl = getChild<LLUICtrl>("stop");
+ mPlayCtrl = getChild<LLUICtrl>("play");
+ mPauseCtrl = getChild<LLUICtrl>("pause");
+ mMuteCtrl = getChild<LLUICtrl>("mute");
+ mVolumeSliderCtrl = getChild<LLUICtrl>("volume_slider_ctrl");
+ mZoomCtrl = getChild<LLUICtrl>("zoom");
+ mUnzoomCtrl = getChild<LLUICtrl>("unzoom");
+ mVolumeSlider = getChild<LLSlider>("volume_slider");
+ mMuteBtn = getChild<LLButton>("mute_btn");
+
+ mEmptyNameString = getString("empty_item_text");
+ mParcelMediaName = getString("parcel_media_name");
+ mParcelAudioName = getString("parcel_audio_name");
+ mPlayingString = getString("playing_suffix");
+
+ mMediaList->setDoubleClickCallback(onZoomMedia, this);
+ mMediaList->sortByColumnIndex(PROXIMITY_COLUMN, TRUE);
+ mMediaList->sortByColumnIndex(VISIBILITY_COLUMN, FALSE);
+
+ refreshList();
+ updateControls();
+ updateColumns();
+
+ LLView* minimized_controls = getChildView("minimized_controls");
+ mMoreRect = getRect();
+ mLessRect = getRect();
+ mLessRect.mBottom = minimized_controls->getRect().mBottom;
+
+ getChild<LLUICtrl>("more_btn")->setVisible(false);
+ onMoreLess();
+
+ return TRUE;
}
void LLPanelNearByMedia::handleMediaAutoPlayChanged(const LLSD& newvalue)
{
- // update mParcelAudioAutoStartMode if "ParcelMediaAutoPlayEnable" changes
+ // update mParcelAudioAutoStartMode if "ParcelMediaAutoPlayEnable" changes
S32 value = gSavedSettings.getS32("ParcelMediaAutoPlayEnable");
mParcelAudioAutoStart = value != 0
&& gSavedSettings.getBOOL("MediaTentativeAutoPlay");
@@ -191,1012 +191,1012 @@ void LLPanelNearByMedia::handleMediaAutoPlayChanged(const LLSD& newvalue)
/*virtual*/
void LLPanelNearByMedia::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- LLPanelPulldown::reshape(width, height, called_from_parent);
+ LLPanelPulldown::reshape(width, height, called_from_parent);
- LLButton* more_btn = findChild<LLButton>("more_btn");
- if (more_btn && more_btn->getValue().asBoolean())
- {
- mMoreRect = getRect();
- }
+ LLButton* more_btn = findChild<LLButton>("more_btn");
+ if (more_btn && more_btn->getValue().asBoolean())
+ {
+ mMoreRect = getRect();
+ }
}
/*virtual*/
void LLPanelNearByMedia::draw()
{
- // keep bottom of panel on screen
- LLRect screen_rect = calcScreenRect();
- if (screen_rect.mBottom < 0)
- {
- LLRect new_rect = getRect();
- new_rect.mBottom += 0 - screen_rect.mBottom;
- setShape(new_rect);
- }
-
- refreshList();
- updateControls();
-
- LLPanelPulldown::draw();
+ // keep bottom of panel on screen
+ LLRect screen_rect = calcScreenRect();
+ if (screen_rect.mBottom < 0)
+ {
+ LLRect new_rect = getRect();
+ new_rect.mBottom += 0 - screen_rect.mBottom;
+ setShape(new_rect);
+ }
+
+ refreshList();
+ updateControls();
+
+ LLPanelPulldown::draw();
}
/*virtual*/
BOOL LLPanelNearByMedia::handleHover(S32 x, S32 y, MASK mask)
{
- LLPanelPulldown::handleHover(x, y, mask);
-
- // If we are hovering over this panel, make sure to clear any hovered media
- // ID. Note that the more general solution would be to clear this ID when
- // the mouse leaves the in-scene view, but that proved to be problematic.
- // See EXT-5517
- LLViewerMediaFocus::getInstance()->clearHover();
-
- // Always handle
- return true;
+ LLPanelPulldown::handleHover(x, y, mask);
+
+ // If we are hovering over this panel, make sure to clear any hovered media
+ // ID. Note that the more general solution would be to clear this ID when
+ // the mouse leaves the in-scene view, but that proved to be problematic.
+ // See EXT-5517
+ LLViewerMediaFocus::getInstance()->clearHover();
+
+ // Always handle
+ return true;
}
bool LLPanelNearByMedia::getParcelAudioAutoStart()
{
- return mParcelAudioAutoStart;
+ return mParcelAudioAutoStart;
}
LLScrollListItem* LLPanelNearByMedia::addListItem(const LLUUID &id)
{
- if (NULL == mMediaList) return NULL;
-
- // Just set up the columns -- the values will be filled in by updateListItem().
-
- LLSD row;
- row["id"] = id;
-
- LLSD &columns = row["columns"];
-
- columns[CHECKBOX_COLUMN]["column"] = "media_checkbox_ctrl";
- columns[CHECKBOX_COLUMN]["type"] = "checkbox";
- //if(mDebugInfoVisible)
- {
- columns[PROXIMITY_COLUMN]["column"] = "media_proximity";
- columns[PROXIMITY_COLUMN]["value"] = "";
- columns[VISIBILITY_COLUMN]["column"] = "media_visibility";
- columns[VISIBILITY_COLUMN]["value"] = "";
- columns[CLASS_COLUMN]["column"] = "media_class";
- columns[CLASS_COLUMN]["type"] = "text";
- columns[CLASS_COLUMN]["value"] = "";
- }
- columns[NAME_COLUMN]["column"] = "media_name";
- columns[NAME_COLUMN]["type"] = "text";
- columns[NAME_COLUMN]["value"] = "";
- //if(mDebugInfoVisible)
- {
- columns[DEBUG_COLUMN]["column"] = "media_debug";
- columns[DEBUG_COLUMN]["type"] = "text";
- columns[DEBUG_COLUMN]["value"] = "";
- }
-
- LLScrollListItem* new_item = mMediaList->addElement(row);
- if (NULL != new_item)
- {
- LLScrollListCheck* scroll_list_check = dynamic_cast<LLScrollListCheck*>(new_item->getColumn(CHECKBOX_COLUMN));
- if (scroll_list_check)
- {
- LLCheckBoxCtrl *check = scroll_list_check->getCheckBox();
- check->setCommitCallback(boost::bind(&LLPanelNearByMedia::onCheckItem, this, _1, id));
- }
- }
- return new_item;
+ if (NULL == mMediaList) return NULL;
+
+ // Just set up the columns -- the values will be filled in by updateListItem().
+
+ LLSD row;
+ row["id"] = id;
+
+ LLSD &columns = row["columns"];
+
+ columns[CHECKBOX_COLUMN]["column"] = "media_checkbox_ctrl";
+ columns[CHECKBOX_COLUMN]["type"] = "checkbox";
+ //if(mDebugInfoVisible)
+ {
+ columns[PROXIMITY_COLUMN]["column"] = "media_proximity";
+ columns[PROXIMITY_COLUMN]["value"] = "";
+ columns[VISIBILITY_COLUMN]["column"] = "media_visibility";
+ columns[VISIBILITY_COLUMN]["value"] = "";
+ columns[CLASS_COLUMN]["column"] = "media_class";
+ columns[CLASS_COLUMN]["type"] = "text";
+ columns[CLASS_COLUMN]["value"] = "";
+ }
+ columns[NAME_COLUMN]["column"] = "media_name";
+ columns[NAME_COLUMN]["type"] = "text";
+ columns[NAME_COLUMN]["value"] = "";
+ //if(mDebugInfoVisible)
+ {
+ columns[DEBUG_COLUMN]["column"] = "media_debug";
+ columns[DEBUG_COLUMN]["type"] = "text";
+ columns[DEBUG_COLUMN]["value"] = "";
+ }
+
+ LLScrollListItem* new_item = mMediaList->addElement(row);
+ if (NULL != new_item)
+ {
+ LLScrollListCheck* scroll_list_check = dynamic_cast<LLScrollListCheck*>(new_item->getColumn(CHECKBOX_COLUMN));
+ if (scroll_list_check)
+ {
+ LLCheckBoxCtrl *check = scroll_list_check->getCheckBox();
+ check->setCommitCallback(boost::bind(&LLPanelNearByMedia::onCheckItem, this, _1, id));
+ }
+ }
+ return new_item;
}
void LLPanelNearByMedia::updateListItem(LLScrollListItem* item, LLViewerMediaImpl* impl)
{
- std::string item_name;
- std::string item_tooltip;
- std::string debug_str;
- LLPanelNearByMedia::MediaClass media_class = MEDIA_CLASS_ALL;
-
- getNameAndUrlHelper(impl, item_name, item_tooltip, mEmptyNameString);
- // Focused
- if (impl->hasFocus())
- {
- media_class = MEDIA_CLASS_FOCUSED;
- }
- // Is attached to another avatar?
- else if (impl->isAttachedToAnotherAvatar())
- {
- media_class = MEDIA_CLASS_ON_OTHERS;
- }
- // Outside agent parcel
- else if (!impl->isInAgentParcel())
- {
- media_class = MEDIA_CLASS_OUTSIDE_PARCEL;
- }
- else {
- // inside parcel
- media_class = MEDIA_CLASS_WITHIN_PARCEL;
- }
-
- if(mDebugInfoVisible)
- {
- debug_str += llformat("%g/", (float)impl->getInterest());
-
- // proximity distance is actually distance squared -- display it as straight distance.
- debug_str += llformat("%g/", (F32) sqrt(impl->getProximityDistance()));
-
- // s += llformat("%g/", (float)impl->getCPUUsage());
- // s += llformat("%g/", (float)impl->getApproximateTextureInterest());
- debug_str += llformat("%g/", (float)(NULL == impl->getSomeObject()) ? 0.0 : impl->getSomeObject()->getPixelArea());
-
- debug_str += LLPluginClassMedia::priorityToString(impl->getPriority());
-
- if(impl->hasMedia())
- {
- debug_str += '@';
- }
- else if(impl->isPlayable())
- {
- debug_str += '+';
- }
- else if(impl->isForcedUnloaded())
- {
- debug_str += '!';
- }
- }
-
- updateListItem(item,
- item_name,
- item_tooltip,
- impl->getProximity(),
- impl->isMediaDisabled(),
- impl->hasMedia(),
- impl->isMediaTimeBased() && impl->isMediaPlaying(),
- media_class,
- debug_str);
+ std::string item_name;
+ std::string item_tooltip;
+ std::string debug_str;
+ LLPanelNearByMedia::MediaClass media_class = MEDIA_CLASS_ALL;
+
+ getNameAndUrlHelper(impl, item_name, item_tooltip, mEmptyNameString);
+ // Focused
+ if (impl->hasFocus())
+ {
+ media_class = MEDIA_CLASS_FOCUSED;
+ }
+ // Is attached to another avatar?
+ else if (impl->isAttachedToAnotherAvatar())
+ {
+ media_class = MEDIA_CLASS_ON_OTHERS;
+ }
+ // Outside agent parcel
+ else if (!impl->isInAgentParcel())
+ {
+ media_class = MEDIA_CLASS_OUTSIDE_PARCEL;
+ }
+ else {
+ // inside parcel
+ media_class = MEDIA_CLASS_WITHIN_PARCEL;
+ }
+
+ if(mDebugInfoVisible)
+ {
+ debug_str += llformat("%g/", (float)impl->getInterest());
+
+ // proximity distance is actually distance squared -- display it as straight distance.
+ debug_str += llformat("%g/", (F32) sqrt(impl->getProximityDistance()));
+
+ // s += llformat("%g/", (float)impl->getCPUUsage());
+ // s += llformat("%g/", (float)impl->getApproximateTextureInterest());
+ debug_str += llformat("%g/", (float)(NULL == impl->getSomeObject()) ? 0.0 : impl->getSomeObject()->getPixelArea());
+
+ debug_str += LLPluginClassMedia::priorityToString(impl->getPriority());
+
+ if(impl->hasMedia())
+ {
+ debug_str += '@';
+ }
+ else if(impl->isPlayable())
+ {
+ debug_str += '+';
+ }
+ else if(impl->isForcedUnloaded())
+ {
+ debug_str += '!';
+ }
+ }
+
+ updateListItem(item,
+ item_name,
+ item_tooltip,
+ impl->getProximity(),
+ impl->isMediaDisabled(),
+ impl->hasMedia(),
+ impl->isMediaTimeBased() && impl->isMediaPlaying(),
+ media_class,
+ debug_str);
}
void LLPanelNearByMedia::updateListItem(LLScrollListItem* item,
- const std::string &item_name,
- const std::string &item_tooltip,
- S32 proximity,
- bool is_disabled,
- bool has_media,
- bool is_time_based_and_playing,
- LLPanelNearByMedia::MediaClass media_class,
- const std::string &debug_str)
+ const std::string &item_name,
+ const std::string &item_tooltip,
+ S32 proximity,
+ bool is_disabled,
+ bool has_media,
+ bool is_time_based_and_playing,
+ LLPanelNearByMedia::MediaClass media_class,
+ const std::string &debug_str)
{
- LLScrollListCell* cell = item->getColumn(PROXIMITY_COLUMN);
- if(cell)
- {
- // since we are forced to sort by text, encode sort order as string
- std::string proximity_string = STRINGIZE(proximity);
- std::string old_proximity_string = cell->getValue().asString();
- if(proximity_string != old_proximity_string)
- {
- cell->setValue(proximity_string);
- mMediaList->setNeedsSort(true);
- }
- }
-
- cell = item->getColumn(CHECKBOX_COLUMN);
- if(cell)
- {
- cell->setValue(!is_disabled);
- }
-
- cell = item->getColumn(VISIBILITY_COLUMN);
- if(cell)
- {
- S32 old_visibility = cell->getValue();
- // *HACK ALERT: force ordering of Media before Audio before the rest of the list
- S32 new_visibility =
- item->getUUID() == PARCEL_MEDIA_LIST_ITEM_UUID ? 3
- : item->getUUID() == PARCEL_AUDIO_LIST_ITEM_UUID ? 2
- : (has_media) ? 1
- : ((is_disabled) ? 0
- : -1);
- cell->setValue(STRINGIZE(new_visibility));
- if (new_visibility != old_visibility)
- {
- mMediaList->setNeedsSort(true);
- }
- }
-
- cell = item->getColumn(NAME_COLUMN);
- if(cell)
- {
- std::string name = item_name;
- std::string old_name = cell->getValue().asString();
- if (has_media)
- {
- name += " " + mPlayingString;
- }
- if (name != old_name)
- {
- cell->setValue(name);
- }
- cell->setToolTip(item_tooltip);
-
- // *TODO: Make these font styles/colors configurable via XUI
- U8 font_style = LLFontGL::NORMAL;
- LLColor4 cell_color = LLColor4::white;
-
- // Only colorize by class in debug
- if (mDebugInfoVisible)
- {
- switch (media_class) {
- case MEDIA_CLASS_FOCUSED:
- cell_color = LLColor4::yellow;
- break;
- case MEDIA_CLASS_ON_OTHERS:
- cell_color = LLColor4::red;
- break;
- case MEDIA_CLASS_OUTSIDE_PARCEL:
- cell_color = LLColor4::orange;
- break;
- case MEDIA_CLASS_WITHIN_PARCEL:
- default:
- break;
- }
- }
- if (is_disabled)
- {
- if (mDebugInfoVisible)
- {
- font_style |= LLFontGL::ITALIC;
- cell_color = LLColor4::black;
- }
- else {
- // Dim it if it is disabled
- cell_color.setAlpha(0.25);
- }
- }
- // Dim it if it isn't "showing"
- else if (!has_media)
- {
- cell_color.setAlpha(0.25);
- }
- // Bold it if it is time-based media and it is playing
- else if (is_time_based_and_playing)
- {
- if (mDebugInfoVisible) font_style |= LLFontGL::BOLD;
- }
- cell->setColor(cell_color);
- LLScrollListText *text_cell = dynamic_cast<LLScrollListText*> (cell);
- if (text_cell)
- {
- text_cell->setFontStyle(font_style);
- }
- }
-
- cell = item->getColumn(CLASS_COLUMN);
- if(cell)
- {
- // TODO: clean this up!
- cell->setValue(STRINGIZE(media_class));
- }
-
- if(mDebugInfoVisible)
- {
- cell = item->getColumn(DEBUG_COLUMN);
- if(cell)
- {
- cell->setValue(debug_str);
- }
- }
+ LLScrollListCell* cell = item->getColumn(PROXIMITY_COLUMN);
+ if(cell)
+ {
+ // since we are forced to sort by text, encode sort order as string
+ std::string proximity_string = STRINGIZE(proximity);
+ std::string old_proximity_string = cell->getValue().asString();
+ if(proximity_string != old_proximity_string)
+ {
+ cell->setValue(proximity_string);
+ mMediaList->setNeedsSort(true);
+ }
+ }
+
+ cell = item->getColumn(CHECKBOX_COLUMN);
+ if(cell)
+ {
+ cell->setValue(!is_disabled);
+ }
+
+ cell = item->getColumn(VISIBILITY_COLUMN);
+ if(cell)
+ {
+ S32 old_visibility = cell->getValue();
+ // *HACK ALERT: force ordering of Media before Audio before the rest of the list
+ S32 new_visibility =
+ item->getUUID() == PARCEL_MEDIA_LIST_ITEM_UUID ? 3
+ : item->getUUID() == PARCEL_AUDIO_LIST_ITEM_UUID ? 2
+ : (has_media) ? 1
+ : ((is_disabled) ? 0
+ : -1);
+ cell->setValue(STRINGIZE(new_visibility));
+ if (new_visibility != old_visibility)
+ {
+ mMediaList->setNeedsSort(true);
+ }
+ }
+
+ cell = item->getColumn(NAME_COLUMN);
+ if(cell)
+ {
+ std::string name = item_name;
+ std::string old_name = cell->getValue().asString();
+ if (has_media)
+ {
+ name += " " + mPlayingString;
+ }
+ if (name != old_name)
+ {
+ cell->setValue(name);
+ }
+ cell->setToolTip(item_tooltip);
+
+ // *TODO: Make these font styles/colors configurable via XUI
+ U8 font_style = LLFontGL::NORMAL;
+ LLColor4 cell_color = LLColor4::white;
+
+ // Only colorize by class in debug
+ if (mDebugInfoVisible)
+ {
+ switch (media_class) {
+ case MEDIA_CLASS_FOCUSED:
+ cell_color = LLColor4::yellow;
+ break;
+ case MEDIA_CLASS_ON_OTHERS:
+ cell_color = LLColor4::red;
+ break;
+ case MEDIA_CLASS_OUTSIDE_PARCEL:
+ cell_color = LLColor4::orange;
+ break;
+ case MEDIA_CLASS_WITHIN_PARCEL:
+ default:
+ break;
+ }
+ }
+ if (is_disabled)
+ {
+ if (mDebugInfoVisible)
+ {
+ font_style |= LLFontGL::ITALIC;
+ cell_color = LLColor4::black;
+ }
+ else {
+ // Dim it if it is disabled
+ cell_color.setAlpha(0.25);
+ }
+ }
+ // Dim it if it isn't "showing"
+ else if (!has_media)
+ {
+ cell_color.setAlpha(0.25);
+ }
+ // Bold it if it is time-based media and it is playing
+ else if (is_time_based_and_playing)
+ {
+ if (mDebugInfoVisible) font_style |= LLFontGL::BOLD;
+ }
+ cell->setColor(cell_color);
+ LLScrollListText *text_cell = dynamic_cast<LLScrollListText*> (cell);
+ if (text_cell)
+ {
+ text_cell->setFontStyle(font_style);
+ }
+ }
+
+ cell = item->getColumn(CLASS_COLUMN);
+ if(cell)
+ {
+ // TODO: clean this up!
+ cell->setValue(STRINGIZE(media_class));
+ }
+
+ if(mDebugInfoVisible)
+ {
+ cell = item->getColumn(DEBUG_COLUMN);
+ if(cell)
+ {
+ cell->setValue(debug_str);
+ }
+ }
}
-
+
void LLPanelNearByMedia::removeListItem(const LLUUID &id)
{
- if (NULL == mMediaList) return;
-
- mMediaList->deleteSingleItem(mMediaList->getItemIndex(id));
- mMediaList->updateLayout();
+ if (NULL == mMediaList) return;
+
+ mMediaList->deleteSingleItem(mMediaList->getItemIndex(id));
+ mMediaList->updateLayout();
}
void LLPanelNearByMedia::refreshParcelItems()
{
- //
- // First add/remove the "fake" items Parcel Media and Parcel Audio.
- // These items will have special UUIDs
- // PARCEL_MEDIA_LIST_ITEM_UUID
- // PARCEL_AUDIO_LIST_ITEM_UUID
- //
- // Get the filter choice.
- const LLSD &choice_llsd = mShowCtrl->getSelectedValue();
- MediaClass choice = (MediaClass)choice_llsd.asInteger();
- // Only show "special parcel items" if "All" or "Within" filter
- // (and if media is "enabled")
- bool should_include = (choice == MEDIA_CLASS_ALL || choice == MEDIA_CLASS_WITHIN_PARCEL);
- LLViewerMedia* media_inst = LLViewerMedia::getInstance();
-
- // First Parcel Media: add or remove it as necessary
- if (gSavedSettings.getBOOL("AudioStreamingMedia") && should_include && media_inst->hasParcelMedia())
- {
- // Yes, there is parcel media.
- if (NULL == mParcelMediaItem)
- {
- mParcelMediaItem = addListItem(PARCEL_MEDIA_LIST_ITEM_UUID);
- mMediaList->setNeedsSort(true);
- }
- }
- else {
- if (NULL != mParcelMediaItem) {
- removeListItem(PARCEL_MEDIA_LIST_ITEM_UUID);
- mParcelMediaItem = NULL;
- mMediaList->setNeedsSort(true);
- }
- }
-
- // ... then update it
- if (NULL != mParcelMediaItem)
- {
- std::string name, url, tooltip;
- getNameAndUrlHelper(LLViewerParcelMedia::getInstance()->getParcelMedia(), name, url, "");
- if (name.empty() || name == url)
- {
- tooltip = url;
- }
- else
- {
- tooltip = name + " : " + url;
- }
- LLViewerMediaImpl *impl = LLViewerParcelMedia::getInstance()->getParcelMedia();
- updateListItem(mParcelMediaItem,
- mParcelMediaName,
- tooltip,
- -2, // Proximity closer than anything else, before Parcel Audio
- impl == NULL || impl->isMediaDisabled(),
- impl != NULL && !LLViewerParcelMedia::getInstance()->getURL().empty(),
- impl != NULL && impl->isMediaTimeBased() && impl->isMediaPlaying(),
- MEDIA_CLASS_ALL,
- "parcel media");
- }
-
- // Next Parcel Audio: add or remove it as necessary (don't show if disabled in prefs)
- if (should_include && media_inst->hasParcelAudio() && gSavedSettings.getBOOL("AudioStreamingMusic"))
- {
- // Yes, there is parcel audio.
- if (NULL == mParcelAudioItem)
- {
- mParcelAudioItem = addListItem(PARCEL_AUDIO_LIST_ITEM_UUID);
- mMediaList->setNeedsSort(true);
- }
- }
- else {
- if (NULL != mParcelAudioItem) {
- removeListItem(PARCEL_AUDIO_LIST_ITEM_UUID);
- mParcelAudioItem = NULL;
- mMediaList->setNeedsSort(true);
- }
- }
-
- // ... then update it
- if (NULL != mParcelAudioItem)
- {
- bool is_playing = media_inst->isParcelAudioPlaying();
-
- std::string url;
- url = media_inst->getParcelAudioURL();
-
- updateListItem(mParcelAudioItem,
- mParcelAudioName,
- url,
- -1, // Proximity after Parcel Media, but closer than anything else
- (!is_playing),
- is_playing,
- is_playing,
- MEDIA_CLASS_ALL,
- "parcel audio");
- }
+ //
+ // First add/remove the "fake" items Parcel Media and Parcel Audio.
+ // These items will have special UUIDs
+ // PARCEL_MEDIA_LIST_ITEM_UUID
+ // PARCEL_AUDIO_LIST_ITEM_UUID
+ //
+ // Get the filter choice.
+ const LLSD &choice_llsd = mShowCtrl->getSelectedValue();
+ MediaClass choice = (MediaClass)choice_llsd.asInteger();
+ // Only show "special parcel items" if "All" or "Within" filter
+ // (and if media is "enabled")
+ bool should_include = (choice == MEDIA_CLASS_ALL || choice == MEDIA_CLASS_WITHIN_PARCEL);
+ LLViewerMedia* media_inst = LLViewerMedia::getInstance();
+
+ // First Parcel Media: add or remove it as necessary
+ if (gSavedSettings.getBOOL("AudioStreamingMedia") && should_include && media_inst->hasParcelMedia())
+ {
+ // Yes, there is parcel media.
+ if (NULL == mParcelMediaItem)
+ {
+ mParcelMediaItem = addListItem(PARCEL_MEDIA_LIST_ITEM_UUID);
+ mMediaList->setNeedsSort(true);
+ }
+ }
+ else {
+ if (NULL != mParcelMediaItem) {
+ removeListItem(PARCEL_MEDIA_LIST_ITEM_UUID);
+ mParcelMediaItem = NULL;
+ mMediaList->setNeedsSort(true);
+ }
+ }
+
+ // ... then update it
+ if (NULL != mParcelMediaItem)
+ {
+ std::string name, url, tooltip;
+ getNameAndUrlHelper(LLViewerParcelMedia::getInstance()->getParcelMedia(), name, url, "");
+ if (name.empty() || name == url)
+ {
+ tooltip = url;
+ }
+ else
+ {
+ tooltip = name + " : " + url;
+ }
+ LLViewerMediaImpl *impl = LLViewerParcelMedia::getInstance()->getParcelMedia();
+ updateListItem(mParcelMediaItem,
+ mParcelMediaName,
+ tooltip,
+ -2, // Proximity closer than anything else, before Parcel Audio
+ impl == NULL || impl->isMediaDisabled(),
+ impl != NULL && !LLViewerParcelMedia::getInstance()->getURL().empty(),
+ impl != NULL && impl->isMediaTimeBased() && impl->isMediaPlaying(),
+ MEDIA_CLASS_ALL,
+ "parcel media");
+ }
+
+ // Next Parcel Audio: add or remove it as necessary (don't show if disabled in prefs)
+ if (should_include && media_inst->hasParcelAudio() && gSavedSettings.getBOOL("AudioStreamingMusic"))
+ {
+ // Yes, there is parcel audio.
+ if (NULL == mParcelAudioItem)
+ {
+ mParcelAudioItem = addListItem(PARCEL_AUDIO_LIST_ITEM_UUID);
+ mMediaList->setNeedsSort(true);
+ }
+ }
+ else {
+ if (NULL != mParcelAudioItem) {
+ removeListItem(PARCEL_AUDIO_LIST_ITEM_UUID);
+ mParcelAudioItem = NULL;
+ mMediaList->setNeedsSort(true);
+ }
+ }
+
+ // ... then update it
+ if (NULL != mParcelAudioItem)
+ {
+ bool is_playing = media_inst->isParcelAudioPlaying();
+
+ std::string url;
+ url = media_inst->getParcelAudioURL();
+
+ updateListItem(mParcelAudioItem,
+ mParcelAudioName,
+ url,
+ -1, // Proximity after Parcel Media, but closer than anything else
+ (!is_playing),
+ is_playing,
+ is_playing,
+ MEDIA_CLASS_ALL,
+ "parcel audio");
+ }
}
void LLPanelNearByMedia::refreshList()
{
- bool all_items_deleted = false;
-
- if(!mMediaList)
- {
- // None of this makes any sense if the media list isn't there.
- return;
- }
-
- // Check whether the debug column has been shown/hidden.
- bool debug_info_visible = gSavedSettings.getBOOL("MediaPerformanceManagerDebug");
- if(debug_info_visible != mDebugInfoVisible)
- {
- mDebugInfoVisible = debug_info_visible;
-
- // Clear all items so the list gets regenerated.
- mMediaList->deleteAllItems();
- mParcelAudioItem = NULL;
- mParcelMediaItem = NULL;
- all_items_deleted = true;
-
- updateColumns();
- }
-
- refreshParcelItems();
-
- // Get the canonical list from LLViewerMedia
- LLViewerMedia* media_inst = LLViewerMedia::getInstance();
- LLViewerMedia::impl_list impls = media_inst->getPriorityList();
- LLViewerMedia::impl_list::iterator priority_iter;
-
- U32 disabled_count = 0;
-
- // iterate over the impl list, creating rows as necessary.
- for(priority_iter = impls.begin(); priority_iter != impls.end(); priority_iter++)
- {
- LLViewerMediaImpl *impl = *priority_iter;
-
- // If we just emptied out the list, every flag needs to be reset.
- if(all_items_deleted)
- {
- impl->setInNearbyMediaList(false);
- }
-
- if (!impl->isParcelMedia())
- {
- LLUUID media_id = impl->getMediaTextureID();
- S32 proximity = impl->getProximity();
- // This is expensive (i.e. a linear search) -- don't use it here. We now use mInNearbyMediaList instead.
- //S32 index = mMediaList->getItemIndex(media_id);
- if (proximity < 0 || !shouldShow(impl))
- {
- if (impl->getInNearbyMediaList())
- {
- // There's a row for this impl -- remove it.
- removeListItem(media_id);
- impl->setInNearbyMediaList(false);
- }
- }
- else
- {
- if (!impl->getInNearbyMediaList())
- {
- // We don't have a row for this impl -- add one.
- addListItem(media_id);
- impl->setInNearbyMediaList(true);
- }
- }
- // Update counts
- if (impl->isMediaDisabled())
- {
- disabled_count++;
- }
- }
- }
- mDisableAllCtrl->setEnabled((gSavedSettings.getBOOL("AudioStreamingMusic") ||
- gSavedSettings.getBOOL("AudioStreamingMedia")) &&
- (media_inst->isAnyMediaShowing() ||
- media_inst->isParcelMediaPlaying() ||
- media_inst->isParcelAudioPlaying()));
-
- mEnableAllCtrl->setEnabled( (gSavedSettings.getBOOL("AudioStreamingMusic") ||
- gSavedSettings.getBOOL("AudioStreamingMedia")) &&
- (disabled_count > 0 ||
- // parcel media (if we have it, and it isn't playing, enable "start")
- (media_inst->hasParcelMedia() && ! media_inst->isParcelMediaPlaying()) ||
- // parcel audio (if we have it, and it isn't playing, enable "start")
- (media_inst->hasParcelAudio() && ! media_inst->isParcelAudioPlaying())));
-
- // Iterate over the rows in the control, updating ones whose impl exists, and deleting ones whose impl has gone away.
- std::vector<LLScrollListItem*> items = mMediaList->getAllData();
-
- for (std::vector<LLScrollListItem*>::iterator item_it = items.begin();
- item_it != items.end();
- ++item_it)
- {
- LLScrollListItem* item = (*item_it);
- LLUUID row_id = item->getUUID();
-
- if (row_id != PARCEL_MEDIA_LIST_ITEM_UUID &&
- row_id != PARCEL_AUDIO_LIST_ITEM_UUID)
- {
- LLViewerMediaImpl* impl = media_inst->getMediaImplFromTextureID(row_id);
- if(impl)
- {
- updateListItem(item, impl);
- }
- else
- {
- // This item's impl has been deleted -- remove the row.
- // Removing the row won't throw off our iteration, since we have a local copy of the array.
- // We just need to make sure we don't access this item after the delete.
- removeListItem(row_id);
- }
- }
- }
-
- // Set the selection to whatever media impl the media focus/hover is on.
- // This is an experiment, and can be removed by ifdefing out these 4 lines.
- LLUUID media_target = LLViewerMediaFocus::getInstance()->getControlsMediaID();
- if(media_target.notNull())
- {
- mMediaList->selectByID(media_target);
- }
+ bool all_items_deleted = false;
+
+ if(!mMediaList)
+ {
+ // None of this makes any sense if the media list isn't there.
+ return;
+ }
+
+ // Check whether the debug column has been shown/hidden.
+ bool debug_info_visible = gSavedSettings.getBOOL("MediaPerformanceManagerDebug");
+ if(debug_info_visible != mDebugInfoVisible)
+ {
+ mDebugInfoVisible = debug_info_visible;
+
+ // Clear all items so the list gets regenerated.
+ mMediaList->deleteAllItems();
+ mParcelAudioItem = NULL;
+ mParcelMediaItem = NULL;
+ all_items_deleted = true;
+
+ updateColumns();
+ }
+
+ refreshParcelItems();
+
+ // Get the canonical list from LLViewerMedia
+ LLViewerMedia* media_inst = LLViewerMedia::getInstance();
+ LLViewerMedia::impl_list impls = media_inst->getPriorityList();
+ LLViewerMedia::impl_list::iterator priority_iter;
+
+ U32 disabled_count = 0;
+
+ // iterate over the impl list, creating rows as necessary.
+ for(priority_iter = impls.begin(); priority_iter != impls.end(); priority_iter++)
+ {
+ LLViewerMediaImpl *impl = *priority_iter;
+
+ // If we just emptied out the list, every flag needs to be reset.
+ if(all_items_deleted)
+ {
+ impl->setInNearbyMediaList(false);
+ }
+
+ if (!impl->isParcelMedia())
+ {
+ LLUUID media_id = impl->getMediaTextureID();
+ S32 proximity = impl->getProximity();
+ // This is expensive (i.e. a linear search) -- don't use it here. We now use mInNearbyMediaList instead.
+ //S32 index = mMediaList->getItemIndex(media_id);
+ if (proximity < 0 || !shouldShow(impl))
+ {
+ if (impl->getInNearbyMediaList())
+ {
+ // There's a row for this impl -- remove it.
+ removeListItem(media_id);
+ impl->setInNearbyMediaList(false);
+ }
+ }
+ else
+ {
+ if (!impl->getInNearbyMediaList())
+ {
+ // We don't have a row for this impl -- add one.
+ addListItem(media_id);
+ impl->setInNearbyMediaList(true);
+ }
+ }
+ // Update counts
+ if (impl->isMediaDisabled())
+ {
+ disabled_count++;
+ }
+ }
+ }
+ mDisableAllCtrl->setEnabled((gSavedSettings.getBOOL("AudioStreamingMusic") ||
+ gSavedSettings.getBOOL("AudioStreamingMedia")) &&
+ (media_inst->isAnyMediaShowing() ||
+ media_inst->isParcelMediaPlaying() ||
+ media_inst->isParcelAudioPlaying()));
+
+ mEnableAllCtrl->setEnabled( (gSavedSettings.getBOOL("AudioStreamingMusic") ||
+ gSavedSettings.getBOOL("AudioStreamingMedia")) &&
+ (disabled_count > 0 ||
+ // parcel media (if we have it, and it isn't playing, enable "start")
+ (media_inst->hasParcelMedia() && ! media_inst->isParcelMediaPlaying()) ||
+ // parcel audio (if we have it, and it isn't playing, enable "start")
+ (media_inst->hasParcelAudio() && ! media_inst->isParcelAudioPlaying())));
+
+ // Iterate over the rows in the control, updating ones whose impl exists, and deleting ones whose impl has gone away.
+ std::vector<LLScrollListItem*> items = mMediaList->getAllData();
+
+ for (std::vector<LLScrollListItem*>::iterator item_it = items.begin();
+ item_it != items.end();
+ ++item_it)
+ {
+ LLScrollListItem* item = (*item_it);
+ LLUUID row_id = item->getUUID();
+
+ if (row_id != PARCEL_MEDIA_LIST_ITEM_UUID &&
+ row_id != PARCEL_AUDIO_LIST_ITEM_UUID)
+ {
+ LLViewerMediaImpl* impl = media_inst->getMediaImplFromTextureID(row_id);
+ if(impl)
+ {
+ updateListItem(item, impl);
+ }
+ else
+ {
+ // This item's impl has been deleted -- remove the row.
+ // Removing the row won't throw off our iteration, since we have a local copy of the array.
+ // We just need to make sure we don't access this item after the delete.
+ removeListItem(row_id);
+ }
+ }
+ }
+
+ // Set the selection to whatever media impl the media focus/hover is on.
+ // This is an experiment, and can be removed by ifdefing out these 4 lines.
+ LLUUID media_target = LLViewerMediaFocus::getInstance()->getControlsMediaID();
+ if(media_target.notNull())
+ {
+ mMediaList->selectByID(media_target);
+ }
}
void LLPanelNearByMedia::updateColumns()
{
- if (!mDebugInfoVisible)
- {
- if (mMediaList->getColumn(CHECKBOX_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(-1);
- if (mMediaList->getColumn(VISIBILITY_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(-1);
- if (mMediaList->getColumn(PROXIMITY_COLUMN)) mMediaList->getColumn(PROXIMITY_COLUMN)->setWidth(-1);
- if (mMediaList->getColumn(CLASS_COLUMN)) mMediaList->getColumn(CLASS_COLUMN)->setWidth(-1);
- if (mMediaList->getColumn(DEBUG_COLUMN)) mMediaList->getColumn(DEBUG_COLUMN)->setWidth(-1);
- }
- else {
- if (mMediaList->getColumn(CHECKBOX_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(20);
- if (mMediaList->getColumn(VISIBILITY_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(20);
- if (mMediaList->getColumn(PROXIMITY_COLUMN)) mMediaList->getColumn(PROXIMITY_COLUMN)->setWidth(30);
- if (mMediaList->getColumn(CLASS_COLUMN)) mMediaList->getColumn(CLASS_COLUMN)->setWidth(20);
- if (mMediaList->getColumn(DEBUG_COLUMN)) mMediaList->getColumn(DEBUG_COLUMN)->setWidth(200);
- }
+ if (!mDebugInfoVisible)
+ {
+ if (mMediaList->getColumn(CHECKBOX_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(-1);
+ if (mMediaList->getColumn(VISIBILITY_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(-1);
+ if (mMediaList->getColumn(PROXIMITY_COLUMN)) mMediaList->getColumn(PROXIMITY_COLUMN)->setWidth(-1);
+ if (mMediaList->getColumn(CLASS_COLUMN)) mMediaList->getColumn(CLASS_COLUMN)->setWidth(-1);
+ if (mMediaList->getColumn(DEBUG_COLUMN)) mMediaList->getColumn(DEBUG_COLUMN)->setWidth(-1);
+ }
+ else {
+ if (mMediaList->getColumn(CHECKBOX_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(20);
+ if (mMediaList->getColumn(VISIBILITY_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(20);
+ if (mMediaList->getColumn(PROXIMITY_COLUMN)) mMediaList->getColumn(PROXIMITY_COLUMN)->setWidth(30);
+ if (mMediaList->getColumn(CLASS_COLUMN)) mMediaList->getColumn(CLASS_COLUMN)->setWidth(20);
+ if (mMediaList->getColumn(DEBUG_COLUMN)) mMediaList->getColumn(DEBUG_COLUMN)->setWidth(200);
+ }
}
void LLPanelNearByMedia::onClickEnableAll()
{
- LLViewerMedia::getInstance()->setAllMediaEnabled(true);
+ LLViewerMedia::getInstance()->setAllMediaEnabled(true);
}
void LLPanelNearByMedia::onClickDisableAll()
{
- LLViewerMedia::getInstance()->setAllMediaEnabled(false);
+ LLViewerMedia::getInstance()->setAllMediaEnabled(false);
}
void LLPanelNearByMedia::onClickEnableParcelMedia()
-{
- if ( ! LLViewerMedia::getInstance()->isParcelMediaPlaying() )
- {
- LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
- }
+{
+ if ( ! LLViewerMedia::getInstance()->isParcelMediaPlaying() )
+ {
+ LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
+ }
}
void LLPanelNearByMedia::onClickDisableParcelMedia()
-{
- // This actually unloads the impl, as opposed to "stop"ping the media
- LLViewerParcelMedia::getInstance()->stop();
+{
+ // This actually unloads the impl, as opposed to "stop"ping the media
+ LLViewerParcelMedia::getInstance()->stop();
}
void LLPanelNearByMedia::onCheckItem(LLUICtrl* ctrl, const LLUUID &row_id)
-{
- LLCheckBoxCtrl* check = static_cast<LLCheckBoxCtrl*>(ctrl);
+{
+ LLCheckBoxCtrl* check = static_cast<LLCheckBoxCtrl*>(ctrl);
- setDisabled(row_id, ! check->getValue());
+ setDisabled(row_id, ! check->getValue());
}
bool LLPanelNearByMedia::setDisabled(const LLUUID &row_id, bool disabled)
{
- if (row_id == PARCEL_AUDIO_LIST_ITEM_UUID)
- {
- if (disabled)
- {
- onClickParcelAudioStop();
- }
- else
- {
- onClickParcelAudioPlay();
- }
- return true;
- }
- else if (row_id == PARCEL_MEDIA_LIST_ITEM_UUID)
- {
- if (disabled)
- {
- onClickDisableParcelMedia();
- }
- else
- {
- onClickEnableParcelMedia();
- }
- return true;
- }
- else {
- LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(row_id);
- if(impl)
- {
- impl->setDisabled(disabled, true);
- return true;
- }
- }
- return false;
+ if (row_id == PARCEL_AUDIO_LIST_ITEM_UUID)
+ {
+ if (disabled)
+ {
+ onClickParcelAudioStop();
+ }
+ else
+ {
+ onClickParcelAudioPlay();
+ }
+ return true;
+ }
+ else if (row_id == PARCEL_MEDIA_LIST_ITEM_UUID)
+ {
+ if (disabled)
+ {
+ onClickDisableParcelMedia();
+ }
+ else
+ {
+ onClickEnableParcelMedia();
+ }
+ return true;
+ }
+ else {
+ LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(row_id);
+ if(impl)
+ {
+ impl->setDisabled(disabled, true);
+ return true;
+ }
+ }
+ return false;
}
-
+
//static
void LLPanelNearByMedia::onZoomMedia(void* user_data)
{
- LLPanelNearByMedia* panelp = (LLPanelNearByMedia*)user_data;
- LLUUID media_id = panelp->mMediaList->getValue().asUUID();
-
- LLViewerMediaFocus::getInstance()->focusZoomOnMedia(media_id);
+ LLPanelNearByMedia* panelp = (LLPanelNearByMedia*)user_data;
+ LLUUID media_id = panelp->mMediaList->getValue().asUUID();
+
+ LLViewerMediaFocus::getInstance()->focusZoomOnMedia(media_id);
}
void LLPanelNearByMedia::onClickParcelMediaPlay()
{
- LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
+ LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
}
void LLPanelNearByMedia::onClickParcelMediaStop()
-{
- if (LLViewerParcelMedia::getInstance()->getParcelMedia())
- {
- // This stops the media playing, as opposed to unloading it like
- // LLViewerParcelMedia::stop() does
- LLViewerParcelMedia::getInstance()->getParcelMedia()->stop();
- }
+{
+ if (LLViewerParcelMedia::getInstance()->getParcelMedia())
+ {
+ // This stops the media playing, as opposed to unloading it like
+ // LLViewerParcelMedia::stop() does
+ LLViewerParcelMedia::getInstance()->getParcelMedia()->stop();
+ }
}
void LLPanelNearByMedia::onClickParcelMediaPause()
{
- LLViewerParcelMedia::getInstance()->pause();
+ LLViewerParcelMedia::getInstance()->pause();
}
void LLPanelNearByMedia::onClickParcelAudioPlay()
{
- // User *explicitly* started the internet stream, so keep the stream
- // playing and updated as they cross to other parcels etc.
- mParcelAudioAutoStart = true;
- if (!gAudiop)
- {
- LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
- return;
- }
-
- if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying())
- {
- // 'false' means unpause
- gAudiop->pauseInternetStream(false);
- }
- else
- {
- LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getInstance()->getParcelAudioURL());
- }
+ // User *explicitly* started the internet stream, so keep the stream
+ // playing and updated as they cross to other parcels etc.
+ mParcelAudioAutoStart = true;
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
+
+ if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying())
+ {
+ // 'false' means unpause
+ gAudiop->pauseInternetStream(false);
+ }
+ else
+ {
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getInstance()->getParcelAudioURL());
+ }
}
void LLPanelNearByMedia::onClickParcelAudioStop()
{
- // User *explicitly* stopped the internet stream, so don't
- // re-start audio when i.e. they move to another parcel, until
- // they explicitly start it again.
- mParcelAudioAutoStart = false;
- if (!gAudiop)
- {
- LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
- return;
- }
-
- LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
+ // User *explicitly* stopped the internet stream, so don't
+ // re-start audio when i.e. they move to another parcel, until
+ // they explicitly start it again.
+ mParcelAudioAutoStart = false;
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
+
+ LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
}
void LLPanelNearByMedia::onClickParcelAudioPause()
{
- if (!gAudiop)
- {
- LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
- return;
- }
-
- // 'true' means pause
- gAudiop->pauseInternetStream(true);
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
+
+ // 'true' means pause
+ gAudiop->pauseInternetStream(true);
}
bool LLPanelNearByMedia::shouldShow(LLViewerMediaImpl* impl)
-{
- const LLSD &choice_llsd = mShowCtrl->getSelectedValue();
- MediaClass choice = (MediaClass)choice_llsd.asInteger();
-
- switch (choice)
- {
- case MEDIA_CLASS_ALL:
- return true;
- break;
- case MEDIA_CLASS_WITHIN_PARCEL:
- return impl->isInAgentParcel();
- break;
- case MEDIA_CLASS_OUTSIDE_PARCEL:
- return ! impl->isInAgentParcel();
- break;
- case MEDIA_CLASS_ON_OTHERS:
- return impl->isAttachedToAnotherAvatar();
- break;
- default:
- break;
- }
- return true;
+{
+ const LLSD &choice_llsd = mShowCtrl->getSelectedValue();
+ MediaClass choice = (MediaClass)choice_llsd.asInteger();
+
+ switch (choice)
+ {
+ case MEDIA_CLASS_ALL:
+ return true;
+ break;
+ case MEDIA_CLASS_WITHIN_PARCEL:
+ return impl->isInAgentParcel();
+ break;
+ case MEDIA_CLASS_OUTSIDE_PARCEL:
+ return ! impl->isInAgentParcel();
+ break;
+ case MEDIA_CLASS_ON_OTHERS:
+ return impl->isAttachedToAnotherAvatar();
+ break;
+ default:
+ break;
+ }
+ return true;
}
void LLPanelNearByMedia::onAdvancedButtonClick()
-{
- // bring up the prefs floater
- LLFloaterPreference* prefsfloater = dynamic_cast<LLFloaterPreference*>(LLFloaterReg::showInstance("preferences"));
- if (prefsfloater)
- {
- // grab the 'audio' panel from the preferences floater and
- // bring it the front!
- LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
- LLPanel* audiopanel = prefsfloater->getChild<LLPanel>("audio");
- if (tabcontainer && audiopanel)
- {
- tabcontainer->selectTabPanel(audiopanel);
- }
- }
+{
+ // bring up the prefs floater
+ LLFloaterPreference* prefsfloater = dynamic_cast<LLFloaterPreference*>(LLFloaterReg::showInstance("preferences"));
+ if (prefsfloater)
+ {
+ // grab the 'audio' panel from the preferences floater and
+ // bring it the front!
+ LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
+ LLPanel* audiopanel = prefsfloater->getChild<LLPanel>("audio");
+ if (tabcontainer && audiopanel)
+ {
+ tabcontainer->selectTabPanel(audiopanel);
+ }
+ }
}
void LLPanelNearByMedia::onMoreLess()
{
- bool is_more = getChild<LLButton>("more_btn")->getToggleState();
- mNearbyMediaPanel->setVisible(is_more);
+ bool is_more = getChild<LLButton>("more_btn")->getToggleState();
+ mNearbyMediaPanel->setVisible(is_more);
- // enable resizing when expanded
- getChildView("resizebar_bottom")->setEnabled(is_more);
+ // enable resizing when expanded
+ getChildView("resizebar_bottom")->setEnabled(is_more);
- LLRect new_rect = is_more ? mMoreRect : mLessRect;
- new_rect.translate(getRect().mRight - new_rect.mRight, getRect().mTop - new_rect.mTop);
+ LLRect new_rect = is_more ? mMoreRect : mLessRect;
+ new_rect.translate(getRect().mRight - new_rect.mRight, getRect().mTop - new_rect.mTop);
- setShape(new_rect);
+ setShape(new_rect);
- getChild<LLUICtrl>("more_btn")->setVisible(true);
+ getChild<LLUICtrl>("more_btn")->setVisible(true);
}
void LLPanelNearByMedia::updateControls()
{
- LLUUID selected_media_id = mMediaList->getValue().asUUID();
- LLViewerMedia* media_inst = LLViewerMedia::getInstance();
-
- if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID)
- {
- if (!media_inst->getInstance()->hasParcelAudio() || !gSavedSettings.getBOOL("AudioStreamingMusic"))
- {
- // disable controls if audio streaming music is disabled from preference
- showDisabledControls();
- }
- else {
- showTimeBasedControls(media_inst->isParcelAudioPlaying(),
- false, // include_zoom
- false, // is_zoomed
- gSavedSettings.getBOOL("MuteMusic"),
- gSavedSettings.getF32("AudioLevelMusic") );
- }
- }
- else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID)
- {
- if (!media_inst->hasParcelMedia() || !gSavedSettings.getBOOL("AudioStreamingMedia"))
- {
- // disable controls if audio streaming media is disabled from preference
- showDisabledControls();
- }
- else {
- LLViewerMediaImpl* impl = LLViewerParcelMedia::getInstance()->getParcelMedia();
- if (NULL == impl)
- {
- // Just means it hasn't started yet
- showBasicControls(false, false, false, false, 0);
- }
- else if (impl->isMediaTimeBased())
- {
- showTimeBasedControls(impl->isMediaPlaying(),
- false, // include_zoom
- false, // is_zoomed
- impl->getVolume() == 0.0,
- impl->getVolume() );
- }
- else {
- // non-time-based parcel media
- showBasicControls(media_inst->isParcelMediaPlaying(),
- false,
- false,
- impl->getVolume() == 0.0,
- impl->getVolume());
- }
- }
- }
- else {
- LLViewerMediaImpl* impl = media_inst->getMediaImplFromTextureID(selected_media_id);
-
- if (NULL == impl || !gSavedSettings.getBOOL("AudioStreamingMedia"))
- {
- showDisabledControls();
- }
- else {
- if (impl->isMediaTimeBased())
- {
- showTimeBasedControls(impl->isMediaPlaying(),
- ! impl->isParcelMedia(), // include_zoom
- LLViewerMediaFocus::getInstance()->isZoomed(),
- impl->getVolume() == 0.0,
- impl->getVolume());
- }
- else {
- showBasicControls(!impl->isMediaDisabled(),
- ! impl->isParcelMedia(), // include_zoom
- LLViewerMediaFocus::getInstance()->isZoomedOnMedia(impl->getMediaTextureID()),
- impl->getVolume() == 0.0,
- impl->getVolume());
- }
- }
- }
+ LLUUID selected_media_id = mMediaList->getValue().asUUID();
+ LLViewerMedia* media_inst = LLViewerMedia::getInstance();
+
+ if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID)
+ {
+ if (!media_inst->getInstance()->hasParcelAudio() || !gSavedSettings.getBOOL("AudioStreamingMusic"))
+ {
+ // disable controls if audio streaming music is disabled from preference
+ showDisabledControls();
+ }
+ else {
+ showTimeBasedControls(media_inst->isParcelAudioPlaying(),
+ false, // include_zoom
+ false, // is_zoomed
+ gSavedSettings.getBOOL("MuteMusic"),
+ gSavedSettings.getF32("AudioLevelMusic") );
+ }
+ }
+ else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID)
+ {
+ if (!media_inst->hasParcelMedia() || !gSavedSettings.getBOOL("AudioStreamingMedia"))
+ {
+ // disable controls if audio streaming media is disabled from preference
+ showDisabledControls();
+ }
+ else {
+ LLViewerMediaImpl* impl = LLViewerParcelMedia::getInstance()->getParcelMedia();
+ if (NULL == impl)
+ {
+ // Just means it hasn't started yet
+ showBasicControls(false, false, false, false, 0);
+ }
+ else if (impl->isMediaTimeBased())
+ {
+ showTimeBasedControls(impl->isMediaPlaying(),
+ false, // include_zoom
+ false, // is_zoomed
+ impl->getVolume() == 0.0,
+ impl->getVolume() );
+ }
+ else {
+ // non-time-based parcel media
+ showBasicControls(media_inst->isParcelMediaPlaying(),
+ false,
+ false,
+ impl->getVolume() == 0.0,
+ impl->getVolume());
+ }
+ }
+ }
+ else {
+ LLViewerMediaImpl* impl = media_inst->getMediaImplFromTextureID(selected_media_id);
+
+ if (NULL == impl || !gSavedSettings.getBOOL("AudioStreamingMedia"))
+ {
+ showDisabledControls();
+ }
+ else {
+ if (impl->isMediaTimeBased())
+ {
+ showTimeBasedControls(impl->isMediaPlaying(),
+ ! impl->isParcelMedia(), // include_zoom
+ LLViewerMediaFocus::getInstance()->isZoomed(),
+ impl->getVolume() == 0.0,
+ impl->getVolume());
+ }
+ else {
+ showBasicControls(!impl->isMediaDisabled(),
+ ! impl->isParcelMedia(), // include_zoom
+ LLViewerMediaFocus::getInstance()->isZoomedOnMedia(impl->getMediaTextureID()),
+ impl->getVolume() == 0.0,
+ impl->getVolume());
+ }
+ }
+ }
}
void LLPanelNearByMedia::showBasicControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume)
{
- mStopCtrl->setVisible(playing);
- mPlayCtrl->setVisible(!playing);
- mPauseCtrl->setVisible(false);
- mVolumeSliderCtrl->setVisible(true);
- mMuteCtrl->setVisible(true);
- mMuteBtn->setValue(muted);
- mVolumeSlider->setValue(volume);
- mZoomCtrl->setVisible(include_zoom && !is_zoomed);
- mUnzoomCtrl->setVisible(include_zoom && is_zoomed);
- mStopCtrl->setEnabled(true);
- mZoomCtrl->setEnabled(true);
+ mStopCtrl->setVisible(playing);
+ mPlayCtrl->setVisible(!playing);
+ mPauseCtrl->setVisible(false);
+ mVolumeSliderCtrl->setVisible(true);
+ mMuteCtrl->setVisible(true);
+ mMuteBtn->setValue(muted);
+ mVolumeSlider->setValue(volume);
+ mZoomCtrl->setVisible(include_zoom && !is_zoomed);
+ mUnzoomCtrl->setVisible(include_zoom && is_zoomed);
+ mStopCtrl->setEnabled(true);
+ mZoomCtrl->setEnabled(true);
}
void LLPanelNearByMedia::showTimeBasedControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume)
{
- mStopCtrl->setVisible(true);
- mPlayCtrl->setVisible(!playing);
- mPauseCtrl->setVisible(playing);
- mMuteCtrl->setVisible(true);
- mVolumeSliderCtrl->setVisible(true);
- mZoomCtrl->setVisible(include_zoom);
- mZoomCtrl->setVisible(include_zoom && !is_zoomed);
- mUnzoomCtrl->setVisible(include_zoom && is_zoomed);
- mStopCtrl->setEnabled(true);
- mZoomCtrl->setEnabled(true);
- mMuteBtn->setValue(muted);
- mVolumeSlider->setValue(volume);
+ mStopCtrl->setVisible(true);
+ mPlayCtrl->setVisible(!playing);
+ mPauseCtrl->setVisible(playing);
+ mMuteCtrl->setVisible(true);
+ mVolumeSliderCtrl->setVisible(true);
+ mZoomCtrl->setVisible(include_zoom);
+ mZoomCtrl->setVisible(include_zoom && !is_zoomed);
+ mUnzoomCtrl->setVisible(include_zoom && is_zoomed);
+ mStopCtrl->setEnabled(true);
+ mZoomCtrl->setEnabled(true);
+ mMuteBtn->setValue(muted);
+ mVolumeSlider->setValue(volume);
}
void LLPanelNearByMedia::showDisabledControls()
{
- mStopCtrl->setVisible(true);
- mPlayCtrl->setVisible(false);
- mPauseCtrl->setVisible(false);
- mMuteCtrl->setVisible(false);
- mVolumeSliderCtrl->setVisible(false);
- mZoomCtrl->setVisible(true);
- mUnzoomCtrl->setVisible(false);
- mStopCtrl->setEnabled(false);
- mZoomCtrl->setEnabled(false);
+ mStopCtrl->setVisible(true);
+ mPlayCtrl->setVisible(false);
+ mPauseCtrl->setVisible(false);
+ mMuteCtrl->setVisible(false);
+ mVolumeSliderCtrl->setVisible(false);
+ mZoomCtrl->setVisible(true);
+ mUnzoomCtrl->setVisible(false);
+ mStopCtrl->setEnabled(false);
+ mZoomCtrl->setEnabled(false);
}
void LLPanelNearByMedia::onClickSelectedMediaStop()
{
- setDisabled(mMediaList->getValue().asUUID(), true);
+ setDisabled(mMediaList->getValue().asUUID(), true);
}
void LLPanelNearByMedia::onClickSelectedMediaPlay()
{
- LLUUID selected_media_id = mMediaList->getValue().asUUID();
-
- // First enable it
- setDisabled(selected_media_id, false);
-
- // Special code to make play "unpause" if time-based and playing
- if (selected_media_id != PARCEL_AUDIO_LIST_ITEM_UUID)
- {
- LLViewerMediaImpl *impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ?
- ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id);
- if (NULL != impl)
- {
- if (impl->isMediaTimeBased() && impl->isMediaPaused())
- {
- // Aha! It's really time-based media that's paused, so unpause
- impl->play();
- return;
- }
- else if (impl->isParcelMedia())
- {
- LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
- }
- }
- }
+ LLUUID selected_media_id = mMediaList->getValue().asUUID();
+
+ // First enable it
+ setDisabled(selected_media_id, false);
+
+ // Special code to make play "unpause" if time-based and playing
+ if (selected_media_id != PARCEL_AUDIO_LIST_ITEM_UUID)
+ {
+ LLViewerMediaImpl *impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ?
+ ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id);
+ if (NULL != impl)
+ {
+ if (impl->isMediaTimeBased() && impl->isMediaPaused())
+ {
+ // Aha! It's really time-based media that's paused, so unpause
+ impl->play();
+ return;
+ }
+ else if (impl->isParcelMedia())
+ {
+ LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
+ }
+ }
+ }
}
void LLPanelNearByMedia::onClickSelectedMediaPause()
{
- LLUUID selected_media_id = mMediaList->getValue().asUUID();
- if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID)
- {
- onClickParcelAudioPause();
- }
- else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID)
- {
- onClickParcelMediaPause();
- }
- else {
- LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id);
- if (NULL != impl && impl->isMediaTimeBased() && impl->isMediaPlaying())
- {
- impl->pause();
- }
- }
+ LLUUID selected_media_id = mMediaList->getValue().asUUID();
+ if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID)
+ {
+ onClickParcelAudioPause();
+ }
+ else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID)
+ {
+ onClickParcelMediaPause();
+ }
+ else {
+ LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id);
+ if (NULL != impl && impl->isMediaTimeBased() && impl->isMediaPlaying())
+ {
+ impl->pause();
+ }
+ }
}
void LLPanelNearByMedia::onClickSelectedMediaMute()
{
- LLUUID selected_media_id = mMediaList->getValue().asUUID();
- if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID)
- {
- gSavedSettings.setBOOL("MuteMusic", mMuteBtn->getValue());
- }
- else {
- LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ?
- ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id);
- if (NULL != impl)
- {
- F32 volume = impl->getVolume();
- if(volume > 0.0)
- {
- impl->setMute(true);
- }
- else if (mVolumeSlider->getValueF32() == 0.0)
- {
- impl->setMute(false);
- mVolumeSlider->setValue(impl->getVolume());
- }
- else
- {
- impl->setVolume(mVolumeSlider->getValueF32());
- }
- }
- }
+ LLUUID selected_media_id = mMediaList->getValue().asUUID();
+ if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID)
+ {
+ gSavedSettings.setBOOL("MuteMusic", mMuteBtn->getValue());
+ }
+ else {
+ LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ?
+ ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id);
+ if (NULL != impl)
+ {
+ F32 volume = impl->getVolume();
+ if(volume > 0.0)
+ {
+ impl->setMute(true);
+ }
+ else if (mVolumeSlider->getValueF32() == 0.0)
+ {
+ impl->setMute(false);
+ mVolumeSlider->setValue(impl->getVolume());
+ }
+ else
+ {
+ impl->setVolume(mVolumeSlider->getValueF32());
+ }
+ }
+ }
}
void LLPanelNearByMedia::onCommitSelectedMediaVolume()
{
- LLUUID selected_media_id = mMediaList->getValue().asUUID();
- if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID)
- {
- F32 vol = mVolumeSlider->getValueF32();
- gSavedSettings.setF32("AudioLevelMusic", vol);
- }
- else {
- LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ?
- ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id);
- if (NULL != impl)
- {
- impl->setVolume(mVolumeSlider->getValueF32());
- }
- }
+ LLUUID selected_media_id = mMediaList->getValue().asUUID();
+ if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID)
+ {
+ F32 vol = mVolumeSlider->getValueF32();
+ gSavedSettings.setF32("AudioLevelMusic", vol);
+ }
+ else {
+ LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ?
+ ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id);
+ if (NULL != impl)
+ {
+ impl->setVolume(mVolumeSlider->getValueF32());
+ }
+ }
}
void LLPanelNearByMedia::onClickSelectedMediaZoom()
{
- LLUUID selected_media_id = mMediaList->getValue().asUUID();
- if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID || selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID)
- return;
- LLViewerMediaFocus::getInstance()->focusZoomOnMedia(selected_media_id);
+ LLUUID selected_media_id = mMediaList->getValue().asUUID();
+ if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID || selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID)
+ return;
+ LLViewerMediaFocus::getInstance()->focusZoomOnMedia(selected_media_id);
}
void LLPanelNearByMedia::onClickSelectedMediaUnzoom()
{
- LLViewerMediaFocus::getInstance()->unZoom();
+ LLViewerMediaFocus::getInstance()->unZoom();
}
// static
void LLPanelNearByMedia::getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName)
{
- if (NULL == impl) return;
-
- name = impl->getName();
- url = impl->getCurrentMediaURL(); // This is the URL the media impl actually has loaded
- if (url.empty())
- {
- url = impl->getMediaEntryURL(); // This is the current URL from the media data
- }
- if (url.empty())
- {
- url = impl->getHomeURL(); // This is the home URL from the media data
- }
- if (name.empty())
- {
- name = url;
- }
- if (name.empty())
- {
- name = defaultName;
- }
+ if (NULL == impl) return;
+
+ name = impl->getName();
+ url = impl->getCurrentMediaURL(); // This is the URL the media impl actually has loaded
+ if (url.empty())
+ {
+ url = impl->getMediaEntryURL(); // This is the current URL from the media data
+ }
+ if (url.empty())
+ {
+ url = impl->getHomeURL(); // This is the home URL from the media data
+ }
+ if (name.empty())
+ {
+ name = url;
+ }
+ if (name.empty())
+ {
+ name = defaultName;
+ }
}
diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h
index 2d898d0aa1..703447d85a 100644
--- a/indra/newview/llpanelnearbymedia.h
+++ b/indra/newview/llpanelnearbymedia.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelnearbymedia.h
* @brief Management interface for muting and controlling nearby media
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,135 +42,135 @@ class LLViewerMediaImpl;
class LLPanelNearByMedia : public LLPanelPulldown
{
public:
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void draw();
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- // this is part of the nearby media *dialog* so we can track whether
- // the user *implicitly* wants audio on or off via their *explicit*
- // interaction with our buttons.
- bool getParcelAudioAutoStart();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+
+ // this is part of the nearby media *dialog* so we can track whether
+ // the user *implicitly* wants audio on or off via their *explicit*
+ // interaction with our buttons.
+ bool getParcelAudioAutoStart();
- // callback for when the auto play media preference changes
- // to update mParcelAudioAutoStart
- void handleMediaAutoPlayChanged(const LLSD& newvalue);
+ // callback for when the auto play media preference changes
+ // to update mParcelAudioAutoStart
+ void handleMediaAutoPlayChanged(const LLSD& newvalue);
- LLPanelNearByMedia();
- virtual ~LLPanelNearByMedia();
+ LLPanelNearByMedia();
+ virtual ~LLPanelNearByMedia();
private:
-
- enum ColumnIndex {
- CHECKBOX_COLUMN = 0,
- PROXIMITY_COLUMN = 1,
- VISIBILITY_COLUMN = 2,
- CLASS_COLUMN = 3,
- NAME_COLUMN = 4,
- DEBUG_COLUMN = 5
- };
-
- // Media "class" enumeration
- enum MediaClass {
- MEDIA_CLASS_ALL = 0,
- MEDIA_CLASS_FOCUSED = 1,
- MEDIA_CLASS_WITHIN_PARCEL = 2,
- MEDIA_CLASS_OUTSIDE_PARCEL = 3,
- MEDIA_CLASS_ON_OTHERS = 4
- };
-
- // Add/remove an LLViewerMediaImpl to/from the list
- LLScrollListItem* addListItem(const LLUUID &id);
- void updateListItem(LLScrollListItem* item, LLViewerMediaImpl* impl);
- void updateListItem(LLScrollListItem* item,
- const std::string &item_name,
- const std::string &item_tooltip,
- S32 proximity,
- bool is_disabled,
- bool has_media,
- bool is_time_based_and_playing,
- MediaClass media_class,
- const std::string &debug_str);
- void removeListItem(const LLUUID &id);
-
- // Refresh the list in the UI
- void refreshList();
-
- void refreshParcelItems();
-
- // UI Callbacks
- void onClickEnableAll();
- void onClickDisableAll();
- void onClickEnableParcelMedia();
- void onClickDisableParcelMedia();
- void onClickMuteParcelMedia();
- void onParcelMediaVolumeSlider();
- void onClickParcelMediaPlay();
- void onClickParcelMediaStop();
- void onClickParcelMediaPause();
- void onClickParcelAudioPlay();
- void onClickParcelAudioStop();
- void onClickParcelAudioPause();
- void onCheckAutoPlay();
- void onAdvancedButtonClick();
- void onMoreLess();
-
- void onCheckItem(LLUICtrl* ctrl, const LLUUID &row_id);
-
- static void onZoomMedia(void* user_data);
-
+
+ enum ColumnIndex {
+ CHECKBOX_COLUMN = 0,
+ PROXIMITY_COLUMN = 1,
+ VISIBILITY_COLUMN = 2,
+ CLASS_COLUMN = 3,
+ NAME_COLUMN = 4,
+ DEBUG_COLUMN = 5
+ };
+
+ // Media "class" enumeration
+ enum MediaClass {
+ MEDIA_CLASS_ALL = 0,
+ MEDIA_CLASS_FOCUSED = 1,
+ MEDIA_CLASS_WITHIN_PARCEL = 2,
+ MEDIA_CLASS_OUTSIDE_PARCEL = 3,
+ MEDIA_CLASS_ON_OTHERS = 4
+ };
+
+ // Add/remove an LLViewerMediaImpl to/from the list
+ LLScrollListItem* addListItem(const LLUUID &id);
+ void updateListItem(LLScrollListItem* item, LLViewerMediaImpl* impl);
+ void updateListItem(LLScrollListItem* item,
+ const std::string &item_name,
+ const std::string &item_tooltip,
+ S32 proximity,
+ bool is_disabled,
+ bool has_media,
+ bool is_time_based_and_playing,
+ MediaClass media_class,
+ const std::string &debug_str);
+ void removeListItem(const LLUUID &id);
+
+ // Refresh the list in the UI
+ void refreshList();
+
+ void refreshParcelItems();
+
+ // UI Callbacks
+ void onClickEnableAll();
+ void onClickDisableAll();
+ void onClickEnableParcelMedia();
+ void onClickDisableParcelMedia();
+ void onClickMuteParcelMedia();
+ void onParcelMediaVolumeSlider();
+ void onClickParcelMediaPlay();
+ void onClickParcelMediaStop();
+ void onClickParcelMediaPause();
+ void onClickParcelAudioPlay();
+ void onClickParcelAudioStop();
+ void onClickParcelAudioPause();
+ void onCheckAutoPlay();
+ void onAdvancedButtonClick();
+ void onMoreLess();
+
+ void onCheckItem(LLUICtrl* ctrl, const LLUUID &row_id);
+
+ static void onZoomMedia(void* user_data);
+
private:
- bool setDisabled(const LLUUID &id, bool disabled);
-
- static void getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName);
-
- void updateColumns();
-
- bool shouldShow(LLViewerMediaImpl* impl);
-
- void showBasicControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume);
- void showTimeBasedControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume);
- void showDisabledControls();
- void updateControls();
-
- void onClickSelectedMediaStop();
- void onClickSelectedMediaPlay();
- void onClickSelectedMediaPause();
- void onClickSelectedMediaMute();
- void onCommitSelectedMediaVolume();
- void onClickSelectedMediaZoom();
- void onClickSelectedMediaUnzoom();
-
- LLUICtrl* mNearbyMediaPanel;
- LLScrollListCtrl* mMediaList;
- LLUICtrl* mEnableAllCtrl;
- LLUICtrl* mDisableAllCtrl;
- LLComboBox* mShowCtrl;
-
- // Dynamic (selection-dependent) controls
- LLUICtrl* mStopCtrl;
- LLUICtrl* mPlayCtrl;
- LLUICtrl* mPauseCtrl;
- LLUICtrl* mMuteCtrl;
- LLUICtrl* mVolumeSliderCtrl;
- LLUICtrl* mZoomCtrl;
- LLUICtrl* mUnzoomCtrl;
- LLSlider* mVolumeSlider;
- LLButton* mMuteBtn;
-
- bool mAllMediaDisabled;
- bool mDebugInfoVisible;
- bool mParcelAudioAutoStart;
- std::string mEmptyNameString;
- std::string mPlayingString;
- std::string mParcelMediaName;
- std::string mParcelAudioName;
-
- LLRect mMoreRect;
- LLRect mLessRect;
- LLScrollListItem* mParcelMediaItem;
- LLScrollListItem* mParcelAudioItem;
+ bool setDisabled(const LLUUID &id, bool disabled);
+
+ static void getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName);
+
+ void updateColumns();
+
+ bool shouldShow(LLViewerMediaImpl* impl);
+
+ void showBasicControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume);
+ void showTimeBasedControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume);
+ void showDisabledControls();
+ void updateControls();
+
+ void onClickSelectedMediaStop();
+ void onClickSelectedMediaPlay();
+ void onClickSelectedMediaPause();
+ void onClickSelectedMediaMute();
+ void onCommitSelectedMediaVolume();
+ void onClickSelectedMediaZoom();
+ void onClickSelectedMediaUnzoom();
+
+ LLUICtrl* mNearbyMediaPanel;
+ LLScrollListCtrl* mMediaList;
+ LLUICtrl* mEnableAllCtrl;
+ LLUICtrl* mDisableAllCtrl;
+ LLComboBox* mShowCtrl;
+
+ // Dynamic (selection-dependent) controls
+ LLUICtrl* mStopCtrl;
+ LLUICtrl* mPlayCtrl;
+ LLUICtrl* mPauseCtrl;
+ LLUICtrl* mMuteCtrl;
+ LLUICtrl* mVolumeSliderCtrl;
+ LLUICtrl* mZoomCtrl;
+ LLUICtrl* mUnzoomCtrl;
+ LLSlider* mVolumeSlider;
+ LLButton* mMuteBtn;
+
+ bool mAllMediaDisabled;
+ bool mDebugInfoVisible;
+ bool mParcelAudioAutoStart;
+ std::string mEmptyNameString;
+ std::string mPlayingString;
+ std::string mParcelMediaName;
+ std::string mParcelAudioName;
+
+ LLRect mMoreRect;
+ LLRect mLessRect;
+ LLScrollListItem* mParcelMediaItem;
+ LLScrollListItem* mParcelAudioItem;
};
diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp
index 0704fc881d..e06333205f 100644
--- a/indra/newview/llpanelobject.cpp
+++ b/indra/newview/llpanelobject.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelobject.cpp
* @brief Object editing (position, scale, etc.) in the tools floater
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -73,228 +73,228 @@
// Constants
//
enum {
- MI_BOX,
- MI_CYLINDER,
- MI_PRISM,
- MI_SPHERE,
- MI_TORUS,
- MI_TUBE,
- MI_RING,
- MI_SCULPT,
- MI_NONE,
- MI_VOLUME_COUNT
+ MI_BOX,
+ MI_CYLINDER,
+ MI_PRISM,
+ MI_SPHERE,
+ MI_TORUS,
+ MI_TUBE,
+ MI_RING,
+ MI_SCULPT,
+ MI_NONE,
+ MI_VOLUME_COUNT
};
enum {
- MI_HOLE_SAME,
- MI_HOLE_CIRCLE,
- MI_HOLE_SQUARE,
- MI_HOLE_TRIANGLE,
- MI_HOLE_COUNT
+ MI_HOLE_SAME,
+ MI_HOLE_CIRCLE,
+ MI_HOLE_SQUARE,
+ MI_HOLE_TRIANGLE,
+ MI_HOLE_COUNT
};
const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters
//static const std::string LEGACY_FULLBRIGHT_DESC =LLTrans::getString("Fullbright");
-BOOL LLPanelObject::postBuild()
+BOOL LLPanelObject::postBuild()
{
- setMouseOpaque(FALSE);
-
- //--------------------------------------------------------
- // Top
- //--------------------------------------------------------
-
- // Lock checkbox
- mCheckLock = getChild<LLCheckBoxCtrl>("checkbox locked");
- childSetCommitCallback("checkbox locked",onCommitLock,this);
-
- // Physical checkbox
- mCheckPhysics = getChild<LLCheckBoxCtrl>("Physical Checkbox Ctrl");
- childSetCommitCallback("Physical Checkbox Ctrl",onCommitPhysics,this);
-
- // Temporary checkbox
- mCheckTemporary = getChild<LLCheckBoxCtrl>("Temporary Checkbox Ctrl");
- childSetCommitCallback("Temporary Checkbox Ctrl",onCommitTemporary,this);
-
- // Phantom checkbox
- mCheckPhantom = getChild<LLCheckBoxCtrl>("Phantom Checkbox Ctrl");
- childSetCommitCallback("Phantom Checkbox Ctrl",onCommitPhantom,this);
-
- // Position
- mMenuClipboardPos = getChild<LLMenuButton>("clipboard_pos_btn");
- mLabelPosition = getChild<LLTextBox>("label position");
- mCtrlPosX = getChild<LLSpinCtrl>("Pos X");
- childSetCommitCallback("Pos X",onCommitPosition,this);
- mCtrlPosY = getChild<LLSpinCtrl>("Pos Y");
- childSetCommitCallback("Pos Y",onCommitPosition,this);
- mCtrlPosZ = getChild<LLSpinCtrl>("Pos Z");
- childSetCommitCallback("Pos Z",onCommitPosition,this);
-
- // Scale
- mMenuClipboardSize = getChild<LLMenuButton>("clipboard_size_btn");
- mLabelSize = getChild<LLTextBox>("label size");
- mCtrlScaleX = getChild<LLSpinCtrl>("Scale X");
- childSetCommitCallback("Scale X",onCommitScale,this);
-
- // Scale Y
- mCtrlScaleY = getChild<LLSpinCtrl>("Scale Y");
- childSetCommitCallback("Scale Y",onCommitScale,this);
-
- // Scale Z
- mCtrlScaleZ = getChild<LLSpinCtrl>("Scale Z");
- childSetCommitCallback("Scale Z",onCommitScale,this);
-
- // Rotation
- mMenuClipboardRot = getChild<LLMenuButton>("clipboard_rot_btn");
- mLabelRotation = getChild<LLTextBox>("label rotation");
- mCtrlRotX = getChild<LLSpinCtrl>("Rot X");
- childSetCommitCallback("Rot X",onCommitRotation,this);
- mCtrlRotY = getChild<LLSpinCtrl>("Rot Y");
- childSetCommitCallback("Rot Y",onCommitRotation,this);
- mCtrlRotZ = getChild<LLSpinCtrl>("Rot Z");
- childSetCommitCallback("Rot Z",onCommitRotation,this);
-
- //--------------------------------------------------------
-
- // Base Type
- mComboBaseType = getChild<LLComboBox>("comboBaseType");
- childSetCommitCallback("comboBaseType",onCommitParametric,this);
-
- mMenuClipboardParams = getChild<LLMenuButton>("clipboard_obj_params_btn");
-
- // Cut
- mLabelCut = getChild<LLTextBox>("text cut");
- mSpinCutBegin = getChild<LLSpinCtrl>("cut begin");
- childSetCommitCallback("cut begin",onCommitParametric,this);
- mSpinCutBegin->setValidateBeforeCommit( precommitValidate );
- mSpinCutEnd = getChild<LLSpinCtrl>("cut end");
- childSetCommitCallback("cut end",onCommitParametric,this);
- mSpinCutEnd->setValidateBeforeCommit( &precommitValidate );
-
- // Hollow / Skew
- mLabelHollow = getChild<LLTextBox>("text hollow");
- mLabelSkew = getChild<LLTextBox>("text skew");
- mSpinHollow = getChild<LLSpinCtrl>("Scale 1");
- childSetCommitCallback("Scale 1",onCommitParametric,this);
- mSpinHollow->setValidateBeforeCommit( &precommitValidate );
- mSpinSkew = getChild<LLSpinCtrl>("Skew");
- childSetCommitCallback("Skew",onCommitParametric,this);
- mSpinSkew->setValidateBeforeCommit( &precommitValidate );
- mLabelHoleType = getChild<LLTextBox>("Hollow Shape");
-
- // Hole Type
- mComboHoleType = getChild<LLComboBox>("hole");
- childSetCommitCallback("hole",onCommitParametric,this);
-
- // Twist
- mLabelTwist = getChild<LLTextBox>("text twist");
- mSpinTwistBegin = getChild<LLSpinCtrl>("Twist Begin");
- childSetCommitCallback("Twist Begin",onCommitParametric,this);
- mSpinTwistBegin->setValidateBeforeCommit( precommitValidate );
- mSpinTwist = getChild<LLSpinCtrl>("Twist End");
- childSetCommitCallback("Twist End",onCommitParametric,this);
- mSpinTwist->setValidateBeforeCommit( &precommitValidate );
-
- // Scale
- mSpinScaleX = getChild<LLSpinCtrl>("Taper Scale X");
- childSetCommitCallback("Taper Scale X",onCommitParametric,this);
- mSpinScaleX->setValidateBeforeCommit( &precommitValidate );
- mSpinScaleY = getChild<LLSpinCtrl>("Taper Scale Y");
- childSetCommitCallback("Taper Scale Y",onCommitParametric,this);
- mSpinScaleY->setValidateBeforeCommit( &precommitValidate );
-
- // Shear
- mLabelShear = getChild<LLTextBox>("text topshear");
- mSpinShearX = getChild<LLSpinCtrl>("Shear X");
- childSetCommitCallback("Shear X",onCommitParametric,this);
- mSpinShearX->setValidateBeforeCommit( &precommitValidate );
- mSpinShearY = getChild<LLSpinCtrl>("Shear Y");
- childSetCommitCallback("Shear Y",onCommitParametric,this);
- mSpinShearY->setValidateBeforeCommit( &precommitValidate );
-
- // Path / Profile
- mCtrlPathBegin = getChild<LLSpinCtrl>("Path Limit Begin");
- childSetCommitCallback("Path Limit Begin",onCommitParametric,this);
- mCtrlPathBegin->setValidateBeforeCommit( &precommitValidate );
- mCtrlPathEnd = getChild<LLSpinCtrl>("Path Limit End");
- childSetCommitCallback("Path Limit End",onCommitParametric,this);
- mCtrlPathEnd->setValidateBeforeCommit( &precommitValidate );
-
- // Taper
- mLabelTaper = getChild<LLTextBox>("text taper2");
- mSpinTaperX = getChild<LLSpinCtrl>("Taper X");
- childSetCommitCallback("Taper X",onCommitParametric,this);
- mSpinTaperX->setValidateBeforeCommit( precommitValidate );
- mSpinTaperY = getChild<LLSpinCtrl>("Taper Y");
- childSetCommitCallback("Taper Y",onCommitParametric,this);
- mSpinTaperY->setValidateBeforeCommit( precommitValidate );
-
- // Radius Offset / Revolutions
- mLabelRadiusOffset = getChild<LLTextBox>("text radius delta");
- mLabelRevolutions = getChild<LLTextBox>("text revolutions");
- mSpinRadiusOffset = getChild<LLSpinCtrl>("Radius Offset");
- childSetCommitCallback("Radius Offset",onCommitParametric,this);
- mSpinRadiusOffset->setValidateBeforeCommit( &precommitValidate );
- mSpinRevolutions = getChild<LLSpinCtrl>("Revolutions");
- childSetCommitCallback("Revolutions",onCommitParametric,this);
- mSpinRevolutions->setValidateBeforeCommit( &precommitValidate );
-
- // Sculpt
- mCtrlSculptTexture = getChild<LLTextureCtrl>("sculpt texture control");
- if (mCtrlSculptTexture)
- {
- mCtrlSculptTexture->setDefaultImageAssetID(LLUUID(SCULPT_DEFAULT_TEXTURE));
- mCtrlSculptTexture->setCommitCallback( boost::bind(&LLPanelObject::onCommitSculpt, this, _2 ));
- mCtrlSculptTexture->setOnCancelCallback( boost::bind(&LLPanelObject::onCancelSculpt, this, _2 ));
- mCtrlSculptTexture->setOnSelectCallback( boost::bind(&LLPanelObject::onSelectSculpt, this, _2 ));
- mCtrlSculptTexture->setDropCallback( boost::bind(&LLPanelObject::onDropSculpt, this, _2 ));
- // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode
- mCtrlSculptTexture->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
- mCtrlSculptTexture->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
- LLAggregatePermissions texture_perms;
- if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms))
- {
- BOOL can_copy =
- texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY ||
- texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL;
- BOOL can_transfer =
- texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY ||
- texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL;
- mCtrlSculptTexture->setCanApplyImmediately(can_copy && can_transfer);
- }
- else
- {
- mCtrlSculptTexture->setCanApplyImmediately(FALSE);
- }
- }
-
- mLabelSculptType = getChild<LLTextBox>("label sculpt type");
- mCtrlSculptType = getChild<LLComboBox>("sculpt type control");
- childSetCommitCallback("sculpt type control", onCommitSculptType, this);
- mCtrlSculptMirror = getChild<LLCheckBoxCtrl>("sculpt mirror control");
- childSetCommitCallback("sculpt mirror control", onCommitSculptType, this);
- mCtrlSculptInvert = getChild<LLCheckBoxCtrl>("sculpt invert control");
- childSetCommitCallback("sculpt invert control", onCommitSculptType, this);
-
- // Start with everyone disabled
- clearCtrls();
-
- return TRUE;
+ setMouseOpaque(FALSE);
+
+ //--------------------------------------------------------
+ // Top
+ //--------------------------------------------------------
+
+ // Lock checkbox
+ mCheckLock = getChild<LLCheckBoxCtrl>("checkbox locked");
+ childSetCommitCallback("checkbox locked",onCommitLock,this);
+
+ // Physical checkbox
+ mCheckPhysics = getChild<LLCheckBoxCtrl>("Physical Checkbox Ctrl");
+ childSetCommitCallback("Physical Checkbox Ctrl",onCommitPhysics,this);
+
+ // Temporary checkbox
+ mCheckTemporary = getChild<LLCheckBoxCtrl>("Temporary Checkbox Ctrl");
+ childSetCommitCallback("Temporary Checkbox Ctrl",onCommitTemporary,this);
+
+ // Phantom checkbox
+ mCheckPhantom = getChild<LLCheckBoxCtrl>("Phantom Checkbox Ctrl");
+ childSetCommitCallback("Phantom Checkbox Ctrl",onCommitPhantom,this);
+
+ // Position
+ mMenuClipboardPos = getChild<LLMenuButton>("clipboard_pos_btn");
+ mLabelPosition = getChild<LLTextBox>("label position");
+ mCtrlPosX = getChild<LLSpinCtrl>("Pos X");
+ childSetCommitCallback("Pos X",onCommitPosition,this);
+ mCtrlPosY = getChild<LLSpinCtrl>("Pos Y");
+ childSetCommitCallback("Pos Y",onCommitPosition,this);
+ mCtrlPosZ = getChild<LLSpinCtrl>("Pos Z");
+ childSetCommitCallback("Pos Z",onCommitPosition,this);
+
+ // Scale
+ mMenuClipboardSize = getChild<LLMenuButton>("clipboard_size_btn");
+ mLabelSize = getChild<LLTextBox>("label size");
+ mCtrlScaleX = getChild<LLSpinCtrl>("Scale X");
+ childSetCommitCallback("Scale X",onCommitScale,this);
+
+ // Scale Y
+ mCtrlScaleY = getChild<LLSpinCtrl>("Scale Y");
+ childSetCommitCallback("Scale Y",onCommitScale,this);
+
+ // Scale Z
+ mCtrlScaleZ = getChild<LLSpinCtrl>("Scale Z");
+ childSetCommitCallback("Scale Z",onCommitScale,this);
+
+ // Rotation
+ mMenuClipboardRot = getChild<LLMenuButton>("clipboard_rot_btn");
+ mLabelRotation = getChild<LLTextBox>("label rotation");
+ mCtrlRotX = getChild<LLSpinCtrl>("Rot X");
+ childSetCommitCallback("Rot X",onCommitRotation,this);
+ mCtrlRotY = getChild<LLSpinCtrl>("Rot Y");
+ childSetCommitCallback("Rot Y",onCommitRotation,this);
+ mCtrlRotZ = getChild<LLSpinCtrl>("Rot Z");
+ childSetCommitCallback("Rot Z",onCommitRotation,this);
+
+ //--------------------------------------------------------
+
+ // Base Type
+ mComboBaseType = getChild<LLComboBox>("comboBaseType");
+ childSetCommitCallback("comboBaseType",onCommitParametric,this);
+
+ mMenuClipboardParams = getChild<LLMenuButton>("clipboard_obj_params_btn");
+
+ // Cut
+ mLabelCut = getChild<LLTextBox>("text cut");
+ mSpinCutBegin = getChild<LLSpinCtrl>("cut begin");
+ childSetCommitCallback("cut begin",onCommitParametric,this);
+ mSpinCutBegin->setValidateBeforeCommit( precommitValidate );
+ mSpinCutEnd = getChild<LLSpinCtrl>("cut end");
+ childSetCommitCallback("cut end",onCommitParametric,this);
+ mSpinCutEnd->setValidateBeforeCommit( &precommitValidate );
+
+ // Hollow / Skew
+ mLabelHollow = getChild<LLTextBox>("text hollow");
+ mLabelSkew = getChild<LLTextBox>("text skew");
+ mSpinHollow = getChild<LLSpinCtrl>("Scale 1");
+ childSetCommitCallback("Scale 1",onCommitParametric,this);
+ mSpinHollow->setValidateBeforeCommit( &precommitValidate );
+ mSpinSkew = getChild<LLSpinCtrl>("Skew");
+ childSetCommitCallback("Skew",onCommitParametric,this);
+ mSpinSkew->setValidateBeforeCommit( &precommitValidate );
+ mLabelHoleType = getChild<LLTextBox>("Hollow Shape");
+
+ // Hole Type
+ mComboHoleType = getChild<LLComboBox>("hole");
+ childSetCommitCallback("hole",onCommitParametric,this);
+
+ // Twist
+ mLabelTwist = getChild<LLTextBox>("text twist");
+ mSpinTwistBegin = getChild<LLSpinCtrl>("Twist Begin");
+ childSetCommitCallback("Twist Begin",onCommitParametric,this);
+ mSpinTwistBegin->setValidateBeforeCommit( precommitValidate );
+ mSpinTwist = getChild<LLSpinCtrl>("Twist End");
+ childSetCommitCallback("Twist End",onCommitParametric,this);
+ mSpinTwist->setValidateBeforeCommit( &precommitValidate );
+
+ // Scale
+ mSpinScaleX = getChild<LLSpinCtrl>("Taper Scale X");
+ childSetCommitCallback("Taper Scale X",onCommitParametric,this);
+ mSpinScaleX->setValidateBeforeCommit( &precommitValidate );
+ mSpinScaleY = getChild<LLSpinCtrl>("Taper Scale Y");
+ childSetCommitCallback("Taper Scale Y",onCommitParametric,this);
+ mSpinScaleY->setValidateBeforeCommit( &precommitValidate );
+
+ // Shear
+ mLabelShear = getChild<LLTextBox>("text topshear");
+ mSpinShearX = getChild<LLSpinCtrl>("Shear X");
+ childSetCommitCallback("Shear X",onCommitParametric,this);
+ mSpinShearX->setValidateBeforeCommit( &precommitValidate );
+ mSpinShearY = getChild<LLSpinCtrl>("Shear Y");
+ childSetCommitCallback("Shear Y",onCommitParametric,this);
+ mSpinShearY->setValidateBeforeCommit( &precommitValidate );
+
+ // Path / Profile
+ mCtrlPathBegin = getChild<LLSpinCtrl>("Path Limit Begin");
+ childSetCommitCallback("Path Limit Begin",onCommitParametric,this);
+ mCtrlPathBegin->setValidateBeforeCommit( &precommitValidate );
+ mCtrlPathEnd = getChild<LLSpinCtrl>("Path Limit End");
+ childSetCommitCallback("Path Limit End",onCommitParametric,this);
+ mCtrlPathEnd->setValidateBeforeCommit( &precommitValidate );
+
+ // Taper
+ mLabelTaper = getChild<LLTextBox>("text taper2");
+ mSpinTaperX = getChild<LLSpinCtrl>("Taper X");
+ childSetCommitCallback("Taper X",onCommitParametric,this);
+ mSpinTaperX->setValidateBeforeCommit( precommitValidate );
+ mSpinTaperY = getChild<LLSpinCtrl>("Taper Y");
+ childSetCommitCallback("Taper Y",onCommitParametric,this);
+ mSpinTaperY->setValidateBeforeCommit( precommitValidate );
+
+ // Radius Offset / Revolutions
+ mLabelRadiusOffset = getChild<LLTextBox>("text radius delta");
+ mLabelRevolutions = getChild<LLTextBox>("text revolutions");
+ mSpinRadiusOffset = getChild<LLSpinCtrl>("Radius Offset");
+ childSetCommitCallback("Radius Offset",onCommitParametric,this);
+ mSpinRadiusOffset->setValidateBeforeCommit( &precommitValidate );
+ mSpinRevolutions = getChild<LLSpinCtrl>("Revolutions");
+ childSetCommitCallback("Revolutions",onCommitParametric,this);
+ mSpinRevolutions->setValidateBeforeCommit( &precommitValidate );
+
+ // Sculpt
+ mCtrlSculptTexture = getChild<LLTextureCtrl>("sculpt texture control");
+ if (mCtrlSculptTexture)
+ {
+ mCtrlSculptTexture->setDefaultImageAssetID(LLUUID(SCULPT_DEFAULT_TEXTURE));
+ mCtrlSculptTexture->setCommitCallback( boost::bind(&LLPanelObject::onCommitSculpt, this, _2 ));
+ mCtrlSculptTexture->setOnCancelCallback( boost::bind(&LLPanelObject::onCancelSculpt, this, _2 ));
+ mCtrlSculptTexture->setOnSelectCallback( boost::bind(&LLPanelObject::onSelectSculpt, this, _2 ));
+ mCtrlSculptTexture->setDropCallback( boost::bind(&LLPanelObject::onDropSculpt, this, _2 ));
+ // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode
+ mCtrlSculptTexture->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ mCtrlSculptTexture->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
+ LLAggregatePermissions texture_perms;
+ if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms))
+ {
+ BOOL can_copy =
+ texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY ||
+ texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL;
+ BOOL can_transfer =
+ texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY ||
+ texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL;
+ mCtrlSculptTexture->setCanApplyImmediately(can_copy && can_transfer);
+ }
+ else
+ {
+ mCtrlSculptTexture->setCanApplyImmediately(FALSE);
+ }
+ }
+
+ mLabelSculptType = getChild<LLTextBox>("label sculpt type");
+ mCtrlSculptType = getChild<LLComboBox>("sculpt type control");
+ childSetCommitCallback("sculpt type control", onCommitSculptType, this);
+ mCtrlSculptMirror = getChild<LLCheckBoxCtrl>("sculpt mirror control");
+ childSetCommitCallback("sculpt mirror control", onCommitSculptType, this);
+ mCtrlSculptInvert = getChild<LLCheckBoxCtrl>("sculpt invert control");
+ childSetCommitCallback("sculpt invert control", onCommitSculptType, this);
+
+ // Start with everyone disabled
+ clearCtrls();
+
+ return TRUE;
}
LLPanelObject::LLPanelObject()
-: LLPanel(),
- mIsPhysical(FALSE),
- mIsTemporary(FALSE),
- mIsPhantom(FALSE),
- mSelectedType(MI_BOX),
- mSculptTextureRevert(LLUUID::null),
- mSculptTypeRevert(0),
+: LLPanel(),
+ mIsPhysical(FALSE),
+ mIsTemporary(FALSE),
+ mIsPhantom(FALSE),
+ mSelectedType(MI_BOX),
+ mSculptTextureRevert(LLUUID::null),
+ mSculptTypeRevert(0),
mHasClipboardPos(false),
mHasClipboardSize(false),
mHasClipboardRot(false),
- mSizeChanged(FALSE)
+ mSizeChanged(FALSE)
{
mCommitCallbackRegistrar.add("PanelObject.menuDoToSelected", boost::bind(&LLPanelObject::menuDoToSelected, this, _2));
mEnableCallbackRegistrar.add("PanelObject.menuEnable", boost::bind(&LLPanelObject::menuEnableItem, this, _2));
@@ -303,1388 +303,1388 @@ LLPanelObject::LLPanelObject()
LLPanelObject::~LLPanelObject()
{
- // Children all cleaned up by default view destructor.
+ // Children all cleaned up by default view destructor.
}
void LLPanelObject::getState( )
{
- LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
- LLViewerObject* root_objectp = objectp;
- if(!objectp)
- {
- objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
- // *FIX: shouldn't we just keep the child?
- if (objectp)
- {
- LLViewerObject* parentp = objectp->getRootEdit();
-
- if (parentp)
- {
- root_objectp = parentp;
- }
- else
- {
- root_objectp = objectp;
- }
- }
- }
-
- LLCalc* calcp = LLCalc::getInstance();
-
- LLVOVolume *volobjp = NULL;
- if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME))
- {
- volobjp = (LLVOVolume *)objectp;
- }
-
- if( !objectp )
- {
- //forfeit focus
- if (gFocusMgr.childHasKeyboardFocus(this))
- {
- gFocusMgr.setKeyboardFocus(NULL);
- }
-
- // Disable all text input fields
- clearCtrls();
- calcp->clearAllVariables();
- return;
- }
-
- S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
- BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ))
- && (selected_count == 1);
-
- bool enable_move;
- bool enable_modify;
-
- LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(enable_move, enable_modify);
-
- BOOL enable_scale = enable_modify;
- BOOL enable_rotate = enable_move; // already accounts for a case of children, which needs permModify() as well
-
- LLVector3 vec;
- if (enable_move)
- {
- vec = objectp->getPositionEdit();
- mCtrlPosX->set( vec.mV[VX] );
- mCtrlPosY->set( vec.mV[VY] );
- mCtrlPosZ->set( vec.mV[VZ] );
- calcp->setVar(LLCalc::X_POS, vec.mV[VX]);
- calcp->setVar(LLCalc::Y_POS, vec.mV[VY]);
- calcp->setVar(LLCalc::Z_POS, vec.mV[VZ]);
- }
- else
- {
- mCtrlPosX->clear();
- mCtrlPosY->clear();
- mCtrlPosZ->clear();
- calcp->clearVar(LLCalc::X_POS);
- calcp->clearVar(LLCalc::Y_POS);
- calcp->clearVar(LLCalc::Z_POS);
- }
-
- mMenuClipboardPos->setEnabled(enable_move);
- mLabelPosition->setEnabled( enable_move );
- mCtrlPosX->setEnabled(enable_move);
- mCtrlPosY->setEnabled(enable_move);
- mCtrlPosZ->setEnabled(enable_move);
-
- if (enable_scale)
- {
- vec = objectp->getScale();
- mCtrlScaleX->set( vec.mV[VX] );
- mCtrlScaleY->set( vec.mV[VY] );
- mCtrlScaleZ->set( vec.mV[VZ] );
- calcp->setVar(LLCalc::X_SCALE, vec.mV[VX]);
- calcp->setVar(LLCalc::Y_SCALE, vec.mV[VY]);
- calcp->setVar(LLCalc::Z_SCALE, vec.mV[VZ]);
- }
- else
- {
- mCtrlScaleX->clear();
- mCtrlScaleY->clear();
- mCtrlScaleZ->clear();
- calcp->setVar(LLCalc::X_SCALE, 0.f);
- calcp->setVar(LLCalc::Y_SCALE, 0.f);
- calcp->setVar(LLCalc::Z_SCALE, 0.f);
- }
-
- mMenuClipboardSize->setEnabled(enable_scale);
- mLabelSize->setEnabled( enable_scale );
- mCtrlScaleX->setEnabled( enable_scale );
- mCtrlScaleY->setEnabled( enable_scale );
- mCtrlScaleZ->setEnabled( enable_scale );
-
- LLQuaternion object_rot = objectp->getRotationEdit();
- object_rot.getEulerAngles(&(mCurEulerDegrees.mV[VX]), &(mCurEulerDegrees.mV[VY]), &(mCurEulerDegrees.mV[VZ]));
- mCurEulerDegrees *= RAD_TO_DEG;
- mCurEulerDegrees.mV[VX] = fmod(ll_round(mCurEulerDegrees.mV[VX], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
- mCurEulerDegrees.mV[VY] = fmod(ll_round(mCurEulerDegrees.mV[VY], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
- mCurEulerDegrees.mV[VZ] = fmod(ll_round(mCurEulerDegrees.mV[VZ], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
-
- if (enable_rotate)
- {
- mCtrlRotX->set( mCurEulerDegrees.mV[VX] );
- mCtrlRotY->set( mCurEulerDegrees.mV[VY] );
- mCtrlRotZ->set( mCurEulerDegrees.mV[VZ] );
- calcp->setVar(LLCalc::X_ROT, mCurEulerDegrees.mV[VX]);
- calcp->setVar(LLCalc::Y_ROT, mCurEulerDegrees.mV[VY]);
- calcp->setVar(LLCalc::Z_ROT, mCurEulerDegrees.mV[VZ]);
- }
- else
- {
- mCtrlRotX->clear();
- mCtrlRotY->clear();
- mCtrlRotZ->clear();
- calcp->clearVar(LLCalc::X_ROT);
- calcp->clearVar(LLCalc::Y_ROT);
- calcp->clearVar(LLCalc::Z_ROT);
- }
-
- mMenuClipboardRot->setEnabled(enable_rotate);
- mLabelRotation->setEnabled( enable_rotate );
- mCtrlRotX->setEnabled( enable_rotate );
- mCtrlRotY->setEnabled( enable_rotate );
- mCtrlRotZ->setEnabled( enable_rotate );
-
- LLUUID owner_id;
- std::string owner_name;
- LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
-
- // BUG? Check for all objects being editable?
- S32 roots_selected = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount();
- BOOL editable = root_objectp->permModify();
-
- BOOL is_flexible = volobjp && volobjp->isFlexible();
- BOOL is_permanent = root_objectp->flagObjectPermanent();
- BOOL is_permanent_enforced = root_objectp->isPermanentEnforced();
- BOOL is_character = root_objectp->flagCharacter();
- llassert(!is_permanent || !is_character); // should never have a permanent object that is also a character
-
- // Lock checkbox - only modifiable if you own the object.
- BOOL self_owned = (gAgent.getID() == owner_id);
- mCheckLock->setEnabled( roots_selected > 0 && self_owned && !is_permanent_enforced);
-
- // More lock and debit checkbox - get the values
- BOOL valid;
- U32 owner_mask_on;
- U32 owner_mask_off;
- valid = LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off);
-
- if(valid)
- {
- if(owner_mask_on & PERM_MOVE)
- {
- // owner can move, so not locked
- mCheckLock->set(FALSE);
- mCheckLock->setTentative(FALSE);
- }
- else if(owner_mask_off & PERM_MOVE)
- {
- // owner can't move, so locked
- mCheckLock->set(TRUE);
- mCheckLock->setTentative(FALSE);
- }
- else
- {
- // some locked, some not locked
- mCheckLock->set(FALSE);
- mCheckLock->setTentative(TRUE);
- }
- }
-
- // Physics checkbox
- mIsPhysical = root_objectp->flagUsePhysics();
- llassert(!is_permanent || !mIsPhysical); // should never have a permanent object that is also physical
-
- mCheckPhysics->set( mIsPhysical );
- mCheckPhysics->setEnabled( roots_selected>0
- && (editable || gAgent.isGodlike())
- && !is_flexible && !is_permanent);
-
- mIsTemporary = root_objectp->flagTemporaryOnRez();
- llassert(!is_permanent || !mIsTemporary); // should never has a permanent object that is also temporary
-
- mCheckTemporary->set( mIsTemporary );
- mCheckTemporary->setEnabled( roots_selected>0 && editable && !is_permanent);
-
- mIsPhantom = root_objectp->flagPhantom();
- BOOL is_volume_detect = root_objectp->flagVolumeDetect();
- llassert(!is_character || !mIsPhantom); // should never have a character that is also a phantom
- mCheckPhantom->set( mIsPhantom );
- mCheckPhantom->setEnabled( roots_selected>0 && editable && !is_flexible && !is_permanent_enforced && !is_character && !is_volume_detect);
-
- //----------------------------------------------------------------------------
-
- S32 selected_item = MI_BOX;
- S32 selected_hole = MI_HOLE_SAME;
- BOOL enabled = FALSE;
- BOOL hole_enabled = FALSE;
- F32 scale_x=1.f, scale_y=1.f;
- BOOL isMesh = FALSE;
-
- if( !objectp || !objectp->getVolume() || !editable || !single_volume)
- {
- // Clear out all geometry fields.
- mComboBaseType->clear();
- mSpinHollow->clear();
- mSpinCutBegin->clear();
- mSpinCutEnd->clear();
- mCtrlPathBegin->clear();
- mCtrlPathEnd->clear();
- mSpinScaleX->clear();
- mSpinScaleY->clear();
- mSpinTwist->clear();
- mSpinTwistBegin->clear();
- mComboHoleType->clear();
- mSpinShearX->clear();
- mSpinShearY->clear();
- mSpinTaperX->clear();
- mSpinTaperY->clear();
- mSpinRadiusOffset->clear();
- mSpinRevolutions->clear();
- mSpinSkew->clear();
-
- mSelectedType = MI_NONE;
- }
- else
- {
- // Only allowed to change these parameters for objects
- // that you have permissions on AND are not attachments.
- enabled = root_objectp->permModify() && !root_objectp->isPermanentEnforced();
-
- // Volume type
- const LLVolumeParams &volume_params = objectp->getVolume()->getParams();
- U8 path = volume_params.getPathParams().getCurveType();
- U8 profile_and_hole = volume_params.getProfileParams().getCurveType();
- U8 profile = profile_and_hole & LL_PCODE_PROFILE_MASK;
- U8 hole = profile_and_hole & LL_PCODE_HOLE_MASK;
-
- // Scale goes first so we can differentiate between a sphere and a torus,
- // which have the same profile and path types.
-
- // Scale
- scale_x = volume_params.getRatioX();
- scale_y = volume_params.getRatioY();
-
- BOOL linear_path = (path == LL_PCODE_PATH_LINE) || (path == LL_PCODE_PATH_FLEXIBLE);
- if ( linear_path && profile == LL_PCODE_PROFILE_CIRCLE )
- {
- selected_item = MI_CYLINDER;
- }
- else if ( linear_path && profile == LL_PCODE_PROFILE_SQUARE )
- {
- selected_item = MI_BOX;
- }
- else if ( linear_path && profile == LL_PCODE_PROFILE_ISOTRI )
- {
- selected_item = MI_PRISM;
- }
- else if ( linear_path && profile == LL_PCODE_PROFILE_EQUALTRI )
- {
- selected_item = MI_PRISM;
- }
- else if ( linear_path && profile == LL_PCODE_PROFILE_RIGHTTRI )
- {
- selected_item = MI_PRISM;
- }
- else if (path == LL_PCODE_PATH_FLEXIBLE) // shouldn't happen
- {
- selected_item = MI_CYLINDER; // reasonable default
- }
- else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_CIRCLE && scale_y > 0.75f)
- {
- selected_item = MI_SPHERE;
- }
- else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_CIRCLE && scale_y <= 0.75f)
- {
- selected_item = MI_TORUS;
- }
- else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_CIRCLE_HALF)
- {
- selected_item = MI_SPHERE;
- }
- else if ( path == LL_PCODE_PATH_CIRCLE2 && profile == LL_PCODE_PROFILE_CIRCLE )
- {
- // Spirals aren't supported. Make it into a sphere. JC
- selected_item = MI_SPHERE;
- }
- else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_EQUALTRI )
- {
- selected_item = MI_RING;
- }
- else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_SQUARE && scale_y <= 0.75f)
- {
- selected_item = MI_TUBE;
- }
- else
- {
- LL_INFOS("FloaterTools") << "Unknown path " << (S32) path << " profile " << (S32) profile << " in getState" << LL_ENDL;
- selected_item = MI_BOX;
- }
-
-
- if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT))
- {
- selected_item = MI_SCULPT;
- //LLFirstUse::useSculptedPrim();
- }
-
-
- mComboBaseType ->setCurrentByIndex( selected_item );
- mSelectedType = selected_item;
-
- // Grab S path
- F32 begin_s = volume_params.getBeginS();
- F32 end_s = volume_params.getEndS();
-
- // Compute cut and advanced cut from S and T
- F32 begin_t = volume_params.getBeginT();
- F32 end_t = volume_params.getEndT();
-
- // Hollowness
- F32 hollow = 100.f * volume_params.getHollow();
- mSpinHollow->set( hollow );
- calcp->setVar(LLCalc::HOLLOW, hollow);
- // All hollow objects allow a shape to be selected.
- if (hollow > 0.f)
- {
- switch (hole)
- {
- case LL_PCODE_HOLE_CIRCLE:
- selected_hole = MI_HOLE_CIRCLE;
- break;
- case LL_PCODE_HOLE_SQUARE:
- selected_hole = MI_HOLE_SQUARE;
- break;
- case LL_PCODE_HOLE_TRIANGLE:
- selected_hole = MI_HOLE_TRIANGLE;
- break;
- case LL_PCODE_HOLE_SAME:
- default:
- selected_hole = MI_HOLE_SAME;
- break;
- }
- mComboHoleType->setCurrentByIndex( selected_hole );
- hole_enabled = enabled;
- }
- else
- {
- mComboHoleType->setCurrentByIndex( MI_HOLE_SAME );
- hole_enabled = FALSE;
- }
-
- // Cut interpretation varies based on base object type
- F32 cut_begin, cut_end, adv_cut_begin, adv_cut_end;
-
- if ( selected_item == MI_SPHERE || selected_item == MI_TORUS ||
- selected_item == MI_TUBE || selected_item == MI_RING )
- {
- cut_begin = begin_t;
- cut_end = end_t;
- adv_cut_begin = begin_s;
- adv_cut_end = end_s;
- }
- else
- {
- cut_begin = begin_s;
- cut_end = end_s;
- adv_cut_begin = begin_t;
- adv_cut_end = end_t;
- }
-
- mSpinCutBegin ->set( cut_begin );
- mSpinCutEnd ->set( cut_end );
- mCtrlPathBegin ->set( adv_cut_begin );
- mCtrlPathEnd ->set( adv_cut_end );
- calcp->setVar(LLCalc::CUT_BEGIN, cut_begin);
- calcp->setVar(LLCalc::CUT_END, cut_end);
- calcp->setVar(LLCalc::PATH_BEGIN, adv_cut_begin);
- calcp->setVar(LLCalc::PATH_END, adv_cut_end);
-
- // Twist
- F32 twist = volume_params.getTwist();
- F32 twist_begin = volume_params.getTwistBegin();
- // Check the path type for conversion.
- if (path == LL_PCODE_PATH_LINE || path == LL_PCODE_PATH_FLEXIBLE)
- {
- twist *= OBJECT_TWIST_LINEAR_MAX;
- twist_begin *= OBJECT_TWIST_LINEAR_MAX;
- }
- else
- {
- twist *= OBJECT_TWIST_MAX;
- twist_begin *= OBJECT_TWIST_MAX;
- }
-
- mSpinTwist ->set( twist );
- mSpinTwistBegin ->set( twist_begin );
- calcp->setVar(LLCalc::TWIST_END, twist);
- calcp->setVar(LLCalc::TWIST_BEGIN, twist_begin);
-
- // Shear
- F32 shear_x = volume_params.getShearX();
- F32 shear_y = volume_params.getShearY();
- mSpinShearX->set( shear_x );
- mSpinShearY->set( shear_y );
- calcp->setVar(LLCalc::X_SHEAR, shear_x);
- calcp->setVar(LLCalc::Y_SHEAR, shear_y);
-
- // Taper
- F32 taper_x = volume_params.getTaperX();
- F32 taper_y = volume_params.getTaperY();
- mSpinTaperX->set( taper_x );
- mSpinTaperY->set( taper_y );
- calcp->setVar(LLCalc::X_TAPER, taper_x);
- calcp->setVar(LLCalc::Y_TAPER, taper_y);
-
- // Radius offset.
- F32 radius_offset = volume_params.getRadiusOffset();
- // Limit radius offset, based on taper and hole size y.
- F32 radius_mag = fabs(radius_offset);
- F32 hole_y_mag = fabs(scale_y);
- F32 taper_y_mag = fabs(taper_y);
- // Check to see if the taper effects us.
- if ( (radius_offset > 0.f && taper_y < 0.f) ||
- (radius_offset < 0.f && taper_y > 0.f) )
- {
- // The taper does not help increase the radius offset range.
- taper_y_mag = 0.f;
- }
- F32 max_radius_mag = 1.f - hole_y_mag * (1.f - taper_y_mag) / (1.f - hole_y_mag);
- // Enforce the maximum magnitude.
- if (radius_mag > max_radius_mag)
- {
- // Check radius offset sign.
- if (radius_offset < 0.f)
- {
- radius_offset = -max_radius_mag;
- }
- else
- {
- radius_offset = max_radius_mag;
- }
- }
- mSpinRadiusOffset->set( radius_offset);
- calcp->setVar(LLCalc::RADIUS_OFFSET, radius_offset);
-
- // Revolutions
- F32 revolutions = volume_params.getRevolutions();
- mSpinRevolutions->set( revolutions );
- calcp->setVar(LLCalc::REVOLUTIONS, revolutions);
-
- // Skew
- F32 skew = volume_params.getSkew();
- // Limit skew, based on revolutions hole size x.
- F32 skew_mag= fabs(skew);
- F32 min_skew_mag = 1.0f - 1.0f / (revolutions * scale_x + 1.0f);
- // Discontinuity; A revolution of 1 allows skews below 0.5.
- if ( fabs(revolutions - 1.0f) < 0.001)
- min_skew_mag = 0.0f;
-
- // Clip skew.
- if (skew_mag < min_skew_mag)
- {
- // Check skew sign.
- if (skew < 0.0f)
- {
- skew = -min_skew_mag;
- }
- else
- {
- skew = min_skew_mag;
- }
- }
- mSpinSkew->set( skew );
- calcp->setVar(LLCalc::SKEW, skew);
- }
-
- // Compute control visibility, label names, and twist range.
- // Start with defaults.
- BOOL cut_visible = TRUE;
- BOOL hollow_visible = TRUE;
- BOOL top_size_x_visible = TRUE;
- BOOL top_size_y_visible = TRUE;
- BOOL top_shear_x_visible = TRUE;
- BOOL top_shear_y_visible = TRUE;
- BOOL twist_visible = TRUE;
- BOOL advanced_cut_visible = FALSE;
- BOOL taper_visible = FALSE;
- BOOL skew_visible = FALSE;
- BOOL radius_offset_visible = FALSE;
- BOOL revolutions_visible = FALSE;
- BOOL sculpt_texture_visible = FALSE;
- F32 twist_min = OBJECT_TWIST_LINEAR_MIN;
- F32 twist_max = OBJECT_TWIST_LINEAR_MAX;
- F32 twist_inc = OBJECT_TWIST_LINEAR_INC;
-
- BOOL advanced_is_dimple = FALSE;
- BOOL advanced_is_slice = FALSE;
- BOOL size_is_hole = FALSE;
-
- // Tune based on overall volume type
- switch (selected_item)
- {
- case MI_SPHERE:
- top_size_x_visible = FALSE;
- top_size_y_visible = FALSE;
- top_shear_x_visible = FALSE;
- top_shear_y_visible = FALSE;
- //twist_visible = FALSE;
- advanced_cut_visible = TRUE;
- advanced_is_dimple = TRUE;
- twist_min = OBJECT_TWIST_MIN;
- twist_max = OBJECT_TWIST_MAX;
- twist_inc = OBJECT_TWIST_INC;
- break;
-
- case MI_TORUS:
- case MI_TUBE:
- case MI_RING:
- //top_size_x_visible = FALSE;
- //top_size_y_visible = FALSE;
- size_is_hole = TRUE;
- skew_visible = TRUE;
- advanced_cut_visible = TRUE;
- taper_visible = TRUE;
- radius_offset_visible = TRUE;
- revolutions_visible = TRUE;
- twist_min = OBJECT_TWIST_MIN;
- twist_max = OBJECT_TWIST_MAX;
- twist_inc = OBJECT_TWIST_INC;
-
- break;
-
- case MI_SCULPT:
- cut_visible = FALSE;
- hollow_visible = FALSE;
- twist_visible = FALSE;
- top_size_x_visible = FALSE;
- top_size_y_visible = FALSE;
- top_shear_x_visible = FALSE;
- top_shear_y_visible = FALSE;
- skew_visible = FALSE;
- advanced_cut_visible = FALSE;
- taper_visible = FALSE;
- radius_offset_visible = FALSE;
- revolutions_visible = FALSE;
- sculpt_texture_visible = TRUE;
-
- break;
-
- case MI_BOX:
- advanced_cut_visible = TRUE;
- advanced_is_slice = TRUE;
- break;
-
- case MI_CYLINDER:
- advanced_cut_visible = TRUE;
- advanced_is_slice = TRUE;
- break;
-
- case MI_PRISM:
- advanced_cut_visible = TRUE;
- advanced_is_slice = TRUE;
- break;
-
- default:
- break;
- }
-
- // Check if we need to change top size/hole size params.
- switch (selected_item)
- {
- case MI_SPHERE:
- case MI_TORUS:
- case MI_TUBE:
- case MI_RING:
- mSpinScaleX->set( scale_x );
- mSpinScaleY->set( scale_y );
- calcp->setVar(LLCalc::X_HOLE, scale_x);
- calcp->setVar(LLCalc::Y_HOLE, scale_y);
- mSpinScaleX->setMinValue(OBJECT_MIN_HOLE_SIZE);
- mSpinScaleX->setMaxValue(OBJECT_MAX_HOLE_SIZE_X);
- mSpinScaleY->setMinValue(OBJECT_MIN_HOLE_SIZE);
- mSpinScaleY->setMaxValue(OBJECT_MAX_HOLE_SIZE_Y);
- break;
- default:
- if (editable && single_volume)
- {
- mSpinScaleX->set( 1.f - scale_x );
- mSpinScaleY->set( 1.f - scale_y );
- mSpinScaleX->setMinValue(-1.f);
- mSpinScaleX->setMaxValue(1.f);
- mSpinScaleY->setMinValue(-1.f);
- mSpinScaleY->setMaxValue(1.f);
-
- // Torus' Hole Size is Box/Cyl/Prism's Taper
- calcp->setVar(LLCalc::X_TAPER, 1.f - scale_x);
- calcp->setVar(LLCalc::Y_TAPER, 1.f - scale_y);
-
- // Box/Cyl/Prism have no hole size
- calcp->setVar(LLCalc::X_HOLE, 0.f);
- calcp->setVar(LLCalc::Y_HOLE, 0.f);
- }
- break;
- }
-
- // Check if we need to limit the hollow based on the hole type.
- if ( selected_hole == MI_HOLE_SQUARE &&
- ( selected_item == MI_CYLINDER || selected_item == MI_TORUS ||
- selected_item == MI_PRISM || selected_item == MI_RING ||
- selected_item == MI_SPHERE ) )
- {
- mSpinHollow->setMinValue(0.f);
- mSpinHollow->setMaxValue(70.f);
- }
- else
- {
- mSpinHollow->setMinValue(0.f);
- mSpinHollow->setMaxValue(95.f);
- }
-
- // Update field enablement
- mComboBaseType ->setEnabled( enabled );
- mMenuClipboardParams->setEnabled(enabled);
-
- mLabelCut ->setEnabled( enabled );
- mSpinCutBegin ->setEnabled( enabled );
- mSpinCutEnd ->setEnabled( enabled );
-
- mLabelHollow ->setEnabled( enabled );
- mSpinHollow ->setEnabled( enabled );
- mLabelHoleType ->setEnabled( hole_enabled );
- mComboHoleType ->setEnabled( hole_enabled );
-
- mLabelTwist ->setEnabled( enabled );
- mSpinTwist ->setEnabled( enabled );
- mSpinTwistBegin ->setEnabled( enabled );
-
- mLabelSkew ->setEnabled( enabled );
- mSpinSkew ->setEnabled( enabled );
-
- getChildView("scale_hole")->setVisible( FALSE);
- getChildView("scale_taper")->setVisible( FALSE);
- if (top_size_x_visible || top_size_y_visible)
- {
- if (size_is_hole)
- {
- getChildView("scale_hole")->setVisible( TRUE);
- getChildView("scale_hole")->setEnabled(enabled);
- }
- else
- {
- getChildView("scale_taper")->setVisible( TRUE);
- getChildView("scale_taper")->setEnabled(enabled);
- }
- }
-
- mSpinScaleX ->setEnabled( enabled );
- mSpinScaleY ->setEnabled( enabled );
-
- mLabelShear ->setEnabled( enabled );
- mSpinShearX ->setEnabled( enabled );
- mSpinShearY ->setEnabled( enabled );
-
- getChildView("advanced_cut")->setVisible( FALSE);
- getChildView("advanced_dimple")->setVisible( FALSE);
- getChildView("advanced_slice")->setVisible( FALSE);
-
- if (advanced_cut_visible)
- {
- if (advanced_is_dimple)
- {
- getChildView("advanced_dimple")->setVisible( TRUE);
- getChildView("advanced_dimple")->setEnabled(enabled);
- }
-
- else if (advanced_is_slice)
- {
- getChildView("advanced_slice")->setVisible( TRUE);
- getChildView("advanced_slice")->setEnabled(enabled);
- }
- else
- {
- getChildView("advanced_cut")->setVisible( TRUE);
- getChildView("advanced_cut")->setEnabled(enabled);
- }
- }
-
- mCtrlPathBegin ->setEnabled( enabled );
- mCtrlPathEnd ->setEnabled( enabled );
-
- mLabelTaper ->setEnabled( enabled );
- mSpinTaperX ->setEnabled( enabled );
- mSpinTaperY ->setEnabled( enabled );
-
- mLabelRadiusOffset->setEnabled( enabled );
- mSpinRadiusOffset ->setEnabled( enabled );
-
- mLabelRevolutions->setEnabled( enabled );
- mSpinRevolutions ->setEnabled( enabled );
-
- // Update field visibility
- mLabelCut ->setVisible( cut_visible );
- mSpinCutBegin ->setVisible( cut_visible );
- mSpinCutEnd ->setVisible( cut_visible );
-
- mLabelHollow ->setVisible( hollow_visible );
- mSpinHollow ->setVisible( hollow_visible );
- mLabelHoleType ->setVisible( hollow_visible );
- mComboHoleType ->setVisible( hollow_visible );
-
- mLabelTwist ->setVisible( twist_visible );
- mSpinTwist ->setVisible( twist_visible );
- mSpinTwistBegin ->setVisible( twist_visible );
- mSpinTwist ->setMinValue( twist_min );
- mSpinTwist ->setMaxValue( twist_max );
- mSpinTwist ->setIncrement( twist_inc );
- mSpinTwistBegin ->setMinValue( twist_min );
- mSpinTwistBegin ->setMaxValue( twist_max );
- mSpinTwistBegin ->setIncrement( twist_inc );
-
- mSpinScaleX ->setVisible( top_size_x_visible );
- mSpinScaleY ->setVisible( top_size_y_visible );
-
- mLabelSkew ->setVisible( skew_visible );
- mSpinSkew ->setVisible( skew_visible );
-
- mLabelShear ->setVisible( top_shear_x_visible || top_shear_y_visible );
- mSpinShearX ->setVisible( top_shear_x_visible );
- mSpinShearY ->setVisible( top_shear_y_visible );
-
- mCtrlPathBegin ->setVisible( advanced_cut_visible );
- mCtrlPathEnd ->setVisible( advanced_cut_visible );
-
- mLabelTaper ->setVisible( taper_visible );
- mSpinTaperX ->setVisible( taper_visible );
- mSpinTaperY ->setVisible( taper_visible );
-
- mLabelRadiusOffset->setVisible( radius_offset_visible );
- mSpinRadiusOffset ->setVisible( radius_offset_visible );
-
- mLabelRevolutions->setVisible( revolutions_visible );
- mSpinRevolutions ->setVisible( revolutions_visible );
-
- mCtrlSculptTexture->setVisible(sculpt_texture_visible);
- mLabelSculptType->setVisible(sculpt_texture_visible);
- mCtrlSculptType->setVisible(sculpt_texture_visible);
-
-
- // sculpt texture
- if (selected_item == MI_SCULPT)
- {
-
-
- LLUUID id;
- LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
-
-
- if (sculpt_params) // if we have a legal sculpt param block for this object:
- {
- if (mObject != objectp) // we've just selected a new object, so save for undo
- {
- mSculptTextureRevert = sculpt_params->getSculptTexture();
- mSculptTypeRevert = sculpt_params->getSculptType();
- }
-
- U8 sculpt_type = sculpt_params->getSculptType();
- U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK;
- BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT;
- BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR;
- isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH);
-
- LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control");
- if(mTextureCtrl)
- {
- mTextureCtrl->setTentative(FALSE);
- mTextureCtrl->setEnabled(editable && !isMesh);
- if (editable)
- mTextureCtrl->setImageAssetID(sculpt_params->getSculptTexture());
- else
- mTextureCtrl->setImageAssetID(LLUUID::null);
- }
-
- mComboBaseType->setEnabled(!isMesh);
- mMenuClipboardParams->setEnabled(!isMesh);
-
- if (mCtrlSculptType)
- {
- if (sculpt_stitching == LL_SCULPT_TYPE_NONE)
- {
- // since 'None' is no longer an option in the combo box
- // use 'Plane' as an equivalent sculpt type
- mCtrlSculptType->setSelectedByValue(LLSD(LL_SCULPT_TYPE_PLANE), true);
- }
- else
- {
- mCtrlSculptType->setSelectedByValue(LLSD(sculpt_stitching), true);
- }
- mCtrlSculptType->setEnabled(editable && !isMesh);
- }
-
- if (mCtrlSculptMirror)
- {
- mCtrlSculptMirror->set(sculpt_mirror);
- mCtrlSculptMirror->setEnabled(editable && !isMesh);
- }
-
- if (mCtrlSculptInvert)
- {
- mCtrlSculptInvert->set(sculpt_invert);
- mCtrlSculptInvert->setEnabled(editable);
- }
-
- if (mLabelSculptType)
- {
- mLabelSculptType->setEnabled(TRUE);
- }
-
- }
- }
- else
- {
- mSculptTextureRevert = LLUUID::null;
- }
-
- mCtrlSculptMirror->setVisible(sculpt_texture_visible && !isMesh);
- mCtrlSculptInvert->setVisible(sculpt_texture_visible && !isMesh);
-
- //----------------------------------------------------------------------------
-
- mObject = objectp;
- mRootObject = root_objectp;
+ LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
+ LLViewerObject* root_objectp = objectp;
+ if(!objectp)
+ {
+ objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
+ // *FIX: shouldn't we just keep the child?
+ if (objectp)
+ {
+ LLViewerObject* parentp = objectp->getRootEdit();
+
+ if (parentp)
+ {
+ root_objectp = parentp;
+ }
+ else
+ {
+ root_objectp = objectp;
+ }
+ }
+ }
+
+ LLCalc* calcp = LLCalc::getInstance();
+
+ LLVOVolume *volobjp = NULL;
+ if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME))
+ {
+ volobjp = (LLVOVolume *)objectp;
+ }
+
+ if( !objectp )
+ {
+ //forfeit focus
+ if (gFocusMgr.childHasKeyboardFocus(this))
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+
+ // Disable all text input fields
+ clearCtrls();
+ calcp->clearAllVariables();
+ return;
+ }
+
+ S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
+ BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ))
+ && (selected_count == 1);
+
+ bool enable_move;
+ bool enable_modify;
+
+ LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(enable_move, enable_modify);
+
+ BOOL enable_scale = enable_modify;
+ BOOL enable_rotate = enable_move; // already accounts for a case of children, which needs permModify() as well
+
+ LLVector3 vec;
+ if (enable_move)
+ {
+ vec = objectp->getPositionEdit();
+ mCtrlPosX->set( vec.mV[VX] );
+ mCtrlPosY->set( vec.mV[VY] );
+ mCtrlPosZ->set( vec.mV[VZ] );
+ calcp->setVar(LLCalc::X_POS, vec.mV[VX]);
+ calcp->setVar(LLCalc::Y_POS, vec.mV[VY]);
+ calcp->setVar(LLCalc::Z_POS, vec.mV[VZ]);
+ }
+ else
+ {
+ mCtrlPosX->clear();
+ mCtrlPosY->clear();
+ mCtrlPosZ->clear();
+ calcp->clearVar(LLCalc::X_POS);
+ calcp->clearVar(LLCalc::Y_POS);
+ calcp->clearVar(LLCalc::Z_POS);
+ }
+
+ mMenuClipboardPos->setEnabled(enable_move);
+ mLabelPosition->setEnabled( enable_move );
+ mCtrlPosX->setEnabled(enable_move);
+ mCtrlPosY->setEnabled(enable_move);
+ mCtrlPosZ->setEnabled(enable_move);
+
+ if (enable_scale)
+ {
+ vec = objectp->getScale();
+ mCtrlScaleX->set( vec.mV[VX] );
+ mCtrlScaleY->set( vec.mV[VY] );
+ mCtrlScaleZ->set( vec.mV[VZ] );
+ calcp->setVar(LLCalc::X_SCALE, vec.mV[VX]);
+ calcp->setVar(LLCalc::Y_SCALE, vec.mV[VY]);
+ calcp->setVar(LLCalc::Z_SCALE, vec.mV[VZ]);
+ }
+ else
+ {
+ mCtrlScaleX->clear();
+ mCtrlScaleY->clear();
+ mCtrlScaleZ->clear();
+ calcp->setVar(LLCalc::X_SCALE, 0.f);
+ calcp->setVar(LLCalc::Y_SCALE, 0.f);
+ calcp->setVar(LLCalc::Z_SCALE, 0.f);
+ }
+
+ mMenuClipboardSize->setEnabled(enable_scale);
+ mLabelSize->setEnabled( enable_scale );
+ mCtrlScaleX->setEnabled( enable_scale );
+ mCtrlScaleY->setEnabled( enable_scale );
+ mCtrlScaleZ->setEnabled( enable_scale );
+
+ LLQuaternion object_rot = objectp->getRotationEdit();
+ object_rot.getEulerAngles(&(mCurEulerDegrees.mV[VX]), &(mCurEulerDegrees.mV[VY]), &(mCurEulerDegrees.mV[VZ]));
+ mCurEulerDegrees *= RAD_TO_DEG;
+ mCurEulerDegrees.mV[VX] = fmod(ll_round(mCurEulerDegrees.mV[VX], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
+ mCurEulerDegrees.mV[VY] = fmod(ll_round(mCurEulerDegrees.mV[VY], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
+ mCurEulerDegrees.mV[VZ] = fmod(ll_round(mCurEulerDegrees.mV[VZ], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
+
+ if (enable_rotate)
+ {
+ mCtrlRotX->set( mCurEulerDegrees.mV[VX] );
+ mCtrlRotY->set( mCurEulerDegrees.mV[VY] );
+ mCtrlRotZ->set( mCurEulerDegrees.mV[VZ] );
+ calcp->setVar(LLCalc::X_ROT, mCurEulerDegrees.mV[VX]);
+ calcp->setVar(LLCalc::Y_ROT, mCurEulerDegrees.mV[VY]);
+ calcp->setVar(LLCalc::Z_ROT, mCurEulerDegrees.mV[VZ]);
+ }
+ else
+ {
+ mCtrlRotX->clear();
+ mCtrlRotY->clear();
+ mCtrlRotZ->clear();
+ calcp->clearVar(LLCalc::X_ROT);
+ calcp->clearVar(LLCalc::Y_ROT);
+ calcp->clearVar(LLCalc::Z_ROT);
+ }
+
+ mMenuClipboardRot->setEnabled(enable_rotate);
+ mLabelRotation->setEnabled( enable_rotate );
+ mCtrlRotX->setEnabled( enable_rotate );
+ mCtrlRotY->setEnabled( enable_rotate );
+ mCtrlRotZ->setEnabled( enable_rotate );
+
+ LLUUID owner_id;
+ std::string owner_name;
+ LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
+
+ // BUG? Check for all objects being editable?
+ S32 roots_selected = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount();
+ BOOL editable = root_objectp->permModify();
+
+ BOOL is_flexible = volobjp && volobjp->isFlexible();
+ BOOL is_permanent = root_objectp->flagObjectPermanent();
+ BOOL is_permanent_enforced = root_objectp->isPermanentEnforced();
+ BOOL is_character = root_objectp->flagCharacter();
+ llassert(!is_permanent || !is_character); // should never have a permanent object that is also a character
+
+ // Lock checkbox - only modifiable if you own the object.
+ BOOL self_owned = (gAgent.getID() == owner_id);
+ mCheckLock->setEnabled( roots_selected > 0 && self_owned && !is_permanent_enforced);
+
+ // More lock and debit checkbox - get the values
+ BOOL valid;
+ U32 owner_mask_on;
+ U32 owner_mask_off;
+ valid = LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off);
+
+ if(valid)
+ {
+ if(owner_mask_on & PERM_MOVE)
+ {
+ // owner can move, so not locked
+ mCheckLock->set(FALSE);
+ mCheckLock->setTentative(FALSE);
+ }
+ else if(owner_mask_off & PERM_MOVE)
+ {
+ // owner can't move, so locked
+ mCheckLock->set(TRUE);
+ mCheckLock->setTentative(FALSE);
+ }
+ else
+ {
+ // some locked, some not locked
+ mCheckLock->set(FALSE);
+ mCheckLock->setTentative(TRUE);
+ }
+ }
+
+ // Physics checkbox
+ mIsPhysical = root_objectp->flagUsePhysics();
+ llassert(!is_permanent || !mIsPhysical); // should never have a permanent object that is also physical
+
+ mCheckPhysics->set( mIsPhysical );
+ mCheckPhysics->setEnabled( roots_selected>0
+ && (editable || gAgent.isGodlike())
+ && !is_flexible && !is_permanent);
+
+ mIsTemporary = root_objectp->flagTemporaryOnRez();
+ llassert(!is_permanent || !mIsTemporary); // should never has a permanent object that is also temporary
+
+ mCheckTemporary->set( mIsTemporary );
+ mCheckTemporary->setEnabled( roots_selected>0 && editable && !is_permanent);
+
+ mIsPhantom = root_objectp->flagPhantom();
+ BOOL is_volume_detect = root_objectp->flagVolumeDetect();
+ llassert(!is_character || !mIsPhantom); // should never have a character that is also a phantom
+ mCheckPhantom->set( mIsPhantom );
+ mCheckPhantom->setEnabled( roots_selected>0 && editable && !is_flexible && !is_permanent_enforced && !is_character && !is_volume_detect);
+
+ //----------------------------------------------------------------------------
+
+ S32 selected_item = MI_BOX;
+ S32 selected_hole = MI_HOLE_SAME;
+ BOOL enabled = FALSE;
+ BOOL hole_enabled = FALSE;
+ F32 scale_x=1.f, scale_y=1.f;
+ BOOL isMesh = FALSE;
+
+ if( !objectp || !objectp->getVolume() || !editable || !single_volume)
+ {
+ // Clear out all geometry fields.
+ mComboBaseType->clear();
+ mSpinHollow->clear();
+ mSpinCutBegin->clear();
+ mSpinCutEnd->clear();
+ mCtrlPathBegin->clear();
+ mCtrlPathEnd->clear();
+ mSpinScaleX->clear();
+ mSpinScaleY->clear();
+ mSpinTwist->clear();
+ mSpinTwistBegin->clear();
+ mComboHoleType->clear();
+ mSpinShearX->clear();
+ mSpinShearY->clear();
+ mSpinTaperX->clear();
+ mSpinTaperY->clear();
+ mSpinRadiusOffset->clear();
+ mSpinRevolutions->clear();
+ mSpinSkew->clear();
+
+ mSelectedType = MI_NONE;
+ }
+ else
+ {
+ // Only allowed to change these parameters for objects
+ // that you have permissions on AND are not attachments.
+ enabled = root_objectp->permModify() && !root_objectp->isPermanentEnforced();
+
+ // Volume type
+ const LLVolumeParams &volume_params = objectp->getVolume()->getParams();
+ U8 path = volume_params.getPathParams().getCurveType();
+ U8 profile_and_hole = volume_params.getProfileParams().getCurveType();
+ U8 profile = profile_and_hole & LL_PCODE_PROFILE_MASK;
+ U8 hole = profile_and_hole & LL_PCODE_HOLE_MASK;
+
+ // Scale goes first so we can differentiate between a sphere and a torus,
+ // which have the same profile and path types.
+
+ // Scale
+ scale_x = volume_params.getRatioX();
+ scale_y = volume_params.getRatioY();
+
+ BOOL linear_path = (path == LL_PCODE_PATH_LINE) || (path == LL_PCODE_PATH_FLEXIBLE);
+ if ( linear_path && profile == LL_PCODE_PROFILE_CIRCLE )
+ {
+ selected_item = MI_CYLINDER;
+ }
+ else if ( linear_path && profile == LL_PCODE_PROFILE_SQUARE )
+ {
+ selected_item = MI_BOX;
+ }
+ else if ( linear_path && profile == LL_PCODE_PROFILE_ISOTRI )
+ {
+ selected_item = MI_PRISM;
+ }
+ else if ( linear_path && profile == LL_PCODE_PROFILE_EQUALTRI )
+ {
+ selected_item = MI_PRISM;
+ }
+ else if ( linear_path && profile == LL_PCODE_PROFILE_RIGHTTRI )
+ {
+ selected_item = MI_PRISM;
+ }
+ else if (path == LL_PCODE_PATH_FLEXIBLE) // shouldn't happen
+ {
+ selected_item = MI_CYLINDER; // reasonable default
+ }
+ else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_CIRCLE && scale_y > 0.75f)
+ {
+ selected_item = MI_SPHERE;
+ }
+ else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_CIRCLE && scale_y <= 0.75f)
+ {
+ selected_item = MI_TORUS;
+ }
+ else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_CIRCLE_HALF)
+ {
+ selected_item = MI_SPHERE;
+ }
+ else if ( path == LL_PCODE_PATH_CIRCLE2 && profile == LL_PCODE_PROFILE_CIRCLE )
+ {
+ // Spirals aren't supported. Make it into a sphere. JC
+ selected_item = MI_SPHERE;
+ }
+ else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_EQUALTRI )
+ {
+ selected_item = MI_RING;
+ }
+ else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_SQUARE && scale_y <= 0.75f)
+ {
+ selected_item = MI_TUBE;
+ }
+ else
+ {
+ LL_INFOS("FloaterTools") << "Unknown path " << (S32) path << " profile " << (S32) profile << " in getState" << LL_ENDL;
+ selected_item = MI_BOX;
+ }
+
+
+ if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT))
+ {
+ selected_item = MI_SCULPT;
+ //LLFirstUse::useSculptedPrim();
+ }
+
+
+ mComboBaseType ->setCurrentByIndex( selected_item );
+ mSelectedType = selected_item;
+
+ // Grab S path
+ F32 begin_s = volume_params.getBeginS();
+ F32 end_s = volume_params.getEndS();
+
+ // Compute cut and advanced cut from S and T
+ F32 begin_t = volume_params.getBeginT();
+ F32 end_t = volume_params.getEndT();
+
+ // Hollowness
+ F32 hollow = 100.f * volume_params.getHollow();
+ mSpinHollow->set( hollow );
+ calcp->setVar(LLCalc::HOLLOW, hollow);
+ // All hollow objects allow a shape to be selected.
+ if (hollow > 0.f)
+ {
+ switch (hole)
+ {
+ case LL_PCODE_HOLE_CIRCLE:
+ selected_hole = MI_HOLE_CIRCLE;
+ break;
+ case LL_PCODE_HOLE_SQUARE:
+ selected_hole = MI_HOLE_SQUARE;
+ break;
+ case LL_PCODE_HOLE_TRIANGLE:
+ selected_hole = MI_HOLE_TRIANGLE;
+ break;
+ case LL_PCODE_HOLE_SAME:
+ default:
+ selected_hole = MI_HOLE_SAME;
+ break;
+ }
+ mComboHoleType->setCurrentByIndex( selected_hole );
+ hole_enabled = enabled;
+ }
+ else
+ {
+ mComboHoleType->setCurrentByIndex( MI_HOLE_SAME );
+ hole_enabled = FALSE;
+ }
+
+ // Cut interpretation varies based on base object type
+ F32 cut_begin, cut_end, adv_cut_begin, adv_cut_end;
+
+ if ( selected_item == MI_SPHERE || selected_item == MI_TORUS ||
+ selected_item == MI_TUBE || selected_item == MI_RING )
+ {
+ cut_begin = begin_t;
+ cut_end = end_t;
+ adv_cut_begin = begin_s;
+ adv_cut_end = end_s;
+ }
+ else
+ {
+ cut_begin = begin_s;
+ cut_end = end_s;
+ adv_cut_begin = begin_t;
+ adv_cut_end = end_t;
+ }
+
+ mSpinCutBegin ->set( cut_begin );
+ mSpinCutEnd ->set( cut_end );
+ mCtrlPathBegin ->set( adv_cut_begin );
+ mCtrlPathEnd ->set( adv_cut_end );
+ calcp->setVar(LLCalc::CUT_BEGIN, cut_begin);
+ calcp->setVar(LLCalc::CUT_END, cut_end);
+ calcp->setVar(LLCalc::PATH_BEGIN, adv_cut_begin);
+ calcp->setVar(LLCalc::PATH_END, adv_cut_end);
+
+ // Twist
+ F32 twist = volume_params.getTwist();
+ F32 twist_begin = volume_params.getTwistBegin();
+ // Check the path type for conversion.
+ if (path == LL_PCODE_PATH_LINE || path == LL_PCODE_PATH_FLEXIBLE)
+ {
+ twist *= OBJECT_TWIST_LINEAR_MAX;
+ twist_begin *= OBJECT_TWIST_LINEAR_MAX;
+ }
+ else
+ {
+ twist *= OBJECT_TWIST_MAX;
+ twist_begin *= OBJECT_TWIST_MAX;
+ }
+
+ mSpinTwist ->set( twist );
+ mSpinTwistBegin ->set( twist_begin );
+ calcp->setVar(LLCalc::TWIST_END, twist);
+ calcp->setVar(LLCalc::TWIST_BEGIN, twist_begin);
+
+ // Shear
+ F32 shear_x = volume_params.getShearX();
+ F32 shear_y = volume_params.getShearY();
+ mSpinShearX->set( shear_x );
+ mSpinShearY->set( shear_y );
+ calcp->setVar(LLCalc::X_SHEAR, shear_x);
+ calcp->setVar(LLCalc::Y_SHEAR, shear_y);
+
+ // Taper
+ F32 taper_x = volume_params.getTaperX();
+ F32 taper_y = volume_params.getTaperY();
+ mSpinTaperX->set( taper_x );
+ mSpinTaperY->set( taper_y );
+ calcp->setVar(LLCalc::X_TAPER, taper_x);
+ calcp->setVar(LLCalc::Y_TAPER, taper_y);
+
+ // Radius offset.
+ F32 radius_offset = volume_params.getRadiusOffset();
+ // Limit radius offset, based on taper and hole size y.
+ F32 radius_mag = fabs(radius_offset);
+ F32 hole_y_mag = fabs(scale_y);
+ F32 taper_y_mag = fabs(taper_y);
+ // Check to see if the taper effects us.
+ if ( (radius_offset > 0.f && taper_y < 0.f) ||
+ (radius_offset < 0.f && taper_y > 0.f) )
+ {
+ // The taper does not help increase the radius offset range.
+ taper_y_mag = 0.f;
+ }
+ F32 max_radius_mag = 1.f - hole_y_mag * (1.f - taper_y_mag) / (1.f - hole_y_mag);
+ // Enforce the maximum magnitude.
+ if (radius_mag > max_radius_mag)
+ {
+ // Check radius offset sign.
+ if (radius_offset < 0.f)
+ {
+ radius_offset = -max_radius_mag;
+ }
+ else
+ {
+ radius_offset = max_radius_mag;
+ }
+ }
+ mSpinRadiusOffset->set( radius_offset);
+ calcp->setVar(LLCalc::RADIUS_OFFSET, radius_offset);
+
+ // Revolutions
+ F32 revolutions = volume_params.getRevolutions();
+ mSpinRevolutions->set( revolutions );
+ calcp->setVar(LLCalc::REVOLUTIONS, revolutions);
+
+ // Skew
+ F32 skew = volume_params.getSkew();
+ // Limit skew, based on revolutions hole size x.
+ F32 skew_mag= fabs(skew);
+ F32 min_skew_mag = 1.0f - 1.0f / (revolutions * scale_x + 1.0f);
+ // Discontinuity; A revolution of 1 allows skews below 0.5.
+ if ( fabs(revolutions - 1.0f) < 0.001)
+ min_skew_mag = 0.0f;
+
+ // Clip skew.
+ if (skew_mag < min_skew_mag)
+ {
+ // Check skew sign.
+ if (skew < 0.0f)
+ {
+ skew = -min_skew_mag;
+ }
+ else
+ {
+ skew = min_skew_mag;
+ }
+ }
+ mSpinSkew->set( skew );
+ calcp->setVar(LLCalc::SKEW, skew);
+ }
+
+ // Compute control visibility, label names, and twist range.
+ // Start with defaults.
+ BOOL cut_visible = TRUE;
+ BOOL hollow_visible = TRUE;
+ BOOL top_size_x_visible = TRUE;
+ BOOL top_size_y_visible = TRUE;
+ BOOL top_shear_x_visible = TRUE;
+ BOOL top_shear_y_visible = TRUE;
+ BOOL twist_visible = TRUE;
+ BOOL advanced_cut_visible = FALSE;
+ BOOL taper_visible = FALSE;
+ BOOL skew_visible = FALSE;
+ BOOL radius_offset_visible = FALSE;
+ BOOL revolutions_visible = FALSE;
+ BOOL sculpt_texture_visible = FALSE;
+ F32 twist_min = OBJECT_TWIST_LINEAR_MIN;
+ F32 twist_max = OBJECT_TWIST_LINEAR_MAX;
+ F32 twist_inc = OBJECT_TWIST_LINEAR_INC;
+
+ BOOL advanced_is_dimple = FALSE;
+ BOOL advanced_is_slice = FALSE;
+ BOOL size_is_hole = FALSE;
+
+ // Tune based on overall volume type
+ switch (selected_item)
+ {
+ case MI_SPHERE:
+ top_size_x_visible = FALSE;
+ top_size_y_visible = FALSE;
+ top_shear_x_visible = FALSE;
+ top_shear_y_visible = FALSE;
+ //twist_visible = FALSE;
+ advanced_cut_visible = TRUE;
+ advanced_is_dimple = TRUE;
+ twist_min = OBJECT_TWIST_MIN;
+ twist_max = OBJECT_TWIST_MAX;
+ twist_inc = OBJECT_TWIST_INC;
+ break;
+
+ case MI_TORUS:
+ case MI_TUBE:
+ case MI_RING:
+ //top_size_x_visible = FALSE;
+ //top_size_y_visible = FALSE;
+ size_is_hole = TRUE;
+ skew_visible = TRUE;
+ advanced_cut_visible = TRUE;
+ taper_visible = TRUE;
+ radius_offset_visible = TRUE;
+ revolutions_visible = TRUE;
+ twist_min = OBJECT_TWIST_MIN;
+ twist_max = OBJECT_TWIST_MAX;
+ twist_inc = OBJECT_TWIST_INC;
+
+ break;
+
+ case MI_SCULPT:
+ cut_visible = FALSE;
+ hollow_visible = FALSE;
+ twist_visible = FALSE;
+ top_size_x_visible = FALSE;
+ top_size_y_visible = FALSE;
+ top_shear_x_visible = FALSE;
+ top_shear_y_visible = FALSE;
+ skew_visible = FALSE;
+ advanced_cut_visible = FALSE;
+ taper_visible = FALSE;
+ radius_offset_visible = FALSE;
+ revolutions_visible = FALSE;
+ sculpt_texture_visible = TRUE;
+
+ break;
+
+ case MI_BOX:
+ advanced_cut_visible = TRUE;
+ advanced_is_slice = TRUE;
+ break;
+
+ case MI_CYLINDER:
+ advanced_cut_visible = TRUE;
+ advanced_is_slice = TRUE;
+ break;
+
+ case MI_PRISM:
+ advanced_cut_visible = TRUE;
+ advanced_is_slice = TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ // Check if we need to change top size/hole size params.
+ switch (selected_item)
+ {
+ case MI_SPHERE:
+ case MI_TORUS:
+ case MI_TUBE:
+ case MI_RING:
+ mSpinScaleX->set( scale_x );
+ mSpinScaleY->set( scale_y );
+ calcp->setVar(LLCalc::X_HOLE, scale_x);
+ calcp->setVar(LLCalc::Y_HOLE, scale_y);
+ mSpinScaleX->setMinValue(OBJECT_MIN_HOLE_SIZE);
+ mSpinScaleX->setMaxValue(OBJECT_MAX_HOLE_SIZE_X);
+ mSpinScaleY->setMinValue(OBJECT_MIN_HOLE_SIZE);
+ mSpinScaleY->setMaxValue(OBJECT_MAX_HOLE_SIZE_Y);
+ break;
+ default:
+ if (editable && single_volume)
+ {
+ mSpinScaleX->set( 1.f - scale_x );
+ mSpinScaleY->set( 1.f - scale_y );
+ mSpinScaleX->setMinValue(-1.f);
+ mSpinScaleX->setMaxValue(1.f);
+ mSpinScaleY->setMinValue(-1.f);
+ mSpinScaleY->setMaxValue(1.f);
+
+ // Torus' Hole Size is Box/Cyl/Prism's Taper
+ calcp->setVar(LLCalc::X_TAPER, 1.f - scale_x);
+ calcp->setVar(LLCalc::Y_TAPER, 1.f - scale_y);
+
+ // Box/Cyl/Prism have no hole size
+ calcp->setVar(LLCalc::X_HOLE, 0.f);
+ calcp->setVar(LLCalc::Y_HOLE, 0.f);
+ }
+ break;
+ }
+
+ // Check if we need to limit the hollow based on the hole type.
+ if ( selected_hole == MI_HOLE_SQUARE &&
+ ( selected_item == MI_CYLINDER || selected_item == MI_TORUS ||
+ selected_item == MI_PRISM || selected_item == MI_RING ||
+ selected_item == MI_SPHERE ) )
+ {
+ mSpinHollow->setMinValue(0.f);
+ mSpinHollow->setMaxValue(70.f);
+ }
+ else
+ {
+ mSpinHollow->setMinValue(0.f);
+ mSpinHollow->setMaxValue(95.f);
+ }
+
+ // Update field enablement
+ mComboBaseType ->setEnabled( enabled );
+ mMenuClipboardParams->setEnabled(enabled);
+
+ mLabelCut ->setEnabled( enabled );
+ mSpinCutBegin ->setEnabled( enabled );
+ mSpinCutEnd ->setEnabled( enabled );
+
+ mLabelHollow ->setEnabled( enabled );
+ mSpinHollow ->setEnabled( enabled );
+ mLabelHoleType ->setEnabled( hole_enabled );
+ mComboHoleType ->setEnabled( hole_enabled );
+
+ mLabelTwist ->setEnabled( enabled );
+ mSpinTwist ->setEnabled( enabled );
+ mSpinTwistBegin ->setEnabled( enabled );
+
+ mLabelSkew ->setEnabled( enabled );
+ mSpinSkew ->setEnabled( enabled );
+
+ getChildView("scale_hole")->setVisible( FALSE);
+ getChildView("scale_taper")->setVisible( FALSE);
+ if (top_size_x_visible || top_size_y_visible)
+ {
+ if (size_is_hole)
+ {
+ getChildView("scale_hole")->setVisible( TRUE);
+ getChildView("scale_hole")->setEnabled(enabled);
+ }
+ else
+ {
+ getChildView("scale_taper")->setVisible( TRUE);
+ getChildView("scale_taper")->setEnabled(enabled);
+ }
+ }
+
+ mSpinScaleX ->setEnabled( enabled );
+ mSpinScaleY ->setEnabled( enabled );
+
+ mLabelShear ->setEnabled( enabled );
+ mSpinShearX ->setEnabled( enabled );
+ mSpinShearY ->setEnabled( enabled );
+
+ getChildView("advanced_cut")->setVisible( FALSE);
+ getChildView("advanced_dimple")->setVisible( FALSE);
+ getChildView("advanced_slice")->setVisible( FALSE);
+
+ if (advanced_cut_visible)
+ {
+ if (advanced_is_dimple)
+ {
+ getChildView("advanced_dimple")->setVisible( TRUE);
+ getChildView("advanced_dimple")->setEnabled(enabled);
+ }
+
+ else if (advanced_is_slice)
+ {
+ getChildView("advanced_slice")->setVisible( TRUE);
+ getChildView("advanced_slice")->setEnabled(enabled);
+ }
+ else
+ {
+ getChildView("advanced_cut")->setVisible( TRUE);
+ getChildView("advanced_cut")->setEnabled(enabled);
+ }
+ }
+
+ mCtrlPathBegin ->setEnabled( enabled );
+ mCtrlPathEnd ->setEnabled( enabled );
+
+ mLabelTaper ->setEnabled( enabled );
+ mSpinTaperX ->setEnabled( enabled );
+ mSpinTaperY ->setEnabled( enabled );
+
+ mLabelRadiusOffset->setEnabled( enabled );
+ mSpinRadiusOffset ->setEnabled( enabled );
+
+ mLabelRevolutions->setEnabled( enabled );
+ mSpinRevolutions ->setEnabled( enabled );
+
+ // Update field visibility
+ mLabelCut ->setVisible( cut_visible );
+ mSpinCutBegin ->setVisible( cut_visible );
+ mSpinCutEnd ->setVisible( cut_visible );
+
+ mLabelHollow ->setVisible( hollow_visible );
+ mSpinHollow ->setVisible( hollow_visible );
+ mLabelHoleType ->setVisible( hollow_visible );
+ mComboHoleType ->setVisible( hollow_visible );
+
+ mLabelTwist ->setVisible( twist_visible );
+ mSpinTwist ->setVisible( twist_visible );
+ mSpinTwistBegin ->setVisible( twist_visible );
+ mSpinTwist ->setMinValue( twist_min );
+ mSpinTwist ->setMaxValue( twist_max );
+ mSpinTwist ->setIncrement( twist_inc );
+ mSpinTwistBegin ->setMinValue( twist_min );
+ mSpinTwistBegin ->setMaxValue( twist_max );
+ mSpinTwistBegin ->setIncrement( twist_inc );
+
+ mSpinScaleX ->setVisible( top_size_x_visible );
+ mSpinScaleY ->setVisible( top_size_y_visible );
+
+ mLabelSkew ->setVisible( skew_visible );
+ mSpinSkew ->setVisible( skew_visible );
+
+ mLabelShear ->setVisible( top_shear_x_visible || top_shear_y_visible );
+ mSpinShearX ->setVisible( top_shear_x_visible );
+ mSpinShearY ->setVisible( top_shear_y_visible );
+
+ mCtrlPathBegin ->setVisible( advanced_cut_visible );
+ mCtrlPathEnd ->setVisible( advanced_cut_visible );
+
+ mLabelTaper ->setVisible( taper_visible );
+ mSpinTaperX ->setVisible( taper_visible );
+ mSpinTaperY ->setVisible( taper_visible );
+
+ mLabelRadiusOffset->setVisible( radius_offset_visible );
+ mSpinRadiusOffset ->setVisible( radius_offset_visible );
+
+ mLabelRevolutions->setVisible( revolutions_visible );
+ mSpinRevolutions ->setVisible( revolutions_visible );
+
+ mCtrlSculptTexture->setVisible(sculpt_texture_visible);
+ mLabelSculptType->setVisible(sculpt_texture_visible);
+ mCtrlSculptType->setVisible(sculpt_texture_visible);
+
+
+ // sculpt texture
+ if (selected_item == MI_SCULPT)
+ {
+
+
+ LLUUID id;
+ LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+
+
+ if (sculpt_params) // if we have a legal sculpt param block for this object:
+ {
+ if (mObject != objectp) // we've just selected a new object, so save for undo
+ {
+ mSculptTextureRevert = sculpt_params->getSculptTexture();
+ mSculptTypeRevert = sculpt_params->getSculptType();
+ }
+
+ U8 sculpt_type = sculpt_params->getSculptType();
+ U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK;
+ BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT;
+ BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR;
+ isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH);
+
+ LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control");
+ if(mTextureCtrl)
+ {
+ mTextureCtrl->setTentative(FALSE);
+ mTextureCtrl->setEnabled(editable && !isMesh);
+ if (editable)
+ mTextureCtrl->setImageAssetID(sculpt_params->getSculptTexture());
+ else
+ mTextureCtrl->setImageAssetID(LLUUID::null);
+ }
+
+ mComboBaseType->setEnabled(!isMesh);
+ mMenuClipboardParams->setEnabled(!isMesh);
+
+ if (mCtrlSculptType)
+ {
+ if (sculpt_stitching == LL_SCULPT_TYPE_NONE)
+ {
+ // since 'None' is no longer an option in the combo box
+ // use 'Plane' as an equivalent sculpt type
+ mCtrlSculptType->setSelectedByValue(LLSD(LL_SCULPT_TYPE_PLANE), true);
+ }
+ else
+ {
+ mCtrlSculptType->setSelectedByValue(LLSD(sculpt_stitching), true);
+ }
+ mCtrlSculptType->setEnabled(editable && !isMesh);
+ }
+
+ if (mCtrlSculptMirror)
+ {
+ mCtrlSculptMirror->set(sculpt_mirror);
+ mCtrlSculptMirror->setEnabled(editable && !isMesh);
+ }
+
+ if (mCtrlSculptInvert)
+ {
+ mCtrlSculptInvert->set(sculpt_invert);
+ mCtrlSculptInvert->setEnabled(editable);
+ }
+
+ if (mLabelSculptType)
+ {
+ mLabelSculptType->setEnabled(TRUE);
+ }
+
+ }
+ }
+ else
+ {
+ mSculptTextureRevert = LLUUID::null;
+ }
+
+ mCtrlSculptMirror->setVisible(sculpt_texture_visible && !isMesh);
+ mCtrlSculptInvert->setVisible(sculpt_texture_visible && !isMesh);
+
+ //----------------------------------------------------------------------------
+
+ mObject = objectp;
+ mRootObject = root_objectp;
}
// static
bool LLPanelObject::precommitValidate( const LLSD& data )
{
- // TODO: Richard will fill this in later.
- return TRUE; // FALSE means that validation failed and new value should not be commited.
+ // TODO: Richard will fill this in later.
+ return TRUE; // FALSE means that validation failed and new value should not be commited.
}
void LLPanelObject::sendIsPhysical()
{
- BOOL value = mCheckPhysics->get();
- if( mIsPhysical != value )
- {
- LLSelectMgr::getInstance()->selectionUpdatePhysics(value);
- mIsPhysical = value;
-
- LL_INFOS("FloaterTools") << "update physics sent" << LL_ENDL;
- }
- else
- {
- LL_INFOS("FloaterTools") << "update physics not changed" << LL_ENDL;
- }
+ BOOL value = mCheckPhysics->get();
+ if( mIsPhysical != value )
+ {
+ LLSelectMgr::getInstance()->selectionUpdatePhysics(value);
+ mIsPhysical = value;
+
+ LL_INFOS("FloaterTools") << "update physics sent" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS("FloaterTools") << "update physics not changed" << LL_ENDL;
+ }
}
void LLPanelObject::sendIsTemporary()
{
- BOOL value = mCheckTemporary->get();
- if( mIsTemporary != value )
- {
- LLSelectMgr::getInstance()->selectionUpdateTemporary(value);
- mIsTemporary = value;
-
- LL_INFOS("FloaterTools") << "update temporary sent" << LL_ENDL;
- }
- else
- {
- LL_INFOS("FloaterTools") << "update temporary not changed" << LL_ENDL;
- }
+ BOOL value = mCheckTemporary->get();
+ if( mIsTemporary != value )
+ {
+ LLSelectMgr::getInstance()->selectionUpdateTemporary(value);
+ mIsTemporary = value;
+
+ LL_INFOS("FloaterTools") << "update temporary sent" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS("FloaterTools") << "update temporary not changed" << LL_ENDL;
+ }
}
void LLPanelObject::sendIsPhantom()
{
- BOOL value = mCheckPhantom->get();
- if( mIsPhantom != value )
- {
- LLSelectMgr::getInstance()->selectionUpdatePhantom(value);
- mIsPhantom = value;
-
- LL_INFOS("FloaterTools") << "update phantom sent" << LL_ENDL;
- }
- else
- {
- LL_INFOS("FloaterTools") << "update phantom not changed" << LL_ENDL;
- }
+ BOOL value = mCheckPhantom->get();
+ if( mIsPhantom != value )
+ {
+ LLSelectMgr::getInstance()->selectionUpdatePhantom(value);
+ mIsPhantom = value;
+
+ LL_INFOS("FloaterTools") << "update phantom sent" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS("FloaterTools") << "update phantom not changed" << LL_ENDL;
+ }
}
// static
void LLPanelObject::onCommitParametric( LLUICtrl* ctrl, void* userdata )
{
- LLPanelObject* self = (LLPanelObject*) userdata;
-
- if (self->mObject.isNull())
- {
- return;
- }
-
- if (self->mObject->getPCode() != LL_PCODE_VOLUME)
- {
- // Don't allow modification of non-volume objects.
- return;
- }
-
- LLVolume *volume = self->mObject->getVolume();
- if (!volume)
- {
- return;
- }
-
- LLVolumeParams volume_params;
- self->getVolumeParams(volume_params);
-
-
-
- // set sculpting
- S32 selected_type = self->mComboBaseType->getCurrentIndex();
-
- if (selected_type == MI_SCULPT)
- {
- self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, TRUE, TRUE);
- LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
- if (sculpt_params)
- volume_params.setSculptID(sculpt_params->getSculptTexture(), sculpt_params->getSculptType());
- }
- else
- {
- LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
- if (sculpt_params)
- self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE);
- }
-
- // Update the volume, if necessary.
- self->mObject->updateVolume(volume_params);
-
-
- // This was added to make sure thate when changes are made, the UI
- // adjusts to present valid options.
- // *FIX: only some changes, ie, hollow or primitive type changes,
- // require a refresh.
- self->refresh();
+ LLPanelObject* self = (LLPanelObject*) userdata;
+
+ if (self->mObject.isNull())
+ {
+ return;
+ }
+
+ if (self->mObject->getPCode() != LL_PCODE_VOLUME)
+ {
+ // Don't allow modification of non-volume objects.
+ return;
+ }
+
+ LLVolume *volume = self->mObject->getVolume();
+ if (!volume)
+ {
+ return;
+ }
+
+ LLVolumeParams volume_params;
+ self->getVolumeParams(volume_params);
+
+
+
+ // set sculpting
+ S32 selected_type = self->mComboBaseType->getCurrentIndex();
+
+ if (selected_type == MI_SCULPT)
+ {
+ self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, TRUE, TRUE);
+ LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+ if (sculpt_params)
+ volume_params.setSculptID(sculpt_params->getSculptTexture(), sculpt_params->getSculptType());
+ }
+ else
+ {
+ LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+ if (sculpt_params)
+ self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE);
+ }
+
+ // Update the volume, if necessary.
+ self->mObject->updateVolume(volume_params);
+
+
+ // This was added to make sure thate when changes are made, the UI
+ // adjusts to present valid options.
+ // *FIX: only some changes, ie, hollow or primitive type changes,
+ // require a refresh.
+ self->refresh();
}
void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params)
{
- // Figure out what type of volume to make
- S32 was_selected_type = mSelectedType;
- S32 selected_type = mComboBaseType->getCurrentIndex();
- U8 profile;
- U8 path;
- switch ( selected_type )
- {
- case MI_CYLINDER:
- profile = LL_PCODE_PROFILE_CIRCLE;
- path = LL_PCODE_PATH_LINE;
- break;
-
- case MI_BOX:
- profile = LL_PCODE_PROFILE_SQUARE;
- path = LL_PCODE_PATH_LINE;
- break;
-
- case MI_PRISM:
- profile = LL_PCODE_PROFILE_EQUALTRI;
- path = LL_PCODE_PATH_LINE;
- break;
-
- case MI_SPHERE:
- profile = LL_PCODE_PROFILE_CIRCLE_HALF;
- path = LL_PCODE_PATH_CIRCLE;
- break;
-
- case MI_TORUS:
- profile = LL_PCODE_PROFILE_CIRCLE;
- path = LL_PCODE_PATH_CIRCLE;
- break;
-
- case MI_TUBE:
- profile = LL_PCODE_PROFILE_SQUARE;
- path = LL_PCODE_PATH_CIRCLE;
- break;
-
- case MI_RING:
- profile = LL_PCODE_PROFILE_EQUALTRI;
- path = LL_PCODE_PATH_CIRCLE;
- break;
-
- case MI_SCULPT:
- profile = LL_PCODE_PROFILE_CIRCLE;
- path = LL_PCODE_PATH_CIRCLE;
- break;
-
- default:
- LL_WARNS("FloaterTools") << "Unknown base type " << selected_type
- << " in getVolumeParams()" << LL_ENDL;
- // assume a box
- selected_type = MI_BOX;
- profile = LL_PCODE_PROFILE_SQUARE;
- path = LL_PCODE_PATH_LINE;
- break;
- }
-
-
- if (path == LL_PCODE_PATH_LINE)
- {
- LLVOVolume *volobjp = (LLVOVolume *)(LLViewerObject*)(mObject);
- if (volobjp->isFlexible())
- {
- path = LL_PCODE_PATH_FLEXIBLE;
- }
- }
-
- S32 selected_hole = mComboHoleType->getCurrentIndex();
- U8 hole;
- switch (selected_hole)
- {
- case MI_HOLE_CIRCLE:
- hole = LL_PCODE_HOLE_CIRCLE;
- break;
- case MI_HOLE_SQUARE:
- hole = LL_PCODE_HOLE_SQUARE;
- break;
- case MI_HOLE_TRIANGLE:
- hole = LL_PCODE_HOLE_TRIANGLE;
- break;
- case MI_HOLE_SAME:
- default:
- hole = LL_PCODE_HOLE_SAME;
- break;
- }
-
- volume_params.setType(profile | hole, path);
- mSelectedType = selected_type;
-
- // Compute cut start/end
- F32 cut_begin = mSpinCutBegin->get();
- F32 cut_end = mSpinCutEnd->get();
-
- // Make sure at least OBJECT_CUT_INC of the object survives
- if (cut_begin > cut_end - OBJECT_MIN_CUT_INC)
- {
- cut_begin = cut_end - OBJECT_MIN_CUT_INC;
- mSpinCutBegin->set(cut_begin);
- }
-
- F32 adv_cut_begin = mCtrlPathBegin->get();
- F32 adv_cut_end = mCtrlPathEnd->get();
-
- // Make sure at least OBJECT_CUT_INC of the object survives
- if (adv_cut_begin > adv_cut_end - OBJECT_MIN_CUT_INC)
- {
- adv_cut_begin = adv_cut_end - OBJECT_MIN_CUT_INC;
- mCtrlPathBegin->set(adv_cut_begin);
- }
-
- F32 begin_s, end_s;
- F32 begin_t, end_t;
-
- if (selected_type == MI_SPHERE || selected_type == MI_TORUS ||
- selected_type == MI_TUBE || selected_type == MI_RING)
- {
- begin_s = adv_cut_begin;
- end_s = adv_cut_end;
-
- begin_t = cut_begin;
- end_t = cut_end;
- }
- else
- {
- begin_s = cut_begin;
- end_s = cut_end;
-
- begin_t = adv_cut_begin;
- end_t = adv_cut_end;
- }
-
- volume_params.setBeginAndEndS(begin_s, end_s);
- volume_params.setBeginAndEndT(begin_t, end_t);
-
- // Hollowness
- F32 hollow = mSpinHollow->get() / 100.f;
-
- if ( selected_hole == MI_HOLE_SQUARE &&
- ( selected_type == MI_CYLINDER || selected_type == MI_TORUS ||
- selected_type == MI_PRISM || selected_type == MI_RING ||
- selected_type == MI_SPHERE ) )
- {
- if (hollow > 0.7f) hollow = 0.7f;
- }
-
- volume_params.setHollow( hollow );
-
- // Twist Begin,End
- F32 twist_begin = mSpinTwistBegin->get();
- F32 twist = mSpinTwist->get();
- // Check the path type for twist conversion.
- if (path == LL_PCODE_PATH_LINE || path == LL_PCODE_PATH_FLEXIBLE)
- {
- twist_begin /= OBJECT_TWIST_LINEAR_MAX;
- twist /= OBJECT_TWIST_LINEAR_MAX;
- }
- else
- {
- twist_begin /= OBJECT_TWIST_MAX;
- twist /= OBJECT_TWIST_MAX;
- }
-
- volume_params.setTwistBegin(twist_begin);
- volume_params.setTwist(twist);
-
- // Scale X,Y
- F32 scale_x = mSpinScaleX->get();
- F32 scale_y = mSpinScaleY->get();
- if ( was_selected_type == MI_BOX || was_selected_type == MI_CYLINDER || was_selected_type == MI_PRISM)
- {
- scale_x = 1.f - scale_x;
- scale_y = 1.f - scale_y;
- }
-
- // Skew
- F32 skew = mSpinSkew->get();
-
- // Taper X,Y
- F32 taper_x = mSpinTaperX->get();
- F32 taper_y = mSpinTaperY->get();
-
- // Radius offset
- F32 radius_offset = mSpinRadiusOffset->get();
-
- // Revolutions
- F32 revolutions = mSpinRevolutions->get();
-
- if ( selected_type == MI_SPHERE )
- {
- // Snap values to valid sphere parameters.
- scale_x = 1.0f;
- scale_y = 1.0f;
- skew = 0.0f;
- taper_x = 0.0f;
- taper_y = 0.0f;
- radius_offset = 0.0f;
- revolutions = 1.0f;
- }
- else if ( selected_type == MI_TORUS || selected_type == MI_TUBE ||
- selected_type == MI_RING )
- {
- scale_x = llclamp(
- scale_x,
- OBJECT_MIN_HOLE_SIZE,
- OBJECT_MAX_HOLE_SIZE_X);
- scale_y = llclamp(
- scale_y,
- OBJECT_MIN_HOLE_SIZE,
- OBJECT_MAX_HOLE_SIZE_Y);
-
- // Limit radius offset, based on taper and hole size y.
- F32 radius_mag = fabs(radius_offset);
- F32 hole_y_mag = fabs(scale_y);
- F32 taper_y_mag = fabs(taper_y);
- // Check to see if the taper effects us.
- if ( (radius_offset > 0.f && taper_y < 0.f) ||
- (radius_offset < 0.f && taper_y > 0.f) )
- {
- // The taper does not help increase the radius offset range.
- taper_y_mag = 0.f;
- }
- F32 max_radius_mag = 1.f - hole_y_mag * (1.f - taper_y_mag) / (1.f - hole_y_mag);
- // Enforce the maximum magnitude.
- if (radius_mag > max_radius_mag)
- {
- // Check radius offset sign.
- if (radius_offset < 0.f)
- {
- radius_offset = -max_radius_mag;
- }
- else
- {
- radius_offset = max_radius_mag;
- }
- }
-
- // Check the skew value against the revolutions.
- F32 skew_mag= fabs(skew);
- F32 min_skew_mag = 1.0f - 1.0f / (revolutions * scale_x + 1.0f);
- // Discontinuity; A revolution of 1 allows skews below 0.5.
- if ( fabs(revolutions - 1.0f) < 0.001)
- min_skew_mag = 0.0f;
-
- // Clip skew.
- if (skew_mag < min_skew_mag)
- {
- // Check skew sign.
- if (skew < 0.0f)
- {
- skew = -min_skew_mag;
- }
- else
- {
- skew = min_skew_mag;
- }
- }
- }
-
- volume_params.setRatio( scale_x, scale_y );
- volume_params.setSkew(skew);
- volume_params.setTaper( taper_x, taper_y );
- volume_params.setRadiusOffset(radius_offset);
- volume_params.setRevolutions(revolutions);
-
- // Shear X,Y
- F32 shear_x = mSpinShearX->get();
- F32 shear_y = mSpinShearY->get();
- volume_params.setShear( shear_x, shear_y );
-
- if (selected_type == MI_SCULPT)
- {
- volume_params.setSculptID(LLUUID::null, 0);
- volume_params.setBeginAndEndT (0, 1);
- volume_params.setBeginAndEndS (0, 1);
- volume_params.setHollow (0);
- volume_params.setTwistBegin (0);
- volume_params.setTwistEnd (0);
- volume_params.setRatio (1, 0.5);
- volume_params.setShear (0, 0);
- volume_params.setTaper (0, 0);
- volume_params.setRevolutions (1);
- volume_params.setRadiusOffset (0);
- volume_params.setSkew (0);
- }
+ // Figure out what type of volume to make
+ S32 was_selected_type = mSelectedType;
+ S32 selected_type = mComboBaseType->getCurrentIndex();
+ U8 profile;
+ U8 path;
+ switch ( selected_type )
+ {
+ case MI_CYLINDER:
+ profile = LL_PCODE_PROFILE_CIRCLE;
+ path = LL_PCODE_PATH_LINE;
+ break;
+
+ case MI_BOX:
+ profile = LL_PCODE_PROFILE_SQUARE;
+ path = LL_PCODE_PATH_LINE;
+ break;
+
+ case MI_PRISM:
+ profile = LL_PCODE_PROFILE_EQUALTRI;
+ path = LL_PCODE_PATH_LINE;
+ break;
+
+ case MI_SPHERE:
+ profile = LL_PCODE_PROFILE_CIRCLE_HALF;
+ path = LL_PCODE_PATH_CIRCLE;
+ break;
+
+ case MI_TORUS:
+ profile = LL_PCODE_PROFILE_CIRCLE;
+ path = LL_PCODE_PATH_CIRCLE;
+ break;
+
+ case MI_TUBE:
+ profile = LL_PCODE_PROFILE_SQUARE;
+ path = LL_PCODE_PATH_CIRCLE;
+ break;
+
+ case MI_RING:
+ profile = LL_PCODE_PROFILE_EQUALTRI;
+ path = LL_PCODE_PATH_CIRCLE;
+ break;
+
+ case MI_SCULPT:
+ profile = LL_PCODE_PROFILE_CIRCLE;
+ path = LL_PCODE_PATH_CIRCLE;
+ break;
+
+ default:
+ LL_WARNS("FloaterTools") << "Unknown base type " << selected_type
+ << " in getVolumeParams()" << LL_ENDL;
+ // assume a box
+ selected_type = MI_BOX;
+ profile = LL_PCODE_PROFILE_SQUARE;
+ path = LL_PCODE_PATH_LINE;
+ break;
+ }
+
+
+ if (path == LL_PCODE_PATH_LINE)
+ {
+ LLVOVolume *volobjp = (LLVOVolume *)(LLViewerObject*)(mObject);
+ if (volobjp->isFlexible())
+ {
+ path = LL_PCODE_PATH_FLEXIBLE;
+ }
+ }
+
+ S32 selected_hole = mComboHoleType->getCurrentIndex();
+ U8 hole;
+ switch (selected_hole)
+ {
+ case MI_HOLE_CIRCLE:
+ hole = LL_PCODE_HOLE_CIRCLE;
+ break;
+ case MI_HOLE_SQUARE:
+ hole = LL_PCODE_HOLE_SQUARE;
+ break;
+ case MI_HOLE_TRIANGLE:
+ hole = LL_PCODE_HOLE_TRIANGLE;
+ break;
+ case MI_HOLE_SAME:
+ default:
+ hole = LL_PCODE_HOLE_SAME;
+ break;
+ }
+
+ volume_params.setType(profile | hole, path);
+ mSelectedType = selected_type;
+
+ // Compute cut start/end
+ F32 cut_begin = mSpinCutBegin->get();
+ F32 cut_end = mSpinCutEnd->get();
+
+ // Make sure at least OBJECT_CUT_INC of the object survives
+ if (cut_begin > cut_end - OBJECT_MIN_CUT_INC)
+ {
+ cut_begin = cut_end - OBJECT_MIN_CUT_INC;
+ mSpinCutBegin->set(cut_begin);
+ }
+
+ F32 adv_cut_begin = mCtrlPathBegin->get();
+ F32 adv_cut_end = mCtrlPathEnd->get();
+
+ // Make sure at least OBJECT_CUT_INC of the object survives
+ if (adv_cut_begin > adv_cut_end - OBJECT_MIN_CUT_INC)
+ {
+ adv_cut_begin = adv_cut_end - OBJECT_MIN_CUT_INC;
+ mCtrlPathBegin->set(adv_cut_begin);
+ }
+
+ F32 begin_s, end_s;
+ F32 begin_t, end_t;
+
+ if (selected_type == MI_SPHERE || selected_type == MI_TORUS ||
+ selected_type == MI_TUBE || selected_type == MI_RING)
+ {
+ begin_s = adv_cut_begin;
+ end_s = adv_cut_end;
+
+ begin_t = cut_begin;
+ end_t = cut_end;
+ }
+ else
+ {
+ begin_s = cut_begin;
+ end_s = cut_end;
+
+ begin_t = adv_cut_begin;
+ end_t = adv_cut_end;
+ }
+
+ volume_params.setBeginAndEndS(begin_s, end_s);
+ volume_params.setBeginAndEndT(begin_t, end_t);
+
+ // Hollowness
+ F32 hollow = mSpinHollow->get() / 100.f;
+
+ if ( selected_hole == MI_HOLE_SQUARE &&
+ ( selected_type == MI_CYLINDER || selected_type == MI_TORUS ||
+ selected_type == MI_PRISM || selected_type == MI_RING ||
+ selected_type == MI_SPHERE ) )
+ {
+ if (hollow > 0.7f) hollow = 0.7f;
+ }
+
+ volume_params.setHollow( hollow );
+
+ // Twist Begin,End
+ F32 twist_begin = mSpinTwistBegin->get();
+ F32 twist = mSpinTwist->get();
+ // Check the path type for twist conversion.
+ if (path == LL_PCODE_PATH_LINE || path == LL_PCODE_PATH_FLEXIBLE)
+ {
+ twist_begin /= OBJECT_TWIST_LINEAR_MAX;
+ twist /= OBJECT_TWIST_LINEAR_MAX;
+ }
+ else
+ {
+ twist_begin /= OBJECT_TWIST_MAX;
+ twist /= OBJECT_TWIST_MAX;
+ }
+
+ volume_params.setTwistBegin(twist_begin);
+ volume_params.setTwist(twist);
+
+ // Scale X,Y
+ F32 scale_x = mSpinScaleX->get();
+ F32 scale_y = mSpinScaleY->get();
+ if ( was_selected_type == MI_BOX || was_selected_type == MI_CYLINDER || was_selected_type == MI_PRISM)
+ {
+ scale_x = 1.f - scale_x;
+ scale_y = 1.f - scale_y;
+ }
+
+ // Skew
+ F32 skew = mSpinSkew->get();
+
+ // Taper X,Y
+ F32 taper_x = mSpinTaperX->get();
+ F32 taper_y = mSpinTaperY->get();
+
+ // Radius offset
+ F32 radius_offset = mSpinRadiusOffset->get();
+
+ // Revolutions
+ F32 revolutions = mSpinRevolutions->get();
+
+ if ( selected_type == MI_SPHERE )
+ {
+ // Snap values to valid sphere parameters.
+ scale_x = 1.0f;
+ scale_y = 1.0f;
+ skew = 0.0f;
+ taper_x = 0.0f;
+ taper_y = 0.0f;
+ radius_offset = 0.0f;
+ revolutions = 1.0f;
+ }
+ else if ( selected_type == MI_TORUS || selected_type == MI_TUBE ||
+ selected_type == MI_RING )
+ {
+ scale_x = llclamp(
+ scale_x,
+ OBJECT_MIN_HOLE_SIZE,
+ OBJECT_MAX_HOLE_SIZE_X);
+ scale_y = llclamp(
+ scale_y,
+ OBJECT_MIN_HOLE_SIZE,
+ OBJECT_MAX_HOLE_SIZE_Y);
+
+ // Limit radius offset, based on taper and hole size y.
+ F32 radius_mag = fabs(radius_offset);
+ F32 hole_y_mag = fabs(scale_y);
+ F32 taper_y_mag = fabs(taper_y);
+ // Check to see if the taper effects us.
+ if ( (radius_offset > 0.f && taper_y < 0.f) ||
+ (radius_offset < 0.f && taper_y > 0.f) )
+ {
+ // The taper does not help increase the radius offset range.
+ taper_y_mag = 0.f;
+ }
+ F32 max_radius_mag = 1.f - hole_y_mag * (1.f - taper_y_mag) / (1.f - hole_y_mag);
+ // Enforce the maximum magnitude.
+ if (radius_mag > max_radius_mag)
+ {
+ // Check radius offset sign.
+ if (radius_offset < 0.f)
+ {
+ radius_offset = -max_radius_mag;
+ }
+ else
+ {
+ radius_offset = max_radius_mag;
+ }
+ }
+
+ // Check the skew value against the revolutions.
+ F32 skew_mag= fabs(skew);
+ F32 min_skew_mag = 1.0f - 1.0f / (revolutions * scale_x + 1.0f);
+ // Discontinuity; A revolution of 1 allows skews below 0.5.
+ if ( fabs(revolutions - 1.0f) < 0.001)
+ min_skew_mag = 0.0f;
+
+ // Clip skew.
+ if (skew_mag < min_skew_mag)
+ {
+ // Check skew sign.
+ if (skew < 0.0f)
+ {
+ skew = -min_skew_mag;
+ }
+ else
+ {
+ skew = min_skew_mag;
+ }
+ }
+ }
+
+ volume_params.setRatio( scale_x, scale_y );
+ volume_params.setSkew(skew);
+ volume_params.setTaper( taper_x, taper_y );
+ volume_params.setRadiusOffset(radius_offset);
+ volume_params.setRevolutions(revolutions);
+
+ // Shear X,Y
+ F32 shear_x = mSpinShearX->get();
+ F32 shear_y = mSpinShearY->get();
+ volume_params.setShear( shear_x, shear_y );
+
+ if (selected_type == MI_SCULPT)
+ {
+ volume_params.setSculptID(LLUUID::null, 0);
+ volume_params.setBeginAndEndT (0, 1);
+ volume_params.setBeginAndEndS (0, 1);
+ volume_params.setHollow (0);
+ volume_params.setTwistBegin (0);
+ volume_params.setTwistEnd (0);
+ volume_params.setRatio (1, 0.5);
+ volume_params.setShear (0, 0);
+ volume_params.setTaper (0, 0);
+ volume_params.setRevolutions (1);
+ volume_params.setRadiusOffset (0);
+ volume_params.setSkew (0);
+ }
}
// BUG: Make work with multiple objects
void LLPanelObject::sendRotation(BOOL btn_down)
{
- if (mObject.isNull()) return;
-
- LLVector3 new_rot(mCtrlRotX->get(), mCtrlRotY->get(), mCtrlRotZ->get());
- new_rot.mV[VX] = ll_round(new_rot.mV[VX], OBJECT_ROTATION_PRECISION);
- new_rot.mV[VY] = ll_round(new_rot.mV[VY], OBJECT_ROTATION_PRECISION);
- new_rot.mV[VZ] = ll_round(new_rot.mV[VZ], OBJECT_ROTATION_PRECISION);
-
- // Note: must compare before conversion to radians
- LLVector3 delta = new_rot - mCurEulerDegrees;
-
- if (delta.magVec() >= 0.0005f)
- {
- mCurEulerDegrees = new_rot;
- new_rot *= DEG_TO_RAD;
-
- LLQuaternion rotation;
- rotation.setQuat(new_rot.mV[VX], new_rot.mV[VY], new_rot.mV[VZ]);
-
- if (mRootObject != mObject)
- {
- rotation = rotation * ~mRootObject->getRotationRegion();
- }
-
- // To include avatars into movements and rotation
- // If false, all children are selected anyway - move avatar
- // If true, not all children are selected - save positions
- bool individual_selection = gSavedSettings.getBOOL("EditLinkedParts");
- std::vector<LLVector3>& child_positions = mObject->mUnselectedChildrenPositions ;
- std::vector<LLQuaternion> child_rotations;
- if (mObject->isRootEdit() && individual_selection)
- {
- mObject->saveUnselectedChildrenRotation(child_rotations) ;
- mObject->saveUnselectedChildrenPosition(child_positions) ;
- }
-
- mObject->setRotation(rotation);
- LLManip::rebuild(mObject) ;
-
- // for individually selected roots, we need to counterrotate all the children
- if (mObject->isRootEdit() && individual_selection)
- {
- mObject->resetChildrenRotationAndPosition(child_rotations, child_positions) ;
- }
-
- if(!btn_down)
- {
- child_positions.clear() ;
- LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_ROTATION | UPD_POSITION);
- }
- }
+ if (mObject.isNull()) return;
+
+ LLVector3 new_rot(mCtrlRotX->get(), mCtrlRotY->get(), mCtrlRotZ->get());
+ new_rot.mV[VX] = ll_round(new_rot.mV[VX], OBJECT_ROTATION_PRECISION);
+ new_rot.mV[VY] = ll_round(new_rot.mV[VY], OBJECT_ROTATION_PRECISION);
+ new_rot.mV[VZ] = ll_round(new_rot.mV[VZ], OBJECT_ROTATION_PRECISION);
+
+ // Note: must compare before conversion to radians
+ LLVector3 delta = new_rot - mCurEulerDegrees;
+
+ if (delta.magVec() >= 0.0005f)
+ {
+ mCurEulerDegrees = new_rot;
+ new_rot *= DEG_TO_RAD;
+
+ LLQuaternion rotation;
+ rotation.setQuat(new_rot.mV[VX], new_rot.mV[VY], new_rot.mV[VZ]);
+
+ if (mRootObject != mObject)
+ {
+ rotation = rotation * ~mRootObject->getRotationRegion();
+ }
+
+ // To include avatars into movements and rotation
+ // If false, all children are selected anyway - move avatar
+ // If true, not all children are selected - save positions
+ bool individual_selection = gSavedSettings.getBOOL("EditLinkedParts");
+ std::vector<LLVector3>& child_positions = mObject->mUnselectedChildrenPositions ;
+ std::vector<LLQuaternion> child_rotations;
+ if (mObject->isRootEdit() && individual_selection)
+ {
+ mObject->saveUnselectedChildrenRotation(child_rotations) ;
+ mObject->saveUnselectedChildrenPosition(child_positions) ;
+ }
+
+ mObject->setRotation(rotation);
+ LLManip::rebuild(mObject) ;
+
+ // for individually selected roots, we need to counterrotate all the children
+ if (mObject->isRootEdit() && individual_selection)
+ {
+ mObject->resetChildrenRotationAndPosition(child_rotations, child_positions) ;
+ }
+
+ if(!btn_down)
+ {
+ child_positions.clear() ;
+ LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_ROTATION | UPD_POSITION);
+ }
+ }
}
// BUG: Make work with multiple objects
void LLPanelObject::sendScale(BOOL btn_down)
{
- if (mObject.isNull()) return;
-
- LLVector3 newscale(mCtrlScaleX->get(), mCtrlScaleY->get(), mCtrlScaleZ->get());
-
- LLVector3 delta = newscale - mObject->getScale();
- if (delta.magVec() >= 0.0005f || (mSizeChanged && !btn_down))
- {
- // scale changed by more than 1/2 millimeter
- mSizeChanged = btn_down;
-
- // check to see if we aren't scaling the textures
- // (in which case the tex coord's need to be recomputed)
- BOOL dont_stretch_textures = !LLManipScale::getStretchTextures();
- if (dont_stretch_textures)
- {
- LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE);
- }
-
- mObject->setScale(newscale, TRUE);
-
- if(!btn_down)
- {
- LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION);
- }
-
- LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, !dont_stretch_textures);
-// LL_INFOS() << "scale sent" << LL_ENDL;
- }
- else
- {
-// LL_INFOS() << "scale not changed" << LL_ENDL;
- }
+ if (mObject.isNull()) return;
+
+ LLVector3 newscale(mCtrlScaleX->get(), mCtrlScaleY->get(), mCtrlScaleZ->get());
+
+ LLVector3 delta = newscale - mObject->getScale();
+ if (delta.magVec() >= 0.0005f || (mSizeChanged && !btn_down))
+ {
+ // scale changed by more than 1/2 millimeter
+ mSizeChanged = btn_down;
+
+ // check to see if we aren't scaling the textures
+ // (in which case the tex coord's need to be recomputed)
+ BOOL dont_stretch_textures = !LLManipScale::getStretchTextures();
+ if (dont_stretch_textures)
+ {
+ LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE);
+ }
+
+ mObject->setScale(newscale, TRUE);
+
+ if(!btn_down)
+ {
+ LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION);
+ }
+
+ LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, !dont_stretch_textures);
+// LL_INFOS() << "scale sent" << LL_ENDL;
+ }
+ else
+ {
+// LL_INFOS() << "scale not changed" << LL_ENDL;
+ }
}
void LLPanelObject::sendPosition(BOOL btn_down)
-{
- if (mObject.isNull()) return;
+{
+ if (mObject.isNull()) return;
- LLVector3 newpos(mCtrlPosX->get(), mCtrlPosY->get(), mCtrlPosZ->get());
- LLViewerRegion* regionp = mObject->getRegion();
+ LLVector3 newpos(mCtrlPosX->get(), mCtrlPosY->get(), mCtrlPosZ->get());
+ LLViewerRegion* regionp = mObject->getRegion();
- if (!regionp) return;
+ if (!regionp) return;
- if (!mObject->isAttachment())
- {
+ if (!mObject->isAttachment())
+ {
// Clamp the Z height
const F32 height = newpos.mV[VZ];
const F32 min_height = LLWorld::getInstance()->getMinAllowedZ(mObject, mObject->getPositionGlobal());
const F32 max_height = LLWorld::getInstance()->getRegionMaxHeight();
- if ( height < min_height)
- {
- newpos.mV[VZ] = min_height;
- mCtrlPosZ->set( min_height );
- }
- else if ( height > max_height )
- {
- newpos.mV[VZ] = max_height;
- mCtrlPosZ->set( max_height );
- }
-
- // Grass is always drawn on the ground, so clamp its position to the ground
- if (mObject->getPCode() == LL_PCODE_LEGACY_GRASS)
- {
- mCtrlPosZ->set(LLWorld::getInstance()->resolveLandHeightAgent(newpos) + 1.f);
- }
- }
+ if ( height < min_height)
+ {
+ newpos.mV[VZ] = min_height;
+ mCtrlPosZ->set( min_height );
+ }
+ else if ( height > max_height )
+ {
+ newpos.mV[VZ] = max_height;
+ mCtrlPosZ->set( max_height );
+ }
+
+ // Grass is always drawn on the ground, so clamp its position to the ground
+ if (mObject->getPCode() == LL_PCODE_LEGACY_GRASS)
+ {
+ mCtrlPosZ->set(LLWorld::getInstance()->resolveLandHeightAgent(newpos) + 1.f);
+ }
+ }
else
{
if (newpos.length() > MAX_ATTACHMENT_DIST)
@@ -1696,9 +1696,9 @@ void LLPanelObject::sendPosition(BOOL btn_down)
}
}
- // Make sure new position is in a valid region, so the object
- // won't get dumped by the simulator.
- LLVector3d new_pos_global = regionp->getPosGlobalFromRegion(newpos);
+ // Make sure new position is in a valid region, so the object
+ // won't get dumped by the simulator.
+ LLVector3d new_pos_global = regionp->getPosGlobalFromRegion(newpos);
bool is_valid_pos = true;
if (mObject->isAttachment())
{
@@ -1711,213 +1711,213 @@ void LLPanelObject::sendPosition(BOOL btn_down)
is_valid_pos = LLWorld::getInstance()->positionRegionValidGlobal(new_pos_global);
}
- if (is_valid_pos)
- {
- // send only if the position is changed, that is, the delta vector is not zero
- LLVector3d old_pos_global = mObject->getPositionGlobal();
- LLVector3d delta = new_pos_global - old_pos_global;
- // moved more than 1/2 millimeter
- if (delta.magVec() >= 0.0005f)
- {
- if (mRootObject != mObject)
- {
- newpos = newpos - mRootObject->getPositionRegion();
- newpos = newpos * ~mRootObject->getRotationRegion();
- mObject->setPositionParent(newpos);
- }
- else
- {
- mObject->setPositionEdit(newpos);
- }
-
- LLManip::rebuild(mObject) ;
-
- // for individually selected roots, we need to counter-translate all unselected children
- if (mObject->isRootEdit())
- {
- // only offset by parent's translation
- mObject->resetChildrenPosition(LLVector3(-delta), TRUE, TRUE) ;
- }
-
- if(!btn_down)
- {
- LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION);
- }
-
- LLSelectMgr::getInstance()->updateSelectionCenter();
- }
- }
- else
- {
- // move failed, so we update the UI with the correct values
- LLVector3 vec = mRootObject->getPositionRegion();
- mCtrlPosX->set(vec.mV[VX]);
- mCtrlPosY->set(vec.mV[VY]);
- mCtrlPosZ->set(vec.mV[VZ]);
- }
+ if (is_valid_pos)
+ {
+ // send only if the position is changed, that is, the delta vector is not zero
+ LLVector3d old_pos_global = mObject->getPositionGlobal();
+ LLVector3d delta = new_pos_global - old_pos_global;
+ // moved more than 1/2 millimeter
+ if (delta.magVec() >= 0.0005f)
+ {
+ if (mRootObject != mObject)
+ {
+ newpos = newpos - mRootObject->getPositionRegion();
+ newpos = newpos * ~mRootObject->getRotationRegion();
+ mObject->setPositionParent(newpos);
+ }
+ else
+ {
+ mObject->setPositionEdit(newpos);
+ }
+
+ LLManip::rebuild(mObject) ;
+
+ // for individually selected roots, we need to counter-translate all unselected children
+ if (mObject->isRootEdit())
+ {
+ // only offset by parent's translation
+ mObject->resetChildrenPosition(LLVector3(-delta), TRUE, TRUE) ;
+ }
+
+ if(!btn_down)
+ {
+ LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION);
+ }
+
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ }
+ }
+ else
+ {
+ // move failed, so we update the UI with the correct values
+ LLVector3 vec = mRootObject->getPositionRegion();
+ mCtrlPosX->set(vec.mV[VX]);
+ mCtrlPosY->set(vec.mV[VY]);
+ mCtrlPosZ->set(vec.mV[VZ]);
+ }
}
void LLPanelObject::sendSculpt()
{
- if (mObject.isNull())
- return;
-
- LLSculptParams sculpt_params;
- LLUUID sculpt_id = LLUUID::null;
-
- if (mCtrlSculptTexture)
- sculpt_id = mCtrlSculptTexture->getImageAssetID();
-
- U8 sculpt_type = 0;
-
- if (mCtrlSculptType)
- sculpt_type |= mCtrlSculptType->getValue().asInteger();
-
- bool enabled = sculpt_type != LL_SCULPT_TYPE_MESH;
-
- if (mCtrlSculptMirror)
- {
- mCtrlSculptMirror->setEnabled(enabled ? TRUE : FALSE);
- }
- if (mCtrlSculptInvert)
- {
- mCtrlSculptInvert->setEnabled(enabled ? TRUE : FALSE);
- }
-
- if ((mCtrlSculptMirror) && (mCtrlSculptMirror->get()))
- sculpt_type |= LL_SCULPT_FLAG_MIRROR;
-
- if ((mCtrlSculptInvert) && (mCtrlSculptInvert->get()))
- sculpt_type |= LL_SCULPT_FLAG_INVERT;
-
- sculpt_params.setSculptTexture(sculpt_id, sculpt_type);
- mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
+ if (mObject.isNull())
+ return;
+
+ LLSculptParams sculpt_params;
+ LLUUID sculpt_id = LLUUID::null;
+
+ if (mCtrlSculptTexture)
+ sculpt_id = mCtrlSculptTexture->getImageAssetID();
+
+ U8 sculpt_type = 0;
+
+ if (mCtrlSculptType)
+ sculpt_type |= mCtrlSculptType->getValue().asInteger();
+
+ bool enabled = sculpt_type != LL_SCULPT_TYPE_MESH;
+
+ if (mCtrlSculptMirror)
+ {
+ mCtrlSculptMirror->setEnabled(enabled ? TRUE : FALSE);
+ }
+ if (mCtrlSculptInvert)
+ {
+ mCtrlSculptInvert->setEnabled(enabled ? TRUE : FALSE);
+ }
+
+ if ((mCtrlSculptMirror) && (mCtrlSculptMirror->get()))
+ sculpt_type |= LL_SCULPT_FLAG_MIRROR;
+
+ if ((mCtrlSculptInvert) && (mCtrlSculptInvert->get()))
+ sculpt_type |= LL_SCULPT_FLAG_INVERT;
+
+ sculpt_params.setSculptTexture(sculpt_id, sculpt_type);
+ mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
}
void LLPanelObject::refresh()
{
- getState();
- if (mObject.notNull() && mObject->isDead())
- {
- mObject = NULL;
- }
-
- if (mRootObject.notNull() && mRootObject->isDead())
- {
- mRootObject = NULL;
- }
-
- F32 max_scale = get_default_max_prim_scale(LLPickInfo::isFlora(mObject));
-
- getChild<LLSpinCtrl>("Scale X")->setMaxValue(max_scale);
- getChild<LLSpinCtrl>("Scale Y")->setMaxValue(max_scale);
- getChild<LLSpinCtrl>("Scale Z")->setMaxValue(max_scale);
+ getState();
+ if (mObject.notNull() && mObject->isDead())
+ {
+ mObject = NULL;
+ }
+
+ if (mRootObject.notNull() && mRootObject->isDead())
+ {
+ mRootObject = NULL;
+ }
+
+ F32 max_scale = get_default_max_prim_scale(LLPickInfo::isFlora(mObject));
+
+ getChild<LLSpinCtrl>("Scale X")->setMaxValue(max_scale);
+ getChild<LLSpinCtrl>("Scale Y")->setMaxValue(max_scale);
+ getChild<LLSpinCtrl>("Scale Z")->setMaxValue(max_scale);
}
void LLPanelObject::draw()
{
- const LLColor4 white( 1.0f, 1.0f, 1.0f, 1);
- const LLColor4 red( 1.0f, 0.25f, 0.f, 1);
- const LLColor4 green( 0.f, 1.0f, 0.f, 1);
- const LLColor4 blue( 0.f, 0.5f, 1.0f, 1);
-
- // Tune the colors of the labels
- LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
-
- if (tool == LLToolCompTranslate::getInstance())
- {
- mCtrlPosX ->setLabelColor(red);
- mCtrlPosY ->setLabelColor(green);
- mCtrlPosZ ->setLabelColor(blue);
-
- mCtrlScaleX ->setLabelColor(white);
- mCtrlScaleY ->setLabelColor(white);
- mCtrlScaleZ ->setLabelColor(white);
-
- mCtrlRotX ->setLabelColor(white);
- mCtrlRotY ->setLabelColor(white);
- mCtrlRotZ ->setLabelColor(white);
- }
- else if ( tool == LLToolCompScale::getInstance() )
- {
- mCtrlPosX ->setLabelColor(white);
- mCtrlPosY ->setLabelColor(white);
- mCtrlPosZ ->setLabelColor(white);
-
- mCtrlScaleX ->setLabelColor(red);
- mCtrlScaleY ->setLabelColor(green);
- mCtrlScaleZ ->setLabelColor(blue);
-
- mCtrlRotX ->setLabelColor(white);
- mCtrlRotY ->setLabelColor(white);
- mCtrlRotZ ->setLabelColor(white);
- }
- else if ( tool == LLToolCompRotate::getInstance() )
- {
- mCtrlPosX ->setLabelColor(white);
- mCtrlPosY ->setLabelColor(white);
- mCtrlPosZ ->setLabelColor(white);
-
- mCtrlScaleX ->setLabelColor(white);
- mCtrlScaleY ->setLabelColor(white);
- mCtrlScaleZ ->setLabelColor(white);
-
- mCtrlRotX ->setLabelColor(red);
- mCtrlRotY ->setLabelColor(green);
- mCtrlRotZ ->setLabelColor(blue);
- }
- else
- {
- mCtrlPosX ->setLabelColor(white);
- mCtrlPosY ->setLabelColor(white);
- mCtrlPosZ ->setLabelColor(white);
-
- mCtrlScaleX ->setLabelColor(white);
- mCtrlScaleY ->setLabelColor(white);
- mCtrlScaleZ ->setLabelColor(white);
-
- mCtrlRotX ->setLabelColor(white);
- mCtrlRotY ->setLabelColor(white);
- mCtrlRotZ ->setLabelColor(white);
- }
-
- LLPanel::draw();
+ const LLColor4 white( 1.0f, 1.0f, 1.0f, 1);
+ const LLColor4 red( 1.0f, 0.25f, 0.f, 1);
+ const LLColor4 green( 0.f, 1.0f, 0.f, 1);
+ const LLColor4 blue( 0.f, 0.5f, 1.0f, 1);
+
+ // Tune the colors of the labels
+ LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
+
+ if (tool == LLToolCompTranslate::getInstance())
+ {
+ mCtrlPosX ->setLabelColor(red);
+ mCtrlPosY ->setLabelColor(green);
+ mCtrlPosZ ->setLabelColor(blue);
+
+ mCtrlScaleX ->setLabelColor(white);
+ mCtrlScaleY ->setLabelColor(white);
+ mCtrlScaleZ ->setLabelColor(white);
+
+ mCtrlRotX ->setLabelColor(white);
+ mCtrlRotY ->setLabelColor(white);
+ mCtrlRotZ ->setLabelColor(white);
+ }
+ else if ( tool == LLToolCompScale::getInstance() )
+ {
+ mCtrlPosX ->setLabelColor(white);
+ mCtrlPosY ->setLabelColor(white);
+ mCtrlPosZ ->setLabelColor(white);
+
+ mCtrlScaleX ->setLabelColor(red);
+ mCtrlScaleY ->setLabelColor(green);
+ mCtrlScaleZ ->setLabelColor(blue);
+
+ mCtrlRotX ->setLabelColor(white);
+ mCtrlRotY ->setLabelColor(white);
+ mCtrlRotZ ->setLabelColor(white);
+ }
+ else if ( tool == LLToolCompRotate::getInstance() )
+ {
+ mCtrlPosX ->setLabelColor(white);
+ mCtrlPosY ->setLabelColor(white);
+ mCtrlPosZ ->setLabelColor(white);
+
+ mCtrlScaleX ->setLabelColor(white);
+ mCtrlScaleY ->setLabelColor(white);
+ mCtrlScaleZ ->setLabelColor(white);
+
+ mCtrlRotX ->setLabelColor(red);
+ mCtrlRotY ->setLabelColor(green);
+ mCtrlRotZ ->setLabelColor(blue);
+ }
+ else
+ {
+ mCtrlPosX ->setLabelColor(white);
+ mCtrlPosY ->setLabelColor(white);
+ mCtrlPosZ ->setLabelColor(white);
+
+ mCtrlScaleX ->setLabelColor(white);
+ mCtrlScaleY ->setLabelColor(white);
+ mCtrlScaleZ ->setLabelColor(white);
+
+ mCtrlRotX ->setLabelColor(white);
+ mCtrlRotY ->setLabelColor(white);
+ mCtrlRotZ ->setLabelColor(white);
+ }
+
+ LLPanel::draw();
}
// virtual
void LLPanelObject::clearCtrls()
{
- LLPanel::clearCtrls();
-
- mCheckLock ->set(FALSE);
- mCheckLock ->setEnabled( FALSE );
- mCheckPhysics ->set(FALSE);
- mCheckPhysics ->setEnabled( FALSE );
- mCheckTemporary ->set(FALSE);
- mCheckTemporary ->setEnabled( FALSE );
- mCheckPhantom ->set(FALSE);
- mCheckPhantom ->setEnabled( FALSE );
-
- // Disable text labels
- mLabelPosition ->setEnabled( FALSE );
- mLabelSize ->setEnabled( FALSE );
- mLabelRotation ->setEnabled( FALSE );
- mLabelCut ->setEnabled( FALSE );
- mLabelHollow ->setEnabled( FALSE );
- mLabelHoleType ->setEnabled( FALSE );
- mLabelTwist ->setEnabled( FALSE );
- mLabelSkew ->setEnabled( FALSE );
- mLabelShear ->setEnabled( FALSE );
- mLabelTaper ->setEnabled( FALSE );
- mLabelRadiusOffset->setEnabled( FALSE );
- mLabelRevolutions->setEnabled( FALSE );
-
- getChildView("scale_hole")->setEnabled(FALSE);
- getChildView("scale_taper")->setEnabled(FALSE);
- getChildView("advanced_cut")->setEnabled(FALSE);
- getChildView("advanced_dimple")->setEnabled(FALSE);
- getChildView("advanced_slice")->setVisible( FALSE);
+ LLPanel::clearCtrls();
+
+ mCheckLock ->set(FALSE);
+ mCheckLock ->setEnabled( FALSE );
+ mCheckPhysics ->set(FALSE);
+ mCheckPhysics ->setEnabled( FALSE );
+ mCheckTemporary ->set(FALSE);
+ mCheckTemporary ->setEnabled( FALSE );
+ mCheckPhantom ->set(FALSE);
+ mCheckPhantom ->setEnabled( FALSE );
+
+ // Disable text labels
+ mLabelPosition ->setEnabled( FALSE );
+ mLabelSize ->setEnabled( FALSE );
+ mLabelRotation ->setEnabled( FALSE );
+ mLabelCut ->setEnabled( FALSE );
+ mLabelHollow ->setEnabled( FALSE );
+ mLabelHoleType ->setEnabled( FALSE );
+ mLabelTwist ->setEnabled( FALSE );
+ mLabelSkew ->setEnabled( FALSE );
+ mLabelShear ->setEnabled( FALSE );
+ mLabelTaper ->setEnabled( FALSE );
+ mLabelRadiusOffset->setEnabled( FALSE );
+ mLabelRevolutions->setEnabled( FALSE );
+
+ getChildView("scale_hole")->setEnabled(FALSE);
+ getChildView("scale_taper")->setEnabled(FALSE);
+ getChildView("advanced_cut")->setEnabled(FALSE);
+ getChildView("advanced_dimple")->setEnabled(FALSE);
+ getChildView("advanced_slice")->setVisible( FALSE);
}
//
@@ -1927,116 +1927,116 @@ void LLPanelObject::clearCtrls()
// static
void LLPanelObject::onCommitLock(LLUICtrl *ctrl, void *data)
{
- // Checkbox will have toggled itself
- LLPanelObject *self = (LLPanelObject *)data;
+ // Checkbox will have toggled itself
+ LLPanelObject *self = (LLPanelObject *)data;
+
+ if(self->mRootObject.isNull()) return;
- if(self->mRootObject.isNull()) return;
+ BOOL new_state = self->mCheckLock->get();
- BOOL new_state = self->mCheckLock->get();
-
- LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, !new_state, PERM_MOVE | PERM_MODIFY);
+ LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, !new_state, PERM_MOVE | PERM_MODIFY);
}
// static
void LLPanelObject::onCommitPosition( LLUICtrl* ctrl, void* userdata )
{
- LLPanelObject* self = (LLPanelObject*) userdata;
- BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ;
- self->sendPosition(btn_down);
+ LLPanelObject* self = (LLPanelObject*) userdata;
+ BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ;
+ self->sendPosition(btn_down);
}
// static
void LLPanelObject::onCommitScale( LLUICtrl* ctrl, void* userdata )
{
- LLPanelObject* self = (LLPanelObject*) userdata;
- BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ;
- self->sendScale(btn_down);
+ LLPanelObject* self = (LLPanelObject*) userdata;
+ BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ;
+ self->sendScale(btn_down);
}
// static
void LLPanelObject::onCommitRotation( LLUICtrl* ctrl, void* userdata )
{
- LLPanelObject* self = (LLPanelObject*) userdata;
- BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ;
- self->sendRotation(btn_down);
+ LLPanelObject* self = (LLPanelObject*) userdata;
+ BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ;
+ self->sendRotation(btn_down);
}
// static
void LLPanelObject::onCommitPhysics( LLUICtrl* ctrl, void* userdata )
{
- LLPanelObject* self = (LLPanelObject*) userdata;
- self->sendIsPhysical();
+ LLPanelObject* self = (LLPanelObject*) userdata;
+ self->sendIsPhysical();
}
// static
void LLPanelObject::onCommitTemporary( LLUICtrl* ctrl, void* userdata )
{
- LLPanelObject* self = (LLPanelObject*) userdata;
- self->sendIsTemporary();
+ LLPanelObject* self = (LLPanelObject*) userdata;
+ self->sendIsTemporary();
}
// static
void LLPanelObject::onCommitPhantom( LLUICtrl* ctrl, void* userdata )
{
- LLPanelObject* self = (LLPanelObject*) userdata;
- self->sendIsPhantom();
+ LLPanelObject* self = (LLPanelObject*) userdata;
+ self->sendIsPhantom();
}
void LLPanelObject::onSelectSculpt(const LLSD& data)
{
LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control");
- if (mTextureCtrl)
- {
- mSculptTextureRevert = mTextureCtrl->getImageAssetID();
- }
-
- sendSculpt();
+ if (mTextureCtrl)
+ {
+ mSculptTextureRevert = mTextureCtrl->getImageAssetID();
+ }
+
+ sendSculpt();
}
void LLPanelObject::onCommitSculpt( const LLSD& data )
{
- sendSculpt();
+ sendSculpt();
}
BOOL LLPanelObject::onDropSculpt(LLInventoryItem* item)
{
LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control");
- if (mTextureCtrl)
- {
- LLUUID asset = item->getAssetUUID();
+ if (mTextureCtrl)
+ {
+ LLUUID asset = item->getAssetUUID();
- mTextureCtrl->setImageAssetID(asset);
- mSculptTextureRevert = asset;
- }
+ mTextureCtrl->setImageAssetID(asset);
+ mSculptTextureRevert = asset;
+ }
- return TRUE;
+ return TRUE;
}
void LLPanelObject::onCancelSculpt(const LLSD& data)
{
- LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control");
- if(!mTextureCtrl)
- return;
-
- if(mSculptTextureRevert == LLUUID::null)
- {
- mSculptTextureRevert = LLUUID(SCULPT_DEFAULT_TEXTURE);
- }
- mTextureCtrl->setImageAssetID(mSculptTextureRevert);
-
- sendSculpt();
+ LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control");
+ if(!mTextureCtrl)
+ return;
+
+ if(mSculptTextureRevert == LLUUID::null)
+ {
+ mSculptTextureRevert = LLUUID(SCULPT_DEFAULT_TEXTURE);
+ }
+ mTextureCtrl->setImageAssetID(mSculptTextureRevert);
+
+ sendSculpt();
}
// static
void LLPanelObject::onCommitSculptType(LLUICtrl *ctrl, void* userdata)
{
- LLPanelObject* self = (LLPanelObject*) userdata;
+ LLPanelObject* self = (LLPanelObject*) userdata;
- self->sendSculpt();
+ self->sendSculpt();
}
void LLPanelObject::menuDoToSelected(const LLSD& userdata)
diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h
index 515dd27c0a..3754dd3040 100644
--- a/indra/newview/llpanelobject.h
+++ b/indra/newview/llpanelobject.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelobject.h
* @brief Object editing (position, scale, etc.) in the tools floater
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,24 +48,24 @@ class LLUUID;
class LLPanelObject : public LLPanel
{
public:
- LLPanelObject();
- virtual ~LLPanelObject();
+ LLPanelObject();
+ virtual ~LLPanelObject();
+
+ virtual BOOL postBuild();
+ virtual void draw();
+ virtual void clearCtrls();
- virtual BOOL postBuild();
- virtual void draw();
- virtual void clearCtrls();
+ void refresh();
- void refresh();
+ static bool precommitValidate(const LLSD& data);
- static bool precommitValidate(const LLSD& data);
-
- static void onCommitLock(LLUICtrl *ctrl, void *data);
- static void onCommitPosition( LLUICtrl* ctrl, void* userdata);
- static void onCommitScale( LLUICtrl* ctrl, void* userdata);
- static void onCommitRotation( LLUICtrl* ctrl, void* userdata);
- static void onCommitTemporary( LLUICtrl* ctrl, void* userdata);
- static void onCommitPhantom( LLUICtrl* ctrl, void* userdata);
- static void onCommitPhysics( LLUICtrl* ctrl, void* userdata);
+ static void onCommitLock(LLUICtrl *ctrl, void *data);
+ static void onCommitPosition( LLUICtrl* ctrl, void* userdata);
+ static void onCommitScale( LLUICtrl* ctrl, void* userdata);
+ static void onCommitRotation( LLUICtrl* ctrl, void* userdata);
+ static void onCommitTemporary( LLUICtrl* ctrl, void* userdata);
+ static void onCommitPhantom( LLUICtrl* ctrl, void* userdata);
+ static void onCommitPhysics( LLUICtrl* ctrl, void* userdata);
void onCopyPos();
void onPastePos();
@@ -75,113 +75,113 @@ public:
void onPasteRot();
void onCopyParams();
void onPasteParams();
- static void onCommitParametric(LLUICtrl* ctrl, void* userdata);
+ static void onCommitParametric(LLUICtrl* ctrl, void* userdata);
- void onCommitSculpt(const LLSD& data);
- void onCancelSculpt(const LLSD& data);
- void onSelectSculpt(const LLSD& data);
- BOOL onDropSculpt(LLInventoryItem* item);
- static void onCommitSculptType( LLUICtrl *ctrl, void* userdata);
+ void onCommitSculpt(const LLSD& data);
+ void onCancelSculpt(const LLSD& data);
+ void onSelectSculpt(const LLSD& data);
+ BOOL onDropSculpt(LLInventoryItem* item);
+ static void onCommitSculptType( LLUICtrl *ctrl, void* userdata);
void menuDoToSelected(const LLSD& userdata);
bool menuEnableItem(const LLSD& userdata);
protected:
- void getState();
-
- void sendRotation(BOOL btn_down);
- void sendScale(BOOL btn_down);
- void sendPosition(BOOL btn_down);
- void sendIsPhysical();
- void sendIsTemporary();
- void sendIsPhantom();
-
- void sendSculpt();
-
- void getVolumeParams(LLVolumeParams& volume_params);
-
+ void getState();
+
+ void sendRotation(BOOL btn_down);
+ void sendScale(BOOL btn_down);
+ void sendPosition(BOOL btn_down);
+ void sendIsPhysical();
+ void sendIsTemporary();
+ void sendIsPhantom();
+
+ void sendSculpt();
+
+ void getVolumeParams(LLVolumeParams& volume_params);
+
protected:
- // Per-object options
- LLComboBox* mComboBaseType;
- LLMenuButton* mMenuClipboardParams;
-
- LLTextBox* mLabelCut;
- LLSpinCtrl* mSpinCutBegin;
- LLSpinCtrl* mSpinCutEnd;
-
- LLTextBox* mLabelHollow;
- LLSpinCtrl* mSpinHollow;
-
- LLTextBox* mLabelHoleType;
- LLComboBox* mComboHoleType;
-
- LLTextBox* mLabelTwist;
- LLSpinCtrl* mSpinTwist;
- LLSpinCtrl* mSpinTwistBegin;
-
- LLSpinCtrl* mSpinScaleX;
- LLSpinCtrl* mSpinScaleY;
-
- LLTextBox* mLabelSkew;
- LLSpinCtrl* mSpinSkew;
-
- LLTextBox* mLabelShear;
- LLSpinCtrl* mSpinShearX;
- LLSpinCtrl* mSpinShearY;
-
- // Advanced Path
- LLSpinCtrl* mCtrlPathBegin;
- LLSpinCtrl* mCtrlPathEnd;
-
- LLTextBox* mLabelTaper;
- LLSpinCtrl* mSpinTaperX;
- LLSpinCtrl* mSpinTaperY;
-
- LLTextBox* mLabelRadiusOffset;
- LLSpinCtrl* mSpinRadiusOffset;
-
- LLTextBox* mLabelRevolutions;
- LLSpinCtrl* mSpinRevolutions;
-
- LLMenuButton* mMenuClipboardPos;
- LLTextBox* mLabelPosition;
- LLSpinCtrl* mCtrlPosX;
- LLSpinCtrl* mCtrlPosY;
- LLSpinCtrl* mCtrlPosZ;
-
- LLMenuButton* mMenuClipboardSize;
- LLTextBox* mLabelSize;
- LLSpinCtrl* mCtrlScaleX;
- LLSpinCtrl* mCtrlScaleY;
- LLSpinCtrl* mCtrlScaleZ;
- BOOL mSizeChanged;
-
- LLMenuButton* mMenuClipboardRot;
- LLTextBox* mLabelRotation;
- LLSpinCtrl* mCtrlRotX;
- LLSpinCtrl* mCtrlRotY;
- LLSpinCtrl* mCtrlRotZ;
-
- LLCheckBoxCtrl *mCheckLock;
- LLCheckBoxCtrl *mCheckPhysics;
- LLCheckBoxCtrl *mCheckTemporary;
- LLCheckBoxCtrl *mCheckPhantom;
-
- LLTextureCtrl *mCtrlSculptTexture;
- LLTextBox *mLabelSculptType;
- LLComboBox *mCtrlSculptType;
- LLCheckBoxCtrl *mCtrlSculptMirror;
- LLCheckBoxCtrl *mCtrlSculptInvert;
-
- LLVector3 mCurEulerDegrees; // to avoid sending rotation when not changed
- BOOL mIsPhysical; // to avoid sending "physical" when not changed
- BOOL mIsTemporary; // to avoid sending "temporary" when not changed
- BOOL mIsPhantom; // to avoid sending "phantom" when not changed
- S32 mSelectedType; // So we know what selected type we last were
-
- LLUUID mSculptTextureRevert; // so we can revert the sculpt texture on cancel
- U8 mSculptTypeRevert; // so we can revert the sculpt type on cancel
+ // Per-object options
+ LLComboBox* mComboBaseType;
+ LLMenuButton* mMenuClipboardParams;
+
+ LLTextBox* mLabelCut;
+ LLSpinCtrl* mSpinCutBegin;
+ LLSpinCtrl* mSpinCutEnd;
+
+ LLTextBox* mLabelHollow;
+ LLSpinCtrl* mSpinHollow;
+
+ LLTextBox* mLabelHoleType;
+ LLComboBox* mComboHoleType;
+
+ LLTextBox* mLabelTwist;
+ LLSpinCtrl* mSpinTwist;
+ LLSpinCtrl* mSpinTwistBegin;
+
+ LLSpinCtrl* mSpinScaleX;
+ LLSpinCtrl* mSpinScaleY;
+
+ LLTextBox* mLabelSkew;
+ LLSpinCtrl* mSpinSkew;
+
+ LLTextBox* mLabelShear;
+ LLSpinCtrl* mSpinShearX;
+ LLSpinCtrl* mSpinShearY;
+
+ // Advanced Path
+ LLSpinCtrl* mCtrlPathBegin;
+ LLSpinCtrl* mCtrlPathEnd;
+
+ LLTextBox* mLabelTaper;
+ LLSpinCtrl* mSpinTaperX;
+ LLSpinCtrl* mSpinTaperY;
+
+ LLTextBox* mLabelRadiusOffset;
+ LLSpinCtrl* mSpinRadiusOffset;
+
+ LLTextBox* mLabelRevolutions;
+ LLSpinCtrl* mSpinRevolutions;
+
+ LLMenuButton* mMenuClipboardPos;
+ LLTextBox* mLabelPosition;
+ LLSpinCtrl* mCtrlPosX;
+ LLSpinCtrl* mCtrlPosY;
+ LLSpinCtrl* mCtrlPosZ;
+
+ LLMenuButton* mMenuClipboardSize;
+ LLTextBox* mLabelSize;
+ LLSpinCtrl* mCtrlScaleX;
+ LLSpinCtrl* mCtrlScaleY;
+ LLSpinCtrl* mCtrlScaleZ;
+ BOOL mSizeChanged;
+
+ LLMenuButton* mMenuClipboardRot;
+ LLTextBox* mLabelRotation;
+ LLSpinCtrl* mCtrlRotX;
+ LLSpinCtrl* mCtrlRotY;
+ LLSpinCtrl* mCtrlRotZ;
+
+ LLCheckBoxCtrl *mCheckLock;
+ LLCheckBoxCtrl *mCheckPhysics;
+ LLCheckBoxCtrl *mCheckTemporary;
+ LLCheckBoxCtrl *mCheckPhantom;
+
+ LLTextureCtrl *mCtrlSculptTexture;
+ LLTextBox *mLabelSculptType;
+ LLComboBox *mCtrlSculptType;
+ LLCheckBoxCtrl *mCtrlSculptMirror;
+ LLCheckBoxCtrl *mCtrlSculptInvert;
+
+ LLVector3 mCurEulerDegrees; // to avoid sending rotation when not changed
+ BOOL mIsPhysical; // to avoid sending "physical" when not changed
+ BOOL mIsTemporary; // to avoid sending "temporary" when not changed
+ BOOL mIsPhantom; // to avoid sending "phantom" when not changed
+ S32 mSelectedType; // So we know what selected type we last were
+
+ LLUUID mSculptTextureRevert; // so we can revert the sculpt texture on cancel
+ U8 mSculptTypeRevert; // so we can revert the sculpt type on cancel
LLVector3 mClipboardPos;
LLVector3 mClipboardSize;
@@ -192,8 +192,8 @@ protected:
bool mHasClipboardSize;
bool mHasClipboardRot;
- LLPointer<LLViewerObject> mObject;
- LLPointer<LLViewerObject> mRootObject;
+ LLPointer<LLViewerObject> mObject;
+ LLPointer<LLViewerObject> mRootObject;
};
#endif
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 632e902d70..cda5689d73 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -77,198 +77,198 @@ const LLColor4U DEFAULT_WHITE(255, 255, 255);
class LLTaskInvFVBridge : public LLFolderViewModelItemInventory
{
protected:
- LLUUID mUUID;
- std::string mName;
- mutable std::string mDisplayName;
- mutable std::string mSearchableName;
- LLPanelObjectInventory* mPanel;
- U32 mFlags;
- LLAssetType::EType mAssetType;
- LLInventoryType::EType mInventoryType;
-
- LLInventoryObject* findInvObject() const;
- LLInventoryItem* findItem() const;
+ LLUUID mUUID;
+ std::string mName;
+ mutable std::string mDisplayName;
+ mutable std::string mSearchableName;
+ LLPanelObjectInventory* mPanel;
+ U32 mFlags;
+ LLAssetType::EType mAssetType;
+ LLInventoryType::EType mInventoryType;
+
+ LLInventoryObject* findInvObject() const;
+ LLInventoryItem* findItem() const;
public:
- LLTaskInvFVBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- U32 flags=0);
- virtual ~LLTaskInvFVBridge() {}
+ LLTaskInvFVBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name,
+ U32 flags=0);
+ virtual ~LLTaskInvFVBridge() {}
- virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
- virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
+ virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
+ virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
- static LLTaskInvFVBridge* createObjectBridge(LLPanelObjectInventory* panel,
- LLInventoryObject* object);
- void showProperties();
- S32 getPrice();
+ static LLTaskInvFVBridge* createObjectBridge(LLPanelObjectInventory* panel,
+ LLInventoryObject* object);
+ void showProperties();
+ S32 getPrice();
- // LLFolderViewModelItemInventory functionality
- virtual const std::string& getName() const;
- virtual const std::string& getDisplayName() const;
- virtual const std::string& getSearchableName() const;
+ // LLFolderViewModelItemInventory functionality
+ virtual const std::string& getName() const;
+ virtual const std::string& getDisplayName() const;
+ virtual const std::string& getSearchableName() const;
- virtual std::string getSearchableDescription() const {return LLStringUtil::null;}
- virtual std::string getSearchableCreatorName() const {return LLStringUtil::null;}
- virtual std::string getSearchableUUIDString() const {return LLStringUtil::null;}
+ virtual std::string getSearchableDescription() const {return LLStringUtil::null;}
+ virtual std::string getSearchableCreatorName() const {return LLStringUtil::null;}
+ virtual std::string getSearchableUUIDString() const {return LLStringUtil::null;}
- virtual PermissionMask getPermissionMask() const { return PERM_NONE; }
- /*virtual*/ LLFolderType::EType getPreferredType() const { return LLFolderType::FT_NONE; }
- virtual const LLUUID& getUUID() const { return mUUID; }
+ virtual PermissionMask getPermissionMask() const { return PERM_NONE; }
+ /*virtual*/ LLFolderType::EType getPreferredType() const { return LLFolderType::FT_NONE; }
+ virtual const LLUUID& getUUID() const { return mUUID; }
virtual const LLUUID& getThumbnailUUID() const { return LLUUID::null;}
- virtual time_t getCreationDate() const;
- virtual void setCreationDate(time_t creation_date_utc);
-
- virtual LLUIImagePtr getIcon() const;
- virtual void openItem();
- virtual BOOL canOpenItem() const { return FALSE; }
- virtual void closeItem() {}
- virtual void selectItem() {}
+ virtual time_t getCreationDate() const;
+ virtual void setCreationDate(time_t creation_date_utc);
+
+ virtual LLUIImagePtr getIcon() const;
+ virtual void openItem();
+ virtual BOOL canOpenItem() const { return FALSE; }
+ virtual void closeItem() {}
+ virtual void selectItem() {}
virtual void navigateToFolder(bool new_window = false, bool change_mode = false) {}
- virtual BOOL isItemRenameable() const;
- virtual BOOL renameItem(const std::string& new_name);
- virtual BOOL isItemMovable() const;
- virtual BOOL isItemRemovable() const;
- virtual BOOL removeItem();
- virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch);
- virtual void move(LLFolderViewModelItem* parent_listener);
+ virtual BOOL isItemRenameable() const;
+ virtual BOOL renameItem(const std::string& new_name);
+ virtual BOOL isItemMovable() const;
+ virtual BOOL isItemRemovable() const;
+ virtual BOOL removeItem();
+ virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch);
+ virtual void move(LLFolderViewModelItem* parent_listener);
virtual bool isItemCopyable(bool can_copy_as_link = true) const;
- virtual BOOL copyToClipboard() const;
- virtual BOOL cutToClipboard();
- virtual BOOL isClipboardPasteable() const;
- virtual void pasteFromClipboard();
- virtual void pasteLinkFromClipboard();
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual BOOL isUpToDate() const { return TRUE; }
- virtual bool hasChildren() const { return FALSE; }
- virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; }
- virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; }
+ virtual BOOL copyToClipboard() const;
+ virtual BOOL cutToClipboard();
+ virtual BOOL isClipboardPasteable() const;
+ virtual void pasteFromClipboard();
+ virtual void pasteLinkFromClipboard();
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual BOOL isUpToDate() const { return TRUE; }
+ virtual bool hasChildren() const { return FALSE; }
+ virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; }
+ virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; }
virtual LLSettingsType::type_e getSettingsType() const { return LLSettingsType::ST_NONE; }
- virtual EInventorySortGroup getSortGroup() const { return SG_ITEM; }
- virtual LLInventoryObject* getInventoryObject() const { return findInvObject(); }
+ virtual EInventorySortGroup getSortGroup() const { return SG_ITEM; }
+ virtual LLInventoryObject* getInventoryObject() const { return findInvObject(); }
- // LLDragAndDropBridge functionality
- virtual LLToolDragAndDrop::ESource getDragSource() const { return LLToolDragAndDrop::SOURCE_WORLD; }
- virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
- virtual BOOL dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg);
+ // LLDragAndDropBridge functionality
+ virtual LLToolDragAndDrop::ESource getDragSource() const { return LLToolDragAndDrop::SOURCE_WORLD; }
+ virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
+ virtual BOOL dragOrDrop(MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg);
};
LLTaskInvFVBridge::LLTaskInvFVBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- U32 flags)
-: LLFolderViewModelItemInventory(panel->getRootViewModel()),
- mUUID(uuid),
- mName(name),
- mPanel(panel),
- mFlags(flags),
- mAssetType(LLAssetType::AT_NONE),
- mInventoryType(LLInventoryType::IT_NONE)
-{
- const LLInventoryItem *item = findItem();
- if (item)
- {
- mAssetType = item->getType();
- mInventoryType = item->getInventoryType();
- }
+ LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name,
+ U32 flags)
+: LLFolderViewModelItemInventory(panel->getRootViewModel()),
+ mUUID(uuid),
+ mName(name),
+ mPanel(panel),
+ mFlags(flags),
+ mAssetType(LLAssetType::AT_NONE),
+ mInventoryType(LLInventoryType::IT_NONE)
+{
+ const LLInventoryItem *item = findItem();
+ if (item)
+ {
+ mAssetType = item->getType();
+ mInventoryType = item->getInventoryType();
+ }
}
LLInventoryObject* LLTaskInvFVBridge::findInvObject() const
{
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if (object)
- {
- return object->getInventoryObject(mUUID);
- }
- return NULL;
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if (object)
+ {
+ return object->getInventoryObject(mUUID);
+ }
+ return NULL;
}
LLInventoryItem* LLTaskInvFVBridge::findItem() const
{
- return dynamic_cast<LLInventoryItem*>(findInvObject());
+ return dynamic_cast<LLInventoryItem*>(findInvObject());
}
void LLTaskInvFVBridge::showProperties()
{
- show_task_item_profile(mUUID, mPanel->getTaskUUID());
+ show_task_item_profile(mUUID, mPanel->getTaskUUID());
}
S32 LLTaskInvFVBridge::getPrice()
{
- LLInventoryItem* item = findItem();
- if(item)
- {
- return item->getSaleInfo().getSalePrice();
- }
- else
- {
- return -1;
- }
+ LLInventoryItem* item = findItem();
+ if(item)
+ {
+ return item->getSaleInfo().getSalePrice();
+ }
+ else
+ {
+ return -1;
+ }
}
const std::string& LLTaskInvFVBridge::getName() const
{
- return mName;
+ return mName;
}
const std::string& LLTaskInvFVBridge::getDisplayName() const
{
- LLInventoryItem* item = findItem();
+ LLInventoryItem* item = findItem();
- if(item)
- {
- mDisplayName.assign(item->getName());
+ if(item)
+ {
+ mDisplayName.assign(item->getName());
- // Localize "New Script", "New Script 1", "New Script 2", etc.
- if (item->getType() == LLAssetType::AT_LSL_TEXT &&
- LLStringUtil::startsWith(item->getName(), "New Script"))
- {
- LLStringUtil::replaceString(mDisplayName, "New Script", LLTrans::getString("PanelContentsNewScript"));
- }
+ // Localize "New Script", "New Script 1", "New Script 2", etc.
+ if (item->getType() == LLAssetType::AT_LSL_TEXT &&
+ LLStringUtil::startsWith(item->getName(), "New Script"))
+ {
+ LLStringUtil::replaceString(mDisplayName, "New Script", LLTrans::getString("PanelContentsNewScript"));
+ }
- const LLPermissions& perm(item->getPermissions());
- BOOL copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE);
- BOOL mod = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE);
- BOOL xfer = gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE);
+ const LLPermissions& perm(item->getPermissions());
+ BOOL copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE);
+ BOOL mod = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE);
+ BOOL xfer = gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE);
- if(!copy)
- {
- mDisplayName.append(LLTrans::getString("no_copy"));
- }
- if(!mod)
- {
- mDisplayName.append(LLTrans::getString("no_modify"));
- }
- if(!xfer)
- {
- mDisplayName.append(LLTrans::getString("no_transfer"));
- }
- }
+ if(!copy)
+ {
+ mDisplayName.append(LLTrans::getString("no_copy"));
+ }
+ if(!mod)
+ {
+ mDisplayName.append(LLTrans::getString("no_modify"));
+ }
+ if(!xfer)
+ {
+ mDisplayName.append(LLTrans::getString("no_transfer"));
+ }
+ }
- mSearchableName.assign(mDisplayName + getLabelSuffix());
+ mSearchableName.assign(mDisplayName + getLabelSuffix());
- return mDisplayName;
+ return mDisplayName;
}
const std::string& LLTaskInvFVBridge::getSearchableName() const
{
- return mSearchableName;
+ return mSearchableName;
}
// BUG: No creation dates for task inventory
time_t LLTaskInvFVBridge::getCreationDate() const
{
- return 0;
+ return 0;
}
void LLTaskInvFVBridge::setCreationDate(time_t creation_date_utc)
@@ -277,95 +277,95 @@ void LLTaskInvFVBridge::setCreationDate(time_t creation_date_utc)
LLUIImagePtr LLTaskInvFVBridge::getIcon() const
{
- const BOOL item_is_multi = (mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS);
+ const BOOL item_is_multi = (mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS);
- return LLInventoryIcon::getIcon(mAssetType, mInventoryType, 0, item_is_multi );
+ return LLInventoryIcon::getIcon(mAssetType, mInventoryType, 0, item_is_multi );
}
void LLTaskInvFVBridge::openItem()
{
- // no-op.
- LL_DEBUGS() << "LLTaskInvFVBridge::openItem()" << LL_ENDL;
+ // no-op.
+ LL_DEBUGS() << "LLTaskInvFVBridge::openItem()" << LL_ENDL;
}
BOOL LLTaskInvFVBridge::isItemRenameable() const
{
- if(gAgent.isGodlike()) return TRUE;
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(object)
- {
- LLInventoryItem* item = (LLInventoryItem*)(object->getInventoryObject(mUUID));
- if(item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(),
- GP_OBJECT_MANIPULATE, GOD_LIKE))
- {
- return TRUE;
- }
- }
- return FALSE;
+ if(gAgent.isGodlike()) return TRUE;
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(object)
+ {
+ LLInventoryItem* item = (LLInventoryItem*)(object->getInventoryObject(mUUID));
+ if(item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(),
+ GP_OBJECT_MANIPULATE, GOD_LIKE))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
BOOL LLTaskInvFVBridge::renameItem(const std::string& new_name)
{
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(object)
- {
- LLViewerInventoryItem* item = NULL;
- item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID);
- if(item && (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(),
- GP_OBJECT_MANIPULATE, GOD_LIKE)))
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->rename(new_name);
- object->updateInventory(
- new_item,
- TASK_INVENTORY_ITEM_KEY,
- false);
- }
- }
- return TRUE;
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(object)
+ {
+ LLViewerInventoryItem* item = NULL;
+ item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID);
+ if(item && (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(),
+ GP_OBJECT_MANIPULATE, GOD_LIKE)))
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->rename(new_name);
+ object->updateInventory(
+ new_item,
+ TASK_INVENTORY_ITEM_KEY,
+ false);
+ }
+ }
+ return TRUE;
}
BOOL LLTaskInvFVBridge::isItemMovable() const
{
- //LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- //if(object && (object->permModify() || gAgent.isGodlike()))
- //{
- // return TRUE;
- //}
- //return FALSE;
- return TRUE;
+ //LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ //if(object && (object->permModify() || gAgent.isGodlike()))
+ //{
+ // return TRUE;
+ //}
+ //return FALSE;
+ return TRUE;
}
BOOL LLTaskInvFVBridge::isItemRemovable() const
{
- const LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(object
- && (object->permModify() || object->permYouOwner()))
- {
- return TRUE;
- }
- return FALSE;
+ const LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(object
+ && (object->permModify() || object->permYouOwner()))
+ {
+ return TRUE;
+ }
+ return FALSE;
}
bool remove_task_inventory_callback(const LLSD& notification, const LLSD& response, LLPanelObjectInventory* panel)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLViewerObject* object = gObjectList.findObject(notification["payload"]["task_id"].asUUID());
- if(option == 0 && object)
- {
- // yes
- LLSD::array_const_iterator list_end = notification["payload"]["inventory_ids"].endArray();
- for (LLSD::array_const_iterator list_it = notification["payload"]["inventory_ids"].beginArray();
- list_it != list_end;
- ++list_it)
- {
- object->removeInventory(list_it->asUUID());
- }
-
- // refresh the UI.
- panel->refresh();
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLViewerObject* object = gObjectList.findObject(notification["payload"]["task_id"].asUUID());
+ if(option == 0 && object)
+ {
+ // yes
+ LLSD::array_const_iterator list_end = notification["payload"]["inventory_ids"].endArray();
+ for (LLSD::array_const_iterator list_it = notification["payload"]["inventory_ids"].beginArray();
+ list_it != list_end;
+ ++list_it)
+ {
+ object->removeInventory(list_it->asUUID());
+ }
+
+ // refresh the UI.
+ panel->refresh();
+ }
+ return false;
}
// helper for remove
@@ -374,68 +374,68 @@ typedef std::pair<LLUUID, std::list<LLUUID> > panel_two_uuids_list_t;
typedef std::pair<LLPanelObjectInventory*, panel_two_uuids_list_t> remove_data_t;
BOOL LLTaskInvFVBridge::removeItem()
{
- if(isItemRemovable() && mPanel)
- {
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(object)
- {
- if(object->permModify())
- {
- // just do it.
- object->removeInventory(mUUID);
- return TRUE;
- }
- else
- {
- LLSD payload;
- payload["task_id"] = mPanel->getTaskUUID();
- payload["inventory_ids"].append(mUUID);
- LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel));
- return FALSE;
- }
- }
- }
- return FALSE;
+ if(isItemRemovable() && mPanel)
+ {
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(object)
+ {
+ if(object->permModify())
+ {
+ // just do it.
+ object->removeInventory(mUUID);
+ return TRUE;
+ }
+ else
+ {
+ LLSD payload;
+ payload["task_id"] = mPanel->getTaskUUID();
+ payload["inventory_ids"].append(mUUID);
+ LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel));
+ return FALSE;
+ }
+ }
+ }
+ return FALSE;
}
void LLTaskInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch)
{
- if (!mPanel)
- {
- return;
- }
-
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if (!object)
- {
- return;
- }
-
- if (!object->permModify())
- {
- LLSD payload;
- payload["task_id"] = mPanel->getTaskUUID();
- for (S32 i = 0; i < (S32)batch.size(); i++)
- {
- LLTaskInvFVBridge* itemp = (LLTaskInvFVBridge*)batch[i];
- payload["inventory_ids"].append(itemp->getUUID());
- }
- LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel));
-
- }
- else
- {
- for (S32 i = 0; i < (S32)batch.size(); i++)
- {
- LLTaskInvFVBridge* itemp = (LLTaskInvFVBridge*)batch[i];
-
- if(itemp->isItemRemovable())
- {
- // just do it.
- object->removeInventory(itemp->getUUID());
- }
- }
- }
+ if (!mPanel)
+ {
+ return;
+ }
+
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if (!object)
+ {
+ return;
+ }
+
+ if (!object->permModify())
+ {
+ LLSD payload;
+ payload["task_id"] = mPanel->getTaskUUID();
+ for (S32 i = 0; i < (S32)batch.size(); i++)
+ {
+ LLTaskInvFVBridge* itemp = (LLTaskInvFVBridge*)batch[i];
+ payload["inventory_ids"].append(itemp->getUUID());
+ }
+ LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel));
+
+ }
+ else
+ {
+ for (S32 i = 0; i < (S32)batch.size(); i++)
+ {
+ LLTaskInvFVBridge* itemp = (LLTaskInvFVBridge*)batch[i];
+
+ if(itemp->isItemRemovable())
+ {
+ // just do it.
+ object->removeInventory(itemp->getUUID());
+ }
+ }
+ }
}
void LLTaskInvFVBridge::move(LLFolderViewModelItem* parent_listener)
@@ -444,25 +444,25 @@ void LLTaskInvFVBridge::move(LLFolderViewModelItem* parent_listener)
bool LLTaskInvFVBridge::isItemCopyable(bool can_link) const
{
- LLInventoryItem* item = findItem();
- if(!item) return false;
- return gAgent.allowOperation(PERM_COPY, item->getPermissions(),
- GP_OBJECT_MANIPULATE);
+ LLInventoryItem* item = findItem();
+ if(!item) return false;
+ return gAgent.allowOperation(PERM_COPY, item->getPermissions(),
+ GP_OBJECT_MANIPULATE);
}
BOOL LLTaskInvFVBridge::copyToClipboard() const
{
- return FALSE;
+ return FALSE;
}
BOOL LLTaskInvFVBridge::cutToClipboard()
{
- return FALSE;
+ return FALSE;
}
BOOL LLTaskInvFVBridge::isClipboardPasteable() const
{
- return FALSE;
+ return FALSE;
}
void LLTaskInvFVBridge::pasteFromClipboard()
@@ -475,99 +475,99 @@ void LLTaskInvFVBridge::pasteLinkFromClipboard()
BOOL LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
{
- //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL;
- if(mPanel)
- {
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(object)
- {
- LLInventoryItem* inv = NULL;
- if((inv = (LLInventoryItem*)object->getInventoryObject(mUUID)))
- {
- const LLPermissions& perm = inv->getPermissions();
- bool can_copy = gAgent.allowOperation(PERM_COPY, perm,
- GP_OBJECT_MANIPULATE);
- if (object->isAttachment() && !can_copy)
- {
+ //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL;
+ if(mPanel)
+ {
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(object)
+ {
+ LLInventoryItem* inv = NULL;
+ if((inv = (LLInventoryItem*)object->getInventoryObject(mUUID)))
+ {
+ const LLPermissions& perm = inv->getPermissions();
+ bool can_copy = gAgent.allowOperation(PERM_COPY, perm,
+ GP_OBJECT_MANIPULATE);
+ if (object->isAttachment() && !can_copy)
+ {
//RN: no copy contents of attachments cannot be dragged out
// due to a race condition and possible exploit where
// attached objects do not update their inventory items
// when their contents are manipulated
return FALSE;
- }
- if((can_copy && perm.allowTransferTo(gAgent.getID()))
- || object->permYouOwner())
-// || gAgent.isGodlike())
+ }
+ if((can_copy && perm.allowTransferTo(gAgent.getID()))
+ || object->permYouOwner())
+// || gAgent.isGodlike())
- {
- *type = LLViewerAssetType::lookupDragAndDropType(inv->getType());
+ {
+ *type = LLViewerAssetType::lookupDragAndDropType(inv->getType());
- *id = inv->getUUID();
- return TRUE;
- }
- }
- }
- }
- return FALSE;
+ *id = inv->getUUID();
+ return TRUE;
+ }
+ }
+ }
+ }
+ return FALSE;
}
BOOL LLTaskInvFVBridge::dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg)
{
- //LL_INFOS() << "LLTaskInvFVBridge::dragOrDrop()" << LL_ENDL;
- return FALSE;
+ //LL_INFOS() << "LLTaskInvFVBridge::dragOrDrop()" << LL_ENDL;
+ return FALSE;
}
// virtual
void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string action)
{
- if (action == "task_open")
- {
- openItem();
- }
- else if (action == "task_properties")
- {
- showProperties();
- }
+ if (action == "task_open")
+ {
+ openItem();
+ }
+ else if (action == "task_properties")
+ {
+ showProperties();
+ }
}
void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LLInventoryItem* item = findItem();
- std::vector<std::string> items;
- std::vector<std::string> disabled_items;
-
- if (!item)
- {
- hide_context_entries(menu, items, disabled_items);
- return;
- }
-
- if (canOpenItem())
- {
- items.push_back(std::string("Task Open"));
- }
- items.push_back(std::string("Task Properties"));
- if ((flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Task Properties"));
- }
- if(isItemRenameable())
- {
- items.push_back(std::string("Task Rename"));
- if ((flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Task Rename"));
- }
- }
- if(isItemRemovable())
- {
- items.push_back(std::string("Task Remove"));
- }
-
- hide_context_entries(menu, items, disabled_items);
+ LLInventoryItem* item = findItem();
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+
+ if (!item)
+ {
+ hide_context_entries(menu, items, disabled_items);
+ return;
+ }
+
+ if (canOpenItem())
+ {
+ items.push_back(std::string("Task Open"));
+ }
+ items.push_back(std::string("Task Properties"));
+ if ((flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Task Properties"));
+ }
+ if(isItemRenameable())
+ {
+ items.push_back(std::string("Task Rename"));
+ if ((flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Task Rename"));
+ }
+ }
+ if(isItemRemovable())
+ {
+ items.push_back(std::string("Task Remove"));
+ }
+
+ hide_context_entries(menu, items, disabled_items);
}
@@ -578,49 +578,49 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
class LLTaskCategoryBridge : public LLTaskInvFVBridge
{
public:
- LLTaskCategoryBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name);
-
- virtual LLUIImagePtr getIcon() const;
- virtual const std::string& getDisplayName() const;
- virtual BOOL isItemRenameable() const;
- // virtual BOOL isItemCopyable() const { return FALSE; }
- virtual BOOL renameItem(const std::string& new_name);
- virtual BOOL isItemRemovable() const;
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual bool hasChildren() const;
- virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
- virtual BOOL dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg);
- virtual BOOL canOpenItem() const { return TRUE; }
- virtual void openItem();
- virtual EInventorySortGroup getSortGroup() const { return SG_NORMAL_FOLDER; }
+ LLTaskCategoryBridge(
+ LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name);
+
+ virtual LLUIImagePtr getIcon() const;
+ virtual const std::string& getDisplayName() const;
+ virtual BOOL isItemRenameable() const;
+ // virtual BOOL isItemCopyable() const { return FALSE; }
+ virtual BOOL renameItem(const std::string& new_name);
+ virtual BOOL isItemRemovable() const;
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ virtual bool hasChildren() const;
+ virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
+ virtual BOOL dragOrDrop(MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg);
+ virtual BOOL canOpenItem() const { return TRUE; }
+ virtual void openItem();
+ virtual EInventorySortGroup getSortGroup() const { return SG_NORMAL_FOLDER; }
};
LLTaskCategoryBridge::LLTaskCategoryBridge(
- LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name)
+ LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name)
{
}
LLUIImagePtr LLTaskCategoryBridge::getIcon() const
{
- return LLUI::getUIImage("Inv_FolderClosed");
+ return LLUI::getUIImage("Inv_FolderClosed");
}
// virtual
const std::string& LLTaskCategoryBridge::getDisplayName() const
{
- LLInventoryObject* cat = findInvObject();
+ LLInventoryObject* cat = findInvObject();
- if (cat)
- {
+ if (cat)
+ {
std::string name = cat->getName();
if (mChildren.size() > 0)
{
@@ -632,39 +632,39 @@ const std::string& LLTaskCategoryBridge::getDisplayName() const
name.append(" " + LLTrans::getString("InventoryItemsCount", args));
}
- mDisplayName.assign(name);
- }
+ mDisplayName.assign(name);
+ }
- return mDisplayName;
+ return mDisplayName;
}
BOOL LLTaskCategoryBridge::isItemRenameable() const
{
- return FALSE;
+ return FALSE;
}
BOOL LLTaskCategoryBridge::renameItem(const std::string& new_name)
{
- return FALSE;
+ return FALSE;
}
BOOL LLTaskCategoryBridge::isItemRemovable() const
{
- return FALSE;
+ return FALSE;
}
void LLTaskCategoryBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- std::vector<std::string> items;
- std::vector<std::string> disabled_items;
- hide_context_entries(menu, items, disabled_items);
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+ hide_context_entries(menu, items, disabled_items);
}
bool LLTaskCategoryBridge::hasChildren() const
{
- // return TRUE if we have or do know know if we have children.
- // *FIX: For now, return FALSE - we will know for sure soon enough.
- return FALSE;
+ // return TRUE if we have or do know know if we have children.
+ // *FIX: For now, return FALSE - we will know for sure soon enough.
+ return FALSE;
}
void LLTaskCategoryBridge::openItem()
@@ -673,90 +673,90 @@ void LLTaskCategoryBridge::openItem()
BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
{
- //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL;
- if(mPanel && mUUID.notNull())
- {
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(object)
- {
- const LLInventoryObject* cat = object->getInventoryObject(mUUID);
- if ( (cat) && (move_inv_category_world_to_agent(mUUID, LLUUID::null, FALSE)) )
- {
- *type = LLViewerAssetType::lookupDragAndDropType(cat->getType());
- *id = mUUID;
- return TRUE;
- }
- }
- }
- return FALSE;
+ //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL;
+ if(mPanel && mUUID.notNull())
+ {
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(object)
+ {
+ const LLInventoryObject* cat = object->getInventoryObject(mUUID);
+ if ( (cat) && (move_inv_category_world_to_agent(mUUID, LLUUID::null, FALSE)) )
+ {
+ *type = LLViewerAssetType::lookupDragAndDropType(cat->getType());
+ *id = mUUID;
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
}
BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg)
-{
- //LL_INFOS() << "LLTaskCategoryBridge::dragOrDrop()" << LL_ENDL;
- BOOL accept = FALSE;
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(object)
- {
- switch(cargo_type)
- {
- case DAD_CATEGORY:
- accept = LLToolDragAndDrop::getInstance()->dadUpdateInventoryCategory(object,drop);
- break;
- case DAD_TEXTURE:
- case DAD_SOUND:
- case DAD_LANDMARK:
- case DAD_OBJECT:
- case DAD_NOTECARD:
- case DAD_CLOTHING:
- case DAD_BODYPART:
- case DAD_ANIMATION:
- case DAD_GESTURE:
- case DAD_CALLINGCARD:
- case DAD_MESH:
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg)
+{
+ //LL_INFOS() << "LLTaskCategoryBridge::dragOrDrop()" << LL_ENDL;
+ BOOL accept = FALSE;
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(object)
+ {
+ switch(cargo_type)
+ {
+ case DAD_CATEGORY:
+ accept = LLToolDragAndDrop::getInstance()->dadUpdateInventoryCategory(object,drop);
+ break;
+ case DAD_TEXTURE:
+ case DAD_SOUND:
+ case DAD_LANDMARK:
+ case DAD_OBJECT:
+ case DAD_NOTECARD:
+ case DAD_CLOTHING:
+ case DAD_BODYPART:
+ case DAD_ANIMATION:
+ case DAD_GESTURE:
+ case DAD_CALLINGCARD:
+ case DAD_MESH:
case DAD_SETTINGS:
case DAD_MATERIAL:
- accept = LLToolDragAndDrop::isInventoryDropAcceptable(object, (LLViewerInventoryItem*)cargo_data);
- if(accept && drop)
- {
- LLToolDragAndDrop::dropInventory(object,
- (LLViewerInventoryItem*)cargo_data,
- LLToolDragAndDrop::getInstance()->getSource(),
- LLToolDragAndDrop::getInstance()->getSourceID());
- }
- break;
- case DAD_SCRIPT:
- // *HACK: In order to resolve SL-22177, we need to block
- // drags from notecards and objects onto other
- // objects. uncomment the simpler version when we have
- // that right.
- //accept = LLToolDragAndDrop::isInventoryDropAcceptable(object, (LLViewerInventoryItem*)cargo_data);
- if(LLToolDragAndDrop::isInventoryDropAcceptable(
- object, (LLViewerInventoryItem*)cargo_data)
- && (LLToolDragAndDrop::SOURCE_WORLD != LLToolDragAndDrop::getInstance()->getSource())
- && (LLToolDragAndDrop::SOURCE_NOTECARD != LLToolDragAndDrop::getInstance()->getSource()))
- {
- accept = TRUE;
- }
- if(accept && drop)
- {
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)cargo_data;
- // rez in the script active by default, rez in
- // inactive if the control key is being held down.
- BOOL active = ((mask & MASK_CONTROL) == 0);
- LLToolDragAndDrop::dropScript(object, item, active,
- LLToolDragAndDrop::getInstance()->getSource(),
- LLToolDragAndDrop::getInstance()->getSourceID());
- }
- break;
- default:
- break;
- }
- }
- return accept;
+ accept = LLToolDragAndDrop::isInventoryDropAcceptable(object, (LLViewerInventoryItem*)cargo_data);
+ if(accept && drop)
+ {
+ LLToolDragAndDrop::dropInventory(object,
+ (LLViewerInventoryItem*)cargo_data,
+ LLToolDragAndDrop::getInstance()->getSource(),
+ LLToolDragAndDrop::getInstance()->getSourceID());
+ }
+ break;
+ case DAD_SCRIPT:
+ // *HACK: In order to resolve SL-22177, we need to block
+ // drags from notecards and objects onto other
+ // objects. uncomment the simpler version when we have
+ // that right.
+ //accept = LLToolDragAndDrop::isInventoryDropAcceptable(object, (LLViewerInventoryItem*)cargo_data);
+ if(LLToolDragAndDrop::isInventoryDropAcceptable(
+ object, (LLViewerInventoryItem*)cargo_data)
+ && (LLToolDragAndDrop::SOURCE_WORLD != LLToolDragAndDrop::getInstance()->getSource())
+ && (LLToolDragAndDrop::SOURCE_NOTECARD != LLToolDragAndDrop::getInstance()->getSource()))
+ {
+ accept = TRUE;
+ }
+ if(accept && drop)
+ {
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)cargo_data;
+ // rez in the script active by default, rez in
+ // inactive if the control key is being held down.
+ BOOL active = ((mask & MASK_CONTROL) == 0);
+ LLToolDragAndDrop::dropScript(object, item, active,
+ LLToolDragAndDrop::getInstance()->getSource(),
+ LLToolDragAndDrop::getInstance()->getSourceID());
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return accept;
}
///----------------------------------------------------------------------------
@@ -766,28 +766,28 @@ BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop,
class LLTaskTextureBridge : public LLTaskInvFVBridge
{
public:
- LLTaskTextureBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name) {}
+ LLTaskTextureBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- virtual BOOL canOpenItem() const { return TRUE; }
- virtual void openItem();
+ virtual BOOL canOpenItem() const { return TRUE; }
+ virtual void openItem();
};
void LLTaskTextureBridge::openItem()
{
- LL_INFOS() << "LLTaskTextureBridge::openItem()" << LL_ENDL;
- LLPreviewTexture* preview = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
- if(preview)
- {
- LLInventoryItem* item = findItem();
- if(item)
- {
- preview->setAuxItem(item);
- }
- preview->setObjectID(mPanel->getTaskUUID());
- }
+ LL_INFOS() << "LLTaskTextureBridge::openItem()" << LL_ENDL;
+ LLPreviewTexture* preview = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
+ if(preview)
+ {
+ LLInventoryItem* item = findItem();
+ if(item)
+ {
+ preview->setAuxItem(item);
+ }
+ preview->setObjectID(mPanel->getTaskUUID());
+ }
}
@@ -798,86 +798,86 @@ void LLTaskTextureBridge::openItem()
class LLTaskSoundBridge : public LLTaskInvFVBridge
{
public:
- LLTaskSoundBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name) {}
-
- virtual BOOL canOpenItem() const { return TRUE; }
- virtual void openItem();
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- static void openSoundPreview(void* data);
+ LLTaskSoundBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
+
+ virtual BOOL canOpenItem() const { return TRUE; }
+ virtual void openItem();
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+ static void openSoundPreview(void* data);
};
void LLTaskSoundBridge::openItem()
{
- openSoundPreview((void*)this);
+ openSoundPreview((void*)this);
}
void LLTaskSoundBridge::openSoundPreview(void* data)
{
- LLTaskSoundBridge* self = (LLTaskSoundBridge*)data;
- if(!self)
- return;
+ LLTaskSoundBridge* self = (LLTaskSoundBridge*)data;
+ if(!self)
+ return;
- LLPreviewSound* preview = LLFloaterReg::showTypedInstance<LLPreviewSound>("preview_sound", LLSD(self->mUUID), TAKE_FOCUS_YES);
- if (preview)
- {
- preview->setObjectID(self->mPanel->getTaskUUID());
- }
+ LLPreviewSound* preview = LLFloaterReg::showTypedInstance<LLPreviewSound>("preview_sound", LLSD(self->mUUID), TAKE_FOCUS_YES);
+ if (preview)
+ {
+ preview->setObjectID(self->mPanel->getTaskUUID());
+ }
}
// virtual
void LLTaskSoundBridge::performAction(LLInventoryModel* model, std::string action)
{
- if (action == "task_play")
- {
- LLInventoryItem* item = findItem();
- if(item)
- {
- send_sound_trigger(item->getAssetUUID(), 1.0);
- }
- }
- LLTaskInvFVBridge::performAction(model, action);
+ if (action == "task_play")
+ {
+ LLInventoryItem* item = findItem();
+ if(item)
+ {
+ send_sound_trigger(item->getAssetUUID(), 1.0);
+ }
+ }
+ LLTaskInvFVBridge::performAction(model, action);
}
void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LLInventoryItem* item = findItem();
- std::vector<std::string> items;
- std::vector<std::string> disabled_items;
- if (!item)
- {
- hide_context_entries(menu, items, disabled_items);
- return;
- }
-
- if (canOpenItem())
- {
- if (!isItemCopyable())
- {
- disabled_items.push_back(std::string("Task Open"));
- }
- }
- items.push_back(std::string("Task Properties"));
- if ((flags & FIRST_SELECTED_ITEM) == 0)
- {
- disabled_items.push_back(std::string("Task Properties"));
- }
- if(isItemRenameable())
- {
- items.push_back(std::string("Task Rename"));
- }
- if(isItemRemovable())
- {
- items.push_back(std::string("Task Remove"));
- }
-
- items.push_back(std::string("Task Play"));
-
-
- hide_context_entries(menu, items, disabled_items);
+ LLInventoryItem* item = findItem();
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+ if (!item)
+ {
+ hide_context_entries(menu, items, disabled_items);
+ return;
+ }
+
+ if (canOpenItem())
+ {
+ if (!isItemCopyable())
+ {
+ disabled_items.push_back(std::string("Task Open"));
+ }
+ }
+ items.push_back(std::string("Task Properties"));
+ if ((flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Task Properties"));
+ }
+ if(isItemRenameable())
+ {
+ items.push_back(std::string("Task Rename"));
+ }
+ if(isItemRemovable())
+ {
+ items.push_back(std::string("Task Remove"));
+ }
+
+ items.push_back(std::string("Task Play"));
+
+
+ hide_context_entries(menu, items, disabled_items);
}
///----------------------------------------------------------------------------
@@ -887,10 +887,10 @@ void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
class LLTaskLandmarkBridge : public LLTaskInvFVBridge
{
public:
- LLTaskLandmarkBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name) {}
+ LLTaskLandmarkBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
};
///----------------------------------------------------------------------------
@@ -900,23 +900,23 @@ public:
class LLTaskCallingCardBridge : public LLTaskInvFVBridge
{
public:
- LLTaskCallingCardBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name) {}
+ LLTaskCallingCardBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- virtual BOOL isItemRenameable() const;
- virtual BOOL renameItem(const std::string& new_name);
+ virtual BOOL isItemRenameable() const;
+ virtual BOOL renameItem(const std::string& new_name);
};
BOOL LLTaskCallingCardBridge::isItemRenameable() const
{
- return FALSE;
+ return FALSE;
}
BOOL LLTaskCallingCardBridge::renameItem(const std::string& new_name)
{
- return FALSE;
+ return FALSE;
}
@@ -927,65 +927,65 @@ BOOL LLTaskCallingCardBridge::renameItem(const std::string& new_name)
class LLTaskScriptBridge : public LLTaskInvFVBridge
{
public:
- LLTaskScriptBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name) {}
+ LLTaskScriptBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
- //static BOOL enableIfCopyable( void* userdata );
+ //static BOOL enableIfCopyable( void* userdata );
};
class LLTaskLSLBridge : public LLTaskScriptBridge
{
public:
- LLTaskLSLBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskScriptBridge(panel, uuid, name) {}
+ LLTaskLSLBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskScriptBridge(panel, uuid, name) {}
- virtual BOOL canOpenItem() const { return TRUE; }
- virtual void openItem();
- virtual BOOL removeItem();
- //virtual void buildContextMenu(LLMenuGL& menu);
+ virtual BOOL canOpenItem() const { return TRUE; }
+ virtual void openItem();
+ virtual BOOL removeItem();
+ //virtual void buildContextMenu(LLMenuGL& menu);
- //static void copyToInventory(void* userdata);
+ //static void copyToInventory(void* userdata);
};
void LLTaskLSLBridge::openItem()
{
- LL_INFOS() << "LLTaskLSLBridge::openItem() " << mUUID << LL_ENDL;
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(!object || object->isInventoryPending())
- {
- return;
- }
- if (object->permModify() || gAgent.isGodlike())
- {
- LLSD floater_key;
- floater_key["taskid"] = mPanel->getTaskUUID();
- floater_key["itemid"] = mUUID;
-
- LLLiveLSLEditor* preview = LLFloaterReg::showTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key, TAKE_FOCUS_YES);
- if (preview)
- {
+ LL_INFOS() << "LLTaskLSLBridge::openItem() " << mUUID << LL_ENDL;
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(!object || object->isInventoryPending())
+ {
+ return;
+ }
+ if (object->permModify() || gAgent.isGodlike())
+ {
+ LLSD floater_key;
+ floater_key["taskid"] = mPanel->getTaskUUID();
+ floater_key["itemid"] = mUUID;
+
+ LLLiveLSLEditor* preview = LLFloaterReg::showTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key, TAKE_FOCUS_YES);
+ if (preview)
+ {
LLSelectNode *node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, TRUE);
if (node && node->mValid)
{
preview->setObjectName(node->mName);
}
- preview->setObjectID(mPanel->getTaskUUID());
- }
- }
- else
- {
- LLNotificationsUtil::add("CannotOpenScriptObjectNoMod");
- }
+ preview->setObjectID(mPanel->getTaskUUID());
+ }
+ }
+ else
+ {
+ LLNotificationsUtil::add("CannotOpenScriptObjectNoMod");
+ }
}
BOOL LLTaskLSLBridge::removeItem()
{
- LLFloaterReg::hideInstance("preview_scriptedit", LLSD(mUUID));
- return LLTaskInvFVBridge::removeItem();
+ LLFloaterReg::hideInstance("preview_scriptedit", LLSD(mUUID));
+ return LLTaskInvFVBridge::removeItem();
}
///----------------------------------------------------------------------------
@@ -995,11 +995,11 @@ BOOL LLTaskLSLBridge::removeItem()
class LLTaskObjectBridge : public LLTaskInvFVBridge
{
public:
- LLTaskObjectBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- U32 flags = 0) :
- LLTaskInvFVBridge(panel, uuid, name, flags) {}
+ LLTaskObjectBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name,
+ U32 flags = 0) :
+ LLTaskInvFVBridge(panel, uuid, name, flags) {}
};
///----------------------------------------------------------------------------
@@ -1009,46 +1009,46 @@ public:
class LLTaskNotecardBridge : public LLTaskInvFVBridge
{
public:
- LLTaskNotecardBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name) {}
-
- virtual BOOL canOpenItem() const { return TRUE; }
- virtual void openItem();
- virtual BOOL removeItem();
+ LLTaskNotecardBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
+
+ virtual BOOL canOpenItem() const { return TRUE; }
+ virtual void openItem();
+ virtual BOOL removeItem();
};
void LLTaskNotecardBridge::openItem()
{
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(!object || object->isInventoryPending())
- {
- return;
- }
-
- // Note: even if we are not allowed to modify copyable notecard, we should be able to view it
- LLInventoryItem *item = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mUUID));
- BOOL item_copy = item && gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE);
- if( item_copy
- || object->permModify()
- || gAgent.isGodlike())
- {
- LLSD floater_key;
- floater_key["taskid"] = mPanel->getTaskUUID();
- floater_key["itemid"] = mUUID;
- LLPreviewNotecard* preview = LLFloaterReg::showTypedInstance<LLPreviewNotecard>("preview_notecard", floater_key, TAKE_FOCUS_YES);
- if (preview)
- {
- preview->setObjectID(mPanel->getTaskUUID());
- }
- }
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(!object || object->isInventoryPending())
+ {
+ return;
+ }
+
+ // Note: even if we are not allowed to modify copyable notecard, we should be able to view it
+ LLInventoryItem *item = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mUUID));
+ BOOL item_copy = item && gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE);
+ if( item_copy
+ || object->permModify()
+ || gAgent.isGodlike())
+ {
+ LLSD floater_key;
+ floater_key["taskid"] = mPanel->getTaskUUID();
+ floater_key["itemid"] = mUUID;
+ LLPreviewNotecard* preview = LLFloaterReg::showTypedInstance<LLPreviewNotecard>("preview_notecard", floater_key, TAKE_FOCUS_YES);
+ if (preview)
+ {
+ preview->setObjectID(mPanel->getTaskUUID());
+ }
+ }
}
BOOL LLTaskNotecardBridge::removeItem()
{
- LLFloaterReg::hideInstance("preview_notecard", LLSD(mUUID));
- return LLTaskInvFVBridge::removeItem();
+ LLFloaterReg::hideInstance("preview_notecard", LLSD(mUUID));
+ return LLTaskInvFVBridge::removeItem();
}
///----------------------------------------------------------------------------
@@ -1058,31 +1058,31 @@ BOOL LLTaskNotecardBridge::removeItem()
class LLTaskGestureBridge : public LLTaskInvFVBridge
{
public:
- LLTaskGestureBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name) {}
-
- virtual BOOL canOpenItem() const { return TRUE; }
- virtual void openItem();
- virtual BOOL removeItem();
+ LLTaskGestureBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
+
+ virtual BOOL canOpenItem() const { return TRUE; }
+ virtual void openItem();
+ virtual BOOL removeItem();
};
void LLTaskGestureBridge::openItem()
{
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(!object || object->isInventoryPending())
- {
- return;
- }
- LLPreviewGesture::show(mUUID, mPanel->getTaskUUID());
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(!object || object->isInventoryPending())
+ {
+ return;
+ }
+ LLPreviewGesture::show(mUUID, mPanel->getTaskUUID());
}
BOOL LLTaskGestureBridge::removeItem()
{
- // Don't need to deactivate gesture because gestures inside objects can never be active.
- LLFloaterReg::hideInstance("preview_gesture", LLSD(mUUID));
- return LLTaskInvFVBridge::removeItem();
+ // Don't need to deactivate gesture because gestures inside objects can never be active.
+ LLFloaterReg::hideInstance("preview_gesture", LLSD(mUUID));
+ return LLTaskInvFVBridge::removeItem();
}
///----------------------------------------------------------------------------
@@ -1092,35 +1092,35 @@ BOOL LLTaskGestureBridge::removeItem()
class LLTaskAnimationBridge : public LLTaskInvFVBridge
{
public:
- LLTaskAnimationBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name) :
- LLTaskInvFVBridge(panel, uuid, name) {}
-
- virtual BOOL canOpenItem() const { return TRUE; }
- virtual void openItem();
- virtual BOOL removeItem();
+ LLTaskAnimationBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name) :
+ LLTaskInvFVBridge(panel, uuid, name) {}
+
+ virtual BOOL canOpenItem() const { return TRUE; }
+ virtual void openItem();
+ virtual BOOL removeItem();
};
void LLTaskAnimationBridge::openItem()
{
- LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
- if(!object || object->isInventoryPending())
- {
- return;
- }
+ LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
+ if(!object || object->isInventoryPending())
+ {
+ return;
+ }
- LLPreviewAnim* preview = LLFloaterReg::showTypedInstance<LLPreviewAnim>("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
- if (preview && (object->permModify() || gAgent.isGodlike()))
- {
- preview->setObjectID(mPanel->getTaskUUID());
- }
+ LLPreviewAnim* preview = LLFloaterReg::showTypedInstance<LLPreviewAnim>("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
+ if (preview && (object->permModify() || gAgent.isGodlike()))
+ {
+ preview->setObjectID(mPanel->getTaskUUID());
+ }
}
BOOL LLTaskAnimationBridge::removeItem()
{
- LLFloaterReg::hideInstance("preview_anim", LLSD(mUUID));
- return LLTaskInvFVBridge::removeItem();
+ LLFloaterReg::hideInstance("preview_anim", LLSD(mUUID));
+ return LLTaskInvFVBridge::removeItem();
}
///----------------------------------------------------------------------------
@@ -1130,18 +1130,18 @@ BOOL LLTaskAnimationBridge::removeItem()
class LLTaskWearableBridge : public LLTaskInvFVBridge
{
public:
- LLTaskWearableBridge(LLPanelObjectInventory* panel,
- const LLUUID& uuid,
- const std::string& name,
- U32 flags) :
- LLTaskInvFVBridge(panel, uuid, name, flags) {}
+ LLTaskWearableBridge(LLPanelObjectInventory* panel,
+ const LLUUID& uuid,
+ const std::string& name,
+ U32 flags) :
+ LLTaskInvFVBridge(panel, uuid, name, flags) {}
- virtual LLUIImagePtr getIcon() const;
+ virtual LLUIImagePtr getIcon() const;
};
LLUIImagePtr LLTaskWearableBridge::getIcon() const
{
- return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, FALSE );
+ return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, FALSE );
}
///----------------------------------------------------------------------------
@@ -1166,9 +1166,9 @@ LLUIImagePtr LLTaskSettingsBridge::getIcon() const
return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, FALSE);
}
-LLSettingsType::type_e LLTaskSettingsBridge::getSettingsType() const
-{
- return LLSettingsType::ST_NONE;
+LLSettingsType::type_e LLTaskSettingsBridge::getSettingsType() const
+{
+ return LLSettingsType::ST_NONE;
}
///----------------------------------------------------------------------------
@@ -1228,99 +1228,99 @@ BOOL LLTaskMaterialBridge::removeItem()
//----------------------------------------------------------------------------
LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory* panel,
- LLInventoryObject* object)
-{
- LLTaskInvFVBridge* new_bridge = NULL;
- const LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(object);
- const U32 itemflags = ( NULL == item ? 0 : item->getFlags() );
- LLAssetType::EType type = object ? object->getType() : LLAssetType::AT_CATEGORY;
- LLUUID object_id = object ? object->getUUID() : LLUUID::null;
- std::string object_name = object ? object->getName() : std::string();
-
- switch(type)
- {
- case LLAssetType::AT_TEXTURE:
- new_bridge = new LLTaskTextureBridge(panel,
- object_id,
- object_name);
- break;
- case LLAssetType::AT_SOUND:
- new_bridge = new LLTaskSoundBridge(panel,
- object_id,
- object_name);
- break;
- case LLAssetType::AT_LANDMARK:
- new_bridge = new LLTaskLandmarkBridge(panel,
- object_id,
- object_name);
- break;
- case LLAssetType::AT_CALLINGCARD:
- new_bridge = new LLTaskCallingCardBridge(panel,
- object_id,
- object_name);
- break;
- case LLAssetType::AT_SCRIPT:
- // OLD SCRIPTS DEPRECATED - JC
- LL_WARNS() << "Old script" << LL_ENDL;
- //new_bridge = new LLTaskOldScriptBridge(panel,
- // object_id,
- // object_name);
- break;
- case LLAssetType::AT_OBJECT:
- new_bridge = new LLTaskObjectBridge(panel,
- object_id,
- object_name,
- itemflags);
- break;
- case LLAssetType::AT_NOTECARD:
- new_bridge = new LLTaskNotecardBridge(panel,
- object_id,
- object_name);
- break;
- case LLAssetType::AT_ANIMATION:
- new_bridge = new LLTaskAnimationBridge(panel,
- object_id,
- object_name);
- break;
- case LLAssetType::AT_GESTURE:
- new_bridge = new LLTaskGestureBridge(panel,
- object_id,
- object_name);
- break;
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_BODYPART:
- new_bridge = new LLTaskWearableBridge(panel,
- object_id,
- object_name,
- itemflags);
- break;
- case LLAssetType::AT_CATEGORY:
- new_bridge = new LLTaskCategoryBridge(panel,
- object_id,
- object_name);
- break;
- case LLAssetType::AT_LSL_TEXT:
- new_bridge = new LLTaskLSLBridge(panel,
- object_id,
- object_name);
- break;
- case LLAssetType::AT_SETTINGS:
- new_bridge = new LLTaskSettingsBridge(panel,
- object_id,
- object_name,
+ LLInventoryObject* object)
+{
+ LLTaskInvFVBridge* new_bridge = NULL;
+ const LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(object);
+ const U32 itemflags = ( NULL == item ? 0 : item->getFlags() );
+ LLAssetType::EType type = object ? object->getType() : LLAssetType::AT_CATEGORY;
+ LLUUID object_id = object ? object->getUUID() : LLUUID::null;
+ std::string object_name = object ? object->getName() : std::string();
+
+ switch(type)
+ {
+ case LLAssetType::AT_TEXTURE:
+ new_bridge = new LLTaskTextureBridge(panel,
+ object_id,
+ object_name);
+ break;
+ case LLAssetType::AT_SOUND:
+ new_bridge = new LLTaskSoundBridge(panel,
+ object_id,
+ object_name);
+ break;
+ case LLAssetType::AT_LANDMARK:
+ new_bridge = new LLTaskLandmarkBridge(panel,
+ object_id,
+ object_name);
+ break;
+ case LLAssetType::AT_CALLINGCARD:
+ new_bridge = new LLTaskCallingCardBridge(panel,
+ object_id,
+ object_name);
+ break;
+ case LLAssetType::AT_SCRIPT:
+ // OLD SCRIPTS DEPRECATED - JC
+ LL_WARNS() << "Old script" << LL_ENDL;
+ //new_bridge = new LLTaskOldScriptBridge(panel,
+ // object_id,
+ // object_name);
+ break;
+ case LLAssetType::AT_OBJECT:
+ new_bridge = new LLTaskObjectBridge(panel,
+ object_id,
+ object_name,
+ itemflags);
+ break;
+ case LLAssetType::AT_NOTECARD:
+ new_bridge = new LLTaskNotecardBridge(panel,
+ object_id,
+ object_name);
+ break;
+ case LLAssetType::AT_ANIMATION:
+ new_bridge = new LLTaskAnimationBridge(panel,
+ object_id,
+ object_name);
+ break;
+ case LLAssetType::AT_GESTURE:
+ new_bridge = new LLTaskGestureBridge(panel,
+ object_id,
+ object_name);
+ break;
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_BODYPART:
+ new_bridge = new LLTaskWearableBridge(panel,
+ object_id,
+ object_name,
+ itemflags);
+ break;
+ case LLAssetType::AT_CATEGORY:
+ new_bridge = new LLTaskCategoryBridge(panel,
+ object_id,
+ object_name);
+ break;
+ case LLAssetType::AT_LSL_TEXT:
+ new_bridge = new LLTaskLSLBridge(panel,
+ object_id,
+ object_name);
+ break;
+ case LLAssetType::AT_SETTINGS:
+ new_bridge = new LLTaskSettingsBridge(panel,
+ object_id,
+ object_name,
itemflags);
- break;
+ break;
case LLAssetType::AT_MATERIAL:
new_bridge = new LLTaskMaterialBridge(panel,
object_id,
object_name);
break;
- default:
- LL_INFOS() << "Unhandled inventory type (llassetstorage.h): "
- << (S32)type << LL_ENDL;
- break;
- }
- return new_bridge;
+ default:
+ LL_INFOS() << "Unhandled inventory type (llassetstorage.h): "
+ << (S32)type << LL_ENDL;
+ break;
+ }
+ return new_bridge;
}
@@ -1336,222 +1336,222 @@ void do_nothing()
// Default constructor
LLPanelObjectInventory::LLPanelObjectInventory(const LLPanelObjectInventory::Params& p) :
- LLPanel(p),
- mScroller(NULL),
- mFolders(NULL),
- mHaveInventory(FALSE),
- mIsInventoryEmpty(TRUE),
- mInventoryNeedsUpdate(FALSE),
- mInventoryViewModel(p.name),
+ LLPanel(p),
+ mScroller(NULL),
+ mFolders(NULL),
+ mHaveInventory(FALSE),
+ mIsInventoryEmpty(TRUE),
+ mInventoryNeedsUpdate(FALSE),
+ mInventoryViewModel(p.name),
mShowRootFolder(p.show_root_folder)
{
- // Setup context menu callbacks
- mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelObjectInventory::doToSelected, this, _2));
- mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
- mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND));
- mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&do_nothing));
- mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&do_nothing));
- mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&do_nothing));
- mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this));
- mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&do_nothing));
+ // Setup context menu callbacks
+ mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelObjectInventory::doToSelected, this, _2));
+ mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
+ mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND));
+ mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&do_nothing));
+ mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&do_nothing));
+ mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&do_nothing));
+ mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this));
+ mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&do_nothing));
}
// Destroys the object
LLPanelObjectInventory::~LLPanelObjectInventory()
{
- if (!gIdleCallbacks.deleteFunction(idle, this))
- {
- LL_WARNS() << "LLPanelObjectInventory::~LLPanelObjectInventory() failed to delete callback" << LL_ENDL;
- }
+ if (!gIdleCallbacks.deleteFunction(idle, this))
+ {
+ LL_WARNS() << "LLPanelObjectInventory::~LLPanelObjectInventory() failed to delete callback" << LL_ENDL;
+ }
}
BOOL LLPanelObjectInventory::postBuild()
{
- // clear contents and initialize menus, sets up mFolders
- reset();
+ // clear contents and initialize menus, sets up mFolders
+ reset();
- // Register an idle update callback
- gIdleCallbacks.addFunction(idle, this);
+ // Register an idle update callback
+ gIdleCallbacks.addFunction(idle, this);
- return TRUE;
+ return TRUE;
}
void LLPanelObjectInventory::doToSelected(const LLSD& userdata)
{
- LLInventoryAction::doToSelected(&gInventory, mFolders, userdata.asString());
+ LLInventoryAction::doToSelected(&gInventory, mFolders, userdata.asString());
}
void LLPanelObjectInventory::clearContents()
{
- mHaveInventory = FALSE;
- mIsInventoryEmpty = TRUE;
- if (LLToolDragAndDrop::getInstance() && LLToolDragAndDrop::getInstance()->getSource() == LLToolDragAndDrop::SOURCE_WORLD)
- {
- LLToolDragAndDrop::getInstance()->endDrag();
- }
+ mHaveInventory = FALSE;
+ mIsInventoryEmpty = TRUE;
+ if (LLToolDragAndDrop::getInstance() && LLToolDragAndDrop::getInstance()->getSource() == LLToolDragAndDrop::SOURCE_WORLD)
+ {
+ LLToolDragAndDrop::getInstance()->endDrag();
+ }
- clearItemIDs();
+ clearItemIDs();
- if( mScroller )
- {
- // removes mFolders
- removeChild( mScroller ); //*TODO: Really shouldn't do this during draw()/refresh()
- mScroller->die();
- mScroller = NULL;
- mFolders = NULL;
- }
+ if( mScroller )
+ {
+ // removes mFolders
+ removeChild( mScroller ); //*TODO: Really shouldn't do this during draw()/refresh()
+ mScroller->die();
+ mScroller = NULL;
+ mFolders = NULL;
+ }
}
void LLPanelObjectInventory::reset()
{
- clearContents();
-
- mCommitCallbackRegistrar.pushScope(); // push local callbacks
-
- // Reset the inventory model to show all folders by default
- mInventoryViewModel.getFilter().setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS);
-
- // Create a new folder view root
- LLRect dummy_rect(0, 1, 1, 0);
- LLFolderView::Params p;
- p.name = "task inventory";
- p.title = "task inventory";
- p.parent_panel = this;
- p.tool_tip= LLTrans::getString("PanelContentsTooltip");
- p.listener = LLTaskInvFVBridge::createObjectBridge(this, NULL);
- p.folder_indentation = -14; // subtract space normally reserved for folder expanders
- p.view_model = &mInventoryViewModel;
- p.root = NULL;
+ clearContents();
+
+ mCommitCallbackRegistrar.pushScope(); // push local callbacks
+
+ // Reset the inventory model to show all folders by default
+ mInventoryViewModel.getFilter().setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS);
+
+ // Create a new folder view root
+ LLRect dummy_rect(0, 1, 1, 0);
+ LLFolderView::Params p;
+ p.name = "task inventory";
+ p.title = "task inventory";
+ p.parent_panel = this;
+ p.tool_tip= LLTrans::getString("PanelContentsTooltip");
+ p.listener = LLTaskInvFVBridge::createObjectBridge(this, NULL);
+ p.folder_indentation = -14; // subtract space normally reserved for folder expanders
+ p.view_model = &mInventoryViewModel;
+ p.root = NULL;
p.options_menu = "menu_inventory.xml";
- mFolders = LLUICtrlFactory::create<LLFolderView>(p);
+ mFolders = LLUICtrlFactory::create<LLFolderView>(p);
+
+ mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar);
+ mFolders->setEnableRegistrar(&mEnableCallbackRegistrar);
+
+ if (hasFocus())
+ {
+ LLEditMenuHandler::gEditMenuHandler = mFolders;
+ }
- mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar);
- mFolders->setEnableRegistrar(&mEnableCallbackRegistrar);
+ int offset = hasBorder() ? getBorder()->getBorderWidth() << 1 : 0;
+ LLRect scroller_rect(0, getRect().getHeight() - offset, getRect().getWidth() - offset, 0);
+ LLScrollContainer::Params scroll_p;
+ scroll_p.name("task inventory scroller");
+ scroll_p.rect(scroller_rect);
+ scroll_p.tab_stop(true);
+ scroll_p.follows.flags(FOLLOWS_ALL);
+ mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroll_p);
+ addChild(mScroller);
+ mScroller->addChild(mFolders);
- if (hasFocus())
- {
- LLEditMenuHandler::gEditMenuHandler = mFolders;
- }
+ mFolders->setScrollContainer( mScroller );
- int offset = hasBorder() ? getBorder()->getBorderWidth() << 1 : 0;
- LLRect scroller_rect(0, getRect().getHeight() - offset, getRect().getWidth() - offset, 0);
- LLScrollContainer::Params scroll_p;
- scroll_p.name("task inventory scroller");
- scroll_p.rect(scroller_rect);
- scroll_p.tab_stop(true);
- scroll_p.follows.flags(FOLLOWS_ALL);
- mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroll_p);
- addChild(mScroller);
- mScroller->addChild(mFolders);
-
- mFolders->setScrollContainer( mScroller );
-
- mCommitCallbackRegistrar.popScope();
+ mCommitCallbackRegistrar.popScope();
}
void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object,
- LLInventoryObject::object_list_t* inventory,
- S32 serial_num,
- void* data)
+ LLInventoryObject::object_list_t* inventory,
+ S32 serial_num,
+ void* data)
{
- if(!object) return;
+ if(!object) return;
- //LL_INFOS() << "invetnory arrived: \n"
- // << " panel UUID: " << panel->mTaskUUID << "\n"
- // << " task UUID: " << object->mID << LL_ENDL;
- if(mTaskUUID == object->mID)
- {
- mInventoryNeedsUpdate = TRUE;
- }
+ //LL_INFOS() << "invetnory arrived: \n"
+ // << " panel UUID: " << panel->mTaskUUID << "\n"
+ // << " task UUID: " << object->mID << LL_ENDL;
+ if(mTaskUUID == object->mID)
+ {
+ mInventoryNeedsUpdate = TRUE;
+ }
}
void LLPanelObjectInventory::updateInventory()
{
- //LL_INFOS() << "inventory arrived: \n"
- // << " panel UUID: " << panel->mTaskUUID << "\n"
- // << " task UUID: " << object->mID << LL_ENDL;
- // We're still interested in this task's inventory.
- std::vector<LLUUID> selected_item_ids;
- std::set<LLFolderViewItem*> selected_items;
- BOOL inventory_has_focus = FALSE;
- if (mHaveInventory && mFolders)
- {
- selected_items = mFolders->getSelectionList();
- inventory_has_focus = gFocusMgr.childHasKeyboardFocus(mFolders);
- }
- for (std::set<LLFolderViewItem*>::iterator it = selected_items.begin(), end_it = selected_items.end();
- it != end_it;
- ++it)
- {
- selected_item_ids.push_back(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
- }
-
- LLViewerObject* objectp = gObjectList.findObject(mTaskUUID);
- if (objectp)
- {
- LLInventoryObject* inventory_root = objectp->getInventoryRoot();
- LLInventoryObject::object_list_t contents;
- objectp->getInventoryContents(contents);
-
- if (inventory_root)
- {
- reset();
- mIsInventoryEmpty = FALSE;
- createFolderViews(inventory_root, contents);
- mFolders->setEnabled(TRUE);
- }
- else
- {
- // TODO: create an empty inventory
- mIsInventoryEmpty = TRUE;
- }
-
- mHaveInventory = !mIsInventoryEmpty || !objectp->isInventoryDirty();
- if (objectp->isInventoryDirty())
- {
- // Inventory is dirty, yet we received inventoryChanged() callback.
- // User changed something during ongoing request.
- // Rerequest. It will clear dirty flag and won't create dupplicate requests.
- objectp->requestInventory();
- }
- }
- else
- {
- // TODO: create an empty inventory
- mIsInventoryEmpty = TRUE;
- mHaveInventory = TRUE;
- }
-
- // restore previous selection
- std::vector<LLUUID>::iterator selection_it;
- bool first_item = true;
- for (selection_it = selected_item_ids.begin(); selection_it != selected_item_ids.end(); ++selection_it)
- {
- LLFolderViewItem* selected_item = getItemByID(*selection_it);
-
- if (selected_item)
- {
- //HACK: "set" first item then "change" each other one to get keyboard focus right
- if (first_item)
- {
- mFolders->setSelection(selected_item, TRUE, inventory_has_focus);
- first_item = FALSE;
- }
- else
- {
- mFolders->changeSelection(selected_item, TRUE);
- }
- }
- }
-
- if (mFolders)
- {
- mFolders->requestArrange();
- }
- mInventoryNeedsUpdate = FALSE;
- // Edit menu handler is set in onFocusReceived
+ //LL_INFOS() << "inventory arrived: \n"
+ // << " panel UUID: " << panel->mTaskUUID << "\n"
+ // << " task UUID: " << object->mID << LL_ENDL;
+ // We're still interested in this task's inventory.
+ std::vector<LLUUID> selected_item_ids;
+ std::set<LLFolderViewItem*> selected_items;
+ BOOL inventory_has_focus = FALSE;
+ if (mHaveInventory && mFolders)
+ {
+ selected_items = mFolders->getSelectionList();
+ inventory_has_focus = gFocusMgr.childHasKeyboardFocus(mFolders);
+ }
+ for (std::set<LLFolderViewItem*>::iterator it = selected_items.begin(), end_it = selected_items.end();
+ it != end_it;
+ ++it)
+ {
+ selected_item_ids.push_back(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
+ }
+
+ LLViewerObject* objectp = gObjectList.findObject(mTaskUUID);
+ if (objectp)
+ {
+ LLInventoryObject* inventory_root = objectp->getInventoryRoot();
+ LLInventoryObject::object_list_t contents;
+ objectp->getInventoryContents(contents);
+
+ if (inventory_root)
+ {
+ reset();
+ mIsInventoryEmpty = FALSE;
+ createFolderViews(inventory_root, contents);
+ mFolders->setEnabled(TRUE);
+ }
+ else
+ {
+ // TODO: create an empty inventory
+ mIsInventoryEmpty = TRUE;
+ }
+
+ mHaveInventory = !mIsInventoryEmpty || !objectp->isInventoryDirty();
+ if (objectp->isInventoryDirty())
+ {
+ // Inventory is dirty, yet we received inventoryChanged() callback.
+ // User changed something during ongoing request.
+ // Rerequest. It will clear dirty flag and won't create dupplicate requests.
+ objectp->requestInventory();
+ }
+ }
+ else
+ {
+ // TODO: create an empty inventory
+ mIsInventoryEmpty = TRUE;
+ mHaveInventory = TRUE;
+ }
+
+ // restore previous selection
+ std::vector<LLUUID>::iterator selection_it;
+ bool first_item = true;
+ for (selection_it = selected_item_ids.begin(); selection_it != selected_item_ids.end(); ++selection_it)
+ {
+ LLFolderViewItem* selected_item = getItemByID(*selection_it);
+
+ if (selected_item)
+ {
+ //HACK: "set" first item then "change" each other one to get keyboard focus right
+ if (first_item)
+ {
+ mFolders->setSelection(selected_item, TRUE, inventory_has_focus);
+ first_item = FALSE;
+ }
+ else
+ {
+ mFolders->changeSelection(selected_item, TRUE);
+ }
+ }
+ }
+
+ if (mFolders)
+ {
+ mFolders->requestArrange();
+ }
+ mInventoryNeedsUpdate = FALSE;
+ // Edit menu handler is set in onFocusReceived
}
// *FIX: This is currently a very expensive operation, because we have
@@ -1561,26 +1561,26 @@ void LLPanelObjectInventory::updateInventory()
// have that in our current arsenal.
void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root, LLInventoryObject::object_list_t& contents)
{
- if (!inventory_root)
- {
- return;
- }
- // Create a visible root category.
- LLTaskInvFVBridge* bridge = NULL;
- bridge = LLTaskInvFVBridge::createObjectBridge(this, inventory_root);
- if(bridge)
- {
- LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
-
- LLFolderViewFolder::Params p;
- p.name = inventory_root->getName();
- p.tool_tip = p.name;
- p.root = mFolders;
- p.listener = bridge;
- p.font_color = item_color;
- p.font_highlight_color = item_color;
-
- LLFolderViewFolder* new_folder = LLUICtrlFactory::create<LLFolderViewFolder>(p);
+ if (!inventory_root)
+ {
+ return;
+ }
+ // Create a visible root category.
+ LLTaskInvFVBridge* bridge = NULL;
+ bridge = LLTaskInvFVBridge::createObjectBridge(this, inventory_root);
+ if(bridge)
+ {
+ LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+
+ LLFolderViewFolder::Params p;
+ p.name = inventory_root->getName();
+ p.tool_tip = p.name;
+ p.root = mFolders;
+ p.listener = bridge;
+ p.font_color = item_color;
+ p.font_highlight_color = item_color;
+
+ LLFolderViewFolder* new_folder = LLUICtrlFactory::create<LLFolderViewFolder>(p);
if (mShowRootFolder)
{
@@ -1588,346 +1588,346 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root
new_folder->toggleOpen();
}
- if (!contents.empty())
- {
- createViewsForCategory(&contents, inventory_root, mShowRootFolder ? new_folder : mFolders);
- }
+ if (!contents.empty())
+ {
+ createViewsForCategory(&contents, inventory_root, mShowRootFolder ? new_folder : mFolders);
+ }
if (mShowRootFolder)
{
// Refresh for label to add item count
new_folder->refresh();
}
- }
+ }
}
typedef std::pair<LLInventoryObject*, LLFolderViewFolder*> obj_folder_pair;
-void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_list_t* inventory,
- LLInventoryObject* parent,
- LLFolderViewFolder* folder)
-{
- LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
-
- // Find all in the first pass
- std::vector<obj_folder_pair*> child_categories;
- LLTaskInvFVBridge* bridge;
- LLFolderViewItem* view;
-
- LLInventoryObject::object_list_t::iterator it = inventory->begin();
- LLInventoryObject::object_list_t::iterator end = inventory->end();
- for( ; it != end; ++it)
- {
- LLInventoryObject* obj = *it;
-
- if(parent->getUUID() == obj->getParentUUID())
- {
- bridge = LLTaskInvFVBridge::createObjectBridge(this, obj);
- if(!bridge)
- {
- continue;
- }
- if(LLAssetType::AT_CATEGORY == obj->getType())
- {
- LLFolderViewFolder::Params p;
- p.name = obj->getName();
- p.root = mFolders;
- p.listener = bridge;
- p.tool_tip = p.name;
- p.font_color = item_color;
- p.font_highlight_color = item_color;
- view = LLUICtrlFactory::create<LLFolderViewFolder>(p);
- child_categories.push_back(new obj_folder_pair(obj,
- (LLFolderViewFolder*)view));
- }
- else
- {
- LLFolderViewItem::Params params;
- params.name(obj->getName());
- params.creation_date(bridge->getCreationDate());
- params.root(mFolders);
- params.listener(bridge);
- params.rect(LLRect());
- params.tool_tip = params.name;
- params.font_color = item_color;
- params.font_highlight_color = item_color;
- view = LLUICtrlFactory::create<LLFolderViewItem> (params);
- }
- view->addToFolder(folder);
- addItemID(obj->getUUID(), view);
- }
- }
-
- // now, for each category, do the second pass
- for(S32 i = 0; i < child_categories.size(); i++)
- {
- createViewsForCategory(inventory, child_categories[i]->first,
- child_categories[i]->second );
- delete child_categories[i];
- }
+void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_list_t* inventory,
+ LLInventoryObject* parent,
+ LLFolderViewFolder* folder)
+{
+ LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+
+ // Find all in the first pass
+ std::vector<obj_folder_pair*> child_categories;
+ LLTaskInvFVBridge* bridge;
+ LLFolderViewItem* view;
+
+ LLInventoryObject::object_list_t::iterator it = inventory->begin();
+ LLInventoryObject::object_list_t::iterator end = inventory->end();
+ for( ; it != end; ++it)
+ {
+ LLInventoryObject* obj = *it;
+
+ if(parent->getUUID() == obj->getParentUUID())
+ {
+ bridge = LLTaskInvFVBridge::createObjectBridge(this, obj);
+ if(!bridge)
+ {
+ continue;
+ }
+ if(LLAssetType::AT_CATEGORY == obj->getType())
+ {
+ LLFolderViewFolder::Params p;
+ p.name = obj->getName();
+ p.root = mFolders;
+ p.listener = bridge;
+ p.tool_tip = p.name;
+ p.font_color = item_color;
+ p.font_highlight_color = item_color;
+ view = LLUICtrlFactory::create<LLFolderViewFolder>(p);
+ child_categories.push_back(new obj_folder_pair(obj,
+ (LLFolderViewFolder*)view));
+ }
+ else
+ {
+ LLFolderViewItem::Params params;
+ params.name(obj->getName());
+ params.creation_date(bridge->getCreationDate());
+ params.root(mFolders);
+ params.listener(bridge);
+ params.rect(LLRect());
+ params.tool_tip = params.name;
+ params.font_color = item_color;
+ params.font_highlight_color = item_color;
+ view = LLUICtrlFactory::create<LLFolderViewItem> (params);
+ }
+ view->addToFolder(folder);
+ addItemID(obj->getUUID(), view);
+ }
+ }
+
+ // now, for each category, do the second pass
+ for(S32 i = 0; i < child_categories.size(); i++)
+ {
+ createViewsForCategory(inventory, child_categories[i]->first,
+ child_categories[i]->second );
+ delete child_categories[i];
+ }
folder->setChildrenInited(true);
}
void LLPanelObjectInventory::refresh()
{
- //LL_INFOS() << "LLPanelObjectInventory::refresh()" << LL_ENDL;
- BOOL has_inventory = FALSE;
- const BOOL non_root_ok = TRUE;
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- LLSelectNode* node = selection->getFirstRootNode(NULL, non_root_ok);
- if(node && node->mValid)
- {
- LLViewerObject* object = node->getObject();
- if(object && ((selection->getRootObjectCount() == 1)
- || (selection->getObjectCount() == 1)))
- {
- // determine if we need to make a request. Start with a
- // default based on if we have inventory at all.
- BOOL make_request = !mHaveInventory;
-
- // If the task id is different than what we've stored,
- // then make the request.
- if(mTaskUUID != object->mID)
- {
- mTaskUUID = object->mID;
- mAttachmentUUID = object->getAttachmentItemID();
- make_request = TRUE;
-
- // This is a new object so pre-emptively clear the contents
- // Otherwise we show the old stuff until the update comes in
- clearContents();
-
- // Register for updates from this object,
- registerVOInventoryListener(object,NULL);
- }
- else if (mAttachmentUUID != object->getAttachmentItemID())
- {
- mAttachmentUUID = object->getAttachmentItemID();
- if (mAttachmentUUID.notNull())
- {
- // Server unsubsribes viewer (deselects object) from property
- // updates after "ObjectAttach" so we need to resubscribe
- LLSelectMgr::getInstance()->sendSelect();
- }
- }
-
- // Based on the node information, we may need to dirty the
- // object inventory and get it again.
- if(node->mValid)
- {
- if(node->mInventorySerial != object->getInventorySerial() || object->isInventoryDirty())
- {
- make_request = TRUE;
- }
- }
-
- // do the request if necessary.
- if(make_request)
- {
- requestVOInventory();
- }
- has_inventory = TRUE;
- }
- }
- if(!has_inventory)
- {
- clearInventoryTask();
- }
- mInventoryViewModel.setTaskID(mTaskUUID);
- //LL_INFOS() << "LLPanelObjectInventory::refresh() " << mTaskUUID << LL_ENDL;
+ //LL_INFOS() << "LLPanelObjectInventory::refresh()" << LL_ENDL;
+ BOOL has_inventory = FALSE;
+ const BOOL non_root_ok = TRUE;
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ LLSelectNode* node = selection->getFirstRootNode(NULL, non_root_ok);
+ if(node && node->mValid)
+ {
+ LLViewerObject* object = node->getObject();
+ if(object && ((selection->getRootObjectCount() == 1)
+ || (selection->getObjectCount() == 1)))
+ {
+ // determine if we need to make a request. Start with a
+ // default based on if we have inventory at all.
+ BOOL make_request = !mHaveInventory;
+
+ // If the task id is different than what we've stored,
+ // then make the request.
+ if(mTaskUUID != object->mID)
+ {
+ mTaskUUID = object->mID;
+ mAttachmentUUID = object->getAttachmentItemID();
+ make_request = TRUE;
+
+ // This is a new object so pre-emptively clear the contents
+ // Otherwise we show the old stuff until the update comes in
+ clearContents();
+
+ // Register for updates from this object,
+ registerVOInventoryListener(object,NULL);
+ }
+ else if (mAttachmentUUID != object->getAttachmentItemID())
+ {
+ mAttachmentUUID = object->getAttachmentItemID();
+ if (mAttachmentUUID.notNull())
+ {
+ // Server unsubsribes viewer (deselects object) from property
+ // updates after "ObjectAttach" so we need to resubscribe
+ LLSelectMgr::getInstance()->sendSelect();
+ }
+ }
+
+ // Based on the node information, we may need to dirty the
+ // object inventory and get it again.
+ if(node->mValid)
+ {
+ if(node->mInventorySerial != object->getInventorySerial() || object->isInventoryDirty())
+ {
+ make_request = TRUE;
+ }
+ }
+
+ // do the request if necessary.
+ if(make_request)
+ {
+ requestVOInventory();
+ }
+ has_inventory = TRUE;
+ }
+ }
+ if(!has_inventory)
+ {
+ clearInventoryTask();
+ }
+ mInventoryViewModel.setTaskID(mTaskUUID);
+ //LL_INFOS() << "LLPanelObjectInventory::refresh() " << mTaskUUID << LL_ENDL;
}
void LLPanelObjectInventory::clearInventoryTask()
{
- mTaskUUID = LLUUID::null;
- mAttachmentUUID = LLUUID::null;
- removeVOInventoryListener();
- clearContents();
+ mTaskUUID = LLUUID::null;
+ mAttachmentUUID = LLUUID::null;
+ removeVOInventoryListener();
+ clearContents();
}
void LLPanelObjectInventory::removeSelectedItem()
{
- if(mFolders)
- {
- mFolders->removeSelectedItems();
- }
+ if(mFolders)
+ {
+ mFolders->removeSelectedItems();
+ }
}
void LLPanelObjectInventory::startRenamingSelectedItem()
{
- if(mFolders)
- {
- mFolders->startRenamingSelectedItem();
- }
+ if(mFolders)
+ {
+ mFolders->startRenamingSelectedItem();
+ }
}
void LLPanelObjectInventory::draw()
{
- LLPanel::draw();
-
- if(mIsInventoryEmpty)
- {
- if((LLUUID::null != mTaskUUID) && (!mHaveInventory))
- {
- LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("LoadingContents"), 0,
- (S32)(getRect().getWidth() * 0.5f),
- 10,
- LLColor4( 1, 1, 1, 1 ),
- LLFontGL::HCENTER,
- LLFontGL::BOTTOM);
- }
- else if(mHaveInventory)
- {
- LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("NoContents"), 0,
- (S32)(getRect().getWidth() * 0.5f),
- 10,
- LLColor4( 1, 1, 1, 1 ),
- LLFontGL::HCENTER,
- LLFontGL::BOTTOM);
- }
- }
+ LLPanel::draw();
+
+ if(mIsInventoryEmpty)
+ {
+ if((LLUUID::null != mTaskUUID) && (!mHaveInventory))
+ {
+ LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("LoadingContents"), 0,
+ (S32)(getRect().getWidth() * 0.5f),
+ 10,
+ LLColor4( 1, 1, 1, 1 ),
+ LLFontGL::HCENTER,
+ LLFontGL::BOTTOM);
+ }
+ else if(mHaveInventory)
+ {
+ LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("NoContents"), 0,
+ (S32)(getRect().getWidth() * 0.5f),
+ 10,
+ LLColor4( 1, 1, 1, 1 ),
+ LLFontGL::HCENTER,
+ LLFontGL::BOTTOM);
+ }
+ }
}
void LLPanelObjectInventory::deleteAllChildren()
{
- mScroller = NULL;
- mFolders = NULL;
- LLView::deleteAllChildren();
+ mScroller = NULL;
+ mFolders = NULL;
+ LLView::deleteAllChildren();
}
BOOL LLPanelObjectInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg)
{
- if (mFolders)
- {
- LLFolderViewItem* folderp = mFolders->getNextFromChild(NULL);
- if (!folderp)
- {
- return FALSE;
- }
- // Try to pass on unmodified mouse coordinates
- S32 local_x = x - mFolders->getRect().mLeft;
- S32 local_y = y - mFolders->getRect().mBottom;
-
- if (mFolders->pointInView(local_x, local_y))
- {
- return mFolders->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
- }
- else
- {
- //force mouse coordinates to be inside folder rectangle
- return mFolders->handleDragAndDrop(5, 1, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
- }
- }
- else
- {
- return FALSE;
- }
+ if (mFolders)
+ {
+ LLFolderViewItem* folderp = mFolders->getNextFromChild(NULL);
+ if (!folderp)
+ {
+ return FALSE;
+ }
+ // Try to pass on unmodified mouse coordinates
+ S32 local_x = x - mFolders->getRect().mLeft;
+ S32 local_y = y - mFolders->getRect().mBottom;
+
+ if (mFolders->pointInView(local_x, local_y))
+ {
+ return mFolders->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+ }
+ else
+ {
+ //force mouse coordinates to be inside folder rectangle
+ return mFolders->handleDragAndDrop(5, 1, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+ }
+ }
+ else
+ {
+ return FALSE;
+ }
}
//static
void LLPanelObjectInventory::idle(void* user_data)
{
- LLPanelObjectInventory* self = (LLPanelObjectInventory*)user_data;
+ LLPanelObjectInventory* self = (LLPanelObjectInventory*)user_data;
- if (self->mFolders)
- {
- self->mFolders->update();
- }
- if (self->mInventoryNeedsUpdate)
- {
- self->updateInventory();
- }
+ if (self->mFolders)
+ {
+ self->mFolders->update();
+ }
+ if (self->mInventoryNeedsUpdate)
+ {
+ self->updateInventory();
+ }
}
void LLPanelObjectInventory::onFocusLost()
{
- // inventory no longer handles cut/copy/paste/delete
- if (LLEditMenuHandler::gEditMenuHandler == mFolders)
- {
- LLEditMenuHandler::gEditMenuHandler = NULL;
- }
-
- LLPanel::onFocusLost();
+ // inventory no longer handles cut/copy/paste/delete
+ if (LLEditMenuHandler::gEditMenuHandler == mFolders)
+ {
+ LLEditMenuHandler::gEditMenuHandler = NULL;
+ }
+
+ LLPanel::onFocusLost();
}
void LLPanelObjectInventory::onFocusReceived()
{
- // inventory now handles cut/copy/paste/delete
- LLEditMenuHandler::gEditMenuHandler = mFolders;
-
- LLPanel::onFocusReceived();
+ // inventory now handles cut/copy/paste/delete
+ LLEditMenuHandler::gEditMenuHandler = mFolders;
+
+ LLPanel::onFocusReceived();
}
LLFolderViewItem* LLPanelObjectInventory::getItemByID( const LLUUID& id )
{
- std::map<LLUUID, LLFolderViewItem*>::iterator map_it;
- map_it = mItemMap.find(id);
- if (map_it != mItemMap.end())
- {
- return map_it->second;
- }
+ std::map<LLUUID, LLFolderViewItem*>::iterator map_it;
+ map_it = mItemMap.find(id);
+ if (map_it != mItemMap.end())
+ {
+ return map_it->second;
+ }
- return NULL;
+ return NULL;
}
void LLPanelObjectInventory::removeItemID( const LLUUID& id )
{
- mItemMap.erase(id);
+ mItemMap.erase(id);
}
void LLPanelObjectInventory::addItemID( const LLUUID& id, LLFolderViewItem* itemp )
{
- mItemMap[id] = itemp;
+ mItemMap[id] = itemp;
}
void LLPanelObjectInventory::clearItemIDs()
{
- mItemMap.clear();
+ mItemMap.clear();
}
BOOL LLPanelObjectInventory::handleKeyHere( KEY key, MASK mask )
{
- BOOL handled = FALSE;
- switch (key)
- {
- case KEY_DELETE:
+ BOOL handled = FALSE;
+ switch (key)
+ {
+ case KEY_DELETE:
#if LL_DARWIN
- case KEY_BACKSPACE:
+ case KEY_BACKSPACE:
#endif
- // Delete selected items if delete or backspace key hit on the inventory panel
- // Note: on Mac laptop keyboards, backspace and delete are one and the same
- if (isSelectionRemovable() && mask == MASK_NONE)
- {
- LLInventoryAction::doToSelected(&gInventory, mFolders, "delete");
- handled = TRUE;
- }
- break;
- }
- return handled;
+ // Delete selected items if delete or backspace key hit on the inventory panel
+ // Note: on Mac laptop keyboards, backspace and delete are one and the same
+ if (isSelectionRemovable() && mask == MASK_NONE)
+ {
+ LLInventoryAction::doToSelected(&gInventory, mFolders, "delete");
+ handled = TRUE;
+ }
+ break;
+ }
+ return handled;
}
BOOL LLPanelObjectInventory::isSelectionRemovable()
{
- if (!mFolders || !mFolders->getRoot())
- {
- return FALSE;
- }
- std::set<LLFolderViewItem*> selection_set = mFolders->getRoot()->getSelectionList();
- if (selection_set.empty())
- {
- return FALSE;
- }
- for (std::set<LLFolderViewItem*>::iterator iter = selection_set.begin();
- iter != selection_set.end();
- ++iter)
- {
- LLFolderViewItem *item = *iter;
- const LLFolderViewModelItemInventory *listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item->getViewModelItem());
- if (!listener || !listener->isItemRemovable() || listener->isItemInTrash())
- {
- return FALSE;
- }
- }
- return TRUE;
+ if (!mFolders || !mFolders->getRoot())
+ {
+ return FALSE;
+ }
+ std::set<LLFolderViewItem*> selection_set = mFolders->getRoot()->getSelectionList();
+ if (selection_set.empty())
+ {
+ return FALSE;
+ }
+ for (std::set<LLFolderViewItem*>::iterator iter = selection_set.begin();
+ iter != selection_set.end();
+ ++iter)
+ {
+ LLFolderViewItem *item = *iter;
+ const LLFolderViewModelItemInventory *listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item->getViewModelItem());
+ if (!listener || !listener->isItemRemovable() || listener->isItemInTrash())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h
index 0e450d8ce9..cef1ca90e5 100644
--- a/indra/newview/llpanelobjectinventory.h
+++ b/indra/newview/llpanelobjectinventory.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelobjectinventory.h
* @brief LLPanelObjectInventory class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,65 +57,65 @@ public:
{}
};
- LLPanelObjectInventory(const Params&);
- virtual ~LLPanelObjectInventory();
-
- virtual BOOL postBuild();
+ LLPanelObjectInventory(const Params&);
+ virtual ~LLPanelObjectInventory();
+
+ virtual BOOL postBuild();
- LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; }
+ LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; }
- void doToSelected(const LLSD& userdata);
-
- void refresh();
- const LLUUID& getTaskUUID() { return mTaskUUID;}
- void clearInventoryTask();
- void removeSelectedItem();
- void startRenamingSelectedItem();
+ void doToSelected(const LLSD& userdata);
- LLFolderView* getRootFolder() const { return mFolders; }
+ void refresh();
+ const LLUUID& getTaskUUID() { return mTaskUUID;}
+ void clearInventoryTask();
+ void removeSelectedItem();
+ void startRenamingSelectedItem();
- virtual void draw();
- virtual void deleteAllChildren();
- virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg);
-
- /*virtual*/ void onFocusLost();
- /*virtual*/ void onFocusReceived();
-
- static void idle(void* user_data);
+ LLFolderView* getRootFolder() const { return mFolders; }
+
+ virtual void draw();
+ virtual void deleteAllChildren();
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg);
+
+ /*virtual*/ void onFocusLost();
+ /*virtual*/ void onFocusReceived();
+
+ static void idle(void* user_data);
protected:
- void reset();
- /*virtual*/ void inventoryChanged(LLViewerObject* object,
- LLInventoryObject::object_list_t* inventory,
- S32 serial_num,
- void* user_data);
- void updateInventory();
- void createFolderViews(LLInventoryObject* inventory_root, LLInventoryObject::object_list_t& contents);
- void createViewsForCategory(LLInventoryObject::object_list_t* inventory,
- LLInventoryObject* parent,
- LLFolderViewFolder* folder);
- void clearContents();
- LLFolderViewItem* getItemByID(const LLUUID& id);
-
- void addItemID( const LLUUID& id, LLFolderViewItem* itemp );
- void removeItemID(const LLUUID& id);
- void clearItemIDs();
-
- BOOL handleKeyHere( KEY key, MASK mask );
- BOOL isSelectionRemovable();
+ void reset();
+ /*virtual*/ void inventoryChanged(LLViewerObject* object,
+ LLInventoryObject::object_list_t* inventory,
+ S32 serial_num,
+ void* user_data);
+ void updateInventory();
+ void createFolderViews(LLInventoryObject* inventory_root, LLInventoryObject::object_list_t& contents);
+ void createViewsForCategory(LLInventoryObject::object_list_t* inventory,
+ LLInventoryObject* parent,
+ LLFolderViewFolder* folder);
+ void clearContents();
+ LLFolderViewItem* getItemByID(const LLUUID& id);
+
+ void addItemID( const LLUUID& id, LLFolderViewItem* itemp );
+ void removeItemID(const LLUUID& id);
+ void clearItemIDs();
+
+ BOOL handleKeyHere( KEY key, MASK mask );
+ BOOL isSelectionRemovable();
private:
- std::map<LLUUID, LLFolderViewItem*> mItemMap;
-
- LLScrollContainer* mScroller;
- LLFolderView* mFolders;
-
- LLUUID mTaskUUID;
- LLUUID mAttachmentUUID;
- BOOL mHaveInventory; // 'Loading' label and used for initial request
- BOOL mIsInventoryEmpty; // 'Empty' label
- BOOL mInventoryNeedsUpdate; // for idle, set on changed callback
- LLFolderViewModelInventory mInventoryViewModel;
+ std::map<LLUUID, LLFolderViewItem*> mItemMap;
+
+ LLScrollContainer* mScroller;
+ LLFolderView* mFolders;
+
+ LLUUID mTaskUUID;
+ LLUUID mAttachmentUUID;
+ BOOL mHaveInventory; // 'Loading' label and used for initial request
+ BOOL mIsInventoryEmpty; // 'Empty' label
+ BOOL mInventoryNeedsUpdate; // for idle, set on changed callback
+ LLFolderViewModelInventory mInventoryViewModel;
bool mShowRootFolder;
};
diff --git a/indra/newview/llpanelonlinestatus.cpp b/indra/newview/llpanelonlinestatus.cpp
index 8202dfe9a3..a8b4a7ef19 100644
--- a/indra/newview/llpanelonlinestatus.cpp
+++ b/indra/newview/llpanelonlinestatus.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,25 +31,25 @@
#include "llviewercontrol.h" // for gSavedSettings
LLPanelOnlineStatus::LLPanelOnlineStatus(
- const LLNotificationPtr& notification) :
- LLPanelTipToast(notification)
+ const LLNotificationPtr& notification) :
+ LLPanelTipToast(notification)
{
- buildFromFile(
- "panel_online_status_toast.xml");
+ buildFromFile(
+ "panel_online_status_toast.xml");
- getChild<LLUICtrl>("avatar_icon")->setValue(notification->getPayload()["FROM_ID"]);
- getChild<LLUICtrl>("message")->setValue(notification->getMessage());
+ getChild<LLUICtrl>("avatar_icon")->setValue(notification->getPayload()["FROM_ID"]);
+ getChild<LLUICtrl>("message")->setValue(notification->getMessage());
- if (notification->getPayload().has("respond_on_mousedown")
- && notification->getPayload()["respond_on_mousedown"])
- {
- setMouseDownCallback(boost::bind(&LLNotification::respond,
- notification, notification->getResponseTemplate()));
- }
+ if (notification->getPayload().has("respond_on_mousedown")
+ && notification->getPayload()["respond_on_mousedown"])
+ {
+ setMouseDownCallback(boost::bind(&LLNotification::respond,
+ notification, notification->getResponseTemplate()));
+ }
- S32 max_line_count = gSavedSettings.getS32("TipToastMessageLineCount");
- snapToMessageHeight(getChild<LLTextBox> ("message"), max_line_count);
+ S32 max_line_count = gSavedSettings.getS32("TipToastMessageLineCount");
+ snapToMessageHeight(getChild<LLTextBox> ("message"), max_line_count);
}
diff --git a/indra/newview/llpanelonlinestatus.h b/indra/newview/llpanelonlinestatus.h
index 7dc648f135..5555aa97e9 100644
--- a/indra/newview/llpanelonlinestatus.h
+++ b/indra/newview/llpanelonlinestatus.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,13 +35,13 @@
*/
class LLPanelOnlineStatus : public LLPanelTipToast
{
- // disallow instantiation of this class
+ // disallow instantiation of this class
private:
- // grant privileges to instantiate this class to LLToastPanel
- friend class LLToastPanel;
+ // grant privileges to instantiate this class to LLToastPanel
+ friend class LLToastPanel;
- LLPanelOnlineStatus(const LLNotificationPtr& notification);
- virtual ~LLPanelOnlineStatus() {}
+ LLPanelOnlineStatus(const LLNotificationPtr& notification);
+ virtual ~LLPanelOnlineStatus() {}
};
#endif /* LL_PANELONLINESTATUS_H */
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index c7ae4eb0d9..1bfae630a0 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -90,60 +90,60 @@ static const std::string SAVE_BTN("save_btn");
class LLShopURLDispatcher
{
public:
- std::string resolveURL(LLWearableType::EType wearable_type, ESex sex);
- std::string resolveURL(LLAssetType::EType asset_type, ESex sex);
+ std::string resolveURL(LLWearableType::EType wearable_type, ESex sex);
+ std::string resolveURL(LLAssetType::EType asset_type, ESex sex);
};
std::string LLShopURLDispatcher::resolveURL(LLWearableType::EType wearable_type, ESex sex)
{
- const std::string prefix = "MarketplaceURL";
- const std::string sex_str = (sex == SEX_MALE) ? "Male" : "Female";
- const std::string type_str = LLWearableType::getInstance()->getTypeName(wearable_type);
-
- std::string setting_name = prefix;
-
- switch (wearable_type)
- {
- case LLWearableType::WT_ALPHA:
- case LLWearableType::WT_NONE:
- case LLWearableType::WT_INVALID: // just in case, this shouldn't happen
- case LLWearableType::WT_COUNT: // just in case, this shouldn't happen
- break;
-
- default:
- setting_name += '_';
- setting_name += type_str;
- setting_name += sex_str;
- break;
- }
-
- return gSavedSettings.getString(setting_name);
+ const std::string prefix = "MarketplaceURL";
+ const std::string sex_str = (sex == SEX_MALE) ? "Male" : "Female";
+ const std::string type_str = LLWearableType::getInstance()->getTypeName(wearable_type);
+
+ std::string setting_name = prefix;
+
+ switch (wearable_type)
+ {
+ case LLWearableType::WT_ALPHA:
+ case LLWearableType::WT_NONE:
+ case LLWearableType::WT_INVALID: // just in case, this shouldn't happen
+ case LLWearableType::WT_COUNT: // just in case, this shouldn't happen
+ break;
+
+ default:
+ setting_name += '_';
+ setting_name += type_str;
+ setting_name += sex_str;
+ break;
+ }
+
+ return gSavedSettings.getString(setting_name);
}
std::string LLShopURLDispatcher::resolveURL(LLAssetType::EType asset_type, ESex sex)
{
- const std::string prefix = "MarketplaceURL";
- const std::string sex_str = (sex == SEX_MALE) ? "Male" : "Female";
- const std::string type_str = LLAssetType::lookup(asset_type);
-
- std::string setting_name = prefix;
-
- switch (asset_type)
- {
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_OBJECT:
- case LLAssetType::AT_BODYPART:
- setting_name += '_';
- setting_name += type_str;
- setting_name += sex_str;
- break;
-
- // to suppress warnings
- default:
- break;
- }
-
- return gSavedSettings.getString(setting_name);
+ const std::string prefix = "MarketplaceURL";
+ const std::string sex_str = (sex == SEX_MALE) ? "Male" : "Female";
+ const std::string type_str = LLAssetType::lookup(asset_type);
+
+ std::string setting_name = prefix;
+
+ switch (asset_type)
+ {
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_OBJECT:
+ case LLAssetType::AT_BODYPART:
+ setting_name += '_';
+ setting_name += type_str;
+ setting_name += sex_str;
+ break;
+
+ // to suppress warnings
+ default:
+ break;
+ }
+
+ return gSavedSettings.getString(setting_name);
}
///////////////////////////////////////////////////////////////////////////////
@@ -153,59 +153,59 @@ std::string LLShopURLDispatcher::resolveURL(LLAssetType::EType asset_type, ESex
class LLPanelOutfitEditGearMenu
{
public:
- static LLToggleableMenu* create()
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ static LLToggleableMenu* create()
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- registrar.add("Wearable.Create", boost::bind(onCreate, _2));
+ registrar.add("Wearable.Create", boost::bind(onCreate, _2));
- llassert(LLMenuGL::sMenuContainer != NULL);
- LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
- "menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
- llassert(menu);
- if (menu)
- {
- populateCreateWearableSubmenus(menu);
- }
+ llassert(LLMenuGL::sMenuContainer != NULL);
+ LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
+ "menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+ llassert(menu);
+ if (menu)
+ {
+ populateCreateWearableSubmenus(menu);
+ }
- return menu;
- }
+ return menu;
+ }
private:
- static void onCreate(const LLSD& param)
- {
- LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(param.asString());
- if (type == LLWearableType::WT_NONE)
- {
- LL_WARNS() << "Invalid wearable type" << LL_ENDL;
- return;
- }
-
- LLAgentWearables::createWearable(type, true);
- }
-
- // Populate the menu with items like "New Skin", "New Pants", etc.
- static void populateCreateWearableSubmenus(LLMenuGL* menu)
- {
- LLView* menu_clothes = gMenuHolder->getChildView("COF.Gear.New_Clothes", FALSE);
- LLView* menu_bp = gMenuHolder->getChildView("COF.Gear.New_Body_Parts", FALSE);
- LLWearableType * wearable_type_inst = LLWearableType::getInstance();
-
- for (U8 i = LLWearableType::WT_SHAPE; i != (U8) LLWearableType::WT_COUNT; ++i)
- {
- LLWearableType::EType type = (LLWearableType::EType) i;
- const std::string& type_name = wearable_type_inst->getTypeName(type);
-
- LLMenuItemCallGL::Params p;
- p.name = type_name;
- p.label = LLTrans::getString(wearable_type_inst->getTypeDefaultNewName(type));
- p.on_click.function_name = "Wearable.Create";
- p.on_click.parameter = LLSD(type_name);
-
- LLView* parent = wearable_type_inst->getAssetType(type) == LLAssetType::AT_CLOTHING ? menu_clothes : menu_bp;
- LLUICtrlFactory::create<LLMenuItemCallGL>(p, parent);
- }
- }
+ static void onCreate(const LLSD& param)
+ {
+ LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(param.asString());
+ if (type == LLWearableType::WT_NONE)
+ {
+ LL_WARNS() << "Invalid wearable type" << LL_ENDL;
+ return;
+ }
+
+ LLAgentWearables::createWearable(type, true);
+ }
+
+ // Populate the menu with items like "New Skin", "New Pants", etc.
+ static void populateCreateWearableSubmenus(LLMenuGL* menu)
+ {
+ LLView* menu_clothes = gMenuHolder->getChildView("COF.Gear.New_Clothes", FALSE);
+ LLView* menu_bp = gMenuHolder->getChildView("COF.Gear.New_Body_Parts", FALSE);
+ LLWearableType * wearable_type_inst = LLWearableType::getInstance();
+
+ for (U8 i = LLWearableType::WT_SHAPE; i != (U8) LLWearableType::WT_COUNT; ++i)
+ {
+ LLWearableType::EType type = (LLWearableType::EType) i;
+ const std::string& type_name = wearable_type_inst->getTypeName(type);
+
+ LLMenuItemCallGL::Params p;
+ p.name = type_name;
+ p.label = LLTrans::getString(wearable_type_inst->getTypeDefaultNewName(type));
+ p.on_click.function_name = "Wearable.Create";
+ p.on_click.parameter = LLSD(type_name);
+
+ LLView* parent = wearable_type_inst->getAssetType(type) == LLAssetType::AT_CLOTHING ? menu_clothes : menu_bp;
+ LLUICtrlFactory::create<LLMenuItemCallGL>(p, parent);
+ }
+ }
};
///////////////////////////////////////////////////////////////////////////////
@@ -215,135 +215,135 @@ private:
class LLAddWearablesGearMenu : public LLInitClass<LLAddWearablesGearMenu>
{
public:
- static LLToggleableMenu* create(LLWearableItemsList* flat_list, LLInventoryPanel* inventory_panel)
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+ static LLToggleableMenu* create(LLWearableItemsList* flat_list, LLInventoryPanel* inventory_panel)
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- llassert(flat_list);
- llassert(inventory_panel);
+ llassert(flat_list);
+ llassert(inventory_panel);
- LLHandle<LLView> flat_list_handle = flat_list->getHandle();
- LLHandle<LLPanel> inventory_panel_handle = inventory_panel->getHandle();
+ LLHandle<LLView> flat_list_handle = flat_list->getHandle();
+ LLHandle<LLPanel> inventory_panel_handle = inventory_panel->getHandle();
- registrar.add("AddWearable.Gear.Sort", boost::bind(onSort, flat_list_handle, inventory_panel_handle, _2));
- enable_registrar.add("AddWearable.Gear.Check", boost::bind(onCheck, flat_list_handle, inventory_panel_handle, _2));
- enable_registrar.add("AddWearable.Gear.Visible", boost::bind(onVisible, inventory_panel_handle, _2));
+ registrar.add("AddWearable.Gear.Sort", boost::bind(onSort, flat_list_handle, inventory_panel_handle, _2));
+ enable_registrar.add("AddWearable.Gear.Check", boost::bind(onCheck, flat_list_handle, inventory_panel_handle, _2));
+ enable_registrar.add("AddWearable.Gear.Visible", boost::bind(onVisible, inventory_panel_handle, _2));
- llassert(LLMenuGL::sMenuContainer != NULL);
- LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
- "menu_add_wearable_gear.xml",
- LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+ llassert(LLMenuGL::sMenuContainer != NULL);
+ LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
+ "menu_add_wearable_gear.xml",
+ LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
- return menu;
- }
+ return menu;
+ }
private:
- static void onSort(LLHandle<LLView> flat_list_handle,
- LLHandle<LLPanel> inventory_panel_handle,
- LLSD::String sort_order_str)
- {
- if (flat_list_handle.isDead() || inventory_panel_handle.isDead()) return;
-
- LLWearableItemsList* flat_list = dynamic_cast<LLWearableItemsList*>(flat_list_handle.get());
- LLInventoryPanel* inventory_panel = dynamic_cast<LLInventoryPanel*>(inventory_panel_handle.get());
-
- if (!flat_list || !inventory_panel) return;
-
- LLWearableItemsList::ESortOrder sort_order;
-
- if ("by_most_recent" == sort_order_str)
- {
- sort_order = LLWearableItemsList::E_SORT_BY_MOST_RECENT;
- }
- else if ("by_name" == sort_order_str)
- {
- sort_order = LLWearableItemsList::E_SORT_BY_NAME;
- }
- else if ("by_type" == sort_order_str)
- {
- sort_order = LLWearableItemsList::E_SORT_BY_TYPE_NAME;
- }
- else
- {
- LL_WARNS() << "Unrecognized sort order action" << LL_ENDL;
- return;
- }
-
- if (inventory_panel->getVisible())
- {
- inventory_panel->getFolderViewModel()->setSorter(sort_order);
- }
- else
- {
- flat_list->setSortOrder(sort_order);
- }
- }
-
- static bool onCheck(LLHandle<LLView> flat_list_handle,
- LLHandle<LLPanel> inventory_panel_handle,
- LLSD::String sort_order_str)
- {
- if (flat_list_handle.isDead() || inventory_panel_handle.isDead()) return false;
-
- LLWearableItemsList* flat_list = dynamic_cast<LLWearableItemsList*>(flat_list_handle.get());
- LLInventoryPanel* inventory_panel = dynamic_cast<LLInventoryPanel*>(inventory_panel_handle.get());
-
- if (!inventory_panel || !flat_list) return false;
-
- // Inventory panel uses its own sort order independent from
- // flat list view so this flag is used to distinguish between
- // currently visible "tree" or "flat" representation of inventory.
- bool inventory_tree_visible = inventory_panel->getVisible();
-
- if (inventory_tree_visible)
- {
- U32 sort_order = inventory_panel->getSortOrder();
-
- if ("by_most_recent" == sort_order_str)
- {
- return LLWearableItemsList::E_SORT_BY_MOST_RECENT & sort_order;
- }
- else if ("by_name" == sort_order_str)
- {
- // If inventory panel is not sorted by date then it is sorted by name.
- return LLWearableItemsList::E_SORT_BY_MOST_RECENT & ~sort_order;
- }
- LL_WARNS() << "Unrecognized inventory panel sort order" << LL_ENDL;
- }
- else
- {
- LLWearableItemsList::ESortOrder sort_order = flat_list->getSortOrder();
-
- if ("by_most_recent" == sort_order_str)
- {
- return LLWearableItemsList::E_SORT_BY_MOST_RECENT == sort_order;
- }
- else if ("by_name" == sort_order_str)
- {
- return LLWearableItemsList::E_SORT_BY_NAME == sort_order;
- }
- else if ("by_type" == sort_order_str)
- {
- return LLWearableItemsList::E_SORT_BY_TYPE_NAME == sort_order;
- }
- LL_WARNS() << "Unrecognized wearable list sort order" << LL_ENDL;
- }
- return false;
- }
-
- static bool onVisible(LLHandle<LLPanel> inventory_panel_handle,
- LLSD::String sort_order_str)
- {
- if (inventory_panel_handle.isDead()) return false;
-
- LLInventoryPanel* inventory_panel = dynamic_cast<LLInventoryPanel*>(inventory_panel_handle.get());
-
- // Enable sorting by type only for the flat list of items
- // because inventory panel doesn't support this kind of sorting.
- return ( "by_type" == sort_order_str )
- && ( !inventory_panel || !inventory_panel->getVisible() );
- }
+ static void onSort(LLHandle<LLView> flat_list_handle,
+ LLHandle<LLPanel> inventory_panel_handle,
+ LLSD::String sort_order_str)
+ {
+ if (flat_list_handle.isDead() || inventory_panel_handle.isDead()) return;
+
+ LLWearableItemsList* flat_list = dynamic_cast<LLWearableItemsList*>(flat_list_handle.get());
+ LLInventoryPanel* inventory_panel = dynamic_cast<LLInventoryPanel*>(inventory_panel_handle.get());
+
+ if (!flat_list || !inventory_panel) return;
+
+ LLWearableItemsList::ESortOrder sort_order;
+
+ if ("by_most_recent" == sort_order_str)
+ {
+ sort_order = LLWearableItemsList::E_SORT_BY_MOST_RECENT;
+ }
+ else if ("by_name" == sort_order_str)
+ {
+ sort_order = LLWearableItemsList::E_SORT_BY_NAME;
+ }
+ else if ("by_type" == sort_order_str)
+ {
+ sort_order = LLWearableItemsList::E_SORT_BY_TYPE_NAME;
+ }
+ else
+ {
+ LL_WARNS() << "Unrecognized sort order action" << LL_ENDL;
+ return;
+ }
+
+ if (inventory_panel->getVisible())
+ {
+ inventory_panel->getFolderViewModel()->setSorter(sort_order);
+ }
+ else
+ {
+ flat_list->setSortOrder(sort_order);
+ }
+ }
+
+ static bool onCheck(LLHandle<LLView> flat_list_handle,
+ LLHandle<LLPanel> inventory_panel_handle,
+ LLSD::String sort_order_str)
+ {
+ if (flat_list_handle.isDead() || inventory_panel_handle.isDead()) return false;
+
+ LLWearableItemsList* flat_list = dynamic_cast<LLWearableItemsList*>(flat_list_handle.get());
+ LLInventoryPanel* inventory_panel = dynamic_cast<LLInventoryPanel*>(inventory_panel_handle.get());
+
+ if (!inventory_panel || !flat_list) return false;
+
+ // Inventory panel uses its own sort order independent from
+ // flat list view so this flag is used to distinguish between
+ // currently visible "tree" or "flat" representation of inventory.
+ bool inventory_tree_visible = inventory_panel->getVisible();
+
+ if (inventory_tree_visible)
+ {
+ U32 sort_order = inventory_panel->getSortOrder();
+
+ if ("by_most_recent" == sort_order_str)
+ {
+ return LLWearableItemsList::E_SORT_BY_MOST_RECENT & sort_order;
+ }
+ else if ("by_name" == sort_order_str)
+ {
+ // If inventory panel is not sorted by date then it is sorted by name.
+ return LLWearableItemsList::E_SORT_BY_MOST_RECENT & ~sort_order;
+ }
+ LL_WARNS() << "Unrecognized inventory panel sort order" << LL_ENDL;
+ }
+ else
+ {
+ LLWearableItemsList::ESortOrder sort_order = flat_list->getSortOrder();
+
+ if ("by_most_recent" == sort_order_str)
+ {
+ return LLWearableItemsList::E_SORT_BY_MOST_RECENT == sort_order;
+ }
+ else if ("by_name" == sort_order_str)
+ {
+ return LLWearableItemsList::E_SORT_BY_NAME == sort_order;
+ }
+ else if ("by_type" == sort_order_str)
+ {
+ return LLWearableItemsList::E_SORT_BY_TYPE_NAME == sort_order;
+ }
+ LL_WARNS() << "Unrecognized wearable list sort order" << LL_ENDL;
+ }
+ return false;
+ }
+
+ static bool onVisible(LLHandle<LLPanel> inventory_panel_handle,
+ LLSD::String sort_order_str)
+ {
+ if (inventory_panel_handle.isDead()) return false;
+
+ LLInventoryPanel* inventory_panel = dynamic_cast<LLInventoryPanel*>(inventory_panel_handle.get());
+
+ // Enable sorting by type only for the flat list of items
+ // because inventory panel doesn't support this kind of sorting.
+ return ( "by_type" == sort_order_str )
+ && ( !inventory_panel || !inventory_panel->getVisible() );
+ }
};
///////////////////////////////////////////////////////////////////////////////
@@ -353,36 +353,36 @@ private:
class LLCOFDragAndDropObserver : public LLInventoryAddItemByAssetObserver
{
public:
- LLCOFDragAndDropObserver(LLInventoryModel* model);
+ LLCOFDragAndDropObserver(LLInventoryModel* model);
- virtual ~LLCOFDragAndDropObserver();
+ virtual ~LLCOFDragAndDropObserver();
- virtual void done();
+ virtual void done();
private:
- LLInventoryModel* mModel;
+ LLInventoryModel* mModel;
};
inline LLCOFDragAndDropObserver::LLCOFDragAndDropObserver(LLInventoryModel* model):
- mModel(model)
+ mModel(model)
{
- if (model != NULL)
- {
- model->addObserver(this);
- }
+ if (model != NULL)
+ {
+ model->addObserver(this);
+ }
}
inline LLCOFDragAndDropObserver::~LLCOFDragAndDropObserver()
{
- if (mModel != NULL && mModel->containsObserver(this))
- {
- mModel->removeObserver(this);
- }
+ if (mModel != NULL && mModel->containsObserver(this))
+ {
+ mModel->removeObserver(this);
+ }
}
void LLCOFDragAndDropObserver::done()
{
- LLAppearanceMgr::instance().updateAppearanceFromCOF();
+ LLAppearanceMgr::instance().updateAppearanceFromCOF();
}
///////////////////////////////////////////////////////////////////////////////
@@ -390,315 +390,315 @@ void LLCOFDragAndDropObserver::done()
///////////////////////////////////////////////////////////////////////////////
LLPanelOutfitEdit::LLPanelOutfitEdit()
-: LLPanel(),
- mSearchFilter(NULL),
- mCOFWearables(NULL),
- mInventoryItemsPanel(NULL),
- mGearMenu(NULL),
- mAddWearablesGearMenu(NULL),
- mCOFDragAndDropObserver(NULL),
- mInitialized(false),
- mAddWearablesPanel(NULL),
- mFolderViewFilterCmbBox(NULL),
- mListViewFilterCmbBox(NULL),
- mWearableListManager(NULL),
- mPlusBtn(NULL),
- mWearablesGearMenuBtn(NULL),
- mGearMenuBtn(NULL)
+: LLPanel(),
+ mSearchFilter(NULL),
+ mCOFWearables(NULL),
+ mInventoryItemsPanel(NULL),
+ mGearMenu(NULL),
+ mAddWearablesGearMenu(NULL),
+ mCOFDragAndDropObserver(NULL),
+ mInitialized(false),
+ mAddWearablesPanel(NULL),
+ mFolderViewFilterCmbBox(NULL),
+ mListViewFilterCmbBox(NULL),
+ mWearableListManager(NULL),
+ mPlusBtn(NULL),
+ mWearablesGearMenuBtn(NULL),
+ mGearMenuBtn(NULL)
{
- mSavedFolderState = new LLSaveFolderState();
- mSavedFolderState->setApply(FALSE);
-
-
- LLOutfitObserver& observer = LLOutfitObserver::instance();
- observer.addBOFReplacedCallback(boost::bind(&LLPanelOutfitEdit::updateCurrentOutfitName, this));
- observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this));
- observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this));
- observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::onCOFChanged, this));
-
- gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, true));
- gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, false));
-
- mFolderViewItemTypes.reserve(NUM_FOLDER_VIEW_ITEM_TYPES);
- for (U32 i = 0; i < NUM_FOLDER_VIEW_ITEM_TYPES; i++)
- {
- mFolderViewItemTypes.push_back(LLLookItemType());
- }
+ mSavedFolderState = new LLSaveFolderState();
+ mSavedFolderState->setApply(FALSE);
+
+
+ LLOutfitObserver& observer = LLOutfitObserver::instance();
+ observer.addBOFReplacedCallback(boost::bind(&LLPanelOutfitEdit::updateCurrentOutfitName, this));
+ observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this));
+ observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this));
+ observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::onCOFChanged, this));
+
+ gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, true));
+ gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, false));
+
+ mFolderViewItemTypes.reserve(NUM_FOLDER_VIEW_ITEM_TYPES);
+ for (U32 i = 0; i < NUM_FOLDER_VIEW_ITEM_TYPES; i++)
+ {
+ mFolderViewItemTypes.push_back(LLLookItemType());
+ }
}
LLPanelOutfitEdit::~LLPanelOutfitEdit()
{
- delete mWearableListManager;
- delete mSavedFolderState;
+ delete mWearableListManager;
+ delete mSavedFolderState;
- delete mCOFDragAndDropObserver;
+ delete mCOFDragAndDropObserver;
- while (!mListViewItemTypes.empty()) {
- delete mListViewItemTypes.back();
- mListViewItemTypes.pop_back();
- }
+ while (!mListViewItemTypes.empty()) {
+ delete mListViewItemTypes.back();
+ mListViewItemTypes.pop_back();
+ }
}
BOOL LLPanelOutfitEdit::postBuild()
{
- // gInventory.isInventoryUsable() no longer needs to be tested per Richard's fix for race conditions between inventory and panels
-
- mFolderViewItemTypes[FVIT_ALL] = LLLookItemType(getString("Filter.All"), ALL_ITEMS_MASK);
- mFolderViewItemTypes[FVIT_WEARABLE] = LLLookItemType(getString("Filter.Clothes/Body"), WEARABLE_MASK);
- mFolderViewItemTypes[FVIT_ATTACHMENT] = LLLookItemType(getString("Filter.Objects"), ATTACHMENT_MASK);
-
- //order is important, see EListViewItemType for order information
- mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.All"), new LLFindNonLinksByMask(ALL_ITEMS_MASK)));
- mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Clothing"), new LLIsTypeActual(LLAssetType::AT_CLOTHING)));
- mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Bodyparts"), new LLIsTypeActual(LLAssetType::AT_BODYPART)));
- mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Objects"), new LLFindNonLinksByMask(ATTACHMENT_MASK)));;
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shape"), new LLFindActualWearablesOfType(LLWearableType::WT_SHAPE)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("skin"), new LLFindActualWearablesOfType(LLWearableType::WT_SKIN)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("hair"), new LLFindActualWearablesOfType(LLWearableType::WT_HAIR)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("eyes"), new LLFindActualWearablesOfType(LLWearableType::WT_EYES)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shirt"), new LLFindActualWearablesOfType(LLWearableType::WT_SHIRT)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("pants"), new LLFindActualWearablesOfType(LLWearableType::WT_PANTS)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shoes"), new LLFindActualWearablesOfType(LLWearableType::WT_SHOES)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("socks"), new LLFindActualWearablesOfType(LLWearableType::WT_SOCKS)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("jacket"), new LLFindActualWearablesOfType(LLWearableType::WT_JACKET)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("gloves"), new LLFindActualWearablesOfType(LLWearableType::WT_GLOVES)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("undershirt"), new LLFindActualWearablesOfType(LLWearableType::WT_UNDERSHIRT)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("underpants"), new LLFindActualWearablesOfType(LLWearableType::WT_UNDERPANTS)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("skirt"), new LLFindActualWearablesOfType(LLWearableType::WT_SKIRT)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("alpha"), new LLFindActualWearablesOfType(LLWearableType::WT_ALPHA)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("tattoo"), new LLFindActualWearablesOfType(LLWearableType::WT_TATTOO)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("physics"), new LLFindActualWearablesOfType(LLWearableType::WT_PHYSICS)));
- mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("universal"), new LLFindActualWearablesOfType(LLWearableType::WT_UNIVERSAL)));
-
- mCurrentOutfitName = getChild<LLTextBox>("curr_outfit_name");
- mStatus = getChild<LLTextBox>("status");
-
- mFolderViewBtn = getChild<LLButton>("folder_view_btn");
- mListViewBtn = getChild<LLButton>("list_view_btn");
-
- childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL);
- childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesFolderView, this), NULL);
- childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
- childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesListView, this), NULL);
- childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
- childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
- childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
-
- setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChanged, this, _2));
-
- mWearablesGearMenuBtn = getChild<LLMenuButton>("wearables_gear_menu_btn");
- mGearMenuBtn = getChild<LLMenuButton>("gear_menu_btn");
-
- mCOFWearables = findChild<LLCOFWearables>("cof_wearables_list");
- mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
-
- mCOFWearables->getCOFCallbacks().mAddWearable = boost::bind(&LLPanelOutfitEdit::onAddWearableClicked, this);
- mCOFWearables->getCOFCallbacks().mEditWearable = boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this);
- mCOFWearables->getCOFCallbacks().mDeleteWearable = boost::bind(&LLPanelOutfitEdit::onRemoveFromOutfitClicked, this);
- mCOFWearables->getCOFCallbacks().mMoveWearableCloser = boost::bind(&LLPanelOutfitEdit::moveWearable, this, true);
- mCOFWearables->getCOFCallbacks().mMoveWearableFurther = boost::bind(&LLPanelOutfitEdit::moveWearable, this, false);
-
- mAddWearablesPanel = getChild<LLPanel>("add_wearables_panel");
-
- mInventoryItemsPanel = getChild<LLInventoryPanel>("folder_view");
- mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK);
- mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
- mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
-
- mCOFDragAndDropObserver = new LLCOFDragAndDropObserver(mInventoryItemsPanel->getModel());
-
- mFolderViewFilterCmbBox = getChild<LLComboBox>("folder_view_filter_combobox");
- mFolderViewFilterCmbBox->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onFolderViewFilterCommitted, this, _1));
- mFolderViewFilterCmbBox->removeall();
- for (U32 i = 0; i < mFolderViewItemTypes.size(); ++i)
- {
- mFolderViewFilterCmbBox->add(mFolderViewItemTypes[i].displayName);
- }
- mFolderViewFilterCmbBox->setCurrentByIndex(FVIT_ALL);
-
- mListViewFilterCmbBox = getChild<LLComboBox>("list_view_filter_combobox");
- mListViewFilterCmbBox->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onListViewFilterCommitted, this, _1));
- mListViewFilterCmbBox->removeall();
- for (U32 i = 0; i < mListViewItemTypes.size(); ++i)
- {
- mListViewFilterCmbBox->add(mListViewItemTypes[i]->displayName);
- }
- mListViewFilterCmbBox->setCurrentByIndex(LVIT_ALL);
-
- mSearchFilter = getChild<LLFilterEditor>("look_item_filter");
- mSearchFilter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onSearchEdit, this, _2));
-
- childSetAction("show_add_wearables_btn", boost::bind(&LLPanelOutfitEdit::onAddMoreButtonClicked, this));
-
- mPlusBtn = getChild<LLButton>("plus_btn");
- mPlusBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this));
-
- childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance()));
-
- /*
- * By default AT_CLOTHING are sorted by (in in MY OUTFITS):
- * - by type (types order determined in LLWearableType::EType)
- * - each LLWearableType::EType by outer layer on top
- *
- * In Add More panel AT_CLOTHING should be sorted in a such way:
- * - by type (types order determined in LLWearableType::EType)
- * - each LLWearableType::EType by name (EXT-8205)
- */
- mWearableListViewItemsComparator = new LLWearableItemTypeNameComparator();
- mWearableListViewItemsComparator->setOrder(LLAssetType::AT_CLOTHING, LLWearableItemTypeNameComparator::ORDER_RANK_1, false, true);
-
- mWearablesListViewPanel = getChild<LLPanel>("filtered_wearables_panel");
- mWearableItemsList = getChild<LLWearableItemsList>("list_view");
- mWearableItemsList->setCommitOnSelectionChange(true);
- mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
- mWearableItemsList->setDoubleClickCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this));
-
- mWearableItemsList->setComparator(mWearableListViewItemsComparator);
-
- // Creating "Add Wearables" panel gear menu after initialization of mWearableItemsList and mInventoryItemsPanel.
- mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel);
- mWearablesGearMenuBtn->setMenu(mAddWearablesGearMenu);
-
- mGearMenu = LLPanelOutfitEditGearMenu::create();
- mGearMenuBtn->setMenu(mGearMenu);
-
- getChild<LLButton>(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false));
- getChild<LLButton>(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true));
-
- onOutfitChanging(gAgentWearables.isCOFChangeInProgress());
- return TRUE;
+ // gInventory.isInventoryUsable() no longer needs to be tested per Richard's fix for race conditions between inventory and panels
+
+ mFolderViewItemTypes[FVIT_ALL] = LLLookItemType(getString("Filter.All"), ALL_ITEMS_MASK);
+ mFolderViewItemTypes[FVIT_WEARABLE] = LLLookItemType(getString("Filter.Clothes/Body"), WEARABLE_MASK);
+ mFolderViewItemTypes[FVIT_ATTACHMENT] = LLLookItemType(getString("Filter.Objects"), ATTACHMENT_MASK);
+
+ //order is important, see EListViewItemType for order information
+ mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.All"), new LLFindNonLinksByMask(ALL_ITEMS_MASK)));
+ mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Clothing"), new LLIsTypeActual(LLAssetType::AT_CLOTHING)));
+ mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Bodyparts"), new LLIsTypeActual(LLAssetType::AT_BODYPART)));
+ mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Objects"), new LLFindNonLinksByMask(ATTACHMENT_MASK)));;
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shape"), new LLFindActualWearablesOfType(LLWearableType::WT_SHAPE)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("skin"), new LLFindActualWearablesOfType(LLWearableType::WT_SKIN)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("hair"), new LLFindActualWearablesOfType(LLWearableType::WT_HAIR)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("eyes"), new LLFindActualWearablesOfType(LLWearableType::WT_EYES)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shirt"), new LLFindActualWearablesOfType(LLWearableType::WT_SHIRT)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("pants"), new LLFindActualWearablesOfType(LLWearableType::WT_PANTS)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shoes"), new LLFindActualWearablesOfType(LLWearableType::WT_SHOES)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("socks"), new LLFindActualWearablesOfType(LLWearableType::WT_SOCKS)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("jacket"), new LLFindActualWearablesOfType(LLWearableType::WT_JACKET)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("gloves"), new LLFindActualWearablesOfType(LLWearableType::WT_GLOVES)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("undershirt"), new LLFindActualWearablesOfType(LLWearableType::WT_UNDERSHIRT)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("underpants"), new LLFindActualWearablesOfType(LLWearableType::WT_UNDERPANTS)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("skirt"), new LLFindActualWearablesOfType(LLWearableType::WT_SKIRT)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("alpha"), new LLFindActualWearablesOfType(LLWearableType::WT_ALPHA)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("tattoo"), new LLFindActualWearablesOfType(LLWearableType::WT_TATTOO)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("physics"), new LLFindActualWearablesOfType(LLWearableType::WT_PHYSICS)));
+ mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("universal"), new LLFindActualWearablesOfType(LLWearableType::WT_UNIVERSAL)));
+
+ mCurrentOutfitName = getChild<LLTextBox>("curr_outfit_name");
+ mStatus = getChild<LLTextBox>("status");
+
+ mFolderViewBtn = getChild<LLButton>("folder_view_btn");
+ mListViewBtn = getChild<LLButton>("list_view_btn");
+
+ childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL);
+ childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesFolderView, this), NULL);
+ childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
+ childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesListView, this), NULL);
+ childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
+ childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
+ childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
+
+ setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChanged, this, _2));
+
+ mWearablesGearMenuBtn = getChild<LLMenuButton>("wearables_gear_menu_btn");
+ mGearMenuBtn = getChild<LLMenuButton>("gear_menu_btn");
+
+ mCOFWearables = findChild<LLCOFWearables>("cof_wearables_list");
+ mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
+
+ mCOFWearables->getCOFCallbacks().mAddWearable = boost::bind(&LLPanelOutfitEdit::onAddWearableClicked, this);
+ mCOFWearables->getCOFCallbacks().mEditWearable = boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this);
+ mCOFWearables->getCOFCallbacks().mDeleteWearable = boost::bind(&LLPanelOutfitEdit::onRemoveFromOutfitClicked, this);
+ mCOFWearables->getCOFCallbacks().mMoveWearableCloser = boost::bind(&LLPanelOutfitEdit::moveWearable, this, true);
+ mCOFWearables->getCOFCallbacks().mMoveWearableFurther = boost::bind(&LLPanelOutfitEdit::moveWearable, this, false);
+
+ mAddWearablesPanel = getChild<LLPanel>("add_wearables_panel");
+
+ mInventoryItemsPanel = getChild<LLInventoryPanel>("folder_view");
+ mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK);
+ mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+ mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
+ mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
+
+ mCOFDragAndDropObserver = new LLCOFDragAndDropObserver(mInventoryItemsPanel->getModel());
+
+ mFolderViewFilterCmbBox = getChild<LLComboBox>("folder_view_filter_combobox");
+ mFolderViewFilterCmbBox->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onFolderViewFilterCommitted, this, _1));
+ mFolderViewFilterCmbBox->removeall();
+ for (U32 i = 0; i < mFolderViewItemTypes.size(); ++i)
+ {
+ mFolderViewFilterCmbBox->add(mFolderViewItemTypes[i].displayName);
+ }
+ mFolderViewFilterCmbBox->setCurrentByIndex(FVIT_ALL);
+
+ mListViewFilterCmbBox = getChild<LLComboBox>("list_view_filter_combobox");
+ mListViewFilterCmbBox->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onListViewFilterCommitted, this, _1));
+ mListViewFilterCmbBox->removeall();
+ for (U32 i = 0; i < mListViewItemTypes.size(); ++i)
+ {
+ mListViewFilterCmbBox->add(mListViewItemTypes[i]->displayName);
+ }
+ mListViewFilterCmbBox->setCurrentByIndex(LVIT_ALL);
+
+ mSearchFilter = getChild<LLFilterEditor>("look_item_filter");
+ mSearchFilter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onSearchEdit, this, _2));
+
+ childSetAction("show_add_wearables_btn", boost::bind(&LLPanelOutfitEdit::onAddMoreButtonClicked, this));
+
+ mPlusBtn = getChild<LLButton>("plus_btn");
+ mPlusBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this));
+
+ childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance()));
+
+ /*
+ * By default AT_CLOTHING are sorted by (in in MY OUTFITS):
+ * - by type (types order determined in LLWearableType::EType)
+ * - each LLWearableType::EType by outer layer on top
+ *
+ * In Add More panel AT_CLOTHING should be sorted in a such way:
+ * - by type (types order determined in LLWearableType::EType)
+ * - each LLWearableType::EType by name (EXT-8205)
+ */
+ mWearableListViewItemsComparator = new LLWearableItemTypeNameComparator();
+ mWearableListViewItemsComparator->setOrder(LLAssetType::AT_CLOTHING, LLWearableItemTypeNameComparator::ORDER_RANK_1, false, true);
+
+ mWearablesListViewPanel = getChild<LLPanel>("filtered_wearables_panel");
+ mWearableItemsList = getChild<LLWearableItemsList>("list_view");
+ mWearableItemsList->setCommitOnSelectionChange(true);
+ mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
+ mWearableItemsList->setDoubleClickCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this));
+
+ mWearableItemsList->setComparator(mWearableListViewItemsComparator);
+
+ // Creating "Add Wearables" panel gear menu after initialization of mWearableItemsList and mInventoryItemsPanel.
+ mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel);
+ mWearablesGearMenuBtn->setMenu(mAddWearablesGearMenu);
+
+ mGearMenu = LLPanelOutfitEditGearMenu::create();
+ mGearMenuBtn->setMenu(mGearMenu);
+
+ getChild<LLButton>(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false));
+ getChild<LLButton>(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true));
+
+ onOutfitChanging(gAgentWearables.isCOFChangeInProgress());
+ return TRUE;
}
// virtual
void LLPanelOutfitEdit::onOpen(const LLSD& key)
{
- if (!mInitialized)
- {
- // *TODO: this method is called even panel is not visible to user because its parent layout panel is hidden.
- // So, we can defer initializing a bit.
- mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, mListViewItemTypes[LVIT_ALL]->collector);
- displayCurrentOutfit();
- mInitialized = true;
- }
+ if (!mInitialized)
+ {
+ // *TODO: this method is called even panel is not visible to user because its parent layout panel is hidden.
+ // So, we can defer initializing a bit.
+ mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, mListViewItemTypes[LVIT_ALL]->collector);
+ displayCurrentOutfit();
+ mInitialized = true;
+ }
}
void LLPanelOutfitEdit::moveWearable(bool closer_to_body)
{
- LLUUID item_id = mCOFWearables->getSelectedUUID();
- if (item_id.isNull()) return;
-
- LLViewerInventoryItem* wearable_to_move = gInventory.getItem(item_id);
- LLAppearanceMgr::getInstance()->moveWearable(wearable_to_move, closer_to_body);
+ LLUUID item_id = mCOFWearables->getSelectedUUID();
+ if (item_id.isNull()) return;
+
+ LLViewerInventoryItem* wearable_to_move = gInventory.getItem(item_id);
+ LLAppearanceMgr::getInstance()->moveWearable(wearable_to_move, closer_to_body);
}
void LLPanelOutfitEdit::toggleAddWearablesPanel()
{
- BOOL current_visibility = mAddWearablesPanel->getVisible();
- showAddWearablesPanel(!current_visibility);
+ BOOL current_visibility = mAddWearablesPanel->getVisible();
+ showAddWearablesPanel(!current_visibility);
}
void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables)
{
- mAddWearablesPanel->setVisible(show_add_wearables);
-
- getChild<LLUICtrl>("show_add_wearables_btn")->setValue(show_add_wearables);
-
- updateFiltersVisibility();
- getChildView("filter_button")->setVisible( show_add_wearables);
-
- //search filter should be disabled
- if (!show_add_wearables)
- {
- getChild<LLUICtrl>("filter_button")->setValue(false);
-
- mFolderViewFilterCmbBox->setVisible(false);
- mListViewFilterCmbBox->setVisible(false);
-
- showWearablesFilter();
-
- /*
- * By default AT_CLOTHING are sorted by (in in MY OUTFITS):
- * - by type (types order determined in LLWearableType::EType)
- * - each LLWearableType::EType by outer layer on top
- *
- * In Add More panel AT_CLOTHING should be sorted in a such way:
- * - by type (types order determined in LLWearableType::EType)
- * - each LLWearableType::EType by name (EXT-8205)
- */
- mWearableItemsList->setSortOrder(LLWearableItemsList::E_SORT_BY_TYPE_NAME);
-
- // Reset mWearableItemsList position to top. See EXT-8180.
- mWearableItemsList->goToTop();
- }
- else
- {
- mWearableListManager->populateIfNeeded();
- }
-
- //switching button bars
- getChildView("no_add_wearables_button_bar")->setVisible( !show_add_wearables);
- getChildView("add_wearables_button_bar")->setVisible( show_add_wearables);
+ mAddWearablesPanel->setVisible(show_add_wearables);
+
+ getChild<LLUICtrl>("show_add_wearables_btn")->setValue(show_add_wearables);
+
+ updateFiltersVisibility();
+ getChildView("filter_button")->setVisible( show_add_wearables);
+
+ //search filter should be disabled
+ if (!show_add_wearables)
+ {
+ getChild<LLUICtrl>("filter_button")->setValue(false);
+
+ mFolderViewFilterCmbBox->setVisible(false);
+ mListViewFilterCmbBox->setVisible(false);
+
+ showWearablesFilter();
+
+ /*
+ * By default AT_CLOTHING are sorted by (in in MY OUTFITS):
+ * - by type (types order determined in LLWearableType::EType)
+ * - each LLWearableType::EType by outer layer on top
+ *
+ * In Add More panel AT_CLOTHING should be sorted in a such way:
+ * - by type (types order determined in LLWearableType::EType)
+ * - each LLWearableType::EType by name (EXT-8205)
+ */
+ mWearableItemsList->setSortOrder(LLWearableItemsList::E_SORT_BY_TYPE_NAME);
+
+ // Reset mWearableItemsList position to top. See EXT-8180.
+ mWearableItemsList->goToTop();
+ }
+ else
+ {
+ mWearableListManager->populateIfNeeded();
+ }
+
+ //switching button bars
+ getChildView("no_add_wearables_button_bar")->setVisible( !show_add_wearables);
+ getChildView("add_wearables_button_bar")->setVisible( show_add_wearables);
}
void LLPanelOutfitEdit::showWearablesFilter()
{
- bool filter_visible = getChild<LLUICtrl>("filter_button")->getValue();
-
- getChildView("filter_panel")->setVisible( filter_visible);
-
- if(!filter_visible)
- {
- mSearchFilter->clear();
- onSearchEdit(LLStringUtil::null);
- }
- else
- {
- mSearchFilter->setFocus(TRUE);
- }
+ bool filter_visible = getChild<LLUICtrl>("filter_button")->getValue();
+
+ getChildView("filter_panel")->setVisible( filter_visible);
+
+ if(!filter_visible)
+ {
+ mSearchFilter->clear();
+ onSearchEdit(LLStringUtil::null);
+ }
+ else
+ {
+ mSearchFilter->setFocus(TRUE);
+ }
}
void LLPanelOutfitEdit::showWearablesListView()
{
- if(switchPanels(mInventoryItemsPanel, mWearablesListViewPanel))
- {
- updateWearablesPanelVerbButtons();
- updateFiltersVisibility();
- mWearableListManager->populateIfNeeded();
- }
- mListViewBtn->setToggleState(TRUE);
+ if(switchPanels(mInventoryItemsPanel, mWearablesListViewPanel))
+ {
+ updateWearablesPanelVerbButtons();
+ updateFiltersVisibility();
+ mWearableListManager->populateIfNeeded();
+ }
+ mListViewBtn->setToggleState(TRUE);
}
void LLPanelOutfitEdit::showWearablesFolderView()
{
- if(switchPanels(mWearablesListViewPanel, mInventoryItemsPanel))
- {
- updateWearablesPanelVerbButtons();
- updateFiltersVisibility();
- }
- mFolderViewBtn->setToggleState(TRUE);
+ if(switchPanels(mWearablesListViewPanel, mInventoryItemsPanel))
+ {
+ updateWearablesPanelVerbButtons();
+ updateFiltersVisibility();
+ }
+ mFolderViewBtn->setToggleState(TRUE);
}
void LLPanelOutfitEdit::updateFiltersVisibility()
{
- mListViewFilterCmbBox->setVisible(mWearablesListViewPanel->getVisible());
- mFolderViewFilterCmbBox->setVisible(mInventoryItemsPanel->getVisible());
+ mListViewFilterCmbBox->setVisible(mWearablesListViewPanel->getVisible());
+ mFolderViewFilterCmbBox->setVisible(mInventoryItemsPanel->getVisible());
}
void LLPanelOutfitEdit::onFolderViewFilterCommitted(LLUICtrl* ctrl)
{
- S32 curr_filter_type = mFolderViewFilterCmbBox->getCurrentIndex();
- if (curr_filter_type < 0) return;
+ S32 curr_filter_type = mFolderViewFilterCmbBox->getCurrentIndex();
+ if (curr_filter_type < 0) return;
- mInventoryItemsPanel->setFilterTypes(mFolderViewItemTypes[curr_filter_type].inventoryMask);
+ mInventoryItemsPanel->setFilterTypes(mFolderViewItemTypes[curr_filter_type].inventoryMask);
- mSavedFolderState->setApply(TRUE);
- mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
-
- LLOpenFoldersWithSelection opener;
- mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(opener);
- mInventoryItemsPanel->getRootFolder()->scrollToShowSelection();
+ mSavedFolderState->setApply(TRUE);
+ mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+
+ LLOpenFoldersWithSelection opener;
+ mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(opener);
+ mInventoryItemsPanel->getRootFolder()->scrollToShowSelection();
if (!LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted())
{
@@ -709,452 +709,452 @@ void LLPanelOutfitEdit::onFolderViewFilterCommitted(LLUICtrl* ctrl)
void LLPanelOutfitEdit::onListViewFilterCommitted(LLUICtrl* ctrl)
{
- S32 curr_filter_type = mListViewFilterCmbBox->getCurrentIndex();
- if (curr_filter_type < 0) return;
-
- if (curr_filter_type >= LVIT_SHAPE)
- {
- mWearableItemsList->setMenuWearableType(LLWearableType::EType(curr_filter_type - LVIT_SHAPE));
- }
- mWearableListManager->setFilterCollector(mListViewItemTypes[curr_filter_type]->collector);
+ S32 curr_filter_type = mListViewFilterCmbBox->getCurrentIndex();
+ if (curr_filter_type < 0) return;
+
+ if (curr_filter_type >= LVIT_SHAPE)
+ {
+ mWearableItemsList->setMenuWearableType(LLWearableType::EType(curr_filter_type - LVIT_SHAPE));
+ }
+ mWearableListManager->setFilterCollector(mListViewItemTypes[curr_filter_type]->collector);
}
void LLPanelOutfitEdit::onSearchEdit(const std::string& string)
{
- if (mSearchString != string)
- {
- mSearchString = string;
-
- // Searches are case-insensitive
- LLStringUtil::toUpper(mSearchString);
- LLStringUtil::trimHead(mSearchString);
- }
-
- if (mSearchString == "")
- {
- mInventoryItemsPanel->setFilterSubString(LLStringUtil::null);
- mWearableItemsList->setFilterSubString(LLStringUtil::null, true);
- // re-open folders that were initially open
- mSavedFolderState->setApply(TRUE);
- mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
- LLOpenFoldersWithSelection opener;
- mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(opener);
- mInventoryItemsPanel->getRootFolder()->scrollToShowSelection();
- }
+ if (mSearchString != string)
+ {
+ mSearchString = string;
+
+ // Searches are case-insensitive
+ LLStringUtil::toUpper(mSearchString);
+ LLStringUtil::trimHead(mSearchString);
+ }
+
+ if (mSearchString == "")
+ {
+ mInventoryItemsPanel->setFilterSubString(LLStringUtil::null);
+ mWearableItemsList->setFilterSubString(LLStringUtil::null, true);
+ // re-open folders that were initially open
+ mSavedFolderState->setApply(TRUE);
+ mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+ LLOpenFoldersWithSelection opener;
+ mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(opener);
+ mInventoryItemsPanel->getRootFolder()->scrollToShowSelection();
+ }
if (!LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted())
{
llassert(false); // this should have been done on startup
LLInventoryModelBackgroundFetch::instance().start();
}
-
- if (mInventoryItemsPanel->getFilterSubString().empty() && mSearchString.empty())
- {
- // current filter and new filter empty, do nothing
- return;
- }
-
- // save current folder open state if no filter currently applied
- if (mInventoryItemsPanel->getFilterSubString().empty())
- {
- mSavedFolderState->setApply(FALSE);
- mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
- }
-
- // set new filter string
- mInventoryItemsPanel->setFilterSubString(mSearchString);
- mWearableItemsList->setFilterSubString(mSearchString, true);
+
+ if (mInventoryItemsPanel->getFilterSubString().empty() && mSearchString.empty())
+ {
+ // current filter and new filter empty, do nothing
+ return;
+ }
+
+ // save current folder open state if no filter currently applied
+ if (mInventoryItemsPanel->getFilterSubString().empty())
+ {
+ mSavedFolderState->setApply(FALSE);
+ mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+ }
+
+ // set new filter string
+ mInventoryItemsPanel->setFilterSubString(mSearchString);
+ mWearableItemsList->setFilterSubString(mSearchString, true);
}
void LLPanelOutfitEdit::onPlusBtnClicked(void)
{
- uuid_vec_t selected_items;
- getSelectedItemsUUID(selected_items);
-
- LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
-
- for(uuid_vec_t::iterator iter = selected_items.begin(); iter != selected_items.end(); iter++)
- {
- LLUUID selected_id = *iter;
- if (!selected_id.isNull())
- {
- //replacing instead of adding the item
- LLAppearanceMgr::getInstance()->wearItemOnAvatar(selected_id, false, true, link_waiter);
- }
- }
+ uuid_vec_t selected_items;
+ getSelectedItemsUUID(selected_items);
+
+ LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
+
+ for(uuid_vec_t::iterator iter = selected_items.begin(); iter != selected_items.end(); iter++)
+ {
+ LLUUID selected_id = *iter;
+ if (!selected_id.isNull())
+ {
+ //replacing instead of adding the item
+ LLAppearanceMgr::getInstance()->wearItemOnAvatar(selected_id, false, true, link_waiter);
+ }
+ }
}
void LLPanelOutfitEdit::onVisibilityChanged(const LLSD &in_visible_chain)
{
- showAddWearablesPanel(false);
- mWearableItemsList->resetSelection();
- mInventoryItemsPanel->clearSelection();
-
- if (in_visible_chain.asBoolean())
- {
- update();
- }
- else
- {
- mWearableListManager->holdProgress(); //list population restarts with visibility
- }
+ showAddWearablesPanel(false);
+ mWearableItemsList->resetSelection();
+ mInventoryItemsPanel->clearSelection();
+
+ if (in_visible_chain.asBoolean())
+ {
+ update();
+ }
+ else
+ {
+ mWearableListManager->holdProgress(); //list population restarts with visibility
+ }
}
void LLPanelOutfitEdit::onAddWearableClicked(void)
{
- LLPanelDummyClothingListItem* item = dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem());
+ LLPanelDummyClothingListItem* item = dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem());
- if(item)
- {
- showFilteredWearablesListView(item->getWearableType());
- }
+ if(item)
+ {
+ showFilteredWearablesListView(item->getWearableType());
+ }
}
void LLPanelOutfitEdit::onReplaceMenuItemClicked(LLUUID selected_item_id)
{
- LLViewerInventoryItem* item = gInventory.getLinkedItem(selected_item_id);
+ LLViewerInventoryItem* item = gInventory.getLinkedItem(selected_item_id);
- if (item)
- {
- showFilteredWearablesListView(item->getWearableType());
- }
+ if (item)
+ {
+ showFilteredWearablesListView(item->getWearableType());
+ }
}
void LLPanelOutfitEdit::onShopButtonClicked()
{
- static LLShopURLDispatcher url_resolver;
-
- // will contain the resultant URL
- std::string url;
-
- if (isAgentAvatarValid())
- {
- // try to get wearable type from 'Add More' panel first (EXT-7639)
- selection_info_t selection_info = getAddMorePanelSelectionType();
-
- LLWearableType::EType type = selection_info.first;
-
- if (selection_info.second > 1)
- {
- // the second argument is not important in this case: generic market place will be opened
- url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE);
- }
- else
- {
- if (type == LLWearableType::WT_NONE)
- {
- type = getCOFWearablesSelectionType();
- }
-
- ESex sex = gAgentAvatarp->getSex();
-
- // WT_INVALID comes for attachments
- if (type != LLWearableType::WT_INVALID && type != LLWearableType::WT_NONE)
- {
- url = url_resolver.resolveURL(type, sex);
- }
-
- if (url.empty())
- {
- url = url_resolver.resolveURL(
- mCOFWearables->getExpandedAccordionAssetType(), sex);
- }
- }
- }
- else
- {
- LL_WARNS() << "Agent avatar is invalid" << LL_ENDL;
-
- // the second argument is not important in this case: generic market place will be opened
- url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE);
- }
-
- LLWeb::loadURL(url);
+ static LLShopURLDispatcher url_resolver;
+
+ // will contain the resultant URL
+ std::string url;
+
+ if (isAgentAvatarValid())
+ {
+ // try to get wearable type from 'Add More' panel first (EXT-7639)
+ selection_info_t selection_info = getAddMorePanelSelectionType();
+
+ LLWearableType::EType type = selection_info.first;
+
+ if (selection_info.second > 1)
+ {
+ // the second argument is not important in this case: generic market place will be opened
+ url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE);
+ }
+ else
+ {
+ if (type == LLWearableType::WT_NONE)
+ {
+ type = getCOFWearablesSelectionType();
+ }
+
+ ESex sex = gAgentAvatarp->getSex();
+
+ // WT_INVALID comes for attachments
+ if (type != LLWearableType::WT_INVALID && type != LLWearableType::WT_NONE)
+ {
+ url = url_resolver.resolveURL(type, sex);
+ }
+
+ if (url.empty())
+ {
+ url = url_resolver.resolveURL(
+ mCOFWearables->getExpandedAccordionAssetType(), sex);
+ }
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Agent avatar is invalid" << LL_ENDL;
+
+ // the second argument is not important in this case: generic market place will be opened
+ url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE);
+ }
+
+ LLWeb::loadURL(url);
}
LLWearableType::EType LLPanelOutfitEdit::getCOFWearablesSelectionType() const
{
- std::vector<LLPanel*> selected_items;
- LLWearableType::EType type = LLWearableType::WT_NONE;
-
- mCOFWearables->getSelectedItems(selected_items);
-
- if (selected_items.size() == 1)
- {
- LLPanel* item = selected_items.front();
-
- // LLPanelDummyClothingListItem is lower then LLPanelInventoryListItemBase in hierarchy tree
- if (LLPanelDummyClothingListItem* dummy_item = dynamic_cast<LLPanelDummyClothingListItem*>(item))
- {
- type = dummy_item->getWearableType();
- }
- else if (LLPanelInventoryListItemBase* real_item = dynamic_cast<LLPanelInventoryListItemBase*>(item))
- {
- type = real_item->getWearableType();
- }
- }
-
- return type;
+ std::vector<LLPanel*> selected_items;
+ LLWearableType::EType type = LLWearableType::WT_NONE;
+
+ mCOFWearables->getSelectedItems(selected_items);
+
+ if (selected_items.size() == 1)
+ {
+ LLPanel* item = selected_items.front();
+
+ // LLPanelDummyClothingListItem is lower then LLPanelInventoryListItemBase in hierarchy tree
+ if (LLPanelDummyClothingListItem* dummy_item = dynamic_cast<LLPanelDummyClothingListItem*>(item))
+ {
+ type = dummy_item->getWearableType();
+ }
+ else if (LLPanelInventoryListItemBase* real_item = dynamic_cast<LLPanelInventoryListItemBase*>(item))
+ {
+ type = real_item->getWearableType();
+ }
+ }
+
+ return type;
}
LLPanelOutfitEdit::selection_info_t LLPanelOutfitEdit::getAddMorePanelSelectionType() const
{
- selection_info_t result = std::make_pair(LLWearableType::WT_NONE, 0);
-
- if (mAddWearablesPanel != NULL && mAddWearablesPanel->getVisible())
- {
- if (mInventoryItemsPanel != NULL && mInventoryItemsPanel->getVisible())
- {
- std::set<LLFolderViewItem*> selected_items = mInventoryItemsPanel->getRootFolder()->getSelectionList();
-
- result.second = selected_items.size();
-
- if (result.second == 1)
- {
- result.first = getWearableTypeByItemUUID(static_cast<LLFolderViewModelItemInventory*>((*selected_items.begin())->getViewModelItem())->getUUID());
- }
- }
- else if (mWearableItemsList != NULL && mWearableItemsList->getVisible())
- {
- std::vector<LLUUID> selected_uuids;
- mWearableItemsList->getSelectedUUIDs(selected_uuids);
-
- result.second = selected_uuids.size();
-
- if (result.second == 1)
- {
- result.first = getWearableTypeByItemUUID(selected_uuids.front());
- }
- }
- }
-
- return result;
+ selection_info_t result = std::make_pair(LLWearableType::WT_NONE, 0);
+
+ if (mAddWearablesPanel != NULL && mAddWearablesPanel->getVisible())
+ {
+ if (mInventoryItemsPanel != NULL && mInventoryItemsPanel->getVisible())
+ {
+ std::set<LLFolderViewItem*> selected_items = mInventoryItemsPanel->getRootFolder()->getSelectionList();
+
+ result.second = selected_items.size();
+
+ if (result.second == 1)
+ {
+ result.first = getWearableTypeByItemUUID(static_cast<LLFolderViewModelItemInventory*>((*selected_items.begin())->getViewModelItem())->getUUID());
+ }
+ }
+ else if (mWearableItemsList != NULL && mWearableItemsList->getVisible())
+ {
+ std::vector<LLUUID> selected_uuids;
+ mWearableItemsList->getSelectedUUIDs(selected_uuids);
+
+ result.second = selected_uuids.size();
+
+ if (result.second == 1)
+ {
+ result.first = getWearableTypeByItemUUID(selected_uuids.front());
+ }
+ }
+ }
+
+ return result;
}
LLWearableType::EType LLPanelOutfitEdit::getWearableTypeByItemUUID(const LLUUID& item_uuid) const
{
- LLViewerInventoryItem* item = gInventory.getLinkedItem(item_uuid);
- return (item != NULL) ? item->getWearableType() : LLWearableType::WT_NONE;
+ LLViewerInventoryItem* item = gInventory.getLinkedItem(item_uuid);
+ return (item != NULL) ? item->getWearableType() : LLWearableType::WT_NONE;
}
void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void)
{
- LLUUID id_to_remove = mCOFWearables->getSelectedUUID();
- LLWearableType::EType type = getWearableTypeByItemUUID(id_to_remove);
-
- LLAppearanceMgr::getInstance()->removeItemFromAvatar(id_to_remove);
-
- if (!mCOFWearables->getSelectedItem())
- {
- mCOFWearables->selectClothing(type);
- }
+ LLUUID id_to_remove = mCOFWearables->getSelectedUUID();
+ LLWearableType::EType type = getWearableTypeByItemUUID(id_to_remove);
+
+ LLAppearanceMgr::getInstance()->removeItemFromAvatar(id_to_remove);
+
+ if (!mCOFWearables->getSelectedItem())
+ {
+ mCOFWearables->selectClothing(type);
+ }
}
void LLPanelOutfitEdit::onEditWearableClicked(void)
{
- LLUUID selected_item_id = mCOFWearables->getSelectedUUID();
- if (selected_item_id.notNull())
- {
- gAgentWearables.editWearable(selected_item_id);
- }
+ LLUUID selected_item_id = mCOFWearables->getSelectedUUID();
+ if (selected_item_id.notNull())
+ {
+ gAgentWearables.editWearable(selected_item_id);
+ }
}
void LLPanelOutfitEdit::updatePlusButton()
{
- uuid_vec_t selected_items;
- getSelectedItemsUUID(selected_items);
- if (selected_items.empty())
- {
- mPlusBtn->setEnabled(false);
- return;
- }
-
- // If any of the selected items are not wearable (due to already being worn OR being of the wrong type), disable the add button.
- uuid_vec_t::iterator unwearable_item = std::find_if(selected_items.begin(), selected_items.end(), !boost::bind(&get_can_item_be_worn, _1));
- bool can_add = ( unwearable_item == selected_items.end() );
-
- mPlusBtn->setEnabled(can_add);
-
- LLViewerInventoryItem* first_item(gInventory.getItem(selected_items.front()));
-
- if (can_add &&
- first_item &&
- selected_items.size() == 1 &&
- first_item->getType() == LLAssetType::AT_BODYPART)
- {
- mPlusBtn->setToolTip(getString("replace_body_part"));
- }
- else
- {
- mPlusBtn->setToolTip(LLStringUtil::null);
- }
-
- /* Removing add to look inline button (not part of mvp for viewer 2)
- LLRect btn_rect(current_item->getLocalRect().mRight - 50,
- current_item->getLocalRect().mTop,
- current_item->getLocalRect().mRight - 30,
- current_item->getLocalRect().mBottom);
-
- mAddToLookBtn->setRect(btn_rect);
- mAddToLookBtn->setEnabled(TRUE);
- if (!mAddToLookBtn->getVisible())
- {
- mAddToLookBtn->setVisible(TRUE);
- }
-
- current_item->addChild(mAddToLookBtn); */
+ uuid_vec_t selected_items;
+ getSelectedItemsUUID(selected_items);
+ if (selected_items.empty())
+ {
+ mPlusBtn->setEnabled(false);
+ return;
+ }
+
+ // If any of the selected items are not wearable (due to already being worn OR being of the wrong type), disable the add button.
+ uuid_vec_t::iterator unwearable_item = std::find_if(selected_items.begin(), selected_items.end(), !boost::bind(&get_can_item_be_worn, _1));
+ bool can_add = ( unwearable_item == selected_items.end() );
+
+ mPlusBtn->setEnabled(can_add);
+
+ LLViewerInventoryItem* first_item(gInventory.getItem(selected_items.front()));
+
+ if (can_add &&
+ first_item &&
+ selected_items.size() == 1 &&
+ first_item->getType() == LLAssetType::AT_BODYPART)
+ {
+ mPlusBtn->setToolTip(getString("replace_body_part"));
+ }
+ else
+ {
+ mPlusBtn->setToolTip(LLStringUtil::null);
+ }
+
+ /* Removing add to look inline button (not part of mvp for viewer 2)
+ LLRect btn_rect(current_item->getLocalRect().mRight - 50,
+ current_item->getLocalRect().mTop,
+ current_item->getLocalRect().mRight - 30,
+ current_item->getLocalRect().mBottom);
+
+ mAddToLookBtn->setRect(btn_rect);
+ mAddToLookBtn->setEnabled(TRUE);
+ if (!mAddToLookBtn->getVisible())
+ {
+ mAddToLookBtn->setVisible(TRUE);
+ }
+
+ current_item->addChild(mAddToLookBtn); */
}
void LLPanelOutfitEdit::applyFolderViewFilter(EFolderViewItemType type)
{
- mFolderViewFilterCmbBox->setCurrentByIndex(type);
- mFolderViewFilterCmbBox->onCommit();
+ mFolderViewFilterCmbBox->setCurrentByIndex(type);
+ mFolderViewFilterCmbBox->onCommit();
}
void LLPanelOutfitEdit::applyListViewFilter(EListViewItemType type)
{
- mListViewFilterCmbBox->setCurrentByIndex(type);
- mListViewFilterCmbBox->onCommit();
+ mListViewFilterCmbBox->setCurrentByIndex(type);
+ mListViewFilterCmbBox->onCommit();
}
void LLPanelOutfitEdit::filterWearablesBySelectedItem(void)
{
- if (!mAddWearablesPanel->getVisible()) return;
-
- uuid_vec_t ids;
- mCOFWearables->getSelectedUUIDs(ids);
-
- bool nothing_selected = ids.empty();
- bool one_selected = ids.size() == 1;
- bool more_than_one_selected = ids.size() > 1;
- bool is_dummy_item = (ids.size() && dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem()));
-
- // selected, expanded accordion tabs and selection in flat list view determine filtering when no item is selected in COF
- // selection in flat list view participates in determining filtering because of EXT-7963
- // So the priority of criterions in is:
- // 1. Selected accordion tab | IF (any accordion selected)
- // | filter_type = selected_accordion_type
- // 2. Selected item in flat list view | ELSEIF (any item in flat list view selected)
- // | filter_type = selected_item_type
- // 3. Expanded accordion tab | ELSEIF (any accordion expanded)
- // | filter_type = expanded accordion_type
- if (nothing_selected)
- {
- if (mInventoryItemsPanel->getVisible())
- {
- return;
- }
- showWearablesListView();
-
- //selected accordion tab is more priority than expanded tab
- //and selected item in flat list view of 'Add more' panel when
- //determining filtering
- LLAssetType::EType type = mCOFWearables->getSelectedAccordionAssetType();
- if (type == LLAssetType::AT_NONE)
- { //no accordion selected
-
- // when no accordion selected then selected item from flat list view
- // has more priority than expanded when determining filtering
- LLUUID selected_item_id = mWearableItemsList->getSelectedUUID();
- LLViewerInventoryItem* item = gInventory.getLinkedItem(selected_item_id);
- if(item)
- {
- showFilteredWearablesListView(item->getWearableType());
- return;
- }
-
- // when no accordion selected and no selected items in flat list view
- // determine filtering according to expanded accordion
- type = mCOFWearables->getExpandedAccordionAssetType();
- }
-
- switch (type)
- {
- case LLAssetType::AT_OBJECT:
- applyListViewFilter(LVIT_ATTACHMENT);
- break;
- case LLAssetType::AT_BODYPART:
- applyListViewFilter(LVIT_BODYPART);
- break;
- case LLAssetType::AT_CLOTHING:
- default:
- applyListViewFilter(LVIT_CLOTHING);
- break;
- }
-
- return;
- }
-
- //resetting selection if more than one item is selected
- if (more_than_one_selected)
- {
- if (mInventoryItemsPanel->getVisible())
- {
- applyFolderViewFilter(FVIT_ALL);
- return;
- }
-
- showWearablesListView();
- applyListViewFilter(LVIT_ALL);
- return;
- }
-
-
- //filter wearables by a type represented by a dummy item
- if (one_selected && is_dummy_item)
- {
- if (mInventoryItemsPanel->getVisible())
- {
- applyFolderViewFilter(FVIT_WEARABLE);
- return;
- }
-
- onAddWearableClicked();
- return;
- }
-
- LLViewerInventoryItem* item = gInventory.getItem(ids[0]);
- if (!item && ids[0].notNull())
- {
- if (mInventoryItemsPanel->getVisible())
- {
- applyFolderViewFilter(FVIT_ALL);
- return;
- }
- //Inventory misses an item with non-zero id
- showWearablesListView();
- applyListViewFilter(LVIT_ALL);
- return;
- }
-
- if (item && one_selected && !is_dummy_item)
- {
- if (item->isWearableType())
- {
- if (mInventoryItemsPanel->getVisible())
- {
- applyFolderViewFilter(FVIT_WEARABLE);
- return;
- }
- //single clothing or bodypart item is selected
- showFilteredWearablesListView(item->getWearableType());
- return;
- }
- else
- {
- if (mInventoryItemsPanel->getVisible())
- {
- applyFolderViewFilter(FVIT_ATTACHMENT);
- return;
- }
- //attachment is selected
- showWearablesListView();
- applyListViewFilter(LVIT_ATTACHMENT);
- return;
- }
- }
+ if (!mAddWearablesPanel->getVisible()) return;
+
+ uuid_vec_t ids;
+ mCOFWearables->getSelectedUUIDs(ids);
+
+ bool nothing_selected = ids.empty();
+ bool one_selected = ids.size() == 1;
+ bool more_than_one_selected = ids.size() > 1;
+ bool is_dummy_item = (ids.size() && dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem()));
+
+ // selected, expanded accordion tabs and selection in flat list view determine filtering when no item is selected in COF
+ // selection in flat list view participates in determining filtering because of EXT-7963
+ // So the priority of criterions in is:
+ // 1. Selected accordion tab | IF (any accordion selected)
+ // | filter_type = selected_accordion_type
+ // 2. Selected item in flat list view | ELSEIF (any item in flat list view selected)
+ // | filter_type = selected_item_type
+ // 3. Expanded accordion tab | ELSEIF (any accordion expanded)
+ // | filter_type = expanded accordion_type
+ if (nothing_selected)
+ {
+ if (mInventoryItemsPanel->getVisible())
+ {
+ return;
+ }
+ showWearablesListView();
+
+ //selected accordion tab is more priority than expanded tab
+ //and selected item in flat list view of 'Add more' panel when
+ //determining filtering
+ LLAssetType::EType type = mCOFWearables->getSelectedAccordionAssetType();
+ if (type == LLAssetType::AT_NONE)
+ { //no accordion selected
+
+ // when no accordion selected then selected item from flat list view
+ // has more priority than expanded when determining filtering
+ LLUUID selected_item_id = mWearableItemsList->getSelectedUUID();
+ LLViewerInventoryItem* item = gInventory.getLinkedItem(selected_item_id);
+ if(item)
+ {
+ showFilteredWearablesListView(item->getWearableType());
+ return;
+ }
+
+ // when no accordion selected and no selected items in flat list view
+ // determine filtering according to expanded accordion
+ type = mCOFWearables->getExpandedAccordionAssetType();
+ }
+
+ switch (type)
+ {
+ case LLAssetType::AT_OBJECT:
+ applyListViewFilter(LVIT_ATTACHMENT);
+ break;
+ case LLAssetType::AT_BODYPART:
+ applyListViewFilter(LVIT_BODYPART);
+ break;
+ case LLAssetType::AT_CLOTHING:
+ default:
+ applyListViewFilter(LVIT_CLOTHING);
+ break;
+ }
+
+ return;
+ }
+
+ //resetting selection if more than one item is selected
+ if (more_than_one_selected)
+ {
+ if (mInventoryItemsPanel->getVisible())
+ {
+ applyFolderViewFilter(FVIT_ALL);
+ return;
+ }
+
+ showWearablesListView();
+ applyListViewFilter(LVIT_ALL);
+ return;
+ }
+
+
+ //filter wearables by a type represented by a dummy item
+ if (one_selected && is_dummy_item)
+ {
+ if (mInventoryItemsPanel->getVisible())
+ {
+ applyFolderViewFilter(FVIT_WEARABLE);
+ return;
+ }
+
+ onAddWearableClicked();
+ return;
+ }
+
+ LLViewerInventoryItem* item = gInventory.getItem(ids[0]);
+ if (!item && ids[0].notNull())
+ {
+ if (mInventoryItemsPanel->getVisible())
+ {
+ applyFolderViewFilter(FVIT_ALL);
+ return;
+ }
+ //Inventory misses an item with non-zero id
+ showWearablesListView();
+ applyListViewFilter(LVIT_ALL);
+ return;
+ }
+
+ if (item && one_selected && !is_dummy_item)
+ {
+ if (item->isWearableType())
+ {
+ if (mInventoryItemsPanel->getVisible())
+ {
+ applyFolderViewFilter(FVIT_WEARABLE);
+ return;
+ }
+ //single clothing or bodypart item is selected
+ showFilteredWearablesListView(item->getWearableType());
+ return;
+ }
+ else
+ {
+ if (mInventoryItemsPanel->getVisible())
+ {
+ applyFolderViewFilter(FVIT_ATTACHMENT);
+ return;
+ }
+ //attachment is selected
+ showWearablesListView();
+ applyListViewFilter(LVIT_ATTACHMENT);
+ return;
+ }
+ }
}
@@ -1162,288 +1162,288 @@ void LLPanelOutfitEdit::filterWearablesBySelectedItem(void)
void LLPanelOutfitEdit::update()
{
- mCOFWearables->refresh();
+ mCOFWearables->refresh();
- updateVerbs();
+ updateVerbs();
}
BOOL LLPanelOutfitEdit::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
{
- if (cargo_data == NULL)
- {
- LL_WARNS() << "cargo_data is NULL" << LL_ENDL;
- return TRUE;
- }
-
- switch (cargo_type)
- {
- case DAD_BODYPART:
- case DAD_CLOTHING:
- case DAD_OBJECT:
- case DAD_LINK:
- *accept = ACCEPT_YES_MULTI;
- break;
- default:
- *accept = ACCEPT_NO;
- }
-
- if (drop)
- {
- LLInventoryItem* item = static_cast<LLInventoryItem*>(cargo_data);
-
- if (LLAssetType::lookupIsAssetIDKnowable(item->getType()))
- {
- mCOFDragAndDropObserver->watchAsset(item->getAssetUUID());
-
- /*
- * Adding request to wear item. If the item is a link, then getLinkedUUID() will
- * return the ID of the linked item. Otherwise it will return the item's ID. The
- * second argument is used to delay the appearance update until all dragged items
- * are added to optimize user experience.
- */
- LLAppearanceMgr::instance().addCOFItemLink(item->getLinkedUUID());
- }
- else
- {
- // if asset id is not available for the item we must wear it immediately (attachments only)
- LLAppearanceMgr::instance().addCOFItemLink(item->getLinkedUUID(), new LLUpdateAppearanceAndEditWearableOnDestroy(item->getUUID()));
- }
- }
-
- return TRUE;
+ if (cargo_data == NULL)
+ {
+ LL_WARNS() << "cargo_data is NULL" << LL_ENDL;
+ return TRUE;
+ }
+
+ switch (cargo_type)
+ {
+ case DAD_BODYPART:
+ case DAD_CLOTHING:
+ case DAD_OBJECT:
+ case DAD_LINK:
+ *accept = ACCEPT_YES_MULTI;
+ break;
+ default:
+ *accept = ACCEPT_NO;
+ }
+
+ if (drop)
+ {
+ LLInventoryItem* item = static_cast<LLInventoryItem*>(cargo_data);
+
+ if (LLAssetType::lookupIsAssetIDKnowable(item->getType()))
+ {
+ mCOFDragAndDropObserver->watchAsset(item->getAssetUUID());
+
+ /*
+ * Adding request to wear item. If the item is a link, then getLinkedUUID() will
+ * return the ID of the linked item. Otherwise it will return the item's ID. The
+ * second argument is used to delay the appearance update until all dragged items
+ * are added to optimize user experience.
+ */
+ LLAppearanceMgr::instance().addCOFItemLink(item->getLinkedUUID());
+ }
+ else
+ {
+ // if asset id is not available for the item we must wear it immediately (attachments only)
+ LLAppearanceMgr::instance().addCOFItemLink(item->getLinkedUUID(), new LLUpdateAppearanceAndEditWearableOnDestroy(item->getUUID()));
+ }
+ }
+
+ return TRUE;
}
void LLPanelOutfitEdit::displayCurrentOutfit()
{
- if (!getVisible())
- {
- setVisible(TRUE);
- }
+ if (!getVisible())
+ {
+ setVisible(TRUE);
+ }
- updateCurrentOutfitName();
+ updateCurrentOutfitName();
- update();
+ update();
}
void LLPanelOutfitEdit::updateCurrentOutfitName()
{
- std::string current_outfit_name;
- if (LLAppearanceMgr::getInstance()->getBaseOutfitName(current_outfit_name))
- {
- mCurrentOutfitName->setText(current_outfit_name);
- }
- else
- {
- mCurrentOutfitName->setText(getString("No Outfit"));
- }
+ std::string current_outfit_name;
+ if (LLAppearanceMgr::getInstance()->getBaseOutfitName(current_outfit_name))
+ {
+ mCurrentOutfitName->setText(current_outfit_name);
+ }
+ else
+ {
+ mCurrentOutfitName->setText(getString("No Outfit"));
+ }
}
//private
void LLPanelOutfitEdit::updateVerbs()
{
- bool outfit_is_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
- bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked();
- bool has_baseoutfit = LLAppearanceMgr::getInstance()->getBaseOutfitUUID().notNull();
+ bool outfit_is_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
+ bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked();
+ bool has_baseoutfit = LLAppearanceMgr::getInstance()->getBaseOutfitUUID().notNull();
- getChildView(SAVE_BTN)->setEnabled(!outfit_locked && outfit_is_dirty);
- getChildView(REVERT_BTN)->setEnabled(outfit_is_dirty && has_baseoutfit);
+ getChildView(SAVE_BTN)->setEnabled(!outfit_locked && outfit_is_dirty);
+ getChildView(REVERT_BTN)->setEnabled(outfit_is_dirty && has_baseoutfit);
- mStatus->setText(outfit_is_dirty ? getString("unsaved_changes") : getString("now_editing"));
+ mStatus->setText(outfit_is_dirty ? getString("unsaved_changes") : getString("now_editing"));
- updateCurrentOutfitName();
+ updateCurrentOutfitName();
- //updating state of "Wear Item" button previously known as "Plus" button
- updatePlusButton();
+ //updating state of "Wear Item" button previously known as "Plus" button
+ updatePlusButton();
}
bool LLPanelOutfitEdit::switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel)
{
- if(switch_from_panel && switch_to_panel && !switch_to_panel->getVisible())
- {
- switch_from_panel->setVisible(FALSE);
- switch_to_panel->setVisible(TRUE);
- return true;
- }
- return false;
+ if(switch_from_panel && switch_to_panel && !switch_to_panel->getVisible())
+ {
+ switch_from_panel->setVisible(FALSE);
+ switch_to_panel->setVisible(TRUE);
+ return true;
+ }
+ return false;
}
void LLPanelOutfitEdit::resetAccordionState()
{
- if (mCOFWearables != NULL)
- {
- mCOFWearables->expandDefaultAccordionTab();
- }
- else
- {
- LL_WARNS() << "mCOFWearables is NULL" << LL_ENDL;
- }
+ if (mCOFWearables != NULL)
+ {
+ mCOFWearables->expandDefaultAccordionTab();
+ }
+ else
+ {
+ LL_WARNS() << "mCOFWearables is NULL" << LL_ENDL;
+ }
}
void LLPanelOutfitEdit::onAddMoreButtonClicked()
{
- toggleAddWearablesPanel();
- filterWearablesBySelectedItem();
+ toggleAddWearablesPanel();
+ filterWearablesBySelectedItem();
}
void LLPanelOutfitEdit::showFilteredWearablesListView(LLWearableType::EType type)
{
- showAddWearablesPanel(true);
- showWearablesListView();
+ showAddWearablesPanel(true);
+ showWearablesListView();
- //e_list_view_item_type implicitly contains LLWearableType::EType starting from LVIT_SHAPE
- applyListViewFilter(static_cast<EListViewItemType>(LVIT_SHAPE + type));
- mWearableItemsList->setMenuWearableType(type);
+ //e_list_view_item_type implicitly contains LLWearableType::EType starting from LVIT_SHAPE
+ applyListViewFilter(static_cast<EListViewItemType>(LVIT_SHAPE + type));
+ mWearableItemsList->setMenuWearableType(type);
}
static void update_status_widget_rect(LLView * widget, S32 right_border)
{
- LLRect rect = widget->getRect();
- rect.mRight = right_border;
+ LLRect rect = widget->getRect();
+ rect.mRight = right_border;
- widget->setShape(rect);
+ widget->setShape(rect);
}
void LLPanelOutfitEdit::onOutfitChanging(bool started)
{
- static LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("edit_outfit_loading_indicator");
- static LLView* status_panel = getChild<LLView>("outfit_name_and_status");
- static S32 indicator_delta = status_panel->getRect().getWidth() - indicator->getRect().mLeft;
+ static LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("edit_outfit_loading_indicator");
+ static LLView* status_panel = getChild<LLView>("outfit_name_and_status");
+ static S32 indicator_delta = status_panel->getRect().getWidth() - indicator->getRect().mLeft;
- S32 delta = started ? indicator_delta : 0;
- S32 right_border = status_panel->getRect().getWidth() - delta;
+ S32 delta = started ? indicator_delta : 0;
+ S32 right_border = status_panel->getRect().getWidth() - delta;
- if (mCurrentOutfitName)
- update_status_widget_rect(mCurrentOutfitName, right_border);
- if (mStatus)
- update_status_widget_rect(mStatus, right_border);
+ if (mCurrentOutfitName)
+ update_status_widget_rect(mCurrentOutfitName, right_border);
+ if (mStatus)
+ update_status_widget_rect(mStatus, right_border);
- indicator->setVisible(started);
+ indicator->setVisible(started);
}
void LLPanelOutfitEdit::getCurrentItemUUID(LLUUID& selected_id)
{
- if (mInventoryItemsPanel->getVisible())
- {
- LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
- if (!curr_item) return;
-
- LLFolderViewModelItemInventory* listenerp = static_cast<LLFolderViewModelItemInventory*>(curr_item->getViewModelItem());
- if (!listenerp) return;
-
- selected_id = listenerp->getUUID();
- }
- else if (mWearablesListViewPanel->getVisible())
- {
- selected_id = mWearableItemsList->getSelectedUUID();
- }
+ if (mInventoryItemsPanel->getVisible())
+ {
+ LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
+ if (!curr_item) return;
+
+ LLFolderViewModelItemInventory* listenerp = static_cast<LLFolderViewModelItemInventory*>(curr_item->getViewModelItem());
+ if (!listenerp) return;
+
+ selected_id = listenerp->getUUID();
+ }
+ else if (mWearablesListViewPanel->getVisible())
+ {
+ selected_id = mWearableItemsList->getSelectedUUID();
+ }
}
void LLPanelOutfitEdit::getSelectedItemsUUID(uuid_vec_t& uuid_list)
{
- void (uuid_vec_t::* tmp)(LLUUID const &) = &uuid_vec_t::push_back;
- if (mInventoryItemsPanel->getVisible())
- {
- std::set<LLFolderViewItem*> item_set = mInventoryItemsPanel->getRootFolder()->getSelectionList();
- for (std::set<LLFolderViewItem*>::iterator it = item_set.begin(), end_it = item_set.end();
- it != end_it;
- ++it)
- {
- uuid_list.push_back(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
- }
- }
- else if (mWearablesListViewPanel->getVisible())
- {
- std::vector<LLSD> item_set;
- mWearableItemsList->getSelectedValues(item_set);
-
- std::for_each(item_set.begin(), item_set.end(), boost::bind( tmp, &uuid_list, boost::bind(&LLSD::asUUID, _1 )));
- }
-
-// return selected_id;
+ void (uuid_vec_t::* tmp)(LLUUID const &) = &uuid_vec_t::push_back;
+ if (mInventoryItemsPanel->getVisible())
+ {
+ std::set<LLFolderViewItem*> item_set = mInventoryItemsPanel->getRootFolder()->getSelectionList();
+ for (std::set<LLFolderViewItem*>::iterator it = item_set.begin(), end_it = item_set.end();
+ it != end_it;
+ ++it)
+ {
+ uuid_list.push_back(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
+ }
+ }
+ else if (mWearablesListViewPanel->getVisible())
+ {
+ std::vector<LLSD> item_set;
+ mWearableItemsList->getSelectedValues(item_set);
+
+ std::for_each(item_set.begin(), item_set.end(), boost::bind( tmp, &uuid_list, boost::bind(&LLSD::asUUID, _1 )));
+ }
+
+// return selected_id;
}
void LLPanelOutfitEdit::onCOFChanged()
{
- //the panel is only updated when is visible to a user
+ //the panel is only updated when is visible to a user
- // BAP - this check has to be removed because otherwise item name
- // changes made when the panel is not visible will not be
- // propagated to the panel.
- // if (!isInVisibleChain()) return;
+ // BAP - this check has to be removed because otherwise item name
+ // changes made when the panel is not visible will not be
+ // propagated to the panel.
+ // if (!isInVisibleChain()) return;
- update();
+ update();
}
void LLPanelOutfitEdit::updateWearablesPanelVerbButtons()
{
- if(mWearablesListViewPanel->getVisible())
- {
- mFolderViewBtn->setToggleState(FALSE);
- mFolderViewBtn->setImageOverlay(getString("folder_view_off"), mFolderViewBtn->getImageOverlayHAlign());
- mListViewBtn->setImageOverlay(getString("list_view_on"), mListViewBtn->getImageOverlayHAlign());
- }
- else if(mInventoryItemsPanel->getVisible())
- {
- mListViewBtn->setToggleState(FALSE);
- mListViewBtn->setImageOverlay(getString("list_view_off"), mListViewBtn->getImageOverlayHAlign());
- mFolderViewBtn->setImageOverlay(getString("folder_view_on"), mFolderViewBtn->getImageOverlayHAlign());
- }
+ if(mWearablesListViewPanel->getVisible())
+ {
+ mFolderViewBtn->setToggleState(FALSE);
+ mFolderViewBtn->setImageOverlay(getString("folder_view_off"), mFolderViewBtn->getImageOverlayHAlign());
+ mListViewBtn->setImageOverlay(getString("list_view_on"), mListViewBtn->getImageOverlayHAlign());
+ }
+ else if(mInventoryItemsPanel->getVisible())
+ {
+ mListViewBtn->setToggleState(FALSE);
+ mListViewBtn->setImageOverlay(getString("list_view_off"), mListViewBtn->getImageOverlayHAlign());
+ mFolderViewBtn->setImageOverlay(getString("folder_view_on"), mFolderViewBtn->getImageOverlayHAlign());
+ }
}
void LLPanelOutfitEdit::saveListSelection()
{
- if(mWearablesListViewPanel->getVisible())
- {
- std::set<LLFolderViewItem*> selected_ids = mInventoryItemsPanel->getRootFolder()->getSelectionList();
-
- if(!selected_ids.size()) return;
-
- for (std::set<LLFolderViewItem*>::const_iterator item_id = selected_ids.begin(); item_id != selected_ids.end(); ++item_id)
- {
- mWearableItemsList->selectItemByUUID(static_cast<LLFolderViewModelItemInventory*>((*item_id)->getViewModelItem())->getUUID(), true);
- }
- mWearableItemsList->scrollToShowFirstSelectedItem();
- }
- else if(mInventoryItemsPanel->getVisible())
- {
- std::vector<LLUUID> selected_ids;
- mWearableItemsList->getSelectedUUIDs(selected_ids);
-
- if(!selected_ids.size()) return;
-
- mInventoryItemsPanel->clearSelection();
- LLFolderView* root = mInventoryItemsPanel->getRootFolder();
-
- if(!root) return;
-
- for(std::vector<LLUUID>::const_iterator item_id = selected_ids.begin(); item_id != selected_ids.end(); ++item_id)
- {
- LLFolderViewItem* item = mInventoryItemsPanel->getItemByID(*item_id);
- if (!item) continue;
-
- LLFolderViewFolder* parent = item->getParentFolder();
- if(parent)
- {
- parent->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
- }
- mInventoryItemsPanel->getRootFolder()->changeSelection(item, TRUE);
- }
- mInventoryItemsPanel->getRootFolder()->scrollToShowSelection();
- }
+ if(mWearablesListViewPanel->getVisible())
+ {
+ std::set<LLFolderViewItem*> selected_ids = mInventoryItemsPanel->getRootFolder()->getSelectionList();
+
+ if(!selected_ids.size()) return;
+
+ for (std::set<LLFolderViewItem*>::const_iterator item_id = selected_ids.begin(); item_id != selected_ids.end(); ++item_id)
+ {
+ mWearableItemsList->selectItemByUUID(static_cast<LLFolderViewModelItemInventory*>((*item_id)->getViewModelItem())->getUUID(), true);
+ }
+ mWearableItemsList->scrollToShowFirstSelectedItem();
+ }
+ else if(mInventoryItemsPanel->getVisible())
+ {
+ std::vector<LLUUID> selected_ids;
+ mWearableItemsList->getSelectedUUIDs(selected_ids);
+
+ if(!selected_ids.size()) return;
+
+ mInventoryItemsPanel->clearSelection();
+ LLFolderView* root = mInventoryItemsPanel->getRootFolder();
+
+ if(!root) return;
+
+ for(std::vector<LLUUID>::const_iterator item_id = selected_ids.begin(); item_id != selected_ids.end(); ++item_id)
+ {
+ LLFolderViewItem* item = mInventoryItemsPanel->getItemByID(*item_id);
+ if (!item) continue;
+
+ LLFolderViewFolder* parent = item->getParentFolder();
+ if(parent)
+ {
+ parent->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ }
+ mInventoryItemsPanel->getRootFolder()->changeSelection(item, TRUE);
+ }
+ mInventoryItemsPanel->getRootFolder()->scrollToShowSelection();
+ }
}
void LLPanelOutfitEdit::saveOutfit(bool as_new)
{
- LLPanelOutfitsInventory* panel_outfits_inventory = LLPanelOutfitsInventory::findInstance();
- if (panel_outfits_inventory)
- {
- panel_outfits_inventory->saveOutfit(as_new);
- }
+ LLPanelOutfitsInventory* panel_outfits_inventory = LLPanelOutfitsInventory::findInstance();
+ if (panel_outfits_inventory)
+ {
+ panel_outfits_inventory->saveOutfit(as_new);
+ }
}
// EOF
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index d0597fb72b..ba1b69a5d7 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpaneloutfitedit.h
* @brief Displays outfit edit information in Side Tray.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -62,183 +62,183 @@ class LLWearableItemTypeNameComparator;
class LLPanelOutfitEdit : public LLPanel
{
- LOG_CLASS(LLPanelOutfitEdit);
+ LOG_CLASS(LLPanelOutfitEdit);
public:
-
- // NOTE: initialize mFolderViewItemTypes at the index of any new enum you add in the LLPanelOutfitEdit() constructor
- typedef enum e_folder_view_item_type
- {
- FVIT_ALL = 0,
- FVIT_WEARABLE, // clothing or shape
- FVIT_ATTACHMENT,
- NUM_FOLDER_VIEW_ITEM_TYPES
- } EFolderViewItemType;
-
- //should reflect order from LLWearableType::EType
- typedef enum e_list_view_item_type
- {
- LVIT_ALL = 0,
- LVIT_CLOTHING,
- LVIT_BODYPART,
- LVIT_ATTACHMENT,
- LVIT_SHAPE,
- LVIT_SKIN,
- LVIT_HAIR,
- LVIT_EYES,
- LVIT_SHIRT,
- LVIT_PANTS,
- LVIT_SHOES,
- LVIT_SOCKS,
- LVIT_JACKET,
- LVIT_GLOVES,
- LVIT_UNDERSHIRT,
- LVIT_UNDERPANTS,
- LVIT_SKIRT,
- LVIT_ALPHA,
- LVIT_TATTOO,
- LVIT_PHYSICS,
- LVIT_UNIVERSAL,
- NUM_LIST_VIEW_ITEM_TYPES
- } EListViewItemType;
-
- struct LLLookItemType {
- std::string displayName;
- U64 inventoryMask;
- LLLookItemType() : displayName("NONE"), inventoryMask(0) {}
- LLLookItemType(std::string name, U64 mask) : displayName(name), inventoryMask(mask) {}
- };
-
- struct LLFilterItem {
- std::string displayName;
- LLInventoryCollectFunctor* collector;
- LLFilterItem() : displayName("NONE"), collector(NULL) {}
- LLFilterItem(std::string name, LLInventoryCollectFunctor* _collector) : displayName(name), collector(_collector) {}
- ~LLFilterItem() { delete collector; }
-
- //the struct is not supposed to by copied, either way the destructor kills collector
- //LLPointer is not used as it requires LLInventoryCollectFunctor to extend LLRefCount what it doesn't do
- private:
- LLFilterItem(const LLFilterItem& filter_item) {};
- };
-
- LLPanelOutfitEdit();
- /*virtual*/ ~LLPanelOutfitEdit();
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
-
- void moveWearable(bool closer_to_body);
-
- void toggleAddWearablesPanel();
- void showAddWearablesPanel(bool show__add_wearables);
-
- //following methods operate with "add wearables" panel
- void showWearablesFilter();
- void showWearablesListView();
- void showWearablesFolderView();
-
- void updateFiltersVisibility();
-
- void onFolderViewFilterCommitted(LLUICtrl* ctrl);
- void onListViewFilterCommitted(LLUICtrl* ctrl);
- void onSearchEdit(const std::string& string);
- void updatePlusButton();
- void onPlusBtnClicked(void);
-
- void onVisibilityChanged(const LLSD &in_visible_chain);
-
- void applyFolderViewFilter(EFolderViewItemType type);
- void applyListViewFilter(EListViewItemType type);
-
- /**
- * Filter items in views of Add Wearables Panel and show appropriate view depending on currently selected COF item(s)
- * No COF items selected - shows the folder view, reset filter
- * 1 COF item selected - shows the list view and filters wearables there by a wearable type of the selected item
- * More than 1 COF item selected - shows the list view and filters it by a type of the selected item (attachment or clothing)
- */
- void filterWearablesBySelectedItem(void);
-
- void onRemoveFromOutfitClicked(void);
- void onEditWearableClicked(void);
- void onAddWearableClicked(void);
- void onReplaceMenuItemClicked(LLUUID selected_item_id);
- void onShopButtonClicked();
-
- void displayCurrentOutfit();
- void updateCurrentOutfitName();
-
- void update();
-
- void updateVerbs();
- /**
- * @brief Helper function. Shows one panel instead of another.
- * If panels already switched does nothing and returns false.
- * @param switch_from_panel panel to hide
- * @param switch_to_panel panel to show
- * @retun returns true if switching happened, false if not.
- */
- bool switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel);
-
- void resetAccordionState();
-
- virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
+
+ // NOTE: initialize mFolderViewItemTypes at the index of any new enum you add in the LLPanelOutfitEdit() constructor
+ typedef enum e_folder_view_item_type
+ {
+ FVIT_ALL = 0,
+ FVIT_WEARABLE, // clothing or shape
+ FVIT_ATTACHMENT,
+ NUM_FOLDER_VIEW_ITEM_TYPES
+ } EFolderViewItemType;
+
+ //should reflect order from LLWearableType::EType
+ typedef enum e_list_view_item_type
+ {
+ LVIT_ALL = 0,
+ LVIT_CLOTHING,
+ LVIT_BODYPART,
+ LVIT_ATTACHMENT,
+ LVIT_SHAPE,
+ LVIT_SKIN,
+ LVIT_HAIR,
+ LVIT_EYES,
+ LVIT_SHIRT,
+ LVIT_PANTS,
+ LVIT_SHOES,
+ LVIT_SOCKS,
+ LVIT_JACKET,
+ LVIT_GLOVES,
+ LVIT_UNDERSHIRT,
+ LVIT_UNDERPANTS,
+ LVIT_SKIRT,
+ LVIT_ALPHA,
+ LVIT_TATTOO,
+ LVIT_PHYSICS,
+ LVIT_UNIVERSAL,
+ NUM_LIST_VIEW_ITEM_TYPES
+ } EListViewItemType;
+
+ struct LLLookItemType {
+ std::string displayName;
+ U64 inventoryMask;
+ LLLookItemType() : displayName("NONE"), inventoryMask(0) {}
+ LLLookItemType(std::string name, U64 mask) : displayName(name), inventoryMask(mask) {}
+ };
+
+ struct LLFilterItem {
+ std::string displayName;
+ LLInventoryCollectFunctor* collector;
+ LLFilterItem() : displayName("NONE"), collector(NULL) {}
+ LLFilterItem(std::string name, LLInventoryCollectFunctor* _collector) : displayName(name), collector(_collector) {}
+ ~LLFilterItem() { delete collector; }
+
+ //the struct is not supposed to by copied, either way the destructor kills collector
+ //LLPointer is not used as it requires LLInventoryCollectFunctor to extend LLRefCount what it doesn't do
+ private:
+ LLFilterItem(const LLFilterItem& filter_item) {};
+ };
+
+ LLPanelOutfitEdit();
+ /*virtual*/ ~LLPanelOutfitEdit();
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ void moveWearable(bool closer_to_body);
+
+ void toggleAddWearablesPanel();
+ void showAddWearablesPanel(bool show__add_wearables);
+
+ //following methods operate with "add wearables" panel
+ void showWearablesFilter();
+ void showWearablesListView();
+ void showWearablesFolderView();
+
+ void updateFiltersVisibility();
+
+ void onFolderViewFilterCommitted(LLUICtrl* ctrl);
+ void onListViewFilterCommitted(LLUICtrl* ctrl);
+ void onSearchEdit(const std::string& string);
+ void updatePlusButton();
+ void onPlusBtnClicked(void);
+
+ void onVisibilityChanged(const LLSD &in_visible_chain);
+
+ void applyFolderViewFilter(EFolderViewItemType type);
+ void applyListViewFilter(EListViewItemType type);
+
+ /**
+ * Filter items in views of Add Wearables Panel and show appropriate view depending on currently selected COF item(s)
+ * No COF items selected - shows the folder view, reset filter
+ * 1 COF item selected - shows the list view and filters wearables there by a wearable type of the selected item
+ * More than 1 COF item selected - shows the list view and filters it by a type of the selected item (attachment or clothing)
+ */
+ void filterWearablesBySelectedItem(void);
+
+ void onRemoveFromOutfitClicked(void);
+ void onEditWearableClicked(void);
+ void onAddWearableClicked(void);
+ void onReplaceMenuItemClicked(LLUUID selected_item_id);
+ void onShopButtonClicked();
+
+ void displayCurrentOutfit();
+ void updateCurrentOutfitName();
+
+ void update();
+
+ void updateVerbs();
+ /**
+ * @brief Helper function. Shows one panel instead of another.
+ * If panels already switched does nothing and returns false.
+ * @param switch_from_panel panel to hide
+ * @param switch_to_panel panel to show
+ * @retun returns true if switching happened, false if not.
+ */
+ bool switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel);
+
+ void resetAccordionState();
+
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
private:
- void onAddMoreButtonClicked();
- void showFilteredWearablesListView(LLWearableType::EType type);
- void onOutfitChanging(bool started);
- void getSelectedItemsUUID(uuid_vec_t& uuid_list);
- void getCurrentItemUUID(LLUUID& selected_id);
- void onCOFChanged();
- void saveOutfit(bool as_new = false);
-
- /**
- * Method preserves selection while switching between folder/list view modes
- */
- void saveListSelection();
-
- void updateWearablesPanelVerbButtons();
-
- typedef std::pair<LLWearableType::EType, size_t> selection_info_t;
-
- LLWearableType::EType getCOFWearablesSelectionType() const;
- selection_info_t getAddMorePanelSelectionType() const;
- LLWearableType::EType getWearableTypeByItemUUID(const LLUUID& item_uuid) const;
-
- LLTextBox* mCurrentOutfitName;
- LLTextBox* mStatus;
- LLInventoryPanel* mInventoryItemsPanel;
- LLFilterEditor* mSearchFilter;
- LLSaveFolderState* mSavedFolderState;
- std::string mSearchString;
- LLButton* mFolderViewBtn;
- LLButton* mListViewBtn;
- LLButton* mPlusBtn;
- LLPanel* mAddWearablesPanel;
-
- LLComboBox* mFolderViewFilterCmbBox;
- LLComboBox* mListViewFilterCmbBox;
-
- LLFilteredWearableListManager* mWearableListManager;
- LLWearableItemsList* mWearableItemsList;
- LLPanel* mWearablesListViewPanel;
- LLWearableItemTypeNameComparator* mWearableListViewItemsComparator;
-
- LLCOFDragAndDropObserver* mCOFDragAndDropObserver;
-
- std::vector<LLLookItemType> mFolderViewItemTypes;
- std::vector<LLFilterItem*> mListViewItemTypes;
-
- LLCOFWearables* mCOFWearables;
- LLToggleableMenu* mGearMenu;
- LLToggleableMenu* mAddWearablesGearMenu;
- bool mInitialized;
- LLMenuButton* mWearablesGearMenuBtn;
- LLMenuButton* mGearMenuBtn;
+ void onAddMoreButtonClicked();
+ void showFilteredWearablesListView(LLWearableType::EType type);
+ void onOutfitChanging(bool started);
+ void getSelectedItemsUUID(uuid_vec_t& uuid_list);
+ void getCurrentItemUUID(LLUUID& selected_id);
+ void onCOFChanged();
+ void saveOutfit(bool as_new = false);
+
+ /**
+ * Method preserves selection while switching between folder/list view modes
+ */
+ void saveListSelection();
+
+ void updateWearablesPanelVerbButtons();
+
+ typedef std::pair<LLWearableType::EType, size_t> selection_info_t;
+
+ LLWearableType::EType getCOFWearablesSelectionType() const;
+ selection_info_t getAddMorePanelSelectionType() const;
+ LLWearableType::EType getWearableTypeByItemUUID(const LLUUID& item_uuid) const;
+
+ LLTextBox* mCurrentOutfitName;
+ LLTextBox* mStatus;
+ LLInventoryPanel* mInventoryItemsPanel;
+ LLFilterEditor* mSearchFilter;
+ LLSaveFolderState* mSavedFolderState;
+ std::string mSearchString;
+ LLButton* mFolderViewBtn;
+ LLButton* mListViewBtn;
+ LLButton* mPlusBtn;
+ LLPanel* mAddWearablesPanel;
+
+ LLComboBox* mFolderViewFilterCmbBox;
+ LLComboBox* mListViewFilterCmbBox;
+
+ LLFilteredWearableListManager* mWearableListManager;
+ LLWearableItemsList* mWearableItemsList;
+ LLPanel* mWearablesListViewPanel;
+ LLWearableItemTypeNameComparator* mWearableListViewItemsComparator;
+
+ LLCOFDragAndDropObserver* mCOFDragAndDropObserver;
+
+ std::vector<LLLookItemType> mFolderViewItemTypes;
+ std::vector<LLFilterItem*> mListViewItemTypes;
+
+ LLCOFWearables* mCOFWearables;
+ LLToggleableMenu* mGearMenu;
+ LLToggleableMenu* mAddWearablesGearMenu;
+ bool mInitialized;
+ LLMenuButton* mWearablesGearMenuBtn;
+ LLMenuButton* mGearMenuBtn;
};
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index af06de379d..edeeb93560 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,110 +54,110 @@ static const std::string SAVE_BTN("save_btn");
static LLPanelInjector<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
- mMyOutfitsPanel(NULL),
- mCurrentOutfitPanel(NULL),
- mActivePanel(NULL),
- mAppearanceTabs(NULL),
- mInitialized(false)
+ mMyOutfitsPanel(NULL),
+ mCurrentOutfitPanel(NULL),
+ mActivePanel(NULL),
+ mAppearanceTabs(NULL),
+ mInitialized(false)
{
- gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoaded, this));
- gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoading, this));
+ gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoaded, this));
+ gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoading, this));
- LLOutfitObserver& observer = LLOutfitObserver::instance();
- observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
- observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
- observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
+ LLOutfitObserver& observer = LLOutfitObserver::instance();
+ observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
+ observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
+ observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
}
LLPanelOutfitsInventory::~LLPanelOutfitsInventory()
{
- if (mAppearanceTabs && mInitialized)
- {
- gSavedSettings.setS32("LastAppearanceTab", mAppearanceTabs->getCurrentPanelIndex());
- }
+ if (mAppearanceTabs && mInitialized)
+ {
+ gSavedSettings.setS32("LastAppearanceTab", mAppearanceTabs->getCurrentPanelIndex());
+ }
}
// virtual
BOOL LLPanelOutfitsInventory::postBuild()
{
- initTabPanels();
- initListCommandsHandlers();
+ initTabPanels();
+ initListCommandsHandlers();
- // Fetch your outfits folder so that the links are in memory.
- // ( This is only necessary if we want to show a warning if a user deletes an item that has a
- // a link in an outfit, see "ConfirmItemDeleteHasLinks". )
+ // Fetch your outfits folder so that the links are in memory.
+ // ( This is only necessary if we want to show a warning if a user deletes an item that has a
+ // a link in an outfit, see "ConfirmItemDeleteHasLinks". )
- const LLUUID &outfits_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
- if (outfits_cat.notNull())
- {
- LLInventoryModelBackgroundFetch::instance().start(outfits_cat);
- }
+ const LLUUID &outfits_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+ if (outfits_cat.notNull())
+ {
+ LLInventoryModelBackgroundFetch::instance().start(outfits_cat);
+ }
- getChild<LLButton>(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::saveOutfit, this, false));
- getChild<LLButton>(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::saveOutfit, this, true));
+ getChild<LLButton>(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::saveOutfit, this, false));
+ getChild<LLButton>(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::saveOutfit, this, true));
- return TRUE;
+ return TRUE;
}
// virtual
void LLPanelOutfitsInventory::onOpen(const LLSD& key)
{
- if (!mInitialized)
- {
- LLSidepanelAppearance* panel_appearance = getAppearanceSP();
- if (panel_appearance)
- {
- // *TODO: move these methods to LLPanelOutfitsInventory?
- panel_appearance->fetchInventory();
- panel_appearance->refreshCurrentOutfitName();
- }
-
- if (!mAppearanceTabs->selectTab(gSavedSettings.getS32("LastAppearanceTab")))
- mAppearanceTabs->selectFirstTab();
-
- mInitialized = true;
- }
-
- // Make sure we know which tab is selected, update the filter,
- // and update verbs.
- onTabChange();
-
- // *TODO: Auto open the first outfit newly created so new users can see sample outfit contents
- /*
- static bool should_open_outfit = true;
- if (should_open_outfit && gAgent.isFirstLogin())
- {
- LLInventoryPanel* outfits_panel = getChild<LLInventoryPanel>(OUTFITS_TAB_NAME);
- if (outfits_panel)
- {
- LLUUID my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
- LLFolderViewFolder* my_outfits_folder = outfits_panel->getRootFolder()->getFolderByID(my_outfits_id);
- if (my_outfits_folder)
- {
- LLFolderViewFolder* first_outfit = dynamic_cast<LLFolderViewFolder*>(my_outfits_folder->getFirstChild());
- if (first_outfit)
- {
- first_outfit->setOpen(TRUE);
- }
- }
- }
- }
- should_open_outfit = false;
- */
+ if (!mInitialized)
+ {
+ LLSidepanelAppearance* panel_appearance = getAppearanceSP();
+ if (panel_appearance)
+ {
+ // *TODO: move these methods to LLPanelOutfitsInventory?
+ panel_appearance->fetchInventory();
+ panel_appearance->refreshCurrentOutfitName();
+ }
+
+ if (!mAppearanceTabs->selectTab(gSavedSettings.getS32("LastAppearanceTab")))
+ mAppearanceTabs->selectFirstTab();
+
+ mInitialized = true;
+ }
+
+ // Make sure we know which tab is selected, update the filter,
+ // and update verbs.
+ onTabChange();
+
+ // *TODO: Auto open the first outfit newly created so new users can see sample outfit contents
+ /*
+ static bool should_open_outfit = true;
+ if (should_open_outfit && gAgent.isFirstLogin())
+ {
+ LLInventoryPanel* outfits_panel = getChild<LLInventoryPanel>(OUTFITS_TAB_NAME);
+ if (outfits_panel)
+ {
+ LLUUID my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+ LLFolderViewFolder* my_outfits_folder = outfits_panel->getRootFolder()->getFolderByID(my_outfits_id);
+ if (my_outfits_folder)
+ {
+ LLFolderViewFolder* first_outfit = dynamic_cast<LLFolderViewFolder*>(my_outfits_folder->getFirstChild());
+ if (first_outfit)
+ {
+ first_outfit->setOpen(TRUE);
+ }
+ }
+ }
+ }
+ should_open_outfit = false;
+ */
}
void LLPanelOutfitsInventory::updateVerbs()
{
- if (mListCommands)
- {
- updateListCommands();
- }
+ if (mListCommands)
+ {
+ updateListCommands();
+ }
}
// virtual
void LLPanelOutfitsInventory::onSearchEdit(const std::string& string)
{
- if (!mActivePanel) return;
+ if (!mActivePanel) return;
if (!LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted())
{
@@ -165,79 +165,79 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string)
LLInventoryModelBackgroundFetch::instance().start();
}
- // set new filter string
- mActivePanel->setFilterSubString(string);
+ // set new filter string
+ mActivePanel->setFilterSubString(string);
}
void LLPanelOutfitsInventory::onWearButtonClick()
{
- if(isOutfitsListPanelActive())
- {
- if (mMyOutfitsPanel->hasItemSelected())
- {
- mMyOutfitsPanel->wearSelectedItems();
- }
- else
- {
- mMyOutfitsPanel->performAction("replaceoutfit");
- }
- }
- else if(isOutfitsGalleryPanelActive())
- {
- mOutfitGalleryPanel->wearSelectedOutfit();
- }
+ if(isOutfitsListPanelActive())
+ {
+ if (mMyOutfitsPanel->hasItemSelected())
+ {
+ mMyOutfitsPanel->wearSelectedItems();
+ }
+ else
+ {
+ mMyOutfitsPanel->performAction("replaceoutfit");
+ }
+ }
+ else if(isOutfitsGalleryPanelActive())
+ {
+ mOutfitGalleryPanel->wearSelectedOutfit();
+ }
}
bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- std::string outfit_name = response["message"].asString();
- LLStringUtil::trim(outfit_name);
- if( !outfit_name.empty() )
- {
- LLAppearanceMgr::getInstance()->makeNewOutfitLinks(outfit_name);
-
- LLSidepanelAppearance* panel_appearance = getAppearanceSP();
- if (panel_appearance)
- {
- panel_appearance->showOutfitsInventoryPanel();
- }
-
- if (mAppearanceTabs)
- {
- mAppearanceTabs->selectTabByName(OUTFITS_TAB_NAME);
- }
- }
- }
-
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ std::string outfit_name = response["message"].asString();
+ LLStringUtil::trim(outfit_name);
+ if( !outfit_name.empty() )
+ {
+ LLAppearanceMgr::getInstance()->makeNewOutfitLinks(outfit_name);
+
+ LLSidepanelAppearance* panel_appearance = getAppearanceSP();
+ if (panel_appearance)
+ {
+ panel_appearance->showOutfitsInventoryPanel();
+ }
+
+ if (mAppearanceTabs)
+ {
+ mAppearanceTabs->selectTabByName(OUTFITS_TAB_NAME);
+ }
+ }
+ }
+
+ return false;
}
void LLPanelOutfitsInventory::onSave()
{
- std::string outfit_name;
+ std::string outfit_name;
+
+ if (!LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
+ {
+ outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
+ }
- if (!LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
- {
- outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
- }
+ LLSD args;
+ args["DESC"] = outfit_name;
- LLSD args;
- args["DESC"] = outfit_name;
+ LLSD payload;
+ //payload["ids"].append(*it);
- LLSD payload;
- //payload["ids"].append(*it);
-
- LLNotificationsUtil::add("SaveOutfitAs", args, payload, boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1, _2));
+ LLNotificationsUtil::add("SaveOutfitAs", args, payload, boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1, _2));
}
//static
LLPanelOutfitsInventory* LLPanelOutfitsInventory::findInstance()
{
- return dynamic_cast<LLPanelOutfitsInventory*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfits_inventory"));
+ return dynamic_cast<LLPanelOutfitsInventory*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfits_inventory"));
}
void LLPanelOutfitsInventory::openApearanceTab(const std::string& tab_name)
@@ -251,43 +251,43 @@ void LLPanelOutfitsInventory::openApearanceTab(const std::string& tab_name)
void LLPanelOutfitsInventory::initListCommandsHandlers()
{
- mListCommands = getChild<LLPanel>("bottom_panel");
- mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
- mMyOutfitsPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
- mOutfitGalleryPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
+ mListCommands = getChild<LLPanel>("bottom_panel");
+ mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
+ mMyOutfitsPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
+ mOutfitGalleryPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
}
void LLPanelOutfitsInventory::updateListCommands()
{
- bool trash_enabled = isActionEnabled("delete");
- bool wear_enabled = isActionEnabled("wear");
- bool wear_visible = !isCOFPanelActive();
- bool make_outfit_enabled = isActionEnabled("save_outfit");
-
- LLButton* wear_btn = mListCommands->getChild<LLButton>("wear_btn");
- mMyOutfitsPanel->childSetEnabled("trash_btn", trash_enabled);
- mOutfitGalleryPanel->childSetEnabled("trash_btn", trash_enabled);
- wear_btn->setEnabled(wear_enabled);
- wear_btn->setVisible(wear_visible);
- getChild<LLButton>(SAVE_BTN)->setEnabled(make_outfit_enabled);
- wear_btn->setToolTip(getString((!isOutfitsGalleryPanelActive() && mMyOutfitsPanel->hasItemSelected()) ? "wear_items_tooltip" : "wear_outfit_tooltip"));
+ bool trash_enabled = isActionEnabled("delete");
+ bool wear_enabled = isActionEnabled("wear");
+ bool wear_visible = !isCOFPanelActive();
+ bool make_outfit_enabled = isActionEnabled("save_outfit");
+
+ LLButton* wear_btn = mListCommands->getChild<LLButton>("wear_btn");
+ mMyOutfitsPanel->childSetEnabled("trash_btn", trash_enabled);
+ mOutfitGalleryPanel->childSetEnabled("trash_btn", trash_enabled);
+ wear_btn->setEnabled(wear_enabled);
+ wear_btn->setVisible(wear_visible);
+ getChild<LLButton>(SAVE_BTN)->setEnabled(make_outfit_enabled);
+ wear_btn->setToolTip(getString((!isOutfitsGalleryPanelActive() && mMyOutfitsPanel->hasItemSelected()) ? "wear_items_tooltip" : "wear_outfit_tooltip"));
}
void LLPanelOutfitsInventory::onTrashButtonClick()
{
- if(isOutfitsListPanelActive())
- {
- mMyOutfitsPanel->removeSelected();
- }
- else if(isOutfitsGalleryPanelActive())
- {
- mOutfitGalleryPanel->removeSelected();
- }
+ if(isOutfitsListPanelActive())
+ {
+ mMyOutfitsPanel->removeSelected();
+ }
+ else if(isOutfitsGalleryPanelActive())
+ {
+ mOutfitGalleryPanel->removeSelected();
+ }
}
bool LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
{
- return mActivePanel && mActivePanel->isActionEnabled(userdata);
+ return mActivePanel && mActivePanel->isActionEnabled(userdata);
}
// List Commands //
@@ -299,83 +299,83 @@ bool LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
void LLPanelOutfitsInventory::initTabPanels()
{
//TODO: Add LLOutfitGallery change callback
- mCurrentOutfitPanel = findChild<LLPanelWearing>(COF_TAB_NAME);
- mCurrentOutfitPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
+ mCurrentOutfitPanel = findChild<LLPanelWearing>(COF_TAB_NAME);
+ mCurrentOutfitPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
- mMyOutfitsPanel = findChild<LLOutfitsList>(OUTFITS_TAB_NAME);
- mMyOutfitsPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
+ mMyOutfitsPanel = findChild<LLOutfitsList>(OUTFITS_TAB_NAME);
+ mMyOutfitsPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
mOutfitGalleryPanel = findChild<LLOutfitGallery>(OUTFIT_GALLERY_TAB_NAME);
mOutfitGalleryPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this));
- mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs");
- mAppearanceTabs->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onTabChange, this));
+ mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs");
+ mAppearanceTabs->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onTabChange, this));
}
void LLPanelOutfitsInventory::onTabChange()
{
- if (!mAppearanceTabs) return;
- mActivePanel = dynamic_cast<LLPanelAppearanceTab*>(mAppearanceTabs->getCurrentPanel());
- if (!mActivePanel) return;
+ if (!mAppearanceTabs) return;
+ mActivePanel = dynamic_cast<LLPanelAppearanceTab*>(mAppearanceTabs->getCurrentPanel());
+ if (!mActivePanel) return;
- mActivePanel->checkFilterSubString();
- mActivePanel->onOpen(LLSD());
+ mActivePanel->checkFilterSubString();
+ mActivePanel->onOpen(LLSD());
- updateVerbs();
+ updateVerbs();
}
bool LLPanelOutfitsInventory::isCOFPanelActive() const
{
- if (!mActivePanel) return false;
+ if (!mActivePanel) return false;
- return mActivePanel->getName() == COF_TAB_NAME;
+ return mActivePanel->getName() == COF_TAB_NAME;
}
bool LLPanelOutfitsInventory::isOutfitsListPanelActive() const
{
- if (!mActivePanel) return false;
+ if (!mActivePanel) return false;
- return mActivePanel->getName() == OUTFITS_TAB_NAME;
+ return mActivePanel->getName() == OUTFITS_TAB_NAME;
}
bool LLPanelOutfitsInventory::isOutfitsGalleryPanelActive() const
{
- if (!mActivePanel) return false;
+ if (!mActivePanel) return false;
- return mActivePanel->getName() == OUTFIT_GALLERY_TAB_NAME;
+ return mActivePanel->getName() == OUTFIT_GALLERY_TAB_NAME;
}
void LLPanelOutfitsInventory::setWearablesLoading(bool val)
{
- updateVerbs();
+ updateVerbs();
}
void LLPanelOutfitsInventory::onWearablesLoaded()
{
- setWearablesLoading(false);
+ setWearablesLoading(false);
}
void LLPanelOutfitsInventory::onWearablesLoading()
{
- setWearablesLoading(true);
+ setWearablesLoading(true);
}
// static
LLSidepanelAppearance* LLPanelOutfitsInventory::getAppearanceSP()
{
- LLSidepanelAppearance* panel_appearance =
- dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::getPanel("appearance"));
- return panel_appearance;
+ LLSidepanelAppearance* panel_appearance =
+ dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::getPanel("appearance"));
+ return panel_appearance;
}
void LLPanelOutfitsInventory::saveOutfit(bool as_new)
{
- if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit())
- {
- // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved.
- // If updateBaseOutfit fails, ask for an outfit name anyways
- return;
- }
-
- onSave();
+ if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit())
+ {
+ // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved.
+ // If updateBaseOutfit fails, ask for an outfit name anyways
+ return;
+ }
+
+ onSave();
}
diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h
index 63f9f599f1..c858803ede 100644
--- a/indra/newview/llpaneloutfitsinventory.h
+++ b/indra/newview/llpaneloutfitsinventory.h
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,70 +41,70 @@ class LLTabContainer;
class LLPanelOutfitsInventory : public LLPanel
{
- LOG_CLASS(LLPanelOutfitsInventory);
+ LOG_CLASS(LLPanelOutfitsInventory);
public:
- LLPanelOutfitsInventory();
- virtual ~LLPanelOutfitsInventory();
+ LLPanelOutfitsInventory();
+ virtual ~LLPanelOutfitsInventory();
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ void onSearchEdit(const std::string& string);
+ void onSave();
+ void saveOutfit(bool as_new = false);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
-
- void onSearchEdit(const std::string& string);
- void onSave();
- void saveOutfit(bool as_new = false);
-
- bool onSaveCommit(const LLSD& notification, const LLSD& response);
+ bool onSaveCommit(const LLSD& notification, const LLSD& response);
- static LLSidepanelAppearance* getAppearanceSP();
+ static LLSidepanelAppearance* getAppearanceSP();
- static LLPanelOutfitsInventory* findInstance();
+ static LLPanelOutfitsInventory* findInstance();
- void openApearanceTab(const std::string& tab_name);
+ void openApearanceTab(const std::string& tab_name);
bool isCOFPanelActive() const;
protected:
- void updateVerbs();
+ void updateVerbs();
private:
- LLTabContainer* mAppearanceTabs;
+ LLTabContainer* mAppearanceTabs;
- //////////////////////////////////////////////////////////////////////////////////
- // tab panels //
+ //////////////////////////////////////////////////////////////////////////////////
+ // tab panels //
protected:
- void initTabPanels();
- void onTabChange();
- bool isOutfitsListPanelActive() const;
- bool isOutfitsGalleryPanelActive() const;
+ void initTabPanels();
+ void onTabChange();
+ bool isOutfitsListPanelActive() const;
+ bool isOutfitsGalleryPanelActive() const;
private:
- LLPanelAppearanceTab* mActivePanel;
- LLOutfitsList* mMyOutfitsPanel;
+ LLPanelAppearanceTab* mActivePanel;
+ LLOutfitsList* mMyOutfitsPanel;
LLOutfitGallery* mOutfitGalleryPanel;
- LLPanelWearing* mCurrentOutfitPanel;
+ LLPanelWearing* mCurrentOutfitPanel;
- // tab panels //
- //////////////////////////////////////////////////////////////////////////////////
+ // tab panels //
+ //////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////
- // List Commands //
+ //////////////////////////////////////////////////////////////////////////////////
+ // List Commands //
protected:
- void initListCommandsHandlers();
- void updateListCommands();
- void onWearButtonClick();
- void showGearMenu();
- void onTrashButtonClick();
- bool isActionEnabled(const LLSD& userdata);
- void setWearablesLoading(bool val);
- void onWearablesLoaded();
- void onWearablesLoading();
+ void initListCommandsHandlers();
+ void updateListCommands();
+ void onWearButtonClick();
+ void showGearMenu();
+ void onTrashButtonClick();
+ bool isActionEnabled(const LLSD& userdata);
+ void setWearablesLoading(bool val);
+ void onWearablesLoaded();
+ void onWearablesLoading();
private:
- LLPanel* mListCommands;
- LLMenuGL* mMenuAdd;
- // List Commands //
- //////////////////////////////////////////////////////////////////////////////////
+ LLPanel* mListCommands;
+ LLMenuGL* mMenuAdd;
+ // List Commands //
+ //////////////////////////////////////////////////////////////////////////////////
- bool mInitialized;
+ bool mInitialized;
};
#endif //LL_LLPANELOUTFITSINVENTORY_H
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 13b52e97c5..44e860837e 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelpeople.cpp
* @brief Side tray "People" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,7 +52,7 @@
#include "llavatarlist.h"
#include "llavatarlistitem.h"
#include "llavatarnamecache.h"
-#include "llcallingcard.h" // for LLAvatarTracker
+#include "llcallingcard.h" // for LLAvatarTracker
#include "llcallbacklist.h"
#include "llerror.h"
#include "llfloateravatarpicker.h"
@@ -65,8 +65,8 @@
#include "llparticipantlist.h"
#include "llsidetraypanelcontainer.h"
#include "llrecentpeople.h"
-#include "llviewercontrol.h" // for gSavedSettings
-#include "llviewermenu.h" // for gMenuHolder
+#include "llviewercontrol.h" // for gSavedSettings
+#include "llviewermenu.h" // for gMenuHolder
#include "llviewerregion.h"
#include "llvoiceclient.h"
#include "llworld.h"
@@ -76,165 +76,165 @@
#include "llagentui.h"
#include "llslurl.h"
-#define FRIEND_LIST_UPDATE_TIMEOUT 0.5
+#define FRIEND_LIST_UPDATE_TIMEOUT 0.5
#define NEARBY_LIST_UPDATE_INTERVAL 1
-static const std::string NEARBY_TAB_NAME = "nearby_panel";
-static const std::string FRIENDS_TAB_NAME = "friends_panel";
-static const std::string GROUP_TAB_NAME = "groups_panel";
-static const std::string RECENT_TAB_NAME = "recent_panel";
-static const std::string BLOCKED_TAB_NAME = "blocked_panel"; // blocked avatars
+static const std::string NEARBY_TAB_NAME = "nearby_panel";
+static const std::string FRIENDS_TAB_NAME = "friends_panel";
+static const std::string GROUP_TAB_NAME = "groups_panel";
+static const std::string RECENT_TAB_NAME = "recent_panel";
+static const std::string BLOCKED_TAB_NAME = "blocked_panel"; // blocked avatars
static const std::string COLLAPSED_BY_USER = "collapsed_by_user";
/** Comparator for comparing avatar items by last interaction date */
class LLAvatarItemRecentComparator : public LLAvatarItemComparator
{
public:
- LLAvatarItemRecentComparator() {};
- virtual ~LLAvatarItemRecentComparator() {};
+ LLAvatarItemRecentComparator() {};
+ virtual ~LLAvatarItemRecentComparator() {};
protected:
- virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const
- {
- LLRecentPeople& people = LLRecentPeople::instance();
- const LLDate& date1 = people.getDate(avatar_item1->getAvatarId());
- const LLDate& date2 = people.getDate(avatar_item2->getAvatarId());
-
- //older comes first
- return date1 > date2;
- }
+ virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const
+ {
+ LLRecentPeople& people = LLRecentPeople::instance();
+ const LLDate& date1 = people.getDate(avatar_item1->getAvatarId());
+ const LLDate& date2 = people.getDate(avatar_item2->getAvatarId());
+
+ //older comes first
+ return date1 > date2;
+ }
};
/** Compares avatar items by online status, then by name */
class LLAvatarItemStatusComparator : public LLAvatarItemComparator
{
public:
- LLAvatarItemStatusComparator() {};
+ LLAvatarItemStatusComparator() {};
protected:
- /**
- * @return true if item1 < item2, false otherwise
- */
- virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
- {
- LLAvatarTracker& at = LLAvatarTracker::instance();
- bool online1 = at.isBuddyOnline(item1->getAvatarId());
- bool online2 = at.isBuddyOnline(item2->getAvatarId());
-
- if (online1 == online2)
- {
- std::string name1 = item1->getAvatarName();
- std::string name2 = item2->getAvatarName();
-
- LLStringUtil::toUpper(name1);
- LLStringUtil::toUpper(name2);
-
- return name1 < name2;
- }
-
- return online1 > online2;
- }
+ /**
+ * @return true if item1 < item2, false otherwise
+ */
+ virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
+ {
+ LLAvatarTracker& at = LLAvatarTracker::instance();
+ bool online1 = at.isBuddyOnline(item1->getAvatarId());
+ bool online2 = at.isBuddyOnline(item2->getAvatarId());
+
+ if (online1 == online2)
+ {
+ std::string name1 = item1->getAvatarName();
+ std::string name2 = item2->getAvatarName();
+
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
+
+ return name1 < name2;
+ }
+
+ return online1 > online2;
+ }
};
/** Compares avatar items by distance between you and them */
class LLAvatarItemDistanceComparator : public LLAvatarItemComparator
{
public:
- typedef std::map < LLUUID, LLVector3d > id_to_pos_map_t;
- LLAvatarItemDistanceComparator() {};
+ typedef std::map < LLUUID, LLVector3d > id_to_pos_map_t;
+ LLAvatarItemDistanceComparator() {};
- void updateAvatarsPositions(std::vector<LLVector3d>& positions, uuid_vec_t& uuids)
- {
- std::vector<LLVector3d>::const_iterator
- pos_it = positions.begin(),
- pos_end = positions.end();
+ void updateAvatarsPositions(std::vector<LLVector3d>& positions, uuid_vec_t& uuids)
+ {
+ std::vector<LLVector3d>::const_iterator
+ pos_it = positions.begin(),
+ pos_end = positions.end();
- uuid_vec_t::const_iterator
- id_it = uuids.begin(),
- id_end = uuids.end();
+ uuid_vec_t::const_iterator
+ id_it = uuids.begin(),
+ id_end = uuids.end();
- LLAvatarItemDistanceComparator::id_to_pos_map_t pos_map;
+ LLAvatarItemDistanceComparator::id_to_pos_map_t pos_map;
- mAvatarsPositions.clear();
+ mAvatarsPositions.clear();
- for (;pos_it != pos_end && id_it != id_end; ++pos_it, ++id_it )
- {
- mAvatarsPositions[*id_it] = *pos_it;
- }
- };
+ for (;pos_it != pos_end && id_it != id_end; ++pos_it, ++id_it )
+ {
+ mAvatarsPositions[*id_it] = *pos_it;
+ }
+ };
protected:
- virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
- {
- const LLVector3d& me_pos = gAgent.getPositionGlobal();
- const LLVector3d& item1_pos = mAvatarsPositions.find(item1->getAvatarId())->second;
- const LLVector3d& item2_pos = mAvatarsPositions.find(item2->getAvatarId())->second;
-
- return dist_vec_squared(item1_pos, me_pos) < dist_vec_squared(item2_pos, me_pos);
- }
+ virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
+ {
+ const LLVector3d& me_pos = gAgent.getPositionGlobal();
+ const LLVector3d& item1_pos = mAvatarsPositions.find(item1->getAvatarId())->second;
+ const LLVector3d& item2_pos = mAvatarsPositions.find(item2->getAvatarId())->second;
+
+ return dist_vec_squared(item1_pos, me_pos) < dist_vec_squared(item2_pos, me_pos);
+ }
private:
- id_to_pos_map_t mAvatarsPositions;
+ id_to_pos_map_t mAvatarsPositions;
};
/** Comparator for comparing nearby avatar items by last spoken time */
class LLAvatarItemRecentSpeakerComparator : public LLAvatarItemNameComparator
{
public:
- LLAvatarItemRecentSpeakerComparator() {};
- virtual ~LLAvatarItemRecentSpeakerComparator() {};
+ LLAvatarItemRecentSpeakerComparator() {};
+ virtual ~LLAvatarItemRecentSpeakerComparator() {};
protected:
- virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
- {
- LLPointer<LLSpeaker> lhs = LLActiveSpeakerMgr::instance().findSpeaker(item1->getAvatarId());
- LLPointer<LLSpeaker> rhs = LLActiveSpeakerMgr::instance().findSpeaker(item2->getAvatarId());
- if ( lhs.notNull() && rhs.notNull() )
- {
- // Compare by last speaking time
- if( lhs->mLastSpokeTime != rhs->mLastSpokeTime )
- return ( lhs->mLastSpokeTime > rhs->mLastSpokeTime );
- }
- else if ( lhs.notNull() )
- {
- // True if only item1 speaker info available
- return true;
- }
- else if ( rhs.notNull() )
- {
- // False if only item2 speaker info available
- return false;
- }
- // By default compare by name.
- return LLAvatarItemNameComparator::doCompare(item1, item2);
- }
+ virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
+ {
+ LLPointer<LLSpeaker> lhs = LLActiveSpeakerMgr::instance().findSpeaker(item1->getAvatarId());
+ LLPointer<LLSpeaker> rhs = LLActiveSpeakerMgr::instance().findSpeaker(item2->getAvatarId());
+ if ( lhs.notNull() && rhs.notNull() )
+ {
+ // Compare by last speaking time
+ if( lhs->mLastSpokeTime != rhs->mLastSpokeTime )
+ return ( lhs->mLastSpokeTime > rhs->mLastSpokeTime );
+ }
+ else if ( lhs.notNull() )
+ {
+ // True if only item1 speaker info available
+ return true;
+ }
+ else if ( rhs.notNull() )
+ {
+ // False if only item2 speaker info available
+ return false;
+ }
+ // By default compare by name.
+ return LLAvatarItemNameComparator::doCompare(item1, item2);
+ }
};
class LLAvatarItemRecentArrivalComparator : public LLAvatarItemNameComparator
{
public:
- LLAvatarItemRecentArrivalComparator() {};
- virtual ~LLAvatarItemRecentArrivalComparator() {};
+ LLAvatarItemRecentArrivalComparator() {};
+ virtual ~LLAvatarItemRecentArrivalComparator() {};
protected:
- virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
- {
+ virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
+ {
- F32 arr_time1 = LLRecentPeople::instance().getArrivalTimeByID(item1->getAvatarId());
- F32 arr_time2 = LLRecentPeople::instance().getArrivalTimeByID(item2->getAvatarId());
+ F32 arr_time1 = LLRecentPeople::instance().getArrivalTimeByID(item1->getAvatarId());
+ F32 arr_time2 = LLRecentPeople::instance().getArrivalTimeByID(item2->getAvatarId());
- if (arr_time1 == arr_time2)
- {
- std::string name1 = item1->getAvatarName();
- std::string name2 = item2->getAvatarName();
+ if (arr_time1 == arr_time2)
+ {
+ std::string name1 = item1->getAvatarName();
+ std::string name2 = item2->getAvatarName();
- LLStringUtil::toUpper(name1);
- LLStringUtil::toUpper(name2);
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
- return name1 < name2;
- }
+ return name1 < name2;
+ }
- return arr_time1 > arr_time2;
- }
+ return arr_time1 > arr_time2;
+ }
};
static const LLAvatarItemRecentComparator RECENT_COMPARATOR;
@@ -248,35 +248,35 @@ static LLPanelInjector<LLPanelPeople> t_people("panel_people");
//=============================================================================
/**
- * Updates given list either on regular basis or on external events (up to implementation).
+ * Updates given list either on regular basis or on external events (up to implementation).
*/
class LLPanelPeople::Updater
{
public:
- typedef boost::function<void()> callback_t;
- Updater(callback_t cb)
- : mCallback(cb)
- {
- }
-
- virtual ~Updater()
- {
- }
-
- /**
- * Activate/deactivate updater.
- *
- * This may start/stop regular updates.
- */
- virtual void setActive(bool) {}
+ typedef boost::function<void()> callback_t;
+ Updater(callback_t cb)
+ : mCallback(cb)
+ {
+ }
+
+ virtual ~Updater()
+ {
+ }
+
+ /**
+ * Activate/deactivate updater.
+ *
+ * This may start/stop regular updates.
+ */
+ virtual void setActive(bool) {}
protected:
- void update()
- {
- mCallback();
- }
+ void update()
+ {
+ mCallback();
+ }
- callback_t mCallback;
+ callback_t mCallback;
};
/**
@@ -285,234 +285,234 @@ protected:
class LLButtonsUpdater : public LLPanelPeople::Updater, public LLFriendObserver
{
public:
- LLButtonsUpdater(callback_t cb)
- : LLPanelPeople::Updater(cb)
- {
- LLAvatarTracker::instance().addObserver(this);
- }
-
- ~LLButtonsUpdater()
- {
- LLAvatarTracker::instance().removeObserver(this);
- }
-
- /*virtual*/ void changed(U32 mask)
- {
- (void) mask;
- update();
- }
+ LLButtonsUpdater(callback_t cb)
+ : LLPanelPeople::Updater(cb)
+ {
+ LLAvatarTracker::instance().addObserver(this);
+ }
+
+ ~LLButtonsUpdater()
+ {
+ LLAvatarTracker::instance().removeObserver(this);
+ }
+
+ /*virtual*/ void changed(U32 mask)
+ {
+ (void) mask;
+ update();
+ }
};
class LLAvatarListUpdater : public LLPanelPeople::Updater, public LLEventTimer
{
public:
- LLAvatarListUpdater(callback_t cb, F32 period)
- : LLEventTimer(period),
- LLPanelPeople::Updater(cb)
- {
- mEventTimer.stop();
- }
-
- virtual BOOL tick() // from LLEventTimer
- {
- return FALSE;
- }
+ LLAvatarListUpdater(callback_t cb, F32 period)
+ : LLEventTimer(period),
+ LLPanelPeople::Updater(cb)
+ {
+ mEventTimer.stop();
+ }
+
+ virtual BOOL tick() // from LLEventTimer
+ {
+ return FALSE;
+ }
};
/**
* Updates the friends list.
- *
- * Updates the list on external events which trigger the changed() method.
+ *
+ * Updates the list on external events which trigger the changed() method.
*/
class LLFriendListUpdater : public LLAvatarListUpdater, public LLFriendObserver
{
- LOG_CLASS(LLFriendListUpdater);
- class LLInventoryFriendCardObserver;
-
-public:
- friend class LLInventoryFriendCardObserver;
- LLFriendListUpdater(callback_t cb)
- : LLAvatarListUpdater(cb, FRIEND_LIST_UPDATE_TIMEOUT)
- , mIsActive(false)
- {
- LLAvatarTracker::instance().addObserver(this);
-
- // For notification when SIP online status changes.
- LLVoiceClient::getInstance()->addObserver(this);
- mInvObserver = new LLInventoryFriendCardObserver(this);
- }
-
- ~LLFriendListUpdater()
- {
- // will be deleted by ~LLInventoryModel
- //delete mInvObserver;
+ LOG_CLASS(LLFriendListUpdater);
+ class LLInventoryFriendCardObserver;
+
+public:
+ friend class LLInventoryFriendCardObserver;
+ LLFriendListUpdater(callback_t cb)
+ : LLAvatarListUpdater(cb, FRIEND_LIST_UPDATE_TIMEOUT)
+ , mIsActive(false)
+ {
+ LLAvatarTracker::instance().addObserver(this);
+
+ // For notification when SIP online status changes.
+ LLVoiceClient::getInstance()->addObserver(this);
+ mInvObserver = new LLInventoryFriendCardObserver(this);
+ }
+
+ ~LLFriendListUpdater()
+ {
+ // will be deleted by ~LLInventoryModel
+ //delete mInvObserver;
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
- LLAvatarTracker::instance().removeObserver(this);
- }
-
- /*virtual*/ void changed(U32 mask)
- {
- if (mIsActive)
- {
- // events can arrive quickly in bulk - we need not process EVERY one of them -
- // so we wait a short while to let others pile-in, and process them in aggregate.
- mEventTimer.start();
- }
-
- // save-up all the mask-bits which have come-in
- mMask |= mask;
- }
-
-
- /*virtual*/ BOOL tick()
- {
- if (!mIsActive) return FALSE;
-
- if (mMask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE))
- {
- update();
- }
-
- // Stop updates.
- mEventTimer.stop();
- mMask = 0;
-
- return FALSE;
- }
-
- // virtual
- void setActive(bool active)
- {
- mIsActive = active;
- if (active)
- {
- tick();
- }
- }
+ LLAvatarTracker::instance().removeObserver(this);
+ }
+
+ /*virtual*/ void changed(U32 mask)
+ {
+ if (mIsActive)
+ {
+ // events can arrive quickly in bulk - we need not process EVERY one of them -
+ // so we wait a short while to let others pile-in, and process them in aggregate.
+ mEventTimer.start();
+ }
+
+ // save-up all the mask-bits which have come-in
+ mMask |= mask;
+ }
+
+
+ /*virtual*/ BOOL tick()
+ {
+ if (!mIsActive) return FALSE;
+
+ if (mMask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE))
+ {
+ update();
+ }
+
+ // Stop updates.
+ mEventTimer.stop();
+ mMask = 0;
+
+ return FALSE;
+ }
+
+ // virtual
+ void setActive(bool active)
+ {
+ mIsActive = active;
+ if (active)
+ {
+ tick();
+ }
+ }
private:
- U32 mMask;
- LLInventoryFriendCardObserver* mInvObserver;
- bool mIsActive;
-
- /**
- * This class is intended for updating Friend List when Inventory Friend Card is added/removed.
- *
- * The main usage is when Inventory Friends/All content is added while synchronizing with
- * friends list on startup is performed. In this case Friend Panel should be updated when
- * missing Inventory Friend Card is created.
- * *NOTE: updating is fired when Inventory item is added into CallingCards/Friends subfolder.
- * Otherwise LLFriendObserver functionality is enough to keep Friends Panel synchronized.
- */
- class LLInventoryFriendCardObserver : public LLInventoryObserver
- {
- LOG_CLASS(LLFriendListUpdater::LLInventoryFriendCardObserver);
-
- friend class LLFriendListUpdater;
-
- private:
- LLInventoryFriendCardObserver(LLFriendListUpdater* updater) : mUpdater(updater)
- {
- gInventory.addObserver(this);
- }
- ~LLInventoryFriendCardObserver()
- {
- gInventory.removeObserver(this);
- }
- /*virtual*/ void changed(U32 mask)
- {
- LL_DEBUGS() << "Inventory changed: " << mask << LL_ENDL;
-
- static bool synchronize_friends_folders = true;
- if (synchronize_friends_folders)
- {
- // Checks whether "Friends" and "Friends/All" folders exist in "Calling Cards" folder,
- // fetches their contents if needed and synchronizes it with buddies list.
- // If the folders are not found they are created.
- LLFriendCardsManager::instance().syncFriendCardsFolders();
- synchronize_friends_folders = false;
- }
-
- // *NOTE: deleting of InventoryItem is performed via moving to Trash.
- // That means LLInventoryObserver::STRUCTURE is present in MASK instead of LLInventoryObserver::REMOVE
- if ((CALLINGCARD_ADDED & mask) == CALLINGCARD_ADDED)
- {
- LL_DEBUGS() << "Calling card added: count: " << gInventory.getChangedIDs().size()
- << ", first Inventory ID: "<< (*gInventory.getChangedIDs().begin())
- << LL_ENDL;
-
- bool friendFound = false;
- std::set<LLUUID> changedIDs = gInventory.getChangedIDs();
- for (std::set<LLUUID>::const_iterator it = changedIDs.begin(); it != changedIDs.end(); ++it)
- {
- if (isDescendentOfInventoryFriends(*it))
- {
- friendFound = true;
- break;
- }
- }
-
- if (friendFound)
- {
- LL_DEBUGS() << "friend found, panel should be updated" << LL_ENDL;
- mUpdater->changed(LLFriendObserver::ADD);
- }
- }
- }
-
- bool isDescendentOfInventoryFriends(const LLUUID& invItemID)
- {
- LLViewerInventoryItem * item = gInventory.getItem(invItemID);
- if (NULL == item)
- return false;
-
- return LLFriendCardsManager::instance().isItemInAnyFriendsList(item);
- }
- LLFriendListUpdater* mUpdater;
-
- static const U32 CALLINGCARD_ADDED = LLInventoryObserver::ADD | LLInventoryObserver::CALLING_CARD;
- };
+ U32 mMask;
+ LLInventoryFriendCardObserver* mInvObserver;
+ bool mIsActive;
+
+ /**
+ * This class is intended for updating Friend List when Inventory Friend Card is added/removed.
+ *
+ * The main usage is when Inventory Friends/All content is added while synchronizing with
+ * friends list on startup is performed. In this case Friend Panel should be updated when
+ * missing Inventory Friend Card is created.
+ * *NOTE: updating is fired when Inventory item is added into CallingCards/Friends subfolder.
+ * Otherwise LLFriendObserver functionality is enough to keep Friends Panel synchronized.
+ */
+ class LLInventoryFriendCardObserver : public LLInventoryObserver
+ {
+ LOG_CLASS(LLFriendListUpdater::LLInventoryFriendCardObserver);
+
+ friend class LLFriendListUpdater;
+
+ private:
+ LLInventoryFriendCardObserver(LLFriendListUpdater* updater) : mUpdater(updater)
+ {
+ gInventory.addObserver(this);
+ }
+ ~LLInventoryFriendCardObserver()
+ {
+ gInventory.removeObserver(this);
+ }
+ /*virtual*/ void changed(U32 mask)
+ {
+ LL_DEBUGS() << "Inventory changed: " << mask << LL_ENDL;
+
+ static bool synchronize_friends_folders = true;
+ if (synchronize_friends_folders)
+ {
+ // Checks whether "Friends" and "Friends/All" folders exist in "Calling Cards" folder,
+ // fetches their contents if needed and synchronizes it with buddies list.
+ // If the folders are not found they are created.
+ LLFriendCardsManager::instance().syncFriendCardsFolders();
+ synchronize_friends_folders = false;
+ }
+
+ // *NOTE: deleting of InventoryItem is performed via moving to Trash.
+ // That means LLInventoryObserver::STRUCTURE is present in MASK instead of LLInventoryObserver::REMOVE
+ if ((CALLINGCARD_ADDED & mask) == CALLINGCARD_ADDED)
+ {
+ LL_DEBUGS() << "Calling card added: count: " << gInventory.getChangedIDs().size()
+ << ", first Inventory ID: "<< (*gInventory.getChangedIDs().begin())
+ << LL_ENDL;
+
+ bool friendFound = false;
+ std::set<LLUUID> changedIDs = gInventory.getChangedIDs();
+ for (std::set<LLUUID>::const_iterator it = changedIDs.begin(); it != changedIDs.end(); ++it)
+ {
+ if (isDescendentOfInventoryFriends(*it))
+ {
+ friendFound = true;
+ break;
+ }
+ }
+
+ if (friendFound)
+ {
+ LL_DEBUGS() << "friend found, panel should be updated" << LL_ENDL;
+ mUpdater->changed(LLFriendObserver::ADD);
+ }
+ }
+ }
+
+ bool isDescendentOfInventoryFriends(const LLUUID& invItemID)
+ {
+ LLViewerInventoryItem * item = gInventory.getItem(invItemID);
+ if (NULL == item)
+ return false;
+
+ return LLFriendCardsManager::instance().isItemInAnyFriendsList(item);
+ }
+ LLFriendListUpdater* mUpdater;
+
+ static const U32 CALLINGCARD_ADDED = LLInventoryObserver::ADD | LLInventoryObserver::CALLING_CARD;
+ };
};
/**
* Periodically updates the nearby people list while the Nearby tab is active.
- *
+ *
* The period is defined by NEARBY_LIST_UPDATE_INTERVAL constant.
*/
class LLNearbyListUpdater : public LLAvatarListUpdater
{
- LOG_CLASS(LLNearbyListUpdater);
+ LOG_CLASS(LLNearbyListUpdater);
public:
- LLNearbyListUpdater(callback_t cb)
- : LLAvatarListUpdater(cb, NEARBY_LIST_UPDATE_INTERVAL)
- {
- setActive(false);
- }
-
- /*virtual*/ void setActive(bool val)
- {
- if (val)
- {
- // update immediately and start regular updates
- update();
- mEventTimer.start();
- }
- else
- {
- // stop regular updates
- mEventTimer.stop();
- }
- }
-
- /*virtual*/ BOOL tick()
- {
- update();
- return FALSE;
- }
+ LLNearbyListUpdater(callback_t cb)
+ : LLAvatarListUpdater(cb, NEARBY_LIST_UPDATE_INTERVAL)
+ {
+ setActive(false);
+ }
+
+ /*virtual*/ void setActive(bool val)
+ {
+ if (val)
+ {
+ // update immediately and start regular updates
+ update();
+ mEventTimer.start();
+ }
+ else
+ {
+ // stop regular updates
+ mEventTimer.stop();
+ }
+ }
+
+ /*virtual*/ BOOL tick()
+ {
+ update();
+ return FALSE;
+ }
private:
};
@@ -521,83 +521,83 @@ private:
*/
class LLRecentListUpdater : public LLAvatarListUpdater, public boost::signals2::trackable
{
- LOG_CLASS(LLRecentListUpdater);
+ LOG_CLASS(LLRecentListUpdater);
public:
- LLRecentListUpdater(callback_t cb)
- : LLAvatarListUpdater(cb, 0)
- {
- LLRecentPeople::instance().setChangedCallback(boost::bind(&LLRecentListUpdater::update, this));
- }
+ LLRecentListUpdater(callback_t cb)
+ : LLAvatarListUpdater(cb, 0)
+ {
+ LLRecentPeople::instance().setChangedCallback(boost::bind(&LLRecentListUpdater::update, this));
+ }
};
//=============================================================================
LLPanelPeople::LLPanelPeople()
- : LLPanel(),
- mTabContainer(NULL),
- mOnlineFriendList(NULL),
- mAllFriendList(NULL),
- mNearbyList(NULL),
- mRecentList(NULL),
- mGroupList(NULL),
- mMiniMap(NULL)
+ : LLPanel(),
+ mTabContainer(NULL),
+ mOnlineFriendList(NULL),
+ mAllFriendList(NULL),
+ mNearbyList(NULL),
+ mRecentList(NULL),
+ mGroupList(NULL),
+ mMiniMap(NULL)
{
- mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList, this));
- mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList, this));
- mRecentListUpdater = new LLRecentListUpdater(boost::bind(&LLPanelPeople::updateRecentList, this));
- mButtonsUpdater = new LLButtonsUpdater(boost::bind(&LLPanelPeople::updateButtons, this));
-
- mCommitCallbackRegistrar.add("People.AddFriend", boost::bind(&LLPanelPeople::onAddFriendButtonClicked, this));
- mCommitCallbackRegistrar.add("People.AddFriendWizard", boost::bind(&LLPanelPeople::onAddFriendWizButtonClicked, this));
- mCommitCallbackRegistrar.add("People.DelFriend", boost::bind(&LLPanelPeople::onDeleteFriendButtonClicked, this));
- mCommitCallbackRegistrar.add("People.Group.Minus", boost::bind(&LLPanelPeople::onGroupMinusButtonClicked, this));
- mCommitCallbackRegistrar.add("People.Chat", boost::bind(&LLPanelPeople::onChatButtonClicked, this));
- mCommitCallbackRegistrar.add("People.Gear", boost::bind(&LLPanelPeople::onGearButtonClicked, this, _1));
-
- mCommitCallbackRegistrar.add("People.Group.Plus.Action", boost::bind(&LLPanelPeople::onGroupPlusMenuItemClicked, this, _2));
- mCommitCallbackRegistrar.add("People.Friends.ViewSort.Action", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemClicked, this, _2));
- mCommitCallbackRegistrar.add("People.Nearby.ViewSort.Action", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemClicked, this, _2));
- mCommitCallbackRegistrar.add("People.Groups.ViewSort.Action", boost::bind(&LLPanelPeople::onGroupsViewSortMenuItemClicked, this, _2));
- mCommitCallbackRegistrar.add("People.Recent.ViewSort.Action", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemClicked, this, _2));
-
- mEnableCallbackRegistrar.add("People.Friends.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemCheck, this, _2));
- mEnableCallbackRegistrar.add("People.Recent.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck, this, _2));
- mEnableCallbackRegistrar.add("People.Nearby.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemCheck, this, _2));
-
- mEnableCallbackRegistrar.add("People.Group.Plus.Validate", boost::bind(&LLPanelPeople::onGroupPlusButtonValidate, this));
-
- doPeriodically(boost::bind(&LLPanelPeople::updateNearbyArrivalTime, this), 2.0);
+ mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList, this));
+ mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList, this));
+ mRecentListUpdater = new LLRecentListUpdater(boost::bind(&LLPanelPeople::updateRecentList, this));
+ mButtonsUpdater = new LLButtonsUpdater(boost::bind(&LLPanelPeople::updateButtons, this));
+
+ mCommitCallbackRegistrar.add("People.AddFriend", boost::bind(&LLPanelPeople::onAddFriendButtonClicked, this));
+ mCommitCallbackRegistrar.add("People.AddFriendWizard", boost::bind(&LLPanelPeople::onAddFriendWizButtonClicked, this));
+ mCommitCallbackRegistrar.add("People.DelFriend", boost::bind(&LLPanelPeople::onDeleteFriendButtonClicked, this));
+ mCommitCallbackRegistrar.add("People.Group.Minus", boost::bind(&LLPanelPeople::onGroupMinusButtonClicked, this));
+ mCommitCallbackRegistrar.add("People.Chat", boost::bind(&LLPanelPeople::onChatButtonClicked, this));
+ mCommitCallbackRegistrar.add("People.Gear", boost::bind(&LLPanelPeople::onGearButtonClicked, this, _1));
+
+ mCommitCallbackRegistrar.add("People.Group.Plus.Action", boost::bind(&LLPanelPeople::onGroupPlusMenuItemClicked, this, _2));
+ mCommitCallbackRegistrar.add("People.Friends.ViewSort.Action", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemClicked, this, _2));
+ mCommitCallbackRegistrar.add("People.Nearby.ViewSort.Action", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemClicked, this, _2));
+ mCommitCallbackRegistrar.add("People.Groups.ViewSort.Action", boost::bind(&LLPanelPeople::onGroupsViewSortMenuItemClicked, this, _2));
+ mCommitCallbackRegistrar.add("People.Recent.ViewSort.Action", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemClicked, this, _2));
+
+ mEnableCallbackRegistrar.add("People.Friends.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemCheck, this, _2));
+ mEnableCallbackRegistrar.add("People.Recent.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck, this, _2));
+ mEnableCallbackRegistrar.add("People.Nearby.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemCheck, this, _2));
+
+ mEnableCallbackRegistrar.add("People.Group.Plus.Validate", boost::bind(&LLPanelPeople::onGroupPlusButtonValidate, this));
+
+ doPeriodically(boost::bind(&LLPanelPeople::updateNearbyArrivalTime, this), 2.0);
}
LLPanelPeople::~LLPanelPeople()
{
- delete mButtonsUpdater;
- delete mNearbyListUpdater;
- delete mFriendListUpdater;
- delete mRecentListUpdater;
-
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->removeObserver(this);
- }
+ delete mButtonsUpdater;
+ delete mNearbyListUpdater;
+ delete mFriendListUpdater;
+ delete mRecentListUpdater;
+
+ if(LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->removeObserver(this);
+ }
}
void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list)
{
- if(!avatar_list)
- {
- LL_ERRS() << "Bad parameter" << LL_ENDL;
- return;
- }
-
- bool expanded = param.asBoolean();
-
- setAccordionCollapsedByUser(ctrl, !expanded);
- if(!expanded)
- {
- avatar_list->resetSelection();
- }
+ if(!avatar_list)
+ {
+ LL_ERRS() << "Bad parameter" << LL_ENDL;
+ return;
+ }
+
+ bool expanded = param.asBoolean();
+
+ setAccordionCollapsedByUser(ctrl, !expanded);
+ if(!expanded)
+ {
+ avatar_list->resetSelection();
+ }
}
@@ -611,574 +611,574 @@ void LLPanelPeople::removePicker()
BOOL LLPanelPeople::postBuild()
{
- S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit();
-
- getChild<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
- getChild<LLFilterEditor>("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
- getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
- getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
-
- if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium)
- {
- getChild<LLTextBox>("groupcount")->setText(getString("GroupCountWithInfo"));
- getChild<LLTextBox>("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this));
- }
-
- mTabContainer = getChild<LLTabContainer>("tabs");
- mTabContainer->setCommitCallback(boost::bind(&LLPanelPeople::onTabSelected, this, _2));
- mSavedFilters.resize(mTabContainer->getTabCount());
- mSavedOriginalFilters.resize(mTabContainer->getTabCount());
-
- LLPanel* friends_tab = getChild<LLPanel>(FRIENDS_TAB_NAME);
- // updater is active only if panel is visible to user.
- friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2));
+ S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit();
+
+ getChild<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
+ getChild<LLFilterEditor>("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
+ getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
+ getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
+
+ if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium)
+ {
+ getChild<LLTextBox>("groupcount")->setText(getString("GroupCountWithInfo"));
+ getChild<LLTextBox>("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this));
+ }
+
+ mTabContainer = getChild<LLTabContainer>("tabs");
+ mTabContainer->setCommitCallback(boost::bind(&LLPanelPeople::onTabSelected, this, _2));
+ mSavedFilters.resize(mTabContainer->getTabCount());
+ mSavedOriginalFilters.resize(mTabContainer->getTabCount());
+
+ LLPanel* friends_tab = getChild<LLPanel>(FRIENDS_TAB_NAME);
+ // updater is active only if panel is visible to user.
+ friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2));
friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::removePicker, this));
- mOnlineFriendList = friends_tab->getChild<LLAvatarList>("avatars_online");
- mAllFriendList = friends_tab->getChild<LLAvatarList>("avatars_all");
- mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online"));
- mOnlineFriendList->setShowIcons("FriendsListShowIcons");
- mOnlineFriendList->showPermissions("FriendsListShowPermissions");
- mOnlineFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames"));
- mAllFriendList->setNoItemsCommentText(getString("no_friends"));
- mAllFriendList->setShowIcons("FriendsListShowIcons");
- mAllFriendList->showPermissions("FriendsListShowPermissions");
- mAllFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames"));
-
- LLPanel* nearby_tab = getChild<LLPanel>(NEARBY_TAB_NAME);
- nearby_tab->setVisibleCallback(boost::bind(&Updater::setActive, mNearbyListUpdater, _2));
- mNearbyList = nearby_tab->getChild<LLAvatarList>("avatar_list");
- mNearbyList->setNoItemsCommentText(getString("no_one_near"));
- mNearbyList->setNoItemsMsg(getString("no_one_near"));
- mNearbyList->setNoFilteredItemsMsg(getString("no_one_filtered_near"));
- mNearbyList->setShowIcons("NearbyListShowIcons");
- mNearbyList->setShowCompleteName(!gSavedSettings.getBOOL("NearbyListHideUsernames"));
- mMiniMap = (LLNetMap*)getChildView("Net Map",true);
- mMiniMap->setToolTipMsg(gSavedSettings.getBOOL("DoubleClickTeleport") ?
- getString("AltMiniMapToolTipMsg") : getString("MiniMapToolTipMsg"));
-
- mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
- mRecentList->setNoItemsCommentText(getString("no_recent_people"));
- mRecentList->setNoItemsMsg(getString("no_recent_people"));
- mRecentList->setNoFilteredItemsMsg(getString("no_filtered_recent_people"));
- mRecentList->setShowIcons("RecentListShowIcons");
-
- mGroupList = getChild<LLGroupList>("group_list");
- mGroupList->setNoItemsCommentText(getString("no_groups_msg"));
- mGroupList->setNoItemsMsg(getString("no_groups_msg"));
- mGroupList->setNoFilteredItemsMsg(getString("no_filtered_groups_msg"));
-
- mNearbyList->setContextMenu(&LLPanelPeopleMenus::gNearbyPeopleContextMenu);
- mRecentList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
- mAllFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
- mOnlineFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
-
- setSortOrder(mRecentList, (ESortOrder)gSavedSettings.getU32("RecentPeopleSortOrder"), false);
- setSortOrder(mAllFriendList, (ESortOrder)gSavedSettings.getU32("FriendsSortOrder"), false);
- setSortOrder(mNearbyList, (ESortOrder)gSavedSettings.getU32("NearbyPeopleSortOrder"), false);
-
- mOnlineFriendList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
- mAllFriendList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
- mNearbyList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
- mRecentList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
-
- mOnlineFriendList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mOnlineFriendList));
- mAllFriendList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mAllFriendList));
- mNearbyList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mNearbyList));
- mRecentList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mRecentList));
-
- // Set openning IM as default on return action for avatar lists
- mOnlineFriendList->setReturnCallback(boost::bind(&LLPanelPeople::onImButtonClicked, this));
- mAllFriendList->setReturnCallback(boost::bind(&LLPanelPeople::onImButtonClicked, this));
- mNearbyList->setReturnCallback(boost::bind(&LLPanelPeople::onImButtonClicked, this));
- mRecentList->setReturnCallback(boost::bind(&LLPanelPeople::onImButtonClicked, this));
-
- mGroupList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onChatButtonClicked, this));
- mGroupList->setCommitCallback(boost::bind(&LLPanelPeople::updateButtons, this));
- mGroupList->setReturnCallback(boost::bind(&LLPanelPeople::onChatButtonClicked, this));
-
- LLMenuButton* groups_gear_btn = getChild<LLMenuButton>("groups_gear_btn");
-
- // Use the context menu of the Groups list for the Groups tab gear menu.
- LLToggleableMenu* groups_gear_menu = mGroupList->getContextMenu();
- if (groups_gear_menu)
- {
- groups_gear_btn->setMenu(groups_gear_menu, LLMenuButton::MP_BOTTOM_LEFT);
- }
- else
- {
- LL_WARNS() << "People->Groups list menu not found" << LL_ENDL;
- }
-
- LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all");
- accordion_tab->setDropDownStateChangedCallback(
- boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mAllFriendList));
-
- accordion_tab = getChild<LLAccordionCtrlTab>("tab_online");
- accordion_tab->setDropDownStateChangedCallback(
- boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mOnlineFriendList));
-
- // Must go after setting commit callback and initializing all pointers to children.
- mTabContainer->selectTabByName(NEARBY_TAB_NAME);
-
- LLVoiceClient::getInstance()->addObserver(this);
-
- // call this method in case some list is empty and buttons can be in inconsistent state
- updateButtons();
-
- mOnlineFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2));
- mAllFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2));
-
- return TRUE;
+ mOnlineFriendList = friends_tab->getChild<LLAvatarList>("avatars_online");
+ mAllFriendList = friends_tab->getChild<LLAvatarList>("avatars_all");
+ mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online"));
+ mOnlineFriendList->setShowIcons("FriendsListShowIcons");
+ mOnlineFriendList->showPermissions("FriendsListShowPermissions");
+ mOnlineFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames"));
+ mAllFriendList->setNoItemsCommentText(getString("no_friends"));
+ mAllFriendList->setShowIcons("FriendsListShowIcons");
+ mAllFriendList->showPermissions("FriendsListShowPermissions");
+ mAllFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames"));
+
+ LLPanel* nearby_tab = getChild<LLPanel>(NEARBY_TAB_NAME);
+ nearby_tab->setVisibleCallback(boost::bind(&Updater::setActive, mNearbyListUpdater, _2));
+ mNearbyList = nearby_tab->getChild<LLAvatarList>("avatar_list");
+ mNearbyList->setNoItemsCommentText(getString("no_one_near"));
+ mNearbyList->setNoItemsMsg(getString("no_one_near"));
+ mNearbyList->setNoFilteredItemsMsg(getString("no_one_filtered_near"));
+ mNearbyList->setShowIcons("NearbyListShowIcons");
+ mNearbyList->setShowCompleteName(!gSavedSettings.getBOOL("NearbyListHideUsernames"));
+ mMiniMap = (LLNetMap*)getChildView("Net Map",true);
+ mMiniMap->setToolTipMsg(gSavedSettings.getBOOL("DoubleClickTeleport") ?
+ getString("AltMiniMapToolTipMsg") : getString("MiniMapToolTipMsg"));
+
+ mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
+ mRecentList->setNoItemsCommentText(getString("no_recent_people"));
+ mRecentList->setNoItemsMsg(getString("no_recent_people"));
+ mRecentList->setNoFilteredItemsMsg(getString("no_filtered_recent_people"));
+ mRecentList->setShowIcons("RecentListShowIcons");
+
+ mGroupList = getChild<LLGroupList>("group_list");
+ mGroupList->setNoItemsCommentText(getString("no_groups_msg"));
+ mGroupList->setNoItemsMsg(getString("no_groups_msg"));
+ mGroupList->setNoFilteredItemsMsg(getString("no_filtered_groups_msg"));
+
+ mNearbyList->setContextMenu(&LLPanelPeopleMenus::gNearbyPeopleContextMenu);
+ mRecentList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
+ mAllFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
+ mOnlineFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
+
+ setSortOrder(mRecentList, (ESortOrder)gSavedSettings.getU32("RecentPeopleSortOrder"), false);
+ setSortOrder(mAllFriendList, (ESortOrder)gSavedSettings.getU32("FriendsSortOrder"), false);
+ setSortOrder(mNearbyList, (ESortOrder)gSavedSettings.getU32("NearbyPeopleSortOrder"), false);
+
+ mOnlineFriendList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
+ mAllFriendList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
+ mNearbyList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
+ mRecentList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
+
+ mOnlineFriendList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mOnlineFriendList));
+ mAllFriendList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mAllFriendList));
+ mNearbyList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mNearbyList));
+ mRecentList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mRecentList));
+
+ // Set openning IM as default on return action for avatar lists
+ mOnlineFriendList->setReturnCallback(boost::bind(&LLPanelPeople::onImButtonClicked, this));
+ mAllFriendList->setReturnCallback(boost::bind(&LLPanelPeople::onImButtonClicked, this));
+ mNearbyList->setReturnCallback(boost::bind(&LLPanelPeople::onImButtonClicked, this));
+ mRecentList->setReturnCallback(boost::bind(&LLPanelPeople::onImButtonClicked, this));
+
+ mGroupList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onChatButtonClicked, this));
+ mGroupList->setCommitCallback(boost::bind(&LLPanelPeople::updateButtons, this));
+ mGroupList->setReturnCallback(boost::bind(&LLPanelPeople::onChatButtonClicked, this));
+
+ LLMenuButton* groups_gear_btn = getChild<LLMenuButton>("groups_gear_btn");
+
+ // Use the context menu of the Groups list for the Groups tab gear menu.
+ LLToggleableMenu* groups_gear_menu = mGroupList->getContextMenu();
+ if (groups_gear_menu)
+ {
+ groups_gear_btn->setMenu(groups_gear_menu, LLMenuButton::MP_BOTTOM_LEFT);
+ }
+ else
+ {
+ LL_WARNS() << "People->Groups list menu not found" << LL_ENDL;
+ }
+
+ LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all");
+ accordion_tab->setDropDownStateChangedCallback(
+ boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mAllFriendList));
+
+ accordion_tab = getChild<LLAccordionCtrlTab>("tab_online");
+ accordion_tab->setDropDownStateChangedCallback(
+ boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mOnlineFriendList));
+
+ // Must go after setting commit callback and initializing all pointers to children.
+ mTabContainer->selectTabByName(NEARBY_TAB_NAME);
+
+ LLVoiceClient::getInstance()->addObserver(this);
+
+ // call this method in case some list is empty and buttons can be in inconsistent state
+ updateButtons();
+
+ mOnlineFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2));
+ mAllFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2));
+
+ return TRUE;
}
// virtual
void LLPanelPeople::onChange(EStatusType status, const std::string &channelURI, bool proximal)
{
- if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
- {
- return;
- }
-
- updateButtons();
+ if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
+ {
+ return;
+ }
+
+ updateButtons();
}
void LLPanelPeople::updateFriendListHelpText()
{
- // show special help text for just created account to help finding friends. EXT-4836
- static LLTextBox* no_friends_text = getChild<LLTextBox>("no_friends_help_text");
-
- // Seems sometimes all_friends can be empty because of issue with Inventory loading (clear cache, slow connection...)
- // So, lets check all lists to avoid overlapping the text with online list. See EXT-6448.
- bool any_friend_exists = mAllFriendList->filterHasMatches() || mOnlineFriendList->filterHasMatches();
- no_friends_text->setVisible(!any_friend_exists);
- if (no_friends_text->getVisible())
- {
- //update help text for empty lists
- const std::string& filter = mSavedOriginalFilters[mTabContainer->getCurrentPanelIndex()];
-
- std::string message_name = filter.empty() ? "no_friends_msg" : "no_filtered_friends_msg";
- LLStringUtil::format_map_t args;
- args["[SEARCH_TERM]"] = LLURI::escape(filter);
- no_friends_text->setText(getString(message_name, args));
- }
+ // show special help text for just created account to help finding friends. EXT-4836
+ static LLTextBox* no_friends_text = getChild<LLTextBox>("no_friends_help_text");
+
+ // Seems sometimes all_friends can be empty because of issue with Inventory loading (clear cache, slow connection...)
+ // So, lets check all lists to avoid overlapping the text with online list. See EXT-6448.
+ bool any_friend_exists = mAllFriendList->filterHasMatches() || mOnlineFriendList->filterHasMatches();
+ no_friends_text->setVisible(!any_friend_exists);
+ if (no_friends_text->getVisible())
+ {
+ //update help text for empty lists
+ const std::string& filter = mSavedOriginalFilters[mTabContainer->getCurrentPanelIndex()];
+
+ std::string message_name = filter.empty() ? "no_friends_msg" : "no_filtered_friends_msg";
+ LLStringUtil::format_map_t args;
+ args["[SEARCH_TERM]"] = LLURI::escape(filter);
+ no_friends_text->setText(getString(message_name, args));
+ }
}
void LLPanelPeople::updateFriendList()
{
- if (!mOnlineFriendList || !mAllFriendList)
- return;
-
- // get all buddies we know about
- const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
- LLAvatarTracker::buddy_map_t all_buddies;
- av_tracker.copyBuddyList(all_buddies);
-
- // save them to the online and all friends vectors
- uuid_vec_t& online_friendsp = mOnlineFriendList->getIDs();
- uuid_vec_t& all_friendsp = mAllFriendList->getIDs();
-
- all_friendsp.clear();
- online_friendsp.clear();
-
- uuid_vec_t buddies_uuids;
- LLAvatarTracker::buddy_map_t::const_iterator buddies_iter;
-
- // Fill the avatar list with friends UUIDs
- for (buddies_iter = all_buddies.begin(); buddies_iter != all_buddies.end(); ++buddies_iter)
- {
- buddies_uuids.push_back(buddies_iter->first);
- }
-
- if (buddies_uuids.size() > 0)
- {
- LL_DEBUGS() << "Friends added to the list: " << buddies_uuids.size() << LL_ENDL;
- all_friendsp = buddies_uuids;
- }
- else
- {
- LL_DEBUGS() << "No friends found" << LL_ENDL;
- }
-
- LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();
- for (; buddy_it != all_buddies.end(); ++buddy_it)
- {
- LLUUID buddy_id = buddy_it->first;
- if (av_tracker.isBuddyOnline(buddy_id))
- online_friendsp.push_back(buddy_id);
- }
-
- /*
- * Avatarlists will be hidden by showFriendsAccordionsIfNeeded(), if they do not have items.
- * But avatarlist can be updated only if it is visible @see LLAvatarList::draw();
- * So we need to do force update of lists to avoid inconsistency of data and view of avatarlist.
- */
- mOnlineFriendList->setDirty(true, !mOnlineFriendList->filterHasMatches());// do force update if list do NOT have items
- mAllFriendList->setDirty(true, !mAllFriendList->filterHasMatches());
- //update trash and other buttons according to a selected item
- updateButtons();
- showFriendsAccordionsIfNeeded();
+ if (!mOnlineFriendList || !mAllFriendList)
+ return;
+
+ // get all buddies we know about
+ const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
+ LLAvatarTracker::buddy_map_t all_buddies;
+ av_tracker.copyBuddyList(all_buddies);
+
+ // save them to the online and all friends vectors
+ uuid_vec_t& online_friendsp = mOnlineFriendList->getIDs();
+ uuid_vec_t& all_friendsp = mAllFriendList->getIDs();
+
+ all_friendsp.clear();
+ online_friendsp.clear();
+
+ uuid_vec_t buddies_uuids;
+ LLAvatarTracker::buddy_map_t::const_iterator buddies_iter;
+
+ // Fill the avatar list with friends UUIDs
+ for (buddies_iter = all_buddies.begin(); buddies_iter != all_buddies.end(); ++buddies_iter)
+ {
+ buddies_uuids.push_back(buddies_iter->first);
+ }
+
+ if (buddies_uuids.size() > 0)
+ {
+ LL_DEBUGS() << "Friends added to the list: " << buddies_uuids.size() << LL_ENDL;
+ all_friendsp = buddies_uuids;
+ }
+ else
+ {
+ LL_DEBUGS() << "No friends found" << LL_ENDL;
+ }
+
+ LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();
+ for (; buddy_it != all_buddies.end(); ++buddy_it)
+ {
+ LLUUID buddy_id = buddy_it->first;
+ if (av_tracker.isBuddyOnline(buddy_id))
+ online_friendsp.push_back(buddy_id);
+ }
+
+ /*
+ * Avatarlists will be hidden by showFriendsAccordionsIfNeeded(), if they do not have items.
+ * But avatarlist can be updated only if it is visible @see LLAvatarList::draw();
+ * So we need to do force update of lists to avoid inconsistency of data and view of avatarlist.
+ */
+ mOnlineFriendList->setDirty(true, !mOnlineFriendList->filterHasMatches());// do force update if list do NOT have items
+ mAllFriendList->setDirty(true, !mAllFriendList->filterHasMatches());
+ //update trash and other buttons according to a selected item
+ updateButtons();
+ showFriendsAccordionsIfNeeded();
}
void LLPanelPeople::updateNearbyList()
{
- if (!mNearbyList)
- return;
+ if (!mNearbyList)
+ return;
- std::vector<LLVector3d> positions;
+ std::vector<LLVector3d> positions;
- LLWorld::getInstance()->getAvatars(&mNearbyList->getIDs(), &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
- mNearbyList->setDirty();
+ LLWorld::getInstance()->getAvatars(&mNearbyList->getIDs(), &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
+ mNearbyList->setDirty();
- DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs());
- LLActiveSpeakerMgr::instance().update(TRUE);
+ DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs());
+ LLActiveSpeakerMgr::instance().update(TRUE);
}
void LLPanelPeople::updateRecentList()
{
- if (!mRecentList)
- return;
+ if (!mRecentList)
+ return;
- LLRecentPeople::instance().get(mRecentList->getIDs());
- mRecentList->setDirty();
+ LLRecentPeople::instance().get(mRecentList->getIDs());
+ mRecentList->setDirty();
}
void LLPanelPeople::updateButtons()
{
- std::string cur_tab = getActiveTabName();
- bool friends_tab_active = (cur_tab == FRIENDS_TAB_NAME);
- bool group_tab_active = (cur_tab == GROUP_TAB_NAME);
- //bool recent_tab_active = (cur_tab == RECENT_TAB_NAME);
- LLUUID selected_id;
-
- uuid_vec_t selected_uuids;
- getCurrentItemIDs(selected_uuids);
- bool item_selected = (selected_uuids.size() == 1);
- bool multiple_selected = (selected_uuids.size() >= 1);
-
- if (group_tab_active)
- {
- if (item_selected)
- {
- selected_id = mGroupList->getSelectedUUID();
- }
-
- LLPanel* groups_panel = mTabContainer->getCurrentPanel();
- groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected
-
- U32 groups_count = gAgent.mGroups.size();
- S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit();
- U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0;
- groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count));
- groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining));
- }
- else
- {
- bool is_friend = true;
- bool is_self = false;
- // Check whether selected avatar is our friend.
- if (item_selected)
- {
- selected_id = selected_uuids.front();
- is_friend = LLAvatarTracker::instance().getBuddyInfo(selected_id) != NULL;
- is_self = gAgent.getID() == selected_id;
- }
-
- LLPanel* cur_panel = mTabContainer->getCurrentPanel();
- if (cur_panel)
- {
- if (cur_panel->hasChild("add_friend_btn", TRUE))
- cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend && !is_self);
-
- if (friends_tab_active)
- {
- cur_panel->getChildView("friends_del_btn")->setEnabled(multiple_selected);
- }
-
- if (!group_tab_active)
- {
- cur_panel->getChildView("gear_btn")->setEnabled(multiple_selected);
- }
- }
- }
+ std::string cur_tab = getActiveTabName();
+ bool friends_tab_active = (cur_tab == FRIENDS_TAB_NAME);
+ bool group_tab_active = (cur_tab == GROUP_TAB_NAME);
+ //bool recent_tab_active = (cur_tab == RECENT_TAB_NAME);
+ LLUUID selected_id;
+
+ uuid_vec_t selected_uuids;
+ getCurrentItemIDs(selected_uuids);
+ bool item_selected = (selected_uuids.size() == 1);
+ bool multiple_selected = (selected_uuids.size() >= 1);
+
+ if (group_tab_active)
+ {
+ if (item_selected)
+ {
+ selected_id = mGroupList->getSelectedUUID();
+ }
+
+ LLPanel* groups_panel = mTabContainer->getCurrentPanel();
+ groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected
+
+ U32 groups_count = gAgent.mGroups.size();
+ S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit();
+ U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0;
+ groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count));
+ groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining));
+ }
+ else
+ {
+ bool is_friend = true;
+ bool is_self = false;
+ // Check whether selected avatar is our friend.
+ if (item_selected)
+ {
+ selected_id = selected_uuids.front();
+ is_friend = LLAvatarTracker::instance().getBuddyInfo(selected_id) != NULL;
+ is_self = gAgent.getID() == selected_id;
+ }
+
+ LLPanel* cur_panel = mTabContainer->getCurrentPanel();
+ if (cur_panel)
+ {
+ if (cur_panel->hasChild("add_friend_btn", TRUE))
+ cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend && !is_self);
+
+ if (friends_tab_active)
+ {
+ cur_panel->getChildView("friends_del_btn")->setEnabled(multiple_selected);
+ }
+
+ if (!group_tab_active)
+ {
+ cur_panel->getChildView("gear_btn")->setEnabled(multiple_selected);
+ }
+ }
+ }
}
std::string LLPanelPeople::getActiveTabName() const
{
- return mTabContainer->getCurrentPanel()->getName();
+ return mTabContainer->getCurrentPanel()->getName();
}
LLUUID LLPanelPeople::getCurrentItemID() const
{
- std::string cur_tab = getActiveTabName();
+ std::string cur_tab = getActiveTabName();
- if (cur_tab == FRIENDS_TAB_NAME) // this tab has two lists
- {
- LLUUID cur_online_friend;
+ if (cur_tab == FRIENDS_TAB_NAME) // this tab has two lists
+ {
+ LLUUID cur_online_friend;
- if ((cur_online_friend = mOnlineFriendList->getSelectedUUID()).notNull())
- return cur_online_friend;
+ if ((cur_online_friend = mOnlineFriendList->getSelectedUUID()).notNull())
+ return cur_online_friend;
- return mAllFriendList->getSelectedUUID();
- }
+ return mAllFriendList->getSelectedUUID();
+ }
- if (cur_tab == NEARBY_TAB_NAME)
- return mNearbyList->getSelectedUUID();
+ if (cur_tab == NEARBY_TAB_NAME)
+ return mNearbyList->getSelectedUUID();
- if (cur_tab == RECENT_TAB_NAME)
- return mRecentList->getSelectedUUID();
+ if (cur_tab == RECENT_TAB_NAME)
+ return mRecentList->getSelectedUUID();
- if (cur_tab == GROUP_TAB_NAME)
- return mGroupList->getSelectedUUID();
+ if (cur_tab == GROUP_TAB_NAME)
+ return mGroupList->getSelectedUUID();
- if (cur_tab == BLOCKED_TAB_NAME)
- return LLUUID::null; // FIXME?
+ if (cur_tab == BLOCKED_TAB_NAME)
+ return LLUUID::null; // FIXME?
- llassert(0 && "unknown tab selected");
- return LLUUID::null;
+ llassert(0 && "unknown tab selected");
+ return LLUUID::null;
}
void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
{
- std::string cur_tab = getActiveTabName();
-
- if (cur_tab == FRIENDS_TAB_NAME)
- {
- // friends tab has two lists
- mOnlineFriendList->getSelectedUUIDs(selected_uuids);
- mAllFriendList->getSelectedUUIDs(selected_uuids);
- }
- else if (cur_tab == NEARBY_TAB_NAME)
- mNearbyList->getSelectedUUIDs(selected_uuids);
- else if (cur_tab == RECENT_TAB_NAME)
- mRecentList->getSelectedUUIDs(selected_uuids);
- else if (cur_tab == GROUP_TAB_NAME)
- mGroupList->getSelectedUUIDs(selected_uuids);
- else if (cur_tab == BLOCKED_TAB_NAME)
- selected_uuids.clear(); // FIXME?
- else
- llassert(0 && "unknown tab selected");
+ std::string cur_tab = getActiveTabName();
+
+ if (cur_tab == FRIENDS_TAB_NAME)
+ {
+ // friends tab has two lists
+ mOnlineFriendList->getSelectedUUIDs(selected_uuids);
+ mAllFriendList->getSelectedUUIDs(selected_uuids);
+ }
+ else if (cur_tab == NEARBY_TAB_NAME)
+ mNearbyList->getSelectedUUIDs(selected_uuids);
+ else if (cur_tab == RECENT_TAB_NAME)
+ mRecentList->getSelectedUUIDs(selected_uuids);
+ else if (cur_tab == GROUP_TAB_NAME)
+ mGroupList->getSelectedUUIDs(selected_uuids);
+ else if (cur_tab == BLOCKED_TAB_NAME)
+ selected_uuids.clear(); // FIXME?
+ else
+ llassert(0 && "unknown tab selected");
}
void LLPanelPeople::showGroupMenu(LLMenuGL* menu)
{
- // Shows the menu at the top of the button bar.
-
- // Calculate its coordinates.
- // (assumes that groups panel is the current tab)
- LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel");
- LLPanel* parent_panel = mTabContainer->getCurrentPanel();
- menu->arrangeAndClear();
- S32 menu_height = menu->getRect().getHeight();
- S32 menu_x = -2; // *HACK: compensates HPAD in showPopup()
- S32 menu_y = bottom_panel->getRect().mTop + menu_height;
-
- // Actually show the menu.
- menu->buildDrawLabels();
- menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(parent_panel, menu, menu_x, menu_y);
+ // Shows the menu at the top of the button bar.
+
+ // Calculate its coordinates.
+ // (assumes that groups panel is the current tab)
+ LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel");
+ LLPanel* parent_panel = mTabContainer->getCurrentPanel();
+ menu->arrangeAndClear();
+ S32 menu_height = menu->getRect().getHeight();
+ S32 menu_x = -2; // *HACK: compensates HPAD in showPopup()
+ S32 menu_y = bottom_panel->getRect().mTop + menu_height;
+
+ // Actually show the menu.
+ menu->buildDrawLabels();
+ menu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(parent_panel, menu, menu_x, menu_y);
}
void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save)
{
- switch (order)
- {
- case E_SORT_BY_NAME:
- list->sortByName();
- break;
- case E_SORT_BY_STATUS:
- list->setComparator(&STATUS_COMPARATOR);
- list->sort();
- break;
- case E_SORT_BY_MOST_RECENT:
- list->setComparator(&RECENT_COMPARATOR);
- list->sort();
- break;
- case E_SORT_BY_RECENT_SPEAKERS:
- list->setComparator(&RECENT_SPEAKER_COMPARATOR);
- list->sort();
- break;
- case E_SORT_BY_DISTANCE:
- list->setComparator(&DISTANCE_COMPARATOR);
- list->sort();
- break;
- case E_SORT_BY_RECENT_ARRIVAL:
- list->setComparator(&RECENT_ARRIVAL_COMPARATOR);
- list->sort();
- break;
- default:
- LL_WARNS() << "Unrecognized people sort order for " << list->getName() << LL_ENDL;
- return;
- }
-
- if (save)
- {
- std::string setting;
-
- if (list == mAllFriendList || list == mOnlineFriendList)
- setting = "FriendsSortOrder";
- else if (list == mRecentList)
- setting = "RecentPeopleSortOrder";
- else if (list == mNearbyList)
- setting = "NearbyPeopleSortOrder";
-
- if (!setting.empty())
- gSavedSettings.setU32(setting, order);
- }
+ switch (order)
+ {
+ case E_SORT_BY_NAME:
+ list->sortByName();
+ break;
+ case E_SORT_BY_STATUS:
+ list->setComparator(&STATUS_COMPARATOR);
+ list->sort();
+ break;
+ case E_SORT_BY_MOST_RECENT:
+ list->setComparator(&RECENT_COMPARATOR);
+ list->sort();
+ break;
+ case E_SORT_BY_RECENT_SPEAKERS:
+ list->setComparator(&RECENT_SPEAKER_COMPARATOR);
+ list->sort();
+ break;
+ case E_SORT_BY_DISTANCE:
+ list->setComparator(&DISTANCE_COMPARATOR);
+ list->sort();
+ break;
+ case E_SORT_BY_RECENT_ARRIVAL:
+ list->setComparator(&RECENT_ARRIVAL_COMPARATOR);
+ list->sort();
+ break;
+ default:
+ LL_WARNS() << "Unrecognized people sort order for " << list->getName() << LL_ENDL;
+ return;
+ }
+
+ if (save)
+ {
+ std::string setting;
+
+ if (list == mAllFriendList || list == mOnlineFriendList)
+ setting = "FriendsSortOrder";
+ else if (list == mRecentList)
+ setting = "RecentPeopleSortOrder";
+ else if (list == mNearbyList)
+ setting = "NearbyPeopleSortOrder";
+
+ if (!setting.empty())
+ gSavedSettings.setU32(setting, order);
+ }
}
void LLPanelPeople::onFilterEdit(const std::string& search_string)
{
- const S32 cur_tab_idx = mTabContainer->getCurrentPanelIndex();
- std::string& filter = mSavedOriginalFilters[cur_tab_idx];
- std::string& saved_filter = mSavedFilters[cur_tab_idx];
-
- filter = search_string;
- LLStringUtil::trimHead(filter);
-
- // Searches are case-insensitive
- std::string search_upper = filter;
- LLStringUtil::toUpper(search_upper);
-
- if (saved_filter == search_upper)
- return;
-
- saved_filter = search_upper;
-
- // Apply new filter to the current tab.
- const std::string cur_tab = getActiveTabName();
- if (cur_tab == NEARBY_TAB_NAME)
- {
- mNearbyList->setNameFilter(filter);
- }
- else if (cur_tab == FRIENDS_TAB_NAME)
- {
- // store accordion tabs opened/closed state before any manipulation with accordion tabs
- if (!saved_filter.empty())
+ const S32 cur_tab_idx = mTabContainer->getCurrentPanelIndex();
+ std::string& filter = mSavedOriginalFilters[cur_tab_idx];
+ std::string& saved_filter = mSavedFilters[cur_tab_idx];
+
+ filter = search_string;
+ LLStringUtil::trimHead(filter);
+
+ // Searches are case-insensitive
+ std::string search_upper = filter;
+ LLStringUtil::toUpper(search_upper);
+
+ if (saved_filter == search_upper)
+ return;
+
+ saved_filter = search_upper;
+
+ // Apply new filter to the current tab.
+ const std::string cur_tab = getActiveTabName();
+ if (cur_tab == NEARBY_TAB_NAME)
+ {
+ mNearbyList->setNameFilter(filter);
+ }
+ else if (cur_tab == FRIENDS_TAB_NAME)
+ {
+ // store accordion tabs opened/closed state before any manipulation with accordion tabs
+ if (!saved_filter.empty())
{
notifyChildren(LLSD().with("action","store_state"));
}
- mOnlineFriendList->setNameFilter(filter);
- mAllFriendList->setNameFilter(filter);
+ mOnlineFriendList->setNameFilter(filter);
+ mAllFriendList->setNameFilter(filter);
setAccordionCollapsedByUser("tab_online", false);
setAccordionCollapsedByUser("tab_all", false);
showFriendsAccordionsIfNeeded();
- // restore accordion tabs state _after_ all manipulations
- if(saved_filter.empty())
+ // restore accordion tabs state _after_ all manipulations
+ if(saved_filter.empty())
{
notifyChildren(LLSD().with("action","restore_state"));
}
}
- else if (cur_tab == GROUP_TAB_NAME)
- {
- mGroupList->setNameFilter(filter);
- }
- else if (cur_tab == RECENT_TAB_NAME)
- {
- mRecentList->setNameFilter(filter);
- }
+ else if (cur_tab == GROUP_TAB_NAME)
+ {
+ mGroupList->setNameFilter(filter);
+ }
+ else if (cur_tab == RECENT_TAB_NAME)
+ {
+ mRecentList->setNameFilter(filter);
+ }
}
void LLPanelPeople::onGroupLimitInfo()
{
- LLSD args;
-
- S32 max_basic = LLAgentBenefitsMgr::get("Base").getGroupMembershipLimit();
- S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit();
-
- args["MAX_BASIC"] = max_basic;
- args["MAX_PREMIUM"] = max_premium;
-
- if (LLAgentBenefitsMgr::has("Premium_Plus"))
- {
- S32 max_premium_plus = LLAgentBenefitsMgr::get("Premium_Plus").getGroupMembershipLimit();
- args["MAX_PREMIUM_PLUS"] = max_premium_plus;
- LLNotificationsUtil::add("GroupLimitInfoPlus", args);
- }
- else
- {
- LLNotificationsUtil::add("GroupLimitInfo", args);
- }
+ LLSD args;
+
+ S32 max_basic = LLAgentBenefitsMgr::get("Base").getGroupMembershipLimit();
+ S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit();
+
+ args["MAX_BASIC"] = max_basic;
+ args["MAX_PREMIUM"] = max_premium;
+
+ if (LLAgentBenefitsMgr::has("Premium_Plus"))
+ {
+ S32 max_premium_plus = LLAgentBenefitsMgr::get("Premium_Plus").getGroupMembershipLimit();
+ args["MAX_PREMIUM_PLUS"] = max_premium_plus;
+ LLNotificationsUtil::add("GroupLimitInfoPlus", args);
+ }
+ else
+ {
+ LLNotificationsUtil::add("GroupLimitInfo", args);
+ }
}
void LLPanelPeople::onTabSelected(const LLSD& param)
{
- std::string tab_name = getChild<LLPanel>(param.asString())->getName();
- updateButtons();
+ std::string tab_name = getChild<LLPanel>(param.asString())->getName();
+ updateButtons();
- showFriendsAccordionsIfNeeded();
+ showFriendsAccordionsIfNeeded();
}
void LLPanelPeople::onAvatarListDoubleClicked(LLUICtrl* ctrl)
{
- LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(ctrl);
- if(!item)
- {
- return;
- }
-
- LLUUID clicked_id = item->getAvatarId();
- if(gAgent.getID() == clicked_id)
- {
- return;
- }
-
+ LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(ctrl);
+ if(!item)
+ {
+ return;
+ }
+
+ LLUUID clicked_id = item->getAvatarId();
+ if(gAgent.getID() == clicked_id)
+ {
+ return;
+ }
+
#if 0 // SJB: Useful for testing, but not currently functional or to spec
- LLAvatarActions::showProfile(clicked_id);
+ LLAvatarActions::showProfile(clicked_id);
#else // spec says open IM window
- LLAvatarActions::startIM(clicked_id);
+ LLAvatarActions::startIM(clicked_id);
#endif
}
void LLPanelPeople::onAvatarListCommitted(LLAvatarList* list)
{
- if (getActiveTabName() == NEARBY_TAB_NAME)
- {
- uuid_vec_t selected_uuids;
- getCurrentItemIDs(selected_uuids);
- mMiniMap->setSelected(selected_uuids);
- } else
- // Make sure only one of the friends lists (online/all) has selection.
- if (getActiveTabName() == FRIENDS_TAB_NAME)
- {
- if (list == mOnlineFriendList)
- mAllFriendList->resetSelection(true);
- else if (list == mAllFriendList)
- mOnlineFriendList->resetSelection(true);
- else
- llassert(0 && "commit on unknown friends list");
- }
-
- updateButtons();
+ if (getActiveTabName() == NEARBY_TAB_NAME)
+ {
+ uuid_vec_t selected_uuids;
+ getCurrentItemIDs(selected_uuids);
+ mMiniMap->setSelected(selected_uuids);
+ } else
+ // Make sure only one of the friends lists (online/all) has selection.
+ if (getActiveTabName() == FRIENDS_TAB_NAME)
+ {
+ if (list == mOnlineFriendList)
+ mAllFriendList->resetSelection(true);
+ else if (list == mAllFriendList)
+ mOnlineFriendList->resetSelection(true);
+ else
+ llassert(0 && "commit on unknown friends list");
+ }
+
+ updateButtons();
}
void LLPanelPeople::onAddFriendButtonClicked()
{
- LLUUID id = getCurrentItemID();
- if (id.notNull())
- {
- LLAvatarActions::requestFriendshipDialog(id);
- }
+ LLUUID id = getCurrentItemID();
+ if (id.notNull())
+ {
+ LLAvatarActions::requestFriendshipDialog(id);
+ }
}
bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids)
{
- const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
- for ( uuid_vec_t::const_iterator
- id = uuids.begin(),
- id_end = uuids.end();
- id != id_end; ++id )
- {
- if (av_tracker.isBuddy (*id))
- {
- return false;
- }
- }
- return true;
+ const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
+ for ( uuid_vec_t::const_iterator
+ id = uuids.begin(),
+ id_end = uuids.end();
+ id != id_end; ++id )
+ {
+ if (av_tracker.isBuddy (*id))
+ {
+ return false;
+ }
+ }
+ return true;
}
void LLPanelPeople::onAddFriendWizButtonClicked()
@@ -1186,397 +1186,397 @@ void LLPanelPeople::onAddFriendWizButtonClicked()
LLPanel* cur_panel = mTabContainer->getCurrentPanel();
LLView * button = cur_panel->findChild<LLButton>("friends_add_btn", TRUE);
- // Show add friend wizard.
+ // Show add friend wizard.
LLFloater* root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button);
- if (!picker)
- {
- return;
- }
-
- // Need to disable 'ok' button when friend occurs in selection
- picker->setOkBtnEnableCb(boost::bind(&LLPanelPeople::isItemsFreeOfFriends, this, _1));
-
- if (root_floater)
- {
- root_floater->addDependentFloater(picker);
- }
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button);
+ if (!picker)
+ {
+ return;
+ }
+
+ // Need to disable 'ok' button when friend occurs in selection
+ picker->setOkBtnEnableCb(boost::bind(&LLPanelPeople::isItemsFreeOfFriends, this, _1));
+
+ if (root_floater)
+ {
+ root_floater->addDependentFloater(picker);
+ }
mPicker = picker->getHandle();
}
void LLPanelPeople::onDeleteFriendButtonClicked()
{
- uuid_vec_t selected_uuids;
- getCurrentItemIDs(selected_uuids);
-
- if (selected_uuids.size() == 1)
- {
- LLAvatarActions::removeFriendDialog( selected_uuids.front() );
- }
- else if (selected_uuids.size() > 1)
- {
- LLAvatarActions::removeFriendsDialog( selected_uuids );
- }
+ uuid_vec_t selected_uuids;
+ getCurrentItemIDs(selected_uuids);
+
+ if (selected_uuids.size() == 1)
+ {
+ LLAvatarActions::removeFriendDialog( selected_uuids.front() );
+ }
+ else if (selected_uuids.size() > 1)
+ {
+ LLAvatarActions::removeFriendsDialog( selected_uuids );
+ }
}
void LLPanelPeople::onChatButtonClicked()
{
- LLUUID group_id = getCurrentItemID();
- if (group_id.notNull())
- LLGroupActions::startIM(group_id);
+ LLUUID group_id = getCurrentItemID();
+ if (group_id.notNull())
+ LLGroupActions::startIM(group_id);
}
void LLPanelPeople::onGearButtonClicked(LLUICtrl* btn)
{
- uuid_vec_t selected_uuids;
- getCurrentItemIDs(selected_uuids);
- // Spawn at bottom left corner of the button.
- if (getActiveTabName() == NEARBY_TAB_NAME)
- LLPanelPeopleMenus::gNearbyPeopleContextMenu.show(btn, selected_uuids, 0, 0);
- else
- LLPanelPeopleMenus::gPeopleContextMenu.show(btn, selected_uuids, 0, 0);
+ uuid_vec_t selected_uuids;
+ getCurrentItemIDs(selected_uuids);
+ // Spawn at bottom left corner of the button.
+ if (getActiveTabName() == NEARBY_TAB_NAME)
+ LLPanelPeopleMenus::gNearbyPeopleContextMenu.show(btn, selected_uuids, 0, 0);
+ else
+ LLPanelPeopleMenus::gPeopleContextMenu.show(btn, selected_uuids, 0, 0);
}
void LLPanelPeople::onImButtonClicked()
{
- uuid_vec_t selected_uuids;
- getCurrentItemIDs(selected_uuids);
- if ( selected_uuids.size() == 1 )
- {
- // if selected only one person then start up IM
- LLAvatarActions::startIM(selected_uuids.at(0));
- }
- else if ( selected_uuids.size() > 1 )
- {
- // for multiple selection start up friends conference
- LLAvatarActions::startConference(selected_uuids);
- }
+ uuid_vec_t selected_uuids;
+ getCurrentItemIDs(selected_uuids);
+ if ( selected_uuids.size() == 1 )
+ {
+ // if selected only one person then start up IM
+ LLAvatarActions::startIM(selected_uuids.at(0));
+ }
+ else if ( selected_uuids.size() > 1 )
+ {
+ // for multiple selection start up friends conference
+ LLAvatarActions::startConference(selected_uuids);
+ }
}
// static
void LLPanelPeople::onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
{
- if (!names.empty() && !ids.empty())
- LLAvatarActions::requestFriendshipDialog(ids[0], names[0].getCompleteName());
+ if (!names.empty() && !ids.empty())
+ LLAvatarActions::requestFriendshipDialog(ids[0], names[0].getCompleteName());
}
bool LLPanelPeople::onGroupPlusButtonValidate()
{
- if (!gAgent.canJoinGroups())
- {
- LLNotificationsUtil::add("JoinedTooManyGroups");
- return false;
- }
+ if (!gAgent.canJoinGroups())
+ {
+ LLNotificationsUtil::add("JoinedTooManyGroups");
+ return false;
+ }
- return true;
+ return true;
}
void LLPanelPeople::onGroupMinusButtonClicked()
{
- LLUUID group_id = getCurrentItemID();
- if (group_id.notNull())
- LLGroupActions::leave(group_id);
+ LLUUID group_id = getCurrentItemID();
+ if (group_id.notNull())
+ LLGroupActions::leave(group_id);
}
void LLPanelPeople::onGroupPlusMenuItemClicked(const LLSD& userdata)
{
- std::string chosen_item = userdata.asString();
+ std::string chosen_item = userdata.asString();
- if (chosen_item == "join_group")
- LLGroupActions::search();
- else if (chosen_item == "new_group")
- LLGroupActions::createGroup();
+ if (chosen_item == "join_group")
+ LLGroupActions::search();
+ else if (chosen_item == "new_group")
+ LLGroupActions::createGroup();
}
void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata)
{
- std::string chosen_item = userdata.asString();
-
- if (chosen_item == "sort_name")
- {
- setSortOrder(mAllFriendList, E_SORT_BY_NAME);
- }
- else if (chosen_item == "sort_status")
- {
- setSortOrder(mAllFriendList, E_SORT_BY_STATUS);
- }
- else if (chosen_item == "view_icons")
- {
- mAllFriendList->toggleIcons();
- mOnlineFriendList->toggleIcons();
- }
- else if (chosen_item == "view_permissions")
- {
- bool show_permissions = !gSavedSettings.getBOOL("FriendsListShowPermissions");
- gSavedSettings.setBOOL("FriendsListShowPermissions", show_permissions);
-
- mAllFriendList->showPermissions(show_permissions);
- mOnlineFriendList->showPermissions(show_permissions);
- }
- else if (chosen_item == "view_usernames")
- {
- bool hide_usernames = !gSavedSettings.getBOOL("FriendsListHideUsernames");
- gSavedSettings.setBOOL("FriendsListHideUsernames", hide_usernames);
-
- mAllFriendList->setShowCompleteName(!hide_usernames);
- mAllFriendList->handleDisplayNamesOptionChanged();
- mOnlineFriendList->setShowCompleteName(!hide_usernames);
- mOnlineFriendList->handleDisplayNamesOptionChanged();
- }
- }
+ std::string chosen_item = userdata.asString();
+
+ if (chosen_item == "sort_name")
+ {
+ setSortOrder(mAllFriendList, E_SORT_BY_NAME);
+ }
+ else if (chosen_item == "sort_status")
+ {
+ setSortOrder(mAllFriendList, E_SORT_BY_STATUS);
+ }
+ else if (chosen_item == "view_icons")
+ {
+ mAllFriendList->toggleIcons();
+ mOnlineFriendList->toggleIcons();
+ }
+ else if (chosen_item == "view_permissions")
+ {
+ bool show_permissions = !gSavedSettings.getBOOL("FriendsListShowPermissions");
+ gSavedSettings.setBOOL("FriendsListShowPermissions", show_permissions);
+
+ mAllFriendList->showPermissions(show_permissions);
+ mOnlineFriendList->showPermissions(show_permissions);
+ }
+ else if (chosen_item == "view_usernames")
+ {
+ bool hide_usernames = !gSavedSettings.getBOOL("FriendsListHideUsernames");
+ gSavedSettings.setBOOL("FriendsListHideUsernames", hide_usernames);
+
+ mAllFriendList->setShowCompleteName(!hide_usernames);
+ mAllFriendList->handleDisplayNamesOptionChanged();
+ mOnlineFriendList->setShowCompleteName(!hide_usernames);
+ mOnlineFriendList->handleDisplayNamesOptionChanged();
+ }
+ }
void LLPanelPeople::onGroupsViewSortMenuItemClicked(const LLSD& userdata)
{
- std::string chosen_item = userdata.asString();
+ std::string chosen_item = userdata.asString();
- if (chosen_item == "show_icons")
- {
- mGroupList->toggleIcons();
- }
+ if (chosen_item == "show_icons")
+ {
+ mGroupList->toggleIcons();
+ }
}
void LLPanelPeople::onNearbyViewSortMenuItemClicked(const LLSD& userdata)
{
- std::string chosen_item = userdata.asString();
-
- if (chosen_item == "sort_by_recent_speakers")
- {
- setSortOrder(mNearbyList, E_SORT_BY_RECENT_SPEAKERS);
- }
- else if (chosen_item == "sort_name")
- {
- setSortOrder(mNearbyList, E_SORT_BY_NAME);
- }
- else if (chosen_item == "view_icons")
- {
- mNearbyList->toggleIcons();
- }
- else if (chosen_item == "sort_distance")
- {
- setSortOrder(mNearbyList, E_SORT_BY_DISTANCE);
- }
- else if (chosen_item == "sort_arrival")
- {
- setSortOrder(mNearbyList, E_SORT_BY_RECENT_ARRIVAL);
- }
- else if (chosen_item == "view_usernames")
- {
- bool hide_usernames = !gSavedSettings.getBOOL("NearbyListHideUsernames");
- gSavedSettings.setBOOL("NearbyListHideUsernames", hide_usernames);
-
- mNearbyList->setShowCompleteName(!hide_usernames);
- mNearbyList->handleDisplayNamesOptionChanged();
- }
+ std::string chosen_item = userdata.asString();
+
+ if (chosen_item == "sort_by_recent_speakers")
+ {
+ setSortOrder(mNearbyList, E_SORT_BY_RECENT_SPEAKERS);
+ }
+ else if (chosen_item == "sort_name")
+ {
+ setSortOrder(mNearbyList, E_SORT_BY_NAME);
+ }
+ else if (chosen_item == "view_icons")
+ {
+ mNearbyList->toggleIcons();
+ }
+ else if (chosen_item == "sort_distance")
+ {
+ setSortOrder(mNearbyList, E_SORT_BY_DISTANCE);
+ }
+ else if (chosen_item == "sort_arrival")
+ {
+ setSortOrder(mNearbyList, E_SORT_BY_RECENT_ARRIVAL);
+ }
+ else if (chosen_item == "view_usernames")
+ {
+ bool hide_usernames = !gSavedSettings.getBOOL("NearbyListHideUsernames");
+ gSavedSettings.setBOOL("NearbyListHideUsernames", hide_usernames);
+
+ mNearbyList->setShowCompleteName(!hide_usernames);
+ mNearbyList->handleDisplayNamesOptionChanged();
+ }
}
bool LLPanelPeople::onNearbyViewSortMenuItemCheck(const LLSD& userdata)
{
- std::string item = userdata.asString();
- U32 sort_order = gSavedSettings.getU32("NearbyPeopleSortOrder");
-
- if (item == "sort_by_recent_speakers")
- return sort_order == E_SORT_BY_RECENT_SPEAKERS;
- if (item == "sort_name")
- return sort_order == E_SORT_BY_NAME;
- if (item == "sort_distance")
- return sort_order == E_SORT_BY_DISTANCE;
- if (item == "sort_arrival")
- return sort_order == E_SORT_BY_RECENT_ARRIVAL;
-
- return false;
+ std::string item = userdata.asString();
+ U32 sort_order = gSavedSettings.getU32("NearbyPeopleSortOrder");
+
+ if (item == "sort_by_recent_speakers")
+ return sort_order == E_SORT_BY_RECENT_SPEAKERS;
+ if (item == "sort_name")
+ return sort_order == E_SORT_BY_NAME;
+ if (item == "sort_distance")
+ return sort_order == E_SORT_BY_DISTANCE;
+ if (item == "sort_arrival")
+ return sort_order == E_SORT_BY_RECENT_ARRIVAL;
+
+ return false;
}
void LLPanelPeople::onRecentViewSortMenuItemClicked(const LLSD& userdata)
{
- std::string chosen_item = userdata.asString();
-
- if (chosen_item == "sort_recent")
- {
- setSortOrder(mRecentList, E_SORT_BY_MOST_RECENT);
- }
- else if (chosen_item == "sort_name")
- {
- setSortOrder(mRecentList, E_SORT_BY_NAME);
- }
- else if (chosen_item == "view_icons")
- {
- mRecentList->toggleIcons();
- }
+ std::string chosen_item = userdata.asString();
+
+ if (chosen_item == "sort_recent")
+ {
+ setSortOrder(mRecentList, E_SORT_BY_MOST_RECENT);
+ }
+ else if (chosen_item == "sort_name")
+ {
+ setSortOrder(mRecentList, E_SORT_BY_NAME);
+ }
+ else if (chosen_item == "view_icons")
+ {
+ mRecentList->toggleIcons();
+ }
}
-bool LLPanelPeople::onFriendsViewSortMenuItemCheck(const LLSD& userdata)
+bool LLPanelPeople::onFriendsViewSortMenuItemCheck(const LLSD& userdata)
{
- std::string item = userdata.asString();
- U32 sort_order = gSavedSettings.getU32("FriendsSortOrder");
+ std::string item = userdata.asString();
+ U32 sort_order = gSavedSettings.getU32("FriendsSortOrder");
- if (item == "sort_name")
- return sort_order == E_SORT_BY_NAME;
- if (item == "sort_status")
- return sort_order == E_SORT_BY_STATUS;
+ if (item == "sort_name")
+ return sort_order == E_SORT_BY_NAME;
+ if (item == "sort_status")
+ return sort_order == E_SORT_BY_STATUS;
- return false;
+ return false;
}
-bool LLPanelPeople::onRecentViewSortMenuItemCheck(const LLSD& userdata)
+bool LLPanelPeople::onRecentViewSortMenuItemCheck(const LLSD& userdata)
{
- std::string item = userdata.asString();
- U32 sort_order = gSavedSettings.getU32("RecentPeopleSortOrder");
+ std::string item = userdata.asString();
+ U32 sort_order = gSavedSettings.getU32("RecentPeopleSortOrder");
- if (item == "sort_recent")
- return sort_order == E_SORT_BY_MOST_RECENT;
- if (item == "sort_name")
- return sort_order == E_SORT_BY_NAME;
+ if (item == "sort_recent")
+ return sort_order == E_SORT_BY_MOST_RECENT;
+ if (item == "sort_name")
+ return sort_order == E_SORT_BY_NAME;
- return false;
+ return false;
}
void LLPanelPeople::onMoreButtonClicked()
{
- // *TODO: not implemented yet
+ // *TODO: not implemented yet
}
-void LLPanelPeople::onOpen(const LLSD& key)
+void LLPanelPeople::onOpen(const LLSD& key)
{
- std::string tab_name = key["people_panel_tab_name"];
- if (!tab_name.empty())
- {
- mTabContainer->selectTabByName(tab_name);
- if(tab_name == BLOCKED_TAB_NAME)
- {
- LLPanel* blocked_tab = mTabContainer->getCurrentPanel()->findChild<LLPanel>("panel_block_list_sidetray");
- if(blocked_tab)
- {
- blocked_tab->onOpen(key);
- }
- }
- }
+ std::string tab_name = key["people_panel_tab_name"];
+ if (!tab_name.empty())
+ {
+ mTabContainer->selectTabByName(tab_name);
+ if(tab_name == BLOCKED_TAB_NAME)
+ {
+ LLPanel* blocked_tab = mTabContainer->getCurrentPanel()->findChild<LLPanel>("panel_block_list_sidetray");
+ if(blocked_tab)
+ {
+ blocked_tab->onOpen(key);
+ }
+ }
+ }
}
bool LLPanelPeople::notifyChildren(const LLSD& info)
{
- if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state")
- {
- LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
- if (!container)
- {
- LL_WARNS() << "Cannot find People panel container" << LL_ENDL;
- return true;
- }
-
- if (container->getCurrentPanelIndex() > 0)
- {
- // if not on the default panel, switch to it
- container->onOpen(LLSD().with(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName()));
- }
- else
- LLFloaterReg::hideInstance("people");
-
- return true; // this notification is only supposed to be handled by task panels
- }
-
- return LLPanel::notifyChildren(info);
+ if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state")
+ {
+ LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
+ if (!container)
+ {
+ LL_WARNS() << "Cannot find People panel container" << LL_ENDL;
+ return true;
+ }
+
+ if (container->getCurrentPanelIndex() > 0)
+ {
+ // if not on the default panel, switch to it
+ container->onOpen(LLSD().with(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName()));
+ }
+ else
+ LLFloaterReg::hideInstance("people");
+
+ return true; // this notification is only supposed to be handled by task panels
+ }
+
+ return LLPanel::notifyChildren(info);
}
void LLPanelPeople::showAccordion(const std::string name, bool show)
{
- if(name.empty())
- {
- LL_WARNS() << "No name provided" << LL_ENDL;
- return;
- }
-
- LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(name);
- tab->setVisible(show);
- if(show)
- {
- // don't expand accordion if it was collapsed by user
- if(!isAccordionCollapsedByUser(tab))
- {
- // expand accordion
- tab->changeOpenClose(false);
- }
- }
+ if(name.empty())
+ {
+ LL_WARNS() << "No name provided" << LL_ENDL;
+ return;
+ }
+
+ LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(name);
+ tab->setVisible(show);
+ if(show)
+ {
+ // don't expand accordion if it was collapsed by user
+ if(!isAccordionCollapsedByUser(tab))
+ {
+ // expand accordion
+ tab->changeOpenClose(false);
+ }
+ }
}
void LLPanelPeople::showFriendsAccordionsIfNeeded()
{
- if(FRIENDS_TAB_NAME == getActiveTabName())
- {
- // Expand and show accordions if needed, else - hide them
- showAccordion("tab_online", mOnlineFriendList->filterHasMatches());
- showAccordion("tab_all", mAllFriendList->filterHasMatches());
-
- // Rearrange accordions
- LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion");
- accordion->arrange();
-
- // *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368).
- // this code should be refactored to use it
- // keep help text in a synchronization with accordions visibility.
- updateFriendListHelpText();
- }
+ if(FRIENDS_TAB_NAME == getActiveTabName())
+ {
+ // Expand and show accordions if needed, else - hide them
+ showAccordion("tab_online", mOnlineFriendList->filterHasMatches());
+ showAccordion("tab_all", mAllFriendList->filterHasMatches());
+
+ // Rearrange accordions
+ LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion");
+ accordion->arrange();
+
+ // *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368).
+ // this code should be refactored to use it
+ // keep help text in a synchronization with accordions visibility.
+ updateFriendListHelpText();
+ }
}
void LLPanelPeople::onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param)
{
- if(ctrl == mOnlineFriendList)
- {
- showAccordion("tab_online", param.asInteger());
- }
- else if(ctrl == mAllFriendList)
- {
- showAccordion("tab_all", param.asInteger());
- }
+ if(ctrl == mOnlineFriendList)
+ {
+ showAccordion("tab_online", param.asInteger());
+ }
+ else if(ctrl == mAllFriendList)
+ {
+ showAccordion("tab_all", param.asInteger());
+ }
}
void LLPanelPeople::setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed)
{
- if(!acc_tab)
- {
- LL_WARNS() << "Invalid parameter" << LL_ENDL;
- return;
- }
-
- LLSD param = acc_tab->getValue();
- param[COLLAPSED_BY_USER] = collapsed;
- acc_tab->setValue(param);
+ if(!acc_tab)
+ {
+ LL_WARNS() << "Invalid parameter" << LL_ENDL;
+ return;
+ }
+
+ LLSD param = acc_tab->getValue();
+ param[COLLAPSED_BY_USER] = collapsed;
+ acc_tab->setValue(param);
}
void LLPanelPeople::setAccordionCollapsedByUser(const std::string& name, bool collapsed)
{
- setAccordionCollapsedByUser(getChild<LLUICtrl>(name), collapsed);
+ setAccordionCollapsedByUser(getChild<LLUICtrl>(name), collapsed);
}
bool LLPanelPeople::isAccordionCollapsedByUser(LLUICtrl* acc_tab)
{
- if(!acc_tab)
- {
- LL_WARNS() << "Invalid parameter" << LL_ENDL;
- return false;
- }
-
- LLSD param = acc_tab->getValue();
- if(!param.has(COLLAPSED_BY_USER))
- {
- return false;
- }
- return param[COLLAPSED_BY_USER].asBoolean();
+ if(!acc_tab)
+ {
+ LL_WARNS() << "Invalid parameter" << LL_ENDL;
+ return false;
+ }
+
+ LLSD param = acc_tab->getValue();
+ if(!param.has(COLLAPSED_BY_USER))
+ {
+ return false;
+ }
+ return param[COLLAPSED_BY_USER].asBoolean();
}
bool LLPanelPeople::isAccordionCollapsedByUser(const std::string& name)
{
- return isAccordionCollapsedByUser(getChild<LLUICtrl>(name));
+ return isAccordionCollapsedByUser(getChild<LLUICtrl>(name));
}
bool LLPanelPeople::updateNearbyArrivalTime()
{
- std::vector<LLVector3d> positions;
- std::vector<LLUUID> uuids;
- static LLCachedControl<F32> range(gSavedSettings, "NearMeRange");
- LLWorld::getInstance()->getAvatars(&uuids, &positions, gAgent.getPositionGlobal(), range);
- LLRecentPeople::instance().updateAvatarsArrivalTime(uuids);
- return LLApp::isExiting();
+ std::vector<LLVector3d> positions;
+ std::vector<LLUUID> uuids;
+ static LLCachedControl<F32> range(gSavedSettings, "NearMeRange");
+ LLWorld::getInstance()->getAvatars(&uuids, &positions, gAgent.getPositionGlobal(), range);
+ LLRecentPeople::instance().updateAvatarsArrivalTime(uuids);
+ return LLApp::isExiting();
}
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index 14205cebe2..f38c71e0b2 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -1,28 +1,28 @@
-/**
+/**
* @file llpanelpeople.h
* @brief Side tray "People" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#ifndef LL_LLPANELPEOPLE_H
#define LL_LLPANELPEOPLE_H
@@ -41,113 +41,113 @@ class LLMenuButton;
class LLTabContainer;
class LLNetMap;
-class LLPanelPeople
- : public LLPanel
- , public LLVoiceClientStatusObserver
+class LLPanelPeople
+ : public LLPanel
+ , public LLVoiceClientStatusObserver
{
- LOG_CLASS(LLPanelPeople);
+ LOG_CLASS(LLPanelPeople);
public:
- LLPanelPeople();
- virtual ~LLPanelPeople();
+ LLPanelPeople();
+ virtual ~LLPanelPeople();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ bool notifyChildren(const LLSD& info);
- // Implements LLVoiceClientStatusObserver::onChange() to enable call buttons
- // when voice is available
- /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ bool notifyChildren(const LLSD& info);
+ // Implements LLVoiceClientStatusObserver::onChange() to enable call buttons
+ // when voice is available
+ /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
- // internals
- class Updater;
+ // internals
+ class Updater;
- bool updateNearbyArrivalTime();
+ bool updateNearbyArrivalTime();
private:
- typedef enum e_sort_oder {
- E_SORT_BY_NAME = 0,
- E_SORT_BY_STATUS = 1,
- E_SORT_BY_MOST_RECENT = 2,
- E_SORT_BY_DISTANCE = 3,
- E_SORT_BY_RECENT_SPEAKERS = 4,
- E_SORT_BY_RECENT_ARRIVAL = 5
- } ESortOrder;
-
- void removePicker();
-
- // methods indirectly called by the updaters
- void updateFriendListHelpText();
- void updateFriendList();
- void updateNearbyList();
- void updateRecentList();
-
- bool isItemsFreeOfFriends(const uuid_vec_t& uuids);
-
- void updateButtons();
- std::string getActiveTabName() const;
- LLUUID getCurrentItemID() const;
- void getCurrentItemIDs(uuid_vec_t& selected_uuids) const;
- void showGroupMenu(LLMenuGL* menu);
- void setSortOrder(LLAvatarList* list, ESortOrder order, bool save = true);
-
- // UI callbacks
- void onFilterEdit(const std::string& search_string);
- void onGroupLimitInfo();
- void onTabSelected(const LLSD& param);
- void onAddFriendButtonClicked();
- void onAddFriendWizButtonClicked();
- void onDeleteFriendButtonClicked();
- void onChatButtonClicked();
- void onGearButtonClicked(LLUICtrl* btn);
- void onImButtonClicked();
- void onMoreButtonClicked();
- void onAvatarListDoubleClicked(LLUICtrl* ctrl);
- void onAvatarListCommitted(LLAvatarList* list);
- bool onGroupPlusButtonValidate();
- void onGroupMinusButtonClicked();
- void onGroupPlusMenuItemClicked(const LLSD& userdata);
-
- void onFriendsViewSortMenuItemClicked(const LLSD& userdata);
- void onNearbyViewSortMenuItemClicked(const LLSD& userdata);
- void onGroupsViewSortMenuItemClicked(const LLSD& userdata);
- void onRecentViewSortMenuItemClicked(const LLSD& userdata);
-
- bool onFriendsViewSortMenuItemCheck(const LLSD& userdata);
- bool onRecentViewSortMenuItemCheck(const LLSD& userdata);
- bool onNearbyViewSortMenuItemCheck(const LLSD& userdata);
-
- // misc callbacks
- static void onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
-
- void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list);
-
- void showAccordion(const std::string name, bool show);
-
- void showFriendsAccordionsIfNeeded();
-
- void onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param);
-
- void setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed);
- void setAccordionCollapsedByUser(const std::string& name, bool collapsed);
- bool isAccordionCollapsedByUser(LLUICtrl* acc_tab);
- bool isAccordionCollapsedByUser(const std::string& name);
-
- LLTabContainer* mTabContainer;
- LLAvatarList* mOnlineFriendList;
- LLAvatarList* mAllFriendList;
- LLAvatarList* mNearbyList;
- LLAvatarList* mRecentList;
- LLGroupList* mGroupList;
- LLNetMap* mMiniMap;
-
- std::vector<std::string> mSavedOriginalFilters;
- std::vector<std::string> mSavedFilters;
-
- Updater* mFriendListUpdater;
- Updater* mNearbyListUpdater;
- Updater* mRecentListUpdater;
- Updater* mButtonsUpdater;
- LLHandle< LLFloater > mPicker;
+ typedef enum e_sort_oder {
+ E_SORT_BY_NAME = 0,
+ E_SORT_BY_STATUS = 1,
+ E_SORT_BY_MOST_RECENT = 2,
+ E_SORT_BY_DISTANCE = 3,
+ E_SORT_BY_RECENT_SPEAKERS = 4,
+ E_SORT_BY_RECENT_ARRIVAL = 5
+ } ESortOrder;
+
+ void removePicker();
+
+ // methods indirectly called by the updaters
+ void updateFriendListHelpText();
+ void updateFriendList();
+ void updateNearbyList();
+ void updateRecentList();
+
+ bool isItemsFreeOfFriends(const uuid_vec_t& uuids);
+
+ void updateButtons();
+ std::string getActiveTabName() const;
+ LLUUID getCurrentItemID() const;
+ void getCurrentItemIDs(uuid_vec_t& selected_uuids) const;
+ void showGroupMenu(LLMenuGL* menu);
+ void setSortOrder(LLAvatarList* list, ESortOrder order, bool save = true);
+
+ // UI callbacks
+ void onFilterEdit(const std::string& search_string);
+ void onGroupLimitInfo();
+ void onTabSelected(const LLSD& param);
+ void onAddFriendButtonClicked();
+ void onAddFriendWizButtonClicked();
+ void onDeleteFriendButtonClicked();
+ void onChatButtonClicked();
+ void onGearButtonClicked(LLUICtrl* btn);
+ void onImButtonClicked();
+ void onMoreButtonClicked();
+ void onAvatarListDoubleClicked(LLUICtrl* ctrl);
+ void onAvatarListCommitted(LLAvatarList* list);
+ bool onGroupPlusButtonValidate();
+ void onGroupMinusButtonClicked();
+ void onGroupPlusMenuItemClicked(const LLSD& userdata);
+
+ void onFriendsViewSortMenuItemClicked(const LLSD& userdata);
+ void onNearbyViewSortMenuItemClicked(const LLSD& userdata);
+ void onGroupsViewSortMenuItemClicked(const LLSD& userdata);
+ void onRecentViewSortMenuItemClicked(const LLSD& userdata);
+
+ bool onFriendsViewSortMenuItemCheck(const LLSD& userdata);
+ bool onRecentViewSortMenuItemCheck(const LLSD& userdata);
+ bool onNearbyViewSortMenuItemCheck(const LLSD& userdata);
+
+ // misc callbacks
+ static void onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
+
+ void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list);
+
+ void showAccordion(const std::string name, bool show);
+
+ void showFriendsAccordionsIfNeeded();
+
+ void onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param);
+
+ void setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed);
+ void setAccordionCollapsedByUser(const std::string& name, bool collapsed);
+ bool isAccordionCollapsedByUser(LLUICtrl* acc_tab);
+ bool isAccordionCollapsedByUser(const std::string& name);
+
+ LLTabContainer* mTabContainer;
+ LLAvatarList* mOnlineFriendList;
+ LLAvatarList* mAllFriendList;
+ LLAvatarList* mNearbyList;
+ LLAvatarList* mRecentList;
+ LLGroupList* mGroupList;
+ LLNetMap* mMiniMap;
+
+ std::vector<std::string> mSavedOriginalFilters;
+ std::vector<std::string> mSavedFilters;
+
+ Updater* mFriendListUpdater;
+ Updater* mNearbyListUpdater;
+ Updater* mRecentListUpdater;
+ Updater* mButtonsUpdater;
+ LLHandle< LLFloater > mPicker;
};
#endif //LL_LLPANELPEOPLE_H
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index 42cecc9986..172c7d0828 100644
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelpeoplemenus.h
* @brief Menus used by the side tray "People" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,12 +34,12 @@
// newview
#include "llagent.h"
-#include "llagentdata.h" // for gAgentID
+#include "llagentdata.h" // for gAgentID
#include "llavataractions.h"
-#include "llcallingcard.h" // for LLAvatarTracker
+#include "llcallingcard.h" // for LLAvatarTracker
#include "lllogchat.h"
#include "llparcel.h"
-#include "llviewermenu.h" // for gMenuHolder
+#include "llviewermenu.h" // for gMenuHolder
#include "llconversationmodel.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
@@ -57,60 +57,60 @@ NearbyPeopleContextMenu gNearbyPeopleContextMenu;
LLContextMenu* PeopleContextMenu::createMenu()
{
- // set up the callbacks for all of the avatar menu items
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- LLContextMenu* menu;
-
- if ( mUUIDs.size() == 1 )
- {
- // Set up for one person selected menu
-
- const LLUUID& id = mUUIDs.front();
- registrar.add("Avatar.Profile", boost::bind(&LLAvatarActions::showProfile, id));
- registrar.add("Avatar.AddFriend", boost::bind(&LLAvatarActions::requestFriendshipDialog, id));
- registrar.add("Avatar.RemoveFriend", boost::bind(&LLAvatarActions::removeFriendDialog, id));
- registrar.add("Avatar.IM", boost::bind(&LLAvatarActions::startIM, id));
- registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startCall, id));
- registrar.add("Avatar.OfferTeleport", boost::bind(&PeopleContextMenu::offerTeleport, this));
- registrar.add("Avatar.ZoomIn", boost::bind(&handle_zoom_to_object, id));
- registrar.add("Avatar.ShowOnMap", boost::bind(&LLAvatarActions::showOnMap, id));
- registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::share, id));
- registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, id));
- registrar.add("Avatar.BlockUnblock", boost::bind(&LLAvatarActions::toggleBlock, id));
- registrar.add("Avatar.InviteToGroup", boost::bind(&LLAvatarActions::inviteToGroup, id));
- registrar.add("Avatar.TeleportRequest", boost::bind(&PeopleContextMenu::requestTeleport, this));
- registrar.add("Avatar.Calllog", boost::bind(&LLAvatarActions::viewChatHistory, id));
- registrar.add("Avatar.Freeze", boost::bind(&LLAvatarActions::freezeAvatar, id));
- registrar.add("Avatar.Eject", boost::bind(&PeopleContextMenu::eject, this));
-
-
- enable_registrar.add("Avatar.EnableItem", boost::bind(&PeopleContextMenu::enableContextMenuItem, this, _2));
- enable_registrar.add("Avatar.CheckItem", boost::bind(&PeopleContextMenu::checkContextMenuItem, this, _2));
- enable_registrar.add("Avatar.EnableFreezeEject", boost::bind(&PeopleContextMenu::enableFreezeEject, this, _2));
-
- // create the context menu from the XUI
- menu = createFromFile("menu_people_nearby.xml");
- buildContextMenu(*menu, 0x0);
- }
- else
- {
- // Set up for multi-selected People
-
- // registrar.add("Avatar.AddFriend", boost::bind(&LLAvatarActions::requestFriendshipDialog, mUUIDs)); // *TODO: unimplemented
- registrar.add("Avatar.IM", boost::bind(&PeopleContextMenu::startConference, this));
- registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startAdhocCall, mUUIDs, LLUUID::null));
- registrar.add("Avatar.OfferTeleport", boost::bind(&PeopleContextMenu::offerTeleport, this));
- registrar.add("Avatar.RemoveFriend", boost::bind(&LLAvatarActions::removeFriendsDialog, mUUIDs));
- // registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::startIM, mUUIDs)); // *TODO: unimplemented
- // registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, mUUIDs)); // *TODO: unimplemented
-
- enable_registrar.add("Avatar.EnableItem", boost::bind(&PeopleContextMenu::enableContextMenuItem, this, _2));
-
- // create the context menu from the XUI
- menu = createFromFile("menu_people_nearby_multiselect.xml");
- buildContextMenu(*menu, ITEM_IN_MULTI_SELECTION);
- }
+ // set up the callbacks for all of the avatar menu items
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+ LLContextMenu* menu;
+
+ if ( mUUIDs.size() == 1 )
+ {
+ // Set up for one person selected menu
+
+ const LLUUID& id = mUUIDs.front();
+ registrar.add("Avatar.Profile", boost::bind(&LLAvatarActions::showProfile, id));
+ registrar.add("Avatar.AddFriend", boost::bind(&LLAvatarActions::requestFriendshipDialog, id));
+ registrar.add("Avatar.RemoveFriend", boost::bind(&LLAvatarActions::removeFriendDialog, id));
+ registrar.add("Avatar.IM", boost::bind(&LLAvatarActions::startIM, id));
+ registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startCall, id));
+ registrar.add("Avatar.OfferTeleport", boost::bind(&PeopleContextMenu::offerTeleport, this));
+ registrar.add("Avatar.ZoomIn", boost::bind(&handle_zoom_to_object, id));
+ registrar.add("Avatar.ShowOnMap", boost::bind(&LLAvatarActions::showOnMap, id));
+ registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::share, id));
+ registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, id));
+ registrar.add("Avatar.BlockUnblock", boost::bind(&LLAvatarActions::toggleBlock, id));
+ registrar.add("Avatar.InviteToGroup", boost::bind(&LLAvatarActions::inviteToGroup, id));
+ registrar.add("Avatar.TeleportRequest", boost::bind(&PeopleContextMenu::requestTeleport, this));
+ registrar.add("Avatar.Calllog", boost::bind(&LLAvatarActions::viewChatHistory, id));
+ registrar.add("Avatar.Freeze", boost::bind(&LLAvatarActions::freezeAvatar, id));
+ registrar.add("Avatar.Eject", boost::bind(&PeopleContextMenu::eject, this));
+
+
+ enable_registrar.add("Avatar.EnableItem", boost::bind(&PeopleContextMenu::enableContextMenuItem, this, _2));
+ enable_registrar.add("Avatar.CheckItem", boost::bind(&PeopleContextMenu::checkContextMenuItem, this, _2));
+ enable_registrar.add("Avatar.EnableFreezeEject", boost::bind(&PeopleContextMenu::enableFreezeEject, this, _2));
+
+ // create the context menu from the XUI
+ menu = createFromFile("menu_people_nearby.xml");
+ buildContextMenu(*menu, 0x0);
+ }
+ else
+ {
+ // Set up for multi-selected People
+
+ // registrar.add("Avatar.AddFriend", boost::bind(&LLAvatarActions::requestFriendshipDialog, mUUIDs)); // *TODO: unimplemented
+ registrar.add("Avatar.IM", boost::bind(&PeopleContextMenu::startConference, this));
+ registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startAdhocCall, mUUIDs, LLUUID::null));
+ registrar.add("Avatar.OfferTeleport", boost::bind(&PeopleContextMenu::offerTeleport, this));
+ registrar.add("Avatar.RemoveFriend", boost::bind(&LLAvatarActions::removeFriendsDialog, mUUIDs));
+ // registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::startIM, mUUIDs)); // *TODO: unimplemented
+ // registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, mUUIDs)); // *TODO: unimplemented
+
+ enable_registrar.add("Avatar.EnableItem", boost::bind(&PeopleContextMenu::enableContextMenuItem, this, _2));
+
+ // create the context menu from the XUI
+ menu = createFromFile("menu_people_nearby_multiselect.xml");
+ buildContextMenu(*menu, ITEM_IN_MULTI_SELECTION);
+ }
return menu;
}
@@ -119,151 +119,151 @@ void PeopleContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags)
{
menuentry_vec_t items;
menuentry_vec_t disabled_items;
-
- if (flags & ITEM_IN_MULTI_SELECTION)
- {
- items.push_back(std::string("add_friends"));
- items.push_back(std::string("remove_friends"));
- items.push_back(std::string("im"));
- items.push_back(std::string("call"));
- items.push_back(std::string("share"));
- items.push_back(std::string("pay"));
- items.push_back(std::string("offer_teleport"));
- }
- else
- {
- items.push_back(std::string("view_profile"));
- items.push_back(std::string("im"));
- items.push_back(std::string("offer_teleport"));
- items.push_back(std::string("request_teleport"));
- items.push_back(std::string("voice_call"));
- items.push_back(std::string("chat_history"));
- items.push_back(std::string("separator_chat_history"));
- items.push_back(std::string("add_friend"));
- items.push_back(std::string("remove_friend"));
- items.push_back(std::string("invite_to_group"));
- items.push_back(std::string("separator_invite_to_group"));
- items.push_back(std::string("map"));
- items.push_back(std::string("share"));
- items.push_back(std::string("pay"));
- items.push_back(std::string("block_unblock"));
- }
+
+ if (flags & ITEM_IN_MULTI_SELECTION)
+ {
+ items.push_back(std::string("add_friends"));
+ items.push_back(std::string("remove_friends"));
+ items.push_back(std::string("im"));
+ items.push_back(std::string("call"));
+ items.push_back(std::string("share"));
+ items.push_back(std::string("pay"));
+ items.push_back(std::string("offer_teleport"));
+ }
+ else
+ {
+ items.push_back(std::string("view_profile"));
+ items.push_back(std::string("im"));
+ items.push_back(std::string("offer_teleport"));
+ items.push_back(std::string("request_teleport"));
+ items.push_back(std::string("voice_call"));
+ items.push_back(std::string("chat_history"));
+ items.push_back(std::string("separator_chat_history"));
+ items.push_back(std::string("add_friend"));
+ items.push_back(std::string("remove_friend"));
+ items.push_back(std::string("invite_to_group"));
+ items.push_back(std::string("separator_invite_to_group"));
+ items.push_back(std::string("map"));
+ items.push_back(std::string("share"));
+ items.push_back(std::string("pay"));
+ items.push_back(std::string("block_unblock"));
+ }
hide_context_entries(menu, items, disabled_items);
}
bool PeopleContextMenu::enableContextMenuItem(const LLSD& userdata)
{
- if(gAgent.getID() == mUUIDs.front())
- {
- return false;
- }
- std::string item = userdata.asString();
-
- // Note: can_block and can_delete is used only for one person selected menu
- // so we don't need to go over all uuids.
-
- if (item == std::string("can_block"))
- {
- const LLUUID& id = mUUIDs.front();
- return LLAvatarActions::canBlock(id);
- }
- else if (item == std::string("can_add"))
- {
- // We can add friends if:
- // - there are selected people
- // - and there are no friends among selection yet.
-
- //EXT-7389 - disable for more than 1
- if(mUUIDs.size() > 1)
- {
- return false;
- }
-
- bool result = (mUUIDs.size() > 0);
-
- uuid_vec_t::const_iterator
- id = mUUIDs.begin(),
- uuids_end = mUUIDs.end();
-
- for (;id != uuids_end; ++id)
- {
- if ( LLAvatarActions::isFriend(*id) )
- {
- result = false;
- break;
- }
- }
-
- return result;
- }
- else if (item == std::string("can_delete"))
- {
- // We can remove friends if:
- // - there are selected people
- // - and there are only friends among selection.
-
- bool result = (mUUIDs.size() > 0);
-
- uuid_vec_t::const_iterator
- id = mUUIDs.begin(),
- uuids_end = mUUIDs.end();
-
- for (;id != uuids_end; ++id)
- {
- if ( !LLAvatarActions::isFriend(*id) )
- {
- result = false;
- break;
- }
- }
-
- return result;
- }
- else if (item == std::string("can_call"))
- {
- return LLAvatarActions::canCall();
- }
- else if (item == std::string("can_zoom_in"))
- {
- const LLUUID& id = mUUIDs.front();
-
- return gObjectList.findObject(id);
- }
- else if (item == std::string("can_show_on_map"))
- {
- const LLUUID& id = mUUIDs.front();
-
- return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id))
- || gAgent.isGodlike();
- }
- else if(item == std::string("can_offer_teleport"))
- {
- return LLAvatarActions::canOfferTeleport(mUUIDs);
- }
- else if (item == std::string("can_callog"))
- {
- return LLLogChat::isTranscriptExist(mUUIDs.front());
- }
- else if (item == std::string("can_im") || item == std::string("can_invite") ||
- item == std::string("can_share") || item == std::string("can_pay"))
- {
- return true;
- }
- return false;
+ if(gAgent.getID() == mUUIDs.front())
+ {
+ return false;
+ }
+ std::string item = userdata.asString();
+
+ // Note: can_block and can_delete is used only for one person selected menu
+ // so we don't need to go over all uuids.
+
+ if (item == std::string("can_block"))
+ {
+ const LLUUID& id = mUUIDs.front();
+ return LLAvatarActions::canBlock(id);
+ }
+ else if (item == std::string("can_add"))
+ {
+ // We can add friends if:
+ // - there are selected people
+ // - and there are no friends among selection yet.
+
+ //EXT-7389 - disable for more than 1
+ if(mUUIDs.size() > 1)
+ {
+ return false;
+ }
+
+ bool result = (mUUIDs.size() > 0);
+
+ uuid_vec_t::const_iterator
+ id = mUUIDs.begin(),
+ uuids_end = mUUIDs.end();
+
+ for (;id != uuids_end; ++id)
+ {
+ if ( LLAvatarActions::isFriend(*id) )
+ {
+ result = false;
+ break;
+ }
+ }
+
+ return result;
+ }
+ else if (item == std::string("can_delete"))
+ {
+ // We can remove friends if:
+ // - there are selected people
+ // - and there are only friends among selection.
+
+ bool result = (mUUIDs.size() > 0);
+
+ uuid_vec_t::const_iterator
+ id = mUUIDs.begin(),
+ uuids_end = mUUIDs.end();
+
+ for (;id != uuids_end; ++id)
+ {
+ if ( !LLAvatarActions::isFriend(*id) )
+ {
+ result = false;
+ break;
+ }
+ }
+
+ return result;
+ }
+ else if (item == std::string("can_call"))
+ {
+ return LLAvatarActions::canCall();
+ }
+ else if (item == std::string("can_zoom_in"))
+ {
+ const LLUUID& id = mUUIDs.front();
+
+ return gObjectList.findObject(id);
+ }
+ else if (item == std::string("can_show_on_map"))
+ {
+ const LLUUID& id = mUUIDs.front();
+
+ return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id))
+ || gAgent.isGodlike();
+ }
+ else if(item == std::string("can_offer_teleport"))
+ {
+ return LLAvatarActions::canOfferTeleport(mUUIDs);
+ }
+ else if (item == std::string("can_callog"))
+ {
+ return LLLogChat::isTranscriptExist(mUUIDs.front());
+ }
+ else if (item == std::string("can_im") || item == std::string("can_invite") ||
+ item == std::string("can_share") || item == std::string("can_pay"))
+ {
+ return true;
+ }
+ return false;
}
bool PeopleContextMenu::checkContextMenuItem(const LLSD& userdata)
{
- std::string item = userdata.asString();
- const LLUUID& id = mUUIDs.front();
+ std::string item = userdata.asString();
+ const LLUUID& id = mUUIDs.front();
- if (item == std::string("is_blocked"))
- {
- return LLAvatarActions::isBlocked(id);
- }
+ if (item == std::string("is_blocked"))
+ {
+ return LLAvatarActions::isBlocked(id);
+ }
- return false;
+ return false;
}
bool PeopleContextMenu::enableFreezeEject(const LLSD& userdata)
@@ -312,62 +312,62 @@ bool PeopleContextMenu::enableFreezeEject(const LLSD& userdata)
void PeopleContextMenu::requestTeleport()
{
- // boost::bind cannot recognize overloaded method LLAvatarActions::teleportRequest(),
- // so we have to use a wrapper.
- LLAvatarActions::teleportRequest(mUUIDs.front());
+ // boost::bind cannot recognize overloaded method LLAvatarActions::teleportRequest(),
+ // so we have to use a wrapper.
+ LLAvatarActions::teleportRequest(mUUIDs.front());
}
void PeopleContextMenu::offerTeleport()
{
- // boost::bind cannot recognize overloaded method LLAvatarActions::offerTeleport(),
- // so we have to use a wrapper.
- LLAvatarActions::offerTeleport(mUUIDs);
+ // boost::bind cannot recognize overloaded method LLAvatarActions::offerTeleport(),
+ // so we have to use a wrapper.
+ LLAvatarActions::offerTeleport(mUUIDs);
}
void PeopleContextMenu::eject()
{
- if((gAgent.getID() == mUUIDs.front()) || (mUUIDs.size() != 1))
- {
- return;
- }
-
- const LLUUID& id = mUUIDs.front();
-
- // Use avatar_id if available, otherwise default to right-click avatar
- LLVOAvatar* avatar = NULL;
- if (id.notNull())
- {
- LLViewerObject* object = gObjectList.findObject(id);
- if (object)
- {
- if( !object->isAvatar() )
- {
- object = NULL;
- }
- avatar = (LLVOAvatar*) object;
- }
- }
- if (!avatar) return;
- LLSD payload;
- payload["avatar_id"] = avatar->getID();
- std::string fullname = avatar->getFullname();
-
- const LLVector3d& pos = avatar->getPositionGlobal();
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel();
- LLAvatarActions::ejectAvatar(id ,LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED));
+ if((gAgent.getID() == mUUIDs.front()) || (mUUIDs.size() != 1))
+ {
+ return;
+ }
+
+ const LLUUID& id = mUUIDs.front();
+
+ // Use avatar_id if available, otherwise default to right-click avatar
+ LLVOAvatar* avatar = NULL;
+ if (id.notNull())
+ {
+ LLViewerObject* object = gObjectList.findObject(id);
+ if (object)
+ {
+ if( !object->isAvatar() )
+ {
+ object = NULL;
+ }
+ avatar = (LLVOAvatar*) object;
+ }
+ }
+ if (!avatar) return;
+ LLSD payload;
+ payload["avatar_id"] = avatar->getID();
+ std::string fullname = avatar->getFullname();
+
+ const LLVector3d& pos = avatar->getPositionGlobal();
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel();
+ LLAvatarActions::ejectAvatar(id ,LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED));
}
void PeopleContextMenu::startConference()
{
- uuid_vec_t uuids;
- for (uuid_vec_t::const_iterator it = mUUIDs.begin(); it != mUUIDs.end(); ++it)
- {
- if(*it != gAgentID)
- {
- uuids.push_back(*it);
- }
- }
- LLAvatarActions::startConference(uuids);
+ uuid_vec_t uuids;
+ for (uuid_vec_t::const_iterator it = mUUIDs.begin(); it != mUUIDs.end(); ++it)
+ {
+ if(*it != gAgentID)
+ {
+ uuids.push_back(*it);
+ }
+ }
+ LLAvatarActions::startConference(uuids);
}
//== NearbyPeopleContextMenu ===============================================================
@@ -376,38 +376,38 @@ void NearbyPeopleContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags)
{
menuentry_vec_t items;
menuentry_vec_t disabled_items;
-
- if (flags & ITEM_IN_MULTI_SELECTION)
- {
- items.push_back(std::string("add_friends"));
- items.push_back(std::string("remove_friends"));
- items.push_back(std::string("im"));
- items.push_back(std::string("call"));
- items.push_back(std::string("share"));
- items.push_back(std::string("pay"));
- items.push_back(std::string("offer_teleport"));
- }
- else
- {
- items.push_back(std::string("view_profile"));
- items.push_back(std::string("im"));
- items.push_back(std::string("offer_teleport"));
- items.push_back(std::string("request_teleport"));
- items.push_back(std::string("voice_call"));
- items.push_back(std::string("chat_history"));
- items.push_back(std::string("separator_chat_history"));
- items.push_back(std::string("add_friend"));
- items.push_back(std::string("remove_friend"));
- items.push_back(std::string("invite_to_group"));
- items.push_back(std::string("separator_invite_to_group"));
- items.push_back(std::string("zoom_in"));
- items.push_back(std::string("map"));
- items.push_back(std::string("share"));
- items.push_back(std::string("pay"));
- items.push_back(std::string("block_unblock"));
- items.push_back(std::string("freeze"));
- items.push_back(std::string("eject"));
- }
+
+ if (flags & ITEM_IN_MULTI_SELECTION)
+ {
+ items.push_back(std::string("add_friends"));
+ items.push_back(std::string("remove_friends"));
+ items.push_back(std::string("im"));
+ items.push_back(std::string("call"));
+ items.push_back(std::string("share"));
+ items.push_back(std::string("pay"));
+ items.push_back(std::string("offer_teleport"));
+ }
+ else
+ {
+ items.push_back(std::string("view_profile"));
+ items.push_back(std::string("im"));
+ items.push_back(std::string("offer_teleport"));
+ items.push_back(std::string("request_teleport"));
+ items.push_back(std::string("voice_call"));
+ items.push_back(std::string("chat_history"));
+ items.push_back(std::string("separator_chat_history"));
+ items.push_back(std::string("add_friend"));
+ items.push_back(std::string("remove_friend"));
+ items.push_back(std::string("invite_to_group"));
+ items.push_back(std::string("separator_invite_to_group"));
+ items.push_back(std::string("zoom_in"));
+ items.push_back(std::string("map"));
+ items.push_back(std::string("share"));
+ items.push_back(std::string("pay"));
+ items.push_back(std::string("block_unblock"));
+ items.push_back(std::string("freeze"));
+ items.push_back(std::string("eject"));
+ }
hide_context_entries(menu, items, disabled_items);
}
diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h
index 3bc1f8caf7..ad38cebc31 100644
--- a/indra/newview/llpanelpeoplemenus.h
+++ b/indra/newview/llpanelpeoplemenus.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelpeoplemenus.h
* @brief Menus used by the side tray "People" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,19 +38,19 @@ namespace LLPanelPeopleMenus
class PeopleContextMenu : public LLListContextMenu
{
public:
- /*virtual*/ LLContextMenu* createMenu();
+ /*virtual*/ LLContextMenu* createMenu();
protected:
- virtual void buildContextMenu(class LLMenuGL& menu, U32 flags);
+ virtual void buildContextMenu(class LLMenuGL& menu, U32 flags);
private:
- bool enableContextMenuItem(const LLSD& userdata);
- bool checkContextMenuItem(const LLSD& userdata);
- bool enableFreezeEject(const LLSD& userdata);
- void offerTeleport();
- void eject();
- void startConference();
- void requestTeleport();
+ bool enableContextMenuItem(const LLSD& userdata);
+ bool checkContextMenuItem(const LLSD& userdata);
+ bool enableFreezeEject(const LLSD& userdata);
+ void offerTeleport();
+ void eject();
+ void startConference();
+ void requestTeleport();
};
/**
@@ -59,7 +59,7 @@ private:
class NearbyPeopleContextMenu : public PeopleContextMenu
{
protected:
- /*virtual*/ void buildContextMenu(class LLMenuGL& menu, U32 flags);
+ /*virtual*/ void buildContextMenu(class LLMenuGL& menu, U32 flags);
};
extern PeopleContextMenu gPeopleContextMenu;
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp
index 67f913a067..90cfcc6d8a 100644
--- a/indra/newview/llpanelpermissions.cpp
+++ b/indra/newview/llpanelpermissions.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelpermissions.cpp
* @brief LLPanelPermissions class implementation
* This class represents the panel in the build view for
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,7 +48,7 @@
#include "llviewerobject.h"
#include "llselectmgr.h"
#include "llagent.h"
-#include "llstatusbar.h" // for getBalance()
+#include "llstatusbar.h" // for getBalance()
#include "lllineeditor.h"
#include "llcombobox.h"
#include "lluiconstants.h"
@@ -76,71 +76,71 @@ std::string click_action_to_string_value( U8 action);
U8 string_value_to_click_action(std::string p_value)
{
- if (p_value == "Touch")
- {
- return CLICK_ACTION_TOUCH;
- }
- if (p_value == "Sit")
- {
- return CLICK_ACTION_SIT;
- }
- if (p_value == "Buy")
- {
- return CLICK_ACTION_BUY;
- }
- if (p_value == "Pay")
- {
- return CLICK_ACTION_PAY;
- }
- if (p_value == "Open")
- {
- return CLICK_ACTION_OPEN;
- }
- if (p_value == "Zoom")
- {
- return CLICK_ACTION_ZOOM;
- }
- if (p_value == "Ignore")
- {
- return CLICK_ACTION_IGNORE;
- }
- if (p_value == "None")
- {
- return CLICK_ACTION_DISABLED;
- }
- return CLICK_ACTION_TOUCH;
+ if (p_value == "Touch")
+ {
+ return CLICK_ACTION_TOUCH;
+ }
+ if (p_value == "Sit")
+ {
+ return CLICK_ACTION_SIT;
+ }
+ if (p_value == "Buy")
+ {
+ return CLICK_ACTION_BUY;
+ }
+ if (p_value == "Pay")
+ {
+ return CLICK_ACTION_PAY;
+ }
+ if (p_value == "Open")
+ {
+ return CLICK_ACTION_OPEN;
+ }
+ if (p_value == "Zoom")
+ {
+ return CLICK_ACTION_ZOOM;
+ }
+ if (p_value == "Ignore")
+ {
+ return CLICK_ACTION_IGNORE;
+ }
+ if (p_value == "None")
+ {
+ return CLICK_ACTION_DISABLED;
+ }
+ return CLICK_ACTION_TOUCH;
}
std::string click_action_to_string_value( U8 action)
{
- switch (action)
- {
- case CLICK_ACTION_TOUCH:
- default:
- return "Touch";
- break;
- case CLICK_ACTION_SIT:
- return "Sit";
- break;
- case CLICK_ACTION_BUY:
- return "Buy";
- break;
- case CLICK_ACTION_PAY:
- return "Pay";
- break;
- case CLICK_ACTION_OPEN:
- return "Open";
- break;
- case CLICK_ACTION_ZOOM:
- return "Zoom";
- break;
- case CLICK_ACTION_IGNORE:
- return "Ignore";
- break;
- case CLICK_ACTION_DISABLED:
- return "None";
- break;
- }
+ switch (action)
+ {
+ case CLICK_ACTION_TOUCH:
+ default:
+ return "Touch";
+ break;
+ case CLICK_ACTION_SIT:
+ return "Sit";
+ break;
+ case CLICK_ACTION_BUY:
+ return "Buy";
+ break;
+ case CLICK_ACTION_PAY:
+ return "Pay";
+ break;
+ case CLICK_ACTION_OPEN:
+ return "Open";
+ break;
+ case CLICK_ACTION_ZOOM:
+ return "Zoom";
+ break;
+ case CLICK_ACTION_IGNORE:
+ return "Ignore";
+ break;
+ case CLICK_ACTION_DISABLED:
+ return "None";
+ break;
+ }
}
///----------------------------------------------------------------------------
@@ -149,834 +149,834 @@ std::string click_action_to_string_value( U8 action)
// Default constructor
LLPanelPermissions::LLPanelPermissions() :
- LLPanel()
+ LLPanel()
{
- setMouseOpaque(FALSE);
+ setMouseOpaque(FALSE);
}
BOOL LLPanelPermissions::postBuild()
{
- childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this);
- getChild<LLLineEditor>("Object Name")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
- childSetCommitCallback("Object Description",LLPanelPermissions::onCommitDesc,this);
- getChild<LLLineEditor>("Object Description")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
+ childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this);
+ getChild<LLLineEditor>("Object Name")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
+ childSetCommitCallback("Object Description",LLPanelPermissions::onCommitDesc,this);
+ getChild<LLLineEditor>("Object Description")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
+
+
+ getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickGroup,this));
+
+ childSetCommitCallback("checkbox share with group",LLPanelPermissions::onCommitGroupShare,this);
-
- getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickGroup,this));
+ childSetAction("button deed",LLPanelPermissions::onClickDeedToGroup,this);
- childSetCommitCallback("checkbox share with group",LLPanelPermissions::onCommitGroupShare,this);
+ childSetCommitCallback("checkbox allow everyone move",LLPanelPermissions::onCommitEveryoneMove,this);
- childSetAction("button deed",LLPanelPermissions::onClickDeedToGroup,this);
+ childSetCommitCallback("checkbox allow everyone copy",LLPanelPermissions::onCommitEveryoneCopy,this);
- childSetCommitCallback("checkbox allow everyone move",LLPanelPermissions::onCommitEveryoneMove,this);
+ childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this);
- childSetCommitCallback("checkbox allow everyone copy",LLPanelPermissions::onCommitEveryoneCopy,this);
-
- childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this);
+ childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this);
- childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this);
+ childSetCommitCallback("Edit Cost", LLPanelPermissions::onCommitSaleInfo, this);
- childSetCommitCallback("Edit Cost", LLPanelPermissions::onCommitSaleInfo, this);
-
- childSetCommitCallback("checkbox next owner can modify",LLPanelPermissions::onCommitNextOwnerModify,this);
- childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this);
- childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this);
- childSetCommitCallback("clickaction",LLPanelPermissions::onCommitClickAction,this);
- childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this);
-
- mLabelGroupName = getChild<LLNameBox>("Group Name Proxy");
- mLabelOwnerName = getChild<LLTextBox>("Owner Name");
- mLabelCreatorName = getChild<LLTextBox>("Creator Name");
+ childSetCommitCallback("checkbox next owner can modify",LLPanelPermissions::onCommitNextOwnerModify,this);
+ childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this);
+ childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this);
+ childSetCommitCallback("clickaction",LLPanelPermissions::onCommitClickAction,this);
+ childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this);
- return TRUE;
+ mLabelGroupName = getChild<LLNameBox>("Group Name Proxy");
+ mLabelOwnerName = getChild<LLTextBox>("Owner Name");
+ mLabelCreatorName = getChild<LLTextBox>("Creator Name");
+
+ return TRUE;
}
LLPanelPermissions::~LLPanelPermissions()
{
- if (mOwnerCacheConnection.connected())
- {
- mOwnerCacheConnection.disconnect();
- }
- if (mCreatorCacheConnection.connected())
- {
- mCreatorCacheConnection.disconnect();
- }
- // base class will take care of everything
+ if (mOwnerCacheConnection.connected())
+ {
+ mOwnerCacheConnection.disconnect();
+ }
+ if (mCreatorCacheConnection.connected())
+ {
+ mCreatorCacheConnection.disconnect();
+ }
+ // base class will take care of everything
}
void LLPanelPermissions::disableAll()
{
- getChildView("perm_modify")->setEnabled(FALSE);
- getChild<LLUICtrl>("perm_modify")->setValue(LLStringUtil::null);
-
- getChildView("pathfinding_attributes_value")->setEnabled(FALSE);
- getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLStringUtil::null);
-
- getChildView("Creator:")->setEnabled(FALSE);
- getChild<LLUICtrl>("Creator Icon")->setVisible(FALSE);
- mLabelCreatorName->setValue(LLStringUtil::null);
- mLabelCreatorName->setEnabled(FALSE);
-
- getChildView("Owner:")->setEnabled(FALSE);
- getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE);
- getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE);
- mLabelOwnerName->setValue(LLStringUtil::null);
- mLabelOwnerName->setEnabled(FALSE);
-
- getChildView("Group:")->setEnabled(FALSE);
- getChild<LLUICtrl>("Group Name Proxy")->setValue(LLStringUtil::null);
- getChildView("Group Name Proxy")->setEnabled(FALSE);
- getChildView("button set group")->setEnabled(FALSE);
-
- getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
- getChildView("Object Name")->setEnabled(FALSE);
- getChildView("Name:")->setEnabled(FALSE);
- getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
- getChildView("Group Name")->setEnabled(FALSE);
- getChildView("Description:")->setEnabled(FALSE);
- getChild<LLUICtrl>("Object Description")->setValue(LLStringUtil::null);
- getChildView("Object Description")->setEnabled(FALSE);
-
- getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE);
- getChildView("checkbox share with group")->setEnabled(FALSE);
- getChildView("button deed")->setEnabled(FALSE);
-
- getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE);
- getChildView("checkbox allow everyone move")->setEnabled(FALSE);
- getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE);
- getChildView("checkbox allow everyone copy")->setEnabled(FALSE);
-
- //Next owner can:
- getChildView("Next owner can:")->setEnabled(FALSE);
- getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE);
- getChildView("checkbox next owner can modify")->setEnabled(FALSE);
- getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE);
- getChildView("checkbox next owner can copy")->setEnabled(FALSE);
- getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE);
- getChildView("checkbox next owner can transfer")->setEnabled(FALSE);
-
- //checkbox for sale
- getChild<LLUICtrl>("checkbox for sale")->setValue(FALSE);
- getChildView("checkbox for sale")->setEnabled(FALSE);
-
- //checkbox include in search
- getChild<LLUICtrl>("search_check")->setValue(FALSE);
- getChildView("search_check")->setEnabled(FALSE);
-
- LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type");
- combo_sale_type->setValue(LLSaleInfo::FS_COPY);
- combo_sale_type->setEnabled(FALSE);
-
- getChildView("Cost")->setEnabled(FALSE);
- getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
- getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
- getChildView("Edit Cost")->setEnabled(FALSE);
-
- getChildView("label click action")->setEnabled(FALSE);
- LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction");
- if (combo_click_action)
- {
- combo_click_action->setEnabled(FALSE);
- combo_click_action->clear();
- }
- getChildView("B:")->setVisible(FALSE);
- getChildView("O:")->setVisible(FALSE);
- getChildView("G:")->setVisible(FALSE);
- getChildView("E:")->setVisible(FALSE);
- getChildView("N:")->setVisible(FALSE);
- getChildView("F:")->setVisible(FALSE);
+ getChildView("perm_modify")->setEnabled(FALSE);
+ getChild<LLUICtrl>("perm_modify")->setValue(LLStringUtil::null);
+
+ getChildView("pathfinding_attributes_value")->setEnabled(FALSE);
+ getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLStringUtil::null);
+
+ getChildView("Creator:")->setEnabled(FALSE);
+ getChild<LLUICtrl>("Creator Icon")->setVisible(FALSE);
+ mLabelCreatorName->setValue(LLStringUtil::null);
+ mLabelCreatorName->setEnabled(FALSE);
+
+ getChildView("Owner:")->setEnabled(FALSE);
+ getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE);
+ getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE);
+ mLabelOwnerName->setValue(LLStringUtil::null);
+ mLabelOwnerName->setEnabled(FALSE);
+
+ getChildView("Group:")->setEnabled(FALSE);
+ getChild<LLUICtrl>("Group Name Proxy")->setValue(LLStringUtil::null);
+ getChildView("Group Name Proxy")->setEnabled(FALSE);
+ getChildView("button set group")->setEnabled(FALSE);
+
+ getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
+ getChildView("Object Name")->setEnabled(FALSE);
+ getChildView("Name:")->setEnabled(FALSE);
+ getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
+ getChildView("Group Name")->setEnabled(FALSE);
+ getChildView("Description:")->setEnabled(FALSE);
+ getChild<LLUICtrl>("Object Description")->setValue(LLStringUtil::null);
+ getChildView("Object Description")->setEnabled(FALSE);
+
+ getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE);
+ getChildView("checkbox share with group")->setEnabled(FALSE);
+ getChildView("button deed")->setEnabled(FALSE);
+
+ getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE);
+ getChildView("checkbox allow everyone move")->setEnabled(FALSE);
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE);
+ getChildView("checkbox allow everyone copy")->setEnabled(FALSE);
+
+ //Next owner can:
+ getChildView("Next owner can:")->setEnabled(FALSE);
+ getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE);
+ getChildView("checkbox next owner can modify")->setEnabled(FALSE);
+ getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE);
+ getChildView("checkbox next owner can copy")->setEnabled(FALSE);
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE);
+ getChildView("checkbox next owner can transfer")->setEnabled(FALSE);
+
+ //checkbox for sale
+ getChild<LLUICtrl>("checkbox for sale")->setValue(FALSE);
+ getChildView("checkbox for sale")->setEnabled(FALSE);
+
+ //checkbox include in search
+ getChild<LLUICtrl>("search_check")->setValue(FALSE);
+ getChildView("search_check")->setEnabled(FALSE);
+
+ LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type");
+ combo_sale_type->setValue(LLSaleInfo::FS_COPY);
+ combo_sale_type->setEnabled(FALSE);
+
+ getChildView("Cost")->setEnabled(FALSE);
+ getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
+ getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
+ getChildView("Edit Cost")->setEnabled(FALSE);
+
+ getChildView("label click action")->setEnabled(FALSE);
+ LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction");
+ if (combo_click_action)
+ {
+ combo_click_action->setEnabled(FALSE);
+ combo_click_action->clear();
+ }
+ getChildView("B:")->setVisible(FALSE);
+ getChildView("O:")->setVisible(FALSE);
+ getChildView("G:")->setVisible(FALSE);
+ getChildView("E:")->setVisible(FALSE);
+ getChildView("N:")->setVisible(FALSE);
+ getChildView("F:")->setVisible(FALSE);
}
void LLPanelPermissions::refresh()
{
- LLButton* BtnDeedToGroup = getChild<LLButton>("button deed");
- if(BtnDeedToGroup)
- {
- std::string deedText;
- if (gWarningSettings.getBOOL("DeedObject"))
- {
- deedText = getString("text deed continued");
- }
- else
- {
- deedText = getString("text deed");
- }
- BtnDeedToGroup->setLabelSelected(deedText);
- BtnDeedToGroup->setLabelUnselected(deedText);
- }
- BOOL root_selected = TRUE;
- LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- S32 object_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount();
- if(!nodep || 0 == object_count)
- {
- nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode();
- object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
- root_selected = FALSE;
- }
-
- //BOOL attachment_selected = LLSelectMgr::getInstance()->getSelection()->isAttachment();
- //attachment_selected = false;
- LLViewerObject* objectp = NULL;
- if(nodep) objectp = nodep->getObject();
- if(!nodep || !objectp)// || attachment_selected)
- {
- // ...nothing selected
- disableAll();
- return;
- }
-
- // figure out a few variables
- const BOOL is_one_object = (object_count == 1);
-
- // BUG: fails if a root and non-root are both single-selected.
- BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
- && LLSelectMgr::getInstance()->selectGetRootsModify())
- || LLSelectMgr::getInstance()->selectGetModify();
- BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
- && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced())
- || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced();
- const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus();
-
- S32 string_index = 0;
- std::string MODIFY_INFO_STRINGS[] =
- {
- getString("text modify info 1"),
- getString("text modify info 2"),
- getString("text modify info 3"),
- getString("text modify info 4"),
- getString("text modify info 5"),
- getString("text modify info 6")
- };
- if (!is_perm_modify)
- {
- string_index += 2;
- }
- else if (!is_nonpermanent_enforced)
- {
- string_index += 4;
- }
- if (!is_one_object)
- {
- ++string_index;
- }
- getChildView("perm_modify")->setEnabled(TRUE);
- getChild<LLUICtrl>("perm_modify")->setValue(MODIFY_INFO_STRINGS[string_index]);
-
- std::string pfAttrName;
-
- if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
- && LLSelectMgr::getInstance()->selectGetRootsNonPathfinding())
- || LLSelectMgr::getInstance()->selectGetNonPathfinding())
- {
- pfAttrName = "Pathfinding_Object_Attr_None";
- }
- else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
- && LLSelectMgr::getInstance()->selectGetRootsPermanent())
- || LLSelectMgr::getInstance()->selectGetPermanent())
- {
- pfAttrName = "Pathfinding_Object_Attr_Permanent";
- }
- else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
- && LLSelectMgr::getInstance()->selectGetRootsCharacter())
- || LLSelectMgr::getInstance()->selectGetCharacter())
- {
- pfAttrName = "Pathfinding_Object_Attr_Character";
- }
- else
- {
- pfAttrName = "Pathfinding_Object_Attr_MultiSelect";
- }
-
- getChildView("pathfinding_attributes_value")->setEnabled(TRUE);
- getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLTrans::getString(pfAttrName));
-
- // Update creator text field
- getChildView("Creator:")->setEnabled(TRUE);
- std::string creator_app_link;
- LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_app_link);
-
- // Style for creator and owner links (both group and agent)
- LLStyle::Params style_params;
- LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
- style_params.color = link_color;
- style_params.readonly_color = link_color;
- style_params.is_link = true; // link will be added later
- const LLFontGL* fontp = mLabelCreatorName->getFont();
- style_params.font.name = LLFontGL::nameFromFont(fontp);
- style_params.font.size = LLFontGL::sizeFromFont(fontp);
- style_params.font.style = "UNDERLINE";
-
- LLAvatarName av_name;
- style_params.link_href = creator_app_link;
- if (LLAvatarNameCache::get(mCreatorID, &av_name))
- {
- updateCreatorName(mCreatorID, av_name, style_params);
- }
- else
- {
- if (mCreatorCacheConnection.connected())
- {
- mCreatorCacheConnection.disconnect();
- }
- mLabelCreatorName->setText(LLTrans::getString("None"));
- mCreatorCacheConnection = LLAvatarNameCache::get(mCreatorID, boost::bind(&LLPanelPermissions::updateCreatorName, this, _1, _2, style_params));
- }
- getChild<LLAvatarIconCtrl>("Creator Icon")->setValue(mCreatorID);
- getChild<LLAvatarIconCtrl>("Creator Icon")->setVisible(TRUE);
- mLabelCreatorName->setEnabled(TRUE);
-
- // Update owner text field
- getChildView("Owner:")->setEnabled(TRUE);
-
- std::string owner_app_link;
- const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_app_link);
-
-
- if (LLSelectMgr::getInstance()->selectIsGroupOwned())
- {
- // Group owned already displayed by selectGetOwner
- LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mOwnerID);
- if (group_data && group_data->isGroupPropertiesDataComplete())
- {
- style_params.link_href = owner_app_link;
- mLabelOwnerName->setText(group_data->mName, style_params);
- getChild<LLGroupIconCtrl>("Owner Group Icon")->setIconId(group_data->mInsigniaID);
- getChild<LLGroupIconCtrl>("Owner Group Icon")->setVisible(TRUE);
- getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE);
- }
- else
- {
- // Triggers refresh
- LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mOwnerID);
- }
- }
- else
- {
- LLUUID owner_id = mOwnerID;
- if (owner_id.isNull())
- {
- // Display last owner if public
- std::string last_owner_app_link;
- LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_app_link);
-
- // It should never happen that the last owner is null and the owner
- // is null, but it seems to be a bug in the simulator right now. JC
- if (!mLastOwnerID.isNull() && !last_owner_app_link.empty())
- {
- owner_app_link.append(", last ");
- owner_app_link.append(last_owner_app_link);
- }
- owner_id = mLastOwnerID;
- }
-
- style_params.link_href = owner_app_link;
- if (LLAvatarNameCache::get(owner_id, &av_name))
- {
- updateOwnerName(owner_id, av_name, style_params);
- }
- else
- {
- if (mOwnerCacheConnection.connected())
- {
- mOwnerCacheConnection.disconnect();
- }
- mLabelOwnerName->setText(LLTrans::getString("None"));
- mOwnerCacheConnection = LLAvatarNameCache::get(owner_id, boost::bind(&LLPanelPermissions::updateOwnerName, this, _1, _2, style_params));
- }
-
- getChild<LLAvatarIconCtrl>("Owner Icon")->setValue(owner_id);
- getChild<LLAvatarIconCtrl>("Owner Icon")->setVisible(TRUE);
- getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE);
- }
- mLabelOwnerName->setEnabled(TRUE);
-
- // update group text field
- getChildView("Group:")->setEnabled(TRUE);
- getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
- LLUUID group_id;
- BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
- if (groups_identical)
- {
- if (mLabelGroupName)
- {
- mLabelGroupName->setNameID(group_id,TRUE);
- mLabelGroupName->setEnabled(TRUE);
- }
- }
- else
- {
- if (mLabelGroupName)
- {
- mLabelGroupName->setNameID(LLUUID::null, TRUE);
- mLabelGroupName->refresh(LLUUID::null, std::string(), true);
- mLabelGroupName->setEnabled(FALSE);
- }
- }
-
- getChildView("button set group")->setEnabled(root_selected && owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced);
-
- getChildView("Name:")->setEnabled(TRUE);
- LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name");
- getChildView("Description:")->setEnabled(TRUE);
- LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description");
-
- if (is_one_object)
- {
- if (keyboard_focus_view != LineEditorObjectName)
- {
- getChild<LLUICtrl>("Object Name")->setValue(nodep->mName);
- }
-
- if (LineEditorObjectDesc)
- {
- if (keyboard_focus_view != LineEditorObjectDesc)
- {
- LineEditorObjectDesc->setText(nodep->mDescription);
- }
- }
- }
- else
- {
- getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
- LineEditorObjectDesc->setText(LLStringUtil::null);
- }
-
- // figure out the contents of the name, description, & category
- BOOL edit_name_desc = FALSE;
- if (is_one_object && objectp->permModify() && !objectp->isPermanentEnforced())
- {
- edit_name_desc = TRUE;
- }
- if (edit_name_desc)
- {
- getChildView("Object Name")->setEnabled(TRUE);
- getChildView("Object Description")->setEnabled(TRUE);
- }
- else
- {
- getChildView("Object Name")->setEnabled(FALSE);
- getChildView("Object Description")->setEnabled(FALSE);
- }
-
- S32 total_sale_price = 0;
- S32 individual_sale_price = 0;
- BOOL is_for_sale_mixed = FALSE;
- BOOL is_sale_price_mixed = FALSE;
- U32 num_for_sale = FALSE;
+ LLButton* BtnDeedToGroup = getChild<LLButton>("button deed");
+ if(BtnDeedToGroup)
+ {
+ std::string deedText;
+ if (gWarningSettings.getBOOL("DeedObject"))
+ {
+ deedText = getString("text deed continued");
+ }
+ else
+ {
+ deedText = getString("text deed");
+ }
+ BtnDeedToGroup->setLabelSelected(deedText);
+ BtnDeedToGroup->setLabelUnselected(deedText);
+ }
+ BOOL root_selected = TRUE;
+ LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ S32 object_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount();
+ if(!nodep || 0 == object_count)
+ {
+ nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode();
+ object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
+ root_selected = FALSE;
+ }
+
+ //BOOL attachment_selected = LLSelectMgr::getInstance()->getSelection()->isAttachment();
+ //attachment_selected = false;
+ LLViewerObject* objectp = NULL;
+ if(nodep) objectp = nodep->getObject();
+ if(!nodep || !objectp)// || attachment_selected)
+ {
+ // ...nothing selected
+ disableAll();
+ return;
+ }
+
+ // figure out a few variables
+ const BOOL is_one_object = (object_count == 1);
+
+ // BUG: fails if a root and non-root are both single-selected.
+ BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
+ && LLSelectMgr::getInstance()->selectGetRootsModify())
+ || LLSelectMgr::getInstance()->selectGetModify();
+ BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
+ && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced())
+ || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced();
+ const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus();
+
+ S32 string_index = 0;
+ std::string MODIFY_INFO_STRINGS[] =
+ {
+ getString("text modify info 1"),
+ getString("text modify info 2"),
+ getString("text modify info 3"),
+ getString("text modify info 4"),
+ getString("text modify info 5"),
+ getString("text modify info 6")
+ };
+ if (!is_perm_modify)
+ {
+ string_index += 2;
+ }
+ else if (!is_nonpermanent_enforced)
+ {
+ string_index += 4;
+ }
+ if (!is_one_object)
+ {
+ ++string_index;
+ }
+ getChildView("perm_modify")->setEnabled(TRUE);
+ getChild<LLUICtrl>("perm_modify")->setValue(MODIFY_INFO_STRINGS[string_index]);
+
+ std::string pfAttrName;
+
+ if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
+ && LLSelectMgr::getInstance()->selectGetRootsNonPathfinding())
+ || LLSelectMgr::getInstance()->selectGetNonPathfinding())
+ {
+ pfAttrName = "Pathfinding_Object_Attr_None";
+ }
+ else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
+ && LLSelectMgr::getInstance()->selectGetRootsPermanent())
+ || LLSelectMgr::getInstance()->selectGetPermanent())
+ {
+ pfAttrName = "Pathfinding_Object_Attr_Permanent";
+ }
+ else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
+ && LLSelectMgr::getInstance()->selectGetRootsCharacter())
+ || LLSelectMgr::getInstance()->selectGetCharacter())
+ {
+ pfAttrName = "Pathfinding_Object_Attr_Character";
+ }
+ else
+ {
+ pfAttrName = "Pathfinding_Object_Attr_MultiSelect";
+ }
+
+ getChildView("pathfinding_attributes_value")->setEnabled(TRUE);
+ getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLTrans::getString(pfAttrName));
+
+ // Update creator text field
+ getChildView("Creator:")->setEnabled(TRUE);
+ std::string creator_app_link;
+ LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_app_link);
+
+ // Style for creator and owner links (both group and agent)
+ LLStyle::Params style_params;
+ LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
+ style_params.color = link_color;
+ style_params.readonly_color = link_color;
+ style_params.is_link = true; // link will be added later
+ const LLFontGL* fontp = mLabelCreatorName->getFont();
+ style_params.font.name = LLFontGL::nameFromFont(fontp);
+ style_params.font.size = LLFontGL::sizeFromFont(fontp);
+ style_params.font.style = "UNDERLINE";
+
+ LLAvatarName av_name;
+ style_params.link_href = creator_app_link;
+ if (LLAvatarNameCache::get(mCreatorID, &av_name))
+ {
+ updateCreatorName(mCreatorID, av_name, style_params);
+ }
+ else
+ {
+ if (mCreatorCacheConnection.connected())
+ {
+ mCreatorCacheConnection.disconnect();
+ }
+ mLabelCreatorName->setText(LLTrans::getString("None"));
+ mCreatorCacheConnection = LLAvatarNameCache::get(mCreatorID, boost::bind(&LLPanelPermissions::updateCreatorName, this, _1, _2, style_params));
+ }
+ getChild<LLAvatarIconCtrl>("Creator Icon")->setValue(mCreatorID);
+ getChild<LLAvatarIconCtrl>("Creator Icon")->setVisible(TRUE);
+ mLabelCreatorName->setEnabled(TRUE);
+
+ // Update owner text field
+ getChildView("Owner:")->setEnabled(TRUE);
+
+ std::string owner_app_link;
+ const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_app_link);
+
+
+ if (LLSelectMgr::getInstance()->selectIsGroupOwned())
+ {
+ // Group owned already displayed by selectGetOwner
+ LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mOwnerID);
+ if (group_data && group_data->isGroupPropertiesDataComplete())
+ {
+ style_params.link_href = owner_app_link;
+ mLabelOwnerName->setText(group_data->mName, style_params);
+ getChild<LLGroupIconCtrl>("Owner Group Icon")->setIconId(group_data->mInsigniaID);
+ getChild<LLGroupIconCtrl>("Owner Group Icon")->setVisible(TRUE);
+ getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE);
+ }
+ else
+ {
+ // Triggers refresh
+ LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mOwnerID);
+ }
+ }
+ else
+ {
+ LLUUID owner_id = mOwnerID;
+ if (owner_id.isNull())
+ {
+ // Display last owner if public
+ std::string last_owner_app_link;
+ LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_app_link);
+
+ // It should never happen that the last owner is null and the owner
+ // is null, but it seems to be a bug in the simulator right now. JC
+ if (!mLastOwnerID.isNull() && !last_owner_app_link.empty())
+ {
+ owner_app_link.append(", last ");
+ owner_app_link.append(last_owner_app_link);
+ }
+ owner_id = mLastOwnerID;
+ }
+
+ style_params.link_href = owner_app_link;
+ if (LLAvatarNameCache::get(owner_id, &av_name))
+ {
+ updateOwnerName(owner_id, av_name, style_params);
+ }
+ else
+ {
+ if (mOwnerCacheConnection.connected())
+ {
+ mOwnerCacheConnection.disconnect();
+ }
+ mLabelOwnerName->setText(LLTrans::getString("None"));
+ mOwnerCacheConnection = LLAvatarNameCache::get(owner_id, boost::bind(&LLPanelPermissions::updateOwnerName, this, _1, _2, style_params));
+ }
+
+ getChild<LLAvatarIconCtrl>("Owner Icon")->setValue(owner_id);
+ getChild<LLAvatarIconCtrl>("Owner Icon")->setVisible(TRUE);
+ getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE);
+ }
+ mLabelOwnerName->setEnabled(TRUE);
+
+ // update group text field
+ getChildView("Group:")->setEnabled(TRUE);
+ getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
+ LLUUID group_id;
+ BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
+ if (groups_identical)
+ {
+ if (mLabelGroupName)
+ {
+ mLabelGroupName->setNameID(group_id,TRUE);
+ mLabelGroupName->setEnabled(TRUE);
+ }
+ }
+ else
+ {
+ if (mLabelGroupName)
+ {
+ mLabelGroupName->setNameID(LLUUID::null, TRUE);
+ mLabelGroupName->refresh(LLUUID::null, std::string(), true);
+ mLabelGroupName->setEnabled(FALSE);
+ }
+ }
+
+ getChildView("button set group")->setEnabled(root_selected && owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced);
+
+ getChildView("Name:")->setEnabled(TRUE);
+ LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name");
+ getChildView("Description:")->setEnabled(TRUE);
+ LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description");
+
+ if (is_one_object)
+ {
+ if (keyboard_focus_view != LineEditorObjectName)
+ {
+ getChild<LLUICtrl>("Object Name")->setValue(nodep->mName);
+ }
+
+ if (LineEditorObjectDesc)
+ {
+ if (keyboard_focus_view != LineEditorObjectDesc)
+ {
+ LineEditorObjectDesc->setText(nodep->mDescription);
+ }
+ }
+ }
+ else
+ {
+ getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
+ LineEditorObjectDesc->setText(LLStringUtil::null);
+ }
+
+ // figure out the contents of the name, description, & category
+ BOOL edit_name_desc = FALSE;
+ if (is_one_object && objectp->permModify() && !objectp->isPermanentEnforced())
+ {
+ edit_name_desc = TRUE;
+ }
+ if (edit_name_desc)
+ {
+ getChildView("Object Name")->setEnabled(TRUE);
+ getChildView("Object Description")->setEnabled(TRUE);
+ }
+ else
+ {
+ getChildView("Object Name")->setEnabled(FALSE);
+ getChildView("Object Description")->setEnabled(FALSE);
+ }
+
+ S32 total_sale_price = 0;
+ S32 individual_sale_price = 0;
+ BOOL is_for_sale_mixed = FALSE;
+ BOOL is_sale_price_mixed = FALSE;
+ U32 num_for_sale = FALSE;
LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale,
- is_for_sale_mixed,
- is_sale_price_mixed,
- total_sale_price,
- individual_sale_price);
-
- const BOOL self_owned = (gAgent.getID() == mOwnerID);
- const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ;
- const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned());
- const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer();
- const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy();
-
- if (!owners_identical)
- {
- getChildView("Cost")->setEnabled(FALSE);
- getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
- getChildView("Edit Cost")->setEnabled(FALSE);
- }
- // You own these objects.
- else if (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE)))
- {
- // If there are multiple items for sale then set text to PRICE PER UNIT.
- if (num_for_sale > 1)
- {
- getChild<LLUICtrl>("Cost")->setValue(getString("Cost Per Unit"));
- }
- else
- {
- getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
- }
-
- LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost");
- if (!edit_price->hasFocus())
- {
- // If the sale price is mixed then set the cost to MIXED, otherwise
- // set to the actual cost.
- if ((num_for_sale > 0) && is_for_sale_mixed)
- {
- edit_price->setTentative(TRUE);
- }
- else if ((num_for_sale > 0) && is_sale_price_mixed)
- {
- edit_price->setTentative(TRUE);
- }
- else
- {
- edit_price->setValue(individual_sale_price);
- }
- }
- // The edit fields are only enabled if you can sell this object
- // and the sale price is not mixed.
- BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE;
- getChildView("Cost")->setEnabled(enable_edit);
- getChildView("Edit Cost")->setEnabled(enable_edit);
- }
- // Someone, not you, owns these objects.
- else if (!public_owned)
- {
- getChildView("Cost")->setEnabled(FALSE);
- getChildView("Edit Cost")->setEnabled(FALSE);
-
- // Don't show a price if none of the items are for sale.
- if (num_for_sale)
- getChild<LLUICtrl>("Edit Cost")->setValue(llformat("%d",total_sale_price));
- else
- getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
-
- // If multiple items are for sale, set text to TOTAL PRICE.
- if (num_for_sale > 1)
- getChild<LLUICtrl>("Cost")->setValue(getString("Cost Total"));
- else
- getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
- }
- // This is a public object.
- else
- {
- getChildView("Cost")->setEnabled(FALSE);
- getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
-
- getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
- getChildView("Edit Cost")->setEnabled(FALSE);
- }
-
- // Enable and disable the permissions checkboxes
- // based on who owns the object.
- // TODO: Creator permissions
-
- U32 base_mask_on = 0;
- U32 base_mask_off = 0;
- U32 owner_mask_off = 0;
- U32 owner_mask_on = 0;
- U32 group_mask_on = 0;
- U32 group_mask_off = 0;
- U32 everyone_mask_on = 0;
- U32 everyone_mask_off = 0;
- U32 next_owner_mask_on = 0;
- U32 next_owner_mask_off = 0;
-
- BOOL valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE,
- &base_mask_on,
- &base_mask_off);
- //BOOL valid_owner_perms =//
- LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER,
- &owner_mask_on,
- &owner_mask_off);
- BOOL valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP,
- &group_mask_on,
- &group_mask_off);
-
- BOOL valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE,
- &everyone_mask_on,
- &everyone_mask_off);
-
- BOOL valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER,
- &next_owner_mask_on,
- &next_owner_mask_off);
-
-
- if (gSavedSettings.getBOOL("DebugPermissions") )
- {
- if (valid_base_perms)
- {
- getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string(base_mask_on));
- getChildView("B:")->setVisible(TRUE);
- getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(owner_mask_on));
- getChildView("O:")->setVisible(TRUE);
- getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(group_mask_on));
- getChildView("G:")->setVisible(TRUE);
- getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(everyone_mask_on));
- getChildView("E:")->setVisible(TRUE);
- getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(next_owner_mask_on));
- getChildView("N:")->setVisible(TRUE);
- }
- else if(!root_selected)
- {
- if(object_count == 1)
- {
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode();
- if (node && node->mValid)
- {
- getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string( node->mPermissions->getMaskBase()));
- getChildView("B:")->setVisible(TRUE);
- getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(node->mPermissions->getMaskOwner()));
- getChildView("O:")->setVisible(TRUE);
- getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(node->mPermissions->getMaskGroup()));
- getChildView("G:")->setVisible(TRUE);
- getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(node->mPermissions->getMaskEveryone()));
- getChildView("E:")->setVisible(TRUE);
- getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(node->mPermissions->getMaskNextOwner()));
- getChildView("N:")->setVisible(TRUE);
- }
- }
- }
- else
- {
- getChildView("B:")->setVisible(FALSE);
- getChildView("O:")->setVisible(FALSE);
- getChildView("G:")->setVisible(FALSE);
- getChildView("E:")->setVisible(FALSE);
- getChildView("N:")->setVisible(FALSE);
- }
-
- U32 flag_mask = 0x0;
- if (objectp->permMove()) flag_mask |= PERM_MOVE;
- if (objectp->permModify()) flag_mask |= PERM_MODIFY;
- if (objectp->permCopy()) flag_mask |= PERM_COPY;
- if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER;
-
- getChild<LLUICtrl>("F:")->setValue("F:" + mask_to_string(flag_mask));
- getChildView("F:")->setVisible( TRUE);
- }
- else
- {
- getChildView("B:")->setVisible( FALSE);
- getChildView("O:")->setVisible( FALSE);
- getChildView("G:")->setVisible( FALSE);
- getChildView("E:")->setVisible( FALSE);
- getChildView("N:")->setVisible( FALSE);
- getChildView("F:")->setVisible( FALSE);
- }
-
- BOOL has_change_perm_ability = FALSE;
- BOOL has_change_sale_ability = FALSE;
-
- if (valid_base_perms && is_nonpermanent_enforced &&
- (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE))))
- {
- has_change_perm_ability = TRUE;
- }
- if (valid_base_perms && is_nonpermanent_enforced &&
- (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE))))
- {
- has_change_sale_ability = TRUE;
- }
-
- if (!has_change_perm_ability && !has_change_sale_ability && !root_selected)
- {
- // ...must select root to choose permissions
- getChild<LLUICtrl>("perm_modify")->setValue(getString("text modify warning"));
- }
-
- if (has_change_perm_ability)
- {
- getChildView("checkbox share with group")->setEnabled(TRUE);
- getChildView("checkbox allow everyone move")->setEnabled(owner_mask_on & PERM_MOVE);
- getChildView("checkbox allow everyone copy")->setEnabled(owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER);
- }
- else
- {
- getChildView("checkbox share with group")->setEnabled(FALSE);
- getChildView("checkbox allow everyone move")->setEnabled(FALSE);
- getChildView("checkbox allow everyone copy")->setEnabled(FALSE);
- }
-
- if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER))
- {
- getChildView("checkbox for sale")->setEnabled(can_transfer || (!can_transfer && num_for_sale));
- // Set the checkbox to tentative if the prices of each object selected
- // are not the same.
- getChild<LLUICtrl>("checkbox for sale")->setTentative( is_for_sale_mixed);
- getChildView("sale type")->setEnabled(num_for_sale && can_transfer && !is_sale_price_mixed);
-
- getChildView("Next owner can:")->setEnabled(TRUE);
- getChildView("checkbox next owner can modify")->setEnabled(base_mask_on & PERM_MODIFY);
- getChildView("checkbox next owner can copy")->setEnabled(base_mask_on & PERM_COPY);
- getChildView("checkbox next owner can transfer")->setEnabled(next_owner_mask_on & PERM_COPY);
- }
- else
- {
- getChildView("checkbox for sale")->setEnabled(FALSE);
- getChildView("sale type")->setEnabled(FALSE);
-
- getChildView("Next owner can:")->setEnabled(FALSE);
- getChildView("checkbox next owner can modify")->setEnabled(FALSE);
- getChildView("checkbox next owner can copy")->setEnabled(FALSE);
- getChildView("checkbox next owner can transfer")->setEnabled(FALSE);
- }
-
- if (valid_group_perms)
- {
- if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE))
- {
- getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE);
- getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer);
- }
- else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE))
- {
- getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE);
- getChildView("button deed")->setEnabled(FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox share with group")->setTentative(!has_change_perm_ability);
- getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer);
- }
- }
-
- if (valid_everyone_perms)
- {
- // Move
- if (everyone_mask_on & PERM_MOVE)
- {
- getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE);
- }
- else if (everyone_mask_off & PERM_MOVE)
- {
- getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( TRUE);
- }
-
- // Copy == everyone can't copy
- if (everyone_mask_on & PERM_COPY)
- {
- getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( !can_copy || !can_transfer);
- }
- else if (everyone_mask_off & PERM_COPY)
- {
- getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( TRUE);
- }
- }
-
- if (valid_next_perms)
- {
- // Modify == next owner canot modify
- if (next_owner_mask_on & PERM_MODIFY)
- {
- getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE);
- }
- else if (next_owner_mask_off & PERM_MODIFY)
- {
- getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( TRUE);
- }
-
- // Copy == next owner cannot copy
- if (next_owner_mask_on & PERM_COPY)
- {
- getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( !can_copy);
- }
- else if (next_owner_mask_off & PERM_COPY)
- {
- getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( TRUE);
- }
-
- // Transfer == next owner cannot transfer
- if (next_owner_mask_on & PERM_TRANSFER)
- {
- getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( !can_transfer);
- }
- else if (next_owner_mask_off & PERM_TRANSFER)
- {
- getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( TRUE);
- }
- }
-
- // reflect sale information
- LLSaleInfo sale_info;
- BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
- LLSaleInfo::EForSale sale_type = sale_info.getSaleType();
-
- LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type");
- if (valid_sale_info)
- {
- combo_sale_type->setValue( sale_type == LLSaleInfo::FS_NOT ? LLSaleInfo::FS_COPY : sale_type);
- combo_sale_type->setTentative( FALSE); // unfortunately this doesn't do anything at the moment.
- }
- else
- {
- // default option is sell copy, determined to be safest
- combo_sale_type->setValue( LLSaleInfo::FS_COPY);
- combo_sale_type->setTentative( TRUE); // unfortunately this doesn't do anything at the moment.
- }
-
- getChild<LLUICtrl>("checkbox for sale")->setValue((num_for_sale != 0));
-
- // HACK: There are some old objects in world that are set for sale,
- // but are no-transfer. We need to let users turn for-sale off, but only
- // if for-sale is set.
- bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY);
- if (cannot_actually_sell)
- {
- if (num_for_sale && has_change_sale_ability)
- {
- getChildView("checkbox for sale")->setEnabled(true);
- }
- }
-
- // Check search status of objects
- const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
- bool include_in_search;
- const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search);
- getChildView("search_check")->setEnabled(has_change_sale_ability && all_volume);
- getChild<LLUICtrl>("search_check")->setValue(include_in_search);
- getChild<LLUICtrl>("search_check")->setTentative( !all_include_in_search);
-
- // Click action (touch, sit, buy, pay, open, play, open media, zoom, ignore)
- U8 click_action = 0;
- if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action))
- {
- LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction");
- if (combo_click_action)
- {
- const std::string combo_value = click_action_to_string_value(click_action);
- combo_click_action->setValue(LLSD(combo_value));
- }
- }
-
- if (LLSelectMgr::getInstance()->getSelection()->isAttachment())
- {
- getChildView("checkbox for sale")->setEnabled(FALSE);
- getChildView("Edit Cost")->setEnabled(FALSE);
- getChild<LLComboBox>("sale type")->setEnabled(FALSE);
- }
-
- getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume);
- getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume);
+ is_for_sale_mixed,
+ is_sale_price_mixed,
+ total_sale_price,
+ individual_sale_price);
+
+ const BOOL self_owned = (gAgent.getID() == mOwnerID);
+ const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ;
+ const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned());
+ const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer();
+ const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy();
+
+ if (!owners_identical)
+ {
+ getChildView("Cost")->setEnabled(FALSE);
+ getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
+ getChildView("Edit Cost")->setEnabled(FALSE);
+ }
+ // You own these objects.
+ else if (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE)))
+ {
+ // If there are multiple items for sale then set text to PRICE PER UNIT.
+ if (num_for_sale > 1)
+ {
+ getChild<LLUICtrl>("Cost")->setValue(getString("Cost Per Unit"));
+ }
+ else
+ {
+ getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
+ }
+
+ LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost");
+ if (!edit_price->hasFocus())
+ {
+ // If the sale price is mixed then set the cost to MIXED, otherwise
+ // set to the actual cost.
+ if ((num_for_sale > 0) && is_for_sale_mixed)
+ {
+ edit_price->setTentative(TRUE);
+ }
+ else if ((num_for_sale > 0) && is_sale_price_mixed)
+ {
+ edit_price->setTentative(TRUE);
+ }
+ else
+ {
+ edit_price->setValue(individual_sale_price);
+ }
+ }
+ // The edit fields are only enabled if you can sell this object
+ // and the sale price is not mixed.
+ BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE;
+ getChildView("Cost")->setEnabled(enable_edit);
+ getChildView("Edit Cost")->setEnabled(enable_edit);
+ }
+ // Someone, not you, owns these objects.
+ else if (!public_owned)
+ {
+ getChildView("Cost")->setEnabled(FALSE);
+ getChildView("Edit Cost")->setEnabled(FALSE);
+
+ // Don't show a price if none of the items are for sale.
+ if (num_for_sale)
+ getChild<LLUICtrl>("Edit Cost")->setValue(llformat("%d",total_sale_price));
+ else
+ getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
+
+ // If multiple items are for sale, set text to TOTAL PRICE.
+ if (num_for_sale > 1)
+ getChild<LLUICtrl>("Cost")->setValue(getString("Cost Total"));
+ else
+ getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
+ }
+ // This is a public object.
+ else
+ {
+ getChildView("Cost")->setEnabled(FALSE);
+ getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
+
+ getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
+ getChildView("Edit Cost")->setEnabled(FALSE);
+ }
+
+ // Enable and disable the permissions checkboxes
+ // based on who owns the object.
+ // TODO: Creator permissions
+
+ U32 base_mask_on = 0;
+ U32 base_mask_off = 0;
+ U32 owner_mask_off = 0;
+ U32 owner_mask_on = 0;
+ U32 group_mask_on = 0;
+ U32 group_mask_off = 0;
+ U32 everyone_mask_on = 0;
+ U32 everyone_mask_off = 0;
+ U32 next_owner_mask_on = 0;
+ U32 next_owner_mask_off = 0;
+
+ BOOL valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE,
+ &base_mask_on,
+ &base_mask_off);
+ //BOOL valid_owner_perms =//
+ LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER,
+ &owner_mask_on,
+ &owner_mask_off);
+ BOOL valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP,
+ &group_mask_on,
+ &group_mask_off);
+
+ BOOL valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE,
+ &everyone_mask_on,
+ &everyone_mask_off);
+
+ BOOL valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER,
+ &next_owner_mask_on,
+ &next_owner_mask_off);
+
+
+ if (gSavedSettings.getBOOL("DebugPermissions") )
+ {
+ if (valid_base_perms)
+ {
+ getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string(base_mask_on));
+ getChildView("B:")->setVisible(TRUE);
+ getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(owner_mask_on));
+ getChildView("O:")->setVisible(TRUE);
+ getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(group_mask_on));
+ getChildView("G:")->setVisible(TRUE);
+ getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(everyone_mask_on));
+ getChildView("E:")->setVisible(TRUE);
+ getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(next_owner_mask_on));
+ getChildView("N:")->setVisible(TRUE);
+ }
+ else if(!root_selected)
+ {
+ if(object_count == 1)
+ {
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode();
+ if (node && node->mValid)
+ {
+ getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string( node->mPermissions->getMaskBase()));
+ getChildView("B:")->setVisible(TRUE);
+ getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(node->mPermissions->getMaskOwner()));
+ getChildView("O:")->setVisible(TRUE);
+ getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(node->mPermissions->getMaskGroup()));
+ getChildView("G:")->setVisible(TRUE);
+ getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(node->mPermissions->getMaskEveryone()));
+ getChildView("E:")->setVisible(TRUE);
+ getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(node->mPermissions->getMaskNextOwner()));
+ getChildView("N:")->setVisible(TRUE);
+ }
+ }
+ }
+ else
+ {
+ getChildView("B:")->setVisible(FALSE);
+ getChildView("O:")->setVisible(FALSE);
+ getChildView("G:")->setVisible(FALSE);
+ getChildView("E:")->setVisible(FALSE);
+ getChildView("N:")->setVisible(FALSE);
+ }
+
+ U32 flag_mask = 0x0;
+ if (objectp->permMove()) flag_mask |= PERM_MOVE;
+ if (objectp->permModify()) flag_mask |= PERM_MODIFY;
+ if (objectp->permCopy()) flag_mask |= PERM_COPY;
+ if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER;
+
+ getChild<LLUICtrl>("F:")->setValue("F:" + mask_to_string(flag_mask));
+ getChildView("F:")->setVisible( TRUE);
+ }
+ else
+ {
+ getChildView("B:")->setVisible( FALSE);
+ getChildView("O:")->setVisible( FALSE);
+ getChildView("G:")->setVisible( FALSE);
+ getChildView("E:")->setVisible( FALSE);
+ getChildView("N:")->setVisible( FALSE);
+ getChildView("F:")->setVisible( FALSE);
+ }
+
+ BOOL has_change_perm_ability = FALSE;
+ BOOL has_change_sale_ability = FALSE;
+
+ if (valid_base_perms && is_nonpermanent_enforced &&
+ (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE))))
+ {
+ has_change_perm_ability = TRUE;
+ }
+ if (valid_base_perms && is_nonpermanent_enforced &&
+ (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE))))
+ {
+ has_change_sale_ability = TRUE;
+ }
+
+ if (!has_change_perm_ability && !has_change_sale_ability && !root_selected)
+ {
+ // ...must select root to choose permissions
+ getChild<LLUICtrl>("perm_modify")->setValue(getString("text modify warning"));
+ }
+
+ if (has_change_perm_ability)
+ {
+ getChildView("checkbox share with group")->setEnabled(TRUE);
+ getChildView("checkbox allow everyone move")->setEnabled(owner_mask_on & PERM_MOVE);
+ getChildView("checkbox allow everyone copy")->setEnabled(owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER);
+ }
+ else
+ {
+ getChildView("checkbox share with group")->setEnabled(FALSE);
+ getChildView("checkbox allow everyone move")->setEnabled(FALSE);
+ getChildView("checkbox allow everyone copy")->setEnabled(FALSE);
+ }
+
+ if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER))
+ {
+ getChildView("checkbox for sale")->setEnabled(can_transfer || (!can_transfer && num_for_sale));
+ // Set the checkbox to tentative if the prices of each object selected
+ // are not the same.
+ getChild<LLUICtrl>("checkbox for sale")->setTentative( is_for_sale_mixed);
+ getChildView("sale type")->setEnabled(num_for_sale && can_transfer && !is_sale_price_mixed);
+
+ getChildView("Next owner can:")->setEnabled(TRUE);
+ getChildView("checkbox next owner can modify")->setEnabled(base_mask_on & PERM_MODIFY);
+ getChildView("checkbox next owner can copy")->setEnabled(base_mask_on & PERM_COPY);
+ getChildView("checkbox next owner can transfer")->setEnabled(next_owner_mask_on & PERM_COPY);
+ }
+ else
+ {
+ getChildView("checkbox for sale")->setEnabled(FALSE);
+ getChildView("sale type")->setEnabled(FALSE);
+
+ getChildView("Next owner can:")->setEnabled(FALSE);
+ getChildView("checkbox next owner can modify")->setEnabled(FALSE);
+ getChildView("checkbox next owner can copy")->setEnabled(FALSE);
+ getChildView("checkbox next owner can transfer")->setEnabled(FALSE);
+ }
+
+ if (valid_group_perms)
+ {
+ if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE))
+ {
+ getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE);
+ getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer);
+ }
+ else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE))
+ {
+ getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE);
+ getChildView("button deed")->setEnabled(FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox share with group")->setTentative(!has_change_perm_ability);
+ getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer);
+ }
+ }
+
+ if (valid_everyone_perms)
+ {
+ // Move
+ if (everyone_mask_on & PERM_MOVE)
+ {
+ getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE);
+ }
+ else if (everyone_mask_off & PERM_MOVE)
+ {
+ getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( TRUE);
+ }
+
+ // Copy == everyone can't copy
+ if (everyone_mask_on & PERM_COPY)
+ {
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( !can_copy || !can_transfer);
+ }
+ else if (everyone_mask_off & PERM_COPY)
+ {
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( TRUE);
+ }
+ }
+
+ if (valid_next_perms)
+ {
+ // Modify == next owner canot modify
+ if (next_owner_mask_on & PERM_MODIFY)
+ {
+ getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE);
+ }
+ else if (next_owner_mask_off & PERM_MODIFY)
+ {
+ getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( TRUE);
+ }
+
+ // Copy == next owner cannot copy
+ if (next_owner_mask_on & PERM_COPY)
+ {
+ getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( !can_copy);
+ }
+ else if (next_owner_mask_off & PERM_COPY)
+ {
+ getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( TRUE);
+ }
+
+ // Transfer == next owner cannot transfer
+ if (next_owner_mask_on & PERM_TRANSFER)
+ {
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( !can_transfer);
+ }
+ else if (next_owner_mask_off & PERM_TRANSFER)
+ {
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( TRUE);
+ }
+ }
+
+ // reflect sale information
+ LLSaleInfo sale_info;
+ BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
+ LLSaleInfo::EForSale sale_type = sale_info.getSaleType();
+
+ LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type");
+ if (valid_sale_info)
+ {
+ combo_sale_type->setValue( sale_type == LLSaleInfo::FS_NOT ? LLSaleInfo::FS_COPY : sale_type);
+ combo_sale_type->setTentative( FALSE); // unfortunately this doesn't do anything at the moment.
+ }
+ else
+ {
+ // default option is sell copy, determined to be safest
+ combo_sale_type->setValue( LLSaleInfo::FS_COPY);
+ combo_sale_type->setTentative( TRUE); // unfortunately this doesn't do anything at the moment.
+ }
+
+ getChild<LLUICtrl>("checkbox for sale")->setValue((num_for_sale != 0));
+
+ // HACK: There are some old objects in world that are set for sale,
+ // but are no-transfer. We need to let users turn for-sale off, but only
+ // if for-sale is set.
+ bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY);
+ if (cannot_actually_sell)
+ {
+ if (num_for_sale && has_change_sale_ability)
+ {
+ getChildView("checkbox for sale")->setEnabled(true);
+ }
+ }
+
+ // Check search status of objects
+ const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
+ bool include_in_search;
+ const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search);
+ getChildView("search_check")->setEnabled(has_change_sale_ability && all_volume);
+ getChild<LLUICtrl>("search_check")->setValue(include_in_search);
+ getChild<LLUICtrl>("search_check")->setTentative( !all_include_in_search);
+
+ // Click action (touch, sit, buy, pay, open, play, open media, zoom, ignore)
+ U8 click_action = 0;
+ if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action))
+ {
+ LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction");
+ if (combo_click_action)
+ {
+ const std::string combo_value = click_action_to_string_value(click_action);
+ combo_click_action->setValue(LLSD(combo_value));
+ }
+ }
+
+ if (LLSelectMgr::getInstance()->getSelection()->isAttachment())
+ {
+ getChildView("checkbox for sale")->setEnabled(FALSE);
+ getChildView("Edit Cost")->setEnabled(FALSE);
+ getChild<LLComboBox>("sale type")->setEnabled(FALSE);
+ }
+
+ getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume);
+ getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume);
}
// Shorten name if it doesn't fit into max_pixels of two lines
@@ -1011,91 +1011,91 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma
void LLPanelPermissions::updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params)
{
- if (mOwnerCacheConnection.connected())
- {
- mOwnerCacheConnection.disconnect();
- }
- std::string name = owner_name.getCompleteName();
- shorten_name(name, style_params, mLabelOwnerName->getLocalRect().getWidth());
- mLabelOwnerName->setText(name, style_params);
+ if (mOwnerCacheConnection.connected())
+ {
+ mOwnerCacheConnection.disconnect();
+ }
+ std::string name = owner_name.getCompleteName();
+ shorten_name(name, style_params, mLabelOwnerName->getLocalRect().getWidth());
+ mLabelOwnerName->setText(name, style_params);
}
void LLPanelPermissions::updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params)
{
- if (mCreatorCacheConnection.connected())
- {
- mCreatorCacheConnection.disconnect();
- }
- std::string name = creator_name.getCompleteName();
- shorten_name(name, style_params, mLabelCreatorName->getLocalRect().getWidth());
- mLabelCreatorName->setText(name, style_params);
+ if (mCreatorCacheConnection.connected())
+ {
+ mCreatorCacheConnection.disconnect();
+ }
+ std::string name = creator_name.getCompleteName();
+ shorten_name(name, style_params, mLabelCreatorName->getLocalRect().getWidth());
+ mLabelCreatorName->setText(name, style_params);
}
// static
void LLPanelPermissions::onClickClaim(void*)
{
- // try to claim ownership
- LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID());
+ // try to claim ownership
+ LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID());
}
// static
void LLPanelPermissions::onClickRelease(void*)
{
- // try to release ownership
- LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null);
+ // try to release ownership
+ LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null);
}
void LLPanelPermissions::onClickGroup()
{
- LLUUID owner_id;
- std::string name;
- BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name);
- LLFloater* parent_floater = gFloaterView->getParentFloater(this);
-
- if(owners_identical && (owner_id == gAgent.getID()))
- {
- LLFloaterGroupPicker* fg = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
- if (fg)
- {
- fg->setSelectGroupCallback( boost::bind(&LLPanelPermissions::cbGroupID, this, _1) );
-
- if (parent_floater)
- {
- LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg);
- fg->setOrigin(new_rect.mLeft, new_rect.mBottom);
- parent_floater->addDependentFloater(fg);
- }
- }
- }
+ LLUUID owner_id;
+ std::string name;
+ BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name);
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+
+ if(owners_identical && (owner_id == gAgent.getID()))
+ {
+ LLFloaterGroupPicker* fg = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
+ if (fg)
+ {
+ fg->setSelectGroupCallback( boost::bind(&LLPanelPermissions::cbGroupID, this, _1) );
+
+ if (parent_floater)
+ {
+ LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg);
+ fg->setOrigin(new_rect.mLeft, new_rect.mBottom);
+ parent_floater->addDependentFloater(fg);
+ }
+ }
+ }
}
void LLPanelPermissions::cbGroupID(LLUUID group_id)
{
- if(mLabelGroupName)
- {
- mLabelGroupName->setNameID(group_id, TRUE);
- }
- LLSelectMgr::getInstance()->sendGroup(group_id);
+ if(mLabelGroupName)
+ {
+ mLabelGroupName->setNameID(group_id, TRUE);
+ }
+ LLSelectMgr::getInstance()->sendGroup(group_id);
}
bool callback_deed_to_group(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- LLUUID group_id;
- BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
- if(group_id.notNull() && groups_identical && (gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED)))
- {
- LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE);
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ LLUUID group_id;
+ BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
+ if(group_id.notNull() && groups_identical && (gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED)))
+ {
+ LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE);
+ }
+ }
+ return false;
}
void LLPanelPermissions::onClickDeedToGroup(void* data)
{
- LLNotificationsUtil::add( "DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group);
+ LLNotificationsUtil::add( "DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group);
}
///----------------------------------------------------------------------------
@@ -1105,151 +1105,151 @@ void LLPanelPermissions::onClickDeedToGroup(void* data)
// static
void LLPanelPermissions::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm)
{
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
- if(!object) return;
-
- // Checkbox will have toggled itself
- // LLPanelPermissions* self = (LLPanelPermissions*)data;
- LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
- BOOL new_state = check->get();
-
- LLSelectMgr::getInstance()->selectionSetObjectPermissions(field, new_state, perm);
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
+ if(!object) return;
+
+ // Checkbox will have toggled itself
+ // LLPanelPermissions* self = (LLPanelPermissions*)data;
+ LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
+ BOOL new_state = check->get();
+
+ LLSelectMgr::getInstance()->selectionSetObjectPermissions(field, new_state, perm);
}
// static
void LLPanelPermissions::onCommitGroupShare(LLUICtrl *ctrl, void *data)
{
- onCommitPerm(ctrl, data, PERM_GROUP, PERM_MODIFY | PERM_MOVE | PERM_COPY);
+ onCommitPerm(ctrl, data, PERM_GROUP, PERM_MODIFY | PERM_MOVE | PERM_COPY);
}
// static
void LLPanelPermissions::onCommitEveryoneMove(LLUICtrl *ctrl, void *data)
{
- onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_MOVE);
+ onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_MOVE);
}
// static
void LLPanelPermissions::onCommitEveryoneCopy(LLUICtrl *ctrl, void *data)
{
- onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_COPY);
+ onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_COPY);
}
// static
void LLPanelPermissions::onCommitNextOwnerModify(LLUICtrl* ctrl, void* data)
{
- //LL_INFOS() << "LLPanelPermissions::onCommitNextOwnerModify" << LL_ENDL;
- onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_MODIFY);
+ //LL_INFOS() << "LLPanelPermissions::onCommitNextOwnerModify" << LL_ENDL;
+ onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_MODIFY);
}
// static
void LLPanelPermissions::onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data)
{
- //LL_INFOS() << "LLPanelPermissions::onCommitNextOwnerCopy" << LL_ENDL;
- onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_COPY);
+ //LL_INFOS() << "LLPanelPermissions::onCommitNextOwnerCopy" << LL_ENDL;
+ onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_COPY);
}
// static
void LLPanelPermissions::onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data)
{
- //LL_INFOS() << "LLPanelPermissions::onCommitNextOwnerTransfer" << LL_ENDL;
- onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_TRANSFER);
+ //LL_INFOS() << "LLPanelPermissions::onCommitNextOwnerTransfer" << LL_ENDL;
+ onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_TRANSFER);
}
// static
void LLPanelPermissions::onCommitName(LLUICtrl*, void* data)
{
- LLPanelPermissions* self = (LLPanelPermissions*)data;
- LLLineEditor* tb = self->getChild<LLLineEditor>("Object Name");
- if (!tb)
- {
- return;
- }
- LLSelectMgr::getInstance()->selectionSetObjectName(tb->getText());
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- if (selection->isAttachment() && (selection->getNumNodes() == 1) && !tb->getText().empty())
- {
- LLUUID object_id = selection->getFirstObject()->getAttachmentItemID();
- LLViewerInventoryItem* item = findItem(object_id);
- if (item)
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->rename(tb->getText());
- new_item->updateServer(FALSE);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- }
- }
+ LLPanelPermissions* self = (LLPanelPermissions*)data;
+ LLLineEditor* tb = self->getChild<LLLineEditor>("Object Name");
+ if (!tb)
+ {
+ return;
+ }
+ LLSelectMgr::getInstance()->selectionSetObjectName(tb->getText());
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ if (selection->isAttachment() && (selection->getNumNodes() == 1) && !tb->getText().empty())
+ {
+ LLUUID object_id = selection->getFirstObject()->getAttachmentItemID();
+ LLViewerInventoryItem* item = findItem(object_id);
+ if (item)
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->rename(tb->getText());
+ new_item->updateServer(FALSE);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+ }
+ }
}
// static
void LLPanelPermissions::onCommitDesc(LLUICtrl*, void* data)
{
- LLPanelPermissions* self = (LLPanelPermissions*)data;
- LLLineEditor* le = self->getChild<LLLineEditor>("Object Description");
- if (!le)
- {
- return;
- }
- LLSelectMgr::getInstance()->selectionSetObjectDescription(le->getText());
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- if (selection->isAttachment() && (selection->getNumNodes() == 1))
- {
- LLUUID object_id = selection->getFirstObject()->getAttachmentItemID();
- LLViewerInventoryItem* item = findItem(object_id);
- if (item)
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setDescription(le->getText());
- new_item->updateServer(FALSE);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- }
- }
+ LLPanelPermissions* self = (LLPanelPermissions*)data;
+ LLLineEditor* le = self->getChild<LLLineEditor>("Object Description");
+ if (!le)
+ {
+ return;
+ }
+ LLSelectMgr::getInstance()->selectionSetObjectDescription(le->getText());
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ if (selection->isAttachment() && (selection->getNumNodes() == 1))
+ {
+ LLUUID object_id = selection->getFirstObject()->getAttachmentItemID();
+ LLViewerInventoryItem* item = findItem(object_id);
+ if (item)
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setDescription(le->getText());
+ new_item->updateServer(FALSE);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+ }
+ }
}
// static
void LLPanelPermissions::onCommitSaleInfo(LLUICtrl*, void* data)
{
- LLPanelPermissions* self = (LLPanelPermissions*)data;
- self->setAllSaleInfo();
+ LLPanelPermissions* self = (LLPanelPermissions*)data;
+ self->setAllSaleInfo();
}
// static
void LLPanelPermissions::onCommitSaleType(LLUICtrl*, void* data)
{
- LLPanelPermissions* self = (LLPanelPermissions*)data;
- self->setAllSaleInfo();
+ LLPanelPermissions* self = (LLPanelPermissions*)data;
+ self->setAllSaleInfo();
}
void LLPanelPermissions::setAllSaleInfo()
{
- LL_INFOS() << "LLPanelPermissions::setAllSaleInfo()" << LL_ENDL;
- LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_NOT;
+ LL_INFOS() << "LLPanelPermissions::setAllSaleInfo()" << LL_ENDL;
+ LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_NOT;
+
+ LLCheckBoxCtrl *checkPurchase = getChild<LLCheckBoxCtrl>("checkbox for sale");
+
+ // Set the sale type if the object(s) are for sale.
+ if(checkPurchase && checkPurchase->get())
+ {
+ sale_type = static_cast<LLSaleInfo::EForSale>(getChild<LLComboBox>("sale type")->getValue().asInteger());
+ }
- LLCheckBoxCtrl *checkPurchase = getChild<LLCheckBoxCtrl>("checkbox for sale");
-
- // Set the sale type if the object(s) are for sale.
- if(checkPurchase && checkPurchase->get())
- {
- sale_type = static_cast<LLSaleInfo::EForSale>(getChild<LLComboBox>("sale type")->getValue().asInteger());
- }
+ S32 price = -1;
- S32 price = -1;
-
- LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost");
- price = (edit_price->getTentative()) ? DEFAULT_PRICE : edit_price->getValue().asInteger();
+ LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost");
+ price = (edit_price->getTentative()) ? DEFAULT_PRICE : edit_price->getValue().asInteger();
- // If somehow an invalid price, turn the sale off.
- if (price < 0)
- sale_type = LLSaleInfo::FS_NOT;
+ // If somehow an invalid price, turn the sale off.
+ if (price < 0)
+ sale_type = LLSaleInfo::FS_NOT;
- LLSaleInfo old_sale_info;
- LLSelectMgr::getInstance()->selectGetSaleInfo(old_sale_info);
+ LLSaleInfo old_sale_info;
+ LLSelectMgr::getInstance()->selectGetSaleInfo(old_sale_info);
- LLSaleInfo new_sale_info(sale_type, price);
- LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(new_sale_info);
+ LLSaleInfo new_sale_info(sale_type, price);
+ LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(new_sale_info);
// Note: won't work right if a root and non-root are both single-selected (here and other places).
BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
@@ -1284,68 +1284,68 @@ void LLPanelPermissions::setAllSaleInfo()
struct LLSelectionPayable : public LLSelectedObjectFunctor
{
- virtual bool apply(LLViewerObject* obj)
- {
- // can pay if you or your parent has money() event in script
- LLViewerObject* parent = (LLViewerObject*)obj->getParent();
- return (obj->flagTakesMoney()
- || (parent && parent->flagTakesMoney()));
- }
+ virtual bool apply(LLViewerObject* obj)
+ {
+ // can pay if you or your parent has money() event in script
+ LLViewerObject* parent = (LLViewerObject*)obj->getParent();
+ return (obj->flagTakesMoney()
+ || (parent && parent->flagTakesMoney()));
+ }
};
// static
void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*)
{
- LLComboBox* box = (LLComboBox*)ctrl;
- if (!box) return;
- std::string value = box->getValue().asString();
- U8 click_action = string_value_to_click_action(value);
-
- if (click_action == CLICK_ACTION_BUY)
- {
- LLSaleInfo sale_info;
- LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
- if (!sale_info.isForSale())
- {
- LLNotificationsUtil::add("CantSetBuyObject");
-
- // Set click action back to its old value
- U8 click_action = 0;
- LLSelectMgr::getInstance()->selectionGetClickAction(&click_action);
- std::string item_value = click_action_to_string_value(click_action);
- box->setValue(LLSD(item_value));
- return;
- }
- }
- else if (click_action == CLICK_ACTION_PAY)
- {
- // Verify object has script with money() handler
- LLSelectionPayable payable;
- bool can_pay = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&payable);
- if (!can_pay)
- {
- // Warn, but do it anyway.
- LLNotificationsUtil::add("ClickActionNotPayable");
- }
- }
- LLSelectMgr::getInstance()->selectionSetClickAction(click_action);
+ LLComboBox* box = (LLComboBox*)ctrl;
+ if (!box) return;
+ std::string value = box->getValue().asString();
+ U8 click_action = string_value_to_click_action(value);
+
+ if (click_action == CLICK_ACTION_BUY)
+ {
+ LLSaleInfo sale_info;
+ LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
+ if (!sale_info.isForSale())
+ {
+ LLNotificationsUtil::add("CantSetBuyObject");
+
+ // Set click action back to its old value
+ U8 click_action = 0;
+ LLSelectMgr::getInstance()->selectionGetClickAction(&click_action);
+ std::string item_value = click_action_to_string_value(click_action);
+ box->setValue(LLSD(item_value));
+ return;
+ }
+ }
+ else if (click_action == CLICK_ACTION_PAY)
+ {
+ // Verify object has script with money() handler
+ LLSelectionPayable payable;
+ bool can_pay = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&payable);
+ if (!can_pay)
+ {
+ // Warn, but do it anyway.
+ LLNotificationsUtil::add("ClickActionNotPayable");
+ }
+ }
+ LLSelectMgr::getInstance()->selectionSetClickAction(click_action);
}
// static
void LLPanelPermissions::onCommitIncludeInSearch(LLUICtrl* ctrl, void*)
{
- LLCheckBoxCtrl* box = (LLCheckBoxCtrl*)ctrl;
- llassert(box);
+ LLCheckBoxCtrl* box = (LLCheckBoxCtrl*)ctrl;
+ llassert(box);
- LLSelectMgr::getInstance()->selectionSetIncludeInSearch(box->get());
+ LLSelectMgr::getInstance()->selectionSetIncludeInSearch(box->get());
}
LLViewerInventoryItem* LLPanelPermissions::findItem(LLUUID &object_id)
{
- if (!object_id.isNull())
- {
- return gInventory.getItem(object_id);
- }
- return NULL;
+ if (!object_id.isNull())
+ {
+ return gInventory.getItem(object_id);
+ }
+ return NULL;
}
diff --git a/indra/newview/llpanelpermissions.h b/indra/newview/llpanelpermissions.h
index e657f8f8b7..790ac9920d 100644
--- a/indra/newview/llpanelpermissions.h
+++ b/indra/newview/llpanelpermissions.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelpermissions.h
* @brief LLPanelPermissions class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,58 +45,58 @@ class LLViewerInventoryItem;
class LLPanelPermissions : public LLPanel
{
public:
- LLPanelPermissions();
- virtual ~LLPanelPermissions();
+ LLPanelPermissions();
+ virtual ~LLPanelPermissions();
- /*virtual*/ BOOL postBuild();
- void updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params);
- void updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params);
- void refresh(); // refresh all labels as needed
+ /*virtual*/ BOOL postBuild();
+ void updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params);
+ void updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params);
+ void refresh(); // refresh all labels as needed
protected:
- // statics
- static void onClickClaim(void*);
- static void onClickRelease(void*);
- void onClickGroup();
- void cbGroupID(LLUUID group_id);
- static void onClickDeedToGroup(void*);
+ // statics
+ static void onClickClaim(void*);
+ static void onClickRelease(void*);
+ void onClickGroup();
+ void cbGroupID(LLUUID group_id);
+ static void onClickDeedToGroup(void*);
+
+ static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm);
- static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm);
+ static void onCommitGroupShare(LLUICtrl *ctrl, void *data);
- static void onCommitGroupShare(LLUICtrl *ctrl, void *data);
+ static void onCommitEveryoneMove(LLUICtrl *ctrl, void *data);
+ static void onCommitEveryoneCopy(LLUICtrl *ctrl, void *data);
- static void onCommitEveryoneMove(LLUICtrl *ctrl, void *data);
- static void onCommitEveryoneCopy(LLUICtrl *ctrl, void *data);
+ static void onCommitNextOwnerModify(LLUICtrl* ctrl, void* data);
+ static void onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data);
+ static void onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data);
- static void onCommitNextOwnerModify(LLUICtrl* ctrl, void* data);
- static void onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data);
- static void onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data);
-
- static void onCommitName(LLUICtrl* ctrl, void* data);
- static void onCommitDesc(LLUICtrl* ctrl, void* data);
+ static void onCommitName(LLUICtrl* ctrl, void* data);
+ static void onCommitDesc(LLUICtrl* ctrl, void* data);
- static void onCommitSaleInfo(LLUICtrl* ctrl, void* data);
- static void onCommitSaleType(LLUICtrl* ctrl, void* data);
- void setAllSaleInfo();
+ static void onCommitSaleInfo(LLUICtrl* ctrl, void* data);
+ static void onCommitSaleType(LLUICtrl* ctrl, void* data);
+ void setAllSaleInfo();
- static void onCommitClickAction(LLUICtrl* ctrl, void*);
- static void onCommitIncludeInSearch(LLUICtrl* ctrl, void*);
+ static void onCommitClickAction(LLUICtrl* ctrl, void*);
+ static void onCommitIncludeInSearch(LLUICtrl* ctrl, void*);
- static LLViewerInventoryItem* findItem(LLUUID &object_id);
+ static LLViewerInventoryItem* findItem(LLUUID &object_id);
protected:
- void disableAll();
-
+ void disableAll();
+
private:
- LLNameBox* mLabelGroupName; // group name
- LLTextBox* mLabelOwnerName;
- LLTextBox* mLabelCreatorName;
- LLUUID mCreatorID;
- LLUUID mOwnerID;
- LLUUID mLastOwnerID;
-
- boost::signals2::connection mOwnerCacheConnection;
- boost::signals2::connection mCreatorCacheConnection;
+ LLNameBox* mLabelGroupName; // group name
+ LLTextBox* mLabelOwnerName;
+ LLTextBox* mLabelCreatorName;
+ LLUUID mCreatorID;
+ LLUUID mOwnerID;
+ LLUUID mLastOwnerID;
+
+ boost::signals2::connection mOwnerCacheConnection;
+ boost::signals2::connection mCreatorCacheConnection;
};
diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index fb5957ff8f..8a9b2a7ec7 100644
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,160 +50,160 @@
#include "llhttpconstants.h"
LLPanelPlaceInfo::LLPanelPlaceInfo()
-: LLPanel(),
- mParcelID(),
- mRequestedID(),
- mPosRegion(),
- mScrollingPanelMinHeight(0),
- mScrollingPanelWidth(0),
- mInfoType(UNKNOWN),
- mScrollingPanel(NULL),
- mScrollContainer(NULL),
- mDescEditor(NULL)
+: LLPanel(),
+ mParcelID(),
+ mRequestedID(),
+ mPosRegion(),
+ mScrollingPanelMinHeight(0),
+ mScrollingPanelWidth(0),
+ mInfoType(UNKNOWN),
+ mScrollingPanel(NULL),
+ mScrollContainer(NULL),
+ mDescEditor(NULL)
{}
//virtual
LLPanelPlaceInfo::~LLPanelPlaceInfo()
{
- if (mParcelID.notNull())
- {
- LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this);
- }
+ if (mParcelID.notNull())
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this);
+ }
}
//virtual
BOOL LLPanelPlaceInfo::postBuild()
{
- mTitle = getChild<LLTextBox>("title");
- mCurrentTitle = mTitle->getText();
+ mTitle = getChild<LLTextBox>("title");
+ mCurrentTitle = mTitle->getText();
- mSnapshotCtrl = getChild<LLTextureCtrl>("logo");
- mRegionName = getChild<LLTextBox>("region_title");
- mParcelName = getChild<LLTextBox>("parcel_title");
- mParcelOwner = getChild<LLTextBox>("parcel_owner");
- mDescEditor = getChild<LLExpandableTextBox>("description");
+ mSnapshotCtrl = getChild<LLTextureCtrl>("logo");
+ mRegionName = getChild<LLTextBox>("region_title");
+ mParcelName = getChild<LLTextBox>("parcel_title");
+ mParcelOwner = getChild<LLTextBox>("parcel_owner");
+ mDescEditor = getChild<LLExpandableTextBox>("description");
- mMaturityRatingIcon = getChild<LLIconCtrl>("maturity_icon");
- mMaturityRatingText = getChild<LLTextBox>("maturity_value");
+ mMaturityRatingIcon = getChild<LLIconCtrl>("maturity_icon");
+ mMaturityRatingText = getChild<LLTextBox>("maturity_value");
- mScrollingPanel = getChild<LLPanel>("scrolling_panel");
- mScrollContainer = getChild<LLScrollContainer>("place_scroll");
+ mScrollingPanel = getChild<LLPanel>("scrolling_panel");
+ mScrollContainer = getChild<LLScrollContainer>("place_scroll");
- mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight();
- mScrollingPanelWidth = mScrollingPanel->getRect().getWidth();
+ mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight();
+ mScrollingPanelWidth = mScrollingPanel->getRect().getWidth();
- return TRUE;
+ return TRUE;
}
//virtual
void LLPanelPlaceInfo::resetLocation()
{
- mParcelID.setNull();
- mRequestedID.setNull();
- mPosRegion.clearVec();
- mRegionTitle.clear();
-
- std::string loading = LLTrans::getString("LoadingData");
- mMaturityRatingText->setValue(loading);
- mRegionName->setTextArg("[REGIONAMEPOS]", loading);
- mParcelName->setText(loading);
- mParcelOwner->setText(loading);
- mDescEditor->setText(loading);
- mMaturityRatingIcon->setValue(LLUUID::null);
-
- mSnapshotCtrl->setImageAssetID(LLUUID::null);
+ mParcelID.setNull();
+ mRequestedID.setNull();
+ mPosRegion.clearVec();
+ mRegionTitle.clear();
+
+ std::string loading = LLTrans::getString("LoadingData");
+ mMaturityRatingText->setValue(loading);
+ mRegionName->setTextArg("[REGIONAMEPOS]", loading);
+ mParcelName->setText(loading);
+ mParcelOwner->setText(loading);
+ mDescEditor->setText(loading);
+ mMaturityRatingIcon->setValue(LLUUID::null);
+
+ mSnapshotCtrl->setImageAssetID(LLUUID::null);
}
//virtual
void LLPanelPlaceInfo::setParcelID(const LLUUID& parcel_id)
{
- mParcelID = parcel_id;
- sendParcelInfoRequest();
+ mParcelID = parcel_id;
+ sendParcelInfoRequest();
}
//virtual
void LLPanelPlaceInfo::setInfoType(EInfoType type)
{
- mTitle->setText(mCurrentTitle);
- mTitle->setToolTip(mCurrentTitle);
+ mTitle->setText(mCurrentTitle);
+ mTitle->setToolTip(mCurrentTitle);
- mInfoType = type;
+ mInfoType = type;
}
void LLPanelPlaceInfo::sendParcelInfoRequest()
{
- if (mParcelID != mRequestedID)
- {
- LLRemoteParcelInfoProcessor::getInstance()->addObserver(mParcelID, this);
- LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(mParcelID);
+ if (mParcelID != mRequestedID)
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->addObserver(mParcelID, this);
+ LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(mParcelID);
- mRequestedID = mParcelID;
- }
+ mRequestedID = mParcelID;
+ }
}
void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id,
- const LLVector3d& pos_global)
+ const LLVector3d& pos_global)
{
- LLViewerRegion* region = gAgent.getRegion();
- if (!region)
- return;
-
- mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
- (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
- (F32)pos_global.mdV[VZ]);
-
- LLSD body;
- std::string url = region->getCapability("RemoteParcelRequest");
- if (!url.empty())
- {
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region)
+ return;
+
+ mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
+ (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
+ (F32)pos_global.mdV[VZ]);
+
+ LLSD body;
+ std::string url = region->getCapability("RemoteParcelRequest");
+ if (!url.empty())
+ {
LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url,
region_id, mPosRegion, pos_global, getObserverHandle());
- }
- else
- {
- mDescEditor->setText(getString("server_update_text"));
- }
+ }
+ else
+ {
+ mDescEditor->setText(getString("server_update_text"));
+ }
}
// virtual
void LLPanelPlaceInfo::setErrorStatus(S32 status, const std::string& reason)
{
- // We only really handle 404 and 499 errors
- std::string error_text;
- if(status == HTTP_NOT_FOUND)
- {
- error_text = getString("server_error_text");
- }
- else if(status == HTTP_INTERNAL_ERROR)
- {
- error_text = getString("server_forbidden_text");
- }
- else
- {
- error_text = getString("server_error_text");
- }
-
- mDescEditor->setText(error_text);
-
- std::string not_available = getString("not_available");
- mMaturityRatingText->setValue(not_available);
- mRegionName->setTextArg("[REGIONAMEPOS]", not_available);
- mParcelName->setText(not_available);
- mParcelOwner->setText(not_available);
- mMaturityRatingIcon->setValue(LLUUID::null);
- mRegionTitle.clear();
-
- // Enable "Back" button that was disabled when parcel request was sent.
- getChild<LLButton>("back_btn")->setEnabled(TRUE);
+ // We only really handle 404 and 499 errors
+ std::string error_text;
+ if(status == HTTP_NOT_FOUND)
+ {
+ error_text = getString("server_error_text");
+ }
+ else if(status == HTTP_INTERNAL_ERROR)
+ {
+ error_text = getString("server_forbidden_text");
+ }
+ else
+ {
+ error_text = getString("server_error_text");
+ }
+
+ mDescEditor->setText(error_text);
+
+ std::string not_available = getString("not_available");
+ mMaturityRatingText->setValue(not_available);
+ mRegionName->setTextArg("[REGIONAMEPOS]", not_available);
+ mParcelName->setText(not_available);
+ mParcelOwner->setText(not_available);
+ mMaturityRatingIcon->setValue(LLUUID::null);
+ mRegionTitle.clear();
+
+ // Enable "Back" button that was disabled when parcel request was sent.
+ getChild<LLButton>("back_btn")->setEnabled(TRUE);
}
// virtual
void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data)
{
- if(mSnapshotCtrl)
- {
- mSnapshotCtrl->setImageAssetID(parcel_data.snapshot_id);
- }
+ if(mSnapshotCtrl)
+ {
+ mSnapshotCtrl->setImageAssetID(parcel_data.snapshot_id);
+ }
S32 region_x;
S32 region_y;
@@ -229,74 +229,74 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data)
std::string name_and_pos = llformat("%s (%d, %d, %d)",
mRegionTitle.c_str(), region_x, region_y, region_z);
mRegionName->setTextArg("[REGIONAMEPOS]", name_and_pos);
- }
- else
- {
- mRegionTitle.clear();
- mRegionName->setText(LLStringUtil::null);
- }
-
- if(!parcel_data.desc.empty())
- {
- mDescEditor->setText(parcel_data.desc);
- }
- else
- {
- mDescEditor->setText(getString("not_available"));
- }
-
- if (!parcel_data.name.empty())
- {
- mParcelTitle = parcel_data.name;
-
- mParcelName->setText(mParcelTitle);
- }
- else
- {
- mParcelName->setText(getString("not_available"));
- }
+ }
+ else
+ {
+ mRegionTitle.clear();
+ mRegionName->setText(LLStringUtil::null);
+ }
+
+ if(!parcel_data.desc.empty())
+ {
+ mDescEditor->setText(parcel_data.desc);
+ }
+ else
+ {
+ mDescEditor->setText(getString("not_available"));
+ }
+
+ if (!parcel_data.name.empty())
+ {
+ mParcelTitle = parcel_data.name;
+
+ mParcelName->setText(mParcelTitle);
+ }
+ else
+ {
+ mParcelName->setText(getString("not_available"));
+ }
}
// virtual
void LLPanelPlaceInfo::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- // This if was added to force collapsing description textbox on Windows at the beginning of reshape
- // (the only case when reshape is skipped here is when it's caused by this textbox, so called_from_parent is FALSE)
- // This way it is consistent with Linux where topLost collapses textbox at the beginning of reshape.
- // On windows it collapsed only after reshape which caused EXT-8342.
- if(called_from_parent)
- {
- if(mDescEditor) mDescEditor->onTopLost();
- }
-
- LLPanel::reshape(width, height, called_from_parent);
-
- if (!mScrollContainer || !mScrollingPanel)
- return;
-
- static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
-
- S32 scroll_height = mScrollContainer->getRect().getHeight();
- if (mScrollingPanelMinHeight > scroll_height)
- {
- mScrollingPanel->reshape(mScrollingPanelWidth, mScrollingPanelMinHeight);
- }
- else
- {
- mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height);
- }
+ // This if was added to force collapsing description textbox on Windows at the beginning of reshape
+ // (the only case when reshape is skipped here is when it's caused by this textbox, so called_from_parent is FALSE)
+ // This way it is consistent with Linux where topLost collapses textbox at the beginning of reshape.
+ // On windows it collapsed only after reshape which caused EXT-8342.
+ if(called_from_parent)
+ {
+ if(mDescEditor) mDescEditor->onTopLost();
+ }
+
+ LLPanel::reshape(width, height, called_from_parent);
+
+ if (!mScrollContainer || !mScrollingPanel)
+ return;
+
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+ S32 scroll_height = mScrollContainer->getRect().getHeight();
+ if (mScrollingPanelMinHeight > scroll_height)
+ {
+ mScrollingPanel->reshape(mScrollingPanelWidth, mScrollingPanelMinHeight);
+ }
+ else
+ {
+ mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height);
+ }
}
void LLPanelPlaceInfo::createPick(const LLVector3d& pos_global)
{
- LLPickData data;
- data.pos_global = pos_global;
- data.name = mParcelTitle.empty() ? mRegionTitle : mParcelTitle;
- data.sim_name = mRegionTitle;
- data.desc = mDescEditor->getText();
- data.snapshot_id = mSnapshotCtrl->getImageAssetID();
- data.parcel_id = mParcelID;
+ LLPickData data;
+ data.pos_global = pos_global;
+ data.name = mParcelTitle.empty() ? mRegionTitle : mParcelTitle;
+ data.sim_name = mRegionTitle;
+ data.desc = mDescEditor->getText();
+ data.snapshot_id = mSnapshotCtrl->getImageAssetID();
+ data.parcel_id = mParcelID;
LLFloaterProfile* profile_floater = dynamic_cast<LLFloaterProfile*>(LLFloaterReg::showInstance("profile", LLSD().with("id", gAgentID)));
if (profile_floater)
@@ -308,13 +308,13 @@ void LLPanelPlaceInfo::createPick(const LLVector3d& pos_global)
// static
void LLPanelPlaceInfo::onNameCache(LLTextBox* text, const std::string& full_name)
{
- text->setText(full_name);
+ text->setText(full_name);
}
// static
void LLPanelPlaceInfo::onAvatarNameCache(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- LLTextBox* text)
+ const LLAvatarName& av_name,
+ LLTextBox* text)
{
- text->setText( av_name.getCompleteName() );
+ text->setText( av_name.getCompleteName() );
}
diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h
index 533215016a..2dbc06dfc2 100644
--- a/indra/newview/llpanelplaceinfo.h
+++ b/indra/newview/llpanelplaceinfo.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelplaceinfo.h
* @brief Base class for place information in Side Tray.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,82 +48,82 @@ class LLViewerInventoryCategory;
class LLPanelPlaceInfo : public LLPanel, LLRemoteParcelInfoObserver
{
public:
- enum EInfoType
- {
- UNKNOWN,
+ enum EInfoType
+ {
+ UNKNOWN,
- AGENT,
- CREATE_LANDMARK,
- LANDMARK,
- PLACE,
- TELEPORT_HISTORY
- };
+ AGENT,
+ CREATE_LANDMARK,
+ LANDMARK,
+ PLACE,
+ TELEPORT_HISTORY
+ };
- LLPanelPlaceInfo();
- /*virtual*/ ~LLPanelPlaceInfo();
+ LLPanelPlaceInfo();
+ /*virtual*/ ~LLPanelPlaceInfo();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- // Ignore all old location information, useful if you are
- // recycling an existing dialog and need to clear it.
- virtual void resetLocation();
+ // Ignore all old location information, useful if you are
+ // recycling an existing dialog and need to clear it.
+ virtual void resetLocation();
- // Sends a request for data about the given parcel, which will
- // only update the location if there is none already available.
- /*virtual*/ void setParcelID(const LLUUID& parcel_id);
+ // Sends a request for data about the given parcel, which will
+ // only update the location if there is none already available.
+ /*virtual*/ void setParcelID(const LLUUID& parcel_id);
- // Depending on how the panel was triggered
- // (from landmark or current location, or other)
- // sets a corresponding title and contents.
- virtual void setInfoType(EInfoType type);
+ // Depending on how the panel was triggered
+ // (from landmark or current location, or other)
+ // sets a corresponding title and contents.
+ virtual void setInfoType(EInfoType type);
- // Requests remote parcel info by parcel ID.
- void sendParcelInfoRequest();
+ // Requests remote parcel info by parcel ID.
+ void sendParcelInfoRequest();
- // Displays information about a remote parcel.
- // Sends a request to the server.
- void displayParcelInfo(const LLUUID& region_id,
- const LLVector3d& pos_global);
+ // Displays information about a remote parcel.
+ // Sends a request to the server.
+ void displayParcelInfo(const LLUUID& region_id,
+ const LLVector3d& pos_global);
- /*virtual*/ void setErrorStatus(S32 status, const std::string& reason);
+ /*virtual*/ void setErrorStatus(S32 status, const std::string& reason);
- /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
+ /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- // Create a pick for the location specified
- // by global_pos.
- void createPick(const LLVector3d& pos_global);
+ // Create a pick for the location specified
+ // by global_pos.
+ void createPick(const LLVector3d& pos_global);
protected:
- static void onNameCache(LLTextBox* text, const std::string& full_name);
- static void onAvatarNameCache(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- LLTextBox* text);
-
- /**
- * mParcelID is valid only for remote places, in other cases it's null. See resetLocation()
- */
- LLUUID mParcelID;
- LLUUID mRequestedID;
- LLVector3 mPosRegion;
- std::string mParcelTitle; // used for pick title without coordinates
- std::string mRegionTitle;
- std::string mCurrentTitle;
- S32 mScrollingPanelMinHeight;
- S32 mScrollingPanelWidth;
- EInfoType mInfoType;
-
- LLScrollContainer* mScrollContainer;
- LLPanel* mScrollingPanel;
- LLTextBox* mTitle;
- LLTextureCtrl* mSnapshotCtrl;
- LLTextBox* mRegionName;
- LLTextBox* mParcelName;
- LLTextBox* mParcelOwner;
- LLExpandableTextBox* mDescEditor;
- LLIconCtrl* mMaturityRatingIcon;
- LLTextBox* mMaturityRatingText;
+ static void onNameCache(LLTextBox* text, const std::string& full_name);
+ static void onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name,
+ LLTextBox* text);
+
+ /**
+ * mParcelID is valid only for remote places, in other cases it's null. See resetLocation()
+ */
+ LLUUID mParcelID;
+ LLUUID mRequestedID;
+ LLVector3 mPosRegion;
+ std::string mParcelTitle; // used for pick title without coordinates
+ std::string mRegionTitle;
+ std::string mCurrentTitle;
+ S32 mScrollingPanelMinHeight;
+ S32 mScrollingPanelWidth;
+ EInfoType mInfoType;
+
+ LLScrollContainer* mScrollContainer;
+ LLPanel* mScrollingPanel;
+ LLTextBox* mTitle;
+ LLTextureCtrl* mSnapshotCtrl;
+ LLTextBox* mRegionName;
+ LLTextBox* mParcelName;
+ LLTextBox* mParcelOwner;
+ LLExpandableTextBox* mDescEditor;
+ LLIconCtrl* mMaturityRatingIcon;
+ LLTextBox* mMaturityRatingText;
};
#endif // LL_LLPANELPLACEINFO_H
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index 9283dfa218..3cff72d42a 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -77,606 +77,606 @@ static std::string icon_see_avs_on;
static std::string icon_see_avs_off;
LLPanelPlaceProfile::LLPanelPlaceProfile()
-: LLPanelPlaceInfo(),
- mNextCovenantUpdateTime(0),
- mForSalePanel(NULL),
- mYouAreHerePanel(NULL),
- mSelectedParcelID(-1),
- mAccordionCtrl(NULL)
+: LLPanelPlaceInfo(),
+ mNextCovenantUpdateTime(0),
+ mForSalePanel(NULL),
+ mYouAreHerePanel(NULL),
+ mSelectedParcelID(-1),
+ mAccordionCtrl(NULL)
{}
// virtual
LLPanelPlaceProfile::~LLPanelPlaceProfile()
{
- gIdleCallbacks.deleteFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this);
+ gIdleCallbacks.deleteFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this);
}
// virtual
BOOL LLPanelPlaceProfile::postBuild()
{
- LLPanelPlaceInfo::postBuild();
-
- mForSalePanel = getChild<LLPanel>("for_sale_panel");
- mYouAreHerePanel = getChild<LLPanel>("here_panel");
- gIdleCallbacks.addFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this);
-
- //Icon value should contain sale price of last selected parcel.
- mForSalePanel->getChild<LLIconCtrl>("icon_for_sale")->
- setMouseDownCallback(boost::bind(&LLPanelPlaceProfile::onForSaleBannerClick, this));
-
- mParcelRatingIcon = getChild<LLIconCtrl>("rating_icon");
- mParcelRatingText = getChild<LLTextBox>("rating_value");
- mVoiceIcon = getChild<LLIconCtrl>("voice_icon");
- mVoiceText = getChild<LLTextBox>("voice_value");
- mFlyIcon = getChild<LLIconCtrl>("fly_icon");
- mFlyText = getChild<LLTextBox>("fly_value");
- mPushIcon = getChild<LLIconCtrl>("push_icon");
- mPushText = getChild<LLTextBox>("push_value");
- mBuildIcon = getChild<LLIconCtrl>("build_icon");
- mBuildText = getChild<LLTextBox>("build_value");
- mScriptsIcon = getChild<LLIconCtrl>("scripts_icon");
- mScriptsText = getChild<LLTextBox>("scripts_value");
- mDamageIcon = getChild<LLIconCtrl>("damage_icon");
- mDamageText = getChild<LLTextBox>("damage_value");
- mSeeAVsIcon = getChild<LLIconCtrl>("see_avatars_icon");
- mSeeAVsText = getChild<LLTextBox>("see_avatars_value");
-
- mRegionNameText = getChild<LLTextBox>("region_name");
- mRegionTypeText = getChild<LLTextBox>("region_type");
- mRegionRatingIcon = getChild<LLIconCtrl>("region_rating_icon");
- mRegionRatingText = getChild<LLTextBox>("region_rating");
- mRegionOwnerText = getChild<LLTextBox>("region_owner");
- mRegionGroupText = getChild<LLTextBox>("region_group");
-
- mEstateNameText = getChild<LLTextBox>("estate_name");
- mEstateRatingText = getChild<LLTextBox>("estate_rating");
- mEstateRatingIcon = getChild<LLIconCtrl>("estate_rating_icon");
- mEstateOwnerText = getChild<LLTextBox>("estate_owner");
- mCovenantText = getChild<LLTextEditor>("covenant");
-
- mSalesPriceText = getChild<LLTextBox>("sales_price");
- mAreaText = getChild<LLTextBox>("area");
- mTrafficText = getChild<LLTextBox>("traffic");
- mPrimitivesText = getChild<LLTextBox>("primitives");
- mParcelScriptsText = getChild<LLTextBox>("parcel_scripts");
- mTerraformLimitsText = getChild<LLTextBox>("terraform_limits");
- mSubdivideText = getChild<LLTextEditor>("subdivide");
- mResaleText = getChild<LLTextEditor>("resale");
- mSaleToText = getChild<LLTextBox>("sale_to");
- mAccordionCtrl = getChild<LLAccordionCtrl>("advanced_info_accordion");
-
- icon_pg = getString("icon_PG");
- icon_m = getString("icon_M");
- icon_r = getString("icon_R");
- icon_voice = getString("icon_Voice");
- icon_voice_no = getString("icon_VoiceNo");
- icon_fly = getString("icon_Fly");
- icon_fly_no = getString("icon_FlyNo");
- icon_push = getString("icon_Push");
- icon_push_no = getString("icon_PushNo");
- icon_build = getString("icon_Build");
- icon_build_no = getString("icon_BuildNo");
- icon_scripts = getString("icon_Scripts");
- icon_scripts_no = getString("icon_ScriptsNo");
- icon_damage = getString("icon_Damage");
- icon_damage_no = getString("icon_DamageNo");
- icon_see_avs_on = getString("icon_SeeAVs_On");
- icon_see_avs_off = getString("icon_SeeAVs_Off");
-
- mLastSelectedRegionID = LLUUID::null;
- mNextCovenantUpdateTime = 0;
-
- return TRUE;
+ LLPanelPlaceInfo::postBuild();
+
+ mForSalePanel = getChild<LLPanel>("for_sale_panel");
+ mYouAreHerePanel = getChild<LLPanel>("here_panel");
+ gIdleCallbacks.addFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this);
+
+ //Icon value should contain sale price of last selected parcel.
+ mForSalePanel->getChild<LLIconCtrl>("icon_for_sale")->
+ setMouseDownCallback(boost::bind(&LLPanelPlaceProfile::onForSaleBannerClick, this));
+
+ mParcelRatingIcon = getChild<LLIconCtrl>("rating_icon");
+ mParcelRatingText = getChild<LLTextBox>("rating_value");
+ mVoiceIcon = getChild<LLIconCtrl>("voice_icon");
+ mVoiceText = getChild<LLTextBox>("voice_value");
+ mFlyIcon = getChild<LLIconCtrl>("fly_icon");
+ mFlyText = getChild<LLTextBox>("fly_value");
+ mPushIcon = getChild<LLIconCtrl>("push_icon");
+ mPushText = getChild<LLTextBox>("push_value");
+ mBuildIcon = getChild<LLIconCtrl>("build_icon");
+ mBuildText = getChild<LLTextBox>("build_value");
+ mScriptsIcon = getChild<LLIconCtrl>("scripts_icon");
+ mScriptsText = getChild<LLTextBox>("scripts_value");
+ mDamageIcon = getChild<LLIconCtrl>("damage_icon");
+ mDamageText = getChild<LLTextBox>("damage_value");
+ mSeeAVsIcon = getChild<LLIconCtrl>("see_avatars_icon");
+ mSeeAVsText = getChild<LLTextBox>("see_avatars_value");
+
+ mRegionNameText = getChild<LLTextBox>("region_name");
+ mRegionTypeText = getChild<LLTextBox>("region_type");
+ mRegionRatingIcon = getChild<LLIconCtrl>("region_rating_icon");
+ mRegionRatingText = getChild<LLTextBox>("region_rating");
+ mRegionOwnerText = getChild<LLTextBox>("region_owner");
+ mRegionGroupText = getChild<LLTextBox>("region_group");
+
+ mEstateNameText = getChild<LLTextBox>("estate_name");
+ mEstateRatingText = getChild<LLTextBox>("estate_rating");
+ mEstateRatingIcon = getChild<LLIconCtrl>("estate_rating_icon");
+ mEstateOwnerText = getChild<LLTextBox>("estate_owner");
+ mCovenantText = getChild<LLTextEditor>("covenant");
+
+ mSalesPriceText = getChild<LLTextBox>("sales_price");
+ mAreaText = getChild<LLTextBox>("area");
+ mTrafficText = getChild<LLTextBox>("traffic");
+ mPrimitivesText = getChild<LLTextBox>("primitives");
+ mParcelScriptsText = getChild<LLTextBox>("parcel_scripts");
+ mTerraformLimitsText = getChild<LLTextBox>("terraform_limits");
+ mSubdivideText = getChild<LLTextEditor>("subdivide");
+ mResaleText = getChild<LLTextEditor>("resale");
+ mSaleToText = getChild<LLTextBox>("sale_to");
+ mAccordionCtrl = getChild<LLAccordionCtrl>("advanced_info_accordion");
+
+ icon_pg = getString("icon_PG");
+ icon_m = getString("icon_M");
+ icon_r = getString("icon_R");
+ icon_voice = getString("icon_Voice");
+ icon_voice_no = getString("icon_VoiceNo");
+ icon_fly = getString("icon_Fly");
+ icon_fly_no = getString("icon_FlyNo");
+ icon_push = getString("icon_Push");
+ icon_push_no = getString("icon_PushNo");
+ icon_build = getString("icon_Build");
+ icon_build_no = getString("icon_BuildNo");
+ icon_scripts = getString("icon_Scripts");
+ icon_scripts_no = getString("icon_ScriptsNo");
+ icon_damage = getString("icon_Damage");
+ icon_damage_no = getString("icon_DamageNo");
+ icon_see_avs_on = getString("icon_SeeAVs_On");
+ icon_see_avs_off = getString("icon_SeeAVs_Off");
+
+ mLastSelectedRegionID = LLUUID::null;
+ mNextCovenantUpdateTime = 0;
+
+ return TRUE;
}
// virtual
void LLPanelPlaceProfile::resetLocation()
{
- LLPanelPlaceInfo::resetLocation();
-
- mLastSelectedRegionID = LLUUID::null;
- mNextCovenantUpdateTime = 0;
-
- mForSalePanel->setVisible(FALSE);
- mYouAreHerePanel->setVisible(FALSE);
-
- std::string loading = LLTrans::getString("LoadingData");
-
- mParcelRatingIcon->setValue(loading);
- mParcelRatingText->setText(loading);
- mVoiceIcon->setValue(loading);
- mVoiceText->setText(loading);
- mFlyIcon->setValue(loading);
- mFlyText->setText(loading);
- mPushIcon->setValue(loading);
- mPushText->setText(loading);
- mBuildIcon->setValue(loading);
- mBuildText->setText(loading);
- mScriptsIcon->setValue(loading);
- mScriptsText->setText(loading);
- mDamageIcon->setValue(loading);
- mDamageText->setText(loading);
- mSeeAVsIcon->setValue(loading);
- mSeeAVsText->setText(loading);
-
- mRegionNameText->setValue(loading);
- mRegionTypeText->setValue(loading);
- mRegionRatingIcon->setValue(loading);
- mRegionRatingText->setValue(loading);
- mRegionOwnerText->setValue(loading);
- mRegionGroupText->setValue(loading);
-
- mEstateNameText->setValue(loading);
- mEstateRatingText->setValue(loading);
- mEstateRatingIcon->setValue(loading);
- mEstateOwnerText->setValue(loading);
- mCovenantText->setValue(loading);
-
- mSalesPriceText->setValue(loading);
- mAreaText->setValue(loading);
- mTrafficText->setValue(loading);
- mPrimitivesText->setValue(loading);
- mParcelScriptsText->setValue(loading);
- mTerraformLimitsText->setValue(loading);
- mSubdivideText->setValue(loading);
- mResaleText->setValue(loading);
- mSaleToText->setValue(loading);
-
- getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(TRUE);
+ LLPanelPlaceInfo::resetLocation();
+
+ mLastSelectedRegionID = LLUUID::null;
+ mNextCovenantUpdateTime = 0;
+
+ mForSalePanel->setVisible(FALSE);
+ mYouAreHerePanel->setVisible(FALSE);
+
+ std::string loading = LLTrans::getString("LoadingData");
+
+ mParcelRatingIcon->setValue(loading);
+ mParcelRatingText->setText(loading);
+ mVoiceIcon->setValue(loading);
+ mVoiceText->setText(loading);
+ mFlyIcon->setValue(loading);
+ mFlyText->setText(loading);
+ mPushIcon->setValue(loading);
+ mPushText->setText(loading);
+ mBuildIcon->setValue(loading);
+ mBuildText->setText(loading);
+ mScriptsIcon->setValue(loading);
+ mScriptsText->setText(loading);
+ mDamageIcon->setValue(loading);
+ mDamageText->setText(loading);
+ mSeeAVsIcon->setValue(loading);
+ mSeeAVsText->setText(loading);
+
+ mRegionNameText->setValue(loading);
+ mRegionTypeText->setValue(loading);
+ mRegionRatingIcon->setValue(loading);
+ mRegionRatingText->setValue(loading);
+ mRegionOwnerText->setValue(loading);
+ mRegionGroupText->setValue(loading);
+
+ mEstateNameText->setValue(loading);
+ mEstateRatingText->setValue(loading);
+ mEstateRatingIcon->setValue(loading);
+ mEstateOwnerText->setValue(loading);
+ mCovenantText->setValue(loading);
+
+ mSalesPriceText->setValue(loading);
+ mAreaText->setValue(loading);
+ mTrafficText->setValue(loading);
+ mPrimitivesText->setValue(loading);
+ mParcelScriptsText->setValue(loading);
+ mTerraformLimitsText->setValue(loading);
+ mSubdivideText->setValue(loading);
+ mResaleText->setValue(loading);
+ mSaleToText->setValue(loading);
+
+ getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(TRUE);
}
// virtual
void LLPanelPlaceProfile::setInfoType(EInfoType type)
{
- bool is_info_type_agent = type == AGENT;
-
- mMaturityRatingIcon->setVisible(!is_info_type_agent);
- mMaturityRatingText->setVisible(!is_info_type_agent);
-
- getChild<LLTextBox>("owner_label")->setVisible(is_info_type_agent);
- mParcelOwner->setVisible(is_info_type_agent);
-
- getChild<LLAccordionCtrl>("advanced_info_accordion")->setVisible(is_info_type_agent);
-
- // If we came from search we want larger description area, approx. 10 lines (see STORM-1311).
- // Don't use the maximum available space because that leads to nasty artifacts
- // in text editor and expandable text box.
- {
- const S32 SEARCH_DESC_HEIGHT = 150;
-
- // Remember original geometry (once).
- static const S32 sOrigDescVPad = getChildView("owner_label")->getRect().mBottom - mDescEditor->getRect().mTop;
- static const S32 sOrigDescHeight = mDescEditor->getRect().getHeight();
- static const S32 sOrigMRIconVPad = mDescEditor->getRect().mBottom - mMaturityRatingIcon->getRect().mTop;
- static const S32 sOrigMRTextVPad = mDescEditor->getRect().mBottom - mMaturityRatingText->getRect().mTop;
-
- // Resize the description.
- const S32 desc_height = is_info_type_agent ? sOrigDescHeight : SEARCH_DESC_HEIGHT;
- const S32 desc_top = getChildView("owner_label")->getRect().mBottom - sOrigDescVPad;
- LLRect desc_rect = mDescEditor->getRect();
- desc_rect.setOriginAndSize(desc_rect.mLeft, desc_top - desc_height, desc_rect.getWidth(), desc_height);
- mDescEditor->reshape(desc_rect.getWidth(), desc_rect.getHeight());
- mDescEditor->setRect(desc_rect);
- mDescEditor->updateTextShape();
-
- // Move the maturity rating icon/text accordingly.
- const S32 mr_icon_bottom = mDescEditor->getRect().mBottom - sOrigMRIconVPad - mMaturityRatingIcon->getRect().getHeight();
- const S32 mr_text_bottom = mDescEditor->getRect().mBottom - sOrigMRTextVPad - mMaturityRatingText->getRect().getHeight();
- mMaturityRatingIcon->setOrigin(mMaturityRatingIcon->getRect().mLeft, mr_icon_bottom);
- mMaturityRatingText->setOrigin(mMaturityRatingText->getRect().mLeft, mr_text_bottom);
- }
-
- switch(type)
- {
- case AGENT:
- case PLACE:
- default:
- mCurrentTitle = getString("title_place");
- break;
-
- case TELEPORT_HISTORY:
- mCurrentTitle = getString("title_teleport_history");
- break;
- }
-
- if (mAccordionCtrl != NULL)
- {
- mAccordionCtrl->expandDefaultTab();
- }
-
- LLPanelPlaceInfo::setInfoType(type);
+ bool is_info_type_agent = type == AGENT;
+
+ mMaturityRatingIcon->setVisible(!is_info_type_agent);
+ mMaturityRatingText->setVisible(!is_info_type_agent);
+
+ getChild<LLTextBox>("owner_label")->setVisible(is_info_type_agent);
+ mParcelOwner->setVisible(is_info_type_agent);
+
+ getChild<LLAccordionCtrl>("advanced_info_accordion")->setVisible(is_info_type_agent);
+
+ // If we came from search we want larger description area, approx. 10 lines (see STORM-1311).
+ // Don't use the maximum available space because that leads to nasty artifacts
+ // in text editor and expandable text box.
+ {
+ const S32 SEARCH_DESC_HEIGHT = 150;
+
+ // Remember original geometry (once).
+ static const S32 sOrigDescVPad = getChildView("owner_label")->getRect().mBottom - mDescEditor->getRect().mTop;
+ static const S32 sOrigDescHeight = mDescEditor->getRect().getHeight();
+ static const S32 sOrigMRIconVPad = mDescEditor->getRect().mBottom - mMaturityRatingIcon->getRect().mTop;
+ static const S32 sOrigMRTextVPad = mDescEditor->getRect().mBottom - mMaturityRatingText->getRect().mTop;
+
+ // Resize the description.
+ const S32 desc_height = is_info_type_agent ? sOrigDescHeight : SEARCH_DESC_HEIGHT;
+ const S32 desc_top = getChildView("owner_label")->getRect().mBottom - sOrigDescVPad;
+ LLRect desc_rect = mDescEditor->getRect();
+ desc_rect.setOriginAndSize(desc_rect.mLeft, desc_top - desc_height, desc_rect.getWidth(), desc_height);
+ mDescEditor->reshape(desc_rect.getWidth(), desc_rect.getHeight());
+ mDescEditor->setRect(desc_rect);
+ mDescEditor->updateTextShape();
+
+ // Move the maturity rating icon/text accordingly.
+ const S32 mr_icon_bottom = mDescEditor->getRect().mBottom - sOrigMRIconVPad - mMaturityRatingIcon->getRect().getHeight();
+ const S32 mr_text_bottom = mDescEditor->getRect().mBottom - sOrigMRTextVPad - mMaturityRatingText->getRect().getHeight();
+ mMaturityRatingIcon->setOrigin(mMaturityRatingIcon->getRect().mLeft, mr_icon_bottom);
+ mMaturityRatingText->setOrigin(mMaturityRatingText->getRect().mLeft, mr_text_bottom);
+ }
+
+ switch(type)
+ {
+ case AGENT:
+ case PLACE:
+ default:
+ mCurrentTitle = getString("title_place");
+ break;
+
+ case TELEPORT_HISTORY:
+ mCurrentTitle = getString("title_teleport_history");
+ break;
+ }
+
+ if (mAccordionCtrl != NULL)
+ {
+ mAccordionCtrl->expandDefaultTab();
+ }
+
+ LLPanelPlaceInfo::setInfoType(type);
}
// virtual
void LLPanelPlaceProfile::processParcelInfo(const LLParcelData& parcel_data)
{
- LLPanelPlaceInfo::processParcelInfo(parcel_data);
-
- // HACK: Flag 0x2 == adult region,
- // Flag 0x1 == mature region, otherwise assume PG
- if (parcel_data.flags & 0x2)
- {
- mMaturityRatingIcon->setValue(icon_r);
- mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_ADULT));
- }
- else if (parcel_data.flags & 0x1)
- {
- mMaturityRatingIcon->setValue(icon_m);
- mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_MATURE));
- }
- else
- {
- mMaturityRatingIcon->setValue(icon_pg);
- mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_PG));
- }
+ LLPanelPlaceInfo::processParcelInfo(parcel_data);
+
+ // HACK: Flag 0x2 == adult region,
+ // Flag 0x1 == mature region, otherwise assume PG
+ if (parcel_data.flags & 0x2)
+ {
+ mMaturityRatingIcon->setValue(icon_r);
+ mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_ADULT));
+ }
+ else if (parcel_data.flags & 0x1)
+ {
+ mMaturityRatingIcon->setValue(icon_m);
+ mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_MATURE));
+ }
+ else
+ {
+ mMaturityRatingIcon->setValue(icon_pg);
+ mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_PG));
+ }
}
// virtual
void LLPanelPlaceProfile::onVisibilityChange(BOOL new_visibility)
{
- LLPanel::onVisibilityChange(new_visibility);
-
- LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
- if (!parcel_mgr)
- return;
-
- // Remove land selection when panel hides.
- if (!new_visibility)
- {
- if (!parcel_mgr->selectionEmpty())
- {
- parcel_mgr->deselectUnused();
- }
- }
+ LLPanel::onVisibilityChange(new_visibility);
+
+ LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+ if (!parcel_mgr)
+ return;
+
+ // Remove land selection when panel hides.
+ if (!new_visibility)
+ {
+ if (!parcel_mgr->selectionEmpty())
+ {
+ parcel_mgr->deselectUnused();
+ }
+ }
}
void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
- LLViewerRegion* region,
- const LLVector3d& pos_global,
- bool is_current_parcel)
+ LLViewerRegion* region,
+ const LLVector3d& pos_global,
+ bool is_current_parcel)
{
- if (!region || !parcel)
- return;
-
- if (mLastSelectedRegionID != region->getRegionID()
- || mNextCovenantUpdateTime < LLTimer::getElapsedSeconds())
- {
- // send EstateCovenantInfo message
- // Note: LLPanelPlaceProfile doesn't change Covenant's content and any
- // changes made by Estate floater should be requested by Estate floater
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessage("EstateCovenantRequest");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->sendReliable(region->getHost());
- mNextCovenantUpdateTime = LLTimer::getElapsedSeconds() + COVENANT_REFRESH_TIME_SEC;
- }
-
- LLParcelData parcel_data;
-
- // HACK: Converting sim access flags to the format
- // returned by remote parcel response.
- U8 sim_access = region->getSimAccess();
- switch(sim_access)
- {
- case SIM_ACCESS_MATURE:
- parcel_data.flags = 0x1;
-
- mParcelRatingIcon->setValue(icon_m);
- mRegionRatingIcon->setValue(icon_m);
- mEstateRatingIcon->setValue(icon_m);
- break;
-
- case SIM_ACCESS_ADULT:
- parcel_data.flags = 0x2;
-
- mParcelRatingIcon->setValue(icon_r);
- mRegionRatingIcon->setValue(icon_r);
- mEstateRatingIcon->setValue(icon_r);
- break;
-
- default:
- parcel_data.flags = 0;
-
- mParcelRatingIcon->setValue(icon_pg);
- mRegionRatingIcon->setValue(icon_pg);
- mEstateRatingIcon->setValue(icon_pg);
- }
-
- std::string rating = LLViewerRegion::accessToString(sim_access);
- mParcelRatingText->setText(rating);
- mRegionRatingText->setText(rating);
-
- parcel_data.desc = parcel->getDesc();
- parcel_data.name = parcel->getName();
- parcel_data.sim_name = region->getName();
- parcel_data.snapshot_id = parcel->getSnapshotID();
- mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
- (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
- (F32)pos_global.mdV[VZ]);
- parcel_data.global_x = pos_global.mdV[VX];
- parcel_data.global_y = pos_global.mdV[VY];
- parcel_data.global_z = pos_global.mdV[VZ];
- parcel_data.owner_id = parcel->getOwnerID();
-
- std::string on = getString("on");
- std::string off = getString("off");
-
- LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
-
- // Processing parcel characteristics
- if (vpm->allowAgentVoice(region, parcel))
- {
- mVoiceIcon->setValue(icon_voice);
- mVoiceText->setText(on);
- }
- else
- {
- mVoiceIcon->setValue(icon_voice_no);
- mVoiceText->setText(off);
- }
-
- if (vpm->allowAgentFly(region, parcel))
- {
- mFlyIcon->setValue(icon_fly);
- mFlyText->setText(on);
- }
- else
- {
- mFlyIcon->setValue(icon_fly_no);
- mFlyText->setText(off);
- }
-
- if (vpm->allowAgentPush(region, parcel))
- {
- mPushIcon->setValue(icon_push);
- mPushText->setText(on);
- }
- else
- {
- mPushIcon->setValue(icon_push_no);
- mPushText->setText(off);
- }
-
- if (vpm->allowAgentBuild(parcel))
- {
- mBuildIcon->setValue(icon_build);
- mBuildText->setText(on);
- }
- else
- {
- mBuildIcon->setValue(icon_build_no);
- mBuildText->setText(off);
- }
-
- if (vpm->allowAgentScripts(region, parcel))
- {
- mScriptsIcon->setValue(icon_scripts);
- mScriptsText->setText(on);
- }
- else
- {
- mScriptsIcon->setValue(icon_scripts_no);
- mScriptsText->setText(off);
- }
-
- if (vpm->allowAgentDamage(region, parcel))
- {
- mDamageIcon->setValue(icon_damage);
- mDamageText->setText(on);
- }
- else
- {
- mDamageIcon->setValue(icon_damage_no);
- mDamageText->setText(off);
- }
-
- if (parcel->getSeeAVs())
- {
- mSeeAVsIcon->setValue(icon_see_avs_on);
- mSeeAVsText->setText(on);
- }
- else
- {
- mSeeAVsIcon->setValue(icon_see_avs_off);
- mSeeAVsText->setText(off);
- }
-
- mRegionNameText->setText(region->getName());
- mRegionTypeText->setText(region->getLocalizedSimProductName());
-
- // Determine parcel owner
- if (parcel->isPublic())
- {
- mParcelOwner->setText(getString("public"));
- mRegionOwnerText->setText(getString("public"));
- }
- else
- {
- if (parcel->getIsGroupOwned())
- {
- mRegionOwnerText->setText(getString("group_owned_text"));
-
- if(!parcel->getGroupID().isNull())
- {
- std::string owner =
- LLSLURL("group", parcel->getGroupID(), "inspect").getSLURLString();
- mParcelOwner->setText(owner);
- }
- else
- {
- std::string owner = getString("none_text");
- mRegionGroupText->setText(owner);
- mParcelOwner->setText(owner);
- }
- }
- else
- {
- // Figure out the owner's name
- std::string parcel_owner =
- LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
- mParcelOwner->setText(parcel_owner);
- LLAvatarNameCache::get(region->getOwner(), boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mRegionOwnerText));
- mRegionGroupText->setText( getString("none_text"));
- }
-
- if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
- {
- mRegionOwnerText->setText(mRegionOwnerText->getText() + getString("sale_pending_text"));
- }
-
- if(!parcel->getGroupID().isNull())
- {
- // FIXME: Using parcel group as region group.
- gCacheName->getGroup(parcel->getGroupID(),
- boost::bind(&LLPanelPlaceInfo::onNameCache, mRegionGroupText, _2));
- }
- }
-
- mEstateRatingText->setText(region->getSimAccessString());
-
- S32 area;
- S32 claim_price;
- S32 rent_price;
- F32 dwell;
- BOOL for_sale;
- vpm->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell);
- mForSalePanel->setVisible(for_sale);
- if (for_sale)
- {
- const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
- if(auth_buyer_id.notNull())
- {
- LLAvatarNameCache::get(auth_buyer_id, boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mSaleToText));
-
- // Show sales info to a specific person or a group he belongs to.
- if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id))
- {
- for_sale = FALSE;
- }
- }
- else
- {
- mSaleToText->setText(getString("anyone"));
- }
-
- mSalesPriceText->setText(llformat("%s%d ", getString("price_text").c_str(), parcel->getSalePrice()));
- mAreaText->setText(llformat("%d %s", area, getString("area_text").c_str()));
- mTrafficText->setText(llformat("%.0f", dwell));
-
- // Can't have more than region max tasks, regardless of parcel
- // object bonus factor.
- S32 primitives = llmin(ll_round(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()),
- (S32)region->getMaxTasks());
-
- mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, getString("available").c_str(), parcel->getPrimCount(), getString("allocated").c_str()));
-
- if (parcel->getAllowOtherScripts())
- {
- mParcelScriptsText->setText(getString("all_residents_text"));
- }
- else if (parcel->getAllowGroupScripts())
- {
- mParcelScriptsText->setText(getString("group_text"));
- }
- else
- {
- mParcelScriptsText->setText(off);
- }
-
- mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off);
-
- if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
- {
- mSubdivideText->setText(getString("can_change"));
- }
- else
- {
- mSubdivideText->setText(getString("can_not_change"));
- }
- if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
- {
- mResaleText->setText(getString("can_not_resell"));
- }
- else
- {
- mResaleText->setText(getString("can_resell"));
- }
- }
-
- mSelectedParcelID = parcel->getLocalID();
- mLastSelectedRegionID = region->getRegionID();
- LLPanelPlaceInfo::processParcelInfo(parcel_data);
-
- mYouAreHerePanel->setVisible(is_current_parcel);
- getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(for_sale);
- mAccordionCtrl->arrange();
+ if (!region || !parcel)
+ return;
+
+ if (mLastSelectedRegionID != region->getRegionID()
+ || mNextCovenantUpdateTime < LLTimer::getElapsedSeconds())
+ {
+ // send EstateCovenantInfo message
+ // Note: LLPanelPlaceProfile doesn't change Covenant's content and any
+ // changes made by Estate floater should be requested by Estate floater
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessage("EstateCovenantRequest");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->sendReliable(region->getHost());
+ mNextCovenantUpdateTime = LLTimer::getElapsedSeconds() + COVENANT_REFRESH_TIME_SEC;
+ }
+
+ LLParcelData parcel_data;
+
+ // HACK: Converting sim access flags to the format
+ // returned by remote parcel response.
+ U8 sim_access = region->getSimAccess();
+ switch(sim_access)
+ {
+ case SIM_ACCESS_MATURE:
+ parcel_data.flags = 0x1;
+
+ mParcelRatingIcon->setValue(icon_m);
+ mRegionRatingIcon->setValue(icon_m);
+ mEstateRatingIcon->setValue(icon_m);
+ break;
+
+ case SIM_ACCESS_ADULT:
+ parcel_data.flags = 0x2;
+
+ mParcelRatingIcon->setValue(icon_r);
+ mRegionRatingIcon->setValue(icon_r);
+ mEstateRatingIcon->setValue(icon_r);
+ break;
+
+ default:
+ parcel_data.flags = 0;
+
+ mParcelRatingIcon->setValue(icon_pg);
+ mRegionRatingIcon->setValue(icon_pg);
+ mEstateRatingIcon->setValue(icon_pg);
+ }
+
+ std::string rating = LLViewerRegion::accessToString(sim_access);
+ mParcelRatingText->setText(rating);
+ mRegionRatingText->setText(rating);
+
+ parcel_data.desc = parcel->getDesc();
+ parcel_data.name = parcel->getName();
+ parcel_data.sim_name = region->getName();
+ parcel_data.snapshot_id = parcel->getSnapshotID();
+ mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
+ (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
+ (F32)pos_global.mdV[VZ]);
+ parcel_data.global_x = pos_global.mdV[VX];
+ parcel_data.global_y = pos_global.mdV[VY];
+ parcel_data.global_z = pos_global.mdV[VZ];
+ parcel_data.owner_id = parcel->getOwnerID();
+
+ std::string on = getString("on");
+ std::string off = getString("off");
+
+ LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
+
+ // Processing parcel characteristics
+ if (vpm->allowAgentVoice(region, parcel))
+ {
+ mVoiceIcon->setValue(icon_voice);
+ mVoiceText->setText(on);
+ }
+ else
+ {
+ mVoiceIcon->setValue(icon_voice_no);
+ mVoiceText->setText(off);
+ }
+
+ if (vpm->allowAgentFly(region, parcel))
+ {
+ mFlyIcon->setValue(icon_fly);
+ mFlyText->setText(on);
+ }
+ else
+ {
+ mFlyIcon->setValue(icon_fly_no);
+ mFlyText->setText(off);
+ }
+
+ if (vpm->allowAgentPush(region, parcel))
+ {
+ mPushIcon->setValue(icon_push);
+ mPushText->setText(on);
+ }
+ else
+ {
+ mPushIcon->setValue(icon_push_no);
+ mPushText->setText(off);
+ }
+
+ if (vpm->allowAgentBuild(parcel))
+ {
+ mBuildIcon->setValue(icon_build);
+ mBuildText->setText(on);
+ }
+ else
+ {
+ mBuildIcon->setValue(icon_build_no);
+ mBuildText->setText(off);
+ }
+
+ if (vpm->allowAgentScripts(region, parcel))
+ {
+ mScriptsIcon->setValue(icon_scripts);
+ mScriptsText->setText(on);
+ }
+ else
+ {
+ mScriptsIcon->setValue(icon_scripts_no);
+ mScriptsText->setText(off);
+ }
+
+ if (vpm->allowAgentDamage(region, parcel))
+ {
+ mDamageIcon->setValue(icon_damage);
+ mDamageText->setText(on);
+ }
+ else
+ {
+ mDamageIcon->setValue(icon_damage_no);
+ mDamageText->setText(off);
+ }
+
+ if (parcel->getSeeAVs())
+ {
+ mSeeAVsIcon->setValue(icon_see_avs_on);
+ mSeeAVsText->setText(on);
+ }
+ else
+ {
+ mSeeAVsIcon->setValue(icon_see_avs_off);
+ mSeeAVsText->setText(off);
+ }
+
+ mRegionNameText->setText(region->getName());
+ mRegionTypeText->setText(region->getLocalizedSimProductName());
+
+ // Determine parcel owner
+ if (parcel->isPublic())
+ {
+ mParcelOwner->setText(getString("public"));
+ mRegionOwnerText->setText(getString("public"));
+ }
+ else
+ {
+ if (parcel->getIsGroupOwned())
+ {
+ mRegionOwnerText->setText(getString("group_owned_text"));
+
+ if(!parcel->getGroupID().isNull())
+ {
+ std::string owner =
+ LLSLURL("group", parcel->getGroupID(), "inspect").getSLURLString();
+ mParcelOwner->setText(owner);
+ }
+ else
+ {
+ std::string owner = getString("none_text");
+ mRegionGroupText->setText(owner);
+ mParcelOwner->setText(owner);
+ }
+ }
+ else
+ {
+ // Figure out the owner's name
+ std::string parcel_owner =
+ LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
+ mParcelOwner->setText(parcel_owner);
+ LLAvatarNameCache::get(region->getOwner(), boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mRegionOwnerText));
+ mRegionGroupText->setText( getString("none_text"));
+ }
+
+ if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
+ {
+ mRegionOwnerText->setText(mRegionOwnerText->getText() + getString("sale_pending_text"));
+ }
+
+ if(!parcel->getGroupID().isNull())
+ {
+ // FIXME: Using parcel group as region group.
+ gCacheName->getGroup(parcel->getGroupID(),
+ boost::bind(&LLPanelPlaceInfo::onNameCache, mRegionGroupText, _2));
+ }
+ }
+
+ mEstateRatingText->setText(region->getSimAccessString());
+
+ S32 area;
+ S32 claim_price;
+ S32 rent_price;
+ F32 dwell;
+ BOOL for_sale;
+ vpm->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell);
+ mForSalePanel->setVisible(for_sale);
+ if (for_sale)
+ {
+ const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
+ if(auth_buyer_id.notNull())
+ {
+ LLAvatarNameCache::get(auth_buyer_id, boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mSaleToText));
+
+ // Show sales info to a specific person or a group he belongs to.
+ if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id))
+ {
+ for_sale = FALSE;
+ }
+ }
+ else
+ {
+ mSaleToText->setText(getString("anyone"));
+ }
+
+ mSalesPriceText->setText(llformat("%s%d ", getString("price_text").c_str(), parcel->getSalePrice()));
+ mAreaText->setText(llformat("%d %s", area, getString("area_text").c_str()));
+ mTrafficText->setText(llformat("%.0f", dwell));
+
+ // Can't have more than region max tasks, regardless of parcel
+ // object bonus factor.
+ S32 primitives = llmin(ll_round(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()),
+ (S32)region->getMaxTasks());
+
+ mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, getString("available").c_str(), parcel->getPrimCount(), getString("allocated").c_str()));
+
+ if (parcel->getAllowOtherScripts())
+ {
+ mParcelScriptsText->setText(getString("all_residents_text"));
+ }
+ else if (parcel->getAllowGroupScripts())
+ {
+ mParcelScriptsText->setText(getString("group_text"));
+ }
+ else
+ {
+ mParcelScriptsText->setText(off);
+ }
+
+ mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off);
+
+ if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
+ {
+ mSubdivideText->setText(getString("can_change"));
+ }
+ else
+ {
+ mSubdivideText->setText(getString("can_not_change"));
+ }
+ if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
+ {
+ mResaleText->setText(getString("can_not_resell"));
+ }
+ else
+ {
+ mResaleText->setText(getString("can_resell"));
+ }
+ }
+
+ mSelectedParcelID = parcel->getLocalID();
+ mLastSelectedRegionID = region->getRegionID();
+ LLPanelPlaceInfo::processParcelInfo(parcel_data);
+
+ mYouAreHerePanel->setVisible(is_current_parcel);
+ getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(for_sale);
+ mAccordionCtrl->arrange();
}
void LLPanelPlaceProfile::updateEstateName(const std::string& name)
{
- mEstateNameText->setText(name);
+ mEstateNameText->setText(name);
}
void LLPanelPlaceProfile::updateEstateOwnerName(const std::string& name)
{
- mEstateOwnerText->setText(name);
+ mEstateOwnerText->setText(name);
}
void LLPanelPlaceProfile::updateCovenantText(const std::string &text)
{
- mCovenantText->setText(text);
+ mCovenantText->setText(text);
}
void LLPanelPlaceProfile::onForSaleBannerClick()
{
- LLViewerParcelMgr* mgr = LLViewerParcelMgr::getInstance();
- LLParcel* parcel = mgr->getFloatingParcelSelection()->getParcel();
- LLViewerRegion* selected_region = mgr->getSelectionRegion();
- if(parcel && selected_region)
- {
- if(parcel->getLocalID() == mSelectedParcelID &&
- mLastSelectedRegionID ==selected_region->getRegionID())
- {
- S32 price = parcel->getSalePrice();
-
- if(price - gStatusBar->getBalance() > 0)
- {
- LLStringUtil::format_map_t args;
- args["AMOUNT"] = llformat("%d", price);
- LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("buying_selected_land", args), price );
- }
- else
- {
- LLViewerParcelMgr::getInstance()->startBuyLand();
- }
- }
- else
- {
- LL_WARNS("Places") << "User is trying to buy remote parcel.Operation is not supported"<< LL_ENDL;
- }
-
- }
+ LLViewerParcelMgr* mgr = LLViewerParcelMgr::getInstance();
+ LLParcel* parcel = mgr->getFloatingParcelSelection()->getParcel();
+ LLViewerRegion* selected_region = mgr->getSelectionRegion();
+ if(parcel && selected_region)
+ {
+ if(parcel->getLocalID() == mSelectedParcelID &&
+ mLastSelectedRegionID ==selected_region->getRegionID())
+ {
+ S32 price = parcel->getSalePrice();
+
+ if(price - gStatusBar->getBalance() > 0)
+ {
+ LLStringUtil::format_map_t args;
+ args["AMOUNT"] = llformat("%d", price);
+ LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("buying_selected_land", args), price );
+ }
+ else
+ {
+ LLViewerParcelMgr::getInstance()->startBuyLand();
+ }
+ }
+ else
+ {
+ LL_WARNS("Places") << "User is trying to buy remote parcel.Operation is not supported"<< LL_ENDL;
+ }
+
+ }
}
// static
void LLPanelPlaceProfile::updateYouAreHereBanner(void* userdata)
{
- //YouAreHere Banner should be displayed only for selected places,
- // If you want to display it for landmark or teleport history item, you should check by mParcelId
+ //YouAreHere Banner should be displayed only for selected places,
+ // If you want to display it for landmark or teleport history item, you should check by mParcelId
- LLPanelPlaceProfile* self = static_cast<LLPanelPlaceProfile*>(userdata);
- if(!self->getVisible())
- return;
+ LLPanelPlaceProfile* self = static_cast<LLPanelPlaceProfile*>(userdata);
+ if(!self->getVisible())
+ return;
- if(!gDisconnected && gAgent.getRegion())
- {
- static F32 radius = gSavedSettings.getF32("YouAreHereDistance");
+ if(!gDisconnected && gAgent.getRegion())
+ {
+ static F32 radius = gSavedSettings.getF32("YouAreHereDistance");
- BOOL display_banner = gAgent.getRegion()->getRegionID() == self->mLastSelectedRegionID &&
- LLAgentUI::checkAgentDistance(self->mPosRegion, radius);
+ BOOL display_banner = gAgent.getRegion()->getRegionID() == self->mLastSelectedRegionID &&
+ LLAgentUI::checkAgentDistance(self->mPosRegion, radius);
- self->mYouAreHerePanel->setVisible(display_banner);
- }
+ self->mYouAreHerePanel->setVisible(display_banner);
+ }
}
diff --git a/indra/newview/llpanelplaceprofile.h b/indra/newview/llpanelplaceprofile.h
index 16478bc179..e440ebc2e1 100644
--- a/indra/newview/llpanelplaceprofile.h
+++ b/indra/newview/llpanelplaceprofile.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,86 +36,86 @@ class LLTextEditor;
class LLPanelPlaceProfile : public LLPanelPlaceInfo
{
public:
- LLPanelPlaceProfile();
- /*virtual*/ ~LLPanelPlaceProfile();
+ LLPanelPlaceProfile();
+ /*virtual*/ ~LLPanelPlaceProfile();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /*virtual*/ void resetLocation();
+ /*virtual*/ void resetLocation();
- /*virtual*/ void setInfoType(EInfoType type);
+ /*virtual*/ void setInfoType(EInfoType type);
- /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
+ /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
- /*virtual*/ void onVisibilityChange(BOOL new_visibility);
+ /*virtual*/ void onVisibilityChange(BOOL new_visibility);
- // Displays information about the currently selected parcel
- // without sending a request to the server.
- // If is_current_parcel true shows "You Are Here" banner.
- void displaySelectedParcelInfo(LLParcel* parcel,
- LLViewerRegion* region,
- const LLVector3d& pos_global,
- bool is_current_parcel);
+ // Displays information about the currently selected parcel
+ // without sending a request to the server.
+ // If is_current_parcel true shows "You Are Here" banner.
+ void displaySelectedParcelInfo(LLParcel* parcel,
+ LLViewerRegion* region,
+ const LLVector3d& pos_global,
+ bool is_current_parcel);
- void updateEstateName(const std::string& name);
- void updateEstateOwnerName(const std::string& name);
- void updateCovenantText(const std::string &text);
+ void updateEstateName(const std::string& name);
+ void updateEstateOwnerName(const std::string& name);
+ void updateCovenantText(const std::string &text);
private:
- void onForSaleBannerClick();
-
- static void updateYouAreHereBanner(void*);// added to gIdleCallbacks
-
- /**
- * Holds last displayed parcel. Needed for YouAreHere banner.
- */
- S32 mSelectedParcelID;
- LLUUID mLastSelectedRegionID;
- F64 mNextCovenantUpdateTime; //seconds since client start
-
- LLPanel* mForSalePanel;
- LLPanel* mYouAreHerePanel;
-
- LLIconCtrl* mParcelRatingIcon;
- LLTextBox* mParcelRatingText;
- LLIconCtrl* mVoiceIcon;
- LLTextBox* mVoiceText;
- LLIconCtrl* mFlyIcon;
- LLTextBox* mFlyText;
- LLIconCtrl* mPushIcon;
- LLTextBox* mPushText;
- LLIconCtrl* mBuildIcon;
- LLTextBox* mBuildText;
- LLIconCtrl* mScriptsIcon;
- LLTextBox* mScriptsText;
- LLIconCtrl* mDamageIcon;
- LLTextBox* mDamageText;
- LLIconCtrl* mSeeAVsIcon;
- LLTextBox* mSeeAVsText;
-
- LLTextBox* mRegionNameText;
- LLTextBox* mRegionTypeText;
- LLIconCtrl* mRegionRatingIcon;
- LLTextBox* mRegionRatingText;
- LLTextBox* mRegionOwnerText;
- LLTextBox* mRegionGroupText;
-
- LLTextBox* mEstateNameText;
- LLTextBox* mEstateRatingText;
- LLIconCtrl* mEstateRatingIcon;
- LLTextBox* mEstateOwnerText;
- LLTextEditor* mCovenantText;
-
- LLTextBox* mSalesPriceText;
- LLTextBox* mAreaText;
- LLTextBox* mTrafficText;
- LLTextBox* mPrimitivesText;
- LLTextBox* mParcelScriptsText;
- LLTextBox* mTerraformLimitsText;
- LLTextEditor* mSubdivideText;
- LLTextEditor* mResaleText;
- LLTextBox* mSaleToText;
- LLAccordionCtrl* mAccordionCtrl;
+ void onForSaleBannerClick();
+
+ static void updateYouAreHereBanner(void*);// added to gIdleCallbacks
+
+ /**
+ * Holds last displayed parcel. Needed for YouAreHere banner.
+ */
+ S32 mSelectedParcelID;
+ LLUUID mLastSelectedRegionID;
+ F64 mNextCovenantUpdateTime; //seconds since client start
+
+ LLPanel* mForSalePanel;
+ LLPanel* mYouAreHerePanel;
+
+ LLIconCtrl* mParcelRatingIcon;
+ LLTextBox* mParcelRatingText;
+ LLIconCtrl* mVoiceIcon;
+ LLTextBox* mVoiceText;
+ LLIconCtrl* mFlyIcon;
+ LLTextBox* mFlyText;
+ LLIconCtrl* mPushIcon;
+ LLTextBox* mPushText;
+ LLIconCtrl* mBuildIcon;
+ LLTextBox* mBuildText;
+ LLIconCtrl* mScriptsIcon;
+ LLTextBox* mScriptsText;
+ LLIconCtrl* mDamageIcon;
+ LLTextBox* mDamageText;
+ LLIconCtrl* mSeeAVsIcon;
+ LLTextBox* mSeeAVsText;
+
+ LLTextBox* mRegionNameText;
+ LLTextBox* mRegionTypeText;
+ LLIconCtrl* mRegionRatingIcon;
+ LLTextBox* mRegionRatingText;
+ LLTextBox* mRegionOwnerText;
+ LLTextBox* mRegionGroupText;
+
+ LLTextBox* mEstateNameText;
+ LLTextBox* mEstateRatingText;
+ LLIconCtrl* mEstateRatingIcon;
+ LLTextBox* mEstateOwnerText;
+ LLTextEditor* mCovenantText;
+
+ LLTextBox* mSalesPriceText;
+ LLTextBox* mAreaText;
+ LLTextBox* mTrafficText;
+ LLTextBox* mPrimitivesText;
+ LLTextBox* mParcelScriptsText;
+ LLTextBox* mTerraformLimitsText;
+ LLTextEditor* mSubdivideText;
+ LLTextEditor* mResaleText;
+ LLTextBox* mSaleToText;
+ LLAccordionCtrl* mAccordionCtrl;
};
#endif // LL_LLPANELPLACEPROFILE_H
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 1d5ed93c4d..67aa51e38a 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -77,54 +77,54 @@
// Constants
static const F32 PLACE_INFO_UPDATE_INTERVAL = 3.0;
-static const std::string AGENT_INFO_TYPE = "agent";
-static const std::string CREATE_LANDMARK_INFO_TYPE = "create_landmark";
-static const std::string CREATE_PICK_TYPE = "create_pick";
-static const std::string LANDMARK_INFO_TYPE = "landmark";
-static const std::string REMOTE_PLACE_INFO_TYPE = "remote_place";
-static const std::string TELEPORT_HISTORY_INFO_TYPE = "teleport_history";
+static const std::string AGENT_INFO_TYPE = "agent";
+static const std::string CREATE_LANDMARK_INFO_TYPE = "create_landmark";
+static const std::string CREATE_PICK_TYPE = "create_pick";
+static const std::string LANDMARK_INFO_TYPE = "landmark";
+static const std::string REMOTE_PLACE_INFO_TYPE = "remote_place";
+static const std::string TELEPORT_HISTORY_INFO_TYPE = "teleport_history";
static const std::string LANDMARK_TAB_INFO_TYPE = "open_landmark_tab";
// Support for secondlife:///app/parcel/{UUID}/about SLapps
class LLParcelHandler : public LLCommandHandler
{
public:
- // requires trusted browser to trigger
- LLParcelHandler() : LLCommandHandler("parcel", UNTRUSTED_THROTTLE) { }
- bool handle(const LLSD& params,
+ // requires trusted browser to trigger
+ LLParcelHandler() : LLCommandHandler("parcel", UNTRUSTED_THROTTLE) { }
+ bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- if (params.size() < 2)
- {
- return false;
- }
-
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnablePlaceProfile"))
- {
- LLNotificationsUtil::add("NoPlaceInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
-
- LLUUID parcel_id;
- if (!parcel_id.set(params[0], FALSE))
- {
- return false;
- }
- if (params[1].asString() == "about")
- {
- if (parcel_id.notNull())
- {
- LLSD key;
- key["type"] = "remote_place";
- key["id"] = parcel_id;
- LLFloaterSidePanelContainer::showPanel("places", key);
- return true;
- }
- }
- return false;
- }
+ {
+ if (params.size() < 2)
+ {
+ return false;
+ }
+
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnablePlaceProfile"))
+ {
+ LLNotificationsUtil::add("NoPlaceInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ LLUUID parcel_id;
+ if (!parcel_id.set(params[0], FALSE))
+ {
+ return false;
+ }
+ if (params[1].asString() == "about")
+ {
+ if (parcel_id.notNull())
+ {
+ LLSD key;
+ key["type"] = "remote_place";
+ key["id"] = parcel_id;
+ LLFloaterSidePanelContainer::showPanel("places", key);
+ return true;
+ }
+ }
+ return false;
+ }
};
LLParcelHandler gParcelHandler;
@@ -136,164 +136,164 @@ static void onSLURLBuilt(std::string& slurl);
class LLPlacesParcelObserver : public LLParcelObserver
{
public:
- LLPlacesParcelObserver(LLPanelPlaces* places_panel) :
- LLParcelObserver(),
- mPlaces(places_panel)
- {}
+ LLPlacesParcelObserver(LLPanelPlaces* places_panel) :
+ LLParcelObserver(),
+ mPlaces(places_panel)
+ {}
- /*virtual*/ void changed()
- {
- if (mPlaces)
- mPlaces->changedParcelSelection();
- }
+ /*virtual*/ void changed()
+ {
+ if (mPlaces)
+ mPlaces->changedParcelSelection();
+ }
private:
- LLPanelPlaces* mPlaces;
+ LLPanelPlaces* mPlaces;
};
class LLPlacesInventoryObserver : public LLInventoryAddedObserver
{
public:
- LLPlacesInventoryObserver(LLPanelPlaces* places_panel) :
- mPlaces(places_panel)
- {}
+ LLPlacesInventoryObserver(LLPanelPlaces* places_panel) :
+ mPlaces(places_panel)
+ {}
- /*virtual*/ void changed(U32 mask)
- {
- LLInventoryAddedObserver::changed(mask);
+ /*virtual*/ void changed(U32 mask)
+ {
+ LLInventoryAddedObserver::changed(mask);
- if (mPlaces && !mPlaces->tabsCreated())
- {
- mPlaces->createTabs();
- }
- }
+ if (mPlaces && !mPlaces->tabsCreated())
+ {
+ mPlaces->createTabs();
+ }
+ }
protected:
- /*virtual*/ void done()
- {
- mPlaces->showAddedLandmarkInfo(gInventory.getAddedIDs());
- }
+ /*virtual*/ void done()
+ {
+ mPlaces->showAddedLandmarkInfo(gInventory.getAddedIDs());
+ }
private:
- LLPanelPlaces* mPlaces;
+ LLPanelPlaces* mPlaces;
};
class LLPlacesRemoteParcelInfoObserver : public LLRemoteParcelInfoObserver
{
public:
- LLPlacesRemoteParcelInfoObserver(LLPanelPlaces* places_panel) :
- LLRemoteParcelInfoObserver(),
- mPlaces(places_panel)
- {}
-
- ~LLPlacesRemoteParcelInfoObserver()
- {
- // remove any in-flight observers
- std::set<LLUUID>::iterator it;
- for (it = mParcelIDs.begin(); it != mParcelIDs.end(); ++it)
- {
- const LLUUID &id = *it;
- LLRemoteParcelInfoProcessor::getInstance()->removeObserver(id, this);
- }
- mParcelIDs.clear();
- }
-
- /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data)
- {
- if (mPlaces)
- {
- mPlaces->changedGlobalPos(LLVector3d(parcel_data.global_x,
- parcel_data.global_y,
- parcel_data.global_z));
- }
-
- mParcelIDs.erase(parcel_data.parcel_id);
- LLRemoteParcelInfoProcessor::getInstance()->removeObserver(parcel_data.parcel_id, this);
- }
- /*virtual*/ void setParcelID(const LLUUID& parcel_id)
- {
- if (!parcel_id.isNull())
- {
- mParcelIDs.insert(parcel_id);
- LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this);
- LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id);
- }
- }
- /*virtual*/ void setErrorStatus(S32 status, const std::string& reason)
- {
- LL_ERRS() << "Can't complete remote parcel request. Http Status: "
- << status << ". Reason : " << reason << LL_ENDL;
- }
+ LLPlacesRemoteParcelInfoObserver(LLPanelPlaces* places_panel) :
+ LLRemoteParcelInfoObserver(),
+ mPlaces(places_panel)
+ {}
+
+ ~LLPlacesRemoteParcelInfoObserver()
+ {
+ // remove any in-flight observers
+ std::set<LLUUID>::iterator it;
+ for (it = mParcelIDs.begin(); it != mParcelIDs.end(); ++it)
+ {
+ const LLUUID &id = *it;
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(id, this);
+ }
+ mParcelIDs.clear();
+ }
+
+ /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data)
+ {
+ if (mPlaces)
+ {
+ mPlaces->changedGlobalPos(LLVector3d(parcel_data.global_x,
+ parcel_data.global_y,
+ parcel_data.global_z));
+ }
+
+ mParcelIDs.erase(parcel_data.parcel_id);
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(parcel_data.parcel_id, this);
+ }
+ /*virtual*/ void setParcelID(const LLUUID& parcel_id)
+ {
+ if (!parcel_id.isNull())
+ {
+ mParcelIDs.insert(parcel_id);
+ LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this);
+ LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id);
+ }
+ }
+ /*virtual*/ void setErrorStatus(S32 status, const std::string& reason)
+ {
+ LL_ERRS() << "Can't complete remote parcel request. Http Status: "
+ << status << ". Reason : " << reason << LL_ENDL;
+ }
private:
- std::set<LLUUID> mParcelIDs;
- LLPanelPlaces* mPlaces;
+ std::set<LLUUID> mParcelIDs;
+ LLPanelPlaces* mPlaces;
};
static LLPanelInjector<LLPanelPlaces> t_places("panel_places");
LLPanelPlaces::LLPanelPlaces()
- : LLPanel(),
- mActivePanel(NULL),
- mFilterEditor(NULL),
- mPlaceProfile(NULL),
- mLandmarkInfo(NULL),
- mItem(NULL),
- mPlaceMenu(NULL),
- mLandmarkMenu(NULL),
- mPosGlobal(),
- isLandmarkEditModeOn(false),
- mTabsCreated(false)
+ : LLPanel(),
+ mActivePanel(NULL),
+ mFilterEditor(NULL),
+ mPlaceProfile(NULL),
+ mLandmarkInfo(NULL),
+ mItem(NULL),
+ mPlaceMenu(NULL),
+ mLandmarkMenu(NULL),
+ mPosGlobal(),
+ isLandmarkEditModeOn(false),
+ mTabsCreated(false)
{
- mParcelObserver = new LLPlacesParcelObserver(this);
- mInventoryObserver = new LLPlacesInventoryObserver(this);
- mRemoteParcelObserver = new LLPlacesRemoteParcelInfoObserver(this);
+ mParcelObserver = new LLPlacesParcelObserver(this);
+ mInventoryObserver = new LLPlacesInventoryObserver(this);
+ mRemoteParcelObserver = new LLPlacesRemoteParcelInfoObserver(this);
- gInventory.addObserver(mInventoryObserver);
+ gInventory.addObserver(mInventoryObserver);
- mAgentParcelChangedConnection = gAgent.addParcelChangedCallback(
- boost::bind(&LLPanelPlaces::updateVerbs, this));
+ mAgentParcelChangedConnection = gAgent.addParcelChangedCallback(
+ boost::bind(&LLPanelPlaces::updateVerbs, this));
- //buildFromFile( "panel_places.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
+ //buildFromFile( "panel_places.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
}
LLPanelPlaces::~LLPanelPlaces()
{
- if (gInventory.containsObserver(mInventoryObserver))
- gInventory.removeObserver(mInventoryObserver);
+ if (gInventory.containsObserver(mInventoryObserver))
+ gInventory.removeObserver(mInventoryObserver);
- LLViewerParcelMgr::getInstance()->removeObserver(mParcelObserver);
+ LLViewerParcelMgr::getInstance()->removeObserver(mParcelObserver);
- delete mInventoryObserver;
- delete mParcelObserver;
- delete mRemoteParcelObserver;
+ delete mInventoryObserver;
+ delete mParcelObserver;
+ delete mRemoteParcelObserver;
- if (mAgentParcelChangedConnection.connected())
- {
- mAgentParcelChangedConnection.disconnect();
- }
+ if (mAgentParcelChangedConnection.connected())
+ {
+ mAgentParcelChangedConnection.disconnect();
+ }
}
BOOL LLPanelPlaces::postBuild()
{
- mTeleportBtn = getChild<LLButton>("teleport_btn");
- mTeleportBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onTeleportButtonClicked, this));
-
- mShowOnMapBtn = getChild<LLButton>("map_btn");
- mShowOnMapBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onShowOnMapButtonClicked, this));
+ mTeleportBtn = getChild<LLButton>("teleport_btn");
+ mTeleportBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onTeleportButtonClicked, this));
- mSaveBtn = getChild<LLButton>("save_btn");
- mSaveBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onSaveButtonClicked, this));
+ mShowOnMapBtn = getChild<LLButton>("map_btn");
+ mShowOnMapBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onShowOnMapButtonClicked, this));
- mCancelBtn = getChild<LLButton>("cancel_btn");
- mCancelBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onCancelButtonClicked, this));
+ mSaveBtn = getChild<LLButton>("save_btn");
+ mSaveBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onSaveButtonClicked, this));
- mCloseBtn = getChild<LLButton>("close_btn");
- mCloseBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this));
+ mCancelBtn = getChild<LLButton>("cancel_btn");
+ mCancelBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onCancelButtonClicked, this));
- mOverflowBtn = getChild<LLMenuButton>("overflow_btn");
- mOverflowBtn->setMouseDownCallback(boost::bind(&LLPanelPlaces::onOverflowButtonClicked, this));
+ mCloseBtn = getChild<LLButton>("close_btn");
+ mCloseBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this));
+
+ mOverflowBtn = getChild<LLMenuButton>("overflow_btn");
+ mOverflowBtn->setMouseDownCallback(boost::bind(&LLPanelPlaces::onOverflowButtonClicked, this));
mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
mGearMenuButton->setMouseDownCallback(boost::bind(&LLPanelPlaces::onGearMenuClick, this));
@@ -315,102 +315,102 @@ BOOL LLPanelPlaces::postBuild()
, _7 // EAcceptance* accept
));
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- registrar.add("Places.OverflowMenu.Action", boost::bind(&LLPanelPlaces::onOverflowMenuItemClicked, this, _2));
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- enable_registrar.add("Places.OverflowMenu.Enable", boost::bind(&LLPanelPlaces::onOverflowMenuItemEnable, this, _2));
-
- mPlaceMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_place.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if (mPlaceMenu)
- {
- mPlaceMenu->setAlwaysShowMenu(TRUE);
- }
- else
- {
- LL_WARNS() << "Error loading Place menu" << LL_ENDL;
- }
-
- mLandmarkMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_landmark.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if (!mLandmarkMenu)
- {
- LL_WARNS() << "Error loading Landmark menu" << LL_ENDL;
- }
-
- mTabContainer = getChild<LLTabContainer>("Places Tabs");
- if (mTabContainer)
- {
- mTabContainer->setCommitCallback(boost::bind(&LLPanelPlaces::onTabSelected, this));
- }
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ registrar.add("Places.OverflowMenu.Action", boost::bind(&LLPanelPlaces::onOverflowMenuItemClicked, this, _2));
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+ enable_registrar.add("Places.OverflowMenu.Enable", boost::bind(&LLPanelPlaces::onOverflowMenuItemEnable, this, _2));
+
+ mPlaceMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_place.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (mPlaceMenu)
+ {
+ mPlaceMenu->setAlwaysShowMenu(TRUE);
+ }
+ else
+ {
+ LL_WARNS() << "Error loading Place menu" << LL_ENDL;
+ }
+
+ mLandmarkMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_landmark.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if (!mLandmarkMenu)
+ {
+ LL_WARNS() << "Error loading Landmark menu" << LL_ENDL;
+ }
+
+ mTabContainer = getChild<LLTabContainer>("Places Tabs");
+ if (mTabContainer)
+ {
+ mTabContainer->setCommitCallback(boost::bind(&LLPanelPlaces::onTabSelected, this));
+ }
mButtonsContainer = getChild<LLPanel>("button_layout_panel");
mButtonsContainer->setVisible(FALSE);
mFilterContainer = getChild<LLLayoutStack>("top_menu_panel");
- mFilterEditor = getChild<LLFilterEditor>("Filter");
- if (mFilterEditor)
- {
- //when list item is being clicked the filter editor looses focus
- //committing on focus lost leads to detaching list items
- //BUT a detached list item cannot be made selected and must not be clicked onto
- mFilterEditor->setCommitOnFocusLost(false);
+ mFilterEditor = getChild<LLFilterEditor>("Filter");
+ if (mFilterEditor)
+ {
+ //when list item is being clicked the filter editor looses focus
+ //committing on focus lost leads to detaching list items
+ //BUT a detached list item cannot be made selected and must not be clicked onto
+ mFilterEditor->setCommitOnFocusLost(false);
- mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2, false));
- }
+ mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2, false));
+ }
- mPlaceProfile = findChild<LLPanelPlaceProfile>("panel_place_profile");
- mLandmarkInfo = findChild<LLPanelLandmarkInfo>("panel_landmark_info");
- if (!mPlaceProfile || !mLandmarkInfo)
- return FALSE;
+ mPlaceProfile = findChild<LLPanelPlaceProfile>("panel_place_profile");
+ mLandmarkInfo = findChild<LLPanelLandmarkInfo>("panel_landmark_info");
+ if (!mPlaceProfile || !mLandmarkInfo)
+ return FALSE;
- mPlaceProfileBackBtn = mPlaceProfile->getChild<LLButton>("back_btn");
- mPlaceProfileBackBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this));
+ mPlaceProfileBackBtn = mPlaceProfile->getChild<LLButton>("back_btn");
+ mPlaceProfileBackBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this));
- mLandmarkInfo->getChild<LLButton>("back_btn")->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this));
+ mLandmarkInfo->getChild<LLButton>("back_btn")->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this));
- LLLineEditor* title_editor = mLandmarkInfo->getChild<LLLineEditor>("title_editor");
- title_editor->setKeystrokeCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this), NULL);
+ LLLineEditor* title_editor = mLandmarkInfo->getChild<LLLineEditor>("title_editor");
+ title_editor->setKeystrokeCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this), NULL);
- LLTextEditor* notes_editor = mLandmarkInfo->getChild<LLTextEditor>("notes_editor");
- notes_editor->setKeystrokeCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this));
+ LLTextEditor* notes_editor = mLandmarkInfo->getChild<LLTextEditor>("notes_editor");
+ notes_editor->setKeystrokeCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this));
- LLComboBox* folder_combo = mLandmarkInfo->getChild<LLComboBox>("folder_combo");
- folder_combo->setCommitCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this));
+ LLComboBox* folder_combo = mLandmarkInfo->getChild<LLComboBox>("folder_combo");
+ folder_combo->setCommitCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this));
- LLButton* edit_btn = mLandmarkInfo->getChild<LLButton>("edit_btn");
- edit_btn->setCommitCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this));
+ LLButton* edit_btn = mLandmarkInfo->getChild<LLButton>("edit_btn");
+ edit_btn->setCommitCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this));
- createTabs();
- updateVerbs();
+ createTabs();
+ updateVerbs();
- return TRUE;
+ return TRUE;
}
void LLPanelPlaces::onOpen(const LLSD& key)
{
- if (!mPlaceProfile || !mLandmarkInfo)
- return;
-
- if (key.size() != 0)
- {
- isLandmarkEditModeOn = false;
- std::string key_type = key["type"].asString();
- if (key_type == LANDMARK_TAB_INFO_TYPE)
- {
- // Small hack: We need to toggle twice. The first toggle moves from the Landmark
- // or Teleport History info panel to the Landmark or Teleport History list panel.
- // For this first toggle, the mPlaceInfoType should be the one previously used so
- // that the state can be corretly set.
- // The second toggle forces the list to be set to Landmark.
- // This avoids extracting and duplicating all the state logic from togglePlaceInfoPanel()
- // here or some specific private method
- togglePlaceInfoPanel(FALSE);
- mPlaceInfoType = key_type;
- togglePlaceInfoPanel(FALSE);
- // Update the active tab
- onTabSelected();
- // Update the buttons at the bottom of the panel
- updateVerbs();
- }
+ if (!mPlaceProfile || !mLandmarkInfo)
+ return;
+
+ if (key.size() != 0)
+ {
+ isLandmarkEditModeOn = false;
+ std::string key_type = key["type"].asString();
+ if (key_type == LANDMARK_TAB_INFO_TYPE)
+ {
+ // Small hack: We need to toggle twice. The first toggle moves from the Landmark
+ // or Teleport History info panel to the Landmark or Teleport History list panel.
+ // For this first toggle, the mPlaceInfoType should be the one previously used so
+ // that the state can be corretly set.
+ // The second toggle forces the list to be set to Landmark.
+ // This avoids extracting and duplicating all the state logic from togglePlaceInfoPanel()
+ // here or some specific private method
+ togglePlaceInfoPanel(FALSE);
+ mPlaceInfoType = key_type;
+ togglePlaceInfoPanel(FALSE);
+ // Update the active tab
+ onTabSelected();
+ // Update the buttons at the bottom of the panel
+ updateVerbs();
+ }
else if (key_type == CREATE_PICK_TYPE)
{
LLUUID item_id = key["item_id"];
@@ -426,236 +426,236 @@ void LLPanelPlaces::onOpen(const LLSD& key)
}
}
}
- else // "create_landmark"
- {
- mFilterEditor->clear();
- onFilterEdit("", false);
-
- mPlaceInfoType = key_type;
- mPosGlobal.setZero();
- mItem = NULL;
- mRegionId.setNull();
- togglePlaceInfoPanel(TRUE);
-
- if (mPlaceInfoType == AGENT_INFO_TYPE)
- {
- mPlaceProfile->setInfoType(LLPanelPlaceInfo::AGENT);
- if (gAgent.getRegion())
- {
- mRegionId = gAgent.getRegion()->getRegionID();
- }
- }
- else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE)
- {
- LLUUID dest_folder = key["dest_folder"];
- mLandmarkInfo->setInfoAndCreateLandmark(dest_folder);
-
- if (key.has("x") && key.has("y") && key.has("z"))
- {
- mPosGlobal = LLVector3d(key["x"].asReal(),
- key["y"].asReal(),
- key["z"].asReal());
- }
- else
- {
- mPosGlobal = gAgent.getPositionGlobal();
- }
-
- mLandmarkInfo->displayParcelInfo(LLUUID(), mPosGlobal);
-
- mSaveBtn->setEnabled(FALSE);
- }
- else if (mPlaceInfoType == LANDMARK_INFO_TYPE)
- {
- mLandmarkInfo->setInfoType(LLPanelPlaceInfo::LANDMARK);
-
- LLUUID id = key["id"].asUUID();
- LLInventoryItem* item = gInventory.getItem(id);
- if (!item)
- return;
+ else // "create_landmark"
+ {
+ mFilterEditor->clear();
+ onFilterEdit("", false);
+
+ mPlaceInfoType = key_type;
+ mPosGlobal.setZero();
+ mItem = NULL;
+ mRegionId.setNull();
+ togglePlaceInfoPanel(TRUE);
+
+ if (mPlaceInfoType == AGENT_INFO_TYPE)
+ {
+ mPlaceProfile->setInfoType(LLPanelPlaceInfo::AGENT);
+ if (gAgent.getRegion())
+ {
+ mRegionId = gAgent.getRegion()->getRegionID();
+ }
+ }
+ else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE)
+ {
+ LLUUID dest_folder = key["dest_folder"];
+ mLandmarkInfo->setInfoAndCreateLandmark(dest_folder);
+
+ if (key.has("x") && key.has("y") && key.has("z"))
+ {
+ mPosGlobal = LLVector3d(key["x"].asReal(),
+ key["y"].asReal(),
+ key["z"].asReal());
+ }
+ else
+ {
+ mPosGlobal = gAgent.getPositionGlobal();
+ }
+
+ mLandmarkInfo->displayParcelInfo(LLUUID(), mPosGlobal);
+
+ mSaveBtn->setEnabled(FALSE);
+ }
+ else if (mPlaceInfoType == LANDMARK_INFO_TYPE)
+ {
+ mLandmarkInfo->setInfoType(LLPanelPlaceInfo::LANDMARK);
+
+ LLUUID id = key["id"].asUUID();
+ LLInventoryItem* item = gInventory.getItem(id);
+ if (!item)
+ return;
BOOL is_editable = gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID())
&& item->getPermissions().allowModifyBy(gAgent.getID());
mLandmarkInfo->setCanEdit(is_editable);
- setItem(item);
- }
- else if (mPlaceInfoType == REMOTE_PLACE_INFO_TYPE)
- {
- if (key.has("id"))
- {
- LLUUID parcel_id = key["id"].asUUID();
- mPlaceProfile->setParcelID(parcel_id);
-
- // query the server to get the global 3D position of this
- // parcel - we need this for teleport/mapping functions.
- mRemoteParcelObserver->setParcelID(parcel_id);
- }
- else
- {
- mPosGlobal = LLVector3d(key["x"].asReal(),
- key["y"].asReal(),
- key["z"].asReal());
- mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal);
- }
-
- mPlaceProfile->setInfoType(LLPanelPlaceInfo::PLACE);
- }
- else if (mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
- {
- S32 index = key["id"].asInteger();
-
- const LLTeleportHistoryStorage::slurl_list_t& hist_items =
- LLTeleportHistoryStorage::getInstance()->getItems();
-
- mPosGlobal = hist_items[index].mGlobalPos;
-
- mPlaceProfile->setInfoType(LLPanelPlaceInfo::TELEPORT_HISTORY);
- mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal);
- }
-
- updateVerbs();
- }
- }
-
- LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
- if (!parcel_mgr)
- return;
-
- mParcelLocalId = parcel_mgr->getAgentParcel()->getLocalID();
-
- // Start using LLViewerParcelMgr for land selection if
- // information about nearby land is requested.
- // Otherwise stop using land selection and deselect land.
- if (mPlaceInfoType == AGENT_INFO_TYPE)
- {
- // We don't know if we are already added to LLViewerParcelMgr observers list
- // so try to remove observer not to add an extra one.
- parcel_mgr->removeObserver(mParcelObserver);
-
- parcel_mgr->addObserver(mParcelObserver);
- parcel_mgr->selectParcelAt(gAgent.getPositionGlobal());
- }
- else
- {
- parcel_mgr->removeObserver(mParcelObserver);
-
- // Clear the reference to selection to allow its removal in deselectUnused().
- mParcel.clear();
-
- if (!parcel_mgr->selectionEmpty())
- {
- parcel_mgr->deselectUnused();
- }
- }
+ setItem(item);
+ }
+ else if (mPlaceInfoType == REMOTE_PLACE_INFO_TYPE)
+ {
+ if (key.has("id"))
+ {
+ LLUUID parcel_id = key["id"].asUUID();
+ mPlaceProfile->setParcelID(parcel_id);
+
+ // query the server to get the global 3D position of this
+ // parcel - we need this for teleport/mapping functions.
+ mRemoteParcelObserver->setParcelID(parcel_id);
+ }
+ else
+ {
+ mPosGlobal = LLVector3d(key["x"].asReal(),
+ key["y"].asReal(),
+ key["z"].asReal());
+ mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal);
+ }
+
+ mPlaceProfile->setInfoType(LLPanelPlaceInfo::PLACE);
+ }
+ else if (mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
+ {
+ S32 index = key["id"].asInteger();
+
+ const LLTeleportHistoryStorage::slurl_list_t& hist_items =
+ LLTeleportHistoryStorage::getInstance()->getItems();
+
+ mPosGlobal = hist_items[index].mGlobalPos;
+
+ mPlaceProfile->setInfoType(LLPanelPlaceInfo::TELEPORT_HISTORY);
+ mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal);
+ }
+
+ updateVerbs();
+ }
+ }
+
+ LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+ if (!parcel_mgr)
+ return;
+
+ mParcelLocalId = parcel_mgr->getAgentParcel()->getLocalID();
+
+ // Start using LLViewerParcelMgr for land selection if
+ // information about nearby land is requested.
+ // Otherwise stop using land selection and deselect land.
+ if (mPlaceInfoType == AGENT_INFO_TYPE)
+ {
+ // We don't know if we are already added to LLViewerParcelMgr observers list
+ // so try to remove observer not to add an extra one.
+ parcel_mgr->removeObserver(mParcelObserver);
+
+ parcel_mgr->addObserver(mParcelObserver);
+ parcel_mgr->selectParcelAt(gAgent.getPositionGlobal());
+ }
+ else
+ {
+ parcel_mgr->removeObserver(mParcelObserver);
+
+ // Clear the reference to selection to allow its removal in deselectUnused().
+ mParcel.clear();
+
+ if (!parcel_mgr->selectionEmpty())
+ {
+ parcel_mgr->deselectUnused();
+ }
+ }
}
void LLPanelPlaces::setItem(LLInventoryItem* item)
{
- if (!mLandmarkInfo || !item)
- return;
-
- mItem = item;
-
- LLAssetType::EType item_type = mItem->getActualType();
- if (item_type == LLAssetType::AT_LANDMARK || item_type == LLAssetType::AT_LINK)
- {
- // If the item is a link get a linked item
- if (item_type == LLAssetType::AT_LINK)
- {
- mItem = gInventory.getItem(mItem->getLinkedUUID());
- if (mItem.isNull())
- return;
- }
- }
- else
- {
- return;
- }
-
- // Check if item is in agent's inventory and he has the permission to modify it.
- BOOL is_landmark_editable = gInventory.isObjectDescendentOf(mItem->getUUID(), gInventory.getRootFolderID()) &&
- mItem->getPermissions().allowModifyBy(gAgent.getID());
-
- mSaveBtn->setEnabled(is_landmark_editable);
-
- if (is_landmark_editable)
- {
- if(!mLandmarkInfo->setLandmarkFolder(mItem->getParentUUID()) && !mItem->getParentUUID().isNull())
- {
- const LLViewerInventoryCategory* cat = gInventory.getCategory(mItem->getParentUUID());
- if (cat)
- {
- std::string cat_fullname = LLPanelLandmarkInfo::getFullFolderName(cat);
- LLComboBox* folderList = mLandmarkInfo->getChild<LLComboBox>("folder_combo");
- folderList->add(cat_fullname, cat->getUUID(), ADD_TOP);
- }
- }
- }
-
- mLandmarkInfo->displayItemInfo(mItem);
-
- LLLandmark* lm = gLandmarkList.getAsset(mItem->getAssetUUID(),
- boost::bind(&LLPanelPlaces::onLandmarkLoaded, this, _1));
- if (lm)
- {
- onLandmarkLoaded(lm);
- }
+ if (!mLandmarkInfo || !item)
+ return;
+
+ mItem = item;
+
+ LLAssetType::EType item_type = mItem->getActualType();
+ if (item_type == LLAssetType::AT_LANDMARK || item_type == LLAssetType::AT_LINK)
+ {
+ // If the item is a link get a linked item
+ if (item_type == LLAssetType::AT_LINK)
+ {
+ mItem = gInventory.getItem(mItem->getLinkedUUID());
+ if (mItem.isNull())
+ return;
+ }
+ }
+ else
+ {
+ return;
+ }
+
+ // Check if item is in agent's inventory and he has the permission to modify it.
+ BOOL is_landmark_editable = gInventory.isObjectDescendentOf(mItem->getUUID(), gInventory.getRootFolderID()) &&
+ mItem->getPermissions().allowModifyBy(gAgent.getID());
+
+ mSaveBtn->setEnabled(is_landmark_editable);
+
+ if (is_landmark_editable)
+ {
+ if(!mLandmarkInfo->setLandmarkFolder(mItem->getParentUUID()) && !mItem->getParentUUID().isNull())
+ {
+ const LLViewerInventoryCategory* cat = gInventory.getCategory(mItem->getParentUUID());
+ if (cat)
+ {
+ std::string cat_fullname = LLPanelLandmarkInfo::getFullFolderName(cat);
+ LLComboBox* folderList = mLandmarkInfo->getChild<LLComboBox>("folder_combo");
+ folderList->add(cat_fullname, cat->getUUID(), ADD_TOP);
+ }
+ }
+ }
+
+ mLandmarkInfo->displayItemInfo(mItem);
+
+ LLLandmark* lm = gLandmarkList.getAsset(mItem->getAssetUUID(),
+ boost::bind(&LLPanelPlaces::onLandmarkLoaded, this, _1));
+ if (lm)
+ {
+ onLandmarkLoaded(lm);
+ }
}
S32 LLPanelPlaces::notifyParent(const LLSD& info)
{
- if(info.has("update_verbs"))
- {
- if(mPosGlobal.isExactlyZero())
- {
- mPosGlobal.setVec(info["global_x"], info["global_y"], info["global_z"]);
- }
-
- updateVerbs();
-
- return 1;
- }
- return LLPanel::notifyParent(info);
+ if(info.has("update_verbs"))
+ {
+ if(mPosGlobal.isExactlyZero())
+ {
+ mPosGlobal.setVec(info["global_x"], info["global_y"], info["global_z"]);
+ }
+
+ updateVerbs();
+
+ return 1;
+ }
+ return LLPanel::notifyParent(info);
}
void LLPanelPlaces::onLandmarkLoaded(LLLandmark* landmark)
{
- if (!mLandmarkInfo)
- return;
+ if (!mLandmarkInfo)
+ return;
- LLUUID region_id;
- landmark->getRegionID(region_id);
- landmark->getGlobalPos(mPosGlobal);
- mLandmarkInfo->displayParcelInfo(region_id, mPosGlobal);
+ LLUUID region_id;
+ landmark->getRegionID(region_id);
+ landmark->getGlobalPos(mPosGlobal);
+ mLandmarkInfo->displayParcelInfo(region_id, mPosGlobal);
- updateVerbs();
+ updateVerbs();
}
void LLPanelPlaces::onFilterEdit(const std::string& search_string, bool force_filter)
{
- if (!mActivePanel)
- return;
+ if (!mActivePanel)
+ return;
- if (force_filter || mActivePanel->getFilterSubString() != search_string)
- {
- std::string string = search_string;
+ if (force_filter || mActivePanel->getFilterSubString() != search_string)
+ {
+ std::string string = search_string;
- // Searches are case-insensitive
- // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is.
+ // Searches are case-insensitive
+ // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is.
- mActivePanel->onSearchEdit(string);
- }
+ mActivePanel->onSearchEdit(string);
+ }
}
void LLPanelPlaces::onTabSelected()
{
- mActivePanel = dynamic_cast<LLPanelPlacesTab*>(mTabContainer->getCurrentPanel());
- if (!mActivePanel)
- return;
+ mActivePanel = dynamic_cast<LLPanelPlacesTab*>(mTabContainer->getCurrentPanel());
+ if (!mActivePanel)
+ return;
- onFilterEdit(mActivePanel->getFilterSubString(), true);
- mActivePanel->updateVerbs();
+ onFilterEdit(mActivePanel->getFilterSubString(), true);
+ mActivePanel->updateVerbs();
// History panel does not support deletion nor creation
// Hide menus
@@ -677,315 +677,315 @@ void LLPanelPlaces::onTabSelected()
void LLPanelPlaces::onTeleportButtonClicked()
{
- LLPanelPlaceInfo* panel = getCurrentInfoPanel();
- if (panel && panel->getVisible())
- {
- if (mPlaceInfoType == LANDMARK_INFO_TYPE)
- {
- if (mItem.isNull())
- {
- LL_WARNS() << "NULL landmark item" << LL_ENDL;
- llassert(mItem.notNull());
- return;
- }
-
- LLSD payload;
- payload["asset_id"] = mItem->getAssetUUID();
- LLSD args;
- args["LOCATION"] = mItem->getName();
- LLNotificationsUtil::add("TeleportFromLandmark", args, payload);
- }
- else if (mPlaceInfoType == AGENT_INFO_TYPE ||
- mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
- mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
- {
- LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
- if (!mPosGlobal.isExactlyZero() && worldmap_instance)
- {
- gAgent.teleportViaLocation(mPosGlobal);
- worldmap_instance->trackLocation(mPosGlobal);
- }
- }
- }
- else
- {
- if (mActivePanel)
- mActivePanel->onTeleport();
- }
+ LLPanelPlaceInfo* panel = getCurrentInfoPanel();
+ if (panel && panel->getVisible())
+ {
+ if (mPlaceInfoType == LANDMARK_INFO_TYPE)
+ {
+ if (mItem.isNull())
+ {
+ LL_WARNS() << "NULL landmark item" << LL_ENDL;
+ llassert(mItem.notNull());
+ return;
+ }
+
+ LLSD payload;
+ payload["asset_id"] = mItem->getAssetUUID();
+ LLSD args;
+ args["LOCATION"] = mItem->getName();
+ LLNotificationsUtil::add("TeleportFromLandmark", args, payload);
+ }
+ else if (mPlaceInfoType == AGENT_INFO_TYPE ||
+ mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
+ mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
+ {
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+ if (!mPosGlobal.isExactlyZero() && worldmap_instance)
+ {
+ gAgent.teleportViaLocation(mPosGlobal);
+ worldmap_instance->trackLocation(mPosGlobal);
+ }
+ }
+ }
+ else
+ {
+ if (mActivePanel)
+ mActivePanel->onTeleport();
+ }
}
void LLPanelPlaces::onShowOnMapButtonClicked()
{
- LLPanelPlaceInfo* panel = getCurrentInfoPanel();
- if (panel && panel->getVisible())
- {
- LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
- if(!worldmap_instance)
- return;
-
- if (mPlaceInfoType == AGENT_INFO_TYPE ||
- mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE ||
- mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
- mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
- {
- if (!mPosGlobal.isExactlyZero())
- {
- worldmap_instance->trackLocation(mPosGlobal);
- LLFloaterReg::showInstance("world_map", "center");
- }
- }
- else if (mPlaceInfoType == LANDMARK_INFO_TYPE)
- {
- if (mItem.isNull())
- {
- LL_WARNS() << "NULL landmark item" << LL_ENDL;
- llassert(mItem.notNull());
- return;
- }
- LLLandmark* landmark = gLandmarkList.getAsset(mItem->getAssetUUID());
- if (!landmark)
- return;
-
- LLVector3d landmark_global_pos;
- if (!landmark->getGlobalPos(landmark_global_pos))
- return;
-
- if (!landmark_global_pos.isExactlyZero())
- {
- worldmap_instance->trackLocation(landmark_global_pos);
- LLFloaterReg::showInstance("world_map", "center");
- }
- }
- }
- else
- {
- if (mActivePanel && mActivePanel->isSingleItemSelected())
- {
- mActivePanel->onShowOnMap();
- }
- else
- {
- LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
- LLVector3d global_pos = gAgent.getPositionGlobal();
-
- if (!global_pos.isExactlyZero() && worldmap_instance)
- {
- worldmap_instance->trackLocation(global_pos);
- LLFloaterReg::showInstance("world_map", "center");
- }
- }
- }
+ LLPanelPlaceInfo* panel = getCurrentInfoPanel();
+ if (panel && panel->getVisible())
+ {
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+ if(!worldmap_instance)
+ return;
+
+ if (mPlaceInfoType == AGENT_INFO_TYPE ||
+ mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE ||
+ mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
+ mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
+ {
+ if (!mPosGlobal.isExactlyZero())
+ {
+ worldmap_instance->trackLocation(mPosGlobal);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
+ }
+ else if (mPlaceInfoType == LANDMARK_INFO_TYPE)
+ {
+ if (mItem.isNull())
+ {
+ LL_WARNS() << "NULL landmark item" << LL_ENDL;
+ llassert(mItem.notNull());
+ return;
+ }
+ LLLandmark* landmark = gLandmarkList.getAsset(mItem->getAssetUUID());
+ if (!landmark)
+ return;
+
+ LLVector3d landmark_global_pos;
+ if (!landmark->getGlobalPos(landmark_global_pos))
+ return;
+
+ if (!landmark_global_pos.isExactlyZero())
+ {
+ worldmap_instance->trackLocation(landmark_global_pos);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
+ }
+ }
+ else
+ {
+ if (mActivePanel && mActivePanel->isSingleItemSelected())
+ {
+ mActivePanel->onShowOnMap();
+ }
+ else
+ {
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+ LLVector3d global_pos = gAgent.getPositionGlobal();
+
+ if (!global_pos.isExactlyZero() && worldmap_instance)
+ {
+ worldmap_instance->trackLocation(global_pos);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
+ }
+ }
}
void LLPanelPlaces::onEditButtonClicked()
{
- if (!mLandmarkInfo || isLandmarkEditModeOn)
- return;
+ if (!mLandmarkInfo || isLandmarkEditModeOn)
+ return;
- isLandmarkEditModeOn = true;
+ isLandmarkEditModeOn = true;
- mLandmarkInfo->toggleLandmarkEditMode(TRUE);
+ mLandmarkInfo->toggleLandmarkEditMode(TRUE);
- updateVerbs();
+ updateVerbs();
}
void LLPanelPlaces::onSaveButtonClicked()
{
- if (!mLandmarkInfo || mItem.isNull())
- return;
-
- std::string current_title_value = mLandmarkInfo->getLandmarkTitle();
- std::string item_title_value = mItem->getName();
- std::string current_notes_value = mLandmarkInfo->getLandmarkNotes();
- std::string item_notes_value = mItem->getDescription();
-
- LLStringUtil::trim(current_title_value);
- LLStringUtil::trim(current_notes_value);
-
- LLUUID folder_id = mLandmarkInfo->getLandmarkFolder();
- bool change_parent = folder_id != mItem->getParentUUID();
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(mItem);
-
- if (!current_title_value.empty() &&
- (item_title_value != current_title_value || item_notes_value != current_notes_value))
- {
- new_item->rename(current_title_value);
- new_item->setDescription(current_notes_value);
- LLPointer<LLInventoryCallback> cb;
- if (change_parent)
- {
- cb = new LLUpdateLandmarkParent(new_item, folder_id);
- }
- LLInventoryModel::LLCategoryUpdate up(mItem->getParentUUID(), 0);
- gInventory.accountForUpdate(up);
- update_inventory_item(new_item, cb);
- }
- else if (change_parent)
- {
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(),-1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(folder_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
-
- new_item->setParent(folder_id);
- new_item->updateParentOnServer(FALSE);
- }
-
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
-
- onCancelButtonClicked();
+ if (!mLandmarkInfo || mItem.isNull())
+ return;
+
+ std::string current_title_value = mLandmarkInfo->getLandmarkTitle();
+ std::string item_title_value = mItem->getName();
+ std::string current_notes_value = mLandmarkInfo->getLandmarkNotes();
+ std::string item_notes_value = mItem->getDescription();
+
+ LLStringUtil::trim(current_title_value);
+ LLStringUtil::trim(current_notes_value);
+
+ LLUUID folder_id = mLandmarkInfo->getLandmarkFolder();
+ bool change_parent = folder_id != mItem->getParentUUID();
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(mItem);
+
+ if (!current_title_value.empty() &&
+ (item_title_value != current_title_value || item_notes_value != current_notes_value))
+ {
+ new_item->rename(current_title_value);
+ new_item->setDescription(current_notes_value);
+ LLPointer<LLInventoryCallback> cb;
+ if (change_parent)
+ {
+ cb = new LLUpdateLandmarkParent(new_item, folder_id);
+ }
+ LLInventoryModel::LLCategoryUpdate up(mItem->getParentUUID(), 0);
+ gInventory.accountForUpdate(up);
+ update_inventory_item(new_item, cb);
+ }
+ else if (change_parent)
+ {
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(),-1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(folder_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ new_item->setParent(folder_id);
+ new_item->updateParentOnServer(FALSE);
+ }
+
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+
+ onCancelButtonClicked();
}
void LLPanelPlaces::onCancelButtonClicked()
{
- if (!mLandmarkInfo)
- return;
-
- if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE)
- {
- onBackButtonClicked();
- }
- else
- {
- mLandmarkInfo->toggleLandmarkEditMode(FALSE);
- isLandmarkEditModeOn = false;
-
- updateVerbs();
-
- // Reload the landmark properties.
- mLandmarkInfo->displayItemInfo(mItem);
- }
+ if (!mLandmarkInfo)
+ return;
+
+ if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE)
+ {
+ onBackButtonClicked();
+ }
+ else
+ {
+ mLandmarkInfo->toggleLandmarkEditMode(FALSE);
+ isLandmarkEditModeOn = false;
+
+ updateVerbs();
+
+ // Reload the landmark properties.
+ mLandmarkInfo->displayItemInfo(mItem);
+ }
}
void LLPanelPlaces::onOverflowButtonClicked()
{
- LLToggleableMenu* menu;
-
- bool is_agent_place_info_visible = mPlaceInfoType == AGENT_INFO_TYPE;
-
- if ((is_agent_place_info_visible ||
- mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
- mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE) && mPlaceMenu != NULL)
- {
- menu = mPlaceMenu;
-
- bool landmark_item_enabled = false;
- LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
- if (is_agent_place_info_visible
- && gAgent.getRegion()
- && mRegionId == gAgent.getRegion()->getRegionID()
- && parcel_mgr
- && parcel_mgr->getAgentParcel()->getLocalID() == mParcelLocalId)
- {
- // Floater still shows location identical to agent's position
- landmark_item_enabled = !LLLandmarkActions::landmarkAlreadyExists();
- }
-
- // Enable adding a landmark only for agent current parcel and if
- // there is no landmark already pointing to that parcel in agent's inventory.
- menu->getChild<LLMenuItemCallGL>("landmark")->setEnabled(landmark_item_enabled);
- // STORM-411
- // Creating landmarks for remote locations is impossible.
- // So hide menu item "Make a Landmark" in "Teleport History Profile" panel.
- menu->setItemVisible("landmark", mPlaceInfoType != TELEPORT_HISTORY_INFO_TYPE);
- menu->arrangeAndClear();
- }
- else if (mPlaceInfoType == LANDMARK_INFO_TYPE && mLandmarkMenu != NULL)
- {
- menu = mLandmarkMenu;
-
- BOOL is_landmark_removable = FALSE;
- if (mItem.notNull())
- {
- const LLUUID& item_id = mItem->getUUID();
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- is_landmark_removable = gInventory.isObjectDescendentOf(item_id, gInventory.getRootFolderID()) &&
- !gInventory.isObjectDescendentOf(item_id, trash_id);
- }
-
- menu->getChild<LLMenuItemCallGL>("delete")->setEnabled(is_landmark_removable);
- }
- else
- {
- return;
- }
-
- mOverflowBtn->setMenu(menu, LLMenuButton::MP_TOP_RIGHT);
+ LLToggleableMenu* menu;
+
+ bool is_agent_place_info_visible = mPlaceInfoType == AGENT_INFO_TYPE;
+
+ if ((is_agent_place_info_visible ||
+ mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
+ mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE) && mPlaceMenu != NULL)
+ {
+ menu = mPlaceMenu;
+
+ bool landmark_item_enabled = false;
+ LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+ if (is_agent_place_info_visible
+ && gAgent.getRegion()
+ && mRegionId == gAgent.getRegion()->getRegionID()
+ && parcel_mgr
+ && parcel_mgr->getAgentParcel()->getLocalID() == mParcelLocalId)
+ {
+ // Floater still shows location identical to agent's position
+ landmark_item_enabled = !LLLandmarkActions::landmarkAlreadyExists();
+ }
+
+ // Enable adding a landmark only for agent current parcel and if
+ // there is no landmark already pointing to that parcel in agent's inventory.
+ menu->getChild<LLMenuItemCallGL>("landmark")->setEnabled(landmark_item_enabled);
+ // STORM-411
+ // Creating landmarks for remote locations is impossible.
+ // So hide menu item "Make a Landmark" in "Teleport History Profile" panel.
+ menu->setItemVisible("landmark", mPlaceInfoType != TELEPORT_HISTORY_INFO_TYPE);
+ menu->arrangeAndClear();
+ }
+ else if (mPlaceInfoType == LANDMARK_INFO_TYPE && mLandmarkMenu != NULL)
+ {
+ menu = mLandmarkMenu;
+
+ BOOL is_landmark_removable = FALSE;
+ if (mItem.notNull())
+ {
+ const LLUUID& item_id = mItem->getUUID();
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ is_landmark_removable = gInventory.isObjectDescendentOf(item_id, gInventory.getRootFolderID()) &&
+ !gInventory.isObjectDescendentOf(item_id, trash_id);
+ }
+
+ menu->getChild<LLMenuItemCallGL>("delete")->setEnabled(is_landmark_removable);
+ }
+ else
+ {
+ return;
+ }
+
+ mOverflowBtn->setMenu(menu, LLMenuButton::MP_TOP_RIGHT);
}
bool LLPanelPlaces::onOverflowMenuItemEnable(const LLSD& param)
{
- std::string value = param.asString();
- if("can_create_pick" == value)
- {
- return !LLAgentPicksInfo::getInstance()->isPickLimitReached();
- }
- return true;
+ std::string value = param.asString();
+ if("can_create_pick" == value)
+ {
+ return !LLAgentPicksInfo::getInstance()->isPickLimitReached();
+ }
+ return true;
}
void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param)
{
- std::string item = param.asString();
- if (item == "landmark")
- {
- LLSD key;
- key["type"] = CREATE_LANDMARK_INFO_TYPE;
- key["x"] = mPosGlobal.mdV[VX];
- key["y"] = mPosGlobal.mdV[VY];
- key["z"] = mPosGlobal.mdV[VZ];
- onOpen(key);
- }
- else if (item == "copy")
- {
- LLLandmarkActions::getSLURLfromPosGlobal(mPosGlobal, boost::bind(&onSLURLBuilt, _1));
- }
- else if (item == "delete")
- {
- gInventory.removeItem(mItem->getUUID());
-
- onBackButtonClicked();
- }
- else if (item == "pick")
- {
- LLPanelPlaceInfo* panel = getCurrentInfoPanel();
- if (panel)
- {
- panel->createPick(mPosGlobal);
- }
- }
- else if (item == "add_to_favbar")
- {
- if ( mItem.notNull() )
- {
- const LLUUID& favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
- if ( favorites_id.notNull() )
- {
- copy_inventory_item(gAgent.getID(),
- mItem->getPermissions().getOwner(),
- mItem->getUUID(),
- favorites_id,
- std::string(),
- LLPointer<LLInventoryCallback>(NULL));
- LL_INFOS() << "Copied inventory item #" << mItem->getUUID() << " to favorites." << LL_ENDL;
- }
- }
- }
+ std::string item = param.asString();
+ if (item == "landmark")
+ {
+ LLSD key;
+ key["type"] = CREATE_LANDMARK_INFO_TYPE;
+ key["x"] = mPosGlobal.mdV[VX];
+ key["y"] = mPosGlobal.mdV[VY];
+ key["z"] = mPosGlobal.mdV[VZ];
+ onOpen(key);
+ }
+ else if (item == "copy")
+ {
+ LLLandmarkActions::getSLURLfromPosGlobal(mPosGlobal, boost::bind(&onSLURLBuilt, _1));
+ }
+ else if (item == "delete")
+ {
+ gInventory.removeItem(mItem->getUUID());
+
+ onBackButtonClicked();
+ }
+ else if (item == "pick")
+ {
+ LLPanelPlaceInfo* panel = getCurrentInfoPanel();
+ if (panel)
+ {
+ panel->createPick(mPosGlobal);
+ }
+ }
+ else if (item == "add_to_favbar")
+ {
+ if ( mItem.notNull() )
+ {
+ const LLUUID& favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ if ( favorites_id.notNull() )
+ {
+ copy_inventory_item(gAgent.getID(),
+ mItem->getPermissions().getOwner(),
+ mItem->getUUID(),
+ favorites_id,
+ std::string(),
+ LLPointer<LLInventoryCallback>(NULL));
+ LL_INFOS() << "Copied inventory item #" << mItem->getUUID() << " to favorites." << LL_ENDL;
+ }
+ }
+ }
}
void LLPanelPlaces::onBackButtonClicked()
{
- togglePlaceInfoPanel(FALSE);
+ togglePlaceInfoPanel(FALSE);
- // Resetting mPlaceInfoType when Place Info panel is closed.
- mPlaceInfoType = LLStringUtil::null;
+ // Resetting mPlaceInfoType when Place Info panel is closed.
+ mPlaceInfoType = LLStringUtil::null;
- isLandmarkEditModeOn = false;
+ isLandmarkEditModeOn = false;
- updateVerbs();
+ updateVerbs();
}
void LLPanelPlaces::onGearMenuClick()
@@ -1034,173 +1034,173 @@ bool LLPanelPlaces::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_t
void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible)
{
- if (!mPlaceProfile || !mLandmarkInfo)
- return;
-
- mTabContainer->setVisible(!visible);
- mButtonsContainer->setVisible(visible);
- mFilterContainer->setVisible(!visible);
-
- if (mPlaceInfoType == AGENT_INFO_TYPE ||
- mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
- mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
- {
- mPlaceProfile->setVisible(visible);
-
- if (visible)
- {
- mPlaceProfile->resetLocation();
-
- // Do not reset location info until mResetInfoTimer has expired
- // to avoid text blinking.
- mResetInfoTimer.setTimerExpirySec(PLACE_INFO_UPDATE_INTERVAL);
-
- mLandmarkInfo->setVisible(FALSE);
- }
- else if (mPlaceInfoType == AGENT_INFO_TYPE)
- {
- LLViewerParcelMgr::getInstance()->removeObserver(mParcelObserver);
-
- // Clear reference to parcel selection when closing place profile panel.
- // LLViewerParcelMgr removes the selection if it has 1 reference to it.
- mParcel.clear();
- }
- }
- else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE ||
- mPlaceInfoType == LANDMARK_INFO_TYPE ||
- mPlaceInfoType == LANDMARK_TAB_INFO_TYPE)
- {
- mLandmarkInfo->setVisible(visible);
- mPlaceProfile->setVisible(FALSE);
- if (visible)
- {
- mLandmarkInfo->resetLocation();
- }
- else
- {
- std::string tab_panel_name("Landmarks");
- if (mItem.notNull())
- {
- if (gInventory.isObjectDescendentOf(mItem->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE)))
- {
- tab_panel_name = "Favorites";
- }
- }
-
- LLLandmarksPanel* landmarks_panel = dynamic_cast<LLLandmarksPanel*>(mTabContainer->getPanelByName(tab_panel_name));
- if (landmarks_panel)
- {
- // If a landmark info is being closed we open the landmarks tab
- // and set this landmark selected.
- mTabContainer->selectTabPanel(landmarks_panel);
- if (mItem.notNull())
- {
- landmarks_panel->setItemSelected(mItem->getUUID(), TRUE);
- }
- else
- {
- landmarks_panel->resetSelection();
- }
- }
- }
- }
+ if (!mPlaceProfile || !mLandmarkInfo)
+ return;
+
+ mTabContainer->setVisible(!visible);
+ mButtonsContainer->setVisible(visible);
+ mFilterContainer->setVisible(!visible);
+
+ if (mPlaceInfoType == AGENT_INFO_TYPE ||
+ mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
+ mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
+ {
+ mPlaceProfile->setVisible(visible);
+
+ if (visible)
+ {
+ mPlaceProfile->resetLocation();
+
+ // Do not reset location info until mResetInfoTimer has expired
+ // to avoid text blinking.
+ mResetInfoTimer.setTimerExpirySec(PLACE_INFO_UPDATE_INTERVAL);
+
+ mLandmarkInfo->setVisible(FALSE);
+ }
+ else if (mPlaceInfoType == AGENT_INFO_TYPE)
+ {
+ LLViewerParcelMgr::getInstance()->removeObserver(mParcelObserver);
+
+ // Clear reference to parcel selection when closing place profile panel.
+ // LLViewerParcelMgr removes the selection if it has 1 reference to it.
+ mParcel.clear();
+ }
+ }
+ else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE ||
+ mPlaceInfoType == LANDMARK_INFO_TYPE ||
+ mPlaceInfoType == LANDMARK_TAB_INFO_TYPE)
+ {
+ mLandmarkInfo->setVisible(visible);
+ mPlaceProfile->setVisible(FALSE);
+ if (visible)
+ {
+ mLandmarkInfo->resetLocation();
+ }
+ else
+ {
+ std::string tab_panel_name("Landmarks");
+ if (mItem.notNull())
+ {
+ if (gInventory.isObjectDescendentOf(mItem->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE)))
+ {
+ tab_panel_name = "Favorites";
+ }
+ }
+
+ LLLandmarksPanel* landmarks_panel = dynamic_cast<LLLandmarksPanel*>(mTabContainer->getPanelByName(tab_panel_name));
+ if (landmarks_panel)
+ {
+ // If a landmark info is being closed we open the landmarks tab
+ // and set this landmark selected.
+ mTabContainer->selectTabPanel(landmarks_panel);
+ if (mItem.notNull())
+ {
+ landmarks_panel->setItemSelected(mItem->getUUID(), TRUE);
+ }
+ else
+ {
+ landmarks_panel->resetSelection();
+ }
+ }
+ }
+ }
}
// virtual
void LLPanelPlaces::onVisibilityChange(BOOL new_visibility)
{
- LLPanel::onVisibilityChange(new_visibility);
+ LLPanel::onVisibilityChange(new_visibility);
- if (!new_visibility && mPlaceInfoType == AGENT_INFO_TYPE)
- {
- LLViewerParcelMgr::getInstance()->removeObserver(mParcelObserver);
+ if (!new_visibility && mPlaceInfoType == AGENT_INFO_TYPE)
+ {
+ LLViewerParcelMgr::getInstance()->removeObserver(mParcelObserver);
- // Clear reference to parcel selection when closing places panel.
- mParcel.clear();
- }
+ // Clear reference to parcel selection when closing places panel.
+ mParcel.clear();
+ }
}
void LLPanelPlaces::changedParcelSelection()
{
- if (!mPlaceProfile)
- return;
-
- LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
- mParcel = parcel_mgr->getFloatingParcelSelection();
- LLParcel* parcel = mParcel->getParcel();
- LLViewerRegion* region = parcel_mgr->getSelectionRegion();
- if (!region || !parcel)
- return;
-
- LLVector3d prev_pos_global = mPosGlobal;
-
- // If agent is inside the selected parcel show agent's region<X, Y, Z>,
- // otherwise show region<X, Y, Z> of agent's selection point.
- bool is_current_parcel = is_agent_in_selected_parcel(parcel);
- if (is_current_parcel)
- {
- mPosGlobal = gAgent.getPositionGlobal();
- }
- else
- {
- LLVector3d pos_global = gViewerWindow->getLastPick().mPosGlobal;
- if (!pos_global.isExactlyZero())
- {
- mPosGlobal = pos_global;
- }
- }
-
- // Reset location info only if global position has changed
- // and update timer has expired to reduce unnecessary text and icons updates.
- if (prev_pos_global != mPosGlobal && mResetInfoTimer.hasExpired())
- {
- mPlaceProfile->resetLocation();
- mResetInfoTimer.setTimerExpirySec(PLACE_INFO_UPDATE_INTERVAL);
- }
-
- mPlaceProfile->displaySelectedParcelInfo(parcel, region, mPosGlobal, is_current_parcel);
-
- updateVerbs();
+ if (!mPlaceProfile)
+ return;
+
+ LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+ mParcel = parcel_mgr->getFloatingParcelSelection();
+ LLParcel* parcel = mParcel->getParcel();
+ LLViewerRegion* region = parcel_mgr->getSelectionRegion();
+ if (!region || !parcel)
+ return;
+
+ LLVector3d prev_pos_global = mPosGlobal;
+
+ // If agent is inside the selected parcel show agent's region<X, Y, Z>,
+ // otherwise show region<X, Y, Z> of agent's selection point.
+ bool is_current_parcel = is_agent_in_selected_parcel(parcel);
+ if (is_current_parcel)
+ {
+ mPosGlobal = gAgent.getPositionGlobal();
+ }
+ else
+ {
+ LLVector3d pos_global = gViewerWindow->getLastPick().mPosGlobal;
+ if (!pos_global.isExactlyZero())
+ {
+ mPosGlobal = pos_global;
+ }
+ }
+
+ // Reset location info only if global position has changed
+ // and update timer has expired to reduce unnecessary text and icons updates.
+ if (prev_pos_global != mPosGlobal && mResetInfoTimer.hasExpired())
+ {
+ mPlaceProfile->resetLocation();
+ mResetInfoTimer.setTimerExpirySec(PLACE_INFO_UPDATE_INTERVAL);
+ }
+
+ mPlaceProfile->displaySelectedParcelInfo(parcel, region, mPosGlobal, is_current_parcel);
+
+ updateVerbs();
}
void LLPanelPlaces::createTabs()
{
- if (!(gInventory.isInventoryUsable() && LLTeleportHistory::getInstance() && !mTabsCreated))
- return;
-
- LLFavoritesPanel* favorites_panel = new LLFavoritesPanel();
- if (favorites_panel)
- {
- mTabContainer->addTabPanel(
- LLTabContainer::TabPanelParams().
- panel(favorites_panel).
- label(getString("favorites_tab_title")).
- insert_at(LLTabContainer::END));
- }
-
- LLLandmarksPanel* landmarks_panel = new LLLandmarksPanel();
- if (landmarks_panel)
- {
- mTabContainer->addTabPanel(
- LLTabContainer::TabPanelParams().
- panel(landmarks_panel).
- label(getString("landmarks_tab_title")).
- insert_at(LLTabContainer::END));
- }
-
- LLTeleportHistoryPanel* teleport_history_panel = new LLTeleportHistoryPanel();
- if (teleport_history_panel)
- {
- mTabContainer->addTabPanel(
- LLTabContainer::TabPanelParams().
- panel(teleport_history_panel).
- label(getString("teleport_history_tab_title")).
- insert_at(LLTabContainer::END));
- }
-
- mTabContainer->selectFirstTab();
-
- mActivePanel = dynamic_cast<LLPanelPlacesTab*>(mTabContainer->getCurrentPanel());
+ if (!(gInventory.isInventoryUsable() && LLTeleportHistory::getInstance() && !mTabsCreated))
+ return;
+
+ LLFavoritesPanel* favorites_panel = new LLFavoritesPanel();
+ if (favorites_panel)
+ {
+ mTabContainer->addTabPanel(
+ LLTabContainer::TabPanelParams().
+ panel(favorites_panel).
+ label(getString("favorites_tab_title")).
+ insert_at(LLTabContainer::END));
+ }
+
+ LLLandmarksPanel* landmarks_panel = new LLLandmarksPanel();
+ if (landmarks_panel)
+ {
+ mTabContainer->addTabPanel(
+ LLTabContainer::TabPanelParams().
+ panel(landmarks_panel).
+ label(getString("landmarks_tab_title")).
+ insert_at(LLTabContainer::END));
+ }
+
+ LLTeleportHistoryPanel* teleport_history_panel = new LLTeleportHistoryPanel();
+ if (teleport_history_panel)
+ {
+ mTabContainer->addTabPanel(
+ LLTabContainer::TabPanelParams().
+ panel(teleport_history_panel).
+ label(getString("teleport_history_tab_title")).
+ insert_at(LLTabContainer::END));
+ }
+
+ mTabContainer->selectFirstTab();
+
+ mActivePanel = dynamic_cast<LLPanelPlacesTab*>(mTabContainer->getCurrentPanel());
if (mActivePanel)
{
@@ -1225,134 +1225,134 @@ void LLPanelPlaces::createTabs()
}
mActivePanel->setRemoveBtn(mRemoveSelectedBtn);
- mActivePanel->updateVerbs();
+ mActivePanel->updateVerbs();
}
- mTabsCreated = true;
+ mTabsCreated = true;
}
void LLPanelPlaces::changedGlobalPos(const LLVector3d &global_pos)
{
- mPosGlobal = global_pos;
- updateVerbs();
+ mPosGlobal = global_pos;
+ updateVerbs();
}
void LLPanelPlaces::showAddedLandmarkInfo(const uuid_set_t& items)
{
- for (uuid_set_t::const_iterator item_iter = items.begin();
- item_iter != items.end();
- ++item_iter)
- {
- const LLUUID& item_id = (*item_iter);
- if(!highlight_offered_object(item_id))
- {
- continue;
- }
-
- LLInventoryItem* item = gInventory.getItem(item_id);
-
- llassert(item);
- if (item && (LLAssetType::AT_LANDMARK == item->getType()) )
- {
- // Created landmark is passed to Places panel to allow its editing.
- // If the panel is closed we don't reopen it until created landmark is loaded.
- if("create_landmark" == getPlaceInfoType() && !getItem())
- {
- setItem(item);
- }
- }
- }
+ for (uuid_set_t::const_iterator item_iter = items.begin();
+ item_iter != items.end();
+ ++item_iter)
+ {
+ const LLUUID& item_id = (*item_iter);
+ if(!highlight_offered_object(item_id))
+ {
+ continue;
+ }
+
+ LLInventoryItem* item = gInventory.getItem(item_id);
+
+ llassert(item);
+ if (item && (LLAssetType::AT_LANDMARK == item->getType()) )
+ {
+ // Created landmark is passed to Places panel to allow its editing.
+ // If the panel is closed we don't reopen it until created landmark is loaded.
+ if("create_landmark" == getPlaceInfoType() && !getItem())
+ {
+ setItem(item);
+ }
+ }
+ }
}
void LLPanelPlaces::updateVerbs()
{
- bool is_place_info_visible;
-
- LLPanelPlaceInfo* panel = getCurrentInfoPanel();
- if (panel)
- {
- is_place_info_visible = panel->getVisible();
- }
- else
- {
- is_place_info_visible = false;
- }
-
- bool is_agent_place_info_visible = mPlaceInfoType == AGENT_INFO_TYPE;
- bool is_create_landmark_visible = mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE;
-
- bool have_3d_pos = ! mPosGlobal.isExactlyZero();
-
- mTeleportBtn->setVisible(!is_create_landmark_visible && !isLandmarkEditModeOn);
- mShowOnMapBtn->setVisible(!is_create_landmark_visible && !isLandmarkEditModeOn);
- mSaveBtn->setVisible(isLandmarkEditModeOn);
- mCancelBtn->setVisible(isLandmarkEditModeOn);
- mCloseBtn->setVisible(is_create_landmark_visible && !isLandmarkEditModeOn);
-
- bool show_options_btn = is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn;
- mOverflowBtn->setVisible(show_options_btn);
- getChild<LLLayoutPanel>("lp_options")->setVisible(show_options_btn);
- getChild<LLLayoutPanel>("lp2")->setVisible(!show_options_btn);
-
- if (is_place_info_visible)
- {
- mShowOnMapBtn->setEnabled(have_3d_pos);
-
- if (is_agent_place_info_visible)
- {
- // We don't need to teleport to the current location
- // so check if the location is not within the current parcel.
- mTeleportBtn->setEnabled(have_3d_pos &&
- !LLViewerParcelMgr::getInstance()->inAgentParcel(mPosGlobal));
- }
- else if (mPlaceInfoType == LANDMARK_INFO_TYPE || mPlaceInfoType == REMOTE_PLACE_INFO_TYPE)
- {
- mTeleportBtn->setEnabled(have_3d_pos);
- }
- }
- else
- {
- if (mActivePanel)
- mActivePanel->updateVerbs();
- }
+ bool is_place_info_visible;
+
+ LLPanelPlaceInfo* panel = getCurrentInfoPanel();
+ if (panel)
+ {
+ is_place_info_visible = panel->getVisible();
+ }
+ else
+ {
+ is_place_info_visible = false;
+ }
+
+ bool is_agent_place_info_visible = mPlaceInfoType == AGENT_INFO_TYPE;
+ bool is_create_landmark_visible = mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE;
+
+ bool have_3d_pos = ! mPosGlobal.isExactlyZero();
+
+ mTeleportBtn->setVisible(!is_create_landmark_visible && !isLandmarkEditModeOn);
+ mShowOnMapBtn->setVisible(!is_create_landmark_visible && !isLandmarkEditModeOn);
+ mSaveBtn->setVisible(isLandmarkEditModeOn);
+ mCancelBtn->setVisible(isLandmarkEditModeOn);
+ mCloseBtn->setVisible(is_create_landmark_visible && !isLandmarkEditModeOn);
+
+ bool show_options_btn = is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn;
+ mOverflowBtn->setVisible(show_options_btn);
+ getChild<LLLayoutPanel>("lp_options")->setVisible(show_options_btn);
+ getChild<LLLayoutPanel>("lp2")->setVisible(!show_options_btn);
+
+ if (is_place_info_visible)
+ {
+ mShowOnMapBtn->setEnabled(have_3d_pos);
+
+ if (is_agent_place_info_visible)
+ {
+ // We don't need to teleport to the current location
+ // so check if the location is not within the current parcel.
+ mTeleportBtn->setEnabled(have_3d_pos &&
+ !LLViewerParcelMgr::getInstance()->inAgentParcel(mPosGlobal));
+ }
+ else if (mPlaceInfoType == LANDMARK_INFO_TYPE || mPlaceInfoType == REMOTE_PLACE_INFO_TYPE)
+ {
+ mTeleportBtn->setEnabled(have_3d_pos);
+ }
+ }
+ else
+ {
+ if (mActivePanel)
+ mActivePanel->updateVerbs();
+ }
}
LLPanelPlaceInfo* LLPanelPlaces::getCurrentInfoPanel()
{
- if (mPlaceInfoType == AGENT_INFO_TYPE ||
- mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
- mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
- {
- return mPlaceProfile;
- }
- else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE ||
- mPlaceInfoType == LANDMARK_INFO_TYPE ||
- mPlaceInfoType == LANDMARK_TAB_INFO_TYPE)
- {
- return mLandmarkInfo;
- }
-
- return NULL;
+ if (mPlaceInfoType == AGENT_INFO_TYPE ||
+ mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
+ mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
+ {
+ return mPlaceProfile;
+ }
+ else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE ||
+ mPlaceInfoType == LANDMARK_INFO_TYPE ||
+ mPlaceInfoType == LANDMARK_TAB_INFO_TYPE)
+ {
+ return mLandmarkInfo;
+ }
+
+ return NULL;
}
static bool is_agent_in_selected_parcel(LLParcel* parcel)
{
- LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+ LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
- LLViewerRegion* region = parcel_mgr->getSelectionRegion();
- if (!region || !parcel)
- return false;
+ LLViewerRegion* region = parcel_mgr->getSelectionRegion();
+ if (!region || !parcel)
+ return false;
- return region == gAgent.getRegion() &&
- parcel->getLocalID() == parcel_mgr->getAgentParcel()->getLocalID();
+ return region == gAgent.getRegion() &&
+ parcel->getLocalID() == parcel_mgr->getAgentParcel()->getLocalID();
}
static void onSLURLBuilt(std::string& slurl)
{
- LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(slurl));
-
- LLSD args;
- args["SLURL"] = slurl;
+ LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(slurl));
+
+ LLSD args;
+ args["SLURL"] = slurl;
- LLNotificationsUtil::add("CopySLURL", args);
+ LLNotificationsUtil::add("CopySLURL", args);
}
diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h
index e554099343..1e76ad126f 100644
--- a/indra/newview/llpanelplaces.h
+++ b/indra/newview/llpanelplaces.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelplaces.h
* @brief Side Bar "Places" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,121 +49,121 @@ class LLToggleableMenu;
class LLMenuButton;
class LLLayoutStack;
-typedef std::pair<LLUUID, std::string> folder_pair_t;
+typedef std::pair<LLUUID, std::string> folder_pair_t;
class LLPanelPlaces : public LLPanel
{
public:
- LLPanelPlaces();
- virtual ~LLPanelPlaces();
+ LLPanelPlaces();
+ virtual ~LLPanelPlaces();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- // Called on parcel selection change to update place information.
- void changedParcelSelection();
- // Called once on agent inventory first change to find out when inventory gets usable
- // and to create "My Landmarks" and "Teleport History" tabs.
- void createTabs();
- // Called when we receive the global 3D position of a parcel.
- void changedGlobalPos(const LLVector3d &global_pos);
+ // Called on parcel selection change to update place information.
+ void changedParcelSelection();
+ // Called once on agent inventory first change to find out when inventory gets usable
+ // and to create "My Landmarks" and "Teleport History" tabs.
+ void createTabs();
+ // Called when we receive the global 3D position of a parcel.
+ void changedGlobalPos(const LLVector3d &global_pos);
- // Opens landmark info panel when agent creates or receives landmark.
- void showAddedLandmarkInfo(const uuid_set_t& items);
+ // Opens landmark info panel when agent creates or receives landmark.
+ void showAddedLandmarkInfo(const uuid_set_t& items);
- void setItem(LLInventoryItem* item);
+ void setItem(LLInventoryItem* item);
- LLInventoryItem* getItem() { return mItem; }
+ LLInventoryItem* getItem() { return mItem; }
- std::string getPlaceInfoType() { return mPlaceInfoType; }
+ std::string getPlaceInfoType() { return mPlaceInfoType; }
- bool tabsCreated() { return mTabsCreated;}
+ bool tabsCreated() { return mTabsCreated;}
- /*virtual*/ S32 notifyParent(const LLSD& info);
+ /*virtual*/ S32 notifyParent(const LLSD& info);
private:
- void onLandmarkLoaded(LLLandmark* landmark);
- void onFilterEdit(const std::string& search_string, bool force_filter);
- void onTabSelected();
-
- void onTeleportButtonClicked();
- void onShowOnMapButtonClicked();
- void onEditButtonClicked();
- void onSaveButtonClicked();
- void onCancelButtonClicked();
- void onOverflowButtonClicked();
- void onOverflowMenuItemClicked(const LLSD& param);
- bool onOverflowMenuItemEnable(const LLSD& param);
- void onBackButtonClicked();
+ void onLandmarkLoaded(LLLandmark* landmark);
+ void onFilterEdit(const std::string& search_string, bool force_filter);
+ void onTabSelected();
+
+ void onTeleportButtonClicked();
+ void onShowOnMapButtonClicked();
+ void onEditButtonClicked();
+ void onSaveButtonClicked();
+ void onCancelButtonClicked();
+ void onOverflowButtonClicked();
+ void onOverflowMenuItemClicked(const LLSD& param);
+ bool onOverflowMenuItemEnable(const LLSD& param);
+ void onBackButtonClicked();
void onGearMenuClick();
void onSortingMenuClick();
void onAddMenuClick();
void onRemoveButtonClicked();
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept);
- void togglePlaceInfoPanel(BOOL visible);
+ void togglePlaceInfoPanel(BOOL visible);
- /*virtual*/ void onVisibilityChange(BOOL new_visibility);
+ /*virtual*/ void onVisibilityChange(BOOL new_visibility);
- void updateVerbs();
+ void updateVerbs();
- LLPanelPlaceInfo* getCurrentInfoPanel();
+ LLPanelPlaceInfo* getCurrentInfoPanel();
- LLFilterEditor* mFilterEditor;
- LLPanelPlacesTab* mActivePanel;
- LLTabContainer* mTabContainer;
- LLPanel* mButtonsContainer;
- LLLayoutStack* mFilterContainer;
- LLPanelPlaceProfile* mPlaceProfile;
- LLPanelLandmarkInfo* mLandmarkInfo;
+ LLFilterEditor* mFilterEditor;
+ LLPanelPlacesTab* mActivePanel;
+ LLTabContainer* mTabContainer;
+ LLPanel* mButtonsContainer;
+ LLLayoutStack* mFilterContainer;
+ LLPanelPlaceProfile* mPlaceProfile;
+ LLPanelLandmarkInfo* mLandmarkInfo;
- LLToggleableMenu* mPlaceMenu;
- LLToggleableMenu* mLandmarkMenu;
+ LLToggleableMenu* mPlaceMenu;
+ LLToggleableMenu* mLandmarkMenu;
- LLButton* mPlaceProfileBackBtn;
- LLButton* mTeleportBtn;
- LLButton* mShowOnMapBtn;
- LLButton* mSaveBtn;
- LLButton* mCancelBtn;
- LLButton* mCloseBtn;
- LLMenuButton* mOverflowBtn;
+ LLButton* mPlaceProfileBackBtn;
+ LLButton* mTeleportBtn;
+ LLButton* mShowOnMapBtn;
+ LLButton* mSaveBtn;
+ LLButton* mCancelBtn;
+ LLButton* mCloseBtn;
+ LLMenuButton* mOverflowBtn;
// Top menu
- LLMenuButton* mGearMenuButton;
- LLMenuButton* mSortingMenuButton;
- LLMenuButton* mAddMenuButton;
- LLButton* mRemoveSelectedBtn;
+ LLMenuButton* mGearMenuButton;
+ LLMenuButton* mSortingMenuButton;
+ LLMenuButton* mAddMenuButton;
+ LLButton* mRemoveSelectedBtn;
- LLPlacesInventoryObserver* mInventoryObserver;
- LLPlacesParcelObserver* mParcelObserver;
- LLRemoteParcelInfoObserver* mRemoteParcelObserver;
+ LLPlacesInventoryObserver* mInventoryObserver;
+ LLPlacesParcelObserver* mParcelObserver;
+ LLRemoteParcelInfoObserver* mRemoteParcelObserver;
- // Pointer to a landmark item or to a linked landmark
- LLPointer<LLInventoryItem> mItem;
+ // Pointer to a landmark item or to a linked landmark
+ LLPointer<LLInventoryItem> mItem;
- // Absolute position of the location for teleport, may not
- // be available (hence zero)
- LLVector3d mPosGlobal;
+ // Absolute position of the location for teleport, may not
+ // be available (hence zero)
+ LLVector3d mPosGlobal;
- // Sets a period of time during which the requested place information
- // is expected to be updated and doesn't need to be reset.
- LLTimer mResetInfoTimer;
+ // Sets a period of time during which the requested place information
+ // is expected to be updated and doesn't need to be reset.
+ LLTimer mResetInfoTimer;
- // Information type currently shown in Place Information panel
- std::string mPlaceInfoType;
+ // Information type currently shown in Place Information panel
+ std::string mPlaceInfoType;
- // Region and parcel ids, to detect location changes in case of AGENT_INFO_TYPE
- LLUUID mRegionId;
- S32 mParcelLocalId;
+ // Region and parcel ids, to detect location changes in case of AGENT_INFO_TYPE
+ LLUUID mRegionId;
+ S32 mParcelLocalId;
- bool isLandmarkEditModeOn;
+ bool isLandmarkEditModeOn;
- // Holds info whether "My Landmarks" and "Teleport History" tabs have been created.
- bool mTabsCreated;
+ // Holds info whether "My Landmarks" and "Teleport History" tabs have been created.
+ bool mTabsCreated;
- LLSafeHandle<LLParcelSelection> mParcel;
+ LLSafeHandle<LLParcelSelection> mParcel;
- boost::signals2::connection mAgentParcelChangedConnection;
+ boost::signals2::connection mAgentParcelChangedConnection;
};
#endif //LL_LLPANELPLACES_H
diff --git a/indra/newview/llpanelplacestab.cpp b/indra/newview/llpanelplacestab.cpp
index 748a917147..3916e34e31 100644
--- a/indra/newview/llpanelplacestab.cpp
+++ b/indra/newview/llpanelplacestab.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelplacestab.cpp
* @brief Tabs interface for Side Bar "Places" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,35 +42,35 @@ LLButton* LLPanelPlacesTab::sRemoveBtn = NULL;
bool LLPanelPlacesTab::isTabVisible()
{
- LLUICtrl* parent = getParentUICtrl();
- if (!parent) return false;
- if (!parent->getVisible()) return false;
- return true;
+ LLUICtrl* parent = getParentUICtrl();
+ if (!parent) return false;
+ if (!parent->getVisible()) return false;
+ return true;
}
void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos,
- U64 region_handle,
- const std::string& url,
- const LLUUID& snapshot_id,
- bool teleport)
+ U64 region_handle,
+ const std::string& url,
+ const LLUUID& snapshot_id,
+ bool teleport)
{
- std::string sim_name;
- bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( landmark_global_pos, sim_name );
+ std::string sim_name;
+ bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( landmark_global_pos, sim_name );
+
+ std::string sl_url;
+ if ( gotSimName )
+ {
+ sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString();
+ }
+ else
+ {
+ sl_url = "";
+ }
- std::string sl_url;
- if ( gotSimName )
- {
- sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString();
- }
- else
- {
- sl_url = "";
- }
+ LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(sl_url));
- LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(sl_url));
-
- LLSD args;
- args["SLURL"] = sl_url;
+ LLSD args;
+ args["SLURL"] = sl_url;
- LLNotificationsUtil::add("CopySLURL", args);
+ LLNotificationsUtil::add("CopySLURL", args);
}
diff --git a/indra/newview/llpanelplacestab.h b/indra/newview/llpanelplacestab.h
index aab1c130c1..b58cd2c3e2 100644
--- a/indra/newview/llpanelplacestab.h
+++ b/indra/newview/llpanelplacestab.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelplacestab.h
* @brief Tabs interface for Side Bar "Places" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,16 +35,16 @@ class LLToggleableMenu;
class LLPanelPlacesTab : public LLPanel
{
public:
- LLPanelPlacesTab() : LLPanel() {}
- virtual ~LLPanelPlacesTab() {}
+ LLPanelPlacesTab() : LLPanel() {}
+ virtual ~LLPanelPlacesTab() {}
- virtual void onSearchEdit(const std::string& string) = 0;
- virtual void updateVerbs() = 0; // Updates buttons at the bottom of Places panel
- virtual void onShowOnMap() = 0;
- virtual void onShowProfile() = 0;
- virtual void onTeleport() = 0;
- virtual void onRemoveSelected() = 0;
- virtual bool isSingleItemSelected() = 0;
+ virtual void onSearchEdit(const std::string& string) = 0;
+ virtual void updateVerbs() = 0; // Updates buttons at the bottom of Places panel
+ virtual void onShowOnMap() = 0;
+ virtual void onShowProfile() = 0;
+ virtual void onTeleport() = 0;
+ virtual void onRemoveSelected() = 0;
+ virtual bool isSingleItemSelected() = 0;
// returns menu for current selection
virtual LLToggleableMenu* getSelectionMenu() = 0;
@@ -56,23 +56,23 @@ public:
*/
virtual bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept) = 0;
- bool isTabVisible(); // Check if parent TabContainer is visible.
+ bool isTabVisible(); // Check if parent TabContainer is visible.
- void onRegionResponse(const LLVector3d& landmark_global_pos,
- U64 region_handle,
- const std::string& url,
- const LLUUID& snapshot_id,
- bool teleport);
+ void onRegionResponse(const LLVector3d& landmark_global_pos,
+ U64 region_handle,
+ const std::string& url,
+ const LLUUID& snapshot_id,
+ bool teleport);
- const std::string& getFilterSubString() { return sFilterSubString; }
- void setFilterSubString(const std::string& string) { sFilterSubString = string; }
+ const std::string& getFilterSubString() { return sFilterSubString; }
+ void setFilterSubString(const std::string& string) { sFilterSubString = string; }
- void setRemoveBtn(LLButton* trash_btn) { sRemoveBtn = trash_btn; }
+ void setRemoveBtn(LLButton* trash_btn) { sRemoveBtn = trash_btn; }
protected:
- // Search string for filtering landmarks and teleport history locations
- static std::string sFilterSubString;
- static LLButton* sRemoveBtn;
+ // Search string for filtering landmarks and teleport history locations
+ static std::string sFilterSubString;
+ static LLButton* sRemoveBtn;
};
#endif //LL_LLPANELPLACESTAB_H
diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp
index 4c9c30160c..124a38bebb 100644
--- a/indra/newview/llpanelpresetscamerapulldown.cpp
+++ b/indra/newview/llpanelpresetscamerapulldown.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelpresetscamerapulldown.cpp
* @brief A panel showing a quick way to pick camera presets
*
* $LicenseInfo:firstyear=2017&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2017, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,95 +48,95 @@
// Default constructor
LLPanelPresetsCameraPulldown::LLPanelPresetsCameraPulldown()
{
- mCommitCallbackRegistrar.add("Presets.toggleCameraFloater", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2));
- mCommitCallbackRegistrar.add("PresetsCamera.RowClick", boost::bind(&LLPanelPresetsCameraPulldown::onRowClick, this, _2));
+ mCommitCallbackRegistrar.add("Presets.toggleCameraFloater", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2));
+ mCommitCallbackRegistrar.add("PresetsCamera.RowClick", boost::bind(&LLPanelPresetsCameraPulldown::onRowClick, this, _2));
- buildFromFile( "panel_presets_camera_pulldown.xml");
+ buildFromFile( "panel_presets_camera_pulldown.xml");
}
BOOL LLPanelPresetsCameraPulldown::postBuild()
{
- LLPresetsManager* presetsMgr = LLPresetsManager::getInstance();
- if (presetsMgr)
- {
- // Make sure there is a default preference file
- presetsMgr->createMissingDefault(PRESETS_CAMERA);
+ LLPresetsManager* presetsMgr = LLPresetsManager::getInstance();
+ if (presetsMgr)
+ {
+ // Make sure there is a default preference file
+ presetsMgr->createMissingDefault(PRESETS_CAMERA);
- presetsMgr->startWatching(PRESETS_CAMERA);
+ presetsMgr->startWatching(PRESETS_CAMERA);
- presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this));
- }
+ presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this));
+ }
- populatePanel();
+ populatePanel();
- return LLPanelPulldown::postBuild();
+ return LLPanelPulldown::postBuild();
}
void LLPanelPresetsCameraPulldown::populatePanel()
{
- LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_CAMERA, mPresetNames, DEFAULT_BOTTOM);
+ LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_CAMERA, mPresetNames, DEFAULT_BOTTOM);
- LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_camera_list");
+ LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_camera_list");
- if (scroll && mPresetNames.begin() != mPresetNames.end())
- {
- scroll->clearRows();
+ if (scroll && mPresetNames.begin() != mPresetNames.end())
+ {
+ scroll->clearRows();
- std::string active_preset = gSavedSettings.getString("PresetCameraActive");
- if (active_preset == PRESETS_DEFAULT)
- {
- active_preset = LLTrans::getString(PRESETS_DEFAULT);
- }
+ std::string active_preset = gSavedSettings.getString("PresetCameraActive");
+ if (active_preset == PRESETS_DEFAULT)
+ {
+ active_preset = LLTrans::getString(PRESETS_DEFAULT);
+ }
- for (std::list<std::string>::const_iterator it = mPresetNames.begin(); it != mPresetNames.end(); ++it)
- {
- const std::string& name = *it;
+ for (std::list<std::string>::const_iterator it = mPresetNames.begin(); it != mPresetNames.end(); ++it)
+ {
+ const std::string& name = *it;
LL_DEBUGS() << "adding '" << name << "'" << LL_ENDL;
-
- LLSD row;
- row["columns"][0]["column"] = "preset_name";
- row["columns"][0]["value"] = name;
-
- bool is_selected_preset = false;
- if (name == active_preset)
- {
- row["columns"][1]["column"] = "icon";
- row["columns"][1]["type"] = "icon";
- row["columns"][1]["value"] = "Check_Mark";
-
- is_selected_preset = true;
- }
-
- LLScrollListItem* new_item = scroll->addElement(row);
- new_item->setSelected(is_selected_preset);
- }
- }
+
+ LLSD row;
+ row["columns"][0]["column"] = "preset_name";
+ row["columns"][0]["value"] = name;
+
+ bool is_selected_preset = false;
+ if (name == active_preset)
+ {
+ row["columns"][1]["column"] = "icon";
+ row["columns"][1]["type"] = "icon";
+ row["columns"][1]["value"] = "Check_Mark";
+
+ is_selected_preset = true;
+ }
+
+ LLScrollListItem* new_item = scroll->addElement(row);
+ new_item->setSelected(is_selected_preset);
+ }
+ }
}
void LLPanelPresetsCameraPulldown::onRowClick(const LLSD& user_data)
{
- LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_camera_list");
+ LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_camera_list");
- if (scroll)
- {
- LLScrollListItem* item = scroll->getFirstSelected();
- if (item)
- {
- std::string name = item->getColumn(1)->getValue().asString();
+ if (scroll)
+ {
+ LLScrollListItem* item = scroll->getFirstSelected();
+ if (item)
+ {
+ std::string name = item->getColumn(1)->getValue().asString();
LL_DEBUGS() << "selected '" << name << "'" << LL_ENDL;
- LLFloaterCamera::switchToPreset(name);
+ LLFloaterCamera::switchToPreset(name);
// Scroll grabbed focus, drop it to prevent selection of parent menu
setFocus(FALSE);
setVisible(FALSE);
- }
+ }
else
{
LL_DEBUGS() << "none selected" << LL_ENDL;
}
- }
+ }
else
{
LL_DEBUGS() << "no scroll" << LL_ENDL;
@@ -145,8 +145,8 @@ void LLPanelPresetsCameraPulldown::onRowClick(const LLSD& user_data)
void LLPanelPresetsCameraPulldown::onViewButtonClick(const LLSD& user_data)
{
- // close the minicontrol, we're bringing up the big one
- setVisible(FALSE);
+ // close the minicontrol, we're bringing up the big one
+ setVisible(FALSE);
- LLFloaterReg::toggleInstanceOrBringToFront("camera");
+ LLFloaterReg::toggleInstanceOrBringToFront("camera");
}
diff --git a/indra/newview/llpanelpresetscamerapulldown.h b/indra/newview/llpanelpresetscamerapulldown.h
index c49bab042e..231a269436 100644
--- a/indra/newview/llpanelpresetscamerapulldown.h
+++ b/indra/newview/llpanelpresetscamerapulldown.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelpresetscamerapulldown.h
* @brief A panel showing a quick way to pick camera presets
*
* $LicenseInfo:firstyear=2017&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2017, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,15 +34,15 @@
class LLPanelPresetsCameraPulldown : public LLPanelPulldown
{
public:
- LLPanelPresetsCameraPulldown();
- /*virtual*/ BOOL postBuild();
- void populatePanel();
-
+ LLPanelPresetsCameraPulldown();
+ /*virtual*/ BOOL postBuild();
+ void populatePanel();
+
private:
- void onViewButtonClick(const LLSD& user_data);
- void onRowClick(const LLSD& user_data);
+ void onViewButtonClick(const LLSD& user_data);
+ void onRowClick(const LLSD& user_data);
- std::list<std::string> mPresetNames;
+ std::list<std::string> mPresetNames;
LOG_CLASS(LLPanelPresetsCameraPulldown);
};
diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp
index f6e501f147..61331aad95 100644
--- a/indra/newview/llpanelpresetspulldown.cpp
+++ b/indra/newview/llpanelpresetspulldown.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelpresetspulldown.cpp
* @brief A panel showing a quick way to pick presets
*
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,92 +48,92 @@
// Default constructor
LLPanelPresetsPulldown::LLPanelPresetsPulldown()
{
- mHoverTimer.stop();
+ mHoverTimer.stop();
- mCommitCallbackRegistrar.add("Presets.GoGraphicsPrefs", boost::bind(&LLPanelPresetsPulldown::onGraphicsButtonClick, this, _2));
+ mCommitCallbackRegistrar.add("Presets.GoGraphicsPrefs", boost::bind(&LLPanelPresetsPulldown::onGraphicsButtonClick, this, _2));
mCommitCallbackRegistrar.add("Presets.GoAutofpsPrefs", boost::bind(&LLPanelPresetsPulldown::onAutofpsButtonClick, this, _2));
- mCommitCallbackRegistrar.add("Presets.RowClick", boost::bind(&LLPanelPresetsPulldown::onRowClick, this, _2));
+ mCommitCallbackRegistrar.add("Presets.RowClick", boost::bind(&LLPanelPresetsPulldown::onRowClick, this, _2));
- buildFromFile( "panel_presets_pulldown.xml");
+ buildFromFile( "panel_presets_pulldown.xml");
}
BOOL LLPanelPresetsPulldown::postBuild()
{
- LLPresetsManager* presetsMgr = LLPresetsManager::getInstance();
+ LLPresetsManager* presetsMgr = LLPresetsManager::getInstance();
presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPresetsPulldown::populatePanel, this));
- // Make sure there is a default preference file
+ // Make sure there is a default preference file
presetsMgr->createMissingDefault(PRESETS_GRAPHIC);
- populatePanel();
+ populatePanel();
- return LLPanelPulldown::postBuild();
+ return LLPanelPulldown::postBuild();
}
void LLPanelPresetsPulldown::populatePanel()
{
- LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_GRAPHIC, mPresetNames, DEFAULT_TOP);
+ LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_GRAPHIC, mPresetNames, DEFAULT_TOP);
- LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_list");
+ LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_list");
- if (scroll && mPresetNames.begin() != mPresetNames.end())
- {
- scroll->clearRows();
+ if (scroll && mPresetNames.begin() != mPresetNames.end())
+ {
+ scroll->clearRows();
- std::string active_preset = gSavedSettings.getString("PresetGraphicActive");
- if (active_preset == PRESETS_DEFAULT)
- {
- active_preset = LLTrans::getString(PRESETS_DEFAULT);
- }
+ std::string active_preset = gSavedSettings.getString("PresetGraphicActive");
+ if (active_preset == PRESETS_DEFAULT)
+ {
+ active_preset = LLTrans::getString(PRESETS_DEFAULT);
+ }
- for (std::list<std::string>::const_iterator it = mPresetNames.begin(); it != mPresetNames.end(); ++it)
- {
- const std::string& name = *it;
+ for (std::list<std::string>::const_iterator it = mPresetNames.begin(); it != mPresetNames.end(); ++it)
+ {
+ const std::string& name = *it;
LL_DEBUGS() << "adding '" << name << "'" << LL_ENDL;
-
- LLSD row;
- row["columns"][0]["column"] = "preset_name";
- row["columns"][0]["value"] = name;
-
- bool is_selected_preset = false;
- if (name == active_preset)
- {
- row["columns"][1]["column"] = "icon";
- row["columns"][1]["type"] = "icon";
- row["columns"][1]["value"] = "Check_Mark";
-
- is_selected_preset = true;
- }
-
- LLScrollListItem* new_item = scroll->addElement(row);
- new_item->setSelected(is_selected_preset);
- }
- }
+
+ LLSD row;
+ row["columns"][0]["column"] = "preset_name";
+ row["columns"][0]["value"] = name;
+
+ bool is_selected_preset = false;
+ if (name == active_preset)
+ {
+ row["columns"][1]["column"] = "icon";
+ row["columns"][1]["type"] = "icon";
+ row["columns"][1]["value"] = "Check_Mark";
+
+ is_selected_preset = true;
+ }
+
+ LLScrollListItem* new_item = scroll->addElement(row);
+ new_item->setSelected(is_selected_preset);
+ }
+ }
}
void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data)
{
- LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_list");
+ LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_list");
- if (scroll)
- {
- LLScrollListItem* item = scroll->getFirstSelected();
- if (item)
- {
- std::string name = item->getColumn(1)->getValue().asString();
+ if (scroll)
+ {
+ LLScrollListItem* item = scroll->getFirstSelected();
+ if (item)
+ {
+ std::string name = item->getColumn(1)->getValue().asString();
LL_DEBUGS() << "selected '" << name << "'" << LL_ENDL;
- LLPresetsManager::getInstance()->loadPreset(PRESETS_GRAPHIC, name);
+ LLPresetsManager::getInstance()->loadPreset(PRESETS_GRAPHIC, name);
// Scroll grabbed focus, drop it to prevent selection of parent menu
setFocus(FALSE);
- setVisible(FALSE);
- }
+ setVisible(FALSE);
+ }
else
{
LL_DEBUGS() << "none selected" << LL_ENDL;
}
- }
+ }
else
{
LL_DEBUGS() << "no scroll" << LL_ENDL;
@@ -142,22 +142,22 @@ void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data)
void LLPanelPresetsPulldown::onGraphicsButtonClick(const LLSD& user_data)
{
- // close the minicontrol, we're bringing up the big one
- setVisible(FALSE);
-
- // bring up the prefs floater
- LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences");
- if (prefsfloater)
- {
- // grab the 'graphics' panel from the preferences floater and
- // bring it the front!
- LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
- LLPanel* graphicspanel = prefsfloater->getChild<LLPanel>("display");
- if (tabcontainer && graphicspanel)
- {
- tabcontainer->selectTabPanel(graphicspanel);
- }
- }
+ // close the minicontrol, we're bringing up the big one
+ setVisible(FALSE);
+
+ // bring up the prefs floater
+ LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences");
+ if (prefsfloater)
+ {
+ // grab the 'graphics' panel from the preferences floater and
+ // bring it the front!
+ LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
+ LLPanel* graphicspanel = prefsfloater->getChild<LLPanel>("display");
+ if (tabcontainer && graphicspanel)
+ {
+ tabcontainer->selectTabPanel(graphicspanel);
+ }
+ }
}
void LLPanelPresetsPulldown::onAutofpsButtonClick(const LLSD& user_data)
diff --git a/indra/newview/llpanelpresetspulldown.h b/indra/newview/llpanelpresetspulldown.h
index 79bd6886b1..9ecd5d66f0 100644
--- a/indra/newview/llpanelpresetspulldown.h
+++ b/indra/newview/llpanelpresetspulldown.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelpresetspulldown.h
* @brief A panel showing a quick way to pick presets
*
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,16 +35,16 @@
class LLPanelPresetsPulldown : public LLPanelPulldown
{
public:
- LLPanelPresetsPulldown();
- /*virtual*/ BOOL postBuild();
- void populatePanel();
-
+ LLPanelPresetsPulldown();
+ /*virtual*/ BOOL postBuild();
+ void populatePanel();
+
private:
- void onGraphicsButtonClick(const LLSD& user_data);
+ void onGraphicsButtonClick(const LLSD& user_data);
void onAutofpsButtonClick(const LLSD& user_data);
- void onRowClick(const LLSD& user_data);
+ void onRowClick(const LLSD& user_data);
- std::list<std::string> mPresetNames;
+ std::list<std::string> mPresetNames;
LOG_CLASS(LLPanelPresetsPulldown);
};
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index c42cd6c6ba..16cf46529d 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelprimmediacontrols.cpp
* @brief media controls popup panel
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -80,61 +80,61 @@ const S32 ADDR_LEFT_PAD = 3;
// LLPanelPrimMediaControls
//
-LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
- mAlpha(1.f),
- mCurrentURL(""),
- mPreviousURL(""),
- mPauseFadeout(false),
- mUpdateSlider(true),
- mClearFaceOnFade(false),
- mCurrentRate(0.0),
- mMovieDuration(0.0),
- mTargetObjectID(LLUUID::null),
- mTargetObjectFace(0),
- mTargetImplID(LLUUID::null),
- mTargetObjectNormal(LLVector3::zero),
- mZoomObjectID(LLUUID::null),
- mZoomObjectFace(0),
- mVolumeSliderVisible(0),
- mZoomedCameraPos(),
- mWindowShade(NULL),
- mHideImmediately(false),
+LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
+ mAlpha(1.f),
+ mCurrentURL(""),
+ mPreviousURL(""),
+ mPauseFadeout(false),
+ mUpdateSlider(true),
+ mClearFaceOnFade(false),
+ mCurrentRate(0.0),
+ mMovieDuration(0.0),
+ mTargetObjectID(LLUUID::null),
+ mTargetObjectFace(0),
+ mTargetImplID(LLUUID::null),
+ mTargetObjectNormal(LLVector3::zero),
+ mZoomObjectID(LLUUID::null),
+ mZoomObjectFace(0),
+ mVolumeSliderVisible(0),
+ mZoomedCameraPos(),
+ mWindowShade(NULL),
+ mHideImmediately(false),
mSecureURL(false),
- mMediaPlaySliderCtrlMouseDownValue(0.0)
+ mMediaPlaySliderCtrlMouseDownValue(0.0)
{
- mCommitCallbackRegistrar.add("MediaCtrl.Close", boost::bind(&LLPanelPrimMediaControls::onClickClose, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Back", boost::bind(&LLPanelPrimMediaControls::onClickBack, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Forward", boost::bind(&LLPanelPrimMediaControls::onClickForward, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Home", boost::bind(&LLPanelPrimMediaControls::onClickHome, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Stop", boost::bind(&LLPanelPrimMediaControls::onClickStop, this));
- mCommitCallbackRegistrar.add("MediaCtrl.MediaStop", boost::bind(&LLPanelPrimMediaControls::onClickMediaStop, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Reload", boost::bind(&LLPanelPrimMediaControls::onClickReload, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Play", boost::bind(&LLPanelPrimMediaControls::onClickPlay, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Pause", boost::bind(&LLPanelPrimMediaControls::onClickPause, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Open", boost::bind(&LLPanelPrimMediaControls::onClickOpen, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Zoom", boost::bind(&LLPanelPrimMediaControls::onClickZoom, this));
- mCommitCallbackRegistrar.add("MediaCtrl.CommitURL", boost::bind(&LLPanelPrimMediaControls::onCommitURL, this));
- mCommitCallbackRegistrar.add("MediaCtrl.MouseDown", boost::bind(&LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseDown, this));
- mCommitCallbackRegistrar.add("MediaCtrl.MouseUp", boost::bind(&LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseUp, this));
- mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeUp", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeUp, this));
- mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeDown", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeDown, this));
- mCommitCallbackRegistrar.add("MediaCtrl.Volume", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeSlider, this));
- mCommitCallbackRegistrar.add("MediaCtrl.ToggleMute", boost::bind(&LLPanelPrimMediaControls::onToggleMute, this));
- mCommitCallbackRegistrar.add("MediaCtrl.ShowVolumeSlider", boost::bind(&LLPanelPrimMediaControls::showVolumeSlider, this));
- mCommitCallbackRegistrar.add("MediaCtrl.HideVolumeSlider", boost::bind(&LLPanelPrimMediaControls::hideVolumeSlider, this));
- mCommitCallbackRegistrar.add("MediaCtrl.SkipBack", boost::bind(&LLPanelPrimMediaControls::onClickSkipBack, this));
- mCommitCallbackRegistrar.add("MediaCtrl.SkipForward", boost::bind(&LLPanelPrimMediaControls::onClickSkipForward, this));
-
- buildFromFile( "panel_prim_media_controls.xml");
- mInactivityTimer.reset();
- mFadeTimer.stop();
- mCurrentZoom = ZOOM_NONE;
- mScrollState = SCROLL_NONE;
-
- mPanelHandle.bind(this);
-
- mInactiveTimeout = gSavedSettings.getF32("MediaControlTimeout");
- mControlFadeTime = gSavedSettings.getF32("MediaControlFadeTime");
+ mCommitCallbackRegistrar.add("MediaCtrl.Close", boost::bind(&LLPanelPrimMediaControls::onClickClose, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Back", boost::bind(&LLPanelPrimMediaControls::onClickBack, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Forward", boost::bind(&LLPanelPrimMediaControls::onClickForward, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Home", boost::bind(&LLPanelPrimMediaControls::onClickHome, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Stop", boost::bind(&LLPanelPrimMediaControls::onClickStop, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.MediaStop", boost::bind(&LLPanelPrimMediaControls::onClickMediaStop, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Reload", boost::bind(&LLPanelPrimMediaControls::onClickReload, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Play", boost::bind(&LLPanelPrimMediaControls::onClickPlay, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Pause", boost::bind(&LLPanelPrimMediaControls::onClickPause, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Open", boost::bind(&LLPanelPrimMediaControls::onClickOpen, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Zoom", boost::bind(&LLPanelPrimMediaControls::onClickZoom, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.CommitURL", boost::bind(&LLPanelPrimMediaControls::onCommitURL, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.MouseDown", boost::bind(&LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseDown, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.MouseUp", boost::bind(&LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseUp, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeUp", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeUp, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeDown", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeDown, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Volume", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeSlider, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.ToggleMute", boost::bind(&LLPanelPrimMediaControls::onToggleMute, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.ShowVolumeSlider", boost::bind(&LLPanelPrimMediaControls::showVolumeSlider, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.HideVolumeSlider", boost::bind(&LLPanelPrimMediaControls::hideVolumeSlider, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.SkipBack", boost::bind(&LLPanelPrimMediaControls::onClickSkipBack, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.SkipForward", boost::bind(&LLPanelPrimMediaControls::onClickSkipForward, this));
+
+ buildFromFile( "panel_prim_media_controls.xml");
+ mInactivityTimer.reset();
+ mFadeTimer.stop();
+ mCurrentZoom = ZOOM_NONE;
+ mScrollState = SCROLL_NONE;
+
+ mPanelHandle.bind(this);
+
+ mInactiveTimeout = gSavedSettings.getF32("MediaControlTimeout");
+ mControlFadeTime = gSavedSettings.getF32("MediaControlFadeTime");
}
LLPanelPrimMediaControls::~LLPanelPrimMediaControls()
@@ -143,695 +143,695 @@ LLPanelPrimMediaControls::~LLPanelPrimMediaControls()
BOOL LLPanelPrimMediaControls::postBuild()
{
- mMediaRegion = getChild<LLView>("media_region");
- mBackCtrl = getChild<LLUICtrl>("back");
- mFwdCtrl = getChild<LLUICtrl>("fwd");
- mReloadCtrl = getChild<LLUICtrl>("reload");
- mPlayCtrl = getChild<LLUICtrl>("play");
- mPauseCtrl = getChild<LLUICtrl>("pause");
- mStopCtrl = getChild<LLUICtrl>("stop");
- mMediaStopCtrl = getChild<LLUICtrl>("media_stop");
- mHomeCtrl = getChild<LLUICtrl>("home");
- mUnzoomCtrl = getChild<LLUICtrl>("close"); // This is actually "unzoom"
- mOpenCtrl = getChild<LLUICtrl>("new_window");
- mZoomCtrl = getChild<LLUICtrl>("zoom_frame");
- mMediaProgressPanel = getChild<LLPanel>("media_progress_indicator");
- mMediaProgressBar = getChild<LLProgressBar>("media_progress_bar");
- mMediaAddressCtrl = getChild<LLUICtrl>("media_address");
- mMediaAddress = getChild<LLLineEditor>("media_address_url");
- mMediaPlaySliderPanel = getChild<LLUICtrl>("media_play_position");
- mMediaPlaySliderCtrl = getChild<LLUICtrl>("media_play_slider");
- mSkipFwdCtrl = getChild<LLUICtrl>("skip_forward");
- mSkipBackCtrl = getChild<LLUICtrl>("skip_back");
- mVolumeCtrl = getChild<LLUICtrl>("media_volume");
- mMuteBtn = getChild<LLButton>("media_mute_button");
- mVolumeSliderCtrl = getChild<LLSliderCtrl>("volume_slider");
- mWhitelistIcon = getChild<LLIconCtrl>("media_whitelist_flag");
- mSecureLockIcon = getChild<LLIconCtrl>("media_secure_lock_flag");
- mMediaControlsStack = getChild<LLLayoutStack>("media_controls");
- mLeftBookend = getChild<LLUICtrl>("left_bookend");
- mRightBookend = getChild<LLUICtrl>("right_bookend");
- mBackgroundImage = LLUI::getUIImage(getString("control_background_image_name"));
- mVolumeSliderBackgroundImage = LLUI::getUIImage(getString("control_background_image_name"));
- LLStringUtil::convertToF32(getString("skip_step"), mSkipStep);
- LLStringUtil::convertToS32(getString("min_width"), mMinWidth);
- LLStringUtil::convertToS32(getString("min_height"), mMinHeight);
- LLStringUtil::convertToF32(getString("zoom_near_padding"), mZoomNearPadding);
- LLStringUtil::convertToF32(getString("zoom_medium_padding"), mZoomMediumPadding);
- LLStringUtil::convertToF32(getString("zoom_far_padding"), mZoomFarPadding);
- LLStringUtil::convertToS32(getString("top_world_view_avoid_zone"), mTopWorldViewAvoidZone);
-
- // These are currently removed...but getChild creates a "dummy" widget.
- // This class handles them missing.
- mMediaPanelScroll = findChild<LLUICtrl>("media_panel_scroll");
- mScrollUpCtrl = findChild<LLButton>("scrollup");
- mScrollLeftCtrl = findChild<LLButton>("scrollleft");
- mScrollRightCtrl = findChild<LLButton>("scrollright");
- mScrollDownCtrl = findChild<LLButton>("scrolldown");
-
- if (mScrollUpCtrl)
- {
- mScrollUpCtrl->setClickedCallback(onScrollUp, this);
- mScrollUpCtrl->setHeldDownCallback(onScrollUpHeld, this);
- mScrollUpCtrl->setMouseUpCallback(onScrollStop, this);
- }
- if (mScrollLeftCtrl)
- {
- mScrollLeftCtrl->setClickedCallback(onScrollLeft, this);
- mScrollLeftCtrl->setHeldDownCallback(onScrollLeftHeld, this);
- mScrollLeftCtrl->setMouseUpCallback(onScrollStop, this);
- }
- if (mScrollRightCtrl)
- {
- mScrollRightCtrl->setClickedCallback(onScrollRight, this);
- mScrollRightCtrl->setHeldDownCallback(onScrollRightHeld, this);
- mScrollRightCtrl->setMouseUpCallback(onScrollStop, this);
- }
- if (mScrollDownCtrl)
- {
- mScrollDownCtrl->setClickedCallback(onScrollDown, this);
- mScrollDownCtrl->setHeldDownCallback(onScrollDownHeld, this);
- mScrollDownCtrl->setMouseUpCallback(onScrollStop, this);
- }
-
- mMediaAddress->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this ));
-
- gAgent.setMouselookModeInCallback(boost::bind(&LLPanelPrimMediaControls::onMouselookModeIn, this));
-
- LLWindowShade::Params window_shade_params;
- window_shade_params.name = "window_shade";
-
- mCurrentZoom = ZOOM_NONE;
- // clicks on buttons do not remove keyboard focus from media
- setIsChrome(TRUE);
- return TRUE;
+ mMediaRegion = getChild<LLView>("media_region");
+ mBackCtrl = getChild<LLUICtrl>("back");
+ mFwdCtrl = getChild<LLUICtrl>("fwd");
+ mReloadCtrl = getChild<LLUICtrl>("reload");
+ mPlayCtrl = getChild<LLUICtrl>("play");
+ mPauseCtrl = getChild<LLUICtrl>("pause");
+ mStopCtrl = getChild<LLUICtrl>("stop");
+ mMediaStopCtrl = getChild<LLUICtrl>("media_stop");
+ mHomeCtrl = getChild<LLUICtrl>("home");
+ mUnzoomCtrl = getChild<LLUICtrl>("close"); // This is actually "unzoom"
+ mOpenCtrl = getChild<LLUICtrl>("new_window");
+ mZoomCtrl = getChild<LLUICtrl>("zoom_frame");
+ mMediaProgressPanel = getChild<LLPanel>("media_progress_indicator");
+ mMediaProgressBar = getChild<LLProgressBar>("media_progress_bar");
+ mMediaAddressCtrl = getChild<LLUICtrl>("media_address");
+ mMediaAddress = getChild<LLLineEditor>("media_address_url");
+ mMediaPlaySliderPanel = getChild<LLUICtrl>("media_play_position");
+ mMediaPlaySliderCtrl = getChild<LLUICtrl>("media_play_slider");
+ mSkipFwdCtrl = getChild<LLUICtrl>("skip_forward");
+ mSkipBackCtrl = getChild<LLUICtrl>("skip_back");
+ mVolumeCtrl = getChild<LLUICtrl>("media_volume");
+ mMuteBtn = getChild<LLButton>("media_mute_button");
+ mVolumeSliderCtrl = getChild<LLSliderCtrl>("volume_slider");
+ mWhitelistIcon = getChild<LLIconCtrl>("media_whitelist_flag");
+ mSecureLockIcon = getChild<LLIconCtrl>("media_secure_lock_flag");
+ mMediaControlsStack = getChild<LLLayoutStack>("media_controls");
+ mLeftBookend = getChild<LLUICtrl>("left_bookend");
+ mRightBookend = getChild<LLUICtrl>("right_bookend");
+ mBackgroundImage = LLUI::getUIImage(getString("control_background_image_name"));
+ mVolumeSliderBackgroundImage = LLUI::getUIImage(getString("control_background_image_name"));
+ LLStringUtil::convertToF32(getString("skip_step"), mSkipStep);
+ LLStringUtil::convertToS32(getString("min_width"), mMinWidth);
+ LLStringUtil::convertToS32(getString("min_height"), mMinHeight);
+ LLStringUtil::convertToF32(getString("zoom_near_padding"), mZoomNearPadding);
+ LLStringUtil::convertToF32(getString("zoom_medium_padding"), mZoomMediumPadding);
+ LLStringUtil::convertToF32(getString("zoom_far_padding"), mZoomFarPadding);
+ LLStringUtil::convertToS32(getString("top_world_view_avoid_zone"), mTopWorldViewAvoidZone);
+
+ // These are currently removed...but getChild creates a "dummy" widget.
+ // This class handles them missing.
+ mMediaPanelScroll = findChild<LLUICtrl>("media_panel_scroll");
+ mScrollUpCtrl = findChild<LLButton>("scrollup");
+ mScrollLeftCtrl = findChild<LLButton>("scrollleft");
+ mScrollRightCtrl = findChild<LLButton>("scrollright");
+ mScrollDownCtrl = findChild<LLButton>("scrolldown");
+
+ if (mScrollUpCtrl)
+ {
+ mScrollUpCtrl->setClickedCallback(onScrollUp, this);
+ mScrollUpCtrl->setHeldDownCallback(onScrollUpHeld, this);
+ mScrollUpCtrl->setMouseUpCallback(onScrollStop, this);
+ }
+ if (mScrollLeftCtrl)
+ {
+ mScrollLeftCtrl->setClickedCallback(onScrollLeft, this);
+ mScrollLeftCtrl->setHeldDownCallback(onScrollLeftHeld, this);
+ mScrollLeftCtrl->setMouseUpCallback(onScrollStop, this);
+ }
+ if (mScrollRightCtrl)
+ {
+ mScrollRightCtrl->setClickedCallback(onScrollRight, this);
+ mScrollRightCtrl->setHeldDownCallback(onScrollRightHeld, this);
+ mScrollRightCtrl->setMouseUpCallback(onScrollStop, this);
+ }
+ if (mScrollDownCtrl)
+ {
+ mScrollDownCtrl->setClickedCallback(onScrollDown, this);
+ mScrollDownCtrl->setHeldDownCallback(onScrollDownHeld, this);
+ mScrollDownCtrl->setMouseUpCallback(onScrollStop, this);
+ }
+
+ mMediaAddress->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this ));
+
+ gAgent.setMouselookModeInCallback(boost::bind(&LLPanelPrimMediaControls::onMouselookModeIn, this));
+
+ LLWindowShade::Params window_shade_params;
+ window_shade_params.name = "window_shade";
+
+ mCurrentZoom = ZOOM_NONE;
+ // clicks on buttons do not remove keyboard focus from media
+ setIsChrome(TRUE);
+ return TRUE;
}
void LLPanelPrimMediaControls::setMediaFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal)
{
- if (media_impl.notNull() && objectp.notNull())
- {
- LLUUID prev_id = mTargetImplID;
- mTargetImplID = media_impl->getMediaTextureID();
- mTargetObjectID = objectp->getID();
- mTargetObjectFace = face;
- mTargetObjectNormal = pick_normal;
- mClearFaceOnFade = false;
-
- if (prev_id != mTargetImplID)
- mVolumeSliderCtrl->setValue(media_impl->getVolume());
- }
- else
- {
- // This happens on a timer now.
-// mTargetImplID = LLUUID::null;
-// mTargetObjectID = LLUUID::null;
-// mTargetObjectFace = 0;
- mClearFaceOnFade = true;
- }
-
- updateShape();
+ if (media_impl.notNull() && objectp.notNull())
+ {
+ LLUUID prev_id = mTargetImplID;
+ mTargetImplID = media_impl->getMediaTextureID();
+ mTargetObjectID = objectp->getID();
+ mTargetObjectFace = face;
+ mTargetObjectNormal = pick_normal;
+ mClearFaceOnFade = false;
+
+ if (prev_id != mTargetImplID)
+ mVolumeSliderCtrl->setValue(media_impl->getVolume());
+ }
+ else
+ {
+ // This happens on a timer now.
+// mTargetImplID = LLUUID::null;
+// mTargetObjectID = LLUUID::null;
+// mTargetObjectFace = 0;
+ mClearFaceOnFade = true;
+ }
+
+ updateShape();
}
void LLPanelPrimMediaControls::focusOnTarget()
{
- // Sets the media focus to the current target of the LLPanelPrimMediaControls.
- // This is how we transition from hover to focus when the user clicks on a control.
- LLViewerMediaImpl* media_impl = getTargetMediaImpl();
- if(media_impl)
- {
- if (!media_impl->hasFocus())
- {
- // The current target doesn't have media focus -- focus on it.
- LLViewerObject* objectp = getTargetObject();
- LLViewerMediaFocus::getInstance()->setFocusFace(objectp, mTargetObjectFace, media_impl, mTargetObjectNormal);
- }
- }
+ // Sets the media focus to the current target of the LLPanelPrimMediaControls.
+ // This is how we transition from hover to focus when the user clicks on a control.
+ LLViewerMediaImpl* media_impl = getTargetMediaImpl();
+ if(media_impl)
+ {
+ if (!media_impl->hasFocus())
+ {
+ // The current target doesn't have media focus -- focus on it.
+ LLViewerObject* objectp = getTargetObject();
+ LLViewerMediaFocus::getInstance()->setFocusFace(objectp, mTargetObjectFace, media_impl, mTargetObjectNormal);
+ }
+ }
}
LLViewerMediaImpl* LLPanelPrimMediaControls::getTargetMediaImpl()
{
- return LLViewerMedia::getInstance()->getMediaImplFromTextureID(mTargetImplID);
+ return LLViewerMedia::getInstance()->getMediaImplFromTextureID(mTargetImplID);
}
LLViewerObject* LLPanelPrimMediaControls::getTargetObject()
{
- return gObjectList.findObject(mTargetObjectID);
+ return gObjectList.findObject(mTargetObjectID);
}
LLPluginClassMedia* LLPanelPrimMediaControls::getTargetMediaPlugin()
{
- LLViewerMediaImpl* impl = getTargetMediaImpl();
- if(impl && impl->hasMedia())
- {
- return impl->getMediaPlugin();
- }
-
- return NULL;
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
+ if(impl && impl->hasMedia())
+ {
+ return impl->getMediaPlugin();
+ }
+
+ return NULL;
}
void LLPanelPrimMediaControls::updateShape()
{
- LLViewerMediaImpl* media_impl = getTargetMediaImpl();
- LLViewerObject* objectp = getTargetObject();
-
- if(!media_impl || gFloaterTools->getVisible())
- {
- setVisible(FALSE);
- return;
- }
-
- LLPluginClassMedia* media_plugin = NULL;
- if(media_impl->hasMedia())
- {
- media_plugin = media_impl->getMediaPlugin();
- }
-
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-
- bool can_navigate = parcel->getMediaAllowNavigate();
- bool enabled = false;
- bool is_zoomed = (mCurrentZoom != ZOOM_NONE) && (mTargetObjectID == mZoomObjectID) && (mTargetObjectFace == mZoomObjectFace) && !isZoomDistExceeding();
-
- // There is no such thing as "has_focus" being different from normal controls set
- // anymore (as of user feedback from bri 10/09). So we cheat here and force 'has_focus'
- // to 'true' (or, actually, we use a setting)
- bool has_focus = (gSavedSettings.getBOOL("PrimMediaControlsUseHoverControlSet")) ? media_impl->hasFocus() : true;
- setVisible(enabled);
-
- if (objectp)
- {
- bool hasPermsControl = true;
- bool mini_controls = false;
- LLMediaEntry *media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
- if (media_data && NULL != dynamic_cast<LLVOVolume*>(objectp))
- {
- // Don't show the media controls if we do not have permissions
- enabled = dynamic_cast<LLVOVolume*>(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL);
- hasPermsControl = dynamic_cast<LLVOVolume*>(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL);
- mini_controls = (LLMediaEntry::MINI == media_data->getControls());
- }
- const bool is_hud = objectp->isHUDAttachment();
-
- //
- // Set the state of the buttons
- //
-
- // XXX RSP: TODO: FIXME: clean this up so that it is clearer what mode we are in,
- // and that only the proper controls get made visible/enabled according to that mode.
- mBackCtrl->setVisible(has_focus);
- mFwdCtrl->setVisible(has_focus);
- mReloadCtrl->setVisible(has_focus);
- mStopCtrl->setVisible(false);
- mHomeCtrl->setVisible(has_focus);
- mZoomCtrl->setVisible(!is_zoomed);
- mUnzoomCtrl->setVisible(is_zoomed);
- mOpenCtrl->setVisible(true);
- mMediaAddressCtrl->setVisible(has_focus && !mini_controls);
- mMediaPlaySliderPanel->setVisible(has_focus && !mini_controls);
- mVolumeCtrl->setVisible(false);
-
- mWhitelistIcon->setVisible(!mini_controls && (media_data)?media_data->getWhiteListEnable():false);
- // Disable zoom if HUD
- mZoomCtrl->setEnabled(!is_hud);
- mUnzoomCtrl->setEnabled(!is_hud);
+ LLViewerMediaImpl* media_impl = getTargetMediaImpl();
+ LLViewerObject* objectp = getTargetObject();
+
+ if(!media_impl || gFloaterTools->getVisible())
+ {
+ setVisible(FALSE);
+ return;
+ }
+
+ LLPluginClassMedia* media_plugin = NULL;
+ if(media_impl->hasMedia())
+ {
+ media_plugin = media_impl->getMediaPlugin();
+ }
+
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+
+ bool can_navigate = parcel->getMediaAllowNavigate();
+ bool enabled = false;
+ bool is_zoomed = (mCurrentZoom != ZOOM_NONE) && (mTargetObjectID == mZoomObjectID) && (mTargetObjectFace == mZoomObjectFace) && !isZoomDistExceeding();
+
+ // There is no such thing as "has_focus" being different from normal controls set
+ // anymore (as of user feedback from bri 10/09). So we cheat here and force 'has_focus'
+ // to 'true' (or, actually, we use a setting)
+ bool has_focus = (gSavedSettings.getBOOL("PrimMediaControlsUseHoverControlSet")) ? media_impl->hasFocus() : true;
+ setVisible(enabled);
+
+ if (objectp)
+ {
+ bool hasPermsControl = true;
+ bool mini_controls = false;
+ LLMediaEntry *media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
+ if (media_data && NULL != dynamic_cast<LLVOVolume*>(objectp))
+ {
+ // Don't show the media controls if we do not have permissions
+ enabled = dynamic_cast<LLVOVolume*>(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL);
+ hasPermsControl = dynamic_cast<LLVOVolume*>(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL);
+ mini_controls = (LLMediaEntry::MINI == media_data->getControls());
+ }
+ const bool is_hud = objectp->isHUDAttachment();
+
+ //
+ // Set the state of the buttons
+ //
+
+ // XXX RSP: TODO: FIXME: clean this up so that it is clearer what mode we are in,
+ // and that only the proper controls get made visible/enabled according to that mode.
+ mBackCtrl->setVisible(has_focus);
+ mFwdCtrl->setVisible(has_focus);
+ mReloadCtrl->setVisible(has_focus);
+ mStopCtrl->setVisible(false);
+ mHomeCtrl->setVisible(has_focus);
+ mZoomCtrl->setVisible(!is_zoomed);
+ mUnzoomCtrl->setVisible(is_zoomed);
+ mOpenCtrl->setVisible(true);
+ mMediaAddressCtrl->setVisible(has_focus && !mini_controls);
+ mMediaPlaySliderPanel->setVisible(has_focus && !mini_controls);
+ mVolumeCtrl->setVisible(false);
+
+ mWhitelistIcon->setVisible(!mini_controls && (media_data)?media_data->getWhiteListEnable():false);
+ // Disable zoom if HUD
+ mZoomCtrl->setEnabled(!is_hud);
+ mUnzoomCtrl->setEnabled(!is_hud);
mSecureURL = false;
- mCurrentURL = media_impl->getCurrentMediaURL();
-
- mBackCtrl->setEnabled((media_impl != NULL) && media_impl->canNavigateBack() && can_navigate);
- mFwdCtrl->setEnabled((media_impl != NULL) && media_impl->canNavigateForward() && can_navigate);
- mStopCtrl->setEnabled(has_focus && can_navigate);
- mHomeCtrl->setEnabled(has_focus && can_navigate);
- LLPluginClassMediaOwner::EMediaStatus result = ((media_impl != NULL) && media_impl->hasMedia()) ? media_plugin->getStatus() : LLPluginClassMediaOwner::MEDIA_NONE;
-
- mVolumeCtrl->setVisible(has_focus);
- mVolumeCtrl->setEnabled(has_focus);
- mVolumeSliderCtrl->setEnabled(has_focus && shouldVolumeSliderBeVisible());
- mVolumeSliderCtrl->setVisible(has_focus && shouldVolumeSliderBeVisible());
-
- if(media_plugin && media_plugin->pluginSupportsMediaTime())
- {
- mReloadCtrl->setEnabled(false);
- mReloadCtrl->setVisible(false);
- mMediaStopCtrl->setVisible(has_focus);
- mHomeCtrl->setVisible(has_focus);
- mBackCtrl->setVisible(false);
- mFwdCtrl->setVisible(false);
- mMediaAddressCtrl->setVisible(false);
- mMediaAddressCtrl->setEnabled(false);
- mMediaPlaySliderPanel->setVisible(has_focus && !mini_controls);
- mMediaPlaySliderPanel->setEnabled(has_focus && !mini_controls);
- mSkipFwdCtrl->setVisible(has_focus && !mini_controls);
- mSkipFwdCtrl->setEnabled(has_focus && !mini_controls);
- mSkipBackCtrl->setVisible(has_focus && !mini_controls);
- mSkipBackCtrl->setEnabled(has_focus && !mini_controls);
-
- mVolumeCtrl->setVisible(has_focus);
- mVolumeCtrl->setEnabled(has_focus);
- mVolumeSliderCtrl->setEnabled(has_focus && shouldVolumeSliderBeVisible());
- mVolumeSliderCtrl->setVisible(has_focus && shouldVolumeSliderBeVisible());
-
- mWhitelistIcon->setVisible(false);
+ mCurrentURL = media_impl->getCurrentMediaURL();
+
+ mBackCtrl->setEnabled((media_impl != NULL) && media_impl->canNavigateBack() && can_navigate);
+ mFwdCtrl->setEnabled((media_impl != NULL) && media_impl->canNavigateForward() && can_navigate);
+ mStopCtrl->setEnabled(has_focus && can_navigate);
+ mHomeCtrl->setEnabled(has_focus && can_navigate);
+ LLPluginClassMediaOwner::EMediaStatus result = ((media_impl != NULL) && media_impl->hasMedia()) ? media_plugin->getStatus() : LLPluginClassMediaOwner::MEDIA_NONE;
+
+ mVolumeCtrl->setVisible(has_focus);
+ mVolumeCtrl->setEnabled(has_focus);
+ mVolumeSliderCtrl->setEnabled(has_focus && shouldVolumeSliderBeVisible());
+ mVolumeSliderCtrl->setVisible(has_focus && shouldVolumeSliderBeVisible());
+
+ if(media_plugin && media_plugin->pluginSupportsMediaTime())
+ {
+ mReloadCtrl->setEnabled(false);
+ mReloadCtrl->setVisible(false);
+ mMediaStopCtrl->setVisible(has_focus);
+ mHomeCtrl->setVisible(has_focus);
+ mBackCtrl->setVisible(false);
+ mFwdCtrl->setVisible(false);
+ mMediaAddressCtrl->setVisible(false);
+ mMediaAddressCtrl->setEnabled(false);
+ mMediaPlaySliderPanel->setVisible(has_focus && !mini_controls);
+ mMediaPlaySliderPanel->setEnabled(has_focus && !mini_controls);
+ mSkipFwdCtrl->setVisible(has_focus && !mini_controls);
+ mSkipFwdCtrl->setEnabled(has_focus && !mini_controls);
+ mSkipBackCtrl->setVisible(has_focus && !mini_controls);
+ mSkipBackCtrl->setEnabled(has_focus && !mini_controls);
+
+ mVolumeCtrl->setVisible(has_focus);
+ mVolumeCtrl->setEnabled(has_focus);
+ mVolumeSliderCtrl->setEnabled(has_focus && shouldVolumeSliderBeVisible());
+ mVolumeSliderCtrl->setVisible(has_focus && shouldVolumeSliderBeVisible());
+
+ mWhitelistIcon->setVisible(false);
mSecureURL = false;
- if (mMediaPanelScroll)
- {
- mMediaPanelScroll->setVisible(false);
- mScrollUpCtrl->setVisible(false);
- mScrollDownCtrl->setVisible(false);
- mScrollRightCtrl->setVisible(false);
- mScrollDownCtrl->setVisible(false);
- }
-
- F32 volume = media_impl->getVolume();
- // movie's url changed
- if(mCurrentURL!=mPreviousURL)
- {
- mMovieDuration = media_plugin->getDuration();
- mPreviousURL = mCurrentURL;
- }
-
- if(mMovieDuration == 0)
- {
- mMovieDuration = media_plugin->getDuration();
- mMediaPlaySliderCtrl->setValue(0);
- mMediaPlaySliderCtrl->setEnabled(false);
- }
- // TODO: What if it's not fully loaded
-
- if(mUpdateSlider && mMovieDuration!= 0)
- {
- F64 current_time = media_plugin->getCurrentTime();
- F32 percent = current_time / mMovieDuration;
- mMediaPlaySliderCtrl->setValue(percent);
- mMediaPlaySliderCtrl->setEnabled(true);
- }
-
- // video volume
- if(volume <= 0.0)
- {
- mMuteBtn->setToggleState(true);
- }
- else if (volume >= 1.0)
- {
- mMuteBtn->setToggleState(false);
- }
- else
- {
- mMuteBtn->setToggleState(false);
- }
-
- switch(result)
- {
- case LLPluginClassMediaOwner::MEDIA_PLAYING:
- mPlayCtrl->setEnabled(FALSE);
- mPlayCtrl->setVisible(FALSE);
- mPauseCtrl->setEnabled(TRUE);
- mPauseCtrl->setVisible(has_focus);
-
- break;
- case LLPluginClassMediaOwner::MEDIA_PAUSED:
- default:
- mPauseCtrl->setEnabled(FALSE);
- mPauseCtrl->setVisible(FALSE);
- mPlayCtrl->setEnabled(TRUE);
- mPlayCtrl->setVisible(has_focus);
- break;
- }
- }
- else // web based
- {
- if(media_plugin)
- {
- mCurrentURL = media_plugin->getLocation();
- }
- else
- {
- mCurrentURL.clear();
- }
-
- mPlayCtrl->setVisible(FALSE);
- mPauseCtrl->setVisible(FALSE);
- mMediaStopCtrl->setVisible(FALSE);
- mMediaAddressCtrl->setVisible(has_focus && !mini_controls);
- mMediaAddressCtrl->setEnabled(has_focus && !mini_controls);
- mMediaPlaySliderPanel->setVisible(FALSE);
- mMediaPlaySliderPanel->setEnabled(FALSE);
- mSkipFwdCtrl->setVisible(FALSE);
- mSkipFwdCtrl->setEnabled(FALSE);
- mSkipBackCtrl->setVisible(FALSE);
- mSkipBackCtrl->setEnabled(FALSE);
-
- if(media_impl->getVolume() <= 0.0)
- {
- mMuteBtn->setToggleState(true);
- }
- else
- {
- mMuteBtn->setToggleState(false);
- }
-
- if (mMediaPanelScroll)
- {
- mMediaPanelScroll->setVisible(has_focus);
- mScrollUpCtrl->setVisible(has_focus);
- mScrollDownCtrl->setVisible(has_focus);
- mScrollRightCtrl->setVisible(has_focus);
- mScrollDownCtrl->setVisible(has_focus);
- }
- // TODO: get the secure lock bool from media plug in
- std::string prefix = std::string("https://");
- std::string test_prefix = mCurrentURL.substr(0, prefix.length());
- LLStringUtil::toLower(test_prefix);
+ if (mMediaPanelScroll)
+ {
+ mMediaPanelScroll->setVisible(false);
+ mScrollUpCtrl->setVisible(false);
+ mScrollDownCtrl->setVisible(false);
+ mScrollRightCtrl->setVisible(false);
+ mScrollDownCtrl->setVisible(false);
+ }
+
+ F32 volume = media_impl->getVolume();
+ // movie's url changed
+ if(mCurrentURL!=mPreviousURL)
+ {
+ mMovieDuration = media_plugin->getDuration();
+ mPreviousURL = mCurrentURL;
+ }
+
+ if(mMovieDuration == 0)
+ {
+ mMovieDuration = media_plugin->getDuration();
+ mMediaPlaySliderCtrl->setValue(0);
+ mMediaPlaySliderCtrl->setEnabled(false);
+ }
+ // TODO: What if it's not fully loaded
+
+ if(mUpdateSlider && mMovieDuration!= 0)
+ {
+ F64 current_time = media_plugin->getCurrentTime();
+ F32 percent = current_time / mMovieDuration;
+ mMediaPlaySliderCtrl->setValue(percent);
+ mMediaPlaySliderCtrl->setEnabled(true);
+ }
+
+ // video volume
+ if(volume <= 0.0)
+ {
+ mMuteBtn->setToggleState(true);
+ }
+ else if (volume >= 1.0)
+ {
+ mMuteBtn->setToggleState(false);
+ }
+ else
+ {
+ mMuteBtn->setToggleState(false);
+ }
+
+ switch(result)
+ {
+ case LLPluginClassMediaOwner::MEDIA_PLAYING:
+ mPlayCtrl->setEnabled(FALSE);
+ mPlayCtrl->setVisible(FALSE);
+ mPauseCtrl->setEnabled(TRUE);
+ mPauseCtrl->setVisible(has_focus);
+
+ break;
+ case LLPluginClassMediaOwner::MEDIA_PAUSED:
+ default:
+ mPauseCtrl->setEnabled(FALSE);
+ mPauseCtrl->setVisible(FALSE);
+ mPlayCtrl->setEnabled(TRUE);
+ mPlayCtrl->setVisible(has_focus);
+ break;
+ }
+ }
+ else // web based
+ {
+ if(media_plugin)
+ {
+ mCurrentURL = media_plugin->getLocation();
+ }
+ else
+ {
+ mCurrentURL.clear();
+ }
+
+ mPlayCtrl->setVisible(FALSE);
+ mPauseCtrl->setVisible(FALSE);
+ mMediaStopCtrl->setVisible(FALSE);
+ mMediaAddressCtrl->setVisible(has_focus && !mini_controls);
+ mMediaAddressCtrl->setEnabled(has_focus && !mini_controls);
+ mMediaPlaySliderPanel->setVisible(FALSE);
+ mMediaPlaySliderPanel->setEnabled(FALSE);
+ mSkipFwdCtrl->setVisible(FALSE);
+ mSkipFwdCtrl->setEnabled(FALSE);
+ mSkipBackCtrl->setVisible(FALSE);
+ mSkipBackCtrl->setEnabled(FALSE);
+
+ if(media_impl->getVolume() <= 0.0)
+ {
+ mMuteBtn->setToggleState(true);
+ }
+ else
+ {
+ mMuteBtn->setToggleState(false);
+ }
+
+ if (mMediaPanelScroll)
+ {
+ mMediaPanelScroll->setVisible(has_focus);
+ mScrollUpCtrl->setVisible(has_focus);
+ mScrollDownCtrl->setVisible(has_focus);
+ mScrollRightCtrl->setVisible(has_focus);
+ mScrollDownCtrl->setVisible(has_focus);
+ }
+ // TODO: get the secure lock bool from media plug in
+ std::string prefix = std::string("https://");
+ std::string test_prefix = mCurrentURL.substr(0, prefix.length());
+ LLStringUtil::toLower(test_prefix);
mSecureURL = has_focus && (test_prefix == prefix);
- S32 left_pad = mSecureURL ? mSecureLockIcon->getRect().getWidth() : ADDR_LEFT_PAD;
- mMediaAddress->setTextPadding(left_pad, 0);
-
- if(mCurrentURL!=mPreviousURL)
- {
- setCurrentURL();
- mPreviousURL = mCurrentURL;
- }
-
- if(result == LLPluginClassMediaOwner::MEDIA_LOADING)
- {
- mReloadCtrl->setEnabled(FALSE);
- mReloadCtrl->setVisible(FALSE);
- mStopCtrl->setEnabled(TRUE);
- mStopCtrl->setVisible(has_focus);
- }
- else
- {
- mReloadCtrl->setEnabled(TRUE);
- mReloadCtrl->setVisible(has_focus);
- mStopCtrl->setEnabled(FALSE);
- mStopCtrl->setVisible(FALSE);
- }
- }
-
-
- if(media_plugin)
- {
- //
- // Handle progress bar
- //
- if(LLPluginClassMediaOwner::MEDIA_LOADING == media_plugin->getStatus())
- {
- mMediaProgressPanel->setVisible(true);
- mMediaProgressBar->setValue(media_plugin->getProgressPercent());
- }
- else
- {
- mMediaProgressPanel->setVisible(false);
- }
- }
-
- if(media_impl)
- {
- //
- // Handle Scrolling
- //
- switch (mScrollState)
- {
- case SCROLL_UP:
- media_impl->scrollWheel(0, 0, 0, -1, MASK_NONE);
- break;
- case SCROLL_DOWN:
- media_impl->scrollWheel(0, 0, 0, 1, MASK_NONE);
- break;
- case SCROLL_LEFT:
- media_impl->scrollWheel(0, 0, 1, 0, MASK_NONE);
- // media_impl->handleKeyHere(KEY_LEFT, MASK_NONE);
- break;
- case SCROLL_RIGHT:
- media_impl->scrollWheel(0, 0, -1, 0, MASK_NONE);
- // media_impl->handleKeyHere(KEY_RIGHT, MASK_NONE);
- break;
- case SCROLL_NONE:
- default:
- break;
- }
- }
-
- // Web plugins and HUD may have media controls invisible for user, but still need scroll mouse events.
- // LLView checks for visibleEnabledAndContains() and won't pass events to invisible panel, so instead
- // of hiding whole panel hide each control instead (if user has no perms).
- // Note: It might be beneficial to keep panel visible for all plugins to make behavior consistent, but
- // for now limiting change to cases that need events.
-
- if (!is_hud && (!media_plugin || media_plugin->pluginSupportsMediaTime()))
- {
- setVisible(enabled);
- }
- else
- {
- if( !hasPermsControl )
- {
- mBackCtrl->setVisible(false);
- mFwdCtrl->setVisible(false);
- mReloadCtrl->setVisible(false);
- mStopCtrl->setVisible(false);
- mHomeCtrl->setVisible(false);
- mZoomCtrl->setVisible(false);
- mUnzoomCtrl->setVisible(false);
- mOpenCtrl->setVisible(false);
- mMediaAddressCtrl->setVisible(false);
- mMediaPlaySliderPanel->setVisible(false);
- mVolumeCtrl->setVisible(false);
- mMediaProgressPanel->setVisible(false);
- mVolumeSliderCtrl->setVisible(false);
- }
-
- setVisible(true);
- }
-
- //
- // Calculate position and shape of the controls
- //
- std::vector<LLVector3>::iterator vert_it;
- std::vector<LLVector3>::iterator vert_end;
- std::vector<LLVector3> vect_face;
-
- LLVolume* volume = objectp->getVolume();
-
- if (volume)
- {
- const LLVolumeFace& vf = volume->getVolumeFace(mTargetObjectFace);
-
- LLVector3 ext[2];
- ext[0].set(vf.mExtents[0].getF32ptr());
- ext[1].set(vf.mExtents[1].getF32ptr());
-
- LLVector3 center = (ext[0]+ext[1])*0.5f;
- LLVector3 size = (ext[1]-ext[0])*0.5f;
- LLVector3 vert[] =
- {
- center + size.scaledVec(LLVector3(1,1,1)),
- center + size.scaledVec(LLVector3(-1,1,1)),
- center + size.scaledVec(LLVector3(1,-1,1)),
- center + size.scaledVec(LLVector3(-1,-1,1)),
- center + size.scaledVec(LLVector3(1,1,-1)),
- center + size.scaledVec(LLVector3(-1,1,-1)),
- center + size.scaledVec(LLVector3(1,-1,-1)),
- center + size.scaledVec(LLVector3(-1,-1,-1)),
- };
-
- LLVOVolume* vo = (LLVOVolume*) objectp;
-
- for (U32 i = 0; i < 8; i++)
- {
- vect_face.push_back(vo->volumePositionToAgent(vert[i]));
- }
- }
- vert_it = vect_face.begin();
- vert_end = vect_face.end();
-
- glh::matrix4f mat;
- if (!is_hud)
- {
- mat = get_current_projection() * get_current_modelview();
- }
- else {
- glh::matrix4f proj, modelview;
- if (get_hud_matrices(proj, modelview))
- mat = proj * modelview;
- }
- LLVector3 min = LLVector3(1,1,1);
- LLVector3 max = LLVector3(-1,-1,-1);
- for(; vert_it != vert_end; ++vert_it)
- {
- // project silhouette vertices into screen space
- glh::vec3f screen_vert = glh::vec3f(vert_it->mV);
- mat.mult_matrix_vec(screen_vert);
-
- // add to screenspace bounding box
- update_min_max(min, max, LLVector3(screen_vert.v));
- }
-
- // convert screenspace bbox to pixels (in screen coords)
- LLRect window_rect = gViewerWindow->getWorldViewRectScaled();
- LLCoordGL screen_min;
- screen_min.mX = ll_round((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (min.mV[VX] + 1.f) * 0.5f);
- screen_min.mY = ll_round((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (min.mV[VY] + 1.f) * 0.5f);
-
- LLCoordGL screen_max;
- screen_max.mX = ll_round((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (max.mV[VX] + 1.f) * 0.5f);
- screen_max.mY = ll_round((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (max.mV[VY] + 1.f) * 0.5f);
-
- // grow panel so that screenspace bounding box fits inside "media_region" element of panel
- LLRect media_panel_rect;
- // Get the height of the controls (less the volume slider)
- S32 controls_height = mMediaControlsStack->getRect().getHeight() - mVolumeSliderCtrl->getRect().getHeight();
- getParent()->screenRectToLocal(LLRect(screen_min.mX, screen_max.mY, screen_max.mX, screen_min.mY), &media_panel_rect);
- media_panel_rect.mTop += controls_height;
-
- // keep all parts of panel on-screen
- // Area of the top of the world view to avoid putting the controls
- window_rect.mTop -= mTopWorldViewAvoidZone;
- // Don't include "spacing" bookends on left & right of the media controls
- window_rect.mLeft -= mLeftBookend->getRect().getWidth();
- window_rect.mRight += mRightBookend->getRect().getWidth();
- // Don't include the volume slider
- window_rect.mBottom -= mVolumeSliderCtrl->getRect().getHeight();
- media_panel_rect.intersectWith(window_rect);
-
- // clamp to minimum size, keeping rect inside window
- S32 centerX = media_panel_rect.getCenterX();
- S32 centerY = media_panel_rect.getCenterY();
- // Shrink screen rect by min width and height, to ensure containment
- window_rect.stretch(-mMinWidth/2, -mMinHeight/2);
- window_rect.clampPointToRect(centerX, centerY);
- media_panel_rect.setCenterAndSize(centerX, centerY,
- llmax(mMinWidth, media_panel_rect.getWidth()),
- llmax(mMinHeight, media_panel_rect.getHeight()));
-
- // Finally set the size of the panel
- setShape(media_panel_rect, true);
-
- // Test mouse position to see if the cursor is stationary
- LLCoordWindow cursor_pos_window;
- getWindow()->getCursorPosition(&cursor_pos_window);
-
- // If last pos is not equal to current pos, the mouse has moved
- // We need to reset the timer, and make sure the panel is visible
- if(cursor_pos_window.mX != mLastCursorPos.mX ||
- cursor_pos_window.mY != mLastCursorPos.mY ||
- mScrollState != SCROLL_NONE)
- {
- mInactivityTimer.start();
- mLastCursorPos = cursor_pos_window;
- }
-
- if(isMouseOver() || hasFocus())
- {
- // Never fade the controls if the mouse is over them or they have keyboard focus.
- mFadeTimer.stop();
- }
- else if(!mClearFaceOnFade && (mInactivityTimer.getElapsedTimeF32() < mInactiveTimeout))
- {
- // Mouse is over the object, but has not been stationary for long enough to fade the UI
- mFadeTimer.stop();
- }
- else if(! mFadeTimer.getStarted() )
- {
- // we need to start fading the UI (and we have not already started)
- mFadeTimer.reset();
- mFadeTimer.start();
- }
- else
- {
- // I don't think this is correct anymore. This is done in draw() after the fade has completed.
- // setVisible(FALSE);
- }
- }
+ S32 left_pad = mSecureURL ? mSecureLockIcon->getRect().getWidth() : ADDR_LEFT_PAD;
+ mMediaAddress->setTextPadding(left_pad, 0);
+
+ if(mCurrentURL!=mPreviousURL)
+ {
+ setCurrentURL();
+ mPreviousURL = mCurrentURL;
+ }
+
+ if(result == LLPluginClassMediaOwner::MEDIA_LOADING)
+ {
+ mReloadCtrl->setEnabled(FALSE);
+ mReloadCtrl->setVisible(FALSE);
+ mStopCtrl->setEnabled(TRUE);
+ mStopCtrl->setVisible(has_focus);
+ }
+ else
+ {
+ mReloadCtrl->setEnabled(TRUE);
+ mReloadCtrl->setVisible(has_focus);
+ mStopCtrl->setEnabled(FALSE);
+ mStopCtrl->setVisible(FALSE);
+ }
+ }
+
+
+ if(media_plugin)
+ {
+ //
+ // Handle progress bar
+ //
+ if(LLPluginClassMediaOwner::MEDIA_LOADING == media_plugin->getStatus())
+ {
+ mMediaProgressPanel->setVisible(true);
+ mMediaProgressBar->setValue(media_plugin->getProgressPercent());
+ }
+ else
+ {
+ mMediaProgressPanel->setVisible(false);
+ }
+ }
+
+ if(media_impl)
+ {
+ //
+ // Handle Scrolling
+ //
+ switch (mScrollState)
+ {
+ case SCROLL_UP:
+ media_impl->scrollWheel(0, 0, 0, -1, MASK_NONE);
+ break;
+ case SCROLL_DOWN:
+ media_impl->scrollWheel(0, 0, 0, 1, MASK_NONE);
+ break;
+ case SCROLL_LEFT:
+ media_impl->scrollWheel(0, 0, 1, 0, MASK_NONE);
+ // media_impl->handleKeyHere(KEY_LEFT, MASK_NONE);
+ break;
+ case SCROLL_RIGHT:
+ media_impl->scrollWheel(0, 0, -1, 0, MASK_NONE);
+ // media_impl->handleKeyHere(KEY_RIGHT, MASK_NONE);
+ break;
+ case SCROLL_NONE:
+ default:
+ break;
+ }
+ }
+
+ // Web plugins and HUD may have media controls invisible for user, but still need scroll mouse events.
+ // LLView checks for visibleEnabledAndContains() and won't pass events to invisible panel, so instead
+ // of hiding whole panel hide each control instead (if user has no perms).
+ // Note: It might be beneficial to keep panel visible for all plugins to make behavior consistent, but
+ // for now limiting change to cases that need events.
+
+ if (!is_hud && (!media_plugin || media_plugin->pluginSupportsMediaTime()))
+ {
+ setVisible(enabled);
+ }
+ else
+ {
+ if( !hasPermsControl )
+ {
+ mBackCtrl->setVisible(false);
+ mFwdCtrl->setVisible(false);
+ mReloadCtrl->setVisible(false);
+ mStopCtrl->setVisible(false);
+ mHomeCtrl->setVisible(false);
+ mZoomCtrl->setVisible(false);
+ mUnzoomCtrl->setVisible(false);
+ mOpenCtrl->setVisible(false);
+ mMediaAddressCtrl->setVisible(false);
+ mMediaPlaySliderPanel->setVisible(false);
+ mVolumeCtrl->setVisible(false);
+ mMediaProgressPanel->setVisible(false);
+ mVolumeSliderCtrl->setVisible(false);
+ }
+
+ setVisible(true);
+ }
+
+ //
+ // Calculate position and shape of the controls
+ //
+ std::vector<LLVector3>::iterator vert_it;
+ std::vector<LLVector3>::iterator vert_end;
+ std::vector<LLVector3> vect_face;
+
+ LLVolume* volume = objectp->getVolume();
+
+ if (volume)
+ {
+ const LLVolumeFace& vf = volume->getVolumeFace(mTargetObjectFace);
+
+ LLVector3 ext[2];
+ ext[0].set(vf.mExtents[0].getF32ptr());
+ ext[1].set(vf.mExtents[1].getF32ptr());
+
+ LLVector3 center = (ext[0]+ext[1])*0.5f;
+ LLVector3 size = (ext[1]-ext[0])*0.5f;
+ LLVector3 vert[] =
+ {
+ center + size.scaledVec(LLVector3(1,1,1)),
+ center + size.scaledVec(LLVector3(-1,1,1)),
+ center + size.scaledVec(LLVector3(1,-1,1)),
+ center + size.scaledVec(LLVector3(-1,-1,1)),
+ center + size.scaledVec(LLVector3(1,1,-1)),
+ center + size.scaledVec(LLVector3(-1,1,-1)),
+ center + size.scaledVec(LLVector3(1,-1,-1)),
+ center + size.scaledVec(LLVector3(-1,-1,-1)),
+ };
+
+ LLVOVolume* vo = (LLVOVolume*) objectp;
+
+ for (U32 i = 0; i < 8; i++)
+ {
+ vect_face.push_back(vo->volumePositionToAgent(vert[i]));
+ }
+ }
+ vert_it = vect_face.begin();
+ vert_end = vect_face.end();
+
+ glh::matrix4f mat;
+ if (!is_hud)
+ {
+ mat = get_current_projection() * get_current_modelview();
+ }
+ else {
+ glh::matrix4f proj, modelview;
+ if (get_hud_matrices(proj, modelview))
+ mat = proj * modelview;
+ }
+ LLVector3 min = LLVector3(1,1,1);
+ LLVector3 max = LLVector3(-1,-1,-1);
+ for(; vert_it != vert_end; ++vert_it)
+ {
+ // project silhouette vertices into screen space
+ glh::vec3f screen_vert = glh::vec3f(vert_it->mV);
+ mat.mult_matrix_vec(screen_vert);
+
+ // add to screenspace bounding box
+ update_min_max(min, max, LLVector3(screen_vert.v));
+ }
+
+ // convert screenspace bbox to pixels (in screen coords)
+ LLRect window_rect = gViewerWindow->getWorldViewRectScaled();
+ LLCoordGL screen_min;
+ screen_min.mX = ll_round((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (min.mV[VX] + 1.f) * 0.5f);
+ screen_min.mY = ll_round((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (min.mV[VY] + 1.f) * 0.5f);
+
+ LLCoordGL screen_max;
+ screen_max.mX = ll_round((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (max.mV[VX] + 1.f) * 0.5f);
+ screen_max.mY = ll_round((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (max.mV[VY] + 1.f) * 0.5f);
+
+ // grow panel so that screenspace bounding box fits inside "media_region" element of panel
+ LLRect media_panel_rect;
+ // Get the height of the controls (less the volume slider)
+ S32 controls_height = mMediaControlsStack->getRect().getHeight() - mVolumeSliderCtrl->getRect().getHeight();
+ getParent()->screenRectToLocal(LLRect(screen_min.mX, screen_max.mY, screen_max.mX, screen_min.mY), &media_panel_rect);
+ media_panel_rect.mTop += controls_height;
+
+ // keep all parts of panel on-screen
+ // Area of the top of the world view to avoid putting the controls
+ window_rect.mTop -= mTopWorldViewAvoidZone;
+ // Don't include "spacing" bookends on left & right of the media controls
+ window_rect.mLeft -= mLeftBookend->getRect().getWidth();
+ window_rect.mRight += mRightBookend->getRect().getWidth();
+ // Don't include the volume slider
+ window_rect.mBottom -= mVolumeSliderCtrl->getRect().getHeight();
+ media_panel_rect.intersectWith(window_rect);
+
+ // clamp to minimum size, keeping rect inside window
+ S32 centerX = media_panel_rect.getCenterX();
+ S32 centerY = media_panel_rect.getCenterY();
+ // Shrink screen rect by min width and height, to ensure containment
+ window_rect.stretch(-mMinWidth/2, -mMinHeight/2);
+ window_rect.clampPointToRect(centerX, centerY);
+ media_panel_rect.setCenterAndSize(centerX, centerY,
+ llmax(mMinWidth, media_panel_rect.getWidth()),
+ llmax(mMinHeight, media_panel_rect.getHeight()));
+
+ // Finally set the size of the panel
+ setShape(media_panel_rect, true);
+
+ // Test mouse position to see if the cursor is stationary
+ LLCoordWindow cursor_pos_window;
+ getWindow()->getCursorPosition(&cursor_pos_window);
+
+ // If last pos is not equal to current pos, the mouse has moved
+ // We need to reset the timer, and make sure the panel is visible
+ if(cursor_pos_window.mX != mLastCursorPos.mX ||
+ cursor_pos_window.mY != mLastCursorPos.mY ||
+ mScrollState != SCROLL_NONE)
+ {
+ mInactivityTimer.start();
+ mLastCursorPos = cursor_pos_window;
+ }
+
+ if(isMouseOver() || hasFocus())
+ {
+ // Never fade the controls if the mouse is over them or they have keyboard focus.
+ mFadeTimer.stop();
+ }
+ else if(!mClearFaceOnFade && (mInactivityTimer.getElapsedTimeF32() < mInactiveTimeout))
+ {
+ // Mouse is over the object, but has not been stationary for long enough to fade the UI
+ mFadeTimer.stop();
+ }
+ else if(! mFadeTimer.getStarted() )
+ {
+ // we need to start fading the UI (and we have not already started)
+ mFadeTimer.reset();
+ mFadeTimer.start();
+ }
+ else
+ {
+ // I don't think this is correct anymore. This is done in draw() after the fade has completed.
+ // setVisible(FALSE);
+ }
+ }
}
/*virtual*/
void LLPanelPrimMediaControls::draw()
{
- LLViewerMediaImpl* impl = getTargetMediaImpl();
- if (impl)
- {
- LLNotificationPtr notification = impl->getCurrentNotification();
- if (notification != mActiveNotification)
- {
- mActiveNotification = notification;
- if (notification)
- {
- showNotification(notification);
- }
- else
- {
- hideNotification();
- }
- }
- }
-
- F32 alpha = getDrawContext().mAlpha;
- if(mHideImmediately)
- {
- //hide this panel
- clearFaceOnFade();
-
- mHideImmediately = false;
- }
- else if(mFadeTimer.getStarted())
- {
- F32 time = mFadeTimer.getElapsedTimeF32();
- alpha *= llmax(lerp(1.0, 0.0, time / mControlFadeTime), 0.0f);
-
- if(time >= mControlFadeTime)
- {
- //hide this panel
- clearFaceOnFade();
- }
- }
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
+ if (impl)
+ {
+ LLNotificationPtr notification = impl->getCurrentNotification();
+ if (notification != mActiveNotification)
+ {
+ mActiveNotification = notification;
+ if (notification)
+ {
+ showNotification(notification);
+ }
+ else
+ {
+ hideNotification();
+ }
+ }
+ }
+
+ F32 alpha = getDrawContext().mAlpha;
+ if(mHideImmediately)
+ {
+ //hide this panel
+ clearFaceOnFade();
+
+ mHideImmediately = false;
+ }
+ else if(mFadeTimer.getStarted())
+ {
+ F32 time = mFadeTimer.getElapsedTimeF32();
+ alpha *= llmax(lerp(1.0, 0.0, time / mControlFadeTime), 0.0f);
+
+ if(time >= mControlFadeTime)
+ {
+ //hide this panel
+ clearFaceOnFade();
+ }
+ }
// Show/hide the lock icon for secure browsing
mSecureLockIcon->setVisible(mSecureURL && !mMediaAddress->hasFocus());
-
- // Build rect for icon area in coord system of this panel
- // Assumes layout_stack is a direct child of this panel
- mMediaControlsStack->updateLayout();
-
- // adjust for layout stack spacing
- S32 space = mMediaControlsStack->getPanelSpacing() + 2;
- LLRect controls_bg_area = mMediaControlsStack->getRect();
-
- controls_bg_area.mTop += space + 2;
-
- // adjust to ignore space from volume slider
- controls_bg_area.mBottom += mVolumeSliderCtrl->getRect().getHeight();
-
- // adjust to ignore space from left bookend padding
- controls_bg_area.mLeft += mLeftBookend->getRect().getWidth() - space;
-
- // ignore space from right bookend padding
- controls_bg_area.mRight -= mRightBookend->getRect().getWidth() - space - 2;
-
- // draw control background UI image
-
- LLViewerObject* objectp = getTargetObject();
- LLMediaEntry *media_data(0);
-
- if( objectp )
- media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
-
- if( !dynamic_cast<LLVOVolume*>(objectp) || !media_data || dynamic_cast<LLVOVolume*>(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL) )
- mBackgroundImage->draw( controls_bg_area, UI_VERTEX_COLOR % alpha);
-
- // draw volume slider background UI image
- if (mVolumeSliderCtrl->getVisible())
- {
- LLRect volume_slider_rect;
- screenRectToLocal(mVolumeSliderCtrl->calcScreenRect(), &volume_slider_rect);
- mVolumeSliderBackgroundImage->draw(volume_slider_rect, UI_VERTEX_COLOR % alpha);
- }
-
- {
- LLViewDrawContext context(alpha);
- LLPanel::draw();
- }
+
+ // Build rect for icon area in coord system of this panel
+ // Assumes layout_stack is a direct child of this panel
+ mMediaControlsStack->updateLayout();
+
+ // adjust for layout stack spacing
+ S32 space = mMediaControlsStack->getPanelSpacing() + 2;
+ LLRect controls_bg_area = mMediaControlsStack->getRect();
+
+ controls_bg_area.mTop += space + 2;
+
+ // adjust to ignore space from volume slider
+ controls_bg_area.mBottom += mVolumeSliderCtrl->getRect().getHeight();
+
+ // adjust to ignore space from left bookend padding
+ controls_bg_area.mLeft += mLeftBookend->getRect().getWidth() - space;
+
+ // ignore space from right bookend padding
+ controls_bg_area.mRight -= mRightBookend->getRect().getWidth() - space - 2;
+
+ // draw control background UI image
+
+ LLViewerObject* objectp = getTargetObject();
+ LLMediaEntry *media_data(0);
+
+ if( objectp )
+ media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
+
+ if( !dynamic_cast<LLVOVolume*>(objectp) || !media_data || dynamic_cast<LLVOVolume*>(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL) )
+ mBackgroundImage->draw( controls_bg_area, UI_VERTEX_COLOR % alpha);
+
+ // draw volume slider background UI image
+ if (mVolumeSliderCtrl->getVisible())
+ {
+ LLRect volume_slider_rect;
+ screenRectToLocal(mVolumeSliderCtrl->calcScreenRect(), &volume_slider_rect);
+ mVolumeSliderBackgroundImage->draw(volume_slider_rect, UI_VERTEX_COLOR % alpha);
+ }
+
+ {
+ LLViewDrawContext context(alpha);
+ LLPanel::draw();
+ }
}
BOOL LLPanelPrimMediaControls::handleScrollWheel(S32 x, S32 y, S32 clicks)
@@ -866,606 +866,606 @@ BOOL LLPanelPrimMediaControls::handleScrollHWheel(S32 x, S32 y, S32 clicks)
BOOL LLPanelPrimMediaControls::handleMouseDown(S32 x, S32 y, MASK mask)
{
- mInactivityTimer.start();
- return LLPanel::handleMouseDown(x, y, mask);
+ mInactivityTimer.start();
+ return LLPanel::handleMouseDown(x, y, mask);
}
BOOL LLPanelPrimMediaControls::handleMouseUp(S32 x, S32 y, MASK mask)
{
- mInactivityTimer.start();
- return LLPanel::handleMouseUp(x, y, mask);
+ mInactivityTimer.start();
+ return LLPanel::handleMouseUp(x, y, mask);
}
BOOL LLPanelPrimMediaControls::handleKeyHere( KEY key, MASK mask )
{
- mInactivityTimer.start();
- return LLPanel::handleKeyHere(key, mask);
+ mInactivityTimer.start();
+ return LLPanel::handleKeyHere(key, mask);
}
bool LLPanelPrimMediaControls::isMouseOver()
{
- bool result = false;
-
- if( getVisible() )
- {
- LLCoordWindow cursor_pos_window;
- LLCoordScreen cursor_pos_screen;
- LLCoordGL cursor_pos_gl;
- S32 x, y;
- getWindow()->getCursorPosition(&cursor_pos_window);
- cursor_pos_gl = cursor_pos_window.convert();
-
- if(mMediaControlsStack->getVisible())
- {
- mMediaControlsStack->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &x, &y);
-
- LLView *hit_child = mMediaControlsStack->childFromPoint(x, y);
- if(hit_child && hit_child->getVisible())
- {
- // This was useful for debugging both coordinate translation and view hieararchy problems...
- // LL_INFOS() << "mouse coords: " << x << ", " << y << " hit child " << hit_child->getName() << LL_ENDL;
-
- // This will be a direct child of the LLLayoutStack, which should be a layout_panel.
- // These may not shown/hidden by the logic in updateShape(), so we need to do another hit test on the children of the layout panel,
- // which are the actual controls.
- hit_child->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &x, &y);
-
- LLView *hit_child_2 = hit_child->childFromPoint(x, y);
- if(hit_child_2 && hit_child_2->getVisible())
- {
- // This was useful for debugging both coordinate translation and view hieararchy problems...
- // LL_INFOS() << " mouse coords: " << x << ", " << y << " hit child 2 " << hit_child_2->getName() << LL_ENDL;
- result = true;
- }
- }
- }
- }
-
- return result;
+ bool result = false;
+
+ if( getVisible() )
+ {
+ LLCoordWindow cursor_pos_window;
+ LLCoordScreen cursor_pos_screen;
+ LLCoordGL cursor_pos_gl;
+ S32 x, y;
+ getWindow()->getCursorPosition(&cursor_pos_window);
+ cursor_pos_gl = cursor_pos_window.convert();
+
+ if(mMediaControlsStack->getVisible())
+ {
+ mMediaControlsStack->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &x, &y);
+
+ LLView *hit_child = mMediaControlsStack->childFromPoint(x, y);
+ if(hit_child && hit_child->getVisible())
+ {
+ // This was useful for debugging both coordinate translation and view hieararchy problems...
+ // LL_INFOS() << "mouse coords: " << x << ", " << y << " hit child " << hit_child->getName() << LL_ENDL;
+
+ // This will be a direct child of the LLLayoutStack, which should be a layout_panel.
+ // These may not shown/hidden by the logic in updateShape(), so we need to do another hit test on the children of the layout panel,
+ // which are the actual controls.
+ hit_child->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &x, &y);
+
+ LLView *hit_child_2 = hit_child->childFromPoint(x, y);
+ if(hit_child_2 && hit_child_2->getVisible())
+ {
+ // This was useful for debugging both coordinate translation and view hieararchy problems...
+ // LL_INFOS() << " mouse coords: " << x << ", " << y << " hit child 2 " << hit_child_2->getName() << LL_ENDL;
+ result = true;
+ }
+ }
+ }
+ }
+
+ return result;
}
void LLPanelPrimMediaControls::onClickClose()
{
- close();
+ close();
}
void LLPanelPrimMediaControls::close()
{
- resetZoomLevel(true);
- LLViewerMediaFocus::getInstance()->clearFocus();
- setVisible(FALSE);
+ resetZoomLevel(true);
+ LLViewerMediaFocus::getInstance()->clearFocus();
+ setVisible(FALSE);
}
void LLPanelPrimMediaControls::onClickBack()
{
- focusOnTarget();
-
- LLViewerMediaImpl* impl =getTargetMediaImpl();
-
- if (impl)
- {
- impl->navigateBack();
- }
+ focusOnTarget();
+
+ LLViewerMediaImpl* impl =getTargetMediaImpl();
+
+ if (impl)
+ {
+ impl->navigateBack();
+ }
}
void LLPanelPrimMediaControls::onClickForward()
{
- focusOnTarget();
+ focusOnTarget();
- LLViewerMediaImpl* impl = getTargetMediaImpl();
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
- if (impl)
- {
- impl->navigateForward();
- }
+ if (impl)
+ {
+ impl->navigateForward();
+ }
}
void LLPanelPrimMediaControls::onClickHome()
{
- focusOnTarget();
+ focusOnTarget();
- LLViewerMediaImpl* impl = getTargetMediaImpl();
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
- if(impl)
- {
- impl->navigateHome();
- }
+ if(impl)
+ {
+ impl->navigateHome();
+ }
}
void LLPanelPrimMediaControls::onClickOpen()
{
- LLViewerMediaImpl* impl = getTargetMediaImpl();
- if(impl)
- {
- LLWeb::loadURL(impl->getCurrentMediaURL());
- }
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
+ if(impl)
+ {
+ LLWeb::loadURL(impl->getCurrentMediaURL());
+ }
}
void LLPanelPrimMediaControls::onClickReload()
{
- focusOnTarget();
+ focusOnTarget();
- //LLViewerMedia::navigateHome();
- LLViewerMediaImpl* impl = getTargetMediaImpl();
+ //LLViewerMedia::navigateHome();
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
- if(impl)
- {
- impl->navigateReload();
- }
+ if(impl)
+ {
+ impl->navigateReload();
+ }
}
void LLPanelPrimMediaControls::onClickPlay()
{
- focusOnTarget();
+ focusOnTarget();
- LLViewerMediaImpl* impl = getTargetMediaImpl();
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
- if(impl)
- {
- impl->play();
- }
+ if(impl)
+ {
+ impl->play();
+ }
}
void LLPanelPrimMediaControls::onClickPause()
{
- focusOnTarget();
+ focusOnTarget();
- LLViewerMediaImpl* impl = getTargetMediaImpl();
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
- if(impl)
- {
- impl->pause();
- }
+ if(impl)
+ {
+ impl->pause();
+ }
}
void LLPanelPrimMediaControls::onClickStop()
{
- focusOnTarget();
+ focusOnTarget();
- LLViewerMediaImpl* impl = getTargetMediaImpl();
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
- if(impl)
- {
- impl->navigateStop();
- }
+ if(impl)
+ {
+ impl->navigateStop();
+ }
}
void LLPanelPrimMediaControls::onClickMediaStop()
{
- focusOnTarget();
+ focusOnTarget();
- LLViewerMediaImpl* impl = getTargetMediaImpl();
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
- if(impl)
- {
- impl->stop();
- }
+ if(impl)
+ {
+ impl->stop();
+ }
}
void LLPanelPrimMediaControls::onClickSkipBack()
{
- focusOnTarget();
-
- LLViewerMediaImpl* impl =getTargetMediaImpl();
-
- if (impl)
- {
- impl->skipBack(mSkipStep);
- }
+ focusOnTarget();
+
+ LLViewerMediaImpl* impl =getTargetMediaImpl();
+
+ if (impl)
+ {
+ impl->skipBack(mSkipStep);
+ }
}
void LLPanelPrimMediaControls::onClickSkipForward()
{
- focusOnTarget();
+ focusOnTarget();
- LLViewerMediaImpl* impl = getTargetMediaImpl();
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
- if (impl)
- {
- impl->skipForward(mSkipStep);
- }
+ if (impl)
+ {
+ impl->skipForward(mSkipStep);
+ }
}
void LLPanelPrimMediaControls::onClickZoom()
{
- focusOnTarget();
-
- if(mCurrentZoom == ZOOM_NONE)
- {
- nextZoomLevel();
- }
+ focusOnTarget();
+
+ if(mCurrentZoom == ZOOM_NONE)
+ {
+ nextZoomLevel();
+ }
}
void LLPanelPrimMediaControls::nextZoomLevel()
{
- LLViewerObject* objectp = getTargetObject();
- if(objectp && objectp->isHUDAttachment())
- {
- // Never allow zooming on HUD attachments.
- return;
- }
-
- int index = 0;
- while (index < kNumZoomLevels)
- {
- if (kZoomLevels[index] == mCurrentZoom)
- {
- index++;
- break;
- }
- index++;
- }
- mCurrentZoom = kZoomLevels[index % kNumZoomLevels];
- updateZoom();
+ LLViewerObject* objectp = getTargetObject();
+ if(objectp && objectp->isHUDAttachment())
+ {
+ // Never allow zooming on HUD attachments.
+ return;
+ }
+
+ int index = 0;
+ while (index < kNumZoomLevels)
+ {
+ if (kZoomLevels[index] == mCurrentZoom)
+ {
+ index++;
+ break;
+ }
+ index++;
+ }
+ mCurrentZoom = kZoomLevels[index % kNumZoomLevels];
+ updateZoom();
}
void LLPanelPrimMediaControls::resetZoomLevel(bool reset_camera)
{
- if(mCurrentZoom != ZOOM_NONE)
- {
- mCurrentZoom = ZOOM_NONE;
- if(reset_camera)
- {
- updateZoom();
- }
- }
+ if(mCurrentZoom != ZOOM_NONE)
+ {
+ mCurrentZoom = ZOOM_NONE;
+ if(reset_camera)
+ {
+ updateZoom();
+ }
+ }
}
void LLPanelPrimMediaControls::updateZoom()
{
- F32 zoom_padding = 0.0f;
- switch (mCurrentZoom)
- {
- case ZOOM_NONE:
- {
- gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
- break;
- }
- case ZOOM_FAR:
- {
- zoom_padding = mZoomFarPadding;
- break;
- }
- case ZOOM_MEDIUM:
- {
- zoom_padding = mZoomMediumPadding;
- break;
- }
- case ZOOM_NEAR:
- {
- zoom_padding = mZoomNearPadding;
- break;
- }
- default:
- {
- gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
- break;
- }
- }
-
- if (zoom_padding > 0.0f)
- {
- // since we only zoom into medium for now, always set zoom_in constraint to true
- mZoomedCameraPos = LLViewerMediaFocus::setCameraZoom(getTargetObject(), mTargetObjectNormal, zoom_padding, true);
- }
-
- // Remember the object ID/face we zoomed into, so we can update the zoom icon appropriately
- mZoomObjectID = mTargetObjectID;
- mZoomObjectFace = mTargetObjectFace;
+ F32 zoom_padding = 0.0f;
+ switch (mCurrentZoom)
+ {
+ case ZOOM_NONE:
+ {
+ gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
+ break;
+ }
+ case ZOOM_FAR:
+ {
+ zoom_padding = mZoomFarPadding;
+ break;
+ }
+ case ZOOM_MEDIUM:
+ {
+ zoom_padding = mZoomMediumPadding;
+ break;
+ }
+ case ZOOM_NEAR:
+ {
+ zoom_padding = mZoomNearPadding;
+ break;
+ }
+ default:
+ {
+ gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
+ break;
+ }
+ }
+
+ if (zoom_padding > 0.0f)
+ {
+ // since we only zoom into medium for now, always set zoom_in constraint to true
+ mZoomedCameraPos = LLViewerMediaFocus::setCameraZoom(getTargetObject(), mTargetObjectNormal, zoom_padding, true);
+ }
+
+ // Remember the object ID/face we zoomed into, so we can update the zoom icon appropriately
+ mZoomObjectID = mTargetObjectID;
+ mZoomObjectFace = mTargetObjectFace;
}
void LLPanelPrimMediaControls::onScrollUp(void* user_data)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
- this_panel->focusOnTarget();
-
- LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
-
- if(impl)
- {
- impl->scrollWheel(0, 0, 0, -1, MASK_NONE);
- }
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
+ this_panel->focusOnTarget();
+
+ LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
+
+ if(impl)
+ {
+ impl->scrollWheel(0, 0, 0, -1, MASK_NONE);
+ }
}
void LLPanelPrimMediaControls::onScrollUpHeld(void* user_data)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
- this_panel->mScrollState = SCROLL_UP;
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
+ this_panel->mScrollState = SCROLL_UP;
}
void LLPanelPrimMediaControls::onScrollRight(void* user_data)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
- this_panel->focusOnTarget();
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
+ this_panel->focusOnTarget();
- LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
+ LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
- if(impl)
- {
- impl->scrollWheel(0, 0, -1, 0, MASK_NONE);
-// impl->handleKeyHere(KEY_RIGHT, MASK_NONE);
- }
+ if(impl)
+ {
+ impl->scrollWheel(0, 0, -1, 0, MASK_NONE);
+// impl->handleKeyHere(KEY_RIGHT, MASK_NONE);
+ }
}
void LLPanelPrimMediaControls::onScrollRightHeld(void* user_data)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
- this_panel->mScrollState = SCROLL_RIGHT;
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
+ this_panel->mScrollState = SCROLL_RIGHT;
}
void LLPanelPrimMediaControls::onScrollLeft(void* user_data)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
- this_panel->focusOnTarget();
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
+ this_panel->focusOnTarget();
- LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
+ LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
- if(impl)
- {
- impl->scrollWheel(0, 0, 1, 0, MASK_NONE);
-// impl->handleKeyHere(KEY_LEFT, MASK_NONE);
- }
+ if(impl)
+ {
+ impl->scrollWheel(0, 0, 1, 0, MASK_NONE);
+// impl->handleKeyHere(KEY_LEFT, MASK_NONE);
+ }
}
void LLPanelPrimMediaControls::onScrollLeftHeld(void* user_data)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
- this_panel->mScrollState = SCROLL_LEFT;
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
+ this_panel->mScrollState = SCROLL_LEFT;
}
void LLPanelPrimMediaControls::onScrollDown(void* user_data)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
- this_panel->focusOnTarget();
-
- LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
-
- if(impl)
- {
- impl->scrollWheel(0, 0, 0, 1, MASK_NONE);
- }
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
+ this_panel->focusOnTarget();
+
+ LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
+
+ if(impl)
+ {
+ impl->scrollWheel(0, 0, 0, 1, MASK_NONE);
+ }
}
void LLPanelPrimMediaControls::onScrollDownHeld(void* user_data)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
- this_panel->mScrollState = SCROLL_DOWN;
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
+ this_panel->mScrollState = SCROLL_DOWN;
}
void LLPanelPrimMediaControls::onScrollStop(void* user_data)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
- this_panel->mScrollState = SCROLL_NONE;
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
+ this_panel->mScrollState = SCROLL_NONE;
}
void LLPanelPrimMediaControls::onCommitURL()
{
- focusOnTarget();
-
- std::string url = mMediaAddress->getValue().asString();
- if(getTargetMediaImpl() && !url.empty())
- {
- getTargetMediaImpl()->navigateTo( url, "", true);
-
- // Make sure keyboard focus is set to the media focus object.
- gFocusMgr.setKeyboardFocus(LLViewerMediaFocus::getInstance());
-
- }
- mPauseFadeout = false;
- mFadeTimer.start();
+ focusOnTarget();
+
+ std::string url = mMediaAddress->getValue().asString();
+ if(getTargetMediaImpl() && !url.empty())
+ {
+ getTargetMediaImpl()->navigateTo( url, "", true);
+
+ // Make sure keyboard focus is set to the media focus object.
+ gFocusMgr.setKeyboardFocus(LLViewerMediaFocus::getInstance());
+
+ }
+ mPauseFadeout = false;
+ mFadeTimer.start();
}
void LLPanelPrimMediaControls::onInputURL(LLFocusableElement* caller, void *userdata)
{
- LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (userdata);
- this_panel->focusOnTarget();
+ LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (userdata);
+ this_panel->focusOnTarget();
+
+ this_panel->mPauseFadeout = true;
+ this_panel->mFadeTimer.stop();
+ this_panel->mFadeTimer.reset();
- this_panel->mPauseFadeout = true;
- this_panel->mFadeTimer.stop();
- this_panel->mFadeTimer.reset();
-
}
void LLPanelPrimMediaControls::setCurrentURL()
-{
+{
#ifdef USE_COMBO_BOX_FOR_MEDIA_URL
-// LLComboBox* media_address_combo = getChild<LLComboBox>("media_address_combo");
-// // redirects will navigate momentarily to about:blank, don't add to history
-// if (media_address_combo && mCurrentURL != "about:blank")
-// {
-// media_address_combo->remove(mCurrentURL);
-// media_address_combo->add(mCurrentURL);
-// media_address_combo->selectByValue(mCurrentURL);
-// }
+// LLComboBox* media_address_combo = getChild<LLComboBox>("media_address_combo");
+// // redirects will navigate momentarily to about:blank, don't add to history
+// if (media_address_combo && mCurrentURL != "about:blank")
+// {
+// media_address_combo->remove(mCurrentURL);
+// media_address_combo->add(mCurrentURL);
+// media_address_combo->selectByValue(mCurrentURL);
+// }
#else // USE_COMBO_BOX_FOR_MEDIA_URL
- if (mMediaAddress && mCurrentURL != "about:blank")
- {
- mMediaAddress->setValue(mCurrentURL);
- }
-#endif // USE_COMBO_BOX_FOR_MEDIA_URL
+ if (mMediaAddress && mCurrentURL != "about:blank")
+ {
+ mMediaAddress->setValue(mCurrentURL);
+ }
+#endif // USE_COMBO_BOX_FOR_MEDIA_URL
}
void LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseDown()
{
- mMediaPlaySliderCtrlMouseDownValue = mMediaPlaySliderCtrl->getValue().asReal();
+ mMediaPlaySliderCtrlMouseDownValue = mMediaPlaySliderCtrl->getValue().asReal();
- mUpdateSlider = false;
+ mUpdateSlider = false;
}
void LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseUp()
{
- F64 cur_value = mMediaPlaySliderCtrl->getValue().asReal();
-
- if (mMediaPlaySliderCtrlMouseDownValue != cur_value)
- {
- focusOnTarget();
-
- LLViewerMediaImpl* media_impl = getTargetMediaImpl();
- if (media_impl)
- {
- if (cur_value <= 0.0)
- {
- media_impl->stop();
- }
- else
- {
- media_impl->seek(cur_value * mMovieDuration);
- }
- }
-
- mUpdateSlider = true;
- }
+ F64 cur_value = mMediaPlaySliderCtrl->getValue().asReal();
+
+ if (mMediaPlaySliderCtrlMouseDownValue != cur_value)
+ {
+ focusOnTarget();
+
+ LLViewerMediaImpl* media_impl = getTargetMediaImpl();
+ if (media_impl)
+ {
+ if (cur_value <= 0.0)
+ {
+ media_impl->stop();
+ }
+ else
+ {
+ media_impl->seek(cur_value * mMovieDuration);
+ }
+ }
+
+ mUpdateSlider = true;
+ }
}
void LLPanelPrimMediaControls::onCommitVolumeUp()
{
- focusOnTarget();
-
- LLViewerMediaImpl* media_impl = getTargetMediaImpl();
- if (media_impl)
- {
- F32 volume = media_impl->getVolume();
-
- volume += 0.1f;
- if(volume >= 1.0f)
- {
- volume = 1.0f;
- }
-
- media_impl->setVolume(volume);
- mMuteBtn->setToggleState(false);
- }
-}
+ focusOnTarget();
+
+ LLViewerMediaImpl* media_impl = getTargetMediaImpl();
+ if (media_impl)
+ {
+ F32 volume = media_impl->getVolume();
+
+ volume += 0.1f;
+ if(volume >= 1.0f)
+ {
+ volume = 1.0f;
+ }
+
+ media_impl->setVolume(volume);
+ mMuteBtn->setToggleState(false);
+ }
+}
void LLPanelPrimMediaControls::onCommitVolumeDown()
{
- focusOnTarget();
-
- LLViewerMediaImpl* media_impl = getTargetMediaImpl();
- if (media_impl)
- {
- F32 volume = media_impl->getVolume();
-
- volume -= 0.1f;
- if(volume <= 0.0f)
- {
- volume = 0.0f;
- }
-
- media_impl->setVolume(volume);
- mMuteBtn->setToggleState(false);
- }
-}
+ focusOnTarget();
+
+ LLViewerMediaImpl* media_impl = getTargetMediaImpl();
+ if (media_impl)
+ {
+ F32 volume = media_impl->getVolume();
+
+ volume -= 0.1f;
+ if(volume <= 0.0f)
+ {
+ volume = 0.0f;
+ }
+
+ media_impl->setVolume(volume);
+ mMuteBtn->setToggleState(false);
+ }
+}
void LLPanelPrimMediaControls::onCommitVolumeSlider()
{
- focusOnTarget();
+ focusOnTarget();
- LLViewerMediaImpl* media_impl = getTargetMediaImpl();
- if (media_impl)
- {
- media_impl->setVolume(mVolumeSliderCtrl->getValueF32());
- }
+ LLViewerMediaImpl* media_impl = getTargetMediaImpl();
+ if (media_impl)
+ {
+ media_impl->setVolume(mVolumeSliderCtrl->getValueF32());
+ }
}
void LLPanelPrimMediaControls::onToggleMute()
{
- focusOnTarget();
-
- LLViewerMediaImpl* media_impl = getTargetMediaImpl();
- if (media_impl)
- {
- F32 volume = media_impl->getVolume();
-
- if(volume > 0.0)
- {
- media_impl->setVolume(0.0);
- }
- else if (mVolumeSliderCtrl->getValueF32() == 0.0)
- {
- media_impl->setVolume(1.0);
- mVolumeSliderCtrl->setValue(1.0);
- }
- else
- {
- media_impl->setVolume(mVolumeSliderCtrl->getValueF32());
- }
- }
+ focusOnTarget();
+
+ LLViewerMediaImpl* media_impl = getTargetMediaImpl();
+ if (media_impl)
+ {
+ F32 volume = media_impl->getVolume();
+
+ if(volume > 0.0)
+ {
+ media_impl->setVolume(0.0);
+ }
+ else if (mVolumeSliderCtrl->getValueF32() == 0.0)
+ {
+ media_impl->setVolume(1.0);
+ mVolumeSliderCtrl->setValue(1.0);
+ }
+ else
+ {
+ media_impl->setVolume(mVolumeSliderCtrl->getValueF32());
+ }
+ }
}
void LLPanelPrimMediaControls::showVolumeSlider()
{
- mVolumeSliderVisible++;
+ mVolumeSliderVisible++;
}
void LLPanelPrimMediaControls::hideVolumeSlider()
{
- mVolumeSliderVisible--;
+ mVolumeSliderVisible--;
}
bool LLPanelPrimMediaControls::shouldVolumeSliderBeVisible()
{
- return mVolumeSliderVisible > 0;
+ return mVolumeSliderVisible > 0;
}
bool LLPanelPrimMediaControls::isZoomDistExceeding()
{
- return (gAgentCamera.getCameraPositionGlobal() - mZoomedCameraPos).normalize() >= EXCEEDING_ZOOM_DISTANCE;
+ return (gAgentCamera.getCameraPositionGlobal() - mZoomedCameraPos).normalize() >= EXCEEDING_ZOOM_DISTANCE;
}
void LLPanelPrimMediaControls::clearFaceOnFade()
{
- if(mClearFaceOnFade)
- {
- // Hiding this object makes scroll events go missing after it fades out
- // (see DEV-41755 for a full description of the train wreck).
- // Only hide the controls when we're untargeting.
- setVisible(FALSE);
-
- mClearFaceOnFade = false;
- mVolumeSliderVisible = 0;
- mTargetImplID = LLUUID::null;
- mTargetObjectID = LLUUID::null;
- mTargetObjectFace = 0;
- }
+ if(mClearFaceOnFade)
+ {
+ // Hiding this object makes scroll events go missing after it fades out
+ // (see DEV-41755 for a full description of the train wreck).
+ // Only hide the controls when we're untargeting.
+ setVisible(FALSE);
+
+ mClearFaceOnFade = false;
+ mVolumeSliderVisible = 0;
+ mTargetImplID = LLUUID::null;
+ mTargetObjectID = LLUUID::null;
+ mTargetObjectFace = 0;
+ }
}
void LLPanelPrimMediaControls::onMouselookModeIn()
{
- LLViewerMediaFocus::getInstance()->clearHover();
- mHideImmediately = true;
+ LLViewerMediaFocus::getInstance()->clearHover();
+ mHideImmediately = true;
}
void LLPanelPrimMediaControls::showNotification(LLNotificationPtr notify)
{
- delete mWindowShade;
- LLWindowShade::Params params;
- params.rect = mMediaRegion->getLocalRect();
- params.follows.flags = FOLLOWS_ALL;
-
- //HACK: don't hardcode this
- if (notify->getIcon() == "Popup_Caution")
- {
- params.bg_image.name = "Yellow_Gradient";
- params.text_color = LLColor4::black;
- }
- else
- {
- //HACK: make this a property of the notification itself, "cancellable"
- params.can_close = false;
- params.text_color.control = "LabelTextColor";
- }
-
- mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
-
- mMediaRegion->addChild(mWindowShade);
- mWindowShade->show(notify);
+ delete mWindowShade;
+ LLWindowShade::Params params;
+ params.rect = mMediaRegion->getLocalRect();
+ params.follows.flags = FOLLOWS_ALL;
+
+ //HACK: don't hardcode this
+ if (notify->getIcon() == "Popup_Caution")
+ {
+ params.bg_image.name = "Yellow_Gradient";
+ params.text_color = LLColor4::black;
+ }
+ else
+ {
+ //HACK: make this a property of the notification itself, "cancellable"
+ params.can_close = false;
+ params.text_color.control = "LabelTextColor";
+ }
+
+ mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
+
+ mMediaRegion->addChild(mWindowShade);
+ mWindowShade->show(notify);
}
void LLPanelPrimMediaControls::hideNotification()
{
- if (mWindowShade)
- {
- mWindowShade->hide();
- }
+ if (mWindowShade)
+ {
+ mWindowShade->hide();
+ }
}
diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h
index dd0e4ff095..fa7cc81873 100644
--- a/indra/newview/llpanelprimmediacontrols.h
+++ b/indra/newview/llpanelprimmediacontrols.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelprimmediacontrols.h
* @brief Pop-up media controls panel
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,191 +44,191 @@ class LLLineEditor;
class LLPanelPrimMediaControls : public LLPanel
{
public:
- LLPanelPrimMediaControls();
- virtual ~LLPanelPrimMediaControls();
- /*virtual*/ BOOL postBuild();
- virtual void draw();
- virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
- virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks);
-
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleKeyHere(KEY key, MASK mask);
-
- void updateShape();
- bool isMouseOver();
-
- void showNotification(LLNotificationPtr notify);
- void hideNotification();
-
-
- enum EZoomLevel
- {
- ZOOM_NONE = 0,
- ZOOM_FAR,
- ZOOM_MEDIUM,
- ZOOM_NEAR
- };
-
- EZoomLevel getZoomLevel() const { return mCurrentZoom; }
- void nextZoomLevel();
- void resetZoomLevel(bool reset_camera = true);
- void close();
-
- LLHandle<LLPanelPrimMediaControls> getHandle() const { return mPanelHandle; }
- void setMediaFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
-
-
- static const EZoomLevel kZoomLevels[];
- static const int kNumZoomLevels;
-
- enum EScrollDir
- {
- SCROLL_UP = 0,
- SCROLL_DOWN,
- SCROLL_LEFT,
- SCROLL_RIGHT,
- SCROLL_NONE
- };
+ LLPanelPrimMediaControls();
+ virtual ~LLPanelPrimMediaControls();
+ /*virtual*/ BOOL postBuild();
+ virtual void draw();
+ virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+ virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks);
+
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
+
+ void updateShape();
+ bool isMouseOver();
+
+ void showNotification(LLNotificationPtr notify);
+ void hideNotification();
+
+
+ enum EZoomLevel
+ {
+ ZOOM_NONE = 0,
+ ZOOM_FAR,
+ ZOOM_MEDIUM,
+ ZOOM_NEAR
+ };
+
+ EZoomLevel getZoomLevel() const { return mCurrentZoom; }
+ void nextZoomLevel();
+ void resetZoomLevel(bool reset_camera = true);
+ void close();
+
+ LLHandle<LLPanelPrimMediaControls> getHandle() const { return mPanelHandle; }
+ void setMediaFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
+
+
+ static const EZoomLevel kZoomLevels[];
+ static const int kNumZoomLevels;
+
+ enum EScrollDir
+ {
+ SCROLL_UP = 0,
+ SCROLL_DOWN,
+ SCROLL_LEFT,
+ SCROLL_RIGHT,
+ SCROLL_NONE
+ };
private:
- void onClickClose();
- void onClickBack();
- void onClickForward();
- void onClickHome();
- void onClickOpen();
- void onClickReload();
- void onClickPlay();
- void onClickPause();
- void onClickStop();
- void onClickZoom();
- void onClickSkipBack();
- void onClickSkipForward();
- void onClickMediaStop();
- void onCommitURL();
-
- void updateZoom();
- void setCurrentURL();
-
- void onMediaPlaySliderCtrlMouseDown();
- void onMediaPlaySliderCtrlMouseUp();
-
- void onCommitVolumeUp();
- void onCommitVolumeDown();
- void onCommitVolumeSlider();
- void onToggleMute();
- void showVolumeSlider();
- void hideVolumeSlider();
- bool shouldVolumeSliderBeVisible();
-
- bool isZoomDistExceeding();
-
- static void onScrollUp(void* user_data);
- static void onScrollUpHeld(void* user_data);
- static void onScrollLeft(void* user_data);
- static void onScrollLeftHeld(void* user_data);
- static void onScrollRight(void* user_data);
- static void onScrollRightHeld(void* user_data);
- static void onScrollDown(void* user_data);
- static void onScrollDownHeld(void* user_data);
- static void onScrollStop(void* user_data);
-
- static void onInputURL(LLFocusableElement* caller, void *userdata);
- static bool hasControlsPermission(LLViewerObject *obj, const LLMediaEntry *media_entry);
-
- void focusOnTarget();
-
- LLViewerMediaImpl* getTargetMediaImpl();
- LLViewerObject* getTargetObject();
- LLPluginClassMedia* getTargetMediaPlugin();
-
+ void onClickClose();
+ void onClickBack();
+ void onClickForward();
+ void onClickHome();
+ void onClickOpen();
+ void onClickReload();
+ void onClickPlay();
+ void onClickPause();
+ void onClickStop();
+ void onClickZoom();
+ void onClickSkipBack();
+ void onClickSkipForward();
+ void onClickMediaStop();
+ void onCommitURL();
+
+ void updateZoom();
+ void setCurrentURL();
+
+ void onMediaPlaySliderCtrlMouseDown();
+ void onMediaPlaySliderCtrlMouseUp();
+
+ void onCommitVolumeUp();
+ void onCommitVolumeDown();
+ void onCommitVolumeSlider();
+ void onToggleMute();
+ void showVolumeSlider();
+ void hideVolumeSlider();
+ bool shouldVolumeSliderBeVisible();
+
+ bool isZoomDistExceeding();
+
+ static void onScrollUp(void* user_data);
+ static void onScrollUpHeld(void* user_data);
+ static void onScrollLeft(void* user_data);
+ static void onScrollLeftHeld(void* user_data);
+ static void onScrollRight(void* user_data);
+ static void onScrollRightHeld(void* user_data);
+ static void onScrollDown(void* user_data);
+ static void onScrollDownHeld(void* user_data);
+ static void onScrollStop(void* user_data);
+
+ static void onInputURL(LLFocusableElement* caller, void *userdata);
+ static bool hasControlsPermission(LLViewerObject *obj, const LLMediaEntry *media_entry);
+
+ void focusOnTarget();
+
+ LLViewerMediaImpl* getTargetMediaImpl();
+ LLViewerObject* getTargetObject();
+ LLPluginClassMedia* getTargetMediaPlugin();
+
private:
- void clearFaceOnFade();
-
- void onMouselookModeIn();
-
- LLView *mMediaRegion;
- LLUICtrl *mBackCtrl;
- LLUICtrl *mFwdCtrl;
- LLUICtrl *mReloadCtrl;
- LLUICtrl *mPlayCtrl;
- LLUICtrl *mPauseCtrl;
- LLUICtrl *mStopCtrl;
- LLUICtrl *mMediaStopCtrl;
- LLUICtrl *mHomeCtrl;
- LLUICtrl *mUnzoomCtrl;
- LLUICtrl *mOpenCtrl;
- LLUICtrl *mSkipBackCtrl;
- LLUICtrl *mSkipFwdCtrl;
- LLUICtrl *mZoomCtrl;
- LLPanel *mMediaProgressPanel;
- LLProgressBar *mMediaProgressBar;
- LLUICtrl *mMediaAddressCtrl;
- LLLineEditor *mMediaAddress;
- LLUICtrl *mMediaPlaySliderPanel;
- LLUICtrl *mMediaPlaySliderCtrl;
- LLUICtrl *mVolumeCtrl;
- LLButton *mMuteBtn;
- LLSliderCtrl *mVolumeSliderCtrl;
- LLIconCtrl *mWhitelistIcon;
- LLIconCtrl *mSecureLockIcon;
- LLLayoutStack *mMediaControlsStack;
- LLUICtrl *mLeftBookend;
- LLUICtrl *mRightBookend;
- LLUIImage* mBackgroundImage;
- LLUIImage* mVolumeSliderBackgroundImage;
- LLWindowShade* mWindowShade;
- F32 mSkipStep;
- S32 mMinWidth;
- S32 mMinHeight;
- F32 mZoomNearPadding;
- F32 mZoomMediumPadding;
- F32 mZoomFarPadding;
- S32 mTopWorldViewAvoidZone;
-
- LLVector3d mZoomedCameraPos;
-
- LLUICtrl *mMediaPanelScroll;
- LLButton *mScrollUpCtrl;
- LLButton *mScrollLeftCtrl;
- LLButton *mScrollRightCtrl;
- LLButton *mScrollDownCtrl;
-
- bool mPauseFadeout;
- bool mUpdateSlider;
- bool mClearFaceOnFade;
- bool mHideImmediately;
+ void clearFaceOnFade();
+
+ void onMouselookModeIn();
+
+ LLView *mMediaRegion;
+ LLUICtrl *mBackCtrl;
+ LLUICtrl *mFwdCtrl;
+ LLUICtrl *mReloadCtrl;
+ LLUICtrl *mPlayCtrl;
+ LLUICtrl *mPauseCtrl;
+ LLUICtrl *mStopCtrl;
+ LLUICtrl *mMediaStopCtrl;
+ LLUICtrl *mHomeCtrl;
+ LLUICtrl *mUnzoomCtrl;
+ LLUICtrl *mOpenCtrl;
+ LLUICtrl *mSkipBackCtrl;
+ LLUICtrl *mSkipFwdCtrl;
+ LLUICtrl *mZoomCtrl;
+ LLPanel *mMediaProgressPanel;
+ LLProgressBar *mMediaProgressBar;
+ LLUICtrl *mMediaAddressCtrl;
+ LLLineEditor *mMediaAddress;
+ LLUICtrl *mMediaPlaySliderPanel;
+ LLUICtrl *mMediaPlaySliderCtrl;
+ LLUICtrl *mVolumeCtrl;
+ LLButton *mMuteBtn;
+ LLSliderCtrl *mVolumeSliderCtrl;
+ LLIconCtrl *mWhitelistIcon;
+ LLIconCtrl *mSecureLockIcon;
+ LLLayoutStack *mMediaControlsStack;
+ LLUICtrl *mLeftBookend;
+ LLUICtrl *mRightBookend;
+ LLUIImage* mBackgroundImage;
+ LLUIImage* mVolumeSliderBackgroundImage;
+ LLWindowShade* mWindowShade;
+ F32 mSkipStep;
+ S32 mMinWidth;
+ S32 mMinHeight;
+ F32 mZoomNearPadding;
+ F32 mZoomMediumPadding;
+ F32 mZoomFarPadding;
+ S32 mTopWorldViewAvoidZone;
+
+ LLVector3d mZoomedCameraPos;
+
+ LLUICtrl *mMediaPanelScroll;
+ LLButton *mScrollUpCtrl;
+ LLButton *mScrollLeftCtrl;
+ LLButton *mScrollRightCtrl;
+ LLButton *mScrollDownCtrl;
+
+ bool mPauseFadeout;
+ bool mUpdateSlider;
+ bool mClearFaceOnFade;
+ bool mHideImmediately;
bool mSecureURL;
- LLMatrix4 mLastCameraMat;
- EZoomLevel mCurrentZoom;
- EScrollDir mScrollState;
- LLCoordWindow mLastCursorPos;
- LLFrameTimer mInactivityTimer;
- LLFrameTimer mFadeTimer;
- F32 mInactiveTimeout;
- F32 mControlFadeTime;
- LLRootHandle<LLPanelPrimMediaControls> mPanelHandle;
- F32 mAlpha;
- std::string mCurrentURL;
- std::string mPreviousURL;
- F64 mCurrentRate;
- F64 mMovieDuration;
-
- LLUUID mTargetObjectID;
- S32 mTargetObjectFace;
- LLUUID mTargetImplID;
- LLVector3 mTargetObjectNormal;
-
- LLUUID mZoomObjectID;
- S32 mZoomObjectFace;
-
- S32 mVolumeSliderVisible;
-
- LLNotificationPtr mActiveNotification;
-
- F64 mMediaPlaySliderCtrlMouseDownValue;
+ LLMatrix4 mLastCameraMat;
+ EZoomLevel mCurrentZoom;
+ EScrollDir mScrollState;
+ LLCoordWindow mLastCursorPos;
+ LLFrameTimer mInactivityTimer;
+ LLFrameTimer mFadeTimer;
+ F32 mInactiveTimeout;
+ F32 mControlFadeTime;
+ LLRootHandle<LLPanelPrimMediaControls> mPanelHandle;
+ F32 mAlpha;
+ std::string mCurrentURL;
+ std::string mPreviousURL;
+ F64 mCurrentRate;
+ F64 mMovieDuration;
+
+ LLUUID mTargetObjectID;
+ S32 mTargetObjectFace;
+ LLUUID mTargetImplID;
+ LLVector3 mTargetObjectNormal;
+
+ LLUUID mZoomObjectID;
+ S32 mZoomObjectFace;
+
+ S32 mVolumeSliderVisible;
+
+ LLNotificationPtr mActiveNotification;
+
+ F64 mMediaPlaySliderCtrlMouseDownValue;
};
#endif // LL_PANELPRIMMEDIACONTROLS_H
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 8114e05a94..7f501661df 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -322,7 +322,7 @@ LLUUID post_profile_image(std::string cap_url, const LLSD &first_data, std::stri
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
httpOpts->setFollowRedirects(true);
-
+
LLSD result = httpAdapter->postAndSuspend(httpRequest, cap_url, first_data, httpOpts, httpHeaders);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
@@ -472,22 +472,22 @@ void post_profile_image_coro(std::string cap_url, EProfileImageType type, std::s
class LLProfileHandler : public LLCommandHandler
{
public:
- // requires trusted browser to trigger
- LLProfileHandler() : LLCommandHandler("profile", UNTRUSTED_THROTTLE) { }
+ // requires trusted browser to trigger
+ LLProfileHandler() : LLCommandHandler("profile", UNTRUSTED_THROTTLE) { }
- bool handle(const LLSD& params,
+ bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- if (params.size() < 1) return false;
- std::string agent_name = params[0];
- LL_INFOS() << "Profile, agent_name " << agent_name << LL_ENDL;
- std::string url = getProfileURL(agent_name);
- LLWeb::loadURLInternal(url);
-
- return true;
- }
+ {
+ if (params.size() < 1) return false;
+ std::string agent_name = params[0];
+ LL_INFOS() << "Profile, agent_name " << agent_name << LL_ENDL;
+ std::string url = getProfileURL(agent_name);
+ LLWeb::loadURLInternal(url);
+
+ return true;
+ }
};
LLProfileHandler gProfileHandler;
@@ -498,8 +498,8 @@ LLProfileHandler gProfileHandler;
class LLAgentHandler : public LLCommandHandler
{
public:
- // requires trusted browser to trigger
- LLAgentHandler() : LLCommandHandler("agent", UNTRUSTED_THROTTLE) { }
+ // requires trusted browser to trigger
+ LLAgentHandler() : LLCommandHandler("agent", UNTRUSTED_THROTTLE) { }
virtual bool canHandleUntrusted(
const LLSD& params,
@@ -526,111 +526,111 @@ public:
return false;
}
- bool handle(const LLSD& params,
+ bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- if (params.size() < 2) return false;
- LLUUID avatar_id;
- if (!avatar_id.set(params[0], FALSE))
- {
- return false;
- }
-
- const std::string verb = params[1].asString();
- if (verb == "about")
- {
- LLAvatarActions::showProfile(avatar_id);
- return true;
- }
-
- if (verb == "inspect")
- {
- LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
- return true;
- }
-
- if (verb == "im")
- {
- LLAvatarActions::startIM(avatar_id);
- return true;
- }
-
- if (verb == "pay")
- {
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAvatarPay"))
- {
- LLNotificationsUtil::add("NoAvatarPay", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
-
- LLAvatarActions::pay(avatar_id);
- return true;
- }
-
- if (verb == "offerteleport")
- {
- LLAvatarActions::offerTeleport(avatar_id);
- return true;
- }
-
- if (verb == "requestfriend")
- {
- LLAvatarActions::requestFriendshipDialog(avatar_id);
- return true;
- }
-
- if (verb == "removefriend")
- {
- LLAvatarActions::removeFriendDialog(avatar_id);
- return true;
- }
-
- if (verb == "mute")
- {
- if (! LLAvatarActions::isBlocked(avatar_id))
- {
- LLAvatarActions::toggleBlock(avatar_id);
- }
- return true;
- }
-
- if (verb == "unmute")
- {
- if (LLAvatarActions::isBlocked(avatar_id))
- {
- LLAvatarActions::toggleBlock(avatar_id);
- }
- return true;
- }
-
- if (verb == "block")
- {
- if (params.size() > 2)
- {
- const std::string object_name = LLURI::unescape(params[2].asString());
- LLMute mute(avatar_id, object_name, LLMute::OBJECT);
- LLMuteList::getInstance()->add(mute);
- LLPanelBlockedList::showPanelAndSelect(mute.mID);
- }
- return true;
- }
-
- if (verb == "unblock")
- {
- if (params.size() > 2)
- {
- const std::string object_name = params[2].asString();
- LLMute mute(avatar_id, object_name, LLMute::OBJECT);
- LLMuteList::getInstance()->remove(mute);
- }
- return true;
- }
+ {
+ if (params.size() < 2) return false;
+ LLUUID avatar_id;
+ if (!avatar_id.set(params[0], FALSE))
+ {
+ return false;
+ }
+
+ const std::string verb = params[1].asString();
+ if (verb == "about")
+ {
+ LLAvatarActions::showProfile(avatar_id);
+ return true;
+ }
+
+ if (verb == "inspect")
+ {
+ LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
+ return true;
+ }
+
+ if (verb == "im")
+ {
+ LLAvatarActions::startIM(avatar_id);
+ return true;
+ }
+
+ if (verb == "pay")
+ {
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAvatarPay"))
+ {
+ LLNotificationsUtil::add("NoAvatarPay", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ LLAvatarActions::pay(avatar_id);
+ return true;
+ }
+
+ if (verb == "offerteleport")
+ {
+ LLAvatarActions::offerTeleport(avatar_id);
+ return true;
+ }
+
+ if (verb == "requestfriend")
+ {
+ LLAvatarActions::requestFriendshipDialog(avatar_id);
+ return true;
+ }
+
+ if (verb == "removefriend")
+ {
+ LLAvatarActions::removeFriendDialog(avatar_id);
+ return true;
+ }
+
+ if (verb == "mute")
+ {
+ if (! LLAvatarActions::isBlocked(avatar_id))
+ {
+ LLAvatarActions::toggleBlock(avatar_id);
+ }
+ return true;
+ }
+
+ if (verb == "unmute")
+ {
+ if (LLAvatarActions::isBlocked(avatar_id))
+ {
+ LLAvatarActions::toggleBlock(avatar_id);
+ }
+ return true;
+ }
+
+ if (verb == "block")
+ {
+ if (params.size() > 2)
+ {
+ const std::string object_name = LLURI::unescape(params[2].asString());
+ LLMute mute(avatar_id, object_name, LLMute::OBJECT);
+ LLMuteList::getInstance()->add(mute);
+ LLPanelBlockedList::showPanelAndSelect(mute.mID);
+ }
+ return true;
+ }
+
+ if (verb == "unblock")
+ {
+ if (params.size() > 2)
+ {
+ const std::string object_name = params[2].asString();
+ LLMute mute(avatar_id, object_name, LLMute::OBJECT);
+ LLMuteList::getInstance()->remove(mute);
+ }
+ return true;
+ }
// reportAbuse is here due to convoluted avatar handling
// in LLScrollListCtrl and LLTextBase
- if (verb == "reportAbuse" && web == NULL)
+ if (verb == "reportAbuse" && web == NULL)
{
LLAvatarName av_name;
if (LLAvatarNameCache::get(avatar_id, &av_name))
@@ -643,8 +643,8 @@ public:
}
return true;
}
- return false;
- }
+ return false;
+ }
};
LLAgentHandler gAgentHandler;
@@ -690,7 +690,7 @@ private:
bool mHasUnsavedPermChanges;
LLHandle<LLView> mOwnerHandle;
- boost::signals2::connection mAvatarNameCacheConnection;
+ boost::signals2::connection mAvatarNameCacheConnection;
};
LLFloaterProfilePermissions::LLFloaterProfilePermissions(LLView * owner, const LLUUID &avatar_id)
@@ -2689,12 +2689,12 @@ void LLPanelProfile::showPick(const LLUUID& pick_id)
bool LLPanelProfile::isPickTabSelected()
{
- return (mTabContainer->getCurrentPanel() == mPanelPicks);
+ return (mTabContainer->getCurrentPanel() == mPanelPicks);
}
bool LLPanelProfile::isNotesTabSelected()
{
- return (mTabContainer->getCurrentPanel() == mPanelNotes);
+ return (mTabContainer->getCurrentPanel() == mPanelNotes);
}
bool LLPanelProfile::hasUnsavedChanges()
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index 11632a10ae..6007d95022 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -68,38 +68,38 @@ class LLViewerFetchedTexture;
* Panel for displaying Avatar's second life related info.
*/
class LLPanelProfileSecondLife
- : public LLPanelProfileTab
- , public LLFriendObserver
- , public LLVoiceClientStatusObserver
+ : public LLPanelProfileTab
+ , public LLFriendObserver
+ , public LLVoiceClientStatusObserver
{
public:
- LLPanelProfileSecondLife();
- /*virtual*/ ~LLPanelProfileSecondLife();
+ LLPanelProfileSecondLife();
+ /*virtual*/ ~LLPanelProfileSecondLife();
- void onOpen(const LLSD& key) override;
+ void onOpen(const LLSD& key) override;
- /**
- * LLFriendObserver trigger
- */
- void changed(U32 mask) override;
+ /**
+ * LLFriendObserver trigger
+ */
+ void changed(U32 mask) override;
- // Implements LLVoiceClientStatusObserver::onChange() to enable the call
- // button when voice is available
- void onChange(EStatusType status, const std::string &channelURI, bool proximal) override;
+ // Implements LLVoiceClientStatusObserver::onChange() to enable the call
+ // button when voice is available
+ void onChange(EStatusType status, const std::string &channelURI, bool proximal) override;
- void setAvatarId(const LLUUID& avatar_id) override;
+ void setAvatarId(const LLUUID& avatar_id) override;
- BOOL postBuild() override;
+ BOOL postBuild() override;
- void resetData() override;
+ void resetData() override;
- /**
- * Sends update data request to server.
- */
- void updateData() override;
+ /**
+ * Sends update data request to server.
+ */
+ void updateData() override;
void refreshName();
- void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
void setProfileImageUploading(bool loading);
void setProfileImageUploaded(const LLUUID &image_asset_id);
@@ -110,30 +110,30 @@ public:
friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id);
protected:
- /**
- * Process profile related data received from server.
- */
- void processProfileProperties(const LLAvatarData* avatar_data);
-
- /**
- * Processes group related data received from server.
- */
- void processGroupProperties(const LLAvatarGroups* avatar_groups);
-
- /**
- * Fills common for Avatar profile and My Profile fields.
- */
- void fillCommonData(const LLAvatarData* avatar_data);
-
- /**
- * Fills partner data.
- */
- void fillPartnerData(const LLAvatarData* avatar_data);
-
- /**
- * Fills account status.
- */
- void fillAccountStatus(const LLAvatarData* avatar_data);
+ /**
+ * Process profile related data received from server.
+ */
+ void processProfileProperties(const LLAvatarData* avatar_data);
+
+ /**
+ * Processes group related data received from server.
+ */
+ void processGroupProperties(const LLAvatarGroups* avatar_groups);
+
+ /**
+ * Fills common for Avatar profile and My Profile fields.
+ */
+ void fillCommonData(const LLAvatarData* avatar_data);
+
+ /**
+ * Fills partner data.
+ */
+ void fillPartnerData(const LLAvatarData* avatar_data);
+
+ /**
+ * Fills account status.
+ */
+ void fillAccountStatus(const LLAvatarData* avatar_data);
/**
* Sets permissions specific icon
@@ -154,27 +154,27 @@ protected:
BOOL final,
void* userdata);
- /**
- * Displays avatar's online status if possible.
- *
- * Requirements from EXT-3880:
- * For friends:
- * - Online when online and privacy settings allow to show
- * - Offline when offline and privacy settings allow to show
- * - Else: nothing
- * For other avatars:
- * - Online when online and was not set in Preferences/"Only Friends & Groups can see when I am online"
- * - Else: Offline
- */
- void updateOnlineStatus();
- void processOnlineStatus(bool is_friend, bool show_online, bool online);
+ /**
+ * Displays avatar's online status if possible.
+ *
+ * Requirements from EXT-3880:
+ * For friends:
+ * - Online when online and privacy settings allow to show
+ * - Offline when offline and privacy settings allow to show
+ * - Else: nothing
+ * For other avatars:
+ * - Online when online and was not set in Preferences/"Only Friends & Groups can see when I am online"
+ * - Else: Offline
+ */
+ void updateOnlineStatus();
+ void processOnlineStatus(bool is_friend, bool show_online, bool online);
private:
void setLoaded() override;
void onCommitMenu(const LLSD& userdata);
bool onEnableMenu(const LLSD& userdata);
bool onCheckMenu(const LLSD& userdata);
- void onAvatarNameCacheSetName(const LLUUID& id, const LLAvatarName& av_name);
+ void onAvatarNameCacheSetName(const LLUUID& id, const LLAvatarName& av_name);
void setDescriptionText(const std::string &text);
void onSetDescriptionDirty();
@@ -187,37 +187,37 @@ private:
void onCommitProfileImage(const LLUUID& id);
private:
- typedef std::map<std::string, LLUUID> group_map_t;
- group_map_t mGroups;
- void openGroupProfile();
-
- LLGroupList* mGroupList;
- LLComboBox* mShowInSearchCombo;
- LLThumbnailCtrl* mSecondLifePic;
- LLPanel* mSecondLifePicLayout;
- LLTextEditor* mDescriptionEdit;
- LLMenuButton* mAgentActionMenuButton;
- LLButton* mSaveDescriptionChanges;
- LLButton* mDiscardDescriptionChanges;
- LLIconCtrl* mCanSeeOnlineIcon;
- LLIconCtrl* mCantSeeOnlineIcon;
- LLIconCtrl* mCanSeeOnMapIcon;
- LLIconCtrl* mCantSeeOnMapIcon;
- LLIconCtrl* mCanEditObjectsIcon;
- LLIconCtrl* mCantEditObjectsIcon;
-
- LLHandle<LLFloater> mFloaterPermissionsHandle;
- LLHandle<LLFloater> mFloaterProfileTextureHandle;
- LLHandle<LLFloater> mFloaterTexturePickerHandle;
-
- bool mHasUnsavedDescriptionChanges;
- bool mVoiceStatus;
- bool mWaitingForImageUpload;
- bool mAllowPublish;
- std::string mDescriptionText;
- LLUUID mImageId;
-
- boost::signals2::connection mAvatarNameCacheConnection;
+ typedef std::map<std::string, LLUUID> group_map_t;
+ group_map_t mGroups;
+ void openGroupProfile();
+
+ LLGroupList* mGroupList;
+ LLComboBox* mShowInSearchCombo;
+ LLThumbnailCtrl* mSecondLifePic;
+ LLPanel* mSecondLifePicLayout;
+ LLTextEditor* mDescriptionEdit;
+ LLMenuButton* mAgentActionMenuButton;
+ LLButton* mSaveDescriptionChanges;
+ LLButton* mDiscardDescriptionChanges;
+ LLIconCtrl* mCanSeeOnlineIcon;
+ LLIconCtrl* mCantSeeOnlineIcon;
+ LLIconCtrl* mCanSeeOnMapIcon;
+ LLIconCtrl* mCantSeeOnMapIcon;
+ LLIconCtrl* mCanEditObjectsIcon;
+ LLIconCtrl* mCantEditObjectsIcon;
+
+ LLHandle<LLFloater> mFloaterPermissionsHandle;
+ LLHandle<LLFloater> mFloaterProfileTextureHandle;
+ LLHandle<LLFloater> mFloaterTexturePickerHandle;
+
+ bool mHasUnsavedDescriptionChanges;
+ bool mVoiceStatus;
+ bool mWaitingForImageUpload;
+ bool mAllowPublish;
+ std::string mDescriptionText;
+ LLUUID mImageId;
+
+ boost::signals2::connection mAvatarNameCacheConnection;
};
@@ -225,61 +225,61 @@ private:
* Panel for displaying Avatar's web profile and home page.
*/
class LLPanelProfileWeb
- : public LLPanelProfileTab
- , public LLViewerMediaObserver
+ : public LLPanelProfileTab
+ , public LLViewerMediaObserver
{
public:
- LLPanelProfileWeb();
- /*virtual*/ ~LLPanelProfileWeb();
+ LLPanelProfileWeb();
+ /*virtual*/ ~LLPanelProfileWeb();
- void onOpen(const LLSD& key) override;
+ void onOpen(const LLSD& key) override;
- BOOL postBuild() override;
+ BOOL postBuild() override;
- void resetData() override;
+ void resetData() override;
- /**
- * Loads web profile.
- */
- void updateData() override;
+ /**
+ * Loads web profile.
+ */
+ void updateData() override;
- void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override;
+ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override;
- void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id);
protected:
- void onCommitLoad(LLUICtrl* ctrl);
+ void onCommitLoad(LLUICtrl* ctrl);
private:
- std::string mURLHome;
- std::string mURLWebProfile;
- LLMediaCtrl* mWebBrowser;
+ std::string mURLHome;
+ std::string mURLWebProfile;
+ LLMediaCtrl* mWebBrowser;
- LLFrameTimer mPerformanceTimer;
- bool mFirstNavigate;
+ LLFrameTimer mPerformanceTimer;
+ bool mFirstNavigate;
- boost::signals2::connection mAvatarNameCacheConnection;
+ boost::signals2::connection mAvatarNameCacheConnection;
};
/**
* Panel for displaying Avatar's first life related info.
*/
class LLPanelProfileFirstLife
- : public LLPanelProfileTab
+ : public LLPanelProfileTab
{
public:
- LLPanelProfileFirstLife();
- /*virtual*/ ~LLPanelProfileFirstLife();
+ LLPanelProfileFirstLife();
+ /*virtual*/ ~LLPanelProfileFirstLife();
- void onOpen(const LLSD& key) override;
+ void onOpen(const LLSD& key) override;
- BOOL postBuild() override;
+ BOOL postBuild() override;
void processProperties(const LLAvatarData* avatar_data);
- void resetData() override;
+ void resetData() override;
void setProfileImageUploading(bool loading);
void setProfileImageUploaded(const LLUUID &image_asset_id);
@@ -290,7 +290,7 @@ public:
friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id);
protected:
- void setLoaded() override;
+ void setLoaded() override;
void onUploadPhoto();
void onChangePhoto();
@@ -301,7 +301,7 @@ protected:
void onSaveDescriptionChanges();
void onDiscardDescriptionChanges();
- LLTextEditor* mDescriptionEdit;
+ LLTextEditor* mDescriptionEdit;
LLThumbnailCtrl* mPicture;
LLButton* mUploadPhoto;
LLButton* mChangePhoto;
@@ -309,34 +309,34 @@ protected:
LLButton* mSaveChanges;
LLButton* mDiscardChanges;
- LLHandle<LLFloater> mFloaterTexturePickerHandle;
+ LLHandle<LLFloater> mFloaterTexturePickerHandle;
- std::string mCurrentDescription;
- LLUUID mImageId;
- bool mHasUnsavedChanges;
+ std::string mCurrentDescription;
+ LLUUID mImageId;
+ bool mHasUnsavedChanges;
};
/**
* Panel for displaying Avatar's notes and modifying friend's rights.
*/
class LLPanelProfileNotes
- : public LLPanelProfileTab
+ : public LLPanelProfileTab
{
public:
- LLPanelProfileNotes();
- /*virtual*/ ~LLPanelProfileNotes();
+ LLPanelProfileNotes();
+ /*virtual*/ ~LLPanelProfileNotes();
- void setAvatarId(const LLUUID& avatar_id) override;
+ void setAvatarId(const LLUUID& avatar_id) override;
- void onOpen(const LLSD& key) override;
+ void onOpen(const LLSD& key) override;
- BOOL postBuild() override;
+ BOOL postBuild() override;
void processProperties(LLAvatarNotes* avatar_notes);
- void resetData() override;
+ void resetData() override;
- void updateData() override;
+ void updateData() override;
bool hasUnsavedChanges() override { return mHasUnsavedChanges; }
void commitUnsavedChanges() override;
@@ -347,12 +347,12 @@ protected:
void onSaveNotesChanges();
void onDiscardNotesChanges();
- LLTextEditor* mNotesEditor;
+ LLTextEditor* mNotesEditor;
LLButton* mSaveChanges;
LLButton* mDiscardChanges;
- std::string mCurrentNotes;
- bool mHasUnsavedChanges;
+ std::string mCurrentNotes;
+ bool mHasUnsavedChanges;
};
diff --git a/indra/newview/llpanelprofileclassifieds.cpp b/indra/newview/llpanelprofileclassifieds.cpp
index 307935f45f..7ec657d069 100644
--- a/indra/newview/llpanelprofileclassifieds.cpp
+++ b/indra/newview/llpanelprofileclassifieds.cpp
@@ -78,9 +78,9 @@ class LLClassifiedHandler : public LLCommandHandler, public LLAvatarPropertiesOb
public:
// throttle calls from untrusted browsers
LLClassifiedHandler() : LLCommandHandler("classified", UNTRUSTED_THROTTLE) {}
-
- std::set<LLUUID> mClassifiedIds;
- std::string mRequestVerb;
+
+ std::set<LLUUID> mClassifiedIds;
+ std::string mRequestVerb;
virtual bool canHandleUntrusted(
const LLSD& params,
@@ -106,8 +106,8 @@ public:
}
return true;
}
-
- bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+
+ bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_STARTED)
{
diff --git a/indra/newview/llpanelpulldown.h b/indra/newview/llpanelpulldown.h
index 705e76d0ab..1bb13d91f9 100644
--- a/indra/newview/llpanelpulldown.h
+++ b/indra/newview/llpanelpulldown.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelpulldown.h
* @brief A panel that serves as a basis for multiple toolbar pulldown panels
*
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp
index c3524a8c87..bd44a2139f 100644
--- a/indra/newview/llpanelsnapshot.cpp
+++ b/indra/newview/llpanelsnapshot.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelsnapshot.cpp
* @brief Snapshot panel base class
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,24 +45,24 @@ const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
S32 power_of_two(S32 sz, S32 upper)
{
- S32 res = upper;
- while( upper >= sz)
- {
- res = upper;
- upper >>= 1;
- }
- return res;
+ S32 res = upper;
+ while( upper >= sz)
+ {
+ res = upper;
+ upper >>= 1;
+ }
+ return res;
}
LLPanelSnapshot::LLPanelSnapshot()
- : mSnapshotFloater(NULL)
+ : mSnapshotFloater(NULL)
{}
// virtual
BOOL LLPanelSnapshot::postBuild()
{
- getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()));
- getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1));
+ getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()));
+ getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1));
if (!getWidthSpinnerName().empty())
{
getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this));
@@ -75,56 +75,56 @@ BOOL LLPanelSnapshot::postBuild()
{
getChild<LLUICtrl>(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onKeepAspectRatioCommit, this, _1));
}
- updateControls(LLSD());
+ updateControls(LLSD());
- mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>();
- return TRUE;
+ mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>();
+ return TRUE;
}
// virtual
void LLPanelSnapshot::onOpen(const LLSD& key)
{
- S32 old_format = gSavedSettings.getS32("SnapshotFormat");
- S32 new_format = (S32) getImageFormat();
+ S32 old_format = gSavedSettings.getS32("SnapshotFormat");
+ S32 new_format = (S32) getImageFormat();
- gSavedSettings.setS32("SnapshotFormat", new_format);
- setCtrlsEnabled(true);
+ gSavedSettings.setS32("SnapshotFormat", new_format);
+ setCtrlsEnabled(true);
- // Switching panels will likely change image format.
- // Not updating preview right away may lead to errors,
- // e.g. attempt to send a large BMP image by email.
- if (old_format != new_format)
- {
+ // Switching panels will likely change image format.
+ // Not updating preview right away may lead to errors,
+ // e.g. attempt to send a large BMP image by email.
+ if (old_format != new_format)
+ {
getParentByType<LLFloater>()->notify(LLSD().with("image-format-change", true));
- }
+ }
}
LLSnapshotModel::ESnapshotFormat LLPanelSnapshot::getImageFormat() const
{
- return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG;
+ return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG;
}
void LLPanelSnapshot::enableControls(BOOL enable)
{
- setCtrlsEnabled(enable);
+ setCtrlsEnabled(enable);
}
LLSpinCtrl* LLPanelSnapshot::getWidthSpinner()
{
llassert(!getWidthSpinnerName().empty());
- return getChild<LLSpinCtrl>(getWidthSpinnerName());
+ return getChild<LLSpinCtrl>(getWidthSpinnerName());
}
LLSpinCtrl* LLPanelSnapshot::getHeightSpinner()
{
llassert(!getHeightSpinnerName().empty());
- return getChild<LLSpinCtrl>(getHeightSpinnerName());
+ return getChild<LLSpinCtrl>(getHeightSpinnerName());
}
S32 LLPanelSnapshot::getTypedPreviewWidth() const
{
llassert(!getWidthSpinnerName().empty());
- return getChild<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger();
+ return getChild<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger();
}
S32 LLPanelSnapshot::getTypedPreviewHeight() const
@@ -141,96 +141,96 @@ void LLPanelSnapshot::enableAspectRatioCheckbox(BOOL enable)
LLSideTrayPanelContainer* LLPanelSnapshot::getParentContainer()
{
- LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
- if (!parent)
- {
- LL_WARNS() << "Cannot find panel container" << LL_ENDL;
- return NULL;
- }
+ LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
+ if (!parent)
+ {
+ LL_WARNS() << "Cannot find panel container" << LL_ENDL;
+ return NULL;
+ }
- return parent;
+ return parent;
}
void LLPanelSnapshot::updateImageQualityLevel()
{
- LLSliderCtrl* quality_slider = getChild<LLSliderCtrl>("image_quality_slider");
- S32 quality_val = llfloor((F32) quality_slider->getValue().asReal());
-
- std::string quality_lvl;
-
- if (quality_val < 20)
- {
- quality_lvl = LLTrans::getString("snapshot_quality_very_low");
- }
- else if (quality_val < 40)
- {
- quality_lvl = LLTrans::getString("snapshot_quality_low");
- }
- else if (quality_val < 60)
- {
- quality_lvl = LLTrans::getString("snapshot_quality_medium");
- }
- else if (quality_val < 80)
- {
- quality_lvl = LLTrans::getString("snapshot_quality_high");
- }
- else
- {
- quality_lvl = LLTrans::getString("snapshot_quality_very_high");
- }
-
- getChild<LLTextBox>("image_quality_level")->setTextArg("[QLVL]", quality_lvl);
+ LLSliderCtrl* quality_slider = getChild<LLSliderCtrl>("image_quality_slider");
+ S32 quality_val = llfloor((F32) quality_slider->getValue().asReal());
+
+ std::string quality_lvl;
+
+ if (quality_val < 20)
+ {
+ quality_lvl = LLTrans::getString("snapshot_quality_very_low");
+ }
+ else if (quality_val < 40)
+ {
+ quality_lvl = LLTrans::getString("snapshot_quality_low");
+ }
+ else if (quality_val < 60)
+ {
+ quality_lvl = LLTrans::getString("snapshot_quality_medium");
+ }
+ else if (quality_val < 80)
+ {
+ quality_lvl = LLTrans::getString("snapshot_quality_high");
+ }
+ else
+ {
+ quality_lvl = LLTrans::getString("snapshot_quality_very_high");
+ }
+
+ getChild<LLTextBox>("image_quality_level")->setTextArg("[QLVL]", quality_lvl);
}
void LLPanelSnapshot::goBack()
{
- LLSideTrayPanelContainer* parent = getParentContainer();
- if (parent)
- {
- parent->openPreviousPanel();
- parent->getCurrentPanel()->onOpen(LLSD());
- }
+ LLSideTrayPanelContainer* parent = getParentContainer();
+ if (parent)
+ {
+ parent->openPreviousPanel();
+ parent->getCurrentPanel()->onOpen(LLSD());
+ }
}
void LLPanelSnapshot::cancel()
{
- goBack();
+ goBack();
getParentByType<LLFloater>()->notify(LLSD().with("set-ready", true));
}
void LLPanelSnapshot::onCustomResolutionCommit()
{
- LLSD info;
+ LLSD info;
std::string widthSpinnerName = getWidthSpinnerName();
std::string heightSpinnerName = getHeightSpinnerName();
llassert(!widthSpinnerName.empty() && !heightSpinnerName.empty());
LLSpinCtrl *widthSpinner = getChild<LLSpinCtrl>(widthSpinnerName);
LLSpinCtrl *heightSpinner = getChild<LLSpinCtrl>(heightSpinnerName);
- if (getName() == "panel_snapshot_inventory")
- {
- S32 width = widthSpinner->getValue().asInteger();
- width = power_of_two(width, MAX_TEXTURE_SIZE);
- info["w"] = width;
- widthSpinner->setIncrement(width >> 1);
- widthSpinner->forceSetValue(width);
- S32 height = heightSpinner->getValue().asInteger();
- height = power_of_two(height, MAX_TEXTURE_SIZE);
- heightSpinner->setIncrement(height >> 1);
- heightSpinner->forceSetValue(height);
- info["h"] = height;
- }
- else
- {
- info["w"] = widthSpinner->getValue().asInteger();
- info["h"] = heightSpinner->getValue().asInteger();
- }
+ if (getName() == "panel_snapshot_inventory")
+ {
+ S32 width = widthSpinner->getValue().asInteger();
+ width = power_of_two(width, MAX_TEXTURE_SIZE);
+ info["w"] = width;
+ widthSpinner->setIncrement(width >> 1);
+ widthSpinner->forceSetValue(width);
+ S32 height = heightSpinner->getValue().asInteger();
+ height = power_of_two(height, MAX_TEXTURE_SIZE);
+ heightSpinner->setIncrement(height >> 1);
+ heightSpinner->forceSetValue(height);
+ info["h"] = height;
+ }
+ else
+ {
+ info["w"] = widthSpinner->getValue().asInteger();
+ info["h"] = heightSpinner->getValue().asInteger();
+ }
getParentByType<LLFloater>()->notify(LLSD().with("custom-res-change", info));
}
void LLPanelSnapshot::onResolutionComboCommit(LLUICtrl* ctrl)
{
- LLSD info;
- info["combo-res-change"]["control-name"] = ctrl->getName();
+ LLSD info;
+ info["combo-res-change"]["control-name"] = ctrl->getName();
getParentByType<LLFloater>()->notify(info);
}
@@ -241,5 +241,5 @@ void LLPanelSnapshot::onKeepAspectRatioCommit(LLUICtrl* ctrl)
LLSnapshotModel::ESnapshotType LLPanelSnapshot::getSnapshotType()
{
- return LLSnapshotModel::SNAPSHOT_WEB;
+ return LLSnapshotModel::SNAPSHOT_WEB;
}
diff --git a/indra/newview/llpanelsnapshot.h b/indra/newview/llpanelsnapshot.h
index 55273797cc..a960ee8fe1 100644
--- a/indra/newview/llpanelsnapshot.h
+++ b/indra/newview/llpanelsnapshot.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelsnapshot.h
* @brief Snapshot panel base class
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,39 +41,39 @@ class LLFloaterSnapshotBase;
class LLPanelSnapshot: public LLPanel
{
public:
- LLPanelSnapshot();
+ LLPanelSnapshot();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- virtual std::string getWidthSpinnerName() const = 0;
- virtual std::string getHeightSpinnerName() const = 0;
- virtual std::string getAspectRatioCBName() const = 0;
- virtual std::string getImageSizeComboName() const = 0;
- virtual std::string getImageSizePanelName() const = 0;
+ virtual std::string getWidthSpinnerName() const = 0;
+ virtual std::string getHeightSpinnerName() const = 0;
+ virtual std::string getAspectRatioCBName() const = 0;
+ virtual std::string getImageSizeComboName() const = 0;
+ virtual std::string getImageSizePanelName() const = 0;
- virtual S32 getTypedPreviewWidth() const;
- virtual S32 getTypedPreviewHeight() const;
- virtual LLSpinCtrl* getWidthSpinner();
- virtual LLSpinCtrl* getHeightSpinner();
- virtual void enableAspectRatioCheckbox(BOOL enable);
+ virtual S32 getTypedPreviewWidth() const;
+ virtual S32 getTypedPreviewHeight() const;
+ virtual LLSpinCtrl* getWidthSpinner();
+ virtual LLSpinCtrl* getHeightSpinner();
+ virtual void enableAspectRatioCheckbox(BOOL enable);
virtual LLSnapshotModel::ESnapshotFormat getImageFormat() const;
- virtual LLSnapshotModel::ESnapshotType getSnapshotType();
- virtual void updateControls(const LLSD& info) = 0; ///< Update controls from saved settings
- void enableControls(BOOL enable);
+ virtual LLSnapshotModel::ESnapshotType getSnapshotType();
+ virtual void updateControls(const LLSD& info) = 0; ///< Update controls from saved settings
+ void enableControls(BOOL enable);
protected:
- LLSideTrayPanelContainer* getParentContainer();
- void updateImageQualityLevel();
- void goBack(); ///< Switch to the default (Snapshot Options) panel
- virtual void cancel();
+ LLSideTrayPanelContainer* getParentContainer();
+ void updateImageQualityLevel();
+ void goBack(); ///< Switch to the default (Snapshot Options) panel
+ virtual void cancel();
- // common UI callbacks
- void onCustomResolutionCommit();
- void onResolutionComboCommit(LLUICtrl* ctrl);
- void onKeepAspectRatioCommit(LLUICtrl* ctrl);
+ // common UI callbacks
+ void onCustomResolutionCommit();
+ void onResolutionComboCommit(LLUICtrl* ctrl);
+ void onKeepAspectRatioCommit(LLUICtrl* ctrl);
- LLFloaterSnapshotBase* mSnapshotFloater;
+ LLFloaterSnapshotBase* mSnapshotFloater;
};
#endif // LL_LLPANELSNAPSHOT_H
diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp
index 9e56a04b3b..3092ea3b18 100644
--- a/indra/newview/llpanelsnapshotinventory.cpp
+++ b/indra/newview/llpanelsnapshotinventory.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelsnapshotinventory.cpp
* @brief The panel provides UI for saving snapshot as an inventory texture.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,7 +34,7 @@
#include "llpanelsnapshot.h"
#include "llsnapshotlivepreview.h"
#include "llviewercontrol.h" // gSavedSettings
-#include "llstatusbar.h" // can_afford_transaction()
+#include "llstatusbar.h" // can_afford_transaction()
#include "llnotificationsutil.h"
#include "llagentbenefits.h"
@@ -50,7 +50,7 @@ class LLPanelSnapshotInventoryBase
public:
LLPanelSnapshotInventoryBase();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
protected:
void onSend();
/*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType();
@@ -59,22 +59,22 @@ protected:
class LLPanelSnapshotInventory
: public LLPanelSnapshotInventoryBase
{
- LOG_CLASS(LLPanelSnapshotInventory);
+ LOG_CLASS(LLPanelSnapshotInventory);
public:
- LLPanelSnapshotInventory();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ LLPanelSnapshotInventory();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- void onResolutionCommit(LLUICtrl* ctrl);
+ void onResolutionCommit(LLUICtrl* ctrl);
private:
- /*virtual*/ std::string getWidthSpinnerName() const { return "inventory_snapshot_width"; }
- /*virtual*/ std::string getHeightSpinnerName() const { return "inventory_snapshot_height"; }
- /*virtual*/ std::string getAspectRatioCBName() const { return "inventory_keep_aspect_check"; }
- /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; }
- /*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
- /*virtual*/ void updateControls(const LLSD& info);
+ /*virtual*/ std::string getWidthSpinnerName() const { return "inventory_snapshot_width"; }
+ /*virtual*/ std::string getHeightSpinnerName() const { return "inventory_snapshot_height"; }
+ /*virtual*/ std::string getAspectRatioCBName() const { return "inventory_keep_aspect_check"; }
+ /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; }
+ /*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
+ /*virtual*/ void updateControls(const LLSD& info);
};
@@ -85,15 +85,15 @@ class LLPanelOutfitSnapshotInventory
public:
LLPanelOutfitSnapshotInventory();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
-
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
private:
- /*virtual*/ std::string getWidthSpinnerName() const { return ""; }
- /*virtual*/ std::string getHeightSpinnerName() const { return ""; }
- /*virtual*/ std::string getAspectRatioCBName() const { return ""; }
- /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; }
- /*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
+ /*virtual*/ std::string getWidthSpinnerName() const { return ""; }
+ /*virtual*/ std::string getHeightSpinnerName() const { return ""; }
+ /*virtual*/ std::string getAspectRatioCBName() const { return ""; }
+ /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; }
+ /*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
/*virtual*/ void updateControls(const LLSD& info);
/*virtual*/ void cancel();
@@ -119,38 +119,38 @@ LLSnapshotModel::ESnapshotType LLPanelSnapshotInventoryBase::getSnapshotType()
LLPanelSnapshotInventory::LLPanelSnapshotInventory()
{
- mCommitCallbackRegistrar.add("Inventory.Save", boost::bind(&LLPanelSnapshotInventory::onSend, this));
- mCommitCallbackRegistrar.add("Inventory.Cancel", boost::bind(&LLPanelSnapshotInventory::cancel, this));
+ mCommitCallbackRegistrar.add("Inventory.Save", boost::bind(&LLPanelSnapshotInventory::onSend, this));
+ mCommitCallbackRegistrar.add("Inventory.Cancel", boost::bind(&LLPanelSnapshotInventory::cancel, this));
}
// virtual
BOOL LLPanelSnapshotInventory::postBuild()
{
- getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(FALSE);
- getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(FALSE);
+ getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(FALSE);
+ getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(FALSE);
- getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onResolutionCommit, this, _1));
- return LLPanelSnapshotInventoryBase::postBuild();
+ getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onResolutionCommit, this, _1));
+ return LLPanelSnapshotInventoryBase::postBuild();
}
// virtual
void LLPanelSnapshotInventory::onOpen(const LLSD& key)
{
- LLPanelSnapshot::onOpen(key);
+ LLPanelSnapshot::onOpen(key);
}
// virtual
void LLPanelSnapshotInventory::updateControls(const LLSD& info)
{
- const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
- getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
+ const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
+ getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
}
void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)
{
- BOOL current_window_selected = (getChild<LLComboBox>(getImageSizeComboName())->getCurrentIndex() == 3);
- getChild<LLSpinCtrl>(getWidthSpinnerName())->setVisible(!current_window_selected);
- getChild<LLSpinCtrl>(getHeightSpinnerName())->setVisible(!current_window_selected);
+ BOOL current_window_selected = (getChild<LLComboBox>(getImageSizeComboName())->getCurrentIndex() == 3);
+ getChild<LLSpinCtrl>(getWidthSpinnerName())->setVisible(!current_window_selected);
+ getChild<LLSpinCtrl>(getHeightSpinnerName())->setVisible(!current_window_selected);
}
void LLPanelSnapshotInventoryBase::onSend()
diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp
index e7fced92a7..bcb1022c81 100644
--- a/indra/newview/llpanelsnapshotlocal.cpp
+++ b/indra/newview/llpanelsnapshotlocal.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelsnapshotlocal.cpp
* @brief The panel provides UI for saving snapshot to a local folder.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,149 +41,149 @@
* The panel provides UI for saving snapshot to a local folder.
*/
class LLPanelSnapshotLocal
-: public LLPanelSnapshot
+: public LLPanelSnapshot
{
- LOG_CLASS(LLPanelSnapshotLocal);
+ LOG_CLASS(LLPanelSnapshotLocal);
public:
- LLPanelSnapshotLocal();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ LLPanelSnapshotLocal();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
private:
- /*virtual*/ std::string getWidthSpinnerName() const { return "local_snapshot_width"; }
- /*virtual*/ std::string getHeightSpinnerName() const { return "local_snapshot_height"; }
- /*virtual*/ std::string getAspectRatioCBName() const { return "local_keep_aspect_check"; }
- /*virtual*/ std::string getImageSizeComboName() const { return "local_size_combo"; }
- /*virtual*/ std::string getImageSizePanelName() const { return "local_image_size_lp"; }
- /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat() const;
- /*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType();
- /*virtual*/ void updateControls(const LLSD& info);
-
- S32 mLocalFormat;
-
- void onFormatComboCommit(LLUICtrl* ctrl);
- void onQualitySliderCommit(LLUICtrl* ctrl);
- void onSaveFlyoutCommit(LLUICtrl* ctrl);
-
- void onLocalSaved();
- void onLocalCanceled();
+ /*virtual*/ std::string getWidthSpinnerName() const { return "local_snapshot_width"; }
+ /*virtual*/ std::string getHeightSpinnerName() const { return "local_snapshot_height"; }
+ /*virtual*/ std::string getAspectRatioCBName() const { return "local_keep_aspect_check"; }
+ /*virtual*/ std::string getImageSizeComboName() const { return "local_size_combo"; }
+ /*virtual*/ std::string getImageSizePanelName() const { return "local_image_size_lp"; }
+ /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat() const;
+ /*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType();
+ /*virtual*/ void updateControls(const LLSD& info);
+
+ S32 mLocalFormat;
+
+ void onFormatComboCommit(LLUICtrl* ctrl);
+ void onQualitySliderCommit(LLUICtrl* ctrl);
+ void onSaveFlyoutCommit(LLUICtrl* ctrl);
+
+ void onLocalSaved();
+ void onLocalCanceled();
};
static LLPanelInjector<LLPanelSnapshotLocal> panel_class("llpanelsnapshotlocal");
LLPanelSnapshotLocal::LLPanelSnapshotLocal()
{
- mLocalFormat = gSavedSettings.getS32("SnapshotFormat");
- mCommitCallbackRegistrar.add("Local.Cancel", boost::bind(&LLPanelSnapshotLocal::cancel, this));
+ mLocalFormat = gSavedSettings.getS32("SnapshotFormat");
+ mCommitCallbackRegistrar.add("Local.Cancel", boost::bind(&LLPanelSnapshotLocal::cancel, this));
}
// virtual
BOOL LLPanelSnapshotLocal::postBuild()
{
- getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1));
- getChild<LLUICtrl>("local_format_combo")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onFormatComboCommit, this, _1));
- getChild<LLUICtrl>("save_btn")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onSaveFlyoutCommit, this, _1));
+ getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1));
+ getChild<LLUICtrl>("local_format_combo")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onFormatComboCommit, this, _1));
+ getChild<LLUICtrl>("save_btn")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onSaveFlyoutCommit, this, _1));
- return LLPanelSnapshot::postBuild();
+ return LLPanelSnapshot::postBuild();
}
// virtual
void LLPanelSnapshotLocal::onOpen(const LLSD& key)
{
- if(gSavedSettings.getS32("SnapshotFormat") != mLocalFormat)
- {
- getChild<LLComboBox>("local_format_combo")->selectNthItem(mLocalFormat);
- }
- LLPanelSnapshot::onOpen(key);
+ if(gSavedSettings.getS32("SnapshotFormat") != mLocalFormat)
+ {
+ getChild<LLComboBox>("local_format_combo")->selectNthItem(mLocalFormat);
+ }
+ LLPanelSnapshot::onOpen(key);
}
// virtual
LLSnapshotModel::ESnapshotFormat LLPanelSnapshotLocal::getImageFormat() const
{
- LLSnapshotModel::ESnapshotFormat fmt = LLSnapshotModel::SNAPSHOT_FORMAT_PNG;
-
- LLComboBox* local_format_combo = getChild<LLComboBox>("local_format_combo");
- const std::string id = local_format_combo->getValue().asString();
- if (id == "PNG")
- {
- fmt = LLSnapshotModel::SNAPSHOT_FORMAT_PNG;
- }
- else if (id == "JPEG")
- {
- fmt = LLSnapshotModel::SNAPSHOT_FORMAT_JPEG;
- }
- else if (id == "BMP")
- {
- fmt = LLSnapshotModel::SNAPSHOT_FORMAT_BMP;
- }
-
- return fmt;
+ LLSnapshotModel::ESnapshotFormat fmt = LLSnapshotModel::SNAPSHOT_FORMAT_PNG;
+
+ LLComboBox* local_format_combo = getChild<LLComboBox>("local_format_combo");
+ const std::string id = local_format_combo->getValue().asString();
+ if (id == "PNG")
+ {
+ fmt = LLSnapshotModel::SNAPSHOT_FORMAT_PNG;
+ }
+ else if (id == "JPEG")
+ {
+ fmt = LLSnapshotModel::SNAPSHOT_FORMAT_JPEG;
+ }
+ else if (id == "BMP")
+ {
+ fmt = LLSnapshotModel::SNAPSHOT_FORMAT_BMP;
+ }
+
+ return fmt;
}
// virtual
void LLPanelSnapshotLocal::updateControls(const LLSD& info)
{
- LLSnapshotModel::ESnapshotFormat fmt =
- (LLSnapshotModel::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
- getChild<LLComboBox>("local_format_combo")->selectNthItem((S32) fmt);
+ LLSnapshotModel::ESnapshotFormat fmt =
+ (LLSnapshotModel::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
+ getChild<LLComboBox>("local_format_combo")->selectNthItem((S32) fmt);
- const bool show_quality_ctrls = (fmt == LLSnapshotModel::SNAPSHOT_FORMAT_JPEG);
- getChild<LLUICtrl>("image_quality_slider")->setVisible(show_quality_ctrls);
- getChild<LLUICtrl>("image_quality_level")->setVisible(show_quality_ctrls);
+ const bool show_quality_ctrls = (fmt == LLSnapshotModel::SNAPSHOT_FORMAT_JPEG);
+ getChild<LLUICtrl>("image_quality_slider")->setVisible(show_quality_ctrls);
+ getChild<LLUICtrl>("image_quality_level")->setVisible(show_quality_ctrls);
- getChild<LLUICtrl>("image_quality_slider")->setValue(gSavedSettings.getS32("SnapshotQuality"));
- updateImageQualityLevel();
+ getChild<LLUICtrl>("image_quality_slider")->setValue(gSavedSettings.getS32("SnapshotQuality"));
+ updateImageQualityLevel();
- const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
- getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
+ const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
+ getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
}
void LLPanelSnapshotLocal::onFormatComboCommit(LLUICtrl* ctrl)
{
- mLocalFormat = getImageFormat();
- // will call updateControls()
- LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true));
+ mLocalFormat = getImageFormat();
+ // will call updateControls()
+ LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true));
}
void LLPanelSnapshotLocal::onQualitySliderCommit(LLUICtrl* ctrl)
{
- updateImageQualityLevel();
+ updateImageQualityLevel();
- LLSliderCtrl* slider = (LLSliderCtrl*)ctrl;
- S32 quality_val = llfloor((F32)slider->getValue().asReal());
- LLSD info;
- info["image-quality-change"] = quality_val;
- LLFloaterSnapshot::getInstance()->notify(info);
+ LLSliderCtrl* slider = (LLSliderCtrl*)ctrl;
+ S32 quality_val = llfloor((F32)slider->getValue().asReal());
+ LLSD info;
+ info["image-quality-change"] = quality_val;
+ LLFloaterSnapshot::getInstance()->notify(info);
}
void LLPanelSnapshotLocal::onSaveFlyoutCommit(LLUICtrl* ctrl)
{
- if (ctrl->getValue().asString() == "save as")
- {
- gViewerWindow->resetSnapshotLoc();
- }
+ if (ctrl->getValue().asString() == "save as")
+ {
+ gViewerWindow->resetSnapshotLoc();
+ }
- LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance();
+ LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance();
- floater->notify(LLSD().with("set-working", true));
- floater->saveLocal((boost::bind(&LLPanelSnapshotLocal::onLocalSaved, this)), (boost::bind(&LLPanelSnapshotLocal::onLocalCanceled, this)));
+ floater->notify(LLSD().with("set-working", true));
+ floater->saveLocal((boost::bind(&LLPanelSnapshotLocal::onLocalSaved, this)), (boost::bind(&LLPanelSnapshotLocal::onLocalCanceled, this)));
}
void LLPanelSnapshotLocal::onLocalSaved()
{
- mSnapshotFloater->postSave();
- LLFloaterSnapshot::getInstance()->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));
+ mSnapshotFloater->postSave();
+ LLFloaterSnapshot::getInstance()->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));
}
void LLPanelSnapshotLocal::onLocalCanceled()
{
- cancel();
- LLFloaterSnapshot::getInstance()->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "local")));
+ cancel();
+ LLFloaterSnapshot::getInstance()->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "local")));
}
LLSnapshotModel::ESnapshotType LLPanelSnapshotLocal::getSnapshotType()
{
- return LLSnapshotModel::SNAPSHOT_LOCAL;
+ return LLSnapshotModel::SNAPSHOT_LOCAL;
}
diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp
index 8cc2fbc770..28e1f33b16 100644
--- a/indra/newview/llpanelsnapshotoptions.cpp
+++ b/indra/newview/llpanelsnapshotoptions.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelsnapshotoptions.cpp
* @brief Snapshot posting options panel.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,35 +39,35 @@
* Provides several ways to save a snapshot.
*/
class LLPanelSnapshotOptions
-: public LLPanel
+: public LLPanel
{
- LOG_CLASS(LLPanelSnapshotOptions);
+ LOG_CLASS(LLPanelSnapshotOptions);
public:
- LLPanelSnapshotOptions();
- ~LLPanelSnapshotOptions();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ LLPanelSnapshotOptions();
+ ~LLPanelSnapshotOptions();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
private:
- void updateUploadCost();
- void openPanel(const std::string& panel_name);
- void onSaveToProfile();
- void onSaveToEmail();
- void onSaveToInventory();
- void onSaveToComputer();
-
- LLFloaterSnapshotBase* mSnapshotFloater;
+ void updateUploadCost();
+ void openPanel(const std::string& panel_name);
+ void onSaveToProfile();
+ void onSaveToEmail();
+ void onSaveToInventory();
+ void onSaveToComputer();
+
+ LLFloaterSnapshotBase* mSnapshotFloater;
};
static LLPanelInjector<LLPanelSnapshotOptions> panel_class("llpanelsnapshotoptions");
LLPanelSnapshotOptions::LLPanelSnapshotOptions()
{
- mCommitCallbackRegistrar.add("Snapshot.SaveToProfile", boost::bind(&LLPanelSnapshotOptions::onSaveToProfile, this));
- mCommitCallbackRegistrar.add("Snapshot.SaveToEmail", boost::bind(&LLPanelSnapshotOptions::onSaveToEmail, this));
- mCommitCallbackRegistrar.add("Snapshot.SaveToInventory", boost::bind(&LLPanelSnapshotOptions::onSaveToInventory, this));
- mCommitCallbackRegistrar.add("Snapshot.SaveToComputer", boost::bind(&LLPanelSnapshotOptions::onSaveToComputer, this));
+ mCommitCallbackRegistrar.add("Snapshot.SaveToProfile", boost::bind(&LLPanelSnapshotOptions::onSaveToProfile, this));
+ mCommitCallbackRegistrar.add("Snapshot.SaveToEmail", boost::bind(&LLPanelSnapshotOptions::onSaveToEmail, this));
+ mCommitCallbackRegistrar.add("Snapshot.SaveToInventory", boost::bind(&LLPanelSnapshotOptions::onSaveToInventory, this));
+ mCommitCallbackRegistrar.add("Snapshot.SaveToComputer", boost::bind(&LLPanelSnapshotOptions::onSaveToComputer, this));
}
LLPanelSnapshotOptions::~LLPanelSnapshotOptions()
@@ -77,53 +77,53 @@ LLPanelSnapshotOptions::~LLPanelSnapshotOptions()
// virtual
BOOL LLPanelSnapshotOptions::postBuild()
{
- mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>();
- return LLPanel::postBuild();
+ mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>();
+ return LLPanel::postBuild();
}
// virtual
void LLPanelSnapshotOptions::onOpen(const LLSD& key)
{
- updateUploadCost();
+ updateUploadCost();
}
void LLPanelSnapshotOptions::updateUploadCost()
{
- S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
- getChild<LLUICtrl>("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost));
+ S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
+ getChild<LLUICtrl>("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost));
}
void LLPanelSnapshotOptions::openPanel(const std::string& panel_name)
{
- LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
- if (!parent)
- {
- LL_WARNS() << "Cannot find panel container" << LL_ENDL;
- return;
- }
-
- parent->openPanel(panel_name);
- parent->getCurrentPanel()->onOpen(LLSD());
- mSnapshotFloater->postPanelSwitch();
+ LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
+ if (!parent)
+ {
+ LL_WARNS() << "Cannot find panel container" << LL_ENDL;
+ return;
+ }
+
+ parent->openPanel(panel_name);
+ parent->getCurrentPanel()->onOpen(LLSD());
+ mSnapshotFloater->postPanelSwitch();
}
void LLPanelSnapshotOptions::onSaveToProfile()
{
- openPanel("panel_snapshot_profile");
+ openPanel("panel_snapshot_profile");
}
void LLPanelSnapshotOptions::onSaveToEmail()
{
- openPanel("panel_snapshot_postcard");
+ openPanel("panel_snapshot_postcard");
}
void LLPanelSnapshotOptions::onSaveToInventory()
{
- openPanel("panel_snapshot_inventory");
+ openPanel("panel_snapshot_inventory");
}
void LLPanelSnapshotOptions::onSaveToComputer()
{
- openPanel("panel_snapshot_local");
+ openPanel("panel_snapshot_local");
}
diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp
index 05fa2b58b1..3a25e471bb 100644
--- a/indra/newview/llpanelsnapshotpostcard.cpp
+++ b/indra/newview/llpanelsnapshotpostcard.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelsnapshotpostcard.cpp
* @brief Postcard sending panel.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,106 +50,106 @@
* Sends postcard via email.
*/
class LLPanelSnapshotPostcard
-: public LLPanelSnapshot
+: public LLPanelSnapshot
{
- LOG_CLASS(LLPanelSnapshotPostcard);
+ LOG_CLASS(LLPanelSnapshotPostcard);
public:
- LLPanelSnapshotPostcard();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ LLPanelSnapshotPostcard();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
private:
- /*virtual*/ std::string getWidthSpinnerName() const { return "postcard_snapshot_width"; }
- /*virtual*/ std::string getHeightSpinnerName() const { return "postcard_snapshot_height"; }
- /*virtual*/ std::string getAspectRatioCBName() const { return "postcard_keep_aspect_check"; }
- /*virtual*/ std::string getImageSizeComboName() const { return "postcard_size_combo"; }
- /*virtual*/ std::string getImageSizePanelName() const { return "postcard_image_size_lp"; }
- /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat() const { return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG; }
- /*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType();
- /*virtual*/ void updateControls(const LLSD& info);
-
- bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response);
- static void sendPostcardFinished(LLSD result);
- void sendPostcard();
-
- void onMsgFormFocusRecieved();
- void onFormatComboCommit(LLUICtrl* ctrl);
- void onQualitySliderCommit(LLUICtrl* ctrl);
- void onSend();
-
- bool mHasFirstMsgFocus;
+ /*virtual*/ std::string getWidthSpinnerName() const { return "postcard_snapshot_width"; }
+ /*virtual*/ std::string getHeightSpinnerName() const { return "postcard_snapshot_height"; }
+ /*virtual*/ std::string getAspectRatioCBName() const { return "postcard_keep_aspect_check"; }
+ /*virtual*/ std::string getImageSizeComboName() const { return "postcard_size_combo"; }
+ /*virtual*/ std::string getImageSizePanelName() const { return "postcard_image_size_lp"; }
+ /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat() const { return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG; }
+ /*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType();
+ /*virtual*/ void updateControls(const LLSD& info);
+
+ bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response);
+ static void sendPostcardFinished(LLSD result);
+ void sendPostcard();
+
+ void onMsgFormFocusRecieved();
+ void onFormatComboCommit(LLUICtrl* ctrl);
+ void onQualitySliderCommit(LLUICtrl* ctrl);
+ void onSend();
+
+ bool mHasFirstMsgFocus;
};
static LLPanelInjector<LLPanelSnapshotPostcard> panel_class("llpanelsnapshotpostcard");
LLPanelSnapshotPostcard::LLPanelSnapshotPostcard()
-: mHasFirstMsgFocus(false)
+: mHasFirstMsgFocus(false)
{
- mCommitCallbackRegistrar.add("Postcard.Send", boost::bind(&LLPanelSnapshotPostcard::onSend, this));
- mCommitCallbackRegistrar.add("Postcard.Cancel", boost::bind(&LLPanelSnapshotPostcard::cancel, this));
+ mCommitCallbackRegistrar.add("Postcard.Send", boost::bind(&LLPanelSnapshotPostcard::onSend, this));
+ mCommitCallbackRegistrar.add("Postcard.Cancel", boost::bind(&LLPanelSnapshotPostcard::cancel, this));
}
// virtual
BOOL LLPanelSnapshotPostcard::postBuild()
{
- // For the first time a user focuses to .the msg box, all text will be selected.
- getChild<LLUICtrl>("msg_form")->setFocusChangedCallback(boost::bind(&LLPanelSnapshotPostcard::onMsgFormFocusRecieved, this));
+ // For the first time a user focuses to .the msg box, all text will be selected.
+ getChild<LLUICtrl>("msg_form")->setFocusChangedCallback(boost::bind(&LLPanelSnapshotPostcard::onMsgFormFocusRecieved, this));
- getChild<LLUICtrl>("to_form")->setFocus(TRUE);
+ getChild<LLUICtrl>("to_form")->setFocus(TRUE);
- getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onQualitySliderCommit, this, _1));
+ getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onQualitySliderCommit, this, _1));
- return LLPanelSnapshot::postBuild();
+ return LLPanelSnapshot::postBuild();
}
// virtual
void LLPanelSnapshotPostcard::onOpen(const LLSD& key)
{
- LLUICtrl* name_form = getChild<LLUICtrl>("name_form");
- if (name_form && name_form->getValue().asString().empty())
- {
- std::string name_string;
- LLAgentUI::buildFullname(name_string);
- getChild<LLUICtrl>("name_form")->setValue(LLSD(name_string));
- }
-
- LLPanelSnapshot::onOpen(key);
+ LLUICtrl* name_form = getChild<LLUICtrl>("name_form");
+ if (name_form && name_form->getValue().asString().empty())
+ {
+ std::string name_string;
+ LLAgentUI::buildFullname(name_string);
+ getChild<LLUICtrl>("name_form")->setValue(LLSD(name_string));
+ }
+
+ LLPanelSnapshot::onOpen(key);
}
// virtual
void LLPanelSnapshotPostcard::updateControls(const LLSD& info)
{
- getChild<LLUICtrl>("image_quality_slider")->setValue(gSavedSettings.getS32("SnapshotQuality"));
- updateImageQualityLevel();
+ getChild<LLUICtrl>("image_quality_slider")->setValue(gSavedSettings.getS32("SnapshotQuality"));
+ updateImageQualityLevel();
- const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
- getChild<LLUICtrl>("send_btn")->setEnabled(have_snapshot);
+ const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
+ getChild<LLUICtrl>("send_btn")->setEnabled(have_snapshot);
}
bool LLPanelSnapshotPostcard::missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if(0 == option)
- {
- // User clicked OK
- if((getChild<LLUICtrl>("subject_form")->getValue().asString()).empty())
- {
- // Stuff the subject back into the form.
- getChild<LLUICtrl>("subject_form")->setValue(getString("default_subject"));
- }
-
- if (!mHasFirstMsgFocus)
- {
- // The user never switched focus to the message window.
- // Using the default string.
- getChild<LLUICtrl>("msg_form")->setValue(getString("default_message"));
- }
-
- sendPostcard();
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if(0 == option)
+ {
+ // User clicked OK
+ if((getChild<LLUICtrl>("subject_form")->getValue().asString()).empty())
+ {
+ // Stuff the subject back into the form.
+ getChild<LLUICtrl>("subject_form")->setValue(getString("default_subject"));
+ }
+
+ if (!mHasFirstMsgFocus)
+ {
+ // The user never switched focus to the message window.
+ // Using the default string.
+ getChild<LLUICtrl>("msg_form")->setValue(getString("default_message"));
+ }
+
+ sendPostcard();
+ }
+ return false;
}
@@ -198,53 +198,53 @@ void LLPanelSnapshotPostcard::sendPostcard()
void LLPanelSnapshotPostcard::onMsgFormFocusRecieved()
{
- LLTextEditor* msg_form = getChild<LLTextEditor>("msg_form");
- if (msg_form->hasFocus() && !mHasFirstMsgFocus)
- {
- mHasFirstMsgFocus = true;
- msg_form->setText(LLStringUtil::null);
- }
+ LLTextEditor* msg_form = getChild<LLTextEditor>("msg_form");
+ if (msg_form->hasFocus() && !mHasFirstMsgFocus)
+ {
+ mHasFirstMsgFocus = true;
+ msg_form->setText(LLStringUtil::null);
+ }
}
void LLPanelSnapshotPostcard::onFormatComboCommit(LLUICtrl* ctrl)
{
- // will call updateControls()
- LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true));
+ // will call updateControls()
+ LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true));
}
void LLPanelSnapshotPostcard::onQualitySliderCommit(LLUICtrl* ctrl)
{
- updateImageQualityLevel();
+ updateImageQualityLevel();
- LLSliderCtrl* slider = (LLSliderCtrl*)ctrl;
- S32 quality_val = llfloor((F32)slider->getValue().asReal());
- LLSD info;
- info["image-quality-change"] = quality_val;
- LLFloaterSnapshot::getInstance()->notify(info); // updates the "SnapshotQuality" setting
+ LLSliderCtrl* slider = (LLSliderCtrl*)ctrl;
+ S32 quality_val = llfloor((F32)slider->getValue().asReal());
+ LLSD info;
+ info["image-quality-change"] = quality_val;
+ LLFloaterSnapshot::getInstance()->notify(info); // updates the "SnapshotQuality" setting
}
void LLPanelSnapshotPostcard::onSend()
{
- // Validate input.
- std::string to(getChild<LLUICtrl>("to_form")->getValue().asString());
-
- boost::regex email_format("[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}(,[ \t]*[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})*");
-
- if (to.empty() || !ll_regex_match(to, email_format))
- {
- LLNotificationsUtil::add("PromptRecipientEmail");
- return;
- }
-
- std::string subject(getChild<LLUICtrl>("subject_form")->getValue().asString());
- if(subject.empty() || !mHasFirstMsgFocus)
- {
- LLNotificationsUtil::add("PromptMissingSubjMsg", LLSD(), LLSD(), boost::bind(&LLPanelSnapshotPostcard::missingSubjMsgAlertCallback, this, _1, _2));
- return;
- }
-
- // Send postcard.
- sendPostcard();
+ // Validate input.
+ std::string to(getChild<LLUICtrl>("to_form")->getValue().asString());
+
+ boost::regex email_format("[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}(,[ \t]*[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})*");
+
+ if (to.empty() || !ll_regex_match(to, email_format))
+ {
+ LLNotificationsUtil::add("PromptRecipientEmail");
+ return;
+ }
+
+ std::string subject(getChild<LLUICtrl>("subject_form")->getValue().asString());
+ if(subject.empty() || !mHasFirstMsgFocus)
+ {
+ LLNotificationsUtil::add("PromptMissingSubjMsg", LLSD(), LLSD(), boost::bind(&LLPanelSnapshotPostcard::missingSubjMsgAlertCallback, this, _1, _2));
+ return;
+ }
+
+ // Send postcard.
+ sendPostcard();
}
LLSnapshotModel::ESnapshotType LLPanelSnapshotPostcard::getSnapshotType()
diff --git a/indra/newview/llpanelsnapshotprofile.cpp b/indra/newview/llpanelsnapshotprofile.cpp
index 38dec78030..7204235407 100644
--- a/indra/newview/llpanelsnapshotprofile.cpp
+++ b/indra/newview/llpanelsnapshotprofile.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelsnapshotprofile.cpp
* @brief Posts a snapshot to My Profile feed.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,60 +42,60 @@
* Posts a snapshot to My Profile feed.
*/
class LLPanelSnapshotProfile
-: public LLPanelSnapshot
+: public LLPanelSnapshot
{
- LOG_CLASS(LLPanelSnapshotProfile);
+ LOG_CLASS(LLPanelSnapshotProfile);
public:
- LLPanelSnapshotProfile();
+ LLPanelSnapshotProfile();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
private:
- /*virtual*/ std::string getWidthSpinnerName() const { return "profile_snapshot_width"; }
- /*virtual*/ std::string getHeightSpinnerName() const { return "profile_snapshot_height"; }
- /*virtual*/ std::string getAspectRatioCBName() const { return "profile_keep_aspect_check"; }
- /*virtual*/ std::string getImageSizeComboName() const { return "profile_size_combo"; }
- /*virtual*/ std::string getImageSizePanelName() const { return "profile_image_size_lp"; }
- /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat() const { return LLSnapshotModel::SNAPSHOT_FORMAT_PNG; }
- /*virtual*/ void updateControls(const LLSD& info);
+ /*virtual*/ std::string getWidthSpinnerName() const { return "profile_snapshot_width"; }
+ /*virtual*/ std::string getHeightSpinnerName() const { return "profile_snapshot_height"; }
+ /*virtual*/ std::string getAspectRatioCBName() const { return "profile_keep_aspect_check"; }
+ /*virtual*/ std::string getImageSizeComboName() const { return "profile_size_combo"; }
+ /*virtual*/ std::string getImageSizePanelName() const { return "profile_image_size_lp"; }
+ /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat() const { return LLSnapshotModel::SNAPSHOT_FORMAT_PNG; }
+ /*virtual*/ void updateControls(const LLSD& info);
- void onSend();
+ void onSend();
};
static LLPanelInjector<LLPanelSnapshotProfile> panel_class("llpanelsnapshotprofile");
LLPanelSnapshotProfile::LLPanelSnapshotProfile()
{
- mCommitCallbackRegistrar.add("PostToProfile.Send", boost::bind(&LLPanelSnapshotProfile::onSend, this));
- mCommitCallbackRegistrar.add("PostToProfile.Cancel", boost::bind(&LLPanelSnapshotProfile::cancel, this));
+ mCommitCallbackRegistrar.add("PostToProfile.Send", boost::bind(&LLPanelSnapshotProfile::onSend, this));
+ mCommitCallbackRegistrar.add("PostToProfile.Cancel", boost::bind(&LLPanelSnapshotProfile::cancel, this));
}
// virtual
BOOL LLPanelSnapshotProfile::postBuild()
{
- return LLPanelSnapshot::postBuild();
+ return LLPanelSnapshot::postBuild();
}
// virtual
void LLPanelSnapshotProfile::onOpen(const LLSD& key)
{
- LLPanelSnapshot::onOpen(key);
+ LLPanelSnapshot::onOpen(key);
}
// virtual
void LLPanelSnapshotProfile::updateControls(const LLSD& info)
{
- const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
- getChild<LLUICtrl>("post_btn")->setEnabled(have_snapshot);
+ const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
+ getChild<LLUICtrl>("post_btn")->setEnabled(have_snapshot);
}
void LLPanelSnapshotProfile::onSend()
{
- std::string caption = getChild<LLUICtrl>("caption")->getValue().asString();
- bool add_location = getChild<LLUICtrl>("add_location_cb")->getValue().asBoolean();
+ std::string caption = getChild<LLUICtrl>("caption")->getValue().asString();
+ bool add_location = getChild<LLUICtrl>("add_location_cb")->getValue().asBoolean();
- LLWebProfile::uploadImage(mSnapshotFloater->getImageData(), caption, add_location);
- mSnapshotFloater->postSave();
+ LLWebProfile::uploadImage(mSnapshotFloater->getImageData(), caption, add_location);
+ mSnapshotFloater->postSave();
}
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 3ed444a5af..627074efa9 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelteleporthistory.cpp
* @brief Teleport history represented by a scrolling list
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,49 +56,49 @@ static const std::string COLLAPSED_BY_USER = "collapsed_by_user";
class LLTeleportHistoryFlatItem : public LLPanel
{
public:
- LLTeleportHistoryFlatItem(S32 index, LLToggleableMenu *menu, const std::string &region_name,
- LLDate date, const std::string &hl);
- virtual ~LLTeleportHistoryFlatItem();
+ LLTeleportHistoryFlatItem(S32 index, LLToggleableMenu *menu, const std::string &region_name,
+ LLDate date, const std::string &hl);
+ virtual ~LLTeleportHistoryFlatItem();
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- /*virtual*/ S32 notify(const LLSD& info);
+ /*virtual*/ S32 notify(const LLSD& info);
- S32 getIndex() { return mIndex; }
- void setIndex(S32 index) { mIndex = index; }
- const std::string& getRegionName() { return mRegionName;}
- void setRegionName(const std::string& name);
- void setDate(LLDate date);
- void setHighlightedText(const std::string& text);
- void updateTitle();
- void updateTimestamp();
- std::string getTimestamp();
+ S32 getIndex() { return mIndex; }
+ void setIndex(S32 index) { mIndex = index; }
+ const std::string& getRegionName() { return mRegionName;}
+ void setRegionName(const std::string& name);
+ void setDate(LLDate date);
+ void setHighlightedText(const std::string& text);
+ void updateTitle();
+ void updateTimestamp();
+ std::string getTimestamp();
- /*virtual*/ void setValue(const LLSD& value);
+ /*virtual*/ void setValue(const LLSD& value);
- void onMouseEnter(S32 x, S32 y, MASK mask);
- void onMouseLeave(S32 x, S32 y, MASK mask);
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ void onMouseEnter(S32 x, S32 y, MASK mask);
+ void onMouseLeave(S32 x, S32 y, MASK mask);
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- static void showPlaceInfoPanel(S32 index);
+ static void showPlaceInfoPanel(S32 index);
- LLHandle<LLTeleportHistoryFlatItem> getItemHandle() { mItemHandle.bind(this); return mItemHandle; }
+ LLHandle<LLTeleportHistoryFlatItem> getItemHandle() { mItemHandle.bind(this); return mItemHandle; }
private:
- void onProfileBtnClick();
+ void onProfileBtnClick();
void showMenu(S32 x, S32 y);
- LLButton* mProfileBtn;
- LLTextBox* mTitle;
- LLTextBox* mTimeTextBox;
-
- LLToggleableMenu *mMenu;
-
- S32 mIndex;
- std::string mRegionName;
- std::string mHighlight;
- LLDate mDate;
- LLRootHandle<LLTeleportHistoryFlatItem> mItemHandle;
+ LLButton* mProfileBtn;
+ LLTextBox* mTitle;
+ LLTextBox* mTimeTextBox;
+
+ LLToggleableMenu *mMenu;
+
+ S32 mIndex;
+ std::string mRegionName;
+ std::string mHighlight;
+ LLDate mDate;
+ LLRootHandle<LLTeleportHistoryFlatItem> mItemHandle;
};
////////////////////////////////////////////////////////////////////////////////
@@ -107,24 +107,24 @@ private:
class LLTeleportHistoryFlatItemStorage: public LLSingleton<LLTeleportHistoryFlatItemStorage>
{
- LLSINGLETON_EMPTY_CTOR(LLTeleportHistoryFlatItemStorage);
+ LLSINGLETON_EMPTY_CTOR(LLTeleportHistoryFlatItemStorage);
protected:
- typedef std::vector< LLHandle<LLTeleportHistoryFlatItem> > flat_item_list_t;
+ typedef std::vector< LLHandle<LLTeleportHistoryFlatItem> > flat_item_list_t;
public:
- LLTeleportHistoryFlatItem* getFlatItemForPersistentItem (
- LLToggleableMenu *menu,
- const LLTeleportHistoryPersistentItem& persistent_item,
- const S32 cur_item_index,
- const std::string &hl);
+ LLTeleportHistoryFlatItem* getFlatItemForPersistentItem (
+ LLToggleableMenu *menu,
+ const LLTeleportHistoryPersistentItem& persistent_item,
+ const S32 cur_item_index,
+ const std::string &hl);
- void removeItem(LLTeleportHistoryFlatItem* item);
+ void removeItem(LLTeleportHistoryFlatItem* item);
- void purge();
+ void purge();
private:
- flat_item_list_t mItems;
+ flat_item_list_t mItems;
};
////////////////////////////////////////////////////////////////////////////////
@@ -132,15 +132,15 @@ private:
////////////////////////////////////////////////////////////////////////////////
LLTeleportHistoryFlatItem::LLTeleportHistoryFlatItem(S32 index, LLToggleableMenu *menu, const std::string &region_name,
- LLDate date, const std::string &hl)
-: LLPanel(),
- mIndex(index),
- mMenu(menu),
- mRegionName(region_name),
- mDate(date),
- mHighlight(hl)
+ LLDate date, const std::string &hl)
+: LLPanel(),
+ mIndex(index),
+ mMenu(menu),
+ mRegionName(region_name),
+ mDate(date),
+ mHighlight(hl)
{
- buildFromFile("panel_teleport_history_item.xml");
+ buildFromFile("panel_teleport_history_item.xml");
}
LLTeleportHistoryFlatItem::~LLTeleportHistoryFlatItem()
@@ -150,140 +150,140 @@ LLTeleportHistoryFlatItem::~LLTeleportHistoryFlatItem()
//virtual
BOOL LLTeleportHistoryFlatItem::postBuild()
{
- mTitle = getChild<LLTextBox>("region");
+ mTitle = getChild<LLTextBox>("region");
- mTimeTextBox = getChild<LLTextBox>("timestamp");
+ mTimeTextBox = getChild<LLTextBox>("timestamp");
- mProfileBtn = getChild<LLButton>("profile_btn");
-
- mProfileBtn->setClickedCallback(boost::bind(&LLTeleportHistoryFlatItem::onProfileBtnClick, this));
+ mProfileBtn = getChild<LLButton>("profile_btn");
- updateTitle();
- updateTimestamp();
+ mProfileBtn->setClickedCallback(boost::bind(&LLTeleportHistoryFlatItem::onProfileBtnClick, this));
- return true;
+ updateTitle();
+ updateTimestamp();
+
+ return true;
}
S32 LLTeleportHistoryFlatItem::notify(const LLSD& info)
{
- if(info.has("detach"))
- {
- delete mMouseDownSignal;
- mMouseDownSignal = NULL;
- delete mRightMouseDownSignal;
- mRightMouseDownSignal = NULL;
- return 1;
- }
- return 0;
+ if(info.has("detach"))
+ {
+ delete mMouseDownSignal;
+ mMouseDownSignal = NULL;
+ delete mRightMouseDownSignal;
+ mRightMouseDownSignal = NULL;
+ return 1;
+ }
+ return 0;
}
void LLTeleportHistoryFlatItem::setValue(const LLSD& value)
{
- if (!value.isMap()) return;;
- if (!value.has("selected")) return;
- getChildView("selected_icon")->setVisible( value["selected"]);
+ if (!value.isMap()) return;;
+ if (!value.has("selected")) return;
+ getChildView("selected_icon")->setVisible( value["selected"]);
}
void LLTeleportHistoryFlatItem::setHighlightedText(const std::string& text)
{
- mHighlight = text;
+ mHighlight = text;
}
void LLTeleportHistoryFlatItem::setRegionName(const std::string& name)
{
- mRegionName = name;
+ mRegionName = name;
}
void LLTeleportHistoryFlatItem::setDate(LLDate date)
{
- mDate = date;
+ mDate = date;
}
std::string LLTeleportHistoryFlatItem::getTimestamp()
{
- const LLDate &date = mDate;
- std::string timestamp = "";
+ const LLDate &date = mDate;
+ std::string timestamp = "";
- LLDate now = LLDate::now();
- S32 now_year, now_month, now_day, now_hour, now_min, now_sec;
- now.split(&now_year, &now_month, &now_day, &now_hour, &now_min, &now_sec);
+ LLDate now = LLDate::now();
+ S32 now_year, now_month, now_day, now_hour, now_min, now_sec;
+ now.split(&now_year, &now_month, &now_day, &now_hour, &now_min, &now_sec);
- const S32 seconds_in_day = 24 * 60 * 60;
- S32 seconds_today = now_hour * 60 * 60 + now_min * 60 + now_sec;
- S32 time_diff = (S32) now.secondsSinceEpoch() - (S32) date.secondsSinceEpoch();
+ const S32 seconds_in_day = 24 * 60 * 60;
+ S32 seconds_today = now_hour * 60 * 60 + now_min * 60 + now_sec;
+ S32 time_diff = (S32) now.secondsSinceEpoch() - (S32) date.secondsSinceEpoch();
- // Only show timestamp for today and yesterday
- if(time_diff < seconds_today + seconds_in_day)
- {
- timestamp = "[" + LLTrans::getString("TimeHour12")+"]:["
- + LLTrans::getString("TimeMin")+"] ["+ LLTrans::getString("TimeAMPM")+"]";
- LLSD substitution;
- substitution["datetime"] = (S32) date.secondsSinceEpoch();
- LLStringUtil::format(timestamp, substitution);
- }
+ // Only show timestamp for today and yesterday
+ if(time_diff < seconds_today + seconds_in_day)
+ {
+ timestamp = "[" + LLTrans::getString("TimeHour12")+"]:["
+ + LLTrans::getString("TimeMin")+"] ["+ LLTrans::getString("TimeAMPM")+"]";
+ LLSD substitution;
+ substitution["datetime"] = (S32) date.secondsSinceEpoch();
+ LLStringUtil::format(timestamp, substitution);
+ }
- return timestamp;
+ return timestamp;
}
void LLTeleportHistoryFlatItem::updateTitle()
{
- static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4U(255, 255, 255));
+ static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4U(255, 255, 255));
- LLTextUtil::textboxSetHighlightedVal(
- mTitle,
- LLStyle::Params().color(sFgColor),
- mRegionName,
- mHighlight);
+ LLTextUtil::textboxSetHighlightedVal(
+ mTitle,
+ LLStyle::Params().color(sFgColor),
+ mRegionName,
+ mHighlight);
}
void LLTeleportHistoryFlatItem::updateTimestamp()
{
- static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4U(255, 255, 255));
+ static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4U(255, 255, 255));
- LLTextUtil::textboxSetHighlightedVal(
- mTimeTextBox,
- LLStyle::Params().color(sFgColor),
- getTimestamp(),
- mHighlight);
+ LLTextUtil::textboxSetHighlightedVal(
+ mTimeTextBox,
+ LLStyle::Params().color(sFgColor),
+ getTimestamp(),
+ mHighlight);
}
void LLTeleportHistoryFlatItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible( true);
- mProfileBtn->setVisible(true);
+ getChildView("hovered_icon")->setVisible( true);
+ mProfileBtn->setVisible(true);
- LLPanel::onMouseEnter(x, y, mask);
+ LLPanel::onMouseEnter(x, y, mask);
}
void LLTeleportHistoryFlatItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
- getChildView("hovered_icon")->setVisible( false);
- mProfileBtn->setVisible(false);
+ getChildView("hovered_icon")->setVisible( false);
+ mProfileBtn->setVisible(false);
- LLPanel::onMouseLeave(x, y, mask);
+ LLPanel::onMouseLeave(x, y, mask);
}
// virtual
BOOL LLTeleportHistoryFlatItem::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
LLPanel::handleRightMouseDown(x, y, mask);
- showMenu(x, y);
+ showMenu(x, y);
return TRUE;
}
void LLTeleportHistoryFlatItem::showPlaceInfoPanel(S32 index)
{
- LLSD params;
- params["id"] = index;
- params["type"] = "teleport_history";
+ LLSD params;
+ params["id"] = index;
+ params["type"] = "teleport_history";
- LLFloaterSidePanelContainer::showPanel("places", params);
+ LLFloaterSidePanelContainer::showPanel("places", params);
}
void LLTeleportHistoryFlatItem::onProfileBtnClick()
{
- LLTeleportHistoryFlatItem::showPlaceInfoPanel(mIndex);
+ LLTeleportHistoryFlatItem::showPlaceInfoPanel(mIndex);
}
void LLTeleportHistoryFlatItem::showMenu(S32 x, S32 y)
@@ -302,73 +302,73 @@ void LLTeleportHistoryFlatItem::showMenu(S32 x, S32 y)
LLTeleportHistoryFlatItem*
LLTeleportHistoryFlatItemStorage::getFlatItemForPersistentItem (
- LLToggleableMenu *menu,
- const LLTeleportHistoryPersistentItem& persistent_item,
- const S32 cur_item_index,
- const std::string &hl)
+ LLToggleableMenu *menu,
+ const LLTeleportHistoryPersistentItem& persistent_item,
+ const S32 cur_item_index,
+ const std::string &hl)
{
- LLTeleportHistoryFlatItem* item = NULL;
- if ( cur_item_index < (S32) mItems.size() )
- {
- item = mItems[cur_item_index].get();
- if (item->getParent() == NULL)
- {
- item->setIndex(cur_item_index);
- item->setRegionName(persistent_item.mTitle);
- item->setDate(persistent_item.mDate);
- item->setHighlightedText(hl);
- item->setVisible(TRUE);
- item->updateTitle();
- item->updateTimestamp();
- }
- else
- {
- // Item already added to parent
- item = NULL;
- }
- }
-
- if ( !item )
- {
- item = new LLTeleportHistoryFlatItem(cur_item_index,
- menu,
- persistent_item.mTitle,
- persistent_item.mDate,
- hl);
- mItems.push_back(item->getItemHandle());
- }
-
- return item;
+ LLTeleportHistoryFlatItem* item = NULL;
+ if ( cur_item_index < (S32) mItems.size() )
+ {
+ item = mItems[cur_item_index].get();
+ if (item->getParent() == NULL)
+ {
+ item->setIndex(cur_item_index);
+ item->setRegionName(persistent_item.mTitle);
+ item->setDate(persistent_item.mDate);
+ item->setHighlightedText(hl);
+ item->setVisible(TRUE);
+ item->updateTitle();
+ item->updateTimestamp();
+ }
+ else
+ {
+ // Item already added to parent
+ item = NULL;
+ }
+ }
+
+ if ( !item )
+ {
+ item = new LLTeleportHistoryFlatItem(cur_item_index,
+ menu,
+ persistent_item.mTitle,
+ persistent_item.mDate,
+ hl);
+ mItems.push_back(item->getItemHandle());
+ }
+
+ return item;
}
void LLTeleportHistoryFlatItemStorage::removeItem(LLTeleportHistoryFlatItem* item)
{
- if (item)
- {
- flat_item_list_t::iterator item_iter = std::find(mItems.begin(),
- mItems.end(),
- item->getItemHandle());
- if (item_iter != mItems.end())
- {
- mItems.erase(item_iter);
- }
- }
+ if (item)
+ {
+ flat_item_list_t::iterator item_iter = std::find(mItems.begin(),
+ mItems.end(),
+ item->getItemHandle());
+ if (item_iter != mItems.end())
+ {
+ mItems.erase(item_iter);
+ }
+ }
}
void LLTeleportHistoryFlatItemStorage::purge()
{
- for ( flat_item_list_t::iterator
- it = mItems.begin(),
- it_end = mItems.end();
- it != it_end; ++it )
- {
- LLHandle <LLTeleportHistoryFlatItem> item_handle = *it;
- if ( !item_handle.isDead() && item_handle.get()->getParent() == NULL )
- {
- item_handle.get()->die();
- }
- }
- mItems.clear();
+ for ( flat_item_list_t::iterator
+ it = mItems.begin(),
+ it_end = mItems.end();
+ it != it_end; ++it )
+ {
+ LLHandle <LLTeleportHistoryFlatItem> item_handle = *it;
+ if ( !item_handle.isDead() && item_handle.get()->getParent() == NULL )
+ {
+ item_handle.get()->die();
+ }
+ }
+ mItems.clear();
}
////////////////////////////////////////////////////////////////////////////////
@@ -380,24 +380,24 @@ void LLTeleportHistoryFlatItemStorage::purge()
//static LLRegisterPanelClassWrapper<LLTeleportHistoryPanel> t_teleport_history("panel_teleport_history");
LLTeleportHistoryPanel::LLTeleportHistoryPanel()
- : LLPanelPlacesTab(),
- mDirty(true),
- mCurrentItem(0),
- mTeleportHistory(NULL),
- mHistoryAccordion(NULL),
- mAccordionTabMenu(NULL),
- mLastSelectedFlatlList(NULL),
- mLastSelectedItemIndex(-1),
- mGearItemMenu(NULL),
- mSortingMenu(NULL)
+ : LLPanelPlacesTab(),
+ mDirty(true),
+ mCurrentItem(0),
+ mTeleportHistory(NULL),
+ mHistoryAccordion(NULL),
+ mAccordionTabMenu(NULL),
+ mLastSelectedFlatlList(NULL),
+ mLastSelectedItemIndex(-1),
+ mGearItemMenu(NULL),
+ mSortingMenu(NULL)
{
- buildFromFile( "panel_teleport_history.xml");
+ buildFromFile( "panel_teleport_history.xml");
}
LLTeleportHistoryPanel::~LLTeleportHistoryPanel()
{
- LLTeleportHistoryFlatItemStorage::instance().purge();
- mTeleportHistoryChangedConnection.disconnect();
+ LLTeleportHistoryFlatItemStorage::instance().purge();
+ mTeleportHistoryChangedConnection.disconnect();
}
BOOL LLTeleportHistoryPanel::postBuild()
@@ -410,128 +410,128 @@ BOOL LLTeleportHistoryPanel::postBuild()
mGearItemMenu->setAlwaysShowMenu(TRUE); // all items can be disabled if nothing is selected, show anyway
mSortingMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_teleport_history_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- mTeleportHistory = LLTeleportHistoryStorage::getInstance();
- if (mTeleportHistory)
- {
- mTeleportHistoryChangedConnection = mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::onTeleportHistoryChange, this, _1));
- }
-
- mHistoryAccordion = getChild<LLAccordionCtrl>("history_accordion");
-
- if (mHistoryAccordion)
- {
- for (child_list_const_iter_t iter = mHistoryAccordion->beginChild(); iter != mHistoryAccordion->endChild(); iter++)
- {
- if (dynamic_cast<LLAccordionCtrlTab*>(*iter))
- {
- LLAccordionCtrlTab* tab = (LLAccordionCtrlTab*)*iter;
- tab->setRightMouseDownCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionTabRightClick, this, _1, _2, _3, _4));
- tab->setDisplayChildren(false);
- tab->setDropDownStateChangedCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionExpand, this, _1, _2));
-
- // All accordion tabs are collapsed initially
- setAccordionCollapsedByUser(tab, true);
-
- mItemContainers.push_back(tab);
-
- LLFlatListView* fl = getFlatListViewFromTab(tab);
- if (fl)
- {
- fl->setCommitOnSelectionChange(true);
- fl->setDoubleClickCallback(boost::bind(&LLTeleportHistoryPanel::onDoubleClickItem, this));
- fl->setCommitCallback(boost::bind(&LLTeleportHistoryPanel::handleItemSelect, this, fl));
- fl->setReturnCallback(boost::bind(&LLTeleportHistoryPanel::onReturnKeyPressed, this));
- }
- }
- }
-
- // Open first 2 accordion tabs
- if (mItemContainers.size() > 1)
- {
- LLAccordionCtrlTab* tab = mItemContainers.at(mItemContainers.size() - 1);
- tab->setDisplayChildren(true);
- setAccordionCollapsedByUser(tab, false);
- }
-
- if (mItemContainers.size() > 2)
- {
- LLAccordionCtrlTab* tab = mItemContainers.at(mItemContainers.size() - 2);
- tab->setDisplayChildren(true);
- setAccordionCollapsedByUser(tab, false);
- }
- }
-
- return TRUE;
+ mTeleportHistory = LLTeleportHistoryStorage::getInstance();
+ if (mTeleportHistory)
+ {
+ mTeleportHistoryChangedConnection = mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::onTeleportHistoryChange, this, _1));
+ }
+
+ mHistoryAccordion = getChild<LLAccordionCtrl>("history_accordion");
+
+ if (mHistoryAccordion)
+ {
+ for (child_list_const_iter_t iter = mHistoryAccordion->beginChild(); iter != mHistoryAccordion->endChild(); iter++)
+ {
+ if (dynamic_cast<LLAccordionCtrlTab*>(*iter))
+ {
+ LLAccordionCtrlTab* tab = (LLAccordionCtrlTab*)*iter;
+ tab->setRightMouseDownCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionTabRightClick, this, _1, _2, _3, _4));
+ tab->setDisplayChildren(false);
+ tab->setDropDownStateChangedCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionExpand, this, _1, _2));
+
+ // All accordion tabs are collapsed initially
+ setAccordionCollapsedByUser(tab, true);
+
+ mItemContainers.push_back(tab);
+
+ LLFlatListView* fl = getFlatListViewFromTab(tab);
+ if (fl)
+ {
+ fl->setCommitOnSelectionChange(true);
+ fl->setDoubleClickCallback(boost::bind(&LLTeleportHistoryPanel::onDoubleClickItem, this));
+ fl->setCommitCallback(boost::bind(&LLTeleportHistoryPanel::handleItemSelect, this, fl));
+ fl->setReturnCallback(boost::bind(&LLTeleportHistoryPanel::onReturnKeyPressed, this));
+ }
+ }
+ }
+
+ // Open first 2 accordion tabs
+ if (mItemContainers.size() > 1)
+ {
+ LLAccordionCtrlTab* tab = mItemContainers.at(mItemContainers.size() - 1);
+ tab->setDisplayChildren(true);
+ setAccordionCollapsedByUser(tab, false);
+ }
+
+ if (mItemContainers.size() > 2)
+ {
+ LLAccordionCtrlTab* tab = mItemContainers.at(mItemContainers.size() - 2);
+ tab->setDisplayChildren(true);
+ setAccordionCollapsedByUser(tab, false);
+ }
+ }
+
+ return TRUE;
}
// virtual
void LLTeleportHistoryPanel::draw()
{
- if (mDirty)
- refresh();
+ if (mDirty)
+ refresh();
- LLPanelPlacesTab::draw();
+ LLPanelPlacesTab::draw();
}
// virtual
void LLTeleportHistoryPanel::onSearchEdit(const std::string& string)
{
- sFilterSubString = string;
- showTeleportHistory();
+ sFilterSubString = string;
+ showTeleportHistory();
}
// virtual
bool LLTeleportHistoryPanel::isSingleItemSelected()
{
- return mLastSelectedFlatlList && mLastSelectedFlatlList->getSelectedItem();
+ return mLastSelectedFlatlList && mLastSelectedFlatlList->getSelectedItem();
}
// virtual
void LLTeleportHistoryPanel::onShowOnMap()
{
- if (!mLastSelectedFlatlList)
- return;
+ if (!mLastSelectedFlatlList)
+ return;
- LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
+ LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
- if(!itemp)
- return;
+ if(!itemp)
+ return;
- LLVector3d global_pos = mTeleportHistory->getItems()[itemp->getIndex()].mGlobalPos;
+ LLVector3d global_pos = mTeleportHistory->getItems()[itemp->getIndex()].mGlobalPos;
- if (!global_pos.isExactlyZero())
- {
- LLFloaterWorldMap::getInstance()->trackLocation(global_pos);
- LLFloaterReg::showInstance("world_map", "center");
- }
+ if (!global_pos.isExactlyZero())
+ {
+ LLFloaterWorldMap::getInstance()->trackLocation(global_pos);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
}
//virtual
void LLTeleportHistoryPanel::onShowProfile()
{
- if (!mLastSelectedFlatlList)
- return;
+ if (!mLastSelectedFlatlList)
+ return;
- LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
+ LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
- if(!itemp)
- return;
+ if(!itemp)
+ return;
- LLTeleportHistoryFlatItem::showPlaceInfoPanel(itemp->getIndex());
+ LLTeleportHistoryFlatItem::showPlaceInfoPanel(itemp->getIndex());
}
// virtual
void LLTeleportHistoryPanel::onTeleport()
{
- if (!mLastSelectedFlatlList)
- return;
+ if (!mLastSelectedFlatlList)
+ return;
- LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
- if(!itemp)
- return;
+ LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
+ if(!itemp)
+ return;
- // teleport to existing item in history, so we don't add it again
- confirmTeleport(itemp->getIndex());
+ // teleport to existing item in history, so we don't add it again
+ confirmTeleport(itemp->getIndex());
}
// virtual
@@ -544,36 +544,36 @@ void LLTeleportHistoryPanel::onRemoveSelected()
// virtual
void LLTeleportHistoryPanel::onCopySLURL()
{
- LLScrollListItem* itemp = mHistoryItems->getFirstSelected();
- if(!itemp)
- return;
+ LLScrollListItem* itemp = mHistoryItems->getFirstSelected();
+ if(!itemp)
+ return;
- S32 index = itemp->getColumn(LIST_INDEX)->getValue().asInteger();
+ S32 index = itemp->getColumn(LIST_INDEX)->getValue().asInteger();
- const LLTeleportHistory::slurl_list_t& hist_items = mTeleportHistory->getItems();
+ const LLTeleportHistory::slurl_list_t& hist_items = mTeleportHistory->getItems();
- LLVector3d global_pos = hist_items[index].mGlobalPos;
+ LLVector3d global_pos = hist_items[index].mGlobalPos;
- U64 new_region_handle = to_region_handle(global_pos);
+ U64 new_region_handle = to_region_handle(global_pos);
- LLWorldMapMessage::url_callback_t cb = boost::bind(
- &LLPanelPlacesTab::onRegionResponse, this,
- global_pos, _1, _2, _3, _4);
+ LLWorldMapMessage::url_callback_t cb = boost::bind(
+ &LLPanelPlacesTab::onRegionResponse, this,
+ global_pos, _1, _2, _3, _4);
- LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle, cb, std::string("unused"), false);
+ LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle, cb, std::string("unused"), false);
}
*/
// virtual
void LLTeleportHistoryPanel::updateVerbs()
{
- if (!isTabVisible())
- return;
+ if (!isTabVisible())
+ return;
- if (sRemoveBtn)
- {
- sRemoveBtn->setEnabled(true);
- }
+ if (sRemoveBtn)
+ {
+ sRemoveBtn->setEnabled(true);
+ }
}
// virtual
@@ -596,407 +596,407 @@ LLToggleableMenu* LLTeleportHistoryPanel::getCreateMenu()
void LLTeleportHistoryPanel::getNextTab(const LLDate& item_date, S32& tab_idx, LLDate& tab_date)
{
- const U32 seconds_in_day = 24 * 60 * 60;
-
- S32 tabs_cnt = mItemContainers.size();
- S32 curr_year = 0, curr_month = 0, curr_day = 0;
-
- tab_date = LLDate::now();
- tab_date.split(&curr_year, &curr_month, &curr_day);
- tab_date.fromYMDHMS(curr_year, curr_month, curr_day); // Set hour, min, and sec to 0
- tab_date.secondsSinceEpoch(tab_date.secondsSinceEpoch() + seconds_in_day);
-
- tab_idx = -1;
-
- while (tab_idx < tabs_cnt - 1 && item_date < tab_date)
- {
- tab_idx++;
-
- if (tab_idx <= tabs_cnt - 4)
- {
- // All tabs, except last three, are tabs for one day, so just push tab_date back by one day
- tab_date.secondsSinceEpoch(tab_date.secondsSinceEpoch() - seconds_in_day);
- }
- else if (tab_idx == tabs_cnt - 3) // 6 day and older, low boundary is 1 month
- {
- tab_date = LLDate::now();
- tab_date.split(&curr_year, &curr_month, &curr_day);
- curr_month--;
- if (0 == curr_month)
- {
- curr_month = 12;
- curr_year--;
- }
- tab_date.fromYMDHMS(curr_year, curr_month, curr_day);
- }
- else if (tab_idx == tabs_cnt - 2) // 1 month and older, low boundary is 6 months
- {
- tab_date = LLDate::now();
- tab_date.split(&curr_year, &curr_month, &curr_day);
- if (curr_month > 6)
- {
- curr_month -= 6;
- }
- else
- {
- curr_month += 6;
- curr_year--;
- }
- tab_date.fromYMDHMS(curr_year, curr_month, curr_day);
- }
- else // 6 months and older
- {
- tab_date.secondsSinceEpoch(0);
- }
- }
+ const U32 seconds_in_day = 24 * 60 * 60;
+
+ S32 tabs_cnt = mItemContainers.size();
+ S32 curr_year = 0, curr_month = 0, curr_day = 0;
+
+ tab_date = LLDate::now();
+ tab_date.split(&curr_year, &curr_month, &curr_day);
+ tab_date.fromYMDHMS(curr_year, curr_month, curr_day); // Set hour, min, and sec to 0
+ tab_date.secondsSinceEpoch(tab_date.secondsSinceEpoch() + seconds_in_day);
+
+ tab_idx = -1;
+
+ while (tab_idx < tabs_cnt - 1 && item_date < tab_date)
+ {
+ tab_idx++;
+
+ if (tab_idx <= tabs_cnt - 4)
+ {
+ // All tabs, except last three, are tabs for one day, so just push tab_date back by one day
+ tab_date.secondsSinceEpoch(tab_date.secondsSinceEpoch() - seconds_in_day);
+ }
+ else if (tab_idx == tabs_cnt - 3) // 6 day and older, low boundary is 1 month
+ {
+ tab_date = LLDate::now();
+ tab_date.split(&curr_year, &curr_month, &curr_day);
+ curr_month--;
+ if (0 == curr_month)
+ {
+ curr_month = 12;
+ curr_year--;
+ }
+ tab_date.fromYMDHMS(curr_year, curr_month, curr_day);
+ }
+ else if (tab_idx == tabs_cnt - 2) // 1 month and older, low boundary is 6 months
+ {
+ tab_date = LLDate::now();
+ tab_date.split(&curr_year, &curr_month, &curr_day);
+ if (curr_month > 6)
+ {
+ curr_month -= 6;
+ }
+ else
+ {
+ curr_month += 6;
+ curr_year--;
+ }
+ tab_date.fromYMDHMS(curr_year, curr_month, curr_day);
+ }
+ else // 6 months and older
+ {
+ tab_date.secondsSinceEpoch(0);
+ }
+ }
}
// Called to add items, no more, than ADD_LIMIT at time
void LLTeleportHistoryPanel::refresh()
{
- if (!mHistoryAccordion)
- {
- mDirty = false;
- return;
- }
-
- const LLTeleportHistoryStorage::slurl_list_t& items = mTeleportHistory->getItems();
-
- // Setting tab_boundary_date to "now", so date from any item would be earlier, than boundary.
- // That leads to call to getNextTab to get right tab_idx in first pass
- LLDate tab_boundary_date = LLDate::now();
-
- LLFlatListView* curr_flat_view = NULL;
- std::string filter_string = sFilterSubString;
- LLStringUtil::toUpper(filter_string);
-
- U32 added_items = 0;
- while (mCurrentItem >= 0)
- {
- // Filtering
- if (!filter_string.empty())
- {
- std::string landmark_title(items[mCurrentItem].mTitle);
- LLStringUtil::toUpper(landmark_title);
- if( std::string::npos == landmark_title.find(filter_string) )
- {
- mCurrentItem--;
- continue;
- }
- }
-
- // Checking whether date of item is earlier, than tab_boundary_date.
- // In that case, item should be added to another tab
- const LLDate &date = items[mCurrentItem].mDate;
-
- if (date < tab_boundary_date)
- {
- // Getting apropriate tab_idx for this and subsequent items,
- // tab_boundary_date would be earliest possible date for this tab
- S32 tab_idx = 0;
- getNextTab(date, tab_idx, tab_boundary_date);
- tab_idx = mItemContainers.size() - 1 - tab_idx;
- if (tab_idx >= 0)
- {
- LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx);
- tab->setVisible(true);
-
- // Expand all accordion tabs when filtering
- if(!sFilterSubString.empty())
- {
- //store accordion tab state when filter is not empty
- tab->notifyChildren(LLSD().with("action","store_state"));
-
- tab->setDisplayChildren(true);
- }
- // Restore each tab's expand state when not filtering
- else
- {
- bool collapsed = isAccordionCollapsedByUser(tab);
- tab->setDisplayChildren(!collapsed);
-
- //restore accordion state after all those accodrion tabmanipulations
- tab->notifyChildren(LLSD().with("action","restore_state"));
- }
-
- curr_flat_view = getFlatListViewFromTab(tab);
- }
- }
-
- if (curr_flat_view)
- {
- LLTeleportHistoryFlatItem* item =
- LLTeleportHistoryFlatItemStorage::instance()
- .getFlatItemForPersistentItem(mGearItemMenu,
- items[mCurrentItem],
- mCurrentItem,
- filter_string);
- if ( !curr_flat_view->addItem(item, LLUUID::null, ADD_BOTTOM, false) )
- LL_ERRS() << "Couldn't add flat item to teleport history." << LL_ENDL;
- if (mLastSelectedItemIndex == mCurrentItem)
- curr_flat_view->selectItem(item, true);
- }
-
- mCurrentItem--;
-
- if (++added_items >= ADD_LIMIT)
- break;
- }
-
- for (S32 n = mItemContainers.size() - 1; n >= 0; --n)
- {
- LLAccordionCtrlTab* tab = mItemContainers.at(n);
- LLFlatListView* fv = getFlatListViewFromTab(tab);
- if (fv)
- {
- fv->notify(LLSD().with("rearrange", LLSD()));
- }
- }
-
- mHistoryAccordion->setFilterSubString(sFilterSubString);
-
- mHistoryAccordion->arrange();
-
- updateVerbs();
-
- if (mCurrentItem < 0)
- mDirty = false;
+ if (!mHistoryAccordion)
+ {
+ mDirty = false;
+ return;
+ }
+
+ const LLTeleportHistoryStorage::slurl_list_t& items = mTeleportHistory->getItems();
+
+ // Setting tab_boundary_date to "now", so date from any item would be earlier, than boundary.
+ // That leads to call to getNextTab to get right tab_idx in first pass
+ LLDate tab_boundary_date = LLDate::now();
+
+ LLFlatListView* curr_flat_view = NULL;
+ std::string filter_string = sFilterSubString;
+ LLStringUtil::toUpper(filter_string);
+
+ U32 added_items = 0;
+ while (mCurrentItem >= 0)
+ {
+ // Filtering
+ if (!filter_string.empty())
+ {
+ std::string landmark_title(items[mCurrentItem].mTitle);
+ LLStringUtil::toUpper(landmark_title);
+ if( std::string::npos == landmark_title.find(filter_string) )
+ {
+ mCurrentItem--;
+ continue;
+ }
+ }
+
+ // Checking whether date of item is earlier, than tab_boundary_date.
+ // In that case, item should be added to another tab
+ const LLDate &date = items[mCurrentItem].mDate;
+
+ if (date < tab_boundary_date)
+ {
+ // Getting apropriate tab_idx for this and subsequent items,
+ // tab_boundary_date would be earliest possible date for this tab
+ S32 tab_idx = 0;
+ getNextTab(date, tab_idx, tab_boundary_date);
+ tab_idx = mItemContainers.size() - 1 - tab_idx;
+ if (tab_idx >= 0)
+ {
+ LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx);
+ tab->setVisible(true);
+
+ // Expand all accordion tabs when filtering
+ if(!sFilterSubString.empty())
+ {
+ //store accordion tab state when filter is not empty
+ tab->notifyChildren(LLSD().with("action","store_state"));
+
+ tab->setDisplayChildren(true);
+ }
+ // Restore each tab's expand state when not filtering
+ else
+ {
+ bool collapsed = isAccordionCollapsedByUser(tab);
+ tab->setDisplayChildren(!collapsed);
+
+ //restore accordion state after all those accodrion tabmanipulations
+ tab->notifyChildren(LLSD().with("action","restore_state"));
+ }
+
+ curr_flat_view = getFlatListViewFromTab(tab);
+ }
+ }
+
+ if (curr_flat_view)
+ {
+ LLTeleportHistoryFlatItem* item =
+ LLTeleportHistoryFlatItemStorage::instance()
+ .getFlatItemForPersistentItem(mGearItemMenu,
+ items[mCurrentItem],
+ mCurrentItem,
+ filter_string);
+ if ( !curr_flat_view->addItem(item, LLUUID::null, ADD_BOTTOM, false) )
+ LL_ERRS() << "Couldn't add flat item to teleport history." << LL_ENDL;
+ if (mLastSelectedItemIndex == mCurrentItem)
+ curr_flat_view->selectItem(item, true);
+ }
+
+ mCurrentItem--;
+
+ if (++added_items >= ADD_LIMIT)
+ break;
+ }
+
+ for (S32 n = mItemContainers.size() - 1; n >= 0; --n)
+ {
+ LLAccordionCtrlTab* tab = mItemContainers.at(n);
+ LLFlatListView* fv = getFlatListViewFromTab(tab);
+ if (fv)
+ {
+ fv->notify(LLSD().with("rearrange", LLSD()));
+ }
+ }
+
+ mHistoryAccordion->setFilterSubString(sFilterSubString);
+
+ mHistoryAccordion->arrange();
+
+ updateVerbs();
+
+ if (mCurrentItem < 0)
+ mDirty = false;
}
void LLTeleportHistoryPanel::onTeleportHistoryChange(S32 removed_index)
{
- mLastSelectedItemIndex = -1;
-
- if (-1 == removed_index)
- showTeleportHistory(); // recreate all items
- else
- {
- replaceItem(removed_index); // replace removed item by most recent
- updateVerbs();
- }
+ mLastSelectedItemIndex = -1;
+
+ if (-1 == removed_index)
+ showTeleportHistory(); // recreate all items
+ else
+ {
+ replaceItem(removed_index); // replace removed item by most recent
+ updateVerbs();
+ }
}
void LLTeleportHistoryPanel::replaceItem(S32 removed_index)
{
- // Flat list for 'Today' (mItemContainers keeps accordion tabs in reverse order)
- LLFlatListView* fv = NULL;
-
- if (mItemContainers.size() > 0)
- {
- fv = getFlatListViewFromTab(mItemContainers[mItemContainers.size() - 1]);
- }
-
- // Empty flat list for 'Today' means that other flat lists are empty as well,
- // so all items from teleport history should be added.
- if (!fv || fv->size() == 0)
- {
- showTeleportHistory();
- return;
- }
-
- const LLTeleportHistoryStorage::slurl_list_t& history_items = mTeleportHistory->getItems();
- LLTeleportHistoryFlatItem* item = LLTeleportHistoryFlatItemStorage::instance()
- .getFlatItemForPersistentItem(mGearItemMenu,
- history_items[history_items.size() - 1], // Most recent item, it was added instead of removed
- history_items.size(), // index will be decremented inside loop below
- sFilterSubString);
-
- fv->addItem(item, LLUUID::null, ADD_TOP);
-
- // Index of each item, from last to removed item should be decremented
- // to point to the right item in LLTeleportHistoryStorage
- for (S32 tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx)
- {
- LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx);
- if (!tab->getVisible())
- continue;
-
- fv = getFlatListViewFromTab(tab);
- if (!fv)
- {
- showTeleportHistory();
- return;
- }
-
- std::vector<LLPanel*> items;
- fv->getItems(items);
-
- S32 items_cnt = items.size();
- for (S32 n = 0; n < items_cnt; ++n)
- {
- LLTeleportHistoryFlatItem *item = (LLTeleportHistoryFlatItem*) items[n];
-
- if (item->getIndex() == removed_index)
- {
- LLTeleportHistoryFlatItemStorage::instance().removeItem(item);
-
- fv->removeItem(item);
-
- // If flat list becames empty, then accordion tab should be hidden
- if (fv->size() == 0)
- tab->setVisible(false);
-
- mHistoryAccordion->arrange();
-
- return; // No need to decrement idexes for the rest of items
- }
-
- item->setIndex(item->getIndex() - 1);
- }
- }
+ // Flat list for 'Today' (mItemContainers keeps accordion tabs in reverse order)
+ LLFlatListView* fv = NULL;
+
+ if (mItemContainers.size() > 0)
+ {
+ fv = getFlatListViewFromTab(mItemContainers[mItemContainers.size() - 1]);
+ }
+
+ // Empty flat list for 'Today' means that other flat lists are empty as well,
+ // so all items from teleport history should be added.
+ if (!fv || fv->size() == 0)
+ {
+ showTeleportHistory();
+ return;
+ }
+
+ const LLTeleportHistoryStorage::slurl_list_t& history_items = mTeleportHistory->getItems();
+ LLTeleportHistoryFlatItem* item = LLTeleportHistoryFlatItemStorage::instance()
+ .getFlatItemForPersistentItem(mGearItemMenu,
+ history_items[history_items.size() - 1], // Most recent item, it was added instead of removed
+ history_items.size(), // index will be decremented inside loop below
+ sFilterSubString);
+
+ fv->addItem(item, LLUUID::null, ADD_TOP);
+
+ // Index of each item, from last to removed item should be decremented
+ // to point to the right item in LLTeleportHistoryStorage
+ for (S32 tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx)
+ {
+ LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx);
+ if (!tab->getVisible())
+ continue;
+
+ fv = getFlatListViewFromTab(tab);
+ if (!fv)
+ {
+ showTeleportHistory();
+ return;
+ }
+
+ std::vector<LLPanel*> items;
+ fv->getItems(items);
+
+ S32 items_cnt = items.size();
+ for (S32 n = 0; n < items_cnt; ++n)
+ {
+ LLTeleportHistoryFlatItem *item = (LLTeleportHistoryFlatItem*) items[n];
+
+ if (item->getIndex() == removed_index)
+ {
+ LLTeleportHistoryFlatItemStorage::instance().removeItem(item);
+
+ fv->removeItem(item);
+
+ // If flat list becames empty, then accordion tab should be hidden
+ if (fv->size() == 0)
+ tab->setVisible(false);
+
+ mHistoryAccordion->arrange();
+
+ return; // No need to decrement idexes for the rest of items
+ }
+
+ item->setIndex(item->getIndex() - 1);
+ }
+ }
}
void LLTeleportHistoryPanel::showTeleportHistory()
{
- mDirty = true;
-
- // Starting to add items from last one, in reverse order,
- // since TeleportHistory keeps most recent item at the end
- if (!mTeleportHistory)
- {
- mTeleportHistory = LLTeleportHistoryStorage::getInstance();
- }
-
- mCurrentItem = mTeleportHistory->getItems().size() - 1;
-
- for (S32 n = mItemContainers.size() - 1; n >= 0; --n)
- {
- LLAccordionCtrlTab* tab = mItemContainers.at(n);
- if (tab)
- {
- tab->setVisible(false);
-
- LLFlatListView* fv = getFlatListViewFromTab(tab);
- if (fv)
- {
- // Detached panels are managed by LLTeleportHistoryFlatItemStorage
- std::vector<LLPanel*> detached_items;
- fv->detachItems(detached_items);
- }
- }
- }
+ mDirty = true;
+
+ // Starting to add items from last one, in reverse order,
+ // since TeleportHistory keeps most recent item at the end
+ if (!mTeleportHistory)
+ {
+ mTeleportHistory = LLTeleportHistoryStorage::getInstance();
+ }
+
+ mCurrentItem = mTeleportHistory->getItems().size() - 1;
+
+ for (S32 n = mItemContainers.size() - 1; n >= 0; --n)
+ {
+ LLAccordionCtrlTab* tab = mItemContainers.at(n);
+ if (tab)
+ {
+ tab->setVisible(false);
+
+ LLFlatListView* fv = getFlatListViewFromTab(tab);
+ if (fv)
+ {
+ // Detached panels are managed by LLTeleportHistoryFlatItemStorage
+ std::vector<LLPanel*> detached_items;
+ fv->detachItems(detached_items);
+ }
+ }
+ }
}
void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected)
{
- mLastSelectedFlatlList = selected;
- LLTeleportHistoryFlatItem* item = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
- if (item)
- mLastSelectedItemIndex = item->getIndex();
+ mLastSelectedFlatlList = selected;
+ LLTeleportHistoryFlatItem* item = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
+ if (item)
+ mLastSelectedItemIndex = item->getIndex();
- S32 tabs_cnt = mItemContainers.size();
+ S32 tabs_cnt = mItemContainers.size();
- for (S32 n = 0; n < tabs_cnt; n++)
- {
- LLAccordionCtrlTab* tab = mItemContainers.at(n);
+ for (S32 n = 0; n < tabs_cnt; n++)
+ {
+ LLAccordionCtrlTab* tab = mItemContainers.at(n);
- if (!tab->getVisible())
- continue;
+ if (!tab->getVisible())
+ continue;
- LLFlatListView *flv = getFlatListViewFromTab(tab);
- if (!flv)
- continue;
+ LLFlatListView *flv = getFlatListViewFromTab(tab);
+ if (!flv)
+ continue;
- if (flv == selected)
- continue;
+ if (flv == selected)
+ continue;
- flv->resetSelection(true);
- }
+ flv->resetSelection(true);
+ }
- updateVerbs();
+ updateVerbs();
}
void LLTeleportHistoryPanel::onReturnKeyPressed()
{
- // Teleport to selected region as default action on return key pressed
- onTeleport();
+ // Teleport to selected region as default action on return key pressed
+ onTeleport();
}
void LLTeleportHistoryPanel::onDoubleClickItem()
{
- // If item got doubleclick, then that item is already selected
- onTeleport();
+ // If item got doubleclick, then that item is already selected
+ onTeleport();
}
void LLTeleportHistoryPanel::onAccordionTabRightClick(LLView *view, S32 x, S32 y, MASK mask)
{
- LLAccordionCtrlTab *tab = (LLAccordionCtrlTab *) view;
-
- // If click occurred below the header, don't show this menu
- if (y < tab->getRect().getHeight() - tab->getHeaderHeight() - tab->getPaddingBottom())
- return;
-
- if (mAccordionTabMenu)
- {
- //preventing parent (menu holder) from deleting already "dead" context menus on exit
- LLView* parent = mAccordionTabMenu->getParent();
- if (parent)
- {
- parent->removeChild(mAccordionTabMenu);
- }
- delete mAccordionTabMenu;
- }
-
- // set up the callbacks for all of the avatar menu items
- // (N.B. callbacks don't take const refs as mID is local scope)
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-
- registrar.add("TeleportHistory.TabOpen", boost::bind(&LLTeleportHistoryPanel::onAccordionTabOpen, this, tab));
- registrar.add("TeleportHistory.TabClose", boost::bind(&LLTeleportHistoryPanel::onAccordionTabClose, this, tab));
-
- // create the context menu from the XUI
- llassert(LLMenuGL::sMenuContainer != NULL);
- mAccordionTabMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
- "menu_teleport_history_tab.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
-
- mAccordionTabMenu->setItemVisible("TabOpen", !tab->isExpanded() ? true : false);
- mAccordionTabMenu->setItemVisible("TabClose", tab->isExpanded() ? true : false);
-
- mAccordionTabMenu->show(x, y);
- LLMenuGL::showPopup(tab, mAccordionTabMenu, x, y);
+ LLAccordionCtrlTab *tab = (LLAccordionCtrlTab *) view;
+
+ // If click occurred below the header, don't show this menu
+ if (y < tab->getRect().getHeight() - tab->getHeaderHeight() - tab->getPaddingBottom())
+ return;
+
+ if (mAccordionTabMenu)
+ {
+ //preventing parent (menu holder) from deleting already "dead" context menus on exit
+ LLView* parent = mAccordionTabMenu->getParent();
+ if (parent)
+ {
+ parent->removeChild(mAccordionTabMenu);
+ }
+ delete mAccordionTabMenu;
+ }
+
+ // set up the callbacks for all of the avatar menu items
+ // (N.B. callbacks don't take const refs as mID is local scope)
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+
+ registrar.add("TeleportHistory.TabOpen", boost::bind(&LLTeleportHistoryPanel::onAccordionTabOpen, this, tab));
+ registrar.add("TeleportHistory.TabClose", boost::bind(&LLTeleportHistoryPanel::onAccordionTabClose, this, tab));
+
+ // create the context menu from the XUI
+ llassert(LLMenuGL::sMenuContainer != NULL);
+ mAccordionTabMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
+ "menu_teleport_history_tab.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+
+ mAccordionTabMenu->setItemVisible("TabOpen", !tab->isExpanded() ? true : false);
+ mAccordionTabMenu->setItemVisible("TabClose", tab->isExpanded() ? true : false);
+
+ mAccordionTabMenu->show(x, y);
+ LLMenuGL::showPopup(tab, mAccordionTabMenu, x, y);
}
void LLTeleportHistoryPanel::onAccordionTabOpen(LLAccordionCtrlTab *tab)
{
- tab->setDisplayChildren(true);
- mHistoryAccordion->arrange();
+ tab->setDisplayChildren(true);
+ mHistoryAccordion->arrange();
}
void LLTeleportHistoryPanel::onAccordionTabClose(LLAccordionCtrlTab *tab)
{
- tab->setDisplayChildren(false);
- mHistoryAccordion->arrange();
+ tab->setDisplayChildren(false);
+ mHistoryAccordion->arrange();
}
bool LLTeleportHistoryPanel::onClearTeleportHistoryDialog(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- // order does matter, call this first or teleport history will contain one record(current location)
- LLTeleportHistory::getInstance()->purgeItems();
+ if (0 == option)
+ {
+ // order does matter, call this first or teleport history will contain one record(current location)
+ LLTeleportHistory::getInstance()->purgeItems();
- LLTeleportHistoryStorage *th = LLTeleportHistoryStorage::getInstance();
- th->purgeItems();
- th->save();
- }
+ LLTeleportHistoryStorage *th = LLTeleportHistoryStorage::getInstance();
+ th->purgeItems();
+ th->save();
+ }
- return false;
+ return false;
}
LLFlatListView* LLTeleportHistoryPanel::getFlatListViewFromTab(LLAccordionCtrlTab *tab)
{
- for (child_list_const_iter_t iter = tab->beginChild(); iter != tab->endChild(); iter++)
- {
- if (dynamic_cast<LLFlatListView*>(*iter))
- {
- return (LLFlatListView*)*iter; // There should be one scroll list per tab.
- }
- }
-
- return NULL;
+ for (child_list_const_iter_t iter = tab->beginChild(); iter != tab->endChild(); iter++)
+ {
+ if (dynamic_cast<LLFlatListView*>(*iter))
+ {
+ return (LLFlatListView*)*iter; // There should be one scroll list per tab.
+ }
+ }
+
+ return NULL;
}
void LLTeleportHistoryPanel::gotSLURLCallback(const std::string& slurl)
@@ -1123,7 +1123,7 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const
{
return mTeleportHistory->getItems().size() > 0;
}
-
+
if ("teleport" == command_name
|| "view" == command_name
|| "show_on_map" == command_name
@@ -1138,60 +1138,60 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const
return itemp != NULL;
}
- return false;
+ return false;
}
void LLTeleportHistoryPanel::setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed)
{
- LLSD param = acc_tab->getValue();
- param[COLLAPSED_BY_USER] = collapsed;
- acc_tab->setValue(param);
+ LLSD param = acc_tab->getValue();
+ param[COLLAPSED_BY_USER] = collapsed;
+ acc_tab->setValue(param);
}
bool LLTeleportHistoryPanel::isAccordionCollapsedByUser(LLUICtrl* acc_tab)
{
- LLSD param = acc_tab->getValue();
- if(!param.has(COLLAPSED_BY_USER))
- {
- return false;
- }
- return param[COLLAPSED_BY_USER].asBoolean();
+ LLSD param = acc_tab->getValue();
+ if(!param.has(COLLAPSED_BY_USER))
+ {
+ return false;
+ }
+ return param[COLLAPSED_BY_USER].asBoolean();
}
void LLTeleportHistoryPanel::onAccordionExpand(LLUICtrl* ctrl, const LLSD& param)
{
- bool expanded = param.asBoolean();
- // Save accordion tab state to restore it in refresh()
- setAccordionCollapsedByUser(ctrl, !expanded);
-
- // Reset selection upon accordion being collapsed
- // to disable "Teleport" and "Map" buttons for hidden item.
- if (!expanded && mLastSelectedFlatlList)
- {
- mLastSelectedFlatlList->resetSelection();
- }
+ bool expanded = param.asBoolean();
+ // Save accordion tab state to restore it in refresh()
+ setAccordionCollapsedByUser(ctrl, !expanded);
+
+ // Reset selection upon accordion being collapsed
+ // to disable "Teleport" and "Map" buttons for hidden item.
+ if (!expanded && mLastSelectedFlatlList)
+ {
+ mLastSelectedFlatlList->resetSelection();
+ }
}
// static
void LLTeleportHistoryPanel::confirmTeleport(S32 hist_idx)
{
- LLSD args;
- args["HISTORY_ENTRY"] = LLTeleportHistoryStorage::getInstance()->getItems()[hist_idx].mTitle;
- LLNotificationsUtil::add("TeleportToHistoryEntry", args, LLSD(),
- boost::bind(&LLTeleportHistoryPanel::onTeleportConfirmation, _1, _2, hist_idx));
+ LLSD args;
+ args["HISTORY_ENTRY"] = LLTeleportHistoryStorage::getInstance()->getItems()[hist_idx].mTitle;
+ LLNotificationsUtil::add("TeleportToHistoryEntry", args, LLSD(),
+ boost::bind(&LLTeleportHistoryPanel::onTeleportConfirmation, _1, _2, hist_idx));
}
// Called when user reacts upon teleport confirmation dialog.
// static
bool LLTeleportHistoryPanel::onTeleportConfirmation(const LLSD& notification, const LLSD& response, S32 hist_idx)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- // Teleport to given history item.
- LLTeleportHistoryStorage::getInstance()->goToItem(hist_idx);
- }
+ if (0 == option)
+ {
+ // Teleport to given history item.
+ LLTeleportHistoryStorage::getInstance()->goToItem(hist_idx);
+ }
- return false;
+ return false;
}
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index 058fee0170..20cd96a89c 100644
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelteleporthistory.h
* @brief Teleport history represented by a scrolling list
* class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,8 +43,8 @@ class LLMenuButton;
class LLTeleportHistoryPanel : public LLPanelPlacesTab
{
public:
- LLTeleportHistoryPanel();
- virtual ~LLTeleportHistoryPanel();
+ LLTeleportHistoryPanel();
+ virtual ~LLTeleportHistoryPanel();
BOOL postBuild() override;
void draw() override;
@@ -66,51 +66,51 @@ public:
private:
- void onDoubleClickItem();
- void onReturnKeyPressed();
- void onAccordionTabRightClick(LLView *view, S32 x, S32 y, MASK mask);
- void onAccordionTabOpen(LLAccordionCtrlTab *tab);
- void onAccordionTabClose(LLAccordionCtrlTab *tab);
- void onExpandAllFolders();
- void onCollapseAllFolders();
- void onClearTeleportHistory();
- bool onClearTeleportHistoryDialog(const LLSD& notification, const LLSD& response);
-
- void refresh() override;
- void getNextTab(const LLDate& item_date, S32& curr_tab, LLDate& tab_date);
- void onTeleportHistoryChange(S32 removed_index);
- void replaceItem(S32 removed_index);
- void showTeleportHistory();
- void handleItemSelect(LLFlatListView* );
- LLFlatListView* getFlatListViewFromTab(LLAccordionCtrlTab *);
- static void gotSLURLCallback(const std::string& slurl);
- void onGearMenuAction(const LLSD& userdata);
- bool isActionEnabled(const LLSD& userdata) const;
-
- void setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed);
- bool isAccordionCollapsedByUser(LLUICtrl* acc_tab);
- void onAccordionExpand(LLUICtrl* ctrl, const LLSD& param);
-
- static void confirmTeleport(S32 hist_idx);
- static bool onTeleportConfirmation(const LLSD& notification, const LLSD& response, S32 hist_idx);
-
- LLTeleportHistoryStorage* mTeleportHistory;
- LLAccordionCtrl* mHistoryAccordion;
-
- LLFlatListView* mLastSelectedFlatlList;
- S32 mLastSelectedItemIndex;
- bool mDirty;
- S32 mCurrentItem;
-
- typedef std::vector<LLAccordionCtrlTab*> item_containers_t;
- item_containers_t mItemContainers;
-
- LLContextMenu* mAccordionTabMenu;
-
- LLToggleableMenu* mGearItemMenu;
- LLToggleableMenu* mSortingMenu;
-
- boost::signals2::connection mTeleportHistoryChangedConnection;
+ void onDoubleClickItem();
+ void onReturnKeyPressed();
+ void onAccordionTabRightClick(LLView *view, S32 x, S32 y, MASK mask);
+ void onAccordionTabOpen(LLAccordionCtrlTab *tab);
+ void onAccordionTabClose(LLAccordionCtrlTab *tab);
+ void onExpandAllFolders();
+ void onCollapseAllFolders();
+ void onClearTeleportHistory();
+ bool onClearTeleportHistoryDialog(const LLSD& notification, const LLSD& response);
+
+ void refresh() override;
+ void getNextTab(const LLDate& item_date, S32& curr_tab, LLDate& tab_date);
+ void onTeleportHistoryChange(S32 removed_index);
+ void replaceItem(S32 removed_index);
+ void showTeleportHistory();
+ void handleItemSelect(LLFlatListView* );
+ LLFlatListView* getFlatListViewFromTab(LLAccordionCtrlTab *);
+ static void gotSLURLCallback(const std::string& slurl);
+ void onGearMenuAction(const LLSD& userdata);
+ bool isActionEnabled(const LLSD& userdata) const;
+
+ void setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed);
+ bool isAccordionCollapsedByUser(LLUICtrl* acc_tab);
+ void onAccordionExpand(LLUICtrl* ctrl, const LLSD& param);
+
+ static void confirmTeleport(S32 hist_idx);
+ static bool onTeleportConfirmation(const LLSD& notification, const LLSD& response, S32 hist_idx);
+
+ LLTeleportHistoryStorage* mTeleportHistory;
+ LLAccordionCtrl* mHistoryAccordion;
+
+ LLFlatListView* mLastSelectedFlatlList;
+ S32 mLastSelectedItemIndex;
+ bool mDirty;
+ S32 mCurrentItem;
+
+ typedef std::vector<LLAccordionCtrlTab*> item_containers_t;
+ item_containers_t mItemContainers;
+
+ LLContextMenu* mAccordionTabMenu;
+
+ LLToggleableMenu* mGearItemMenu;
+ LLToggleableMenu* mSortingMenu;
+
+ boost::signals2::connection mTeleportHistoryChangedConnection;
};
diff --git a/indra/newview/llpaneltiptoast.cpp b/indra/newview/llpaneltiptoast.cpp
index 35009a552d..7b512a7737 100644
--- a/indra/newview/llpaneltiptoast.cpp
+++ b/indra/newview/llpaneltiptoast.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,34 +30,34 @@
BOOL LLPanelTipToast::postBuild()
{
- mMessageText= findChild<LLUICtrl>("message");
+ mMessageText= findChild<LLUICtrl>("message");
- if (mMessageText != NULL)
- {
- mMessageText->setMouseUpCallback(boost::bind(&LLPanelTipToast::onMessageTextClick,this));
- setMouseUpCallback(boost::bind(&LLPanelTipToast::onPanelClick, this, _2, _3, _4));
- }
- else
- {
- llassert(!"Can't find child 'message' text box.");
- return FALSE;
- }
+ if (mMessageText != NULL)
+ {
+ mMessageText->setMouseUpCallback(boost::bind(&LLPanelTipToast::onMessageTextClick,this));
+ setMouseUpCallback(boost::bind(&LLPanelTipToast::onPanelClick, this, _2, _3, _4));
+ }
+ else
+ {
+ llassert(!"Can't find child 'message' text box.");
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
void LLPanelTipToast::onMessageTextClick()
{
- // notify parent toast about need hide
- LLSD info;
- info["action"] = "hide_toast";
- notifyParent(info);
+ // notify parent toast about need hide
+ LLSD info;
+ info["action"] = "hide_toast";
+ notifyParent(info);
}
void LLPanelTipToast::onPanelClick(S32 x, S32 y, MASK mask)
{
- if (!mMessageText->getRect().pointInRect(x, y))
- {
- onMessageTextClick();
- }
+ if (!mMessageText->getRect().pointInRect(x, y))
+ {
+ onMessageTextClick();
+ }
}
diff --git a/indra/newview/llpaneltiptoast.h b/indra/newview/llpaneltiptoast.h
index cb09f1dca6..f52772fbfe 100644
--- a/indra/newview/llpaneltiptoast.h
+++ b/indra/newview/llpaneltiptoast.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,15 +37,15 @@
*/
class LLPanelTipToast : public LLToastPanel
{
- LOG_CLASS(LLPanelTipToast);
+ LOG_CLASS(LLPanelTipToast);
public:
- LLPanelTipToast(const LLNotificationPtr& notification): LLToastPanel(notification) {}
- virtual BOOL postBuild();
+ LLPanelTipToast(const LLNotificationPtr& notification): LLToastPanel(notification) {}
+ virtual BOOL postBuild();
private:
- void onMessageTextClick();
- void onPanelClick(S32 x, S32 y, MASK mask);
+ void onMessageTextClick();
+ void onPanelClick(S32 x, S32 y, MASK mask);
- LLUICtrl* mMessageText;
+ LLUICtrl* mMessageText;
};
#endif /* LL_PANELTOASTTIP_H */
diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp
index 0723a78704..499c290c66 100644
--- a/indra/newview/llpaneltopinfobar.cpp
+++ b/indra/newview/llpaneltopinfobar.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,432 +49,432 @@
class LLPanelTopInfoBar::LLParcelChangeObserver : public LLParcelObserver
{
public:
- LLParcelChangeObserver(LLPanelTopInfoBar* topInfoBar) : mTopInfoBar(topInfoBar) {}
+ LLParcelChangeObserver(LLPanelTopInfoBar* topInfoBar) : mTopInfoBar(topInfoBar) {}
private:
- /*virtual*/ void changed()
- {
- if (mTopInfoBar)
- {
- mTopInfoBar->updateParcelIcons();
- }
- }
-
- LLPanelTopInfoBar* mTopInfoBar;
+ /*virtual*/ void changed()
+ {
+ if (mTopInfoBar)
+ {
+ mTopInfoBar->updateParcelIcons();
+ }
+ }
+
+ LLPanelTopInfoBar* mTopInfoBar;
};
LLPanelTopInfoBar::LLPanelTopInfoBar(): mParcelChangedObserver(0)
{
- buildFromFile( "panel_topinfo_bar.xml");
+ buildFromFile( "panel_topinfo_bar.xml");
}
LLPanelTopInfoBar::~LLPanelTopInfoBar()
{
- if (mParcelChangedObserver)
- {
- LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangedObserver);
- delete mParcelChangedObserver;
- }
-
- if (mParcelPropsCtrlConnection.connected())
- {
- mParcelPropsCtrlConnection.disconnect();
- }
-
- if (mParcelMgrConnection.connected())
- {
- mParcelMgrConnection.disconnect();
- }
-
- if (mShowCoordsCtrlConnection.connected())
- {
- mShowCoordsCtrlConnection.disconnect();
- }
+ if (mParcelChangedObserver)
+ {
+ LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangedObserver);
+ delete mParcelChangedObserver;
+ }
+
+ if (mParcelPropsCtrlConnection.connected())
+ {
+ mParcelPropsCtrlConnection.disconnect();
+ }
+
+ if (mParcelMgrConnection.connected())
+ {
+ mParcelMgrConnection.disconnect();
+ }
+
+ if (mShowCoordsCtrlConnection.connected())
+ {
+ mShowCoordsCtrlConnection.disconnect();
+ }
}
void LLPanelTopInfoBar::initParcelIcons()
{
- mParcelIcon[VOICE_ICON] = getChild<LLIconCtrl>("voice_icon");
- mParcelIcon[FLY_ICON] = getChild<LLIconCtrl>("fly_icon");
- mParcelIcon[PUSH_ICON] = getChild<LLIconCtrl>("push_icon");
- mParcelIcon[BUILD_ICON] = getChild<LLIconCtrl>("build_icon");
- mParcelIcon[SCRIPTS_ICON] = getChild<LLIconCtrl>("scripts_icon");
- mParcelIcon[DAMAGE_ICON] = getChild<LLIconCtrl>("damage_icon");
- mParcelIcon[SEE_AVATARS_ICON] = getChild<LLIconCtrl>("see_avatars_icon");
-
- mParcelIcon[VOICE_ICON]->setToolTip(LLTrans::getString("LocationCtrlVoiceTooltip"));
- mParcelIcon[FLY_ICON]->setToolTip(LLTrans::getString("LocationCtrlFlyTooltip"));
- mParcelIcon[PUSH_ICON]->setToolTip(LLTrans::getString("LocationCtrlPushTooltip"));
- mParcelIcon[BUILD_ICON]->setToolTip(LLTrans::getString("LocationCtrlBuildTooltip"));
- mParcelIcon[SCRIPTS_ICON]->setToolTip(LLTrans::getString("LocationCtrlScriptsTooltip"));
- mParcelIcon[DAMAGE_ICON]->setToolTip(LLTrans::getString("LocationCtrlDamageTooltip"));
- mParcelIcon[SEE_AVATARS_ICON]->setToolTip(LLTrans::getString("LocationCtrlSeeAVsTooltip"));
-
- mParcelIcon[VOICE_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, VOICE_ICON));
- mParcelIcon[FLY_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, FLY_ICON));
- mParcelIcon[PUSH_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, PUSH_ICON));
- mParcelIcon[BUILD_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, BUILD_ICON));
- mParcelIcon[SCRIPTS_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, SCRIPTS_ICON));
- mParcelIcon[DAMAGE_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, DAMAGE_ICON));
- mParcelIcon[SEE_AVATARS_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, SEE_AVATARS_ICON));
-
- mDamageText->setText(LLStringExplicit("100%"));
+ mParcelIcon[VOICE_ICON] = getChild<LLIconCtrl>("voice_icon");
+ mParcelIcon[FLY_ICON] = getChild<LLIconCtrl>("fly_icon");
+ mParcelIcon[PUSH_ICON] = getChild<LLIconCtrl>("push_icon");
+ mParcelIcon[BUILD_ICON] = getChild<LLIconCtrl>("build_icon");
+ mParcelIcon[SCRIPTS_ICON] = getChild<LLIconCtrl>("scripts_icon");
+ mParcelIcon[DAMAGE_ICON] = getChild<LLIconCtrl>("damage_icon");
+ mParcelIcon[SEE_AVATARS_ICON] = getChild<LLIconCtrl>("see_avatars_icon");
+
+ mParcelIcon[VOICE_ICON]->setToolTip(LLTrans::getString("LocationCtrlVoiceTooltip"));
+ mParcelIcon[FLY_ICON]->setToolTip(LLTrans::getString("LocationCtrlFlyTooltip"));
+ mParcelIcon[PUSH_ICON]->setToolTip(LLTrans::getString("LocationCtrlPushTooltip"));
+ mParcelIcon[BUILD_ICON]->setToolTip(LLTrans::getString("LocationCtrlBuildTooltip"));
+ mParcelIcon[SCRIPTS_ICON]->setToolTip(LLTrans::getString("LocationCtrlScriptsTooltip"));
+ mParcelIcon[DAMAGE_ICON]->setToolTip(LLTrans::getString("LocationCtrlDamageTooltip"));
+ mParcelIcon[SEE_AVATARS_ICON]->setToolTip(LLTrans::getString("LocationCtrlSeeAVsTooltip"));
+
+ mParcelIcon[VOICE_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, VOICE_ICON));
+ mParcelIcon[FLY_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, FLY_ICON));
+ mParcelIcon[PUSH_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, PUSH_ICON));
+ mParcelIcon[BUILD_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, BUILD_ICON));
+ mParcelIcon[SCRIPTS_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, SCRIPTS_ICON));
+ mParcelIcon[DAMAGE_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, DAMAGE_ICON));
+ mParcelIcon[SEE_AVATARS_ICON]->setMouseDownCallback(boost::bind(&LLPanelTopInfoBar::onParcelIconClick, this, SEE_AVATARS_ICON));
+
+ mDamageText->setText(LLStringExplicit("100%"));
}
void LLPanelTopInfoBar::handleLoginComplete()
{
- // An agent parcel update hasn't occurred yet, so
- // we have to manually set location and the icons.
- update();
+ // An agent parcel update hasn't occurred yet, so
+ // we have to manually set location and the icons.
+ update();
}
BOOL LLPanelTopInfoBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- if(!LLUICtrl::CommitCallbackRegistry::getValue("TopInfoBar.Action"))
- {
- LLUICtrl::CommitCallbackRegistry::currentRegistrar()
- .add("TopInfoBar.Action", boost::bind(&LLPanelTopInfoBar::onContextMenuItemClicked, this, _2));
- }
- show_topinfobar_context_menu(this, x, y);
- return TRUE;
+ if(!LLUICtrl::CommitCallbackRegistry::getValue("TopInfoBar.Action"))
+ {
+ LLUICtrl::CommitCallbackRegistry::currentRegistrar()
+ .add("TopInfoBar.Action", boost::bind(&LLPanelTopInfoBar::onContextMenuItemClicked, this, _2));
+ }
+ show_topinfobar_context_menu(this, x, y);
+ return TRUE;
}
BOOL LLPanelTopInfoBar::postBuild()
{
- mInfoBtn = getChild<LLButton>("place_info_btn");
- mInfoBtn->setClickedCallback(boost::bind(&LLPanelTopInfoBar::onInfoButtonClicked, this));
- mInfoBtn->setToolTip(LLTrans::getString("LocationCtrlInfoBtnTooltip"));
+ mInfoBtn = getChild<LLButton>("place_info_btn");
+ mInfoBtn->setClickedCallback(boost::bind(&LLPanelTopInfoBar::onInfoButtonClicked, this));
+ mInfoBtn->setToolTip(LLTrans::getString("LocationCtrlInfoBtnTooltip"));
- mParcelInfoText = getChild<LLTextBox>("parcel_info_text");
- mDamageText = getChild<LLTextBox>("damage_text");
+ mParcelInfoText = getChild<LLTextBox>("parcel_info_text");
+ mDamageText = getChild<LLTextBox>("damage_text");
- initParcelIcons();
+ initParcelIcons();
- mParcelChangedObserver = new LLParcelChangeObserver(this);
- LLViewerParcelMgr::getInstance()->addObserver(mParcelChangedObserver);
+ mParcelChangedObserver = new LLParcelChangeObserver(this);
+ LLViewerParcelMgr::getInstance()->addObserver(mParcelChangedObserver);
- // Connecting signal for updating parcel icons on "Show Parcel Properties" setting change.
- LLControlVariable* ctrl = gSavedSettings.getControl("NavBarShowParcelProperties").get();
- if (ctrl)
- {
- mParcelPropsCtrlConnection = ctrl->getSignal()->connect(boost::bind(&LLPanelTopInfoBar::updateParcelIcons, this));
- }
+ // Connecting signal for updating parcel icons on "Show Parcel Properties" setting change.
+ LLControlVariable* ctrl = gSavedSettings.getControl("NavBarShowParcelProperties").get();
+ if (ctrl)
+ {
+ mParcelPropsCtrlConnection = ctrl->getSignal()->connect(boost::bind(&LLPanelTopInfoBar::updateParcelIcons, this));
+ }
- // Connecting signal for updating parcel text on "Show Coordinates" setting change.
- ctrl = gSavedSettings.getControl("NavBarShowCoordinates").get();
- if (ctrl)
- {
- mShowCoordsCtrlConnection = ctrl->getSignal()->connect(boost::bind(&LLPanelTopInfoBar::onNavBarShowParcelPropertiesCtrlChanged, this));
- }
+ // Connecting signal for updating parcel text on "Show Coordinates" setting change.
+ ctrl = gSavedSettings.getControl("NavBarShowCoordinates").get();
+ if (ctrl)
+ {
+ mShowCoordsCtrlConnection = ctrl->getSignal()->connect(boost::bind(&LLPanelTopInfoBar::onNavBarShowParcelPropertiesCtrlChanged, this));
+ }
- mParcelMgrConnection = gAgent.addParcelChangedCallback(
- boost::bind(&LLPanelTopInfoBar::onAgentParcelChange, this));
+ mParcelMgrConnection = gAgent.addParcelChangedCallback(
+ boost::bind(&LLPanelTopInfoBar::onAgentParcelChange, this));
- setVisibleCallback(boost::bind(&LLPanelTopInfoBar::onVisibilityChanged, this, _2));
+ setVisibleCallback(boost::bind(&LLPanelTopInfoBar::onVisibilityChanged, this, _2));
- return TRUE;
+ return TRUE;
}
void LLPanelTopInfoBar::onNavBarShowParcelPropertiesCtrlChanged()
{
- std::string new_text;
+ std::string new_text;
- // don't need to have separate show_coords variable; if user requested the coords to be shown
- // they will be added during the next call to the draw() method.
- buildLocationString(new_text, false);
- setParcelInfoText(new_text);
+ // don't need to have separate show_coords variable; if user requested the coords to be shown
+ // they will be added during the next call to the draw() method.
+ buildLocationString(new_text, false);
+ setParcelInfoText(new_text);
}
// when panel is shown, all minimized floaters should be shifted downwards to prevent overlapping of
// PanelTopInfoBar. See EXT-7951.
void LLPanelTopInfoBar::onVisibilityChanged(const LLSD& show)
{
- // this height is used as a vertical offset for ALREADY MINIMIZED floaters
- // when PanelTopInfoBar visibility changes
- S32 height = getRect().getHeight();
+ // this height is used as a vertical offset for ALREADY MINIMIZED floaters
+ // when PanelTopInfoBar visibility changes
+ S32 height = getRect().getHeight();
- // this vertical offset is used for a start minimize position of floaters that
- // are NOT MIMIMIZED YET
- S32 minimize_pos_offset = 0;
+ // this vertical offset is used for a start minimize position of floaters that
+ // are NOT MIMIMIZED YET
+ S32 minimize_pos_offset = 0;
- if (show.asBoolean())
- {
- height = minimize_pos_offset = -height;
- }
+ if (show.asBoolean())
+ {
+ height = minimize_pos_offset = -height;
+ }
- gFloaterView->shiftFloaters(0, height);
- gFloaterView->setMinimizePositionVerticalOffset(minimize_pos_offset);
+ gFloaterView->shiftFloaters(0, height);
+ gFloaterView->setMinimizePositionVerticalOffset(minimize_pos_offset);
}
boost::signals2::connection LLPanelTopInfoBar::setResizeCallback( const resize_signal_t::slot_type& cb )
{
- return mResizeSignal.connect(cb);
+ return mResizeSignal.connect(cb);
}
void LLPanelTopInfoBar::draw()
{
- updateParcelInfoText();
- updateHealth();
+ updateParcelInfoText();
+ updateHealth();
- LLPanel::draw();
+ LLPanel::draw();
}
void LLPanelTopInfoBar::buildLocationString(std::string& loc_str, bool show_coords)
{
- LLAgentUI::ELocationFormat format =
- (show_coords ? LLAgentUI::LOCATION_FORMAT_FULL : LLAgentUI::LOCATION_FORMAT_NO_COORDS);
+ LLAgentUI::ELocationFormat format =
+ (show_coords ? LLAgentUI::LOCATION_FORMAT_FULL : LLAgentUI::LOCATION_FORMAT_NO_COORDS);
- if (!LLAgentUI::buildLocationString(loc_str, format))
- {
- loc_str = "???";
- }
+ if (!LLAgentUI::buildLocationString(loc_str, format))
+ {
+ loc_str = "???";
+ }
}
void LLPanelTopInfoBar::setParcelInfoText(const std::string& new_text)
{
- LLRect old_rect = getRect();
- const LLFontGL* font = mParcelInfoText->getFont();
- S32 new_text_width = font->getWidth(new_text);
+ LLRect old_rect = getRect();
+ const LLFontGL* font = mParcelInfoText->getFont();
+ S32 new_text_width = font->getWidth(new_text);
- mParcelInfoText->setText(new_text);
+ mParcelInfoText->setText(new_text);
- LLRect rect = mParcelInfoText->getRect();
- rect.setOriginAndSize(rect.mLeft, rect.mBottom, new_text_width, rect.getHeight());
+ LLRect rect = mParcelInfoText->getRect();
+ rect.setOriginAndSize(rect.mLeft, rect.mBottom, new_text_width, rect.getHeight());
- mParcelInfoText->reshape(rect.getWidth(), rect.getHeight(), TRUE);
- mParcelInfoText->setRect(rect);
- layoutParcelIcons();
+ mParcelInfoText->reshape(rect.getWidth(), rect.getHeight(), TRUE);
+ mParcelInfoText->setRect(rect);
+ layoutParcelIcons();
- if (old_rect != getRect())
- {
- mResizeSignal();
- }
+ if (old_rect != getRect())
+ {
+ mResizeSignal();
+ }
}
void LLPanelTopInfoBar::update()
{
- std::string new_text;
+ std::string new_text;
- // don't need to have separate show_coords variable; if user requested the coords to be shown
- // they will be added during the next call to the draw() method.
- buildLocationString(new_text, false);
- setParcelInfoText(new_text);
+ // don't need to have separate show_coords variable; if user requested the coords to be shown
+ // they will be added during the next call to the draw() method.
+ buildLocationString(new_text, false);
+ setParcelInfoText(new_text);
- updateParcelIcons();
+ updateParcelIcons();
}
void LLPanelTopInfoBar::updateParcelInfoText()
{
- static LLUICachedControl<bool> show_coords("NavBarShowCoordinates", false);
+ static LLUICachedControl<bool> show_coords("NavBarShowCoordinates", false);
- if (show_coords)
- {
- std::string new_text;
+ if (show_coords)
+ {
+ std::string new_text;
- buildLocationString(new_text, show_coords);
- setParcelInfoText(new_text);
- }
+ buildLocationString(new_text, show_coords);
+ setParcelInfoText(new_text);
+ }
}
void LLPanelTopInfoBar::updateParcelIcons()
{
- LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
-
- LLViewerRegion* agent_region = gAgent.getRegion();
- LLParcel* agent_parcel = vpm->getAgentParcel();
- if (!agent_region || !agent_parcel)
- return;
-
- if (gSavedSettings.getBOOL("NavBarShowParcelProperties"))
- {
- LLParcel* current_parcel;
- LLViewerRegion* selection_region = vpm->getSelectionRegion();
- LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel();
-
- // If agent is in selected parcel we use its properties because
- // they are updated more often by LLViewerParcelMgr than agent parcel properties.
- // See LLViewerParcelMgr::processParcelProperties().
- // This is needed to reflect parcel restrictions changes without having to leave
- // the parcel and then enter it again. See EXT-2987
- if (selected_parcel && selected_parcel->getLocalID() == agent_parcel->getLocalID()
- && selection_region == agent_region)
- {
- current_parcel = selected_parcel;
- }
- else
- {
- current_parcel = agent_parcel;
- }
-
- bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel);
- bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel);
- bool allow_push = vpm->allowAgentPush(agent_region, current_parcel);
- bool allow_build = vpm->allowAgentBuild(current_parcel); // true when anyone is allowed to build. See EXT-4610.
- bool allow_scripts = vpm->allowAgentScripts(agent_region, current_parcel);
- bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel);
- bool see_avs = current_parcel->getSeeAVs();
-
- // Most icons are "block this ability"
- mParcelIcon[VOICE_ICON]->setVisible( !allow_voice );
- mParcelIcon[FLY_ICON]->setVisible( !allow_fly );
- mParcelIcon[PUSH_ICON]->setVisible( !allow_push );
- mParcelIcon[BUILD_ICON]->setVisible( !allow_build );
- mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts );
- mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage );
- mDamageText->setVisible(allow_damage);
- mParcelIcon[SEE_AVATARS_ICON]->setVisible( !see_avs );
-
- layoutParcelIcons();
- }
- else
- {
- for (S32 i = 0; i < ICON_COUNT; ++i)
- {
- mParcelIcon[i]->setVisible(false);
- }
- mDamageText->setVisible(false);
- }
+ LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
+
+ LLViewerRegion* agent_region = gAgent.getRegion();
+ LLParcel* agent_parcel = vpm->getAgentParcel();
+ if (!agent_region || !agent_parcel)
+ return;
+
+ if (gSavedSettings.getBOOL("NavBarShowParcelProperties"))
+ {
+ LLParcel* current_parcel;
+ LLViewerRegion* selection_region = vpm->getSelectionRegion();
+ LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel();
+
+ // If agent is in selected parcel we use its properties because
+ // they are updated more often by LLViewerParcelMgr than agent parcel properties.
+ // See LLViewerParcelMgr::processParcelProperties().
+ // This is needed to reflect parcel restrictions changes without having to leave
+ // the parcel and then enter it again. See EXT-2987
+ if (selected_parcel && selected_parcel->getLocalID() == agent_parcel->getLocalID()
+ && selection_region == agent_region)
+ {
+ current_parcel = selected_parcel;
+ }
+ else
+ {
+ current_parcel = agent_parcel;
+ }
+
+ bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel);
+ bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel);
+ bool allow_push = vpm->allowAgentPush(agent_region, current_parcel);
+ bool allow_build = vpm->allowAgentBuild(current_parcel); // true when anyone is allowed to build. See EXT-4610.
+ bool allow_scripts = vpm->allowAgentScripts(agent_region, current_parcel);
+ bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel);
+ bool see_avs = current_parcel->getSeeAVs();
+
+ // Most icons are "block this ability"
+ mParcelIcon[VOICE_ICON]->setVisible( !allow_voice );
+ mParcelIcon[FLY_ICON]->setVisible( !allow_fly );
+ mParcelIcon[PUSH_ICON]->setVisible( !allow_push );
+ mParcelIcon[BUILD_ICON]->setVisible( !allow_build );
+ mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts );
+ mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage );
+ mDamageText->setVisible(allow_damage);
+ mParcelIcon[SEE_AVATARS_ICON]->setVisible( !see_avs );
+
+ layoutParcelIcons();
+ }
+ else
+ {
+ for (S32 i = 0; i < ICON_COUNT; ++i)
+ {
+ mParcelIcon[i]->setVisible(false);
+ }
+ mDamageText->setVisible(false);
+ }
}
void LLPanelTopInfoBar::updateHealth()
{
- static LLUICachedControl<bool> show_icons("NavBarShowParcelProperties", false);
-
- // *FIXME: Status bar owns health information, should be in agent
- if (show_icons && gStatusBar)
- {
- static S32 last_health = -1;
- S32 health = gStatusBar->getHealth();
- if (health != last_health)
- {
- std::string text = llformat("%d%%", health);
- mDamageText->setText(text);
- last_health = health;
- }
- }
+ static LLUICachedControl<bool> show_icons("NavBarShowParcelProperties", false);
+
+ // *FIXME: Status bar owns health information, should be in agent
+ if (show_icons && gStatusBar)
+ {
+ static S32 last_health = -1;
+ S32 health = gStatusBar->getHealth();
+ if (health != last_health)
+ {
+ std::string text = llformat("%d%%", health);
+ mDamageText->setText(text);
+ last_health = health;
+ }
+ }
}
void LLPanelTopInfoBar::layoutParcelIcons()
{
- LLRect old_rect = getRect();
+ LLRect old_rect = getRect();
- // TODO: remove hard-coded values and read them as xml parameters
- static const int FIRST_ICON_HPAD = 32;
- static const int LAST_ICON_HPAD = 11;
+ // TODO: remove hard-coded values and read them as xml parameters
+ static const int FIRST_ICON_HPAD = 32;
+ static const int LAST_ICON_HPAD = 11;
- S32 left = mParcelInfoText->getRect().mRight + FIRST_ICON_HPAD;
+ S32 left = mParcelInfoText->getRect().mRight + FIRST_ICON_HPAD;
- left = layoutWidget(mDamageText, left);
+ left = layoutWidget(mDamageText, left);
- for (int i = ICON_COUNT - 1; i >= 0; --i)
- {
- left = layoutWidget(mParcelIcon[i], left);
- }
+ for (int i = ICON_COUNT - 1; i >= 0; --i)
+ {
+ left = layoutWidget(mParcelIcon[i], left);
+ }
- LLRect rect = getRect();
- rect.set(rect.mLeft, rect.mTop, left + LAST_ICON_HPAD, rect.mBottom);
- setRect(rect);
+ LLRect rect = getRect();
+ rect.set(rect.mLeft, rect.mTop, left + LAST_ICON_HPAD, rect.mBottom);
+ setRect(rect);
- if (old_rect != getRect())
- {
- mResizeSignal();
- }
+ if (old_rect != getRect())
+ {
+ mResizeSignal();
+ }
}
S32 LLPanelTopInfoBar::layoutWidget(LLUICtrl* ctrl, S32 left)
{
- // TODO: remove hard-coded values and read them as xml parameters
- static const int ICON_HPAD = 2;
+ // TODO: remove hard-coded values and read them as xml parameters
+ static const int ICON_HPAD = 2;
- if (ctrl->getVisible())
- {
- LLRect rect = ctrl->getRect();
- rect.mRight = left + rect.getWidth();
- rect.mLeft = left;
+ if (ctrl->getVisible())
+ {
+ LLRect rect = ctrl->getRect();
+ rect.mRight = left + rect.getWidth();
+ rect.mLeft = left;
- ctrl->setRect(rect);
- left += rect.getWidth() + ICON_HPAD;
- }
+ ctrl->setRect(rect);
+ left += rect.getWidth() + ICON_HPAD;
+ }
- return left;
+ return left;
}
void LLPanelTopInfoBar::onParcelIconClick(EParcelIcon icon)
{
- switch (icon)
- {
- case VOICE_ICON:
- LLNotificationsUtil::add("NoVoice");
- break;
- case FLY_ICON:
- LLNotificationsUtil::add("NoFly");
- break;
- case PUSH_ICON:
- LLNotificationsUtil::add("PushRestricted");
- break;
- case BUILD_ICON:
- LLNotificationsUtil::add("NoBuild");
- break;
- case SCRIPTS_ICON:
- {
- LLViewerRegion* region = gAgent.getRegion();
- if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))
- {
- LLNotificationsUtil::add("ScriptsStopped");
- }
- else if(region && region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS))
- {
- LLNotificationsUtil::add("ScriptsNotRunning");
- }
- else
- {
- LLNotificationsUtil::add("NoOutsideScripts");
- }
- break;
- }
- case DAMAGE_ICON:
- LLNotificationsUtil::add("NotSafe");
- break;
- case SEE_AVATARS_ICON:
- LLNotificationsUtil::add("SeeAvatars");
- break;
- case ICON_COUNT:
- break;
- // no default to get compiler warning when a new icon gets added
- }
+ switch (icon)
+ {
+ case VOICE_ICON:
+ LLNotificationsUtil::add("NoVoice");
+ break;
+ case FLY_ICON:
+ LLNotificationsUtil::add("NoFly");
+ break;
+ case PUSH_ICON:
+ LLNotificationsUtil::add("PushRestricted");
+ break;
+ case BUILD_ICON:
+ LLNotificationsUtil::add("NoBuild");
+ break;
+ case SCRIPTS_ICON:
+ {
+ LLViewerRegion* region = gAgent.getRegion();
+ if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))
+ {
+ LLNotificationsUtil::add("ScriptsStopped");
+ }
+ else if(region && region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS))
+ {
+ LLNotificationsUtil::add("ScriptsNotRunning");
+ }
+ else
+ {
+ LLNotificationsUtil::add("NoOutsideScripts");
+ }
+ break;
+ }
+ case DAMAGE_ICON:
+ LLNotificationsUtil::add("NotSafe");
+ break;
+ case SEE_AVATARS_ICON:
+ LLNotificationsUtil::add("SeeAvatars");
+ break;
+ case ICON_COUNT:
+ break;
+ // no default to get compiler warning when a new icon gets added
+ }
}
void LLPanelTopInfoBar::onAgentParcelChange()
{
- update();
+ update();
}
void LLPanelTopInfoBar::onContextMenuItemClicked(const LLSD::String& item)
{
- if (item == "landmark")
- {
- LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
-
- if(landmark == NULL)
- {
- LLFloaterReg::showInstance("add_landmark");
- }
- else
- {
- LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id",landmark->getUUID()));
- }
- }
- else if (item == "copy")
- {
- LLSLURL slurl;
- LLAgentUI::buildSLURL(slurl, false);
- LLUIString location_str(slurl.getSLURLString());
-
- LLClipboard::instance().copyToClipboard(location_str,0,location_str.length());
- }
+ if (item == "landmark")
+ {
+ LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
+
+ if(landmark == NULL)
+ {
+ LLFloaterReg::showInstance("add_landmark");
+ }
+ else
+ {
+ LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id",landmark->getUUID()));
+ }
+ }
+ else if (item == "copy")
+ {
+ LLSLURL slurl;
+ LLAgentUI::buildSLURL(slurl, false);
+ LLUIString location_str(slurl.getSLURLString());
+
+ LLClipboard::instance().copyToClipboard(location_str,0,location_str.length());
+ }
}
void LLPanelTopInfoBar::onInfoButtonClicked()
{
- LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "agent"));
+ LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "agent"));
}
diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h
index b6c263e331..0f072db175 100644
--- a/indra/newview/llpaneltopinfobar.h
+++ b/indra/newview/llpaneltopinfobar.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,142 +37,142 @@ class LLParcelChangeObserver;
class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>, private LLDestroyClass<LLPanelTopInfoBar>
{
- LLSINGLETON(LLPanelTopInfoBar);
- ~LLPanelTopInfoBar();
- LOG_CLASS(LLPanelTopInfoBar);
+ LLSINGLETON(LLPanelTopInfoBar);
+ ~LLPanelTopInfoBar();
+ LOG_CLASS(LLPanelTopInfoBar);
- friend class LLDestroyClass<LLPanelTopInfoBar>;
+ friend class LLDestroyClass<LLPanelTopInfoBar>;
public:
- typedef boost::signals2::signal<void ()> resize_signal_t;
+ typedef boost::signals2::signal<void ()> resize_signal_t;
- /*virtual*/ BOOL postBuild() override;
- /*virtual*/ void draw() override;
+ /*virtual*/ BOOL postBuild() override;
+ /*virtual*/ void draw() override;
- /**
- * Updates location and parcel icons on login complete
- */
- void handleLoginComplete();
+ /**
+ * Updates location and parcel icons on login complete
+ */
+ void handleLoginComplete();
- /**
- * Called when the top info bar gets shown or hidden
- */
- void onVisibilityChanged(const LLSD& show);
+ /**
+ * Called when the top info bar gets shown or hidden
+ */
+ void onVisibilityChanged(const LLSD& show);
- boost::signals2::connection setResizeCallback( const resize_signal_t::slot_type& cb );
+ boost::signals2::connection setResizeCallback( const resize_signal_t::slot_type& cb );
private:
- class LLParcelChangeObserver;
-
- friend class LLParcelChangeObserver;
-
- enum EParcelIcon
- {
- VOICE_ICON = 0,
- FLY_ICON, // 1
- PUSH_ICON, // 2
- BUILD_ICON, // 3
- SCRIPTS_ICON, // 4
- DAMAGE_ICON, // 5
- SEE_AVATARS_ICON, // 6
- ICON_COUNT // 7 total
- };
-
- /**
- * Initializes parcel icons controls. Called from the constructor.
- */
- void initParcelIcons();
-
- BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
-
- /**
- * Handles clicks on the parcel icons.
- */
- void onParcelIconClick(EParcelIcon icon);
-
- /**
- * Handles clicks on the info buttons.
- */
- void onInfoButtonClicked();
-
- /**
- * Called when agent changes the parcel.
- */
- void onAgentParcelChange();
-
- /**
- * Called when context menu item is clicked.
- */
- void onContextMenuItemClicked(const LLSD::String& userdata);
-
- /**
- * Called when user checks/unchecks Show Coordinates menu item.
- */
- void onNavBarShowParcelPropertiesCtrlChanged();
-
- /**
- * Shorthand to call updateParcelInfoText() and updateParcelIcons().
- */
- void update();
-
- /**
- * Updates parcel info text (mParcelInfoText).
- */
- void updateParcelInfoText();
-
- /**
- * Updates parcel icons (mParcelIcon[]).
- */
- void updateParcelIcons();
-
- /**
- * Updates health information (mDamageText).
- */
- void updateHealth();
-
- /**
- * Lays out all parcel icons starting from right edge of the mParcelInfoText + 11px
- * (see screenshots in EXT-5808 for details).
- */
- void layoutParcelIcons();
-
- /**
- * Lays out a widget. Widget's rect mLeft becomes equal to the 'left' argument.
- */
- S32 layoutWidget(LLUICtrl* ctrl, S32 left);
-
- /**
- * Generates location string and returns it in the loc_str parameter.
- */
- void buildLocationString(std::string& loc_str, bool show_coords);
-
- /**
- * Sets new value to the mParcelInfoText and updates the size of the top bar.
- */
- void setParcelInfoText(const std::string& new_text);
-
- /**
- * Implementation of LLDestroyClass<T>
- */
- static void destroyClass()
- {
- if (LLPanelTopInfoBar::instanceExists())
- {
- LLPanelTopInfoBar::getInstance()->setEnabled(FALSE);
- }
- }
-
- LLButton* mInfoBtn;
- LLTextBox* mParcelInfoText;
- LLTextBox* mDamageText;
- LLIconCtrl* mParcelIcon[ICON_COUNT];
- LLParcelChangeObserver* mParcelChangedObserver;
-
- boost::signals2::connection mParcelPropsCtrlConnection;
- boost::signals2::connection mShowCoordsCtrlConnection;
- boost::signals2::connection mParcelMgrConnection;
-
- resize_signal_t mResizeSignal;
+ class LLParcelChangeObserver;
+
+ friend class LLParcelChangeObserver;
+
+ enum EParcelIcon
+ {
+ VOICE_ICON = 0,
+ FLY_ICON, // 1
+ PUSH_ICON, // 2
+ BUILD_ICON, // 3
+ SCRIPTS_ICON, // 4
+ DAMAGE_ICON, // 5
+ SEE_AVATARS_ICON, // 6
+ ICON_COUNT // 7 total
+ };
+
+ /**
+ * Initializes parcel icons controls. Called from the constructor.
+ */
+ void initParcelIcons();
+
+ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
+
+ /**
+ * Handles clicks on the parcel icons.
+ */
+ void onParcelIconClick(EParcelIcon icon);
+
+ /**
+ * Handles clicks on the info buttons.
+ */
+ void onInfoButtonClicked();
+
+ /**
+ * Called when agent changes the parcel.
+ */
+ void onAgentParcelChange();
+
+ /**
+ * Called when context menu item is clicked.
+ */
+ void onContextMenuItemClicked(const LLSD::String& userdata);
+
+ /**
+ * Called when user checks/unchecks Show Coordinates menu item.
+ */
+ void onNavBarShowParcelPropertiesCtrlChanged();
+
+ /**
+ * Shorthand to call updateParcelInfoText() and updateParcelIcons().
+ */
+ void update();
+
+ /**
+ * Updates parcel info text (mParcelInfoText).
+ */
+ void updateParcelInfoText();
+
+ /**
+ * Updates parcel icons (mParcelIcon[]).
+ */
+ void updateParcelIcons();
+
+ /**
+ * Updates health information (mDamageText).
+ */
+ void updateHealth();
+
+ /**
+ * Lays out all parcel icons starting from right edge of the mParcelInfoText + 11px
+ * (see screenshots in EXT-5808 for details).
+ */
+ void layoutParcelIcons();
+
+ /**
+ * Lays out a widget. Widget's rect mLeft becomes equal to the 'left' argument.
+ */
+ S32 layoutWidget(LLUICtrl* ctrl, S32 left);
+
+ /**
+ * Generates location string and returns it in the loc_str parameter.
+ */
+ void buildLocationString(std::string& loc_str, bool show_coords);
+
+ /**
+ * Sets new value to the mParcelInfoText and updates the size of the top bar.
+ */
+ void setParcelInfoText(const std::string& new_text);
+
+ /**
+ * Implementation of LLDestroyClass<T>
+ */
+ static void destroyClass()
+ {
+ if (LLPanelTopInfoBar::instanceExists())
+ {
+ LLPanelTopInfoBar::getInstance()->setEnabled(FALSE);
+ }
+ }
+
+ LLButton* mInfoBtn;
+ LLTextBox* mParcelInfoText;
+ LLTextBox* mDamageText;
+ LLIconCtrl* mParcelIcon[ICON_COUNT];
+ LLParcelChangeObserver* mParcelChangedObserver;
+
+ boost::signals2::connection mParcelPropsCtrlConnection;
+ boost::signals2::connection mShowCoordsCtrlConnection;
+ boost::signals2::connection mParcelMgrConnection;
+
+ resize_signal_t mResizeSignal;
};
#endif /* LLPANELTOPINFOBAR_H_ */
diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp
index af57169f3b..cac5421ffc 100644
--- a/indra/newview/llpanelvoicedevicesettings.cpp
+++ b/indra/newview/llpanelvoicedevicesettings.cpp
@@ -1,30 +1,30 @@
-/**
+/**
* @file llpanelvoicedevicesettings.cpp
* @author Richard Nelson
- * @brief Voice communication set-up
+ * @brief Voice communication set-up
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
#include "llviewerprecompiledheaders.h"
#include "llpanelvoicedevicesettings.h"
@@ -45,17 +45,17 @@ static const std::string DEFAULT_DEVICE("Default");
LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings()
- : LLPanel()
+ : LLPanel()
{
- mCtrlInputDevices = NULL;
- mCtrlOutputDevices = NULL;
- mInputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
- mOutputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
- mDevicesUpdated = FALSE; //obsolete
- mUseTuningMode = true;
+ mCtrlInputDevices = NULL;
+ mCtrlOutputDevices = NULL;
+ mInputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
+ mOutputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
+ mDevicesUpdated = FALSE; //obsolete
+ mUseTuningMode = true;
- // grab "live" mic volume level
- mMicVolume = gSavedSettings.getF32("AudioLevelMic");
+ // grab "live" mic volume level
+ mMicVolume = gSavedSettings.getF32("AudioLevelMic");
}
@@ -65,53 +65,53 @@ LLPanelVoiceDeviceSettings::~LLPanelVoiceDeviceSettings()
BOOL LLPanelVoiceDeviceSettings::postBuild()
{
- LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
- // set mic volume tuning slider based on last mic volume setting
- volume_slider->setValue(mMicVolume);
+ LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
+ // set mic volume tuning slider based on last mic volume setting
+ volume_slider->setValue(mMicVolume);
- mCtrlInputDevices = getChild<LLComboBox>("voice_input_device");
- mCtrlOutputDevices = getChild<LLComboBox>("voice_output_device");
+ mCtrlInputDevices = getChild<LLComboBox>("voice_input_device");
+ mCtrlOutputDevices = getChild<LLComboBox>("voice_output_device");
mUnmuteBtn = getChild<LLButton>("unmute_btn");
- mCtrlInputDevices->setCommitCallback(
- boost::bind(&LLPanelVoiceDeviceSettings::onCommitInputDevice, this));
- mCtrlOutputDevices->setCommitCallback(
- boost::bind(&LLPanelVoiceDeviceSettings::onCommitOutputDevice, this));
+ mCtrlInputDevices->setCommitCallback(
+ boost::bind(&LLPanelVoiceDeviceSettings::onCommitInputDevice, this));
+ mCtrlOutputDevices->setCommitCallback(
+ boost::bind(&LLPanelVoiceDeviceSettings::onCommitOutputDevice, this));
mUnmuteBtn->setCommitCallback(
boost::bind(&LLPanelVoiceDeviceSettings::onCommitUnmute, this));
- mLocalizedDeviceNames[DEFAULT_DEVICE] = getString("default_text");
- mLocalizedDeviceNames["No Device"] = getString("name_no_device");
- mLocalizedDeviceNames["Default System Device"] = getString("name_default_system_device");
+ mLocalizedDeviceNames[DEFAULT_DEVICE] = getString("default_text");
+ mLocalizedDeviceNames["No Device"] = getString("name_no_device");
+ mLocalizedDeviceNames["Default System Device"] = getString("name_default_system_device");
+
+ mCtrlOutputDevices->setMouseDownCallback(boost::bind(&LLPanelVoiceDeviceSettings::onOutputDevicesClicked, this));
+ mCtrlInputDevices->setMouseDownCallback(boost::bind(&LLPanelVoiceDeviceSettings::onInputDevicesClicked, this));
+
- mCtrlOutputDevices->setMouseDownCallback(boost::bind(&LLPanelVoiceDeviceSettings::onOutputDevicesClicked, this));
- mCtrlInputDevices->setMouseDownCallback(boost::bind(&LLPanelVoiceDeviceSettings::onInputDevicesClicked, this));
-
-
- return TRUE;
+ return TRUE;
}
// virtual
void LLPanelVoiceDeviceSettings::onVisibilityChange ( BOOL new_visibility )
{
- if (new_visibility)
- {
- initialize();
- }
- else
- {
- cleanup();
- // when closing this window, turn of visiblity control so that
- // next time preferences is opened we don't suspend voice
- gSavedSettings.setBOOL("ShowDeviceSettings", FALSE);
- }
+ if (new_visibility)
+ {
+ initialize();
+ }
+ else
+ {
+ cleanup();
+ // when closing this window, turn of visiblity control so that
+ // next time preferences is opened we don't suspend voice
+ gSavedSettings.setBOOL("ShowDeviceSettings", FALSE);
+ }
}
void LLPanelVoiceDeviceSettings::draw()
{
- refresh();
+ refresh();
- // let user know that volume indicator is not yet available
- bool is_in_tuning_mode = LLVoiceClient::getInstance()->inTuningMode();
+ // let user know that volume indicator is not yet available
+ bool is_in_tuning_mode = LLVoiceClient::getInstance()->inTuningMode();
bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled();
if (voice_enabled)
{
@@ -130,234 +130,234 @@ void LLPanelVoiceDeviceSettings::draw()
mUnmuteBtn->setVisible(!voice_disabled);
}
- LLPanel::draw();
-
- if (is_in_tuning_mode && voice_enabled)
- {
- const S32 num_bars = 5;
- F32 voice_power = LLVoiceClient::getInstance()->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
- S32 discrete_power = llmin(num_bars, llfloor(voice_power * (F32)num_bars + 0.1f));
-
- for(S32 power_bar_idx = 0; power_bar_idx < num_bars; power_bar_idx++)
- {
- std::string view_name = llformat("%s%d", "bar", power_bar_idx);
- LLView* bar_view = getChild<LLView>(view_name);
- if (bar_view)
- {
- gl_rect_2d(bar_view->getRect(), LLColor4::grey, TRUE);
-
- LLColor4 color;
- if (power_bar_idx < discrete_power)
- {
- color = (power_bar_idx >= 3) ? LLUIColorTable::instance().getColor("OverdrivenColor") : LLUIColorTable::instance().getColor("SpeakingColor");
- }
- else
- {
- color = LLUIColorTable::instance().getColor("PanelFocusBackgroundColor");
- }
-
- LLRect color_rect = bar_view->getRect();
- color_rect.stretch(-1);
- gl_rect_2d(color_rect, color, TRUE);
- }
- }
- }
+ LLPanel::draw();
+
+ if (is_in_tuning_mode && voice_enabled)
+ {
+ const S32 num_bars = 5;
+ F32 voice_power = LLVoiceClient::getInstance()->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
+ S32 discrete_power = llmin(num_bars, llfloor(voice_power * (F32)num_bars + 0.1f));
+
+ for(S32 power_bar_idx = 0; power_bar_idx < num_bars; power_bar_idx++)
+ {
+ std::string view_name = llformat("%s%d", "bar", power_bar_idx);
+ LLView* bar_view = getChild<LLView>(view_name);
+ if (bar_view)
+ {
+ gl_rect_2d(bar_view->getRect(), LLColor4::grey, TRUE);
+
+ LLColor4 color;
+ if (power_bar_idx < discrete_power)
+ {
+ color = (power_bar_idx >= 3) ? LLUIColorTable::instance().getColor("OverdrivenColor") : LLUIColorTable::instance().getColor("SpeakingColor");
+ }
+ else
+ {
+ color = LLUIColorTable::instance().getColor("PanelFocusBackgroundColor");
+ }
+
+ LLRect color_rect = bar_view->getRect();
+ color_rect.stretch(-1);
+ gl_rect_2d(color_rect, color, TRUE);
+ }
+ }
+ }
}
void LLPanelVoiceDeviceSettings::apply()
{
- std::string s;
- if(mCtrlInputDevices)
- {
- s = mCtrlInputDevices->getValue().asString();
- gSavedSettings.setString("VoiceInputAudioDevice", s);
- mInputDevice = s;
- }
-
- if(mCtrlOutputDevices)
- {
- s = mCtrlOutputDevices->getValue().asString();
- gSavedSettings.setString("VoiceOutputAudioDevice", s);
- mOutputDevice = s;
- }
-
- // assume we are being destroyed by closing our embedding window
- LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
- if(volume_slider)
- {
- F32 slider_value = (F32)volume_slider->getValue().asReal();
- gSavedSettings.setF32("AudioLevelMic", slider_value);
- mMicVolume = slider_value;
- }
+ std::string s;
+ if(mCtrlInputDevices)
+ {
+ s = mCtrlInputDevices->getValue().asString();
+ gSavedSettings.setString("VoiceInputAudioDevice", s);
+ mInputDevice = s;
+ }
+
+ if(mCtrlOutputDevices)
+ {
+ s = mCtrlOutputDevices->getValue().asString();
+ gSavedSettings.setString("VoiceOutputAudioDevice", s);
+ mOutputDevice = s;
+ }
+
+ // assume we are being destroyed by closing our embedding window
+ LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
+ if(volume_slider)
+ {
+ F32 slider_value = (F32)volume_slider->getValue().asReal();
+ gSavedSettings.setF32("AudioLevelMic", slider_value);
+ mMicVolume = slider_value;
+ }
}
void LLPanelVoiceDeviceSettings::cancel()
{
- gSavedSettings.setString("VoiceInputAudioDevice", mInputDevice);
- gSavedSettings.setString("VoiceOutputAudioDevice", mOutputDevice);
+ gSavedSettings.setString("VoiceInputAudioDevice", mInputDevice);
+ gSavedSettings.setString("VoiceOutputAudioDevice", mOutputDevice);
- if(mCtrlInputDevices)
- mCtrlInputDevices->setValue(mInputDevice);
+ if(mCtrlInputDevices)
+ mCtrlInputDevices->setValue(mInputDevice);
- if(mCtrlOutputDevices)
- mCtrlOutputDevices->setValue(mOutputDevice);
+ if(mCtrlOutputDevices)
+ mCtrlOutputDevices->setValue(mOutputDevice);
- gSavedSettings.setF32("AudioLevelMic", mMicVolume);
- LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
- if(volume_slider)
- {
- volume_slider->setValue(mMicVolume);
- }
+ gSavedSettings.setF32("AudioLevelMic", mMicVolume);
+ LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
+ if(volume_slider)
+ {
+ volume_slider->setValue(mMicVolume);
+ }
}
void LLPanelVoiceDeviceSettings::refresh()
{
- //grab current volume
- LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
- // set mic volume tuning slider based on last mic volume setting
- F32 current_volume = (F32)volume_slider->getValue().asReal();
- LLVoiceClient::getInstance()->tuningSetMicVolume(current_volume);
-
- // Fill in popup menus
- bool device_settings_available = LLVoiceClient::getInstance()->deviceSettingsAvailable();
-
- if (mCtrlInputDevices)
- {
- mCtrlInputDevices->setEnabled(device_settings_available);
- }
-
- if (mCtrlOutputDevices)
- {
- mCtrlOutputDevices->setEnabled(device_settings_available);
- }
-
- getChild<LLSlider>("mic_volume_slider")->setEnabled(device_settings_available);
-
- if(!device_settings_available)
- {
- // The combo boxes are disabled, since we can't get the device settings from the daemon just now.
- // Put the currently set default (ONLY) in the box, and select it.
- if(mCtrlInputDevices)
- {
- mCtrlInputDevices->removeall();
- mCtrlInputDevices->add(getLocalizedDeviceName(mInputDevice), mInputDevice, ADD_BOTTOM);
- mCtrlInputDevices->setValue(mInputDevice);
- }
- if(mCtrlOutputDevices)
- {
- mCtrlOutputDevices->removeall();
- mCtrlOutputDevices->add(getLocalizedDeviceName(mOutputDevice), mOutputDevice, ADD_BOTTOM);
- mCtrlOutputDevices->setValue(mOutputDevice);
- }
- }
- else if (LLVoiceClient::getInstance()->deviceSettingsUpdated())
- {
- LLVoiceDeviceList::const_iterator device;
-
- if(mCtrlInputDevices)
- {
- mCtrlInputDevices->removeall();
- mCtrlInputDevices->add(getLocalizedDeviceName(DEFAULT_DEVICE), DEFAULT_DEVICE, ADD_BOTTOM);
-
- for(device=LLVoiceClient::getInstance()->getCaptureDevices().begin();
- device != LLVoiceClient::getInstance()->getCaptureDevices().end();
- device++)
- {
- mCtrlInputDevices->add(getLocalizedDeviceName(device->display_name), device->full_name, ADD_BOTTOM);
- }
-
- // Fix invalid input audio device preference.
- if (!mCtrlInputDevices->setSelectedByValue(mInputDevice, TRUE))
- {
- mCtrlInputDevices->setValue(DEFAULT_DEVICE);
- gSavedSettings.setString("VoiceInputAudioDevice", DEFAULT_DEVICE);
- mInputDevice = DEFAULT_DEVICE;
- }
- }
-
- if(mCtrlOutputDevices)
- {
- mCtrlOutputDevices->removeall();
- mCtrlOutputDevices->add(getLocalizedDeviceName(DEFAULT_DEVICE), DEFAULT_DEVICE, ADD_BOTTOM);
-
- for(device = LLVoiceClient::getInstance()->getRenderDevices().begin();
- device != LLVoiceClient::getInstance()->getRenderDevices().end();
+ //grab current volume
+ LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
+ // set mic volume tuning slider based on last mic volume setting
+ F32 current_volume = (F32)volume_slider->getValue().asReal();
+ LLVoiceClient::getInstance()->tuningSetMicVolume(current_volume);
+
+ // Fill in popup menus
+ bool device_settings_available = LLVoiceClient::getInstance()->deviceSettingsAvailable();
+
+ if (mCtrlInputDevices)
+ {
+ mCtrlInputDevices->setEnabled(device_settings_available);
+ }
+
+ if (mCtrlOutputDevices)
+ {
+ mCtrlOutputDevices->setEnabled(device_settings_available);
+ }
+
+ getChild<LLSlider>("mic_volume_slider")->setEnabled(device_settings_available);
+
+ if(!device_settings_available)
+ {
+ // The combo boxes are disabled, since we can't get the device settings from the daemon just now.
+ // Put the currently set default (ONLY) in the box, and select it.
+ if(mCtrlInputDevices)
+ {
+ mCtrlInputDevices->removeall();
+ mCtrlInputDevices->add(getLocalizedDeviceName(mInputDevice), mInputDevice, ADD_BOTTOM);
+ mCtrlInputDevices->setValue(mInputDevice);
+ }
+ if(mCtrlOutputDevices)
+ {
+ mCtrlOutputDevices->removeall();
+ mCtrlOutputDevices->add(getLocalizedDeviceName(mOutputDevice), mOutputDevice, ADD_BOTTOM);
+ mCtrlOutputDevices->setValue(mOutputDevice);
+ }
+ }
+ else if (LLVoiceClient::getInstance()->deviceSettingsUpdated())
+ {
+ LLVoiceDeviceList::const_iterator device;
+
+ if(mCtrlInputDevices)
+ {
+ mCtrlInputDevices->removeall();
+ mCtrlInputDevices->add(getLocalizedDeviceName(DEFAULT_DEVICE), DEFAULT_DEVICE, ADD_BOTTOM);
+
+ for(device=LLVoiceClient::getInstance()->getCaptureDevices().begin();
+ device != LLVoiceClient::getInstance()->getCaptureDevices().end();
device++)
- {
+ {
+ mCtrlInputDevices->add(getLocalizedDeviceName(device->display_name), device->full_name, ADD_BOTTOM);
+ }
+
+ // Fix invalid input audio device preference.
+ if (!mCtrlInputDevices->setSelectedByValue(mInputDevice, TRUE))
+ {
+ mCtrlInputDevices->setValue(DEFAULT_DEVICE);
+ gSavedSettings.setString("VoiceInputAudioDevice", DEFAULT_DEVICE);
+ mInputDevice = DEFAULT_DEVICE;
+ }
+ }
+
+ if(mCtrlOutputDevices)
+ {
+ mCtrlOutputDevices->removeall();
+ mCtrlOutputDevices->add(getLocalizedDeviceName(DEFAULT_DEVICE), DEFAULT_DEVICE, ADD_BOTTOM);
+
+ for(device = LLVoiceClient::getInstance()->getRenderDevices().begin();
+ device != LLVoiceClient::getInstance()->getRenderDevices().end();
+ device++)
+ {
mCtrlOutputDevices->add(getLocalizedDeviceName(device->display_name), device->full_name, ADD_BOTTOM);
- }
-
- // Fix invalid output audio device preference.
- if (!mCtrlOutputDevices->setSelectedByValue(mOutputDevice, TRUE))
- {
- mCtrlOutputDevices->setValue(DEFAULT_DEVICE);
- gSavedSettings.setString("VoiceOutputAudioDevice", DEFAULT_DEVICE);
- mOutputDevice = DEFAULT_DEVICE;
- }
- }
- }
+ }
+
+ // Fix invalid output audio device preference.
+ if (!mCtrlOutputDevices->setSelectedByValue(mOutputDevice, TRUE))
+ {
+ mCtrlOutputDevices->setValue(DEFAULT_DEVICE);
+ gSavedSettings.setString("VoiceOutputAudioDevice", DEFAULT_DEVICE);
+ mOutputDevice = DEFAULT_DEVICE;
+ }
+ }
+ }
}
void LLPanelVoiceDeviceSettings::initialize()
{
- mInputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
- mOutputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
- mMicVolume = gSavedSettings.getF32("AudioLevelMic");
-
- // ask for new device enumeration
- LLVoiceClient::getInstance()->refreshDeviceLists();
-
- // put voice client in "tuning" mode
- if (mUseTuningMode)
- {
- LLVoiceClient::getInstance()->tuningStart();
- LLVoiceChannel::suspend();
- }
+ mInputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
+ mOutputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
+ mMicVolume = gSavedSettings.getF32("AudioLevelMic");
+
+ // ask for new device enumeration
+ LLVoiceClient::getInstance()->refreshDeviceLists();
+
+ // put voice client in "tuning" mode
+ if (mUseTuningMode)
+ {
+ LLVoiceClient::getInstance()->tuningStart();
+ LLVoiceChannel::suspend();
+ }
}
void LLPanelVoiceDeviceSettings::cleanup()
{
- if (mUseTuningMode)
- {
- LLVoiceClient::getInstance()->tuningStop();
- LLVoiceChannel::resume();
- }
+ if (mUseTuningMode)
+ {
+ LLVoiceClient::getInstance()->tuningStop();
+ LLVoiceChannel::resume();
+ }
}
// returns English name if no translation found
std::string LLPanelVoiceDeviceSettings::getLocalizedDeviceName(const std::string& en_dev_name)
{
- std::map<std::string, std::string>::const_iterator it = mLocalizedDeviceNames.find(en_dev_name);
- return it != mLocalizedDeviceNames.end() ? it->second : en_dev_name;
+ std::map<std::string, std::string>::const_iterator it = mLocalizedDeviceNames.find(en_dev_name);
+ return it != mLocalizedDeviceNames.end() ? it->second : en_dev_name;
}
void LLPanelVoiceDeviceSettings::onCommitInputDevice()
{
- if(LLVoiceClient::getInstance())
- {
- mInputDevice = mCtrlInputDevices->getValue().asString();
- LLVoiceClient::getInstance()->setRenderDevice(mInputDevice);
- }
+ if(LLVoiceClient::getInstance())
+ {
+ mInputDevice = mCtrlInputDevices->getValue().asString();
+ LLVoiceClient::getInstance()->setRenderDevice(mInputDevice);
+ }
}
void LLPanelVoiceDeviceSettings::onCommitOutputDevice()
{
- if(LLVoiceClient::getInstance())
- {
-
- mOutputDevice = mCtrlOutputDevices->getValue().asString();
- LLVoiceClient::getInstance()->setRenderDevice(mOutputDevice);
- }
+ if(LLVoiceClient::getInstance())
+ {
+
+ mOutputDevice = mCtrlOutputDevices->getValue().asString();
+ LLVoiceClient::getInstance()->setRenderDevice(mOutputDevice);
+ }
}
void LLPanelVoiceDeviceSettings::onOutputDevicesClicked()
{
- LLVoiceClient::getInstance()->refreshDeviceLists(false); // fill in the pop up menus again if needed.
+ LLVoiceClient::getInstance()->refreshDeviceLists(false); // fill in the pop up menus again if needed.
}
void LLPanelVoiceDeviceSettings::onInputDevicesClicked()
{
- LLVoiceClient::getInstance()->refreshDeviceLists(false); // fill in the pop up menus again if needed.
+ LLVoiceClient::getInstance()->refreshDeviceLists(false); // fill in the pop up menus again if needed.
}
void LLPanelVoiceDeviceSettings::onCommitUnmute()
diff --git a/indra/newview/llpanelvoicedevicesettings.h b/indra/newview/llpanelvoicedevicesettings.h
index e704394d4a..1c170b135c 100644
--- a/indra/newview/llpanelvoicedevicesettings.h
+++ b/indra/newview/llpanelvoicedevicesettings.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelvoicedevicesettings.h
* @author Richard Nelson
* @brief Voice communication set-up wizard
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,39 +33,39 @@
class LLPanelVoiceDeviceSettings : public LLPanel
{
public:
- LLPanelVoiceDeviceSettings();
- ~LLPanelVoiceDeviceSettings();
+ LLPanelVoiceDeviceSettings();
+ ~LLPanelVoiceDeviceSettings();
+
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL postBuild();
+ void apply();
+ void cancel();
+ void refresh();
+ void initialize();
+ void cleanup();
- /*virtual*/ void draw();
- /*virtual*/ BOOL postBuild();
- void apply();
- void cancel();
- void refresh();
- void initialize();
- void cleanup();
+ /*virtual*/ void onVisibilityChange ( BOOL new_visibility );
- /*virtual*/ void onVisibilityChange ( BOOL new_visibility );
+ void setUseTuningMode(bool use) { mUseTuningMode = use; };
- void setUseTuningMode(bool use) { mUseTuningMode = use; };
-
protected:
- std::string getLocalizedDeviceName(const std::string& en_dev_name);
+ std::string getLocalizedDeviceName(const std::string& en_dev_name);
- void onCommitInputDevice();
- void onCommitOutputDevice();
- void onOutputDevicesClicked();
- void onInputDevicesClicked();
+ void onCommitInputDevice();
+ void onCommitOutputDevice();
+ void onOutputDevicesClicked();
+ void onInputDevicesClicked();
void onCommitUnmute();
- F32 mMicVolume;
- std::string mInputDevice;
- std::string mOutputDevice;
- class LLComboBox *mCtrlInputDevices;
- class LLComboBox *mCtrlOutputDevices;
+ F32 mMicVolume;
+ std::string mInputDevice;
+ std::string mOutputDevice;
+ class LLComboBox *mCtrlInputDevices;
+ class LLComboBox *mCtrlOutputDevices;
class LLButton *mUnmuteBtn;
- BOOL mDevicesUpdated;
- bool mUseTuningMode;
- std::map<std::string, std::string> mLocalizedDeviceNames;
+ BOOL mDevicesUpdated;
+ bool mUseTuningMode;
+ std::map<std::string, std::string> mLocalizedDeviceNames;
};
#endif // LL_LLPANELVOICEDEVICESETTINGS_H
diff --git a/indra/newview/llpanelvoiceeffect.cpp b/indra/newview/llpanelvoiceeffect.cpp
index a3f0e25ef0..681d35dafc 100644
--- a/indra/newview/llpanelvoiceeffect.cpp
+++ b/indra/newview/llpanelvoiceeffect.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelvoiceeffect.cpp
* @author Aimee
* @brief Panel to select Voice Morphs.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,45 +40,45 @@
static LLPanelInjector<LLPanelVoiceEffect> t_panel_voice_effect("panel_voice_effect");
LLPanelVoiceEffect::LLPanelVoiceEffect()
- : mVoiceEffectCombo(NULL)
+ : mVoiceEffectCombo(NULL)
{
- mCommitCallbackRegistrar.add("Voice.CommitVoiceEffect", boost::bind(&LLPanelVoiceEffect::onCommitVoiceEffect, this));
+ mCommitCallbackRegistrar.add("Voice.CommitVoiceEffect", boost::bind(&LLPanelVoiceEffect::onCommitVoiceEffect, this));
}
LLPanelVoiceEffect::~LLPanelVoiceEffect()
{
- LLView* combo_list_view = mVoiceEffectCombo->getChildView("ComboBox");
- LLTransientFloaterMgr::getInstance()->removeControlView(combo_list_view);
-
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interface)
- {
- effect_interface->removeObserver(this);
- }
- }
+ LLView* combo_list_view = mVoiceEffectCombo->getChildView("ComboBox");
+ LLTransientFloaterMgr::getInstance()->removeControlView(combo_list_view);
+
+ if(LLVoiceClient::instanceExists())
+ {
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interface)
+ {
+ effect_interface->removeObserver(this);
+ }
+ }
}
// virtual
BOOL LLPanelVoiceEffect::postBuild()
{
- mVoiceEffectCombo = getChild<LLComboBox>("voice_effect");
+ mVoiceEffectCombo = getChild<LLComboBox>("voice_effect");
- // Need to tell LLTransientFloaterMgr about the combo list, otherwise it can't
- // be clicked while in a docked floater as it extends outside the floater area.
- LLView* combo_list_view = mVoiceEffectCombo->getChildView("ComboBox");
- LLTransientFloaterMgr::getInstance()->addControlView(combo_list_view);
+ // Need to tell LLTransientFloaterMgr about the combo list, otherwise it can't
+ // be clicked while in a docked floater as it extends outside the floater area.
+ LLView* combo_list_view = mVoiceEffectCombo->getChildView("ComboBox");
+ LLTransientFloaterMgr::getInstance()->addControlView(combo_list_view);
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interface)
- {
- effect_interface->addObserver(this);
- }
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interface)
+ {
+ effect_interface->addObserver(this);
+ }
- update(true);
+ update(true);
- return TRUE;
+ return TRUE;
}
//////////////////////////////////////////////////////////////////////////
@@ -87,79 +87,79 @@ BOOL LLPanelVoiceEffect::postBuild()
void LLPanelVoiceEffect::onCommitVoiceEffect()
{
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (!effect_interface)
- {
- mVoiceEffectCombo->setEnabled(false);
- return;
- }
-
- LLSD value = mVoiceEffectCombo->getValue();
- if (value.asInteger() == PREVIEW_VOICE_EFFECTS)
- {
- // Open the Voice Morph preview floater
- LLFloaterReg::showInstance("voice_effect");
- }
- else if (value.asInteger() == GET_VOICE_EFFECTS)
- {
- // Open the voice morphing info web page
- LLWeb::loadURL(LLTrans::getString("voice_morphing_url"));
- }
- else
- {
- effect_interface->setVoiceEffect(value.asUUID());
- }
-
- mVoiceEffectCombo->setValue(effect_interface->getVoiceEffect());
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (!effect_interface)
+ {
+ mVoiceEffectCombo->setEnabled(false);
+ return;
+ }
+
+ LLSD value = mVoiceEffectCombo->getValue();
+ if (value.asInteger() == PREVIEW_VOICE_EFFECTS)
+ {
+ // Open the Voice Morph preview floater
+ LLFloaterReg::showInstance("voice_effect");
+ }
+ else if (value.asInteger() == GET_VOICE_EFFECTS)
+ {
+ // Open the voice morphing info web page
+ LLWeb::loadURL(LLTrans::getString("voice_morphing_url"));
+ }
+ else
+ {
+ effect_interface->setVoiceEffect(value.asUUID());
+ }
+
+ mVoiceEffectCombo->setValue(effect_interface->getVoiceEffect());
}
// virtual
void LLPanelVoiceEffect::onVoiceEffectChanged(bool effect_list_updated)
{
- update(effect_list_updated);
+ update(effect_list_updated);
}
void LLPanelVoiceEffect::update(bool list_updated)
{
- if (mVoiceEffectCombo)
- {
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- if (!effect_interface) return;
- if (list_updated)
- {
- // Add the default "No Voice Morph" entry.
- mVoiceEffectCombo->removeall();
- mVoiceEffectCombo->add(getString("no_voice_effect"), LLUUID::null);
- mVoiceEffectCombo->addSeparator();
-
- // Add entries for each Voice Morph.
- const voice_effect_list_t& effect_list = effect_interface->getVoiceEffectList();
- if (!effect_list.empty())
- {
- for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it)
- {
- mVoiceEffectCombo->add(it->first, it->second, ADD_BOTTOM);
- }
-
- mVoiceEffectCombo->addSeparator();
- }
-
- // Add the fixed entries to go to the preview floater or marketing page.
- mVoiceEffectCombo->add(getString("preview_voice_effects"), PREVIEW_VOICE_EFFECTS);
- mVoiceEffectCombo->add(getString("get_voice_effects"), GET_VOICE_EFFECTS);
- }
-
- if (effect_interface && LLVoiceClient::instance().isVoiceWorking())
- {
- // Select the current Voice Morph.
- mVoiceEffectCombo->setValue(effect_interface->getVoiceEffect());
- mVoiceEffectCombo->setEnabled(true);
- }
- else
- {
- // If voice isn't working or Voice Effects are not supported disable the control.
- mVoiceEffectCombo->setValue(LLUUID::null);
- mVoiceEffectCombo->setEnabled(false);
- }
- }
+ if (mVoiceEffectCombo)
+ {
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (!effect_interface) return;
+ if (list_updated)
+ {
+ // Add the default "No Voice Morph" entry.
+ mVoiceEffectCombo->removeall();
+ mVoiceEffectCombo->add(getString("no_voice_effect"), LLUUID::null);
+ mVoiceEffectCombo->addSeparator();
+
+ // Add entries for each Voice Morph.
+ const voice_effect_list_t& effect_list = effect_interface->getVoiceEffectList();
+ if (!effect_list.empty())
+ {
+ for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it)
+ {
+ mVoiceEffectCombo->add(it->first, it->second, ADD_BOTTOM);
+ }
+
+ mVoiceEffectCombo->addSeparator();
+ }
+
+ // Add the fixed entries to go to the preview floater or marketing page.
+ mVoiceEffectCombo->add(getString("preview_voice_effects"), PREVIEW_VOICE_EFFECTS);
+ mVoiceEffectCombo->add(getString("get_voice_effects"), GET_VOICE_EFFECTS);
+ }
+
+ if (effect_interface && LLVoiceClient::instance().isVoiceWorking())
+ {
+ // Select the current Voice Morph.
+ mVoiceEffectCombo->setValue(effect_interface->getVoiceEffect());
+ mVoiceEffectCombo->setEnabled(true);
+ }
+ else
+ {
+ // If voice isn't working or Voice Effects are not supported disable the control.
+ mVoiceEffectCombo->setValue(LLUUID::null);
+ mVoiceEffectCombo->setEnabled(false);
+ }
+ }
}
diff --git a/indra/newview/llpanelvoiceeffect.h b/indra/newview/llpanelvoiceeffect.h
index bba525e1df..4acb8abca2 100644
--- a/indra/newview/llpanelvoiceeffect.h
+++ b/indra/newview/llpanelvoiceeffect.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelvoiceeffect.h
* @author Aimee
* @brief Panel to select Voice Effects.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,33 +34,33 @@
class LLComboBox;
class LLPanelVoiceEffect
- : public LLPanel
- , public LLVoiceEffectObserver
+ : public LLPanel
+ , public LLVoiceEffectObserver
{
public:
- LOG_CLASS(LLPanelVoiceEffect);
+ LOG_CLASS(LLPanelVoiceEffect);
- LLPanelVoiceEffect();
- virtual ~LLPanelVoiceEffect();
+ LLPanelVoiceEffect();
+ virtual ~LLPanelVoiceEffect();
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
private:
- void onCommitVoiceEffect();
- void update(bool list_updated);
+ void onCommitVoiceEffect();
+ void update(bool list_updated);
- /// Called by voice effect provider when voice effect list is changed.
- virtual void onVoiceEffectChanged(bool effect_list_updated);
+ /// Called by voice effect provider when voice effect list is changed.
+ virtual void onVoiceEffectChanged(bool effect_list_updated);
- // Fixed entries in the Voice Morph list
- typedef enum e_voice_effect_combo_items
- {
- NO_VOICE_EFFECT = 0,
- PREVIEW_VOICE_EFFECTS = 1,
- GET_VOICE_EFFECTS = 2
- } EVoiceEffectComboItems;
+ // Fixed entries in the Voice Morph list
+ typedef enum e_voice_effect_combo_items
+ {
+ NO_VOICE_EFFECT = 0,
+ PREVIEW_VOICE_EFFECTS = 1,
+ GET_VOICE_EFFECTS = 2
+ } EVoiceEffectComboItems;
- LLComboBox* mVoiceEffectCombo;
+ LLComboBox* mVoiceEffectCombo;
};
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index 595609b4de..7a483a44ea 100644
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelvolume.cpp
* @brief Object editing (position, scale, etc.) in the tools floater
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -90,63 +90,63 @@ const F32 DEFAULT_GRAVITY_MULTIPLIER = 1.f;
const F32 DEFAULT_DENSITY = 1000.f;
// "Features" Tab
-BOOL LLPanelVolume::postBuild()
+BOOL LLPanelVolume::postBuild()
{
- // Flexible Objects Parameters
- {
- childSetCommitCallback("Animated Mesh Checkbox Ctrl", boost::bind(&LLPanelVolume::onCommitAnimatedMeshCheckbox, this, _1, _2), NULL);
- childSetCommitCallback("Flexible1D Checkbox Ctrl", boost::bind(&LLPanelVolume::onCommitIsFlexible, this, _1, _2), NULL);
- childSetCommitCallback("FlexNumSections",onCommitFlexible,this);
- getChild<LLUICtrl>("FlexNumSections")->setValidateBeforeCommit(precommitValidate);
- childSetCommitCallback("FlexGravity",onCommitFlexible,this);
- getChild<LLUICtrl>("FlexGravity")->setValidateBeforeCommit(precommitValidate);
- childSetCommitCallback("FlexFriction",onCommitFlexible,this);
- getChild<LLUICtrl>("FlexFriction")->setValidateBeforeCommit(precommitValidate);
- childSetCommitCallback("FlexWind",onCommitFlexible,this);
- getChild<LLUICtrl>("FlexWind")->setValidateBeforeCommit(precommitValidate);
- childSetCommitCallback("FlexTension",onCommitFlexible,this);
- getChild<LLUICtrl>("FlexTension")->setValidateBeforeCommit(precommitValidate);
- childSetCommitCallback("FlexForceX",onCommitFlexible,this);
- getChild<LLUICtrl>("FlexForceX")->setValidateBeforeCommit(precommitValidate);
- childSetCommitCallback("FlexForceY",onCommitFlexible,this);
- getChild<LLUICtrl>("FlexForceY")->setValidateBeforeCommit(precommitValidate);
- childSetCommitCallback("FlexForceZ",onCommitFlexible,this);
- getChild<LLUICtrl>("FlexForceZ")->setValidateBeforeCommit(precommitValidate);
- }
-
- // LIGHT Parameters
- {
- childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this);
- LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- if(LightColorSwatch){
- LightColorSwatch->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelColor, this, _2));
- LightColorSwatch->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectColor, this, _2));
- childSetCommitCallback("colorswatch",onCommitLight,this);
- }
-
- LLTextureCtrl* LightTexPicker = getChild<LLTextureCtrl>("light texture control");
- if (LightTexPicker)
- {
- LightTexPicker->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelTexture, this, _2));
- LightTexPicker->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectTexture, this, _2));
- childSetCommitCallback("light texture control", onCommitLight, this);
- }
-
- childSetCommitCallback("Light Intensity",onCommitLight,this);
- getChild<LLUICtrl>("Light Intensity")->setValidateBeforeCommit(precommitValidate);
- childSetCommitCallback("Light Radius",onCommitLight,this);
- getChild<LLUICtrl>("Light Radius")->setValidateBeforeCommit(precommitValidate);
- childSetCommitCallback("Light Falloff",onCommitLight,this);
- getChild<LLUICtrl>("Light Falloff")->setValidateBeforeCommit(precommitValidate);
-
- childSetCommitCallback("Light FOV", onCommitLight, this);
- getChild<LLUICtrl>("Light FOV")->setValidateBeforeCommit( precommitValidate);
- childSetCommitCallback("Light Focus", onCommitLight, this);
- getChild<LLUICtrl>("Light Focus")->setValidateBeforeCommit( precommitValidate);
- childSetCommitCallback("Light Ambiance", onCommitLight, this);
- getChild<LLUICtrl>("Light Ambiance")->setValidateBeforeCommit( precommitValidate);
- }
-
+ // Flexible Objects Parameters
+ {
+ childSetCommitCallback("Animated Mesh Checkbox Ctrl", boost::bind(&LLPanelVolume::onCommitAnimatedMeshCheckbox, this, _1, _2), NULL);
+ childSetCommitCallback("Flexible1D Checkbox Ctrl", boost::bind(&LLPanelVolume::onCommitIsFlexible, this, _1, _2), NULL);
+ childSetCommitCallback("FlexNumSections",onCommitFlexible,this);
+ getChild<LLUICtrl>("FlexNumSections")->setValidateBeforeCommit(precommitValidate);
+ childSetCommitCallback("FlexGravity",onCommitFlexible,this);
+ getChild<LLUICtrl>("FlexGravity")->setValidateBeforeCommit(precommitValidate);
+ childSetCommitCallback("FlexFriction",onCommitFlexible,this);
+ getChild<LLUICtrl>("FlexFriction")->setValidateBeforeCommit(precommitValidate);
+ childSetCommitCallback("FlexWind",onCommitFlexible,this);
+ getChild<LLUICtrl>("FlexWind")->setValidateBeforeCommit(precommitValidate);
+ childSetCommitCallback("FlexTension",onCommitFlexible,this);
+ getChild<LLUICtrl>("FlexTension")->setValidateBeforeCommit(precommitValidate);
+ childSetCommitCallback("FlexForceX",onCommitFlexible,this);
+ getChild<LLUICtrl>("FlexForceX")->setValidateBeforeCommit(precommitValidate);
+ childSetCommitCallback("FlexForceY",onCommitFlexible,this);
+ getChild<LLUICtrl>("FlexForceY")->setValidateBeforeCommit(precommitValidate);
+ childSetCommitCallback("FlexForceZ",onCommitFlexible,this);
+ getChild<LLUICtrl>("FlexForceZ")->setValidateBeforeCommit(precommitValidate);
+ }
+
+ // LIGHT Parameters
+ {
+ childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this);
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ if(LightColorSwatch){
+ LightColorSwatch->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelColor, this, _2));
+ LightColorSwatch->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectColor, this, _2));
+ childSetCommitCallback("colorswatch",onCommitLight,this);
+ }
+
+ LLTextureCtrl* LightTexPicker = getChild<LLTextureCtrl>("light texture control");
+ if (LightTexPicker)
+ {
+ LightTexPicker->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelTexture, this, _2));
+ LightTexPicker->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectTexture, this, _2));
+ childSetCommitCallback("light texture control", onCommitLight, this);
+ }
+
+ childSetCommitCallback("Light Intensity",onCommitLight,this);
+ getChild<LLUICtrl>("Light Intensity")->setValidateBeforeCommit(precommitValidate);
+ childSetCommitCallback("Light Radius",onCommitLight,this);
+ getChild<LLUICtrl>("Light Radius")->setValidateBeforeCommit(precommitValidate);
+ childSetCommitCallback("Light Falloff",onCommitLight,this);
+ getChild<LLUICtrl>("Light Falloff")->setValidateBeforeCommit(precommitValidate);
+
+ childSetCommitCallback("Light FOV", onCommitLight, this);
+ getChild<LLUICtrl>("Light FOV")->setValidateBeforeCommit( precommitValidate);
+ childSetCommitCallback("Light Focus", onCommitLight, this);
+ getChild<LLUICtrl>("Light Focus")->setValidateBeforeCommit( precommitValidate);
+ childSetCommitCallback("Light Ambiance", onCommitLight, this);
+ getChild<LLUICtrl>("Light Ambiance")->setValidateBeforeCommit( precommitValidate);
+ }
+
// REFLECTION PROBE Parameters
{
childSetCommitCallback("Reflection Probe", onCommitIsReflectionProbe, this);
@@ -156,71 +156,71 @@ BOOL LLPanelVolume::postBuild()
childSetCommitCallback("Probe Near Clip", onCommitProbe, this);
}
- // PHYSICS Parameters
- {
- // PhysicsShapeType combobox
- mComboPhysicsShapeType = getChild<LLComboBox>("Physics Shape Type Combo Ctrl");
- mComboPhysicsShapeType->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsShapeType, this, _1, mComboPhysicsShapeType));
-
- // PhysicsGravity
- mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity");
- mSpinPhysicsGravity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsGravity, this, _1, mSpinPhysicsGravity));
+ // PHYSICS Parameters
+ {
+ // PhysicsShapeType combobox
+ mComboPhysicsShapeType = getChild<LLComboBox>("Physics Shape Type Combo Ctrl");
+ mComboPhysicsShapeType->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsShapeType, this, _1, mComboPhysicsShapeType));
+
+ // PhysicsGravity
+ mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity");
+ mSpinPhysicsGravity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsGravity, this, _1, mSpinPhysicsGravity));
- // PhysicsFriction
- mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction");
- mSpinPhysicsFriction->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsFriction, this, _1, mSpinPhysicsFriction));
+ // PhysicsFriction
+ mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction");
+ mSpinPhysicsFriction->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsFriction, this, _1, mSpinPhysicsFriction));
- // PhysicsDensity
- mSpinPhysicsDensity = getChild<LLSpinCtrl>("Physics Density");
- mSpinPhysicsDensity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsDensity, this, _1, mSpinPhysicsDensity));
+ // PhysicsDensity
+ mSpinPhysicsDensity = getChild<LLSpinCtrl>("Physics Density");
+ mSpinPhysicsDensity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsDensity, this, _1, mSpinPhysicsDensity));
- // PhysicsRestitution
- mSpinPhysicsRestitution = getChild<LLSpinCtrl>("Physics Restitution");
- mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution));
- }
+ // PhysicsRestitution
+ mSpinPhysicsRestitution = getChild<LLSpinCtrl>("Physics Restitution");
+ mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution));
+ }
mMenuClipboardFeatures = getChild<LLMenuButton>("clipboard_features_params_btn");
mMenuClipboardLight = getChild<LLMenuButton>("clipboard_light_params_btn");
- std::map<std::string, std::string> material_name_map;
- material_name_map["Stone"]= LLTrans::getString("Stone");
- material_name_map["Metal"]= LLTrans::getString("Metal");
- material_name_map["Glass"]= LLTrans::getString("Glass");
- material_name_map["Wood"]= LLTrans::getString("Wood");
- material_name_map["Flesh"]= LLTrans::getString("Flesh");
- material_name_map["Plastic"]= LLTrans::getString("Plastic");
- material_name_map["Rubber"]= LLTrans::getString("Rubber");
- material_name_map["Light"]= LLTrans::getString("Light");
-
- LLMaterialTable::basic.initTableTransNames(material_name_map);
-
- // material type popup
- mComboMaterial = getChild<LLComboBox>("material");
- childSetCommitCallback("material",onCommitMaterial,this);
- mComboMaterial->removeall();
-
- for (LLMaterialTable::info_list_t::iterator iter = LLMaterialTable::basic.mMaterialInfoList.begin();
- iter != LLMaterialTable::basic.mMaterialInfoList.end(); ++iter)
- {
- LLMaterialInfo* minfop = *iter;
- if (minfop->mMCode != LL_MCODE_LIGHT)
- {
- mComboMaterial->add(minfop->mName);
- }
- }
- mComboMaterialItemCount = mComboMaterial->getItemCount();
-
- // Start with everyone disabled
- clearCtrls();
-
- return TRUE;
+ std::map<std::string, std::string> material_name_map;
+ material_name_map["Stone"]= LLTrans::getString("Stone");
+ material_name_map["Metal"]= LLTrans::getString("Metal");
+ material_name_map["Glass"]= LLTrans::getString("Glass");
+ material_name_map["Wood"]= LLTrans::getString("Wood");
+ material_name_map["Flesh"]= LLTrans::getString("Flesh");
+ material_name_map["Plastic"]= LLTrans::getString("Plastic");
+ material_name_map["Rubber"]= LLTrans::getString("Rubber");
+ material_name_map["Light"]= LLTrans::getString("Light");
+
+ LLMaterialTable::basic.initTableTransNames(material_name_map);
+
+ // material type popup
+ mComboMaterial = getChild<LLComboBox>("material");
+ childSetCommitCallback("material",onCommitMaterial,this);
+ mComboMaterial->removeall();
+
+ for (LLMaterialTable::info_list_t::iterator iter = LLMaterialTable::basic.mMaterialInfoList.begin();
+ iter != LLMaterialTable::basic.mMaterialInfoList.end(); ++iter)
+ {
+ LLMaterialInfo* minfop = *iter;
+ if (minfop->mMCode != LL_MCODE_LIGHT)
+ {
+ mComboMaterial->add(minfop->mName);
+ }
+ }
+ mComboMaterialItemCount = mComboMaterial->getItemCount();
+
+ // Start with everyone disabled
+ clearCtrls();
+
+ return TRUE;
}
LLPanelVolume::LLPanelVolume()
- : LLPanel(),
- mComboMaterialItemCount(0)
+ : LLPanel(),
+ mComboMaterialItemCount(0)
{
- setMouseOpaque(FALSE);
+ setMouseOpaque(FALSE);
mCommitCallbackRegistrar.add("PanelVolume.menuDoToSelected", boost::bind(&LLPanelVolume::menuDoToSelected, this, _2));
mEnableCallbackRegistrar.add("PanelVolume.menuEnable", boost::bind(&LLPanelVolume::menuEnableItem, this, _2));
@@ -229,142 +229,142 @@ LLPanelVolume::LLPanelVolume()
LLPanelVolume::~LLPanelVolume()
{
- // Children all cleaned up by default view destructor.
+ // Children all cleaned up by default view destructor.
}
void LLPanelVolume::getState( )
{
- LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
- LLViewerObject* root_objectp = objectp;
- if(!objectp)
- {
- objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
- // *FIX: shouldn't we just keep the child?
- if (objectp)
- {
- LLViewerObject* parentp = objectp->getRootEdit();
-
- if (parentp)
- {
- root_objectp = parentp;
- }
- else
- {
- root_objectp = objectp;
- }
- }
- }
-
- LLVOVolume *volobjp = NULL;
- if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME))
- {
- volobjp = (LLVOVolume *)objectp;
- }
- LLVOVolume *root_volobjp = NULL;
+ LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
+ LLViewerObject* root_objectp = objectp;
+ if(!objectp)
+ {
+ objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
+ // *FIX: shouldn't we just keep the child?
+ if (objectp)
+ {
+ LLViewerObject* parentp = objectp->getRootEdit();
+
+ if (parentp)
+ {
+ root_objectp = parentp;
+ }
+ else
+ {
+ root_objectp = objectp;
+ }
+ }
+ }
+
+ LLVOVolume *volobjp = NULL;
+ if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME))
+ {
+ volobjp = (LLVOVolume *)objectp;
+ }
+ LLVOVolume *root_volobjp = NULL;
if (root_objectp && (root_objectp->getPCode() == LL_PCODE_VOLUME))
{
root_volobjp = (LLVOVolume *)root_objectp;
}
-
- if( !objectp )
- {
- //forfeit focus
- if (gFocusMgr.childHasKeyboardFocus(this))
- {
- gFocusMgr.setKeyboardFocus(NULL);
- }
-
- // Disable all text input fields
- clearCtrls();
-
- return;
- }
-
- LLUUID owner_id;
- std::string owner_name;
- LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
-
- // BUG? Check for all objects being editable?
- BOOL editable = root_objectp->permModify() && !root_objectp->isPermanentEnforced();
- BOOL single_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )
- && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1;
- BOOL single_root_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) &&
+
+ if( !objectp )
+ {
+ //forfeit focus
+ if (gFocusMgr.childHasKeyboardFocus(this))
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+
+ // Disable all text input fields
+ clearCtrls();
+
+ return;
+ }
+
+ LLUUID owner_id;
+ std::string owner_name;
+ LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
+
+ // BUG? Check for all objects being editable?
+ BOOL editable = root_objectp->permModify() && !root_objectp->isPermanentEnforced();
+ BOOL single_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )
+ && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1;
+ BOOL single_root_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) &&
LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() == 1;
- // Select Single Message
- if (single_volume)
- {
- getChildView("edit_object")->setVisible(true);
- getChildView("edit_object")->setEnabled(true);
- getChildView("select_single")->setVisible(false);
- }
- else
- {
- getChildView("edit_object")->setVisible(false);
- getChildView("select_single")->setVisible(true);
- getChildView("select_single")->setEnabled(true);
- }
-
- // Light properties
- BOOL is_light = volobjp && volobjp->getIsLight();
- getChild<LLUICtrl>("Light Checkbox Ctrl")->setValue(is_light);
- getChildView("Light Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp);
-
- if (is_light && editable && single_volume)
- {
- //mLabelColor ->setEnabled( TRUE );
- LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- if(LightColorSwatch)
- {
- LightColorSwatch->setEnabled( TRUE );
- LightColorSwatch->setValid( TRUE );
- LightColorSwatch->set(volobjp->getLightSRGBBaseColor());
- }
-
- LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
- if (LightTextureCtrl)
- {
- LightTextureCtrl->setEnabled(TRUE);
- LightTextureCtrl->setValid(TRUE);
- LightTextureCtrl->setImageAssetID(volobjp->getLightTextureID());
- }
-
- getChildView("Light Intensity")->setEnabled(true);
- getChildView("Light Radius")->setEnabled(true);
- getChildView("Light Falloff")->setEnabled(true);
-
- getChildView("Light FOV")->setEnabled(true);
- getChildView("Light Focus")->setEnabled(true);
- getChildView("Light Ambiance")->setEnabled(true);
-
- getChild<LLUICtrl>("Light Intensity")->setValue(volobjp->getLightIntensity());
- getChild<LLUICtrl>("Light Radius")->setValue(volobjp->getLightRadius());
- getChild<LLUICtrl>("Light Falloff")->setValue(volobjp->getLightFalloff());
-
- LLVector3 params = volobjp->getSpotLightParams();
- getChild<LLUICtrl>("Light FOV")->setValue(params.mV[0]);
- getChild<LLUICtrl>("Light Focus")->setValue(params.mV[1]);
- getChild<LLUICtrl>("Light Ambiance")->setValue(params.mV[2]);
-
- mLightSavedColor = volobjp->getLightSRGBBaseColor();
- }
- else
- {
- getChild<LLSpinCtrl>("Light Intensity", true)->clear();
- getChild<LLSpinCtrl>("Light Radius", true)->clear();
- getChild<LLSpinCtrl>("Light Falloff", true)->clear();
-
- LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- if(LightColorSwatch)
- {
- LightColorSwatch->setEnabled( FALSE );
- LightColorSwatch->setValid( FALSE );
- }
- LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
- if (LightTextureCtrl)
- {
- LightTextureCtrl->setEnabled(FALSE);
- LightTextureCtrl->setValid(FALSE);
+ // Select Single Message
+ if (single_volume)
+ {
+ getChildView("edit_object")->setVisible(true);
+ getChildView("edit_object")->setEnabled(true);
+ getChildView("select_single")->setVisible(false);
+ }
+ else
+ {
+ getChildView("edit_object")->setVisible(false);
+ getChildView("select_single")->setVisible(true);
+ getChildView("select_single")->setEnabled(true);
+ }
+
+ // Light properties
+ BOOL is_light = volobjp && volobjp->getIsLight();
+ getChild<LLUICtrl>("Light Checkbox Ctrl")->setValue(is_light);
+ getChildView("Light Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp);
+
+ if (is_light && editable && single_volume)
+ {
+ //mLabelColor ->setEnabled( TRUE );
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ if(LightColorSwatch)
+ {
+ LightColorSwatch->setEnabled( TRUE );
+ LightColorSwatch->setValid( TRUE );
+ LightColorSwatch->set(volobjp->getLightSRGBBaseColor());
+ }
+
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ if (LightTextureCtrl)
+ {
+ LightTextureCtrl->setEnabled(TRUE);
+ LightTextureCtrl->setValid(TRUE);
+ LightTextureCtrl->setImageAssetID(volobjp->getLightTextureID());
+ }
+
+ getChildView("Light Intensity")->setEnabled(true);
+ getChildView("Light Radius")->setEnabled(true);
+ getChildView("Light Falloff")->setEnabled(true);
+
+ getChildView("Light FOV")->setEnabled(true);
+ getChildView("Light Focus")->setEnabled(true);
+ getChildView("Light Ambiance")->setEnabled(true);
+
+ getChild<LLUICtrl>("Light Intensity")->setValue(volobjp->getLightIntensity());
+ getChild<LLUICtrl>("Light Radius")->setValue(volobjp->getLightRadius());
+ getChild<LLUICtrl>("Light Falloff")->setValue(volobjp->getLightFalloff());
+
+ LLVector3 params = volobjp->getSpotLightParams();
+ getChild<LLUICtrl>("Light FOV")->setValue(params.mV[0]);
+ getChild<LLUICtrl>("Light Focus")->setValue(params.mV[1]);
+ getChild<LLUICtrl>("Light Ambiance")->setValue(params.mV[2]);
+
+ mLightSavedColor = volobjp->getLightSRGBBaseColor();
+ }
+ else
+ {
+ getChild<LLSpinCtrl>("Light Intensity", true)->clear();
+ getChild<LLSpinCtrl>("Light Radius", true)->clear();
+ getChild<LLSpinCtrl>("Light Falloff", true)->clear();
+
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ if(LightColorSwatch)
+ {
+ LightColorSwatch->setEnabled( FALSE );
+ LightColorSwatch->setValid( FALSE );
+ }
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ if (LightTextureCtrl)
+ {
+ LightTextureCtrl->setEnabled(FALSE);
+ LightTextureCtrl->setValid(FALSE);
if (objectp->isAttachment())
{
@@ -374,16 +374,16 @@ void LLPanelVolume::getState( )
{
LightTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
}
- }
+ }
- getChildView("Light Intensity")->setEnabled(false);
- getChildView("Light Radius")->setEnabled(false);
- getChildView("Light Falloff")->setEnabled(false);
+ getChildView("Light Intensity")->setEnabled(false);
+ getChildView("Light Radius")->setEnabled(false);
+ getChildView("Light Falloff")->setEnabled(false);
- getChildView("Light FOV")->setEnabled(false);
- getChildView("Light Focus")->setEnabled(false);
- getChildView("Light Ambiance")->setEnabled(false);
- }
+ getChildView("Light FOV")->setEnabled(false);
+ getChildView("Light Focus")->setEnabled(false);
+ getChildView("Light Ambiance")->setEnabled(false);
+ }
// Reflection Probe
BOOL is_probe = volobjp && volobjp->isReflectionProbe();
@@ -423,12 +423,12 @@ void LLPanelVolume::getState( )
}
// Animated Mesh
- BOOL is_animated_mesh = single_root_volume && root_volobjp && root_volobjp->isAnimatedObject();
- getChild<LLUICtrl>("Animated Mesh Checkbox Ctrl")->setValue(is_animated_mesh);
+ BOOL is_animated_mesh = single_root_volume && root_volobjp && root_volobjp->isAnimatedObject();
+ getChild<LLUICtrl>("Animated Mesh Checkbox Ctrl")->setValue(is_animated_mesh);
BOOL enabled_animated_object_box = FALSE;
if (root_volobjp && root_volobjp == volobjp)
{
- enabled_animated_object_box = single_root_volume && root_volobjp && root_volobjp->canBeAnimatedObject() && editable;
+ enabled_animated_object_box = single_root_volume && root_volobjp && root_volobjp->canBeAnimatedObject() && editable;
#if 0
if (!enabled_animated_object_box)
{
@@ -441,7 +441,7 @@ void LLPanelVolume::getState( )
}
}
#endif
- if (enabled_animated_object_box && !is_animated_mesh &&
+ if (enabled_animated_object_box && !is_animated_mesh &&
root_volobjp->isAttachment() && !gAgentAvatarp->canAttachMoreAnimatedObjects())
{
// Turning this attachment animated would cause us to exceed the limit.
@@ -449,182 +449,182 @@ void LLPanelVolume::getState( )
}
}
getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(enabled_animated_object_box);
-
- //refresh any bakes
- if (root_volobjp)
- {
- root_volobjp->refreshBakeTexture();
-
- LLViewerObject::const_child_list_t& child_list = root_volobjp->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
- if (objectp)
- {
- objectp->refreshBakeTexture();
- }
- }
-
- if (gAgentAvatarp)
- {
- gAgentAvatarp->updateMeshVisibility();
- }
- }
-
- // Flexible properties
- BOOL is_flexible = volobjp && volobjp->isFlexible();
- getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(is_flexible);
- if (is_flexible || (volobjp && volobjp->canBeFlexible()))
- {
- getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp && !volobjp->isMesh() && !objectp->isPermanentEnforced());
- }
- else
- {
- getChildView("Flexible1D Checkbox Ctrl")->setEnabled(false);
- }
- if (is_flexible && editable && single_volume)
- {
- getChildView("FlexNumSections")->setVisible(true);
- getChildView("FlexGravity")->setVisible(true);
- getChildView("FlexTension")->setVisible(true);
- getChildView("FlexFriction")->setVisible(true);
- getChildView("FlexWind")->setVisible(true);
- getChildView("FlexForceX")->setVisible(true);
- getChildView("FlexForceY")->setVisible(true);
- getChildView("FlexForceZ")->setVisible(true);
-
- getChildView("FlexNumSections")->setEnabled(true);
- getChildView("FlexGravity")->setEnabled(true);
- getChildView("FlexTension")->setEnabled(true);
- getChildView("FlexFriction")->setEnabled(true);
- getChildView("FlexWind")->setEnabled(true);
- getChildView("FlexForceX")->setEnabled(true);
- getChildView("FlexForceY")->setEnabled(true);
- getChildView("FlexForceZ")->setEnabled(true);
-
- LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
-
- getChild<LLUICtrl>("FlexNumSections")->setValue((F32)attributes->getSimulateLOD());
- getChild<LLUICtrl>("FlexGravity")->setValue(attributes->getGravity());
- getChild<LLUICtrl>("FlexTension")->setValue(attributes->getTension());
- getChild<LLUICtrl>("FlexFriction")->setValue(attributes->getAirFriction());
- getChild<LLUICtrl>("FlexWind")->setValue(attributes->getWindSensitivity());
- getChild<LLUICtrl>("FlexForceX")->setValue(attributes->getUserForce().mV[VX]);
- getChild<LLUICtrl>("FlexForceY")->setValue(attributes->getUserForce().mV[VY]);
- getChild<LLUICtrl>("FlexForceZ")->setValue(attributes->getUserForce().mV[VZ]);
- }
- else
- {
- getChild<LLSpinCtrl>("FlexNumSections", true)->clear();
- getChild<LLSpinCtrl>("FlexGravity", true)->clear();
- getChild<LLSpinCtrl>("FlexTension", true)->clear();
- getChild<LLSpinCtrl>("FlexFriction", true)->clear();
- getChild<LLSpinCtrl>("FlexWind", true)->clear();
- getChild<LLSpinCtrl>("FlexForceX", true)->clear();
- getChild<LLSpinCtrl>("FlexForceY", true)->clear();
- getChild<LLSpinCtrl>("FlexForceZ", true)->clear();
-
- getChildView("FlexNumSections")->setEnabled(false);
- getChildView("FlexGravity")->setEnabled(false);
- getChildView("FlexTension")->setEnabled(false);
- getChildView("FlexFriction")->setEnabled(false);
- getChildView("FlexWind")->setEnabled(false);
- getChildView("FlexForceX")->setEnabled(false);
- getChildView("FlexForceY")->setEnabled(false);
- getChildView("FlexForceZ")->setEnabled(false);
- }
-
- // Material properties
-
- // Update material part
- // slightly inefficient - materials are unique per object, not per TE
- U8 material_code = 0;
- struct f : public LLSelectedTEGetFunctor<U8>
- {
- U8 get(LLViewerObject* object, S32 te)
- {
- return object->getMaterial();
- }
- } func;
- bool material_same = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_code );
- std::string LEGACY_FULLBRIGHT_DESC = LLTrans::getString("Fullbright");
- if (editable && single_volume && material_same)
- {
- mComboMaterial->setEnabled( TRUE );
- if (material_code == LL_MCODE_LIGHT)
- {
- if (mComboMaterial->getItemCount() == mComboMaterialItemCount)
- {
- mComboMaterial->add(LEGACY_FULLBRIGHT_DESC);
- }
- mComboMaterial->setSimple(LEGACY_FULLBRIGHT_DESC);
- }
- else
- {
- if (mComboMaterial->getItemCount() != mComboMaterialItemCount)
- {
- mComboMaterial->remove(LEGACY_FULLBRIGHT_DESC);
- }
-
- mComboMaterial->setSimple(std::string(LLMaterialTable::basic.getName(material_code)));
- }
- }
- else
- {
- mComboMaterial->setEnabled( FALSE );
- }
-
- // Physics properties
-
- mSpinPhysicsGravity->set(objectp->getPhysicsGravity());
- mSpinPhysicsGravity->setEnabled(editable);
-
- mSpinPhysicsFriction->set(objectp->getPhysicsFriction());
- mSpinPhysicsFriction->setEnabled(editable);
-
- mSpinPhysicsDensity->set(objectp->getPhysicsDensity());
- mSpinPhysicsDensity->setEnabled(editable);
-
- mSpinPhysicsRestitution->set(objectp->getPhysicsRestitution());
- mSpinPhysicsRestitution->setEnabled(editable);
-
- // update the physics shape combo to include allowed physics shapes
- mComboPhysicsShapeType->removeall();
- mComboPhysicsShapeType->add(getString("None"), LLSD(1));
-
- BOOL isMesh = FALSE;
- LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
- if (sculpt_params)
- {
- U8 sculpt_type = sculpt_params->getSculptType();
- U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK;
- isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH);
- }
-
- if(isMesh && objectp)
- {
- const LLVolumeParams &volume_params = objectp->getVolume()->getParams();
- LLUUID mesh_id = volume_params.getSculptID();
- if(gMeshRepo.hasPhysicsShape(mesh_id))
- {
- // if a mesh contains an uploaded or decomposed physics mesh,
- // allow 'Prim'
- mComboPhysicsShapeType->add(getString("Prim"), LLSD(0));
- }
- }
- else
- {
- // simple prims always allow physics shape prim
- mComboPhysicsShapeType->add(getString("Prim"), LLSD(0));
- }
-
- mComboPhysicsShapeType->add(getString("Convex Hull"), LLSD(2));
- mComboPhysicsShapeType->setValue(LLSD(objectp->getPhysicsShapeType()));
- mComboPhysicsShapeType->setEnabled(editable && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()));
-
- mObject = objectp;
- mRootObject = root_objectp;
+
+ //refresh any bakes
+ if (root_volobjp)
+ {
+ root_volobjp->refreshBakeTexture();
+
+ LLViewerObject::const_child_list_t& child_list = root_volobjp->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+ if (objectp)
+ {
+ objectp->refreshBakeTexture();
+ }
+ }
+
+ if (gAgentAvatarp)
+ {
+ gAgentAvatarp->updateMeshVisibility();
+ }
+ }
+
+ // Flexible properties
+ BOOL is_flexible = volobjp && volobjp->isFlexible();
+ getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(is_flexible);
+ if (is_flexible || (volobjp && volobjp->canBeFlexible()))
+ {
+ getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp && !volobjp->isMesh() && !objectp->isPermanentEnforced());
+ }
+ else
+ {
+ getChildView("Flexible1D Checkbox Ctrl")->setEnabled(false);
+ }
+ if (is_flexible && editable && single_volume)
+ {
+ getChildView("FlexNumSections")->setVisible(true);
+ getChildView("FlexGravity")->setVisible(true);
+ getChildView("FlexTension")->setVisible(true);
+ getChildView("FlexFriction")->setVisible(true);
+ getChildView("FlexWind")->setVisible(true);
+ getChildView("FlexForceX")->setVisible(true);
+ getChildView("FlexForceY")->setVisible(true);
+ getChildView("FlexForceZ")->setVisible(true);
+
+ getChildView("FlexNumSections")->setEnabled(true);
+ getChildView("FlexGravity")->setEnabled(true);
+ getChildView("FlexTension")->setEnabled(true);
+ getChildView("FlexFriction")->setEnabled(true);
+ getChildView("FlexWind")->setEnabled(true);
+ getChildView("FlexForceX")->setEnabled(true);
+ getChildView("FlexForceY")->setEnabled(true);
+ getChildView("FlexForceZ")->setEnabled(true);
+
+ LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
+
+ getChild<LLUICtrl>("FlexNumSections")->setValue((F32)attributes->getSimulateLOD());
+ getChild<LLUICtrl>("FlexGravity")->setValue(attributes->getGravity());
+ getChild<LLUICtrl>("FlexTension")->setValue(attributes->getTension());
+ getChild<LLUICtrl>("FlexFriction")->setValue(attributes->getAirFriction());
+ getChild<LLUICtrl>("FlexWind")->setValue(attributes->getWindSensitivity());
+ getChild<LLUICtrl>("FlexForceX")->setValue(attributes->getUserForce().mV[VX]);
+ getChild<LLUICtrl>("FlexForceY")->setValue(attributes->getUserForce().mV[VY]);
+ getChild<LLUICtrl>("FlexForceZ")->setValue(attributes->getUserForce().mV[VZ]);
+ }
+ else
+ {
+ getChild<LLSpinCtrl>("FlexNumSections", true)->clear();
+ getChild<LLSpinCtrl>("FlexGravity", true)->clear();
+ getChild<LLSpinCtrl>("FlexTension", true)->clear();
+ getChild<LLSpinCtrl>("FlexFriction", true)->clear();
+ getChild<LLSpinCtrl>("FlexWind", true)->clear();
+ getChild<LLSpinCtrl>("FlexForceX", true)->clear();
+ getChild<LLSpinCtrl>("FlexForceY", true)->clear();
+ getChild<LLSpinCtrl>("FlexForceZ", true)->clear();
+
+ getChildView("FlexNumSections")->setEnabled(false);
+ getChildView("FlexGravity")->setEnabled(false);
+ getChildView("FlexTension")->setEnabled(false);
+ getChildView("FlexFriction")->setEnabled(false);
+ getChildView("FlexWind")->setEnabled(false);
+ getChildView("FlexForceX")->setEnabled(false);
+ getChildView("FlexForceY")->setEnabled(false);
+ getChildView("FlexForceZ")->setEnabled(false);
+ }
+
+ // Material properties
+
+ // Update material part
+ // slightly inefficient - materials are unique per object, not per TE
+ U8 material_code = 0;
+ struct f : public LLSelectedTEGetFunctor<U8>
+ {
+ U8 get(LLViewerObject* object, S32 te)
+ {
+ return object->getMaterial();
+ }
+ } func;
+ bool material_same = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_code );
+ std::string LEGACY_FULLBRIGHT_DESC = LLTrans::getString("Fullbright");
+ if (editable && single_volume && material_same)
+ {
+ mComboMaterial->setEnabled( TRUE );
+ if (material_code == LL_MCODE_LIGHT)
+ {
+ if (mComboMaterial->getItemCount() == mComboMaterialItemCount)
+ {
+ mComboMaterial->add(LEGACY_FULLBRIGHT_DESC);
+ }
+ mComboMaterial->setSimple(LEGACY_FULLBRIGHT_DESC);
+ }
+ else
+ {
+ if (mComboMaterial->getItemCount() != mComboMaterialItemCount)
+ {
+ mComboMaterial->remove(LEGACY_FULLBRIGHT_DESC);
+ }
+
+ mComboMaterial->setSimple(std::string(LLMaterialTable::basic.getName(material_code)));
+ }
+ }
+ else
+ {
+ mComboMaterial->setEnabled( FALSE );
+ }
+
+ // Physics properties
+
+ mSpinPhysicsGravity->set(objectp->getPhysicsGravity());
+ mSpinPhysicsGravity->setEnabled(editable);
+
+ mSpinPhysicsFriction->set(objectp->getPhysicsFriction());
+ mSpinPhysicsFriction->setEnabled(editable);
+
+ mSpinPhysicsDensity->set(objectp->getPhysicsDensity());
+ mSpinPhysicsDensity->setEnabled(editable);
+
+ mSpinPhysicsRestitution->set(objectp->getPhysicsRestitution());
+ mSpinPhysicsRestitution->setEnabled(editable);
+
+ // update the physics shape combo to include allowed physics shapes
+ mComboPhysicsShapeType->removeall();
+ mComboPhysicsShapeType->add(getString("None"), LLSD(1));
+
+ BOOL isMesh = FALSE;
+ LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+ if (sculpt_params)
+ {
+ U8 sculpt_type = sculpt_params->getSculptType();
+ U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK;
+ isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH);
+ }
+
+ if(isMesh && objectp)
+ {
+ const LLVolumeParams &volume_params = objectp->getVolume()->getParams();
+ LLUUID mesh_id = volume_params.getSculptID();
+ if(gMeshRepo.hasPhysicsShape(mesh_id))
+ {
+ // if a mesh contains an uploaded or decomposed physics mesh,
+ // allow 'Prim'
+ mComboPhysicsShapeType->add(getString("Prim"), LLSD(0));
+ }
+ }
+ else
+ {
+ // simple prims always allow physics shape prim
+ mComboPhysicsShapeType->add(getString("Prim"), LLSD(0));
+ }
+
+ mComboPhysicsShapeType->add(getString("Convex Hull"), LLSD(2));
+ mComboPhysicsShapeType->setValue(LLSD(objectp->getPhysicsShapeType()));
+ mComboPhysicsShapeType->setEnabled(editable && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()));
+
+ mObject = objectp;
+ mRootObject = root_objectp;
mMenuClipboardFeatures->setEnabled(editable && single_volume && volobjp); // Note: physics doesn't need to be limited by single volume
mMenuClipboardLight->setEnabled(editable && single_volume && volobjp);
@@ -633,76 +633,76 @@ void LLPanelVolume::getState( )
// static
bool LLPanelVolume::precommitValidate( const LLSD& data )
{
- // TODO: Richard will fill this in later.
- return TRUE; // FALSE means that validation failed and new value should not be commited.
+ // TODO: Richard will fill this in later.
+ return TRUE; // FALSE means that validation failed and new value should not be commited.
}
void LLPanelVolume::refresh()
{
- getState();
- if (mObject.notNull() && mObject->isDead())
- {
- mObject = NULL;
- }
-
- if (mRootObject.notNull() && mRootObject->isDead())
- {
- mRootObject = NULL;
- }
-
- bool enable_mesh = false;
-
- LLSD sim_features;
- LLViewerRegion *region = gAgent.getRegion();
- if(region)
- {
- LLSD sim_features;
- region->getSimulatorFeatures(sim_features);
- enable_mesh = sim_features.has("PhysicsShapeTypes");
- }
- getChildView("label physicsshapetype")->setVisible(enable_mesh);
- getChildView("Physics Shape Type Combo Ctrl")->setVisible(enable_mesh);
- getChildView("Physics Gravity")->setVisible(enable_mesh);
- getChildView("Physics Friction")->setVisible(enable_mesh);
- getChildView("Physics Density")->setVisible(enable_mesh);
- getChildView("Physics Restitution")->setVisible(enable_mesh);
-
+ getState();
+ if (mObject.notNull() && mObject->isDead())
+ {
+ mObject = NULL;
+ }
+
+ if (mRootObject.notNull() && mRootObject->isDead())
+ {
+ mRootObject = NULL;
+ }
+
+ bool enable_mesh = false;
+
+ LLSD sim_features;
+ LLViewerRegion *region = gAgent.getRegion();
+ if(region)
+ {
+ LLSD sim_features;
+ region->getSimulatorFeatures(sim_features);
+ enable_mesh = sim_features.has("PhysicsShapeTypes");
+ }
+ getChildView("label physicsshapetype")->setVisible(enable_mesh);
+ getChildView("Physics Shape Type Combo Ctrl")->setVisible(enable_mesh);
+ getChildView("Physics Gravity")->setVisible(enable_mesh);
+ getChildView("Physics Friction")->setVisible(enable_mesh);
+ getChildView("Physics Density")->setVisible(enable_mesh);
+ getChildView("Physics Restitution")->setVisible(enable_mesh);
+
/* TODO: add/remove individual physics shape types as per the PhysicsShapeTypes simulator features */
}
void LLPanelVolume::draw()
{
- LLPanel::draw();
+ LLPanel::draw();
}
// virtual
void LLPanelVolume::clearCtrls()
{
- LLPanel::clearCtrls();
-
- getChildView("select_single")->setEnabled(false);
- getChildView("select_single")->setVisible(true);
- getChildView("edit_object")->setEnabled(false);
- getChildView("edit_object")->setVisible(false);
- getChildView("Light Checkbox Ctrl")->setEnabled(false);;
- LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- if(LightColorSwatch)
- {
- LightColorSwatch->setEnabled( FALSE );
- LightColorSwatch->setValid( FALSE );
- }
- LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
- if(LightTextureCtrl)
- {
- LightTextureCtrl->setEnabled( FALSE );
- LightTextureCtrl->setValid( FALSE );
- }
-
- getChildView("Light Intensity")->setEnabled(false);
- getChildView("Light Radius")->setEnabled(false);
- getChildView("Light Falloff")->setEnabled(false);
+ LLPanel::clearCtrls();
+
+ getChildView("select_single")->setEnabled(false);
+ getChildView("select_single")->setVisible(true);
+ getChildView("edit_object")->setEnabled(false);
+ getChildView("edit_object")->setVisible(false);
+ getChildView("Light Checkbox Ctrl")->setEnabled(false);;
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ if(LightColorSwatch)
+ {
+ LightColorSwatch->setEnabled( FALSE );
+ LightColorSwatch->setValid( FALSE );
+ }
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ if(LightTextureCtrl)
+ {
+ LightTextureCtrl->setEnabled( FALSE );
+ LightTextureCtrl->setValid( FALSE );
+ }
+
+ getChildView("Light Intensity")->setEnabled(false);
+ getChildView("Light Radius")->setEnabled(false);
+ getChildView("Light Falloff")->setEnabled(false);
getChildView("Reflection Probe")->setEnabled(false);;
getChildView("Probe Volume Type")->setEnabled(false);
@@ -710,22 +710,22 @@ void LLPanelVolume::clearCtrls()
getChildView("Probe Ambiance")->setEnabled(false);
getChildView("Probe Near Clip")->setEnabled(false);
getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(false);
- getChildView("Flexible1D Checkbox Ctrl")->setEnabled(false);
- getChildView("FlexNumSections")->setEnabled(false);
- getChildView("FlexGravity")->setEnabled(false);
- getChildView("FlexTension")->setEnabled(false);
- getChildView("FlexFriction")->setEnabled(false);
- getChildView("FlexWind")->setEnabled(false);
- getChildView("FlexForceX")->setEnabled(false);
- getChildView("FlexForceY")->setEnabled(false);
- getChildView("FlexForceZ")->setEnabled(false);
-
- mSpinPhysicsGravity->setEnabled(FALSE);
- mSpinPhysicsFriction->setEnabled(FALSE);
- mSpinPhysicsDensity->setEnabled(FALSE);
- mSpinPhysicsRestitution->setEnabled(FALSE);
-
- mComboMaterial->setEnabled( FALSE );
+ getChildView("Flexible1D Checkbox Ctrl")->setEnabled(false);
+ getChildView("FlexNumSections")->setEnabled(false);
+ getChildView("FlexGravity")->setEnabled(false);
+ getChildView("FlexTension")->setEnabled(false);
+ getChildView("FlexFriction")->setEnabled(false);
+ getChildView("FlexWind")->setEnabled(false);
+ getChildView("FlexForceX")->setEnabled(false);
+ getChildView("FlexForceY")->setEnabled(false);
+ getChildView("FlexForceZ")->setEnabled(false);
+
+ mSpinPhysicsGravity->setEnabled(FALSE);
+ mSpinPhysicsFriction->setEnabled(FALSE);
+ mSpinPhysicsDensity->setEnabled(FALSE);
+ mSpinPhysicsRestitution->setEnabled(FALSE);
+
+ mComboMaterial->setEnabled( FALSE );
}
//
@@ -734,16 +734,16 @@ void LLPanelVolume::clearCtrls()
void LLPanelVolume::sendIsLight()
{
- LLViewerObject* objectp = mObject;
- if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
- {
- return;
- }
- LLVOVolume *volobjp = (LLVOVolume *)objectp;
-
- BOOL value = getChild<LLUICtrl>("Light Checkbox Ctrl")->getValue();
- volobjp->setIsLight(value);
- LL_INFOS() << "update light sent" << LL_ENDL;
+ LLViewerObject* objectp = mObject;
+ if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
+ }
+ LLVOVolume *volobjp = (LLVOVolume *)objectp;
+
+ BOOL value = getChild<LLUICtrl>("Light Checkbox Ctrl")->getValue();
+ volobjp->setIsLight(value);
+ LL_INFOS() << "update light sent" << LL_ENDL;
}
void notify_cant_select_reflection_probe()
@@ -829,97 +829,97 @@ void LLPanelVolume::doSendIsReflectionProbe(const LLSD & notification, const LLS
void LLPanelVolume::sendIsFlexible()
{
- LLViewerObject* objectp = mObject;
- if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
- {
- return;
- }
- LLVOVolume *volobjp = (LLVOVolume *)objectp;
-
- BOOL is_flexible = getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->getValue();
- //BOOL is_flexible = mCheckFlexible1D->get();
-
- if (is_flexible)
- {
- //LLFirstUse::useFlexible();
-
- if (objectp->getClickAction() == CLICK_ACTION_SIT)
- {
- LLSelectMgr::getInstance()->selectionSetClickAction(CLICK_ACTION_NONE);
- }
-
- }
-
- if (volobjp->setIsFlexible(is_flexible))
- {
- mObject->sendShapeUpdate();
- LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom());
- }
-
- LL_INFOS() << "update flexible sent" << LL_ENDL;
+ LLViewerObject* objectp = mObject;
+ if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
+ }
+ LLVOVolume *volobjp = (LLVOVolume *)objectp;
+
+ BOOL is_flexible = getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->getValue();
+ //BOOL is_flexible = mCheckFlexible1D->get();
+
+ if (is_flexible)
+ {
+ //LLFirstUse::useFlexible();
+
+ if (objectp->getClickAction() == CLICK_ACTION_SIT)
+ {
+ LLSelectMgr::getInstance()->selectionSetClickAction(CLICK_ACTION_NONE);
+ }
+
+ }
+
+ if (volobjp->setIsFlexible(is_flexible))
+ {
+ mObject->sendShapeUpdate();
+ LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom());
+ }
+
+ LL_INFOS() << "update flexible sent" << LL_ENDL;
}
void LLPanelVolume::sendPhysicsShapeType(LLUICtrl* ctrl, void* userdata)
{
- U8 type = ctrl->getValue().asInteger();
- LLSelectMgr::getInstance()->selectionSetPhysicsType(type);
+ U8 type = ctrl->getValue().asInteger();
+ LLSelectMgr::getInstance()->selectionSetPhysicsType(type);
- refreshCost();
+ refreshCost();
}
void LLPanelVolume::sendPhysicsGravity(LLUICtrl* ctrl, void* userdata)
{
- F32 val = ctrl->getValue().asReal();
- LLSelectMgr::getInstance()->selectionSetGravity(val);
+ F32 val = ctrl->getValue().asReal();
+ LLSelectMgr::getInstance()->selectionSetGravity(val);
}
void LLPanelVolume::sendPhysicsFriction(LLUICtrl* ctrl, void* userdata)
{
- F32 val = ctrl->getValue().asReal();
- LLSelectMgr::getInstance()->selectionSetFriction(val);
+ F32 val = ctrl->getValue().asReal();
+ LLSelectMgr::getInstance()->selectionSetFriction(val);
}
void LLPanelVolume::sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata)
{
- F32 val = ctrl->getValue().asReal();
- LLSelectMgr::getInstance()->selectionSetRestitution(val);
+ F32 val = ctrl->getValue().asReal();
+ LLSelectMgr::getInstance()->selectionSetRestitution(val);
}
void LLPanelVolume::sendPhysicsDensity(LLUICtrl* ctrl, void* userdata)
{
- F32 val = ctrl->getValue().asReal();
- LLSelectMgr::getInstance()->selectionSetDensity(val);
+ F32 val = ctrl->getValue().asReal();
+ LLSelectMgr::getInstance()->selectionSetDensity(val);
}
void LLPanelVolume::refreshCost()
{
- LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
-
- if (obj)
- {
- obj->getObjectCost();
- }
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
+
+ if (obj)
+ {
+ obj->getObjectCost();
+ }
}
void LLPanelVolume::onLightCancelColor(const LLSD& data)
{
- LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- if(LightColorSwatch)
- {
- LightColorSwatch->setColor(mLightSavedColor);
- }
- onLightSelectColor(data);
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ if(LightColorSwatch)
+ {
+ LightColorSwatch->setColor(mLightSavedColor);
+ }
+ onLightSelectColor(data);
}
void LLPanelVolume::onLightCancelTexture(const LLSD& data)
{
- LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
- LLVOVolume *volobjp = (LLVOVolume *) mObject.get();
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ LLVOVolume *volobjp = (LLVOVolume *) mObject.get();
- if (volobjp && LightTextureCtrl)
- {
- // Cancel the light texture as requested
- // NORSPEC-292
+ if (volobjp && LightTextureCtrl)
+ {
+ // Cancel the light texture as requested
+ // NORSPEC-292
//
// Texture picker triggers cancel both in case of actual cancel and in case of
// selection of "None" texture.
@@ -934,44 +934,44 @@ void LLPanelVolume::onLightCancelTexture(const LLSD& data)
getChild<LLUICtrl>("Light Focus")->setValue(spot_params.mV[1]);
getChild<LLUICtrl>("Light Ambiance")->setValue(spot_params.mV[2]);
}
- }
+ }
}
void LLPanelVolume::onLightSelectColor(const LLSD& data)
{
- LLViewerObject* objectp = mObject;
- if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
- {
- return;
- }
- LLVOVolume *volobjp = (LLVOVolume *)objectp;
-
-
- LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- if(LightColorSwatch)
- {
- LLColor4 clr = LightColorSwatch->get();
- LLColor3 clr3( clr );
- volobjp->setLightSRGBColor(clr3);
- mLightSavedColor = clr;
- }
+ LLViewerObject* objectp = mObject;
+ if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
+ }
+ LLVOVolume *volobjp = (LLVOVolume *)objectp;
+
+
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ if(LightColorSwatch)
+ {
+ LLColor4 clr = LightColorSwatch->get();
+ LLColor3 clr3( clr );
+ volobjp->setLightSRGBColor(clr3);
+ mLightSavedColor = clr;
+ }
}
void LLPanelVolume::onLightSelectTexture(const LLSD& data)
{
- if (mObject.isNull() || (mObject->getPCode() != LL_PCODE_VOLUME))
- {
- return;
- }
- LLVOVolume *volobjp = (LLVOVolume *) mObject.get();
-
-
- LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
- if(LightTextureCtrl)
- {
- LLUUID id = LightTextureCtrl->getImageAssetID();
- setLightTextureID(id, LightTextureCtrl->getImageItemID(), volobjp);
- }
+ if (mObject.isNull() || (mObject->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
+ }
+ LLVOVolume *volobjp = (LLVOVolume *) mObject.get();
+
+
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ if(LightTextureCtrl)
+ {
+ LLUUID id = LightTextureCtrl->getImageAssetID();
+ setLightTextureID(id, LightTextureCtrl->getImageItemID(), volobjp);
+ }
}
void LLPanelVolume::onCopyFeatures()
@@ -1293,100 +1293,100 @@ bool LLPanelVolume::menuEnableItem(const LLSD& userdata)
// static
void LLPanelVolume::onCommitMaterial( LLUICtrl* ctrl, void* userdata )
{
- LLPanelVolume* self = (LLPanelVolume*)userdata;
- LLComboBox* box = (LLComboBox*) ctrl;
-
- if (box)
- {
- // apply the currently selected material to the object
- const std::string& material_name = box->getSimple();
- std::string LEGACY_FULLBRIGHT_DESC = LLTrans::getString("Fullbright");
- if (material_name != LEGACY_FULLBRIGHT_DESC)
- {
- U8 material_code = LLMaterialTable::basic.getMCode(material_name);
- if (self)
- {
- LLViewerObject* objectp = self->mObject;
- if (objectp)
- {
- objectp->setPhysicsGravity(DEFAULT_GRAVITY_MULTIPLIER);
- objectp->setPhysicsFriction(LLMaterialTable::basic.getFriction(material_code));
- //currently density is always set to 1000 serverside regardless of chosen material,
- //actual material density should be used here, if this behavior change
- objectp->setPhysicsDensity(DEFAULT_DENSITY);
- objectp->setPhysicsRestitution(LLMaterialTable::basic.getRestitution(material_code));
- }
- }
- LLSelectMgr::getInstance()->selectionSetMaterial(material_code);
- }
- }
+ LLPanelVolume* self = (LLPanelVolume*)userdata;
+ LLComboBox* box = (LLComboBox*) ctrl;
+
+ if (box)
+ {
+ // apply the currently selected material to the object
+ const std::string& material_name = box->getSimple();
+ std::string LEGACY_FULLBRIGHT_DESC = LLTrans::getString("Fullbright");
+ if (material_name != LEGACY_FULLBRIGHT_DESC)
+ {
+ U8 material_code = LLMaterialTable::basic.getMCode(material_name);
+ if (self)
+ {
+ LLViewerObject* objectp = self->mObject;
+ if (objectp)
+ {
+ objectp->setPhysicsGravity(DEFAULT_GRAVITY_MULTIPLIER);
+ objectp->setPhysicsFriction(LLMaterialTable::basic.getFriction(material_code));
+ //currently density is always set to 1000 serverside regardless of chosen material,
+ //actual material density should be used here, if this behavior change
+ objectp->setPhysicsDensity(DEFAULT_DENSITY);
+ objectp->setPhysicsRestitution(LLMaterialTable::basic.getRestitution(material_code));
+ }
+ }
+ LLSelectMgr::getInstance()->selectionSetMaterial(material_code);
+ }
+ }
}
// static
void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )
{
- LLPanelVolume* self = (LLPanelVolume*) userdata;
- LLViewerObject* objectp = self->mObject;
- if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
- {
- return;
- }
- LLVOVolume *volobjp = (LLVOVolume *)objectp;
-
-
- volobjp->setLightIntensity((F32)self->getChild<LLUICtrl>("Light Intensity")->getValue().asReal());
- volobjp->setLightRadius((F32)self->getChild<LLUICtrl>("Light Radius")->getValue().asReal());
- volobjp->setLightFalloff((F32)self->getChild<LLUICtrl>("Light Falloff")->getValue().asReal());
-
- LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch");
- if(LightColorSwatch)
- {
- LLColor4 clr = LightColorSwatch->get();
- volobjp->setLightSRGBColor(LLColor3(clr));
- }
-
- LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control");
- if(LightTextureCtrl)
- {
- LLUUID id = LightTextureCtrl->getImageAssetID();
+ LLPanelVolume* self = (LLPanelVolume*) userdata;
+ LLViewerObject* objectp = self->mObject;
+ if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
+ }
+ LLVOVolume *volobjp = (LLVOVolume *)objectp;
+
+
+ volobjp->setLightIntensity((F32)self->getChild<LLUICtrl>("Light Intensity")->getValue().asReal());
+ volobjp->setLightRadius((F32)self->getChild<LLUICtrl>("Light Radius")->getValue().asReal());
+ volobjp->setLightFalloff((F32)self->getChild<LLUICtrl>("Light Falloff")->getValue().asReal());
+
+ LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch");
+ if(LightColorSwatch)
+ {
+ LLColor4 clr = LightColorSwatch->get();
+ volobjp->setLightSRGBColor(LLColor3(clr));
+ }
+
+ LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control");
+ if(LightTextureCtrl)
+ {
+ LLUUID id = LightTextureCtrl->getImageAssetID();
LLUUID item_id = LightTextureCtrl->getImageItemID();
- if (id.notNull())
- {
- if (!volobjp->isLightSpotlight())
- { //this commit is making this a spot light, set UI to default params
+ if (id.notNull())
+ {
+ if (!volobjp->isLightSpotlight())
+ { //this commit is making this a spot light, set UI to default params
setLightTextureID(id, item_id, volobjp);
- LLVector3 spot_params = volobjp->getSpotLightParams();
- self->getChild<LLUICtrl>("Light FOV")->setValue(spot_params.mV[0]);
- self->getChild<LLUICtrl>("Light Focus")->setValue(spot_params.mV[1]);
- self->getChild<LLUICtrl>("Light Ambiance")->setValue(spot_params.mV[2]);
- }
- else
- { //modifying existing params, this time volobjp won't change params on its own.
+ LLVector3 spot_params = volobjp->getSpotLightParams();
+ self->getChild<LLUICtrl>("Light FOV")->setValue(spot_params.mV[0]);
+ self->getChild<LLUICtrl>("Light Focus")->setValue(spot_params.mV[1]);
+ self->getChild<LLUICtrl>("Light Ambiance")->setValue(spot_params.mV[2]);
+ }
+ else
+ { //modifying existing params, this time volobjp won't change params on its own.
if (volobjp->getLightTextureID() != id)
{
setLightTextureID(id, item_id, volobjp);
}
- LLVector3 spot_params;
- spot_params.mV[0] = (F32) self->getChild<LLUICtrl>("Light FOV")->getValue().asReal();
- spot_params.mV[1] = (F32) self->getChild<LLUICtrl>("Light Focus")->getValue().asReal();
- spot_params.mV[2] = (F32) self->getChild<LLUICtrl>("Light Ambiance")->getValue().asReal();
- volobjp->setSpotLightParams(spot_params);
- }
- }
- else if (volobjp->isLightSpotlight())
- { //no longer a spot light
- setLightTextureID(id, item_id, volobjp);
- //self->getChildView("Light FOV")->setEnabled(FALSE);
- //self->getChildView("Light Focus")->setEnabled(FALSE);
- //self->getChildView("Light Ambiance")->setEnabled(FALSE);
- }
- }
-
-
+ LLVector3 spot_params;
+ spot_params.mV[0] = (F32) self->getChild<LLUICtrl>("Light FOV")->getValue().asReal();
+ spot_params.mV[1] = (F32) self->getChild<LLUICtrl>("Light Focus")->getValue().asReal();
+ spot_params.mV[2] = (F32) self->getChild<LLUICtrl>("Light Ambiance")->getValue().asReal();
+ volobjp->setSpotLightParams(spot_params);
+ }
+ }
+ else if (volobjp->isLightSpotlight())
+ { //no longer a spot light
+ setLightTextureID(id, item_id, volobjp);
+ //self->getChildView("Light FOV")->setEnabled(FALSE);
+ //self->getChildView("Light Focus")->setEnabled(FALSE);
+ //self->getChildView("Light Ambiance")->setEnabled(FALSE);
+ }
+ }
+
+
}
-//static
+//static
void LLPanelVolume::onCommitProbe(LLUICtrl* ctrl, void* userdata)
{
LLPanelVolume* self = (LLPanelVolume*)userdata;
@@ -1430,7 +1430,7 @@ void LLPanelVolume::onCommitProbe(LLUICtrl* ctrl, void* userdata)
profile = LL_PCODE_PROFILE_SQUARE;
path = LL_PCODE_PATH_LINE;
}
-
+
LLVolumeParams params;
params.getProfileParams().setCurveType(profile);
params.getPathParams().setCurveType(path);
@@ -1442,8 +1442,8 @@ void LLPanelVolume::onCommitProbe(LLUICtrl* ctrl, void* userdata)
// static
void LLPanelVolume::onCommitIsLight( LLUICtrl* ctrl, void* userdata )
{
- LLPanelVolume* self = (LLPanelVolume*) userdata;
- self->sendIsLight();
+ LLPanelVolume* self = (LLPanelVolume*) userdata;
+ self->sendIsLight();
}
// static
@@ -1468,7 +1468,7 @@ void LLPanelVolume::setLightTextureID(const LLUUID &asset_id, const LLUUID &item
if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
{
LLToolDragAndDrop::handleDropMaterialProtections(volobjp, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null);
- }
+ }
volobjp->setLightTextureID(asset_id);
}
}
@@ -1486,47 +1486,47 @@ void LLPanelVolume::onCommitIsReflectionProbe(LLUICtrl* ctrl, void* userdata)
// static
void LLPanelVolume::onCommitFlexible( LLUICtrl* ctrl, void* userdata )
{
- LLPanelVolume* self = (LLPanelVolume*) userdata;
- LLViewerObject* objectp = self->mObject;
- if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
- {
- return;
- }
-
- LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
- if (attributes)
- {
- LLFlexibleObjectData new_attributes;
- new_attributes = *attributes;
-
-
- new_attributes.setSimulateLOD(self->getChild<LLUICtrl>("FlexNumSections")->getValue().asInteger());//(S32)self->mSpinSections->get());
- new_attributes.setGravity((F32)self->getChild<LLUICtrl>("FlexGravity")->getValue().asReal());
- new_attributes.setTension((F32)self->getChild<LLUICtrl>("FlexTension")->getValue().asReal());
- new_attributes.setAirFriction((F32)self->getChild<LLUICtrl>("FlexFriction")->getValue().asReal());
- new_attributes.setWindSensitivity((F32)self->getChild<LLUICtrl>("FlexWind")->getValue().asReal());
- F32 fx = (F32)self->getChild<LLUICtrl>("FlexForceX")->getValue().asReal();
- F32 fy = (F32)self->getChild<LLUICtrl>("FlexForceY")->getValue().asReal();
- F32 fz = (F32)self->getChild<LLUICtrl>("FlexForceZ")->getValue().asReal();
- LLVector3 force(fx,fy,fz);
-
- new_attributes.setUserForce(force);
- objectp->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE, new_attributes, true);
- }
-
- // Values may fail validation
- self->refresh();
+ LLPanelVolume* self = (LLPanelVolume*) userdata;
+ LLViewerObject* objectp = self->mObject;
+ if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
+ }
+
+ LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
+ if (attributes)
+ {
+ LLFlexibleObjectData new_attributes;
+ new_attributes = *attributes;
+
+
+ new_attributes.setSimulateLOD(self->getChild<LLUICtrl>("FlexNumSections")->getValue().asInteger());//(S32)self->mSpinSections->get());
+ new_attributes.setGravity((F32)self->getChild<LLUICtrl>("FlexGravity")->getValue().asReal());
+ new_attributes.setTension((F32)self->getChild<LLUICtrl>("FlexTension")->getValue().asReal());
+ new_attributes.setAirFriction((F32)self->getChild<LLUICtrl>("FlexFriction")->getValue().asReal());
+ new_attributes.setWindSensitivity((F32)self->getChild<LLUICtrl>("FlexWind")->getValue().asReal());
+ F32 fx = (F32)self->getChild<LLUICtrl>("FlexForceX")->getValue().asReal();
+ F32 fy = (F32)self->getChild<LLUICtrl>("FlexForceY")->getValue().asReal();
+ F32 fz = (F32)self->getChild<LLUICtrl>("FlexForceZ")->getValue().asReal();
+ LLVector3 force(fx,fy,fz);
+
+ new_attributes.setUserForce(force);
+ objectp->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE, new_attributes, true);
+ }
+
+ // Values may fail validation
+ self->refresh();
}
void LLPanelVolume::onCommitAnimatedMeshCheckbox(LLUICtrl *, void*)
{
- LLViewerObject* objectp = mObject;
- if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
- {
- return;
+ LLViewerObject* objectp = mObject;
+ if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
}
- LLVOVolume *volobjp = (LLVOVolume *)objectp;
- BOOL animated_mesh = getChild<LLUICtrl>("Animated Mesh Checkbox Ctrl")->getValue();
+ LLVOVolume *volobjp = (LLVOVolume *)objectp;
+ BOOL animated_mesh = getChild<LLUICtrl>("Animated Mesh Checkbox Ctrl")->getValue();
U32 flags = volobjp->getExtendedMeshFlags();
U32 new_flags = flags;
if (animated_mesh)
@@ -1542,49 +1542,49 @@ void LLPanelVolume::onCommitAnimatedMeshCheckbox(LLUICtrl *, void*)
volobjp->setExtendedMeshFlags(new_flags);
}
- //refresh any bakes
- if (volobjp)
- {
- volobjp->refreshBakeTexture();
-
- LLViewerObject::const_child_list_t& child_list = volobjp->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
- if (objectp)
- {
- objectp->refreshBakeTexture();
- }
- }
-
- if (gAgentAvatarp)
- {
- gAgentAvatarp->updateMeshVisibility();
- }
- }
+ //refresh any bakes
+ if (volobjp)
+ {
+ volobjp->refreshBakeTexture();
+
+ LLViewerObject::const_child_list_t& child_list = volobjp->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+ if (objectp)
+ {
+ objectp->refreshBakeTexture();
+ }
+ }
+
+ if (gAgentAvatarp)
+ {
+ gAgentAvatarp->updateMeshVisibility();
+ }
+ }
}
void LLPanelVolume::onCommitIsFlexible(LLUICtrl *, void*)
{
- if (mObject->flagObjectPermanent())
- {
- LLNotificationsUtil::add("PathfindingLinksets_ChangeToFlexiblePath", LLSD(), LLSD(), boost::bind(&LLPanelVolume::handleResponseChangeToFlexible, this, _1, _2));
- }
- else
- {
- sendIsFlexible();
- }
+ if (mObject->flagObjectPermanent())
+ {
+ LLNotificationsUtil::add("PathfindingLinksets_ChangeToFlexiblePath", LLSD(), LLSD(), boost::bind(&LLPanelVolume::handleResponseChangeToFlexible, this, _1, _2));
+ }
+ else
+ {
+ sendIsFlexible();
+ }
}
void LLPanelVolume::handleResponseChangeToFlexible(const LLSD &pNotification, const LLSD &pResponse)
{
- if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
- {
- sendIsFlexible();
- }
- else
- {
- getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(FALSE);
- }
+ if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
+ {
+ sendIsFlexible();
+ }
+ else
+ {
+ getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(FALSE);
+ }
}
diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h
index 01b7ebb75c..37b7b13d44 100644
--- a/indra/newview/llpanelvolume.h
+++ b/indra/newview/llpanelvolume.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelvolume.h
* @brief Object editing (position, scale, etc.) in the tools floater
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,18 +46,18 @@ class LLVOVolume;
class LLPanelVolume : public LLPanel
{
public:
- LLPanelVolume();
- virtual ~LLPanelVolume();
+ LLPanelVolume();
+ virtual ~LLPanelVolume();
- virtual void draw();
- virtual void clearCtrls();
+ virtual void draw();
+ virtual void clearCtrls();
- virtual BOOL postBuild();
+ virtual BOOL postBuild();
- void refresh();
+ void refresh();
+
+ void sendIsLight();
- void sendIsLight();
-
// when an object is becoming a refleciton probe, present a dialog asking for confirmation
// otherwise, send the reflection probe update immediately
void sendIsReflectionProbe();
@@ -65,25 +65,25 @@ public:
// callback for handling response of the ok/cancel/ignore dialog for making an object a reflection probe
void doSendIsReflectionProbe(const LLSD& notification, const LLSD& response);
- void sendIsFlexible();
+ void sendIsFlexible();
+
+ static bool precommitValidate(const LLSD& data);
- static bool precommitValidate(const LLSD& data);
-
- static void onCommitIsLight( LLUICtrl* ctrl, void* userdata);
- static void onCommitLight( LLUICtrl* ctrl, void* userdata);
- static void onCommitIsReflectionProbe(LLUICtrl* ctrl, void* userdata);
+ static void onCommitIsLight( LLUICtrl* ctrl, void* userdata);
+ static void onCommitLight( LLUICtrl* ctrl, void* userdata);
+ static void onCommitIsReflectionProbe(LLUICtrl* ctrl, void* userdata);
static void onCommitProbe(LLUICtrl* ctrl, void* userdata);
- void onCommitIsFlexible( LLUICtrl* ctrl, void* userdata);
- static void onCommitFlexible( LLUICtrl* ctrl, void* userdata);
+ void onCommitIsFlexible( LLUICtrl* ctrl, void* userdata);
+ static void onCommitFlexible( LLUICtrl* ctrl, void* userdata);
void onCommitAnimatedMeshCheckbox(LLUICtrl* ctrl, void* userdata);
- static void onCommitPhysicsParam( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterial( LLUICtrl* ctrl, void* userdata);
+ static void onCommitPhysicsParam( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterial( LLUICtrl* ctrl, void* userdata);
- void onLightCancelColor(const LLSD& data);
- void onLightSelectColor(const LLSD& data);
+ void onLightCancelColor(const LLSD& data);
+ void onLightSelectColor(const LLSD& data);
- void onLightCancelTexture(const LLSD& data);
- void onLightSelectTexture(const LLSD& data);
+ void onLightCancelTexture(const LLSD& data);
+ void onLightSelectTexture(const LLSD& data);
static void setLightTextureID(const LLUUID &asset_id, const LLUUID &item_id, LLVOVolume* volobjp);
@@ -91,56 +91,56 @@ public:
void onPasteFeatures();
void onCopyLight();
void onPasteLight();
-
+
void menuDoToSelected(const LLSD& userdata);
bool menuEnableItem(const LLSD& userdata);
protected:
- void getState();
- void refreshCost();
+ void getState();
+ void refreshCost();
protected:
- void sendPhysicsShapeType(LLUICtrl* ctrl, void* userdata);
- void sendPhysicsGravity(LLUICtrl* ctrl, void* userdata);
- void sendPhysicsFriction(LLUICtrl* ctrl, void* userdata);
- void sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata);
- void sendPhysicsDensity(LLUICtrl* ctrl, void* userdata);
+ void sendPhysicsShapeType(LLUICtrl* ctrl, void* userdata);
+ void sendPhysicsGravity(LLUICtrl* ctrl, void* userdata);
+ void sendPhysicsFriction(LLUICtrl* ctrl, void* userdata);
+ void sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata);
+ void sendPhysicsDensity(LLUICtrl* ctrl, void* userdata);
- void handleResponseChangeToFlexible(const LLSD &pNotification, const LLSD &pResponse);
+ void handleResponseChangeToFlexible(const LLSD &pNotification, const LLSD &pResponse);
/*
- LLTextBox* mLabelSelectSingleMessage;
- // Light
- LLCheckBoxCtrl* mCheckLight;
- LLCheckBoxCtrl* mCheckFlexible1D;
- LLTextBox* mLabelColor;
- LLColorSwatchCtrl* mLightColorSwatch;
- LLSpinCtrl* mLightIntensity;
- LLSpinCtrl* mLightRadius;
- LLSpinCtrl* mLightFalloff;
- LLSpinCtrl* mLightCutoff;
- // Flexibile
- LLSpinCtrl* mSpinSections;
- LLSpinCtrl* mSpinGravity;
- LLSpinCtrl* mSpinTension;
- LLSpinCtrl* mSpinFriction;
- LLSpinCtrl* mSpinWind;
- LLSpinCtrl* mSpinForce[3];
+ LLTextBox* mLabelSelectSingleMessage;
+ // Light
+ LLCheckBoxCtrl* mCheckLight;
+ LLCheckBoxCtrl* mCheckFlexible1D;
+ LLTextBox* mLabelColor;
+ LLColorSwatchCtrl* mLightColorSwatch;
+ LLSpinCtrl* mLightIntensity;
+ LLSpinCtrl* mLightRadius;
+ LLSpinCtrl* mLightFalloff;
+ LLSpinCtrl* mLightCutoff;
+ // Flexibile
+ LLSpinCtrl* mSpinSections;
+ LLSpinCtrl* mSpinGravity;
+ LLSpinCtrl* mSpinTension;
+ LLSpinCtrl* mSpinFriction;
+ LLSpinCtrl* mSpinWind;
+ LLSpinCtrl* mSpinForce[3];
*/
- S32 mComboMaterialItemCount;
- LLComboBox* mComboMaterial;
-
+ S32 mComboMaterialItemCount;
+ LLComboBox* mComboMaterial;
+
- LLColor4 mLightSavedColor;
- LLPointer<LLViewerObject> mObject;
- LLPointer<LLViewerObject> mRootObject;
+ LLColor4 mLightSavedColor;
+ LLPointer<LLViewerObject> mObject;
+ LLPointer<LLViewerObject> mRootObject;
- LLComboBox* mComboPhysicsShapeType;
- LLSpinCtrl* mSpinPhysicsGravity;
- LLSpinCtrl* mSpinPhysicsFriction;
- LLSpinCtrl* mSpinPhysicsDensity;
- LLSpinCtrl* mSpinPhysicsRestitution;
+ LLComboBox* mComboPhysicsShapeType;
+ LLSpinCtrl* mSpinPhysicsGravity;
+ LLSpinCtrl* mSpinPhysicsFriction;
+ LLSpinCtrl* mSpinPhysicsDensity;
+ LLSpinCtrl* mSpinPhysicsRestitution;
LLMenuButton* mMenuClipboardFeatures;
LLMenuButton* mMenuClipboardLight;
diff --git a/indra/newview/llpanelvolumepulldown.cpp b/indra/newview/llpanelvolumepulldown.cpp
index 09038ac95a..553decca2c 100644
--- a/indra/newview/llpanelvolumepulldown.cpp
+++ b/indra/newview/llpanelvolumepulldown.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelvolumepulldown.cpp
* @author Tofu Linden
* @brief A floater showing the master volume pull-down
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,46 +48,46 @@
// Default constructor
LLPanelVolumePulldown::LLPanelVolumePulldown()
{
- mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&LLPanelVolumePulldown::setControlFalse, this, _2));
- mCommitCallbackRegistrar.add("Vol.SetSounds", boost::bind(&LLPanelVolumePulldown::onClickSetSounds, this));
- mCommitCallbackRegistrar.add("Vol.updateCheckbox", boost::bind(&LLPanelVolumePulldown::updateCheckbox, this, _1, _2));
- mCommitCallbackRegistrar.add("Vol.GoAudioPrefs", boost::bind(&LLPanelVolumePulldown::onAdvancedButtonClick, this, _2));
- buildFromFile( "panel_volume_pulldown.xml");
+ mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&LLPanelVolumePulldown::setControlFalse, this, _2));
+ mCommitCallbackRegistrar.add("Vol.SetSounds", boost::bind(&LLPanelVolumePulldown::onClickSetSounds, this));
+ mCommitCallbackRegistrar.add("Vol.updateCheckbox", boost::bind(&LLPanelVolumePulldown::updateCheckbox, this, _1, _2));
+ mCommitCallbackRegistrar.add("Vol.GoAudioPrefs", boost::bind(&LLPanelVolumePulldown::onAdvancedButtonClick, this, _2));
+ buildFromFile( "panel_volume_pulldown.xml");
}
BOOL LLPanelVolumePulldown::postBuild()
{
- return LLPanelPulldown::postBuild();
+ return LLPanelPulldown::postBuild();
}
void LLPanelVolumePulldown::onAdvancedButtonClick(const LLSD& user_data)
{
- // close the global volume minicontrol, we're bringing up the big one
- setVisible(FALSE);
+ // close the global volume minicontrol, we're bringing up the big one
+ setVisible(FALSE);
- // bring up the prefs floater
- LLFloaterPreference* prefsfloater = dynamic_cast<LLFloaterPreference*>
- (LLFloaterReg::showInstance("preferences"));
- if (prefsfloater)
- {
- // grab the 'audio' panel from the preferences floater and
- // bring it the front!
- LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
- LLPanel* audiopanel = prefsfloater->getChild<LLPanel>("audio");
- if (tabcontainer && audiopanel)
- {
- tabcontainer->selectTabPanel(audiopanel);
- }
- }
+ // bring up the prefs floater
+ LLFloaterPreference* prefsfloater = dynamic_cast<LLFloaterPreference*>
+ (LLFloaterReg::showInstance("preferences"));
+ if (prefsfloater)
+ {
+ // grab the 'audio' panel from the preferences floater and
+ // bring it the front!
+ LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
+ LLPanel* audiopanel = prefsfloater->getChild<LLPanel>("audio");
+ if (tabcontainer && audiopanel)
+ {
+ tabcontainer->selectTabPanel(audiopanel);
+ }
+ }
}
void LLPanelVolumePulldown::setControlFalse(const LLSD& user_data)
{
- std::string control_name = user_data.asString();
- LLControlVariable* control = findControl(control_name);
-
- if (control)
- control->set(LLSD(FALSE));
+ std::string control_name = user_data.asString();
+ LLControlVariable* control = findControl(control_name);
+
+ if (control)
+ control->set(LLSD(FALSE));
}
void LLPanelVolumePulldown::updateCheckbox(LLUICtrl* ctrl, const LLSD& user_data)
@@ -111,7 +111,7 @@ void LLPanelVolumePulldown::updateCheckbox(LLUICtrl* ctrl, const LLSD& user_data
void LLPanelVolumePulldown::onClickSetSounds()
{
- // Disable Enable gesture sounds checkbox if the master sound is disabled
- // or if sound effects are disabled.
- getChild<LLCheckBoxCtrl>("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds"));
+ // Disable Enable gesture sounds checkbox if the master sound is disabled
+ // or if sound effects are disabled.
+ getChild<LLCheckBoxCtrl>("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds"));
}
diff --git a/indra/newview/llpanelvolumepulldown.h b/indra/newview/llpanelvolumepulldown.h
index 3243d2e968..a2816db747 100644
--- a/indra/newview/llpanelvolumepulldown.h
+++ b/indra/newview/llpanelvolumepulldown.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpanelvolumepulldown.h
* @author Tofu Linden
* @brief A panel showing the master volume pull-down
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,16 +35,16 @@
class LLPanelVolumePulldown : public LLPanelPulldown
{
public:
- LLPanelVolumePulldown();
- /*virtual*/ BOOL postBuild();
-
+ LLPanelVolumePulldown();
+ /*virtual*/ BOOL postBuild();
+
private:
- void setControlFalse(const LLSD& user_data);
- void onClickSetSounds();
- // Disables "Allow Media to auto play" check box only when both
- // "Streaming Music" and "Media" are unchecked. Otherwise enables it.
- void updateCheckbox(LLUICtrl* ctrl, const LLSD& user_data);
- void onAdvancedButtonClick(const LLSD& user_data);
+ void setControlFalse(const LLSD& user_data);
+ void onClickSetSounds();
+ // Disables "Allow Media to auto play" check box only when both
+ // "Streaming Music" and "Media" are unchecked. Otherwise enables it.
+ void updateCheckbox(LLUICtrl* ctrl, const LLSD& user_data);
+ void onAdvancedButtonClick(const LLSD& user_data);
};
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index bfdb0fbc88..b2b8e81704 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,7 +51,7 @@
// Context menu and Gear menu helper.
static void edit_outfit()
{
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
}
//////////////////////////////////////////////////////////////////////////
@@ -59,41 +59,41 @@ static void edit_outfit()
class LLWearingGearMenu
{
public:
- LLWearingGearMenu(LLPanelWearing* panel_wearing)
- : mMenu(NULL), mPanelWearing(panel_wearing)
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+ LLWearingGearMenu(LLPanelWearing* panel_wearing)
+ : mMenu(NULL), mPanelWearing(panel_wearing)
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- registrar.add("Gear.TouchAttach", boost::bind(&LLWearingGearMenu::handleMultiple, this, handle_attachment_touch));
- registrar.add("Gear.EditItem", boost::bind(&LLWearingGearMenu::handleMultiple, this, handle_item_edit));
- registrar.add("Gear.EditOutfit", boost::bind(&edit_outfit));
- registrar.add("Gear.TakeOff", boost::bind(&LLPanelWearing::onRemoveItem, mPanelWearing));
- registrar.add("Gear.Copy", boost::bind(&LLPanelWearing::copyToClipboard, mPanelWearing));
+ registrar.add("Gear.TouchAttach", boost::bind(&LLWearingGearMenu::handleMultiple, this, handle_attachment_touch));
+ registrar.add("Gear.EditItem", boost::bind(&LLWearingGearMenu::handleMultiple, this, handle_item_edit));
+ registrar.add("Gear.EditOutfit", boost::bind(&edit_outfit));
+ registrar.add("Gear.TakeOff", boost::bind(&LLPanelWearing::onRemoveItem, mPanelWearing));
+ registrar.add("Gear.Copy", boost::bind(&LLPanelWearing::copyToClipboard, mPanelWearing));
- enable_registrar.add("Gear.OnEnable", boost::bind(&LLPanelWearing::isActionEnabled, mPanelWearing, _2));
+ enable_registrar.add("Gear.OnEnable", boost::bind(&LLPanelWearing::isActionEnabled, mPanelWearing, _2));
- mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
- "menu_wearing_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- llassert(mMenu);
- }
+ mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
+ "menu_wearing_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ llassert(mMenu);
+ }
- LLToggleableMenu* getMenu() { return mMenu; }
+ LLToggleableMenu* getMenu() { return mMenu; }
private:
- void handleMultiple(std::function<void(const LLUUID& id)> functor)
- {
- uuid_vec_t selected_item_ids;
- mPanelWearing->getSelectedItemsUUIDs(selected_item_ids);
-
- for (const LLUUID& item_id : selected_item_ids)
- {
- functor(item_id);
- }
- }
-
- LLToggleableMenu* mMenu;
- LLPanelWearing* mPanelWearing;
+ void handleMultiple(std::function<void(const LLUUID& id)> functor)
+ {
+ uuid_vec_t selected_item_ids;
+ mPanelWearing->getSelectedItemsUUIDs(selected_item_ids);
+
+ for (const LLUUID& item_id : selected_item_ids)
+ {
+ functor(item_id);
+ }
+ }
+
+ LLToggleableMenu* mMenu;
+ LLPanelWearing* mPanelWearing;
};
//////////////////////////////////////////////////////////////////////////
@@ -101,72 +101,72 @@ private:
class LLWearingContextMenu : public LLListContextMenu
{
protected:
- /* virtual */ LLContextMenu* createMenu()
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-
- registrar.add("Wearing.TouchAttach", boost::bind(handleMultiple, handle_attachment_touch, mUUIDs));
- registrar.add("Wearing.EditItem", boost::bind(handleMultiple, handle_item_edit, mUUIDs));
- registrar.add("Wearing.EditOutfit", boost::bind(&edit_outfit));
- registrar.add("Wearing.ShowOriginal", boost::bind(show_item_original, mUUIDs.front()));
- registrar.add("Wearing.TakeOff",
- boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
- registrar.add("Wearing.Detach",
- boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
- LLContextMenu* menu = createFromFile("menu_wearing_tab.xml");
-
- updateMenuItemsVisibility(menu);
-
- return menu;
- }
-
- void updateMenuItemsVisibility(LLContextMenu* menu)
- {
- bool bp_selected = false; // true if body parts selected
- bool clothes_selected = false;
- bool attachments_selected = false;
-
- // See what types of wearables are selected.
- for (uuid_vec_t::const_iterator it = mUUIDs.begin(); it != mUUIDs.end(); ++it)
- {
- LLViewerInventoryItem* item = gInventory.getItem(*it);
-
- if (!item)
- {
- LL_WARNS() << "Invalid item" << LL_ENDL;
- continue;
- }
-
- LLAssetType::EType type = item->getType();
- if (type == LLAssetType::AT_CLOTHING)
- {
- clothes_selected = true;
- }
- else if (type == LLAssetType::AT_BODYPART)
- {
- bp_selected = true;
- }
- else if (type == LLAssetType::AT_OBJECT || type == LLAssetType::AT_GESTURE)
- {
- attachments_selected = true;
- }
- }
-
- // Enable/disable some menu items depending on the selection.
- bool show_touch = !bp_selected && !clothes_selected && attachments_selected;
- bool show_edit = bp_selected || clothes_selected || attachments_selected;
- bool allow_detach = !bp_selected && !clothes_selected && attachments_selected;
- bool allow_take_off = !bp_selected && clothes_selected && !attachments_selected;
-
- menu->setItemVisible("touch_attach", show_touch);
- menu->setItemEnabled("touch_attach", 1 == mUUIDs.size() && enable_attachment_touch(mUUIDs.front()));
- menu->setItemVisible("edit_item", show_edit);
- menu->setItemEnabled("edit_item", 1 == mUUIDs.size() && get_is_item_editable(mUUIDs.front()));
- menu->setItemVisible("take_off", allow_take_off);
- menu->setItemVisible("detach", allow_detach);
- menu->setItemVisible("edit_outfit_separator", show_touch | show_edit | allow_take_off || allow_detach);
- menu->setItemVisible("show_original", mUUIDs.size() == 1);
- }
+ /* virtual */ LLContextMenu* createMenu()
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+
+ registrar.add("Wearing.TouchAttach", boost::bind(handleMultiple, handle_attachment_touch, mUUIDs));
+ registrar.add("Wearing.EditItem", boost::bind(handleMultiple, handle_item_edit, mUUIDs));
+ registrar.add("Wearing.EditOutfit", boost::bind(&edit_outfit));
+ registrar.add("Wearing.ShowOriginal", boost::bind(show_item_original, mUUIDs.front()));
+ registrar.add("Wearing.TakeOff",
+ boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
+ registrar.add("Wearing.Detach",
+ boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
+ LLContextMenu* menu = createFromFile("menu_wearing_tab.xml");
+
+ updateMenuItemsVisibility(menu);
+
+ return menu;
+ }
+
+ void updateMenuItemsVisibility(LLContextMenu* menu)
+ {
+ bool bp_selected = false; // true if body parts selected
+ bool clothes_selected = false;
+ bool attachments_selected = false;
+
+ // See what types of wearables are selected.
+ for (uuid_vec_t::const_iterator it = mUUIDs.begin(); it != mUUIDs.end(); ++it)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(*it);
+
+ if (!item)
+ {
+ LL_WARNS() << "Invalid item" << LL_ENDL;
+ continue;
+ }
+
+ LLAssetType::EType type = item->getType();
+ if (type == LLAssetType::AT_CLOTHING)
+ {
+ clothes_selected = true;
+ }
+ else if (type == LLAssetType::AT_BODYPART)
+ {
+ bp_selected = true;
+ }
+ else if (type == LLAssetType::AT_OBJECT || type == LLAssetType::AT_GESTURE)
+ {
+ attachments_selected = true;
+ }
+ }
+
+ // Enable/disable some menu items depending on the selection.
+ bool show_touch = !bp_selected && !clothes_selected && attachments_selected;
+ bool show_edit = bp_selected || clothes_selected || attachments_selected;
+ bool allow_detach = !bp_selected && !clothes_selected && attachments_selected;
+ bool allow_take_off = !bp_selected && clothes_selected && !attachments_selected;
+
+ menu->setItemVisible("touch_attach", show_touch);
+ menu->setItemEnabled("touch_attach", 1 == mUUIDs.size() && enable_attachment_touch(mUUIDs.front()));
+ menu->setItemVisible("edit_item", show_edit);
+ menu->setItemEnabled("edit_item", 1 == mUUIDs.size() && get_is_item_editable(mUUIDs.front()));
+ menu->setItemVisible("take_off", allow_take_off);
+ menu->setItemVisible("detach", allow_detach);
+ menu->setItemVisible("edit_outfit_separator", show_touch | show_edit | allow_take_off || allow_detach);
+ menu->setItemVisible("show_original", mUUIDs.size() == 1);
+ }
};
//////////////////////////////////////////////////////////////////////////
@@ -174,37 +174,37 @@ protected:
class LLTempAttachmentsContextMenu : public LLListContextMenu
{
public:
- LLTempAttachmentsContextMenu(LLPanelWearing* panel_wearing)
- : mPanelWearing(panel_wearing)
- {}
+ LLTempAttachmentsContextMenu(LLPanelWearing* panel_wearing)
+ : mPanelWearing(panel_wearing)
+ {}
protected:
- /* virtual */ LLContextMenu* createMenu()
- {
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-
- registrar.add("Wearing.EditItem", boost::bind(&LLPanelWearing::onEditAttachment, mPanelWearing));
- registrar.add("Wearing.Detach", boost::bind(&LLPanelWearing::onRemoveAttachment, mPanelWearing));
- LLContextMenu* menu = createFromFile("menu_wearing_tab.xml");
-
- updateMenuItemsVisibility(menu);
-
- return menu;
- }
-
- void updateMenuItemsVisibility(LLContextMenu* menu)
- {
- menu->setItemVisible("touch_attach", TRUE);
- menu->setItemEnabled("touch_attach", 1 == mUUIDs.size());
- menu->setItemVisible("edit_item", TRUE);
- menu->setItemEnabled("edit_item", 1 == mUUIDs.size());
- menu->setItemVisible("take_off", FALSE);
- menu->setItemVisible("detach", TRUE);
- menu->setItemVisible("edit_outfit_separator", FALSE);
- menu->setItemVisible("show_original", FALSE);
- menu->setItemVisible("edit_outfit", FALSE);
- }
-
- LLPanelWearing* mPanelWearing;
+ /* virtual */ LLContextMenu* createMenu()
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+
+ registrar.add("Wearing.EditItem", boost::bind(&LLPanelWearing::onEditAttachment, mPanelWearing));
+ registrar.add("Wearing.Detach", boost::bind(&LLPanelWearing::onRemoveAttachment, mPanelWearing));
+ LLContextMenu* menu = createFromFile("menu_wearing_tab.xml");
+
+ updateMenuItemsVisibility(menu);
+
+ return menu;
+ }
+
+ void updateMenuItemsVisibility(LLContextMenu* menu)
+ {
+ menu->setItemVisible("touch_attach", TRUE);
+ menu->setItemEnabled("touch_attach", 1 == mUUIDs.size());
+ menu->setItemVisible("edit_item", TRUE);
+ menu->setItemEnabled("edit_item", 1 == mUUIDs.size());
+ menu->setItemVisible("take_off", FALSE);
+ menu->setItemVisible("detach", TRUE);
+ menu->setItemVisible("edit_outfit_separator", FALSE);
+ menu->setItemVisible("show_original", FALSE);
+ menu->setItemVisible("edit_outfit", FALSE);
+ }
+
+ LLPanelWearing* mPanelWearing;
};
//////////////////////////////////////////////////////////////////////////
@@ -212,388 +212,388 @@ protected:
static LLPanelInjector<LLPanelWearing> t_panel_wearing("panel_wearing");
LLPanelWearing::LLPanelWearing()
- : LLPanelAppearanceTab()
- , mCOFItemsList(NULL)
- , mIsInitialized(false)
- , mAttachmentsChangedConnection()
+ : LLPanelAppearanceTab()
+ , mCOFItemsList(NULL)
+ , mIsInitialized(false)
+ , mAttachmentsChangedConnection()
{
- mGearMenu = new LLWearingGearMenu(this);
- mContextMenu = new LLWearingContextMenu();
- mAttachmentsMenu = new LLTempAttachmentsContextMenu(this);
+ mGearMenu = new LLWearingGearMenu(this);
+ mContextMenu = new LLWearingContextMenu();
+ mAttachmentsMenu = new LLTempAttachmentsContextMenu(this);
}
LLPanelWearing::~LLPanelWearing()
{
- delete mGearMenu;
- delete mContextMenu;
- delete mAttachmentsMenu;
-
- if (mAttachmentsChangedConnection.connected())
- {
- mAttachmentsChangedConnection.disconnect();
- }
+ delete mGearMenu;
+ delete mContextMenu;
+ delete mAttachmentsMenu;
+
+ if (mAttachmentsChangedConnection.connected())
+ {
+ mAttachmentsChangedConnection.disconnect();
+ }
}
BOOL LLPanelWearing::postBuild()
{
- mAccordionCtrl = getChild<LLAccordionCtrl>("wearables_accordion");
- mWearablesTab = getChild<LLAccordionCtrlTab>("tab_wearables");
- mWearablesTab->setIgnoreResizeNotification(true);
- mAttachmentsTab = getChild<LLAccordionCtrlTab>("tab_temp_attachments");
- mAttachmentsTab->setDropDownStateChangedCallback(boost::bind(&LLPanelWearing::onAccordionTabStateChanged, this));
+ mAccordionCtrl = getChild<LLAccordionCtrl>("wearables_accordion");
+ mWearablesTab = getChild<LLAccordionCtrlTab>("tab_wearables");
+ mWearablesTab->setIgnoreResizeNotification(true);
+ mAttachmentsTab = getChild<LLAccordionCtrlTab>("tab_temp_attachments");
+ mAttachmentsTab->setDropDownStateChangedCallback(boost::bind(&LLPanelWearing::onAccordionTabStateChanged, this));
- mCOFItemsList = getChild<LLWearableItemsList>("cof_items_list");
- mCOFItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onWearableItemsListRightClick, this, _1, _2, _3));
+ mCOFItemsList = getChild<LLWearableItemsList>("cof_items_list");
+ mCOFItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onWearableItemsListRightClick, this, _1, _2, _3));
- mTempItemsList = getChild<LLScrollListCtrl>("temp_attachments_list");
- mTempItemsList->setFgUnselectedColor(LLColor4::white);
- mTempItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onTempAttachmentsListRightClick, this, _1, _2, _3));
+ mTempItemsList = getChild<LLScrollListCtrl>("temp_attachments_list");
+ mTempItemsList->setFgUnselectedColor(LLColor4::white);
+ mTempItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onTempAttachmentsListRightClick, this, _1, _2, _3));
- LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
+ LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
- menu_gear_btn->setMenu(mGearMenu->getMenu());
+ menu_gear_btn->setMenu(mGearMenu->getMenu());
- return TRUE;
+ return TRUE;
}
//virtual
void LLPanelWearing::onOpen(const LLSD& /*info*/)
{
- if (!mIsInitialized)
- {
- // *TODO: I'm not sure is this check necessary but it never match while developing.
- if (!gInventory.isInventoryUsable())
- return;
+ if (!mIsInitialized)
+ {
+ // *TODO: I'm not sure is this check necessary but it never match while developing.
+ if (!gInventory.isInventoryUsable())
+ return;
- const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
- // *TODO: I'm not sure is this check necessary but it never match while developing.
- LLViewerInventoryCategory* category = gInventory.getCategory(cof);
- if (!category)
- return;
+ // *TODO: I'm not sure is this check necessary but it never match while developing.
+ LLViewerInventoryCategory* category = gInventory.getCategory(cof);
+ if (!category)
+ return;
- // Start observing changes in Current Outfit category.
+ // Start observing changes in Current Outfit category.
LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLWearableItemsList::updateList, mCOFItemsList, cof));
- // Fetch Current Outfit contents and refresh the list to display
- // initially fetched items. If not all items are fetched now
- // the observer will refresh the list as soon as the new items
- // arrive.
- category->fetch();
+ // Fetch Current Outfit contents and refresh the list to display
+ // initially fetched items. If not all items are fetched now
+ // the observer will refresh the list as soon as the new items
+ // arrive.
+ category->fetch();
- mCOFItemsList->updateList(cof);
+ mCOFItemsList->updateList(cof);
- mIsInitialized = true;
- }
+ mIsInitialized = true;
+ }
}
void LLPanelWearing::draw()
{
- if (mUpdateTimer.getStarted() && (mUpdateTimer.getElapsedTimeF32() > 0.1))
- {
- mUpdateTimer.stop();
- updateAttachmentsList();
- }
- LLPanel::draw();
+ if (mUpdateTimer.getStarted() && (mUpdateTimer.getElapsedTimeF32() > 0.1))
+ {
+ mUpdateTimer.stop();
+ updateAttachmentsList();
+ }
+ LLPanel::draw();
}
void LLPanelWearing::onAccordionTabStateChanged()
{
- if(mAttachmentsTab->isExpanded())
- {
- startUpdateTimer();
- mAttachmentsChangedConnection = LLAppearanceMgr::instance().setAttachmentsChangedCallback(boost::bind(&LLPanelWearing::startUpdateTimer, this));
- }
- else
- {
- if (mAttachmentsChangedConnection.connected())
- {
- mAttachmentsChangedConnection.disconnect();
- }
- }
+ if(mAttachmentsTab->isExpanded())
+ {
+ startUpdateTimer();
+ mAttachmentsChangedConnection = LLAppearanceMgr::instance().setAttachmentsChangedCallback(boost::bind(&LLPanelWearing::startUpdateTimer, this));
+ }
+ else
+ {
+ if (mAttachmentsChangedConnection.connected())
+ {
+ mAttachmentsChangedConnection.disconnect();
+ }
+ }
}
void LLPanelWearing::startUpdateTimer()
{
- if (!mUpdateTimer.getStarted())
- {
- mUpdateTimer.start();
- }
- else
- {
- mUpdateTimer.reset();
- }
+ if (!mUpdateTimer.getStarted())
+ {
+ mUpdateTimer.start();
+ }
+ else
+ {
+ mUpdateTimer.reset();
+ }
}
// virtual
void LLPanelWearing::onFilterSubStringChanged(const std::string& new_string, const std::string& old_string)
{
- mCOFItemsList->setFilterSubString(new_string, true);
+ mCOFItemsList->setFilterSubString(new_string, true);
- mAccordionCtrl->arrange();
+ mAccordionCtrl->arrange();
}
// virtual
bool LLPanelWearing::isActionEnabled(const LLSD& userdata)
{
- const std::string command_name = userdata.asString();
-
- if (command_name == "save_outfit")
- {
- bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked();
- bool outfit_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
- // allow save only if outfit isn't locked and is dirty
- return !outfit_locked && outfit_dirty;
- }
-
- if (command_name == "take_off")
- {
- if (mWearablesTab->isExpanded())
- {
- return hasItemSelected() && canTakeOffSelected();
- }
- else
- {
- LLScrollListItem* item = mTempItemsList->getFirstSelected();
- if (item && item->getUUID().notNull())
- {
- return true;
- }
- }
- }
-
- uuid_vec_t selected_uuids;
- getSelectedItemsUUIDs(selected_uuids);
-
- if (command_name == "touch_attach")
- {
- return (1 == selected_uuids.size()) && (enable_attachment_touch(selected_uuids.front()));
- }
- else if (command_name == "edit_item")
- {
- return (1 == selected_uuids.size()) && (get_is_item_editable(selected_uuids.front()));
- }
-
- return false;
+ const std::string command_name = userdata.asString();
+
+ if (command_name == "save_outfit")
+ {
+ bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked();
+ bool outfit_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
+ // allow save only if outfit isn't locked and is dirty
+ return !outfit_locked && outfit_dirty;
+ }
+
+ if (command_name == "take_off")
+ {
+ if (mWearablesTab->isExpanded())
+ {
+ return hasItemSelected() && canTakeOffSelected();
+ }
+ else
+ {
+ LLScrollListItem* item = mTempItemsList->getFirstSelected();
+ if (item && item->getUUID().notNull())
+ {
+ return true;
+ }
+ }
+ }
+
+ uuid_vec_t selected_uuids;
+ getSelectedItemsUUIDs(selected_uuids);
+
+ if (command_name == "touch_attach")
+ {
+ return (1 == selected_uuids.size()) && (enable_attachment_touch(selected_uuids.front()));
+ }
+ else if (command_name == "edit_item")
+ {
+ return (1 == selected_uuids.size()) && (get_is_item_editable(selected_uuids.front()));
+ }
+
+ return false;
}
void LLPanelWearing::updateAttachmentsList()
{
- std::vector<LLViewerObject*> attachs = LLAgentWearables::getTempAttachments();
- mTempItemsList->deleteAllItems();
- mAttachmentsMap.clear();
- if(!attachs.empty())
- {
- if(!populateAttachmentsList())
- {
- requestAttachmentDetails();
- }
- }
- else
- {
- std::string no_attachments = getString("no_attachments");
- LLSD row;
- row["columns"][0]["column"] = "text";
- row["columns"][0]["value"] = no_attachments;
- row["columns"][0]["font"] = "SansSerifBold";
- mTempItemsList->addElement(row);
- }
+ std::vector<LLViewerObject*> attachs = LLAgentWearables::getTempAttachments();
+ mTempItemsList->deleteAllItems();
+ mAttachmentsMap.clear();
+ if(!attachs.empty())
+ {
+ if(!populateAttachmentsList())
+ {
+ requestAttachmentDetails();
+ }
+ }
+ else
+ {
+ std::string no_attachments = getString("no_attachments");
+ LLSD row;
+ row["columns"][0]["column"] = "text";
+ row["columns"][0]["value"] = no_attachments;
+ row["columns"][0]["font"] = "SansSerifBold";
+ mTempItemsList->addElement(row);
+ }
}
bool LLPanelWearing::populateAttachmentsList(bool update)
{
- bool populated = true;
- if(mTempItemsList)
- {
- mTempItemsList->deleteAllItems();
- mAttachmentsMap.clear();
- std::vector<LLViewerObject*> attachs = LLAgentWearables::getTempAttachments();
-
- std::string icon_name = LLInventoryIcon::getIconName(LLAssetType::AT_OBJECT, LLInventoryType::IT_OBJECT);
- for (std::vector<LLViewerObject*>::iterator iter = attachs.begin();
- iter != attachs.end(); ++iter)
- {
- LLViewerObject *attachment = *iter;
- LLSD row;
- row["id"] = attachment->getID();
- row["columns"][0]["column"] = "icon";
- row["columns"][0]["type"] = "icon";
- row["columns"][0]["value"] = icon_name;
- row["columns"][1]["column"] = "text";
- if(mObjectNames.count(attachment->getID()) && !mObjectNames[attachment->getID()].empty())
- {
- row["columns"][1]["value"] = mObjectNames[attachment->getID()];
- }
- else if(update)
- {
- row["columns"][1]["value"] = attachment->getID();
- populated = false;
- }
- else
- {
- row["columns"][1]["value"] = "Loading...";
- populated = false;
- }
- mTempItemsList->addElement(row);
- mAttachmentsMap[attachment->getID()] = attachment;
- }
- }
- return populated;
+ bool populated = true;
+ if(mTempItemsList)
+ {
+ mTempItemsList->deleteAllItems();
+ mAttachmentsMap.clear();
+ std::vector<LLViewerObject*> attachs = LLAgentWearables::getTempAttachments();
+
+ std::string icon_name = LLInventoryIcon::getIconName(LLAssetType::AT_OBJECT, LLInventoryType::IT_OBJECT);
+ for (std::vector<LLViewerObject*>::iterator iter = attachs.begin();
+ iter != attachs.end(); ++iter)
+ {
+ LLViewerObject *attachment = *iter;
+ LLSD row;
+ row["id"] = attachment->getID();
+ row["columns"][0]["column"] = "icon";
+ row["columns"][0]["type"] = "icon";
+ row["columns"][0]["value"] = icon_name;
+ row["columns"][1]["column"] = "text";
+ if(mObjectNames.count(attachment->getID()) && !mObjectNames[attachment->getID()].empty())
+ {
+ row["columns"][1]["value"] = mObjectNames[attachment->getID()];
+ }
+ else if(update)
+ {
+ row["columns"][1]["value"] = attachment->getID();
+ populated = false;
+ }
+ else
+ {
+ row["columns"][1]["value"] = "Loading...";
+ populated = false;
+ }
+ mTempItemsList->addElement(row);
+ mAttachmentsMap[attachment->getID()] = attachment;
+ }
+ }
+ return populated;
}
void LLPanelWearing::requestAttachmentDetails()
{
- LLSD body;
- std::string url = gAgent.getRegionCapability("AttachmentResources");
- if (!url.empty())
- {
- LLCoros::instance().launch("LLPanelWearing::getAttachmentLimitsCoro",
- boost::bind(&LLPanelWearing::getAttachmentLimitsCoro, this, url));
- }
+ LLSD body;
+ std::string url = gAgent.getRegionCapability("AttachmentResources");
+ if (!url.empty())
+ {
+ LLCoros::instance().launch("LLPanelWearing::getAttachmentLimitsCoro",
+ boost::bind(&LLPanelWearing::getAttachmentLimitsCoro, this, url));
+ }
}
void LLPanelWearing::getAttachmentLimitsCoro(std::string url)
{
- LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
- httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getAttachmentLimitsCoro", httpPolicy));
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getAttachmentLimitsCoro", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
+ LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
- LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
- if (!status)
- {
- LL_WARNS() << "Unable to retrieve attachment limits." << LL_ENDL;
- return;
- }
+ if (!status)
+ {
+ LL_WARNS() << "Unable to retrieve attachment limits." << LL_ENDL;
+ return;
+ }
- result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
- setAttachmentDetails(result);
+ result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
+ setAttachmentDetails(result);
}
void LLPanelWearing::setAttachmentDetails(LLSD content)
{
- mObjectNames.clear();
- S32 number_attachments = content["attachments"].size();
- for(int i = 0; i < number_attachments; i++)
- {
- S32 number_objects = content["attachments"][i]["objects"].size();
- for(int j = 0; j < number_objects; j++)
- {
- LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID();
- std::string name = content["attachments"][i]["objects"][j]["name"].asString();
- mObjectNames[task_id] = name;
- }
- }
- if(!mObjectNames.empty())
- {
- populateAttachmentsList(true);
- }
+ mObjectNames.clear();
+ S32 number_attachments = content["attachments"].size();
+ for(int i = 0; i < number_attachments; i++)
+ {
+ S32 number_objects = content["attachments"][i]["objects"].size();
+ for(int j = 0; j < number_objects; j++)
+ {
+ LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID();
+ std::string name = content["attachments"][i]["objects"][j]["name"].asString();
+ mObjectNames[task_id] = name;
+ }
+ }
+ if(!mObjectNames.empty())
+ {
+ populateAttachmentsList(true);
+ }
}
boost::signals2::connection LLPanelWearing::setSelectionChangeCallback(commit_callback_t cb)
{
- if (!mCOFItemsList) return boost::signals2::connection();
+ if (!mCOFItemsList) return boost::signals2::connection();
- return mCOFItemsList->setCommitCallback(cb);
+ return mCOFItemsList->setCommitCallback(cb);
}
void LLPanelWearing::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y)
{
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(ctrl);
- if (!list) return;
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(ctrl);
+ if (!list) return;
- uuid_vec_t selected_uuids;
+ uuid_vec_t selected_uuids;
- list->getSelectedUUIDs(selected_uuids);
+ list->getSelectedUUIDs(selected_uuids);
- mContextMenu->show(ctrl, selected_uuids, x, y);
+ mContextMenu->show(ctrl, selected_uuids, x, y);
}
void LLPanelWearing::onTempAttachmentsListRightClick(LLUICtrl* ctrl, S32 x, S32 y)
{
- LLScrollListCtrl* list = dynamic_cast<LLScrollListCtrl*>(ctrl);
- if (!list) return;
- list->selectItemAt(x, y, MASK_NONE);
- uuid_vec_t selected_uuids;
-
- if(list->getCurrentID().notNull())
- {
- selected_uuids.push_back(list->getCurrentID());
- mAttachmentsMenu->show(ctrl, selected_uuids, x, y);
- }
+ LLScrollListCtrl* list = dynamic_cast<LLScrollListCtrl*>(ctrl);
+ if (!list) return;
+ list->selectItemAt(x, y, MASK_NONE);
+ uuid_vec_t selected_uuids;
+
+ if(list->getCurrentID().notNull())
+ {
+ selected_uuids.push_back(list->getCurrentID());
+ mAttachmentsMenu->show(ctrl, selected_uuids, x, y);
+ }
}
bool LLPanelWearing::hasItemSelected()
{
- return mCOFItemsList->getSelectedItem() != NULL;
+ return mCOFItemsList->getSelectedItem() != NULL;
}
void LLPanelWearing::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const
{
- mCOFItemsList->getSelectedUUIDs(selected_uuids);
+ mCOFItemsList->getSelectedUUIDs(selected_uuids);
}
void LLPanelWearing::onEditAttachment()
{
- LLScrollListItem* item = mTempItemsList->getFirstSelected();
- if (item)
- {
- LLSelectMgr::getInstance()->deselectAll();
- LLSelectMgr::getInstance()->selectObjectAndFamily(mAttachmentsMap[item->getUUID()]);
- handle_object_edit();
- }
+ LLScrollListItem* item = mTempItemsList->getFirstSelected();
+ if (item)
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ LLSelectMgr::getInstance()->selectObjectAndFamily(mAttachmentsMap[item->getUUID()]);
+ handle_object_edit();
+ }
}
void LLPanelWearing::onRemoveAttachment()
{
- LLScrollListItem* item = mTempItemsList->getFirstSelected();
- if (item && item->getUUID().notNull())
- {
- LLSelectMgr::getInstance()->deselectAll();
- LLSelectMgr::getInstance()->selectObjectAndFamily(mAttachmentsMap[item->getUUID()]);
- LLSelectMgr::getInstance()->sendDetach();
- }
+ LLScrollListItem* item = mTempItemsList->getFirstSelected();
+ if (item && item->getUUID().notNull())
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ LLSelectMgr::getInstance()->selectObjectAndFamily(mAttachmentsMap[item->getUUID()]);
+ LLSelectMgr::getInstance()->sendDetach();
+ }
}
void LLPanelWearing::onRemoveItem()
{
- if (mWearablesTab->isExpanded())
- {
- uuid_vec_t selected_uuids;
- getSelectedItemsUUIDs(selected_uuids);
- LLAppearanceMgr::instance().removeItemsFromAvatar(selected_uuids);
- }
- else
- {
- onRemoveAttachment();
- }
+ if (mWearablesTab->isExpanded())
+ {
+ uuid_vec_t selected_uuids;
+ getSelectedItemsUUIDs(selected_uuids);
+ LLAppearanceMgr::instance().removeItemsFromAvatar(selected_uuids);
+ }
+ else
+ {
+ onRemoveAttachment();
+ }
}
void LLPanelWearing::copyToClipboard()
{
- std::string text;
- std::vector<LLSD> data;
- mCOFItemsList->getValues(data);
-
- for(std::vector<LLSD>::const_iterator iter = data.begin(); iter != data.end();)
- {
- LLSD uuid = (*iter);
- LLViewerInventoryItem* item = gInventory.getItem(uuid);
-
- iter++;
- if (item != NULL)
- {
- // Append a newline to all but the last line
- text += iter != data.end() ? item->getName() + "\n" : item->getName();
- }
- }
-
- LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size());
+ std::string text;
+ std::vector<LLSD> data;
+ mCOFItemsList->getValues(data);
+
+ for(std::vector<LLSD>::const_iterator iter = data.begin(); iter != data.end();)
+ {
+ LLSD uuid = (*iter);
+ LLViewerInventoryItem* item = gInventory.getItem(uuid);
+
+ iter++;
+ if (item != NULL)
+ {
+ // Append a newline to all but the last line
+ text += iter != data.end() ? item->getName() + "\n" : item->getName();
+ }
+ }
+
+ LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size());
}
// EOF
diff --git a/indra/newview/llpanelwearing.h b/indra/newview/llpanelwearing.h
index 2f3f14956a..bc1d0afc1b 100644
--- a/indra/newview/llpanelwearing.h
+++ b/indra/newview/llpanelwearing.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,62 +52,62 @@ class LLWearingGearMenu;
class LLPanelWearing : public LLPanelAppearanceTab
{
public:
- LLPanelWearing();
- virtual ~LLPanelWearing();
+ LLPanelWearing();
+ virtual ~LLPanelWearing();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /*virtual*/ void draw();
+ /*virtual*/ void draw();
- /*virtual*/ void onOpen(const LLSD& info);
+ /*virtual*/ void onOpen(const LLSD& info);
- /*virtual*/ void onFilterSubStringChanged(const std::string& new_string, const std::string& old_string);
+ /*virtual*/ void onFilterSubStringChanged(const std::string& new_string, const std::string& old_string);
- /*virtual*/ bool isActionEnabled(const LLSD& userdata);
+ /*virtual*/ bool isActionEnabled(const LLSD& userdata);
- /*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
+ /*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
- /*virtual*/ void copyToClipboard();
+ /*virtual*/ void copyToClipboard();
- void startUpdateTimer();
- void updateAttachmentsList();
+ void startUpdateTimer();
+ void updateAttachmentsList();
- boost::signals2::connection setSelectionChangeCallback(commit_callback_t cb);
+ boost::signals2::connection setSelectionChangeCallback(commit_callback_t cb);
- bool hasItemSelected();
+ bool hasItemSelected();
- bool populateAttachmentsList(bool update = false);
- void onAccordionTabStateChanged();
- void setAttachmentDetails(LLSD content);
- void requestAttachmentDetails();
- void onRemoveItem();
- void onEditAttachment();
- void onRemoveAttachment();
+ bool populateAttachmentsList(bool update = false);
+ void onAccordionTabStateChanged();
+ void setAttachmentDetails(LLSD content);
+ void requestAttachmentDetails();
+ void onRemoveItem();
+ void onEditAttachment();
+ void onRemoveAttachment();
private:
- void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
- void onTempAttachmentsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
+ void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
+ void onTempAttachmentsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
- void getAttachmentLimitsCoro(std::string url);
+ void getAttachmentLimitsCoro(std::string url);
- LLWearableItemsList* mCOFItemsList;
- LLScrollListCtrl* mTempItemsList;
- LLWearingGearMenu* mGearMenu;
- LLListContextMenu* mContextMenu;
- LLListContextMenu* mAttachmentsMenu;
+ LLWearableItemsList* mCOFItemsList;
+ LLScrollListCtrl* mTempItemsList;
+ LLWearingGearMenu* mGearMenu;
+ LLListContextMenu* mContextMenu;
+ LLListContextMenu* mAttachmentsMenu;
- LLAccordionCtrlTab* mWearablesTab;
- LLAccordionCtrlTab* mAttachmentsTab;
- LLAccordionCtrl* mAccordionCtrl;
+ LLAccordionCtrlTab* mWearablesTab;
+ LLAccordionCtrlTab* mAttachmentsTab;
+ LLAccordionCtrl* mAccordionCtrl;
- std::map<LLUUID, LLViewerObject*> mAttachmentsMap;
+ std::map<LLUUID, LLViewerObject*> mAttachmentsMap;
- std::map<LLUUID, std::string> mObjectNames;
+ std::map<LLUUID, std::string> mObjectNames;
- boost::signals2::connection mAttachmentsChangedConnection;
- LLFrameTimer mUpdateTimer;
+ boost::signals2::connection mAttachmentsChangedConnection;
+ LLFrameTimer mUpdateTimer;
- bool mIsInitialized;
+ bool mIsInitialized;
};
#endif //LL_LLPANELWEARING_H
diff --git a/indra/newview/llparcelselection.cpp b/indra/newview/llparcelselection.cpp
index 5c62159b93..12ac947dea 100644
--- a/indra/newview/llparcelselection.cpp
+++ b/indra/newview/llparcelselection.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,22 +35,22 @@
// LLParcelSelection
//
LLParcelSelection::LLParcelSelection() :
- mParcel(NULL),
- mSelectedMultipleOwners(FALSE),
- mWholeParcelSelected(FALSE),
- mSelectedSelfCount(0),
- mSelectedOtherCount(0),
- mSelectedPublicCount(0)
+ mParcel(NULL),
+ mSelectedMultipleOwners(FALSE),
+ mWholeParcelSelected(FALSE),
+ mSelectedSelfCount(0),
+ mSelectedOtherCount(0),
+ mSelectedPublicCount(0)
{
}
LLParcelSelection::LLParcelSelection(LLParcel* parcel) :
- mParcel(parcel),
- mSelectedMultipleOwners(FALSE),
- mWholeParcelSelected(FALSE),
- mSelectedSelfCount(0),
- mSelectedOtherCount(0),
- mSelectedPublicCount(0)
+ mParcel(parcel),
+ mSelectedMultipleOwners(FALSE),
+ mWholeParcelSelected(FALSE),
+ mSelectedSelfCount(0),
+ mSelectedOtherCount(0),
+ mSelectedPublicCount(0)
{
}
@@ -60,23 +60,23 @@ LLParcelSelection::~LLParcelSelection()
BOOL LLParcelSelection::getMultipleOwners() const
{
- return mSelectedMultipleOwners;
+ return mSelectedMultipleOwners;
}
BOOL LLParcelSelection::getWholeParcelSelected() const
{
- return mWholeParcelSelected;
+ return mWholeParcelSelected;
}
S32 LLParcelSelection::getClaimableArea() const
{
- const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
- return mSelectedPublicCount * UNIT_AREA;
+ const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
+ return mSelectedPublicCount * UNIT_AREA;
}
bool LLParcelSelection::hasOthersSelected() const
{
- return mSelectedOtherCount != 0;
+ return mSelectedOtherCount != 0;
}
diff --git a/indra/newview/llparcelselection.h b/indra/newview/llparcelselection.h
index 06d9141efb..ba2241bc40 100644
--- a/indra/newview/llparcelselection.h
+++ b/indra/newview/llparcelselection.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,44 +34,44 @@ class LLParcel;
class LLParcelSelection : public LLRefCount
{
- friend class LLViewerParcelMgr;
- friend class LLSafeHandle<LLParcelSelection>;
+ friend class LLViewerParcelMgr;
+ friend class LLSafeHandle<LLParcelSelection>;
protected:
- ~LLParcelSelection();
+ ~LLParcelSelection();
public:
- LLParcelSelection(LLParcel* parcel);
- LLParcelSelection();
+ LLParcelSelection(LLParcel* parcel);
+ LLParcelSelection();
- // this can return NULL at any time, as parcel selection
- // might have been invalidated.
- LLParcel* getParcel() { return mParcel; }
+ // this can return NULL at any time, as parcel selection
+ // might have been invalidated.
+ LLParcel* getParcel() { return mParcel; }
- // Return the number of grid units that are owned by you within
- // the selection (computed by server).
- S32 getSelfCount() const { return mSelectedSelfCount; }
+ // Return the number of grid units that are owned by you within
+ // the selection (computed by server).
+ S32 getSelfCount() const { return mSelectedSelfCount; }
- // Returns area that will actually be claimed in meters squared.
- S32 getClaimableArea() const;
- bool hasOthersSelected() const;
+ // Returns area that will actually be claimed in meters squared.
+ S32 getClaimableArea() const;
+ bool hasOthersSelected() const;
- // Does the selection have multiple land owners in it?
- BOOL getMultipleOwners() const;
+ // Does the selection have multiple land owners in it?
+ BOOL getMultipleOwners() const;
- // Is the entire parcel selected, or just a part?
- BOOL getWholeParcelSelected() const;
+ // Is the entire parcel selected, or just a part?
+ BOOL getWholeParcelSelected() const;
private:
- void setParcel(LLParcel* parcel) { mParcel = parcel; }
+ void setParcel(LLParcel* parcel) { mParcel = parcel; }
private:
- LLParcel* mParcel;
- BOOL mSelectedMultipleOwners;
- BOOL mWholeParcelSelected;
- S32 mSelectedSelfCount;
- S32 mSelectedOtherCount;
- S32 mSelectedPublicCount;
+ LLParcel* mParcel;
+ BOOL mSelectedMultipleOwners;
+ BOOL mWholeParcelSelected;
+ S32 mSelectedSelfCount;
+ S32 mSelectedOtherCount;
+ S32 mSelectedPublicCount;
};
typedef LLSafeHandle<LLParcelSelection> LLParcelSelectionHandle;
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 9b60d1ae2f..9ef9c26411 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llparticipantlist.cpp
* @brief LLParticipantList : model of a conversation session with added speaker events handling
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,69 +33,69 @@
#include "llparticipantlist.h"
#include "llspeakers.h"
-//LLParticipantList retrieves add, clear and remove events and updates view accordingly
+//LLParticipantList retrieves add, clear and remove events and updates view accordingly
#if LL_MSVC
#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
#endif
LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLFolderViewModelInterface& root_view_model) :
- LLConversationItemSession(data_source->getSessionID(), root_view_model),
- mSpeakerMgr(data_source),
- mValidateSpeakerCallback(NULL)
+ LLConversationItemSession(data_source->getSessionID(), root_view_model),
+ mSpeakerMgr(data_source),
+ mValidateSpeakerCallback(NULL)
{
- mSpeakerAddListener = new SpeakerAddListener(*this);
- mSpeakerRemoveListener = new SpeakerRemoveListener(*this);
- mSpeakerClearListener = new SpeakerClearListener(*this);
- mSpeakerModeratorListener = new SpeakerModeratorUpdateListener(*this);
- mSpeakerUpdateListener = new SpeakerUpdateListener(*this);
- mSpeakerMuteListener = new SpeakerMuteListener(*this);
-
- mSpeakerMgr->addListener(mSpeakerAddListener, "add");
- mSpeakerMgr->addListener(mSpeakerRemoveListener, "remove");
- mSpeakerMgr->addListener(mSpeakerClearListener, "clear");
- mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator");
- mSpeakerMgr->addListener(mSpeakerUpdateListener, "update_speaker");
-
- setSessionID(mSpeakerMgr->getSessionID());
-
- //Lets fill avatarList with existing speakers
- LLSpeakerMgr::speaker_list_t speaker_list;
- mSpeakerMgr->getSpeakerList(&speaker_list, true);
- for(LLSpeakerMgr::speaker_list_t::iterator it = speaker_list.begin(); it != speaker_list.end(); it++)
- {
- const LLPointer<LLSpeaker>& speakerp = *it;
-
- addAvatarIDExceptAgent(speakerp->mID);
- if ( speakerp->mIsModerator )
- {
- mModeratorList.insert(speakerp->mID);
- }
- else
- {
- mModeratorToRemoveList.insert(speakerp->mID);
- }
- }
-
- // Identify and store what kind of session we are
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(data_source->getSessionID());
- if (im_session)
- {
- // By default, sessions that can't be identified as group or ad-hoc will be considered P2P (i.e. 1 on 1)
- mConvType = CONV_SESSION_1_ON_1;
- if (im_session->isAdHocSessionType())
- {
- mConvType = CONV_SESSION_AD_HOC;
- }
- else if (im_session->isGroupSessionType())
- {
- mConvType = CONV_SESSION_GROUP;
- }
- }
- else
- {
- // That's the only session that doesn't get listed in the LLIMModel as a session...
- mConvType = CONV_SESSION_NEARBY;
- }
+ mSpeakerAddListener = new SpeakerAddListener(*this);
+ mSpeakerRemoveListener = new SpeakerRemoveListener(*this);
+ mSpeakerClearListener = new SpeakerClearListener(*this);
+ mSpeakerModeratorListener = new SpeakerModeratorUpdateListener(*this);
+ mSpeakerUpdateListener = new SpeakerUpdateListener(*this);
+ mSpeakerMuteListener = new SpeakerMuteListener(*this);
+
+ mSpeakerMgr->addListener(mSpeakerAddListener, "add");
+ mSpeakerMgr->addListener(mSpeakerRemoveListener, "remove");
+ mSpeakerMgr->addListener(mSpeakerClearListener, "clear");
+ mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator");
+ mSpeakerMgr->addListener(mSpeakerUpdateListener, "update_speaker");
+
+ setSessionID(mSpeakerMgr->getSessionID());
+
+ //Lets fill avatarList with existing speakers
+ LLSpeakerMgr::speaker_list_t speaker_list;
+ mSpeakerMgr->getSpeakerList(&speaker_list, true);
+ for(LLSpeakerMgr::speaker_list_t::iterator it = speaker_list.begin(); it != speaker_list.end(); it++)
+ {
+ const LLPointer<LLSpeaker>& speakerp = *it;
+
+ addAvatarIDExceptAgent(speakerp->mID);
+ if ( speakerp->mIsModerator )
+ {
+ mModeratorList.insert(speakerp->mID);
+ }
+ else
+ {
+ mModeratorToRemoveList.insert(speakerp->mID);
+ }
+ }
+
+ // Identify and store what kind of session we are
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(data_source->getSessionID());
+ if (im_session)
+ {
+ // By default, sessions that can't be identified as group or ad-hoc will be considered P2P (i.e. 1 on 1)
+ mConvType = CONV_SESSION_1_ON_1;
+ if (im_session->isAdHocSessionType())
+ {
+ mConvType = CONV_SESSION_AD_HOC;
+ }
+ else if (im_session->isGroupSessionType())
+ {
+ mConvType = CONV_SESSION_GROUP;
+ }
+ }
+ else
+ {
+ // That's the only session that doesn't get listed in the LLIMModel as a session...
+ mConvType = CONV_SESSION_NEARBY;
+ }
}
LLParticipantList::~LLParticipantList()
@@ -104,140 +104,140 @@ LLParticipantList::~LLParticipantList()
void LLParticipantList::setValidateSpeakerCallback(validate_speaker_callback_t cb)
{
- mValidateSpeakerCallback = cb;
+ mValidateSpeakerCallback = cb;
}
void LLParticipantList::update()
{
- mSpeakerMgr->update(true);
+ mSpeakerMgr->update(true);
}
bool LLParticipantList::onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- LLUUID uu_id = event->getValue().asUUID();
+ LLUUID uu_id = event->getValue().asUUID();
- if (mValidateSpeakerCallback && !mValidateSpeakerCallback(uu_id))
- {
- return true;
- }
+ if (mValidateSpeakerCallback && !mValidateSpeakerCallback(uu_id))
+ {
+ return true;
+ }
- addAvatarIDExceptAgent(uu_id);
- return true;
+ addAvatarIDExceptAgent(uu_id);
+ return true;
}
bool LLParticipantList::onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- LLUUID avatar_id = event->getValue().asUUID();
- removeParticipant(avatar_id);
- return true;
+ LLUUID avatar_id = event->getValue().asUUID();
+ removeParticipant(avatar_id);
+ return true;
}
bool LLParticipantList::onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- clearParticipants();
- return true;
+ clearParticipants();
+ return true;
}
bool LLParticipantList::onSpeakerUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- const LLSD& evt_data = event->getValue();
- if ( evt_data.has("id") )
- {
- LLUUID participant_id = evt_data["id"];
- LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
- if (im_box)
- {
- im_box->setTimeNow(mUUID,participant_id);
- }
- }
- return true;
+ const LLSD& evt_data = event->getValue();
+ if ( evt_data.has("id") )
+ {
+ LLUUID participant_id = evt_data["id"];
+ LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
+ if (im_box)
+ {
+ im_box->setTimeNow(mUUID,participant_id);
+ }
+ }
+ return true;
}
bool LLParticipantList::onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- const LLSD& evt_data = event->getValue();
- if ( evt_data.has("id") && evt_data.has("is_moderator") )
- {
- LLUUID id = evt_data["id"];
- bool is_moderator = evt_data["is_moderator"];
- if ( id.notNull() )
- {
- if ( is_moderator )
- mModeratorList.insert(id);
- else
- {
- std::set<LLUUID>::iterator it = mModeratorList.find (id);
- if ( it != mModeratorList.end () )
- {
- mModeratorToRemoveList.insert(id);
- mModeratorList.erase(id);
- }
- }
- // *TODO : do we have to fire an event so that LLFloaterIMSessionTab::refreshConversation() gets called
- }
- }
- return true;
+ const LLSD& evt_data = event->getValue();
+ if ( evt_data.has("id") && evt_data.has("is_moderator") )
+ {
+ LLUUID id = evt_data["id"];
+ bool is_moderator = evt_data["is_moderator"];
+ if ( id.notNull() )
+ {
+ if ( is_moderator )
+ mModeratorList.insert(id);
+ else
+ {
+ std::set<LLUUID>::iterator it = mModeratorList.find (id);
+ if ( it != mModeratorList.end () )
+ {
+ mModeratorToRemoveList.insert(id);
+ mModeratorList.erase(id);
+ }
+ }
+ // *TODO : do we have to fire an event so that LLFloaterIMSessionTab::refreshConversation() gets called
+ }
+ }
+ return true;
}
bool LLParticipantList::onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- LLPointer<LLSpeaker> speakerp = (LLSpeaker*)event->getSource();
- if (speakerp.isNull()) return false;
-
- // update UI on confirmation of moderator mutes
- if (event->getValue().asString() == "voice")
- {
- setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice);
- }
- return true;
+ LLPointer<LLSpeaker> speakerp = (LLSpeaker*)event->getSource();
+ if (speakerp.isNull()) return false;
+
+ // update UI on confirmation of moderator mutes
+ if (event->getValue().asString() == "voice")
+ {
+ setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice);
+ }
+ return true;
}
void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
{
- // Do not add if already in there, is the session id (hence not an avatar) or excluded for some reason
- if (findParticipant(avatar_id) || (avatar_id == mUUID))
- {
- return;
- }
-
- bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(avatar_id);
-
- LLConversationItemParticipant* participant = NULL;
-
- if (is_avatar)
- {
- // Create a participant view model instance
- LLAvatarName avatar_name;
- bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name);
- participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.getDisplayName() , avatar_id, mRootViewModel);
- participant->fetchAvatarName();
- }
- else
- {
- std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id);
- // Create a participant view model instance
- participant = new LLConversationItemParticipant(display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name, avatar_id, mRootViewModel);
- }
-
- // *TODO : Need to update the online/offline status of the participant
- // Hack for this: LLAvatarTracker::instance().isBuddyOnline(avatar_id))
-
- // Add the participant model to the session's children list
- // This will post "add_participant" event
- addParticipant(participant);
-
- adjustParticipant(avatar_id);
+ // Do not add if already in there, is the session id (hence not an avatar) or excluded for some reason
+ if (findParticipant(avatar_id) || (avatar_id == mUUID))
+ {
+ return;
+ }
+
+ bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(avatar_id);
+
+ LLConversationItemParticipant* participant = NULL;
+
+ if (is_avatar)
+ {
+ // Create a participant view model instance
+ LLAvatarName avatar_name;
+ bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name);
+ participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.getDisplayName() , avatar_id, mRootViewModel);
+ participant->fetchAvatarName();
+ }
+ else
+ {
+ std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id);
+ // Create a participant view model instance
+ participant = new LLConversationItemParticipant(display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name, avatar_id, mRootViewModel);
+ }
+
+ // *TODO : Need to update the online/offline status of the participant
+ // Hack for this: LLAvatarTracker::instance().isBuddyOnline(avatar_id))
+
+ // Add the participant model to the session's children list
+ // This will post "add_participant" event
+ addParticipant(participant);
+
+ adjustParticipant(avatar_id);
}
static LLFastTimer::DeclareTimer FTM_FOLDERVIEW_TEST("add test avatar agents");
void LLParticipantList::adjustParticipant(const LLUUID& speaker_id)
{
- LLPointer<LLSpeaker> speakerp = mSpeakerMgr->findSpeaker(speaker_id);
- if (speakerp.isNull()) return;
+ LLPointer<LLSpeaker> speakerp = mSpeakerMgr->findSpeaker(speaker_id);
+ if (speakerp.isNull()) return;
- // add listener to process moderation changes
- speakerp->addListener(mSpeakerMuteListener);
+ // add listener to process moderation changes
+ speakerp->addListener(mSpeakerMuteListener);
}
//
@@ -245,17 +245,17 @@ void LLParticipantList::adjustParticipant(const LLUUID& speaker_id)
//
bool LLParticipantList::SpeakerAddListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- /**
- * We need to filter speaking objects. These objects shouldn't appear in the list.
- * @see LLFloaterChat::addChat() in llviewermessage.cpp to get detailed call hierarchy
- */
- const LLUUID& speaker_id = event->getValue().asUUID();
- LLPointer<LLSpeaker> speaker = mParent.mSpeakerMgr->findSpeaker(speaker_id);
- if (speaker.isNull() || (speaker->mType == LLSpeaker::SPEAKER_OBJECT))
- {
- return false;
- }
- return mParent.onAddItemEvent(event, userdata);
+ /**
+ * We need to filter speaking objects. These objects shouldn't appear in the list.
+ * @see LLFloaterChat::addChat() in llviewermessage.cpp to get detailed call hierarchy
+ */
+ const LLUUID& speaker_id = event->getValue().asUUID();
+ LLPointer<LLSpeaker> speaker = mParent.mSpeakerMgr->findSpeaker(speaker_id);
+ if (speaker.isNull() || (speaker->mType == LLSpeaker::SPEAKER_OBJECT))
+ {
+ return false;
+ }
+ return mParent.onAddItemEvent(event, userdata);
}
//
@@ -263,7 +263,7 @@ bool LLParticipantList::SpeakerAddListener::handleEvent(LLPointer<LLOldEvents::L
//
bool LLParticipantList::SpeakerRemoveListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- return mParent.onRemoveItemEvent(event, userdata);
+ return mParent.onRemoveItemEvent(event, userdata);
}
//
@@ -271,7 +271,7 @@ bool LLParticipantList::SpeakerRemoveListener::handleEvent(LLPointer<LLOldEvents
//
bool LLParticipantList::SpeakerClearListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- return mParent.onClearListEvent(event, userdata);
+ return mParent.onClearListEvent(event, userdata);
}
//
@@ -279,7 +279,7 @@ bool LLParticipantList::SpeakerClearListener::handleEvent(LLPointer<LLOldEvents:
//
bool LLParticipantList::SpeakerUpdateListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- return mParent.onSpeakerUpdateEvent(event, userdata);
+ return mParent.onSpeakerUpdateEvent(event, userdata);
}
//
@@ -287,12 +287,12 @@ bool LLParticipantList::SpeakerUpdateListener::handleEvent(LLPointer<LLOldEvents
//
bool LLParticipantList::SpeakerModeratorUpdateListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- return mParent.onModeratorUpdateEvent(event, userdata);
+ return mParent.onModeratorUpdateEvent(event, userdata);
}
bool LLParticipantList::SpeakerMuteListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
- return mParent.onSpeakerMuteEvent(event, userdata);
+ return mParent.onSpeakerMuteEvent(event, userdata);
}
//EOF
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index 14c0a63692..7cb29a6211 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llparticipantlist.h
* @brief LLParticipantList : model of a conversation session with added speaker events handling
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,124 +35,124 @@ class LLUICtrl;
class LLParticipantList : public LLConversationItemSession
{
- LOG_CLASS(LLParticipantList);
+ LOG_CLASS(LLParticipantList);
public:
- typedef boost::function<bool (const LLUUID& speaker_id)> validate_speaker_callback_t;
+ typedef boost::function<bool (const LLUUID& speaker_id)> validate_speaker_callback_t;
- LLParticipantList(LLSpeakerMgr* data_source, LLFolderViewModelInterface& root_view_model);
- ~LLParticipantList();
+ LLParticipantList(LLSpeakerMgr* data_source, LLFolderViewModelInterface& root_view_model);
+ ~LLParticipantList();
- /**
- * Adds specified avatar ID to the existing list if it is not Agent's ID
- *
- * @param[in] avatar_id - Avatar UUID to be added into the list
- */
- void addAvatarIDExceptAgent(const LLUUID& avatar_id);
+ /**
+ * Adds specified avatar ID to the existing list if it is not Agent's ID
+ *
+ * @param[in] avatar_id - Avatar UUID to be added into the list
+ */
+ void addAvatarIDExceptAgent(const LLUUID& avatar_id);
- /**
- * Refreshes the participant list.
- */
- void update();
+ /**
+ * Refreshes the participant list.
+ */
+ void update();
- /**
- * Set a callback to be called before adding a speaker. Invalid speakers will not be added.
- *
- * If the callback is unset all speakers are considered as valid.
- *
- * @see onAddItemEvent()
- */
- void setValidateSpeakerCallback(validate_speaker_callback_t cb);
+ /**
+ * Set a callback to be called before adding a speaker. Invalid speakers will not be added.
+ *
+ * If the callback is unset all speakers are considered as valid.
+ *
+ * @see onAddItemEvent()
+ */
+ void setValidateSpeakerCallback(validate_speaker_callback_t cb);
protected:
- /**
- * LLSpeakerMgr event handlers
- */
- bool onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- bool onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- bool onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- bool onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- bool onSpeakerUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- bool onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-
- /**
- * List of listeners implementing LLOldEvents::LLSimpleListener.
- * There is no way to handle all the events in one listener as LLSpeakerMgr registers
- * listeners in such a way that one listener can handle only one type of event
- **/
- class BaseSpeakerListener : public LLOldEvents::LLSimpleListener
- {
- public:
- BaseSpeakerListener(LLParticipantList& parent) : mParent(parent) {}
- protected:
- LLParticipantList& mParent;
- };
-
- class SpeakerAddListener : public BaseSpeakerListener
- {
- public:
- SpeakerAddListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
- /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- };
-
- class SpeakerRemoveListener : public BaseSpeakerListener
- {
- public:
- SpeakerRemoveListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
- /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- };
-
- class SpeakerClearListener : public BaseSpeakerListener
- {
- public:
- SpeakerClearListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
- /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- };
-
- class SpeakerUpdateListener : public BaseSpeakerListener
- {
- public:
- SpeakerUpdateListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
- /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- };
-
- class SpeakerModeratorUpdateListener : public BaseSpeakerListener
- {
- public:
- SpeakerModeratorUpdateListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
- /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- };
-
- class SpeakerMuteListener : public BaseSpeakerListener
- {
- public:
- SpeakerMuteListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
-
- /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
- };
+ /**
+ * LLSpeakerMgr event handlers
+ */
+ bool onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ bool onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ bool onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ bool onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ bool onSpeakerUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ bool onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+
+ /**
+ * List of listeners implementing LLOldEvents::LLSimpleListener.
+ * There is no way to handle all the events in one listener as LLSpeakerMgr registers
+ * listeners in such a way that one listener can handle only one type of event
+ **/
+ class BaseSpeakerListener : public LLOldEvents::LLSimpleListener
+ {
+ public:
+ BaseSpeakerListener(LLParticipantList& parent) : mParent(parent) {}
+ protected:
+ LLParticipantList& mParent;
+ };
+
+ class SpeakerAddListener : public BaseSpeakerListener
+ {
+ public:
+ SpeakerAddListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+ /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ };
+
+ class SpeakerRemoveListener : public BaseSpeakerListener
+ {
+ public:
+ SpeakerRemoveListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+ /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ };
+
+ class SpeakerClearListener : public BaseSpeakerListener
+ {
+ public:
+ SpeakerClearListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+ /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ };
+
+ class SpeakerUpdateListener : public BaseSpeakerListener
+ {
+ public:
+ SpeakerUpdateListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+ /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ };
+
+ class SpeakerModeratorUpdateListener : public BaseSpeakerListener
+ {
+ public:
+ SpeakerModeratorUpdateListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+ /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ };
+
+ class SpeakerMuteListener : public BaseSpeakerListener
+ {
+ public:
+ SpeakerMuteListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+
+ /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ };
private:
- /**
- * Adjusts passed participant to work properly.
- *
- * Adds SpeakerMuteListener to process moderation actions.
- */
- void adjustParticipant(const LLUUID& speaker_id);
+ /**
+ * Adjusts passed participant to work properly.
+ *
+ * Adds SpeakerMuteListener to process moderation actions.
+ */
+ void adjustParticipant(const LLUUID& speaker_id);
- LLSpeakerMgr* mSpeakerMgr;
+ LLSpeakerMgr* mSpeakerMgr;
- std::set<LLUUID> mModeratorList;
- std::set<LLUUID> mModeratorToRemoveList;
+ std::set<LLUUID> mModeratorList;
+ std::set<LLUUID> mModeratorToRemoveList;
- LLPointer<SpeakerAddListener> mSpeakerAddListener;
- LLPointer<SpeakerRemoveListener> mSpeakerRemoveListener;
- LLPointer<SpeakerClearListener> mSpeakerClearListener;
- LLPointer<SpeakerUpdateListener> mSpeakerUpdateListener;
- LLPointer<SpeakerModeratorUpdateListener> mSpeakerModeratorListener;
- LLPointer<SpeakerMuteListener> mSpeakerMuteListener;
+ LLPointer<SpeakerAddListener> mSpeakerAddListener;
+ LLPointer<SpeakerRemoveListener> mSpeakerRemoveListener;
+ LLPointer<SpeakerClearListener> mSpeakerClearListener;
+ LLPointer<SpeakerUpdateListener> mSpeakerUpdateListener;
+ LLPointer<SpeakerModeratorUpdateListener> mSpeakerModeratorListener;
+ LLPointer<SpeakerMuteListener> mSpeakerMuteListener;
- validate_speaker_callback_t mValidateSpeakerCallback;
+ validate_speaker_callback_t mValidateSpeakerCallback;
};
#endif // LL_PARTICIPANTLIST_H
diff --git a/indra/newview/llpatchvertexarray.cpp b/indra/newview/llpatchvertexarray.cpp
index a7011dfad5..846f3167fd 100644
--- a/indra/newview/llpatchvertexarray.cpp
+++ b/indra/newview/llpatchvertexarray.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpatchvertexarray.cpp
* @brief Implementation of the LLSurfaceVertexArray class.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,223 +32,223 @@
// constructors
LLPatchVertexArray::LLPatchVertexArray() :
- mSurfaceWidth(0),
- mPatchWidth(0),
- mPatchOrder(0),
- mRenderLevelp(NULL),
- mRenderStridep(NULL)
+ mSurfaceWidth(0),
+ mPatchWidth(0),
+ mPatchOrder(0),
+ mRenderLevelp(NULL),
+ mRenderStridep(NULL)
{
}
LLPatchVertexArray::LLPatchVertexArray(U32 surface_width, U32 patch_width, F32 meters_per_grid) :
- mRenderLevelp(NULL),
- mRenderStridep(NULL)
+ mRenderLevelp(NULL),
+ mRenderStridep(NULL)
{
- create(surface_width, patch_width, meters_per_grid);
+ create(surface_width, patch_width, meters_per_grid);
}
-LLPatchVertexArray::~LLPatchVertexArray()
+LLPatchVertexArray::~LLPatchVertexArray()
{
- destroy();
+ destroy();
}
-void LLPatchVertexArray::create(U32 surface_width, U32 patch_width, F32 meters_per_grid)
+void LLPatchVertexArray::create(U32 surface_width, U32 patch_width, F32 meters_per_grid)
{
- // PART 1 -- Make sure the arguments are good...
- // Make sure patch_width is not greater than surface_width
- if (patch_width > surface_width)
- {
- U32 temp = patch_width;
- patch_width = surface_width;
- surface_width = temp;
- }
-
- // Make sure (surface_width-1) is equal to a power_of_two.
- // (The -1 is there because an LLSurface has a buffer of 1 on
- // its East and North edges).
- U32 power_of_two = 1;
- while (power_of_two < (surface_width-1))
- {
- power_of_two *= 2;
- }
-
- if (power_of_two == (surface_width-1))
- {
- mSurfaceWidth = surface_width;
-
- // Make sure patch_width is a factor of (surface_width - 1)
- U32 ratio = (surface_width - 1) / patch_width;
- F32 fratio = ((float)(surface_width - 1)) / ((float)(patch_width));
- if ( fratio == (float)(ratio))
- {
- // Make sure patch_width is a power of two
- power_of_two = 1;
- U32 patch_order = 0;
- while (power_of_two < patch_width)
- {
- power_of_two *= 2;
- patch_order += 1;
- }
- if (power_of_two == patch_width)
- {
- mPatchWidth = patch_width;
- mPatchOrder = patch_order;
- }
- else // patch_width is not a power of two...
- {
- mPatchWidth = 0;
- mPatchOrder = 0;
- }
- }
- else // patch_width is not a factor of (surface_width - 1)...
- {
- mPatchWidth = 0;
- mPatchOrder = 0;
- }
- }
- else // surface_width is not a power of two...
- {
- mSurfaceWidth = 0;
- mPatchWidth = 0;
- mPatchOrder = 0;
- }
-
- // PART 2 -- Allocate memory for the render level table
- if (mPatchWidth > 0)
- {
- mRenderLevelp = new U32 [2*mPatchWidth + 1];
- mRenderStridep = new U32 [mPatchOrder + 1];
- }
-
- if (NULL == mRenderLevelp || NULL == mRenderStridep)
- {
- // init() and some other things all want to deref these
- // pointers, so this is serious.
- LL_ERRS() << "mRenderLevelp or mRenderStridep was NULL; we'd crash soon." << LL_ENDL;
- return;
- }
-
- // Now that we've allocated memory, we can initialize
- // the arrays...
- init();
+ // PART 1 -- Make sure the arguments are good...
+ // Make sure patch_width is not greater than surface_width
+ if (patch_width > surface_width)
+ {
+ U32 temp = patch_width;
+ patch_width = surface_width;
+ surface_width = temp;
+ }
+
+ // Make sure (surface_width-1) is equal to a power_of_two.
+ // (The -1 is there because an LLSurface has a buffer of 1 on
+ // its East and North edges).
+ U32 power_of_two = 1;
+ while (power_of_two < (surface_width-1))
+ {
+ power_of_two *= 2;
+ }
+
+ if (power_of_two == (surface_width-1))
+ {
+ mSurfaceWidth = surface_width;
+
+ // Make sure patch_width is a factor of (surface_width - 1)
+ U32 ratio = (surface_width - 1) / patch_width;
+ F32 fratio = ((float)(surface_width - 1)) / ((float)(patch_width));
+ if ( fratio == (float)(ratio))
+ {
+ // Make sure patch_width is a power of two
+ power_of_two = 1;
+ U32 patch_order = 0;
+ while (power_of_two < patch_width)
+ {
+ power_of_two *= 2;
+ patch_order += 1;
+ }
+ if (power_of_two == patch_width)
+ {
+ mPatchWidth = patch_width;
+ mPatchOrder = patch_order;
+ }
+ else // patch_width is not a power of two...
+ {
+ mPatchWidth = 0;
+ mPatchOrder = 0;
+ }
+ }
+ else // patch_width is not a factor of (surface_width - 1)...
+ {
+ mPatchWidth = 0;
+ mPatchOrder = 0;
+ }
+ }
+ else // surface_width is not a power of two...
+ {
+ mSurfaceWidth = 0;
+ mPatchWidth = 0;
+ mPatchOrder = 0;
+ }
+
+ // PART 2 -- Allocate memory for the render level table
+ if (mPatchWidth > 0)
+ {
+ mRenderLevelp = new U32 [2*mPatchWidth + 1];
+ mRenderStridep = new U32 [mPatchOrder + 1];
+ }
+
+ if (NULL == mRenderLevelp || NULL == mRenderStridep)
+ {
+ // init() and some other things all want to deref these
+ // pointers, so this is serious.
+ LL_ERRS() << "mRenderLevelp or mRenderStridep was NULL; we'd crash soon." << LL_ENDL;
+ return;
+ }
+
+ // Now that we've allocated memory, we can initialize
+ // the arrays...
+ init();
}
void LLPatchVertexArray::destroy()
{
- if (mPatchWidth == 0)
- {
- return;
- }
-
- delete [] mRenderLevelp;
- delete [] mRenderStridep;
- mSurfaceWidth = 0;
- mPatchWidth = 0;
- mPatchOrder = 0;
+ if (mPatchWidth == 0)
+ {
+ return;
+ }
+
+ delete [] mRenderLevelp;
+ delete [] mRenderStridep;
+ mSurfaceWidth = 0;
+ mPatchWidth = 0;
+ mPatchOrder = 0;
}
-void LLPatchVertexArray::init()
+void LLPatchVertexArray::init()
// Initializes the triangle strip arrays.
{
- U32 j;
- U32 level, stride;
- U32 k;
-
- // We need to build two look-up tables...
-
- // render_level -> render_stride
- // A 16x16 patch has 5 render levels : 2^0 to 2^4
- // render_level render_stride
- // 4 1
- // 3 2
- // 2 4
- // 1 8
- // 0 16
- stride = mPatchWidth;
- for (level=0; level<mPatchOrder + 1; level++)
- {
- mRenderStridep[level] = stride;
- stride /= 2;
- }
-
- // render_level <- render_stride.
+ U32 j;
+ U32 level, stride;
+ U32 k;
+
+ // We need to build two look-up tables...
+
+ // render_level -> render_stride
+ // A 16x16 patch has 5 render levels : 2^0 to 2^4
+ // render_level render_stride
+ // 4 1
+ // 3 2
+ // 2 4
+ // 1 8
+ // 0 16
+ stride = mPatchWidth;
+ for (level=0; level<mPatchOrder + 1; level++)
+ {
+ mRenderStridep[level] = stride;
+ stride /= 2;
+ }
+
+ // render_level <- render_stride.
/*
- // For a 16x16 patch we'll clamp the render_strides to 0 through 16
- // and enter the nearest render_level in the table. Of course, only
- // power-of-two render strides are actually used.
- //
- // render_stride render_level
- // 0 4
- // 1 4 *
- // 2 3 *
- // 3 3
- // 4 2 *
- // 5 2
- // 6 2
- // 7 1
- // 8 1 *
- // 9 1
- // 10 1
- // 11 1
- // 12 1
- // 13 0
- // 14 0
- // 15 0
- // 16 Always 0
-
- level = mPatchOrder;
- for (stride=0; stride<mPatchWidth; stride++)
- {
- if ((F32) stride > 2.1f * mRenderStridep[level])
- {
- level--;
- };
- mRenderLevelp[stride] = level;
- }
- */
-
- // This method is more agressive about putting triangles onscreen
- level = mPatchOrder;
- k = 2;
- mRenderLevelp[0] = mPatchOrder;
- mRenderLevelp[1] = mPatchOrder;
- stride = 2;
- while(stride < 2*mPatchWidth)
- {
- for (j=0; j<k && stride<2*mPatchWidth; j++)
- {
- mRenderLevelp[stride++] = level;
- }
- k *= 2;
- level--;
- }
- mRenderLevelp[2*mPatchWidth] = 0;
+ // For a 16x16 patch we'll clamp the render_strides to 0 through 16
+ // and enter the nearest render_level in the table. Of course, only
+ // power-of-two render strides are actually used.
+ //
+ // render_stride render_level
+ // 0 4
+ // 1 4 *
+ // 2 3 *
+ // 3 3
+ // 4 2 *
+ // 5 2
+ // 6 2
+ // 7 1
+ // 8 1 *
+ // 9 1
+ // 10 1
+ // 11 1
+ // 12 1
+ // 13 0
+ // 14 0
+ // 15 0
+ // 16 Always 0
+
+ level = mPatchOrder;
+ for (stride=0; stride<mPatchWidth; stride++)
+ {
+ if ((F32) stride > 2.1f * mRenderStridep[level])
+ {
+ level--;
+ };
+ mRenderLevelp[stride] = level;
+ }
+ */
+
+ // This method is more agressive about putting triangles onscreen
+ level = mPatchOrder;
+ k = 2;
+ mRenderLevelp[0] = mPatchOrder;
+ mRenderLevelp[1] = mPatchOrder;
+ stride = 2;
+ while(stride < 2*mPatchWidth)
+ {
+ for (j=0; j<k && stride<2*mPatchWidth; j++)
+ {
+ mRenderLevelp[stride++] = level;
+ }
+ k *= 2;
+ level--;
+ }
+ mRenderLevelp[2*mPatchWidth] = 0;
}
std::ostream& operator<<(std::ostream &s, const LLPatchVertexArray &va)
{
- U32 i;
- s << "{ \n";
- s << " mSurfaceWidth = " << va.mSurfaceWidth << "\n";
- s << " mPatchWidth = " << va.mPatchWidth << "\n";
- s << " mPatchOrder = " << va.mPatchOrder << "\n";
- s << " mRenderStridep = \n";
- for (i=0; i<va.mPatchOrder+1; i++)
- {
- s << " " << i << " " << va.mRenderStridep[i] << "\n";
- }
- s << " mRenderLevelp = \n";
- for (i=0; i < 2*va.mPatchWidth + 1; i++)
- {
- s << " " << i << " " << va.mRenderLevelp[i] << "\n";
- }
- s << "}";
- return s;
+ U32 i;
+ s << "{ \n";
+ s << " mSurfaceWidth = " << va.mSurfaceWidth << "\n";
+ s << " mPatchWidth = " << va.mPatchWidth << "\n";
+ s << " mPatchOrder = " << va.mPatchOrder << "\n";
+ s << " mRenderStridep = \n";
+ for (i=0; i<va.mPatchOrder+1; i++)
+ {
+ s << " " << i << " " << va.mRenderStridep[i] << "\n";
+ }
+ s << " mRenderLevelp = \n";
+ for (i=0; i < 2*va.mPatchWidth + 1; i++)
+ {
+ s << " " << i << " " << va.mRenderLevelp[i] << "\n";
+ }
+ s << "}";
+ return s;
}
diff --git a/indra/newview/llpatchvertexarray.h b/indra/newview/llpatchvertexarray.h
index 721f3f18b1..feb7f1503d 100644
--- a/indra/newview/llpatchvertexarray.h
+++ b/indra/newview/llpatchvertexarray.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpatchvertexarray.h
* @brief description of Surface class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,38 +32,38 @@
//
// A "patch" is currently a sub-square of a larger square array of data
// we call a "surface".
-class LLPatchVertexArray
+class LLPatchVertexArray
{
public:
- LLPatchVertexArray();
- LLPatchVertexArray(U32 surface_width, U32 patch_width, F32 meters_per_grid);
- virtual ~LLPatchVertexArray();
+ LLPatchVertexArray();
+ LLPatchVertexArray(U32 surface_width, U32 patch_width, F32 meters_per_grid);
+ virtual ~LLPatchVertexArray();
- void create(U32 surface_width, U32 patch_width, F32 meters_per_grid);
- void destroy();
- void init();
+ void create(U32 surface_width, U32 patch_width, F32 meters_per_grid);
+ void destroy();
+ void init();
public:
- U32 mSurfaceWidth; // grid points on one side of a LLSurface
- U32 mPatchWidth; // grid points on one side of a LLPatch
- U32 mPatchOrder; // 2^mPatchOrder >= mPatchWidth
+ U32 mSurfaceWidth; // grid points on one side of a LLSurface
+ U32 mPatchWidth; // grid points on one side of a LLPatch
+ U32 mPatchOrder; // 2^mPatchOrder >= mPatchWidth
- U32 *mRenderLevelp; // Look-up table : render_stride -> render_level
- U32 *mRenderStridep; // Look-up table : render_level -> render_stride
+ U32 *mRenderLevelp; // Look-up table : render_stride -> render_level
+ U32 *mRenderStridep; // Look-up table : render_level -> render_stride
- // We want to be able to render a patch from multiple resolutions.
- // The lowest resolution has two triangles, and the highest has
- // 2*mPatchWidth*mPatchWidth triangles.
- //
- // mPatchWidth is not hard-coded, so we don't know how much memory
- // to allocate to the vertex arrays until it is set. Once it is
- // set, we will calculate how much total memory to allocate for the
- // vertex arrays, and then keep track of their lengths and locations
- // in the memory bank.
- //
- // A Patch has three regions that need vertex arrays: middle, north,
- // and east. For each region there are three items that must be
- // kept track of: data, offset, and length.
+ // We want to be able to render a patch from multiple resolutions.
+ // The lowest resolution has two triangles, and the highest has
+ // 2*mPatchWidth*mPatchWidth triangles.
+ //
+ // mPatchWidth is not hard-coded, so we don't know how much memory
+ // to allocate to the vertex arrays until it is set. Once it is
+ // set, we will calculate how much total memory to allocate for the
+ // vertex arrays, and then keep track of their lengths and locations
+ // in the memory bank.
+ //
+ // A Patch has three regions that need vertex arrays: middle, north,
+ // and east. For each region there are three items that must be
+ // kept track of: data, offset, and length.
};
#endif
diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp
index 00f2ebc4bb..a376de10ae 100644
--- a/indra/newview/llpathfindingcharacter.cpp
+++ b/indra/newview/llpathfindingcharacter.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingcharacter.cpp
* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding.
* @author Stinson@lindenlab.com
@@ -45,21 +45,21 @@
//---------------------------------------------------------------------------
LLPathfindingCharacter::LLPathfindingCharacter(const std::string &pUUID, const LLSD& pCharacterData)
- : LLPathfindingObject(pUUID, pCharacterData),
- mCPUTime(0U),
- mIsHorizontal(FALSE),
- mLength(0.0f),
- mRadius(0.0f)
+ : LLPathfindingObject(pUUID, pCharacterData),
+ mCPUTime(0U),
+ mIsHorizontal(FALSE),
+ mLength(0.0f),
+ mRadius(0.0f)
{
- parseCharacterData(pCharacterData);
+ parseCharacterData(pCharacterData);
}
LLPathfindingCharacter::LLPathfindingCharacter(const LLPathfindingCharacter& pOther)
- : LLPathfindingObject(pOther),
- mCPUTime(pOther.mCPUTime),
- mIsHorizontal(pOther.mIsHorizontal),
- mLength(pOther.mLength),
- mRadius(pOther.mRadius)
+ : LLPathfindingObject(pOther),
+ mCPUTime(pOther.mCPUTime),
+ mIsHorizontal(pOther.mIsHorizontal),
+ mLength(pOther.mLength),
+ mRadius(pOther.mRadius)
{
}
@@ -69,31 +69,31 @@ LLPathfindingCharacter::~LLPathfindingCharacter()
LLPathfindingCharacter& LLPathfindingCharacter::operator =(const LLPathfindingCharacter& pOther)
{
- dynamic_cast<LLPathfindingObject &>(*this) = pOther;
+ dynamic_cast<LLPathfindingObject &>(*this) = pOther;
- mCPUTime = pOther.mCPUTime;
- mIsHorizontal = pOther.mIsHorizontal;
- mLength = pOther.mLength;
- mRadius = pOther.mRadius;
+ mCPUTime = pOther.mCPUTime;
+ mIsHorizontal = pOther.mIsHorizontal;
+ mLength = pOther.mLength;
+ mRadius = pOther.mRadius;
- return *this;
+ return *this;
}
void LLPathfindingCharacter::parseCharacterData(const LLSD &pCharacterData)
{
- llassert(pCharacterData.has(CHARACTER_CPU_TIME_FIELD));
- llassert(pCharacterData.get(CHARACTER_CPU_TIME_FIELD).isReal());
- mCPUTime = pCharacterData.get(CHARACTER_CPU_TIME_FIELD).asReal();
+ llassert(pCharacterData.has(CHARACTER_CPU_TIME_FIELD));
+ llassert(pCharacterData.get(CHARACTER_CPU_TIME_FIELD).isReal());
+ mCPUTime = pCharacterData.get(CHARACTER_CPU_TIME_FIELD).asReal();
- llassert(pCharacterData.has(CHARACTER_HORIZONTAL_FIELD));
- llassert(pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).isBoolean());
- mIsHorizontal = pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).asBoolean();
+ llassert(pCharacterData.has(CHARACTER_HORIZONTAL_FIELD));
+ llassert(pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).isBoolean());
+ mIsHorizontal = pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).asBoolean();
- llassert(pCharacterData.has(CHARACTER_LENGTH_FIELD));
- llassert(pCharacterData.get(CHARACTER_LENGTH_FIELD).isReal());
- mLength = pCharacterData.get(CHARACTER_LENGTH_FIELD).asReal();
+ llassert(pCharacterData.has(CHARACTER_LENGTH_FIELD));
+ llassert(pCharacterData.get(CHARACTER_LENGTH_FIELD).isReal());
+ mLength = pCharacterData.get(CHARACTER_LENGTH_FIELD).asReal();
- llassert(pCharacterData.has(CHARACTER_RADIUS_FIELD));
- llassert(pCharacterData.get(CHARACTER_RADIUS_FIELD).isReal());
- mRadius = pCharacterData.get(CHARACTER_RADIUS_FIELD).asReal();
+ llassert(pCharacterData.has(CHARACTER_RADIUS_FIELD));
+ llassert(pCharacterData.get(CHARACTER_RADIUS_FIELD).isReal());
+ mRadius = pCharacterData.get(CHARACTER_RADIUS_FIELD).asReal();
}
diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h
index 7cf9f401b0..ac5a113f96 100644
--- a/indra/newview/llpathfindingcharacter.h
+++ b/indra/newview/llpathfindingcharacter.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingcharacter.h
* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding.
* @author Stinson@lindenlab.com
@@ -36,28 +36,28 @@ class LLSD;
class LLPathfindingCharacter : public LLPathfindingObject
{
public:
- LLPathfindingCharacter(const std::string &pUUID, const LLSD &pCharacterData);
- LLPathfindingCharacter(const LLPathfindingCharacter& pOther);
- virtual ~LLPathfindingCharacter();
+ LLPathfindingCharacter(const std::string &pUUID, const LLSD &pCharacterData);
+ LLPathfindingCharacter(const LLPathfindingCharacter& pOther);
+ virtual ~LLPathfindingCharacter();
- LLPathfindingCharacter& operator =(const LLPathfindingCharacter& pOther);
+ LLPathfindingCharacter& operator =(const LLPathfindingCharacter& pOther);
- inline F32 getCPUTime() const {return mCPUTime;};
+ inline F32 getCPUTime() const {return mCPUTime;};
- inline BOOL isHorizontal() const {return mIsHorizontal;};
- inline F32 getLength() const {return mLength;};
- inline F32 getRadius() const {return mRadius;};
+ inline BOOL isHorizontal() const {return mIsHorizontal;};
+ inline F32 getLength() const {return mLength;};
+ inline F32 getRadius() const {return mRadius;};
protected:
private:
- void parseCharacterData(const LLSD &pCharacterData);
+ void parseCharacterData(const LLSD &pCharacterData);
- F32 mCPUTime;
+ F32 mCPUTime;
- BOOL mIsHorizontal;
- F32 mLength;
- F32 mRadius;
+ BOOL mIsHorizontal;
+ F32 mLength;
+ F32 mRadius;
};
#endif // LL_LLPATHFINDINGCHARACTER_H
diff --git a/indra/newview/llpathfindingcharacterlist.cpp b/indra/newview/llpathfindingcharacterlist.cpp
index d63daaa59b..1366ba6c6f 100644
--- a/indra/newview/llpathfindingcharacterlist.cpp
+++ b/indra/newview/llpathfindingcharacterlist.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingcharacterlist.cpp
* @brief Implementation of llpathfindingcharacterlist
* @author Stinson@lindenlab.com
diff --git a/indra/newview/llpathfindingcharacterlist.h b/indra/newview/llpathfindingcharacterlist.h
index 4ecf70001d..3254681ffe 100644
--- a/indra/newview/llpathfindingcharacterlist.h
+++ b/indra/newview/llpathfindingcharacterlist.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingcharacterlist.h
* @brief Header file for llpathfindingcharacterlist
* @author Stinson@lindenlab.com
@@ -34,14 +34,14 @@ class LLSD;
class LLPathfindingCharacterList : public LLPathfindingObjectList
{
public:
- LLPathfindingCharacterList();
- LLPathfindingCharacterList(const LLSD& pCharacterListData);
- virtual ~LLPathfindingCharacterList();
+ LLPathfindingCharacterList();
+ LLPathfindingCharacterList(const LLSD& pCharacterListData);
+ virtual ~LLPathfindingCharacterList();
protected:
private:
- void parseCharacterListData(const LLSD& pCharacterListData);
+ void parseCharacterListData(const LLSD& pCharacterListData);
};
#endif // LL_LLPATHFINDINGCHARACTERLIST_H
diff --git a/indra/newview/llpathfindinglinkset.cpp b/indra/newview/llpathfindinglinkset.cpp
index 50b76378f5..8de7a57ae4 100644
--- a/indra/newview/llpathfindinglinkset.cpp
+++ b/indra/newview/llpathfindinglinkset.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindinglinkset.cpp
* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding.
* @author Stinson@lindenlab.com
@@ -58,53 +58,53 @@ const S32 LLPathfindingLinkset::MIN_WALKABILITY_VALUE(0);
const S32 LLPathfindingLinkset::MAX_WALKABILITY_VALUE(100);
LLPathfindingLinkset::LLPathfindingLinkset(const LLSD& pTerrainData)
- : LLPathfindingObject(),
- mIsTerrain(true),
- mLandImpact(0U),
- mIsModifiable(FALSE),
- mCanBeVolume(FALSE),
- mIsScripted(FALSE),
- mHasIsScripted(TRUE),
- mLinksetUse(kUnknown),
- mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE),
- mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE),
- mWalkabilityCoefficientC(MIN_WALKABILITY_VALUE),
- mWalkabilityCoefficientD(MIN_WALKABILITY_VALUE)
+ : LLPathfindingObject(),
+ mIsTerrain(true),
+ mLandImpact(0U),
+ mIsModifiable(FALSE),
+ mCanBeVolume(FALSE),
+ mIsScripted(FALSE),
+ mHasIsScripted(TRUE),
+ mLinksetUse(kUnknown),
+ mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE),
+ mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE),
+ mWalkabilityCoefficientC(MIN_WALKABILITY_VALUE),
+ mWalkabilityCoefficientD(MIN_WALKABILITY_VALUE)
{
- parsePathfindingData(pTerrainData);
+ parsePathfindingData(pTerrainData);
}
LLPathfindingLinkset::LLPathfindingLinkset(const std::string &pUUID, const LLSD& pLinksetData)
- : LLPathfindingObject(pUUID, pLinksetData),
- mIsTerrain(false),
- mLandImpact(0U),
- mIsModifiable(TRUE),
- mCanBeVolume(TRUE),
- mIsScripted(FALSE),
- mHasIsScripted(FALSE),
- mLinksetUse(kUnknown),
- mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE),
- mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE),
- mWalkabilityCoefficientC(MIN_WALKABILITY_VALUE),
- mWalkabilityCoefficientD(MIN_WALKABILITY_VALUE)
+ : LLPathfindingObject(pUUID, pLinksetData),
+ mIsTerrain(false),
+ mLandImpact(0U),
+ mIsModifiable(TRUE),
+ mCanBeVolume(TRUE),
+ mIsScripted(FALSE),
+ mHasIsScripted(FALSE),
+ mLinksetUse(kUnknown),
+ mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE),
+ mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE),
+ mWalkabilityCoefficientC(MIN_WALKABILITY_VALUE),
+ mWalkabilityCoefficientD(MIN_WALKABILITY_VALUE)
{
- parseLinksetData(pLinksetData);
- parsePathfindingData(pLinksetData);
+ parseLinksetData(pLinksetData);
+ parsePathfindingData(pLinksetData);
}
LLPathfindingLinkset::LLPathfindingLinkset(const LLPathfindingLinkset& pOther)
- : LLPathfindingObject(pOther),
- mIsTerrain(pOther.mIsTerrain),
- mLandImpact(pOther.mLandImpact),
- mIsModifiable(pOther.mIsModifiable),
- mCanBeVolume(pOther.mCanBeVolume),
- mIsScripted(pOther.mIsScripted),
- mHasIsScripted(pOther.mHasIsScripted),
- mLinksetUse(pOther.mLinksetUse),
- mWalkabilityCoefficientA(pOther.mWalkabilityCoefficientA),
- mWalkabilityCoefficientB(pOther.mWalkabilityCoefficientB),
- mWalkabilityCoefficientC(pOther.mWalkabilityCoefficientC),
- mWalkabilityCoefficientD(pOther.mWalkabilityCoefficientD)
+ : LLPathfindingObject(pOther),
+ mIsTerrain(pOther.mIsTerrain),
+ mLandImpact(pOther.mLandImpact),
+ mIsModifiable(pOther.mIsModifiable),
+ mCanBeVolume(pOther.mCanBeVolume),
+ mIsScripted(pOther.mIsScripted),
+ mHasIsScripted(pOther.mHasIsScripted),
+ mLinksetUse(pOther.mLinksetUse),
+ mWalkabilityCoefficientA(pOther.mWalkabilityCoefficientA),
+ mWalkabilityCoefficientB(pOther.mWalkabilityCoefficientB),
+ mWalkabilityCoefficientC(pOther.mWalkabilityCoefficientC),
+ mWalkabilityCoefficientD(pOther.mWalkabilityCoefficientD)
{
}
@@ -114,295 +114,295 @@ LLPathfindingLinkset::~LLPathfindingLinkset()
LLPathfindingLinkset& LLPathfindingLinkset::operator =(const LLPathfindingLinkset& pOther)
{
- dynamic_cast<LLPathfindingObject &>(*this) = pOther;
-
- mIsTerrain = pOther.mIsTerrain;
- mLandImpact = pOther.mLandImpact;
- mIsModifiable = pOther.mIsModifiable;
- mCanBeVolume = pOther.mCanBeVolume;
- mIsScripted = pOther.mIsScripted;
- mHasIsScripted = pOther.mHasIsScripted;
- mLinksetUse = pOther.mLinksetUse;
- mWalkabilityCoefficientA = pOther.mWalkabilityCoefficientA;
- mWalkabilityCoefficientB = pOther.mWalkabilityCoefficientB;
- mWalkabilityCoefficientC = pOther.mWalkabilityCoefficientC;
- mWalkabilityCoefficientD = pOther.mWalkabilityCoefficientD;
-
- return *this;
+ dynamic_cast<LLPathfindingObject &>(*this) = pOther;
+
+ mIsTerrain = pOther.mIsTerrain;
+ mLandImpact = pOther.mLandImpact;
+ mIsModifiable = pOther.mIsModifiable;
+ mCanBeVolume = pOther.mCanBeVolume;
+ mIsScripted = pOther.mIsScripted;
+ mHasIsScripted = pOther.mHasIsScripted;
+ mLinksetUse = pOther.mLinksetUse;
+ mWalkabilityCoefficientA = pOther.mWalkabilityCoefficientA;
+ mWalkabilityCoefficientB = pOther.mWalkabilityCoefficientB;
+ mWalkabilityCoefficientC = pOther.mWalkabilityCoefficientC;
+ mWalkabilityCoefficientD = pOther.mWalkabilityCoefficientD;
+
+ return *this;
}
BOOL LLPathfindingLinkset::isPhantom() const
{
- return isPhantom(getLinksetUse());
+ return isPhantom(getLinksetUse());
}
LLPathfindingLinkset::ELinksetUse LLPathfindingLinkset::getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse)
{
- BOOL isPhantom = LLPathfindingLinkset::isPhantom(pLinksetUse);
- ENavMeshGenerationCategory navMeshGenerationCategory = getNavMeshGenerationCategory(pLinksetUse);
+ BOOL isPhantom = LLPathfindingLinkset::isPhantom(pLinksetUse);
+ ENavMeshGenerationCategory navMeshGenerationCategory = getNavMeshGenerationCategory(pLinksetUse);
- return getLinksetUse(!isPhantom, navMeshGenerationCategory);
+ return getLinksetUse(!isPhantom, navMeshGenerationCategory);
}
bool LLPathfindingLinkset::isShowUnmodifiablePhantomWarning(ELinksetUse pLinksetUse) const
{
- return (!isModifiable() && (isPhantom() != isPhantom(pLinksetUse)));
+ return (!isModifiable() && (isPhantom() != isPhantom(pLinksetUse)));
}
bool LLPathfindingLinkset::isShowPhantomToggleWarning(ELinksetUse pLinksetUse) const
{
- return (isModifiable() && (isPhantom() != isPhantom(pLinksetUse)));
+ return (isModifiable() && (isPhantom() != isPhantom(pLinksetUse)));
}
bool LLPathfindingLinkset::isShowCannotBeVolumeWarning(ELinksetUse pLinksetUse) const
{
- return (!canBeVolume() && ((pLinksetUse == kMaterialVolume) || (pLinksetUse == kExclusionVolume)));
+ return (!canBeVolume() && ((pLinksetUse == kMaterialVolume) || (pLinksetUse == kExclusionVolume)));
}
LLSD LLPathfindingLinkset::encodeAlteredFields(ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const
{
- LLSD itemData;
-
- if (!isTerrain() && (pLinksetUse != kUnknown) && (getLinksetUse() != pLinksetUse) &&
- (canBeVolume() || ((pLinksetUse != kMaterialVolume) && (pLinksetUse != kExclusionVolume))))
- {
- if (isModifiable())
- {
- itemData[LINKSET_PHANTOM_FIELD] = static_cast<bool>(isPhantom(pLinksetUse));
- }
-
- itemData[LINKSET_CATEGORY_FIELD] = convertCategoryToLLSD(getNavMeshGenerationCategory(pLinksetUse));
- }
-
- if (mWalkabilityCoefficientA != pA)
- {
- itemData[LINKSET_WALKABILITY_A_FIELD] = llclamp(pA, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
- }
-
- if (mWalkabilityCoefficientB != pB)
- {
- itemData[LINKSET_WALKABILITY_B_FIELD] = llclamp(pB, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
- }
-
- if (mWalkabilityCoefficientC != pC)
- {
- itemData[LINKSET_WALKABILITY_C_FIELD] = llclamp(pC, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
- }
-
- if (mWalkabilityCoefficientD != pD)
- {
- itemData[LINKSET_WALKABILITY_D_FIELD] = llclamp(pD, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
- }
-
- return itemData;
+ LLSD itemData;
+
+ if (!isTerrain() && (pLinksetUse != kUnknown) && (getLinksetUse() != pLinksetUse) &&
+ (canBeVolume() || ((pLinksetUse != kMaterialVolume) && (pLinksetUse != kExclusionVolume))))
+ {
+ if (isModifiable())
+ {
+ itemData[LINKSET_PHANTOM_FIELD] = static_cast<bool>(isPhantom(pLinksetUse));
+ }
+
+ itemData[LINKSET_CATEGORY_FIELD] = convertCategoryToLLSD(getNavMeshGenerationCategory(pLinksetUse));
+ }
+
+ if (mWalkabilityCoefficientA != pA)
+ {
+ itemData[LINKSET_WALKABILITY_A_FIELD] = llclamp(pA, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
+ }
+
+ if (mWalkabilityCoefficientB != pB)
+ {
+ itemData[LINKSET_WALKABILITY_B_FIELD] = llclamp(pB, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
+ }
+
+ if (mWalkabilityCoefficientC != pC)
+ {
+ itemData[LINKSET_WALKABILITY_C_FIELD] = llclamp(pC, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
+ }
+
+ if (mWalkabilityCoefficientD != pD)
+ {
+ itemData[LINKSET_WALKABILITY_D_FIELD] = llclamp(pD, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
+ }
+
+ return itemData;
}
void LLPathfindingLinkset::parseLinksetData(const LLSD &pLinksetData)
{
- llassert(pLinksetData.has(LINKSET_LAND_IMPACT_FIELD));
- llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).isInteger());
- llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger() >= 0);
- mLandImpact = pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger();
-
- llassert(pLinksetData.has(LINKSET_MODIFIABLE_FIELD));
- llassert(pLinksetData.get(LINKSET_MODIFIABLE_FIELD).isBoolean());
- mIsModifiable = pLinksetData.get(LINKSET_MODIFIABLE_FIELD).asBoolean();
-
- mHasIsScripted = pLinksetData.has(LINKSET_IS_SCRIPTED_FIELD);
- if (mHasIsScripted)
- {
- llassert(pLinksetData.get(LINKSET_IS_SCRIPTED_FIELD).isBoolean());
- mIsScripted = pLinksetData.get(LINKSET_IS_SCRIPTED_FIELD).asBoolean();
- }
+ llassert(pLinksetData.has(LINKSET_LAND_IMPACT_FIELD));
+ llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).isInteger());
+ llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger() >= 0);
+ mLandImpact = pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger();
+
+ llassert(pLinksetData.has(LINKSET_MODIFIABLE_FIELD));
+ llassert(pLinksetData.get(LINKSET_MODIFIABLE_FIELD).isBoolean());
+ mIsModifiable = pLinksetData.get(LINKSET_MODIFIABLE_FIELD).asBoolean();
+
+ mHasIsScripted = pLinksetData.has(LINKSET_IS_SCRIPTED_FIELD);
+ if (mHasIsScripted)
+ {
+ llassert(pLinksetData.get(LINKSET_IS_SCRIPTED_FIELD).isBoolean());
+ mIsScripted = pLinksetData.get(LINKSET_IS_SCRIPTED_FIELD).asBoolean();
+ }
}
void LLPathfindingLinkset::parsePathfindingData(const LLSD &pLinksetData)
{
- bool isPhantom = false;
- if (pLinksetData.has(LINKSET_PHANTOM_FIELD))
- {
- llassert(pLinksetData.get(LINKSET_PHANTOM_FIELD).isBoolean());
- isPhantom = pLinksetData.get(LINKSET_PHANTOM_FIELD).asBoolean();
- }
-
- llassert(pLinksetData.has(LINKSET_CATEGORY_FIELD));
- mLinksetUse = getLinksetUse(isPhantom, convertCategoryFromLLSD(pLinksetData.get(LINKSET_CATEGORY_FIELD)));
-
- if (pLinksetData.has(LINKSET_CAN_BE_VOLUME))
- {
- llassert(pLinksetData.get(LINKSET_CAN_BE_VOLUME).isBoolean());
- mCanBeVolume = pLinksetData.get(LINKSET_CAN_BE_VOLUME).asBoolean();
- }
-
- llassert(pLinksetData.has(LINKSET_WALKABILITY_A_FIELD));
- llassert(pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).isInteger());
- mWalkabilityCoefficientA = pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).asInteger();
- llassert(mWalkabilityCoefficientA >= MIN_WALKABILITY_VALUE);
- llassert(mWalkabilityCoefficientA <= MAX_WALKABILITY_VALUE);
-
- llassert(pLinksetData.has(LINKSET_WALKABILITY_B_FIELD));
- llassert(pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).isInteger());
- mWalkabilityCoefficientB = pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).asInteger();
- llassert(mWalkabilityCoefficientB >= MIN_WALKABILITY_VALUE);
- llassert(mWalkabilityCoefficientB <= MAX_WALKABILITY_VALUE);
-
- llassert(pLinksetData.has(LINKSET_WALKABILITY_C_FIELD));
- llassert(pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).isInteger());
- mWalkabilityCoefficientC = pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).asInteger();
- llassert(mWalkabilityCoefficientC >= MIN_WALKABILITY_VALUE);
- llassert(mWalkabilityCoefficientC <= MAX_WALKABILITY_VALUE);
-
- llassert(pLinksetData.has(LINKSET_WALKABILITY_D_FIELD));
- llassert(pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).isInteger());
- mWalkabilityCoefficientD = pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).asInteger();
- llassert(mWalkabilityCoefficientD >= MIN_WALKABILITY_VALUE);
- llassert(mWalkabilityCoefficientD <= MAX_WALKABILITY_VALUE);
+ bool isPhantom = false;
+ if (pLinksetData.has(LINKSET_PHANTOM_FIELD))
+ {
+ llassert(pLinksetData.get(LINKSET_PHANTOM_FIELD).isBoolean());
+ isPhantom = pLinksetData.get(LINKSET_PHANTOM_FIELD).asBoolean();
+ }
+
+ llassert(pLinksetData.has(LINKSET_CATEGORY_FIELD));
+ mLinksetUse = getLinksetUse(isPhantom, convertCategoryFromLLSD(pLinksetData.get(LINKSET_CATEGORY_FIELD)));
+
+ if (pLinksetData.has(LINKSET_CAN_BE_VOLUME))
+ {
+ llassert(pLinksetData.get(LINKSET_CAN_BE_VOLUME).isBoolean());
+ mCanBeVolume = pLinksetData.get(LINKSET_CAN_BE_VOLUME).asBoolean();
+ }
+
+ llassert(pLinksetData.has(LINKSET_WALKABILITY_A_FIELD));
+ llassert(pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).isInteger());
+ mWalkabilityCoefficientA = pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).asInteger();
+ llassert(mWalkabilityCoefficientA >= MIN_WALKABILITY_VALUE);
+ llassert(mWalkabilityCoefficientA <= MAX_WALKABILITY_VALUE);
+
+ llassert(pLinksetData.has(LINKSET_WALKABILITY_B_FIELD));
+ llassert(pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).isInteger());
+ mWalkabilityCoefficientB = pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).asInteger();
+ llassert(mWalkabilityCoefficientB >= MIN_WALKABILITY_VALUE);
+ llassert(mWalkabilityCoefficientB <= MAX_WALKABILITY_VALUE);
+
+ llassert(pLinksetData.has(LINKSET_WALKABILITY_C_FIELD));
+ llassert(pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).isInteger());
+ mWalkabilityCoefficientC = pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).asInteger();
+ llassert(mWalkabilityCoefficientC >= MIN_WALKABILITY_VALUE);
+ llassert(mWalkabilityCoefficientC <= MAX_WALKABILITY_VALUE);
+
+ llassert(pLinksetData.has(LINKSET_WALKABILITY_D_FIELD));
+ llassert(pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).isInteger());
+ mWalkabilityCoefficientD = pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).asInteger();
+ llassert(mWalkabilityCoefficientD >= MIN_WALKABILITY_VALUE);
+ llassert(mWalkabilityCoefficientD <= MAX_WALKABILITY_VALUE);
}
BOOL LLPathfindingLinkset::isPhantom(ELinksetUse pLinksetUse)
{
- BOOL retVal;
-
- switch (pLinksetUse)
- {
- case kWalkable :
- case kStaticObstacle :
- case kDynamicObstacle :
- retVal = false;
- break;
- case kMaterialVolume :
- case kExclusionVolume :
- case kDynamicPhantom :
- retVal = true;
- break;
- case kUnknown :
- default :
- retVal = false;
- llassert(0);
- break;
- }
-
- return retVal;
+ BOOL retVal;
+
+ switch (pLinksetUse)
+ {
+ case kWalkable :
+ case kStaticObstacle :
+ case kDynamicObstacle :
+ retVal = false;
+ break;
+ case kMaterialVolume :
+ case kExclusionVolume :
+ case kDynamicPhantom :
+ retVal = true;
+ break;
+ case kUnknown :
+ default :
+ retVal = false;
+ llassert(0);
+ break;
+ }
+
+ return retVal;
}
LLPathfindingLinkset::ELinksetUse LLPathfindingLinkset::getLinksetUse(bool pIsPhantom, ENavMeshGenerationCategory pNavMeshGenerationCategory)
{
- ELinksetUse linksetUse = kUnknown;
-
- if (pIsPhantom)
- {
- switch (pNavMeshGenerationCategory)
- {
- case kNavMeshGenerationIgnore :
- linksetUse = kDynamicPhantom;
- break;
- case kNavMeshGenerationInclude :
- linksetUse = kMaterialVolume;
- break;
- case kNavMeshGenerationExclude :
- linksetUse = kExclusionVolume;
- break;
- default :
- linksetUse = kUnknown;
- llassert(0);
- break;
- }
- }
- else
- {
- switch (pNavMeshGenerationCategory)
- {
- case kNavMeshGenerationIgnore :
- linksetUse = kDynamicObstacle;
- break;
- case kNavMeshGenerationInclude :
- linksetUse = kWalkable;
- break;
- case kNavMeshGenerationExclude :
- linksetUse = kStaticObstacle;
- break;
- default :
- linksetUse = kUnknown;
- llassert(0);
- break;
- }
- }
-
- return linksetUse;
+ ELinksetUse linksetUse = kUnknown;
+
+ if (pIsPhantom)
+ {
+ switch (pNavMeshGenerationCategory)
+ {
+ case kNavMeshGenerationIgnore :
+ linksetUse = kDynamicPhantom;
+ break;
+ case kNavMeshGenerationInclude :
+ linksetUse = kMaterialVolume;
+ break;
+ case kNavMeshGenerationExclude :
+ linksetUse = kExclusionVolume;
+ break;
+ default :
+ linksetUse = kUnknown;
+ llassert(0);
+ break;
+ }
+ }
+ else
+ {
+ switch (pNavMeshGenerationCategory)
+ {
+ case kNavMeshGenerationIgnore :
+ linksetUse = kDynamicObstacle;
+ break;
+ case kNavMeshGenerationInclude :
+ linksetUse = kWalkable;
+ break;
+ case kNavMeshGenerationExclude :
+ linksetUse = kStaticObstacle;
+ break;
+ default :
+ linksetUse = kUnknown;
+ llassert(0);
+ break;
+ }
+ }
+
+ return linksetUse;
}
LLPathfindingLinkset::ENavMeshGenerationCategory LLPathfindingLinkset::getNavMeshGenerationCategory(ELinksetUse pLinksetUse)
{
- ENavMeshGenerationCategory navMeshGenerationCategory;
- switch (pLinksetUse)
- {
- case kWalkable :
- case kMaterialVolume :
- navMeshGenerationCategory = kNavMeshGenerationInclude;
- break;
- case kStaticObstacle :
- case kExclusionVolume :
- navMeshGenerationCategory = kNavMeshGenerationExclude;
- break;
- case kDynamicObstacle :
- case kDynamicPhantom :
- navMeshGenerationCategory = kNavMeshGenerationIgnore;
- break;
- case kUnknown :
- default :
- navMeshGenerationCategory = kNavMeshGenerationIgnore;
- llassert(0);
- break;
- }
-
- return navMeshGenerationCategory;
+ ENavMeshGenerationCategory navMeshGenerationCategory;
+ switch (pLinksetUse)
+ {
+ case kWalkable :
+ case kMaterialVolume :
+ navMeshGenerationCategory = kNavMeshGenerationInclude;
+ break;
+ case kStaticObstacle :
+ case kExclusionVolume :
+ navMeshGenerationCategory = kNavMeshGenerationExclude;
+ break;
+ case kDynamicObstacle :
+ case kDynamicPhantom :
+ navMeshGenerationCategory = kNavMeshGenerationIgnore;
+ break;
+ case kUnknown :
+ default :
+ navMeshGenerationCategory = kNavMeshGenerationIgnore;
+ llassert(0);
+ break;
+ }
+
+ return navMeshGenerationCategory;
}
LLSD LLPathfindingLinkset::convertCategoryToLLSD(ENavMeshGenerationCategory pNavMeshGenerationCategory)
{
- LLSD llsd;
-
- switch (pNavMeshGenerationCategory)
- {
- case kNavMeshGenerationIgnore :
- llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_IGNORE);
- break;
- case kNavMeshGenerationInclude :
- llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_INCLUDE);
- break;
- case kNavMeshGenerationExclude :
- llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_EXCLUDE);
- break;
- default :
- llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_IGNORE);
- llassert(0);
- break;
- }
-
- return llsd;
+ LLSD llsd;
+
+ switch (pNavMeshGenerationCategory)
+ {
+ case kNavMeshGenerationIgnore :
+ llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_IGNORE);
+ break;
+ case kNavMeshGenerationInclude :
+ llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_INCLUDE);
+ break;
+ case kNavMeshGenerationExclude :
+ llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_EXCLUDE);
+ break;
+ default :
+ llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_IGNORE);
+ llassert(0);
+ break;
+ }
+
+ return llsd;
}
LLPathfindingLinkset::ENavMeshGenerationCategory LLPathfindingLinkset::convertCategoryFromLLSD(const LLSD &llsd)
{
- ENavMeshGenerationCategory navMeshGenerationCategory;
-
- llassert(llsd.isInteger());
- switch (llsd.asInteger())
- {
- case LINKSET_CATEGORY_VALUE_IGNORE :
- navMeshGenerationCategory = kNavMeshGenerationIgnore;
- break;
- case LINKSET_CATEGORY_VALUE_INCLUDE :
- navMeshGenerationCategory = kNavMeshGenerationInclude;
- break;
- case LINKSET_CATEGORY_VALUE_EXCLUDE :
- navMeshGenerationCategory = kNavMeshGenerationExclude;
- break;
- default :
- navMeshGenerationCategory = kNavMeshGenerationIgnore;
- llassert(0);
- break;
- }
-
- return navMeshGenerationCategory;
+ ENavMeshGenerationCategory navMeshGenerationCategory;
+
+ llassert(llsd.isInteger());
+ switch (llsd.asInteger())
+ {
+ case LINKSET_CATEGORY_VALUE_IGNORE :
+ navMeshGenerationCategory = kNavMeshGenerationIgnore;
+ break;
+ case LINKSET_CATEGORY_VALUE_INCLUDE :
+ navMeshGenerationCategory = kNavMeshGenerationInclude;
+ break;
+ case LINKSET_CATEGORY_VALUE_EXCLUDE :
+ navMeshGenerationCategory = kNavMeshGenerationExclude;
+ break;
+ default :
+ navMeshGenerationCategory = kNavMeshGenerationIgnore;
+ llassert(0);
+ break;
+ }
+
+ return navMeshGenerationCategory;
}
diff --git a/indra/newview/llpathfindinglinkset.h b/indra/newview/llpathfindinglinkset.h
index 308a3a1e0f..ef236d5949 100644
--- a/indra/newview/llpathfindinglinkset.h
+++ b/indra/newview/llpathfindinglinkset.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindinglinkset.h
* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding.
* @author Stinson@lindenlab.com
@@ -36,79 +36,79 @@ class LLSD;
class LLPathfindingLinkset : public LLPathfindingObject
{
public:
- typedef enum
- {
- kUnknown,
- kWalkable,
- kStaticObstacle,
- kDynamicObstacle,
- kMaterialVolume,
- kExclusionVolume,
- kDynamicPhantom
- } ELinksetUse;
-
- LLPathfindingLinkset(const LLSD &pTerrainData);
- LLPathfindingLinkset(const std::string &pUUID, const LLSD &pLinksetData);
- LLPathfindingLinkset(const LLPathfindingLinkset& pOther);
- virtual ~LLPathfindingLinkset();
-
- LLPathfindingLinkset& operator = (const LLPathfindingLinkset& pOther);
-
- inline bool isTerrain() const {return mIsTerrain;};
- inline U32 getLandImpact() const {return mLandImpact;};
- BOOL isModifiable() const {return mIsModifiable;};
- BOOL isPhantom() const;
- BOOL canBeVolume() const {return mCanBeVolume;};
- static ELinksetUse getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse);
-
- inline ELinksetUse getLinksetUse() const {return mLinksetUse;};
-
- inline BOOL isScripted() const {return mIsScripted;};
- inline BOOL hasIsScripted() const {return mHasIsScripted;};
-
- inline S32 getWalkabilityCoefficientA() const {return mWalkabilityCoefficientA;};
- inline S32 getWalkabilityCoefficientB() const {return mWalkabilityCoefficientB;};
- inline S32 getWalkabilityCoefficientC() const {return mWalkabilityCoefficientC;};
- inline S32 getWalkabilityCoefficientD() const {return mWalkabilityCoefficientD;};
-
- bool isShowUnmodifiablePhantomWarning(ELinksetUse pLinksetUse) const;
- bool isShowPhantomToggleWarning(ELinksetUse pLinksetUse) const;
- bool isShowCannotBeVolumeWarning(ELinksetUse pLinksetUse) const;
- LLSD encodeAlteredFields(ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
-
- static const S32 MIN_WALKABILITY_VALUE;
- static const S32 MAX_WALKABILITY_VALUE;
-
+ typedef enum
+ {
+ kUnknown,
+ kWalkable,
+ kStaticObstacle,
+ kDynamicObstacle,
+ kMaterialVolume,
+ kExclusionVolume,
+ kDynamicPhantom
+ } ELinksetUse;
+
+ LLPathfindingLinkset(const LLSD &pTerrainData);
+ LLPathfindingLinkset(const std::string &pUUID, const LLSD &pLinksetData);
+ LLPathfindingLinkset(const LLPathfindingLinkset& pOther);
+ virtual ~LLPathfindingLinkset();
+
+ LLPathfindingLinkset& operator = (const LLPathfindingLinkset& pOther);
+
+ inline bool isTerrain() const {return mIsTerrain;};
+ inline U32 getLandImpact() const {return mLandImpact;};
+ BOOL isModifiable() const {return mIsModifiable;};
+ BOOL isPhantom() const;
+ BOOL canBeVolume() const {return mCanBeVolume;};
+ static ELinksetUse getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse);
+
+ inline ELinksetUse getLinksetUse() const {return mLinksetUse;};
+
+ inline BOOL isScripted() const {return mIsScripted;};
+ inline BOOL hasIsScripted() const {return mHasIsScripted;};
+
+ inline S32 getWalkabilityCoefficientA() const {return mWalkabilityCoefficientA;};
+ inline S32 getWalkabilityCoefficientB() const {return mWalkabilityCoefficientB;};
+ inline S32 getWalkabilityCoefficientC() const {return mWalkabilityCoefficientC;};
+ inline S32 getWalkabilityCoefficientD() const {return mWalkabilityCoefficientD;};
+
+ bool isShowUnmodifiablePhantomWarning(ELinksetUse pLinksetUse) const;
+ bool isShowPhantomToggleWarning(ELinksetUse pLinksetUse) const;
+ bool isShowCannotBeVolumeWarning(ELinksetUse pLinksetUse) const;
+ LLSD encodeAlteredFields(ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
+
+ static const S32 MIN_WALKABILITY_VALUE;
+ static const S32 MAX_WALKABILITY_VALUE;
+
protected:
private:
- typedef enum
- {
- kNavMeshGenerationIgnore,
- kNavMeshGenerationInclude,
- kNavMeshGenerationExclude
- } ENavMeshGenerationCategory;
-
- void parseLinksetData(const LLSD &pLinksetData);
- void parsePathfindingData(const LLSD &pLinksetData);
-
- static BOOL isPhantom(ELinksetUse pLinksetUse);
- static ELinksetUse getLinksetUse(bool pIsPhantom, ENavMeshGenerationCategory pNavMeshGenerationCategory);
- static ENavMeshGenerationCategory getNavMeshGenerationCategory(ELinksetUse pLinksetUse);
- static LLSD convertCategoryToLLSD(ENavMeshGenerationCategory pNavMeshGenerationCategory);
- static ENavMeshGenerationCategory convertCategoryFromLLSD(const LLSD &llsd);
-
- bool mIsTerrain;
- U32 mLandImpact;
- BOOL mIsModifiable;
- BOOL mCanBeVolume;
- BOOL mIsScripted;
- BOOL mHasIsScripted;
- ELinksetUse mLinksetUse;
- S32 mWalkabilityCoefficientA;
- S32 mWalkabilityCoefficientB;
- S32 mWalkabilityCoefficientC;
- S32 mWalkabilityCoefficientD;
+ typedef enum
+ {
+ kNavMeshGenerationIgnore,
+ kNavMeshGenerationInclude,
+ kNavMeshGenerationExclude
+ } ENavMeshGenerationCategory;
+
+ void parseLinksetData(const LLSD &pLinksetData);
+ void parsePathfindingData(const LLSD &pLinksetData);
+
+ static BOOL isPhantom(ELinksetUse pLinksetUse);
+ static ELinksetUse getLinksetUse(bool pIsPhantom, ENavMeshGenerationCategory pNavMeshGenerationCategory);
+ static ENavMeshGenerationCategory getNavMeshGenerationCategory(ELinksetUse pLinksetUse);
+ static LLSD convertCategoryToLLSD(ENavMeshGenerationCategory pNavMeshGenerationCategory);
+ static ENavMeshGenerationCategory convertCategoryFromLLSD(const LLSD &llsd);
+
+ bool mIsTerrain;
+ U32 mLandImpact;
+ BOOL mIsModifiable;
+ BOOL mCanBeVolume;
+ BOOL mIsScripted;
+ BOOL mHasIsScripted;
+ ELinksetUse mLinksetUse;
+ S32 mWalkabilityCoefficientA;
+ S32 mWalkabilityCoefficientB;
+ S32 mWalkabilityCoefficientC;
+ S32 mWalkabilityCoefficientD;
};
#endif // LL_LLPATHFINDINGLINKSET_H
diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp
index eb7b95552e..ee68db759d 100644
--- a/indra/newview/llpathfindinglinksetlist.cpp
+++ b/indra/newview/llpathfindinglinksetlist.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindinglinksetlist.cpp
* @brief Implementation of llpathfindinglinksetlist
* @author Stinson@lindenlab.com
@@ -43,14 +43,14 @@
//---------------------------------------------------------------------------
LLPathfindingLinksetList::LLPathfindingLinksetList()
- : LLPathfindingObjectList()
+ : LLPathfindingObjectList()
{
}
LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetListData)
- : LLPathfindingObjectList()
+ : LLPathfindingObjectList()
{
- parseLinksetListData(pLinksetListData);
+ parseLinksetListData(pLinksetListData);
}
LLPathfindingLinksetList::~LLPathfindingLinksetList()
@@ -59,155 +59,155 @@ LLPathfindingLinksetList::~LLPathfindingLinksetList()
LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const
{
- LLSD listData;
-
- for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
- {
- const LLPathfindingObjectPtr objectPtr = linksetIter->second;
- const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
-
- if (!linkset->isTerrain())
- {
- LLSD linksetData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD);
- if (!linksetData.isUndefined())
- {
- const std::string& uuid(linksetIter->first);
- listData[uuid] = linksetData;
- }
- }
- }
-
- return listData;
+ LLSD listData;
+
+ for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
+ {
+ const LLPathfindingObjectPtr objectPtr = linksetIter->second;
+ const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
+
+ if (!linkset->isTerrain())
+ {
+ LLSD linksetData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD);
+ if (!linksetData.isUndefined())
+ {
+ const std::string& uuid(linksetIter->first);
+ listData[uuid] = linksetData;
+ }
+ }
+ }
+
+ return listData;
}
LLSD LLPathfindingLinksetList::encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const
{
- LLSD terrainData;
-
- for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
- {
- const LLPathfindingObjectPtr objectPtr = linksetIter->second;
- const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
-
- if (linkset->isTerrain())
- {
- terrainData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD);
- break;
- }
- }
-
- return terrainData;
+ LLSD terrainData;
+
+ for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
+ {
+ const LLPathfindingObjectPtr objectPtr = linksetIter->second;
+ const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
+
+ if (linkset->isTerrain())
+ {
+ terrainData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD);
+ break;
+ }
+ }
+
+ return terrainData;
}
bool LLPathfindingLinksetList::isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
- bool isShowWarning = false;
+ bool isShowWarning = false;
- for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter)
- {
- const LLPathfindingObjectPtr objectPtr = objectIter->second;
- const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
- isShowWarning = linkset->isShowUnmodifiablePhantomWarning(pLinksetUse);
- }
+ for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter)
+ {
+ const LLPathfindingObjectPtr objectPtr = objectIter->second;
+ const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
+ isShowWarning = linkset->isShowUnmodifiablePhantomWarning(pLinksetUse);
+ }
- return isShowWarning;
+ return isShowWarning;
}
bool LLPathfindingLinksetList::isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
- bool isShowWarning = false;
+ bool isShowWarning = false;
- for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter)
- {
- const LLPathfindingObjectPtr objectPtr = objectIter->second;
- const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
- isShowWarning = linkset->isShowPhantomToggleWarning(pLinksetUse);
- }
+ for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter)
+ {
+ const LLPathfindingObjectPtr objectPtr = objectIter->second;
+ const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
+ isShowWarning = linkset->isShowPhantomToggleWarning(pLinksetUse);
+ }
- return isShowWarning;
+ return isShowWarning;
}
bool LLPathfindingLinksetList::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
- bool isShowWarning = false;
+ bool isShowWarning = false;
- for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter)
- {
- const LLPathfindingObjectPtr objectPtr = objectIter->second;
- const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
- isShowWarning = linkset->isShowCannotBeVolumeWarning(pLinksetUse);
- }
+ for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter)
+ {
+ const LLPathfindingObjectPtr objectPtr = objectIter->second;
+ const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
+ isShowWarning = linkset->isShowCannotBeVolumeWarning(pLinksetUse);
+ }
- return isShowWarning;
+ return isShowWarning;
}
void LLPathfindingLinksetList::determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle,
- BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const
+ BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const
{
- pCanBeWalkable = FALSE;
- pCanBeStaticObstacle = FALSE;
- pCanBeDynamicObstacle = FALSE;
- pCanBeMaterialVolume = FALSE;
- pCanBeExclusionVolume = FALSE;
- pCanBeDynamicPhantom = FALSE;
-
- for (const_iterator objectIter = begin();
- !(pCanBeWalkable && pCanBeStaticObstacle && pCanBeDynamicObstacle && pCanBeMaterialVolume && pCanBeExclusionVolume && pCanBeDynamicPhantom) && (objectIter != end());
- ++objectIter)
- {
- const LLPathfindingObjectPtr objectPtr = objectIter->second;
- const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
-
- if (linkset->isTerrain())
- {
- pCanBeWalkable = TRUE;
- }
- else
- {
- if (linkset->isModifiable())
- {
- pCanBeWalkable = TRUE;
- pCanBeStaticObstacle = TRUE;
- pCanBeDynamicObstacle = TRUE;
- pCanBeDynamicPhantom = TRUE;
- if (linkset->canBeVolume())
- {
- pCanBeMaterialVolume = TRUE;
- pCanBeExclusionVolume = TRUE;
- }
- }
- else if (linkset->isPhantom())
- {
- pCanBeDynamicPhantom = TRUE;
- if (linkset->canBeVolume())
- {
- pCanBeMaterialVolume = TRUE;
- pCanBeExclusionVolume = TRUE;
- }
- }
- else
- {
- pCanBeWalkable = TRUE;
- pCanBeStaticObstacle = TRUE;
- pCanBeDynamicObstacle = TRUE;
- }
- }
- }
+ pCanBeWalkable = FALSE;
+ pCanBeStaticObstacle = FALSE;
+ pCanBeDynamicObstacle = FALSE;
+ pCanBeMaterialVolume = FALSE;
+ pCanBeExclusionVolume = FALSE;
+ pCanBeDynamicPhantom = FALSE;
+
+ for (const_iterator objectIter = begin();
+ !(pCanBeWalkable && pCanBeStaticObstacle && pCanBeDynamicObstacle && pCanBeMaterialVolume && pCanBeExclusionVolume && pCanBeDynamicPhantom) && (objectIter != end());
+ ++objectIter)
+ {
+ const LLPathfindingObjectPtr objectPtr = objectIter->second;
+ const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
+
+ if (linkset->isTerrain())
+ {
+ pCanBeWalkable = TRUE;
+ }
+ else
+ {
+ if (linkset->isModifiable())
+ {
+ pCanBeWalkable = TRUE;
+ pCanBeStaticObstacle = TRUE;
+ pCanBeDynamicObstacle = TRUE;
+ pCanBeDynamicPhantom = TRUE;
+ if (linkset->canBeVolume())
+ {
+ pCanBeMaterialVolume = TRUE;
+ pCanBeExclusionVolume = TRUE;
+ }
+ }
+ else if (linkset->isPhantom())
+ {
+ pCanBeDynamicPhantom = TRUE;
+ if (linkset->canBeVolume())
+ {
+ pCanBeMaterialVolume = TRUE;
+ pCanBeExclusionVolume = TRUE;
+ }
+ }
+ else
+ {
+ pCanBeWalkable = TRUE;
+ pCanBeStaticObstacle = TRUE;
+ pCanBeDynamicObstacle = TRUE;
+ }
+ }
+ }
}
void LLPathfindingLinksetList::parseLinksetListData(const LLSD& pLinksetListData)
{
- LLPathfindingObjectMap &objectMap = getObjectMap();
-
- for (LLSD::map_const_iterator linksetDataIter = pLinksetListData.beginMap();
- linksetDataIter != pLinksetListData.endMap(); ++linksetDataIter)
- {
- const std::string& uuid(linksetDataIter->first);
- const LLSD& linksetData = linksetDataIter->second;
- if(linksetData.size() != 0)
- {
- LLPathfindingObjectPtr linksetPtr(new LLPathfindingLinkset(uuid, linksetData));
- objectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(uuid, linksetPtr));
- }
- }
+ LLPathfindingObjectMap &objectMap = getObjectMap();
+
+ for (LLSD::map_const_iterator linksetDataIter = pLinksetListData.beginMap();
+ linksetDataIter != pLinksetListData.endMap(); ++linksetDataIter)
+ {
+ const std::string& uuid(linksetDataIter->first);
+ const LLSD& linksetData = linksetDataIter->second;
+ if(linksetData.size() != 0)
+ {
+ LLPathfindingObjectPtr linksetPtr(new LLPathfindingLinkset(uuid, linksetData));
+ objectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(uuid, linksetPtr));
+ }
+ }
}
diff --git a/indra/newview/llpathfindinglinksetlist.h b/indra/newview/llpathfindinglinksetlist.h
index 1d38e4c11a..ae68227824 100644
--- a/indra/newview/llpathfindinglinksetlist.h
+++ b/indra/newview/llpathfindinglinksetlist.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindinglinksetlist.h
* @brief Header file for llpathfindinglinksetlist
* @author Stinson@lindenlab.com
@@ -35,24 +35,24 @@ class LLSD;
class LLPathfindingLinksetList : public LLPathfindingObjectList
{
public:
- LLPathfindingLinksetList();
- LLPathfindingLinksetList(const LLSD& pLinksetListData);
- virtual ~LLPathfindingLinksetList();
+ LLPathfindingLinksetList();
+ LLPathfindingLinksetList(const LLSD& pLinksetListData);
+ virtual ~LLPathfindingLinksetList();
- LLSD encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
- LLSD encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
+ LLSD encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
+ LLSD encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
- bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
- bool isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
- bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
+ bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
+ bool isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
+ bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
- void determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle,
- BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const;
+ void determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle,
+ BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const;
protected:
private:
- void parseLinksetListData(const LLSD& pLinksetListData);
+ void parseLinksetListData(const LLSD& pLinksetListData);
};
#endif // LL_LLPATHFINDINGLINKSETLIST_H
diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp
index 664e240484..7b7caa5a79 100644
--- a/indra/newview/llpathfindingmanager.cpp
+++ b/indra/newview/llpathfindingmanager.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingmanager.cpp
* @brief Implementation of llpathfindingmanager
* @author Stinson@lindenlab.com
@@ -82,7 +82,7 @@
class LLNavMeshSimStateChangeNode : public LLHTTPNode
{
public:
- virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const;
+ virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const;
};
LLHTTPRegistration<LLNavMeshSimStateChangeNode> gHTTPRegistrationNavMeshSimStateChangeNode(SIM_MESSAGE_NAVMESH_STATUS_UPDATE);
@@ -94,7 +94,7 @@ LLHTTPRegistration<LLNavMeshSimStateChangeNode> gHTTPRegistrationNavMeshSimState
class LLAgentStateChangeNode : public LLHTTPNode
{
public:
- virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const;
+ virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const;
};
LLHTTPRegistration<LLAgentStateChangeNode> gHTTPRegistrationAgentStateChangeNode(SIM_MESSAGE_AGENT_STATE_UPDATE);
@@ -106,37 +106,37 @@ LLHTTPRegistration<LLAgentStateChangeNode> gHTTPRegistrationAgentStateChangeNode
class LinksetsResponder
{
public:
- LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested);
- virtual ~LinksetsResponder();
+ LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested);
+ virtual ~LinksetsResponder();
- void handleObjectLinksetsResult(const LLSD &pContent);
- void handleObjectLinksetsError();
- void handleTerrainLinksetsResult(const LLSD &pContent);
- void handleTerrainLinksetsError();
+ void handleObjectLinksetsResult(const LLSD &pContent);
+ void handleObjectLinksetsError();
+ void handleTerrainLinksetsResult(const LLSD &pContent);
+ void handleTerrainLinksetsError();
typedef std::shared_ptr<LinksetsResponder> ptr_t;
protected:
private:
- void sendCallback();
+ void sendCallback();
- typedef enum
- {
- kNotRequested,
- kWaiting,
- kReceivedGood,
- kReceivedError
- } EMessagingState;
+ typedef enum
+ {
+ kNotRequested,
+ kWaiting,
+ kReceivedGood,
+ kReceivedError
+ } EMessagingState;
- LLPathfindingManager::request_id_t mRequestId;
- LLPathfindingManager::object_request_callback_t mLinksetsCallback;
+ LLPathfindingManager::request_id_t mRequestId;
+ LLPathfindingManager::object_request_callback_t mLinksetsCallback;
- EMessagingState mObjectMessagingState;
- EMessagingState mTerrainMessagingState;
+ EMessagingState mObjectMessagingState;
+ EMessagingState mTerrainMessagingState;
- LLPathfindingObjectListPtr mObjectLinksetListPtr;
- LLPathfindingObjectPtr mTerrainLinksetPtr;
+ LLPathfindingObjectListPtr mObjectLinksetListPtr;
+ LLPathfindingObjectPtr mTerrainLinksetPtr;
};
typedef std::shared_ptr<LinksetsResponder> LinksetsResponderPtr;
@@ -146,79 +146,79 @@ typedef std::shared_ptr<LinksetsResponder> LinksetsResponderPtr;
//---------------------------------------------------------------------------
LLPathfindingManager::LLPathfindingManager():
- mNavMeshMap(),
- mAgentStateSignal()
+ mNavMeshMap(),
+ mAgentStateSignal()
{
}
LLPathfindingManager::~LLPathfindingManager()
-{
- quitSystem();
+{
+ quitSystem();
}
void LLPathfindingManager::initSystem()
{
- if (LLPathingLib::getInstance() == NULL)
- {
- LLPathingLib::initSystem();
- }
+ if (LLPathingLib::getInstance() == NULL)
+ {
+ LLPathingLib::initSystem();
+ }
}
void LLPathfindingManager::quitSystem()
{
- if (LLPathingLib::getInstance() != NULL)
- {
- LLPathingLib::quitSystem();
- }
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::quitSystem();
+ }
}
bool LLPathfindingManager::isPathfindingViewEnabled() const
{
- return (LLPathingLib::getInstance() != NULL);
+ return (LLPathingLib::getInstance() != NULL);
}
bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const
{
- return isPathfindingEnabledForRegion(getCurrentRegion());
+ return isPathfindingEnabledForRegion(getCurrentRegion());
}
bool LLPathfindingManager::isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const
{
- std::string retrieveNavMeshURL = getRetrieveNavMeshURLForRegion(pRegion);
- return !retrieveNavMeshURL.empty();
+ std::string retrieveNavMeshURL = getRetrieveNavMeshURLForRegion(pRegion);
+ return !retrieveNavMeshURL.empty();
}
bool LLPathfindingManager::isAllowViewTerrainProperties() const
{
- LLViewerRegion* region = getCurrentRegion();
- return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate()));
+ LLViewerRegion* region = getCurrentRegion();
+ return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate()));
}
LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback)
{
- LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion);
- return navMeshPtr->registerNavMeshListener(pNavMeshCallback);
+ LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion);
+ return navMeshPtr->registerNavMeshListener(pNavMeshCallback);
}
void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly)
{
- LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion);
-
- if (pRegion == NULL)
- {
- navMeshPtr->handleNavMeshNotEnabled();
- }
- else if (!pRegion->capabilitiesReceived())
- {
- navMeshPtr->handleNavMeshWaitForRegionLoad();
- pRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetNavMeshForRegion, this, _1, pIsGetStatusOnly));
- }
- else if (!isPathfindingEnabledForRegion(pRegion))
- {
- navMeshPtr->handleNavMeshNotEnabled();
- }
- else
- {
+ LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion);
+
+ if (pRegion == NULL)
+ {
+ navMeshPtr->handleNavMeshNotEnabled();
+ }
+ else if (!pRegion->capabilitiesReceived())
+ {
+ navMeshPtr->handleNavMeshWaitForRegionLoad();
+ pRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetNavMeshForRegion, this, _1, pIsGetStatusOnly));
+ }
+ else if (!isPathfindingEnabledForRegion(pRegion))
+ {
+ navMeshPtr->handleNavMeshNotEnabled();
+ }
+ else
+ {
std::string navMeshStatusURL = getNavMeshStatusURLForRegion(pRegion);
llassert(!navMeshStatusURL.empty());
navMeshPtr->handleNavMeshCheckVersion();
@@ -226,226 +226,226 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion, b
U64 regionHandle = pRegion->getHandle();
std::string coroname = LLCoros::instance().launch("LLPathfindingManager::navMeshStatusRequestCoro",
boost::bind(&LLPathfindingManager::navMeshStatusRequestCoro, this, navMeshStatusURL, regionHandle, pIsGetStatusOnly));
- }
+ }
}
void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const
{
- LLPathfindingObjectListPtr emptyLinksetListPtr;
- LLViewerRegion *currentRegion = getCurrentRegion();
-
- if (currentRegion == NULL)
- {
- pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr);
- }
- else if (!currentRegion->capabilitiesReceived())
- {
- pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr);
- currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetLinksetsForRegion, this, _1, pRequestId, pLinksetsCallback));
- }
- else
- {
- std::string objectLinksetsURL = getRetrieveObjectLinksetsURLForCurrentRegion();
- std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion();
- if (objectLinksetsURL.empty() || terrainLinksetsURL.empty())
- {
- pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr);
- }
- else
- {
- pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr);
-
- bool doRequestTerrain = isAllowViewTerrainProperties();
- LinksetsResponder::ptr_t linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain));
+ LLPathfindingObjectListPtr emptyLinksetListPtr;
+ LLViewerRegion *currentRegion = getCurrentRegion();
+
+ if (currentRegion == NULL)
+ {
+ pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr);
+ }
+ else if (!currentRegion->capabilitiesReceived())
+ {
+ pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr);
+ currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetLinksetsForRegion, this, _1, pRequestId, pLinksetsCallback));
+ }
+ else
+ {
+ std::string objectLinksetsURL = getRetrieveObjectLinksetsURLForCurrentRegion();
+ std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion();
+ if (objectLinksetsURL.empty() || terrainLinksetsURL.empty())
+ {
+ pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr);
+ }
+ else
+ {
+ pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr);
+
+ bool doRequestTerrain = isAllowViewTerrainProperties();
+ LinksetsResponder::ptr_t linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain));
std::string coroname = LLCoros::instance().launch("LLPathfindingManager::linksetObjectsCoro",
boost::bind(&LLPathfindingManager::linksetObjectsCoro, this, objectLinksetsURL, linksetsResponderPtr, LLSD()));
if (doRequestTerrain)
- {
+ {
std::string coroname = LLCoros::instance().launch("LLPathfindingManager::linksetTerrainCoro",
boost::bind(&LLPathfindingManager::linksetTerrainCoro, this, terrainLinksetsURL, linksetsResponderPtr, LLSD()));
- }
- }
- }
+ }
+ }
+ }
}
void LLPathfindingManager::requestSetLinksets(request_id_t pRequestId, const LLPathfindingObjectListPtr &pLinksetListPtr, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, object_request_callback_t pLinksetsCallback) const
{
- LLPathfindingObjectListPtr emptyLinksetListPtr;
-
- std::string objectLinksetsURL = getChangeObjectLinksetsURLForCurrentRegion();
- std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion();
- if (objectLinksetsURL.empty() || terrainLinksetsURL.empty())
- {
- pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr);
- }
- else if ((pLinksetListPtr == NULL) || pLinksetListPtr->isEmpty())
- {
- pLinksetsCallback(pRequestId, kRequestCompleted, emptyLinksetListPtr);
- }
- else
- {
- const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(pLinksetListPtr.get());
-
- LLSD objectPostData = linksetList->encodeObjectFields(pLinksetUse, pA, pB, pC, pD);
- LLSD terrainPostData;
- if (isAllowViewTerrainProperties())
- {
- terrainPostData = linksetList->encodeTerrainFields(pLinksetUse, pA, pB, pC, pD);
- }
-
- if (objectPostData.isUndefined() && terrainPostData.isUndefined())
- {
- pLinksetsCallback(pRequestId, kRequestCompleted, emptyLinksetListPtr);
- }
- else
- {
- pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr);
-
- LinksetsResponder::ptr_t linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, !objectPostData.isUndefined(), !terrainPostData.isUndefined()));
-
- if (!objectPostData.isUndefined())
- {
+ LLPathfindingObjectListPtr emptyLinksetListPtr;
+
+ std::string objectLinksetsURL = getChangeObjectLinksetsURLForCurrentRegion();
+ std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion();
+ if (objectLinksetsURL.empty() || terrainLinksetsURL.empty())
+ {
+ pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr);
+ }
+ else if ((pLinksetListPtr == NULL) || pLinksetListPtr->isEmpty())
+ {
+ pLinksetsCallback(pRequestId, kRequestCompleted, emptyLinksetListPtr);
+ }
+ else
+ {
+ const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(pLinksetListPtr.get());
+
+ LLSD objectPostData = linksetList->encodeObjectFields(pLinksetUse, pA, pB, pC, pD);
+ LLSD terrainPostData;
+ if (isAllowViewTerrainProperties())
+ {
+ terrainPostData = linksetList->encodeTerrainFields(pLinksetUse, pA, pB, pC, pD);
+ }
+
+ if (objectPostData.isUndefined() && terrainPostData.isUndefined())
+ {
+ pLinksetsCallback(pRequestId, kRequestCompleted, emptyLinksetListPtr);
+ }
+ else
+ {
+ pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr);
+
+ LinksetsResponder::ptr_t linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, !objectPostData.isUndefined(), !terrainPostData.isUndefined()));
+
+ if (!objectPostData.isUndefined())
+ {
std::string coroname = LLCoros::instance().launch("LLPathfindingManager::linksetObjectsCoro",
boost::bind(&LLPathfindingManager::linksetObjectsCoro, this, objectLinksetsURL, linksetsResponderPtr, objectPostData));
- }
+ }
- if (!terrainPostData.isUndefined())
- {
+ if (!terrainPostData.isUndefined())
+ {
std::string coroname = LLCoros::instance().launch("LLPathfindingManager::linksetTerrainCoro",
boost::bind(&LLPathfindingManager::linksetTerrainCoro, this, terrainLinksetsURL, linksetsResponderPtr, terrainPostData));
- }
- }
- }
+ }
+ }
+ }
}
void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_request_callback_t pCharactersCallback) const
{
- LLPathfindingObjectListPtr emptyCharacterListPtr;
-
- LLViewerRegion *currentRegion = getCurrentRegion();
-
- if (currentRegion == NULL)
- {
- pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr);
- }
- else if (!currentRegion->capabilitiesReceived())
- {
- pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr);
- currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetCharactersForRegion, this, _1, pRequestId, pCharactersCallback));
- }
- else
- {
- std::string charactersURL = getCharactersURLForCurrentRegion();
- if (charactersURL.empty())
- {
- pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr);
- }
- else
- {
- pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr);
+ LLPathfindingObjectListPtr emptyCharacterListPtr;
+
+ LLViewerRegion *currentRegion = getCurrentRegion();
+
+ if (currentRegion == NULL)
+ {
+ pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr);
+ }
+ else if (!currentRegion->capabilitiesReceived())
+ {
+ pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr);
+ currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetCharactersForRegion, this, _1, pRequestId, pCharactersCallback));
+ }
+ else
+ {
+ std::string charactersURL = getCharactersURLForCurrentRegion();
+ if (charactersURL.empty())
+ {
+ pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr);
+ }
+ else
+ {
+ pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr);
std::string coroname = LLCoros::instance().launch("LLPathfindingManager::charactersCoro",
boost::bind(&LLPathfindingManager::charactersCoro, this, charactersURL, pRequestId, pCharactersCallback));
- }
- }
+ }
+ }
}
LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback)
{
- return mAgentStateSignal.connect(pAgentStateCallback);
+ return mAgentStateSignal.connect(pAgentStateCallback);
}
void LLPathfindingManager::requestGetAgentState()
{
- LLViewerRegion *currentRegion = getCurrentRegion();
-
- if (currentRegion == NULL)
- {
- mAgentStateSignal(FALSE);
- }
- else
- {
- if (!currentRegion->capabilitiesReceived())
- {
- currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetAgentStateForRegion, this, _1));
- }
- else if (!isPathfindingEnabledForRegion(currentRegion))
- {
- mAgentStateSignal(FALSE);
- }
- else
- {
- std::string agentStateURL = getAgentStateURLForRegion(currentRegion);
- llassert(!agentStateURL.empty());
+ LLViewerRegion *currentRegion = getCurrentRegion();
+
+ if (currentRegion == NULL)
+ {
+ mAgentStateSignal(FALSE);
+ }
+ else
+ {
+ if (!currentRegion->capabilitiesReceived())
+ {
+ currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetAgentStateForRegion, this, _1));
+ }
+ else if (!isPathfindingEnabledForRegion(currentRegion))
+ {
+ mAgentStateSignal(FALSE);
+ }
+ else
+ {
+ std::string agentStateURL = getAgentStateURLForRegion(currentRegion);
+ llassert(!agentStateURL.empty());
std::string coroname = LLCoros::instance().launch("LLPathfindingManager::navAgentStateRequestCoro",
boost::bind(&LLPathfindingManager::navAgentStateRequestCoro, this, agentStateURL));
- }
- }
+ }
+ }
}
void LLPathfindingManager::requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback)
{
- LLViewerRegion *currentRegion = getCurrentRegion();
-
- if (currentRegion == NULL)
- {
- pRebakeNavMeshCallback(false);
- }
- else if (!isPathfindingEnabledForRegion(currentRegion))
- {
- pRebakeNavMeshCallback(false);
- }
- else
- {
- std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion();
- llassert(!navMeshStatusURL.empty());
+ LLViewerRegion *currentRegion = getCurrentRegion();
+
+ if (currentRegion == NULL)
+ {
+ pRebakeNavMeshCallback(false);
+ }
+ else if (!isPathfindingEnabledForRegion(currentRegion))
+ {
+ pRebakeNavMeshCallback(false);
+ }
+ else
+ {
+ std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion();
+ llassert(!navMeshStatusURL.empty());
std::string coroname = LLCoros::instance().launch("LLPathfindingManager::navMeshRebakeCoro",
boost::bind(&LLPathfindingManager::navMeshRebakeCoro, this, navMeshStatusURL, pRebakeNavMeshCallback));
- }
+ }
}
void LLPathfindingManager::handleDeferredGetAgentStateForRegion(const LLUUID &pRegionUUID)
{
- LLViewerRegion *currentRegion = getCurrentRegion();
+ LLViewerRegion *currentRegion = getCurrentRegion();
- if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID))
- {
- requestGetAgentState();
- }
+ if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID))
+ {
+ requestGetAgentState();
+ }
}
void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly)
{
- LLViewerRegion *currentRegion = getCurrentRegion();
+ LLViewerRegion *currentRegion = getCurrentRegion();
- if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID))
- {
- requestGetNavMeshForRegion(currentRegion, pIsGetStatusOnly);
- }
+ if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID))
+ {
+ requestGetNavMeshForRegion(currentRegion, pIsGetStatusOnly);
+ }
}
void LLPathfindingManager::handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const
{
- LLViewerRegion *currentRegion = getCurrentRegion();
+ LLViewerRegion *currentRegion = getCurrentRegion();
- if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID))
- {
- requestGetLinksets(pRequestId, pLinksetsCallback);
- }
+ if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID))
+ {
+ requestGetLinksets(pRequestId, pLinksetsCallback);
+ }
}
void LLPathfindingManager::handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const
{
- LLViewerRegion *currentRegion = getCurrentRegion();
+ LLViewerRegion *currentRegion = getCurrentRegion();
- if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID))
- {
- requestGetCharacters(pRequestId, pCharactersCallback);
- }
+ if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID))
+ {
+ requestGetCharacters(pRequestId, pCharactersCallback);
+ }
}
void LLPathfindingManager::navMeshStatusRequestCoro(std::string url, U64 regionHandle, bool isGetStatusOnly)
@@ -474,7 +474,7 @@ void LLPathfindingManager::navMeshStatusRequestCoro(std::string url, U64 regionH
LLPathfindingNavMeshStatus navMeshStatus(regionUUID);
if (!status)
{
- LL_WARNS("PathfindingManager") << "HTTP status, " << status.toTerseString() <<
+ LL_WARNS("PathfindingManager") << "HTTP status, " << status.toTerseString() <<
". Building using empty status." << LL_ENDL;
}
else
@@ -589,11 +589,11 @@ void LLPathfindingManager::navMeshRebakeCoro(std::string url, rebake_navmesh_cal
". Rebake failed." << LL_ENDL;
success = false;
}
-
+
rebakeNavMeshCallback(success);
}
-// If called with putData undefined this coroutine will issue a get. If there
+// If called with putData undefined this coroutine will issue a get. If there
// is data in putData it will be PUT to the URL.
void LLPathfindingManager::linksetObjectsCoro(std::string url, LinksetsResponder::ptr_t linksetsResponsderPtr, LLSD putData) const
{
@@ -608,7 +608,7 @@ void LLPathfindingManager::linksetObjectsCoro(std::string url, LinksetsResponder
{
result = httpAdapter->getAndSuspend(httpRequest, url);
}
- else
+ else
{
result = httpAdapter->putAndSuspend(httpRequest, url, putData);
}
@@ -629,7 +629,7 @@ void LLPathfindingManager::linksetObjectsCoro(std::string url, LinksetsResponder
}
}
-// If called with putData undefined this coroutine will issue a GET. If there
+// If called with putData undefined this coroutine will issue a GET. If there
// is data in putData it will be PUT to the URL.
void LLPathfindingManager::linksetTerrainCoro(std::string url, LinksetsResponder::ptr_t linksetsResponsderPtr, LLSD putData) const
{
@@ -644,7 +644,7 @@ void LLPathfindingManager::linksetTerrainCoro(std::string url, LinksetsResponder
{
result = httpAdapter->getAndSuspend(httpRequest, url);
}
- else
+ else
{
result = httpAdapter->putAndSuspend(httpRequest, url, putData);
}
@@ -696,69 +696,69 @@ void LLPathfindingManager::charactersCoro(std::string url, request_id_t requestI
void LLPathfindingManager::handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
- LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID());
+ LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID());
- if (!pNavMeshStatus.isValid())
- {
- navMeshPtr->handleNavMeshError();
- }
- else
- {
- navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus);
- }
+ if (!pNavMeshStatus.isValid())
+ {
+ navMeshPtr->handleNavMeshError();
+ }
+ else
+ {
+ navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus);
+ }
}
-void LLPathfindingManager::handleAgentState(BOOL pCanRebakeRegion)
+void LLPathfindingManager::handleAgentState(BOOL pCanRebakeRegion)
{
- mAgentStateSignal(pCanRebakeRegion);
+ mAgentStateSignal(pCanRebakeRegion);
}
LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(const LLUUID &pRegionUUID)
{
- LLPathfindingNavMeshPtr navMeshPtr;
- NavMeshMap::iterator navMeshIter = mNavMeshMap.find(pRegionUUID);
- if (navMeshIter == mNavMeshMap.end())
- {
- navMeshPtr = LLPathfindingNavMeshPtr(new LLPathfindingNavMesh(pRegionUUID));
- mNavMeshMap.insert(std::pair<LLUUID, LLPathfindingNavMeshPtr>(pRegionUUID, navMeshPtr));
- }
- else
- {
- navMeshPtr = navMeshIter->second;
- }
+ LLPathfindingNavMeshPtr navMeshPtr;
+ NavMeshMap::iterator navMeshIter = mNavMeshMap.find(pRegionUUID);
+ if (navMeshIter == mNavMeshMap.end())
+ {
+ navMeshPtr = LLPathfindingNavMeshPtr(new LLPathfindingNavMesh(pRegionUUID));
+ mNavMeshMap.insert(std::pair<LLUUID, LLPathfindingNavMeshPtr>(pRegionUUID, navMeshPtr));
+ }
+ else
+ {
+ navMeshPtr = navMeshIter->second;
+ }
- return navMeshPtr;
+ return navMeshPtr;
}
LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion)
{
- LLUUID regionUUID;
- if (pRegion != NULL)
- {
- regionUUID = pRegion->getRegionID();
- }
+ LLUUID regionUUID;
+ if (pRegion != NULL)
+ {
+ regionUUID = pRegion->getRegionID();
+ }
- return getNavMeshForRegion(regionUUID);
+ return getNavMeshForRegion(regionUUID);
}
std::string LLPathfindingManager::getNavMeshStatusURLForCurrentRegion() const
{
- return getNavMeshStatusURLForRegion(getCurrentRegion());
+ return getNavMeshStatusURLForRegion(getCurrentRegion());
}
std::string LLPathfindingManager::getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const
{
- return getCapabilityURLForRegion(pRegion, CAP_SERVICE_NAVMESH_STATUS);
+ return getCapabilityURLForRegion(pRegion, CAP_SERVICE_NAVMESH_STATUS);
}
std::string LLPathfindingManager::getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const
{
- return getCapabilityURLForRegion(pRegion, CAP_SERVICE_RETRIEVE_NAVMESH);
+ return getCapabilityURLForRegion(pRegion, CAP_SERVICE_RETRIEVE_NAVMESH);
}
std::string LLPathfindingManager::getRetrieveObjectLinksetsURLForCurrentRegion() const
{
- return getCapabilityURLForCurrentRegion(CAP_SERVICE_GET_OBJECT_LINKSETS);
+ return getCapabilityURLForCurrentRegion(CAP_SERVICE_GET_OBJECT_LINKSETS);
}
std::string LLPathfindingManager::getChangeObjectLinksetsURLForCurrentRegion() const
@@ -768,45 +768,45 @@ std::string LLPathfindingManager::getChangeObjectLinksetsURLForCurrentRegion() c
std::string LLPathfindingManager::getTerrainLinksetsURLForCurrentRegion() const
{
- return getCapabilityURLForCurrentRegion(CAP_SERVICE_TERRAIN_LINKSETS);
+ return getCapabilityURLForCurrentRegion(CAP_SERVICE_TERRAIN_LINKSETS);
}
std::string LLPathfindingManager::getCharactersURLForCurrentRegion() const
{
- return getCapabilityURLForCurrentRegion(CAP_SERVICE_CHARACTERS);
+ return getCapabilityURLForCurrentRegion(CAP_SERVICE_CHARACTERS);
}
std::string LLPathfindingManager::getAgentStateURLForRegion(LLViewerRegion *pRegion) const
{
- return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE);
+ return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE);
}
std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const
{
- return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName);
+ return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName);
}
std::string LLPathfindingManager::getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const
{
- std::string capabilityURL("");
+ std::string capabilityURL("");
- if (pRegion != NULL)
- {
- capabilityURL = pRegion->getCapability(pCapabilityName);
- }
+ if (pRegion != NULL)
+ {
+ capabilityURL = pRegion->getCapability(pCapabilityName);
+ }
- if (capabilityURL.empty())
- {
- LL_WARNS() << "cannot find capability '" << pCapabilityName << "' for current region '"
- << ((pRegion != NULL) ? pRegion->getName() : "<null>") << "'" << LL_ENDL;
- }
+ if (capabilityURL.empty())
+ {
+ LL_WARNS() << "cannot find capability '" << pCapabilityName << "' for current region '"
+ << ((pRegion != NULL) ? pRegion->getName() : "<null>") << "'" << LL_ENDL;
+ }
- return capabilityURL;
+ return capabilityURL;
}
LLViewerRegion *LLPathfindingManager::getCurrentRegion() const
{
- return gAgent.getRegion();
+ return gAgent.getRegion();
}
//---------------------------------------------------------------------------
@@ -815,10 +815,10 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const
void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const
{
- llassert(pInput.has(SIM_MESSAGE_BODY_FIELD));
- llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap());
- LLPathfindingNavMeshStatus navMeshStatus(pInput.get(SIM_MESSAGE_BODY_FIELD));
- LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus);
+ llassert(pInput.has(SIM_MESSAGE_BODY_FIELD));
+ llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap());
+ LLPathfindingNavMeshStatus navMeshStatus(pInput.get(SIM_MESSAGE_BODY_FIELD));
+ LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus);
}
//---------------------------------------------------------------------------
@@ -827,25 +827,25 @@ void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pConte
void LLAgentStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const
{
- llassert(pInput.has(SIM_MESSAGE_BODY_FIELD));
- llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap());
- llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).has(AGENT_STATE_CAN_REBAKE_REGION_FIELD));
- llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).isBoolean());
- BOOL canRebakeRegion = pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).asBoolean();
-
- LLPathfindingManager::getInstance()->handleAgentState(canRebakeRegion);
+ llassert(pInput.has(SIM_MESSAGE_BODY_FIELD));
+ llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap());
+ llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).has(AGENT_STATE_CAN_REBAKE_REGION_FIELD));
+ llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).isBoolean());
+ BOOL canRebakeRegion = pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).asBoolean();
+
+ LLPathfindingManager::getInstance()->handleAgentState(canRebakeRegion);
}
//---------------------------------------------------------------------------
// LinksetsResponder
//---------------------------------------------------------------------------
LinksetsResponder::LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested)
- : mRequestId(pRequestId),
- mLinksetsCallback(pLinksetsCallback),
- mObjectMessagingState(pIsObjectRequested ? kWaiting : kNotRequested),
- mTerrainMessagingState(pIsTerrainRequested ? kWaiting : kNotRequested),
- mObjectLinksetListPtr(),
- mTerrainLinksetPtr()
+ : mRequestId(pRequestId),
+ mLinksetsCallback(pLinksetsCallback),
+ mObjectMessagingState(pIsObjectRequested ? kWaiting : kNotRequested),
+ mTerrainMessagingState(pIsTerrainRequested ? kWaiting : kNotRequested),
+ mObjectLinksetListPtr(),
+ mTerrainLinksetPtr()
{
}
@@ -855,64 +855,64 @@ LinksetsResponder::~LinksetsResponder()
void LinksetsResponder::handleObjectLinksetsResult(const LLSD &pContent)
{
- mObjectLinksetListPtr = LLPathfindingObjectListPtr(new LLPathfindingLinksetList(pContent));
+ mObjectLinksetListPtr = LLPathfindingObjectListPtr(new LLPathfindingLinksetList(pContent));
- mObjectMessagingState = kReceivedGood;
- if (mTerrainMessagingState != kWaiting)
- {
- sendCallback();
- }
+ mObjectMessagingState = kReceivedGood;
+ if (mTerrainMessagingState != kWaiting)
+ {
+ sendCallback();
+ }
}
void LinksetsResponder::handleObjectLinksetsError()
{
- LL_WARNS() << "LinksetsResponder object linksets error" << LL_ENDL;
- mObjectMessagingState = kReceivedError;
- if (mTerrainMessagingState != kWaiting)
- {
- sendCallback();
- }
+ LL_WARNS() << "LinksetsResponder object linksets error" << LL_ENDL;
+ mObjectMessagingState = kReceivedError;
+ if (mTerrainMessagingState != kWaiting)
+ {
+ sendCallback();
+ }
}
void LinksetsResponder::handleTerrainLinksetsResult(const LLSD &pContent)
{
- mTerrainLinksetPtr = LLPathfindingObjectPtr(new LLPathfindingLinkset(pContent));
+ mTerrainLinksetPtr = LLPathfindingObjectPtr(new LLPathfindingLinkset(pContent));
- mTerrainMessagingState = kReceivedGood;
- if (mObjectMessagingState != kWaiting)
- {
- sendCallback();
- }
+ mTerrainMessagingState = kReceivedGood;
+ if (mObjectMessagingState != kWaiting)
+ {
+ sendCallback();
+ }
}
void LinksetsResponder::handleTerrainLinksetsError()
{
- LL_WARNS() << "LinksetsResponder terrain linksets error" << LL_ENDL;
- mTerrainMessagingState = kReceivedError;
- if (mObjectMessagingState != kWaiting)
- {
- sendCallback();
- }
+ LL_WARNS() << "LinksetsResponder terrain linksets error" << LL_ENDL;
+ mTerrainMessagingState = kReceivedError;
+ if (mObjectMessagingState != kWaiting)
+ {
+ sendCallback();
+ }
}
void LinksetsResponder::sendCallback()
{
- llassert(mObjectMessagingState != kWaiting);
- llassert(mTerrainMessagingState != kWaiting);
- LLPathfindingManager::ERequestStatus requestStatus =
- ((((mObjectMessagingState == kReceivedGood) || (mObjectMessagingState == kNotRequested)) &&
- ((mTerrainMessagingState == kReceivedGood) || (mTerrainMessagingState == kNotRequested))) ?
- LLPathfindingManager::kRequestCompleted : LLPathfindingManager::kRequestError);
+ llassert(mObjectMessagingState != kWaiting);
+ llassert(mTerrainMessagingState != kWaiting);
+ LLPathfindingManager::ERequestStatus requestStatus =
+ ((((mObjectMessagingState == kReceivedGood) || (mObjectMessagingState == kNotRequested)) &&
+ ((mTerrainMessagingState == kReceivedGood) || (mTerrainMessagingState == kNotRequested))) ?
+ LLPathfindingManager::kRequestCompleted : LLPathfindingManager::kRequestError);
- if (mObjectMessagingState != kReceivedGood)
- {
- mObjectLinksetListPtr = LLPathfindingObjectListPtr(new LLPathfindingLinksetList());
- }
+ if (mObjectMessagingState != kReceivedGood)
+ {
+ mObjectLinksetListPtr = LLPathfindingObjectListPtr(new LLPathfindingLinksetList());
+ }
- if (mTerrainMessagingState == kReceivedGood)
- {
- mObjectLinksetListPtr->update(mTerrainLinksetPtr);
- }
+ if (mTerrainMessagingState == kReceivedGood)
+ {
+ mObjectLinksetListPtr->update(mTerrainLinksetPtr);
+ }
- mLinksetsCallback(mRequestId, requestStatus, mObjectLinksetListPtr);
+ mLinksetsCallback(mRequestId, requestStatus, mObjectLinksetListPtr);
}
diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h
index 258d0fdef7..be03b161a0 100644
--- a/indra/newview/llpathfindingmanager.h
+++ b/indra/newview/llpathfindingmanager.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingmanager.h
* @brief Header file for llpathfindingmanager
* @author Stinson@lindenlab.com
@@ -48,61 +48,61 @@ class LinksetsResponder;
class LLPathfindingManager : public LLSingleton<LLPathfindingManager>
{
- LLSINGLETON(LLPathfindingManager);
- virtual ~LLPathfindingManager();
+ LLSINGLETON(LLPathfindingManager);
+ virtual ~LLPathfindingManager();
- friend class LLNavMeshSimStateChangeNode;
- friend class NavMeshStatusResponder;
- friend class LLAgentStateChangeNode;
- friend class AgentStateResponder;
+ friend class LLNavMeshSimStateChangeNode;
+ friend class NavMeshStatusResponder;
+ friend class LLAgentStateChangeNode;
+ friend class AgentStateResponder;
public:
- typedef enum {
- kRequestStarted,
- kRequestCompleted,
- kRequestNotEnabled,
- kRequestError
- } ERequestStatus;
+ typedef enum {
+ kRequestStarted,
+ kRequestCompleted,
+ kRequestNotEnabled,
+ kRequestError
+ } ERequestStatus;
- void initSystem();
- void quitSystem();
+ void initSystem();
+ void quitSystem();
- bool isPathfindingViewEnabled() const;
- bool isPathfindingEnabledForCurrentRegion() const;
- bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const;
+ bool isPathfindingViewEnabled() const;
+ bool isPathfindingEnabledForCurrentRegion() const;
+ bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const;
- bool isAllowViewTerrainProperties() const;
+ bool isAllowViewTerrainProperties() const;
- LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback);
- void requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly);
+ LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback);
+ void requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly);
- typedef U32 request_id_t;
- typedef boost::function<void (request_id_t, ERequestStatus, LLPathfindingObjectListPtr)> object_request_callback_t;
+ typedef U32 request_id_t;
+ typedef boost::function<void (request_id_t, ERequestStatus, LLPathfindingObjectListPtr)> object_request_callback_t;
- void requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const;
- void requestSetLinksets(request_id_t pRequestId, const LLPathfindingObjectListPtr &pLinksetListPtr, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, object_request_callback_t pLinksetsCallback) const;
+ void requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const;
+ void requestSetLinksets(request_id_t pRequestId, const LLPathfindingObjectListPtr &pLinksetListPtr, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, object_request_callback_t pLinksetsCallback) const;
- void requestGetCharacters(request_id_t pRequestId, object_request_callback_t pCharactersCallback) const;
+ void requestGetCharacters(request_id_t pRequestId, object_request_callback_t pCharactersCallback) const;
- typedef boost::function<void (BOOL)> agent_state_callback_t;
- typedef boost::signals2::signal<void (BOOL)> agent_state_signal_t;
- typedef boost::signals2::connection agent_state_slot_t;
+ typedef boost::function<void (BOOL)> agent_state_callback_t;
+ typedef boost::signals2::signal<void (BOOL)> agent_state_signal_t;
+ typedef boost::signals2::connection agent_state_slot_t;
- agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback);
- void requestGetAgentState();
+ agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback);
+ void requestGetAgentState();
- typedef boost::function<void (bool)> rebake_navmesh_callback_t;
- void requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback);
+ typedef boost::function<void (bool)> rebake_navmesh_callback_t;
+ void requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback);
protected:
private:
- typedef std::map<LLUUID, LLPathfindingNavMeshPtr> NavMeshMap;
+ typedef std::map<LLUUID, LLPathfindingNavMeshPtr> NavMeshMap;
- void handleDeferredGetAgentStateForRegion(const LLUUID &pRegionUUID);
- void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly);
- void handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const;
- void handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const;
+ void handleDeferredGetAgentStateForRegion(const LLUUID &pRegionUUID);
+ void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly);
+ void handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const;
+ void handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const;
void navMeshStatusRequestCoro(std::string url, U64 regionHandle, bool isGetStatusOnly);
void navAgentStateRequestCoro(std::string url);
@@ -111,28 +111,28 @@ private:
void linksetTerrainCoro(std::string url, std::shared_ptr<LinksetsResponder> linksetsResponsderPtr, LLSD putData) const;
void charactersCoro(std::string url, request_id_t requestId, object_request_callback_t callback) const;
- //void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly);
- void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus);
+ //void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly);
+ void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus);
- void handleAgentState(BOOL pCanRebakeRegion);
+ void handleAgentState(BOOL pCanRebakeRegion);
- LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID);
- LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion);
+ LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID);
+ LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion);
- std::string getNavMeshStatusURLForCurrentRegion() const;
- std::string getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const;
- std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const;
- std::string getRetrieveObjectLinksetsURLForCurrentRegion() const;
+ std::string getNavMeshStatusURLForCurrentRegion() const;
+ std::string getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const;
+ std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const;
+ std::string getRetrieveObjectLinksetsURLForCurrentRegion() const;
std::string getChangeObjectLinksetsURLForCurrentRegion() const;
- std::string getTerrainLinksetsURLForCurrentRegion() const;
- std::string getCharactersURLForCurrentRegion() const;
- std::string getAgentStateURLForRegion(LLViewerRegion *pRegion) const;
- std::string getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const;
- std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const;
- LLViewerRegion *getCurrentRegion() const;
-
- NavMeshMap mNavMeshMap;
- agent_state_signal_t mAgentStateSignal;
+ std::string getTerrainLinksetsURLForCurrentRegion() const;
+ std::string getCharactersURLForCurrentRegion() const;
+ std::string getAgentStateURLForRegion(LLViewerRegion *pRegion) const;
+ std::string getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const;
+ std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const;
+ LLViewerRegion *getCurrentRegion() const;
+
+ NavMeshMap mNavMeshMap;
+ agent_state_signal_t mAgentStateSignal;
};
#endif // LL_LLPATHFINDINGMANAGER_H
diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp
index c297cac771..52a7383da6 100644
--- a/indra/newview/llpathfindingnavmesh.cpp
+++ b/indra/newview/llpathfindingnavmesh.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingnavmesh.cpp
* @brief Implementation of llpathfindingnavmesh
* @author Stinson@lindenlab.com
@@ -45,10 +45,10 @@
//---------------------------------------------------------------------------
LLPathfindingNavMesh::LLPathfindingNavMesh(const LLUUID &pRegionUUID)
- : mNavMeshStatus(pRegionUUID),
- mNavMeshRequestStatus(kNavMeshRequestUnknown),
- mNavMeshSignal(),
- mNavMeshData()
+ : mNavMeshStatus(pRegionUUID),
+ mNavMeshRequestStatus(kNavMeshRequestUnknown),
+ mNavMeshSignal(),
+ mNavMeshData()
{
}
@@ -59,146 +59,146 @@ LLPathfindingNavMesh::~LLPathfindingNavMesh()
LLPathfindingNavMesh::navmesh_slot_t LLPathfindingNavMesh::registerNavMeshListener(navmesh_callback_t pNavMeshCallback)
{
- return mNavMeshSignal.connect(pNavMeshCallback);
+ return mNavMeshSignal.connect(pNavMeshCallback);
}
bool LLPathfindingNavMesh::hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const
{
- return ((mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) &&
- ((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) ||
- ((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty())));
+ return ((mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) &&
+ ((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) ||
+ ((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty())));
}
void LLPathfindingNavMesh::handleNavMeshWaitForRegionLoad()
{
- setRequestStatus(kNavMeshRequestWaiting);
+ setRequestStatus(kNavMeshRequestWaiting);
}
void LLPathfindingNavMesh::handleNavMeshCheckVersion()
{
- setRequestStatus(kNavMeshRequestChecking);
+ setRequestStatus(kNavMeshRequestChecking);
}
void LLPathfindingNavMesh::handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
- llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
- llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion());
- mNavMeshStatus = pNavMeshStatus;
- if (mNavMeshRequestStatus == kNavMeshRequestChecking)
- {
- llassert(!mNavMeshData.empty());
- setRequestStatus(kNavMeshRequestCompleted);
- }
- else
- {
- sendStatus();
- }
+ llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
+ llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion());
+ mNavMeshStatus = pNavMeshStatus;
+ if (mNavMeshRequestStatus == kNavMeshRequestChecking)
+ {
+ llassert(!mNavMeshData.empty());
+ setRequestStatus(kNavMeshRequestCompleted);
+ }
+ else
+ {
+ sendStatus();
+ }
}
void LLPathfindingNavMesh::handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
- llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
- if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion())
- {
- mNavMeshStatus = pNavMeshStatus;
- sendStatus();
- }
- else
- {
- mNavMeshData.clear();
- mNavMeshStatus = pNavMeshStatus;
- setRequestStatus(kNavMeshRequestNeedsUpdate);
- }
+ llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
+ if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion())
+ {
+ mNavMeshStatus = pNavMeshStatus;
+ sendStatus();
+ }
+ else
+ {
+ mNavMeshData.clear();
+ mNavMeshStatus = pNavMeshStatus;
+ setRequestStatus(kNavMeshRequestNeedsUpdate);
+ }
}
void LLPathfindingNavMesh::handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
- llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
- mNavMeshStatus = pNavMeshStatus;
- setRequestStatus(kNavMeshRequestStarted);
+ llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
+ mNavMeshStatus = pNavMeshStatus;
+ setRequestStatus(kNavMeshRequestStarted);
}
void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion)
{
- llassert(pContent.has(NAVMESH_VERSION_FIELD));
- if (pContent.has(NAVMESH_VERSION_FIELD))
- {
- llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger());
- llassert(pContent.get(NAVMESH_VERSION_FIELD).asInteger() >= 0);
- U32 embeddedNavMeshVersion = static_cast<U32>(pContent.get(NAVMESH_VERSION_FIELD).asInteger());
- llassert(embeddedNavMeshVersion == pNavMeshVersion); // stinson 03/13/2012 : does this ever occur?
- if (embeddedNavMeshVersion != pNavMeshVersion)
- {
- LL_WARNS() << "Mismatch between expected and embedded navmesh versions occurred" << LL_ENDL;
- pNavMeshVersion = embeddedNavMeshVersion;
- }
- }
-
- if (mNavMeshStatus.getVersion() == pNavMeshVersion)
- {
- ENavMeshRequestStatus status;
- if ( pContent.has(NAVMESH_DATA_FIELD) )
- {
- const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary();
- unsigned int binSize = value.size();
- std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize);
- std::istringstream streamdecomp( newStr );
- size_t decompBinSize = 0;
- bool valid = false;
- U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ;
- if ( !valid )
- {
- LL_WARNS() << "Unable to decompress the navmesh llsd." << LL_ENDL;
- status = kNavMeshRequestError;
- }
- else
- {
- llassert(pUncompressedNavMeshContainer);
- mNavMeshData.resize( decompBinSize );
- memcpy( &mNavMeshData[0], &pUncompressedNavMeshContainer[0], decompBinSize );
- status = kNavMeshRequestCompleted;
- }
- if ( pUncompressedNavMeshContainer )
- {
- free( pUncompressedNavMeshContainer );
- }
- }
- else
- {
- LL_WARNS() << "No mesh data received" << LL_ENDL;
- status = kNavMeshRequestError;
- }
- setRequestStatus(status);
- }
+ llassert(pContent.has(NAVMESH_VERSION_FIELD));
+ if (pContent.has(NAVMESH_VERSION_FIELD))
+ {
+ llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger());
+ llassert(pContent.get(NAVMESH_VERSION_FIELD).asInteger() >= 0);
+ U32 embeddedNavMeshVersion = static_cast<U32>(pContent.get(NAVMESH_VERSION_FIELD).asInteger());
+ llassert(embeddedNavMeshVersion == pNavMeshVersion); // stinson 03/13/2012 : does this ever occur?
+ if (embeddedNavMeshVersion != pNavMeshVersion)
+ {
+ LL_WARNS() << "Mismatch between expected and embedded navmesh versions occurred" << LL_ENDL;
+ pNavMeshVersion = embeddedNavMeshVersion;
+ }
+ }
+
+ if (mNavMeshStatus.getVersion() == pNavMeshVersion)
+ {
+ ENavMeshRequestStatus status;
+ if ( pContent.has(NAVMESH_DATA_FIELD) )
+ {
+ const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary();
+ unsigned int binSize = value.size();
+ std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize);
+ std::istringstream streamdecomp( newStr );
+ size_t decompBinSize = 0;
+ bool valid = false;
+ U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ;
+ if ( !valid )
+ {
+ LL_WARNS() << "Unable to decompress the navmesh llsd." << LL_ENDL;
+ status = kNavMeshRequestError;
+ }
+ else
+ {
+ llassert(pUncompressedNavMeshContainer);
+ mNavMeshData.resize( decompBinSize );
+ memcpy( &mNavMeshData[0], &pUncompressedNavMeshContainer[0], decompBinSize );
+ status = kNavMeshRequestCompleted;
+ }
+ if ( pUncompressedNavMeshContainer )
+ {
+ free( pUncompressedNavMeshContainer );
+ }
+ }
+ else
+ {
+ LL_WARNS() << "No mesh data received" << LL_ENDL;
+ status = kNavMeshRequestError;
+ }
+ setRequestStatus(status);
+ }
}
void LLPathfindingNavMesh::handleNavMeshNotEnabled()
{
- mNavMeshData.clear();
- setRequestStatus(kNavMeshRequestNotEnabled);
+ mNavMeshData.clear();
+ setRequestStatus(kNavMeshRequestNotEnabled);
}
void LLPathfindingNavMesh::handleNavMeshError()
{
- mNavMeshData.clear();
- setRequestStatus(kNavMeshRequestError);
+ mNavMeshData.clear();
+ setRequestStatus(kNavMeshRequestError);
}
void LLPathfindingNavMesh::handleNavMeshError(U32 pNavMeshVersion)
{
- if (mNavMeshStatus.getVersion() == pNavMeshVersion)
- {
- handleNavMeshError();
- }
+ if (mNavMeshStatus.getVersion() == pNavMeshVersion)
+ {
+ handleNavMeshError();
+ }
}
void LLPathfindingNavMesh::setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus)
{
- mNavMeshRequestStatus = pNavMeshRequestStatus;
- sendStatus();
+ mNavMeshRequestStatus = pNavMeshRequestStatus;
+ sendStatus();
}
void LLPathfindingNavMesh::sendStatus()
{
- mNavMeshSignal(mNavMeshRequestStatus, mNavMeshStatus, mNavMeshData);
+ mNavMeshSignal(mNavMeshRequestStatus, mNavMeshStatus, mNavMeshData);
}
diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h
index ddc886f01c..18b6a31845 100644
--- a/indra/newview/llpathfindingnavmesh.h
+++ b/indra/newview/llpathfindingnavmesh.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingnavmesh.h
* @brief Header file for llpathfindingnavmesh
* @author Stinson@lindenlab.com
@@ -44,48 +44,48 @@ typedef std::shared_ptr<LLPathfindingNavMesh> LLPathfindingNavMeshPtr;
class LLPathfindingNavMesh
{
public:
- typedef enum {
- kNavMeshRequestUnknown,
- kNavMeshRequestWaiting,
- kNavMeshRequestChecking,
- kNavMeshRequestNeedsUpdate,
- kNavMeshRequestStarted,
- kNavMeshRequestCompleted,
- kNavMeshRequestNotEnabled,
- kNavMeshRequestError
- } ENavMeshRequestStatus;
+ typedef enum {
+ kNavMeshRequestUnknown,
+ kNavMeshRequestWaiting,
+ kNavMeshRequestChecking,
+ kNavMeshRequestNeedsUpdate,
+ kNavMeshRequestStarted,
+ kNavMeshRequestCompleted,
+ kNavMeshRequestNotEnabled,
+ kNavMeshRequestError
+ } ENavMeshRequestStatus;
- typedef boost::function<void (ENavMeshRequestStatus, const LLPathfindingNavMeshStatus &, const LLSD::Binary &)> navmesh_callback_t;
- typedef boost::signals2::signal<void (ENavMeshRequestStatus, const LLPathfindingNavMeshStatus &, const LLSD::Binary &)> navmesh_signal_t;
- typedef boost::signals2::connection navmesh_slot_t;
+ typedef boost::function<void (ENavMeshRequestStatus, const LLPathfindingNavMeshStatus &, const LLSD::Binary &)> navmesh_callback_t;
+ typedef boost::signals2::signal<void (ENavMeshRequestStatus, const LLPathfindingNavMeshStatus &, const LLSD::Binary &)> navmesh_signal_t;
+ typedef boost::signals2::connection navmesh_slot_t;
- LLPathfindingNavMesh(const LLUUID &pRegionUUID);
- virtual ~LLPathfindingNavMesh();
+ LLPathfindingNavMesh(const LLUUID &pRegionUUID);
+ virtual ~LLPathfindingNavMesh();
- navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback);
+ navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback);
- bool hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const;
+ bool hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const;
- void handleNavMeshWaitForRegionLoad();
- void handleNavMeshCheckVersion();
- void handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus);
- void handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus);
- void handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus);
- void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion);
- void handleNavMeshNotEnabled();
- void handleNavMeshError();
- void handleNavMeshError(U32 pNavMeshVersion);
+ void handleNavMeshWaitForRegionLoad();
+ void handleNavMeshCheckVersion();
+ void handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus);
+ void handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus);
+ void handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus);
+ void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion);
+ void handleNavMeshNotEnabled();
+ void handleNavMeshError();
+ void handleNavMeshError(U32 pNavMeshVersion);
protected:
private:
- void setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus);
- void sendStatus();
+ void setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus);
+ void sendStatus();
- LLPathfindingNavMeshStatus mNavMeshStatus;
- ENavMeshRequestStatus mNavMeshRequestStatus;
- navmesh_signal_t mNavMeshSignal;
- LLSD::Binary mNavMeshData;
+ LLPathfindingNavMeshStatus mNavMeshStatus;
+ ENavMeshRequestStatus mNavMeshRequestStatus;
+ navmesh_signal_t mNavMeshSignal;
+ LLSD::Binary mNavMeshData;
};
#endif // LL_LLPATHFINDINGNAVMESH_H
diff --git a/indra/newview/llpathfindingnavmeshstatus.cpp b/indra/newview/llpathfindingnavmeshstatus.cpp
index 2eaa6075ca..9cd5be4b3f 100644
--- a/indra/newview/llpathfindingnavmeshstatus.cpp
+++ b/indra/newview/llpathfindingnavmeshstatus.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingnavmeshstatus.cpp
* @brief Implementation of llpathfindingnavmeshstatus
* @author Stinson@lindenlab.com
@@ -51,48 +51,48 @@ const std::string LLPathfindingNavMeshStatus::sStatusRepending("repending");
//---------------------------------------------------------------------------
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus()
- : mIsValid(false),
- mRegionUUID(),
- mVersion(0U),
- mStatus(kComplete)
+ : mIsValid(false),
+ mRegionUUID(),
+ mVersion(0U),
+ mStatus(kComplete)
{
}
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID)
- : mIsValid(false),
- mRegionUUID(pRegionUUID),
- mVersion(0U),
- mStatus(kComplete)
+ : mIsValid(false),
+ mRegionUUID(pRegionUUID),
+ mVersion(0U),
+ mStatus(kComplete)
{
}
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent)
- : mIsValid(true),
- mRegionUUID(pRegionUUID),
- mVersion(0U),
- mStatus(kComplete)
+ : mIsValid(true),
+ mRegionUUID(pRegionUUID),
+ mVersion(0U),
+ mStatus(kComplete)
{
- parseStatus(pContent);
+ parseStatus(pContent);
}
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLSD &pContent)
- : mIsValid(true),
- mRegionUUID(),
- mVersion(0U),
- mStatus(kComplete)
+ : mIsValid(true),
+ mRegionUUID(),
+ mVersion(0U),
+ mStatus(kComplete)
{
- llassert(pContent.has(REGION_FIELD));
- llassert(pContent.get(REGION_FIELD).isUUID());
- mRegionUUID = pContent.get(REGION_FIELD).asUUID();
+ llassert(pContent.has(REGION_FIELD));
+ llassert(pContent.get(REGION_FIELD).isUUID());
+ mRegionUUID = pContent.get(REGION_FIELD).asUUID();
- parseStatus(pContent);
+ parseStatus(pContent);
}
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLPathfindingNavMeshStatus &pOther)
- : mIsValid(pOther.mIsValid),
- mRegionUUID(pOther.mRegionUUID),
- mVersion(pOther.mVersion),
- mStatus(pOther.mStatus)
+ : mIsValid(pOther.mIsValid),
+ mRegionUUID(pOther.mRegionUUID),
+ mVersion(pOther.mVersion),
+ mStatus(pOther.mStatus)
{
}
@@ -102,44 +102,44 @@ LLPathfindingNavMeshStatus::~LLPathfindingNavMeshStatus()
LLPathfindingNavMeshStatus &LLPathfindingNavMeshStatus::operator =(const LLPathfindingNavMeshStatus &pOther)
{
- mIsValid = pOther.mIsValid;
- mRegionUUID = pOther.mRegionUUID;
- mVersion = pOther.mVersion;
- mStatus = pOther.mStatus;
+ mIsValid = pOther.mIsValid;
+ mRegionUUID = pOther.mRegionUUID;
+ mVersion = pOther.mVersion;
+ mStatus = pOther.mStatus;
- return *this;
+ return *this;
}
void LLPathfindingNavMeshStatus::parseStatus(const LLSD &pContent)
{
- llassert(pContent.has(VERSION_FIELD));
- llassert(pContent.get(VERSION_FIELD).isInteger());
- llassert(pContent.get(VERSION_FIELD).asInteger() >= 0);
- mVersion = static_cast<U32>(pContent.get(VERSION_FIELD).asInteger());
-
- llassert(pContent.has(STATUS_FIELD));
- llassert(pContent.get(STATUS_FIELD).isString());
- std::string status = pContent.get(STATUS_FIELD).asString();
-
- if (LLStringUtil::compareStrings(status, sStatusPending) == 0)
- {
- mStatus = kPending;
- }
- else if (LLStringUtil::compareStrings(status, sStatusBuilding) == 0)
- {
- mStatus = kBuilding;
- }
- else if (LLStringUtil::compareStrings(status, sStatusComplete) == 0)
- {
- mStatus = kComplete;
- }
- else if (LLStringUtil::compareStrings(status, sStatusRepending) == 0)
- {
- mStatus = kRepending;
- }
- else
- {
- mStatus = kComplete;
- llassert(0);
- }
+ llassert(pContent.has(VERSION_FIELD));
+ llassert(pContent.get(VERSION_FIELD).isInteger());
+ llassert(pContent.get(VERSION_FIELD).asInteger() >= 0);
+ mVersion = static_cast<U32>(pContent.get(VERSION_FIELD).asInteger());
+
+ llassert(pContent.has(STATUS_FIELD));
+ llassert(pContent.get(STATUS_FIELD).isString());
+ std::string status = pContent.get(STATUS_FIELD).asString();
+
+ if (LLStringUtil::compareStrings(status, sStatusPending) == 0)
+ {
+ mStatus = kPending;
+ }
+ else if (LLStringUtil::compareStrings(status, sStatusBuilding) == 0)
+ {
+ mStatus = kBuilding;
+ }
+ else if (LLStringUtil::compareStrings(status, sStatusComplete) == 0)
+ {
+ mStatus = kComplete;
+ }
+ else if (LLStringUtil::compareStrings(status, sStatusRepending) == 0)
+ {
+ mStatus = kRepending;
+ }
+ else
+ {
+ mStatus = kComplete;
+ llassert(0);
+ }
}
diff --git a/indra/newview/llpathfindingnavmeshstatus.h b/indra/newview/llpathfindingnavmeshstatus.h
index 74533fa484..e429d13a3f 100644
--- a/indra/newview/llpathfindingnavmeshstatus.h
+++ b/indra/newview/llpathfindingnavmeshstatus.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingnavmeshstatus.h
* @brief Header file for llpathfindingnavmeshstatus
* @author Stinson@lindenlab.com
@@ -36,42 +36,42 @@ class LLSD;
class LLPathfindingNavMeshStatus
{
public:
- typedef enum
- {
- kPending,
- kBuilding,
- kComplete,
- kRepending
- } ENavMeshStatus;
+ typedef enum
+ {
+ kPending,
+ kBuilding,
+ kComplete,
+ kRepending
+ } ENavMeshStatus;
- LLPathfindingNavMeshStatus();
- LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID);
- LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent);
- LLPathfindingNavMeshStatus(const LLSD &pContent);
- LLPathfindingNavMeshStatus(const LLPathfindingNavMeshStatus &pOther);
- virtual ~LLPathfindingNavMeshStatus();
+ LLPathfindingNavMeshStatus();
+ LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID);
+ LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent);
+ LLPathfindingNavMeshStatus(const LLSD &pContent);
+ LLPathfindingNavMeshStatus(const LLPathfindingNavMeshStatus &pOther);
+ virtual ~LLPathfindingNavMeshStatus();
- LLPathfindingNavMeshStatus &operator =(const LLPathfindingNavMeshStatus &pOther);
+ LLPathfindingNavMeshStatus &operator =(const LLPathfindingNavMeshStatus &pOther);
- bool isValid() const {return mIsValid;};
- const LLUUID &getRegionUUID() const {return mRegionUUID;};
- U32 getVersion() const {return mVersion;};
- ENavMeshStatus getStatus() const {return mStatus;};
+ bool isValid() const {return mIsValid;};
+ const LLUUID &getRegionUUID() const {return mRegionUUID;};
+ U32 getVersion() const {return mVersion;};
+ ENavMeshStatus getStatus() const {return mStatus;};
protected:
private:
- void parseStatus(const LLSD &pContent);
+ void parseStatus(const LLSD &pContent);
- bool mIsValid;
- LLUUID mRegionUUID;
- U32 mVersion;
- ENavMeshStatus mStatus;
+ bool mIsValid;
+ LLUUID mRegionUUID;
+ U32 mVersion;
+ ENavMeshStatus mStatus;
- static const std::string sStatusPending;
- static const std::string sStatusBuilding;
- static const std::string sStatusComplete;
- static const std::string sStatusRepending;
+ static const std::string sStatusPending;
+ static const std::string sStatusBuilding;
+ static const std::string sStatusComplete;
+ static const std::string sStatusRepending;
};
#endif // LL_LLPATHFINDINGNAVMESHSTATUS_H
diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp
index e190dbba65..012cc11eee 100644
--- a/indra/newview/llpathfindingnavmeshzone.cpp
+++ b/indra/newview/llpathfindingnavmeshzone.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingnavmeshzone.cpp
* @brief Implementation of llpathfindingnavmeshzone
* @author Stinson@lindenlab.com
@@ -54,9 +54,9 @@
//---------------------------------------------------------------------------
LLPathfindingNavMeshZone::LLPathfindingNavMeshZone()
- : mNavMeshLocationPtrs(),
- mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown),
- mNavMeshZoneSignal()
+ : mNavMeshLocationPtrs(),
+ mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown),
+ mNavMeshZoneSignal()
{
}
@@ -66,228 +66,228 @@ LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone()
LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback)
{
- return mNavMeshZoneSignal.connect(pNavMeshZoneCallback);
+ return mNavMeshZoneSignal.connect(pNavMeshZoneCallback);
}
void LLPathfindingNavMeshZone::initialize()
{
- mNavMeshLocationPtrs.clear();
+ mNavMeshLocationPtrs.clear();
- NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this)));
- mNavMeshLocationPtrs.push_back(centerNavMeshPtr);
+ NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this)));
+ mNavMeshLocationPtrs.push_back(centerNavMeshPtr);
- U32 neighborRegionDir = gSavedSettings.getU32("PathfindingRetrieveNeighboringRegion");
- if (neighborRegionDir != CENTER_REGION)
- {
- NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this)));
- mNavMeshLocationPtrs.push_back(neighborNavMeshPtr);
- }
+ U32 neighborRegionDir = gSavedSettings.getU32("PathfindingRetrieveNeighboringRegion");
+ if (neighborRegionDir != CENTER_REGION)
+ {
+ NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this)));
+ mNavMeshLocationPtrs.push_back(neighborNavMeshPtr);
+ }
}
void LLPathfindingNavMeshZone::enable()
{
- for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
- navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
- {
- NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
- navMeshLocationPtr->enable();
- }
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
+ {
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ navMeshLocationPtr->enable();
+ }
}
void LLPathfindingNavMeshZone::disable()
{
- for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
- navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
- {
- NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
- navMeshLocationPtr->disable();
- }
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
+ {
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ navMeshLocationPtr->disable();
+ }
}
void LLPathfindingNavMeshZone::refresh()
{
- if (LLPathingLib::getInstance() != NULL)
- {
- LLPathingLib::getInstance()->cleanupResidual();
- }
-
- for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
- navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
- {
- NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
- navMeshLocationPtr->refresh();
- }
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->cleanupResidual();
+ }
+
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
+ {
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ navMeshLocationPtr->refresh();
+ }
}
LLPathfindingNavMeshZone::ENavMeshZoneStatus LLPathfindingNavMeshZone::getNavMeshZoneStatus() const
{
- bool hasPending = false;
- bool hasBuilding = false;
- bool hasComplete = false;
- bool hasRepending = false;
-
- for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
- navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
- {
- const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
-
- switch (navMeshLocationPtr->getNavMeshStatus())
- {
- case LLPathfindingNavMeshStatus::kPending :
- hasPending = true;
- break;
- case LLPathfindingNavMeshStatus::kBuilding :
- hasBuilding = true;
- break;
- case LLPathfindingNavMeshStatus::kComplete :
- hasComplete = true;
- break;
- case LLPathfindingNavMeshStatus::kRepending :
- hasRepending = true;
- break;
- default :
- hasPending = true;
- llassert(0);
- break;
- }
- }
-
- ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete;
- if (hasRepending || (hasPending && hasBuilding))
- {
- zoneStatus = kNavMeshZonePendingAndBuilding;
- }
- else if (hasComplete)
- {
- if (hasPending)
- {
- zoneStatus = kNavMeshZoneSomePending;
- }
- else if (hasBuilding)
- {
- zoneStatus = kNavMeshZoneSomeBuilding;
- }
- else
- {
- zoneStatus = kNavMeshZoneComplete;
- }
- }
- else if (hasPending)
- {
- zoneStatus = kNavMeshZonePending;
- }
- else if (hasBuilding)
- {
- zoneStatus = kNavMeshZoneBuilding;
- }
-
- return zoneStatus;
+ bool hasPending = false;
+ bool hasBuilding = false;
+ bool hasComplete = false;
+ bool hasRepending = false;
+
+ for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
+ {
+ const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+
+ switch (navMeshLocationPtr->getNavMeshStatus())
+ {
+ case LLPathfindingNavMeshStatus::kPending :
+ hasPending = true;
+ break;
+ case LLPathfindingNavMeshStatus::kBuilding :
+ hasBuilding = true;
+ break;
+ case LLPathfindingNavMeshStatus::kComplete :
+ hasComplete = true;
+ break;
+ case LLPathfindingNavMeshStatus::kRepending :
+ hasRepending = true;
+ break;
+ default :
+ hasPending = true;
+ llassert(0);
+ break;
+ }
+ }
+
+ ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete;
+ if (hasRepending || (hasPending && hasBuilding))
+ {
+ zoneStatus = kNavMeshZonePendingAndBuilding;
+ }
+ else if (hasComplete)
+ {
+ if (hasPending)
+ {
+ zoneStatus = kNavMeshZoneSomePending;
+ }
+ else if (hasBuilding)
+ {
+ zoneStatus = kNavMeshZoneSomeBuilding;
+ }
+ else
+ {
+ zoneStatus = kNavMeshZoneComplete;
+ }
+ }
+ else if (hasPending)
+ {
+ zoneStatus = kNavMeshZonePending;
+ }
+ else if (hasBuilding)
+ {
+ zoneStatus = kNavMeshZoneBuilding;
+ }
+
+ return zoneStatus;
}
void LLPathfindingNavMeshZone::handleNavMeshLocation()
{
- updateStatus();
+ updateStatus();
}
void LLPathfindingNavMeshZone::updateStatus()
{
- bool hasRequestUnknown = false;
- bool hasRequestWaiting = false;
- bool hasRequestChecking = false;
- bool hasRequestNeedsUpdate = false;
- bool hasRequestStarted = false;
- bool hasRequestCompleted = false;
- bool hasRequestNotEnabled = false;
- bool hasRequestError = false;
-
- for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
- navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
- {
- const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
- switch (navMeshLocationPtr->getRequestStatus())
- {
- case LLPathfindingNavMesh::kNavMeshRequestUnknown :
- hasRequestUnknown = true;
- break;
- case LLPathfindingNavMesh::kNavMeshRequestWaiting :
- hasRequestWaiting = true;
- break;
- case LLPathfindingNavMesh::kNavMeshRequestChecking :
- hasRequestChecking = true;
- break;
- case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate :
- hasRequestNeedsUpdate = true;
- break;
- case LLPathfindingNavMesh::kNavMeshRequestStarted :
- hasRequestStarted = true;
- break;
- case LLPathfindingNavMesh::kNavMeshRequestCompleted :
- hasRequestCompleted = true;
- break;
- case LLPathfindingNavMesh::kNavMeshRequestNotEnabled :
- hasRequestNotEnabled = true;
- break;
- case LLPathfindingNavMesh::kNavMeshRequestError :
- hasRequestError = true;
- break;
- default :
- hasRequestError = true;
- llassert(0);
- break;
- }
- }
-
- ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown;
- if (hasRequestWaiting)
- {
- zoneRequestStatus = kNavMeshZoneRequestWaiting;
- }
- else if (hasRequestNeedsUpdate)
- {
- zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate;
- }
- else if (hasRequestChecking)
- {
- zoneRequestStatus = kNavMeshZoneRequestChecking;
- }
- else if (hasRequestStarted)
- {
- zoneRequestStatus = kNavMeshZoneRequestStarted;
- }
- else if (hasRequestError)
- {
- zoneRequestStatus = kNavMeshZoneRequestError;
- }
- else if (hasRequestUnknown)
- {
- zoneRequestStatus = kNavMeshZoneRequestUnknown;
- }
- else if (hasRequestCompleted)
- {
- zoneRequestStatus = kNavMeshZoneRequestCompleted;
- }
- else if (hasRequestNotEnabled)
- {
- zoneRequestStatus = kNavMeshZoneRequestNotEnabled;
- }
- else
- {
- zoneRequestStatus = kNavMeshZoneRequestError;
- llassert(0);
- }
-
- if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) &&
- (zoneRequestStatus == kNavMeshZoneRequestCompleted))
- {
- llassert(LLPathingLib::getInstance() != NULL);
- if (LLPathingLib::getInstance() != NULL)
- {
- LLPathingLib::getInstance()->processNavMeshData();
- }
- }
-
- mNavMeshZoneRequestStatus = zoneRequestStatus;
- mNavMeshZoneSignal(mNavMeshZoneRequestStatus);
+ bool hasRequestUnknown = false;
+ bool hasRequestWaiting = false;
+ bool hasRequestChecking = false;
+ bool hasRequestNeedsUpdate = false;
+ bool hasRequestStarted = false;
+ bool hasRequestCompleted = false;
+ bool hasRequestNotEnabled = false;
+ bool hasRequestError = false;
+
+ for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
+ {
+ const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ switch (navMeshLocationPtr->getRequestStatus())
+ {
+ case LLPathfindingNavMesh::kNavMeshRequestUnknown :
+ hasRequestUnknown = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestWaiting :
+ hasRequestWaiting = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestChecking :
+ hasRequestChecking = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate :
+ hasRequestNeedsUpdate = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestStarted :
+ hasRequestStarted = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestCompleted :
+ hasRequestCompleted = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestNotEnabled :
+ hasRequestNotEnabled = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestError :
+ hasRequestError = true;
+ break;
+ default :
+ hasRequestError = true;
+ llassert(0);
+ break;
+ }
+ }
+
+ ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown;
+ if (hasRequestWaiting)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestWaiting;
+ }
+ else if (hasRequestNeedsUpdate)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate;
+ }
+ else if (hasRequestChecking)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestChecking;
+ }
+ else if (hasRequestStarted)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestStarted;
+ }
+ else if (hasRequestError)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestError;
+ }
+ else if (hasRequestUnknown)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestUnknown;
+ }
+ else if (hasRequestCompleted)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestCompleted;
+ }
+ else if (hasRequestNotEnabled)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestNotEnabled;
+ }
+ else
+ {
+ zoneRequestStatus = kNavMeshZoneRequestError;
+ llassert(0);
+ }
+
+ if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) &&
+ (zoneRequestStatus == kNavMeshZoneRequestCompleted))
+ {
+ llassert(LLPathingLib::getInstance() != NULL);
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->processNavMeshData();
+ }
+ }
+
+ mNavMeshZoneRequestStatus = zoneRequestStatus;
+ mNavMeshZoneSignal(mNavMeshZoneRequestStatus);
}
//---------------------------------------------------------------------------
@@ -295,14 +295,14 @@ void LLPathfindingNavMeshZone::updateStatus()
//---------------------------------------------------------------------------
LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback)
- : mDirection(pDirection),
- mRegionUUID(),
- mHasNavMesh(false),
- mNavMeshVersion(0U),
- mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete),
- mLocationCallback(pLocationCallback),
- mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown),
- mNavMeshSlot()
+ : mDirection(pDirection),
+ mRegionUUID(),
+ mHasNavMesh(false),
+ mNavMeshVersion(0U),
+ mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete),
+ mLocationCallback(pLocationCallback),
+ mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown),
+ mNavMeshSlot()
{
}
@@ -312,112 +312,112 @@ LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation()
void LLPathfindingNavMeshZone::NavMeshLocation::enable()
{
- clear();
-
- LLViewerRegion *region = getRegion();
- if (region == NULL)
- {
- mRegionUUID.setNull();
- }
- else
- {
- mRegionUUID = region->getRegionID();
- mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3));
- }
+ clear();
+
+ LLViewerRegion *region = getRegion();
+ if (region == NULL)
+ {
+ mRegionUUID.setNull();
+ }
+ else
+ {
+ mRegionUUID = region->getRegionID();
+ mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3));
+ }
}
void LLPathfindingNavMeshZone::NavMeshLocation::refresh()
{
- LLViewerRegion *region = getRegion();
-
- if (region == NULL)
- {
- llassert(mRegionUUID.isNull());
- LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID);
- LLSD::Binary nullData;
- handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData);
- }
- else
- {
- llassert(mRegionUUID == region->getRegionID());
- LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region, false);
- }
+ LLViewerRegion *region = getRegion();
+
+ if (region == NULL)
+ {
+ llassert(mRegionUUID.isNull());
+ LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID);
+ LLSD::Binary nullData;
+ handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData);
+ }
+ else
+ {
+ llassert(mRegionUUID == region->getRegionID());
+ LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region, false);
+ }
}
void LLPathfindingNavMeshZone::NavMeshLocation::disable()
{
- clear();
+ clear();
}
LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const
{
- return mRequestStatus;
+ return mRequestStatus;
}
LLPathfindingNavMeshStatus::ENavMeshStatus LLPathfindingNavMeshZone::NavMeshLocation::getNavMeshStatus() const
{
- return mNavMeshStatus;
+ return mNavMeshStatus;
}
void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData)
{
- llassert(mRegionUUID == pNavMeshStatus.getRegionUUID());
-
- if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) &&
- (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion())))
- {
- llassert(!pNavMeshData.empty());
- mHasNavMesh = true;
- mNavMeshVersion = pNavMeshStatus.getVersion();
- llassert(LLPathingLib::getInstance() != NULL);
- if (LLPathingLib::getInstance() != NULL)
- {
- LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection);
- }
- }
-
- mRequestStatus = pNavMeshRequestStatus;
- mNavMeshStatus = pNavMeshStatus.getStatus();
- mLocationCallback();
+ llassert(mRegionUUID == pNavMeshStatus.getRegionUUID());
+
+ if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) &&
+ (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion())))
+ {
+ llassert(!pNavMeshData.empty());
+ mHasNavMesh = true;
+ mNavMeshVersion = pNavMeshStatus.getVersion();
+ llassert(LLPathingLib::getInstance() != NULL);
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection);
+ }
+ }
+
+ mRequestStatus = pNavMeshRequestStatus;
+ mNavMeshStatus = pNavMeshStatus.getStatus();
+ mLocationCallback();
}
void LLPathfindingNavMeshZone::NavMeshLocation::clear()
{
- mHasNavMesh = false;
- mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown;
- mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete;
- if (mNavMeshSlot.connected())
- {
- mNavMeshSlot.disconnect();
- }
+ mHasNavMesh = false;
+ mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown;
+ mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete;
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
}
LLViewerRegion *LLPathfindingNavMeshZone::NavMeshLocation::getRegion() const
{
- LLViewerRegion *region = NULL;
-
- LLViewerRegion *currentRegion = gAgent.getRegion();
- if (currentRegion != NULL)
- {
- if (mDirection == CENTER_REGION)
- {
- region = currentRegion;
- }
- else
- {
- //User wants to pull in a neighboring region
- std::vector<S32> availableRegions;
- currentRegion->getNeighboringRegionsStatus( availableRegions );
- //Is the desired region in the available list
- std::vector<S32>::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection);
- if ( foundElem != availableRegions.end() )
- {
- std::vector<LLViewerRegion*> neighborRegionsPtrs;
- currentRegion->getNeighboringRegions( neighborRegionsPtrs );
- region = neighborRegionsPtrs[foundElem - availableRegions.begin()];
- }
- }
- }
-
- return region;
+ LLViewerRegion *region = NULL;
+
+ LLViewerRegion *currentRegion = gAgent.getRegion();
+ if (currentRegion != NULL)
+ {
+ if (mDirection == CENTER_REGION)
+ {
+ region = currentRegion;
+ }
+ else
+ {
+ //User wants to pull in a neighboring region
+ std::vector<S32> availableRegions;
+ currentRegion->getNeighboringRegionsStatus( availableRegions );
+ //Is the desired region in the available list
+ std::vector<S32>::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection);
+ if ( foundElem != availableRegions.end() )
+ {
+ std::vector<LLViewerRegion*> neighborRegionsPtrs;
+ currentRegion->getNeighboringRegions( neighborRegionsPtrs );
+ region = neighborRegionsPtrs[foundElem - availableRegions.begin()];
+ }
+ }
+ }
+
+ return region;
}
diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h
index b76f4421a6..a2c8691391 100644
--- a/indra/newview/llpathfindingnavmeshzone.h
+++ b/indra/newview/llpathfindingnavmeshzone.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingnavmeshzone.h
* @brief Header file for llpathfindingnavmeshzone
* @author Stinson@lindenlab.com
@@ -43,86 +43,86 @@ class LLViewerRegion;
class LLPathfindingNavMeshZone
{
public:
- typedef enum {
- kNavMeshZoneRequestUnknown,
- kNavMeshZoneRequestWaiting,
- kNavMeshZoneRequestChecking,
- kNavMeshZoneRequestNeedsUpdate,
- kNavMeshZoneRequestStarted,
- kNavMeshZoneRequestCompleted,
- kNavMeshZoneRequestNotEnabled,
- kNavMeshZoneRequestError
- } ENavMeshZoneRequestStatus;
-
- typedef enum {
- kNavMeshZonePending,
- kNavMeshZoneBuilding,
- kNavMeshZoneSomePending,
- kNavMeshZoneSomeBuilding,
- kNavMeshZonePendingAndBuilding,
- kNavMeshZoneComplete
- } ENavMeshZoneStatus;
-
- typedef boost::function<void (ENavMeshZoneRequestStatus)> navmesh_zone_callback_t;
- typedef boost::signals2::signal<void (ENavMeshZoneRequestStatus)> navmesh_zone_signal_t;
- typedef boost::signals2::connection navmesh_zone_slot_t;
-
- LLPathfindingNavMeshZone();
- virtual ~LLPathfindingNavMeshZone();
-
- navmesh_zone_slot_t registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback);
- void initialize();
-
- void enable();
- void disable();
- void refresh();
-
- ENavMeshZoneStatus getNavMeshZoneStatus() const;
+ typedef enum {
+ kNavMeshZoneRequestUnknown,
+ kNavMeshZoneRequestWaiting,
+ kNavMeshZoneRequestChecking,
+ kNavMeshZoneRequestNeedsUpdate,
+ kNavMeshZoneRequestStarted,
+ kNavMeshZoneRequestCompleted,
+ kNavMeshZoneRequestNotEnabled,
+ kNavMeshZoneRequestError
+ } ENavMeshZoneRequestStatus;
+
+ typedef enum {
+ kNavMeshZonePending,
+ kNavMeshZoneBuilding,
+ kNavMeshZoneSomePending,
+ kNavMeshZoneSomeBuilding,
+ kNavMeshZonePendingAndBuilding,
+ kNavMeshZoneComplete
+ } ENavMeshZoneStatus;
+
+ typedef boost::function<void (ENavMeshZoneRequestStatus)> navmesh_zone_callback_t;
+ typedef boost::signals2::signal<void (ENavMeshZoneRequestStatus)> navmesh_zone_signal_t;
+ typedef boost::signals2::connection navmesh_zone_slot_t;
+
+ LLPathfindingNavMeshZone();
+ virtual ~LLPathfindingNavMeshZone();
+
+ navmesh_zone_slot_t registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback);
+ void initialize();
+
+ void enable();
+ void disable();
+ void refresh();
+
+ ENavMeshZoneStatus getNavMeshZoneStatus() const;
protected:
private:
- typedef boost::function<void (void)> navmesh_location_callback_t;
- class NavMeshLocation
- {
- public:
- NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback);
- virtual ~NavMeshLocation();
-
- void enable();
- void refresh();
- void disable();
-
- LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const;
- LLPathfindingNavMeshStatus::ENavMeshStatus getNavMeshStatus() const;
-
- protected:
-
- private:
- void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData);
-
- void clear();
- LLViewerRegion *getRegion() const;
-
- S32 mDirection;
- LLUUID mRegionUUID;
- bool mHasNavMesh;
- U32 mNavMeshVersion;
- LLPathfindingNavMeshStatus::ENavMeshStatus mNavMeshStatus;
- navmesh_location_callback_t mLocationCallback;
- LLPathfindingNavMesh::ENavMeshRequestStatus mRequestStatus;
- LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
- };
-
- typedef std::shared_ptr<NavMeshLocation> NavMeshLocationPtr;
- typedef std::vector<NavMeshLocationPtr> NavMeshLocationPtrs;
-
- void handleNavMeshLocation();
- void updateStatus();
-
- NavMeshLocationPtrs mNavMeshLocationPtrs;
- ENavMeshZoneRequestStatus mNavMeshZoneRequestStatus;
- navmesh_zone_signal_t mNavMeshZoneSignal;
+ typedef boost::function<void (void)> navmesh_location_callback_t;
+ class NavMeshLocation
+ {
+ public:
+ NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback);
+ virtual ~NavMeshLocation();
+
+ void enable();
+ void refresh();
+ void disable();
+
+ LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const;
+ LLPathfindingNavMeshStatus::ENavMeshStatus getNavMeshStatus() const;
+
+ protected:
+
+ private:
+ void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData);
+
+ void clear();
+ LLViewerRegion *getRegion() const;
+
+ S32 mDirection;
+ LLUUID mRegionUUID;
+ bool mHasNavMesh;
+ U32 mNavMeshVersion;
+ LLPathfindingNavMeshStatus::ENavMeshStatus mNavMeshStatus;
+ navmesh_location_callback_t mLocationCallback;
+ LLPathfindingNavMesh::ENavMeshRequestStatus mRequestStatus;
+ LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
+ };
+
+ typedef std::shared_ptr<NavMeshLocation> NavMeshLocationPtr;
+ typedef std::vector<NavMeshLocationPtr> NavMeshLocationPtrs;
+
+ void handleNavMeshLocation();
+ void updateStatus();
+
+ NavMeshLocationPtrs mNavMeshLocationPtrs;
+ ENavMeshZoneRequestStatus mNavMeshZoneRequestStatus;
+ navmesh_zone_signal_t mNavMeshZoneSignal;
};
#endif // LL_LLPATHFINDINGNAVMESHZONE_H
diff --git a/indra/newview/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp
index 900763eae4..b9038254e7 100644
--- a/indra/newview/llpathfindingobject.cpp
+++ b/indra/newview/llpathfindingobject.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingobject.cpp
* @brief Implementation of llpathfindingobject
* @author Stinson@lindenlab.com
@@ -49,152 +49,152 @@
//---------------------------------------------------------------------------
LLPathfindingObject::LLPathfindingObject()
- : mUUID(),
- mName(),
- mDescription(),
- mOwnerUUID(),
- mHasOwnerName(false),
- mOwnerName(),
- mAvatarNameCacheConnection(),
- mIsGroupOwned(false),
- mLocation(),
- mOwnerNameSignal()
+ : mUUID(),
+ mName(),
+ mDescription(),
+ mOwnerUUID(),
+ mHasOwnerName(false),
+ mOwnerName(),
+ mAvatarNameCacheConnection(),
+ mIsGroupOwned(false),
+ mLocation(),
+ mOwnerNameSignal()
{
}
LLPathfindingObject::LLPathfindingObject(const std::string &pUUID, const LLSD &pObjectData)
- : mUUID(pUUID),
- mName(),
- mDescription(),
- mOwnerUUID(),
- mHasOwnerName(false),
- mOwnerName(),
- mAvatarNameCacheConnection(),
- mIsGroupOwned(false),
- mLocation(),
- mOwnerNameSignal()
+ : mUUID(pUUID),
+ mName(),
+ mDescription(),
+ mOwnerUUID(),
+ mHasOwnerName(false),
+ mOwnerName(),
+ mAvatarNameCacheConnection(),
+ mIsGroupOwned(false),
+ mLocation(),
+ mOwnerNameSignal()
{
- parseObjectData(pObjectData);
+ parseObjectData(pObjectData);
}
LLPathfindingObject::LLPathfindingObject(const LLPathfindingObject& pOther)
- : mUUID(pOther.mUUID),
- mName(pOther.mName),
- mDescription(pOther.mDescription),
- mOwnerUUID(pOther.mOwnerUUID),
- mHasOwnerName(false),
- mOwnerName(),
- mAvatarNameCacheConnection(),
- mIsGroupOwned(pOther.mIsGroupOwned),
- mLocation(pOther.mLocation),
- mOwnerNameSignal()
+ : mUUID(pOther.mUUID),
+ mName(pOther.mName),
+ mDescription(pOther.mDescription),
+ mOwnerUUID(pOther.mOwnerUUID),
+ mHasOwnerName(false),
+ mOwnerName(),
+ mAvatarNameCacheConnection(),
+ mIsGroupOwned(pOther.mIsGroupOwned),
+ mLocation(pOther.mLocation),
+ mOwnerNameSignal()
{
- fetchOwnerName();
+ fetchOwnerName();
}
LLPathfindingObject::~LLPathfindingObject()
{
- disconnectAvatarNameCacheConnection();
+ disconnectAvatarNameCacheConnection();
}
LLPathfindingObject &LLPathfindingObject::operator =(const LLPathfindingObject& pOther)
{
- mUUID = pOther.mUUID;
- mName = pOther.mName;
- mDescription = pOther.mDescription;
- mOwnerUUID = pOther.mOwnerUUID;
- fetchOwnerName();
- mIsGroupOwned = pOther.mIsGroupOwned;
- mLocation = pOther.mLocation;
-
- return *this;
+ mUUID = pOther.mUUID;
+ mName = pOther.mName;
+ mDescription = pOther.mDescription;
+ mOwnerUUID = pOther.mOwnerUUID;
+ fetchOwnerName();
+ mIsGroupOwned = pOther.mIsGroupOwned;
+ mLocation = pOther.mLocation;
+
+ return *this;
}
std::string LLPathfindingObject::getOwnerName() const
{
- std::string ownerName;
+ std::string ownerName;
- if (hasOwner())
- {
- ownerName = mOwnerName.getCompleteName();
- }
+ if (hasOwner())
+ {
+ ownerName = mOwnerName.getCompleteName();
+ }
- return ownerName;
+ return ownerName;
}
LLPathfindingObject::name_connection_t LLPathfindingObject::registerOwnerNameListener(name_callback_t pOwnerNameCallback)
{
- llassert(hasOwner());
-
- name_connection_t connection;
- if (hasOwnerName())
- {
- pOwnerNameCallback(this);
- }
- else
- {
- connection = mOwnerNameSignal.connect(pOwnerNameCallback);
- }
-
- return connection;
+ llassert(hasOwner());
+
+ name_connection_t connection;
+ if (hasOwnerName())
+ {
+ pOwnerNameCallback(this);
+ }
+ else
+ {
+ connection = mOwnerNameSignal.connect(pOwnerNameCallback);
+ }
+
+ return connection;
}
void LLPathfindingObject::parseObjectData(const LLSD &pObjectData)
{
- llassert(pObjectData.has(PATHFINDING_OBJECT_NAME_FIELD));
- llassert(pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).isString());
- mName = pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).asString();
-
- llassert(pObjectData.has(PATHFINDING_OBJECT_DESCRIPTION_FIELD));
- llassert(pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).isString());
- mDescription = pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).asString();
-
- llassert(pObjectData.has(PATHFINDING_OBJECT_OWNER_FIELD));
- llassert(pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).isUUID());
- mOwnerUUID = pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).asUUID();
- fetchOwnerName();
-
- if (pObjectData.has(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD))
- {
- llassert(pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).isBoolean());
- mIsGroupOwned = pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).asBoolean();
- }
-
- llassert(pObjectData.has(PATHFINDING_OBJECT_POSITION_FIELD));
- llassert(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD).isArray());
- mLocation.setValue(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD));
+ llassert(pObjectData.has(PATHFINDING_OBJECT_NAME_FIELD));
+ llassert(pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).isString());
+ mName = pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).asString();
+
+ llassert(pObjectData.has(PATHFINDING_OBJECT_DESCRIPTION_FIELD));
+ llassert(pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).isString());
+ mDescription = pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).asString();
+
+ llassert(pObjectData.has(PATHFINDING_OBJECT_OWNER_FIELD));
+ llassert(pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).isUUID());
+ mOwnerUUID = pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).asUUID();
+ fetchOwnerName();
+
+ if (pObjectData.has(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD))
+ {
+ llassert(pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).isBoolean());
+ mIsGroupOwned = pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).asBoolean();
+ }
+
+ llassert(pObjectData.has(PATHFINDING_OBJECT_POSITION_FIELD));
+ llassert(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD).isArray());
+ mLocation.setValue(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD));
}
void LLPathfindingObject::fetchOwnerName()
{
- mHasOwnerName = false;
- if (hasOwner())
- {
- mHasOwnerName = LLAvatarNameCache::get(mOwnerUUID, &mOwnerName);
- if (!mHasOwnerName)
- {
- disconnectAvatarNameCacheConnection();
- mAvatarNameCacheConnection = LLAvatarNameCache::get(mOwnerUUID, boost::bind(&LLPathfindingObject::handleAvatarNameFetch, this, _1, _2));
- }
- }
+ mHasOwnerName = false;
+ if (hasOwner())
+ {
+ mHasOwnerName = LLAvatarNameCache::get(mOwnerUUID, &mOwnerName);
+ if (!mHasOwnerName)
+ {
+ disconnectAvatarNameCacheConnection();
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(mOwnerUUID, boost::bind(&LLPathfindingObject::handleAvatarNameFetch, this, _1, _2));
+ }
+ }
}
void LLPathfindingObject::handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName)
{
- llassert(mOwnerUUID == pOwnerUUID);
+ llassert(mOwnerUUID == pOwnerUUID);
- mOwnerName = pAvatarName;
- mHasOwnerName = true;
+ mOwnerName = pAvatarName;
+ mHasOwnerName = true;
- disconnectAvatarNameCacheConnection();
+ disconnectAvatarNameCacheConnection();
- mOwnerNameSignal(this);
+ mOwnerNameSignal(this);
}
void LLPathfindingObject::disconnectAvatarNameCacheConnection()
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
}
diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h
index 0114cce3f1..2561e8d66f 100644
--- a/indra/newview/llpathfindingobject.h
+++ b/indra/newview/llpathfindingobject.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingobject.h
* @brief Header file for llpathfindingobject
* @author Stinson@lindenlab.com
@@ -46,47 +46,47 @@ typedef std::shared_ptr<LLPathfindingObject> LLPathfindingObjectPtr;
class LLPathfindingObject
{
public:
- LLPathfindingObject();
- LLPathfindingObject(const std::string &pUUID, const LLSD &pObjectData);
- LLPathfindingObject(const LLPathfindingObject& pOther);
- virtual ~LLPathfindingObject();
+ LLPathfindingObject();
+ LLPathfindingObject(const std::string &pUUID, const LLSD &pObjectData);
+ LLPathfindingObject(const LLPathfindingObject& pOther);
+ virtual ~LLPathfindingObject();
- LLPathfindingObject& operator =(const LLPathfindingObject& pOther);
+ LLPathfindingObject& operator =(const LLPathfindingObject& pOther);
- inline const LLUUID& getUUID() const {return mUUID;};
- inline const std::string& getName() const {return mName;};
- inline const std::string& getDescription() const {return mDescription;};
- inline BOOL hasOwner() const {return mOwnerUUID.notNull();};
- inline bool hasOwnerName() const {return mHasOwnerName;};
- std::string getOwnerName() const;
- inline BOOL isGroupOwned() const {return mIsGroupOwned;};
- inline const LLVector3& getLocation() const {return mLocation;};
+ inline const LLUUID& getUUID() const {return mUUID;};
+ inline const std::string& getName() const {return mName;};
+ inline const std::string& getDescription() const {return mDescription;};
+ inline BOOL hasOwner() const {return mOwnerUUID.notNull();};
+ inline bool hasOwnerName() const {return mHasOwnerName;};
+ std::string getOwnerName() const;
+ inline BOOL isGroupOwned() const {return mIsGroupOwned;};
+ inline const LLVector3& getLocation() const {return mLocation;};
- typedef boost::function<void (const LLPathfindingObject *)> name_callback_t;
- typedef boost::signals2::signal<void (const LLPathfindingObject *)> name_signal_t;
- typedef boost::signals2::connection name_connection_t;
+ typedef boost::function<void (const LLPathfindingObject *)> name_callback_t;
+ typedef boost::signals2::signal<void (const LLPathfindingObject *)> name_signal_t;
+ typedef boost::signals2::connection name_connection_t;
- name_connection_t registerOwnerNameListener(name_callback_t pOwnerNameCallback);
+ name_connection_t registerOwnerNameListener(name_callback_t pOwnerNameCallback);
protected:
private:
- void parseObjectData(const LLSD &pObjectData);
+ void parseObjectData(const LLSD &pObjectData);
- void fetchOwnerName();
- void handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName);
- void disconnectAvatarNameCacheConnection();
+ void fetchOwnerName();
+ void handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName);
+ void disconnectAvatarNameCacheConnection();
- LLUUID mUUID;
- std::string mName;
- std::string mDescription;
- LLUUID mOwnerUUID;
- bool mHasOwnerName;
- LLAvatarName mOwnerName;
- LLAvatarNameCache::callback_connection_t mAvatarNameCacheConnection;
- BOOL mIsGroupOwned;
- LLVector3 mLocation;
- name_signal_t mOwnerNameSignal;
+ LLUUID mUUID;
+ std::string mName;
+ std::string mDescription;
+ LLUUID mOwnerUUID;
+ bool mHasOwnerName;
+ LLAvatarName mOwnerName;
+ LLAvatarNameCache::callback_connection_t mAvatarNameCacheConnection;
+ BOOL mIsGroupOwned;
+ LLVector3 mLocation;
+ name_signal_t mOwnerNameSignal;
};
#endif // LL_LLPATHFINDINGOBJECT_H
diff --git a/indra/newview/llpathfindingobjectlist.cpp b/indra/newview/llpathfindingobjectlist.cpp
index f1ecb45fc0..0ea782649c 100644
--- a/indra/newview/llpathfindingobjectlist.cpp
+++ b/indra/newview/llpathfindingobjectlist.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingobjectlist.cpp
* @brief Implementation of llpathfindingobjectlist
* @author Stinson@lindenlab.com
@@ -39,84 +39,84 @@
//---------------------------------------------------------------------------
LLPathfindingObjectList::LLPathfindingObjectList()
- : mObjectMap()
+ : mObjectMap()
{
}
LLPathfindingObjectList::~LLPathfindingObjectList()
{
- clear();
+ clear();
}
bool LLPathfindingObjectList::isEmpty() const
{
- return mObjectMap.empty();
+ return mObjectMap.empty();
}
void LLPathfindingObjectList::clear()
{
- for (LLPathfindingObjectMap::iterator objectIter = mObjectMap.begin(); objectIter != mObjectMap.end(); ++objectIter)
- {
- objectIter->second.reset();
- }
- mObjectMap.clear();
+ for (LLPathfindingObjectMap::iterator objectIter = mObjectMap.begin(); objectIter != mObjectMap.end(); ++objectIter)
+ {
+ objectIter->second.reset();
+ }
+ mObjectMap.clear();
}
void LLPathfindingObjectList::update(LLPathfindingObjectPtr pUpdateObjectPtr)
{
- if (pUpdateObjectPtr != NULL)
- {
- std::string updateObjectId = pUpdateObjectPtr->getUUID().asString();
-
- LLPathfindingObjectMap::iterator foundObjectIter = mObjectMap.find(updateObjectId);
- if (foundObjectIter == mObjectMap.end())
- {
- mObjectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(updateObjectId, pUpdateObjectPtr));
- }
- else
- {
- foundObjectIter->second = pUpdateObjectPtr;
- }
- }
+ if (pUpdateObjectPtr != NULL)
+ {
+ std::string updateObjectId = pUpdateObjectPtr->getUUID().asString();
+
+ LLPathfindingObjectMap::iterator foundObjectIter = mObjectMap.find(updateObjectId);
+ if (foundObjectIter == mObjectMap.end())
+ {
+ mObjectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(updateObjectId, pUpdateObjectPtr));
+ }
+ else
+ {
+ foundObjectIter->second = pUpdateObjectPtr;
+ }
+ }
}
void LLPathfindingObjectList::update(LLPathfindingObjectListPtr pUpdateObjectListPtr)
{
- if ((pUpdateObjectListPtr != NULL) && !pUpdateObjectListPtr->isEmpty())
- {
- for (LLPathfindingObjectMap::const_iterator updateObjectIter = pUpdateObjectListPtr->begin();
- updateObjectIter != pUpdateObjectListPtr->end(); ++updateObjectIter)
- {
- const LLPathfindingObjectPtr updateObjectPtr = updateObjectIter->second;
- update(updateObjectPtr);
- }
- }
+ if ((pUpdateObjectListPtr != NULL) && !pUpdateObjectListPtr->isEmpty())
+ {
+ for (LLPathfindingObjectMap::const_iterator updateObjectIter = pUpdateObjectListPtr->begin();
+ updateObjectIter != pUpdateObjectListPtr->end(); ++updateObjectIter)
+ {
+ const LLPathfindingObjectPtr updateObjectPtr = updateObjectIter->second;
+ update(updateObjectPtr);
+ }
+ }
}
LLPathfindingObjectPtr LLPathfindingObjectList::find(const std::string &pObjectId) const
{
- LLPathfindingObjectPtr objectPtr;
+ LLPathfindingObjectPtr objectPtr;
- LLPathfindingObjectMap::const_iterator objectIter = mObjectMap.find(pObjectId);
- if (objectIter != mObjectMap.end())
- {
- objectPtr = objectIter->second;
- }
+ LLPathfindingObjectMap::const_iterator objectIter = mObjectMap.find(pObjectId);
+ if (objectIter != mObjectMap.end())
+ {
+ objectPtr = objectIter->second;
+ }
- return objectPtr;
+ return objectPtr;
}
LLPathfindingObjectList::const_iterator LLPathfindingObjectList::begin() const
{
- return mObjectMap.begin();
+ return mObjectMap.begin();
}
LLPathfindingObjectList::const_iterator LLPathfindingObjectList::end() const
{
- return mObjectMap.end();
+ return mObjectMap.end();
}
LLPathfindingObjectMap &LLPathfindingObjectList::getObjectMap()
{
- return mObjectMap;
+ return mObjectMap;
}
diff --git a/indra/newview/llpathfindingobjectlist.h b/indra/newview/llpathfindingobjectlist.h
index e2e0dce4da..654423183e 100644
--- a/indra/newview/llpathfindingobjectlist.h
+++ b/indra/newview/llpathfindingobjectlist.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingobjectlist.h
* @brief Header file for llpathfindingobjectlist
* @author Stinson@lindenlab.com
@@ -42,27 +42,27 @@ typedef std::map<std::string, LLPathfindingObjectPtr> LLPathfindingObjectMap;
class LLPathfindingObjectList
{
public:
- LLPathfindingObjectList();
- virtual ~LLPathfindingObjectList();
+ LLPathfindingObjectList();
+ virtual ~LLPathfindingObjectList();
- bool isEmpty() const;
+ bool isEmpty() const;
- void clear();
+ void clear();
- void update(LLPathfindingObjectPtr pUpdateObjectPtr);
- void update(LLPathfindingObjectListPtr pUpdateObjectListPtr);
+ void update(LLPathfindingObjectPtr pUpdateObjectPtr);
+ void update(LLPathfindingObjectListPtr pUpdateObjectListPtr);
- LLPathfindingObjectPtr find(const std::string &pObjectId) const;
+ LLPathfindingObjectPtr find(const std::string &pObjectId) const;
- typedef LLPathfindingObjectMap::const_iterator const_iterator;
- const_iterator begin() const;
- const_iterator end() const;
+ typedef LLPathfindingObjectMap::const_iterator const_iterator;
+ const_iterator begin() const;
+ const_iterator end() const;
protected:
- LLPathfindingObjectMap &getObjectMap();
+ LLPathfindingObjectMap &getObjectMap();
private:
- LLPathfindingObjectMap mObjectMap;
+ LLPathfindingObjectMap mObjectMap;
};
#endif // LL_LLPATHFINDINGOBJECTLIST_H
diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp
index 3187325101..a57283d5cd 100644
--- a/indra/newview/llpathfindingpathtool.cpp
+++ b/indra/newview/llpathfindingpathtool.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingpathtool.cpp
* @brief Implementation of llpathfindingpathtool
* @author Stinson@lindenlab.com
@@ -45,18 +45,18 @@
#define PATH_TOOL_NAME "PathfindingPathTool"
LLPathfindingPathTool::LLPathfindingPathTool()
- : LLTool(PATH_TOOL_NAME),
- mFinalPathData(),
- mTempPathData(),
- mPathResult(LLPathingLib::LLPL_NO_PATH),
- mCharacterType(kCharacterTypeNone),
- mPathEventSignal(),
- mIsLeftMouseButtonHeld(false),
- mIsMiddleMouseButtonHeld(false),
- mIsRightMouseButtonHeld(false)
+ : LLTool(PATH_TOOL_NAME),
+ mFinalPathData(),
+ mTempPathData(),
+ mPathResult(LLPathingLib::LLPL_NO_PATH),
+ mCharacterType(kCharacterTypeNone),
+ mPathEventSignal(),
+ mIsLeftMouseButtonHeld(false),
+ mIsMiddleMouseButtonHeld(false),
+ mIsRightMouseButtonHeld(false)
{
- setCharacterWidth(1.0f);
- setCharacterType(mCharacterType);
+ setCharacterWidth(1.0f);
+ setCharacterType(mCharacterType);
}
LLPathfindingPathTool::~LLPathfindingPathTool()
@@ -65,402 +65,402 @@ LLPathfindingPathTool::~LLPathfindingPathTool()
BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask)
{
- BOOL returnVal = FALSE;
-
- if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld)
- {
- if (isAnyPathToolModKeys(pMask))
- {
- gViewerWindow->setCursor(isPointAModKeys(pMask)
- ? UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD
- : UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD);
- computeFinalPoints(pX, pY, pMask);
- mIsLeftMouseButtonHeld = true;
- setMouseCapture(TRUE);
- returnVal = TRUE;
- }
- else if (!isCameraModKeys(pMask))
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
- mIsLeftMouseButtonHeld = true;
- setMouseCapture(TRUE);
- returnVal = TRUE;
- }
- }
- mIsLeftMouseButtonHeld = true;
-
- return returnVal;
+ BOOL returnVal = FALSE;
+
+ if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld)
+ {
+ if (isAnyPathToolModKeys(pMask))
+ {
+ gViewerWindow->setCursor(isPointAModKeys(pMask)
+ ? UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD
+ : UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD);
+ computeFinalPoints(pX, pY, pMask);
+ mIsLeftMouseButtonHeld = true;
+ setMouseCapture(TRUE);
+ returnVal = TRUE;
+ }
+ else if (!isCameraModKeys(pMask))
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
+ mIsLeftMouseButtonHeld = true;
+ setMouseCapture(TRUE);
+ returnVal = TRUE;
+ }
+ }
+ mIsLeftMouseButtonHeld = true;
+
+ return returnVal;
}
BOOL LLPathfindingPathTool::handleMouseUp(S32 pX, S32 pY, MASK pMask)
{
- BOOL returnVal = FALSE;
+ BOOL returnVal = FALSE;
- if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld)
- {
- computeFinalPoints(pX, pY, pMask);
- setMouseCapture(FALSE);
- returnVal = TRUE;
- }
- mIsLeftMouseButtonHeld = false;
+ if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld)
+ {
+ computeFinalPoints(pX, pY, pMask);
+ setMouseCapture(FALSE);
+ returnVal = TRUE;
+ }
+ mIsLeftMouseButtonHeld = false;
- return returnVal;
+ return returnVal;
}
BOOL LLPathfindingPathTool::handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask)
{
- setMouseCapture(TRUE);
- mIsMiddleMouseButtonHeld = true;
- gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
+ setMouseCapture(TRUE);
+ mIsMiddleMouseButtonHeld = true;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
- return TRUE;
+ return TRUE;
}
BOOL LLPathfindingPathTool::handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask)
{
- if (!mIsLeftMouseButtonHeld && mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld)
- {
- setMouseCapture(FALSE);
- }
- mIsMiddleMouseButtonHeld = false;
+ if (!mIsLeftMouseButtonHeld && mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld)
+ {
+ setMouseCapture(FALSE);
+ }
+ mIsMiddleMouseButtonHeld = false;
- return TRUE;
+ return TRUE;
}
BOOL LLPathfindingPathTool::handleRightMouseDown(S32 pX, S32 pY, MASK pMask)
{
- setMouseCapture(TRUE);
- mIsRightMouseButtonHeld = true;
- gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
+ setMouseCapture(TRUE);
+ mIsRightMouseButtonHeld = true;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
- return TRUE;
+ return TRUE;
}
BOOL LLPathfindingPathTool::handleRightMouseUp(S32 pX, S32 pY, MASK pMask)
{
- if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && mIsRightMouseButtonHeld)
- {
- setMouseCapture(FALSE);
- }
- mIsRightMouseButtonHeld = false;
+ if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && mIsRightMouseButtonHeld)
+ {
+ setMouseCapture(FALSE);
+ }
+ mIsRightMouseButtonHeld = false;
- return TRUE;
+ return TRUE;
}
BOOL LLPathfindingPathTool::handleDoubleClick(S32 pX, S32 pY, MASK pMask)
{
- return TRUE;
+ return TRUE;
}
BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask)
{
- BOOL returnVal = FALSE;
+ BOOL returnVal = FALSE;
- if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && !isAnyPathToolModKeys(pMask))
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING);
- }
+ if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && !isAnyPathToolModKeys(pMask))
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING);
+ }
- if (!mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask))
- {
- gViewerWindow->setCursor(isPointAModKeys(pMask)
- ? (mIsLeftMouseButtonHeld ? UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD : UI_CURSOR_TOOLPATHFINDING_PATH_START)
- : (mIsLeftMouseButtonHeld ? UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD : UI_CURSOR_TOOLPATHFINDING_PATH_END));
- computeTempPoints(pX, pY, pMask);
- returnVal = TRUE;
- }
- else
- {
- clearTemp();
- computeFinalPath();
- }
+ if (!mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask))
+ {
+ gViewerWindow->setCursor(isPointAModKeys(pMask)
+ ? (mIsLeftMouseButtonHeld ? UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD : UI_CURSOR_TOOLPATHFINDING_PATH_START)
+ : (mIsLeftMouseButtonHeld ? UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD : UI_CURSOR_TOOLPATHFINDING_PATH_END));
+ computeTempPoints(pX, pY, pMask);
+ returnVal = TRUE;
+ }
+ else
+ {
+ clearTemp();
+ computeFinalPath();
+ }
- return returnVal;
+ return returnVal;
}
BOOL LLPathfindingPathTool::handleKey(KEY pKey, MASK pMask)
{
- // Eat the escape key or else the camera tool will pick up and reset to default view. This,
- // in turn, will cause some other methods to get called. And one of those methods will reset
- // the current toolset back to the basic toolset. This means that the pathfinding path toolset
- // will no longer be active, but typically with pathfinding path elements on screen.
- return (pKey == KEY_ESCAPE);
+ // Eat the escape key or else the camera tool will pick up and reset to default view. This,
+ // in turn, will cause some other methods to get called. And one of those methods will reset
+ // the current toolset back to the basic toolset. This means that the pathfinding path toolset
+ // will no longer be active, but typically with pathfinding path elements on screen.
+ return (pKey == KEY_ESCAPE);
}
LLPathfindingPathTool::EPathStatus LLPathfindingPathTool::getPathStatus() const
{
- EPathStatus status = kPathStatusUnknown;
-
- if (LLPathingLib::getInstance() == NULL)
- {
- status = kPathStatusNotImplemented;
- }
- else if ((gAgent.getRegion() != NULL) && !gAgent.getRegion()->capabilitiesReceived())
- {
- status = kPathStatusUnknown;
- }
- else if (!LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion())
- {
- status = kPathStatusNotEnabled;
- }
- else if (!hasFinalA() && !hasFinalB())
- {
- status = kPathStatusChooseStartAndEndPoints;
- }
- else if (!hasFinalA())
- {
- status = kPathStatusChooseStartPoint;
- }
- else if (!hasFinalB())
- {
- status = kPathStatusChooseEndPoint;
- }
- else if (mPathResult == LLPathingLib::LLPL_PATH_GENERATED_OK)
- {
- status = kPathStatusHasValidPath;
- }
- else if (mPathResult == LLPathingLib::LLPL_NO_PATH)
- {
- status = kPathStatusHasInvalidPath;
- }
- else
- {
- status = kPathStatusError;
- }
-
- return status;
+ EPathStatus status = kPathStatusUnknown;
+
+ if (LLPathingLib::getInstance() == NULL)
+ {
+ status = kPathStatusNotImplemented;
+ }
+ else if ((gAgent.getRegion() != NULL) && !gAgent.getRegion()->capabilitiesReceived())
+ {
+ status = kPathStatusUnknown;
+ }
+ else if (!LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion())
+ {
+ status = kPathStatusNotEnabled;
+ }
+ else if (!hasFinalA() && !hasFinalB())
+ {
+ status = kPathStatusChooseStartAndEndPoints;
+ }
+ else if (!hasFinalA())
+ {
+ status = kPathStatusChooseStartPoint;
+ }
+ else if (!hasFinalB())
+ {
+ status = kPathStatusChooseEndPoint;
+ }
+ else if (mPathResult == LLPathingLib::LLPL_PATH_GENERATED_OK)
+ {
+ status = kPathStatusHasValidPath;
+ }
+ else if (mPathResult == LLPathingLib::LLPL_NO_PATH)
+ {
+ status = kPathStatusHasInvalidPath;
+ }
+ else
+ {
+ status = kPathStatusError;
+ }
+
+ return status;
}
F32 LLPathfindingPathTool::getCharacterWidth() const
{
- return mFinalPathData.mCharacterWidth;
+ return mFinalPathData.mCharacterWidth;
}
void LLPathfindingPathTool::setCharacterWidth(F32 pCharacterWidth)
{
- mFinalPathData.mCharacterWidth = pCharacterWidth;
- mTempPathData.mCharacterWidth = pCharacterWidth;
- computeFinalPath();
+ mFinalPathData.mCharacterWidth = pCharacterWidth;
+ mTempPathData.mCharacterWidth = pCharacterWidth;
+ computeFinalPath();
}
LLPathfindingPathTool::ECharacterType LLPathfindingPathTool::getCharacterType() const
{
- return mCharacterType;
+ return mCharacterType;
}
void LLPathfindingPathTool::setCharacterType(ECharacterType pCharacterType)
{
- mCharacterType = pCharacterType;
-
- LLPathingLib::LLPLCharacterType characterType;
- switch (pCharacterType)
- {
- case kCharacterTypeNone :
- characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
- break;
- case kCharacterTypeA :
- characterType = LLPathingLib::LLPL_CHARACTER_TYPE_A;
- break;
- case kCharacterTypeB :
- characterType = LLPathingLib::LLPL_CHARACTER_TYPE_B;
- break;
- case kCharacterTypeC :
- characterType = LLPathingLib::LLPL_CHARACTER_TYPE_C;
- break;
- case kCharacterTypeD :
- characterType = LLPathingLib::LLPL_CHARACTER_TYPE_D;
- break;
- default :
- characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
- llassert(0);
- break;
- }
- mFinalPathData.mCharacterType = characterType;
- mTempPathData.mCharacterType = characterType;
- computeFinalPath();
+ mCharacterType = pCharacterType;
+
+ LLPathingLib::LLPLCharacterType characterType;
+ switch (pCharacterType)
+ {
+ case kCharacterTypeNone :
+ characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
+ break;
+ case kCharacterTypeA :
+ characterType = LLPathingLib::LLPL_CHARACTER_TYPE_A;
+ break;
+ case kCharacterTypeB :
+ characterType = LLPathingLib::LLPL_CHARACTER_TYPE_B;
+ break;
+ case kCharacterTypeC :
+ characterType = LLPathingLib::LLPL_CHARACTER_TYPE_C;
+ break;
+ case kCharacterTypeD :
+ characterType = LLPathingLib::LLPL_CHARACTER_TYPE_D;
+ break;
+ default :
+ characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
+ llassert(0);
+ break;
+ }
+ mFinalPathData.mCharacterType = characterType;
+ mTempPathData.mCharacterType = characterType;
+ computeFinalPath();
}
bool LLPathfindingPathTool::isRenderPath() const
{
- return (hasFinalA() || hasFinalB() || hasTempA() || hasTempB());
+ return (hasFinalA() || hasFinalB() || hasTempA() || hasTempB());
}
void LLPathfindingPathTool::clearPath()
{
- clearFinal();
- clearTemp();
- computeFinalPath();
+ clearFinal();
+ clearTemp();
+ computeFinalPath();
}
LLPathfindingPathTool::path_event_slot_t LLPathfindingPathTool::registerPathEventListener(path_event_callback_t pPathEventCallback)
{
- return mPathEventSignal.connect(pPathEventCallback);
+ return mPathEventSignal.connect(pPathEventCallback);
}
bool LLPathfindingPathTool::isAnyPathToolModKeys(MASK pMask) const
{
- return ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0);
+ return ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0);
}
bool LLPathfindingPathTool::isPointAModKeys(MASK pMask) const
{
- return ((pMask & MASK_CONTROL) != 0);
+ return ((pMask & MASK_CONTROL) != 0);
}
bool LLPathfindingPathTool::isPointBModKeys(MASK pMask) const
{
- return ((pMask & MASK_SHIFT) != 0);
+ return ((pMask & MASK_SHIFT) != 0);
}
bool LLPathfindingPathTool::isCameraModKeys(MASK pMask) const
{
- return ((pMask & MASK_ALT) != 0);
+ return ((pMask & MASK_ALT) != 0);
}
void LLPathfindingPathTool::getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const
{
- LLVector3 dv = gViewerWindow->mouseDirectionGlobal(pX, pY);
- LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin();
- pRayStart = mousePos;
- pRayEnd = mousePos + dv * 150;
+ LLVector3 dv = gViewerWindow->mouseDirectionGlobal(pX, pY);
+ LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin();
+ pRayStart = mousePos;
+ pRayEnd = mousePos + dv * 150;
}
void LLPathfindingPathTool::computeFinalPoints(S32 pX, S32 pY, MASK pMask)
{
- LLVector3 rayStart, rayEnd;
- getRayPoints(pX, pY, rayStart, rayEnd);
+ LLVector3 rayStart, rayEnd;
+ getRayPoints(pX, pY, rayStart, rayEnd);
- if (isPointAModKeys(pMask))
- {
- setFinalA(rayStart, rayEnd);
- }
- else if (isPointBModKeys(pMask))
- {
- setFinalB(rayStart, rayEnd);
- }
- computeFinalPath();
+ if (isPointAModKeys(pMask))
+ {
+ setFinalA(rayStart, rayEnd);
+ }
+ else if (isPointBModKeys(pMask))
+ {
+ setFinalB(rayStart, rayEnd);
+ }
+ computeFinalPath();
}
void LLPathfindingPathTool::computeTempPoints(S32 pX, S32 pY, MASK pMask)
{
- LLVector3 rayStart, rayEnd;
- getRayPoints(pX, pY, rayStart, rayEnd);
-
- if (isPointAModKeys(pMask))
- {
- setTempA(rayStart, rayEnd);
- if (hasFinalB())
- {
- setTempB(getFinalBStart(), getFinalBEnd());
- }
- }
- else if (isPointBModKeys(pMask))
- {
- if (hasFinalA())
- {
- setTempA(getFinalAStart(), getFinalAEnd());
- }
- setTempB(rayStart, rayEnd);
- }
- computeTempPath();
+ LLVector3 rayStart, rayEnd;
+ getRayPoints(pX, pY, rayStart, rayEnd);
+
+ if (isPointAModKeys(pMask))
+ {
+ setTempA(rayStart, rayEnd);
+ if (hasFinalB())
+ {
+ setTempB(getFinalBStart(), getFinalBEnd());
+ }
+ }
+ else if (isPointBModKeys(pMask))
+ {
+ if (hasFinalA())
+ {
+ setTempA(getFinalAStart(), getFinalAEnd());
+ }
+ setTempB(rayStart, rayEnd);
+ }
+ computeTempPath();
}
void LLPathfindingPathTool::setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
- mFinalPathData.mStartPointA = pStartPoint;
- mFinalPathData.mEndPointA = pEndPoint;
- mFinalPathData.mHasPointA = true;
+ mFinalPathData.mStartPointA = pStartPoint;
+ mFinalPathData.mEndPointA = pEndPoint;
+ mFinalPathData.mHasPointA = true;
}
bool LLPathfindingPathTool::hasFinalA() const
{
- return mFinalPathData.mHasPointA;
+ return mFinalPathData.mHasPointA;
}
const LLVector3 &LLPathfindingPathTool::getFinalAStart() const
{
- return mFinalPathData.mStartPointA;
+ return mFinalPathData.mStartPointA;
}
const LLVector3 &LLPathfindingPathTool::getFinalAEnd() const
{
- return mFinalPathData.mEndPointA;
+ return mFinalPathData.mEndPointA;
}
void LLPathfindingPathTool::setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
- mTempPathData.mStartPointA = pStartPoint;
- mTempPathData.mEndPointA = pEndPoint;
- mTempPathData.mHasPointA = true;
+ mTempPathData.mStartPointA = pStartPoint;
+ mTempPathData.mEndPointA = pEndPoint;
+ mTempPathData.mHasPointA = true;
}
bool LLPathfindingPathTool::hasTempA() const
{
- return mTempPathData.mHasPointA;
+ return mTempPathData.mHasPointA;
}
void LLPathfindingPathTool::setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
- mFinalPathData.mStartPointB = pStartPoint;
- mFinalPathData.mEndPointB = pEndPoint;
- mFinalPathData.mHasPointB = true;
+ mFinalPathData.mStartPointB = pStartPoint;
+ mFinalPathData.mEndPointB = pEndPoint;
+ mFinalPathData.mHasPointB = true;
}
bool LLPathfindingPathTool::hasFinalB() const
{
- return mFinalPathData.mHasPointB;
+ return mFinalPathData.mHasPointB;
}
const LLVector3 &LLPathfindingPathTool::getFinalBStart() const
{
- return mFinalPathData.mStartPointB;
+ return mFinalPathData.mStartPointB;
}
const LLVector3 &LLPathfindingPathTool::getFinalBEnd() const
{
- return mFinalPathData.mEndPointB;
+ return mFinalPathData.mEndPointB;
}
void LLPathfindingPathTool::setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
- mTempPathData.mStartPointB = pStartPoint;
- mTempPathData.mEndPointB = pEndPoint;
- mTempPathData.mHasPointB = true;
+ mTempPathData.mStartPointB = pStartPoint;
+ mTempPathData.mEndPointB = pEndPoint;
+ mTempPathData.mHasPointB = true;
}
bool LLPathfindingPathTool::hasTempB() const
{
- return mTempPathData.mHasPointB;
+ return mTempPathData.mHasPointB;
}
void LLPathfindingPathTool::clearFinal()
{
- mFinalPathData.mHasPointA = false;
- mFinalPathData.mHasPointB = false;
+ mFinalPathData.mHasPointA = false;
+ mFinalPathData.mHasPointB = false;
}
void LLPathfindingPathTool::clearTemp()
{
- mTempPathData.mHasPointA = false;
- mTempPathData.mHasPointB = false;
+ mTempPathData.mHasPointA = false;
+ mTempPathData.mHasPointB = false;
}
void LLPathfindingPathTool::computeFinalPath()
{
- mPathResult = LLPathingLib::LLPL_NO_PATH;
- if (LLPathingLib::getInstance() != NULL)
- {
- mPathResult = LLPathingLib::getInstance()->generatePath(mFinalPathData);
- }
- mPathEventSignal();
+ mPathResult = LLPathingLib::LLPL_NO_PATH;
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ mPathResult = LLPathingLib::getInstance()->generatePath(mFinalPathData);
+ }
+ mPathEventSignal();
}
void LLPathfindingPathTool::computeTempPath()
{
- mPathResult = LLPathingLib::LLPL_NO_PATH;
- if (LLPathingLib::getInstance() != NULL)
- {
- mPathResult = LLPathingLib::getInstance()->generatePath(mTempPathData);
- }
- mPathEventSignal();
+ mPathResult = LLPathingLib::LLPL_NO_PATH;
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ mPathResult = LLPathingLib::getInstance()->generatePath(mTempPathData);
+ }
+ mPathEventSignal();
}
diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h
index f98624e30d..0713616113 100644
--- a/indra/newview/llpathfindingpathtool.h
+++ b/indra/newview/llpathfindingpathtool.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpathfindingpathtool.h
* @brief Header file for llpathfindingpathtool
* @author Stinson@lindenlab.com
@@ -36,103 +36,103 @@
class LLPathfindingPathTool : public LLTool, public LLSingleton<LLPathfindingPathTool>
{
- LLSINGLETON(LLPathfindingPathTool);
- virtual ~LLPathfindingPathTool();
+ LLSINGLETON(LLPathfindingPathTool);
+ virtual ~LLPathfindingPathTool();
public:
- typedef enum
- {
- kPathStatusUnknown,
- kPathStatusChooseStartAndEndPoints,
- kPathStatusChooseStartPoint,
- kPathStatusChooseEndPoint,
- kPathStatusHasValidPath,
- kPathStatusHasInvalidPath,
- kPathStatusNotEnabled,
- kPathStatusNotImplemented,
- kPathStatusError
- } EPathStatus;
-
- typedef enum
- {
- kCharacterTypeNone,
- kCharacterTypeA,
- kCharacterTypeB,
- kCharacterTypeC,
- kCharacterTypeD
- } ECharacterType;
-
- typedef boost::function<void (void)> path_event_callback_t;
- typedef boost::signals2::signal<void (void)> path_event_signal_t;
- typedef boost::signals2::connection path_event_slot_t;
-
- virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask) override;
- virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask) override;
- virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) override;
- virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) override;
- virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask) override;
- virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
-
- virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask) override;
-
- virtual BOOL handleKey(KEY pKey, MASK pMask) override;
-
- EPathStatus getPathStatus() const;
-
- F32 getCharacterWidth() const;
- void setCharacterWidth(F32 pCharacterWidth);
-
- ECharacterType getCharacterType() const;
- void setCharacterType(ECharacterType pCharacterType);
-
- bool isRenderPath() const;
- void clearPath();
-
- path_event_slot_t registerPathEventListener(path_event_callback_t pPathEventCallback);
+ typedef enum
+ {
+ kPathStatusUnknown,
+ kPathStatusChooseStartAndEndPoints,
+ kPathStatusChooseStartPoint,
+ kPathStatusChooseEndPoint,
+ kPathStatusHasValidPath,
+ kPathStatusHasInvalidPath,
+ kPathStatusNotEnabled,
+ kPathStatusNotImplemented,
+ kPathStatusError
+ } EPathStatus;
+
+ typedef enum
+ {
+ kCharacterTypeNone,
+ kCharacterTypeA,
+ kCharacterTypeB,
+ kCharacterTypeC,
+ kCharacterTypeD
+ } ECharacterType;
+
+ typedef boost::function<void (void)> path_event_callback_t;
+ typedef boost::signals2::signal<void (void)> path_event_signal_t;
+ typedef boost::signals2::connection path_event_slot_t;
+
+ virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask) override;
+ virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask) override;
+ virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) override;
+ virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) override;
+ virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask) override;
+ virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+
+ virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask) override;
+
+ virtual BOOL handleKey(KEY pKey, MASK pMask) override;
+
+ EPathStatus getPathStatus() const;
+
+ F32 getCharacterWidth() const;
+ void setCharacterWidth(F32 pCharacterWidth);
+
+ ECharacterType getCharacterType() const;
+ void setCharacterType(ECharacterType pCharacterType);
+
+ bool isRenderPath() const;
+ void clearPath();
+
+ path_event_slot_t registerPathEventListener(path_event_callback_t pPathEventCallback);
protected:
private:
- bool isAnyPathToolModKeys(MASK pMask) const;
- bool isPointAModKeys(MASK pMask) const;
- bool isPointBModKeys(MASK pMask) const;
- bool isCameraModKeys(MASK pMask) const;
-
- void getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const;
- void computeFinalPoints(S32 pX, S32 pY, MASK pMask);
- void computeTempPoints(S32 pX, S32 pY, MASK pMask);
-
- void setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
- bool hasFinalA() const;
- const LLVector3 &getFinalAStart() const;
- const LLVector3 &getFinalAEnd() const;
-
- void setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
- bool hasTempA() const;
-
- void setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
- bool hasFinalB() const;
- const LLVector3 &getFinalBStart() const;
- const LLVector3 &getFinalBEnd() const;
-
- void setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
- bool hasTempB() const;
-
- void clearFinal();
- void clearTemp();
-
- void computeFinalPath();
- void computeTempPath();
-
- LLPathingLib::PathingPacket mFinalPathData;
- LLPathingLib::PathingPacket mTempPathData;
- LLPathingLib::LLPLResult mPathResult;
- ECharacterType mCharacterType;
- path_event_signal_t mPathEventSignal;
- bool mIsLeftMouseButtonHeld;
- bool mIsMiddleMouseButtonHeld;
- bool mIsRightMouseButtonHeld;
+ bool isAnyPathToolModKeys(MASK pMask) const;
+ bool isPointAModKeys(MASK pMask) const;
+ bool isPointBModKeys(MASK pMask) const;
+ bool isCameraModKeys(MASK pMask) const;
+
+ void getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const;
+ void computeFinalPoints(S32 pX, S32 pY, MASK pMask);
+ void computeTempPoints(S32 pX, S32 pY, MASK pMask);
+
+ void setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
+ bool hasFinalA() const;
+ const LLVector3 &getFinalAStart() const;
+ const LLVector3 &getFinalAEnd() const;
+
+ void setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
+ bool hasTempA() const;
+
+ void setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
+ bool hasFinalB() const;
+ const LLVector3 &getFinalBStart() const;
+ const LLVector3 &getFinalBEnd() const;
+
+ void setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
+ bool hasTempB() const;
+
+ void clearFinal();
+ void clearTemp();
+
+ void computeFinalPath();
+ void computeTempPath();
+
+ LLPathingLib::PathingPacket mFinalPathData;
+ LLPathingLib::PathingPacket mTempPathData;
+ LLPathingLib::LLPLResult mPathResult;
+ ECharacterType mCharacterType;
+ path_event_signal_t mPathEventSignal;
+ bool mIsLeftMouseButtonHeld;
+ bool mIsMiddleMouseButtonHeld;
+ bool mIsRightMouseButtonHeld;
};
#endif // LL_LLPATHFINDINGPATHTOOL_H
diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp
index 8718f7e7b0..f8737076b3 100644
--- a/indra/newview/llperfstats.cpp
+++ b/indra/newview/llperfstats.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llperfstats.cpp
* @brief Statistics collection to support autotune and perf flaoter.
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,7 +47,7 @@ namespace LLPerfStats
std::atomic<int64_t> tunedAvatars{0};
std::atomic<U64> renderAvatarMaxART_ns{(U64)(ART_UNLIMITED_NANOS)}; // highest render time we'll allow without culling features
bool belowTargetFPS{false};
- U32 lastGlobalPrefChange{0};
+ U32 lastGlobalPrefChange{0};
U32 lastSleepedFrame{0};
U64 meanFrameTime{0};
std::mutex bufferToggleLock{};
@@ -57,11 +57,11 @@ namespace LLPerfStats
Tunables tunables;
- std::atomic<int> StatsRecorder::writeBuffer{0};
- bool StatsRecorder::collectionEnabled{true};
+ std::atomic<int> StatsRecorder::writeBuffer{0};
+ bool StatsRecorder::collectionEnabled{true};
LLUUID StatsRecorder::focusAv{LLUUID::null};
bool StatsRecorder::autotuneInit{false};
- std::array<StatsRecorder::StatsTypeMatrix,2> StatsRecorder::statsDoubleBuffer{ {} };
+ std::array<StatsRecorder::StatsTypeMatrix,2> StatsRecorder::statsDoubleBuffer{ {} };
std::array<StatsRecorder::StatsSummaryArray,2> StatsRecorder::max{ {} };
std::array<StatsRecorder::StatsSummaryArray,2> StatsRecorder::sum{ {} };
@@ -99,7 +99,7 @@ namespace LLPerfStats
}
}
- // static
+ // static
void Tunables::updateSettingsFromRenderCostLimit()
{
if( userARTCutoffSliderValue != log10( ( (F32)LLPerfStats::renderAvatarMaxART_ns )/1000 ) )
@@ -112,13 +112,13 @@ namespace LLPerfStats
{
updateUserARTCutoffSlider(log10( (F32)LLPerfStats::ART_UNLIMITED_NANOS/1000 ) );
}
- }
+ }
}
void Tunables::initialiseFromSettings()
{
assert_main_thread();
- // the following variables are two way and have "push" in llviewercontrol
+ // the following variables are two way and have "push" in llviewercontrol
LLPerfStats::tunables.userMinDrawDistance = gSavedSettings.getF32("AutoTuneRenderFarClipMin");
LLPerfStats::tunables.userTargetDrawDistance = gSavedSettings.getF32("AutoTuneRenderFarClipTarget");
LLPerfStats::tunables.userImpostorDistance = gSavedSettings.getF32("AutoTuneImpostorFarAwayDistance");
@@ -166,8 +166,8 @@ namespace LLPerfStats
auto& lastStats = statsDoubleBuffer[writeBuffer ^ 1][static_cast<size_t>(ObjType_t::OT_GENERAL)][LLUUID::null];
static constexpr std::initializer_list<StatType_t> sceneStatsToAvg = {
- StatType_t::RENDER_FRAME,
- StatType_t::RENDER_DISPLAY,
+ StatType_t::RENDER_FRAME,
+ StatType_t::RENDER_DISPLAY,
StatType_t::RENDER_HUDS,
StatType_t::RENDER_UI,
StatType_t::RENDER_SWAP,
@@ -177,8 +177,8 @@ namespace LLPerfStats
#if 0
static constexpr std::initializer_list<StatType_t> avatarStatsToAvg = {
- StatType_t::RENDER_GEOMETRY,
- StatType_t::RENDER_SHADOWS,
+ StatType_t::RENDER_GEOMETRY,
+ StatType_t::RENDER_SHADOWS,
StatType_t::RENDER_COMBINED,
StatType_t::RENDER_IDLE };
#endif
@@ -194,7 +194,7 @@ namespace LLPerfStats
if(!unreliable)
{
- // only use these stats when things are reliable.
+ // only use these stats when things are reliable.
for(auto & statEntry : sceneStatsToAvg)
{
@@ -204,13 +204,13 @@ namespace LLPerfStats
// LL_INFOS("scenestats") << "Scenestat: " << static_cast<size_t>(statEntry) << " before=" << avg << " new=" << val << " newavg=" << statsDoubleBuffer[writeBuffer][static_cast<size_t>(ObjType_t::OT_GENERAL)][LLUUID::null][static_cast<size_t>(statEntry)] << LL_ENDL;
}
}
-
+
// swap the buffers
if(enabled())
{
std::lock_guard<std::mutex> lock{bufferToggleLock};
writeBuffer ^= 1;
- }; // note we are relying on atomic updates here. The risk is low and would cause minor errors in the stats display.
+ }; // note we are relying on atomic updates here. The risk is low and would cause minor errors in the stats display.
// clean the write maps in all cases.
auto& statsTypeMatrix = statsDoubleBuffer[writeBuffer];
@@ -238,7 +238,7 @@ namespace LLPerfStats
}
// clear buffers when we change region or need a hard reset.
- // static
+ // static
void StatsRecorder::clearStatsBuffers()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
@@ -265,7 +265,7 @@ namespace LLPerfStats
{
std::lock_guard<std::mutex> lock{bufferToggleLock};
writeBuffer ^= 1;
- };
+ };
// repeat before we start processing new stuff
for(auto& statsMap : statsTypeMatrix)
{
@@ -288,7 +288,7 @@ namespace LLPerfStats
void updateClass()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
-
+
sTotalAvatarTime = LLVOAvatar::getTotalGPURenderTime();
sAverageAvatarTime = LLVOAvatar::getAverageGPURenderTime();
sMaxAvatarTime = LLVOAvatar::getMaxGPURenderTime();
@@ -299,11 +299,11 @@ namespace LLPerfStats
{
const auto our_pos = gAgentCamera.getCameraPositionGlobal();
- std::vector<LLVector3d> positions;
- uuid_vec_t avatar_ids;
+ std::vector<LLVector3d> positions;
+ uuid_vec_t avatar_ids;
LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, our_pos, distance);
return positions.size();
- }
+ }
const U32 NUM_PERIODS = 50;
void StatsRecorder::updateMeanFrameTime(U64 cur_frame_time_raw)
@@ -314,7 +314,7 @@ namespace LLPerfStats
{
frame_time_deque.pop_back();
}
-
+
std::vector<U64> buf(frame_time_deque.begin(), frame_time_deque.end());
std::sort(buf.begin(), buf.end());
@@ -347,8 +347,8 @@ namespace LLPerfStats
if( tot_sleep_time_raw != 0 )
{
- // Note: we do not average sleep
- // if at some point we need to, the averaging will need to take this into account or
+ // Note: we do not average sleep
+ // if at some point we need to, the averaging will need to take this into account or
// we forever think we're in the background due to residuals.
LL_DEBUGS() << "No tuning when not in focus" << LL_ENDL;
LLPerfStats::lastSleepedFrame = gFrameCount;
@@ -386,7 +386,7 @@ namespace LLPerfStats
auto av_render_max_raw = ms_to_raw(sMaxAvatarTime);
// Is our target frame time lower than current? If so we need to take action to reduce draw overheads.
// cumulative avatar time (includes idle processing, attachments and base av)
- auto tot_avatar_time_raw = ms_to_raw(sTotalAvatarTime);
+ auto tot_avatar_time_raw = ms_to_raw(sTotalAvatarTime);
// The frametime budget we have based on the target FPS selected
auto target_frame_time_raw = (U64)llround(LLPerfStats::cpu_hertz / (target_fps == 0 ? 1 : target_fps));
@@ -398,7 +398,7 @@ namespace LLPerfStats
// This could be problematic.
tot_frame_time_raw -= tot_limit_time_raw;
}*/
-
+
F64 time_buf = target_frame_time_raw * 0.1;
// 1) Is the target frame time lower than current?
@@ -457,7 +457,7 @@ namespace LLPerfStats
// Note: moved from outside "if changefrequency elapsed" to stop fallthrough and allow scenery changes time to take effect.
target_avatar_time_raw = 0;
}
- else
+ else
{
// we made a settings change recently so let's give it time.
return;
@@ -484,7 +484,7 @@ namespace LLPerfStats
new_render_limit_ns -= LLPerfStats::ART_MIN_ADJUST_DOWN_NANOS;
}
- // bounce at the bottom to prevent "no limit"
+ // bounce at the bottom to prevent "no limit"
new_render_limit_ns = std::max((U64)new_render_limit_ns, (U64)LLPerfStats::ART_MINIMUM_NANOS);
// assign the new value
@@ -526,7 +526,7 @@ namespace LLPerfStats
}
if(tunables.userFPSTuningStrategy != TUNE_AVATARS_ONLY)
{
- if( LLPipeline::RenderFarClip < tunables.userTargetDrawDistance )
+ if( LLPipeline::RenderFarClip < tunables.userTargetDrawDistance )
{
LLPerfStats::tunables.updateFarClip( std::min(LLPipeline::RenderFarClip + DD_STEP, tunables.userTargetDrawDistance) );
LLPerfStats::lastGlobalPrefChange = gFrameCount;
diff --git a/indra/newview/llperfstats.h b/indra/newview/llperfstats.h
index 33777abdbf..1a2098ec7e 100644
--- a/indra/newview/llperfstats.h
+++ b/indra/newview/llperfstats.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llperfstats.h
* @brief Statistics collection to support autotune and perf flaoter.
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,7 +50,7 @@ namespace LLPerfStats
static constexpr U64 ART_UNLIMITED_NANOS{50000000};
static constexpr U64 ART_MINIMUM_NANOS{100000};
static constexpr U64 ART_MIN_ADJUST_UP_NANOS{5000};
- static constexpr U64 ART_MIN_ADJUST_DOWN_NANOS{10000};
+ static constexpr U64 ART_MIN_ADJUST_DOWN_NANOS{10000};
static constexpr F32 PREFERRED_DD{180};
static constexpr U32 SMOOTHING_PERIODS{50};
@@ -94,7 +94,7 @@ namespace LLPerfStats
};
struct StatsRecord
- {
+ {
StatType_t statType;
ObjType_t objType;
LLUUID avID;
@@ -123,10 +123,10 @@ namespace LLPerfStats
U32 tuningFlag{0}; // bit mask for changed settings
// proxy variables, used to pas the new value to be set via the mainthread
- U32 nonImpostors{0};
- S32 reflectionDetail{0};
- F32 farClip{0.0};
- F32 userMinDrawDistance{0.0};
+ U32 nonImpostors{0};
+ S32 reflectionDetail{0};
+ F32 farClip{0.0};
+ F32 userMinDrawDistance{0.0};
F32 userTargetDrawDistance{0.0};
F32 userImpostorDistance{0.0};
bool userImpostorDistanceTuningEnabled{false};
@@ -171,7 +171,7 @@ namespace LLPerfStats
static inline void setFocusAv(const LLUUID& avID){focusAv = avID;};
static inline const LLUUID& getFocusAv(){return focusAv;};
static inline void setAutotuneInit(){autotuneInit = true;};
-
+
static inline void send(StatsRecord && upd)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
@@ -326,7 +326,7 @@ namespace LLPerfStats
};
~RecordTime()
- {
+ {
if(!LLPerfStats::StatsRecorder::enabled())
{
return;
@@ -347,7 +347,7 @@ namespace LLPerfStats
inline U64 ms_to_raw(double ms) { return (U64)(LLPerfStats::cpu_hertz * (ms / 1000.0));
}
-
+
using RecordSceneTime = RecordTime<ObjType_t::OT_GENERAL>;
diff --git a/indra/newview/llpersistentnotificationstorage.cpp b/indra/newview/llpersistentnotificationstorage.cpp
index 9bf771db8a..4aca704a27 100644
--- a/indra/newview/llpersistentnotificationstorage.cpp
+++ b/indra/newview/llpersistentnotificationstorage.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpersistentnotificationstorage.cpp
* @brief Implementation of llpersistentnotificationstorage
* @author Stinson@lindenlab.com
@@ -37,8 +37,8 @@
#include "llviewermessage.h"
#include "llviewernetwork.h"
LLPersistentNotificationStorage::LLPersistentNotificationStorage():
- LLNotificationStorage("")
- , mLoaded(false)
+ LLNotificationStorage("")
+ , mLoaded(false)
{
initialize();
}
@@ -51,116 +51,116 @@ void LLPersistentNotificationStorage::saveNotifications()
{
LL_PROFILE_ZONE_SCOPED;
- boost::intrusive_ptr<LLPersistentNotificationChannel> history_channel = boost::dynamic_pointer_cast<LLPersistentNotificationChannel>(LLNotifications::instance().getChannel("Persistent"));
- if (!history_channel)
- {
- return;
- }
-
- LLSD output = LLSD::emptyMap();
- LLSD& data = output["data"];
-
- for ( std::vector<LLNotificationPtr>::iterator it = history_channel->beginHistory(), end_it = history_channel->endHistory();
- it != end_it;
- ++it)
- {
- LLNotificationPtr notification = *it;
-
- // After a notification was placed in Persist channel, it can become
- // responded, expired or canceled - in this case we are should not save it
- if(notification->isRespondedTo() || notification->isCancelled()
- || notification->isExpired())
- {
- continue;
- }
-
- data.append(notification->asLLSD(true));
- if (data.size() >= gSavedSettings.getS32("MaxPersistentNotifications"))
- {
- LL_WARNS() << "Too many persistent notifications."
- << " Saved " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << history_channel->size()
- << " persistent notifications." << LL_ENDL;
- break;
- }
-
- }
-
- writeNotifications(output);
+ boost::intrusive_ptr<LLPersistentNotificationChannel> history_channel = boost::dynamic_pointer_cast<LLPersistentNotificationChannel>(LLNotifications::instance().getChannel("Persistent"));
+ if (!history_channel)
+ {
+ return;
+ }
+
+ LLSD output = LLSD::emptyMap();
+ LLSD& data = output["data"];
+
+ for ( std::vector<LLNotificationPtr>::iterator it = history_channel->beginHistory(), end_it = history_channel->endHistory();
+ it != end_it;
+ ++it)
+ {
+ LLNotificationPtr notification = *it;
+
+ // After a notification was placed in Persist channel, it can become
+ // responded, expired or canceled - in this case we are should not save it
+ if(notification->isRespondedTo() || notification->isCancelled()
+ || notification->isExpired())
+ {
+ continue;
+ }
+
+ data.append(notification->asLLSD(true));
+ if (data.size() >= gSavedSettings.getS32("MaxPersistentNotifications"))
+ {
+ LL_WARNS() << "Too many persistent notifications."
+ << " Saved " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << history_channel->size()
+ << " persistent notifications." << LL_ENDL;
+ break;
+ }
+
+ }
+
+ writeNotifications(output);
}
void LLPersistentNotificationStorage::loadNotifications()
{
LL_PROFILE_ZONE_SCOPED;
- LL_INFOS("LLPersistentNotificationStorage") << "start loading notifications" << LL_ENDL;
-
- if (mLoaded)
- {
- LL_INFOS("LLPersistentNotificationStorage") << "notifications already loaded, exiting" << LL_ENDL;
- return;
- }
-
- mLoaded = true;
- LLSD input;
- if (!readNotifications(input) ||input.isUndefined())
- {
- return;
- }
-
- LLSD& data = input["data"];
- if (data.isUndefined())
- {
- return;
- }
-
- using namespace LLNotificationsUI;
- LLScreenChannel* notification_channel = dynamic_cast<LLScreenChannel*>(LLChannelManager::getInstance()->
- findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
-
- LLNotifications& instance = LLNotifications::instance();
- S32 processed_notifications = 0;
- std::vector<LLSD> notifications_array;
- for (LLSD::reverse_array_iterator notification_it = data.rbeginArray();
- notification_it != data.rendArray();
- ++notification_it)
- {
- LLSD notification_params = *notification_it;
- notifications_array.push_back(notification_params);
-
- ++processed_notifications;
- if (processed_notifications >= gSavedSettings.getS32("MaxPersistentNotifications"))
- {
- LL_WARNS() << "Too many persistent notifications."
- << " Processed " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << data.size() << " persistent notifications." << LL_ENDL;
- break;
- }
- }
-
- for (LLSD::reverse_array_iterator notification_it = notifications_array.rbegin();
- notification_it != notifications_array.rend();
- ++notification_it)
- {
- LLSD notification_params = *notification_it;
- LLNotificationPtr notification(new LLNotification(notification_params));
-
- LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"]));
- notification->setResponseFunctor(responder);
-
- instance.load(notification);
-
- // hide script floaters so they don't confuse the user and don't overlap startup toast
- LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false);
-
- if(notification_channel)
- {
- // hide saved toasts so they don't confuse the user
- notification_channel->hideToast(notification->getID());
- }
- }
-
- LLNotifications::instance().getChannel("Persistent")->
- connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
- LL_INFOS("LLPersistentNotificationStorage") << "finished loading notifications" << LL_ENDL;
+ LL_INFOS("LLPersistentNotificationStorage") << "start loading notifications" << LL_ENDL;
+
+ if (mLoaded)
+ {
+ LL_INFOS("LLPersistentNotificationStorage") << "notifications already loaded, exiting" << LL_ENDL;
+ return;
+ }
+
+ mLoaded = true;
+ LLSD input;
+ if (!readNotifications(input) ||input.isUndefined())
+ {
+ return;
+ }
+
+ LLSD& data = input["data"];
+ if (data.isUndefined())
+ {
+ return;
+ }
+
+ using namespace LLNotificationsUI;
+ LLScreenChannel* notification_channel = dynamic_cast<LLScreenChannel*>(LLChannelManager::getInstance()->
+ findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
+
+ LLNotifications& instance = LLNotifications::instance();
+ S32 processed_notifications = 0;
+ std::vector<LLSD> notifications_array;
+ for (LLSD::reverse_array_iterator notification_it = data.rbeginArray();
+ notification_it != data.rendArray();
+ ++notification_it)
+ {
+ LLSD notification_params = *notification_it;
+ notifications_array.push_back(notification_params);
+
+ ++processed_notifications;
+ if (processed_notifications >= gSavedSettings.getS32("MaxPersistentNotifications"))
+ {
+ LL_WARNS() << "Too many persistent notifications."
+ << " Processed " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << data.size() << " persistent notifications." << LL_ENDL;
+ break;
+ }
+ }
+
+ for (LLSD::reverse_array_iterator notification_it = notifications_array.rbegin();
+ notification_it != notifications_array.rend();
+ ++notification_it)
+ {
+ LLSD notification_params = *notification_it;
+ LLNotificationPtr notification(new LLNotification(notification_params));
+
+ LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"]));
+ notification->setResponseFunctor(responder);
+
+ instance.load(notification);
+
+ // hide script floaters so they don't confuse the user and don't overlap startup toast
+ LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false);
+
+ if(notification_channel)
+ {
+ // hide saved toasts so they don't confuse the user
+ notification_channel->hideToast(notification->getID());
+ }
+ }
+
+ LLNotifications::instance().getChannel("Persistent")->
+ connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
+ LL_INFOS("LLPersistentNotificationStorage") << "finished loading notifications" << LL_ENDL;
}
void LLPersistentNotificationStorage::reset()
@@ -173,24 +173,24 @@ void LLPersistentNotificationStorage::reset()
void LLPersistentNotificationStorage::initialize()
{
reset();
- LLNotifications::instance().getChannel("Persistent")->
- connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
+ LLNotifications::instance().getChannel("Persistent")->
+ connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
}
bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& payload)
{
- // In case we received channel changed signal but haven't yet loaded notifications, do it
- if (!mLoaded)
- {
- loadNotifications();
- }
- // we ignore "load" messages, but rewrite the persistence file on any other
- const std::string sigtype = payload["sigtype"].asString();
- if ("load" != sigtype)
- {
- saveNotifications();
- }
- return false;
+ // In case we received channel changed signal but haven't yet loaded notifications, do it
+ if (!mLoaded)
+ {
+ loadNotifications();
+ }
+ // we ignore "load" messages, but rewrite the persistence file on any other
+ const std::string sigtype = payload["sigtype"].asString();
+ if ("load" != sigtype)
+ {
+ saveNotifications();
+ }
+ return false;
}
// EOF
diff --git a/indra/newview/llpersistentnotificationstorage.h b/indra/newview/llpersistentnotificationstorage.h
index 335d85aaf6..72fe2a7975 100644
--- a/indra/newview/llpersistentnotificationstorage.h
+++ b/indra/newview/llpersistentnotificationstorage.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpersistentnotificationstorage.h
* @brief Header file for llpersistentnotificationstorage
* @author Stinson@lindenlab.com
@@ -45,22 +45,22 @@ class LLSD;
class LLPersistentNotificationStorage : public LLParamSingleton<LLPersistentNotificationStorage>, public LLNotificationStorage
{
- LLSINGLETON(LLPersistentNotificationStorage);
- ~LLPersistentNotificationStorage();
- LOG_CLASS(LLPersistentNotificationStorage);
+ LLSINGLETON(LLPersistentNotificationStorage);
+ ~LLPersistentNotificationStorage();
+ LOG_CLASS(LLPersistentNotificationStorage);
public:
- void saveNotifications();
- void loadNotifications();
+ void saveNotifications();
+ void loadNotifications();
void reset();
protected:
private:
- void initialize();
+ void initialize();
- bool onPersistentChannelChanged(const LLSD& payload);
- bool mLoaded;
+ bool onPersistentChannelChanged(const LLSD& payload);
+ bool mLoaded;
};
#endif // LL_LLPERSISTENTNOTIFICATIONSTORAGE_H
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp
index 03a02ba26f..9c6a4a7f10 100644
--- a/indra/newview/llphysicsmotion.cpp
+++ b/indra/newview/llphysicsmotion.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llphysicsmotion.cpp
* @brief Implementation of LLPhysicsMotion class.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,7 +55,7 @@ inline F64 llsgn(const F64 a)
return -1;
}
-/*
+/*
At a high level, this works by setting temporary parameters that are not stored
in the avatar's list of params, and are not conveyed to other users. We accomplish
this by creating some new temporary driven params inside avatar_lad that are then driven
@@ -69,18 +69,18 @@ inline F64 llsgn(const F64 a)
class LLPhysicsMotion
{
public:
- typedef enum
- {
- SMOOTHING = 0,
- MASS,
- GRAVITY,
- SPRING,
- GAIN,
- DAMPING,
- DRAG,
- MAX_EFFECT,
- NUM_PARAMS
- } eParamName;
+ typedef enum
+ {
+ SMOOTHING = 0,
+ MASS,
+ GRAVITY,
+ SPRING,
+ GAIN,
+ DAMPING,
+ DRAG,
+ MAX_EFFECT,
+ NUM_PARAMS
+ } eParamName;
/*
param_driver_name: The param that controls the params that are being affected by the physics.
@@ -96,7 +96,7 @@ public:
controllers: The various settings (e.g. spring force, mass) that determine how
the body part behaves.
*/
- LLPhysicsMotion(const std::string &param_driver_name,
+ LLPhysicsMotion(const std::string &param_driver_name,
const std::string &joint_name,
LLCharacter *character,
const LLVector3 &motion_direction_vec,
@@ -114,10 +114,10 @@ public:
{
mJointState = new LLJointState;
- for (U32 i = 0; i < NUM_PARAMS; ++i)
- {
- mParamCache[i] = NULL;
- }
+ for (U32 i = 0; i < NUM_PARAMS; ++i)
+ {
+ mParamCache[i] = NULL;
+ }
}
BOOL initialize();
@@ -126,48 +126,48 @@ public:
BOOL onUpdate(F32 time);
- LLPointer<LLJointState> getJointState()
+ LLPointer<LLJointState> getJointState()
{
return mJointState;
}
protected:
- F32 getParamValue(eParamName param)
- {
- static std::string controller_key[] =
- {
- "Smoothing",
- "Mass",
- "Gravity",
- "Spring",
- "Gain",
- "Damping",
- "Drag",
- "MaxEffect"
- };
-
- if (!mParamCache[param])
- {
- const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key[param]);
+ F32 getParamValue(eParamName param)
+ {
+ static std::string controller_key[] =
+ {
+ "Smoothing",
+ "Mass",
+ "Gravity",
+ "Spring",
+ "Gain",
+ "Damping",
+ "Drag",
+ "MaxEffect"
+ };
+
+ if (!mParamCache[param])
+ {
+ const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key[param]);
if (entry == mParamControllers.end())
{
return sDefaultController[controller_key[param]];
}
const std::string& param_name = (*entry).second.c_str();
mParamCache[param] = mCharacter->getVisualParam(param_name.c_str());
- }
-
- if (mParamCache[param])
- {
- return mParamCache[param]->getWeight();
- }
- else
- {
- return sDefaultController[controller_key[param]];
- }
- }
-
-
+ }
+
+ if (mParamCache[param])
+ {
+ return mParamCache[param]->getWeight();
+ }
+ else
+ {
+ return sDefaultController[controller_key[param]];
+ }
+ }
+
+
void setParamValue(const LLViewerVisualParam *param,
const F32 new_value_local,
F32 behavior_maxeffect);
@@ -191,13 +191,13 @@ private:
LLViewerVisualParam *mParamDriver;
const controller_map_t mParamControllers;
-
+
LLPointer<LLJointState> mJointState;
LLCharacter *mCharacter;
F32 mLastTime;
-
- LLVisualParam* mParamCache[NUM_PARAMS];
+
+ LLVisualParam* mParamCache[NUM_PARAMS];
static default_controller_map_t sDefaultController;
};
@@ -233,7 +233,7 @@ BOOL LLPhysicsMotion::initialize()
return TRUE;
}
-LLPhysicsMotionController::LLPhysicsMotionController(const LLUUID &id) :
+LLPhysicsMotionController::LLPhysicsMotionController(const LLUUID &id) :
LLMotion(id),
mCharacter(NULL)
{
@@ -250,12 +250,12 @@ LLPhysicsMotionController::~LLPhysicsMotionController()
}
}
-BOOL LLPhysicsMotionController::onActivate()
-{
- return TRUE;
+BOOL LLPhysicsMotionController::onActivate()
+{
+ return TRUE;
}
-void LLPhysicsMotionController::onDeactivate()
+void LLPhysicsMotionController::onDeactivate()
{
}
@@ -401,7 +401,7 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter
}
addMotion(motion);
}
-
+
return STATUS_SUCCESS;
}
@@ -411,7 +411,7 @@ void LLPhysicsMotionController::addMotion(LLPhysicsMotion *motion)
mMotions.push_back(motion);
}
-F32 LLPhysicsMotionController::getMinPixelArea()
+F32 LLPhysicsMotionController::getMinPixelArea()
{
return MIN_REQUIRED_PIXEL_AREA_AVATAR_PHYSICS_MOTION;
}
@@ -421,7 +421,7 @@ F32 LLPhysicsMotion::toLocal(const LLVector3 &world)
{
LLJoint *joint = mJointState->getJoint();
const LLQuaternion rotation_world = joint->getWorldRotation();
-
+
LLVector3 dir_world = mMotionDirectionVec * rotation_world;
dir_world.normalize();
return world * dir_world;
@@ -429,11 +429,11 @@ F32 LLPhysicsMotion::toLocal(const LLVector3 &world)
F32 LLPhysicsMotion::calculateVelocity_local(const F32 time_delta)
{
- const F32 world_to_model_scale = 100.0f;
+ const F32 world_to_model_scale = 100.0f;
LLJoint *joint = mJointState->getJoint();
const LLVector3 position_world = joint->getWorldPosition();
const LLVector3 last_position_world = mPosition_world;
- const LLVector3 positionchange_world = (position_world-last_position_world) * world_to_model_scale;
+ const LLVector3 positionchange_world = (position_world-last_position_world) * world_to_model_scale;
const F32 velocity_local = toLocal(positionchange_world) / time_delta;
return velocity_local;
}
@@ -443,11 +443,11 @@ F32 LLPhysicsMotion::calculateAcceleration_local(const F32 velocity_local, const
// const F32 smoothing = getParamValue("Smoothing");
static const F32 smoothing = 3.0f; // Removed smoothing param since it's probably not necessary
const F32 acceleration_local = (velocity_local - mVelocityJoint_local) / time_delta;
-
- const F32 smoothed_acceleration_local =
- acceleration_local * 1.0/smoothing +
+
+ const F32 smoothed_acceleration_local =
+ acceleration_local * 1.0/smoothing +
mAccelerationJoint_local * (smoothing-1.0)/smoothing;
-
+
return smoothed_acceleration_local;
}
@@ -459,7 +459,7 @@ BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
{
return TRUE;
}
-
+
BOOL update_visuals = FALSE;
for (motion_vec_t::iterator iter = mMotions.begin();
iter != mMotions.end();
@@ -468,10 +468,10 @@ BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
LLPhysicsMotion *motion = (*iter);
update_visuals |= motion->onUpdate(time);
}
-
+
if (update_visuals)
mCharacter->updateVisualParams();
-
+
return TRUE;
}
@@ -479,7 +479,7 @@ BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
BOOL LLPhysicsMotion::onUpdate(F32 time)
{
// static FILE *mFileWrite = fopen("c:\\temp\\avatar_data.txt","w");
-
+
if (!mParamDriver)
return FALSE;
@@ -494,8 +494,8 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
//
const F32 time_delta = time - mLastTime;
-
- // If less than 1FPS, we don't want to be spending time updating physics at all.
+
+ // If less than 1FPS, we don't want to be spending time updating physics at all.
if (time_delta > 1.0)
{
mLastTime = time;
@@ -512,217 +512,217 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
LLJoint *joint = mJointState->getJoint();
- const F32 behavior_mass = getParamValue(MASS);
- const F32 behavior_gravity = getParamValue(GRAVITY);
- const F32 behavior_spring = getParamValue(SPRING);
- const F32 behavior_gain = getParamValue(GAIN);
- const F32 behavior_damping = getParamValue(DAMPING);
- const F32 behavior_drag = getParamValue(DRAG);
- F32 behavior_maxeffect = getParamValue(MAX_EFFECT);
-
- const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts.
-
+ const F32 behavior_mass = getParamValue(MASS);
+ const F32 behavior_gravity = getParamValue(GRAVITY);
+ const F32 behavior_spring = getParamValue(SPRING);
+ const F32 behavior_gain = getParamValue(GAIN);
+ const F32 behavior_damping = getParamValue(DAMPING);
+ const F32 behavior_drag = getParamValue(DRAG);
+ F32 behavior_maxeffect = getParamValue(MAX_EFFECT);
+
+ const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts.
+
if (physics_test)
behavior_maxeffect = 1.0f;
- // Normalize the param position to be from [0,1].
- // We have to use normalized values because there may be more than one driven param,
- // and each of these driven params may have its own range.
- // This means we'll do all our calculations in normalized [0,1] local coordinates.
- const F32 position_user_local = (mParamDriver->getWeight() - mParamDriver->getMinWeight()) / (mParamDriver->getMaxWeight() - mParamDriver->getMinWeight());
-
- //
- // End parameters and settings
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Calculate velocity and acceleration in parameter space.
- //
-
+ // Normalize the param position to be from [0,1].
+ // We have to use normalized values because there may be more than one driven param,
+ // and each of these driven params may have its own range.
+ // This means we'll do all our calculations in normalized [0,1] local coordinates.
+ const F32 position_user_local = (mParamDriver->getWeight() - mParamDriver->getMinWeight()) / (mParamDriver->getMaxWeight() - mParamDriver->getMinWeight());
+
+ //
+ // End parameters and settings
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Calculate velocity and acceleration in parameter space.
+ //
+
const F32 joint_local_factor = 30.0;
const F32 velocity_joint_local = calculateVelocity_local(time_delta * joint_local_factor);
const F32 acceleration_joint_local = calculateAcceleration_local(velocity_joint_local, time_delta * joint_local_factor);
-
- //
- // End velocity and acceleration
- ////////////////////////////////////////////////////////////////////////////////
-
- BOOL update_visuals = FALSE;
-
- // Break up the physics into a bunch of iterations so that differing framerates will show
- // roughly the same behavior.
- // Explanation/example: Lets assume we have a bouncing object. Said abjects bounces at a
- // trajectory that has points A>B>C. Object bounces from A to B with specific speed.
- // It needs time T to move from A to B.
- // As long as our frame's time significantly smaller then T our motion will be split into
- // multiple parts. with each part speed will decrease. Object will reach B position (roughly)
- // and bounce/fall back to A.
- // But if frame's time (F_T) is larger then T, object will move with same speed for whole F_T
- // and will jump over point B up to C ending up with increased amplitude. To avoid that we
- // split F_T into smaller portions so that when frame's time is too long object can virtually
- // bounce at right (relatively) position.
- // Note: this doesn't look to be optimal, since it provides only "roughly same" behavior, but
- // irregularity at higher fps looks to be insignificant so it works good enough for low fps.
- U32 steps = (U32)(time_delta / TIME_ITERATION_STEP_MAX) + 1;
- F32 time_iteration_step = time_delta / (F32)steps; //minimal step size ends up as 0.025
- for (U32 i = 0; i < steps; i++)
- {
- // mPositon_local should be in normalized 0,1 range already. Just making sure...
- const F32 position_current_local = llclamp(mPosition_local,
- 0.0f,
- 1.0f);
- // If the effect is turned off then don't process unless we need one more update
- // to set the position to the default (i.e. user) position.
- if ((behavior_maxeffect == 0) && (position_current_local == position_user_local))
- {
- return update_visuals;
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // Calculate the total force
- //
-
- // Spring force is a restoring force towards the original user-set breast position.
- // F = kx
- const F32 spring_length = position_current_local - position_user_local;
- const F32 force_spring = -spring_length * behavior_spring;
-
- // Acceleration is the force that comes from the change in velocity of the torso.
- // F = ma
- const F32 force_accel = behavior_gain * (acceleration_joint_local * behavior_mass);
-
- // Gravity always points downward in world space.
- // F = mg
- const LLVector3 gravity_world(0,0,1);
- const F32 force_gravity = (toLocal(gravity_world) * behavior_gravity * behavior_mass);
-
- // Damping is a restoring force that opposes the current velocity.
- // F = -kv
- const F32 force_damping = -behavior_damping * mVelocity_local;
-
- // Drag is a force imparted by velocity (intuitively it is similar to wind resistance)
- // F = .5kv^2
- const F32 force_drag = .5*behavior_drag*velocity_joint_local*velocity_joint_local*llsgn(velocity_joint_local);
-
- const F32 force_net = (force_accel +
- force_gravity +
- force_spring +
- force_damping +
- force_drag);
-
- //
- // End total force
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Calculate new params
- //
-
- // Calculate the new acceleration based on the net force.
- // a = F/m
- const F32 acceleration_new_local = force_net / behavior_mass;
- static const F32 max_velocity = 100.0f; // magic number, used to be customizable.
- F32 velocity_new_local = mVelocity_local + acceleration_new_local*time_iteration_step;
- velocity_new_local = llclamp(velocity_new_local,
- -max_velocity, max_velocity);
-
- // Temporary debugging setting to cause all avatars to move, for profiling purposes.
- if (physics_test)
- {
- velocity_new_local = sin(time*4.0);
- }
- // Calculate the new parameters, or remain unchanged if max speed is 0.
- F32 position_new_local = position_current_local + velocity_new_local*time_iteration_step;
- if (behavior_maxeffect == 0)
- position_new_local = position_user_local;
-
- // Zero out the velocity if the param is being pushed beyond its limits.
- if ((position_new_local < 0 && velocity_new_local < 0) ||
- (position_new_local > 1 && velocity_new_local > 0))
- {
- velocity_new_local = 0;
- }
-
- // Check for NaN values. A NaN value is detected if the variables doesn't equal itself.
- // If NaN, then reset everything.
- if ((mPosition_local != mPosition_local) ||
- (mVelocity_local != mVelocity_local) ||
- (position_new_local != position_new_local))
- {
- position_new_local = 0;
- mVelocity_local = 0;
- mVelocityJoint_local = 0;
- mAccelerationJoint_local = 0;
- mPosition_local = 0;
- mPosition_world = LLVector3(0,0,0);
- }
-
- const F32 position_new_local_clamped = llclamp(position_new_local,
- 0.0f,
- 1.0f);
-
- LLDriverParam *driver_param = dynamic_cast<LLDriverParam *>(mParamDriver);
- llassert_always(driver_param);
- if (driver_param)
- {
- // If this is one of our "hidden" driver params, then make sure it's
- // the default value.
- if ((driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) &&
- (driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT))
- {
- mCharacter->setVisualParamWeight(driver_param, 0);
- }
- S32 num_driven = driver_param->getDrivenParamsCount();
- for (S32 i = 0; i < num_driven; ++i)
- {
- const LLViewerVisualParam *driven_param = driver_param->getDrivenParam(i);
- setParamValue(driven_param,position_new_local_clamped, behavior_maxeffect);
- }
- }
-
- //
- // End calculate new params
- ////////////////////////////////////////////////////////////////////////////////
-
- ////////////////////////////////////////////////////////////////////////////////
- // Conditionally update the visual params
- //
-
- // Updating the visual params (i.e. what the user sees) is fairly expensive.
- // So only update if the params have changed enough, and also take into account
- // the graphics LOD settings.
-
- // For non-self, if the avatar is small enough visually, then don't update.
- const F32 area_for_max_settings = 0.0;
- const F32 area_for_min_settings = 1400.0;
- const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor);
- const F32 pixel_area = sqrtf(mCharacter->getPixelArea());
-
- const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(mCharacter) != NULL);
- if ((pixel_area > area_for_this_setting) || is_self)
- {
- const F32 position_diff_local = llabs(mPositionLastUpdate_local-position_new_local_clamped);
- const F32 min_delta = (1.0001f-lod_factor)*0.4f;
- if (llabs(position_diff_local) > min_delta)
- {
- update_visuals = TRUE;
- mPositionLastUpdate_local = position_new_local;
- }
- }
-
- //
- // End update visual params
- ////////////////////////////////////////////////////////////////////////////////
-
- mVelocity_local = velocity_new_local;
- mAccelerationJoint_local = acceleration_joint_local;
- mPosition_local = position_new_local;
- }
- mLastTime = time;
- mPosition_world = joint->getWorldPosition();
- mVelocityJoint_local = velocity_joint_local;
+
+ //
+ // End velocity and acceleration
+ ////////////////////////////////////////////////////////////////////////////////
+
+ BOOL update_visuals = FALSE;
+
+ // Break up the physics into a bunch of iterations so that differing framerates will show
+ // roughly the same behavior.
+ // Explanation/example: Lets assume we have a bouncing object. Said abjects bounces at a
+ // trajectory that has points A>B>C. Object bounces from A to B with specific speed.
+ // It needs time T to move from A to B.
+ // As long as our frame's time significantly smaller then T our motion will be split into
+ // multiple parts. with each part speed will decrease. Object will reach B position (roughly)
+ // and bounce/fall back to A.
+ // But if frame's time (F_T) is larger then T, object will move with same speed for whole F_T
+ // and will jump over point B up to C ending up with increased amplitude. To avoid that we
+ // split F_T into smaller portions so that when frame's time is too long object can virtually
+ // bounce at right (relatively) position.
+ // Note: this doesn't look to be optimal, since it provides only "roughly same" behavior, but
+ // irregularity at higher fps looks to be insignificant so it works good enough for low fps.
+ U32 steps = (U32)(time_delta / TIME_ITERATION_STEP_MAX) + 1;
+ F32 time_iteration_step = time_delta / (F32)steps; //minimal step size ends up as 0.025
+ for (U32 i = 0; i < steps; i++)
+ {
+ // mPositon_local should be in normalized 0,1 range already. Just making sure...
+ const F32 position_current_local = llclamp(mPosition_local,
+ 0.0f,
+ 1.0f);
+ // If the effect is turned off then don't process unless we need one more update
+ // to set the position to the default (i.e. user) position.
+ if ((behavior_maxeffect == 0) && (position_current_local == position_user_local))
+ {
+ return update_visuals;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Calculate the total force
+ //
+
+ // Spring force is a restoring force towards the original user-set breast position.
+ // F = kx
+ const F32 spring_length = position_current_local - position_user_local;
+ const F32 force_spring = -spring_length * behavior_spring;
+
+ // Acceleration is the force that comes from the change in velocity of the torso.
+ // F = ma
+ const F32 force_accel = behavior_gain * (acceleration_joint_local * behavior_mass);
+
+ // Gravity always points downward in world space.
+ // F = mg
+ const LLVector3 gravity_world(0,0,1);
+ const F32 force_gravity = (toLocal(gravity_world) * behavior_gravity * behavior_mass);
+
+ // Damping is a restoring force that opposes the current velocity.
+ // F = -kv
+ const F32 force_damping = -behavior_damping * mVelocity_local;
+
+ // Drag is a force imparted by velocity (intuitively it is similar to wind resistance)
+ // F = .5kv^2
+ const F32 force_drag = .5*behavior_drag*velocity_joint_local*velocity_joint_local*llsgn(velocity_joint_local);
+
+ const F32 force_net = (force_accel +
+ force_gravity +
+ force_spring +
+ force_damping +
+ force_drag);
+
+ //
+ // End total force
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Calculate new params
+ //
+
+ // Calculate the new acceleration based on the net force.
+ // a = F/m
+ const F32 acceleration_new_local = force_net / behavior_mass;
+ static const F32 max_velocity = 100.0f; // magic number, used to be customizable.
+ F32 velocity_new_local = mVelocity_local + acceleration_new_local*time_iteration_step;
+ velocity_new_local = llclamp(velocity_new_local,
+ -max_velocity, max_velocity);
+
+ // Temporary debugging setting to cause all avatars to move, for profiling purposes.
+ if (physics_test)
+ {
+ velocity_new_local = sin(time*4.0);
+ }
+ // Calculate the new parameters, or remain unchanged if max speed is 0.
+ F32 position_new_local = position_current_local + velocity_new_local*time_iteration_step;
+ if (behavior_maxeffect == 0)
+ position_new_local = position_user_local;
+
+ // Zero out the velocity if the param is being pushed beyond its limits.
+ if ((position_new_local < 0 && velocity_new_local < 0) ||
+ (position_new_local > 1 && velocity_new_local > 0))
+ {
+ velocity_new_local = 0;
+ }
+
+ // Check for NaN values. A NaN value is detected if the variables doesn't equal itself.
+ // If NaN, then reset everything.
+ if ((mPosition_local != mPosition_local) ||
+ (mVelocity_local != mVelocity_local) ||
+ (position_new_local != position_new_local))
+ {
+ position_new_local = 0;
+ mVelocity_local = 0;
+ mVelocityJoint_local = 0;
+ mAccelerationJoint_local = 0;
+ mPosition_local = 0;
+ mPosition_world = LLVector3(0,0,0);
+ }
+
+ const F32 position_new_local_clamped = llclamp(position_new_local,
+ 0.0f,
+ 1.0f);
+
+ LLDriverParam *driver_param = dynamic_cast<LLDriverParam *>(mParamDriver);
+ llassert_always(driver_param);
+ if (driver_param)
+ {
+ // If this is one of our "hidden" driver params, then make sure it's
+ // the default value.
+ if ((driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) &&
+ (driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT))
+ {
+ mCharacter->setVisualParamWeight(driver_param, 0);
+ }
+ S32 num_driven = driver_param->getDrivenParamsCount();
+ for (S32 i = 0; i < num_driven; ++i)
+ {
+ const LLViewerVisualParam *driven_param = driver_param->getDrivenParam(i);
+ setParamValue(driven_param,position_new_local_clamped, behavior_maxeffect);
+ }
+ }
+
+ //
+ // End calculate new params
+ ////////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Conditionally update the visual params
+ //
+
+ // Updating the visual params (i.e. what the user sees) is fairly expensive.
+ // So only update if the params have changed enough, and also take into account
+ // the graphics LOD settings.
+
+ // For non-self, if the avatar is small enough visually, then don't update.
+ const F32 area_for_max_settings = 0.0;
+ const F32 area_for_min_settings = 1400.0;
+ const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor);
+ const F32 pixel_area = sqrtf(mCharacter->getPixelArea());
+
+ const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(mCharacter) != NULL);
+ if ((pixel_area > area_for_this_setting) || is_self)
+ {
+ const F32 position_diff_local = llabs(mPositionLastUpdate_local-position_new_local_clamped);
+ const F32 min_delta = (1.0001f-lod_factor)*0.4f;
+ if (llabs(position_diff_local) > min_delta)
+ {
+ update_visuals = TRUE;
+ mPositionLastUpdate_local = position_new_local;
+ }
+ }
+
+ //
+ // End update visual params
+ ////////////////////////////////////////////////////////////////////////////////
+
+ mVelocity_local = velocity_new_local;
+ mAccelerationJoint_local = acceleration_joint_local;
+ mPosition_local = position_new_local;
+ }
+ mLastTime = time;
+ mPosition_world = joint->getWorldPosition();
+ mVelocityJoint_local = velocity_joint_local;
/*
@@ -759,17 +759,17 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
// Range of new_value_local is assumed to be [0 , 1] normalized.
void LLPhysicsMotion::setParamValue(const LLViewerVisualParam *param,
F32 new_value_normalized,
- F32 behavior_maxeffect)
+ F32 behavior_maxeffect)
{
const F32 value_min_local = param->getMinWeight();
const F32 value_max_local = param->getMaxWeight();
const F32 min_val = 0.5f-behavior_maxeffect/2.0;
const F32 max_val = 0.5f+behavior_maxeffect/2.0;
- // Scale from [0,1] to [min_val,max_val]
- const F32 new_value_rescaled = min_val + (max_val-min_val) * new_value_normalized;
-
- // Scale from [0,1] to [value_min_local,value_max_local]
+ // Scale from [0,1] to [min_val,max_val]
+ const F32 new_value_rescaled = min_val + (max_val-min_val) * new_value_normalized;
+
+ // Scale from [0,1] to [value_min_local,value_max_local]
const F32 new_value_local = value_min_local + (value_max_local-value_min_local) * new_value_rescaled;
mCharacter->setVisualParamWeight(param, new_value_local);
diff --git a/indra/newview/llphysicsmotion.h b/indra/newview/llphysicsmotion.h
index b246fa99bb..e7c31dff52 100644
--- a/indra/newview/llphysicsmotion.h
+++ b/indra/newview/llphysicsmotion.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llphysicsmotion.h
* @brief Implementation of LLPhysicsMotion class.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,76 +42,76 @@ class LLPhysicsMotion;
// class LLPhysicsMotion
//-----------------------------------------------------------------------------
class LLPhysicsMotionController :
- public LLMotion
+ public LLMotion
{
public:
- // Constructor
- LLPhysicsMotionController(const LLUUID &id);
+ // Constructor
+ LLPhysicsMotionController(const LLUUID &id);
- // Destructor
- virtual ~LLPhysicsMotionController();
+ // Destructor
+ virtual ~LLPhysicsMotionController();
public:
- //-------------------------------------------------------------------------
- // functions to support MotionController and MotionRegistry
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ // functions to support MotionController and MotionRegistry
+ //-------------------------------------------------------------------------
- // static constructor
- // all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLPhysicsMotionController(id); }
+ // static constructor
+ // all subclasses must implement such a function and register it
+ static LLMotion *create(const LLUUID &id) { return new LLPhysicsMotionController(id); }
public:
- //-------------------------------------------------------------------------
- // animation callbacks to be implemented by subclasses
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ // animation callbacks to be implemented by subclasses
+ //-------------------------------------------------------------------------
- // motions must specify whether or not they loop
- virtual BOOL getLoop() { return TRUE; }
+ // motions must specify whether or not they loop
+ virtual BOOL getLoop() { return TRUE; }
- // motions must report their total duration
- virtual F32 getDuration() { return 0.0; }
+ // motions must report their total duration
+ virtual F32 getDuration() { return 0.0; }
- // motions must report their "ease in" duration
- virtual F32 getEaseInDuration() { return PHYSICS_MOTION_FADEIN_TIME; }
+ // motions must report their "ease in" duration
+ virtual F32 getEaseInDuration() { return PHYSICS_MOTION_FADEIN_TIME; }
- // motions must report their "ease out" duration.
- virtual F32 getEaseOutDuration() { return PHYSICS_MOTION_FADEOUT_TIME; }
+ // motions must report their "ease out" duration.
+ virtual F32 getEaseOutDuration() { return PHYSICS_MOTION_FADEOUT_TIME; }
- // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
- virtual F32 getMinPixelArea();
+ // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
+ virtual F32 getMinPixelArea();
- // motions must report their priority
- virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
+ // motions must report their priority
+ virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
- virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
+ virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
- // run-time (post constructor) initialization,
- // called after parameters have been set
- // must return true to indicate success and be available for activation
- virtual LLMotionInitStatus onInitialize(LLCharacter *character);
+ // run-time (post constructor) initialization,
+ // called after parameters have been set
+ // must return true to indicate success and be available for activation
+ virtual LLMotionInitStatus onInitialize(LLCharacter *character);
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate();
+ // called when a motion is activated
+ // must return TRUE to indicate success, or else
+ // it will be deactivated
+ virtual BOOL onActivate();
- // called per time step
- // must return TRUE while it is active, and
- // must return FALSE when the motion is completed.
- virtual BOOL onUpdate(F32 time, U8* joint_mask);
+ // called per time step
+ // must return TRUE while it is active, and
+ // must return FALSE when the motion is completed.
+ virtual BOOL onUpdate(F32 time, U8* joint_mask);
- // called when a motion is deactivated
- virtual void onDeactivate();
+ // called when a motion is deactivated
+ virtual void onDeactivate();
- LLCharacter* getCharacter() { return mCharacter; }
+ LLCharacter* getCharacter() { return mCharacter; }
protected:
- void addMotion(LLPhysicsMotion *motion);
+ void addMotion(LLPhysicsMotion *motion);
private:
- LLCharacter* mCharacter;
+ LLCharacter* mCharacter;
- typedef std::vector<LLPhysicsMotion *> motion_vec_t;
- motion_vec_t mMotions;
+ typedef std::vector<LLPhysicsMotion *> motion_vec_t;
+ motion_vec_t mMotions;
};
#endif // LL_LLPHYSICSMOTION_H
diff --git a/indra/newview/llphysicsshapebuilderutil.cpp b/indra/newview/llphysicsshapebuilderutil.cpp
index 9603ee6329..37534feadc 100644
--- a/indra/newview/llphysicsshapebuilderutil.cpp
+++ b/indra/newview/llphysicsshapebuilderutil.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llphysicsshapebuilder.cpp
* @brief Generic system to convert LL(Physics)VolumeParams to physics shapes
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,175 +31,175 @@
/* static */
void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumeParams& volume_params, const LLVector3& scale, PhysicsShapeSpecification& specOut)
{
- const LLProfileParams& profile_params = volume_params.getProfileParams();
- const LLPathParams& path_params = volume_params.getPathParams();
-
- specOut.mScale = scale;
-
- const F32 avgScale = ( scale[VX] + scale[VY] + scale[VZ] )/3.0f;
-
- // count the scale elements that are small
- S32 min_size_counts = 0;
- for (S32 i = 0; i < 3; ++i)
- {
- if (scale[i] < SHAPE_BUILDER_CONVEXIFICATION_SIZE)
- {
- ++min_size_counts;
- }
- }
-
- const bool profile_complete = ( profile_params.getBegin() <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale ) &&
- ( profile_params.getEnd() >= (1.0f - SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale) );
-
- const bool path_complete = ( path_params.getBegin() <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale ) &&
- ( path_params.getEnd() >= (1.0f - SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale) );
-
- const bool simple_params = ( volume_params.getHollow() <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_HOLLOW/avgScale )
- && ( fabs(path_params.getShearX()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_SHEAR/avgScale )
- && ( fabs(path_params.getShearY()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_SHEAR/avgScale )
- && ( !volume_params.isMeshSculpt() && !volume_params.isSculpt() );
-
- if (simple_params && profile_complete)
- {
- // Try to create an implicit shape or convexified
- bool no_taper = ( fabs(path_params.getScaleX() - 1.0f) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TAPER/avgScale )
- && ( fabs(path_params.getScaleY() - 1.0f) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TAPER/avgScale );
-
- bool no_twist = ( fabs(path_params.getTwistBegin()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TWIST/avgScale )
- && ( fabs(path_params.getTwistEnd()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TWIST/avgScale);
-
- // Box
- if(
- ( profile_params.getCurveType() == LL_PCODE_PROFILE_SQUARE )
- && ( path_params.getCurveType() == LL_PCODE_PATH_LINE )
- && no_taper
- && no_twist
- )
- {
- specOut.mType = PhysicsShapeSpecification::BOX;
- if ( path_complete )
- {
- return;
- }
- else
- {
- // Side lengths
- specOut.mScale[VX] = llmax( scale[VX], SHAPE_BUILDER_MIN_GEOMETRY_SIZE );
- specOut.mScale[VY] = llmax( scale[VY], SHAPE_BUILDER_MIN_GEOMETRY_SIZE );
- specOut.mScale[VZ] = llmax( scale[VZ] * (path_params.getEnd() - path_params.getBegin()), SHAPE_BUILDER_MIN_GEOMETRY_SIZE );
-
- specOut.mCenter.set( 0.f, 0.f, 0.5f * scale[VZ] * ( path_params.getEnd() + path_params.getBegin() - 1.0f ) );
- return;
- }
- }
-
- // Sphere
- if( path_complete
- && ( profile_params.getCurveType() == LL_PCODE_PROFILE_CIRCLE_HALF )
- && ( path_params.getCurveType() == LL_PCODE_PATH_CIRCLE )
- && ( fabs(volume_params.getTaper()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TAPER/avgScale )
- && no_twist
- )
- {
- if ( ( scale[VX] == scale[VZ] )
- && ( scale[VY] == scale[VZ] ) )
- {
- // perfect sphere
- specOut.mType = PhysicsShapeSpecification::SPHERE;
- specOut.mScale = scale;
- return;
- }
- else if (min_size_counts > 1)
- {
- // small or narrow sphere -- we can boxify
- for (S32 i=0; i<3; ++i)
- {
- if (specOut.mScale[i] < SHAPE_BUILDER_CONVEXIFICATION_SIZE)
- {
- // reduce each small dimension size to split the approximation errors
- specOut.mScale[i] *= 0.75f;
- }
- }
- specOut.mType = PhysicsShapeSpecification::BOX;
- return;
- }
- }
-
- // Cylinder
- if( (scale[VX] == scale[VY])
- && ( profile_params.getCurveType() == LL_PCODE_PROFILE_CIRCLE )
- && ( path_params.getCurveType() == LL_PCODE_PATH_LINE )
- && ( volume_params.getBeginS() <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale )
- && ( volume_params.getEndS() >= (1.0f - SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale) )
- && no_taper
- )
- {
- if (min_size_counts > 1)
- {
- // small or narrow sphere -- we can boxify
- for (S32 i=0; i<3; ++i)
- {
- if (specOut.mScale[i] < SHAPE_BUILDER_CONVEXIFICATION_SIZE)
- {
- // reduce each small dimension size to split the approximation errors
- specOut.mScale[i] *= 0.75f;
- }
- }
-
- specOut.mType = PhysicsShapeSpecification::BOX;
- }
- else
- {
- specOut.mType = PhysicsShapeSpecification::CYLINDER;
- F32 length = (volume_params.getPathParams().getEnd() - volume_params.getPathParams().getBegin()) * scale[VZ];
-
- specOut.mScale[VY] = specOut.mScale[VX];
- specOut.mScale[VZ] = length;
- // The minus one below fixes the fact that begin and end range from 0 to 1 not -1 to 1.
- specOut.mCenter.set( 0.f, 0.f, 0.5f * (volume_params.getPathParams().getBegin() + volume_params.getPathParams().getEnd() - 1.f) * scale[VZ] );
- }
-
- return;
- }
- }
-
- if ( (min_size_counts == 3 )
- // Possible dead code here--who wants to take it out?
- || (path_complete
- && profile_complete
- && ( path_params.getCurveType() == LL_PCODE_PATH_LINE )
- && (min_size_counts > 1 ) )
- )
- {
- // it isn't simple but
- // we might be able to convexify this shape if the path and profile are complete
- // or the path is linear and both path and profile are complete --> we can boxify it
- specOut.mType = PhysicsShapeSpecification::BOX;
- specOut.mScale = scale;
- return;
- }
-
- // Special case for big, very thin objects - bump the small dimensions up to the COLLISION_TOLERANCE
- if (min_size_counts == 1 // One dimension is small
- && avgScale > 3.f) // ... but others are fairly large
- {
- for (S32 i = 0; i < 3; ++i)
- {
- specOut.mScale[i] = llmax( specOut.mScale[i], COLLISION_TOLERANCE );
- }
- }
-
- if ( volume_params.shouldForceConvex() )
- {
+ const LLProfileParams& profile_params = volume_params.getProfileParams();
+ const LLPathParams& path_params = volume_params.getPathParams();
+
+ specOut.mScale = scale;
+
+ const F32 avgScale = ( scale[VX] + scale[VY] + scale[VZ] )/3.0f;
+
+ // count the scale elements that are small
+ S32 min_size_counts = 0;
+ for (S32 i = 0; i < 3; ++i)
+ {
+ if (scale[i] < SHAPE_BUILDER_CONVEXIFICATION_SIZE)
+ {
+ ++min_size_counts;
+ }
+ }
+
+ const bool profile_complete = ( profile_params.getBegin() <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale ) &&
+ ( profile_params.getEnd() >= (1.0f - SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale) );
+
+ const bool path_complete = ( path_params.getBegin() <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale ) &&
+ ( path_params.getEnd() >= (1.0f - SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale) );
+
+ const bool simple_params = ( volume_params.getHollow() <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_HOLLOW/avgScale )
+ && ( fabs(path_params.getShearX()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_SHEAR/avgScale )
+ && ( fabs(path_params.getShearY()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_SHEAR/avgScale )
+ && ( !volume_params.isMeshSculpt() && !volume_params.isSculpt() );
+
+ if (simple_params && profile_complete)
+ {
+ // Try to create an implicit shape or convexified
+ bool no_taper = ( fabs(path_params.getScaleX() - 1.0f) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TAPER/avgScale )
+ && ( fabs(path_params.getScaleY() - 1.0f) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TAPER/avgScale );
+
+ bool no_twist = ( fabs(path_params.getTwistBegin()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TWIST/avgScale )
+ && ( fabs(path_params.getTwistEnd()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TWIST/avgScale);
+
+ // Box
+ if(
+ ( profile_params.getCurveType() == LL_PCODE_PROFILE_SQUARE )
+ && ( path_params.getCurveType() == LL_PCODE_PATH_LINE )
+ && no_taper
+ && no_twist
+ )
+ {
+ specOut.mType = PhysicsShapeSpecification::BOX;
+ if ( path_complete )
+ {
+ return;
+ }
+ else
+ {
+ // Side lengths
+ specOut.mScale[VX] = llmax( scale[VX], SHAPE_BUILDER_MIN_GEOMETRY_SIZE );
+ specOut.mScale[VY] = llmax( scale[VY], SHAPE_BUILDER_MIN_GEOMETRY_SIZE );
+ specOut.mScale[VZ] = llmax( scale[VZ] * (path_params.getEnd() - path_params.getBegin()), SHAPE_BUILDER_MIN_GEOMETRY_SIZE );
+
+ specOut.mCenter.set( 0.f, 0.f, 0.5f * scale[VZ] * ( path_params.getEnd() + path_params.getBegin() - 1.0f ) );
+ return;
+ }
+ }
+
+ // Sphere
+ if( path_complete
+ && ( profile_params.getCurveType() == LL_PCODE_PROFILE_CIRCLE_HALF )
+ && ( path_params.getCurveType() == LL_PCODE_PATH_CIRCLE )
+ && ( fabs(volume_params.getTaper()) <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_TAPER/avgScale )
+ && no_twist
+ )
+ {
+ if ( ( scale[VX] == scale[VZ] )
+ && ( scale[VY] == scale[VZ] ) )
+ {
+ // perfect sphere
+ specOut.mType = PhysicsShapeSpecification::SPHERE;
+ specOut.mScale = scale;
+ return;
+ }
+ else if (min_size_counts > 1)
+ {
+ // small or narrow sphere -- we can boxify
+ for (S32 i=0; i<3; ++i)
+ {
+ if (specOut.mScale[i] < SHAPE_BUILDER_CONVEXIFICATION_SIZE)
+ {
+ // reduce each small dimension size to split the approximation errors
+ specOut.mScale[i] *= 0.75f;
+ }
+ }
+ specOut.mType = PhysicsShapeSpecification::BOX;
+ return;
+ }
+ }
+
+ // Cylinder
+ if( (scale[VX] == scale[VY])
+ && ( profile_params.getCurveType() == LL_PCODE_PROFILE_CIRCLE )
+ && ( path_params.getCurveType() == LL_PCODE_PATH_LINE )
+ && ( volume_params.getBeginS() <= SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale )
+ && ( volume_params.getEndS() >= (1.0f - SHAPE_BUILDER_IMPLICIT_THRESHOLD_PATH_CUT/avgScale) )
+ && no_taper
+ )
+ {
+ if (min_size_counts > 1)
+ {
+ // small or narrow sphere -- we can boxify
+ for (S32 i=0; i<3; ++i)
+ {
+ if (specOut.mScale[i] < SHAPE_BUILDER_CONVEXIFICATION_SIZE)
+ {
+ // reduce each small dimension size to split the approximation errors
+ specOut.mScale[i] *= 0.75f;
+ }
+ }
+
+ specOut.mType = PhysicsShapeSpecification::BOX;
+ }
+ else
+ {
+ specOut.mType = PhysicsShapeSpecification::CYLINDER;
+ F32 length = (volume_params.getPathParams().getEnd() - volume_params.getPathParams().getBegin()) * scale[VZ];
+
+ specOut.mScale[VY] = specOut.mScale[VX];
+ specOut.mScale[VZ] = length;
+ // The minus one below fixes the fact that begin and end range from 0 to 1 not -1 to 1.
+ specOut.mCenter.set( 0.f, 0.f, 0.5f * (volume_params.getPathParams().getBegin() + volume_params.getPathParams().getEnd() - 1.f) * scale[VZ] );
+ }
+
+ return;
+ }
+ }
+
+ if ( (min_size_counts == 3 )
+ // Possible dead code here--who wants to take it out?
+ || (path_complete
+ && profile_complete
+ && ( path_params.getCurveType() == LL_PCODE_PATH_LINE )
+ && (min_size_counts > 1 ) )
+ )
+ {
+ // it isn't simple but
+ // we might be able to convexify this shape if the path and profile are complete
+ // or the path is linear and both path and profile are complete --> we can boxify it
+ specOut.mType = PhysicsShapeSpecification::BOX;
+ specOut.mScale = scale;
+ return;
+ }
+
+ // Special case for big, very thin objects - bump the small dimensions up to the COLLISION_TOLERANCE
+ if (min_size_counts == 1 // One dimension is small
+ && avgScale > 3.f) // ... but others are fairly large
+ {
+ for (S32 i = 0; i < 3; ++i)
+ {
+ specOut.mScale[i] = llmax( specOut.mScale[i], COLLISION_TOLERANCE );
+ }
+ }
+
+ if ( volume_params.shouldForceConvex() )
+ {
// Server distinguishes between convex of a prim vs isSculpt, but we don't care.
- specOut.mType = PhysicsShapeSpecification::USER_CONVEX;
- }
- // Make a simpler convex shape if we can.
- else if (volume_params.isConvex() // is convex
- || min_size_counts > 1 ) // two or more small dimensions
- {
- specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
- }
+ specOut.mType = PhysicsShapeSpecification::USER_CONVEX;
+ }
+ // Make a simpler convex shape if we can.
+ else if (volume_params.isConvex() // is convex
+ || min_size_counts > 1 ) // two or more small dimensions
+ {
+ specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
+ }
else if (volume_params.isMeshSculpt() &&
// Check overall dimensions, not individual triangles.
(scale.mV[0] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE ||
@@ -210,12 +210,12 @@ void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumePara
// Server distinguishes between user-specified or default convex mesh, vs server's thin-triangle override, but we don't.
specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
}
- else if ( volume_params.isSculpt() ) // Is a sculpt of any kind (mesh or legacy)
- {
- specOut.mType = volume_params.isMeshSculpt() ? PhysicsShapeSpecification::USER_MESH : PhysicsShapeSpecification::SCULPT;
- }
- else // Resort to mesh
- {
- specOut.mType = PhysicsShapeSpecification::PRIM_MESH;
- }
+ else if ( volume_params.isSculpt() ) // Is a sculpt of any kind (mesh or legacy)
+ {
+ specOut.mType = volume_params.isMeshSculpt() ? PhysicsShapeSpecification::USER_MESH : PhysicsShapeSpecification::SCULPT;
+ }
+ else // Resort to mesh
+ {
+ specOut.mType = PhysicsShapeSpecification::PRIM_MESH;
+ }
}
diff --git a/indra/newview/llphysicsshapebuilderutil.h b/indra/newview/llphysicsshapebuilderutil.h
index b3b100296f..0f3baa2c7f 100644
--- a/indra/newview/llphysicsshapebuilderutil.h
+++ b/indra/newview/llphysicsshapebuilderutil.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llphysicsshapebuilder.h
* @brief Generic system to convert LL(Physics)VolumeParams to physics shapes
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,33 +53,33 @@ class LLPhysicsVolumeParams : public LLVolumeParams
{
public:
- LLPhysicsVolumeParams( const LLVolumeParams& params, bool forceConvex ) :
- LLVolumeParams( params ),
- mForceConvex(forceConvex) {}
+ LLPhysicsVolumeParams( const LLVolumeParams& params, bool forceConvex ) :
+ LLVolumeParams( params ),
+ mForceConvex(forceConvex) {}
- bool operator==(const LLPhysicsVolumeParams &params) const
- {
- return ( LLVolumeParams::operator==(params) && (mForceConvex == params.mForceConvex) );
- }
+ bool operator==(const LLPhysicsVolumeParams &params) const
+ {
+ return ( LLVolumeParams::operator==(params) && (mForceConvex == params.mForceConvex) );
+ }
- bool operator!=(const LLPhysicsVolumeParams &params) const
- {
- return !operator==(params);
- }
+ bool operator!=(const LLPhysicsVolumeParams &params) const
+ {
+ return !operator==(params);
+ }
- bool operator<(const LLPhysicsVolumeParams &params) const
- {
- if ( LLVolumeParams::operator!=(params) )
- {
- return LLVolumeParams::operator<(params);
- }
- return (params.mForceConvex == false) && (mForceConvex == true);
- }
+ bool operator<(const LLPhysicsVolumeParams &params) const
+ {
+ if ( LLVolumeParams::operator!=(params) )
+ {
+ return LLVolumeParams::operator<(params);
+ }
+ return (params.mForceConvex == false) && (mForceConvex == true);
+ }
- bool shouldForceConvex() const { return mForceConvex; }
+ bool shouldForceConvex() const { return mForceConvex; }
private:
- bool mForceConvex;
+ bool mForceConvex;
};
@@ -87,55 +87,55 @@ class LLPhysicsShapeBuilderUtil
{
public:
- class PhysicsShapeSpecification
- {
- public:
- enum ShapeType
- {
- // Primitive types
- BOX,
- SPHERE,
- CYLINDER,
+ class PhysicsShapeSpecification
+ {
+ public:
+ enum ShapeType
+ {
+ // Primitive types
+ BOX,
+ SPHERE,
+ CYLINDER,
+
+ USER_CONVEX, // User specified they wanted the convex hull of the volume
- USER_CONVEX, // User specified they wanted the convex hull of the volume
+ PRIM_CONVEX, // Either a volume that is inherently convex but not a primitive type, or a shape
+ // with dimensions such that will convexify it anyway.
- PRIM_CONVEX, // Either a volume that is inherently convex but not a primitive type, or a shape
- // with dimensions such that will convexify it anyway.
+ SCULPT, // Special case for traditional sculpts--they are the convex hull of a single particular set of volume params
- SCULPT, // Special case for traditional sculpts--they are the convex hull of a single particular set of volume params
+ USER_MESH, // A user mesh. May or may not contain a convex decomposition.
- USER_MESH, // A user mesh. May or may not contain a convex decomposition.
+ PRIM_MESH, // A non-convex volume which we have to represent accurately
- PRIM_MESH, // A non-convex volume which we have to represent accurately
+ INVALID
+ };
- INVALID
- };
+ PhysicsShapeSpecification() :
+ mType( INVALID ),
+ mScale( 0.f, 0.f, 0.f ),
+ mCenter( 0.f, 0.f, 0.f ) {}
- PhysicsShapeSpecification() :
- mType( INVALID ),
- mScale( 0.f, 0.f, 0.f ),
- mCenter( 0.f, 0.f, 0.f ) {}
-
- bool isConvex() { return (mType != USER_MESH && mType != PRIM_MESH && mType != INVALID); }
- bool isMesh() { return (mType == USER_MESH) || (mType == PRIM_MESH); }
+ bool isConvex() { return (mType != USER_MESH && mType != PRIM_MESH && mType != INVALID); }
+ bool isMesh() { return (mType == USER_MESH) || (mType == PRIM_MESH); }
- ShapeType getType() { return mType; }
- const LLVector3& getScale() { return mScale; }
- const LLVector3& getCenter() { return mCenter; }
+ ShapeType getType() { return mType; }
+ const LLVector3& getScale() { return mScale; }
+ const LLVector3& getCenter() { return mCenter; }
- private:
- friend class LLPhysicsShapeBuilderUtil;
+ private:
+ friend class LLPhysicsShapeBuilderUtil;
- ShapeType mType;
+ ShapeType mType;
- // Dimensions of an AABB around the shape
- LLVector3 mScale;
+ // Dimensions of an AABB around the shape
+ LLVector3 mScale;
- // Offset of shape from origin of primitive's reference frame
- LLVector3 mCenter;
- };
+ // Offset of shape from origin of primitive's reference frame
+ LLVector3 mCenter;
+ };
- static void determinePhysicsShape( const LLPhysicsVolumeParams& volume_params, const LLVector3& scale, PhysicsShapeSpecification& specOut );
+ static void determinePhysicsShape( const LLPhysicsVolumeParams& volume_params, const LLVector3& scale, PhysicsShapeSpecification& specOut );
};
#endif //LL_PHYSICS_SHAPE_BUILDER_H
diff --git a/indra/newview/llpipelinelistener.cpp b/indra/newview/llpipelinelistener.cpp
index f11cdcf876..df65e94b48 100644
--- a/indra/newview/llpipelinelistener.cpp
+++ b/indra/newview/llpipelinelistener.cpp
@@ -3,25 +3,25 @@
* @author Don Kjer
* @date 2012-07-09
* @brief Implementation for LLPipelineListener
- *
+ *
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,179 +38,179 @@
namespace {
- // Render Types
- void toggle_render_types_wrapper(LLSD const& request)
- {
- for (LLSD::array_const_iterator iter = request["types"].beginArray();
- iter != request["types"].endArray();
- ++iter)
- {
- U32 render_type = render_type_from_string( iter->asString() );
- if ( render_type != 0 )
- {
- LLPipeline::toggleRenderTypeControl( render_type );
- }
- }
- }
-
- void has_render_type_wrapper(LLSD const& request)
- {
- LLEventAPI::Response response(LLSD(), request);
- U32 render_type = render_type_from_string( request["type"].asString() );
- if ( render_type != 0 )
- {
- response["value"] = LLPipeline::hasRenderTypeControl( render_type );
- }
- else
- {
- response.error(STRINGIZE("unknown type '" << request["type"].asString() << "'"));
- }
- }
-
- void disable_all_render_types_wrapper(LLSD const& request)
- {
- gPipeline.clearAllRenderTypes();
- }
-
- void enable_all_render_types_wrapper(LLSD const& request)
- {
- gPipeline.setAllRenderTypes();
- }
-
- // Render Features
- void toggle_render_features_wrapper(LLSD const& request)
- {
- for (LLSD::array_const_iterator iter = request["features"].beginArray();
- iter != request["features"].endArray();
- ++iter)
- {
- U32 render_feature = feature_from_string( iter->asString() );
- if ( render_feature != 0 )
- {
- LLPipeline::toggleRenderDebugFeatureControl( render_feature );
- }
- }
- }
-
- void has_render_feature_wrapper(LLSD const& request)
- {
- LLEventAPI::Response response(LLSD(), request);
- U32 render_feature = feature_from_string( request["feature"].asString() );
- if ( render_feature != 0 )
- {
- response["value"] = gPipeline.hasRenderDebugFeatureMask(render_feature);
- }
- else
- {
- response.error(STRINGIZE("unknown feature '" << request["feature"].asString() << "'"));
- }
- }
-
- void disable_all_render_features_wrapper(LLSD const& request)
- {
- gPipeline.clearAllRenderDebugFeatures();
- }
-
- void enable_all_render_features_wrapper(LLSD const& request)
- {
- gPipeline.setAllRenderDebugFeatures();
- }
-
- // Render Info Displays
- void toggle_info_displays_wrapper(LLSD const& request)
- {
- for (LLSD::array_const_iterator iter = request["displays"].beginArray();
- iter != request["displays"].endArray();
- ++iter)
- {
- U64 info_display = info_display_from_string( iter->asString() );
- if ( info_display != 0 )
- {
- LLPipeline::toggleRenderDebug( info_display );
- }
- }
- }
-
- void has_info_display_wrapper(LLSD const& request)
- {
- LLEventAPI::Response response(LLSD(), request);
- U64 info_display = info_display_from_string( request["display"].asString() );
- if ( info_display != 0 )
- {
- response["value"] = gPipeline.hasRenderDebugMask(info_display);
- }
- else
- {
- response.error(STRINGIZE("unknown display '" << request["display"].asString() << "'"));
- }
- }
-
- void disable_all_info_displays_wrapper(LLSD const& request)
- {
- gPipeline.clearAllRenderDebugDisplays();
- }
-
- void enable_all_info_displays_wrapper(LLSD const& request)
- {
- gPipeline.setAllRenderDebugDisplays();
- }
+ // Render Types
+ void toggle_render_types_wrapper(LLSD const& request)
+ {
+ for (LLSD::array_const_iterator iter = request["types"].beginArray();
+ iter != request["types"].endArray();
+ ++iter)
+ {
+ U32 render_type = render_type_from_string( iter->asString() );
+ if ( render_type != 0 )
+ {
+ LLPipeline::toggleRenderTypeControl( render_type );
+ }
+ }
+ }
+
+ void has_render_type_wrapper(LLSD const& request)
+ {
+ LLEventAPI::Response response(LLSD(), request);
+ U32 render_type = render_type_from_string( request["type"].asString() );
+ if ( render_type != 0 )
+ {
+ response["value"] = LLPipeline::hasRenderTypeControl( render_type );
+ }
+ else
+ {
+ response.error(STRINGIZE("unknown type '" << request["type"].asString() << "'"));
+ }
+ }
+
+ void disable_all_render_types_wrapper(LLSD const& request)
+ {
+ gPipeline.clearAllRenderTypes();
+ }
+
+ void enable_all_render_types_wrapper(LLSD const& request)
+ {
+ gPipeline.setAllRenderTypes();
+ }
+
+ // Render Features
+ void toggle_render_features_wrapper(LLSD const& request)
+ {
+ for (LLSD::array_const_iterator iter = request["features"].beginArray();
+ iter != request["features"].endArray();
+ ++iter)
+ {
+ U32 render_feature = feature_from_string( iter->asString() );
+ if ( render_feature != 0 )
+ {
+ LLPipeline::toggleRenderDebugFeatureControl( render_feature );
+ }
+ }
+ }
+
+ void has_render_feature_wrapper(LLSD const& request)
+ {
+ LLEventAPI::Response response(LLSD(), request);
+ U32 render_feature = feature_from_string( request["feature"].asString() );
+ if ( render_feature != 0 )
+ {
+ response["value"] = gPipeline.hasRenderDebugFeatureMask(render_feature);
+ }
+ else
+ {
+ response.error(STRINGIZE("unknown feature '" << request["feature"].asString() << "'"));
+ }
+ }
+
+ void disable_all_render_features_wrapper(LLSD const& request)
+ {
+ gPipeline.clearAllRenderDebugFeatures();
+ }
+
+ void enable_all_render_features_wrapper(LLSD const& request)
+ {
+ gPipeline.setAllRenderDebugFeatures();
+ }
+
+ // Render Info Displays
+ void toggle_info_displays_wrapper(LLSD const& request)
+ {
+ for (LLSD::array_const_iterator iter = request["displays"].beginArray();
+ iter != request["displays"].endArray();
+ ++iter)
+ {
+ U64 info_display = info_display_from_string( iter->asString() );
+ if ( info_display != 0 )
+ {
+ LLPipeline::toggleRenderDebug( info_display );
+ }
+ }
+ }
+
+ void has_info_display_wrapper(LLSD const& request)
+ {
+ LLEventAPI::Response response(LLSD(), request);
+ U64 info_display = info_display_from_string( request["display"].asString() );
+ if ( info_display != 0 )
+ {
+ response["value"] = gPipeline.hasRenderDebugMask(info_display);
+ }
+ else
+ {
+ response.error(STRINGIZE("unknown display '" << request["display"].asString() << "'"));
+ }
+ }
+
+ void disable_all_info_displays_wrapper(LLSD const& request)
+ {
+ gPipeline.clearAllRenderDebugDisplays();
+ }
+
+ void enable_all_info_displays_wrapper(LLSD const& request)
+ {
+ gPipeline.setAllRenderDebugDisplays();
+ }
}
LLPipelineListener::LLPipelineListener():
- LLEventAPI("LLPipeline",
- "API to te rendering pipeline.")
+ LLEventAPI("LLPipeline",
+ "API to te rendering pipeline.")
{
- // Render Types
- add("toggleRenderTypes",
- "Toggle rendering [\"types\"]:\n"
- "See: llviewermenu.cpp:render_type_from_string for list of available types.",
- &toggle_render_types_wrapper);
- add("hasRenderType",
- "Check if rendering [\"type\"] is enabled:\n"
- "See: llviewermenu.cpp:render_type_from_string for list of available types.",
- &has_render_type_wrapper,
- LLSDMap("reply", LLSD()));
- add("disableAllRenderTypes",
- "Turn off all rendering types.",
- &disable_all_render_types_wrapper);
- add("enableAllRenderTypes",
- "Turn on all rendering types.",
- &enable_all_render_types_wrapper);
-
- // Render Features
- add("toggleRenderFeatures",
- "Toggle rendering [\"features\"]:\n"
- "See: llviewermenu.cpp:feature_from_string for list of available features.",
- &toggle_render_features_wrapper);
- add("hasRenderFeature",
- "Check if rendering [\"feature\"] is enabled:\n"
- "See: llviewermenu.cpp:render_feature_from_string for list of available features.",
- &has_render_feature_wrapper,
- LLSDMap("reply", LLSD()));
- add("disableAllRenderFeatures",
- "Turn off all rendering features.",
- &disable_all_render_features_wrapper);
- add("enableAllRenderFeatures",
- "Turn on all rendering features.",
- &enable_all_render_features_wrapper);
-
- // Render Info Displays
- add("toggleRenderInfoDisplays",
- "Toggle info [\"displays\"]:\n"
- "See: llviewermenu.cpp:info_display_from_string for list of available displays.",
- &toggle_info_displays_wrapper);
- add("hasRenderInfoDisplay",
- "Check if info [\"display\"] is enabled:\n"
- "See: llviewermenu.cpp:info_display_from_string for list of available displays.",
- &has_info_display_wrapper,
- LLSDMap("reply", LLSD()));
- add("disableAllRenderInfoDisplays",
- "Turn off all info displays.",
- &disable_all_info_displays_wrapper);
- add("enableAllRenderInfoDisplays",
- "Turn on all info displays.",
- &enable_all_info_displays_wrapper);
+ // Render Types
+ add("toggleRenderTypes",
+ "Toggle rendering [\"types\"]:\n"
+ "See: llviewermenu.cpp:render_type_from_string for list of available types.",
+ &toggle_render_types_wrapper);
+ add("hasRenderType",
+ "Check if rendering [\"type\"] is enabled:\n"
+ "See: llviewermenu.cpp:render_type_from_string for list of available types.",
+ &has_render_type_wrapper,
+ LLSDMap("reply", LLSD()));
+ add("disableAllRenderTypes",
+ "Turn off all rendering types.",
+ &disable_all_render_types_wrapper);
+ add("enableAllRenderTypes",
+ "Turn on all rendering types.",
+ &enable_all_render_types_wrapper);
+
+ // Render Features
+ add("toggleRenderFeatures",
+ "Toggle rendering [\"features\"]:\n"
+ "See: llviewermenu.cpp:feature_from_string for list of available features.",
+ &toggle_render_features_wrapper);
+ add("hasRenderFeature",
+ "Check if rendering [\"feature\"] is enabled:\n"
+ "See: llviewermenu.cpp:render_feature_from_string for list of available features.",
+ &has_render_feature_wrapper,
+ LLSDMap("reply", LLSD()));
+ add("disableAllRenderFeatures",
+ "Turn off all rendering features.",
+ &disable_all_render_features_wrapper);
+ add("enableAllRenderFeatures",
+ "Turn on all rendering features.",
+ &enable_all_render_features_wrapper);
+
+ // Render Info Displays
+ add("toggleRenderInfoDisplays",
+ "Toggle info [\"displays\"]:\n"
+ "See: llviewermenu.cpp:info_display_from_string for list of available displays.",
+ &toggle_info_displays_wrapper);
+ add("hasRenderInfoDisplay",
+ "Check if info [\"display\"] is enabled:\n"
+ "See: llviewermenu.cpp:info_display_from_string for list of available displays.",
+ &has_info_display_wrapper,
+ LLSDMap("reply", LLSD()));
+ add("disableAllRenderInfoDisplays",
+ "Turn off all info displays.",
+ &disable_all_info_displays_wrapper);
+ add("enableAllRenderInfoDisplays",
+ "Turn on all info displays.",
+ &enable_all_info_displays_wrapper);
}
diff --git a/indra/newview/llpipelinelistener.h b/indra/newview/llpipelinelistener.h
index da1898e57b..2d06ce63b3 100644
--- a/indra/newview/llpipelinelistener.h
+++ b/indra/newview/llpipelinelistener.h
@@ -3,25 +3,25 @@
* @author Don Kjer
* @date 2012-07-09
* @brief Wrap subset of LLPipeline API in event API
- *
+ *
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,7 +35,7 @@
class LLPipelineListener: public LLEventAPI
{
public:
- LLPipelineListener();
+ LLPipelineListener();
};
#endif /* ! defined(LL_LLPIPELINELISTENER_H) */
diff --git a/indra/newview/llplacesfolderview.cpp b/indra/newview/llplacesfolderview.cpp
index fe89c1e314..3661d98c2a 100644
--- a/indra/newview/llplacesfolderview.cpp
+++ b/indra/newview/llplacesfolderview.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llplacesfolderview.cpp
* @brief llplacesfolderview used within llplacesinventorypanel
* @author Gilbert@lindenlab.com
@@ -70,12 +70,12 @@ BOOL LLPlacesFolderView::handleRightMouseDown(S32 x, S32 y, MASK mask)
void LLPlacesFolderView::updateMenu()
{
- LLFolderView::updateMenu();
- LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
- if (menu && menu->getVisible())
- {
- mParentLandmarksPanel->updateMenuVisibility(menu);
- }
+ LLFolderView::updateMenu();
+ LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
+ if (menu && menu->getVisible())
+ {
+ mParentLandmarksPanel->updateMenuVisibility(menu);
+ }
}
void LLPlacesFolderView::setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle)
diff --git a/indra/newview/llplacesfolderview.h b/indra/newview/llplacesfolderview.h
index 65fe76007a..0a3d9ef21b 100644
--- a/indra/newview/llplacesfolderview.h
+++ b/indra/newview/llplacesfolderview.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llplacesfolderview.h
* @brief llplacesfolderview used within llplacesinventorypanel
* @author Gilbert@lindenlab.com
@@ -39,34 +39,34 @@ public:
struct Params : public LLInitParam::Block<Params, LLFolderView::Params>
{
Params()
- {}
+ {}
};
- LLPlacesFolderView(const LLFolderView::Params& p);
- /**
- * Handles right mouse down
- *
- * Contains workaround for EXT-2786: sets current selected list for landmark
- * panel using @c mParentLandmarksPanel which is set in @c LLLandmarksPanel::initLandmarksPanel
- */
- /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
+ LLPlacesFolderView(const LLFolderView::Params& p);
+ /**
+ * Handles right mouse down
+ *
+ * Contains workaround for EXT-2786: sets current selected list for landmark
+ * panel using @c mParentLandmarksPanel which is set in @c LLLandmarksPanel::initLandmarksPanel
+ */
+ /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
- /*virtual*/ void updateMenu();
+ /*virtual*/ void updateMenu();
- void setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle);
+ void setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle);
- void setParentLandmarksPanel(LLLandmarksPanel* panel)
- {
- mParentLandmarksPanel = panel;
- }
+ void setParentLandmarksPanel(LLLandmarksPanel* panel)
+ {
+ mParentLandmarksPanel = panel;
+ }
private:
- /**
- * holds pointer to landmark panel. This pointer is used in @c LLPlacesFolderView::handleRightMouseDown
- */
- LLLandmarksPanel* mParentLandmarksPanel;
- typedef std::map<LLInventoryType::EType, LLHandle<LLView> > inventory_type_menu_handle_t;
- inventory_type_menu_handle_t mMenuHandlesByInventoryType;
+ /**
+ * holds pointer to landmark panel. This pointer is used in @c LLPlacesFolderView::handleRightMouseDown
+ */
+ LLLandmarksPanel* mParentLandmarksPanel;
+ typedef std::map<LLInventoryType::EType, LLHandle<LLView> > inventory_type_menu_handle_t;
+ inventory_type_menu_handle_t mMenuHandlesByInventoryType;
};
diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp
index 471e1c24f3..2d207a9eee 100644
--- a/indra/newview/llplacesinventorybridge.cpp
+++ b/indra/newview/llplacesinventorybridge.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llplacesinventorybridge.cpp
* @brief Implementation of the Inventory-Folder-View-Bridge classes for Places Panel.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,162 +38,162 @@ static const std::string LANDMARKS_INVENTORY_LIST_NAME("landmarks_list");
bool is_landmarks_panel(const LLInventoryPanel* inv_panel)
{
- if (NULL == inv_panel)
- return false;
- return inv_panel->getName() == LANDMARKS_INVENTORY_LIST_NAME;
+ if (NULL == inv_panel)
+ return false;
+ return inv_panel->getName() == LANDMARKS_INVENTORY_LIST_NAME;
}
void fill_items_with_menu_items(std::vector<std::string>& items, LLMenuGL& menu)
{
- LLView::child_list_const_iter_t itor;
- for (itor = menu.beginChild(); itor != menu.endChild(); ++itor)
- {
- std::string name = (*itor)->getName();
- items.push_back(name);
- }
+ LLView::child_list_const_iter_t itor;
+ for (itor = menu.beginChild(); itor != menu.endChild(); ++itor)
+ {
+ std::string name = (*itor)->getName();
+ items.push_back(name);
+ }
}
// virtual
void LLPlacesLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- std::vector<std::string> items;
- std::vector<std::string> disabled_items;
-
- if(isItemInTrash())
- {
- items.push_back(std::string("Purge Item"));
- if (!isItemRemovable() || (gInventory.getCategory(mUUID) && !gInventory.isCategoryComplete(mUUID)))
- {
- disabled_items.push_back(std::string("Purge Item"));
- }
-
- items.push_back(std::string("Restore Item"));
- }
- else
- {
- fill_items_with_menu_items(items, menu);
-
- // Disabled items are processed via LLLandmarksPanel::isActionEnabled()
- // they should be synchronized with Places/My Landmarks/Gear menu. See EXT-1601
- }
-
- hide_context_entries(menu, items, disabled_items);
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+
+ if(isItemInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable() || (gInventory.getCategory(mUUID) && !gInventory.isCategoryComplete(mUUID)))
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ fill_items_with_menu_items(items, menu);
+
+ // Disabled items are processed via LLLandmarksPanel::isActionEnabled()
+ // they should be synchronized with Places/My Landmarks/Gear menu. See EXT-1601
+ }
+
+ hide_context_entries(menu, items, disabled_items);
}
void LLPlacesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- std::vector<std::string> items;
- std::vector<std::string> disabled_items;
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
- LLInventoryPanel* inv_panel = mInventoryPanel.get();
- bool is_open = false;
- if (inv_panel)
- {
- LLFolderViewFolder* folder = dynamic_cast<LLFolderViewFolder*>(inv_panel->getItemByID(mUUID));
- is_open = (NULL != folder) && folder->isOpen();
- }
+ LLInventoryPanel* inv_panel = mInventoryPanel.get();
+ bool is_open = false;
+ if (inv_panel)
+ {
+ LLFolderViewFolder* folder = dynamic_cast<LLFolderViewFolder*>(inv_panel->getItemByID(mUUID));
+ is_open = (NULL != folder) && folder->isOpen();
+ }
- // collect all items' names
- fill_items_with_menu_items(items, menu);
+ // collect all items' names
+ fill_items_with_menu_items(items, menu);
- // remove expand or collapse menu item depend on folder state
- std::string collapse_expand_item_to_hide(is_open ? "expand" : "collapse");
- std::vector<std::string>::iterator it = std::find(items.begin(), items.end(), collapse_expand_item_to_hide);
- if (it != items.end()) items.erase(it);
+ // remove expand or collapse menu item depend on folder state
+ std::string collapse_expand_item_to_hide(is_open ? "expand" : "collapse");
+ std::vector<std::string>::iterator it = std::find(items.begin(), items.end(), collapse_expand_item_to_hide);
+ if (it != items.end()) items.erase(it);
- // Disabled items are processed via LLLandmarksPanel::isActionEnabled()
- // they should be synchronized with Places/My Landmarks/Gear menu. See EXT-1601
+ // Disabled items are processed via LLLandmarksPanel::isActionEnabled()
+ // they should be synchronized with Places/My Landmarks/Gear menu. See EXT-1601
- // repeat parent functionality
- sSelf = getHandle(); // necessary for "New Folder" functionality
+ // repeat parent functionality
+ sSelf = getHandle(); // necessary for "New Folder" functionality
- hide_context_entries(menu, items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
}
//virtual
void LLPlacesFolderBridge::performAction(LLInventoryModel* model, std::string action)
{
- if ("expand" == action)
- {
- LLFolderViewFolder* act_folder = getFolder();
- act_folder->toggleOpen();
- }
- else if ("collapse" == action)
- {
- LLFolderViewFolder* act_folder = getFolder();
- act_folder->toggleOpen();
- }
- else
- {
- LLFolderBridge::performAction(model, action);
- }
+ if ("expand" == action)
+ {
+ LLFolderViewFolder* act_folder = getFolder();
+ act_folder->toggleOpen();
+ }
+ else if ("collapse" == action)
+ {
+ LLFolderViewFolder* act_folder = getFolder();
+ act_folder->toggleOpen();
+ }
+ else
+ {
+ LLFolderBridge::performAction(model, action);
+ }
}
LLFolderViewFolder* LLPlacesFolderBridge::getFolder()
{
- LLFolderViewFolder* folder = NULL;
- LLInventoryPanel* inv_panel = mInventoryPanel.get();
- if (inv_panel)
- {
- folder = dynamic_cast<LLFolderViewFolder*>(inv_panel->getItemByID(mUUID));
- }
-
- return folder;
+ LLFolderViewFolder* folder = NULL;
+ LLInventoryPanel* inv_panel = mInventoryPanel.get();
+ if (inv_panel)
+ {
+ folder = dynamic_cast<LLFolderViewFolder*>(inv_panel->getItemByID(mUUID));
+ }
+
+ return folder;
}
// virtual
LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge(
- LLAssetType::EType asset_type,
- LLAssetType::EType actual_asset_type,
- LLInventoryType::EType inv_type,
- LLInventoryPanel* inventory,
- LLFolderViewModelInventory* view_model,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags/* = 0x00*/) const
+ LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderViewModelInventory* view_model,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags/* = 0x00*/) const
{
- LLInvFVBridge* new_listener = NULL;
- switch(asset_type)
- {
- case LLAssetType::AT_LANDMARK:
- if(!(inv_type == LLInventoryType::IT_LANDMARK))
- {
- LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
- }
- new_listener = new LLPlacesLandmarkBridge(inv_type, inventory, root, uuid, flags);
- break;
- case LLAssetType::AT_CATEGORY:
- if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
- {
- // *TODO: Create a link folder handler instead if it is necessary
- new_listener = LLInventoryFolderViewModelBuilder::createBridge(
- asset_type,
- actual_asset_type,
- inv_type,
- inventory,
- view_model,
- root,
- uuid,
- flags);
- break;
- }
- new_listener = new LLPlacesFolderBridge(inv_type, inventory, root, uuid);
- break;
- default:
- new_listener = LLInventoryFolderViewModelBuilder::createBridge(
- asset_type,
- actual_asset_type,
- inv_type,
- inventory,
- view_model,
- root,
- uuid,
- flags);
- }
- return new_listener;
+ LLInvFVBridge* new_listener = NULL;
+ switch(asset_type)
+ {
+ case LLAssetType::AT_LANDMARK:
+ if(!(inv_type == LLInventoryType::IT_LANDMARK))
+ {
+ LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+ }
+ new_listener = new LLPlacesLandmarkBridge(inv_type, inventory, root, uuid, flags);
+ break;
+ case LLAssetType::AT_CATEGORY:
+ if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
+ {
+ // *TODO: Create a link folder handler instead if it is necessary
+ new_listener = LLInventoryFolderViewModelBuilder::createBridge(
+ asset_type,
+ actual_asset_type,
+ inv_type,
+ inventory,
+ view_model,
+ root,
+ uuid,
+ flags);
+ break;
+ }
+ new_listener = new LLPlacesFolderBridge(inv_type, inventory, root, uuid);
+ break;
+ default:
+ new_listener = LLInventoryFolderViewModelBuilder::createBridge(
+ asset_type,
+ actual_asset_type,
+ inv_type,
+ inventory,
+ view_model,
+ root,
+ uuid,
+ flags);
+ }
+ return new_listener;
}
// EOF
diff --git a/indra/newview/llplacesinventorybridge.h b/indra/newview/llplacesinventorybridge.h
index 108991210f..270e0690f5 100644
--- a/indra/newview/llplacesinventorybridge.h
+++ b/indra/newview/llplacesinventorybridge.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llplacesinventorybridge.h
* @brief Declaration of the Inventory-Folder-View-Bridge classes for Places Panel.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,21 +36,21 @@ class LLFolderViewFolder;
*/
class LLPlacesLandmarkBridge : public LLLandmarkBridge
{
- friend class LLPlacesInventoryBridgeBuilder;
+ friend class LLPlacesInventoryBridgeBuilder;
public:
- /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
+ /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
protected:
- LLPlacesLandmarkBridge(LLInventoryType::EType type,
- LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags = 0x00) :
- LLLandmarkBridge(inventory, root, uuid, flags)
- {
- mInvType = type;
- }
+ LLPlacesLandmarkBridge(LLInventoryType::EType type,
+ LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags = 0x00) :
+ LLLandmarkBridge(inventory, root, uuid, flags)
+ {
+ mInvType = type;
+ }
};
/**
@@ -58,22 +58,22 @@ protected:
*/
class LLPlacesFolderBridge : public LLFolderBridge
{
- friend class LLPlacesInventoryBridgeBuilder;
+ friend class LLPlacesInventoryBridgeBuilder;
public:
- /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
- /*virtual*/ void performAction(LLInventoryModel* model, std::string action);
+ /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
+ /*virtual*/ void performAction(LLInventoryModel* model, std::string action);
protected:
- LLPlacesFolderBridge(LLInventoryType::EType type,
- LLInventoryPanel* inventory,
- LLFolderView* root,
- const LLUUID& uuid) :
- LLFolderBridge(inventory, root, uuid)
- {
- mInvType = type;
- }
- LLFolderViewFolder* getFolder();
+ LLPlacesFolderBridge(LLInventoryType::EType type,
+ LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLFolderBridge(inventory, root, uuid)
+ {
+ mInvType = type;
+ }
+ LLFolderViewFolder* getFolder();
};
@@ -85,16 +85,16 @@ protected:
class LLPlacesInventoryBridgeBuilder : public LLInventoryFolderViewModelBuilder
{
public:
- LLPlacesInventoryBridgeBuilder() {}
+ LLPlacesInventoryBridgeBuilder() {}
- /*virtual*/ LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
- LLAssetType::EType actual_asset_type,
- LLInventoryType::EType inv_type,
- LLInventoryPanel* inventory,
- LLFolderViewModelInventory* view_model,
- LLFolderView* root,
- const LLUUID& uuid,
- U32 flags = 0x00) const;
+ /*virtual*/ LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ LLFolderViewModelInventory* view_model,
+ LLFolderView* root,
+ const LLUUID& uuid,
+ U32 flags = 0x00) const;
};
#endif // LL_LLPLACESINVENTORYBRIDGE_H
diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp
index f3455bb4f0..23e490e124 100644
--- a/indra/newview/llplacesinventorypanel.cpp
+++ b/indra/newview/llplacesinventorypanel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llplacesinventorypanel.cpp
* @brief LLPlacesInventoryPanel class definition
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,32 +42,32 @@ static LLDefaultChildRegistry::Register<LLPlacesInventoryPanel> r("places_invent
static const LLPlacesInventoryBridgeBuilder PLACES_INVENTORY_BUILDER;
-LLPlacesInventoryPanel::LLPlacesInventoryPanel(const Params& p) :
+LLPlacesInventoryPanel::LLPlacesInventoryPanel(const Params& p) :
LLAssetFilteredInventoryPanel(p),
- mSavedFolderState(NULL)
+ mSavedFolderState(NULL)
{
- mInvFVBridgeBuilder = &PLACES_INVENTORY_BUILDER;
- mSavedFolderState = new LLSaveFolderState();
- mSavedFolderState->setApply(FALSE);
+ mInvFVBridgeBuilder = &PLACES_INVENTORY_BUILDER;
+ mSavedFolderState = new LLSaveFolderState();
+ mSavedFolderState->setApply(FALSE);
}
LLPlacesInventoryPanel::~LLPlacesInventoryPanel()
{
- delete mSavedFolderState;
+ delete mSavedFolderState;
}
LLFolderView * LLPlacesInventoryPanel::createFolderRoot(LLUUID root_id )
{
LLPlacesFolderView::Params p;
-
+
p.name = getName();
p.title = getLabel();
p.rect = LLRect(0, 0, getRect().getWidth(), 0);
p.parent_panel = this;
p.tool_tip = p.name;
- p.listener = mInvFVBridgeBuilder->createBridge( LLAssetType::AT_CATEGORY,
+ p.listener = mInvFVBridgeBuilder->createBridge( LLAssetType::AT_CATEGORY,
LLAssetType::AT_CATEGORY,
LLInventoryType::IT_CATEGORY,
this,
@@ -90,41 +90,41 @@ LLFolderView * LLPlacesInventoryPanel::createFolderRoot(LLUUID root_id )
// save current folder open state
void LLPlacesInventoryPanel::saveFolderState()
{
- mSavedFolderState->setApply(FALSE);
- mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState);
+ mSavedFolderState->setApply(FALSE);
+ mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState);
}
// re-open folders which state was saved
void LLPlacesInventoryPanel::restoreFolderState()
{
- mSavedFolderState->setApply(TRUE);
- mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState);
- LLOpenFoldersWithSelection opener;
- mFolderRoot.get()->applyFunctorRecursively(opener);
- mFolderRoot.get()->scrollToShowSelection();
+ mSavedFolderState->setApply(TRUE);
+ mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState);
+ LLOpenFoldersWithSelection opener;
+ mFolderRoot.get()->applyFunctorRecursively(opener);
+ mFolderRoot.get()->scrollToShowSelection();
}
-S32 LLPlacesInventoryPanel::notify(const LLSD& info)
+S32 LLPlacesInventoryPanel::notify(const LLSD& info)
{
- if(info.has("action"))
- {
- std::string str_action = info["action"];
- if(str_action == "select_first")
- {
- return mFolderRoot.get()->notify(info);
- }
- else if(str_action == "select_last")
- {
- return mFolderRoot.get()->notify(info);
- }
- }
- return 0;
+ if(info.has("action"))
+ {
+ std::string str_action = info["action"];
+ if(str_action == "select_first")
+ {
+ return mFolderRoot.get()->notify(info);
+ }
+ else if(str_action == "select_last")
+ {
+ return mFolderRoot.get()->notify(info);
+ }
+ }
+ return 0;
}
BOOL LLPlacesInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
EAcceptance *accept, std::string &tooltip_msg)
{
- if (mAcceptsDragAndDrop)
+ if (mAcceptsDragAndDrop)
{
return LLInventoryPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
}
diff --git a/indra/newview/llplacesinventorypanel.h b/indra/newview/llplacesinventorypanel.h
index 81b623b045..755db690dd 100644
--- a/indra/newview/llplacesinventorypanel.h
+++ b/indra/newview/llplacesinventorypanel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llplacesinventorypanel.h
* @brief LLPlacesInventoryPanel class declaration
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,29 +35,29 @@ class LLFolderView;
class LLPlacesInventoryPanel : public LLAssetFilteredInventoryPanel
{
public:
- struct Params
- : public LLInitParam::Block<Params, LLAssetFilteredInventoryPanel::Params>
- {
- Params()
- {
+ struct Params
+ : public LLInitParam::Block<Params, LLAssetFilteredInventoryPanel::Params>
+ {
+ Params()
+ {
filter_asset_types = "landmark";
}
- };
+ };
- LLPlacesInventoryPanel(const Params& p);
- ~LLPlacesInventoryPanel();
+ LLPlacesInventoryPanel(const Params& p);
+ ~LLPlacesInventoryPanel();
LLFolderView * createFolderRoot(LLUUID root_id ) override;
- void saveFolderState();
- void restoreFolderState();
+ void saveFolderState();
+ void restoreFolderState();
- virtual S32 notify(const LLSD& info) override;
+ virtual S32 notify(const LLSD& info) override;
BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
EAcceptance *accept, std::string &tooltip_msg) override;
private:
- LLSaveFolderState* mSavedFolderState;
+ LLSaveFolderState* mSavedFolderState;
};
#endif //LL_LLINVENTORYSUBTREEPANEL_H
diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp
index d1a9ca229f..353d261ad1 100644
--- a/indra/newview/llpopupview.cpp
+++ b/indra/newview/llpopupview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpopupview.cpp
* @brief Holds transient popups
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,241 +31,241 @@ static LLPanelInjector<LLPopupView> r("popup_holder");
bool view_visible_and_enabled(LLView* viewp)
{
- return viewp->getVisible() && viewp->getEnabled();
+ return viewp->getVisible() && viewp->getEnabled();
}
bool view_visible(LLView* viewp)
{
- return viewp->getVisible();
+ return viewp->getVisible();
}
LLPopupView::LLPopupView(const LLPopupView::Params& p)
: LLPanel(p)
{
- // register ourself as handler of UI popups
- LLUI::getInstance()->setPopupFuncs(boost::bind(&LLPopupView::addPopup, this, _1), boost::bind(&LLPopupView::removePopup, this, _1), boost::bind(&LLPopupView::clearPopups, this));
+ // register ourself as handler of UI popups
+ LLUI::getInstance()->setPopupFuncs(boost::bind(&LLPopupView::addPopup, this, _1), boost::bind(&LLPopupView::removePopup, this, _1), boost::bind(&LLPopupView::clearPopups, this));
}
LLPopupView::~LLPopupView()
{
- // set empty callback function so we can't handle popups anymore
- LLUI::getInstance()->setPopupFuncs(LLUI::add_popup_t(), LLUI::remove_popup_t(), LLUI::clear_popups_t());
+ // set empty callback function so we can't handle popups anymore
+ LLUI::getInstance()->setPopupFuncs(LLUI::add_popup_t(), LLUI::remove_popup_t(), LLUI::clear_popups_t());
}
void LLPopupView::draw()
{
- S32 screen_x, screen_y;
-
- // remove dead popups
- for (popup_list_t::iterator popup_it = mPopups.begin();
- popup_it != mPopups.end();)
- {
- if (!popup_it->get())
- {
- mPopups.erase(popup_it++);
- }
- else
- {
- popup_it++;
- }
- }
-
- // draw in reverse order (most recent is on top)
- for (popup_list_t::reverse_iterator popup_it = mPopups.rbegin();
- popup_it != mPopups.rend();)
- {
- LLView* popup = popup_it->get();
-
- if (popup->getVisible())
- {
- popup->localPointToScreen(0, 0, &screen_x, &screen_y);
-
- LLUI::pushMatrix();
- {
- LLUI::translate( (F32) screen_x, (F32) screen_y);
- popup->draw();
- }
- LLUI::popMatrix();
- }
- ++popup_it;
- }
-
- LLPanel::draw();
+ S32 screen_x, screen_y;
+
+ // remove dead popups
+ for (popup_list_t::iterator popup_it = mPopups.begin();
+ popup_it != mPopups.end();)
+ {
+ if (!popup_it->get())
+ {
+ mPopups.erase(popup_it++);
+ }
+ else
+ {
+ popup_it++;
+ }
+ }
+
+ // draw in reverse order (most recent is on top)
+ for (popup_list_t::reverse_iterator popup_it = mPopups.rbegin();
+ popup_it != mPopups.rend();)
+ {
+ LLView* popup = popup_it->get();
+
+ if (popup->getVisible())
+ {
+ popup->localPointToScreen(0, 0, &screen_x, &screen_y);
+
+ LLUI::pushMatrix();
+ {
+ LLUI::translate( (F32) screen_x, (F32) screen_y);
+ popup->draw();
+ }
+ LLUI::popMatrix();
+ }
+ ++popup_it;
+ }
+
+ LLPanel::draw();
}
-BOOL LLPopupView::handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)> func,
- boost::function<bool(LLView*)> predicate,
- S32 x, S32 y,
- bool close_popups)
+BOOL LLPopupView::handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)> func,
+ boost::function<bool(LLView*)> predicate,
+ S32 x, S32 y,
+ bool close_popups)
{
- BOOL handled = FALSE;
-
- // make a copy of list of popups, in case list is modified during mouse event handling
- popup_list_t popups(mPopups);
- for (popup_list_t::iterator popup_it = popups.begin(), popup_end = popups.end();
- popup_it != popup_end;
- ++popup_it)
- {
- LLView* popup = popup_it->get();
- if (!popup
- || !predicate(popup))
- {
- continue;
- }
-
- S32 popup_x, popup_y;
- if (localPointToOtherView(x, y, &popup_x, &popup_y, popup)
- && popup->pointInView(popup_x, popup_y))
- {
- if (func(popup, popup_x, popup_y))
- {
- handled = TRUE;
- break;
- }
- }
-
- if (close_popups)
- {
- mPopups.remove(*popup_it);
- popup->onTopLost();
- }
- }
-
- return handled;
+ BOOL handled = FALSE;
+
+ // make a copy of list of popups, in case list is modified during mouse event handling
+ popup_list_t popups(mPopups);
+ for (popup_list_t::iterator popup_it = popups.begin(), popup_end = popups.end();
+ popup_it != popup_end;
+ ++popup_it)
+ {
+ LLView* popup = popup_it->get();
+ if (!popup
+ || !predicate(popup))
+ {
+ continue;
+ }
+
+ S32 popup_x, popup_y;
+ if (localPointToOtherView(x, y, &popup_x, &popup_y, popup)
+ && popup->pointInView(popup_x, popup_y))
+ {
+ if (func(popup, popup_x, popup_y))
+ {
+ handled = TRUE;
+ break;
+ }
+ }
+
+ if (close_popups)
+ {
+ mPopups.remove(*popup_it);
+ popup->onTopLost();
+ }
+ }
+
+ return handled;
}
BOOL LLPopupView::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true);
- if (!handled)
- {
- handled = LLPanel::handleMouseDown(x, y, mask);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true);
+ if (!handled)
+ {
+ handled = LLPanel::handleMouseDown(x, y, mask);
+ }
+ return handled;
}
BOOL LLPopupView::handleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
- if (!handled)
- {
- handled = LLPanel::handleMouseUp(x, y, mask);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+ if (!handled)
+ {
+ handled = LLPanel::handleMouseUp(x, y, mask);
+ }
+ return handled;
}
BOOL LLPopupView::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true);
- if (!handled)
- {
- handled = LLPanel::handleMiddleMouseDown(x, y, mask);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true);
+ if (!handled)
+ {
+ handled = LLPanel::handleMiddleMouseDown(x, y, mask);
+ }
+ return handled;
}
BOOL LLPopupView::handleMiddleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
- if (!handled)
- {
- handled = LLPanel::handleMiddleMouseUp(x, y, mask);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+ if (!handled)
+ {
+ handled = LLPanel::handleMiddleMouseUp(x, y, mask);
+ }
+ return handled;
}
BOOL LLPopupView::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true);
- if (!handled)
- {
- handled = LLPanel::handleRightMouseDown(x, y, mask);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true);
+ if (!handled)
+ {
+ handled = LLPanel::handleRightMouseDown(x, y, mask);
+ }
+ return handled;
}
BOOL LLPopupView::handleRightMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
- if (!handled)
- {
- handled = LLPanel::handleRightMouseUp(x, y, mask);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+ if (!handled)
+ {
+ handled = LLPanel::handleRightMouseUp(x, y, mask);
+ }
+ return handled;
}
BOOL LLPopupView::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleDoubleClick, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
- if (!handled)
- {
- handled = LLPanel::handleDoubleClick(x, y, mask);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleDoubleClick, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+ if (!handled)
+ {
+ handled = LLPanel::handleDoubleClick(x, y, mask);
+ }
+ return handled;
}
BOOL LLPopupView::handleHover(S32 x, S32 y, MASK mask)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleHover, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
- if (!handled)
- {
- handled = LLPanel::handleHover(x, y, mask);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleHover, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+ if (!handled)
+ {
+ handled = LLPanel::handleHover(x, y, mask);
+ }
+ return handled;
}
BOOL LLPopupView::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleScrollWheel, _1, _2, _3, clicks), view_visible_and_enabled, x, y, false);
- if (!handled)
- {
- handled = LLPanel::handleScrollWheel(x, y, clicks);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleScrollWheel, _1, _2, _3, clicks), view_visible_and_enabled, x, y, false);
+ if (!handled)
+ {
+ handled = LLPanel::handleScrollWheel(x, y, clicks);
+ }
+ return handled;
}
BOOL LLPopupView::handleToolTip(S32 x, S32 y, MASK mask)
{
- BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleToolTip, _1, _2, _3, mask), view_visible, x, y, false);
- if (!handled)
- {
- handled = LLPanel::handleToolTip(x, y, mask);
- }
- return handled;
+ BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleToolTip, _1, _2, _3, mask), view_visible, x, y, false);
+ if (!handled)
+ {
+ handled = LLPanel::handleToolTip(x, y, mask);
+ }
+ return handled;
}
void LLPopupView::addPopup(LLView* popup)
{
- if (popup)
- {
- mPopups.remove(popup->getHandle());
- mPopups.push_front(popup->getHandle());
- }
+ if (popup)
+ {
+ mPopups.remove(popup->getHandle());
+ mPopups.push_front(popup->getHandle());
+ }
}
void LLPopupView::removePopup(LLView* popup)
{
- if (popup)
- {
- mPopups.remove(popup->getHandle());
- popup->onTopLost();
- }
+ if (popup)
+ {
+ mPopups.remove(popup->getHandle());
+ popup->onTopLost();
+ }
}
void LLPopupView::clearPopups()
{
- for (popup_list_t::iterator popup_it = mPopups.begin();
- popup_it != mPopups.end();)
- {
- LLView* popup = popup_it->get();
+ for (popup_list_t::iterator popup_it = mPopups.begin();
+ popup_it != mPopups.end();)
+ {
+ LLView* popup = popup_it->get();
- popup_list_t::iterator cur_popup_it = popup_it;
- ++popup_it;
+ popup_list_t::iterator cur_popup_it = popup_it;
+ ++popup_it;
- mPopups.erase(cur_popup_it);
- popup->onTopLost();
- }
+ mPopups.erase(cur_popup_it);
+ popup->onTopLost();
+ }
}
diff --git a/indra/newview/llpopupview.h b/indra/newview/llpopupview.h
index b378f61984..d42df280bb 100644
--- a/indra/newview/llpopupview.h
+++ b/indra/newview/llpopupview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpopupview.h
* @brief Holds transient popups
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,30 +32,30 @@
class LLPopupView : public LLPanel
{
public:
- LLPopupView(const Params& p = LLPanel::Params());
- ~LLPopupView();
+ LLPopupView(const Params& p = LLPanel::Params());
+ ~LLPopupView();
- /*virtual*/ void draw();
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
- void addPopup(LLView* popup);
- void removePopup(LLView* popup);
- void clearPopups();
+ void addPopup(LLView* popup);
+ void removePopup(LLView* popup);
+ void clearPopups();
- typedef std::list<LLHandle<LLView> > popup_list_t;
- popup_list_t getCurrentPopups() { return mPopups; }
+ typedef std::list<LLHandle<LLView> > popup_list_t;
+ popup_list_t getCurrentPopups() { return mPopups; }
private:
- BOOL handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)>, boost::function<bool(LLView*)>, S32 x, S32 y, bool close_popups);
- popup_list_t mPopups;
+ BOOL handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)>, boost::function<bool(LLView*)>, S32 x, S32 y, bool close_popups);
+ popup_list_t mPopups;
};
#endif //LL_LLROOTVIEW_H
diff --git a/indra/newview/llpostcard.cpp b/indra/newview/llpostcard.cpp
index 071fc31d27..715281d25a 100644
--- a/indra/newview/llpostcard.cpp
+++ b/indra/newview/llpostcard.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpostcard.cpp
* @brief Sending postcards.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -72,8 +72,8 @@ LLPostCard::result_callback_t LLPostCard::mResultCallback;
// static
void LLPostCard::reportPostResult(bool ok)
{
- if (mResultCallback)
- {
- mResultCallback(ok);
- }
+ if (mResultCallback)
+ {
+ mResultCallback(ok);
+ }
}
diff --git a/indra/newview/llpostcard.h b/indra/newview/llpostcard.h
index 1e932ae03f..cfe6f3951d 100644
--- a/indra/newview/llpostcard.h
+++ b/indra/newview/llpostcard.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpostcard.h
* @brief Sending postcards.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,21 +32,21 @@
#include "llviewerassetupload.h"
/// *TODO$: this LLPostCard class is a hold over and should be removed. Right now
-/// all it does is hold a pointer to a call back function which is invoked by
-/// llpanelsnapshotpostcard's finish function. (and all that call back does is
+/// all it does is hold a pointer to a call back function which is invoked by
+/// llpanelsnapshotpostcard's finish function. (and all that call back does is
/// set the status in the floater.
class LLPostCard
{
- LOG_CLASS(LLPostCard);
+ LOG_CLASS(LLPostCard);
public:
- typedef boost::function<void(bool ok)> result_callback_t;
+ typedef boost::function<void(bool ok)> result_callback_t;
- static void setPostResultCallback(result_callback_t cb) { mResultCallback = cb; }
- static void reportPostResult(bool ok);
+ static void setPostResultCallback(result_callback_t cb) { mResultCallback = cb; }
+ static void reportPostResult(bool ok);
private:
- static result_callback_t mResultCallback;
+ static result_callback_t mResultCallback;
};
diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp
index 30d0a22ef0..cde552fc8d 100644
--- a/indra/newview/llpresetsmanager.cpp
+++ b/indra/newview/llpresetsmanager.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,176 +48,176 @@ LLPresetsManager::LLPresetsManager()
LLPresetsManager::~LLPresetsManager()
{
- mCameraChangedSignal.disconnect();
+ mCameraChangedSignal.disconnect();
}
void LLPresetsManager::triggerChangeCameraSignal()
{
- mPresetListChangeCameraSignal();
+ mPresetListChangeCameraSignal();
}
void LLPresetsManager::triggerChangeSignal()
{
- mPresetListChangeSignal();
+ mPresetListChangeSignal();
}
void LLPresetsManager::createMissingDefault(const std::string& subdirectory)
{
- if(gDirUtilp->getLindenUserDir().empty())
- {
- return;
- }
-
- if (PRESETS_CAMERA == subdirectory)
- {
- createCameraDefaultPresets();
- return;
- }
-
- std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR,
- subdirectory, PRESETS_DEFAULT + ".xml");
- if (!gDirUtilp->fileExists(default_file))
- {
- LL_INFOS() << "No default preset found -- creating one at " << default_file << LL_ENDL;
-
- // Write current settings as the default
- savePreset(subdirectory, PRESETS_DEFAULT, true);
- }
- else
- {
- LL_DEBUGS() << "default preset exists; no-op" << LL_ENDL;
- }
+ if(gDirUtilp->getLindenUserDir().empty())
+ {
+ return;
+ }
+
+ if (PRESETS_CAMERA == subdirectory)
+ {
+ createCameraDefaultPresets();
+ return;
+ }
+
+ std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR,
+ subdirectory, PRESETS_DEFAULT + ".xml");
+ if (!gDirUtilp->fileExists(default_file))
+ {
+ LL_INFOS() << "No default preset found -- creating one at " << default_file << LL_ENDL;
+
+ // Write current settings as the default
+ savePreset(subdirectory, PRESETS_DEFAULT, true);
+ }
+ else
+ {
+ LL_DEBUGS() << "default preset exists; no-op" << LL_ENDL;
+ }
}
void LLPresetsManager::createCameraDefaultPresets()
{
- bool is_default_created = createDefaultCameraPreset(PRESETS_REAR_VIEW);
- is_default_created |= createDefaultCameraPreset(PRESETS_FRONT_VIEW);
- is_default_created |= createDefaultCameraPreset(PRESETS_SIDE_VIEW);
-
- if (is_default_created)
- {
- triggerChangeCameraSignal();
- }
+ bool is_default_created = createDefaultCameraPreset(PRESETS_REAR_VIEW);
+ is_default_created |= createDefaultCameraPreset(PRESETS_FRONT_VIEW);
+ is_default_created |= createDefaultCameraPreset(PRESETS_SIDE_VIEW);
+
+ if (is_default_created)
+ {
+ triggerChangeCameraSignal();
+ }
}
void LLPresetsManager::startWatching(const std::string& subdirectory)
{
- if (PRESETS_CAMERA == subdirectory)
- {
- std::vector<std::string> name_list;
- getControlNames(name_list);
-
- for (std::vector<std::string>::iterator it = name_list.begin(); it != name_list.end(); ++it)
- {
- std::string ctrl_name = *it;
- if (gSavedSettings.controlExists(ctrl_name))
- {
- LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl(ctrl_name);
- if (cntrl_ptr.isNull())
- {
- LL_WARNS("Init") << "Unable to set signal on global setting '" << ctrl_name
- << "'" << LL_ENDL;
- }
- else
- {
- mCameraChangedSignal = cntrl_ptr->getCommitSignal()->connect(boost::bind(&settingChanged));
- }
- }
- }
- }
+ if (PRESETS_CAMERA == subdirectory)
+ {
+ std::vector<std::string> name_list;
+ getControlNames(name_list);
+
+ for (std::vector<std::string>::iterator it = name_list.begin(); it != name_list.end(); ++it)
+ {
+ std::string ctrl_name = *it;
+ if (gSavedSettings.controlExists(ctrl_name))
+ {
+ LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl(ctrl_name);
+ if (cntrl_ptr.isNull())
+ {
+ LL_WARNS("Init") << "Unable to set signal on global setting '" << ctrl_name
+ << "'" << LL_ENDL;
+ }
+ else
+ {
+ mCameraChangedSignal = cntrl_ptr->getCommitSignal()->connect(boost::bind(&settingChanged));
+ }
+ }
+ }
+ }
}
std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory)
{
- std::string presets_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR);
+ std::string presets_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR);
- LLFile::mkdir(presets_path);
+ LLFile::mkdir(presets_path);
- std::string dest_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, subdirectory);
- if (!gDirUtilp->fileExists(dest_path))
- LLFile::mkdir(dest_path);
+ std::string dest_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, subdirectory);
+ if (!gDirUtilp->fileExists(dest_path))
+ LLFile::mkdir(dest_path);
- return dest_path;
+ return dest_path;
}
void LLPresetsManager::loadPresetNamesFromDir(const std::string& subdirectory, preset_name_list_t& presets, EDefaultOptions default_option)
{
- bool IS_CAMERA = (PRESETS_CAMERA == subdirectory);
- bool IS_GRAPHIC = (PRESETS_GRAPHIC == subdirectory);
-
- std::string dir = LLPresetsManager::getInstance()->getPresetsDir(subdirectory);
- LL_INFOS("AppInit") << "Loading list of preset names from " << dir << LL_ENDL;
-
- mPresetNames.clear();
-
- LLDirIterator dir_iter(dir, "*.xml");
- bool found = true;
- while (found)
- {
- std::string file;
- found = dir_iter.next(file);
-
- if (found)
- {
- std::string path = gDirUtilp->add(dir, file);
- std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true));
- LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL;
-
- if (IS_CAMERA)
- {
- if (isTemplateCameraPreset(name))
- {
- continue;
- }
- if ((default_option == DEFAULT_HIDE) || (default_option == DEFAULT_BOTTOM))
- {
- if (isDefaultCameraPreset(name))
- {
- continue;
- }
- }
- mPresetNames.push_back(name);
- }
- if (IS_GRAPHIC)
- {
- if (PRESETS_DEFAULT != name)
- {
- mPresetNames.push_back(name);
- }
- else
- {
- switch (default_option)
- {
- case DEFAULT_SHOW:
- mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT));
- break;
-
- case DEFAULT_TOP:
- mPresetNames.push_front(LLTrans::getString(PRESETS_DEFAULT));
- break;
-
- case DEFAULT_HIDE:
- default:
- break;
- }
- }
- }
- }
- }
-
- if (IS_CAMERA)
- {
- mPresetNames.sort(LLStringUtil::precedesDict);
- if (default_option == DEFAULT_BOTTOM)
- {
- mPresetNames.push_back(PRESETS_FRONT_VIEW);
- mPresetNames.push_back(PRESETS_REAR_VIEW);
- mPresetNames.push_back(PRESETS_SIDE_VIEW);
- }
- }
-
- presets = mPresetNames;
+ bool IS_CAMERA = (PRESETS_CAMERA == subdirectory);
+ bool IS_GRAPHIC = (PRESETS_GRAPHIC == subdirectory);
+
+ std::string dir = LLPresetsManager::getInstance()->getPresetsDir(subdirectory);
+ LL_INFOS("AppInit") << "Loading list of preset names from " << dir << LL_ENDL;
+
+ mPresetNames.clear();
+
+ LLDirIterator dir_iter(dir, "*.xml");
+ bool found = true;
+ while (found)
+ {
+ std::string file;
+ found = dir_iter.next(file);
+
+ if (found)
+ {
+ std::string path = gDirUtilp->add(dir, file);
+ std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true));
+ LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL;
+
+ if (IS_CAMERA)
+ {
+ if (isTemplateCameraPreset(name))
+ {
+ continue;
+ }
+ if ((default_option == DEFAULT_HIDE) || (default_option == DEFAULT_BOTTOM))
+ {
+ if (isDefaultCameraPreset(name))
+ {
+ continue;
+ }
+ }
+ mPresetNames.push_back(name);
+ }
+ if (IS_GRAPHIC)
+ {
+ if (PRESETS_DEFAULT != name)
+ {
+ mPresetNames.push_back(name);
+ }
+ else
+ {
+ switch (default_option)
+ {
+ case DEFAULT_SHOW:
+ mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT));
+ break;
+
+ case DEFAULT_TOP:
+ mPresetNames.push_front(LLTrans::getString(PRESETS_DEFAULT));
+ break;
+
+ case DEFAULT_HIDE:
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (IS_CAMERA)
+ {
+ mPresetNames.sort(LLStringUtil::precedesDict);
+ if (default_option == DEFAULT_BOTTOM)
+ {
+ mPresetNames.push_back(PRESETS_FRONT_VIEW);
+ mPresetNames.push_back(PRESETS_REAR_VIEW);
+ mPresetNames.push_back(PRESETS_SIDE_VIEW);
+ }
+ }
+
+ presets = mPresetNames;
}
bool LLPresetsManager::mCameraDirty = false;
@@ -225,357 +225,357 @@ bool LLPresetsManager::mIgnoreChangedSignal = false;
void LLPresetsManager::setCameraDirty(bool dirty)
{
- mCameraDirty = dirty;
+ mCameraDirty = dirty;
}
bool LLPresetsManager::isCameraDirty()
{
- return mCameraDirty;
+ return mCameraDirty;
}
void LLPresetsManager::settingChanged()
{
- setCameraDirty(true);
+ setCameraDirty(true);
- static LLCachedControl<std::string> preset_camera_active(gSavedSettings, "PresetCameraActive", "");
- std::string preset_name = preset_camera_active;
- if (!preset_name.empty() && !mIgnoreChangedSignal)
- {
- gSavedSettings.setString("PresetCameraActive", "");
+ static LLCachedControl<std::string> preset_camera_active(gSavedSettings, "PresetCameraActive", "");
+ std::string preset_name = preset_camera_active;
+ if (!preset_name.empty() && !mIgnoreChangedSignal)
+ {
+ gSavedSettings.setString("PresetCameraActive", "");
- // Hack call because this is a static routine
- LLPresetsManager::getInstance()->triggerChangeCameraSignal();
- }
+ // Hack call because this is a static routine
+ LLPresetsManager::getInstance()->triggerChangeCameraSignal();
+ }
}
void LLPresetsManager::getControlNames(std::vector<std::string>& names)
{
- const std::vector<std::string> camera_controls = boost::assign::list_of
- // From panel_preferences_move.xml
- ("CameraAngle")
- ("CameraOffsetScale")
- ("EditCameraMovement")
- ("AppearanceCameraMovement")
- // From llagentcamera.cpp
- ("CameraOffsetBuild")
- ("TrackFocusObject")
- ("CameraOffsetRearView")
- ("FocusOffsetRearView")
- ("AvatarSitRotation")
+ const std::vector<std::string> camera_controls = boost::assign::list_of
+ // From panel_preferences_move.xml
+ ("CameraAngle")
+ ("CameraOffsetScale")
+ ("EditCameraMovement")
+ ("AppearanceCameraMovement")
+ // From llagentcamera.cpp
+ ("CameraOffsetBuild")
+ ("TrackFocusObject")
+ ("CameraOffsetRearView")
+ ("FocusOffsetRearView")
+ ("AvatarSitRotation")
;
names = camera_controls;
}
bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault)
{
- bool IS_CAMERA = (PRESETS_CAMERA == subdirectory);
- bool IS_GRAPHIC = (PRESETS_GRAPHIC == subdirectory);
-
- if (LLTrans::getString(PRESETS_DEFAULT) == name)
- {
- name = PRESETS_DEFAULT;
- }
- if (!createDefault && name == PRESETS_DEFAULT)
- {
- LL_WARNS() << "Should not overwrite default" << LL_ENDL;
- return false;
- }
-
- if (isTemplateCameraPreset(name))
- {
- LL_WARNS() << "Should not overwrite template presets" << LL_ENDL;
- return false;
- }
-
- bool saved = false;
- std::vector<std::string> name_list;
-
- if (IS_GRAPHIC)
- {
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance && !createDefault)
- {
- gSavedSettings.setString("PresetGraphicActive", name);
- instance->getControlNames(name_list);
- LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL;
- name_list.push_back("PresetGraphicActive");
- }
- else
+ bool IS_CAMERA = (PRESETS_CAMERA == subdirectory);
+ bool IS_GRAPHIC = (PRESETS_GRAPHIC == subdirectory);
+
+ if (LLTrans::getString(PRESETS_DEFAULT) == name)
+ {
+ name = PRESETS_DEFAULT;
+ }
+ if (!createDefault && name == PRESETS_DEFAULT)
+ {
+ LL_WARNS() << "Should not overwrite default" << LL_ENDL;
+ return false;
+ }
+
+ if (isTemplateCameraPreset(name))
+ {
+ LL_WARNS() << "Should not overwrite template presets" << LL_ENDL;
+ return false;
+ }
+
+ bool saved = false;
+ std::vector<std::string> name_list;
+
+ if (IS_GRAPHIC)
+ {
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance && !createDefault)
+ {
+ gSavedSettings.setString("PresetGraphicActive", name);
+ instance->getControlNames(name_list);
+ LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL;
+ name_list.push_back("PresetGraphicActive");
+ }
+ else
+ {
+ LL_WARNS("Presets") << "preferences floater instance not found" << LL_ENDL;
+ }
+ }
+ else if (IS_CAMERA)
+ {
+ name_list.clear();
+ getControlNames(name_list);
+ name_list.push_back("PresetCameraActive");
+ }
+ else
+ {
+ LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL;
+ }
+
+ // make an empty llsd
+ LLSD paramsData(LLSD::emptyMap());
+
+ // Create a default graphics preset from hw recommended settings
+ if (IS_GRAPHIC && createDefault && name == PRESETS_DEFAULT)
+ {
+ paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap();
+ if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0)
+ {
+ // use the recommended setting as an initial one (MAINT-6435)
+ gSavedSettings.setU32("RenderAvatarMaxComplexity", paramsData["RenderAvatarMaxComplexity"]["Value"].asInteger());
+ }
+ }
+ else
+ {
+ ECameraPreset new_camera_preset = (ECameraPreset)gSavedSettings.getU32("CameraPresetType");
+ if (IS_CAMERA)
+ {
+ if (isDefaultCameraPreset(name))
+ {
+ if (PRESETS_REAR_VIEW == name)
+ {
+ new_camera_preset = CAMERA_PRESET_REAR_VIEW;
+ }
+ else if (PRESETS_SIDE_VIEW == name)
+ {
+ new_camera_preset = CAMERA_PRESET_GROUP_VIEW;
+ }
+ else if (PRESETS_FRONT_VIEW == name)
+ {
+ new_camera_preset = CAMERA_PRESET_FRONT_VIEW;
+ }
+ }
+ else
+ {
+ new_camera_preset = CAMERA_PRESET_CUSTOM;
+ }
+ }
+ for (std::vector<std::string>::iterator it = name_list.begin(); it != name_list.end(); ++it)
{
- LL_WARNS("Presets") << "preferences floater instance not found" << LL_ENDL;
- }
- }
- else if (IS_CAMERA)
- {
- name_list.clear();
- getControlNames(name_list);
- name_list.push_back("PresetCameraActive");
- }
- else
- {
- LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL;
- }
-
- // make an empty llsd
- LLSD paramsData(LLSD::emptyMap());
-
- // Create a default graphics preset from hw recommended settings
- if (IS_GRAPHIC && createDefault && name == PRESETS_DEFAULT)
- {
- paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap();
- if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0)
- {
- // use the recommended setting as an initial one (MAINT-6435)
- gSavedSettings.setU32("RenderAvatarMaxComplexity", paramsData["RenderAvatarMaxComplexity"]["Value"].asInteger());
- }
- }
- else
- {
- ECameraPreset new_camera_preset = (ECameraPreset)gSavedSettings.getU32("CameraPresetType");
- if (IS_CAMERA)
- {
- if (isDefaultCameraPreset(name))
- {
- if (PRESETS_REAR_VIEW == name)
- {
- new_camera_preset = CAMERA_PRESET_REAR_VIEW;
- }
- else if (PRESETS_SIDE_VIEW == name)
- {
- new_camera_preset = CAMERA_PRESET_GROUP_VIEW;
- }
- else if (PRESETS_FRONT_VIEW == name)
- {
- new_camera_preset = CAMERA_PRESET_FRONT_VIEW;
- }
- }
- else
- {
- new_camera_preset = CAMERA_PRESET_CUSTOM;
- }
- }
- for (std::vector<std::string>::iterator it = name_list.begin(); it != name_list.end(); ++it)
- {
- std::string ctrl_name = *it;
-
- LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get();
- if (ctrl)
- {
- std::string comment = ctrl->getComment();
- std::string type = LLControlGroup::typeEnumToString(ctrl->type());
- LLSD value = ctrl->getValue();
-
- paramsData[ctrl_name]["Comment"] = comment;
- paramsData[ctrl_name]["Persist"] = 1;
- paramsData[ctrl_name]["Type"] = type;
- paramsData[ctrl_name]["Value"] = value;
- }
- }
- if (IS_CAMERA)
- {
- gSavedSettings.setU32("CameraPresetType", new_camera_preset);
- }
- }
-
- std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml");
+ std::string ctrl_name = *it;
+
+ LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get();
+ if (ctrl)
+ {
+ std::string comment = ctrl->getComment();
+ std::string type = LLControlGroup::typeEnumToString(ctrl->type());
+ LLSD value = ctrl->getValue();
+
+ paramsData[ctrl_name]["Comment"] = comment;
+ paramsData[ctrl_name]["Persist"] = 1;
+ paramsData[ctrl_name]["Type"] = type;
+ paramsData[ctrl_name]["Value"] = value;
+ }
+ }
+ if (IS_CAMERA)
+ {
+ gSavedSettings.setU32("CameraPresetType", new_camera_preset);
+ }
+ }
+
+ std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml");
// If the active preset name is the only thing in the list, don't save the list
- if (paramsData.size() > 1)
- {
- // write to file
- llofstream presetsXML(pathName.c_str());
- if (presetsXML.is_open())
- {
- LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
- formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
- presetsXML.close();
- saved = true;
-
- LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL;
-
- if (IS_GRAPHIC)
- {
- gSavedSettings.setString("PresetGraphicActive", name);
- // signal interested parties
- triggerChangeSignal();
- }
-
- if (IS_CAMERA)
- {
- gSavedSettings.setString("PresetCameraActive", name);
- setCameraDirty(false);
- // signal interested parties
- triggerChangeCameraSignal();
- }
- }
- else
- {
- LL_WARNS("Presets") << "Cannot open for output preset file " << pathName << LL_ENDL;
- }
- }
+ if (paramsData.size() > 1)
+ {
+ // write to file
+ llofstream presetsXML(pathName.c_str());
+ if (presetsXML.is_open())
+ {
+ LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+ formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
+ presetsXML.close();
+ saved = true;
+
+ LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL;
+
+ if (IS_GRAPHIC)
+ {
+ gSavedSettings.setString("PresetGraphicActive", name);
+ // signal interested parties
+ triggerChangeSignal();
+ }
+
+ if (IS_CAMERA)
+ {
+ gSavedSettings.setString("PresetCameraActive", name);
+ setCameraDirty(false);
+ // signal interested parties
+ triggerChangeCameraSignal();
+ }
+ }
+ else
+ {
+ LL_WARNS("Presets") << "Cannot open for output preset file " << pathName << LL_ENDL;
+ }
+ }
else
- {
- LL_INFOS() << "No settings available to be saved" << LL_ENDL;
- }
-
- return saved;
+ {
+ LL_INFOS() << "No settings available to be saved" << LL_ENDL;
+ }
+
+ return saved;
}
bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option)
{
- bool sts = true;
-
- combo->clearRows();
- combo->setEnabled(TRUE);
-
- std::list<std::string> preset_names;
- loadPresetNamesFromDir(subdirectory, preset_names, default_option);
-
- if (preset_names.begin() != preset_names.end())
- {
- for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it)
- {
- const std::string& name = *it;
- combo->add(name, name);
- }
- }
- else
- {
- combo->setLabel(LLTrans::getString("preset_combo_label"));
- combo->setEnabled(PRESETS_CAMERA != subdirectory);
- sts = false;
- }
-
- return sts;
+ bool sts = true;
+
+ combo->clearRows();
+ combo->setEnabled(TRUE);
+
+ std::list<std::string> preset_names;
+ loadPresetNamesFromDir(subdirectory, preset_names, default_option);
+
+ if (preset_names.begin() != preset_names.end())
+ {
+ for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it)
+ {
+ const std::string& name = *it;
+ combo->add(name, name);
+ }
+ }
+ else
+ {
+ combo->setLabel(LLTrans::getString("preset_combo_label"));
+ combo->setEnabled(PRESETS_CAMERA != subdirectory);
+ sts = false;
+ }
+
+ return sts;
}
void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string name)
{
- if (LLTrans::getString(PRESETS_DEFAULT) == name)
- {
- name = PRESETS_DEFAULT;
- }
+ if (LLTrans::getString(PRESETS_DEFAULT) == name)
+ {
+ name = PRESETS_DEFAULT;
+ }
- std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml");
+ std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml");
LL_DEBUGS() << "attempting to load preset '"<<name<<"' from '"<<full_path<<"'" << LL_ENDL;
- mIgnoreChangedSignal = true;
- if(gSavedSettings.loadFromFile(full_path, false, true) > 0)
- {
- mIgnoreChangedSignal = false;
- if(PRESETS_GRAPHIC == subdirectory)
- {
- gSavedSettings.setString("PresetGraphicActive", name);
-
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
- instance->refreshEnabledGraphics();
- }
- triggerChangeSignal();
- }
- if(PRESETS_CAMERA == subdirectory)
- {
- gSavedSettings.setString("PresetCameraActive", name);
- triggerChangeCameraSignal();
- }
- }
- else
- {
- mIgnoreChangedSignal = false;
- LL_WARNS("Presets") << "failed to load preset '"<<name<<"' from '"<<full_path<<"'" << LL_ENDL;
- }
+ mIgnoreChangedSignal = true;
+ if(gSavedSettings.loadFromFile(full_path, false, true) > 0)
+ {
+ mIgnoreChangedSignal = false;
+ if(PRESETS_GRAPHIC == subdirectory)
+ {
+ gSavedSettings.setString("PresetGraphicActive", name);
+
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance)
+ {
+ instance->refreshEnabledGraphics();
+ }
+ triggerChangeSignal();
+ }
+ if(PRESETS_CAMERA == subdirectory)
+ {
+ gSavedSettings.setString("PresetCameraActive", name);
+ triggerChangeCameraSignal();
+ }
+ }
+ else
+ {
+ mIgnoreChangedSignal = false;
+ LL_WARNS("Presets") << "failed to load preset '"<<name<<"' from '"<<full_path<<"'" << LL_ENDL;
+ }
}
bool LLPresetsManager::deletePreset(const std::string& subdirectory, std::string name)
{
- if (LLTrans::getString(PRESETS_DEFAULT) == name)
- {
- name = PRESETS_DEFAULT;
- }
-
- bool sts = true;
-
- if (PRESETS_DEFAULT == name)
- {
- // This code should never execute
- LL_WARNS("Presets") << "You are not allowed to delete the default preset." << LL_ENDL;
- sts = false;
- }
-
- if (gDirUtilp->deleteFilesInDir(getPresetsDir(subdirectory), LLURI::escape(name) + ".xml") < 1)
- {
- LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL;
- sts = false;
- }
-
- // If you delete the preset that is currently marked as loaded then also indicate that no preset is loaded.
- if(PRESETS_GRAPHIC == subdirectory)
- {
- if (gSavedSettings.getString("PresetGraphicActive") == name)
- {
- gSavedSettings.setString("PresetGraphicActive", "");
- }
- // signal interested parties
- triggerChangeSignal();
- }
-
- if(PRESETS_CAMERA == subdirectory)
- {
- if (gSavedSettings.getString("PresetCameraActive") == name)
- {
- gSavedSettings.setString("PresetCameraActive", "");
- }
- // signal interested parties
- triggerChangeCameraSignal();
- }
-
- return sts;
+ if (LLTrans::getString(PRESETS_DEFAULT) == name)
+ {
+ name = PRESETS_DEFAULT;
+ }
+
+ bool sts = true;
+
+ if (PRESETS_DEFAULT == name)
+ {
+ // This code should never execute
+ LL_WARNS("Presets") << "You are not allowed to delete the default preset." << LL_ENDL;
+ sts = false;
+ }
+
+ if (gDirUtilp->deleteFilesInDir(getPresetsDir(subdirectory), LLURI::escape(name) + ".xml") < 1)
+ {
+ LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL;
+ sts = false;
+ }
+
+ // If you delete the preset that is currently marked as loaded then also indicate that no preset is loaded.
+ if(PRESETS_GRAPHIC == subdirectory)
+ {
+ if (gSavedSettings.getString("PresetGraphicActive") == name)
+ {
+ gSavedSettings.setString("PresetGraphicActive", "");
+ }
+ // signal interested parties
+ triggerChangeSignal();
+ }
+
+ if(PRESETS_CAMERA == subdirectory)
+ {
+ if (gSavedSettings.getString("PresetCameraActive") == name)
+ {
+ gSavedSettings.setString("PresetCameraActive", "");
+ }
+ // signal interested parties
+ triggerChangeCameraSignal();
+ }
+
+ return sts;
}
bool LLPresetsManager::isDefaultCameraPreset(std::string preset_name)
{
- return (preset_name == PRESETS_REAR_VIEW || preset_name == PRESETS_SIDE_VIEW || preset_name == PRESETS_FRONT_VIEW);
+ return (preset_name == PRESETS_REAR_VIEW || preset_name == PRESETS_SIDE_VIEW || preset_name == PRESETS_FRONT_VIEW);
}
bool LLPresetsManager::isTemplateCameraPreset(std::string preset_name)
{
- return (preset_name == PRESETS_REAR || preset_name == PRESETS_SIDE || preset_name == PRESETS_FRONT);
+ return (preset_name == PRESETS_REAR || preset_name == PRESETS_SIDE || preset_name == PRESETS_FRONT);
}
void LLPresetsManager::resetCameraPreset(std::string preset_name)
{
- if (isDefaultCameraPreset(preset_name))
- {
- createDefaultCameraPreset(preset_name, true);
-
- if (gSavedSettings.getString("PresetCameraActive") == preset_name)
- {
- loadPreset(PRESETS_CAMERA, preset_name);
- }
- }
+ if (isDefaultCameraPreset(preset_name))
+ {
+ createDefaultCameraPreset(preset_name, true);
+
+ if (gSavedSettings.getString("PresetCameraActive") == preset_name)
+ {
+ loadPreset(PRESETS_CAMERA, preset_name);
+ }
+ }
}
bool LLPresetsManager::createDefaultCameraPreset(std::string preset_name, bool force_reset)
{
- std::string preset_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR,
- PRESETS_CAMERA, LLURI::escape(preset_name) + ".xml");
- if (!gDirUtilp->fileExists(preset_file) || force_reset)
- {
- std::string template_name = preset_name.substr(0, preset_name.size() - PRESETS_VIEW_SUFFIX.size());
- std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, template_name + ".xml");
- return LLFile::copy(default_template_file, preset_file);
- }
- return false;
+ std::string preset_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR,
+ PRESETS_CAMERA, LLURI::escape(preset_name) + ".xml");
+ if (!gDirUtilp->fileExists(preset_file) || force_reset)
+ {
+ std::string template_name = preset_name.substr(0, preset_name.size() - PRESETS_VIEW_SUFFIX.size());
+ std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, template_name + ".xml");
+ return LLFile::copy(default_template_file, preset_file);
+ }
+ return false;
}
boost::signals2::connection LLPresetsManager::setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb)
{
- return mPresetListChangeCameraSignal.connect(cb);
+ return mPresetListChangeCameraSignal.connect(cb);
}
boost::signals2::connection LLPresetsManager::setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb)
{
- return mPresetListChangeSignal.connect(cb);
+ return mPresetListChangeSignal.connect(cb);
}
diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h
index 0de30e9e01..6fd038df3c 100644
--- a/indra/newview/llpresetsmanager.h
+++ b/indra/newview/llpresetsmanager.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,63 +47,63 @@ static const std::string PRESETS_SIDE_VIEW = PRESETS_SIDE + PRESETS_VIEW_SUFFIX;
enum EDefaultOptions
{
- DEFAULT_SHOW,
- DEFAULT_TOP,
- DEFAULT_BOTTOM,
- DEFAULT_HIDE // Do not display "Default" in a list
+ DEFAULT_SHOW,
+ DEFAULT_TOP,
+ DEFAULT_BOTTOM,
+ DEFAULT_HIDE // Do not display "Default" in a list
};
class LLPresetsManager : public LLSingleton<LLPresetsManager>
{
- LLSINGLETON(LLPresetsManager);
- ~LLPresetsManager();
+ LLSINGLETON(LLPresetsManager);
+ ~LLPresetsManager();
public:
- typedef std::list<std::string> preset_name_list_t;
- typedef boost::signals2::signal<void()> preset_list_signal_t;
+ typedef std::list<std::string> preset_name_list_t;
+ typedef boost::signals2::signal<void()> preset_list_signal_t;
- void createMissingDefault(const std::string& subdirectory);
- void startWatching(const std::string& subdirectory);
- void triggerChangeCameraSignal();
- void triggerChangeSignal();
- static std::string getPresetsDir(const std::string& subdirectory);
- bool setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option);
- void loadPresetNamesFromDir(const std::string& subdirectory, preset_name_list_t& presets, EDefaultOptions default_option);
- bool savePreset(const std::string& subdirectory, std::string name, bool createDefault = false);
- void loadPreset(const std::string& subdirectory, std::string name);
- bool deletePreset(const std::string& subdirectory, std::string name);
- bool isCameraDirty();
- static void setCameraDirty(bool dirty);
+ void createMissingDefault(const std::string& subdirectory);
+ void startWatching(const std::string& subdirectory);
+ void triggerChangeCameraSignal();
+ void triggerChangeSignal();
+ static std::string getPresetsDir(const std::string& subdirectory);
+ bool setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option);
+ void loadPresetNamesFromDir(const std::string& subdirectory, preset_name_list_t& presets, EDefaultOptions default_option);
+ bool savePreset(const std::string& subdirectory, std::string name, bool createDefault = false);
+ void loadPreset(const std::string& subdirectory, std::string name);
+ bool deletePreset(const std::string& subdirectory, std::string name);
+ bool isCameraDirty();
+ static void setCameraDirty(bool dirty);
- void createCameraDefaultPresets();
+ void createCameraDefaultPresets();
- bool isTemplateCameraPreset(std::string preset_name);
- bool isDefaultCameraPreset(std::string preset_name);
- void resetCameraPreset(std::string preset_name);
- bool createDefaultCameraPreset(std::string preset_name, bool force_reset = false);
+ bool isTemplateCameraPreset(std::string preset_name);
+ bool isDefaultCameraPreset(std::string preset_name);
+ void resetCameraPreset(std::string preset_name);
+ bool createDefaultCameraPreset(std::string preset_name, bool force_reset = false);
- // Emitted when a preset gets loaded, deleted, or saved.
- boost::signals2::connection setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb);
- boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb);
+ // Emitted when a preset gets loaded, deleted, or saved.
+ boost::signals2::connection setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb);
+ boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb);
- // Emitted when a preset gets loaded or saved.
+ // Emitted when a preset gets loaded or saved.
- preset_name_list_t mPresetNames;
+ preset_name_list_t mPresetNames;
- preset_list_signal_t mPresetListChangeCameraSignal;
- preset_list_signal_t mPresetListChangeSignal;
+ preset_list_signal_t mPresetListChangeCameraSignal;
+ preset_list_signal_t mPresetListChangeSignal;
private:
- LOG_CLASS(LLPresetsManager);
+ LOG_CLASS(LLPresetsManager);
- void getControlNames(std::vector<std::string>& names);
- static void settingChanged();
+ void getControlNames(std::vector<std::string>& names);
+ static void settingChanged();
- boost::signals2::connection mCameraChangedSignal;
+ boost::signals2::connection mCameraChangedSignal;
- static bool mCameraDirty;
- static bool mIgnoreChangedSignal;
+ static bool mCameraDirty;
+ static bool mIgnoreChangedSignal;
};
#endif // LL_PRESETSMANAGER_H
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp
index 0117db86e8..df1b2be955 100644
--- a/indra/newview/llpreview.cpp
+++ b/indra/newview/llpreview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreview.cpp
* @brief LLPreview class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,426 +54,426 @@
// Constants
LLPreview::LLPreview(const LLSD& key)
-: LLFloater(key),
- mItemUUID(key.has("itemid") ? key.get("itemid").asUUID() : key.asUUID()),
- mObjectUUID(), // set later by setObjectID()
- mCopyToInvBtn( NULL ),
- mForceClose(FALSE),
- mUserResized(FALSE),
- mCloseAfterSave(FALSE),
- mAssetStatus(PREVIEW_ASSET_UNLOADED),
- mDirty(TRUE),
- mSaveDialogShown(FALSE)
+: LLFloater(key),
+ mItemUUID(key.has("itemid") ? key.get("itemid").asUUID() : key.asUUID()),
+ mObjectUUID(), // set later by setObjectID()
+ mCopyToInvBtn( NULL ),
+ mForceClose(FALSE),
+ mUserResized(FALSE),
+ mCloseAfterSave(FALSE),
+ mAssetStatus(PREVIEW_ASSET_UNLOADED),
+ mDirty(TRUE),
+ mSaveDialogShown(FALSE)
{
- mAuxItem = new LLInventoryItem;
- // don't necessarily steal focus on creation -- sometimes these guys pop up without user action
- setAutoFocus(FALSE);
+ mAuxItem = new LLInventoryItem;
+ // don't necessarily steal focus on creation -- sometimes these guys pop up without user action
+ setAutoFocus(FALSE);
+
+ gInventory.addObserver(this);
- gInventory.addObserver(this);
-
- refreshFromItem();
+ refreshFromItem();
}
BOOL LLPreview::postBuild()
{
- refreshFromItem();
- return TRUE;
+ refreshFromItem();
+ return TRUE;
}
LLPreview::~LLPreview()
{
- gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
- gInventory.removeObserver(this);
+ gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
+ gInventory.removeObserver(this);
}
void LLPreview::setObjectID(const LLUUID& object_id)
{
- mObjectUUID = object_id;
- if (getAssetStatus() == PREVIEW_ASSET_UNLOADED)
- {
- loadAsset();
- }
- refreshFromItem();
+ mObjectUUID = object_id;
+ if (getAssetStatus() == PREVIEW_ASSET_UNLOADED)
+ {
+ loadAsset();
+ }
+ refreshFromItem();
}
void LLPreview::setItem( LLInventoryItem* item )
{
- mItem = item;
- if (mItem && getAssetStatus() == PREVIEW_ASSET_UNLOADED)
- {
- loadAsset();
- }
- refreshFromItem();
+ mItem = item;
+ if (mItem && getAssetStatus() == PREVIEW_ASSET_UNLOADED)
+ {
+ loadAsset();
+ }
+ refreshFromItem();
}
const LLInventoryItem *LLPreview::getItem() const
{
- const LLInventoryItem *item = NULL;
- if (mItem.notNull())
- {
- item = mItem;
- }
- else if (mObjectUUID.isNull())
- {
+ const LLInventoryItem *item = NULL;
+ if (mItem.notNull())
+ {
+ item = mItem;
+ }
+ else if (mObjectUUID.isNull())
+ {
if (mItemUUID.notNull())
{
// it's an inventory item, so get the item.
item = gInventory.getItem(mItemUUID);
}
- }
- else
- {
- // it's an object's inventory item.
- LLViewerObject* object = gObjectList.findObject(mObjectUUID);
- if(object)
- {
- item = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mItemUUID));
- }
- }
- return item;
+ }
+ else
+ {
+ // it's an object's inventory item.
+ LLViewerObject* object = gObjectList.findObject(mObjectUUID);
+ if(object)
+ {
+ item = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mItemUUID));
+ }
+ }
+ return item;
}
// Sub-classes should override this function if they allow editing
void LLPreview::onCommit()
{
- const LLViewerInventoryItem *item = dynamic_cast<const LLViewerInventoryItem*>(getItem());
- if(item)
- {
- if (!item->isFinished())
- {
- // We are attempting to save an item that was never loaded
- LL_WARNS() << "LLPreview::onCommit() called with mIsComplete == FALSE"
- << " Type: " << item->getType()
- << " ID: " << item->getUUID()
- << LL_ENDL;
- return;
- }
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setDescription(getChild<LLUICtrl>("desc")->getValue().asString());
-
- std::string new_name = getChild<LLUICtrl>("name")->getValue().asString();
- if ( (new_item->getName() != new_name) && !new_name.empty())
- {
- new_item->rename(getChild<LLUICtrl>("name")->getValue().asString());
- }
-
- if(mObjectUUID.notNull())
- {
- // must be in an object
- LLViewerObject* object = gObjectList.findObject(mObjectUUID);
- if(object)
- {
- object->updateInventory(
- new_item,
- TASK_INVENTORY_ITEM_KEY,
- false);
- }
- }
- else if(item->getPermissions().getOwner() == gAgent.getID())
- {
- new_item->updateServer(FALSE);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
-
- // If the item is an attachment that is currently being worn,
- // update the object itself.
- if( item->getType() == LLAssetType::AT_OBJECT )
- {
- if (isAgentAvatarValid())
- {
- LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
- if( obj )
- {
- LLSelectMgr::getInstance()->deselectAll();
- LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
- LLSelectMgr::getInstance()->selectionSetObjectDescription( getChild<LLUICtrl>("desc")->getValue().asString() );
-
- LLSelectMgr::getInstance()->deselectAll();
- }
- }
- }
- }
- }
+ const LLViewerInventoryItem *item = dynamic_cast<const LLViewerInventoryItem*>(getItem());
+ if(item)
+ {
+ if (!item->isFinished())
+ {
+ // We are attempting to save an item that was never loaded
+ LL_WARNS() << "LLPreview::onCommit() called with mIsComplete == FALSE"
+ << " Type: " << item->getType()
+ << " ID: " << item->getUUID()
+ << LL_ENDL;
+ return;
+ }
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setDescription(getChild<LLUICtrl>("desc")->getValue().asString());
+
+ std::string new_name = getChild<LLUICtrl>("name")->getValue().asString();
+ if ( (new_item->getName() != new_name) && !new_name.empty())
+ {
+ new_item->rename(getChild<LLUICtrl>("name")->getValue().asString());
+ }
+
+ if(mObjectUUID.notNull())
+ {
+ // must be in an object
+ LLViewerObject* object = gObjectList.findObject(mObjectUUID);
+ if(object)
+ {
+ object->updateInventory(
+ new_item,
+ TASK_INVENTORY_ITEM_KEY,
+ false);
+ }
+ }
+ else if(item->getPermissions().getOwner() == gAgent.getID())
+ {
+ new_item->updateServer(FALSE);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+
+ // If the item is an attachment that is currently being worn,
+ // update the object itself.
+ if( item->getType() == LLAssetType::AT_OBJECT )
+ {
+ if (isAgentAvatarValid())
+ {
+ LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
+ if( obj )
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
+ LLSelectMgr::getInstance()->selectionSetObjectDescription( getChild<LLUICtrl>("desc")->getValue().asString() );
+
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+ }
+ }
+ }
+ }
}
void LLPreview::changed(U32 mask)
{
- mDirty = TRUE;
+ mDirty = TRUE;
}
-void LLPreview::setNotecardInfo(const LLUUID& notecard_inv_id,
- const LLUUID& object_id)
+void LLPreview::setNotecardInfo(const LLUUID& notecard_inv_id,
+ const LLUUID& object_id)
{
- mNotecardInventoryID = notecard_inv_id;
- mNotecardObjectID = object_id;
+ mNotecardInventoryID = notecard_inv_id;
+ mNotecardObjectID = object_id;
}
void LLPreview::draw()
{
- LLFloater::draw();
- if (mDirty)
- {
- mDirty = FALSE;
- refreshFromItem();
- }
+ LLFloater::draw();
+ if (mDirty)
+ {
+ mDirty = FALSE;
+ refreshFromItem();
+ }
}
void LLPreview::refreshFromItem()
{
- const LLInventoryItem* item = getItem();
- if (!item)
- {
- return;
- }
- if (hasString("Title"))
- {
- LLStringUtil::format_map_t args;
- args["[NAME]"] = item->getName();
- LLUIString title = getString("Title", args);
- setTitle(title.getString());
- }
- getChild<LLUICtrl>("desc")->setValue(item->getDescription());
-
- getChildView("desc")->setEnabled(canModify(mObjectUUID, item));
+ const LLInventoryItem* item = getItem();
+ if (!item)
+ {
+ return;
+ }
+ if (hasString("Title"))
+ {
+ LLStringUtil::format_map_t args;
+ args["[NAME]"] = item->getName();
+ LLUIString title = getString("Title", args);
+ setTitle(title.getString());
+ }
+ getChild<LLUICtrl>("desc")->setValue(item->getDescription());
+
+ getChildView("desc")->setEnabled(canModify(mObjectUUID, item));
}
// static
BOOL LLPreview::canModify(const LLUUID taskUUID, const LLInventoryItem* item)
{
const LLViewerObject* object = nullptr;
- if (taskUUID.notNull())
- {
- object = gObjectList.findObject(taskUUID);
- }
+ if (taskUUID.notNull())
+ {
+ object = gObjectList.findObject(taskUUID);
+ }
- return canModify(object, item);
+ return canModify(object, item);
}
// static
BOOL LLPreview::canModify(const LLViewerObject* object, const LLInventoryItem* item)
{
- if (object && !object->permModify())
- {
+ if (object && !object->permModify())
+ {
// No permission to edit in-world inventory
return FALSE;
- }
+ }
- return item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE);
+ return item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE);
}
-// static
+// static
void LLPreview::onText(LLUICtrl*, void* userdata)
{
- LLPreview* self = (LLPreview*) userdata;
- self->onCommit();
+ LLPreview* self = (LLPreview*) userdata;
+ self->onCommit();
}
// static
void LLPreview::onRadio(LLUICtrl*, void* userdata)
{
- LLPreview* self = (LLPreview*) userdata;
- self->onCommit();
+ LLPreview* self = (LLPreview*) userdata;
+ self->onCommit();
}
// static
void LLPreview::hide(const LLUUID& item_uuid, BOOL no_saving /* = FALSE */ )
{
- LLFloater* floater = LLFloaterReg::findInstance("preview", LLSD(item_uuid));
- if (!floater) floater = LLFloaterReg::findInstance("preview_avatar", LLSD(item_uuid));
-
- LLPreview* preview = dynamic_cast<LLPreview*>(floater);
- if (preview)
- {
- if ( no_saving )
- {
- preview->mForceClose = TRUE;
- }
- preview->closeFloater();
- }
+ LLFloater* floater = LLFloaterReg::findInstance("preview", LLSD(item_uuid));
+ if (!floater) floater = LLFloaterReg::findInstance("preview_avatar", LLSD(item_uuid));
+
+ LLPreview* preview = dynamic_cast<LLPreview*>(floater);
+ if (preview)
+ {
+ if ( no_saving )
+ {
+ preview->mForceClose = TRUE;
+ }
+ preview->closeFloater();
+ }
}
// static
void LLPreview::dirty(const LLUUID& item_uuid)
{
- LLFloater* floater = LLFloaterReg::findInstance("preview", LLSD(item_uuid));
- if (!floater) floater = LLFloaterReg::findInstance("preview_avatar", LLSD(item_uuid));
-
- LLPreview* preview = dynamic_cast<LLPreview*>(floater);
- if(preview)
- {
- preview->mDirty = TRUE;
- }
+ LLFloater* floater = LLFloaterReg::findInstance("preview", LLSD(item_uuid));
+ if (!floater) floater = LLFloaterReg::findInstance("preview_avatar", LLSD(item_uuid));
+
+ LLPreview* preview = dynamic_cast<LLPreview*>(floater);
+ if(preview)
+ {
+ preview->mDirty = TRUE;
+ }
}
BOOL LLPreview::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if(mClientRect.pointInRect(x, y))
- {
- // No handler needed for focus lost since this class has no
- // state that depends on it.
- bringToFront(x, y);
- gFocusMgr.setMouseCapture(this);
- S32 screen_x;
- S32 screen_y;
- localPointToScreen(x, y, &screen_x, &screen_y );
- LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y);
- return TRUE;
- }
- return LLFloater::handleMouseDown(x, y, mask);
+ if(mClientRect.pointInRect(x, y))
+ {
+ // No handler needed for focus lost since this class has no
+ // state that depends on it.
+ bringToFront(x, y);
+ gFocusMgr.setMouseCapture(this);
+ S32 screen_x;
+ S32 screen_y;
+ localPointToScreen(x, y, &screen_x, &screen_y );
+ LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y);
+ return TRUE;
+ }
+ return LLFloater::handleMouseDown(x, y, mask);
}
BOOL LLPreview::handleMouseUp(S32 x, S32 y, MASK mask)
{
- if(hasMouseCapture())
- {
- gFocusMgr.setMouseCapture(NULL);
- return TRUE;
- }
- return LLFloater::handleMouseUp(x, y, mask);
+ if(hasMouseCapture())
+ {
+ gFocusMgr.setMouseCapture(NULL);
+ return TRUE;
+ }
+ return LLFloater::handleMouseUp(x, y, mask);
}
BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask)
{
- if(hasMouseCapture())
- {
- S32 screen_x;
- S32 screen_y;
- const LLInventoryItem *item = getItem();
-
- localPointToScreen(x, y, &screen_x, &screen_y );
- if(item
- && item->getPermissions().allowCopyBy(gAgent.getID(),
- gAgent.getGroupID())
- && LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y))
- {
- EDragAndDropType type;
- type = LLViewerAssetType::lookupDragAndDropType(item->getType());
- LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_LIBRARY;
- if(!mObjectUUID.isNull())
- {
- src = LLToolDragAndDrop::SOURCE_WORLD;
- }
- else if(item->getPermissions().getOwner() == gAgent.getID())
- {
- src = LLToolDragAndDrop::SOURCE_AGENT;
- }
- LLToolDragAndDrop::getInstance()->beginDrag(type,
- item->getUUID(),
- src,
- mObjectUUID);
- return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask );
- }
- }
- return LLFloater::handleHover(x,y,mask);
+ if(hasMouseCapture())
+ {
+ S32 screen_x;
+ S32 screen_y;
+ const LLInventoryItem *item = getItem();
+
+ localPointToScreen(x, y, &screen_x, &screen_y );
+ if(item
+ && item->getPermissions().allowCopyBy(gAgent.getID(),
+ gAgent.getGroupID())
+ && LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y))
+ {
+ EDragAndDropType type;
+ type = LLViewerAssetType::lookupDragAndDropType(item->getType());
+ LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_LIBRARY;
+ if(!mObjectUUID.isNull())
+ {
+ src = LLToolDragAndDrop::SOURCE_WORLD;
+ }
+ else if(item->getPermissions().getOwner() == gAgent.getID())
+ {
+ src = LLToolDragAndDrop::SOURCE_AGENT;
+ }
+ LLToolDragAndDrop::getInstance()->beginDrag(type,
+ item->getUUID(),
+ src,
+ mObjectUUID);
+ return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask );
+ }
+ }
+ return LLFloater::handleHover(x,y,mask);
}
void LLPreview::onOpen(const LLSD& key)
{
- if (!getFloaterHost() && !getHost() && getAssetStatus() == PREVIEW_ASSET_UNLOADED)
- {
- loadAsset();
- }
+ if (!getFloaterHost() && !getHost() && getAssetStatus() == PREVIEW_ASSET_UNLOADED)
+ {
+ loadAsset();
+ }
}
void LLPreview::setAuxItem( const LLInventoryItem* item )
{
- if ( mAuxItem )
- mAuxItem->copyItem(item);
+ if ( mAuxItem )
+ mAuxItem->copyItem(item);
}
// static
void LLPreview::onBtnCopyToInv(void* userdata)
{
- LLPreview* self = (LLPreview*) userdata;
- LLInventoryItem *item = self->mAuxItem;
-
- if(item && item->getUUID().notNull())
- {
- // Copy to inventory
- if (self->mNotecardInventoryID.notNull())
- {
- copy_inventory_from_notecard(LLUUID::null,
- self->mNotecardObjectID,
- self->mNotecardInventoryID,
- item);
- }
- else if (self->mObjectUUID.notNull())
- {
- // item is in in-world inventory
- LLViewerObject* object = gObjectList.findObject(self->mObjectUUID);
- LLPermissions perm(item->getPermissions());
- if(object
- &&(perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
- && perm.allowTransferTo(gAgent.getID())))
- {
- // copy to default folder
- set_dad_inventory_item(item, LLUUID::null);
- object->moveInventory(LLUUID::null, item->getUUID());
- }
- }
- else
- {
- LLPointer<LLInventoryCallback> cb = NULL;
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- LLUUID::null,
- std::string(),
- cb);
- }
- }
- self->closeFloater();
+ LLPreview* self = (LLPreview*) userdata;
+ LLInventoryItem *item = self->mAuxItem;
+
+ if(item && item->getUUID().notNull())
+ {
+ // Copy to inventory
+ if (self->mNotecardInventoryID.notNull())
+ {
+ copy_inventory_from_notecard(LLUUID::null,
+ self->mNotecardObjectID,
+ self->mNotecardInventoryID,
+ item);
+ }
+ else if (self->mObjectUUID.notNull())
+ {
+ // item is in in-world inventory
+ LLViewerObject* object = gObjectList.findObject(self->mObjectUUID);
+ LLPermissions perm(item->getPermissions());
+ if(object
+ &&(perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
+ && perm.allowTransferTo(gAgent.getID())))
+ {
+ // copy to default folder
+ set_dad_inventory_item(item, LLUUID::null);
+ object->moveInventory(LLUUID::null, item->getUUID());
+ }
+ }
+ else
+ {
+ LLPointer<LLInventoryCallback> cb = NULL;
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ }
+ self->closeFloater();
}
// static
void LLPreview::onKeepBtn(void* data)
{
- LLPreview* self = (LLPreview*)data;
- self->closeFloater();
+ LLPreview* self = (LLPreview*)data;
+ self->closeFloater();
}
// static
void LLPreview::onDiscardBtn(void* data)
{
- LLPreview* self = (LLPreview*)data;
-
- const LLInventoryItem* item = self->getItem();
- if (!item) return;
-
- self->mForceClose = TRUE;
- self->closeFloater();
-
- // Move the item to the trash
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if (item->getParentUUID() != trash_id)
- {
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setParent(trash_id);
- // no need to restamp it though it's a move into trash because
- // it's a brand new item already.
- new_item->updateParentOnServer(FALSE);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- }
+ LLPreview* self = (LLPreview*)data;
+
+ const LLInventoryItem* item = self->getItem();
+ if (!item) return;
+
+ self->mForceClose = TRUE;
+ self->closeFloater();
+
+ // Move the item to the trash
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if (item->getParentUUID() != trash_id)
+ {
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setParent(trash_id);
+ // no need to restamp it though it's a move into trash because
+ // it's a brand new item already.
+ new_item->updateParentOnServer(FALSE);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+ }
}
void LLPreview::handleReshape(const LLRect& new_rect, bool by_user)
{
- if(by_user
- && (new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()))
- {
- userResized();
- }
- LLFloater::handleReshape(new_rect, by_user);
+ if(by_user
+ && (new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()))
+ {
+ userResized();
+ }
+ LLFloater::handleReshape(new_rect, by_user);
}
//
@@ -481,88 +481,88 @@ void LLPreview::handleReshape(const LLRect& new_rect, bool by_user)
//
LLMultiPreview::LLMultiPreview()
- : LLMultiFloater(LLSD())
+ : LLMultiFloater(LLSD())
{
- // start with a rect in the top-left corner ; will get resized
- LLRect rect;
- rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 200, 400);
- setRect(rect);
-
- LLFloater* last_floater = LLFloaterReg::getLastFloaterInGroup("preview");
- if (last_floater)
- {
- stackWith(*last_floater);
- }
- setTitle(LLTrans::getString("MultiPreviewTitle"));
- buildTabContainer();
- setCanResize(TRUE);
+ // start with a rect in the top-left corner ; will get resized
+ LLRect rect;
+ rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 200, 400);
+ setRect(rect);
+
+ LLFloater* last_floater = LLFloaterReg::getLastFloaterInGroup("preview");
+ if (last_floater)
+ {
+ stackWith(*last_floater);
+ }
+ setTitle(LLTrans::getString("MultiPreviewTitle"));
+ buildTabContainer();
+ setCanResize(TRUE);
}
void LLMultiPreview::onOpen(const LLSD& key)
{
- // Floater could be something else than LLPreview, eg LLFloaterProfile.
- LLPreview* frontmost_preview = dynamic_cast<LLPreview*>(mTabContainer->getCurrentPanel());
-
- if (frontmost_preview && frontmost_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED)
- {
- frontmost_preview->loadAsset();
- }
- LLMultiFloater::onOpen(key);
+ // Floater could be something else than LLPreview, eg LLFloaterProfile.
+ LLPreview* frontmost_preview = dynamic_cast<LLPreview*>(mTabContainer->getCurrentPanel());
+
+ if (frontmost_preview && frontmost_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED)
+ {
+ frontmost_preview->loadAsset();
+ }
+ LLMultiFloater::onOpen(key);
}
void LLMultiPreview::handleReshape(const LLRect& new_rect, bool by_user)
{
- if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight())
- {
- // Floater could be something else than LLPreview, eg LLFloaterProfile.
- LLPreview* frontmost_preview = dynamic_cast<LLPreview*>(mTabContainer->getCurrentPanel());
-
- if (frontmost_preview)
- {
- frontmost_preview->userResized();
- }
- }
- LLFloater::handleReshape(new_rect, by_user);
+ if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight())
+ {
+ // Floater could be something else than LLPreview, eg LLFloaterProfile.
+ LLPreview* frontmost_preview = dynamic_cast<LLPreview*>(mTabContainer->getCurrentPanel());
+
+ if (frontmost_preview)
+ {
+ frontmost_preview->userResized();
+ }
+ }
+ LLFloater::handleReshape(new_rect, by_user);
}
void LLMultiPreview::tabOpen(LLFloater* opened_floater, bool from_click)
{
- // Floater could be something else than LLPreview, eg LLFloaterProfile.
- LLPreview* opened_preview = dynamic_cast<LLPreview*>(opened_floater);
+ // Floater could be something else than LLPreview, eg LLFloaterProfile.
+ LLPreview* opened_preview = dynamic_cast<LLPreview*>(opened_floater);
- if (opened_preview && opened_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED)
- {
- opened_preview->loadAsset();
- }
+ if (opened_preview && opened_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED)
+ {
+ opened_preview->loadAsset();
+ }
}
void LLPreview::setAssetId(const LLUUID& asset_id)
{
- const LLViewerInventoryItem* item = dynamic_cast<const LLViewerInventoryItem*>(getItem());
- if(NULL == item)
- {
- return;
- }
-
- if(mObjectUUID.isNull())
- {
- // Update avatar inventory asset_id.
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setAssetUUID(asset_id);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- }
- else
- {
- // Update object inventory asset_id.
- LLViewerObject* object = gObjectList.findObject(mObjectUUID);
- if(NULL == object)
- {
- return;
- }
- object->updateViewerInventoryAsset(item, asset_id);
- }
+ const LLViewerInventoryItem* item = dynamic_cast<const LLViewerInventoryItem*>(getItem());
+ if(NULL == item)
+ {
+ return;
+ }
+
+ if(mObjectUUID.isNull())
+ {
+ // Update avatar inventory asset_id.
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setAssetUUID(asset_id);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+ }
+ else
+ {
+ // Update object inventory asset_id.
+ LLViewerObject* object = gObjectList.findObject(mObjectUUID);
+ if(NULL == object)
+ {
+ return;
+ }
+ object->updateViewerInventoryAsset(item, asset_id);
+ }
}
diff --git a/indra/newview/llpreview.h b/indra/newview/llpreview.h
index 3688ee0192..5b77cc6a25 100644
--- a/indra/newview/llpreview.h
+++ b/indra/newview/llpreview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreview.h
* @brief LLPreview class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,11 +44,11 @@ class LLPreview;
class LLMultiPreview : public LLMultiFloater
{
public:
- LLMultiPreview();
+ LLMultiPreview();
- /*virtual*/void onOpen(const LLSD& key);
- /*virtual*/void tabOpen(LLFloater* opened_floater, bool from_click);
- /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
+ /*virtual*/void onOpen(const LLSD& key);
+ /*virtual*/void tabOpen(LLFloater* opened_floater, bool from_click);
+ /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
};
@@ -57,103 +57,103 @@ public:
class LLPreview : public LLFloater, LLInventoryObserver
{
public:
- typedef enum e_asset_status
- {
- PREVIEW_ASSET_ERROR,
- PREVIEW_ASSET_UNLOADED,
- PREVIEW_ASSET_LOADING,
- PREVIEW_ASSET_LOADED
- } EAssetStatus;
+ typedef enum e_asset_status
+ {
+ PREVIEW_ASSET_ERROR,
+ PREVIEW_ASSET_UNLOADED,
+ PREVIEW_ASSET_LOADING,
+ PREVIEW_ASSET_LOADED
+ } EAssetStatus;
public:
- LLPreview(const LLSD& key );
- virtual ~LLPreview();
-
- /*virtual*/ BOOL postBuild();
-
- virtual void setObjectID(const LLUUID& object_id);
- void setItem( LLInventoryItem* item );
-
- void setAssetId(const LLUUID& asset_id);
- const LLInventoryItem* getItem() const; // searches if not constructed with it
-
- static void hide(const LLUUID& item_uuid, BOOL no_saving = FALSE );
- static void dirty(const LLUUID& item_uuid);
-
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual void onOpen(const LLSD& key);
-
- virtual void setAuxItem( const LLInventoryItem* item );
-
- static void onBtnCopyToInv(void* userdata);
-
- void addKeepDiscardButtons();
- static void onKeepBtn(void* data);
- static void onDiscardBtn(void* data);
- /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
-
- void userResized() { mUserResized = TRUE; };
-
- virtual void loadAsset() { mAssetStatus = PREVIEW_ASSET_LOADED; }
- virtual EAssetStatus getAssetStatus() { return mAssetStatus;}
-
- static LLPreview* getFirstPreviewForSource(const LLUUID& source_id);
-
- // Why is this at the LLPreview level? JC
- void setNotecardInfo(const LLUUID& notecard_inv_id, const LLUUID& object_id);
-
- // llview
- /*virtual*/ void draw();
- virtual void refreshFromItem();
-
- // We can't modify Item or description in preview if either in-world Object
- // or Item itself is unmodifiable
- static BOOL canModify(const LLUUID taskUUID, const LLInventoryItem* item);
- static BOOL canModify(const LLViewerObject* object, const LLInventoryItem* item);
+ LLPreview(const LLSD& key );
+ virtual ~LLPreview();
+
+ /*virtual*/ BOOL postBuild();
+
+ virtual void setObjectID(const LLUUID& object_id);
+ void setItem( LLInventoryItem* item );
+
+ void setAssetId(const LLUUID& asset_id);
+ const LLInventoryItem* getItem() const; // searches if not constructed with it
+
+ static void hide(const LLUUID& item_uuid, BOOL no_saving = FALSE );
+ static void dirty(const LLUUID& item_uuid);
+
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual void onOpen(const LLSD& key);
+
+ virtual void setAuxItem( const LLInventoryItem* item );
+
+ static void onBtnCopyToInv(void* userdata);
+
+ void addKeepDiscardButtons();
+ static void onKeepBtn(void* data);
+ static void onDiscardBtn(void* data);
+ /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
+
+ void userResized() { mUserResized = TRUE; };
+
+ virtual void loadAsset() { mAssetStatus = PREVIEW_ASSET_LOADED; }
+ virtual EAssetStatus getAssetStatus() { return mAssetStatus;}
+
+ static LLPreview* getFirstPreviewForSource(const LLUUID& source_id);
+
+ // Why is this at the LLPreview level? JC
+ void setNotecardInfo(const LLUUID& notecard_inv_id, const LLUUID& object_id);
+
+ // llview
+ /*virtual*/ void draw();
+ virtual void refreshFromItem();
+
+ // We can't modify Item or description in preview if either in-world Object
+ // or Item itself is unmodifiable
+ static BOOL canModify(const LLUUID taskUUID, const LLInventoryItem* item);
+ static BOOL canModify(const LLViewerObject* object, const LLInventoryItem* item);
protected:
- virtual void onCommit();
+ virtual void onCommit();
+
+ void addDescriptionUI();
- void addDescriptionUI();
+ static void onText(LLUICtrl*, void* userdata);
+ static void onRadio(LLUICtrl*, void* userdata);
- static void onText(LLUICtrl*, void* userdata);
- static void onRadio(LLUICtrl*, void* userdata);
-
- // for LLInventoryObserver
- virtual void changed(U32 mask);
- BOOL mDirty;
- BOOL mSaveDialogShown;
+ // for LLInventoryObserver
+ virtual void changed(U32 mask);
+ BOOL mDirty;
+ BOOL mSaveDialogShown;
protected:
- LLUUID mItemUUID;
+ LLUUID mItemUUID;
- // mObjectUUID will have a value if it is associated with a task in
- // the world, and will be == LLUUID::null if it's in the agent
- // inventory.
- LLUUID mObjectUUID;
+ // mObjectUUID will have a value if it is associated with a task in
+ // the world, and will be == LLUUID::null if it's in the agent
+ // inventory.
+ LLUUID mObjectUUID;
- LLRect mClientRect;
+ LLRect mClientRect;
- LLPointer<LLInventoryItem> mAuxItem; // HACK!
- LLPointer<LLInventoryItem> mItem; // For embedded items (Landmarks)
- LLButton* mCopyToInvBtn;
+ LLPointer<LLInventoryItem> mAuxItem; // HACK!
+ LLPointer<LLInventoryItem> mItem; // For embedded items (Landmarks)
+ LLButton* mCopyToInvBtn;
- // Close without saving changes
- BOOL mForceClose;
+ // Close without saving changes
+ BOOL mForceClose;
- BOOL mUserResized;
+ BOOL mUserResized;
- // When closing springs a "Want to save?" dialog, we want
- // to keep the preview open until the save completes.
- BOOL mCloseAfterSave;
+ // When closing springs a "Want to save?" dialog, we want
+ // to keep the preview open until the save completes.
+ BOOL mCloseAfterSave;
- EAssetStatus mAssetStatus;
+ EAssetStatus mAssetStatus;
- LLUUID mNotecardInventoryID;
- // I am unsure if this is always the same as mObjectUUID, or why it exists
- // at the LLPreview level. JC 2009-06-24
- LLUUID mNotecardObjectID;
+ LLUUID mNotecardInventoryID;
+ // I am unsure if this is always the same as mObjectUUID, or why it exists
+ // at the LLPreview level. JC 2009-06-24
+ LLUUID mNotecardObjectID;
};
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index 7f01438425..dfc41b6700 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewanim.cpp
* @brief LLPreviewAnim class implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,121 +44,121 @@ extern LLAgent gAgent;
const S32 ADVANCED_VPAD = 3;
LLPreviewAnim::LLPreviewAnim(const LLSD& key)
- : LLPreview( key )
+ : LLPreview( key )
{
- mCommitCallbackRegistrar.add("PreviewAnim.Play", boost::bind(&LLPreviewAnim::play, this, _2));
+ mCommitCallbackRegistrar.add("PreviewAnim.Play", boost::bind(&LLPreviewAnim::play, this, _2));
}
// virtual
BOOL LLPreviewAnim::postBuild()
{
- childSetCommitCallback("desc", LLPreview::onText, this);
- getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
- getChild<LLTextBox>("adv_trigger")->setClickedCallback(boost::bind(&LLPreviewAnim::showAdvanced, this));
- pAdvancedStatsTextBox = getChild<LLTextBox>("AdvancedStats");
+ childSetCommitCallback("desc", LLPreview::onText, this);
+ getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ getChild<LLTextBox>("adv_trigger")->setClickedCallback(boost::bind(&LLPreviewAnim::showAdvanced, this));
+ pAdvancedStatsTextBox = getChild<LLTextBox>("AdvancedStats");
// Assume that advanced stats start visible (for XUI preview tool's purposes)
pAdvancedStatsTextBox->setVisible(FALSE);
LLRect rect = getRect();
reshape(rect.getWidth(), rect.getHeight() - pAdvancedStatsTextBox->getRect().getHeight() - ADVANCED_VPAD, FALSE);
- return LLPreview::postBuild();
+ return LLPreview::postBuild();
}
// llinventorybridge also calls into here
void LLPreviewAnim::play(const LLSD& param)
{
- const LLInventoryItem *item = getItem();
-
- if(item)
- {
- LLUUID itemID=item->getAssetUUID();
-
- std::string btn_name = param.asString();
- LLButton* btn_inuse;
- LLButton* btn_other;
-
- if ("Inworld" == btn_name)
- {
- btn_inuse = getChild<LLButton>("Inworld");
- btn_other = getChild<LLButton>("Locally");
- }
- else if ("Locally" == btn_name)
- {
- btn_inuse = getChild<LLButton>("Locally");
- btn_other = getChild<LLButton>("Inworld");
- }
- else
- {
- return;
- }
-
- if (btn_inuse)
- {
- btn_inuse->toggleState();
- }
-
- if (btn_other)
- {
- btn_other->setEnabled(false);
- }
-
- if (getChild<LLUICtrl>(btn_name)->getValue().asBoolean() )
- {
- if("Inworld" == btn_name)
- {
- gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START);
- }
- else
- {
- gAgentAvatarp->startMotion(item->getAssetUUID());
- }
-
- LLMotion* motion = gAgentAvatarp->findMotion(itemID);
- if (motion)
- {
- mItemID = itemID;
- mDidStart = false;
- }
- }
- else
- {
- gAgentAvatarp->stopMotion(itemID);
- gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
-
- if (btn_other)
- {
- btn_other->setEnabled(true);
- }
- }
- }
+ const LLInventoryItem *item = getItem();
+
+ if(item)
+ {
+ LLUUID itemID=item->getAssetUUID();
+
+ std::string btn_name = param.asString();
+ LLButton* btn_inuse;
+ LLButton* btn_other;
+
+ if ("Inworld" == btn_name)
+ {
+ btn_inuse = getChild<LLButton>("Inworld");
+ btn_other = getChild<LLButton>("Locally");
+ }
+ else if ("Locally" == btn_name)
+ {
+ btn_inuse = getChild<LLButton>("Locally");
+ btn_other = getChild<LLButton>("Inworld");
+ }
+ else
+ {
+ return;
+ }
+
+ if (btn_inuse)
+ {
+ btn_inuse->toggleState();
+ }
+
+ if (btn_other)
+ {
+ btn_other->setEnabled(false);
+ }
+
+ if (getChild<LLUICtrl>(btn_name)->getValue().asBoolean() )
+ {
+ if("Inworld" == btn_name)
+ {
+ gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START);
+ }
+ else
+ {
+ gAgentAvatarp->startMotion(item->getAssetUUID());
+ }
+
+ LLMotion* motion = gAgentAvatarp->findMotion(itemID);
+ if (motion)
+ {
+ mItemID = itemID;
+ mDidStart = false;
+ }
+ }
+ else
+ {
+ gAgentAvatarp->stopMotion(itemID);
+ gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
+
+ if (btn_other)
+ {
+ btn_other->setEnabled(true);
+ }
+ }
+ }
}
// virtual
void LLPreviewAnim::draw()
{
- LLPreview::draw();
- if (!this->mItemID.isNull())
- {
- LLMotion* motion = gAgentAvatarp->findMotion(this->mItemID);
- if (motion)
- {
- if (motion->isStopped() && this->mDidStart)
- {
- cleanup();
- }
- if(gAgentAvatarp->isMotionActive(this->mItemID) && !this->mDidStart)
- {
- const LLInventoryItem *item = getItem();
- LLMotion* motion = gAgentAvatarp->findMotion(this->mItemID);
- if (item && motion)
- {
- motion->setName(item->getName());
- }
- this->mDidStart = true;
- }
- }
- }
+ LLPreview::draw();
+ if (!this->mItemID.isNull())
+ {
+ LLMotion* motion = gAgentAvatarp->findMotion(this->mItemID);
+ if (motion)
+ {
+ if (motion->isStopped() && this->mDidStart)
+ {
+ cleanup();
+ }
+ if(gAgentAvatarp->isMotionActive(this->mItemID) && !this->mDidStart)
+ {
+ const LLInventoryItem *item = getItem();
+ LLMotion* motion = gAgentAvatarp->findMotion(this->mItemID);
+ if (item && motion)
+ {
+ motion->setName(item->getName());
+ }
+ this->mDidStart = true;
+ }
+ }
+ }
}
// virtual
@@ -171,31 +171,31 @@ void LLPreviewAnim::refreshFromItem()
}
// Preload motion
- gAgentAvatarp->createMotion(item->getAssetUUID());
+ gAgentAvatarp->createMotion(item->getAssetUUID());
LLPreview::refreshFromItem();
}
void LLPreviewAnim::cleanup()
{
- this->mItemID = LLUUID::null;
- this->mDidStart = false;
- getChild<LLUICtrl>("Inworld")->setValue(FALSE);
- getChild<LLUICtrl>("Locally")->setValue(FALSE);
- getChild<LLUICtrl>("Inworld")->setEnabled(TRUE);
- getChild<LLUICtrl>("Locally")->setEnabled(TRUE);
+ this->mItemID = LLUUID::null;
+ this->mDidStart = false;
+ getChild<LLUICtrl>("Inworld")->setValue(FALSE);
+ getChild<LLUICtrl>("Locally")->setValue(FALSE);
+ getChild<LLUICtrl>("Inworld")->setEnabled(TRUE);
+ getChild<LLUICtrl>("Locally")->setEnabled(TRUE);
}
// virtual
void LLPreviewAnim::onClose(bool app_quitting)
{
- const LLInventoryItem *item = getItem();
+ const LLInventoryItem *item = getItem();
- if(item)
- {
- gAgentAvatarp->stopMotion(item->getAssetUUID());
- gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP);
- }
+ if(item)
+ {
+ gAgentAvatarp->stopMotion(item->getAssetUUID());
+ gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP);
+ }
}
void LLPreviewAnim::showAdvanced()
diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h
index 9f4ad4fa69..ccaca6ff96 100644
--- a/indra/newview/llpreviewanim.h
+++ b/indra/newview/llpreviewanim.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewanim.h
* @brief LLPreviewAnim class definition
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,21 +37,21 @@ class LLPreviewAnim : public LLPreview
{
public:
- LLPreviewAnim(const LLSD& key);
- BOOL postBuild() override;
- void onClose(bool app_quitting) override;
- void draw() override;
- void refreshFromItem() override;
+ LLPreviewAnim(const LLSD& key);
+ BOOL postBuild() override;
+ void onClose(bool app_quitting) override;
+ void draw() override;
+ void refreshFromItem() override;
- void cleanup(); // cleanup 'playing' state
- void play(const LLSD& param);
- void showAdvanced();
+ void cleanup(); // cleanup 'playing' state
+ void play(const LLSD& param);
+ void showAdvanced();
protected:
-
- LLUUID mItemID; // Not an item id, but a playing asset id
- bool mDidStart;
- LLTextBox* pAdvancedStatsTextBox;
+
+ LLUUID mItemID; // Not an item id, but a playing asset id
+ bool mDidStart;
+ LLTextBox* pAdvancedStatsTextBox;
};
#endif // LL_LLPREVIEWANIM_H
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 544ff8b5dc..5b95decbd8 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewgesture.cpp
* @brief Editing UI for inventory-based gestures.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -64,163 +64,163 @@ void dialog_refresh_all();
class LLInventoryGestureAvailable : public LLInventoryCompletionObserver
{
public:
- LLInventoryGestureAvailable() {}
+ LLInventoryGestureAvailable() {}
protected:
- virtual void done();
+ virtual void done();
};
void LLInventoryGestureAvailable::done()
{
- for(uuid_vec_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it)
- {
- LLPreviewGesture* preview = LLFloaterReg::findTypedInstance<LLPreviewGesture>("preview_gesture", *it);
- if(preview)
- {
- preview->refresh();
- }
- }
- gInventory.removeObserver(this);
- delete this;
+ for(uuid_vec_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it)
+ {
+ LLPreviewGesture* preview = LLFloaterReg::findTypedInstance<LLPreviewGesture>("preview_gesture", *it);
+ if(preview)
+ {
+ preview->refresh();
+ }
+ }
+ gInventory.removeObserver(this);
+ delete this;
}
// Used for sorting
struct SortItemPtrsByName
{
- bool operator()(const LLInventoryItem* i1, const LLInventoryItem* i2)
- {
- return (LLStringUtil::compareDict(i1->getName(), i2->getName()) < 0);
- }
+ bool operator()(const LLInventoryItem* i1, const LLInventoryItem* i2)
+ {
+ return (LLStringUtil::compareDict(i1->getName(), i2->getName()) < 0);
+ }
};
// static
LLPreviewGesture* LLPreviewGesture::show(const LLUUID& item_id, const LLUUID& object_id)
{
- LLPreviewGesture* preview = LLFloaterReg::showTypedInstance<LLPreviewGesture>("preview_gesture", LLSD(item_id), TAKE_FOCUS_YES);
- if (!preview)
- {
- return NULL;
- }
-
- preview->setObjectID(object_id);
-
- // Start speculative download of sounds and animations
- const LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ANIMATION);
- LLInventoryModelBackgroundFetch::instance().start(animation_folder_id);
-
- const LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SOUND);
- LLInventoryModelBackgroundFetch::instance().start(sound_folder_id);
-
- // this will call refresh when we have everything.
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)preview->getItem();
- if (item && !item->isFinished())
- {
- LLInventoryGestureAvailable* observer;
- observer = new LLInventoryGestureAvailable();
- observer->watchItem(item_id);
- gInventory.addObserver(observer);
- item->fetchFromServer();
- }
- else
- {
- // not sure this is necessary.
- preview->refresh();
- }
-
- return preview;
+ LLPreviewGesture* preview = LLFloaterReg::showTypedInstance<LLPreviewGesture>("preview_gesture", LLSD(item_id), TAKE_FOCUS_YES);
+ if (!preview)
+ {
+ return NULL;
+ }
+
+ preview->setObjectID(object_id);
+
+ // Start speculative download of sounds and animations
+ const LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ANIMATION);
+ LLInventoryModelBackgroundFetch::instance().start(animation_folder_id);
+
+ const LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SOUND);
+ LLInventoryModelBackgroundFetch::instance().start(sound_folder_id);
+
+ // this will call refresh when we have everything.
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)preview->getItem();
+ if (item && !item->isFinished())
+ {
+ LLInventoryGestureAvailable* observer;
+ observer = new LLInventoryGestureAvailable();
+ observer->watchItem(item_id);
+ gInventory.addObserver(observer);
+ item->fetchFromServer();
+ }
+ else
+ {
+ // not sure this is necessary.
+ preview->refresh();
+ }
+
+ return preview;
}
void LLPreviewGesture::draw()
{
- // Skip LLPreview::draw() to avoid description update
- LLFloater::draw();
+ // Skip LLPreview::draw() to avoid description update
+ LLFloater::draw();
}
// virtual
BOOL LLPreviewGesture::handleKeyHere(KEY key, MASK mask)
{
- if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL)))
- {
- saveIfNeeded();
- return TRUE;
- }
+ if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL)))
+ {
+ saveIfNeeded();
+ return TRUE;
+ }
- return LLPreview::handleKeyHere(key, mask);
+ return LLPreview::handleKeyHere(key, mask);
}
// virtual
BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
{
- BOOL handled = TRUE;
- switch(cargo_type)
- {
- case DAD_ANIMATION:
- case DAD_SOUND:
- {
- // TODO: Don't allow this if you can't transfer the sound/animation
-
- // make a script step
- LLInventoryItem* item = (LLInventoryItem*)cargo_data;
- if (item
- && gInventory.getItem(item->getUUID()))
- {
- LLPermissions perm = item->getPermissions();
- if (!((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED))
- {
- *accept = ACCEPT_NO;
- if (tooltip_msg.empty())
- {
- tooltip_msg.assign("Only animations and sounds\n"
- "with unrestricted permissions\n"
- "can be added to a gesture.");
- }
- break;
- }
- else if (drop)
- {
- LLScrollListItem* line = NULL;
- if (cargo_type == DAD_ANIMATION)
- {
- line = addStep( STEP_ANIMATION );
- LLGestureStepAnimation* anim = (LLGestureStepAnimation*)line->getUserdata();
- anim->mAnimAssetID = item->getAssetUUID();
- anim->mAnimName = item->getName();
- }
- else if (cargo_type == DAD_SOUND)
- {
- line = addStep( STEP_SOUND );
- LLGestureStepSound* sound = (LLGestureStepSound*)line->getUserdata();
- sound->mSoundAssetID = item->getAssetUUID();
- sound->mSoundName = item->getName();
- }
- updateLabel(line);
- mDirty = TRUE;
- refresh();
- }
- *accept = ACCEPT_YES_COPY_MULTI;
- }
- else
- {
- // Not in user's inventory means it was in object inventory
- *accept = ACCEPT_NO;
- }
- break;
- }
- default:
- *accept = ACCEPT_NO;
- if (tooltip_msg.empty())
- {
- tooltip_msg.assign("Only animations and sounds\n"
- "can be added to a gesture.");
- }
- break;
- }
- return handled;
+ BOOL handled = TRUE;
+ switch(cargo_type)
+ {
+ case DAD_ANIMATION:
+ case DAD_SOUND:
+ {
+ // TODO: Don't allow this if you can't transfer the sound/animation
+
+ // make a script step
+ LLInventoryItem* item = (LLInventoryItem*)cargo_data;
+ if (item
+ && gInventory.getItem(item->getUUID()))
+ {
+ LLPermissions perm = item->getPermissions();
+ if (!((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED))
+ {
+ *accept = ACCEPT_NO;
+ if (tooltip_msg.empty())
+ {
+ tooltip_msg.assign("Only animations and sounds\n"
+ "with unrestricted permissions\n"
+ "can be added to a gesture.");
+ }
+ break;
+ }
+ else if (drop)
+ {
+ LLScrollListItem* line = NULL;
+ if (cargo_type == DAD_ANIMATION)
+ {
+ line = addStep( STEP_ANIMATION );
+ LLGestureStepAnimation* anim = (LLGestureStepAnimation*)line->getUserdata();
+ anim->mAnimAssetID = item->getAssetUUID();
+ anim->mAnimName = item->getName();
+ }
+ else if (cargo_type == DAD_SOUND)
+ {
+ line = addStep( STEP_SOUND );
+ LLGestureStepSound* sound = (LLGestureStepSound*)line->getUserdata();
+ sound->mSoundAssetID = item->getAssetUUID();
+ sound->mSoundName = item->getName();
+ }
+ updateLabel(line);
+ mDirty = TRUE;
+ refresh();
+ }
+ *accept = ACCEPT_YES_COPY_MULTI;
+ }
+ else
+ {
+ // Not in user's inventory means it was in object inventory
+ *accept = ACCEPT_NO;
+ }
+ break;
+ }
+ default:
+ *accept = ACCEPT_NO;
+ if (tooltip_msg.empty())
+ {
+ tooltip_msg.assign("Only animations and sounds\n"
+ "can be added to a gesture.");
+ }
+ break;
+ }
+ return handled;
}
@@ -228,799 +228,799 @@ BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
BOOL LLPreviewGesture::canClose()
{
- if(!mDirty || mForceClose)
- {
- return TRUE;
- }
- else
- {
- if(!mSaveDialogShown)
- {
- mSaveDialogShown = TRUE;
- // Bring up view-modal dialog: Save changes? Yes, No, Cancel
- LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(),
- boost::bind(&LLPreviewGesture::handleSaveChangesDialog, this, _1, _2) );
- }
- return FALSE;
- }
+ if(!mDirty || mForceClose)
+ {
+ return TRUE;
+ }
+ else
+ {
+ if(!mSaveDialogShown)
+ {
+ mSaveDialogShown = TRUE;
+ // Bring up view-modal dialog: Save changes? Yes, No, Cancel
+ LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(),
+ boost::bind(&LLPreviewGesture::handleSaveChangesDialog, this, _1, _2) );
+ }
+ return FALSE;
+ }
}
// virtual
void LLPreviewGesture::onClose(bool app_quitting)
{
- LLGestureMgr::instance().stopGesture(mPreviewGesture);
+ LLGestureMgr::instance().stopGesture(mPreviewGesture);
}
// virtual
void LLPreviewGesture::onUpdateSucceeded()
{
- refresh();
+ refresh();
}
void LLPreviewGesture::onVisibilityChanged ( const LLSD& new_visibility )
{
- if (new_visibility.asBoolean())
- {
- refresh();
- }
+ if (new_visibility.asBoolean())
+ {
+ refresh();
+ }
}
bool LLPreviewGesture::handleSaveChangesDialog(const LLSD& notification, const LLSD& response)
{
- mSaveDialogShown = FALSE;
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch(option)
- {
- case 0: // "Yes"
- LLGestureMgr::instance().stopGesture(mPreviewGesture);
- mCloseAfterSave = TRUE;
- onClickSave(this);
- break;
-
- case 1: // "No"
- LLGestureMgr::instance().stopGesture(mPreviewGesture);
- mDirty = FALSE; // Force the dirty flag because user has clicked NO on confirm save dialog...
- closeFloater();
- break;
-
- case 2: // "Cancel"
- default:
- // If we were quitting, we didn't really mean it.
- LLAppViewer::instance()->abortQuit();
- break;
- }
- return false;
+ mSaveDialogShown = FALSE;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case 0: // "Yes"
+ LLGestureMgr::instance().stopGesture(mPreviewGesture);
+ mCloseAfterSave = TRUE;
+ onClickSave(this);
+ break;
+
+ case 1: // "No"
+ LLGestureMgr::instance().stopGesture(mPreviewGesture);
+ mDirty = FALSE; // Force the dirty flag because user has clicked NO on confirm save dialog...
+ closeFloater();
+ break;
+
+ case 2: // "Cancel"
+ default:
+ // If we were quitting, we didn't really mean it.
+ LLAppViewer::instance()->abortQuit();
+ break;
+ }
+ return false;
}
LLPreviewGesture::LLPreviewGesture(const LLSD& key)
-: LLPreview(key),
- mTriggerEditor(NULL),
- mModifierCombo(NULL),
- mKeyCombo(NULL),
- mLibraryList(NULL),
- mAddBtn(NULL),
- mUpBtn(NULL),
- mDownBtn(NULL),
- mDeleteBtn(NULL),
- mStepList(NULL),
- mOptionsText(NULL),
- mAnimationRadio(NULL),
- mAnimationCombo(NULL),
- mSoundCombo(NULL),
- mChatEditor(NULL),
- mSaveBtn(NULL),
- mPreviewBtn(NULL),
- mPreviewGesture(NULL),
- mDirty(FALSE)
+: LLPreview(key),
+ mTriggerEditor(NULL),
+ mModifierCombo(NULL),
+ mKeyCombo(NULL),
+ mLibraryList(NULL),
+ mAddBtn(NULL),
+ mUpBtn(NULL),
+ mDownBtn(NULL),
+ mDeleteBtn(NULL),
+ mStepList(NULL),
+ mOptionsText(NULL),
+ mAnimationRadio(NULL),
+ mAnimationCombo(NULL),
+ mSoundCombo(NULL),
+ mChatEditor(NULL),
+ mSaveBtn(NULL),
+ mPreviewBtn(NULL),
+ mPreviewGesture(NULL),
+ mDirty(FALSE)
{
- NONE_LABEL = LLTrans::getString("---");
- SHIFT_LABEL = LLTrans::getString("KBShift");
- CTRL_LABEL = LLTrans::getString("KBCtrl");
+ NONE_LABEL = LLTrans::getString("---");
+ SHIFT_LABEL = LLTrans::getString("KBShift");
+ CTRL_LABEL = LLTrans::getString("KBCtrl");
}
LLPreviewGesture::~LLPreviewGesture()
{
- // Userdata for all steps is a LLGestureStep we need to clean up
- std::vector<LLScrollListItem*> data_list = mStepList->getAllData();
- std::vector<LLScrollListItem*>::iterator data_itor;
- for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor)
- {
- LLScrollListItem* item = *data_itor;
- LLGestureStep* step = (LLGestureStep*)item->getUserdata();
- delete step;
- step = NULL;
- }
+ // Userdata for all steps is a LLGestureStep we need to clean up
+ std::vector<LLScrollListItem*> data_list = mStepList->getAllData();
+ std::vector<LLScrollListItem*>::iterator data_itor;
+ for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor)
+ {
+ LLScrollListItem* item = *data_itor;
+ LLGestureStep* step = (LLGestureStep*)item->getUserdata();
+ delete step;
+ step = NULL;
+ }
}
BOOL LLPreviewGesture::postBuild()
{
- setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChanged, this, _2));
-
- LLLineEditor* edit;
- LLComboBox* combo;
- LLButton* btn;
- LLScrollListCtrl* list;
- LLTextBox* text;
- LLCheckBoxCtrl* check;
-
- edit = getChild<LLLineEditor>("desc");
- edit->setKeystrokeCallback(onKeystrokeCommit, this);
-
- edit = getChild<LLLineEditor>("trigger_editor");
- edit->setKeystrokeCallback(onKeystrokeCommit, this);
- edit->setCommitCallback(onCommitSetDirty, this);
- edit->setCommitOnFocusLost(TRUE);
- edit->setIgnoreTab(TRUE);
- mTriggerEditor = edit;
-
- text = getChild<LLTextBox>("replace_text");
- text->setEnabled(FALSE);
- mReplaceText = text;
-
- edit = getChild<LLLineEditor>("replace_editor");
- edit->setEnabled(FALSE);
- edit->setKeystrokeCallback(onKeystrokeCommit, this);
- edit->setCommitCallback(onCommitSetDirty, this);
- edit->setCommitOnFocusLost(TRUE);
- edit->setIgnoreTab(TRUE);
- mReplaceEditor = edit;
-
- combo = getChild<LLComboBox>( "modifier_combo");
- combo->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitKeyorModifier, this));
- mModifierCombo = combo;
-
- combo = getChild<LLComboBox>( "key_combo");
- combo->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitKeyorModifier, this));
- mKeyCombo = combo;
-
- list = getChild<LLScrollListCtrl>("library_list");
- list->setCommitCallback(onCommitLibrary, this);
- list->setDoubleClickCallback(onClickAdd, this);
- mLibraryList = list;
-
- btn = getChild<LLButton>( "add_btn");
- btn->setClickedCallback(onClickAdd, this);
- btn->setEnabled(FALSE);
- mAddBtn = btn;
-
- btn = getChild<LLButton>( "up_btn");
- btn->setClickedCallback(onClickUp, this);
- btn->setEnabled(FALSE);
- mUpBtn = btn;
-
- btn = getChild<LLButton>( "down_btn");
- btn->setClickedCallback(onClickDown, this);
- btn->setEnabled(FALSE);
- mDownBtn = btn;
-
- btn = getChild<LLButton>( "delete_btn");
- btn->setClickedCallback(onClickDelete, this);
- btn->setEnabled(FALSE);
- mDeleteBtn = btn;
-
- list = getChild<LLScrollListCtrl>("step_list");
- list->setCommitCallback(onCommitStep, this);
- mStepList = list;
-
- // Options
- mOptionsText = getChild<LLTextBox>("options_text");
-
- combo = getChild<LLComboBox>( "animation_list");
- combo->setVisible(FALSE);
- combo->setCommitCallback(onCommitAnimation, this);
- mAnimationCombo = combo;
-
- LLRadioGroup* group;
- group = getChild<LLRadioGroup>("animation_trigger_type");
- group->setVisible(FALSE);
- group->setCommitCallback(onCommitAnimationTrigger, this);
- mAnimationRadio = group;
-
- combo = getChild<LLComboBox>( "sound_list");
- combo->setVisible(FALSE);
- combo->setCommitCallback(onCommitSound, this);
- mSoundCombo = combo;
-
- edit = getChild<LLLineEditor>("chat_editor");
- edit->setVisible(FALSE);
- edit->setCommitCallback(onCommitChat, this);
- //edit->setKeystrokeCallback(onKeystrokeCommit, this);
- edit->setCommitOnFocusLost(TRUE);
- edit->setIgnoreTab(TRUE);
- mChatEditor = edit;
-
- check = getChild<LLCheckBoxCtrl>( "wait_anim_check");
- check->setVisible(FALSE);
- check->setCommitCallback(onCommitWait, this);
- mWaitAnimCheck = check;
-
- check = getChild<LLCheckBoxCtrl>( "wait_time_check");
- check->setVisible(FALSE);
- check->setCommitCallback(onCommitWait, this);
- mWaitTimeCheck = check;
-
- edit = getChild<LLLineEditor>("wait_time_editor");
- edit->setEnabled(FALSE);
- edit->setVisible(FALSE);
- edit->setPrevalidate(LLTextValidate::validateFloat);
-// edit->setKeystrokeCallback(onKeystrokeCommit, this);
- edit->setCommitOnFocusLost(TRUE);
- edit->setCommitCallback(onCommitWaitTime, this);
- edit->setIgnoreTab(TRUE);
- mWaitTimeEditor = edit;
-
- // Buttons at the bottom
- check = getChild<LLCheckBoxCtrl>( "active_check");
- check->setCommitCallback(onCommitActive, this);
- mActiveCheck = check;
-
- btn = getChild<LLButton>( "save_btn");
- btn->setClickedCallback(onClickSave, this);
- mSaveBtn = btn;
-
- btn = getChild<LLButton>( "preview_btn");
- btn->setClickedCallback(onClickPreview, this);
- mPreviewBtn = btn;
-
-
- // Populate the comboboxes
- addModifiers();
- addKeys();
- addAnimations();
- addSounds();
-
- const LLInventoryItem* item = getItem();
-
- if (item)
- {
- getChild<LLUICtrl>("desc")->setValue(item->getDescription());
- getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
- }
-
- return LLPreview::postBuild();
+ setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChanged, this, _2));
+
+ LLLineEditor* edit;
+ LLComboBox* combo;
+ LLButton* btn;
+ LLScrollListCtrl* list;
+ LLTextBox* text;
+ LLCheckBoxCtrl* check;
+
+ edit = getChild<LLLineEditor>("desc");
+ edit->setKeystrokeCallback(onKeystrokeCommit, this);
+
+ edit = getChild<LLLineEditor>("trigger_editor");
+ edit->setKeystrokeCallback(onKeystrokeCommit, this);
+ edit->setCommitCallback(onCommitSetDirty, this);
+ edit->setCommitOnFocusLost(TRUE);
+ edit->setIgnoreTab(TRUE);
+ mTriggerEditor = edit;
+
+ text = getChild<LLTextBox>("replace_text");
+ text->setEnabled(FALSE);
+ mReplaceText = text;
+
+ edit = getChild<LLLineEditor>("replace_editor");
+ edit->setEnabled(FALSE);
+ edit->setKeystrokeCallback(onKeystrokeCommit, this);
+ edit->setCommitCallback(onCommitSetDirty, this);
+ edit->setCommitOnFocusLost(TRUE);
+ edit->setIgnoreTab(TRUE);
+ mReplaceEditor = edit;
+
+ combo = getChild<LLComboBox>( "modifier_combo");
+ combo->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitKeyorModifier, this));
+ mModifierCombo = combo;
+
+ combo = getChild<LLComboBox>( "key_combo");
+ combo->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitKeyorModifier, this));
+ mKeyCombo = combo;
+
+ list = getChild<LLScrollListCtrl>("library_list");
+ list->setCommitCallback(onCommitLibrary, this);
+ list->setDoubleClickCallback(onClickAdd, this);
+ mLibraryList = list;
+
+ btn = getChild<LLButton>( "add_btn");
+ btn->setClickedCallback(onClickAdd, this);
+ btn->setEnabled(FALSE);
+ mAddBtn = btn;
+
+ btn = getChild<LLButton>( "up_btn");
+ btn->setClickedCallback(onClickUp, this);
+ btn->setEnabled(FALSE);
+ mUpBtn = btn;
+
+ btn = getChild<LLButton>( "down_btn");
+ btn->setClickedCallback(onClickDown, this);
+ btn->setEnabled(FALSE);
+ mDownBtn = btn;
+
+ btn = getChild<LLButton>( "delete_btn");
+ btn->setClickedCallback(onClickDelete, this);
+ btn->setEnabled(FALSE);
+ mDeleteBtn = btn;
+
+ list = getChild<LLScrollListCtrl>("step_list");
+ list->setCommitCallback(onCommitStep, this);
+ mStepList = list;
+
+ // Options
+ mOptionsText = getChild<LLTextBox>("options_text");
+
+ combo = getChild<LLComboBox>( "animation_list");
+ combo->setVisible(FALSE);
+ combo->setCommitCallback(onCommitAnimation, this);
+ mAnimationCombo = combo;
+
+ LLRadioGroup* group;
+ group = getChild<LLRadioGroup>("animation_trigger_type");
+ group->setVisible(FALSE);
+ group->setCommitCallback(onCommitAnimationTrigger, this);
+ mAnimationRadio = group;
+
+ combo = getChild<LLComboBox>( "sound_list");
+ combo->setVisible(FALSE);
+ combo->setCommitCallback(onCommitSound, this);
+ mSoundCombo = combo;
+
+ edit = getChild<LLLineEditor>("chat_editor");
+ edit->setVisible(FALSE);
+ edit->setCommitCallback(onCommitChat, this);
+ //edit->setKeystrokeCallback(onKeystrokeCommit, this);
+ edit->setCommitOnFocusLost(TRUE);
+ edit->setIgnoreTab(TRUE);
+ mChatEditor = edit;
+
+ check = getChild<LLCheckBoxCtrl>( "wait_anim_check");
+ check->setVisible(FALSE);
+ check->setCommitCallback(onCommitWait, this);
+ mWaitAnimCheck = check;
+
+ check = getChild<LLCheckBoxCtrl>( "wait_time_check");
+ check->setVisible(FALSE);
+ check->setCommitCallback(onCommitWait, this);
+ mWaitTimeCheck = check;
+
+ edit = getChild<LLLineEditor>("wait_time_editor");
+ edit->setEnabled(FALSE);
+ edit->setVisible(FALSE);
+ edit->setPrevalidate(LLTextValidate::validateFloat);
+// edit->setKeystrokeCallback(onKeystrokeCommit, this);
+ edit->setCommitOnFocusLost(TRUE);
+ edit->setCommitCallback(onCommitWaitTime, this);
+ edit->setIgnoreTab(TRUE);
+ mWaitTimeEditor = edit;
+
+ // Buttons at the bottom
+ check = getChild<LLCheckBoxCtrl>( "active_check");
+ check->setCommitCallback(onCommitActive, this);
+ mActiveCheck = check;
+
+ btn = getChild<LLButton>( "save_btn");
+ btn->setClickedCallback(onClickSave, this);
+ mSaveBtn = btn;
+
+ btn = getChild<LLButton>( "preview_btn");
+ btn->setClickedCallback(onClickPreview, this);
+ mPreviewBtn = btn;
+
+
+ // Populate the comboboxes
+ addModifiers();
+ addKeys();
+ addAnimations();
+ addSounds();
+
+ const LLInventoryItem* item = getItem();
+
+ if (item)
+ {
+ getChild<LLUICtrl>("desc")->setValue(item->getDescription());
+ getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ }
+
+ return LLPreview::postBuild();
}
void LLPreviewGesture::addModifiers()
{
- LLComboBox* combo = mModifierCombo;
+ LLComboBox* combo = mModifierCombo;
- combo->add( NONE_LABEL, ADD_BOTTOM );
- combo->add( SHIFT_LABEL, ADD_BOTTOM );
- combo->add( CTRL_LABEL, ADD_BOTTOM );
- combo->setCurrentByIndex(0);
+ combo->add( NONE_LABEL, ADD_BOTTOM );
+ combo->add( SHIFT_LABEL, ADD_BOTTOM );
+ combo->add( CTRL_LABEL, ADD_BOTTOM );
+ combo->setCurrentByIndex(0);
}
void LLPreviewGesture::addKeys()
{
- LLComboBox* combo = mKeyCombo;
-
- combo->add( NONE_LABEL );
- for (KEY key = KEY_F2; key <= KEY_F12; key++)
- {
- combo->add( LLKeyboard::stringFromKey(key), ADD_BOTTOM );
- }
- combo->setCurrentByIndex(0);
+ LLComboBox* combo = mKeyCombo;
+
+ combo->add( NONE_LABEL );
+ for (KEY key = KEY_F2; key <= KEY_F12; key++)
+ {
+ combo->add( LLKeyboard::stringFromKey(key), ADD_BOTTOM );
+ }
+ combo->setCurrentByIndex(0);
}
// TODO: Sort the legacy and non-legacy together?
void LLPreviewGesture::addAnimations()
{
- LLComboBox* combo = mAnimationCombo;
-
- combo->removeall();
-
- std::string none_text = getString("none_text");
-
- combo->add(none_text, LLUUID::null);
-
- // Add all the default (legacy) animations
- S32 i;
- for (i = 0; i < gUserAnimStatesCount; ++i)
- {
- // Use the user-readable name
- std::string label = LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName );
- const LLUUID& id = gUserAnimStates[i].mID;
- combo->add(label, id);
- }
-
- // Get all inventory items that are animations
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLIsTypeWithPermissions is_copyable_animation(LLAssetType::AT_ANIMATION,
- PERM_ITEM_UNRESTRICTED,
- gAgent.getID(),
- gAgent.getGroupID());
- gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_copyable_animation);
-
- // Copy into something we can sort
- std::vector<LLInventoryItem*> animations;
-
- S32 count = items.size();
- for(i = 0; i < count; ++i)
- {
- animations.push_back( items.at(i) );
- }
-
- // Do the sort
- std::sort(animations.begin(), animations.end(), SortItemPtrsByName());
-
- // And load up the combobox
- std::vector<LLInventoryItem*>::iterator it;
- for (it = animations.begin(); it != animations.end(); ++it)
- {
- LLInventoryItem* item = *it;
-
- combo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM);
- }
+ LLComboBox* combo = mAnimationCombo;
+
+ combo->removeall();
+
+ std::string none_text = getString("none_text");
+
+ combo->add(none_text, LLUUID::null);
+
+ // Add all the default (legacy) animations
+ S32 i;
+ for (i = 0; i < gUserAnimStatesCount; ++i)
+ {
+ // Use the user-readable name
+ std::string label = LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName );
+ const LLUUID& id = gUserAnimStates[i].mID;
+ combo->add(label, id);
+ }
+
+ // Get all inventory items that are animations
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLIsTypeWithPermissions is_copyable_animation(LLAssetType::AT_ANIMATION,
+ PERM_ITEM_UNRESTRICTED,
+ gAgent.getID(),
+ gAgent.getGroupID());
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_copyable_animation);
+
+ // Copy into something we can sort
+ std::vector<LLInventoryItem*> animations;
+
+ S32 count = items.size();
+ for(i = 0; i < count; ++i)
+ {
+ animations.push_back( items.at(i) );
+ }
+
+ // Do the sort
+ std::sort(animations.begin(), animations.end(), SortItemPtrsByName());
+
+ // And load up the combobox
+ std::vector<LLInventoryItem*>::iterator it;
+ for (it = animations.begin(); it != animations.end(); ++it)
+ {
+ LLInventoryItem* item = *it;
+
+ combo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM);
+ }
}
void LLPreviewGesture::addSounds()
{
- LLComboBox* combo = mSoundCombo;
- combo->removeall();
-
- std::string none_text = getString("none_text");
-
- combo->add(none_text, LLUUID::null);
-
- // Get all inventory items that are sounds
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLIsTypeWithPermissions is_copyable_sound(LLAssetType::AT_SOUND,
- PERM_ITEM_UNRESTRICTED,
- gAgent.getID(),
- gAgent.getGroupID());
- gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_copyable_sound);
-
- // Copy sounds into something we can sort
- std::vector<LLInventoryItem*> sounds;
-
- S32 i;
- S32 count = items.size();
- for(i = 0; i < count; ++i)
- {
- sounds.push_back( items.at(i) );
- }
-
- // Do the sort
- std::sort(sounds.begin(), sounds.end(), SortItemPtrsByName());
-
- // And load up the combobox
- std::vector<LLInventoryItem*>::iterator it;
- for (it = sounds.begin(); it != sounds.end(); ++it)
- {
- LLInventoryItem* item = *it;
-
- combo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM);
- }
+ LLComboBox* combo = mSoundCombo;
+ combo->removeall();
+
+ std::string none_text = getString("none_text");
+
+ combo->add(none_text, LLUUID::null);
+
+ // Get all inventory items that are sounds
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLIsTypeWithPermissions is_copyable_sound(LLAssetType::AT_SOUND,
+ PERM_ITEM_UNRESTRICTED,
+ gAgent.getID(),
+ gAgent.getGroupID());
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_copyable_sound);
+
+ // Copy sounds into something we can sort
+ std::vector<LLInventoryItem*> sounds;
+
+ S32 i;
+ S32 count = items.size();
+ for(i = 0; i < count; ++i)
+ {
+ sounds.push_back( items.at(i) );
+ }
+
+ // Do the sort
+ std::sort(sounds.begin(), sounds.end(), SortItemPtrsByName());
+
+ // And load up the combobox
+ std::vector<LLInventoryItem*>::iterator it;
+ for (it = sounds.begin(); it != sounds.end(); ++it)
+ {
+ LLInventoryItem* item = *it;
+
+ combo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM);
+ }
}
void LLPreviewGesture::refresh()
{
- LLPreview::refresh();
- // If previewing or item is incomplete, all controls are disabled
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem();
- bool is_complete = (item && item->isFinished()) ? true : false;
- if (mPreviewGesture || !is_complete)
- {
-
- getChildView("desc")->setEnabled(FALSE);
- //mDescEditor->setEnabled(FALSE);
- mTriggerEditor->setEnabled(FALSE);
- mReplaceText->setEnabled(FALSE);
- mReplaceEditor->setEnabled(FALSE);
- mModifierCombo->setEnabled(FALSE);
- mKeyCombo->setEnabled(FALSE);
- mLibraryList->setEnabled(FALSE);
- mAddBtn->setEnabled(FALSE);
- mUpBtn->setEnabled(FALSE);
- mDownBtn->setEnabled(FALSE);
- mDeleteBtn->setEnabled(FALSE);
- mStepList->setEnabled(FALSE);
- mOptionsText->setEnabled(FALSE);
- mAnimationCombo->setEnabled(FALSE);
- mAnimationRadio->setEnabled(FALSE);
- mSoundCombo->setEnabled(FALSE);
- mChatEditor->setEnabled(FALSE);
- mWaitAnimCheck->setEnabled(FALSE);
- mWaitTimeCheck->setEnabled(FALSE);
- mWaitTimeEditor->setEnabled(FALSE);
- mActiveCheck->setEnabled(FALSE);
- mSaveBtn->setEnabled(FALSE);
-
- // Make sure preview button is enabled, so we can stop it
- mPreviewBtn->setEnabled(TRUE);
- return;
- }
-
- BOOL modifiable = item->getPermissions().allowModifyBy(gAgent.getID());
-
- getChildView("desc")->setEnabled(modifiable);
- mTriggerEditor->setEnabled(TRUE);
- mLibraryList->setEnabled(modifiable);
- mStepList->setEnabled(modifiable);
- mOptionsText->setEnabled(modifiable);
- mAnimationCombo->setEnabled(modifiable);
- mAnimationRadio->setEnabled(modifiable);
- mSoundCombo->setEnabled(modifiable);
- mChatEditor->setEnabled(modifiable);
- mWaitAnimCheck->setEnabled(modifiable);
- mWaitTimeCheck->setEnabled(modifiable);
- mWaitTimeEditor->setEnabled(modifiable);
- mActiveCheck->setEnabled(TRUE);
-
- const std::string& trigger = mTriggerEditor->getText();
- BOOL have_trigger = !trigger.empty();
-
- const std::string& replace = mReplaceEditor->getText();
- BOOL have_replace = !replace.empty();
-
- LLScrollListItem* library_item = mLibraryList->getFirstSelected();
- BOOL have_library = (library_item != NULL);
-
- LLScrollListItem* step_item = mStepList->getFirstSelected();
- S32 step_index = mStepList->getFirstSelectedIndex();
- S32 step_count = mStepList->getItemCount();
- BOOL have_step = (step_item != NULL);
-
- mReplaceText->setEnabled(have_trigger || have_replace);
- mReplaceEditor->setEnabled(have_trigger || have_replace);
-
- mModifierCombo->setEnabled(TRUE);
- mKeyCombo->setEnabled(TRUE);
-
- mAddBtn->setEnabled(modifiable && have_library);
- mUpBtn->setEnabled(modifiable && have_step && step_index > 0);
- mDownBtn->setEnabled(modifiable && have_step && step_index < step_count-1);
- mDeleteBtn->setEnabled(modifiable && have_step);
-
- // Assume all not visible
- mAnimationCombo->setVisible(FALSE);
- mAnimationRadio->setVisible(FALSE);
- mSoundCombo->setVisible(FALSE);
- mChatEditor->setVisible(FALSE);
- mWaitAnimCheck->setVisible(FALSE);
- mWaitTimeCheck->setVisible(FALSE);
- mWaitTimeEditor->setVisible(FALSE);
-
- std::string optionstext;
-
- if (have_step)
- {
- // figure out the type, show proper options, update text
- LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
- EStepType type = step->getType();
-
- switch(type)
- {
- case STEP_ANIMATION:
- {
- LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- optionstext = getString("step_anim");
- mAnimationCombo->setVisible(TRUE);
- mAnimationRadio->setVisible(TRUE);
- mAnimationRadio->setSelectedIndex((anim_step->mFlags & ANIM_FLAG_STOP) ? 1 : 0);
- mAnimationCombo->setCurrentByID(anim_step->mAnimAssetID);
- break;
- }
- case STEP_SOUND:
- {
- LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
- optionstext = getString("step_sound");
- mSoundCombo->setVisible(TRUE);
- mSoundCombo->setCurrentByID(sound_step->mSoundAssetID);
- break;
- }
- case STEP_CHAT:
- {
- LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
- optionstext = getString("step_chat");
- mChatEditor->setVisible(TRUE);
- mChatEditor->setText(chat_step->mChatText);
- break;
- }
- case STEP_WAIT:
- {
- LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
- optionstext = getString("step_wait");
- mWaitAnimCheck->setVisible(TRUE);
- mWaitAnimCheck->set(wait_step->mFlags & WAIT_FLAG_ALL_ANIM);
- mWaitTimeCheck->setVisible(TRUE);
- mWaitTimeCheck->set(wait_step->mFlags & WAIT_FLAG_TIME);
- mWaitTimeEditor->setVisible(TRUE);
- std::string buffer = llformat("%.1f", (double)wait_step->mWaitSeconds);
- mWaitTimeEditor->setText(buffer);
- break;
- }
- default:
- break;
- }
- }
-
- mOptionsText->setText(optionstext);
-
- BOOL active = LLGestureMgr::instance().isGestureActive(mItemUUID);
- mActiveCheck->set(active);
-
- // Can only preview if there are steps
- mPreviewBtn->setEnabled(step_count > 0);
-
- // And can only save if changes have been made
- mSaveBtn->setEnabled(mDirty);
- addAnimations();
- addSounds();
+ LLPreview::refresh();
+ // If previewing or item is incomplete, all controls are disabled
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem();
+ bool is_complete = (item && item->isFinished()) ? true : false;
+ if (mPreviewGesture || !is_complete)
+ {
+
+ getChildView("desc")->setEnabled(FALSE);
+ //mDescEditor->setEnabled(FALSE);
+ mTriggerEditor->setEnabled(FALSE);
+ mReplaceText->setEnabled(FALSE);
+ mReplaceEditor->setEnabled(FALSE);
+ mModifierCombo->setEnabled(FALSE);
+ mKeyCombo->setEnabled(FALSE);
+ mLibraryList->setEnabled(FALSE);
+ mAddBtn->setEnabled(FALSE);
+ mUpBtn->setEnabled(FALSE);
+ mDownBtn->setEnabled(FALSE);
+ mDeleteBtn->setEnabled(FALSE);
+ mStepList->setEnabled(FALSE);
+ mOptionsText->setEnabled(FALSE);
+ mAnimationCombo->setEnabled(FALSE);
+ mAnimationRadio->setEnabled(FALSE);
+ mSoundCombo->setEnabled(FALSE);
+ mChatEditor->setEnabled(FALSE);
+ mWaitAnimCheck->setEnabled(FALSE);
+ mWaitTimeCheck->setEnabled(FALSE);
+ mWaitTimeEditor->setEnabled(FALSE);
+ mActiveCheck->setEnabled(FALSE);
+ mSaveBtn->setEnabled(FALSE);
+
+ // Make sure preview button is enabled, so we can stop it
+ mPreviewBtn->setEnabled(TRUE);
+ return;
+ }
+
+ BOOL modifiable = item->getPermissions().allowModifyBy(gAgent.getID());
+
+ getChildView("desc")->setEnabled(modifiable);
+ mTriggerEditor->setEnabled(TRUE);
+ mLibraryList->setEnabled(modifiable);
+ mStepList->setEnabled(modifiable);
+ mOptionsText->setEnabled(modifiable);
+ mAnimationCombo->setEnabled(modifiable);
+ mAnimationRadio->setEnabled(modifiable);
+ mSoundCombo->setEnabled(modifiable);
+ mChatEditor->setEnabled(modifiable);
+ mWaitAnimCheck->setEnabled(modifiable);
+ mWaitTimeCheck->setEnabled(modifiable);
+ mWaitTimeEditor->setEnabled(modifiable);
+ mActiveCheck->setEnabled(TRUE);
+
+ const std::string& trigger = mTriggerEditor->getText();
+ BOOL have_trigger = !trigger.empty();
+
+ const std::string& replace = mReplaceEditor->getText();
+ BOOL have_replace = !replace.empty();
+
+ LLScrollListItem* library_item = mLibraryList->getFirstSelected();
+ BOOL have_library = (library_item != NULL);
+
+ LLScrollListItem* step_item = mStepList->getFirstSelected();
+ S32 step_index = mStepList->getFirstSelectedIndex();
+ S32 step_count = mStepList->getItemCount();
+ BOOL have_step = (step_item != NULL);
+
+ mReplaceText->setEnabled(have_trigger || have_replace);
+ mReplaceEditor->setEnabled(have_trigger || have_replace);
+
+ mModifierCombo->setEnabled(TRUE);
+ mKeyCombo->setEnabled(TRUE);
+
+ mAddBtn->setEnabled(modifiable && have_library);
+ mUpBtn->setEnabled(modifiable && have_step && step_index > 0);
+ mDownBtn->setEnabled(modifiable && have_step && step_index < step_count-1);
+ mDeleteBtn->setEnabled(modifiable && have_step);
+
+ // Assume all not visible
+ mAnimationCombo->setVisible(FALSE);
+ mAnimationRadio->setVisible(FALSE);
+ mSoundCombo->setVisible(FALSE);
+ mChatEditor->setVisible(FALSE);
+ mWaitAnimCheck->setVisible(FALSE);
+ mWaitTimeCheck->setVisible(FALSE);
+ mWaitTimeEditor->setVisible(FALSE);
+
+ std::string optionstext;
+
+ if (have_step)
+ {
+ // figure out the type, show proper options, update text
+ LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
+ EStepType type = step->getType();
+
+ switch(type)
+ {
+ case STEP_ANIMATION:
+ {
+ LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
+ optionstext = getString("step_anim");
+ mAnimationCombo->setVisible(TRUE);
+ mAnimationRadio->setVisible(TRUE);
+ mAnimationRadio->setSelectedIndex((anim_step->mFlags & ANIM_FLAG_STOP) ? 1 : 0);
+ mAnimationCombo->setCurrentByID(anim_step->mAnimAssetID);
+ break;
+ }
+ case STEP_SOUND:
+ {
+ LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
+ optionstext = getString("step_sound");
+ mSoundCombo->setVisible(TRUE);
+ mSoundCombo->setCurrentByID(sound_step->mSoundAssetID);
+ break;
+ }
+ case STEP_CHAT:
+ {
+ LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
+ optionstext = getString("step_chat");
+ mChatEditor->setVisible(TRUE);
+ mChatEditor->setText(chat_step->mChatText);
+ break;
+ }
+ case STEP_WAIT:
+ {
+ LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
+ optionstext = getString("step_wait");
+ mWaitAnimCheck->setVisible(TRUE);
+ mWaitAnimCheck->set(wait_step->mFlags & WAIT_FLAG_ALL_ANIM);
+ mWaitTimeCheck->setVisible(TRUE);
+ mWaitTimeCheck->set(wait_step->mFlags & WAIT_FLAG_TIME);
+ mWaitTimeEditor->setVisible(TRUE);
+ std::string buffer = llformat("%.1f", (double)wait_step->mWaitSeconds);
+ mWaitTimeEditor->setText(buffer);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ mOptionsText->setText(optionstext);
+
+ BOOL active = LLGestureMgr::instance().isGestureActive(mItemUUID);
+ mActiveCheck->set(active);
+
+ // Can only preview if there are steps
+ mPreviewBtn->setEnabled(step_count > 0);
+
+ // And can only save if changes have been made
+ mSaveBtn->setEnabled(mDirty);
+ addAnimations();
+ addSounds();
}
void LLPreviewGesture::initDefaultGesture()
{
- LLScrollListItem* item;
- item = addStep( STEP_ANIMATION );
- LLGestureStepAnimation* anim = (LLGestureStepAnimation*)item->getUserdata();
- anim->mAnimAssetID = ANIM_AGENT_HELLO;
- anim->mAnimName = LLTrans::getString("Wave");
- updateLabel(item);
-
- item = addStep( STEP_WAIT );
- LLGestureStepWait* wait = (LLGestureStepWait*)item->getUserdata();
- wait->mFlags = WAIT_FLAG_ALL_ANIM;
- updateLabel(item);
-
- item = addStep( STEP_CHAT );
- LLGestureStepChat* chat_step = (LLGestureStepChat*)item->getUserdata();
- chat_step->mChatText = LLTrans::getString("HelloAvatar");
- updateLabel(item);
-
- // Start with item list selected
- mStepList->selectFirstItem();
-
- // this is *new* content, so we are dirty
- mDirty = TRUE;
+ LLScrollListItem* item;
+ item = addStep( STEP_ANIMATION );
+ LLGestureStepAnimation* anim = (LLGestureStepAnimation*)item->getUserdata();
+ anim->mAnimAssetID = ANIM_AGENT_HELLO;
+ anim->mAnimName = LLTrans::getString("Wave");
+ updateLabel(item);
+
+ item = addStep( STEP_WAIT );
+ LLGestureStepWait* wait = (LLGestureStepWait*)item->getUserdata();
+ wait->mFlags = WAIT_FLAG_ALL_ANIM;
+ updateLabel(item);
+
+ item = addStep( STEP_CHAT );
+ LLGestureStepChat* chat_step = (LLGestureStepChat*)item->getUserdata();
+ chat_step->mChatText = LLTrans::getString("HelloAvatar");
+ updateLabel(item);
+
+ // Start with item list selected
+ mStepList->selectFirstItem();
+
+ // this is *new* content, so we are dirty
+ mDirty = TRUE;
}
void LLPreviewGesture::loadAsset()
{
- const LLInventoryItem* item = getItem();
- if (!item)
- {
- // Don't set asset status here; we may not have set the item id yet
- // (e.g. when this gets called initially)
- //mAssetStatus = PREVIEW_ASSET_ERROR;
- return;
- }
-
- LLUUID asset_id = item->getAssetUUID();
- if (asset_id.isNull())
- {
- // Freshly created gesture, don't need to load asset.
- // Blank gesture will be fine.
- initDefaultGesture();
- refresh();
- mAssetStatus = PREVIEW_ASSET_LOADED;
- return;
- }
-
- // TODO: Based on item->getPermissions().allow*
- // could enable/disable UI.
-
- // Copy the UUID, because the user might close the preview
- // window if the download gets stalled.
- LLUUID* item_idp = new LLUUID(mItemUUID);
-
- const BOOL high_priority = TRUE;
- gAssetStorage->getAssetData(asset_id,
- LLAssetType::AT_GESTURE,
- onLoadComplete,
- (void**)item_idp,
- high_priority);
- mAssetStatus = PREVIEW_ASSET_LOADING;
+ const LLInventoryItem* item = getItem();
+ if (!item)
+ {
+ // Don't set asset status here; we may not have set the item id yet
+ // (e.g. when this gets called initially)
+ //mAssetStatus = PREVIEW_ASSET_ERROR;
+ return;
+ }
+
+ LLUUID asset_id = item->getAssetUUID();
+ if (asset_id.isNull())
+ {
+ // Freshly created gesture, don't need to load asset.
+ // Blank gesture will be fine.
+ initDefaultGesture();
+ refresh();
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ return;
+ }
+
+ // TODO: Based on item->getPermissions().allow*
+ // could enable/disable UI.
+
+ // Copy the UUID, because the user might close the preview
+ // window if the download gets stalled.
+ LLUUID* item_idp = new LLUUID(mItemUUID);
+
+ const BOOL high_priority = TRUE;
+ gAssetStorage->getAssetData(asset_id,
+ LLAssetType::AT_GESTURE,
+ onLoadComplete,
+ (void**)item_idp,
+ high_priority);
+ mAssetStatus = PREVIEW_ASSET_LOADING;
}
// static
void LLPreviewGesture::onLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status)
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status)
{
- LLUUID* item_idp = (LLUUID*)user_data;
-
- LLPreviewGesture* self = LLFloaterReg::findTypedInstance<LLPreviewGesture>("preview_gesture", *item_idp);
- if (self)
- {
- if (0 == status)
- {
- LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
- S32 size = file.getSize();
-
- std::vector<char> buffer(size+1);
- file.read((U8*)&buffer[0], size);
- buffer[size] = '\0';
-
- LLMultiGesture* gesture = new LLMultiGesture();
-
- LLDataPackerAsciiBuffer dp(&buffer[0], size+1);
- BOOL ok = gesture->deserialize(dp);
-
- if (ok)
- {
- // Everything has been successful. Load up the UI.
- self->loadUIFromGesture(gesture);
-
- self->mStepList->selectFirstItem();
-
- self->mDirty = FALSE;
- self->refresh();
- self->refreshFromItem(); // to update description and title
- }
- else
- {
- LL_WARNS() << "Unable to load gesture" << LL_ENDL;
- }
-
- delete gesture;
- gesture = NULL;
-
- self->mAssetStatus = PREVIEW_ASSET_LOADED;
- }
- else
- {
- if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
- LL_ERR_FILE_EMPTY == status)
- {
- LLDelayedGestureError::gestureMissing( *item_idp );
- }
- else
- {
- LLDelayedGestureError::gestureFailedToLoad( *item_idp );
- }
-
- LL_WARNS() << "Problem loading gesture: " << status << LL_ENDL;
- self->mAssetStatus = PREVIEW_ASSET_ERROR;
- }
- }
- delete item_idp;
- item_idp = NULL;
+ LLUUID* item_idp = (LLUUID*)user_data;
+
+ LLPreviewGesture* self = LLFloaterReg::findTypedInstance<LLPreviewGesture>("preview_gesture", *item_idp);
+ if (self)
+ {
+ if (0 == status)
+ {
+ LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
+ S32 size = file.getSize();
+
+ std::vector<char> buffer(size+1);
+ file.read((U8*)&buffer[0], size);
+ buffer[size] = '\0';
+
+ LLMultiGesture* gesture = new LLMultiGesture();
+
+ LLDataPackerAsciiBuffer dp(&buffer[0], size+1);
+ BOOL ok = gesture->deserialize(dp);
+
+ if (ok)
+ {
+ // Everything has been successful. Load up the UI.
+ self->loadUIFromGesture(gesture);
+
+ self->mStepList->selectFirstItem();
+
+ self->mDirty = FALSE;
+ self->refresh();
+ self->refreshFromItem(); // to update description and title
+ }
+ else
+ {
+ LL_WARNS() << "Unable to load gesture" << LL_ENDL;
+ }
+
+ delete gesture;
+ gesture = NULL;
+
+ self->mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
+ else
+ {
+ if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
+ LL_ERR_FILE_EMPTY == status)
+ {
+ LLDelayedGestureError::gestureMissing( *item_idp );
+ }
+ else
+ {
+ LLDelayedGestureError::gestureFailedToLoad( *item_idp );
+ }
+
+ LL_WARNS() << "Problem loading gesture: " << status << LL_ENDL;
+ self->mAssetStatus = PREVIEW_ASSET_ERROR;
+ }
+ }
+ delete item_idp;
+ item_idp = NULL;
}
void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture)
{
- /*LLInventoryItem* item = getItem();
-
-
-
- if (item)
- {
- LLLineEditor* descEditor = getChild<LLLineEditor>("desc");
- descEditor->setText(item->getDescription());
- }*/
-
- mTriggerEditor->setText(gesture->mTrigger);
-
- mReplaceEditor->setText(gesture->mReplaceText);
-
- switch (gesture->mMask)
- {
- default:
- case MASK_NONE:
- mModifierCombo->setSimple( NONE_LABEL );
- break;
- case MASK_SHIFT:
- mModifierCombo->setSimple( SHIFT_LABEL );
- break;
- case MASK_CONTROL:
- mModifierCombo->setSimple( CTRL_LABEL );
- break;
- }
-
- mModifierCombo->setEnabledByValue(CTRL_LABEL, gesture->mKey != KEY_F10);
-
- mKeyCombo->setCurrentByIndex(0);
- if (gesture->mKey != KEY_NONE)
- {
- mKeyCombo->setSimple(LLKeyboard::stringFromKey(gesture->mKey));
- }
-
- mKeyCombo->setEnabledByValue(LLKeyboard::stringFromKey(KEY_F10), gesture->mMask != MASK_CONTROL);
-
- // Make UI steps for each gesture step
- S32 i;
- S32 count = gesture->mSteps.size();
- for (i = 0; i < count; ++i)
- {
- LLGestureStep* step = gesture->mSteps[i];
-
- LLGestureStep* new_step = NULL;
-
- switch(step->getType())
- {
- case STEP_ANIMATION:
- {
- LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- LLGestureStepAnimation* new_anim_step =
- new LLGestureStepAnimation(*anim_step);
- new_step = new_anim_step;
- break;
- }
- case STEP_SOUND:
- {
- LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
- LLGestureStepSound* new_sound_step =
- new LLGestureStepSound(*sound_step);
- new_step = new_sound_step;
- break;
- }
- case STEP_CHAT:
- {
- LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
- LLGestureStepChat* new_chat_step =
- new LLGestureStepChat(*chat_step);
- new_step = new_chat_step;
- break;
- }
- case STEP_WAIT:
- {
- LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
- LLGestureStepWait* new_wait_step =
- new LLGestureStepWait(*wait_step);
- new_step = new_wait_step;
- break;
- }
- default:
- {
- break;
- }
- }
-
- if (!new_step) continue;
-
- // Create an enabled item with this step
- LLSD row;
- row["columns"][0]["value"] = getLabel( new_step->getLabel());
- row["columns"][0]["font"] = "SANSSERIF_SMALL";
- LLScrollListItem* item = mStepList->addElement(row);
- item->setUserdata(new_step);
- }
+ /*LLInventoryItem* item = getItem();
+
+
+
+ if (item)
+ {
+ LLLineEditor* descEditor = getChild<LLLineEditor>("desc");
+ descEditor->setText(item->getDescription());
+ }*/
+
+ mTriggerEditor->setText(gesture->mTrigger);
+
+ mReplaceEditor->setText(gesture->mReplaceText);
+
+ switch (gesture->mMask)
+ {
+ default:
+ case MASK_NONE:
+ mModifierCombo->setSimple( NONE_LABEL );
+ break;
+ case MASK_SHIFT:
+ mModifierCombo->setSimple( SHIFT_LABEL );
+ break;
+ case MASK_CONTROL:
+ mModifierCombo->setSimple( CTRL_LABEL );
+ break;
+ }
+
+ mModifierCombo->setEnabledByValue(CTRL_LABEL, gesture->mKey != KEY_F10);
+
+ mKeyCombo->setCurrentByIndex(0);
+ if (gesture->mKey != KEY_NONE)
+ {
+ mKeyCombo->setSimple(LLKeyboard::stringFromKey(gesture->mKey));
+ }
+
+ mKeyCombo->setEnabledByValue(LLKeyboard::stringFromKey(KEY_F10), gesture->mMask != MASK_CONTROL);
+
+ // Make UI steps for each gesture step
+ S32 i;
+ S32 count = gesture->mSteps.size();
+ for (i = 0; i < count; ++i)
+ {
+ LLGestureStep* step = gesture->mSteps[i];
+
+ LLGestureStep* new_step = NULL;
+
+ switch(step->getType())
+ {
+ case STEP_ANIMATION:
+ {
+ LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
+ LLGestureStepAnimation* new_anim_step =
+ new LLGestureStepAnimation(*anim_step);
+ new_step = new_anim_step;
+ break;
+ }
+ case STEP_SOUND:
+ {
+ LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
+ LLGestureStepSound* new_sound_step =
+ new LLGestureStepSound(*sound_step);
+ new_step = new_sound_step;
+ break;
+ }
+ case STEP_CHAT:
+ {
+ LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
+ LLGestureStepChat* new_chat_step =
+ new LLGestureStepChat(*chat_step);
+ new_step = new_chat_step;
+ break;
+ }
+ case STEP_WAIT:
+ {
+ LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
+ LLGestureStepWait* new_wait_step =
+ new LLGestureStepWait(*wait_step);
+ new_step = new_wait_step;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ if (!new_step) continue;
+
+ // Create an enabled item with this step
+ LLSD row;
+ row["columns"][0]["value"] = getLabel( new_step->getLabel());
+ row["columns"][0]["font"] = "SANSSERIF_SMALL";
+ LLScrollListItem* item = mStepList->addElement(row);
+ item->setUserdata(new_step);
+ }
}
// Helpful structure so we can look up the inventory item
// after the save finishes.
struct LLSaveInfo
{
- LLSaveInfo(const LLUUID& item_id, const LLUUID& object_id, const std::string& desc,
- const LLTransactionID tid)
- : mItemUUID(item_id), mObjectUUID(object_id), mDesc(desc), mTransactionID(tid)
- {
- }
-
- LLUUID mItemUUID;
- LLUUID mObjectUUID;
- std::string mDesc;
- LLTransactionID mTransactionID;
+ LLSaveInfo(const LLUUID& item_id, const LLUUID& object_id, const std::string& desc,
+ const LLTransactionID tid)
+ : mItemUUID(item_id), mObjectUUID(object_id), mDesc(desc), mTransactionID(tid)
+ {
+ }
+
+ LLUUID mItemUUID;
+ LLUUID mObjectUUID;
+ std::string mDesc;
+ LLTransactionID mTransactionID;
};
void LLPreviewGesture::finishInventoryUpload(LLUUID itemId, LLUUID newAssetId)
{
// If this gesture is active, then we need to update the in-memory
- // active map with the new pointer.
+ // active map with the new pointer.
if (LLGestureMgr::instance().isGestureActive(itemId))
{
// Active gesture edited from menu.
@@ -1039,16 +1039,16 @@ void LLPreviewGesture::finishInventoryUpload(LLUUID itemId, LLUUID newAssetId)
void LLPreviewGesture::saveIfNeeded()
{
- if (!gAssetStorage)
- {
- LL_WARNS() << "Can't save gesture, no asset storage system." << LL_ENDL;
- return;
- }
+ if (!gAssetStorage)
+ {
+ LL_WARNS() << "Can't save gesture, no asset storage system." << LL_ENDL;
+ return;
+ }
- if (!mDirty)
- {
- return;
- }
+ if (!mDirty)
+ {
+ return;
+ }
// Copy the UI into a gesture
LLMultiGesture* gesture = createGesture();
@@ -1182,624 +1182,624 @@ void LLPreviewGesture::saveIfNeeded()
// static
void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
- LLSaveInfo* info = (LLSaveInfo*)user_data;
- if (info && (status == 0))
- {
- if(info->mObjectUUID.isNull())
- {
- // Saving into user inventory
- LLViewerInventoryItem* item;
- item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID);
- if(item)
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setDescription(info->mDesc);
- new_item->setTransactionID(info->mTransactionID);
- new_item->setAssetUUID(asset_uuid);
- new_item->updateServer(FALSE);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- }
- else
- {
- LL_WARNS() << "Inventory item for gesture " << info->mItemUUID
- << " is no longer in agent inventory." << LL_ENDL;
- }
- }
- else
- {
- // Saving into in-world object inventory
- LLViewerObject* object = gObjectList.findObject(info->mObjectUUID);
- LLViewerInventoryItem* item = NULL;
- if(object)
- {
- item = (LLViewerInventoryItem*)object->getInventoryObject(info->mItemUUID);
- }
- if(object && item)
- {
- item->setDescription(info->mDesc);
- item->setAssetUUID(asset_uuid);
- item->setTransactionID(info->mTransactionID);
- object->updateInventory(item, TASK_INVENTORY_ITEM_KEY, false);
- dialog_refresh_all();
- }
- else
- {
- LLNotificationsUtil::add("GestureSaveFailedObjectNotFound");
- }
- }
-
- // Find our window and close it if requested.
- LLPreviewGesture* previewp = LLFloaterReg::findTypedInstance<LLPreviewGesture>("preview_gesture", info->mItemUUID);
- if (previewp && previewp->mCloseAfterSave)
- {
- previewp->closeFloater();
- }
- }
- else
- {
- LL_WARNS() << "Problem saving gesture: " << status << LL_ENDL;
- LLSD args;
- args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
- LLNotificationsUtil::add("GestureSaveFailedReason", args);
- }
- delete info;
- info = NULL;
+ LLSaveInfo* info = (LLSaveInfo*)user_data;
+ if (info && (status == 0))
+ {
+ if(info->mObjectUUID.isNull())
+ {
+ // Saving into user inventory
+ LLViewerInventoryItem* item;
+ item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID);
+ if(item)
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setDescription(info->mDesc);
+ new_item->setTransactionID(info->mTransactionID);
+ new_item->setAssetUUID(asset_uuid);
+ new_item->updateServer(FALSE);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+ }
+ else
+ {
+ LL_WARNS() << "Inventory item for gesture " << info->mItemUUID
+ << " is no longer in agent inventory." << LL_ENDL;
+ }
+ }
+ else
+ {
+ // Saving into in-world object inventory
+ LLViewerObject* object = gObjectList.findObject(info->mObjectUUID);
+ LLViewerInventoryItem* item = NULL;
+ if(object)
+ {
+ item = (LLViewerInventoryItem*)object->getInventoryObject(info->mItemUUID);
+ }
+ if(object && item)
+ {
+ item->setDescription(info->mDesc);
+ item->setAssetUUID(asset_uuid);
+ item->setTransactionID(info->mTransactionID);
+ object->updateInventory(item, TASK_INVENTORY_ITEM_KEY, false);
+ dialog_refresh_all();
+ }
+ else
+ {
+ LLNotificationsUtil::add("GestureSaveFailedObjectNotFound");
+ }
+ }
+
+ // Find our window and close it if requested.
+ LLPreviewGesture* previewp = LLFloaterReg::findTypedInstance<LLPreviewGesture>("preview_gesture", info->mItemUUID);
+ if (previewp && previewp->mCloseAfterSave)
+ {
+ previewp->closeFloater();
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Problem saving gesture: " << status << LL_ENDL;
+ LLSD args;
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
+ LLNotificationsUtil::add("GestureSaveFailedReason", args);
+ }
+ delete info;
+ info = NULL;
}
LLMultiGesture* LLPreviewGesture::createGesture()
{
- LLMultiGesture* gesture = new LLMultiGesture();
-
- gesture->mTrigger = mTriggerEditor->getText();
- gesture->mReplaceText = mReplaceEditor->getText();
-
- const std::string& modifier = mModifierCombo->getSimple();
- if (modifier == CTRL_LABEL)
- {
- gesture->mMask = MASK_CONTROL;
- }
- else if (modifier == SHIFT_LABEL)
- {
- gesture->mMask = MASK_SHIFT;
- }
- else
- {
- gesture->mMask = MASK_NONE;
- }
-
- if (mKeyCombo->getCurrentIndex() == 0)
- {
- gesture->mKey = KEY_NONE;
- }
- else
- {
- const std::string& key_string = mKeyCombo->getSimple();
- LLKeyboard::keyFromString(key_string, &(gesture->mKey));
- }
-
- std::vector<LLScrollListItem*> data_list = mStepList->getAllData();
- std::vector<LLScrollListItem*>::iterator data_itor;
- for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor)
- {
- LLScrollListItem* item = *data_itor;
- LLGestureStep* step = (LLGestureStep*)item->getUserdata();
-
- switch(step->getType())
- {
- case STEP_ANIMATION:
- {
- // Copy UI-generated step into actual gesture step
- LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- LLGestureStepAnimation* new_anim_step =
- new LLGestureStepAnimation(*anim_step);
- gesture->mSteps.push_back(new_anim_step);
- break;
- }
- case STEP_SOUND:
- {
- // Copy UI-generated step into actual gesture step
- LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
- LLGestureStepSound* new_sound_step =
- new LLGestureStepSound(*sound_step);
- gesture->mSteps.push_back(new_sound_step);
- break;
- }
- case STEP_CHAT:
- {
- // Copy UI-generated step into actual gesture step
- LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
- LLGestureStepChat* new_chat_step =
- new LLGestureStepChat(*chat_step);
- gesture->mSteps.push_back(new_chat_step);
- break;
- }
- case STEP_WAIT:
- {
- // Copy UI-generated step into actual gesture step
- LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
- LLGestureStepWait* new_wait_step =
- new LLGestureStepWait(*wait_step);
- gesture->mSteps.push_back(new_wait_step);
- break;
- }
- default:
- {
- break;
- }
- }
- }
-
- return gesture;
+ LLMultiGesture* gesture = new LLMultiGesture();
+
+ gesture->mTrigger = mTriggerEditor->getText();
+ gesture->mReplaceText = mReplaceEditor->getText();
+
+ const std::string& modifier = mModifierCombo->getSimple();
+ if (modifier == CTRL_LABEL)
+ {
+ gesture->mMask = MASK_CONTROL;
+ }
+ else if (modifier == SHIFT_LABEL)
+ {
+ gesture->mMask = MASK_SHIFT;
+ }
+ else
+ {
+ gesture->mMask = MASK_NONE;
+ }
+
+ if (mKeyCombo->getCurrentIndex() == 0)
+ {
+ gesture->mKey = KEY_NONE;
+ }
+ else
+ {
+ const std::string& key_string = mKeyCombo->getSimple();
+ LLKeyboard::keyFromString(key_string, &(gesture->mKey));
+ }
+
+ std::vector<LLScrollListItem*> data_list = mStepList->getAllData();
+ std::vector<LLScrollListItem*>::iterator data_itor;
+ for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor)
+ {
+ LLScrollListItem* item = *data_itor;
+ LLGestureStep* step = (LLGestureStep*)item->getUserdata();
+
+ switch(step->getType())
+ {
+ case STEP_ANIMATION:
+ {
+ // Copy UI-generated step into actual gesture step
+ LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
+ LLGestureStepAnimation* new_anim_step =
+ new LLGestureStepAnimation(*anim_step);
+ gesture->mSteps.push_back(new_anim_step);
+ break;
+ }
+ case STEP_SOUND:
+ {
+ // Copy UI-generated step into actual gesture step
+ LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
+ LLGestureStepSound* new_sound_step =
+ new LLGestureStepSound(*sound_step);
+ gesture->mSteps.push_back(new_sound_step);
+ break;
+ }
+ case STEP_CHAT:
+ {
+ // Copy UI-generated step into actual gesture step
+ LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
+ LLGestureStepChat* new_chat_step =
+ new LLGestureStepChat(*chat_step);
+ gesture->mSteps.push_back(new_chat_step);
+ break;
+ }
+ case STEP_WAIT:
+ {
+ // Copy UI-generated step into actual gesture step
+ LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
+ LLGestureStepWait* new_wait_step =
+ new LLGestureStepWait(*wait_step);
+ gesture->mSteps.push_back(new_wait_step);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+ return gesture;
}
void LLPreviewGesture::onCommitKeyorModifier()
{
- // SL-14139: ctrl-F10 is currently used to access top menu,
- // so don't allow to bound gestures to this combination.
+ // SL-14139: ctrl-F10 is currently used to access top menu,
+ // so don't allow to bound gestures to this combination.
- mKeyCombo->setEnabledByValue(LLKeyboard::stringFromKey(KEY_F10), mModifierCombo->getSimple() != CTRL_LABEL);
- mModifierCombo->setEnabledByValue(CTRL_LABEL, mKeyCombo->getSimple() != LLKeyboard::stringFromKey(KEY_F10));
- mDirty = TRUE;
- refresh();
+ mKeyCombo->setEnabledByValue(LLKeyboard::stringFromKey(KEY_F10), mModifierCombo->getSimple() != CTRL_LABEL);
+ mModifierCombo->setEnabledByValue(CTRL_LABEL, mKeyCombo->getSimple() != LLKeyboard::stringFromKey(KEY_F10));
+ mDirty = TRUE;
+ refresh();
}
// static
void LLPreviewGesture::updateLabel(LLScrollListItem* item)
{
- LLGestureStep* step = (LLGestureStep*)item->getUserdata();
+ LLGestureStep* step = (LLGestureStep*)item->getUserdata();
- LLScrollListCell* cell = item->getColumn(0);
- LLScrollListText* text_cell = (LLScrollListText*)cell;
- std::string label = getLabel( step->getLabel());
- text_cell->setText(label);
+ LLScrollListCell* cell = item->getColumn(0);
+ LLScrollListText* text_cell = (LLScrollListText*)cell;
+ std::string label = getLabel( step->getLabel());
+ text_cell->setText(label);
}
// static
void LLPreviewGesture::onCommitSetDirty(LLUICtrl* ctrl, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
- self->mDirty = TRUE;
- self->refresh();
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
+ self->mDirty = TRUE;
+ self->refresh();
}
// static
void LLPreviewGesture::onCommitLibrary(LLUICtrl* ctrl, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
-
- LLScrollListItem* library_item = self->mLibraryList->getFirstSelected();
- if (library_item)
- {
- self->mStepList->deselectAllItems();
- self->refresh();
- }
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
+
+ LLScrollListItem* library_item = self->mLibraryList->getFirstSelected();
+ if (library_item)
+ {
+ self->mStepList->deselectAllItems();
+ self->refresh();
+ }
}
// static
void LLPreviewGesture::onCommitStep(LLUICtrl* ctrl, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
- LLScrollListItem* step_item = self->mStepList->getFirstSelected();
- if (!step_item) return;
+ LLScrollListItem* step_item = self->mStepList->getFirstSelected();
+ if (!step_item) return;
- self->mLibraryList->deselectAllItems();
- self->refresh();
+ self->mLibraryList->deselectAllItems();
+ self->refresh();
}
// static
void LLPreviewGesture::onCommitAnimation(LLUICtrl* ctrl, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
-
- LLScrollListItem* step_item = self->mStepList->getFirstSelected();
- if (step_item)
- {
- LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
- if (step->getType() == STEP_ANIMATION)
- {
- // Assign the animation name
- LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- if (self->mAnimationCombo->getCurrentIndex() == 0)
- {
- anim_step->mAnimName.clear();
- anim_step->mAnimAssetID.setNull();
- }
- else
- {
- anim_step->mAnimName = self->mAnimationCombo->getSimple();
- anim_step->mAnimAssetID = self->mAnimationCombo->getCurrentID();
- }
- //anim_step->mFlags = 0x0;
-
- // Update the UI label in the list
- updateLabel(step_item);
-
- self->mDirty = TRUE;
- self->refresh();
- }
- }
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
+
+ LLScrollListItem* step_item = self->mStepList->getFirstSelected();
+ if (step_item)
+ {
+ LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
+ if (step->getType() == STEP_ANIMATION)
+ {
+ // Assign the animation name
+ LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
+ if (self->mAnimationCombo->getCurrentIndex() == 0)
+ {
+ anim_step->mAnimName.clear();
+ anim_step->mAnimAssetID.setNull();
+ }
+ else
+ {
+ anim_step->mAnimName = self->mAnimationCombo->getSimple();
+ anim_step->mAnimAssetID = self->mAnimationCombo->getCurrentID();
+ }
+ //anim_step->mFlags = 0x0;
+
+ // Update the UI label in the list
+ updateLabel(step_item);
+
+ self->mDirty = TRUE;
+ self->refresh();
+ }
+ }
}
// static
void LLPreviewGesture::onCommitAnimationTrigger(LLUICtrl* ctrl, void *data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
-
- LLScrollListItem* step_item = self->mStepList->getFirstSelected();
- if (step_item)
- {
- LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
- if (step->getType() == STEP_ANIMATION)
- {
- LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- if (self->mAnimationRadio->getSelectedIndex() == 0)
- {
- // start
- anim_step->mFlags &= ~ANIM_FLAG_STOP;
- }
- else
- {
- // stop
- anim_step->mFlags |= ANIM_FLAG_STOP;
- }
- // Update the UI label in the list
- updateLabel(step_item);
-
- self->mDirty = TRUE;
- self->refresh();
- }
- }
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
+
+ LLScrollListItem* step_item = self->mStepList->getFirstSelected();
+ if (step_item)
+ {
+ LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
+ if (step->getType() == STEP_ANIMATION)
+ {
+ LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
+ if (self->mAnimationRadio->getSelectedIndex() == 0)
+ {
+ // start
+ anim_step->mFlags &= ~ANIM_FLAG_STOP;
+ }
+ else
+ {
+ // stop
+ anim_step->mFlags |= ANIM_FLAG_STOP;
+ }
+ // Update the UI label in the list
+ updateLabel(step_item);
+
+ self->mDirty = TRUE;
+ self->refresh();
+ }
+ }
}
// static
void LLPreviewGesture::onCommitSound(LLUICtrl* ctrl, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
-
- LLScrollListItem* step_item = self->mStepList->getFirstSelected();
- if (step_item)
- {
- LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
- if (step->getType() == STEP_SOUND)
- {
- // Assign the sound name
- LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
- sound_step->mSoundName = self->mSoundCombo->getSimple();
- sound_step->mSoundAssetID = self->mSoundCombo->getCurrentID();
- sound_step->mFlags = 0x0;
-
- // Update the UI label in the list
- updateLabel(step_item);
-
- self->mDirty = TRUE;
- self->refresh();
- }
- }
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
+
+ LLScrollListItem* step_item = self->mStepList->getFirstSelected();
+ if (step_item)
+ {
+ LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
+ if (step->getType() == STEP_SOUND)
+ {
+ // Assign the sound name
+ LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
+ sound_step->mSoundName = self->mSoundCombo->getSimple();
+ sound_step->mSoundAssetID = self->mSoundCombo->getCurrentID();
+ sound_step->mFlags = 0x0;
+
+ // Update the UI label in the list
+ updateLabel(step_item);
+
+ self->mDirty = TRUE;
+ self->refresh();
+ }
+ }
}
// static
void LLPreviewGesture::onCommitChat(LLUICtrl* ctrl, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
- LLScrollListItem* step_item = self->mStepList->getFirstSelected();
- if (!step_item) return;
+ LLScrollListItem* step_item = self->mStepList->getFirstSelected();
+ if (!step_item) return;
- LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
- if (step->getType() != STEP_CHAT) return;
+ LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
+ if (step->getType() != STEP_CHAT) return;
- LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
- chat_step->mChatText = self->mChatEditor->getText();
- chat_step->mFlags = 0x0;
+ LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
+ chat_step->mChatText = self->mChatEditor->getText();
+ chat_step->mFlags = 0x0;
- // Update the UI label in the list
- updateLabel(step_item);
+ // Update the UI label in the list
+ updateLabel(step_item);
- self->mDirty = TRUE;
- self->refresh();
+ self->mDirty = TRUE;
+ self->refresh();
}
// static
void LLPreviewGesture::onCommitWait(LLUICtrl* ctrl, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
- LLScrollListItem* step_item = self->mStepList->getFirstSelected();
- if (!step_item) return;
+ LLScrollListItem* step_item = self->mStepList->getFirstSelected();
+ if (!step_item) return;
- LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
- if (step->getType() != STEP_WAIT) return;
+ LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
+ if (step->getType() != STEP_WAIT) return;
- LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
- U32 flags = 0x0;
- if (self->mWaitAnimCheck->get()) flags |= WAIT_FLAG_ALL_ANIM;
- if (self->mWaitTimeCheck->get()) flags |= WAIT_FLAG_TIME;
- wait_step->mFlags = flags;
+ LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
+ U32 flags = 0x0;
+ if (self->mWaitAnimCheck->get()) flags |= WAIT_FLAG_ALL_ANIM;
+ if (self->mWaitTimeCheck->get()) flags |= WAIT_FLAG_TIME;
+ wait_step->mFlags = flags;
- {
- LLLocale locale(LLLocale::USER_LOCALE);
+ {
+ LLLocale locale(LLLocale::USER_LOCALE);
- F32 wait_seconds = (F32)atof(self->mWaitTimeEditor->getText().c_str());
- if (wait_seconds < 0.f) wait_seconds = 0.f;
- if (wait_seconds > 3600.f) wait_seconds = 3600.f;
- wait_step->mWaitSeconds = wait_seconds;
- }
+ F32 wait_seconds = (F32)atof(self->mWaitTimeEditor->getText().c_str());
+ if (wait_seconds < 0.f) wait_seconds = 0.f;
+ if (wait_seconds > 3600.f) wait_seconds = 3600.f;
+ wait_step->mWaitSeconds = wait_seconds;
+ }
- // Enable the input area if necessary
- self->mWaitTimeEditor->setEnabled(self->mWaitTimeCheck->get());
+ // Enable the input area if necessary
+ self->mWaitTimeEditor->setEnabled(self->mWaitTimeCheck->get());
- // Update the UI label in the list
- updateLabel(step_item);
+ // Update the UI label in the list
+ updateLabel(step_item);
- self->mDirty = TRUE;
- self->refresh();
+ self->mDirty = TRUE;
+ self->refresh();
}
// static
void LLPreviewGesture::onCommitWaitTime(LLUICtrl* ctrl, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
- LLScrollListItem* step_item = self->mStepList->getFirstSelected();
- if (!step_item) return;
+ LLScrollListItem* step_item = self->mStepList->getFirstSelected();
+ if (!step_item) return;
- LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
- if (step->getType() != STEP_WAIT) return;
+ LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
+ if (step->getType() != STEP_WAIT) return;
- self->mWaitTimeCheck->set(TRUE);
- onCommitWait(ctrl, data);
+ self->mWaitTimeCheck->set(TRUE);
+ onCommitWait(ctrl, data);
}
// static
void LLPreviewGesture::onKeystrokeCommit(LLLineEditor* caller,
- void* data)
+ void* data)
{
- // Just commit every keystroke
- onCommitSetDirty(caller, data);
+ // Just commit every keystroke
+ onCommitSetDirty(caller, data);
}
// static
void LLPreviewGesture::onClickAdd(void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
- LLScrollListItem* library_item = self->mLibraryList->getFirstSelected();
- if (!library_item) return;
+ LLScrollListItem* library_item = self->mLibraryList->getFirstSelected();
+ if (!library_item) return;
- S32 library_item_index = self->mLibraryList->getFirstSelectedIndex();
+ S32 library_item_index = self->mLibraryList->getFirstSelectedIndex();
- const LLScrollListCell* library_cell = library_item->getColumn(0);
- const std::string& library_text = library_cell->getValue().asString();
+ const LLScrollListCell* library_cell = library_item->getColumn(0);
+ const std::string& library_text = library_cell->getValue().asString();
- if( library_item_index >= STEP_EOF )
- {
- LL_ERRS() << "Unknown step type: " << library_text << LL_ENDL;
- return;
- }
+ if( library_item_index >= STEP_EOF )
+ {
+ LL_ERRS() << "Unknown step type: " << library_text << LL_ENDL;
+ return;
+ }
- self->addStep( (EStepType)library_item_index );
- self->mDirty = TRUE;
- self->refresh();
+ self->addStep( (EStepType)library_item_index );
+ self->mDirty = TRUE;
+ self->refresh();
}
LLScrollListItem* LLPreviewGesture::addStep( const EStepType step_type )
{
- // Order of enum EStepType MUST match the library_list element in floater_preview_gesture.xml
-
- LLGestureStep* step = NULL;
- switch( step_type)
- {
- case STEP_ANIMATION:
- step = new LLGestureStepAnimation();
-
- break;
- case STEP_SOUND:
- step = new LLGestureStepSound();
- break;
- case STEP_CHAT:
- step = new LLGestureStepChat();
- break;
- case STEP_WAIT:
- step = new LLGestureStepWait();
- break;
- default:
- LL_ERRS() << "Unknown step type: " << (S32)step_type << LL_ENDL;
- return NULL;
- }
-
-
- // Create an enabled item with this step
- LLSD row;
- row["columns"][0]["value"] = getLabel(step->getLabel());
- row["columns"][0]["font"] = "SANSSERIF_SMALL";
- LLScrollListItem* step_item = mStepList->addElement(row);
- step_item->setUserdata(step);
-
- // And move selection to the list on the right
- mLibraryList->deselectAllItems();
- mStepList->deselectAllItems();
-
- step_item->setSelected(TRUE);
-
- return step_item;
+ // Order of enum EStepType MUST match the library_list element in floater_preview_gesture.xml
+
+ LLGestureStep* step = NULL;
+ switch( step_type)
+ {
+ case STEP_ANIMATION:
+ step = new LLGestureStepAnimation();
+
+ break;
+ case STEP_SOUND:
+ step = new LLGestureStepSound();
+ break;
+ case STEP_CHAT:
+ step = new LLGestureStepChat();
+ break;
+ case STEP_WAIT:
+ step = new LLGestureStepWait();
+ break;
+ default:
+ LL_ERRS() << "Unknown step type: " << (S32)step_type << LL_ENDL;
+ return NULL;
+ }
+
+
+ // Create an enabled item with this step
+ LLSD row;
+ row["columns"][0]["value"] = getLabel(step->getLabel());
+ row["columns"][0]["font"] = "SANSSERIF_SMALL";
+ LLScrollListItem* step_item = mStepList->addElement(row);
+ step_item->setUserdata(step);
+
+ // And move selection to the list on the right
+ mLibraryList->deselectAllItems();
+ mStepList->deselectAllItems();
+
+ step_item->setSelected(TRUE);
+
+ return step_item;
}
// static
std::string LLPreviewGesture::getLabel(std::vector<std::string> labels)
{
- std::vector<std::string> v_labels = labels ;
- std::string result("");
-
- if( v_labels.size() != 2)
- {
- return result;
- }
-
- if(v_labels[0]=="Chat")
- {
- result=LLTrans::getString("Chat Message");
- }
- else if(v_labels[0]=="Sound")
- {
- result=LLTrans::getString("Sound");
- }
- else if(v_labels[0]=="Wait")
- {
- result=LLTrans::getString("Wait");
- }
- else if(v_labels[0]=="AnimFlagStop")
- {
- result=LLTrans::getString("AnimFlagStop");
- }
- else if(v_labels[0]=="AnimFlagStart")
- {
- result=LLTrans::getString("AnimFlagStart");
- }
-
- // lets localize action value
- std::string action = v_labels[1];
- if ("None" == action)
- {
- action = LLTrans::getString("GestureActionNone");
- }
- else if ("until animations are done" == action)
- {
- action = LLFloaterReg::getInstance("preview_gesture")->getChild<LLCheckBoxCtrl>("wait_anim_check")->getLabel();
- }
- result.append(action);
- return result;
-
+ std::vector<std::string> v_labels = labels ;
+ std::string result("");
+
+ if( v_labels.size() != 2)
+ {
+ return result;
+ }
+
+ if(v_labels[0]=="Chat")
+ {
+ result=LLTrans::getString("Chat Message");
+ }
+ else if(v_labels[0]=="Sound")
+ {
+ result=LLTrans::getString("Sound");
+ }
+ else if(v_labels[0]=="Wait")
+ {
+ result=LLTrans::getString("Wait");
+ }
+ else if(v_labels[0]=="AnimFlagStop")
+ {
+ result=LLTrans::getString("AnimFlagStop");
+ }
+ else if(v_labels[0]=="AnimFlagStart")
+ {
+ result=LLTrans::getString("AnimFlagStart");
+ }
+
+ // lets localize action value
+ std::string action = v_labels[1];
+ if ("None" == action)
+ {
+ action = LLTrans::getString("GestureActionNone");
+ }
+ else if ("until animations are done" == action)
+ {
+ action = LLFloaterReg::getInstance("preview_gesture")->getChild<LLCheckBoxCtrl>("wait_anim_check")->getLabel();
+ }
+ result.append(action);
+ return result;
+
}
// static
void LLPreviewGesture::onClickUp(void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
-
- S32 selected_index = self->mStepList->getFirstSelectedIndex();
- if (selected_index > 0)
- {
- self->mStepList->swapWithPrevious(selected_index);
- self->mDirty = TRUE;
- self->refresh();
- }
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
+
+ S32 selected_index = self->mStepList->getFirstSelectedIndex();
+ if (selected_index > 0)
+ {
+ self->mStepList->swapWithPrevious(selected_index);
+ self->mDirty = TRUE;
+ self->refresh();
+ }
}
// static
void LLPreviewGesture::onClickDown(void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
-
- S32 selected_index = self->mStepList->getFirstSelectedIndex();
- if (selected_index < 0) return;
-
- S32 count = self->mStepList->getItemCount();
- if (selected_index < count-1)
- {
- self->mStepList->swapWithNext(selected_index);
- self->mDirty = TRUE;
- self->refresh();
- }
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
+
+ S32 selected_index = self->mStepList->getFirstSelectedIndex();
+ if (selected_index < 0) return;
+
+ S32 count = self->mStepList->getItemCount();
+ if (selected_index < count-1)
+ {
+ self->mStepList->swapWithNext(selected_index);
+ self->mDirty = TRUE;
+ self->refresh();
+ }
}
// static
void LLPreviewGesture::onClickDelete(void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
- LLScrollListItem* item = self->mStepList->getFirstSelected();
- S32 selected_index = self->mStepList->getFirstSelectedIndex();
- if (item && selected_index >= 0)
- {
- LLGestureStep* step = (LLGestureStep*)item->getUserdata();
- delete step;
- step = NULL;
+ LLScrollListItem* item = self->mStepList->getFirstSelected();
+ S32 selected_index = self->mStepList->getFirstSelectedIndex();
+ if (item && selected_index >= 0)
+ {
+ LLGestureStep* step = (LLGestureStep*)item->getUserdata();
+ delete step;
+ step = NULL;
- self->mStepList->deleteSingleItem(selected_index);
+ self->mStepList->deleteSingleItem(selected_index);
- self->mDirty = TRUE;
- self->refresh();
- }
+ self->mDirty = TRUE;
+ self->refresh();
+ }
}
// static
void LLPreviewGesture::onCommitActive(LLUICtrl* ctrl, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
- if (!LLGestureMgr::instance().isGestureActive(self->mItemUUID))
- {
- LLGestureMgr::instance().activateGesture(self->mItemUUID);
- }
- else
- {
- LLGestureMgr::instance().deactivateGesture(self->mItemUUID);
- }
-
- // Make sure the (active) label in the inventory gets updated.
- LLViewerInventoryItem* item = gInventory.getItem(self->mItemUUID);
- if (item)
- {
- gInventory.updateItem(item);
- gInventory.notifyObservers();
- }
-
- self->refresh();
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
+ if (!LLGestureMgr::instance().isGestureActive(self->mItemUUID))
+ {
+ LLGestureMgr::instance().activateGesture(self->mItemUUID);
+ }
+ else
+ {
+ LLGestureMgr::instance().deactivateGesture(self->mItemUUID);
+ }
+
+ // Make sure the (active) label in the inventory gets updated.
+ LLViewerInventoryItem* item = gInventory.getItem(self->mItemUUID);
+ if (item)
+ {
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+
+ self->refresh();
}
// static
void LLPreviewGesture::onClickSave(void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
- self->saveIfNeeded();
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
+ self->saveIfNeeded();
}
// static
void LLPreviewGesture::onClickPreview(void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
- if (!self->mPreviewGesture)
- {
- // make temporary gesture
- self->mPreviewGesture = self->createGesture();
+ if (!self->mPreviewGesture)
+ {
+ // make temporary gesture
+ self->mPreviewGesture = self->createGesture();
- // add a callback
- self->mPreviewGesture->mDoneCallback = onDonePreview;
- self->mPreviewGesture->mCallbackData = self;
+ // add a callback
+ self->mPreviewGesture->mDoneCallback = onDonePreview;
+ self->mPreviewGesture->mCallbackData = self;
- // set the button title
- self->mPreviewBtn->setLabel(self->getString("stop_txt"));
+ // set the button title
+ self->mPreviewBtn->setLabel(self->getString("stop_txt"));
- // play it, and delete when done
- LLGestureMgr::instance().playGesture(self->mPreviewGesture);
+ // play it, and delete when done
+ LLGestureMgr::instance().playGesture(self->mPreviewGesture);
- self->refresh();
- }
- else
- {
- // Will call onDonePreview() below
- LLGestureMgr::instance().stopGesture(self->mPreviewGesture);
+ self->refresh();
+ }
+ else
+ {
+ // Will call onDonePreview() below
+ LLGestureMgr::instance().stopGesture(self->mPreviewGesture);
- self->refresh();
- }
+ self->refresh();
+ }
}
// static
void LLPreviewGesture::onDonePreview(LLMultiGesture* gesture, void* data)
{
- LLPreviewGesture* self = (LLPreviewGesture*)data;
+ LLPreviewGesture* self = (LLPreviewGesture*)data;
- self->mPreviewBtn->setLabel(self->getString("preview_txt"));
+ self->mPreviewBtn->setLabel(self->getString("preview_txt"));
- delete self->mPreviewGesture;
- self->mPreviewGesture = NULL;
+ delete self->mPreviewGesture;
+ self->mPreviewGesture = NULL;
- self->refresh();
+ self->refresh();
}
diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h
index f5c47d71b8..55f95a8811 100644
--- a/indra/newview/llpreviewgesture.h
+++ b/indra/newview/llpreviewgesture.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewgesture.h
* @brief Editing UI for inventory-based gestures.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,127 +43,127 @@ class LLRadioGroup;
class LLPreviewGesture : public LLPreview
{
public:
- // Pass an object_id if this gesture is inside an object in the world,
- // otherwise use LLUUID::null.
- static LLPreviewGesture* show(const LLUUID& item_id, const LLUUID& object_id);
-
- LLPreviewGesture(const LLSD& key);
- virtual ~LLPreviewGesture();
-
- // LLView
- /*virtual*/ void draw();
- /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
-
- // LLPanel
- /*virtual*/ BOOL postBuild();
-
- // LLFloater
- /*virtual*/ BOOL canClose();
- /*virtual*/ void onClose(bool app_quitting);
- /*virtual*/ void onUpdateSucceeded();
- /*virtual*/ void refresh();
+ // Pass an object_id if this gesture is inside an object in the world,
+ // otherwise use LLUUID::null.
+ static LLPreviewGesture* show(const LLUUID& item_id, const LLUUID& object_id);
+
+ LLPreviewGesture(const LLSD& key);
+ virtual ~LLPreviewGesture();
+
+ // LLView
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+
+ // LLPanel
+ /*virtual*/ BOOL postBuild();
+
+ // LLFloater
+ /*virtual*/ BOOL canClose();
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ void onUpdateSucceeded();
+ /*virtual*/ void refresh();
protected:
- // Populate various comboboxes
- void addModifiers();
- void addKeys();
- void addAnimations();
- void addSounds();
+ // Populate various comboboxes
+ void addModifiers();
+ void addKeys();
+ void addAnimations();
+ void addSounds();
+
+ void initDefaultGesture();
+
+ void loadAsset();
- void initDefaultGesture();
+ static void onLoadComplete(const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status);
- void loadAsset();
+ void loadUIFromGesture(LLMultiGesture* gesture);
- static void onLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status);
+ void saveIfNeeded();
- void loadUIFromGesture(LLMultiGesture* gesture);
+ static void onSaveComplete(const LLUUID& asset_uuid,
+ void* user_data,
+ S32 status, LLExtStat ext_status);
- void saveIfNeeded();
+ bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
- static void onSaveComplete(const LLUUID& asset_uuid,
- void* user_data,
- S32 status, LLExtStat ext_status);
+ // Write UI back into gesture
+ LLMultiGesture* createGesture();
- bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
+ // Add a step. Pass the name of the step, like "Animation",
+ // "Sound", "Chat", or "Wait"
+ LLScrollListItem* addStep(const enum EStepType step_type);
- // Write UI back into gesture
- LLMultiGesture* createGesture();
+ void onVisibilityChanged ( const LLSD& new_visibility );
- // Add a step. Pass the name of the step, like "Animation",
- // "Sound", "Chat", or "Wait"
- LLScrollListItem* addStep(const enum EStepType step_type);
-
- void onVisibilityChanged ( const LLSD& new_visibility );
+ void onCommitKeyorModifier();
- void onCommitKeyorModifier();
-
- static std::string getLabel(std::vector<std::string> labels);
- static void updateLabel(LLScrollListItem* item);
+ static std::string getLabel(std::vector<std::string> labels);
+ static void updateLabel(LLScrollListItem* item);
- static void onCommitSetDirty(LLUICtrl* ctrl, void* data);
- static void onCommitLibrary(LLUICtrl* ctrl, void* data);
- static void onCommitStep(LLUICtrl* ctrl, void* data);
- static void onCommitAnimation(LLUICtrl* ctrl, void* data);
- static void onCommitSound(LLUICtrl* ctrl, void* data);
- static void onCommitChat(LLUICtrl* ctrl, void* data);
- static void onCommitWait(LLUICtrl* ctrl, void* data);
- static void onCommitWaitTime(LLUICtrl* ctrl, void* data);
+ static void onCommitSetDirty(LLUICtrl* ctrl, void* data);
+ static void onCommitLibrary(LLUICtrl* ctrl, void* data);
+ static void onCommitStep(LLUICtrl* ctrl, void* data);
+ static void onCommitAnimation(LLUICtrl* ctrl, void* data);
+ static void onCommitSound(LLUICtrl* ctrl, void* data);
+ static void onCommitChat(LLUICtrl* ctrl, void* data);
+ static void onCommitWait(LLUICtrl* ctrl, void* data);
+ static void onCommitWaitTime(LLUICtrl* ctrl, void* data);
- static void onCommitAnimationTrigger(LLUICtrl* ctrl, void *data);
+ static void onCommitAnimationTrigger(LLUICtrl* ctrl, void *data);
- // Handy function to commit each keystroke
- static void onKeystrokeCommit(LLLineEditor* caller, void* data);
+ // Handy function to commit each keystroke
+ static void onKeystrokeCommit(LLLineEditor* caller, void* data);
- static void onClickAdd(void* data);
- static void onClickUp(void* data);
- static void onClickDown(void* data);
- static void onClickDelete(void* data);
+ static void onClickAdd(void* data);
+ static void onClickUp(void* data);
+ static void onClickDown(void* data);
+ static void onClickDelete(void* data);
- static void onCommitActive(LLUICtrl* ctrl, void* data);
- static void onClickSave(void* data);
- static void onClickPreview(void* data);
+ static void onCommitActive(LLUICtrl* ctrl, void* data);
+ static void onClickSave(void* data);
+ static void onClickPreview(void* data);
- static void onDonePreview(LLMultiGesture* gesture, void* data);
+ static void onDonePreview(LLMultiGesture* gesture, void* data);
static void finishInventoryUpload(LLUUID itemId, LLUUID newAssetId);
private:
- // LLPreview contains mDescEditor
- LLLineEditor* mTriggerEditor;
- LLTextBox* mReplaceText;
- LLLineEditor* mReplaceEditor;
- LLComboBox* mModifierCombo;
- LLComboBox* mKeyCombo;
-
- LLScrollListCtrl* mLibraryList;
- LLButton* mAddBtn;
- LLButton* mUpBtn;
- LLButton* mDownBtn;
- LLButton* mDeleteBtn;
- LLScrollListCtrl* mStepList;
-
- // Options panels for items in gesture list
- LLTextBox* mOptionsText;
- LLRadioGroup* mAnimationRadio;
- LLComboBox* mAnimationCombo;
- LLComboBox* mSoundCombo;
- LLLineEditor* mChatEditor;
- LLCheckBoxCtrl* mWaitAnimCheck;
- LLCheckBoxCtrl* mWaitTimeCheck;
- LLLineEditor* mWaitTimeEditor;
-
- LLCheckBoxCtrl* mActiveCheck;
- LLButton* mSaveBtn;
- LLButton* mPreviewBtn;
-
- LLMultiGesture* mPreviewGesture;
- BOOL mDirty;
+ // LLPreview contains mDescEditor
+ LLLineEditor* mTriggerEditor;
+ LLTextBox* mReplaceText;
+ LLLineEditor* mReplaceEditor;
+ LLComboBox* mModifierCombo;
+ LLComboBox* mKeyCombo;
+
+ LLScrollListCtrl* mLibraryList;
+ LLButton* mAddBtn;
+ LLButton* mUpBtn;
+ LLButton* mDownBtn;
+ LLButton* mDeleteBtn;
+ LLScrollListCtrl* mStepList;
+
+ // Options panels for items in gesture list
+ LLTextBox* mOptionsText;
+ LLRadioGroup* mAnimationRadio;
+ LLComboBox* mAnimationCombo;
+ LLComboBox* mSoundCombo;
+ LLLineEditor* mChatEditor;
+ LLCheckBoxCtrl* mWaitAnimCheck;
+ LLCheckBoxCtrl* mWaitTimeCheck;
+ LLLineEditor* mWaitTimeEditor;
+
+ LLCheckBoxCtrl* mActiveCheck;
+ LLButton* mSaveBtn;
+ LLButton* mPreviewBtn;
+
+ LLMultiGesture* mPreviewGesture;
+ BOOL mDirty;
};
#endif // LL_LLPREVIEWGESTURE_H
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index 6681703625..aa04540536 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewnotecard.cpp
* @brief Implementation of the notecard editor
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,8 +55,8 @@
#include "llviewerregion.h"
#include "lldir.h"
#include "llviewerstats.h"
-#include "llviewercontrol.h" // gSavedSettings
-#include "llappviewer.h" // app_abort_quit()
+#include "llviewercontrol.h" // gSavedSettings
+#include "llappviewer.h" // app_abort_quit()
#include "lllineeditor.h"
#include "lluictrlfactory.h"
#include "llviewerassetupload.h"
@@ -66,259 +66,259 @@
///----------------------------------------------------------------------------
// Default constructor
-LLPreviewNotecard::LLPreviewNotecard(const LLSD& key) //const LLUUID& item_id,
- : LLPreview( key ),
- mLiveFile(NULL)
+LLPreviewNotecard::LLPreviewNotecard(const LLSD& key) //const LLUUID& item_id,
+ : LLPreview( key ),
+ mLiveFile(NULL)
{
- const LLInventoryItem *item = getItem();
- if (item)
- {
- mAssetID = item->getAssetUUID();
- }
+ const LLInventoryItem *item = getItem();
+ if (item)
+ {
+ mAssetID = item->getAssetUUID();
+ }
}
LLPreviewNotecard::~LLPreviewNotecard()
{
- delete mLiveFile;
+ delete mLiveFile;
}
BOOL LLPreviewNotecard::postBuild()
{
- mEditor = getChild<LLViewerTextEditor>("Notecard Editor");
- mEditor->setNotecardInfo(mItemUUID, mObjectID, getKey());
- mEditor->makePristine();
+ mEditor = getChild<LLViewerTextEditor>("Notecard Editor");
+ mEditor->setNotecardInfo(mItemUUID, mObjectID, getKey());
+ mEditor->makePristine();
- childSetAction("Save", onClickSave, this);
- getChildView("lock")->setVisible( FALSE);
+ childSetAction("Save", onClickSave, this);
+ getChildView("lock")->setVisible( FALSE);
- childSetAction("Delete", onClickDelete, this);
- getChildView("Delete")->setEnabled(false);
+ childSetAction("Delete", onClickDelete, this);
+ getChildView("Delete")->setEnabled(false);
- childSetAction("Edit", onClickEdit, this);
+ childSetAction("Edit", onClickEdit, this);
- const LLInventoryItem* item = getItem();
+ const LLInventoryItem* item = getItem();
- childSetCommitCallback("desc", LLPreview::onText, this);
- if (item)
- {
- getChild<LLUICtrl>("desc")->setValue(item->getDescription());
- BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID());
- getChildView("Delete")->setEnabled(!source_library);
- }
- getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ childSetCommitCallback("desc", LLPreview::onText, this);
+ if (item)
+ {
+ getChild<LLUICtrl>("desc")->setValue(item->getDescription());
+ BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID());
+ getChildView("Delete")->setEnabled(!source_library);
+ }
+ getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
- return LLPreview::postBuild();
+ return LLPreview::postBuild();
}
bool LLPreviewNotecard::saveItem()
{
- LLInventoryItem* item = gInventory.getItem(mItemUUID);
- return saveIfNeeded(item);
+ LLInventoryItem* item = gInventory.getItem(mItemUUID);
+ return saveIfNeeded(item);
}
void LLPreviewNotecard::setEnabled( BOOL enabled )
{
- LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
- getChildView("Notecard Editor")->setEnabled(enabled);
- getChildView("lock")->setVisible( !enabled);
- getChildView("desc")->setEnabled(enabled);
- getChildView("Save")->setEnabled(enabled && editor && (!editor->isPristine()));
+ getChildView("Notecard Editor")->setEnabled(enabled);
+ getChildView("lock")->setVisible( !enabled);
+ getChildView("desc")->setEnabled(enabled);
+ getChildView("Save")->setEnabled(enabled && editor && (!editor->isPristine()));
}
void LLPreviewNotecard::draw()
{
- LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
- BOOL changed = !editor->isPristine();
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
+ BOOL changed = !editor->isPristine();
+
+ getChildView("Save")->setEnabled(changed && getEnabled());
- getChildView("Save")->setEnabled(changed && getEnabled());
-
- LLPreview::draw();
+ LLPreview::draw();
}
// virtual
BOOL LLPreviewNotecard::handleKeyHere(KEY key, MASK mask)
{
- if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL)))
- {
- saveIfNeeded();
- return TRUE;
- }
+ if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL)))
+ {
+ saveIfNeeded();
+ return TRUE;
+ }
- return LLPreview::handleKeyHere(key, mask);
+ return LLPreview::handleKeyHere(key, mask);
}
// virtual
BOOL LLPreviewNotecard::canClose()
{
- LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
- if(mForceClose || editor->isPristine())
- {
- return TRUE;
- }
- else
- {
- if(!mSaveDialogShown)
- {
- mSaveDialogShown = TRUE;
- // Bring up view-modal dialog: Save changes? Yes, No, Cancel
- LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLPreviewNotecard::handleSaveChangesDialog,this, _1, _2));
- }
- return FALSE;
- }
+ if(mForceClose || editor->isPristine())
+ {
+ return TRUE;
+ }
+ else
+ {
+ if(!mSaveDialogShown)
+ {
+ mSaveDialogShown = TRUE;
+ // Bring up view-modal dialog: Save changes? Yes, No, Cancel
+ LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLPreviewNotecard::handleSaveChangesDialog,this, _1, _2));
+ }
+ return FALSE;
+ }
}
/* virtual */
void LLPreviewNotecard::setObjectID(const LLUUID& object_id)
{
- LLPreview::setObjectID(object_id);
+ LLPreview::setObjectID(object_id);
- LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
- editor->setNotecardObjectID(mObjectUUID);
- editor->makePristine();
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
+ editor->setNotecardObjectID(mObjectUUID);
+ editor->makePristine();
}
const LLInventoryItem* LLPreviewNotecard::getDragItem()
{
- LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
- if(editor)
- {
- return editor->getDragItem();
- }
- return NULL;
+ if(editor)
+ {
+ return editor->getDragItem();
+ }
+ return NULL;
}
bool LLPreviewNotecard::hasEmbeddedInventory()
{
- LLViewerTextEditor* editor = NULL;
- editor = getChild<LLViewerTextEditor>("Notecard Editor");
- if (!editor) return false;
- return editor->hasEmbeddedInventory();
+ LLViewerTextEditor* editor = NULL;
+ editor = getChild<LLViewerTextEditor>("Notecard Editor");
+ if (!editor) return false;
+ return editor->hasEmbeddedInventory();
}
void LLPreviewNotecard::refreshFromInventory(const LLUUID& new_item_id)
{
- if (new_item_id.notNull())
- {
- mItemUUID = new_item_id;
- setKey(LLSD(new_item_id));
- }
- LL_DEBUGS() << "LLPreviewNotecard::refreshFromInventory()" << LL_ENDL;
- loadAsset();
+ if (new_item_id.notNull())
+ {
+ mItemUUID = new_item_id;
+ setKey(LLSD(new_item_id));
+ }
+ LL_DEBUGS() << "LLPreviewNotecard::refreshFromInventory()" << LL_ENDL;
+ loadAsset();
}
void LLPreviewNotecard::updateTitleButtons()
{
- LLPreview::updateTitleButtons();
+ LLPreview::updateTitleButtons();
- LLUICtrl* lock_btn = getChild<LLUICtrl>("lock");
- if(lock_btn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized.
- {
- LLRect lock_rc = lock_btn->getRect();
- LLRect buttons_rect = getDragHandle()->getButtonsRect();
- buttons_rect.mLeft = lock_rc.mLeft;
- getDragHandle()->setButtonsRect(buttons_rect);
- }
+ LLUICtrl* lock_btn = getChild<LLUICtrl>("lock");
+ if(lock_btn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized.
+ {
+ LLRect lock_rc = lock_btn->getRect();
+ LLRect buttons_rect = getDragHandle()->getButtonsRect();
+ buttons_rect.mLeft = lock_rc.mLeft;
+ getDragHandle()->setButtonsRect(buttons_rect);
+ }
}
void LLPreviewNotecard::loadAsset()
{
- // request the asset.
- const LLInventoryItem* item = getItem();
- LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
-
- if (!editor)
- return;
-
- bool fail = false;
-
- if(item)
- {
- LLPermissions perm(item->getPermissions());
- BOOL is_owner = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE);
- BOOL allow_copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE);
- BOOL allow_modify = canModify(mObjectUUID, item);
- BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID());
-
- if (allow_copy || gAgent.isGodlike())
- {
- mAssetID = item->getAssetUUID();
- if(mAssetID.isNull())
- {
- editor->setText(LLStringUtil::null);
- editor->makePristine();
- editor->setEnabled(TRUE);
- mAssetStatus = PREVIEW_ASSET_LOADED;
- }
- else
- {
- LLHost source_sim = LLHost();
- LLSD* user_data = nullptr;
- if (mObjectUUID.notNull())
- {
- LLViewerObject *objectp = gObjectList.findObject(mObjectUUID);
- if (objectp && objectp->getRegion())
- {
- source_sim = objectp->getRegion()->getHost();
- }
- else
- {
- // The object that we're trying to look at disappeared, bail.
- LL_WARNS() << "Can't find object " << mObjectUUID << " associated with notecard." << LL_ENDL;
- mAssetID.setNull();
- editor->setText(getString("no_object"));
- editor->makePristine();
- editor->setEnabled(FALSE);
- mAssetStatus = PREVIEW_ASSET_LOADED;
- return;
- }
- user_data = new LLSD();
- user_data->with("taskid", mObjectUUID).with("itemid", mItemUUID);
- }
- else
- {
- user_data = new LLSD(mItemUUID);
- }
-
- gAssetStorage->getInvItemAsset(source_sim,
- gAgent.getID(),
- gAgent.getSessionID(),
- item->getPermissions().getOwner(),
- mObjectUUID,
- item->getUUID(),
- item->getAssetUUID(),
- item->getType(),
- &onLoadComplete,
- (void*)user_data,
- TRUE);
- mAssetStatus = PREVIEW_ASSET_LOADING;
- }
- }
- else
- {
- mAssetID.setNull();
- editor->setText(getString("not_allowed"));
- editor->makePristine();
- editor->setEnabled(FALSE);
- mAssetStatus = PREVIEW_ASSET_LOADED;
- }
-
- if(!allow_modify)
- {
- editor->setEnabled(FALSE);
- getChildView("lock")->setVisible( TRUE);
- getChildView("Edit")->setEnabled(FALSE);
- }
-
- if((allow_modify || is_owner) && !source_library)
- {
- getChildView("Delete")->setEnabled(TRUE);
- }
- }
+ // request the asset.
+ const LLInventoryItem* item = getItem();
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
+
+ if (!editor)
+ return;
+
+ bool fail = false;
+
+ if(item)
+ {
+ LLPermissions perm(item->getPermissions());
+ BOOL is_owner = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE);
+ BOOL allow_copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE);
+ BOOL allow_modify = canModify(mObjectUUID, item);
+ BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID());
+
+ if (allow_copy || gAgent.isGodlike())
+ {
+ mAssetID = item->getAssetUUID();
+ if(mAssetID.isNull())
+ {
+ editor->setText(LLStringUtil::null);
+ editor->makePristine();
+ editor->setEnabled(TRUE);
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
+ else
+ {
+ LLHost source_sim = LLHost();
+ LLSD* user_data = nullptr;
+ if (mObjectUUID.notNull())
+ {
+ LLViewerObject *objectp = gObjectList.findObject(mObjectUUID);
+ if (objectp && objectp->getRegion())
+ {
+ source_sim = objectp->getRegion()->getHost();
+ }
+ else
+ {
+ // The object that we're trying to look at disappeared, bail.
+ LL_WARNS() << "Can't find object " << mObjectUUID << " associated with notecard." << LL_ENDL;
+ mAssetID.setNull();
+ editor->setText(getString("no_object"));
+ editor->makePristine();
+ editor->setEnabled(FALSE);
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ return;
+ }
+ user_data = new LLSD();
+ user_data->with("taskid", mObjectUUID).with("itemid", mItemUUID);
+ }
+ else
+ {
+ user_data = new LLSD(mItemUUID);
+ }
+
+ gAssetStorage->getInvItemAsset(source_sim,
+ gAgent.getID(),
+ gAgent.getSessionID(),
+ item->getPermissions().getOwner(),
+ mObjectUUID,
+ item->getUUID(),
+ item->getAssetUUID(),
+ item->getType(),
+ &onLoadComplete,
+ (void*)user_data,
+ TRUE);
+ mAssetStatus = PREVIEW_ASSET_LOADING;
+ }
+ }
+ else
+ {
+ mAssetID.setNull();
+ editor->setText(getString("not_allowed"));
+ editor->makePristine();
+ editor->setEnabled(FALSE);
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
+
+ if(!allow_modify)
+ {
+ editor->setEnabled(FALSE);
+ getChildView("lock")->setVisible( TRUE);
+ getChildView("Edit")->setEnabled(FALSE);
+ }
+
+ if((allow_modify || is_owner) && !source_library)
+ {
+ getChildView("Delete")->setEnabled(TRUE);
+ }
+ }
else if (mObjectUUID.notNull() && mItemUUID.notNull())
{
LLViewerObject* objectp = gObjectList.findObject(mObjectUUID);
@@ -343,128 +343,128 @@ void LLPreviewNotecard::loadAsset()
fail = true;
}
- if (fail)
- {
- editor->setText(LLStringUtil::null);
- editor->makePristine();
- editor->setEnabled(TRUE);
- // Don't set asset status here; we may not have set the item id yet
- // (e.g. when this gets called initially)
- //mAssetStatus = PREVIEW_ASSET_LOADED;
- }
+ if (fail)
+ {
+ editor->setText(LLStringUtil::null);
+ editor->makePristine();
+ editor->setEnabled(TRUE);
+ // Don't set asset status here; we may not have set the item id yet
+ // (e.g. when this gets called initially)
+ //mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
}
// static
void LLPreviewNotecard::onLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status)
-{
- LL_INFOS() << "LLPreviewNotecard::onLoadComplete()" << LL_ENDL;
- LLSD* floater_key = (LLSD*)user_data;
- LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", *floater_key);
- if( preview )
- {
- if(0 == status)
- {
- LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
-
- S32 file_length = file.getSize();
-
- std::vector<char> buffer(file_length+1);
- file.read((U8*)&buffer[0], file_length);
-
- // put a EOS at the end
- buffer[file_length] = 0;
-
-
- LLViewerTextEditor* previewEditor = preview->getChild<LLViewerTextEditor>("Notecard Editor");
-
- if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) )
- {
- if( !previewEditor->importBuffer( &buffer[0], file_length+1 ) )
- {
- LL_WARNS() << "Problem importing notecard" << LL_ENDL;
- }
- }
- else
- {
- // Version 0 (just text, doesn't include version number)
- previewEditor->setText(LLStringExplicit(&buffer[0]));
- }
-
- previewEditor->makePristine();
- BOOL modifiable = preview->canModify(preview->mObjectID, preview->getItem());
- preview->setEnabled(modifiable);
- preview->syncExternal();
- preview->mAssetStatus = PREVIEW_ASSET_LOADED;
- }
- else
- {
- if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
- LL_ERR_FILE_EMPTY == status)
- {
- LLNotificationsUtil::add("NotecardMissing");
- }
- else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
- {
- LLNotificationsUtil::add("NotecardNoPermissions");
- }
- else
- {
- LLNotificationsUtil::add("UnableToLoadNotecard");
- }
-
- LL_WARNS() << "Problem loading notecard: " << status << LL_ENDL;
- preview->mAssetStatus = PREVIEW_ASSET_ERROR;
- }
- }
- delete floater_key;
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status)
+{
+ LL_INFOS() << "LLPreviewNotecard::onLoadComplete()" << LL_ENDL;
+ LLSD* floater_key = (LLSD*)user_data;
+ LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", *floater_key);
+ if( preview )
+ {
+ if(0 == status)
+ {
+ LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
+
+ S32 file_length = file.getSize();
+
+ std::vector<char> buffer(file_length+1);
+ file.read((U8*)&buffer[0], file_length);
+
+ // put a EOS at the end
+ buffer[file_length] = 0;
+
+
+ LLViewerTextEditor* previewEditor = preview->getChild<LLViewerTextEditor>("Notecard Editor");
+
+ if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) )
+ {
+ if( !previewEditor->importBuffer( &buffer[0], file_length+1 ) )
+ {
+ LL_WARNS() << "Problem importing notecard" << LL_ENDL;
+ }
+ }
+ else
+ {
+ // Version 0 (just text, doesn't include version number)
+ previewEditor->setText(LLStringExplicit(&buffer[0]));
+ }
+
+ previewEditor->makePristine();
+ BOOL modifiable = preview->canModify(preview->mObjectID, preview->getItem());
+ preview->setEnabled(modifiable);
+ preview->syncExternal();
+ preview->mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
+ else
+ {
+ if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
+ LL_ERR_FILE_EMPTY == status)
+ {
+ LLNotificationsUtil::add("NotecardMissing");
+ }
+ else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
+ {
+ LLNotificationsUtil::add("NotecardNoPermissions");
+ }
+ else
+ {
+ LLNotificationsUtil::add("UnableToLoadNotecard");
+ }
+
+ LL_WARNS() << "Problem loading notecard: " << status << LL_ENDL;
+ preview->mAssetStatus = PREVIEW_ASSET_ERROR;
+ }
+ }
+ delete floater_key;
}
// static
void LLPreviewNotecard::onClickSave(void* user_data)
{
- //LL_INFOS() << "LLPreviewNotecard::onBtnSave()" << LL_ENDL;
- LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
- if(preview)
- {
- preview->saveIfNeeded();
- }
+ //LL_INFOS() << "LLPreviewNotecard::onBtnSave()" << LL_ENDL;
+ LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
+ if(preview)
+ {
+ preview->saveIfNeeded();
+ }
}
// static
void LLPreviewNotecard::onClickDelete(void* user_data)
{
- LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
- if(preview)
- {
- preview->deleteNotecard();
- }
+ LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
+ if(preview)
+ {
+ preview->deleteNotecard();
+ }
}
// static
void LLPreviewNotecard::onClickEdit(void* user_data)
{
- LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
- if (preview)
- {
- preview->openInExternalEditor();
- }
+ LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
+ if (preview)
+ {
+ preview->openInExternalEditor();
+ }
}
struct LLSaveNotecardInfo
{
- LLPreviewNotecard* mSelf;
- LLUUID mItemUUID;
- LLUUID mObjectUUID;
- LLTransactionID mTransactionID;
- LLPointer<LLInventoryItem> mCopyItem;
- LLSaveNotecardInfo(LLPreviewNotecard* self, const LLUUID& item_id, const LLUUID& object_id,
- const LLTransactionID& transaction_id, LLInventoryItem* copyitem) :
- mSelf(self), mItemUUID(item_id), mObjectUUID(object_id), mTransactionID(transaction_id), mCopyItem(copyitem)
- {
- }
+ LLPreviewNotecard* mSelf;
+ LLUUID mItemUUID;
+ LLUUID mObjectUUID;
+ LLTransactionID mTransactionID;
+ LLPointer<LLInventoryItem> mCopyItem;
+ LLSaveNotecardInfo(LLPreviewNotecard* self, const LLUUID& item_id, const LLUUID& object_id,
+ const LLTransactionID& transaction_id, LLInventoryItem* copyitem) :
+ mSelf(self), mItemUUID(item_id), mObjectUUID(object_id), mTransactionID(transaction_id), mCopyItem(copyitem)
+ {
+ }
};
void LLPreviewNotecard::finishInventoryUpload(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId)
@@ -515,25 +515,25 @@ void LLPreviewNotecard::finishTaskUpload(LLUUID itemId, LLUUID newAssetId, LLUUI
bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync)
{
- LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
-
- if(!editor)
- {
- LL_WARNS() << "Cannot get handle to the notecard editor." << LL_ENDL;
- return false;
- }
-
- if(!editor->isPristine())
- {
- std::string buffer;
- if (!editor->exportBuffer(buffer))
- {
- return false;
- }
-
- editor->makePristine();
- const LLInventoryItem* item = getItem();
- // save it out to database
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
+
+ if(!editor)
+ {
+ LL_WARNS() << "Cannot get handle to the notecard editor." << LL_ENDL;
+ return false;
+ }
+
+ if(!editor->isPristine())
+ {
+ std::string buffer;
+ if (!editor->exportBuffer(buffer))
+ {
+ return false;
+ }
+
+ editor->makePristine();
+ const LLInventoryItem* item = getItem();
+ // save it out to database
if (item)
{
const LLViewerRegion* region = gAgent.getRegion();
@@ -552,7 +552,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync)
if (mObjectUUID.isNull() && !agent_url.empty())
{
- uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(mItemUUID, LLAssetType::AT_NOTECARD, buffer,
+ uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(mItemUUID, LLAssetType::AT_NOTECARD, buffer,
[](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD) {
LLPreviewNotecard::finishInventoryUpload(itemId, newAssetId, newItemId);
},
@@ -562,7 +562,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync)
else if (!mObjectUUID.isNull() && !task_url.empty())
{
LLUUID object_uuid(mObjectUUID);
- uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(mObjectUUID, mItemUUID, LLAssetType::AT_NOTECARD, buffer,
+ uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(mObjectUUID, mItemUUID, LLAssetType::AT_NOTECARD, buffer,
[object_uuid](LLUUID itemId, LLUUID, LLUUID newAssetId, LLSD) {
LLPreviewNotecard::finishTaskUpload(itemId, newAssetId, object_uuid);
},
@@ -579,8 +579,8 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync)
}
}
- else if (gAssetStorage)
- {
+ else if (gAssetStorage)
+ {
// We need to update the asset information
LLTransactionID tid;
LLAssetID asset_id;
@@ -590,42 +590,42 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync)
LLFileSystem file(asset_id, LLAssetType::AT_NOTECARD, LLFileSystem::APPEND);
- LLSaveNotecardInfo* info = new LLSaveNotecardInfo(this, mItemUUID, mObjectUUID,
- tid, copyitem);
+ LLSaveNotecardInfo* info = new LLSaveNotecardInfo(this, mItemUUID, mObjectUUID,
+ tid, copyitem);
S32 size = buffer.length() + 1;
file.write((U8*)buffer.c_str(), size);
- gAssetStorage->storeAssetData(tid, LLAssetType::AT_NOTECARD,
- &onSaveComplete,
- (void*)info,
- FALSE);
- return true;
- }
- else // !gAssetStorage
- {
- LL_WARNS() << "Not connected to an asset storage system." << LL_ENDL;
- return false;
- }
- if(mCloseAfterSave)
- {
- closeFloater();
- }
- }
- }
- return true;
+ gAssetStorage->storeAssetData(tid, LLAssetType::AT_NOTECARD,
+ &onSaveComplete,
+ (void*)info,
+ FALSE);
+ return true;
+ }
+ else // !gAssetStorage
+ {
+ LL_WARNS() << "Not connected to an asset storage system." << LL_ENDL;
+ return false;
+ }
+ if(mCloseAfterSave)
+ {
+ closeFloater();
+ }
+ }
+ }
+ return true;
}
void LLPreviewNotecard::syncExternal()
{
- // Sync with external editor.
- std::string tmp_file = getTmpFileName();
- llstat s;
- if (LLFile::stat(tmp_file, &s) == 0) // file exists
- {
- if (mLiveFile) mLiveFile->ignoreNextUpdate();
- writeToFile(tmp_file);
- }
+ // Sync with external editor.
+ std::string tmp_file = getTmpFileName();
+ llstat s;
+ if (LLFile::stat(tmp_file, &s) == 0) // file exists
+ {
+ if (mLiveFile) mLiveFile->ignoreNextUpdate();
+ writeToFile(tmp_file);
+ }
}
/*virtual*/
@@ -641,150 +641,150 @@ void LLPreviewNotecard::inventoryChanged(LLViewerObject* object,
void LLPreviewNotecard::deleteNotecard()
{
- LLNotificationsUtil::add("DeleteNotecard", LLSD(), LLSD(), boost::bind(&LLPreviewNotecard::handleConfirmDeleteDialog,this, _1, _2));
+ LLNotificationsUtil::add("DeleteNotecard", LLSD(), LLSD(), boost::bind(&LLPreviewNotecard::handleConfirmDeleteDialog,this, _1, _2));
}
// static
void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
- LLSaveNotecardInfo* info = (LLSaveNotecardInfo*)user_data;
- if(info && (0 == status))
- {
- if(info->mObjectUUID.isNull())
- {
- LLViewerInventoryItem* item;
- item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID);
- if(item)
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setAssetUUID(asset_uuid);
- new_item->setTransactionID(info->mTransactionID);
- new_item->updateServer(FALSE);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- }
- else
- {
- LL_WARNS() << "Inventory item for script " << info->mItemUUID
- << " is no longer in agent inventory." << LL_ENDL;
- }
- }
- else
- {
- LLViewerObject* object = gObjectList.findObject(info->mObjectUUID);
- LLViewerInventoryItem* item = NULL;
- if(object)
- {
- item = (LLViewerInventoryItem*)object->getInventoryObject(info->mItemUUID);
- }
- if(object && item)
- {
- item->setAssetUUID(asset_uuid);
- item->setTransactionID(info->mTransactionID);
- object->updateInventory(item, TASK_INVENTORY_ITEM_KEY, false);
- dialog_refresh_all();
- }
- else
- {
- LLNotificationsUtil::add("SaveNotecardFailObjectNotFound");
- }
- }
- // Perform item copy to inventory
- if (info->mCopyItem.notNull())
- {
- LLViewerTextEditor* editor = info->mSelf->getChild<LLViewerTextEditor>("Notecard Editor");
- if (editor)
- {
- editor->copyInventory(info->mCopyItem);
- }
- }
-
- // Find our window and close it if requested.
-
- LLPreviewNotecard* previewp = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", info->mItemUUID);
- if (previewp && previewp->mCloseAfterSave)
- {
- previewp->closeFloater();
- }
- }
- else
- {
- LL_WARNS() << "Problem saving notecard: " << status << LL_ENDL;
- LLSD args;
- args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
- LLNotificationsUtil::add("SaveNotecardFailReason", args);
- }
-
- std::string uuid_string;
- asset_uuid.toString(uuid_string);
- std::string filename;
- filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".tmp";
- LLFile::remove(filename);
- delete info;
+ LLSaveNotecardInfo* info = (LLSaveNotecardInfo*)user_data;
+ if(info && (0 == status))
+ {
+ if(info->mObjectUUID.isNull())
+ {
+ LLViewerInventoryItem* item;
+ item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID);
+ if(item)
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setAssetUUID(asset_uuid);
+ new_item->setTransactionID(info->mTransactionID);
+ new_item->updateServer(FALSE);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+ }
+ else
+ {
+ LL_WARNS() << "Inventory item for script " << info->mItemUUID
+ << " is no longer in agent inventory." << LL_ENDL;
+ }
+ }
+ else
+ {
+ LLViewerObject* object = gObjectList.findObject(info->mObjectUUID);
+ LLViewerInventoryItem* item = NULL;
+ if(object)
+ {
+ item = (LLViewerInventoryItem*)object->getInventoryObject(info->mItemUUID);
+ }
+ if(object && item)
+ {
+ item->setAssetUUID(asset_uuid);
+ item->setTransactionID(info->mTransactionID);
+ object->updateInventory(item, TASK_INVENTORY_ITEM_KEY, false);
+ dialog_refresh_all();
+ }
+ else
+ {
+ LLNotificationsUtil::add("SaveNotecardFailObjectNotFound");
+ }
+ }
+ // Perform item copy to inventory
+ if (info->mCopyItem.notNull())
+ {
+ LLViewerTextEditor* editor = info->mSelf->getChild<LLViewerTextEditor>("Notecard Editor");
+ if (editor)
+ {
+ editor->copyInventory(info->mCopyItem);
+ }
+ }
+
+ // Find our window and close it if requested.
+
+ LLPreviewNotecard* previewp = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", info->mItemUUID);
+ if (previewp && previewp->mCloseAfterSave)
+ {
+ previewp->closeFloater();
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Problem saving notecard: " << status << LL_ENDL;
+ LLSD args;
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
+ LLNotificationsUtil::add("SaveNotecardFailReason", args);
+ }
+
+ std::string uuid_string;
+ asset_uuid.toString(uuid_string);
+ std::string filename;
+ filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".tmp";
+ LLFile::remove(filename);
+ delete info;
}
bool LLPreviewNotecard::handleSaveChangesDialog(const LLSD& notification, const LLSD& response)
{
- mSaveDialogShown = FALSE;
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch(option)
- {
- case 0: // "Yes"
- mCloseAfterSave = TRUE;
- LLPreviewNotecard::onClickSave((void*)this);
- break;
-
- case 1: // "No"
- mForceClose = TRUE;
- closeFloater();
- break;
-
- case 2: // "Cancel"
- default:
- // If we were quitting, we didn't really mean it.
- LLAppViewer::instance()->abortQuit();
- break;
- }
- return false;
+ mSaveDialogShown = FALSE;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case 0: // "Yes"
+ mCloseAfterSave = TRUE;
+ LLPreviewNotecard::onClickSave((void*)this);
+ break;
+
+ case 1: // "No"
+ mForceClose = TRUE;
+ closeFloater();
+ break;
+
+ case 2: // "Cancel"
+ default:
+ // If we were quitting, we didn't really mean it.
+ LLAppViewer::instance()->abortQuit();
+ break;
+ }
+ return false;
}
bool LLPreviewNotecard::handleConfirmDeleteDialog(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0)
- {
- // canceled
- return false;
- }
-
- if (mObjectUUID.isNull())
- {
- // move item from agent's inventory into trash
- LLViewerInventoryItem* item = gInventory.getItem(mItemUUID);
- if (item != NULL)
- {
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- gInventory.changeItemParent(item, trash_id, FALSE);
- }
- }
- else
- {
- // delete item from inventory of in-world object
- LLViewerObject* object = gObjectList.findObject(mObjectUUID);
- if(object)
- {
- LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemUUID));
- if (item != NULL)
- {
- object->removeInventory(mItemUUID);
- }
- }
- }
-
- // close floater, ignore unsaved changes
- mForceClose = TRUE;
- closeFloater();
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0)
+ {
+ // canceled
+ return false;
+ }
+
+ if (mObjectUUID.isNull())
+ {
+ // move item from agent's inventory into trash
+ LLViewerInventoryItem* item = gInventory.getItem(mItemUUID);
+ if (item != NULL)
+ {
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ gInventory.changeItemParent(item, trash_id, FALSE);
+ }
+ }
+ else
+ {
+ // delete item from inventory of in-world object
+ LLViewerObject* object = gObjectList.findObject(mObjectUUID);
+ if(object)
+ {
+ LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemUUID));
+ if (item != NULL)
+ {
+ object->removeInventory(mItemUUID);
+ }
+ }
+ }
+
+ // close floater, ignore unsaved changes
+ mForceClose = TRUE;
+ closeFloater();
+ return false;
}
void LLPreviewNotecard::openInExternalEditor()
@@ -851,7 +851,7 @@ bool LLPreviewNotecard::loadNotecardText(const std::string& filename)
return false;
}
- LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/
+ LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/
if (!file)
{
LL_WARNS() << "Error opening " << filename << LL_ENDL;
@@ -907,7 +907,7 @@ std::string LLPreviewNotecard::getTmpFileName()
std::string notecard_id = mObjectID.asString() + "_" + mItemUUID.asString();
// Use MD5 sum to make the file name shorter and not exceed maximum path length.
- char notecard_id_hash_str[33]; /* Flawfinder: ignore */
+ char notecard_id_hash_str[33]; /* Flawfinder: ignore */
LLMD5 notecard_id_hash((const U8 *)notecard_id.c_str());
notecard_id_hash.hex_digest(notecard_id_hash_str);
diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h
index 321f44a1ea..a5cd5510a3 100644
--- a/indra/newview/llpreviewnotecard.h
+++ b/indra/newview/llpreviewnotecard.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewnotecard.h
* @brief LLPreviewNotecard class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,36 +45,36 @@ class LLButton;
class LLPreviewNotecard : public LLPreview, public LLVOInventoryListener
{
public:
- LLPreviewNotecard(const LLSD& key);
- virtual ~LLPreviewNotecard();
-
- bool saveItem();
- void setObjectID(const LLUUID& object_id) override;
+ LLPreviewNotecard(const LLSD& key);
+ virtual ~LLPreviewNotecard();
+
+ bool saveItem();
+ void setObjectID(const LLUUID& object_id) override;
- // llview
- void draw() override;
- BOOL handleKeyHere(KEY key, MASK mask) override;
- void setEnabled( BOOL enabled ) override;
+ // llview
+ void draw() override;
+ BOOL handleKeyHere(KEY key, MASK mask) override;
+ void setEnabled( BOOL enabled ) override;
- // llfloater
- BOOL canClose() override;
+ // llfloater
+ BOOL canClose() override;
- // llpanel
- BOOL postBuild() override;
+ // llpanel
+ BOOL postBuild() override;
- // reach into the text editor, and grab the drag item
- const LLInventoryItem* getDragItem();
+ // reach into the text editor, and grab the drag item
+ const LLInventoryItem* getDragItem();
- // return true if there is any embedded inventory.
- bool hasEmbeddedInventory();
+ // return true if there is any embedded inventory.
+ bool hasEmbeddedInventory();
- // After saving a notecard, the tcp based upload system will
- // change the asset, therefore, we need to re-fetch it from the
- // asset system. :(
- void refreshFromInventory(const LLUUID& item_id = LLUUID::null);
+ // After saving a notecard, the tcp based upload system will
+ // change the asset, therefore, we need to re-fetch it from the
+ // asset system. :(
+ void refreshFromInventory(const LLUUID& item_id = LLUUID::null);
- void syncExternal();
+ void syncExternal();
void inventoryChanged(LLViewerObject* object,
LLInventoryObject::object_list_t* inventory,
@@ -83,28 +83,28 @@ public:
protected:
- void updateTitleButtons() override;
- void loadAsset() override;
- bool saveIfNeeded(LLInventoryItem* copyitem = NULL, bool sync = true);
+ void updateTitleButtons() override;
+ void loadAsset() override;
+ bool saveIfNeeded(LLInventoryItem* copyitem = NULL, bool sync = true);
- void deleteNotecard();
+ void deleteNotecard();
- static void onLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status);
+ static void onLoadComplete(const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status);
- static void onClickSave(void* data);
+ static void onClickSave(void* data);
- static void onClickDelete(void* data);
+ static void onClickDelete(void* data);
- static void onClickEdit(void* data);
+ static void onClickEdit(void* data);
- static void onSaveComplete(const LLUUID& asset_uuid,
- void* user_data,
- S32 status, LLExtStat ext_status);
+ static void onSaveComplete(const LLUUID& asset_uuid,
+ void* user_data,
+ S32 status, LLExtStat ext_status);
- bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
- bool handleConfirmDeleteDialog(const LLSD& notification, const LLSD& response);
+ bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
+ bool handleConfirmDeleteDialog(const LLSD& notification, const LLSD& response);
static void finishInventoryUpload(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId);
static void finishTaskUpload(LLUUID itemId, LLUUID newAssetId, LLUUID taskId);
@@ -116,14 +116,14 @@ protected:
std::string getTmpFileName();
protected:
- LLViewerTextEditor* mEditor;
- LLButton* mSaveBtn;
+ LLViewerTextEditor* mEditor;
+ LLButton* mSaveBtn;
- LLUUID mAssetID;
+ LLUUID mAssetID;
- LLUUID mObjectID;
+ LLUUID mObjectID;
- LLLiveLSLFile* mLiveFile;
+ LLLiveLSLFile* mLiveFile;
};
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 7095275c52..70458af0e8 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewscript.cpp
* @brief LLPreviewScript class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -92,18 +92,18 @@
#include "llinventoryfunctions.h"
const std::string HELLO_LSL =
- "default\n"
- "{\n"
- " state_entry()\n"
- " {\n"
- " llSay(0, \"Hello, Avatar!\");\n"
- " }\n"
- "\n"
- " touch_start(integer total_number)\n"
- " {\n"
- " llSay(0, \"Touched.\");\n"
- " }\n"
- "}\n";
+ "default\n"
+ "{\n"
+ " state_entry()\n"
+ " {\n"
+ " llSay(0, \"Hello, Avatar!\");\n"
+ " }\n"
+ "\n"
+ " touch_start(integer total_number)\n"
+ " {\n"
+ " llSay(0, \"Touched.\");\n"
+ " }\n"
+ "}\n";
const std::string HELP_LSL_PORTAL_TOPIC = "LSL_Portal";
const std::string DEFAULT_SCRIPT_NAME = "New Script"; // *TODO:Translate?
@@ -115,8 +115,8 @@ const F32 LIVE_HELP_REFRESH_TIME = 1.f;
static bool have_script_upload_cap(LLUUID& object_id)
{
- LLViewerObject* object = gObjectList.findObject(object_id);
- return object && (! object->getRegion()->getCapability("UpdateScriptTask").empty());
+ LLViewerObject* object = gObjectList.findObject(object_id);
+ return object && (! object->getRegion()->getCapability("UpdateScriptTask").empty());
}
/// ---------------------------------------------------------------------------
@@ -124,27 +124,27 @@ static bool have_script_upload_cap(LLUUID& object_id)
/// ---------------------------------------------------------------------------
LLLiveLSLFile::LLLiveLSLFile(std::string file_path, change_callback_t change_cb)
-: mOnChangeCallback(change_cb)
-, mIgnoreNextUpdate(false)
-, LLLiveFile(file_path, 1.0)
+: mOnChangeCallback(change_cb)
+, mIgnoreNextUpdate(false)
+, LLLiveFile(file_path, 1.0)
{
- llassert(mOnChangeCallback);
+ llassert(mOnChangeCallback);
}
LLLiveLSLFile::~LLLiveLSLFile()
{
- LLFile::remove(filename());
+ LLFile::remove(filename());
}
bool LLLiveLSLFile::loadFile()
{
- if (mIgnoreNextUpdate)
- {
- mIgnoreNextUpdate = false;
- return true;
- }
+ if (mIgnoreNextUpdate)
+ {
+ mIgnoreNextUpdate = false;
+ return true;
+ }
- return mOnChangeCallback(filename());
+ return mOnChangeCallback(filename());
}
/// ---------------------------------------------------------------------------
@@ -153,176 +153,176 @@ bool LLLiveLSLFile::loadFile()
class LLFloaterScriptSearch : public LLFloater
{
public:
- LLFloaterScriptSearch(LLScriptEdCore* editor_core);
- ~LLFloaterScriptSearch();
+ LLFloaterScriptSearch(LLScriptEdCore* editor_core);
+ ~LLFloaterScriptSearch();
- /*virtual*/ BOOL postBuild();
- static void show(LLScriptEdCore* editor_core);
- static void onBtnSearch(void* userdata);
- void handleBtnSearch();
+ /*virtual*/ BOOL postBuild();
+ static void show(LLScriptEdCore* editor_core);
+ static void onBtnSearch(void* userdata);
+ void handleBtnSearch();
- static void onBtnReplace(void* userdata);
- void handleBtnReplace();
+ static void onBtnReplace(void* userdata);
+ void handleBtnReplace();
- static void onBtnReplaceAll(void* userdata);
- void handleBtnReplaceAll();
+ static void onBtnReplaceAll(void* userdata);
+ void handleBtnReplaceAll();
- LLScriptEdCore* getEditorCore() { return mEditorCore; }
- static LLFloaterScriptSearch* getInstance() { return sInstance; }
+ LLScriptEdCore* getEditorCore() { return mEditorCore; }
+ static LLFloaterScriptSearch* getInstance() { return sInstance; }
- virtual bool hasAccelerators() const;
- virtual BOOL handleKeyHere(KEY key, MASK mask);
+ virtual bool hasAccelerators() const;
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
private:
- LLScriptEdCore* mEditorCore;
- static LLFloaterScriptSearch* sInstance;
+ LLScriptEdCore* mEditorCore;
+ static LLFloaterScriptSearch* sInstance;
protected:
- LLLineEditor* mSearchBox;
- LLLineEditor* mReplaceBox;
- void onSearchBoxCommit();
+ LLLineEditor* mSearchBox;
+ LLLineEditor* mReplaceBox;
+ void onSearchBoxCommit();
};
LLFloaterScriptSearch* LLFloaterScriptSearch::sInstance = NULL;
LLFloaterScriptSearch::LLFloaterScriptSearch(LLScriptEdCore* editor_core)
-: LLFloater(LLSD()),
- mSearchBox(NULL),
- mReplaceBox(NULL),
- mEditorCore(editor_core)
-{
- buildFromFile("floater_script_search.xml");
-
- sInstance = this;
-
- // find floater in which script panel is embedded
- LLView* viewp = (LLView*)editor_core;
- while(viewp)
- {
- LLFloater* floaterp = dynamic_cast<LLFloater*>(viewp);
- if (floaterp)
- {
- floaterp->addDependentFloater(this);
- break;
- }
- viewp = viewp->getParent();
- }
+: LLFloater(LLSD()),
+ mSearchBox(NULL),
+ mReplaceBox(NULL),
+ mEditorCore(editor_core)
+{
+ buildFromFile("floater_script_search.xml");
+
+ sInstance = this;
+
+ // find floater in which script panel is embedded
+ LLView* viewp = (LLView*)editor_core;
+ while(viewp)
+ {
+ LLFloater* floaterp = dynamic_cast<LLFloater*>(viewp);
+ if (floaterp)
+ {
+ floaterp->addDependentFloater(this);
+ break;
+ }
+ viewp = viewp->getParent();
+ }
}
BOOL LLFloaterScriptSearch::postBuild()
{
- mReplaceBox = getChild<LLLineEditor>("replace_text");
- mSearchBox = getChild<LLLineEditor>("search_text");
- mSearchBox->setCommitCallback(boost::bind(&LLFloaterScriptSearch::onSearchBoxCommit, this));
- mSearchBox->setCommitOnFocusLost(FALSE);
- childSetAction("search_btn", onBtnSearch,this);
- childSetAction("replace_btn", onBtnReplace,this);
- childSetAction("replace_all_btn", onBtnReplaceAll,this);
+ mReplaceBox = getChild<LLLineEditor>("replace_text");
+ mSearchBox = getChild<LLLineEditor>("search_text");
+ mSearchBox->setCommitCallback(boost::bind(&LLFloaterScriptSearch::onSearchBoxCommit, this));
+ mSearchBox->setCommitOnFocusLost(FALSE);
+ childSetAction("search_btn", onBtnSearch,this);
+ childSetAction("replace_btn", onBtnReplace,this);
+ childSetAction("replace_all_btn", onBtnReplaceAll,this);
- setDefaultBtn("search_btn");
+ setDefaultBtn("search_btn");
- return TRUE;
+ return TRUE;
}
-//static
+//static
void LLFloaterScriptSearch::show(LLScriptEdCore* editor_core)
{
- LLSD::String search_text;
- LLSD::String replace_text;
- if (sInstance && sInstance->mEditorCore && sInstance->mEditorCore != editor_core)
- {
- search_text=sInstance->mSearchBox->getValue().asString();
- replace_text=sInstance->mReplaceBox->getValue().asString();
- sInstance->closeFloater();
- delete sInstance;
- }
+ LLSD::String search_text;
+ LLSD::String replace_text;
+ if (sInstance && sInstance->mEditorCore && sInstance->mEditorCore != editor_core)
+ {
+ search_text=sInstance->mSearchBox->getValue().asString();
+ replace_text=sInstance->mReplaceBox->getValue().asString();
+ sInstance->closeFloater();
+ delete sInstance;
+ }
- if (!sInstance)
- {
- // sInstance will be assigned in the constructor.
- new LLFloaterScriptSearch(editor_core);
- sInstance->mSearchBox->setValue(search_text);
- sInstance->mReplaceBox->setValue(replace_text);
- }
+ if (!sInstance)
+ {
+ // sInstance will be assigned in the constructor.
+ new LLFloaterScriptSearch(editor_core);
+ sInstance->mSearchBox->setValue(search_text);
+ sInstance->mReplaceBox->setValue(replace_text);
+ }
- sInstance->openFloater();
+ sInstance->openFloater();
}
LLFloaterScriptSearch::~LLFloaterScriptSearch()
{
- sInstance = NULL;
+ sInstance = NULL;
}
-// static
+// static
void LLFloaterScriptSearch::onBtnSearch(void *userdata)
{
- LLFloaterScriptSearch* self = (LLFloaterScriptSearch*)userdata;
- self->handleBtnSearch();
+ LLFloaterScriptSearch* self = (LLFloaterScriptSearch*)userdata;
+ self->handleBtnSearch();
}
void LLFloaterScriptSearch::handleBtnSearch()
{
- LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->selectNext(mSearchBox->getValue().asString(), caseChk->get());
+ LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
+ mEditorCore->mEditor->selectNext(mSearchBox->getValue().asString(), caseChk->get());
}
-// static
+// static
void LLFloaterScriptSearch::onBtnReplace(void *userdata)
{
- LLFloaterScriptSearch* self = (LLFloaterScriptSearch*)userdata;
- self->handleBtnReplace();
+ LLFloaterScriptSearch* self = (LLFloaterScriptSearch*)userdata;
+ self->handleBtnReplace();
}
void LLFloaterScriptSearch::handleBtnReplace()
{
- LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->replaceText(mSearchBox->getValue().asString(), mReplaceBox->getValue().asString(), caseChk->get());
+ LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
+ mEditorCore->mEditor->replaceText(mSearchBox->getValue().asString(), mReplaceBox->getValue().asString(), caseChk->get());
}
-// static
+// static
void LLFloaterScriptSearch::onBtnReplaceAll(void *userdata)
{
- LLFloaterScriptSearch* self = (LLFloaterScriptSearch*)userdata;
- self->handleBtnReplaceAll();
+ LLFloaterScriptSearch* self = (LLFloaterScriptSearch*)userdata;
+ self->handleBtnReplaceAll();
}
void LLFloaterScriptSearch::handleBtnReplaceAll()
{
- LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->replaceTextAll(mSearchBox->getValue().asString(), mReplaceBox->getValue().asString(), caseChk->get());
+ LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
+ mEditorCore->mEditor->replaceTextAll(mSearchBox->getValue().asString(), mReplaceBox->getValue().asString(), caseChk->get());
}
bool LLFloaterScriptSearch::hasAccelerators() const
{
- if (mEditorCore)
- {
- return mEditorCore->hasAccelerators();
- }
- return FALSE;
+ if (mEditorCore)
+ {
+ return mEditorCore->hasAccelerators();
+ }
+ return FALSE;
}
BOOL LLFloaterScriptSearch::handleKeyHere(KEY key, MASK mask)
{
- if (mEditorCore)
- {
- BOOL handled = mEditorCore->handleKeyHere(key, mask);
- if (!handled)
- {
- LLFloater::handleKeyHere(key, mask);
- }
- }
+ if (mEditorCore)
+ {
+ BOOL handled = mEditorCore->handleKeyHere(key, mask);
+ if (!handled)
+ {
+ LLFloater::handleKeyHere(key, mask);
+ }
+ }
- return FALSE;
+ return FALSE;
}
void LLFloaterScriptSearch::onSearchBoxCommit()
{
- if (mEditorCore && mEditorCore->mEditor)
- {
- LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
- mEditorCore->mEditor->selectNext(mSearchBox->getValue().asString(), caseChk->get());
- }
+ if (mEditorCore && mEditorCore->mEditor)
+ {
+ LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text");
+ mEditorCore->mEditor->selectNext(mSearchBox->getValue().asString(), caseChk->get());
+ }
}
/// ---------------------------------------------------------------------------
@@ -363,137 +363,137 @@ void LLScriptMovedObserver::changed(U32 mask)
struct LLSECKeywordCompare
{
- bool operator()(const std::string& lhs, const std::string& rhs)
- {
- return (LLStringUtil::compareDictInsensitive( lhs, rhs ) < 0 );
- }
+ bool operator()(const std::string& lhs, const std::string& rhs)
+ {
+ return (LLStringUtil::compareDictInsensitive( lhs, rhs ) < 0 );
+ }
};
LLScriptEdCore::LLScriptEdCore(
- LLScriptEdContainer* container,
- const std::string& sample,
- const LLHandle<LLFloater>& floater_handle,
- void (*load_callback)(void*),
- void (*save_callback)(void*, BOOL),
- void (*search_replace_callback) (void* userdata),
- void* userdata,
- bool live,
- S32 bottom_pad)
- :
- LLPanel(),
- mSampleText(sample),
- mEditor( NULL ),
- mLoadCallback( load_callback ),
- mSaveCallback( save_callback ),
- mSearchReplaceCallback( search_replace_callback ),
- mUserdata( userdata ),
- mForceClose( FALSE ),
- mLastHelpToken(NULL),
- mLiveHelpHistorySize(0),
- mEnableSave(FALSE),
- mLiveFile(NULL),
- mLive(live),
- mContainer(container),
- mHasScriptData(FALSE),
- mScriptRemoved(FALSE),
- mSaveDialogShown(FALSE)
-{
- setFollowsAll();
- setBorderVisible(FALSE);
-
- setXMLFilename("panel_script_ed.xml");
- llassert_always(mContainer != NULL);
+ LLScriptEdContainer* container,
+ const std::string& sample,
+ const LLHandle<LLFloater>& floater_handle,
+ void (*load_callback)(void*),
+ void (*save_callback)(void*, BOOL),
+ void (*search_replace_callback) (void* userdata),
+ void* userdata,
+ bool live,
+ S32 bottom_pad)
+ :
+ LLPanel(),
+ mSampleText(sample),
+ mEditor( NULL ),
+ mLoadCallback( load_callback ),
+ mSaveCallback( save_callback ),
+ mSearchReplaceCallback( search_replace_callback ),
+ mUserdata( userdata ),
+ mForceClose( FALSE ),
+ mLastHelpToken(NULL),
+ mLiveHelpHistorySize(0),
+ mEnableSave(FALSE),
+ mLiveFile(NULL),
+ mLive(live),
+ mContainer(container),
+ mHasScriptData(FALSE),
+ mScriptRemoved(FALSE),
+ mSaveDialogShown(FALSE)
+{
+ setFollowsAll();
+ setBorderVisible(FALSE);
+
+ setXMLFilename("panel_script_ed.xml");
+ llassert_always(mContainer != NULL);
}
LLScriptEdCore::~LLScriptEdCore()
{
- deleteBridges();
+ deleteBridges();
- // If the search window is up for this editor, close it.
- LLFloaterScriptSearch* script_search = LLFloaterScriptSearch::getInstance();
- if (script_search && script_search->getEditorCore() == this)
- {
- script_search->closeFloater();
- delete script_search;
- }
+ // If the search window is up for this editor, close it.
+ LLFloaterScriptSearch* script_search = LLFloaterScriptSearch::getInstance();
+ if (script_search && script_search->getEditorCore() == this)
+ {
+ script_search->closeFloater();
+ delete script_search;
+ }
- delete mLiveFile;
- if (mSyntaxIDConnection.connected())
- {
- mSyntaxIDConnection.disconnect();
- }
+ delete mLiveFile;
+ if (mSyntaxIDConnection.connected())
+ {
+ mSyntaxIDConnection.disconnect();
+ }
}
void LLLiveLSLEditor::experienceChanged()
{
- if(mScriptEd->getAssociatedExperience() != mExperiences->getSelectedValue().asUUID())
- {
- mScriptEd->enableSave(getIsModifiable());
- //getChildView("Save_btn")->setEnabled(TRUE);
- mScriptEd->setAssociatedExperience(mExperiences->getSelectedValue().asUUID());
- updateExperiencePanel();
- }
+ if(mScriptEd->getAssociatedExperience() != mExperiences->getSelectedValue().asUUID())
+ {
+ mScriptEd->enableSave(getIsModifiable());
+ //getChildView("Save_btn")->setEnabled(TRUE);
+ mScriptEd->setAssociatedExperience(mExperiences->getSelectedValue().asUUID());
+ updateExperiencePanel();
+ }
}
void LLLiveLSLEditor::onViewProfile( LLUICtrl *ui, void* userdata )
{
- LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
+ LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
- LLUUID id;
- if(self->mExperienceEnabled->get())
- {
- id=self->mScriptEd->getAssociatedExperience();
- if(id.notNull())
- {
- LLFloaterReg::showInstance("experience_profile", id, true);
- }
- }
+ LLUUID id;
+ if(self->mExperienceEnabled->get())
+ {
+ id=self->mScriptEd->getAssociatedExperience();
+ if(id.notNull())
+ {
+ LLFloaterReg::showInstance("experience_profile", id, true);
+ }
+ }
}
void LLLiveLSLEditor::onToggleExperience( LLUICtrl *ui, void* userdata )
{
- LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
+ LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
- LLUUID id;
- if(self->mExperienceEnabled->get())
- {
- if(self->mScriptEd->getAssociatedExperience().isNull())
- {
- id=self->mExperienceIds.beginArray()->asUUID();
- }
- }
+ LLUUID id;
+ if(self->mExperienceEnabled->get())
+ {
+ if(self->mScriptEd->getAssociatedExperience().isNull())
+ {
+ id=self->mExperienceIds.beginArray()->asUUID();
+ }
+ }
- if(id != self->mScriptEd->getAssociatedExperience())
- {
- self->mScriptEd->enableSave(self->getIsModifiable());
- }
- self->mScriptEd->setAssociatedExperience(id);
+ if(id != self->mScriptEd->getAssociatedExperience())
+ {
+ self->mScriptEd->enableSave(self->getIsModifiable());
+ }
+ self->mScriptEd->setAssociatedExperience(id);
- self->updateExperiencePanel();
+ self->updateExperiencePanel();
}
BOOL LLScriptEdCore::postBuild()
{
- mErrorList = getChild<LLScrollListCtrl>("lsl errors");
+ mErrorList = getChild<LLScrollListCtrl>("lsl errors");
- mFunctions = getChild<LLComboBox>("Insert...");
+ mFunctions = getChild<LLComboBox>("Insert...");
- childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this);
+ childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this);
- mEditor = getChild<LLScriptEditor>("Script Editor");
+ mEditor = getChild<LLScriptEditor>("Script Editor");
- childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this);
- childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,FALSE));
- childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this));
+ childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this);
+ childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,FALSE));
+ childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this));
- initMenu();
+ initMenu();
- mSyntaxIDConnection = LLSyntaxIdLSL::getInstance()->addSyntaxIDCallback(boost::bind(&LLScriptEdCore::processKeywords, this));
+ mSyntaxIDConnection = LLSyntaxIdLSL::getInstance()->addSyntaxIDCallback(boost::bind(&LLScriptEdCore::processKeywords, this));
- // Intialise keyword highlighting for the current simulator's version of LSL
- LLSyntaxIdLSL::getInstance()->initialize();
- processKeywords();
+ // Intialise keyword highlighting for the current simulator's version of LSL
+ LLSyntaxIdLSL::getInstance()->initialize();
+ processKeywords();
mCommitCallbackRegistrar.add("FontSize.Set", boost::bind(&LLScriptEdCore::onChangeFontSize, this, _2));
mEnableCallbackRegistrar.add("FontSize.Check", boost::bind(&LLScriptEdCore::isFontSizeChecked, this, _2));
@@ -502,182 +502,182 @@ BOOL LLScriptEdCore::postBuild()
"menu_lsl_font_size.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
getChild<LLMenuButton>("font_btn")->setMenu(context_menu, LLMenuButton::MP_BOTTOM_LEFT, true);
- return TRUE;
+ return TRUE;
}
void LLScriptEdCore::processKeywords()
{
- LL_DEBUGS("SyntaxLSL") << "Processing keywords" << LL_ENDL;
- mEditor->clearSegments();
- mEditor->initKeywords();
- mEditor->loadKeywords();
-
- string_vec_t primary_keywords;
- string_vec_t secondary_keywords;
- LLKeywordToken *token;
- LLKeywords::keyword_iterator_t token_it;
- for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it)
- {
- token = token_it->second;
- if (token->getType() == LLKeywordToken::TT_FUNCTION)
- {
- primary_keywords.push_back( wstring_to_utf8str(token->getToken()) );
- }
- else
- {
- secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) );
- }
- }
- for (string_vec_t::const_iterator iter = primary_keywords.begin();
- iter!= primary_keywords.end(); ++iter)
- {
- mFunctions->add(*iter);
- }
- for (string_vec_t::const_iterator iter = secondary_keywords.begin();
- iter!= secondary_keywords.end(); ++iter)
- {
- mFunctions->add(*iter);
- }
+ LL_DEBUGS("SyntaxLSL") << "Processing keywords" << LL_ENDL;
+ mEditor->clearSegments();
+ mEditor->initKeywords();
+ mEditor->loadKeywords();
+
+ string_vec_t primary_keywords;
+ string_vec_t secondary_keywords;
+ LLKeywordToken *token;
+ LLKeywords::keyword_iterator_t token_it;
+ for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it)
+ {
+ token = token_it->second;
+ if (token->getType() == LLKeywordToken::TT_FUNCTION)
+ {
+ primary_keywords.push_back( wstring_to_utf8str(token->getToken()) );
+ }
+ else
+ {
+ secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) );
+ }
+ }
+ for (string_vec_t::const_iterator iter = primary_keywords.begin();
+ iter!= primary_keywords.end(); ++iter)
+ {
+ mFunctions->add(*iter);
+ }
+ for (string_vec_t::const_iterator iter = secondary_keywords.begin();
+ iter!= secondary_keywords.end(); ++iter)
+ {
+ mFunctions->add(*iter);
+ }
}
void LLScriptEdCore::initMenu()
{
- // *TODO: Skinning - make these callbacks data driven
- LLMenuItemCallGL* menuItem;
-
- menuItem = getChild<LLMenuItemCallGL>("Save");
- menuItem->setClickCallback(boost::bind(&LLScriptEdCore::doSave, this, FALSE));
- menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::hasChanged, this));
-
- menuItem = getChild<LLMenuItemCallGL>("Revert All Changes");
- menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnUndoChanges, this));
- menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::hasChanged, this));
+ // *TODO: Skinning - make these callbacks data driven
+ LLMenuItemCallGL* menuItem;
+
+ menuItem = getChild<LLMenuItemCallGL>("Save");
+ menuItem->setClickCallback(boost::bind(&LLScriptEdCore::doSave, this, FALSE));
+ menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::hasChanged, this));
- menuItem = getChild<LLMenuItemCallGL>("Undo");
- menuItem->setClickCallback(boost::bind(&LLTextEditor::undo, mEditor));
- menuItem->setEnableCallback(boost::bind(&LLTextEditor::canUndo, mEditor));
+ menuItem = getChild<LLMenuItemCallGL>("Revert All Changes");
+ menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnUndoChanges, this));
+ menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::hasChanged, this));
- menuItem = getChild<LLMenuItemCallGL>("Redo");
- menuItem->setClickCallback(boost::bind(&LLTextEditor::redo, mEditor));
- menuItem->setEnableCallback(boost::bind(&LLTextEditor::canRedo, mEditor));
+ menuItem = getChild<LLMenuItemCallGL>("Undo");
+ menuItem->setClickCallback(boost::bind(&LLTextEditor::undo, mEditor));
+ menuItem->setEnableCallback(boost::bind(&LLTextEditor::canUndo, mEditor));
- menuItem = getChild<LLMenuItemCallGL>("Cut");
- menuItem->setClickCallback(boost::bind(&LLTextEditor::cut, mEditor));
- menuItem->setEnableCallback(boost::bind(&LLTextEditor::canCut, mEditor));
+ menuItem = getChild<LLMenuItemCallGL>("Redo");
+ menuItem->setClickCallback(boost::bind(&LLTextEditor::redo, mEditor));
+ menuItem->setEnableCallback(boost::bind(&LLTextEditor::canRedo, mEditor));
- menuItem = getChild<LLMenuItemCallGL>("Copy");
- menuItem->setClickCallback(boost::bind(&LLTextEditor::copy, mEditor));
- menuItem->setEnableCallback(boost::bind(&LLTextEditor::canCopy, mEditor));
+ menuItem = getChild<LLMenuItemCallGL>("Cut");
+ menuItem->setClickCallback(boost::bind(&LLTextEditor::cut, mEditor));
+ menuItem->setEnableCallback(boost::bind(&LLTextEditor::canCut, mEditor));
- menuItem = getChild<LLMenuItemCallGL>("Paste");
- menuItem->setClickCallback(boost::bind(&LLTextEditor::paste, mEditor));
- menuItem->setEnableCallback(boost::bind(&LLTextEditor::canPaste, mEditor));
+ menuItem = getChild<LLMenuItemCallGL>("Copy");
+ menuItem->setClickCallback(boost::bind(&LLTextEditor::copy, mEditor));
+ menuItem->setEnableCallback(boost::bind(&LLTextEditor::canCopy, mEditor));
- menuItem = getChild<LLMenuItemCallGL>("Select All");
- menuItem->setClickCallback(boost::bind(&LLTextEditor::selectAll, mEditor));
- menuItem->setEnableCallback(boost::bind(&LLTextEditor::canSelectAll, mEditor));
+ menuItem = getChild<LLMenuItemCallGL>("Paste");
+ menuItem->setClickCallback(boost::bind(&LLTextEditor::paste, mEditor));
+ menuItem->setEnableCallback(boost::bind(&LLTextEditor::canPaste, mEditor));
- menuItem = getChild<LLMenuItemCallGL>("Deselect");
- menuItem->setClickCallback(boost::bind(&LLTextEditor::deselect, mEditor));
- menuItem->setEnableCallback(boost::bind(&LLTextEditor::canDeselect, mEditor));
+ menuItem = getChild<LLMenuItemCallGL>("Select All");
+ menuItem->setClickCallback(boost::bind(&LLTextEditor::selectAll, mEditor));
+ menuItem->setEnableCallback(boost::bind(&LLTextEditor::canSelectAll, mEditor));
- menuItem = getChild<LLMenuItemCallGL>("Search / Replace...");
- menuItem->setClickCallback(boost::bind(&LLFloaterScriptSearch::show, this));
+ menuItem = getChild<LLMenuItemCallGL>("Deselect");
+ menuItem->setClickCallback(boost::bind(&LLTextEditor::deselect, mEditor));
+ menuItem->setEnableCallback(boost::bind(&LLTextEditor::canDeselect, mEditor));
- menuItem = getChild<LLMenuItemCallGL>("Go to line...");
- menuItem->setClickCallback(boost::bind(&LLFloaterGotoLine::show, this));
+ menuItem = getChild<LLMenuItemCallGL>("Search / Replace...");
+ menuItem->setClickCallback(boost::bind(&LLFloaterScriptSearch::show, this));
- menuItem = getChild<LLMenuItemCallGL>("Keyword Help...");
- menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnDynamicHelp, this));
+ menuItem = getChild<LLMenuItemCallGL>("Go to line...");
+ menuItem->setClickCallback(boost::bind(&LLFloaterGotoLine::show, this));
- menuItem = getChild<LLMenuItemCallGL>("LoadFromFile");
- menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnLoadFromFile, this));
- menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::enableLoadFromFileMenu, this));
+ menuItem = getChild<LLMenuItemCallGL>("Keyword Help...");
+ menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnDynamicHelp, this));
- menuItem = getChild<LLMenuItemCallGL>("SaveToFile");
- menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnSaveToFile, this));
- menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::enableSaveToFileMenu, this));
+ menuItem = getChild<LLMenuItemCallGL>("LoadFromFile");
+ menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnLoadFromFile, this));
+ menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::enableLoadFromFileMenu, this));
+
+ menuItem = getChild<LLMenuItemCallGL>("SaveToFile");
+ menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnSaveToFile, this));
+ menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::enableSaveToFileMenu, this));
}
void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid)
{
- if (mEditor)
- {
- mEditor->setText(text);
- mHasScriptData = is_valid;
- }
+ if (mEditor)
+ {
+ mEditor->setText(text);
+ mHasScriptData = is_valid;
+ }
}
void LLScriptEdCore::makeEditorPristine()
{
- if (mEditor)
- {
- mEditor->makePristine();
- }
+ if (mEditor)
+ {
+ mEditor->makePristine();
+ }
}
bool LLScriptEdCore::loadScriptText(const std::string& filename)
{
- if (filename.empty())
- {
- LL_WARNS() << "Empty file name" << LL_ENDL;
- return false;
- }
-
- LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/
- if (!file)
- {
- LL_WARNS() << "Error opening " << filename << LL_ENDL;
- return false;
- }
-
- // read in the whole file
- fseek(file, 0L, SEEK_END);
- size_t file_length = (size_t) ftell(file);
- fseek(file, 0L, SEEK_SET);
- char* buffer = new char[file_length+1];
- size_t nread = fread(buffer, 1, file_length, file);
- if (nread < file_length)
- {
- LL_WARNS() << "Short read" << LL_ENDL;
- }
- buffer[nread] = '\0';
- fclose(file);
+ if (filename.empty())
+ {
+ LL_WARNS() << "Empty file name" << LL_ENDL;
+ return false;
+ }
+
+ LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/
+ if (!file)
+ {
+ LL_WARNS() << "Error opening " << filename << LL_ENDL;
+ return false;
+ }
+
+ // read in the whole file
+ fseek(file, 0L, SEEK_END);
+ size_t file_length = (size_t) ftell(file);
+ fseek(file, 0L, SEEK_SET);
+ char* buffer = new char[file_length+1];
+ size_t nread = fread(buffer, 1, file_length, file);
+ if (nread < file_length)
+ {
+ LL_WARNS() << "Short read" << LL_ENDL;
+ }
+ buffer[nread] = '\0';
+ fclose(file);
std::string text = std::string(buffer);
LLStringUtil::replaceTabsWithSpaces(text, LLTextEditor::spacesPerTab());
mEditor->setText(text);
- delete[] buffer;
+ delete[] buffer;
- return true;
+ return true;
}
bool LLScriptEdCore::writeToFile(const std::string& filename)
{
- LLFILE* fp = LLFile::fopen(filename, "wb");
- if (!fp)
- {
- LL_WARNS() << "Unable to write to " << filename << LL_ENDL;
+ LLFILE* fp = LLFile::fopen(filename, "wb");
+ if (!fp)
+ {
+ LL_WARNS() << "Unable to write to " << filename << LL_ENDL;
- LLSD row;
- row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?";
- row["columns"][0]["font"] = "SANSSERIF_SMALL";
- mErrorList->addElement(row);
- return false;
- }
+ LLSD row;
+ row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?";
+ row["columns"][0]["font"] = "SANSSERIF_SMALL";
+ mErrorList->addElement(row);
+ return false;
+ }
- std::string utf8text = mEditor->getText();
+ std::string utf8text = mEditor->getText();
- // Special case for a completely empty script - stuff in one space so it can store properly. See SL-46889
- if (utf8text.size() == 0)
- {
- utf8text = " ";
- }
+ // Special case for a completely empty script - stuff in one space so it can store properly. See SL-46889
+ if (utf8text.size() == 0)
+ {
+ utf8text = " ";
+ }
- fputs(utf8text.c_str(), fp);
- fclose(fp);
- return true;
+ fputs(utf8text.c_str(), fp);
+ fclose(fp);
+ return true;
}
void LLScriptEdCore::sync()
@@ -697,393 +697,393 @@ void LLScriptEdCore::sync()
bool LLScriptEdCore::hasChanged()
{
- if (!mEditor) return false;
+ if (!mEditor) return false;
- return ((!mEditor->isPristine() || mEnableSave) && mHasScriptData);
+ return ((!mEditor->isPristine() || mEnableSave) && mHasScriptData);
}
void LLScriptEdCore::draw()
{
- BOOL script_changed = hasChanged();
- getChildView("Save_btn")->setEnabled(script_changed && !mScriptRemoved);
+ BOOL script_changed = hasChanged();
+ getChildView("Save_btn")->setEnabled(script_changed && !mScriptRemoved);
- if( mEditor->hasFocus() )
- {
- S32 line = 0;
- S32 column = 0;
- mEditor->getCurrentLineAndColumn( &line, &column, FALSE ); // don't include wordwrap
- LLStringUtil::format_map_t args;
- std::string cursor_pos;
- args["[LINE]"] = llformat ("%d", line);
- args["[COLUMN]"] = llformat ("%d", column);
- cursor_pos = LLTrans::getString("CursorPos", args);
- getChild<LLUICtrl>("line_col")->setValue(cursor_pos);
- }
- else
- {
- getChild<LLUICtrl>("line_col")->setValue(LLStringUtil::null);
- }
+ if( mEditor->hasFocus() )
+ {
+ S32 line = 0;
+ S32 column = 0;
+ mEditor->getCurrentLineAndColumn( &line, &column, FALSE ); // don't include wordwrap
+ LLStringUtil::format_map_t args;
+ std::string cursor_pos;
+ args["[LINE]"] = llformat ("%d", line);
+ args["[COLUMN]"] = llformat ("%d", column);
+ cursor_pos = LLTrans::getString("CursorPos", args);
+ getChild<LLUICtrl>("line_col")->setValue(cursor_pos);
+ }
+ else
+ {
+ getChild<LLUICtrl>("line_col")->setValue(LLStringUtil::null);
+ }
- updateDynamicHelp();
+ updateDynamicHelp();
- LLPanel::draw();
+ LLPanel::draw();
}
void LLScriptEdCore::updateDynamicHelp(BOOL immediate)
{
- LLFloater* help_floater = mLiveHelpHandle.get();
- if (!help_floater) return;
-
- // update back and forward buttons
- LLButton* fwd_button = help_floater->getChild<LLButton>("fwd_btn");
- LLButton* back_button = help_floater->getChild<LLButton>("back_btn");
- LLMediaCtrl* browser = help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
- back_button->setEnabled(browser->canNavigateBack());
- fwd_button->setEnabled(browser->canNavigateForward());
-
- if (!immediate && !gSavedSettings.getBOOL("ScriptHelpFollowsCursor"))
- {
- return;
- }
-
- LLTextSegmentPtr segment = NULL;
- std::vector<LLTextSegmentPtr> selected_segments;
- mEditor->getSelectedSegments(selected_segments);
- LLKeywordToken* token;
- // try segments in selection range first
- std::vector<LLTextSegmentPtr>::iterator segment_iter;
- for (segment_iter = selected_segments.begin(); segment_iter != selected_segments.end(); ++segment_iter)
- {
- token = (*segment_iter)->getToken();
- if(token && isKeyword(token))
- {
- segment = *segment_iter;
- break;
- }
- }
-
- // then try previous segment in case we just typed it
- if (!segment)
- {
- const LLTextSegmentPtr test_segment = mEditor->getPreviousSegment();
- token = test_segment->getToken();
- if(token && isKeyword(token))
- {
- segment = test_segment;
- }
- }
-
- if (segment)
- {
- if (segment->getToken() != mLastHelpToken)
- {
- mLastHelpToken = segment->getToken();
- mLiveHelpTimer.start();
- }
- if (immediate || (mLiveHelpTimer.getStarted() && mLiveHelpTimer.getElapsedTimeF32() > LIVE_HELP_REFRESH_TIME))
- {
- // Use Wtext since segment's start/end are made for wstring and will
- // result in a shift for case of multi-byte symbols inside std::string.
- LLWString segment_text = mEditor->getWText().substr(segment->getStart(), segment->getEnd() - segment->getStart());
- std::string help_string = wstring_to_utf8str(segment_text);
- setHelpPage(help_string);
- mLiveHelpTimer.stop();
- }
- }
- else
- {
- if (immediate)
- {
- setHelpPage(LLStringUtil::null);
- }
- }
+ LLFloater* help_floater = mLiveHelpHandle.get();
+ if (!help_floater) return;
+
+ // update back and forward buttons
+ LLButton* fwd_button = help_floater->getChild<LLButton>("fwd_btn");
+ LLButton* back_button = help_floater->getChild<LLButton>("back_btn");
+ LLMediaCtrl* browser = help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
+ back_button->setEnabled(browser->canNavigateBack());
+ fwd_button->setEnabled(browser->canNavigateForward());
+
+ if (!immediate && !gSavedSettings.getBOOL("ScriptHelpFollowsCursor"))
+ {
+ return;
+ }
+
+ LLTextSegmentPtr segment = NULL;
+ std::vector<LLTextSegmentPtr> selected_segments;
+ mEditor->getSelectedSegments(selected_segments);
+ LLKeywordToken* token;
+ // try segments in selection range first
+ std::vector<LLTextSegmentPtr>::iterator segment_iter;
+ for (segment_iter = selected_segments.begin(); segment_iter != selected_segments.end(); ++segment_iter)
+ {
+ token = (*segment_iter)->getToken();
+ if(token && isKeyword(token))
+ {
+ segment = *segment_iter;
+ break;
+ }
+ }
+
+ // then try previous segment in case we just typed it
+ if (!segment)
+ {
+ const LLTextSegmentPtr test_segment = mEditor->getPreviousSegment();
+ token = test_segment->getToken();
+ if(token && isKeyword(token))
+ {
+ segment = test_segment;
+ }
+ }
+
+ if (segment)
+ {
+ if (segment->getToken() != mLastHelpToken)
+ {
+ mLastHelpToken = segment->getToken();
+ mLiveHelpTimer.start();
+ }
+ if (immediate || (mLiveHelpTimer.getStarted() && mLiveHelpTimer.getElapsedTimeF32() > LIVE_HELP_REFRESH_TIME))
+ {
+ // Use Wtext since segment's start/end are made for wstring and will
+ // result in a shift for case of multi-byte symbols inside std::string.
+ LLWString segment_text = mEditor->getWText().substr(segment->getStart(), segment->getEnd() - segment->getStart());
+ std::string help_string = wstring_to_utf8str(segment_text);
+ setHelpPage(help_string);
+ mLiveHelpTimer.stop();
+ }
+ }
+ else
+ {
+ if (immediate)
+ {
+ setHelpPage(LLStringUtil::null);
+ }
+ }
}
bool LLScriptEdCore::isKeyword(LLKeywordToken* token)
{
- switch(token->getType())
- {
- case LLKeywordToken::TT_CONSTANT:
- case LLKeywordToken::TT_CONTROL:
- case LLKeywordToken::TT_EVENT:
- case LLKeywordToken::TT_FUNCTION:
- case LLKeywordToken::TT_SECTION:
- case LLKeywordToken::TT_TYPE:
- case LLKeywordToken::TT_WORD:
- return true;
-
- default:
- return false;
- }
+ switch(token->getType())
+ {
+ case LLKeywordToken::TT_CONSTANT:
+ case LLKeywordToken::TT_CONTROL:
+ case LLKeywordToken::TT_EVENT:
+ case LLKeywordToken::TT_FUNCTION:
+ case LLKeywordToken::TT_SECTION:
+ case LLKeywordToken::TT_TYPE:
+ case LLKeywordToken::TT_WORD:
+ return true;
+
+ default:
+ return false;
+ }
}
void LLScriptEdCore::setHelpPage(const std::string& help_string)
{
- LLFloater* help_floater = mLiveHelpHandle.get();
- if (!help_floater) return;
-
- LLMediaCtrl* web_browser = help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
- if (!web_browser) return;
+ LLFloater* help_floater = mLiveHelpHandle.get();
+ if (!help_floater) return;
- LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo");
- if (!history_combo) return;
+ LLMediaCtrl* web_browser = help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
+ if (!web_browser) return;
- LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
+ LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo");
+ if (!history_combo) return;
- url_string.setArg("[LSL_STRING]", help_string.empty() ? HELP_LSL_PORTAL_TOPIC : help_string);
+ LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
- addHelpItemToHistory(help_string);
+ url_string.setArg("[LSL_STRING]", help_string.empty() ? HELP_LSL_PORTAL_TOPIC : help_string);
- web_browser->navigateTo(url_string);
+ addHelpItemToHistory(help_string);
+
+ web_browser->navigateTo(url_string);
}
void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string)
{
- if (help_string.empty()) return;
-
- LLFloater* help_floater = mLiveHelpHandle.get();
- if (!help_floater) return;
-
- LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo");
- if (!history_combo) return;
-
- // separate history items from full item list
- if (mLiveHelpHistorySize == 0)
- {
- history_combo->addSeparator(ADD_TOP);
- }
- // delete all history items over history limit
- while(mLiveHelpHistorySize > MAX_HISTORY_COUNT - 1)
- {
- history_combo->remove(mLiveHelpHistorySize - 1);
- mLiveHelpHistorySize--;
- }
-
- history_combo->setSimple(help_string);
- S32 index = history_combo->getCurrentIndex();
-
- // if help string exists in the combo box
- if (index >= 0)
- {
- S32 cur_index = history_combo->getCurrentIndex();
- if (cur_index < mLiveHelpHistorySize)
- {
- // item found in history, bubble up to top
- history_combo->remove(history_combo->getCurrentIndex());
- mLiveHelpHistorySize--;
- }
- }
- history_combo->add(help_string, LLSD(help_string), ADD_TOP);
- history_combo->selectFirstItem();
- mLiveHelpHistorySize++;
+ if (help_string.empty()) return;
+
+ LLFloater* help_floater = mLiveHelpHandle.get();
+ if (!help_floater) return;
+
+ LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo");
+ if (!history_combo) return;
+
+ // separate history items from full item list
+ if (mLiveHelpHistorySize == 0)
+ {
+ history_combo->addSeparator(ADD_TOP);
+ }
+ // delete all history items over history limit
+ while(mLiveHelpHistorySize > MAX_HISTORY_COUNT - 1)
+ {
+ history_combo->remove(mLiveHelpHistorySize - 1);
+ mLiveHelpHistorySize--;
+ }
+
+ history_combo->setSimple(help_string);
+ S32 index = history_combo->getCurrentIndex();
+
+ // if help string exists in the combo box
+ if (index >= 0)
+ {
+ S32 cur_index = history_combo->getCurrentIndex();
+ if (cur_index < mLiveHelpHistorySize)
+ {
+ // item found in history, bubble up to top
+ history_combo->remove(history_combo->getCurrentIndex());
+ mLiveHelpHistorySize--;
+ }
+ }
+ history_combo->add(help_string, LLSD(help_string), ADD_TOP);
+ history_combo->selectFirstItem();
+ mLiveHelpHistorySize++;
}
BOOL LLScriptEdCore::canClose()
{
- if(mForceClose || !hasChanged() || mScriptRemoved)
- {
- return TRUE;
- }
- else
- {
- if(!mSaveDialogShown)
- {
- mSaveDialogShown = TRUE;
- // Bring up view-modal dialog: Save changes? Yes, No, Cancel
- LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleSaveChangesDialog, this, _1, _2));
- }
- return FALSE;
- }
+ if(mForceClose || !hasChanged() || mScriptRemoved)
+ {
+ return TRUE;
+ }
+ else
+ {
+ if(!mSaveDialogShown)
+ {
+ mSaveDialogShown = TRUE;
+ // Bring up view-modal dialog: Save changes? Yes, No, Cancel
+ LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleSaveChangesDialog, this, _1, _2));
+ }
+ return FALSE;
+ }
}
void LLScriptEdCore::setEnableEditing(bool enable)
{
- mEditor->setEnabled(enable);
- getChildView("Edit_btn")->setEnabled(enable);
+ mEditor->setEnabled(enable);
+ getChildView("Edit_btn")->setEnabled(enable);
}
bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLSD& response )
{
- mSaveDialogShown = FALSE;
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch( option )
- {
- case 0: // "Yes"
- // close after saving
- doSave( TRUE );
- break;
-
- case 1: // "No"
- mForceClose = TRUE;
- // This will close immediately because mForceClose is true, so we won't
- // infinite loop with these dialogs. JC
- ((LLFloater*) getParent())->closeFloater();
- break;
-
- case 2: // "Cancel"
- default:
- // If we were quitting, we didn't really mean it.
- LLAppViewer::instance()->abortQuit();
- break;
- }
- return false;
+ mSaveDialogShown = FALSE;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch( option )
+ {
+ case 0: // "Yes"
+ // close after saving
+ doSave( TRUE );
+ break;
+
+ case 1: // "No"
+ mForceClose = TRUE;
+ // This will close immediately because mForceClose is true, so we won't
+ // infinite loop with these dialogs. JC
+ ((LLFloater*) getParent())->closeFloater();
+ break;
+
+ case 2: // "Cancel"
+ default:
+ // If we were quitting, we didn't really mean it.
+ LLAppViewer::instance()->abortQuit();
+ break;
+ }
+ return false;
}
void LLScriptEdCore::onBtnDynamicHelp()
{
- LLFloater* live_help_floater = mLiveHelpHandle.get();
- if (!live_help_floater)
- {
- live_help_floater = new LLFloater(LLSD());
- live_help_floater->buildFromFile("floater_lsl_guide.xml");
- LLFloater* parent = dynamic_cast<LLFloater*>(getParent());
- llassert(parent);
- if (parent)
- parent->addDependentFloater(live_help_floater, TRUE);
- live_help_floater->childSetCommitCallback("lock_check", onCheckLock, this);
- live_help_floater->getChild<LLUICtrl>("lock_check")->setValue(gSavedSettings.getBOOL("ScriptHelpFollowsCursor"));
- live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, this);
- live_help_floater->childSetAction("back_btn", onClickBack, this);
- live_help_floater->childSetAction("fwd_btn", onClickForward, this);
-
- LLMediaCtrl* browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
- browser->setAlwaysRefresh(TRUE);
-
- LLComboBox* help_combo = live_help_floater->getChild<LLComboBox>("history_combo");
- LLKeywordToken *token;
- LLKeywords::keyword_iterator_t token_it;
- for (token_it = mEditor->keywordsBegin();
- token_it != mEditor->keywordsEnd();
- ++token_it)
- {
- token = token_it->second;
- help_combo->add(wstring_to_utf8str(token->getToken()));
- }
- help_combo->sortByName();
-
- // re-initialize help variables
- mLastHelpToken = NULL;
- mLiveHelpHandle = live_help_floater->getHandle();
- mLiveHelpHistorySize = 0;
- }
-
- BOOL visible = TRUE;
- BOOL take_focus = TRUE;
- live_help_floater->setVisible(visible);
- live_help_floater->setFrontmost(take_focus);
-
- updateDynamicHelp(TRUE);
-}
-
-//static
+ LLFloater* live_help_floater = mLiveHelpHandle.get();
+ if (!live_help_floater)
+ {
+ live_help_floater = new LLFloater(LLSD());
+ live_help_floater->buildFromFile("floater_lsl_guide.xml");
+ LLFloater* parent = dynamic_cast<LLFloater*>(getParent());
+ llassert(parent);
+ if (parent)
+ parent->addDependentFloater(live_help_floater, TRUE);
+ live_help_floater->childSetCommitCallback("lock_check", onCheckLock, this);
+ live_help_floater->getChild<LLUICtrl>("lock_check")->setValue(gSavedSettings.getBOOL("ScriptHelpFollowsCursor"));
+ live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, this);
+ live_help_floater->childSetAction("back_btn", onClickBack, this);
+ live_help_floater->childSetAction("fwd_btn", onClickForward, this);
+
+ LLMediaCtrl* browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
+ browser->setAlwaysRefresh(TRUE);
+
+ LLComboBox* help_combo = live_help_floater->getChild<LLComboBox>("history_combo");
+ LLKeywordToken *token;
+ LLKeywords::keyword_iterator_t token_it;
+ for (token_it = mEditor->keywordsBegin();
+ token_it != mEditor->keywordsEnd();
+ ++token_it)
+ {
+ token = token_it->second;
+ help_combo->add(wstring_to_utf8str(token->getToken()));
+ }
+ help_combo->sortByName();
+
+ // re-initialize help variables
+ mLastHelpToken = NULL;
+ mLiveHelpHandle = live_help_floater->getHandle();
+ mLiveHelpHistorySize = 0;
+ }
+
+ BOOL visible = TRUE;
+ BOOL take_focus = TRUE;
+ live_help_floater->setVisible(visible);
+ live_help_floater->setFrontmost(take_focus);
+
+ updateDynamicHelp(TRUE);
+}
+
+//static
void LLScriptEdCore::onClickBack(void* userdata)
{
- LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
- LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
- if (live_help_floater)
- {
- LLMediaCtrl* browserp = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
- if (browserp)
- {
- browserp->navigateBack();
- }
- }
+ LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
+ LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
+ if (live_help_floater)
+ {
+ LLMediaCtrl* browserp = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
+ if (browserp)
+ {
+ browserp->navigateBack();
+ }
+ }
}
-//static
+//static
void LLScriptEdCore::onClickForward(void* userdata)
{
- LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
- LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
- if (live_help_floater)
- {
- LLMediaCtrl* browserp = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
- if (browserp)
- {
- browserp->navigateForward();
- }
- }
+ LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
+ LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
+ if (live_help_floater)
+ {
+ LLMediaCtrl* browserp = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
+ if (browserp)
+ {
+ browserp->navigateForward();
+ }
+ }
}
// static
void LLScriptEdCore::onCheckLock(LLUICtrl* ctrl, void* userdata)
{
- LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
+ LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
- // clear out token any time we lock the frame, so we will refresh web page immediately when unlocked
- gSavedSettings.setBOOL("ScriptHelpFollowsCursor", ctrl->getValue().asBoolean());
+ // clear out token any time we lock the frame, so we will refresh web page immediately when unlocked
+ gSavedSettings.setBOOL("ScriptHelpFollowsCursor", ctrl->getValue().asBoolean());
- corep->mLastHelpToken = NULL;
+ corep->mLastHelpToken = NULL;
}
-// static
+// static
void LLScriptEdCore::onBtnInsertSample(void* userdata)
{
- LLScriptEdCore* self = (LLScriptEdCore*) userdata;
+ LLScriptEdCore* self = (LLScriptEdCore*) userdata;
- // Insert sample code
- self->mEditor->selectAll();
- self->mEditor->cut();
- self->mEditor->insertText(self->mSampleText);
+ // Insert sample code
+ self->mEditor->selectAll();
+ self->mEditor->cut();
+ self->mEditor->insertText(self->mSampleText);
}
-// static
+// static
void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata)
{
- LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
+ LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
- LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
- if (live_help_floater)
- {
- std::string help_string = ctrl->getValue().asString();
+ LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
+ if (live_help_floater)
+ {
+ std::string help_string = ctrl->getValue().asString();
- corep->addHelpItemToHistory(help_string);
+ corep->addHelpItemToHistory(help_string);
- LLMediaCtrl* web_browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
- LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
- url_string.setArg("[LSL_STRING]", help_string);
- web_browser->navigateTo(url_string);
- }
+ LLMediaCtrl* web_browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html");
+ LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
+ url_string.setArg("[LSL_STRING]", help_string);
+ web_browser->navigateTo(url_string);
+ }
}
-// static
+// static
void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata)
{
- LLScriptEdCore* self = (LLScriptEdCore*) userdata;
+ LLScriptEdCore* self = (LLScriptEdCore*) userdata;
- // Insert sample code
- if(self->mEditor->getEnabled())
- {
- self->mEditor->insertText(self->mFunctions->getSimple());
- }
- self->mEditor->setFocus(TRUE);
- self->setHelpPage(self->mFunctions->getSimple());
+ // Insert sample code
+ if(self->mEditor->getEnabled())
+ {
+ self->mEditor->insertText(self->mFunctions->getSimple());
+ }
+ self->mEditor->setFocus(TRUE);
+ self->setHelpPage(self->mFunctions->getSimple());
}
void LLScriptEdCore::doSave( BOOL close_after_save )
{
- add(LLStatViewer::LSL_SAVES, 1);
+ add(LLStatViewer::LSL_SAVES, 1);
- if( mSaveCallback )
- {
- mSaveCallback( mUserdata, close_after_save );
- }
+ if( mSaveCallback )
+ {
+ mSaveCallback( mUserdata, close_after_save );
+ }
}
void LLScriptEdCore::openInExternalEditor()
{
- delete mLiveFile; // deletes file
+ delete mLiveFile; // deletes file
- // Generate a suitable filename
+ // Generate a suitable filename
std::string script_name = mScriptName;
std::string forbidden_chars = "<>:\"\\/|?*";
for (std::string::iterator c = forbidden_chars.begin(); c != forbidden_chars.end(); c++)
{
script_name.erase(std::remove(script_name.begin(), script_name.end(), *c), script_name.end());
}
- std::string filename = mContainer->getTmpFileName(script_name);
+ std::string filename = mContainer->getTmpFileName(script_name);
// Save the script to a temporary file.
if (!writeToFile(filename))
@@ -1096,238 +1096,238 @@ void LLScriptEdCore::openInExternalEditor()
writeToFile(filename);
}
- // Start watching file changes.
- mLiveFile = new LLLiveLSLFile(filename, boost::bind(&LLScriptEdContainer::onExternalChange, mContainer, _1));
- mLiveFile->addToEventTimer();
-
- // Open it in external editor.
- {
- LLExternalEditor ed;
- LLExternalEditor::EErrorCode status;
- std::string msg;
-
- status = ed.setCommand("LL_SCRIPT_EDITOR");
- if (status != LLExternalEditor::EC_SUCCESS)
- {
- if (status == LLExternalEditor::EC_NOT_SPECIFIED) // Use custom message for this error.
- {
- msg = LLTrans::getString("ExternalEditorNotSet");
- }
- else
- {
- msg = LLExternalEditor::getErrorMessage(status);
- }
-
- LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg));
- return;
- }
-
- status = ed.run(filename);
- if (status != LLExternalEditor::EC_SUCCESS)
- {
- msg = LLExternalEditor::getErrorMessage(status);
- LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg));
- }
- }
+ // Start watching file changes.
+ mLiveFile = new LLLiveLSLFile(filename, boost::bind(&LLScriptEdContainer::onExternalChange, mContainer, _1));
+ mLiveFile->addToEventTimer();
+
+ // Open it in external editor.
+ {
+ LLExternalEditor ed;
+ LLExternalEditor::EErrorCode status;
+ std::string msg;
+
+ status = ed.setCommand("LL_SCRIPT_EDITOR");
+ if (status != LLExternalEditor::EC_SUCCESS)
+ {
+ if (status == LLExternalEditor::EC_NOT_SPECIFIED) // Use custom message for this error.
+ {
+ msg = LLTrans::getString("ExternalEditorNotSet");
+ }
+ else
+ {
+ msg = LLExternalEditor::getErrorMessage(status);
+ }
+
+ LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg));
+ return;
+ }
+
+ status = ed.run(filename);
+ if (status != LLExternalEditor::EC_SUCCESS)
+ {
+ msg = LLExternalEditor::getErrorMessage(status);
+ LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg));
+ }
+ }
}
void LLScriptEdCore::onBtnUndoChanges()
{
- if( !mEditor->tryToRevertToPristineState() )
- {
- LLNotificationsUtil::add("ScriptCannotUndo", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleReloadFromServerDialog, this, _1, _2));
- }
+ if( !mEditor->tryToRevertToPristineState() )
+ {
+ LLNotificationsUtil::add("ScriptCannotUndo", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleReloadFromServerDialog, this, _1, _2));
+ }
}
// static
void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data)
{
- LLScriptEdCore* self = (LLScriptEdCore*)user_data;
- LLScrollListItem* item = self->mErrorList->getFirstSelected();
- if(item)
- {
- // *FIX: replace with boost grep
- S32 row = 0;
- S32 column = 0;
- const LLScrollListCell* cell = item->getColumn(0);
- std::string line(cell->getValue().asString());
- line.erase(0, 1);
- LLStringUtil::replaceChar(line, ',',' ');
- LLStringUtil::replaceChar(line, ')',' ');
- sscanf(line.c_str(), "%d %d", &row, &column);
- //LL_INFOS() << "LLScriptEdCore::onErrorList() - " << row << ", "
- //<< column << LL_ENDL;
- self->mEditor->setCursor(row, column);
- self->mEditor->setFocus(TRUE);
- }
+ LLScriptEdCore* self = (LLScriptEdCore*)user_data;
+ LLScrollListItem* item = self->mErrorList->getFirstSelected();
+ if(item)
+ {
+ // *FIX: replace with boost grep
+ S32 row = 0;
+ S32 column = 0;
+ const LLScrollListCell* cell = item->getColumn(0);
+ std::string line(cell->getValue().asString());
+ line.erase(0, 1);
+ LLStringUtil::replaceChar(line, ',',' ');
+ LLStringUtil::replaceChar(line, ')',' ');
+ sscanf(line.c_str(), "%d %d", &row, &column);
+ //LL_INFOS() << "LLScriptEdCore::onErrorList() - " << row << ", "
+ //<< column << LL_ENDL;
+ self->mEditor->setCursor(row, column);
+ self->mEditor->setFocus(TRUE);
+ }
}
bool LLScriptEdCore::handleReloadFromServerDialog(const LLSD& notification, const LLSD& response )
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch( option )
- {
- case 0: // "Yes"
- if( mLoadCallback )
- {
- setScriptText(getString("loading"), FALSE);
- mLoadCallback(mUserdata);
- }
- break;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch( option )
+ {
+ case 0: // "Yes"
+ if( mLoadCallback )
+ {
+ setScriptText(getString("loading"), FALSE);
+ mLoadCallback(mUserdata);
+ }
+ break;
- case 1: // "No"
- break;
+ case 1: // "No"
+ break;
- default:
- llassert(0);
- break;
- }
- return false;
+ default:
+ llassert(0);
+ break;
+ }
+ return false;
}
void LLScriptEdCore::selectFirstError()
{
- // Select the first item;
- mErrorList->selectFirstItem();
- onErrorList(mErrorList, this);
+ // Select the first item;
+ mErrorList->selectFirstItem();
+ onErrorList(mErrorList, this);
}
struct LLEntryAndEdCore
{
- LLScriptEdCore* mCore;
- LLEntryAndEdCore(LLScriptEdCore* core) :
- mCore(core)
- {}
+ LLScriptEdCore* mCore;
+ LLEntryAndEdCore(LLScriptEdCore* core) :
+ mCore(core)
+ {}
};
void LLScriptEdCore::deleteBridges()
{
- S32 count = mBridges.size();
- LLEntryAndEdCore* eandc;
- for(S32 i = 0; i < count; i++)
- {
- eandc = mBridges.at(i);
- delete eandc;
- mBridges[i] = NULL;
- }
- mBridges.clear();
+ S32 count = mBridges.size();
+ LLEntryAndEdCore* eandc;
+ for(S32 i = 0; i < count; i++)
+ {
+ eandc = mBridges.at(i);
+ delete eandc;
+ mBridges[i] = NULL;
+ }
+ mBridges.clear();
}
// virtual
BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask)
{
- bool just_control = MASK_CONTROL == (mask & MASK_MODIFIERS);
+ bool just_control = MASK_CONTROL == (mask & MASK_MODIFIERS);
- if(('S' == key) && just_control)
- {
- if(mSaveCallback)
- {
- // don't close after saving
- mSaveCallback(mUserdata, FALSE);
- }
+ if(('S' == key) && just_control)
+ {
+ if(mSaveCallback)
+ {
+ // don't close after saving
+ mSaveCallback(mUserdata, FALSE);
+ }
- return TRUE;
- }
+ return TRUE;
+ }
- if(('F' == key) && just_control)
- {
- if(mSearchReplaceCallback)
- {
- mSearchReplaceCallback(mUserdata);
- }
+ if(('F' == key) && just_control)
+ {
+ if(mSearchReplaceCallback)
+ {
+ mSearchReplaceCallback(mUserdata);
+ }
- return TRUE;
- }
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
void LLScriptEdCore::onBtnLoadFromFile( void* data )
{
- LLFilePickerReplyThread::startPicker(boost::bind(&LLScriptEdCore::loadScriptFromFile, _1, data), LLFilePicker::FFLOAD_SCRIPT, false);
+ LLFilePickerReplyThread::startPicker(boost::bind(&LLScriptEdCore::loadScriptFromFile, _1, data), LLFilePicker::FFLOAD_SCRIPT, false);
}
void LLScriptEdCore::loadScriptFromFile(const std::vector<std::string>& filenames, void* data)
{
- std::string filename = filenames[0];
-
- llifstream fin(filename.c_str());
-
- std::string line;
- std::string text;
- std::string linetotal;
- while (!fin.eof())
- {
- getline(fin, line);
- text += line;
- if (!fin.eof())
- {
- text += "\n";
- }
- }
- fin.close();
-
- // Only replace the script if there is something to replace with.
- LLScriptEdCore* self = (LLScriptEdCore*)data;
- if (self && (text.length() > 0))
- {
- self->mEditor->selectAll();
- LLWString script(utf8str_to_wstring(text));
- self->mEditor->insertText(script);
- }
+ std::string filename = filenames[0];
+
+ llifstream fin(filename.c_str());
+
+ std::string line;
+ std::string text;
+ std::string linetotal;
+ while (!fin.eof())
+ {
+ getline(fin, line);
+ text += line;
+ if (!fin.eof())
+ {
+ text += "\n";
+ }
+ }
+ fin.close();
+
+ // Only replace the script if there is something to replace with.
+ LLScriptEdCore* self = (LLScriptEdCore*)data;
+ if (self && (text.length() > 0))
+ {
+ self->mEditor->selectAll();
+ LLWString script(utf8str_to_wstring(text));
+ self->mEditor->insertText(script);
+ }
}
void LLScriptEdCore::onBtnSaveToFile( void* userdata )
{
- add(LLStatViewer::LSL_SAVES, 1);
+ add(LLStatViewer::LSL_SAVES, 1);
- LLScriptEdCore* self = (LLScriptEdCore*) userdata;
+ LLScriptEdCore* self = (LLScriptEdCore*) userdata;
- if( self->mSaveCallback )
- {
- LLFilePickerReplyThread::startPicker(boost::bind(&LLScriptEdCore::saveScriptToFile, _1, userdata), LLFilePicker::FFSAVE_SCRIPT, self->mScriptName);
- }
+ if( self->mSaveCallback )
+ {
+ LLFilePickerReplyThread::startPicker(boost::bind(&LLScriptEdCore::saveScriptToFile, _1, userdata), LLFilePicker::FFSAVE_SCRIPT, self->mScriptName);
+ }
}
void LLScriptEdCore::saveScriptToFile(const std::vector<std::string>& filenames, void* data)
{
- LLScriptEdCore* self = (LLScriptEdCore*)data;
- if (self)
- {
- std::string filename = filenames[0];
- std::string scriptText = self->mEditor->getText();
- llofstream fout(filename.c_str());
- fout << (scriptText);
- fout.close();
- self->mSaveCallback(self->mUserdata, FALSE);
- }
+ LLScriptEdCore* self = (LLScriptEdCore*)data;
+ if (self)
+ {
+ std::string filename = filenames[0];
+ std::string scriptText = self->mEditor->getText();
+ llofstream fout(filename.c_str());
+ fout << (scriptText);
+ fout.close();
+ self->mSaveCallback(self->mUserdata, FALSE);
+ }
}
bool LLScriptEdCore::canLoadOrSaveToFile( void* userdata )
{
- LLScriptEdCore* self = (LLScriptEdCore*) userdata;
- return self->mEditor->canLoadOrSaveToFile();
+ LLScriptEdCore* self = (LLScriptEdCore*) userdata;
+ return self->mEditor->canLoadOrSaveToFile();
}
// static
bool LLScriptEdCore::enableSaveToFileMenu(void* userdata)
{
- LLScriptEdCore* self = (LLScriptEdCore*)userdata;
- if (!self || !self->mEditor) return FALSE;
- return self->mEditor->canLoadOrSaveToFile();
+ LLScriptEdCore* self = (LLScriptEdCore*)userdata;
+ if (!self || !self->mEditor) return FALSE;
+ return self->mEditor->canLoadOrSaveToFile();
}
-// static
+// static
bool LLScriptEdCore::enableLoadFromFileMenu(void* userdata)
{
- LLScriptEdCore* self = (LLScriptEdCore*)userdata;
- return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : FALSE;
+ LLScriptEdCore* self = (LLScriptEdCore*)userdata;
+ return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : FALSE;
}
LLUUID LLScriptEdCore::getAssociatedExperience()const
{
- return mAssociatedExperience;
+ return mAssociatedExperience;
}
void LLScriptEdCore::onChangeFontSize(const LLSD &userdata)
@@ -1346,138 +1346,138 @@ bool LLScriptEdCore::isFontSizeChecked(const LLSD &userdata)
void LLLiveLSLEditor::setExperienceIds( const LLSD& experience_ids )
{
- mExperienceIds=experience_ids;
- updateExperiencePanel();
+ mExperienceIds=experience_ids;
+ updateExperiencePanel();
}
void LLLiveLSLEditor::updateExperiencePanel()
{
- if(mScriptEd->getAssociatedExperience().isNull())
- {
- mExperienceEnabled->set(FALSE);
- mExperiences->setVisible(FALSE);
- if(mExperienceIds.size()>0)
- {
- mExperienceEnabled->setEnabled(TRUE);
- mExperienceEnabled->setToolTip(getString("add_experiences"));
- }
- else
- {
- mExperienceEnabled->setEnabled(FALSE);
- mExperienceEnabled->setToolTip(getString("no_experiences"));
- }
- getChild<LLButton>("view_profile")->setVisible(FALSE);
- }
- else
- {
- mExperienceEnabled->setToolTip(getString("experience_enabled"));
- mExperienceEnabled->setEnabled(getIsModifiable());
- mExperiences->setVisible(TRUE);
- mExperienceEnabled->set(TRUE);
- getChild<LLButton>("view_profile")->setToolTip(getString("show_experience_profile"));
- buildExperienceList();
- }
+ if(mScriptEd->getAssociatedExperience().isNull())
+ {
+ mExperienceEnabled->set(FALSE);
+ mExperiences->setVisible(FALSE);
+ if(mExperienceIds.size()>0)
+ {
+ mExperienceEnabled->setEnabled(TRUE);
+ mExperienceEnabled->setToolTip(getString("add_experiences"));
+ }
+ else
+ {
+ mExperienceEnabled->setEnabled(FALSE);
+ mExperienceEnabled->setToolTip(getString("no_experiences"));
+ }
+ getChild<LLButton>("view_profile")->setVisible(FALSE);
+ }
+ else
+ {
+ mExperienceEnabled->setToolTip(getString("experience_enabled"));
+ mExperienceEnabled->setEnabled(getIsModifiable());
+ mExperiences->setVisible(TRUE);
+ mExperienceEnabled->set(TRUE);
+ getChild<LLButton>("view_profile")->setToolTip(getString("show_experience_profile"));
+ buildExperienceList();
+ }
}
void LLLiveLSLEditor::buildExperienceList()
{
- mExperiences->clearRows();
- bool foundAssociated=false;
- const LLUUID& associated = mScriptEd->getAssociatedExperience();
- LLUUID last;
- LLScrollListItem* item;
- for(LLSD::array_const_iterator it = mExperienceIds.beginArray(); it != mExperienceIds.endArray(); ++it)
- {
- LLUUID id = it->asUUID();
- EAddPosition position = ADD_BOTTOM;
- if(id == associated)
- {
- foundAssociated = true;
- position = ADD_TOP;
- }
-
+ mExperiences->clearRows();
+ bool foundAssociated=false;
+ const LLUUID& associated = mScriptEd->getAssociatedExperience();
+ LLUUID last;
+ LLScrollListItem* item;
+ for(LLSD::array_const_iterator it = mExperienceIds.beginArray(); it != mExperienceIds.endArray(); ++it)
+ {
+ LLUUID id = it->asUUID();
+ EAddPosition position = ADD_BOTTOM;
+ if(id == associated)
+ {
+ foundAssociated = true;
+ position = ADD_TOP;
+ }
+
const LLSD& experience = LLExperienceCache::instance().get(id);
- if(experience.isUndefined())
- {
- mExperiences->add(getString("loading"), id, position);
- last = id;
- }
- else
- {
- std::string experience_name_string = experience[LLExperienceCache::NAME].asString();
- if (experience_name_string.empty())
- {
- experience_name_string = LLTrans::getString("ExperienceNameUntitled");
- }
- mExperiences->add(experience_name_string, id, position);
- }
- }
-
- if(!foundAssociated )
- {
+ if(experience.isUndefined())
+ {
+ mExperiences->add(getString("loading"), id, position);
+ last = id;
+ }
+ else
+ {
+ std::string experience_name_string = experience[LLExperienceCache::NAME].asString();
+ if (experience_name_string.empty())
+ {
+ experience_name_string = LLTrans::getString("ExperienceNameUntitled");
+ }
+ mExperiences->add(experience_name_string, id, position);
+ }
+ }
+
+ if(!foundAssociated )
+ {
const LLSD& experience = LLExperienceCache::instance().get(associated);
- if(experience.isDefined())
- {
- std::string experience_name_string = experience[LLExperienceCache::NAME].asString();
- if (experience_name_string.empty())
- {
- experience_name_string = LLTrans::getString("ExperienceNameUntitled");
- }
- item=mExperiences->add(experience_name_string, associated, ADD_TOP);
- }
- else
- {
- item=mExperiences->add(getString("loading"), associated, ADD_TOP);
- last = associated;
- }
- item->setEnabled(FALSE);
- }
-
- if(last.notNull())
- {
- mExperiences->setEnabled(FALSE);
+ if(experience.isDefined())
+ {
+ std::string experience_name_string = experience[LLExperienceCache::NAME].asString();
+ if (experience_name_string.empty())
+ {
+ experience_name_string = LLTrans::getString("ExperienceNameUntitled");
+ }
+ item=mExperiences->add(experience_name_string, associated, ADD_TOP);
+ }
+ else
+ {
+ item=mExperiences->add(getString("loading"), associated, ADD_TOP);
+ last = associated;
+ }
+ item->setEnabled(FALSE);
+ }
+
+ if(last.notNull())
+ {
+ mExperiences->setEnabled(FALSE);
LLExperienceCache::instance().get(last, boost::bind(&LLLiveLSLEditor::buildExperienceList, this));
- }
- else
- {
- mExperiences->setEnabled(TRUE);
- mExperiences->sortByName(TRUE);
- mExperiences->setCurrentByIndex(mExperiences->getCurrentIndex());
- getChild<LLButton>("view_profile")->setVisible(TRUE);
- }
+ }
+ else
+ {
+ mExperiences->setEnabled(TRUE);
+ mExperiences->sortByName(TRUE);
+ mExperiences->setCurrentByIndex(mExperiences->getCurrentIndex());
+ getChild<LLButton>("view_profile")->setVisible(TRUE);
+ }
}
void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id )
{
- mAssociatedExperience = experience_id;
+ mAssociatedExperience = experience_id;
}
void LLLiveLSLEditor::requestExperiences()
{
- if (!getIsModifiable())
- {
- return;
- }
-
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
- std::string lookup_url=region->getCapability("GetCreatorExperiences");
- if(!lookup_url.empty())
- {
+ if (!getIsModifiable())
+ {
+ return;
+ }
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ std::string lookup_url=region->getCapability("GetCreatorExperiences");
+ if(!lookup_url.empty())
+ {
LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t success =
boost::bind(&LLLiveLSLEditor::receiveExperienceIds, _1, getDerivedHandle<LLLiveLSLEditor>());
LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpGet(lookup_url, success);
- }
- }
+ }
+ }
}
-/*static*/
+/*static*/
void LLLiveLSLEditor::receiveExperienceIds(LLSD result, LLHandle<LLLiveLSLEditor> hparent)
{
LLLiveLSLEditor* parent = hparent.get();
@@ -1493,22 +1493,22 @@ void LLLiveLSLEditor::receiveExperienceIds(LLSD result, LLHandle<LLLiveLSLEditor
/// ---------------------------------------------------------------------------
LLScriptEdContainer::LLScriptEdContainer(const LLSD& key) :
- LLPreview(key)
-, mScriptEd(NULL)
+ LLPreview(key)
+, mScriptEd(NULL)
{
}
std::string LLScriptEdContainer::getTmpFileName(const std::string& script_name)
{
- // Take script inventory item id (within the object inventory)
- // to consideration so that it's possible to edit multiple scripts
- // in the same object inventory simultaneously (STORM-781).
- std::string script_id = mObjectUUID.asString() + "_" + mItemUUID.asString();
+ // Take script inventory item id (within the object inventory)
+ // to consideration so that it's possible to edit multiple scripts
+ // in the same object inventory simultaneously (STORM-781).
+ std::string script_id = mObjectUUID.asString() + "_" + mItemUUID.asString();
- // Use MD5 sum to make the file name shorter and not exceed maximum path length.
- char script_id_hash_str[33]; /* Flawfinder: ignore */
- LLMD5 script_id_hash((const U8 *)script_id.c_str());
- script_id_hash.hex_digest(script_id_hash_str);
+ // Use MD5 sum to make the file name shorter and not exceed maximum path length.
+ char script_id_hash_str[33]; /* Flawfinder: ignore */
+ LLMD5 script_id_hash((const U8 *)script_id.c_str());
+ script_id_hash.hex_digest(script_id_hash_str);
if (script_name.empty())
{
@@ -1522,17 +1522,17 @@ std::string LLScriptEdContainer::getTmpFileName(const std::string& script_name)
bool LLScriptEdContainer::onExternalChange(const std::string& filename)
{
- if (!mScriptEd->loadScriptText(filename))
- {
- return false;
- }
+ if (!mScriptEd->loadScriptText(filename))
+ {
+ return false;
+ }
- // Disable sync to avoid recursive load->save->load calls.
- saveIfNeeded(false);
- return true;
+ // Disable sync to avoid recursive load->save->load calls.
+ saveIfNeeded(false);
+ return true;
}
-BOOL LLScriptEdContainer::handleKeyHere(KEY key, MASK mask)
+BOOL LLScriptEdContainer::handleKeyHere(KEY key, MASK mask)
{
if (('A' == key) && (MASK_CONTROL == (mask & MASK_MODIFIERS)))
{
@@ -1540,7 +1540,7 @@ BOOL LLScriptEdContainer::handleKeyHere(KEY key, MASK mask)
return TRUE;
}
- if (!LLPreview::handleKeyHere(key, mask))
+ if (!LLPreview::handleKeyHere(key, mask))
{
return mScriptEd->handleKeyHere(key, mask);
}
@@ -1552,12 +1552,12 @@ BOOL LLScriptEdContainer::handleKeyHere(KEY key, MASK mask)
struct LLScriptSaveInfo
{
- LLUUID mItemUUID;
- std::string mDescription;
- LLTransactionID mTransactionID;
+ LLUUID mItemUUID;
+ std::string mDescription;
+ LLTransactionID mTransactionID;
- LLScriptSaveInfo(const LLUUID& uuid, const std::string& desc, LLTransactionID tid) :
- mItemUUID(uuid), mDescription(desc), mTransactionID(tid) {}
+ LLScriptSaveInfo(const LLUUID& uuid, const std::string& desc, LLTransactionID tid) :
+ mItemUUID(uuid), mDescription(desc), mTransactionID(tid) {}
};
@@ -1565,34 +1565,34 @@ struct LLScriptSaveInfo
//static
void* LLPreviewLSL::createScriptEdPanel(void* userdata)
{
-
- LLPreviewLSL *self = (LLPreviewLSL*)userdata;
- self->mScriptEd = new LLScriptEdCore(
- self,
- HELLO_LSL,
- self->getHandle(),
- LLPreviewLSL::onLoad,
- LLPreviewLSL::onSave,
- LLPreviewLSL::onSearchReplace,
- self,
- false,
- 0);
- return self->mScriptEd;
+ LLPreviewLSL *self = (LLPreviewLSL*)userdata;
+
+ self->mScriptEd = new LLScriptEdCore(
+ self,
+ HELLO_LSL,
+ self->getHandle(),
+ LLPreviewLSL::onLoad,
+ LLPreviewLSL::onSave,
+ LLPreviewLSL::onSearchReplace,
+ self,
+ false,
+ 0);
+ return self->mScriptEd;
}
LLPreviewLSL::LLPreviewLSL(const LLSD& key )
-: LLScriptEdContainer(key),
- mPendingUploads(0)
+: LLScriptEdContainer(key),
+ mPendingUploads(0)
{
- mFactoryMap["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this);
+ mFactoryMap["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this);
mItemObserver = new LLScriptMovedObserver(this);
}
-LLPreviewLSL::~LLPreviewLSL()
-{
+LLPreviewLSL::~LLPreviewLSL()
+{
delete mItemObserver;
mItemObserver = NULL;
}
@@ -1600,159 +1600,159 @@ LLPreviewLSL::~LLPreviewLSL()
// virtual
BOOL LLPreviewLSL::postBuild()
{
- const LLInventoryItem* item = getItem();
+ const LLInventoryItem* item = getItem();
- llassert(item);
- if (item)
- {
- getChild<LLUICtrl>("desc")->setValue(item->getDescription());
+ llassert(item);
+ if (item)
+ {
+ getChild<LLUICtrl>("desc")->setValue(item->getDescription());
std::string item_path = get_category_path(item->getParentUUID());
getChild<LLUICtrl>("path_txt")->setValue(item_path);
getChild<LLUICtrl>("path_txt")->setToolTip(item_path);
- }
- childSetCommitCallback("desc", LLPreview::onText, this);
- getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
-
- return LLPreview::postBuild();
+ }
+ childSetCommitCallback("desc", LLPreview::onText, this);
+ getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+
+ return LLPreview::postBuild();
}
void LLPreviewLSL::draw()
{
- const LLInventoryItem* item = getItem();
- if(!item)
- {
- setTitle(LLTrans::getString("ScriptWasDeleted"));
- mScriptEd->setItemRemoved(TRUE);
- }
- else if (mDirty)
+ const LLInventoryItem* item = getItem();
+ if(!item)
+ {
+ setTitle(LLTrans::getString("ScriptWasDeleted"));
+ mScriptEd->setItemRemoved(TRUE);
+ }
+ else if (mDirty)
{
std::string item_path = get_category_path(item->getParentUUID());
getChild<LLUICtrl>("path_txt")->setValue(item_path);
getChild<LLUICtrl>("path_txt")->setToolTip(item_path);
}
- LLPreview::draw();
+ LLPreview::draw();
}
// virtual
void LLPreviewLSL::callbackLSLCompileSucceeded()
{
- LL_INFOS() << "LSL Bytecode saved" << LL_ENDL;
- mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful"));
- mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete"));
- closeIfNeeded();
+ LL_INFOS() << "LSL Bytecode saved" << LL_ENDL;
+ mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful"));
+ mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete"));
+ closeIfNeeded();
}
// virtual
void LLPreviewLSL::callbackLSLCompileFailed(const LLSD& compile_errors)
{
- LL_INFOS() << "Compile failed!" << LL_ENDL;
+ LL_INFOS() << "Compile failed!" << LL_ENDL;
- for(LLSD::array_const_iterator line = compile_errors.beginArray();
- line < compile_errors.endArray();
- line++)
- {
- LLSD row;
- std::string error_message = line->asString();
- LLStringUtil::stripNonprintable(error_message);
- row["columns"][0]["value"] = error_message;
- row["columns"][0]["font"] = "OCRA";
- mScriptEd->mErrorList->addElement(row);
- }
- mScriptEd->selectFirstError();
- closeIfNeeded();
+ for(LLSD::array_const_iterator line = compile_errors.beginArray();
+ line < compile_errors.endArray();
+ line++)
+ {
+ LLSD row;
+ std::string error_message = line->asString();
+ LLStringUtil::stripNonprintable(error_message);
+ row["columns"][0]["value"] = error_message;
+ row["columns"][0]["font"] = "OCRA";
+ mScriptEd->mErrorList->addElement(row);
+ }
+ mScriptEd->selectFirstError();
+ closeIfNeeded();
}
void LLPreviewLSL::loadAsset()
{
- // *HACK: we poke into inventory to see if it's there, and if so,
- // then it might be part of the inventory library. If it's in the
- // library, then you can see the script, but not modify it.
- const LLInventoryItem* item = gInventory.getItem(mItemUUID);
- BOOL is_library = item
- && !gInventory.isObjectDescendentOf(mItemUUID,
- gInventory.getRootFolderID());
- if(!item)
- {
- // do the more generic search.
- getItem();
- }
- if(item)
- {
- BOOL is_copyable = gAgent.allowOperation(PERM_COPY,
- item->getPermissions(), GP_OBJECT_MANIPULATE);
- BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY,
- item->getPermissions(), GP_OBJECT_MANIPULATE);
- if (gAgent.isGodlike() || (is_copyable && (is_modifiable || is_library)))
- {
- LLUUID* new_uuid = new LLUUID(mItemUUID);
- gAssetStorage->getInvItemAsset(LLHost(),
- gAgent.getID(),
- gAgent.getSessionID(),
- item->getPermissions().getOwner(),
- LLUUID::null,
- item->getUUID(),
- item->getAssetUUID(),
- item->getType(),
- &LLPreviewLSL::onLoadComplete,
- (void*)new_uuid,
- TRUE);
- mAssetStatus = PREVIEW_ASSET_LOADING;
- }
- else
- {
- mScriptEd->setScriptText(mScriptEd->getString("can_not_view"), FALSE);
- mScriptEd->mEditor->makePristine();
- mScriptEd->mFunctions->setEnabled(FALSE);
- mAssetStatus = PREVIEW_ASSET_LOADED;
- }
- getChildView("lock")->setVisible( !is_modifiable);
- mScriptEd->getChildView("Insert...")->setEnabled(is_modifiable);
- }
- else
- {
- mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE);
- mScriptEd->setEnableEditing(TRUE);
- mAssetStatus = PREVIEW_ASSET_LOADED;
- }
+ // *HACK: we poke into inventory to see if it's there, and if so,
+ // then it might be part of the inventory library. If it's in the
+ // library, then you can see the script, but not modify it.
+ const LLInventoryItem* item = gInventory.getItem(mItemUUID);
+ BOOL is_library = item
+ && !gInventory.isObjectDescendentOf(mItemUUID,
+ gInventory.getRootFolderID());
+ if(!item)
+ {
+ // do the more generic search.
+ getItem();
+ }
+ if(item)
+ {
+ BOOL is_copyable = gAgent.allowOperation(PERM_COPY,
+ item->getPermissions(), GP_OBJECT_MANIPULATE);
+ BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY,
+ item->getPermissions(), GP_OBJECT_MANIPULATE);
+ if (gAgent.isGodlike() || (is_copyable && (is_modifiable || is_library)))
+ {
+ LLUUID* new_uuid = new LLUUID(mItemUUID);
+ gAssetStorage->getInvItemAsset(LLHost(),
+ gAgent.getID(),
+ gAgent.getSessionID(),
+ item->getPermissions().getOwner(),
+ LLUUID::null,
+ item->getUUID(),
+ item->getAssetUUID(),
+ item->getType(),
+ &LLPreviewLSL::onLoadComplete,
+ (void*)new_uuid,
+ TRUE);
+ mAssetStatus = PREVIEW_ASSET_LOADING;
+ }
+ else
+ {
+ mScriptEd->setScriptText(mScriptEd->getString("can_not_view"), FALSE);
+ mScriptEd->mEditor->makePristine();
+ mScriptEd->mFunctions->setEnabled(FALSE);
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
+ getChildView("lock")->setVisible( !is_modifiable);
+ mScriptEd->getChildView("Insert...")->setEnabled(is_modifiable);
+ }
+ else
+ {
+ mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE);
+ mScriptEd->setEnableEditing(TRUE);
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
}
BOOL LLPreviewLSL::canClose()
{
- return mScriptEd->canClose();
+ return mScriptEd->canClose();
}
void LLPreviewLSL::closeIfNeeded()
{
- // Find our window and close it if requested.
- getWindow()->decBusyCount();
- mPendingUploads--;
- if (mPendingUploads <= 0 && mCloseAfterSave)
- {
- closeFloater();
- }
+ // Find our window and close it if requested.
+ getWindow()->decBusyCount();
+ mPendingUploads--;
+ if (mPendingUploads <= 0 && mCloseAfterSave)
+ {
+ closeFloater();
+ }
}
void LLPreviewLSL::onSearchReplace(void* userdata)
{
- LLPreviewLSL* self = (LLPreviewLSL*)userdata;
- LLScriptEdCore* sec = self->mScriptEd;
- LLFloaterScriptSearch::show(sec);
+ LLPreviewLSL* self = (LLPreviewLSL*)userdata;
+ LLScriptEdCore* sec = self->mScriptEd;
+ LLFloaterScriptSearch::show(sec);
}
// static
void LLPreviewLSL::onLoad(void* userdata)
{
- LLPreviewLSL* self = (LLPreviewLSL*)userdata;
- self->loadAsset();
+ LLPreviewLSL* self = (LLPreviewLSL*)userdata;
+ self->loadAsset();
}
// static
void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save)
{
- LLPreviewLSL* self = (LLPreviewLSL*)userdata;
- self->mCloseAfterSave = close_after_save;
- self->saveIfNeeded();
+ LLPreviewLSL* self = (LLPreviewLSL*)userdata;
+ self->mCloseAfterSave = close_after_save;
+ self->saveIfNeeded();
}
/*static*/
@@ -1833,7 +1833,7 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
LLUUID old_asset_id = inv_item->getAssetUUID().isNull() ? mScriptEd->getAssetID() : inv_item->getAssetUUID();
- LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLScriptAssetUpload>(mItemUUID, buffer,
+ LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLScriptAssetUpload>(mItemUUID, buffer,
[old_asset_id](LLUUID itemId, LLUUID, LLUUID, LLSD response) {
LLFileSystem::removeFile(old_asset_id, LLAssetType::AT_LSL_TEXT);
LLPreviewLSL::finishedLSLUpload(itemId, response);
@@ -1847,67 +1847,67 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
// static
void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status)
-{
- LL_DEBUGS() << "LLPreviewLSL::onLoadComplete: got uuid " << asset_uuid
- << LL_ENDL;
- LLUUID* item_uuid = (LLUUID*)user_data;
- LLPreviewLSL* preview = LLFloaterReg::findTypedInstance<LLPreviewLSL>("preview_script", *item_uuid);
- if( preview )
- {
- if(0 == status)
- {
- LLFileSystem file(asset_uuid, type);
- S32 file_length = file.getSize();
-
- std::vector<char> buffer(file_length+1);
- file.read((U8*)&buffer[0], file_length);
-
- // put a EOS at the end
- buffer[file_length] = 0;
- preview->mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE);
- preview->mScriptEd->mEditor->makePristine();
-
- std::string script_name = DEFAULT_SCRIPT_NAME;
- LLInventoryItem* item = gInventory.getItem(*item_uuid);
- BOOL is_modifiable = FALSE;
- if (item)
- {
- if (!item->getName().empty())
- {
- script_name = item->getName();
- }
- if (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE))
- {
- is_modifiable = TRUE;
- }
- }
- preview->mScriptEd->setScriptName(script_name);
- preview->mScriptEd->setEnableEditing(is_modifiable);
+ void* user_data, S32 status, LLExtStat ext_status)
+{
+ LL_DEBUGS() << "LLPreviewLSL::onLoadComplete: got uuid " << asset_uuid
+ << LL_ENDL;
+ LLUUID* item_uuid = (LLUUID*)user_data;
+ LLPreviewLSL* preview = LLFloaterReg::findTypedInstance<LLPreviewLSL>("preview_script", *item_uuid);
+ if( preview )
+ {
+ if(0 == status)
+ {
+ LLFileSystem file(asset_uuid, type);
+ S32 file_length = file.getSize();
+
+ std::vector<char> buffer(file_length+1);
+ file.read((U8*)&buffer[0], file_length);
+
+ // put a EOS at the end
+ buffer[file_length] = 0;
+ preview->mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE);
+ preview->mScriptEd->mEditor->makePristine();
+
+ std::string script_name = DEFAULT_SCRIPT_NAME;
+ LLInventoryItem* item = gInventory.getItem(*item_uuid);
+ BOOL is_modifiable = FALSE;
+ if (item)
+ {
+ if (!item->getName().empty())
+ {
+ script_name = item->getName();
+ }
+ if (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE))
+ {
+ is_modifiable = TRUE;
+ }
+ }
+ preview->mScriptEd->setScriptName(script_name);
+ preview->mScriptEd->setEnableEditing(is_modifiable);
preview->mScriptEd->setAssetID(asset_uuid);
- preview->mAssetStatus = PREVIEW_ASSET_LOADED;
- }
- else
- {
- if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
- LL_ERR_FILE_EMPTY == status)
- {
- LLNotificationsUtil::add("ScriptMissing");
- }
- else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
- {
- LLNotificationsUtil::add("ScriptNoPermissions");
- }
- else
- {
- LLNotificationsUtil::add("UnableToLoadScript");
- }
-
- preview->mAssetStatus = PREVIEW_ASSET_ERROR;
- LL_WARNS() << "Problem loading script: " << status << LL_ENDL;
- }
- }
- delete item_uuid;
+ preview->mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
+ else
+ {
+ if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
+ LL_ERR_FILE_EMPTY == status)
+ {
+ LLNotificationsUtil::add("ScriptMissing");
+ }
+ else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
+ {
+ LLNotificationsUtil::add("ScriptNoPermissions");
+ }
+ else
+ {
+ LLNotificationsUtil::add("UnableToLoadScript");
+ }
+
+ preview->mAssetStatus = PREVIEW_ASSET_ERROR;
+ LL_WARNS() << "Problem loading script: " << status << LL_ENDL;
+ }
+ }
+ delete item_uuid;
}
@@ -1916,396 +1916,396 @@ void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType t
/// ---------------------------------------------------------------------------
-//static
+//static
void* LLLiveLSLEditor::createScriptEdPanel(void* userdata)
{
- LLLiveLSLEditor *self = (LLLiveLSLEditor*)userdata;
+ LLLiveLSLEditor *self = (LLLiveLSLEditor*)userdata;
- self->mScriptEd = new LLScriptEdCore(
- self,
- HELLO_LSL,
- self->getHandle(),
- &LLLiveLSLEditor::onLoad,
- &LLLiveLSLEditor::onSave,
- &LLLiveLSLEditor::onSearchReplace,
- self,
- true,
- 0);
- return self->mScriptEd;
+ self->mScriptEd = new LLScriptEdCore(
+ self,
+ HELLO_LSL,
+ self->getHandle(),
+ &LLLiveLSLEditor::onLoad,
+ &LLLiveLSLEditor::onSave,
+ &LLLiveLSLEditor::onSearchReplace,
+ self,
+ true,
+ 0);
+ return self->mScriptEd;
}
LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) :
- LLScriptEdContainer(key),
- mAskedForRunningInfo(FALSE),
- mHaveRunningInfo(FALSE),
- mCloseAfterSave(FALSE),
- mPendingUploads(0),
- mIsModifiable(FALSE),
- mIsNew(false),
- mIsSaving(FALSE),
+ LLScriptEdContainer(key),
+ mAskedForRunningInfo(FALSE),
+ mHaveRunningInfo(FALSE),
+ mCloseAfterSave(FALSE),
+ mPendingUploads(0),
+ mIsModifiable(FALSE),
+ mIsNew(false),
+ mIsSaving(FALSE),
mObjectName("")
{
- mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this);
+ mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this);
}
BOOL LLLiveLSLEditor::postBuild()
{
- childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this);
- getChildView("running")->setEnabled(FALSE);
+ childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this);
+ getChildView("running")->setEnabled(FALSE);
+
+ childSetAction("Reset",&LLLiveLSLEditor::onReset,this);
+ getChildView("Reset")->setEnabled(TRUE);
+
+ mMonoCheckbox = getChild<LLCheckBoxCtrl>("mono");
+ childSetCommitCallback("mono", &LLLiveLSLEditor::onMonoCheckboxClicked, this);
+ getChildView("mono")->setEnabled(FALSE);
+
+ mScriptEd->mEditor->makePristine();
+ mScriptEd->mEditor->setFocus(TRUE);
- childSetAction("Reset",&LLLiveLSLEditor::onReset,this);
- getChildView("Reset")->setEnabled(TRUE);
- mMonoCheckbox = getChild<LLCheckBoxCtrl>("mono");
- childSetCommitCallback("mono", &LLLiveLSLEditor::onMonoCheckboxClicked, this);
- getChildView("mono")->setEnabled(FALSE);
+ mExperiences = getChild<LLComboBox>("Experiences...");
+ mExperiences->setCommitCallback(boost::bind(&LLLiveLSLEditor::experienceChanged, this));
- mScriptEd->mEditor->makePristine();
- mScriptEd->mEditor->setFocus(TRUE);
+ mExperienceEnabled = getChild<LLCheckBoxCtrl>("enable_xp");
+ childSetCommitCallback("enable_xp", onToggleExperience, this);
+ childSetCommitCallback("view_profile", onViewProfile, this);
- mExperiences = getChild<LLComboBox>("Experiences...");
- mExperiences->setCommitCallback(boost::bind(&LLLiveLSLEditor::experienceChanged, this));
-
- mExperienceEnabled = getChild<LLCheckBoxCtrl>("enable_xp");
-
- childSetCommitCallback("enable_xp", onToggleExperience, this);
- childSetCommitCallback("view_profile", onViewProfile, this);
-
- return LLPreview::postBuild();
+ return LLPreview::postBuild();
}
// virtual
void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id,
- const LLUUID& item_id,
- bool is_script_running)
+ const LLUUID& item_id,
+ bool is_script_running)
{
- LL_DEBUGS() << "LSL Bytecode saved" << LL_ENDL;
- mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful"));
- mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete"));
- getChild<LLCheckBoxCtrl>("running")->set(is_script_running);
- mIsSaving = FALSE;
- closeIfNeeded();
+ LL_DEBUGS() << "LSL Bytecode saved" << LL_ENDL;
+ mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful"));
+ mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete"));
+ getChild<LLCheckBoxCtrl>("running")->set(is_script_running);
+ mIsSaving = FALSE;
+ closeIfNeeded();
}
// virtual
void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors)
{
- LL_DEBUGS() << "Compile failed!" << LL_ENDL;
- for(LLSD::array_const_iterator line = compile_errors.beginArray();
- line < compile_errors.endArray();
- line++)
- {
- LLSD row;
- std::string error_message = line->asString();
- LLStringUtil::stripNonprintable(error_message);
- row["columns"][0]["value"] = error_message;
- // *TODO: change to "MONOSPACE" and change llfontgl.cpp?
- row["columns"][0]["font"] = "OCRA";
- mScriptEd->mErrorList->addElement(row);
- }
- mScriptEd->selectFirstError();
- mIsSaving = FALSE;
- closeIfNeeded();
+ LL_DEBUGS() << "Compile failed!" << LL_ENDL;
+ for(LLSD::array_const_iterator line = compile_errors.beginArray();
+ line < compile_errors.endArray();
+ line++)
+ {
+ LLSD row;
+ std::string error_message = line->asString();
+ LLStringUtil::stripNonprintable(error_message);
+ row["columns"][0]["value"] = error_message;
+ // *TODO: change to "MONOSPACE" and change llfontgl.cpp?
+ row["columns"][0]["font"] = "OCRA";
+ mScriptEd->mErrorList->addElement(row);
+ }
+ mScriptEd->selectFirstError();
+ mIsSaving = FALSE;
+ closeIfNeeded();
}
void LLLiveLSLEditor::loadAsset()
{
- //LL_INFOS() << "LLLiveLSLEditor::loadAsset()" << LL_ENDL;
- if(!mIsNew)
- {
- LLViewerObject* object = gObjectList.findObject(mObjectUUID);
- if(object)
- {
- LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemUUID));
-
- if(item)
- {
- LLViewerRegion* region = object->getRegion();
- std::string url = std::string();
- if(region)
- {
- url = region->getCapability("GetMetadata");
- }
- LLExperienceCache::instance().fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), url,
- boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle<LLLiveLSLEditor>(), _1));
-
- bool isGodlike = gAgent.isGodlike();
- bool copyManipulate = gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE);
- mIsModifiable = gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE);
-
- if(!isGodlike && (!copyManipulate || !mIsModifiable))
- {
- mItem = new LLViewerInventoryItem(item);
- mScriptEd->setScriptText(getString("not_allowed"), FALSE);
- mScriptEd->mEditor->makePristine();
- mScriptEd->enableSave(FALSE);
- mAssetStatus = PREVIEW_ASSET_LOADED;
- }
- else if(copyManipulate || isGodlike)
- {
- mItem = new LLViewerInventoryItem(item);
- // request the text from the object
- LLSD* user_data = new LLSD();
- user_data->with("taskid", mObjectUUID).with("itemid", mItemUUID);
- gAssetStorage->getInvItemAsset(object->getRegion()->getHost(),
- gAgent.getID(),
- gAgent.getSessionID(),
- item->getPermissions().getOwner(),
- object->getID(),
- item->getUUID(),
- item->getAssetUUID(),
- item->getType(),
- &LLLiveLSLEditor::onLoadComplete,
- (void*)user_data,
- TRUE);
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_GetScriptRunning);
- msg->nextBlockFast(_PREHASH_Script);
- msg->addUUIDFast(_PREHASH_ObjectID, mObjectUUID);
- msg->addUUIDFast(_PREHASH_ItemID, mItemUUID);
- msg->sendReliable(object->getRegion()->getHost());
- mAskedForRunningInfo = TRUE;
- mAssetStatus = PREVIEW_ASSET_LOADING;
- }
- }
-
- if(mItem.isNull())
- {
- mScriptEd->setScriptText(LLStringUtil::null, FALSE);
- mScriptEd->mEditor->makePristine();
- mAssetStatus = PREVIEW_ASSET_LOADED;
- mIsModifiable = FALSE;
- }
-
- refreshFromItem();
+ //LL_INFOS() << "LLLiveLSLEditor::loadAsset()" << LL_ENDL;
+ if(!mIsNew)
+ {
+ LLViewerObject* object = gObjectList.findObject(mObjectUUID);
+ if(object)
+ {
+ LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemUUID));
+
+ if(item)
+ {
+ LLViewerRegion* region = object->getRegion();
+ std::string url = std::string();
+ if(region)
+ {
+ url = region->getCapability("GetMetadata");
+ }
+ LLExperienceCache::instance().fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), url,
+ boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle<LLLiveLSLEditor>(), _1));
+
+ bool isGodlike = gAgent.isGodlike();
+ bool copyManipulate = gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE);
+ mIsModifiable = gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE);
+
+ if(!isGodlike && (!copyManipulate || !mIsModifiable))
+ {
+ mItem = new LLViewerInventoryItem(item);
+ mScriptEd->setScriptText(getString("not_allowed"), FALSE);
+ mScriptEd->mEditor->makePristine();
+ mScriptEd->enableSave(FALSE);
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
+ else if(copyManipulate || isGodlike)
+ {
+ mItem = new LLViewerInventoryItem(item);
+ // request the text from the object
+ LLSD* user_data = new LLSD();
+ user_data->with("taskid", mObjectUUID).with("itemid", mItemUUID);
+ gAssetStorage->getInvItemAsset(object->getRegion()->getHost(),
+ gAgent.getID(),
+ gAgent.getSessionID(),
+ item->getPermissions().getOwner(),
+ object->getID(),
+ item->getUUID(),
+ item->getAssetUUID(),
+ item->getType(),
+ &LLLiveLSLEditor::onLoadComplete,
+ (void*)user_data,
+ TRUE);
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_GetScriptRunning);
+ msg->nextBlockFast(_PREHASH_Script);
+ msg->addUUIDFast(_PREHASH_ObjectID, mObjectUUID);
+ msg->addUUIDFast(_PREHASH_ItemID, mItemUUID);
+ msg->sendReliable(object->getRegion()->getHost());
+ mAskedForRunningInfo = TRUE;
+ mAssetStatus = PREVIEW_ASSET_LOADING;
+ }
+ }
+
+ if(mItem.isNull())
+ {
+ mScriptEd->setScriptText(LLStringUtil::null, FALSE);
+ mScriptEd->mEditor->makePristine();
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ mIsModifiable = FALSE;
+ }
+
+ refreshFromItem();
getChild<LLUICtrl>("obj_name")->setValue(mObjectName);
- // This is commented out, because we don't completely
- // handle script exports yet.
- /*
- // request the exports from the object
- gMessageSystem->newMessage("GetScriptExports");
- gMessageSystem->nextBlock("ScriptBlock");
- gMessageSystem->addUUID("AgentID", gAgent.getID());
- U32 local_id = object->getLocalID();
- gMessageSystem->addData("LocalID", &local_id);
- gMessageSystem->addUUID("ItemID", mItemUUID);
- LLHost host(object->getRegion()->getIP(),
- object->getRegion()->getPort());
- gMessageSystem->sendReliable(host);
- */
- }
- }
- else
- {
- mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE);
- mScriptEd->enableSave(FALSE);
- LLPermissions perm;
- perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID());
- perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER);
- mItem = new LLViewerInventoryItem(mItemUUID,
- mObjectUUID,
- perm,
- LLUUID::null,
- LLAssetType::AT_LSL_TEXT,
- LLInventoryType::IT_LSL,
- DEFAULT_SCRIPT_NAME,
- DEFAULT_SCRIPT_DESC,
- LLSaleInfo::DEFAULT,
- LLInventoryItemFlags::II_FLAGS_NONE,
- time_corrected());
- mAssetStatus = PREVIEW_ASSET_LOADED;
- }
-
- requestExperiences();
+ // This is commented out, because we don't completely
+ // handle script exports yet.
+ /*
+ // request the exports from the object
+ gMessageSystem->newMessage("GetScriptExports");
+ gMessageSystem->nextBlock("ScriptBlock");
+ gMessageSystem->addUUID("AgentID", gAgent.getID());
+ U32 local_id = object->getLocalID();
+ gMessageSystem->addData("LocalID", &local_id);
+ gMessageSystem->addUUID("ItemID", mItemUUID);
+ LLHost host(object->getRegion()->getIP(),
+ object->getRegion()->getPort());
+ gMessageSystem->sendReliable(host);
+ */
+ }
+ }
+ else
+ {
+ mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE);
+ mScriptEd->enableSave(FALSE);
+ LLPermissions perm;
+ perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID());
+ perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER);
+ mItem = new LLViewerInventoryItem(mItemUUID,
+ mObjectUUID,
+ perm,
+ LLUUID::null,
+ LLAssetType::AT_LSL_TEXT,
+ LLInventoryType::IT_LSL,
+ DEFAULT_SCRIPT_NAME,
+ DEFAULT_SCRIPT_DESC,
+ LLSaleInfo::DEFAULT,
+ LLInventoryItemFlags::II_FLAGS_NONE,
+ time_corrected());
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
+
+ requestExperiences();
}
// static
void LLLiveLSLEditor::onLoadComplete(const LLUUID& asset_id,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status)
-{
- LL_DEBUGS() << "LLLiveLSLEditor::onLoadComplete: got uuid " << asset_id
- << LL_ENDL;
- LLSD* floater_key = (LLSD*)user_data;
-
- LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", *floater_key);
-
- if(instance )
- {
- if( LL_ERR_NOERR == status )
- {
- instance->loadScriptText(asset_id, type);
- instance->mScriptEd->setEnableEditing(TRUE);
- instance->mAssetStatus = PREVIEW_ASSET_LOADED;
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status)
+{
+ LL_DEBUGS() << "LLLiveLSLEditor::onLoadComplete: got uuid " << asset_id
+ << LL_ENDL;
+ LLSD* floater_key = (LLSD*)user_data;
+
+ LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", *floater_key);
+
+ if(instance )
+ {
+ if( LL_ERR_NOERR == status )
+ {
+ instance->loadScriptText(asset_id, type);
+ instance->mScriptEd->setEnableEditing(TRUE);
+ instance->mAssetStatus = PREVIEW_ASSET_LOADED;
instance->mScriptEd->setAssetID(asset_id);
- }
- else
- {
- if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
- LL_ERR_FILE_EMPTY == status)
- {
- LLNotificationsUtil::add("ScriptMissing");
- }
- else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
- {
- LLNotificationsUtil::add("ScriptNoPermissions");
- }
- else
- {
- LLNotificationsUtil::add("UnableToLoadScript");
- }
- instance->mAssetStatus = PREVIEW_ASSET_ERROR;
- }
- }
-
- delete floater_key;
+ }
+ else
+ {
+ if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
+ LL_ERR_FILE_EMPTY == status)
+ {
+ LLNotificationsUtil::add("ScriptMissing");
+ }
+ else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
+ {
+ LLNotificationsUtil::add("ScriptNoPermissions");
+ }
+ else
+ {
+ LLNotificationsUtil::add("UnableToLoadScript");
+ }
+ instance->mAssetStatus = PREVIEW_ASSET_ERROR;
+ }
+ }
+
+ delete floater_key;
}
void LLLiveLSLEditor::loadScriptText(const LLUUID &uuid, LLAssetType::EType type)
{
- LLFileSystem file(uuid, type);
- S32 file_length = file.getSize();
- std::vector<char> buffer(file_length + 1);
- file.read((U8*)&buffer[0], file_length);
+ LLFileSystem file(uuid, type);
+ S32 file_length = file.getSize();
+ std::vector<char> buffer(file_length + 1);
+ file.read((U8*)&buffer[0], file_length);
- if (file.getLastBytesRead() != file_length ||
- file_length <= 0)
- {
- LL_WARNS() << "Error reading " << uuid << ":" << type << LL_ENDL;
- }
+ if (file.getLastBytesRead() != file_length ||
+ file_length <= 0)
+ {
+ LL_WARNS() << "Error reading " << uuid << ":" << type << LL_ENDL;
+ }
- buffer[file_length] = '\0';
+ buffer[file_length] = '\0';
- mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE);
- mScriptEd->makeEditorPristine();
+ mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE);
+ mScriptEd->makeEditorPristine();
- std::string script_name = DEFAULT_SCRIPT_NAME;
- const LLInventoryItem* inv_item = getItem();
+ std::string script_name = DEFAULT_SCRIPT_NAME;
+ const LLInventoryItem* inv_item = getItem();
- if(inv_item)
- {
- script_name = inv_item->getName();
- }
- mScriptEd->setScriptName(script_name);
+ if(inv_item)
+ {
+ script_name = inv_item->getName();
+ }
+ mScriptEd->setScriptName(script_name);
}
void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata )
{
- LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata;
- LLViewerObject* object = gObjectList.findObject( self->mObjectUUID );
- LLCheckBoxCtrl* runningCheckbox = self->getChild<LLCheckBoxCtrl>("running");
- BOOL running = runningCheckbox->get();
- //self->mRunningCheckbox->get();
- if( object )
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_SetScriptRunning);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Script);
- msg->addUUIDFast(_PREHASH_ObjectID, self->mObjectUUID);
- msg->addUUIDFast(_PREHASH_ItemID, self->mItemUUID);
- msg->addBOOLFast(_PREHASH_Running, running);
- msg->sendReliable(object->getRegion()->getHost());
- }
- else
- {
- runningCheckbox->set(!running);
- LLNotificationsUtil::add("CouldNotStartStopScript");
- }
+ LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata;
+ LLViewerObject* object = gObjectList.findObject( self->mObjectUUID );
+ LLCheckBoxCtrl* runningCheckbox = self->getChild<LLCheckBoxCtrl>("running");
+ BOOL running = runningCheckbox->get();
+ //self->mRunningCheckbox->get();
+ if( object )
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_SetScriptRunning);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_Script);
+ msg->addUUIDFast(_PREHASH_ObjectID, self->mObjectUUID);
+ msg->addUUIDFast(_PREHASH_ItemID, self->mItemUUID);
+ msg->addBOOLFast(_PREHASH_Running, running);
+ msg->sendReliable(object->getRegion()->getHost());
+ }
+ else
+ {
+ runningCheckbox->set(!running);
+ LLNotificationsUtil::add("CouldNotStartStopScript");
+ }
}
void LLLiveLSLEditor::onReset(void *userdata)
{
- LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata;
-
- LLViewerObject* object = gObjectList.findObject( self->mObjectUUID );
- if(object)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ScriptReset);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Script);
- msg->addUUIDFast(_PREHASH_ObjectID, self->mObjectUUID);
- msg->addUUIDFast(_PREHASH_ItemID, self->mItemUUID);
- msg->sendReliable(object->getRegion()->getHost());
- }
- else
- {
- LLNotificationsUtil::add("CouldNotStartStopScript");
- }
+ LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata;
+
+ LLViewerObject* object = gObjectList.findObject( self->mObjectUUID );
+ if(object)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ScriptReset);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_Script);
+ msg->addUUIDFast(_PREHASH_ObjectID, self->mObjectUUID);
+ msg->addUUIDFast(_PREHASH_ItemID, self->mItemUUID);
+ msg->sendReliable(object->getRegion()->getHost());
+ }
+ else
+ {
+ LLNotificationsUtil::add("CouldNotStartStopScript");
+ }
}
void LLLiveLSLEditor::draw()
{
- LLViewerObject* object = gObjectList.findObject(mObjectUUID);
- LLCheckBoxCtrl* runningCheckbox = getChild<LLCheckBoxCtrl>( "running");
- if(object && mAskedForRunningInfo && mHaveRunningInfo)
- {
- if(object->permAnyOwner())
- {
- runningCheckbox->setLabel(getString("script_running"));
- runningCheckbox->setEnabled(!mIsSaving);
- }
- else
- {
- runningCheckbox->setLabel(getString("public_objects_can_not_run"));
- runningCheckbox->setEnabled(FALSE);
-
- // *FIX: Set it to false so that the ui is correct for
- // a box that is released to public. It could be
- // incorrect after a release/claim cycle, but will be
- // correct after clicking on it.
- runningCheckbox->set(FALSE);
- mMonoCheckbox->set(FALSE);
- }
- }
- else if(!object)
- {
- // HACK: Display this information in the title bar.
- // Really ought to put in main window.
- setTitle(LLTrans::getString("ObjectOutOfRange"));
- runningCheckbox->setEnabled(FALSE);
- mMonoCheckbox->setEnabled(FALSE);
- // object may have fallen out of range.
- mHaveRunningInfo = FALSE;
- }
-
- LLPreview::draw();
+ LLViewerObject* object = gObjectList.findObject(mObjectUUID);
+ LLCheckBoxCtrl* runningCheckbox = getChild<LLCheckBoxCtrl>( "running");
+ if(object && mAskedForRunningInfo && mHaveRunningInfo)
+ {
+ if(object->permAnyOwner())
+ {
+ runningCheckbox->setLabel(getString("script_running"));
+ runningCheckbox->setEnabled(!mIsSaving);
+ }
+ else
+ {
+ runningCheckbox->setLabel(getString("public_objects_can_not_run"));
+ runningCheckbox->setEnabled(FALSE);
+
+ // *FIX: Set it to false so that the ui is correct for
+ // a box that is released to public. It could be
+ // incorrect after a release/claim cycle, but will be
+ // correct after clicking on it.
+ runningCheckbox->set(FALSE);
+ mMonoCheckbox->set(FALSE);
+ }
+ }
+ else if(!object)
+ {
+ // HACK: Display this information in the title bar.
+ // Really ought to put in main window.
+ setTitle(LLTrans::getString("ObjectOutOfRange"));
+ runningCheckbox->setEnabled(FALSE);
+ mMonoCheckbox->setEnabled(FALSE);
+ // object may have fallen out of range.
+ mHaveRunningInfo = FALSE;
+ }
+
+ LLPreview::draw();
}
void LLLiveLSLEditor::onSearchReplace(void* userdata)
{
- LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
+ LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
- LLScriptEdCore* sec = self->mScriptEd;
- LLFloaterScriptSearch::show(sec);
+ LLScriptEdCore* sec = self->mScriptEd;
+ LLFloaterScriptSearch::show(sec);
}
struct LLLiveLSLSaveData
{
- LLLiveLSLSaveData(const LLUUID& id, const LLViewerInventoryItem* item, BOOL active);
- LLUUID mSaveObjectID;
- LLPointer<LLViewerInventoryItem> mItem;
- BOOL mActive;
+ LLLiveLSLSaveData(const LLUUID& id, const LLViewerInventoryItem* item, BOOL active);
+ LLUUID mSaveObjectID;
+ LLPointer<LLViewerInventoryItem> mItem;
+ BOOL mActive;
};
LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id,
- const LLViewerInventoryItem* item,
- BOOL active) :
- mSaveObjectID(id),
- mActive(active)
+ const LLViewerInventoryItem* item,
+ BOOL active) :
+ mSaveObjectID(id),
+ mActive(active)
{
- llassert(item);
- mItem = new LLViewerInventoryItem(item);
+ llassert(item);
+ mItem = new LLViewerInventoryItem(item);
}
@@ -2339,20 +2339,20 @@ void LLLiveLSLEditor::finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAs
// virtual
void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/)
{
- LLViewerObject* object = gObjectList.findObject(mObjectUUID);
- if(!object)
- {
- LLNotificationsUtil::add("SaveScriptFailObjectNotFound");
- return;
- }
+ LLViewerObject* object = gObjectList.findObject(mObjectUUID);
+ if(!object)
+ {
+ LLNotificationsUtil::add("SaveScriptFailObjectNotFound");
+ return;
+ }
if (mItem.isNull() || !mItem->isFinished())
- {
- // $NOTE: While the error message may not be exactly correct,
- // it's pretty close.
- LLNotificationsUtil::add("SaveScriptFailObjectNotFound");
- return;
- }
+ {
+ // $NOTE: While the error message may not be exactly correct,
+ // it's pretty close.
+ LLNotificationsUtil::add("SaveScriptFailObjectNotFound");
+ return;
+ }
// get the latest info about it. We used to be losing the script
// name on save, because the viewer object version of the item,
@@ -2393,10 +2393,10 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/)
std::string buffer(mScriptEd->mEditor->getText());
LLUUID old_asset_id = mScriptEd->getAssetID();
- LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLScriptAssetUpload>(mObjectUUID, mItemUUID,
- monoChecked() ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2,
- isRunning, mScriptEd->getAssociatedExperience(), buffer,
- [isRunning, old_asset_id](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) {
+ LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLScriptAssetUpload>(mObjectUUID, mItemUUID,
+ monoChecked() ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2,
+ isRunning, mScriptEd->getAssociatedExperience(), buffer,
+ [isRunning, old_asset_id](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) {
LLFileSystem::removeFile(old_asset_id, LLAssetType::AT_LSL_TEXT);
LLLiveLSLEditor::finishLSLUpload(itemId, taskId, newAssetId, response, isRunning);
},
@@ -2408,94 +2408,94 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/)
BOOL LLLiveLSLEditor::canClose()
{
- return (mScriptEd->canClose());
+ return (mScriptEd->canClose());
}
void LLLiveLSLEditor::closeIfNeeded()
{
- getWindow()->decBusyCount();
- mPendingUploads--;
- if (mPendingUploads <= 0 && mCloseAfterSave)
- {
- closeFloater();
- }
+ getWindow()->decBusyCount();
+ mPendingUploads--;
+ if (mPendingUploads <= 0 && mCloseAfterSave)
+ {
+ closeFloater();
+ }
}
// static
void LLLiveLSLEditor::onLoad(void* userdata)
{
- LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
- self->loadAsset();
+ LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
+ self->loadAsset();
}
// static
void LLLiveLSLEditor::onSave(void* userdata, BOOL close_after_save)
{
- LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
- if(self)
- {
- self->mCloseAfterSave = close_after_save;
- self->mScriptEd->mErrorList->setCommentText("");
- self->saveIfNeeded();
- }
+ LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
+ if(self)
+ {
+ self->mCloseAfterSave = close_after_save;
+ self->mScriptEd->mErrorList->setCommentText("");
+ self->saveIfNeeded();
+ }
}
// static
void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**)
{
- LLUUID item_id;
- LLUUID object_id;
- msg->getUUIDFast(_PREHASH_Script, _PREHASH_ObjectID, object_id);
- msg->getUUIDFast(_PREHASH_Script, _PREHASH_ItemID, item_id);
-
- LLSD floater_key;
- floater_key["taskid"] = object_id;
- floater_key["itemid"] = item_id;
- LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key);
- if(instance)
- {
- instance->mHaveRunningInfo = TRUE;
- BOOL running;
- msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running);
- LLCheckBoxCtrl* runningCheckbox = instance->getChild<LLCheckBoxCtrl>("running");
- runningCheckbox->set(running);
- BOOL mono;
- msg->getBOOLFast(_PREHASH_Script, "Mono", mono);
- LLCheckBoxCtrl* monoCheckbox = instance->getChild<LLCheckBoxCtrl>("mono");
- monoCheckbox->setEnabled(instance->getIsModifiable() && have_script_upload_cap(object_id));
- monoCheckbox->set(mono);
- }
+ LLUUID item_id;
+ LLUUID object_id;
+ msg->getUUIDFast(_PREHASH_Script, _PREHASH_ObjectID, object_id);
+ msg->getUUIDFast(_PREHASH_Script, _PREHASH_ItemID, item_id);
+
+ LLSD floater_key;
+ floater_key["taskid"] = object_id;
+ floater_key["itemid"] = item_id;
+ LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key);
+ if(instance)
+ {
+ instance->mHaveRunningInfo = TRUE;
+ BOOL running;
+ msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running);
+ LLCheckBoxCtrl* runningCheckbox = instance->getChild<LLCheckBoxCtrl>("running");
+ runningCheckbox->set(running);
+ BOOL mono;
+ msg->getBOOLFast(_PREHASH_Script, "Mono", mono);
+ LLCheckBoxCtrl* monoCheckbox = instance->getChild<LLCheckBoxCtrl>("mono");
+ monoCheckbox->setEnabled(instance->getIsModifiable() && have_script_upload_cap(object_id));
+ monoCheckbox->set(mono);
+ }
}
void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata)
{
- LLLiveLSLEditor* self = static_cast<LLLiveLSLEditor*>(userdata);
- self->mMonoCheckbox->setEnabled(have_script_upload_cap(self->mObjectUUID));
- self->mScriptEd->enableSave(self->getIsModifiable());
+ LLLiveLSLEditor* self = static_cast<LLLiveLSLEditor*>(userdata);
+ self->mMonoCheckbox->setEnabled(have_script_upload_cap(self->mObjectUUID));
+ self->mScriptEd->enableSave(self->getIsModifiable());
}
BOOL LLLiveLSLEditor::monoChecked() const
{
- if(NULL != mMonoCheckbox)
- {
- return mMonoCheckbox->getValue()? TRUE : FALSE;
- }
- return FALSE;
+ if(NULL != mMonoCheckbox)
+ {
+ return mMonoCheckbox->getValue()? TRUE : FALSE;
+ }
+ return FALSE;
}
void LLLiveLSLEditor::setAssociatedExperience( LLHandle<LLLiveLSLEditor> editor, const LLSD& experience )
{
- LLLiveLSLEditor* scriptEd = editor.get();
- if(scriptEd)
- {
- LLUUID id;
- if(experience.has(LLExperienceCache::EXPERIENCE_ID))
- {
- id=experience[LLExperienceCache::EXPERIENCE_ID].asUUID();
- }
- scriptEd->mScriptEd->setAssociatedExperience(id);
- scriptEd->updateExperiencePanel();
- }
+ LLLiveLSLEditor* scriptEd = editor.get();
+ if(scriptEd)
+ {
+ LLUUID id;
+ if(experience.has(LLExperienceCache::EXPERIENCE_ID))
+ {
+ id=experience[LLExperienceCache::EXPERIENCE_ID].asUUID();
+ }
+ scriptEd->mScriptEd->setAssociatedExperience(id);
+ scriptEd->updateExperiencePanel();
+ }
}
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index dc49770699..e554f049a5 100644
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewscript.h
* @brief LLPreviewScript class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,7 +45,7 @@ class LLButton;
class LLCheckBoxCtrl;
class LLScrollListCtrl;
class LLViewerObject;
-struct LLEntryAndEdCore;
+struct LLEntryAndEdCore;
class LLMenuBarGL;
class LLFloaterScriptSearch;
class LLKeywordToken;
@@ -68,84 +68,84 @@ public:
protected:
/*virtual*/ bool loadFile();
- change_callback_t mOnChangeCallback;
- bool mIgnoreNextUpdate;
+ change_callback_t mOnChangeCallback;
+ bool mIgnoreNextUpdate;
};
// Inner, implementation class. LLPreviewScript and LLLiveLSLEditor each own one of these.
class LLScriptEdCore : public LLPanel
{
- friend class LLPreviewScript;
- friend class LLPreviewLSL;
- friend class LLLiveLSLEditor;
- friend class LLFloaterScriptSearch;
- friend class LLScriptEdContainer;
- friend class LLFloaterGotoLine;
+ friend class LLPreviewScript;
+ friend class LLPreviewLSL;
+ friend class LLLiveLSLEditor;
+ friend class LLFloaterScriptSearch;
+ friend class LLScriptEdContainer;
+ friend class LLFloaterGotoLine;
protected:
- // Supposed to be invoked only by the container.
- LLScriptEdCore(
- LLScriptEdContainer* container,
- const std::string& sample,
- const LLHandle<LLFloater>& floater_handle,
- void (*load_callback)(void* userdata),
- void (*save_callback)(void* userdata, BOOL close_after_save),
- void (*search_replace_callback)(void* userdata),
- void* userdata,
- bool live,
- S32 bottom_pad = 0); // pad below bottom row of buttons
+ // Supposed to be invoked only by the container.
+ LLScriptEdCore(
+ LLScriptEdContainer* container,
+ const std::string& sample,
+ const LLHandle<LLFloater>& floater_handle,
+ void (*load_callback)(void* userdata),
+ void (*save_callback)(void* userdata, BOOL close_after_save),
+ void (*search_replace_callback)(void* userdata),
+ void* userdata,
+ bool live,
+ S32 bottom_pad = 0); // pad below bottom row of buttons
public:
- ~LLScriptEdCore();
-
- void initializeKeywords();
- void initMenu();
- void processKeywords();
- void processLoaded();
-
- virtual void draw();
- /*virtual*/ BOOL postBuild();
- BOOL canClose();
- void setEnableEditing(bool enable);
- bool canLoadOrSaveToFile( void* userdata );
-
- void setScriptText(const std::string& text, BOOL is_valid);
- void makeEditorPristine();
- bool loadScriptText(const std::string& filename);
- bool writeToFile(const std::string& filename);
- void sync();
-
- void doSave( BOOL close_after_save );
-
- bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
- bool handleReloadFromServerDialog(const LLSD& notification, const LLSD& response);
-
- void openInExternalEditor();
-
- static void onCheckLock(LLUICtrl*, void*);
- static void onHelpComboCommit(LLUICtrl* ctrl, void* userdata);
- static void onClickBack(void* userdata);
- static void onClickForward(void* userdata);
- static void onBtnInsertSample(void*);
- static void onBtnInsertFunction(LLUICtrl*, void*);
- static void onBtnLoadFromFile(void*);
- static void onBtnSaveToFile(void*);
-
- static void loadScriptFromFile(const std::vector<std::string>& filenames, void* data);
- static void saveScriptToFile(const std::vector<std::string>& filenames, void* data);
-
- static bool enableSaveToFileMenu(void* userdata);
- static bool enableLoadFromFileMenu(void* userdata);
-
- virtual bool hasAccelerators() const { return true; }
- LLUUID getAssociatedExperience()const;
- void setAssociatedExperience( const LLUUID& experience_id );
-
- void setScriptName(const std::string& name){mScriptName = name;};
-
- void setItemRemoved(bool script_removed){mScriptRemoved = script_removed;};
-
- void setAssetID( const LLUUID& asset_id){ mAssetID = asset_id; };
- LLUUID getAssetID() { return mAssetID; }
+ ~LLScriptEdCore();
+
+ void initializeKeywords();
+ void initMenu();
+ void processKeywords();
+ void processLoaded();
+
+ virtual void draw();
+ /*virtual*/ BOOL postBuild();
+ BOOL canClose();
+ void setEnableEditing(bool enable);
+ bool canLoadOrSaveToFile( void* userdata );
+
+ void setScriptText(const std::string& text, BOOL is_valid);
+ void makeEditorPristine();
+ bool loadScriptText(const std::string& filename);
+ bool writeToFile(const std::string& filename);
+ void sync();
+
+ void doSave( BOOL close_after_save );
+
+ bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
+ bool handleReloadFromServerDialog(const LLSD& notification, const LLSD& response);
+
+ void openInExternalEditor();
+
+ static void onCheckLock(LLUICtrl*, void*);
+ static void onHelpComboCommit(LLUICtrl* ctrl, void* userdata);
+ static void onClickBack(void* userdata);
+ static void onClickForward(void* userdata);
+ static void onBtnInsertSample(void*);
+ static void onBtnInsertFunction(LLUICtrl*, void*);
+ static void onBtnLoadFromFile(void*);
+ static void onBtnSaveToFile(void*);
+
+ static void loadScriptFromFile(const std::vector<std::string>& filenames, void* data);
+ static void saveScriptToFile(const std::vector<std::string>& filenames, void* data);
+
+ static bool enableSaveToFileMenu(void* userdata);
+ static bool enableLoadFromFileMenu(void* userdata);
+
+ virtual bool hasAccelerators() const { return true; }
+ LLUUID getAssociatedExperience()const;
+ void setAssociatedExperience( const LLUUID& experience_id );
+
+ void setScriptName(const std::string& name){mScriptName = name;};
+
+ void setItemRemoved(bool script_removed){mScriptRemoved = script_removed;};
+
+ void setAssetID( const LLUUID& asset_id){ mAssetID = asset_id; };
+ LLUUID getAssetID() { return mAssetID; }
bool isFontSizeChecked(const LLSD &userdata);
void onChangeFontSize(const LLSD &size_name);
@@ -154,116 +154,116 @@ public:
void selectAll() { mEditor->selectAll(); }
private:
- void onBtnDynamicHelp();
- void onBtnUndoChanges();
+ void onBtnDynamicHelp();
+ void onBtnUndoChanges();
- bool hasChanged();
+ bool hasChanged();
- void selectFirstError();
+ void selectFirstError();
- void enableSave(BOOL b) {mEnableSave = b;}
+ void enableSave(BOOL b) {mEnableSave = b;}
protected:
- void deleteBridges();
- void setHelpPage(const std::string& help_string);
- void updateDynamicHelp(BOOL immediate = FALSE);
- bool isKeyword(LLKeywordToken* token);
- void addHelpItemToHistory(const std::string& help_string);
- static void onErrorList(LLUICtrl*, void* user_data);
+ void deleteBridges();
+ void setHelpPage(const std::string& help_string);
+ void updateDynamicHelp(BOOL immediate = FALSE);
+ bool isKeyword(LLKeywordToken* token);
+ void addHelpItemToHistory(const std::string& help_string);
+ static void onErrorList(LLUICtrl*, void* user_data);
- bool mLive;
+ bool mLive;
private:
- std::string mSampleText;
- std::string mScriptName;
- LLScriptEditor* mEditor;
- void (*mLoadCallback)(void* userdata);
- void (*mSaveCallback)(void* userdata, BOOL close_after_save);
- void (*mSearchReplaceCallback) (void* userdata);
- void* mUserdata;
- LLComboBox *mFunctions;
- BOOL mForceClose;
- LLPanel* mCodePanel;
- LLScrollListCtrl* mErrorList;
- std::vector<LLEntryAndEdCore*> mBridges;
- LLHandle<LLFloater> mLiveHelpHandle;
- LLKeywordToken* mLastHelpToken;
- LLFrameTimer mLiveHelpTimer;
- S32 mLiveHelpHistorySize;
- BOOL mEnableSave;
- BOOL mHasScriptData;
- LLLiveLSLFile* mLiveFile;
- LLUUID mAssociatedExperience;
- BOOL mScriptRemoved;
- BOOL mSaveDialogShown;
+ std::string mSampleText;
+ std::string mScriptName;
+ LLScriptEditor* mEditor;
+ void (*mLoadCallback)(void* userdata);
+ void (*mSaveCallback)(void* userdata, BOOL close_after_save);
+ void (*mSearchReplaceCallback) (void* userdata);
+ void* mUserdata;
+ LLComboBox *mFunctions;
+ BOOL mForceClose;
+ LLPanel* mCodePanel;
+ LLScrollListCtrl* mErrorList;
+ std::vector<LLEntryAndEdCore*> mBridges;
+ LLHandle<LLFloater> mLiveHelpHandle;
+ LLKeywordToken* mLastHelpToken;
+ LLFrameTimer mLiveHelpTimer;
+ S32 mLiveHelpHistorySize;
+ BOOL mEnableSave;
+ BOOL mHasScriptData;
+ LLLiveLSLFile* mLiveFile;
+ LLUUID mAssociatedExperience;
+ BOOL mScriptRemoved;
+ BOOL mSaveDialogShown;
LLUUID mAssetID;
- LLScriptEdContainer* mContainer; // parent view
+ LLScriptEdContainer* mContainer; // parent view
public:
- boost::signals2::connection mSyntaxIDConnection;
+ boost::signals2::connection mSyntaxIDConnection;
};
class LLScriptEdContainer : public LLPreview
{
- friend class LLScriptEdCore;
+ friend class LLScriptEdCore;
public:
- LLScriptEdContainer(const LLSD& key);
- LLScriptEdContainer(const LLSD& key, const bool live);
+ LLScriptEdContainer(const LLSD& key);
+ LLScriptEdContainer(const LLSD& key, const bool live);
BOOL handleKeyHere(KEY key, MASK mask);
protected:
- std::string getTmpFileName(const std::string& script_name);
- bool onExternalChange(const std::string& filename);
- virtual void saveIfNeeded(bool sync = true) = 0;
+ std::string getTmpFileName(const std::string& script_name);
+ bool onExternalChange(const std::string& filename);
+ virtual void saveIfNeeded(bool sync = true) = 0;
- LLScriptEdCore* mScriptEd;
+ LLScriptEdCore* mScriptEd;
};
// Used to view and edit an LSL script from your inventory.
class LLPreviewLSL : public LLScriptEdContainer
{
public:
- LLPreviewLSL(const LLSD& key );
+ LLPreviewLSL(const LLSD& key );
~LLPreviewLSL();
LLUUID getScriptID() { return mItemUUID; }
void setDirty() { mDirty = true; }
- virtual void callbackLSLCompileSucceeded();
- virtual void callbackLSLCompileFailed(const LLSD& compile_errors);
+ virtual void callbackLSLCompileSucceeded();
+ virtual void callbackLSLCompileFailed(const LLSD& compile_errors);
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
protected:
- virtual void draw();
- virtual BOOL canClose();
- void closeIfNeeded();
+ virtual void draw();
+ virtual BOOL canClose();
+ void closeIfNeeded();
+
+ virtual void loadAsset();
+ /*virtual*/ void saveIfNeeded(bool sync = true);
- virtual void loadAsset();
- /*virtual*/ void saveIfNeeded(bool sync = true);
+ static void onSearchReplace(void* userdata);
+ static void onLoad(void* userdata);
+ static void onSave(void* userdata, BOOL close_after_save);
- static void onSearchReplace(void* userdata);
- static void onLoad(void* userdata);
- static void onSave(void* userdata, BOOL close_after_save);
-
- static void onLoadComplete(const LLUUID& uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status);
+ static void onLoadComplete(const LLUUID& uuid,
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status);
protected:
- static void* createScriptEdPanel(void* userdata);
+ static void* createScriptEdPanel(void* userdata);
static void finishedLSLUpload(LLUUID itemId, LLSD response);
static bool failedLSLUpload(LLUUID itemId, LLUUID taskId, LLSD response, std::string reason);
protected:
- // Can safely close only after both text and bytecode are uploaded
- S32 mPendingUploads;
+ // Can safely close only after both text and bytecode are uploaded
+ S32 mPendingUploads;
LLScriptMovedObserver* mItemObserver;
@@ -273,92 +273,92 @@ protected:
// Used to view and edit an LSL script that is attached to an object.
class LLLiveLSLEditor : public LLScriptEdContainer
{
- friend class LLLiveLSLFile;
-public:
- LLLiveLSLEditor(const LLSD& key);
+ friend class LLLiveLSLFile;
+public:
+ LLLiveLSLEditor(const LLSD& key);
- static void processScriptRunningReply(LLMessageSystem* msg, void**);
+ static void processScriptRunningReply(LLMessageSystem* msg, void**);
- virtual void callbackLSLCompileSucceeded(const LLUUID& task_id,
- const LLUUID& item_id,
- bool is_script_running);
- virtual void callbackLSLCompileFailed(const LLSD& compile_errors);
+ virtual void callbackLSLCompileSucceeded(const LLUUID& task_id,
+ const LLUUID& item_id,
+ bool is_script_running);
+ virtual void callbackLSLCompileFailed(const LLSD& compile_errors);
+
+ /*virtual*/ BOOL postBuild();
- /*virtual*/ BOOL postBuild();
-
void setIsNew() { mIsNew = TRUE; }
- static void setAssociatedExperience( LLHandle<LLLiveLSLEditor> editor, const LLSD& experience );
- static void onToggleExperience(LLUICtrl *ui, void* userdata);
- static void onViewProfile(LLUICtrl *ui, void* userdata);
+ static void setAssociatedExperience( LLHandle<LLLiveLSLEditor> editor, const LLSD& experience );
+ static void onToggleExperience(LLUICtrl *ui, void* userdata);
+ static void onViewProfile(LLUICtrl *ui, void* userdata);
- void setExperienceIds(const LLSD& experience_ids);
- void buildExperienceList();
- void updateExperiencePanel();
- void requestExperiences();
- void experienceChanged();
- void addAssociatedExperience(const LLSD& experience);
+ void setExperienceIds(const LLSD& experience_ids);
+ void buildExperienceList();
+ void updateExperiencePanel();
+ void requestExperiences();
+ void experienceChanged();
+ void addAssociatedExperience(const LLSD& experience);
void setObjectName(std::string name) { mObjectName = name; }
-
+
private:
- virtual BOOL canClose();
- void closeIfNeeded();
- virtual void draw();
+ virtual BOOL canClose();
+ void closeIfNeeded();
+ virtual void draw();
- virtual void loadAsset();
- void loadAsset(BOOL is_new);
- /*virtual*/ void saveIfNeeded(bool sync = true);
- BOOL monoChecked() const;
+ virtual void loadAsset();
+ void loadAsset(BOOL is_new);
+ /*virtual*/ void saveIfNeeded(bool sync = true);
+ BOOL monoChecked() const;
- static void onSearchReplace(void* userdata);
- static void onLoad(void* userdata);
- static void onSave(void* userdata, BOOL close_after_save);
+ static void onSearchReplace(void* userdata);
+ static void onLoad(void* userdata);
+ static void onSave(void* userdata, BOOL close_after_save);
- static void onLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status);
- static void onRunningCheckboxClicked(LLUICtrl*, void* userdata);
- static void onReset(void* userdata);
+ static void onLoadComplete(const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status);
+ static void onRunningCheckboxClicked(LLUICtrl*, void* userdata);
+ static void onReset(void* userdata);
- void loadScriptText(const LLUUID &uuid, LLAssetType::EType type);
+ void loadScriptText(const LLUUID &uuid, LLAssetType::EType type);
- static void onErrorList(LLUICtrl*, void* user_data);
+ static void onErrorList(LLUICtrl*, void* user_data);
- static void* createScriptEdPanel(void* userdata);
+ static void* createScriptEdPanel(void* userdata);
- static void onMonoCheckboxClicked(LLUICtrl*, void* userdata);
+ static void onMonoCheckboxClicked(LLUICtrl*, void* userdata);
static void finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, bool isRunning);
static void receiveExperienceIds(LLSD result, LLHandle<LLLiveLSLEditor> parent);
private:
- bool mIsNew;
- //LLUUID mTransmitID;
- LLCheckBoxCtrl* mRunningCheckbox;
- BOOL mAskedForRunningInfo;
- BOOL mHaveRunningInfo;
- LLButton* mResetButton;
- LLPointer<LLViewerInventoryItem> mItem;
- BOOL mCloseAfterSave;
- // need to save both text and script, so need to decide when done
- S32 mPendingUploads;
+ bool mIsNew;
+ //LLUUID mTransmitID;
+ LLCheckBoxCtrl* mRunningCheckbox;
+ BOOL mAskedForRunningInfo;
+ BOOL mHaveRunningInfo;
+ LLButton* mResetButton;
+ LLPointer<LLViewerInventoryItem> mItem;
+ BOOL mCloseAfterSave;
+ // need to save both text and script, so need to decide when done
+ S32 mPendingUploads;
- BOOL mIsSaving;
+ BOOL mIsSaving;
- BOOL getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert
+ BOOL getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert
- LLCheckBoxCtrl* mMonoCheckbox;
- BOOL mIsModifiable;
+ LLCheckBoxCtrl* mMonoCheckbox;
+ BOOL mIsModifiable;
- LLComboBox* mExperiences;
- LLCheckBoxCtrl* mExperienceEnabled;
- LLSD mExperienceIds;
+ LLComboBox* mExperiences;
+ LLCheckBoxCtrl* mExperienceEnabled;
+ LLSD mExperienceIds;
- LLHandle<LLFloater> mExperienceProfile;
+ LLHandle<LLFloater> mExperienceProfile;
std::string mObjectName;
};
diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp
index 105c5e8cbe..3c910171cf 100644
--- a/indra/newview/llpreviewsound.cpp
+++ b/indra/newview/llpreviewsound.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewsound.cpp
* @brief LLPreviewSound class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,53 +48,53 @@ LLPreviewSound::LLPreviewSound(const LLSD& key)
}
// virtual
-BOOL LLPreviewSound::postBuild()
+BOOL LLPreviewSound::postBuild()
{
- const LLInventoryItem* item = getItem();
- if (item)
- {
- getChild<LLUICtrl>("desc")->setValue(item->getDescription());
- if (gAudiop)
- {
- gAudiop->preloadSound(item->getAssetUUID()); // preload the sound
- }
- }
-
- childSetAction("Sound play btn",&LLPreviewSound::playSound,this);
- childSetAction("Sound audition btn",&LLPreviewSound::auditionSound,this);
+ const LLInventoryItem* item = getItem();
+ if (item)
+ {
+ getChild<LLUICtrl>("desc")->setValue(item->getDescription());
+ if (gAudiop)
+ {
+ gAudiop->preloadSound(item->getAssetUUID()); // preload the sound
+ }
+ }
+
+ childSetAction("Sound play btn",&LLPreviewSound::playSound,this);
+ childSetAction("Sound audition btn",&LLPreviewSound::auditionSound,this);
+
+ LLButton* button = getChild<LLButton>("Sound play btn");
+ button->setSoundFlags(LLView::SILENT);
- LLButton* button = getChild<LLButton>("Sound play btn");
- button->setSoundFlags(LLView::SILENT);
-
- button = getChild<LLButton>("Sound audition btn");
- button->setSoundFlags(LLView::SILENT);
+ button = getChild<LLButton>("Sound audition btn");
+ button->setSoundFlags(LLView::SILENT);
- childSetCommitCallback("desc", LLPreview::onText, this);
- getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ childSetCommitCallback("desc", LLPreview::onText, this);
+ getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
- return LLPreview::postBuild();
+ return LLPreview::postBuild();
}
// static
void LLPreviewSound::playSound( void *userdata )
{
- LLPreviewSound* self = (LLPreviewSound*) userdata;
- const LLInventoryItem *item = self->getItem();
+ LLPreviewSound* self = (LLPreviewSound*) userdata;
+ const LLInventoryItem *item = self->getItem();
- if(item && gAudiop)
- {
- send_sound_trigger(item->getAssetUUID(), SOUND_GAIN);
- }
+ if(item && gAudiop)
+ {
+ send_sound_trigger(item->getAssetUUID(), SOUND_GAIN);
+ }
}
// static
void LLPreviewSound::auditionSound( void *userdata )
{
- LLPreviewSound* self = (LLPreviewSound*) userdata;
- const LLInventoryItem *item = self->getItem();
+ LLPreviewSound* self = (LLPreviewSound*) userdata;
+ const LLInventoryItem *item = self->getItem();
- if(item && gAudiop)
- {
- gAudiop->triggerSound(item->getAssetUUID(), gAgent.getID(), SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_SFX);
- }
+ if(item && gAudiop)
+ {
+ gAudiop->triggerSound(item->getAssetUUID(), gAgent.getID(), SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_SFX);
+ }
}
diff --git a/indra/newview/llpreviewsound.h b/indra/newview/llpreviewsound.h
index 0453bfd936..e1bca7f4e3 100644
--- a/indra/newview/llpreviewsound.h
+++ b/indra/newview/llpreviewsound.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewsound.h
* @brief LLPreviewSound class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,13 +32,13 @@
class LLPreviewSound : public LLPreview
{
public:
- LLPreviewSound(const LLSD& key);
+ LLPreviewSound(const LLSD& key);
- static void playSound( void* userdata );
- static void auditionSound( void* userdata );
+ static void playSound( void* userdata );
+ static void auditionSound( void* userdata );
protected:
- /* virtual */ BOOL postBuild();
+ /* virtual */ BOOL postBuild();
};
#endif // LL_LLPREVIEWSOUND_H
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index ea7d4800e0..5e19d770a6 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewtexture.cpp
* @brief LLPreviewTexture class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -65,89 +65,89 @@ const F32 PREVIEW_TEXTURE_MIN_ASPECT = 0.005f;
LLPreviewTexture::LLPreviewTexture(const LLSD& key)
- : LLPreview(key),
- mLoadingFullImage( FALSE ),
- mShowKeepDiscard(FALSE),
- mCopyToInv(FALSE),
- mIsCopyable(FALSE),
- mIsFullPerm(FALSE),
- mUpdateDimensions(TRUE),
- mLastHeight(0),
- mLastWidth(0),
- mAspectRatio(0.f),
- mPreviewToSave(FALSE),
- mImage(NULL),
- mImageOldBoostLevel(LLGLTexture::BOOST_NONE)
+ : LLPreview(key),
+ mLoadingFullImage( FALSE ),
+ mShowKeepDiscard(FALSE),
+ mCopyToInv(FALSE),
+ mIsCopyable(FALSE),
+ mIsFullPerm(FALSE),
+ mUpdateDimensions(TRUE),
+ mLastHeight(0),
+ mLastWidth(0),
+ mAspectRatio(0.f),
+ mPreviewToSave(FALSE),
+ mImage(NULL),
+ mImageOldBoostLevel(LLGLTexture::BOOST_NONE)
{
- updateImageID();
- if (key.has("save_as"))
- {
- mPreviewToSave = TRUE;
- }
+ updateImageID();
+ if (key.has("save_as"))
+ {
+ mPreviewToSave = TRUE;
+ }
}
LLPreviewTexture::~LLPreviewTexture()
{
- LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ;
-
- if( mLoadingFullImage )
- {
- getWindow()->decBusyCount();
- }
-
- if (mImage.notNull())
- {
- mImage->setBoostLevel(mImageOldBoostLevel);
- mImage = NULL;
- }
+ LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ;
+
+ if( mLoadingFullImage )
+ {
+ getWindow()->decBusyCount();
+ }
+
+ if (mImage.notNull())
+ {
+ mImage->setBoostLevel(mImageOldBoostLevel);
+ mImage = NULL;
+ }
}
void LLPreviewTexture::populateRatioList()
{
- // Fill in ratios list with common aspect ratio values
- mRatiosList.clear();
- mRatiosList.push_back(LLTrans::getString("Unconstrained"));
- mRatiosList.push_back("1:1");
- mRatiosList.push_back("4:3");
- mRatiosList.push_back("10:7");
- mRatiosList.push_back("3:2");
- mRatiosList.push_back("16:10");
- mRatiosList.push_back("16:9");
- mRatiosList.push_back("2:1");
-
- // Now fill combo box with provided list
- LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
- combo->removeall();
-
- for (std::vector<std::string>::const_iterator it = mRatiosList.begin(); it != mRatiosList.end(); ++it)
- {
- combo->add(*it);
- }
+ // Fill in ratios list with common aspect ratio values
+ mRatiosList.clear();
+ mRatiosList.push_back(LLTrans::getString("Unconstrained"));
+ mRatiosList.push_back("1:1");
+ mRatiosList.push_back("4:3");
+ mRatiosList.push_back("10:7");
+ mRatiosList.push_back("3:2");
+ mRatiosList.push_back("16:10");
+ mRatiosList.push_back("16:9");
+ mRatiosList.push_back("2:1");
+
+ // Now fill combo box with provided list
+ LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
+ combo->removeall();
+
+ for (std::vector<std::string>::const_iterator it = mRatiosList.begin(); it != mRatiosList.end(); ++it)
+ {
+ combo->add(*it);
+ }
}
// virtual
BOOL LLPreviewTexture::postBuild()
{
- if (mCopyToInv)
- {
- getChild<LLButton>("Keep")->setLabel(getString("Copy"));
- childSetAction("Keep",LLPreview::onBtnCopyToInv,this);
- getChildView("Discard")->setVisible( false);
- }
- else if (mShowKeepDiscard)
- {
- childSetAction("Keep",onKeepBtn,this);
- childSetAction("Discard",onDiscardBtn,this);
- }
- else
- {
- getChildView("Keep")->setVisible( false);
- getChildView("Discard")->setVisible( false);
- }
-
- childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this);
- getChildView("save_tex_btn")->setVisible( true);
- getChildView("save_tex_btn")->setEnabled(canSaveAs());
+ if (mCopyToInv)
+ {
+ getChild<LLButton>("Keep")->setLabel(getString("Copy"));
+ childSetAction("Keep",LLPreview::onBtnCopyToInv,this);
+ getChildView("Discard")->setVisible( false);
+ }
+ else if (mShowKeepDiscard)
+ {
+ childSetAction("Keep",onKeepBtn,this);
+ childSetAction("Discard",onDiscardBtn,this);
+ }
+ else
+ {
+ getChildView("Keep")->setVisible( false);
+ getChildView("Discard")->setVisible( false);
+ }
+
+ childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this);
+ getChildView("save_tex_btn")->setVisible( true);
+ getChildView("save_tex_btn")->setEnabled(canSaveAs());
const LLInventoryItem* item = getItem();
if (item)
@@ -165,119 +165,119 @@ BOOL LLPreviewTexture::postBuild()
}
}
- // Fill in ratios list and combo box with common aspect ratio values
- populateRatioList();
+ // Fill in ratios list and combo box with common aspect ratio values
+ populateRatioList();
- childSetCommitCallback("combo_aspect_ratio", onAspectRatioCommit, this);
+ childSetCommitCallback("combo_aspect_ratio", onAspectRatioCommit, this);
- LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
- combo->setCurrentByIndex(0);
-
- return LLPreview::postBuild();
+ LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
+ combo->setCurrentByIndex(0);
+
+ return LLPreview::postBuild();
}
// static
void LLPreviewTexture::onSaveAsBtn(void* data)
{
- LLPreviewTexture* self = (LLPreviewTexture*)data;
- self->saveAs();
+ LLPreviewTexture* self = (LLPreviewTexture*)data;
+ self->saveAs();
}
void LLPreviewTexture::draw()
{
- updateDimensions();
-
- LLPreview::draw();
-
- if (!isMinimized())
- {
- LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- const LLRect& border = mClientRect;
- LLRect interior = mClientRect;
- interior.stretch( -PREVIEW_BORDER_WIDTH );
-
- // ...border
- gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f));
- gl_rect_2d_checkerboard( interior );
-
- if ( mImage.notNull() )
- {
- // Draw the texture
- gGL.diffuseColor3f( 1.f, 1.f, 1.f );
- gl_draw_scaled_image(interior.mLeft,
- interior.mBottom,
- interior.getWidth(),
- interior.getHeight(),
- mImage);
-
- // Pump the texture priority
- F32 pixel_area = mLoadingFullImage ? (F32)MAX_IMAGE_AREA : (F32)(interior.getWidth() * interior.getHeight() );
- mImage->addTextureStats( pixel_area );
-
- // Don't bother decoding more than we can display, unless
- // we're loading the full image.
- if (!mLoadingFullImage)
- {
- S32 int_width = interior.getWidth();
- S32 int_height = interior.getHeight();
- mImage->setKnownDrawSize(int_width, int_height);
- }
- else
- {
- // Don't use this feature
- mImage->setKnownDrawSize(0, 0);
- }
-
- if( mLoadingFullImage )
- {
- LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("Receiving"), 0,
- interior.mLeft + 4,
- interior.mBottom + 4,
- LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
- LLFontGL::NORMAL,
- LLFontGL::DROP_SHADOW);
-
- F32 data_progress = mImage->getDownloadProgress() ;
-
- // Draw the progress bar.
- const S32 BAR_HEIGHT = 12;
- const S32 BAR_LEFT_PAD = 80;
- S32 left = interior.mLeft + 4 + BAR_LEFT_PAD;
- S32 bar_width = getRect().getWidth() - left - RESIZE_HANDLE_WIDTH - 2;
- S32 top = interior.mBottom + 4 + BAR_HEIGHT;
- S32 right = left + bar_width;
- S32 bottom = top - BAR_HEIGHT;
-
- LLColor4 background_color(0.f, 0.f, 0.f, 0.75f);
- LLColor4 decoded_color(0.f, 1.f, 0.f, 1.0f);
- LLColor4 downloaded_color(0.f, 0.5f, 0.f, 1.0f);
-
- gl_rect_2d(left, top, right, bottom, background_color);
-
- if (data_progress > 0.0f)
- {
- // Downloaded bytes
- right = left + llfloor(data_progress * (F32)bar_width);
- if (right > left)
- {
- gl_rect_2d(left, top, right, bottom, downloaded_color);
- }
- }
- }
- else
- if( !mSavedFileTimer.hasExpired() )
- {
- LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("FileSaved"), 0,
- interior.mLeft + 4,
- interior.mBottom + 4,
- LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
- LLFontGL::NORMAL,
- LLFontGL::DROP_SHADOW);
- }
- }
- }
+ updateDimensions();
+
+ LLPreview::draw();
+
+ if (!isMinimized())
+ {
+ LLGLSUIDefault gls_ui;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ const LLRect& border = mClientRect;
+ LLRect interior = mClientRect;
+ interior.stretch( -PREVIEW_BORDER_WIDTH );
+
+ // ...border
+ gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f));
+ gl_rect_2d_checkerboard( interior );
+
+ if ( mImage.notNull() )
+ {
+ // Draw the texture
+ gGL.diffuseColor3f( 1.f, 1.f, 1.f );
+ gl_draw_scaled_image(interior.mLeft,
+ interior.mBottom,
+ interior.getWidth(),
+ interior.getHeight(),
+ mImage);
+
+ // Pump the texture priority
+ F32 pixel_area = mLoadingFullImage ? (F32)MAX_IMAGE_AREA : (F32)(interior.getWidth() * interior.getHeight() );
+ mImage->addTextureStats( pixel_area );
+
+ // Don't bother decoding more than we can display, unless
+ // we're loading the full image.
+ if (!mLoadingFullImage)
+ {
+ S32 int_width = interior.getWidth();
+ S32 int_height = interior.getHeight();
+ mImage->setKnownDrawSize(int_width, int_height);
+ }
+ else
+ {
+ // Don't use this feature
+ mImage->setKnownDrawSize(0, 0);
+ }
+
+ if( mLoadingFullImage )
+ {
+ LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("Receiving"), 0,
+ interior.mLeft + 4,
+ interior.mBottom + 4,
+ LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
+ LLFontGL::NORMAL,
+ LLFontGL::DROP_SHADOW);
+
+ F32 data_progress = mImage->getDownloadProgress() ;
+
+ // Draw the progress bar.
+ const S32 BAR_HEIGHT = 12;
+ const S32 BAR_LEFT_PAD = 80;
+ S32 left = interior.mLeft + 4 + BAR_LEFT_PAD;
+ S32 bar_width = getRect().getWidth() - left - RESIZE_HANDLE_WIDTH - 2;
+ S32 top = interior.mBottom + 4 + BAR_HEIGHT;
+ S32 right = left + bar_width;
+ S32 bottom = top - BAR_HEIGHT;
+
+ LLColor4 background_color(0.f, 0.f, 0.f, 0.75f);
+ LLColor4 decoded_color(0.f, 1.f, 0.f, 1.0f);
+ LLColor4 downloaded_color(0.f, 0.5f, 0.f, 1.0f);
+
+ gl_rect_2d(left, top, right, bottom, background_color);
+
+ if (data_progress > 0.0f)
+ {
+ // Downloaded bytes
+ right = left + llfloor(data_progress * (F32)bar_width);
+ if (right > left)
+ {
+ gl_rect_2d(left, top, right, bottom, downloaded_color);
+ }
+ }
+ }
+ else
+ if( !mSavedFileTimer.hasExpired() )
+ {
+ LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("FileSaved"), 0,
+ interior.mLeft + 4,
+ interior.mBottom + 4,
+ LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
+ LLFontGL::NORMAL,
+ LLFontGL::DROP_SHADOW);
+ }
+ }
+ }
}
@@ -285,45 +285,45 @@ void LLPreviewTexture::draw()
// virtual
BOOL LLPreviewTexture::canSaveAs() const
{
- return mIsFullPerm && !mLoadingFullImage && mImage.notNull() && !mImage->isMissingAsset();
+ return mIsFullPerm && !mLoadingFullImage && mImage.notNull() && !mImage->isMissingAsset();
}
// virtual
void LLPreviewTexture::saveAs()
{
- if( mLoadingFullImage )
- return;
+ if( mLoadingFullImage )
+ return;
- std::string filename = getItem() ? LLDir::getScrubbedFileName(getItem()->getName()) : LLStringUtil::null;
- LLFilePickerReplyThread::startPicker(boost::bind(&LLPreviewTexture::saveTextureToFile, this, _1), LLFilePicker::FFSAVE_TGAPNG, filename);
+ std::string filename = getItem() ? LLDir::getScrubbedFileName(getItem()->getName()) : LLStringUtil::null;
+ LLFilePickerReplyThread::startPicker(boost::bind(&LLPreviewTexture::saveTextureToFile, this, _1), LLFilePicker::FFSAVE_TGAPNG, filename);
}
void LLPreviewTexture::saveTextureToFile(const std::vector<std::string>& filenames)
{
- const LLInventoryItem* item = getItem();
- if (item && mPreviewToSave)
- {
- mPreviewToSave = FALSE;
- LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", item->getUUID());
- }
-
- // remember the user-approved/edited file name.
- mSaveFileName = filenames[0];
- mLoadingFullImage = TRUE;
- getWindow()->incBusyCount();
-
- mImage->forceToSaveRawImage(0);//re-fetch the raw image if the old one is removed.
- mImage->setLoadedCallback(LLPreviewTexture::onFileLoadedForSave,
- 0, TRUE, FALSE, new LLUUID(mItemUUID), &mCallbackTextureList);
+ const LLInventoryItem* item = getItem();
+ if (item && mPreviewToSave)
+ {
+ mPreviewToSave = FALSE;
+ LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", item->getUUID());
+ }
+
+ // remember the user-approved/edited file name.
+ mSaveFileName = filenames[0];
+ mLoadingFullImage = TRUE;
+ getWindow()->incBusyCount();
+
+ mImage->forceToSaveRawImage(0);//re-fetch the raw image if the old one is removed.
+ mImage->setLoadedCallback(LLPreviewTexture::onFileLoadedForSave,
+ 0, TRUE, FALSE, new LLUUID(mItemUUID), &mCallbackTextureList);
}
void LLPreviewTexture::saveMultipleToFile(const std::string& file_name)
{
- std::string texture_location(gSavedSettings.getString("TextureSaveLocation"));
+ std::string texture_location(gSavedSettings.getString("TextureSaveLocation"));
std::string texture_name = file_name.empty() ? getItem()->getName() : file_name;
-
+
std::string filepath;
S32 i = 0;
S32 err = 0;
@@ -345,8 +345,8 @@ void LLPreviewTexture::saveMultipleToFile(const std::string& file_name)
err = LLFile::stat( filepath, &stat_info );
i++;
} while (-1 != err); // Search until the file is not found (i.e., stat() gives an error).
-
-
+
+
mSaveFileName = filepath;
mLoadingFullImage = TRUE;
getWindow()->incBusyCount();
@@ -359,137 +359,137 @@ void LLPreviewTexture::saveMultipleToFile(const std::string& file_name)
// virtual
void LLPreviewTexture::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- LLPreview::reshape(width, height, called_from_parent);
-
- LLRect dim_rect(getChildView("dimensions")->getRect());
-
- S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE;
-
- // add space for dimensions and aspect ratio
- S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD;
- if (getChild<LLLayoutPanel>("buttons_panel")->getVisible())
- {
- info_height += getChild<LLLayoutPanel>("buttons_panel")->getRect().getHeight();
- }
- LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0);
- client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD);
- client_rect.mBottom += PREVIEW_BORDER + CLIENT_RECT_VPAD + info_height ;
-
- S32 client_width = client_rect.getWidth();
- S32 client_height = client_rect.getHeight();
-
- if (mAspectRatio > 0.f)
- {
- if(mAspectRatio > 1.f)
- {
- client_height = llceil((F32)client_width / mAspectRatio);
- if(client_height > client_rect.getHeight())
- {
- client_height = client_rect.getHeight();
- client_width = llceil((F32)client_height * mAspectRatio);
- }
- }
- else//mAspectRatio < 1.f
- {
- client_width = llceil((F32)client_height * mAspectRatio);
- if(client_width > client_rect.getWidth())
- {
- client_width = client_rect.getWidth();
- client_height = llceil((F32)client_width / mAspectRatio);
- }
- }
- }
-
- mClientRect.setLeftTopAndSize(client_rect.getCenterX() - (client_width / 2), client_rect.getCenterY() + (client_height / 2), client_width, client_height);
+ LLPreview::reshape(width, height, called_from_parent);
+
+ LLRect dim_rect(getChildView("dimensions")->getRect());
+
+ S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE;
+
+ // add space for dimensions and aspect ratio
+ S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD;
+ if (getChild<LLLayoutPanel>("buttons_panel")->getVisible())
+ {
+ info_height += getChild<LLLayoutPanel>("buttons_panel")->getRect().getHeight();
+ }
+ LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0);
+ client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD);
+ client_rect.mBottom += PREVIEW_BORDER + CLIENT_RECT_VPAD + info_height ;
+
+ S32 client_width = client_rect.getWidth();
+ S32 client_height = client_rect.getHeight();
+
+ if (mAspectRatio > 0.f)
+ {
+ if(mAspectRatio > 1.f)
+ {
+ client_height = llceil((F32)client_width / mAspectRatio);
+ if(client_height > client_rect.getHeight())
+ {
+ client_height = client_rect.getHeight();
+ client_width = llceil((F32)client_height * mAspectRatio);
+ }
+ }
+ else//mAspectRatio < 1.f
+ {
+ client_width = llceil((F32)client_height * mAspectRatio);
+ if(client_width > client_rect.getWidth())
+ {
+ client_width = client_rect.getWidth();
+ client_height = llceil((F32)client_width / mAspectRatio);
+ }
+ }
+ }
+
+ mClientRect.setLeftTopAndSize(client_rect.getCenterX() - (client_width / 2), client_rect.getCenterY() + (client_height / 2), client_width, client_height);
}
// virtual
void LLPreviewTexture::onFocusReceived()
{
- LLPreview::onFocusReceived();
+ LLPreview::onFocusReceived();
}
void LLPreviewTexture::openToSave()
{
- mPreviewToSave = TRUE;
+ mPreviewToSave = TRUE;
}
void LLPreviewTexture::hideCtrlButtons()
{
- getChildView("desc txt")->setVisible(false);
- getChildView("desc")->setVisible(false);
- getChild<LLLayoutStack>("preview_stack")->collapsePanel(getChild<LLLayoutPanel>("buttons_panel"), true);
- getChild<LLLayoutPanel>("buttons_panel")->setVisible(false);
- getChild<LLComboBox>("combo_aspect_ratio")->setCurrentByIndex(0); //unconstrained
- reshape(getRect().getWidth(), getRect().getHeight());
+ getChildView("desc txt")->setVisible(false);
+ getChildView("desc")->setVisible(false);
+ getChild<LLLayoutStack>("preview_stack")->collapsePanel(getChild<LLLayoutPanel>("buttons_panel"), true);
+ getChild<LLLayoutPanel>("buttons_panel")->setVisible(false);
+ getChild<LLComboBox>("combo_aspect_ratio")->setCurrentByIndex(0); //unconstrained
+ reshape(getRect().getWidth(), getRect().getHeight());
}
// static
-void LLPreviewTexture::onFileLoadedForSave(BOOL success,
- LLViewerFetchedTexture *src_vi,
- LLImageRaw* src,
- LLImageRaw* aux_src,
- S32 discard_level,
- BOOL final,
- void* userdata)
+void LLPreviewTexture::onFileLoadedForSave(BOOL success,
+ LLViewerFetchedTexture *src_vi,
+ LLImageRaw* src,
+ LLImageRaw* aux_src,
+ S32 discard_level,
+ BOOL final,
+ void* userdata)
{
- LLUUID* item_uuid = (LLUUID*) userdata;
-
- LLPreviewTexture* self = LLFloaterReg::findTypedInstance<LLPreviewTexture>("preview_texture", *item_uuid);
-
- if( final || !success )
- {
- delete item_uuid;
-
- if( self )
- {
- self->getWindow()->decBusyCount();
- self->mLoadingFullImage = FALSE;
- }
- }
-
- if( self && final && success )
- {
- const U32 ext_length = 3;
- std::string extension = self->mSaveFileName.substr( self->mSaveFileName.length() - ext_length);
- LLStringUtil::toLower(extension);
- // We only support saving in PNG or TGA format
- LLPointer<LLImageFormatted> image;
- if(extension == "png")
- {
- image = new LLImagePNG;
- }
- else if(extension == "tga")
- {
- image = new LLImageTGA;
- }
-
- if( image && !image->encode( src, 0 ) )
- {
- LLSD args;
- args["FILE"] = self->mSaveFileName;
- LLNotificationsUtil::add("CannotEncodeFile", args);
- }
- else if( image && !image->save( self->mSaveFileName ) )
- {
- LLSD args;
- args["FILE"] = self->mSaveFileName;
- LLNotificationsUtil::add("CannotWriteFile", args);
- }
- else
- {
- self->mSavedFileTimer.reset();
- self->mSavedFileTimer.setTimerExpirySec( SECONDS_TO_SHOW_FILE_SAVED_MSG );
- }
-
- self->mSaveFileName.clear();
- }
-
- if( self && !success )
- {
- LLNotificationsUtil::add("CannotDownloadFile");
- }
+ LLUUID* item_uuid = (LLUUID*) userdata;
+
+ LLPreviewTexture* self = LLFloaterReg::findTypedInstance<LLPreviewTexture>("preview_texture", *item_uuid);
+
+ if( final || !success )
+ {
+ delete item_uuid;
+
+ if( self )
+ {
+ self->getWindow()->decBusyCount();
+ self->mLoadingFullImage = FALSE;
+ }
+ }
+
+ if( self && final && success )
+ {
+ const U32 ext_length = 3;
+ std::string extension = self->mSaveFileName.substr( self->mSaveFileName.length() - ext_length);
+ LLStringUtil::toLower(extension);
+ // We only support saving in PNG or TGA format
+ LLPointer<LLImageFormatted> image;
+ if(extension == "png")
+ {
+ image = new LLImagePNG;
+ }
+ else if(extension == "tga")
+ {
+ image = new LLImageTGA;
+ }
+
+ if( image && !image->encode( src, 0 ) )
+ {
+ LLSD args;
+ args["FILE"] = self->mSaveFileName;
+ LLNotificationsUtil::add("CannotEncodeFile", args);
+ }
+ else if( image && !image->save( self->mSaveFileName ) )
+ {
+ LLSD args;
+ args["FILE"] = self->mSaveFileName;
+ LLNotificationsUtil::add("CannotWriteFile", args);
+ }
+ else
+ {
+ self->mSavedFileTimer.reset();
+ self->mSavedFileTimer.setTimerExpirySec( SECONDS_TO_SHOW_FILE_SAVED_MSG );
+ }
+
+ self->mSaveFileName.clear();
+ }
+
+ if( self && !success )
+ {
+ LLNotificationsUtil::add("CannotDownloadFile");
+ }
}
@@ -498,229 +498,229 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success,
// When we receive it, reshape the window accordingly.
void LLPreviewTexture::updateDimensions()
{
- if (!mImage)
- {
- return;
- }
- if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0)
- {
- return;
- }
-
- S32 img_width = mImage->getFullWidth();
- S32 img_height = mImage->getFullHeight();
-
- if (mAssetStatus != PREVIEW_ASSET_LOADED
- || mLastWidth != img_width
- || mLastHeight != img_height)
- {
- mAssetStatus = PREVIEW_ASSET_LOADED;
- // Asset has been fully loaded, adjust aspect ratio
- adjustAspectRatio();
- }
-
-
- // Update the width/height display every time
- getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", img_width));
- getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", img_height));
-
- mLastHeight = img_height;
- mLastWidth = img_width;
-
- // Reshape the floater only when required
- if (mUpdateDimensions)
- {
- mUpdateDimensions = FALSE;
-
- //reshape floater
- reshape(getRect().getWidth(), getRect().getHeight());
-
- gFloaterView->adjustToFitScreen(this, FALSE);
-
- LLRect dim_rect(getChildView("dimensions")->getRect());
- LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect());
- getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft);
- }
+ if (!mImage)
+ {
+ return;
+ }
+ if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0)
+ {
+ return;
+ }
+
+ S32 img_width = mImage->getFullWidth();
+ S32 img_height = mImage->getFullHeight();
+
+ if (mAssetStatus != PREVIEW_ASSET_LOADED
+ || mLastWidth != img_width
+ || mLastHeight != img_height)
+ {
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ // Asset has been fully loaded, adjust aspect ratio
+ adjustAspectRatio();
+ }
+
+
+ // Update the width/height display every time
+ getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", img_width));
+ getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", img_height));
+
+ mLastHeight = img_height;
+ mLastWidth = img_width;
+
+ // Reshape the floater only when required
+ if (mUpdateDimensions)
+ {
+ mUpdateDimensions = FALSE;
+
+ //reshape floater
+ reshape(getRect().getWidth(), getRect().getHeight());
+
+ gFloaterView->adjustToFitScreen(this, FALSE);
+
+ LLRect dim_rect(getChildView("dimensions")->getRect());
+ LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect());
+ getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft);
+ }
}
// Return true if everything went fine, false if we somewhat modified the ratio as we bumped on border values
bool LLPreviewTexture::setAspectRatio(const F32 width, const F32 height)
{
- mUpdateDimensions = TRUE;
-
- // We don't allow negative width or height. Also, if height is positive but too small, we reset to default
- // A default 0.f value for mAspectRatio means "unconstrained" in the rest of the code
- if ((width <= 0.f) || (height <= F_APPROXIMATELY_ZERO))
- {
- mAspectRatio = 0.f;
- return false;
- }
-
- // Compute and store the ratio
- F32 ratio = width / height;
- mAspectRatio = llclamp(ratio, PREVIEW_TEXTURE_MIN_ASPECT, PREVIEW_TEXTURE_MAX_ASPECT);
-
- // Return false if we clamped the value, true otherwise
- return (ratio == mAspectRatio);
+ mUpdateDimensions = TRUE;
+
+ // We don't allow negative width or height. Also, if height is positive but too small, we reset to default
+ // A default 0.f value for mAspectRatio means "unconstrained" in the rest of the code
+ if ((width <= 0.f) || (height <= F_APPROXIMATELY_ZERO))
+ {
+ mAspectRatio = 0.f;
+ return false;
+ }
+
+ // Compute and store the ratio
+ F32 ratio = width / height;
+ mAspectRatio = llclamp(ratio, PREVIEW_TEXTURE_MIN_ASPECT, PREVIEW_TEXTURE_MAX_ASPECT);
+
+ // Return false if we clamped the value, true otherwise
+ return (ratio == mAspectRatio);
}
void LLPreviewTexture::onAspectRatioCommit(LLUICtrl* ctrl, void* userdata)
-{
- LLPreviewTexture* self = (LLPreviewTexture*) userdata;
-
- std::string ratio(ctrl->getValue().asString());
- std::string::size_type separator(ratio.find_first_of(":/\\"));
-
- if (std::string::npos == separator) {
- // If there's no separator assume we want an unconstrained ratio
- self->setAspectRatio( 0.f, 0.f );
- return;
- }
-
- F32 width, height;
- std::istringstream numerator(ratio.substr(0, separator));
- std::istringstream denominator(ratio.substr(separator + 1));
- numerator >> width;
- denominator >> height;
-
- self->setAspectRatio( width, height );
+{
+ LLPreviewTexture* self = (LLPreviewTexture*) userdata;
+
+ std::string ratio(ctrl->getValue().asString());
+ std::string::size_type separator(ratio.find_first_of(":/\\"));
+
+ if (std::string::npos == separator) {
+ // If there's no separator assume we want an unconstrained ratio
+ self->setAspectRatio( 0.f, 0.f );
+ return;
+ }
+
+ F32 width, height;
+ std::istringstream numerator(ratio.substr(0, separator));
+ std::istringstream denominator(ratio.substr(separator + 1));
+ numerator >> width;
+ denominator >> height;
+
+ self->setAspectRatio( width, height );
}
void LLPreviewTexture::loadAsset()
{
- mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- mImageOldBoostLevel = mImage->getBoostLevel();
- mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
- mImage->forceToSaveRawImage(0) ;
- mAssetStatus = PREVIEW_ASSET_LOADING;
- mUpdateDimensions = TRUE;
- updateDimensions();
- getChildView("save_tex_btn")->setEnabled(canSaveAs());
- if (mObjectUUID.notNull())
- {
- // check that we can copy inworld items into inventory
- getChildView("Keep")->setEnabled(mIsCopyable);
- }
- else
- {
- // check that we can remove item
- BOOL source_library = gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID());
- if (source_library)
- {
- getChildView("Discard")->setEnabled(false);
- }
- }
+ mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ mImageOldBoostLevel = mImage->getBoostLevel();
+ mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
+ mImage->forceToSaveRawImage(0) ;
+ mAssetStatus = PREVIEW_ASSET_LOADING;
+ mUpdateDimensions = TRUE;
+ updateDimensions();
+ getChildView("save_tex_btn")->setEnabled(canSaveAs());
+ if (mObjectUUID.notNull())
+ {
+ // check that we can copy inworld items into inventory
+ getChildView("Keep")->setEnabled(mIsCopyable);
+ }
+ else
+ {
+ // check that we can remove item
+ BOOL source_library = gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID());
+ if (source_library)
+ {
+ getChildView("Discard")->setEnabled(false);
+ }
+ }
}
LLPreview::EAssetStatus LLPreviewTexture::getAssetStatus()
{
- if (mImage.notNull() && (mImage->getFullWidth() * mImage->getFullHeight() > 0))
- {
- mAssetStatus = PREVIEW_ASSET_LOADED;
- }
- return mAssetStatus;
+ if (mImage.notNull() && (mImage->getFullWidth() * mImage->getFullHeight() > 0))
+ {
+ mAssetStatus = PREVIEW_ASSET_LOADED;
+ }
+ return mAssetStatus;
}
void LLPreviewTexture::adjustAspectRatio()
{
- S32 w = mImage->getFullWidth();
+ S32 w = mImage->getFullWidth();
S32 h = mImage->getFullHeight();
- // Determine aspect ratio of the image
- S32 tmp;
+ // Determine aspect ratio of the image
+ S32 tmp;
while (h != 0)
{
tmp = w % h;
w = h;
h = tmp;
}
- S32 divisor = w;
- S32 num = mImage->getFullWidth() / divisor;
- S32 denom = mImage->getFullHeight() / divisor;
-
- if (setAspectRatio(num, denom))
- {
- // Select corresponding ratio entry in the combo list
- LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
- if (combo)
- {
- std::ostringstream ratio;
- ratio << num << ":" << denom;
- std::vector<std::string>::const_iterator found = std::find(mRatiosList.begin(), mRatiosList.end(), ratio.str());
- if (found == mRatiosList.end())
- {
- // No existing ratio found, create an element that will show image at original ratio
- populateRatioList(); // makes sure previous custom ratio is cleared
- std::string ratio = std::to_string(num)+":" + std::to_string(denom);
- mRatiosList.push_back(ratio);
- combo->add(ratio);
- combo->setCurrentByIndex(mRatiosList.size()- 1);
- }
- else
- {
- combo->setCurrentByIndex(found - mRatiosList.begin());
- }
- }
- }
- else
- {
- // Aspect ratio was set to unconstrained or was clamped
- LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
- if (combo)
- {
- combo->setCurrentByIndex(0); //unconstrained
- }
- }
-
- mUpdateDimensions = TRUE;
+ S32 divisor = w;
+ S32 num = mImage->getFullWidth() / divisor;
+ S32 denom = mImage->getFullHeight() / divisor;
+
+ if (setAspectRatio(num, denom))
+ {
+ // Select corresponding ratio entry in the combo list
+ LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
+ if (combo)
+ {
+ std::ostringstream ratio;
+ ratio << num << ":" << denom;
+ std::vector<std::string>::const_iterator found = std::find(mRatiosList.begin(), mRatiosList.end(), ratio.str());
+ if (found == mRatiosList.end())
+ {
+ // No existing ratio found, create an element that will show image at original ratio
+ populateRatioList(); // makes sure previous custom ratio is cleared
+ std::string ratio = std::to_string(num)+":" + std::to_string(denom);
+ mRatiosList.push_back(ratio);
+ combo->add(ratio);
+ combo->setCurrentByIndex(mRatiosList.size()- 1);
+ }
+ else
+ {
+ combo->setCurrentByIndex(found - mRatiosList.begin());
+ }
+ }
+ }
+ else
+ {
+ // Aspect ratio was set to unconstrained or was clamped
+ LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
+ if (combo)
+ {
+ combo->setCurrentByIndex(0); //unconstrained
+ }
+ }
+
+ mUpdateDimensions = TRUE;
}
void LLPreviewTexture::updateImageID()
{
- const LLViewerInventoryItem *item = static_cast<const LLViewerInventoryItem*>(getItem());
- if(item)
- {
- mImageID = item->getAssetUUID();
-
- // here's the old logic...
- //mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID();
- // here's the new logic... 'cos we hate disappearing buttons.
- mShowKeepDiscard = TRUE;
-
- mCopyToInv = FALSE;
- LLPermissions perm(item->getPermissions());
- mIsCopyable = perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) && perm.allowTransferTo(gAgent.getID());
- mIsFullPerm = item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED);
- }
- else // not an item, assume it's an asset id
- {
- mImageID = mItemUUID;
- mShowKeepDiscard = FALSE;
- mCopyToInv = TRUE;
- mIsCopyable = TRUE;
- mIsFullPerm = TRUE;
- }
+ const LLViewerInventoryItem *item = static_cast<const LLViewerInventoryItem*>(getItem());
+ if(item)
+ {
+ mImageID = item->getAssetUUID();
+
+ // here's the old logic...
+ //mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID();
+ // here's the new logic... 'cos we hate disappearing buttons.
+ mShowKeepDiscard = TRUE;
+
+ mCopyToInv = FALSE;
+ LLPermissions perm(item->getPermissions());
+ mIsCopyable = perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) && perm.allowTransferTo(gAgent.getID());
+ mIsFullPerm = item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED);
+ }
+ else // not an item, assume it's an asset id
+ {
+ mImageID = mItemUUID;
+ mShowKeepDiscard = FALSE;
+ mCopyToInv = TRUE;
+ mIsCopyable = TRUE;
+ mIsFullPerm = TRUE;
+ }
}
/* virtual */
void LLPreviewTexture::setObjectID(const LLUUID& object_id)
{
- mObjectUUID = object_id;
+ mObjectUUID = object_id;
- const LLUUID old_image_id = mImageID;
+ const LLUUID old_image_id = mImageID;
- // Update what image we're pointing to, such as if we just specified the mObjectID
- // that this mItemID is part of.
- updateImageID();
+ // Update what image we're pointing to, such as if we just specified the mObjectID
+ // that this mItemID is part of.
+ updateImageID();
- // If the imageID has changed, start over and reload the new image.
- if (mImageID != old_image_id)
- {
- mAssetStatus = PREVIEW_ASSET_UNLOADED;
- loadAsset();
- }
- refreshFromItem();
+ // If the imageID has changed, start over and reload the new image.
+ if (mImageID != old_image_id)
+ {
+ mAssetStatus = PREVIEW_ASSET_UNLOADED;
+ loadAsset();
+ }
+ refreshFromItem();
}
diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h
index 16db51332e..fda4390993 100644
--- a/indra/newview/llpreviewtexture.h
+++ b/indra/newview/llpreviewtexture.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpreviewtexture.h
* @brief LLPreviewTexture class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,71 +38,71 @@ class LLImageRaw;
class LLPreviewTexture : public LLPreview
{
public:
- LLPreviewTexture(const LLSD& key);
- ~LLPreviewTexture();
-
- virtual void draw();
-
- virtual BOOL canSaveAs() const;
- virtual void saveAs();
-
- virtual void loadAsset();
- virtual EAssetStatus getAssetStatus();
-
- virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- virtual void onFocusReceived();
-
- static void onFileLoadedForSave(
- BOOL success,
- LLViewerFetchedTexture *src_vi,
- LLImageRaw* src,
- LLImageRaw* aux_src,
- S32 discard_level,
- BOOL final,
- void* userdata );
- void openToSave();
-
- void saveTextureToFile(const std::vector<std::string>& filenames);
+ LLPreviewTexture(const LLSD& key);
+ ~LLPreviewTexture();
+
+ virtual void draw();
+
+ virtual BOOL canSaveAs() const;
+ virtual void saveAs();
+
+ virtual void loadAsset();
+ virtual EAssetStatus getAssetStatus();
+
+ virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ virtual void onFocusReceived();
+
+ static void onFileLoadedForSave(
+ BOOL success,
+ LLViewerFetchedTexture *src_vi,
+ LLImageRaw* src,
+ LLImageRaw* aux_src,
+ S32 discard_level,
+ BOOL final,
+ void* userdata );
+ void openToSave();
+
+ void saveTextureToFile(const std::vector<std::string>& filenames);
void saveMultipleToFile(const std::string& file_name = "");
-
- static void onSaveAsBtn(void* data);
- void hideCtrlButtons();
+ static void onSaveAsBtn(void* data);
- /*virtual*/ void setObjectID(const LLUUID& object_id);
+ void hideCtrlButtons();
+
+ /*virtual*/ void setObjectID(const LLUUID& object_id);
protected:
- void init();
- void populateRatioList();
- /* virtual */ BOOL postBuild();
- bool setAspectRatio(const F32 width, const F32 height);
- static void onAspectRatioCommit(LLUICtrl*,void* userdata);
- void adjustAspectRatio();
-
+ void init();
+ void populateRatioList();
+ /* virtual */ BOOL postBuild();
+ bool setAspectRatio(const F32 width, const F32 height);
+ static void onAspectRatioCommit(LLUICtrl*,void* userdata);
+ void adjustAspectRatio();
+
private:
- void updateImageID(); // set what image is being uploaded.
- void updateDimensions();
- LLUUID mImageID;
- LLPointer<LLViewerFetchedTexture> mImage;
- S32 mImageOldBoostLevel;
- std::string mSaveFileName;
- LLFrameTimer mSavedFileTimer;
- BOOL mLoadingFullImage;
- BOOL mShowKeepDiscard;
- BOOL mCopyToInv;
-
- // Save the image once it's loaded.
- BOOL mPreviewToSave;
-
- // This is stored off in a member variable, because the save-as
- // button and drag and drop functionality need to know.
- BOOL mIsCopyable;
- BOOL mIsFullPerm;
- BOOL mUpdateDimensions;
- S32 mLastHeight;
- S32 mLastWidth;
- F32 mAspectRatio;
-
- LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ;
- std::vector<std::string> mRatiosList;
+ void updateImageID(); // set what image is being uploaded.
+ void updateDimensions();
+ LLUUID mImageID;
+ LLPointer<LLViewerFetchedTexture> mImage;
+ S32 mImageOldBoostLevel;
+ std::string mSaveFileName;
+ LLFrameTimer mSavedFileTimer;
+ BOOL mLoadingFullImage;
+ BOOL mShowKeepDiscard;
+ BOOL mCopyToInv;
+
+ // Save the image once it's loaded.
+ BOOL mPreviewToSave;
+
+ // This is stored off in a member variable, because the save-as
+ // button and drag and drop functionality need to know.
+ BOOL mIsCopyable;
+ BOOL mIsFullPerm;
+ BOOL mUpdateDimensions;
+ S32 mLastHeight;
+ S32 mLastWidth;
+ F32 mAspectRatio;
+
+ LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ;
+ std::vector<std::string> mRatiosList;
};
#endif // LL_LLPREVIEWTEXTURE_H
diff --git a/indra/newview/llproductinforequest.cpp b/indra/newview/llproductinforequest.cpp
index 4abb673555..728cb22431 100644
--- a/indra/newview/llproductinforequest.cpp
+++ b/indra/newview/llproductinforequest.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llproductinforequest.cpp
* @author Kent Quirk
* @brief Get region type descriptions (translation from SKU to description)
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,36 +34,36 @@
#include "llviewerregion.h"
#include "llcorehttputil.h"
-LLProductInfoRequestManager::LLProductInfoRequestManager():
+LLProductInfoRequestManager::LLProductInfoRequestManager():
mSkuDescriptions()
{
}
void LLProductInfoRequestManager::initSingleton()
{
- std::string url = gAgent.getRegionCapability("ProductInfoRequest");
- if (!url.empty())
- {
+ std::string url = gAgent.getRegionCapability("ProductInfoRequest");
+ if (!url.empty())
+ {
LLCoros::instance().launch("LLProductInfoRequestManager::getLandDescriptionsCoro",
boost::bind(&LLProductInfoRequestManager::getLandDescriptionsCoro, this, url));
- }
+ }
}
std::string LLProductInfoRequestManager::getDescriptionForSku(const std::string& sku)
{
- // The description LLSD is an array of maps; each array entry
- // has a map with 3 fields -- description, name, and sku
- for (LLSD::array_const_iterator it = mSkuDescriptions.beginArray();
- it != mSkuDescriptions.endArray();
- ++it)
- {
- // LL_WARNS() << (*it)["sku"].asString() << " = " << (*it)["description"].asString() << LL_ENDL;
- if ((*it)["sku"].asString() == sku)
- {
- return (*it)["description"].asString();
- }
- }
- return LLTrans::getString("land_type_unknown");
+ // The description LLSD is an array of maps; each array entry
+ // has a map with 3 fields -- description, name, and sku
+ for (LLSD::array_const_iterator it = mSkuDescriptions.beginArray();
+ it != mSkuDescriptions.endArray();
+ ++it)
+ {
+ // LL_WARNS() << (*it)["sku"].asString() << " = " << (*it)["description"].asString() << LL_ENDL;
+ if ((*it)["sku"].asString() == sku)
+ {
+ return (*it)["description"].asString();
+ }
+ }
+ return LLTrans::getString("land_type_unknown");
}
void LLProductInfoRequestManager::getLandDescriptionsCoro(std::string url)
diff --git a/indra/newview/llproductinforequest.h b/indra/newview/llproductinforequest.h
index 0b94c39d11..ef0c8cfdd8 100644
--- a/indra/newview/llproductinforequest.h
+++ b/indra/newview/llproductinforequest.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llproductinforequest.h
* @author Kent Quirk
* @brief Get region type descriptions (translation from SKU to description)
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,7 +32,7 @@
#include "lleventcoro.h"
#include "llcoros.h"
-/**
+/**
* This is a singleton to manage a cache of information about land types.
* The land system provides a capability to get information about the
* set of possible land sku, name, and description information.
@@ -41,12 +41,12 @@
*/
class LLProductInfoRequestManager : public LLSingleton<LLProductInfoRequestManager>
{
- LLSINGLETON(LLProductInfoRequestManager);
+ LLSINGLETON(LLProductInfoRequestManager);
public:
- std::string getDescriptionForSku(const std::string& sku);
+ std::string getDescriptionForSku(const std::string& sku);
private:
- /* virtual */ void initSingleton() override;
+ /* virtual */ void initSingleton() override;
void getLandDescriptionsCoro(std::string url);
LLSD mSkuDescriptions;
diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp
index 416848f9af..bbd1ef45f4 100644
--- a/indra/newview/llprogressview.cpp
+++ b/indra/newview/llprogressview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llprogressview.cpp
* @brief LLProgressView class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -62,115 +62,115 @@ const F32 FADE_TO_WORLD_TIME = 1.0f;
static LLPanelInjector<LLProgressView> r("progress_view");
// XUI: Translate
-LLProgressView::LLProgressView()
-: LLPanel(),
- mPercentDone( 0.f ),
- mMediaCtrl( NULL ),
- mMouseDownInActiveArea( false ),
- mUpdateEvents("LLProgressView"),
- mFadeToWorldTimer(),
- mFadeFromLoginTimer(),
- mStartupComplete(false)
+LLProgressView::LLProgressView()
+: LLPanel(),
+ mPercentDone( 0.f ),
+ mMediaCtrl( NULL ),
+ mMouseDownInActiveArea( false ),
+ mUpdateEvents("LLProgressView"),
+ mFadeToWorldTimer(),
+ mFadeFromLoginTimer(),
+ mStartupComplete(false)
{
- mUpdateEvents.listen("self", boost::bind(&LLProgressView::handleUpdate, this, _1));
- mFadeToWorldTimer.stop();
- mFadeFromLoginTimer.stop();
+ mUpdateEvents.listen("self", boost::bind(&LLProgressView::handleUpdate, this, _1));
+ mFadeToWorldTimer.stop();
+ mFadeFromLoginTimer.stop();
}
BOOL LLProgressView::postBuild()
{
- mProgressBar = getChild<LLProgressBar>("login_progress_bar");
+ mProgressBar = getChild<LLProgressBar>("login_progress_bar");
+
+ // media control that is used to play intro video
+ mMediaCtrl = getChild<LLMediaCtrl>("login_media_panel");
+ mMediaCtrl->setVisible( false ); // hidden initially
+ mMediaCtrl->addObserver( this ); // watch events
- // media control that is used to play intro video
- mMediaCtrl = getChild<LLMediaCtrl>("login_media_panel");
- mMediaCtrl->setVisible( false ); // hidden initially
- mMediaCtrl->addObserver( this ); // watch events
-
- LLViewerMedia::getInstance()->setOnlyAudibleMediaTextureID(mMediaCtrl->getTextureID());
+ LLViewerMedia::getInstance()->setOnlyAudibleMediaTextureID(mMediaCtrl->getTextureID());
- mCancelBtn = getChild<LLButton>("cancel_btn");
- mCancelBtn->setClickedCallback( LLProgressView::onCancelButtonClicked, NULL );
+ mCancelBtn = getChild<LLButton>("cancel_btn");
+ mCancelBtn->setClickedCallback( LLProgressView::onCancelButtonClicked, NULL );
- getChild<LLTextBox>("title_text")->setText(LLStringExplicit(LLAppViewer::instance()->getSecondLifeTitle()));
+ getChild<LLTextBox>("title_text")->setText(LLStringExplicit(LLAppViewer::instance()->getSecondLifeTitle()));
- getChild<LLTextBox>("message_text")->setClickedCallback(onClickMessage, this);
+ getChild<LLTextBox>("message_text")->setClickedCallback(onClickMessage, this);
- // hidden initially, until we need it
- setVisible(FALSE);
+ // hidden initially, until we need it
+ setVisible(FALSE);
- LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLProgressView::onAlertModal, this, _1));
+ LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLProgressView::onAlertModal, this, _1));
- sInstance = this;
- return TRUE;
+ sInstance = this;
+ return TRUE;
}
LLProgressView::~LLProgressView()
{
- // Just in case something went wrong, make sure we deregister our idle callback.
- gIdleCallbacks.deleteFunction(onIdle, this);
+ // Just in case something went wrong, make sure we deregister our idle callback.
+ gIdleCallbacks.deleteFunction(onIdle, this);
- gFocusMgr.releaseFocusIfNeeded( this );
+ gFocusMgr.releaseFocusIfNeeded( this );
- sInstance = NULL;
+ sInstance = NULL;
}
BOOL LLProgressView::handleHover(S32 x, S32 y, MASK mask)
{
- if( childrenHandleHover( x, y, mask ) == NULL )
- {
- gViewerWindow->setCursor(UI_CURSOR_WAIT);
- }
- return TRUE;
+ if( childrenHandleHover( x, y, mask ) == NULL )
+ {
+ gViewerWindow->setCursor(UI_CURSOR_WAIT);
+ }
+ return TRUE;
}
BOOL LLProgressView::handleKeyHere(KEY key, MASK mask)
{
- // Suck up all keystokes except CTRL-Q.
- if( ('Q' == key) && (MASK_CONTROL == mask) )
- {
- LLAppViewer::instance()->userQuit();
- }
- return TRUE;
+ // Suck up all keystokes except CTRL-Q.
+ if( ('Q' == key) && (MASK_CONTROL == mask) )
+ {
+ LLAppViewer::instance()->userQuit();
+ }
+ return TRUE;
}
void LLProgressView::revealIntroPanel()
{
- // if user hasn't yet seen intro video
- std::string intro_url = gSavedSettings.getString("PostFirstLoginIntroURL");
- if ( intro_url.length() > 0 &&
- gSavedSettings.getBOOL("BrowserJavascriptEnabled") &&
- gSavedSettings.getBOOL("PostFirstLoginIntroViewed" ) == FALSE )
- {
- // hide the progress bar
- getChild<LLView>("stack1")->setVisible(false);
-
- // navigate to intro URL and reveal widget
- mMediaCtrl->navigateTo( intro_url );
- mMediaCtrl->setVisible( TRUE );
-
-
- // flag as having seen the new user post login intro
- gSavedSettings.setBOOL("PostFirstLoginIntroViewed", TRUE );
-
- mMediaCtrl->setFocus(TRUE);
- }
-
- mFadeFromLoginTimer.start();
- gIdleCallbacks.addFunction(onIdle, this);
+ // if user hasn't yet seen intro video
+ std::string intro_url = gSavedSettings.getString("PostFirstLoginIntroURL");
+ if ( intro_url.length() > 0 &&
+ gSavedSettings.getBOOL("BrowserJavascriptEnabled") &&
+ gSavedSettings.getBOOL("PostFirstLoginIntroViewed" ) == FALSE )
+ {
+ // hide the progress bar
+ getChild<LLView>("stack1")->setVisible(false);
+
+ // navigate to intro URL and reveal widget
+ mMediaCtrl->navigateTo( intro_url );
+ mMediaCtrl->setVisible( TRUE );
+
+
+ // flag as having seen the new user post login intro
+ gSavedSettings.setBOOL("PostFirstLoginIntroViewed", TRUE );
+
+ mMediaCtrl->setFocus(TRUE);
+ }
+
+ mFadeFromLoginTimer.start();
+ gIdleCallbacks.addFunction(onIdle, this);
}
void LLProgressView::setStartupComplete()
{
- mStartupComplete = true;
-
- // if we are not showing a video, fade into world
- if (!mMediaCtrl->getVisible())
- {
- mFadeFromLoginTimer.stop();
- mFadeToWorldTimer.start();
- }
+ mStartupComplete = true;
+
+ // if we are not showing a video, fade into world
+ if (!mMediaCtrl->getVisible())
+ {
+ mFadeFromLoginTimer.stop();
+ mFadeToWorldTimer.start();
+ }
}
void LLProgressView::setVisible(BOOL visible)
@@ -179,54 +179,54 @@ void LLProgressView::setVisible(BOOL visible)
{
mFadeFromLoginTimer.stop();
}
- // hiding progress view
- if (getVisible() && !visible)
- {
- LLPanel::setVisible(FALSE);
- }
- // showing progress view
- else if (visible && (!getVisible() || mFadeToWorldTimer.getStarted()))
- {
- setFocus(TRUE);
- mFadeToWorldTimer.stop();
- LLPanel::setVisible(TRUE);
- }
+ // hiding progress view
+ if (getVisible() && !visible)
+ {
+ LLPanel::setVisible(FALSE);
+ }
+ // showing progress view
+ else if (visible && (!getVisible() || mFadeToWorldTimer.getStarted()))
+ {
+ setFocus(TRUE);
+ mFadeToWorldTimer.stop();
+ LLPanel::setVisible(TRUE);
+ }
}
void LLProgressView::drawStartTexture(F32 alpha)
{
- gGL.pushMatrix();
- if (gStartTexture)
- {
- LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->bind(gStartTexture.get());
- gGL.color4f(1.f, 1.f, 1.f, alpha);
- F32 image_aspect = (F32)gStartImageWidth / (F32)gStartImageHeight;
- S32 width = getRect().getWidth();
- S32 height = getRect().getHeight();
- F32 view_aspect = (F32)width / (F32)height;
- // stretch image to maintain aspect ratio
- if (image_aspect > view_aspect)
- {
- gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * width, 0.f, 0.f);
- gGL.scalef(image_aspect / view_aspect, 1.f, 1.f);
- }
- else
- {
- gGL.translatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f);
- gGL.scalef(1.f, view_aspect / image_aspect, 1.f);
- }
- gl_rect_2d_simple_tex( getRect().getWidth(), getRect().getHeight() );
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- }
- else
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4f(0.f, 0.f, 0.f, 1.f);
- gl_rect_2d(getRect());
- }
- gGL.popMatrix();
+ gGL.pushMatrix();
+ if (gStartTexture)
+ {
+ LLGLSUIDefault gls_ui;
+ gGL.getTexUnit(0)->bind(gStartTexture.get());
+ gGL.color4f(1.f, 1.f, 1.f, alpha);
+ F32 image_aspect = (F32)gStartImageWidth / (F32)gStartImageHeight;
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
+ F32 view_aspect = (F32)width / (F32)height;
+ // stretch image to maintain aspect ratio
+ if (image_aspect > view_aspect)
+ {
+ gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * width, 0.f, 0.f);
+ gGL.scalef(image_aspect / view_aspect, 1.f, 1.f);
+ }
+ else
+ {
+ gGL.translatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f);
+ gGL.scalef(1.f, view_aspect / image_aspect, 1.f);
+ }
+ gl_rect_2d_simple_tex( getRect().getWidth(), getRect().getHeight() );
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.color4f(0.f, 0.f, 0.f, 1.f);
+ gl_rect_2d(getRect());
+ }
+ gGL.popMatrix();
}
void LLProgressView::drawLogos(F32 alpha)
@@ -259,84 +259,84 @@ void LLProgressView::drawLogos(F32 alpha)
void LLProgressView::draw()
{
- static LLTimer timer;
-
- if (mFadeFromLoginTimer.getStarted())
- {
- F32 alpha = clamp_rescale(mFadeFromLoginTimer.getElapsedTimeF32(), 0.f, FADE_TO_WORLD_TIME, 0.f, 1.f);
- LLViewDrawContext context(alpha);
-
- if (!mMediaCtrl->getVisible())
- {
- drawStartTexture(alpha);
- }
-
- LLPanel::draw();
- drawLogos(alpha);
- return;
- }
-
- // handle fade out to world view when we're asked to
- if (mFadeToWorldTimer.getStarted())
- {
- // draw fading panel
- F32 alpha = clamp_rescale(mFadeToWorldTimer.getElapsedTimeF32(), 0.f, FADE_TO_WORLD_TIME, 1.f, 0.f);
- LLViewDrawContext context(alpha);
-
- drawStartTexture(alpha);
- LLPanel::draw();
- drawLogos(alpha);
-
- // faded out completely - remove panel and reveal world
- if (mFadeToWorldTimer.getElapsedTimeF32() > FADE_TO_WORLD_TIME )
- {
- mFadeToWorldTimer.stop();
-
- LLViewerMedia::getInstance()->setOnlyAudibleMediaTextureID(LLUUID::null);
-
- // Fade is complete, release focus
- gFocusMgr.releaseFocusIfNeeded( this );
-
- // turn off panel that hosts intro so we see the world
- setVisible(FALSE);
-
- // stop observing events since we no longer care
- mMediaCtrl->remObserver( this );
-
- // hide the intro
- mMediaCtrl->setVisible( false );
-
- // navigate away from intro page to something innocuous since 'unload' is broken right now
- //mMediaCtrl->navigateTo( "about:blank" );
-
- // FIXME: this causes a crash that i haven't been able to fix
- mMediaCtrl->unloadMediaSource();
+ static LLTimer timer;
+
+ if (mFadeFromLoginTimer.getStarted())
+ {
+ F32 alpha = clamp_rescale(mFadeFromLoginTimer.getElapsedTimeF32(), 0.f, FADE_TO_WORLD_TIME, 0.f, 1.f);
+ LLViewDrawContext context(alpha);
+
+ if (!mMediaCtrl->getVisible())
+ {
+ drawStartTexture(alpha);
+ }
+
+ LLPanel::draw();
+ drawLogos(alpha);
+ return;
+ }
+
+ // handle fade out to world view when we're asked to
+ if (mFadeToWorldTimer.getStarted())
+ {
+ // draw fading panel
+ F32 alpha = clamp_rescale(mFadeToWorldTimer.getElapsedTimeF32(), 0.f, FADE_TO_WORLD_TIME, 1.f, 0.f);
+ LLViewDrawContext context(alpha);
+
+ drawStartTexture(alpha);
+ LLPanel::draw();
+ drawLogos(alpha);
+
+ // faded out completely - remove panel and reveal world
+ if (mFadeToWorldTimer.getElapsedTimeF32() > FADE_TO_WORLD_TIME )
+ {
+ mFadeToWorldTimer.stop();
+
+ LLViewerMedia::getInstance()->setOnlyAudibleMediaTextureID(LLUUID::null);
+
+ // Fade is complete, release focus
+ gFocusMgr.releaseFocusIfNeeded( this );
+
+ // turn off panel that hosts intro so we see the world
+ setVisible(FALSE);
+
+ // stop observing events since we no longer care
+ mMediaCtrl->remObserver( this );
+
+ // hide the intro
+ mMediaCtrl->setVisible( false );
+
+ // navigate away from intro page to something innocuous since 'unload' is broken right now
+ //mMediaCtrl->navigateTo( "about:blank" );
+
+ // FIXME: this causes a crash that i haven't been able to fix
+ mMediaCtrl->unloadMediaSource();
releaseTextures();
- }
- return;
- }
-
- drawStartTexture(1.0f);
- // draw children
- LLPanel::draw();
- drawLogos(1.0f);
+ }
+ return;
+ }
+
+ drawStartTexture(1.0f);
+ // draw children
+ LLPanel::draw();
+ drawLogos(1.0f);
}
void LLProgressView::setText(const std::string& text)
{
- getChild<LLUICtrl>("progress_text")->setValue(text);
+ getChild<LLUICtrl>("progress_text")->setValue(text);
}
void LLProgressView::setPercent(const F32 percent)
{
- mProgressBar->setValue(percent);
+ mProgressBar->setValue(percent);
}
void LLProgressView::setMessage(const std::string& msg)
{
- mMessage = msg;
- getChild<LLUICtrl>("message_text")->setValue(mMessage);
+ mMessage = msg;
+ getChild<LLUICtrl>("message_text")->setValue(mMessage);
}
void LLProgressView::loadLogo(const std::string &path,
@@ -475,7 +475,7 @@ void LLProgressView::initStartTexture(S32 location_id, bool is_in_production)
LLPointer<LLImageFormatted> start_image_frmted = LLImageFormatted::createFromType(image_codec);
- // Turn off start screen to get around the occasional readback
+ // Turn off start screen to get around the occasional readback
// driver bug
if (!gSavedSettings.getBOOL("UseStartScreen"))
{
@@ -534,137 +534,137 @@ void LLProgressView::releaseTextures()
void LLProgressView::setCancelButtonVisible(BOOL b, const std::string& label)
{
- mCancelBtn->setVisible( b );
- mCancelBtn->setEnabled( b );
- mCancelBtn->setLabelSelected(label);
- mCancelBtn->setLabelUnselected(label);
+ mCancelBtn->setVisible( b );
+ mCancelBtn->setEnabled( b );
+ mCancelBtn->setLabelSelected(label);
+ mCancelBtn->setLabelUnselected(label);
}
// static
void LLProgressView::onCancelButtonClicked(void*)
{
- // Quitting viewer here should happen only when "Quit" button is pressed while starting up.
- // Check for startup state is used here instead of teleport state to avoid quitting when
- // cancel is pressed while teleporting inside region (EXT-4911)
- if (LLStartUp::getStartupState() < STATE_STARTED)
- {
- LL_INFOS() << "User requesting quit during login" << LL_ENDL;
- LLAppViewer::instance()->requestQuit();
- }
- else
- {
- gAgent.teleportCancel();
- sInstance->mCancelBtn->setEnabled(FALSE);
- sInstance->setVisible(FALSE);
- }
+ // Quitting viewer here should happen only when "Quit" button is pressed while starting up.
+ // Check for startup state is used here instead of teleport state to avoid quitting when
+ // cancel is pressed while teleporting inside region (EXT-4911)
+ if (LLStartUp::getStartupState() < STATE_STARTED)
+ {
+ LL_INFOS() << "User requesting quit during login" << LL_ENDL;
+ LLAppViewer::instance()->requestQuit();
+ }
+ else
+ {
+ gAgent.teleportCancel();
+ sInstance->mCancelBtn->setEnabled(FALSE);
+ sInstance->setVisible(FALSE);
+ }
}
// static
void LLProgressView::onClickMessage(void* data)
{
- LLProgressView* viewp = (LLProgressView*)data;
- if ( viewp != NULL && ! viewp->mMessage.empty() )
- {
- std::string url_to_open( "" );
-
- size_t start_pos;
- start_pos = viewp->mMessage.find( "https://" );
- if (start_pos == std::string::npos)
- start_pos = viewp->mMessage.find( "http://" );
- if (start_pos == std::string::npos)
- start_pos = viewp->mMessage.find( "ftp://" );
-
- if ( start_pos != std::string::npos )
- {
- size_t end_pos = viewp->mMessage.find_first_of( " \n\r\t", start_pos );
- if ( end_pos != std::string::npos )
- url_to_open = viewp->mMessage.substr( start_pos, end_pos - start_pos );
- else
- url_to_open = viewp->mMessage.substr( start_pos );
-
- LLWeb::loadURLExternal( url_to_open );
- }
- }
+ LLProgressView* viewp = (LLProgressView*)data;
+ if ( viewp != NULL && ! viewp->mMessage.empty() )
+ {
+ std::string url_to_open( "" );
+
+ size_t start_pos;
+ start_pos = viewp->mMessage.find( "https://" );
+ if (start_pos == std::string::npos)
+ start_pos = viewp->mMessage.find( "http://" );
+ if (start_pos == std::string::npos)
+ start_pos = viewp->mMessage.find( "ftp://" );
+
+ if ( start_pos != std::string::npos )
+ {
+ size_t end_pos = viewp->mMessage.find_first_of( " \n\r\t", start_pos );
+ if ( end_pos != std::string::npos )
+ url_to_open = viewp->mMessage.substr( start_pos, end_pos - start_pos );
+ else
+ url_to_open = viewp->mMessage.substr( start_pos );
+
+ LLWeb::loadURLExternal( url_to_open );
+ }
+ }
}
bool LLProgressView::handleUpdate(const LLSD& event_data)
{
- LLSD message = event_data.get("message");
- LLSD desc = event_data.get("desc");
- LLSD percent = event_data.get("percent");
-
- if(message.isDefined())
- {
- setMessage(message.asString());
- }
-
- if(desc.isDefined())
- {
- setText(desc.asString());
- }
-
- if(percent.isDefined())
- {
- setPercent(percent.asReal());
- }
- return false;
+ LLSD message = event_data.get("message");
+ LLSD desc = event_data.get("desc");
+ LLSD percent = event_data.get("percent");
+
+ if(message.isDefined())
+ {
+ setMessage(message.asString());
+ }
+
+ if(desc.isDefined())
+ {
+ setText(desc.asString());
+ }
+
+ if(percent.isDefined())
+ {
+ setPercent(percent.asReal());
+ }
+ return false;
}
bool LLProgressView::onAlertModal(const LLSD& notify)
{
- // if the progress view is visible, it will obscure the notification window
- // in this case, we want to auto-accept WebLaunchExternalTarget notifications
- if (isInVisibleChain() && notify["sigtype"].asString() == "add")
- {
- LLNotificationPtr notifyp = LLNotifications::instance().find(notify["id"].asUUID());
- if (notifyp && notifyp->getName() == "WebLaunchExternalTarget")
- {
- notifyp->respondWithDefault();
- }
- }
- return false;
+ // if the progress view is visible, it will obscure the notification window
+ // in this case, we want to auto-accept WebLaunchExternalTarget notifications
+ if (isInVisibleChain() && notify["sigtype"].asString() == "add")
+ {
+ LLNotificationPtr notifyp = LLNotifications::instance().find(notify["id"].asUUID());
+ if (notifyp && notifyp->getName() == "WebLaunchExternalTarget")
+ {
+ notifyp->respondWithDefault();
+ }
+ }
+ return false;
}
void LLProgressView::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
{
- // the intro web content calls javascript::window.close() when it's done
- if( event == MEDIA_EVENT_CLOSE_REQUEST )
- {
- if (mStartupComplete)
- {
- //make sure other timer has stopped
- mFadeFromLoginTimer.stop();
- mFadeToWorldTimer.start();
- }
- else
- {
- // hide the media ctrl and wait for startup to be completed before fading to world
- mMediaCtrl->setVisible(false);
- if (mMediaCtrl->getMediaPlugin())
- {
- mMediaCtrl->getMediaPlugin()->stop();
- }
-
- // show the progress bar
- getChild<LLView>("stack1")->setVisible(true);
- }
- }
+ // the intro web content calls javascript::window.close() when it's done
+ if( event == MEDIA_EVENT_CLOSE_REQUEST )
+ {
+ if (mStartupComplete)
+ {
+ //make sure other timer has stopped
+ mFadeFromLoginTimer.stop();
+ mFadeToWorldTimer.start();
+ }
+ else
+ {
+ // hide the media ctrl and wait for startup to be completed before fading to world
+ mMediaCtrl->setVisible(false);
+ if (mMediaCtrl->getMediaPlugin())
+ {
+ mMediaCtrl->getMediaPlugin()->stop();
+ }
+
+ // show the progress bar
+ getChild<LLView>("stack1")->setVisible(true);
+ }
+ }
}
// static
void LLProgressView::onIdle(void* user_data)
{
- LLProgressView* self = (LLProgressView*) user_data;
-
- // Close login panel on mFadeToWorldTimer expiration.
- if (self->mFadeFromLoginTimer.getStarted() &&
- self->mFadeFromLoginTimer.getElapsedTimeF32() > FADE_TO_WORLD_TIME)
- {
- self->mFadeFromLoginTimer.stop();
- LLPanelLogin::closePanel();
-
- // Nothing to do anymore.
- gIdleCallbacks.deleteFunction(onIdle, user_data);
- }
+ LLProgressView* self = (LLProgressView*) user_data;
+
+ // Close login panel on mFadeToWorldTimer expiration.
+ if (self->mFadeFromLoginTimer.getStarted() &&
+ self->mFadeFromLoginTimer.getElapsedTimeF32() > FADE_TO_WORLD_TIME)
+ {
+ self->mFadeFromLoginTimer.stop();
+ LLPanelLogin::closePanel();
+
+ // Nothing to do anymore.
+ gIdleCallbacks.deleteFunction(onIdle, user_data);
+ }
}
diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h
index 56377a5889..56756f092a 100644
--- a/indra/newview/llprogressview.h
+++ b/indra/newview/llprogressview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llprogressview.h
* @brief LLProgressView class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,70 +37,70 @@ class LLButton;
class LLProgressBar;
class LLViewerTexture;
-class LLProgressView :
- public LLPanel,
- public LLViewerMediaObserver
+class LLProgressView :
+ public LLPanel,
+ public LLViewerMediaObserver
{
- LOG_CLASS(LLProgressView);
+ LOG_CLASS(LLProgressView);
public:
- LLProgressView();
- virtual ~LLProgressView();
-
- BOOL postBuild();
+ LLProgressView();
+ virtual ~LLProgressView();
+
+ BOOL postBuild();
+
+ /*virtual*/ void draw();
+ void drawStartTexture(F32 alpha);
+ void drawLogos(F32 alpha);
- /*virtual*/ void draw();
- void drawStartTexture(F32 alpha);
- void drawLogos(F32 alpha);
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
+ /*virtual*/ void setVisible(BOOL visible);
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
- /*virtual*/ void setVisible(BOOL visible);
+ // inherited from LLViewerMediaObserver
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
- // inherited from LLViewerMediaObserver
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+ void setText(const std::string& text);
+ void setPercent(const F32 percent);
- void setText(const std::string& text);
- void setPercent(const F32 percent);
+ // Set it to NULL when you want to eliminate the message.
+ void setMessage(const std::string& msg);
- // Set it to NULL when you want to eliminate the message.
- void setMessage(const std::string& msg);
-
- // turns on (under certain circumstances) the into video after login
- void revealIntroPanel();
+ // turns on (under certain circumstances) the into video after login
+ void revealIntroPanel();
- void setStartupComplete();
+ void setStartupComplete();
- // we have to preload local textures to make sure they won't be grey
- void initTextures(S32 location_id, bool is_in_production);
- void releaseTextures();
+ // we have to preload local textures to make sure they won't be grey
+ void initTextures(S32 location_id, bool is_in_production);
+ void releaseTextures();
- void setCancelButtonVisible(BOOL b, const std::string& label);
+ void setCancelButtonVisible(BOOL b, const std::string& label);
- static void onCancelButtonClicked( void* );
- static void onClickMessage(void*);
- bool onAlertModal(const LLSD& sd);
+ static void onCancelButtonClicked( void* );
+ static void onClickMessage(void*);
+ bool onAlertModal(const LLSD& sd);
protected:
- LLProgressBar* mProgressBar;
- LLMediaCtrl* mMediaCtrl;
- F32 mPercentDone;
- std::string mMessage;
- LLButton* mCancelBtn;
- LLFrameTimer mFadeToWorldTimer;
- LLFrameTimer mFadeFromLoginTimer;
- LLRect mOutlineRect;
- bool mMouseDownInActiveArea;
- bool mStartupComplete;
-
- // The LLEventStream mUpdateEvents depends upon this class being a singleton
- // to avoid pump name conflicts.
- static LLProgressView* sInstance;
- LLEventStream mUpdateEvents;
-
- bool handleUpdate(const LLSD& event_data);
- static void onIdle(void* user_data);
+ LLProgressBar* mProgressBar;
+ LLMediaCtrl* mMediaCtrl;
+ F32 mPercentDone;
+ std::string mMessage;
+ LLButton* mCancelBtn;
+ LLFrameTimer mFadeToWorldTimer;
+ LLFrameTimer mFadeFromLoginTimer;
+ LLRect mOutlineRect;
+ bool mMouseDownInActiveArea;
+ bool mStartupComplete;
+
+ // The LLEventStream mUpdateEvents depends upon this class being a singleton
+ // to avoid pump name conflicts.
+ static LLProgressView* sInstance;
+ LLEventStream mUpdateEvents;
+
+ bool handleUpdate(const LLSD& event_data);
+ static void onIdle(void* user_data);
void loadLogo(const std::string &path, const U8 image_codec, const LLRect &pos_rect, const LLRectf &clip_rect, const LLRectf &offset_rect);
// logos have unusual location and need to be preloaded to not appear grey, then deleted
void initLogos();
diff --git a/indra/newview/llrecentpeople.cpp b/indra/newview/llrecentpeople.cpp
index 0faf6bf889..d64dfdfcbc 100644
--- a/indra/newview/llrecentpeople.cpp
+++ b/indra/newview/llrecentpeople.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llrecentpeople.cpp
* @brief List of people with which the user has recently interacted.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,87 +35,87 @@ using namespace LLOldEvents;
bool LLRecentPeople::add(const LLUUID& id, const LLSD& userdata)
{
- if (id == gAgent.getID())
- return false;
+ if (id == gAgent.getID())
+ return false;
- bool is_not_group_id = LLGroupMgr::getInstance()->getGroupData(id) == NULL;
+ bool is_not_group_id = LLGroupMgr::getInstance()->getGroupData(id) == NULL;
- if (is_not_group_id)
- {
- //[] instead of insert to replace existing id->llsd["date"] with new date value
- mPeople[id] = userdata;
- mChangedSignal();
- }
+ if (is_not_group_id)
+ {
+ //[] instead of insert to replace existing id->llsd["date"] with new date value
+ mPeople[id] = userdata;
+ mChangedSignal();
+ }
- return is_not_group_id;
+ return is_not_group_id;
}
bool LLRecentPeople::contains(const LLUUID& id) const
{
- return mPeople.find(id) != mPeople.end();
+ return mPeople.find(id) != mPeople.end();
}
void LLRecentPeople::get(uuid_vec_t& result) const
{
- result.clear();
- for (recent_people_t::const_iterator pos = mPeople.begin(); pos != mPeople.end(); ++pos)
- result.push_back((*pos).first);
+ result.clear();
+ for (recent_people_t::const_iterator pos = mPeople.begin(); pos != mPeople.end(); ++pos)
+ result.push_back((*pos).first);
}
const LLDate LLRecentPeople::getDate(const LLUUID& id) const
{
- recent_people_t::const_iterator it = mPeople.find(id);
- if (it!= mPeople.end()) return it->second["date"].asDate();
+ recent_people_t::const_iterator it = mPeople.find(id);
+ if (it!= mPeople.end()) return it->second["date"].asDate();
- static LLDate no_date = LLDate();
- return no_date;
+ static LLDate no_date = LLDate();
+ return no_date;
}
const LLSD& LLRecentPeople::getData(const LLUUID& id) const
{
- recent_people_t::const_iterator it = mPeople.find(id);
+ recent_people_t::const_iterator it = mPeople.find(id);
- if (it != mPeople.end())
- return it->second;
+ if (it != mPeople.end())
+ return it->second;
- static LLSD no_data = LLSD();
- return no_data;
+ static LLSD no_data = LLSD();
+ return no_data;
}
// virtual
bool LLRecentPeople::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- (void) userdata;
- add(event->getValue().asUUID());
- return true;
+ (void) userdata;
+ add(event->getValue().asUUID());
+ return true;
}
void LLRecentPeople::updateAvatarsArrivalTime(uuid_vec_t& uuids)
{
- id_to_time_map_t buf = mAvatarsArrivalTime;
- mAvatarsArrivalTime.clear();
-
- for (uuid_vec_t::const_iterator id_it = uuids.begin(); id_it != uuids.end(); ++id_it)
- {
- if (buf.find(*id_it) != buf.end())
- {
- mAvatarsArrivalTime[*id_it] = buf[*id_it];
- }
- else
- {
- mAvatarsArrivalTime[*id_it] = LLDate::now().secondsSinceEpoch();
- }
- }
+ id_to_time_map_t buf = mAvatarsArrivalTime;
+ mAvatarsArrivalTime.clear();
+
+ for (uuid_vec_t::const_iterator id_it = uuids.begin(); id_it != uuids.end(); ++id_it)
+ {
+ if (buf.find(*id_it) != buf.end())
+ {
+ mAvatarsArrivalTime[*id_it] = buf[*id_it];
+ }
+ else
+ {
+ mAvatarsArrivalTime[*id_it] = LLDate::now().secondsSinceEpoch();
+ }
+ }
}
F32 LLRecentPeople::getArrivalTimeByID(const LLUUID& id)
{
- id_to_time_map_t::const_iterator it = mAvatarsArrivalTime.find(id);
+ id_to_time_map_t::const_iterator it = mAvatarsArrivalTime.find(id);
- if (it != mAvatarsArrivalTime.end())
- {
- return it->second;
- }
- return LLDate::now().secondsSinceEpoch();
+ if (it != mAvatarsArrivalTime.end())
+ {
+ return it->second;
+ }
+ return LLDate::now().secondsSinceEpoch();
}
diff --git a/indra/newview/llrecentpeople.h b/indra/newview/llrecentpeople.h
index 0c04222a9f..75f0f3c50e 100644
--- a/indra/newview/llrecentpeople.h
+++ b/indra/newview/llrecentpeople.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llrecentpeople.h
* @brief List of people with which the user has recently interacted.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,84 +39,84 @@ class LLDate;
/**
* List of people the agent recently interacted with.
- *
+ *
* Includes: anyone with whom the user IM'd or called
* (1:1 and ad-hoc but not SL Group chat),
* anyone with whom the user has had a transaction
* (inventory offer, friend request, etc),
- * and anyone that has chatted within chat range of the user in-world.
- *
- *TODO: purge least recently added items?
+ * and anyone that has chatted within chat range of the user in-world.
+ *
+ *TODO: purge least recently added items?
*/
class LLRecentPeople: public LLSingleton<LLRecentPeople>, public LLOldEvents::LLSimpleListener
{
- LLSINGLETON_EMPTY_CTOR(LLRecentPeople);
- LOG_CLASS(LLRecentPeople);
+ LLSINGLETON_EMPTY_CTOR(LLRecentPeople);
+ LOG_CLASS(LLRecentPeople);
public:
- typedef std::map <LLUUID, F64> id_to_time_map_t;
- typedef boost::signals2::signal<void ()> signal_t;
-
- /**
- * Add specified avatar to the list if it's not there already.
- *
- * @param id avatar to add.
- *
- * @param userdata additional information about last interaction party.
- * For example session id can be added.
- *
- * @return false if the avatar is in the list already, true otherwise
- */
- bool add(const LLUUID& id, const LLSD& userdata = LLSD().with("date", LLDate::now()));
-
- /**
- * @param id avatar to search.
- * @return true if the avatar is in the list, false otherwise.
- */
- bool contains(const LLUUID& id) const;
-
- /**
- * Get the whole list.
- *
- * @param result where to put the result.
- */
- void get(uuid_vec_t& result) const;
-
- /**
- * Returns last interaction time with specified participant
- *
- */
- const LLDate getDate(const LLUUID& id) const;
-
- /**
- * Returns data about specified participant
- *
- * @param id identifier of specific participant
- */
- const LLSD& getData(const LLUUID& id) const;
-
- /**
- * Set callback to be called when the list changed.
- *
- * Multiple callbacks can be set.
- *
- * @return no connection; use boost::bind + boost::signals2::trackable to disconnect slots.
- */
- void setChangedCallback(const signal_t::slot_type& cb) { mChangedSignal.connect(cb); }
-
- /**
- * LLSimpleListener interface.
- */
- /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata) override;
-
- void updateAvatarsArrivalTime(uuid_vec_t& uuids);
- F32 getArrivalTimeByID(const LLUUID& id);
+ typedef std::map <LLUUID, F64> id_to_time_map_t;
+ typedef boost::signals2::signal<void ()> signal_t;
+
+ /**
+ * Add specified avatar to the list if it's not there already.
+ *
+ * @param id avatar to add.
+ *
+ * @param userdata additional information about last interaction party.
+ * For example session id can be added.
+ *
+ * @return false if the avatar is in the list already, true otherwise
+ */
+ bool add(const LLUUID& id, const LLSD& userdata = LLSD().with("date", LLDate::now()));
+
+ /**
+ * @param id avatar to search.
+ * @return true if the avatar is in the list, false otherwise.
+ */
+ bool contains(const LLUUID& id) const;
+
+ /**
+ * Get the whole list.
+ *
+ * @param result where to put the result.
+ */
+ void get(uuid_vec_t& result) const;
+
+ /**
+ * Returns last interaction time with specified participant
+ *
+ */
+ const LLDate getDate(const LLUUID& id) const;
+
+ /**
+ * Returns data about specified participant
+ *
+ * @param id identifier of specific participant
+ */
+ const LLSD& getData(const LLUUID& id) const;
+
+ /**
+ * Set callback to be called when the list changed.
+ *
+ * Multiple callbacks can be set.
+ *
+ * @return no connection; use boost::bind + boost::signals2::trackable to disconnect slots.
+ */
+ void setChangedCallback(const signal_t::slot_type& cb) { mChangedSignal.connect(cb); }
+
+ /**
+ * LLSimpleListener interface.
+ */
+ /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata) override;
+
+ void updateAvatarsArrivalTime(uuid_vec_t& uuids);
+ F32 getArrivalTimeByID(const LLUUID& id);
private:
- typedef std::map<LLUUID, LLSD> recent_people_t;
- recent_people_t mPeople;
- signal_t mChangedSignal;
- id_to_time_map_t mAvatarsArrivalTime;
+ typedef std::map<LLUUID, LLSD> recent_people_t;
+ recent_people_t mPeople;
+ signal_t mChangedSignal;
+ id_to_time_map_t mAvatarsArrivalTime;
};
#endif // LL_LLRECENTPEOPLE_H
diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp
index a26445b4bc..26aabb9d4c 100644
--- a/indra/newview/llreflectionmap.cpp
+++ b/indra/newview/llreflectionmap.cpp
@@ -56,7 +56,7 @@ void LLReflectionMap::update(U32 resolution, U32 face)
llassert(mCubeArray.notNull());
llassert(mCubeIndex != -1);
//llassert(LLPipeline::sRenderDeferred);
-
+
// make sure we don't walk off the edge of the render target
while (resolution > gPipeline.mRT->deferredScreen.getWidth() ||
resolution > gPipeline.mRT->deferredScreen.getHeight())
@@ -140,7 +140,7 @@ void LLReflectionMap::autoAdjustOrigin()
LLVector3 origin(fp);
F32 height = LLWorld::instance().resolveLandHeightAgent(origin) + 2.f;
fp[2] = llmax(fp[2], height);
-
+
// make sure radius encompasses all objects
LLSimdScalar r2 = 0.0;
for (int i = 0; i < 8; ++i)
@@ -160,7 +160,7 @@ void LLReflectionMap::autoAdjustOrigin()
// make sure near clip doesn't poke through ground
fp[2] = llmax(fp[2], height+mRadius*0.5f);
-
+
}
}
else if (mViewerObject)
@@ -232,7 +232,7 @@ F32 LLReflectionMap::getNearClip()
bool LLReflectionMap::getIsDynamic()
{
if (gSavedSettings.getS32("RenderReflectionProbeDetail") > (S32) LLReflectionMapManager::DetailLevel::STATIC_ONLY &&
- mViewerObject &&
+ mViewerObject &&
mViewerObject->getVolume())
{
return ((LLVOVolume*)mViewerObject)->getReflectionProbeIsDynamic();
@@ -242,7 +242,7 @@ bool LLReflectionMap::getIsDynamic()
}
bool LLReflectionMap::getBox(LLMatrix4& box)
-{
+{
if (mViewerObject)
{
LLVolume* volume = mViewerObject->getVolume();
@@ -265,7 +265,7 @@ bool LLReflectionMap::getBox(LLMatrix4& box)
// construct object to camera space (with scale)
mv = mv * rm * scale;
- // inverse is camera space to object unit cube
+ // inverse is camera space to object unit cube
mv = mv.inverse();
box = LLMatrix4(mv.m);
@@ -332,7 +332,7 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye)
mOccluded = false;
return;
}
-
+
if (mOcclusionQuery == 0)
{ // no query was previously issued, allocate one and issue
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - glGenQueries");
diff --git a/indra/newview/llreflectionmap.h b/indra/newview/llreflectionmap.h
index 7ea0fe6187..924cf6233f 100644
--- a/indra/newview/llreflectionmap.h
+++ b/indra/newview/llreflectionmap.h
@@ -36,7 +36,7 @@ class alignas(16) LLReflectionMap : public LLRefCount
{
LL_ALIGN_NEW
public:
- // allocate an environment map of the given resolution
+ // allocate an environment map of the given resolution
LLReflectionMap();
~LLReflectionMap();
@@ -77,7 +77,7 @@ public:
// point at which environment map was last generated from (in agent space)
LLVector4a mOrigin;
-
+
// distance from main viewer camera
F32 mDistance = -1.f;
@@ -97,7 +97,7 @@ public:
// cube map used to sample this environment map
LLPointer<LLCubeMapArray> mCubeArray;
S32 mCubeIndex = -1; // index into cube map array or -1 if not currently stored in cube map array
-
+
// probe has had at least one full update and is ready to render
bool mComplete = false;
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index 69674417c1..669989e6e1 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -143,7 +143,7 @@ void LLReflectionMapManager::update()
{
U32 res = mProbeResolution;
U32 count = log2((F32)res) + 0.5f;
-
+
mMipChain.resize(count);
for (int i = 0; i < count; ++i)
{
@@ -153,7 +153,7 @@ void LLReflectionMapManager::update()
}
llassert(mProbes[0] == mDefaultProbe);
-
+
LLVector4a camera_pos;
camera_pos.load3(LLViewerCamera::instance().getOrigin().mV);
@@ -168,7 +168,7 @@ void LLReflectionMapManager::update()
}
mKillList.clear();
-
+
// process create list
for (auto& probe : mCreateList)
{
@@ -184,12 +184,12 @@ void LLReflectionMapManager::update()
bool did_update = false;
-
+
static LLCachedControl<S32> sDetail(gSavedSettings, "RenderReflectionProbeDetail", -1);
static LLCachedControl<S32> sLevel(gSavedSettings, "RenderReflectionProbeLevel", 3);
bool realtime = sDetail >= (S32)LLReflectionMapManager::DetailLevel::REALTIME;
-
+
LLReflectionMap* closestDynamic = nullptr;
LLReflectionMap* oldestProbe = nullptr;
@@ -251,7 +251,7 @@ void LLReflectionMapManager::update()
--i;
continue;
}
-
+
if (probe != mDefaultProbe &&
(!probe->isRelevant() || mPaused))
{ // skip irrelevant probes (or all non-default probes if paused)
@@ -306,8 +306,8 @@ void LLReflectionMapManager::update()
}
}
- if (realtime &&
- closestDynamic == nullptr &&
+ if (realtime &&
+ closestDynamic == nullptr &&
probe->mCubeIndex != -1 &&
probe->getIsDynamic())
{
@@ -322,7 +322,7 @@ void LLReflectionMapManager::update()
// should do a full irradiance pass on "odd" frames and a radiance pass on "even" frames
closestDynamic->autoAdjustOrigin();
- // store and override the value of "isRadiancePass" -- parts of the render pipe rely on "isRadiancePass" to set
+ // store and override the value of "isRadiancePass" -- parts of the render pipe rely on "isRadiancePass" to set
// lighting values etc
bool radiance_pass = isRadiancePass();
mRadiancePass = mRealtimeRadiancePass;
@@ -354,7 +354,7 @@ void LLReflectionMapManager::update()
{
LLReflectionMap* probe = oldestProbe;
llassert(probe->mCubeIndex != -1);
-
+
probe->autoAdjustOrigin();
sUpdateCount++;
@@ -543,7 +543,7 @@ void LLReflectionMapManager::doProbeUpdate()
llassert(mUpdatingProbe != nullptr);
updateProbeFace(mUpdatingProbe, mUpdatingFace);
-
+
bool debug_updates = gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PROBE_UPDATES) && mUpdatingProbe->mViewerObject;
if (++mUpdatingFace == 6)
@@ -573,7 +573,7 @@ void LLReflectionMapManager::doProbeUpdate()
// Do the reflection map update render passes.
// For every 12 calls of this function, one complete reflection probe radiance map and irradiance map is generated
-// First six passes render the scene with direct lighting only into a scratch space cube map at the end of the cube map array and generate
+// First six passes render the scene with direct lighting only into a scratch space cube map at the end of the cube map array and generate
// a simple mip chain (not convolution filter).
// At the end of these passes, an irradiance map is generated for this probe and placed into the irradiance cube map array at the index for this probe
// The next six passes render the scene with both radiance and irradiance into the same scratch space cube map and generate a simple mip chain.
@@ -596,11 +596,11 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
touch_default_probe(probe);
gPipeline.pushRenderTypeMask();
-
+
//only render sky, water, terrain, and clouds
gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY,
LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_VOIDWATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::RENDER_TYPE_TERRAIN, LLPipeline::END_RENDER_TYPES);
-
+
probe->update(mRenderTarget.getWidth(), face);
gPipeline.popRenderTypeMask();
@@ -609,7 +609,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
{
probe->update(mRenderTarget.getWidth(), face);
}
-
+
gPipeline.mRT = &gPipeline.mMainRT;
S32 sourceIdx = mReflectionProbeCount;
@@ -686,12 +686,12 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
gGL.getTexUnit(diffuseChannel)->bind(&(mMipChain[i - 1]));
}
-
+
gReflectionMipProgram.uniform1f(resScale, 1.f/(mProbeResolution*2));
-
+
gPipeline.mScreenTriangleVB->setBuffer();
gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
-
+
res /= 2;
S32 mip = i - (mMipChain.size() - mips);
@@ -780,7 +780,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
gIrradianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
gIrradianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
-
+
mVertexBuffer->setBuffer();
int start_mip = 0;
// find the mip target to start with based on irradiance map resolution
@@ -856,7 +856,7 @@ void LLReflectionMapManager::updateNeighbors(LLReflectionMap* probe)
//remove from existing neighbors
{
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("rmmun - clear");
-
+
for (auto& other : probe->mNeighbors)
{
auto const & iter = std::find(other->mNeighbors.begin(), other->mNeighbors.end(), probe);
@@ -898,14 +898,14 @@ void LLReflectionMapManager::updateUniforms()
// see class3/deferred/reflectionProbeF.glsl
struct ReflectionProbeData
{
- // for box probes, matrix that transforms from camera space to a [-1, 1] cube representing the bounding box of
+ // for box probes, matrix that transforms from camera space to a [-1, 1] cube representing the bounding box of
// the box probe
- LLMatrix4 refBox[LL_MAX_REFLECTION_PROBE_COUNT];
+ LLMatrix4 refBox[LL_MAX_REFLECTION_PROBE_COUNT];
// for sphere probes, origin (xyz) and radius (w) of refmaps in clip space
- LLVector4 refSphere[LL_MAX_REFLECTION_PROBE_COUNT];
+ LLVector4 refSphere[LL_MAX_REFLECTION_PROBE_COUNT];
- // extra parameters
+ // extra parameters
// x - irradiance scale
// y - radiance scale
// z - fade in
@@ -917,14 +917,14 @@ void LLReflectionMapManager::updateUniforms()
// [i][1] - index into "refNeighbor" for probes that intersect this probe
// [i][2] - number of probes that intersect this probe, or -1 for no neighbors
// [i][3] - priority (probe type stored in sign bit - positive for spheres, negative for boxes)
- GLint refIndex[LL_MAX_REFLECTION_PROBE_COUNT][4];
+ GLint refIndex[LL_MAX_REFLECTION_PROBE_COUNT][4];
// list of neighbor indices
- GLint refNeighbor[4096];
+ GLint refNeighbor[4096];
GLint refBucket[256][4]; //lookup table for which index to start with for the given Z depth
// numbrer of active refmaps
- GLint refmapCount;
+ GLint refmapCount;
};
mReflectionMaps.resize(mReflectionProbeCount);
@@ -961,7 +961,7 @@ void LLReflectionMapManager::updateUniforms()
bool is_ambiance_pass = gCubeSnapshot && !isRadiancePass();
F32 ambscale = is_ambiance_pass ? 0.f : 1.f;
F32 radscale = is_ambiance_pass ? 0.5f : 1.f;
-
+
for (auto* refmap : mReflectionMaps)
{
if (refmap == nullptr)
@@ -1093,7 +1093,7 @@ void LLReflectionMapManager::updateUniforms()
{
// fill in gaps in refBucket
S32 probe_idx = mReflectionProbeCount;
-
+
for (int i = 0; i < 256; ++i)
{
if (i < count)
@@ -1152,7 +1152,7 @@ void LLReflectionMapManager::setUniforms()
}
if (mUBO == 0)
- {
+ {
updateUniforms();
}
glBindBufferBase(GL_UNIFORM_BUFFER, 1, mUBO);
@@ -1329,9 +1329,9 @@ void LLReflectionMapManager::initReflectionMaps()
buff->allocateBuffer(4, 0);
LLStrider<LLVector3> v;
-
+
buff->getVertexStrider(v);
-
+
v[0] = LLVector3(-1, -1, -1);
v[1] = LLVector3(1, -1, -1);
v[2] = LLVector3(-1, 1, -1);
@@ -1343,8 +1343,8 @@ void LLReflectionMapManager::initReflectionMaps()
}
}
-void LLReflectionMapManager::cleanup()
-{
+void LLReflectionMapManager::cleanup()
+{
mVertexBuffer = nullptr;
mRenderTarget.release();
@@ -1359,7 +1359,7 @@ void LLReflectionMapManager::cleanup()
mReflectionMaps.clear();
mUpdatingFace = 0;
-
+
mDefaultProbe = nullptr;
mUpdatingProbe = nullptr;
diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h
index b77a33da89..bd4204468a 100644
--- a/indra/newview/llreflectionmapmanager.h
+++ b/indra/newview/llreflectionmapmanager.h
@@ -47,17 +47,17 @@ class alignas(16) LLReflectionMapManager
{
LL_ALIGN_NEW
public:
- enum class DetailLevel
+ enum class DetailLevel
{
STATIC_ONLY = 0,
STATIC_AND_DYNAMIC,
REALTIME = 2
};
- // allocate an environment map of the given resolution
+ // allocate an environment map of the given resolution
LLReflectionMapManager();
- // release any GL state
+ // release any GL state
void cleanup();
// maintain reflection probes
@@ -65,7 +65,7 @@ public:
// add a probe for the given spatial group
LLReflectionMap* addProbe(LLSpatialGroup* group = nullptr);
-
+
// Populate "maps" with the N most relevant Reflection Maps where N is no more than maps.size()
// If less than maps.size() ReflectionMaps are available, will assign trailing elements to nullptr.
// maps -- presized array of Reflection Map pointers
@@ -119,7 +119,7 @@ private:
// returns -1 if allocation failed
S32 allocateCubeIndex();
- // update the neighbors of the given probe
+ // update the neighbors of the given probe
void updateNeighbors(LLReflectionMap* probe);
// update UBO used for rendering (call only once per render pipe flush)
@@ -151,7 +151,7 @@ private:
// update the specified face of the specified probe
void updateProbeFace(LLReflectionMap* probe, U32 face);
-
+
// list of active reflection maps
std::vector<LLPointer<LLReflectionMap> > mProbes;
diff --git a/indra/newview/llregioninfomodel.cpp b/indra/newview/llregioninfomodel.cpp
index 6caec6ec4a..383ec60543 100644
--- a/indra/newview/llregioninfomodel.cpp
+++ b/indra/newview/llregioninfomodel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llregioninfomodel.cpp
* @brief Region info model
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,217 +38,217 @@
void LLRegionInfoModel::reset()
{
- mSimAccess = 0;
- mAgentLimit = 0;
- mHardAgentLimit = 100;
+ mSimAccess = 0;
+ mAgentLimit = 0;
+ mHardAgentLimit = 100;
- mRegionFlags = 0;
- mEstateID = 0;
- mParentEstateID = 0;
+ mRegionFlags = 0;
+ mEstateID = 0;
+ mParentEstateID = 0;
- mPricePerMeter = 0;
- mRedirectGridX = 0;
- mRedirectGridY = 0;
+ mPricePerMeter = 0;
+ mRedirectGridX = 0;
+ mRedirectGridY = 0;
- mBillableFactor = 0.0f;
- mObjectBonusFactor = 0.0f;
- mWaterHeight = 0.0f;
- mTerrainRaiseLimit = 0.0f;
- mTerrainLowerLimit = 0.0f;
- mSunHour = 0.0f;
+ mBillableFactor = 0.0f;
+ mObjectBonusFactor = 0.0f;
+ mWaterHeight = 0.0f;
+ mTerrainRaiseLimit = 0.0f;
+ mTerrainLowerLimit = 0.0f;
+ mSunHour = 0.0f;
- mUseEstateSun = false;
+ mUseEstateSun = false;
- mSimType.clear();
- mSimName.clear();
+ mSimType.clear();
+ mSimName.clear();
}
LLRegionInfoModel::LLRegionInfoModel()
{
- reset();
+ reset();
}
boost::signals2::connection LLRegionInfoModel::setUpdateCallback(const update_signal_t::slot_type& cb)
{
- return mUpdateSignal.connect(cb);
+ return mUpdateSignal.connect(cb);
}
void LLRegionInfoModel::sendRegionTerrain(const LLUUID& invoice) const
{
- std::string buffer;
- std::vector<std::string> strings;
-
- // ==========================================
- // Assemble and send setregionterrain message
- // "setregionterrain"
- // strings[0] = float water height
- // strings[1] = float terrain raise
- // strings[2] = float terrain lower
- // strings[3] = 'Y' use estate time
- // strings[4] = 'Y' fixed sun
- // strings[5] = float sun_hour
- // strings[6] = from estate, 'Y' use global time
- // strings[7] = from estate, 'Y' fixed sun
- // strings[8] = from estate, float sun_hour
-
- // *NOTE: this resets estate sun info.
- BOOL estate_global_time = true;
- BOOL estate_fixed_sun = false;
- F32 estate_sun_hour = 0.f;
-
- buffer = llformat("%f", mWaterHeight);
- strings.push_back(buffer);
- buffer = llformat("%f", mTerrainRaiseLimit);
- strings.push_back(buffer);
- buffer = llformat("%f", mTerrainLowerLimit);
- strings.push_back(buffer);
- buffer = llformat("%s", (mUseEstateSun ? "Y" : "N"));
- strings.push_back(buffer);
- buffer = llformat("%s", (getUseFixedSun() ? "Y" : "N"));
- strings.push_back(buffer);
- buffer = llformat("%f", mSunHour);
- strings.push_back(buffer);
- buffer = llformat("%s", (estate_global_time ? "Y" : "N") );
- strings.push_back(buffer);
- buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") );
- strings.push_back(buffer);
- buffer = llformat("%f", estate_sun_hour);
- strings.push_back(buffer);
-
- sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings);
+ std::string buffer;
+ std::vector<std::string> strings;
+
+ // ==========================================
+ // Assemble and send setregionterrain message
+ // "setregionterrain"
+ // strings[0] = float water height
+ // strings[1] = float terrain raise
+ // strings[2] = float terrain lower
+ // strings[3] = 'Y' use estate time
+ // strings[4] = 'Y' fixed sun
+ // strings[5] = float sun_hour
+ // strings[6] = from estate, 'Y' use global time
+ // strings[7] = from estate, 'Y' fixed sun
+ // strings[8] = from estate, float sun_hour
+
+ // *NOTE: this resets estate sun info.
+ BOOL estate_global_time = true;
+ BOOL estate_fixed_sun = false;
+ F32 estate_sun_hour = 0.f;
+
+ buffer = llformat("%f", mWaterHeight);
+ strings.push_back(buffer);
+ buffer = llformat("%f", mTerrainRaiseLimit);
+ strings.push_back(buffer);
+ buffer = llformat("%f", mTerrainLowerLimit);
+ strings.push_back(buffer);
+ buffer = llformat("%s", (mUseEstateSun ? "Y" : "N"));
+ strings.push_back(buffer);
+ buffer = llformat("%s", (getUseFixedSun() ? "Y" : "N"));
+ strings.push_back(buffer);
+ buffer = llformat("%f", mSunHour);
+ strings.push_back(buffer);
+ buffer = llformat("%s", (estate_global_time ? "Y" : "N") );
+ strings.push_back(buffer);
+ buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") );
+ strings.push_back(buffer);
+ buffer = llformat("%f", estate_sun_hour);
+ strings.push_back(buffer);
+
+ sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings);
}
bool LLRegionInfoModel::getUseFixedSun() const
{
- return ((mRegionFlags & REGION_FLAGS_SUN_FIXED) != 0);
+ return ((mRegionFlags & REGION_FLAGS_SUN_FIXED) != 0);
}
void LLRegionInfoModel::setUseFixedSun(bool fixed)
{
- if (fixed)
- {
- mRegionFlags |= REGION_FLAGS_SUN_FIXED;
- }
- else
- {
- mRegionFlags &= ~REGION_FLAGS_SUN_FIXED;
- }
+ if (fixed)
+ {
+ mRegionFlags |= REGION_FLAGS_SUN_FIXED;
+ }
+ else
+ {
+ mRegionFlags &= ~REGION_FLAGS_SUN_FIXED;
+ }
}
void LLRegionInfoModel::update(LLMessageSystem* msg)
{
- reset();
-
- msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, mSimName);
- msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, mEstateID);
- msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, mParentEstateID);
- msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, mSimAccess);
- msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, mAgentLimit);
-
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, mObjectBonusFactor);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_BillableFactor, mBillableFactor);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, mWaterHeight);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, mTerrainRaiseLimit);
- msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, mTerrainLowerLimit);
- msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_PricePerMeter, mPricePerMeter);
- msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridX, mRedirectGridX);
- msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridY, mRedirectGridY);
-
- msg->getBOOL(_PREHASH_RegionInfo, _PREHASH_UseEstateSun, mUseEstateSun);
-
- // actually the "last set" sun hour, not the current sun hour. JC
- msg->getF32(_PREHASH_RegionInfo, _PREHASH_SunHour, mSunHour);
- LL_DEBUGS("WindlightSync") << "Got region sun hour: " << mSunHour << LL_ENDL;
-
- msg->getS32Fast(_PREHASH_RegionInfo2, _PREHASH_HardMaxAgents, mHardAgentLimit);
-
- if (msg->has(_PREHASH_RegionInfo3))
- {
- msg->getU64Fast(_PREHASH_RegionInfo3, _PREHASH_RegionFlagsExtended, mRegionFlags);
- }
- else
- {
- U32 flags = 0;
- msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags);
- mRegionFlags = flags;
- }
-
- if (msg->has(_PREHASH_RegionInfo5))
- {
- F32 chat_whisper_range;
- F32 chat_normal_range;
- F32 chat_shout_range;
- F32 chat_whisper_offset;
- F32 chat_normal_offset;
- F32 chat_shout_offset;
- U32 chat_flags;
-
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperRange, chat_whisper_range);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalRange, chat_normal_range);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutRange, chat_shout_range);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperOffset, chat_whisper_offset);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalOffset, chat_normal_offset);
- msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutOffset, chat_shout_offset);
- msg->getU32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatFlags, chat_flags);
-
- LL_INFOS() << "Whisper range: " << chat_whisper_range << " normal range: " << chat_normal_range << " shout range: " << chat_shout_range
- << " whisper offset: " << chat_whisper_offset << " normal offset: " << chat_normal_offset << " shout offset: " << chat_shout_offset
- << " chat flags: " << chat_flags << LL_ENDL;
- }
-
- // the only reasonable way to decide if we actually have any data is to
- // check to see if any of these fields have nonzero sizes
- if (msg->getSize(_PREHASH_RegionInfo2, _PREHASH_ProductSKU) > 0 ||
- msg->getSize(_PREHASH_RegionInfo2, "ProductName") > 0)
- {
- msg->getString(_PREHASH_RegionInfo2, "ProductName", mSimType);
- }
-
- // Let interested parties know that region info has been updated.
- mUpdateSignal();
+ reset();
+
+ msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, mSimName);
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, mEstateID);
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, mParentEstateID);
+ msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, mSimAccess);
+ msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, mAgentLimit);
+
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, mObjectBonusFactor);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_BillableFactor, mBillableFactor);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, mWaterHeight);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, mTerrainRaiseLimit);
+ msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, mTerrainLowerLimit);
+ msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_PricePerMeter, mPricePerMeter);
+ msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridX, mRedirectGridX);
+ msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridY, mRedirectGridY);
+
+ msg->getBOOL(_PREHASH_RegionInfo, _PREHASH_UseEstateSun, mUseEstateSun);
+
+ // actually the "last set" sun hour, not the current sun hour. JC
+ msg->getF32(_PREHASH_RegionInfo, _PREHASH_SunHour, mSunHour);
+ LL_DEBUGS("WindlightSync") << "Got region sun hour: " << mSunHour << LL_ENDL;
+
+ msg->getS32Fast(_PREHASH_RegionInfo2, _PREHASH_HardMaxAgents, mHardAgentLimit);
+
+ if (msg->has(_PREHASH_RegionInfo3))
+ {
+ msg->getU64Fast(_PREHASH_RegionInfo3, _PREHASH_RegionFlagsExtended, mRegionFlags);
+ }
+ else
+ {
+ U32 flags = 0;
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags);
+ mRegionFlags = flags;
+ }
+
+ if (msg->has(_PREHASH_RegionInfo5))
+ {
+ F32 chat_whisper_range;
+ F32 chat_normal_range;
+ F32 chat_shout_range;
+ F32 chat_whisper_offset;
+ F32 chat_normal_offset;
+ F32 chat_shout_offset;
+ U32 chat_flags;
+
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperRange, chat_whisper_range);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalRange, chat_normal_range);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutRange, chat_shout_range);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatWhisperOffset, chat_whisper_offset);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatNormalOffset, chat_normal_offset);
+ msg->getF32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatShoutOffset, chat_shout_offset);
+ msg->getU32Fast(_PREHASH_RegionInfo5, _PREHASH_ChatFlags, chat_flags);
+
+ LL_INFOS() << "Whisper range: " << chat_whisper_range << " normal range: " << chat_normal_range << " shout range: " << chat_shout_range
+ << " whisper offset: " << chat_whisper_offset << " normal offset: " << chat_normal_offset << " shout offset: " << chat_shout_offset
+ << " chat flags: " << chat_flags << LL_ENDL;
+ }
+
+ // the only reasonable way to decide if we actually have any data is to
+ // check to see if any of these fields have nonzero sizes
+ if (msg->getSize(_PREHASH_RegionInfo2, _PREHASH_ProductSKU) > 0 ||
+ msg->getSize(_PREHASH_RegionInfo2, "ProductName") > 0)
+ {
+ msg->getString(_PREHASH_RegionInfo2, "ProductName", mSimType);
+ }
+
+ // Let interested parties know that region info has been updated.
+ mUpdateSignal();
}
// static
void LLRegionInfoModel::sendEstateOwnerMessage(
- LLMessageSystem* msg,
- const std::string& request,
- const LLUUID& invoice,
- const std::vector<std::string>& strings)
+ LLMessageSystem* msg,
+ const std::string& request,
+ const LLUUID& invoice,
+ const std::vector<std::string>& strings)
{
- LLViewerRegion* cur_region = gAgent.getRegion();
-
- if (!cur_region)
- {
- LL_WARNS() << "Agent region not set" << LL_ENDL;
- return;
- }
-
- LL_INFOS() << "Sending estate request '" << request << "'" << LL_ENDL;
- msg->newMessage("EstateOwnerMessage");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", request);
- msg->addUUID("Invoice", invoice);
-
- if (strings.empty())
- {
- msg->nextBlock("ParamList");
- msg->addString("Parameter", NULL);
- }
- else
- {
- std::vector<std::string>::const_iterator it = strings.begin();
- std::vector<std::string>::const_iterator end = strings.end();
- for (unsigned i = 0; it != end; ++it, ++i)
- {
- LL_DEBUGS() << "- [" << i << "] " << (*it) << LL_ENDL;
- msg->nextBlock("ParamList");
- msg->addString("Parameter", *it);
- }
- }
-
- msg->sendReliable(cur_region->getHost());
+ LLViewerRegion* cur_region = gAgent.getRegion();
+
+ if (!cur_region)
+ {
+ LL_WARNS() << "Agent region not set" << LL_ENDL;
+ return;
+ }
+
+ LL_INFOS() << "Sending estate request '" << request << "'" << LL_ENDL;
+ msg->newMessage("EstateOwnerMessage");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ msg->nextBlock("MethodData");
+ msg->addString("Method", request);
+ msg->addUUID("Invoice", invoice);
+
+ if (strings.empty())
+ {
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", NULL);
+ }
+ else
+ {
+ std::vector<std::string>::const_iterator it = strings.begin();
+ std::vector<std::string>::const_iterator end = strings.end();
+ for (unsigned i = 0; it != end; ++it, ++i)
+ {
+ LL_DEBUGS() << "- [" << i << "] " << (*it) << LL_ENDL;
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", *it);
+ }
+ }
+
+ msg->sendReliable(cur_region->getHost());
}
diff --git a/indra/newview/llregioninfomodel.h b/indra/newview/llregioninfomodel.h
index baeff82fef..e208899372 100644
--- a/indra/newview/llregioninfomodel.h
+++ b/indra/newview/llregioninfomodel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llregioninfomodel.h
* @brief Region info model
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,65 +36,65 @@ class LLMessageSystem;
*/
class LLRegionInfoModel : public LLSingleton<LLRegionInfoModel>
{
- LLSINGLETON(LLRegionInfoModel);
- LOG_CLASS(LLRegionInfoModel);
+ LLSINGLETON(LLRegionInfoModel);
+ LOG_CLASS(LLRegionInfoModel);
public:
- typedef boost::signals2::signal<void()> update_signal_t;
- boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb);
+ typedef boost::signals2::signal<void()> update_signal_t;
+ boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb);
- void sendRegionTerrain(const LLUUID& invoice) const; /// upload region terrain data
+ void sendRegionTerrain(const LLUUID& invoice) const; /// upload region terrain data
- bool getUseFixedSun() const;
+ bool getUseFixedSun() const;
- void setUseFixedSun(bool fixed);
+ void setUseFixedSun(bool fixed);
- // *TODO: Add getters and make the data private.
- U8 mSimAccess;
- U8 mAgentLimit;
+ // *TODO: Add getters and make the data private.
+ U8 mSimAccess;
+ U8 mAgentLimit;
- S32 mHardAgentLimit;
+ S32 mHardAgentLimit;
- U64 mRegionFlags;
- U32 mEstateID;
- U32 mParentEstateID;
+ U64 mRegionFlags;
+ U32 mEstateID;
+ U32 mParentEstateID;
- S32 mPricePerMeter;
- S32 mRedirectGridX;
- S32 mRedirectGridY;
+ S32 mPricePerMeter;
+ S32 mRedirectGridX;
+ S32 mRedirectGridY;
- F32 mBillableFactor;
- F32 mObjectBonusFactor;
- F32 mWaterHeight;
- F32 mTerrainRaiseLimit;
- F32 mTerrainLowerLimit;
- F32 mSunHour; // 6..30
+ F32 mBillableFactor;
+ F32 mObjectBonusFactor;
+ F32 mWaterHeight;
+ F32 mTerrainRaiseLimit;
+ F32 mTerrainLowerLimit;
+ F32 mSunHour; // 6..30
- BOOL mUseEstateSun;
+ BOOL mUseEstateSun;
- std::string mSimName;
- std::string mSimType;
+ std::string mSimName;
+ std::string mSimType;
protected:
- friend class LLViewerRegion;
+ friend class LLViewerRegion;
- /**
- * Refresh model with data from the incoming server message.
- */
- void update(LLMessageSystem* msg);
+ /**
+ * Refresh model with data from the incoming server message.
+ */
+ void update(LLMessageSystem* msg);
private:
- void reset();
+ void reset();
- // *FIXME: Duplicated code from LLPanelRegionInfo
- static void sendEstateOwnerMessage(
- LLMessageSystem* msg,
- const std::string& request,
- const LLUUID& invoice,
- const std::vector<std::string>& strings);
+ // *FIXME: Duplicated code from LLPanelRegionInfo
+ static void sendEstateOwnerMessage(
+ LLMessageSystem* msg,
+ const std::string& request,
+ const LLUUID& invoice,
+ const std::vector<std::string>& strings);
- update_signal_t mUpdateSignal;
+ update_signal_t mUpdateSignal;
};
#endif // LL_LLREGIONINFOMODEL_H
diff --git a/indra/newview/llregionposition.cpp b/indra/newview/llregionposition.cpp
index 32c271b2b8..ea774a0e55 100644
--- a/indra/newview/llregionposition.cpp
+++ b/indra/newview/llregionposition.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llregionposition.cpp
* @brief Region position storing class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,61 +34,61 @@
LLRegionPosition::LLRegionPosition()
{
- mRegionp = NULL;
+ mRegionp = NULL;
}
LLRegionPosition::LLRegionPosition(LLViewerRegion *regionp, const LLVector3 &position)
{
- mRegionp = regionp;
- mPositionRegion = position;
+ mRegionp = regionp;
+ mPositionRegion = position;
}
LLRegionPosition::LLRegionPosition(const LLVector3d &global_position)
{
- setPositionGlobal(global_position);
+ setPositionGlobal(global_position);
}
LLViewerRegion *LLRegionPosition::getRegion() const
{
- return mRegionp;
+ return mRegionp;
}
const LLVector3 &LLRegionPosition::getPositionRegion() const
{
- return mPositionRegion;
+ return mPositionRegion;
}
const LLVector3 LLRegionPosition::getPositionAgent() const
{
- return mRegionp->getPosAgentFromRegion( mPositionRegion );
+ return mRegionp->getPosAgentFromRegion( mPositionRegion );
}
LLVector3d LLRegionPosition::getPositionGlobal() const
{
- if (mRegionp)
- {
- return mRegionp->getPosGlobalFromRegion(mPositionRegion);
- }
- else
- {
- LLVector3d pos_global;
- pos_global.setVec(mPositionRegion);
- return pos_global;
- }
+ if (mRegionp)
+ {
+ return mRegionp->getPosGlobalFromRegion(mPositionRegion);
+ }
+ else
+ {
+ LLVector3d pos_global;
+ pos_global.setVec(mPositionRegion);
+ return pos_global;
+ }
}
void LLRegionPosition::setPositionGlobal(const LLVector3d& position_global )
{
- mRegionp = LLWorld::getInstance()->getRegionFromPosGlobal(position_global);
- if (mRegionp)
- {
- mPositionRegion = mRegionp->getPosRegionFromGlobal(position_global);
- }
- else
- {
- mRegionp = gAgent.getRegion();
- llassert(mRegionp);
- mPositionRegion = mRegionp->getPosRegionFromGlobal(position_global);
- }
+ mRegionp = LLWorld::getInstance()->getRegionFromPosGlobal(position_global);
+ if (mRegionp)
+ {
+ mPositionRegion = mRegionp->getPosRegionFromGlobal(position_global);
+ }
+ else
+ {
+ mRegionp = gAgent.getRegion();
+ llassert(mRegionp);
+ mPositionRegion = mRegionp->getPosRegionFromGlobal(position_global);
+ }
}
diff --git a/indra/newview/llregionposition.h b/indra/newview/llregionposition.h
index 8f72fa2e4e..d46870c062 100644
--- a/indra/newview/llregionposition.h
+++ b/indra/newview/llregionposition.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llregionposition.h
* @brief Region position storing class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,22 +40,22 @@ class LLViewerRegion;
class LLRegionPosition
{
private:
- LLViewerRegion *mRegionp;
+ LLViewerRegion *mRegionp;
public:
- LLVector3 mPositionRegion;
- LLRegionPosition();
- LLRegionPosition(LLViewerRegion *regionp, const LLVector3 &position_local);
- LLRegionPosition(const LLVector3d &global_position); // From global coords ONLY!
+ LLVector3 mPositionRegion;
+ LLRegionPosition();
+ LLRegionPosition(LLViewerRegion *regionp, const LLVector3 &position_local);
+ LLRegionPosition(const LLVector3d &global_position); // From global coords ONLY!
- LLViewerRegion* getRegion() const;
- void setPositionGlobal(const LLVector3d& global_pos);
- LLVector3d getPositionGlobal() const;
- const LLVector3& getPositionRegion() const;
- const LLVector3 getPositionAgent() const;
+ LLViewerRegion* getRegion() const;
+ void setPositionGlobal(const LLVector3d& global_pos);
+ LLVector3d getPositionGlobal() const;
+ const LLVector3& getPositionRegion() const;
+ const LLVector3 getPositionAgent() const;
- void clear() { mRegionp = NULL; mPositionRegion.clearVec(); }
-// LLRegionPosition operator+(const LLRegionPosition &pos) const;
+ void clear() { mRegionp = NULL; mPositionRegion.clearVec(); }
+// LLRegionPosition operator+(const LLRegionPosition &pos) const;
};
#endif // LL_REGION_POSITION_H
diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp
index f4ace52faa..7b80e8c27f 100644
--- a/indra/newview/llremoteparcelrequest.cpp
+++ b/indra/newview/llremoteparcelrequest.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llremoteparcelrequest.cpp
* @author Sam Kolb
* @brief Get information about a parcel you aren't standing in to display
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,125 +44,125 @@
void LLRemoteParcelInfoProcessor::addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer)
{
- observer_multimap_t::iterator it;
- observer_multimap_t::iterator start = mObservers.lower_bound(parcel_id);
- observer_multimap_t::iterator end = mObservers.upper_bound(parcel_id);
-
- // Check if the observer is already in observers list for this UUID
- for(it = start; it != end; ++it)
- {
- if (it->second.get() == observer)
- {
- return;
- }
- }
-
- mObservers.insert(std::make_pair(parcel_id, observer->getObserverHandle()));
+ observer_multimap_t::iterator it;
+ observer_multimap_t::iterator start = mObservers.lower_bound(parcel_id);
+ observer_multimap_t::iterator end = mObservers.upper_bound(parcel_id);
+
+ // Check if the observer is already in observers list for this UUID
+ for(it = start; it != end; ++it)
+ {
+ if (it->second.get() == observer)
+ {
+ return;
+ }
+ }
+
+ mObservers.insert(std::make_pair(parcel_id, observer->getObserverHandle()));
}
void LLRemoteParcelInfoProcessor::removeObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer)
{
- if (!observer)
- {
- return;
- }
-
- observer_multimap_t::iterator it;
- observer_multimap_t::iterator start = mObservers.lower_bound(parcel_id);
- observer_multimap_t::iterator end = mObservers.upper_bound(parcel_id);
-
- for(it = start; it != end; ++it)
- {
- if (it->second.get() == observer)
- {
- mObservers.erase(it);
- break;
- }
- }
+ if (!observer)
+ {
+ return;
+ }
+
+ observer_multimap_t::iterator it;
+ observer_multimap_t::iterator start = mObservers.lower_bound(parcel_id);
+ observer_multimap_t::iterator end = mObservers.upper_bound(parcel_id);
+
+ for(it = start; it != end; ++it)
+ {
+ if (it->second.get() == observer)
+ {
+ mObservers.erase(it);
+ break;
+ }
+ }
}
//static
void LLRemoteParcelInfoProcessor::processParcelInfoReply(LLMessageSystem* msg, void**)
{
- LLParcelData parcel_data;
-
- msg->getUUID ("Data", "ParcelID", parcel_data.parcel_id);
- msg->getUUID ("Data", "OwnerID", parcel_data.owner_id);
- msg->getString ("Data", "Name", parcel_data.name);
- msg->getString ("Data", "Desc", parcel_data.desc);
- msg->getS32 ("Data", "ActualArea", parcel_data.actual_area);
- msg->getS32 ("Data", "BillableArea", parcel_data.billable_area);
- msg->getU8 ("Data", "Flags", parcel_data.flags);
- msg->getF32 ("Data", "GlobalX", parcel_data.global_x);
- msg->getF32 ("Data", "GlobalY", parcel_data.global_y);
- msg->getF32 ("Data", "GlobalZ", parcel_data.global_z);
- msg->getString ("Data", "SimName", parcel_data.sim_name);
- msg->getUUID ("Data", "SnapshotID", parcel_data.snapshot_id);
- msg->getF32 ("Data", "Dwell", parcel_data.dwell);
- msg->getS32 ("Data", "SalePrice", parcel_data.sale_price);
- msg->getS32 ("Data", "AuctionID", parcel_data.auction_id);
-
- LLRemoteParcelInfoProcessor::observer_multimap_t & observers = LLRemoteParcelInfoProcessor::getInstance()->mObservers;
-
- typedef std::vector<observer_multimap_t::iterator> deadlist_t;
- deadlist_t dead_iters;
-
- observer_multimap_t::iterator oi = observers.lower_bound(parcel_data.parcel_id);
- observer_multimap_t::iterator end = observers.upper_bound(parcel_data.parcel_id);
-
- while (oi != end)
- {
- // increment the loop iterator now since it may become invalid below
- observer_multimap_t::iterator cur_oi = oi++;
-
- LLRemoteParcelInfoObserver * observer = cur_oi->second.get();
- if(observer)
- {
- // may invalidate cur_oi if the observer removes itself
- observer->processParcelInfo(parcel_data);
- }
- else
- {
- // the handle points to an expired observer, so don't keep it
- // around anymore
- dead_iters.push_back(cur_oi);
- }
- }
-
- deadlist_t::iterator i;
- deadlist_t::iterator end_dead = dead_iters.end();
- for(i = dead_iters.begin(); i != end_dead; ++i)
- {
- observers.erase(*i);
- }
-
- LLUrlEntryParcel::LLParcelData url_data;
- url_data.parcel_id = parcel_data.parcel_id;
- url_data.name = parcel_data.name;
- url_data.sim_name = parcel_data.sim_name;
- url_data.global_x = parcel_data.global_x;
- url_data.global_y = parcel_data.global_y;
- url_data.global_z = parcel_data.global_z;
-
- // Pass the parcel data to LLUrlEntryParcel to render
- // human readable parcel name.
- LLUrlEntryParcel::processParcelInfo(url_data);
+ LLParcelData parcel_data;
+
+ msg->getUUID ("Data", "ParcelID", parcel_data.parcel_id);
+ msg->getUUID ("Data", "OwnerID", parcel_data.owner_id);
+ msg->getString ("Data", "Name", parcel_data.name);
+ msg->getString ("Data", "Desc", parcel_data.desc);
+ msg->getS32 ("Data", "ActualArea", parcel_data.actual_area);
+ msg->getS32 ("Data", "BillableArea", parcel_data.billable_area);
+ msg->getU8 ("Data", "Flags", parcel_data.flags);
+ msg->getF32 ("Data", "GlobalX", parcel_data.global_x);
+ msg->getF32 ("Data", "GlobalY", parcel_data.global_y);
+ msg->getF32 ("Data", "GlobalZ", parcel_data.global_z);
+ msg->getString ("Data", "SimName", parcel_data.sim_name);
+ msg->getUUID ("Data", "SnapshotID", parcel_data.snapshot_id);
+ msg->getF32 ("Data", "Dwell", parcel_data.dwell);
+ msg->getS32 ("Data", "SalePrice", parcel_data.sale_price);
+ msg->getS32 ("Data", "AuctionID", parcel_data.auction_id);
+
+ LLRemoteParcelInfoProcessor::observer_multimap_t & observers = LLRemoteParcelInfoProcessor::getInstance()->mObservers;
+
+ typedef std::vector<observer_multimap_t::iterator> deadlist_t;
+ deadlist_t dead_iters;
+
+ observer_multimap_t::iterator oi = observers.lower_bound(parcel_data.parcel_id);
+ observer_multimap_t::iterator end = observers.upper_bound(parcel_data.parcel_id);
+
+ while (oi != end)
+ {
+ // increment the loop iterator now since it may become invalid below
+ observer_multimap_t::iterator cur_oi = oi++;
+
+ LLRemoteParcelInfoObserver * observer = cur_oi->second.get();
+ if(observer)
+ {
+ // may invalidate cur_oi if the observer removes itself
+ observer->processParcelInfo(parcel_data);
+ }
+ else
+ {
+ // the handle points to an expired observer, so don't keep it
+ // around anymore
+ dead_iters.push_back(cur_oi);
+ }
+ }
+
+ deadlist_t::iterator i;
+ deadlist_t::iterator end_dead = dead_iters.end();
+ for(i = dead_iters.begin(); i != end_dead; ++i)
+ {
+ observers.erase(*i);
+ }
+
+ LLUrlEntryParcel::LLParcelData url_data;
+ url_data.parcel_id = parcel_data.parcel_id;
+ url_data.name = parcel_data.name;
+ url_data.sim_name = parcel_data.sim_name;
+ url_data.global_x = parcel_data.global_x;
+ url_data.global_y = parcel_data.global_y;
+ url_data.global_z = parcel_data.global_z;
+
+ // Pass the parcel data to LLUrlEntryParcel to render
+ // human readable parcel name.
+ LLUrlEntryParcel::processParcelInfo(url_data);
}
void LLRemoteParcelInfoProcessor::sendParcelInfoRequest(const LLUUID& parcel_id)
{
- LLMessageSystem *msg = gMessageSystem;
-
- msg->newMessage("ParcelInfoRequest");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addUUID("ParcelID", parcel_id);
- gAgent.sendReliableMessage();
+ LLMessageSystem *msg = gMessageSystem;
+
+ msg->newMessage("ParcelInfoRequest");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addUUID("ParcelID", parcel_id);
+ gAgent.sendReliableMessage();
}
-bool LLRemoteParcelInfoProcessor::requestRegionParcelInfo(const std::string &url,
+bool LLRemoteParcelInfoProcessor::requestRegionParcelInfo(const std::string &url,
const LLUUID &regionId, const LLVector3 &regionPos, const LLVector3d&globalPos,
LLHandle<LLRemoteParcelInfoObserver> observerHandle)
{
@@ -178,8 +178,8 @@ bool LLRemoteParcelInfoProcessor::requestRegionParcelInfo(const std::string &url
return false;
}
-void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url,
- LLUUID regionId, LLVector3 posRegion, LLVector3d posGlobal,
+void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url,
+ LLUUID regionId, LLVector3 posRegion, LLVector3d posGlobal,
LLHandle<LLRemoteParcelInfoObserver> observerHandle)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
@@ -220,7 +220,7 @@ void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url,
}
observer->setErrorStatus(status.getStatus(), message);
}
- else
+ else
{
LLUUID parcel_id = result["parcel_id"];
observer->setParcelID(parcel_id);
diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h
index 70c117be44..1420b4032e 100644
--- a/indra/newview/llremoteparcelrequest.h
+++ b/indra/newview/llremoteparcelrequest.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llremoteparcelrequest.h
* @author Sam Kolb
* @brief Get information about a parcel you aren't standing in to display
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,21 +39,21 @@ class LLRemoteParcelInfoObserver;
struct LLParcelData
{
- LLUUID parcel_id;
- LLUUID owner_id;
- std::string name;
- std::string desc;
- S32 actual_area;
- S32 billable_area;
- U8 flags; // group owned, maturity
- F32 global_x;
- F32 global_y;
- F32 global_z;
- std::string sim_name;
- LLUUID snapshot_id;
- F32 dwell;
- S32 sale_price;
- S32 auction_id;
+ LLUUID parcel_id;
+ LLUUID owner_id;
+ std::string name;
+ std::string desc;
+ S32 actual_area;
+ S32 billable_area;
+ U8 flags; // group owned, maturity
+ F32 global_x;
+ F32 global_y;
+ F32 global_z;
+ std::string sim_name;
+ LLUUID snapshot_id;
+ F32 dwell;
+ S32 sale_price;
+ S32 auction_id;
};
// An interface class for panels which display parcel information
@@ -61,36 +61,36 @@ struct LLParcelData
class LLRemoteParcelInfoObserver
{
public:
- LLRemoteParcelInfoObserver() { mObserverHandle.bind(this); }
- virtual ~LLRemoteParcelInfoObserver() {}
- virtual void processParcelInfo(const LLParcelData& parcel_data) = 0;
- virtual void setParcelID(const LLUUID& parcel_id) = 0;
- virtual void setErrorStatus(S32 status, const std::string& reason) = 0;
- LLHandle<LLRemoteParcelInfoObserver> getObserverHandle() const { return mObserverHandle; }
+ LLRemoteParcelInfoObserver() { mObserverHandle.bind(this); }
+ virtual ~LLRemoteParcelInfoObserver() {}
+ virtual void processParcelInfo(const LLParcelData& parcel_data) = 0;
+ virtual void setParcelID(const LLUUID& parcel_id) = 0;
+ virtual void setErrorStatus(S32 status, const std::string& reason) = 0;
+ LLHandle<LLRemoteParcelInfoObserver> getObserverHandle() const { return mObserverHandle; }
protected:
- LLRootHandle<LLRemoteParcelInfoObserver> mObserverHandle;
+ LLRootHandle<LLRemoteParcelInfoObserver> mObserverHandle;
};
class LLRemoteParcelInfoProcessor : public LLSingleton<LLRemoteParcelInfoProcessor>
{
- LLSINGLETON_EMPTY_CTOR(LLRemoteParcelInfoProcessor);
- virtual ~LLRemoteParcelInfoProcessor() {}
+ LLSINGLETON_EMPTY_CTOR(LLRemoteParcelInfoProcessor);
+ virtual ~LLRemoteParcelInfoProcessor() {}
public:
- void addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
- void removeObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
+ void addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
+ void removeObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
- void sendParcelInfoRequest(const LLUUID& parcel_id);
+ void sendParcelInfoRequest(const LLUUID& parcel_id);
- static void processParcelInfoReply(LLMessageSystem* msg, void**);
+ static void processParcelInfoReply(LLMessageSystem* msg, void**);
- bool requestRegionParcelInfo(const std::string &url, const LLUUID &regionId,
+ bool requestRegionParcelInfo(const std::string &url, const LLUUID &regionId,
const LLVector3 &regionPos, const LLVector3d& globalPos, LLHandle<LLRemoteParcelInfoObserver> observerHandle);
private:
- typedef std::multimap<LLUUID, LLHandle<LLRemoteParcelInfoObserver> > observer_multimap_t;
- observer_multimap_t mObservers;
+ typedef std::multimap<LLUUID, LLHandle<LLRemoteParcelInfoObserver> > observer_multimap_t;
+ observer_multimap_t mObservers;
void regionParcelInfoCoro(std::string url, LLUUID regionId, LLVector3 posRegion, LLVector3d posGlobal, LLHandle<LLRemoteParcelInfoObserver> observerHandle);
};
diff --git a/indra/newview/llresourcedata.h b/indra/newview/llresourcedata.h
index 28b97ed130..f6b50574f6 100644
--- a/indra/newview/llresourcedata.h
+++ b/indra/newview/llresourcedata.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llresourcedata.h
* @brief Tracking object for uploads.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,13 +32,13 @@
struct LLResourceData
{
- LLAssetInfo mAssetInfo;
- LLFolderType::EType mPreferredLocation;
- LLInventoryType::EType mInventoryType;
- U32 mNextOwnerPerm;
- S32 mExpectedUploadCost;
- void *mUserData;
- static const S8 INVALID_LOCATION = -2;
+ LLAssetInfo mAssetInfo;
+ LLFolderType::EType mPreferredLocation;
+ LLInventoryType::EType mInventoryType;
+ U32 mNextOwnerPerm;
+ S32 mExpectedUploadCost;
+ void *mUserData;
+ static const S8 INVALID_LOCATION = -2;
};
#endif
diff --git a/indra/newview/llrootview.h b/indra/newview/llrootview.h
index 2ac958e7b8..43b15ee370 100644
--- a/indra/newview/llrootview.h
+++ b/indra/newview/llrootview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llrootview.h
* @brief Mother of all Views
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,16 +33,16 @@
class LLRootViewRegistry : public LLChildRegistry<LLRootViewRegistry>
{
- LLSINGLETON(LLRootViewRegistry);
+ LLSINGLETON(LLRootViewRegistry);
};
class LLRootView : public LLView
{
public:
- typedef LLRootViewRegistry child_registry_t;
+ typedef LLRootViewRegistry child_registry_t;
- LLRootView(const Params& p)
- : LLView(p)
- {}
+ LLRootView(const Params& p)
+ : LLView(p)
+ {}
};
#endif //LL_LLROOTVIEW_H
diff --git a/indra/newview/llsavedsettingsglue.cpp b/indra/newview/llsavedsettingsglue.cpp
index 37b576814d..4b0132974a 100644
--- a/indra/newview/llsavedsettingsglue.cpp
+++ b/indra/newview/llsavedsettingsglue.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsavedsettingsglue.cpp
* @author James Cook
* @brief LLSavedSettingsGlue class implementation
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,25 +35,25 @@
void LLSavedSettingsGlue::setBOOL(LLUICtrl* ctrl, const std::string& name)
{
- gSavedSettings.setBOOL(name, ctrl->getValue().asBoolean());
+ gSavedSettings.setBOOL(name, ctrl->getValue().asBoolean());
}
void LLSavedSettingsGlue::setS32(LLUICtrl* ctrl, const std::string& name)
{
- gSavedSettings.setS32(name, ctrl->getValue().asInteger());
+ gSavedSettings.setS32(name, ctrl->getValue().asInteger());
}
void LLSavedSettingsGlue::setF32(LLUICtrl* ctrl, const std::string& name)
{
- gSavedSettings.setF32(name, (F32)ctrl->getValue().asReal());
+ gSavedSettings.setF32(name, (F32)ctrl->getValue().asReal());
}
void LLSavedSettingsGlue::setU32(LLUICtrl* ctrl, const std::string& name)
{
- gSavedSettings.setU32(name, (U32)ctrl->getValue().asInteger());
+ gSavedSettings.setU32(name, (U32)ctrl->getValue().asInteger());
}
void LLSavedSettingsGlue::setString(LLUICtrl* ctrl, const std::string& name)
{
- gSavedSettings.setString(name, ctrl->getValue().asString());
+ gSavedSettings.setString(name, ctrl->getValue().asString());
}
diff --git a/indra/newview/llsavedsettingsglue.h b/indra/newview/llsavedsettingsglue.h
index e8c6a7dbdb..61967c53d3 100644
--- a/indra/newview/llsavedsettingsglue.h
+++ b/indra/newview/llsavedsettingsglue.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsavedsettingsglue.h
* @author James Cook
* @brief LLSavedSettingsGlue class definition
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,11 +36,11 @@ class LLUICtrl;
class LLSavedSettingsGlue
{
public:
- static void setBOOL(LLUICtrl* ctrl, const std::string& name);
- static void setS32(LLUICtrl* ctrl, const std::string& name);
- static void setF32(LLUICtrl* ctrl, const std::string& name);
- static void setU32(LLUICtrl* ctrl, const std::string& name);
- static void setString(LLUICtrl* ctrl, const std::string& name);
+ static void setBOOL(LLUICtrl* ctrl, const std::string& name);
+ static void setS32(LLUICtrl* ctrl, const std::string& name);
+ static void setF32(LLUICtrl* ctrl, const std::string& name);
+ static void setU32(LLUICtrl* ctrl, const std::string& name);
+ static void setString(LLUICtrl* ctrl, const std::string& name);
};
#endif
diff --git a/indra/newview/llsaveoutfitcombobtn.cpp b/indra/newview/llsaveoutfitcombobtn.cpp
index b1cb6d08d0..6418c310c1 100644
--- a/indra/newview/llsaveoutfitcombobtn.cpp
+++ b/indra/newview/llsaveoutfitcombobtn.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsaveoutfitcombobtn.cpp
* @brief Represents outfit save/save as combo button.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,57 +36,57 @@ static const std::string SAVE_BTN("save_btn");
static const std::string SAVE_FLYOUT_BTN("save_flyout_btn");
LLSaveOutfitComboBtn::LLSaveOutfitComboBtn(LLPanel* parent, bool saveAsDefaultAction):
- mParent(parent), mSaveAsDefaultAction(saveAsDefaultAction)
+ mParent(parent), mSaveAsDefaultAction(saveAsDefaultAction)
{
- // register action mapping before creating menu
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar;
- save_registar.add("Outfit.Save.Action", boost::bind(
- &LLSaveOutfitComboBtn::saveOutfit, this, false));
- save_registar.add("Outfit.SaveAs.Action", boost::bind(
- &LLSaveOutfitComboBtn::saveOutfit, this, true));
+ // register action mapping before creating menu
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar;
+ save_registar.add("Outfit.Save.Action", boost::bind(
+ &LLSaveOutfitComboBtn::saveOutfit, this, false));
+ save_registar.add("Outfit.SaveAs.Action", boost::bind(
+ &LLSaveOutfitComboBtn::saveOutfit, this, true));
- mParent->childSetAction(SAVE_BTN, boost::bind(&LLSaveOutfitComboBtn::saveOutfit, this, mSaveAsDefaultAction));
- mParent->childSetAction(SAVE_FLYOUT_BTN, boost::bind(&LLSaveOutfitComboBtn::showSaveMenu, this));
+ mParent->childSetAction(SAVE_BTN, boost::bind(&LLSaveOutfitComboBtn::saveOutfit, this, mSaveAsDefaultAction));
+ mParent->childSetAction(SAVE_FLYOUT_BTN, boost::bind(&LLSaveOutfitComboBtn::showSaveMenu, this));
- mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile<
- LLToggleableMenu> ("menu_save_outfit.xml", gMenuHolder,
- LLViewerMenuHolderGL::child_registry_t::instance());
+ mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile<
+ LLToggleableMenu> ("menu_save_outfit.xml", gMenuHolder,
+ LLViewerMenuHolderGL::child_registry_t::instance());
}
void LLSaveOutfitComboBtn::showSaveMenu()
{
- S32 x, y;
- LLUI::getInstance()->getMousePositionLocal(mParent, &x, &y);
+ S32 x, y;
+ LLUI::getInstance()->getMousePositionLocal(mParent, &x, &y);
- mSaveMenu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(mParent, mSaveMenu, x, y);
+ mSaveMenu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(mParent, mSaveMenu, x, y);
}
void LLSaveOutfitComboBtn::saveOutfit(bool as_new)
{
- if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit())
- {
- // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved.
- // If updateBaseOutfit fails, ask for an outfit name anyways
- return;
- }
+ if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit())
+ {
+ // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved.
+ // If updateBaseOutfit fails, ask for an outfit name anyways
+ return;
+ }
+
+ LLPanelOutfitsInventory* panel_outfits_inventory =
+ LLPanelOutfitsInventory::findInstance();
+ if (panel_outfits_inventory)
+ {
+ panel_outfits_inventory->onSave();
+ }
- LLPanelOutfitsInventory* panel_outfits_inventory =
- LLPanelOutfitsInventory::findInstance();
- if (panel_outfits_inventory)
- {
- panel_outfits_inventory->onSave();
- }
-
- //*TODO how to get to know when base outfit is updated or new outfit is created?
+ //*TODO how to get to know when base outfit is updated or new outfit is created?
}
void LLSaveOutfitComboBtn::setMenuItemEnabled(const std::string& item, bool enabled)
{
- mSaveMenu->setItemEnabled("save_outfit", enabled);
+ mSaveMenu->setItemEnabled("save_outfit", enabled);
}
void LLSaveOutfitComboBtn::setSaveBtnEnabled(bool enabled)
{
- mParent->getChildView(SAVE_BTN)->setEnabled(enabled);
+ mParent->getChildView(SAVE_BTN)->setEnabled(enabled);
}
diff --git a/indra/newview/llsaveoutfitcombobtn.h b/indra/newview/llsaveoutfitcombobtn.h
index 3987a99f51..e99cb22cac 100644
--- a/indra/newview/llsaveoutfitcombobtn.h
+++ b/indra/newview/llsaveoutfitcombobtn.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsaveoutfitcombobtn.h
* @brief Represents outfit save/save as combo button.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,19 +36,19 @@ class LLButton;
*/
class LLSaveOutfitComboBtn
{
- LOG_CLASS(LLSaveOutfitComboBtn);
+ LOG_CLASS(LLSaveOutfitComboBtn);
public:
- LLSaveOutfitComboBtn(LLPanel* parent, bool saveAsDefaultAction = false);
+ LLSaveOutfitComboBtn(LLPanel* parent, bool saveAsDefaultAction = false);
- void showSaveMenu();
- void saveOutfit(bool as_new = false);
- void setMenuItemEnabled(const std::string& item, bool enabled);
- void setSaveBtnEnabled(bool enabled);
+ void showSaveMenu();
+ void saveOutfit(bool as_new = false);
+ void setMenuItemEnabled(const std::string& item, bool enabled);
+ void setSaveBtnEnabled(bool enabled);
private:
- bool mSaveAsDefaultAction;
- LLPanel* mParent;
- LLToggleableMenu* mSaveMenu;
+ bool mSaveAsDefaultAction;
+ LLPanel* mParent;
+ LLToggleableMenu* mSaveMenu;
};
#endif // LL_LLSAVEOUTFITCOMBOBTN_H
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index ce0a8d69a9..62c0b6a0a5 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llscenemonitor.cpp
* @brief monitor the scene loading process.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,7 +45,7 @@
LLSceneMonitorView* gSceneMonitorView = NULL;
//
-//The procedures of monitoring when the scene finishes loading visually,
+//The procedures of monitoring when the scene finishes loading visually,
//i.e., no pixel differences among frames, are:
//1, freeze all dynamic objects and avatars;
//2, (?) disable all sky and water;
@@ -56,280 +56,280 @@ LLSceneMonitorView* gSceneMonitorView = NULL;
//END.
//
-LLSceneMonitor::LLSceneMonitor() :
- mEnabled(false),
- mDiff(NULL),
- mDiffResult(0.f),
- mDiffTolerance(0.1f),
- mDiffState(WAITING_FOR_NEXT_DIFF),
- mDebugViewerVisible(false),
- mQueryObject(0),
- mDiffPixelRatio(0.5f)
+LLSceneMonitor::LLSceneMonitor() :
+ mEnabled(false),
+ mDiff(NULL),
+ mDiffResult(0.f),
+ mDiffTolerance(0.1f),
+ mDiffState(WAITING_FOR_NEXT_DIFF),
+ mDebugViewerVisible(false),
+ mQueryObject(0),
+ mDiffPixelRatio(0.5f)
{
- mFrames[0] = NULL;
- mFrames[1] = NULL;
+ mFrames[0] = NULL;
+ mFrames[1] = NULL;
}
LLSceneMonitor::~LLSceneMonitor()
{
- mDiffState = VIEWER_QUITTING;
- reset();
+ mDiffState = VIEWER_QUITTING;
+ reset();
- mDitheringTexture = NULL;
+ mDitheringTexture = NULL;
}
void LLSceneMonitor::reset()
{
- delete mFrames[0];
- delete mFrames[1];
- delete mDiff;
+ delete mFrames[0];
+ delete mFrames[1];
+ delete mDiff;
- mFrames[0] = NULL;
- mFrames[1] = NULL;
- mDiff = NULL;
+ mFrames[0] = NULL;
+ mFrames[1] = NULL;
+ mDiff = NULL;
- mMonitorRecording.reset();
- mSceneLoadRecording.reset();
- mRecordingTimer.reset();
+ mMonitorRecording.reset();
+ mSceneLoadRecording.reset();
+ mRecordingTimer.reset();
- unfreezeScene();
+ unfreezeScene();
- if(mQueryObject > 0)
- {
- LLOcclusionCullingGroup::releaseOcclusionQueryObjectName(mQueryObject);
- mQueryObject = 0;
- }
+ if(mQueryObject > 0)
+ {
+ LLOcclusionCullingGroup::releaseOcclusionQueryObjectName(mQueryObject);
+ mQueryObject = 0;
+ }
}
void LLSceneMonitor::generateDitheringTexture(S32 width, S32 height)
{
#if 1
- //4 * 4 matrix
- mDitherMatrixWidth = 4;
- S32 dither_matrix[4][4] =
- {
- {1, 9, 3, 11},
- {13, 5, 15, 7},
- {4, 12, 2, 10},
- {16, 8, 14, 6}
- };
-
- mDitherScale = 255.f / 17;
+ //4 * 4 matrix
+ mDitherMatrixWidth = 4;
+ S32 dither_matrix[4][4] =
+ {
+ {1, 9, 3, 11},
+ {13, 5, 15, 7},
+ {4, 12, 2, 10},
+ {16, 8, 14, 6}
+ };
+
+ mDitherScale = 255.f / 17;
#else
- //8 * 8 matrix
- mDitherMatrixWidth = 16;
- S32 dither_matrix[16][16] =
- {
- {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64},
- {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32},
- {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56},
- {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24},
- {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62},
- {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30},
- {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54},
- {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22},
- {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64},
- {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32},
- {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56},
- {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24},
- {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62},
- {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30},
- {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54},
- {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22}
- };
-
- mDitherScale = 255.f / 65;
+ //8 * 8 matrix
+ mDitherMatrixWidth = 16;
+ S32 dither_matrix[16][16] =
+ {
+ {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64},
+ {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32},
+ {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56},
+ {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24},
+ {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62},
+ {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30},
+ {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54},
+ {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22},
+ {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64},
+ {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32},
+ {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56},
+ {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24},
+ {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62},
+ {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30},
+ {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54},
+ {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22}
+ };
+
+ mDitherScale = 255.f / 65;
#endif
- LLPointer<LLImageRaw> image_raw = new LLImageRaw(mDitherMatrixWidth, mDitherMatrixWidth, 3);
- U8* data = image_raw->getData();
- for (S32 i = 0; i < mDitherMatrixWidth; i++)
- {
- for (S32 j = 0; j < mDitherMatrixWidth; j++)
- {
- U8 val = dither_matrix[i][j];
- *data++ = val;
- *data++ = val;
- *data++ = val;
- }
- }
-
- mDitheringTexture = LLViewerTextureManager::getLocalTexture(image_raw.get(), FALSE) ;
- mDitheringTexture->setAddressMode(LLTexUnit::TAM_WRAP);
- mDitheringTexture->setFilteringOption(LLTexUnit::TFO_POINT);
-
- mDitherScaleS = (F32)width / mDitherMatrixWidth;
- mDitherScaleT = (F32)height / mDitherMatrixWidth;
+ LLPointer<LLImageRaw> image_raw = new LLImageRaw(mDitherMatrixWidth, mDitherMatrixWidth, 3);
+ U8* data = image_raw->getData();
+ for (S32 i = 0; i < mDitherMatrixWidth; i++)
+ {
+ for (S32 j = 0; j < mDitherMatrixWidth; j++)
+ {
+ U8 val = dither_matrix[i][j];
+ *data++ = val;
+ *data++ = val;
+ *data++ = val;
+ }
+ }
+
+ mDitheringTexture = LLViewerTextureManager::getLocalTexture(image_raw.get(), FALSE) ;
+ mDitheringTexture->setAddressMode(LLTexUnit::TAM_WRAP);
+ mDitheringTexture->setFilteringOption(LLTexUnit::TFO_POINT);
+
+ mDitherScaleS = (F32)width / mDitherMatrixWidth;
+ mDitherScaleT = (F32)height / mDitherMatrixWidth;
}
-void LLSceneMonitor::setDebugViewerVisible(bool visible)
+void LLSceneMonitor::setDebugViewerVisible(bool visible)
{
- mDebugViewerVisible = visible;
+ mDebugViewerVisible = visible;
}
LLRenderTarget& LLSceneMonitor::getCaptureTarget()
{
- LLRenderTarget* cur_target = NULL;
-
- S32 width = gViewerWindow->getWorldViewWidthRaw();
- S32 height = gViewerWindow->getWorldViewHeightRaw();
-
- if(!mFrames[0])
- {
- mFrames[0] = new LLRenderTarget();
- mFrames[0]->allocate(width, height, GL_RGB);
- gGL.getTexUnit(0)->bind(mFrames[0]);
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- cur_target = mFrames[0];
- }
- else if(!mFrames[1])
- {
- mFrames[1] = new LLRenderTarget();
- mFrames[1]->allocate(width, height, GL_RGB);
- gGL.getTexUnit(0)->bind(mFrames[1]);
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- cur_target = mFrames[1];
- }
- else //swap
- {
- cur_target = mFrames[0];
- mFrames[0] = mFrames[1];
- mFrames[1] = cur_target;
- }
-
- if(cur_target->getWidth() != width || cur_target->getHeight() != height) //size changed
- {
- cur_target->resize(width, height);
- }
-
- // we're promising the target exists
- return *cur_target;
+ LLRenderTarget* cur_target = NULL;
+
+ S32 width = gViewerWindow->getWorldViewWidthRaw();
+ S32 height = gViewerWindow->getWorldViewHeightRaw();
+
+ if(!mFrames[0])
+ {
+ mFrames[0] = new LLRenderTarget();
+ mFrames[0]->allocate(width, height, GL_RGB);
+ gGL.getTexUnit(0)->bind(mFrames[0]);
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ cur_target = mFrames[0];
+ }
+ else if(!mFrames[1])
+ {
+ mFrames[1] = new LLRenderTarget();
+ mFrames[1]->allocate(width, height, GL_RGB);
+ gGL.getTexUnit(0)->bind(mFrames[1]);
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ cur_target = mFrames[1];
+ }
+ else //swap
+ {
+ cur_target = mFrames[0];
+ mFrames[0] = mFrames[1];
+ mFrames[1] = cur_target;
+ }
+
+ if(cur_target->getWidth() != width || cur_target->getHeight() != height) //size changed
+ {
+ cur_target->resize(width, height);
+ }
+
+ // we're promising the target exists
+ return *cur_target;
}
void LLSceneMonitor::freezeAvatar(LLCharacter* avatarp)
{
- if(mEnabled)
- {
- mAvatarPauseHandles.push_back(avatarp->requestPause());
- }
+ if(mEnabled)
+ {
+ mAvatarPauseHandles.push_back(avatarp->requestPause());
+ }
}
void LLSceneMonitor::freezeScene()
{
- if(!mEnabled)
- {
- return;
- }
-
- //freeze all avatars
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- freezeAvatar((LLCharacter*)(*iter));
- }
-
- // freeze everything else
- gSavedSettings.setBOOL("FreezeTime", TRUE);
-
- //disable sky, water and clouds
- gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY,
- LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES);
-
- //disable particle system
- LLViewerPartSim::getInstance()->enable(false);
+ if(!mEnabled)
+ {
+ return;
+ }
+
+ //freeze all avatars
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ freezeAvatar((LLCharacter*)(*iter));
+ }
+
+ // freeze everything else
+ gSavedSettings.setBOOL("FreezeTime", TRUE);
+
+ //disable sky, water and clouds
+ gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY,
+ LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES);
+
+ //disable particle system
+ LLViewerPartSim::getInstance()->enable(false);
}
void LLSceneMonitor::unfreezeScene()
{
- //thaw all avatars
- mAvatarPauseHandles.clear();
+ //thaw all avatars
+ mAvatarPauseHandles.clear();
- if(mDiffState == VIEWER_QUITTING)
- {
- return;
- }
+ if(mDiffState == VIEWER_QUITTING)
+ {
+ return;
+ }
- // thaw everything else
- gSavedSettings.setBOOL("FreezeTime", FALSE);
+ // thaw everything else
+ gSavedSettings.setBOOL("FreezeTime", FALSE);
- //enable sky, water and clouds
- gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY,
- LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES);
+ //enable sky, water and clouds
+ gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY,
+ LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES);
- //enable particle system
- LLViewerPartSim::getInstance()->enable(true);
+ //enable particle system
+ LLViewerPartSim::getInstance()->enable(true);
}
void LLSceneMonitor::capture()
{
- static U32 last_capture_frame = 0;
- static LLCachedControl<bool> monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled");
- static LLCachedControl<F32> scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime");
- static bool force_capture = true;
-
- bool enabled = monitor_enabled || mDebugViewerVisible;
- if(mEnabled != enabled)
- {
- if(mEnabled)
- {
- mEnabled = enabled;
- unfreezeScene();
- reset();
- force_capture = true;
- }
- else
- {
- mEnabled = enabled;
- reset();
- freezeScene();
- }
- }
-
- if (mEnabled
- && (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f
- || mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f))
- {
- reset();
- freezeScene();
- force_capture = true;
- }
-
- if(mEnabled
- && (mRecordingTimer.getElapsedTimeF32() > scene_load_sample_time()
- || force_capture)
- && last_capture_frame != gFrameCount)
- {
- force_capture = false;
-
- mSceneLoadRecording.resume();
- mMonitorRecording.resume();
-
- last_capture_frame = gFrameCount;
-
- LLRenderTarget& cur_target = getCaptureTarget();
-
- U32 old_FBO = LLRenderTarget::sCurFBO;
-
- gGL.getTexUnit(0)->bind(&cur_target);
- glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); //point to the main frame buffer.
-
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, cur_target.getWidth(), cur_target.getHeight()); //copy the content
-
- glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
- glBindFramebuffer(GL_FRAMEBUFFER, old_FBO);
-
- mDiffState = NEED_DIFF;
- }
+ static U32 last_capture_frame = 0;
+ static LLCachedControl<bool> monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled");
+ static LLCachedControl<F32> scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime");
+ static bool force_capture = true;
+
+ bool enabled = monitor_enabled || mDebugViewerVisible;
+ if(mEnabled != enabled)
+ {
+ if(mEnabled)
+ {
+ mEnabled = enabled;
+ unfreezeScene();
+ reset();
+ force_capture = true;
+ }
+ else
+ {
+ mEnabled = enabled;
+ reset();
+ freezeScene();
+ }
+ }
+
+ if (mEnabled
+ && (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f
+ || mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f))
+ {
+ reset();
+ freezeScene();
+ force_capture = true;
+ }
+
+ if(mEnabled
+ && (mRecordingTimer.getElapsedTimeF32() > scene_load_sample_time()
+ || force_capture)
+ && last_capture_frame != gFrameCount)
+ {
+ force_capture = false;
+
+ mSceneLoadRecording.resume();
+ mMonitorRecording.resume();
+
+ last_capture_frame = gFrameCount;
+
+ LLRenderTarget& cur_target = getCaptureTarget();
+
+ U32 old_FBO = LLRenderTarget::sCurFBO;
+
+ gGL.getTexUnit(0)->bind(&cur_target);
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); //point to the main frame buffer.
+
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, cur_target.getWidth(), cur_target.getHeight()); //copy the content
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_FRAMEBUFFER, old_FBO);
+
+ mDiffState = NEED_DIFF;
+ }
}
bool LLSceneMonitor::needsUpdate() const
{
- return mDiffState == NEED_DIFF;
+ return mDiffState == NEED_DIFF;
}
static LLStaticHashedString sDitherScale("dither_scale");
@@ -339,78 +339,78 @@ static LLStaticHashedString sDitherScaleT("dither_scale_t");
void LLSceneMonitor::compare()
{
#ifdef LL_WINDOWS
- if(mDiffState != NEED_DIFF)
- {
- return;
- }
-
- if(!mFrames[0] || !mFrames[1])
- {
- return;
- }
- if(mFrames[0]->getWidth() != mFrames[1]->getWidth() || mFrames[0]->getHeight() != mFrames[1]->getHeight())
- { //size does not match
- return;
- }
-
- mDiffState = EXECUTE_DIFF;
-
- S32 width = gViewerWindow->getWindowWidthRaw();
- S32 height = gViewerWindow->getWindowHeightRaw();
- if(!mDiff)
- {
- mDiff = new LLRenderTarget();
- mDiff->allocate(width, height, GL_RGBA);
-
- generateDitheringTexture(width, height);
- }
- else if(mDiff->getWidth() != width || mDiff->getHeight() != height)
- {
- mDiff->resize(width, height);
- generateDitheringTexture(width, height);
- }
-
- mDiff->bindTarget();
- mDiff->clear();
-
- gTwoTextureCompareProgram.bind();
-
- gTwoTextureCompareProgram.uniform1f(sDitherScale, mDitherScale);
- gTwoTextureCompareProgram.uniform1f(sDitherScaleS, mDitherScaleS);
- gTwoTextureCompareProgram.uniform1f(sDitherScaleT, mDitherScaleT);
-
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(0)->bind(mFrames[0]);
- gGL.getTexUnit(0)->activate();
-
- gGL.getTexUnit(1)->activate();
- gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(1)->bind(mFrames[1]);
- gGL.getTexUnit(1)->activate();
-
- gGL.getTexUnit(2)->activate();
- gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(2)->bind(mDitheringTexture);
- gGL.getTexUnit(2)->activate();
-
- gl_rect_2d_simple_tex(width, height);
-
- mDiff->flush();
-
- gTwoTextureCompareProgram.unbind();
-
- gGL.getTexUnit(0)->disable();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(1)->disable();
- gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(2)->disable();
- gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE);
-
- if (!mDebugViewerVisible)
- {
- calcDiffAggregate();
- }
+ if(mDiffState != NEED_DIFF)
+ {
+ return;
+ }
+
+ if(!mFrames[0] || !mFrames[1])
+ {
+ return;
+ }
+ if(mFrames[0]->getWidth() != mFrames[1]->getWidth() || mFrames[0]->getHeight() != mFrames[1]->getHeight())
+ { //size does not match
+ return;
+ }
+
+ mDiffState = EXECUTE_DIFF;
+
+ S32 width = gViewerWindow->getWindowWidthRaw();
+ S32 height = gViewerWindow->getWindowHeightRaw();
+ if(!mDiff)
+ {
+ mDiff = new LLRenderTarget();
+ mDiff->allocate(width, height, GL_RGBA);
+
+ generateDitheringTexture(width, height);
+ }
+ else if(mDiff->getWidth() != width || mDiff->getHeight() != height)
+ {
+ mDiff->resize(width, height);
+ generateDitheringTexture(width, height);
+ }
+
+ mDiff->bindTarget();
+ mDiff->clear();
+
+ gTwoTextureCompareProgram.bind();
+
+ gTwoTextureCompareProgram.uniform1f(sDitherScale, mDitherScale);
+ gTwoTextureCompareProgram.uniform1f(sDitherScaleS, mDitherScaleS);
+ gTwoTextureCompareProgram.uniform1f(sDitherScaleT, mDitherScaleT);
+
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->bind(mFrames[0]);
+ gGL.getTexUnit(0)->activate();
+
+ gGL.getTexUnit(1)->activate();
+ gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->bind(mFrames[1]);
+ gGL.getTexUnit(1)->activate();
+
+ gGL.getTexUnit(2)->activate();
+ gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(2)->bind(mDitheringTexture);
+ gGL.getTexUnit(2)->activate();
+
+ gl_rect_2d_simple_tex(width, height);
+
+ mDiff->flush();
+
+ gTwoTextureCompareProgram.unbind();
+
+ gGL.getTexUnit(0)->disable();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->disable();
+ gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(2)->disable();
+ gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE);
+
+ if (!mDebugViewerVisible)
+ {
+ calcDiffAggregate();
+ }
#endif
}
@@ -421,337 +421,337 @@ void LLSceneMonitor::calcDiffAggregate()
{
#ifdef LL_WINDOWS
- if(mDiffState != EXECUTE_DIFF && !mDebugViewerVisible)
- {
- return;
- }
-
- if(!mQueryObject)
- {
- mQueryObject = LLOcclusionCullingGroup::getNewOcclusionQueryObjectName();
- }
-
- LLGLDepthTest depth(true, false, GL_ALWAYS);
- if(!mDebugViewerVisible)
- {
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
- }
-
- LLGLSLShader* cur_shader = NULL;
-
- cur_shader = LLGLSLShader::sCurBoundShaderPtr;
- gOneTextureFilterProgram.bind();
- gOneTextureFilterProgram.uniform1f(sTolerance, mDiffTolerance);
-
- if(mDiffState == EXECUTE_DIFF)
- {
- glBeginQuery(GL_SAMPLES_PASSED, mQueryObject);
- }
-
- gl_draw_scaled_target(0, 0, S32(mDiff->getWidth() * mDiffPixelRatio), S32(mDiff->getHeight() * mDiffPixelRatio), mDiff);
-
- if(mDiffState == EXECUTE_DIFF)
- {
- glEndQuery(GL_SAMPLES_PASSED);
- mDiffState = WAIT_ON_RESULT;
- }
-
- gOneTextureFilterProgram.unbind();
-
- if(cur_shader != NULL)
- {
- cur_shader->bind();
- }
-
- if(!mDebugViewerVisible)
- {
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- }
+ if(mDiffState != EXECUTE_DIFF && !mDebugViewerVisible)
+ {
+ return;
+ }
+
+ if(!mQueryObject)
+ {
+ mQueryObject = LLOcclusionCullingGroup::getNewOcclusionQueryObjectName();
+ }
+
+ LLGLDepthTest depth(true, false, GL_ALWAYS);
+ if(!mDebugViewerVisible)
+ {
+ glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+ }
+
+ LLGLSLShader* cur_shader = NULL;
+
+ cur_shader = LLGLSLShader::sCurBoundShaderPtr;
+ gOneTextureFilterProgram.bind();
+ gOneTextureFilterProgram.uniform1f(sTolerance, mDiffTolerance);
+
+ if(mDiffState == EXECUTE_DIFF)
+ {
+ glBeginQuery(GL_SAMPLES_PASSED, mQueryObject);
+ }
+
+ gl_draw_scaled_target(0, 0, S32(mDiff->getWidth() * mDiffPixelRatio), S32(mDiff->getHeight() * mDiffPixelRatio), mDiff);
+
+ if(mDiffState == EXECUTE_DIFF)
+ {
+ glEndQuery(GL_SAMPLES_PASSED);
+ mDiffState = WAIT_ON_RESULT;
+ }
+
+ gOneTextureFilterProgram.unbind();
+
+ if(cur_shader != NULL)
+ {
+ cur_shader->bind();
+ }
+
+ if(!mDebugViewerVisible)
+ {
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ }
#endif
}
static LLTrace::EventStatHandle<> sFramePixelDiff("FramePixelDifference");
void LLSceneMonitor::fetchQueryResult()
{
- // also throttle timing here, to avoid going below sample time due to phasing with frame capture
- static LLCachedControl<F32> scene_load_sample_time_control(gSavedSettings, "SceneLoadingMonitorSampleTime");
- F32Seconds scene_load_sample_time = (F32Seconds)scene_load_sample_time_control();
-
- if(mDiffState == WAIT_ON_RESULT
- && !LLAppViewer::instance()->quitRequested())
- {
- mDiffState = WAITING_FOR_NEXT_DIFF;
-
- GLuint available = 0;
- glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT_AVAILABLE, &available);
- if(available)
- {
- GLuint count = 0;
- glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT, &count);
-
- mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face)
-
- LL_DEBUGS("SceneMonitor") << "Frame difference: " << mDiffResult << LL_ENDL;
- record(sFramePixelDiff, mDiffResult);
-
- static LLCachedControl<F32> diff_threshold(gSavedSettings,"SceneLoadingMonitorPixelDiffThreshold");
- F32Seconds elapsed_time = mRecordingTimer.getElapsedTimeF32();
-
- if (elapsed_time > scene_load_sample_time)
- {
- if(mDiffResult > diff_threshold())
- {
- mSceneLoadRecording.extend();
- llassert_always(mSceneLoadRecording.getResults().getLastRecording().getDuration() > scene_load_sample_time);
- }
- else
- {
- mSceneLoadRecording.nextPeriod();
- }
- mRecordingTimer.reset();
- }
- }
- }
+ // also throttle timing here, to avoid going below sample time due to phasing with frame capture
+ static LLCachedControl<F32> scene_load_sample_time_control(gSavedSettings, "SceneLoadingMonitorSampleTime");
+ F32Seconds scene_load_sample_time = (F32Seconds)scene_load_sample_time_control();
+
+ if(mDiffState == WAIT_ON_RESULT
+ && !LLAppViewer::instance()->quitRequested())
+ {
+ mDiffState = WAITING_FOR_NEXT_DIFF;
+
+ GLuint available = 0;
+ glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT_AVAILABLE, &available);
+ if(available)
+ {
+ GLuint count = 0;
+ glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT, &count);
+
+ mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face)
+
+ LL_DEBUGS("SceneMonitor") << "Frame difference: " << mDiffResult << LL_ENDL;
+ record(sFramePixelDiff, mDiffResult);
+
+ static LLCachedControl<F32> diff_threshold(gSavedSettings,"SceneLoadingMonitorPixelDiffThreshold");
+ F32Seconds elapsed_time = mRecordingTimer.getElapsedTimeF32();
+
+ if (elapsed_time > scene_load_sample_time)
+ {
+ if(mDiffResult > diff_threshold())
+ {
+ mSceneLoadRecording.extend();
+ llassert_always(mSceneLoadRecording.getResults().getLastRecording().getDuration() > scene_load_sample_time);
+ }
+ else
+ {
+ mSceneLoadRecording.nextPeriod();
+ }
+ mRecordingTimer.reset();
+ }
+ }
+ }
}
//dump results to a file _scene_xmonitor_results.csv
void LLSceneMonitor::dumpToFile(const std::string &file_name)
{
- if (!hasResults()) return;
-
- LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL;
- try
- {
- llofstream os(file_name.c_str());
-
- os << std::setprecision(10);
-
- LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults();
- const U32 frame_count = scene_load_recording.getNumRecordedPeriods();
-
- F64Seconds frame_time;
-
- os << "Stat";
- for (S32 frame = 1; frame <= frame_count; frame++)
- {
- frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration();
- os << ", " << frame_time.value();
- }
- os << '\n';
-
- os << "Sample period(s)";
- for (S32 frame = 1; frame <= frame_count; frame++)
- {
- frame_time = scene_load_recording.getPrevRecording(frame_count - frame).getDuration();
- os << ", " << frame_time.value();
- }
- os << '\n';
-
-
- typedef LLTrace::StatType<LLTrace::CountAccumulator> trace_count;
- for (auto& it : trace_count::instance_snapshot())
- {
- std::ostringstream row;
- row << std::setprecision(10);
-
- row << it.getName();
-
- const char* unit_label = it.getUnitLabel();
- if (unit_label[0])
- {
- row << "(" << unit_label << ")";
- }
-
- S32 samples = 0;
-
- for (S32 frame = 1; frame <= frame_count; frame++)
- {
- LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame);
- samples += recording.getSampleCount(it);
- row << ", " << recording.getSum(it);
- }
-
- row << '\n';
-
- if (samples > 0)
- {
- os << row.str();
- }
- }
-
- typedef LLTrace::StatType<LLTrace::EventAccumulator> trace_event;
-
- for (auto& it : trace_event::instance_snapshot())
- {
- std::ostringstream row;
- row << std::setprecision(10);
- row << it.getName();
-
- const char* unit_label = it.getUnitLabel();
- if (unit_label[0])
- {
- row << "(" << unit_label << ")";
- }
-
- S32 samples = 0;
-
- for (S32 frame = 1; frame <= frame_count; frame++)
- {
- LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame);
- samples += recording.getSampleCount(it);
- F64 mean = recording.getMean(it);
- if (llisnan(mean))
- {
- row << ", n/a";
- }
- else
- {
- row << ", " << mean;
- }
- }
-
- row << '\n';
-
- if (samples > 0)
- {
- os << row.str();
- }
- }
-
- typedef LLTrace::StatType<LLTrace::SampleAccumulator> trace_sample;
-
- for (auto& it : trace_sample::instance_snapshot())
- {
- std::ostringstream row;
- row << std::setprecision(10);
- row << it.getName();
-
- const char* unit_label = it.getUnitLabel();
- if (unit_label[0])
- {
- row << "(" << unit_label << ")";
- }
-
- S32 samples = 0;
-
- for (S32 frame = 1; frame <= frame_count; frame++)
- {
- LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame);
- samples += recording.getSampleCount(it);
- F64 mean = recording.getMean(it);
- if (llisnan(mean))
- {
- row << ", n/a";
- }
- else
- {
- row << ", " << mean;
- }
- }
-
- row << '\n';
-
- if (samples > 0)
- {
- os << row.str();
- }
- }
-
- os.flush();
- os.close();
- }
- catch (const std::ios_base::failure &e)
- {
- LL_WARNS() << "Unable to dump scene monitor results: " << e.what() << LL_ENDL;
- }
+ if (!hasResults()) return;
+
+ LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL;
+ try
+ {
+ llofstream os(file_name.c_str());
+
+ os << std::setprecision(10);
+
+ LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults();
+ const U32 frame_count = scene_load_recording.getNumRecordedPeriods();
+
+ F64Seconds frame_time;
+
+ os << "Stat";
+ for (S32 frame = 1; frame <= frame_count; frame++)
+ {
+ frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration();
+ os << ", " << frame_time.value();
+ }
+ os << '\n';
+
+ os << "Sample period(s)";
+ for (S32 frame = 1; frame <= frame_count; frame++)
+ {
+ frame_time = scene_load_recording.getPrevRecording(frame_count - frame).getDuration();
+ os << ", " << frame_time.value();
+ }
+ os << '\n';
+
+
+ typedef LLTrace::StatType<LLTrace::CountAccumulator> trace_count;
+ for (auto& it : trace_count::instance_snapshot())
+ {
+ std::ostringstream row;
+ row << std::setprecision(10);
+
+ row << it.getName();
+
+ const char* unit_label = it.getUnitLabel();
+ if (unit_label[0])
+ {
+ row << "(" << unit_label << ")";
+ }
+
+ S32 samples = 0;
+
+ for (S32 frame = 1; frame <= frame_count; frame++)
+ {
+ LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame);
+ samples += recording.getSampleCount(it);
+ row << ", " << recording.getSum(it);
+ }
+
+ row << '\n';
+
+ if (samples > 0)
+ {
+ os << row.str();
+ }
+ }
+
+ typedef LLTrace::StatType<LLTrace::EventAccumulator> trace_event;
+
+ for (auto& it : trace_event::instance_snapshot())
+ {
+ std::ostringstream row;
+ row << std::setprecision(10);
+ row << it.getName();
+
+ const char* unit_label = it.getUnitLabel();
+ if (unit_label[0])
+ {
+ row << "(" << unit_label << ")";
+ }
+
+ S32 samples = 0;
+
+ for (S32 frame = 1; frame <= frame_count; frame++)
+ {
+ LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame);
+ samples += recording.getSampleCount(it);
+ F64 mean = recording.getMean(it);
+ if (llisnan(mean))
+ {
+ row << ", n/a";
+ }
+ else
+ {
+ row << ", " << mean;
+ }
+ }
+
+ row << '\n';
+
+ if (samples > 0)
+ {
+ os << row.str();
+ }
+ }
+
+ typedef LLTrace::StatType<LLTrace::SampleAccumulator> trace_sample;
+
+ for (auto& it : trace_sample::instance_snapshot())
+ {
+ std::ostringstream row;
+ row << std::setprecision(10);
+ row << it.getName();
+
+ const char* unit_label = it.getUnitLabel();
+ if (unit_label[0])
+ {
+ row << "(" << unit_label << ")";
+ }
+
+ S32 samples = 0;
+
+ for (S32 frame = 1; frame <= frame_count; frame++)
+ {
+ LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame);
+ samples += recording.getSampleCount(it);
+ F64 mean = recording.getMean(it);
+ if (llisnan(mean))
+ {
+ row << ", n/a";
+ }
+ else
+ {
+ row << ", " << mean;
+ }
+ }
+
+ row << '\n';
+
+ if (samples > 0)
+ {
+ os << row.str();
+ }
+ }
+
+ os.flush();
+ os.close();
+ }
+ catch (const std::ios_base::failure &e)
+ {
+ LL_WARNS() << "Unable to dump scene monitor results: " << e.what() << LL_ENDL;
+ }
}
//-------------------------------------------------------------------------------------------------------------
//definition of class LLSceneMonitorView
//-------------------------------------------------------------------------------------------------------------
LLSceneMonitorView::LLSceneMonitorView(const LLRect& rect)
- : LLFloater(LLSD())
+ : LLFloater(LLSD())
{
- setRect(rect);
- setVisible(FALSE);
-
- setCanMinimize(false);
- setCanClose(true);
+ setRect(rect);
+ setVisible(FALSE);
+
+ setCanMinimize(false);
+ setCanClose(true);
- sTeleportFinishConnection = LLViewerParcelMgr::getInstance()->setTeleportFinishedCallback(boost::bind(&LLSceneMonitorView::onTeleportFinished, this));
+ sTeleportFinishConnection = LLViewerParcelMgr::getInstance()->setTeleportFinishedCallback(boost::bind(&LLSceneMonitorView::onTeleportFinished, this));
}
LLSceneMonitorView::~LLSceneMonitorView()
{
- sTeleportFinishConnection.disconnect();
+ sTeleportFinishConnection.disconnect();
}
void LLSceneMonitorView::onClose(bool app_quitting)
{
- setVisible(false);
+ setVisible(false);
}
void LLSceneMonitorView::onClickCloseBtn(bool app_quitting)
{
- setVisible(false);
+ setVisible(false);
}
void LLSceneMonitorView::onTeleportFinished()
{
- if(isInVisibleChain())
- {
- LLSceneMonitor::getInstance()->reset();
- }
+ if(isInVisibleChain())
+ {
+ LLSceneMonitor::getInstance()->reset();
+ }
}
void LLSceneMonitorView::onVisibilityChange(BOOL visible)
{
- LLSceneMonitor::getInstance()->setDebugViewerVisible(visible);
+ LLSceneMonitor::getInstance()->setDebugViewerVisible(visible);
}
void LLSceneMonitorView::draw()
{
- const LLRenderTarget* target = LLSceneMonitor::getInstance()->getDiffTarget();
- if(!target)
- {
- return;
- }
-
- F32 ratio = LLSceneMonitor::getInstance()->getDiffPixelRatio();
- S32 height = (S32)(target->getHeight() * ratio);
- S32 width = (S32)(target->getWidth() * ratio);
-
- LLRect new_rect;
- new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height);
- setRect(new_rect);
-
- //draw background
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f));
-
- LLSceneMonitor::getInstance()->calcDiffAggregate();
-
- //show some texts
- LLColor4 color = LLColor4::white;
- S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
-
- S32 lines = 0;
- std::string num_str = llformat("Frame difference: %.6f", LLSceneMonitor::getInstance()->getDiffResult());
- LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
- lines++;
-
- num_str = llformat("Pixel tolerance: (R+G+B) < %.4f", LLSceneMonitor::getInstance()->getDiffTolerance());
- LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
- lines++;
-
- num_str = llformat("Sampling time: %.3f seconds", gSavedSettings.getF32("SceneLoadingMonitorSampleTime"));
- LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
- lines++;
-
- num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getResults().getDuration().value());
- LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
- lines++;
-
- LLView::draw();
+ const LLRenderTarget* target = LLSceneMonitor::getInstance()->getDiffTarget();
+ if(!target)
+ {
+ return;
+ }
+
+ F32 ratio = LLSceneMonitor::getInstance()->getDiffPixelRatio();
+ S32 height = (S32)(target->getHeight() * ratio);
+ S32 width = (S32)(target->getWidth() * ratio);
+
+ LLRect new_rect;
+ new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height);
+ setRect(new_rect);
+
+ //draw background
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f));
+
+ LLSceneMonitor::getInstance()->calcDiffAggregate();
+
+ //show some texts
+ LLColor4 color = LLColor4::white;
+ S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
+
+ S32 lines = 0;
+ std::string num_str = llformat("Frame difference: %.6f", LLSceneMonitor::getInstance()->getDiffResult());
+ LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
+ lines++;
+
+ num_str = llformat("Pixel tolerance: (R+G+B) < %.4f", LLSceneMonitor::getInstance()->getDiffTolerance());
+ LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
+ lines++;
+
+ num_str = llformat("Sampling time: %.3f seconds", gSavedSettings.getF32("SceneLoadingMonitorSampleTime"));
+ LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
+ lines++;
+
+ num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getResults().getDuration().value());
+ LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP);
+ lines++;
+
+ LLView::draw();
}
diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h
index f2e1ef69b9..ac79543bb9 100644
--- a/indra/newview/llscenemonitor.h
+++ b/indra/newview/llscenemonitor.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llscenemonitor.h
* @brief monitor the process of scene loading
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,88 +39,88 @@ class LLViewerTexture;
class LLSceneMonitor : public LLSingleton<LLSceneMonitor>
{
- LLSINGLETON(LLSceneMonitor);
- ~LLSceneMonitor();
- LOG_CLASS(LLSceneMonitor);
+ LLSINGLETON(LLSceneMonitor);
+ ~LLSceneMonitor();
+ LOG_CLASS(LLSceneMonitor);
public:
- void freezeAvatar(LLCharacter* avatarp);
- void setDebugViewerVisible(bool visible);
+ void freezeAvatar(LLCharacter* avatarp);
+ void setDebugViewerVisible(bool visible);
+
+ void capture(); //capture the main frame buffer
+ void compare(); //compare the stored two buffers.
+ void fetchQueryResult();
+ void calcDiffAggregate();
+ void setDiffTolerance(F32 tol) {mDiffTolerance = tol;}
- void capture(); //capture the main frame buffer
- void compare(); //compare the stored two buffers.
- void fetchQueryResult();
- void calcDiffAggregate();
- void setDiffTolerance(F32 tol) {mDiffTolerance = tol;}
+ const LLRenderTarget* getDiffTarget() const {return mDiff;}
+ F32 getDiffTolerance() const {return mDiffTolerance;}
+ F32 getDiffResult() const { return mDiffResult;}
+ F32 getDiffPixelRatio() const { return mDiffPixelRatio;}
+ bool isEnabled()const {return mEnabled;}
+ bool needsUpdate() const;
- const LLRenderTarget* getDiffTarget() const {return mDiff;}
- F32 getDiffTolerance() const {return mDiffTolerance;}
- F32 getDiffResult() const { return mDiffResult;}
- F32 getDiffPixelRatio() const { return mDiffPixelRatio;}
- bool isEnabled()const {return mEnabled;}
- bool needsUpdate() const;
-
- const LLTrace::ExtendablePeriodicRecording* getRecording() const {return &mSceneLoadRecording;}
- void dumpToFile(const std::string &file_name);
- bool hasResults() const { return mSceneLoadRecording.getResults().getDuration() != S32Seconds(0);}
+ const LLTrace::ExtendablePeriodicRecording* getRecording() const {return &mSceneLoadRecording;}
+ void dumpToFile(const std::string &file_name);
+ bool hasResults() const { return mSceneLoadRecording.getResults().getDuration() != S32Seconds(0);}
- void reset();
+ void reset();
private:
- void freezeScene();
- void unfreezeScene();
+ void freezeScene();
+ void unfreezeScene();
- LLRenderTarget& getCaptureTarget();
- void generateDitheringTexture(S32 width, S32 height);
+ LLRenderTarget& getCaptureTarget();
+ void generateDitheringTexture(S32 width, S32 height);
private:
- bool mEnabled,
- mDebugViewerVisible;
-
- enum EDiffState
- {
- WAITING_FOR_NEXT_DIFF,
- NEED_DIFF,
- EXECUTE_DIFF,
- WAIT_ON_RESULT,
- VIEWER_QUITTING
- } mDiffState;
-
- LLRenderTarget* mFrames[2];
- LLRenderTarget* mDiff;
-
- GLuint mQueryObject; //used for glQuery
- F32 mDiffResult, //aggregate results of mDiff.
- mDiffTolerance, //pixels are filtered out when R+G+B < mDiffTolerance
- mDiffPixelRatio; //ratio of pixels used for comparison against the original mDiff size along one dimension
-
- LLPointer<LLViewerTexture> mDitheringTexture;
- S32 mDitherMatrixWidth;
- F32 mDitherScale,
- mDitherScaleS,
- mDitherScaleT;
-
- std::vector<LLAnimPauseRequest> mAvatarPauseHandles;
-
- LLTimer mRecordingTimer;
- LLTrace::ExtendablePeriodicRecording mSceneLoadRecording;
- LLTrace::Recording mMonitorRecording;
+ bool mEnabled,
+ mDebugViewerVisible;
+
+ enum EDiffState
+ {
+ WAITING_FOR_NEXT_DIFF,
+ NEED_DIFF,
+ EXECUTE_DIFF,
+ WAIT_ON_RESULT,
+ VIEWER_QUITTING
+ } mDiffState;
+
+ LLRenderTarget* mFrames[2];
+ LLRenderTarget* mDiff;
+
+ GLuint mQueryObject; //used for glQuery
+ F32 mDiffResult, //aggregate results of mDiff.
+ mDiffTolerance, //pixels are filtered out when R+G+B < mDiffTolerance
+ mDiffPixelRatio; //ratio of pixels used for comparison against the original mDiff size along one dimension
+
+ LLPointer<LLViewerTexture> mDitheringTexture;
+ S32 mDitherMatrixWidth;
+ F32 mDitherScale,
+ mDitherScaleS,
+ mDitherScaleT;
+
+ std::vector<LLAnimPauseRequest> mAvatarPauseHandles;
+
+ LLTimer mRecordingTimer;
+ LLTrace::ExtendablePeriodicRecording mSceneLoadRecording;
+ LLTrace::Recording mMonitorRecording;
};
class LLSceneMonitorView : public LLFloater
{
public:
- LLSceneMonitorView(const LLRect& rect);
- ~LLSceneMonitorView();
- virtual void draw();
+ LLSceneMonitorView(const LLRect& rect);
+ ~LLSceneMonitorView();
+ virtual void draw();
- virtual void onVisibilityChange(BOOL visible);
+ virtual void onVisibilityChange(BOOL visible);
protected:
- virtual void onClose(bool app_quitting=false);
- virtual void onClickCloseBtn(bool app_quitting=false);
- void onTeleportFinished();
- boost::signals2::connection sTeleportFinishConnection;
+ virtual void onClose(bool app_quitting=false);
+ virtual void onClickCloseBtn(bool app_quitting=false);
+ void onTeleportFinished();
+ boost::signals2::connection sTeleportFinishConnection;
};
extern LLSceneMonitorView* gSceneMonitorView;
diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp
index 2643ee95f8..33af529589 100644
--- a/indra/newview/llsceneview.cpp
+++ b/indra/newview/llsceneview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsceneview.cpp
* @brief LLSceneView class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,99 +43,99 @@ void removeOutliers(std::vector<VEC_TYPE>& data, F32 k);
LLSceneView::LLSceneView(const LLRect& rect)
- : LLFloater(LLSD())
+ : LLFloater(LLSD())
{
- setRect(rect);
- setVisible(FALSE);
-
- setCanMinimize(false);
- setCanClose(true);
+ setRect(rect);
+ setVisible(FALSE);
+
+ setCanMinimize(false);
+ setCanClose(true);
}
void LLSceneView::onClose(bool)
{
- setVisible(false);
+ setVisible(false);
}
void LLSceneView::onClickCloseBtn(bool)
{
- setVisible(false);
+ setVisible(false);
}
void LLSceneView::draw()
{
- S32 margin = 10;
- S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f);
- S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f);
-
- LLRect new_rect;
- new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height);
- setRect(new_rect);
-
- // Draw the window background
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f));
-
-
- //aggregate some statistics
-
- //object sizes
- std::vector<F32> size[2];
-
- //triangle counts
- std::vector<S32> triangles[2];
- std::vector<S32> visible_triangles[2];
- S32 total_visible_triangles[] = {0, 0};
- S32 total_triangles[] = {0, 0};
-
- S32 total_visible_bytes[] = {0, 0};
- S32 total_bytes[] = {0, 0};
-
- //streaming cost
- std::vector<F32> streaming_cost[2];
- F32 total_streaming[] = { 0.f, 0.f };
-
- //physics cost
- std::vector<F32> physics_cost[2];
- F32 total_physics[] = { 0.f, 0.f };
-
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
- for (U32 i = 0; i < gObjectList.getNumObjects(); ++i)
- {
- LLViewerObject* object = gObjectList.getObject(i);
-
- if (object &&
- object->getVolume()&&
- object->getRegion() == region)
- {
- U32 idx = object->isAttachment() ? 1 : 0;
-
- LLVolume* volume = object->getVolume();
-
- F32 radius = object->getScale().magVec();
- size[idx].push_back(radius);
-
- S32 visible = volume->getNumTriangles();
- S32 high_triangles = object->getHighLODTriangleCount();
-
- total_visible_triangles[idx] += visible;
- total_triangles[idx] += high_triangles;
-
- visible_triangles[idx].push_back(visible);
- triangles[idx].push_back(high_triangles);
+ S32 margin = 10;
+ S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f);
+ S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f);
+
+ LLRect new_rect;
+ new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height);
+ setRect(new_rect);
+
+ // Draw the window background
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f));
+
+
+ //aggregate some statistics
+
+ //object sizes
+ std::vector<F32> size[2];
+
+ //triangle counts
+ std::vector<S32> triangles[2];
+ std::vector<S32> visible_triangles[2];
+ S32 total_visible_triangles[] = {0, 0};
+ S32 total_triangles[] = {0, 0};
+
+ S32 total_visible_bytes[] = {0, 0};
+ S32 total_bytes[] = {0, 0};
+
+ //streaming cost
+ std::vector<F32> streaming_cost[2];
+ F32 total_streaming[] = { 0.f, 0.f };
+
+ //physics cost
+ std::vector<F32> physics_cost[2];
+ F32 total_physics[] = { 0.f, 0.f };
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ for (U32 i = 0; i < gObjectList.getNumObjects(); ++i)
+ {
+ LLViewerObject* object = gObjectList.getObject(i);
+
+ if (object &&
+ object->getVolume()&&
+ object->getRegion() == region)
+ {
+ U32 idx = object->isAttachment() ? 1 : 0;
+
+ LLVolume* volume = object->getVolume();
+
+ F32 radius = object->getScale().magVec();
+ size[idx].push_back(radius);
+
+ S32 visible = volume->getNumTriangles();
+ S32 high_triangles = object->getHighLODTriangleCount();
+
+ total_visible_triangles[idx] += visible;
+ total_triangles[idx] += high_triangles;
+
+ visible_triangles[idx].push_back(visible);
+ triangles[idx].push_back(high_triangles);
F32 streaming = object->getStreamingCost();
total_streaming[idx] += streaming;
streaming_cost[idx].push_back(streaming);
- F32 physics = object->getPhysicsCost();
- total_physics[idx] += physics;
- physics_cost[idx].push_back(physics);
+ F32 physics = object->getPhysicsCost();
+ total_physics[idx] += physics;
+ physics_cost[idx].push_back(physics);
- S32 bytes = 0;
- S32 visible_bytes = 0;
+ S32 bytes = 0;
+ S32 visible_bytes = 0;
LLMeshCostData costs;
if (object->getCostData(costs))
{
@@ -143,293 +143,293 @@ void LLSceneView::draw()
visible_bytes = costs.getSizeByLOD(object->getLOD());
}
- total_bytes[idx] += bytes;
- total_visible_bytes[idx] += visible_bytes;
- }
- }
- }
-
- const char* category[] =
- {
- "Region",
- "Attachment"
- };
-
- S32 graph_pos[4];
-
- for (U32 i = 0; i < 4; ++i)
- {
- graph_pos[i] = new_rect.getHeight()/4*(i+1);
- }
-
- for (U32 idx = 0; idx < 2; idx++)
- {
- if (!size[idx].empty())
- { //display graph of object sizes
- std::sort(size[idx].begin(), size[idx].end());
-
- ll_remove_outliers(size[idx], 1.f);
-
- LLRect size_rect;
-
- if (idx == 0)
- {
- size_rect = LLRect(margin, graph_pos[0]-margin, new_rect.getWidth()/2-margin, margin*2);
- }
- else
- {
- size_rect = LLRect(margin+new_rect.getWidth()/2, graph_pos[0]-margin, new_rect.getWidth()-margin, margin*2);
- }
-
- gl_rect_2d(size_rect, LLColor4::white, false);
-
- F32 size_domain[] = { 128.f, 0.f };
-
- //get domain of sizes
- for (U32 i = 0; i < size[idx].size(); ++i)
- {
- size_domain[0] = llmin(size_domain[0], size[idx][i]);
- size_domain[1] = llmax(size_domain[1], size[idx][i]);
- }
-
- F32 size_range = size_domain[1]-size_domain[0];
-
- U32 count = size[idx].size();
-
- F32 total = 0.f;
-
- gGL.begin(LLRender::LINE_STRIP);
-
- for (U32 i = 0; i < count; ++i)
- {
- F32 rad = size[idx][i];
- total += rad;
- F32 y = (rad-size_domain[0])/size_range*size_rect.getHeight()+size_rect.mBottom;
- F32 x = (F32) i / count * size_rect.getWidth() + size_rect.mLeft;
-
- gGL.vertex2f(x,y);
-
- if (i%4096 == 0)
- {
- gGL.end();
- gGL.flush();
- gGL.begin(LLRender::LINE_STRIP);
- }
- }
-
- gGL.end();
- gGL.flush();
-
- std::string label = llformat("%s Object Sizes (m) -- [%.1f, %.1f] Mean: %.1f Median: %.1f -- %d samples",
- category[idx], size_domain[0], size_domain[1], total/count, size[idx][count/2], count);
-
- LLFontGL::getFontMonospace()->renderUTF8(label,
- 0 , size_rect.mLeft, size_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
-
- }
- }
-
- for (U32 idx = 0; idx < 2; ++idx)
- {
- if (!triangles[idx].empty())
- { //plot graph of visible/total triangles
- std::sort(triangles[idx].begin(), triangles[idx].end());
-
- ll_remove_outliers(triangles[idx], 1.f);
-
- LLRect tri_rect;
- if (idx == 0)
- {
- tri_rect = LLRect(margin, graph_pos[1]-margin, new_rect.getWidth()/2-margin, graph_pos[0]+margin);
- }
- else
- {
- tri_rect = LLRect(new_rect.getWidth()/2+margin, graph_pos[1]-margin, new_rect.getWidth()-margin, graph_pos[0]+margin);
- }
-
- gl_rect_2d(tri_rect, LLColor4::white, false);
-
- S32 tri_domain[] = { 65536, 0 };
-
- //get domain of triangle counts
- for (U32 i = 0; i < triangles[idx].size(); ++i)
- {
- tri_domain[0] = llmin(tri_domain[0], triangles[idx][i]);
- tri_domain[1] = llmax(tri_domain[1], triangles[idx][i]);
- }
-
- U32 triangle_range = tri_domain[1]-tri_domain[0];
-
- U32 count = triangles[idx].size();
-
- gGL.begin(LLRender::LINE_STRIP);
- //plot triangles
- for (U32 i = 0; i < count; ++i)
- {
- U32 tri_count = triangles[idx][i];
- F32 y = (F32) (tri_count-tri_domain[0])/triangle_range*tri_rect.getHeight()+tri_rect.mBottom;
- F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft;
-
- gGL.vertex2f(x,y);
-
- if (i%4096 == 0)
- {
- gGL.end();
- gGL.flush();
- gGL.begin(LLRender::LINE_STRIP);
- }
- }
-
- gGL.end();
- gGL.flush();
-
- count = visible_triangles[idx].size();
-
- std::string label = llformat("%s Object Triangle Counts (Ktris) -- Visible: %.2f/%.2f (%.2f KB Visible)",
- category[idx], total_visible_triangles[idx]/1024.f, total_triangles[idx]/1024.f, total_visible_bytes[idx]/1024.f);
-
- LLFontGL::getFontMonospace()->renderUTF8(label,
- 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
-
- }
- }
-
- for (U32 idx = 0; idx < 2; ++idx)
- {
- if (!streaming_cost[idx].empty())
- { //plot graph of streaming cost
- std::sort(streaming_cost[idx].begin(), streaming_cost[idx].end());
-
- ll_remove_outliers(streaming_cost[idx], 1.f);
-
- LLRect tri_rect;
- if (idx == 0)
- {
- tri_rect = LLRect(margin, graph_pos[2]-margin, new_rect.getWidth()/2-margin, graph_pos[1]+margin);
- }
- else
- {
- tri_rect = LLRect(new_rect.getWidth()/2+margin, graph_pos[2]-margin, new_rect.getWidth()-margin, graph_pos[1]+margin);
- }
-
- gl_rect_2d(tri_rect, LLColor4::white, false);
-
- F32 streaming_domain[] = { 65536, 0 };
-
- //get domain of triangle counts
- for (U32 i = 0; i < streaming_cost[idx].size(); ++i)
- {
- streaming_domain[0] = llmin(streaming_domain[0], streaming_cost[idx][i]);
- streaming_domain[1] = llmax(streaming_domain[1], streaming_cost[idx][i]);
- }
-
- F32 cost_range = streaming_domain[1]-streaming_domain[0];
-
- U32 count = streaming_cost[idx].size();
-
- F32 total = 0;
-
- gGL.begin(LLRender::LINE_STRIP);
- //plot triangles
- for (U32 i = 0; i < count; ++i)
- {
- F32 sc = streaming_cost[idx][i];
- total += sc;
- F32 y = (F32) (sc-streaming_domain[0])/cost_range*tri_rect.getHeight()+tri_rect.mBottom;
- F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft;
-
- gGL.vertex2f(x,y);
-
- if (i%4096 == 0)
- {
- gGL.end();
- gGL.flush();
- gGL.begin(LLRender::LINE_STRIP);
- }
- }
-
- gGL.end();
- gGL.flush();
-
- std::string label = llformat("%s Object Streaming Cost -- [%.2f, %.2f] Mean: %.2f Total: %.2f",
- category[idx], streaming_domain[0], streaming_domain[1], total/count, total_streaming[idx]);
-
- LLFontGL::getFontMonospace()->renderUTF8(label,
- 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
-
- }
- }
-
- for (U32 idx = 0; idx < 2; ++idx)
- {
- if (!physics_cost[idx].empty())
- { //plot graph of physics cost
- std::sort(physics_cost[idx].begin(), physics_cost[idx].end());
-
- ll_remove_outliers(physics_cost[idx], 1.f);
-
- LLRect tri_rect;
- if (idx == 0)
- {
- tri_rect = LLRect(margin, graph_pos[3]-margin, new_rect.getWidth()/2-margin, graph_pos[2]+margin);
- }
- else
- {
- tri_rect = LLRect(new_rect.getWidth()/2+margin, graph_pos[3]-margin, new_rect.getWidth()-margin, graph_pos[2]+margin);
- }
-
- gl_rect_2d(tri_rect, LLColor4::white, false);
-
- F32 physics_domain[] = { 65536, 0 };
-
- //get domain of triangle counts
- for (U32 i = 0; i < physics_cost[idx].size(); ++i)
- {
- physics_domain[0] = llmin(physics_domain[0], physics_cost[idx][i]);
- physics_domain[1] = llmax(physics_domain[1], physics_cost[idx][i]);
- }
-
- F32 cost_range = physics_domain[1]-physics_domain[0];
-
- U32 count = physics_cost[idx].size();
-
- F32 total = 0;
-
- gGL.begin(LLRender::LINE_STRIP);
- //plot triangles
- for (U32 i = 0; i < count; ++i)
- {
- F32 pc = physics_cost[idx][i];
- total += pc;
- F32 y = (F32) (pc-physics_domain[0])/cost_range*tri_rect.getHeight()+tri_rect.mBottom;
- F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft;
-
- gGL.vertex2f(x,y);
-
- if (i%4096 == 0)
- {
- gGL.end();
- gGL.flush();
- gGL.begin(LLRender::LINE_STRIP);
- }
- }
-
- gGL.end();
- gGL.flush();
-
- std::string label = llformat("%s Object Physics Cost -- [%.2f, %.2f] Mean: %.2f Total: %.2f",
- category[idx], physics_domain[0], physics_domain[1], total/count, total_physics[idx]);
-
- LLFontGL::getFontMonospace()->renderUTF8(label,
- 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
-
- }
- }
-
-
-
-
- LLView::draw();
+ total_bytes[idx] += bytes;
+ total_visible_bytes[idx] += visible_bytes;
+ }
+ }
+ }
+
+ const char* category[] =
+ {
+ "Region",
+ "Attachment"
+ };
+
+ S32 graph_pos[4];
+
+ for (U32 i = 0; i < 4; ++i)
+ {
+ graph_pos[i] = new_rect.getHeight()/4*(i+1);
+ }
+
+ for (U32 idx = 0; idx < 2; idx++)
+ {
+ if (!size[idx].empty())
+ { //display graph of object sizes
+ std::sort(size[idx].begin(), size[idx].end());
+
+ ll_remove_outliers(size[idx], 1.f);
+
+ LLRect size_rect;
+
+ if (idx == 0)
+ {
+ size_rect = LLRect(margin, graph_pos[0]-margin, new_rect.getWidth()/2-margin, margin*2);
+ }
+ else
+ {
+ size_rect = LLRect(margin+new_rect.getWidth()/2, graph_pos[0]-margin, new_rect.getWidth()-margin, margin*2);
+ }
+
+ gl_rect_2d(size_rect, LLColor4::white, false);
+
+ F32 size_domain[] = { 128.f, 0.f };
+
+ //get domain of sizes
+ for (U32 i = 0; i < size[idx].size(); ++i)
+ {
+ size_domain[0] = llmin(size_domain[0], size[idx][i]);
+ size_domain[1] = llmax(size_domain[1], size[idx][i]);
+ }
+
+ F32 size_range = size_domain[1]-size_domain[0];
+
+ U32 count = size[idx].size();
+
+ F32 total = 0.f;
+
+ gGL.begin(LLRender::LINE_STRIP);
+
+ for (U32 i = 0; i < count; ++i)
+ {
+ F32 rad = size[idx][i];
+ total += rad;
+ F32 y = (rad-size_domain[0])/size_range*size_rect.getHeight()+size_rect.mBottom;
+ F32 x = (F32) i / count * size_rect.getWidth() + size_rect.mLeft;
+
+ gGL.vertex2f(x,y);
+
+ if (i%4096 == 0)
+ {
+ gGL.end();
+ gGL.flush();
+ gGL.begin(LLRender::LINE_STRIP);
+ }
+ }
+
+ gGL.end();
+ gGL.flush();
+
+ std::string label = llformat("%s Object Sizes (m) -- [%.1f, %.1f] Mean: %.1f Median: %.1f -- %d samples",
+ category[idx], size_domain[0], size_domain[1], total/count, size[idx][count/2], count);
+
+ LLFontGL::getFontMonospace()->renderUTF8(label,
+ 0 , size_rect.mLeft, size_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+
+ }
+ }
+
+ for (U32 idx = 0; idx < 2; ++idx)
+ {
+ if (!triangles[idx].empty())
+ { //plot graph of visible/total triangles
+ std::sort(triangles[idx].begin(), triangles[idx].end());
+
+ ll_remove_outliers(triangles[idx], 1.f);
+
+ LLRect tri_rect;
+ if (idx == 0)
+ {
+ tri_rect = LLRect(margin, graph_pos[1]-margin, new_rect.getWidth()/2-margin, graph_pos[0]+margin);
+ }
+ else
+ {
+ tri_rect = LLRect(new_rect.getWidth()/2+margin, graph_pos[1]-margin, new_rect.getWidth()-margin, graph_pos[0]+margin);
+ }
+
+ gl_rect_2d(tri_rect, LLColor4::white, false);
+
+ S32 tri_domain[] = { 65536, 0 };
+
+ //get domain of triangle counts
+ for (U32 i = 0; i < triangles[idx].size(); ++i)
+ {
+ tri_domain[0] = llmin(tri_domain[0], triangles[idx][i]);
+ tri_domain[1] = llmax(tri_domain[1], triangles[idx][i]);
+ }
+
+ U32 triangle_range = tri_domain[1]-tri_domain[0];
+
+ U32 count = triangles[idx].size();
+
+ gGL.begin(LLRender::LINE_STRIP);
+ //plot triangles
+ for (U32 i = 0; i < count; ++i)
+ {
+ U32 tri_count = triangles[idx][i];
+ F32 y = (F32) (tri_count-tri_domain[0])/triangle_range*tri_rect.getHeight()+tri_rect.mBottom;
+ F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft;
+
+ gGL.vertex2f(x,y);
+
+ if (i%4096 == 0)
+ {
+ gGL.end();
+ gGL.flush();
+ gGL.begin(LLRender::LINE_STRIP);
+ }
+ }
+
+ gGL.end();
+ gGL.flush();
+
+ count = visible_triangles[idx].size();
+
+ std::string label = llformat("%s Object Triangle Counts (Ktris) -- Visible: %.2f/%.2f (%.2f KB Visible)",
+ category[idx], total_visible_triangles[idx]/1024.f, total_triangles[idx]/1024.f, total_visible_bytes[idx]/1024.f);
+
+ LLFontGL::getFontMonospace()->renderUTF8(label,
+ 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+
+ }
+ }
+
+ for (U32 idx = 0; idx < 2; ++idx)
+ {
+ if (!streaming_cost[idx].empty())
+ { //plot graph of streaming cost
+ std::sort(streaming_cost[idx].begin(), streaming_cost[idx].end());
+
+ ll_remove_outliers(streaming_cost[idx], 1.f);
+
+ LLRect tri_rect;
+ if (idx == 0)
+ {
+ tri_rect = LLRect(margin, graph_pos[2]-margin, new_rect.getWidth()/2-margin, graph_pos[1]+margin);
+ }
+ else
+ {
+ tri_rect = LLRect(new_rect.getWidth()/2+margin, graph_pos[2]-margin, new_rect.getWidth()-margin, graph_pos[1]+margin);
+ }
+
+ gl_rect_2d(tri_rect, LLColor4::white, false);
+
+ F32 streaming_domain[] = { 65536, 0 };
+
+ //get domain of triangle counts
+ for (U32 i = 0; i < streaming_cost[idx].size(); ++i)
+ {
+ streaming_domain[0] = llmin(streaming_domain[0], streaming_cost[idx][i]);
+ streaming_domain[1] = llmax(streaming_domain[1], streaming_cost[idx][i]);
+ }
+
+ F32 cost_range = streaming_domain[1]-streaming_domain[0];
+
+ U32 count = streaming_cost[idx].size();
+
+ F32 total = 0;
+
+ gGL.begin(LLRender::LINE_STRIP);
+ //plot triangles
+ for (U32 i = 0; i < count; ++i)
+ {
+ F32 sc = streaming_cost[idx][i];
+ total += sc;
+ F32 y = (F32) (sc-streaming_domain[0])/cost_range*tri_rect.getHeight()+tri_rect.mBottom;
+ F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft;
+
+ gGL.vertex2f(x,y);
+
+ if (i%4096 == 0)
+ {
+ gGL.end();
+ gGL.flush();
+ gGL.begin(LLRender::LINE_STRIP);
+ }
+ }
+
+ gGL.end();
+ gGL.flush();
+
+ std::string label = llformat("%s Object Streaming Cost -- [%.2f, %.2f] Mean: %.2f Total: %.2f",
+ category[idx], streaming_domain[0], streaming_domain[1], total/count, total_streaming[idx]);
+
+ LLFontGL::getFontMonospace()->renderUTF8(label,
+ 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+
+ }
+ }
+
+ for (U32 idx = 0; idx < 2; ++idx)
+ {
+ if (!physics_cost[idx].empty())
+ { //plot graph of physics cost
+ std::sort(physics_cost[idx].begin(), physics_cost[idx].end());
+
+ ll_remove_outliers(physics_cost[idx], 1.f);
+
+ LLRect tri_rect;
+ if (idx == 0)
+ {
+ tri_rect = LLRect(margin, graph_pos[3]-margin, new_rect.getWidth()/2-margin, graph_pos[2]+margin);
+ }
+ else
+ {
+ tri_rect = LLRect(new_rect.getWidth()/2+margin, graph_pos[3]-margin, new_rect.getWidth()-margin, graph_pos[2]+margin);
+ }
+
+ gl_rect_2d(tri_rect, LLColor4::white, false);
+
+ F32 physics_domain[] = { 65536, 0 };
+
+ //get domain of triangle counts
+ for (U32 i = 0; i < physics_cost[idx].size(); ++i)
+ {
+ physics_domain[0] = llmin(physics_domain[0], physics_cost[idx][i]);
+ physics_domain[1] = llmax(physics_domain[1], physics_cost[idx][i]);
+ }
+
+ F32 cost_range = physics_domain[1]-physics_domain[0];
+
+ U32 count = physics_cost[idx].size();
+
+ F32 total = 0;
+
+ gGL.begin(LLRender::LINE_STRIP);
+ //plot triangles
+ for (U32 i = 0; i < count; ++i)
+ {
+ F32 pc = physics_cost[idx][i];
+ total += pc;
+ F32 y = (F32) (pc-physics_domain[0])/cost_range*tri_rect.getHeight()+tri_rect.mBottom;
+ F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft;
+
+ gGL.vertex2f(x,y);
+
+ if (i%4096 == 0)
+ {
+ gGL.end();
+ gGL.flush();
+ gGL.begin(LLRender::LINE_STRIP);
+ }
+ }
+
+ gGL.end();
+ gGL.flush();
+
+ std::string label = llformat("%s Object Physics Cost -- [%.2f, %.2f] Mean: %.2f Total: %.2f",
+ category[idx], physics_domain[0], physics_domain[1], total/count, total_physics[idx]);
+
+ LLFontGL::getFontMonospace()->renderUTF8(label,
+ 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+
+ }
+ }
+
+
+
+
+ LLView::draw();
}
diff --git a/indra/newview/llsceneview.h b/indra/newview/llsceneview.h
index e077c358b4..27e934830e 100644
--- a/indra/newview/llsceneview.h
+++ b/indra/newview/llsceneview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsceneview.h
* @brief LLSceneView class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,12 +33,12 @@
class LLSceneView : public LLFloater
{
public:
- LLSceneView(const LLRect& rect);
+ LLSceneView(const LLRect& rect);
+
+ virtual void draw();
- virtual void draw();
-
protected:
- virtual void onClose(bool app_qutting = false);
+ virtual void onClose(bool app_qutting = false);
virtual void onClickCloseBtn(bool app_qutting = false);
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 17f2970f99..70e6838a49 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llscreenchannel.cpp
* @brief Class implements a channel on a screen in which appropriate toasts may appear.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,24 +53,24 @@ LLRect LLScreenChannelBase::getChannelRect()
{
LL_PROFILE_ZONE_SCOPED;
- if (mFloaterSnapRegion == NULL)
- {
- mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
- }
-
- if (mChicletRegion == NULL)
- {
- mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container");
- }
-
- LLRect channel_rect;
- LLRect chiclet_rect;
-
- mFloaterSnapRegion->localRectToScreen(mFloaterSnapRegion->getLocalRect(), &channel_rect);
- mChicletRegion->localRectToScreen(mChicletRegion->getLocalRect(), &chiclet_rect);
-
- channel_rect.mTop = chiclet_rect.mBottom;
- return channel_rect;
+ if (mFloaterSnapRegion == NULL)
+ {
+ mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+ }
+
+ if (mChicletRegion == NULL)
+ {
+ mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container");
+ }
+
+ LLRect channel_rect;
+ LLRect chiclet_rect;
+
+ mFloaterSnapRegion->localRectToScreen(mFloaterSnapRegion->getLocalRect(), &channel_rect);
+ mChicletRegion->localRectToScreen(mChicletRegion->getLocalRect(), &chiclet_rect);
+
+ channel_rect.mTop = chiclet_rect.mBottom;
+ return channel_rect;
}
@@ -79,102 +79,102 @@ LLRect LLScreenChannelBase::getChannelRect()
// LLScreenChannelBase
//////////////////////
-LLScreenChannelBase::LLScreenChannelBase(const Params& p)
-: LLUICtrl(p),
- mToastAlignment(p.toast_align),
- mCanStoreToasts(true),
- mHiddenToastsNum(0),
- mHoveredToast(NULL),
- mControlHovering(false),
- mShowToasts(true),
- mID(p.id),
- mDisplayToastsAlways(p.display_toasts_always),
- mChannelAlignment(p.channel_align),
- mFloaterSnapRegion(NULL),
- mChicletRegion(NULL)
+LLScreenChannelBase::LLScreenChannelBase(const Params& p)
+: LLUICtrl(p),
+ mToastAlignment(p.toast_align),
+ mCanStoreToasts(true),
+ mHiddenToastsNum(0),
+ mHoveredToast(NULL),
+ mControlHovering(false),
+ mShowToasts(true),
+ mID(p.id),
+ mDisplayToastsAlways(p.display_toasts_always),
+ mChannelAlignment(p.channel_align),
+ mFloaterSnapRegion(NULL),
+ mChicletRegion(NULL)
{
- mID = p.id;
+ mID = p.id;
- setMouseOpaque( false );
- setVisible(FALSE);
+ setMouseOpaque( false );
+ setVisible(FALSE);
}
BOOL LLScreenChannelBase::postBuild()
{
- if (mFloaterSnapRegion == NULL)
- {
- mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
- }
-
- if (mChicletRegion == NULL)
- {
- mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container");
- }
-
- return TRUE;
+ if (mFloaterSnapRegion == NULL)
+ {
+ mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+ }
+
+ if (mChicletRegion == NULL)
+ {
+ mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container");
+ }
+
+ return TRUE;
}
void LLScreenChannelBase::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- if (mChannelAlignment == CA_CENTRE)
- {
- // Keep notifications and alerts centered
- // WorldViewRectScaled is out of date at reshape but Window has same width
- S32 channel_bound = gViewerWindow->getWindowRectScaled().getWidth() / 2;
- setRect(LLRect(channel_bound, 0, channel_bound, 0));
- updateRect(); //sets top and bottom only
- }
- redrawToasts();
+ if (mChannelAlignment == CA_CENTRE)
+ {
+ // Keep notifications and alerts centered
+ // WorldViewRectScaled is out of date at reshape but Window has same width
+ S32 channel_bound = gViewerWindow->getWindowRectScaled().getWidth() / 2;
+ setRect(LLRect(channel_bound, 0, channel_bound, 0));
+ updateRect(); //sets top and bottom only
+ }
+ redrawToasts();
}
bool LLScreenChannelBase::isHovering()
{
- if (!mHoveredToast)
- {
- return false;
- }
+ if (!mHoveredToast)
+ {
+ return false;
+ }
- return mHoveredToast->isHovered();
+ return mHoveredToast->isHovered();
}
void LLScreenChannelBase::updatePositionAndSize(LLRect rect)
{
- LLRect this_rect = getRect();
-
- this_rect.mTop = rect.mTop;
- switch(mChannelAlignment)
- {
- case CA_LEFT :
- break;
- case CA_CENTRE :
- this_rect.setCenterAndSize( (rect.getWidth()) / 2, rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight());
- break;
- case CA_RIGHT :
- this_rect.setLeftTopAndSize(rect.mRight - this_rect.getWidth(),
- this_rect.mTop,
- this_rect.getWidth(),
- this_rect.getHeight());
- }
- setRect(this_rect);
- redrawToasts();
-
+ LLRect this_rect = getRect();
+
+ this_rect.mTop = rect.mTop;
+ switch(mChannelAlignment)
+ {
+ case CA_LEFT :
+ break;
+ case CA_CENTRE :
+ this_rect.setCenterAndSize( (rect.getWidth()) / 2, rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight());
+ break;
+ case CA_RIGHT :
+ this_rect.setLeftTopAndSize(rect.mRight - this_rect.getWidth(),
+ this_rect.mTop,
+ this_rect.getWidth(),
+ this_rect.getHeight());
+ }
+ setRect(this_rect);
+ redrawToasts();
+
}
void LLScreenChannelBase::init(S32 channel_left, S32 channel_right)
{
- // top and bottom set by updateRect()
- setRect(LLRect(channel_left, 0, channel_right, 0));
- updateRect();
- setVisible(TRUE);
+ // top and bottom set by updateRect()
+ setRect(LLRect(channel_left, 0, channel_right, 0));
+ updateRect();
+ setVisible(TRUE);
}
-void LLScreenChannelBase::updateRect()
+void LLScreenChannelBase::updateRect()
{
- S32 channel_top = getChannelRect().mTop;
- S32 channel_bottom = getChannelRect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
- S32 channel_left = getRect().mLeft;
- S32 channel_right = getRect().mRight;
- setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom));
+ S32 channel_top = getChannelRect().mTop;
+ S32 channel_bottom = getChannelRect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
+ S32 channel_left = getRect().mLeft;
+ S32 channel_right = getRect().mRight;
+ setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom));
}
//--------------------------------------------------------------------------
@@ -183,76 +183,76 @@ void LLScreenChannelBase::updateRect()
//////////////////////
//--------------------------------------------------------------------------
LLScreenChannel::LLScreenChannel(const Params& p)
-: LLScreenChannelBase(p),
- mStartUpToastPanel(NULL)
+: LLScreenChannelBase(p),
+ mStartUpToastPanel(NULL)
{
}
//--------------------------------------------------------------------------
void LLScreenChannel::init(S32 channel_left, S32 channel_right)
{
- LLScreenChannelBase::init(channel_left, channel_right);
- LLRect channel_rect = getChannelRect();
- updatePositionAndSize(channel_rect);
+ LLScreenChannelBase::init(channel_left, channel_right);
+ LLRect channel_rect = getChannelRect();
+ updatePositionAndSize(channel_rect);
}
//--------------------------------------------------------------------------
-LLScreenChannel::~LLScreenChannel()
+LLScreenChannel::~LLScreenChannel()
{
-
+
}
std::list<const LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
{
- std::list<const LLToast*> res;
-
- // collect stored toasts
- for (std::vector<ToastElem>::iterator it = mStoredToastList.begin(); it
- != mStoredToastList.end(); it++)
- {
- const LLToast* toast = it->getToast();
- if (toast && matcher.matches(toast->getNotification()))
- {
- res.push_back(toast);
- }
- }
-
- // collect displayed toasts
- for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
- != mToastList.end(); it++)
- {
- const LLToast* toast = it->getToast();
- if (toast && matcher.matches(toast->getNotification()))
- {
- res.push_back(toast);
- }
- }
-
- return res;
+ std::list<const LLToast*> res;
+
+ // collect stored toasts
+ for (std::vector<ToastElem>::iterator it = mStoredToastList.begin(); it
+ != mStoredToastList.end(); it++)
+ {
+ const LLToast* toast = it->getToast();
+ if (toast && matcher.matches(toast->getNotification()))
+ {
+ res.push_back(toast);
+ }
+ }
+
+ // collect displayed toasts
+ for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
+ != mToastList.end(); it++)
+ {
+ const LLToast* toast = it->getToast();
+ if (toast && matcher.matches(toast->getNotification()))
+ {
+ res.push_back(toast);
+ }
+ }
+
+ return res;
}
//--------------------------------------------------------------------------
void LLScreenChannel::updatePositionAndSize(LLRect new_world_rect)
{
- LLRect this_rect = getRect();
-
- switch(mChannelAlignment)
- {
- case CA_LEFT :
- this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio());
- break;
- case CA_CENTRE :
- LLScreenChannelBase::updatePositionAndSize(new_world_rect);
- return;
- case CA_RIGHT :
- this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio());
- this_rect.setLeftTopAndSize(new_world_rect.mRight - this_rect.getWidth(),
- this_rect.mTop,
- this_rect.getWidth(),
- this_rect.getHeight());
- }
- setRect(this_rect);
- redrawToasts();
+ LLRect this_rect = getRect();
+
+ switch(mChannelAlignment)
+ {
+ case CA_LEFT :
+ this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio());
+ break;
+ case CA_CENTRE :
+ LLScreenChannelBase::updatePositionAndSize(new_world_rect);
+ return;
+ case CA_RIGHT :
+ this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio());
+ this_rect.setLeftTopAndSize(new_world_rect.mRight - this_rect.getWidth(),
+ this_rect.mTop,
+ this_rect.getWidth(),
+ this_rect.getHeight());
+ }
+ setRect(this_rect);
+ redrawToasts();
}
//--------------------------------------------------------------------------
@@ -261,875 +261,875 @@ void LLScreenChannel::addToast(const LLToast::Params& p)
LL_PROFILE_ZONE_SCOPED
bool store_toast = false, show_toast = false;
- if (mDisplayToastsAlways)
- {
- show_toast = true;
- }
- else
- {
- show_toast = mWasStartUpToastShown && (mShowToasts || p.force_show);
- }
- store_toast = !show_toast && p.can_be_stored && mCanStoreToasts;
-
- if(!show_toast && !store_toast)
- {
- if(gAgent.isDoNotDisturb())
+ if (mDisplayToastsAlways)
+ {
+ show_toast = true;
+ }
+ else
+ {
+ show_toast = mWasStartUpToastShown && (mShowToasts || p.force_show);
+ }
+ store_toast = !show_toast && p.can_be_stored && mCanStoreToasts;
+
+ if(!show_toast && !store_toast)
+ {
+ if(gAgent.isDoNotDisturb())
{
- return;
+ return;
}
- LLNotificationPtr notification = LLNotifications::instance().find(p.notif_id);
-
- if (notification &&
- (!notification->canLogToIM() || !notification->hasFormElements()))
- {
- // only cancel notification if it isn't being used in IM session
- LLNotifications::instance().cancel(notification);
- }
-
- // It was assumed that the toast would take ownership of the panel pointer.
- // But since we have decided not to display the toast, kill the panel to
- // prevent the memory leak.
- if (p.panel != NULL)
- {
- p.panel()->die();
- }
- return;
- }
-
- LLToast* toast = new LLToast(p);
- ToastElem new_toast_elem(toast->getHandle());
-
- toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, _1));
- toast->setOnToastDestroyedCallback(boost::bind(&LLScreenChannel::onToastDestroyed, this, _1));
- if(mControlHovering)
- {
- toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2));
- toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopToastTimer, this, toast));
- toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startToastTimer, this, toast));
- }
-
- if(show_toast)
- {
- mToastList.push_back(new_toast_elem);
- if(p.can_be_stored)
- {
- // store toasts immediately - EXT-3762
- storeToast(new_toast_elem);
- }
- updateShowToastsState();
- redrawToasts();
- }
- else // store_toast
- {
- mHiddenToastsNum++;
- storeToast(new_toast_elem);
- }
+ LLNotificationPtr notification = LLNotifications::instance().find(p.notif_id);
+
+ if (notification &&
+ (!notification->canLogToIM() || !notification->hasFormElements()))
+ {
+ // only cancel notification if it isn't being used in IM session
+ LLNotifications::instance().cancel(notification);
+ }
+
+ // It was assumed that the toast would take ownership of the panel pointer.
+ // But since we have decided not to display the toast, kill the panel to
+ // prevent the memory leak.
+ if (p.panel != NULL)
+ {
+ p.panel()->die();
+ }
+ return;
+ }
+
+ LLToast* toast = new LLToast(p);
+ ToastElem new_toast_elem(toast->getHandle());
+
+ toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, _1));
+ toast->setOnToastDestroyedCallback(boost::bind(&LLScreenChannel::onToastDestroyed, this, _1));
+ if(mControlHovering)
+ {
+ toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2));
+ toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopToastTimer, this, toast));
+ toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startToastTimer, this, toast));
+ }
+
+ if(show_toast)
+ {
+ mToastList.push_back(new_toast_elem);
+ if(p.can_be_stored)
+ {
+ // store toasts immediately - EXT-3762
+ storeToast(new_toast_elem);
+ }
+ updateShowToastsState();
+ redrawToasts();
+ }
+ else // store_toast
+ {
+ mHiddenToastsNum++;
+ storeToast(new_toast_elem);
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::onToastDestroyed(LLToast* toast)
-{
- std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), static_cast<LLPanel*>(toast));
-
- if(it != mToastList.end())
- {
- mToastList.erase(it);
- }
-
- it = find(mStoredToastList.begin(), mStoredToastList.end(), static_cast<LLPanel*>(toast));
-
- if(it != mStoredToastList.end())
- {
- mStoredToastList.erase(it);
- }
-
- // if destroyed toast is hovered - reset hovered
- if (mHoveredToast == toast)
- {
- mHoveredToast = NULL;
- }
+{
+ std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), static_cast<LLPanel*>(toast));
+
+ if(it != mToastList.end())
+ {
+ mToastList.erase(it);
+ }
+
+ it = find(mStoredToastList.begin(), mStoredToastList.end(), static_cast<LLPanel*>(toast));
+
+ if(it != mStoredToastList.end())
+ {
+ mStoredToastList.erase(it);
+ }
+
+ // if destroyed toast is hovered - reset hovered
+ if (mHoveredToast == toast)
+ {
+ mHoveredToast = NULL;
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::onToastFade(LLToast* toast)
-{
- std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), static_cast<LLPanel*>(toast));
-
- if(it != mToastList.end())
- {
- bool delete_toast = !mCanStoreToasts || !toast->getCanBeStored();
- if(delete_toast)
- {
- mToastList.erase(it);
- deleteToast(toast);
- }
- else
- {
- storeToast((*it));
- mToastList.erase(it);
- }
-
- redrawToasts();
- }
+{
+ std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), static_cast<LLPanel*>(toast));
+
+ if(it != mToastList.end())
+ {
+ bool delete_toast = !mCanStoreToasts || !toast->getCanBeStored();
+ if(delete_toast)
+ {
+ mToastList.erase(it);
+ deleteToast(toast);
+ }
+ else
+ {
+ storeToast((*it));
+ mToastList.erase(it);
+ }
+
+ redrawToasts();
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::deleteToast(LLToast* toast)
{
- if (!toast || toast->isDead())
- {
- return;
- }
-
- // send signal to observers about destroying of a toast
- toast->closeToast();
-
- // update channel's Hovering state
- // turning hovering off manually because onMouseLeave won't happen if a toast was closed using a keyboard
- if(mHoveredToast == toast)
- {
- mHoveredToast = NULL;
- }
+ if (!toast || toast->isDead())
+ {
+ return;
+ }
+
+ // send signal to observers about destroying of a toast
+ toast->closeToast();
+
+ // update channel's Hovering state
+ // turning hovering off manually because onMouseLeave won't happen if a toast was closed using a keyboard
+ if(mHoveredToast == toast)
+ {
+ mHoveredToast = NULL;
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::storeToast(ToastElem& toast_elem)
{
- // do not store clones
- std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), toast_elem.getID());
- if( it != mStoredToastList.end() )
- return;
-
- const LLToast* toast = toast_elem.getToast();
- if (toast)
- {
- mStoredToastList.push_back(toast_elem);
- mOnStoreToast(toast->getPanel(), toast->getNotificationID());
- }
+ // do not store clones
+ std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), toast_elem.getID());
+ if( it != mStoredToastList.end() )
+ return;
+
+ const LLToast* toast = toast_elem.getToast();
+ if (toast)
+ {
+ mStoredToastList.push_back(toast_elem);
+ mOnStoreToast(toast->getPanel(), toast->getNotificationID());
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::loadStoredToastsToChannel()
{
- std::vector<ToastElem>::iterator it;
-
- if(mStoredToastList.size() == 0)
- return;
-
- for(it = mStoredToastList.begin(); it != mStoredToastList.end(); ++it)
- {
- LLToast* toast = it->getToast();
- if (toast)
- {
- toast->setIsHidden(false);
- toast->startTimer();
- mToastList.push_back(*it);
- }
- }
-
- mStoredToastList.clear();
- redrawToasts();
+ std::vector<ToastElem>::iterator it;
+
+ if(mStoredToastList.size() == 0)
+ return;
+
+ for(it = mStoredToastList.begin(); it != mStoredToastList.end(); ++it)
+ {
+ LLToast* toast = it->getToast();
+ if (toast)
+ {
+ toast->setIsHidden(false);
+ toast->startTimer();
+ mToastList.push_back(*it);
+ }
+ }
+
+ mStoredToastList.clear();
+ redrawToasts();
}
//--------------------------------------------------------------------------
void LLScreenChannel::loadStoredToastByNotificationIDToChannel(LLUUID id)
{
- std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
-
- if( it == mStoredToastList.end() )
- return;
-
- LLToast* toast = it->getToast();
- if (toast)
- {
- if(toast->getVisible())
- {
- // toast is already in channel
- return;
- }
-
- toast->setIsHidden(false);
- toast->startTimer();
- mToastList.push_back(*it);
- }
-
- redrawToasts();
+ std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
+
+ if( it == mStoredToastList.end() )
+ return;
+
+ LLToast* toast = it->getToast();
+ if (toast)
+ {
+ if(toast->getVisible())
+ {
+ // toast is already in channel
+ return;
+ }
+
+ toast->setIsHidden(false);
+ toast->startTimer();
+ mToastList.push_back(*it);
+ }
+
+ redrawToasts();
}
//--------------------------------------------------------------------------
void LLScreenChannel::killToastByNotificationID(LLUUID id)
{
- // searching among toasts on a screen
- std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), id);
- LLNotificationPtr notification = LLNotifications::instance().find(id);
- if (!notification) return;
-
- if( it != mToastList.end())
- {
- LLToast* toast = it->getToast();
- // if it is a notification toast and notification is UnResponded - then respond on it
- // else - simply destroy a toast
- //
- // NOTE: if a notification is unresponded this function will be called twice for the same toast.
- // At first, the notification will be discarded, at second (it will be caused by discarding),
- // the toast will be destroyed.
- if(toast && toast->isNotificationValid())
- {
- if (!notification->canLogToIM() || !notification->hasFormElements())
- {
- // only cancel notification if it isn't being used in IM session
- LLNotifications::instance().cancel(notification);
- }
- }
- else
- {
- removeToastByNotificationID(id);
- }
- }
- else
- {
- // searching among stored toasts
- it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
-
- if( it != mStoredToastList.end() )
- {
- LLToast* toast = it->getToast();
- if (toast)
- {
- if (!notification->canLogToIM() || !notification->hasFormElements())
- {
- // only cancel notification if it isn't being used in IM session
- LLNotifications::instance().cancel(notification);
- }
- deleteToast(toast);
- }
- }
-
- // Call find() once more, because the mStoredToastList could have been changed
- // via notification cancellation and the iterator could have become invalid.
- it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
- if (it != mStoredToastList.end())
- {
- mStoredToastList.erase(it);
- }
- }
+ // searching among toasts on a screen
+ std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), id);
+ LLNotificationPtr notification = LLNotifications::instance().find(id);
+ if (!notification) return;
+
+ if( it != mToastList.end())
+ {
+ LLToast* toast = it->getToast();
+ // if it is a notification toast and notification is UnResponded - then respond on it
+ // else - simply destroy a toast
+ //
+ // NOTE: if a notification is unresponded this function will be called twice for the same toast.
+ // At first, the notification will be discarded, at second (it will be caused by discarding),
+ // the toast will be destroyed.
+ if(toast && toast->isNotificationValid())
+ {
+ if (!notification->canLogToIM() || !notification->hasFormElements())
+ {
+ // only cancel notification if it isn't being used in IM session
+ LLNotifications::instance().cancel(notification);
+ }
+ }
+ else
+ {
+ removeToastByNotificationID(id);
+ }
+ }
+ else
+ {
+ // searching among stored toasts
+ it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
+
+ if( it != mStoredToastList.end() )
+ {
+ LLToast* toast = it->getToast();
+ if (toast)
+ {
+ if (!notification->canLogToIM() || !notification->hasFormElements())
+ {
+ // only cancel notification if it isn't being used in IM session
+ LLNotifications::instance().cancel(notification);
+ }
+ deleteToast(toast);
+ }
+ }
+
+ // Call find() once more, because the mStoredToastList could have been changed
+ // via notification cancellation and the iterator could have become invalid.
+ it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
+ if (it != mStoredToastList.end())
+ {
+ mStoredToastList.erase(it);
+ }
+ }
}
void LLScreenChannel::removeToastByNotificationID(LLUUID id)
{
- std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), id);
- while( it != mToastList.end())
- {
- deleteToast(it->getToast());
- mToastList.erase(it);
- redrawToasts();
- // find next toast with matching id
- it = find(mToastList.begin(), mToastList.end(), id);
- }
-
- it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
- if (it != mStoredToastList.end())
- {
- deleteToast(it->getToast());
- mStoredToastList.erase(it);
- }
+ std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), id);
+ while( it != mToastList.end())
+ {
+ deleteToast(it->getToast());
+ mToastList.erase(it);
+ redrawToasts();
+ // find next toast with matching id
+ it = find(mToastList.begin(), mToastList.end(), id);
+ }
+
+ it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
+ if (it != mStoredToastList.end())
+ {
+ deleteToast(it->getToast());
+ mStoredToastList.erase(it);
+ }
}
void LLScreenChannel::killMatchedToasts(const Matcher& matcher)
{
- std::list<const LLToast*> to_delete = findToasts(matcher);
- for (std::list<const LLToast*>::iterator it = to_delete.begin(); it
- != to_delete.end(); it++)
- {
- killToastByNotificationID((*it)-> getNotificationID());
- }
+ std::list<const LLToast*> to_delete = findToasts(matcher);
+ for (std::list<const LLToast*>::iterator it = to_delete.begin(); it
+ != to_delete.end(); it++)
+ {
+ killToastByNotificationID((*it)-> getNotificationID());
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel)
{
- std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), id);
-
- LLPanel* panel_to_delete = panel;
-
- if( it != mToastList.end() && panel)
- {
- LLToast* toast = it->getToast();
- if (toast)
- {
- LLPanel* old_panel = toast->getPanel();
- toast->removeChild(old_panel);
- panel_to_delete = old_panel;
- toast->insertPanel(panel);
- toast->startTimer();
- }
- redrawToasts();
- }
-
- delete panel_to_delete;
+ std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), id);
+
+ LLPanel* panel_to_delete = panel;
+
+ if( it != mToastList.end() && panel)
+ {
+ LLToast* toast = it->getToast();
+ if (toast)
+ {
+ LLPanel* old_panel = toast->getPanel();
+ toast->removeChild(old_panel);
+ panel_to_delete = old_panel;
+ toast->insertPanel(panel);
+ toast->startTimer();
+ }
+ redrawToasts();
+ }
+
+ delete panel_to_delete;
}
//--------------------------------------------------------------------------
void LLScreenChannel::redrawToasts()
{
- if (!getParent())
- {
- // connect to floater snap region just to get resize events, we don't care about being a proper widget
- mFloaterSnapRegion->addChild(this);
- setFollows(FOLLOWS_ALL);
- }
-
- if(mToastList.size() == 0)
- return;
-
- switch(mToastAlignment)
- {
- case NA_TOP :
- showToastsTop();
- break;
-
- case NA_CENTRE :
- showToastsCentre();
- break;
-
- case NA_BOTTOM :
- showToastsBottom();
- }
+ if (!getParent())
+ {
+ // connect to floater snap region just to get resize events, we don't care about being a proper widget
+ mFloaterSnapRegion->addChild(this);
+ setFollows(FOLLOWS_ALL);
+ }
+
+ if(mToastList.size() == 0)
+ return;
+
+ switch(mToastAlignment)
+ {
+ case NA_TOP :
+ showToastsTop();
+ break;
+
+ case NA_CENTRE :
+ showToastsCentre();
+ break;
+
+ case NA_BOTTOM :
+ showToastsBottom();
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::showToastsBottom()
{
- LLRect toast_rect;
- S32 bottom = getRect().mBottom - gFloaterView->getRect().mBottom;
- S32 toast_margin = 0;
- std::vector<ToastElem>::reverse_iterator it;
-
- updateRect();
-
- LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
-
- // Use a local variable instead of mToastList.
- // mToastList can be modified during recursive calls and then all iteratos will be invalidated.
- std::vector<ToastElem> vToastList( mToastList );
-
- for(it = vToastList.rbegin(); it != vToastList.rend(); ++it)
- {
- if(it != vToastList.rbegin())
- {
- LLToast* toast = (it-1)->getToast();
- if (!toast)
- {
- LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
- return;
- }
-
- bottom = toast->getRect().mTop - toast->getTopPad();
- toast_margin = gSavedSettings.getS32("ToastGap");
- }
-
- LLToast* toast = it->getToast();
- if(!toast)
- {
- LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
- return;
- }
-
- toast_rect = toast->getRect();
- toast_rect.setOriginAndSize(getRect().mRight - toast_rect.getWidth(),
- bottom + toast_margin, toast_rect.getWidth(),
- toast_rect.getHeight());
- toast->setRect(toast_rect);
-
- if(floater && floater->overlapsScreenChannel())
- {
- if(it == vToastList.rbegin())
- {
- // move first toast above docked floater
- S32 shift = floater->getRect().getHeight();
- if(floater->getDockControl())
- {
- shift += floater->getDockControl()->getTongueHeight();
- }
- toast->translate(0, shift);
- }
-
- LLRect channel_rect = getChannelRect();
- // don't show toasts if there is not enough space
- if(toast_rect.mTop > channel_rect.mTop)
- {
- break;
- }
- }
-
- bool stop_showing_toasts = toast->getRect().mTop > getRect().mTop;
-
- if(!stop_showing_toasts)
- {
- if( it != vToastList.rend()-1)
- {
- S32 toast_top = toast->getRect().mTop + gSavedSettings.getS32("ToastGap");
- stop_showing_toasts = toast_top > getRect().mTop;
- }
- }
-
- // at least one toast should be visible
-
- if(it == vToastList.rbegin())
- {
- stop_showing_toasts = false;
- }
-
- if(stop_showing_toasts)
- break;
-
- if( !toast->getVisible() )
- {
- // HACK
- // EXT-2653: it is necessary to prevent overlapping for secondary showed toasts
- toast->setVisible(TRUE);
- }
- if(!toast->hasFocus())
- {
- // Fixing Z-order of toasts (EXT-4862)
- // Next toast will be positioned under this one.
- gFloaterView->sendChildToBack(toast);
- }
- }
-
- // Dismiss toasts we don't have space for (STORM-391).
- if(it != vToastList.rend())
- {
- mHiddenToastsNum = 0;
-
- for(; it != vToastList.rend(); it++)
- {
- LLToast* toast = it->getToast();
- if (toast)
- {
- toast->hide();
- }
- }
- }
+ LLRect toast_rect;
+ S32 bottom = getRect().mBottom - gFloaterView->getRect().mBottom;
+ S32 toast_margin = 0;
+ std::vector<ToastElem>::reverse_iterator it;
+
+ updateRect();
+
+ LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
+
+ // Use a local variable instead of mToastList.
+ // mToastList can be modified during recursive calls and then all iteratos will be invalidated.
+ std::vector<ToastElem> vToastList( mToastList );
+
+ for(it = vToastList.rbegin(); it != vToastList.rend(); ++it)
+ {
+ if(it != vToastList.rbegin())
+ {
+ LLToast* toast = (it-1)->getToast();
+ if (!toast)
+ {
+ LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
+ return;
+ }
+
+ bottom = toast->getRect().mTop - toast->getTopPad();
+ toast_margin = gSavedSettings.getS32("ToastGap");
+ }
+
+ LLToast* toast = it->getToast();
+ if(!toast)
+ {
+ LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
+ return;
+ }
+
+ toast_rect = toast->getRect();
+ toast_rect.setOriginAndSize(getRect().mRight - toast_rect.getWidth(),
+ bottom + toast_margin, toast_rect.getWidth(),
+ toast_rect.getHeight());
+ toast->setRect(toast_rect);
+
+ if(floater && floater->overlapsScreenChannel())
+ {
+ if(it == vToastList.rbegin())
+ {
+ // move first toast above docked floater
+ S32 shift = floater->getRect().getHeight();
+ if(floater->getDockControl())
+ {
+ shift += floater->getDockControl()->getTongueHeight();
+ }
+ toast->translate(0, shift);
+ }
+
+ LLRect channel_rect = getChannelRect();
+ // don't show toasts if there is not enough space
+ if(toast_rect.mTop > channel_rect.mTop)
+ {
+ break;
+ }
+ }
+
+ bool stop_showing_toasts = toast->getRect().mTop > getRect().mTop;
+
+ if(!stop_showing_toasts)
+ {
+ if( it != vToastList.rend()-1)
+ {
+ S32 toast_top = toast->getRect().mTop + gSavedSettings.getS32("ToastGap");
+ stop_showing_toasts = toast_top > getRect().mTop;
+ }
+ }
+
+ // at least one toast should be visible
+
+ if(it == vToastList.rbegin())
+ {
+ stop_showing_toasts = false;
+ }
+
+ if(stop_showing_toasts)
+ break;
+
+ if( !toast->getVisible() )
+ {
+ // HACK
+ // EXT-2653: it is necessary to prevent overlapping for secondary showed toasts
+ toast->setVisible(TRUE);
+ }
+ if(!toast->hasFocus())
+ {
+ // Fixing Z-order of toasts (EXT-4862)
+ // Next toast will be positioned under this one.
+ gFloaterView->sendChildToBack(toast);
+ }
+ }
+
+ // Dismiss toasts we don't have space for (STORM-391).
+ if(it != vToastList.rend())
+ {
+ mHiddenToastsNum = 0;
+
+ for(; it != vToastList.rend(); it++)
+ {
+ LLToast* toast = it->getToast();
+ if (toast)
+ {
+ toast->hide();
+ }
+ }
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::showToastsCentre()
{
- LLToast* toast = mToastList[0].getToast();
- if (!toast)
- {
- LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
- return;
- }
-
- LLRect toast_rect;
- S32 bottom = (getRect().mTop - getRect().mBottom)/2 + toast->getRect().getHeight()/2;
- std::vector<ToastElem>::reverse_iterator it;
-
- for(it = mToastList.rbegin(); it != mToastList.rend(); ++it)
- {
- LLToast* toast = it->getToast();
- if (!toast)
- {
- LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
- return;
- }
-
- toast_rect = toast->getRect();
- toast_rect.setLeftTopAndSize(getRect().mLeft - toast_rect.getWidth() / 2, bottom + toast_rect.getHeight() / 2 + gSavedSettings.getS32("ToastGap"), toast_rect.getWidth() ,toast_rect.getHeight());
- toast->setRect(toast_rect);
-
- toast->setVisible(TRUE);
- }
+ LLToast* toast = mToastList[0].getToast();
+ if (!toast)
+ {
+ LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
+ return;
+ }
+
+ LLRect toast_rect;
+ S32 bottom = (getRect().mTop - getRect().mBottom)/2 + toast->getRect().getHeight()/2;
+ std::vector<ToastElem>::reverse_iterator it;
+
+ for(it = mToastList.rbegin(); it != mToastList.rend(); ++it)
+ {
+ LLToast* toast = it->getToast();
+ if (!toast)
+ {
+ LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
+ return;
+ }
+
+ toast_rect = toast->getRect();
+ toast_rect.setLeftTopAndSize(getRect().mLeft - toast_rect.getWidth() / 2, bottom + toast_rect.getHeight() / 2 + gSavedSettings.getS32("ToastGap"), toast_rect.getWidth() ,toast_rect.getHeight());
+ toast->setRect(toast_rect);
+
+ toast->setVisible(TRUE);
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::showToastsTop()
{
- LLRect channel_rect = getChannelRect();
-
- LLRect toast_rect;
- S32 top = channel_rect.mTop;
- std::vector<ToastElem>::reverse_iterator it;
-
- updateRect();
-
- LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
-
- // Use a local variable instead of mToastList.
- // mToastList can be modified during recursive calls and then all iteratos will be invalidated.
- std::vector<ToastElem> vToastList( mToastList );
-
- for(it = vToastList.rbegin(); it != vToastList.rend(); ++it)
- {
- if(it != vToastList.rbegin())
- {
- LLToast* toast = (it-1)->getToast();
- if (!toast)
- {
- LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
- return;
- }
-
- top = toast->getRect().mBottom - toast->getTopPad();
- gSavedSettings.getS32("ToastGap");
- }
-
- LLToast* toast = it->getToast();
- if (!toast)
- {
- LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
- return;
- }
-
- toast_rect = toast->getRect();
- toast_rect.setLeftTopAndSize(channel_rect.mRight - toast_rect.getWidth(),
- top, toast_rect.getWidth(),
- toast_rect.getHeight());
- toast->setRect(toast_rect);
-
- if(floater && floater->overlapsScreenChannel())
- {
- if(it == vToastList.rbegin())
- {
- // move first toast above docked floater
- S32 shift = -floater->getRect().getHeight();
- if(floater->getDockControl())
- {
- shift -= floater->getDockControl()->getTongueHeight();
- }
- toast->translate(0, shift);
- }
-
- LLRect channel_rect = getChannelRect();
- // don't show toasts if there is not enough space
- if(toast_rect.mBottom < channel_rect.mBottom)
- {
- break;
- }
- }
-
- bool stop_showing_toasts = toast->getRect().mBottom < channel_rect.mBottom;
-
- if(!stop_showing_toasts)
- {
- if( it != vToastList.rend()-1)
- {
- S32 toast_bottom = toast->getRect().mBottom - gSavedSettings.getS32("ToastGap");
- stop_showing_toasts = toast_bottom < channel_rect.mBottom;
- }
- }
-
- // at least one toast should be visible
- if(it == vToastList.rbegin())
- {
- stop_showing_toasts = false;
- }
-
- if(stop_showing_toasts)
- break;
-
- if (!toast->getVisible())
- {
- // HACK
- // EXT-2653: it is necessary to prevent overlapping for secondary showed toasts
- toast->setVisible(TRUE);
- }
- if (!toast->hasFocus())
- {
- // Fixing Z-order of toasts (EXT-4862)
- // Next toast will be positioned under this one.
- gFloaterView->sendChildToBack(toast);
- }
- }
-
- // Dismiss toasts we don't have space for (STORM-391).
- std::vector<LLToast*> toasts_to_hide;
-
- if(it != vToastList.rend())
- {
- mHiddenToastsNum = 0;
-
- for(; it != vToastList.rend(); it++)
- {
- LLToast* toast = it->getToast();
- if (toast)
- {
- toasts_to_hide.push_back(toast);
- }
- }
- }
-
- for (std::vector<LLToast*>::iterator it = toasts_to_hide.begin(), end_it = toasts_to_hide.end();
- it != end_it;
- ++it)
- {
- (*it)->hide();
- }
+ LLRect channel_rect = getChannelRect();
+
+ LLRect toast_rect;
+ S32 top = channel_rect.mTop;
+ std::vector<ToastElem>::reverse_iterator it;
+
+ updateRect();
+
+ LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
+
+ // Use a local variable instead of mToastList.
+ // mToastList can be modified during recursive calls and then all iteratos will be invalidated.
+ std::vector<ToastElem> vToastList( mToastList );
+
+ for(it = vToastList.rbegin(); it != vToastList.rend(); ++it)
+ {
+ if(it != vToastList.rbegin())
+ {
+ LLToast* toast = (it-1)->getToast();
+ if (!toast)
+ {
+ LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
+ return;
+ }
+
+ top = toast->getRect().mBottom - toast->getTopPad();
+ gSavedSettings.getS32("ToastGap");
+ }
+
+ LLToast* toast = it->getToast();
+ if (!toast)
+ {
+ LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL;
+ return;
+ }
+
+ toast_rect = toast->getRect();
+ toast_rect.setLeftTopAndSize(channel_rect.mRight - toast_rect.getWidth(),
+ top, toast_rect.getWidth(),
+ toast_rect.getHeight());
+ toast->setRect(toast_rect);
+
+ if(floater && floater->overlapsScreenChannel())
+ {
+ if(it == vToastList.rbegin())
+ {
+ // move first toast above docked floater
+ S32 shift = -floater->getRect().getHeight();
+ if(floater->getDockControl())
+ {
+ shift -= floater->getDockControl()->getTongueHeight();
+ }
+ toast->translate(0, shift);
+ }
+
+ LLRect channel_rect = getChannelRect();
+ // don't show toasts if there is not enough space
+ if(toast_rect.mBottom < channel_rect.mBottom)
+ {
+ break;
+ }
+ }
+
+ bool stop_showing_toasts = toast->getRect().mBottom < channel_rect.mBottom;
+
+ if(!stop_showing_toasts)
+ {
+ if( it != vToastList.rend()-1)
+ {
+ S32 toast_bottom = toast->getRect().mBottom - gSavedSettings.getS32("ToastGap");
+ stop_showing_toasts = toast_bottom < channel_rect.mBottom;
+ }
+ }
+
+ // at least one toast should be visible
+ if(it == vToastList.rbegin())
+ {
+ stop_showing_toasts = false;
+ }
+
+ if(stop_showing_toasts)
+ break;
+
+ if (!toast->getVisible())
+ {
+ // HACK
+ // EXT-2653: it is necessary to prevent overlapping for secondary showed toasts
+ toast->setVisible(TRUE);
+ }
+ if (!toast->hasFocus())
+ {
+ // Fixing Z-order of toasts (EXT-4862)
+ // Next toast will be positioned under this one.
+ gFloaterView->sendChildToBack(toast);
+ }
+ }
+
+ // Dismiss toasts we don't have space for (STORM-391).
+ std::vector<LLToast*> toasts_to_hide;
+
+ if(it != vToastList.rend())
+ {
+ mHiddenToastsNum = 0;
+
+ for(; it != vToastList.rend(); it++)
+ {
+ LLToast* toast = it->getToast();
+ if (toast)
+ {
+ toasts_to_hide.push_back(toast);
+ }
+ }
+ }
+
+ for (std::vector<LLToast*>::iterator it = toasts_to_hide.begin(), end_it = toasts_to_hide.end();
+ it != end_it;
+ ++it)
+ {
+ (*it)->hide();
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer)
{
- LLScreenChannelBase::updateRect();
+ LLScreenChannelBase::updateRect();
- LLRect toast_rect;
- LLToast::Params p;
- p.lifetime_secs = timer;
- p.enable_hide_btn = false;
- mStartUpToastPanel = new LLToast(p);
+ LLRect toast_rect;
+ LLToast::Params p;
+ p.lifetime_secs = timer;
+ p.enable_hide_btn = false;
+ mStartUpToastPanel = new LLToast(p);
- if(!mStartUpToastPanel)
- return;
+ if(!mStartUpToastPanel)
+ return;
- mStartUpToastPanel->setOnFadeCallback(boost::bind(&LLScreenChannel::onStartUpToastHide, this));
+ mStartUpToastPanel->setOnFadeCallback(boost::bind(&LLScreenChannel::onStartUpToastHide, this));
- LLPanel* wrapper_panel = mStartUpToastPanel->getChild<LLPanel>("wrapper_panel");
- LLTextBox* text_box = mStartUpToastPanel->getChild<LLTextBox>("toast_text");
+ LLPanel* wrapper_panel = mStartUpToastPanel->getChild<LLPanel>("wrapper_panel");
+ LLTextBox* text_box = mStartUpToastPanel->getChild<LLTextBox>("toast_text");
- std::string text = LLTrans::getString("StartUpNotifications");
+ std::string text = LLTrans::getString("StartUpNotifications");
- toast_rect = mStartUpToastPanel->getRect();
- mStartUpToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true);
+ toast_rect = mStartUpToastPanel->getRect();
+ mStartUpToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true);
- text_box->setValue(text);
- text_box->setVisible(TRUE);
+ text_box->setValue(text);
+ text_box->setVisible(TRUE);
- text_box->reshapeToFitText();
- text_box->setOrigin(text_box->getRect().mLeft, (wrapper_panel->getRect().getHeight() - text_box->getRect().getHeight())/2);
+ text_box->reshapeToFitText();
+ text_box->setOrigin(text_box->getRect().mLeft, (wrapper_panel->getRect().getHeight() - text_box->getRect().getHeight())/2);
- toast_rect.setLeftTopAndSize(0, getRect().getHeight() - gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight());
- mStartUpToastPanel->setRect(toast_rect);
+ toast_rect.setLeftTopAndSize(0, getRect().getHeight() - gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight());
+ mStartUpToastPanel->setRect(toast_rect);
- addChild(mStartUpToastPanel);
-
- mStartUpToastPanel->setVisible(TRUE);
+ addChild(mStartUpToastPanel);
+
+ mStartUpToastPanel->setVisible(TRUE);
}
// static --------------------------------------------------------------------------
F32 LLScreenChannel::getHeightRatio()
{
- F32 ratio = gSavedSettings.getF32("NotificationChannelHeightRatio");
- if(0.0f > ratio)
- {
- ratio = 0.0f;
- }
- else if(1.0f < ratio)
- {
- ratio = 1.0f;
- }
- return ratio;
+ F32 ratio = gSavedSettings.getF32("NotificationChannelHeightRatio");
+ if(0.0f > ratio)
+ {
+ ratio = 0.0f;
+ }
+ else if(1.0f < ratio)
+ {
+ ratio = 1.0f;
+ }
+ return ratio;
}
//--------------------------------------------------------------------------
void LLScreenChannel::updateStartUpString(S32 num)
{
- // *TODO: update string if notifications are arriving while the StartUp toast is on a screen
+ // *TODO: update string if notifications are arriving while the StartUp toast is on a screen
}
//--------------------------------------------------------------------------
void LLScreenChannel::onStartUpToastHide()
{
- onCommit();
+ onCommit();
}
//--------------------------------------------------------------------------
void LLScreenChannel::closeStartUpToast()
{
- if(mStartUpToastPanel != NULL)
- {
- mStartUpToastPanel->setVisible(FALSE);
- mStartUpToastPanel = NULL;
- }
+ if(mStartUpToastPanel != NULL)
+ {
+ mStartUpToastPanel->setVisible(FALSE);
+ mStartUpToastPanel = NULL;
+ }
}
void LLNotificationsUI::LLScreenChannel::stopToastTimer(LLToast* toast)
{
- if (!toast || toast != mHoveredToast) return;
+ if (!toast || toast != mHoveredToast) return;
- // Pause fade timer of the hovered toast.
- toast->stopTimer();
+ // Pause fade timer of the hovered toast.
+ toast->stopTimer();
}
void LLNotificationsUI::LLScreenChannel::startToastTimer(LLToast* toast)
{
- if (!toast || toast == mHoveredToast)
- {
- return;
- }
+ if (!toast || toast == mHoveredToast)
+ {
+ return;
+ }
- // Reset its fade timer.
- toast->startTimer();
+ // Reset its fade timer.
+ toast->startTimer();
}
//--------------------------------------------------------------------------
void LLScreenChannel::hideToastsFromScreen()
{
- for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++)
- {
- LLToast* toast = it->getToast();
- if (toast)
- {
- toast->setVisible(FALSE);
- }
- else
- {
- LL_WARNS() << "Attempt to hide a deleted toast." << LL_ENDL;
- }
- }
+ for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++)
+ {
+ LLToast* toast = it->getToast();
+ if (toast)
+ {
+ toast->setVisible(FALSE);
+ }
+ else
+ {
+ LL_WARNS() << "Attempt to hide a deleted toast." << LL_ENDL;
+ }
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::hideToast(const LLUUID& notification_id)
{
- std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), notification_id);
- if(mToastList.end() != it)
- {
- LLToast* toast = it->getToast();
- if (toast)
- {
- toast->hide();
- }
- else
- {
- LL_WARNS() << "Attempt to hide a deleted toast." << LL_ENDL;
- }
- }
+ std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), notification_id);
+ if(mToastList.end() != it)
+ {
+ LLToast* toast = it->getToast();
+ if (toast)
+ {
+ toast->hide();
+ }
+ else
+ {
+ LL_WARNS() << "Attempt to hide a deleted toast." << LL_ENDL;
+ }
+ }
}
void LLScreenChannel::closeHiddenToasts(const Matcher& matcher)
{
- // since we can't guarantee that close toast operation doesn't change mToastList
- // we collect matched toasts that should be closed into separate list
- std::list<LLToast*> toasts;
- for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
- != mToastList.end(); it++)
- {
- LLToast* toast = it->getToast();
- // add to list valid toast that match to provided matcher criteria
- if (toast != NULL && !toast->isDead() && toast->getNotification() != NULL
- && !toast->getVisible() && matcher.matches(toast->getNotification()))
- {
- toasts.push_back(toast);
- }
- }
-
- // close collected toasts
- for (std::list<LLToast*>::iterator it = toasts.begin(); it
- != toasts.end(); it++)
- {
- LLToast* toast = *it;
- toast->closeFloater();
- }
+ // since we can't guarantee that close toast operation doesn't change mToastList
+ // we collect matched toasts that should be closed into separate list
+ std::list<LLToast*> toasts;
+ for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
+ != mToastList.end(); it++)
+ {
+ LLToast* toast = it->getToast();
+ // add to list valid toast that match to provided matcher criteria
+ if (toast != NULL && !toast->isDead() && toast->getNotification() != NULL
+ && !toast->getVisible() && matcher.matches(toast->getNotification()))
+ {
+ toasts.push_back(toast);
+ }
+ }
+
+ // close collected toasts
+ for (std::list<LLToast*>::iterator it = toasts.begin(); it
+ != toasts.end(); it++)
+ {
+ LLToast* toast = *it;
+ toast->closeFloater();
+ }
}
//--------------------------------------------------------------------------
void LLScreenChannel::removeToastsFromChannel()
{
- hideToastsFromScreen();
- for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++)
- {
- deleteToast(it->getToast());
- }
- mToastList.clear();
+ hideToastsFromScreen();
+ for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++)
+ {
+ deleteToast(it->getToast());
+ }
+ mToastList.clear();
}
//--------------------------------------------------------------------------
void LLScreenChannel::removeAndStoreAllStorableToasts()
{
- if(mToastList.size() == 0)
- return;
-
- hideToastsFromScreen();
- for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();)
- {
- LLToast* toast = it->getToast();
- if(toast && toast->getCanBeStored())
- {
- storeToast(*it);
- it = mToastList.erase(it);
- }
- else
- {
- ++it;
- }
- }
- redrawToasts();
+ if(mToastList.size() == 0)
+ return;
+
+ hideToastsFromScreen();
+ for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();)
+ {
+ LLToast* toast = it->getToast();
+ if(toast && toast->getCanBeStored())
+ {
+ storeToast(*it);
+ it = mToastList.erase(it);
+ }
+ else
+ {
+ ++it;
+ }
+ }
+ redrawToasts();
}
//--------------------------------------------------------------------------
void LLScreenChannel::removeToastsBySessionID(LLUUID id)
{
- if(mToastList.size() == 0)
- return;
-
- hideToastsFromScreen();
- for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();)
- {
- LLToast* toast = it->getToast();
- if(toast && toast->getSessionID() == id)
- {
- deleteToast(toast);
- it = mToastList.erase(it);
- }
- else
- {
- ++it;
- }
- }
- redrawToasts();
+ if(mToastList.size() == 0)
+ return;
+
+ hideToastsFromScreen();
+ for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();)
+ {
+ LLToast* toast = it->getToast();
+ if(toast && toast->getSessionID() == id)
+ {
+ deleteToast(toast);
+ it = mToastList.erase(it);
+ }
+ else
+ {
+ ++it;
+ }
+ }
+ redrawToasts();
}
//--------------------------------------------------------------------------
void LLScreenChannel::onToastHover(LLToast* toast, bool mouse_enter)
{
- // because of LLViewerWindow::updateUI() that NOT ALWAYS calls onMouseEnter BEFORE onMouseLeave
- // we must check hovering directly to prevent incorrect setting for hovering in a channel
- if (mouse_enter)
- {
- if (toast->isHovered())
- {
- mHoveredToast = toast;
- }
- }
- else if (mHoveredToast != NULL)
- {
- if (!mHoveredToast->isHovered())
- {
- mHoveredToast = NULL;
- }
- }
-
- redrawToasts();
+ // because of LLViewerWindow::updateUI() that NOT ALWAYS calls onMouseEnter BEFORE onMouseLeave
+ // we must check hovering directly to prevent incorrect setting for hovering in a channel
+ if (mouse_enter)
+ {
+ if (toast->isHovered())
+ {
+ mHoveredToast = toast;
+ }
+ }
+ else if (mHoveredToast != NULL)
+ {
+ if (!mHoveredToast->isHovered())
+ {
+ mHoveredToast = NULL;
+ }
+ }
+
+ redrawToasts();
}
//--------------------------------------------------------------------------
void LLScreenChannel::updateShowToastsState()
{
- LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
+ LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
- if(!floater)
- {
- setShowToasts(true);
- return;
- }
+ if(!floater)
+ {
+ setShowToasts(true);
+ return;
+ }
- updateRect();
+ updateRect();
}
//--------------------------------------------------------------------------
LLToast* LLScreenChannel::getToastByNotificationID(LLUUID id)
{
- std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(),
- mStoredToastList.end(), id);
+ std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(),
+ mStoredToastList.end(), id);
- if (it == mStoredToastList.end())
- return NULL;
+ if (it == mStoredToastList.end())
+ return NULL;
- return it->getToast();
+ return it->getToast();
}
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h
index e5f4807ab7..e2c4ffd66c 100644
--- a/indra/newview/llscreenchannel.h
+++ b/indra/newview/llscreenchannel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llscreenchannel.h
* @brief Class implements a channel on a screen in which appropriate toasts may appear.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,111 +37,111 @@ namespace LLNotificationsUI
typedef enum e_notification_toast_alignment
{
- NA_TOP,
- NA_CENTRE,
- NA_BOTTOM,
+ NA_TOP,
+ NA_CENTRE,
+ NA_BOTTOM,
} EToastAlignment;
typedef enum e_channel_alignment
{
- CA_LEFT,
- CA_CENTRE,
- CA_RIGHT,
+ CA_LEFT,
+ CA_CENTRE,
+ CA_RIGHT,
} EChannelAlignment;
class LLScreenChannelBase : public LLUICtrl
{
- friend class LLChannelManager;
+ friend class LLChannelManager;
public:
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Mandatory<LLUUID> id;
- Optional<bool> display_toasts_always;
- Optional<EToastAlignment> toast_align;
- Optional<EChannelAlignment> channel_align;
-
- Params()
- : id("id", LLUUID("")),
- display_toasts_always("display_toasts_always", false),
- toast_align("toast_align", NA_BOTTOM),
- channel_align("channel_align", CA_LEFT)
- {}
- };
-
- LLScreenChannelBase(const Params&);
-
- BOOL postBuild();
-
- void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
-
- // Channel's outfit-functions
- // update channel's size and position in the World View
- virtual void updatePositionAndSize(LLRect rect);
-
- // initialization of channel's shape and position
- virtual void init(S32 channel_left, S32 channel_right);
-
- // kill or modify a toast by its ID
- virtual void killToastByNotificationID(LLUUID id) {};
- virtual void modifyToastNotificationByID(LLUUID id, LLSD data) {};
- virtual void removeToastByNotificationID(LLUUID id){};
-
- // hide all toasts from screen, but not remove them from a channel
- virtual void hideToastsFromScreen() {};
- // removes all toasts from a channel
- virtual void removeToastsFromChannel() {};
-
- // show all toasts in a channel
- virtual void redrawToasts() {};
-
-
- // Channel's behavior-functions
- // set whether a channel will control hovering inside itself or not
- virtual void setControlHovering(bool control) { mControlHovering = control; }
-
-
- bool isHovering();
-
- void setCanStoreToasts(bool store) { mCanStoreToasts = store; }
-
- bool getDisplayToastsAlways() { return mDisplayToastsAlways; }
-
- // get number of hidden notifications from a channel
- S32 getNumberOfHiddenToasts() { return mHiddenToastsNum;}
-
-
- void setShowToasts(bool show) { mShowToasts = show; }
- bool getShowToasts() { return mShowToasts; }
-
- // get toast allignment preset for a channel
- e_notification_toast_alignment getToastAlignment() {return mToastAlignment;}
-
- // get ID of a channel
- LLUUID getChannelID() { return mID; }
- LLHandle<LLScreenChannelBase> getHandle() { return getDerivedHandle<LLScreenChannelBase>(); }
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Mandatory<LLUUID> id;
+ Optional<bool> display_toasts_always;
+ Optional<EToastAlignment> toast_align;
+ Optional<EChannelAlignment> channel_align;
+
+ Params()
+ : id("id", LLUUID("")),
+ display_toasts_always("display_toasts_always", false),
+ toast_align("toast_align", NA_BOTTOM),
+ channel_align("channel_align", CA_LEFT)
+ {}
+ };
+
+ LLScreenChannelBase(const Params&);
+
+ BOOL postBuild();
+
+ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+
+ // Channel's outfit-functions
+ // update channel's size and position in the World View
+ virtual void updatePositionAndSize(LLRect rect);
+
+ // initialization of channel's shape and position
+ virtual void init(S32 channel_left, S32 channel_right);
+
+ // kill or modify a toast by its ID
+ virtual void killToastByNotificationID(LLUUID id) {};
+ virtual void modifyToastNotificationByID(LLUUID id, LLSD data) {};
+ virtual void removeToastByNotificationID(LLUUID id){};
+
+ // hide all toasts from screen, but not remove them from a channel
+ virtual void hideToastsFromScreen() {};
+ // removes all toasts from a channel
+ virtual void removeToastsFromChannel() {};
+
+ // show all toasts in a channel
+ virtual void redrawToasts() {};
+
+
+ // Channel's behavior-functions
+ // set whether a channel will control hovering inside itself or not
+ virtual void setControlHovering(bool control) { mControlHovering = control; }
+
+
+ bool isHovering();
+
+ void setCanStoreToasts(bool store) { mCanStoreToasts = store; }
+
+ bool getDisplayToastsAlways() { return mDisplayToastsAlways; }
+
+ // get number of hidden notifications from a channel
+ S32 getNumberOfHiddenToasts() { return mHiddenToastsNum;}
+
+
+ void setShowToasts(bool show) { mShowToasts = show; }
+ bool getShowToasts() { return mShowToasts; }
+
+ // get toast allignment preset for a channel
+ e_notification_toast_alignment getToastAlignment() {return mToastAlignment;}
+
+ // get ID of a channel
+ LLUUID getChannelID() { return mID; }
+ LLHandle<LLScreenChannelBase> getHandle() { return getDerivedHandle<LLScreenChannelBase>(); }
protected:
- void updateRect();
- LLRect getChannelRect();
-
- // Channel's flags
- bool mControlHovering;
- LLToast* mHoveredToast;
- bool mCanStoreToasts;
- bool mDisplayToastsAlways;
- // controls whether a channel shows toasts or not
- bool mShowToasts;
- //
- EToastAlignment mToastAlignment;
- EChannelAlignment mChannelAlignment;
-
- S32 mHiddenToastsNum;
-
- // channel's ID
- LLUUID mID;
-
- LLView* mFloaterSnapRegion;
- LLView* mChicletRegion;
+ void updateRect();
+ LLRect getChannelRect();
+
+ // Channel's flags
+ bool mControlHovering;
+ LLToast* mHoveredToast;
+ bool mCanStoreToasts;
+ bool mDisplayToastsAlways;
+ // controls whether a channel shows toasts or not
+ bool mShowToasts;
+ //
+ EToastAlignment mToastAlignment;
+ EChannelAlignment mChannelAlignment;
+
+ S32 mHiddenToastsNum;
+
+ // channel's ID
+ LLUUID mID;
+
+ LLView* mFloaterSnapRegion;
+ LLView* mChicletRegion;
};
@@ -150,157 +150,157 @@ protected:
*/
class LLScreenChannel : public LLScreenChannelBase
{
- friend class LLChannelManager;
+ friend class LLChannelManager;
public:
- LLScreenChannel(const Params&);
- virtual ~LLScreenChannel();
-
- class Matcher
- {
- public:
- Matcher(){}
- virtual ~Matcher() {}
- virtual bool matches(const LLNotificationPtr) const = 0;
- };
-
- std::list<const LLToast*> findToasts(const Matcher& matcher);
-
- // Channel's outfit-functions
- // update channel's size and position in the World View
- void updatePositionAndSize(LLRect new_rect);
- // initialization of channel's shape and position
- void init(S32 channel_left, S32 channel_right);
-
- // Operating with toasts
- // add a toast to a channel
- void addToast(const LLToast::Params& p);
- // kill or modify a toast by its ID
- void killToastByNotificationID(LLUUID id);
- void removeToastByNotificationID(LLUUID id);
- void killMatchedToasts(const Matcher& matcher);
- void modifyToastByNotificationID(LLUUID id, LLPanel* panel);
- // hide all toasts from screen, but not remove them from a channel
- void hideToastsFromScreen();
- // hide toast by notification id
- void hideToast(const LLUUID& notification_id);
-
- /**
- * Closes hidden matched toasts from channel.
- */
- void closeHiddenToasts(const Matcher& matcher);
-
- // removes all toasts from a channel
- void removeToastsFromChannel();
- // show all toasts in a channel
- void redrawToasts();
- //
- void loadStoredToastsToChannel();
- // finds a toast among stored by its Notification ID and throws it on a screen to a channel
- void loadStoredToastByNotificationIDToChannel(LLUUID id);
- // removes from channel all toasts that belongs to the certain IM session
- void removeToastsBySessionID(LLUUID id);
- // remove all storable toasts from screen and store them
- void removeAndStoreAllStorableToasts();
- // close the StartUp Toast
- void closeStartUpToast();
-
-
- /** Stop fading given toast */
- virtual void stopToastTimer(LLToast* toast);
-
- /** Start fading given toast */
- virtual void startToastTimer(LLToast* toast);
-
- // get StartUp Toast's state
- static bool getStartUpToastShown() { return mWasStartUpToastShown; }
- // tell all channels that the StartUp toast was shown and allow them showing of toasts
- static void setStartUpToastShown() { mWasStartUpToastShown = true; }
- // let a channel update its ShowToast flag
- void updateShowToastsState();
-
-
- // Channel's other interface functions functions
- // update number of notifications in the StartUp Toast
- void updateStartUpString(S32 num);
-
- LLToast* getToastByNotificationID(LLUUID id);
-
- // Channel's signals
- // signal on storing of faded toasts event
- typedef boost::signals2::signal<void (LLPanel* info_panel, const LLUUID id)> store_toast_signal_t;
- boost::signals2::connection addOnStoreToastCallback(store_toast_signal_t::slot_type cb) { return mOnStoreToast.connect(cb); }
+ LLScreenChannel(const Params&);
+ virtual ~LLScreenChannel();
+
+ class Matcher
+ {
+ public:
+ Matcher(){}
+ virtual ~Matcher() {}
+ virtual bool matches(const LLNotificationPtr) const = 0;
+ };
+
+ std::list<const LLToast*> findToasts(const Matcher& matcher);
+
+ // Channel's outfit-functions
+ // update channel's size and position in the World View
+ void updatePositionAndSize(LLRect new_rect);
+ // initialization of channel's shape and position
+ void init(S32 channel_left, S32 channel_right);
+
+ // Operating with toasts
+ // add a toast to a channel
+ void addToast(const LLToast::Params& p);
+ // kill or modify a toast by its ID
+ void killToastByNotificationID(LLUUID id);
+ void removeToastByNotificationID(LLUUID id);
+ void killMatchedToasts(const Matcher& matcher);
+ void modifyToastByNotificationID(LLUUID id, LLPanel* panel);
+ // hide all toasts from screen, but not remove them from a channel
+ void hideToastsFromScreen();
+ // hide toast by notification id
+ void hideToast(const LLUUID& notification_id);
+
+ /**
+ * Closes hidden matched toasts from channel.
+ */
+ void closeHiddenToasts(const Matcher& matcher);
+
+ // removes all toasts from a channel
+ void removeToastsFromChannel();
+ // show all toasts in a channel
+ void redrawToasts();
+ //
+ void loadStoredToastsToChannel();
+ // finds a toast among stored by its Notification ID and throws it on a screen to a channel
+ void loadStoredToastByNotificationIDToChannel(LLUUID id);
+ // removes from channel all toasts that belongs to the certain IM session
+ void removeToastsBySessionID(LLUUID id);
+ // remove all storable toasts from screen and store them
+ void removeAndStoreAllStorableToasts();
+ // close the StartUp Toast
+ void closeStartUpToast();
+
+
+ /** Stop fading given toast */
+ virtual void stopToastTimer(LLToast* toast);
+
+ /** Start fading given toast */
+ virtual void startToastTimer(LLToast* toast);
+
+ // get StartUp Toast's state
+ static bool getStartUpToastShown() { return mWasStartUpToastShown; }
+ // tell all channels that the StartUp toast was shown and allow them showing of toasts
+ static void setStartUpToastShown() { mWasStartUpToastShown = true; }
+ // let a channel update its ShowToast flag
+ void updateShowToastsState();
+
+
+ // Channel's other interface functions functions
+ // update number of notifications in the StartUp Toast
+ void updateStartUpString(S32 num);
+
+ LLToast* getToastByNotificationID(LLUUID id);
+
+ // Channel's signals
+ // signal on storing of faded toasts event
+ typedef boost::signals2::signal<void (LLPanel* info_panel, const LLUUID id)> store_toast_signal_t;
+ boost::signals2::connection addOnStoreToastCallback(store_toast_signal_t::slot_type cb) { return mOnStoreToast.connect(cb); }
private:
- store_toast_signal_t mOnStoreToast;
-
- class ToastElem
- {
- public:
- ToastElem(const LLHandle<LLToast>& toast) : mToast(toast)
- {
- }
-
- ToastElem(const ToastElem& toast_elem) : mToast(toast_elem.mToast)
- {
- }
-
- LLToast* getToast() const
- {
- return mToast.get();
- }
-
- LLUUID getID() const
- {
- return mToast.isDead() ? LLUUID() : mToast.get()->getNotificationID();
- }
-
- bool operator == (const LLUUID &id_op) const
- {
- return (getID() == id_op);
- }
-
- bool operator == (LLPanel* panel_op) const
- {
- return (mToast.get() == panel_op);
- }
-
- private:
- LLHandle<LLToast> mToast;
- };
-
- // Channel's handlers
- void onToastHover(LLToast* toast, bool mouse_enter);
- void onToastFade(LLToast* toast);
- void onToastDestroyed(LLToast* toast);
- void onStartUpToastHide();
-
- //
- void storeToast(ToastElem& toast_elem);
- // send signal to observers about destroying of a toast, update channel's Hovering state, close the toast
- void deleteToast(LLToast* toast);
-
- // show-functions depending on allignment of toasts
- void showToastsBottom();
- void showToastsCentre();
- void showToastsTop();
-
- // create the StartUp Toast
- void createStartUpToast(S32 notif_num, F32 timer);
-
- /**
- * Notification channel and World View ratio(0.0 - always show 1 notification, 1.0 - max ratio).
- */
- static F32 getHeightRatio();
-
- // Channel's flags
- static bool mWasStartUpToastShown;
-
- // attributes for the StartUp Toast
- LLToast* mStartUpToastPanel;
-
-
- std::vector<ToastElem> mToastList;
- std::vector<ToastElem> mStoredToastList;
+ store_toast_signal_t mOnStoreToast;
+
+ class ToastElem
+ {
+ public:
+ ToastElem(const LLHandle<LLToast>& toast) : mToast(toast)
+ {
+ }
+
+ ToastElem(const ToastElem& toast_elem) : mToast(toast_elem.mToast)
+ {
+ }
+
+ LLToast* getToast() const
+ {
+ return mToast.get();
+ }
+
+ LLUUID getID() const
+ {
+ return mToast.isDead() ? LLUUID() : mToast.get()->getNotificationID();
+ }
+
+ bool operator == (const LLUUID &id_op) const
+ {
+ return (getID() == id_op);
+ }
+
+ bool operator == (LLPanel* panel_op) const
+ {
+ return (mToast.get() == panel_op);
+ }
+
+ private:
+ LLHandle<LLToast> mToast;
+ };
+
+ // Channel's handlers
+ void onToastHover(LLToast* toast, bool mouse_enter);
+ void onToastFade(LLToast* toast);
+ void onToastDestroyed(LLToast* toast);
+ void onStartUpToastHide();
+
+ //
+ void storeToast(ToastElem& toast_elem);
+ // send signal to observers about destroying of a toast, update channel's Hovering state, close the toast
+ void deleteToast(LLToast* toast);
+
+ // show-functions depending on allignment of toasts
+ void showToastsBottom();
+ void showToastsCentre();
+ void showToastsTop();
+
+ // create the StartUp Toast
+ void createStartUpToast(S32 notif_num, F32 timer);
+
+ /**
+ * Notification channel and World View ratio(0.0 - always show 1 notification, 1.0 - max ratio).
+ */
+ static F32 getHeightRatio();
+
+ // Channel's flags
+ static bool mWasStartUpToastShown;
+
+ // attributes for the StartUp Toast
+ LLToast* mStartUpToastPanel;
+
+
+ std::vector<ToastElem> mToastList;
+ std::vector<ToastElem> mStoredToastList;
};
}
diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp
index 693491e7e7..e03f6302e6 100644
--- a/indra/newview/llscripteditor.cpp
+++ b/indra/newview/llscripteditor.cpp
@@ -32,26 +32,26 @@
#include "lllocalcliprect.h"
#include "llviewercontrol.h"
-const S32 UI_TEXTEDITOR_LINE_NUMBER_MARGIN = 32;
+const S32 UI_TEXTEDITOR_LINE_NUMBER_MARGIN = 32;
static LLDefaultChildRegistry::Register<LLScriptEditor> r("script_editor");
LLScriptEditor::Params::Params()
-: show_line_numbers("show_line_numbers", true),
+: show_line_numbers("show_line_numbers", true),
default_font_size("default_font_size", false)
{}
LLScriptEditor::LLScriptEditor(const Params& p)
-: LLTextEditor(p)
-, mShowLineNumbers(p.show_line_numbers),
+: LLTextEditor(p)
+, mShowLineNumbers(p.show_line_numbers),
mUseDefaultFontSize(p.default_font_size)
{
- if (mShowLineNumbers)
- {
- mHPad += UI_TEXTEDITOR_LINE_NUMBER_MARGIN;
- updateRects();
- }
+ if (mShowLineNumbers)
+ {
+ mHPad += UI_TEXTEDITOR_LINE_NUMBER_MARGIN;
+ updateRects();
+ }
}
BOOL LLScriptEditor::postBuild()
@@ -62,171 +62,171 @@ BOOL LLScriptEditor::postBuild()
void LLScriptEditor::draw()
{
- {
- // pad clipping rectangle so that cursor can draw at full width
- // when at left edge of mVisibleTextRect
- LLRect clip_rect(mVisibleTextRect);
- clip_rect.stretch(1);
- LLLocalClipRect clip(clip_rect);
- }
-
- LLTextBase::draw();
- drawLineNumbers();
-
+ {
+ // pad clipping rectangle so that cursor can draw at full width
+ // when at left edge of mVisibleTextRect
+ LLRect clip_rect(mVisibleTextRect);
+ clip_rect.stretch(1);
+ LLLocalClipRect clip(clip_rect);
+ }
+
+ LLTextBase::draw();
+ drawLineNumbers();
+
drawPreeditMarker();
-
- //RN: the decision was made to always show the orange border for keyboard focus but do not put an insertion caret
- // when in readonly mode
- mBorder->setKeyboardFocusHighlight( hasFocus() );// && !mReadOnly);
+
+ //RN: the decision was made to always show the orange border for keyboard focus but do not put an insertion caret
+ // when in readonly mode
+ mBorder->setKeyboardFocusHighlight( hasFocus() );// && !mReadOnly);
}
void LLScriptEditor::drawLineNumbers()
{
- LLGLSUIDefault gls_ui;
- LLRect scrolled_view_rect = getVisibleDocumentRect();
- LLRect content_rect = getVisibleTextRect();
- LLLocalClipRect clip(content_rect);
- S32 first_line = getFirstVisibleLine();
- S32 num_lines = getLineCount();
- if (first_line >= num_lines)
- {
- return;
- }
-
- S32 cursor_line = mLineInfoList[getLineNumFromDocIndex(mCursorPos)].mLineNum;
-
- if (mShowLineNumbers)
- {
- S32 left = 0;
- S32 top = getRect().getHeight();
- S32 bottom = 0;
-
- gl_rect_2d(left, top, UI_TEXTEDITOR_LINE_NUMBER_MARGIN, bottom, mReadOnlyBgColor.get() ); // line number area always read-only
- gl_rect_2d(UI_TEXTEDITOR_LINE_NUMBER_MARGIN, top, UI_TEXTEDITOR_LINE_NUMBER_MARGIN-1, bottom, LLColor4::grey3); // separator
-
- S32 last_line_num = -1;
-
- for (S32 cur_line = first_line; cur_line < num_lines; cur_line++)
- {
- line_info& line = mLineInfoList[cur_line];
-
- if ((line.mRect.mTop - scrolled_view_rect.mBottom) < mVisibleTextRect.mBottom)
- {
- break;
- }
-
- S32 line_bottom = line.mRect.mBottom - scrolled_view_rect.mBottom + mVisibleTextRect.mBottom;
- // draw the line numbers
- if(line.mLineNum != last_line_num && line.mRect.mTop <= scrolled_view_rect.mTop)
- {
- const LLWString ltext = utf8str_to_wstring(llformat("%d", line.mLineNum ));
- BOOL is_cur_line = cursor_line == line.mLineNum;
- const U8 style = is_cur_line ? LLFontGL::BOLD : LLFontGL::NORMAL;
- const LLColor4 fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor;
+ LLGLSUIDefault gls_ui;
+ LLRect scrolled_view_rect = getVisibleDocumentRect();
+ LLRect content_rect = getVisibleTextRect();
+ LLLocalClipRect clip(content_rect);
+ S32 first_line = getFirstVisibleLine();
+ S32 num_lines = getLineCount();
+ if (first_line >= num_lines)
+ {
+ return;
+ }
+
+ S32 cursor_line = mLineInfoList[getLineNumFromDocIndex(mCursorPos)].mLineNum;
+
+ if (mShowLineNumbers)
+ {
+ S32 left = 0;
+ S32 top = getRect().getHeight();
+ S32 bottom = 0;
+
+ gl_rect_2d(left, top, UI_TEXTEDITOR_LINE_NUMBER_MARGIN, bottom, mReadOnlyBgColor.get() ); // line number area always read-only
+ gl_rect_2d(UI_TEXTEDITOR_LINE_NUMBER_MARGIN, top, UI_TEXTEDITOR_LINE_NUMBER_MARGIN-1, bottom, LLColor4::grey3); // separator
+
+ S32 last_line_num = -1;
+
+ for (S32 cur_line = first_line; cur_line < num_lines; cur_line++)
+ {
+ line_info& line = mLineInfoList[cur_line];
+
+ if ((line.mRect.mTop - scrolled_view_rect.mBottom) < mVisibleTextRect.mBottom)
+ {
+ break;
+ }
+
+ S32 line_bottom = line.mRect.mBottom - scrolled_view_rect.mBottom + mVisibleTextRect.mBottom;
+ // draw the line numbers
+ if(line.mLineNum != last_line_num && line.mRect.mTop <= scrolled_view_rect.mTop)
+ {
+ const LLWString ltext = utf8str_to_wstring(llformat("%d", line.mLineNum ));
+ BOOL is_cur_line = cursor_line == line.mLineNum;
+ const U8 style = is_cur_line ? LLFontGL::BOLD : LLFontGL::NORMAL;
+ const LLColor4 fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor;
getScriptFont()->render(
- ltext, // string to draw
- 0, // begin offset
- UI_TEXTEDITOR_LINE_NUMBER_MARGIN - 2, // x
- line_bottom, // y
- fg_color,
- LLFontGL::RIGHT, // horizontal alignment
- LLFontGL::BOTTOM, // vertical alignment
- style,
- LLFontGL::NO_SHADOW,
- S32_MAX, // max chars
- UI_TEXTEDITOR_LINE_NUMBER_MARGIN - 2); // max pixels
- last_line_num = line.mLineNum;
- }
- }
- }
+ ltext, // string to draw
+ 0, // begin offset
+ UI_TEXTEDITOR_LINE_NUMBER_MARGIN - 2, // x
+ line_bottom, // y
+ fg_color,
+ LLFontGL::RIGHT, // horizontal alignment
+ LLFontGL::BOTTOM, // vertical alignment
+ style,
+ LLFontGL::NO_SHADOW,
+ S32_MAX, // max chars
+ UI_TEXTEDITOR_LINE_NUMBER_MARGIN - 2); // max pixels
+ last_line_num = line.mLineNum;
+ }
+ }
+ }
}
void LLScriptEditor::initKeywords()
{
- mKeywords.initialize(LLSyntaxIdLSL::getInstance()->getKeywordsXML());
+ mKeywords.initialize(LLSyntaxIdLSL::getInstance()->getKeywordsXML());
}
void LLScriptEditor::loadKeywords()
{
LL_PROFILE_ZONE_SCOPED;
- mKeywords.processTokens();
-
+ mKeywords.processTokens();
+
LLStyleConstSP style = new LLStyle(LLStyle::Params().font(getScriptFont()).color(mDefaultColor.get()));
- segment_vec_t segment_list;
+ segment_vec_t segment_list;
mKeywords.findSegments(&segment_list, getWText(), *this, style);
-
- mSegments.clear();
- segment_set_t::iterator insert_it = mSegments.begin();
- for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
- {
- insert_it = mSegments.insert(insert_it, *list_it);
- }
+
+ mSegments.clear();
+ segment_set_t::iterator insert_it = mSegments.begin();
+ for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
+ {
+ insert_it = mSegments.insert(insert_it, *list_it);
+ }
}
void LLScriptEditor::updateSegments()
{
- if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly)
- {
+ if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly)
+ {
LL_PROFILE_ZONE_SCOPED;
LLStyleConstSP style = new LLStyle(LLStyle::Params().font(getScriptFont()).color(mDefaultColor.get()));
- // HACK: No non-ascii keywords for now
- segment_vec_t segment_list;
+ // HACK: No non-ascii keywords for now
+ segment_vec_t segment_list;
mKeywords.findSegments(&segment_list, getWText(), *this, style);
-
- clearSegments();
- for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
- {
- insertSegment(*list_it);
- }
- }
-
- LLTextBase::updateSegments();
+
+ clearSegments();
+ for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
+ {
+ insertSegment(*list_it);
+ }
+ }
+
+ LLTextBase::updateSegments();
}
void LLScriptEditor::clearSegments()
{
- if (!mSegments.empty())
- {
- mSegments.clear();
- }
+ if (!mSegments.empty())
+ {
+ mSegments.clear();
+ }
}
// Most of this is shamelessly copied from LLTextBase
void LLScriptEditor::drawSelectionBackground()
{
- // Draw selection even if we don't have keyboard focus for search/replace
- if( hasSelection() && !mLineInfoList.empty())
- {
+ // Draw selection even if we don't have keyboard focus for search/replace
+ if( hasSelection() && !mLineInfoList.empty())
+ {
std::vector<LLRect> selection_rects = getSelectionRects();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- const LLColor4& color = mReadOnly ? mReadOnlyFgColor : mFgColor;
- F32 alpha = hasFocus() ? 0.7f : 0.3f;
- alpha *= getDrawContext().mAlpha;
- // We want to shift the color to something readable but distinct
- LLColor4 selection_color((1.f + color.mV[VRED]) * 0.5f,
- (1.f + color.mV[VGREEN]) * 0.5f,
- (1.f + color.mV[VBLUE]) * 0.5f,
- alpha);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ const LLColor4& color = mReadOnly ? mReadOnlyFgColor : mFgColor;
+ F32 alpha = hasFocus() ? 0.7f : 0.3f;
+ alpha *= getDrawContext().mAlpha;
+ // We want to shift the color to something readable but distinct
+ LLColor4 selection_color((1.f + color.mV[VRED]) * 0.5f,
+ (1.f + color.mV[VGREEN]) * 0.5f,
+ (1.f + color.mV[VBLUE]) * 0.5f,
+ alpha);
LLRect content_display_rect = getVisibleDocumentRect();
-
- for (std::vector<LLRect>::iterator rect_it = selection_rects.begin();
- rect_it != selection_rects.end();
- ++rect_it)
- {
- LLRect selection_rect = *rect_it;
- selection_rect = *rect_it;
- selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom);
- gl_rect_2d(selection_rect, selection_color);
- }
- }
+
+ for (std::vector<LLRect>::iterator rect_it = selection_rects.begin();
+ rect_it != selection_rects.end();
+ ++rect_it)
+ {
+ LLRect selection_rect = *rect_it;
+ selection_rect = *rect_it;
+ selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom);
+ gl_rect_2d(selection_rect, selection_color);
+ }
+ }
}
std::string LLScriptEditor::getScriptFontSize()
-{
+{
static LLCachedControl<std::string> size_name(gSavedSettings, "LSLFontSizeName", "Monospace");
return size_name;
}
@@ -237,7 +237,7 @@ LLFontGL* LLScriptEditor::getScriptFont()
return LLFontGL::getFont(LLFontDescriptor("Monospace", font_size_name, 0));
}
-void LLScriptEditor::onFontSizeChange()
+void LLScriptEditor::onFontSizeChange()
{
if (!mUseDefaultFontSize)
{
diff --git a/indra/newview/llscripteditor.h b/indra/newview/llscripteditor.h
index ef941f552a..19caa277d9 100644
--- a/indra/newview/llscripteditor.h
+++ b/indra/newview/llscripteditor.h
@@ -33,43 +33,43 @@
class LLScriptEditor : public LLTextEditor
{
public:
-
- struct Params : public LLInitParam::Block<Params, LLTextEditor::Params>
- {
- Optional<bool> show_line_numbers;
+
+ struct Params : public LLInitParam::Block<Params, LLTextEditor::Params>
+ {
+ Optional<bool> show_line_numbers;
Optional<bool> default_font_size;
- Params();
- };
-
- virtual ~LLScriptEditor() {};
-
- // LLView override
- virtual void draw();
+ Params();
+ };
+
+ virtual ~LLScriptEditor() {};
+
+ // LLView override
+ virtual void draw();
BOOL postBuild();
-
- void initKeywords();
- void loadKeywords();
- /* virtual */ void clearSegments();
- LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); }
- LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); }
-
+
+ void initKeywords();
+ void loadKeywords();
+ /* virtual */ void clearSegments();
+ LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); }
+ LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); }
+
static std::string getScriptFontSize();
LLFontGL* getScriptFont();
void onFontSizeChange();
protected:
- friend class LLUICtrlFactory;
- LLScriptEditor(const Params& p);
-
+ friend class LLUICtrlFactory;
+ LLScriptEditor(const Params& p);
+
private:
- void drawLineNumbers();
- /* virtual */ void updateSegments();
- /* virtual */ void drawSelectionBackground();
- void loadKeywords(const std::string& filename_keywords,
- const std::string& filename_colors);
-
- LLKeywords mKeywords;
- bool mShowLineNumbers;
+ void drawLineNumbers();
+ /* virtual */ void updateSegments();
+ /* virtual */ void drawSelectionBackground();
+ void loadKeywords(const std::string& filename_keywords,
+ const std::string& filename_colors);
+
+ LLKeywords mKeywords;
+ bool mShowLineNumbers;
bool mUseDefaultFontSize;
};
diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp
index 6a27ff3047..cf65049b99 100644
--- a/indra/newview/llscriptfloater.cpp
+++ b/indra/newview/llscriptfloater.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llscriptfloater.cpp
* @brief LLScriptFloater class definition
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,12 +50,12 @@
LLUUID notification_id_to_object_id(const LLUUID& notification_id)
{
- LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
- if(notification)
- {
- return notification->getPayload()["object_id"].asUUID();
- }
- return LLUUID::null;
+ LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
+ if(notification)
+ {
+ return notification->getPayload()["object_id"].asUUID();
+ }
+ return LLUUID::null;
}
//////////////////////////////////////////////////////////////////////////
@@ -68,280 +68,280 @@ LLScriptFloater::LLScriptFloater(const LLSD& key)
, mScriptForm(NULL)
, mSaveFloaterPosition(false)
{
- setMouseDownCallback(boost::bind(&LLScriptFloater::onMouseDown, this));
- setOverlapsScreenChannel(true);
- mIsDockedStateForcedCallback = boost::bind(&LLAgentCamera::cameraMouselook, &gAgentCamera);
+ setMouseDownCallback(boost::bind(&LLScriptFloater::onMouseDown, this));
+ setOverlapsScreenChannel(true);
+ mIsDockedStateForcedCallback = boost::bind(&LLAgentCamera::cameraMouselook, &gAgentCamera);
}
bool LLScriptFloater::toggle(const LLUUID& notification_id)
{
- LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", notification_id);
-
- // show existing floater
- if(floater)
- {
- if(floater->getVisible())
- {
- floater->setVisible(false);
- return false;
- }
- else
- {
- floater->setVisible(TRUE);
- floater->setFocus(FALSE);
- }
- }
- // create and show new floater
- else
- {
- show(notification_id);
- }
-
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- chiclet_panelp->setChicletToggleState(notification_id, true);
- }
-
- return true;
+ LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", notification_id);
+
+ // show existing floater
+ if(floater)
+ {
+ if(floater->getVisible())
+ {
+ floater->setVisible(false);
+ return false;
+ }
+ else
+ {
+ floater->setVisible(TRUE);
+ floater->setFocus(FALSE);
+ }
+ }
+ // create and show new floater
+ else
+ {
+ show(notification_id);
+ }
+
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ chiclet_panelp->setChicletToggleState(notification_id, true);
+ }
+
+ return true;
}
LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id)
{
- LLScriptFloater* floater = LLFloaterReg::getTypedInstance<LLScriptFloater>("script_floater", notification_id);
- floater->setNotificationId(notification_id);
- floater->createForm(notification_id);
+ LLScriptFloater* floater = LLFloaterReg::getTypedInstance<LLScriptFloater>("script_floater", notification_id);
+ floater->setNotificationId(notification_id);
+ floater->createForm(notification_id);
- //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445)
- floater->setAutoFocus(FALSE);
+ //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445)
+ floater->setAutoFocus(FALSE);
- if(LLScriptFloaterManager::OBJ_SCRIPT == LLScriptFloaterManager::getObjectType(notification_id))
- {
- floater->setSavePosition(true);
- floater->restorePosition();
- }
- else
- {
- floater->dockToChiclet(true);
- }
+ if(LLScriptFloaterManager::OBJ_SCRIPT == LLScriptFloaterManager::getObjectType(notification_id))
+ {
+ floater->setSavePosition(true);
+ floater->restorePosition();
+ }
+ else
+ {
+ floater->dockToChiclet(true);
+ }
- //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445)
- LLFloaterReg::showTypedInstance<LLScriptFloater>("script_floater", notification_id, FALSE);
+ //LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445)
+ LLFloaterReg::showTypedInstance<LLScriptFloater>("script_floater", notification_id, FALSE);
- return floater;
+ return floater;
}
void LLScriptFloater::setNotificationId(const LLUUID& id)
{
- mNotificationId = id;
- // Lets save object id now while notification exists
- mObjectId = notification_id_to_object_id(id);
+ mNotificationId = id;
+ // Lets save object id now while notification exists
+ mObjectId = notification_id_to_object_id(id);
}
void LLScriptFloater::createForm(const LLUUID& notification_id)
{
- // delete old form
- if(mScriptForm)
- {
- removeChild(mScriptForm);
- mScriptForm->die();
- }
-
- LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
- if(NULL == notification)
- {
- return;
- }
-
- // create new form
- LLRect toast_rect = getRect();
- if (isScriptTextbox(notification))
- {
- mScriptForm = new LLToastScriptTextbox(notification);
- }
- else
- {
- // LLToastNotifyPanel will fit own content in vertical direction,
- // but it needs an initial rect to properly calculate its width
- // Use an initial rect of the script floater to make the floater
- // window more configurable.
- mScriptForm = new LLToastNotifyPanel(notification, toast_rect);
- }
- addChild(mScriptForm);
-
- // position form on floater
- mScriptForm->setOrigin(0, 0);
-
- // make floater size fit form size
- LLRect panel_rect = mScriptForm->getRect();
- toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop, panel_rect.getWidth(), panel_rect.getHeight() + getHeaderHeight());
- setShape(toast_rect);
+ // delete old form
+ if(mScriptForm)
+ {
+ removeChild(mScriptForm);
+ mScriptForm->die();
+ }
+
+ LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
+ if(NULL == notification)
+ {
+ return;
+ }
+
+ // create new form
+ LLRect toast_rect = getRect();
+ if (isScriptTextbox(notification))
+ {
+ mScriptForm = new LLToastScriptTextbox(notification);
+ }
+ else
+ {
+ // LLToastNotifyPanel will fit own content in vertical direction,
+ // but it needs an initial rect to properly calculate its width
+ // Use an initial rect of the script floater to make the floater
+ // window more configurable.
+ mScriptForm = new LLToastNotifyPanel(notification, toast_rect);
+ }
+ addChild(mScriptForm);
+
+ // position form on floater
+ mScriptForm->setOrigin(0, 0);
+
+ // make floater size fit form size
+ LLRect panel_rect = mScriptForm->getRect();
+ toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop, panel_rect.getWidth(), panel_rect.getHeight() + getHeaderHeight());
+ setShape(toast_rect);
}
void LLScriptFloater::onClose(bool app_quitting)
{
- savePosition();
+ savePosition();
- if(getNotificationId().notNull())
- {
- // we shouldn't kill notification on exit since it may be used as persistent.
- if (app_quitting)
- {
- LLScriptFloaterManager::getInstance()->onRemoveNotification(getNotificationId());
- }
- else
- {
- LLScriptFloaterManager::getInstance()->removeNotification(getNotificationId());
- }
- }
+ if(getNotificationId().notNull())
+ {
+ // we shouldn't kill notification on exit since it may be used as persistent.
+ if (app_quitting)
+ {
+ LLScriptFloaterManager::getInstance()->onRemoveNotification(getNotificationId());
+ }
+ else
+ {
+ LLScriptFloaterManager::getInstance()->removeNotification(getNotificationId());
+ }
+ }
}
void LLScriptFloater::setDocked(bool docked, bool pop_on_undock /* = true */)
{
- LLDockableFloater::setDocked(docked, pop_on_undock);
+ LLDockableFloater::setDocked(docked, pop_on_undock);
- savePosition();
+ savePosition();
- hideToastsIfNeeded();
+ hideToastsIfNeeded();
}
void LLScriptFloater::setVisible(BOOL visible)
{
- LLDockableFloater::setVisible(visible);
+ LLDockableFloater::setVisible(visible);
- hideToastsIfNeeded();
+ hideToastsIfNeeded();
- if(!visible)
- {
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(getNotificationId());
- if(NULL != chicletp)
- {
- chicletp->setToggleState(false);
- }
- }
- }
+ if(!visible)
+ {
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(getNotificationId());
+ if(NULL != chicletp)
+ {
+ chicletp->setToggleState(false);
+ }
+ }
+ }
}
void LLScriptFloater::onMouseDown()
{
- if(getNotificationId().notNull())
- {
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(getNotificationId());
- // Remove new message icon
- if (NULL == chicletp)
- {
- LL_ERRS() << "Dock chiclet for LLScriptFloater doesn't exist" << LL_ENDL;
- }
- else
- {
- chicletp->setShowNewMessagesIcon(false);
- }
- }
- }
+ if(getNotificationId().notNull())
+ {
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(getNotificationId());
+ // Remove new message icon
+ if (NULL == chicletp)
+ {
+ LL_ERRS() << "Dock chiclet for LLScriptFloater doesn't exist" << LL_ENDL;
+ }
+ else
+ {
+ chicletp->setShowNewMessagesIcon(false);
+ }
+ }
+ }
}
void LLScriptFloater::savePosition()
{
- if(getSavePosition() && mObjectId.notNull())
- {
- LLScriptFloaterManager::FloaterPositionInfo fpi = {getRect(), isDocked()};
- LLScriptFloaterManager::getInstance()->saveFloaterPosition(mObjectId, fpi);
- }
+ if(getSavePosition() && mObjectId.notNull())
+ {
+ LLScriptFloaterManager::FloaterPositionInfo fpi = {getRect(), isDocked()};
+ LLScriptFloaterManager::getInstance()->saveFloaterPosition(mObjectId, fpi);
+ }
}
void LLScriptFloater::restorePosition()
{
- LLScriptFloaterManager::FloaterPositionInfo fpi;
- if(LLScriptFloaterManager::getInstance()->getFloaterPosition(mObjectId, fpi))
- {
- dockToChiclet(fpi.mDockState);
- if(!fpi.mDockState)
- {
- // Un-docked floater is opened in 0,0, now move it to saved position
- translate(fpi.mRect.mLeft - getRect().mLeft, fpi.mRect.mTop - getRect().mTop);
- }
- }
- else
- {
- dockToChiclet(true);
- }
+ LLScriptFloaterManager::FloaterPositionInfo fpi;
+ if(LLScriptFloaterManager::getInstance()->getFloaterPosition(mObjectId, fpi))
+ {
+ dockToChiclet(fpi.mDockState);
+ if(!fpi.mDockState)
+ {
+ // Un-docked floater is opened in 0,0, now move it to saved position
+ translate(fpi.mRect.mLeft - getRect().mLeft, fpi.mRect.mTop - getRect().mTop);
+ }
+ }
+ else
+ {
+ dockToChiclet(true);
+ }
}
void LLScriptFloater::onFocusLost()
{
- if(getNotificationId().notNull())
- {
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- chiclet_panelp->setChicletToggleState(getNotificationId(), false);
- }
- }
+ if(getNotificationId().notNull())
+ {
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ chiclet_panelp->setChicletToggleState(getNotificationId(), false);
+ }
+ }
}
void LLScriptFloater::onFocusReceived()
{
- // first focus will be received before setObjectId() call - don't toggle chiclet
- if(getNotificationId().notNull())
- {
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- chiclet_panelp->setChicletToggleState(getNotificationId(), true);
- }
- }
+ // first focus will be received before setObjectId() call - don't toggle chiclet
+ if(getNotificationId().notNull())
+ {
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ chiclet_panelp->setChicletToggleState(getNotificationId(), true);
+ }
+ }
}
void LLScriptFloater::dockToChiclet(bool dock)
{
- if (getDockControl() == NULL)
- {
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- LLChiclet * chicletp = chiclet_panelp->findChiclet<LLChiclet>(getNotificationId());
- if (NULL == chicletp)
- {
- LL_WARNS() << "Dock chiclet for LLScriptFloater doesn't exist" << LL_ENDL;
- return;
- }
+ if (getDockControl() == NULL)
+ {
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ LLChiclet * chicletp = chiclet_panelp->findChiclet<LLChiclet>(getNotificationId());
+ if (NULL == chicletp)
+ {
+ LL_WARNS() << "Dock chiclet for LLScriptFloater doesn't exist" << LL_ENDL;
+ return;
+ }
- chiclet_panelp->scrollToChiclet(chicletp);
+ chiclet_panelp->scrollToChiclet(chicletp);
- // Stop saving position while we dock floater
- bool save = getSavePosition();
- setSavePosition(false);
+ // Stop saving position while we dock floater
+ bool save = getSavePosition();
+ setSavePosition(false);
- setDockControl(new LLDockControl(chicletp, this, getDockTongue(),
- LLDockControl::BOTTOM));
+ setDockControl(new LLDockControl(chicletp, this, getDockTongue(),
+ LLDockControl::BOTTOM));
- setDocked(dock);
+ setDocked(dock);
- // Restore saving
- setSavePosition(save);
- }
- }
+ // Restore saving
+ setSavePosition(save);
+ }
+ }
}
void LLScriptFloater::hideToastsIfNeeded()
{
- using namespace LLNotificationsUI;
+ using namespace LLNotificationsUI;
- // find channel
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(LLChannelManager::getInstance()->findChannelByID(
- LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
- // update notification channel state
- if(channel)
- {
- channel->updateShowToastsState();
- channel->redrawToasts();
- }
+ // find channel
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(LLChannelManager::getInstance()->findChannelByID(
+ LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
+ // update notification channel state
+ if(channel)
+ {
+ channel->updateShowToastsState();
+ channel->redrawToasts();
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -349,430 +349,430 @@ void LLScriptFloater::hideToastsIfNeeded()
//////////////////////////////////////////////////////////////////////////
LLScriptFloaterManager::LLScriptFloaterManager()
- : mDialogLimitationsSlot()
+ : mDialogLimitationsSlot()
{
}
void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id)
{
- if(notification_id.isNull())
- {
- LL_WARNS() << "Invalid notification ID" << LL_ENDL;
- return;
- }
-
- if (!mDialogLimitationsSlot.connected())
- {
- LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl("ScriptDialogLimitations");
- if (cntrl_ptr.notNull())
- {
- mDialogLimitationsSlot = cntrl_ptr->getCommitSignal()->connect(boost::bind(&clearScriptNotifications));
- }
- else
- {
- LL_WARNS() << "Unable to set signal on setting 'ScriptDialogLimitations'" << LL_ENDL;
- }
- }
-
- // get scripted Object's ID
- LLUUID object_id = notification_id_to_object_id(notification_id);
-
- // Need to indicate of "new message" for object chiclets according to requirements
- // specified in the Message Bar design specification. See EXT-3142.
- bool set_new_message = false;
- EObjectType obj_type = getObjectType(notification_id);
-
- // LLDialog can spawn only one instance, LLLoadURL and LLGiveInventory can spawn unlimited number of instances
- if(OBJ_SCRIPT == obj_type)
- {
- static LLCachedControl<U32> script_dialog_limitations(gSavedSettings, "ScriptDialogLimitations", 0);
- script_notification_map_t::const_iterator it = mNotifications.end();
- switch (script_dialog_limitations)
- {
- case SCRIPT_PER_CHANNEL:
- {
- // If an Object spawns more-than-one floater per channel, only the newest one is shown.
- // The previous is automatically closed.
- LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
- if (notification)
- {
- it = findUsingObjectIdAndChannel(object_id, notification->getPayload()["chat_channel"].asInteger());
- }
- break;
- }
- case SCRIPT_ATTACHMENT_PER_CHANNEL:
- {
- LLViewerObject* objectp = gObjectList.findObject(object_id);
- if (objectp && objectp->getAttachmentItemID().notNull()) //in user inventory
- {
- LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
- if (notification)
- {
- it = findUsingObjectIdAndChannel(object_id, notification->getPayload()["chat_channel"].asInteger());
- }
- }
- else
- {
- it = findUsingObjectId(object_id);
- }
- break;
- }
- case SCRIPT_HUD_PER_CHANNEL:
- {
- LLViewerObject* objectp = gObjectList.findObject(object_id);
- if (objectp && objectp->isHUDAttachment())
- {
- LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
- if (notification)
- {
- it = findUsingObjectIdAndChannel(object_id, notification->getPayload()["chat_channel"].asInteger());
- }
- }
- else
- {
- it = findUsingObjectId(object_id);
- }
- break;
- }
- case SCRIPT_HUD_UNCONSTRAINED:
- {
- LLViewerObject* objectp = gObjectList.findObject(object_id);
- if (objectp && objectp->isHUDAttachment())
- {
- // don't remove existing floaters
- break;
- }
- else
- {
- it = findUsingObjectId(object_id);
- }
- break;
- }
- case SCRIPT_PER_OBJECT:
- default:
- {
- // If an Object spawns more-than-one floater, only the newest one is shown.
- // The previous is automatically closed.
- it = findUsingObjectId(object_id);
- break;
- }
- }
-
- if(it != mNotifications.end())
- {
- LLUUID old_id = it->first; // copy LLUUID to prevent use after free when it is erased below
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(old_id);
- if (NULL != chicletp)
- {
- // Pass the new_message icon state further.
- set_new_message = chicletp->getShowNewMessagesIcon();
- chicletp->hidePopupMenu();
- }
- }
-
- LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", old_id);
- if (floater)
- {
- // Generate chiclet with a "new message" indicator if a docked window was opened but not in focus. See EXT-3142.
- set_new_message |= !floater->hasFocus();
- }
-
- removeNotification(old_id);
- }
- }
-
- mNotifications.insert(std::make_pair(notification_id, object_id));
-
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- // Create inventory offer chiclet for offer type notifications
- if( OBJ_GIVE_INVENTORY == obj_type )
- {
- chiclet_panelp->createChiclet<LLInvOfferChiclet>(notification_id);
- }
- else
- {
- chiclet_panelp->createChiclet<LLScriptChiclet>(notification_id);
- }
- }
-
- LLIMWellWindow::getInstance()->addObjectRow(notification_id, set_new_message);
-
- LLSD data;
- data["notification_id"] = notification_id;
- data["new_message"] = set_new_message;
- data["unread"] = 1; // each object has got only one floater
- mNewObjectSignal(data);
-
- toggleScriptFloater(notification_id, set_new_message);
+ if(notification_id.isNull())
+ {
+ LL_WARNS() << "Invalid notification ID" << LL_ENDL;
+ return;
+ }
+
+ if (!mDialogLimitationsSlot.connected())
+ {
+ LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl("ScriptDialogLimitations");
+ if (cntrl_ptr.notNull())
+ {
+ mDialogLimitationsSlot = cntrl_ptr->getCommitSignal()->connect(boost::bind(&clearScriptNotifications));
+ }
+ else
+ {
+ LL_WARNS() << "Unable to set signal on setting 'ScriptDialogLimitations'" << LL_ENDL;
+ }
+ }
+
+ // get scripted Object's ID
+ LLUUID object_id = notification_id_to_object_id(notification_id);
+
+ // Need to indicate of "new message" for object chiclets according to requirements
+ // specified in the Message Bar design specification. See EXT-3142.
+ bool set_new_message = false;
+ EObjectType obj_type = getObjectType(notification_id);
+
+ // LLDialog can spawn only one instance, LLLoadURL and LLGiveInventory can spawn unlimited number of instances
+ if(OBJ_SCRIPT == obj_type)
+ {
+ static LLCachedControl<U32> script_dialog_limitations(gSavedSettings, "ScriptDialogLimitations", 0);
+ script_notification_map_t::const_iterator it = mNotifications.end();
+ switch (script_dialog_limitations)
+ {
+ case SCRIPT_PER_CHANNEL:
+ {
+ // If an Object spawns more-than-one floater per channel, only the newest one is shown.
+ // The previous is automatically closed.
+ LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
+ if (notification)
+ {
+ it = findUsingObjectIdAndChannel(object_id, notification->getPayload()["chat_channel"].asInteger());
+ }
+ break;
+ }
+ case SCRIPT_ATTACHMENT_PER_CHANNEL:
+ {
+ LLViewerObject* objectp = gObjectList.findObject(object_id);
+ if (objectp && objectp->getAttachmentItemID().notNull()) //in user inventory
+ {
+ LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
+ if (notification)
+ {
+ it = findUsingObjectIdAndChannel(object_id, notification->getPayload()["chat_channel"].asInteger());
+ }
+ }
+ else
+ {
+ it = findUsingObjectId(object_id);
+ }
+ break;
+ }
+ case SCRIPT_HUD_PER_CHANNEL:
+ {
+ LLViewerObject* objectp = gObjectList.findObject(object_id);
+ if (objectp && objectp->isHUDAttachment())
+ {
+ LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
+ if (notification)
+ {
+ it = findUsingObjectIdAndChannel(object_id, notification->getPayload()["chat_channel"].asInteger());
+ }
+ }
+ else
+ {
+ it = findUsingObjectId(object_id);
+ }
+ break;
+ }
+ case SCRIPT_HUD_UNCONSTRAINED:
+ {
+ LLViewerObject* objectp = gObjectList.findObject(object_id);
+ if (objectp && objectp->isHUDAttachment())
+ {
+ // don't remove existing floaters
+ break;
+ }
+ else
+ {
+ it = findUsingObjectId(object_id);
+ }
+ break;
+ }
+ case SCRIPT_PER_OBJECT:
+ default:
+ {
+ // If an Object spawns more-than-one floater, only the newest one is shown.
+ // The previous is automatically closed.
+ it = findUsingObjectId(object_id);
+ break;
+ }
+ }
+
+ if(it != mNotifications.end())
+ {
+ LLUUID old_id = it->first; // copy LLUUID to prevent use after free when it is erased below
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(old_id);
+ if (NULL != chicletp)
+ {
+ // Pass the new_message icon state further.
+ set_new_message = chicletp->getShowNewMessagesIcon();
+ chicletp->hidePopupMenu();
+ }
+ }
+
+ LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", old_id);
+ if (floater)
+ {
+ // Generate chiclet with a "new message" indicator if a docked window was opened but not in focus. See EXT-3142.
+ set_new_message |= !floater->hasFocus();
+ }
+
+ removeNotification(old_id);
+ }
+ }
+
+ mNotifications.insert(std::make_pair(notification_id, object_id));
+
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ // Create inventory offer chiclet for offer type notifications
+ if( OBJ_GIVE_INVENTORY == obj_type )
+ {
+ chiclet_panelp->createChiclet<LLInvOfferChiclet>(notification_id);
+ }
+ else
+ {
+ chiclet_panelp->createChiclet<LLScriptChiclet>(notification_id);
+ }
+ }
+
+ LLIMWellWindow::getInstance()->addObjectRow(notification_id, set_new_message);
+
+ LLSD data;
+ data["notification_id"] = notification_id;
+ data["new_message"] = set_new_message;
+ data["unread"] = 1; // each object has got only one floater
+ mNewObjectSignal(data);
+
+ toggleScriptFloater(notification_id, set_new_message);
}
void LLScriptFloaterManager::removeNotification(const LLUUID& notification_id)
{
- LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
- if (notification != NULL && !notification->isCancelled())
- {
- LLNotificationsUtil::cancel(notification);
- }
+ LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
+ if (notification != NULL && !notification->isCancelled())
+ {
+ LLNotificationsUtil::cancel(notification);
+ }
- onRemoveNotification(notification_id);
+ onRemoveNotification(notification_id);
}
void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id)
{
- if(notification_id.isNull())
- {
- LL_WARNS() << "Invalid notification ID" << LL_ENDL;
- return;
- }
-
- // remove related chiclet
- if (LLChicletBar::instanceExists())
- {
- LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
- if (NULL != chiclet_panelp)
- {
- chiclet_panelp->removeChiclet(notification_id);
- }
- }
-
- LLIMWellWindow* im_well_window = LLIMWellWindow::findInstance();
- if (im_well_window)
- {
- im_well_window->removeObjectRow(notification_id);
- }
-
- mNotifications.erase(notification_id);
-
- // close floater
- LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", notification_id);
- if(floater)
- {
- floater->savePosition();
- floater->setNotificationId(LLUUID::null);
- floater->closeFloater();
- }
+ if(notification_id.isNull())
+ {
+ LL_WARNS() << "Invalid notification ID" << LL_ENDL;
+ return;
+ }
+
+ // remove related chiclet
+ if (LLChicletBar::instanceExists())
+ {
+ LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel();
+ if (NULL != chiclet_panelp)
+ {
+ chiclet_panelp->removeChiclet(notification_id);
+ }
+ }
+
+ LLIMWellWindow* im_well_window = LLIMWellWindow::findInstance();
+ if (im_well_window)
+ {
+ im_well_window->removeObjectRow(notification_id);
+ }
+
+ mNotifications.erase(notification_id);
+
+ // close floater
+ LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", notification_id);
+ if(floater)
+ {
+ floater->savePosition();
+ floater->setNotificationId(LLUUID::null);
+ floater->closeFloater();
+ }
}
void LLScriptFloaterManager::toggleScriptFloater(const LLUUID& notification_id, bool set_new_message)
{
- LLSD data;
- data["notification_id"] = notification_id;
- data["new_message"] = set_new_message;
- mToggleFloaterSignal(data);
+ LLSD data;
+ data["notification_id"] = notification_id;
+ data["new_message"] = set_new_message;
+ mToggleFloaterSignal(data);
- // toggle floater
- LLScriptFloater::toggle(notification_id);
+ // toggle floater
+ LLScriptFloater::toggle(notification_id);
}
LLUUID LLScriptFloaterManager::findObjectId(const LLUUID& notification_id)
{
- script_notification_map_t::const_iterator it = mNotifications.find(notification_id);
- if(mNotifications.end() != it)
- {
- return it->second;
- }
- return LLUUID::null;
+ script_notification_map_t::const_iterator it = mNotifications.find(notification_id);
+ if(mNotifications.end() != it)
+ {
+ return it->second;
+ }
+ return LLUUID::null;
}
LLUUID LLScriptFloaterManager::findNotificationId(const LLUUID& object_id)
{
- if(object_id.notNull())
- {
- script_notification_map_t::const_iterator it = findUsingObjectId(object_id);
- if(mNotifications.end() != it)
- {
- return it->first;
- }
- }
- return LLUUID::null;
+ if(object_id.notNull())
+ {
+ script_notification_map_t::const_iterator it = findUsingObjectId(object_id);
+ if(mNotifications.end() != it)
+ {
+ return it->first;
+ }
+ }
+ return LLUUID::null;
}
// static
LLScriptFloaterManager::EObjectType LLScriptFloaterManager::getObjectType(const LLUUID& notification_id)
{
- if(notification_id.isNull())
- {
- LL_WARNS() << "Invalid notification ID" << LL_ENDL;
- return OBJ_UNKNOWN;
- }
+ if(notification_id.isNull())
+ {
+ LL_WARNS() << "Invalid notification ID" << LL_ENDL;
+ return OBJ_UNKNOWN;
+ }
- static const object_type_map TYPE_MAP = initObjectTypeMap();
+ static const object_type_map TYPE_MAP = initObjectTypeMap();
- LLNotificationPtr notification = LLNotificationsUtil::find(notification_id);
- object_type_map::const_iterator it = TYPE_MAP.find(notification->getName());
- if(it != TYPE_MAP.end())
- {
- return it->second;
- }
+ LLNotificationPtr notification = LLNotificationsUtil::find(notification_id);
+ object_type_map::const_iterator it = TYPE_MAP.find(notification->getName());
+ if(it != TYPE_MAP.end())
+ {
+ return it->second;
+ }
- LL_WARNS() << "Unknown object type" << LL_ENDL;
- return OBJ_UNKNOWN;
+ LL_WARNS() << "Unknown object type" << LL_ENDL;
+ return OBJ_UNKNOWN;
}
// static
std::string LLScriptFloaterManager::getObjectName(const LLUUID& notification_id)
{
- using namespace LLNotificationsUI;
- LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
- if(!notification)
- {
- LL_WARNS() << "Invalid notification" << LL_ENDL;
- return LLStringUtil::null;
- }
-
- std::string text;
-
- switch(LLScriptFloaterManager::getObjectType(notification_id))
- {
- case LLScriptFloaterManager::OBJ_SCRIPT:
- text = notification->getSubstitutions()["TITLE"].asString();
- break;
- case LLScriptFloaterManager::OBJ_LOAD_URL:
- text = notification->getSubstitutions()["OBJECTNAME"].asString();
- break;
- case LLScriptFloaterManager::OBJ_GIVE_INVENTORY:
- text = notification->getSubstitutions()["OBJECTFROMNAME"].asString();
- break;
- default:
- text = LLTrans::getString("object");
- break;
- }
-
- return text;
+ using namespace LLNotificationsUI;
+ LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
+ if(!notification)
+ {
+ LL_WARNS() << "Invalid notification" << LL_ENDL;
+ return LLStringUtil::null;
+ }
+
+ std::string text;
+
+ switch(LLScriptFloaterManager::getObjectType(notification_id))
+ {
+ case LLScriptFloaterManager::OBJ_SCRIPT:
+ text = notification->getSubstitutions()["TITLE"].asString();
+ break;
+ case LLScriptFloaterManager::OBJ_LOAD_URL:
+ text = notification->getSubstitutions()["OBJECTNAME"].asString();
+ break;
+ case LLScriptFloaterManager::OBJ_GIVE_INVENTORY:
+ text = notification->getSubstitutions()["OBJECTFROMNAME"].asString();
+ break;
+ default:
+ text = LLTrans::getString("object");
+ break;
+ }
+
+ return text;
}
//static
LLScriptFloaterManager::object_type_map LLScriptFloaterManager::initObjectTypeMap()
{
- object_type_map type_map;
- type_map["ScriptDialog"] = OBJ_SCRIPT;
- type_map["ScriptDialogGroup"] = OBJ_SCRIPT;
- type_map["LoadWebPage"] = OBJ_LOAD_URL;
- type_map["ObjectGiveItem"] = OBJ_GIVE_INVENTORY;
- return type_map;
+ object_type_map type_map;
+ type_map["ScriptDialog"] = OBJ_SCRIPT;
+ type_map["ScriptDialogGroup"] = OBJ_SCRIPT;
+ type_map["LoadWebPage"] = OBJ_LOAD_URL;
+ type_map["ObjectGiveItem"] = OBJ_GIVE_INVENTORY;
+ return type_map;
}
LLScriptFloaterManager::script_notification_map_t::const_iterator LLScriptFloaterManager::findUsingObjectId(const LLUUID& object_id)
{
- script_notification_map_t::const_iterator it = mNotifications.begin();
- for(; mNotifications.end() != it; ++it)
- {
- if(object_id == it->second)
- {
- return it;
- }
- }
- return mNotifications.end();
+ script_notification_map_t::const_iterator it = mNotifications.begin();
+ for(; mNotifications.end() != it; ++it)
+ {
+ if(object_id == it->second)
+ {
+ return it;
+ }
+ }
+ return mNotifications.end();
}
LLScriptFloaterManager::script_notification_map_t::const_iterator LLScriptFloaterManager::findUsingObjectIdAndChannel(const LLUUID& object_id, S32 im_channel)
{
- script_notification_map_t::const_iterator it = mNotifications.begin();
- for (; mNotifications.end() != it; ++it)
- {
- if (object_id == it->second)
- {
- LLNotificationPtr notification = LLNotifications::instance().find(it->first);
- if (notification && (im_channel == notification->getPayload()["chat_channel"].asInteger()))
- {
- return it;
- }
- }
- }
- return mNotifications.end();
+ script_notification_map_t::const_iterator it = mNotifications.begin();
+ for (; mNotifications.end() != it; ++it)
+ {
+ if (object_id == it->second)
+ {
+ LLNotificationPtr notification = LLNotifications::instance().find(it->first);
+ if (notification && (im_channel == notification->getPayload()["chat_channel"].asInteger()))
+ {
+ return it;
+ }
+ }
+ }
+ return mNotifications.end();
}
void LLScriptFloaterManager::saveFloaterPosition(const LLUUID& object_id, const FloaterPositionInfo& fpi)
{
- if(object_id.notNull())
- {
- LLScriptFloaterManager::getInstance()->mFloaterPositions[object_id] = fpi;
- }
- else
- {
- LL_WARNS() << "Invalid object id" << LL_ENDL;
- }
+ if(object_id.notNull())
+ {
+ LLScriptFloaterManager::getInstance()->mFloaterPositions[object_id] = fpi;
+ }
+ else
+ {
+ LL_WARNS() << "Invalid object id" << LL_ENDL;
+ }
}
bool LLScriptFloaterManager::getFloaterPosition(const LLUUID& object_id, FloaterPositionInfo& fpi)
{
- floater_position_map_t::const_iterator it = mFloaterPositions.find(object_id);
- if(LLScriptFloaterManager::getInstance()->mFloaterPositions.end() != it)
- {
- fpi = it->second;
- return true;
- }
- return false;
+ floater_position_map_t::const_iterator it = mFloaterPositions.find(object_id);
+ if(LLScriptFloaterManager::getInstance()->mFloaterPositions.end() != it)
+ {
+ fpi = it->second;
+ return true;
+ }
+ return false;
}
void LLScriptFloaterManager::setFloaterVisible(const LLUUID& notification_id, bool visible)
{
- LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>(
- "script_floater", notification_id);
- if(floater)
- {
- floater->setVisible(visible);
- }
+ LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>(
+ "script_floater", notification_id);
+ if(floater)
+ {
+ floater->setVisible(visible);
+ }
}
//static
void LLScriptFloaterManager::clearScriptNotifications()
{
- LLScriptFloaterManager* inst = LLScriptFloaterManager::getInstance();
- static const object_type_map TYPE_MAP = initObjectTypeMap();
-
- script_notification_map_t::const_iterator ntf_it = inst->mNotifications.begin();
- while (inst->mNotifications.end() != ntf_it)
- {
- LLUUID notification_id = ntf_it->first;
- ntf_it++; // onRemoveNotification() erases notification
- LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
- if (notification)
- {
- object_type_map::const_iterator map_it = TYPE_MAP.find(notification->getName());
- if (map_it != TYPE_MAP.end() && map_it->second == OBJ_SCRIPT)
- {
- if (notification != NULL && !notification->isCancelled())
- {
- LLNotificationsUtil::cancel(notification);
- }
- inst->onRemoveNotification(notification_id);
- }
- }
- }
+ LLScriptFloaterManager* inst = LLScriptFloaterManager::getInstance();
+ static const object_type_map TYPE_MAP = initObjectTypeMap();
+
+ script_notification_map_t::const_iterator ntf_it = inst->mNotifications.begin();
+ while (inst->mNotifications.end() != ntf_it)
+ {
+ LLUUID notification_id = ntf_it->first;
+ ntf_it++; // onRemoveNotification() erases notification
+ LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
+ if (notification)
+ {
+ object_type_map::const_iterator map_it = TYPE_MAP.find(notification->getName());
+ if (map_it != TYPE_MAP.end() && map_it->second == OBJ_SCRIPT)
+ {
+ if (notification != NULL && !notification->isCancelled())
+ {
+ LLNotificationsUtil::cancel(notification);
+ }
+ inst->onRemoveNotification(notification_id);
+ }
+ }
+ }
}
//////////////////////////////////////////////////////////////////
bool LLScriptFloater::isScriptTextbox(LLNotificationPtr notification)
{
- // get a form for the notification
- LLNotificationFormPtr form(notification->getForm());
-
- if (form)
- {
- // get number of elements in the form
- int num_options = form->getNumElements();
-
- // if ANY of the buttons have the magic lltextbox string as
- // name, then treat the whole dialog as a simple text entry
- // box (i.e. mixed button and textbox forms are not supported)
- for (int i=0; i<num_options; ++i)
- {
- LLSD form_element = form->getElement(i);
- if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN)
- {
- return true;
- }
- }
- }
-
- return false;
+ // get a form for the notification
+ LLNotificationFormPtr form(notification->getForm());
+
+ if (form)
+ {
+ // get number of elements in the form
+ int num_options = form->getNumElements();
+
+ // if ANY of the buttons have the magic lltextbox string as
+ // name, then treat the whole dialog as a simple text entry
+ // box (i.e. mixed button and textbox forms are not supported)
+ for (int i=0; i<num_options; ++i)
+ {
+ LLSD form_element = form->getElement(i);
+ if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
}
// EOF
diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h
index 3695b8a3e1..cf413af2cb 100644
--- a/indra/newview/llscriptfloater.h
+++ b/indra/newview/llscriptfloater.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llscriptfloater.h
* @brief LLScriptFloater class definition
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,193 +38,193 @@ class LLToastPanel;
*/
class LLScriptFloaterManager : public LLSingleton<LLScriptFloaterManager>
{
- // *TODO
- // LLScriptFloaterManager and LLScriptFloater will need some refactoring after we
- // know how script notifications should look like.
- LLSINGLETON(LLScriptFloaterManager);
+ // *TODO
+ // LLScriptFloaterManager and LLScriptFloater will need some refactoring after we
+ // know how script notifications should look like.
+ LLSINGLETON(LLScriptFloaterManager);
public:
- typedef enum e_object_type
- {
- OBJ_SCRIPT,
- OBJ_GIVE_INVENTORY,
- OBJ_LOAD_URL,
+ typedef enum e_object_type
+ {
+ OBJ_SCRIPT,
+ OBJ_GIVE_INVENTORY,
+ OBJ_LOAD_URL,
- OBJ_UNKNOWN
- }EObjectType;
+ OBJ_UNKNOWN
+ }EObjectType;
- typedef enum e_limitation_type
- {
- SCRIPT_PER_OBJECT = 0,
- SCRIPT_PER_CHANNEL = 1,
- SCRIPT_ATTACHMENT_PER_CHANNEL,
- SCRIPT_HUD_PER_CHANNEL,
- SCRIPT_HUD_UNCONSTRAINED
- }ELimitationType;
+ typedef enum e_limitation_type
+ {
+ SCRIPT_PER_OBJECT = 0,
+ SCRIPT_PER_CHANNEL = 1,
+ SCRIPT_ATTACHMENT_PER_CHANNEL,
+ SCRIPT_HUD_PER_CHANNEL,
+ SCRIPT_HUD_UNCONSTRAINED
+ }ELimitationType;
- /**
- * Handles new notifications.
- * Saves notification and object ids, removes old notification if needed, creates script chiclet
- * Note that one object can spawn one script floater.
- */
- void onAddNotification(const LLUUID& notification_id);
+ /**
+ * Handles new notifications.
+ * Saves notification and object ids, removes old notification if needed, creates script chiclet
+ * Note that one object can spawn one script floater.
+ */
+ void onAddNotification(const LLUUID& notification_id);
- /**
- * Removes notification.
- */
- void removeNotification(const LLUUID& notification_id);
+ /**
+ * Removes notification.
+ */
+ void removeNotification(const LLUUID& notification_id);
- /**
- * Handles notification removal.
- * Removes script notification toast, removes script chiclet, closes script floater
- */
- void onRemoveNotification(const LLUUID& notification_id);
+ /**
+ * Handles notification removal.
+ * Removes script notification toast, removes script chiclet, closes script floater
+ */
+ void onRemoveNotification(const LLUUID& notification_id);
- /**
- * Toggles script floater.
- * Removes "new message" icon from chiclet and removes notification toast.
- */
- void toggleScriptFloater(const LLUUID& object_id, bool set_new_message = false);
+ /**
+ * Toggles script floater.
+ * Removes "new message" icon from chiclet and removes notification toast.
+ */
+ void toggleScriptFloater(const LLUUID& object_id, bool set_new_message = false);
- LLUUID findObjectId(const LLUUID& notification_id);
+ LLUUID findObjectId(const LLUUID& notification_id);
- LLUUID findNotificationId(const LLUUID& object_id);
+ LLUUID findNotificationId(const LLUUID& object_id);
- static EObjectType getObjectType(const LLUUID& notification_id);
+ static EObjectType getObjectType(const LLUUID& notification_id);
- static std::string getObjectName(const LLUUID& notification_id);
+ static std::string getObjectName(const LLUUID& notification_id);
- typedef boost::signals2::signal<void(const LLSD&)> object_signal_t;
+ typedef boost::signals2::signal<void(const LLSD&)> object_signal_t;
- boost::signals2::connection addNewObjectCallback(const object_signal_t::slot_type& cb) { return mNewObjectSignal.connect(cb); }
- boost::signals2::connection addToggleObjectFloaterCallback(const object_signal_t::slot_type& cb) { return mToggleFloaterSignal.connect(cb); }
+ boost::signals2::connection addNewObjectCallback(const object_signal_t::slot_type& cb) { return mNewObjectSignal.connect(cb); }
+ boost::signals2::connection addToggleObjectFloaterCallback(const object_signal_t::slot_type& cb) { return mToggleFloaterSignal.connect(cb); }
- struct FloaterPositionInfo
- {
- LLRect mRect;
- bool mDockState;
- };
+ struct FloaterPositionInfo
+ {
+ LLRect mRect;
+ bool mDockState;
+ };
- void saveFloaterPosition(const LLUUID& object_id, const FloaterPositionInfo& fpi);
+ void saveFloaterPosition(const LLUUID& object_id, const FloaterPositionInfo& fpi);
- bool getFloaterPosition(const LLUUID& object_id, FloaterPositionInfo& fpi);
+ bool getFloaterPosition(const LLUUID& object_id, FloaterPositionInfo& fpi);
- void setFloaterVisible(const LLUUID& notification_id, bool visible);
+ void setFloaterVisible(const LLUUID& notification_id, bool visible);
protected:
- /**
- * Removes all script-dialog notifications
- */
- static void clearScriptNotifications();
+ /**
+ * Removes all script-dialog notifications
+ */
+ static void clearScriptNotifications();
- typedef std::map<std::string, EObjectType> object_type_map;
+ typedef std::map<std::string, EObjectType> object_type_map;
- static object_type_map initObjectTypeMap();
+ static object_type_map initObjectTypeMap();
- // <notification_id, object_id>
- typedef std::map<LLUUID, LLUUID> script_notification_map_t;
+ // <notification_id, object_id>
+ typedef std::map<LLUUID, LLUUID> script_notification_map_t;
- script_notification_map_t::const_iterator findUsingObjectId(const LLUUID& object_id);
- script_notification_map_t::const_iterator findUsingObjectIdAndChannel(const LLUUID& object_id, S32 im_channel);
+ script_notification_map_t::const_iterator findUsingObjectId(const LLUUID& object_id);
+ script_notification_map_t::const_iterator findUsingObjectIdAndChannel(const LLUUID& object_id, S32 im_channel);
private:
- script_notification_map_t mNotifications;
+ script_notification_map_t mNotifications;
- object_signal_t mNewObjectSignal;
- object_signal_t mToggleFloaterSignal;
+ object_signal_t mNewObjectSignal;
+ object_signal_t mToggleFloaterSignal;
- // <object_id, floater position>
- typedef std::map<LLUUID, FloaterPositionInfo> floater_position_map_t;
+ // <object_id, floater position>
+ typedef std::map<LLUUID, FloaterPositionInfo> floater_position_map_t;
- floater_position_map_t mFloaterPositions;
- boost::signals2::connection mDialogLimitationsSlot;
+ floater_position_map_t mFloaterPositions;
+ boost::signals2::connection mDialogLimitationsSlot;
};
/**
* Floater script forms.
- * LLScriptFloater will create script form based on notification data and
+ * LLScriptFloater will create script form based on notification data and
* will auto fit the form.
*/
class LLScriptFloater : public LLDockableFloater
{
public:
- /**
- * key - UUID of scripted Object
- */
- LLScriptFloater(const LLSD& key);
+ /**
+ * key - UUID of scripted Object
+ */
+ LLScriptFloater(const LLSD& key);
- virtual ~LLScriptFloater(){};
+ virtual ~LLScriptFloater(){};
- /**
- * Toggle existing floater or create and show a new one.
- */
- static bool toggle(const LLUUID& object_id);
+ /**
+ * Toggle existing floater or create and show a new one.
+ */
+ static bool toggle(const LLUUID& object_id);
- /**
- * Creates and shows floater
- */
- static LLScriptFloater* show(const LLUUID& object_id);
+ /**
+ * Creates and shows floater
+ */
+ static LLScriptFloater* show(const LLUUID& object_id);
- const LLUUID& getNotificationId() { return mNotificationId; }
+ const LLUUID& getNotificationId() { return mNotificationId; }
- void setNotificationId(const LLUUID& id);
+ void setNotificationId(const LLUUID& id);
- /**
- * Close notification if script floater is closed.
- */
- /*virtual*/ void onClose(bool app_quitting);
+ /**
+ * Close notification if script floater is closed.
+ */
+ /*virtual*/ void onClose(bool app_quitting);
- /**
- * Hide all notification toasts when we show dockable floater
- */
- /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
+ /**
+ * Hide all notification toasts when we show dockable floater
+ */
+ /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
- /**
- * Hide all notification toasts when we show dockable floater
- */
- /*virtual*/ void setVisible(BOOL visible);
+ /**
+ * Hide all notification toasts when we show dockable floater
+ */
+ /*virtual*/ void setVisible(BOOL visible);
- bool getSavePosition() { return mSaveFloaterPosition; }
+ bool getSavePosition() { return mSaveFloaterPosition; }
- void setSavePosition(bool save) { mSaveFloaterPosition = save; }
+ void setSavePosition(bool save) { mSaveFloaterPosition = save; }
- void savePosition();
+ void savePosition();
- void restorePosition();
+ void restorePosition();
protected:
- /**
- * Creates script form, will delete old form if floater is shown for same object.
- */
- void createForm(const LLUUID& object_id);
+ /**
+ * Creates script form, will delete old form if floater is shown for same object.
+ */
+ void createForm(const LLUUID& object_id);
+
+ /**
+ * Hide all notification toasts.
+ */
+ static void hideToastsIfNeeded();
- /**
- * Hide all notification toasts.
- */
- static void hideToastsIfNeeded();
+ /**
+ * Removes chiclets new messages icon
+ */
+ void onMouseDown();
- /**
- * Removes chiclets new messages icon
- */
- void onMouseDown();
+ /*virtual*/ void onFocusLost();
- /*virtual*/ void onFocusLost();
-
- /*virtual*/ void onFocusReceived();
+ /*virtual*/ void onFocusReceived();
- void dockToChiclet(bool dock);
+ void dockToChiclet(bool dock);
private:
- bool isScriptTextbox(LLNotificationPtr notification);
+ bool isScriptTextbox(LLNotificationPtr notification);
- LLToastPanel* mScriptForm;
- LLUUID mNotificationId;
- LLUUID mObjectId;
- bool mSaveFloaterPosition;
+ LLToastPanel* mScriptForm;
+ LLUUID mNotificationId;
+ LLUUID mObjectId;
+ bool mSaveFloaterPosition;
};
#endif //LL_SCRIPTFLOATER_H
diff --git a/indra/newview/llscriptruntimeperms.h b/indra/newview/llscriptruntimeperms.h
index f692c0ad01..300304c21b 100644
--- a/indra/newview/llscriptruntimeperms.h
+++ b/indra/newview/llscriptruntimeperms.h
@@ -30,11 +30,11 @@
#include <boost/array.hpp>
typedef struct _script_perm {
- std::string question;
- U32 permbit;
- bool caution;
- _script_perm(const std::string& q, const U32 b, const bool c) :
- question(q), permbit(b), caution(c) {}
+ std::string question;
+ U32 permbit;
+ bool caution;
+ _script_perm(const std::string& q, const U32 b, const bool c) :
+ question(q), permbit(b), caution(c) {}
} script_perm_t;
const U32 NUM_SCRIPT_PERMISSIONS = 18;
@@ -43,22 +43,22 @@ const S32 SCRIPT_PERMISSION_TRIGGER_ANIMATION = 3;
const S32 SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS = 14;
static const boost::array<script_perm_t, NUM_SCRIPT_PERMISSIONS> SCRIPT_PERMISSIONS = {{
- _script_perm("ScriptTakeMoney", (0x1 << 1), true),
- _script_perm("ActOnControlInputs", (0x1 << 2), false),
- _script_perm("RemapControlInputs", (0x1 << 3), false),
- _script_perm("AnimateYourAvatar", (0x1 << 4), false),
- _script_perm("AttachToYourAvatar", (0x1 << 5), false),
- _script_perm("ReleaseOwnership", (0x1 << 6), false),
- _script_perm("LinkAndDelink", (0x1 << 7), false),
- _script_perm("AddAndRemoveJoints", (0x1 << 8), false),
- _script_perm("ChangePermissions", (0x1 << 9), false),
- _script_perm("TrackYourCamera", (0x1 << 10), false),
- _script_perm("ControlYourCamera", (0x1 << 11), false),
- _script_perm("TeleportYourAgent", (0x1 << 12), false),
- _script_perm("JoinAnExperience", (0x1 << 13), false),
- _script_perm("SilentlyManageEstateAccess", (0x1 << 14), false),
- _script_perm("OverrideYourAnimations", (0x1 << 15), false),
- _script_perm("ScriptReturnObjects", (0x1 << 16), false),
+ _script_perm("ScriptTakeMoney", (0x1 << 1), true),
+ _script_perm("ActOnControlInputs", (0x1 << 2), false),
+ _script_perm("RemapControlInputs", (0x1 << 3), false),
+ _script_perm("AnimateYourAvatar", (0x1 << 4), false),
+ _script_perm("AttachToYourAvatar", (0x1 << 5), false),
+ _script_perm("ReleaseOwnership", (0x1 << 6), false),
+ _script_perm("LinkAndDelink", (0x1 << 7), false),
+ _script_perm("AddAndRemoveJoints", (0x1 << 8), false),
+ _script_perm("ChangePermissions", (0x1 << 9), false),
+ _script_perm("TrackYourCamera", (0x1 << 10), false),
+ _script_perm("ControlYourCamera", (0x1 << 11), false),
+ _script_perm("TeleportYourAgent", (0x1 << 12), false),
+ _script_perm("JoinAnExperience", (0x1 << 13), false),
+ _script_perm("SilentlyManageEstateAccess", (0x1 << 14), false),
+ _script_perm("OverrideYourAnimations", (0x1 << 15), false),
+ _script_perm("ScriptReturnObjects", (0x1 << 16), false),
_script_perm("ForceSitAvatar", (0x1 << 17), false),
_script_perm("ChangeEnvSettings", (0x1 << 18), false)
} };
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp
index bfa453a0ae..4c8666bdde 100644
--- a/indra/newview/llscrollingpanelparam.cpp
+++ b/indra/newview/llscrollingpanelparam.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llscrollingpanelparam.cpp
* @brief UI panel for a list of visual param panels
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,50 +50,50 @@ const S32 LLScrollingPanelParam::PARAM_HINT_HEIGHT = 128;
S32 LLScrollingPanelParam::sUpdateDelayFrames = 0;
LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_params,
- LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints )
+ LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints )
: LLScrollingPanelParamBase( panel_params, mesh, param, allow_modify, wearable, jointp, use_hints)
{
- // *HACK To avoid hard coding texture position, lets use border's position for texture.
- LLViewBorder* left_border = getChild<LLViewBorder>("left_border");
-
- static LLUICachedControl<S32> slider_ctrl_height ("UISliderctrlHeight", 0);
- S32 pos_x = left_border->getRect().mLeft + left_border->getBorderWidth();
- S32 pos_y = left_border->getRect().mBottom + left_border->getBorderWidth();
- F32 min_weight = param->getMinWeight();
- F32 max_weight = param->getMaxWeight();
-
- mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, min_weight, jointp);
- pos_x = getChild<LLViewBorder>("right_border")->getRect().mLeft + left_border->getBorderWidth();
- mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, max_weight, jointp );
-
- mHintMin->setAllowsUpdates( FALSE );
- mHintMax->setAllowsUpdates( FALSE );
-
- std::string min_name = LLTrans::getString(param->getMinDisplayName());
- std::string max_name = LLTrans::getString(param->getMaxDisplayName());
- getChild<LLUICtrl>("min param text")->setValue(min_name);
- getChild<LLUICtrl>("max param text")->setValue(max_name);
-
- LLButton* less = getChild<LLButton>("less");
- if (less)
- {
- less->setMouseDownCallback( LLScrollingPanelParam::onHintMinMouseDown, this );
- less->setMouseUpCallback( LLScrollingPanelParam::onHintMinMouseUp, this );
- less->setHeldDownCallback( LLScrollingPanelParam::onHintMinHeldDown, this );
- less->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
- }
-
- LLButton* more = getChild<LLButton>("more");
- if (more)
- {
- more->setMouseDownCallback( LLScrollingPanelParam::onHintMaxMouseDown, this );
- more->setMouseUpCallback( LLScrollingPanelParam::onHintMaxMouseUp, this );
- more->setHeldDownCallback( LLScrollingPanelParam::onHintMaxHeldDown, this );
- more->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
- }
-
- setVisible(FALSE);
- setBorderVisible( FALSE );
+ // *HACK To avoid hard coding texture position, lets use border's position for texture.
+ LLViewBorder* left_border = getChild<LLViewBorder>("left_border");
+
+ static LLUICachedControl<S32> slider_ctrl_height ("UISliderctrlHeight", 0);
+ S32 pos_x = left_border->getRect().mLeft + left_border->getBorderWidth();
+ S32 pos_y = left_border->getRect().mBottom + left_border->getBorderWidth();
+ F32 min_weight = param->getMinWeight();
+ F32 max_weight = param->getMaxWeight();
+
+ mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, min_weight, jointp);
+ pos_x = getChild<LLViewBorder>("right_border")->getRect().mLeft + left_border->getBorderWidth();
+ mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, max_weight, jointp );
+
+ mHintMin->setAllowsUpdates( FALSE );
+ mHintMax->setAllowsUpdates( FALSE );
+
+ std::string min_name = LLTrans::getString(param->getMinDisplayName());
+ std::string max_name = LLTrans::getString(param->getMaxDisplayName());
+ getChild<LLUICtrl>("min param text")->setValue(min_name);
+ getChild<LLUICtrl>("max param text")->setValue(max_name);
+
+ LLButton* less = getChild<LLButton>("less");
+ if (less)
+ {
+ less->setMouseDownCallback( LLScrollingPanelParam::onHintMinMouseDown, this );
+ less->setMouseUpCallback( LLScrollingPanelParam::onHintMinMouseUp, this );
+ less->setHeldDownCallback( LLScrollingPanelParam::onHintMinHeldDown, this );
+ less->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
+ }
+
+ LLButton* more = getChild<LLButton>("more");
+ if (more)
+ {
+ more->setMouseDownCallback( LLScrollingPanelParam::onHintMaxMouseDown, this );
+ more->setMouseUpCallback( LLScrollingPanelParam::onHintMaxMouseUp, this );
+ more->setHeldDownCallback( LLScrollingPanelParam::onHintMaxHeldDown, this );
+ more->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
+ }
+
+ setVisible(FALSE);
+ setBorderVisible( FALSE );
}
LLScrollingPanelParam::~LLScrollingPanelParam()
@@ -101,86 +101,86 @@ LLScrollingPanelParam::~LLScrollingPanelParam()
}
void LLScrollingPanelParam::updatePanel(BOOL allow_modify)
{
- if (!mWearable)
- {
- // not editing a wearable just now, no update necessary
- return;
- }
- LLScrollingPanelParamBase::updatePanel(allow_modify);
-
- mHintMin->requestUpdate( sUpdateDelayFrames++ );
- mHintMax->requestUpdate( sUpdateDelayFrames++ );
- getChildView("less")->setEnabled(mAllowModify);
- getChildView("more")->setEnabled(mAllowModify);
+ if (!mWearable)
+ {
+ // not editing a wearable just now, no update necessary
+ return;
+ }
+ LLScrollingPanelParamBase::updatePanel(allow_modify);
+
+ mHintMin->requestUpdate( sUpdateDelayFrames++ );
+ mHintMax->requestUpdate( sUpdateDelayFrames++ );
+ getChildView("less")->setEnabled(mAllowModify);
+ getChildView("more")->setEnabled(mAllowModify);
}
void LLScrollingPanelParam::setVisible( BOOL visible )
{
- if( getVisible() != visible )
- {
- LLPanel::setVisible( visible );
- if (mHintMin)
- mHintMin->setAllowsUpdates( visible );
- if (mHintMax)
- mHintMax->setAllowsUpdates( visible );
-
- if( visible )
- {
- if (mHintMin)
- mHintMin->setUpdateDelayFrames( sUpdateDelayFrames++ );
- if (mHintMax)
- mHintMax->setUpdateDelayFrames( sUpdateDelayFrames++ );
- }
- }
+ if( getVisible() != visible )
+ {
+ LLPanel::setVisible( visible );
+ if (mHintMin)
+ mHintMin->setAllowsUpdates( visible );
+ if (mHintMax)
+ mHintMax->setAllowsUpdates( visible );
+
+ if( visible )
+ {
+ if (mHintMin)
+ mHintMin->setUpdateDelayFrames( sUpdateDelayFrames++ );
+ if (mHintMax)
+ mHintMax->setUpdateDelayFrames( sUpdateDelayFrames++ );
+ }
+ }
}
void LLScrollingPanelParam::draw()
{
- if( !mWearable )
- {
- return;
- }
-
- getChildView("less")->setVisible( mHintMin->getVisible());
- getChildView("more")->setVisible( mHintMax->getVisible());
-
- // hide borders if texture has been loaded
- getChildView("left_border")->setVisible( !mHintMin->getVisible());
- getChildView("right_border")->setVisible( !mHintMax->getVisible());
-
- // Draw all the children except for the labels
- getChildView("min param text")->setVisible( FALSE );
- getChildView("max param text")->setVisible( FALSE );
- LLPanel::draw();
-
- // If we're in a focused floater, don't apply the floater's alpha to visual param hint,
- // making its behavior similar to texture controls'.
- F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
-
- // Draw the hints over the "less" and "more" buttons.
- gGL.pushUIMatrix();
- {
- const LLRect& r = mHintMin->getRect();
- gGL.translateUI((F32)r.mLeft, (F32)r.mBottom, 0.f);
- mHintMin->draw(alpha);
- }
- gGL.popUIMatrix();
-
- gGL.pushUIMatrix();
- {
- const LLRect& r = mHintMax->getRect();
- gGL.translateUI((F32)r.mLeft, (F32)r.mBottom, 0.f);
- mHintMax->draw(alpha);
- }
- gGL.popUIMatrix();
-
-
- // Draw labels on top of the buttons
- getChildView("min param text")->setVisible( TRUE );
- drawChild(getChild<LLView>("min param text"));
-
- getChildView("max param text")->setVisible( TRUE );
- drawChild(getChild<LLView>("max param text"));
+ if( !mWearable )
+ {
+ return;
+ }
+
+ getChildView("less")->setVisible( mHintMin->getVisible());
+ getChildView("more")->setVisible( mHintMax->getVisible());
+
+ // hide borders if texture has been loaded
+ getChildView("left_border")->setVisible( !mHintMin->getVisible());
+ getChildView("right_border")->setVisible( !mHintMax->getVisible());
+
+ // Draw all the children except for the labels
+ getChildView("min param text")->setVisible( FALSE );
+ getChildView("max param text")->setVisible( FALSE );
+ LLPanel::draw();
+
+ // If we're in a focused floater, don't apply the floater's alpha to visual param hint,
+ // making its behavior similar to texture controls'.
+ F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+
+ // Draw the hints over the "less" and "more" buttons.
+ gGL.pushUIMatrix();
+ {
+ const LLRect& r = mHintMin->getRect();
+ gGL.translateUI((F32)r.mLeft, (F32)r.mBottom, 0.f);
+ mHintMin->draw(alpha);
+ }
+ gGL.popUIMatrix();
+
+ gGL.pushUIMatrix();
+ {
+ const LLRect& r = mHintMax->getRect();
+ gGL.translateUI((F32)r.mLeft, (F32)r.mBottom, 0.f);
+ mHintMax->draw(alpha);
+ }
+ gGL.popUIMatrix();
+
+
+ // Draw labels on top of the buttons
+ getChildView("min param text")->setVisible( TRUE );
+ drawChild(getChild<LLView>("min param text"));
+
+ getChildView("max param text")->setVisible( TRUE );
+ drawChild(getChild<LLView>("max param text"));
}
// static
@@ -191,168 +191,168 @@ void LLScrollingPanelParam::onSliderMouseDown(LLUICtrl* ctrl, void* userdata)
// static
void LLScrollingPanelParam::onSliderMouseUp(LLUICtrl* ctrl, void* userdata)
{
- LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
- LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
+ LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
+ LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
}
// static
void LLScrollingPanelParam::onHintMinMouseDown( void* userdata )
{
- LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
- self->onHintMouseDown( self->mHintMin );
+ LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
+ self->onHintMouseDown( self->mHintMin );
}
// static
void LLScrollingPanelParam::onHintMaxMouseDown( void* userdata )
{
- LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
- self->onHintMouseDown( self->mHintMax );
+ LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
+ self->onHintMouseDown( self->mHintMax );
}
void LLScrollingPanelParam::onHintMouseDown( LLVisualParamHint* hint )
{
- // morph towards this result
- F32 current_weight = mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
-
- // if we have maxed out on this morph, we shouldn't be able to click it
- if( hint->getVisualParamWeight() != current_weight )
- {
- mMouseDownTimer.reset();
- mLastHeldTime = 0.f;
- }
+ // morph towards this result
+ F32 current_weight = mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
+
+ // if we have maxed out on this morph, we shouldn't be able to click it
+ if( hint->getVisualParamWeight() != current_weight )
+ {
+ mMouseDownTimer.reset();
+ mLastHeldTime = 0.f;
+ }
}
// static
void LLScrollingPanelParam::onHintMinHeldDown( void* userdata )
{
- LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
- self->onHintHeldDown( self->mHintMin );
+ LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
+ self->onHintHeldDown( self->mHintMin );
}
// static
void LLScrollingPanelParam::onHintMaxHeldDown( void* userdata )
{
- LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
- self->onHintHeldDown( self->mHintMax );
+ LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
+ self->onHintHeldDown( self->mHintMax );
}
-
+
void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint )
{
- F32 current_weight = mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
-
- if (current_weight != hint->getVisualParamWeight() )
- {
- const F32 FULL_BLEND_TIME = 2.f;
- F32 elapsed_time = mMouseDownTimer.getElapsedTimeF32() - mLastHeldTime;
- mLastHeldTime += elapsed_time;
-
- F32 new_weight;
- if (current_weight > hint->getVisualParamWeight() )
- {
- new_weight = current_weight - (elapsed_time / FULL_BLEND_TIME);
- }
- else
- {
- new_weight = current_weight + (elapsed_time / FULL_BLEND_TIME);
- }
-
- // Make sure we're not taking the slider out of bounds
- // (this is where some simple UI limits are stored)
- F32 new_percent = weightToPercent(new_weight);
- LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
- if (slider)
- {
- if (slider->getMinValue() < new_percent
- && new_percent < slider->getMaxValue())
- {
- mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight);
- mWearable->writeToAvatar(gAgentAvatarp);
- gAgentAvatarp->updateVisualParams();
-
- slider->setValue( weightToPercent( new_weight ) );
- }
- }
- }
+ F32 current_weight = mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
+
+ if (current_weight != hint->getVisualParamWeight() )
+ {
+ const F32 FULL_BLEND_TIME = 2.f;
+ F32 elapsed_time = mMouseDownTimer.getElapsedTimeF32() - mLastHeldTime;
+ mLastHeldTime += elapsed_time;
+
+ F32 new_weight;
+ if (current_weight > hint->getVisualParamWeight() )
+ {
+ new_weight = current_weight - (elapsed_time / FULL_BLEND_TIME);
+ }
+ else
+ {
+ new_weight = current_weight + (elapsed_time / FULL_BLEND_TIME);
+ }
+
+ // Make sure we're not taking the slider out of bounds
+ // (this is where some simple UI limits are stored)
+ F32 new_percent = weightToPercent(new_weight);
+ LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
+ if (slider)
+ {
+ if (slider->getMinValue() < new_percent
+ && new_percent < slider->getMaxValue())
+ {
+ mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight);
+ mWearable->writeToAvatar(gAgentAvatarp);
+ gAgentAvatarp->updateVisualParams();
+
+ slider->setValue( weightToPercent( new_weight ) );
+ }
+ }
+ }
}
// static
void LLScrollingPanelParam::onHintMinMouseUp( void* userdata )
{
- LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
-
- F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32();
-
- LLVisualParamHint* hint = self->mHintMin;
-
- if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
- {
- // step in direction
- F32 current_weight = self->mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
- F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
- // step a fraction in the negative directiona
- F32 new_weight = current_weight - (range / 10.f);
- F32 new_percent = self->weightToPercent(new_weight);
- LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
- if (slider)
- {
- if (slider->getMinValue() < new_percent
- && new_percent < slider->getMaxValue())
- {
- self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
- self->mWearable->writeToAvatar(gAgentAvatarp);
- slider->setValue( self->weightToPercent( new_weight ) );
- }
- }
- }
-
- LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
+ LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
+
+ F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32();
+
+ LLVisualParamHint* hint = self->mHintMin;
+
+ if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
+ {
+ // step in direction
+ F32 current_weight = self->mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
+ F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
+ // step a fraction in the negative directiona
+ F32 new_weight = current_weight - (range / 10.f);
+ F32 new_percent = self->weightToPercent(new_weight);
+ LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
+ if (slider)
+ {
+ if (slider->getMinValue() < new_percent
+ && new_percent < slider->getMaxValue())
+ {
+ self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
+ self->mWearable->writeToAvatar(gAgentAvatarp);
+ slider->setValue( self->weightToPercent( new_weight ) );
+ }
+ }
+ }
+
+ LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
}
void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata )
{
- LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
-
- F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32();
-
- if (isAgentAvatarValid())
- {
- LLVisualParamHint* hint = self->mHintMax;
-
- if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
- {
- // step in direction
- F32 current_weight = self->mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
- F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
- // step a fraction in the negative direction
- F32 new_weight = current_weight + (range / 10.f);
- F32 new_percent = self->weightToPercent(new_weight);
- LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
- if (slider)
- {
- if (slider->getMinValue() < new_percent
- && new_percent < slider->getMaxValue())
- {
- self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
- self->mWearable->writeToAvatar(gAgentAvatarp);
- slider->setValue( self->weightToPercent( new_weight ) );
- }
- }
- }
- }
-
- LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
+ LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
+
+ F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32();
+
+ if (isAgentAvatarValid())
+ {
+ LLVisualParamHint* hint = self->mHintMax;
+
+ if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
+ {
+ // step in direction
+ F32 current_weight = self->mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
+ F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
+ // step a fraction in the negative direction
+ F32 new_weight = current_weight + (range / 10.f);
+ F32 new_percent = self->weightToPercent(new_weight);
+ LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
+ if (slider)
+ {
+ if (slider->getMinValue() < new_percent
+ && new_percent < slider->getMaxValue())
+ {
+ self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
+ self->mWearable->writeToAvatar(gAgentAvatarp);
+ slider->setValue( self->weightToPercent( new_weight ) );
+ }
+ }
+ }
+ }
+
+ LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
}
F32 LLScrollingPanelParam::weightToPercent( F32 weight )
{
- LLViewerVisualParam* param = mParam;
- return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f;
+ LLViewerVisualParam* param = mParam;
+ return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f;
}
F32 LLScrollingPanelParam::percentToWeight( F32 percent )
{
- LLViewerVisualParam* param = mParam;
- return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight();
+ LLViewerVisualParam* param = mParam;
+ return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight();
}
diff --git a/indra/newview/llscrollingpanelparam.h b/indra/newview/llscrollingpanelparam.h
index c7a47d5c7a..e4f3f398fe 100644
--- a/indra/newview/llscrollingpanelparam.h
+++ b/indra/newview/llscrollingpanelparam.h
@@ -1,26 +1,26 @@
-/**
+/**
* @file llscrollingpanelparam.h
- * @brief the scrolling panel containing a list of visual param
- * panels
+ * @brief the scrolling panel containing a list of visual param
+ * panels
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,46 +40,46 @@ class LLJoint;
class LLScrollingPanelParam : public LLScrollingPanelParamBase
{
public:
- LLScrollingPanelParam( const LLPanel::Params& panel_params,
- LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints = TRUE );
- virtual ~LLScrollingPanelParam();
+ LLScrollingPanelParam( const LLPanel::Params& panel_params,
+ LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints = TRUE );
+ virtual ~LLScrollingPanelParam();
- virtual void draw();
- virtual void setVisible( BOOL visible );
- virtual void updatePanel(BOOL allow_modify);
+ virtual void draw();
+ virtual void setVisible( BOOL visible );
+ virtual void updatePanel(BOOL allow_modify);
- static void onSliderMouseDown(LLUICtrl* ctrl, void* userdata);
- static void onSliderMouseUp(LLUICtrl* ctrl, void* userdata);
+ static void onSliderMouseDown(LLUICtrl* ctrl, void* userdata);
+ static void onSliderMouseUp(LLUICtrl* ctrl, void* userdata);
- static void onHintMinMouseDown(void* userdata);
- static void onHintMinHeldDown(void* userdata);
- static void onHintMaxMouseDown(void* userdata);
- static void onHintMaxHeldDown(void* userdata);
- static void onHintMinMouseUp(void* userdata);
- static void onHintMaxMouseUp(void* userdata);
+ static void onHintMinMouseDown(void* userdata);
+ static void onHintMinHeldDown(void* userdata);
+ static void onHintMaxMouseDown(void* userdata);
+ static void onHintMaxHeldDown(void* userdata);
+ static void onHintMinMouseUp(void* userdata);
+ static void onHintMaxMouseUp(void* userdata);
- void onHintMouseDown( LLVisualParamHint* hint );
- void onHintHeldDown( LLVisualParamHint* hint );
+ void onHintMouseDown( LLVisualParamHint* hint );
+ void onHintHeldDown( LLVisualParamHint* hint );
- F32 weightToPercent( F32 weight );
- F32 percentToWeight( F32 percent );
+ F32 weightToPercent( F32 weight );
+ F32 percentToWeight( F32 percent );
public:
- // Constants for LLPanelVisualParam
- const static F32 PARAM_STEP_TIME_THRESHOLD;
-
- const static S32 PARAM_HINT_WIDTH;
- const static S32 PARAM_HINT_HEIGHT;
+ // Constants for LLPanelVisualParam
+ const static F32 PARAM_STEP_TIME_THRESHOLD;
+
+ const static S32 PARAM_HINT_WIDTH;
+ const static S32 PARAM_HINT_HEIGHT;
public:
- LLPointer<LLVisualParamHint> mHintMin;
- LLPointer<LLVisualParamHint> mHintMax;
- static S32 sUpdateDelayFrames;
-
+ LLPointer<LLVisualParamHint> mHintMin;
+ LLPointer<LLVisualParamHint> mHintMax;
+ static S32 sUpdateDelayFrames;
+
protected:
- LLTimer mMouseDownTimer; // timer for how long mouse has been held down on a hint.
- F32 mLastHeldTime;
- BOOL mAllowModify;
-};
+ LLTimer mMouseDownTimer; // timer for how long mouse has been held down on a hint.
+ F32 mLastHeldTime;
+ BOOL mAllowModify;
+};
#endif
diff --git a/indra/newview/llscrollingpanelparambase.cpp b/indra/newview/llscrollingpanelparambase.cpp
index fe7a362723..13651880dd 100644
--- a/indra/newview/llscrollingpanelparambase.cpp
+++ b/indra/newview/llscrollingpanelparambase.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llscrollingpanelparam.cpp
* @brief UI panel for a list of visual param panels
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,26 +40,26 @@
#include "llvoavatarself.h"
LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& panel_params,
- LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints)
- : LLScrollingPanel( panel_params ),
- mParam(param),
- mAllowModify(allow_modify),
- mWearable(wearable)
+ LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints)
+ : LLScrollingPanel( panel_params ),
+ mParam(param),
+ mAllowModify(allow_modify),
+ mWearable(wearable)
{
- if (use_hints)
- buildFromFile( "panel_scrolling_param.xml");
- else
- buildFromFile( "panel_scrolling_param_base.xml");
-
- getChild<LLUICtrl>("param slider")->setValue(weightToPercent(param->getWeight()));
+ if (use_hints)
+ buildFromFile( "panel_scrolling_param.xml");
+ else
+ buildFromFile( "panel_scrolling_param_base.xml");
+
+ getChild<LLUICtrl>("param slider")->setValue(weightToPercent(param->getWeight()));
- std::string display_name = LLTrans::getString(param->getDisplayName());
- getChild<LLUICtrl>("param slider")->setLabelArg("[DESC]", display_name);
- getChildView("param slider")->setEnabled(mAllowModify);
- childSetCommitCallback("param slider", LLScrollingPanelParamBase::onSliderMoved, this);
+ std::string display_name = LLTrans::getString(param->getDisplayName());
+ getChild<LLUICtrl>("param slider")->setLabelArg("[DESC]", display_name);
+ getChildView("param slider")->setEnabled(mAllowModify);
+ childSetCommitCallback("param slider", LLScrollingPanelParamBase::onSliderMoved, this);
- setVisible(FALSE);
- setBorderVisible( FALSE );
+ setVisible(FALSE);
+ setBorderVisible( FALSE );
}
LLScrollingPanelParamBase::~LLScrollingPanelParamBase()
@@ -68,45 +68,45 @@ LLScrollingPanelParamBase::~LLScrollingPanelParamBase()
void LLScrollingPanelParamBase::updatePanel(BOOL allow_modify)
{
- LLViewerVisualParam* param = mParam;
+ LLViewerVisualParam* param = mParam;
- if (!mWearable)
- {
- // not editing a wearable just now, no update necessary
- return;
- }
+ if (!mWearable)
+ {
+ // not editing a wearable just now, no update necessary
+ return;
+ }
- F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
- getChild<LLUICtrl>("param slider")->setValue(weightToPercent( current_weight ) );
- mAllowModify = allow_modify;
- getChildView("param slider")->setEnabled(mAllowModify);
+ F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
+ getChild<LLUICtrl>("param slider")->setValue(weightToPercent( current_weight ) );
+ mAllowModify = allow_modify;
+ getChildView("param slider")->setEnabled(mAllowModify);
}
// static
void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata)
{
- LLSliderCtrl* slider = (LLSliderCtrl*) ctrl;
- LLScrollingPanelParamBase* self = (LLScrollingPanelParamBase*) userdata;
- LLViewerVisualParam* param = self->mParam;
-
- F32 current_weight = self->mWearable->getVisualParamWeight( param->getID() );
- F32 new_weight = self->percentToWeight( (F32)slider->getValue().asReal() );
- if (current_weight != new_weight )
- {
- self->mWearable->setVisualParamWeight( param->getID(), new_weight);
- self->mWearable->writeToAvatar(gAgentAvatarp);
- gAgentAvatarp->updateVisualParams();
- }
+ LLSliderCtrl* slider = (LLSliderCtrl*) ctrl;
+ LLScrollingPanelParamBase* self = (LLScrollingPanelParamBase*) userdata;
+ LLViewerVisualParam* param = self->mParam;
+
+ F32 current_weight = self->mWearable->getVisualParamWeight( param->getID() );
+ F32 new_weight = self->percentToWeight( (F32)slider->getValue().asReal() );
+ if (current_weight != new_weight )
+ {
+ self->mWearable->setVisualParamWeight( param->getID(), new_weight);
+ self->mWearable->writeToAvatar(gAgentAvatarp);
+ gAgentAvatarp->updateVisualParams();
+ }
}
F32 LLScrollingPanelParamBase::weightToPercent( F32 weight )
{
- LLViewerVisualParam* param = mParam;
- return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f;
+ LLViewerVisualParam* param = mParam;
+ return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f;
}
F32 LLScrollingPanelParamBase::percentToWeight( F32 percent )
{
- LLViewerVisualParam* param = mParam;
- return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight();
+ LLViewerVisualParam* param = mParam;
+ return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight();
}
diff --git a/indra/newview/llscrollingpanelparambase.h b/indra/newview/llscrollingpanelparambase.h
index 9538826251..74682bb71c 100644
--- a/indra/newview/llscrollingpanelparambase.h
+++ b/indra/newview/llscrollingpanelparambase.h
@@ -1,26 +1,26 @@
-/**
+/**
* @file llscrollingpanelparam.h
- * @brief the scrolling panel containing a list of visual param
- * panels
+ * @brief the scrolling panel containing a list of visual param
+ * panels
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,22 +41,22 @@ class LLJoint;
class LLScrollingPanelParamBase : public LLScrollingPanel
{
public:
- LLScrollingPanelParamBase( const LLPanel::Params& panel_params,
- LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints = FALSE );
- virtual ~LLScrollingPanelParamBase();
+ LLScrollingPanelParamBase( const LLPanel::Params& panel_params,
+ LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints = FALSE );
+ virtual ~LLScrollingPanelParamBase();
- virtual void updatePanel(BOOL allow_modify);
+ virtual void updatePanel(BOOL allow_modify);
- static void onSliderMoved(LLUICtrl* ctrl, void* userdata);
+ static void onSliderMoved(LLUICtrl* ctrl, void* userdata);
- F32 weightToPercent( F32 weight );
- F32 percentToWeight( F32 percent );
+ F32 weightToPercent( F32 weight );
+ F32 percentToWeight( F32 percent );
public:
- LLViewerVisualParam* mParam;
+ LLViewerVisualParam* mParam;
protected:
- BOOL mAllowModify;
- LLWearable *mWearable;
-};
+ BOOL mAllowModify;
+ LLWearable *mWearable;
+};
#endif
diff --git a/indra/newview/llsculptidsize.cpp b/indra/newview/llsculptidsize.cpp
index bedee32213..3bc5ad7616 100644
--- a/indra/newview/llsculptidsize.cpp
+++ b/indra/newview/llsculptidsize.cpp
@@ -46,86 +46,86 @@ void _nothing_to_do_func(int) { /*nothing todo here because of the size it's a s
void LLSculptIDSize::inc(const LLDrawable *pdrawable, int sz)
{
- llassert(sz >= 0);
-
- if (!pdrawable) return;
- LLVOVolume* vvol = pdrawable->getVOVolume();
- if (!vvol) return;
- if (!vvol->isAttachment()) return;
- if (!vvol->getAvatar()) return;
- if (vvol->getAvatar()->isSelf()) return;
- LLVolume *vol = vvol->getVolume();
- if (!vol) return;
-
- const LLUUID &sculptId = vol->getParams().getSculptID();
- if (sculptId.isNull()) return;
-
- unsigned int total_size = 0;
-
- pair_iter_iter_BY_SCULPT_ID_t itLU = mSizeInfo.get<tag_BY_SCULPT_ID>().equal_range(sculptId);
- if (itLU.first == itLU.second)
- { //register
- //llassert(mSizeInfo.get<tag_BY_DRAWABLE>().end() == mSizeInfo.get<tag_BY_DRAWABLE>().find(pdrawable));
- mSizeInfo.get<tag_BY_DRAWABLE>().insert(Info(pdrawable, sz, std::make_shared<SizeSum>(sz), sculptId));
- total_size = sz;
- }
- else
- { //update + register
- Info &nfo = const_cast<Info &>(*itLU.first);
- //calc new size
- total_size = nfo.getSizeSum() + sz;
- nfo.mSharedSizeSum->mSizeSum = total_size;
- nfo.mSize = sz;
- //update size for all LLDrwable in range of sculptId
- for (pair_iter_iter_BY_SCULPT_ID_t::first_type it = itLU.first; it != itLU.second; ++it)
- {
- mSizeInfo.get<tag_BY_SIZE>().modify_key(mSizeInfo.project<tag_BY_SIZE>(it), boost::bind(&_nothing_to_do_func, _1));
- }
-
- //trying insert the LLDrawable
- mSizeInfo.get<tag_BY_DRAWABLE>().insert(Info(pdrawable, sz, nfo.mSharedSizeSum, sculptId));
- }
+ llassert(sz >= 0);
+
+ if (!pdrawable) return;
+ LLVOVolume* vvol = pdrawable->getVOVolume();
+ if (!vvol) return;
+ if (!vvol->isAttachment()) return;
+ if (!vvol->getAvatar()) return;
+ if (vvol->getAvatar()->isSelf()) return;
+ LLVolume *vol = vvol->getVolume();
+ if (!vol) return;
+
+ const LLUUID &sculptId = vol->getParams().getSculptID();
+ if (sculptId.isNull()) return;
+
+ unsigned int total_size = 0;
+
+ pair_iter_iter_BY_SCULPT_ID_t itLU = mSizeInfo.get<tag_BY_SCULPT_ID>().equal_range(sculptId);
+ if (itLU.first == itLU.second)
+ { //register
+ //llassert(mSizeInfo.get<tag_BY_DRAWABLE>().end() == mSizeInfo.get<tag_BY_DRAWABLE>().find(pdrawable));
+ mSizeInfo.get<tag_BY_DRAWABLE>().insert(Info(pdrawable, sz, std::make_shared<SizeSum>(sz), sculptId));
+ total_size = sz;
+ }
+ else
+ { //update + register
+ Info &nfo = const_cast<Info &>(*itLU.first);
+ //calc new size
+ total_size = nfo.getSizeSum() + sz;
+ nfo.mSharedSizeSum->mSizeSum = total_size;
+ nfo.mSize = sz;
+ //update size for all LLDrwable in range of sculptId
+ for (pair_iter_iter_BY_SCULPT_ID_t::first_type it = itLU.first; it != itLU.second; ++it)
+ {
+ mSizeInfo.get<tag_BY_SIZE>().modify_key(mSizeInfo.project<tag_BY_SIZE>(it), boost::bind(&_nothing_to_do_func, _1));
+ }
+
+ //trying insert the LLDrawable
+ mSizeInfo.get<tag_BY_DRAWABLE>().insert(Info(pdrawable, sz, nfo.mSharedSizeSum, sculptId));
+ }
}
void LLSculptIDSize::dec(const LLDrawable *pdrawable)
{
- container_BY_DRAWABLE_view::iterator it = mSizeInfo.get<tag_BY_DRAWABLE>().find(pdrawable);
- if (mSizeInfo.get<tag_BY_DRAWABLE>().end() == it) return;
-
- unsigned int size = it->getSizeSum() - it->getSize();
-
- if (0 == size)
- {
- mSizeInfo.get<tag_BY_SCULPT_ID>().erase(it->getSculptId());
- }
- else
- {
- Info &nfo = const_cast<Info &>(*it);
- nfo.mSize = 0;
- pair_iter_iter_BY_SCULPT_ID_t itLU = mSizeInfo.get<tag_BY_SCULPT_ID>().equal_range(it->getSculptId());
- it->mSharedSizeSum->mSizeSum = size;
- for (pair_iter_iter_BY_SCULPT_ID_t::first_type it = itLU.first; it != itLU.second; ++it)
- {
- mSizeInfo.get<tag_BY_SIZE>().modify_key(mSizeInfo.project<tag_BY_SIZE>(it), boost::bind(&_nothing_to_do_func, _1));
- }
- }
+ container_BY_DRAWABLE_view::iterator it = mSizeInfo.get<tag_BY_DRAWABLE>().find(pdrawable);
+ if (mSizeInfo.get<tag_BY_DRAWABLE>().end() == it) return;
+
+ unsigned int size = it->getSizeSum() - it->getSize();
+
+ if (0 == size)
+ {
+ mSizeInfo.get<tag_BY_SCULPT_ID>().erase(it->getSculptId());
+ }
+ else
+ {
+ Info &nfo = const_cast<Info &>(*it);
+ nfo.mSize = 0;
+ pair_iter_iter_BY_SCULPT_ID_t itLU = mSizeInfo.get<tag_BY_SCULPT_ID>().equal_range(it->getSculptId());
+ it->mSharedSizeSum->mSizeSum = size;
+ for (pair_iter_iter_BY_SCULPT_ID_t::first_type it = itLU.first; it != itLU.second; ++it)
+ {
+ mSizeInfo.get<tag_BY_SIZE>().modify_key(mSizeInfo.project<tag_BY_SIZE>(it), boost::bind(&_nothing_to_do_func, _1));
+ }
+ }
}
void LLSculptIDSize::rem(const LLUUID &sculptId)
{
- mSizeInfo.get<tag_BY_SCULPT_ID>().erase(sculptId);
+ mSizeInfo.get<tag_BY_SCULPT_ID>().erase(sculptId);
}
void LLSculptIDSize::resetSizeSum(const LLUUID &sculptId)
{
- const pair_iter_iter_BY_SCULPT_ID_t itLU = mSizeInfo.get<tag_BY_SCULPT_ID>().equal_range(sculptId);
+ const pair_iter_iter_BY_SCULPT_ID_t itLU = mSizeInfo.get<tag_BY_SCULPT_ID>().equal_range(sculptId);
- if (itLU.first != itLU.second) {
- itLU.first->mSharedSizeSum->mSizeSum = 0;
- }
+ if (itLU.first != itLU.second) {
+ itLU.first->mSharedSizeSum->mSizeSum = 0;
+ }
- for (pair_iter_iter_BY_SCULPT_ID_t::first_type it = itLU.first, itE = itLU.second; it != itE; ++it)
- {
- mSizeInfo.get<tag_BY_SIZE>().modify_key(mSizeInfo.project<tag_BY_SIZE>(it), boost::bind(&_nothing_to_do_func, _1));
- }
+ for (pair_iter_iter_BY_SCULPT_ID_t::first_type it = itLU.first, itE = itLU.second; it != itE; ++it)
+ {
+ mSizeInfo.get<tag_BY_SIZE>().modify_key(mSizeInfo.project<tag_BY_SIZE>(it), boost::bind(&_nothing_to_do_func, _1));
+ }
}
diff --git a/indra/newview/llsculptidsize.h b/indra/newview/llsculptidsize.h
index 679fcbd44c..c84b365a4d 100644
--- a/indra/newview/llsculptidsize.h
+++ b/indra/newview/llsculptidsize.h
@@ -42,93 +42,93 @@ class LLDrawable;
class LLSculptIDSize
{
public:
- struct SizeSum
- {
- SizeSum(int size)
- : mSizeSum(size)
- {}
- unsigned int mSizeSum;
- };
-
- struct Info
- {
- typedef std::shared_ptr<SizeSum> PtrSizeSum;
-
- Info(const LLDrawable *drawable, int size, PtrSizeSum sizeInfo, LLUUID sculptId)
- : mDrawable(drawable)
- , mSize(size)
- , mSharedSizeSum(sizeInfo)
- , mSculptId(sculptId)
- {}
-
- const LLDrawable *mDrawable;
- unsigned int mSize;
- PtrSizeSum mSharedSizeSum;
- LLUUID mSculptId;
-
- inline const LLDrawable* getPtrLLDrawable() const { return mDrawable; }
- inline unsigned int getSize() const { return mSize; }
- inline unsigned int getSizeSum() const { return mSharedSizeSum->mSizeSum; }
- inline LLUUID getSculptId() const { return mSculptId; }
- PtrSizeSum getSizeInfo() { return mSharedSizeSum; }
- };
+ struct SizeSum
+ {
+ SizeSum(int size)
+ : mSizeSum(size)
+ {}
+ unsigned int mSizeSum;
+ };
+
+ struct Info
+ {
+ typedef std::shared_ptr<SizeSum> PtrSizeSum;
+
+ Info(const LLDrawable *drawable, int size, PtrSizeSum sizeInfo, LLUUID sculptId)
+ : mDrawable(drawable)
+ , mSize(size)
+ , mSharedSizeSum(sizeInfo)
+ , mSculptId(sculptId)
+ {}
+
+ const LLDrawable *mDrawable;
+ unsigned int mSize;
+ PtrSizeSum mSharedSizeSum;
+ LLUUID mSculptId;
+
+ inline const LLDrawable* getPtrLLDrawable() const { return mDrawable; }
+ inline unsigned int getSize() const { return mSize; }
+ inline unsigned int getSizeSum() const { return mSharedSizeSum->mSizeSum; }
+ inline LLUUID getSculptId() const { return mSculptId; }
+ PtrSizeSum getSizeInfo() { return mSharedSizeSum; }
+ };
public:
- //tags
- struct tag_BY_DRAWABLE {};
- struct tag_BY_SCULPT_ID {};
- struct tag_BY_SIZE {};
-
- //container
- typedef boost::multi_index_container <
- Info,
- boost::multi_index::indexed_by <
- boost::multi_index::ordered_unique< boost::multi_index::tag<tag_BY_DRAWABLE>
- , boost::multi_index::const_mem_fun<Info, const LLDrawable*, &Info::getPtrLLDrawable>
- >
- , boost::multi_index::ordered_non_unique<boost::multi_index::tag<tag_BY_SCULPT_ID>
- , boost::multi_index::const_mem_fun<Info, LLUUID, &Info::getSculptId>
- >
- , boost::multi_index::ordered_non_unique < boost::multi_index::tag<tag_BY_SIZE>
- , boost::multi_index::const_mem_fun < Info, unsigned int, &Info::getSizeSum >
- >
- >
- > container;
-
- //views
- typedef container::index<tag_BY_DRAWABLE>::type container_BY_DRAWABLE_view;
- typedef container::index<tag_BY_SCULPT_ID>::type container_BY_SCULPT_ID_view;
- typedef container::index<tag_BY_SIZE>::type container_BY_SIZE_view;
+ //tags
+ struct tag_BY_DRAWABLE {};
+ struct tag_BY_SCULPT_ID {};
+ struct tag_BY_SIZE {};
+
+ //container
+ typedef boost::multi_index_container <
+ Info,
+ boost::multi_index::indexed_by <
+ boost::multi_index::ordered_unique< boost::multi_index::tag<tag_BY_DRAWABLE>
+ , boost::multi_index::const_mem_fun<Info, const LLDrawable*, &Info::getPtrLLDrawable>
+ >
+ , boost::multi_index::ordered_non_unique<boost::multi_index::tag<tag_BY_SCULPT_ID>
+ , boost::multi_index::const_mem_fun<Info, LLUUID, &Info::getSculptId>
+ >
+ , boost::multi_index::ordered_non_unique < boost::multi_index::tag<tag_BY_SIZE>
+ , boost::multi_index::const_mem_fun < Info, unsigned int, &Info::getSizeSum >
+ >
+ >
+ > container;
+
+ //views
+ typedef container::index<tag_BY_DRAWABLE>::type container_BY_DRAWABLE_view;
+ typedef container::index<tag_BY_SCULPT_ID>::type container_BY_SCULPT_ID_view;
+ typedef container::index<tag_BY_SIZE>::type container_BY_SIZE_view;
private:
- LLSculptIDSize()
- {}
+ LLSculptIDSize()
+ {}
public:
- static LLSculptIDSize & instance()
- {
- static LLSculptIDSize inst;
- return inst;
- }
+ static LLSculptIDSize & instance()
+ {
+ static LLSculptIDSize inst;
+ return inst;
+ }
public:
- void inc(const LLDrawable *pdrawable, int sz);
- void dec(const LLDrawable *pdrawable);
- void rem(const LLUUID &sculptId);
+ void inc(const LLDrawable *pdrawable, int sz);
+ void dec(const LLDrawable *pdrawable);
+ void rem(const LLUUID &sculptId);
- inline void addToUnloaded(const LLUUID &sculptId) { mMarkAsUnloaded.insert(sculptId); }
- inline void remFromUnloaded(const LLUUID &sculptId) { mMarkAsUnloaded.erase(sculptId); }
- inline bool isUnloaded(const LLUUID &sculptId) const { return mMarkAsUnloaded.end() != mMarkAsUnloaded.find(sculptId); }
- inline void clearUnloaded() { mMarkAsUnloaded.clear(); }
-
- void resetSizeSum(const LLUUID &sculptId);
+ inline void addToUnloaded(const LLUUID &sculptId) { mMarkAsUnloaded.insert(sculptId); }
+ inline void remFromUnloaded(const LLUUID &sculptId) { mMarkAsUnloaded.erase(sculptId); }
+ inline bool isUnloaded(const LLUUID &sculptId) const { return mMarkAsUnloaded.end() != mMarkAsUnloaded.find(sculptId); }
+ inline void clearUnloaded() { mMarkAsUnloaded.clear(); }
- inline const container & getSizeInfo() const { return mSizeInfo; }
+ void resetSizeSum(const LLUUID &sculptId);
+
+ inline const container & getSizeInfo() const { return mSizeInfo; }
private:
- container mSizeInfo;
- typedef std::set<LLUUID> std_LLUUID;
- std_LLUUID mMarkAsUnloaded;
+ container mSizeInfo;
+ typedef std::set<LLUUID> std_LLUUID;
+ std_LLUUID mMarkAsUnloaded;
};
#endif
diff --git a/indra/newview/llsearchableui.cpp b/indra/newview/llsearchableui.cpp
index 620bbdfcdf..0a3cb803d2 100644
--- a/indra/newview/llsearchableui.cpp
+++ b/indra/newview/llsearchableui.cpp
@@ -35,31 +35,31 @@ ll::prefs::SearchableItem::~SearchableItem()
void ll::prefs::SearchableItem::setNotHighlighted()
{
- mCtrl->setHighlighted( false );
+ mCtrl->setHighlighted( false );
}
bool ll::prefs::SearchableItem::hightlightAndHide( LLWString const &aFilter )
{
- if( mCtrl->getHighlighted() )
- return true;
-
- LLView const *pView = dynamic_cast< LLView const* >( mCtrl );
- if( pView && !pView->getVisible() )
- return false;
-
- if( aFilter.empty() )
- {
- mCtrl->setHighlighted( false );
- return true;
- }
-
- if( mLabel.find( aFilter ) != LLWString::npos )
- {
- mCtrl->setHighlighted( true );
- return true;
- }
-
- return false;
+ if( mCtrl->getHighlighted() )
+ return true;
+
+ LLView const *pView = dynamic_cast< LLView const* >( mCtrl );
+ if( pView && !pView->getVisible() )
+ return false;
+
+ if( aFilter.empty() )
+ {
+ mCtrl->setHighlighted( false );
+ return true;
+ }
+
+ if( mLabel.find( aFilter ) != LLWString::npos )
+ {
+ mCtrl->setHighlighted( true );
+ return true;
+ }
+
+ return false;
}
ll::prefs::PanelData::~PanelData()
@@ -67,109 +67,109 @@ ll::prefs::PanelData::~PanelData()
bool ll::prefs::PanelData::hightlightAndHide( LLWString const &aFilter )
{
- for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
- (*itr)->setNotHighlighted();
+ for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
+ (*itr)->setNotHighlighted();
- for (tPanelDataList::iterator itr = mChildPanel.begin(); itr != mChildPanel.end(); ++itr)
- (*itr)->setNotHighlighted();
+ for (tPanelDataList::iterator itr = mChildPanel.begin(); itr != mChildPanel.end(); ++itr)
+ (*itr)->setNotHighlighted();
- if (aFilter.empty())
- {
- return true;
- }
+ if (aFilter.empty())
+ {
+ return true;
+ }
- bool bVisible(false);
- for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
- bVisible |= (*itr)->hightlightAndHide( aFilter );
+ bool bVisible(false);
+ for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
+ bVisible |= (*itr)->hightlightAndHide( aFilter );
- for( tPanelDataList::iterator itr = mChildPanel.begin(); itr != mChildPanel.end(); ++itr )
- bVisible |= (*itr)->hightlightAndHide( aFilter );
+ for( tPanelDataList::iterator itr = mChildPanel.begin(); itr != mChildPanel.end(); ++itr )
+ bVisible |= (*itr)->hightlightAndHide( aFilter );
- return bVisible;
+ return bVisible;
}
void ll::prefs::PanelData::setNotHighlighted()
{
- for (tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr)
- (*itr)->setNotHighlighted();
+ for (tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr)
+ (*itr)->setNotHighlighted();
- for (tPanelDataList::iterator itr = mChildPanel.begin(); itr != mChildPanel.end(); ++itr)
- (*itr)->setNotHighlighted();
+ for (tPanelDataList::iterator itr = mChildPanel.begin(); itr != mChildPanel.end(); ++itr)
+ (*itr)->setNotHighlighted();
}
bool ll::prefs::TabContainerData::hightlightAndHide( LLWString const &aFilter )
{
- for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
- (*itr)->setNotHighlighted( );
-
- bool bVisible(false);
- for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
- bVisible |= (*itr)->hightlightAndHide( aFilter );
-
- for( tPanelDataList::iterator itr = mChildPanel.begin(); itr != mChildPanel.end(); ++itr )
- {
- bool bPanelVisible = (*itr)->hightlightAndHide( aFilter );
- if( (*itr)->mPanel )
- mTabContainer->setTabVisibility( (*itr)->mPanel, bPanelVisible );
- bVisible |= bPanelVisible;
- }
-
- return bVisible;
+ for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
+ (*itr)->setNotHighlighted( );
+
+ bool bVisible(false);
+ for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
+ bVisible |= (*itr)->hightlightAndHide( aFilter );
+
+ for( tPanelDataList::iterator itr = mChildPanel.begin(); itr != mChildPanel.end(); ++itr )
+ {
+ bool bPanelVisible = (*itr)->hightlightAndHide( aFilter );
+ if( (*itr)->mPanel )
+ mTabContainer->setTabVisibility( (*itr)->mPanel, bPanelVisible );
+ bVisible |= bPanelVisible;
+ }
+
+ return bVisible;
}
ll::statusbar::SearchableItem::SearchableItem()
- : mMenu(0)
- , mCtrl(0)
- , mWasHiddenBySearch( false )
+ : mMenu(0)
+ , mCtrl(0)
+ , mWasHiddenBySearch( false )
{ }
void ll::statusbar::SearchableItem::setNotHighlighted( )
{
- for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
- (*itr)->setNotHighlighted( );
+ for( tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr )
+ (*itr)->setNotHighlighted( );
- if( mCtrl )
- {
- mCtrl->setHighlighted( false );
+ if( mCtrl )
+ {
+ mCtrl->setHighlighted( false );
if (mWasHiddenBySearch)
{
mMenu->setVisible(TRUE);
mWasHiddenBySearch = false;
}
- }
+ }
}
bool ll::statusbar::SearchableItem::hightlightAndHide(LLWString const &aFilter, bool hide)
{
- if ((mMenu && !mMenu->getVisible() && !mWasHiddenBySearch) || dynamic_cast<LLMenuItemTearOffGL*>(mMenu))
- return false;
-
- setNotHighlighted( );
-
- if( aFilter.empty() )
- {
- if( mCtrl )
- mCtrl->setHighlighted( false );
- return true;
- }
-
- bool bHighlighted(!hide);
- if( mLabel.find( aFilter ) != LLWString::npos )
- {
- if( mCtrl )
- mCtrl->setHighlighted( true );
- bHighlighted = true;
- }
-
- bool bVisible(false);
- for (tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr)
- bVisible |= (*itr)->hightlightAndHide(aFilter, !bHighlighted);
-
- if (mCtrl && !bVisible && !bHighlighted)
- {
- mWasHiddenBySearch = true;
- mMenu->setVisible(FALSE);
- }
- return bVisible || bHighlighted;
+ if ((mMenu && !mMenu->getVisible() && !mWasHiddenBySearch) || dynamic_cast<LLMenuItemTearOffGL*>(mMenu))
+ return false;
+
+ setNotHighlighted( );
+
+ if( aFilter.empty() )
+ {
+ if( mCtrl )
+ mCtrl->setHighlighted( false );
+ return true;
+ }
+
+ bool bHighlighted(!hide);
+ if( mLabel.find( aFilter ) != LLWString::npos )
+ {
+ if( mCtrl )
+ mCtrl->setHighlighted( true );
+ bHighlighted = true;
+ }
+
+ bool bVisible(false);
+ for (tSearchableItemList::iterator itr = mChildren.begin(); itr != mChildren.end(); ++itr)
+ bVisible |= (*itr)->hightlightAndHide(aFilter, !bHighlighted);
+
+ if (mCtrl && !bVisible && !bHighlighted)
+ {
+ mWasHiddenBySearch = true;
+ mMenu->setVisible(FALSE);
+ }
+ return bVisible || bHighlighted;
}
diff --git a/indra/newview/llsearchableui.h b/indra/newview/llsearchableui.h
index 84fcefb835..de9f2c2efe 100644
--- a/indra/newview/llsearchableui.h
+++ b/indra/newview/llsearchableui.h
@@ -35,88 +35,88 @@ class LLTabContainer;
namespace ll
{
- namespace prefs
- {
- struct SearchableItem;
- struct PanelData;
- struct TabContainerData;
-
- typedef std::shared_ptr< SearchableItem > SearchableItemPtr;
- typedef std::shared_ptr< PanelData > PanelDataPtr;
- typedef std::shared_ptr< TabContainerData > TabContainerDataPtr;
-
- typedef std::vector< TabContainerData > tTabContainerDataList;
- typedef std::vector< SearchableItemPtr > tSearchableItemList;
- typedef std::vector< PanelDataPtr > tPanelDataList;
-
- struct SearchableItem
- {
- LLWString mLabel;
- LLView const *mView;
- ll::ui::SearchableControl const *mCtrl;
-
- std::vector< std::shared_ptr< SearchableItem > > mChildren;
-
- virtual ~SearchableItem();
-
- void setNotHighlighted();
- virtual bool hightlightAndHide( LLWString const &aFilter );
- };
-
- struct PanelData
- {
- LLPanel const *mPanel;
- std::string mLabel;
-
- std::vector< std::shared_ptr< SearchableItem > > mChildren;
- std::vector< std::shared_ptr< PanelData > > mChildPanel;
-
- virtual ~PanelData();
-
- void setNotHighlighted();
- virtual bool hightlightAndHide( LLWString const &aFilter );
- };
-
- struct TabContainerData: public PanelData
- {
- LLTabContainer *mTabContainer;
- virtual bool hightlightAndHide( LLWString const &aFilter );
- };
-
- struct SearchData
- {
- TabContainerDataPtr mRootTab;
- LLWString mLastFilter;
- };
- }
- namespace statusbar
- {
- struct SearchableItem;
-
- typedef std::shared_ptr< SearchableItem > SearchableItemPtr;
-
- typedef std::vector< SearchableItemPtr > tSearchableItemList;
-
- struct SearchableItem
- {
- LLWString mLabel;
- LLMenuItemGL *mMenu;
- tSearchableItemList mChildren;
- ll::ui::SearchableControl const *mCtrl;
- bool mWasHiddenBySearch;
-
- SearchableItem();
-
- void setNotHighlighted( );
- bool hightlightAndHide( LLWString const &aFilter, bool hide = true );
- };
-
- struct SearchData
- {
- SearchableItemPtr mRootMenu;
- LLWString mLastFilter;
- };
- }
+ namespace prefs
+ {
+ struct SearchableItem;
+ struct PanelData;
+ struct TabContainerData;
+
+ typedef std::shared_ptr< SearchableItem > SearchableItemPtr;
+ typedef std::shared_ptr< PanelData > PanelDataPtr;
+ typedef std::shared_ptr< TabContainerData > TabContainerDataPtr;
+
+ typedef std::vector< TabContainerData > tTabContainerDataList;
+ typedef std::vector< SearchableItemPtr > tSearchableItemList;
+ typedef std::vector< PanelDataPtr > tPanelDataList;
+
+ struct SearchableItem
+ {
+ LLWString mLabel;
+ LLView const *mView;
+ ll::ui::SearchableControl const *mCtrl;
+
+ std::vector< std::shared_ptr< SearchableItem > > mChildren;
+
+ virtual ~SearchableItem();
+
+ void setNotHighlighted();
+ virtual bool hightlightAndHide( LLWString const &aFilter );
+ };
+
+ struct PanelData
+ {
+ LLPanel const *mPanel;
+ std::string mLabel;
+
+ std::vector< std::shared_ptr< SearchableItem > > mChildren;
+ std::vector< std::shared_ptr< PanelData > > mChildPanel;
+
+ virtual ~PanelData();
+
+ void setNotHighlighted();
+ virtual bool hightlightAndHide( LLWString const &aFilter );
+ };
+
+ struct TabContainerData: public PanelData
+ {
+ LLTabContainer *mTabContainer;
+ virtual bool hightlightAndHide( LLWString const &aFilter );
+ };
+
+ struct SearchData
+ {
+ TabContainerDataPtr mRootTab;
+ LLWString mLastFilter;
+ };
+ }
+ namespace statusbar
+ {
+ struct SearchableItem;
+
+ typedef std::shared_ptr< SearchableItem > SearchableItemPtr;
+
+ typedef std::vector< SearchableItemPtr > tSearchableItemList;
+
+ struct SearchableItem
+ {
+ LLWString mLabel;
+ LLMenuItemGL *mMenu;
+ tSearchableItemList mChildren;
+ ll::ui::SearchableControl const *mCtrl;
+ bool mWasHiddenBySearch;
+
+ SearchableItem();
+
+ void setNotHighlighted( );
+ bool hightlightAndHide( LLWString const &aFilter, bool hide = true );
+ };
+
+ struct SearchData
+ {
+ SearchableItemPtr mRootMenu;
+ LLWString mLastFilter;
+ };
+ }
}
#endif
diff --git a/indra/newview/llsearchcombobox.cpp b/indra/newview/llsearchcombobox.cpp
index 2824c70582..5cab2e6f70 100644
--- a/indra/newview/llsearchcombobox.cpp
+++ b/indra/newview/llsearchcombobox.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,111 +36,111 @@ static LLDefaultChildRegistry::Register<LLSearchComboBox> r1("search_combo_box")
class LLSearchHistoryBuilder
{
public:
- LLSearchHistoryBuilder(LLSearchComboBox* combo_box, const std::string& filter);
+ LLSearchHistoryBuilder(LLSearchComboBox* combo_box, const std::string& filter);
- virtual void buildSearchHistory();
+ virtual void buildSearchHistory();
- virtual ~LLSearchHistoryBuilder(){}
+ virtual ~LLSearchHistoryBuilder(){}
protected:
- virtual bool filterSearchHistory();
+ virtual bool filterSearchHistory();
- LLSearchComboBox* mComboBox;
- std::string mFilter;
- LLSearchHistory::search_history_list_t mFilteredSearchHistory;
+ LLSearchComboBox* mComboBox;
+ std::string mFilter;
+ LLSearchHistory::search_history_list_t mFilteredSearchHistory;
};
LLSearchComboBox::Params::Params()
-: search_button("search_button"),
- dropdown_button_visible("dropdown_button_visible", false)
+: search_button("search_button"),
+ dropdown_button_visible("dropdown_button_visible", false)
{}
LLSearchComboBox::LLSearchComboBox(const Params&p)
: LLComboBox(p)
{
- S32 btn_top = p.search_button.top_pad + p.search_button.rect.height;
- S32 btn_right = p.search_button.rect.width + p.search_button.left_pad;
- LLRect search_btn_rect(p.search_button.left_pad, btn_top, btn_right, p.search_button.top_pad);
-
- LLButton::Params button_params(p.search_button);
- button_params.name(std::string("search_btn"));
- button_params.rect(search_btn_rect) ;
- button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_TOP);
- button_params.tab_stop(false);
- button_params.click_callback.function(boost::bind(&LLSearchComboBox::onSelectionCommit, this));
- mSearchButton = LLUICtrlFactory::create<LLButton>(button_params);
- mTextEntry->addChild(mSearchButton);
- mTextEntry->setPassDelete(TRUE);
-
- setButtonVisible(p.dropdown_button_visible);
- mTextEntry->setCommitCallback(boost::bind(&LLComboBox::onTextCommit, this, _2));
- mTextEntry->setKeystrokeCallback(boost::bind(&LLComboBox::onTextEntry, this, _1), NULL);
- setCommitCallback(boost::bind(&LLSearchComboBox::onSelectionCommit, this));
- setPrearrangeCallback(boost::bind(&LLSearchComboBox::onSearchPrearrange, this, _2));
- mSearchButton->setCommitCallback(boost::bind(&LLSearchComboBox::onTextCommit, this, _2));
+ S32 btn_top = p.search_button.top_pad + p.search_button.rect.height;
+ S32 btn_right = p.search_button.rect.width + p.search_button.left_pad;
+ LLRect search_btn_rect(p.search_button.left_pad, btn_top, btn_right, p.search_button.top_pad);
+
+ LLButton::Params button_params(p.search_button);
+ button_params.name(std::string("search_btn"));
+ button_params.rect(search_btn_rect) ;
+ button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_TOP);
+ button_params.tab_stop(false);
+ button_params.click_callback.function(boost::bind(&LLSearchComboBox::onSelectionCommit, this));
+ mSearchButton = LLUICtrlFactory::create<LLButton>(button_params);
+ mTextEntry->addChild(mSearchButton);
+ mTextEntry->setPassDelete(TRUE);
+
+ setButtonVisible(p.dropdown_button_visible);
+ mTextEntry->setCommitCallback(boost::bind(&LLComboBox::onTextCommit, this, _2));
+ mTextEntry->setKeystrokeCallback(boost::bind(&LLComboBox::onTextEntry, this, _1), NULL);
+ setCommitCallback(boost::bind(&LLSearchComboBox::onSelectionCommit, this));
+ setPrearrangeCallback(boost::bind(&LLSearchComboBox::onSearchPrearrange, this, _2));
+ mSearchButton->setCommitCallback(boost::bind(&LLSearchComboBox::onTextCommit, this, _2));
}
void LLSearchComboBox::rebuildSearchHistory(const std::string& filter)
{
- LLSearchHistoryBuilder builder(this, filter);
- builder.buildSearchHistory();
+ LLSearchHistoryBuilder builder(this, filter);
+ builder.buildSearchHistory();
}
void LLSearchComboBox::onSearchPrearrange(const LLSD& data)
{
- std::string filter = data.asString();
- rebuildSearchHistory(filter);
+ std::string filter = data.asString();
+ rebuildSearchHistory(filter);
- mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item.
+ mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item.
}
void LLSearchComboBox::onTextEntry(LLLineEditor* line_editor)
{
- KEY key = gKeyboard->currentKey();
-
- if (line_editor->getText().empty())
- {
- prearrangeList(); // resets filter
- hideList();
- }
- // Typing? (moving cursor should not affect showing the list)
- else if (key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END)
- {
- prearrangeList(line_editor->getText());
- if (mList->getItemCount() != 0)
- {
- showList();
- focusTextEntry();
- }
- else
- {
- // Hide the list if it's empty.
- hideList();
- }
- }
- LLComboBox::onTextEntry(line_editor);
+ KEY key = gKeyboard->currentKey();
+
+ if (line_editor->getText().empty())
+ {
+ prearrangeList(); // resets filter
+ hideList();
+ }
+ // Typing? (moving cursor should not affect showing the list)
+ else if (key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END)
+ {
+ prearrangeList(line_editor->getText());
+ if (mList->getItemCount() != 0)
+ {
+ showList();
+ focusTextEntry();
+ }
+ else
+ {
+ // Hide the list if it's empty.
+ hideList();
+ }
+ }
+ LLComboBox::onTextEntry(line_editor);
}
void LLSearchComboBox::focusTextEntry()
{
- // We can't use "mTextEntry->setFocus(TRUE)" instead because
- // if the "select_on_focus" parameter is true it places the cursor
- // at the beginning (after selecting text), thus screwing up updateSelection().
- if (mTextEntry)
- {
- gFocusMgr.setKeyboardFocus(mTextEntry);
-
- // Let the editor handle editing hotkeys (STORM-431).
- LLEditMenuHandler::gEditMenuHandler = mTextEntry;
- }
+ // We can't use "mTextEntry->setFocus(TRUE)" instead because
+ // if the "select_on_focus" parameter is true it places the cursor
+ // at the beginning (after selecting text), thus screwing up updateSelection().
+ if (mTextEntry)
+ {
+ gFocusMgr.setKeyboardFocus(mTextEntry);
+
+ // Let the editor handle editing hotkeys (STORM-431).
+ LLEditMenuHandler::gEditMenuHandler = mTextEntry;
+ }
}
void LLSearchComboBox::hideList()
{
- LLComboBox::hideList();
- if (mTextEntry && hasFocus())
- focusTextEntry();
+ LLComboBox::hideList();
+ if (mTextEntry && hasFocus())
+ focusTextEntry();
}
LLSearchComboBox::~LLSearchComboBox()
@@ -149,58 +149,58 @@ LLSearchComboBox::~LLSearchComboBox()
void LLSearchComboBox::onSelectionCommit()
{
- std::string search_query = getSimple();
- LLStringUtil::trim(search_query);
-
- // Order of add() and mTextEntry->setText does matter because add() will select first item
- // in drop down list and its label will be copied to text box rewriting mTextEntry->setText() call
- if(!search_query.empty())
- {
- remove(search_query);
- add(search_query, ADD_TOP);
- }
-
- mTextEntry->setText(search_query);
- setControlValue(search_query);
+ std::string search_query = getSimple();
+ LLStringUtil::trim(search_query);
+
+ // Order of add() and mTextEntry->setText does matter because add() will select first item
+ // in drop down list and its label will be copied to text box rewriting mTextEntry->setText() call
+ if(!search_query.empty())
+ {
+ remove(search_query);
+ add(search_query, ADD_TOP);
+ }
+
+ mTextEntry->setText(search_query);
+ setControlValue(search_query);
}
BOOL LLSearchComboBox::remove(const std::string& name)
{
- BOOL found = mList->selectItemByLabel(name, FALSE);
-
- if (found)
- {
- LLScrollListItem* item = mList->getFirstSelected();
- if (item)
- {
- LLComboBox::remove(mList->getItemIndex(item));
- }
- }
-
- return found;
+ BOOL found = mList->selectItemByLabel(name, FALSE);
+
+ if (found)
+ {
+ LLScrollListItem* item = mList->getFirstSelected();
+ if (item)
+ {
+ LLComboBox::remove(mList->getItemIndex(item));
+ }
+ }
+
+ return found;
}
void LLSearchComboBox::clearHistory()
{
- removeall();
- setTextEntry(LLStringUtil::null);
+ removeall();
+ setTextEntry(LLStringUtil::null);
}
BOOL LLSearchComboBox::handleKeyHere(KEY key,MASK mask )
{
- if(mTextEntry->hasFocus() && MASK_NONE == mask && KEY_DOWN == key)
- {
- S32 first = 0;
- S32 size = 0;
-
- // get entered text (without auto-complete part)
- mTextEntry->getSelectionRange(&first, &size);
- std::string search_query = mTextEntry->getText();
- search_query.erase(first, size);
-
- onSearchPrearrange(search_query);
- }
- return LLComboBox::handleKeyHere(key, mask);
+ if(mTextEntry->hasFocus() && MASK_NONE == mask && KEY_DOWN == key)
+ {
+ S32 first = 0;
+ S32 size = 0;
+
+ // get entered text (without auto-complete part)
+ mTextEntry->getSelectionRange(&first, &size);
+ std::string search_query = mTextEntry->getText();
+ search_query.erase(first, size);
+
+ onSearchPrearrange(search_query);
+ }
+ return LLComboBox::handleKeyHere(key, mask);
}
LLSearchHistoryBuilder::LLSearchHistoryBuilder(LLSearchComboBox* combo_box, const std::string& filter)
@@ -211,53 +211,53 @@ LLSearchHistoryBuilder::LLSearchHistoryBuilder(LLSearchComboBox* combo_box, cons
bool LLSearchHistoryBuilder::filterSearchHistory()
{
- // *TODO: an STL algorithm would look nicer
- mFilteredSearchHistory.clear();
+ // *TODO: an STL algorithm would look nicer
+ mFilteredSearchHistory.clear();
- std::string filter_copy = mFilter;
- LLStringUtil::toLower(filter_copy);
+ std::string filter_copy = mFilter;
+ LLStringUtil::toLower(filter_copy);
- LLSearchHistory::search_history_list_t history =
- LLSearchHistory::getInstance()->getSearchHistoryList();
+ LLSearchHistory::search_history_list_t history =
+ LLSearchHistory::getInstance()->getSearchHistoryList();
- LLSearchHistory::search_history_list_t::const_iterator it = history.begin();
- for ( ; it != history.end(); ++it)
- {
- std::string search_query = (*it).search_query;
- LLStringUtil::toLower(search_query);
+ LLSearchHistory::search_history_list_t::const_iterator it = history.begin();
+ for ( ; it != history.end(); ++it)
+ {
+ std::string search_query = (*it).search_query;
+ LLStringUtil::toLower(search_query);
- if (search_query.find(filter_copy) != std::string::npos)
- mFilteredSearchHistory.push_back(*it);
- }
+ if (search_query.find(filter_copy) != std::string::npos)
+ mFilteredSearchHistory.push_back(*it);
+ }
- return mFilteredSearchHistory.size();
+ return mFilteredSearchHistory.size();
}
void LLSearchHistoryBuilder::buildSearchHistory()
{
- mFilteredSearchHistory.clear();
-
- LLSearchHistory::search_history_list_t filtered_items;
- LLSearchHistory::search_history_list_t* itemsp = NULL;
- LLSearchHistory* sh = LLSearchHistory::getInstance();
-
- if (mFilter.empty())
- {
- itemsp = &sh->getSearchHistoryList();
- }
- else
- {
- filterSearchHistory();
- itemsp = &mFilteredSearchHistory;
- itemsp->sort();
- }
-
- mComboBox->removeall();
-
- LLSearchHistory::search_history_list_t::const_iterator it = itemsp->begin();
- for ( ; it != itemsp->end(); it++)
- {
- LLSearchHistory::LLSearchHistoryItem item = *it;
- mComboBox->add(item.search_query);
- }
+ mFilteredSearchHistory.clear();
+
+ LLSearchHistory::search_history_list_t filtered_items;
+ LLSearchHistory::search_history_list_t* itemsp = NULL;
+ LLSearchHistory* sh = LLSearchHistory::getInstance();
+
+ if (mFilter.empty())
+ {
+ itemsp = &sh->getSearchHistoryList();
+ }
+ else
+ {
+ filterSearchHistory();
+ itemsp = &mFilteredSearchHistory;
+ itemsp->sort();
+ }
+
+ mComboBox->removeall();
+
+ LLSearchHistory::search_history_list_t::const_iterator it = itemsp->begin();
+ for ( ; it != itemsp->end(); it++)
+ {
+ LLSearchHistory::LLSearchHistoryItem item = *it;
+ mComboBox->add(item.search_query);
+ }
}
diff --git a/indra/newview/llsearchcombobox.h b/indra/newview/llsearchcombobox.h
index 68f3979532..ff9c74a6a8 100644
--- a/indra/newview/llsearchcombobox.h
+++ b/indra/newview/llsearchcombobox.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsearchcombobox.h
* @brief LLSearchComboBox class definition
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,66 +39,66 @@ class LLSearchComboBox : public LLComboBox
{
public:
- struct Params : public LLInitParam::Block<Params, LLComboBox::Params>
- {
- Optional<LLButton::Params> search_button;
- Optional<bool> dropdown_button_visible;
+ struct Params : public LLInitParam::Block<Params, LLComboBox::Params>
+ {
+ Optional<LLButton::Params> search_button;
+ Optional<bool> dropdown_button_visible;
- Params();
- };
+ Params();
+ };
- /**
- * Removes an entry from combo box, case insensitive
- */
- BOOL remove(const std::string& name);
+ /**
+ * Removes an entry from combo box, case insensitive
+ */
+ BOOL remove(const std::string& name);
- /**
- * Clears search history
- */
- void clearHistory();
+ /**
+ * Clears search history
+ */
+ void clearHistory();
- /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
+ /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
- ~LLSearchComboBox();
+ ~LLSearchComboBox();
protected:
- LLSearchComboBox(const Params&p);
- friend class LLUICtrlFactory;
-
- /**
- * Handles typing in text box
- */
- void onTextEntry(LLLineEditor* line_editor);
-
- /**
- * Hides drop down list and focuses text box
- */
- void hideList();
-
- /**
- * Rebuilds search history, case insensitive
- * If filter is an empty string - whole history will be added to combo box
- * if filter is valid string - only matching entries will be added
- */
- virtual void rebuildSearchHistory(const std::string& filter);
-
- /**
- * Callback for prearrange event
- */
- void onSearchPrearrange(const LLSD& data);
-
- /**
- * Callback for text box or combo box commit
- */
- void onSelectionCommit();
-
- /**
- * Sets focus to text box
- */
- void focusTextEntry();
-
- LLButton* mSearchButton;
+ LLSearchComboBox(const Params&p);
+ friend class LLUICtrlFactory;
+
+ /**
+ * Handles typing in text box
+ */
+ void onTextEntry(LLLineEditor* line_editor);
+
+ /**
+ * Hides drop down list and focuses text box
+ */
+ void hideList();
+
+ /**
+ * Rebuilds search history, case insensitive
+ * If filter is an empty string - whole history will be added to combo box
+ * if filter is valid string - only matching entries will be added
+ */
+ virtual void rebuildSearchHistory(const std::string& filter);
+
+ /**
+ * Callback for prearrange event
+ */
+ void onSearchPrearrange(const LLSD& data);
+
+ /**
+ * Callback for text box or combo box commit
+ */
+ void onSelectionCommit();
+
+ /**
+ * Sets focus to text box
+ */
+ void focusTextEntry();
+
+ LLButton* mSearchButton;
};
#endif //LL_LLSEARCHCOMBOBOX_H
diff --git a/indra/newview/llsearchhistory.cpp b/indra/newview/llsearchhistory.cpp
index 66e377cb8d..51752cbb61 100644
--- a/indra/newview/llsearchhistory.cpp
+++ b/indra/newview/llsearchhistory.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,40 +41,40 @@ LLSearchHistory::LLSearchHistory()
bool LLSearchHistory::load()
{
- // build filename for each user
- std::string resolved_filename = getHistoryFilePath();
- llifstream file(resolved_filename.c_str());
- if (!file.is_open())
- {
- return false;
- }
-
- clearHistory();
-
- // add each line in the file to the list
- std::string line;
- LLPointer<LLSDParser> parser = new LLSDNotationParser();
- while (std::getline(file, line))
- {
- LLSD s_item;
- std::istringstream iss(line);
- if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
- {
- break;
- }
-
- mSearchHistory.push_back(s_item);
- }
-
- file.close();
-
- return true;
+ // build filename for each user
+ std::string resolved_filename = getHistoryFilePath();
+ llifstream file(resolved_filename.c_str());
+ if (!file.is_open())
+ {
+ return false;
+ }
+
+ clearHistory();
+
+ // add each line in the file to the list
+ std::string line;
+ LLPointer<LLSDParser> parser = new LLSDNotationParser();
+ while (std::getline(file, line))
+ {
+ LLSD s_item;
+ std::istringstream iss(line);
+ if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
+ {
+ break;
+ }
+
+ mSearchHistory.push_back(s_item);
+ }
+
+ file.close();
+
+ return true;
}
bool LLSearchHistory::save()
{
- // build filename for each user
- std::string resolved_filename = getHistoryFilePath();
+ // build filename for each user
+ std::string resolved_filename = getHistoryFilePath();
// delete the file if it is empty or contains only empty entries
if (std::find_if(mSearchHistory.begin(), mSearchHistory.end(), [](const LLSearchHistoryItem& x)
@@ -86,74 +86,74 @@ bool LLSearchHistory::save()
return true;
}
- // open a file for writing
- llofstream file(resolved_filename.c_str());
- if (!file.is_open())
- {
- return false;
- }
-
- search_history_list_t::const_iterator it = mSearchHistory.begin();
- for (; mSearchHistory.end() != it; ++it)
- {
- file << LLSDOStreamer<LLSDNotationFormatter>((*it).toLLSD()) << std::endl;
- }
-
- file.close();
- return true;
+ // open a file for writing
+ llofstream file(resolved_filename.c_str());
+ if (!file.is_open())
+ {
+ return false;
+ }
+
+ search_history_list_t::const_iterator it = mSearchHistory.begin();
+ for (; mSearchHistory.end() != it; ++it)
+ {
+ file << LLSDOStreamer<LLSDNotationFormatter>((*it).toLLSD()) << std::endl;
+ }
+
+ file.close();
+ return true;
}
std::string LLSearchHistory::getHistoryFilePath()
{
- return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SEARCH_HISTORY_FILE_NAME);
+ return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SEARCH_HISTORY_FILE_NAME);
}
void LLSearchHistory::addEntry(const std::string& search_query)
{
- if(search_query.empty())
- {
- return;
- }
+ if(search_query.empty())
+ {
+ return;
+ }
- search_history_list_t::iterator it =
- find(mSearchHistory.begin(), mSearchHistory.end(), search_query);
+ search_history_list_t::iterator it =
+ find(mSearchHistory.begin(), mSearchHistory.end(), search_query);
- if(mSearchHistory.end() != it)
- {
- mSearchHistory.erase(it);
- }
+ if(mSearchHistory.end() != it)
+ {
+ mSearchHistory.erase(it);
+ }
- LLSearchHistoryItem item(search_query);
- mSearchHistory.push_front(item);
+ LLSearchHistoryItem item(search_query);
+ mSearchHistory.push_front(item);
}
bool LLSearchHistory::LLSearchHistoryItem::operator < (const LLSearchHistory::LLSearchHistoryItem& right) const
{
- S32 result = LLStringUtil::compareInsensitive(search_query, right.search_query);
+ S32 result = LLStringUtil::compareInsensitive(search_query, right.search_query);
- return result < 0;
+ return result < 0;
}
bool LLSearchHistory::LLSearchHistoryItem::operator > (const LLSearchHistory::LLSearchHistoryItem& right) const
{
- S32 result = LLStringUtil::compareInsensitive(search_query, right.search_query);
+ S32 result = LLStringUtil::compareInsensitive(search_query, right.search_query);
- return result > 0;
+ return result > 0;
}
bool LLSearchHistory::LLSearchHistoryItem::operator==(const LLSearchHistory::LLSearchHistoryItem& right) const
{
- return 0 == LLStringUtil::compareInsensitive(search_query, right.search_query);
+ return 0 == LLStringUtil::compareInsensitive(search_query, right.search_query);
}
bool LLSearchHistory::LLSearchHistoryItem::operator==(const std::string& right) const
{
- return 0 == LLStringUtil::compareInsensitive(search_query, right);
+ return 0 == LLStringUtil::compareInsensitive(search_query, right);
}
LLSD LLSearchHistory::LLSearchHistoryItem::toLLSD() const
{
- LLSD ret;
- ret[SEARCH_QUERY] = search_query;
- return ret;
+ LLSD ret;
+ ret[SEARCH_QUERY] = search_query;
+ return ret;
}
diff --git a/indra/newview/llsearchhistory.h b/indra/newview/llsearchhistory.h
index 4ae6122396..1c4ece890c 100644
--- a/indra/newview/llsearchhistory.h
+++ b/indra/newview/llsearchhistory.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsearchhistory.h
* @brief Search history container definition
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,104 +37,104 @@
*/
class LLSearchHistory : public LLSingleton<LLSearchHistory>, private LLDestroyClass<LLSearchHistory>
{
- LLSINGLETON(LLSearchHistory);
- friend class LLDestroyClass<LLSearchHistory>;
+ LLSINGLETON(LLSearchHistory);
+ friend class LLDestroyClass<LLSearchHistory>;
public:
- // Forward declaration
- class LLSearchHistoryItem;
+ // Forward declaration
+ class LLSearchHistoryItem;
- // Search history container
- typedef std::list<LLSearchHistoryItem> search_history_list_t;
+ // Search history container
+ typedef std::list<LLSearchHistoryItem> search_history_list_t;
- /**
- * Saves search history to file
- */
- bool save();
+ /**
+ * Saves search history to file
+ */
+ bool save();
- /**
- * loads search history from file
- */
- bool load();
+ /**
+ * loads search history from file
+ */
+ bool load();
- /**
- * Returns search history list
- */
- search_history_list_t& getSearchHistoryList() { return mSearchHistory; }
+ /**
+ * Returns search history list
+ */
+ search_history_list_t& getSearchHistoryList() { return mSearchHistory; }
- /**
- * Deletes all search history queries from list.
- */
- void clearHistory() { mSearchHistory.clear(); }
+ /**
+ * Deletes all search history queries from list.
+ */
+ void clearHistory() { mSearchHistory.clear(); }
- /**
- * Adds unique entry to front of search history list, case insensitive
- * If entry is already in list, it will be deleted and added to front.
- */
- void addEntry(const std::string& search_text);
+ /**
+ * Adds unique entry to front of search history list, case insensitive
+ * If entry is already in list, it will be deleted and added to front.
+ */
+ void addEntry(const std::string& search_text);
- /**
- * Class for storing data about single search request.
- */
- class LLSearchHistoryItem
- {
- public:
+ /**
+ * Class for storing data about single search request.
+ */
+ class LLSearchHistoryItem
+ {
+ public:
- LLSearchHistoryItem()
- {}
+ LLSearchHistoryItem()
+ {}
- LLSearchHistoryItem(const std::string& query)
- : search_query(query)
- {}
+ LLSearchHistoryItem(const std::string& query)
+ : search_query(query)
+ {}
- LLSearchHistoryItem(const LLSD& item)
- {
- if(item.has(SEARCH_QUERY))
- search_query = item[SEARCH_QUERY].asString();
- }
+ LLSearchHistoryItem(const LLSD& item)
+ {
+ if(item.has(SEARCH_QUERY))
+ search_query = item[SEARCH_QUERY].asString();
+ }
- std::string search_query;
+ std::string search_query;
- /**
- * Allows std::list sorting
- */
- bool operator < (const LLSearchHistory::LLSearchHistoryItem& right) const;
+ /**
+ * Allows std::list sorting
+ */
+ bool operator < (const LLSearchHistory::LLSearchHistoryItem& right) const;
- /**
- * Allows std::list sorting
- */
- bool operator > (const LLSearchHistory::LLSearchHistoryItem& right) const;
+ /**
+ * Allows std::list sorting
+ */
+ bool operator > (const LLSearchHistory::LLSearchHistoryItem& right) const;
- bool operator==(const LLSearchHistoryItem& right) const;
+ bool operator==(const LLSearchHistoryItem& right) const;
- bool operator==(const std::string& right) const;
+ bool operator==(const std::string& right) const;
- /**
- * Serializes search history item to LLSD
- */
- LLSD toLLSD() const;
- };
+ /**
+ * Serializes search history item to LLSD
+ */
+ LLSD toLLSD() const;
+ };
protected:
- /**
- * Returns path to search history file.
- */
- std::string getHistoryFilePath();
+ /**
+ * Returns path to search history file.
+ */
+ std::string getHistoryFilePath();
- static std::string SEARCH_HISTORY_FILE_NAME;
- static std::string SEARCH_QUERY;
+ static std::string SEARCH_HISTORY_FILE_NAME;
+ static std::string SEARCH_QUERY;
private:
- // Implementation of LLDestroyClass<LLSearchHistory>
- static void destroyClass()
- {
- LLSearchHistory::getInstance()->save();
- }
+ // Implementation of LLDestroyClass<LLSearchHistory>
+ static void destroyClass()
+ {
+ LLSearchHistory::getInstance()->save();
+ }
- search_history_list_t mSearchHistory;
+ search_history_list_t mSearchHistory;
};
class LLSearchComboBox;
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index aba8ca5a4a..85c7451d8a 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsecapi.cpp
* @brief Security API for services such as certificate handling
* secure local storage, etc.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,37 +42,37 @@ LLPointer<LLSecAPIHandler> gSecAPIHandler;
void initializeSecHandler()
{
- ERR_load_crypto_strings();
- OpenSSL_add_all_algorithms();
-
- gHandlerMap[BASIC_SECHANDLER] = new LLSecAPIBasicHandler();
-
-
- // Currently, we only have the Basic handler, so we can point the main sechandler
- // pointer to the basic handler. Later, we'll create a wrapper handler that
- // selects the appropriate sechandler as needed, for instance choosing the
- // mac keyring handler, with fallback to the basic sechandler
- gSecAPIHandler = gHandlerMap[BASIC_SECHANDLER];
-
- // initialize all SecAPIHandlers
- std::string exception_msg;
- std::map<std::string, LLPointer<LLSecAPIHandler> >::const_iterator itr;
- for(itr = gHandlerMap.begin(); itr != gHandlerMap.end(); ++itr)
- {
- LLPointer<LLSecAPIHandler> handler = (*itr).second;
- try
- {
- handler->init();
- }
- catch (LLProtectedDataException& e)
- {
- exception_msg = e.what();
- }
- }
- if (!exception_msg.empty()) // an exception was thrown.
- {
- LLTHROW(LLProtectedDataException(exception_msg));
- }
+ ERR_load_crypto_strings();
+ OpenSSL_add_all_algorithms();
+
+ gHandlerMap[BASIC_SECHANDLER] = new LLSecAPIBasicHandler();
+
+
+ // Currently, we only have the Basic handler, so we can point the main sechandler
+ // pointer to the basic handler. Later, we'll create a wrapper handler that
+ // selects the appropriate sechandler as needed, for instance choosing the
+ // mac keyring handler, with fallback to the basic sechandler
+ gSecAPIHandler = gHandlerMap[BASIC_SECHANDLER];
+
+ // initialize all SecAPIHandlers
+ std::string exception_msg;
+ std::map<std::string, LLPointer<LLSecAPIHandler> >::const_iterator itr;
+ for(itr = gHandlerMap.begin(); itr != gHandlerMap.end(); ++itr)
+ {
+ LLPointer<LLSecAPIHandler> handler = (*itr).second;
+ try
+ {
+ handler->init();
+ }
+ catch (LLProtectedDataException& e)
+ {
+ exception_msg = e.what();
+ }
+ }
+ if (!exception_msg.empty()) // an exception was thrown.
+ {
+ LLTHROW(LLProtectedDataException(exception_msg));
+ }
}
@@ -85,80 +85,80 @@ void clearSecHandler()
// the default is used
LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type)
{
- if (gHandlerMap.find(handler_type) != gHandlerMap.end())
- {
- return gHandlerMap[handler_type];
- }
- else
- {
- return LLPointer<LLSecAPIHandler>(NULL);
- }
+ if (gHandlerMap.find(handler_type) != gHandlerMap.end())
+ {
+ return gHandlerMap[handler_type];
+ }
+ else
+ {
+ return LLPointer<LLSecAPIHandler>(NULL);
+ }
}
// register a handler
-void registerSecHandler(const std::string& handler_type,
- LLPointer<LLSecAPIHandler>& handler)
+void registerSecHandler(const std::string& handler_type,
+ LLPointer<LLSecAPIHandler>& handler)
{
- gHandlerMap[handler_type] = handler;
+ gHandlerMap[handler_type] = handler;
}
std::ostream& operator <<(std::ostream& s, const LLCredential& cred)
{
- return s << (std::string)cred;
+ return s << (std::string)cred;
}
LLSD LLCredential::getLoginParams()
{
- LLSD result = LLSD::emptyMap();
- std::string username;
- try
- {
- if (mIdentifier["type"].asString() == "agent")
- {
- // legacy credential
- result["passwd"] = "$1$" + mAuthenticator["secret"].asString();
- result["first"] = mIdentifier["first_name"];
- result["last"] = mIdentifier["last_name"];
- username = result["first"].asString() + " " + result["last"].asString();
- }
- else if (mIdentifier["type"].asString() == "account")
- {
- result["username"] = mIdentifier["account_name"];
- result["passwd"] = mAuthenticator["secret"].asString();
- username = result["username"].asString();
- }
- }
- catch (...)
- {
- // nat 2016-08-18: not clear what exceptions the above COULD throw?!
- LOG_UNHANDLED_EXCEPTION(STRINGIZE("for '" << username << "'"));
- // we could have corrupt data, so simply return a null login param if so
- LL_WARNS("AppInit") << "Invalid credential" << LL_ENDL;
- }
- return result;
+ LLSD result = LLSD::emptyMap();
+ std::string username;
+ try
+ {
+ if (mIdentifier["type"].asString() == "agent")
+ {
+ // legacy credential
+ result["passwd"] = "$1$" + mAuthenticator["secret"].asString();
+ result["first"] = mIdentifier["first_name"];
+ result["last"] = mIdentifier["last_name"];
+ username = result["first"].asString() + " " + result["last"].asString();
+ }
+ else if (mIdentifier["type"].asString() == "account")
+ {
+ result["username"] = mIdentifier["account_name"];
+ result["passwd"] = mAuthenticator["secret"].asString();
+ username = result["username"].asString();
+ }
+ }
+ catch (...)
+ {
+ // nat 2016-08-18: not clear what exceptions the above COULD throw?!
+ LOG_UNHANDLED_EXCEPTION(STRINGIZE("for '" << username << "'"));
+ // we could have corrupt data, so simply return a null login param if so
+ LL_WARNS("AppInit") << "Invalid credential" << LL_ENDL;
+ }
+ return result;
}
void LLCredential::identifierType(std::string &idType)
{
- if(mIdentifier.has("type"))
- {
- idType = mIdentifier["type"].asString();
- }
- else {
- idType = std::string();
-
- }
+ if(mIdentifier.has("type"))
+ {
+ idType = mIdentifier["type"].asString();
+ }
+ else {
+ idType = std::string();
+
+ }
}
void LLCredential::authenticatorType(std::string &idType)
{
- if(mAuthenticator.has("type"))
- {
- idType = mAuthenticator["type"].asString();
- }
- else {
- idType = std::string();
-
- }
+ if(mAuthenticator.has("type"))
+ {
+ idType = mAuthenticator["type"].asString();
+ }
+ else {
+ idType = std::string();
+
+ }
}
LLCertException::LLCertException(const LLSD& cert_data, const std::string& msg)
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index d8831fee93..5cc78d09dc 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsecapi.h
* @brief Security API for services such as certificate handling
* secure local storage, etc.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,12 +44,12 @@
#define CERT_SUBJECT_NAME "subject_name"
#define CERT_ISSUER_NAME "issuer_name"
#define CERT_NAME_CN "commonName"
-
+
#define CERT_SUBJECT_NAME_STRING "subject_name_string"
#define CERT_ISSUER_NAME_STRING "issuer_name_string"
-
+
#define CERT_SERIAL_NUMBER "serial_number"
-
+
#define CERT_VALID_FROM "valid_from"
#define CERT_VALID_TO "valid_to"
#define CERT_SHA1_DIGEST "sha1_digest"
@@ -83,7 +83,7 @@
#define CERT_AUTHORITY_KEY_IDENTIFIER_NAME "authorityKeyIdentifierName"
#define CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL "authorityKeyIdentifierSerial"
-// validate the current time lies within
+// validate the current time lies within
// the validation period of the cert
#define VALIDATION_POLICY_TIME 1
@@ -120,11 +120,11 @@
struct LLProtectedDataException: public LLException
{
- LLProtectedDataException(const std::string& msg):
- LLException(msg)
- {
- LL_WARNS("SECAPI") << "Protected Data Error: " << msg << LL_ENDL;
- }
+ LLProtectedDataException(const std::string& msg):
+ LLException(msg)
+ {
+ LL_WARNS("SECAPI") << "Protected Data Error: " << msg << LL_ENDL;
+ }
};
// class LLCertificate
@@ -134,25 +134,25 @@ struct LLProtectedDataException: public LLException
// factory calls
class LLCertificate : public LLThreadSafeRefCount
{
- LOG_CLASS(LLCertificate);
+ LOG_CLASS(LLCertificate);
public:
- LLCertificate() {}
-
- virtual ~LLCertificate() {}
-
- // return a PEM encoded certificate. The encoding
- // includes the -----BEGIN CERTIFICATE----- and end certificate elements
- virtual std::string getPem() const=0;
-
- // return a DER encoded certificate
- virtual std::vector<U8> getBinary() const=0;
-
- // return an LLSD object containing information about the certificate
- // such as its name, signature, expiry time, serial number
- virtual void getLLSD(LLSD& llsd)=0;
-
- // return an openSSL X509 struct for the certificate
- virtual X509* getOpenSSLX509() const=0;
+ LLCertificate() {}
+
+ virtual ~LLCertificate() {}
+
+ // return a PEM encoded certificate. The encoding
+ // includes the -----BEGIN CERTIFICATE----- and end certificate elements
+ virtual std::string getPem() const=0;
+
+ // return a DER encoded certificate
+ virtual std::vector<U8> getBinary() const=0;
+
+ // return an LLSD object containing information about the certificate
+ // such as its name, signature, expiry time, serial number
+ virtual void getLLSD(LLSD& llsd)=0;
+
+ // return an openSSL X509 struct for the certificate
+ virtual X509* getOpenSSLX509() const=0;
};
@@ -162,81 +162,81 @@ public:
class LLCertificateVector : public LLThreadSafeRefCount
{
-
+
public:
-
- LLCertificateVector() {};
- virtual ~LLCertificateVector() {};
-
- // base iterator implementation class, providing
- // the functionality needed for the iterator class.
- class iterator_impl : public LLThreadSafeRefCount
- {
- public:
- iterator_impl() {};
- virtual ~iterator_impl() {};
- virtual void seek(bool incr)=0;
- virtual LLPointer<iterator_impl> clone() const=0;
- virtual bool equals(const LLPointer<iterator_impl>& _iter) const=0;
- virtual LLPointer<LLCertificate> get()=0;
- };
-
- // iterator class
- class iterator
- {
- public:
- iterator(LLPointer<iterator_impl> impl) : mImpl(impl) {}
- iterator() : mImpl(NULL) {}
- iterator(const iterator& _iter) {mImpl = _iter.mImpl->clone(); }
- ~iterator() {}
- iterator& operator++() { if(mImpl.notNull()) mImpl->seek(true); return *this;}
- iterator& operator--() { if(mImpl.notNull()) mImpl->seek(false); return *this;}
-
- iterator operator++(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(true); return result;}
- iterator operator--(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(false); return result;}
- LLPointer<LLCertificate> operator*() { return mImpl->get(); }
-
- LLPointer<iterator_impl> mImpl;
- protected:
- friend bool operator==(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs);
- bool equals(const iterator& _iter) const { return mImpl->equals(_iter.mImpl); }
- };
-
- // numeric indexer
- virtual LLPointer<LLCertificate> operator[](int)=0;
-
- // Iteration
- virtual iterator begin()=0;
-
- virtual iterator end()=0;
-
- // find a cert given params
- virtual iterator find(const LLSD& params) =0;
-
- // return the number of certs in the store
- virtual int size() const = 0;
-
- // append the cert to the store. if a copy of the cert already exists in the store, it is removed first
- virtual void add(LLPointer<LLCertificate> cert)=0;
-
- // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first
- virtual void insert(iterator location, LLPointer<LLCertificate> cert)=0;
-
- // remove a certificate from the store
- virtual LLPointer<LLCertificate> erase(iterator cert)=0;
+
+ LLCertificateVector() {};
+ virtual ~LLCertificateVector() {};
+
+ // base iterator implementation class, providing
+ // the functionality needed for the iterator class.
+ class iterator_impl : public LLThreadSafeRefCount
+ {
+ public:
+ iterator_impl() {};
+ virtual ~iterator_impl() {};
+ virtual void seek(bool incr)=0;
+ virtual LLPointer<iterator_impl> clone() const=0;
+ virtual bool equals(const LLPointer<iterator_impl>& _iter) const=0;
+ virtual LLPointer<LLCertificate> get()=0;
+ };
+
+ // iterator class
+ class iterator
+ {
+ public:
+ iterator(LLPointer<iterator_impl> impl) : mImpl(impl) {}
+ iterator() : mImpl(NULL) {}
+ iterator(const iterator& _iter) {mImpl = _iter.mImpl->clone(); }
+ ~iterator() {}
+ iterator& operator++() { if(mImpl.notNull()) mImpl->seek(true); return *this;}
+ iterator& operator--() { if(mImpl.notNull()) mImpl->seek(false); return *this;}
+
+ iterator operator++(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(true); return result;}
+ iterator operator--(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(false); return result;}
+ LLPointer<LLCertificate> operator*() { return mImpl->get(); }
+
+ LLPointer<iterator_impl> mImpl;
+ protected:
+ friend bool operator==(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs);
+ bool equals(const iterator& _iter) const { return mImpl->equals(_iter.mImpl); }
+ };
+
+ // numeric indexer
+ virtual LLPointer<LLCertificate> operator[](int)=0;
+
+ // Iteration
+ virtual iterator begin()=0;
+
+ virtual iterator end()=0;
+
+ // find a cert given params
+ virtual iterator find(const LLSD& params) =0;
+
+ // return the number of certs in the store
+ virtual int size() const = 0;
+
+ // append the cert to the store. if a copy of the cert already exists in the store, it is removed first
+ virtual void add(LLPointer<LLCertificate> cert)=0;
+
+ // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first
+ virtual void insert(iterator location, LLPointer<LLCertificate> cert)=0;
+
+ // remove a certificate from the store
+ virtual LLPointer<LLCertificate> erase(iterator cert)=0;
};
// class LLCertificateChain
-// Class representing a chain of certificates in order, with the
+// Class representing a chain of certificates in order, with the
// first element being the child cert.
class LLCertificateChain : virtual public LLCertificateVector
-{
-
+{
+
public:
- LLCertificateChain() {}
-
- virtual ~LLCertificateChain() {}
-
+ LLCertificateChain() {}
+
+ virtual ~LLCertificateChain() {}
+
};
// class LLCertificateStore
@@ -246,24 +246,24 @@ public:
//
class LLCertificateStore : virtual public LLCertificateVector
{
-
+
public:
-
- LLCertificateStore() {}
- virtual ~LLCertificateStore() {}
-
- // persist the store
- virtual void save()=0;
-
- // return the store id
- virtual std::string storeId() const=0;
-
- // validate a certificate chain given the params.
- // Will throw exceptions on error
-
- virtual void validate(int validation_policy,
- LLPointer<LLCertificateChain> cert_chain,
- const LLSD& validation_params) =0;
+
+ LLCertificateStore() {}
+ virtual ~LLCertificateStore() {}
+
+ // persist the store
+ virtual void save()=0;
+
+ // return the store id
+ virtual std::string storeId() const=0;
+
+ // validate a certificate chain given the params.
+ // Will throw exceptions on error
+
+ virtual void validate(int validation_policy,
+ LLPointer<LLCertificateChain> cert_chain,
+ const LLSD& validation_params) =0;
// Clear cache if any
virtual void clearSertCache()=0;
@@ -273,12 +273,12 @@ public:
inline
bool operator==(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs)
{
- return _lhs.equals(_rhs);
+ return _lhs.equals(_rhs);
}
inline
bool operator!=(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs)
{
- return !(_lhs == _rhs);
+ return !(_lhs == _rhs);
}
@@ -290,43 +290,43 @@ bool operator!=(const LLCertificateVector::iterator& _lhs, const LLCertificateVe
// LLCredential - interface for credentials providing the following functionality:
// * Persistence of credential information based on grid (for saving username/password)
// * Serialization to an OGP identifier/authenticator pair
-//
+//
class LLCredential : public LLThreadSafeRefCount
{
public:
-
- LLCredential() {}
-
- LLCredential(const std::string& grid)
- {
- mGrid = grid;
- mIdentifier = LLSD::emptyMap();
- mAuthenticator = LLSD::emptyMap();
- }
-
- virtual ~LLCredential() {}
-
- virtual void setCredentialData(const LLSD& identifier, const LLSD& authenticator)
- {
- mIdentifier = identifier;
- mAuthenticator = authenticator;
- }
- virtual LLSD getIdentifier() { return mIdentifier; }
- virtual void identifierType(std::string& idType);
- virtual LLSD getAuthenticator() { return mAuthenticator; }
- virtual void authenticatorType(std::string& authType);
- virtual LLSD getLoginParams();
- virtual std::string getGrid() { return mGrid; }
-
-
- virtual void clearAuthenticator() { mAuthenticator = LLSD(); }
- virtual std::string userID() const { return std::string("unknown");}
- virtual std::string asString() const { return std::string("unknown");}
- operator std::string() const { return asString(); }
+
+ LLCredential() {}
+
+ LLCredential(const std::string& grid)
+ {
+ mGrid = grid;
+ mIdentifier = LLSD::emptyMap();
+ mAuthenticator = LLSD::emptyMap();
+ }
+
+ virtual ~LLCredential() {}
+
+ virtual void setCredentialData(const LLSD& identifier, const LLSD& authenticator)
+ {
+ mIdentifier = identifier;
+ mAuthenticator = authenticator;
+ }
+ virtual LLSD getIdentifier() { return mIdentifier; }
+ virtual void identifierType(std::string& idType);
+ virtual LLSD getAuthenticator() { return mAuthenticator; }
+ virtual void authenticatorType(std::string& authType);
+ virtual LLSD getLoginParams();
+ virtual std::string getGrid() { return mGrid; }
+
+
+ virtual void clearAuthenticator() { mAuthenticator = LLSD(); }
+ virtual std::string userID() const { return std::string("unknown");}
+ virtual std::string asString() const { return std::string("unknown");}
+ operator std::string() const { return asString(); }
protected:
- LLSD mIdentifier;
- LLSD mAuthenticator;
- std::string mGrid;
+ LLSD mIdentifier;
+ LLSD mAuthenticator;
+ std::string mGrid;
};
std::ostream& operator <<(std::ostream& s, const LLCredential& cred);
@@ -338,10 +338,10 @@ class LLCertException: public LLException
{
public:
LLCertException(const LLSD& cert_data, const std::string& msg);
- virtual ~LLCertException() throw() {}
- LLSD getCertData() const { return mCertData; }
+ virtual ~LLCertException() throw() {}
+ LLSD getCertData() const { return mCertData; }
protected:
- LLSD mCertData;
+ LLSD mCertData;
};
class LLAllocationCertException : public LLCertException
@@ -357,78 +357,78 @@ protected:
class LLInvalidCertificate : public LLCertException
{
public:
- LLInvalidCertificate(const LLSD& cert_data) : LLCertException(cert_data, "CertInvalid")
- {
- }
- virtual ~LLInvalidCertificate() throw() {}
+ LLInvalidCertificate(const LLSD& cert_data) : LLCertException(cert_data, "CertInvalid")
+ {
+ }
+ virtual ~LLInvalidCertificate() throw() {}
protected:
};
class LLCertValidationTrustException : public LLCertException
{
public:
- LLCertValidationTrustException(const LLSD& cert_data) : LLCertException(cert_data, "CertUntrusted")
- {
- }
- virtual ~LLCertValidationTrustException() throw() {}
+ LLCertValidationTrustException(const LLSD& cert_data) : LLCertException(cert_data, "CertUntrusted")
+ {
+ }
+ virtual ~LLCertValidationTrustException() throw() {}
protected:
};
class LLCertValidationHostnameException : public LLCertException
{
public:
- LLCertValidationHostnameException(std::string hostname,
- const LLSD& cert_data) : LLCertException(cert_data, "CertInvalidHostname")
- {
- mHostname = hostname;
- }
- virtual ~LLCertValidationHostnameException() throw() {}
- std::string getHostname() { return mHostname; }
+ LLCertValidationHostnameException(std::string hostname,
+ const LLSD& cert_data) : LLCertException(cert_data, "CertInvalidHostname")
+ {
+ mHostname = hostname;
+ }
+ virtual ~LLCertValidationHostnameException() throw() {}
+ std::string getHostname() { return mHostname; }
protected:
- std::string mHostname;
+ std::string mHostname;
};
class LLCertValidationExpirationException : public LLCertException
{
public:
- LLCertValidationExpirationException(const LLSD& cert_data,
- LLDate current_time) : LLCertException(cert_data, "CertExpired")
- {
- mTime = current_time;
- }
- virtual ~LLCertValidationExpirationException() throw() {}
- LLDate GetTime() { return mTime; }
+ LLCertValidationExpirationException(const LLSD& cert_data,
+ LLDate current_time) : LLCertException(cert_data, "CertExpired")
+ {
+ mTime = current_time;
+ }
+ virtual ~LLCertValidationExpirationException() throw() {}
+ LLDate GetTime() { return mTime; }
protected:
- LLDate mTime;
+ LLDate mTime;
};
class LLCertKeyUsageValidationException : public LLCertException
{
public:
- LLCertKeyUsageValidationException(const LLSD& cert_data) : LLCertException(cert_data, "CertKeyUsage")
- {
- }
- virtual ~LLCertKeyUsageValidationException() throw() {}
+ LLCertKeyUsageValidationException(const LLSD& cert_data) : LLCertException(cert_data, "CertKeyUsage")
+ {
+ }
+ virtual ~LLCertKeyUsageValidationException() throw() {}
protected:
};
class LLCertBasicConstraintsValidationException : public LLCertException
{
public:
- LLCertBasicConstraintsValidationException(const LLSD& cert_data) : LLCertException(cert_data, "CertBasicConstraints")
- {
- }
- virtual ~LLCertBasicConstraintsValidationException() throw() {}
+ LLCertBasicConstraintsValidationException(const LLSD& cert_data) : LLCertException(cert_data, "CertBasicConstraints")
+ {
+ }
+ virtual ~LLCertBasicConstraintsValidationException() throw() {}
protected:
};
class LLCertValidationInvalidSignatureException : public LLCertException
{
public:
- LLCertValidationInvalidSignatureException(const LLSD& cert_data) : LLCertException(cert_data, "CertInvalidSignature")
- {
- }
- virtual ~LLCertValidationInvalidSignatureException() throw() {}
+ LLCertValidationInvalidSignatureException(const LLSD& cert_data) : LLCertException(cert_data, "CertInvalidSignature")
+ {
+ }
+ virtual ~LLCertValidationInvalidSignatureException() throw() {}
protected:
};
@@ -437,115 +437,115 @@ protected:
class LLSecAPIHandler : public LLThreadSafeRefCount
{
public:
-
-
- LLSecAPIHandler() {}
- virtual ~LLSecAPIHandler() {}
-
- // initialize the SecAPIHandler
- virtual void init() {};
-
- // instantiate a certificate from a pem string
- virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert)=0;
-
-
-
- // instiate a certificate from an openssl X509 structure
- virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert)=0;
-
- // instantiate a chain from an X509_STORE_CTX
- virtual LLPointer<LLCertificateChain> getCertificateChain(X509_STORE_CTX* chain)=0;
-
- // instantiate a cert store given it's id. if a persisted version
- // exists, it'll be loaded. If not, one will be created (but not
- // persisted)
- virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id)=0;
-
- // persist data in a protected store
- virtual void setProtectedData(const std::string& data_type,
- const std::string& data_id,
- const LLSD& data)=0;
-
- // retrieve protected data
- virtual LLSD getProtectedData(const std::string& data_type,
- const std::string& data_id)=0;
-
- // delete a protected data item from the store
- virtual void deleteProtectedData(const std::string& data_type,
- const std::string& data_id)=0;
-
- // persist data in a protected store's map
- virtual void addToProtectedMap(const std::string& data_type,
- const std::string& data_id,
- const std::string& map_elem,
- const LLSD& data)=0;
-
- // remove data from protected store's map
- virtual void removeFromProtectedMap(const std::string& data_type,
- const std::string& data_id,
- const std::string& map_elem)=0;
-
- // ensure protected store's map is written to storage
- virtual void syncProtectedMap() = 0;
+
+
+ LLSecAPIHandler() {}
+ virtual ~LLSecAPIHandler() {}
+
+ // initialize the SecAPIHandler
+ virtual void init() {};
+
+ // instantiate a certificate from a pem string
+ virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert)=0;
+
+
+
+ // instiate a certificate from an openssl X509 structure
+ virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert)=0;
+
+ // instantiate a chain from an X509_STORE_CTX
+ virtual LLPointer<LLCertificateChain> getCertificateChain(X509_STORE_CTX* chain)=0;
+
+ // instantiate a cert store given it's id. if a persisted version
+ // exists, it'll be loaded. If not, one will be created (but not
+ // persisted)
+ virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id)=0;
+
+ // persist data in a protected store
+ virtual void setProtectedData(const std::string& data_type,
+ const std::string& data_id,
+ const LLSD& data)=0;
+
+ // retrieve protected data
+ virtual LLSD getProtectedData(const std::string& data_type,
+ const std::string& data_id)=0;
+
+ // delete a protected data item from the store
+ virtual void deleteProtectedData(const std::string& data_type,
+ const std::string& data_id)=0;
+
+ // persist data in a protected store's map
+ virtual void addToProtectedMap(const std::string& data_type,
+ const std::string& data_id,
+ const std::string& map_elem,
+ const LLSD& data)=0;
+
+ // remove data from protected store's map
+ virtual void removeFromProtectedMap(const std::string& data_type,
+ const std::string& data_id,
+ const std::string& map_elem)=0;
+
+ // ensure protected store's map is written to storage
+ virtual void syncProtectedMap() = 0;
public:
- virtual LLPointer<LLCredential> createCredential(const std::string& grid,
- const LLSD& identifier,
- const LLSD& authenticator)=0;
-
- virtual LLPointer<LLCredential> loadCredential(const std::string& grid)=0;
-
- virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)=0;
-
- virtual void deleteCredential(LLPointer<LLCredential> cred)=0;
-
- // has map of credentials declared as specific storage
- virtual bool hasCredentialMap(const std::string& storage,
- const std::string& grid)=0;
-
- // returns true if map is empty or does not exist
- virtual bool emptyCredentialMap(const std::string& storage,
- const std::string& grid)=0;
-
- // load map of credentials from specific storage
- typedef std::map<std::string, LLPointer<LLCredential> > credential_map_t;
- virtual void loadCredentialMap(const std::string& storage,
- const std::string& grid,
- credential_map_t& credential_map)=0;
-
- // load single username from map of credentials from specific storage
- virtual LLPointer<LLCredential> loadFromCredentialMap(const std::string& storage,
- const std::string& grid,
- const std::string& userid)=0;
-
- // add item to map of credentials from specific storage
- virtual void addToCredentialMap(const std::string& storage,
- LLPointer<LLCredential> cred,
- bool save_authenticator)=0;
-
- // remove item from map of credentials from specific storage
- virtual void removeFromCredentialMap(const std::string& storage,
- LLPointer<LLCredential> cred)=0;
-
- // remove item from map of credentials from specific storage
- virtual void removeFromCredentialMap(const std::string& storage,
- const std::string& grid,
- const std::string& userid)=0;
-
- virtual void removeCredentialMap(const std::string& storage,
- const std::string& grid)=0;
-
+ virtual LLPointer<LLCredential> createCredential(const std::string& grid,
+ const LLSD& identifier,
+ const LLSD& authenticator)=0;
+
+ virtual LLPointer<LLCredential> loadCredential(const std::string& grid)=0;
+
+ virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)=0;
+
+ virtual void deleteCredential(LLPointer<LLCredential> cred)=0;
+
+ // has map of credentials declared as specific storage
+ virtual bool hasCredentialMap(const std::string& storage,
+ const std::string& grid)=0;
+
+ // returns true if map is empty or does not exist
+ virtual bool emptyCredentialMap(const std::string& storage,
+ const std::string& grid)=0;
+
+ // load map of credentials from specific storage
+ typedef std::map<std::string, LLPointer<LLCredential> > credential_map_t;
+ virtual void loadCredentialMap(const std::string& storage,
+ const std::string& grid,
+ credential_map_t& credential_map)=0;
+
+ // load single username from map of credentials from specific storage
+ virtual LLPointer<LLCredential> loadFromCredentialMap(const std::string& storage,
+ const std::string& grid,
+ const std::string& userid)=0;
+
+ // add item to map of credentials from specific storage
+ virtual void addToCredentialMap(const std::string& storage,
+ LLPointer<LLCredential> cred,
+ bool save_authenticator)=0;
+
+ // remove item from map of credentials from specific storage
+ virtual void removeFromCredentialMap(const std::string& storage,
+ LLPointer<LLCredential> cred)=0;
+
+ // remove item from map of credentials from specific storage
+ virtual void removeFromCredentialMap(const std::string& storage,
+ const std::string& grid,
+ const std::string& userid)=0;
+
+ virtual void removeCredentialMap(const std::string& storage,
+ const std::string& grid)=0;
+
};
void initializeSecHandler();
void clearSecHandler();
-
+
// retrieve a security api depending on the api type
LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type);
-void registerSecHandler(const std::string& handler_type,
- LLPointer<LLSecAPIHandler>& handler);
+void registerSecHandler(const std::string& handler_type,
+ LLPointer<LLSecAPIHandler>& handler);
extern LLPointer<LLSecAPIHandler> gSecAPIHandler;
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 8e8f2f4fe0..da7eff7f54 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsechandler_basic.cpp
* @brief Security API for services such as certificate handling
* secure local storage, etc.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,7 +55,7 @@
static const std::string DEFAULT_CREDENTIAL_STORAGE = "credential";
// 128 bits of salt data...
-#define STORE_SALT_SIZE 16
+#define STORE_SALT_SIZE 16
#define BUFFER_READ_SIZE 256
std::string cert_string_from_asn1_string(ASN1_STRING* value);
std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value);
@@ -71,300 +71,300 @@ void _validateCert(int validation_policy,
int depth);
LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert,
- const LLSD* validation_params)
+ const LLSD* validation_params)
{
- // BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const
- // so we need to cast it.
- BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length());
- if(pem_bio == NULL)
- {
+ // BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const
+ // so we need to cast it.
+ BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length());
+ if(pem_bio == NULL)
+ {
LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
LLTHROW(LLAllocationCertException(LLSD::emptyMap()));
- }
- mCert = NULL;
- PEM_read_bio_X509(pem_bio, &mCert, 0, NULL);
- BIO_free(pem_bio);
- if (!mCert)
- {
+ }
+ mCert = NULL;
+ PEM_read_bio_X509(pem_bio, &mCert, 0, NULL);
+ BIO_free(pem_bio);
+ if (!mCert)
+ {
LL_WARNS("SECAPI") << "Could not decode certificate to x509." << LL_ENDL;
LLTHROW(LLInvalidCertificate(LLSD::emptyMap()));
- }
+ }
}
LLBasicCertificate::LLBasicCertificate(X509* pCert,
- const LLSD* validation_params)
+ const LLSD* validation_params)
{
- if (!pCert)
- {
- LLTHROW(LLInvalidCertificate(LLSD::emptyMap()));
- }
- mCert = X509_dup(pCert);
+ if (!pCert)
+ {
+ LLTHROW(LLInvalidCertificate(LLSD::emptyMap()));
+ }
+ mCert = X509_dup(pCert);
// it is tempting to run _validateCert here, but doing so causes problems
// the trick is figuring out which aspects to validate. TBD
}
-LLBasicCertificate::~LLBasicCertificate()
+LLBasicCertificate::~LLBasicCertificate()
{
- if(mCert)
- {
- X509_free(mCert);
+ if(mCert)
+ {
+ X509_free(mCert);
mCert = NULL;
- }
+ }
}
//
// retrieve the pem using the openssl functionality
std::string LLBasicCertificate::getPem() const
-{
- char * pem_bio_chars = NULL;
- // a BIO is the equivalent of a 'std::stream', and
- // can be a file, mem stream, whatever. Grab a memory based
- // BIO for the result
- BIO *pem_bio = BIO_new(BIO_s_mem());
- if (!pem_bio)
- {
- LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
- return std::string();
- }
- PEM_write_bio_X509(pem_bio, mCert);
- int length = BIO_get_mem_data(pem_bio, &pem_bio_chars);
- std::string result = std::string(pem_bio_chars, length);
- BIO_free(pem_bio);
- return result;
+{
+ char * pem_bio_chars = NULL;
+ // a BIO is the equivalent of a 'std::stream', and
+ // can be a file, mem stream, whatever. Grab a memory based
+ // BIO for the result
+ BIO *pem_bio = BIO_new(BIO_s_mem());
+ if (!pem_bio)
+ {
+ LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
+ return std::string();
+ }
+ PEM_write_bio_X509(pem_bio, mCert);
+ int length = BIO_get_mem_data(pem_bio, &pem_bio_chars);
+ std::string result = std::string(pem_bio_chars, length);
+ BIO_free(pem_bio);
+ return result;
}
// get the DER encoding for the cert
// DER is a binary encoding format for certs...
std::vector<U8> LLBasicCertificate::getBinary() const
-{
- U8 * der_bio_data = NULL;
- // get a memory bio
- BIO *der_bio = BIO_new(BIO_s_mem());
- if (!der_bio)
- {
- LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
- return std::vector<U8>();
- }
- i2d_X509_bio(der_bio, mCert);
- int length = BIO_get_mem_data(der_bio, &der_bio_data);
- std::vector<U8> result(length);
- // vectors are guranteed to be a contiguous chunk of memory.
- memcpy(&result[0], der_bio_data, length);
- BIO_free(der_bio);
- return result;
+{
+ U8 * der_bio_data = NULL;
+ // get a memory bio
+ BIO *der_bio = BIO_new(BIO_s_mem());
+ if (!der_bio)
+ {
+ LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
+ return std::vector<U8>();
+ }
+ i2d_X509_bio(der_bio, mCert);
+ int length = BIO_get_mem_data(der_bio, &der_bio_data);
+ std::vector<U8> result(length);
+ // vectors are guranteed to be a contiguous chunk of memory.
+ memcpy(&result[0], der_bio_data, length);
+ BIO_free(der_bio);
+ return result;
}
void LLBasicCertificate::getLLSD(LLSD &llsd)
{
- if (mLLSDInfo.isUndefined())
- {
- _initLLSD();
- }
- llsd = mLLSDInfo;
+ if (mLLSDInfo.isUndefined())
+ {
+ _initLLSD();
+ }
+ llsd = mLLSDInfo;
}
// Initialize the LLSD info for the certificate
LLSD& LLBasicCertificate::_initLLSD()
-{
-
- // call the various helpers to build the LLSD
- mLLSDInfo[CERT_SUBJECT_NAME] = cert_name_from_X509_NAME(X509_get_subject_name(mCert));
- mLLSDInfo[CERT_ISSUER_NAME] = cert_name_from_X509_NAME(X509_get_issuer_name(mCert));
- mLLSDInfo[CERT_SUBJECT_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_subject_name(mCert));
- mLLSDInfo[CERT_ISSUER_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_issuer_name(mCert));
- ASN1_INTEGER *sn = X509_get_serialNumber(mCert);
- if (sn != NULL)
- {
- mLLSDInfo[CERT_SERIAL_NUMBER] = cert_string_from_asn1_integer(sn);
- }
-
- mLLSDInfo[CERT_VALID_TO] = cert_date_from_asn1_time(X509_get_notAfter(mCert));
- mLLSDInfo[CERT_VALID_FROM] = cert_date_from_asn1_time(X509_get_notBefore(mCert));
- // add the known extensions
- mLLSDInfo[CERT_BASIC_CONSTRAINTS] = _basic_constraints_ext(mCert);
- mLLSDInfo[CERT_KEY_USAGE] = _key_usage_ext(mCert);
- mLLSDInfo[CERT_EXTENDED_KEY_USAGE] = _ext_key_usage_ext(mCert);
- mLLSDInfo[CERT_SUBJECT_KEY_IDENTFIER] = _subject_key_identifier(mCert);
- mLLSDInfo[CERT_AUTHORITY_KEY_IDENTIFIER] = _authority_key_identifier(mCert);
- return mLLSDInfo;
+{
+
+ // call the various helpers to build the LLSD
+ mLLSDInfo[CERT_SUBJECT_NAME] = cert_name_from_X509_NAME(X509_get_subject_name(mCert));
+ mLLSDInfo[CERT_ISSUER_NAME] = cert_name_from_X509_NAME(X509_get_issuer_name(mCert));
+ mLLSDInfo[CERT_SUBJECT_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_subject_name(mCert));
+ mLLSDInfo[CERT_ISSUER_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_issuer_name(mCert));
+ ASN1_INTEGER *sn = X509_get_serialNumber(mCert);
+ if (sn != NULL)
+ {
+ mLLSDInfo[CERT_SERIAL_NUMBER] = cert_string_from_asn1_integer(sn);
+ }
+
+ mLLSDInfo[CERT_VALID_TO] = cert_date_from_asn1_time(X509_get_notAfter(mCert));
+ mLLSDInfo[CERT_VALID_FROM] = cert_date_from_asn1_time(X509_get_notBefore(mCert));
+ // add the known extensions
+ mLLSDInfo[CERT_BASIC_CONSTRAINTS] = _basic_constraints_ext(mCert);
+ mLLSDInfo[CERT_KEY_USAGE] = _key_usage_ext(mCert);
+ mLLSDInfo[CERT_EXTENDED_KEY_USAGE] = _ext_key_usage_ext(mCert);
+ mLLSDInfo[CERT_SUBJECT_KEY_IDENTFIER] = _subject_key_identifier(mCert);
+ mLLSDInfo[CERT_AUTHORITY_KEY_IDENTIFIER] = _authority_key_identifier(mCert);
+ return mLLSDInfo;
}
// Retrieve the basic constraints info
LLSD _basic_constraints_ext(X509* cert)
{
- LLSD result;
- BASIC_CONSTRAINTS *bs = (BASIC_CONSTRAINTS *)X509_get_ext_d2i(cert, NID_basic_constraints, NULL, NULL);
- if(bs)
- {
- result = LLSD::emptyMap();
- // Determines whether the cert can be used as a CA
- result[CERT_BASIC_CONSTRAINTS_CA] = (bool)bs->ca;
-
- if(bs->pathlen)
- {
- // the pathlen determines how deep a certificate chain can be from
- // this CA
- if((bs->pathlen->type == V_ASN1_NEG_INTEGER)
- || !bs->ca)
- {
- result[CERT_BASIC_CONSTRAINTS_PATHLEN] = 0;
- }
- else
- {
- result[CERT_BASIC_CONSTRAINTS_PATHLEN] = (int)ASN1_INTEGER_get(bs->pathlen);
- }
- }
-
- BASIC_CONSTRAINTS_free( bs );
- }
- return result;
+ LLSD result;
+ BASIC_CONSTRAINTS *bs = (BASIC_CONSTRAINTS *)X509_get_ext_d2i(cert, NID_basic_constraints, NULL, NULL);
+ if(bs)
+ {
+ result = LLSD::emptyMap();
+ // Determines whether the cert can be used as a CA
+ result[CERT_BASIC_CONSTRAINTS_CA] = (bool)bs->ca;
+
+ if(bs->pathlen)
+ {
+ // the pathlen determines how deep a certificate chain can be from
+ // this CA
+ if((bs->pathlen->type == V_ASN1_NEG_INTEGER)
+ || !bs->ca)
+ {
+ result[CERT_BASIC_CONSTRAINTS_PATHLEN] = 0;
+ }
+ else
+ {
+ result[CERT_BASIC_CONSTRAINTS_PATHLEN] = (int)ASN1_INTEGER_get(bs->pathlen);
+ }
+ }
+
+ BASIC_CONSTRAINTS_free( bs );
+ }
+ return result;
}
// retrieve the key usage, which specifies how the cert can be used.
-//
+//
LLSD _key_usage_ext(X509* cert)
{
- LLSD result;
- ASN1_STRING *usage_str = (ASN1_STRING *)X509_get_ext_d2i(cert, NID_key_usage, NULL, NULL);
- if(usage_str)
- {
- result = LLSD::emptyArray();
- long usage = 0;
- if(usage_str->length > 0)
- {
- usage = usage_str->data[0];
- if(usage_str->length > 1)
- {
- usage |= usage_str->data[1] << 8;
- }
- }
- ASN1_STRING_free(usage_str);
- if(usage)
- {
- if(usage & KU_DIGITAL_SIGNATURE) result.append(LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE));
- if(usage & KU_NON_REPUDIATION) result.append(LLSD((std::string)CERT_KU_NON_REPUDIATION));
- if(usage & KU_KEY_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT));
- if(usage & KU_DATA_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_DATA_ENCIPHERMENT));
- if(usage & KU_KEY_AGREEMENT) result.append(LLSD((std::string)CERT_KU_KEY_AGREEMENT));
- if(usage & KU_KEY_CERT_SIGN) result.append(LLSD((std::string)CERT_KU_CERT_SIGN));
- if(usage & KU_CRL_SIGN) result.append(LLSD((std::string)CERT_KU_CRL_SIGN));
- if(usage & KU_ENCIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_ENCIPHER_ONLY));
- if(usage & KU_DECIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_DECIPHER_ONLY));
- }
- }
- return result;
+ LLSD result;
+ ASN1_STRING *usage_str = (ASN1_STRING *)X509_get_ext_d2i(cert, NID_key_usage, NULL, NULL);
+ if(usage_str)
+ {
+ result = LLSD::emptyArray();
+ long usage = 0;
+ if(usage_str->length > 0)
+ {
+ usage = usage_str->data[0];
+ if(usage_str->length > 1)
+ {
+ usage |= usage_str->data[1] << 8;
+ }
+ }
+ ASN1_STRING_free(usage_str);
+ if(usage)
+ {
+ if(usage & KU_DIGITAL_SIGNATURE) result.append(LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE));
+ if(usage & KU_NON_REPUDIATION) result.append(LLSD((std::string)CERT_KU_NON_REPUDIATION));
+ if(usage & KU_KEY_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT));
+ if(usage & KU_DATA_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_DATA_ENCIPHERMENT));
+ if(usage & KU_KEY_AGREEMENT) result.append(LLSD((std::string)CERT_KU_KEY_AGREEMENT));
+ if(usage & KU_KEY_CERT_SIGN) result.append(LLSD((std::string)CERT_KU_CERT_SIGN));
+ if(usage & KU_CRL_SIGN) result.append(LLSD((std::string)CERT_KU_CRL_SIGN));
+ if(usage & KU_ENCIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_ENCIPHER_ONLY));
+ if(usage & KU_DECIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_DECIPHER_ONLY));
+ }
+ }
+ return result;
}
// retrieve the extended key usage for the cert
LLSD _ext_key_usage_ext(X509* cert)
{
- LLSD result;
- EXTENDED_KEY_USAGE *eku = (EXTENDED_KEY_USAGE *)X509_get_ext_d2i(cert, NID_ext_key_usage, NULL, NULL);
- if(eku)
- {
- result = LLSD::emptyArray();
- while(sk_ASN1_OBJECT_num(eku))
- {
- ASN1_OBJECT *usage = sk_ASN1_OBJECT_pop(eku);
- if(usage)
- {
- int nid = OBJ_obj2nid(usage);
- if (nid)
- {
- std::string sn = OBJ_nid2sn(nid);
- result.append(sn);
- }
- ASN1_OBJECT_free(usage);
- }
- }
-
- EXTENDED_KEY_USAGE_free( eku );
- }
- return result;
+ LLSD result;
+ EXTENDED_KEY_USAGE *eku = (EXTENDED_KEY_USAGE *)X509_get_ext_d2i(cert, NID_ext_key_usage, NULL, NULL);
+ if(eku)
+ {
+ result = LLSD::emptyArray();
+ while(sk_ASN1_OBJECT_num(eku))
+ {
+ ASN1_OBJECT *usage = sk_ASN1_OBJECT_pop(eku);
+ if(usage)
+ {
+ int nid = OBJ_obj2nid(usage);
+ if (nid)
+ {
+ std::string sn = OBJ_nid2sn(nid);
+ result.append(sn);
+ }
+ ASN1_OBJECT_free(usage);
+ }
+ }
+
+ EXTENDED_KEY_USAGE_free( eku );
+ }
+ return result;
}
// retrieve the subject key identifier of the cert
std::string _subject_key_identifier(X509 *cert)
{
std::string result;
- ASN1_OCTET_STRING *skeyid = (ASN1_OCTET_STRING *)X509_get_ext_d2i(cert, NID_subject_key_identifier, NULL, NULL);
- if(skeyid)
- {
- result = cert_string_from_octet_string(skeyid);
- ASN1_OCTET_STRING_free( skeyid );
- }
- return result;
+ ASN1_OCTET_STRING *skeyid = (ASN1_OCTET_STRING *)X509_get_ext_d2i(cert, NID_subject_key_identifier, NULL, NULL);
+ if(skeyid)
+ {
+ result = cert_string_from_octet_string(skeyid);
+ ASN1_OCTET_STRING_free( skeyid );
+ }
+ return result;
}
// retrieve the authority key identifier of the cert
LLSD _authority_key_identifier(X509* cert)
{
- LLSD result;
- AUTHORITY_KEYID *akeyid = (AUTHORITY_KEYID *)X509_get_ext_d2i(cert, NID_authority_key_identifier, NULL, NULL);
- if(akeyid)
- {
- result = LLSD::emptyMap();
- if(akeyid->keyid)
- {
- result[CERT_AUTHORITY_KEY_IDENTIFIER_ID] = cert_string_from_octet_string(akeyid->keyid);
- }
- if(akeyid->serial)
- {
- result[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL] = cert_string_from_asn1_integer(akeyid->serial);
- }
-
- AUTHORITY_KEYID_free( akeyid );
- }
- // we ignore the issuer name in the authority key identifier, we check the issue name via
- // the the issuer name entry in the cert.
- return result;
+ LLSD result;
+ AUTHORITY_KEYID *akeyid = (AUTHORITY_KEYID *)X509_get_ext_d2i(cert, NID_authority_key_identifier, NULL, NULL);
+ if(akeyid)
+ {
+ result = LLSD::emptyMap();
+ if(akeyid->keyid)
+ {
+ result[CERT_AUTHORITY_KEY_IDENTIFIER_ID] = cert_string_from_octet_string(akeyid->keyid);
+ }
+ if(akeyid->serial)
+ {
+ result[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL] = cert_string_from_asn1_integer(akeyid->serial);
+ }
+
+ AUTHORITY_KEYID_free( akeyid );
+ }
+ // we ignore the issuer name in the authority key identifier, we check the issue name via
+ // the the issuer name entry in the cert.
+ return result;
}
// retrieve an openssl x509 object,
// which must be freed by X509_free
X509* LLBasicCertificate::getOpenSSLX509() const
-{
- return X509_dup(mCert);
-}
+{
+ return X509_dup(mCert);
+}
// generate a single string containing the subject or issuer
// name of the cert.
std::string cert_string_name_from_X509_NAME(X509_NAME* name)
{
- char * name_bio_chars = NULL;
- // get a memory bio
- BIO *name_bio = BIO_new(BIO_s_mem());
- // stream the name into the bio. The name will be in the 'short name' format
- X509_NAME_print_ex(name_bio, name, 0, XN_FLAG_RFC2253);
- int length = BIO_get_mem_data(name_bio, &name_bio_chars);
- std::string result = std::string(name_bio_chars, length);
- BIO_free(name_bio);
- return result;
+ char * name_bio_chars = NULL;
+ // get a memory bio
+ BIO *name_bio = BIO_new(BIO_s_mem());
+ // stream the name into the bio. The name will be in the 'short name' format
+ X509_NAME_print_ex(name_bio, name, 0, XN_FLAG_RFC2253);
+ int length = BIO_get_mem_data(name_bio, &name_bio_chars);
+ std::string result = std::string(name_bio_chars, length);
+ BIO_free(name_bio);
+ return result;
}
-// generate an LLSD from a certificate name (issuer or subject name).
+// generate an LLSD from a certificate name (issuer or subject name).
// the name will be strings indexed by the 'long form'
LLSD cert_name_from_X509_NAME(X509_NAME* name)
{
- LLSD result = LLSD::emptyMap();
- int name_entries = X509_NAME_entry_count(name);
- for (int entry_index=0; entry_index < name_entries; entry_index++)
- {
- char buffer[32];
- X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, entry_index);
-
- std::string name_value = std::string((const char*)ASN1_STRING_get0_data(X509_NAME_ENTRY_get_data(entry)),
- ASN1_STRING_length(X509_NAME_ENTRY_get_data(entry)));
-
- ASN1_OBJECT* name_obj = X509_NAME_ENTRY_get_object(entry);
- OBJ_obj2txt(buffer, sizeof(buffer), name_obj, 0);
- std::string obj_buffer_str = std::string(buffer);
- result[obj_buffer_str] = name_value;
- }
-
- return result;
+ LLSD result = LLSD::emptyMap();
+ int name_entries = X509_NAME_entry_count(name);
+ for (int entry_index=0; entry_index < name_entries; entry_index++)
+ {
+ char buffer[32];
+ X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, entry_index);
+
+ std::string name_value = std::string((const char*)ASN1_STRING_get0_data(X509_NAME_ENTRY_get_data(entry)),
+ ASN1_STRING_length(X509_NAME_ENTRY_get_data(entry)));
+
+ ASN1_OBJECT* name_obj = X509_NAME_ENTRY_get_object(entry);
+ OBJ_obj2txt(buffer, sizeof(buffer), name_obj, 0);
+ std::string obj_buffer_str = std::string(buffer);
+ result[obj_buffer_str] = name_value;
+ }
+
+ return result;
}
// Generate a string from an ASN1 integer. ASN1 Integers are
@@ -374,39 +374,39 @@ LLSD cert_name_from_X509_NAME(X509_NAME* name)
std::string cert_string_from_asn1_integer(ASN1_INTEGER* value)
{
- std::string result;
- BIGNUM *bn = ASN1_INTEGER_to_BN(value, NULL);
- if(bn)
- {
- char * ascii_bn = BN_bn2hex(bn);
+ std::string result;
+ BIGNUM *bn = ASN1_INTEGER_to_BN(value, NULL);
+ if(bn)
+ {
+ char * ascii_bn = BN_bn2hex(bn);
- if(ascii_bn)
- {
- result = ascii_bn;
- OPENSSL_free(ascii_bn);
- }
- BN_free(bn);
- }
- return result;
+ if(ascii_bn)
+ {
+ result = ascii_bn;
+ OPENSSL_free(ascii_bn);
+ }
+ BN_free(bn);
+ }
+ return result;
}
// Generate a string from an OCTET string.
-// we retrieve as a
+// we retrieve as a
std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value)
{
-
- std::stringstream result;
- result << std::hex << std::setprecision(2);
- for (int i=0; i < value->length; i++)
- {
- if (i != 0)
- {
- result << ":";
- }
- result << std::setfill('0') << std::setw(2) << (int)value->data[i];
- }
- return result.str();
+
+ std::stringstream result;
+ result << std::hex << std::setprecision(2);
+ for (int i=0; i < value->length; i++)
+ {
+ if (i != 0)
+ {
+ result << ":";
+ }
+ result << std::setfill('0') << std::setw(2) << (int)value->data[i];
+ }
+ return result.str();
}
// Generate a string from an ASN1 integer. ASN1 Integers are
@@ -416,56 +416,56 @@ std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value)
std::string cert_string_from_asn1_string(ASN1_STRING* value)
{
- char * string_bio_chars = NULL;
- std::string result;
- // get a memory bio
- BIO *string_bio = BIO_new(BIO_s_mem());
- if(!string_bio)
- {
- // stream the name into the bio. The name will be in the 'short name' format
- ASN1_STRING_print_ex(string_bio, value, ASN1_STRFLGS_RFC2253);
- int length = BIO_get_mem_data(string_bio, &string_bio_chars);
- result = std::string(string_bio_chars, length);
- BIO_free(string_bio);
- }
- else
- {
- LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
- }
-
- return result;
-}
-
-// retrieve a date structure from an ASN1 time, for
+ char * string_bio_chars = NULL;
+ std::string result;
+ // get a memory bio
+ BIO *string_bio = BIO_new(BIO_s_mem());
+ if(!string_bio)
+ {
+ // stream the name into the bio. The name will be in the 'short name' format
+ ASN1_STRING_print_ex(string_bio, value, ASN1_STRFLGS_RFC2253);
+ int length = BIO_get_mem_data(string_bio, &string_bio_chars);
+ result = std::string(string_bio_chars, length);
+ BIO_free(string_bio);
+ }
+ else
+ {
+ LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
+ }
+
+ return result;
+}
+
+// retrieve a date structure from an ASN1 time, for
// validity checking.
LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time)
{
-
- struct tm timestruct = {0};
- int i = asn1_time->length;
-
- if (i < 10)
- {
- return LLDate();
- }
- // convert the date from the ASN1 time (which is a string in ZULU time), to
- // a timeval.
- timestruct.tm_year = (asn1_time->data[0]-'0') * 10 + (asn1_time->data[1]-'0');
-
- /* Deal with Year 2000 */
- if (timestruct.tm_year < 70)
- timestruct.tm_year += 100;
-
- timestruct.tm_mon = (asn1_time->data[2]-'0') * 10 + (asn1_time->data[3]-'0') - 1;
- timestruct.tm_mday = (asn1_time->data[4]-'0') * 10 + (asn1_time->data[5]-'0');
- timestruct.tm_hour = (asn1_time->data[6]-'0') * 10 + (asn1_time->data[7]-'0');
- timestruct.tm_min = (asn1_time->data[8]-'0') * 10 + (asn1_time->data[9]-'0');
- timestruct.tm_sec = (asn1_time->data[10]-'0') * 10 + (asn1_time->data[11]-'0');
+
+ struct tm timestruct = {0};
+ int i = asn1_time->length;
+
+ if (i < 10)
+ {
+ return LLDate();
+ }
+ // convert the date from the ASN1 time (which is a string in ZULU time), to
+ // a timeval.
+ timestruct.tm_year = (asn1_time->data[0]-'0') * 10 + (asn1_time->data[1]-'0');
+
+ /* Deal with Year 2000 */
+ if (timestruct.tm_year < 70)
+ timestruct.tm_year += 100;
+
+ timestruct.tm_mon = (asn1_time->data[2]-'0') * 10 + (asn1_time->data[3]-'0') - 1;
+ timestruct.tm_mday = (asn1_time->data[4]-'0') * 10 + (asn1_time->data[5]-'0');
+ timestruct.tm_hour = (asn1_time->data[6]-'0') * 10 + (asn1_time->data[7]-'0');
+ timestruct.tm_min = (asn1_time->data[8]-'0') * 10 + (asn1_time->data[9]-'0');
+ timestruct.tm_sec = (asn1_time->data[10]-'0') * 10 + (asn1_time->data[11]-'0');
#if LL_WINDOWS
- return LLDate((F64)_mkgmtime(&timestruct));
+ return LLDate((F64)_mkgmtime(&timestruct));
#else // LL_WINDOWS
- return LLDate((F64)timegm(&timestruct));
+ return LLDate((F64)timegm(&timestruct));
#endif // LL_WINDOWS
}
@@ -478,59 +478,59 @@ LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time)
// It will find a cert that has minimally the params listed, with the values being the same
LLBasicCertificateVector::iterator LLBasicCertificateVector::find(const LLSD& params)
{
- // loop through the entire vector comparing the values in the certs
- // against those passed in via the params.
- // params should be a map. Only the items specified in the map will be
- // checked, but they must match exactly, even if they're maps or arrays.
+ // loop through the entire vector comparing the values in the certs
+ // against those passed in via the params.
+ // params should be a map. Only the items specified in the map will be
+ // checked, but they must match exactly, even if they're maps or arrays.
bool found = false;
- iterator cert = begin();
- while ( !found && cert != end() )
- {
- found = true;
- LLSD cert_info;
- (*cert)->getLLSD(cert_info);
- for (LLSD::map_const_iterator param = params.beginMap();
- found && param != params.endMap();
- param++)
- {
- if ( !cert_info.has((std::string)param->first)
+ iterator cert = begin();
+ while ( !found && cert != end() )
+ {
+ found = true;
+ LLSD cert_info;
+ (*cert)->getLLSD(cert_info);
+ for (LLSD::map_const_iterator param = params.beginMap();
+ found && param != params.endMap();
+ param++)
+ {
+ if ( !cert_info.has((std::string)param->first)
|| !valueCompareLLSD(cert_info[(std::string)param->first], param->second))
- {
- found = false;
- }
- }
+ {
+ found = false;
+ }
+ }
if (!found)
{
cert++;
}
- }
- return cert;
+ }
+ return cert;
}
-// Insert a certificate into the store. If the certificate already
+// Insert a certificate into the store. If the certificate already
// exists in the store, nothing is done.
-void LLBasicCertificateVector::insert(iterator _iter,
- LLPointer<LLCertificate> cert)
-{
- LLSD cert_info;
- cert->getLLSD(cert_info);
- if (cert_info.isMap() && cert_info.has(CERT_SUBJECT_KEY_IDENTFIER))
- {
- LLSD existing_cert_info = LLSD::emptyMap();
- existing_cert_info[CERT_SUBJECT_KEY_IDENTFIER] = cert_info[CERT_SUBJECT_KEY_IDENTFIER];
- if(find(existing_cert_info) == end())
- {
- BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
- if (basic_iter)
- {
- mCerts.insert(basic_iter->mIter, cert);
- }
+void LLBasicCertificateVector::insert(iterator _iter,
+ LLPointer<LLCertificate> cert)
+{
+ LLSD cert_info;
+ cert->getLLSD(cert_info);
+ if (cert_info.isMap() && cert_info.has(CERT_SUBJECT_KEY_IDENTFIER))
+ {
+ LLSD existing_cert_info = LLSD::emptyMap();
+ existing_cert_info[CERT_SUBJECT_KEY_IDENTFIER] = cert_info[CERT_SUBJECT_KEY_IDENTFIER];
+ if(find(existing_cert_info) == end())
+ {
+ BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
+ if (basic_iter)
+ {
+ mCerts.insert(basic_iter->mIter, cert);
+ }
else
{
LL_WARNS("SECAPI") << "Invalid certificate postion vector"
<< LL_ENDL;
}
- }
+ }
else
{
LL_DEBUGS("SECAPI") << "Certificate already in vector: "
@@ -538,7 +538,7 @@ void LLBasicCertificateVector::insert(iterator _iter,
<< LL_ENDL;
}
- }
+ }
else
{
LL_WARNS("SECAPI") << "Certificate does not have Subject Key Identifier; not inserted: "
@@ -550,15 +550,15 @@ void LLBasicCertificateVector::insert(iterator _iter,
// remove a certificate from the store
LLPointer<LLCertificate> LLBasicCertificateVector::erase(iterator _iter)
{
-
- if (_iter != end())
- {
- BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
- LLPointer<LLCertificate> result = (*_iter);
- mCerts.erase(basic_iter->mIter);
- return result;
- }
- return NULL;
+
+ if (_iter != end())
+ {
+ BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
+ LLPointer<LLCertificate> result = (*_iter);
+ mCerts.erase(basic_iter->mIter);
+ return result;
+ }
+ return NULL;
}
@@ -568,8 +568,8 @@ LLPointer<LLCertificate> LLBasicCertificateVector::erase(iterator _iter)
// uses a crt file such as the ca-bundle.crt in the existing SL implementation.
LLBasicCertificateStore::LLBasicCertificateStore(const std::string& filename)
{
- mFilename = filename;
- load_from_file(filename);
+ mFilename = filename;
+ load_from_file(filename);
}
void LLBasicCertificateStore::load_from_file(const std::string& filename)
@@ -577,16 +577,16 @@ void LLBasicCertificateStore::load_from_file(const std::string& filename)
int loaded = 0;
int rejected = 0;
- // scan the PEM file extracting each certificate
- if (LLFile::isfile(filename))
- {
+ // scan the PEM file extracting each certificate
+ if (LLFile::isfile(filename))
+ {
BIO* file_bio = BIO_new(BIO_s_file());
if(file_bio)
{
if (BIO_read_filename(file_bio, filename.c_str()) > 0)
- {
+ {
X509 *cert_x509 = NULL;
- while((PEM_read_bio_X509(file_bio, &cert_x509, 0, NULL)) &&
+ while((PEM_read_bio_X509(file_bio, &cert_x509, 0, NULL)) &&
(cert_x509 != NULL))
{
try
@@ -649,33 +649,33 @@ LLBasicCertificateStore::~LLBasicCertificateStore()
// persist the store
void LLBasicCertificateStore::save()
{
- llofstream file_store(mFilename.c_str(), std::ios_base::binary);
- if(!file_store.fail())
- {
- for(iterator cert = begin();
- cert != end();
- cert++)
- {
- std::string pem = (*cert)->getPem();
- if(!pem.empty())
- {
- file_store << (*cert)->getPem() << std::endl;
- }
- }
- file_store.close();
- }
- else
- {
- LL_WARNS("SECAPI") << "Could not open certificate store " << mFilename << "for save" << LL_ENDL;
- }
+ llofstream file_store(mFilename.c_str(), std::ios_base::binary);
+ if(!file_store.fail())
+ {
+ for(iterator cert = begin();
+ cert != end();
+ cert++)
+ {
+ std::string pem = (*cert)->getPem();
+ if(!pem.empty())
+ {
+ file_store << (*cert)->getPem() << std::endl;
+ }
+ }
+ file_store.close();
+ }
+ else
+ {
+ LL_WARNS("SECAPI") << "Could not open certificate store " << mFilename << "for save" << LL_ENDL;
+ }
}
// return the store id
std::string LLBasicCertificateStore::storeId() const
{
- // this is the basic handler which uses the ca-bundle.crt store,
- // so we ignore this.
- return std::string("");
+ // this is the basic handler which uses the ca-bundle.crt store,
+ // so we ignore this.
+ return std::string("");
}
@@ -686,51 +686,51 @@ std::string LLBasicCertificateStore::storeId() const
LLBasicCertificateChain::LLBasicCertificateChain(X509_STORE_CTX* store)
{
- // we're passed in a context, which contains a cert, and a blob of untrusted
- // certificates which compose the chain.
- if((store == NULL) || X509_STORE_CTX_get0_cert(store) == NULL)
- {
- LL_WARNS("SECAPI") << "An invalid store context was passed in when trying to create a certificate chain" << LL_ENDL;
- return;
- }
- // grab the child cert
- LLPointer<LLCertificate> current = new LLBasicCertificate(X509_STORE_CTX_get0_cert(store));
-
- add(current);
- if(X509_STORE_CTX_get0_untrusted(store) != NULL)
- {
- // if there are other certs in the chain, we build up a vector
- // of untrusted certs so we can search for the parents of each
- // consecutive cert.
- LLBasicCertificateVector untrusted_certs;
- for(int i = 0; i < sk_X509_num(X509_STORE_CTX_get0_untrusted(store)); i++)
- {
- LLPointer<LLCertificate> cert = new LLBasicCertificate(sk_X509_value(X509_STORE_CTX_get0_untrusted(store), i));
- untrusted_certs.add(cert);
-
- }
- while(untrusted_certs.size() > 0)
- {
- LLSD find_data = LLSD::emptyMap();
- LLSD cert_data;
- current->getLLSD(cert_data);
- // we simply build the chain via subject/issuer name as the
- // client should not have passed in multiple CA's with the same
- // subject name. If they did, it'll come out in the wash during
- // validation.
- find_data[CERT_SUBJECT_NAME_STRING] = cert_data[CERT_ISSUER_NAME_STRING];
- LLBasicCertificateVector::iterator issuer = untrusted_certs.find(find_data);
- if (issuer != untrusted_certs.end())
- {
- current = untrusted_certs.erase(issuer);
- add(current);
- }
- else
- {
- break;
- }
- }
- }
+ // we're passed in a context, which contains a cert, and a blob of untrusted
+ // certificates which compose the chain.
+ if((store == NULL) || X509_STORE_CTX_get0_cert(store) == NULL)
+ {
+ LL_WARNS("SECAPI") << "An invalid store context was passed in when trying to create a certificate chain" << LL_ENDL;
+ return;
+ }
+ // grab the child cert
+ LLPointer<LLCertificate> current = new LLBasicCertificate(X509_STORE_CTX_get0_cert(store));
+
+ add(current);
+ if(X509_STORE_CTX_get0_untrusted(store) != NULL)
+ {
+ // if there are other certs in the chain, we build up a vector
+ // of untrusted certs so we can search for the parents of each
+ // consecutive cert.
+ LLBasicCertificateVector untrusted_certs;
+ for(int i = 0; i < sk_X509_num(X509_STORE_CTX_get0_untrusted(store)); i++)
+ {
+ LLPointer<LLCertificate> cert = new LLBasicCertificate(sk_X509_value(X509_STORE_CTX_get0_untrusted(store), i));
+ untrusted_certs.add(cert);
+
+ }
+ while(untrusted_certs.size() > 0)
+ {
+ LLSD find_data = LLSD::emptyMap();
+ LLSD cert_data;
+ current->getLLSD(cert_data);
+ // we simply build the chain via subject/issuer name as the
+ // client should not have passed in multiple CA's with the same
+ // subject name. If they did, it'll come out in the wash during
+ // validation.
+ find_data[CERT_SUBJECT_NAME_STRING] = cert_data[CERT_ISSUER_NAME_STRING];
+ LLBasicCertificateVector::iterator issuer = untrusted_certs.find(find_data);
+ if (issuer != untrusted_certs.end())
+ {
+ current = untrusted_certs.erase(issuer);
+ add(current);
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
}
@@ -743,62 +743,62 @@ LLBasicCertificateChain::LLBasicCertificateChain(X509_STORE_CTX* store)
// recursively match foofoobar and foobar
bool _cert_subdomain_wildcard_match(const std::string& subdomain,
- const std::string& wildcard)
-{
- // split wildcard into the portion before the *, and the portion after
-
- int wildcard_pos = wildcard.find_first_of('*');
- // check the case where there is no wildcard.
- if(wildcard_pos == wildcard.npos)
- {
- return (subdomain == wildcard);
- }
-
- // we need to match the first part of the subdomain string up to the wildcard
- // position
- if(subdomain.substr(0, wildcard_pos) != wildcard.substr(0, wildcard_pos))
- {
- // the first portions of the strings didn't match
- return FALSE;
- }
-
- // as the portion of the wildcard string before the * matched, we need to check the
- // portion afterwards. Grab that portion.
- std::string new_wildcard_string = wildcard.substr( wildcard_pos+1, wildcard.npos);
- if(new_wildcard_string.empty())
- {
- // we had nothing after the *, so it's an automatic match
- return TRUE;
- }
-
- // grab the portion of the remaining wildcard string before the next '*'. We need to find this
- // within the remaining subdomain string. and then recursively check.
- std::string new_wildcard_match_string = new_wildcard_string.substr(0, new_wildcard_string.find_first_of('*'));
-
- // grab the portion of the subdomain after the part that matched the initial wildcard portion
- std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos);
-
- // iterate through the current subdomain, finding instances of the match string.
- int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string);
- while(sub_pos != std::string::npos)
- {
- new_subdomain = new_subdomain.substr(sub_pos, std::string::npos);
- if(_cert_subdomain_wildcard_match(new_subdomain, new_wildcard_string))
- {
- return TRUE;
- }
- sub_pos = new_subdomain.find_first_of(new_wildcard_match_string, 1);
-
-
- }
- // didn't find any instances of the match string that worked in the subdomain, so fail.
- return FALSE;
+ const std::string& wildcard)
+{
+ // split wildcard into the portion before the *, and the portion after
+
+ int wildcard_pos = wildcard.find_first_of('*');
+ // check the case where there is no wildcard.
+ if(wildcard_pos == wildcard.npos)
+ {
+ return (subdomain == wildcard);
+ }
+
+ // we need to match the first part of the subdomain string up to the wildcard
+ // position
+ if(subdomain.substr(0, wildcard_pos) != wildcard.substr(0, wildcard_pos))
+ {
+ // the first portions of the strings didn't match
+ return FALSE;
+ }
+
+ // as the portion of the wildcard string before the * matched, we need to check the
+ // portion afterwards. Grab that portion.
+ std::string new_wildcard_string = wildcard.substr( wildcard_pos+1, wildcard.npos);
+ if(new_wildcard_string.empty())
+ {
+ // we had nothing after the *, so it's an automatic match
+ return TRUE;
+ }
+
+ // grab the portion of the remaining wildcard string before the next '*'. We need to find this
+ // within the remaining subdomain string. and then recursively check.
+ std::string new_wildcard_match_string = new_wildcard_string.substr(0, new_wildcard_string.find_first_of('*'));
+
+ // grab the portion of the subdomain after the part that matched the initial wildcard portion
+ std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos);
+
+ // iterate through the current subdomain, finding instances of the match string.
+ int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string);
+ while(sub_pos != std::string::npos)
+ {
+ new_subdomain = new_subdomain.substr(sub_pos, std::string::npos);
+ if(_cert_subdomain_wildcard_match(new_subdomain, new_wildcard_string))
+ {
+ return TRUE;
+ }
+ sub_pos = new_subdomain.find_first_of(new_wildcard_match_string, 1);
+
+
+ }
+ // didn't find any instances of the match string that worked in the subdomain, so fail.
+ return FALSE;
}
// RFC2459 does not address wildcards as part of it's name matching
// specification, and there is no RFC specifying wildcard matching,
-// RFC2818 does a few statements about wildcard matching, but is very
+// RFC2818 does a few statements about wildcard matching, but is very
// general. Generally, wildcard matching is per implementation, although
// it's pretty similar.
// in our case, we use the '*' wildcard character only, within each
@@ -807,210 +807,210 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain,
// We then iterate that algorithm over each subdomain.
bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& common_name)
{
- std::string new_hostname = hostname;
- std::string new_cn = common_name;
-
- // find the last '.' in the hostname and the match name.
- int subdomain_pos = new_hostname.find_last_of('.');
- int subcn_pos = new_cn.find_last_of('.');
-
- // if the last char is a '.', strip it
- if(subdomain_pos == (new_hostname.length()-1))
- {
- new_hostname = new_hostname.substr(0, subdomain_pos);
- subdomain_pos = new_hostname.find_last_of('.');
- }
- if(subcn_pos == (new_cn.length()-1))
- {
- new_cn = new_cn.substr(0, subcn_pos);
- subcn_pos = new_cn.find_last_of('.');
- }
-
- // Check to see if there are any further '.' in the string.
- while((subcn_pos != std::string::npos) && (subdomain_pos != std::string::npos))
- {
- // snip out last subdomain in both the match string and the hostname
- // The last bit for 'my.current.host.com' would be 'com'
- std::string cn_part = new_cn.substr(subcn_pos+1, std::string::npos);
- std::string hostname_part = new_hostname.substr(subdomain_pos+1, std::string::npos);
-
- if(!_cert_subdomain_wildcard_match(new_hostname.substr(subdomain_pos+1, std::string::npos),
- cn_part))
- {
- return FALSE;
- }
- new_hostname = new_hostname.substr(0, subdomain_pos);
- new_cn = new_cn.substr(0, subcn_pos);
- subdomain_pos = new_hostname.find_last_of('.');
- subcn_pos = new_cn.find_last_of('.');
- }
- // check to see if the most significant portion of the common name is '*'. If so, we can
- // simply return success as child domains are also matched.
- if(new_cn == "*")
- {
- // if it's just a '*' we support all child domains as well, so '*.
- return TRUE;
- }
-
- return _cert_subdomain_wildcard_match(new_hostname, new_cn);
-
-}
-
-// validate that the LLSD array in llsd_set contains the llsd_value
+ std::string new_hostname = hostname;
+ std::string new_cn = common_name;
+
+ // find the last '.' in the hostname and the match name.
+ int subdomain_pos = new_hostname.find_last_of('.');
+ int subcn_pos = new_cn.find_last_of('.');
+
+ // if the last char is a '.', strip it
+ if(subdomain_pos == (new_hostname.length()-1))
+ {
+ new_hostname = new_hostname.substr(0, subdomain_pos);
+ subdomain_pos = new_hostname.find_last_of('.');
+ }
+ if(subcn_pos == (new_cn.length()-1))
+ {
+ new_cn = new_cn.substr(0, subcn_pos);
+ subcn_pos = new_cn.find_last_of('.');
+ }
+
+ // Check to see if there are any further '.' in the string.
+ while((subcn_pos != std::string::npos) && (subdomain_pos != std::string::npos))
+ {
+ // snip out last subdomain in both the match string and the hostname
+ // The last bit for 'my.current.host.com' would be 'com'
+ std::string cn_part = new_cn.substr(subcn_pos+1, std::string::npos);
+ std::string hostname_part = new_hostname.substr(subdomain_pos+1, std::string::npos);
+
+ if(!_cert_subdomain_wildcard_match(new_hostname.substr(subdomain_pos+1, std::string::npos),
+ cn_part))
+ {
+ return FALSE;
+ }
+ new_hostname = new_hostname.substr(0, subdomain_pos);
+ new_cn = new_cn.substr(0, subcn_pos);
+ subdomain_pos = new_hostname.find_last_of('.');
+ subcn_pos = new_cn.find_last_of('.');
+ }
+ // check to see if the most significant portion of the common name is '*'. If so, we can
+ // simply return success as child domains are also matched.
+ if(new_cn == "*")
+ {
+ // if it's just a '*' we support all child domains as well, so '*.
+ return TRUE;
+ }
+
+ return _cert_subdomain_wildcard_match(new_hostname, new_cn);
+
+}
+
+// validate that the LLSD array in llsd_set contains the llsd_value
bool _LLSDArrayIncludesValue(const LLSD& llsd_set, LLSD llsd_value)
{
- for(LLSD::array_const_iterator set_value = llsd_set.beginArray();
- set_value != llsd_set.endArray();
- set_value++)
- {
- if(valueCompareLLSD((*set_value), llsd_value))
- {
- return TRUE;
- }
- }
- return FALSE;
+ for(LLSD::array_const_iterator set_value = llsd_set.beginArray();
+ set_value != llsd_set.endArray();
+ set_value++)
+ {
+ if(valueCompareLLSD((*set_value), llsd_value))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
void _validateCert(int validation_policy,
- LLPointer<LLCertificate> cert,
- const LLSD& validation_params,
- int depth)
-{
- LLSD current_cert_info;
- cert->getLLSD(current_cert_info);
- // check basic properties exist in the cert
- if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info.has(CERT_SUBJECT_NAME_STRING))
- {
- LLTHROW(LLCertException(current_cert_info, "Cert doesn't have a Subject Name"));
- }
-
- if(!current_cert_info.has(CERT_ISSUER_NAME_STRING))
- {
- LLTHROW(LLCertException(current_cert_info, "Cert doesn't have an Issuer Name"));
- }
-
- // check basic properties exist in the cert
- if(!current_cert_info.has(CERT_VALID_FROM) || !current_cert_info.has(CERT_VALID_TO))
- {
- LLTHROW(LLCertException(current_cert_info, "Cert doesn't have an expiration period"));
- }
- if (!current_cert_info.has(CERT_SUBJECT_KEY_IDENTFIER))
- {
- LLTHROW(LLCertException(current_cert_info, "Cert doesn't have a Subject Key Id"));
- }
-
- if (validation_policy & VALIDATION_POLICY_TIME)
- {
- LLDate validation_date(time(NULL));
- if(validation_params.has(CERT_VALIDATION_DATE))
- {
- validation_date = validation_params[CERT_VALIDATION_DATE];
- }
-
- if((validation_date < current_cert_info[CERT_VALID_FROM].asDate()) ||
- (validation_date > current_cert_info[CERT_VALID_TO].asDate()))
- {
- LLTHROW(LLCertValidationExpirationException(current_cert_info, validation_date));
- }
- }
- if (validation_policy & VALIDATION_POLICY_SSL_KU)
- {
- // This stanza of code was changed 2021-06-09 as per details in SL-15370.
- // Brief summary: a renewed certificate from Akamai only contains the
- // 'Digital Signature' field and not the 'Key Encipherment' one. This code
- // used to look for both and throw an exception at startup (ignored) and
- // (for example) when buying L$ in the Viewer (fails with a UI message
- // and an entry in the Viewer log). This modified code removes the second
- // check for the 'Key Encipherment' field. If Akamai can provide a
- // replacement certificate that has both fields, then this modified code
- // will not be required.
- if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
- !(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE],
- LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE)))
- )
- {
- LLTHROW(LLCertKeyUsageValidationException(current_cert_info));
- }
- // only validate EKU if the cert has it
+ LLPointer<LLCertificate> cert,
+ const LLSD& validation_params,
+ int depth)
+{
+ LLSD current_cert_info;
+ cert->getLLSD(current_cert_info);
+ // check basic properties exist in the cert
+ if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info.has(CERT_SUBJECT_NAME_STRING))
+ {
+ LLTHROW(LLCertException(current_cert_info, "Cert doesn't have a Subject Name"));
+ }
+
+ if(!current_cert_info.has(CERT_ISSUER_NAME_STRING))
+ {
+ LLTHROW(LLCertException(current_cert_info, "Cert doesn't have an Issuer Name"));
+ }
+
+ // check basic properties exist in the cert
+ if(!current_cert_info.has(CERT_VALID_FROM) || !current_cert_info.has(CERT_VALID_TO))
+ {
+ LLTHROW(LLCertException(current_cert_info, "Cert doesn't have an expiration period"));
+ }
+ if (!current_cert_info.has(CERT_SUBJECT_KEY_IDENTFIER))
+ {
+ LLTHROW(LLCertException(current_cert_info, "Cert doesn't have a Subject Key Id"));
+ }
+
+ if (validation_policy & VALIDATION_POLICY_TIME)
+ {
+ LLDate validation_date(time(NULL));
+ if(validation_params.has(CERT_VALIDATION_DATE))
+ {
+ validation_date = validation_params[CERT_VALIDATION_DATE];
+ }
+
+ if((validation_date < current_cert_info[CERT_VALID_FROM].asDate()) ||
+ (validation_date > current_cert_info[CERT_VALID_TO].asDate()))
+ {
+ LLTHROW(LLCertValidationExpirationException(current_cert_info, validation_date));
+ }
+ }
+ if (validation_policy & VALIDATION_POLICY_SSL_KU)
+ {
+ // This stanza of code was changed 2021-06-09 as per details in SL-15370.
+ // Brief summary: a renewed certificate from Akamai only contains the
+ // 'Digital Signature' field and not the 'Key Encipherment' one. This code
+ // used to look for both and throw an exception at startup (ignored) and
+ // (for example) when buying L$ in the Viewer (fails with a UI message
+ // and an entry in the Viewer log). This modified code removes the second
+ // check for the 'Key Encipherment' field. If Akamai can provide a
+ // replacement certificate that has both fields, then this modified code
+ // will not be required.
+ if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
+ !(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE],
+ LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE)))
+ )
+ {
+ LLTHROW(LLCertKeyUsageValidationException(current_cert_info));
+ }
+ // only validate EKU if the cert has it
if(current_cert_info.has(CERT_EXTENDED_KEY_USAGE)
&& current_cert_info[CERT_EXTENDED_KEY_USAGE].isArray()
&& (!_LLSDArrayIncludesValue(current_cert_info[CERT_EXTENDED_KEY_USAGE],
LLSD((std::string)CERT_EKU_TLS_SERVER_AUTH)))
- && (!_LLSDArrayIncludesValue(current_cert_info[CERT_EXTENDED_KEY_USAGE],
+ && (!_LLSDArrayIncludesValue(current_cert_info[CERT_EXTENDED_KEY_USAGE],
LLSD((std::string)CERT_EKU_SERVER_AUTH)))
)
- {
- LLTHROW(LLCertKeyUsageValidationException(current_cert_info));
- }
- }
- if (validation_policy & VALIDATION_POLICY_CA_KU)
- {
- if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
- (!_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE],
- (std::string)CERT_KU_CERT_SIGN)))
- {
- LLTHROW(LLCertKeyUsageValidationException(current_cert_info));
- }
- }
-
- // validate basic constraints
- if ((validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS) &&
- current_cert_info.has(CERT_BASIC_CONSTRAINTS) &&
- current_cert_info[CERT_BASIC_CONSTRAINTS].isMap())
- {
- if(!current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_CA) ||
- !current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_CA])
- {
- LLTHROW(LLCertBasicConstraintsValidationException(current_cert_info));
- }
- if (current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_PATHLEN) &&
- ((current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger() != 0) &&
- (depth > current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger())))
- {
- LLTHROW(LLCertBasicConstraintsValidationException(current_cert_info));
- }
- }
-}
-
-bool _verify_signature(LLPointer<LLCertificate> parent,
- LLPointer<LLCertificate> child)
-{
- bool verify_result = FALSE;
- LLSD cert1, cert2;
- parent->getLLSD(cert1);
- child->getLLSD(cert2);
- X509 *signing_cert = parent->getOpenSSLX509();
- X509 *child_cert = child->getOpenSSLX509();
- if((signing_cert != NULL) && (child_cert != NULL))
- {
- EVP_PKEY *pkey = X509_get_pubkey(signing_cert);
-
-
- if(pkey)
- {
- int verify_code = X509_verify(child_cert, pkey);
- verify_result = ( verify_code > 0);
- EVP_PKEY_free(pkey);
- }
- else
- {
- LL_WARNS("SECAPI") << "Could not validate the cert chain signature, as the public key of the signing cert could not be retrieved" << LL_ENDL;
- }
-
- }
- else
- {
- LL_WARNS("SECAPI") << "Signature verification failed as there are no certs in the chain" << LL_ENDL;
- }
- if(child_cert)
- {
- X509_free(child_cert);
- }
- if(signing_cert)
- {
- X509_free(signing_cert);
- }
- return verify_result;
+ {
+ LLTHROW(LLCertKeyUsageValidationException(current_cert_info));
+ }
+ }
+ if (validation_policy & VALIDATION_POLICY_CA_KU)
+ {
+ if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
+ (!_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE],
+ (std::string)CERT_KU_CERT_SIGN)))
+ {
+ LLTHROW(LLCertKeyUsageValidationException(current_cert_info));
+ }
+ }
+
+ // validate basic constraints
+ if ((validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS) &&
+ current_cert_info.has(CERT_BASIC_CONSTRAINTS) &&
+ current_cert_info[CERT_BASIC_CONSTRAINTS].isMap())
+ {
+ if(!current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_CA) ||
+ !current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_CA])
+ {
+ LLTHROW(LLCertBasicConstraintsValidationException(current_cert_info));
+ }
+ if (current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_PATHLEN) &&
+ ((current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger() != 0) &&
+ (depth > current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger())))
+ {
+ LLTHROW(LLCertBasicConstraintsValidationException(current_cert_info));
+ }
+ }
+}
+
+bool _verify_signature(LLPointer<LLCertificate> parent,
+ LLPointer<LLCertificate> child)
+{
+ bool verify_result = FALSE;
+ LLSD cert1, cert2;
+ parent->getLLSD(cert1);
+ child->getLLSD(cert2);
+ X509 *signing_cert = parent->getOpenSSLX509();
+ X509 *child_cert = child->getOpenSSLX509();
+ if((signing_cert != NULL) && (child_cert != NULL))
+ {
+ EVP_PKEY *pkey = X509_get_pubkey(signing_cert);
+
+
+ if(pkey)
+ {
+ int verify_code = X509_verify(child_cert, pkey);
+ verify_result = ( verify_code > 0);
+ EVP_PKEY_free(pkey);
+ }
+ else
+ {
+ LL_WARNS("SECAPI") << "Could not validate the cert chain signature, as the public key of the signing cert could not be retrieved" << LL_ENDL;
+ }
+
+ }
+ else
+ {
+ LL_WARNS("SECAPI") << "Signature verification failed as there are no certs in the chain" << LL_ENDL;
+ }
+ if(child_cert)
+ {
+ X509_free(child_cert);
+ }
+ if(signing_cert)
+ {
+ X509_free(signing_cert);
+ }
+ return verify_result;
}
@@ -1029,58 +1029,58 @@ bool _verify_signature(LLPointer<LLCertificate> parent,
// to a cert in the store. It validates whether any cert in the chain
// is trusted in the store, even if it's not the last one.
void LLBasicCertificateStore::validate(int validation_policy,
- LLPointer<LLCertificateChain> cert_chain,
- const LLSD& validation_params)
+ LLPointer<LLCertificateChain> cert_chain,
+ const LLSD& validation_params)
{
- // If --no-verify-ssl-cert was passed on the command line, stop right now.
- if (gSavedSettings.getBOOL("NoVerifySSLCert"))
+ // If --no-verify-ssl-cert was passed on the command line, stop right now.
+ if (gSavedSettings.getBOOL("NoVerifySSLCert"))
{
LL_WARNS_ONCE("SECAPI") << "All Certificate validation disabled; viewer operation is insecure" << LL_ENDL;
return;
}
- if(cert_chain->size() < 1)
- {
- LLTHROW(LLCertException(LLSD::emptyMap(), "No certs in chain"));
- }
- iterator current_cert = cert_chain->begin();
- LLSD validation_date;
- if (validation_params.has(CERT_VALIDATION_DATE))
- {
- validation_date = validation_params[CERT_VALIDATION_DATE];
- }
+ if(cert_chain->size() < 1)
+ {
+ LLTHROW(LLCertException(LLSD::emptyMap(), "No certs in chain"));
+ }
+ iterator current_cert = cert_chain->begin();
+ LLSD validation_date;
+ if (validation_params.has(CERT_VALIDATION_DATE))
+ {
+ validation_date = validation_params[CERT_VALIDATION_DATE];
+ }
// get LLSD info from the cert to throw in any exception
- LLSD current_cert_info;
+ LLSD current_cert_info;
(*current_cert)->getLLSD(current_cert_info);
- if (validation_policy & VALIDATION_POLICY_HOSTNAME)
- {
- if(!validation_params.has(CERT_HOSTNAME))
- {
- LLTHROW(LLCertException(current_cert_info, "No hostname passed in for validation"));
- }
- if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info[CERT_SUBJECT_NAME].has(CERT_NAME_CN))
- {
- LLTHROW(LLInvalidCertificate(current_cert_info));
- }
-
- LL_DEBUGS("SECAPI") << "Validating the hostname " << validation_params[CERT_HOSTNAME].asString() <<
- "against the cert CN " << current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString() << LL_ENDL;
- if(!_cert_hostname_wildcard_match(validation_params[CERT_HOSTNAME].asString(),
- current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString()))
- {
- throw LLCertValidationHostnameException(validation_params[CERT_HOSTNAME].asString(),
- current_cert_info);
- }
- }
-
- // check the cache of already validated certs
- X509* cert_x509 = (*current_cert)->getOpenSSLX509();
- if(!cert_x509)
- {
- LLTHROW(LLInvalidCertificate(current_cert_info));
- }
+ if (validation_policy & VALIDATION_POLICY_HOSTNAME)
+ {
+ if(!validation_params.has(CERT_HOSTNAME))
+ {
+ LLTHROW(LLCertException(current_cert_info, "No hostname passed in for validation"));
+ }
+ if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info[CERT_SUBJECT_NAME].has(CERT_NAME_CN))
+ {
+ LLTHROW(LLInvalidCertificate(current_cert_info));
+ }
+
+ LL_DEBUGS("SECAPI") << "Validating the hostname " << validation_params[CERT_HOSTNAME].asString() <<
+ "against the cert CN " << current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString() << LL_ENDL;
+ if(!_cert_hostname_wildcard_match(validation_params[CERT_HOSTNAME].asString(),
+ current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString()))
+ {
+ throw LLCertValidationHostnameException(validation_params[CERT_HOSTNAME].asString(),
+ current_cert_info);
+ }
+ }
+
+ // check the cache of already validated certs
+ X509* cert_x509 = (*current_cert)->getOpenSSLX509();
+ if(!cert_x509)
+ {
+ LLTHROW(LLInvalidCertificate(current_cert_info));
+ }
std::string subject_name(cert_string_name_from_X509_NAME(X509_get_subject_name(cert_x509)));
std::string skeyid(_subject_key_identifier(cert_x509));
@@ -1091,85 +1091,85 @@ void LLBasicCertificateStore::validate(int validation_policy,
<< " subject key id '" << skeyid << "'"
<< LL_ENDL;
- X509_free( cert_x509 );
- cert_x509 = NULL;
+ X509_free( cert_x509 );
+ cert_x509 = NULL;
if (skeyid.empty())
{
LLTHROW(LLCertException(current_cert_info, "No Subject Key Id"));
}
-
- t_cert_cache::iterator cache_entry = mTrustedCertCache.find(skeyid);
- if(cache_entry != mTrustedCertCache.end())
- {
- // this cert is in the cache, so validate the time.
- if (validation_policy & VALIDATION_POLICY_TIME)
- {
- LLDate validation_date;
- if(validation_params.has(CERT_VALIDATION_DATE))
- {
- validation_date = validation_params[CERT_VALIDATION_DATE];
- }
+
+ t_cert_cache::iterator cache_entry = mTrustedCertCache.find(skeyid);
+ if(cache_entry != mTrustedCertCache.end())
+ {
+ // this cert is in the cache, so validate the time.
+ if (validation_policy & VALIDATION_POLICY_TIME)
+ {
+ LLDate validation_date;
+ if(validation_params.has(CERT_VALIDATION_DATE))
+ {
+ validation_date = validation_params[CERT_VALIDATION_DATE];
+ }
else
{
validation_date = LLDate(time(NULL)); // current time
}
-
- if((validation_date < cache_entry->second.first) ||
- (validation_date > cache_entry->second.second))
- {
- LLTHROW(LLCertValidationExpirationException(current_cert_info, validation_date));
- }
- }
- // successfully found in cache
- LL_DEBUGS("SECAPI") << "Valid cert for '" << validation_params[CERT_HOSTNAME].asString() << "'"
+
+ if((validation_date < cache_entry->second.first) ||
+ (validation_date > cache_entry->second.second))
+ {
+ LLTHROW(LLCertValidationExpirationException(current_cert_info, validation_date));
+ }
+ }
+ // successfully found in cache
+ LL_DEBUGS("SECAPI") << "Valid cert for '" << validation_params[CERT_HOSTNAME].asString() << "'"
<< " skeyid '" << skeyid << "'"
<< " found in cache"
<< LL_ENDL;
- return;
- }
- if(current_cert_info.isUndefined())
- {
- (*current_cert)->getLLSD(current_cert_info);
- }
- LLDate from_time = current_cert_info[CERT_VALID_FROM].asDate();
- LLDate to_time = current_cert_info[CERT_VALID_TO].asDate();
- int depth = 0;
- LLPointer<LLCertificate> previous_cert;
- // loop through the cert chain, validating the current cert against the next one.
- while(current_cert != cert_chain->end())
- {
- int local_validation_policy = validation_policy;
- if(current_cert == cert_chain->begin())
- {
- // for the child cert, we don't validate CA stuff
- local_validation_policy &= ~(VALIDATION_POLICY_CA_KU |
- VALIDATION_POLICY_CA_BASIC_CONSTRAINTS);
- }
- else
- {
- // for non-child certs, we don't validate SSL Key usage
- local_validation_policy &= ~VALIDATION_POLICY_SSL_KU;
- if(!_verify_signature((*current_cert),
- previous_cert))
- {
+ return;
+ }
+ if(current_cert_info.isUndefined())
+ {
+ (*current_cert)->getLLSD(current_cert_info);
+ }
+ LLDate from_time = current_cert_info[CERT_VALID_FROM].asDate();
+ LLDate to_time = current_cert_info[CERT_VALID_TO].asDate();
+ int depth = 0;
+ LLPointer<LLCertificate> previous_cert;
+ // loop through the cert chain, validating the current cert against the next one.
+ while(current_cert != cert_chain->end())
+ {
+ int local_validation_policy = validation_policy;
+ if(current_cert == cert_chain->begin())
+ {
+ // for the child cert, we don't validate CA stuff
+ local_validation_policy &= ~(VALIDATION_POLICY_CA_KU |
+ VALIDATION_POLICY_CA_BASIC_CONSTRAINTS);
+ }
+ else
+ {
+ // for non-child certs, we don't validate SSL Key usage
+ local_validation_policy &= ~VALIDATION_POLICY_SSL_KU;
+ if(!_verify_signature((*current_cert),
+ previous_cert))
+ {
LLSD previous_cert_info;
previous_cert->getLLSD(previous_cert_info);
LLTHROW(LLCertValidationInvalidSignatureException(previous_cert_info));
- }
- }
- _validateCert(local_validation_policy,
- (*current_cert),
- validation_params,
- depth);
-
- // look for a CA in the CA store that may belong to this chain.
- LLSD cert_search_params = LLSD::emptyMap();
- // is the cert itself in the store?
- cert_search_params[CERT_SUBJECT_KEY_IDENTFIER] = current_cert_info[CERT_SUBJECT_KEY_IDENTFIER];
- LLCertificateStore::iterator found_store_cert = find(cert_search_params);
- if(found_store_cert != end())
- {
- mTrustedCertCache[skeyid] = std::pair<LLDate, LLDate>(from_time, to_time);
+ }
+ }
+ _validateCert(local_validation_policy,
+ (*current_cert),
+ validation_params,
+ depth);
+
+ // look for a CA in the CA store that may belong to this chain.
+ LLSD cert_search_params = LLSD::emptyMap();
+ // is the cert itself in the store?
+ cert_search_params[CERT_SUBJECT_KEY_IDENTFIER] = current_cert_info[CERT_SUBJECT_KEY_IDENTFIER];
+ LLCertificateStore::iterator found_store_cert = find(cert_search_params);
+ if(found_store_cert != end())
+ {
+ mTrustedCertCache[skeyid] = std::pair<LLDate, LLDate>(from_time, to_time);
LL_DEBUGS("SECAPI") << "Valid cert "
<< " for '" << (validation_params.has(CERT_HOSTNAME) ? validation_params[CERT_HOSTNAME].asString() : "(unknown hostname)") << "'";
X509* cert_x509 = (*found_store_cert)->getOpenSSLX509();
@@ -1178,73 +1178,73 @@ void LLBasicCertificateStore::validate(int validation_policy,
LL_CONT << " as '" << found_cert_subject_name << "'"
<< " skeyid '" << current_cert_info[CERT_SUBJECT_KEY_IDENTFIER].asString() << "'"
<< " found in cert store"
- << LL_ENDL;
- return;
- }
-
- // is the parent in the cert store?
-
- cert_search_params = LLSD::emptyMap();
- cert_search_params[CERT_SUBJECT_NAME_STRING] = current_cert_info[CERT_ISSUER_NAME_STRING];
- if (current_cert_info.has(CERT_AUTHORITY_KEY_IDENTIFIER))
- {
- LLSD cert_aki = current_cert_info[CERT_AUTHORITY_KEY_IDENTIFIER];
- if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_ID))
- {
- cert_search_params[CERT_SUBJECT_KEY_IDENTFIER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_ID];
- }
- if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL))
- {
- cert_search_params[CERT_SERIAL_NUMBER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL];
- }
- }
- found_store_cert = find(cert_search_params);
-
- if(found_store_cert != end())
- {
- // validate the store cert against the depth
- _validateCert(validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS,
- (*found_store_cert),
- LLSD(),
- depth);
-
- // verify the signature of the CA
- if(!_verify_signature((*found_store_cert),
- (*current_cert)))
- {
- LLTHROW(LLCertValidationInvalidSignatureException(current_cert_info));
- }
- // successfully validated.
- mTrustedCertCache[skeyid] = std::pair<LLDate, LLDate>(from_time, to_time);
+ << LL_ENDL;
+ return;
+ }
+
+ // is the parent in the cert store?
+
+ cert_search_params = LLSD::emptyMap();
+ cert_search_params[CERT_SUBJECT_NAME_STRING] = current_cert_info[CERT_ISSUER_NAME_STRING];
+ if (current_cert_info.has(CERT_AUTHORITY_KEY_IDENTIFIER))
+ {
+ LLSD cert_aki = current_cert_info[CERT_AUTHORITY_KEY_IDENTIFIER];
+ if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_ID))
+ {
+ cert_search_params[CERT_SUBJECT_KEY_IDENTFIER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_ID];
+ }
+ if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL))
+ {
+ cert_search_params[CERT_SERIAL_NUMBER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL];
+ }
+ }
+ found_store_cert = find(cert_search_params);
+
+ if(found_store_cert != end())
+ {
+ // validate the store cert against the depth
+ _validateCert(validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS,
+ (*found_store_cert),
+ LLSD(),
+ depth);
+
+ // verify the signature of the CA
+ if(!_verify_signature((*found_store_cert),
+ (*current_cert)))
+ {
+ LLTHROW(LLCertValidationInvalidSignatureException(current_cert_info));
+ }
+ // successfully validated.
+ mTrustedCertCache[skeyid] = std::pair<LLDate, LLDate>(from_time, to_time);
LL_DEBUGS("SECAPI") << "Verified and cached cert for '" << validation_params[CERT_HOSTNAME].asString() << "'"
<< " as '" << subject_name << "'"
<< " id '" << skeyid << "'"
<< " using CA '" << cert_search_params[CERT_SUBJECT_NAME_STRING] << "'"
<< " with id '" << cert_search_params[CERT_SUBJECT_KEY_IDENTFIER].asString() << "' found in cert store"
- << LL_ENDL;
- return;
- }
- previous_cert = (*current_cert);
- current_cert++;
- depth++;
- if(current_cert != cert_chain->end())
- {
- (*current_cert)->getLLSD(current_cert_info);
- }
- }
- if (validation_policy & VALIDATION_POLICY_TRUSTED)
- {
- // we reached the end without finding a trusted cert.
+ << LL_ENDL;
+ return;
+ }
+ previous_cert = (*current_cert);
+ current_cert++;
+ depth++;
+ if(current_cert != cert_chain->end())
+ {
+ (*current_cert)->getLLSD(current_cert_info);
+ }
+ }
+ if (validation_policy & VALIDATION_POLICY_TRUSTED)
+ {
+ // we reached the end without finding a trusted cert.
LLSD last_cert_info;
((*cert_chain)[cert_chain->size()-1])->getLLSD(last_cert_info);
- LLTHROW(LLCertValidationTrustException(last_cert_info));
- }
+ LLTHROW(LLCertValidationTrustException(last_cert_info));
+ }
else
{
LL_DEBUGS("SECAPI") << "! Caching untrusted cert for '" << subject_name << "'"
<< " skeyid '" << skeyid << "' in cert store because ! VALIDATION_POLICY_TRUSTED"
- << LL_ENDL;
- mTrustedCertCache[skeyid] = std::pair<LLDate, LLDate>(from_time, to_time);
+ << LL_ENDL;
+ mTrustedCertCache[skeyid] = std::pair<LLDate, LLDate>(from_time, to_time);
}
}
@@ -1255,11 +1255,11 @@ void LLBasicCertificateStore::validate(int validation_policy,
// We read the file on construction, and write it on destruction. This
// means multiple processes cannot modify the datastore.
LLSecAPIBasicHandler::LLSecAPIBasicHandler(const std::string& protected_data_file,
- const std::string& legacy_password_path)
+ const std::string& legacy_password_path)
{
- mProtectedDataFilename = protected_data_file;
- mProtectedDataMap = LLSD::emptyMap();
- mLegacyPasswordPath = legacy_password_path;
+ mProtectedDataFilename = protected_data_file;
+ mProtectedDataMap = LLSD::emptyMap();
+ mLegacyPasswordPath = legacy_password_path;
}
@@ -1270,108 +1270,108 @@ LLSecAPIBasicHandler::LLSecAPIBasicHandler()
void LLSecAPIBasicHandler::init()
{
- mProtectedDataMap = LLSD::emptyMap();
- if (mProtectedDataFilename.length() == 0)
- {
- mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
- "bin_conf.dat");
- mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
-
- mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
- "bin_conf.dat");
- std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
- "CA.pem");
-
-
- LL_INFOS("SECAPI") << "Loading user certificate store from " << store_file << LL_ENDL;
- mStore = new LLBasicCertificateStore(store_file);
-
- // grab the application ca-bundle.crt file that contains the well-known certs shipped
- // with the product
- std::string ca_file_path = gDirUtilp->getCAFile();
- LL_INFOS("SECAPI") << "Loading application certificate store from " << ca_file_path << LL_ENDL;
- LLPointer<LLBasicCertificateStore> app_ca_store = new LLBasicCertificateStore(ca_file_path);
-
- // push the applicate CA files into the store, therefore adding any new CA certs that
- // updated
- for(LLCertificateVector::iterator i = app_ca_store->begin();
- i != app_ca_store->end();
- i++)
- {
- mStore->add(*i);
- }
-
- }
- _readProtectedData(); // initialize mProtectedDataMap
- // may throw LLProtectedDataException if saved datamap is not decryptable
+ mProtectedDataMap = LLSD::emptyMap();
+ if (mProtectedDataFilename.length() == 0)
+ {
+ mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+ "bin_conf.dat");
+ mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
+
+ mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+ "bin_conf.dat");
+ std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+ "CA.pem");
+
+
+ LL_INFOS("SECAPI") << "Loading user certificate store from " << store_file << LL_ENDL;
+ mStore = new LLBasicCertificateStore(store_file);
+
+ // grab the application ca-bundle.crt file that contains the well-known certs shipped
+ // with the product
+ std::string ca_file_path = gDirUtilp->getCAFile();
+ LL_INFOS("SECAPI") << "Loading application certificate store from " << ca_file_path << LL_ENDL;
+ LLPointer<LLBasicCertificateStore> app_ca_store = new LLBasicCertificateStore(ca_file_path);
+
+ // push the applicate CA files into the store, therefore adding any new CA certs that
+ // updated
+ for(LLCertificateVector::iterator i = app_ca_store->begin();
+ i != app_ca_store->end();
+ i++)
+ {
+ mStore->add(*i);
+ }
+
+ }
+ _readProtectedData(); // initialize mProtectedDataMap
+ // may throw LLProtectedDataException if saved datamap is not decryptable
}
LLSecAPIBasicHandler::~LLSecAPIBasicHandler()
{
- _writeProtectedData();
+ _writeProtectedData();
}
void LLSecAPIBasicHandler::_readProtectedData(unsigned char *unique_id, U32 id_len)
{
- // attempt to load the file into our map
- LLPointer<LLSDParser> parser = new LLSDXMLParser();
- llifstream protected_data_stream(mProtectedDataFilename.c_str(),
- llifstream::binary);
-
- if (!protected_data_stream.fail()) {
- U8 salt[STORE_SALT_SIZE];
- U8 buffer[BUFFER_READ_SIZE];
- U8 decrypted_buffer[BUFFER_READ_SIZE];
- int decrypted_length;
- LLXORCipher cipher(unique_id, id_len);
-
- // read in the salt and key
- protected_data_stream.read((char *)salt, STORE_SALT_SIZE);
- if (protected_data_stream.gcount() < STORE_SALT_SIZE)
- {
- LLTHROW(LLProtectedDataException("Config file too short."));
- }
-
- cipher.decrypt(salt, STORE_SALT_SIZE);
-
- // totally lame. As we're not using the OS level protected data, we need to
- // at least obfuscate the data. We do this by using a salt stored at the head of the file
- // to encrypt the data, therefore obfuscating it from someone using simple existing tools.
- // We do include the MAC address as part of the obfuscation, which would require an
- // attacker to get the MAC address as well as the protected store, which improves things
- // somewhat. It would be better to use the password, but as this store
- // will be used to store the SL password when the user decides to have SL remember it,
- // so we can't use that. OS-dependent store implementations will use the OS password/storage
- // mechanisms and are considered to be more secure.
- // We've a strong intent to move to OS dependent protected data stores.
-
-
- // read in the rest of the file.
- EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
+ // attempt to load the file into our map
+ LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ llifstream protected_data_stream(mProtectedDataFilename.c_str(),
+ llifstream::binary);
+
+ if (!protected_data_stream.fail()) {
+ U8 salt[STORE_SALT_SIZE];
+ U8 buffer[BUFFER_READ_SIZE];
+ U8 decrypted_buffer[BUFFER_READ_SIZE];
+ int decrypted_length;
+ LLXORCipher cipher(unique_id, id_len);
+
+ // read in the salt and key
+ protected_data_stream.read((char *)salt, STORE_SALT_SIZE);
+ if (protected_data_stream.gcount() < STORE_SALT_SIZE)
+ {
+ LLTHROW(LLProtectedDataException("Config file too short."));
+ }
+
+ cipher.decrypt(salt, STORE_SALT_SIZE);
+
+ // totally lame. As we're not using the OS level protected data, we need to
+ // at least obfuscate the data. We do this by using a salt stored at the head of the file
+ // to encrypt the data, therefore obfuscating it from someone using simple existing tools.
+ // We do include the MAC address as part of the obfuscation, which would require an
+ // attacker to get the MAC address as well as the protected store, which improves things
+ // somewhat. It would be better to use the password, but as this store
+ // will be used to store the SL password when the user decides to have SL remember it,
+ // so we can't use that. OS-dependent store implementations will use the OS password/storage
+ // mechanisms and are considered to be more secure.
+ // We've a strong intent to move to OS dependent protected data stores.
+
+
+ // read in the rest of the file.
+ EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
// todo: ctx error handling
- EVP_DecryptInit(ctx, EVP_rc4(), salt, NULL);
- // allocate memory:
- std::string decrypted_data;
-
- while(protected_data_stream.good()) {
- // read data as a block:
- protected_data_stream.read((char *)buffer, BUFFER_READ_SIZE);
-
- EVP_DecryptUpdate(ctx, decrypted_buffer, &decrypted_length,
- buffer, protected_data_stream.gcount());
- decrypted_data.append((const char *)decrypted_buffer, protected_data_stream.gcount());
- }
-
- // RC4 is a stream cipher, so we don't bother to EVP_DecryptFinal, as there is
- // no block padding.
+ EVP_DecryptInit(ctx, EVP_rc4(), salt, NULL);
+ // allocate memory:
+ std::string decrypted_data;
+
+ while(protected_data_stream.good()) {
+ // read data as a block:
+ protected_data_stream.read((char *)buffer, BUFFER_READ_SIZE);
+
+ EVP_DecryptUpdate(ctx, decrypted_buffer, &decrypted_length,
+ buffer, protected_data_stream.gcount());
+ decrypted_data.append((const char *)decrypted_buffer, protected_data_stream.gcount());
+ }
+
+ // RC4 is a stream cipher, so we don't bother to EVP_DecryptFinal, as there is
+ // no block padding.
EVP_CIPHER_CTX_free(ctx);
- std::istringstream parse_stream(decrypted_data);
- if (parser->parse(parse_stream, mProtectedDataMap,
- LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE)
- {
- LLTHROW(LLProtectedDataException("Config file cannot be decrypted."));
- }
- }
+ std::istringstream parse_stream(decrypted_data);
+ if (parser->parse(parse_stream, mProtectedDataMap,
+ LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE)
+ {
+ LLTHROW(LLProtectedDataException("Config file cannot be decrypted."));
+ }
+ }
}
void LLSecAPIBasicHandler::_readProtectedData()
@@ -1399,166 +1399,166 @@ void LLSecAPIBasicHandler::_readProtectedData()
}
void LLSecAPIBasicHandler::_writeProtectedData()
-{
- std::ostringstream formatted_data_ostream;
- U8 salt[STORE_SALT_SIZE];
- U8 buffer[BUFFER_READ_SIZE];
- U8 encrypted_buffer[BUFFER_READ_SIZE];
-
-
- if(mProtectedDataMap.isUndefined())
- {
- LLFile::remove(mProtectedDataFilename);
- return;
- }
- // create a string with the formatted data.
- LLSDSerialize::toXML(mProtectedDataMap, formatted_data_ostream);
- std::istringstream formatted_data_istream(formatted_data_ostream.str());
- // generate the seed
- RAND_bytes(salt, STORE_SALT_SIZE);
-
-
- // write to a temp file so we don't clobber the initial file if there is
- // an error.
- std::string tmp_filename = mProtectedDataFilename + ".tmp";
-
- llofstream protected_data_stream(tmp_filename.c_str(),
+{
+ std::ostringstream formatted_data_ostream;
+ U8 salt[STORE_SALT_SIZE];
+ U8 buffer[BUFFER_READ_SIZE];
+ U8 encrypted_buffer[BUFFER_READ_SIZE];
+
+
+ if(mProtectedDataMap.isUndefined())
+ {
+ LLFile::remove(mProtectedDataFilename);
+ return;
+ }
+ // create a string with the formatted data.
+ LLSDSerialize::toXML(mProtectedDataMap, formatted_data_ostream);
+ std::istringstream formatted_data_istream(formatted_data_ostream.str());
+ // generate the seed
+ RAND_bytes(salt, STORE_SALT_SIZE);
+
+
+ // write to a temp file so we don't clobber the initial file if there is
+ // an error.
+ std::string tmp_filename = mProtectedDataFilename + ".tmp";
+
+ llofstream protected_data_stream(tmp_filename.c_str(),
std::ios_base::binary);
EVP_CIPHER_CTX *ctx = NULL;
- try
- {
-
- ctx = EVP_CIPHER_CTX_new();
+ try
+ {
+
+ ctx = EVP_CIPHER_CTX_new();
// todo: ctx error handling
- EVP_EncryptInit(ctx, EVP_rc4(), salt, NULL);
- unsigned char unique_id[MAC_ADDRESS_BYTES];
+ EVP_EncryptInit(ctx, EVP_rc4(), salt, NULL);
+ unsigned char unique_id[MAC_ADDRESS_BYTES];
LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
- LLXORCipher cipher(unique_id, sizeof(unique_id));
- cipher.encrypt(salt, STORE_SALT_SIZE);
- protected_data_stream.write((const char *)salt, STORE_SALT_SIZE);
-
- while (formatted_data_istream.good())
- {
- formatted_data_istream.read((char *)buffer, BUFFER_READ_SIZE);
- if(formatted_data_istream.gcount() == 0)
- {
- break;
- }
- int encrypted_length;
- EVP_EncryptUpdate(ctx, encrypted_buffer, &encrypted_length,
- buffer, formatted_data_istream.gcount());
- protected_data_stream.write((const char *)encrypted_buffer, encrypted_length);
- }
-
- // no EVP_EncrypteFinal, as this is a stream cipher
+ LLXORCipher cipher(unique_id, sizeof(unique_id));
+ cipher.encrypt(salt, STORE_SALT_SIZE);
+ protected_data_stream.write((const char *)salt, STORE_SALT_SIZE);
+
+ while (formatted_data_istream.good())
+ {
+ formatted_data_istream.read((char *)buffer, BUFFER_READ_SIZE);
+ if(formatted_data_istream.gcount() == 0)
+ {
+ break;
+ }
+ int encrypted_length;
+ EVP_EncryptUpdate(ctx, encrypted_buffer, &encrypted_length,
+ buffer, formatted_data_istream.gcount());
+ protected_data_stream.write((const char *)encrypted_buffer, encrypted_length);
+ }
+
+ // no EVP_EncrypteFinal, as this is a stream cipher
EVP_CIPHER_CTX_free(ctx);
- protected_data_stream.close();
- }
- catch (...)
- {
- LOG_UNHANDLED_EXCEPTION("LLProtectedDataException(Error writing Protected Data Store)");
- // it's good practice to clean up any secure information on error
- // (even though this file isn't really secure. Perhaps in the future
- // it may be, however.
- LLFile::remove(tmp_filename);
+ protected_data_stream.close();
+ }
+ catch (...)
+ {
+ LOG_UNHANDLED_EXCEPTION("LLProtectedDataException(Error writing Protected Data Store)");
+ // it's good practice to clean up any secure information on error
+ // (even though this file isn't really secure. Perhaps in the future
+ // it may be, however.
+ LLFile::remove(tmp_filename);
if (ctx)
{
EVP_CIPHER_CTX_free(ctx);
}
- // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
- // Decided throwing an exception here was overkill until we figure out why this happens
- //LLTHROW(LLProtectedDataException("Error writing Protected Data Store"));
- }
-
- try
- {
- // move the temporary file to the specified file location.
- if((( (LLFile::isfile(mProtectedDataFilename) != 0)
- && (LLFile::remove(mProtectedDataFilename) != 0)))
- || (LLFile::rename(tmp_filename, mProtectedDataFilename)))
- {
- LL_WARNS() << "LLProtectedDataException(Could not overwrite protected data store)" << LL_ENDL;
- LLFile::remove(tmp_filename);
-
- // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
- // Decided throwing an exception here was overkill until we figure out why this happens
- //LLTHROW(LLProtectedDataException("Could not overwrite protected data store"));
- }
- }
- catch (...)
- {
- LOG_UNHANDLED_EXCEPTION(STRINGIZE("renaming '" << tmp_filename << "' to '"
- << mProtectedDataFilename << "'"));
- // it's good practice to clean up any secure information on error
- // (even though this file isn't really secure. Perhaps in the future
- // it may be, however).
- LLFile::remove(tmp_filename);
-
- //crash in LLSecAPIBasicHandler::_writeProtectedData()
- // Decided throwing an exception here was overkill until we figure out why this happens
- //LLTHROW(LLProtectedDataException("Error writing Protected Data Store"));
- }
+ // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
+ // Decided throwing an exception here was overkill until we figure out why this happens
+ //LLTHROW(LLProtectedDataException("Error writing Protected Data Store"));
+ }
+
+ try
+ {
+ // move the temporary file to the specified file location.
+ if((( (LLFile::isfile(mProtectedDataFilename) != 0)
+ && (LLFile::remove(mProtectedDataFilename) != 0)))
+ || (LLFile::rename(tmp_filename, mProtectedDataFilename)))
+ {
+ LL_WARNS() << "LLProtectedDataException(Could not overwrite protected data store)" << LL_ENDL;
+ LLFile::remove(tmp_filename);
+
+ // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
+ // Decided throwing an exception here was overkill until we figure out why this happens
+ //LLTHROW(LLProtectedDataException("Could not overwrite protected data store"));
+ }
+ }
+ catch (...)
+ {
+ LOG_UNHANDLED_EXCEPTION(STRINGIZE("renaming '" << tmp_filename << "' to '"
+ << mProtectedDataFilename << "'"));
+ // it's good practice to clean up any secure information on error
+ // (even though this file isn't really secure. Perhaps in the future
+ // it may be, however).
+ LLFile::remove(tmp_filename);
+
+ //crash in LLSecAPIBasicHandler::_writeProtectedData()
+ // Decided throwing an exception here was overkill until we figure out why this happens
+ //LLTHROW(LLProtectedDataException("Error writing Protected Data Store"));
+ }
}
// instantiate a certificate from a pem string
LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(const std::string& pem_cert)
{
- LLPointer<LLCertificate> result = new LLBasicCertificate(pem_cert);
- return result;
+ LLPointer<LLCertificate> result = new LLBasicCertificate(pem_cert);
+ return result;
}
-
-
+
+
// instiate a certificate from an openssl X509 structure
LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(X509* openssl_cert)
{
- LLPointer<LLCertificate> result = new LLBasicCertificate(openssl_cert);
- return result;
+ LLPointer<LLCertificate> result = new LLBasicCertificate(openssl_cert);
+ return result;
}
-
+
// instantiate a chain from an X509_STORE_CTX
LLPointer<LLCertificateChain> LLSecAPIBasicHandler::getCertificateChain(X509_STORE_CTX* chain)
{
- LLPointer<LLCertificateChain> result = new LLBasicCertificateChain(chain);
- return result;
+ LLPointer<LLCertificateChain> result = new LLBasicCertificateChain(chain);
+ return result;
}
-
+
// instantiate a cert store given it's id. if a persisted version
// exists, it'll be loaded. If not, one will be created (but not
// persisted)
LLPointer<LLCertificateStore> LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id)
{
- return mStore;
+ return mStore;
}
-
+
// retrieve protected data
LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type,
- const std::string& data_id)
+ const std::string& data_id)
{
- if (mProtectedDataMap.has(data_type) &&
- mProtectedDataMap[data_type].isMap() &&
- mProtectedDataMap[data_type].has(data_id))
- {
- return mProtectedDataMap[data_type][data_id];
- }
-
- return LLSD();
+ if (mProtectedDataMap.has(data_type) &&
+ mProtectedDataMap[data_type].isMap() &&
+ mProtectedDataMap[data_type].has(data_id))
+ {
+ return mProtectedDataMap[data_type][data_id];
+ }
+
+ return LLSD();
}
void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type,
- const std::string& data_id)
+ const std::string& data_id)
{
- if (mProtectedDataMap.has(data_type) &&
- mProtectedDataMap[data_type].isMap() &&
- mProtectedDataMap[data_type].has(data_id))
- {
- mProtectedDataMap[data_type].erase(data_id);
- }
+ if (mProtectedDataMap.has(data_type) &&
+ mProtectedDataMap[data_type].isMap() &&
+ mProtectedDataMap[data_type].has(data_id))
+ {
+ mProtectedDataMap[data_type].erase(data_id);
+ }
}
@@ -1566,21 +1566,21 @@ void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type,
// persist data in a protected store
//
void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type,
- const std::string& data_id,
- const LLSD& data)
+ const std::string& data_id,
+ const LLSD& data)
{
- if (!mProtectedDataMap.has(data_type) || !mProtectedDataMap[data_type].isMap()) {
- mProtectedDataMap[data_type] = LLSD::emptyMap();
- }
-
- mProtectedDataMap[data_type][data_id] = data;
+ if (!mProtectedDataMap.has(data_type) || !mProtectedDataMap[data_type].isMap()) {
+ mProtectedDataMap[data_type] = LLSD::emptyMap();
+ }
+
+ mProtectedDataMap[data_type][data_id] = data;
}
// persist data in a protected store's map
void LLSecAPIBasicHandler::addToProtectedMap(const std::string& data_type,
- const std::string& data_id,
- const std::string& map_elem,
- const LLSD& data)
+ const std::string& data_id,
+ const std::string& map_elem,
+ const LLSD& data)
{
if (!mProtectedDataMap.has(data_type) || !mProtectedDataMap[data_type].isMap()) {
mProtectedDataMap[data_type] = LLSD::emptyMap();
@@ -1595,8 +1595,8 @@ void LLSecAPIBasicHandler::addToProtectedMap(const std::string& data_type,
// remove data from protected store's map
void LLSecAPIBasicHandler::removeFromProtectedMap(const std::string& data_type,
- const std::string& data_id,
- const std::string& map_elem)
+ const std::string& data_id,
+ const std::string& map_elem)
{
if (mProtectedDataMap.has(data_type) &&
mProtectedDataMap[data_type].isMap() &&
@@ -1617,85 +1617,85 @@ void LLSecAPIBasicHandler::syncProtectedMap()
// Create a credential object from an identifier and authenticator. credentials are
// per grid.
LLPointer<LLCredential> LLSecAPIBasicHandler::createCredential(const std::string& grid,
- const LLSD& identifier,
- const LLSD& authenticator)
+ const LLSD& identifier,
+ const LLSD& authenticator)
{
- LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
- result->setCredentialData(identifier, authenticator);
- return result;
+ LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
+ result->setCredentialData(identifier, authenticator);
+ return result;
}
// Load a credential from default credential store, given the grid
LLPointer<LLCredential> LLSecAPIBasicHandler::loadCredential(const std::string& grid)
{
- LLSD credential = getProtectedData(DEFAULT_CREDENTIAL_STORAGE, grid);
- LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
- if(credential.isMap() &&
- credential.has("identifier"))
- {
-
- LLSD identifier = credential["identifier"];
- LLSD authenticator;
- if (credential.has("authenticator"))
- {
- authenticator = credential["authenticator"];
- }
- result->setCredentialData(identifier, authenticator);
- }
- else
- {
- // credential was not in protected storage, so pull the credential
- // from the legacy store.
- std::string first_name = gSavedSettings.getString("FirstName");
- std::string last_name = gSavedSettings.getString("LastName");
-
- if ((first_name != "") &&
- (last_name != ""))
- {
- LLSD identifier = LLSD::emptyMap();
- LLSD authenticator;
- identifier["type"] = "agent";
- identifier["first_name"] = first_name;
- identifier["last_name"] = last_name;
-
- std::string legacy_password = _legacyLoadPassword();
- if (legacy_password.length() > 0)
- {
- authenticator = LLSD::emptyMap();
- authenticator["type"] = "hash";
- authenticator["algorithm"] = "md5";
- authenticator["secret"] = legacy_password;
- }
- result->setCredentialData(identifier, authenticator);
- }
- }
- return result;
+ LLSD credential = getProtectedData(DEFAULT_CREDENTIAL_STORAGE, grid);
+ LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
+ if(credential.isMap() &&
+ credential.has("identifier"))
+ {
+
+ LLSD identifier = credential["identifier"];
+ LLSD authenticator;
+ if (credential.has("authenticator"))
+ {
+ authenticator = credential["authenticator"];
+ }
+ result->setCredentialData(identifier, authenticator);
+ }
+ else
+ {
+ // credential was not in protected storage, so pull the credential
+ // from the legacy store.
+ std::string first_name = gSavedSettings.getString("FirstName");
+ std::string last_name = gSavedSettings.getString("LastName");
+
+ if ((first_name != "") &&
+ (last_name != ""))
+ {
+ LLSD identifier = LLSD::emptyMap();
+ LLSD authenticator;
+ identifier["type"] = "agent";
+ identifier["first_name"] = first_name;
+ identifier["last_name"] = last_name;
+
+ std::string legacy_password = _legacyLoadPassword();
+ if (legacy_password.length() > 0)
+ {
+ authenticator = LLSD::emptyMap();
+ authenticator["type"] = "hash";
+ authenticator["algorithm"] = "md5";
+ authenticator["secret"] = legacy_password;
+ }
+ result->setCredentialData(identifier, authenticator);
+ }
+ }
+ return result;
}
// Save the credential to the credential store. Save the authenticator also if requested.
// That feature is used to implement the 'remember password' functionality.
void LLSecAPIBasicHandler::saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)
{
- LLSD credential = LLSD::emptyMap();
- credential["identifier"] = cred->getIdentifier();
- if (save_authenticator)
- {
- credential["authenticator"] = cred->getAuthenticator();
- }
- LL_DEBUGS("SECAPI") << "Saving Credential " << cred->getGrid() << ":" << cred->userID() << " " << save_authenticator << LL_ENDL;
- setProtectedData(DEFAULT_CREDENTIAL_STORAGE, cred->getGrid(), credential);
- //*TODO: If we're saving Agni credentials, should we write the
- // credentials to the legacy password.dat/etc?
- _writeProtectedData();
+ LLSD credential = LLSD::emptyMap();
+ credential["identifier"] = cred->getIdentifier();
+ if (save_authenticator)
+ {
+ credential["authenticator"] = cred->getAuthenticator();
+ }
+ LL_DEBUGS("SECAPI") << "Saving Credential " << cred->getGrid() << ":" << cred->userID() << " " << save_authenticator << LL_ENDL;
+ setProtectedData(DEFAULT_CREDENTIAL_STORAGE, cred->getGrid(), credential);
+ //*TODO: If we're saving Agni credentials, should we write the
+ // credentials to the legacy password.dat/etc?
+ _writeProtectedData();
}
// Remove a credential from the credential store.
void LLSecAPIBasicHandler::deleteCredential(LLPointer<LLCredential> cred)
{
- LLSD undefVal;
- deleteProtectedData(DEFAULT_CREDENTIAL_STORAGE, cred->getGrid());
- cred->setCredentialData(undefVal, undefVal);
- _writeProtectedData();
+ LLSD undefVal;
+ deleteProtectedData(DEFAULT_CREDENTIAL_STORAGE, cred->getGrid());
+ cred->setCredentialData(undefVal, undefVal);
+ _writeProtectedData();
}
// has map of credentials declared as specific storage
@@ -1837,136 +1837,136 @@ void LLSecAPIBasicHandler::removeCredentialMap(const std::string& storage, const
_writeProtectedData();
}
-// load the legacy hash for agni, and decrypt it given the
+// load the legacy hash for agni, and decrypt it given the
// mac address
std::string LLSecAPIBasicHandler::_legacyLoadPassword()
{
- const S32 HASHED_LENGTH = 32;
- std::vector<U8> buffer(HASHED_LENGTH);
- llifstream password_file(mLegacyPasswordPath.c_str(), llifstream::binary);
-
- if(password_file.fail())
- {
- return std::string("");
- }
-
- password_file.read((char*)&buffer[0], buffer.size());
- if(password_file.gcount() != buffer.size())
- {
- return std::string("");
- }
-
- // Decipher with MAC address
- unsigned char unique_id[MAC_ADDRESS_BYTES];
+ const S32 HASHED_LENGTH = 32;
+ std::vector<U8> buffer(HASHED_LENGTH);
+ llifstream password_file(mLegacyPasswordPath.c_str(), llifstream::binary);
+
+ if(password_file.fail())
+ {
+ return std::string("");
+ }
+
+ password_file.read((char*)&buffer[0], buffer.size());
+ if(password_file.gcount() != buffer.size())
+ {
+ return std::string("");
+ }
+
+ // Decipher with MAC address
+ unsigned char unique_id[MAC_ADDRESS_BYTES];
LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
- LLXORCipher cipher(unique_id, sizeof(unique_id));
- cipher.decrypt(&buffer[0], buffer.size());
-
- return std::string((const char*)&buffer[0], buffer.size());
+ LLXORCipher cipher(unique_id, sizeof(unique_id));
+ cipher.decrypt(&buffer[0], buffer.size());
+
+ return std::string((const char*)&buffer[0], buffer.size());
}
// return an identifier for the user
std::string LLSecAPIBasicCredential::userID() const
{
- if (!mIdentifier.isMap())
- {
- return mGrid + "(null)";
- }
- else if ((std::string)mIdentifier["type"] == "agent")
- {
- std::string id = (std::string)mIdentifier["first_name"] + "_" + (std::string)mIdentifier["last_name"];
- LLStringUtil::toLower(id);
- return id;
- }
- else if ((std::string)mIdentifier["type"] == "account")
- {
- std::string id = (std::string)mIdentifier["account_name"];
- LLStringUtil::toLower(id);
- return id;
- }
-
- return "unknown";
+ if (!mIdentifier.isMap())
+ {
+ return mGrid + "(null)";
+ }
+ else if ((std::string)mIdentifier["type"] == "agent")
+ {
+ std::string id = (std::string)mIdentifier["first_name"] + "_" + (std::string)mIdentifier["last_name"];
+ LLStringUtil::toLower(id);
+ return id;
+ }
+ else if ((std::string)mIdentifier["type"] == "account")
+ {
+ std::string id = (std::string)mIdentifier["account_name"];
+ LLStringUtil::toLower(id);
+ return id;
+ }
+
+ return "unknown";
}
// return a printable user identifier
std::string LLSecAPIBasicCredential::asString() const
{
- if (!mIdentifier.isMap())
- {
- return mGrid + ":(null)";
- }
- else if ((std::string)mIdentifier["type"] == "agent")
- {
- return mGrid + ":" + (std::string)mIdentifier["first_name"] + " " + (std::string)mIdentifier["last_name"];
- }
- else if ((std::string)mIdentifier["type"] == "account")
- {
- return mGrid + ":" + (std::string)mIdentifier["account_name"];
- }
+ if (!mIdentifier.isMap())
+ {
+ return mGrid + ":(null)";
+ }
+ else if ((std::string)mIdentifier["type"] == "agent")
+ {
+ return mGrid + ":" + (std::string)mIdentifier["first_name"] + " " + (std::string)mIdentifier["last_name"];
+ }
+ else if ((std::string)mIdentifier["type"] == "account")
+ {
+ return mGrid + ":" + (std::string)mIdentifier["account_name"];
+ }
- return mGrid + ":(unknown type)";
+ return mGrid + ":(unknown type)";
}
bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs)
{
- if (lhs.type() != rhs.type())
- {
- return FALSE;
- }
+ if (lhs.type() != rhs.type())
+ {
+ return FALSE;
+ }
if (lhs.isMap())
- {
- // iterate through the map, verifying the right hand side has all of the
- // values that the left hand side has.
- for (LLSD::map_const_iterator litt = lhs.beginMap();
- litt != lhs.endMap();
- litt++)
- {
- if (!rhs.has(litt->first))
- {
- return FALSE;
- }
- }
-
- // Now validate that the left hand side has everything the
- // right hand side has, and that the values are equal.
- for (LLSD::map_const_iterator ritt = rhs.beginMap();
- ritt != rhs.endMap();
- ritt++)
- {
- if (!lhs.has(ritt->first))
- {
- return FALSE;
- }
- if (!valueCompareLLSD(lhs[ritt->first], ritt->second))
- {
- return FALSE;
- }
- }
- return TRUE;
- }
+ {
+ // iterate through the map, verifying the right hand side has all of the
+ // values that the left hand side has.
+ for (LLSD::map_const_iterator litt = lhs.beginMap();
+ litt != lhs.endMap();
+ litt++)
+ {
+ if (!rhs.has(litt->first))
+ {
+ return FALSE;
+ }
+ }
+
+ // Now validate that the left hand side has everything the
+ // right hand side has, and that the values are equal.
+ for (LLSD::map_const_iterator ritt = rhs.beginMap();
+ ritt != rhs.endMap();
+ ritt++)
+ {
+ if (!lhs.has(ritt->first))
+ {
+ return FALSE;
+ }
+ if (!valueCompareLLSD(lhs[ritt->first], ritt->second))
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+ }
else if (lhs.isArray())
- {
- LLSD::array_const_iterator ritt = rhs.beginArray();
- // iterate through the array, comparing
- for (LLSD::array_const_iterator litt = lhs.beginArray();
- litt != lhs.endArray();
- litt++)
- {
- if (!valueCompareLLSD(*ritt, *litt))
- {
- return FALSE;
- }
- ritt++;
- }
-
- return (ritt == rhs.endArray());
- }
+ {
+ LLSD::array_const_iterator ritt = rhs.beginArray();
+ // iterate through the array, comparing
+ for (LLSD::array_const_iterator litt = lhs.beginArray();
+ litt != lhs.endArray();
+ litt++)
+ {
+ if (!valueCompareLLSD(*ritt, *litt))
+ {
+ return FALSE;
+ }
+ ritt++;
+ }
+
+ return (ritt == rhs.endArray());
+ }
else
- {
- // simple type, compare as string
- return (lhs.asString() == rhs.asString());
- }
-
+ {
+ // simple type, compare as string
+ return (lhs.asString() == rhs.asString());
+ }
+
}
diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h
index bd1a8f640c..b4108d0c0e 100644
--- a/indra/newview/llsechandler_basic.h
+++ b/indra/newview/llsechandler_basic.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsechandler_basic.h
* @brief Security API for services such as certificate handling
* secure local storage, etc.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,35 +41,35 @@ extern std::string cert_get_digest(const std::string& digest_type, X509 *cert);
// class LLCertificate
-//
+//
class LLBasicCertificate : public LLCertificate
{
-public:
- LOG_CLASS(LLBasicCertificate);
+public:
+ LOG_CLASS(LLBasicCertificate);
// The optional validation_params allow us to make the unit test time-invariant
- LLBasicCertificate(const std::string& pem_cert, const LLSD* validation_params = NULL);
- LLBasicCertificate(X509* openSSLX509, const LLSD* validation_params = NULL);
-
- virtual ~LLBasicCertificate();
-
- virtual std::string getPem() const;
- virtual std::vector<U8> getBinary() const;
- virtual void getLLSD(LLSD &llsd);
-
- virtual X509* getOpenSSLX509() const;
-
- // set llsd elements for testing
- void setLLSD(const std::string name, const LLSD& value) { mLLSDInfo[name] = value; }
+ LLBasicCertificate(const std::string& pem_cert, const LLSD* validation_params = NULL);
+ LLBasicCertificate(X509* openSSLX509, const LLSD* validation_params = NULL);
+
+ virtual ~LLBasicCertificate();
+
+ virtual std::string getPem() const;
+ virtual std::vector<U8> getBinary() const;
+ virtual void getLLSD(LLSD &llsd);
+
+ virtual X509* getOpenSSLX509() const;
+
+ // set llsd elements for testing
+ void setLLSD(const std::string name, const LLSD& value) { mLLSDInfo[name] = value; }
protected:
- // certificates are stored as X509 objects, as validation and
- // other functionality is via openssl
- X509* mCert;
-
- LLSD& _initLLSD();
- LLSD mLLSDInfo;
+ // certificates are stored as X509 objects, as validation and
+ // other functionality is via openssl
+ X509* mCert;
+
+ LLSD& _initLLSD();
+ LLSD mLLSDInfo;
};
@@ -78,79 +78,79 @@ protected:
// This implementation uses a stl vector of certificates.
class LLBasicCertificateVector : virtual public LLCertificateVector
{
-
+
public:
- LLBasicCertificateVector() {}
-
- virtual ~LLBasicCertificateVector() {}
-
- // Implementation of the basic iterator implementation.
- // The implementation uses a vector iterator derived from
- // the vector in the LLBasicCertificateVector class
- class BasicIteratorImpl : public iterator_impl
- {
- public:
- BasicIteratorImpl(std::vector<LLPointer<LLCertificate> >::iterator _iter) { mIter = _iter;}
- virtual ~BasicIteratorImpl() {};
- // seek forward or back. Used by the operator++/operator-- implementations
- virtual void seek(bool incr)
- {
- if(incr)
- {
- mIter++;
- }
- else
- {
- mIter--;
- }
- }
- // create a copy of the iterator implementation class, used by the iterator copy constructor
- virtual LLPointer<iterator_impl> clone() const
- {
- return new BasicIteratorImpl(mIter);
- }
-
- virtual bool equals(const LLPointer<iterator_impl>& _iter) const
- {
- const BasicIteratorImpl *rhs_iter = dynamic_cast<const BasicIteratorImpl *>(_iter.get());
- llassert(rhs_iter);
- if (!rhs_iter) return 0;
- return (mIter == rhs_iter->mIter);
- }
- virtual LLPointer<LLCertificate> get()
- {
- return *mIter;
- }
- protected:
- friend class LLBasicCertificateVector;
- std::vector<LLPointer<LLCertificate> >::iterator mIter;
- };
-
- // numeric index of the vector
- virtual LLPointer<LLCertificate> operator[](int _index) { return mCerts[_index];}
-
- // Iteration
- virtual iterator begin() { return iterator(new BasicIteratorImpl(mCerts.begin())); }
-
- virtual iterator end() { return iterator(new BasicIteratorImpl(mCerts.end())); }
-
- // find a cert given params
- virtual iterator find(const LLSD& params);
-
- // return the number of certs in the store
- virtual int size() const { return mCerts.size(); }
-
- // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first
- virtual void add(LLPointer<LLCertificate> cert) { insert(end(), cert); }
-
- // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first
- virtual void insert(iterator _iter, LLPointer<LLCertificate> cert);
-
- // remove a certificate from the store
- virtual LLPointer<LLCertificate> erase(iterator _iter);
-
+ LLBasicCertificateVector() {}
+
+ virtual ~LLBasicCertificateVector() {}
+
+ // Implementation of the basic iterator implementation.
+ // The implementation uses a vector iterator derived from
+ // the vector in the LLBasicCertificateVector class
+ class BasicIteratorImpl : public iterator_impl
+ {
+ public:
+ BasicIteratorImpl(std::vector<LLPointer<LLCertificate> >::iterator _iter) { mIter = _iter;}
+ virtual ~BasicIteratorImpl() {};
+ // seek forward or back. Used by the operator++/operator-- implementations
+ virtual void seek(bool incr)
+ {
+ if(incr)
+ {
+ mIter++;
+ }
+ else
+ {
+ mIter--;
+ }
+ }
+ // create a copy of the iterator implementation class, used by the iterator copy constructor
+ virtual LLPointer<iterator_impl> clone() const
+ {
+ return new BasicIteratorImpl(mIter);
+ }
+
+ virtual bool equals(const LLPointer<iterator_impl>& _iter) const
+ {
+ const BasicIteratorImpl *rhs_iter = dynamic_cast<const BasicIteratorImpl *>(_iter.get());
+ llassert(rhs_iter);
+ if (!rhs_iter) return 0;
+ return (mIter == rhs_iter->mIter);
+ }
+ virtual LLPointer<LLCertificate> get()
+ {
+ return *mIter;
+ }
+ protected:
+ friend class LLBasicCertificateVector;
+ std::vector<LLPointer<LLCertificate> >::iterator mIter;
+ };
+
+ // numeric index of the vector
+ virtual LLPointer<LLCertificate> operator[](int _index) { return mCerts[_index];}
+
+ // Iteration
+ virtual iterator begin() { return iterator(new BasicIteratorImpl(mCerts.begin())); }
+
+ virtual iterator end() { return iterator(new BasicIteratorImpl(mCerts.end())); }
+
+ // find a cert given params
+ virtual iterator find(const LLSD& params);
+
+ // return the number of certs in the store
+ virtual int size() const { return mCerts.size(); }
+
+ // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first
+ virtual void add(LLPointer<LLCertificate> cert) { insert(end(), cert); }
+
+ // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first
+ virtual void insert(iterator _iter, LLPointer<LLCertificate> cert);
+
+ // remove a certificate from the store
+ virtual LLPointer<LLCertificate> erase(iterator _iter);
+
protected:
- std::vector<LLPointer<LLCertificate> >mCerts;
+ std::vector<LLPointer<LLCertificate> >mCerts;
};
// class LLCertificateStore
@@ -161,49 +161,49 @@ protected:
class LLBasicCertificateStore : virtual public LLBasicCertificateVector, public LLCertificateStore
{
public:
- LLBasicCertificateStore(const std::string& filename);
- void load_from_file(const std::string& filename);
-
- virtual ~LLBasicCertificateStore();
-
- // persist the store
- virtual void save();
-
- // return the store id
- virtual std::string storeId() const;
-
- // validate a certificate chain against a certificate store, using the
- // given validation policy.
- virtual void validate(int validation_policy,
- LLPointer<LLCertificateChain> ca_chain,
- const LLSD& validation_params);
-
- // Clears cache of certs validated agains store
- virtual void clearSertCache() { mTrustedCertCache.clear(); }
+ LLBasicCertificateStore(const std::string& filename);
+ void load_from_file(const std::string& filename);
+
+ virtual ~LLBasicCertificateStore();
+
+ // persist the store
+ virtual void save();
+
+ // return the store id
+ virtual std::string storeId() const;
+
+ // validate a certificate chain against a certificate store, using the
+ // given validation policy.
+ virtual void validate(int validation_policy,
+ LLPointer<LLCertificateChain> ca_chain,
+ const LLSD& validation_params);
+
+ // Clears cache of certs validated agains store
+ virtual void clearSertCache() { mTrustedCertCache.clear(); }
protected:
- std::vector<LLPointer<LLCertificate> > mCerts;
-
- // cache of cert sha1 hashes to from/to date pairs, to improve
- // performance of cert trust. Note, these are not the CA certs,
- // but the certs that have been validated against this store.
- typedef std::map<std::string, std::pair<LLDate, LLDate> > t_cert_cache;
- t_cert_cache mTrustedCertCache;
-
- std::string mFilename;
+ std::vector<LLPointer<LLCertificate> > mCerts;
+
+ // cache of cert sha1 hashes to from/to date pairs, to improve
+ // performance of cert trust. Note, these are not the CA certs,
+ // but the certs that have been validated against this store.
+ typedef std::map<std::string, std::pair<LLDate, LLDate> > t_cert_cache;
+ t_cert_cache mTrustedCertCache;
+
+ std::string mFilename;
};
// class LLCertificateChain
-// Class representing a chain of certificates in order, with the
+// Class representing a chain of certificates in order, with the
// first element being the child cert.
class LLBasicCertificateChain : virtual public LLBasicCertificateVector, public LLCertificateChain
{
-
+
public:
- LLBasicCertificateChain(X509_STORE_CTX * store);
-
- virtual ~LLBasicCertificateChain() {}
-
+ LLBasicCertificateChain(X509_STORE_CTX * store);
+
+ virtual ~LLBasicCertificateChain() {}
+
};
@@ -212,14 +212,14 @@ public:
class LLSecAPIBasicCredential : public LLCredential
{
public:
- LLSecAPIBasicCredential(const std::string& grid) : LLCredential(grid) {}
- virtual ~LLSecAPIBasicCredential() {}
- // return a value representing the user id, used for server and voice
- // (could be guid, name in format "name_resident", whatever)
- virtual std::string userID() const;
-
- // printible string identifying the credential.
- virtual std::string asString() const;
+ LLSecAPIBasicCredential(const std::string& grid) : LLCredential(grid) {}
+ virtual ~LLSecAPIBasicCredential() {}
+ // return a value representing the user id, used for server and voice
+ // (could be guid, name in format "name_resident", whatever)
+ virtual std::string userID() const;
+
+ // printible string identifying the credential.
+ virtual std::string asString() const;
};
// LLSecAPIBasicHandler Class
@@ -227,121 +227,121 @@ public:
class LLSecAPIBasicHandler : public LLSecAPIHandler
{
public:
-
- LLSecAPIBasicHandler(const std::string& protected_data_filename,
- const std::string& legacy_password_path);
- LLSecAPIBasicHandler();
-
- void init();
-
- virtual ~LLSecAPIBasicHandler();
-
- // instantiate a certificate from a pem string
- virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert);
-
-
- // instiate a certificate from an openssl X509 structure
- virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert);
-
- // instantiate a chain from an X509_STORE_CTX
- virtual LLPointer<LLCertificateChain> getCertificateChain(X509_STORE_CTX* chain);
-
- // instantiate a cert store given it's id. if a persisted version
- // exists, it'll be loaded. If not, one will be created (but not
- // persisted)
- virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id);
-
- // protectedData functions technically should be pretected or private,
- // they are not because of llsechandler_basic_test imlementation
-
- // persist data in a protected store
- virtual void setProtectedData(const std::string& data_type,
- const std::string& data_id,
- const LLSD& data);
-
- // retrieve protected data
- virtual LLSD getProtectedData(const std::string& data_type,
- const std::string& data_id);
-
- // delete a protected data item from the store
- virtual void deleteProtectedData(const std::string& data_type,
- const std::string& data_id);
-
- // persist data in a protected store's map
- virtual void addToProtectedMap(const std::string& data_type,
- const std::string& data_id,
- const std::string& map_elem,
- const LLSD& data);
-
- // remove data from protected store's map
- virtual void removeFromProtectedMap(const std::string& data_type,
- const std::string& data_id,
- const std::string& map_elem);
-
- // ensure protected store's map is written to storage
- virtual void syncProtectedMap();
-
- // credential management routines
-
- virtual LLPointer<LLCredential> createCredential(const std::string& grid,
- const LLSD& identifier,
- const LLSD& authenticator);
-
- // load single credencial from default storage
- virtual LLPointer<LLCredential> loadCredential(const std::string& grid);
-
- // save credencial to default storage
- virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator);
-
- virtual void deleteCredential(LLPointer<LLCredential> cred);
-
- // has map of credentials declared as specific storage
- virtual bool hasCredentialMap(const std::string& storage,
- const std::string& grid);
-
- // returns true if map is empty or does not exist
- virtual bool emptyCredentialMap(const std::string& storage,
- const std::string& grid);
-
- // load map of credentials from specific storage
- virtual void loadCredentialMap(const std::string& storage,
- const std::string& grid,
- credential_map_t& credential_map);
-
- // load single username from map of credentials from specific storage
- virtual LLPointer<LLCredential> loadFromCredentialMap(const std::string& storage,
- const std::string& grid,
- const std::string& userid);
-
- // add item to map of credentials from specific storage
- virtual void addToCredentialMap(const std::string& storage,
- LLPointer<LLCredential> cred,
- bool save_authenticator);
-
- // remove item from map of credentials from specific storage
- virtual void removeFromCredentialMap(const std::string& storage,
- LLPointer<LLCredential> cred);
-
- // remove item from map of credentials from specific storage
- virtual void removeFromCredentialMap(const std::string& storage,
- const std::string& grid,
- const std::string& userid);
-
- virtual void removeCredentialMap(const std::string& storage,
- const std::string& grid);
+
+ LLSecAPIBasicHandler(const std::string& protected_data_filename,
+ const std::string& legacy_password_path);
+ LLSecAPIBasicHandler();
+
+ void init();
+
+ virtual ~LLSecAPIBasicHandler();
+
+ // instantiate a certificate from a pem string
+ virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert);
+
+
+ // instiate a certificate from an openssl X509 structure
+ virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert);
+
+ // instantiate a chain from an X509_STORE_CTX
+ virtual LLPointer<LLCertificateChain> getCertificateChain(X509_STORE_CTX* chain);
+
+ // instantiate a cert store given it's id. if a persisted version
+ // exists, it'll be loaded. If not, one will be created (but not
+ // persisted)
+ virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id);
+
+ // protectedData functions technically should be pretected or private,
+ // they are not because of llsechandler_basic_test imlementation
+
+ // persist data in a protected store
+ virtual void setProtectedData(const std::string& data_type,
+ const std::string& data_id,
+ const LLSD& data);
+
+ // retrieve protected data
+ virtual LLSD getProtectedData(const std::string& data_type,
+ const std::string& data_id);
+
+ // delete a protected data item from the store
+ virtual void deleteProtectedData(const std::string& data_type,
+ const std::string& data_id);
+
+ // persist data in a protected store's map
+ virtual void addToProtectedMap(const std::string& data_type,
+ const std::string& data_id,
+ const std::string& map_elem,
+ const LLSD& data);
+
+ // remove data from protected store's map
+ virtual void removeFromProtectedMap(const std::string& data_type,
+ const std::string& data_id,
+ const std::string& map_elem);
+
+ // ensure protected store's map is written to storage
+ virtual void syncProtectedMap();
+
+ // credential management routines
+
+ virtual LLPointer<LLCredential> createCredential(const std::string& grid,
+ const LLSD& identifier,
+ const LLSD& authenticator);
+
+ // load single credencial from default storage
+ virtual LLPointer<LLCredential> loadCredential(const std::string& grid);
+
+ // save credencial to default storage
+ virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator);
+
+ virtual void deleteCredential(LLPointer<LLCredential> cred);
+
+ // has map of credentials declared as specific storage
+ virtual bool hasCredentialMap(const std::string& storage,
+ const std::string& grid);
+
+ // returns true if map is empty or does not exist
+ virtual bool emptyCredentialMap(const std::string& storage,
+ const std::string& grid);
+
+ // load map of credentials from specific storage
+ virtual void loadCredentialMap(const std::string& storage,
+ const std::string& grid,
+ credential_map_t& credential_map);
+
+ // load single username from map of credentials from specific storage
+ virtual LLPointer<LLCredential> loadFromCredentialMap(const std::string& storage,
+ const std::string& grid,
+ const std::string& userid);
+
+ // add item to map of credentials from specific storage
+ virtual void addToCredentialMap(const std::string& storage,
+ LLPointer<LLCredential> cred,
+ bool save_authenticator);
+
+ // remove item from map of credentials from specific storage
+ virtual void removeFromCredentialMap(const std::string& storage,
+ LLPointer<LLCredential> cred);
+
+ // remove item from map of credentials from specific storage
+ virtual void removeFromCredentialMap(const std::string& storage,
+ const std::string& grid,
+ const std::string& userid);
+
+ virtual void removeCredentialMap(const std::string& storage,
+ const std::string& grid);
protected:
- void _readProtectedData(unsigned char *unique_id, U32 id_len);
- void _readProtectedData();
- void _writeProtectedData();
- std::string _legacyLoadPassword();
-
- std::string mProtectedDataFilename;
- LLSD mProtectedDataMap;
- LLPointer<LLBasicCertificateStore> mStore;
-
- std::string mLegacyPasswordPath;
+ void _readProtectedData(unsigned char *unique_id, U32 id_len);
+ void _readProtectedData();
+ void _writeProtectedData();
+ std::string _legacyLoadPassword();
+
+ std::string mProtectedDataFilename;
+ LLSD mProtectedDataMap;
+ LLPointer<LLBasicCertificateStore> mStore;
+
+ std::string mLegacyPasswordPath;
};
bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs);
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index b50c0f60bd..885f4d993e 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llselectmgr.cpp
* @brief A manager for selected objects and faces.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -120,13 +120,13 @@ const S32 MAX_CHILDREN_PER_TASK = 255;
BOOL LLSelectMgr::sRectSelectInclusive = TRUE;
BOOL LLSelectMgr::sRenderHiddenSelections = TRUE;
BOOL LLSelectMgr::sRenderLightRadius = FALSE;
-F32 LLSelectMgr::sHighlightThickness = 0.f;
-F32 LLSelectMgr::sHighlightUScale = 0.f;
-F32 LLSelectMgr::sHighlightVScale = 0.f;
-F32 LLSelectMgr::sHighlightAlpha = 0.f;
-F32 LLSelectMgr::sHighlightAlphaTest = 0.f;
-F32 LLSelectMgr::sHighlightUAnim = 0.f;
-F32 LLSelectMgr::sHighlightVAnim = 0.f;
+F32 LLSelectMgr::sHighlightThickness = 0.f;
+F32 LLSelectMgr::sHighlightUScale = 0.f;
+F32 LLSelectMgr::sHighlightVScale = 0.f;
+F32 LLSelectMgr::sHighlightAlpha = 0.f;
+F32 LLSelectMgr::sHighlightAlphaTest = 0.f;
+F32 LLSelectMgr::sHighlightUAnim = 0.f;
+F32 LLSelectMgr::sHighlightVAnim = 0.f;
LLColor4 LLSelectMgr::sSilhouetteParentColor;
LLColor4 LLSelectMgr::sSilhouetteChildColor;
LLColor4 LLSelectMgr::sHighlightInspectColor;
@@ -137,15 +137,15 @@ LLColor4 LLSelectMgr::sContextSilhouetteColor;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// struct LLDeRezInfo
//
-// Used to keep track of important derez info.
+// Used to keep track of important derez info.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct LLDeRezInfo
{
- EDeRezDestination mDestination;
- LLUUID mDestinationID;
- LLDeRezInfo(EDeRezDestination dest, const LLUUID& dest_id) :
- mDestination(dest), mDestinationID(dest_id) {}
+ EDeRezDestination mDestination;
+ LLUUID mDestinationID;
+ LLDeRezInfo(EDeRezDestination dest, const LLUUID& dest_id) :
+ mDestination(dest), mDestinationID(dest_id) {}
};
//
@@ -206,7 +206,7 @@ LLSelectionCallbackData::LLSelectionCallbackData()
void LLSelectMgr::cleanupGlobals()
{
- LLSelectMgr::getInstance()->clearSelections();
+ LLSelectMgr::getInstance()->clearSelections();
}
//-----------------------------------------------------------------------------
@@ -218,38 +218,38 @@ LLSelectMgr::LLSelectMgr()
mAllowSelectAvatar( LLCachedControl<bool>(gSavedSettings, "AllowSelectAvatar", FALSE)),
mDebugSelectMgr(LLCachedControl<bool>(gSavedSettings, "DebugSelectMgr", FALSE))
{
- mTEMode = FALSE;
- mTextureChannel = LLRender::DIFFUSE_MAP;
- mLastCameraPos.clearVec();
+ mTEMode = FALSE;
+ mTextureChannel = LLRender::DIFFUSE_MAP;
+ mLastCameraPos.clearVec();
+
+ sHighlightThickness = gSavedSettings.getF32("SelectionHighlightThickness");
+ sHighlightUScale = gSavedSettings.getF32("SelectionHighlightUScale");
+ sHighlightVScale = gSavedSettings.getF32("SelectionHighlightVScale");
+ sHighlightAlpha = gSavedSettings.getF32("SelectionHighlightAlpha") * 2;
+ sHighlightAlphaTest = gSavedSettings.getF32("SelectionHighlightAlphaTest");
+ sHighlightUAnim = gSavedSettings.getF32("SelectionHighlightUAnim");
+ sHighlightVAnim = gSavedSettings.getF32("SelectionHighlightVAnim");
- sHighlightThickness = gSavedSettings.getF32("SelectionHighlightThickness");
- sHighlightUScale = gSavedSettings.getF32("SelectionHighlightUScale");
- sHighlightVScale = gSavedSettings.getF32("SelectionHighlightVScale");
- sHighlightAlpha = gSavedSettings.getF32("SelectionHighlightAlpha") * 2;
- sHighlightAlphaTest = gSavedSettings.getF32("SelectionHighlightAlphaTest");
- sHighlightUAnim = gSavedSettings.getF32("SelectionHighlightUAnim");
- sHighlightVAnim = gSavedSettings.getF32("SelectionHighlightVAnim");
+ sSilhouetteParentColor =LLUIColorTable::instance().getColor("SilhouetteParentColor");
+ sSilhouetteChildColor = LLUIColorTable::instance().getColor("SilhouetteChildColor");
+ sHighlightParentColor = LLUIColorTable::instance().getColor("HighlightParentColor");
+ sHighlightChildColor = LLUIColorTable::instance().getColor("HighlightChildColor");
+ sHighlightInspectColor = LLUIColorTable::instance().getColor("HighlightInspectColor");
+ sContextSilhouetteColor = LLUIColorTable::instance().getColor("ContextSilhouetteColor")*0.5f;
- sSilhouetteParentColor =LLUIColorTable::instance().getColor("SilhouetteParentColor");
- sSilhouetteChildColor = LLUIColorTable::instance().getColor("SilhouetteChildColor");
- sHighlightParentColor = LLUIColorTable::instance().getColor("HighlightParentColor");
- sHighlightChildColor = LLUIColorTable::instance().getColor("HighlightChildColor");
- sHighlightInspectColor = LLUIColorTable::instance().getColor("HighlightInspectColor");
- sContextSilhouetteColor = LLUIColorTable::instance().getColor("ContextSilhouetteColor")*0.5f;
+ sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius");
- sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius");
-
- mRenderSilhouettes = TRUE;
+ mRenderSilhouettes = TRUE;
- mGridMode = GRID_MODE_WORLD;
- gSavedSettings.setS32("GridMode", (S32)GRID_MODE_WORLD);
+ mGridMode = GRID_MODE_WORLD;
+ gSavedSettings.setS32("GridMode", (S32)GRID_MODE_WORLD);
- mSelectedObjects = new LLObjectSelection();
- mHoverObjects = new LLObjectSelection();
- mHighlightedObjects = new LLObjectSelection();
+ mSelectedObjects = new LLObjectSelection();
+ mHoverObjects = new LLObjectSelection();
+ mHighlightedObjects = new LLObjectSelection();
- mForceSelection = FALSE;
- mShowSelection = FALSE;
+ mForceSelection = FALSE;
+ mShowSelection = FALSE;
}
@@ -258,47 +258,47 @@ LLSelectMgr::LLSelectMgr()
//-----------------------------------------------------------------------------
LLSelectMgr::~LLSelectMgr()
{
- clearSelections();
+ clearSelections();
}
void LLSelectMgr::clearSelections()
{
- mHoverObjects->deleteAllNodes();
- mSelectedObjects->deleteAllNodes();
- mHighlightedObjects->deleteAllNodes();
- mRectSelectedObjects.clear();
- mGridObjects.deleteAllNodes();
+ mHoverObjects->deleteAllNodes();
+ mSelectedObjects->deleteAllNodes();
+ mHighlightedObjects->deleteAllNodes();
+ mRectSelectedObjects.clear();
+ mGridObjects.deleteAllNodes();
- LLPipeline::setRenderHighlightTextureChannel(LLRender::DIFFUSE_MAP);
+ LLPipeline::setRenderHighlightTextureChannel(LLRender::DIFFUSE_MAP);
}
void LLSelectMgr::update()
{
- mSelectedObjects->cleanupNodes();
+ mSelectedObjects->cleanupNodes();
}
void LLSelectMgr::updateEffects()
{
- //keep reference grid objects active
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- LLDrawable* drawable = object->mDrawable;
- if (drawable)
- {
- gPipeline.markMoved(drawable);
- }
- return true;
- }
- } func;
- mGridObjects.applyToObjects(&func);
-
- if (mEffectsTimer.getElapsedTimeF32() > 1.f)
- {
- mSelectedObjects->updateEffects();
- mEffectsTimer.reset();
- }
+ //keep reference grid objects active
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ LLDrawable* drawable = object->mDrawable;
+ if (drawable)
+ {
+ gPipeline.markMoved(drawable);
+ }
+ return true;
+ }
+ } func;
+ mGridObjects.applyToObjects(&func);
+
+ if (mEffectsTimer.getElapsedTimeF32() > 1.f)
+ {
+ mSelectedObjects->updateEffects();
+ mEffectsTimer.reset();
+ }
}
void LLSelectMgr::resetObjectOverrides()
@@ -339,31 +339,31 @@ void LLSelectMgr::resetObjectOverrides(LLObjectSelectionHandle selected_handle)
void LLSelectMgr::overrideObjectUpdates()
{
- //override any position updates from simulator on objects being edited
- struct f : public LLSelectedNodeFunctor
- {
- virtual bool apply(LLSelectNode* selectNode)
- {
- LLViewerObject* object = selectNode->getObject();
- if (object && object->permMove() && !object->isPermanentEnforced())
- {
- if (!selectNode->mLastPositionLocal.isExactlyZero())
- {
- object->setPosition(selectNode->mLastPositionLocal);
- }
- if (selectNode->mLastRotation != LLQuaternion())
- {
- object->setRotation(selectNode->mLastRotation);
- }
- if (!selectNode->mLastScale.isExactlyZero())
- {
- object->setScale(selectNode->mLastScale);
- }
- }
- return true;
- }
- } func;
- getSelection()->applyToNodes(&func);
+ //override any position updates from simulator on objects being edited
+ struct f : public LLSelectedNodeFunctor
+ {
+ virtual bool apply(LLSelectNode* selectNode)
+ {
+ LLViewerObject* object = selectNode->getObject();
+ if (object && object->permMove() && !object->isPermanentEnforced())
+ {
+ if (!selectNode->mLastPositionLocal.isExactlyZero())
+ {
+ object->setPosition(selectNode->mLastPositionLocal);
+ }
+ if (selectNode->mLastRotation != LLQuaternion())
+ {
+ object->setRotation(selectNode->mLastRotation);
+ }
+ if (!selectNode->mLastScale.isExactlyZero())
+ {
+ object->setScale(selectNode->mLastScale);
+ }
+ }
+ return true;
+ }
+ } func;
+ getSelection()->applyToNodes(&func);
}
void LLSelectMgr::resetAvatarOverrides()
@@ -397,7 +397,7 @@ void LLSelectMgr::overrideAvatarUpdates()
}
// remove selected avatars from this list,
- // but set object overrides to make sure avatar won't snap back
+ // but set object overrides to make sure avatar won't snap back
struct f : public LLSelectedNodeFunctor
{
f(LLSelectMgr* p) : mManager(p) {}
@@ -458,62 +458,62 @@ void LLSelectMgr::overrideAvatarUpdates()
//-----------------------------------------------------------------------------
LLObjectSelectionHandle LLSelectMgr::selectObjectOnly(LLViewerObject* object, S32 face)
{
- llassert( object );
-
- //remember primary object
- mSelectedObjects->mPrimaryObject = object;
-
- // Don't add an object that is already in the list
- if (object->isSelected() ) {
- // make sure point at position is updated
- updatePointAt();
- gEditMenuHandler = this;
- return NULL;
- }
-
- if (!canSelectObject(object))
- {
- //make_ui_sound("UISndInvalidOp");
- return NULL;
- }
-
- // LL_INFOS() << "Adding object to selected object list" << LL_ENDL;
-
- // Place it in the list and tag it.
- // This will refresh dialogs.
- addAsIndividual(object, face);
-
- // Stop the object from moving (this anticipates changes on the
- // simulator in LLTask::userSelect)
- // *FIX: shouldn't zero out these either
- object->setVelocity(LLVector3::zero);
- object->setAcceleration(LLVector3::zero);
- //object->setAngularVelocity(LLVector3::zero);
- object->resetRot();
-
- // Always send to simulator, so you get a copy of the
- // permissions structure back.
- gMessageSystem->newMessageFast(_PREHASH_ObjectSelect);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID() );
- LLViewerRegion* regionp = object->getRegion();
- gMessageSystem->sendReliable( regionp->getHost());
-
- updatePointAt();
- updateSelectionCenter();
- saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
-
- // have selection manager handle edit menu immediately after
- // user selects an object
- if (mSelectedObjects->getObjectCount())
- {
- gEditMenuHandler = this;
- }
-
- return mSelectedObjects;
+ llassert( object );
+
+ //remember primary object
+ mSelectedObjects->mPrimaryObject = object;
+
+ // Don't add an object that is already in the list
+ if (object->isSelected() ) {
+ // make sure point at position is updated
+ updatePointAt();
+ gEditMenuHandler = this;
+ return NULL;
+ }
+
+ if (!canSelectObject(object))
+ {
+ //make_ui_sound("UISndInvalidOp");
+ return NULL;
+ }
+
+ // LL_INFOS() << "Adding object to selected object list" << LL_ENDL;
+
+ // Place it in the list and tag it.
+ // This will refresh dialogs.
+ addAsIndividual(object, face);
+
+ // Stop the object from moving (this anticipates changes on the
+ // simulator in LLTask::userSelect)
+ // *FIX: shouldn't zero out these either
+ object->setVelocity(LLVector3::zero);
+ object->setAcceleration(LLVector3::zero);
+ //object->setAngularVelocity(LLVector3::zero);
+ object->resetRot();
+
+ // Always send to simulator, so you get a copy of the
+ // permissions structure back.
+ gMessageSystem->newMessageFast(_PREHASH_ObjectSelect);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID() );
+ LLViewerRegion* regionp = object->getRegion();
+ gMessageSystem->sendReliable( regionp->getHost());
+
+ updatePointAt();
+ updateSelectionCenter();
+ saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+
+ // have selection manager handle edit menu immediately after
+ // user selects an object
+ if (mSelectedObjects->getObjectCount())
+ {
+ gEditMenuHandler = this;
+ }
+
+ return mSelectedObjects;
}
//-----------------------------------------------------------------------------
@@ -521,149 +521,149 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectOnly(LLViewerObject* object, S3
//-----------------------------------------------------------------------------
LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end, BOOL ignore_select_owned)
{
- llassert( obj );
-
- //remember primary object
- mSelectedObjects->mPrimaryObject = obj;
-
- // This may be incorrect if things weren't family selected before... - djs 07/08/02
- // Don't add an object that is already in the list
- if (obj->isSelected() )
- {
- // make sure pointat position is updated
- updatePointAt();
- gEditMenuHandler = this;
- return NULL;
- }
-
- if (!canSelectObject(obj,ignore_select_owned))
- {
- //make_ui_sound("UISndInvalidOp");
- return NULL;
- }
-
- // Since we're selecting a family, start at the root, but
- // don't include an avatar.
- LLViewerObject* root = obj;
-
- while(!root->isAvatar() && root->getParent())
- {
- LLViewerObject* parent = (LLViewerObject*)root->getParent();
- if (parent->isAvatar())
- {
- break;
- }
- root = parent;
- }
-
- // Collect all of the objects
- std::vector<LLViewerObject*> objects;
-
- root->addThisAndNonJointChildren(objects);
- addAsFamily(objects, add_to_end);
-
- updateSelectionCenter();
- saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- updatePointAt();
-
- dialog_refresh_all();
-
- // Always send to simulator, so you get a copy of the permissions
- // structure back.
- sendSelect();
-
- // Stop the object from moving (this anticipates changes on the
- // simulator in LLTask::userSelect)
- root->setVelocity(LLVector3::zero);
- root->setAcceleration(LLVector3::zero);
- //root->setAngularVelocity(LLVector3::zero);
- root->resetRot();
-
- // leave component mode
- if (gSavedSettings.getBOOL("EditLinkedParts"))
- {
- gSavedSettings.setBOOL("EditLinkedParts", FALSE);
- promoteSelectionToRoot();
- }
-
- // have selection manager handle edit menu immediately after
- // user selects an object
- if (mSelectedObjects->getObjectCount())
- {
- gEditMenuHandler = this;
- }
-
- return mSelectedObjects;
+ llassert( obj );
+
+ //remember primary object
+ mSelectedObjects->mPrimaryObject = obj;
+
+ // This may be incorrect if things weren't family selected before... - djs 07/08/02
+ // Don't add an object that is already in the list
+ if (obj->isSelected() )
+ {
+ // make sure pointat position is updated
+ updatePointAt();
+ gEditMenuHandler = this;
+ return NULL;
+ }
+
+ if (!canSelectObject(obj,ignore_select_owned))
+ {
+ //make_ui_sound("UISndInvalidOp");
+ return NULL;
+ }
+
+ // Since we're selecting a family, start at the root, but
+ // don't include an avatar.
+ LLViewerObject* root = obj;
+
+ while(!root->isAvatar() && root->getParent())
+ {
+ LLViewerObject* parent = (LLViewerObject*)root->getParent();
+ if (parent->isAvatar())
+ {
+ break;
+ }
+ root = parent;
+ }
+
+ // Collect all of the objects
+ std::vector<LLViewerObject*> objects;
+
+ root->addThisAndNonJointChildren(objects);
+ addAsFamily(objects, add_to_end);
+
+ updateSelectionCenter();
+ saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ updatePointAt();
+
+ dialog_refresh_all();
+
+ // Always send to simulator, so you get a copy of the permissions
+ // structure back.
+ sendSelect();
+
+ // Stop the object from moving (this anticipates changes on the
+ // simulator in LLTask::userSelect)
+ root->setVelocity(LLVector3::zero);
+ root->setAcceleration(LLVector3::zero);
+ //root->setAngularVelocity(LLVector3::zero);
+ root->resetRot();
+
+ // leave component mode
+ if (gSavedSettings.getBOOL("EditLinkedParts"))
+ {
+ gSavedSettings.setBOOL("EditLinkedParts", FALSE);
+ promoteSelectionToRoot();
+ }
+
+ // have selection manager handle edit menu immediately after
+ // user selects an object
+ if (mSelectedObjects->getObjectCount())
+ {
+ gEditMenuHandler = this;
+ }
+
+ return mSelectedObjects;
}
//-----------------------------------------------------------------------------
// Select the object, parents and children.
//-----------------------------------------------------------------------------
LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const std::vector<LLViewerObject*>& object_list,
- BOOL send_to_sim)
-{
- // Collect all of the objects, children included
- std::vector<LLViewerObject*> objects;
-
- //clear primary object (no primary object)
- mSelectedObjects->mPrimaryObject = NULL;
-
- if (object_list.size() < 1)
- {
- return NULL;
- }
-
- // NOTE -- we add the objects in REVERSE ORDER
- // to preserve the order in the mSelectedObjects list
- for (std::vector<LLViewerObject*>::const_reverse_iterator riter = object_list.rbegin();
- riter != object_list.rend(); ++riter)
- {
- LLViewerObject *object = *riter;
-
- llassert( object );
-
- if (!canSelectObject(object)) continue;
-
- object->addThisAndNonJointChildren(objects);
- addAsFamily(objects);
-
- // Stop the object from moving (this anticipates changes on the
- // simulator in LLTask::userSelect)
- object->setVelocity(LLVector3::zero);
- object->setAcceleration(LLVector3::zero);
- //object->setAngularVelocity(LLVector3::zero);
- object->resetRot();
- }
-
- updateSelectionCenter();
- saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- updatePointAt();
- dialog_refresh_all();
-
- // Almost always send to simulator, so you get a copy of the permissions
- // structure back.
- // JC: The one case where you don't want to do this is if you're selecting
- // all the objects on a sim.
- if (send_to_sim)
- {
- sendSelect();
- }
-
- // leave component mode
- if (gSavedSettings.getBOOL("EditLinkedParts"))
- {
- gSavedSettings.setBOOL("EditLinkedParts", FALSE);
- promoteSelectionToRoot();
- }
-
- // have selection manager handle edit menu immediately after
- // user selects an object
- if (mSelectedObjects->getObjectCount())
- {
- gEditMenuHandler = this;
- }
-
- return mSelectedObjects;
+ BOOL send_to_sim)
+{
+ // Collect all of the objects, children included
+ std::vector<LLViewerObject*> objects;
+
+ //clear primary object (no primary object)
+ mSelectedObjects->mPrimaryObject = NULL;
+
+ if (object_list.size() < 1)
+ {
+ return NULL;
+ }
+
+ // NOTE -- we add the objects in REVERSE ORDER
+ // to preserve the order in the mSelectedObjects list
+ for (std::vector<LLViewerObject*>::const_reverse_iterator riter = object_list.rbegin();
+ riter != object_list.rend(); ++riter)
+ {
+ LLViewerObject *object = *riter;
+
+ llassert( object );
+
+ if (!canSelectObject(object)) continue;
+
+ object->addThisAndNonJointChildren(objects);
+ addAsFamily(objects);
+
+ // Stop the object from moving (this anticipates changes on the
+ // simulator in LLTask::userSelect)
+ object->setVelocity(LLVector3::zero);
+ object->setAcceleration(LLVector3::zero);
+ //object->setAngularVelocity(LLVector3::zero);
+ object->resetRot();
+ }
+
+ updateSelectionCenter();
+ saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ updatePointAt();
+ dialog_refresh_all();
+
+ // Almost always send to simulator, so you get a copy of the permissions
+ // structure back.
+ // JC: The one case where you don't want to do this is if you're selecting
+ // all the objects on a sim.
+ if (send_to_sim)
+ {
+ sendSelect();
+ }
+
+ // leave component mode
+ if (gSavedSettings.getBOOL("EditLinkedParts"))
+ {
+ gSavedSettings.setBOOL("EditLinkedParts", FALSE);
+ promoteSelectionToRoot();
+ }
+
+ // have selection manager handle edit menu immediately after
+ // user selects an object
+ if (mSelectedObjects->getObjectCount())
+ {
+ gEditMenuHandler = this;
+ }
+
+ return mSelectedObjects;
}
// Use for when the simulator kills an object. This version also
@@ -672,138 +672,138 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const std::vector<LLV
// Caller needs to call dialog_refresh_all if necessary.
BOOL LLSelectMgr::removeObjectFromSelections(const LLUUID &id)
{
- BOOL object_found = FALSE;
- LLTool *tool = NULL;
-
- tool = LLToolMgr::getInstance()->getCurrentTool();
-
- // It's possible that the tool is editing an object that is not selected
- LLViewerObject* tool_editing_object = tool->getEditingObject();
- if( tool_editing_object && tool_editing_object->mID == id)
- {
- tool->stopEditing();
- object_found = TRUE;
- }
-
- // Iterate through selected objects list and kill the object
- if( !object_found )
- {
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); )
- {
- LLObjectSelection::iterator curiter = iter++;
- LLViewerObject* object = (*curiter)->getObject();
- if (object->mID == id)
- {
- if (tool)
- {
- tool->stopEditing();
- }
-
- // lose the selection, don't tell simulator, it knows
- deselectObjectAndFamily(object, FALSE);
- object_found = TRUE;
- break; // must break here, may have removed multiple objects from list
- }
- else if (object->isAvatar() && object->getParent() && ((LLViewerObject*)object->getParent())->mID == id)
- {
- // It's possible the item being removed has an avatar sitting on it
- // So remove the avatar that is sitting on the object.
- deselectObjectAndFamily(object, FALSE);
- break; // must break here, may have removed multiple objects from list
- }
- }
- }
-
- return object_found;
+ BOOL object_found = FALSE;
+ LLTool *tool = NULL;
+
+ tool = LLToolMgr::getInstance()->getCurrentTool();
+
+ // It's possible that the tool is editing an object that is not selected
+ LLViewerObject* tool_editing_object = tool->getEditingObject();
+ if( tool_editing_object && tool_editing_object->mID == id)
+ {
+ tool->stopEditing();
+ object_found = TRUE;
+ }
+
+ // Iterate through selected objects list and kill the object
+ if( !object_found )
+ {
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); )
+ {
+ LLObjectSelection::iterator curiter = iter++;
+ LLViewerObject* object = (*curiter)->getObject();
+ if (object->mID == id)
+ {
+ if (tool)
+ {
+ tool->stopEditing();
+ }
+
+ // lose the selection, don't tell simulator, it knows
+ deselectObjectAndFamily(object, FALSE);
+ object_found = TRUE;
+ break; // must break here, may have removed multiple objects from list
+ }
+ else if (object->isAvatar() && object->getParent() && ((LLViewerObject*)object->getParent())->mID == id)
+ {
+ // It's possible the item being removed has an avatar sitting on it
+ // So remove the avatar that is sitting on the object.
+ deselectObjectAndFamily(object, FALSE);
+ break; // must break here, may have removed multiple objects from list
+ }
+ }
+ }
+
+ return object_found;
}
bool LLSelectMgr::linkObjects()
{
- if (!LLSelectMgr::getInstance()->selectGetAllRootsValid())
- {
- LLNotificationsUtil::add("UnableToLinkWhileDownloading");
- return true;
- }
-
- S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
- if (object_count > MAX_CHILDREN_PER_TASK + 1)
- {
- LLSD args;
- args["COUNT"] = llformat("%d", object_count);
- int max = MAX_CHILDREN_PER_TASK+1;
- args["MAX"] = llformat("%d", max);
- LLNotificationsUtil::add("UnableToLinkObjects", args);
- return true;
- }
-
- if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() < 2)
- {
- LLNotificationsUtil::add("CannotLinkIncompleteSet");
- return true;
- }
-
- if (!LLSelectMgr::getInstance()->selectGetRootsModify())
- {
- LLNotificationsUtil::add("CannotLinkModify");
- return true;
- }
-
- if (!LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced())
- {
- LLNotificationsUtil::add("CannotLinkPermanent");
- return true;
- }
-
- LLUUID owner_id;
- std::string owner_name;
- if (!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name))
- {
- // we don't actually care if you're the owner, but novices are
- // the most likely to be stumped by this one, so offer the
- // easiest and most likely solution.
- LLNotificationsUtil::add("CannotLinkDifferentOwners");
- return true;
- }
-
- if (!LLSelectMgr::getInstance()->selectGetSameRegion())
- {
- LLNotificationsUtil::add("CannotLinkAcrossRegions");
- return true;
- }
-
- LLSelectMgr::getInstance()->sendLink();
-
- return true;
+ if (!LLSelectMgr::getInstance()->selectGetAllRootsValid())
+ {
+ LLNotificationsUtil::add("UnableToLinkWhileDownloading");
+ return true;
+ }
+
+ S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
+ if (object_count > MAX_CHILDREN_PER_TASK + 1)
+ {
+ LLSD args;
+ args["COUNT"] = llformat("%d", object_count);
+ int max = MAX_CHILDREN_PER_TASK+1;
+ args["MAX"] = llformat("%d", max);
+ LLNotificationsUtil::add("UnableToLinkObjects", args);
+ return true;
+ }
+
+ if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() < 2)
+ {
+ LLNotificationsUtil::add("CannotLinkIncompleteSet");
+ return true;
+ }
+
+ if (!LLSelectMgr::getInstance()->selectGetRootsModify())
+ {
+ LLNotificationsUtil::add("CannotLinkModify");
+ return true;
+ }
+
+ if (!LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced())
+ {
+ LLNotificationsUtil::add("CannotLinkPermanent");
+ return true;
+ }
+
+ LLUUID owner_id;
+ std::string owner_name;
+ if (!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name))
+ {
+ // we don't actually care if you're the owner, but novices are
+ // the most likely to be stumped by this one, so offer the
+ // easiest and most likely solution.
+ LLNotificationsUtil::add("CannotLinkDifferentOwners");
+ return true;
+ }
+
+ if (!LLSelectMgr::getInstance()->selectGetSameRegion())
+ {
+ LLNotificationsUtil::add("CannotLinkAcrossRegions");
+ return true;
+ }
+
+ LLSelectMgr::getInstance()->sendLink();
+
+ return true;
}
bool LLSelectMgr::unlinkObjects()
{
- S32 min_objects_for_confirm = gSavedSettings.getS32("MinObjectsForUnlinkConfirm");
- S32 unlink_object_count = mSelectedObjects->getObjectCount(); // clears out nodes with NULL objects
- if (unlink_object_count >= min_objects_for_confirm
- && unlink_object_count > mSelectedObjects->getRootObjectCount())
- {
- // total count > root count means that there are childer inside and that there are linksets that will be unlinked
- LLNotificationsUtil::add("ConfirmUnlink", LLSD(), LLSD(), boost::bind(&LLSelectMgr::confirmUnlinkObjects, this, _1, _2));
- return true;
- }
+ S32 min_objects_for_confirm = gSavedSettings.getS32("MinObjectsForUnlinkConfirm");
+ S32 unlink_object_count = mSelectedObjects->getObjectCount(); // clears out nodes with NULL objects
+ if (unlink_object_count >= min_objects_for_confirm
+ && unlink_object_count > mSelectedObjects->getRootObjectCount())
+ {
+ // total count > root count means that there are childer inside and that there are linksets that will be unlinked
+ LLNotificationsUtil::add("ConfirmUnlink", LLSD(), LLSD(), boost::bind(&LLSelectMgr::confirmUnlinkObjects, this, _1, _2));
+ return true;
+ }
- LLSelectMgr::getInstance()->sendDelink();
- return true;
+ LLSelectMgr::getInstance()->sendDelink();
+ return true;
}
void LLSelectMgr::confirmUnlinkObjects(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- // if Cancel pressed
- if (option == 1)
- {
- return;
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ // if Cancel pressed
+ if (option == 1)
+ {
+ return;
+ }
- LLSelectMgr::getInstance()->sendDelink();
- return;
+ LLSelectMgr::getInstance()->sendDelink();
+ return;
}
// in order to link, all objects must have the same owner, and the
@@ -820,158 +820,158 @@ void LLSelectMgr::confirmUnlinkObjects(const LLSD& notification, const LLSD& res
// triangle count cannot exceed the designated limit.
bool LLSelectMgr::enableLinkObjects()
{
- bool new_value = false;
- // check if there are at least 2 objects selected, and that the
- // user can modify at least one of the selected objects.
-
- // in component mode, can't link
- if (!gSavedSettings.getBOOL("EditLinkedParts"))
- {
- if(LLSelectMgr::getInstance()->selectGetAllRootsValid() && LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() >= 2)
- {
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- LLViewerObject *root_object = (object == NULL) ? NULL : object->getRootEdit();
- return object->permModify() && !object->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced());
- }
- } func;
- const bool firstonly = true;
- new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly);
- }
- }
+ bool new_value = false;
+ // check if there are at least 2 objects selected, and that the
+ // user can modify at least one of the selected objects.
+
+ // in component mode, can't link
+ if (!gSavedSettings.getBOOL("EditLinkedParts"))
+ {
+ if(LLSelectMgr::getInstance()->selectGetAllRootsValid() && LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() >= 2)
+ {
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ LLViewerObject *root_object = (object == NULL) ? NULL : object->getRootEdit();
+ return object->permModify() && !object->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced());
+ }
+ } func;
+ const bool firstonly = true;
+ new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly);
+ }
+ }
if (!LLSelectMgr::getInstance()->getSelection()->checkAnimatedObjectLinkable())
{
new_value = false;
}
- return new_value;
+ return new_value;
}
bool LLSelectMgr::enableUnlinkObjects()
{
- LLViewerObject* first_editable_object = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject();
- LLViewerObject *root_object = (first_editable_object == NULL) ? NULL : first_editable_object->getRootEdit();
+ LLViewerObject* first_editable_object = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject();
+ LLViewerObject *root_object = (first_editable_object == NULL) ? NULL : first_editable_object->getRootEdit();
- bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() &&
- first_editable_object &&
- !first_editable_object->isAttachment() && !first_editable_object->isPermanentEnforced() &&
- ((root_object == NULL) || !root_object->isPermanentEnforced());
+ bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() &&
+ first_editable_object &&
+ !first_editable_object->isAttachment() && !first_editable_object->isPermanentEnforced() &&
+ ((root_object == NULL) || !root_object->isPermanentEnforced());
- return new_value;
+ return new_value;
}
void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim, BOOL include_entire_object)
{
- // bail if nothing selected or if object wasn't selected in the first place
- if(!object) return;
- if(!object->isSelected()) return;
-
- // Collect all of the objects, and remove them
- std::vector<LLViewerObject*> objects;
-
- if (include_entire_object)
- {
- // Since we're selecting a family, start at the root, but
- // don't include an avatar.
- LLViewerObject* root = object;
-
- while(!root->isAvatar() && root->getParent())
- {
- LLViewerObject* parent = (LLViewerObject*)root->getParent();
- if (parent->isAvatar())
- {
- break;
- }
- root = parent;
- }
-
- object = root;
- }
- else
- {
- object = (LLViewerObject*)object->getRoot();
- }
-
- object->addThisAndAllChildren(objects);
- remove(objects);
-
- if (!send_to_sim) return;
-
- //-----------------------------------------------------------
- // Inform simulator of deselection
- //-----------------------------------------------------------
- LLViewerRegion* regionp = object->getRegion();
-
- BOOL start_new_message = TRUE;
- S32 select_count = 0;
-
- LLMessageSystem* msg = gMessageSystem;
- for (U32 i = 0; i < objects.size(); i++)
- {
- if (start_new_message)
- {
- msg->newMessageFast(_PREHASH_ObjectDeselect);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- select_count++;
- start_new_message = FALSE;
- }
-
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU32Fast(_PREHASH_ObjectLocalID, (objects[i])->getLocalID());
- select_count++;
-
- // Zap the angular velocity, as the sim will set it to zero
- objects[i]->setAngularVelocity( 0,0,0 );
- objects[i]->setVelocity( 0,0,0 );
-
- if(msg->isSendFull(NULL) || select_count >= MAX_OBJECTS_PER_PACKET)
- {
- msg->sendReliable(regionp->getHost() );
- select_count = 0;
- start_new_message = TRUE;
- }
- }
-
- if (!start_new_message)
- {
- msg->sendReliable(regionp->getHost() );
- }
-
- updatePointAt();
- updateSelectionCenter();
+ // bail if nothing selected or if object wasn't selected in the first place
+ if(!object) return;
+ if(!object->isSelected()) return;
+
+ // Collect all of the objects, and remove them
+ std::vector<LLViewerObject*> objects;
+
+ if (include_entire_object)
+ {
+ // Since we're selecting a family, start at the root, but
+ // don't include an avatar.
+ LLViewerObject* root = object;
+
+ while(!root->isAvatar() && root->getParent())
+ {
+ LLViewerObject* parent = (LLViewerObject*)root->getParent();
+ if (parent->isAvatar())
+ {
+ break;
+ }
+ root = parent;
+ }
+
+ object = root;
+ }
+ else
+ {
+ object = (LLViewerObject*)object->getRoot();
+ }
+
+ object->addThisAndAllChildren(objects);
+ remove(objects);
+
+ if (!send_to_sim) return;
+
+ //-----------------------------------------------------------
+ // Inform simulator of deselection
+ //-----------------------------------------------------------
+ LLViewerRegion* regionp = object->getRegion();
+
+ BOOL start_new_message = TRUE;
+ S32 select_count = 0;
+
+ LLMessageSystem* msg = gMessageSystem;
+ for (U32 i = 0; i < objects.size(); i++)
+ {
+ if (start_new_message)
+ {
+ msg->newMessageFast(_PREHASH_ObjectDeselect);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ select_count++;
+ start_new_message = FALSE;
+ }
+
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addU32Fast(_PREHASH_ObjectLocalID, (objects[i])->getLocalID());
+ select_count++;
+
+ // Zap the angular velocity, as the sim will set it to zero
+ objects[i]->setAngularVelocity( 0,0,0 );
+ objects[i]->setVelocity( 0,0,0 );
+
+ if(msg->isSendFull(NULL) || select_count >= MAX_OBJECTS_PER_PACKET)
+ {
+ msg->sendReliable(regionp->getHost() );
+ select_count = 0;
+ start_new_message = TRUE;
+ }
+ }
+
+ if (!start_new_message)
+ {
+ msg->sendReliable(regionp->getHost() );
+ }
+
+ updatePointAt();
+ updateSelectionCenter();
}
void LLSelectMgr::deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim)
{
- // bail if nothing selected or if object wasn't selected in the first place
- if (!object) return;
- if (!object->isSelected() ) return;
+ // bail if nothing selected or if object wasn't selected in the first place
+ if (!object) return;
+ if (!object->isSelected() ) return;
- // Zap the angular velocity, as the sim will set it to zero
- object->setAngularVelocity( 0,0,0 );
- object->setVelocity( 0,0,0 );
+ // Zap the angular velocity, as the sim will set it to zero
+ object->setAngularVelocity( 0,0,0 );
+ object->setVelocity( 0,0,0 );
- if (send_to_sim)
- {
- LLViewerRegion* region = object->getRegion();
- gMessageSystem->newMessageFast(_PREHASH_ObjectDeselect);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID() );
- gMessageSystem->sendReliable(region->getHost());
- }
+ if (send_to_sim)
+ {
+ LLViewerRegion* region = object->getRegion();
+ gMessageSystem->newMessageFast(_PREHASH_ObjectDeselect);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID() );
+ gMessageSystem->sendReliable(region->getHost());
+ }
- // This will refresh dialogs.
- remove( object );
+ // This will refresh dialogs.
+ remove( object );
- updatePointAt();
- updateSelectionCenter();
+ updatePointAt();
+ updateSelectionCenter();
}
@@ -981,53 +981,53 @@ void LLSelectMgr::deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim)
void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to_end)
{
- for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
- iter != objects.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
-
- // Can't select yourself
- if (objectp->mID == gAgentID
- && !mAllowSelectAvatar)
- {
- continue;
- }
-
- if (!objectp->isSelected())
- {
- LLSelectNode *nodep = new LLSelectNode(objectp, TRUE);
- if (add_to_end)
- {
- mSelectedObjects->addNodeAtEnd(nodep);
- }
- else
- {
- mSelectedObjects->addNode(nodep);
- }
- objectp->setSelected(TRUE);
-
- if (objectp->getNumTEs() > 0)
- {
- nodep->selectAllTEs(TRUE);
- objectp->setAllTESelected(true);
- }
- else
- {
- // object has no faces, so don't mess with faces
- }
- }
- else
- {
- // we want this object to be selected for real
- // so clear transient flag
- LLSelectNode* select_node = mSelectedObjects->findNode(objectp);
- if (select_node)
- {
- select_node->setTransient(FALSE);
- }
- }
- }
- saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
+ iter != objects.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+
+ // Can't select yourself
+ if (objectp->mID == gAgentID
+ && !mAllowSelectAvatar)
+ {
+ continue;
+ }
+
+ if (!objectp->isSelected())
+ {
+ LLSelectNode *nodep = new LLSelectNode(objectp, TRUE);
+ if (add_to_end)
+ {
+ mSelectedObjects->addNodeAtEnd(nodep);
+ }
+ else
+ {
+ mSelectedObjects->addNode(nodep);
+ }
+ objectp->setSelected(TRUE);
+
+ if (objectp->getNumTEs() > 0)
+ {
+ nodep->selectAllTEs(TRUE);
+ objectp->setAllTESelected(true);
+ }
+ else
+ {
+ // object has no faces, so don't mess with faces
+ }
+ }
+ else
+ {
+ // we want this object to be selected for real
+ // so clear transient flag
+ LLSelectNode* select_node = mSelectedObjects->findNode(objectp);
+ if (select_node)
+ {
+ select_node->setTransient(FALSE);
+ }
+ }
+ }
+ saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
}
//-----------------------------------------------------------------------------
@@ -1035,447 +1035,447 @@ void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to
//-----------------------------------------------------------------------------
void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoable)
{
- // check to see if object is already in list
- LLSelectNode *nodep = mSelectedObjects->findNode(objectp);
-
- // if not in list, add it
- if (!nodep)
- {
- nodep = new LLSelectNode(objectp, TRUE);
- mSelectedObjects->addNode(nodep);
- llassert_always(nodep->getObject());
- }
- else
- {
- // make this a full-fledged selection
- nodep->setTransient(FALSE);
- // Move it to the front of the list
- mSelectedObjects->moveNodeToFront(nodep);
- }
-
- // Make sure the object is tagged as selected
- objectp->setSelected( TRUE );
-
- // And make sure we don't consider it as part of a family
- nodep->mIndividualSelection = TRUE;
-
- // Handle face selection
- if (objectp->getNumTEs() <= 0)
- {
- // object has no faces, so don't do anything
- }
- else if (face == SELECT_ALL_TES)
- {
- nodep->selectAllTEs(TRUE);
- objectp->setAllTESelected(true);
- }
- else if (0 <= face && face < SELECT_MAX_TES)
- {
- nodep->selectTE(face, TRUE);
- objectp->setTESelected(face, true);
- }
- else
- {
- LL_ERRS() << "LLSelectMgr::add face " << face << " out-of-range" << LL_ENDL;
- return;
- }
-
- saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- updateSelectionCenter();
- dialog_refresh_all();
+ // check to see if object is already in list
+ LLSelectNode *nodep = mSelectedObjects->findNode(objectp);
+
+ // if not in list, add it
+ if (!nodep)
+ {
+ nodep = new LLSelectNode(objectp, TRUE);
+ mSelectedObjects->addNode(nodep);
+ llassert_always(nodep->getObject());
+ }
+ else
+ {
+ // make this a full-fledged selection
+ nodep->setTransient(FALSE);
+ // Move it to the front of the list
+ mSelectedObjects->moveNodeToFront(nodep);
+ }
+
+ // Make sure the object is tagged as selected
+ objectp->setSelected( TRUE );
+
+ // And make sure we don't consider it as part of a family
+ nodep->mIndividualSelection = TRUE;
+
+ // Handle face selection
+ if (objectp->getNumTEs() <= 0)
+ {
+ // object has no faces, so don't do anything
+ }
+ else if (face == SELECT_ALL_TES)
+ {
+ nodep->selectAllTEs(TRUE);
+ objectp->setAllTESelected(true);
+ }
+ else if (0 <= face && face < SELECT_MAX_TES)
+ {
+ nodep->selectTE(face, TRUE);
+ objectp->setTESelected(face, true);
+ }
+ else
+ {
+ LL_ERRS() << "LLSelectMgr::add face " << face << " out-of-range" << LL_ENDL;
+ return;
+ }
+
+ saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ updateSelectionCenter();
+ dialog_refresh_all();
}
LLObjectSelectionHandle LLSelectMgr::setHoverObject(LLViewerObject *objectp, S32 face)
{
- if (!objectp)
- {
- mHoverObjects->deleteAllNodes();
- return NULL;
- }
-
- // Can't select yourself
- if (objectp->mID == gAgentID)
- {
- mHoverObjects->deleteAllNodes();
- return NULL;
- }
-
- // Can't select land
- if (objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH)
- {
- mHoverObjects->deleteAllNodes();
- return NULL;
- }
-
- mHoverObjects->mPrimaryObject = objectp;
-
- objectp = objectp->getRootEdit();
-
- // is the requested object the same as the existing hover object root?
- // NOTE: there is only ever one linked set in mHoverObjects
- if (mHoverObjects->getFirstRootObject() != objectp)
- {
-
- // Collect all of the objects
- std::vector<LLViewerObject*> objects;
- objectp = objectp->getRootEdit();
- objectp->addThisAndNonJointChildren(objects);
-
- mHoverObjects->deleteAllNodes();
- for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
- iter != objects.end(); ++iter)
- {
- LLViewerObject* cur_objectp = *iter;
- if(!cur_objectp || cur_objectp->isDead())
- {
- continue;
- }
- LLSelectNode* nodep = new LLSelectNode(cur_objectp, FALSE);
- nodep->selectTE(face, TRUE);
- mHoverObjects->addNodeAtEnd(nodep);
- }
-
- requestObjectPropertiesFamily(objectp);
- }
-
- return mHoverObjects;
+ if (!objectp)
+ {
+ mHoverObjects->deleteAllNodes();
+ return NULL;
+ }
+
+ // Can't select yourself
+ if (objectp->mID == gAgentID)
+ {
+ mHoverObjects->deleteAllNodes();
+ return NULL;
+ }
+
+ // Can't select land
+ if (objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH)
+ {
+ mHoverObjects->deleteAllNodes();
+ return NULL;
+ }
+
+ mHoverObjects->mPrimaryObject = objectp;
+
+ objectp = objectp->getRootEdit();
+
+ // is the requested object the same as the existing hover object root?
+ // NOTE: there is only ever one linked set in mHoverObjects
+ if (mHoverObjects->getFirstRootObject() != objectp)
+ {
+
+ // Collect all of the objects
+ std::vector<LLViewerObject*> objects;
+ objectp = objectp->getRootEdit();
+ objectp->addThisAndNonJointChildren(objects);
+
+ mHoverObjects->deleteAllNodes();
+ for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
+ iter != objects.end(); ++iter)
+ {
+ LLViewerObject* cur_objectp = *iter;
+ if(!cur_objectp || cur_objectp->isDead())
+ {
+ continue;
+ }
+ LLSelectNode* nodep = new LLSelectNode(cur_objectp, FALSE);
+ nodep->selectTE(face, TRUE);
+ mHoverObjects->addNodeAtEnd(nodep);
+ }
+
+ requestObjectPropertiesFamily(objectp);
+ }
+
+ return mHoverObjects;
}
LLSelectNode *LLSelectMgr::getHoverNode()
{
- return mHoverObjects->getFirstRootNode();
+ return mHoverObjects->getFirstRootNode();
}
LLSelectNode *LLSelectMgr::getPrimaryHoverNode()
{
- return mHoverObjects->mSelectNodeMap[mHoverObjects->mPrimaryObject];
+ return mHoverObjects->mSelectNodeMap[mHoverObjects->mPrimaryObject];
}
void LLSelectMgr::highlightObjectOnly(LLViewerObject* objectp)
{
- if (!objectp)
- {
- return;
- }
+ if (!objectp)
+ {
+ return;
+ }
+
+ if (objectp->getPCode() != LL_PCODE_VOLUME)
+ {
+ return;
+ }
- if (objectp->getPCode() != LL_PCODE_VOLUME)
- {
- return;
- }
-
if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !objectp->permYouOwner())
|| (gSavedSettings.getBOOL("SelectMovableOnly") && (!objectp->permMove() || objectp->isPermanentEnforced())))
- {
- // only select my own objects
- return;
- }
+ {
+ // only select my own objects
+ return;
+ }
- mRectSelectedObjects.insert(objectp);
+ mRectSelectedObjects.insert(objectp);
}
void LLSelectMgr::highlightObjectAndFamily(LLViewerObject* objectp)
{
- if (!objectp)
- {
- return;
- }
+ if (!objectp)
+ {
+ return;
+ }
- LLViewerObject* root_obj = (LLViewerObject*)objectp->getRoot();
+ LLViewerObject* root_obj = (LLViewerObject*)objectp->getRoot();
- highlightObjectOnly(root_obj);
+ highlightObjectOnly(root_obj);
- LLViewerObject::const_child_list_t& child_list = root_obj->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- highlightObjectOnly(child);
- }
+ LLViewerObject::const_child_list_t& child_list = root_obj->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ highlightObjectOnly(child);
+ }
}
// Note that this ignores the "select owned only" flag
// It's also more efficient than calling the single-object version over and over.
void LLSelectMgr::highlightObjectAndFamily(const std::vector<LLViewerObject*>& objects)
{
- for (std::vector<LLViewerObject*>::const_iterator iter1 = objects.begin();
- iter1 != objects.end(); ++iter1)
- {
- LLViewerObject* object = *iter1;
-
- if (!object)
- {
- continue;
- }
- if (object->getPCode() != LL_PCODE_VOLUME)
- {
- continue;
- }
-
- LLViewerObject* root = (LLViewerObject*)object->getRoot();
- mRectSelectedObjects.insert(root);
-
- LLViewerObject::const_child_list_t& child_list = root->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter2 = child_list.begin();
- iter2 != child_list.end(); iter2++)
- {
- LLViewerObject* child = *iter2;
- mRectSelectedObjects.insert(child);
- }
- }
+ for (std::vector<LLViewerObject*>::const_iterator iter1 = objects.begin();
+ iter1 != objects.end(); ++iter1)
+ {
+ LLViewerObject* object = *iter1;
+
+ if (!object)
+ {
+ continue;
+ }
+ if (object->getPCode() != LL_PCODE_VOLUME)
+ {
+ continue;
+ }
+
+ LLViewerObject* root = (LLViewerObject*)object->getRoot();
+ mRectSelectedObjects.insert(root);
+
+ LLViewerObject::const_child_list_t& child_list = root->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter2 = child_list.begin();
+ iter2 != child_list.end(); iter2++)
+ {
+ LLViewerObject* child = *iter2;
+ mRectSelectedObjects.insert(child);
+ }
+ }
}
void LLSelectMgr::unhighlightObjectOnly(LLViewerObject* objectp)
{
- if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
- {
- return;
- }
+ if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
+ }
- mRectSelectedObjects.erase(objectp);
+ mRectSelectedObjects.erase(objectp);
}
void LLSelectMgr::unhighlightObjectAndFamily(LLViewerObject* objectp)
{
- if (!objectp)
- {
- return;
- }
+ if (!objectp)
+ {
+ return;
+ }
- LLViewerObject* root_obj = (LLViewerObject*)objectp->getRoot();
+ LLViewerObject* root_obj = (LLViewerObject*)objectp->getRoot();
- unhighlightObjectOnly(root_obj);
+ unhighlightObjectOnly(root_obj);
- LLViewerObject::const_child_list_t& child_list = root_obj->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- unhighlightObjectOnly(child);
- }
+ LLViewerObject::const_child_list_t& child_list = root_obj->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ unhighlightObjectOnly(child);
+ }
}
void LLSelectMgr::unhighlightAll()
{
- mRectSelectedObjects.clear();
- mHighlightedObjects->deleteAllNodes();
+ mRectSelectedObjects.clear();
+ mHighlightedObjects->deleteAllNodes();
}
LLObjectSelectionHandle LLSelectMgr::selectHighlightedObjects()
{
- if (!mHighlightedObjects->getNumNodes())
- {
- return NULL;
- }
+ if (!mHighlightedObjects->getNumNodes())
+ {
+ return NULL;
+ }
- //clear primary object
- mSelectedObjects->mPrimaryObject = NULL;
+ //clear primary object
+ mSelectedObjects->mPrimaryObject = NULL;
- for (LLObjectSelection::iterator iter = getHighlightedObjects()->begin();
- iter != getHighlightedObjects()->end(); )
- {
- LLObjectSelection::iterator curiter = iter++;
-
- LLSelectNode *nodep = *curiter;
- LLViewerObject* objectp = nodep->getObject();
+ for (LLObjectSelection::iterator iter = getHighlightedObjects()->begin();
+ iter != getHighlightedObjects()->end(); )
+ {
+ LLObjectSelection::iterator curiter = iter++;
- if (!canSelectObject(objectp))
- {
- continue;
- }
+ LLSelectNode *nodep = *curiter;
+ LLViewerObject* objectp = nodep->getObject();
- // already selected
- if (objectp->isSelected())
- {
- continue;
- }
+ if (!canSelectObject(objectp))
+ {
+ continue;
+ }
- LLSelectNode* new_nodep = new LLSelectNode(*nodep);
- mSelectedObjects->addNode(new_nodep);
+ // already selected
+ if (objectp->isSelected())
+ {
+ continue;
+ }
+
+ LLSelectNode* new_nodep = new LLSelectNode(*nodep);
+ mSelectedObjects->addNode(new_nodep);
- // flag this object as selected
- objectp->setSelected(TRUE);
- objectp->setAllTESelected(true);
+ // flag this object as selected
+ objectp->setSelected(TRUE);
+ objectp->setAllTESelected(true);
- mSelectedObjects->mSelectType = getSelectTypeForObject(objectp);
+ mSelectedObjects->mSelectType = getSelectTypeForObject(objectp);
- // request properties on root objects
- if (objectp->isRootEdit())
- {
- requestObjectPropertiesFamily(objectp);
- }
- }
+ // request properties on root objects
+ if (objectp->isRootEdit())
+ {
+ requestObjectPropertiesFamily(objectp);
+ }
+ }
- // pack up messages to let sim know these objects are selected
- sendSelect();
- unhighlightAll();
- updateSelectionCenter();
- saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- updatePointAt();
+ // pack up messages to let sim know these objects are selected
+ sendSelect();
+ unhighlightAll();
+ updateSelectionCenter();
+ saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ updatePointAt();
- if (mSelectedObjects->getObjectCount())
- {
- gEditMenuHandler = this;
- }
+ if (mSelectedObjects->getObjectCount())
+ {
+ gEditMenuHandler = this;
+ }
- return mSelectedObjects;
+ return mSelectedObjects;
}
void LLSelectMgr::deselectHighlightedObjects()
{
- BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
- for (std::set<LLPointer<LLViewerObject> >::iterator iter = mRectSelectedObjects.begin();
- iter != mRectSelectedObjects.end(); iter++)
- {
- LLViewerObject *objectp = *iter;
- if (!select_linked_set)
- {
- deselectObjectOnly(objectp);
- }
- else
- {
- LLViewerObject* root_object = (LLViewerObject*)objectp->getRoot();
- if (root_object->isSelected())
- {
- deselectObjectAndFamily(root_object);
- }
- }
- }
-
- unhighlightAll();
+ BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
+ for (std::set<LLPointer<LLViewerObject> >::iterator iter = mRectSelectedObjects.begin();
+ iter != mRectSelectedObjects.end(); iter++)
+ {
+ LLViewerObject *objectp = *iter;
+ if (!select_linked_set)
+ {
+ deselectObjectOnly(objectp);
+ }
+ else
+ {
+ LLViewerObject* root_object = (LLViewerObject*)objectp->getRoot();
+ if (root_object->isSelected())
+ {
+ deselectObjectAndFamily(root_object);
+ }
+ }
+ }
+
+ unhighlightAll();
}
void LLSelectMgr::addGridObject(LLViewerObject* objectp)
{
- LLSelectNode* nodep = new LLSelectNode(objectp, FALSE);
- mGridObjects.addNodeAtEnd(nodep);
+ LLSelectNode* nodep = new LLSelectNode(objectp, FALSE);
+ mGridObjects.addNodeAtEnd(nodep);
- LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- nodep = new LLSelectNode(child, FALSE);
- mGridObjects.addNodeAtEnd(nodep);
- }
+ LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ nodep = new LLSelectNode(child, FALSE);
+ mGridObjects.addNodeAtEnd(nodep);
+ }
}
void LLSelectMgr::clearGridObjects()
{
- mGridObjects.deleteAllNodes();
+ mGridObjects.deleteAllNodes();
}
void LLSelectMgr::setGridMode(EGridMode mode)
{
- mGridMode = mode;
- gSavedSettings.setS32("GridMode", mode);
- updateSelectionCenter();
+ mGridMode = mode;
+ gSavedSettings.setS32("GridMode", mode);
+ updateSelectionCenter();
}
void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &scale, bool for_snap_guides)
{
- mGridObjects.cleanupNodes();
-
- LLViewerObject* first_grid_object = mGridObjects.getFirstObject();
-
- if (mGridMode == GRID_MODE_LOCAL && mSelectedObjects->getObjectCount())
- {
- //LLViewerObject* root = getSelectedParentObject(mSelectedObjects->getFirstObject());
- mGridOrigin = mSavedSelectionBBox.getCenterAgent();
- mGridScale = mSavedSelectionBBox.getExtentLocal() * 0.5f;
-
- // DEV-12570 Just taking the saved selection box rotation prevents
- // wild rotations of linked sets while in local grid mode
- //if(mSelectedObjects->getObjectCount() < 2 || !root || root->mDrawable.isNull())
- {
- mGridRotation = mSavedSelectionBBox.getRotation();
- }
- /*else //set to the root object
- {
- mGridRotation = root->getRenderRotation();
- }*/
- }
- else if (mGridMode == GRID_MODE_REF_OBJECT && first_grid_object && first_grid_object->mDrawable.notNull())
- {
- LLSelectNode *node = mSelectedObjects->findNode(first_grid_object);
- if (!for_snap_guides && node)
- {
- mGridRotation = node->mSavedRotation;
- }
- else
- {
- mGridRotation = first_grid_object->getRenderRotation();
- }
-
- LLVector4a min_extents(F32_MAX);
- LLVector4a max_extents(-F32_MAX);
- BOOL grid_changed = FALSE;
- for (LLObjectSelection::iterator iter = mGridObjects.begin();
- iter != mGridObjects.end(); ++iter)
- {
- LLViewerObject* object = (*iter)->getObject();
- LLDrawable* drawable = object->mDrawable;
- if (drawable)
- {
- const LLVector4a* ext = drawable->getSpatialExtents();
- update_min_max(min_extents, max_extents, ext[0]);
- update_min_max(min_extents, max_extents, ext[1]);
- grid_changed = TRUE;
- }
- }
- if (grid_changed)
- {
- LLVector4a center, size;
- center.setAdd(min_extents, max_extents);
- center.mul(0.5f);
- size.setSub(max_extents, min_extents);
- size.mul(0.5f);
-
- mGridOrigin.set(center.getF32ptr());
- LLDrawable* drawable = first_grid_object->mDrawable;
- if (drawable && drawable->isActive())
- {
- mGridOrigin = mGridOrigin * first_grid_object->getRenderMatrix();
- }
- mGridScale.set(size.getF32ptr());
- }
- }
- else // GRID_MODE_WORLD or just plain default
- {
- const BOOL non_root_ok = TRUE;
- LLViewerObject* first_object = mSelectedObjects->getFirstRootObject(non_root_ok);
-
- mGridOrigin.clearVec();
- mGridRotation.loadIdentity();
-
- mSelectedObjects->mSelectType = getSelectTypeForObject( first_object );
-
- switch (mSelectedObjects->mSelectType)
- {
- case SELECT_TYPE_ATTACHMENT:
- if (first_object && first_object->getRootEdit()->mDrawable.notNull())
- {
- // this means this object *has* to be an attachment
- LLXform* attachment_point_xform = first_object->getRootEdit()->mDrawable->mXform.getParent();
- mGridOrigin = attachment_point_xform->getWorldPosition();
- mGridRotation = attachment_point_xform->getWorldRotation();
- mGridScale = LLVector3(1.f, 1.f, 1.f) * gSavedSettings.getF32("GridResolution");
- }
- break;
- case SELECT_TYPE_HUD:
- mGridScale = LLVector3(1.f, 1.f, 1.f) * llmin(gSavedSettings.getF32("GridResolution"), 0.5f);
- break;
- case SELECT_TYPE_WORLD:
- mGridScale = LLVector3(1.f, 1.f, 1.f) * gSavedSettings.getF32("GridResolution");
- break;
- }
- }
- llassert(mGridOrigin.isFinite());
-
- origin = mGridOrigin;
- rotation = mGridRotation;
- scale = mGridScale;
+ mGridObjects.cleanupNodes();
+
+ LLViewerObject* first_grid_object = mGridObjects.getFirstObject();
+
+ if (mGridMode == GRID_MODE_LOCAL && mSelectedObjects->getObjectCount())
+ {
+ //LLViewerObject* root = getSelectedParentObject(mSelectedObjects->getFirstObject());
+ mGridOrigin = mSavedSelectionBBox.getCenterAgent();
+ mGridScale = mSavedSelectionBBox.getExtentLocal() * 0.5f;
+
+ // DEV-12570 Just taking the saved selection box rotation prevents
+ // wild rotations of linked sets while in local grid mode
+ //if(mSelectedObjects->getObjectCount() < 2 || !root || root->mDrawable.isNull())
+ {
+ mGridRotation = mSavedSelectionBBox.getRotation();
+ }
+ /*else //set to the root object
+ {
+ mGridRotation = root->getRenderRotation();
+ }*/
+ }
+ else if (mGridMode == GRID_MODE_REF_OBJECT && first_grid_object && first_grid_object->mDrawable.notNull())
+ {
+ LLSelectNode *node = mSelectedObjects->findNode(first_grid_object);
+ if (!for_snap_guides && node)
+ {
+ mGridRotation = node->mSavedRotation;
+ }
+ else
+ {
+ mGridRotation = first_grid_object->getRenderRotation();
+ }
+
+ LLVector4a min_extents(F32_MAX);
+ LLVector4a max_extents(-F32_MAX);
+ BOOL grid_changed = FALSE;
+ for (LLObjectSelection::iterator iter = mGridObjects.begin();
+ iter != mGridObjects.end(); ++iter)
+ {
+ LLViewerObject* object = (*iter)->getObject();
+ LLDrawable* drawable = object->mDrawable;
+ if (drawable)
+ {
+ const LLVector4a* ext = drawable->getSpatialExtents();
+ update_min_max(min_extents, max_extents, ext[0]);
+ update_min_max(min_extents, max_extents, ext[1]);
+ grid_changed = TRUE;
+ }
+ }
+ if (grid_changed)
+ {
+ LLVector4a center, size;
+ center.setAdd(min_extents, max_extents);
+ center.mul(0.5f);
+ size.setSub(max_extents, min_extents);
+ size.mul(0.5f);
+
+ mGridOrigin.set(center.getF32ptr());
+ LLDrawable* drawable = first_grid_object->mDrawable;
+ if (drawable && drawable->isActive())
+ {
+ mGridOrigin = mGridOrigin * first_grid_object->getRenderMatrix();
+ }
+ mGridScale.set(size.getF32ptr());
+ }
+ }
+ else // GRID_MODE_WORLD or just plain default
+ {
+ const BOOL non_root_ok = TRUE;
+ LLViewerObject* first_object = mSelectedObjects->getFirstRootObject(non_root_ok);
+
+ mGridOrigin.clearVec();
+ mGridRotation.loadIdentity();
+
+ mSelectedObjects->mSelectType = getSelectTypeForObject( first_object );
+
+ switch (mSelectedObjects->mSelectType)
+ {
+ case SELECT_TYPE_ATTACHMENT:
+ if (first_object && first_object->getRootEdit()->mDrawable.notNull())
+ {
+ // this means this object *has* to be an attachment
+ LLXform* attachment_point_xform = first_object->getRootEdit()->mDrawable->mXform.getParent();
+ mGridOrigin = attachment_point_xform->getWorldPosition();
+ mGridRotation = attachment_point_xform->getWorldRotation();
+ mGridScale = LLVector3(1.f, 1.f, 1.f) * gSavedSettings.getF32("GridResolution");
+ }
+ break;
+ case SELECT_TYPE_HUD:
+ mGridScale = LLVector3(1.f, 1.f, 1.f) * llmin(gSavedSettings.getF32("GridResolution"), 0.5f);
+ break;
+ case SELECT_TYPE_WORLD:
+ mGridScale = LLVector3(1.f, 1.f, 1.f) * gSavedSettings.getF32("GridResolution");
+ break;
+ }
+ }
+ llassert(mGridOrigin.isFinite());
+
+ origin = mGridOrigin;
+ rotation = mGridRotation;
+ scale = mGridScale;
}
//-----------------------------------------------------------------------------
@@ -1484,20 +1484,20 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
void LLSelectMgr::remove(std::vector<LLViewerObject*>& objects)
{
- for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
- iter != objects.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
- LLSelectNode* nodep = mSelectedObjects->findNode(objectp);
- if (nodep)
- {
- objectp->setSelected(FALSE);
- mSelectedObjects->removeNode(nodep);
- nodep = NULL;
- }
- }
- updateSelectionCenter();
- dialog_refresh_all();
+ for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
+ iter != objects.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+ LLSelectNode* nodep = mSelectedObjects->findNode(objectp);
+ if (nodep)
+ {
+ objectp->setSelected(FALSE);
+ mSelectedObjects->removeNode(nodep);
+ nodep = NULL;
+ }
+ }
+ updateSelectionCenter();
+ dialog_refresh_all();
}
@@ -1506,59 +1506,59 @@ void LLSelectMgr::remove(std::vector<LLViewerObject*>& objects)
//-----------------------------------------------------------------------------
void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable)
{
- // get object node (and verify it is in the selected list)
- LLSelectNode *nodep = mSelectedObjects->findNode(objectp);
- if (!nodep)
- {
- return;
- }
-
- // if face = all, remove object from list
- if ((objectp->getNumTEs() <= 0) || (te == SELECT_ALL_TES))
- {
- // Remove all faces (or the object doesn't have faces) so remove the node
- mSelectedObjects->removeNode(nodep);
- nodep = NULL;
- objectp->setSelected( FALSE );
- }
- else if (0 <= te && te < SELECT_MAX_TES)
- {
- // ...valid face, check to see if it was on
- if (nodep->isTESelected(te))
- {
- nodep->selectTE(te, FALSE);
- objectp->setTESelected(te, false);
- }
- else
- {
- LL_ERRS() << "LLSelectMgr::remove - tried to remove TE " << te << " that wasn't selected" << LL_ENDL;
- return;
- }
-
- // ...check to see if this operation turned off all faces
- BOOL found = FALSE;
- for (S32 i = 0; i < nodep->getObject()->getNumTEs(); i++)
- {
- found = found || nodep->isTESelected(i);
- }
-
- // ...all faces now turned off, so remove
- if (!found)
- {
- mSelectedObjects->removeNode(nodep);
- nodep = NULL;
- objectp->setSelected( FALSE );
- // *FIXME: Doesn't update simulator that object is no longer selected
- }
- }
- else
- {
- // ...out of range face
- LL_ERRS() << "LLSelectMgr::remove - TE " << te << " out of range" << LL_ENDL;
- }
-
- updateSelectionCenter();
- dialog_refresh_all();
+ // get object node (and verify it is in the selected list)
+ LLSelectNode *nodep = mSelectedObjects->findNode(objectp);
+ if (!nodep)
+ {
+ return;
+ }
+
+ // if face = all, remove object from list
+ if ((objectp->getNumTEs() <= 0) || (te == SELECT_ALL_TES))
+ {
+ // Remove all faces (or the object doesn't have faces) so remove the node
+ mSelectedObjects->removeNode(nodep);
+ nodep = NULL;
+ objectp->setSelected( FALSE );
+ }
+ else if (0 <= te && te < SELECT_MAX_TES)
+ {
+ // ...valid face, check to see if it was on
+ if (nodep->isTESelected(te))
+ {
+ nodep->selectTE(te, FALSE);
+ objectp->setTESelected(te, false);
+ }
+ else
+ {
+ LL_ERRS() << "LLSelectMgr::remove - tried to remove TE " << te << " that wasn't selected" << LL_ENDL;
+ return;
+ }
+
+ // ...check to see if this operation turned off all faces
+ BOOL found = FALSE;
+ for (S32 i = 0; i < nodep->getObject()->getNumTEs(); i++)
+ {
+ found = found || nodep->isTESelected(i);
+ }
+
+ // ...all faces now turned off, so remove
+ if (!found)
+ {
+ mSelectedObjects->removeNode(nodep);
+ nodep = NULL;
+ objectp->setSelected( FALSE );
+ // *FIXME: Doesn't update simulator that object is no longer selected
+ }
+ }
+ else
+ {
+ // ...out of range face
+ LL_ERRS() << "LLSelectMgr::remove - TE " << te << " out of range" << LL_ENDL;
+ }
+
+ updateSelectionCenter();
+ dialog_refresh_all();
}
@@ -1567,17 +1567,17 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable)
//-----------------------------------------------------------------------------
void LLSelectMgr::removeAll()
{
- for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
- iter != mSelectedObjects->end(); iter++ )
- {
- LLViewerObject *objectp = (*iter)->getObject();
- objectp->setSelected( FALSE );
- }
+ for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+ iter != mSelectedObjects->end(); iter++ )
+ {
+ LLViewerObject *objectp = (*iter)->getObject();
+ objectp->setSelected( FALSE );
+ }
+
+ mSelectedObjects->deleteAllNodes();
- mSelectedObjects->deleteAllNodes();
-
- updateSelectionCenter();
- dialog_refresh_all();
+ updateSelectionCenter();
+ dialog_refresh_all();
}
//-----------------------------------------------------------------------------
@@ -1585,41 +1585,41 @@ void LLSelectMgr::removeAll()
//-----------------------------------------------------------------------------
void LLSelectMgr::promoteSelectionToRoot()
{
- std::set<LLViewerObject*> selection_set;
+ std::set<LLViewerObject*> selection_set;
- BOOL selection_changed = FALSE;
+ BOOL selection_changed = FALSE;
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); )
- {
- LLObjectSelection::iterator curiter = iter++;
- LLSelectNode* nodep = *curiter;
- LLViewerObject* object = nodep->getObject();
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); )
+ {
+ LLObjectSelection::iterator curiter = iter++;
+ LLSelectNode* nodep = *curiter;
+ LLViewerObject* object = nodep->getObject();
- if (nodep->mIndividualSelection)
- {
- selection_changed = TRUE;
- }
+ if (nodep->mIndividualSelection)
+ {
+ selection_changed = TRUE;
+ }
- LLViewerObject* parentp = object;
- while(parentp->getParent() && !(parentp->isRootEdit()))
- {
- parentp = (LLViewerObject*)parentp->getParent();
- }
-
- selection_set.insert(parentp);
- }
+ LLViewerObject* parentp = object;
+ while(parentp->getParent() && !(parentp->isRootEdit()))
+ {
+ parentp = (LLViewerObject*)parentp->getParent();
+ }
- if (selection_changed)
- {
- deselectAll();
+ selection_set.insert(parentp);
+ }
+
+ if (selection_changed)
+ {
+ deselectAll();
- std::set<LLViewerObject*>::iterator set_iter;
- for (set_iter = selection_set.begin(); set_iter != selection_set.end(); ++set_iter)
- {
- selectObjectAndFamily(*set_iter);
- }
- }
+ std::set<LLViewerObject*>::iterator set_iter;
+ for (set_iter = selection_set.begin(); set_iter != selection_set.end(); ++set_iter)
+ {
+ selectObjectAndFamily(*set_iter);
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -1627,25 +1627,25 @@ void LLSelectMgr::promoteSelectionToRoot()
//-----------------------------------------------------------------------------
void LLSelectMgr::demoteSelectionToIndividuals()
{
- std::vector<LLViewerObject*> objects;
+ std::vector<LLViewerObject*> objects;
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++)
- {
- LLViewerObject* object = (*iter)->getObject();
- object->addThisAndNonJointChildren(objects);
- }
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
+ {
+ LLViewerObject* object = (*iter)->getObject();
+ object->addThisAndNonJointChildren(objects);
+ }
- if (!objects.empty())
- {
- deselectAll();
- for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
- iter != objects.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
- selectObjectOnly(objectp);
- }
- }
+ if (!objects.empty())
+ {
+ deselectAll();
+ for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
+ iter != objects.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+ selectObjectOnly(objectp);
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -1653,49 +1653,49 @@ void LLSelectMgr::demoteSelectionToIndividuals()
//-----------------------------------------------------------------------------
void LLSelectMgr::dump()
{
- LL_INFOS() << "Selection Manager: " << mSelectedObjects->getNumNodes() << " items" << LL_ENDL;
-
- LL_INFOS() << "TE mode " << mTEMode << LL_ENDL;
-
- S32 count = 0;
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLViewerObject* objectp = (*iter)->getObject();
- LL_INFOS() << "Object " << count << " type " << LLPrimitive::pCodeToString(objectp->getPCode()) << LL_ENDL;
- LL_INFOS() << " hasLSL " << objectp->flagScripted() << LL_ENDL;
- LL_INFOS() << " hasTouch " << objectp->flagHandleTouch() << LL_ENDL;
- LL_INFOS() << " hasMoney " << objectp->flagTakesMoney() << LL_ENDL;
- LL_INFOS() << " getposition " << objectp->getPosition() << LL_ENDL;
- LL_INFOS() << " getpositionAgent " << objectp->getPositionAgent() << LL_ENDL;
- LL_INFOS() << " getpositionRegion " << objectp->getPositionRegion() << LL_ENDL;
- LL_INFOS() << " getpositionGlobal " << objectp->getPositionGlobal() << LL_ENDL;
- LLDrawable* drawablep = objectp->mDrawable;
- LL_INFOS() << " " << (drawablep&& drawablep->isVisible() ? "visible" : "invisible") << LL_ENDL;
- LL_INFOS() << " " << (drawablep&& drawablep->isState(LLDrawable::FORCE_INVISIBLE) ? "force_invisible" : "") << LL_ENDL;
- count++;
- }
-
- // Face iterator
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* objectp = node->getObject();
- if (!objectp)
- continue;
- for (S32 te = 0; te < objectp->getNumTEs(); ++te )
- {
- if (node->isTESelected(te))
- {
- LL_INFOS() << "Object " << objectp << " te " << te << LL_ENDL;
- }
- }
- }
-
- LL_INFOS() << mHighlightedObjects->getNumNodes() << " objects currently highlighted." << LL_ENDL;
-
- LL_INFOS() << "Center global " << mSelectionCenterGlobal << LL_ENDL;
+ LL_INFOS() << "Selection Manager: " << mSelectedObjects->getNumNodes() << " items" << LL_ENDL;
+
+ LL_INFOS() << "TE mode " << mTEMode << LL_ENDL;
+
+ S32 count = 0;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLViewerObject* objectp = (*iter)->getObject();
+ LL_INFOS() << "Object " << count << " type " << LLPrimitive::pCodeToString(objectp->getPCode()) << LL_ENDL;
+ LL_INFOS() << " hasLSL " << objectp->flagScripted() << LL_ENDL;
+ LL_INFOS() << " hasTouch " << objectp->flagHandleTouch() << LL_ENDL;
+ LL_INFOS() << " hasMoney " << objectp->flagTakesMoney() << LL_ENDL;
+ LL_INFOS() << " getposition " << objectp->getPosition() << LL_ENDL;
+ LL_INFOS() << " getpositionAgent " << objectp->getPositionAgent() << LL_ENDL;
+ LL_INFOS() << " getpositionRegion " << objectp->getPositionRegion() << LL_ENDL;
+ LL_INFOS() << " getpositionGlobal " << objectp->getPositionGlobal() << LL_ENDL;
+ LLDrawable* drawablep = objectp->mDrawable;
+ LL_INFOS() << " " << (drawablep&& drawablep->isVisible() ? "visible" : "invisible") << LL_ENDL;
+ LL_INFOS() << " " << (drawablep&& drawablep->isState(LLDrawable::FORCE_INVISIBLE) ? "force_invisible" : "") << LL_ENDL;
+ count++;
+ }
+
+ // Face iterator
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* objectp = node->getObject();
+ if (!objectp)
+ continue;
+ for (S32 te = 0; te < objectp->getNumTEs(); ++te )
+ {
+ if (node->isTESelected(te))
+ {
+ LL_INFOS() << "Object " << objectp << " te " << te << LL_ENDL;
+ }
+ }
+ }
+
+ LL_INFOS() << mHighlightedObjects->getNumNodes() << " objects currently highlighted." << LL_ENDL;
+
+ LL_INFOS() << "Center global " << mSelectionCenterGlobal << LL_ENDL;
}
//-----------------------------------------------------------------------------
@@ -1703,7 +1703,7 @@ void LLSelectMgr::dump()
//-----------------------------------------------------------------------------
void LLSelectMgr::cleanup()
{
- mSilhouetteImagep = NULL;
+ mSilhouetteImagep = NULL;
}
@@ -1713,54 +1713,54 @@ void LLSelectMgr::cleanup()
struct LLSelectMgrSendFunctor : public LLSelectedObjectFunctor
{
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
- return true;
- }
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->sendTEUpdate();
+ }
+ return true;
+ }
};
void LLObjectSelection::applyNoCopyTextureToTEs(LLViewerInventoryItem* item)
{
- if (!item)
- {
- return;
- }
- LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(item->getAssetUUID());
-
- for (iterator iter = begin(); iter != end(); ++iter)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = (*iter)->getObject();
- if (!object)
- {
- continue;
- }
-
- S32 num_tes = llmin((S32)object->getNumTEs(), (S32)object->getNumFaces());
- bool texture_copied = false;
+ if (!item)
+ {
+ return;
+ }
+ LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(item->getAssetUUID());
+
+ for (iterator iter = begin(); iter != end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = (*iter)->getObject();
+ if (!object)
+ {
+ continue;
+ }
+
+ S32 num_tes = llmin((S32)object->getNumTEs(), (S32)object->getNumFaces());
+ bool texture_copied = false;
bool updated = false;
- for (S32 te = 0; te < num_tes; ++te)
- {
- if (node->isTESelected(te))
- {
- //(no-copy) textures must be moved to the object's inventory only once
- // without making any copies
- if (!texture_copied)
- {
- LLToolDragAndDrop::handleDropMaterialProtections(object, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null);
- texture_copied = true;
- }
-
- // apply texture for the selected faces
- add(LLStatViewer::EDIT_TEXTURE, 1);
- object->setTEImage(te, image);
+ for (S32 te = 0; te < num_tes; ++te)
+ {
+ if (node->isTESelected(te))
+ {
+ //(no-copy) textures must be moved to the object's inventory only once
+ // without making any copies
+ if (!texture_copied)
+ {
+ LLToolDragAndDrop::handleDropMaterialProtections(object, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null);
+ texture_copied = true;
+ }
+
+ // apply texture for the selected faces
+ add(LLStatViewer::EDIT_TEXTURE, 1);
+ object->setTEImage(te, image);
updated = true;
- }
- }
+ }
+ }
if (updated) // not nessesary? sendTEUpdate update supposed to be done by sendfunc
{
@@ -1769,7 +1769,7 @@ void LLObjectSelection::applyNoCopyTextureToTEs(LLViewerInventoryItem* item)
// send the update to the simulator
object->sendTEUpdate();
}
- }
+ }
}
bool LLObjectSelection::applyRestrictedPbrMaterialToTEs(LLViewerInventoryItem* item)
@@ -1811,7 +1811,7 @@ bool LLObjectSelection::applyRestrictedPbrMaterialToTEs(LLViewerInventoryItem* i
if (!material_copied)
{
// Applying the material is not possible for this object given the current inventory
- material_copied_all_faces = false;
+ material_copied_all_faces = false;
break;
}
@@ -1835,30 +1835,30 @@ bool LLObjectSelection::applyRestrictedPbrMaterialToTEs(LLViewerInventoryItem* i
// *TODO: re-arch texture applying out of lltooldraganddrop
bool LLSelectMgr::selectionSetImage(const LLUUID& imageid)
{
- // First for (no copy) textures and multiple object selection
- LLViewerInventoryItem* item = gInventory.getItem(imageid);
- if(item
- && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())
- && (mSelectedObjects->getNumNodes() > 1) )
- {
+ // First for (no copy) textures and multiple object selection
+ LLViewerInventoryItem* item = gInventory.getItem(imageid);
+ if(item
+ && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())
+ && (mSelectedObjects->getNumNodes() > 1) )
+ {
LL_DEBUGS() << "Attempted to apply no-copy texture " << imageid
<< " to multiple objects" << LL_ENDL;
LLNotificationsUtil::add("FailedToApplyTextureNoCopyToMultiple");
return false;
- }
-
- struct f : public LLSelectedTEFunctor
- {
- LLViewerInventoryItem* mItem;
- LLUUID mImageID;
- f(LLViewerInventoryItem* item, const LLUUID& id) : mItem(item), mImageID(id) {}
- bool apply(LLViewerObject* objectp, S32 te)
- {
- if(!objectp || !objectp->permModify())
- {
- return false;
- }
+ }
+
+ struct f : public LLSelectedTEFunctor
+ {
+ LLViewerInventoryItem* mItem;
+ LLUUID mImageID;
+ f(LLViewerInventoryItem* item, const LLUUID& id) : mItem(item), mImageID(id) {}
+ bool apply(LLViewerObject* objectp, S32 te)
+ {
+ if(!objectp || !objectp->permModify())
+ {
+ return false;
+ }
// Might be better to run willObjectAcceptInventory
if (mItem && objectp->isAttachment())
@@ -1873,58 +1873,58 @@ bool LLSelectMgr::selectionSetImage(const LLUUID& imageid)
}
}
- if (mItem)
- {
+ if (mItem)
+ {
LLToolDragAndDrop::dropTextureOneFace(objectp,
te,
mItem,
LLToolDragAndDrop::SOURCE_AGENT,
LLUUID::null,
false);
- }
- else // not an inventory item
- {
- // Texture picker defaults aren't inventory items
- // * Don't need to worry about permissions for them
- // * Can just apply the texture and be done with it.
- objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
- }
-
- return true;
- }
- };
-
- if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
- {
- getSelection()->applyNoCopyTextureToTEs(item);
- }
- else
- {
- f setfunc(item, imageid);
- getSelection()->applyToTEs(&setfunc);
- }
-
-
- struct g : public LLSelectedObjectFunctor
- {
- LLViewerInventoryItem* mItem;
- g(LLViewerInventoryItem* item) : mItem(item) {}
- virtual bool apply(LLViewerObject* object)
- {
- if (!mItem)
- {
- object->sendTEUpdate();
- // 1 particle effect per object
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgentAvatarp);
- effectp->setTargetObject(object);
- effectp->setDuration(LL_HUD_DUR_SHORT);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- }
- return true;
- }
- } sendfunc(item);
- getSelection()->applyToObjects(&sendfunc);
+ }
+ else // not an inventory item
+ {
+ // Texture picker defaults aren't inventory items
+ // * Don't need to worry about permissions for them
+ // * Can just apply the texture and be done with it.
+ objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
+ }
+
+ return true;
+ }
+ };
+
+ if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
+ {
+ getSelection()->applyNoCopyTextureToTEs(item);
+ }
+ else
+ {
+ f setfunc(item, imageid);
+ getSelection()->applyToTEs(&setfunc);
+ }
+
+
+ struct g : public LLSelectedObjectFunctor
+ {
+ LLViewerInventoryItem* mItem;
+ g(LLViewerInventoryItem* item) : mItem(item) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (!mItem)
+ {
+ object->sendTEUpdate();
+ // 1 particle effect per object
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ effectp->setSourceObject(gAgentAvatarp);
+ effectp->setTargetObject(object);
+ effectp->setDuration(LL_HUD_DUR_SHORT);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ }
+ return true;
+ }
+ } sendfunc(item);
+ getSelection()->applyToObjects(&sendfunc);
return true;
}
@@ -2028,7 +2028,7 @@ bool LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id)
if (!mItem)
{
- // 1 particle effect per object
+ // 1 particle effect per object
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
effectp->setSourceObject(gAgentAvatarp);
effectp->setTargetObject(object);
@@ -2053,23 +2053,23 @@ bool LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionSetColor(const LLColor4 &color)
{
- struct f : public LLSelectedTEFunctor
- {
- LLColor4 mColor;
- f(const LLColor4& c) : mColor(c) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- object->setTEColor(te, mColor);
- }
- return true;
- }
- } setfunc(color);
- getSelection()->applyToTEs(&setfunc);
-
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedTEFunctor
+ {
+ LLColor4 mColor;
+ f(const LLColor4& c) : mColor(c) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ object->setTEColor(te, mColor);
+ }
+ return true;
+ }
+ } setfunc(color);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
//-----------------------------------------------------------------------------
@@ -2077,26 +2077,26 @@ void LLSelectMgr::selectionSetColor(const LLColor4 &color)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionSetColorOnly(const LLColor4 &color)
{
- struct f : public LLSelectedTEFunctor
- {
- LLColor4 mColor;
- f(const LLColor4& c) : mColor(c) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- LLColor4 prev_color = object->getTE(te)->getColor();
- mColor.mV[VALPHA] = prev_color.mV[VALPHA];
- // update viewer side color in anticipation of update from simulator
- object->setTEColor(te, mColor);
- }
- return true;
- }
- } setfunc(color);
- getSelection()->applyToTEs(&setfunc);
-
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedTEFunctor
+ {
+ LLColor4 mColor;
+ f(const LLColor4& c) : mColor(c) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ LLColor4 prev_color = object->getTE(te)->getColor();
+ mColor.mV[VALPHA] = prev_color.mV[VALPHA];
+ // update viewer side color in anticipation of update from simulator
+ object->setTEColor(te, mColor);
+ }
+ return true;
+ }
+ } setfunc(color);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
//-----------------------------------------------------------------------------
@@ -2104,125 +2104,125 @@ void LLSelectMgr::selectionSetColorOnly(const LLColor4 &color)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionSetAlphaOnly(const F32 alpha)
{
- struct f : public LLSelectedTEFunctor
- {
- F32 mAlpha;
- f(const F32& a) : mAlpha(a) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- LLColor4 prev_color = object->getTE(te)->getColor();
- prev_color.mV[VALPHA] = mAlpha;
- // update viewer side color in anticipation of update from simulator
- object->setTEColor(te, prev_color);
- }
- return true;
- }
- } setfunc(alpha);
- getSelection()->applyToTEs(&setfunc);
-
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedTEFunctor
+ {
+ F32 mAlpha;
+ f(const F32& a) : mAlpha(a) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ LLColor4 prev_color = object->getTE(te)->getColor();
+ prev_color.mV[VALPHA] = mAlpha;
+ // update viewer side color in anticipation of update from simulator
+ object->setTEColor(te, prev_color);
+ }
+ return true;
+ }
+ } setfunc(alpha);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionRevertColors()
{
- struct f : public LLSelectedTEFunctor
- {
- LLObjectSelectionHandle mSelectedObjects;
- f(LLObjectSelectionHandle sel) : mSelectedObjects(sel) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- LLSelectNode* nodep = mSelectedObjects->findNode(object);
- if (nodep && te < (S32)nodep->mSavedColors.size())
- {
- LLColor4 color = nodep->mSavedColors[te];
- // update viewer side color in anticipation of update from simulator
- object->setTEColor(te, color);
- }
- }
- return true;
- }
- } setfunc(mSelectedObjects);
- getSelection()->applyToTEs(&setfunc);
-
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedTEFunctor
+ {
+ LLObjectSelectionHandle mSelectedObjects;
+ f(LLObjectSelectionHandle sel) : mSelectedObjects(sel) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ LLSelectNode* nodep = mSelectedObjects->findNode(object);
+ if (nodep && te < (S32)nodep->mSavedColors.size())
+ {
+ LLColor4 color = nodep->mSavedColors[te];
+ // update viewer side color in anticipation of update from simulator
+ object->setTEColor(te, color);
+ }
+ }
+ return true;
+ }
+ } setfunc(mSelectedObjects);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionRevertShinyColors()
{
- struct f : public LLSelectedTEFunctor
- {
- LLObjectSelectionHandle mSelectedObjects;
- f(LLObjectSelectionHandle sel) : mSelectedObjects(sel) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- LLSelectNode* nodep = mSelectedObjects->findNode(object);
- if (nodep && te < (S32)nodep->mSavedShinyColors.size())
- {
- LLColor4 color = nodep->mSavedShinyColors[te];
- // update viewer side color in anticipation of update from simulator
- LLMaterialPtr old_mat = object->getTE(te)->getMaterialParams();
- if (!old_mat.isNull())
- {
- LLMaterialPtr new_mat = gFloaterTools->getPanelFace()->createDefaultMaterial(old_mat);
- new_mat->setSpecularLightColor(color);
- object->getTE(te)->setMaterialParams(new_mat);
- LLMaterialMgr::getInstance()->put(object->getID(), te, *new_mat);
- }
- }
- }
- return true;
- }
- } setfunc(mSelectedObjects);
- getSelection()->applyToTEs(&setfunc);
-
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedTEFunctor
+ {
+ LLObjectSelectionHandle mSelectedObjects;
+ f(LLObjectSelectionHandle sel) : mSelectedObjects(sel) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ LLSelectNode* nodep = mSelectedObjects->findNode(object);
+ if (nodep && te < (S32)nodep->mSavedShinyColors.size())
+ {
+ LLColor4 color = nodep->mSavedShinyColors[te];
+ // update viewer side color in anticipation of update from simulator
+ LLMaterialPtr old_mat = object->getTE(te)->getMaterialParams();
+ if (!old_mat.isNull())
+ {
+ LLMaterialPtr new_mat = gFloaterTools->getPanelFace()->createDefaultMaterial(old_mat);
+ new_mat->setSpecularLightColor(color);
+ object->getTE(te)->setMaterialParams(new_mat);
+ LLMaterialMgr::getInstance()->put(object->getID(), te, *new_mat);
+ }
+ }
+ }
+ return true;
+ }
+ } setfunc(mSelectedObjects);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
BOOL LLSelectMgr::selectionRevertTextures()
{
- struct f : public LLSelectedTEFunctor
- {
- LLObjectSelectionHandle mSelectedObjects;
- f(LLObjectSelectionHandle sel) : mSelectedObjects(sel) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- LLSelectNode* nodep = mSelectedObjects->findNode(object);
- if (nodep && te < (S32)nodep->mSavedTextures.size())
- {
- LLUUID id = nodep->mSavedTextures[te];
- // update textures on viewer side
- if (id.isNull())
- {
- // this was probably a no-copy texture, leave image as-is
- return FALSE;
- }
- else
- {
- object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
-
- }
- }
- }
- return true;
- }
- } setfunc(mSelectedObjects);
- BOOL revert_successful = getSelection()->applyToTEs(&setfunc);
-
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
-
- return revert_successful;
+ struct f : public LLSelectedTEFunctor
+ {
+ LLObjectSelectionHandle mSelectedObjects;
+ f(LLObjectSelectionHandle sel) : mSelectedObjects(sel) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ LLSelectNode* nodep = mSelectedObjects->findNode(object);
+ if (nodep && te < (S32)nodep->mSavedTextures.size())
+ {
+ LLUUID id = nodep->mSavedTextures[te];
+ // update textures on viewer side
+ if (id.isNull())
+ {
+ // this was probably a no-copy texture, leave image as-is
+ return FALSE;
+ }
+ else
+ {
+ object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
+
+ }
+ }
+ }
+ return true;
+ }
+ } setfunc(mSelectedObjects);
+ BOOL revert_successful = getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
+
+ return revert_successful;
}
void LLSelectMgr::selectionRevertGLTFMaterials()
@@ -2253,7 +2253,7 @@ void LLSelectMgr::selectionRevertGLTFMaterials()
{
// Restore overrides and base material
LLGLTFMaterialList::queueApply(objectp, te, asset_id, nodep->mSavedGLTFOverrideMaterials[te]);
- }
+ }
else
{
//blank override out
@@ -2269,23 +2269,23 @@ void LLSelectMgr::selectionRevertGLTFMaterials()
void LLSelectMgr::selectionSetBumpmap(U8 bumpmap, const LLUUID &image_id)
{
- struct f : public LLSelectedTEFunctor
- {
- U8 mBump;
- f(const U8& b) : mBump(b) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- // update viewer side color in anticipation of update from simulator
- object->setTEBumpmap(te, mBump);
- }
- return true;
- }
- } setfunc(bumpmap);
+ struct f : public LLSelectedTEFunctor
+ {
+ U8 mBump;
+ f(const U8& b) : mBump(b) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTEBumpmap(te, mBump);
+ }
+ return true;
+ }
+ } setfunc(bumpmap);
LLViewerInventoryItem* item = gInventory.getItem(image_id);
- if(item
+ if(item
&& !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())
&& (mSelectedObjects->getNumNodes() > 1) )
{
@@ -2311,53 +2311,53 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap, const LLUUID &image_id)
LLToolDragAndDrop::handleDropMaterialProtections(object, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null);
}
getSelection()->applyToTEs(&setfunc);
-
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetTexGen(U8 texgen)
{
- struct f : public LLSelectedTEFunctor
- {
- U8 mTexgen;
- f(const U8& t) : mTexgen(t) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- // update viewer side color in anticipation of update from simulator
- object->setTETexGen(te, mTexgen);
- }
- return true;
- }
- } setfunc(texgen);
- getSelection()->applyToTEs(&setfunc);
+ struct f : public LLSelectedTEFunctor
+ {
+ U8 mTexgen;
+ f(const U8& t) : mTexgen(t) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTETexGen(te, mTexgen);
+ }
+ return true;
+ }
+ } setfunc(texgen);
+ getSelection()->applyToTEs(&setfunc);
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetShiny(U8 shiny, const LLUUID &image_id)
{
- struct f : public LLSelectedTEFunctor
- {
- U8 mShiny;
- f(const U8& t) : mShiny(t) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- // update viewer side color in anticipation of update from simulator
- object->setTEShiny(te, mShiny);
- }
- return true;
- }
- } setfunc(shiny);
+ struct f : public LLSelectedTEFunctor
+ {
+ U8 mShiny;
+ f(const U8& t) : mShiny(t) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTEShiny(te, mShiny);
+ }
+ return true;
+ }
+ } setfunc(shiny);
LLViewerInventoryItem* item = gInventory.getItem(image_id);
- if(item
+ if(item
&& !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())
&& (mSelectedObjects->getNumNodes() > 1) )
{
@@ -2384,235 +2384,235 @@ void LLSelectMgr::selectionSetShiny(U8 shiny, const LLUUID &image_id)
}
getSelection()->applyToTEs(&setfunc);
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetFullbright(U8 fullbright)
{
- struct f : public LLSelectedTEFunctor
- {
- U8 mFullbright;
- f(const U8& t) : mFullbright(t) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- // update viewer side color in anticipation of update from simulator
- object->setTEFullbright(te, mFullbright);
- }
- return true;
- }
- } setfunc(fullbright);
- getSelection()->applyToTEs(&setfunc);
-
- struct g : public LLSelectedObjectFunctor
- {
- U8 mFullbright;
- g(const U8& t) : mFullbright(t) {}
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- if (mFullbright)
- {
- U8 material = object->getMaterial();
- U8 mcode = material & LL_MCODE_MASK;
- if (mcode == LL_MCODE_LIGHT)
- {
- mcode = LL_MCODE_GLASS;
- material = (material & ~LL_MCODE_MASK) | mcode;
- object->setMaterial(material);
- object->sendMaterialUpdate();
- }
- }
- }
- return true;
- }
- } sendfunc(fullbright);
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedTEFunctor
+ {
+ U8 mFullbright;
+ f(const U8& t) : mFullbright(t) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTEFullbright(te, mFullbright);
+ }
+ return true;
+ }
+ } setfunc(fullbright);
+ getSelection()->applyToTEs(&setfunc);
+
+ struct g : public LLSelectedObjectFunctor
+ {
+ U8 mFullbright;
+ g(const U8& t) : mFullbright(t) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->sendTEUpdate();
+ if (mFullbright)
+ {
+ U8 material = object->getMaterial();
+ U8 mcode = material & LL_MCODE_MASK;
+ if (mcode == LL_MCODE_LIGHT)
+ {
+ mcode = LL_MCODE_GLASS;
+ material = (material & ~LL_MCODE_MASK) | mcode;
+ object->setMaterial(material);
+ object->sendMaterialUpdate();
+ }
+ }
+ }
+ return true;
+ }
+ } sendfunc(fullbright);
+ getSelection()->applyToObjects(&sendfunc);
}
// This function expects media_data to be a map containing relevant
// media data name/value pairs (e.g. home_url, etc.)
void LLSelectMgr::selectionSetMedia(U8 media_type, const LLSD &media_data)
-{
- struct f : public LLSelectedTEFunctor
- {
- U8 mMediaFlags;
- const LLSD &mMediaData;
- f(const U8& t, const LLSD& d) : mMediaFlags(t), mMediaData(d) {}
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- // If we are adding media, then check the current state of the
- // media data on this face.
- // - If it does not have media, AND we are NOT setting the HOME URL, then do NOT add media to this
- // face.
- // - If it does not have media, and we ARE setting the HOME URL, add media to this face.
- // - If it does already have media, add/update media to/on this face
- // If we are removing media, just do it (ignore the passed-in LLSD).
- if (mMediaFlags & LLTextureEntry::MF_HAS_MEDIA)
- {
- llassert(mMediaData.isMap());
- const LLTextureEntry *texture_entry = object->getTE(te);
- if (!mMediaData.isMap() ||
- ((NULL != texture_entry) && !texture_entry->hasMedia() && !mMediaData.has(LLMediaEntry::HOME_URL_KEY)))
- {
- // skip adding/updating media
- }
- else {
- // Add/update media
- object->setTEMediaFlags(te, mMediaFlags);
- LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object);
- llassert(NULL != vo);
- if (NULL != vo)
- {
- vo->syncMediaData(te, mMediaData, true/*merge*/, true/*ignore_agent*/);
- }
- }
- }
- else
- {
- // delete media (or just set the flags)
- object->setTEMediaFlags(te, mMediaFlags);
- }
- }
- return true;
- }
- } setfunc(media_type, media_data);
- getSelection()->applyToTEs(&setfunc);
-
- struct f2 : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object);
- llassert(NULL != vo);
- // It's okay to skip this object if hasMedia() is false...
- // the sendTEUpdate() above would remove all media data if it were
- // there.
+{
+ struct f : public LLSelectedTEFunctor
+ {
+ U8 mMediaFlags;
+ const LLSD &mMediaData;
+ f(const U8& t, const LLSD& d) : mMediaFlags(t), mMediaData(d) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ // If we are adding media, then check the current state of the
+ // media data on this face.
+ // - If it does not have media, AND we are NOT setting the HOME URL, then do NOT add media to this
+ // face.
+ // - If it does not have media, and we ARE setting the HOME URL, add media to this face.
+ // - If it does already have media, add/update media to/on this face
+ // If we are removing media, just do it (ignore the passed-in LLSD).
+ if (mMediaFlags & LLTextureEntry::MF_HAS_MEDIA)
+ {
+ llassert(mMediaData.isMap());
+ const LLTextureEntry *texture_entry = object->getTE(te);
+ if (!mMediaData.isMap() ||
+ ((NULL != texture_entry) && !texture_entry->hasMedia() && !mMediaData.has(LLMediaEntry::HOME_URL_KEY)))
+ {
+ // skip adding/updating media
+ }
+ else {
+ // Add/update media
+ object->setTEMediaFlags(te, mMediaFlags);
+ LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object);
+ llassert(NULL != vo);
+ if (NULL != vo)
+ {
+ vo->syncMediaData(te, mMediaData, true/*merge*/, true/*ignore_agent*/);
+ }
+ }
+ }
+ else
+ {
+ // delete media (or just set the flags)
+ object->setTEMediaFlags(te, mMediaFlags);
+ }
+ }
+ return true;
+ }
+ } setfunc(media_type, media_data);
+ getSelection()->applyToTEs(&setfunc);
+
+ struct f2 : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->sendTEUpdate();
+ LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object);
+ llassert(NULL != vo);
+ // It's okay to skip this object if hasMedia() is false...
+ // the sendTEUpdate() above would remove all media data if it were
+ // there.
if (NULL != vo && vo->hasMedia())
{
// Send updated media data FOR THE ENTIRE OBJECT
vo->sendMediaDataUpdate();
}
- }
- return true;
- }
- } func2;
- mSelectedObjects->applyToObjects( &func2 );
+ }
+ return true;
+ }
+ } func2;
+ mSelectedObjects->applyToObjects( &func2 );
}
void LLSelectMgr::selectionSetGlow(F32 glow)
{
- struct f1 : public LLSelectedTEFunctor
- {
- F32 mGlow;
- f1(F32 glow) : mGlow(glow) {};
- bool apply(LLViewerObject* object, S32 face)
- {
- if (object->permModify())
- {
- // update viewer side color in anticipation of update from simulator
- object->setTEGlow(face, mGlow);
- }
- return true;
- }
- } func1(glow);
- mSelectedObjects->applyToTEs( &func1 );
-
- struct f2 : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
- return true;
- }
- } func2;
- mSelectedObjects->applyToObjects( &func2 );
+ struct f1 : public LLSelectedTEFunctor
+ {
+ F32 mGlow;
+ f1(F32 glow) : mGlow(glow) {};
+ bool apply(LLViewerObject* object, S32 face)
+ {
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTEGlow(face, mGlow);
+ }
+ return true;
+ }
+ } func1(glow);
+ mSelectedObjects->applyToTEs( &func1 );
+
+ struct f2 : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->sendTEUpdate();
+ }
+ return true;
+ }
+ } func2;
+ mSelectedObjects->applyToObjects( &func2 );
}
void LLSelectMgr::selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func, int te)
{
- struct f1 : public LLSelectedTEFunctor
- {
- LLMaterialPtr mMaterial;
- f1(LLSelectedTEMaterialFunctor* material_func, int te) : _material_func(material_func), _specific_te(te) {}
+ struct f1 : public LLSelectedTEFunctor
+ {
+ LLMaterialPtr mMaterial;
+ f1(LLSelectedTEMaterialFunctor* material_func, int te) : _material_func(material_func), _specific_te(te) {}
- bool apply(LLViewerObject* object, S32 te)
- {
+ bool apply(LLViewerObject* object, S32 te)
+ {
if (_specific_te == -1 || (te == _specific_te))
{
- if (object && object->permModify() && _material_func)
- {
- LLTextureEntry* tep = object->getTE(te);
- if (tep)
- {
- LLMaterialPtr current_material = tep->getMaterialParams();
- _material_func->apply(object, te, tep, current_material);
- }
- }
+ if (object && object->permModify() && _material_func)
+ {
+ LLTextureEntry* tep = object->getTE(te);
+ if (tep)
+ {
+ LLMaterialPtr current_material = tep->getMaterialParams();
+ _material_func->apply(object, te, tep, current_material);
+ }
+ }
}
- return true;
- }
+ return true;
+ }
- LLSelectedTEMaterialFunctor* _material_func;
+ LLSelectedTEMaterialFunctor* _material_func;
int _specific_te;
- } func1(material_func, te);
- mSelectedObjects->applyToTEs( &func1 );
-
- struct f2 : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
- return true;
- }
- } func2;
- mSelectedObjects->applyToObjects( &func2 );
+ } func1(material_func, te);
+ mSelectedObjects->applyToTEs( &func1 );
+
+ struct f2 : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->sendTEUpdate();
+ }
+ return true;
+ }
+ } func2;
+ mSelectedObjects->applyToObjects( &func2 );
}
void LLSelectMgr::selectionRemoveMaterial()
{
- struct f1 : public LLSelectedTEFunctor
- {
- bool apply(LLViewerObject* object, S32 face)
- {
- if (object->permModify())
- {
- LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
- LLMaterialMgr::getInstance()->remove(object->getID(),face);
- object->setTEMaterialParams(face, NULL);
- }
- return true;
- }
- } func1;
- mSelectedObjects->applyToTEs( &func1 );
-
- struct f2 : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
- return true;
- }
- } func2;
- mSelectedObjects->applyToObjects( &func2 );
+ struct f1 : public LLSelectedTEFunctor
+ {
+ bool apply(LLViewerObject* object, S32 face)
+ {
+ if (object->permModify())
+ {
+ LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
+ LLMaterialMgr::getInstance()->remove(object->getID(),face);
+ object->setTEMaterialParams(face, NULL);
+ }
+ return true;
+ }
+ } func1;
+ mSelectedObjects->applyToTEs( &func1 );
+
+ struct f2 : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->sendTEUpdate();
+ }
+ return true;
+ }
+ } func2;
+ mSelectedObjects->applyToObjects( &func2 );
}
@@ -2621,17 +2621,17 @@ void LLSelectMgr::selectionRemoveMaterial()
//-----------------------------------------------------------------------------
LLPermissions* LLSelectMgr::findObjectPermissions(const LLViewerObject* object)
{
- for (LLObjectSelection::valid_iterator iter = getSelection()->valid_begin();
- iter != getSelection()->valid_end(); iter++ )
- {
- LLSelectNode* nodep = *iter;
- if (nodep->getObject() == object)
- {
- return nodep->mPermissions;
- }
- }
+ for (LLObjectSelection::valid_iterator iter = getSelection()->valid_begin();
+ iter != getSelection()->valid_end(); iter++ )
+ {
+ LLSelectNode* nodep = *iter;
+ if (nodep->getObject() == object)
+ {
+ return nodep->mPermissions;
+ }
+ }
- return NULL;
+ return NULL;
}
@@ -2640,115 +2640,115 @@ LLPermissions* LLSelectMgr::findObjectPermissions(const LLViewerObject* object)
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectionGetGlow(F32 *glow)
{
- BOOL identical;
- F32 lglow = 0.f;
- struct f1 : public LLSelectedTEGetFunctor<F32>
- {
- F32 get(LLViewerObject* object, S32 face)
- {
- return object->getTE(face)->getGlow();
- }
- } func;
- identical = mSelectedObjects->getSelectedTEValue( &func, lglow );
+ BOOL identical;
+ F32 lglow = 0.f;
+ struct f1 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return object->getTE(face)->getGlow();
+ }
+ } func;
+ identical = mSelectedObjects->getSelectedTEValue( &func, lglow );
- *glow = lglow;
- return identical;
+ *glow = lglow;
+ return identical;
}
void LLSelectMgr::selectionSetPhysicsType(U8 type)
{
- struct f : public LLSelectedObjectFunctor
- {
- U8 mType;
- f(const U8& t) : mType(t) {}
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->setPhysicsShapeType(mType);
- object->updateFlags(TRUE);
- }
- return true;
- }
- } sendfunc(type);
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedObjectFunctor
+ {
+ U8 mType;
+ f(const U8& t) : mType(t) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsShapeType(mType);
+ object->updateFlags(TRUE);
+ }
+ return true;
+ }
+ } sendfunc(type);
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetFriction(F32 friction)
{
- struct f : public LLSelectedObjectFunctor
- {
- F32 mFriction;
- f(const F32& friction) : mFriction(friction) {}
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->setPhysicsFriction(mFriction);
- object->updateFlags(TRUE);
- }
- return true;
- }
- } sendfunc(friction);
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedObjectFunctor
+ {
+ F32 mFriction;
+ f(const F32& friction) : mFriction(friction) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsFriction(mFriction);
+ object->updateFlags(TRUE);
+ }
+ return true;
+ }
+ } sendfunc(friction);
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetGravity(F32 gravity )
{
- struct f : public LLSelectedObjectFunctor
- {
- F32 mGravity;
- f(const F32& gravity) : mGravity(gravity) {}
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->setPhysicsGravity(mGravity);
- object->updateFlags(TRUE);
- }
- return true;
- }
- } sendfunc(gravity);
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedObjectFunctor
+ {
+ F32 mGravity;
+ f(const F32& gravity) : mGravity(gravity) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsGravity(mGravity);
+ object->updateFlags(TRUE);
+ }
+ return true;
+ }
+ } sendfunc(gravity);
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetDensity(F32 density )
{
- struct f : public LLSelectedObjectFunctor
- {
- F32 mDensity;
- f(const F32& density ) : mDensity(density) {}
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->setPhysicsDensity(mDensity);
- object->updateFlags(TRUE);
- }
- return true;
- }
- } sendfunc(density);
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedObjectFunctor
+ {
+ F32 mDensity;
+ f(const F32& density ) : mDensity(density) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsDensity(mDensity);
+ object->updateFlags(TRUE);
+ }
+ return true;
+ }
+ } sendfunc(density);
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetRestitution(F32 restitution)
{
- struct f : public LLSelectedObjectFunctor
- {
- F32 mRestitution;
- f(const F32& restitution ) : mRestitution(restitution) {}
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->setPhysicsRestitution(mRestitution);
- object->updateFlags(TRUE);
- }
- return true;
- }
- } sendfunc(restitution);
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedObjectFunctor
+ {
+ F32 mRestitution;
+ f(const F32& restitution ) : mRestitution(restitution) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsRestitution(mRestitution);
+ object->updateFlags(TRUE);
+ }
+ return true;
+ }
+ } sendfunc(restitution);
+ getSelection()->applyToObjects(&sendfunc);
}
@@ -2757,136 +2757,136 @@ void LLSelectMgr::selectionSetRestitution(F32 restitution)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionSetMaterial(U8 material)
{
- struct f : public LLSelectedObjectFunctor
- {
- U8 mMaterial;
- f(const U8& t) : mMaterial(t) {}
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- U8 cur_material = object->getMaterial();
- U8 material = mMaterial | (cur_material & ~LL_MCODE_MASK);
- object->setMaterial(material);
- object->sendMaterialUpdate();
- }
- return true;
- }
- } sendfunc(material);
- getSelection()->applyToObjects(&sendfunc);
+ struct f : public LLSelectedObjectFunctor
+ {
+ U8 mMaterial;
+ f(const U8& t) : mMaterial(t) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ U8 cur_material = object->getMaterial();
+ U8 material = mMaterial | (cur_material & ~LL_MCODE_MASK);
+ object->setMaterial(material);
+ object->sendMaterialUpdate();
+ }
+ return true;
+ }
+ } sendfunc(material);
+ getSelection()->applyToObjects(&sendfunc);
}
// TRUE if all selected objects have this PCode
BOOL LLSelectMgr::selectionAllPCode(LLPCode code)
{
- struct f : public LLSelectedObjectFunctor
- {
- LLPCode mCode;
- f(const LLPCode& t) : mCode(t) {}
- virtual bool apply(LLViewerObject* object)
- {
- if (object->getPCode() != mCode)
- {
- return FALSE;
- }
- return true;
- }
- } func(code);
- BOOL res = getSelection()->applyToObjects(&func);
- return res;
+ struct f : public LLSelectedObjectFunctor
+ {
+ LLPCode mCode;
+ f(const LLPCode& t) : mCode(t) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->getPCode() != mCode)
+ {
+ return FALSE;
+ }
+ return true;
+ }
+ } func(code);
+ BOOL res = getSelection()->applyToObjects(&func);
+ return res;
}
bool LLSelectMgr::selectionGetIncludeInSearch(bool* include_in_search_out)
{
- LLViewerObject *object = mSelectedObjects->getFirstRootObject();
- if (!object) return FALSE;
+ LLViewerObject *object = mSelectedObjects->getFirstRootObject();
+ if (!object) return FALSE;
- bool include_in_search = object->getIncludeInSearch();
+ bool include_in_search = object->getIncludeInSearch();
- bool identical = true;
+ bool identical = true;
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++)
- {
- LLViewerObject* object = (*iter)->getObject();
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
+ {
+ LLViewerObject* object = (*iter)->getObject();
- if ( include_in_search != object->getIncludeInSearch())
- {
- identical = false;
- break;
- }
- }
+ if ( include_in_search != object->getIncludeInSearch())
+ {
+ identical = false;
+ break;
+ }
+ }
- *include_in_search_out = include_in_search;
- return identical;
+ *include_in_search_out = include_in_search;
+ return identical;
}
void LLSelectMgr::selectionSetIncludeInSearch(bool include_in_search)
{
- LLViewerObject* object = NULL;
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++)
- {
- object = (*iter)->getObject();
- object->setIncludeInSearch(include_in_search);
- }
- sendListToRegions(
- "ObjectIncludeInSearch",
- packAgentAndSessionID,
- packObjectIncludeInSearch,
+ LLViewerObject* object = NULL;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
+ {
+ object = (*iter)->getObject();
+ object->setIncludeInSearch(include_in_search);
+ }
+ sendListToRegions(
+ "ObjectIncludeInSearch",
+ packAgentAndSessionID,
+ packObjectIncludeInSearch,
logNoOp,
- &include_in_search,
- SEND_ONLY_ROOTS);
+ &include_in_search,
+ SEND_ONLY_ROOTS);
}
BOOL LLSelectMgr::selectionGetClickAction(U8 *out_action)
{
- LLViewerObject *object = mSelectedObjects->getFirstObject();
- if (!object)
- {
- return FALSE;
- }
-
- U8 action = object->getClickAction();
- *out_action = action;
-
- struct f : public LLSelectedObjectFunctor
- {
- U8 mAction;
- f(const U8& t) : mAction(t) {}
- virtual bool apply(LLViewerObject* object)
- {
- if ( mAction != object->getClickAction())
- {
- return false;
- }
- return true;
- }
- } func(action);
- BOOL res = getSelection()->applyToObjects(&func);
- return res;
+ LLViewerObject *object = mSelectedObjects->getFirstObject();
+ if (!object)
+ {
+ return FALSE;
+ }
+
+ U8 action = object->getClickAction();
+ *out_action = action;
+
+ struct f : public LLSelectedObjectFunctor
+ {
+ U8 mAction;
+ f(const U8& t) : mAction(t) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if ( mAction != object->getClickAction())
+ {
+ return false;
+ }
+ return true;
+ }
+ } func(action);
+ BOOL res = getSelection()->applyToObjects(&func);
+ return res;
}
void LLSelectMgr::selectionSetClickAction(U8 action)
{
- struct f : public LLSelectedObjectFunctor
- {
- U8 mAction;
- f(const U8& t) : mAction(t) {}
- virtual bool apply(LLViewerObject* object)
- {
- object->setClickAction(mAction);
- return true;
- }
- } func(action);
- getSelection()->applyToObjects(&func);
-
- sendListToRegions("ObjectClickAction",
- packAgentAndSessionID,
- packObjectClickAction,
+ struct f : public LLSelectedObjectFunctor
+ {
+ U8 mAction;
+ f(const U8& t) : mAction(t) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ object->setClickAction(mAction);
+ return true;
+ }
+ } func(action);
+ getSelection()->applyToObjects(&func);
+
+ sendListToRegions("ObjectClickAction",
+ packAgentAndSessionID,
+ packObjectClickAction,
logNoOp,
- &action,
- SEND_INDIVIDUALS);
+ &action,
+ SEND_INDIVIDUALS);
}
@@ -2898,54 +2898,54 @@ typedef std::pair<const std::string, const std::string> godlike_request_t;
void LLSelectMgr::sendGodlikeRequest(const std::string& request, const std::string& param)
{
- // If the agent is neither godlike nor an estate owner, the server
- // will reject the request.
- std::string message_type;
- if (gAgent.isGodlike())
- {
- message_type = "GodlikeMessage";
- }
- else
- {
- message_type = "EstateOwnerMessage";
- }
-
- godlike_request_t data(request, param);
- if(!mSelectedObjects->getRootObjectCount())
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage(message_type.c_str());
- LLSelectMgr::packGodlikeHead(&data);
- gAgent.sendReliableMessage();
- }
- else
- {
- sendListToRegions(message_type, packGodlikeHead, packObjectIDAsParam, logNoOp, &data, SEND_ONLY_ROOTS);
- }
+ // If the agent is neither godlike nor an estate owner, the server
+ // will reject the request.
+ std::string message_type;
+ if (gAgent.isGodlike())
+ {
+ message_type = "GodlikeMessage";
+ }
+ else
+ {
+ message_type = "EstateOwnerMessage";
+ }
+
+ godlike_request_t data(request, param);
+ if(!mSelectedObjects->getRootObjectCount())
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage(message_type.c_str());
+ LLSelectMgr::packGodlikeHead(&data);
+ gAgent.sendReliableMessage();
+ }
+ else
+ {
+ sendListToRegions(message_type, packGodlikeHead, packObjectIDAsParam, logNoOp, &data, SEND_ONLY_ROOTS);
+ }
}
void LLSelectMgr::packGodlikeHead(void* user_data)
{
- LLMessageSystem* msg = gMessageSystem;
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUID("TransactionID", LLUUID::null);
- godlike_request_t* data = (godlike_request_t*)user_data;
- msg->nextBlock("MethodData");
- msg->addString("Method", data->first);
- msg->addUUID("Invoice", LLUUID::null);
-
- // The parameters used to be restricted to either string or
- // integer. This mimics that behavior under the new 'string-only'
- // parameter list by not packing a string if there wasn't one
- // specified. The object ids will be packed in the
- // packObjectIDAsParam() method.
- if(data->second.size() > 0)
- {
- msg->nextBlock("ParamList");
- msg->addString("Parameter", data->second);
- }
+ LLMessageSystem* msg = gMessageSystem;
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUID("TransactionID", LLUUID::null);
+ godlike_request_t* data = (godlike_request_t*)user_data;
+ msg->nextBlock("MethodData");
+ msg->addString("Method", data->first);
+ msg->addUUID("Invoice", LLUUID::null);
+
+ // The parameters used to be restricted to either string or
+ // integer. This mimics that behavior under the new 'string-only'
+ // parameter list by not packing a string if there wasn't one
+ // specified. The object ids will be packed in the
+ // packObjectIDAsParam() method.
+ if(data->second.size() > 0)
+ {
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", data->second);
+ }
}
// static
@@ -2968,9 +2968,9 @@ void LLSelectMgr::logDetachRequest(LLSelectNode* node, void *)
// static
void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *)
{
- std::string buf = llformat("%u", node->getObject()->getLocalID());
- gMessageSystem->nextBlock("ParamList");
- gMessageSystem->addString("Parameter", buf);
+ std::string buf = llformat("%u", node->getObject()->getLocalID());
+ gMessageSystem->nextBlock("ParamList");
+ gMessageSystem->addString("Parameter", buf);
}
//-----------------------------------------------------------------------------
@@ -2978,34 +2978,34 @@ void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter)
{
- struct f : public LLSelectedTEFunctor
- {
- F32 mRepeatsPerMeter;
- f(const F32& t) : mRepeatsPerMeter(t) {}
- bool apply(LLViewerObject* object, S32 te)
- {
-
- if (object->permModify())
- {
- // Compute S,T to axis mapping
- U32 s_axis, t_axis;
- if (!LLPrimitive::getTESTAxes(te, &s_axis, &t_axis))
- {
- return TRUE;
- }
+ struct f : public LLSelectedTEFunctor
+ {
+ F32 mRepeatsPerMeter;
+ f(const F32& t) : mRepeatsPerMeter(t) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
- F32 new_s = object->getScale().mV[s_axis] * mRepeatsPerMeter;
- F32 new_t = object->getScale().mV[t_axis] * mRepeatsPerMeter;
+ if (object->permModify())
+ {
+ // Compute S,T to axis mapping
+ U32 s_axis, t_axis;
+ if (!LLPrimitive::getTESTAxes(te, &s_axis, &t_axis))
+ {
+ return TRUE;
+ }
- object->setTEScale(te, new_s, new_t);
- }
- return true;
- }
- } setfunc(repeats_per_meter);
- getSelection()->applyToTEs(&setfunc);
+ F32 new_s = object->getScale().mV[s_axis] * mRepeatsPerMeter;
+ F32 new_t = object->getScale().mV[t_axis] * mRepeatsPerMeter;
- LLSelectMgrSendFunctor sendfunc;
- getSelection()->applyToObjects(&sendfunc);
+ object->setTEScale(te, new_s, new_t);
+ }
+ return true;
+ }
+ } setfunc(repeats_per_meter);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
@@ -3018,113 +3018,113 @@ void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter)
//-----------------------------------------------------------------------------
void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++)
- {
- LLSelectNode* selectNode = *iter;
- LLViewerObject* object = selectNode->getObject();
-
- if (!object)
- {
- continue;
- }
-
- if (!object->permModify())
- {
- continue;
- }
-
- if (object->getNumTEs() == 0)
- {
- continue;
- }
-
- BOOL send = FALSE;
-
- for (U8 te_num = 0; te_num < object->getNumTEs(); te_num++)
- {
- const LLTextureEntry* tep = object->getTE(te_num);
-
- BOOL planar = tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR;
- if (planar == stretch)
- {
- // Figure out how S,T changed with scale operation
- U32 s_axis, t_axis;
- if (!LLPrimitive::getTESTAxes(te_num, &s_axis, &t_axis))
- {
- continue;
- }
-
- LLVector3 object_scale = object->getScale();
- LLVector3 diffuse_scale_ratio = selectNode->mTextureScaleRatios[te_num];
-
- // We like these to track together. NORSPEC-96
- //
- LLVector3 normal_scale_ratio = diffuse_scale_ratio;
- LLVector3 specular_scale_ratio = diffuse_scale_ratio;
-
- // Apply new scale to face
- if (planar)
- {
- F32 diffuse_scale_s = diffuse_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
- F32 diffuse_scale_t = diffuse_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
-
- F32 normal_scale_s = normal_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
- F32 normal_scale_t = normal_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
-
- F32 specular_scale_s = specular_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
- F32 specular_scale_t = specular_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
-
- object->setTEScale(te_num, diffuse_scale_s, diffuse_scale_t);
-
- LLTextureEntry* tep = object->getTE(te_num);
-
- if (tep && !tep->getMaterialParams().isNull())
- {
- LLMaterialPtr orig = tep->getMaterialParams();
- LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
- p->setNormalRepeat(normal_scale_s, normal_scale_t);
- p->setSpecularRepeat(specular_scale_s, specular_scale_t);
-
- LLMaterialMgr::getInstance()->put(object->getID(), te_num, *p);
- }
- }
- else
- {
-
- F32 diffuse_scale_s = diffuse_scale_ratio.mV[s_axis]*object_scale.mV[s_axis];
- F32 diffuse_scale_t = diffuse_scale_ratio.mV[t_axis]*object_scale.mV[t_axis];
-
- F32 normal_scale_s = normal_scale_ratio.mV[s_axis]*object_scale.mV[s_axis];
- F32 normal_scale_t = normal_scale_ratio.mV[t_axis]*object_scale.mV[t_axis];
-
- F32 specular_scale_s = specular_scale_ratio.mV[s_axis]*object_scale.mV[s_axis];
- F32 specular_scale_t = specular_scale_ratio.mV[t_axis]*object_scale.mV[t_axis];
-
- object->setTEScale(te_num, diffuse_scale_s,diffuse_scale_t);
-
- LLTextureEntry* tep = object->getTE(te_num);
-
- if (tep && !tep->getMaterialParams().isNull())
- {
- LLMaterialPtr orig = tep->getMaterialParams();
- LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
-
- p->setNormalRepeat(normal_scale_s, normal_scale_t);
- p->setSpecularRepeat(specular_scale_s, specular_scale_t);
-
- LLMaterialMgr::getInstance()->put(object->getID(), te_num, *p);
- }
- }
- send = send_to_sim;
- }
- }
-
- if (send)
- {
- object->sendTEUpdate();
- }
- }
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++)
+ {
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* object = selectNode->getObject();
+
+ if (!object)
+ {
+ continue;
+ }
+
+ if (!object->permModify())
+ {
+ continue;
+ }
+
+ if (object->getNumTEs() == 0)
+ {
+ continue;
+ }
+
+ BOOL send = FALSE;
+
+ for (U8 te_num = 0; te_num < object->getNumTEs(); te_num++)
+ {
+ const LLTextureEntry* tep = object->getTE(te_num);
+
+ BOOL planar = tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR;
+ if (planar == stretch)
+ {
+ // Figure out how S,T changed with scale operation
+ U32 s_axis, t_axis;
+ if (!LLPrimitive::getTESTAxes(te_num, &s_axis, &t_axis))
+ {
+ continue;
+ }
+
+ LLVector3 object_scale = object->getScale();
+ LLVector3 diffuse_scale_ratio = selectNode->mTextureScaleRatios[te_num];
+
+ // We like these to track together. NORSPEC-96
+ //
+ LLVector3 normal_scale_ratio = diffuse_scale_ratio;
+ LLVector3 specular_scale_ratio = diffuse_scale_ratio;
+
+ // Apply new scale to face
+ if (planar)
+ {
+ F32 diffuse_scale_s = diffuse_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
+ F32 diffuse_scale_t = diffuse_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
+
+ F32 normal_scale_s = normal_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
+ F32 normal_scale_t = normal_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
+
+ F32 specular_scale_s = specular_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
+ F32 specular_scale_t = specular_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
+
+ object->setTEScale(te_num, diffuse_scale_s, diffuse_scale_t);
+
+ LLTextureEntry* tep = object->getTE(te_num);
+
+ if (tep && !tep->getMaterialParams().isNull())
+ {
+ LLMaterialPtr orig = tep->getMaterialParams();
+ LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
+ p->setNormalRepeat(normal_scale_s, normal_scale_t);
+ p->setSpecularRepeat(specular_scale_s, specular_scale_t);
+
+ LLMaterialMgr::getInstance()->put(object->getID(), te_num, *p);
+ }
+ }
+ else
+ {
+
+ F32 diffuse_scale_s = diffuse_scale_ratio.mV[s_axis]*object_scale.mV[s_axis];
+ F32 diffuse_scale_t = diffuse_scale_ratio.mV[t_axis]*object_scale.mV[t_axis];
+
+ F32 normal_scale_s = normal_scale_ratio.mV[s_axis]*object_scale.mV[s_axis];
+ F32 normal_scale_t = normal_scale_ratio.mV[t_axis]*object_scale.mV[t_axis];
+
+ F32 specular_scale_s = specular_scale_ratio.mV[s_axis]*object_scale.mV[s_axis];
+ F32 specular_scale_t = specular_scale_ratio.mV[t_axis]*object_scale.mV[t_axis];
+
+ object->setTEScale(te_num, diffuse_scale_s,diffuse_scale_t);
+
+ LLTextureEntry* tep = object->getTE(te_num);
+
+ if (tep && !tep->getMaterialParams().isNull())
+ {
+ LLMaterialPtr orig = tep->getMaterialParams();
+ LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
+
+ p->setNormalRepeat(normal_scale_s, normal_scale_t);
+ p->setSpecularRepeat(specular_scale_s, specular_scale_t);
+
+ LLMaterialMgr::getInstance()->put(object->getID(), te_num, *p);
+ }
+ }
+ send = send_to_sim;
+ }
+ }
+
+ if (send)
+ {
+ object->sendTEUpdate();
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -3133,16 +3133,16 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetAllRootsValid()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); ++iter )
- {
- LLSelectNode* node = *iter;
- if( !node->mValid )
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); ++iter )
+ {
+ LLSelectNode* node = *iter;
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
@@ -3152,16 +3152,16 @@ BOOL LLSelectMgr::selectGetAllRootsValid()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetAllValid()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); ++iter )
- {
- LLSelectNode* node = *iter;
- if( !node->mValid )
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); ++iter )
+ {
+ LLSelectNode* node = *iter;
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3172,17 +3172,17 @@ BOOL LLSelectMgr::selectGetAllValid()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetAllValidAndObjectsFound()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3191,21 +3191,21 @@ BOOL LLSelectMgr::selectGetAllValidAndObjectsFound()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetModify()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- if( !object->permModify() )
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ if( !object->permModify() )
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3214,22 +3214,22 @@ BOOL LLSelectMgr::selectGetModify()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsModify()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !node->mValid )
- {
- return FALSE;
- }
- if( !object->permModify() )
- {
- return FALSE;
- }
- }
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ if( !object->permModify() )
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3268,21 +3268,21 @@ BOOL LLSelectMgr::selectGetSameRegion()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetNonPermanentEnforced()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- if( object->isPermanentEnforced())
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ if( object->isPermanentEnforced())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3291,22 +3291,22 @@ BOOL LLSelectMgr::selectGetNonPermanentEnforced()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsNonPermanentEnforced()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !node->mValid )
- {
- return FALSE;
- }
- if( object->isPermanentEnforced())
- {
- return FALSE;
- }
- }
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ if( object->isPermanentEnforced())
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3314,21 +3314,21 @@ BOOL LLSelectMgr::selectGetRootsNonPermanentEnforced()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetPermanent()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- if( !object->flagObjectPermanent())
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ if( !object->flagObjectPermanent())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3337,22 +3337,22 @@ BOOL LLSelectMgr::selectGetPermanent()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsPermanent()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !node->mValid )
- {
- return FALSE;
- }
- if( !object->flagObjectPermanent())
- {
- return FALSE;
- }
- }
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ if( !object->flagObjectPermanent())
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3360,21 +3360,21 @@ BOOL LLSelectMgr::selectGetRootsPermanent()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetCharacter()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- if( !object->flagCharacter())
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ if( !object->flagCharacter())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3383,22 +3383,22 @@ BOOL LLSelectMgr::selectGetCharacter()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsCharacter()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !node->mValid )
- {
- return FALSE;
- }
- if( !object->flagCharacter())
- {
- return FALSE;
- }
- }
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ if( !object->flagCharacter())
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3406,21 +3406,21 @@ BOOL LLSelectMgr::selectGetRootsCharacter()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetNonPathfinding()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- if( object->flagObjectPermanent() || object->flagCharacter())
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ if( object->flagObjectPermanent() || object->flagCharacter())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3429,22 +3429,22 @@ BOOL LLSelectMgr::selectGetNonPathfinding()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsNonPathfinding()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !node->mValid )
- {
- return FALSE;
- }
- if( object->flagObjectPermanent() || object->flagCharacter())
- {
- return FALSE;
- }
- }
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ if( object->flagObjectPermanent() || object->flagCharacter())
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3452,21 +3452,21 @@ BOOL LLSelectMgr::selectGetRootsNonPathfinding()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetNonPermanent()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- if( object->flagObjectPermanent())
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ if( object->flagObjectPermanent())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3475,22 +3475,22 @@ BOOL LLSelectMgr::selectGetNonPermanent()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsNonPermanent()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !node->mValid )
- {
- return FALSE;
- }
- if( object->flagObjectPermanent())
- {
- return FALSE;
- }
- }
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ if( object->flagObjectPermanent())
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3498,45 +3498,45 @@ BOOL LLSelectMgr::selectGetRootsNonPermanent()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetNonCharacter()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- if( object->flagCharacter())
- {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-//-----------------------------------------------------------------------------
-// selectGetRootsNonCharacter() - return TRUE if all root objects are not
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ if( object->flagCharacter())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+//-----------------------------------------------------------------------------
+// selectGetRootsNonCharacter() - return TRUE if all root objects are not
// character
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsNonCharacter()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !node->mValid )
- {
- return FALSE;
- }
- if( object->flagCharacter())
- {
- return FALSE;
- }
- }
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ if( object->flagCharacter())
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
@@ -3546,30 +3546,30 @@ BOOL LLSelectMgr::selectGetRootsNonCharacter()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetEditableLinksets()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- if (object->flagUsePhysics() ||
- object->flagTemporaryOnRez() ||
- object->flagCharacter() ||
- object->flagVolumeDetect() ||
- object->flagAnimSource() ||
- (object->getRegion() != gAgent.getRegion()) ||
- (!gAgent.isGodlike() &&
- !gAgent.canManageEstate() &&
- !object->permYouOwner() &&
- !object->permMove()))
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ if (object->flagUsePhysics() ||
+ object->flagTemporaryOnRez() ||
+ object->flagCharacter() ||
+ object->flagVolumeDetect() ||
+ object->flagAnimSource() ||
+ (object->getRegion() != gAgent.getRegion()) ||
+ (!gAgent.isGodlike() &&
+ !gAgent.canManageEstate() &&
+ !object->permYouOwner() &&
+ !object->permMove()))
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3578,22 +3578,22 @@ BOOL LLSelectMgr::selectGetEditableLinksets()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetViewableCharacters()
{
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !object || !node->mValid )
- {
- return FALSE;
- }
- if( !object->flagCharacter() ||
- (object->getRegion() != gAgent.getRegion()))
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !object || !node->mValid )
+ {
+ return FALSE;
+ }
+ if( !object->flagCharacter() ||
+ (object->getRegion() != gAgent.getRegion()))
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3602,21 +3602,21 @@ BOOL LLSelectMgr::selectGetViewableCharacters()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsTransfer()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !node->mValid )
- {
- return FALSE;
- }
- if(!object->permTransfer())
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ if(!object->permTransfer())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -3625,88 +3625,88 @@ BOOL LLSelectMgr::selectGetRootsTransfer()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsCopy()
{
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if( !node->mValid )
- {
- return FALSE;
- }
- if(!object->permCopy())
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
+ {
+ return FALSE;
+ }
+ if(!object->permCopy())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
struct LLSelectGetFirstTest
{
- LLSelectGetFirstTest() : mIdentical(true), mFirst(true) { }
- virtual ~LLSelectGetFirstTest() { }
-
- // returns false to break out of the iteration.
- bool checkMatchingNode(LLSelectNode* node)
- {
- if (!node || !node->mValid)
- {
- return false;
- }
-
- if (mFirst)
- {
- mFirstValue = getValueFromNode(node);
- mFirst = false;
- }
- else
- {
- if ( mFirstValue != getValueFromNode(node) )
- {
- mIdentical = false;
- // stop testing once we know not all selected are identical.
- return false;
- }
- }
- // continue testing.
- return true;
- }
-
- bool mIdentical;
- LLUUID mFirstValue;
+ LLSelectGetFirstTest() : mIdentical(true), mFirst(true) { }
+ virtual ~LLSelectGetFirstTest() { }
+
+ // returns false to break out of the iteration.
+ bool checkMatchingNode(LLSelectNode* node)
+ {
+ if (!node || !node->mValid)
+ {
+ return false;
+ }
+
+ if (mFirst)
+ {
+ mFirstValue = getValueFromNode(node);
+ mFirst = false;
+ }
+ else
+ {
+ if ( mFirstValue != getValueFromNode(node) )
+ {
+ mIdentical = false;
+ // stop testing once we know not all selected are identical.
+ return false;
+ }
+ }
+ // continue testing.
+ return true;
+ }
+
+ bool mIdentical;
+ LLUUID mFirstValue;
protected:
- virtual const LLUUID& getValueFromNode(LLSelectNode* node) = 0;
+ virtual const LLUUID& getValueFromNode(LLSelectNode* node) = 0;
private:
- bool mFirst;
+ bool mFirst;
};
void LLSelectMgr::getFirst(LLSelectGetFirstTest* test)
{
- if (gSavedSettings.getBOOL("EditLinkedParts"))
- {
- for (LLObjectSelection::valid_iterator iter = getSelection()->valid_begin();
- iter != getSelection()->valid_end(); ++iter )
- {
- if (!test->checkMatchingNode(*iter))
- {
- break;
- }
- }
- }
- else
- {
- for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
- iter != getSelection()->root_object_end(); ++iter )
- {
- if (!test->checkMatchingNode(*iter))
- {
- break;
- }
- }
- }
+ if (gSavedSettings.getBOOL("EditLinkedParts"))
+ {
+ for (LLObjectSelection::valid_iterator iter = getSelection()->valid_begin();
+ iter != getSelection()->valid_end(); ++iter )
+ {
+ if (!test->checkMatchingNode(*iter))
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
+ iter != getSelection()->root_object_end(); ++iter )
+ {
+ if (!test->checkMatchingNode(*iter))
+ {
+ break;
+ }
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -3716,35 +3716,35 @@ void LLSelectMgr::getFirst(LLSelectGetFirstTest* test)
struct LLSelectGetFirstCreator : public LLSelectGetFirstTest
{
protected:
- virtual const LLUUID& getValueFromNode(LLSelectNode* node)
- {
- return node->mPermissions->getCreator();
- }
+ virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+ {
+ return node->mPermissions->getCreator();
+ }
};
BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
{
- LLSelectGetFirstCreator test;
- getFirst(&test);
+ LLSelectGetFirstCreator test;
+ getFirst(&test);
+
+ if (test.mFirstValue.isNull())
+ {
+ name = LLTrans::getString("AvatarNameNobody");
+ return FALSE;
+ }
+
+ result_id = test.mFirstValue;
- if (test.mFirstValue.isNull())
- {
- name = LLTrans::getString("AvatarNameNobody");
- return FALSE;
- }
-
- result_id = test.mFirstValue;
-
- if (test.mIdentical)
- {
- name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
- }
- else
- {
- name = LLTrans::getString("AvatarNameMultiple");
- }
+ if (test.mIdentical)
+ {
+ name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
+ }
+ else
+ {
+ name = LLTrans::getString("AvatarNameMultiple");
+ }
- return test.mIdentical;
+ return test.mIdentical;
}
//-----------------------------------------------------------------------------
@@ -3754,44 +3754,44 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
struct LLSelectGetFirstOwner : public LLSelectGetFirstTest
{
protected:
- virtual const LLUUID& getValueFromNode(LLSelectNode* node)
- {
- // Don't use 'getOwnership' since we return a reference, not a copy.
- // Will return LLUUID::null if unowned (which is not allowed and should never happen.)
- return node->mPermissions->isGroupOwned() ? node->mPermissions->getGroup() : node->mPermissions->getOwner();
- }
+ virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+ {
+ // Don't use 'getOwnership' since we return a reference, not a copy.
+ // Will return LLUUID::null if unowned (which is not allowed and should never happen.)
+ return node->mPermissions->isGroupOwned() ? node->mPermissions->getGroup() : node->mPermissions->getOwner();
+ }
};
BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
{
- LLSelectGetFirstOwner test;
- getFirst(&test);
-
- if (test.mFirstValue.isNull())
- {
- return FALSE;
- }
-
- result_id = test.mFirstValue;
-
- if (test.mIdentical)
- {
- bool group_owned = selectIsGroupOwned();
- if (group_owned)
- {
- name = LLSLURL("group", test.mFirstValue, "inspect").getSLURLString();
- }
- else
- {
- name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
- }
- }
- else
- {
- name = LLTrans::getString("AvatarNameMultiple");
- }
-
- return test.mIdentical;
+ LLSelectGetFirstOwner test;
+ getFirst(&test);
+
+ if (test.mFirstValue.isNull())
+ {
+ return FALSE;
+ }
+
+ result_id = test.mFirstValue;
+
+ if (test.mIdentical)
+ {
+ bool group_owned = selectIsGroupOwned();
+ if (group_owned)
+ {
+ name = LLSLURL("group", test.mFirstValue, "inspect").getSLURLString();
+ }
+ else
+ {
+ name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
+ }
+ }
+ else
+ {
+ name = LLTrans::getString("AvatarNameMultiple");
+ }
+
+ return test.mIdentical;
}
//-----------------------------------------------------------------------------
@@ -3801,34 +3801,34 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
struct LLSelectGetFirstLastOwner : public LLSelectGetFirstTest
{
protected:
- virtual const LLUUID& getValueFromNode(LLSelectNode* node)
- {
- return node->mPermissions->getLastOwner();
- }
+ virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+ {
+ return node->mPermissions->getLastOwner();
+ }
};
BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
{
- LLSelectGetFirstLastOwner test;
- getFirst(&test);
+ LLSelectGetFirstLastOwner test;
+ getFirst(&test);
- if (test.mFirstValue.isNull())
- {
- return FALSE;
- }
+ if (test.mFirstValue.isNull())
+ {
+ return FALSE;
+ }
+
+ result_id = test.mFirstValue;
- result_id = test.mFirstValue;
-
- if (test.mIdentical)
- {
- name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
- }
- else
- {
- name.assign( "" );
- }
+ if (test.mIdentical)
+ {
+ name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
+ }
+ else
+ {
+ name.assign( "" );
+ }
- return test.mIdentical;
+ return test.mIdentical;
}
//-----------------------------------------------------------------------------
@@ -3838,45 +3838,45 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
struct LLSelectGetFirstGroup : public LLSelectGetFirstTest
{
protected:
- virtual const LLUUID& getValueFromNode(LLSelectNode* node)
- {
- return node->mPermissions->getGroup();
- }
+ virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+ {
+ return node->mPermissions->getGroup();
+ }
};
BOOL LLSelectMgr::selectGetGroup(LLUUID& result_id)
{
- LLSelectGetFirstGroup test;
- getFirst(&test);
+ LLSelectGetFirstGroup test;
+ getFirst(&test);
- result_id = test.mFirstValue;
- return test.mIdentical;
+ result_id = test.mFirstValue;
+ return test.mIdentical;
}
//-----------------------------------------------------------------------------
// selectIsGroupOwned()
-// Only operates on root nodes unless editing linked parts.
+// Only operates on root nodes unless editing linked parts.
// Returns TRUE if the first selected is group owned.
//-----------------------------------------------------------------------------
struct LLSelectGetFirstGroupOwner : public LLSelectGetFirstTest
{
protected:
- virtual const LLUUID& getValueFromNode(LLSelectNode* node)
- {
- if (node->mPermissions->isGroupOwned())
- {
- return node->mPermissions->getGroup();
- }
- return LLUUID::null;
- }
+ virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+ {
+ if (node->mPermissions->isGroupOwned())
+ {
+ return node->mPermissions->getGroup();
+ }
+ return LLUUID::null;
+ }
};
BOOL LLSelectMgr::selectIsGroupOwned()
{
- LLSelectGetFirstGroupOwner test;
- getFirst(&test);
+ LLSelectGetFirstGroupOwner test;
+ getFirst(&test);
- return test.mFirstValue.notNull() ? TRUE : FALSE;
+ return test.mFirstValue.notNull() ? TRUE : FALSE;
}
//-----------------------------------------------------------------------------
@@ -3890,255 +3890,255 @@ BOOL LLSelectMgr::selectIsGroupOwned()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off)
{
- U32 mask;
- U32 mask_and = 0xffffffff;
- U32 mask_or = 0x00000000;
- BOOL all_valid = FALSE;
-
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++)
- {
- LLSelectNode* node = *iter;
-
- if (!node->mValid)
- {
- all_valid = FALSE;
- break;
- }
-
- all_valid = TRUE;
-
- switch( which_perm )
- {
- case PERM_BASE:
- mask = node->mPermissions->getMaskBase();
- break;
- case PERM_OWNER:
- mask = node->mPermissions->getMaskOwner();
- break;
- case PERM_GROUP:
- mask = node->mPermissions->getMaskGroup();
- break;
- case PERM_EVERYONE:
- mask = node->mPermissions->getMaskEveryone();
- break;
- case PERM_NEXT_OWNER:
- mask = node->mPermissions->getMaskNextOwner();
- break;
- default:
- mask = 0x0;
- break;
- }
- mask_and &= mask;
- mask_or |= mask;
- }
-
- if (all_valid)
- {
- // ...TRUE through all ANDs means all TRUE
- *mask_on = mask_and;
-
- // ...FALSE through all ORs means all FALSE
- *mask_off = ~mask_or;
- return TRUE;
- }
- else
- {
- *mask_on = 0;
- *mask_off = 0;
- return FALSE;
- }
+ U32 mask;
+ U32 mask_and = 0xffffffff;
+ U32 mask_or = 0x00000000;
+ BOOL all_valid = FALSE;
+
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+
+ if (!node->mValid)
+ {
+ all_valid = FALSE;
+ break;
+ }
+
+ all_valid = TRUE;
+
+ switch( which_perm )
+ {
+ case PERM_BASE:
+ mask = node->mPermissions->getMaskBase();
+ break;
+ case PERM_OWNER:
+ mask = node->mPermissions->getMaskOwner();
+ break;
+ case PERM_GROUP:
+ mask = node->mPermissions->getMaskGroup();
+ break;
+ case PERM_EVERYONE:
+ mask = node->mPermissions->getMaskEveryone();
+ break;
+ case PERM_NEXT_OWNER:
+ mask = node->mPermissions->getMaskNextOwner();
+ break;
+ default:
+ mask = 0x0;
+ break;
+ }
+ mask_and &= mask;
+ mask_or |= mask;
+ }
+
+ if (all_valid)
+ {
+ // ...TRUE through all ANDs means all TRUE
+ *mask_on = mask_and;
+
+ // ...FALSE through all ORs means all FALSE
+ *mask_off = ~mask_or;
+ return TRUE;
+ }
+ else
+ {
+ *mask_on = 0;
+ *mask_off = 0;
+ return FALSE;
+ }
}
BOOL LLSelectMgr::selectGetPermissions(LLPermissions& result_perm)
{
- BOOL first = TRUE;
- LLPermissions perm;
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- if (!node->mValid)
- {
- return FALSE;
- }
+ BOOL first = TRUE;
+ LLPermissions perm;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ if (!node->mValid)
+ {
+ return FALSE;
+ }
- if (first)
- {
- perm = *(node->mPermissions);
- first = FALSE;
- }
- else
- {
- perm.accumulate(*(node->mPermissions));
- }
- }
+ if (first)
+ {
+ perm = *(node->mPermissions);
+ first = FALSE;
+ }
+ else
+ {
+ perm.accumulate(*(node->mPermissions));
+ }
+ }
- result_perm = perm;
+ result_perm = perm;
- return TRUE;
+ return TRUE;
}
void LLSelectMgr::selectDelete()
{
- S32 deleteable_count = 0;
-
- BOOL locked_but_deleteable_object = FALSE;
- BOOL no_copy_but_deleteable_object = FALSE;
- BOOL all_owned_by_you = TRUE;
-
- for (LLObjectSelection::iterator iter = getSelection()->begin();
- iter != getSelection()->end(); iter++)
- {
- LLViewerObject* obj = (*iter)->getObject();
-
- if( obj->isAttachment() )
- {
- continue;
- }
-
- deleteable_count++;
-
- // Check to see if you can delete objects which are locked.
- if(!obj->permMove())
- {
- locked_but_deleteable_object = TRUE;
- }
- if(!obj->permCopy())
- {
- no_copy_but_deleteable_object = TRUE;
- }
- if(!obj->permYouOwner())
- {
- all_owned_by_you = FALSE;
- }
- }
-
- if( 0 == deleteable_count )
- {
- make_ui_sound("UISndInvalidOp");
- return;
- }
-
- LLNotification::Params params("ConfirmObjectDeleteLock");
- params.functor.function(boost::bind(&LLSelectMgr::confirmDelete, _1, _2, getSelection()));
-
- if(locked_but_deleteable_object ||
- no_copy_but_deleteable_object ||
- !all_owned_by_you)
- {
- // convert any transient pie-menu selections to full selection so this operation
- // has some context
- // NOTE: if user cancels delete operation, this will potentially leave objects selected outside of build mode
- // but this is ok, if not ideal
- convertTransient();
-
- //This is messy, but needed to get all english our of the UI.
- if(locked_but_deleteable_object && !no_copy_but_deleteable_object && all_owned_by_you)
- {
- //Locked only
- params.name("ConfirmObjectDeleteLock");
- }
- else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you)
- {
- //No Copy only
- params.name("ConfirmObjectDeleteNoCopy");
- }
- else if(!locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you)
- {
- //not owned only
- params.name("ConfirmObjectDeleteNoOwn");
- }
- else if(locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you)
- {
- //locked and no copy
- params.name("ConfirmObjectDeleteLockNoCopy");
- }
- else if(locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you)
- {
- //locked and not owned
- params.name("ConfirmObjectDeleteLockNoOwn");
- }
- else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && !all_owned_by_you)
- {
- //no copy and not owned
- params.name("ConfirmObjectDeleteNoCopyNoOwn");
- }
- else
- {
- //locked, no copy and not owned
- params.name("ConfirmObjectDeleteLockNoCopyNoOwn");
- }
-
- LLNotifications::instance().add(params);
- }
- else
- {
- LLNotifications::instance().forceResponse(params, 0);
- }
+ S32 deleteable_count = 0;
+
+ BOOL locked_but_deleteable_object = FALSE;
+ BOOL no_copy_but_deleteable_object = FALSE;
+ BOOL all_owned_by_you = TRUE;
+
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++)
+ {
+ LLViewerObject* obj = (*iter)->getObject();
+
+ if( obj->isAttachment() )
+ {
+ continue;
+ }
+
+ deleteable_count++;
+
+ // Check to see if you can delete objects which are locked.
+ if(!obj->permMove())
+ {
+ locked_but_deleteable_object = TRUE;
+ }
+ if(!obj->permCopy())
+ {
+ no_copy_but_deleteable_object = TRUE;
+ }
+ if(!obj->permYouOwner())
+ {
+ all_owned_by_you = FALSE;
+ }
+ }
+
+ if( 0 == deleteable_count )
+ {
+ make_ui_sound("UISndInvalidOp");
+ return;
+ }
+
+ LLNotification::Params params("ConfirmObjectDeleteLock");
+ params.functor.function(boost::bind(&LLSelectMgr::confirmDelete, _1, _2, getSelection()));
+
+ if(locked_but_deleteable_object ||
+ no_copy_but_deleteable_object ||
+ !all_owned_by_you)
+ {
+ // convert any transient pie-menu selections to full selection so this operation
+ // has some context
+ // NOTE: if user cancels delete operation, this will potentially leave objects selected outside of build mode
+ // but this is ok, if not ideal
+ convertTransient();
+
+ //This is messy, but needed to get all english our of the UI.
+ if(locked_but_deleteable_object && !no_copy_but_deleteable_object && all_owned_by_you)
+ {
+ //Locked only
+ params.name("ConfirmObjectDeleteLock");
+ }
+ else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you)
+ {
+ //No Copy only
+ params.name("ConfirmObjectDeleteNoCopy");
+ }
+ else if(!locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you)
+ {
+ //not owned only
+ params.name("ConfirmObjectDeleteNoOwn");
+ }
+ else if(locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you)
+ {
+ //locked and no copy
+ params.name("ConfirmObjectDeleteLockNoCopy");
+ }
+ else if(locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you)
+ {
+ //locked and not owned
+ params.name("ConfirmObjectDeleteLockNoOwn");
+ }
+ else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && !all_owned_by_you)
+ {
+ //no copy and not owned
+ params.name("ConfirmObjectDeleteNoCopyNoOwn");
+ }
+ else
+ {
+ //locked, no copy and not owned
+ params.name("ConfirmObjectDeleteLockNoCopyNoOwn");
+ }
+
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
}
// static
bool LLSelectMgr::confirmDelete(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle handle)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
- if (!handle->getObjectCount())
- {
- LL_WARNS() << "Nothing to delete!" << LL_ENDL;
- return false;
- }
-
- switch(option)
- {
- case 0:
- {
- // TODO: Make sure you have delete permissions on all of them.
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- // attempt to derez into the trash.
- LLDeRezInfo info(DRD_TRASH, trash_id);
- LLSelectMgr::getInstance()->sendListToRegions("DeRezObject",
+ S32 option = LLNotification::getSelectedOption(notification, response);
+ if (!handle->getObjectCount())
+ {
+ LL_WARNS() << "Nothing to delete!" << LL_ENDL;
+ return false;
+ }
+
+ switch(option)
+ {
+ case 0:
+ {
+ // TODO: Make sure you have delete permissions on all of them.
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ // attempt to derez into the trash.
+ LLDeRezInfo info(DRD_TRASH, trash_id);
+ LLSelectMgr::getInstance()->sendListToRegions("DeRezObject",
packDeRezHeader,
packObjectLocalID,
logNoOp,
(void*) &info,
SEND_ONLY_ROOTS);
- // VEFFECT: Delete Object - one effect for all deletes
- if (LLSelectMgr::getInstance()->mSelectedObjects->mSelectType != SELECT_TYPE_HUD)
- {
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
- effectp->setPositionGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal() );
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- F32 duration = 0.5f;
- duration += LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount() / 64.f;
- effectp->setDuration(duration);
- }
-
- gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
-
- // Keep track of how many objects have been deleted.
- add(LLStatViewer::DELETE_OBJECT, LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount());
- }
- break;
- case 1:
- default:
- break;
- }
- return false;
+ // VEFFECT: Delete Object - one effect for all deletes
+ if (LLSelectMgr::getInstance()->mSelectedObjects->mSelectType != SELECT_TYPE_HUD)
+ {
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
+ effectp->setPositionGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal() );
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ F32 duration = 0.5f;
+ duration += LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount() / 64.f;
+ effectp->setDuration(duration);
+ }
+
+ gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
+
+ // Keep track of how many objects have been deleted.
+ add(LLStatViewer::DELETE_OBJECT, LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount());
+ }
+ break;
+ case 1:
+ default:
+ break;
+ }
+ return false;
}
void LLSelectMgr::selectForceDelete()
{
- sendListToRegions(
- "ObjectDelete",
- packDeleteHeader,
- packObjectLocalID,
+ sendListToRegions(
+ "ObjectDelete",
+ packDeleteHeader,
+ packObjectLocalID,
logNoOp,
- (void*)TRUE,
- SEND_ONLY_ROOTS);
+ (void*)TRUE,
+ SEND_ONLY_ROOTS);
}
BOOL LLSelectMgr::selectGetEditMoveLinksetPermissions(bool &move, bool &modify)
@@ -4175,154 +4175,154 @@ BOOL LLSelectMgr::selectGetEditMoveLinksetPermissions(bool &move, bool &modify)
}
void LLSelectMgr::selectGetAggregateSaleInfo(U32 &num_for_sale,
- BOOL &is_for_sale_mixed,
- BOOL &is_sale_price_mixed,
- S32 &total_sale_price,
- S32 &individual_sale_price)
-{
- num_for_sale = 0;
- is_for_sale_mixed = FALSE;
- is_sale_price_mixed = FALSE;
- total_sale_price = 0;
- individual_sale_price = 0;
-
-
- // Empty set.
- if (getSelection()->root_begin() == getSelection()->root_end())
- return;
-
- LLSelectNode *node = *(getSelection()->root_begin());
- const BOOL first_node_for_sale = node->mSaleInfo.isForSale();
- const S32 first_node_sale_price = node->mSaleInfo.getSalePrice();
-
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- const BOOL node_for_sale = node->mSaleInfo.isForSale();
- const S32 node_sale_price = node->mSaleInfo.getSalePrice();
-
- // Set mixed if the fields don't match the first node's fields.
- if (node_for_sale != first_node_for_sale)
- is_for_sale_mixed = TRUE;
- if (node_sale_price != first_node_sale_price)
- is_sale_price_mixed = TRUE;
-
- if (node_for_sale)
- {
- total_sale_price += node_sale_price;
- num_for_sale ++;
- }
- }
-
- individual_sale_price = first_node_sale_price;
- if (is_for_sale_mixed)
- {
- is_sale_price_mixed = TRUE;
- individual_sale_price = 0;
- }
+ BOOL &is_for_sale_mixed,
+ BOOL &is_sale_price_mixed,
+ S32 &total_sale_price,
+ S32 &individual_sale_price)
+{
+ num_for_sale = 0;
+ is_for_sale_mixed = FALSE;
+ is_sale_price_mixed = FALSE;
+ total_sale_price = 0;
+ individual_sale_price = 0;
+
+
+ // Empty set.
+ if (getSelection()->root_begin() == getSelection()->root_end())
+ return;
+
+ LLSelectNode *node = *(getSelection()->root_begin());
+ const BOOL first_node_for_sale = node->mSaleInfo.isForSale();
+ const S32 first_node_sale_price = node->mSaleInfo.getSalePrice();
+
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ const BOOL node_for_sale = node->mSaleInfo.isForSale();
+ const S32 node_sale_price = node->mSaleInfo.getSalePrice();
+
+ // Set mixed if the fields don't match the first node's fields.
+ if (node_for_sale != first_node_for_sale)
+ is_for_sale_mixed = TRUE;
+ if (node_sale_price != first_node_sale_price)
+ is_sale_price_mixed = TRUE;
+
+ if (node_for_sale)
+ {
+ total_sale_price += node_sale_price;
+ num_for_sale ++;
+ }
+ }
+
+ individual_sale_price = first_node_sale_price;
+ if (is_for_sale_mixed)
+ {
+ is_sale_price_mixed = TRUE;
+ individual_sale_price = 0;
+ }
}
// returns TRUE if all nodes are valid. method also stores an
// accumulated sale info.
BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& result_sale_info)
{
- BOOL first = TRUE;
- LLSaleInfo sale_info;
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- if (!node->mValid)
- {
- return FALSE;
- }
-
- if (first)
- {
- sale_info = node->mSaleInfo;
- first = FALSE;
- }
- else
- {
- sale_info.accumulate(node->mSaleInfo);
- }
- }
-
- result_sale_info = sale_info;
-
- return TRUE;
+ BOOL first = TRUE;
+ LLSaleInfo sale_info;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ if (!node->mValid)
+ {
+ return FALSE;
+ }
+
+ if (first)
+ {
+ sale_info = node->mSaleInfo;
+ first = FALSE;
+ }
+ else
+ {
+ sale_info.accumulate(node->mSaleInfo);
+ }
+ }
+
+ result_sale_info = sale_info;
+
+ return TRUE;
}
BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& result_perm)
{
- BOOL first = TRUE;
- LLAggregatePermissions perm;
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- if (!node->mValid)
- {
- return FALSE;
- }
-
- if (first)
- {
- perm = node->mAggregatePerm;
- first = FALSE;
- }
- else
- {
- perm.aggregate(node->mAggregatePerm);
- }
- }
-
- result_perm = perm;
-
- return TRUE;
+ BOOL first = TRUE;
+ LLAggregatePermissions perm;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ if (!node->mValid)
+ {
+ return FALSE;
+ }
+
+ if (first)
+ {
+ perm = node->mAggregatePerm;
+ first = FALSE;
+ }
+ else
+ {
+ perm.aggregate(node->mAggregatePerm);
+ }
+ }
+
+ result_perm = perm;
+
+ return TRUE;
}
BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& result_perm)
{
- BOOL first = TRUE;
- LLAggregatePermissions perm;
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- if (!node->mValid)
- {
- return FALSE;
- }
-
- LLAggregatePermissions t_perm = node->getObject()->permYouOwner() ? node->mAggregateTexturePermOwner : node->mAggregateTexturePerm;
- if (first)
- {
- perm = t_perm;
- first = FALSE;
- }
- else
- {
- perm.aggregate(t_perm);
- }
- }
-
- result_perm = perm;
-
- return TRUE;
+ BOOL first = TRUE;
+ LLAggregatePermissions perm;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ if (!node->mValid)
+ {
+ return FALSE;
+ }
+
+ LLAggregatePermissions t_perm = node->getObject()->permYouOwner() ? node->mAggregateTexturePermOwner : node->mAggregateTexturePerm;
+ if (first)
+ {
+ perm = t_perm;
+ first = FALSE;
+ }
+ else
+ {
+ perm.aggregate(t_perm);
+ }
+ }
+
+ result_perm = perm;
+
+ return TRUE;
}
BOOL LLSelectMgr::isMovableAvatarSelected()
{
- if (mAllowSelectAvatar && getSelection()->getObjectCount() == 1)
- {
+ if (mAllowSelectAvatar && getSelection()->getObjectCount() == 1)
+ {
// nothing but avatar should be selected, so check that
// there is only one selected object and it is a root
LLViewerObject* obj = getSelection()->getFirstRootObject();
- return obj && obj->isAvatar() && getSelection()->getFirstMoveableNode(TRUE);
- }
- return FALSE;
+ return obj && obj->isAvatar() && getSelection()->getFirstMoveableNode(TRUE);
+ }
+ return FALSE;
}
//--------------------------------------------------------------------
@@ -4334,119 +4334,119 @@ BOOL LLSelectMgr::isMovableAvatarSelected()
// messages.
struct LLDuplicateData
{
- LLVector3 offset;
- U32 flags;
+ LLVector3 offset;
+ U32 flags;
};
void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy)
{
- if (mSelectedObjects->isAttachment())
- {
- //RN: do not duplicate attachments
- make_ui_sound("UISndInvalidOp");
- return;
- }
- if (!canDuplicate())
- {
- LLSelectNode* node = getSelection()->getFirstRootNode(NULL, true);
- if (node)
- {
- LLSD args;
- args["OBJ_NAME"] = node->mName;
- LLNotificationsUtil::add("NoCopyPermsNoObject", args);
- return;
- }
- }
- LLDuplicateData data;
-
- data.offset = offset;
- data.flags = (select_copy ? FLAGS_CREATE_SELECTED : 0x0);
-
- sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, logNoOp, &data, SEND_ONLY_ROOTS);
-
- if (select_copy)
- {
- // the new copy will be coming in selected
- deselectAll();
- }
- else
- {
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- node->mDuplicated = TRUE;
- node->mDuplicatePos = node->getObject()->getPositionGlobal();
- node->mDuplicateRot = node->getObject()->getRotation();
- }
- }
+ if (mSelectedObjects->isAttachment())
+ {
+ //RN: do not duplicate attachments
+ make_ui_sound("UISndInvalidOp");
+ return;
+ }
+ if (!canDuplicate())
+ {
+ LLSelectNode* node = getSelection()->getFirstRootNode(NULL, true);
+ if (node)
+ {
+ LLSD args;
+ args["OBJ_NAME"] = node->mName;
+ LLNotificationsUtil::add("NoCopyPermsNoObject", args);
+ return;
+ }
+ }
+ LLDuplicateData data;
+
+ data.offset = offset;
+ data.flags = (select_copy ? FLAGS_CREATE_SELECTED : 0x0);
+
+ sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, logNoOp, &data, SEND_ONLY_ROOTS);
+
+ if (select_copy)
+ {
+ // the new copy will be coming in selected
+ deselectAll();
+ }
+ else
+ {
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ node->mDuplicated = TRUE;
+ node->mDuplicatePos = node->getObject()->getPositionGlobal();
+ node->mDuplicateRot = node->getObject()->getRotation();
+ }
+ }
}
void LLSelectMgr::repeatDuplicate()
{
- if (mSelectedObjects->isAttachment())
- {
- //RN: do not duplicate attachments
- make_ui_sound("UISndInvalidOp");
- return;
- }
-
- std::vector<LLViewerObject*> non_duplicated_objects;
-
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- if (!node->mDuplicated)
- {
- non_duplicated_objects.push_back(node->getObject());
- }
- }
-
- // make sure only previously duplicated objects are selected
- for (std::vector<LLViewerObject*>::iterator iter = non_duplicated_objects.begin();
- iter != non_duplicated_objects.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
- deselectObjectAndFamily(objectp);
- }
-
- // duplicate objects in place
- LLDuplicateData data;
-
- data.offset = LLVector3::zero;
- data.flags = 0x0;
-
- sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, logNoOp, &data, SEND_ONLY_ROOTS);
-
- // move current selection based on delta from duplication position and update duplication position
- for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
- iter != getSelection()->root_end(); iter++ )
- {
- LLSelectNode* node = *iter;
- if (node->mDuplicated)
- {
- LLQuaternion cur_rot = node->getObject()->getRotation();
- LLQuaternion rot_delta = (~node->mDuplicateRot * cur_rot);
- LLQuaternion new_rot = cur_rot * rot_delta;
- LLVector3d cur_pos = node->getObject()->getPositionGlobal();
- LLVector3d new_pos = cur_pos + ((cur_pos - node->mDuplicatePos) * rot_delta);
-
- node->mDuplicatePos = node->getObject()->getPositionGlobal();
- node->mDuplicateRot = node->getObject()->getRotation();
- node->getObject()->setPositionGlobal(new_pos);
- node->getObject()->setRotation(new_rot);
- }
- }
-
- sendMultipleUpdate(UPD_ROTATION | UPD_POSITION);
-}
-
-// static
+ if (mSelectedObjects->isAttachment())
+ {
+ //RN: do not duplicate attachments
+ make_ui_sound("UISndInvalidOp");
+ return;
+ }
+
+ std::vector<LLViewerObject*> non_duplicated_objects;
+
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ if (!node->mDuplicated)
+ {
+ non_duplicated_objects.push_back(node->getObject());
+ }
+ }
+
+ // make sure only previously duplicated objects are selected
+ for (std::vector<LLViewerObject*>::iterator iter = non_duplicated_objects.begin();
+ iter != non_duplicated_objects.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+ deselectObjectAndFamily(objectp);
+ }
+
+ // duplicate objects in place
+ LLDuplicateData data;
+
+ data.offset = LLVector3::zero;
+ data.flags = 0x0;
+
+ sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, logNoOp, &data, SEND_ONLY_ROOTS);
+
+ // move current selection based on delta from duplication position and update duplication position
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
+ {
+ LLSelectNode* node = *iter;
+ if (node->mDuplicated)
+ {
+ LLQuaternion cur_rot = node->getObject()->getRotation();
+ LLQuaternion rot_delta = (~node->mDuplicateRot * cur_rot);
+ LLQuaternion new_rot = cur_rot * rot_delta;
+ LLVector3d cur_pos = node->getObject()->getPositionGlobal();
+ LLVector3d new_pos = cur_pos + ((cur_pos - node->mDuplicatePos) * rot_delta);
+
+ node->mDuplicatePos = node->getObject()->getPositionGlobal();
+ node->mDuplicateRot = node->getObject()->getRotation();
+ node->getObject()->setPositionGlobal(new_pos);
+ node->getObject()->setRotation(new_rot);
+ }
+ }
+
+ sendMultipleUpdate(UPD_ROTATION | UPD_POSITION);
+}
+
+// static
void LLSelectMgr::packDuplicate( LLSelectNode* node, void *duplicate_data )
{
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID());
}
@@ -4458,71 +4458,71 @@ void LLSelectMgr::packDuplicate( LLSelectNode* node, void *duplicate_data )
// ray.
struct LLDuplicateOnRayData
{
- LLVector3 mRayStartRegion;
- LLVector3 mRayEndRegion;
- BOOL mBypassRaycast;
- BOOL mRayEndIsIntersection;
- LLUUID mRayTargetID;
- BOOL mCopyCenters;
- BOOL mCopyRotates;
- U32 mFlags;
+ LLVector3 mRayStartRegion;
+ LLVector3 mRayEndRegion;
+ BOOL mBypassRaycast;
+ BOOL mRayEndIsIntersection;
+ LLUUID mRayTargetID;
+ BOOL mCopyCenters;
+ BOOL mCopyRotates;
+ U32 mFlags;
};
void LLSelectMgr::selectDuplicateOnRay(const LLVector3 &ray_start_region,
- const LLVector3 &ray_end_region,
- BOOL bypass_raycast,
- BOOL ray_end_is_intersection,
- const LLUUID &ray_target_id,
- BOOL copy_centers,
- BOOL copy_rotates,
- BOOL select_copy)
-{
- if (mSelectedObjects->isAttachment())
- {
- // do not duplicate attachments
- make_ui_sound("UISndInvalidOp");
- return;
- }
-
- LLDuplicateOnRayData data;
-
- data.mRayStartRegion = ray_start_region;
- data.mRayEndRegion = ray_end_region;
- data.mBypassRaycast = bypass_raycast;
- data.mRayEndIsIntersection = ray_end_is_intersection;
- data.mRayTargetID = ray_target_id;
- data.mCopyCenters = copy_centers;
- data.mCopyRotates = copy_rotates;
- data.mFlags = (select_copy ? FLAGS_CREATE_SELECTED : 0x0);
-
- sendListToRegions("ObjectDuplicateOnRay",
+ const LLVector3 &ray_end_region,
+ BOOL bypass_raycast,
+ BOOL ray_end_is_intersection,
+ const LLUUID &ray_target_id,
+ BOOL copy_centers,
+ BOOL copy_rotates,
+ BOOL select_copy)
+{
+ if (mSelectedObjects->isAttachment())
+ {
+ // do not duplicate attachments
+ make_ui_sound("UISndInvalidOp");
+ return;
+ }
+
+ LLDuplicateOnRayData data;
+
+ data.mRayStartRegion = ray_start_region;
+ data.mRayEndRegion = ray_end_region;
+ data.mBypassRaycast = bypass_raycast;
+ data.mRayEndIsIntersection = ray_end_is_intersection;
+ data.mRayTargetID = ray_target_id;
+ data.mCopyCenters = copy_centers;
+ data.mCopyRotates = copy_rotates;
+ data.mFlags = (select_copy ? FLAGS_CREATE_SELECTED : 0x0);
+
+ sendListToRegions("ObjectDuplicateOnRay",
packDuplicateOnRayHead, packObjectLocalID, logNoOp, &data, SEND_ONLY_ROOTS);
- if (select_copy)
- {
- // the new copy will be coming in selected
- deselectAll();
- }
+ if (select_copy)
+ {
+ // the new copy will be coming in selected
+ deselectAll();
+ }
}
// static
void LLSelectMgr::packDuplicateOnRayHead(void *user_data)
{
- LLMessageSystem *msg = gMessageSystem;
- LLDuplicateOnRayData *data = (LLDuplicateOnRayData *)user_data;
+ LLMessageSystem *msg = gMessageSystem;
+ LLDuplicateOnRayData *data = (LLDuplicateOnRayData *)user_data;
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID() );
- msg->addVector3Fast(_PREHASH_RayStart, data->mRayStartRegion );
- msg->addVector3Fast(_PREHASH_RayEnd, data->mRayEndRegion );
- msg->addBOOLFast(_PREHASH_BypassRaycast, data->mBypassRaycast );
- msg->addBOOLFast(_PREHASH_RayEndIsIntersection, data->mRayEndIsIntersection );
- msg->addBOOLFast(_PREHASH_CopyCenters, data->mCopyCenters );
- msg->addBOOLFast(_PREHASH_CopyRotates, data->mCopyRotates );
- msg->addUUIDFast(_PREHASH_RayTargetID, data->mRayTargetID );
- msg->addU32Fast(_PREHASH_DuplicateFlags, data->mFlags );
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID() );
+ msg->addVector3Fast(_PREHASH_RayStart, data->mRayStartRegion );
+ msg->addVector3Fast(_PREHASH_RayEnd, data->mRayEndRegion );
+ msg->addBOOLFast(_PREHASH_BypassRaycast, data->mBypassRaycast );
+ msg->addBOOLFast(_PREHASH_RayEndIsIntersection, data->mRayEndIsIntersection );
+ msg->addBOOLFast(_PREHASH_CopyCenters, data->mCopyCenters );
+ msg->addBOOLFast(_PREHASH_CopyRotates, data->mCopyRotates );
+ msg->addUUIDFast(_PREHASH_RayTargetID, data->mRayTargetID );
+ msg->addU32Fast(_PREHASH_DuplicateFlags, data->mFlags );
}
@@ -4533,61 +4533,61 @@ void LLSelectMgr::packDuplicateOnRayHead(void *user_data)
void LLSelectMgr::sendMultipleUpdate(U32 type)
{
- if (type == UPD_NONE) return;
- // send individual updates when selecting textures or individual objects
- ESendType send_type = (!gSavedSettings.getBOOL("EditLinkedParts") && !getTEMode()) ? SEND_ONLY_ROOTS : SEND_ROOTS_FIRST;
- if (send_type == SEND_ONLY_ROOTS)
- {
- // tell simulator to apply to whole linked sets
- type |= UPD_LINKED_SETS;
- }
-
- sendListToRegions(
- "MultipleObjectUpdate",
- packAgentAndSessionID,
- packMultipleUpdate,
+ if (type == UPD_NONE) return;
+ // send individual updates when selecting textures or individual objects
+ ESendType send_type = (!gSavedSettings.getBOOL("EditLinkedParts") && !getTEMode()) ? SEND_ONLY_ROOTS : SEND_ROOTS_FIRST;
+ if (send_type == SEND_ONLY_ROOTS)
+ {
+ // tell simulator to apply to whole linked sets
+ type |= UPD_LINKED_SETS;
+ }
+
+ sendListToRegions(
+ "MultipleObjectUpdate",
+ packAgentAndSessionID,
+ packMultipleUpdate,
logNoOp,
- &type,
- send_type);
+ &type,
+ send_type);
}
// static
void LLSelectMgr::packMultipleUpdate(LLSelectNode* node, void *user_data)
{
- LLViewerObject* object = node->getObject();
- U32 *type32 = (U32 *)user_data;
- U8 type = (U8)*type32;
- U8 data[256];
-
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID() );
- gMessageSystem->addU8Fast(_PREHASH_Type, type );
-
- S32 offset = 0;
-
- // JC: You MUST pack the data in this order. The receiving
- // routine process_multiple_update_message on simulator will
- // extract them in this order.
-
- if (type & UPD_POSITION)
- {
- htolememcpy(&data[offset], &(object->getPosition().mV), MVT_LLVector3, 12);
- offset += 12;
- }
- if (type & UPD_ROTATION)
- {
- LLQuaternion quat = object->getRotation();
- LLVector3 vec = quat.packToVector3();
- htolememcpy(&data[offset], &(vec.mV), MVT_LLQuaternion, 12);
- offset += 12;
- }
- if (type & UPD_SCALE)
- {
- //LL_INFOS() << "Sending object scale " << object->getScale() << LL_ENDL;
- htolememcpy(&data[offset], &(object->getScale().mV), MVT_LLVector3, 12);
- offset += 12;
- }
- gMessageSystem->addBinaryDataFast(_PREHASH_Data, data, offset);
+ LLViewerObject* object = node->getObject();
+ U32 *type32 = (U32 *)user_data;
+ U8 type = (U8)*type32;
+ U8 data[256];
+
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID() );
+ gMessageSystem->addU8Fast(_PREHASH_Type, type );
+
+ S32 offset = 0;
+
+ // JC: You MUST pack the data in this order. The receiving
+ // routine process_multiple_update_message on simulator will
+ // extract them in this order.
+
+ if (type & UPD_POSITION)
+ {
+ htolememcpy(&data[offset], &(object->getPosition().mV), MVT_LLVector3, 12);
+ offset += 12;
+ }
+ if (type & UPD_ROTATION)
+ {
+ LLQuaternion quat = object->getRotation();
+ LLVector3 vec = quat.packToVector3();
+ htolememcpy(&data[offset], &(vec.mV), MVT_LLQuaternion, 12);
+ offset += 12;
+ }
+ if (type & UPD_SCALE)
+ {
+ //LL_INFOS() << "Sending object scale " << object->getScale() << LL_ENDL;
+ htolememcpy(&data[offset], &(object->getScale().mV), MVT_LLVector3, 12);
+ offset += 12;
+ }
+ gMessageSystem->addBinaryDataFast(_PREHASH_Data, data, offset);
}
//------------------------------------------------------------------------
@@ -4595,36 +4595,36 @@ void LLSelectMgr::packMultipleUpdate(LLSelectNode* node, void *user_data)
//------------------------------------------------------------------------
struct LLOwnerData
{
- LLUUID owner_id;
- LLUUID group_id;
- BOOL override;
+ LLUUID owner_id;
+ LLUUID group_id;
+ BOOL override;
};
void LLSelectMgr::sendOwner(const LLUUID& owner_id,
- const LLUUID& group_id,
- BOOL override)
+ const LLUUID& group_id,
+ BOOL override)
{
- LLOwnerData data;
+ LLOwnerData data;
- data.owner_id = owner_id;
- data.group_id = group_id;
- data.override = override;
+ data.owner_id = owner_id;
+ data.group_id = group_id;
+ data.override = override;
- sendListToRegions("ObjectOwner", packOwnerHead, packObjectLocalID, logNoOp, &data, SEND_ONLY_ROOTS);
+ sendListToRegions("ObjectOwner", packOwnerHead, packObjectLocalID, logNoOp, &data, SEND_ONLY_ROOTS);
}
// static
void LLSelectMgr::packOwnerHead(void *user_data)
{
- LLOwnerData *data = (LLOwnerData *)user_data;
+ LLOwnerData *data = (LLOwnerData *)user_data;
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- gMessageSystem->nextBlockFast(_PREHASH_HeaderData);
- gMessageSystem->addBOOLFast(_PREHASH_Override, data->override);
- gMessageSystem->addUUIDFast(_PREHASH_OwnerID, data->owner_id);
- gMessageSystem->addUUIDFast(_PREHASH_GroupID, data->group_id);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ gMessageSystem->nextBlockFast(_PREHASH_HeaderData);
+ gMessageSystem->addBOOLFast(_PREHASH_Override, data->override);
+ gMessageSystem->addUUIDFast(_PREHASH_OwnerID, data->owner_id);
+ gMessageSystem->addUUIDFast(_PREHASH_GroupID, data->group_id);
}
//------------------------------------------------------------------------
@@ -4633,8 +4633,8 @@ void LLSelectMgr::packOwnerHead(void *user_data)
void LLSelectMgr::sendGroup(const LLUUID& group_id)
{
- LLUUID local_group_id(group_id);
- sendListToRegions("ObjectGroup", packAgentAndSessionAndGroupID, packObjectLocalID, logNoOp, &local_group_id, SEND_ONLY_ROOTS);
+ LLUUID local_group_id(group_id);
+ sendListToRegions("ObjectGroup", packAgentAndSessionAndGroupID, packObjectLocalID, logNoOp, &local_group_id, SEND_ONLY_ROOTS);
}
@@ -4644,9 +4644,9 @@ void LLSelectMgr::sendGroup(const LLUUID& group_id)
struct LLBuyData
{
- std::vector<LLViewerObject*> mObjectsSent;
- LLUUID mCategoryID;
- LLSaleInfo mSaleInfo;
+ std::vector<LLViewerObject*> mObjectsSent;
+ LLUUID mCategoryID;
+ LLSaleInfo mSaleInfo;
};
// *NOTE: does not work for multiple object buy, which UI does not
@@ -4655,26 +4655,26 @@ struct LLBuyData
// info -as displayed in the UI- for every item.
void LLSelectMgr::sendBuy(const LLUUID& buyer_id, const LLUUID& category_id, const LLSaleInfo sale_info)
{
- LLBuyData buy;
- buy.mCategoryID = category_id;
- buy.mSaleInfo = sale_info;
- sendListToRegions("ObjectBuy", packAgentGroupAndCatID, packBuyObjectIDs, logNoOp, &buy, SEND_ONLY_ROOTS);
+ LLBuyData buy;
+ buy.mCategoryID = category_id;
+ buy.mSaleInfo = sale_info;
+ sendListToRegions("ObjectBuy", packAgentGroupAndCatID, packBuyObjectIDs, logNoOp, &buy, SEND_ONLY_ROOTS);
}
// static
void LLSelectMgr::packBuyObjectIDs(LLSelectNode* node, void* data)
{
- LLBuyData* buy = (LLBuyData*)data;
+ LLBuyData* buy = (LLBuyData*)data;
- LLViewerObject* object = node->getObject();
- if (std::find(buy->mObjectsSent.begin(), buy->mObjectsSent.end(), object) == buy->mObjectsSent.end())
- {
- buy->mObjectsSent.push_back(object);
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID() );
- gMessageSystem->addU8Fast(_PREHASH_SaleType, buy->mSaleInfo.getSaleType());
- gMessageSystem->addS32Fast(_PREHASH_SalePrice, buy->mSaleInfo.getSalePrice());
- }
+ LLViewerObject* object = node->getObject();
+ if (std::find(buy->mObjectsSent.begin(), buy->mObjectsSent.end(), object) == buy->mObjectsSent.end())
+ {
+ buy->mObjectsSent.push_back(object);
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID() );
+ gMessageSystem->addU8Fast(_PREHASH_SaleType, buy->mSaleInfo.getSaleType());
+ gMessageSystem->addS32Fast(_PREHASH_SalePrice, buy->mSaleInfo.getSalePrice());
+ }
}
//------------------------------------------------------------------------
@@ -4683,37 +4683,37 @@ void LLSelectMgr::packBuyObjectIDs(LLSelectNode* node, void* data)
struct LLPermData
{
- U8 mField;
- BOOL mSet;
- U32 mMask;
- BOOL mOverride;
+ U8 mField;
+ BOOL mSet;
+ U32 mMask;
+ BOOL mOverride;
};
// TODO: Make this able to fail elegantly.
void LLSelectMgr::selectionSetObjectPermissions(U8 field,
- BOOL set,
- U32 mask,
- BOOL override)
+ BOOL set,
+ U32 mask,
+ BOOL override)
{
- LLPermData data;
+ LLPermData data;
- data.mField = field;
- data.mSet = set;
- data.mMask = mask;
- data.mOverride = override;
+ data.mField = field;
+ data.mSet = set;
+ data.mMask = mask;
+ data.mOverride = override;
- sendListToRegions("ObjectPermissions", packPermissionsHead, packPermissions, logNoOp, &data, SEND_ONLY_ROOTS);
+ sendListToRegions("ObjectPermissions", packPermissionsHead, packPermissions, logNoOp, &data, SEND_ONLY_ROOTS);
}
void LLSelectMgr::packPermissionsHead(void* user_data)
{
- LLPermData* data = (LLPermData*)user_data;
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_HeaderData);
- gMessageSystem->addBOOLFast(_PREHASH_Override, data->mOverride);
-}
+ LLPermData* data = (LLPermData*)user_data;
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_HeaderData);
+ gMessageSystem->addBOOLFast(_PREHASH_Override, data->mOverride);
+}
// Now that you've added a bunch of objects, send a select message
@@ -4721,204 +4721,204 @@ void LLSelectMgr::packPermissionsHead(void* user_data)
/*
void LLSelectMgr::sendSelect()
{
- LL_ERRS() << "Not implemented" << LL_ENDL;
+ LL_ERRS() << "Not implemented" << LL_ENDL;
}
*/
void LLSelectMgr::deselectAll()
{
- if (!mSelectedObjects->getNumNodes())
- {
- return;
- }
-
- // Zap the angular velocity, as the sim will set it to zero
- for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
- iter != mSelectedObjects->end(); iter++ )
- {
- LLViewerObject *objectp = (*iter)->getObject();
- objectp->setAngularVelocity( 0,0,0 );
- objectp->setVelocity( 0,0,0 );
- }
-
- sendListToRegions(
- "ObjectDeselect",
- packAgentAndSessionID,
- packObjectLocalID,
+ if (!mSelectedObjects->getNumNodes())
+ {
+ return;
+ }
+
+ // Zap the angular velocity, as the sim will set it to zero
+ for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+ iter != mSelectedObjects->end(); iter++ )
+ {
+ LLViewerObject *objectp = (*iter)->getObject();
+ objectp->setAngularVelocity( 0,0,0 );
+ objectp->setVelocity( 0,0,0 );
+ }
+
+ sendListToRegions(
+ "ObjectDeselect",
+ packAgentAndSessionID,
+ packObjectLocalID,
logNoOp,
- NULL,
- SEND_INDIVIDUALS);
+ NULL,
+ SEND_INDIVIDUALS);
- removeAll();
-
- mLastSentSelectionCenterGlobal.clearVec();
+ removeAll();
- updatePointAt();
+ mLastSentSelectionCenterGlobal.clearVec();
+
+ updatePointAt();
}
void LLSelectMgr::deselectAllForStandingUp()
{
- /*
- This function is similar deselectAll() except for the first if statement
- which was removed. This is needed as a workaround for DEV-2854
- */
-
- // Zap the angular velocity, as the sim will set it to zero
- for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
- iter != mSelectedObjects->end(); iter++ )
- {
- LLViewerObject *objectp = (*iter)->getObject();
- objectp->setAngularVelocity( 0,0,0 );
- objectp->setVelocity( 0,0,0 );
- }
-
- sendListToRegions(
- "ObjectDeselect",
- packAgentAndSessionID,
- packObjectLocalID,
+ /*
+ This function is similar deselectAll() except for the first if statement
+ which was removed. This is needed as a workaround for DEV-2854
+ */
+
+ // Zap the angular velocity, as the sim will set it to zero
+ for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+ iter != mSelectedObjects->end(); iter++ )
+ {
+ LLViewerObject *objectp = (*iter)->getObject();
+ objectp->setAngularVelocity( 0,0,0 );
+ objectp->setVelocity( 0,0,0 );
+ }
+
+ sendListToRegions(
+ "ObjectDeselect",
+ packAgentAndSessionID,
+ packObjectLocalID,
logNoOp,
- NULL,
- SEND_INDIVIDUALS);
+ NULL,
+ SEND_INDIVIDUALS);
+
+ removeAll();
- removeAll();
-
- mLastSentSelectionCenterGlobal.clearVec();
+ mLastSentSelectionCenterGlobal.clearVec();
- updatePointAt();
+ updatePointAt();
}
void LLSelectMgr::deselectUnused()
{
- // no more outstanding references to this selection
- if (mSelectedObjects->getNumRefs() == 1)
- {
- deselectAll();
- }
+ // no more outstanding references to this selection
+ if (mSelectedObjects->getNumRefs() == 1)
+ {
+ deselectAll();
+ }
}
void LLSelectMgr::convertTransient()
{
- LLObjectSelection::iterator node_it;
- for (node_it = mSelectedObjects->begin(); node_it != mSelectedObjects->end(); ++node_it)
- {
- LLSelectNode *nodep = *node_it;
- nodep->setTransient(FALSE);
- }
+ LLObjectSelection::iterator node_it;
+ for (node_it = mSelectedObjects->begin(); node_it != mSelectedObjects->end(); ++node_it)
+ {
+ LLSelectNode *nodep = *node_it;
+ nodep->setTransient(FALSE);
+ }
}
void LLSelectMgr::deselectAllIfTooFar()
{
- if (mSelectedObjects->isEmpty() || mSelectedObjects->mSelectType == SELECT_TYPE_HUD)
- {
- return;
- }
-
- // HACK: Don't deselect when we're navigating to rate an object's
- // owner or creator. JC
- if (gMenuObject->getVisible())
- {
- return;
- }
-
- LLVector3d selectionCenter = getSelectionCenterGlobal();
- if (gSavedSettings.getBOOL("LimitSelectDistance")
- && (!mSelectedObjects->getPrimaryObject() || !mSelectedObjects->getPrimaryObject()->isAvatar())
- && (mSelectedObjects->getPrimaryObject() != LLViewerMediaFocus::getInstance()->getFocusedObject())
- && !mSelectedObjects->isAttachment()
- && !selectionCenter.isExactlyZero())
- {
- F32 deselect_dist = gSavedSettings.getF32("MaxSelectDistance");
- F32 deselect_dist_sq = deselect_dist * deselect_dist;
-
- LLVector3d select_delta = gAgent.getPositionGlobal() - selectionCenter;
- F32 select_dist_sq = (F32) select_delta.magVecSquared();
-
- if (select_dist_sq > deselect_dist_sq)
- {
- if (mDebugSelectMgr)
- {
- LL_INFOS() << "Selection manager: auto-deselecting, select_dist = " << (F32) sqrt(select_dist_sq) << LL_ENDL;
- LL_INFOS() << "agent pos global = " << gAgent.getPositionGlobal() << LL_ENDL;
- LL_INFOS() << "selection pos global = " << selectionCenter << LL_ENDL;
- }
-
- deselectAll();
- }
- }
+ if (mSelectedObjects->isEmpty() || mSelectedObjects->mSelectType == SELECT_TYPE_HUD)
+ {
+ return;
+ }
+
+ // HACK: Don't deselect when we're navigating to rate an object's
+ // owner or creator. JC
+ if (gMenuObject->getVisible())
+ {
+ return;
+ }
+
+ LLVector3d selectionCenter = getSelectionCenterGlobal();
+ if (gSavedSettings.getBOOL("LimitSelectDistance")
+ && (!mSelectedObjects->getPrimaryObject() || !mSelectedObjects->getPrimaryObject()->isAvatar())
+ && (mSelectedObjects->getPrimaryObject() != LLViewerMediaFocus::getInstance()->getFocusedObject())
+ && !mSelectedObjects->isAttachment()
+ && !selectionCenter.isExactlyZero())
+ {
+ F32 deselect_dist = gSavedSettings.getF32("MaxSelectDistance");
+ F32 deselect_dist_sq = deselect_dist * deselect_dist;
+
+ LLVector3d select_delta = gAgent.getPositionGlobal() - selectionCenter;
+ F32 select_dist_sq = (F32) select_delta.magVecSquared();
+
+ if (select_dist_sq > deselect_dist_sq)
+ {
+ if (mDebugSelectMgr)
+ {
+ LL_INFOS() << "Selection manager: auto-deselecting, select_dist = " << (F32) sqrt(select_dist_sq) << LL_ENDL;
+ LL_INFOS() << "agent pos global = " << gAgent.getPositionGlobal() << LL_ENDL;
+ LL_INFOS() << "selection pos global = " << selectionCenter << LL_ENDL;
+ }
+
+ deselectAll();
+ }
+ }
}
void LLSelectMgr::selectionSetObjectName(const std::string& name)
{
- std::string name_copy(name);
+ std::string name_copy(name);
- // we only work correctly if 1 object is selected.
- if(mSelectedObjects->getRootObjectCount() == 1)
- {
- sendListToRegions("ObjectName",
- packAgentAndSessionID,
- packObjectName,
+ // we only work correctly if 1 object is selected.
+ if(mSelectedObjects->getRootObjectCount() == 1)
+ {
+ sendListToRegions("ObjectName",
+ packAgentAndSessionID,
+ packObjectName,
logNoOp,
- (void*)(&name_copy),
- SEND_ONLY_ROOTS);
- }
- else if(mSelectedObjects->getObjectCount() == 1)
- {
- sendListToRegions("ObjectName",
- packAgentAndSessionID,
- packObjectName,
+ (void*)(&name_copy),
+ SEND_ONLY_ROOTS);
+ }
+ else if(mSelectedObjects->getObjectCount() == 1)
+ {
+ sendListToRegions("ObjectName",
+ packAgentAndSessionID,
+ packObjectName,
logNoOp,
- (void*)(&name_copy),
- SEND_INDIVIDUALS);
- }
+ (void*)(&name_copy),
+ SEND_INDIVIDUALS);
+ }
}
void LLSelectMgr::selectionSetObjectDescription(const std::string& desc)
{
- std::string desc_copy(desc);
+ std::string desc_copy(desc);
- // we only work correctly if 1 object is selected.
- if(mSelectedObjects->getRootObjectCount() == 1)
- {
- sendListToRegions("ObjectDescription",
- packAgentAndSessionID,
- packObjectDescription,
+ // we only work correctly if 1 object is selected.
+ if(mSelectedObjects->getRootObjectCount() == 1)
+ {
+ sendListToRegions("ObjectDescription",
+ packAgentAndSessionID,
+ packObjectDescription,
logNoOp,
- (void*)(&desc_copy),
- SEND_ONLY_ROOTS);
- }
- else if(mSelectedObjects->getObjectCount() == 1)
- {
- sendListToRegions("ObjectDescription",
- packAgentAndSessionID,
- packObjectDescription,
+ (void*)(&desc_copy),
+ SEND_ONLY_ROOTS);
+ }
+ else if(mSelectedObjects->getObjectCount() == 1)
+ {
+ sendListToRegions("ObjectDescription",
+ packAgentAndSessionID,
+ packObjectDescription,
logNoOp,
- (void*)(&desc_copy),
- SEND_INDIVIDUALS);
- }
+ (void*)(&desc_copy),
+ SEND_INDIVIDUALS);
+ }
}
void LLSelectMgr::selectionSetObjectCategory(const LLCategory& category)
{
- // for now, we only want to be able to set one root category at
- // a time.
- if(mSelectedObjects->getRootObjectCount() != 1) return;
- sendListToRegions("ObjectCategory",
- packAgentAndSessionID,
- packObjectCategory,
+ // for now, we only want to be able to set one root category at
+ // a time.
+ if(mSelectedObjects->getRootObjectCount() != 1) return;
+ sendListToRegions("ObjectCategory",
+ packAgentAndSessionID,
+ packObjectCategory,
logNoOp,
- (void*)(&category),
- SEND_ONLY_ROOTS);
+ (void*)(&category),
+ SEND_ONLY_ROOTS);
}
void LLSelectMgr::selectionSetObjectSaleInfo(const LLSaleInfo& sale_info)
{
- sendListToRegions("ObjectSaleInfo",
- packAgentAndSessionID,
- packObjectSaleInfo,
+ sendListToRegions("ObjectSaleInfo",
+ packAgentAndSessionID,
+ packObjectSaleInfo,
logNoOp,
- (void*)(&sale_info),
- SEND_ONLY_ROOTS);
+ (void*)(&sale_info),
+ SEND_ONLY_ROOTS);
}
//----------------------------------------------------------------------
@@ -4932,80 +4932,80 @@ void LLSelectMgr::sendAttach(U8 attachment_point, bool replace)
void LLSelectMgr::sendAttach(LLObjectSelectionHandle selection_handle, U8 attachment_point, bool replace)
{
- if (selection_handle.isNull())
- {
- return;
- }
-
- LLViewerObject* attach_object = selection_handle->getFirstRootObject();
-
- if (!attach_object || !isAgentAvatarValid() || selection_handle->mSelectType != SELECT_TYPE_WORLD)
- {
- return;
- }
-
- BOOL build_mode = LLToolMgr::getInstance()->inEdit();
- // Special case: Attach to default location for this object.
- if (0 == attachment_point ||
- get_if_there(gAgentAvatarp->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL))
- {
- if (!replace || attachment_point != 0)
- {
- // If we know the attachment point then we got here by clicking an
- // "Attach to..." context menu item, so we should add, not replace.
- attachment_point |= ATTACHMENT_ADD;
- }
-
- sendListToRegions(
- selection_handle,
- "ObjectAttach",
- packAgentIDAndSessionAndAttachment,
- packObjectIDAndRotation,
+ if (selection_handle.isNull())
+ {
+ return;
+ }
+
+ LLViewerObject* attach_object = selection_handle->getFirstRootObject();
+
+ if (!attach_object || !isAgentAvatarValid() || selection_handle->mSelectType != SELECT_TYPE_WORLD)
+ {
+ return;
+ }
+
+ BOOL build_mode = LLToolMgr::getInstance()->inEdit();
+ // Special case: Attach to default location for this object.
+ if (0 == attachment_point ||
+ get_if_there(gAgentAvatarp->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL))
+ {
+ if (!replace || attachment_point != 0)
+ {
+ // If we know the attachment point then we got here by clicking an
+ // "Attach to..." context menu item, so we should add, not replace.
+ attachment_point |= ATTACHMENT_ADD;
+ }
+
+ sendListToRegions(
+ selection_handle,
+ "ObjectAttach",
+ packAgentIDAndSessionAndAttachment,
+ packObjectIDAndRotation,
logAttachmentRequest,
- &attachment_point,
- SEND_ONLY_ROOTS );
- if (!build_mode)
- {
- // After "ObjectAttach" server will unsubscribe us from properties updates
- // so either deselect objects or resend selection after attach packet reaches server
- // In case of build_mode LLPanelObjectInventory::refresh() will deal with selection
- // Still unsubscribe even in case selection_handle is not current selection
- deselectAll();
- }
- }
+ &attachment_point,
+ SEND_ONLY_ROOTS );
+ if (!build_mode)
+ {
+ // After "ObjectAttach" server will unsubscribe us from properties updates
+ // so either deselect objects or resend selection after attach packet reaches server
+ // In case of build_mode LLPanelObjectInventory::refresh() will deal with selection
+ // Still unsubscribe even in case selection_handle is not current selection
+ deselectAll();
+ }
+ }
}
void LLSelectMgr::sendDetach()
{
- if (!mSelectedObjects->getNumNodes() || mSelectedObjects->mSelectType == SELECT_TYPE_WORLD)
- {
- return;
- }
+ if (!mSelectedObjects->getNumNodes() || mSelectedObjects->mSelectType == SELECT_TYPE_WORLD)
+ {
+ return;
+ }
- sendListToRegions(
- "ObjectDetach",
- packAgentAndSessionID,
- packObjectLocalID,
+ sendListToRegions(
+ "ObjectDetach",
+ packAgentAndSessionID,
+ packObjectLocalID,
logDetachRequest,
- NULL,
- SEND_ONLY_ROOTS );
+ NULL,
+ SEND_ONLY_ROOTS );
}
void LLSelectMgr::sendDropAttachment()
{
- if (!mSelectedObjects->getNumNodes() || mSelectedObjects->mSelectType == SELECT_TYPE_WORLD)
- {
- return;
- }
+ if (!mSelectedObjects->getNumNodes() || mSelectedObjects->mSelectType == SELECT_TYPE_WORLD)
+ {
+ return;
+ }
- sendListToRegions(
- "ObjectDrop",
- packAgentAndSessionID,
- packObjectLocalID,
+ sendListToRegions(
+ "ObjectDrop",
+ packAgentAndSessionID,
+ packObjectLocalID,
logDetachRequest,
- NULL,
- SEND_ONLY_ROOTS);
+ NULL,
+ SEND_ONLY_ROOTS);
}
//----------------------------------------------------------------------
@@ -5014,56 +5014,56 @@ void LLSelectMgr::sendDropAttachment()
void LLSelectMgr::sendLink()
{
- if (!mSelectedObjects->getNumNodes())
- {
- return;
- }
+ if (!mSelectedObjects->getNumNodes())
+ {
+ return;
+ }
- sendListToRegions(
- "ObjectLink",
- packAgentAndSessionID,
- packObjectLocalID,
+ sendListToRegions(
+ "ObjectLink",
+ packAgentAndSessionID,
+ packObjectLocalID,
logNoOp,
- NULL,
- SEND_ONLY_ROOTS);
+ NULL,
+ SEND_ONLY_ROOTS);
}
void LLSelectMgr::sendDelink()
{
- if (!mSelectedObjects->getNumNodes())
- {
- return;
- }
-
- struct f : public LLSelectedObjectFunctor
- { //on delink, any modifyable object should
- f() {}
-
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- if (object->getPhysicsShapeType() == LLViewerObject::PHYSICS_SHAPE_NONE)
- {
- object->setPhysicsShapeType(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL);
- object->updateFlags();
- }
- }
- return true;
- }
- } sendfunc;
- getSelection()->applyToObjects(&sendfunc);
-
-
- // Delink needs to send individuals so you can unlink a single object from
- // a linked set.
- sendListToRegions(
- "ObjectDelink",
- packAgentAndSessionID,
- packObjectLocalID,
+ if (!mSelectedObjects->getNumNodes())
+ {
+ return;
+ }
+
+ struct f : public LLSelectedObjectFunctor
+ { //on delink, any modifyable object should
+ f() {}
+
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ if (object->getPhysicsShapeType() == LLViewerObject::PHYSICS_SHAPE_NONE)
+ {
+ object->setPhysicsShapeType(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL);
+ object->updateFlags();
+ }
+ }
+ return true;
+ }
+ } sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
+
+
+ // Delink needs to send individuals so you can unlink a single object from
+ // a linked set.
+ sendListToRegions(
+ "ObjectDelink",
+ packAgentAndSessionID,
+ packObjectLocalID,
logNoOp,
- NULL,
- SEND_INDIVIDUALS);
+ NULL,
+ SEND_INDIVIDUALS);
}
@@ -5074,118 +5074,118 @@ void LLSelectMgr::sendDelink()
/*
void LLSelectMgr::sendHinge(U8 type)
{
- if (!mSelectedObjects->getNumNodes())
- {
- return;
- }
+ if (!mSelectedObjects->getNumNodes())
+ {
+ return;
+ }
- sendListToRegions(
- "ObjectHinge",
- packHingeHead,
- packObjectLocalID,
- &type,
- SEND_ONLY_ROOTS);
+ sendListToRegions(
+ "ObjectHinge",
+ packHingeHead,
+ packObjectLocalID,
+ &type,
+ SEND_ONLY_ROOTS);
}
void LLSelectMgr::sendDehinge()
{
- if (!mSelectedObjects->getNumNodes())
- {
- return;
- }
-
- sendListToRegions(
- "ObjectDehinge",
- packAgentAndSessionID,
- packObjectLocalID,
- NULL,
- SEND_ONLY_ROOTS);
+ if (!mSelectedObjects->getNumNodes())
+ {
+ return;
+ }
+
+ sendListToRegions(
+ "ObjectDehinge",
+ packAgentAndSessionID,
+ packObjectLocalID,
+ NULL,
+ SEND_ONLY_ROOTS);
}*/
void LLSelectMgr::sendSelect()
{
- if (!mSelectedObjects->getNumNodes())
- {
- return;
- }
+ if (!mSelectedObjects->getNumNodes())
+ {
+ return;
+ }
- sendListToRegions(
- "ObjectSelect",
- packAgentAndSessionID,
- packObjectLocalID,
+ sendListToRegions(
+ "ObjectSelect",
+ packAgentAndSessionID,
+ packObjectLocalID,
logNoOp,
- NULL,
- SEND_INDIVIDUALS);
+ NULL,
+ SEND_INDIVIDUALS);
}
// static
void LLSelectMgr::packHingeHead(void *user_data)
{
- U8 *type = (U8 *)user_data;
+ U8 *type = (U8 *)user_data;
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- gMessageSystem->nextBlockFast(_PREHASH_JointType);
- gMessageSystem->addU8Fast(_PREHASH_Type, *type );
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ gMessageSystem->nextBlockFast(_PREHASH_JointType);
+ gMessageSystem->addU8Fast(_PREHASH_Type, *type );
}
void LLSelectMgr::selectionDump()
{
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- object->dump();
- return true;
- }
- } func;
- getSelection()->applyToObjects(&func);
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ object->dump();
+ return true;
+ }
+ } func;
+ getSelection()->applyToObjects(&func);
}
void LLSelectMgr::saveSelectedObjectColors()
{
- struct f : public LLSelectedNodeFunctor
- {
- virtual bool apply(LLSelectNode* node)
- {
- node->saveColors();
- return true;
- }
- } func;
- getSelection()->applyToNodes(&func);
+ struct f : public LLSelectedNodeFunctor
+ {
+ virtual bool apply(LLSelectNode* node)
+ {
+ node->saveColors();
+ return true;
+ }
+ } func;
+ getSelection()->applyToNodes(&func);
}
void LLSelectMgr::saveSelectedShinyColors()
{
- struct f : public LLSelectedNodeFunctor
- {
- virtual bool apply(LLSelectNode* node)
- {
- node->saveShinyColors();
- return true;
- }
- } func;
- getSelection()->applyToNodes(&func);
+ struct f : public LLSelectedNodeFunctor
+ {
+ virtual bool apply(LLSelectNode* node)
+ {
+ node->saveShinyColors();
+ return true;
+ }
+ } func;
+ getSelection()->applyToNodes(&func);
}
void LLSelectMgr::saveSelectedObjectTextures()
{
- // invalidate current selection so we update saved textures
- struct f : public LLSelectedNodeFunctor
- {
- virtual bool apply(LLSelectNode* node)
- {
- node->mValid = FALSE;
- return true;
- }
- } func;
- getSelection()->applyToNodes(&func);
+ // invalidate current selection so we update saved textures
+ struct f : public LLSelectedNodeFunctor
+ {
+ virtual bool apply(LLSelectNode* node)
+ {
+ node->mValid = FALSE;
+ return true;
+ }
+ } func;
+ getSelection()->applyToNodes(&func);
- // request object properties message to get updated permissions data
- sendSelect();
+ // request object properties message to get updated permissions data
+ sendSelect();
}
@@ -5193,293 +5193,293 @@ void LLSelectMgr::saveSelectedObjectTextures()
// also need to know to which simulator to send update message
void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type)
{
- if (mSelectedObjects->isEmpty())
- {
- // nothing selected, so nothing to save
- return;
- }
-
- struct f : public LLSelectedNodeFunctor
- {
- EActionType mActionType;
- LLSelectMgr* mManager;
- f(EActionType a, LLSelectMgr* p) : mActionType(a), mManager(p) {}
- virtual bool apply(LLSelectNode* selectNode)
- {
- LLViewerObject* object = selectNode->getObject();
- if (!object)
- {
- return true; // skip
- }
- selectNode->mSavedPositionLocal = object->getPosition();
- if (object->isAttachment())
- {
- if (object->isRootEdit())
- {
- LLXform* parent_xform = object->mDrawable->getXform()->getParent();
- if (parent_xform)
- {
- selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition());
- }
- else
- {
- selectNode->mSavedPositionGlobal = object->getPositionGlobal();
- }
- }
- else
- {
- LLViewerObject* attachment_root = (LLViewerObject*)object->getParent();
- LLXform* parent_xform = attachment_root ? attachment_root->mDrawable->getXform()->getParent() : NULL;
- if (parent_xform)
- {
- LLVector3 root_pos = (attachment_root->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();
- LLQuaternion root_rot = (attachment_root->getRotation() * parent_xform->getWorldRotation());
- selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * root_rot) + root_pos);
- }
- else
- {
- selectNode->mSavedPositionGlobal = object->getPositionGlobal();
- }
- }
- selectNode->mSavedRotation = object->getRenderRotation();
- }
- else
- {
- selectNode->mSavedPositionGlobal = object->getPositionGlobal();
- selectNode->mSavedRotation = object->getRotationRegion();
- }
-
- selectNode->mSavedScale = object->getScale();
- selectNode->saveTextureScaleRatios(mManager->mTextureChannel);
- return true;
- }
- } func(action_type, this);
- getSelection()->applyToNodes(&func);
-
- mSavedSelectionBBox = getBBoxOfSelection();
+ if (mSelectedObjects->isEmpty())
+ {
+ // nothing selected, so nothing to save
+ return;
+ }
+
+ struct f : public LLSelectedNodeFunctor
+ {
+ EActionType mActionType;
+ LLSelectMgr* mManager;
+ f(EActionType a, LLSelectMgr* p) : mActionType(a), mManager(p) {}
+ virtual bool apply(LLSelectNode* selectNode)
+ {
+ LLViewerObject* object = selectNode->getObject();
+ if (!object)
+ {
+ return true; // skip
+ }
+ selectNode->mSavedPositionLocal = object->getPosition();
+ if (object->isAttachment())
+ {
+ if (object->isRootEdit())
+ {
+ LLXform* parent_xform = object->mDrawable->getXform()->getParent();
+ if (parent_xform)
+ {
+ selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition());
+ }
+ else
+ {
+ selectNode->mSavedPositionGlobal = object->getPositionGlobal();
+ }
+ }
+ else
+ {
+ LLViewerObject* attachment_root = (LLViewerObject*)object->getParent();
+ LLXform* parent_xform = attachment_root ? attachment_root->mDrawable->getXform()->getParent() : NULL;
+ if (parent_xform)
+ {
+ LLVector3 root_pos = (attachment_root->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();
+ LLQuaternion root_rot = (attachment_root->getRotation() * parent_xform->getWorldRotation());
+ selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * root_rot) + root_pos);
+ }
+ else
+ {
+ selectNode->mSavedPositionGlobal = object->getPositionGlobal();
+ }
+ }
+ selectNode->mSavedRotation = object->getRenderRotation();
+ }
+ else
+ {
+ selectNode->mSavedPositionGlobal = object->getPositionGlobal();
+ selectNode->mSavedRotation = object->getRotationRegion();
+ }
+
+ selectNode->mSavedScale = object->getScale();
+ selectNode->saveTextureScaleRatios(mManager->mTextureChannel);
+ return true;
+ }
+ } func(action_type, this);
+ getSelection()->applyToNodes(&func);
+
+ mSavedSelectionBBox = getBBoxOfSelection();
}
struct LLSelectMgrApplyFlags : public LLSelectedObjectFunctor
{
- LLSelectMgrApplyFlags(U32 flags, BOOL state) : mFlags(flags), mState(state) {}
- U32 mFlags;
- BOOL mState;
- virtual bool apply(LLViewerObject* object)
- {
- if ( object->permModify())
- {
- if (object->isRoot()) // don't send for child objects
- {
- object->setFlags( mFlags, mState);
- }
- else if (FLAGS_WORLD & mFlags && ((LLViewerObject*)object->getRoot())->isSelected())
- {
- // FLAGS_WORLD are shared by all items in linkset
- object->setFlagsWithoutUpdate(FLAGS_WORLD & mFlags, mState);
- }
- };
- return true;
- }
+ LLSelectMgrApplyFlags(U32 flags, BOOL state) : mFlags(flags), mState(state) {}
+ U32 mFlags;
+ BOOL mState;
+ virtual bool apply(LLViewerObject* object)
+ {
+ if ( object->permModify())
+ {
+ if (object->isRoot()) // don't send for child objects
+ {
+ object->setFlags( mFlags, mState);
+ }
+ else if (FLAGS_WORLD & mFlags && ((LLViewerObject*)object->getRoot())->isSelected())
+ {
+ // FLAGS_WORLD are shared by all items in linkset
+ object->setFlagsWithoutUpdate(FLAGS_WORLD & mFlags, mState);
+ }
+ };
+ return true;
+ }
};
void LLSelectMgr::selectionUpdatePhysics(BOOL physics)
{
- LLSelectMgrApplyFlags func( FLAGS_USE_PHYSICS, physics);
- getSelection()->applyToObjects(&func);
+ LLSelectMgrApplyFlags func( FLAGS_USE_PHYSICS, physics);
+ getSelection()->applyToObjects(&func);
}
void LLSelectMgr::selectionUpdateTemporary(BOOL is_temporary)
{
- LLSelectMgrApplyFlags func( FLAGS_TEMPORARY_ON_REZ, is_temporary);
- getSelection()->applyToObjects(&func);
+ LLSelectMgrApplyFlags func( FLAGS_TEMPORARY_ON_REZ, is_temporary);
+ getSelection()->applyToObjects(&func);
}
void LLSelectMgr::selectionUpdatePhantom(BOOL is_phantom)
{
- LLSelectMgrApplyFlags func( FLAGS_PHANTOM, is_phantom);
- getSelection()->applyToObjects(&func);
+ LLSelectMgrApplyFlags func( FLAGS_PHANTOM, is_phantom);
+ getSelection()->applyToObjects(&func);
}
//----------------------------------------------------------------------
// Helpful packing functions for sendObjectMessage()
//----------------------------------------------------------------------
-// static
+// static
void LLSelectMgr::packAgentIDAndSessionAndAttachment( void *user_data)
{
- U8 *attachment_point = (U8*)user_data;
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->addU8Fast(_PREHASH_AttachmentPoint, *attachment_point);
+ U8 *attachment_point = (U8*)user_data;
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->addU8Fast(_PREHASH_AttachmentPoint, *attachment_point);
}
// static
-void LLSelectMgr::packAgentID( void *user_data)
+void LLSelectMgr::packAgentID( void *user_data)
{
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
}
// static
void LLSelectMgr::packAgentAndSessionID(void* user_data)
{
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
}
// static
void LLSelectMgr::packAgentAndGroupID(void* user_data)
{
- LLOwnerData *data = (LLOwnerData *)user_data;
+ LLOwnerData *data = (LLOwnerData *)user_data;
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, data->owner_id );
- gMessageSystem->addUUIDFast(_PREHASH_GroupID, data->group_id );
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, data->owner_id );
+ gMessageSystem->addUUIDFast(_PREHASH_GroupID, data->group_id );
}
// static
void LLSelectMgr::packAgentAndSessionAndGroupID(void* user_data)
{
- LLUUID* group_idp = (LLUUID*) user_data;
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->addUUIDFast(_PREHASH_GroupID, *group_idp);
+ LLUUID* group_idp = (LLUUID*) user_data;
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->addUUIDFast(_PREHASH_GroupID, *group_idp);
}
// static
void LLSelectMgr::packDuplicateHeader(void* data)
{
- LLUUID group_id(gAgent.getGroupID());
- packAgentAndSessionAndGroupID(&group_id);
+ LLUUID group_id(gAgent.getGroupID());
+ packAgentAndSessionAndGroupID(&group_id);
- LLDuplicateData* dup_data = (LLDuplicateData*) data;
+ LLDuplicateData* dup_data = (LLDuplicateData*) data;
- gMessageSystem->nextBlockFast(_PREHASH_SharedData);
- gMessageSystem->addVector3Fast(_PREHASH_Offset, dup_data->offset);
- gMessageSystem->addU32Fast(_PREHASH_DuplicateFlags, dup_data->flags);
+ gMessageSystem->nextBlockFast(_PREHASH_SharedData);
+ gMessageSystem->addVector3Fast(_PREHASH_Offset, dup_data->offset);
+ gMessageSystem->addU32Fast(_PREHASH_DuplicateFlags, dup_data->flags);
}
// static
void LLSelectMgr::packDeleteHeader(void* userdata)
{
- BOOL force = (BOOL)(intptr_t)userdata;
+ BOOL force = (BOOL)(intptr_t)userdata;
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->addBOOLFast(_PREHASH_Force, force);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->addBOOLFast(_PREHASH_Force, force);
}
// static
void LLSelectMgr::packAgentGroupAndCatID(void* user_data)
{
- LLBuyData* buy = (LLBuyData*)user_data;
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
- gMessageSystem->addUUIDFast(_PREHASH_CategoryID, buy->mCategoryID);
+ LLBuyData* buy = (LLBuyData*)user_data;
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
+ gMessageSystem->addUUIDFast(_PREHASH_CategoryID, buy->mCategoryID);
}
//static
void LLSelectMgr::packDeRezHeader(void* user_data)
{
- LLDeRezInfo* info = (LLDeRezInfo*)user_data;
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_AgentBlock);
- gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
- gMessageSystem->addU8Fast(_PREHASH_Destination, (U8)info->mDestination);
- gMessageSystem->addUUIDFast(_PREHASH_DestinationID, info->mDestinationID);
- LLUUID tid;
- tid.generate();
- gMessageSystem->addUUIDFast(_PREHASH_TransactionID, tid);
- const U8 PACKET = 1;
- gMessageSystem->addU8Fast(_PREHASH_PacketCount, PACKET);
- gMessageSystem->addU8Fast(_PREHASH_PacketNumber, PACKET);
-}
-
-// static
+ LLDeRezInfo* info = (LLDeRezInfo*)user_data;
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_AgentBlock);
+ gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
+ gMessageSystem->addU8Fast(_PREHASH_Destination, (U8)info->mDestination);
+ gMessageSystem->addUUIDFast(_PREHASH_DestinationID, info->mDestinationID);
+ LLUUID tid;
+ tid.generate();
+ gMessageSystem->addUUIDFast(_PREHASH_TransactionID, tid);
+ const U8 PACKET = 1;
+ gMessageSystem->addU8Fast(_PREHASH_PacketCount, PACKET);
+ gMessageSystem->addU8Fast(_PREHASH_PacketNumber, PACKET);
+}
+
+// static
void LLSelectMgr::packObjectID(LLSelectNode* node, void *user_data)
{
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addUUIDFast(_PREHASH_ObjectID, node->getObject()->mID );
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addUUIDFast(_PREHASH_ObjectID, node->getObject()->mID );
}
void LLSelectMgr::packObjectIDAndRotation(LLSelectNode* node, void *user_data)
{
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID() );
- gMessageSystem->addQuatFast(_PREHASH_Rotation, node->getObject()->getRotation());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID() );
+ gMessageSystem->addQuatFast(_PREHASH_Rotation, node->getObject()->getRotation());
}
void LLSelectMgr::packObjectClickAction(LLSelectNode* node, void *user_data)
{
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID() );
- gMessageSystem->addU8("ClickAction", node->getObject()->getClickAction());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID() );
+ gMessageSystem->addU8("ClickAction", node->getObject()->getClickAction());
}
void LLSelectMgr::packObjectIncludeInSearch(LLSelectNode* node, void *user_data)
{
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID() );
- gMessageSystem->addBOOL("IncludeInSearch", node->getObject()->getIncludeInSearch());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID() );
+ gMessageSystem->addBOOL("IncludeInSearch", node->getObject()->getIncludeInSearch());
}
// static
void LLSelectMgr::packObjectLocalID(LLSelectNode* node, void *)
{
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID());
}
// static
void LLSelectMgr::packObjectName(LLSelectNode* node, void* user_data)
{
- const std::string* name = (const std::string*)user_data;
- if(!name->empty())
- {
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID());
- gMessageSystem->addStringFast(_PREHASH_Name, *name);
- }
+ const std::string* name = (const std::string*)user_data;
+ if(!name->empty())
+ {
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID());
+ gMessageSystem->addStringFast(_PREHASH_Name, *name);
+ }
}
// static
void LLSelectMgr::packObjectDescription(LLSelectNode* node, void* user_data)
{
- const std::string* desc = (const std::string*)user_data;
- if(desc)
- { // Empty (non-null, but zero length) descriptions are OK
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID());
- gMessageSystem->addStringFast(_PREHASH_Description, *desc);
- }
+ const std::string* desc = (const std::string*)user_data;
+ if(desc)
+ { // Empty (non-null, but zero length) descriptions are OK
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID());
+ gMessageSystem->addStringFast(_PREHASH_Description, *desc);
+ }
}
// static
void LLSelectMgr::packObjectCategory(LLSelectNode* node, void* user_data)
{
- LLCategory* category = (LLCategory*)user_data;
- if(!category) return;
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID());
- category->packMessage(gMessageSystem);
+ LLCategory* category = (LLCategory*)user_data;
+ if(!category) return;
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID());
+ category->packMessage(gMessageSystem);
}
// static
void LLSelectMgr::packObjectSaleInfo(LLSelectNode* node, void* user_data)
{
- LLSaleInfo* sale_info = (LLSaleInfo*)user_data;
- if(!sale_info) return;
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID());
- sale_info->packMessage(gMessageSystem);
+ LLSaleInfo* sale_info = (LLSaleInfo*)user_data;
+ if(!sale_info) return;
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_LocalID, node->getObject()->getLocalID());
+ sale_info->packMessage(gMessageSystem);
}
// static
@@ -5492,46 +5492,46 @@ void LLSelectMgr::packShape(LLSelectNode* node, void *user_data)
{
}
-// static
+// static
void LLSelectMgr::packPermissions(LLSelectNode* node, void *user_data)
{
- LLPermData *data = (LLPermData *)user_data;
+ LLPermData *data = (LLPermData *)user_data;
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID());
- gMessageSystem->addU8Fast(_PREHASH_Field, data->mField);
- gMessageSystem->addBOOLFast(_PREHASH_Set, data->mSet);
- gMessageSystem->addU32Fast(_PREHASH_Mask, data->mMask);
+ gMessageSystem->addU8Fast(_PREHASH_Field, data->mField);
+ gMessageSystem->addBOOLFast(_PREHASH_Set, data->mSet);
+ gMessageSystem->addU32Fast(_PREHASH_Mask, data->mMask);
}
// Utility function to send some information to every region containing
// an object on the selection list. We want to do this to reduce the total
// number of packets sent by the viewer.
void LLSelectMgr::sendListToRegions(const std::string& message_name,
- void (*pack_header)(void *user_data),
- void (*pack_body)(LLSelectNode* node, void *user_data),
- void (*log_func)(LLSelectNode* node, void *user_data),
- void *user_data,
- ESendType send_type)
+ void (*pack_header)(void *user_data),
+ void (*pack_body)(LLSelectNode* node, void *user_data),
+ void (*log_func)(LLSelectNode* node, void *user_data),
+ void *user_data,
+ ESendType send_type)
{
sendListToRegions(mSelectedObjects, message_name, pack_header, pack_body, log_func, user_data, send_type);
}
void LLSelectMgr::sendListToRegions(LLObjectSelectionHandle selected_handle,
- const std::string& message_name,
- void (*pack_header)(void *user_data),
- void (*pack_body)(LLSelectNode* node, void *user_data),
- void (*log_func)(LLSelectNode* node, void *user_data),
- void *user_data,
- ESendType send_type)
+ const std::string& message_name,
+ void (*pack_header)(void *user_data),
+ void (*pack_body)(LLSelectNode* node, void *user_data),
+ void (*log_func)(LLSelectNode* node, void *user_data),
+ void *user_data,
+ ESendType send_type)
{
- LLSelectNode* node;
- LLSelectNode* linkset_root = NULL;
- LLViewerRegion* last_region;
- LLViewerRegion* current_region;
- S32 objects_in_this_packet = 0;
+ LLSelectNode* node;
+ LLSelectNode* linkset_root = NULL;
+ LLViewerRegion* last_region;
+ LLViewerRegion* current_region;
+ S32 objects_in_this_packet = 0;
- bool link_operation = message_name == "ObjectLink";
+ bool link_operation = message_name == "ObjectLink";
if (mAllowSelectAvatar)
{
@@ -5555,164 +5555,164 @@ void LLSelectMgr::sendListToRegions(LLObjectSelectionHandle selected_handle,
resetObjectOverrides(selected_handle);
}
- std::queue<LLSelectNode*> nodes_to_send;
-
- struct push_all : public LLSelectedNodeFunctor
- {
- std::queue<LLSelectNode*>& nodes_to_send;
- push_all(std::queue<LLSelectNode*>& n) : nodes_to_send(n) {}
- virtual bool apply(LLSelectNode* node)
- {
- if (node->getObject())
- {
- nodes_to_send.push(node);
- }
- return true;
- }
- };
- struct push_some : public LLSelectedNodeFunctor
- {
- std::queue<LLSelectNode*>& nodes_to_send;
- bool mRoots;
- push_some(std::queue<LLSelectNode*>& n, bool roots) : nodes_to_send(n), mRoots(roots) {}
- virtual bool apply(LLSelectNode* node)
- {
- if (node->getObject())
- {
- BOOL is_root = node->getObject()->isRootEdit();
- if ((mRoots && is_root) || (!mRoots && !is_root))
- {
- nodes_to_send.push(node);
- }
- }
- return true;
- }
- };
- struct push_all pushall(nodes_to_send);
- struct push_some pushroots(nodes_to_send, TRUE);
- struct push_some pushnonroots(nodes_to_send, FALSE);
-
- switch(send_type)
- {
- case SEND_ONLY_ROOTS:
- if(message_name == "ObjectBuy")
- selected_handle->applyToRootNodes(&pushroots);
- else
- selected_handle->applyToRootNodes(&pushall);
-
- break;
- case SEND_INDIVIDUALS:
- selected_handle->applyToNodes(&pushall);
- break;
- case SEND_ROOTS_FIRST:
- // first roots...
- selected_handle->applyToNodes(&pushroots);
- // then children...
- selected_handle->applyToNodes(&pushnonroots);
- break;
- case SEND_CHILDREN_FIRST:
- // first children...
- selected_handle->applyToNodes(&pushnonroots);
- // then roots...
- selected_handle->applyToNodes(&pushroots);
- break;
-
- default:
- LL_ERRS() << "Bad send type " << send_type << " passed to SendListToRegions()" << LL_ENDL;
- }
-
- // bail if nothing selected
- if (nodes_to_send.empty())
- {
- return;
- }
-
- node = nodes_to_send.front();
- nodes_to_send.pop();
-
- // cache last region information
- current_region = node->getObject()->getRegion();
-
- // Start duplicate message
- // CRO: this isn't
- gMessageSystem->newMessage(message_name.c_str());
- (*pack_header)(user_data);
-
- // For each object
- while (node != NULL)
- {
- // remember the last region, look up the current one
- last_region = current_region;
- current_region = node->getObject()->getRegion();
-
- // if to same simulator and message not too big
- if ((current_region == last_region)
- && (! gMessageSystem->isSendFull(NULL))
- && (objects_in_this_packet < MAX_OBJECTS_PER_PACKET))
- {
- if (link_operation && linkset_root == NULL)
- {
- // linksets over 254 will be split into multiple messages,
- // but we need to provide same root for all messages or we will get separate linksets
- linkset_root = node;
- }
- // add another instance of the body of the data
- (*pack_body)(node, user_data);
+ std::queue<LLSelectNode*> nodes_to_send;
+
+ struct push_all : public LLSelectedNodeFunctor
+ {
+ std::queue<LLSelectNode*>& nodes_to_send;
+ push_all(std::queue<LLSelectNode*>& n) : nodes_to_send(n) {}
+ virtual bool apply(LLSelectNode* node)
+ {
+ if (node->getObject())
+ {
+ nodes_to_send.push(node);
+ }
+ return true;
+ }
+ };
+ struct push_some : public LLSelectedNodeFunctor
+ {
+ std::queue<LLSelectNode*>& nodes_to_send;
+ bool mRoots;
+ push_some(std::queue<LLSelectNode*>& n, bool roots) : nodes_to_send(n), mRoots(roots) {}
+ virtual bool apply(LLSelectNode* node)
+ {
+ if (node->getObject())
+ {
+ BOOL is_root = node->getObject()->isRootEdit();
+ if ((mRoots && is_root) || (!mRoots && !is_root))
+ {
+ nodes_to_send.push(node);
+ }
+ }
+ return true;
+ }
+ };
+ struct push_all pushall(nodes_to_send);
+ struct push_some pushroots(nodes_to_send, TRUE);
+ struct push_some pushnonroots(nodes_to_send, FALSE);
+
+ switch(send_type)
+ {
+ case SEND_ONLY_ROOTS:
+ if(message_name == "ObjectBuy")
+ selected_handle->applyToRootNodes(&pushroots);
+ else
+ selected_handle->applyToRootNodes(&pushall);
+
+ break;
+ case SEND_INDIVIDUALS:
+ selected_handle->applyToNodes(&pushall);
+ break;
+ case SEND_ROOTS_FIRST:
+ // first roots...
+ selected_handle->applyToNodes(&pushroots);
+ // then children...
+ selected_handle->applyToNodes(&pushnonroots);
+ break;
+ case SEND_CHILDREN_FIRST:
+ // first children...
+ selected_handle->applyToNodes(&pushnonroots);
+ // then roots...
+ selected_handle->applyToNodes(&pushroots);
+ break;
+
+ default:
+ LL_ERRS() << "Bad send type " << send_type << " passed to SendListToRegions()" << LL_ENDL;
+ }
+
+ // bail if nothing selected
+ if (nodes_to_send.empty())
+ {
+ return;
+ }
+
+ node = nodes_to_send.front();
+ nodes_to_send.pop();
+
+ // cache last region information
+ current_region = node->getObject()->getRegion();
+
+ // Start duplicate message
+ // CRO: this isn't
+ gMessageSystem->newMessage(message_name.c_str());
+ (*pack_header)(user_data);
+
+ // For each object
+ while (node != NULL)
+ {
+ // remember the last region, look up the current one
+ last_region = current_region;
+ current_region = node->getObject()->getRegion();
+
+ // if to same simulator and message not too big
+ if ((current_region == last_region)
+ && (! gMessageSystem->isSendFull(NULL))
+ && (objects_in_this_packet < MAX_OBJECTS_PER_PACKET))
+ {
+ if (link_operation && linkset_root == NULL)
+ {
+ // linksets over 254 will be split into multiple messages,
+ // but we need to provide same root for all messages or we will get separate linksets
+ linkset_root = node;
+ }
+ // add another instance of the body of the data
+ (*pack_body)(node, user_data);
// do any related logging
(*log_func)(node, user_data);
- ++objects_in_this_packet;
-
- // and on to the next object
- if(nodes_to_send.empty())
- {
- node = NULL;
- }
- else
- {
- node = nodes_to_send.front();
- nodes_to_send.pop();
- }
- }
- else
- {
- // otherwise send current message and start new one
- gMessageSystem->sendReliable( last_region->getHost());
- objects_in_this_packet = 0;
-
- gMessageSystem->newMessage(message_name.c_str());
- (*pack_header)(user_data);
-
- if (linkset_root != NULL)
- {
- if (current_region != last_region)
- {
- // root should be in one region with the child, reset it
- linkset_root = NULL;
- }
- else
- {
- // add root instance into new message
- (*pack_body)(linkset_root, user_data);
- ++objects_in_this_packet;
- }
- }
-
- // don't move to the next object, we still need to add the
- // body data.
- }
- }
-
- // flush messages
- if (gMessageSystem->getCurrentSendTotal() > 0)
- {
- gMessageSystem->sendReliable( current_region->getHost());
- }
- else
- {
- gMessageSystem->clearMessage();
- }
-
- // LL_INFOS() << "sendListToRegions " << message_name << " obj " << objects_sent << " pkt " << packets_sent << LL_ENDL;
+ ++objects_in_this_packet;
+
+ // and on to the next object
+ if(nodes_to_send.empty())
+ {
+ node = NULL;
+ }
+ else
+ {
+ node = nodes_to_send.front();
+ nodes_to_send.pop();
+ }
+ }
+ else
+ {
+ // otherwise send current message and start new one
+ gMessageSystem->sendReliable( last_region->getHost());
+ objects_in_this_packet = 0;
+
+ gMessageSystem->newMessage(message_name.c_str());
+ (*pack_header)(user_data);
+
+ if (linkset_root != NULL)
+ {
+ if (current_region != last_region)
+ {
+ // root should be in one region with the child, reset it
+ linkset_root = NULL;
+ }
+ else
+ {
+ // add root instance into new message
+ (*pack_body)(linkset_root, user_data);
+ ++objects_in_this_packet;
+ }
+ }
+
+ // don't move to the next object, we still need to add the
+ // body data.
+ }
+ }
+
+ // flush messages
+ if (gMessageSystem->getCurrentSendTotal() > 0)
+ {
+ gMessageSystem->sendReliable( current_region->getHost());
+ }
+ else
+ {
+ gMessageSystem->clearMessage();
+ }
+
+ // LL_INFOS() << "sendListToRegions " << message_name << " obj " << objects_sent << " pkt " << packets_sent << LL_ENDL;
}
@@ -5722,166 +5722,166 @@ void LLSelectMgr::sendListToRegions(LLObjectSelectionHandle selected_handle,
void LLSelectMgr::requestObjectPropertiesFamily(LLViewerObject* object)
{
- LLMessageSystem* msg = gMessageSystem;
+ LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU32Fast(_PREHASH_RequestFlags, 0x0 );
- msg->addUUIDFast(_PREHASH_ObjectID, object->mID );
+ msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addU32Fast(_PREHASH_RequestFlags, 0x0 );
+ msg->addUUIDFast(_PREHASH_ObjectID, object->mID );
- LLViewerRegion* regionp = object->getRegion();
- msg->sendReliable( regionp->getHost() );
+ LLViewerRegion* regionp = object->getRegion();
+ msg->sendReliable( regionp->getHost() );
}
// static
void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data)
{
- S32 i;
- S32 count = msg->getNumberOfBlocksFast(_PREHASH_ObjectData);
- for (i = 0; i < count; i++)
- {
- LLUUID id;
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, id, i);
-
- LLUUID creator_id;
- LLUUID owner_id;
- LLUUID group_id;
- LLUUID last_owner_id;
- U64 creation_date;
- LLUUID extra_id;
- U32 base_mask, owner_mask, group_mask, everyone_mask, next_owner_mask;
- LLSaleInfo sale_info;
- LLCategory category;
- LLAggregatePermissions ag_perms;
- LLAggregatePermissions ag_texture_perms;
- LLAggregatePermissions ag_texture_perms_owner;
-
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_CreatorID, creator_id, i);
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, owner_id, i);
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID, group_id, i);
- msg->getU64Fast(_PREHASH_ObjectData, _PREHASH_CreationDate, creation_date, i);
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_BaseMask, base_mask, i);
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_OwnerMask, owner_mask, i);
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_GroupMask, group_mask, i);
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_EveryoneMask, everyone_mask, i);
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_NextOwnerMask, next_owner_mask, i);
- sale_info.unpackMultiMessage(msg, _PREHASH_ObjectData, i);
-
- ag_perms.unpackMessage(msg, _PREHASH_ObjectData, _PREHASH_AggregatePerms, i);
- ag_texture_perms.unpackMessage(msg, _PREHASH_ObjectData, _PREHASH_AggregatePermTextures, i);
- ag_texture_perms_owner.unpackMessage(msg, _PREHASH_ObjectData, _PREHASH_AggregatePermTexturesOwner, i);
- category.unpackMultiMessage(msg, _PREHASH_ObjectData, i);
-
- S16 inv_serial = 0;
- msg->getS16Fast(_PREHASH_ObjectData, _PREHASH_InventorySerial, inv_serial, i);
-
- LLUUID item_id;
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ItemID, item_id, i);
- LLUUID folder_id;
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FolderID, folder_id, i);
- LLUUID from_task_id;
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FromTaskID, from_task_id, i);
-
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id, i);
-
- std::string name;
- msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name, i);
- std::string desc;
- msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, desc, i);
-
- std::string touch_name;
- msg->getStringFast(_PREHASH_ObjectData, _PREHASH_TouchName, touch_name, i);
- std::string sit_name;
- msg->getStringFast(_PREHASH_ObjectData, _PREHASH_SitName, sit_name, i);
-
- //unpack TE IDs
- uuid_vec_t texture_ids;
- S32 size = msg->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_TextureID);
- if (size > 0)
- {
- S8 packed_buffer[SELECT_MAX_TES * UUID_BYTES];
- msg->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextureID, packed_buffer, 0, i, SELECT_MAX_TES * UUID_BYTES);
-
- for (S32 buf_offset = 0; buf_offset < size; buf_offset += UUID_BYTES)
- {
- LLUUID tid;
- memcpy(tid.mData, packed_buffer + buf_offset, UUID_BYTES); /* Flawfinder: ignore */
- texture_ids.push_back(tid);
- }
- }
-
-
- // Iterate through nodes at end, since it can be on both the regular AND hover list
- struct f : public LLSelectedNodeFunctor
- {
- LLUUID mID;
- f(const LLUUID& id) : mID(id) {}
- virtual bool apply(LLSelectNode* node)
- {
- return (node->getObject() && node->getObject()->mID == mID);
- }
- } func(id);
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func);
-
- if (!node)
- {
- LL_WARNS() << "Couldn't find object " << id << " selected." << LL_ENDL;
- }
- else
- {
+ S32 i;
+ S32 count = msg->getNumberOfBlocksFast(_PREHASH_ObjectData);
+ for (i = 0; i < count; i++)
+ {
+ LLUUID id;
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, id, i);
+
+ LLUUID creator_id;
+ LLUUID owner_id;
+ LLUUID group_id;
+ LLUUID last_owner_id;
+ U64 creation_date;
+ LLUUID extra_id;
+ U32 base_mask, owner_mask, group_mask, everyone_mask, next_owner_mask;
+ LLSaleInfo sale_info;
+ LLCategory category;
+ LLAggregatePermissions ag_perms;
+ LLAggregatePermissions ag_texture_perms;
+ LLAggregatePermissions ag_texture_perms_owner;
+
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_CreatorID, creator_id, i);
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, owner_id, i);
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID, group_id, i);
+ msg->getU64Fast(_PREHASH_ObjectData, _PREHASH_CreationDate, creation_date, i);
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_BaseMask, base_mask, i);
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_OwnerMask, owner_mask, i);
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_GroupMask, group_mask, i);
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_EveryoneMask, everyone_mask, i);
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_NextOwnerMask, next_owner_mask, i);
+ sale_info.unpackMultiMessage(msg, _PREHASH_ObjectData, i);
+
+ ag_perms.unpackMessage(msg, _PREHASH_ObjectData, _PREHASH_AggregatePerms, i);
+ ag_texture_perms.unpackMessage(msg, _PREHASH_ObjectData, _PREHASH_AggregatePermTextures, i);
+ ag_texture_perms_owner.unpackMessage(msg, _PREHASH_ObjectData, _PREHASH_AggregatePermTexturesOwner, i);
+ category.unpackMultiMessage(msg, _PREHASH_ObjectData, i);
+
+ S16 inv_serial = 0;
+ msg->getS16Fast(_PREHASH_ObjectData, _PREHASH_InventorySerial, inv_serial, i);
+
+ LLUUID item_id;
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ItemID, item_id, i);
+ LLUUID folder_id;
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FolderID, folder_id, i);
+ LLUUID from_task_id;
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FromTaskID, from_task_id, i);
+
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id, i);
+
+ std::string name;
+ msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name, i);
+ std::string desc;
+ msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, desc, i);
+
+ std::string touch_name;
+ msg->getStringFast(_PREHASH_ObjectData, _PREHASH_TouchName, touch_name, i);
+ std::string sit_name;
+ msg->getStringFast(_PREHASH_ObjectData, _PREHASH_SitName, sit_name, i);
+
+ //unpack TE IDs
+ uuid_vec_t texture_ids;
+ S32 size = msg->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_TextureID);
+ if (size > 0)
+ {
+ S8 packed_buffer[SELECT_MAX_TES * UUID_BYTES];
+ msg->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextureID, packed_buffer, 0, i, SELECT_MAX_TES * UUID_BYTES);
+
+ for (S32 buf_offset = 0; buf_offset < size; buf_offset += UUID_BYTES)
+ {
+ LLUUID tid;
+ memcpy(tid.mData, packed_buffer + buf_offset, UUID_BYTES); /* Flawfinder: ignore */
+ texture_ids.push_back(tid);
+ }
+ }
+
+
+ // Iterate through nodes at end, since it can be on both the regular AND hover list
+ struct f : public LLSelectedNodeFunctor
+ {
+ LLUUID mID;
+ f(const LLUUID& id) : mID(id) {}
+ virtual bool apply(LLSelectNode* node)
+ {
+ return (node->getObject() && node->getObject()->mID == mID);
+ }
+ } func(id);
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func);
+
+ if (!node)
+ {
+ LL_WARNS() << "Couldn't find object " << id << " selected." << LL_ENDL;
+ }
+ else
+ {
// save texture data as soon as we get texture perms first time
bool save_textures = !node->mValid;
- if (node->mInventorySerial != inv_serial && node->getObject())
- {
- node->getObject()->dirtyInventory();
+ if (node->mInventorySerial != inv_serial && node->getObject())
+ {
+ node->getObject()->dirtyInventory();
// Even if this isn't object's first udpate, inventory changed
// and some of the applied textures might have been in inventory
// so update texture list.
save_textures = true;
- }
-
- if (save_textures)
- {
- BOOL can_copy = FALSE;
- BOOL can_transfer = FALSE;
-
- LLAggregatePermissions::EValue value = LLAggregatePermissions::AP_NONE;
- if(node->getObject()->permYouOwner())
- {
- value = ag_texture_perms_owner.getValue(PERM_COPY);
- if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL)
- {
- can_copy = TRUE;
- }
- value = ag_texture_perms_owner.getValue(PERM_TRANSFER);
- if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL)
- {
- can_transfer = TRUE;
- }
- }
- else
- {
- value = ag_texture_perms.getValue(PERM_COPY);
- if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL)
- {
- can_copy = TRUE;
- }
- value = ag_texture_perms.getValue(PERM_TRANSFER);
- if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL)
- {
- can_transfer = TRUE;
- }
- }
-
- if (can_copy && can_transfer)
- {
- node->saveTextures(texture_ids);
- }
+ }
+
+ if (save_textures)
+ {
+ BOOL can_copy = FALSE;
+ BOOL can_transfer = FALSE;
+
+ LLAggregatePermissions::EValue value = LLAggregatePermissions::AP_NONE;
+ if(node->getObject()->permYouOwner())
+ {
+ value = ag_texture_perms_owner.getValue(PERM_COPY);
+ if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL)
+ {
+ can_copy = TRUE;
+ }
+ value = ag_texture_perms_owner.getValue(PERM_TRANSFER);
+ if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL)
+ {
+ can_transfer = TRUE;
+ }
+ }
+ else
+ {
+ value = ag_texture_perms.getValue(PERM_COPY);
+ if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL)
+ {
+ can_copy = TRUE;
+ }
+ value = ag_texture_perms.getValue(PERM_TRANSFER);
+ if (value == LLAggregatePermissions::AP_EMPTY || value == LLAggregatePermissions::AP_ALL)
+ {
+ can_transfer = TRUE;
+ }
+ }
+
+ if (can_copy && can_transfer)
+ {
+ node->saveTextures(texture_ids);
+ }
if (can_copy && can_transfer && node->getObject()->getVolume())
{
@@ -5912,572 +5912,572 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data
// might need to be moved to LLGLTFMaterialOverrideDispatchHandler
node->saveGLTFMaterials(material_ids, override_materials);
}
- }
-
- node->mValid = TRUE;
- node->mPermissions->init(creator_id, owner_id,
- last_owner_id, group_id);
- node->mPermissions->initMasks(base_mask, owner_mask, everyone_mask, group_mask, next_owner_mask);
- node->mCreationDate = creation_date;
- node->mItemID = item_id;
- node->mFolderID = folder_id;
- node->mFromTaskID = from_task_id;
- node->mName.assign(name);
- node->mDescription.assign(desc);
- node->mSaleInfo = sale_info;
- node->mAggregatePerm = ag_perms;
- node->mAggregateTexturePerm = ag_texture_perms;
- node->mAggregateTexturePermOwner = ag_texture_perms_owner;
- node->mCategory = category;
- node->mInventorySerial = inv_serial;
- node->mSitName.assign(sit_name);
- node->mTouchName.assign(touch_name);
- }
- }
-
- dialog_refresh_all();
-
- // hack for left-click buy object
- LLToolPie::selectionPropertiesReceived();
+ }
+
+ node->mValid = TRUE;
+ node->mPermissions->init(creator_id, owner_id,
+ last_owner_id, group_id);
+ node->mPermissions->initMasks(base_mask, owner_mask, everyone_mask, group_mask, next_owner_mask);
+ node->mCreationDate = creation_date;
+ node->mItemID = item_id;
+ node->mFolderID = folder_id;
+ node->mFromTaskID = from_task_id;
+ node->mName.assign(name);
+ node->mDescription.assign(desc);
+ node->mSaleInfo = sale_info;
+ node->mAggregatePerm = ag_perms;
+ node->mAggregateTexturePerm = ag_texture_perms;
+ node->mAggregateTexturePermOwner = ag_texture_perms_owner;
+ node->mCategory = category;
+ node->mInventorySerial = inv_serial;
+ node->mSitName.assign(sit_name);
+ node->mTouchName.assign(touch_name);
+ }
+ }
+
+ dialog_refresh_all();
+
+ // hack for left-click buy object
+ LLToolPie::selectionPropertiesReceived();
}
// static
void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data)
{
- LLUUID id;
-
- U32 request_flags;
- LLUUID creator_id;
- LLUUID owner_id;
- LLUUID group_id;
- LLUUID extra_id;
- U32 base_mask, owner_mask, group_mask, everyone_mask, next_owner_mask;
- LLSaleInfo sale_info;
- LLCategory category;
-
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_RequestFlags, request_flags );
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, id );
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, owner_id );
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID, group_id );
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_BaseMask, base_mask );
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_OwnerMask, owner_mask );
- msg->getU32Fast(_PREHASH_ObjectData,_PREHASH_GroupMask, group_mask );
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_EveryoneMask, everyone_mask );
- msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_NextOwnerMask, next_owner_mask);
- sale_info.unpackMessage(msg, _PREHASH_ObjectData);
- category.unpackMessage(msg, _PREHASH_ObjectData);
-
- LLUUID last_owner_id;
- msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id );
-
- // unpack name & desc
- std::string name;
- msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name);
-
- std::string desc;
- msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, desc);
-
- // the reporter widget askes the server for info about picked objects
- if (request_flags & COMPLAINT_REPORT_REQUEST )
- {
- LLFloaterReporter *reporterp = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
- if (reporterp)
- {
- LLAvatarName av_name;
- LLAvatarNameCache::get(owner_id, &av_name);
- reporterp->setPickedObjectProperties(name, av_name.getUserName(), owner_id);
- }
- }
- else if (request_flags & OBJECT_PAY_REQUEST)
- {
- // check if the owner of the paid object is muted
- LLMuteList::getInstance()->autoRemove(owner_id, LLMuteList::AR_MONEY);
- }
-
- // Now look through all of the hovered nodes
- struct f : public LLSelectedNodeFunctor
- {
- LLUUID mID;
- f(const LLUUID& id) : mID(id) {}
- virtual bool apply(LLSelectNode* node)
- {
- return (node->getObject() && node->getObject()->mID == mID);
- }
- } func(id);
- LLSelectNode* node = LLSelectMgr::getInstance()->mHoverObjects->getFirstNode(&func);
-
- if (node)
- {
- node->mValid = TRUE;
- node->mPermissions->init(LLUUID::null, owner_id,
- last_owner_id, group_id);
- node->mPermissions->initMasks(base_mask, owner_mask, everyone_mask, group_mask, next_owner_mask);
- node->mSaleInfo = sale_info;
- node->mCategory = category;
- node->mName.assign(name);
- node->mDescription.assign(desc);
- }
-
- dialog_refresh_all();
+ LLUUID id;
+
+ U32 request_flags;
+ LLUUID creator_id;
+ LLUUID owner_id;
+ LLUUID group_id;
+ LLUUID extra_id;
+ U32 base_mask, owner_mask, group_mask, everyone_mask, next_owner_mask;
+ LLSaleInfo sale_info;
+ LLCategory category;
+
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_RequestFlags, request_flags );
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, id );
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, owner_id );
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID, group_id );
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_BaseMask, base_mask );
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_OwnerMask, owner_mask );
+ msg->getU32Fast(_PREHASH_ObjectData,_PREHASH_GroupMask, group_mask );
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_EveryoneMask, everyone_mask );
+ msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_NextOwnerMask, next_owner_mask);
+ sale_info.unpackMessage(msg, _PREHASH_ObjectData);
+ category.unpackMessage(msg, _PREHASH_ObjectData);
+
+ LLUUID last_owner_id;
+ msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id );
+
+ // unpack name & desc
+ std::string name;
+ msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name);
+
+ std::string desc;
+ msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, desc);
+
+ // the reporter widget askes the server for info about picked objects
+ if (request_flags & COMPLAINT_REPORT_REQUEST )
+ {
+ LLFloaterReporter *reporterp = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter");
+ if (reporterp)
+ {
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(owner_id, &av_name);
+ reporterp->setPickedObjectProperties(name, av_name.getUserName(), owner_id);
+ }
+ }
+ else if (request_flags & OBJECT_PAY_REQUEST)
+ {
+ // check if the owner of the paid object is muted
+ LLMuteList::getInstance()->autoRemove(owner_id, LLMuteList::AR_MONEY);
+ }
+
+ // Now look through all of the hovered nodes
+ struct f : public LLSelectedNodeFunctor
+ {
+ LLUUID mID;
+ f(const LLUUID& id) : mID(id) {}
+ virtual bool apply(LLSelectNode* node)
+ {
+ return (node->getObject() && node->getObject()->mID == mID);
+ }
+ } func(id);
+ LLSelectNode* node = LLSelectMgr::getInstance()->mHoverObjects->getFirstNode(&func);
+
+ if (node)
+ {
+ node->mValid = TRUE;
+ node->mPermissions->init(LLUUID::null, owner_id,
+ last_owner_id, group_id);
+ node->mPermissions->initMasks(base_mask, owner_mask, everyone_mask, group_mask, next_owner_mask);
+ node->mSaleInfo = sale_info;
+ node->mCategory = category;
+ node->mName.assign(name);
+ node->mDescription.assign(desc);
+ }
+
+ dialog_refresh_all();
}
// static
void LLSelectMgr::processForceObjectSelect(LLMessageSystem* msg, void**)
{
- BOOL reset_list;
- msg->getBOOL("Header", "ResetList", reset_list);
-
- if (reset_list)
- {
- LLSelectMgr::getInstance()->deselectAll();
- }
+ BOOL reset_list;
+ msg->getBOOL("Header", "ResetList", reset_list);
- LLUUID full_id;
- S32 local_id;
- LLViewerObject* object;
- std::vector<LLViewerObject*> objects;
- S32 i;
- S32 block_count = msg->getNumberOfBlocks("Data");
+ if (reset_list)
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ }
- for (i = 0; i < block_count; i++)
- {
- msg->getS32("Data", "LocalID", local_id, i);
+ LLUUID full_id;
+ S32 local_id;
+ LLViewerObject* object;
+ std::vector<LLViewerObject*> objects;
+ S32 i;
+ S32 block_count = msg->getNumberOfBlocks("Data");
- gObjectList.getUUIDFromLocal(full_id,
- local_id,
- msg->getSenderIP(),
- msg->getSenderPort());
- object = gObjectList.findObject(full_id);
- if (object)
- {
- objects.push_back(object);
- }
- }
+ for (i = 0; i < block_count; i++)
+ {
+ msg->getS32("Data", "LocalID", local_id, i);
+
+ gObjectList.getUUIDFromLocal(full_id,
+ local_id,
+ msg->getSenderIP(),
+ msg->getSenderPort());
+ object = gObjectList.findObject(full_id);
+ if (object)
+ {
+ objects.push_back(object);
+ }
+ }
- // Don't select, just highlight
- LLSelectMgr::getInstance()->highlightObjectAndFamily(objects);
+ // Don't select, just highlight
+ LLSelectMgr::getInstance()->highlightObjectAndFamily(objects);
}
-extern F32 gGLModelView[16];
+extern F32 gGLModelView[16];
void LLSelectMgr::updateSilhouettes()
{
- S32 num_sils_genned = 0;
-
- LLVector3d cameraPos = gAgentCamera.getCameraPositionGlobal();
- F32 currentCameraZoom = gAgentCamera.getCurrentCameraBuildOffset();
-
- if (!mSilhouetteImagep)
- {
- mSilhouetteImagep = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI);
- }
-
- mHighlightedObjects->cleanupNodes();
-
- if((cameraPos - mLastCameraPos).magVecSquared() > SILHOUETTE_UPDATE_THRESHOLD_SQUARED * currentCameraZoom * currentCameraZoom)
- {
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- object->setChanged(LLXform::SILHOUETTE);
- return true;
- }
- } func;
- getSelection()->applyToObjects(&func);
-
- mLastCameraPos = gAgentCamera.getCameraPositionGlobal();
- }
-
- std::vector<LLViewerObject*> changed_objects;
-
- updateSelectionSilhouette(mSelectedObjects, num_sils_genned, changed_objects);
- if (mRectSelectedObjects.size() > 0)
- {
- //gGLSPipelineSelection.set();
-
- //mSilhouetteImagep->bindTexture();
- //glAlphaFunc(GL_GREATER, sHighlightAlphaTest);
-
- std::set<LLViewerObject*> roots;
-
- // sync mHighlightedObjects with mRectSelectedObjects since the latter is rebuilt every frame and former
- // persists from frame to frame to avoid regenerating object silhouettes
- // mHighlightedObjects includes all siblings of rect selected objects
-
- BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
-
- // generate list of roots from current object selection
- for (std::set<LLPointer<LLViewerObject> >::iterator iter = mRectSelectedObjects.begin();
- iter != mRectSelectedObjects.end(); iter++)
- {
- LLViewerObject *objectp = *iter;
- if (select_linked_set)
- {
- LLViewerObject *rootp = (LLViewerObject*)objectp->getRoot();
- roots.insert(rootp);
- }
- else
- {
- roots.insert(objectp);
- }
- }
-
- // remove highlight nodes not in roots list
- std::vector<LLSelectNode*> remove_these_nodes;
- std::vector<LLViewerObject*> remove_these_roots;
-
- for (LLObjectSelection::iterator iter = mHighlightedObjects->begin();
- iter != mHighlightedObjects->end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* objectp = node->getObject();
- if (!objectp)
- continue;
- if (objectp->isRoot() || !select_linked_set)
- {
- if (roots.count(objectp) == 0)
- {
- remove_these_nodes.push_back(node);
- }
- else
- {
- remove_these_roots.push_back(objectp);
- }
- }
- else
- {
- LLViewerObject* rootp = (LLViewerObject*)objectp->getRoot();
-
- if (roots.count(rootp) == 0)
- {
- remove_these_nodes.push_back(node);
- }
- }
- }
-
- // remove all highlight nodes no longer in rectangle selection
- for (std::vector<LLSelectNode*>::iterator iter = remove_these_nodes.begin();
- iter != remove_these_nodes.end(); ++iter)
- {
- LLSelectNode* nodep = *iter;
- mHighlightedObjects->removeNode(nodep);
- }
-
- // remove all root objects already being highlighted
- for (std::vector<LLViewerObject*>::iterator iter = remove_these_roots.begin();
- iter != remove_these_roots.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
- roots.erase(objectp);
- }
-
- // add all new objects in rectangle selection
- for (std::set<LLViewerObject*>::iterator iter = roots.begin();
- iter != roots.end(); iter++)
- {
- LLViewerObject* objectp = *iter;
- if (!canSelectObject(objectp))
- {
- continue;
- }
-
- LLSelectNode* rect_select_root_node = new LLSelectNode(objectp, TRUE);
- rect_select_root_node->selectAllTEs(TRUE);
-
- if (!select_linked_set)
- {
- rect_select_root_node->mIndividualSelection = TRUE;
- }
- else
- {
- LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child_objectp = *iter;
-
- if (!canSelectObject(child_objectp))
- {
- continue;
- }
-
- LLSelectNode* rect_select_node = new LLSelectNode(child_objectp, TRUE);
- rect_select_node->selectAllTEs(TRUE);
- mHighlightedObjects->addNodeAtEnd(rect_select_node);
- }
- }
-
- // Add the root last, to preserve order for link operations.
- mHighlightedObjects->addNodeAtEnd(rect_select_root_node);
- }
-
- num_sils_genned = 0;
-
- // render silhouettes for highlighted objects
- //BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL);
- for (S32 pass = 0; pass < 2; pass++)
- {
- for (LLObjectSelection::iterator iter = mHighlightedObjects->begin();
- iter != mHighlightedObjects->end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* objectp = node->getObject();
- if (!objectp)
- continue;
-
- // do roots first, then children so that root flags are cleared ASAP
- BOOL roots_only = (pass == 0);
- BOOL is_root = objectp->isRootEdit();
- if (roots_only != is_root)
- {
- continue;
- }
-
- if (!node->mSilhouetteExists
- || objectp->isChanged(LLXform::SILHOUETTE)
- || (objectp->getParent() && objectp->getParent()->isChanged(LLXform::SILHOUETTE)))
- {
- if (num_sils_genned++ < MAX_SILS_PER_FRAME)
- {
- generateSilhouette(node, LLViewerCamera::getInstance()->getOrigin());
- changed_objects.push_back(objectp);
- }
- else if (objectp->isAttachment() && objectp->getRootEdit()->mDrawable.notNull())
- {
- //RN: hack for orthogonal projection of HUD attachments
- LLViewerJointAttachment* attachment_pt = (LLViewerJointAttachment*)objectp->getRootEdit()->mDrawable->getParent();
- if (attachment_pt && attachment_pt->getIsHUDAttachment())
- {
- LLVector3 camera_pos = LLVector3(-10000.f, 0.f, 0.f);
- generateSilhouette(node, camera_pos);
- }
- }
- }
- //LLColor4 highlight_color;
- //
- //if (subtracting_from_selection)
- //{
- // node->renderOneSilhouette(LLColor4::red);
- //}
- //else if (!objectp->isSelected())
- //{
- // highlight_color = objectp->isRoot() ? sHighlightParentColor : sHighlightChildColor;
- // node->renderOneSilhouette(highlight_color);
- //}
- }
- }
- //mSilhouetteImagep->unbindTexture(0, GL_TEXTURE_2D);
- }
- else
- {
- mHighlightedObjects->deleteAllNodes();
- }
-
- for (std::vector<LLViewerObject*>::iterator iter = changed_objects.begin();
- iter != changed_objects.end(); ++iter)
- {
- // clear flags after traversing node list (as child objects need to refer to parent flags, etc)
- LLViewerObject* objectp = *iter;
- objectp->clearChanged(LLXform::MOVED | LLXform::SILHOUETTE);
- }
+ S32 num_sils_genned = 0;
+
+ LLVector3d cameraPos = gAgentCamera.getCameraPositionGlobal();
+ F32 currentCameraZoom = gAgentCamera.getCurrentCameraBuildOffset();
+
+ if (!mSilhouetteImagep)
+ {
+ mSilhouetteImagep = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI);
+ }
+
+ mHighlightedObjects->cleanupNodes();
+
+ if((cameraPos - mLastCameraPos).magVecSquared() > SILHOUETTE_UPDATE_THRESHOLD_SQUARED * currentCameraZoom * currentCameraZoom)
+ {
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ object->setChanged(LLXform::SILHOUETTE);
+ return true;
+ }
+ } func;
+ getSelection()->applyToObjects(&func);
+
+ mLastCameraPos = gAgentCamera.getCameraPositionGlobal();
+ }
+
+ std::vector<LLViewerObject*> changed_objects;
+
+ updateSelectionSilhouette(mSelectedObjects, num_sils_genned, changed_objects);
+ if (mRectSelectedObjects.size() > 0)
+ {
+ //gGLSPipelineSelection.set();
+
+ //mSilhouetteImagep->bindTexture();
+ //glAlphaFunc(GL_GREATER, sHighlightAlphaTest);
+
+ std::set<LLViewerObject*> roots;
+
+ // sync mHighlightedObjects with mRectSelectedObjects since the latter is rebuilt every frame and former
+ // persists from frame to frame to avoid regenerating object silhouettes
+ // mHighlightedObjects includes all siblings of rect selected objects
+
+ BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
+
+ // generate list of roots from current object selection
+ for (std::set<LLPointer<LLViewerObject> >::iterator iter = mRectSelectedObjects.begin();
+ iter != mRectSelectedObjects.end(); iter++)
+ {
+ LLViewerObject *objectp = *iter;
+ if (select_linked_set)
+ {
+ LLViewerObject *rootp = (LLViewerObject*)objectp->getRoot();
+ roots.insert(rootp);
+ }
+ else
+ {
+ roots.insert(objectp);
+ }
+ }
+
+ // remove highlight nodes not in roots list
+ std::vector<LLSelectNode*> remove_these_nodes;
+ std::vector<LLViewerObject*> remove_these_roots;
+
+ for (LLObjectSelection::iterator iter = mHighlightedObjects->begin();
+ iter != mHighlightedObjects->end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* objectp = node->getObject();
+ if (!objectp)
+ continue;
+ if (objectp->isRoot() || !select_linked_set)
+ {
+ if (roots.count(objectp) == 0)
+ {
+ remove_these_nodes.push_back(node);
+ }
+ else
+ {
+ remove_these_roots.push_back(objectp);
+ }
+ }
+ else
+ {
+ LLViewerObject* rootp = (LLViewerObject*)objectp->getRoot();
+
+ if (roots.count(rootp) == 0)
+ {
+ remove_these_nodes.push_back(node);
+ }
+ }
+ }
+
+ // remove all highlight nodes no longer in rectangle selection
+ for (std::vector<LLSelectNode*>::iterator iter = remove_these_nodes.begin();
+ iter != remove_these_nodes.end(); ++iter)
+ {
+ LLSelectNode* nodep = *iter;
+ mHighlightedObjects->removeNode(nodep);
+ }
+
+ // remove all root objects already being highlighted
+ for (std::vector<LLViewerObject*>::iterator iter = remove_these_roots.begin();
+ iter != remove_these_roots.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+ roots.erase(objectp);
+ }
+
+ // add all new objects in rectangle selection
+ for (std::set<LLViewerObject*>::iterator iter = roots.begin();
+ iter != roots.end(); iter++)
+ {
+ LLViewerObject* objectp = *iter;
+ if (!canSelectObject(objectp))
+ {
+ continue;
+ }
+
+ LLSelectNode* rect_select_root_node = new LLSelectNode(objectp, TRUE);
+ rect_select_root_node->selectAllTEs(TRUE);
+
+ if (!select_linked_set)
+ {
+ rect_select_root_node->mIndividualSelection = TRUE;
+ }
+ else
+ {
+ LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child_objectp = *iter;
+
+ if (!canSelectObject(child_objectp))
+ {
+ continue;
+ }
+
+ LLSelectNode* rect_select_node = new LLSelectNode(child_objectp, TRUE);
+ rect_select_node->selectAllTEs(TRUE);
+ mHighlightedObjects->addNodeAtEnd(rect_select_node);
+ }
+ }
+
+ // Add the root last, to preserve order for link operations.
+ mHighlightedObjects->addNodeAtEnd(rect_select_root_node);
+ }
+
+ num_sils_genned = 0;
+
+ // render silhouettes for highlighted objects
+ //BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL);
+ for (S32 pass = 0; pass < 2; pass++)
+ {
+ for (LLObjectSelection::iterator iter = mHighlightedObjects->begin();
+ iter != mHighlightedObjects->end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* objectp = node->getObject();
+ if (!objectp)
+ continue;
+
+ // do roots first, then children so that root flags are cleared ASAP
+ BOOL roots_only = (pass == 0);
+ BOOL is_root = objectp->isRootEdit();
+ if (roots_only != is_root)
+ {
+ continue;
+ }
+
+ if (!node->mSilhouetteExists
+ || objectp->isChanged(LLXform::SILHOUETTE)
+ || (objectp->getParent() && objectp->getParent()->isChanged(LLXform::SILHOUETTE)))
+ {
+ if (num_sils_genned++ < MAX_SILS_PER_FRAME)
+ {
+ generateSilhouette(node, LLViewerCamera::getInstance()->getOrigin());
+ changed_objects.push_back(objectp);
+ }
+ else if (objectp->isAttachment() && objectp->getRootEdit()->mDrawable.notNull())
+ {
+ //RN: hack for orthogonal projection of HUD attachments
+ LLViewerJointAttachment* attachment_pt = (LLViewerJointAttachment*)objectp->getRootEdit()->mDrawable->getParent();
+ if (attachment_pt && attachment_pt->getIsHUDAttachment())
+ {
+ LLVector3 camera_pos = LLVector3(-10000.f, 0.f, 0.f);
+ generateSilhouette(node, camera_pos);
+ }
+ }
+ }
+ //LLColor4 highlight_color;
+ //
+ //if (subtracting_from_selection)
+ //{
+ // node->renderOneSilhouette(LLColor4::red);
+ //}
+ //else if (!objectp->isSelected())
+ //{
+ // highlight_color = objectp->isRoot() ? sHighlightParentColor : sHighlightChildColor;
+ // node->renderOneSilhouette(highlight_color);
+ //}
+ }
+ }
+ //mSilhouetteImagep->unbindTexture(0, GL_TEXTURE_2D);
+ }
+ else
+ {
+ mHighlightedObjects->deleteAllNodes();
+ }
+
+ for (std::vector<LLViewerObject*>::iterator iter = changed_objects.begin();
+ iter != changed_objects.end(); ++iter)
+ {
+ // clear flags after traversing node list (as child objects need to refer to parent flags, etc)
+ LLViewerObject* objectp = *iter;
+ objectp->clearChanged(LLXform::MOVED | LLXform::SILHOUETTE);
+ }
}
void LLSelectMgr::updateSelectionSilhouette(LLObjectSelectionHandle object_handle, S32& num_sils_genned, std::vector<LLViewerObject*>& changed_objects)
{
- if (object_handle->getNumNodes())
- {
- //gGLSPipelineSelection.set();
-
- //mSilhouetteImagep->bindTexture();
- //glAlphaFunc(GL_GREATER, sHighlightAlphaTest);
-
- for (S32 pass = 0; pass < 2; pass++)
- {
- for (LLObjectSelection::iterator iter = object_handle->begin();
- iter != object_handle->end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* objectp = node->getObject();
- if (!objectp)
- continue;
- // do roots first, then children so that root flags are cleared ASAP
- BOOL roots_only = (pass == 0);
- BOOL is_root = (objectp->isRootEdit());
- if (roots_only != is_root || objectp->mDrawable.isNull())
- {
- continue;
- }
-
- if (!node->mSilhouetteExists
- || objectp->isChanged(LLXform::SILHOUETTE)
- || (objectp->getParent() && objectp->getParent()->isChanged(LLXform::SILHOUETTE)))
- {
- if (num_sils_genned++ < MAX_SILS_PER_FRAME)// && objectp->mDrawable->isVisible())
- {
- generateSilhouette(node, LLViewerCamera::getInstance()->getOrigin());
- changed_objects.push_back(objectp);
- }
- else if (objectp->isAttachment())
- {
- //RN: hack for orthogonal projection of HUD attachments
- LLViewerJointAttachment* attachment_pt = (LLViewerJointAttachment*)objectp->getRootEdit()->mDrawable->getParent();
- if (attachment_pt && attachment_pt->getIsHUDAttachment())
- {
- LLVector3 camera_pos = LLVector3(-10000.f, 0.f, 0.f);
- generateSilhouette(node, camera_pos);
- }
- }
- }
- }
- }
- }
+ if (object_handle->getNumNodes())
+ {
+ //gGLSPipelineSelection.set();
+
+ //mSilhouetteImagep->bindTexture();
+ //glAlphaFunc(GL_GREATER, sHighlightAlphaTest);
+
+ for (S32 pass = 0; pass < 2; pass++)
+ {
+ for (LLObjectSelection::iterator iter = object_handle->begin();
+ iter != object_handle->end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* objectp = node->getObject();
+ if (!objectp)
+ continue;
+ // do roots first, then children so that root flags are cleared ASAP
+ BOOL roots_only = (pass == 0);
+ BOOL is_root = (objectp->isRootEdit());
+ if (roots_only != is_root || objectp->mDrawable.isNull())
+ {
+ continue;
+ }
+
+ if (!node->mSilhouetteExists
+ || objectp->isChanged(LLXform::SILHOUETTE)
+ || (objectp->getParent() && objectp->getParent()->isChanged(LLXform::SILHOUETTE)))
+ {
+ if (num_sils_genned++ < MAX_SILS_PER_FRAME)// && objectp->mDrawable->isVisible())
+ {
+ generateSilhouette(node, LLViewerCamera::getInstance()->getOrigin());
+ changed_objects.push_back(objectp);
+ }
+ else if (objectp->isAttachment())
+ {
+ //RN: hack for orthogonal projection of HUD attachments
+ LLViewerJointAttachment* attachment_pt = (LLViewerJointAttachment*)objectp->getRootEdit()->mDrawable->getParent();
+ if (attachment_pt && attachment_pt->getIsHUDAttachment())
+ {
+ LLVector3 camera_pos = LLVector3(-10000.f, 0.f, 0.f);
+ generateSilhouette(node, camera_pos);
+ }
+ }
+ }
+ }
+ }
+ }
}
void LLSelectMgr::renderSilhouettes(BOOL for_hud)
{
- if (!mRenderSilhouettes || !mRenderHighlightSelections)
- {
- return;
- }
-
- gGL.getTexUnit(0)->bind(mSilhouetteImagep);
- LLGLSPipelineSelection gls_select;
- LLGLEnable blend(GL_BLEND);
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
-
- if (isAgentAvatarValid() && for_hud)
- {
- LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
-
- F32 cur_zoom = gAgentCamera.mHUDCurZoom;
-
- // set up transform to encompass bounding box of HUD
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadIdentity();
- F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
- gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.pushUIMatrix();
- gGL.loadUIIdentity();
- gGL.loadIdentity();
- gGL.loadMatrix(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
- gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
- gGL.scalef(cur_zoom, cur_zoom, cur_zoom);
- }
-
- bool wireframe_selection = (gFloaterTools && gFloaterTools->getVisible()) || LLSelectMgr::sRenderHiddenSelections;
- F32 fogCfx = (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal() - gAgentCamera.getCameraPositionGlobal()).magVec() / (LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec() * 4), 0.0, 1.0);
-
- static LLColor4 sParentColor = LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha);
- static LLColor4 sChildColor = LLColor4(sSilhouetteChildColor[VRED], sSilhouetteChildColor[VGREEN], sSilhouetteChildColor[VBLUE], LLSelectMgr::sHighlightAlpha);
-
- auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp, LLColor4 hlColor)
- {
- LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
-
- if (shader)
- {
- gDebugProgram.bind();
- }
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
-
- BOOL is_hud_object = objectp->isHUDAttachment();
-
- if (!is_hud_object)
- {
- gGL.loadIdentity();
- gGL.multMatrix(gGLModelView);
- }
-
- if (objectp->mDrawable->isActive())
- {
- gGL.multMatrix((F32*)objectp->getRenderMatrix().mMatrix);
- }
- else if (!is_hud_object)
- {
- LLVector3 trans = objectp->getRegion()->getOriginAgent();
- gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
- }
-
- bool bRenderHidenSelection = node->isTransient() ? false : LLSelectMgr::sRenderHiddenSelections;
-
-
- LLVOVolume* vobj = objectp->mDrawable->getVOVolume();
- if (vobj)
- {
- LLVertexBuffer::unbind();
- gGL.pushMatrix();
- gGL.multMatrix((F32*)vobj->getRelativeXform().mMatrix);
-
- if (objectp->mDrawable->isState(LLDrawable::RIGGED))
- {
- vobj->updateRiggedVolume(true);
- }
- }
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- S32 num_tes = llmin((S32)objectp->getNumTEs(), (S32)objectp->getNumFaces()); // avatars have TEs but no faces
- for (S32 te = 0; te < num_tes; ++te)
- {
- if (node->isTESelected(te))
- {
- objectp->mDrawable->getFace(te)->renderOneWireframe(hlColor, fogCfx, wireframe_selection, bRenderHidenSelection, nullptr != shader);
- }
- }
-
- gGL.popMatrix();
- gGL.popMatrix();
-
- glLineWidth(1.f);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
- if (shader)
- {
- shader->bind();
- }
- };
-
- if (mSelectedObjects->getNumNodes())
- {
- LLUUID inspect_item_id= LLUUID::null;
- LLFloaterInspect* inspect_instance = LLFloaterReg::getTypedInstance<LLFloaterInspect>("inspect");
- if(inspect_instance && inspect_instance->getVisible())
- {
- inspect_item_id = inspect_instance->getSelectedUUID();
- }
- else
- {
- LLSidepanelTaskInfo *panel_task_info = LLSidepanelTaskInfo::getActivePanel();
- if (panel_task_info)
- {
- inspect_item_id = panel_task_info->getSelectedUUID();
- }
- }
-
- LLUUID focus_item_id = LLViewerMediaFocus::getInstance()->getFocusedObjectID();
- for (S32 pass = 0; pass < 2; pass++)
- {
- for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
- iter != mSelectedObjects->end(); iter++)
- {
- LLSelectNode* node = *iter;
-
+ if (!mRenderSilhouettes || !mRenderHighlightSelections)
+ {
+ return;
+ }
+
+ gGL.getTexUnit(0)->bind(mSilhouetteImagep);
+ LLGLSPipelineSelection gls_select;
+ LLGLEnable blend(GL_BLEND);
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+
+ if (isAgentAvatarValid() && for_hud)
+ {
+ LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
+
+ F32 cur_zoom = gAgentCamera.mHUDCurZoom;
+
+ // set up transform to encompass bounding box of HUD
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
+ gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.pushUIMatrix();
+ gGL.loadUIIdentity();
+ gGL.loadIdentity();
+ gGL.loadMatrix(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
+ gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
+ gGL.scalef(cur_zoom, cur_zoom, cur_zoom);
+ }
+
+ bool wireframe_selection = (gFloaterTools && gFloaterTools->getVisible()) || LLSelectMgr::sRenderHiddenSelections;
+ F32 fogCfx = (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal() - gAgentCamera.getCameraPositionGlobal()).magVec() / (LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec() * 4), 0.0, 1.0);
+
+ static LLColor4 sParentColor = LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha);
+ static LLColor4 sChildColor = LLColor4(sSilhouetteChildColor[VRED], sSilhouetteChildColor[VGREEN], sSilhouetteChildColor[VBLUE], LLSelectMgr::sHighlightAlpha);
+
+ auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp, LLColor4 hlColor)
+ {
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+ if (shader)
+ {
+ gDebugProgram.bind();
+ }
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+
+ BOOL is_hud_object = objectp->isHUDAttachment();
+
+ if (!is_hud_object)
+ {
+ gGL.loadIdentity();
+ gGL.multMatrix(gGLModelView);
+ }
+
+ if (objectp->mDrawable->isActive())
+ {
+ gGL.multMatrix((F32*)objectp->getRenderMatrix().mMatrix);
+ }
+ else if (!is_hud_object)
+ {
+ LLVector3 trans = objectp->getRegion()->getOriginAgent();
+ gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+ }
+
+ bool bRenderHidenSelection = node->isTransient() ? false : LLSelectMgr::sRenderHiddenSelections;
+
+
+ LLVOVolume* vobj = objectp->mDrawable->getVOVolume();
+ if (vobj)
+ {
+ LLVertexBuffer::unbind();
+ gGL.pushMatrix();
+ gGL.multMatrix((F32*)vobj->getRelativeXform().mMatrix);
+
+ if (objectp->mDrawable->isState(LLDrawable::RIGGED))
+ {
+ vobj->updateRiggedVolume(true);
+ }
+ }
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
+ S32 num_tes = llmin((S32)objectp->getNumTEs(), (S32)objectp->getNumFaces()); // avatars have TEs but no faces
+ for (S32 te = 0; te < num_tes; ++te)
+ {
+ if (node->isTESelected(te))
+ {
+ objectp->mDrawable->getFace(te)->renderOneWireframe(hlColor, fogCfx, wireframe_selection, bRenderHidenSelection, nullptr != shader);
+ }
+ }
+
+ gGL.popMatrix();
+ gGL.popMatrix();
+
+ glLineWidth(1.f);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
+ if (shader)
+ {
+ shader->bind();
+ }
+ };
+
+ if (mSelectedObjects->getNumNodes())
+ {
+ LLUUID inspect_item_id= LLUUID::null;
+ LLFloaterInspect* inspect_instance = LLFloaterReg::getTypedInstance<LLFloaterInspect>("inspect");
+ if(inspect_instance && inspect_instance->getVisible())
+ {
+ inspect_item_id = inspect_instance->getSelectedUUID();
+ }
+ else
+ {
+ LLSidepanelTaskInfo *panel_task_info = LLSidepanelTaskInfo::getActivePanel();
+ if (panel_task_info)
+ {
+ inspect_item_id = panel_task_info->getSelectedUUID();
+ }
+ }
+
+ LLUUID focus_item_id = LLViewerMediaFocus::getInstance()->getFocusedObjectID();
+ for (S32 pass = 0; pass < 2; pass++)
+ {
+ for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+ iter != mSelectedObjects->end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+
if (getTEMode() && !node->hasSelectedTE())
continue;
- LLViewerObject* objectp = node->getObject();
- if (!objectp)
- continue;
+ LLViewerObject* objectp = node->getObject();
+ if (!objectp)
+ continue;
- if (objectp->mDrawable
- && objectp->mDrawable->getVOVolume()
+ if (objectp->mDrawable
+ && objectp->mDrawable->getVOVolume()
&& objectp->mDrawable->getVOVolume()->isMesh())
{
LLColor4 hlColor = objectp->isRootEdit() ? sParentColor : sChildColor;
@@ -6521,145 +6521,145 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
node->renderOneSilhouette(sSilhouetteChildColor);
}
}
- } //for all selected node's
- } //for pass
- }
-
- if (mHighlightedObjects->getNumNodes())
- {
- // render silhouettes for highlighted objects
- BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL);
- for (S32 pass = 0; pass < 2; pass++)
- {
- for (LLObjectSelection::iterator iter = mHighlightedObjects->begin();
- iter != mHighlightedObjects->end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* objectp = node->getObject();
- if (!objectp)
- continue;
- if (objectp->isHUDAttachment() != for_hud)
- {
- continue;
- }
-
- LLColor4 highlight_color = objectp->isRoot() ? sHighlightParentColor : sHighlightChildColor;
- if (objectp->mDrawable
- && objectp->mDrawable->getVOVolume()
- && objectp->mDrawable->getVOVolume()->isMesh())
- {
- renderMeshSelection_f(node, objectp, subtracting_from_selection ? LLColor4::red : highlight_color);
- }
- else if (subtracting_from_selection)
- {
- node->renderOneSilhouette(LLColor4::red);
- }
- else if (!objectp->isSelected())
- {
- node->renderOneSilhouette(highlight_color);
- }
- }
- }
- }
-
- if (isAgentAvatarValid() && for_hud)
- {
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
- gGL.popUIMatrix();
- stop_glerror();
- }
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ } //for all selected node's
+ } //for pass
+ }
+
+ if (mHighlightedObjects->getNumNodes())
+ {
+ // render silhouettes for highlighted objects
+ BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL);
+ for (S32 pass = 0; pass < 2; pass++)
+ {
+ for (LLObjectSelection::iterator iter = mHighlightedObjects->begin();
+ iter != mHighlightedObjects->end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* objectp = node->getObject();
+ if (!objectp)
+ continue;
+ if (objectp->isHUDAttachment() != for_hud)
+ {
+ continue;
+ }
+
+ LLColor4 highlight_color = objectp->isRoot() ? sHighlightParentColor : sHighlightChildColor;
+ if (objectp->mDrawable
+ && objectp->mDrawable->getVOVolume()
+ && objectp->mDrawable->getVOVolume()->isMesh())
+ {
+ renderMeshSelection_f(node, objectp, subtracting_from_selection ? LLColor4::red : highlight_color);
+ }
+ else if (subtracting_from_selection)
+ {
+ node->renderOneSilhouette(LLColor4::red);
+ }
+ else if (!objectp->isSelected())
+ {
+ node->renderOneSilhouette(highlight_color);
+ }
+ }
+ }
+ }
+
+ if (isAgentAvatarValid() && for_hud)
+ {
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+ gGL.popUIMatrix();
+ stop_glerror();
+ }
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
void LLSelectMgr::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point)
{
- LLViewerObject* objectp = nodep->getObject();
+ LLViewerObject* objectp = nodep->getObject();
- if (objectp && objectp->getPCode() == LL_PCODE_VOLUME)
- {
- ((LLVOVolume*)objectp)->generateSilhouette(nodep, view_point);
- }
+ if (objectp && objectp->getPCode() == LL_PCODE_VOLUME)
+ {
+ ((LLVOVolume*)objectp)->generateSilhouette(nodep, view_point);
+ }
}
//
// Utility classes
//
LLSelectNode::LLSelectNode(LLViewerObject* object, BOOL glow)
-: mObject(object),
- mIndividualSelection(FALSE),
- mTransient(FALSE),
- mValid(FALSE),
- mPermissions(new LLPermissions()),
- mInventorySerial(0),
- mSilhouetteExists(FALSE),
- mDuplicated(FALSE),
- mTESelectMask(0),
- mLastTESelected(0),
- mName(LLStringUtil::null),
- mDescription(LLStringUtil::null),
- mTouchName(LLStringUtil::null),
- mSitName(LLStringUtil::null),
- mCreationDate(0)
-{
- saveColors();
- saveShinyColors();
+: mObject(object),
+ mIndividualSelection(FALSE),
+ mTransient(FALSE),
+ mValid(FALSE),
+ mPermissions(new LLPermissions()),
+ mInventorySerial(0),
+ mSilhouetteExists(FALSE),
+ mDuplicated(FALSE),
+ mTESelectMask(0),
+ mLastTESelected(0),
+ mName(LLStringUtil::null),
+ mDescription(LLStringUtil::null),
+ mTouchName(LLStringUtil::null),
+ mSitName(LLStringUtil::null),
+ mCreationDate(0)
+{
+ saveColors();
+ saveShinyColors();
}
LLSelectNode::LLSelectNode(const LLSelectNode& nodep)
{
- mTESelectMask = nodep.mTESelectMask;
- mLastTESelected = nodep.mLastTESelected;
-
- mIndividualSelection = nodep.mIndividualSelection;
-
- mValid = nodep.mValid;
- mTransient = nodep.mTransient;
- mPermissions = new LLPermissions(*nodep.mPermissions);
- mSaleInfo = nodep.mSaleInfo;;
- mAggregatePerm = nodep.mAggregatePerm;
- mAggregateTexturePerm = nodep.mAggregateTexturePerm;
- mAggregateTexturePermOwner = nodep.mAggregateTexturePermOwner;
- mName = nodep.mName;
- mDescription = nodep.mDescription;
- mCategory = nodep.mCategory;
- mInventorySerial = 0;
- mSavedPositionLocal = nodep.mSavedPositionLocal;
- mSavedPositionGlobal = nodep.mSavedPositionGlobal;
- mSavedScale = nodep.mSavedScale;
- mSavedRotation = nodep.mSavedRotation;
- mDuplicated = nodep.mDuplicated;
- mDuplicatePos = nodep.mDuplicatePos;
- mDuplicateRot = nodep.mDuplicateRot;
- mItemID = nodep.mItemID;
- mFolderID = nodep.mFolderID;
- mFromTaskID = nodep.mFromTaskID;
- mTouchName = nodep.mTouchName;
- mSitName = nodep.mSitName;
- mCreationDate = nodep.mCreationDate;
-
- mSilhouetteVertices = nodep.mSilhouetteVertices;
- mSilhouetteNormals = nodep.mSilhouetteNormals;
- mSilhouetteExists = nodep.mSilhouetteExists;
- mObject = nodep.mObject;
-
- std::vector<LLColor4>::const_iterator color_iter;
- mSavedColors.clear();
- for (color_iter = nodep.mSavedColors.begin(); color_iter != nodep.mSavedColors.end(); ++color_iter)
- {
- mSavedColors.push_back(*color_iter);
- }
- mSavedShinyColors.clear();
- for (color_iter = nodep.mSavedShinyColors.begin(); color_iter != nodep.mSavedShinyColors.end(); ++color_iter)
- {
- mSavedShinyColors.push_back(*color_iter);
- }
-
- saveTextures(nodep.mSavedTextures);
+ mTESelectMask = nodep.mTESelectMask;
+ mLastTESelected = nodep.mLastTESelected;
+
+ mIndividualSelection = nodep.mIndividualSelection;
+
+ mValid = nodep.mValid;
+ mTransient = nodep.mTransient;
+ mPermissions = new LLPermissions(*nodep.mPermissions);
+ mSaleInfo = nodep.mSaleInfo;;
+ mAggregatePerm = nodep.mAggregatePerm;
+ mAggregateTexturePerm = nodep.mAggregateTexturePerm;
+ mAggregateTexturePermOwner = nodep.mAggregateTexturePermOwner;
+ mName = nodep.mName;
+ mDescription = nodep.mDescription;
+ mCategory = nodep.mCategory;
+ mInventorySerial = 0;
+ mSavedPositionLocal = nodep.mSavedPositionLocal;
+ mSavedPositionGlobal = nodep.mSavedPositionGlobal;
+ mSavedScale = nodep.mSavedScale;
+ mSavedRotation = nodep.mSavedRotation;
+ mDuplicated = nodep.mDuplicated;
+ mDuplicatePos = nodep.mDuplicatePos;
+ mDuplicateRot = nodep.mDuplicateRot;
+ mItemID = nodep.mItemID;
+ mFolderID = nodep.mFolderID;
+ mFromTaskID = nodep.mFromTaskID;
+ mTouchName = nodep.mTouchName;
+ mSitName = nodep.mSitName;
+ mCreationDate = nodep.mCreationDate;
+
+ mSilhouetteVertices = nodep.mSilhouetteVertices;
+ mSilhouetteNormals = nodep.mSilhouetteNormals;
+ mSilhouetteExists = nodep.mSilhouetteExists;
+ mObject = nodep.mObject;
+
+ std::vector<LLColor4>::const_iterator color_iter;
+ mSavedColors.clear();
+ for (color_iter = nodep.mSavedColors.begin(); color_iter != nodep.mSavedColors.end(); ++color_iter)
+ {
+ mSavedColors.push_back(*color_iter);
+ }
+ mSavedShinyColors.clear();
+ for (color_iter = nodep.mSavedShinyColors.begin(); color_iter != nodep.mSavedShinyColors.end(); ++color_iter)
+ {
+ mSavedShinyColors.push_back(*color_iter);
+ }
+
+ saveTextures(nodep.mSavedTextures);
saveGLTFMaterials(nodep.mSavedGLTFMaterialIds, nodep.mSavedGLTFOverrideMaterials);
}
@@ -6683,115 +6683,115 @@ LLSelectNode::~LLSelectNode()
}
- delete mPermissions;
- mPermissions = NULL;
+ delete mPermissions;
+ mPermissions = NULL;
}
void LLSelectNode::selectAllTEs(BOOL b)
{
- mTESelectMask = b ? TE_SELECT_MASK_ALL : 0x0;
- mLastTESelected = 0;
+ mTESelectMask = b ? TE_SELECT_MASK_ALL : 0x0;
+ mLastTESelected = 0;
}
void LLSelectNode::selectTE(S32 te_index, BOOL selected)
{
- if (te_index < 0 || te_index >= SELECT_MAX_TES)
- {
- return;
- }
- S32 mask = 0x1 << te_index;
- if(selected)
- {
- mTESelectMask |= mask;
- }
- else
- {
- mTESelectMask &= ~mask;
- }
- mLastTESelected = te_index;
+ if (te_index < 0 || te_index >= SELECT_MAX_TES)
+ {
+ return;
+ }
+ S32 mask = 0x1 << te_index;
+ if(selected)
+ {
+ mTESelectMask |= mask;
+ }
+ else
+ {
+ mTESelectMask &= ~mask;
+ }
+ mLastTESelected = te_index;
}
BOOL LLSelectNode::isTESelected(S32 te_index) const
{
- if (te_index < 0 || te_index >= mObject->getNumTEs())
- {
- return FALSE;
- }
- return (mTESelectMask & (0x1 << te_index)) != 0;
+ if (te_index < 0 || te_index >= mObject->getNumTEs())
+ {
+ return FALSE;
+ }
+ return (mTESelectMask & (0x1 << te_index)) != 0;
}
S32 LLSelectNode::getLastSelectedTE() const
{
- if (!isTESelected(mLastTESelected))
- {
- return -1;
- }
- return mLastTESelected;
+ if (!isTESelected(mLastTESelected))
+ {
+ return -1;
+ }
+ return mLastTESelected;
}
LLViewerObject* LLSelectNode::getObject()
{
- if (!mObject)
- {
- return NULL;
- }
- else if (mObject->isDead())
- {
- mObject = NULL;
- }
- return mObject;
+ if (!mObject)
+ {
+ return NULL;
+ }
+ else if (mObject->isDead())
+ {
+ mObject = NULL;
+ }
+ return mObject;
}
void LLSelectNode::setObject(LLViewerObject* object)
{
- mObject = object;
+ mObject = object;
}
void LLSelectNode::saveColors()
{
- if (mObject.notNull())
- {
- mSavedColors.clear();
- for (S32 i = 0; i < mObject->getNumTEs(); i++)
- {
- const LLTextureEntry* tep = mObject->getTE(i);
- mSavedColors.push_back(tep->getColor());
- }
- }
+ if (mObject.notNull())
+ {
+ mSavedColors.clear();
+ for (S32 i = 0; i < mObject->getNumTEs(); i++)
+ {
+ const LLTextureEntry* tep = mObject->getTE(i);
+ mSavedColors.push_back(tep->getColor());
+ }
+ }
}
void LLSelectNode::saveShinyColors()
{
- if (mObject.notNull())
- {
- mSavedShinyColors.clear();
- for (S32 i = 0; i < mObject->getNumTEs(); i++)
- {
- const LLMaterialPtr mat = mObject->getTE(i)->getMaterialParams();
- if (!mat.isNull())
- {
- mSavedShinyColors.push_back(mat->getSpecularLightColor());
- }
- else
- {
- mSavedShinyColors.push_back(LLColor4::white);
- }
- }
- }
+ if (mObject.notNull())
+ {
+ mSavedShinyColors.clear();
+ for (S32 i = 0; i < mObject->getNumTEs(); i++)
+ {
+ const LLMaterialPtr mat = mObject->getTE(i)->getMaterialParams();
+ if (!mat.isNull())
+ {
+ mSavedShinyColors.push_back(mat->getSpecularLightColor());
+ }
+ else
+ {
+ mSavedShinyColors.push_back(LLColor4::white);
+ }
+ }
+ }
}
void LLSelectNode::saveTextures(const uuid_vec_t& textures)
{
- if (mObject.notNull())
- {
- mSavedTextures.clear();
+ if (mObject.notNull())
+ {
+ mSavedTextures.clear();
- for (uuid_vec_t::const_iterator texture_it = textures.begin();
- texture_it != textures.end(); ++texture_it)
- {
- mSavedTextures.push_back(*texture_it);
- }
- }
+ for (uuid_vec_t::const_iterator texture_it = textures.begin();
+ texture_it != textures.end(); ++texture_it)
+ {
+ mSavedTextures.push_back(*texture_it);
+ }
+ }
}
void LLSelectNode::saveGLTFMaterials(const uuid_vec_t& materials, const gltf_materials_vec_t& override_materials)
@@ -6817,136 +6817,136 @@ void LLSelectNode::saveGLTFMaterials(const uuid_vec_t& materials, const gltf_mat
void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
{
- mTextureScaleRatios.clear();
-
- if (mObject.notNull())
- {
-
- LLVector3 scale = mObject->getScale();
-
- for (U8 i = 0; i < mObject->getNumTEs(); i++)
- {
- F32 diffuse_s = 1.0f;
- F32 diffuse_t = 1.0f;
-
- LLVector3 v;
- const LLTextureEntry* tep = mObject->getTE(i);
- if (!tep)
- continue;
-
- U32 s_axis = VX;
- U32 t_axis = VY;
- LLPrimitive::getTESTAxes(i, &s_axis, &t_axis);
-
- tep->getScale(&diffuse_s,&diffuse_t);
-
- if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR)
- {
- v.mV[s_axis] = diffuse_s*scale.mV[s_axis];
- v.mV[t_axis] = diffuse_t*scale.mV[t_axis];
- mTextureScaleRatios.push_back(v);
- }
- else
- {
- v.mV[s_axis] = diffuse_s/scale.mV[s_axis];
- v.mV[t_axis] = diffuse_t/scale.mV[t_axis];
- mTextureScaleRatios.push_back(v);
- }
- }
- }
+ mTextureScaleRatios.clear();
+
+ if (mObject.notNull())
+ {
+
+ LLVector3 scale = mObject->getScale();
+
+ for (U8 i = 0; i < mObject->getNumTEs(); i++)
+ {
+ F32 diffuse_s = 1.0f;
+ F32 diffuse_t = 1.0f;
+
+ LLVector3 v;
+ const LLTextureEntry* tep = mObject->getTE(i);
+ if (!tep)
+ continue;
+
+ U32 s_axis = VX;
+ U32 t_axis = VY;
+ LLPrimitive::getTESTAxes(i, &s_axis, &t_axis);
+
+ tep->getScale(&diffuse_s,&diffuse_t);
+
+ if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR)
+ {
+ v.mV[s_axis] = diffuse_s*scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t*scale.mV[t_axis];
+ mTextureScaleRatios.push_back(v);
+ }
+ else
+ {
+ v.mV[s_axis] = diffuse_s/scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t/scale.mV[t_axis];
+ mTextureScaleRatios.push_back(v);
+ }
+ }
+ }
}
// This implementation should be similar to LLTask::allowOperationOnTask
BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const
{
- // Extract ownership.
- BOOL object_is_group_owned = FALSE;
- LLUUID object_owner_id;
- mPermissions->getOwnership(object_owner_id, object_is_group_owned);
-
- // Operations on invalid or public objects is not allowed.
- if (!mObject || (mObject->isDead()) || !mPermissions->isOwned())
- {
- return FALSE;
- }
-
- // The transfer permissions can never be given through proxy.
- if (PERM_TRANSFER == op)
- {
- // The owner of an agent-owned object can transfer to themselves.
- if ( !object_is_group_owned
- && (gAgent.getID() == object_owner_id) )
- {
- return TRUE;
- }
- else
- {
- // Otherwise check aggregate permissions.
- return mObject->permTransfer();
- }
- }
-
- if (PERM_MOVE == op
- || PERM_MODIFY == op)
- {
- // only owners can move or modify their attachments
- // no proxy allowed.
- if (mObject->isAttachment() && object_owner_id != gAgent.getID())
- {
- return FALSE;
- }
- }
-
- // Calculate proxy_agent_id and group_id to use for permissions checks.
- // proxy_agent_id may be set to the object owner through group powers.
- // group_id can only be set to the object's group, if the agent is in that group.
- LLUUID group_id = LLUUID::null;
- LLUUID proxy_agent_id = gAgent.getID();
-
- // Gods can always operate.
- if (gAgent.isGodlike())
- {
- return TRUE;
- }
-
- // Check if the agent is in the same group as the object.
- LLUUID object_group_id = mPermissions->getGroup();
- if (object_group_id.notNull() &&
- gAgent.isInGroup(object_group_id))
- {
- // Assume the object's group during this operation.
- group_id = object_group_id;
- }
-
- // Only allow proxy powers for PERM_COPY if the actual agent can
- // receive the item (ie has PERM_TRANSFER permissions).
- // NOTE: op == PERM_TRANSFER has already been handled, but if
- // that ever changes we need to BLOCK proxy powers for PERM_TRANSFER. DK 03/28/06
- if (PERM_COPY != op || mPermissions->allowTransferTo(gAgent.getID()))
- {
- // Check if the agent can assume ownership through group proxy or agent-granted proxy.
- if ( ( object_is_group_owned
- && gAgent.hasPowerInGroup(object_owner_id, group_proxy_power))
- // Only allow proxy for move, modify, and copy.
- || ( (PERM_MOVE == op || PERM_MODIFY == op || PERM_COPY == op)
- && (!object_is_group_owned
- && gAgent.isGrantedProxy(*mPermissions))))
- {
- // This agent is able to assume the ownership role for this operation.
- proxy_agent_id = object_owner_id;
- }
- }
-
- // We now have max ownership information.
- if (PERM_OWNER == op)
- {
- // This this was just a check for ownership, we can now return the answer.
- return (proxy_agent_id == object_owner_id ? TRUE : FALSE);
- }
-
- // check permissions to see if the agent can operate
- return (mPermissions->allowOperationBy(op, proxy_agent_id, group_id));
+ // Extract ownership.
+ BOOL object_is_group_owned = FALSE;
+ LLUUID object_owner_id;
+ mPermissions->getOwnership(object_owner_id, object_is_group_owned);
+
+ // Operations on invalid or public objects is not allowed.
+ if (!mObject || (mObject->isDead()) || !mPermissions->isOwned())
+ {
+ return FALSE;
+ }
+
+ // The transfer permissions can never be given through proxy.
+ if (PERM_TRANSFER == op)
+ {
+ // The owner of an agent-owned object can transfer to themselves.
+ if ( !object_is_group_owned
+ && (gAgent.getID() == object_owner_id) )
+ {
+ return TRUE;
+ }
+ else
+ {
+ // Otherwise check aggregate permissions.
+ return mObject->permTransfer();
+ }
+ }
+
+ if (PERM_MOVE == op
+ || PERM_MODIFY == op)
+ {
+ // only owners can move or modify their attachments
+ // no proxy allowed.
+ if (mObject->isAttachment() && object_owner_id != gAgent.getID())
+ {
+ return FALSE;
+ }
+ }
+
+ // Calculate proxy_agent_id and group_id to use for permissions checks.
+ // proxy_agent_id may be set to the object owner through group powers.
+ // group_id can only be set to the object's group, if the agent is in that group.
+ LLUUID group_id = LLUUID::null;
+ LLUUID proxy_agent_id = gAgent.getID();
+
+ // Gods can always operate.
+ if (gAgent.isGodlike())
+ {
+ return TRUE;
+ }
+
+ // Check if the agent is in the same group as the object.
+ LLUUID object_group_id = mPermissions->getGroup();
+ if (object_group_id.notNull() &&
+ gAgent.isInGroup(object_group_id))
+ {
+ // Assume the object's group during this operation.
+ group_id = object_group_id;
+ }
+
+ // Only allow proxy powers for PERM_COPY if the actual agent can
+ // receive the item (ie has PERM_TRANSFER permissions).
+ // NOTE: op == PERM_TRANSFER has already been handled, but if
+ // that ever changes we need to BLOCK proxy powers for PERM_TRANSFER. DK 03/28/06
+ if (PERM_COPY != op || mPermissions->allowTransferTo(gAgent.getID()))
+ {
+ // Check if the agent can assume ownership through group proxy or agent-granted proxy.
+ if ( ( object_is_group_owned
+ && gAgent.hasPowerInGroup(object_owner_id, group_proxy_power))
+ // Only allow proxy for move, modify, and copy.
+ || ( (PERM_MOVE == op || PERM_MODIFY == op || PERM_COPY == op)
+ && (!object_is_group_owned
+ && gAgent.isGrantedProxy(*mPermissions))))
+ {
+ // This agent is able to assume the ownership role for this operation.
+ proxy_agent_id = object_owner_id;
+ }
+ }
+
+ // We now have max ownership information.
+ if (PERM_OWNER == op)
+ {
+ // This this was just a check for ownership, we can now return the answer.
+ return (proxy_agent_id == object_owner_id ? TRUE : FALSE);
+ }
+
+ // check permissions to see if the agent can operate
+ return (mPermissions->allowOperationBy(op, proxy_agent_id, group_id));
}
//-----------------------------------------------------------------------------
@@ -6954,167 +6954,167 @@ BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power)
//-----------------------------------------------------------------------------
void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
{
- LLViewerObject* objectp = getObject();
- if (!objectp)
- {
- return;
- }
-
- LLDrawable* drawable = objectp->mDrawable;
- if(!drawable)
- {
- return;
- }
-
- LLVOVolume* vobj = drawable->getVOVolume();
- if (vobj && vobj->isMesh())
- {
- //This check (if(...)) with assert here just for ensure that this situation will not happens, and can be removed later. For example on the next release.
- llassert(!"renderOneWireframe() was removed SL-10194");
- return;
- }
-
- if (!mSilhouetteExists)
- {
- return;
- }
-
- BOOL is_hud_object = objectp->isHUDAttachment();
-
- if (mSilhouetteVertices.size() == 0 || mSilhouetteNormals.size() != mSilhouetteVertices.size())
- {
- return;
- }
-
-
- LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
-
- if (shader)
- { //use UI program for selection highlights (texture color modulated by vertex color)
- gUIProgram.bind();
- }
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.pushUIMatrix();
- gGL.loadUIIdentity();
-
- if (!is_hud_object)
- {
- gGL.loadIdentity();
- gGL.multMatrix(gGLModelView);
- }
-
-
- if (drawable->isActive())
- {
- gGL.multMatrix((F32*) objectp->getRenderMatrix().mMatrix);
- }
-
- LLVolume *volume = objectp->getVolume();
- if (volume)
- {
- F32 silhouette_thickness;
- if (isAgentAvatarValid() && is_hud_object)
- {
- silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgentCamera.mHUDCurZoom;
- }
- else
- {
- LLVector3 view_vector = LLViewerCamera::getInstance()->getOrigin() - objectp->getRenderPosition();
- silhouette_thickness = view_vector.magVec() * LLSelectMgr::sHighlightThickness * (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV());
- }
- F32 animationTime = (F32)LLFrameTimer::getElapsedSeconds();
-
- F32 u_coord = fmod(animationTime * LLSelectMgr::sHighlightUAnim, 1.f);
- F32 v_coord = 1.f - fmod(animationTime * LLSelectMgr::sHighlightVAnim, 1.f);
- F32 u_divisor = 1.f / ((F32)(mSilhouetteVertices.size() - 1));
-
- if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible())
- {
- gGL.flush();
- gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE);
-
+ LLViewerObject* objectp = getObject();
+ if (!objectp)
+ {
+ return;
+ }
+
+ LLDrawable* drawable = objectp->mDrawable;
+ if(!drawable)
+ {
+ return;
+ }
+
+ LLVOVolume* vobj = drawable->getVOVolume();
+ if (vobj && vobj->isMesh())
+ {
+ //This check (if(...)) with assert here just for ensure that this situation will not happens, and can be removed later. For example on the next release.
+ llassert(!"renderOneWireframe() was removed SL-10194");
+ return;
+ }
+
+ if (!mSilhouetteExists)
+ {
+ return;
+ }
+
+ BOOL is_hud_object = objectp->isHUDAttachment();
+
+ if (mSilhouetteVertices.size() == 0 || mSilhouetteNormals.size() != mSilhouetteVertices.size())
+ {
+ return;
+ }
+
+
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+ if (shader)
+ { //use UI program for selection highlights (texture color modulated by vertex color)
+ gUIProgram.bind();
+ }
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.pushUIMatrix();
+ gGL.loadUIIdentity();
+
+ if (!is_hud_object)
+ {
+ gGL.loadIdentity();
+ gGL.multMatrix(gGLModelView);
+ }
+
+
+ if (drawable->isActive())
+ {
+ gGL.multMatrix((F32*) objectp->getRenderMatrix().mMatrix);
+ }
+
+ LLVolume *volume = objectp->getVolume();
+ if (volume)
+ {
+ F32 silhouette_thickness;
+ if (isAgentAvatarValid() && is_hud_object)
+ {
+ silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgentCamera.mHUDCurZoom;
+ }
+ else
+ {
+ LLVector3 view_vector = LLViewerCamera::getInstance()->getOrigin() - objectp->getRenderPosition();
+ silhouette_thickness = view_vector.magVec() * LLSelectMgr::sHighlightThickness * (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV());
+ }
+ F32 animationTime = (F32)LLFrameTimer::getElapsedSeconds();
+
+ F32 u_coord = fmod(animationTime * LLSelectMgr::sHighlightUAnim, 1.f);
+ F32 v_coord = 1.f - fmod(animationTime * LLSelectMgr::sHighlightVAnim, 1.f);
+ F32 u_divisor = 1.f / ((F32)(mSilhouetteVertices.size() - 1));
+
+ if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible())
+ {
+ gGL.flush();
+ gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE);
+
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL);
gGL.flush();
- gGL.begin(LLRender::LINES);
- {
- gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
-
- for(S32 i = 0; i < mSilhouetteVertices.size(); i += 2)
- {
- u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
- gGL.texCoord2f( u_coord, v_coord );
- gGL.vertex3fv( mSilhouetteVertices[i].mV);
- u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
- gGL.texCoord2f( u_coord, v_coord );
- gGL.vertex3fv(mSilhouetteVertices[i+1].mV);
- }
- }
+ gGL.begin(LLRender::LINES);
+ {
+ gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
+
+ for(S32 i = 0; i < mSilhouetteVertices.size(); i += 2)
+ {
+ u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
+ gGL.texCoord2f( u_coord, v_coord );
+ gGL.vertex3fv( mSilhouetteVertices[i].mV);
+ u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
+ gGL.texCoord2f( u_coord, v_coord );
+ gGL.vertex3fv(mSilhouetteVertices[i+1].mV);
+ }
+ }
gGL.end();
- u_coord = fmod(animationTime * LLSelectMgr::sHighlightUAnim, 1.f);
- }
-
- gGL.flush();
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
- gGL.begin(LLRender::TRIANGLES);
- {
- for(S32 i = 0; i < mSilhouetteVertices.size(); i+=2)
- {
- if (!mSilhouetteNormals[i].isFinite() ||
- !mSilhouetteNormals[i+1].isFinite())
- { //skip skewed segments
- continue;
- }
-
- LLVector3 v[4];
- LLVector2 tc[4];
- v[0] = mSilhouetteVertices[i] + (mSilhouetteNormals[i] * silhouette_thickness);
- tc[0].set(u_coord, v_coord + LLSelectMgr::sHighlightVScale);
-
- v[1] = mSilhouetteVertices[i];
- tc[1].set(u_coord, v_coord);
-
- u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
-
- v[2] = mSilhouetteVertices[i+1] + (mSilhouetteNormals[i+1] * silhouette_thickness);
- tc[2].set(u_coord, v_coord + LLSelectMgr::sHighlightVScale);
-
- v[3] = mSilhouetteVertices[i+1];
- tc[3].set(u_coord,v_coord);
-
- gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.0f); //LLSelectMgr::sHighlightAlpha);
- gGL.texCoord2fv(tc[0].mV);
- gGL.vertex3fv( v[0].mV );
-
- gGL.color4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha);
- gGL.texCoord2fv( tc[1].mV );
- gGL.vertex3fv( v[1].mV );
-
- gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.0f); //LLSelectMgr::sHighlightAlpha);
- gGL.texCoord2fv( tc[2].mV );
- gGL.vertex3fv( v[2].mV );
-
- gGL.vertex3fv( v[2].mV );
-
- gGL.color4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha);
- gGL.texCoord2fv( tc[1].mV );
- gGL.vertex3fv( v[1].mV );
-
- gGL.texCoord2fv( tc[3].mV );
- gGL.vertex3fv( v[3].mV );
- }
- }
- gGL.end();
- gGL.flush();
- }
- gGL.popMatrix();
- gGL.popUIMatrix();
-
- if (shader)
- {
- shader->bind();
- }
+ u_coord = fmod(animationTime * LLSelectMgr::sHighlightUAnim, 1.f);
+ }
+
+ gGL.flush();
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ for(S32 i = 0; i < mSilhouetteVertices.size(); i+=2)
+ {
+ if (!mSilhouetteNormals[i].isFinite() ||
+ !mSilhouetteNormals[i+1].isFinite())
+ { //skip skewed segments
+ continue;
+ }
+
+ LLVector3 v[4];
+ LLVector2 tc[4];
+ v[0] = mSilhouetteVertices[i] + (mSilhouetteNormals[i] * silhouette_thickness);
+ tc[0].set(u_coord, v_coord + LLSelectMgr::sHighlightVScale);
+
+ v[1] = mSilhouetteVertices[i];
+ tc[1].set(u_coord, v_coord);
+
+ u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
+
+ v[2] = mSilhouetteVertices[i+1] + (mSilhouetteNormals[i+1] * silhouette_thickness);
+ tc[2].set(u_coord, v_coord + LLSelectMgr::sHighlightVScale);
+
+ v[3] = mSilhouetteVertices[i+1];
+ tc[3].set(u_coord,v_coord);
+
+ gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.0f); //LLSelectMgr::sHighlightAlpha);
+ gGL.texCoord2fv(tc[0].mV);
+ gGL.vertex3fv( v[0].mV );
+
+ gGL.color4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha);
+ gGL.texCoord2fv( tc[1].mV );
+ gGL.vertex3fv( v[1].mV );
+
+ gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.0f); //LLSelectMgr::sHighlightAlpha);
+ gGL.texCoord2fv( tc[2].mV );
+ gGL.vertex3fv( v[2].mV );
+
+ gGL.vertex3fv( v[2].mV );
+
+ gGL.color4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha);
+ gGL.texCoord2fv( tc[1].mV );
+ gGL.vertex3fv( v[1].mV );
+
+ gGL.texCoord2fv( tc[3].mV );
+ gGL.vertex3fv( v[3].mV );
+ }
+ }
+ gGL.end();
+ gGL.flush();
+ }
+ gGL.popMatrix();
+ gGL.popUIMatrix();
+
+ if (shader)
+ {
+ shader->bind();
+ }
}
//
@@ -7124,71 +7124,71 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
// *DEPRECATED: See header comment.
void dialog_refresh_all()
{
- // This is the easiest place to fire the update signal, as it will
- // make cleaning up the functions below easier. Also, sometimes entities
- // outside the selection manager change properties of selected objects
- // and call into this function. Yuck.
- LLSelectMgr::getInstance()->mUpdateSignal();
+ // This is the easiest place to fire the update signal, as it will
+ // make cleaning up the functions below easier. Also, sometimes entities
+ // outside the selection manager change properties of selected objects
+ // and call into this function. Yuck.
+ LLSelectMgr::getInstance()->mUpdateSignal();
- // *TODO: Eliminate all calls into outside classes below, make those
- // objects register with the update signal.
+ // *TODO: Eliminate all calls into outside classes below, make those
+ // objects register with the update signal.
- gFloaterTools->dirty();
+ gFloaterTools->dirty();
- gMenuObject->needsArrange();
+ gMenuObject->needsArrange();
- if( gMenuAttachmentSelf->getVisible() )
- {
- gMenuAttachmentSelf->arrange();
- }
- if( gMenuAttachmentOther->getVisible() )
- {
- gMenuAttachmentOther->arrange();
- }
+ if( gMenuAttachmentSelf->getVisible() )
+ {
+ gMenuAttachmentSelf->arrange();
+ }
+ if( gMenuAttachmentOther->getVisible() )
+ {
+ gMenuAttachmentOther->arrange();
+ }
- LLFloaterInspect* inspect_instance = LLFloaterReg::getTypedInstance<LLFloaterInspect>("inspect");
- if(inspect_instance)
- {
- inspect_instance->dirty();
- }
+ LLFloaterInspect* inspect_instance = LLFloaterReg::getTypedInstance<LLFloaterInspect>("inspect");
+ if(inspect_instance)
+ {
+ inspect_instance->dirty();
+ }
- LLSidepanelTaskInfo *panel_task_info = LLSidepanelTaskInfo::getActivePanel();
- if (panel_task_info)
- {
- panel_task_info->dirty();
- }
+ LLSidepanelTaskInfo *panel_task_info = LLSidepanelTaskInfo::getActivePanel();
+ if (panel_task_info)
+ {
+ panel_task_info->dirty();
+ }
}
S32 get_family_count(LLViewerObject *parent)
{
- if (!parent)
- {
- LL_WARNS() << "Trying to get_family_count on null parent!" << LL_ENDL;
- }
- S32 count = 1; // for this object
- LLViewerObject::const_child_list_t& child_list = parent->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
-
- if (!child)
- {
- LL_WARNS() << "Family object has NULL child! Show Doug." << LL_ENDL;
- }
- else if (child->isDead())
- {
- LL_WARNS() << "Family object has dead child object. Show Doug." << LL_ENDL;
- }
- else
- {
- if (LLSelectMgr::getInstance()->canSelectObject(child))
- {
- count += get_family_count( child );
- }
- }
- }
- return count;
+ if (!parent)
+ {
+ LL_WARNS() << "Trying to get_family_count on null parent!" << LL_ENDL;
+ }
+ S32 count = 1; // for this object
+ LLViewerObject::const_child_list_t& child_list = parent->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+
+ if (!child)
+ {
+ LL_WARNS() << "Family object has NULL child! Show Doug." << LL_ENDL;
+ }
+ else if (child->isDead())
+ {
+ LL_WARNS() << "Family object has dead child object. Show Doug." << LL_ENDL;
+ }
+ else
+ {
+ if (LLSelectMgr::getInstance()->canSelectObject(child))
+ {
+ count += get_family_count( child );
+ }
+ }
+ }
+ return count;
}
//-----------------------------------------------------------------------------
@@ -7199,106 +7199,106 @@ S32 get_family_count(LLViewerObject *parent)
// -----------------------------------------------------------------------------
void LLSelectMgr::updateSelectionCenter()
{
- const F32 MOVE_SELECTION_THRESHOLD = 1.f; // Movement threshold in meters for updating selection
- // center (tractor beam)
+ const F32 MOVE_SELECTION_THRESHOLD = 1.f; // Movement threshold in meters for updating selection
+ // center (tractor beam)
// override any avatar updates received
// Works only if avatar was repositioned
// and edit floater is visible
overrideAvatarUpdates();
- //override any object updates received
- //for selected objects
- overrideObjectUpdates();
-
- LLViewerObject* object = mSelectedObjects->getFirstObject();
- if (!object)
- {
- // nothing selected, probably grabbing
- // Ignore by setting to avatar origin.
- mSelectionCenterGlobal.clearVec();
- mShowSelection = FALSE;
- mSelectionBBox = LLBBox();
- resetAgentHUDZoom();
- }
- else
- {
- mSelectedObjects->mSelectType = getSelectTypeForObject(object);
-
- if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && isAgentAvatarValid())
- {
- // reset hud ZOOM
- resetAgentHUDZoom();
- }
-
- mShowSelection = FALSE;
- LLBBox bbox;
-
- // have stuff selected
- LLVector3d select_center;
- // keep a list of jointed objects for showing the joint HUDEffects
-
- // Initialize the bounding box to the root prim, so the BBox orientation
- // matches the root prim's (affecting the orientation of the manipulators).
- bbox.addBBoxAgent( (mSelectedObjects->getFirstRootObject(TRUE))->getBoundingBoxAgent() );
-
- for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
- iter != mSelectedObjects->end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if (!object)
- continue;
-
- LLViewerObject *root = object->getRootEdit();
- if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment
- !root->isChild(gAgentAvatarp) && // not the object you're sitting on
- !object->isAvatar()) // not another avatar
- {
- mShowSelection = TRUE;
- }
-
- bbox.addBBoxAgent( object->getBoundingBoxAgent() );
- }
-
- LLVector3 bbox_center_agent = bbox.getCenterAgent();
- mSelectionCenterGlobal = gAgent.getPosGlobalFromAgent(bbox_center_agent);
- mSelectionBBox = bbox;
-
- }
-
- if ( !(gAgentID == LLUUID::null))
- {
- LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
- if (mShowSelection)
- {
- LLVector3d select_center_global;
-
- if( tool->isEditing() )
- {
- select_center_global = tool->getEditingPointGlobal();
- }
- else
- {
- select_center_global = mSelectionCenterGlobal;
- }
-
- // Send selection center if moved beyond threshold (used to animate tractor beam)
- LLVector3d diff;
- diff = select_center_global - mLastSentSelectionCenterGlobal;
-
- if ( diff.magVecSquared() > MOVE_SELECTION_THRESHOLD*MOVE_SELECTION_THRESHOLD )
- {
- // Transmit updated selection center
- mLastSentSelectionCenterGlobal = select_center_global;
- }
- }
- }
-
- // give up edit menu if no objects selected
- if (gEditMenuHandler == this && mSelectedObjects->getObjectCount() == 0)
- {
- gEditMenuHandler = NULL;
- }
+ //override any object updates received
+ //for selected objects
+ overrideObjectUpdates();
+
+ LLViewerObject* object = mSelectedObjects->getFirstObject();
+ if (!object)
+ {
+ // nothing selected, probably grabbing
+ // Ignore by setting to avatar origin.
+ mSelectionCenterGlobal.clearVec();
+ mShowSelection = FALSE;
+ mSelectionBBox = LLBBox();
+ resetAgentHUDZoom();
+ }
+ else
+ {
+ mSelectedObjects->mSelectType = getSelectTypeForObject(object);
+
+ if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && isAgentAvatarValid())
+ {
+ // reset hud ZOOM
+ resetAgentHUDZoom();
+ }
+
+ mShowSelection = FALSE;
+ LLBBox bbox;
+
+ // have stuff selected
+ LLVector3d select_center;
+ // keep a list of jointed objects for showing the joint HUDEffects
+
+ // Initialize the bounding box to the root prim, so the BBox orientation
+ // matches the root prim's (affecting the orientation of the manipulators).
+ bbox.addBBoxAgent( (mSelectedObjects->getFirstRootObject(TRUE))->getBoundingBoxAgent() );
+
+ for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+ iter != mSelectedObjects->end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if (!object)
+ continue;
+
+ LLViewerObject *root = object->getRootEdit();
+ if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment
+ !root->isChild(gAgentAvatarp) && // not the object you're sitting on
+ !object->isAvatar()) // not another avatar
+ {
+ mShowSelection = TRUE;
+ }
+
+ bbox.addBBoxAgent( object->getBoundingBoxAgent() );
+ }
+
+ LLVector3 bbox_center_agent = bbox.getCenterAgent();
+ mSelectionCenterGlobal = gAgent.getPosGlobalFromAgent(bbox_center_agent);
+ mSelectionBBox = bbox;
+
+ }
+
+ if ( !(gAgentID == LLUUID::null))
+ {
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (mShowSelection)
+ {
+ LLVector3d select_center_global;
+
+ if( tool->isEditing() )
+ {
+ select_center_global = tool->getEditingPointGlobal();
+ }
+ else
+ {
+ select_center_global = mSelectionCenterGlobal;
+ }
+
+ // Send selection center if moved beyond threshold (used to animate tractor beam)
+ LLVector3d diff;
+ diff = select_center_global - mLastSentSelectionCenterGlobal;
+
+ if ( diff.magVecSquared() > MOVE_SELECTION_THRESHOLD*MOVE_SELECTION_THRESHOLD )
+ {
+ // Transmit updated selection center
+ mLastSentSelectionCenterGlobal = select_center_global;
+ }
+ }
+ }
+
+ // give up edit menu if no objects selected
+ if (gEditMenuHandler == this && mSelectedObjects->getObjectCount() == 0)
+ {
+ gEditMenuHandler = NULL;
+ }
pauseAssociatedAvatars();
}
@@ -7321,7 +7321,7 @@ void LLSelectMgr::pauseAssociatedAvatars()
LLViewerObject* object = node->getObject();
if (!object)
continue;
-
+
mSelectedObjects->mSelectType = getSelectTypeForObject(object);
LLVOAvatar* parent_av = NULL;
@@ -7349,40 +7349,40 @@ void LLSelectMgr::pauseAssociatedAvatars()
void LLSelectMgr::updatePointAt()
{
- if (mShowSelection)
- {
- if (mSelectedObjects->getObjectCount())
- {
- LLVector3 select_offset;
- const LLPickInfo& pick = gViewerWindow->getLastPick();
- LLViewerObject *click_object = pick.getObject();
- if (click_object && click_object->isSelected())
- {
- // clicked on another object in our selection group, use that as target
- select_offset.setVec(pick.mObjectOffset);
- select_offset.rotVec(~click_object->getRenderRotation());
-
- gAgentCamera.setPointAt(POINTAT_TARGET_SELECT, click_object, select_offset);
- gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, click_object, select_offset);
- }
- else
- {
- // didn't click on an object this time, revert to pointing at center of first object
- gAgentCamera.setPointAt(POINTAT_TARGET_SELECT, mSelectedObjects->getFirstObject());
- gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, mSelectedObjects->getFirstObject());
- }
- }
- else
- {
- gAgentCamera.setPointAt(POINTAT_TARGET_CLEAR);
- gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
- }
- }
- else
- {
- gAgentCamera.setPointAt(POINTAT_TARGET_CLEAR);
- gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
- }
+ if (mShowSelection)
+ {
+ if (mSelectedObjects->getObjectCount())
+ {
+ LLVector3 select_offset;
+ const LLPickInfo& pick = gViewerWindow->getLastPick();
+ LLViewerObject *click_object = pick.getObject();
+ if (click_object && click_object->isSelected())
+ {
+ // clicked on another object in our selection group, use that as target
+ select_offset.setVec(pick.mObjectOffset);
+ select_offset.rotVec(~click_object->getRenderRotation());
+
+ gAgentCamera.setPointAt(POINTAT_TARGET_SELECT, click_object, select_offset);
+ gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, click_object, select_offset);
+ }
+ else
+ {
+ // didn't click on an object this time, revert to pointing at center of first object
+ gAgentCamera.setPointAt(POINTAT_TARGET_SELECT, mSelectedObjects->getFirstObject());
+ gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, mSelectedObjects->getFirstObject());
+ }
+ }
+ else
+ {
+ gAgentCamera.setPointAt(POINTAT_TARGET_CLEAR);
+ gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
+ }
+ }
+ else
+ {
+ gAgentCamera.setPointAt(POINTAT_TARGET_CLEAR);
+ gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
+ }
}
//-----------------------------------------------------------------------------
@@ -7390,7 +7390,7 @@ void LLSelectMgr::updatePointAt()
//-----------------------------------------------------------------------------
LLBBox LLSelectMgr::getBBoxOfSelection() const
{
- return mSelectionBBox;
+ return mSelectionBBox;
}
@@ -7399,8 +7399,8 @@ LLBBox LLSelectMgr::getBBoxOfSelection() const
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canUndo() const
{
- // Can edit or can move
- return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstUndoEnabledObject() != NULL; // HACK: casting away constness - MG;
+ // Can edit or can move
+ return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstUndoEnabledObject() != NULL; // HACK: casting away constness - MG;
}
//-----------------------------------------------------------------------------
@@ -7408,9 +7408,9 @@ BOOL LLSelectMgr::canUndo() const
//-----------------------------------------------------------------------------
void LLSelectMgr::undo()
{
- BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
- LLUUID group_id(gAgent.getGroupID());
- sendListToRegions("Undo", packAgentAndSessionAndGroupID, packObjectID, logNoOp, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST);
+ BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
+ LLUUID group_id(gAgent.getGroupID());
+ sendListToRegions("Undo", packAgentAndSessionAndGroupID, packObjectID, logNoOp, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST);
}
//-----------------------------------------------------------------------------
@@ -7418,7 +7418,7 @@ void LLSelectMgr::undo()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canRedo() const
{
- return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstEditableObject() != NULL; // HACK: casting away constness - MG
+ return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstEditableObject() != NULL; // HACK: casting away constness - MG
}
//-----------------------------------------------------------------------------
@@ -7426,9 +7426,9 @@ BOOL LLSelectMgr::canRedo() const
//-----------------------------------------------------------------------------
void LLSelectMgr::redo()
{
- BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
- LLUUID group_id(gAgent.getGroupID());
- sendListToRegions("Redo", packAgentAndSessionAndGroupID, packObjectID, logNoOp, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST);
+ BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
+ LLUUID group_id(gAgent.getGroupID());
+ sendListToRegions("Redo", packAgentAndSessionAndGroupID, packObjectID, logNoOp, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST);
}
//-----------------------------------------------------------------------------
@@ -7436,22 +7436,22 @@ void LLSelectMgr::redo()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canDoDelete() const
{
- bool can_delete = false;
- // This function is "logically const" - it does not change state in
- // a way visible outside the selection manager.
- LLSelectMgr* self = const_cast<LLSelectMgr*>(this);
- LLViewerObject* obj = self->mSelectedObjects->getFirstDeleteableObject();
- // Note: Can only delete root objects (see getFirstDeleteableObject() for more info)
- if (obj!= NULL)
- {
- // all the faces needs to be selected
- if(self->mSelectedObjects->contains(obj,SELECT_ALL_TES ))
- {
- can_delete = true;
- }
- }
-
- return can_delete;
+ bool can_delete = false;
+ // This function is "logically const" - it does not change state in
+ // a way visible outside the selection manager.
+ LLSelectMgr* self = const_cast<LLSelectMgr*>(this);
+ LLViewerObject* obj = self->mSelectedObjects->getFirstDeleteableObject();
+ // Note: Can only delete root objects (see getFirstDeleteableObject() for more info)
+ if (obj!= NULL)
+ {
+ // all the faces needs to be selected
+ if(self->mSelectedObjects->contains(obj,SELECT_ALL_TES ))
+ {
+ can_delete = true;
+ }
+ }
+
+ return can_delete;
}
//-----------------------------------------------------------------------------
@@ -7459,7 +7459,7 @@ BOOL LLSelectMgr::canDoDelete() const
//-----------------------------------------------------------------------------
void LLSelectMgr::doDelete()
{
- selectDelete();
+ selectDelete();
}
//-----------------------------------------------------------------------------
@@ -7467,7 +7467,7 @@ void LLSelectMgr::doDelete()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canDeselect() const
{
- return !mSelectedObjects->isEmpty();
+ return !mSelectedObjects->isEmpty();
}
//-----------------------------------------------------------------------------
@@ -7475,123 +7475,123 @@ BOOL LLSelectMgr::canDeselect() const
//-----------------------------------------------------------------------------
void LLSelectMgr::deselect()
{
- deselectAll();
+ deselectAll();
}
//-----------------------------------------------------------------------------
// canDuplicate()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canDuplicate() const
{
- return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstCopyableObject() != NULL; // HACK: casting away constness - MG
+ return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstCopyableObject() != NULL; // HACK: casting away constness - MG
}
//-----------------------------------------------------------------------------
// duplicate()
//-----------------------------------------------------------------------------
void LLSelectMgr::duplicate()
{
- LLVector3 offset(0.5f, 0.5f, 0.f);
- selectDuplicate(offset, TRUE);
+ LLVector3 offset(0.5f, 0.5f, 0.f);
+ selectDuplicate(offset, TRUE);
}
ESelectType LLSelectMgr::getSelectTypeForObject(LLViewerObject* object)
{
- if (!object)
- {
- return SELECT_TYPE_WORLD;
- }
- if (object->isHUDAttachment())
- {
- return SELECT_TYPE_HUD;
- }
- else if (object->isAttachment())
- {
- return SELECT_TYPE_ATTACHMENT;
- }
- else
- {
- return SELECT_TYPE_WORLD;
- }
+ if (!object)
+ {
+ return SELECT_TYPE_WORLD;
+ }
+ if (object->isHUDAttachment())
+ {
+ return SELECT_TYPE_HUD;
+ }
+ else if (object->isAttachment())
+ {
+ return SELECT_TYPE_ATTACHMENT;
+ }
+ else
+ {
+ return SELECT_TYPE_WORLD;
+ }
}
void LLSelectMgr::validateSelection()
{
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- if (!LLSelectMgr::getInstance()->canSelectObject(object))
- {
- LLSelectMgr::getInstance()->deselectObjectOnly(object);
- }
- return true;
- }
- } func;
- getSelection()->applyToObjects(&func);
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (!LLSelectMgr::getInstance()->canSelectObject(object))
+ {
+ LLSelectMgr::getInstance()->deselectObjectOnly(object);
+ }
+ return true;
+ }
+ } func;
+ getSelection()->applyToObjects(&func);
}
BOOL LLSelectMgr::canSelectObject(LLViewerObject* object, BOOL ignore_select_owned)
{
- // Never select dead objects
- if (!object || object->isDead())
- {
- return FALSE;
- }
+ // Never select dead objects
+ if (!object || object->isDead())
+ {
+ return FALSE;
+ }
- if (mForceSelection)
- {
- return TRUE;
- }
+ if (mForceSelection)
+ {
+ return TRUE;
+ }
- if(!ignore_select_owned)
- {
- if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !object->permYouOwner()) ||
- (gSavedSettings.getBOOL("SelectMovableOnly") && (!object->permMove() || object->isPermanentEnforced())))
- {
- // only select my own objects
- return FALSE;
- }
- }
+ if(!ignore_select_owned)
+ {
+ if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !object->permYouOwner()) ||
+ (gSavedSettings.getBOOL("SelectMovableOnly") && (!object->permMove() || object->isPermanentEnforced())))
+ {
+ // only select my own objects
+ return FALSE;
+ }
+ }
- // Can't select orphans
- if (object->isOrphaned()) return FALSE;
+ // Can't select orphans
+ if (object->isOrphaned()) return FALSE;
- // Can't select avatars
- if (object->isAvatar()) return FALSE;
+ // Can't select avatars
+ if (object->isAvatar()) return FALSE;
- // Can't select land
- if (object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) return FALSE;
+ // Can't select land
+ if (object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) return FALSE;
- ESelectType selection_type = getSelectTypeForObject(object);
- if (mSelectedObjects->getObjectCount() > 0 && mSelectedObjects->mSelectType != selection_type) return FALSE;
+ ESelectType selection_type = getSelectTypeForObject(object);
+ if (mSelectedObjects->getObjectCount() > 0 && mSelectedObjects->mSelectType != selection_type) return FALSE;
- return TRUE;
+ return TRUE;
}
-BOOL LLSelectMgr::setForceSelection(BOOL force)
-{
- std::swap(mForceSelection,force);
- return force;
+BOOL LLSelectMgr::setForceSelection(BOOL force)
+{
+ std::swap(mForceSelection,force);
+ return force;
}
void LLSelectMgr::resetAgentHUDZoom()
{
- if (gAgentCamera.mHUDTargetZoom != 1)
- {
- gAgentCamera.mHUDTargetZoom = 1.f;
- gAgentCamera.mHUDCurZoom = 1.f;
- }
+ if (gAgentCamera.mHUDTargetZoom != 1)
+ {
+ gAgentCamera.mHUDTargetZoom = 1.f;
+ gAgentCamera.mHUDCurZoom = 1.f;
+ }
}
void LLSelectMgr::getAgentHUDZoom(F32 &target_zoom, F32 &current_zoom) const
{
- target_zoom = gAgentCamera.mHUDTargetZoom;
- current_zoom = gAgentCamera.mHUDCurZoom;
+ target_zoom = gAgentCamera.mHUDTargetZoom;
+ current_zoom = gAgentCamera.mHUDCurZoom;
}
void LLSelectMgr::setAgentHUDZoom(F32 target_zoom, F32 current_zoom)
{
- gAgentCamera.mHUDTargetZoom = target_zoom;
- gAgentCamera.mHUDCurZoom = current_zoom;
+ gAgentCamera.mHUDTargetZoom = target_zoom;
+ gAgentCamera.mHUDCurZoom = current_zoom;
}
/////////////////////////////////////////////////////////////////////////////
@@ -7599,45 +7599,45 @@ void LLSelectMgr::setAgentHUDZoom(F32 target_zoom, F32 current_zoom)
/////////////////////////////////////////////////////////////////////////////
bool LLObjectSelection::is_root::operator()(LLSelectNode *node)
{
- LLViewerObject* object = node->getObject();
- return (object != NULL) && !node->mIndividualSelection && (object->isRootEdit());
+ LLViewerObject* object = node->getObject();
+ return (object != NULL) && !node->mIndividualSelection && (object->isRootEdit());
}
bool LLObjectSelection::is_valid_root::operator()(LLSelectNode *node)
{
- LLViewerObject* object = node->getObject();
- return (object != NULL) && node->mValid && !node->mIndividualSelection && (object->isRootEdit());
+ LLViewerObject* object = node->getObject();
+ return (object != NULL) && node->mValid && !node->mIndividualSelection && (object->isRootEdit());
}
bool LLObjectSelection::is_root_object::operator()(LLSelectNode *node)
{
- LLViewerObject* object = node->getObject();
- return (object != NULL) && (object->isRootEdit());
+ LLViewerObject* object = node->getObject();
+ return (object != NULL) && (object->isRootEdit());
}
-LLObjectSelection::LLObjectSelection() :
- LLRefCount(),
- mSelectType(SELECT_TYPE_WORLD)
+LLObjectSelection::LLObjectSelection() :
+ LLRefCount(),
+ mSelectType(SELECT_TYPE_WORLD)
{
}
LLObjectSelection::~LLObjectSelection()
{
- deleteAllNodes();
+ deleteAllNodes();
}
void LLObjectSelection::cleanupNodes()
{
- for (list_t::iterator iter = mList.begin(); iter != mList.end(); )
- {
- list_t::iterator curiter = iter++;
- LLSelectNode* node = *curiter;
- if (node->getObject() == NULL || node->getObject()->isDead())
- {
- mList.erase(curiter);
- delete node;
- }
- }
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); )
+ {
+ list_t::iterator curiter = iter++;
+ LLSelectNode* node = *curiter;
+ if (node->getObject() == NULL || node->getObject()->isDead())
+ {
+ mList.erase(curiter);
+ delete node;
+ }
+ }
}
void LLObjectSelection::updateEffects()
@@ -7646,56 +7646,56 @@ void LLObjectSelection::updateEffects()
S32 LLObjectSelection::getNumNodes()
{
- return mList.size();
+ return mList.size();
}
void LLObjectSelection::addNode(LLSelectNode *nodep)
{
- llassert_always(nodep->getObject() && !nodep->getObject()->isDead());
- mList.push_front(nodep);
- mSelectNodeMap[nodep->getObject()] = nodep;
+ llassert_always(nodep->getObject() && !nodep->getObject()->isDead());
+ mList.push_front(nodep);
+ mSelectNodeMap[nodep->getObject()] = nodep;
}
void LLObjectSelection::addNodeAtEnd(LLSelectNode *nodep)
{
- llassert_always(nodep->getObject() && !nodep->getObject()->isDead());
- mList.push_back(nodep);
- mSelectNodeMap[nodep->getObject()] = nodep;
+ llassert_always(nodep->getObject() && !nodep->getObject()->isDead());
+ mList.push_back(nodep);
+ mSelectNodeMap[nodep->getObject()] = nodep;
}
void LLObjectSelection::moveNodeToFront(LLSelectNode *nodep)
{
- mList.remove(nodep);
- mList.push_front(nodep);
+ mList.remove(nodep);
+ mList.push_front(nodep);
}
void LLObjectSelection::removeNode(LLSelectNode *nodep)
{
- mSelectNodeMap.erase(nodep->getObject());
- if (nodep->getObject() == mPrimaryObject)
- {
- mPrimaryObject = NULL;
- }
- nodep->setObject(NULL); // Will get erased in cleanupNodes()
- mList.remove(nodep);
+ mSelectNodeMap.erase(nodep->getObject());
+ if (nodep->getObject() == mPrimaryObject)
+ {
+ mPrimaryObject = NULL;
+ }
+ nodep->setObject(NULL); // Will get erased in cleanupNodes()
+ mList.remove(nodep);
}
void LLObjectSelection::deleteAllNodes()
{
- std::for_each(mList.begin(), mList.end(), DeletePointer());
- mList.clear();
- mSelectNodeMap.clear();
- mPrimaryObject = NULL;
+ std::for_each(mList.begin(), mList.end(), DeletePointer());
+ mList.clear();
+ mSelectNodeMap.clear();
+ mPrimaryObject = NULL;
}
LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp)
{
- std::map<LLPointer<LLViewerObject>, LLSelectNode*>::iterator found_it = mSelectNodeMap.find(objectp);
- if (found_it != mSelectNodeMap.end())
- {
- return found_it->second;
- }
- return NULL;
+ std::map<LLPointer<LLViewerObject>, LLSelectNode*>::iterator found_it = mSelectNodeMap.find(objectp);
+ if (found_it != mSelectNodeMap.end())
+ {
+ return found_it->second;
+ }
+ return NULL;
}
//-----------------------------------------------------------------------------
@@ -7703,7 +7703,7 @@ LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp)
//-----------------------------------------------------------------------------
BOOL LLObjectSelection::isEmpty() const
{
- return (mList.size() == 0);
+ return (mList.size() == 0);
}
@@ -7712,119 +7712,119 @@ BOOL LLObjectSelection::isEmpty() const
//-----------------------------------------------------------------------------
S32 LLObjectSelection::getObjectCount()
{
- cleanupNodes();
- S32 count = mList.size();
+ cleanupNodes();
+ S32 count = mList.size();
- return count;
+ return count;
}
F32 LLObjectSelection::getSelectedObjectCost()
{
- cleanupNodes();
- F32 cost = 0.f;
+ cleanupNodes();
+ F32 cost = 0.f;
+
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
- for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
-
- if (object)
- {
- cost += object->getObjectCost();
- }
- }
+ if (object)
+ {
+ cost += object->getObjectCost();
+ }
+ }
- return cost;
+ return cost;
}
F32 LLObjectSelection::getSelectedLinksetCost()
{
- cleanupNodes();
- F32 cost = 0.f;
-
- std::set<LLViewerObject*> me_roots;
-
- for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
-
- if (object && !object->isAttachment())
- {
- LLViewerObject* root = static_cast<LLViewerObject*>(object->getRoot());
- if (root)
- {
- if (me_roots.find(root) == me_roots.end())
- {
- me_roots.insert(root);
- cost += root->getLinksetCost();
- }
- }
- }
- }
-
- return cost;
+ cleanupNodes();
+ F32 cost = 0.f;
+
+ std::set<LLViewerObject*> me_roots;
+
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+
+ if (object && !object->isAttachment())
+ {
+ LLViewerObject* root = static_cast<LLViewerObject*>(object->getRoot());
+ if (root)
+ {
+ if (me_roots.find(root) == me_roots.end())
+ {
+ me_roots.insert(root);
+ cost += root->getLinksetCost();
+ }
+ }
+ }
+ }
+
+ return cost;
}
F32 LLObjectSelection::getSelectedPhysicsCost()
{
- cleanupNodes();
- F32 cost = 0.f;
+ cleanupNodes();
+ F32 cost = 0.f;
+
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
- for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
-
- if (object)
- {
- cost += object->getPhysicsCost();
- }
- }
+ if (object)
+ {
+ cost += object->getPhysicsCost();
+ }
+ }
- return cost;
+ return cost;
}
F32 LLObjectSelection::getSelectedLinksetPhysicsCost()
{
- cleanupNodes();
- F32 cost = 0.f;
-
- std::set<LLViewerObject*> me_roots;
-
- for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
-
- if (object)
- {
- LLViewerObject* root = static_cast<LLViewerObject*>(object->getRoot());
- if (root)
- {
- if (me_roots.find(root) == me_roots.end())
- {
- me_roots.insert(root);
- cost += root->getLinksetPhysicsCost();
- }
- }
- }
- }
-
- return cost;
+ cleanupNodes();
+ F32 cost = 0.f;
+
+ std::set<LLViewerObject*> me_roots;
+
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+
+ if (object)
+ {
+ LLViewerObject* root = static_cast<LLViewerObject*>(object->getRoot());
+ if (root)
+ {
+ if (me_roots.find(root) == me_roots.end())
+ {
+ me_roots.insert(root);
+ cost += root->getLinksetPhysicsCost();
+ }
+ }
+ }
+ }
+
+ return cost;
}
F32 LLObjectSelection::getSelectedObjectStreamingCost(S32* total_bytes, S32* visible_bytes)
{
- F32 cost = 0.f;
- for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
-
- if (object)
- {
- cost += object->getStreamingCost();
+ F32 cost = 0.f;
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+
+ if (object)
+ {
+ cost += object->getStreamingCost();
S32 bytes = 0;
S32 visible = 0;
@@ -7834,38 +7834,38 @@ F32 LLObjectSelection::getSelectedObjectStreamingCost(S32* total_bytes, S32* vis
bytes = costs.getSizeTotal();
visible = costs.getSizeByLOD(object->getLOD());
}
- if (total_bytes)
- {
- *total_bytes += bytes;
- }
+ if (total_bytes)
+ {
+ *total_bytes += bytes;
+ }
- if (visible_bytes)
- {
- *visible_bytes += visible;
- }
- }
- }
+ if (visible_bytes)
+ {
+ *visible_bytes += visible;
+ }
+ }
+ }
- return cost;
+ return cost;
}
U32 LLObjectSelection::getSelectedObjectTriangleCount(S32* vcount)
{
- U32 count = 0;
- for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
-
- if (object)
- {
- S32 vt = 0;
- count += object->getTriangleCount(&vt);
- *vcount += vt;
- }
- }
+ U32 count = 0;
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
- return count;
+ if (object)
+ {
+ S32 vt = 0;
+ count += object->getTriangleCount(&vt);
+ *vcount += vt;
+ }
+ }
+
+ return count;
}
S32 LLObjectSelection::getSelectedObjectRenderCost()
@@ -7875,65 +7875,65 @@ S32 LLObjectSelection::getSelectedObjectRenderCost()
typedef std::set<LLUUID> uuid_list_t;
uuid_list_t computed_objects;
- typedef std::list<LLPointer<LLViewerObject> > child_list_t;
- typedef const child_list_t const_child_list_t;
+ typedef std::list<LLPointer<LLViewerObject> > child_list_t;
+ typedef const child_list_t const_child_list_t;
- // add render cost of complete linksets first, to get accurate texture counts
+ // add render cost of complete linksets first, to get accurate texture counts
for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
{
LLSelectNode* node = *iter;
-
+
LLVOVolume* object = (LLVOVolume*)node->getObject();
if (object && object->isRootEdit())
{
- cost += object->getRenderCost(textures);
- computed_objects.insert(object->getID());
-
- const_child_list_t children = object->getChildren();
- for (const_child_list_t::const_iterator child_iter = children.begin();
- child_iter != children.end();
- ++child_iter)
- {
- LLViewerObject* child_obj = *child_iter;
- LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj );
- if (child)
- {
- cost += child->getRenderCost(textures);
- computed_objects.insert(child->getID());
- }
- }
-
- for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter)
- {
- // add the cost of each individual texture in the linkset
- cost += LLVOVolume::getTextureCost(*iter);
- }
-
- textures.clear();
+ cost += object->getRenderCost(textures);
+ computed_objects.insert(object->getID());
+
+ const_child_list_t children = object->getChildren();
+ for (const_child_list_t::const_iterator child_iter = children.begin();
+ child_iter != children.end();
+ ++child_iter)
+ {
+ LLViewerObject* child_obj = *child_iter;
+ LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj );
+ if (child)
+ {
+ cost += child->getRenderCost(textures);
+ computed_objects.insert(child->getID());
+ }
+ }
+
+ for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter)
+ {
+ // add the cost of each individual texture in the linkset
+ cost += LLVOVolume::getTextureCost(*iter);
+ }
+
+ textures.clear();
}
}
-
- // add any partial linkset objects, texture cost may be slightly misleading
- for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
- {
- LLSelectNode* node = *iter;
- LLVOVolume* object = (LLVOVolume*)node->getObject();
-
- if (object && computed_objects.find(object->getID()) == computed_objects.end() )
- {
- cost += object->getRenderCost(textures);
- computed_objects.insert(object->getID());
- }
-
- for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter)
- {
- // add the cost of each individual texture in the linkset
- cost += LLVOVolume::getTextureCost(*iter);
- }
-
- textures.clear();
- }
+
+ // add any partial linkset objects, texture cost may be slightly misleading
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ LLVOVolume* object = (LLVOVolume*)node->getObject();
+
+ if (object && computed_objects.find(object->getID()) == computed_objects.end() )
+ {
+ cost += object->getRenderCost(textures);
+ computed_objects.insert(object->getID());
+ }
+
+ for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter)
+ {
+ // add the cost of each individual texture in the linkset
+ cost += LLVOVolume::getTextureCost(*iter);
+ }
+
+ textures.clear();
+ }
return cost;
}
@@ -7943,23 +7943,23 @@ S32 LLObjectSelection::getSelectedObjectRenderCost()
//-----------------------------------------------------------------------------
S32 LLObjectSelection::getTECount()
{
- S32 count = 0;
- for (LLObjectSelection::iterator iter = begin(); iter != end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if (!object)
- continue;
- S32 num_tes = object->getNumTEs();
- for (S32 te = 0; te < num_tes; te++)
- {
- if (node->isTESelected(te))
- {
- ++count;
- }
- }
- }
- return count;
+ S32 count = 0;
+ for (LLObjectSelection::iterator iter = begin(); iter != end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if (!object)
+ continue;
+ S32 num_tes = object->getNumTEs();
+ for (S32 te = 0; te < num_tes; te++)
+ {
+ if (node->isTESelected(te))
+ {
+ ++count;
+ }
+ }
+ }
+ return count;
}
//-----------------------------------------------------------------------------
@@ -7967,27 +7967,27 @@ S32 LLObjectSelection::getTECount()
//-----------------------------------------------------------------------------
S32 LLObjectSelection::getRootObjectCount()
{
- S32 count = 0;
- for (LLObjectSelection::root_iterator iter = root_begin(); iter != root_end(); iter++)
- {
- ++count;
- }
- return count;
+ S32 count = 0;
+ for (LLObjectSelection::root_iterator iter = root_begin(); iter != root_end(); iter++)
+ {
+ ++count;
+ }
+ return count;
}
bool LLObjectSelection::applyToObjects(LLSelectedObjectFunctor* func)
{
- bool result = true;
- for (iterator iter = begin(); iter != end(); )
- {
- iterator nextiter = iter++;
- LLViewerObject* object = (*nextiter)->getObject();
- if (!object)
- continue;
- bool r = func->apply(object);
- result = result && r;
- }
- return result;
+ bool result = true;
+ for (iterator iter = begin(); iter != end(); )
+ {
+ iterator nextiter = iter++;
+ LLViewerObject* object = (*nextiter)->getObject();
+ if (!object)
+ continue;
+ bool r = func->apply(object);
+ result = result && r;
+ }
+ return result;
}
bool LLObjectSelection::checkAnimatedObjectEstTris()
@@ -7995,19 +7995,19 @@ bool LLObjectSelection::checkAnimatedObjectEstTris()
F32 est_tris = 0;
F32 max_tris = 0;
S32 anim_count = 0;
- for (root_iterator iter = root_begin(); iter != root_end(); ++iter)
- {
- LLViewerObject* object = (*iter)->getObject();
- if (!object)
- continue;
+ for (root_iterator iter = root_begin(); iter != root_end(); ++iter)
+ {
+ LLViewerObject* object = (*iter)->getObject();
+ if (!object)
+ continue;
if (object->isAnimatedObject())
{
anim_count++;
}
est_tris += object->recursiveGetEstTrianglesMax();
max_tris = llmax((F32)max_tris,(F32)object->getAnimatedObjectMaxTris());
- }
- return anim_count==0 || est_tris <= max_tris;
+ }
+ return anim_count==0 || est_tris <= max_tris;
}
bool LLObjectSelection::checkAnimatedObjectLinkable()
@@ -8017,101 +8017,101 @@ bool LLObjectSelection::checkAnimatedObjectLinkable()
bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly)
{
- bool result = firstonly ? false : true;
- for (root_iterator iter = root_begin(); iter != root_end(); )
- {
- root_iterator nextiter = iter++;
- LLViewerObject* object = (*nextiter)->getObject();
- if (!object)
- continue;
- bool r = func->apply(object);
- if (firstonly && r)
- return true;
- else
- result = result && r;
- }
- return result;
+ bool result = firstonly ? false : true;
+ for (root_iterator iter = root_begin(); iter != root_end(); )
+ {
+ root_iterator nextiter = iter++;
+ LLViewerObject* object = (*nextiter)->getObject();
+ if (!object)
+ continue;
+ bool r = func->apply(object);
+ if (firstonly && r)
+ return true;
+ else
+ result = result && r;
+ }
+ return result;
}
bool LLObjectSelection::applyToTEs(LLSelectedTEFunctor* func, bool firstonly)
{
- bool result = firstonly ? false : true;
- for (iterator iter = begin(); iter != end(); )
- {
- iterator nextiter = iter++;
- LLSelectNode* node = *nextiter;
- LLViewerObject* object = (*nextiter)->getObject();
- if (!object)
- continue;
- S32 num_tes = llmin((S32)object->getNumTEs(), (S32)object->getNumFaces()); // avatars have TEs but no faces
- for (S32 te = 0; te < num_tes; ++te)
- {
- if (node->isTESelected(te))
- {
- bool r = func->apply(object, te);
- if (firstonly && r)
- return true;
- else
- result = result && r;
- }
- }
- }
- return result;
+ bool result = firstonly ? false : true;
+ for (iterator iter = begin(); iter != end(); )
+ {
+ iterator nextiter = iter++;
+ LLSelectNode* node = *nextiter;
+ LLViewerObject* object = (*nextiter)->getObject();
+ if (!object)
+ continue;
+ S32 num_tes = llmin((S32)object->getNumTEs(), (S32)object->getNumFaces()); // avatars have TEs but no faces
+ for (S32 te = 0; te < num_tes; ++te)
+ {
+ if (node->isTESelected(te))
+ {
+ bool r = func->apply(object, te);
+ if (firstonly && r)
+ return true;
+ else
+ result = result && r;
+ }
+ }
+ }
+ return result;
}
bool LLObjectSelection::applyToNodes(LLSelectedNodeFunctor *func, bool firstonly)
{
- bool result = firstonly ? false : true;
- for (iterator iter = begin(); iter != end(); )
- {
- iterator nextiter = iter++;
- LLSelectNode* node = *nextiter;
- bool r = func->apply(node);
- if (firstonly && r)
- return true;
- else
- result = result && r;
- }
- return result;
+ bool result = firstonly ? false : true;
+ for (iterator iter = begin(); iter != end(); )
+ {
+ iterator nextiter = iter++;
+ LLSelectNode* node = *nextiter;
+ bool r = func->apply(node);
+ if (firstonly && r)
+ return true;
+ else
+ result = result && r;
+ }
+ return result;
}
bool LLObjectSelection::applyToRootNodes(LLSelectedNodeFunctor *func, bool firstonly)
{
- bool result = firstonly ? false : true;
- for (root_iterator iter = root_begin(); iter != root_end(); )
- {
- root_iterator nextiter = iter++;
- LLSelectNode* node = *nextiter;
- bool r = func->apply(node);
- if (firstonly && r)
- return true;
- else
- result = result && r;
- }
- return result;
+ bool result = firstonly ? false : true;
+ for (root_iterator iter = root_begin(); iter != root_end(); )
+ {
+ root_iterator nextiter = iter++;
+ LLSelectNode* node = *nextiter;
+ bool r = func->apply(node);
+ if (firstonly && r)
+ return true;
+ else
+ result = result && r;
+ }
+ return result;
}
BOOL LLObjectSelection::isMultipleTESelected()
{
- BOOL te_selected = FALSE;
- // ...all faces
- for (LLObjectSelection::iterator iter = begin();
- iter != end(); iter++)
- {
- LLSelectNode* nodep = *iter;
- for (S32 i = 0; i < SELECT_MAX_TES; i++)
- {
- if(nodep->isTESelected(i))
- {
- if(te_selected)
- {
- return TRUE;
- }
- te_selected = TRUE;
- }
- }
- }
- return FALSE;
+ BOOL te_selected = FALSE;
+ // ...all faces
+ for (LLObjectSelection::iterator iter = begin();
+ iter != end(); iter++)
+ {
+ LLSelectNode* nodep = *iter;
+ for (S32 i = 0; i < SELECT_MAX_TES; i++)
+ {
+ if(nodep->isTESelected(i))
+ {
+ if(te_selected)
+ {
+ return TRUE;
+ }
+ te_selected = TRUE;
+ }
+ }
+ }
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -8119,7 +8119,7 @@ BOOL LLObjectSelection::isMultipleTESelected()
//-----------------------------------------------------------------------------
BOOL LLObjectSelection::contains(LLViewerObject* object)
{
- return findNode(object) != NULL;
+ return findNode(object) != NULL;
}
@@ -8128,50 +8128,50 @@ BOOL LLObjectSelection::contains(LLViewerObject* object)
//-----------------------------------------------------------------------------
BOOL LLObjectSelection::contains(LLViewerObject* object, S32 te)
{
- if (te == SELECT_ALL_TES)
- {
- // ...all faces
- for (LLObjectSelection::iterator iter = begin();
- iter != end(); iter++)
- {
- LLSelectNode* nodep = *iter;
- if (nodep->getObject() == object)
- {
- // Optimization
- if (nodep->getTESelectMask() == TE_SELECT_MASK_ALL)
- {
- return TRUE;
- }
-
- BOOL all_selected = TRUE;
- for (S32 i = 0; i < object->getNumTEs(); i++)
- {
- all_selected = all_selected && nodep->isTESelected(i);
- }
- return all_selected;
- }
- }
- return FALSE;
- }
- else
- {
- // ...one face
- for (LLObjectSelection::iterator iter = begin(); iter != end(); iter++)
- {
- LLSelectNode* nodep = *iter;
- if (nodep->getObject() == object && nodep->isTESelected(te))
- {
- return TRUE;
- }
- }
- return FALSE;
- }
+ if (te == SELECT_ALL_TES)
+ {
+ // ...all faces
+ for (LLObjectSelection::iterator iter = begin();
+ iter != end(); iter++)
+ {
+ LLSelectNode* nodep = *iter;
+ if (nodep->getObject() == object)
+ {
+ // Optimization
+ if (nodep->getTESelectMask() == TE_SELECT_MASK_ALL)
+ {
+ return TRUE;
+ }
+
+ BOOL all_selected = TRUE;
+ for (S32 i = 0; i < object->getNumTEs(); i++)
+ {
+ all_selected = all_selected && nodep->isTESelected(i);
+ }
+ return all_selected;
+ }
+ }
+ return FALSE;
+ }
+ else
+ {
+ // ...one face
+ for (LLObjectSelection::iterator iter = begin(); iter != end(); iter++)
+ {
+ LLSelectNode* nodep = *iter;
+ if (nodep->getObject() == object && nodep->isTESelected(te))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+ }
}
// returns TRUE is any node is currenly worn as an attachment
BOOL LLObjectSelection::isAttachment()
{
- return (mSelectType == SELECT_TYPE_ATTACHMENT || mSelectType == SELECT_TYPE_HUD);
+ return (mSelectType == SELECT_TYPE_ATTACHMENT || mSelectType == SELECT_TYPE_HUD);
}
//-----------------------------------------------------------------------------
@@ -8179,19 +8179,19 @@ BOOL LLObjectSelection::isAttachment()
//-----------------------------------------------------------------------------
LLViewerObject* getSelectedParentObject(LLViewerObject *object)
{
- LLViewerObject *parent;
- while (object && (parent = (LLViewerObject*)object->getParent()))
- {
- if (parent->isSelected())
- {
- object = parent;
- }
- else
- {
- break;
- }
- }
- return object;
+ LLViewerObject *parent;
+ while (object && (parent = (LLViewerObject*)object->getParent()))
+ {
+ if (parent->isSelected())
+ {
+ object = parent;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return object;
}
//-----------------------------------------------------------------------------
@@ -8199,33 +8199,33 @@ LLViewerObject* getSelectedParentObject(LLViewerObject *object)
//-----------------------------------------------------------------------------
LLSelectNode* LLObjectSelection::getFirstNode(LLSelectedNodeFunctor* func)
{
- for (iterator iter = begin(); iter != end(); ++iter)
- {
- LLSelectNode* node = *iter;
- if (func == NULL || func->apply(node))
- {
- return node;
- }
- }
- return NULL;
+ for (iterator iter = begin(); iter != end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ if (func == NULL || func->apply(node))
+ {
+ return node;
+ }
+ }
+ return NULL;
}
LLSelectNode* LLObjectSelection::getFirstRootNode(LLSelectedNodeFunctor* func, BOOL non_root_ok)
{
- for (root_iterator iter = root_begin(); iter != root_end(); ++iter)
- {
- LLSelectNode* node = *iter;
- if (func == NULL || func->apply(node))
- {
- return node;
- }
- }
- if (non_root_ok)
- {
- // Get non root
- return getFirstNode(func);
- }
- return NULL;
+ for (root_iterator iter = root_begin(); iter != root_end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ if (func == NULL || func->apply(node))
+ {
+ return node;
+ }
+ }
+ if (non_root_ok)
+ {
+ // Get non root
+ return getFirstNode(func);
+ }
+ return NULL;
}
@@ -8234,16 +8234,16 @@ LLSelectNode* LLObjectSelection::getFirstRootNode(LLSelectedNodeFunctor* func, B
//-----------------------------------------------------------------------------
LLViewerObject* LLObjectSelection::getFirstSelectedObject(LLSelectedNodeFunctor* func, BOOL get_parent)
{
- LLSelectNode* res = getFirstNode(func);
- if (res && get_parent)
- {
- return getSelectedParentObject(res->getObject());
- }
- else if (res)
- {
- return res->getObject();
- }
- return NULL;
+ LLSelectNode* res = getFirstNode(func);
+ if (res && get_parent)
+ {
+ return getSelectedParentObject(res->getObject());
+ }
+ else if (res)
+ {
+ return res->getObject();
+ }
+ return NULL;
}
//-----------------------------------------------------------------------------
@@ -8251,8 +8251,8 @@ LLViewerObject* LLObjectSelection::getFirstSelectedObject(LLSelectedNodeFunctor*
//-----------------------------------------------------------------------------
LLViewerObject* LLObjectSelection::getFirstObject()
{
- LLSelectNode* res = getFirstNode(NULL);
- return res ? res->getObject() : NULL;
+ LLSelectNode* res = getFirstNode(NULL);
+ return res ? res->getObject() : NULL;
}
//-----------------------------------------------------------------------------
@@ -8260,8 +8260,8 @@ LLViewerObject* LLObjectSelection::getFirstObject()
//-----------------------------------------------------------------------------
LLViewerObject* LLObjectSelection::getFirstRootObject(BOOL non_root_ok)
{
- LLSelectNode* res = getFirstRootNode(NULL, non_root_ok);
- return res ? res->getObject() : NULL;
+ LLSelectNode* res = getFirstRootNode(NULL, non_root_ok);
+ return res ? res->getObject() : NULL;
}
//-----------------------------------------------------------------------------
@@ -8269,16 +8269,16 @@ LLViewerObject* LLObjectSelection::getFirstRootObject(BOOL non_root_ok)
//-----------------------------------------------------------------------------
LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root_first)
{
- struct f : public LLSelectedNodeFunctor
- {
- bool apply(LLSelectNode* node)
- {
- LLViewerObject* obj = node->getObject();
- return obj && obj->permMove() && !obj->isPermanentEnforced();
- }
- } func;
- LLSelectNode* res = get_root_first ? getFirstRootNode(&func, TRUE) : getFirstNode(&func);
- return res;
+ struct f : public LLSelectedNodeFunctor
+ {
+ bool apply(LLSelectNode* node)
+ {
+ LLViewerObject* obj = node->getObject();
+ return obj && obj->permMove() && !obj->isPermanentEnforced();
+ }
+ } func;
+ LLSelectNode* res = get_root_first ? getFirstRootNode(&func, TRUE) : getFirstNode(&func);
+ return res;
}
//-----------------------------------------------------------------------------
@@ -8286,15 +8286,15 @@ LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root_first)
//-----------------------------------------------------------------------------
LLViewerObject* LLObjectSelection::getFirstCopyableObject(BOOL get_parent)
{
- struct f : public LLSelectedNodeFunctor
- {
- bool apply(LLSelectNode* node)
- {
- LLViewerObject* obj = node->getObject();
- return obj && obj->permCopy() && !obj->isAttachment();
- }
- } func;
- return getFirstSelectedObject(&func, get_parent);
+ struct f : public LLSelectedNodeFunctor
+ {
+ bool apply(LLSelectNode* node)
+ {
+ LLViewerObject* obj = node->getObject();
+ return obj && obj->permCopy() && !obj->isAttachment();
+ }
+ } func;
+ return getFirstSelectedObject(&func, get_parent);
}
//-----------------------------------------------------------------------------
@@ -8302,31 +8302,31 @@ LLViewerObject* LLObjectSelection::getFirstCopyableObject(BOOL get_parent)
//-----------------------------------------------------------------------------
LLViewerObject* LLObjectSelection::getFirstDeleteableObject()
{
- //RN: don't currently support deletion of child objects, as that requires separating them first
- // then derezzing to trash
-
- struct f : public LLSelectedNodeFunctor
- {
- bool apply(LLSelectNode* node)
- {
- LLViewerObject* obj = node->getObject();
- // you can delete an object if you are the owner
- // or you have permission to modify it.
- if( obj && !obj->isPermanentEnforced() &&
- ( (obj->permModify()) ||
- (obj->permYouOwner()) ||
- (!obj->permAnyOwner()) )) // public
- {
- if( !obj->isAttachment() )
- {
- return true;
- }
- }
- return false;
- }
- } func;
- LLSelectNode* node = getFirstNode(&func);
- return node ? node->getObject() : NULL;
+ //RN: don't currently support deletion of child objects, as that requires separating them first
+ // then derezzing to trash
+
+ struct f : public LLSelectedNodeFunctor
+ {
+ bool apply(LLSelectNode* node)
+ {
+ LLViewerObject* obj = node->getObject();
+ // you can delete an object if you are the owner
+ // or you have permission to modify it.
+ if( obj && !obj->isPermanentEnforced() &&
+ ( (obj->permModify()) ||
+ (obj->permYouOwner()) ||
+ (!obj->permAnyOwner()) )) // public
+ {
+ if( !obj->isAttachment() )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ } func;
+ LLSelectNode* node = getFirstNode(&func);
+ return node ? node->getObject() : NULL;
}
//-----------------------------------------------------------------------------
@@ -8334,15 +8334,15 @@ LLViewerObject* LLObjectSelection::getFirstDeleteableObject()
//-----------------------------------------------------------------------------
LLViewerObject* LLObjectSelection::getFirstEditableObject(BOOL get_parent)
{
- struct f : public LLSelectedNodeFunctor
- {
- bool apply(LLSelectNode* node)
- {
- LLViewerObject* obj = node->getObject();
- return obj && obj->permModify();
- }
- } func;
- return getFirstSelectedObject(&func, get_parent);
+ struct f : public LLSelectedNodeFunctor
+ {
+ bool apply(LLSelectNode* node)
+ {
+ LLViewerObject* obj = node->getObject();
+ return obj && obj->permModify();
+ }
+ } func;
+ return getFirstSelectedObject(&func, get_parent);
}
//-----------------------------------------------------------------------------
@@ -8350,15 +8350,15 @@ LLViewerObject* LLObjectSelection::getFirstEditableObject(BOOL get_parent)
//-----------------------------------------------------------------------------
LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_parent)
{
- struct f : public LLSelectedNodeFunctor
- {
- bool apply(LLSelectNode* node)
- {
- LLViewerObject* obj = node->getObject();
- return obj && obj->permMove() && !obj->isPermanentEnforced();
- }
- } func;
- return getFirstSelectedObject(&func, get_parent);
+ struct f : public LLSelectedNodeFunctor
+ {
+ bool apply(LLSelectNode* node)
+ {
+ LLViewerObject* obj = node->getObject();
+ return obj && obj->permMove() && !obj->isPermanentEnforced();
+ }
+ } func;
+ return getFirstSelectedObject(&func, get_parent);
}
//-----------------------------------------------------------------------------
@@ -8383,196 +8383,196 @@ LLViewerObject* LLObjectSelection::getFirstUndoEnabledObject(BOOL get_parent)
bool LLSelectMgr::selectionMove(const LLVector3& displ,
F32 roll, F32 pitch, F32 yaw, U32 update_type)
{
- if (update_type == UPD_NONE)
- {
- return false;
- }
-
- LLVector3 displ_global;
- bool update_success = true;
- bool update_position = update_type & UPD_POSITION;
- bool update_rotation = update_type & UPD_ROTATION;
- const bool noedit_linked_parts = !gSavedSettings.getBOOL("EditLinkedParts");
-
- if (update_position)
- {
- // calculate the distance of the object closest to the camera origin
- F32 min_dist_squared = F32_MAX; // value will be overridden in the loop
-
- LLVector3 obj_pos;
- for (LLObjectSelection::root_iterator it = getSelection()->root_begin();
- it != getSelection()->root_end(); ++it)
- {
- obj_pos = (*it)->getObject()->getPositionEdit();
-
- F32 obj_dist_squared = dist_vec_squared(obj_pos, LLViewerCamera::getInstance()->getOrigin());
- if (obj_dist_squared < min_dist_squared)
- {
- min_dist_squared = obj_dist_squared;
- }
- }
-
- // factor the distance into the displacement vector. This will get us
- // equally visible movements for both close and far away selections.
- F32 min_dist = sqrt((F32) sqrtf(min_dist_squared)) / 2;
- displ_global.setVec(displ.mV[0] * min_dist,
- displ.mV[1] * min_dist,
- displ.mV[2] * min_dist);
-
- // equates to: Displ_global = Displ * M_cam_axes_in_global_frame
- displ_global = LLViewerCamera::getInstance()->rotateToAbsolute(displ_global);
- }
-
- LLQuaternion new_rot;
- if (update_rotation)
- {
- // let's calculate the rotation around each camera axes
- LLQuaternion qx(roll, LLViewerCamera::getInstance()->getAtAxis());
- LLQuaternion qy(pitch, LLViewerCamera::getInstance()->getLeftAxis());
- LLQuaternion qz(yaw, LLViewerCamera::getInstance()->getUpAxis());
- new_rot.setQuat(qx * qy * qz);
- }
-
- LLViewerObject *obj;
- S32 obj_count = getSelection()->getObjectCount();
- for (LLObjectSelection::root_iterator it = getSelection()->root_begin();
- it != getSelection()->root_end(); ++it )
- {
- obj = (*it)->getObject();
- bool enable_pos = false, enable_rot = false;
- bool perm_move = obj->permMove() && !obj->isPermanentEnforced();
- bool perm_mod = obj->permModify();
-
- LLVector3d sel_center(getSelectionCenterGlobal());
-
- if (update_rotation)
- {
- enable_rot = perm_move
- && ((perm_mod && !obj->isAttachment()) || noedit_linked_parts);
-
- if (enable_rot)
- {
- int children_count = obj->getChildren().size();
- if (obj_count > 1 && children_count > 0)
- {
- // for linked sets, rotate around the group center
- const LLVector3 t(obj->getPositionGlobal() - sel_center);
-
- // Ra = T x R x T^-1
- LLMatrix4 mt; mt.setTranslation(t);
- const LLMatrix4 mnew_rot(new_rot);
- LLMatrix4 mt_1; mt_1.setTranslation(-t);
- mt *= mnew_rot;
- mt *= mt_1;
-
- // Rfin = Rcur * Ra
- obj->setRotation(obj->getRotationEdit() * mt.quaternion());
- displ_global += mt.getTranslation();
- }
- else
- {
- obj->setRotation(obj->getRotationEdit() * new_rot);
- }
- }
- else
- {
- update_success = false;
- }
- }
-
- if (update_position)
- {
- // establish if object can be moved or not
- enable_pos = perm_move && !obj->isAttachment()
- && (perm_mod || noedit_linked_parts);
-
- if (enable_pos)
- {
- obj->setPosition(obj->getPositionEdit() + displ_global);
- }
- else
- {
- update_success = false;
- }
- }
-
- if (enable_pos && enable_rot && obj->mDrawable.notNull())
- {
- gPipeline.markMoved(obj->mDrawable, TRUE);
- }
- }
-
- if (update_position && update_success && obj_count > 1)
- {
- updateSelectionCenter();
- }
-
- return update_success;
+ if (update_type == UPD_NONE)
+ {
+ return false;
+ }
+
+ LLVector3 displ_global;
+ bool update_success = true;
+ bool update_position = update_type & UPD_POSITION;
+ bool update_rotation = update_type & UPD_ROTATION;
+ const bool noedit_linked_parts = !gSavedSettings.getBOOL("EditLinkedParts");
+
+ if (update_position)
+ {
+ // calculate the distance of the object closest to the camera origin
+ F32 min_dist_squared = F32_MAX; // value will be overridden in the loop
+
+ LLVector3 obj_pos;
+ for (LLObjectSelection::root_iterator it = getSelection()->root_begin();
+ it != getSelection()->root_end(); ++it)
+ {
+ obj_pos = (*it)->getObject()->getPositionEdit();
+
+ F32 obj_dist_squared = dist_vec_squared(obj_pos, LLViewerCamera::getInstance()->getOrigin());
+ if (obj_dist_squared < min_dist_squared)
+ {
+ min_dist_squared = obj_dist_squared;
+ }
+ }
+
+ // factor the distance into the displacement vector. This will get us
+ // equally visible movements for both close and far away selections.
+ F32 min_dist = sqrt((F32) sqrtf(min_dist_squared)) / 2;
+ displ_global.setVec(displ.mV[0] * min_dist,
+ displ.mV[1] * min_dist,
+ displ.mV[2] * min_dist);
+
+ // equates to: Displ_global = Displ * M_cam_axes_in_global_frame
+ displ_global = LLViewerCamera::getInstance()->rotateToAbsolute(displ_global);
+ }
+
+ LLQuaternion new_rot;
+ if (update_rotation)
+ {
+ // let's calculate the rotation around each camera axes
+ LLQuaternion qx(roll, LLViewerCamera::getInstance()->getAtAxis());
+ LLQuaternion qy(pitch, LLViewerCamera::getInstance()->getLeftAxis());
+ LLQuaternion qz(yaw, LLViewerCamera::getInstance()->getUpAxis());
+ new_rot.setQuat(qx * qy * qz);
+ }
+
+ LLViewerObject *obj;
+ S32 obj_count = getSelection()->getObjectCount();
+ for (LLObjectSelection::root_iterator it = getSelection()->root_begin();
+ it != getSelection()->root_end(); ++it )
+ {
+ obj = (*it)->getObject();
+ bool enable_pos = false, enable_rot = false;
+ bool perm_move = obj->permMove() && !obj->isPermanentEnforced();
+ bool perm_mod = obj->permModify();
+
+ LLVector3d sel_center(getSelectionCenterGlobal());
+
+ if (update_rotation)
+ {
+ enable_rot = perm_move
+ && ((perm_mod && !obj->isAttachment()) || noedit_linked_parts);
+
+ if (enable_rot)
+ {
+ int children_count = obj->getChildren().size();
+ if (obj_count > 1 && children_count > 0)
+ {
+ // for linked sets, rotate around the group center
+ const LLVector3 t(obj->getPositionGlobal() - sel_center);
+
+ // Ra = T x R x T^-1
+ LLMatrix4 mt; mt.setTranslation(t);
+ const LLMatrix4 mnew_rot(new_rot);
+ LLMatrix4 mt_1; mt_1.setTranslation(-t);
+ mt *= mnew_rot;
+ mt *= mt_1;
+
+ // Rfin = Rcur * Ra
+ obj->setRotation(obj->getRotationEdit() * mt.quaternion());
+ displ_global += mt.getTranslation();
+ }
+ else
+ {
+ obj->setRotation(obj->getRotationEdit() * new_rot);
+ }
+ }
+ else
+ {
+ update_success = false;
+ }
+ }
+
+ if (update_position)
+ {
+ // establish if object can be moved or not
+ enable_pos = perm_move && !obj->isAttachment()
+ && (perm_mod || noedit_linked_parts);
+
+ if (enable_pos)
+ {
+ obj->setPosition(obj->getPositionEdit() + displ_global);
+ }
+ else
+ {
+ update_success = false;
+ }
+ }
+
+ if (enable_pos && enable_rot && obj->mDrawable.notNull())
+ {
+ gPipeline.markMoved(obj->mDrawable, TRUE);
+ }
+ }
+
+ if (update_position && update_success && obj_count > 1)
+ {
+ updateSelectionCenter();
+ }
+
+ return update_success;
}
void LLSelectMgr::sendSelectionMove()
{
- LLSelectNode *node = mSelectedObjects->getFirstRootNode();
- if (node == NULL)
- {
- return;
- }
-
- //saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
-
- U32 update_type = UPD_POSITION | UPD_ROTATION;
- LLViewerRegion *last_region, *curr_region = node->getObject()->getRegion();
- S32 objects_in_this_packet = 0;
-
- // apply to linked objects if unable to select their individual parts
- if (!gSavedSettings.getBOOL("EditLinkedParts") && !getTEMode())
- {
- // tell simulator to apply to whole linked sets
- update_type |= UPD_LINKED_SETS;
- }
-
- // prepare first bulk message
- gMessageSystem->newMessage("MultipleObjectUpdate");
- packAgentAndSessionID(&update_type);
-
- LLViewerObject *obj = NULL;
- for (LLObjectSelection::root_iterator it = getSelection()->root_begin();
- it != getSelection()->root_end(); ++it)
- {
- obj = (*it)->getObject();
-
- // note: following code adapted from sendListToRegions() (@3924)
- last_region = curr_region;
- curr_region = obj->getRegion();
-
- // if not simulator or message too big
- if (curr_region != last_region
- || gMessageSystem->isSendFull(NULL)
- || objects_in_this_packet >= MAX_OBJECTS_PER_PACKET)
- {
- // send sim the current message and start new one
- gMessageSystem->sendReliable(last_region->getHost());
- objects_in_this_packet = 0;
- gMessageSystem->newMessage("MultipleObjectUpdate");
- packAgentAndSessionID(&update_type);
- }
-
- // add another instance of the body of data
- packMultipleUpdate(*it, &update_type);
- ++objects_in_this_packet;
- }
-
- // flush remaining messages
- if (gMessageSystem->getCurrentSendTotal() > 0)
- {
- gMessageSystem->sendReliable(curr_region->getHost());
- }
- else
- {
- gMessageSystem->clearMessage();
- }
-
- //saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+ LLSelectNode *node = mSelectedObjects->getFirstRootNode();
+ if (node == NULL)
+ {
+ return;
+ }
+
+ //saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
+
+ U32 update_type = UPD_POSITION | UPD_ROTATION;
+ LLViewerRegion *last_region, *curr_region = node->getObject()->getRegion();
+ S32 objects_in_this_packet = 0;
+
+ // apply to linked objects if unable to select their individual parts
+ if (!gSavedSettings.getBOOL("EditLinkedParts") && !getTEMode())
+ {
+ // tell simulator to apply to whole linked sets
+ update_type |= UPD_LINKED_SETS;
+ }
+
+ // prepare first bulk message
+ gMessageSystem->newMessage("MultipleObjectUpdate");
+ packAgentAndSessionID(&update_type);
+
+ LLViewerObject *obj = NULL;
+ for (LLObjectSelection::root_iterator it = getSelection()->root_begin();
+ it != getSelection()->root_end(); ++it)
+ {
+ obj = (*it)->getObject();
+
+ // note: following code adapted from sendListToRegions() (@3924)
+ last_region = curr_region;
+ curr_region = obj->getRegion();
+
+ // if not simulator or message too big
+ if (curr_region != last_region
+ || gMessageSystem->isSendFull(NULL)
+ || objects_in_this_packet >= MAX_OBJECTS_PER_PACKET)
+ {
+ // send sim the current message and start new one
+ gMessageSystem->sendReliable(last_region->getHost());
+ objects_in_this_packet = 0;
+ gMessageSystem->newMessage("MultipleObjectUpdate");
+ packAgentAndSessionID(&update_type);
+ }
+
+ // add another instance of the body of data
+ packMultipleUpdate(*it, &update_type);
+ ++objects_in_this_packet;
+ }
+
+ // flush remaining messages
+ if (gMessageSystem->getCurrentSendTotal() > 0)
+ {
+ gMessageSystem->sendReliable(curr_region->getHost());
+ }
+ else
+ {
+ gMessageSystem->clearMessage();
+ }
+
+ //saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
}
template<>
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index f89209b437..1ce53fe149 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llselectmgr.h
* @brief A manager for selected objects and TEs.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,13 +42,13 @@
#include "llbbox.h"
#include "llpermissions.h"
#include "llcontrol.h"
-#include "llviewerobject.h" // LLObjectSelection::getSelectedTEValue template
+#include "llviewerobject.h" // LLObjectSelection::getSelectedTEValue template
#include "llmaterial.h"
#include <deque>
#include <boost/iterator/filter_iterator.hpp>
#include <boost/signals2.hpp>
-#include <boost/make_shared.hpp> // boost::make_shared
+#include <boost/make_shared.hpp> // boost::make_shared
class LLMessageSystem;
class LLViewerTexture;
@@ -56,30 +56,30 @@ class LLColor4;
class LLVector3;
class LLSelectNode;
-const U8 UPD_NONE = 0x00;
-const U8 UPD_POSITION = 0x01;
-const U8 UPD_ROTATION = 0x02;
-const U8 UPD_SCALE = 0x04;
-const U8 UPD_LINKED_SETS = 0x08;
-const U8 UPD_UNIFORM = 0x10; // used with UPD_SCALE
+const U8 UPD_NONE = 0x00;
+const U8 UPD_POSITION = 0x01;
+const U8 UPD_ROTATION = 0x02;
+const U8 UPD_SCALE = 0x04;
+const U8 UPD_LINKED_SETS = 0x08;
+const U8 UPD_UNIFORM = 0x10; // used with UPD_SCALE
// This is used by the DeRezObject message to determine where to put
// derezed tasks.
enum EDeRezDestination
{
- DRD_SAVE_INTO_AGENT_INVENTORY = 0,
- DRD_ACQUIRE_TO_AGENT_INVENTORY = 1, // try to leave copy in world
- DRD_SAVE_INTO_TASK_INVENTORY = 2,
- DRD_ATTACHMENT = 3,
- DRD_TAKE_INTO_AGENT_INVENTORY = 4, // delete from world
- DRD_FORCE_TO_GOD_INVENTORY = 5, // force take copy
- DRD_TRASH = 6,
- DRD_ATTACHMENT_TO_INV = 7,
- DRD_ATTACHMENT_EXISTS = 8,
- DRD_RETURN_TO_OWNER = 9, // back to owner's inventory
- DRD_RETURN_TO_LAST_OWNER = 10, // deeded object back to last owner's inventory
-
- DRD_COUNT = 11
+ DRD_SAVE_INTO_AGENT_INVENTORY = 0,
+ DRD_ACQUIRE_TO_AGENT_INVENTORY = 1, // try to leave copy in world
+ DRD_SAVE_INTO_TASK_INVENTORY = 2,
+ DRD_ATTACHMENT = 3,
+ DRD_TAKE_INTO_AGENT_INVENTORY = 4, // delete from world
+ DRD_FORCE_TO_GOD_INVENTORY = 5, // force take copy
+ DRD_TRASH = 6,
+ DRD_ATTACHMENT_TO_INV = 7,
+ DRD_ATTACHMENT_EXISTS = 8,
+ DRD_RETURN_TO_OWNER = 9, // back to owner's inventory
+ DRD_RETURN_TO_LAST_OWNER = 10, // deeded object back to last owner's inventory
+
+ DRD_COUNT = 11
};
@@ -92,8 +92,8 @@ const S32 SELECT_MAX_TES = 32;
// the operation was successful.
struct LLSelectedObjectFunctor
{
- virtual ~LLSelectedObjectFunctor() {};
- virtual bool apply(LLViewerObject* object) = 0;
+ virtual ~LLSelectedObjectFunctor() {};
+ virtual bool apply(LLViewerObject* object) = 0;
};
// Do something to all select nodes in the selection manager.
@@ -102,63 +102,63 @@ struct LLSelectedObjectFunctor
// the operation was successful.
struct LLSelectedNodeFunctor
{
- virtual ~LLSelectedNodeFunctor() {};
- virtual bool apply(LLSelectNode* node) = 0;
+ virtual ~LLSelectedNodeFunctor() {};
+ virtual bool apply(LLSelectNode* node) = 0;
};
struct LLSelectedTEFunctor
{
- virtual ~LLSelectedTEFunctor() {};
- virtual bool apply(LLViewerObject* object, S32 face) = 0;
+ virtual ~LLSelectedTEFunctor() {};
+ virtual bool apply(LLViewerObject* object, S32 face) = 0;
};
struct LLSelectedTEMaterialFunctor
{
- virtual ~LLSelectedTEMaterialFunctor() {};
- virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) = 0;
+ virtual ~LLSelectedTEMaterialFunctor() {};
+ virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) = 0;
};
template <typename T> struct LLSelectedTEGetFunctor
{
- virtual ~LLSelectedTEGetFunctor() {};
- virtual T get(LLViewerObject* object, S32 te) = 0;
+ virtual ~LLSelectedTEGetFunctor() {};
+ virtual T get(LLViewerObject* object, S32 te) = 0;
};
template <typename T> struct LLCheckIdenticalFunctor
{
- static bool same(const T& a, const T& b, const T& tolerance);
+ static bool same(const T& a, const T& b, const T& tolerance);
};
typedef enum e_send_type
{
- SEND_ONLY_ROOTS,
- SEND_INDIVIDUALS,
- SEND_ROOTS_FIRST, // useful for serial undos on linked sets
- SEND_CHILDREN_FIRST // useful for serial transforms of linked sets
+ SEND_ONLY_ROOTS,
+ SEND_INDIVIDUALS,
+ SEND_ROOTS_FIRST, // useful for serial undos on linked sets
+ SEND_CHILDREN_FIRST // useful for serial transforms of linked sets
} ESendType;
typedef enum e_grid_mode
{
- GRID_MODE_WORLD,
- GRID_MODE_LOCAL,
- GRID_MODE_REF_OBJECT
+ GRID_MODE_WORLD,
+ GRID_MODE_LOCAL,
+ GRID_MODE_REF_OBJECT
} EGridMode;
typedef enum e_action_type
{
- SELECT_ACTION_TYPE_BEGIN,
- SELECT_ACTION_TYPE_PICK,
- SELECT_ACTION_TYPE_MOVE,
- SELECT_ACTION_TYPE_ROTATE,
- SELECT_ACTION_TYPE_SCALE,
- NUM_ACTION_TYPES
+ SELECT_ACTION_TYPE_BEGIN,
+ SELECT_ACTION_TYPE_PICK,
+ SELECT_ACTION_TYPE_MOVE,
+ SELECT_ACTION_TYPE_ROTATE,
+ SELECT_ACTION_TYPE_SCALE,
+ NUM_ACTION_TYPES
}EActionType;
typedef enum e_selection_type
{
- SELECT_TYPE_WORLD,
- SELECT_TYPE_ATTACHMENT,
- SELECT_TYPE_HUD
+ SELECT_TYPE_WORLD,
+ SELECT_TYPE_ATTACHMENT,
+ SELECT_TYPE_HUD
}ESelectType;
typedef std::vector<LLPointer<LLGLTFMaterial> > gltf_materials_vec_t;
@@ -169,28 +169,28 @@ const S32 TE_SELECT_MASK_ALL = 0xFFFFFFFF;
class LLSelectNode
{
public:
- LLSelectNode(LLViewerObject* object, BOOL do_glow);
- LLSelectNode(const LLSelectNode& nodep);
- ~LLSelectNode();
-
- void selectAllTEs(BOOL b);
- void selectTE(S32 te_index, BOOL selected);
- BOOL isTESelected(S32 te_index) const;
- bool hasSelectedTE() const { return TE_SELECT_MASK_ALL & mTESelectMask; }
- S32 getLastSelectedTE() const;
- S32 getLastOperatedTE() const { return mLastTESelected; }
- S32 getTESelectMask() { return mTESelectMask; }
- void renderOneSilhouette(const LLColor4 &color);
- void setTransient(BOOL transient) { mTransient = transient; }
- BOOL isTransient() const { return mTransient; }
- LLViewerObject* getObject();
- void setObject(LLViewerObject* object);
- // *NOTE: invalidate stored textures and colors when # faces change
+ LLSelectNode(LLViewerObject* object, BOOL do_glow);
+ LLSelectNode(const LLSelectNode& nodep);
+ ~LLSelectNode();
+
+ void selectAllTEs(BOOL b);
+ void selectTE(S32 te_index, BOOL selected);
+ BOOL isTESelected(S32 te_index) const;
+ bool hasSelectedTE() const { return TE_SELECT_MASK_ALL & mTESelectMask; }
+ S32 getLastSelectedTE() const;
+ S32 getLastOperatedTE() const { return mLastTESelected; }
+ S32 getTESelectMask() { return mTESelectMask; }
+ void renderOneSilhouette(const LLColor4 &color);
+ void setTransient(BOOL transient) { mTransient = transient; }
+ BOOL isTransient() const { return mTransient; }
+ LLViewerObject* getObject();
+ void setObject(LLViewerObject* object);
+ // *NOTE: invalidate stored textures and colors when # faces change
// Used by tools floater's color/texture pickers to restore changes
- void saveColors();
- void saveShinyColors();
- void saveTextures(const uuid_vec_t& textures);
- void saveTextureScaleRatios(LLRender::eTexIndex index_to_query);
+ void saveColors();
+ void saveShinyColors();
+ void saveTextures(const uuid_vec_t& textures);
+ void saveTextureScaleRatios(LLRender::eTexIndex index_to_query);
// GLTF materials are applied to objects by ids,
// overrides get applied on top of materials resulting in
@@ -199,185 +199,185 @@ public:
// overrides get applied in live material editor
void saveGLTFMaterials(const uuid_vec_t& materials, const gltf_materials_vec_t& override_materials);
- BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const;
+ BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const;
public:
- BOOL mIndividualSelection; // For root objects and objects individually selected
-
- BOOL mTransient;
- BOOL mValid; // is extra information valid?
- LLPermissions* mPermissions;
- LLSaleInfo mSaleInfo;
- LLAggregatePermissions mAggregatePerm;
- LLAggregatePermissions mAggregateTexturePerm;
- LLAggregatePermissions mAggregateTexturePermOwner;
- std::string mName;
- std::string mDescription;
- LLCategory mCategory;
- S16 mInventorySerial;
- LLVector3 mSavedPositionLocal; // for interactively modifying object position
- LLVector3 mLastPositionLocal;
- LLVector3d mSavedPositionGlobal; // for interactively modifying object position
- LLVector3 mSavedScale; // for interactively modifying object scale
- LLVector3 mLastScale;
- LLQuaternion mSavedRotation; // for interactively modifying object rotation
- LLQuaternion mLastRotation;
- BOOL mDuplicated;
- LLVector3d mDuplicatePos;
- LLQuaternion mDuplicateRot;
- LLUUID mItemID;
- LLUUID mFolderID;
- LLUUID mFromTaskID;
- std::string mTouchName;
- std::string mSitName;
- U64 mCreationDate;
- std::vector<LLColor4> mSavedColors;
- std::vector<LLColor4> mSavedShinyColors;
- uuid_vec_t mSavedTextures;
- uuid_vec_t mSavedGLTFMaterialIds;
+ BOOL mIndividualSelection; // For root objects and objects individually selected
+
+ BOOL mTransient;
+ BOOL mValid; // is extra information valid?
+ LLPermissions* mPermissions;
+ LLSaleInfo mSaleInfo;
+ LLAggregatePermissions mAggregatePerm;
+ LLAggregatePermissions mAggregateTexturePerm;
+ LLAggregatePermissions mAggregateTexturePermOwner;
+ std::string mName;
+ std::string mDescription;
+ LLCategory mCategory;
+ S16 mInventorySerial;
+ LLVector3 mSavedPositionLocal; // for interactively modifying object position
+ LLVector3 mLastPositionLocal;
+ LLVector3d mSavedPositionGlobal; // for interactively modifying object position
+ LLVector3 mSavedScale; // for interactively modifying object scale
+ LLVector3 mLastScale;
+ LLQuaternion mSavedRotation; // for interactively modifying object rotation
+ LLQuaternion mLastRotation;
+ BOOL mDuplicated;
+ LLVector3d mDuplicatePos;
+ LLQuaternion mDuplicateRot;
+ LLUUID mItemID;
+ LLUUID mFolderID;
+ LLUUID mFromTaskID;
+ std::string mTouchName;
+ std::string mSitName;
+ U64 mCreationDate;
+ std::vector<LLColor4> mSavedColors;
+ std::vector<LLColor4> mSavedShinyColors;
+ uuid_vec_t mSavedTextures;
+ uuid_vec_t mSavedGLTFMaterialIds;
gltf_materials_vec_t mSavedGLTFOverrideMaterials;
- std::vector<LLVector3> mTextureScaleRatios;
- std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object
- std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object
- BOOL mSilhouetteExists; // need to generate silhouette?
+ std::vector<LLVector3> mTextureScaleRatios;
+ std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object
+ std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object
+ BOOL mSilhouetteExists; // need to generate silhouette?
protected:
- LLPointer<LLViewerObject> mObject;
- S32 mTESelectMask;
- S32 mLastTESelected;
+ LLPointer<LLViewerObject> mObject;
+ S32 mTESelectMask;
+ S32 mLastTESelected;
};
class LLObjectSelection : public LLRefCount
{
- friend class LLSelectMgr;
- friend class LLSafeHandle<LLObjectSelection>;
- friend class LLSelectionCallbackData;
+ friend class LLSelectMgr;
+ friend class LLSafeHandle<LLObjectSelection>;
+ friend class LLSelectionCallbackData;
protected:
- ~LLObjectSelection();
+ ~LLObjectSelection();
public:
- typedef std::list<LLSelectNode*> list_t;
-
- // Iterators
- struct is_non_null
- {
- bool operator()(LLSelectNode* node)
- {
- return (node->getObject() != NULL);
- }
- };
- typedef boost::filter_iterator<is_non_null, list_t::iterator > iterator;
- iterator begin() { return iterator(mList.begin(), mList.end()); }
- iterator end() { return iterator(mList.end(), mList.end()); }
-
- struct is_valid
- {
- bool operator()(LLSelectNode* node)
- {
- return (node->getObject() != NULL) && node->mValid;
- }
- };
- typedef boost::filter_iterator<is_valid, list_t::iterator > valid_iterator;
- valid_iterator valid_begin() { return valid_iterator(mList.begin(), mList.end()); }
- valid_iterator valid_end() { return valid_iterator(mList.end(), mList.end()); }
-
- struct is_root
- {
- bool operator()(LLSelectNode* node);
- };
- typedef boost::filter_iterator<is_root, list_t::iterator > root_iterator;
- root_iterator root_begin() { return root_iterator(mList.begin(), mList.end()); }
- root_iterator root_end() { return root_iterator(mList.end(), mList.end()); }
-
- struct is_valid_root
- {
- bool operator()(LLSelectNode* node);
- };
- typedef boost::filter_iterator<is_valid_root, list_t::iterator > valid_root_iterator;
- valid_root_iterator valid_root_begin() { return valid_root_iterator(mList.begin(), mList.end()); }
- valid_root_iterator valid_root_end() { return valid_root_iterator(mList.end(), mList.end()); }
-
- struct is_root_object
- {
- bool operator()(LLSelectNode* node);
- };
- typedef boost::filter_iterator<is_root_object, list_t::iterator > root_object_iterator;
- root_object_iterator root_object_begin() { return root_object_iterator(mList.begin(), mList.end()); }
- root_object_iterator root_object_end() { return root_object_iterator(mList.end(), mList.end()); }
-
+ typedef std::list<LLSelectNode*> list_t;
+
+ // Iterators
+ struct is_non_null
+ {
+ bool operator()(LLSelectNode* node)
+ {
+ return (node->getObject() != NULL);
+ }
+ };
+ typedef boost::filter_iterator<is_non_null, list_t::iterator > iterator;
+ iterator begin() { return iterator(mList.begin(), mList.end()); }
+ iterator end() { return iterator(mList.end(), mList.end()); }
+
+ struct is_valid
+ {
+ bool operator()(LLSelectNode* node)
+ {
+ return (node->getObject() != NULL) && node->mValid;
+ }
+ };
+ typedef boost::filter_iterator<is_valid, list_t::iterator > valid_iterator;
+ valid_iterator valid_begin() { return valid_iterator(mList.begin(), mList.end()); }
+ valid_iterator valid_end() { return valid_iterator(mList.end(), mList.end()); }
+
+ struct is_root
+ {
+ bool operator()(LLSelectNode* node);
+ };
+ typedef boost::filter_iterator<is_root, list_t::iterator > root_iterator;
+ root_iterator root_begin() { return root_iterator(mList.begin(), mList.end()); }
+ root_iterator root_end() { return root_iterator(mList.end(), mList.end()); }
+
+ struct is_valid_root
+ {
+ bool operator()(LLSelectNode* node);
+ };
+ typedef boost::filter_iterator<is_valid_root, list_t::iterator > valid_root_iterator;
+ valid_root_iterator valid_root_begin() { return valid_root_iterator(mList.begin(), mList.end()); }
+ valid_root_iterator valid_root_end() { return valid_root_iterator(mList.end(), mList.end()); }
+
+ struct is_root_object
+ {
+ bool operator()(LLSelectNode* node);
+ };
+ typedef boost::filter_iterator<is_root_object, list_t::iterator > root_object_iterator;
+ root_object_iterator root_object_begin() { return root_object_iterator(mList.begin(), mList.end()); }
+ root_object_iterator root_object_end() { return root_object_iterator(mList.end(), mList.end()); }
+
public:
- LLObjectSelection();
-
- void updateEffects();
-
- BOOL isEmpty() const;
-
- LLSelectNode* getFirstNode(LLSelectedNodeFunctor* func = NULL);
- LLSelectNode* getFirstRootNode(LLSelectedNodeFunctor* func = NULL, BOOL non_root_ok = FALSE);
- LLViewerObject* getFirstSelectedObject(LLSelectedNodeFunctor* func, BOOL get_parent = FALSE);
- LLViewerObject* getFirstObject();
- LLViewerObject* getFirstRootObject(BOOL non_root_ok = FALSE);
-
- LLSelectNode* getFirstMoveableNode(BOOL get_root_first = FALSE);
-
- LLViewerObject* getFirstEditableObject(BOOL get_parent = FALSE);
- LLViewerObject* getFirstCopyableObject(BOOL get_parent = FALSE);
- LLViewerObject* getFirstDeleteableObject();
- LLViewerObject* getFirstMoveableObject(BOOL get_parent = FALSE);
- LLViewerObject* getFirstUndoEnabledObject(BOOL get_parent = FALSE);
-
- /// Return the object that lead to this selection, possible a child
- LLViewerObject* getPrimaryObject() { return mPrimaryObject; }
-
- // iterate through texture entries
- template <typename T> bool getSelectedTEValue(LLSelectedTEGetFunctor<T>* func, T& res, bool has_tolerance = false, T tolerance = T());
- template <typename T> bool isMultipleTEValue(LLSelectedTEGetFunctor<T>* func, const T& ignore_value);
-
- S32 getNumNodes();
- LLSelectNode* findNode(LLViewerObject* objectp);
-
- // count members
- S32 getObjectCount();
- F32 getSelectedObjectCost();
- F32 getSelectedLinksetCost();
- F32 getSelectedPhysicsCost();
- F32 getSelectedLinksetPhysicsCost();
- S32 getSelectedObjectRenderCost();
-
- F32 getSelectedObjectStreamingCost(S32* total_bytes = NULL, S32* visible_bytes = NULL);
- U32 getSelectedObjectTriangleCount(S32* vcount = NULL);
-
- S32 getTECount();
- S32 getRootObjectCount();
-
- BOOL isMultipleTESelected();
- BOOL contains(LLViewerObject* object);
- BOOL contains(LLViewerObject* object, S32 te);
-
- // returns TRUE is any node is currenly worn as an attachment
- BOOL isAttachment();
+ LLObjectSelection();
+
+ void updateEffects();
+
+ BOOL isEmpty() const;
+
+ LLSelectNode* getFirstNode(LLSelectedNodeFunctor* func = NULL);
+ LLSelectNode* getFirstRootNode(LLSelectedNodeFunctor* func = NULL, BOOL non_root_ok = FALSE);
+ LLViewerObject* getFirstSelectedObject(LLSelectedNodeFunctor* func, BOOL get_parent = FALSE);
+ LLViewerObject* getFirstObject();
+ LLViewerObject* getFirstRootObject(BOOL non_root_ok = FALSE);
+
+ LLSelectNode* getFirstMoveableNode(BOOL get_root_first = FALSE);
+
+ LLViewerObject* getFirstEditableObject(BOOL get_parent = FALSE);
+ LLViewerObject* getFirstCopyableObject(BOOL get_parent = FALSE);
+ LLViewerObject* getFirstDeleteableObject();
+ LLViewerObject* getFirstMoveableObject(BOOL get_parent = FALSE);
+ LLViewerObject* getFirstUndoEnabledObject(BOOL get_parent = FALSE);
+
+ /// Return the object that lead to this selection, possible a child
+ LLViewerObject* getPrimaryObject() { return mPrimaryObject; }
+
+ // iterate through texture entries
+ template <typename T> bool getSelectedTEValue(LLSelectedTEGetFunctor<T>* func, T& res, bool has_tolerance = false, T tolerance = T());
+ template <typename T> bool isMultipleTEValue(LLSelectedTEGetFunctor<T>* func, const T& ignore_value);
+
+ S32 getNumNodes();
+ LLSelectNode* findNode(LLViewerObject* objectp);
+
+ // count members
+ S32 getObjectCount();
+ F32 getSelectedObjectCost();
+ F32 getSelectedLinksetCost();
+ F32 getSelectedPhysicsCost();
+ F32 getSelectedLinksetPhysicsCost();
+ S32 getSelectedObjectRenderCost();
+
+ F32 getSelectedObjectStreamingCost(S32* total_bytes = NULL, S32* visible_bytes = NULL);
+ U32 getSelectedObjectTriangleCount(S32* vcount = NULL);
+
+ S32 getTECount();
+ S32 getRootObjectCount();
+
+ BOOL isMultipleTESelected();
+ BOOL contains(LLViewerObject* object);
+ BOOL contains(LLViewerObject* object, S32 te);
+
+ // returns TRUE is any node is currenly worn as an attachment
+ BOOL isAttachment();
bool checkAnimatedObjectEstTris();
bool checkAnimatedObjectLinkable();
-
- // Apply functors to various subsets of the selected objects
- // If firstonly is FALSE, returns the AND of all apply() calls.
- // Else returns TRUE immediately if any apply() call succeeds (i.e. OR with early exit)
- bool applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly = false);
- bool applyToObjects(LLSelectedObjectFunctor* func);
- bool applyToTEs(LLSelectedTEFunctor* func, bool firstonly = false);
- bool applyToRootNodes(LLSelectedNodeFunctor* func, bool firstonly = false);
- bool applyToNodes(LLSelectedNodeFunctor* func, bool firstonly = false);
-
- /*
- * Used to apply (no-copy) textures to the selected object or
- * selected face/faces of the object.
- * This method moves (no-copy) texture to the object's inventory
- * and doesn't make copy of the texture for each face.
- * Then this only texture is used for all selected faces.
- */
- void applyNoCopyTextureToTEs(LLViewerInventoryItem* item);
+
+ // Apply functors to various subsets of the selected objects
+ // If firstonly is FALSE, returns the AND of all apply() calls.
+ // Else returns TRUE immediately if any apply() call succeeds (i.e. OR with early exit)
+ bool applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly = false);
+ bool applyToObjects(LLSelectedObjectFunctor* func);
+ bool applyToTEs(LLSelectedTEFunctor* func, bool firstonly = false);
+ bool applyToRootNodes(LLSelectedNodeFunctor* func, bool firstonly = false);
+ bool applyToNodes(LLSelectedNodeFunctor* func, bool firstonly = false);
+
+ /*
+ * Used to apply (no-copy) textures to the selected object or
+ * selected face/faces of the object.
+ * This method moves (no-copy) texture to the object's inventory
+ * and doesn't make copy of the texture for each face.
+ * Then this only texture is used for all selected faces.
+ */
+ void applyNoCopyTextureToTEs(LLViewerInventoryItem* item);
/*
* Multi-purpose function for applying PBR materials to the
* selected object or faces, any combination of copy/mod/transfer
@@ -390,24 +390,24 @@ public:
*/
bool applyRestrictedPbrMaterialToTEs(LLViewerInventoryItem* item);
- ESelectType getSelectType() const { return mSelectType; }
+ ESelectType getSelectType() const { return mSelectType; }
private:
- void addNode(LLSelectNode *nodep);
- void addNodeAtEnd(LLSelectNode *nodep);
- void moveNodeToFront(LLSelectNode *nodep);
- void removeNode(LLSelectNode *nodep);
- void deleteAllNodes();
- void cleanupNodes();
+ void addNode(LLSelectNode *nodep);
+ void addNodeAtEnd(LLSelectNode *nodep);
+ void moveNodeToFront(LLSelectNode *nodep);
+ void removeNode(LLSelectNode *nodep);
+ void deleteAllNodes();
+ void cleanupNodes();
private:
- list_t mList;
- const LLObjectSelection &operator=(const LLObjectSelection &);
+ list_t mList;
+ const LLObjectSelection &operator=(const LLObjectSelection &);
- LLPointer<LLViewerObject> mPrimaryObject;
- std::map<LLPointer<LLViewerObject>, LLSelectNode*> mSelectNodeMap;
- ESelectType mSelectType;
+ LLPointer<LLViewerObject> mPrimaryObject;
+ std::map<LLPointer<LLViewerObject>, LLSelectNode*> mSelectNodeMap;
+ ESelectType mSelectType;
};
typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
@@ -425,70 +425,70 @@ class LLSelectionCallbackData
{
public:
LLSelectionCallbackData();
- LLObjectSelectionHandle getSelection() { return mSelectedObjects; }
+ LLObjectSelectionHandle getSelection() { return mSelectedObjects; }
private:
- LLObjectSelectionHandle mSelectedObjects;
+ LLObjectSelectionHandle mSelectedObjects;
};
class LLSelectMgr : public LLEditMenuHandler, public LLSimpleton<LLSelectMgr>
{
public:
- static BOOL sRectSelectInclusive; // do we need to surround an object to pick it?
- static BOOL sRenderHiddenSelections; // do we show selection silhouettes that are occluded?
- static BOOL sRenderLightRadius; // do we show the radius of selected lights?
-
- static F32 sHighlightThickness;
- static F32 sHighlightUScale;
- static F32 sHighlightVScale;
- static F32 sHighlightAlpha;
- static F32 sHighlightAlphaTest;
- static F32 sHighlightUAnim;
- static F32 sHighlightVAnim;
- static LLColor4 sSilhouetteParentColor;
- static LLColor4 sSilhouetteChildColor;
- static LLColor4 sHighlightParentColor;
- static LLColor4 sHighlightChildColor;
- static LLColor4 sHighlightInspectColor;
- static LLColor4 sContextSilhouetteColor;
-
- LLCachedControl<bool> mHideSelectedObjects;
- LLCachedControl<bool> mRenderHighlightSelections;
- LLCachedControl<bool> mAllowSelectAvatar;
- LLCachedControl<bool> mDebugSelectMgr;
+ static BOOL sRectSelectInclusive; // do we need to surround an object to pick it?
+ static BOOL sRenderHiddenSelections; // do we show selection silhouettes that are occluded?
+ static BOOL sRenderLightRadius; // do we show the radius of selected lights?
+
+ static F32 sHighlightThickness;
+ static F32 sHighlightUScale;
+ static F32 sHighlightVScale;
+ static F32 sHighlightAlpha;
+ static F32 sHighlightAlphaTest;
+ static F32 sHighlightUAnim;
+ static F32 sHighlightVAnim;
+ static LLColor4 sSilhouetteParentColor;
+ static LLColor4 sSilhouetteChildColor;
+ static LLColor4 sHighlightParentColor;
+ static LLColor4 sHighlightChildColor;
+ static LLColor4 sHighlightInspectColor;
+ static LLColor4 sContextSilhouetteColor;
+
+ LLCachedControl<bool> mHideSelectedObjects;
+ LLCachedControl<bool> mRenderHighlightSelections;
+ LLCachedControl<bool> mAllowSelectAvatar;
+ LLCachedControl<bool> mDebugSelectMgr;
public:
LLSelectMgr();
~LLSelectMgr();
- static void cleanupGlobals();
+ static void cleanupGlobals();
- // LLEditMenuHandler interface
- virtual BOOL canUndo() const;
- virtual void undo();
+ // LLEditMenuHandler interface
+ virtual BOOL canUndo() const;
+ virtual void undo();
- virtual BOOL canRedo() const;
- virtual void redo();
+ virtual BOOL canRedo() const;
+ virtual void redo();
- virtual BOOL canDoDelete() const;
- virtual void doDelete();
+ virtual BOOL canDoDelete() const;
+ virtual void doDelete();
- virtual void deselect();
- virtual BOOL canDeselect() const;
+ virtual void deselect();
+ virtual BOOL canDeselect() const;
- virtual void duplicate();
- virtual BOOL canDuplicate() const;
+ virtual void duplicate();
+ virtual BOOL canDuplicate() const;
- void clearSelections();
- void update();
- void updateEffects(); // Update HUD effects
+ void clearSelections();
+ void update();
+ void updateEffects(); // Update HUD effects
- // When we edit object's position/rotation/scale we set local
- // overrides and ignore any updates (override received valeus).
- // When we send data to server, we send local values and reset
- // overrides
- void resetObjectOverrides();
- void resetObjectOverrides(LLObjectSelectionHandle selected_handle);
- void overrideObjectUpdates();
+ // When we edit object's position/rotation/scale we set local
+ // overrides and ignore any updates (override received valeus).
+ // When we send data to server, we send local values and reset
+ // overrides
+ void resetObjectOverrides();
+ void resetObjectOverrides(LLObjectSelectionHandle selected_handle);
+ void overrideObjectUpdates();
void resetAvatarOverrides();
void overrideAvatarUpdates();
@@ -514,430 +514,430 @@ public:
public:
- // Returns the previous value of mForceSelection
- BOOL setForceSelection(BOOL force);
+ // Returns the previous value of mForceSelection
+ BOOL setForceSelection(BOOL force);
+
+ ////////////////////////////////////////////////////////////////
+ // Selection methods
+ ////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////
- // Selection methods
- ////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////
+ // Add
+ ////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////
- // Add
- ////////////////////////////////////////////////////////////////
+ // This method is meant to select an object, and then select all
+ // of the ancestors and descendants. This should be the normal behavior.
+ //
+ // *NOTE: You must hold on to the object selection handle, otherwise
+ // the objects will be automatically deselected in 1 frame.
+ LLObjectSelectionHandle selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE, BOOL ignore_select_owned = FALSE);
- // This method is meant to select an object, and then select all
- // of the ancestors and descendants. This should be the normal behavior.
- //
- // *NOTE: You must hold on to the object selection handle, otherwise
- // the objects will be automatically deselected in 1 frame.
- LLObjectSelectionHandle selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE, BOOL ignore_select_owned = FALSE);
+ // For when you want just a child object.
+ LLObjectSelectionHandle selectObjectOnly(LLViewerObject* object, S32 face = SELECT_ALL_TES);
- // For when you want just a child object.
- LLObjectSelectionHandle selectObjectOnly(LLViewerObject* object, S32 face = SELECT_ALL_TES);
+ // Same as above, but takes a list of objects. Used by rectangle select.
+ LLObjectSelectionHandle selectObjectAndFamily(const std::vector<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE);
- // Same as above, but takes a list of objects. Used by rectangle select.
- LLObjectSelectionHandle selectObjectAndFamily(const std::vector<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE);
+ // converts all objects currently highlighted to a selection, and returns it
+ LLObjectSelectionHandle selectHighlightedObjects();
- // converts all objects currently highlighted to a selection, and returns it
- LLObjectSelectionHandle selectHighlightedObjects();
+ LLObjectSelectionHandle setHoverObject(LLViewerObject *objectp, S32 face = -1);
+ LLSelectNode *getHoverNode();
+ LLSelectNode *getPrimaryHoverNode();
- LLObjectSelectionHandle setHoverObject(LLViewerObject *objectp, S32 face = -1);
- LLSelectNode *getHoverNode();
- LLSelectNode *getPrimaryHoverNode();
+ void highlightObjectOnly(LLViewerObject *objectp);
+ void highlightObjectAndFamily(LLViewerObject *objectp);
+ void highlightObjectAndFamily(const std::vector<LLViewerObject*>& list);
- void highlightObjectOnly(LLViewerObject *objectp);
- void highlightObjectAndFamily(LLViewerObject *objectp);
- void highlightObjectAndFamily(const std::vector<LLViewerObject*>& list);
+ ////////////////////////////////////////////////////////////////
+ // Remove
+ ////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////
- // Remove
- ////////////////////////////////////////////////////////////////
+ void deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim = TRUE);
+ void deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim = TRUE, BOOL include_entire_object = FALSE);
- void deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim = TRUE);
- void deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim = TRUE, BOOL include_entire_object = FALSE);
+ // Send deselect messages to simulator, then clear the list
+ void deselectAll();
+ void deselectAllForStandingUp();
- // Send deselect messages to simulator, then clear the list
- void deselectAll();
- void deselectAllForStandingUp();
+ // deselect only if nothing else currently referencing the selection
+ void deselectUnused();
- // deselect only if nothing else currently referencing the selection
- void deselectUnused();
+ // Deselect if the selection center is too far away from the agent.
+ void deselectAllIfTooFar();
- // Deselect if the selection center is too far away from the agent.
- void deselectAllIfTooFar();
+ // Removes all highlighted objects from current selection
+ void deselectHighlightedObjects();
- // Removes all highlighted objects from current selection
- void deselectHighlightedObjects();
+ void unhighlightObjectOnly(LLViewerObject *objectp);
+ void unhighlightObjectAndFamily(LLViewerObject *objectp);
+ void unhighlightAll();
- void unhighlightObjectOnly(LLViewerObject *objectp);
- void unhighlightObjectAndFamily(LLViewerObject *objectp);
- void unhighlightAll();
+ BOOL removeObjectFromSelections(const LLUUID &id);
- BOOL removeObjectFromSelections(const LLUUID &id);
+ ////////////////////////////////////////////////////////////////
+ // Selection editing
+ ////////////////////////////////////////////////////////////////
+ bool linkObjects();
- ////////////////////////////////////////////////////////////////
- // Selection editing
- ////////////////////////////////////////////////////////////////
- bool linkObjects();
+ bool unlinkObjects();
- bool unlinkObjects();
+ void confirmUnlinkObjects(const LLSD& notification, const LLSD& response);
- void confirmUnlinkObjects(const LLSD& notification, const LLSD& response);
+ bool enableLinkObjects();
- bool enableLinkObjects();
+ bool enableUnlinkObjects();
- bool enableUnlinkObjects();
+ ////////////////////////////////////////////////////////////////
+ // Selection accessors
+ ////////////////////////////////////////////////////////////////
+ LLObjectSelectionHandle getSelection() { return mSelectedObjects; }
+ // right now this just renders the selection with root/child colors instead of a single color
+ LLObjectSelectionHandle getEditSelection() { convertTransient(); return mSelectedObjects; }
+ LLObjectSelectionHandle getHighlightedObjects() { return mHighlightedObjects; }
- ////////////////////////////////////////////////////////////////
- // Selection accessors
- ////////////////////////////////////////////////////////////////
- LLObjectSelectionHandle getSelection() { return mSelectedObjects; }
- // right now this just renders the selection with root/child colors instead of a single color
- LLObjectSelectionHandle getEditSelection() { convertTransient(); return mSelectedObjects; }
- LLObjectSelectionHandle getHighlightedObjects() { return mHighlightedObjects; }
+ ////////////////////////////////////////////////////////////////
+ // Grid manipulation
+ ////////////////////////////////////////////////////////////////
+ void addGridObject(LLViewerObject* objectp);
+ void clearGridObjects();
+ void setGridMode(EGridMode mode);
+ EGridMode getGridMode() { return mGridMode; }
+ void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale, bool for_snap_guides = false);
- ////////////////////////////////////////////////////////////////
- // Grid manipulation
- ////////////////////////////////////////////////////////////////
- void addGridObject(LLViewerObject* objectp);
- void clearGridObjects();
- void setGridMode(EGridMode mode);
- EGridMode getGridMode() { return mGridMode; }
- void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale, bool for_snap_guides = false);
+ BOOL getTEMode() const { return mTEMode; }
+ void setTEMode(BOOL b) { mTEMode = b; }
- BOOL getTEMode() const { return mTEMode; }
- void setTEMode(BOOL b) { mTEMode = b; }
+ BOOL shouldShowSelection() const { return mShowSelection; }
- BOOL shouldShowSelection() const { return mShowSelection; }
+ LLBBox getBBoxOfSelection() const;
+ LLBBox getSavedBBoxOfSelection() const { return mSavedSelectionBBox; }
- LLBBox getBBoxOfSelection() const;
- LLBBox getSavedBBoxOfSelection() const { return mSavedSelectionBBox; }
+ void dump();
+ void cleanup();
- void dump();
- void cleanup();
-
- void updateSilhouettes();
- void renderSilhouettes(BOOL for_hud);
- void enableSilhouette(BOOL enable) { mRenderSilhouettes = enable; }
-
- ////////////////////////////////////////////////////////////////
- // Utility functions that operate on the current selection
- ////////////////////////////////////////////////////////////////
- void saveSelectedObjectTransform(EActionType action_type);
- void saveSelectedObjectColors();
- void saveSelectedShinyColors();
- void saveSelectedObjectTextures();
-
- void selectionUpdatePhysics(BOOL use_physics);
- void selectionUpdateTemporary(BOOL is_temporary);
- void selectionUpdatePhantom(BOOL is_ghost);
- void selectionDump();
-
- BOOL selectionAllPCode(LLPCode code); // all objects have this PCode
- BOOL selectionGetClickAction(U8 *out_action);
- bool selectionGetIncludeInSearch(bool* include_in_search_out); // true if all selected objects have same
- BOOL selectionGetGlow(F32 *glow);
-
- void selectionSetPhysicsType(U8 type);
- void selectionSetGravity(F32 gravity);
- void selectionSetFriction(F32 friction);
- void selectionSetDensity(F32 density);
- void selectionSetRestitution(F32 restitution);
- void selectionSetMaterial(U8 material);
- bool selectionSetImage(const LLUUID& imageid); // could be item or asset id
+ void updateSilhouettes();
+ void renderSilhouettes(BOOL for_hud);
+ void enableSilhouette(BOOL enable) { mRenderSilhouettes = enable; }
+
+ ////////////////////////////////////////////////////////////////
+ // Utility functions that operate on the current selection
+ ////////////////////////////////////////////////////////////////
+ void saveSelectedObjectTransform(EActionType action_type);
+ void saveSelectedObjectColors();
+ void saveSelectedShinyColors();
+ void saveSelectedObjectTextures();
+
+ void selectionUpdatePhysics(BOOL use_physics);
+ void selectionUpdateTemporary(BOOL is_temporary);
+ void selectionUpdatePhantom(BOOL is_ghost);
+ void selectionDump();
+
+ BOOL selectionAllPCode(LLPCode code); // all objects have this PCode
+ BOOL selectionGetClickAction(U8 *out_action);
+ bool selectionGetIncludeInSearch(bool* include_in_search_out); // true if all selected objects have same
+ BOOL selectionGetGlow(F32 *glow);
+
+ void selectionSetPhysicsType(U8 type);
+ void selectionSetGravity(F32 gravity);
+ void selectionSetFriction(F32 friction);
+ void selectionSetDensity(F32 density);
+ void selectionSetRestitution(F32 restitution);
+ void selectionSetMaterial(U8 material);
+ bool selectionSetImage(const LLUUID& imageid); // could be item or asset id
bool selectionSetGLTFMaterial(const LLUUID& mat_id); // material id only
- void selectionSetColor(const LLColor4 &color);
- void selectionSetColorOnly(const LLColor4 &color); // Set only the RGB channels
- void selectionSetAlphaOnly(const F32 alpha); // Set only the alpha channel
- void selectionRevertColors();
- void selectionRevertShinyColors();
- BOOL selectionRevertTextures();
+ void selectionSetColor(const LLColor4 &color);
+ void selectionSetColorOnly(const LLColor4 &color); // Set only the RGB channels
+ void selectionSetAlphaOnly(const F32 alpha); // Set only the alpha channel
+ void selectionRevertColors();
+ void selectionRevertShinyColors();
+ BOOL selectionRevertTextures();
void selectionRevertGLTFMaterials();
- void selectionSetBumpmap( U8 bumpmap, const LLUUID &image_id );
- void selectionSetTexGen( U8 texgen );
- void selectionSetShiny( U8 shiny, const LLUUID &image_id );
- void selectionSetFullbright( U8 fullbright );
- void selectionSetMedia( U8 media_type, const LLSD &media_data );
- void selectionSetClickAction(U8 action);
- void selectionSetIncludeInSearch(bool include_in_search);
- void selectionSetGlow(const F32 glow);
- void selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func, int specific_te = -1);
- void selectionRemoveMaterial();
-
- void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE);
- void selectionSetObjectName(const std::string& name);
- void selectionSetObjectDescription(const std::string& desc);
- void selectionSetObjectCategory(const LLCategory& category);
- void selectionSetObjectSaleInfo(const LLSaleInfo& sale_info);
-
- void selectionTexScaleAutofit(F32 repeats_per_meter);
- void adjustTexturesByScale(BOOL send_to_sim, BOOL stretch);
-
- bool selectionMove(const LLVector3& displ, F32 rx, F32 ry, F32 rz,
- U32 update_type);
- void sendSelectionMove();
-
- void sendGodlikeRequest(const std::string& request, const std::string& parameter);
-
-
- // will make sure all selected object meet current criteria, or deselect them otherwise
- void validateSelection();
-
- // returns TRUE if it is possible to select this object
- BOOL canSelectObject(LLViewerObject* object, BOOL ignore_select_owned = FALSE);
-
- // Returns TRUE if the viewer has information on all selected objects
- BOOL selectGetAllRootsValid();
- BOOL selectGetAllValid();
- BOOL selectGetAllValidAndObjectsFound();
-
- // returns TRUE if you can modify all selected objects.
- BOOL selectGetRootsModify();
- BOOL selectGetModify();
-
- // returns TRUE if all objects are in same region
- BOOL selectGetSameRegion();
-
- // returns TRUE if is all objects are non-permanent-enforced
- BOOL selectGetRootsNonPermanentEnforced();
- BOOL selectGetNonPermanentEnforced();
-
- // returns TRUE if is all objects are permanent
- BOOL selectGetRootsPermanent();
- BOOL selectGetPermanent();
-
- // returns TRUE if is all objects are character
- BOOL selectGetRootsCharacter();
- BOOL selectGetCharacter();
-
- // returns TRUE if is all objects are not permanent
- BOOL selectGetRootsNonPathfinding();
- BOOL selectGetNonPathfinding();
-
- // returns TRUE if is all objects are not permanent
- BOOL selectGetRootsNonPermanent();
- BOOL selectGetNonPermanent();
-
- // returns TRUE if is all objects are not character
- BOOL selectGetRootsNonCharacter();
- BOOL selectGetNonCharacter();
-
- BOOL selectGetEditableLinksets();
- BOOL selectGetViewableCharacters();
-
- // returns TRUE if selected objects can be transferred.
- BOOL selectGetRootsTransfer();
-
- // returns TRUE if selected objects can be copied.
- BOOL selectGetRootsCopy();
-
- BOOL selectGetCreator(LLUUID& id, std::string& name); // TRUE if all have same creator, returns id
- BOOL selectGetOwner(LLUUID& id, std::string& name); // TRUE if all objects have same owner, returns id
- BOOL selectGetLastOwner(LLUUID& id, std::string& name); // TRUE if all objects have same owner, returns id
-
- // returns TRUE if all are the same. id is stuffed with
- // the value found if available.
- BOOL selectGetGroup(LLUUID& id);
- BOOL selectGetPerm( U8 which_perm, U32* mask_on, U32* mask_off); // TRUE if all have data, returns two masks, each indicating which bits are all on and all off
-
- BOOL selectIsGroupOwned(); // TRUE if all root objects have valid data and are group owned.
-
- // returns TRUE if all the nodes are valid. Accumulates
- // permissions in the parameter.
- BOOL selectGetPermissions(LLPermissions& perm);
-
- // returns TRUE if all the nodes are valid. Depends onto "edit linked" state
- // Children in linksets are a bit special - they require not only move permission
- // but also modify if "edit linked" is set, since you move them relative to parent
- BOOL selectGetEditMoveLinksetPermissions(bool &move, bool &modify);
-
- // Get a bunch of useful sale information for the object(s) selected.
- // "_mixed" is true if not all objects have the same setting.
- void selectGetAggregateSaleInfo(U32 &num_for_sale,
- BOOL &is_for_sale_mixed,
- BOOL &is_sale_price_mixed,
- S32 &total_sale_price,
- S32 &individual_sale_price);
-
- // returns TRUE if all nodes are valid.
- BOOL selectGetCategory(LLCategory& category);
-
- // returns TRUE if all nodes are valid. method also stores an
- // accumulated sale info.
- BOOL selectGetSaleInfo(LLSaleInfo& sale_info);
-
- // returns TRUE if all nodes are valid. fills passed in object
- // with the aggregate permissions of the selection.
- BOOL selectGetAggregatePermissions(LLAggregatePermissions& ag_perm);
-
- // returns TRUE if all nodes are valid. fills passed in object
- // with the aggregate permissions for texture inventory items of the selection.
- BOOL selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm);
-
- LLPermissions* findObjectPermissions(const LLViewerObject* object);
-
- BOOL isMovableAvatarSelected();
-
- void selectDelete(); // Delete on simulator
- void selectForceDelete(); // just delete, no into trash
- void selectDuplicate(const LLVector3& offset, BOOL select_copy); // Duplicate on simulator
- void repeatDuplicate();
- void selectDuplicateOnRay(const LLVector3 &ray_start_region,
- const LLVector3 &ray_end_region,
- BOOL bypass_raycast,
- BOOL ray_end_is_intersection,
- const LLUUID &ray_target_id,
- BOOL copy_centers,
- BOOL copy_rotates,
- BOOL select_copy);
-
- void sendMultipleUpdate(U32 type); // Position, rotation, scale all in one
- void sendOwner(const LLUUID& owner_id, const LLUUID& group_id, BOOL override = FALSE);
- void sendGroup(const LLUUID& group_id);
-
- // Category ID is the UUID of the folder you want to contain the purchase.
- // *NOTE: sale_info check doesn't work for multiple object buy,
- // which UI does not currently support sale info is used for
- // verification only, if it doesn't match region info then sale is
- // canceled
- void sendBuy(const LLUUID& buyer_id, const LLUUID& category_id, const LLSaleInfo sale_info);
- void sendAttach(U8 attachment_point, bool replace);
- void sendAttach(LLObjectSelectionHandle selection_handle, U8 attachment_point, bool replace);
- void sendDetach();
- void sendDropAttachment();
- void sendLink();
- void sendDelink();
- //void sendHinge(U8 type);
- //void sendDehinge();
- void sendSelect();
-
- void requestObjectPropertiesFamily(LLViewerObject* object); // asks sim for creator, permissions, resources, etc.
- static void processObjectProperties(LLMessageSystem *mesgsys, void **user_data);
- static void processObjectPropertiesFamily(LLMessageSystem *mesgsys, void **user_data);
- static void processForceObjectSelect(LLMessageSystem* msg, void**);
-
- void requestGodInfo();
-
- LLVector3d getSelectionCenterGlobal() const { return mSelectionCenterGlobal; }
- void updateSelectionCenter();
+ void selectionSetBumpmap( U8 bumpmap, const LLUUID &image_id );
+ void selectionSetTexGen( U8 texgen );
+ void selectionSetShiny( U8 shiny, const LLUUID &image_id );
+ void selectionSetFullbright( U8 fullbright );
+ void selectionSetMedia( U8 media_type, const LLSD &media_data );
+ void selectionSetClickAction(U8 action);
+ void selectionSetIncludeInSearch(bool include_in_search);
+ void selectionSetGlow(const F32 glow);
+ void selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func, int specific_te = -1);
+ void selectionRemoveMaterial();
+
+ void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE);
+ void selectionSetObjectName(const std::string& name);
+ void selectionSetObjectDescription(const std::string& desc);
+ void selectionSetObjectCategory(const LLCategory& category);
+ void selectionSetObjectSaleInfo(const LLSaleInfo& sale_info);
+
+ void selectionTexScaleAutofit(F32 repeats_per_meter);
+ void adjustTexturesByScale(BOOL send_to_sim, BOOL stretch);
+
+ bool selectionMove(const LLVector3& displ, F32 rx, F32 ry, F32 rz,
+ U32 update_type);
+ void sendSelectionMove();
+
+ void sendGodlikeRequest(const std::string& request, const std::string& parameter);
+
+
+ // will make sure all selected object meet current criteria, or deselect them otherwise
+ void validateSelection();
+
+ // returns TRUE if it is possible to select this object
+ BOOL canSelectObject(LLViewerObject* object, BOOL ignore_select_owned = FALSE);
+
+ // Returns TRUE if the viewer has information on all selected objects
+ BOOL selectGetAllRootsValid();
+ BOOL selectGetAllValid();
+ BOOL selectGetAllValidAndObjectsFound();
+
+ // returns TRUE if you can modify all selected objects.
+ BOOL selectGetRootsModify();
+ BOOL selectGetModify();
+
+ // returns TRUE if all objects are in same region
+ BOOL selectGetSameRegion();
+
+ // returns TRUE if is all objects are non-permanent-enforced
+ BOOL selectGetRootsNonPermanentEnforced();
+ BOOL selectGetNonPermanentEnforced();
+
+ // returns TRUE if is all objects are permanent
+ BOOL selectGetRootsPermanent();
+ BOOL selectGetPermanent();
+
+ // returns TRUE if is all objects are character
+ BOOL selectGetRootsCharacter();
+ BOOL selectGetCharacter();
+
+ // returns TRUE if is all objects are not permanent
+ BOOL selectGetRootsNonPathfinding();
+ BOOL selectGetNonPathfinding();
+
+ // returns TRUE if is all objects are not permanent
+ BOOL selectGetRootsNonPermanent();
+ BOOL selectGetNonPermanent();
+
+ // returns TRUE if is all objects are not character
+ BOOL selectGetRootsNonCharacter();
+ BOOL selectGetNonCharacter();
+
+ BOOL selectGetEditableLinksets();
+ BOOL selectGetViewableCharacters();
+
+ // returns TRUE if selected objects can be transferred.
+ BOOL selectGetRootsTransfer();
+
+ // returns TRUE if selected objects can be copied.
+ BOOL selectGetRootsCopy();
+
+ BOOL selectGetCreator(LLUUID& id, std::string& name); // TRUE if all have same creator, returns id
+ BOOL selectGetOwner(LLUUID& id, std::string& name); // TRUE if all objects have same owner, returns id
+ BOOL selectGetLastOwner(LLUUID& id, std::string& name); // TRUE if all objects have same owner, returns id
+
+ // returns TRUE if all are the same. id is stuffed with
+ // the value found if available.
+ BOOL selectGetGroup(LLUUID& id);
+ BOOL selectGetPerm( U8 which_perm, U32* mask_on, U32* mask_off); // TRUE if all have data, returns two masks, each indicating which bits are all on and all off
+
+ BOOL selectIsGroupOwned(); // TRUE if all root objects have valid data and are group owned.
+
+ // returns TRUE if all the nodes are valid. Accumulates
+ // permissions in the parameter.
+ BOOL selectGetPermissions(LLPermissions& perm);
+
+ // returns TRUE if all the nodes are valid. Depends onto "edit linked" state
+ // Children in linksets are a bit special - they require not only move permission
+ // but also modify if "edit linked" is set, since you move them relative to parent
+ BOOL selectGetEditMoveLinksetPermissions(bool &move, bool &modify);
+
+ // Get a bunch of useful sale information for the object(s) selected.
+ // "_mixed" is true if not all objects have the same setting.
+ void selectGetAggregateSaleInfo(U32 &num_for_sale,
+ BOOL &is_for_sale_mixed,
+ BOOL &is_sale_price_mixed,
+ S32 &total_sale_price,
+ S32 &individual_sale_price);
+
+ // returns TRUE if all nodes are valid.
+ BOOL selectGetCategory(LLCategory& category);
+
+ // returns TRUE if all nodes are valid. method also stores an
+ // accumulated sale info.
+ BOOL selectGetSaleInfo(LLSaleInfo& sale_info);
+
+ // returns TRUE if all nodes are valid. fills passed in object
+ // with the aggregate permissions of the selection.
+ BOOL selectGetAggregatePermissions(LLAggregatePermissions& ag_perm);
+
+ // returns TRUE if all nodes are valid. fills passed in object
+ // with the aggregate permissions for texture inventory items of the selection.
+ BOOL selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm);
+
+ LLPermissions* findObjectPermissions(const LLViewerObject* object);
+
+ BOOL isMovableAvatarSelected();
+
+ void selectDelete(); // Delete on simulator
+ void selectForceDelete(); // just delete, no into trash
+ void selectDuplicate(const LLVector3& offset, BOOL select_copy); // Duplicate on simulator
+ void repeatDuplicate();
+ void selectDuplicateOnRay(const LLVector3 &ray_start_region,
+ const LLVector3 &ray_end_region,
+ BOOL bypass_raycast,
+ BOOL ray_end_is_intersection,
+ const LLUUID &ray_target_id,
+ BOOL copy_centers,
+ BOOL copy_rotates,
+ BOOL select_copy);
+
+ void sendMultipleUpdate(U32 type); // Position, rotation, scale all in one
+ void sendOwner(const LLUUID& owner_id, const LLUUID& group_id, BOOL override = FALSE);
+ void sendGroup(const LLUUID& group_id);
+
+ // Category ID is the UUID of the folder you want to contain the purchase.
+ // *NOTE: sale_info check doesn't work for multiple object buy,
+ // which UI does not currently support sale info is used for
+ // verification only, if it doesn't match region info then sale is
+ // canceled
+ void sendBuy(const LLUUID& buyer_id, const LLUUID& category_id, const LLSaleInfo sale_info);
+ void sendAttach(U8 attachment_point, bool replace);
+ void sendAttach(LLObjectSelectionHandle selection_handle, U8 attachment_point, bool replace);
+ void sendDetach();
+ void sendDropAttachment();
+ void sendLink();
+ void sendDelink();
+ //void sendHinge(U8 type);
+ //void sendDehinge();
+ void sendSelect();
+
+ void requestObjectPropertiesFamily(LLViewerObject* object); // asks sim for creator, permissions, resources, etc.
+ static void processObjectProperties(LLMessageSystem *mesgsys, void **user_data);
+ static void processObjectPropertiesFamily(LLMessageSystem *mesgsys, void **user_data);
+ static void processForceObjectSelect(LLMessageSystem* msg, void**);
+
+ void requestGodInfo();
+
+ LLVector3d getSelectionCenterGlobal() const { return mSelectionCenterGlobal; }
+ void updateSelectionCenter();
void pauseAssociatedAvatars();
- void resetAgentHUDZoom();
- void setAgentHUDZoom(F32 target_zoom, F32 current_zoom);
- void getAgentHUDZoom(F32 &target_zoom, F32 &current_zoom) const;
+ void resetAgentHUDZoom();
+ void setAgentHUDZoom(F32 target_zoom, F32 current_zoom);
+ void getAgentHUDZoom(F32 &target_zoom, F32 &current_zoom) const;
- void updatePointAt();
+ void updatePointAt();
- // Internal list maintenance functions. TODO: Make these private!
- void remove(std::vector<LLViewerObject*>& objects);
- void remove(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE);
- void removeAll();
- void addAsIndividual(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE);
- void promoteSelectionToRoot();
- void demoteSelectionToIndividuals();
+ // Internal list maintenance functions. TODO: Make these private!
+ void remove(std::vector<LLViewerObject*>& objects);
+ void remove(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE);
+ void removeAll();
+ void addAsIndividual(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE);
+ void promoteSelectionToRoot();
+ void demoteSelectionToIndividuals();
private:
- void convertTransient(); // converts temporarily selected objects to full-fledged selections
- ESelectType getSelectTypeForObject(LLViewerObject* object);
- void addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to_end = FALSE);
- void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point);
- void updateSelectionSilhouette(LLObjectSelectionHandle object_handle, S32& num_sils_genned, std::vector<LLViewerObject*>& changed_objects);
- // Send one message to each region containing an object on selection list.
- void sendListToRegions( const std::string& message_name,
- void (*pack_header)(void *user_data),
- void (*pack_body)(LLSelectNode* node, void *user_data),
- void (*log_func)(LLSelectNode* node, void *user_data),
- void *user_data,
- ESendType send_type);
- void sendListToRegions( LLObjectSelectionHandle selected_handle,
- const std::string& message_name,
- void (*pack_header)(void *user_data),
- void (*pack_body)(LLSelectNode* node, void *user_data),
- void (*log_func)(LLSelectNode* node, void *user_data),
- void *user_data,
- ESendType send_type);
-
-
- static void packAgentID( void *);
- static void packAgentAndSessionID(void* user_data);
- static void packAgentAndGroupID(void* user_data);
- static void packAgentAndSessionAndGroupID(void* user_data);
- static void packAgentIDAndSessionAndAttachment(void*);
- static void packAgentGroupAndCatID(void*);
- static void packDeleteHeader(void* userdata);
- static void packDeRezHeader(void* user_data);
- static void packObjectID( LLSelectNode* node, void *);
- static void packObjectIDAsParam(LLSelectNode* node, void *);
- static void packObjectIDAndRotation(LLSelectNode* node, void *);
- static void packObjectLocalID(LLSelectNode* node, void *);
- static void packObjectClickAction(LLSelectNode* node, void* data);
- static void packObjectIncludeInSearch(LLSelectNode* node, void* data);
- static void packObjectName(LLSelectNode* node, void* user_data);
- static void packObjectDescription(LLSelectNode* node, void* user_data);
- static void packObjectCategory(LLSelectNode* node, void* user_data);
- static void packObjectSaleInfo(LLSelectNode* node, void* user_data);
- static void packBuyObjectIDs(LLSelectNode* node, void* user_data);
- static void packDuplicate( LLSelectNode* node, void *duplicate_data);
- static void packDuplicateHeader(void*);
- static void packDuplicateOnRayHead(void *user_data);
- static void packPermissions(LLSelectNode* node, void *user_data);
- static void packDeselect( LLSelectNode* node, void *user_data);
- static void packMultipleUpdate(LLSelectNode* node, void *user_data);
- static void packPhysics(LLSelectNode* node, void *user_data);
- static void packShape(LLSelectNode* node, void *user_data);
- static void packOwnerHead(void *user_data);
- static void packHingeHead(void *user_data);
- static void packPermissionsHead(void* user_data);
- static void packGodlikeHead(void* user_data);
+ void convertTransient(); // converts temporarily selected objects to full-fledged selections
+ ESelectType getSelectTypeForObject(LLViewerObject* object);
+ void addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to_end = FALSE);
+ void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point);
+ void updateSelectionSilhouette(LLObjectSelectionHandle object_handle, S32& num_sils_genned, std::vector<LLViewerObject*>& changed_objects);
+ // Send one message to each region containing an object on selection list.
+ void sendListToRegions( const std::string& message_name,
+ void (*pack_header)(void *user_data),
+ void (*pack_body)(LLSelectNode* node, void *user_data),
+ void (*log_func)(LLSelectNode* node, void *user_data),
+ void *user_data,
+ ESendType send_type);
+ void sendListToRegions( LLObjectSelectionHandle selected_handle,
+ const std::string& message_name,
+ void (*pack_header)(void *user_data),
+ void (*pack_body)(LLSelectNode* node, void *user_data),
+ void (*log_func)(LLSelectNode* node, void *user_data),
+ void *user_data,
+ ESendType send_type);
+
+
+ static void packAgentID( void *);
+ static void packAgentAndSessionID(void* user_data);
+ static void packAgentAndGroupID(void* user_data);
+ static void packAgentAndSessionAndGroupID(void* user_data);
+ static void packAgentIDAndSessionAndAttachment(void*);
+ static void packAgentGroupAndCatID(void*);
+ static void packDeleteHeader(void* userdata);
+ static void packDeRezHeader(void* user_data);
+ static void packObjectID( LLSelectNode* node, void *);
+ static void packObjectIDAsParam(LLSelectNode* node, void *);
+ static void packObjectIDAndRotation(LLSelectNode* node, void *);
+ static void packObjectLocalID(LLSelectNode* node, void *);
+ static void packObjectClickAction(LLSelectNode* node, void* data);
+ static void packObjectIncludeInSearch(LLSelectNode* node, void* data);
+ static void packObjectName(LLSelectNode* node, void* user_data);
+ static void packObjectDescription(LLSelectNode* node, void* user_data);
+ static void packObjectCategory(LLSelectNode* node, void* user_data);
+ static void packObjectSaleInfo(LLSelectNode* node, void* user_data);
+ static void packBuyObjectIDs(LLSelectNode* node, void* user_data);
+ static void packDuplicate( LLSelectNode* node, void *duplicate_data);
+ static void packDuplicateHeader(void*);
+ static void packDuplicateOnRayHead(void *user_data);
+ static void packPermissions(LLSelectNode* node, void *user_data);
+ static void packDeselect( LLSelectNode* node, void *user_data);
+ static void packMultipleUpdate(LLSelectNode* node, void *user_data);
+ static void packPhysics(LLSelectNode* node, void *user_data);
+ static void packShape(LLSelectNode* node, void *user_data);
+ static void packOwnerHead(void *user_data);
+ static void packHingeHead(void *user_data);
+ static void packPermissionsHead(void* user_data);
+ static void packGodlikeHead(void* user_data);
static void logNoOp(LLSelectNode* node, void *user_data);
static void logAttachmentRequest(LLSelectNode* node, void *user_data);
static void logDetachRequest(LLSelectNode* node, void *user_data);
- static bool confirmDelete(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle handle);
+ static bool confirmDelete(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle handle);
- // Get the first ID that matches test and whether or not all ids are identical in selected objects.
- void getFirst(LLSelectGetFirstTest* test);
+ // Get the first ID that matches test and whether or not all ids are identical in selected objects.
+ void getFirst(LLSelectGetFirstTest* test);
public:
- // Observer/callback support for when object selection changes or
- // properties are received/updated
- typedef boost::signals2::signal< void ()> update_signal_t;
- update_signal_t mUpdateSignal;
+ // Observer/callback support for when object selection changes or
+ // properties are received/updated
+ typedef boost::signals2::signal< void ()> update_signal_t;
+ update_signal_t mUpdateSignal;
private:
- LLPointer<LLViewerTexture> mSilhouetteImagep;
- LLObjectSelectionHandle mSelectedObjects;
- LLObjectSelectionHandle mHoverObjects;
- LLObjectSelectionHandle mHighlightedObjects;
- std::set<LLPointer<LLViewerObject> > mRectSelectedObjects;
-
- LLObjectSelection mGridObjects;
- LLQuaternion mGridRotation;
- LLVector3 mGridOrigin;
- LLVector3 mGridScale;
- EGridMode mGridMode;
-
- BOOL mTEMode; // render te
- LLRender::eTexIndex mTextureChannel; // diff, norm, or spec, depending on UI editing mode
- LLVector3d mSelectionCenterGlobal;
- LLBBox mSelectionBBox;
-
- LLVector3d mLastSentSelectionCenterGlobal;
- BOOL mShowSelection; // do we send the selection center name value and do we animate this selection?
- LLVector3d mLastCameraPos; // camera position from last generation of selection silhouette
- BOOL mRenderSilhouettes; // do we render the silhouette
- LLBBox mSavedSelectionBBox;
-
- LLFrameTimer mEffectsTimer;
- BOOL mForceSelection;
-
- std::vector<LLAnimPauseRequest> mPauseRequests;
+ LLPointer<LLViewerTexture> mSilhouetteImagep;
+ LLObjectSelectionHandle mSelectedObjects;
+ LLObjectSelectionHandle mHoverObjects;
+ LLObjectSelectionHandle mHighlightedObjects;
+ std::set<LLPointer<LLViewerObject> > mRectSelectedObjects;
+
+ LLObjectSelection mGridObjects;
+ LLQuaternion mGridRotation;
+ LLVector3 mGridOrigin;
+ LLVector3 mGridScale;
+ EGridMode mGridMode;
+
+ BOOL mTEMode; // render te
+ LLRender::eTexIndex mTextureChannel; // diff, norm, or spec, depending on UI editing mode
+ LLVector3d mSelectionCenterGlobal;
+ LLBBox mSelectionBBox;
+
+ LLVector3d mLastSentSelectionCenterGlobal;
+ BOOL mShowSelection; // do we send the selection center name value and do we animate this selection?
+ LLVector3d mLastCameraPos; // camera position from last generation of selection silhouette
+ BOOL mRenderSilhouettes; // do we render the silhouette
+ LLBBox mSavedSelectionBBox;
+
+ LLFrameTimer mEffectsTimer;
+ BOOL mForceSelection;
+
+ std::vector<LLAnimPauseRequest> mPauseRequests;
};
// *DEPRECATED: For callbacks or observers, use
// LLSelectMgr::getInstance()->mUpdateSignal.connect( callback )
// Update subscribers to the selection list
-void dialog_refresh_all();
+void dialog_refresh_all();
// Templates
//-----------------------------------------------------------------------------
@@ -945,113 +945,113 @@ void dialog_refresh_all();
//-----------------------------------------------------------------------------
template <typename T> bool LLObjectSelection::getSelectedTEValue(LLSelectedTEGetFunctor<T>* func, T& res, bool has_tolerance, T tolerance)
{
- bool have_first = false;
- bool have_selected = false;
- T selected_value = T();
-
- // Now iterate through all TEs to test for sameness
- bool identical = TRUE;
- for (iterator iter = begin(); iter != end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- S32 selected_te = -1;
- if (object == getPrimaryObject())
- {
- selected_te = node->getLastSelectedTE();
- }
- for (S32 te = 0; te < object->getNumTEs(); ++te)
- {
- if (!node->isTESelected(te))
- {
- continue;
- }
- T value = func->get(object, te);
- if (!have_first)
- {
- have_first = true;
- if (!have_selected)
- {
- selected_value = value;
- }
- }
- else
- {
- if ( value != selected_value )
- {
+ bool have_first = false;
+ bool have_selected = false;
+ T selected_value = T();
+
+ // Now iterate through all TEs to test for sameness
+ bool identical = TRUE;
+ for (iterator iter = begin(); iter != end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ S32 selected_te = -1;
+ if (object == getPrimaryObject())
+ {
+ selected_te = node->getLastSelectedTE();
+ }
+ for (S32 te = 0; te < object->getNumTEs(); ++te)
+ {
+ if (!node->isTESelected(te))
+ {
+ continue;
+ }
+ T value = func->get(object, te);
+ if (!have_first)
+ {
+ have_first = true;
+ if (!have_selected)
+ {
+ selected_value = value;
+ }
+ }
+ else
+ {
+ if ( value != selected_value )
+ {
if (!has_tolerance)
{
- identical = false;
+ identical = false;
}
else if (!LLCheckIdenticalFunctor<T>::same(value, selected_value, tolerance))
{
identical = false;
}
- }
- if (te == selected_te)
- {
- selected_value = value;
- have_selected = true;
- }
- }
- }
- if (!identical && have_selected)
- {
- break;
- }
- }
- if (have_first || have_selected)
- {
- res = selected_value;
- }
- return identical;
+ }
+ if (te == selected_te)
+ {
+ selected_value = value;
+ have_selected = true;
+ }
+ }
+ }
+ if (!identical && have_selected)
+ {
+ break;
+ }
+ }
+ if (have_first || have_selected)
+ {
+ res = selected_value;
+ }
+ return identical;
}
// Templates
//-----------------------------------------------------------------------------
-// isMultipleTEValue iterate through all TEs and test for uniqueness
-// with certain return value ignored when performing the test.
+// isMultipleTEValue iterate through all TEs and test for uniqueness
+// with certain return value ignored when performing the test.
// e.g. when testing if the selection has a unique non-empty homeurl :
-// you can set ignore_value = "" and it will only compare among the non-empty
+// you can set ignore_value = "" and it will only compare among the non-empty
// homeUrls and ignore the empty ones.
//-----------------------------------------------------------------------------
template <typename T> bool LLObjectSelection::isMultipleTEValue(LLSelectedTEGetFunctor<T>* func, const T& ignore_value)
{
- bool have_first = false;
- T selected_value = T();
-
- // Now iterate through all TEs to test for sameness
- bool unique = TRUE;
- for (iterator iter = begin(); iter != end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- for (S32 te = 0; te < object->getNumTEs(); ++te)
- {
- if (!node->isTESelected(te))
- {
- continue;
- }
- T value = func->get(object, te);
- if(value == ignore_value)
- {
- continue;
- }
- if (!have_first)
- {
- have_first = true;
- }
- else
- {
- if (value !=selected_value )
- {
- unique = false;
- return !unique;
- }
- }
- }
- }
- return !unique;
+ bool have_first = false;
+ T selected_value = T();
+
+ // Now iterate through all TEs to test for sameness
+ bool unique = TRUE;
+ for (iterator iter = begin(); iter != end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ for (S32 te = 0; te < object->getNumTEs(); ++te)
+ {
+ if (!node->isTESelected(te))
+ {
+ continue;
+ }
+ T value = func->get(object, te);
+ if(value == ignore_value)
+ {
+ continue;
+ }
+ if (!have_first)
+ {
+ have_first = true;
+ }
+ else
+ {
+ if (value !=selected_value )
+ {
+ unique = false;
+ return !unique;
+ }
+ }
+ }
+ }
+ return !unique;
}
diff --git a/indra/newview/llsetkeybinddialog.cpp b/indra/newview/llsetkeybinddialog.cpp
index 74844a80e8..dfb26b47fc 100644
--- a/indra/newview/llsetkeybinddialog.cpp
+++ b/indra/newview/llsetkeybinddialog.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsetkeybinddialog.cpp
* @brief LLSetKeyBindDialog class implementation.
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -78,9 +78,9 @@ LLSetKeyBindDialog::LLSetKeyBindDialog(const LLSD& key)
mContextConeOutAlpha(0.f),
mContextConeFadeTime(0.f)
{
- mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha");
- mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha");
- mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime");
+ mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha");
+ mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha");
+ mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime");
}
LLSetKeyBindDialog::~LLSetKeyBindDialog()
diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h
index 18e2601723..b0643e37f9 100644
--- a/indra/newview/llsetkeybinddialog.h
+++ b/indra/newview/llsetkeybinddialog.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsetkeybinddialog.h
* @brief LLSetKeyBindDialog class definition
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp
index d2d21063e7..648a9503e1 100644
--- a/indra/newview/llsettingspicker.cpp
+++ b/indra/newview/llsettingspicker.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @author Rider Linden
* @brief LLSettingsPicker class header file including related functions
*
@@ -82,7 +82,7 @@ LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_
}
-LLFloaterSettingsPicker::~LLFloaterSettingsPicker()
+LLFloaterSettingsPicker::~LLFloaterSettingsPicker()
{
}
@@ -99,7 +99,7 @@ BOOL LLFloaterSettingsPicker::postBuild()
mFilterEdit = getChild<LLFilterEditor>(FLT_INVENTORY_SEARCH);
mFilterEdit->setCommitCallback([this](LLUICtrl*, const LLSD& param){ onFilterEdit(param.asString()); });
-
+
mInventoryPanel = getChild<LLInventoryPanel>(PNL_INVENTORY);
if (mInventoryPanel)
{
@@ -160,7 +160,7 @@ void LLFloaterSettingsPicker::setValue(const LLSD& value)
mSettingItemID = value.asUUID();
}
-LLSD LLFloaterSettingsPicker::getValue() const
+LLSD LLFloaterSettingsPicker::getValue() const
{
return LLSD(mSettingItemID);
}
@@ -335,7 +335,7 @@ void LLFloaterSettingsPicker::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr
}
}
}
-
+
mSettingAssetID = asset_id;
track_selection->setEnabled(true);
track_selection->selectFirstItem();
diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h
index 859f92fbe8..7e370af251 100644
--- a/indra/newview/llsettingspicker.h
+++ b/indra/newview/llsettingspicker.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsettingspicker.h
* @author Rider Linden
* @brief LLSettingsPicker class header file including related functions
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2018&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2018, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -79,7 +79,7 @@ public:
virtual void setValue(const LLSD& value) override;
virtual LLSD getValue() const override;
- static LLUUID findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false)
+ static LLUUID findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false)
{
LLInventoryItem *pitem = findItem(asset_id, copyable_only, ignore_library);
if (pitem)
@@ -125,9 +125,9 @@ private:
PermissionMask mImmediateFilterPermMask;
bool mActive;
- bool mNoCopySettingsSelected;
+ bool mNoCopySettingsSelected;
- LLSaveFolderState mSavedFolderState;
+ LLSaveFolderState mSavedFolderState;
// boost::signals2::signal<void(LLUUID id)> mCommitSignal;
boost::signals2::signal<void()> mCloseSignal;
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index c07c939862..ca5e148952 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -72,7 +72,7 @@
extern BOOL gCubeSnapshot;
//=========================================================================
-namespace
+namespace
{
LLSD ensure_array_4(LLSD in, F32 fill);
LLSD read_legacy_preset_data(const std::string &name, const std::string& path, LLSD &messages);
@@ -185,7 +185,7 @@ void LLSettingsVOBase::onInventoryItemCreated(const LLUUID &inventoryId, LLSetti
}
}
if (!settings)
- { // The item was created as new with no settings passed in. Simulator should have given it the default for the type... check ID,
+ { // The item was created as new with no settings passed in. Simulator should have given it the default for the type... check ID,
// no need to upload asset.
LLUUID asset_id;
if (pitem)
@@ -246,11 +246,11 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings
}
}
- std::stringstream buffer;
+ std::stringstream buffer;
LLSD settingdata(settings->getSettings());
LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION);
- LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(),
+ LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(),
[settings, callback](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response)
{
LLSettingsVOBase::onAgentAssetUploadComplete(itemId, newAssetId, newItemId, response, settings, callback);
@@ -313,7 +313,7 @@ void LLSettingsVOBase::onTaskAssetUploadComplete(LLUUID itemId, LLUUID taskId, L
void LLSettingsVOBase::getSettingsAsset(const LLUUID &assetId, LLSettingsVOBase::asset_download_fn callback)
{
gAssetStorage->getAssetData(assetId, LLAssetType::AT_SETTINGS,
- [callback](const LLUUID &asset_id, LLAssetType::EType, void *, S32 status, LLExtStat ext_status)
+ [callback](const LLUUID &asset_id, LLAssetType::EType, void *, S32 status, LLExtStat ext_status)
{ onAssetDownloadComplete(asset_id, status, ext_status, callback); },
nullptr, true);
@@ -503,7 +503,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
if (!llsd_equals(oldsettings, oldsettings))
{
- LL_WARNS("SKY") << "Conversion to/from legacy does not match!\n"
+ LL_WARNS("SKY") << "Conversion to/from legacy does not match!\n"
<< "Old: " << oldsettings
<< "new: " << oldsettings << LL_ENDL;
}
@@ -601,7 +601,7 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA
{
LLSD legacy(LLSD::emptyMap());
LLSD settings = psky->getSettings();
-
+
convertAtmosphericsToLegacy(legacy, settings);
legacy[SETTING_CLOUD_COLOR] = ensure_array_4(settings[SETTING_CLOUD_COLOR], 1.0);
@@ -610,15 +610,15 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA
legacy[SETTING_CLOUD_SCALE] = llsd::array(settings[SETTING_CLOUD_SCALE], LLSD::Real(0.0), LLSD::Real(0.0), LLSD::Real(1.0));
legacy[SETTING_CLOUD_SCROLL_RATE] = settings[SETTING_CLOUD_SCROLL_RATE];
legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL] = llsd::array(LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][0].asReal())),
- LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal())));
- legacy[SETTING_CLOUD_SHADOW] = llsd::array(settings[SETTING_CLOUD_SHADOW].asReal(), 0.0f, 0.0f, 1.0f);
+ LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal())));
+ legacy[SETTING_CLOUD_SHADOW] = llsd::array(settings[SETTING_CLOUD_SHADOW].asReal(), 0.0f, 0.0f, 1.0f);
legacy[SETTING_GAMMA] = llsd::array(settings[SETTING_GAMMA], 0.0f, 0.0f, 1.0f);
legacy[SETTING_GLOW] = ensure_array_4(settings[SETTING_GLOW], 1.0);
legacy[SETTING_LIGHT_NORMAL] = ensure_array_4(psky->getLightDirection().getValue(), 0.0f);
legacy[SETTING_MAX_Y] = llsd::array(settings[SETTING_MAX_Y], 0.0f, 0.0f, 1.0f);
legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS].asReal() / 250.0f; // convert from 0-500 -> 0-2 ala pre-FS-compat changes
legacy[SETTING_SUNLIGHT_COLOR] = ensure_array_4(settings[SETTING_SUNLIGHT_COLOR], 1.0f);
-
+
LLVector3 dir = psky->getLightDirection();
F32 phi = asin(dir.mV[2]);
@@ -633,17 +633,17 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA
{
theta += F_PI * 2;
}
-
+
if (theta > 4 * F_PI)
{
theta = fmod(theta, 2 * F_PI);
}
-
+
while (phi < -F_PI)
{
phi += 2 * F_PI;
}
-
+
if (phi > 3 * F_PI)
{
phi = F_PI + fmod(phi - F_PI, 2 * F_PI);
@@ -651,8 +651,8 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA
legacy[SETTING_LEGACY_EAST_ANGLE] = theta;
legacy[SETTING_LEGACY_SUN_ANGLE] = phi;
-
- return legacy;
+
+ return legacy;
}
//-------------------------------------------------------------------------
@@ -669,10 +669,10 @@ void LLSettingsVOSky::updateSettings()
// Since WL scales everything by 2, there should always be at least a 2:1 brightness ratio
// between sunlight and point lights in windlight to normalize point lights.
//
- // After some A/B comparison of relesae vs EEP, tweak to allow strength to fall below 2
+ // After some A/B comparison of relesae vs EEP, tweak to allow strength to fall below 2
// at night, for better match. (mSceneLightStrength is a divisor, so lower value means brighter
// local lights)
- F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f);
+ F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f);
mSceneLightStrength = 2.0f * (0.75f + sun_dynamic_range * dp);
gSky.setSunAndMoonDirectionsCFR(sun_direction, moon_direction);
@@ -693,11 +693,11 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
bool irradiance_pass = gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass();
LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_DEFAULT];
- {
+ {
shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, light_direction);
shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, LLViewerCamera::getInstance()->getOrigin());
- }
-
+ }
+
shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_SKY];
shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, light_direction);
@@ -760,13 +760,13 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
shader->uniform1f(LLShaderMgr::SKY_HDR_SCALE, sqrtf(g)*2.0); // use a modifier here so 1.0 maps to the "most desirable" default and the maximum value doesn't go off the rails
}
else if (psky->canAutoAdjust() && should_auto_adjust)
- { // auto-adjust legacy sky to take advantage of probe ambiance
+ { // auto-adjust legacy sky to take advantage of probe ambiance
shader->uniform3fv(LLShaderMgr::AMBIENT, (ambient * auto_adjust_ambient_scale).mV);
shader->uniform1f(LLShaderMgr::SKY_HDR_SCALE, auto_adjust_hdr_scale);
LLColor3 blue_horizon = getBlueHorizon() * auto_adjust_blue_horizon_scale;
LLColor3 blue_density = getBlueDensity() * auto_adjust_blue_density_scale;
LLColor3 sun_diffuse = getSunDiffuse() * auto_adjust_sun_color_scale;
-
+
shader->uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, sun_diffuse.mV);
shader->uniform3fv(LLShaderMgr::BLUE_DENSITY, blue_density.mV);
shader->uniform3fv(LLShaderMgr::BLUE_HORIZON, blue_horizon.mV);
@@ -786,7 +786,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
shader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, getSunMoonGlowFactor());
shader->uniform1f(LLShaderMgr::DENSITY_MULTIPLIER, getDensityMultiplier());
shader->uniform1f(LLShaderMgr::DISTANCE_MULTIPLIER, getDistanceMultiplier());
-
+
shader->uniform1f(LLShaderMgr::GAMMA, g);
}
@@ -810,7 +810,7 @@ LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const
// Following values are always present, so we can just zero these ones, but used values from defaults()
LLSD sky_defaults = LLSettingsSky::defaults();
-
+
param_map[SETTING_CLOUD_POS_DENSITY2] = DefaultParam(LLShaderMgr::CLOUD_POS_DENSITY2, sky_defaults[SETTING_CLOUD_POS_DENSITY2]);
param_map[SETTING_CLOUD_SCALE] = DefaultParam(LLShaderMgr::CLOUD_SCALE, sky_defaults[SETTING_CLOUD_SCALE]);
param_map[SETTING_CLOUD_SHADOW] = DefaultParam(LLShaderMgr::CLOUD_SHADOW, sky_defaults[SETTING_CLOUD_SHADOW]);
@@ -873,7 +873,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin
return LLSettingsWater::ptr_t();
}
- newsettings[SETTING_NAME] = name;
+ newsettings[SETTING_NAME] = name;
LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList();
LLSD results = LLSettingsWater::settingValidation(newsettings, validations);
if (!results["success"].asBoolean())
@@ -971,7 +971,7 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
legacy[SETTING_LEGACY_SCALE_BELOW] = settings[SETTING_SCALE_BELOW];
legacy[SETTING_LEGACY_WAVE1_DIR] = settings[SETTING_WAVE1_DIR];
legacy[SETTING_LEGACY_WAVE2_DIR] = settings[SETTING_WAVE2_DIR];
-
+
return legacy;
}
//-------------------------------------------------------------------------
@@ -984,8 +984,8 @@ void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
auto group = LLGLSLShader::SG_ANY;
LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[group];
-
- {
+
+ {
F32 water_height = env.getWaterHeight();
if (LLViewerCamera::instance().cameraUnderWater())
@@ -1102,7 +1102,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
std::set<std::string> notfound;
// expected and correct folder sctructure is to have
- // three folders in widnlight's root: days, water, skies
+ // three folders in widnlight's root: days, water, skies
std::string base_path(gDirUtilp->getDirName(path));
std::string water_path(base_path);
std::string sky_path(base_path);
@@ -1193,7 +1193,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
if (!llsd_equals(oldsettings, testsettings))
{
- LL_WARNS("DAYCYCLE") << "Conversion to/from legacy does not match!\n"
+ LL_WARNS("DAYCYCLE") << "Conversion to/from legacy does not match!\n"
<< "Old: " << oldsettings
<< "new: " << testsettings << LL_ENDL;
}
@@ -1228,7 +1228,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID &regio
{
std::string newname = "sky:" + (*itm).first;
LLSD newsettings = LLSettingsSky::translateLegacySettings((*itm).second);
-
+
newsettings[SETTING_NAME] = newname;
frames[newname] = newsettings;
@@ -1267,7 +1267,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID &regio
}
LLSettingsDay::ptr_t dayp = std::make_shared<LLSettingsVODay>(newsettings);
-
+
if (dayp)
{
// true for validation - either validate here, or when cloning for floater.
@@ -1417,34 +1417,34 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday)
if (!pwater)
pwater = LLSettingsVOWater::buildDefaultWater();
-
+
LLSD llsdwater = LLSettingsVOWater::convertToLegacy(pwater);
-
+
CycleTrack_t &tracksky = pday->getCycleTrack(1); // first sky track
std::map<std::string, LLSettingsSky::ptr_t> skys;
-
+
LLSD llsdcycle(LLSD::emptyArray());
-
+
for(CycleTrack_t::iterator it = tracksky.begin(); it != tracksky.end(); ++it)
{
size_t hash = (*it).second->getHash();
std::stringstream name;
-
+
name << hash;
-
+
skys[name.str()] = std::static_pointer_cast<LLSettingsSky>((*it).second);
-
+
F32 frame = ((tracksky.size() == 1) && (it == tracksky.begin())) ? -1.0f : (*it).first;
llsdcycle.append( llsd::array(LLSD::Real(frame), name.str()) );
}
LLSD llsdskylist(LLSD::emptyMap());
-
+
for (std::map<std::string, LLSettingsSky::ptr_t>::iterator its = skys.begin(); its != skys.end(); ++its)
{
LLSD llsdsky = LLSettingsVOSky::convertToLegacy((*its).second, false);
llsdsky[SETTING_NAME] = (*its).first;
-
+
llsdskylist[(*its).first] = llsdsky;
}
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index 4f410ab7d9..c55b3f82b9 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -80,7 +80,7 @@ private:
static void onAgentAssetUploadComplete(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response, LLSettingsBase::ptr_t psettings, inventory_result_fn callback);
static void onTaskAssetUploadComplete(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, LLSettingsBase::ptr_t psettings, inventory_result_fn callback);
-
+
static void onAssetDownloadComplete(const LLUUID &asset_id, S32 status, LLExtStat ext_status, asset_download_fn callback);
};
@@ -171,7 +171,7 @@ public:
virtual ptr_t buildDeepCloneAndUncompress() const SETTINGS_OVERRIDE;
static LLSD convertToLegacy(const ptr_t &);
-
+
virtual LLSettingsSkyPtr_t getDefaultSky() const override;
virtual LLSettingsWaterPtr_t getDefaultWater() const override;
virtual LLSettingsSkyPtr_t buildSky(LLSD) const override;
diff --git a/indra/newview/llshareavatarhandler.cpp b/indra/newview/llshareavatarhandler.cpp
index 8c5ebb75ef..7425aa1a3c 100644
--- a/indra/newview/llshareavatarhandler.cpp
+++ b/indra/newview/llshareavatarhandler.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llshareavatarhandler.cpp
* @brief slapp to handle sharing with an avatar
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,36 +32,36 @@
class LLShareWithAvatarHandler : public LLCommandHandler
{
-public:
- // requires trusted browser to trigger
- LLShareWithAvatarHandler() : LLCommandHandler("sharewithavatar", UNTRUSTED_THROTTLE)
- {
- }
-
- bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAvatarShare"))
- {
- LLNotificationsUtil::add("NoAvatarShare", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
+public:
+ // requires trusted browser to trigger
+ LLShareWithAvatarHandler() : LLCommandHandler("sharewithavatar", UNTRUSTED_THROTTLE)
+ {
+ }
+
+ bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAvatarShare"))
+ {
+ LLNotificationsUtil::add("NoAvatarShare", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ //Make sure we have some parameters
+ if (params.size() == 0)
+ {
+ return false;
+ }
+
+ //Get the ID
+ LLUUID id;
+ if (!id.set( params[0], FALSE ))
+ {
+ return false;
+ }
- //Make sure we have some parameters
- if (params.size() == 0)
- {
- return false;
- }
-
- //Get the ID
- LLUUID id;
- if (!id.set( params[0], FALSE ))
- {
- return false;
- }
-
- //instigate share with this avatar
- LLAvatarActions::share( id );
- return true;
- }
+ //instigate share with this avatar
+ LLAvatarActions::share( id );
+ return true;
+ }
};
LLShareWithAvatarHandler gShareWithAvatar;
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 7571d361a4..eb3dbdbd2e 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,37 +54,37 @@ static LLPanelInjector<LLSidepanelAppearance> t_appearance("sidepanel_appearance
class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver
{
public:
- LLCurrentlyWornFetchObserver(const uuid_vec_t &ids,
- LLSidepanelAppearance *panel) :
- LLInventoryFetchItemsObserver(ids),
- mPanel(panel)
- {}
- ~LLCurrentlyWornFetchObserver() {}
- virtual void done()
- {
- mPanel->inventoryFetched();
- gInventory.removeObserver(this);
- delete this;
- }
+ LLCurrentlyWornFetchObserver(const uuid_vec_t &ids,
+ LLSidepanelAppearance *panel) :
+ LLInventoryFetchItemsObserver(ids),
+ mPanel(panel)
+ {}
+ ~LLCurrentlyWornFetchObserver() {}
+ virtual void done()
+ {
+ mPanel->inventoryFetched();
+ gInventory.removeObserver(this);
+ delete this;
+ }
private:
- LLSidepanelAppearance *mPanel;
+ LLSidepanelAppearance *mPanel;
};
LLSidepanelAppearance::LLSidepanelAppearance() :
- LLPanel(),
- mFilterSubString(LLStringUtil::null),
- mFilterEditor(NULL),
- mOutfitEdit(NULL),
- mCurrOutfitPanel(NULL),
- mOpened(false)
+ LLPanel(),
+ mFilterSubString(LLStringUtil::null),
+ mFilterEditor(NULL),
+ mOutfitEdit(NULL),
+ mCurrOutfitPanel(NULL),
+ mOpened(false)
{
- LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
- outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
- outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
- outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
+ LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
+ outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
+ outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
+ outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
- gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true));
- gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false));
+ gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true));
+ gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false));
}
LLSidepanelAppearance::~LLSidepanelAppearance()
@@ -94,204 +94,204 @@ LLSidepanelAppearance::~LLSidepanelAppearance()
// virtual
BOOL LLSidepanelAppearance::postBuild()
{
- mOpenOutfitBtn = getChild<LLButton>("openoutfit_btn");
- mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this));
+ mOpenOutfitBtn = getChild<LLButton>("openoutfit_btn");
+ mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this));
- mEditAppearanceBtn = getChild<LLButton>("editappearance_btn");
- mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this));
+ mEditAppearanceBtn = getChild<LLButton>("editappearance_btn");
+ mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this));
- childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this));
+ childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this));
+
+ mFilterEditor = getChild<LLFilterEditor>("Filter");
+ if (mFilterEditor)
+ {
+ mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2));
+ }
- mFilterEditor = getChild<LLFilterEditor>("Filter");
- if (mFilterEditor)
- {
- mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2));
- }
+ mPanelOutfitsInventory = dynamic_cast<LLPanelOutfitsInventory *>(getChild<LLPanel>("panel_outfits_inventory"));
- mPanelOutfitsInventory = dynamic_cast<LLPanelOutfitsInventory *>(getChild<LLPanel>("panel_outfits_inventory"));
+ mOutfitEdit = dynamic_cast<LLPanelOutfitEdit*>(getChild<LLPanel>("panel_outfit_edit"));
+ if (mOutfitEdit)
+ {
+ LLButton* back_btn = mOutfitEdit->getChild<LLButton>("back_btn");
+ if (back_btn)
+ {
+ back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this));
+ }
- mOutfitEdit = dynamic_cast<LLPanelOutfitEdit*>(getChild<LLPanel>("panel_outfit_edit"));
- if (mOutfitEdit)
- {
- LLButton* back_btn = mOutfitEdit->getChild<LLButton>("back_btn");
- if (back_btn)
- {
- back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this));
- }
+ }
- }
+ mEditWearable = dynamic_cast<LLPanelEditWearable*>(getChild<LLPanel>("panel_edit_wearable"));
+ if (mEditWearable)
+ {
+ LLButton* edit_wearable_back_btn = mEditWearable->getChild<LLButton>("back_btn");
+ if (edit_wearable_back_btn)
+ {
+ edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this));
+ }
+ }
- mEditWearable = dynamic_cast<LLPanelEditWearable*>(getChild<LLPanel>("panel_edit_wearable"));
- if (mEditWearable)
- {
- LLButton* edit_wearable_back_btn = mEditWearable->getChild<LLButton>("back_btn");
- if (edit_wearable_back_btn)
- {
- edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this));
- }
- }
+ mCurrentLookName = getChild<LLTextBox>("currentlook_name");
- mCurrentLookName = getChild<LLTextBox>("currentlook_name");
+ mOutfitStatus = getChild<LLTextBox>("currentlook_status");
- mOutfitStatus = getChild<LLTextBox>("currentlook_status");
-
- mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook");
+ mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook");
- setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChanged,this,_2));
+ setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChanged,this,_2));
- setWearablesLoading(gAgentWearables.isCOFChangeInProgress());
+ setWearablesLoading(gAgentWearables.isCOFChangeInProgress());
- return TRUE;
+ return TRUE;
}
// virtual
void LLSidepanelAppearance::onOpen(const LLSD& key)
{
- if (!key.has("type"))
- {
- // No specific panel requested.
- // If we're opened for the first time then show My Outfits.
- // Else do nothing.
- if (!mOpened)
- {
- showOutfitsInventoryPanel();
- }
- }
- else
- {
- // Switch to the requested panel.
- std::string type = key["type"].asString();
- if (type == "my_outfits")
- {
- showOutfitsInventoryPanel("outfitslist_tab");
- }
+ if (!key.has("type"))
+ {
+ // No specific panel requested.
+ // If we're opened for the first time then show My Outfits.
+ // Else do nothing.
+ if (!mOpened)
+ {
+ showOutfitsInventoryPanel();
+ }
+ }
+ else
+ {
+ // Switch to the requested panel.
+ std::string type = key["type"].asString();
+ if (type == "my_outfits")
+ {
+ showOutfitsInventoryPanel("outfitslist_tab");
+ }
else if (type == "now_wearing")
{
showOutfitsInventoryPanel("cof_tab");
}
- else if (type == "edit_outfit")
- {
- showOutfitEditPanel();
- }
- else if (type == "edit_shape")
- {
- showWearableEditPanel();
- }
- }
-
- mOpened = true;
+ else if (type == "edit_outfit")
+ {
+ showOutfitEditPanel();
+ }
+ else if (type == "edit_shape")
+ {
+ showWearableEditPanel();
+ }
+ }
+
+ mOpened = true;
}
void LLSidepanelAppearance::onVisibilityChanged(const LLSD &new_visibility)
{
- LLSD visibility;
- visibility["visible"] = new_visibility.asBoolean();
- visibility["reset_accordion"] = false;
- updateToVisibility(visibility);
+ LLSD visibility;
+ visibility["visible"] = new_visibility.asBoolean();
+ visibility["reset_accordion"] = false;
+ updateToVisibility(visibility);
}
void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility)
{
- if (new_visibility["visible"].asBoolean())
- {
- const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible();
- const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible();
-
- if (is_outfit_edit_visible || is_wearable_edit_visible)
- {
- const LLViewerWearable *wearable_ptr = mEditWearable ? mEditWearable->getWearable() : NULL;
- if (!wearable_ptr)
- {
- LL_WARNS() << "Visibility change to invalid wearable" << LL_ENDL;
- return;
- }
- // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar
- // when editing its physics.
- if (!gAgentCamera.cameraCustomizeAvatar())
- {
- LLVOAvatarSelf::onCustomizeStart(LLWearableType::getInstance()->getDisableCameraSwitch(wearable_ptr->getType()));
- }
- if (is_wearable_edit_visible)
- {
- U32 index;
- if (!gAgentWearables.getWearableIndex(wearable_ptr,index))
- {
- // we're no longer wearing the wearable we were last editing, switch back to outfit editor
- showOutfitEditPanel();
- }
- }
-
- if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean())
- {
- mOutfitEdit->resetAccordionState();
- }
- }
- }
- else
- {
- if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement"))
- {
- gAgentCamera.changeCameraToDefault();
- gAgentCamera.resetView();
- }
- }
+ if (new_visibility["visible"].asBoolean())
+ {
+ const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible();
+ const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible();
+
+ if (is_outfit_edit_visible || is_wearable_edit_visible)
+ {
+ const LLViewerWearable *wearable_ptr = mEditWearable ? mEditWearable->getWearable() : NULL;
+ if (!wearable_ptr)
+ {
+ LL_WARNS() << "Visibility change to invalid wearable" << LL_ENDL;
+ return;
+ }
+ // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar
+ // when editing its physics.
+ if (!gAgentCamera.cameraCustomizeAvatar())
+ {
+ LLVOAvatarSelf::onCustomizeStart(LLWearableType::getInstance()->getDisableCameraSwitch(wearable_ptr->getType()));
+ }
+ if (is_wearable_edit_visible)
+ {
+ U32 index;
+ if (!gAgentWearables.getWearableIndex(wearable_ptr,index))
+ {
+ // we're no longer wearing the wearable we were last editing, switch back to outfit editor
+ showOutfitEditPanel();
+ }
+ }
+
+ if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean())
+ {
+ mOutfitEdit->resetAccordionState();
+ }
+ }
+ }
+ else
+ {
+ if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement"))
+ {
+ gAgentCamera.changeCameraToDefault();
+ gAgentCamera.resetView();
+ }
+ }
}
void LLSidepanelAppearance::onFilterEdit(const std::string& search_string)
{
- if (mFilterSubString != search_string)
- {
- mFilterSubString = search_string;
+ if (mFilterSubString != search_string)
+ {
+ mFilterSubString = search_string;
- // Searches are case-insensitive
- // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is.
+ // Searches are case-insensitive
+ // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is.
- mPanelOutfitsInventory->onSearchEdit(mFilterSubString);
- }
+ mPanelOutfitsInventory->onSearchEdit(mFilterSubString);
+ }
}
void LLSidepanelAppearance::onOpenOutfitButtonClicked()
{
- const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink();
- if (!outfit_link)
- return;
- if (!outfit_link->getIsLinkType())
- return;
-
- LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild<LLAccordionCtrlTab>("tab_outfits");
- if (tab_outfits)
- {
- tab_outfits->changeOpenClose(FALSE);
- LLInventoryPanel *inventory_panel = tab_outfits->findChild<LLInventoryPanel>("outfitslist_tab");
- if (inventory_panel)
- {
- LLFolderView* root = inventory_panel->getRootFolder();
- LLFolderViewItem *outfit_folder = inventory_panel->getItemByID(outfit_link->getLinkedUUID());
- if (outfit_folder)
- {
- outfit_folder->setOpen(!outfit_folder->isOpen());
- root->setSelection(outfit_folder,TRUE);
- root->scrollToShowSelection();
- }
- }
- }
+ const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink();
+ if (!outfit_link)
+ return;
+ if (!outfit_link->getIsLinkType())
+ return;
+
+ LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild<LLAccordionCtrlTab>("tab_outfits");
+ if (tab_outfits)
+ {
+ tab_outfits->changeOpenClose(FALSE);
+ LLInventoryPanel *inventory_panel = tab_outfits->findChild<LLInventoryPanel>("outfitslist_tab");
+ if (inventory_panel)
+ {
+ LLFolderView* root = inventory_panel->getRootFolder();
+ LLFolderViewItem *outfit_folder = inventory_panel->getItemByID(outfit_link->getLinkedUUID());
+ if (outfit_folder)
+ {
+ outfit_folder->setOpen(!outfit_folder->isOpen());
+ root->setSelection(outfit_folder,TRUE);
+ root->scrollToShowSelection();
+ }
+ }
+ }
}
// *TODO: obsolete?
void LLSidepanelAppearance::onEditAppearanceButtonClicked()
{
- if (gAgentWearables.areWearablesLoaded())
- {
- LLVOAvatarSelf::onCustomizeStart();
- }
+ if (gAgentWearables.areWearablesLoaded())
+ {
+ LLVOAvatarSelf::onCustomizeStart();
+ }
}
void LLSidepanelAppearance::showOutfitsInventoryPanel()
{
- toggleWearableEditPanel(FALSE);
- toggleOutfitEditPanel(FALSE);
- toggleMyOutfitsPanel(TRUE, "");
+ toggleWearableEditPanel(FALSE);
+ toggleOutfitEditPanel(FALSE);
+ toggleMyOutfitsPanel(TRUE, "");
}
void LLSidepanelAppearance::showOutfitsInventoryPanel(const std::string &tab_name)
@@ -303,36 +303,36 @@ void LLSidepanelAppearance::showOutfitsInventoryPanel(const std::string &tab_nam
void LLSidepanelAppearance::showOutfitEditPanel()
{
- if (mOutfitEdit && mOutfitEdit->getVisible()) return;
-
- // Accordion's state must be reset in all cases except the one when user
- // is returning back to the mOutfitEdit panel from the mEditWearable panel.
- // The simplest way to control this is to check the visibility state of the mEditWearable
- // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE).
- if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL)
- {
- mOutfitEdit->resetAccordionState();
- }
-
- // If we're exiting the edit wearable view, and the camera was not focused on the avatar
- // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since
- // otherwise this would trigger the camera focus mode.
- if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar())
- {
- showOutfitsInventoryPanel();
- return;
- }
-
- toggleMyOutfitsPanel(FALSE, "");
- toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode
- toggleOutfitEditPanel(TRUE);
+ if (mOutfitEdit && mOutfitEdit->getVisible()) return;
+
+ // Accordion's state must be reset in all cases except the one when user
+ // is returning back to the mOutfitEdit panel from the mEditWearable panel.
+ // The simplest way to control this is to check the visibility state of the mEditWearable
+ // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE).
+ if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL)
+ {
+ mOutfitEdit->resetAccordionState();
+ }
+
+ // If we're exiting the edit wearable view, and the camera was not focused on the avatar
+ // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since
+ // otherwise this would trigger the camera focus mode.
+ if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar())
+ {
+ showOutfitsInventoryPanel();
+ return;
+ }
+
+ toggleMyOutfitsPanel(FALSE, "");
+ toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode
+ toggleOutfitEditPanel(TRUE);
}
void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch)
{
- toggleMyOutfitsPanel(FALSE, "");
- toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode
- toggleWearableEditPanel(TRUE, wearable, disable_camera_switch);
+ toggleMyOutfitsPanel(FALSE, "");
+ toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode
+ toggleWearableEditPanel(TRUE, wearable, disable_camera_switch);
}
void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible, const std::string& tab_name)
@@ -372,167 +372,167 @@ bool LLSidepanelAppearance::isCOFPanelVisible()
void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch)
{
- if (!mOutfitEdit || mOutfitEdit->getVisible() == visible)
- {
- // visibility isn't changing, hence nothing to do
- return;
- }
-
- mOutfitEdit->setVisible(visible);
-
- if (visible)
- {
- mOutfitEdit->onOpen(LLSD());
- LLVOAvatarSelf::onCustomizeStart(disable_camera_switch);
- }
- else
- {
- if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization.
- {
- LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch);
- LLAppearanceMgr::getInstance()->updateIsDirty();
- }
- }
+ if (!mOutfitEdit || mOutfitEdit->getVisible() == visible)
+ {
+ // visibility isn't changing, hence nothing to do
+ return;
+ }
+
+ mOutfitEdit->setVisible(visible);
+
+ if (visible)
+ {
+ mOutfitEdit->onOpen(LLSD());
+ LLVOAvatarSelf::onCustomizeStart(disable_camera_switch);
+ }
+ else
+ {
+ if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization.
+ {
+ LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch);
+ LLAppearanceMgr::getInstance()->updateIsDirty();
+ }
+ }
}
void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch)
{
- if (!mEditWearable)
- {
- return;
- }
-
- if (mEditWearable->getVisible() == visible && (!visible || mEditWearable->getWearable() == wearable))
- {
- // visibility isn't changing and panel doesn't need an update, hence nothing to do
- return;
- }
-
- // If we're just switching between outfit and wearable editing or updating item,
- // don't end customization and don't switch camera
- // Don't end customization and don't switch camera without visibility change
- BOOL change_state = !disable_camera_switch && mEditWearable->getVisible() != visible;
-
- if (!wearable)
- {
- wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0);
- }
- if (!wearable)
- {
- return;
- }
-
- // Toggle panel visibility.
- mEditWearable->setVisible(visible);
-
- if (visible)
- {
- LLVOAvatarSelf::onCustomizeStart(!change_state);
- mEditWearable->setWearable(wearable, !change_state);
- mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency
- }
- else
- {
- // Save changes if closing.
- mEditWearable->saveChanges();
- mEditWearable->setWearable(NULL);
- LLAppearanceMgr::getInstance()->updateIsDirty();
- if (change_state)
- {
- LLVOAvatarSelf::onCustomizeEnd(!change_state);
- }
- }
+ if (!mEditWearable)
+ {
+ return;
+ }
+
+ if (mEditWearable->getVisible() == visible && (!visible || mEditWearable->getWearable() == wearable))
+ {
+ // visibility isn't changing and panel doesn't need an update, hence nothing to do
+ return;
+ }
+
+ // If we're just switching between outfit and wearable editing or updating item,
+ // don't end customization and don't switch camera
+ // Don't end customization and don't switch camera without visibility change
+ BOOL change_state = !disable_camera_switch && mEditWearable->getVisible() != visible;
+
+ if (!wearable)
+ {
+ wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0);
+ }
+ if (!wearable)
+ {
+ return;
+ }
+
+ // Toggle panel visibility.
+ mEditWearable->setVisible(visible);
+
+ if (visible)
+ {
+ LLVOAvatarSelf::onCustomizeStart(!change_state);
+ mEditWearable->setWearable(wearable, !change_state);
+ mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency
+ }
+ else
+ {
+ // Save changes if closing.
+ mEditWearable->saveChanges();
+ mEditWearable->setWearable(NULL);
+ LLAppearanceMgr::getInstance()->updateIsDirty();
+ if (change_state)
+ {
+ LLVOAvatarSelf::onCustomizeEnd(!change_state);
+ }
+ }
}
void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
{
- // Set current outfit status (wearing/unsaved).
- bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
- std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing");
- mOutfitStatus->setText(cof_status_str);
-
- if (name == "")
- {
- std::string outfit_name;
- if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
- {
- mCurrentLookName->setText(outfit_name);
- return;
- }
-
- std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit";
- mCurrentLookName->setText(getString(string_name));
- mOpenOutfitBtn->setEnabled(FALSE);
- }
- else
- {
- mCurrentLookName->setText(name);
- // Can't just call update verbs since the folder link may not have been created yet.
- mOpenOutfitBtn->setEnabled(TRUE);
- }
+ // Set current outfit status (wearing/unsaved).
+ bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
+ std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing");
+ mOutfitStatus->setText(cof_status_str);
+
+ if (name == "")
+ {
+ std::string outfit_name;
+ if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
+ {
+ mCurrentLookName->setText(outfit_name);
+ return;
+ }
+
+ std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit";
+ mCurrentLookName->setText(getString(string_name));
+ mOpenOutfitBtn->setEnabled(FALSE);
+ }
+ else
+ {
+ mCurrentLookName->setText(name);
+ // Can't just call update verbs since the folder link may not have been created yet.
+ mOpenOutfitBtn->setEnabled(TRUE);
+ }
}
//static
void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch)
{
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD());
- LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(data);
- if (panel)
- {
- panel->showWearableEditPanel(wearable, disable_camera_switch);
- }
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD());
+ LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(data);
+ if (panel)
+ {
+ panel->showWearableEditPanel(wearable, disable_camera_switch);
+ }
}
// Fetch currently worn items and only enable the New Look button after everything's been
// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks.
void LLSidepanelAppearance::fetchInventory()
{
- uuid_vec_t ids;
- LLUUID item_id;
- for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type)
- {
- for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index)
- {
- item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index);
- if(item_id.notNull())
- {
- ids.push_back(item_id);
- }
- }
- }
-
- if (isAgentAvatarValid())
- {
- for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (!attachment) continue;
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject* attached_object = attachment_iter->get();
- if (!attached_object) continue;
- const LLUUID& item_id = attached_object->getAttachmentItemID();
- if (item_id.isNull()) continue;
- ids.push_back(item_id);
- }
- }
- }
-
- LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this);
- fetch_worn->startFetch();
- // If no items to be fetched, done will never be triggered.
- // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition.
- if (fetch_worn->isFinished())
- {
- fetch_worn->done();
- }
- else
- {
- gInventory.addObserver(fetch_worn);
- }
+ uuid_vec_t ids;
+ LLUUID item_id;
+ for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type)
+ {
+ for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index)
+ {
+ item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index);
+ if(item_id.notNull())
+ {
+ ids.push_back(item_id);
+ }
+ }
+ }
+
+ if (isAgentAvatarValid())
+ {
+ for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (!attachment) continue;
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject* attached_object = attachment_iter->get();
+ if (!attached_object) continue;
+ const LLUUID& item_id = attached_object->getAttachmentItemID();
+ if (item_id.isNull()) continue;
+ ids.push_back(item_id);
+ }
+ }
+ }
+
+ LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this);
+ fetch_worn->startFetch();
+ // If no items to be fetched, done will never be triggered.
+ // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition.
+ if (fetch_worn->isFinished())
+ {
+ fetch_worn->done();
+ }
+ else
+ {
+ gInventory.addObserver(fetch_worn);
+ }
}
void LLSidepanelAppearance::inventoryFetched()
@@ -541,28 +541,28 @@ void LLSidepanelAppearance::inventoryFetched()
void LLSidepanelAppearance::setWearablesLoading(bool val)
{
- getChildView("wearables_loading_indicator")->setVisible( val);
- getChildView("edit_outfit_btn")->setVisible( !val);
-
- if (!val)
- {
- // refresh outfit name when COF is already changed.
- refreshCurrentOutfitName();
- }
+ getChildView("wearables_loading_indicator")->setVisible( val);
+ getChildView("edit_outfit_btn")->setVisible( !val);
+
+ if (!val)
+ {
+ // refresh outfit name when COF is already changed.
+ refreshCurrentOutfitName();
+ }
}
void LLSidepanelAppearance::showDefaultSubpart()
{
- if (mEditWearable->getVisible())
- {
- mEditWearable->showDefaultSubpart();
- }
+ if (mEditWearable->getVisible())
+ {
+ mEditWearable->showDefaultSubpart();
+ }
}
void LLSidepanelAppearance::updateScrollingPanelList()
{
- if (mEditWearable->getVisible())
- {
- mEditWearable->updateScrollingPanelList();
- }
+ if (mEditWearable->getVisible())
+ {
+ mEditWearable->updateScrollingPanelList();
+ }
}
diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h
index e67652d6f7..239cbd4537 100644
--- a/indra/newview/llsidepanelappearance.h
+++ b/indra/newview/llsidepanelappearance.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsidepanelappearance.h
* @brief Side Bar "Appearance" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,62 +41,62 @@ class LLPanelOutfitsInventory;
class LLSidepanelAppearance : public LLPanel
{
- LOG_CLASS(LLSidepanelAppearance);
+ LOG_CLASS(LLSidepanelAppearance);
public:
- LLSidepanelAppearance();
- virtual ~LLSidepanelAppearance();
+ LLSidepanelAppearance();
+ virtual ~LLSidepanelAppearance();
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- void refreshCurrentOutfitName(const std::string& name = "");
+ void refreshCurrentOutfitName(const std::string& name = "");
- static void editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch = FALSE);
+ static void editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch = FALSE);
- void fetchInventory();
- void inventoryFetched();
+ void fetchInventory();
+ void inventoryFetched();
void showOutfitsInventoryPanel(); // last selected
- void showOutfitsInventoryPanel(const std::string& tab_name);
- void showOutfitEditPanel();
- void showWearableEditPanel(LLViewerWearable *wearable = NULL, BOOL disable_camera_switch = FALSE);
- void setWearablesLoading(bool val);
- void showDefaultSubpart();
- void updateScrollingPanelList();
- void updateToVisibility( const LLSD& new_visibility );
- LLPanelEditWearable* getWearable(){ return mEditWearable; }
+ void showOutfitsInventoryPanel(const std::string& tab_name);
+ void showOutfitEditPanel();
+ void showWearableEditPanel(LLViewerWearable *wearable = NULL, BOOL disable_camera_switch = FALSE);
+ void setWearablesLoading(bool val);
+ void showDefaultSubpart();
+ void updateScrollingPanelList();
+ void updateToVisibility( const LLSD& new_visibility );
+ LLPanelEditWearable* getWearable(){ return mEditWearable; }
bool isCOFPanelVisible();
private:
- void onFilterEdit(const std::string& search_string);
- void onVisibilityChanged ( const LLSD& new_visibility );
+ void onFilterEdit(const std::string& search_string);
+ void onVisibilityChanged ( const LLSD& new_visibility );
- void onOpenOutfitButtonClicked();
- void onEditAppearanceButtonClicked();
+ void onOpenOutfitButtonClicked();
+ void onEditAppearanceButtonClicked();
- void toggleMyOutfitsPanel(BOOL visible, const std::string& tab_name);
- void toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch = FALSE);
- void toggleWearableEditPanel(BOOL visible, LLViewerWearable* wearable = NULL, BOOL disable_camera_switch = FALSE);
+ void toggleMyOutfitsPanel(BOOL visible, const std::string& tab_name);
+ void toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch = FALSE);
+ void toggleWearableEditPanel(BOOL visible, LLViewerWearable* wearable = NULL, BOOL disable_camera_switch = FALSE);
- LLFilterEditor* mFilterEditor;
- LLPanelOutfitsInventory* mPanelOutfitsInventory;
- LLPanelOutfitEdit* mOutfitEdit;
- LLPanelEditWearable* mEditWearable;
+ LLFilterEditor* mFilterEditor;
+ LLPanelOutfitsInventory* mPanelOutfitsInventory;
+ LLPanelOutfitEdit* mOutfitEdit;
+ LLPanelEditWearable* mEditWearable;
- LLButton* mOpenOutfitBtn;
- LLButton* mEditAppearanceBtn;
- LLPanel* mCurrOutfitPanel;
+ LLButton* mOpenOutfitBtn;
+ LLButton* mEditAppearanceBtn;
+ LLPanel* mCurrOutfitPanel;
- LLTextBox* mCurrentLookName;
- LLTextBox* mOutfitStatus;
+ LLTextBox* mCurrentLookName;
+ LLTextBox* mOutfitStatus;
- // Search string for filtering landmarks and teleport
- // history locations
- std::string mFilterSubString;
+ // Search string for filtering landmarks and teleport
+ // history locations
+ std::string mFilterSubString;
- // Gets set to true when we're opened for the first time.
- bool mOpened;
+ // Gets set to true when we're opened for the first time.
+ bool mOpened;
};
#endif //LL_LLSIDEPANELAPPEARANCE_H
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index e970f70e92..0bb9e48a89 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -66,7 +66,7 @@ static LLPanelInjector<LLSidepanelInventory> t_inventory("sidepanel_inventory");
//
// No longer want the inbox panel to auto-expand since it creates issues with the "new" tag time stamp
-#define AUTO_EXPAND_INBOX 0
+#define AUTO_EXPAND_INBOX 0
static const char * const INBOX_BUTTON_NAME = "inbox_btn";
static const char * const INBOX_LAYOUT_PANEL_NAME = "inbox_layout_panel";
@@ -81,34 +81,34 @@ static bool sLoginCompleted = false;
class LLInboxAddedObserver : public LLInventoryCategoryAddedObserver
{
public:
- LLInboxAddedObserver(LLSidepanelInventory * sidepanelInventory)
- : LLInventoryCategoryAddedObserver()
- , mSidepanelInventory(sidepanelInventory)
- {
- }
-
- void done()
- {
- for (cat_vec_t::iterator it = mAddedCategories.begin(); it != mAddedCategories.end(); ++it)
- {
- LLViewerInventoryCategory* added_category = *it;
-
- LLFolderType::EType added_category_type = added_category->getPreferredType();
-
- switch (added_category_type)
- {
- case LLFolderType::FT_INBOX:
- mSidepanelInventory->enableInbox(true);
- mSidepanelInventory->observeInboxModifications(added_category->getUUID());
- break;
- default:
- break;
- }
- }
- }
-
+ LLInboxAddedObserver(LLSidepanelInventory * sidepanelInventory)
+ : LLInventoryCategoryAddedObserver()
+ , mSidepanelInventory(sidepanelInventory)
+ {
+ }
+
+ void done()
+ {
+ for (cat_vec_t::iterator it = mAddedCategories.begin(); it != mAddedCategories.end(); ++it)
+ {
+ LLViewerInventoryCategory* added_category = *it;
+
+ LLFolderType::EType added_category_type = added_category->getPreferredType();
+
+ switch (added_category_type)
+ {
+ case LLFolderType::FT_INBOX:
+ mSidepanelInventory->enableInbox(true);
+ mSidepanelInventory->observeInboxModifications(added_category->getUUID());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
private:
- LLSidepanelInventory * mSidepanelInventory;
+ LLSidepanelInventory * mSidepanelInventory;
};
//
@@ -116,79 +116,79 @@ private:
//
LLSidepanelInventory::LLSidepanelInventory()
- : LLPanel()
- , mPanelMainInventory(NULL)
- , mInboxEnabled(false)
- , mCategoriesObserver(NULL)
- , mInboxAddedObserver(NULL)
+ : LLPanel()
+ , mPanelMainInventory(NULL)
+ , mInboxEnabled(false)
+ , mCategoriesObserver(NULL)
+ , mInboxAddedObserver(NULL)
, mInboxLayoutPanel(NULL)
{
- //buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
+ //buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
}
LLSidepanelInventory::~LLSidepanelInventory()
{
- // Save the InventoryMainPanelHeight in settings per account
- gSavedPerAccountSettings.setS32("InventoryInboxHeight", mInboxLayoutPanel->getTargetDim());
-
- if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver))
- {
- gInventory.removeObserver(mCategoriesObserver);
- }
- delete mCategoriesObserver;
-
- if (mInboxAddedObserver && gInventory.containsObserver(mInboxAddedObserver))
- {
- gInventory.removeObserver(mInboxAddedObserver);
- }
- delete mInboxAddedObserver;
+ // Save the InventoryMainPanelHeight in settings per account
+ gSavedPerAccountSettings.setS32("InventoryInboxHeight", mInboxLayoutPanel->getTargetDim());
+
+ if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver))
+ {
+ gInventory.removeObserver(mCategoriesObserver);
+ }
+ delete mCategoriesObserver;
+
+ if (mInboxAddedObserver && gInventory.containsObserver(mInboxAddedObserver))
+ {
+ gInventory.removeObserver(mInboxAddedObserver);
+ }
+ delete mInboxAddedObserver;
}
void handleInventoryDisplayInboxChanged()
{
- LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
- if (sidepanel_inventory)
- {
- sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox"));
- }
+ LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ if (sidepanel_inventory)
+ {
+ sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox"));
+ }
}
BOOL LLSidepanelInventory::postBuild()
{
- // UI elements from inventory panel
- {
- mInventoryPanel = getChild<LLPanel>("sidepanel_inventory_panel");
-
- mPanelMainInventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
- mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2));
- //LLTabContainer* tabs = mPanelMainInventory->getChild<LLTabContainer>("inventory filter tabs");
- //tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
-
- /*
- EXT-4846 : "Can we suppress the "Landmarks" and "My Favorites" folder since they have their own Task Panel?"
- Deferring this until 2.1.
- LLInventoryPanel *my_inventory_panel = mPanelMainInventory->getChild<LLInventoryPanel>("All Items");
- my_inventory_panel->addHideFolderType(LLFolderType::FT_LANDMARK);
- my_inventory_panel->addHideFolderType(LLFolderType::FT_FAVORITE);
- */
-
- //LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
- }
-
- // Received items inbox setup
- {
- LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
-
- // Set up button states and callbacks
- LLButton * inbox_button = getChild<LLButton>(INBOX_BUTTON_NAME);
-
- inbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this));
-
- // For main Inventory floater: Get the previous inbox state from "InventoryInboxToggleState" setting.
+ // UI elements from inventory panel
+ {
+ mInventoryPanel = getChild<LLPanel>("sidepanel_inventory_panel");
+
+ mPanelMainInventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
+ mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2));
+ //LLTabContainer* tabs = mPanelMainInventory->getChild<LLTabContainer>("inventory filter tabs");
+ //tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
+
+ /*
+ EXT-4846 : "Can we suppress the "Landmarks" and "My Favorites" folder since they have their own Task Panel?"
+ Deferring this until 2.1.
+ LLInventoryPanel *my_inventory_panel = mPanelMainInventory->getChild<LLInventoryPanel>("All Items");
+ my_inventory_panel->addHideFolderType(LLFolderType::FT_LANDMARK);
+ my_inventory_panel->addHideFolderType(LLFolderType::FT_FAVORITE);
+ */
+
+ //LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
+ }
+
+ // Received items inbox setup
+ {
+ LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
+
+ // Set up button states and callbacks
+ LLButton * inbox_button = getChild<LLButton>(INBOX_BUTTON_NAME);
+
+ inbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this));
+
+ // For main Inventory floater: Get the previous inbox state from "InventoryInboxToggleState" setting.
// For additional Inventory floaters: Collapsed state is default.
- bool is_inbox_collapsed = !inbox_button->getToggleState() || sLoginCompleted;
+ bool is_inbox_collapsed = !inbox_button->getToggleState() || sLoginCompleted;
- // Restore the collapsed inbox panel state
+ // Restore the collapsed inbox panel state
mInboxLayoutPanel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
inv_stack->collapsePanel(mInboxLayoutPanel, is_inbox_collapsed);
if (!is_inbox_collapsed)
@@ -208,115 +208,115 @@ BOOL LLSidepanelInventory::postBuild()
// Trigger callback for after login so we can setup to track inbox changes after initial inventory load
LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::updateInbox, this));
}
- }
+ }
- gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged));
+ gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged));
LLFloater *floater = dynamic_cast<LLFloater*>(getParent());
if (floater && floater->getKey().isUndefined() && !sLoginCompleted)
{
// Prefill inventory for primary inventory floater
// Other floaters should fill on visibility change
- //
+ //
// see get_instance_num();
// Primary inventory floater will have undefined key
initInventoryViews();
}
- return TRUE;
+ return TRUE;
}
void LLSidepanelInventory::updateInbox()
{
sLoginCompleted = true;
- //
- // Track inbox folder changes
- //
- const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
-
- // Set up observer to listen for creation of inbox if it doesn't exist
- if (inbox_id.isNull())
- {
- observeInboxCreation();
- }
- // Set up observer for inbox changes, if we have an inbox already
- else
- {
+ //
+ // Track inbox folder changes
+ //
+ const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
+
+ // Set up observer to listen for creation of inbox if it doesn't exist
+ if (inbox_id.isNull())
+ {
+ observeInboxCreation();
+ }
+ // Set up observer for inbox changes, if we have an inbox already
+ else
+ {
// Consolidate Received items
// We shouldn't have to do that but with a client/server system relying on a "well known folder" convention,
// things can get messy and conventions broken. This call puts everything back together in its right place.
gInventory.consolidateForType(inbox_id, LLFolderType::FT_INBOX);
-
- // Enable the display of the inbox if it exists
- enableInbox(true);
- observeInboxModifications(inbox_id);
- }
+ // Enable the display of the inbox if it exists
+ enableInbox(true);
+
+ observeInboxModifications(inbox_id);
+ }
}
void LLSidepanelInventory::observeInboxCreation()
{
- //
- // Set up observer to track inbox folder creation
- //
-
- if (mInboxAddedObserver == NULL)
- {
- mInboxAddedObserver = new LLInboxAddedObserver(this);
-
- gInventory.addObserver(mInboxAddedObserver);
- }
+ //
+ // Set up observer to track inbox folder creation
+ //
+
+ if (mInboxAddedObserver == NULL)
+ {
+ mInboxAddedObserver = new LLInboxAddedObserver(this);
+
+ gInventory.addObserver(mInboxAddedObserver);
+ }
}
void LLSidepanelInventory::observeInboxModifications(const LLUUID& inboxID)
{
- //
- // Silently do nothing if we already have an inbox inventory panel set up
- // (this can happen multiple times on the initial session that creates the inbox)
- //
+ //
+ // Silently do nothing if we already have an inbox inventory panel set up
+ // (this can happen multiple times on the initial session that creates the inbox)
+ //
- if (mInventoryPanelInbox.get() != NULL)
- {
- return;
- }
+ if (mInventoryPanelInbox.get() != NULL)
+ {
+ return;
+ }
- //
- // Track inbox folder changes
- //
+ //
+ // Track inbox folder changes
+ //
- if (inboxID.isNull())
- {
- LL_WARNS() << "Attempting to track modifications to non-existent inbox" << LL_ENDL;
- return;
- }
+ if (inboxID.isNull())
+ {
+ LL_WARNS() << "Attempting to track modifications to non-existent inbox" << LL_ENDL;
+ return;
+ }
- if (mCategoriesObserver == NULL)
- {
- mCategoriesObserver = new LLInventoryCategoriesObserver();
- gInventory.addObserver(mCategoriesObserver);
- }
+ if (mCategoriesObserver == NULL)
+ {
+ mCategoriesObserver = new LLInventoryCategoriesObserver();
+ gInventory.addObserver(mCategoriesObserver);
+ }
- mCategoriesObserver->addCategory(inboxID, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inboxID));
+ mCategoriesObserver->addCategory(inboxID, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inboxID));
- //
- // Trigger a load for the entire contents of the Inbox
- //
+ //
+ // Trigger a load for the entire contents of the Inbox
+ //
- LLInventoryModelBackgroundFetch::instance().start(inboxID);
+ LLInventoryModelBackgroundFetch::instance().start(inboxID);
- //
- // Set up the inbox inventory view
- //
+ //
+ // Set up the inbox inventory view
+ //
- LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
+ LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
LLInventoryPanel* inventory_panel = inbox->setupInventoryPanel();
- mInventoryPanelInbox = inventory_panel->getInventoryPanelHandle();
+ mInventoryPanelInbox = inventory_panel->getInventoryPanelHandle();
}
void LLSidepanelInventory::enableInbox(bool enabled)
{
- mInboxEnabled = enabled;
-
+ mInboxEnabled = enabled;
+
if(!enabled || !mPanelMainInventory->isSingleFolderMode())
{
toggleInbox();
@@ -335,70 +335,70 @@ void LLSidepanelInventory::toggleInbox()
void LLSidepanelInventory::openInbox()
{
- if (mInboxEnabled)
- {
- getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true);
- onToggleInboxBtn();
- }
+ if (mInboxEnabled)
+ {
+ getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true);
+ onToggleInboxBtn();
+ }
}
void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id)
{
- // Trigger a load of the entire inbox so we always know the contents and their creation dates for sorting
- LLInventoryModelBackgroundFetch::instance().start(inbox_id);
+ // Trigger a load of the entire inbox so we always know the contents and their creation dates for sorting
+ LLInventoryModelBackgroundFetch::instance().start(inbox_id);
#if AUTO_EXPAND_INBOX
- // Expand the inbox since we have fresh items
- if (mInboxEnabled)
- {
- getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true);
- onToggleInboxBtn();
- }
+ // Expand the inbox since we have fresh items
+ if (mInboxEnabled)
+ {
+ getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true);
+ onToggleInboxBtn();
+ }
#endif
}
void LLSidepanelInventory::onToggleInboxBtn()
{
- LLButton* inboxButton = getChild<LLButton>(INBOX_BUTTON_NAME);
- LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
-
- const bool inbox_expanded = inboxButton->getToggleState();
-
- // Expand/collapse the indicated panel
- inv_stack->collapsePanel(mInboxLayoutPanel, !inbox_expanded);
-
- if (inbox_expanded)
- {
+ LLButton* inboxButton = getChild<LLButton>(INBOX_BUTTON_NAME);
+ LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
+
+ const bool inbox_expanded = inboxButton->getToggleState();
+
+ // Expand/collapse the indicated panel
+ inv_stack->collapsePanel(mInboxLayoutPanel, !inbox_expanded);
+
+ if (inbox_expanded)
+ {
mInboxLayoutPanel->setTargetDim(gSavedPerAccountSettings.getS32("InventoryInboxHeight"));
- if (mInboxLayoutPanel->isInVisibleChain())
- {
- gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
- }
+ if (mInboxLayoutPanel->isInVisibleChain())
+ {
+ gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
+ }
}
- else
- {
- gSavedPerAccountSettings.setS32("InventoryInboxHeight", mInboxLayoutPanel->getTargetDim());
- }
+ else
+ {
+ gSavedPerAccountSettings.setS32("InventoryInboxHeight", mInboxLayoutPanel->getTargetDim());
+ }
}
void LLSidepanelInventory::onOpen(const LLSD& key)
{
- LLFirstUse::newInventory(false);
- mPanelMainInventory->setFocusFilterEditor();
+ LLFirstUse::newInventory(false);
+ mPanelMainInventory->setFocusFilterEditor();
#if AUTO_EXPAND_INBOX
- // Expand the inbox if we have fresh items
- LLPanelMarketplaceInbox * inbox = findChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
- if (inbox && (inbox->getFreshItemCount() > 0))
- {
- getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true);
- onToggleInboxBtn();
- }
+ // Expand the inbox if we have fresh items
+ LLPanelMarketplaceInbox * inbox = findChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
+ if (inbox && (inbox->getFreshItemCount() > 0))
+ {
+ getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true);
+ onToggleInboxBtn();
+ }
#else
- if (mInboxEnabled && getChild<LLButton>(INBOX_BUTTON_NAME)->getToggleState())
- {
- gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
- }
+ if (mInboxEnabled && getChild<LLButton>(INBOX_BUTTON_NAME)->getToggleState())
+ {
+ gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
+ }
#endif
gAgent.showLatestFeatureNotification("inventory");
@@ -406,26 +406,26 @@ void LLSidepanelInventory::onOpen(const LLSD& key)
void LLSidepanelInventory::performActionOnSelection(const std::string &action)
{
- LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
- if (!current_item)
- {
- if (mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
- {
- current_item = mInventoryPanelInbox.get()->getRootFolder()->getCurSelectedItem();
- }
-
- if (!current_item)
- {
- return;
- }
- }
-
- static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->performAction(mPanelMainInventory->getActivePanel()->getModel(), action);
+ LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
+ if (!current_item)
+ {
+ if (mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
+ {
+ current_item = mInventoryPanelInbox.get()->getRootFolder()->getCurSelectedItem();
+ }
+
+ if (!current_item)
+ {
+ return;
+ }
+ }
+
+ static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->performAction(mPanelMainInventory->getActivePanel()->getModel(), action);
}
void LLSidepanelInventory::onBackButtonClicked()
{
- showInventoryPanel();
+ showInventoryPanel();
}
void LLSidepanelInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
@@ -435,7 +435,7 @@ void LLSidepanelInventory::onSelectionChange(const std::deque<LLFolderViewItem*>
void LLSidepanelInventory::showInventoryPanel()
{
- mInventoryPanel->setVisible(TRUE);
+ mInventoryPanel->setVisible(TRUE);
}
void LLSidepanelInventory::initInventoryViews()
@@ -445,36 +445,36 @@ void LLSidepanelInventory::initInventoryViews()
bool LLSidepanelInventory::canShare()
{
- LLInventoryPanel* inbox = mInventoryPanelInbox.get();
+ LLInventoryPanel* inbox = mInventoryPanelInbox.get();
- // Avoid flicker in the Recent tab while inventory is being loaded.
- if ( (!inbox || !inbox->getRootFolder() || inbox->getRootFolder()->getSelectionList().empty())
- && (mPanelMainInventory && !mPanelMainInventory->getActivePanel()->getRootFolder()->hasVisibleChildren()) )
- {
- return false;
- }
+ // Avoid flicker in the Recent tab while inventory is being loaded.
+ if ( (!inbox || !inbox->getRootFolder() || inbox->getRootFolder()->getSelectionList().empty())
+ && (mPanelMainInventory && !mPanelMainInventory->getActivePanel()->getRootFolder()->hasVisibleChildren()) )
+ {
+ return false;
+ }
- return ( (mPanelMainInventory ? LLAvatarActions::canShareSelectedItems(mPanelMainInventory->getActivePanel()) : false)
- || (inbox ? LLAvatarActions::canShareSelectedItems(inbox) : false) );
+ return ( (mPanelMainInventory ? LLAvatarActions::canShareSelectedItems(mPanelMainInventory->getActivePanel()) : false)
+ || (inbox ? LLAvatarActions::canShareSelectedItems(inbox) : false) );
}
bool LLSidepanelInventory::canWearSelected()
{
- std::set<LLUUID> selected_uuids = LLAvatarActions::getInventorySelectedUUIDs();
+ std::set<LLUUID> selected_uuids = LLAvatarActions::getInventorySelectedUUIDs();
- if (selected_uuids.empty())
- return false;
+ if (selected_uuids.empty())
+ return false;
- for (std::set<LLUUID>::const_iterator it = selected_uuids.begin();
- it != selected_uuids.end();
- ++it)
- {
- if (!get_can_item_be_worn(*it)) return false;
- }
+ for (std::set<LLUUID>::const_iterator it = selected_uuids.begin();
+ it != selected_uuids.end();
+ ++it)
+ {
+ if (!get_can_item_be_worn(*it)) return false;
+ }
- return true;
+ return true;
}
LLInventoryItem *LLSidepanelInventory::getSelectedItem()
@@ -484,112 +484,112 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem()
{
return NULL;
}
- LLFolderViewItem* current_item = root->getCurSelectedItem();
-
- if (!current_item)
- {
- if (mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
- {
- current_item = mInventoryPanelInbox.get()->getRootFolder()->getCurSelectedItem();
- }
-
- if (!current_item)
- {
- return NULL;
- }
- }
- const LLUUID &item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
- LLInventoryItem *item = gInventory.getItem(item_id);
- return item;
+ LLFolderViewItem* current_item = root->getCurSelectedItem();
+
+ if (!current_item)
+ {
+ if (mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
+ {
+ current_item = mInventoryPanelInbox.get()->getRootFolder()->getCurSelectedItem();
+ }
+
+ if (!current_item)
+ {
+ return NULL;
+ }
+ }
+ const LLUUID &item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
+ LLInventoryItem *item = gInventory.getItem(item_id);
+ return item;
}
U32 LLSidepanelInventory::getSelectedCount()
{
- int count = 0;
+ int count = 0;
- std::set<LLFolderViewItem*> selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList();
- count += selection_list.size();
+ std::set<LLFolderViewItem*> selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList();
+ count += selection_list.size();
- if ((count == 0) && mInboxEnabled && mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
- {
- selection_list = mInventoryPanelInbox.get()->getRootFolder()->getSelectionList();
+ if ((count == 0) && mInboxEnabled && mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
+ {
+ selection_list = mInventoryPanelInbox.get()->getRootFolder()->getSelectionList();
- count += selection_list.size();
- }
+ count += selection_list.size();
+ }
- return count;
+ return count;
}
LLInventoryPanel *LLSidepanelInventory::getActivePanel()
{
- if (!getVisible())
- {
- return NULL;
- }
- if (mInventoryPanel->getVisible())
- {
- return mPanelMainInventory->getActivePanel();
- }
- return NULL;
+ if (!getVisible())
+ {
+ return NULL;
+ }
+ if (mInventoryPanel->getVisible())
+ {
+ return mPanelMainInventory->getActivePanel();
+ }
+ return NULL;
}
void LLSidepanelInventory::selectAllItemsPanel()
{
- if (!getVisible())
- {
- return;
- }
- if (mInventoryPanel->getVisible())
- {
- mPanelMainInventory->selectAllItemsPanel();
- }
+ if (!getVisible())
+ {
+ return;
+ }
+ if (mInventoryPanel->getVisible())
+ {
+ mPanelMainInventory->selectAllItemsPanel();
+ }
}
BOOL LLSidepanelInventory::isMainInventoryPanelActive() const
{
- return mInventoryPanel->getVisible();
+ return mInventoryPanel->getVisible();
}
void LLSidepanelInventory::clearSelections(bool clearMain, bool clearInbox)
{
- if (clearMain)
- {
- LLInventoryPanel * inv_panel = getActivePanel();
-
- if (inv_panel)
- {
- inv_panel->getRootFolder()->clearSelection();
- }
- }
-
- if (clearInbox && mInboxEnabled && !mInventoryPanelInbox.isDead())
- {
- mInventoryPanelInbox.get()->getRootFolder()->clearSelection();
- }
+ if (clearMain)
+ {
+ LLInventoryPanel * inv_panel = getActivePanel();
+
+ if (inv_panel)
+ {
+ inv_panel->getRootFolder()->clearSelection();
+ }
+ }
+
+ if (clearInbox && mInboxEnabled && !mInventoryPanelInbox.isDead())
+ {
+ mInventoryPanelInbox.get()->getRootFolder()->clearSelection();
+ }
}
std::set<LLFolderViewItem*> LLSidepanelInventory::getInboxSelectionList()
{
- std::set<LLFolderViewItem*> inventory_selected_uuids;
-
- if (mInboxEnabled && mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
- {
- inventory_selected_uuids = mInventoryPanelInbox.get()->getRootFolder()->getSelectionList();
- }
-
- return inventory_selected_uuids;
+ std::set<LLFolderViewItem*> inventory_selected_uuids;
+
+ if (mInboxEnabled && mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
+ {
+ inventory_selected_uuids = mInventoryPanelInbox.get()->getRootFolder()->getSelectionList();
+ }
+
+ return inventory_selected_uuids;
}
void LLSidepanelInventory::cleanup()
{
- LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
- for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end();)
- {
- LLFloaterSidePanelContainer* iv = dynamic_cast<LLFloaterSidePanelContainer*>(*iter++);
- if (iv)
- {
- iv->cleanup();
- }
- }
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end();)
+ {
+ LLFloaterSidePanelContainer* iv = dynamic_cast<LLFloaterSidePanelContainer*>(*iter++);
+ if (iv)
+ {
+ iv->cleanup();
+ }
+ }
}
diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h
index 08989bb6af..a4df090852 100644
--- a/indra/newview/llsidepanelinventory.h
+++ b/indra/newview/llsidepanelinventory.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file LLSidepanelInventory.h
* @brief Side Bar "Inventory" panel
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,77 +43,77 @@ class LLSidepanelTaskInfo;
class LLSidepanelInventory : public LLPanel
{
public:
- LLSidepanelInventory();
- virtual ~LLSidepanelInventory();
+ LLSidepanelInventory();
+ virtual ~LLSidepanelInventory();
private:
- void updateInbox();
-
+ void updateInbox();
+
public:
- void observeInboxCreation();
- void observeInboxModifications(const LLUUID& inboxID);
+ void observeInboxCreation();
+ void observeInboxModifications(const LLUUID& inboxID);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
- LLInventoryPanel* getActivePanel(); // Returns an active inventory panel, if any.
- void selectAllItemsPanel();
- LLInventoryPanel* getInboxPanel() const { return mInventoryPanelInbox.get(); }
+ LLInventoryPanel* getActivePanel(); // Returns an active inventory panel, if any.
+ void selectAllItemsPanel();
+ LLInventoryPanel* getInboxPanel() const { return mInventoryPanelInbox.get(); }
- LLPanelMainInventory* getMainInventoryPanel() const { return mPanelMainInventory; }
- BOOL isMainInventoryPanelActive() const;
+ LLPanelMainInventory* getMainInventoryPanel() const { return mPanelMainInventory; }
+ BOOL isMainInventoryPanelActive() const;
- void clearSelections(bool clearMain, bool clearInbox);
+ void clearSelections(bool clearMain, bool clearInbox);
std::set<LLFolderViewItem*> getInboxSelectionList();
- void showInventoryPanel();
+ void showInventoryPanel();
void initInventoryViews();
- // checks can share selected item(s)
- bool canShare();
+ // checks can share selected item(s)
+ bool canShare();
- void onToggleInboxBtn();
+ void onToggleInboxBtn();
- void enableInbox(bool enabled);
+ void enableInbox(bool enabled);
void toggleInbox();
void hideInbox();
-
- void openInbox();
-
- bool isInboxEnabled() const { return mInboxEnabled; }
- static void cleanup();
+ void openInbox();
+
+ bool isInboxEnabled() const { return mInboxEnabled; }
+
+ static void cleanup();
protected:
- // Tracks highlighted (selected) item in inventory panel.
- LLInventoryItem *getSelectedItem();
- U32 getSelectedCount();
- void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
- // "wear", "teleport", etc.
- void performActionOnSelection(const std::string &action);
+ // Tracks highlighted (selected) item in inventory panel.
+ LLInventoryItem *getSelectedItem();
+ U32 getSelectedCount();
+ void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
+ // "wear", "teleport", etc.
+ void performActionOnSelection(const std::string &action);
- bool canWearSelected(); // check whether selected items can be worn
+ bool canWearSelected(); // check whether selected items can be worn
- void onInboxChanged(const LLUUID& inbox_id);
+ void onInboxChanged(const LLUUID& inbox_id);
- //
- // UI Elements
- //
+ //
+ // UI Elements
+ //
private:
- LLPanel* mInventoryPanel; // Main inventory view
- LLHandle<LLInventoryPanel> mInventoryPanelInbox;
- LLPanelMainInventory* mPanelMainInventory;
+ LLPanel* mInventoryPanel; // Main inventory view
+ LLHandle<LLInventoryPanel> mInventoryPanelInbox;
+ LLPanelMainInventory* mPanelMainInventory;
LLLayoutPanel* mInboxLayoutPanel;
protected:
- void onBackButtonClicked();
+ void onBackButtonClicked();
private:
- bool mInboxEnabled;
+ bool mInboxEnabled;
- LLInventoryCategoriesObserver* mCategoriesObserver;
- LLInboxAddedObserver* mInboxAddedObserver;
+ LLInventoryCategoriesObserver* mCategoriesObserver;
+ LLInboxAddedObserver* mInboxAddedObserver;
};
#endif //LL_LLSIDEPANELINVENTORY_H
diff --git a/indra/newview/llsidepanelinventorysubpanel.cpp b/indra/newview/llsidepanelinventorysubpanel.cpp
index 3b73b6b7dd..115f06e65f 100644
--- a/indra/newview/llsidepanelinventorysubpanel.cpp
+++ b/indra/newview/llsidepanelinventorysubpanel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsidepanelinventorysubpanel.cpp
* @brief A floater which shows an inventory item's properties.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,9 +48,9 @@
// Default constructor
LLSidepanelInventorySubpanel::LLSidepanelInventorySubpanel(const LLPanel::Params& p)
: LLPanel(p),
- mIsDirty(TRUE),
- mIsEditing(FALSE),
- mCancelBtn(NULL)
+ mIsDirty(TRUE),
+ mIsEditing(FALSE),
+ mCancelBtn(NULL)
{
}
@@ -63,77 +63,77 @@ LLSidepanelInventorySubpanel::~LLSidepanelInventorySubpanel()
BOOL LLSidepanelInventorySubpanel::postBuild()
{
- mCancelBtn = findChild<LLButton>("cancel_btn");
- if (mCancelBtn)
- {
- mCancelBtn->setClickedCallback(boost::bind(&LLSidepanelInventorySubpanel::onCancelButtonClicked, this));
- }
- return TRUE;
+ mCancelBtn = findChild<LLButton>("cancel_btn");
+ if (mCancelBtn)
+ {
+ mCancelBtn->setClickedCallback(boost::bind(&LLSidepanelInventorySubpanel::onCancelButtonClicked, this));
+ }
+ return TRUE;
}
void LLSidepanelInventorySubpanel::setVisible(BOOL visible)
{
- if (visible)
- {
- dirty();
- }
- LLPanel::setVisible(visible);
+ if (visible)
+ {
+ dirty();
+ }
+ LLPanel::setVisible(visible);
}
void LLSidepanelInventorySubpanel::setIsEditing(BOOL edit)
{
- mIsEditing = edit;
- mIsDirty = TRUE;
+ mIsEditing = edit;
+ mIsDirty = TRUE;
}
BOOL LLSidepanelInventorySubpanel::getIsEditing() const
{
- return TRUE; // Default everything to edit mode since we're not using an edit button anymore.
- // return mIsEditing;
+ return TRUE; // Default everything to edit mode since we're not using an edit button anymore.
+ // return mIsEditing;
}
void LLSidepanelInventorySubpanel::reset()
{
- mIsDirty = TRUE;
+ mIsDirty = TRUE;
}
void LLSidepanelInventorySubpanel::draw()
{
- if (mIsDirty)
- {
- refresh();
- updateVerbs();
- mIsDirty = FALSE;
- }
-
- LLPanel::draw();
+ if (mIsDirty)
+ {
+ refresh();
+ updateVerbs();
+ mIsDirty = FALSE;
+ }
+
+ LLPanel::draw();
}
void LLSidepanelInventorySubpanel::dirty()
{
- mIsDirty = TRUE;
- setIsEditing(FALSE);
+ mIsDirty = TRUE;
+ setIsEditing(FALSE);
}
void LLSidepanelInventorySubpanel::updateVerbs()
{
- if (mCancelBtn)
- {
- mCancelBtn->setVisible(mIsEditing);
- }
+ if (mCancelBtn)
+ {
+ mCancelBtn->setVisible(mIsEditing);
+ }
}
void LLSidepanelInventorySubpanel::onEditButtonClicked()
{
- setIsEditing(TRUE);
- refresh();
- updateVerbs();
+ setIsEditing(TRUE);
+ refresh();
+ updateVerbs();
}
void LLSidepanelInventorySubpanel::onCancelButtonClicked()
{
- setIsEditing(FALSE);
- refresh();
- updateVerbs();
+ setIsEditing(FALSE);
+ refresh();
+ updateVerbs();
}
diff --git a/indra/newview/llsidepanelinventorysubpanel.h b/indra/newview/llsidepanelinventorysubpanel.h
index 0d18943cbf..9fa2bbbc00 100644
--- a/indra/newview/llsidepanelinventorysubpanel.h
+++ b/indra/newview/llsidepanelinventorysubpanel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsidepanelinventorysubpanel.h
* @brief A panel which shows an inventory item's properties.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,34 +40,34 @@ class LLInventoryItem;
class LLSidepanelInventorySubpanel : public LLPanel
{
public:
- LLSidepanelInventorySubpanel(const LLPanel::Params& p = getDefaultParams());
- virtual ~LLSidepanelInventorySubpanel();
+ LLSidepanelInventorySubpanel(const LLPanel::Params& p = getDefaultParams());
+ virtual ~LLSidepanelInventorySubpanel();
- /*virtual*/ void setVisible(BOOL visible);
- virtual BOOL postBuild();
- virtual void draw();
- virtual void reset();
+ /*virtual*/ void setVisible(BOOL visible);
+ virtual BOOL postBuild();
+ virtual void draw();
+ virtual void reset();
- void dirty();
- void setIsEditing(BOOL edit);
+ void dirty();
+ void setIsEditing(BOOL edit);
protected:
- virtual void refresh() = 0;
- virtual void save() = 0;
- virtual void updateVerbs();
-
- BOOL getIsEditing() const;
-
- //
- // UI Elements
- //
+ virtual void refresh() = 0;
+ virtual void save() = 0;
+ virtual void updateVerbs();
+
+ BOOL getIsEditing() const;
+
+ //
+ // UI Elements
+ //
protected:
- void onEditButtonClicked();
- void onCancelButtonClicked();
- LLButton* mCancelBtn;
+ void onEditButtonClicked();
+ void onCancelButtonClicked();
+ LLButton* mCancelBtn;
private:
- BOOL mIsDirty; // item properties need to be updated
- BOOL mIsEditing; // if we're in edit mode
+ BOOL mIsDirty; // item properties need to be updated
+ BOOL mIsEditing; // if we're in edit mode
};
#endif // LL_LLSIDEPANELINVENTORYSUBPANEL_H
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index d6d5a4ef2d..4506088fd3 100644
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsidepaneliteminfo.cpp
* @brief A floater which shows an inventory item's properties.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -88,30 +88,30 @@ private:
class LLObjectInventoryObserver : public LLVOInventoryListener
{
public:
- LLObjectInventoryObserver(LLSidepanelItemInfo* floater, LLViewerObject* object)
- : mFloater(floater)
- {
- registerVOInventoryListener(object, NULL);
- }
- virtual ~LLObjectInventoryObserver()
- {
- removeVOInventoryListener();
- }
- /*virtual*/ void inventoryChanged(LLViewerObject* object,
- LLInventoryObject::object_list_t* inventory,
- S32 serial_num,
- void* user_data);
+ LLObjectInventoryObserver(LLSidepanelItemInfo* floater, LLViewerObject* object)
+ : mFloater(floater)
+ {
+ registerVOInventoryListener(object, NULL);
+ }
+ virtual ~LLObjectInventoryObserver()
+ {
+ removeVOInventoryListener();
+ }
+ /*virtual*/ void inventoryChanged(LLViewerObject* object,
+ LLInventoryObject::object_list_t* inventory,
+ S32 serial_num,
+ void* user_data);
private:
- LLSidepanelItemInfo* mFloater; // Not a handle because LLSidepanelItemInfo is managing LLObjectInventoryObserver
+ LLSidepanelItemInfo* mFloater; // Not a handle because LLSidepanelItemInfo is managing LLObjectInventoryObserver
};
/*virtual*/
void LLObjectInventoryObserver::inventoryChanged(LLViewerObject* object,
- LLInventoryObject::object_list_t* inventory,
- S32 serial_num,
- void* user_data)
+ LLInventoryObject::object_list_t* inventory,
+ S32 serial_num,
+ void* user_data)
{
- mFloater->dirty();
+ mFloater->dirty();
}
///----------------------------------------------------------------------------
@@ -122,10 +122,10 @@ static LLPanelInjector<LLSidepanelItemInfo> t_item_info("sidepanel_item_info");
// Default constructor
LLSidepanelItemInfo::LLSidepanelItemInfo(const LLPanel::Params& p)
- : LLPanel(p)
- , mItemID(LLUUID::null)
- , mObjectInventoryObserver(NULL)
- , mUpdatePendingId(-1)
+ : LLPanel(p)
+ , mItemID(LLUUID::null)
+ , mObjectInventoryObserver(NULL)
+ , mUpdatePendingId(-1)
, mIsDirty(false) /*Not ready*/
, mParentFloater(NULL)
{
@@ -139,8 +139,8 @@ LLSidepanelItemInfo::~LLSidepanelItemInfo()
gInventory.removeObserver(this);
gIdleCallbacks.deleteFunction(&LLSidepanelItemInfo::onIdle, (void*)this);
- stopObjectInventoryObserver();
-
+ stopObjectInventoryObserver();
+
if (mOwnerCacheConnection.connected())
{
mOwnerCacheConnection.disconnect();
@@ -158,41 +158,41 @@ BOOL LLSidepanelItemInfo::postBuild()
mItemTypeIcon = getChild<LLIconCtrl>("item_type_icon");
mLabelOwnerName = getChild<LLTextBox>("LabelOwnerName");
mLabelCreatorName = getChild<LLTextBox>("LabelCreatorName");
-
- getChild<LLLineEditor>("LabelItemName")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
- getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this));
- getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this));
+
+ getChild<LLLineEditor>("LabelItemName")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this));
+ getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this));
// Thumnail edition
mChangeThumbnailBtn->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onEditThumbnail, this));
- // acquired date
- // owner permissions
- // Permissions debug text
- // group permissions
- getChild<LLUICtrl>("CheckShareWithGroup")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
- // everyone permissions
- getChild<LLUICtrl>("CheckEveryoneCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
- // next owner permissions
- getChild<LLUICtrl>("CheckNextOwnerModify")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
- getChild<LLUICtrl>("CheckNextOwnerCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
- getChild<LLUICtrl>("CheckNextOwnerTransfer")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
- // Mark for sale or not, and sale info
- getChild<LLUICtrl>("CheckPurchase")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1));
- // Change sale type, and sale info
- getChild<LLUICtrl>("ComboBoxSaleType")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1));
- // "Price" label for edit
- getChild<LLUICtrl>("Edit Cost")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1));
- refresh();
- return TRUE;
+ // acquired date
+ // owner permissions
+ // Permissions debug text
+ // group permissions
+ getChild<LLUICtrl>("CheckShareWithGroup")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
+ // everyone permissions
+ getChild<LLUICtrl>("CheckEveryoneCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
+ // next owner permissions
+ getChild<LLUICtrl>("CheckNextOwnerModify")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
+ getChild<LLUICtrl>("CheckNextOwnerCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
+ getChild<LLUICtrl>("CheckNextOwnerTransfer")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));
+ // Mark for sale or not, and sale info
+ getChild<LLUICtrl>("CheckPurchase")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1));
+ // Change sale type, and sale info
+ getChild<LLUICtrl>("ComboBoxSaleType")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1));
+ // "Price" label for edit
+ getChild<LLUICtrl>("Edit Cost")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1));
+ refresh();
+ return TRUE;
}
void LLSidepanelItemInfo::setObjectID(const LLUUID& object_id)
{
- mObjectID = object_id;
+ mObjectID = object_id;
- // Start monitoring changes in the object inventory to update
- // selected inventory item properties in Item Profile panel. See STORM-148.
- startObjectInventoryObserver();
- mUpdatePendingId = -1;
+ // Start monitoring changes in the object inventory to update
+ // selected inventory item properties in Item Profile panel. See STORM-148.
+ startObjectInventoryObserver();
+ mUpdatePendingId = -1;
}
void LLSidepanelItemInfo::setItemID(const LLUUID& item_id)
@@ -212,12 +212,12 @@ void LLSidepanelItemInfo::setParentFloater(LLFloater* parent)
const LLUUID& LLSidepanelItemInfo::getObjectID() const
{
- return mObjectID;
+ return mObjectID;
}
const LLUUID& LLSidepanelItemInfo::getItemID() const
{
- return mItemID;
+ return mItemID;
}
void LLSidepanelItemInfo::onUpdateCallback(const LLUUID& item_id, S32 received_update_id)
@@ -231,18 +231,18 @@ void LLSidepanelItemInfo::onUpdateCallback(const LLUUID& item_id, S32 received_u
void LLSidepanelItemInfo::reset()
{
- mObjectID = LLUUID::null;
- mItemID = LLUUID::null;
+ mObjectID = LLUUID::null;
+ mItemID = LLUUID::null;
- stopObjectInventoryObserver();
+ stopObjectInventoryObserver();
dirty();
}
void LLSidepanelItemInfo::refresh()
{
- LLViewerInventoryItem* item = findItem();
- if(item)
- {
+ LLViewerInventoryItem* item = findItem();
+ if(item)
+ {
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
bool in_trash = (item->getUUID() == trash_id) || gInventory.isObjectDescendentOf(item->getUUID(), trash_id);
if (in_trash && mParentFloater)
@@ -255,8 +255,8 @@ void LLSidepanelItemInfo::refresh()
{
refreshFromItem(item);
}
- return;
- }
+ return;
+ }
if (mObjectID.notNull())
{
@@ -268,7 +268,7 @@ void LLSidepanelItemInfo::refresh()
return;
}
}
-
+
if (mParentFloater)
{
// if we failed to get item, it likely no longer exists
@@ -278,43 +278,43 @@ void LLSidepanelItemInfo::refresh()
void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
{
- ////////////////////////
- // PERMISSIONS LOOKUP //
- ////////////////////////
+ ////////////////////////
+ // PERMISSIONS LOOKUP //
+ ////////////////////////
- llassert(item);
- if (!item) return;
+ llassert(item);
+ if (!item) return;
if (mUpdatePendingId != -1)
{
return;
}
- // do not enable the UI for incomplete items.
- bool is_complete = item->isFinished();
- const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(item->getInventoryType());
- const BOOL is_calling_card = (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD);
- const BOOL is_settings = (item->getInventoryType() == LLInventoryType::IT_SETTINGS);
- const LLPermissions& perm = item->getPermissions();
- const BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm,
- GP_OBJECT_MANIPULATE);
- const BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm,
- GP_OBJECT_SET_SALE) &&
- !cannot_restrict_permissions;
- const BOOL is_link = item->getIsLinkType();
-
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- bool not_in_trash = (item->getUUID() != trash_id) && !gInventory.isObjectDescendentOf(item->getUUID(), trash_id);
-
- // You need permission to modify the object to modify an inventory
- // item in it.
- LLViewerObject* object = NULL;
- if(!mObjectID.isNull()) object = gObjectList.findObject(mObjectID);
- BOOL is_obj_modify = TRUE;
- if(object)
- {
- is_obj_modify = object->permOwnerModify();
- }
+ // do not enable the UI for incomplete items.
+ bool is_complete = item->isFinished();
+ const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(item->getInventoryType());
+ const BOOL is_calling_card = (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD);
+ const BOOL is_settings = (item->getInventoryType() == LLInventoryType::IT_SETTINGS);
+ const LLPermissions& perm = item->getPermissions();
+ const BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm,
+ GP_OBJECT_MANIPULATE);
+ const BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm,
+ GP_OBJECT_SET_SALE) &&
+ !cannot_restrict_permissions;
+ const BOOL is_link = item->getIsLinkType();
+
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ bool not_in_trash = (item->getUUID() != trash_id) && !gInventory.isObjectDescendentOf(item->getUUID(), trash_id);
+
+ // You need permission to modify the object to modify an inventory
+ // item in it.
+ LLViewerObject* object = NULL;
+ if(!mObjectID.isNull()) object = gObjectList.findObject(mObjectID);
+ BOOL is_obj_modify = TRUE;
+ if(object)
+ {
+ is_obj_modify = object->permOwnerModify();
+ }
if(item->getInventoryType() == LLInventoryType::IT_LSL)
{
@@ -330,25 +330,25 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
LLExperienceCache::instance().fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), url,
boost::bind(&LLSidepanelItemInfo::setAssociatedExperience, getDerivedHandle<LLSidepanelItemInfo>(), _1));
}
-
- //////////////////////
- // ITEM NAME & DESC //
- //////////////////////
- BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm,
- GP_OBJECT_MANIPULATE)
- && is_obj_modify && is_complete && not_in_trash;
-
- getChildView("LabelItemNameTitle")->setEnabled(TRUE);
- getChildView("LabelItemName")->setEnabled(is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards
- getChild<LLUICtrl>("LabelItemName")->setValue(item->getName());
- getChildView("LabelItemDescTitle")->setEnabled(TRUE);
- getChildView("LabelItemDesc")->setEnabled(is_modifiable);
- getChild<LLUICtrl>("LabelItemDesc")->setValue(item->getDescription());
+
+ //////////////////////
+ // ITEM NAME & DESC //
+ //////////////////////
+ BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm,
+ GP_OBJECT_MANIPULATE)
+ && is_obj_modify && is_complete && not_in_trash;
+
+ getChildView("LabelItemNameTitle")->setEnabled(TRUE);
+ getChildView("LabelItemName")->setEnabled(is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards
+ getChild<LLUICtrl>("LabelItemName")->setValue(item->getName());
+ getChildView("LabelItemDescTitle")->setEnabled(TRUE);
+ getChildView("LabelItemDesc")->setEnabled(is_modifiable);
+ getChild<LLUICtrl>("LabelItemDesc")->setValue(item->getDescription());
getChild<LLUICtrl>("item_thumbnail")->setValue(item->getThumbnailUUID());
LLUIImagePtr icon_img = LLInventoryIcon::getIcon(item->getType(), item->getInventoryType(), item->getFlags(), FALSE);
mItemTypeIcon->setImage(icon_img);
-
+
// Style for creator and owner links
LLStyle::Params style_params;
LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
@@ -360,20 +360,20 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
style_params.font.size = LLFontGL::sizeFromFont(fontp);
style_params.font.style = "UNDERLINE";
- //////////////////
- // CREATOR NAME //
- //////////////////
- if(!gCacheName) return;
- if(!gAgent.getRegion()) return;
+ //////////////////
+ // CREATOR NAME //
+ //////////////////
+ if(!gCacheName) return;
+ if(!gAgent.getRegion()) return;
- if (item->getCreatorUUID().notNull())
- {
- LLUUID creator_id = item->getCreatorUUID();
- std::string slurl =
- LLSLURL("agent", creator_id, "inspect").getSLURLString();
+ if (item->getCreatorUUID().notNull())
+ {
+ LLUUID creator_id = item->getCreatorUUID();
+ std::string slurl =
+ LLSLURL("agent", creator_id, "inspect").getSLURLString();
style_params.link_href = slurl;
-
+
LLAvatarName av_name;
if (LLAvatarNameCache::get(creator_id, &av_name))
{
@@ -388,27 +388,27 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
mLabelCreatorName->setText(LLTrans::getString("None"));
mCreatorCacheConnection = LLAvatarNameCache::get(creator_id, boost::bind(&LLSidepanelItemInfo::updateCreatorName, this, _1, _2, style_params));
}
-
- getChildView("LabelCreatorTitle")->setEnabled(TRUE);
+
+ getChildView("LabelCreatorTitle")->setEnabled(TRUE);
mLabelCreatorName->setEnabled(TRUE);
- }
- else
- {
- getChildView("LabelCreatorTitle")->setEnabled(FALSE);
+ }
+ else
+ {
+ getChildView("LabelCreatorTitle")->setEnabled(FALSE);
mLabelCreatorName->setEnabled(FALSE);
mLabelCreatorName->setValue(getString("unknown_multiple"));
- }
+ }
- ////////////////
- // OWNER NAME //
- ////////////////
- if(perm.isOwned())
- {
+ ////////////////
+ // OWNER NAME //
+ ////////////////
+ if(perm.isOwned())
+ {
std::string slurl;
- if (perm.isGroupOwned())
- {
+ if (perm.isGroupOwned())
+ {
LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(perm.getGroup());
-
+
slurl = LLSLURL("group", perm.getGroup(), "inspect").getSLURLString();
style_params.link_href = slurl;
if (group_data && group_data->isGroupPropertiesDataComplete())
@@ -419,17 +419,17 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
{
// Triggers refresh
LLGroupMgr::getInstance()->sendGroupPropertiesRequest(perm.getGroup());
-
+
std::string name;
gCacheName->getGroupName(perm.getGroup(), name);
mLabelOwnerName->setText(name, style_params);
}
- }
- else
- {
- LLUUID owner_id = perm.getOwner();
+ }
+ else
+ {
+ LLUUID owner_id = perm.getOwner();
slurl = LLSLURL("agent", owner_id, "inspect").getSLURLString();
-
+
style_params.link_href = slurl;
LLAvatarName av_name;
if (LLAvatarNameCache::get(owner_id, &av_name))
@@ -445,264 +445,264 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
mLabelOwnerName->setText(LLTrans::getString("None"));
mOwnerCacheConnection = LLAvatarNameCache::get(owner_id, boost::bind(&LLSidepanelItemInfo::updateOwnerName, this, _1, _2, style_params));
}
- }
- getChildView("LabelOwnerTitle")->setEnabled(TRUE);
+ }
+ getChildView("LabelOwnerTitle")->setEnabled(TRUE);
mLabelOwnerName->setEnabled(TRUE);
- }
- else
- {
- getChildView("LabelOwnerTitle")->setEnabled(FALSE);
+ }
+ else
+ {
+ getChildView("LabelOwnerTitle")->setEnabled(FALSE);
mLabelOwnerName->setEnabled(FALSE);
mLabelOwnerName->setValue(getString("public"));
- }
+ }
// Not yet supported for task inventories
mChangeThumbnailBtn->setEnabled(mObjectID.isNull() && ALEXANDRIA_LINDEN_ID != perm.getOwner());
-
- ////////////
- // ORIGIN //
- ////////////
-
- if (object)
- {
- getChild<LLUICtrl>("origin")->setValue(getString("origin_inworld"));
- }
- else
- {
- getChild<LLUICtrl>("origin")->setValue(getString("origin_inventory"));
- }
-
- //////////////////
- // ACQUIRE DATE //
- //////////////////
-
- time_t time_utc = item->getCreationDate();
- if (0 == time_utc)
- {
- getChild<LLUICtrl>("LabelAcquiredDate")->setValue(getString("unknown"));
- }
- else
- {
- std::string timeStr = getString("acquiredDate");
- LLSD substitution;
- substitution["datetime"] = (S32) time_utc;
- LLStringUtil::format (timeStr, substitution);
- getChild<LLUICtrl>("LabelAcquiredDate")->setValue(timeStr);
- }
-
- //////////////////////////////////////
- // PERMISSIONS AND SALE ITEM HIDING //
- //////////////////////////////////////
-
- const std::string perm_and_sale_items[]={
- "perms_inv",
- "perm_modify",
- "CheckOwnerModify",
- "CheckOwnerCopy",
- "CheckOwnerTransfer",
- "GroupLabel",
- "CheckShareWithGroup",
- "AnyoneLabel",
- "CheckEveryoneCopy",
- "NextOwnerLabel",
- "CheckNextOwnerModify",
- "CheckNextOwnerCopy",
- "CheckNextOwnerTransfer",
- "CheckPurchase",
- "ComboBoxSaleType",
- "Edit Cost"
- };
-
- const std::string debug_items[]={
- "BaseMaskDebug",
- "OwnerMaskDebug",
- "GroupMaskDebug",
- "EveryoneMaskDebug",
- "NextMaskDebug"
- };
-
- // Hide permissions checkboxes and labels and for sale info if in the trash
- // or ui elements don't apply to these objects and return from function
- if (!not_in_trash || cannot_restrict_permissions)
- {
- for(size_t t=0; t<LL_ARRAY_SIZE(perm_and_sale_items); ++t)
- {
- getChildView(perm_and_sale_items[t])->setVisible(false);
- }
-
- for(size_t t=0; t<LL_ARRAY_SIZE(debug_items); ++t)
- {
- getChildView(debug_items[t])->setVisible(false);
- }
- return;
- }
- else // Make sure perms and sale ui elements are visible
- {
- for(size_t t=0; t<LL_ARRAY_SIZE(perm_and_sale_items); ++t)
- {
- getChildView(perm_and_sale_items[t])->setVisible(true);
- }
- }
-
- ///////////////////////
- // OWNER PERMISSIONS //
- ///////////////////////
-
- U32 base_mask = perm.getMaskBase();
- U32 owner_mask = perm.getMaskOwner();
- U32 group_mask = perm.getMaskGroup();
- U32 everyone_mask = perm.getMaskEveryone();
- U32 next_owner_mask = perm.getMaskNextOwner();
-
- getChildView("CheckOwnerModify")->setEnabled(FALSE);
- getChild<LLUICtrl>("CheckOwnerModify")->setValue(LLSD((BOOL)(owner_mask & PERM_MODIFY)));
- getChildView("CheckOwnerCopy")->setEnabled(FALSE);
- getChild<LLUICtrl>("CheckOwnerCopy")->setValue(LLSD((BOOL)(owner_mask & PERM_COPY)));
- getChildView("CheckOwnerTransfer")->setEnabled(FALSE);
- getChild<LLUICtrl>("CheckOwnerTransfer")->setValue(LLSD((BOOL)(owner_mask & PERM_TRANSFER)));
-
- ///////////////////////
- // DEBUG PERMISSIONS //
- ///////////////////////
-
- if( gSavedSettings.getBOOL("DebugPermissions") )
- {
+
+ ////////////
+ // ORIGIN //
+ ////////////
+
+ if (object)
+ {
+ getChild<LLUICtrl>("origin")->setValue(getString("origin_inworld"));
+ }
+ else
+ {
+ getChild<LLUICtrl>("origin")->setValue(getString("origin_inventory"));
+ }
+
+ //////////////////
+ // ACQUIRE DATE //
+ //////////////////
+
+ time_t time_utc = item->getCreationDate();
+ if (0 == time_utc)
+ {
+ getChild<LLUICtrl>("LabelAcquiredDate")->setValue(getString("unknown"));
+ }
+ else
+ {
+ std::string timeStr = getString("acquiredDate");
+ LLSD substitution;
+ substitution["datetime"] = (S32) time_utc;
+ LLStringUtil::format (timeStr, substitution);
+ getChild<LLUICtrl>("LabelAcquiredDate")->setValue(timeStr);
+ }
+
+ //////////////////////////////////////
+ // PERMISSIONS AND SALE ITEM HIDING //
+ //////////////////////////////////////
+
+ const std::string perm_and_sale_items[]={
+ "perms_inv",
+ "perm_modify",
+ "CheckOwnerModify",
+ "CheckOwnerCopy",
+ "CheckOwnerTransfer",
+ "GroupLabel",
+ "CheckShareWithGroup",
+ "AnyoneLabel",
+ "CheckEveryoneCopy",
+ "NextOwnerLabel",
+ "CheckNextOwnerModify",
+ "CheckNextOwnerCopy",
+ "CheckNextOwnerTransfer",
+ "CheckPurchase",
+ "ComboBoxSaleType",
+ "Edit Cost"
+ };
+
+ const std::string debug_items[]={
+ "BaseMaskDebug",
+ "OwnerMaskDebug",
+ "GroupMaskDebug",
+ "EveryoneMaskDebug",
+ "NextMaskDebug"
+ };
+
+ // Hide permissions checkboxes and labels and for sale info if in the trash
+ // or ui elements don't apply to these objects and return from function
+ if (!not_in_trash || cannot_restrict_permissions)
+ {
+ for(size_t t=0; t<LL_ARRAY_SIZE(perm_and_sale_items); ++t)
+ {
+ getChildView(perm_and_sale_items[t])->setVisible(false);
+ }
+
+ for(size_t t=0; t<LL_ARRAY_SIZE(debug_items); ++t)
+ {
+ getChildView(debug_items[t])->setVisible(false);
+ }
+ return;
+ }
+ else // Make sure perms and sale ui elements are visible
+ {
+ for(size_t t=0; t<LL_ARRAY_SIZE(perm_and_sale_items); ++t)
+ {
+ getChildView(perm_and_sale_items[t])->setVisible(true);
+ }
+ }
+
+ ///////////////////////
+ // OWNER PERMISSIONS //
+ ///////////////////////
+
+ U32 base_mask = perm.getMaskBase();
+ U32 owner_mask = perm.getMaskOwner();
+ U32 group_mask = perm.getMaskGroup();
+ U32 everyone_mask = perm.getMaskEveryone();
+ U32 next_owner_mask = perm.getMaskNextOwner();
+
+ getChildView("CheckOwnerModify")->setEnabled(FALSE);
+ getChild<LLUICtrl>("CheckOwnerModify")->setValue(LLSD((BOOL)(owner_mask & PERM_MODIFY)));
+ getChildView("CheckOwnerCopy")->setEnabled(FALSE);
+ getChild<LLUICtrl>("CheckOwnerCopy")->setValue(LLSD((BOOL)(owner_mask & PERM_COPY)));
+ getChildView("CheckOwnerTransfer")->setEnabled(FALSE);
+ getChild<LLUICtrl>("CheckOwnerTransfer")->setValue(LLSD((BOOL)(owner_mask & PERM_TRANSFER)));
+
+ ///////////////////////
+ // DEBUG PERMISSIONS //
+ ///////////////////////
+
+ if( gSavedSettings.getBOOL("DebugPermissions") )
+ {
childSetVisible("layout_debug_permissions", true);
-
- BOOL slam_perm = FALSE;
- BOOL overwrite_group = FALSE;
- BOOL overwrite_everyone = FALSE;
-
- if (item->getType() == LLAssetType::AT_OBJECT)
- {
- U32 flags = item->getFlags();
- slam_perm = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
- overwrite_everyone = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
- overwrite_group = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
- }
-
- std::string perm_string;
-
- perm_string = "B: ";
- perm_string += mask_to_string(base_mask);
- getChild<LLUICtrl>("BaseMaskDebug")->setValue(perm_string);
-
- perm_string = "O: ";
- perm_string += mask_to_string(owner_mask);
- getChild<LLUICtrl>("OwnerMaskDebug")->setValue(perm_string);
-
- perm_string = "G";
- perm_string += overwrite_group ? "*: " : ": ";
- perm_string += mask_to_string(group_mask);
- getChild<LLUICtrl>("GroupMaskDebug")->setValue(perm_string);
-
- perm_string = "E";
- perm_string += overwrite_everyone ? "*: " : ": ";
- perm_string += mask_to_string(everyone_mask);
- getChild<LLUICtrl>("EveryoneMaskDebug")->setValue(perm_string);
-
- perm_string = "N";
- perm_string += slam_perm ? "*: " : ": ";
- perm_string += mask_to_string(next_owner_mask);
- getChild<LLUICtrl>("NextMaskDebug")->setValue(perm_string);
- }
- else
- {
+
+ BOOL slam_perm = FALSE;
+ BOOL overwrite_group = FALSE;
+ BOOL overwrite_everyone = FALSE;
+
+ if (item->getType() == LLAssetType::AT_OBJECT)
+ {
+ U32 flags = item->getFlags();
+ slam_perm = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
+ overwrite_everyone = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
+ overwrite_group = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
+ }
+
+ std::string perm_string;
+
+ perm_string = "B: ";
+ perm_string += mask_to_string(base_mask);
+ getChild<LLUICtrl>("BaseMaskDebug")->setValue(perm_string);
+
+ perm_string = "O: ";
+ perm_string += mask_to_string(owner_mask);
+ getChild<LLUICtrl>("OwnerMaskDebug")->setValue(perm_string);
+
+ perm_string = "G";
+ perm_string += overwrite_group ? "*: " : ": ";
+ perm_string += mask_to_string(group_mask);
+ getChild<LLUICtrl>("GroupMaskDebug")->setValue(perm_string);
+
+ perm_string = "E";
+ perm_string += overwrite_everyone ? "*: " : ": ";
+ perm_string += mask_to_string(everyone_mask);
+ getChild<LLUICtrl>("EveryoneMaskDebug")->setValue(perm_string);
+
+ perm_string = "N";
+ perm_string += slam_perm ? "*: " : ": ";
+ perm_string += mask_to_string(next_owner_mask);
+ getChild<LLUICtrl>("NextMaskDebug")->setValue(perm_string);
+ }
+ else
+ {
childSetVisible("layout_debug_permissions", false);
- }
-
- /////////////
- // SHARING //
- /////////////
-
- // Check for ability to change values.
- if (is_link || cannot_restrict_permissions)
- {
- getChildView("CheckShareWithGroup")->setEnabled(FALSE);
- getChildView("CheckEveryoneCopy")->setEnabled(FALSE);
- }
- else if (is_obj_modify && can_agent_manipulate)
- {
- getChildView("CheckShareWithGroup")->setEnabled(TRUE);
- getChildView("CheckEveryoneCopy")->setEnabled((owner_mask & PERM_COPY) && (owner_mask & PERM_TRANSFER));
- }
- else
- {
- getChildView("CheckShareWithGroup")->setEnabled(FALSE);
- getChildView("CheckEveryoneCopy")->setEnabled(FALSE);
- }
-
- // Set values.
- BOOL is_group_copy = (group_mask & PERM_COPY) ? TRUE : FALSE;
- BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE;
- BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE;
-
- if (is_group_copy && is_group_modify && is_group_move)
- {
- getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((BOOL)TRUE));
-
- LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
- if(ctl)
- {
- ctl->setTentative(FALSE);
- }
- }
- else if (!is_group_copy && !is_group_modify && !is_group_move)
- {
- getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((BOOL)FALSE));
- LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
- if(ctl)
- {
- ctl->setTentative(FALSE);
- }
- }
- else
- {
- LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
- if(ctl)
- {
- ctl->setTentative(!ctl->getEnabled());
- ctl->set(TRUE);
- }
- }
-
- getChild<LLUICtrl>("CheckEveryoneCopy")->setValue(LLSD((BOOL)(everyone_mask & PERM_COPY)));
-
- ///////////////
- // SALE INFO //
- ///////////////
-
- const LLSaleInfo& sale_info = item->getSaleInfo();
- BOOL is_for_sale = sale_info.isForSale();
- LLComboBox* combo_sale_type = getChild<LLComboBox>("ComboBoxSaleType");
- LLUICtrl* edit_cost = getChild<LLUICtrl>("Edit Cost");
-
- // Check for ability to change values.
- if (is_obj_modify && can_agent_sell
- && gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE))
- {
- getChildView("CheckPurchase")->setEnabled(is_complete);
-
- getChildView("NextOwnerLabel")->setEnabled(TRUE);
- getChildView("CheckNextOwnerModify")->setEnabled((base_mask & PERM_MODIFY) && !cannot_restrict_permissions);
- getChildView("CheckNextOwnerCopy")->setEnabled((base_mask & PERM_COPY) && !cannot_restrict_permissions && !is_settings);
- getChildView("CheckNextOwnerTransfer")->setEnabled((next_owner_mask & PERM_COPY) && !cannot_restrict_permissions);
-
- combo_sale_type->setEnabled(is_complete && is_for_sale);
- edit_cost->setEnabled(is_complete && is_for_sale);
- }
- else
- {
- getChildView("CheckPurchase")->setEnabled(FALSE);
-
- getChildView("NextOwnerLabel")->setEnabled(FALSE);
- getChildView("CheckNextOwnerModify")->setEnabled(FALSE);
- getChildView("CheckNextOwnerCopy")->setEnabled(FALSE);
- getChildView("CheckNextOwnerTransfer")->setEnabled(FALSE);
-
- combo_sale_type->setEnabled(FALSE);
- edit_cost->setEnabled(FALSE);
- }
+ }
+
+ /////////////
+ // SHARING //
+ /////////////
+
+ // Check for ability to change values.
+ if (is_link || cannot_restrict_permissions)
+ {
+ getChildView("CheckShareWithGroup")->setEnabled(FALSE);
+ getChildView("CheckEveryoneCopy")->setEnabled(FALSE);
+ }
+ else if (is_obj_modify && can_agent_manipulate)
+ {
+ getChildView("CheckShareWithGroup")->setEnabled(TRUE);
+ getChildView("CheckEveryoneCopy")->setEnabled((owner_mask & PERM_COPY) && (owner_mask & PERM_TRANSFER));
+ }
+ else
+ {
+ getChildView("CheckShareWithGroup")->setEnabled(FALSE);
+ getChildView("CheckEveryoneCopy")->setEnabled(FALSE);
+ }
+
+ // Set values.
+ BOOL is_group_copy = (group_mask & PERM_COPY) ? TRUE : FALSE;
+ BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE;
+ BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE;
+
+ if (is_group_copy && is_group_modify && is_group_move)
+ {
+ getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((BOOL)TRUE));
+
+ LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
+ if(ctl)
+ {
+ ctl->setTentative(FALSE);
+ }
+ }
+ else if (!is_group_copy && !is_group_modify && !is_group_move)
+ {
+ getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((BOOL)FALSE));
+ LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
+ if(ctl)
+ {
+ ctl->setTentative(FALSE);
+ }
+ }
+ else
+ {
+ LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
+ if(ctl)
+ {
+ ctl->setTentative(!ctl->getEnabled());
+ ctl->set(TRUE);
+ }
+ }
+
+ getChild<LLUICtrl>("CheckEveryoneCopy")->setValue(LLSD((BOOL)(everyone_mask & PERM_COPY)));
+
+ ///////////////
+ // SALE INFO //
+ ///////////////
+
+ const LLSaleInfo& sale_info = item->getSaleInfo();
+ BOOL is_for_sale = sale_info.isForSale();
+ LLComboBox* combo_sale_type = getChild<LLComboBox>("ComboBoxSaleType");
+ LLUICtrl* edit_cost = getChild<LLUICtrl>("Edit Cost");
+
+ // Check for ability to change values.
+ if (is_obj_modify && can_agent_sell
+ && gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE))
+ {
+ getChildView("CheckPurchase")->setEnabled(is_complete);
+
+ getChildView("NextOwnerLabel")->setEnabled(TRUE);
+ getChildView("CheckNextOwnerModify")->setEnabled((base_mask & PERM_MODIFY) && !cannot_restrict_permissions);
+ getChildView("CheckNextOwnerCopy")->setEnabled((base_mask & PERM_COPY) && !cannot_restrict_permissions && !is_settings);
+ getChildView("CheckNextOwnerTransfer")->setEnabled((next_owner_mask & PERM_COPY) && !cannot_restrict_permissions);
+
+ combo_sale_type->setEnabled(is_complete && is_for_sale);
+ edit_cost->setEnabled(is_complete && is_for_sale);
+ }
+ else
+ {
+ getChildView("CheckPurchase")->setEnabled(FALSE);
+
+ getChildView("NextOwnerLabel")->setEnabled(FALSE);
+ getChildView("CheckNextOwnerModify")->setEnabled(FALSE);
+ getChildView("CheckNextOwnerCopy")->setEnabled(FALSE);
+ getChildView("CheckNextOwnerTransfer")->setEnabled(FALSE);
+
+ combo_sale_type->setEnabled(FALSE);
+ edit_cost->setEnabled(FALSE);
+ }
// Hide any properties that are not relevant to settings
if (is_settings)
@@ -723,24 +723,24 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
getChild<LLUICtrl>("Edit Cost")->setVisible(false);
}
- // Set values.
- getChild<LLUICtrl>("CheckPurchase")->setValue(is_for_sale);
- getChild<LLUICtrl>("CheckNextOwnerModify")->setValue(LLSD(BOOL(next_owner_mask & PERM_MODIFY)));
- getChild<LLUICtrl>("CheckNextOwnerCopy")->setValue(LLSD(BOOL(next_owner_mask & PERM_COPY)));
- getChild<LLUICtrl>("CheckNextOwnerTransfer")->setValue(LLSD(BOOL(next_owner_mask & PERM_TRANSFER)));
-
- if (is_for_sale)
- {
- S32 numerical_price;
- numerical_price = sale_info.getSalePrice();
- edit_cost->setValue(llformat("%d",numerical_price));
- combo_sale_type->setValue(sale_info.getSaleType());
- }
- else
- {
- edit_cost->setValue(llformat("%d",0));
- combo_sale_type->setValue(LLSaleInfo::FS_COPY);
- }
+ // Set values.
+ getChild<LLUICtrl>("CheckPurchase")->setValue(is_for_sale);
+ getChild<LLUICtrl>("CheckNextOwnerModify")->setValue(LLSD(BOOL(next_owner_mask & PERM_MODIFY)));
+ getChild<LLUICtrl>("CheckNextOwnerCopy")->setValue(LLSD(BOOL(next_owner_mask & PERM_COPY)));
+ getChild<LLUICtrl>("CheckNextOwnerTransfer")->setValue(LLSD(BOOL(next_owner_mask & PERM_TRANSFER)));
+
+ if (is_for_sale)
+ {
+ S32 numerical_price;
+ numerical_price = sale_info.getSalePrice();
+ edit_cost->setValue(llformat("%d",numerical_price));
+ combo_sale_type->setValue(sale_info.getSaleType());
+ }
+ else
+ {
+ edit_cost->setValue(llformat("%d",0));
+ combo_sale_type->setValue(LLSaleInfo::FS_COPY);
+ }
}
void LLSidepanelItemInfo::updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params)
@@ -771,7 +771,7 @@ void LLSidepanelItemInfo::changed(U32 mask)
// Task inventory or not set up yet
return;
}
-
+
const std::set<LLUUID>& mChangedItemIDs = gInventory.getChangedIDs();
std::set<LLUUID>::const_iterator it;
@@ -818,7 +818,7 @@ void LLSidepanelItemInfo::setAssociatedExperience( LLHandle<LLSidepanelItemInfo>
}
if(id.notNull())
{
- info->getChild<LLTextBox>("LabelItemExperience")->setText(LLSLURL("experience", id, "profile").getSLURLString());
+ info->getChild<LLTextBox>("LabelItemExperience")->setText(LLSLURL("experience", id, "profile").getSLURLString());
}
else
{
@@ -830,29 +830,29 @@ void LLSidepanelItemInfo::setAssociatedExperience( LLHandle<LLSidepanelItemInfo>
void LLSidepanelItemInfo::startObjectInventoryObserver()
{
- if (!mObjectInventoryObserver)
- {
- stopObjectInventoryObserver();
+ if (!mObjectInventoryObserver)
+ {
+ stopObjectInventoryObserver();
- // Previous object observer should be removed before starting to observe a new object.
- llassert(mObjectInventoryObserver == NULL);
- }
+ // Previous object observer should be removed before starting to observe a new object.
+ llassert(mObjectInventoryObserver == NULL);
+ }
- if (mObjectID.isNull())
- {
- LL_WARNS() << "Empty object id passed to inventory observer" << LL_ENDL;
- return;
- }
+ if (mObjectID.isNull())
+ {
+ LL_WARNS() << "Empty object id passed to inventory observer" << LL_ENDL;
+ return;
+ }
- LLViewerObject* object = gObjectList.findObject(mObjectID);
+ LLViewerObject* object = gObjectList.findObject(mObjectID);
- mObjectInventoryObserver = new LLObjectInventoryObserver(this, object);
+ mObjectInventoryObserver = new LLObjectInventoryObserver(this, object);
}
void LLSidepanelItemInfo::stopObjectInventoryObserver()
{
- delete mObjectInventoryObserver;
- mObjectInventoryObserver = NULL;
+ delete mObjectInventoryObserver;
+ mObjectInventoryObserver = NULL;
}
void LLSidepanelItemInfo::setPropertiesFieldsEnabled(bool enabled)
@@ -877,69 +877,69 @@ void LLSidepanelItemInfo::setPropertiesFieldsEnabled(bool enabled)
void LLSidepanelItemInfo::onClickCreator()
{
- LLViewerInventoryItem* item = findItem();
- if(!item) return;
- if(!item->getCreatorUUID().isNull())
- {
- LLAvatarActions::showProfile(item->getCreatorUUID());
- }
+ LLViewerInventoryItem* item = findItem();
+ if(!item) return;
+ if(!item->getCreatorUUID().isNull())
+ {
+ LLAvatarActions::showProfile(item->getCreatorUUID());
+ }
}
// static
void LLSidepanelItemInfo::onClickOwner()
{
- LLViewerInventoryItem* item = findItem();
- if(!item) return;
- if(item->getPermissions().isGroupOwned())
- {
- LLGroupActions::show(item->getPermissions().getGroup());
- }
- else
- {
- LLAvatarActions::showProfile(item->getPermissions().getOwner());
- }
+ LLViewerInventoryItem* item = findItem();
+ if(!item) return;
+ if(item->getPermissions().isGroupOwned())
+ {
+ LLGroupActions::show(item->getPermissions().getGroup());
+ }
+ else
+ {
+ LLAvatarActions::showProfile(item->getPermissions().getOwner());
+ }
}
// static
void LLSidepanelItemInfo::onCommitName()
{
- //LL_INFOS() << "LLSidepanelItemInfo::onCommitName()" << LL_ENDL;
- LLViewerInventoryItem* item = findItem();
- if(!item)
- {
- return;
- }
- LLLineEditor* labelItemName = getChild<LLLineEditor>("LabelItemName");
-
- if(labelItemName&&
- (item->getName() != labelItemName->getText()) &&
- (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) )
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->rename(labelItemName->getText());
- onCommitChanges(new_item);
- }
+ //LL_INFOS() << "LLSidepanelItemInfo::onCommitName()" << LL_ENDL;
+ LLViewerInventoryItem* item = findItem();
+ if(!item)
+ {
+ return;
+ }
+ LLLineEditor* labelItemName = getChild<LLLineEditor>("LabelItemName");
+
+ if(labelItemName&&
+ (item->getName() != labelItemName->getText()) &&
+ (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) )
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->rename(labelItemName->getText());
+ onCommitChanges(new_item);
+ }
}
void LLSidepanelItemInfo::onCommitDescription()
{
- //LL_INFOS() << "LLSidepanelItemInfo::onCommitDescription()" << LL_ENDL;
- LLViewerInventoryItem* item = findItem();
- if(!item) return;
+ //LL_INFOS() << "LLSidepanelItemInfo::onCommitDescription()" << LL_ENDL;
+ LLViewerInventoryItem* item = findItem();
+ if(!item) return;
LLTextEditor* labelItemDesc = getChild<LLTextEditor>("LabelItemDesc");
- if(!labelItemDesc)
- {
- return;
- }
- if((item->getDescription() != labelItemDesc->getText()) &&
- (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)))
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
-
- new_item->setDescription(labelItemDesc->getText());
- onCommitChanges(new_item);
- }
+ if(!labelItemDesc)
+ {
+ return;
+ }
+ if((item->getDescription() != labelItemDesc->getText()) &&
+ (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)))
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+
+ new_item->setDescription(labelItemDesc->getText());
+ onCommitChanges(new_item);
+ }
}
void LLSidepanelItemInfo::onCommitPermissions(LLUICtrl* ctrl)
@@ -954,90 +954,90 @@ void LLSidepanelItemInfo::onCommitPermissions(LLUICtrl* ctrl)
void LLSidepanelItemInfo::updatePermissions()
{
- LLViewerInventoryItem* item = findItem();
- if(!item) return;
-
- BOOL is_group_owned;
- LLUUID owner_id;
- LLUUID group_id;
- LLPermissions perm(item->getPermissions());
- perm.getOwnership(owner_id, is_group_owned);
-
- if (is_group_owned && gAgent.hasPowerInGroup(owner_id, GP_OBJECT_MANIPULATE))
- {
- group_id = owner_id;
- }
-
- LLCheckBoxCtrl* CheckShareWithGroup = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
-
- if(CheckShareWithGroup)
- {
- perm.setGroupBits(gAgent.getID(), group_id,
- CheckShareWithGroup->get(),
- PERM_MODIFY | PERM_MOVE | PERM_COPY);
- }
- LLCheckBoxCtrl* CheckEveryoneCopy = getChild<LLCheckBoxCtrl>("CheckEveryoneCopy");
- if(CheckEveryoneCopy)
- {
- perm.setEveryoneBits(gAgent.getID(), group_id,
- CheckEveryoneCopy->get(), PERM_COPY);
- }
-
- LLCheckBoxCtrl* CheckNextOwnerModify = getChild<LLCheckBoxCtrl>("CheckNextOwnerModify");
- if(CheckNextOwnerModify)
- {
- perm.setNextOwnerBits(gAgent.getID(), group_id,
- CheckNextOwnerModify->get(), PERM_MODIFY);
- }
- LLCheckBoxCtrl* CheckNextOwnerCopy = getChild<LLCheckBoxCtrl>("CheckNextOwnerCopy");
- if(CheckNextOwnerCopy)
- {
- perm.setNextOwnerBits(gAgent.getID(), group_id,
- CheckNextOwnerCopy->get(), PERM_COPY);
- }
- LLCheckBoxCtrl* CheckNextOwnerTransfer = getChild<LLCheckBoxCtrl>("CheckNextOwnerTransfer");
- if(CheckNextOwnerTransfer)
- {
- perm.setNextOwnerBits(gAgent.getID(), group_id,
- CheckNextOwnerTransfer->get(), PERM_TRANSFER);
- }
- if(perm != item->getPermissions()
- && item->isFinished())
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setPermissions(perm);
- U32 flags = new_item->getFlags();
- // If next owner permissions have changed (and this is an object)
- // then set the slam permissions flag so that they are applied on rez.
- if((perm.getMaskNextOwner()!=item->getPermissions().getMaskNextOwner())
- && (item->getType() == LLAssetType::AT_OBJECT))
- {
- flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
- }
- // If everyone permissions have changed (and this is an object)
- // then set the overwrite everyone permissions flag so they
- // are applied on rez.
- if ((perm.getMaskEveryone()!=item->getPermissions().getMaskEveryone())
- && (item->getType() == LLAssetType::AT_OBJECT))
- {
- flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
- }
- // If group permissions have changed (and this is an object)
- // then set the overwrite group permissions flag so they
- // are applied on rez.
- if ((perm.getMaskGroup()!=item->getPermissions().getMaskGroup())
- && (item->getType() == LLAssetType::AT_OBJECT))
- {
- flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
- }
- new_item->setFlags(flags);
- onCommitChanges(new_item);
- }
- else
- {
- // need to make sure we don't just follow the click
- refresh();
- }
+ LLViewerInventoryItem* item = findItem();
+ if(!item) return;
+
+ BOOL is_group_owned;
+ LLUUID owner_id;
+ LLUUID group_id;
+ LLPermissions perm(item->getPermissions());
+ perm.getOwnership(owner_id, is_group_owned);
+
+ if (is_group_owned && gAgent.hasPowerInGroup(owner_id, GP_OBJECT_MANIPULATE))
+ {
+ group_id = owner_id;
+ }
+
+ LLCheckBoxCtrl* CheckShareWithGroup = getChild<LLCheckBoxCtrl>("CheckShareWithGroup");
+
+ if(CheckShareWithGroup)
+ {
+ perm.setGroupBits(gAgent.getID(), group_id,
+ CheckShareWithGroup->get(),
+ PERM_MODIFY | PERM_MOVE | PERM_COPY);
+ }
+ LLCheckBoxCtrl* CheckEveryoneCopy = getChild<LLCheckBoxCtrl>("CheckEveryoneCopy");
+ if(CheckEveryoneCopy)
+ {
+ perm.setEveryoneBits(gAgent.getID(), group_id,
+ CheckEveryoneCopy->get(), PERM_COPY);
+ }
+
+ LLCheckBoxCtrl* CheckNextOwnerModify = getChild<LLCheckBoxCtrl>("CheckNextOwnerModify");
+ if(CheckNextOwnerModify)
+ {
+ perm.setNextOwnerBits(gAgent.getID(), group_id,
+ CheckNextOwnerModify->get(), PERM_MODIFY);
+ }
+ LLCheckBoxCtrl* CheckNextOwnerCopy = getChild<LLCheckBoxCtrl>("CheckNextOwnerCopy");
+ if(CheckNextOwnerCopy)
+ {
+ perm.setNextOwnerBits(gAgent.getID(), group_id,
+ CheckNextOwnerCopy->get(), PERM_COPY);
+ }
+ LLCheckBoxCtrl* CheckNextOwnerTransfer = getChild<LLCheckBoxCtrl>("CheckNextOwnerTransfer");
+ if(CheckNextOwnerTransfer)
+ {
+ perm.setNextOwnerBits(gAgent.getID(), group_id,
+ CheckNextOwnerTransfer->get(), PERM_TRANSFER);
+ }
+ if(perm != item->getPermissions()
+ && item->isFinished())
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setPermissions(perm);
+ U32 flags = new_item->getFlags();
+ // If next owner permissions have changed (and this is an object)
+ // then set the slam permissions flag so that they are applied on rez.
+ if((perm.getMaskNextOwner()!=item->getPermissions().getMaskNextOwner())
+ && (item->getType() == LLAssetType::AT_OBJECT))
+ {
+ flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
+ }
+ // If everyone permissions have changed (and this is an object)
+ // then set the overwrite everyone permissions flag so they
+ // are applied on rez.
+ if ((perm.getMaskEveryone()!=item->getPermissions().getMaskEveryone())
+ && (item->getType() == LLAssetType::AT_OBJECT))
+ {
+ flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
+ }
+ // If group permissions have changed (and this is an object)
+ // then set the overwrite group permissions flag so they
+ // are applied on rez.
+ if ((perm.getMaskGroup()!=item->getPermissions().getMaskGroup())
+ && (item->getType() == LLAssetType::AT_OBJECT))
+ {
+ flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
+ }
+ new_item->setFlags(flags);
+ onCommitChanges(new_item);
+ }
+ else
+ {
+ // need to make sure we don't just follow the click
+ refresh();
+ }
}
void LLSidepanelItemInfo::onEditThumbnail()
@@ -1055,78 +1055,78 @@ void LLSidepanelItemInfo::onCommitSaleInfo(LLUICtrl* ctrl)
// will be enabled by response from server
ctrl->setEnabled(false);
}
- //LL_INFOS() << "LLSidepanelItemInfo::onCommitSaleInfo()" << LL_ENDL;
- updateSaleInfo();
+ //LL_INFOS() << "LLSidepanelItemInfo::onCommitSaleInfo()" << LL_ENDL;
+ updateSaleInfo();
}
void LLSidepanelItemInfo::updateSaleInfo()
{
- LLViewerInventoryItem* item = findItem();
- if(!item) return;
- LLSaleInfo sale_info(item->getSaleInfo());
- if(!gAgent.allowOperation(PERM_TRANSFER, item->getPermissions(), GP_OBJECT_SET_SALE))
- {
- getChild<LLUICtrl>("CheckPurchase")->setValue(LLSD((BOOL)FALSE));
- }
-
- if((BOOL)getChild<LLUICtrl>("CheckPurchase")->getValue())
- {
- // turn on sale info
- LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_COPY;
-
- LLComboBox* combo_sale_type = getChild<LLComboBox>("ComboBoxSaleType");
- if (combo_sale_type)
- {
- sale_type = static_cast<LLSaleInfo::EForSale>(combo_sale_type->getValue().asInteger());
- }
-
- if (sale_type == LLSaleInfo::FS_COPY
- && !gAgent.allowOperation(PERM_COPY, item->getPermissions(),
- GP_OBJECT_SET_SALE))
- {
- sale_type = LLSaleInfo::FS_ORIGINAL;
- }
-
-
-
- S32 price = -1;
- price = getChild<LLUICtrl>("Edit Cost")->getValue().asInteger();;
-
- // Invalid data - turn off the sale
- if (price < 0)
- {
- sale_type = LLSaleInfo::FS_NOT;
- price = 0;
- }
-
- sale_info.setSaleType(sale_type);
- sale_info.setSalePrice(price);
- }
- else
- {
- sale_info.setSaleType(LLSaleInfo::FS_NOT);
- }
- if(sale_info != item->getSaleInfo()
- && item->isFinished())
- {
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
-
- // Force an update on the sale price at rez
- if (item->getType() == LLAssetType::AT_OBJECT)
- {
- U32 flags = new_item->getFlags();
- flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE;
- new_item->setFlags(flags);
- }
-
- new_item->setSaleInfo(sale_info);
- onCommitChanges(new_item);
- }
- else
- {
- // need to make sure we don't just follow the click
- refresh();
- }
+ LLViewerInventoryItem* item = findItem();
+ if(!item) return;
+ LLSaleInfo sale_info(item->getSaleInfo());
+ if(!gAgent.allowOperation(PERM_TRANSFER, item->getPermissions(), GP_OBJECT_SET_SALE))
+ {
+ getChild<LLUICtrl>("CheckPurchase")->setValue(LLSD((BOOL)FALSE));
+ }
+
+ if((BOOL)getChild<LLUICtrl>("CheckPurchase")->getValue())
+ {
+ // turn on sale info
+ LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_COPY;
+
+ LLComboBox* combo_sale_type = getChild<LLComboBox>("ComboBoxSaleType");
+ if (combo_sale_type)
+ {
+ sale_type = static_cast<LLSaleInfo::EForSale>(combo_sale_type->getValue().asInteger());
+ }
+
+ if (sale_type == LLSaleInfo::FS_COPY
+ && !gAgent.allowOperation(PERM_COPY, item->getPermissions(),
+ GP_OBJECT_SET_SALE))
+ {
+ sale_type = LLSaleInfo::FS_ORIGINAL;
+ }
+
+
+
+ S32 price = -1;
+ price = getChild<LLUICtrl>("Edit Cost")->getValue().asInteger();;
+
+ // Invalid data - turn off the sale
+ if (price < 0)
+ {
+ sale_type = LLSaleInfo::FS_NOT;
+ price = 0;
+ }
+
+ sale_info.setSaleType(sale_type);
+ sale_info.setSalePrice(price);
+ }
+ else
+ {
+ sale_info.setSaleType(LLSaleInfo::FS_NOT);
+ }
+ if(sale_info != item->getSaleInfo()
+ && item->isFinished())
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+
+ // Force an update on the sale price at rez
+ if (item->getType() == LLAssetType::AT_OBJECT)
+ {
+ U32 flags = new_item->getFlags();
+ flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE;
+ new_item->setFlags(flags);
+ }
+
+ new_item->setSaleInfo(sale_info);
+ onCommitChanges(new_item);
+ }
+ else
+ {
+ // need to make sure we don't just follow the click
+ refresh();
+ }
}
void LLSidepanelItemInfo::onCommitChanges(LLPointer<LLViewerInventoryItem> item)
@@ -1176,28 +1176,28 @@ void LLSidepanelItemInfo::onCommitChanges(LLPointer<LLViewerInventoryItem> item)
LLViewerInventoryItem* LLSidepanelItemInfo::findItem() const
{
- LLViewerInventoryItem* item = NULL;
- if(mObjectID.isNull())
- {
- // it is in agent inventory
- item = gInventory.getItem(mItemID);
- }
- else
- {
- LLViewerObject* object = gObjectList.findObject(mObjectID);
- if(object)
- {
- item = static_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemID));
- }
- }
- return item;
+ LLViewerInventoryItem* item = NULL;
+ if(mObjectID.isNull())
+ {
+ // it is in agent inventory
+ item = gInventory.getItem(mItemID);
+ }
+ else
+ {
+ LLViewerObject* object = gObjectList.findObject(mObjectID);
+ if(object)
+ {
+ item = static_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemID));
+ }
+ }
+ return item;
}
// virtual
void LLSidepanelItemInfo::save()
{
- onCommitName();
- onCommitDescription();
- updatePermissions();
- updateSaleInfo();
+ onCommitName();
+ onCommitDescription();
+ updatePermissions();
+ updateSaleInfo();
}
diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h
index b916f44520..45709b82f3 100644
--- a/indra/newview/llsidepaneliteminfo.h
+++ b/indra/newview/llsidepaneliteminfo.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsidepaneliteminfo.h
* @brief A panel which shows an inventory item's properties.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,54 +50,54 @@ class LLTextBox;
class LLSidepanelItemInfo : public LLPanel, public LLInventoryObserver
{
public:
- LLSidepanelItemInfo(const LLPanel::Params& p = getDefaultParams());
- virtual ~LLSidepanelItemInfo();
-
- /*virtual*/ BOOL postBuild() override;
- /*virtual*/ void reset();
-
- void setObjectID(const LLUUID& object_id);
- void setItemID(const LLUUID& item_id);
+ LLSidepanelItemInfo(const LLPanel::Params& p = getDefaultParams());
+ virtual ~LLSidepanelItemInfo();
+
+ /*virtual*/ BOOL postBuild() override;
+ /*virtual*/ void reset();
+
+ void setObjectID(const LLUUID& object_id);
+ void setItemID(const LLUUID& item_id);
void setParentFloater(LLFloater* parent); // For simplicity
- const LLUUID& getObjectID() const;
- const LLUUID& getItemID() const;
+ const LLUUID& getObjectID() const;
+ const LLUUID& getItemID() const;
+
+ // if received update and item id (from callback) matches internal ones, update UI
+ void onUpdateCallback(const LLUUID& item_id, S32 received_update_id);
- // if received update and item id (from callback) matches internal ones, update UI
- void onUpdateCallback(const LLUUID& item_id, S32 received_update_id);
-
void changed(U32 mask) override;
void dirty();
-
+
static void onIdle( void* user_data );
void updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params);
void updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params);
protected:
- void refresh() override;
- void save();
+ void refresh() override;
+ void save();
- LLViewerInventoryItem* findItem() const;
- LLViewerObject* findObject() const;
-
- void refreshFromItem(LLViewerInventoryItem* item);
+ LLViewerInventoryItem* findItem() const;
+ LLViewerObject* findObject() const;
+
+ void refreshFromItem(LLViewerInventoryItem* item);
private:
static void setAssociatedExperience( LLHandle<LLSidepanelItemInfo> hInfo, const LLSD& experience );
- void startObjectInventoryObserver();
- void stopObjectInventoryObserver();
- void setPropertiesFieldsEnabled(bool enabled);
-
+ void startObjectInventoryObserver();
+ void stopObjectInventoryObserver();
+ void setPropertiesFieldsEnabled(bool enabled);
+
boost::signals2::connection mOwnerCacheConnection;
boost::signals2::connection mCreatorCacheConnection;
- LLUUID mItemID; // inventory UUID for the inventory item.
- LLUUID mObjectID; // in-world task UUID, or null if in agent inventory.
- LLObjectInventoryObserver* mObjectInventoryObserver; // for syncing changes to items inside an object
+ LLUUID mItemID; // inventory UUID for the inventory item.
+ LLUUID mObjectID; // in-world task UUID, or null if in agent inventory.
+ LLObjectInventoryObserver* mObjectInventoryObserver; // for syncing changes to items inside an object
- // We can send multiple properties updates simultaneously, make sure only last response counts and there won't be a race condition.
- S32 mUpdatePendingId;
+ // We can send multiple properties updates simultaneously, make sure only last response counts and there won't be a race condition.
+ S32 mUpdatePendingId;
bool mIsDirty; // item properties need to be updated
LLFloater* mParentFloater;
@@ -106,20 +106,20 @@ private:
LLTextBox* mLabelOwnerName;
LLTextBox* mLabelCreatorName;
- //
- // UI Elements
- //
+ //
+ // UI Elements
+ //
protected:
- void onClickCreator();
- void onClickOwner();
- void onCommitName();
- void onCommitDescription();
- void onCommitPermissions(LLUICtrl* ctrl);
- void updatePermissions();
- void onEditThumbnail();
- void onCommitSaleInfo(LLUICtrl* ctrl);
- void updateSaleInfo();
- void onCommitChanges(LLPointer<LLViewerInventoryItem> item);
+ void onClickCreator();
+ void onClickOwner();
+ void onCommitName();
+ void onCommitDescription();
+ void onCommitPermissions(LLUICtrl* ctrl);
+ void updatePermissions();
+ void onEditThumbnail();
+ void onCommitSaleInfo(LLUICtrl* ctrl);
+ void updateSaleInfo();
+ void onCommitChanges(LLPointer<LLViewerInventoryItem> item);
};
#endif // LL_LLSIDEPANELITEMINFO_H
diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp
index fe61b7a02a..23c95ee143 100644
--- a/indra/newview/llsidepaneltaskinfo.cpp
+++ b/indra/newview/llsidepaneltaskinfo.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsidepaneltaskinfo.cpp
* @brief LLSidepanelTaskInfo class implementation
* This class represents the panel in the build view for
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,7 +47,7 @@
#include "llviewerobject.h"
#include "llselectmgr.h"
#include "llagent.h"
-#include "llstatusbar.h" // for getBalance()
+#include "llstatusbar.h" // for getBalance()
#include "lllineeditor.h"
#include "llcombobox.h"
#include "lluiconstants.h"
@@ -78,7 +78,7 @@ static LLPanelInjector<LLSidepanelTaskInfo> t_task_info("sidepanel_task_info");
LLSidepanelTaskInfo::LLSidepanelTaskInfo()
: mVisibleDebugPermissions(true) // space was allocated by default
{
- setMouseOpaque(FALSE);
+ setMouseOpaque(FALSE);
mSelectionUpdateSlot = LLSelectMgr::instance().mUpdateSignal.connect(boost::bind(&LLSidepanelTaskInfo::refreshAll, this));
gIdleCallbacks.addFunction(&LLSidepanelTaskInfo::onIdle, (void*)this);
}
@@ -86,8 +86,8 @@ LLSidepanelTaskInfo::LLSidepanelTaskInfo()
LLSidepanelTaskInfo::~LLSidepanelTaskInfo()
{
- if (sActivePanel == this)
- sActivePanel = NULL;
+ if (sActivePanel == this)
+ sActivePanel = NULL;
gIdleCallbacks.deleteFunction(&LLSidepanelTaskInfo::onIdle, (void*)this);
if (mSelectionUpdateSlot.connected())
@@ -99,114 +99,114 @@ LLSidepanelTaskInfo::~LLSidepanelTaskInfo()
// virtual
BOOL LLSidepanelTaskInfo::postBuild()
{
- mOpenBtn = getChild<LLButton>("open_btn");
- mOpenBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onOpenButtonClicked, this));
- mPayBtn = getChild<LLButton>("pay_btn");
- mPayBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onPayButtonClicked, this));
- mBuyBtn = getChild<LLButton>("buy_btn");
- mBuyBtn->setClickedCallback(boost::bind(&handle_buy));
- mDetailsBtn = getChild<LLButton>("details_btn");
- mDetailsBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onDetailsButtonClicked, this));
-
- mDeedBtn = getChild<LLButton>("button deed");
-
- mLabelGroupName = getChild<LLNameBox>("Group Name Proxy");
-
- childSetCommitCallback("Object Name", LLSidepanelTaskInfo::onCommitName,this);
- getChild<LLLineEditor>("Object Name")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
- childSetCommitCallback("Object Description", LLSidepanelTaskInfo::onCommitDesc,this);
- getChild<LLLineEditor>("Object Description")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
- getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLSidepanelTaskInfo::onClickGroup,this));
- childSetCommitCallback("checkbox share with group", &LLSidepanelTaskInfo::onCommitGroupShare,this);
- childSetAction("button deed", &LLSidepanelTaskInfo::onClickDeedToGroup,this);
- childSetCommitCallback("checkbox allow everyone move", &LLSidepanelTaskInfo::onCommitEveryoneMove,this);
- childSetCommitCallback("checkbox allow everyone copy", &LLSidepanelTaskInfo::onCommitEveryoneCopy,this);
- childSetCommitCallback("checkbox for sale", &LLSidepanelTaskInfo::onCommitSaleInfo,this);
- childSetCommitCallback("sale type", &LLSidepanelTaskInfo::onCommitSaleType,this);
- childSetCommitCallback("Edit Cost", &LLSidepanelTaskInfo::onCommitSaleInfo, this);
- childSetCommitCallback("checkbox next owner can modify", &LLSidepanelTaskInfo::onCommitNextOwnerModify,this);
- childSetCommitCallback("checkbox next owner can copy", &LLSidepanelTaskInfo::onCommitNextOwnerCopy,this);
- childSetCommitCallback("checkbox next owner can transfer", &LLSidepanelTaskInfo::onCommitNextOwnerTransfer,this);
- childSetCommitCallback("clickaction", &LLSidepanelTaskInfo::onCommitClickAction,this);
- childSetCommitCallback("search_check", &LLSidepanelTaskInfo::onCommitIncludeInSearch,this);
-
- mDAPermModify = getChild<LLUICtrl>("perm_modify");
- mDACreatorName = getChild<LLUICtrl>("Creator Name");
- mDAOwner = getChildView("Owner:");
- mDAOwnerName = getChild<LLUICtrl>("Owner Name");
- mDAButtonSetGroup = getChildView("button set group");
- mDAObjectName = getChild<LLUICtrl>("Object Name");
- mDAName = getChildView("Name:");
- mDADescription = getChildView("Description:");
- mDAObjectDescription = getChild<LLUICtrl>("Object Description");
- mDACheckboxShareWithGroup = getChild<LLUICtrl>("checkbox share with group");
- mDAButtonDeed = getChildView("button deed");
- mDACheckboxAllowEveryoneMove = getChild<LLUICtrl>("checkbox allow everyone move");
- mDACheckboxAllowEveryoneCopy = getChild<LLUICtrl>("checkbox allow everyone copy");
- mDACheckboxNextOwnerCanModify = getChild<LLUICtrl>("checkbox next owner can modify");
- mDACheckboxNextOwnerCanCopy = getChild<LLUICtrl>("checkbox next owner can copy");
- mDACheckboxNextOwnerCanTransfer = getChild<LLUICtrl>("checkbox next owner can transfer");
- mDACheckboxForSale = getChild<LLUICtrl>("checkbox for sale");
- mDASearchCheck = getChild<LLUICtrl>("search_check");
- mDAComboSaleType = getChild<LLComboBox>("sale type");
- mDAEditCost = getChild<LLUICtrl>("Edit Cost");
- mDALabelClickAction = getChildView("label click action");
- mDAComboClickAction = getChild<LLComboBox>("clickaction");
- mDAPathfindingAttributes = getChild<LLTextBase>("pathfinding_attributes_value");
- mDAB = getChild<LLUICtrl>("B:");
- mDAO = getChild<LLUICtrl>("O:");
- mDAG = getChild<LLUICtrl>("G:");
- mDAE = getChild<LLUICtrl>("E:");
- mDAN = getChild<LLUICtrl>("N:");
- mDAF = getChild<LLUICtrl>("F:");
-
- return TRUE;
+ mOpenBtn = getChild<LLButton>("open_btn");
+ mOpenBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onOpenButtonClicked, this));
+ mPayBtn = getChild<LLButton>("pay_btn");
+ mPayBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onPayButtonClicked, this));
+ mBuyBtn = getChild<LLButton>("buy_btn");
+ mBuyBtn->setClickedCallback(boost::bind(&handle_buy));
+ mDetailsBtn = getChild<LLButton>("details_btn");
+ mDetailsBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onDetailsButtonClicked, this));
+
+ mDeedBtn = getChild<LLButton>("button deed");
+
+ mLabelGroupName = getChild<LLNameBox>("Group Name Proxy");
+
+ childSetCommitCallback("Object Name", LLSidepanelTaskInfo::onCommitName,this);
+ getChild<LLLineEditor>("Object Name")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
+ childSetCommitCallback("Object Description", LLSidepanelTaskInfo::onCommitDesc,this);
+ getChild<LLLineEditor>("Object Description")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
+ getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLSidepanelTaskInfo::onClickGroup,this));
+ childSetCommitCallback("checkbox share with group", &LLSidepanelTaskInfo::onCommitGroupShare,this);
+ childSetAction("button deed", &LLSidepanelTaskInfo::onClickDeedToGroup,this);
+ childSetCommitCallback("checkbox allow everyone move", &LLSidepanelTaskInfo::onCommitEveryoneMove,this);
+ childSetCommitCallback("checkbox allow everyone copy", &LLSidepanelTaskInfo::onCommitEveryoneCopy,this);
+ childSetCommitCallback("checkbox for sale", &LLSidepanelTaskInfo::onCommitSaleInfo,this);
+ childSetCommitCallback("sale type", &LLSidepanelTaskInfo::onCommitSaleType,this);
+ childSetCommitCallback("Edit Cost", &LLSidepanelTaskInfo::onCommitSaleInfo, this);
+ childSetCommitCallback("checkbox next owner can modify", &LLSidepanelTaskInfo::onCommitNextOwnerModify,this);
+ childSetCommitCallback("checkbox next owner can copy", &LLSidepanelTaskInfo::onCommitNextOwnerCopy,this);
+ childSetCommitCallback("checkbox next owner can transfer", &LLSidepanelTaskInfo::onCommitNextOwnerTransfer,this);
+ childSetCommitCallback("clickaction", &LLSidepanelTaskInfo::onCommitClickAction,this);
+ childSetCommitCallback("search_check", &LLSidepanelTaskInfo::onCommitIncludeInSearch,this);
+
+ mDAPermModify = getChild<LLUICtrl>("perm_modify");
+ mDACreatorName = getChild<LLUICtrl>("Creator Name");
+ mDAOwner = getChildView("Owner:");
+ mDAOwnerName = getChild<LLUICtrl>("Owner Name");
+ mDAButtonSetGroup = getChildView("button set group");
+ mDAObjectName = getChild<LLUICtrl>("Object Name");
+ mDAName = getChildView("Name:");
+ mDADescription = getChildView("Description:");
+ mDAObjectDescription = getChild<LLUICtrl>("Object Description");
+ mDACheckboxShareWithGroup = getChild<LLUICtrl>("checkbox share with group");
+ mDAButtonDeed = getChildView("button deed");
+ mDACheckboxAllowEveryoneMove = getChild<LLUICtrl>("checkbox allow everyone move");
+ mDACheckboxAllowEveryoneCopy = getChild<LLUICtrl>("checkbox allow everyone copy");
+ mDACheckboxNextOwnerCanModify = getChild<LLUICtrl>("checkbox next owner can modify");
+ mDACheckboxNextOwnerCanCopy = getChild<LLUICtrl>("checkbox next owner can copy");
+ mDACheckboxNextOwnerCanTransfer = getChild<LLUICtrl>("checkbox next owner can transfer");
+ mDACheckboxForSale = getChild<LLUICtrl>("checkbox for sale");
+ mDASearchCheck = getChild<LLUICtrl>("search_check");
+ mDAComboSaleType = getChild<LLComboBox>("sale type");
+ mDAEditCost = getChild<LLUICtrl>("Edit Cost");
+ mDALabelClickAction = getChildView("label click action");
+ mDAComboClickAction = getChild<LLComboBox>("clickaction");
+ mDAPathfindingAttributes = getChild<LLTextBase>("pathfinding_attributes_value");
+ mDAB = getChild<LLUICtrl>("B:");
+ mDAO = getChild<LLUICtrl>("O:");
+ mDAG = getChild<LLUICtrl>("G:");
+ mDAE = getChild<LLUICtrl>("E:");
+ mDAN = getChild<LLUICtrl>("N:");
+ mDAF = getChild<LLUICtrl>("F:");
+
+ return TRUE;
}
/*virtual*/ void LLSidepanelTaskInfo::onVisibilityChange ( BOOL visible )
{
- if (visible)
- {
- sActivePanel = this;
- mObject = getFirstSelectedObject();
- }
- else
- {
- sActivePanel = NULL;
- // drop selection reference
- mObjectSelection = NULL;
- }
+ if (visible)
+ {
+ sActivePanel = this;
+ mObject = getFirstSelectedObject();
+ }
+ else
+ {
+ sActivePanel = NULL;
+ // drop selection reference
+ mObjectSelection = NULL;
+ }
}
void LLSidepanelTaskInfo::disableAll()
{
- mDACreatorName->setValue(LLStringUtil::null);
- mDACreatorName->setEnabled(FALSE);
+ mDACreatorName->setValue(LLStringUtil::null);
+ mDACreatorName->setEnabled(FALSE);
- mDAOwner->setEnabled(FALSE);
- mDAOwnerName->setValue(LLStringUtil::null);
- mDAOwnerName->setEnabled(FALSE);
+ mDAOwner->setEnabled(FALSE);
+ mDAOwnerName->setValue(LLStringUtil::null);
+ mDAOwnerName->setEnabled(FALSE);
- mDAObjectName->setValue(LLStringUtil::null);
- mDAObjectName->setEnabled(FALSE);
- mDAName->setEnabled(FALSE);
- mDADescription->setEnabled(FALSE);
- mDAObjectDescription->setValue(LLStringUtil::null);
- mDAObjectDescription->setEnabled(FALSE);
+ mDAObjectName->setValue(LLStringUtil::null);
+ mDAObjectName->setEnabled(FALSE);
+ mDAName->setEnabled(FALSE);
+ mDADescription->setEnabled(FALSE);
+ mDAObjectDescription->setValue(LLStringUtil::null);
+ mDAObjectDescription->setEnabled(FALSE);
- mDAPathfindingAttributes->setEnabled(FALSE);
- mDAPathfindingAttributes->setValue(LLStringUtil::null);
+ mDAPathfindingAttributes->setEnabled(FALSE);
+ mDAPathfindingAttributes->setValue(LLStringUtil::null);
- mDAButtonSetGroup->setEnabled(FALSE);
- mDAButtonDeed->setEnabled(FALSE);
+ mDAButtonSetGroup->setEnabled(FALSE);
+ mDAButtonDeed->setEnabled(FALSE);
- mDAPermModify->setEnabled(FALSE);
- mDAPermModify->setValue(LLStringUtil::null);
- mDAEditCost->setValue(LLStringUtil::null);
- mDAComboSaleType->setValue(LLSaleInfo::FS_COPY);
+ mDAPermModify->setEnabled(FALSE);
+ mDAPermModify->setValue(LLStringUtil::null);
+ mDAEditCost->setValue(LLStringUtil::null);
+ mDAComboSaleType->setValue(LLSaleInfo::FS_COPY);
- disablePermissions();
+ disablePermissions();
if (mVisibleDebugPermissions)
{
@@ -225,429 +225,429 @@ void LLSidepanelTaskInfo::disableAll()
mVisibleDebugPermissions = false;
}
- mOpenBtn->setEnabled(FALSE);
- mPayBtn->setEnabled(FALSE);
- mBuyBtn->setEnabled(FALSE);
+ mOpenBtn->setEnabled(FALSE);
+ mPayBtn->setEnabled(FALSE);
+ mBuyBtn->setEnabled(FALSE);
}
void LLSidepanelTaskInfo::disablePermissions()
{
- mDACheckboxShareWithGroup->setValue(FALSE);
- mDACheckboxShareWithGroup->setEnabled(FALSE);
-
- mDACheckboxAllowEveryoneMove->setValue(FALSE);
- mDACheckboxAllowEveryoneMove->setEnabled(FALSE);
- mDACheckboxAllowEveryoneCopy->setValue(FALSE);
- mDACheckboxAllowEveryoneCopy->setEnabled(FALSE);
-
- //Next owner can:
- mDACheckboxNextOwnerCanModify->setValue(FALSE);
- mDACheckboxNextOwnerCanModify->setEnabled(FALSE);
- mDACheckboxNextOwnerCanCopy->setValue(FALSE);
- mDACheckboxNextOwnerCanCopy->setEnabled(FALSE);
- mDACheckboxNextOwnerCanTransfer->setValue(FALSE);
- mDACheckboxNextOwnerCanTransfer->setEnabled(FALSE);
-
- //checkbox for sale
- mDACheckboxForSale->setValue(FALSE);
- mDACheckboxForSale->setEnabled(FALSE);
-
- //checkbox include in search
- mDASearchCheck->setValue(FALSE);
- mDASearchCheck->setEnabled(FALSE);
-
- mDAComboSaleType->setEnabled(FALSE);
-
- mDAEditCost->setEnabled(FALSE);
-
- mDALabelClickAction->setEnabled(FALSE);
- if (mDAComboClickAction)
- {
- mDAComboClickAction->setEnabled(FALSE);
- mDAComboClickAction->clear();
- }
+ mDACheckboxShareWithGroup->setValue(FALSE);
+ mDACheckboxShareWithGroup->setEnabled(FALSE);
+
+ mDACheckboxAllowEveryoneMove->setValue(FALSE);
+ mDACheckboxAllowEveryoneMove->setEnabled(FALSE);
+ mDACheckboxAllowEveryoneCopy->setValue(FALSE);
+ mDACheckboxAllowEveryoneCopy->setEnabled(FALSE);
+
+ //Next owner can:
+ mDACheckboxNextOwnerCanModify->setValue(FALSE);
+ mDACheckboxNextOwnerCanModify->setEnabled(FALSE);
+ mDACheckboxNextOwnerCanCopy->setValue(FALSE);
+ mDACheckboxNextOwnerCanCopy->setEnabled(FALSE);
+ mDACheckboxNextOwnerCanTransfer->setValue(FALSE);
+ mDACheckboxNextOwnerCanTransfer->setEnabled(FALSE);
+
+ //checkbox for sale
+ mDACheckboxForSale->setValue(FALSE);
+ mDACheckboxForSale->setEnabled(FALSE);
+
+ //checkbox include in search
+ mDASearchCheck->setValue(FALSE);
+ mDASearchCheck->setEnabled(FALSE);
+
+ mDAComboSaleType->setEnabled(FALSE);
+
+ mDAEditCost->setEnabled(FALSE);
+
+ mDALabelClickAction->setEnabled(FALSE);
+ if (mDAComboClickAction)
+ {
+ mDAComboClickAction->setEnabled(FALSE);
+ mDAComboClickAction->clear();
+ }
}
void LLSidepanelTaskInfo::refresh()
{
mIsDirty = false;
-
- LLButton* btn_deed_to_group = mDeedBtn;
- if (btn_deed_to_group)
- {
- std::string deedText;
- if (gWarningSettings.getBOOL("DeedObject"))
- {
- deedText = getString("text deed continued");
- }
- else
- {
- deedText = getString("text deed");
- }
- btn_deed_to_group->setLabelSelected(deedText);
- btn_deed_to_group->setLabelUnselected(deedText);
- }
-
- BOOL root_selected = TRUE;
- LLSelectNode* nodep = mObjectSelection->getFirstRootNode();
- S32 object_count = mObjectSelection->getRootObjectCount();
- if (!nodep || (object_count == 0))
- {
- nodep = mObjectSelection->getFirstNode();
- object_count = mObjectSelection->getObjectCount();
- root_selected = FALSE;
- }
-
- LLViewerObject* objectp = NULL;
- if (nodep)
- {
- objectp = nodep->getObject();
- }
-
- // ...nothing selected
- if (!nodep || !objectp)
- {
- disableAll();
- return;
- }
-
- // figure out a few variables
- const BOOL is_one_object = (object_count == 1);
-
- // BUG: fails if a root and non-root are both single-selected.
- const BOOL is_perm_modify = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) ||
- LLSelectMgr::getInstance()->selectGetModify();
- const BOOL is_nonpermanent_enforced = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) ||
- LLSelectMgr::getInstance()->selectGetNonPermanentEnforced();
-
- S32 string_index = 0;
- std::string MODIFY_INFO_STRINGS[] =
- {
- getString("text modify info 1"),
- getString("text modify info 2"),
- getString("text modify info 3"),
- getString("text modify info 4"),
- getString("text modify info 5"),
- getString("text modify info 6")
- };
- if (!is_perm_modify)
- {
- string_index += 2;
- }
- else if (!is_nonpermanent_enforced)
- {
- string_index += 4;
- }
- if (!is_one_object)
- {
- ++string_index;
- }
- getChildView("perm_modify")->setEnabled(TRUE);
- getChild<LLUICtrl>("perm_modify")->setValue(MODIFY_INFO_STRINGS[string_index]);
-
- std::string pfAttrName;
-
- if ((mObjectSelection->getFirstRootNode()
- && LLSelectMgr::getInstance()->selectGetRootsNonPathfinding())
- || LLSelectMgr::getInstance()->selectGetNonPathfinding())
- {
- pfAttrName = "Pathfinding_Object_Attr_None";
- }
- else if ((mObjectSelection->getFirstRootNode()
- && LLSelectMgr::getInstance()->selectGetRootsPermanent())
- || LLSelectMgr::getInstance()->selectGetPermanent())
- {
- pfAttrName = "Pathfinding_Object_Attr_Permanent";
- }
- else if ((mObjectSelection->getFirstRootNode()
- && LLSelectMgr::getInstance()->selectGetRootsCharacter())
- || LLSelectMgr::getInstance()->selectGetCharacter())
- {
- pfAttrName = "Pathfinding_Object_Attr_Character";
- }
- else
- {
- pfAttrName = "Pathfinding_Object_Attr_MultiSelect";
- }
-
- mDAPathfindingAttributes->setEnabled(TRUE);
- mDAPathfindingAttributes->setValue(LLTrans::getString(pfAttrName));
-
- // Update creator text field
- getChildView("Creator:")->setEnabled(TRUE);
-
- std::string creator_name;
- LLUUID creator_id;
- LLSelectMgr::getInstance()->selectGetCreator(creator_id, creator_name);
-
- if(creator_id != mCreatorID )
- {
- mDACreatorName->setValue(creator_name);
- mCreatorID = creator_id;
- }
- if(mDACreatorName->getValue().asString() == LLStringUtil::null)
- {
- mDACreatorName->setValue(creator_name);
- }
- mDACreatorName->setEnabled(TRUE);
-
- // Update owner text field
- getChildView("Owner:")->setEnabled(TRUE);
-
- std::string owner_name;
- LLUUID owner_id;
- const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
- if (owner_id.isNull())
- {
- if (LLSelectMgr::getInstance()->selectIsGroupOwned())
- {
- // Group owned already displayed by selectGetOwner
- }
- else
- {
- // Display last owner if public
- std::string last_owner_name;
- LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name);
-
- // It should never happen that the last owner is null and the owner
- // is null, but it seems to be a bug in the simulator right now. JC
- if (!mLastOwnerID.isNull() && !last_owner_name.empty())
- {
- owner_name.append(", last ");
- owner_name.append(last_owner_name);
- }
- }
- }
-
- if(owner_id.isNull() || (owner_id != mOwnerID))
- {
- mDAOwnerName->setValue(owner_name);
- mOwnerID = owner_id;
- }
- if(mDAOwnerName->getValue().asString() == LLStringUtil::null)
- {
- mDAOwnerName->setValue(owner_name);
- }
-
- getChildView("Owner Name")->setEnabled(TRUE);
-
- // update group text field
- getChildView("Group:")->setEnabled(TRUE);
- getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
- LLUUID group_id;
- BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
- if (groups_identical)
- {
- if (mLabelGroupName)
- {
- mLabelGroupName->setNameID(group_id,TRUE);
- mLabelGroupName->setEnabled(TRUE);
- }
- }
- else
- {
- if (mLabelGroupName)
- {
- mLabelGroupName->setNameID(LLUUID::null, TRUE);
- mLabelGroupName->refresh(LLUUID::null, std::string(), true);
- mLabelGroupName->setEnabled(FALSE);
- }
- }
-
- getChildView("button set group")->setEnabled(owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced);
-
- getChildView("Name:")->setEnabled(TRUE);
- LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name");
- getChildView("Description:")->setEnabled(TRUE);
- LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description");
-
- if (is_one_object)
- {
- if (!LineEditorObjectName->hasFocus())
- {
- getChild<LLUICtrl>("Object Name")->setValue(nodep->mName);
- }
-
- if (LineEditorObjectDesc)
- {
- if (!LineEditorObjectDesc->hasFocus())
- {
- LineEditorObjectDesc->setText(nodep->mDescription);
- }
- }
- }
- else
- {
- getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
- LineEditorObjectDesc->setText(LLStringUtil::null);
- }
-
- // figure out the contents of the name, description, & category
- BOOL edit_name_desc = FALSE;
- if (is_one_object && objectp->permModify() && !objectp->isPermanentEnforced())
- {
- edit_name_desc = TRUE;
- }
- if (edit_name_desc)
- {
- getChildView("Object Name")->setEnabled(TRUE);
- getChildView("Object Description")->setEnabled(TRUE);
- }
- else
- {
- getChildView("Object Name")->setEnabled(FALSE);
- getChildView("Object Description")->setEnabled(FALSE);
- }
-
- S32 total_sale_price = 0;
- S32 individual_sale_price = 0;
- BOOL is_for_sale_mixed = FALSE;
- BOOL is_sale_price_mixed = FALSE;
- U32 num_for_sale = FALSE;
+
+ LLButton* btn_deed_to_group = mDeedBtn;
+ if (btn_deed_to_group)
+ {
+ std::string deedText;
+ if (gWarningSettings.getBOOL("DeedObject"))
+ {
+ deedText = getString("text deed continued");
+ }
+ else
+ {
+ deedText = getString("text deed");
+ }
+ btn_deed_to_group->setLabelSelected(deedText);
+ btn_deed_to_group->setLabelUnselected(deedText);
+ }
+
+ BOOL root_selected = TRUE;
+ LLSelectNode* nodep = mObjectSelection->getFirstRootNode();
+ S32 object_count = mObjectSelection->getRootObjectCount();
+ if (!nodep || (object_count == 0))
+ {
+ nodep = mObjectSelection->getFirstNode();
+ object_count = mObjectSelection->getObjectCount();
+ root_selected = FALSE;
+ }
+
+ LLViewerObject* objectp = NULL;
+ if (nodep)
+ {
+ objectp = nodep->getObject();
+ }
+
+ // ...nothing selected
+ if (!nodep || !objectp)
+ {
+ disableAll();
+ return;
+ }
+
+ // figure out a few variables
+ const BOOL is_one_object = (object_count == 1);
+
+ // BUG: fails if a root and non-root are both single-selected.
+ const BOOL is_perm_modify = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) ||
+ LLSelectMgr::getInstance()->selectGetModify();
+ const BOOL is_nonpermanent_enforced = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) ||
+ LLSelectMgr::getInstance()->selectGetNonPermanentEnforced();
+
+ S32 string_index = 0;
+ std::string MODIFY_INFO_STRINGS[] =
+ {
+ getString("text modify info 1"),
+ getString("text modify info 2"),
+ getString("text modify info 3"),
+ getString("text modify info 4"),
+ getString("text modify info 5"),
+ getString("text modify info 6")
+ };
+ if (!is_perm_modify)
+ {
+ string_index += 2;
+ }
+ else if (!is_nonpermanent_enforced)
+ {
+ string_index += 4;
+ }
+ if (!is_one_object)
+ {
+ ++string_index;
+ }
+ getChildView("perm_modify")->setEnabled(TRUE);
+ getChild<LLUICtrl>("perm_modify")->setValue(MODIFY_INFO_STRINGS[string_index]);
+
+ std::string pfAttrName;
+
+ if ((mObjectSelection->getFirstRootNode()
+ && LLSelectMgr::getInstance()->selectGetRootsNonPathfinding())
+ || LLSelectMgr::getInstance()->selectGetNonPathfinding())
+ {
+ pfAttrName = "Pathfinding_Object_Attr_None";
+ }
+ else if ((mObjectSelection->getFirstRootNode()
+ && LLSelectMgr::getInstance()->selectGetRootsPermanent())
+ || LLSelectMgr::getInstance()->selectGetPermanent())
+ {
+ pfAttrName = "Pathfinding_Object_Attr_Permanent";
+ }
+ else if ((mObjectSelection->getFirstRootNode()
+ && LLSelectMgr::getInstance()->selectGetRootsCharacter())
+ || LLSelectMgr::getInstance()->selectGetCharacter())
+ {
+ pfAttrName = "Pathfinding_Object_Attr_Character";
+ }
+ else
+ {
+ pfAttrName = "Pathfinding_Object_Attr_MultiSelect";
+ }
+
+ mDAPathfindingAttributes->setEnabled(TRUE);
+ mDAPathfindingAttributes->setValue(LLTrans::getString(pfAttrName));
+
+ // Update creator text field
+ getChildView("Creator:")->setEnabled(TRUE);
+
+ std::string creator_name;
+ LLUUID creator_id;
+ LLSelectMgr::getInstance()->selectGetCreator(creator_id, creator_name);
+
+ if(creator_id != mCreatorID )
+ {
+ mDACreatorName->setValue(creator_name);
+ mCreatorID = creator_id;
+ }
+ if(mDACreatorName->getValue().asString() == LLStringUtil::null)
+ {
+ mDACreatorName->setValue(creator_name);
+ }
+ mDACreatorName->setEnabled(TRUE);
+
+ // Update owner text field
+ getChildView("Owner:")->setEnabled(TRUE);
+
+ std::string owner_name;
+ LLUUID owner_id;
+ const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
+ if (owner_id.isNull())
+ {
+ if (LLSelectMgr::getInstance()->selectIsGroupOwned())
+ {
+ // Group owned already displayed by selectGetOwner
+ }
+ else
+ {
+ // Display last owner if public
+ std::string last_owner_name;
+ LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name);
+
+ // It should never happen that the last owner is null and the owner
+ // is null, but it seems to be a bug in the simulator right now. JC
+ if (!mLastOwnerID.isNull() && !last_owner_name.empty())
+ {
+ owner_name.append(", last ");
+ owner_name.append(last_owner_name);
+ }
+ }
+ }
+
+ if(owner_id.isNull() || (owner_id != mOwnerID))
+ {
+ mDAOwnerName->setValue(owner_name);
+ mOwnerID = owner_id;
+ }
+ if(mDAOwnerName->getValue().asString() == LLStringUtil::null)
+ {
+ mDAOwnerName->setValue(owner_name);
+ }
+
+ getChildView("Owner Name")->setEnabled(TRUE);
+
+ // update group text field
+ getChildView("Group:")->setEnabled(TRUE);
+ getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
+ LLUUID group_id;
+ BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
+ if (groups_identical)
+ {
+ if (mLabelGroupName)
+ {
+ mLabelGroupName->setNameID(group_id,TRUE);
+ mLabelGroupName->setEnabled(TRUE);
+ }
+ }
+ else
+ {
+ if (mLabelGroupName)
+ {
+ mLabelGroupName->setNameID(LLUUID::null, TRUE);
+ mLabelGroupName->refresh(LLUUID::null, std::string(), true);
+ mLabelGroupName->setEnabled(FALSE);
+ }
+ }
+
+ getChildView("button set group")->setEnabled(owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced);
+
+ getChildView("Name:")->setEnabled(TRUE);
+ LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name");
+ getChildView("Description:")->setEnabled(TRUE);
+ LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description");
+
+ if (is_one_object)
+ {
+ if (!LineEditorObjectName->hasFocus())
+ {
+ getChild<LLUICtrl>("Object Name")->setValue(nodep->mName);
+ }
+
+ if (LineEditorObjectDesc)
+ {
+ if (!LineEditorObjectDesc->hasFocus())
+ {
+ LineEditorObjectDesc->setText(nodep->mDescription);
+ }
+ }
+ }
+ else
+ {
+ getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
+ LineEditorObjectDesc->setText(LLStringUtil::null);
+ }
+
+ // figure out the contents of the name, description, & category
+ BOOL edit_name_desc = FALSE;
+ if (is_one_object && objectp->permModify() && !objectp->isPermanentEnforced())
+ {
+ edit_name_desc = TRUE;
+ }
+ if (edit_name_desc)
+ {
+ getChildView("Object Name")->setEnabled(TRUE);
+ getChildView("Object Description")->setEnabled(TRUE);
+ }
+ else
+ {
+ getChildView("Object Name")->setEnabled(FALSE);
+ getChildView("Object Description")->setEnabled(FALSE);
+ }
+
+ S32 total_sale_price = 0;
+ S32 individual_sale_price = 0;
+ BOOL is_for_sale_mixed = FALSE;
+ BOOL is_sale_price_mixed = FALSE;
+ U32 num_for_sale = FALSE;
LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale,
- is_for_sale_mixed,
- is_sale_price_mixed,
- total_sale_price,
- individual_sale_price);
-
- const BOOL self_owned = (gAgent.getID() == mOwnerID);
- const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ;
- const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned());
- const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer();
- const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy();
-
- if (!owners_identical)
- {
- getChildView("Cost")->setEnabled(FALSE);
- getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
- getChildView("Edit Cost")->setEnabled(FALSE);
- }
- // You own these objects.
- else if (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE)))
- {
- LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost");
-
- // If there are multiple items for sale then set text to PRICE PER UNIT.
- if (num_for_sale > 1)
- {
- std::string label_text = is_sale_price_mixed? "Cost Mixed" :"Cost Per Unit";
- edit_price->setLabel(getString(label_text));
- }
- else
- {
- edit_price->setLabel(getString("Cost Default"));
- }
-
- if (!edit_price->hasFocus())
- {
- // If the sale price is mixed then set the cost to MIXED, otherwise
- // set to the actual cost.
- if ((num_for_sale > 0) && is_for_sale_mixed)
- {
- edit_price->setTentative(TRUE);
- }
- else if ((num_for_sale > 0) && is_sale_price_mixed)
- {
- edit_price->setTentative(TRUE);
- }
- else
- {
- edit_price->setValue(individual_sale_price);
- }
- }
- // The edit fields are only enabled if you can sell this object
- // and the sale price is not mixed.
- BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE;
- getChildView("Cost")->setEnabled(enable_edit);
- getChildView("Edit Cost")->setEnabled(enable_edit);
- }
- // Someone, not you, owns these objects.
- else if (!public_owned)
- {
- getChildView("Cost")->setEnabled(FALSE);
- getChildView("Edit Cost")->setEnabled(FALSE);
-
- // Don't show a price if none of the items are for sale.
- if (num_for_sale)
- getChild<LLUICtrl>("Edit Cost")->setValue(llformat("%d",total_sale_price));
- else
- getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
-
- // If multiple items are for sale, set text to TOTAL PRICE.
- if (num_for_sale > 1)
- getChild<LLSpinCtrl>("Edit Cost")->setLabel(getString("Cost Total"));
- else
- getChild<LLSpinCtrl>("Edit Cost")->setLabel(getString("Cost Default"));
- }
- // This is a public object.
- else
- {
- getChildView("Cost")->setEnabled(FALSE);
- getChild<LLSpinCtrl>("Edit Cost")->setLabel(getString("Cost Default"));
- getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
- getChildView("Edit Cost")->setEnabled(FALSE);
- }
-
- // Enable and disable the permissions checkboxes
- // based on who owns the object.
- // TODO: Creator permissions
-
- U32 base_mask_on = 0;
- U32 base_mask_off = 0;
- U32 owner_mask_off = 0;
- U32 owner_mask_on = 0;
- U32 group_mask_on = 0;
- U32 group_mask_off = 0;
- U32 everyone_mask_on = 0;
- U32 everyone_mask_off = 0;
- U32 next_owner_mask_on = 0;
- U32 next_owner_mask_off = 0;
-
- BOOL valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE,
- &base_mask_on,
- &base_mask_off);
- //BOOL valid_owner_perms =//
- LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER,
- &owner_mask_on,
- &owner_mask_off);
- BOOL valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP,
- &group_mask_on,
- &group_mask_off);
-
- BOOL valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE,
- &everyone_mask_on,
- &everyone_mask_off);
-
- BOOL valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER,
- &next_owner_mask_on,
- &next_owner_mask_off);
-
-
- if (gSavedSettings.getBOOL("DebugPermissions") )
- {
+ is_for_sale_mixed,
+ is_sale_price_mixed,
+ total_sale_price,
+ individual_sale_price);
+
+ const BOOL self_owned = (gAgent.getID() == mOwnerID);
+ const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ;
+ const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned());
+ const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer();
+ const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy();
+
+ if (!owners_identical)
+ {
+ getChildView("Cost")->setEnabled(FALSE);
+ getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
+ getChildView("Edit Cost")->setEnabled(FALSE);
+ }
+ // You own these objects.
+ else if (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE)))
+ {
+ LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost");
+
+ // If there are multiple items for sale then set text to PRICE PER UNIT.
+ if (num_for_sale > 1)
+ {
+ std::string label_text = is_sale_price_mixed? "Cost Mixed" :"Cost Per Unit";
+ edit_price->setLabel(getString(label_text));
+ }
+ else
+ {
+ edit_price->setLabel(getString("Cost Default"));
+ }
+
+ if (!edit_price->hasFocus())
+ {
+ // If the sale price is mixed then set the cost to MIXED, otherwise
+ // set to the actual cost.
+ if ((num_for_sale > 0) && is_for_sale_mixed)
+ {
+ edit_price->setTentative(TRUE);
+ }
+ else if ((num_for_sale > 0) && is_sale_price_mixed)
+ {
+ edit_price->setTentative(TRUE);
+ }
+ else
+ {
+ edit_price->setValue(individual_sale_price);
+ }
+ }
+ // The edit fields are only enabled if you can sell this object
+ // and the sale price is not mixed.
+ BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE;
+ getChildView("Cost")->setEnabled(enable_edit);
+ getChildView("Edit Cost")->setEnabled(enable_edit);
+ }
+ // Someone, not you, owns these objects.
+ else if (!public_owned)
+ {
+ getChildView("Cost")->setEnabled(FALSE);
+ getChildView("Edit Cost")->setEnabled(FALSE);
+
+ // Don't show a price if none of the items are for sale.
+ if (num_for_sale)
+ getChild<LLUICtrl>("Edit Cost")->setValue(llformat("%d",total_sale_price));
+ else
+ getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
+
+ // If multiple items are for sale, set text to TOTAL PRICE.
+ if (num_for_sale > 1)
+ getChild<LLSpinCtrl>("Edit Cost")->setLabel(getString("Cost Total"));
+ else
+ getChild<LLSpinCtrl>("Edit Cost")->setLabel(getString("Cost Default"));
+ }
+ // This is a public object.
+ else
+ {
+ getChildView("Cost")->setEnabled(FALSE);
+ getChild<LLSpinCtrl>("Edit Cost")->setLabel(getString("Cost Default"));
+ getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
+ getChildView("Edit Cost")->setEnabled(FALSE);
+ }
+
+ // Enable and disable the permissions checkboxes
+ // based on who owns the object.
+ // TODO: Creator permissions
+
+ U32 base_mask_on = 0;
+ U32 base_mask_off = 0;
+ U32 owner_mask_off = 0;
+ U32 owner_mask_on = 0;
+ U32 group_mask_on = 0;
+ U32 group_mask_off = 0;
+ U32 everyone_mask_on = 0;
+ U32 everyone_mask_off = 0;
+ U32 next_owner_mask_on = 0;
+ U32 next_owner_mask_off = 0;
+
+ BOOL valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE,
+ &base_mask_on,
+ &base_mask_off);
+ //BOOL valid_owner_perms =//
+ LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER,
+ &owner_mask_on,
+ &owner_mask_off);
+ BOOL valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP,
+ &group_mask_on,
+ &group_mask_off);
+
+ BOOL valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE,
+ &everyone_mask_on,
+ &everyone_mask_off);
+
+ BOOL valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER,
+ &next_owner_mask_on,
+ &next_owner_mask_off);
+
+
+ if (gSavedSettings.getBOOL("DebugPermissions") )
+ {
if (valid_base_perms)
{
mDAB->setValue("B: " + mask_to_string(base_mask_on));
- mDAB->setVisible( TRUE);
+ mDAB->setVisible( TRUE);
mDAO->setValue("O: " + mask_to_string(owner_mask_on));
- mDAO->setVisible( TRUE);
+ mDAO->setVisible( TRUE);
mDAG->setValue("G: " + mask_to_string(group_mask_on));
- mDAG->setVisible( TRUE);
+ mDAG->setVisible( TRUE);
mDAE->setValue("E: " + mask_to_string(everyone_mask_on));
- mDAE->setVisible( TRUE);
+ mDAE->setVisible( TRUE);
mDAN->setValue("N: " + mask_to_string(next_owner_mask_on));
- mDAN->setVisible( TRUE);
+ mDAN->setVisible( TRUE);
}
- U32 flag_mask = 0x0;
- if (objectp->permMove()) flag_mask |= PERM_MOVE;
- if (objectp->permModify()) flag_mask |= PERM_MODIFY;
- if (objectp->permCopy()) flag_mask |= PERM_COPY;
- if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER;
+ U32 flag_mask = 0x0;
+ if (objectp->permMove()) flag_mask |= PERM_MOVE;
+ if (objectp->permModify()) flag_mask |= PERM_MODIFY;
+ if (objectp->permCopy()) flag_mask |= PERM_COPY;
+ if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER;
mDAF->setValue("F:" + mask_to_string(flag_mask));
mDAF->setVisible(TRUE);
@@ -679,295 +679,295 @@ void LLSidepanelTaskInfo::refresh()
mVisibleDebugPermissions = false;
}
- BOOL has_change_perm_ability = FALSE;
- BOOL has_change_sale_ability = FALSE;
-
- if (valid_base_perms && is_nonpermanent_enforced &&
- (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE))))
- {
- has_change_perm_ability = TRUE;
- }
- if (valid_base_perms && is_nonpermanent_enforced &&
- (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE))))
- {
- has_change_sale_ability = TRUE;
- }
-
- if (!has_change_perm_ability && !has_change_sale_ability && !root_selected)
- {
- // ...must select root to choose permissions
- getChild<LLUICtrl>("perm_modify")->setValue(getString("text modify warning"));
- }
-
- if (has_change_perm_ability)
- {
- getChildView("checkbox share with group")->setEnabled(TRUE);
- getChildView("checkbox allow everyone move")->setEnabled(owner_mask_on & PERM_MOVE);
- getChildView("checkbox allow everyone copy")->setEnabled(owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER);
- }
- else
- {
- getChildView("checkbox share with group")->setEnabled(FALSE);
- getChildView("checkbox allow everyone move")->setEnabled(FALSE);
- getChildView("checkbox allow everyone copy")->setEnabled(FALSE);
- }
-
- if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER))
- {
- getChildView("checkbox for sale")->setEnabled(can_transfer || (!can_transfer && num_for_sale));
- // Set the checkbox to tentative if the prices of each object selected
- // are not the same.
- getChild<LLUICtrl>("checkbox for sale")->setTentative( is_for_sale_mixed);
- getChildView("sale type")->setEnabled(num_for_sale && can_transfer && !is_sale_price_mixed);
-
- getChildView("checkbox next owner can modify")->setEnabled(base_mask_on & PERM_MODIFY);
- getChildView("checkbox next owner can copy")->setEnabled(base_mask_on & PERM_COPY);
- getChildView("checkbox next owner can transfer")->setEnabled(next_owner_mask_on & PERM_COPY);
- }
- else
- {
- getChildView("checkbox for sale")->setEnabled(FALSE);
- getChildView("sale type")->setEnabled(FALSE);
-
- getChildView("checkbox next owner can modify")->setEnabled(FALSE);
- getChildView("checkbox next owner can copy")->setEnabled(FALSE);
- getChildView("checkbox next owner can transfer")->setEnabled(FALSE);
- }
-
- if (valid_group_perms)
- {
- if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE))
- {
- getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE);
- getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer);
- }
- else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE))
- {
- getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE);
- getChildView("button deed")->setEnabled(FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox share with group")->setTentative( TRUE);
- getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer);
- }
- }
-
- if (valid_everyone_perms)
- {
- // Move
- if (everyone_mask_on & PERM_MOVE)
- {
- getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE);
- }
- else if (everyone_mask_off & PERM_MOVE)
- {
- getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( TRUE);
- }
-
- // Copy == everyone can't copy
- if (everyone_mask_on & PERM_COPY)
- {
- getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( !can_copy || !can_transfer);
- }
- else if (everyone_mask_off & PERM_COPY)
- {
- getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( TRUE);
- }
- }
-
- if (valid_next_perms)
- {
- // Modify == next owner canot modify
- if (next_owner_mask_on & PERM_MODIFY)
- {
- getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE);
- }
- else if (next_owner_mask_off & PERM_MODIFY)
- {
- getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( TRUE);
- }
-
- // Copy == next owner cannot copy
- if (next_owner_mask_on & PERM_COPY)
- {
- getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( !can_copy);
- }
- else if (next_owner_mask_off & PERM_COPY)
- {
- getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( TRUE);
- }
-
- // Transfer == next owner cannot transfer
- if (next_owner_mask_on & PERM_TRANSFER)
- {
- getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( !can_transfer);
- }
- else if (next_owner_mask_off & PERM_TRANSFER)
- {
- getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE);
- getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( FALSE);
- }
- else
- {
- getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE);
- getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( TRUE);
- }
- }
-
- // reflect sale information
- LLSaleInfo sale_info;
- BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
- LLSaleInfo::EForSale sale_type = sale_info.getSaleType();
-
- LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type");
- if (valid_sale_info)
- {
- combo_sale_type->setValue( sale_type == LLSaleInfo::FS_NOT ? LLSaleInfo::FS_COPY : sale_type);
- combo_sale_type->setTentative( FALSE); // unfortunately this doesn't do anything at the moment.
- }
- else
- {
- // default option is sell copy, determined to be safest
- combo_sale_type->setValue( LLSaleInfo::FS_COPY);
- combo_sale_type->setTentative( TRUE); // unfortunately this doesn't do anything at the moment.
- }
-
- getChild<LLUICtrl>("checkbox for sale")->setValue((num_for_sale != 0));
-
- // HACK: There are some old objects in world that are set for sale,
- // but are no-transfer. We need to let users turn for-sale off, but only
- // if for-sale is set.
- bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY);
- if (cannot_actually_sell)
- {
- if (num_for_sale && has_change_sale_ability)
- {
- getChildView("checkbox for sale")->setEnabled(true);
- }
- }
-
- // Check search status of objects
- const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
- bool include_in_search;
- const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search);
- getChildView("search_check")->setEnabled(has_change_sale_ability && all_volume);
- getChild<LLUICtrl>("search_check")->setValue(include_in_search);
- getChild<LLUICtrl>("search_check")->setTentative(!all_include_in_search);
-
- // Click action (touch, sit, buy)
- U8 click_action = 0;
- if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action))
- {
- LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction");
- if (ComboClickAction)
- {
- ComboClickAction->setCurrentByIndex((S32)click_action);
- }
- }
- getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume);
- getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume);
-
- updateVerbs();
+ BOOL has_change_perm_ability = FALSE;
+ BOOL has_change_sale_ability = FALSE;
+
+ if (valid_base_perms && is_nonpermanent_enforced &&
+ (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE))))
+ {
+ has_change_perm_ability = TRUE;
+ }
+ if (valid_base_perms && is_nonpermanent_enforced &&
+ (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE))))
+ {
+ has_change_sale_ability = TRUE;
+ }
+
+ if (!has_change_perm_ability && !has_change_sale_ability && !root_selected)
+ {
+ // ...must select root to choose permissions
+ getChild<LLUICtrl>("perm_modify")->setValue(getString("text modify warning"));
+ }
+
+ if (has_change_perm_ability)
+ {
+ getChildView("checkbox share with group")->setEnabled(TRUE);
+ getChildView("checkbox allow everyone move")->setEnabled(owner_mask_on & PERM_MOVE);
+ getChildView("checkbox allow everyone copy")->setEnabled(owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER);
+ }
+ else
+ {
+ getChildView("checkbox share with group")->setEnabled(FALSE);
+ getChildView("checkbox allow everyone move")->setEnabled(FALSE);
+ getChildView("checkbox allow everyone copy")->setEnabled(FALSE);
+ }
+
+ if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER))
+ {
+ getChildView("checkbox for sale")->setEnabled(can_transfer || (!can_transfer && num_for_sale));
+ // Set the checkbox to tentative if the prices of each object selected
+ // are not the same.
+ getChild<LLUICtrl>("checkbox for sale")->setTentative( is_for_sale_mixed);
+ getChildView("sale type")->setEnabled(num_for_sale && can_transfer && !is_sale_price_mixed);
+
+ getChildView("checkbox next owner can modify")->setEnabled(base_mask_on & PERM_MODIFY);
+ getChildView("checkbox next owner can copy")->setEnabled(base_mask_on & PERM_COPY);
+ getChildView("checkbox next owner can transfer")->setEnabled(next_owner_mask_on & PERM_COPY);
+ }
+ else
+ {
+ getChildView("checkbox for sale")->setEnabled(FALSE);
+ getChildView("sale type")->setEnabled(FALSE);
+
+ getChildView("checkbox next owner can modify")->setEnabled(FALSE);
+ getChildView("checkbox next owner can copy")->setEnabled(FALSE);
+ getChildView("checkbox next owner can transfer")->setEnabled(FALSE);
+ }
+
+ if (valid_group_perms)
+ {
+ if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE))
+ {
+ getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE);
+ getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer);
+ }
+ else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE))
+ {
+ getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE);
+ getChildView("button deed")->setEnabled(FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox share with group")->setTentative( TRUE);
+ getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer);
+ }
+ }
+
+ if (valid_everyone_perms)
+ {
+ // Move
+ if (everyone_mask_on & PERM_MOVE)
+ {
+ getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE);
+ }
+ else if (everyone_mask_off & PERM_MOVE)
+ {
+ getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( TRUE);
+ }
+
+ // Copy == everyone can't copy
+ if (everyone_mask_on & PERM_COPY)
+ {
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( !can_copy || !can_transfer);
+ }
+ else if (everyone_mask_off & PERM_COPY)
+ {
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( TRUE);
+ }
+ }
+
+ if (valid_next_perms)
+ {
+ // Modify == next owner canot modify
+ if (next_owner_mask_on & PERM_MODIFY)
+ {
+ getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE);
+ }
+ else if (next_owner_mask_off & PERM_MODIFY)
+ {
+ getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( TRUE);
+ }
+
+ // Copy == next owner cannot copy
+ if (next_owner_mask_on & PERM_COPY)
+ {
+ getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( !can_copy);
+ }
+ else if (next_owner_mask_off & PERM_COPY)
+ {
+ getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( TRUE);
+ }
+
+ // Transfer == next owner cannot transfer
+ if (next_owner_mask_on & PERM_TRANSFER)
+ {
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( !can_transfer);
+ }
+ else if (next_owner_mask_off & PERM_TRANSFER)
+ {
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE);
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( FALSE);
+ }
+ else
+ {
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE);
+ getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( TRUE);
+ }
+ }
+
+ // reflect sale information
+ LLSaleInfo sale_info;
+ BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
+ LLSaleInfo::EForSale sale_type = sale_info.getSaleType();
+
+ LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type");
+ if (valid_sale_info)
+ {
+ combo_sale_type->setValue( sale_type == LLSaleInfo::FS_NOT ? LLSaleInfo::FS_COPY : sale_type);
+ combo_sale_type->setTentative( FALSE); // unfortunately this doesn't do anything at the moment.
+ }
+ else
+ {
+ // default option is sell copy, determined to be safest
+ combo_sale_type->setValue( LLSaleInfo::FS_COPY);
+ combo_sale_type->setTentative( TRUE); // unfortunately this doesn't do anything at the moment.
+ }
+
+ getChild<LLUICtrl>("checkbox for sale")->setValue((num_for_sale != 0));
+
+ // HACK: There are some old objects in world that are set for sale,
+ // but are no-transfer. We need to let users turn for-sale off, but only
+ // if for-sale is set.
+ bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY);
+ if (cannot_actually_sell)
+ {
+ if (num_for_sale && has_change_sale_ability)
+ {
+ getChildView("checkbox for sale")->setEnabled(true);
+ }
+ }
+
+ // Check search status of objects
+ const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );
+ bool include_in_search;
+ const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search);
+ getChildView("search_check")->setEnabled(has_change_sale_ability && all_volume);
+ getChild<LLUICtrl>("search_check")->setValue(include_in_search);
+ getChild<LLUICtrl>("search_check")->setTentative(!all_include_in_search);
+
+ // Click action (touch, sit, buy)
+ U8 click_action = 0;
+ if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action))
+ {
+ LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction");
+ if (ComboClickAction)
+ {
+ ComboClickAction->setCurrentByIndex((S32)click_action);
+ }
+ }
+ getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume);
+ getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume);
+
+ updateVerbs();
}
// static
void LLSidepanelTaskInfo::onClickClaim(void*)
{
- // try to claim ownership
- LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID());
+ // try to claim ownership
+ LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID());
}
// static
void LLSidepanelTaskInfo::onClickRelease(void*)
{
- // try to release ownership
- LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null);
+ // try to release ownership
+ LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null);
}
void LLSidepanelTaskInfo::onClickGroup()
{
- LLUUID owner_id;
- std::string name;
- BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name);
- LLFloater* parent_floater = gFloaterView->getParentFloater(this);
-
- if (owners_identical && (owner_id == gAgent.getID()))
- {
- LLFloaterGroupPicker* fg = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
- if (fg)
- {
- fg->setSelectGroupCallback( boost::bind(&LLSidepanelTaskInfo::cbGroupID, this, _1) );
- if (parent_floater)
- {
- LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg);
- fg->setOrigin(new_rect.mLeft, new_rect.mBottom);
- parent_floater->addDependentFloater(fg);
- }
- }
- }
+ LLUUID owner_id;
+ std::string name;
+ BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name);
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+
+ if (owners_identical && (owner_id == gAgent.getID()))
+ {
+ LLFloaterGroupPicker* fg = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
+ if (fg)
+ {
+ fg->setSelectGroupCallback( boost::bind(&LLSidepanelTaskInfo::cbGroupID, this, _1) );
+ if (parent_floater)
+ {
+ LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg);
+ fg->setOrigin(new_rect.mLeft, new_rect.mBottom);
+ parent_floater->addDependentFloater(fg);
+ }
+ }
+ }
}
void LLSidepanelTaskInfo::cbGroupID(LLUUID group_id)
{
- if (mLabelGroupName)
- {
- mLabelGroupName->setNameID(group_id, TRUE);
- }
- LLSelectMgr::getInstance()->sendGroup(group_id);
+ if (mLabelGroupName)
+ {
+ mLabelGroupName->setNameID(group_id, TRUE);
+ }
+ LLSelectMgr::getInstance()->sendGroup(group_id);
}
static bool callback_deed_to_group(const LLSD& notification, const LLSD& response)
{
- const S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- LLUUID group_id;
- const BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
- if (group_id.notNull() && groups_identical && (gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED)))
- {
- LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE);
- }
- }
- return FALSE;
+ const S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ LLUUID group_id;
+ const BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
+ if (group_id.notNull() && groups_identical && (gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED)))
+ {
+ LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE);
+ }
+ }
+ return FALSE;
}
void LLSidepanelTaskInfo::onClickDeedToGroup(void *data)
{
- LLNotificationsUtil::add("DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group);
+ LLNotificationsUtil::add("DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group);
}
///----------------------------------------------------------------------------
@@ -977,15 +977,15 @@ void LLSidepanelTaskInfo::onClickDeedToGroup(void *data)
// static
void LLSidepanelTaskInfo::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm)
{
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
- if(!object) return;
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
+ if(!object) return;
- // Checkbox will have toggled itself
- // LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
- LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
- BOOL new_state = check->get();
-
- LLSelectMgr::getInstance()->selectionSetObjectPermissions(field, new_state, perm);
+ // Checkbox will have toggled itself
+ // LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
+ LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
+ BOOL new_state = check->get();
+
+ LLSelectMgr::getInstance()->selectionSetObjectPermissions(field, new_state, perm);
LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
if (self)
@@ -997,303 +997,303 @@ void LLSidepanelTaskInfo::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32
// static
void LLSidepanelTaskInfo::onCommitGroupShare(LLUICtrl *ctrl, void *data)
{
- onCommitPerm(ctrl, data, PERM_GROUP, PERM_MODIFY | PERM_MOVE | PERM_COPY);
+ onCommitPerm(ctrl, data, PERM_GROUP, PERM_MODIFY | PERM_MOVE | PERM_COPY);
}
// static
void LLSidepanelTaskInfo::onCommitEveryoneMove(LLUICtrl *ctrl, void *data)
{
- onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_MOVE);
+ onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_MOVE);
}
// static
void LLSidepanelTaskInfo::onCommitEveryoneCopy(LLUICtrl *ctrl, void *data)
{
- onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_COPY);
+ onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_COPY);
}
// static
void LLSidepanelTaskInfo::onCommitNextOwnerModify(LLUICtrl* ctrl, void* data)
{
- //LL_INFOS() << "LLSidepanelTaskInfo::onCommitNextOwnerModify" << LL_ENDL;
- onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_MODIFY);
+ //LL_INFOS() << "LLSidepanelTaskInfo::onCommitNextOwnerModify" << LL_ENDL;
+ onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_MODIFY);
}
// static
void LLSidepanelTaskInfo::onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data)
{
- //LL_INFOS() << "LLSidepanelTaskInfo::onCommitNextOwnerCopy" << LL_ENDL;
- onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_COPY);
+ //LL_INFOS() << "LLSidepanelTaskInfo::onCommitNextOwnerCopy" << LL_ENDL;
+ onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_COPY);
}
// static
void LLSidepanelTaskInfo::onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data)
{
- //LL_INFOS() << "LLSidepanelTaskInfo::onCommitNextOwnerTransfer" << LL_ENDL;
- onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_TRANSFER);
+ //LL_INFOS() << "LLSidepanelTaskInfo::onCommitNextOwnerTransfer" << LL_ENDL;
+ onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_TRANSFER);
}
// static
void LLSidepanelTaskInfo::onCommitName(LLUICtrl*, void* data)
{
- //LL_INFOS() << "LLSidepanelTaskInfo::onCommitName()" << LL_ENDL;
- LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
- LLLineEditor* tb = self->getChild<LLLineEditor>("Object Name");
- if(tb)
- {
- LLSelectMgr::getInstance()->selectionSetObjectName(tb->getText());
-// LLSelectMgr::getInstance()->selectionSetObjectName(self->mLabelObjectName->getText());
- }
+ //LL_INFOS() << "LLSidepanelTaskInfo::onCommitName()" << LL_ENDL;
+ LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
+ LLLineEditor* tb = self->getChild<LLLineEditor>("Object Name");
+ if(tb)
+ {
+ LLSelectMgr::getInstance()->selectionSetObjectName(tb->getText());
+// LLSelectMgr::getInstance()->selectionSetObjectName(self->mLabelObjectName->getText());
+ }
}
// static
void LLSidepanelTaskInfo::onCommitDesc(LLUICtrl*, void* data)
{
- //LL_INFOS() << "LLSidepanelTaskInfo::onCommitDesc()" << LL_ENDL;
- LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
- LLLineEditor* le = self->getChild<LLLineEditor>("Object Description");
- if(le)
- {
- LLSelectMgr::getInstance()->selectionSetObjectDescription(le->getText());
- }
+ //LL_INFOS() << "LLSidepanelTaskInfo::onCommitDesc()" << LL_ENDL;
+ LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
+ LLLineEditor* le = self->getChild<LLLineEditor>("Object Description");
+ if(le)
+ {
+ LLSelectMgr::getInstance()->selectionSetObjectDescription(le->getText());
+ }
}
// static
void LLSidepanelTaskInfo::onCommitSaleInfo(LLUICtrl*, void* data)
{
- LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
- self->setAllSaleInfo();
+ LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
+ self->setAllSaleInfo();
}
// static
void LLSidepanelTaskInfo::onCommitSaleType(LLUICtrl*, void* data)
{
- LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
- self->setAllSaleInfo();
+ LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data;
+ self->setAllSaleInfo();
}
void LLSidepanelTaskInfo::setAllSaleInfo()
{
- LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_NOT;
-
- LLCheckBoxCtrl *checkPurchase = getChild<LLCheckBoxCtrl>("checkbox for sale");
-
- // Set the sale type if the object(s) are for sale.
- if(checkPurchase && checkPurchase->get())
- {
- sale_type = static_cast<LLSaleInfo::EForSale>(getChild<LLComboBox>("sale type")->getValue().asInteger());
- }
-
- S32 price = -1;
-
- LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost");
- price = (edit_price->getTentative()) ? DEFAULT_PRICE : edit_price->getValue().asInteger();
-
- // If somehow an invalid price, turn the sale off.
- if (price < 0)
- sale_type = LLSaleInfo::FS_NOT;
-
- LLSaleInfo old_sale_info;
- LLSelectMgr::getInstance()->selectGetSaleInfo(old_sale_info);
-
- LLSaleInfo new_sale_info(sale_type, price);
- LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(new_sale_info);
-
- U8 old_click_action = 0;
- LLSelectMgr::getInstance()->selectionGetClickAction(&old_click_action);
-
- if (old_sale_info.isForSale()
- && !new_sale_info.isForSale()
- && old_click_action == CLICK_ACTION_BUY)
- {
- // If turned off for-sale, make sure click-action buy is turned
- // off as well
- LLSelectMgr::getInstance()->
- selectionSetClickAction(CLICK_ACTION_TOUCH);
- }
- else if (new_sale_info.isForSale()
- && !old_sale_info.isForSale()
- && old_click_action == CLICK_ACTION_TOUCH)
- {
- // If just turning on for-sale, preemptively turn on one-click buy
- // unless user have a different click action set
- LLSelectMgr::getInstance()->
- selectionSetClickAction(CLICK_ACTION_BUY);
- }
+ LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_NOT;
+
+ LLCheckBoxCtrl *checkPurchase = getChild<LLCheckBoxCtrl>("checkbox for sale");
+
+ // Set the sale type if the object(s) are for sale.
+ if(checkPurchase && checkPurchase->get())
+ {
+ sale_type = static_cast<LLSaleInfo::EForSale>(getChild<LLComboBox>("sale type")->getValue().asInteger());
+ }
+
+ S32 price = -1;
+
+ LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost");
+ price = (edit_price->getTentative()) ? DEFAULT_PRICE : edit_price->getValue().asInteger();
+
+ // If somehow an invalid price, turn the sale off.
+ if (price < 0)
+ sale_type = LLSaleInfo::FS_NOT;
+
+ LLSaleInfo old_sale_info;
+ LLSelectMgr::getInstance()->selectGetSaleInfo(old_sale_info);
+
+ LLSaleInfo new_sale_info(sale_type, price);
+ LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(new_sale_info);
+
+ U8 old_click_action = 0;
+ LLSelectMgr::getInstance()->selectionGetClickAction(&old_click_action);
+
+ if (old_sale_info.isForSale()
+ && !new_sale_info.isForSale()
+ && old_click_action == CLICK_ACTION_BUY)
+ {
+ // If turned off for-sale, make sure click-action buy is turned
+ // off as well
+ LLSelectMgr::getInstance()->
+ selectionSetClickAction(CLICK_ACTION_TOUCH);
+ }
+ else if (new_sale_info.isForSale()
+ && !old_sale_info.isForSale()
+ && old_click_action == CLICK_ACTION_TOUCH)
+ {
+ // If just turning on for-sale, preemptively turn on one-click buy
+ // unless user have a different click action set
+ LLSelectMgr::getInstance()->
+ selectionSetClickAction(CLICK_ACTION_BUY);
+ }
}
struct LLSelectionPayable : public LLSelectedObjectFunctor
{
- virtual bool apply(LLViewerObject* obj)
- {
- // can pay if you or your parent has money() event in script
- LLViewerObject* parent = (LLViewerObject*)obj->getParent();
- return (obj->flagTakesMoney() ||
- (parent && parent->flagTakesMoney()));
- }
+ virtual bool apply(LLViewerObject* obj)
+ {
+ // can pay if you or your parent has money() event in script
+ LLViewerObject* parent = (LLViewerObject*)obj->getParent();
+ return (obj->flagTakesMoney() ||
+ (parent && parent->flagTakesMoney()));
+ }
};
static U8 string_value_to_click_action(std::string p_value)
{
- if (p_value == "Touch")
- return CLICK_ACTION_TOUCH;
- if (p_value == "Sit")
- return CLICK_ACTION_SIT;
- if (p_value == "Buy")
- return CLICK_ACTION_BUY;
- if (p_value == "Pay")
- return CLICK_ACTION_PAY;
- if (p_value == "Open")
- return CLICK_ACTION_OPEN;
- if (p_value == "Zoom")
- return CLICK_ACTION_ZOOM;
- if (p_value == "None")
- return CLICK_ACTION_DISABLED;
- return CLICK_ACTION_TOUCH;
+ if (p_value == "Touch")
+ return CLICK_ACTION_TOUCH;
+ if (p_value == "Sit")
+ return CLICK_ACTION_SIT;
+ if (p_value == "Buy")
+ return CLICK_ACTION_BUY;
+ if (p_value == "Pay")
+ return CLICK_ACTION_PAY;
+ if (p_value == "Open")
+ return CLICK_ACTION_OPEN;
+ if (p_value == "Zoom")
+ return CLICK_ACTION_ZOOM;
+ if (p_value == "None")
+ return CLICK_ACTION_DISABLED;
+ return CLICK_ACTION_TOUCH;
}
// static
void LLSidepanelTaskInfo::onCommitClickAction(LLUICtrl* ctrl, void*)
{
- LLComboBox* box = (LLComboBox*)ctrl;
- if (!box)
- return;
- std::string value = box->getValue().asString();
- U8 click_action = string_value_to_click_action(value);
- doClickAction(click_action);
+ LLComboBox* box = (LLComboBox*)ctrl;
+ if (!box)
+ return;
+ std::string value = box->getValue().asString();
+ U8 click_action = string_value_to_click_action(value);
+ doClickAction(click_action);
}
// static
void LLSidepanelTaskInfo::doClickAction(U8 click_action)
{
- if (click_action == CLICK_ACTION_BUY)
- {
- LLSaleInfo sale_info;
- LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
- if (!sale_info.isForSale())
- {
- LLNotificationsUtil::add("CantSetBuyObject");
-
- // Set click action back to its old value
- U8 click_action = 0;
- LLSelectMgr::getInstance()->selectionGetClickAction(&click_action);
- return;
- }
- }
- else if (click_action == CLICK_ACTION_PAY)
- {
- // Verify object has script with money() handler
- LLSelectionPayable payable;
- bool can_pay = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&payable);
- if (!can_pay)
- {
- // Warn, but do it anyway.
- LLNotificationsUtil::add("ClickActionNotPayable");
- }
- else
- {
- handle_give_money_dialog();
- }
- }
- LLSelectMgr::getInstance()->selectionSetClickAction(click_action);
+ if (click_action == CLICK_ACTION_BUY)
+ {
+ LLSaleInfo sale_info;
+ LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
+ if (!sale_info.isForSale())
+ {
+ LLNotificationsUtil::add("CantSetBuyObject");
+
+ // Set click action back to its old value
+ U8 click_action = 0;
+ LLSelectMgr::getInstance()->selectionGetClickAction(&click_action);
+ return;
+ }
+ }
+ else if (click_action == CLICK_ACTION_PAY)
+ {
+ // Verify object has script with money() handler
+ LLSelectionPayable payable;
+ bool can_pay = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&payable);
+ if (!can_pay)
+ {
+ // Warn, but do it anyway.
+ LLNotificationsUtil::add("ClickActionNotPayable");
+ }
+ else
+ {
+ handle_give_money_dialog();
+ }
+ }
+ LLSelectMgr::getInstance()->selectionSetClickAction(click_action);
}
// static
void LLSidepanelTaskInfo::onCommitIncludeInSearch(LLUICtrl* ctrl, void* data)
{
- LLCheckBoxCtrl* box = (LLCheckBoxCtrl*)ctrl;
- llassert(box);
- LLSelectMgr::getInstance()->selectionSetIncludeInSearch(box->get());
+ LLCheckBoxCtrl* box = (LLCheckBoxCtrl*)ctrl;
+ llassert(box);
+ LLSelectMgr::getInstance()->selectionSetIncludeInSearch(box->get());
}
// virtual
void LLSidepanelTaskInfo::updateVerbs()
{
- LLSafeHandle<LLObjectSelection> object_selection = LLSelectMgr::getInstance()->getSelection();
- const BOOL any_selected = (object_selection->getNumNodes() > 0);
-
- mOpenBtn->setVisible(true);
- mPayBtn->setVisible(true);
- mBuyBtn->setVisible(true);
- mDetailsBtn->setVisible(true);
-
- mOpenBtn->setEnabled(enable_object_open());
- mPayBtn->setEnabled(enable_pay_object());
- mBuyBtn->setEnabled(enable_buy_object());
- mDetailsBtn->setEnabled(any_selected);
+ LLSafeHandle<LLObjectSelection> object_selection = LLSelectMgr::getInstance()->getSelection();
+ const BOOL any_selected = (object_selection->getNumNodes() > 0);
+
+ mOpenBtn->setVisible(true);
+ mPayBtn->setVisible(true);
+ mBuyBtn->setVisible(true);
+ mDetailsBtn->setVisible(true);
+
+ mOpenBtn->setEnabled(enable_object_open());
+ mPayBtn->setEnabled(enable_pay_object());
+ mBuyBtn->setEnabled(enable_buy_object());
+ mDetailsBtn->setEnabled(any_selected);
}
void LLSidepanelTaskInfo::onOpenButtonClicked()
{
- if (enable_object_open())
- {
- handle_object_open();
- }
+ if (enable_object_open())
+ {
+ handle_object_open();
+ }
}
void LLSidepanelTaskInfo::onPayButtonClicked()
{
- doClickAction(CLICK_ACTION_PAY);
+ doClickAction(CLICK_ACTION_PAY);
}
void LLSidepanelTaskInfo::onBuyButtonClicked()
{
- doClickAction(CLICK_ACTION_BUY);
+ doClickAction(CLICK_ACTION_BUY);
}
void LLSidepanelTaskInfo::onDetailsButtonClicked()
{
- LLFloaterReg::showInstance("inspect", LLSD());
+ LLFloaterReg::showInstance("inspect", LLSD());
}
// virtual
void LLSidepanelTaskInfo::save()
{
- onCommitGroupShare(getChild<LLCheckBoxCtrl>("checkbox share with group"), this);
- onCommitEveryoneMove(getChild<LLCheckBoxCtrl>("checkbox allow everyone move"), this);
- onCommitEveryoneCopy(getChild<LLCheckBoxCtrl>("checkbox allow everyone copy"), this);
- onCommitNextOwnerModify(getChild<LLCheckBoxCtrl>("checkbox next owner can modify"), this);
- onCommitNextOwnerCopy(getChild<LLCheckBoxCtrl>("checkbox next owner can copy"), this);
- onCommitNextOwnerTransfer(getChild<LLCheckBoxCtrl>("checkbox next owner can transfer"), this);
- onCommitName(getChild<LLLineEditor>("Object Name"), this);
- onCommitDesc(getChild<LLLineEditor>("Object Description"), this);
- onCommitSaleInfo(NULL, this);
- onCommitSaleType(NULL, this);
- onCommitIncludeInSearch(getChild<LLCheckBoxCtrl>("search_check"), this);
+ onCommitGroupShare(getChild<LLCheckBoxCtrl>("checkbox share with group"), this);
+ onCommitEveryoneMove(getChild<LLCheckBoxCtrl>("checkbox allow everyone move"), this);
+ onCommitEveryoneCopy(getChild<LLCheckBoxCtrl>("checkbox allow everyone copy"), this);
+ onCommitNextOwnerModify(getChild<LLCheckBoxCtrl>("checkbox next owner can modify"), this);
+ onCommitNextOwnerCopy(getChild<LLCheckBoxCtrl>("checkbox next owner can copy"), this);
+ onCommitNextOwnerTransfer(getChild<LLCheckBoxCtrl>("checkbox next owner can transfer"), this);
+ onCommitName(getChild<LLLineEditor>("Object Name"), this);
+ onCommitDesc(getChild<LLLineEditor>("Object Description"), this);
+ onCommitSaleInfo(NULL, this);
+ onCommitSaleType(NULL, this);
+ onCommitIncludeInSearch(getChild<LLCheckBoxCtrl>("search_check"), this);
}
// removes keyboard focus so that all fields can be updated
// and then restored focus
void LLSidepanelTaskInfo::refreshAll()
{
- // update UI as soon as we have an object
- // but remove keyboard focus first so fields are free to update
- LLFocusableElement* focus = NULL;
- if (hasFocus())
- {
- focus = gFocusMgr.getKeyboardFocus();
- setFocus(FALSE);
- }
- refresh();
- if (focus)
- {
- focus->setFocus(TRUE);
- }
+ // update UI as soon as we have an object
+ // but remove keyboard focus first so fields are free to update
+ LLFocusableElement* focus = NULL;
+ if (hasFocus())
+ {
+ focus = gFocusMgr.getKeyboardFocus();
+ setFocus(FALSE);
+ }
+ refresh();
+ if (focus)
+ {
+ focus->setFocus(TRUE);
+ }
}
void LLSidepanelTaskInfo::setObjectSelection(LLObjectSelectionHandle selection)
{
- mObjectSelection = selection;
- refreshAll();
+ mObjectSelection = selection;
+ refreshAll();
}
LLSidepanelTaskInfo* LLSidepanelTaskInfo::getActivePanel()
{
- return sActivePanel;
+ return sActivePanel;
}
void LLSidepanelTaskInfo::dirty()
@@ -1315,27 +1315,27 @@ void LLSidepanelTaskInfo::onIdle( void* user_data )
LLViewerObject* LLSidepanelTaskInfo::getObject()
{
- if (!mObject->isDead())
- return mObject;
- return NULL;
+ if (!mObject->isDead())
+ return mObject;
+ return NULL;
}
LLViewerObject* LLSidepanelTaskInfo::getFirstSelectedObject()
{
- LLSelectNode *node = mObjectSelection->getFirstRootNode();
- if (node)
- {
- return node->getObject();
- }
- return NULL;
+ LLSelectNode *node = mObjectSelection->getFirstRootNode();
+ if (node)
+ {
+ return node->getObject();
+ }
+ return NULL;
}
const LLUUID& LLSidepanelTaskInfo::getSelectedUUID()
{
- const LLViewerObject* obj = getFirstSelectedObject();
- if (obj)
- {
- return obj->getID();
- }
- return LLUUID::null;
+ const LLViewerObject* obj = getFirstSelectedObject();
+ if (obj)
+ {
+ return obj->getID();
+ }
+ return LLUUID::null;
}
diff --git a/indra/newview/llsidepaneltaskinfo.h b/indra/newview/llsidepaneltaskinfo.h
index 2baafc67e7..ea457cebe5 100644
--- a/indra/newview/llsidepaneltaskinfo.h
+++ b/indra/newview/llsidepaneltaskinfo.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsidepaneltaskinfo.h
* @brief LLSidepanelTaskInfo class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,116 +46,116 @@ class LLTextBase;
class LLSidepanelTaskInfo : public LLPanel
{
public:
- LLSidepanelTaskInfo();
- virtual ~LLSidepanelTaskInfo();
+ LLSidepanelTaskInfo();
+ virtual ~LLSidepanelTaskInfo();
- BOOL postBuild() override;
- void onVisibilityChange ( BOOL new_visibility ) override;
+ BOOL postBuild() override;
+ void onVisibilityChange ( BOOL new_visibility ) override;
- void setObjectSelection(LLObjectSelectionHandle selection);
+ void setObjectSelection(LLObjectSelectionHandle selection);
- const LLUUID& getSelectedUUID();
- LLViewerObject* getFirstSelectedObject();
+ const LLUUID& getSelectedUUID();
+ LLViewerObject* getFirstSelectedObject();
- static LLSidepanelTaskInfo *getActivePanel();
+ static LLSidepanelTaskInfo *getActivePanel();
void dirty();
static void onIdle( void* user_data );
protected:
- void refresh() override; // refresh all labels as needed
- void save();
- void updateVerbs();
+ void refresh() override; // refresh all labels as needed
+ void save();
+ void updateVerbs();
- void refreshAll(); // ignore current keyboard focus and update all fields
+ void refreshAll(); // ignore current keyboard focus and update all fields
- // statics
- static void onClickClaim(void*);
- static void onClickRelease(void*);
- void onClickGroup();
- void cbGroupID(LLUUID group_id);
- static void onClickDeedToGroup(void*);
+ // statics
+ static void onClickClaim(void*);
+ static void onClickRelease(void*);
+ void onClickGroup();
+ void cbGroupID(LLUUID group_id);
+ static void onClickDeedToGroup(void*);
- static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm);
+ static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm);
- static void onCommitGroupShare(LLUICtrl *ctrl, void *data);
+ static void onCommitGroupShare(LLUICtrl *ctrl, void *data);
- static void onCommitEveryoneMove(LLUICtrl *ctrl, void *data);
- static void onCommitEveryoneCopy(LLUICtrl *ctrl, void *data);
+ static void onCommitEveryoneMove(LLUICtrl *ctrl, void *data);
+ static void onCommitEveryoneCopy(LLUICtrl *ctrl, void *data);
- static void onCommitNextOwnerModify(LLUICtrl* ctrl, void* data);
- static void onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data);
- static void onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data);
-
- static void onCommitName(LLUICtrl* ctrl, void* data);
- static void onCommitDesc(LLUICtrl* ctrl, void* data);
+ static void onCommitNextOwnerModify(LLUICtrl* ctrl, void* data);
+ static void onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data);
+ static void onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data);
- static void onCommitSaleInfo(LLUICtrl* ctrl, void* data);
- static void onCommitSaleType(LLUICtrl* ctrl, void* data);
- void setAllSaleInfo();
+ static void onCommitName(LLUICtrl* ctrl, void* data);
+ static void onCommitDesc(LLUICtrl* ctrl, void* data);
- static void onCommitClickAction(LLUICtrl* ctrl, void* data);
- static void onCommitIncludeInSearch(LLUICtrl* ctrl, void*);
+ static void onCommitSaleInfo(LLUICtrl* ctrl, void* data);
+ static void onCommitSaleType(LLUICtrl* ctrl, void* data);
+ void setAllSaleInfo();
- static void doClickAction(U8 click_action);
- void disableAll();
- void disablePermissions();
+ static void onCommitClickAction(LLUICtrl* ctrl, void* data);
+ static void onCommitIncludeInSearch(LLUICtrl* ctrl, void*);
+
+ static void doClickAction(U8 click_action);
+ void disableAll();
+ void disablePermissions();
private:
- LLNameBox* mLabelGroupName; // group name
+ LLNameBox* mLabelGroupName; // group name
+
+ LLUUID mCreatorID;
+ LLUUID mOwnerID;
+ LLUUID mLastOwnerID;
- LLUUID mCreatorID;
- LLUUID mOwnerID;
- LLUUID mLastOwnerID;
-
bool mIsDirty;
protected:
- void onOpenButtonClicked();
- void onPayButtonClicked();
- void onBuyButtonClicked();
- void onDetailsButtonClicked();
+ void onOpenButtonClicked();
+ void onPayButtonClicked();
+ void onBuyButtonClicked();
+ void onDetailsButtonClicked();
private:
- LLButton* mOpenBtn;
- LLButton* mPayBtn;
- LLButton* mBuyBtn;
- LLButton* mDetailsBtn;
- LLButton* mDeedBtn;
+ LLButton* mOpenBtn;
+ LLButton* mPayBtn;
+ LLButton* mBuyBtn;
+ LLButton* mDetailsBtn;
+ LLButton* mDeedBtn;
protected:
- LLViewerObject* getObject();
+ LLViewerObject* getObject();
private:
- LLPointer<LLViewerObject> mObject;
- LLObjectSelectionHandle mObjectSelection;
+ LLPointer<LLViewerObject> mObject;
+ LLObjectSelectionHandle mObjectSelection;
// mVisibleDebugPermissions doesn't nessesarily matche state
// of viewes and is primarily for floater resize
bool mVisibleDebugPermissions;
- static LLSidepanelTaskInfo* sActivePanel;
-
+ static LLSidepanelTaskInfo* sActivePanel;
+
private:
- // Pointers cached here to speed up the "disableAll" function which gets called on idle
- LLUICtrl* mDAPermModify;
- LLUICtrl* mDACreatorName;
- LLView* mDAOwner;
- LLUICtrl* mDAOwnerName;
- LLView* mDAButtonSetGroup;
- LLUICtrl* mDAObjectName;
- LLView* mDAName;
- LLView* mDADescription;
- LLUICtrl* mDAObjectDescription;
- LLUICtrl* mDACheckboxShareWithGroup;
- LLView* mDAButtonDeed;
- LLUICtrl* mDACheckboxAllowEveryoneMove;
- LLUICtrl* mDACheckboxAllowEveryoneCopy;
- LLUICtrl* mDACheckboxNextOwnerCanModify;
- LLUICtrl* mDACheckboxNextOwnerCanCopy;
- LLUICtrl* mDACheckboxNextOwnerCanTransfer;
- LLUICtrl* mDACheckboxForSale;
- LLUICtrl* mDASearchCheck;
- LLComboBox* mDAComboSaleType;
- LLUICtrl* mDAEditCost;
- LLView* mDALabelClickAction;
- LLComboBox* mDAComboClickAction;
- LLTextBase* mDAPathfindingAttributes;
+ // Pointers cached here to speed up the "disableAll" function which gets called on idle
+ LLUICtrl* mDAPermModify;
+ LLUICtrl* mDACreatorName;
+ LLView* mDAOwner;
+ LLUICtrl* mDAOwnerName;
+ LLView* mDAButtonSetGroup;
+ LLUICtrl* mDAObjectName;
+ LLView* mDAName;
+ LLView* mDADescription;
+ LLUICtrl* mDAObjectDescription;
+ LLUICtrl* mDACheckboxShareWithGroup;
+ LLView* mDAButtonDeed;
+ LLUICtrl* mDACheckboxAllowEveryoneMove;
+ LLUICtrl* mDACheckboxAllowEveryoneCopy;
+ LLUICtrl* mDACheckboxNextOwnerCanModify;
+ LLUICtrl* mDACheckboxNextOwnerCanCopy;
+ LLUICtrl* mDACheckboxNextOwnerCanTransfer;
+ LLUICtrl* mDACheckboxForSale;
+ LLUICtrl* mDASearchCheck;
+ LLComboBox* mDAComboSaleType;
+ LLUICtrl* mDAEditCost;
+ LLView* mDALabelClickAction;
+ LLComboBox* mDAComboClickAction;
+ LLTextBase* mDAPathfindingAttributes;
LLUICtrl* mDAB;
LLUICtrl* mDAO;
LLUICtrl* mDAG;
diff --git a/indra/newview/llsidetraypanelcontainer.cpp b/indra/newview/llsidetraypanelcontainer.cpp
index e340333c2c..bf11b08f64 100644
--- a/indra/newview/llsidetraypanelcontainer.cpp
+++ b/indra/newview/llsidetraypanelcontainer.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsidetraypanelcontainer.cpp
* @brief LLSideTrayPanelContainer implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,10 +32,10 @@ static LLDefaultChildRegistry::Register<LLSideTrayPanelContainer> r2("panel_cont
std::string LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME = "sub_panel_name";
LLSideTrayPanelContainer::Params::Params()
-: default_panel_name("default_panel_name")
+: default_panel_name("default_panel_name")
{
- // Always hide tabs.
- changeDefault(hide_tabs, true);
+ // Always hide tabs.
+ changeDefault(hide_tabs, true);
}
LLSideTrayPanelContainer::LLSideTrayPanelContainer(const Params& p)
@@ -46,48 +46,48 @@ LLSideTrayPanelContainer::LLSideTrayPanelContainer(const Params& p)
void LLSideTrayPanelContainer::onOpen(const LLSD& key)
{
- // Select specified panel and save navigation history.
- if(key.has(PARAM_SUB_PANEL_NAME))
- {
- //*NOTE dzaporozhan
- // Navigation history is not used after fix for EXT-3186,
- // openPreviousPanel() always opens default panel
+ // Select specified panel and save navigation history.
+ if(key.has(PARAM_SUB_PANEL_NAME))
+ {
+ //*NOTE dzaporozhan
+ // Navigation history is not used after fix for EXT-3186,
+ // openPreviousPanel() always opens default panel
- // Save panel navigation history
- std::string panel_name = key[PARAM_SUB_PANEL_NAME];
+ // Save panel navigation history
+ std::string panel_name = key[PARAM_SUB_PANEL_NAME];
- selectTabByName(panel_name);
- }
- // Will reopen current panel if no panel name was passed.
- getCurrentPanel()->onOpen(key);
+ selectTabByName(panel_name);
+ }
+ // Will reopen current panel if no panel name was passed.
+ getCurrentPanel()->onOpen(key);
}
void LLSideTrayPanelContainer::openPanel(const std::string& panel_name, const LLSD& key)
{
- LLSD combined_key = key;
- combined_key[PARAM_SUB_PANEL_NAME] = panel_name;
- onOpen(combined_key);
+ LLSD combined_key = key;
+ combined_key[PARAM_SUB_PANEL_NAME] = panel_name;
+ onOpen(combined_key);
}
void LLSideTrayPanelContainer::openPreviousPanel()
{
- if(!mDefaultPanelName.empty())
- {
- selectTabByName(mDefaultPanelName);
- }
- else
- {
- selectTab(0);
- }
+ if(!mDefaultPanelName.empty())
+ {
+ selectTabByName(mDefaultPanelName);
+ }
+ else
+ {
+ selectTab(0);
+ }
}
BOOL LLSideTrayPanelContainer::handleKeyHere(KEY key, MASK mask)
{
- // No key press handling code for Panel Container - this disables
- // Tab Container's Alt + Left/Right Button tab switching.
-
- // Let default handler process key presses, don't simply return TRUE or FALSE
- // as this may brake some functionality as it did with Copy/Paste for
- // text_editor (ticket EXT-642).
- return LLPanel::handleKeyHere(key, mask);
+ // No key press handling code for Panel Container - this disables
+ // Tab Container's Alt + Left/Right Button tab switching.
+
+ // Let default handler process key presses, don't simply return TRUE or FALSE
+ // as this may brake some functionality as it did with Copy/Paste for
+ // text_editor (ticket EXT-642).
+ return LLPanel::handleKeyHere(key, mask);
}
diff --git a/indra/newview/llsidetraypanelcontainer.h b/indra/newview/llsidetraypanelcontainer.h
index 93a85ed374..a31a3640d8 100644
--- a/indra/newview/llsidetraypanelcontainer.h
+++ b/indra/newview/llsidetraypanelcontainer.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsidetraypanelcontainer.h
* @brief LLSideTrayPanelContainer class declaration
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,62 +35,62 @@
* calls and related workarounds.
* use onOpen to open sub panel, pass the name of panel to open
* in key[PARAM_SUB_PANEL_NAME].
-* LLSideTrayPanelContainer also implements panel navigation history - it allows to
-* open previous or next panel if navigation history is available(after user
+* LLSideTrayPanelContainer also implements panel navigation history - it allows to
+* open previous or next panel if navigation history is available(after user
* has opened two or more panels). *NOTE - only back navigation is implemented so far.
*/
class LLSideTrayPanelContainer : public LLTabContainer
{
public:
- struct Params : public LLInitParam::Block<Params, LLTabContainer::Params>
- {
- Optional<std::string> default_panel_name;
- Params();
- };
+ struct Params : public LLInitParam::Block<Params, LLTabContainer::Params>
+ {
+ Optional<std::string> default_panel_name;
+ Params();
+ };
- /**
- * Opens sub panel
- * @param key - params to be passed to panel, use key[PARAM_SUB_PANEL_NAME]
- * to specify panel name to be opened.
- */
- /*virtual*/ void onOpen(const LLSD& key);
+ /**
+ * Opens sub panel
+ * @param key - params to be passed to panel, use key[PARAM_SUB_PANEL_NAME]
+ * to specify panel name to be opened.
+ */
+ /*virtual*/ void onOpen(const LLSD& key);
- /**
- * Opens given subpanel.
- */
- void openPanel(const std::string& panel_name, const LLSD& key = LLSD::emptyMap());
+ /**
+ * Opens given subpanel.
+ */
+ void openPanel(const std::string& panel_name, const LLSD& key = LLSD::emptyMap());
- /**
- * Opens previous panel from panel navigation history.
- */
- void openPreviousPanel();
+ /**
+ * Opens previous panel from panel navigation history.
+ */
+ void openPreviousPanel();
- /**
- * Overrides LLTabContainer::handleKeyHere to disable panel switch on
- * Alt + Left/Right button press.
- */
- BOOL handleKeyHere(KEY key, MASK mask);
+ /**
+ * Overrides LLTabContainer::handleKeyHere to disable panel switch on
+ * Alt + Left/Right button press.
+ */
+ BOOL handleKeyHere(KEY key, MASK mask);
- /**
- * Name of parameter that stores panel name to open.
- */
- static std::string PARAM_SUB_PANEL_NAME;
+ /**
+ * Name of parameter that stores panel name to open.
+ */
+ static std::string PARAM_SUB_PANEL_NAME;
protected:
- LLSideTrayPanelContainer(const Params& p);
- friend class LLUICtrlFactory;
+ LLSideTrayPanelContainer(const Params& p);
+ friend class LLUICtrlFactory;
- /**
- * std::string - name of panel
- * S32 - index of previous panel
- * *NOTE - no forward navigation implemented yet
- */
- typedef std::map<std::string, S32> panel_navigation_history_t;
+ /**
+ * std::string - name of panel
+ * S32 - index of previous panel
+ * *NOTE - no forward navigation implemented yet
+ */
+ typedef std::map<std::string, S32> panel_navigation_history_t;
- // Navigation history
- panel_navigation_history_t mPanelHistory;
- std::string mDefaultPanelName;
+ // Navigation history
+ panel_navigation_history_t mPanelHistory;
+ std::string mDefaultPanelName;
};
#endif //LL_LLSIDETRAY_PANEL_CONTAINER_H
diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp
index 8bdccfd9f6..438b04ff39 100644
--- a/indra/newview/llskinningutil.cpp
+++ b/indra/newview/llskinningutil.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llskinningutil.cpp
* @brief Functions for mesh object skinning
* @author vir@lindenlab.com
@@ -45,14 +45,14 @@ void dump_avatar_and_skin_state(const std::string& reason, LLVOAvatar *avatar, c
if (dump_count < max_dump)
{
LL_WARNS("Avatar") << avatar->getFullname() << " dumping, reason " << reason
- << " avatar build state: isBuilt() " << avatar->isBuilt()
+ << " avatar build state: isBuilt() " << avatar->isBuilt()
<< " mInitFlags " << avatar->mInitFlags << LL_ENDL;
LL_WARNS("Avatar") << "Skin num joints " << skin->mJointNames.size() << " " << skin->mJointNums.size() << LL_ENDL;
- LL_WARNS("Avatar") << "Skin scrubbed " << skin->mInvalidJointsScrubbed
+ LL_WARNS("Avatar") << "Skin scrubbed " << skin->mInvalidJointsScrubbed
<< " nums init " << skin->mJointNumsInitialized << LL_ENDL;
for (S32 j=0; j<skin->mJointNames.size(); j++)
{
- LL_WARNS("Avatar") << "skin joint idx " << j << " name [" << skin->mJointNames[j]
+ LL_WARNS("Avatar") << "skin joint idx " << j << " name [" << skin->mJointNames[j]
<< "] num " << skin->mJointNums[j] << LL_ENDL;
const std::string& name = skin->mJointNames[j];
S32 joint_num = skin->mJointNums[j];
@@ -61,11 +61,11 @@ void dump_avatar_and_skin_state(const std::string& reason, LLVOAvatar *avatar, c
LLJoint *num_joint = avatar->getJoint(joint_num);
if (!name_joint)
{
- LL_WARNS("Avatar") << "failed to find joint by name" << LL_ENDL;
+ LL_WARNS("Avatar") << "failed to find joint by name" << LL_ENDL;
}
if (!num_joint)
{
- LL_WARNS("Avatar") << "failed to find joint by num" << LL_ENDL;
+ LL_WARNS("Avatar") << "failed to find joint by num" << LL_ENDL;
}
if (num_joint != name_joint)
{
@@ -94,7 +94,7 @@ S32 LLSkinningUtil::getMaxJointCount()
U32 LLSkinningUtil::getMeshJointCount(const LLMeshSkinInfo *skin)
{
- return llmin((U32)getMaxJointCount(), (U32)skin->mJointNames.size());
+ return llmin((U32)getMaxJointCount(), (U32)skin->mJointNames.size());
}
void LLSkinningUtil::scrubInvalidJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin)
@@ -121,7 +121,7 @@ void LLSkinningUtil::scrubInvalidJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin
void LLSkinningUtil::initSkinningMatrixPalette(
LLMatrix4a* mat,
- S32 count,
+ S32 count,
const LLMeshSkinInfo* skin,
LLVOAvatar *avatar)
{
@@ -174,11 +174,11 @@ void LLSkinningUtil::initSkinningMatrixPalette(
void LLSkinningUtil::checkSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin)
{
#if DEBUG_SKINNING
- const S32 max_joints = skin->mJointNames.size();
+ const S32 max_joints = skin->mJointNames.size();
for (U32 j=0; j<num_vertices; j++)
{
F32 *w = weights[j].getF32ptr();
-
+
F32 wsum = 0.0;
for (U32 k=0; k<4; ++k)
{
@@ -207,7 +207,7 @@ void LLSkinningUtil::scrubSkinWeights(LLVector4a* weights, U32 num_vertices, con
w[k] = i + f;
}
}
- checkSkinWeights(weights, num_vertices, skin);
+ checkSkinWeights(weights, num_vertices, skin);
}
void LLSkinningUtil::getPerVertexSkinMatrix(
@@ -276,7 +276,7 @@ void LLSkinningUtil::initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar)
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
for (U32 j = 0; j < skin->mJointNames.size(); ++j)
{
- #if DEBUG_SKINNING
+ #if DEBUG_SKINNING
LLJoint *joint = NULL;
if (skin->mJointNums[j] == -1)
{
@@ -300,7 +300,7 @@ void LLSkinningUtil::initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar)
}
#else
LLJoint *joint = (skin->mJointNums[j] == -1) ? avatar->getJoint(skin->mJointNames[j]) : avatar->getJoint(skin->mJointNums[j]);
- skin->mJointNums[j] = joint ? joint->getJointNum() : 0;
+ skin->mJointNums[j] = joint ? joint->getJointNum() : 0;
#endif
// insure we have *a* valid joint to reference
llassert(skin->mJointNums[j] >= 0);
@@ -352,7 +352,7 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
}
for (U32 k=0; k<4; ++k)
{
- S32 joint_index = idx[k];
+ S32 joint_index = idx[k];
if (wght[k] > 0.0f && num_joints > joint_index)
{
S32 joint_num = skin->mJointNums[joint_index];
@@ -377,11 +377,11 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
}
}
}
- //LL_DEBUGS("RigSpammish") << "built rigging info for vf " << &vol_face
+ //LL_DEBUGS("RigSpammish") << "built rigging info for vf " << &vol_face
// << " num_verts " << vol_face.mNumVertices
// << " active joints " << active_joints.size()
// << " active verts " << active_verts
- // << LL_ENDL;
+ // << LL_ENDL;
vol_face.mJointRiggingInfoTab.setNeedsUpdate(false);
}
}
@@ -389,13 +389,13 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
#if DEBUG_SKINNING
if (vol_face.mJointRiggingInfoTab.size()!=0)
{
- LL_DEBUGS("RigSpammish") << "we have rigging info for vf " << &vol_face
- << " num_verts " << vol_face.mNumVertices << LL_ENDL;
+ LL_DEBUGS("RigSpammish") << "we have rigging info for vf " << &vol_face
+ << " num_verts " << vol_face.mNumVertices << LL_ENDL;
}
else
{
- LL_DEBUGS("RigSpammish") << "no rigging info for vf " << &vol_face
- << " num_verts " << vol_face.mNumVertices << LL_ENDL;
+ LL_DEBUGS("RigSpammish") << "no rigging info for vf " << &vol_face
+ << " num_verts " << vol_face.mNumVertices << LL_ENDL;
}
#endif
diff --git a/indra/newview/llskinningutil.h b/indra/newview/llskinningutil.h
index 807418f983..bd2f8ea04e 100644
--- a/indra/newview/llskinningutil.h
+++ b/indra/newview/llskinningutil.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llskinningutil.h
* @brief Functions for mesh object skinning
* @author vir@lindenlab.com
@@ -53,13 +53,13 @@ namespace LLSkinningUtil
LLMatrix4a* mat,
LLMatrix4a& final_mat,
LLMatrix4a* src)
- {
+ {
final_mat.clear();
src[0].setMul(mat[idx[0]], weights[0]);
src[1].setMul(mat[idx[1]], weights[1]);
final_mat.add(src[0]);
final_mat.add(src[1]);
- src[2].setMul(mat[idx[2]], weights[2]);
+ src[2].setMul(mat[idx[2]], weights[2]);
src[3].setMul(mat[idx[3]], weights[3]);
final_mat.add(src[2]);
final_mat.add(src[3]);
@@ -67,7 +67,7 @@ namespace LLSkinningUtil
void initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar);
void updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, LLVolumeFace& vol_face);
- LLQuaternion getUnscaledQuaternion(const LLMatrix4& mat4);
+ LLQuaternion getUnscaledQuaternion(const LLMatrix4& mat4);
};
#endif
diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index 4926b86b14..dc784662e9 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -1,35 +1,35 @@
-/**
+/**
* @file llsky.cpp
- * @brief IndraWorld sky class
+ * @brief IndraWorld sky class
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-// Ideas:
-// -haze should be controlled by global query from sims
-// -need secondary optical effects on sun (flare)
-// -stars should be brought down from sims
-// -star intensity should be driven by global ambient level from sims,
-// so that eclipses, etc can be easily done.
+// Ideas:
+// -haze should be controlled by global query from sims
+// -need secondary optical effects on sun (flare)
+// -stars should be brought down from sims
+// -star intensity should be driven by global ambient level from sims,
+// so that eclipses, etc can be easily done.
//
#include "llviewerprecompiledheaders.h"
@@ -67,13 +67,13 @@ LLSky gSky;
LLSky::LLSky()
{
- // Set initial clear color to black
- // Set fog color
- mFogColor.mV[VRED] = mFogColor.mV[VGREEN] = mFogColor.mV[VBLUE] = 0.5f;
- mFogColor.mV[VALPHA] = 0.0f;
+ // Set initial clear color to black
+ // Set fog color
+ mFogColor.mV[VRED] = mFogColor.mV[VGREEN] = mFogColor.mV[VBLUE] = 0.5f;
+ mFogColor.mV[VALPHA] = 0.0f;
- mLightingGeneration = 0;
- mUpdatedThisFrame = TRUE;
+ mLightingGeneration = 0;
+ mUpdatedThisFrame = TRUE;
}
@@ -83,47 +83,47 @@ LLSky::~LLSky()
void LLSky::cleanup()
{
- mVOSkyp = NULL;
- mVOWLSkyp = NULL;
+ mVOSkyp = NULL;
+ mVOWLSkyp = NULL;
}
void LLSky::destroyGL()
{
- if (!mVOSkyp.isNull() && mVOSkyp->getCubeMap())
- {
- mVOSkyp->cleanupGL();
- }
- if (mVOWLSkyp.notNull())
- {
- mVOWLSkyp->cleanupGL();
- }
+ if (!mVOSkyp.isNull() && mVOSkyp->getCubeMap())
+ {
+ mVOSkyp->cleanupGL();
+ }
+ if (mVOWLSkyp.notNull())
+ {
+ mVOWLSkyp->cleanupGL();
+ }
}
void LLSky::restoreGL()
{
- if (mVOSkyp)
- {
- mVOSkyp->restoreGL();
- }
- if (mVOWLSkyp)
- {
- mVOWLSkyp->restoreGL();
- }
+ if (mVOSkyp)
+ {
+ mVOSkyp->restoreGL();
+ }
+ if (mVOWLSkyp)
+ {
+ mVOWLSkyp->restoreGL();
+ }
}
void LLSky::resetVertexBuffers()
{
- if (gSky.mVOSkyp.notNull())
- {
- gPipeline.resetVertexBuffers(gSky.mVOSkyp->mDrawable);
- gPipeline.markRebuild(gSky.mVOSkyp->mDrawable, LLDrawable::REBUILD_ALL);
- }
- if (gSky.mVOWLSkyp.notNull())
- {
- gSky.mVOWLSkyp->resetVertexBuffers();
- gPipeline.resetVertexBuffers(gSky.mVOWLSkyp->mDrawable);
- gPipeline.markRebuild(gSky.mVOWLSkyp->mDrawable, LLDrawable::REBUILD_ALL);
- }
+ if (gSky.mVOSkyp.notNull())
+ {
+ gPipeline.resetVertexBuffers(gSky.mVOSkyp->mDrawable);
+ gPipeline.markRebuild(gSky.mVOSkyp->mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ if (gSky.mVOWLSkyp.notNull())
+ {
+ gSky.mVOWLSkyp->resetVertexBuffers();
+ gPipeline.resetVertexBuffers(gSky.mVOWLSkyp->mDrawable);
+ gPipeline.markRebuild(gSky.mVOWLSkyp->mDrawable, LLDrawable::REBUILD_ALL);
+ }
}
void LLSky::setSunScale(F32 sun_scale)
@@ -131,7 +131,7 @@ void LLSky::setSunScale(F32 sun_scale)
if(mVOSkyp.notNull())
{
mVOSkyp->setSunScale(sun_scale);
- }
+ }
}
void LLSky::setMoonScale(F32 moon_scale)
@@ -139,56 +139,56 @@ void LLSky::setMoonScale(F32 moon_scale)
if(mVOSkyp.notNull())
{
mVOSkyp->setMoonScale(moon_scale);
- }
+ }
}
void LLSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next)
{
if(mVOSkyp.notNull()) {
mVOSkyp->setSunTextures(sun_texture, sun_texture_next);
- }
+ }
}
void LLSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next)
{
if(mVOSkyp.notNull()) {
mVOSkyp->setMoonTextures(moon_texture, moon_texture_next);
- }
+ }
}
void LLSky::setCloudNoiseTextures(const LLUUID& cloud_noise_texture, const LLUUID& cloud_noise_texture_next)
{
if(mVOSkyp.notNull()) {
mVOSkyp->setCloudNoiseTextures(cloud_noise_texture, cloud_noise_texture_next);
- }
+ }
}
void LLSky::setBloomTextures(const LLUUID& bloom_texture, const LLUUID& bloom_texture_next)
{
if(mVOSkyp.notNull()) {
mVOSkyp->setBloomTextures(bloom_texture, bloom_texture_next);
- }
+ }
}
void LLSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLVector3 &moon_direction)
{
if(mVOSkyp.notNull()) {
mVOSkyp->setSunAndMoonDirectionsCFR(sun_direction, moon_direction);
- }
+ }
}
void LLSky::setSunDirectionCFR(const LLVector3 &sun_direction)
{
if(mVOSkyp.notNull()) {
mVOSkyp->setSunDirectionCFR(sun_direction);
- }
+ }
}
void LLSky::setMoonDirectionCFR(const LLVector3 &moon_direction)
{
if(mVOSkyp.notNull()) {
mVOSkyp->setMoonDirectionCFR(moon_direction);
- }
+ }
}
//////////////////////////////////////////////////////////////////////
@@ -197,52 +197,52 @@ void LLSky::setMoonDirectionCFR(const LLVector3 &moon_direction)
void LLSky::init()
{
- mVOWLSkyp = static_cast<LLVOWLSky*>(gObjectList.createObjectViewer(LLViewerObject::LL_VO_WL_SKY, NULL));
+ mVOWLSkyp = static_cast<LLVOWLSky*>(gObjectList.createObjectViewer(LLViewerObject::LL_VO_WL_SKY, NULL));
mVOWLSkyp->init();
- gPipeline.createObject(mVOWLSkyp.get());
+ gPipeline.createObject(mVOWLSkyp.get());
- mVOSkyp = (LLVOSky *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_SKY, NULL);
+ mVOSkyp = (LLVOSky *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_SKY, NULL);
mVOSkyp->init();
- gPipeline.createObject(mVOSkyp.get());
+ gPipeline.createObject(mVOSkyp.get());
- gSky.setFogRatio(gSavedSettings.getF32("RenderFogRatio"));
+ gSky.setFogRatio(gSavedSettings.getF32("RenderFogRatio"));
- mUpdatedThisFrame = TRUE;
+ mUpdatedThisFrame = TRUE;
}
void LLSky::setCloudDensityAtAgent(F32 cloud_density)
{
- if (mVOSkyp)
- {
- mVOSkyp->setCloudDensity(cloud_density);
- }
+ if (mVOSkyp)
+ {
+ mVOSkyp->setCloudDensity(cloud_density);
+ }
}
void LLSky::setWind(const LLVector3& average_wind)
{
- if (mVOSkyp)
- {
- mVOSkyp->setWind(average_wind);
- }
+ if (mVOSkyp)
+ {
+ mVOSkyp->setWind(average_wind);
+ }
}
void LLSky::addSunMoonBeacons()
-{
- if (!gAgentAvatarp || !mVOSkyp) return;
-
- static LLUICachedControl<bool> show_sun_beacon("sunbeacon", false);
- static LLUICachedControl<bool> show_moon_beacon("moonbeacon", false);
-
- if (show_sun_beacon)
- {
- renderSunMoonBeacons(gAgentAvatarp->getPositionAgent(), mVOSkyp->getSun().getDirection(), LLColor4(1.f, 0.5f, 0.f, 0.5f));
- }
- if (show_moon_beacon)
- {
- renderSunMoonBeacons(gAgentAvatarp->getPositionAgent(), mVOSkyp->getMoon().getDirection(), LLColor4(1.f, 0.f, 0.8f, 0.5f));
- }
+{
+ if (!gAgentAvatarp || !mVOSkyp) return;
+
+ static LLUICachedControl<bool> show_sun_beacon("sunbeacon", false);
+ static LLUICachedControl<bool> show_moon_beacon("moonbeacon", false);
+
+ if (show_sun_beacon)
+ {
+ renderSunMoonBeacons(gAgentAvatarp->getPositionAgent(), mVOSkyp->getSun().getDirection(), LLColor4(1.f, 0.5f, 0.f, 0.5f));
+ }
+ if (show_moon_beacon)
+ {
+ renderSunMoonBeacons(gAgentAvatarp->getPositionAgent(), mVOSkyp->getMoon().getDirection(), LLColor4(1.f, 0.f, 0.8f, 0.5f));
+ }
}
//////////////////////////////////////////////////////////////////////
@@ -252,82 +252,82 @@ void LLSky::addSunMoonBeacons()
LLColor4 LLSky::getSkyFogColor() const
{
- if (mVOSkyp)
- {
- return mVOSkyp->getSkyFogColor();
- }
+ if (mVOSkyp)
+ {
+ return mVOSkyp->getSkyFogColor();
+ }
- return LLColor4(1.f, 1.f, 1.f, 1.f);
+ return LLColor4(1.f, 1.f, 1.f, 1.f);
}
void LLSky::updateFog(const F32 distance)
{
- if (mVOSkyp)
- {
- mVOSkyp->updateFog(distance);
- }
+ if (mVOSkyp)
+ {
+ mVOSkyp->updateFog(distance);
+ }
}
void LLSky::updateCull()
{
- // *TODO: do culling for wl sky properly -Brad
+ // *TODO: do culling for wl sky properly -Brad
}
void LLSky::updateSky()
{
- if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))
- {
- return;
- }
- if (mVOSkyp)
- {
- mVOSkyp->updateSky();
- }
+ if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))
+ {
+ return;
+ }
+ if (mVOSkyp)
+ {
+ mVOSkyp->updateSky();
+ }
}
void LLSky::setFogRatio(const F32 fog_ratio)
{
- if (mVOSkyp)
- {
- mVOSkyp->setFogRatio(fog_ratio);
- }
+ if (mVOSkyp)
+ {
+ mVOSkyp->setFogRatio(fog_ratio);
+ }
}
F32 LLSky::getFogRatio() const
{
- if (mVOSkyp)
- {
- return mVOSkyp->getFogRatio();
- }
- else
- {
- return 0.f;
- }
+ if (mVOSkyp)
+ {
+ return mVOSkyp->getFogRatio();
+ }
+ else
+ {
+ return 0.f;
+ }
}
-// Returns angle (DEGREES) between the horizontal plane and "v",
+// Returns angle (DEGREES) between the horizontal plane and "v",
// where the angle is negative when v.mV[VZ] < 0.0f
F32 elevation_from_vector(const LLVector3 &v)
{
- F32 elevation = 0.0f;
- F32 xy_component = (F32) sqrt(v.mV[VX] * v.mV[VX] + v.mV[VY] * v.mV[VY]);
- if (xy_component != 0.0f)
- {
- elevation = RAD_TO_DEG * (F32) atan(v.mV[VZ]/xy_component);
- }
- else
- {
- if (v.mV[VZ] > 0.f)
- {
- elevation = 90.f;
- }
- else
- {
- elevation = -90.f;
- }
- }
- return elevation;
+ F32 elevation = 0.0f;
+ F32 xy_component = (F32) sqrt(v.mV[VX] * v.mV[VX] + v.mV[VY] * v.mV[VY]);
+ if (xy_component != 0.0f)
+ {
+ elevation = RAD_TO_DEG * (F32) atan(v.mV[VZ]/xy_component);
+ }
+ else
+ {
+ if (v.mV[VZ] > 0.f)
+ {
+ elevation = 90.f;
+ }
+ else
+ {
+ elevation = -90.f;
+ }
+ }
+ return elevation;
}
diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h
index cce645e2be..4ece232156 100644
--- a/indra/newview/llsky.h
+++ b/indra/newview/llsky.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsky.h
* @brief It's, uh, the sky!
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,14 +40,14 @@ class LLViewerCamera;
class LLVOWLSky;
-class LLSky
+class LLSky
{
public:
- LLSky();
- ~LLSky();
+ LLSky();
+ ~LLSky();
- void init();
- void cleanup();
+ void init();
+ void cleanup();
// These directions should be in CFR coord sys (+x at, +z up, +y right)
void setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLVector3 &moon_direction);
@@ -62,32 +62,32 @@ public:
void setSunScale(F32 sun_scale);
void setMoonScale(F32 moon_scale);
- LLColor4 getSkyFogColor() const;
+ LLColor4 getSkyFogColor() const;
- void setCloudDensityAtAgent(F32 cloud_density);
- void setWind(const LLVector3& wind);
+ void setCloudDensityAtAgent(F32 cloud_density);
+ void setWind(const LLVector3& wind);
- void updateFog(const F32 distance);
- void updateCull();
- void updateSky();
+ void updateFog(const F32 distance);
+ void updateCull();
+ void updateSky();
- S32 mLightingGeneration;
- BOOL mUpdatedThisFrame;
+ S32 mLightingGeneration;
+ BOOL mUpdatedThisFrame;
- void setFogRatio(const F32 fog_ratio); // Fog distance as fraction of cull distance.
- F32 getFogRatio() const;
- LLColor4U getFadeColor() const;
+ void setFogRatio(const F32 fog_ratio); // Fog distance as fraction of cull distance.
+ F32 getFogRatio() const;
+ LLColor4U getFadeColor() const;
- void destroyGL();
- void restoreGL();
- void resetVertexBuffers();
+ void destroyGL();
+ void restoreGL();
+ void resetVertexBuffers();
- void addSunMoonBeacons();
- void renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& direction, LLColor4 color);
+ void addSunMoonBeacons();
+ void renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& direction, LLColor4 color);
public:
- LLPointer<LLVOSky> mVOSkyp; // Pointer to the LLVOSky object (only one, ever!)
- LLPointer<LLVOWLSky> mVOWLSkyp;
+ LLPointer<LLVOSky> mVOSkyp; // Pointer to the LLVOSky object (only one, ever!)
+ LLPointer<LLVOWLSky> mVOWLSkyp;
protected:
LLColor4 mFogColor;
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index e43fb993ce..432ec3899a 100644
--- a/indra/newview/llslurl.cpp
+++ b/indra/newview/llslurl.cpp
@@ -34,17 +34,17 @@
#include "llviewernetwork.h"
#include "llfiltersd2xmlrpc.h"
#include "curl/curl.h"
-const char* LLSLURL::SLURL_HTTP_SCHEME = "http";
-const char* LLSLURL::SLURL_HTTPS_SCHEME = "https";
+const char* LLSLURL::SLURL_HTTP_SCHEME = "http";
+const char* LLSLURL::SLURL_HTTPS_SCHEME = "https";
const char* LLSLURL::SLURL_SECONDLIFE_SCHEME = "secondlife";
-const char* LLSLURL::SLURL_SECONDLIFE_PATH = "secondlife";
-const char* LLSLURL::SLURL_COM = "slurl.com";
+const char* LLSLURL::SLURL_SECONDLIFE_PATH = "secondlife";
+const char* LLSLURL::SLURL_COM = "slurl.com";
// For DnD - even though www.slurl.com redirects to slurl.com in a browser, you can copy and drag
// text with www.slurl.com or a link explicitly pointing at www.slurl.com so testing for this
// version is required also.
-const char* LLSLURL::WWW_SLURL_COM = "www.slurl.com";
-const char* LLSLURL::MAPS_SECONDLIFE_COM = "maps.secondlife.com";
+const char* LLSLURL::WWW_SLURL_COM = "www.slurl.com";
+const char* LLSLURL::MAPS_SECONDLIFE_COM = "maps.secondlife.com";
const char* LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME = "x-grid-location-info";
const char* LLSLURL::SLURL_APP_PATH = "app";
const char* LLSLURL::SLURL_REGION_PATH = "region";
diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h
index 6132a4a8b0..c7419778da 100644
--- a/indra/newview/llslurl.h
+++ b/indra/newview/llslurl.h
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,81 +35,81 @@
class LLSLURL
{
public:
- static const char* SLURL_HTTPS_SCHEME;
- static const char* SLURL_HTTP_SCHEME;
- static const char* SLURL_SL_SCHEME;
- static const char* SLURL_SECONDLIFE_SCHEME;
- static const char* SLURL_SECONDLIFE_PATH;
- static const char* SLURL_COM;
- static const char* WWW_SLURL_COM;
- static const char* SECONDLIFE_COM;
- static const char* MAPS_SECONDLIFE_COM;
- static const char* SLURL_X_GRID_LOCATION_INFO_SCHEME;
- static LLSLURL START_LOCATION;
- static const char* SIM_LOCATION_HOME;
- static const char* SIM_LOCATION_LAST;
- static const char* SLURL_APP_PATH;
- static const char* SLURL_REGION_PATH;
-
- // if you modify this enumeration, update typeName as well
- enum SLURL_TYPE {
- INVALID,
- LOCATION,
- HOME_LOCATION,
- LAST_LOCATION,
- APP,
- HELP,
- EMPTY,
- NUM_SLURL_TYPES // must be last
- };
-
-
- LLSLURL(): mType(INVALID) { }
- LLSLURL(const std::string& slurl);
- LLSLURL(const std::string& grid, const std::string& region);
- LLSLURL(const std::string& region, const LLVector3& position);
- LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position);
- LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position);
- LLSLURL(const std::string& region, const LLVector3d& global_position);
- LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
-
- SLURL_TYPE getType() const { return mType; }
-
- std::string getSLURLString() const;
- std::string getLoginString() const;
- std::string getLocationString() const;
- std::string getGrid() const { return mGrid; }
- std::string getRegion() const { return mRegion; }
- LLVector3 getPosition() const { return mPosition; }
- std::string getAppCmd() const { return mAppCmd; }
- std::string getAppQuery() const { return mAppQuery; }
- LLSD getAppQueryMap() const { return mAppQueryMap; }
- LLSD getAppPath() const { return mAppPath; }
-
- bool isValid() const { return mType != INVALID; }
- bool isSpatial() const { return (mType == LAST_LOCATION) || (mType == HOME_LOCATION) || (mType == LOCATION); }
-
- bool operator==(const LLSLURL& rhs);
- bool operator!=(const LLSLURL&rhs);
+ static const char* SLURL_HTTPS_SCHEME;
+ static const char* SLURL_HTTP_SCHEME;
+ static const char* SLURL_SL_SCHEME;
+ static const char* SLURL_SECONDLIFE_SCHEME;
+ static const char* SLURL_SECONDLIFE_PATH;
+ static const char* SLURL_COM;
+ static const char* WWW_SLURL_COM;
+ static const char* SECONDLIFE_COM;
+ static const char* MAPS_SECONDLIFE_COM;
+ static const char* SLURL_X_GRID_LOCATION_INFO_SCHEME;
+ static LLSLURL START_LOCATION;
+ static const char* SIM_LOCATION_HOME;
+ static const char* SIM_LOCATION_LAST;
+ static const char* SLURL_APP_PATH;
+ static const char* SLURL_REGION_PATH;
+
+ // if you modify this enumeration, update typeName as well
+ enum SLURL_TYPE {
+ INVALID,
+ LOCATION,
+ HOME_LOCATION,
+ LAST_LOCATION,
+ APP,
+ HELP,
+ EMPTY,
+ NUM_SLURL_TYPES // must be last
+ };
+
+
+ LLSLURL(): mType(INVALID) { }
+ LLSLURL(const std::string& slurl);
+ LLSLURL(const std::string& grid, const std::string& region);
+ LLSLURL(const std::string& region, const LLVector3& position);
+ LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position);
+ LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position);
+ LLSLURL(const std::string& region, const LLVector3d& global_position);
+ LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
+
+ SLURL_TYPE getType() const { return mType; }
+
+ std::string getSLURLString() const;
+ std::string getLoginString() const;
+ std::string getLocationString() const;
+ std::string getGrid() const { return mGrid; }
+ std::string getRegion() const { return mRegion; }
+ LLVector3 getPosition() const { return mPosition; }
+ std::string getAppCmd() const { return mAppCmd; }
+ std::string getAppQuery() const { return mAppQuery; }
+ LLSD getAppQueryMap() const { return mAppQueryMap; }
+ LLSD getAppPath() const { return mAppPath; }
+
+ bool isValid() const { return mType != INVALID; }
+ bool isSpatial() const { return (mType == LAST_LOCATION) || (mType == HOME_LOCATION) || (mType == LOCATION); }
+
+ bool operator==(const LLSLURL& rhs);
+ bool operator!=(const LLSLURL&rhs);
std::string asString() const ;
protected:
- static const std::string typeName[NUM_SLURL_TYPES];
- /// Get a human-readable version of the type for logging
- static std::string getTypeString(SLURL_TYPE type);
-
- SLURL_TYPE mType;
-
- // used for Apps and Help
- std::string mAppCmd;
- LLSD mAppPath;
- LLSD mAppQueryMap;
- std::string mAppQuery;
-
- std::string mGrid; // reference to grid manager grid
- std::string mRegion;
- LLVector3 mPosition;
+ static const std::string typeName[NUM_SLURL_TYPES];
+ /// Get a human-readable version of the type for logging
+ static std::string getTypeString(SLURL_TYPE type);
+
+ SLURL_TYPE mType;
+
+ // used for Apps and Help
+ std::string mAppCmd;
+ LLSD mAppPath;
+ LLSD mAppQueryMap;
+ std::string mAppQuery;
+
+ std::string mGrid; // reference to grid manager grid
+ std::string mRegion;
+ LLVector3 mPosition;
};
#endif // LLSLURL_H
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index 2ff8f50277..ef0f58ff7a 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsnapshotlivepreview.cpp
* @brief Implementation of llsnapshotlivepreview
* @author Gilbert@lindenlab.com
@@ -49,7 +49,7 @@
#include "llsnapshotlivepreview.h"
#include "lltoolfocus.h"
#include "llviewercontrol.h"
-#include "llviewermenufile.h" // upload_new_resource()
+#include "llviewermenufile.h" // upload_new_resource()
#include "llviewerstats.h"
#include "llviewertexturelist.h"
#include "llwindow.h"
@@ -70,104 +70,104 @@ const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
std::set<LLSnapshotLivePreview*> LLSnapshotLivePreview::sList;
LLPointer<LLImageFormatted> LLSnapshotLivePreview::sSaveLocalImage = NULL;
-LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Params& p)
- : LLView(p),
- mColor(1.f, 0.f, 0.f, 0.5f),
- mCurImageIndex(0),
- mPreviewImage(NULL),
+LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Params& p)
+ : LLView(p),
+ mColor(1.f, 0.f, 0.f, 0.5f),
+ mCurImageIndex(0),
+ mPreviewImage(NULL),
mThumbnailImage(NULL) ,
mBigThumbnailImage(NULL) ,
- mThumbnailWidth(0),
- mThumbnailHeight(0),
+ mThumbnailWidth(0),
+ mThumbnailHeight(0),
mThumbnailSubsampled(FALSE),
- mPreviewImageEncoded(NULL),
- mFormattedImage(NULL),
- mShineCountdown(0),
- mFlashAlpha(0.f),
- mNeedsFlash(TRUE),
- mSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")),
- mDataSize(0),
- mSnapshotType(LLSnapshotModel::SNAPSHOT_POSTCARD),
- mSnapshotFormat(LLSnapshotModel::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))),
- mSnapshotUpToDate(FALSE),
- mCameraPos(LLViewerCamera::getInstance()->getOrigin()),
- mCameraRot(LLViewerCamera::getInstance()->getQuaternion()),
- mSnapshotActive(FALSE),
- mSnapshotBufferType(LLSnapshotModel::SNAPSHOT_TYPE_COLOR),
+ mPreviewImageEncoded(NULL),
+ mFormattedImage(NULL),
+ mShineCountdown(0),
+ mFlashAlpha(0.f),
+ mNeedsFlash(TRUE),
+ mSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")),
+ mDataSize(0),
+ mSnapshotType(LLSnapshotModel::SNAPSHOT_POSTCARD),
+ mSnapshotFormat(LLSnapshotModel::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))),
+ mSnapshotUpToDate(FALSE),
+ mCameraPos(LLViewerCamera::getInstance()->getOrigin()),
+ mCameraRot(LLViewerCamera::getInstance()->getQuaternion()),
+ mSnapshotActive(FALSE),
+ mSnapshotBufferType(LLSnapshotModel::SNAPSHOT_TYPE_COLOR),
mFilterName(""),
mAllowRenderUI(TRUE),
mAllowFullScreenPreview(TRUE),
mViewContainer(NULL)
{
- setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality"));
- mSnapshotDelayTimer.setTimerExpirySec(0.0f);
- mSnapshotDelayTimer.start();
- // gIdleCallbacks.addFunction( &LLSnapshotLivePreview::onIdle, (void*)this );
- sList.insert(this);
- setFollowsAll();
- mWidth[0] = gViewerWindow->getWindowWidthRaw();
- mWidth[1] = gViewerWindow->getWindowWidthRaw();
- mHeight[0] = gViewerWindow->getWindowHeightRaw();
- mHeight[1] = gViewerWindow->getWindowHeightRaw();
- mImageScaled[0] = FALSE;
- mImageScaled[1] = FALSE;
-
- mMaxImageSize = MAX_SNAPSHOT_IMAGE_SIZE ;
- mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ;
- mThumbnailUpdateLock = FALSE ;
- mThumbnailUpToDate = FALSE ;
- mBigThumbnailUpToDate = FALSE ;
-
- mForceUpdateSnapshot = FALSE;
+ setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality"));
+ mSnapshotDelayTimer.setTimerExpirySec(0.0f);
+ mSnapshotDelayTimer.start();
+ // gIdleCallbacks.addFunction( &LLSnapshotLivePreview::onIdle, (void*)this );
+ sList.insert(this);
+ setFollowsAll();
+ mWidth[0] = gViewerWindow->getWindowWidthRaw();
+ mWidth[1] = gViewerWindow->getWindowWidthRaw();
+ mHeight[0] = gViewerWindow->getWindowHeightRaw();
+ mHeight[1] = gViewerWindow->getWindowHeightRaw();
+ mImageScaled[0] = FALSE;
+ mImageScaled[1] = FALSE;
+
+ mMaxImageSize = MAX_SNAPSHOT_IMAGE_SIZE ;
+ mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ;
+ mThumbnailUpdateLock = FALSE ;
+ mThumbnailUpToDate = FALSE ;
+ mBigThumbnailUpToDate = FALSE ;
+
+ mForceUpdateSnapshot = FALSE;
}
LLSnapshotLivePreview::~LLSnapshotLivePreview()
{
- // delete images
- mPreviewImage = NULL;
- mPreviewImageEncoded = NULL;
- mFormattedImage = NULL;
-
- // gIdleCallbacks.deleteFunction( &LLSnapshotLivePreview::onIdle, (void*)this );
- sList.erase(this);
- sSaveLocalImage = NULL;
+ // delete images
+ mPreviewImage = NULL;
+ mPreviewImageEncoded = NULL;
+ mFormattedImage = NULL;
+
+ // gIdleCallbacks.deleteFunction( &LLSnapshotLivePreview::onIdle, (void*)this );
+ sList.erase(this);
+ sSaveLocalImage = NULL;
}
-void LLSnapshotLivePreview::setMaxImageSize(S32 size)
+void LLSnapshotLivePreview::setMaxImageSize(S32 size)
{
mMaxImageSize = llmin(size,(S32)(MAX_SNAPSHOT_IMAGE_SIZE));
}
LLViewerTexture* LLSnapshotLivePreview::getCurrentImage()
{
- return mViewerImage[mCurImageIndex];
+ return mViewerImage[mCurImageIndex];
}
F32 LLSnapshotLivePreview::getImageAspect()
{
- if (!getCurrentImage())
- {
- return 0.f;
- }
- // mKeepAspectRatio) == gSavedSettings.getBOOL("KeepAspectForSnapshot"))
+ if (!getCurrentImage())
+ {
+ return 0.f;
+ }
+ // mKeepAspectRatio) == gSavedSettings.getBOOL("KeepAspectForSnapshot"))
return (mKeepAspectRatio ? ((F32)getRect().getWidth()) / ((F32)getRect().getHeight()) : ((F32)getWidth()) / ((F32)getHeight()));
}
void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail, F32 delay)
{
- LL_DEBUGS("Snapshot") << "updateSnapshot: mSnapshotUpToDate = " << getSnapshotUpToDate() << LL_ENDL;
+ LL_DEBUGS("Snapshot") << "updateSnapshot: mSnapshotUpToDate = " << getSnapshotUpToDate() << LL_ENDL;
- // Update snapshot if requested.
- if (new_snapshot)
- {
+ // Update snapshot if requested.
+ if (new_snapshot)
+ {
if (getSnapshotUpToDate())
{
S32 old_image_index = mCurImageIndex;
- mCurImageIndex = (mCurImageIndex + 1) % 2;
+ mCurImageIndex = (mCurImageIndex + 1) % 2;
setSize(mWidth[old_image_index], mHeight[old_image_index]);
- mFallAnimTimer.start();
+ mFallAnimTimer.start();
}
- mSnapshotUpToDate = FALSE;
+ mSnapshotUpToDate = FALSE;
// Update snapshot source rect depending on whether we keep the aspect ratio.
LLRect& rect = mImageRect[mCurImageIndex];
@@ -181,14 +181,14 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail
if (image_aspect_ratio > window_aspect_ratio)
{
// trim off top and bottom
- S32 new_height = ll_round((F32)getRect().getWidth() / image_aspect_ratio);
+ S32 new_height = ll_round((F32)getRect().getWidth() / image_aspect_ratio);
rect.mBottom += (getRect().getHeight() - new_height) / 2;
rect.mTop -= (getRect().getHeight() - new_height) / 2;
}
else if (image_aspect_ratio < window_aspect_ratio)
{
// trim off left and right
- S32 new_width = ll_round((F32)getRect().getHeight() * image_aspect_ratio);
+ S32 new_width = ll_round((F32)getRect().getHeight() * image_aspect_ratio);
rect.mLeft += (getRect().getWidth() - new_width) / 2;
rect.mRight -= (getRect().getWidth() - new_width) / 2;
}
@@ -196,294 +196,294 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail
// Stop shining animation.
mShineAnimTimer.stop();
- mSnapshotDelayTimer.start();
- mSnapshotDelayTimer.resetWithExpiry(delay);
+ mSnapshotDelayTimer.start();
+ mSnapshotDelayTimer.resetWithExpiry(delay);
-
- mPosTakenGlobal = gAgentCamera.getCameraPositionGlobal();
+
+ mPosTakenGlobal = gAgentCamera.getCameraPositionGlobal();
// Tell the floater container that the snapshot is in the process of updating itself
if (mViewContainer)
{
mViewContainer->notify(LLSD().with("snapshot-updating", true));
}
- }
+ }
- // Update thumbnail if requested.
- if (new_thumbnail)
- {
- mThumbnailUpToDate = FALSE ;
+ // Update thumbnail if requested.
+ if (new_thumbnail)
+ {
+ mThumbnailUpToDate = FALSE ;
mBigThumbnailUpToDate = FALSE;
- }
+ }
}
// Return true if the quality has been changed, false otherwise
bool LLSnapshotLivePreview::setSnapshotQuality(S32 quality, bool set_by_user)
{
- llclamp(quality, 0, 100);
- if (quality != mSnapshotQuality)
- {
- mSnapshotQuality = quality;
+ llclamp(quality, 0, 100);
+ if (quality != mSnapshotQuality)
+ {
+ mSnapshotQuality = quality;
if (set_by_user)
{
gSavedSettings.setS32("SnapshotQuality", quality);
}
mFormattedImage = NULL; // Invalidate the already formatted image if any
return true;
- }
+ }
return false;
}
void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y, LLColor4 alpha_color)
{
- F32 line_width ;
- glGetFloatv(GL_LINE_WIDTH, &line_width) ;
- glLineWidth(2.0f * line_width) ;
- LLColor4 color(0.0f, 0.0f, 0.0f, 1.0f) ;
- gl_rect_2d( mPreviewRect.mLeft + offset_x, mPreviewRect.mTop + offset_y,
- mPreviewRect.mRight + offset_x, mPreviewRect.mBottom + offset_y, color, FALSE ) ;
- glLineWidth(line_width) ;
-
- //draw four alpha rectangles to cover areas outside of the snapshot image
- if(!mKeepAspectRatio)
- {
- S32 dwl = 0, dwr = 0 ;
- if(mThumbnailWidth > mPreviewRect.getWidth())
- {
- dwl = (mThumbnailWidth - mPreviewRect.getWidth()) >> 1 ;
- dwr = mThumbnailWidth - mPreviewRect.getWidth() - dwl ;
-
- gl_rect_2d(mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mTop + offset_y,
- mPreviewRect.mLeft + offset_x, mPreviewRect.mBottom + offset_y, alpha_color, TRUE ) ;
- gl_rect_2d( mPreviewRect.mRight + offset_x, mPreviewRect.mTop + offset_y,
- mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y, alpha_color, TRUE ) ;
- }
-
- if(mThumbnailHeight > mPreviewRect.getHeight())
- {
- S32 dh = (mThumbnailHeight - mPreviewRect.getHeight()) >> 1 ;
- gl_rect_2d(mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mBottom + offset_y ,
- mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y - dh, alpha_color, TRUE ) ;
-
- dh = mThumbnailHeight - mPreviewRect.getHeight() - dh ;
- gl_rect_2d( mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mTop + offset_y + dh,
- mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mTop + offset_y, alpha_color, TRUE ) ;
- }
- }
+ F32 line_width ;
+ glGetFloatv(GL_LINE_WIDTH, &line_width) ;
+ glLineWidth(2.0f * line_width) ;
+ LLColor4 color(0.0f, 0.0f, 0.0f, 1.0f) ;
+ gl_rect_2d( mPreviewRect.mLeft + offset_x, mPreviewRect.mTop + offset_y,
+ mPreviewRect.mRight + offset_x, mPreviewRect.mBottom + offset_y, color, FALSE ) ;
+ glLineWidth(line_width) ;
+
+ //draw four alpha rectangles to cover areas outside of the snapshot image
+ if(!mKeepAspectRatio)
+ {
+ S32 dwl = 0, dwr = 0 ;
+ if(mThumbnailWidth > mPreviewRect.getWidth())
+ {
+ dwl = (mThumbnailWidth - mPreviewRect.getWidth()) >> 1 ;
+ dwr = mThumbnailWidth - mPreviewRect.getWidth() - dwl ;
+
+ gl_rect_2d(mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mTop + offset_y,
+ mPreviewRect.mLeft + offset_x, mPreviewRect.mBottom + offset_y, alpha_color, TRUE ) ;
+ gl_rect_2d( mPreviewRect.mRight + offset_x, mPreviewRect.mTop + offset_y,
+ mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y, alpha_color, TRUE ) ;
+ }
+
+ if(mThumbnailHeight > mPreviewRect.getHeight())
+ {
+ S32 dh = (mThumbnailHeight - mPreviewRect.getHeight()) >> 1 ;
+ gl_rect_2d(mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mBottom + offset_y ,
+ mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y - dh, alpha_color, TRUE ) ;
+
+ dh = mThumbnailHeight - mPreviewRect.getHeight() - dh ;
+ gl_rect_2d( mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mTop + offset_y + dh,
+ mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mTop + offset_y, alpha_color, TRUE ) ;
+ }
+ }
}
//called when the frame is frozen.
void LLSnapshotLivePreview::draw()
{
- if (getCurrentImage() &&
- mPreviewImageEncoded.notNull() &&
- getSnapshotUpToDate())
- {
- LLColor4 bg_color(0.f, 0.f, 0.3f, 0.4f);
- gl_rect_2d(getRect(), bg_color);
- const LLRect& rect = getImageRect();
- LLRect shadow_rect = rect;
- shadow_rect.stretch(BORDER_WIDTH);
- gl_drop_shadow(shadow_rect.mLeft, shadow_rect.mTop, shadow_rect.mRight, shadow_rect.mBottom, LLColor4(0.f, 0.f, 0.f, mNeedsFlash ? 0.f :0.5f), 10);
-
- LLColor4 image_color(1.f, 1.f, 1.f, 1.f);
- gGL.color4fv(image_color.mV);
- gGL.getTexUnit(0)->bind(getCurrentImage());
- // calculate UV scale
- F32 uv_width = isImageScaled() ? 1.f : llmin((F32)getWidth() / (F32)getCurrentImage()->getWidth(), 1.f);
- F32 uv_height = isImageScaled() ? 1.f : llmin((F32)getHeight() / (F32)getCurrentImage()->getHeight(), 1.f);
- gGL.pushMatrix();
- {
- gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom + TOP_PANEL_HEIGHT, 0.f);
- gGL.begin(LLRender::QUADS);
- {
- gGL.texCoord2f(uv_width, uv_height);
- gGL.vertex2i(rect.getWidth(), rect.getHeight() );
-
- gGL.texCoord2f(0.f, uv_height);
- gGL.vertex2i(0, rect.getHeight() );
-
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2i(0, 0);
-
- gGL.texCoord2f(uv_width, 0.f);
- gGL.vertex2i(rect.getWidth(), 0);
- }
- gGL.end();
- }
- gGL.popMatrix();
-
- gGL.color4f(1.f, 1.f, 1.f, mFlashAlpha);
- gl_rect_2d(getRect());
- if (mNeedsFlash)
- {
- if (mFlashAlpha < 1.f)
- {
- mFlashAlpha = lerp(mFlashAlpha, 1.f, LLCriticalDamp::getInterpolant(0.02f));
- }
- else
- {
- mNeedsFlash = FALSE;
- }
- }
- else
- {
- mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f));
- }
-
- // Draw shining animation if appropriate.
- if (mShineCountdown > 0)
- {
- mShineCountdown--;
- if (mShineCountdown == 0)
- {
- mShineAnimTimer.start();
- }
- }
- else if (mShineAnimTimer.getStarted())
- {
- LL_DEBUGS("Snapshot") << "Drawing shining animation" << LL_ENDL;
- F32 shine_interp = llmin(1.f, mShineAnimTimer.getElapsedTimeF32() / SHINE_TIME);
-
- // draw "shine" effect
- LLRect local_rect(0, getRect().getHeight() + TOP_PANEL_HEIGHT, getRect().getWidth(), 0);
- LLLocalClipRect clip(local_rect);
- {
- // draw diagonal stripe with gradient that passes over screen
- S32 x1 = gViewerWindow->getWindowWidthScaled() * ll_round((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f)));
- S32 x2 = x1 + ll_round(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
- S32 x3 = x2 + ll_round(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
- S32 y1 = 0;
- S32 y2 = gViewerWindow->getWindowHeightScaled() + TOP_PANEL_HEIGHT;
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.begin(LLRender::QUADS);
- {
- gGL.color4f(1.f, 1.f, 1.f, 0.f);
- gGL.vertex2i(x1, y1);
- gGL.vertex2i(x1 + gViewerWindow->getWindowWidthScaled(), y2);
- gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
- gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2);
- gGL.vertex2i(x2, y1);
-
- gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
- gGL.vertex2i(x2, y1);
- gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2);
- gGL.color4f(1.f, 1.f, 1.f, 0.f);
- gGL.vertex2i(x3 + gViewerWindow->getWindowWidthScaled(), y2);
- gGL.vertex2i(x3, y1);
- }
- gGL.end();
- }
-
- // if we're at the end of the animation, stop
- if (shine_interp >= 1.f)
- {
- mShineAnimTimer.stop();
- }
- }
- }
-
- // draw old image dropping away
- if (mFallAnimTimer.getStarted())
- {
- S32 old_image_index = (mCurImageIndex + 1) % 2;
- if (mViewerImage[old_image_index].notNull() && mFallAnimTimer.getElapsedTimeF32() < FALL_TIME)
- {
- LL_DEBUGS("Snapshot") << "Drawing fall animation" << LL_ENDL;
- F32 fall_interp = mFallAnimTimer.getElapsedTimeF32() / FALL_TIME;
- F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f);
- LLColor4 image_color(1.f, 1.f, 1.f, alpha);
- gGL.color4fv(image_color.mV);
- gGL.getTexUnit(0)->bind(mViewerImage[old_image_index]);
- // calculate UV scale
- // *FIX get this to work with old image
- BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull();
- F32 uv_width = rescale ? llmin((F32)mWidth[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f) : 1.f;
- F32 uv_height = rescale ? llmin((F32)mHeight[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f) : 1.f;
- gGL.pushMatrix();
- {
- LLRect& rect = mImageRect[old_image_index];
- gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - ll_round(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
- gGL.rotatef(-45.f * fall_interp, 0.f, 0.f, 1.f);
- gGL.begin(LLRender::QUADS);
- {
- gGL.texCoord2f(uv_width, uv_height);
- gGL.vertex2i(rect.getWidth(), rect.getHeight() );
-
- gGL.texCoord2f(0.f, uv_height);
- gGL.vertex2i(0, rect.getHeight() );
-
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2i(0, 0);
-
- gGL.texCoord2f(uv_width, 0.f);
- gGL.vertex2i(rect.getWidth(), 0);
- }
- gGL.end();
- }
- gGL.popMatrix();
- }
- }
+ if (getCurrentImage() &&
+ mPreviewImageEncoded.notNull() &&
+ getSnapshotUpToDate())
+ {
+ LLColor4 bg_color(0.f, 0.f, 0.3f, 0.4f);
+ gl_rect_2d(getRect(), bg_color);
+ const LLRect& rect = getImageRect();
+ LLRect shadow_rect = rect;
+ shadow_rect.stretch(BORDER_WIDTH);
+ gl_drop_shadow(shadow_rect.mLeft, shadow_rect.mTop, shadow_rect.mRight, shadow_rect.mBottom, LLColor4(0.f, 0.f, 0.f, mNeedsFlash ? 0.f :0.5f), 10);
+
+ LLColor4 image_color(1.f, 1.f, 1.f, 1.f);
+ gGL.color4fv(image_color.mV);
+ gGL.getTexUnit(0)->bind(getCurrentImage());
+ // calculate UV scale
+ F32 uv_width = isImageScaled() ? 1.f : llmin((F32)getWidth() / (F32)getCurrentImage()->getWidth(), 1.f);
+ F32 uv_height = isImageScaled() ? 1.f : llmin((F32)getHeight() / (F32)getCurrentImage()->getHeight(), 1.f);
+ gGL.pushMatrix();
+ {
+ gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom + TOP_PANEL_HEIGHT, 0.f);
+ gGL.begin(LLRender::QUADS);
+ {
+ gGL.texCoord2f(uv_width, uv_height);
+ gGL.vertex2i(rect.getWidth(), rect.getHeight() );
+
+ gGL.texCoord2f(0.f, uv_height);
+ gGL.vertex2i(0, rect.getHeight() );
+
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(0, 0);
+
+ gGL.texCoord2f(uv_width, 0.f);
+ gGL.vertex2i(rect.getWidth(), 0);
+ }
+ gGL.end();
+ }
+ gGL.popMatrix();
+
+ gGL.color4f(1.f, 1.f, 1.f, mFlashAlpha);
+ gl_rect_2d(getRect());
+ if (mNeedsFlash)
+ {
+ if (mFlashAlpha < 1.f)
+ {
+ mFlashAlpha = lerp(mFlashAlpha, 1.f, LLCriticalDamp::getInterpolant(0.02f));
+ }
+ else
+ {
+ mNeedsFlash = FALSE;
+ }
+ }
+ else
+ {
+ mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f));
+ }
+
+ // Draw shining animation if appropriate.
+ if (mShineCountdown > 0)
+ {
+ mShineCountdown--;
+ if (mShineCountdown == 0)
+ {
+ mShineAnimTimer.start();
+ }
+ }
+ else if (mShineAnimTimer.getStarted())
+ {
+ LL_DEBUGS("Snapshot") << "Drawing shining animation" << LL_ENDL;
+ F32 shine_interp = llmin(1.f, mShineAnimTimer.getElapsedTimeF32() / SHINE_TIME);
+
+ // draw "shine" effect
+ LLRect local_rect(0, getRect().getHeight() + TOP_PANEL_HEIGHT, getRect().getWidth(), 0);
+ LLLocalClipRect clip(local_rect);
+ {
+ // draw diagonal stripe with gradient that passes over screen
+ S32 x1 = gViewerWindow->getWindowWidthScaled() * ll_round((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f)));
+ S32 x2 = x1 + ll_round(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
+ S32 x3 = x2 + ll_round(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
+ S32 y1 = 0;
+ S32 y2 = gViewerWindow->getWindowHeightScaled() + TOP_PANEL_HEIGHT;
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.begin(LLRender::QUADS);
+ {
+ gGL.color4f(1.f, 1.f, 1.f, 0.f);
+ gGL.vertex2i(x1, y1);
+ gGL.vertex2i(x1 + gViewerWindow->getWindowWidthScaled(), y2);
+ gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
+ gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2);
+ gGL.vertex2i(x2, y1);
+
+ gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
+ gGL.vertex2i(x2, y1);
+ gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2);
+ gGL.color4f(1.f, 1.f, 1.f, 0.f);
+ gGL.vertex2i(x3 + gViewerWindow->getWindowWidthScaled(), y2);
+ gGL.vertex2i(x3, y1);
+ }
+ gGL.end();
+ }
+
+ // if we're at the end of the animation, stop
+ if (shine_interp >= 1.f)
+ {
+ mShineAnimTimer.stop();
+ }
+ }
+ }
+
+ // draw old image dropping away
+ if (mFallAnimTimer.getStarted())
+ {
+ S32 old_image_index = (mCurImageIndex + 1) % 2;
+ if (mViewerImage[old_image_index].notNull() && mFallAnimTimer.getElapsedTimeF32() < FALL_TIME)
+ {
+ LL_DEBUGS("Snapshot") << "Drawing fall animation" << LL_ENDL;
+ F32 fall_interp = mFallAnimTimer.getElapsedTimeF32() / FALL_TIME;
+ F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f);
+ LLColor4 image_color(1.f, 1.f, 1.f, alpha);
+ gGL.color4fv(image_color.mV);
+ gGL.getTexUnit(0)->bind(mViewerImage[old_image_index]);
+ // calculate UV scale
+ // *FIX get this to work with old image
+ BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull();
+ F32 uv_width = rescale ? llmin((F32)mWidth[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f) : 1.f;
+ F32 uv_height = rescale ? llmin((F32)mHeight[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f) : 1.f;
+ gGL.pushMatrix();
+ {
+ LLRect& rect = mImageRect[old_image_index];
+ gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - ll_round(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
+ gGL.rotatef(-45.f * fall_interp, 0.f, 0.f, 1.f);
+ gGL.begin(LLRender::QUADS);
+ {
+ gGL.texCoord2f(uv_width, uv_height);
+ gGL.vertex2i(rect.getWidth(), rect.getHeight() );
+
+ gGL.texCoord2f(0.f, uv_height);
+ gGL.vertex2i(0, rect.getHeight() );
+
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(0, 0);
+
+ gGL.texCoord2f(uv_width, 0.f);
+ gGL.vertex2i(rect.getWidth(), 0);
+ }
+ gGL.end();
+ }
+ gGL.popMatrix();
+ }
+ }
}
-/*virtual*/
+/*virtual*/
void LLSnapshotLivePreview::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- LLRect old_rect = getRect();
- LLView::reshape(width, height, called_from_parent);
- if (old_rect.getWidth() != width || old_rect.getHeight() != height)
- {
- LL_DEBUGS("Window", "Snapshot") << "window reshaped, updating thumbnail" << LL_ENDL;
- if (mViewContainer && mViewContainer->isInVisibleChain())
- {
- // We usually resize only on window reshape, so give it a chance to redraw, assign delay
- updateSnapshot(
- TRUE, // new snapshot is needed
- FALSE, // thumbnail will be updated either way.
- AUTO_SNAPSHOT_TIME_DELAY); // shutter delay.
- }
- }
+ LLRect old_rect = getRect();
+ LLView::reshape(width, height, called_from_parent);
+ if (old_rect.getWidth() != width || old_rect.getHeight() != height)
+ {
+ LL_DEBUGS("Window", "Snapshot") << "window reshaped, updating thumbnail" << LL_ENDL;
+ if (mViewContainer && mViewContainer->isInVisibleChain())
+ {
+ // We usually resize only on window reshape, so give it a chance to redraw, assign delay
+ updateSnapshot(
+ TRUE, // new snapshot is needed
+ FALSE, // thumbnail will be updated either way.
+ AUTO_SNAPSHOT_TIME_DELAY); // shutter delay.
+ }
+ }
}
BOOL LLSnapshotLivePreview::setThumbnailImageSize()
{
- if (getWidth() < 10 || getHeight() < 10)
- {
- return FALSE ;
- }
- S32 width = (mThumbnailSubsampled ? mPreviewImage->getWidth() : gViewerWindow->getWindowWidthRaw());
- S32 height = (mThumbnailSubsampled ? mPreviewImage->getHeight() : gViewerWindow->getWindowHeightRaw()) ;
-
- F32 aspect_ratio = ((F32)width) / ((F32)height);
-
- // UI size for thumbnail
- S32 max_width = mThumbnailPlaceholderRect.getWidth();
- S32 max_height = mThumbnailPlaceholderRect.getHeight();
-
- if (aspect_ratio > (F32)max_width / (F32)max_height)
- {
- // image too wide, shrink to width
- mThumbnailWidth = max_width;
- mThumbnailHeight = ll_round((F32)max_width / aspect_ratio);
- }
- else
- {
- // image too tall, shrink to height
- mThumbnailHeight = max_height;
- mThumbnailWidth = ll_round((F32)max_height * aspect_ratio);
- }
-
- if (mThumbnailWidth > width || mThumbnailHeight > height)
- {
- return FALSE ;//if the window is too small, ignore thumbnail updating.
- }
-
- S32 left = 0 , top = mThumbnailHeight, right = mThumbnailWidth, bottom = 0 ;
- if (!mKeepAspectRatio)
- {
- F32 ratio_x = (F32)getWidth() / width ;
- F32 ratio_y = (F32)getHeight() / height ;
+ if (getWidth() < 10 || getHeight() < 10)
+ {
+ return FALSE ;
+ }
+ S32 width = (mThumbnailSubsampled ? mPreviewImage->getWidth() : gViewerWindow->getWindowWidthRaw());
+ S32 height = (mThumbnailSubsampled ? mPreviewImage->getHeight() : gViewerWindow->getWindowHeightRaw()) ;
+
+ F32 aspect_ratio = ((F32)width) / ((F32)height);
+
+ // UI size for thumbnail
+ S32 max_width = mThumbnailPlaceholderRect.getWidth();
+ S32 max_height = mThumbnailPlaceholderRect.getHeight();
+
+ if (aspect_ratio > (F32)max_width / (F32)max_height)
+ {
+ // image too wide, shrink to width
+ mThumbnailWidth = max_width;
+ mThumbnailHeight = ll_round((F32)max_width / aspect_ratio);
+ }
+ else
+ {
+ // image too tall, shrink to height
+ mThumbnailHeight = max_height;
+ mThumbnailWidth = ll_round((F32)max_height * aspect_ratio);
+ }
+
+ if (mThumbnailWidth > width || mThumbnailHeight > height)
+ {
+ return FALSE ;//if the window is too small, ignore thumbnail updating.
+ }
+
+ S32 left = 0 , top = mThumbnailHeight, right = mThumbnailWidth, bottom = 0 ;
+ if (!mKeepAspectRatio)
+ {
+ F32 ratio_x = (F32)getWidth() / width ;
+ F32 ratio_y = (F32)getHeight() / height ;
if (ratio_x > ratio_y)
{
@@ -493,55 +493,55 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize()
{
right = (S32)(right * ratio_x / ratio_y) ;
}
- left = (S32)((mThumbnailWidth - right) * 0.5f) ;
- bottom = (S32)((mThumbnailHeight - top) * 0.5f) ;
- top += bottom ;
- right += left ;
- }
- mPreviewRect.set(left - 1, top + 1, right + 1, bottom - 1) ;
-
- return TRUE ;
+ left = (S32)((mThumbnailWidth - right) * 0.5f) ;
+ bottom = (S32)((mThumbnailHeight - top) * 0.5f) ;
+ top += bottom ;
+ right += left ;
+ }
+ mPreviewRect.set(left - 1, top + 1, right + 1, bottom - 1) ;
+
+ return TRUE ;
}
void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update)
-{
- if(mThumbnailUpdateLock) //in the process of updating
- {
- return ;
- }
- if(getThumbnailUpToDate() && !force_update)//already updated
- {
- return ;
- }
- if(getWidth() < 10 || getHeight() < 10)
- {
- return ;
- }
-
- ////lock updating
- mThumbnailUpdateLock = TRUE ;
-
- if(!setThumbnailImageSize())
- {
- mThumbnailUpdateLock = FALSE ;
- mThumbnailUpToDate = TRUE ;
- return ;
- }
+{
+ if(mThumbnailUpdateLock) //in the process of updating
+ {
+ return ;
+ }
+ if(getThumbnailUpToDate() && !force_update)//already updated
+ {
+ return ;
+ }
+ if(getWidth() < 10 || getHeight() < 10)
+ {
+ return ;
+ }
+
+ ////lock updating
+ mThumbnailUpdateLock = TRUE ;
+
+ if(!setThumbnailImageSize())
+ {
+ mThumbnailUpdateLock = FALSE ;
+ mThumbnailUpToDate = TRUE ;
+ return ;
+ }
// Invalidate the big thumbnail when we regenerate the small one
mBigThumbnailUpToDate = FALSE;
- if(mThumbnailImage)
- {
- resetThumbnailImage() ;
- }
+ if(mThumbnailImage)
+ {
+ resetThumbnailImage() ;
+ }
+
+ LLPointer<LLImageRaw> raw = new LLImageRaw;
- LLPointer<LLImageRaw> raw = new LLImageRaw;
-
if (mThumbnailSubsampled)
{
// The thumbnail is be a subsampled version of the preview (used in SL Share previews, i.e. Flickr, Twitter)
- raw->resize( mPreviewImage->getWidth(),
+ raw->resize( mPreviewImage->getWidth(),
mPreviewImage->getHeight(),
mPreviewImage->getComponents());
raw->copy(mPreviewImage);
@@ -565,9 +565,9 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update)
raw = NULL ;
}
}
-
- if (raw)
- {
+
+ if (raw)
+ {
// Filter the thumbnail
// Note: filtering needs to be done *before* the scaling to power of 2 or the effect is distorted
if (getFilter() != "")
@@ -585,29 +585,29 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update)
}
// Scale to a power of 2 so it can be mapped to a texture
raw->expandToPowerOfTwo();
- mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
- mThumbnailUpToDate = TRUE ;
- }
+ mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
+ mThumbnailUpToDate = TRUE ;
+ }
- //unlock updating
- mThumbnailUpdateLock = FALSE ;
+ //unlock updating
+ mThumbnailUpdateLock = FALSE ;
}
LLViewerTexture* LLSnapshotLivePreview::getBigThumbnailImage()
{
- if (mThumbnailUpdateLock) //in the process of updating
- {
- return NULL;
- }
- if (mBigThumbnailUpToDate && mBigThumbnailImage)//already updated
- {
- return mBigThumbnailImage;
- }
-
- LLPointer<LLImageRaw> raw = new LLImageRaw;
-
- if (raw)
- {
+ if (mThumbnailUpdateLock) //in the process of updating
+ {
+ return NULL;
+ }
+ if (mBigThumbnailUpToDate && mBigThumbnailImage)//already updated
+ {
+ return mBigThumbnailImage;
+ }
+
+ LLPointer<LLImageRaw> raw = new LLImageRaw;
+
+ if (raw)
+ {
// The big thumbnail is a new filtered version of the preview (used in SL Share previews, i.e. Flickr, Twitter)
mBigThumbnailWidth = mPreviewImage->getWidth();
mBigThumbnailHeight = mPreviewImage->getHeight();
@@ -615,7 +615,7 @@ LLViewerTexture* LLSnapshotLivePreview::getBigThumbnailImage()
mBigThumbnailHeight,
mPreviewImage->getComponents());
raw->copy(mPreviewImage);
-
+
// Filter
// Note: filtering needs to be done *before* the scaling to power of 2 or the effect is distorted
if (getFilter() != "")
@@ -633,67 +633,67 @@ LLViewerTexture* LLSnapshotLivePreview::getBigThumbnailImage()
}
// Scale to a power of 2 so it can be mapped to a texture
raw->expandToPowerOfTwo();
- mBigThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
- mBigThumbnailUpToDate = TRUE ;
- }
-
+ mBigThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
+ mBigThumbnailUpToDate = TRUE ;
+ }
+
return mBigThumbnailImage ;
}
// Called often. Checks whether it's time to grab a new snapshot and if so, does it.
// Returns TRUE if new snapshot generated, FALSE otherwise.
-//static
+//static
BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
{
- LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview;
- if (previewp->getWidth() == 0 || previewp->getHeight() == 0)
- {
- LL_WARNS("Snapshot") << "Incorrect dimensions: " << previewp->getWidth() << "x" << previewp->getHeight() << LL_ENDL;
- return FALSE;
- }
-
- if (previewp->mSnapshotDelayTimer.getStarted()) // Wait for a snapshot delay timer
- {
- if (!previewp->mSnapshotDelayTimer.hasExpired())
- {
- return FALSE;
- }
- previewp->mSnapshotDelayTimer.stop();
- }
-
- if (LLToolCamera::getInstance()->hasMouseCapture()) // Hide full-screen preview while camming, either don't take snapshots while ALT-zoom active
- {
- previewp->setVisible(FALSE);
- return FALSE;
- }
-
- // If we're in freeze-frame and/or auto update mode and camera has moved, update snapshot.
- LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin();
- LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion();
- if (previewp->mForceUpdateSnapshot ||
- (((gSavedSettings.getBOOL("AutoSnapshot") && LLView::isAvailable(previewp->mViewContainer)) ||
- (gSavedSettings.getBOOL("FreezeTime") && previewp->mAllowFullScreenPreview)) &&
- (new_camera_pos != previewp->mCameraPos || dot(new_camera_rot, previewp->mCameraRot) < 0.995f)))
- {
- previewp->mCameraPos = new_camera_pos;
- previewp->mCameraRot = new_camera_rot;
- // request a new snapshot whenever the camera moves, with a time delay
- BOOL new_snapshot = gSavedSettings.getBOOL("AutoSnapshot") || previewp->mForceUpdateSnapshot;
- LL_DEBUGS("Snapshot") << "camera moved, updating thumbnail" << LL_ENDL;
- previewp->updateSnapshot(
- new_snapshot, // whether a new snapshot is needed or merely invalidate the existing one
- FALSE, // or if 1st arg is false, whether to produce a new thumbnail image.
- new_snapshot ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); // shutter delay if 1st arg is true.
- previewp->mForceUpdateSnapshot = FALSE;
- }
-
- if (previewp->getSnapshotUpToDate() && previewp->getThumbnailUpToDate())
- {
- return FALSE;
- }
-
- // time to produce a snapshot
- if(!previewp->getSnapshotUpToDate())
+ LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview;
+ if (previewp->getWidth() == 0 || previewp->getHeight() == 0)
+ {
+ LL_WARNS("Snapshot") << "Incorrect dimensions: " << previewp->getWidth() << "x" << previewp->getHeight() << LL_ENDL;
+ return FALSE;
+ }
+
+ if (previewp->mSnapshotDelayTimer.getStarted()) // Wait for a snapshot delay timer
+ {
+ if (!previewp->mSnapshotDelayTimer.hasExpired())
+ {
+ return FALSE;
+ }
+ previewp->mSnapshotDelayTimer.stop();
+ }
+
+ if (LLToolCamera::getInstance()->hasMouseCapture()) // Hide full-screen preview while camming, either don't take snapshots while ALT-zoom active
+ {
+ previewp->setVisible(FALSE);
+ return FALSE;
+ }
+
+ // If we're in freeze-frame and/or auto update mode and camera has moved, update snapshot.
+ LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin();
+ LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion();
+ if (previewp->mForceUpdateSnapshot ||
+ (((gSavedSettings.getBOOL("AutoSnapshot") && LLView::isAvailable(previewp->mViewContainer)) ||
+ (gSavedSettings.getBOOL("FreezeTime") && previewp->mAllowFullScreenPreview)) &&
+ (new_camera_pos != previewp->mCameraPos || dot(new_camera_rot, previewp->mCameraRot) < 0.995f)))
+ {
+ previewp->mCameraPos = new_camera_pos;
+ previewp->mCameraRot = new_camera_rot;
+ // request a new snapshot whenever the camera moves, with a time delay
+ BOOL new_snapshot = gSavedSettings.getBOOL("AutoSnapshot") || previewp->mForceUpdateSnapshot;
+ LL_DEBUGS("Snapshot") << "camera moved, updating thumbnail" << LL_ENDL;
+ previewp->updateSnapshot(
+ new_snapshot, // whether a new snapshot is needed or merely invalidate the existing one
+ FALSE, // or if 1st arg is false, whether to produce a new thumbnail image.
+ new_snapshot ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); // shutter delay if 1st arg is true.
+ previewp->mForceUpdateSnapshot = FALSE;
+ }
+
+ if (previewp->getSnapshotUpToDate() && previewp->getThumbnailUpToDate())
+ {
+ return FALSE;
+ }
+
+ // time to produce a snapshot
+ if(!previewp->getSnapshotUpToDate())
{
LL_DEBUGS("Snapshot") << "producing snapshot" << LL_ENDL;
if (!previewp->mPreviewImage)
@@ -738,7 +738,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
// The snapshot is updated now...
previewp->mSnapshotUpToDate = TRUE;
-
+
// We need to update the thumbnail though
previewp->setThumbnailImageSize();
previewp->generateThumbnailImage(TRUE) ;
@@ -748,19 +748,19 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->mSnapshotActive = FALSE;
LL_DEBUGS("Snapshot") << "done creating snapshot" << LL_ENDL;
}
-
+
if (!previewp->getThumbnailUpToDate())
- {
- previewp->generateThumbnailImage() ;
- }
-
+ {
+ previewp->generateThumbnailImage() ;
+ }
+
// Tell the floater container that the snapshot is updated now
if (previewp->mViewContainer)
{
previewp->mViewContainer->notify(LLSD().with("snapshot-updated", true));
}
- return TRUE;
+ return TRUE;
}
void LLSnapshotLivePreview::prepareFreezeFrame()
@@ -825,40 +825,40 @@ S32 LLSnapshotLivePreview::getEncodedImageHeight() const
LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage()
{
- if (!mPreviewImageEncoded)
- {
- mPreviewImageEncoded = new LLImageRaw;
-
- mPreviewImageEncoded->resize(
+ if (!mPreviewImageEncoded)
+ {
+ mPreviewImageEncoded = new LLImageRaw;
+
+ mPreviewImageEncoded->resize(
mPreviewImage->getWidth(),
mPreviewImage->getHeight(),
mPreviewImage->getComponents());
-
+
if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE)
- {
- // We don't store the intermediate formatted image in mFormattedImage in the J2C case
- LL_DEBUGS("Snapshot") << "Encoding new image of format J2C" << LL_ENDL;
- LLPointer<LLImageJ2C> formatted = new LLImageJ2C;
+ {
+ // We don't store the intermediate formatted image in mFormattedImage in the J2C case
+ LL_DEBUGS("Snapshot") << "Encoding new image of format J2C" << LL_ENDL;
+ LLPointer<LLImageJ2C> formatted = new LLImageJ2C;
// Copy the preview
- LLPointer<LLImageRaw> scaled = new LLImageRaw(
+ LLPointer<LLImageRaw> scaled = new LLImageRaw(
mPreviewImage->getData(),
mPreviewImage->getWidth(),
mPreviewImage->getHeight(),
mPreviewImage->getComponents());
// Scale it as required by J2C
- scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE);
- setImageScaled(TRUE);
+ scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE);
+ setImageScaled(TRUE);
// Compress to J2C
- if (formatted->encode(scaled, 0.f))
- {
+ if (formatted->encode(scaled, 0.f))
+ {
// We can update the data size precisely at that point
- mDataSize = formatted->getDataSize();
+ mDataSize = formatted->getDataSize();
// Decompress back
- formatted->decode(mPreviewImageEncoded, 0);
- }
- }
- else
- {
+ formatted->decode(mPreviewImageEncoded, 0);
+ }
+ }
+ else
+ {
// Update mFormattedImage if necessary
getFormattedImage();
if (getSnapshotFormat() == LLSnapshotModel::SNAPSHOT_FORMAT_BMP)
@@ -871,8 +871,8 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage()
// Decode back
mFormattedImage->decode(mPreviewImageEncoded, 0);
}
- }
- }
+ }
+ }
return mPreviewImageEncoded;
}
@@ -887,7 +887,7 @@ void LLSnapshotLivePreview::estimateDataSize()
{
// Compression ratio
F32 ratio = 1.0;
-
+
if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE)
{
ratio = 8.0; // This is what we shoot for when compressing to J2C
@@ -912,7 +912,7 @@ void LLSnapshotLivePreview::estimateDataSize()
mDataSize = (S32)((F32)mPreviewImage->getDataSize() / ratio);
}
-LLPointer<LLImageFormatted> LLSnapshotLivePreview::getFormattedImage()
+LLPointer<LLImageFormatted> LLSnapshotLivePreview::getFormattedImage()
{
if (!mFormattedImage)
{
@@ -930,20 +930,20 @@ LLPointer<LLImageFormatted> LLSnapshotLivePreview::getFormattedImage()
LL_WARNS("Snapshot") << "Couldn't find a path to the following filter : " << getFilter() << LL_ENDL;
}
}
-
+
// Create the new formatted image of the appropriate format.
LLSnapshotModel::ESnapshotFormat format = getSnapshotFormat();
LL_DEBUGS("Snapshot") << "Encoding new image of format " << format << LL_ENDL;
-
+
switch (format)
{
- case LLSnapshotModel::SNAPSHOT_FORMAT_PNG:
+ case LLSnapshotModel::SNAPSHOT_FORMAT_PNG:
mFormattedImage = new LLImagePNG();
break;
- case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG:
+ case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG:
mFormattedImage = new LLImageJPEG(mSnapshotQuality);
break;
- case LLSnapshotModel::SNAPSHOT_FORMAT_BMP:
+ case LLSnapshotModel::SNAPSHOT_FORMAT_BMP:
mFormattedImage = new LLImageBMP();
break;
}
@@ -959,8 +959,8 @@ LLPointer<LLImageFormatted> LLSnapshotLivePreview::getFormattedImage()
void LLSnapshotLivePreview::setSize(S32 w, S32 h)
{
LL_DEBUGS("Snapshot") << "setSize(" << w << ", " << h << ")" << LL_ENDL;
- setWidth(w);
- setHeight(h);
+ setWidth(w);
+ setHeight(h);
}
void LLSnapshotLivePreview::setSnapshotFormat(LLSnapshotModel::ESnapshotFormat format)
@@ -974,51 +974,51 @@ void LLSnapshotLivePreview::setSnapshotFormat(LLSnapshotModel::ESnapshotFormat f
void LLSnapshotLivePreview::getSize(S32& w, S32& h) const
{
- w = getWidth();
- h = getHeight();
+ w = getWidth();
+ h = getHeight();
}
void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name)
{
- LL_DEBUGS("Snapshot") << "saving texture: " << mPreviewImage->getWidth() << "x" << mPreviewImage->getHeight() << LL_ENDL;
- // gen a new uuid for this asset
- LLTransactionID tid;
- tid.generate();
- LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
-
- LLPointer<LLImageJ2C> formatted = new LLImageJ2C;
- LLPointer<LLImageRaw> scaled = new LLImageRaw(mPreviewImage->getData(),
- mPreviewImage->getWidth(),
- mPreviewImage->getHeight(),
- mPreviewImage->getComponents());
-
- // Apply the filter to mPreviewImage
- if (getFilter() != "")
- {
- std::string filter_path = LLImageFiltersManager::getInstance()->getFilterPath(getFilter());
- if (filter_path != "")
- {
- LLImageFilter filter(filter_path);
- filter.executeFilter(scaled);
- }
- else
- {
- LL_WARNS("Snapshot") << "Couldn't find a path to the following filter : " << getFilter() << LL_ENDL;
- }
- }
-
- scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE);
- LL_DEBUGS("Snapshot") << "scaled texture to " << scaled->getWidth() << "x" << scaled->getHeight() << LL_ENDL;
-
- if (formatted->encode(scaled, 0.0f))
- {
+ LL_DEBUGS("Snapshot") << "saving texture: " << mPreviewImage->getWidth() << "x" << mPreviewImage->getHeight() << LL_ENDL;
+ // gen a new uuid for this asset
+ LLTransactionID tid;
+ tid.generate();
+ LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
+
+ LLPointer<LLImageJ2C> formatted = new LLImageJ2C;
+ LLPointer<LLImageRaw> scaled = new LLImageRaw(mPreviewImage->getData(),
+ mPreviewImage->getWidth(),
+ mPreviewImage->getHeight(),
+ mPreviewImage->getComponents());
+
+ // Apply the filter to mPreviewImage
+ if (getFilter() != "")
+ {
+ std::string filter_path = LLImageFiltersManager::getInstance()->getFilterPath(getFilter());
+ if (filter_path != "")
+ {
+ LLImageFilter filter(filter_path);
+ filter.executeFilter(scaled);
+ }
+ else
+ {
+ LL_WARNS("Snapshot") << "Couldn't find a path to the following filter : " << getFilter() << LL_ENDL;
+ }
+ }
+
+ scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE);
+ LL_DEBUGS("Snapshot") << "scaled texture to " << scaled->getWidth() << "x" << scaled->getHeight() << LL_ENDL;
+
+ if (formatted->encode(scaled, 0.0f))
+ {
LLFileSystem fmt_file(new_asset_id, LLAssetType::AT_TEXTURE, LLFileSystem::WRITE);
fmt_file.write(formatted->getData(), formatted->getDataSize());
- std::string pos_string;
- LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL);
- std::string who_took_it;
- LLAgentUI::buildFullname(who_took_it);
- S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
+ std::string pos_string;
+ LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL);
+ std::string who_took_it;
+ LLAgentUI::buildFullname(who_took_it);
+ S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
std::string res_name = outfit_snapshot ? name : "Snapshot : " + pos_string;
std::string res_desc = outfit_snapshot ? "" : "Taken by " + who_took_it + " at " + pos_string;
LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY;
@@ -1032,32 +1032,32 @@ void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name)
upload_new_resource(assetUploadInfo);
- gViewerWindow->playSnapshotAnimAndSound();
- }
- else
- {
- LLNotificationsUtil::add("ErrorEncodingSnapshot");
- LL_WARNS("Snapshot") << "Error encoding snapshot" << LL_ENDL;
- }
+ gViewerWindow->playSnapshotAnimAndSound();
+ }
+ else
+ {
+ LLNotificationsUtil::add("ErrorEncodingSnapshot");
+ LL_WARNS("Snapshot") << "Error encoding snapshot" << LL_ENDL;
+ }
- add(LLStatViewer::SNAPSHOT, 1);
+ add(LLStatViewer::SNAPSHOT, 1);
- mDataSize = 0;
+ mDataSize = 0;
}
void LLSnapshotLivePreview::saveLocal(const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb)
{
// Update mFormattedImage if necessary
getFormattedImage();
-
+
// Save the formatted image
- saveLocal(mFormattedImage, success_cb, failure_cb);
+ saveLocal(mFormattedImage, success_cb, failure_cb);
}
//Check if failed due to insufficient memory
void LLSnapshotLivePreview::saveLocal(LLPointer<LLImageFormatted> image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb)
{
- sSaveLocalImage = image;
+ sSaveLocalImage = image;
- gViewerWindow->saveImageNumbered(sSaveLocalImage, FALSE, success_cb, failure_cb);
+ gViewerWindow->saveImageNumbered(sSaveLocalImage, FALSE, success_cb, failure_cb);
}
diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h
index 6e38a957b4..072e350e34 100644
--- a/indra/newview/llsnapshotlivepreview.h
+++ b/indra/newview/llsnapshotlivepreview.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsnapshotlivepreview.h
* @brief Header file for llsnapshotlivepreview
* @author Gilbert@lindenlab.com
@@ -34,152 +34,152 @@
class LLImageJPEG;
///----------------------------------------------------------------------------
-/// Class LLSnapshotLivePreview
+/// Class LLSnapshotLivePreview
///----------------------------------------------------------------------------
class LLSnapshotLivePreview : public LLView
{
- LOG_CLASS(LLSnapshotLivePreview);
+ LOG_CLASS(LLSnapshotLivePreview);
public:
- typedef boost::signals2::signal<void(void)> snapshot_saved_signal_t;
+ typedef boost::signals2::signal<void(void)> snapshot_saved_signal_t;
- static void saveLocal(LLPointer<LLImageFormatted> image, const snapshot_saved_signal_t::slot_type& success_cb = snapshot_saved_signal_t(), const snapshot_saved_signal_t::slot_type& failure_cb = snapshot_saved_signal_t());
- struct Params : public LLInitParam::Block<Params, LLView::Params>
- {
- Params()
- {
- name = "snapshot_live_preview";
- mouse_opaque = false;
- }
- };
+ static void saveLocal(LLPointer<LLImageFormatted> image, const snapshot_saved_signal_t::slot_type& success_cb = snapshot_saved_signal_t(), const snapshot_saved_signal_t::slot_type& failure_cb = snapshot_saved_signal_t());
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ Params()
+ {
+ name = "snapshot_live_preview";
+ mouse_opaque = false;
+ }
+ };
- LLSnapshotLivePreview(const LLSnapshotLivePreview::Params& p);
- ~LLSnapshotLivePreview();
+ LLSnapshotLivePreview(const LLSnapshotLivePreview::Params& p);
+ ~LLSnapshotLivePreview();
void setContainer(LLView* container) { mViewContainer = container; }
- /*virtual*/ void draw();
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
+ /*virtual*/ void draw();
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
- void setSize(S32 w, S32 h);
- void setWidth(S32 w) { mWidth[mCurImageIndex] = w; }
- void setHeight(S32 h) { mHeight[mCurImageIndex] = h; }
- void getSize(S32& w, S32& h) const;
- S32 getWidth() const { return mWidth[mCurImageIndex]; }
- S32 getHeight() const { return mHeight[mCurImageIndex]; }
+ void setSize(S32 w, S32 h);
+ void setWidth(S32 w) { mWidth[mCurImageIndex] = w; }
+ void setHeight(S32 h) { mHeight[mCurImageIndex] = h; }
+ void getSize(S32& w, S32& h) const;
+ S32 getWidth() const { return mWidth[mCurImageIndex]; }
+ S32 getHeight() const { return mHeight[mCurImageIndex]; }
S32 getEncodedImageWidth() const;
S32 getEncodedImageHeight() const;
void estimateDataSize();
- S32 getDataSize() const { return mDataSize; }
- void setMaxImageSize(S32 size) ;
- S32 getMaxImageSize() {return mMaxImageSize ;}
+ S32 getDataSize() const { return mDataSize; }
+ void setMaxImageSize(S32 size) ;
+ S32 getMaxImageSize() {return mMaxImageSize ;}
LLSnapshotModel::ESnapshotType getSnapshotType() const { return mSnapshotType; }
LLSnapshotModel::ESnapshotFormat getSnapshotFormat() const { return mSnapshotFormat; }
- BOOL getSnapshotUpToDate() const { return mSnapshotUpToDate; }
- BOOL isSnapshotActive() { return mSnapshotActive; }
- LLViewerTexture* getThumbnailImage() const { return mThumbnailImage ; }
- S32 getThumbnailWidth() const { return mThumbnailWidth ; }
- S32 getThumbnailHeight() const { return mThumbnailHeight ; }
- BOOL getThumbnailLock() const { return mThumbnailUpdateLock ; }
- BOOL getThumbnailUpToDate() const { return mThumbnailUpToDate ;}
+ BOOL getSnapshotUpToDate() const { return mSnapshotUpToDate; }
+ BOOL isSnapshotActive() { return mSnapshotActive; }
+ LLViewerTexture* getThumbnailImage() const { return mThumbnailImage ; }
+ S32 getThumbnailWidth() const { return mThumbnailWidth ; }
+ S32 getThumbnailHeight() const { return mThumbnailHeight ; }
+ BOOL getThumbnailLock() const { return mThumbnailUpdateLock ; }
+ BOOL getThumbnailUpToDate() const { return mThumbnailUpToDate ;}
void setThumbnailSubsampled(BOOL subsampled) { mThumbnailSubsampled = subsampled; }
- LLViewerTexture* getCurrentImage();
- F32 getImageAspect();
- const LLRect& getImageRect() const { return mImageRect[mCurImageIndex]; }
- BOOL isImageScaled() const { return mImageScaled[mCurImageIndex]; }
- void setImageScaled(BOOL scaled) { mImageScaled[mCurImageIndex] = scaled; }
- const LLVector3d& getPosTakenGlobal() const { return mPosTakenGlobal; }
+ LLViewerTexture* getCurrentImage();
+ F32 getImageAspect();
+ const LLRect& getImageRect() const { return mImageRect[mCurImageIndex]; }
+ BOOL isImageScaled() const { return mImageScaled[mCurImageIndex]; }
+ void setImageScaled(BOOL scaled) { mImageScaled[mCurImageIndex] = scaled; }
+ const LLVector3d& getPosTakenGlobal() const { return mPosTakenGlobal; }
void setSnapshotType(LLSnapshotModel::ESnapshotType type) { mSnapshotType = type; }
void setSnapshotFormat(LLSnapshotModel::ESnapshotFormat format);
- bool setSnapshotQuality(S32 quality, bool set_by_user = true);
- void setSnapshotBufferType(LLSnapshotModel::ESnapshotLayerType type) { mSnapshotBufferType = type; }
+ bool setSnapshotQuality(S32 quality, bool set_by_user = true);
+ void setSnapshotBufferType(LLSnapshotModel::ESnapshotLayerType type) { mSnapshotBufferType = type; }
void setAllowRenderUI(BOOL allow) { mAllowRenderUI = allow; }
void setAllowFullScreenPreview(BOOL allow) { mAllowFullScreenPreview = allow; }
void setFilter(std::string filter_name) { mFilterName = filter_name; }
std::string getFilter() const { return mFilterName; }
- void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f);
+ void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f);
void saveTexture(BOOL outfit_snapshot = FALSE, std::string name = "");
- void saveLocal(const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
+ void saveLocal(const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
- LLPointer<LLImageFormatted> getFormattedImage();
- LLPointer<LLImageRaw> getEncodedImage();
+ LLPointer<LLImageFormatted> getFormattedImage();
+ LLPointer<LLImageRaw> getEncodedImage();
bool createUploadFile(const std::string &out_file, const S32 max_image_dimentions, const S32 min_image_dimentions);
- /// Sets size of preview thumbnail image and the surrounding rect.
- void setThumbnailPlaceholderRect(const LLRect& rect) {mThumbnailPlaceholderRect = rect; }
- BOOL setThumbnailImageSize() ;
- void generateThumbnailImage(BOOL force_update = FALSE) ;
- void resetThumbnailImage() { mThumbnailImage = NULL ; }
- void drawPreviewRect(S32 offset_x, S32 offset_y, LLColor4 alpha_color = LLColor4(0.5f, 0.5f, 0.5f, 0.8f));
- void prepareFreezeFrame();
-
- LLViewerTexture* getBigThumbnailImage();
- S32 getBigThumbnailWidth() const { return mBigThumbnailWidth ; }
- S32 getBigThumbnailHeight() const { return mBigThumbnailHeight ; }
-
- // Returns TRUE when snapshot generated, FALSE otherwise.
- static BOOL onIdle( void* snapshot_preview );
+ /// Sets size of preview thumbnail image and the surrounding rect.
+ void setThumbnailPlaceholderRect(const LLRect& rect) {mThumbnailPlaceholderRect = rect; }
+ BOOL setThumbnailImageSize() ;
+ void generateThumbnailImage(BOOL force_update = FALSE) ;
+ void resetThumbnailImage() { mThumbnailImage = NULL ; }
+ void drawPreviewRect(S32 offset_x, S32 offset_y, LLColor4 alpha_color = LLColor4(0.5f, 0.5f, 0.5f, 0.8f));
+ void prepareFreezeFrame();
+
+ LLViewerTexture* getBigThumbnailImage();
+ S32 getBigThumbnailWidth() const { return mBigThumbnailWidth ; }
+ S32 getBigThumbnailHeight() const { return mBigThumbnailHeight ; }
+
+ // Returns TRUE when snapshot generated, FALSE otherwise.
+ static BOOL onIdle( void* snapshot_preview );
private:
LLView* mViewContainer;
-
- LLColor4 mColor;
- LLPointer<LLViewerTexture> mViewerImage[2]; //used to represent the scene when the frame is frozen.
- LLRect mImageRect[2];
- S32 mWidth[2];
- S32 mHeight[2];
- BOOL mImageScaled[2];
- S32 mMaxImageSize ;
-
- //thumbnail image
- LLPointer<LLViewerTexture> mThumbnailImage ;
- S32 mThumbnailWidth ;
- S32 mThumbnailHeight ;
- LLRect mPreviewRect ;
- BOOL mThumbnailUpdateLock ;
- BOOL mThumbnailUpToDate ;
- LLRect mThumbnailPlaceholderRect;
+
+ LLColor4 mColor;
+ LLPointer<LLViewerTexture> mViewerImage[2]; //used to represent the scene when the frame is frozen.
+ LLRect mImageRect[2];
+ S32 mWidth[2];
+ S32 mHeight[2];
+ BOOL mImageScaled[2];
+ S32 mMaxImageSize ;
+
+ //thumbnail image
+ LLPointer<LLViewerTexture> mThumbnailImage ;
+ S32 mThumbnailWidth ;
+ S32 mThumbnailHeight ;
+ LLRect mPreviewRect ;
+ BOOL mThumbnailUpdateLock ;
+ BOOL mThumbnailUpToDate ;
+ LLRect mThumbnailPlaceholderRect;
BOOL mThumbnailSubsampled; // TRUE if the thumbnail is a subsampled version of the mPreviewImage
-
- LLPointer<LLViewerTexture> mBigThumbnailImage ;
+
+ LLPointer<LLViewerTexture> mBigThumbnailImage ;
S32 mBigThumbnailWidth;
S32 mBigThumbnailHeight;
BOOL mBigThumbnailUpToDate;
- S32 mCurImageIndex;
+ S32 mCurImageIndex;
// The logic is mPreviewImage (raw frame) -> mFormattedImage (formatted / filtered) -> mPreviewImageEncoded (decoded back, to show artifacts)
- LLPointer<LLImageRaw> mPreviewImage;
- LLPointer<LLImageRaw> mPreviewImageEncoded;
- LLPointer<LLImageFormatted> mFormattedImage;
+ LLPointer<LLImageRaw> mPreviewImage;
+ LLPointer<LLImageRaw> mPreviewImageEncoded;
+ LLPointer<LLImageFormatted> mFormattedImage;
BOOL mAllowRenderUI;
BOOL mAllowFullScreenPreview;
- LLFrameTimer mSnapshotDelayTimer;
- S32 mShineCountdown;
- LLFrameTimer mShineAnimTimer;
- F32 mFlashAlpha;
- BOOL mNeedsFlash;
- LLVector3d mPosTakenGlobal;
- S32 mSnapshotQuality;
- S32 mDataSize;
- LLSnapshotModel::ESnapshotType mSnapshotType;
- LLSnapshotModel::ESnapshotFormat mSnapshotFormat;
- BOOL mSnapshotUpToDate;
- LLFrameTimer mFallAnimTimer;
- LLVector3 mCameraPos;
- LLQuaternion mCameraRot;
- BOOL mSnapshotActive;
- LLSnapshotModel::ESnapshotLayerType mSnapshotBufferType;
- std::string mFilterName;
-
- static LLPointer<LLImageFormatted> sSaveLocalImage;
+ LLFrameTimer mSnapshotDelayTimer;
+ S32 mShineCountdown;
+ LLFrameTimer mShineAnimTimer;
+ F32 mFlashAlpha;
+ BOOL mNeedsFlash;
+ LLVector3d mPosTakenGlobal;
+ S32 mSnapshotQuality;
+ S32 mDataSize;
+ LLSnapshotModel::ESnapshotType mSnapshotType;
+ LLSnapshotModel::ESnapshotFormat mSnapshotFormat;
+ BOOL mSnapshotUpToDate;
+ LLFrameTimer mFallAnimTimer;
+ LLVector3 mCameraPos;
+ LLQuaternion mCameraRot;
+ BOOL mSnapshotActive;
+ LLSnapshotModel::ESnapshotLayerType mSnapshotBufferType;
+ std::string mFilterName;
+
+ static LLPointer<LLImageFormatted> sSaveLocalImage;
public:
- static std::set<LLSnapshotLivePreview*> sList;
- BOOL mKeepAspectRatio ;
- BOOL mForceUpdateSnapshot;
+ static std::set<LLSnapshotLivePreview*> sList;
+ BOOL mKeepAspectRatio ;
+ BOOL mForceUpdateSnapshot;
};
#endif // LL_LLSNAPSHOTLIVEPREVIEW_H
diff --git a/indra/newview/llsnapshotmodel.h b/indra/newview/llsnapshotmodel.h
index 71402fb5bc..f0da0713db 100644
--- a/indra/newview/llsnapshotmodel.h
+++ b/indra/newview/llsnapshotmodel.h
@@ -30,26 +30,26 @@
class LLSnapshotModel
{
public:
- enum ESnapshotType
- {
- SNAPSHOT_POSTCARD,
- SNAPSHOT_TEXTURE,
- SNAPSHOT_LOCAL,
- SNAPSHOT_WEB
- };
+ enum ESnapshotType
+ {
+ SNAPSHOT_POSTCARD,
+ SNAPSHOT_TEXTURE,
+ SNAPSHOT_LOCAL,
+ SNAPSHOT_WEB
+ };
- typedef enum e_snapshot_format
- {
- SNAPSHOT_FORMAT_PNG,
- SNAPSHOT_FORMAT_JPEG,
- SNAPSHOT_FORMAT_BMP
- } ESnapshotFormat;
+ typedef enum e_snapshot_format
+ {
+ SNAPSHOT_FORMAT_PNG,
+ SNAPSHOT_FORMAT_JPEG,
+ SNAPSHOT_FORMAT_BMP
+ } ESnapshotFormat;
- typedef enum
- {
- SNAPSHOT_TYPE_COLOR,
- SNAPSHOT_TYPE_DEPTH
- } ESnapshotLayerType;
+ typedef enum
+ {
+ SNAPSHOT_TYPE_COLOR,
+ SNAPSHOT_TYPE_DEPTH
+ } ESnapshotLayerType;
};
#endif // LL_LLSNAPSHOTMODEL_H
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index faf6f15015..fe5b6f71a3 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llspatialpartition.cpp
* @brief LLSpatialGroup class implementation and supporting functions
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -72,131 +72,131 @@ static F32 sCurMaxTexPriority = 1.f;
void sg_assert(BOOL expr)
{
#if LL_OCTREE_PARANOIA_CHECK
- if (!expr)
- {
- LL_ERRS() << "Octree invalid!" << LL_ENDL;
- }
+ if (!expr)
+ {
+ LL_ERRS() << "Octree invalid!" << LL_ENDL;
+ }
#endif
}
//returns:
-// 0 if sphere and AABB are not intersecting
-// 1 if they are
-// 2 if AABB is entirely inside sphere
+// 0 if sphere and AABB are not intersecting
+// 1 if they are
+// 2 if AABB is entirely inside sphere
S32 LLSphereAABB(const LLVector3& center, const LLVector3& size, const LLVector3& pos, const F32 &rad)
{
- S32 ret = 2;
-
- LLVector3 min = center - size;
- LLVector3 max = center + size;
- for (U32 i = 0; i < 3; i++)
- {
- if (min.mV[i] > pos.mV[i] + rad ||
- max.mV[i] < pos.mV[i] - rad)
- { //totally outside
- return 0;
- }
-
- if (min.mV[i] < pos.mV[i] - rad ||
- max.mV[i] > pos.mV[i] + rad)
- { //intersecting
- ret = 1;
- }
- }
-
- return ret;
+ S32 ret = 2;
+
+ LLVector3 min = center - size;
+ LLVector3 max = center + size;
+ for (U32 i = 0; i < 3; i++)
+ {
+ if (min.mV[i] > pos.mV[i] + rad ||
+ max.mV[i] < pos.mV[i] - rad)
+ { //totally outside
+ return 0;
+ }
+
+ if (min.mV[i] < pos.mV[i] - rad ||
+ max.mV[i] > pos.mV[i] + rad)
+ { //intersecting
+ ret = 1;
+ }
+ }
+
+ return ret;
}
LLSpatialGroup::~LLSpatialGroup()
{
- /*if (sNoDelete)
- {
- LL_ERRS() << "Illegal deletion of LLSpatialGroup!" << LL_ENDL;
- }*/
+ /*if (sNoDelete)
+ {
+ LL_ERRS() << "Illegal deletion of LLSpatialGroup!" << LL_ENDL;
+ }*/
- if (gDebugGL)
- {
- gPipeline.checkReferences(this);
- }
+ if (gDebugGL)
+ {
+ gPipeline.checkReferences(this);
+ }
+
+ if (hasState(DEAD))
+ {
+ sZombieGroups--;
+ }
- if (hasState(DEAD))
- {
- sZombieGroups--;
- }
-
- sNodeCount--;
+ sNodeCount--;
- clearDrawMap();
+ clearDrawMap();
}
void LLSpatialGroup::clearDrawMap()
{
- mDrawMap.clear();
+ mDrawMap.clear();
}
-BOOL LLSpatialGroup::isHUDGroup()
+BOOL LLSpatialGroup::isHUDGroup()
{
- return getSpatialPartition() && getSpatialPartition()->isHUDPartition() ;
+ return getSpatialPartition() && getSpatialPartition()->isHUDPartition() ;
}
void LLSpatialGroup::validate()
{
- ll_assert_aligned(this,64);
+ ll_assert_aligned(this,64);
#if LL_OCTREE_PARANOIA_CHECK
- sg_assert(!isState(DIRTY));
- sg_assert(!isDead());
-
- LLVector4a myMin;
- myMin.setSub(mBounds[0], mBounds[1]);
- LLVector4a myMax;
- myMax.setAdd(mBounds[0], mBounds[1]);
-
- validateDrawMap();
-
- for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)
- {
- LLDrawable* drawable = *i;
- sg_assert(drawable->getSpatialGroup() == this);
- if (drawable->getSpatialBridge())
- {
- sg_assert(drawable->getSpatialBridge() == getSpatialPartition()->asBridge());
- }
-
- /*if (drawable->isSpatialBridge())
- {
- LLSpatialPartition* part = drawable->asPartition();
- if (!part)
- {
- LL_ERRS() << "Drawable reports it is a spatial bridge but not a partition." << LL_ENDL;
- }
- LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
- group->validate();
- }*/
- }
-
- for (U32 i = 0; i < mOctreeNode->getChildCount(); ++i)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) mOctreeNode->getChild(i)->getListener(0);
-
- group->validate();
-
- //ensure all children are enclosed in this node
- LLVector4a center = group->mBounds[0];
- LLVector4a size = group->mBounds[1];
-
- LLVector4a min;
- min.setSub(center, size);
- LLVector4a max;
- max.setAdd(center, size);
-
- for (U32 j = 0; j < 3; j++)
- {
- sg_assert(min[j] >= myMin[j]-0.02f);
- sg_assert(max[j] <= myMax[j]+0.02f);
- }
- }
+ sg_assert(!isState(DIRTY));
+ sg_assert(!isDead());
+
+ LLVector4a myMin;
+ myMin.setSub(mBounds[0], mBounds[1]);
+ LLVector4a myMax;
+ myMax.setAdd(mBounds[0], mBounds[1]);
+
+ validateDrawMap();
+
+ for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)
+ {
+ LLDrawable* drawable = *i;
+ sg_assert(drawable->getSpatialGroup() == this);
+ if (drawable->getSpatialBridge())
+ {
+ sg_assert(drawable->getSpatialBridge() == getSpatialPartition()->asBridge());
+ }
+
+ /*if (drawable->isSpatialBridge())
+ {
+ LLSpatialPartition* part = drawable->asPartition();
+ if (!part)
+ {
+ LL_ERRS() << "Drawable reports it is a spatial bridge but not a partition." << LL_ENDL;
+ }
+ LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
+ group->validate();
+ }*/
+ }
+
+ for (U32 i = 0; i < mOctreeNode->getChildCount(); ++i)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) mOctreeNode->getChild(i)->getListener(0);
+
+ group->validate();
+
+ //ensure all children are enclosed in this node
+ LLVector4a center = group->mBounds[0];
+ LLVector4a size = group->mBounds[1];
+
+ LLVector4a min;
+ min.setSub(center, size);
+ LLVector4a max;
+ max.setAdd(center, size);
+
+ for (U32 j = 0; j < 3; j++)
+ {
+ sg_assert(min[j] >= myMin[j]-0.02f);
+ sg_assert(max[j] <= myMax[j]+0.02f);
+ }
+ }
#endif
}
@@ -204,195 +204,195 @@ void LLSpatialGroup::validate()
void LLSpatialGroup::validateDrawMap()
{
#if LL_OCTREE_PARANOIA_CHECK
- for (draw_map_t::iterator i = mDrawMap.begin(); i != mDrawMap.end(); ++i)
- {
- LLSpatialGroup::drawmap_elem_t& draw_vec = i->second;
- for (drawmap_elem_t::iterator j = draw_vec.begin(); j != draw_vec.end(); ++j)
- {
- LLDrawInfo& params = **j;
-
- params.validate();
- }
- }
+ for (draw_map_t::iterator i = mDrawMap.begin(); i != mDrawMap.end(); ++i)
+ {
+ LLSpatialGroup::drawmap_elem_t& draw_vec = i->second;
+ for (drawmap_elem_t::iterator j = draw_vec.begin(); j != draw_vec.end(); ++j)
+ {
+ LLDrawInfo& params = **j;
+
+ params.validate();
+ }
+ }
#endif
}
BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate)
{
LL_PROFILE_ZONE_SCOPED;
- drawablep->updateSpatialExtents();
-
- OctreeNode* parent = mOctreeNode->getOctParent();
-
- if (mOctreeNode->isInside(drawablep->getPositionGroup()) &&
- (mOctreeNode->contains(drawablep->getEntry()) ||
- (drawablep->getBinRadius() > mOctreeNode->getSize()[0] &&
- parent && parent->getElementCount() >= gOctreeMaxCapacity)))
- {
- unbound();
- setState(OBJECT_DIRTY);
- //setState(GEOM_DIRTY);
- return TRUE;
- }
-
- return FALSE;
+ drawablep->updateSpatialExtents();
+
+ OctreeNode* parent = mOctreeNode->getOctParent();
+
+ if (mOctreeNode->isInside(drawablep->getPositionGroup()) &&
+ (mOctreeNode->contains(drawablep->getEntry()) ||
+ (drawablep->getBinRadius() > mOctreeNode->getSize()[0] &&
+ parent && parent->getElementCount() >= gOctreeMaxCapacity)))
+ {
+ unbound();
+ setState(OBJECT_DIRTY);
+ //setState(GEOM_DIRTY);
+ return TRUE;
+ }
+
+ return FALSE;
}
void LLSpatialGroup::expandExtents(const LLVector4a* addingExtents, const LLXformMatrix& currentTransform)
{
- // Get coordinates of the adding extents
- const LLVector4a& min = addingExtents[0];
- const LLVector4a& max = addingExtents[1];
-
- // Get coordinates of all corners of the bounding box
- LLVector3 corners[] =
- {
- LLVector3(min[0], min[1], min[2]),
- LLVector3(min[0], min[1], max[2]),
- LLVector3(min[0], max[1], min[2]),
- LLVector3(min[0], max[1], max[2]),
- LLVector3(max[0], min[1], min[2]),
- LLVector3(max[0], min[1], max[2]),
- LLVector3(max[0], max[1], min[2]),
- LLVector3(max[0], max[1], max[2])
- };
-
- // New extents (to be expanded)
- LLVector3 extents[] =
- {
- LLVector3(mExtents[0].getF32ptr()),
- LLVector3(mExtents[1].getF32ptr())
- };
-
- LLQuaternion backwardRotation = ~currentTransform.getWorldRotation();
- for (LLVector3& corner : corners)
- {
- // Make coordinates relative to the current position
- corner -= currentTransform.getWorldPosition();
- // Rotate coordinates backward to the current rotation
- corner.rotVec(backwardRotation);
- // Expand root extents on the current corner
- for (int j = 0; j < 3; ++j)
- {
- if (corner[j] < extents[0][j])
- extents[0][j] = corner[j];
- if (corner[j] > extents[1][j])
- extents[1][j] = corner[j];
- }
- }
-
- // Set new expanded extents
- mExtents[0].load3(extents[0].mV);
- mExtents[1].load3(extents[1].mV);
-
- // Calculate new center and size
- mBounds[0].setAdd(mExtents[0], mExtents[1]);
- mBounds[0].mul(0.5f);
- mBounds[1].setSub(mExtents[0], mExtents[1]);
- mBounds[1].mul(0.5f);
+ // Get coordinates of the adding extents
+ const LLVector4a& min = addingExtents[0];
+ const LLVector4a& max = addingExtents[1];
+
+ // Get coordinates of all corners of the bounding box
+ LLVector3 corners[] =
+ {
+ LLVector3(min[0], min[1], min[2]),
+ LLVector3(min[0], min[1], max[2]),
+ LLVector3(min[0], max[1], min[2]),
+ LLVector3(min[0], max[1], max[2]),
+ LLVector3(max[0], min[1], min[2]),
+ LLVector3(max[0], min[1], max[2]),
+ LLVector3(max[0], max[1], min[2]),
+ LLVector3(max[0], max[1], max[2])
+ };
+
+ // New extents (to be expanded)
+ LLVector3 extents[] =
+ {
+ LLVector3(mExtents[0].getF32ptr()),
+ LLVector3(mExtents[1].getF32ptr())
+ };
+
+ LLQuaternion backwardRotation = ~currentTransform.getWorldRotation();
+ for (LLVector3& corner : corners)
+ {
+ // Make coordinates relative to the current position
+ corner -= currentTransform.getWorldPosition();
+ // Rotate coordinates backward to the current rotation
+ corner.rotVec(backwardRotation);
+ // Expand root extents on the current corner
+ for (int j = 0; j < 3; ++j)
+ {
+ if (corner[j] < extents[0][j])
+ extents[0][j] = corner[j];
+ if (corner[j] > extents[1][j])
+ extents[1][j] = corner[j];
+ }
+ }
+
+ // Set new expanded extents
+ mExtents[0].load3(extents[0].mV);
+ mExtents[1].load3(extents[1].mV);
+
+ // Calculate new center and size
+ mBounds[0].setAdd(mExtents[0], mExtents[1]);
+ mBounds[0].mul(0.5f);
+ mBounds[1].setSub(mExtents[0], mExtents[1]);
+ mBounds[1].mul(0.5f);
}
BOOL LLSpatialGroup::addObject(LLDrawable *drawablep)
{
- if(!drawablep)
- {
- return FALSE;
- }
- {
- drawablep->setGroup(this);
- setState(OBJECT_DIRTY | GEOM_DIRTY);
- setOcclusionState(LLSpatialGroup::DISCARD_QUERY, LLSpatialGroup::STATE_MODE_ALL_CAMERAS);
- gPipeline.markRebuild(this);
- if (drawablep->isSpatialBridge())
- {
- mBridgeList.push_back((LLSpatialBridge*) drawablep);
- }
- if (drawablep->getRadius() > 1.f)
- {
- setState(IMAGE_DIRTY);
- }
- }
-
- return TRUE;
+ if(!drawablep)
+ {
+ return FALSE;
+ }
+ {
+ drawablep->setGroup(this);
+ setState(OBJECT_DIRTY | GEOM_DIRTY);
+ setOcclusionState(LLSpatialGroup::DISCARD_QUERY, LLSpatialGroup::STATE_MODE_ALL_CAMERAS);
+ gPipeline.markRebuild(this);
+ if (drawablep->isSpatialBridge())
+ {
+ mBridgeList.push_back((LLSpatialBridge*) drawablep);
+ }
+ if (drawablep->getRadius() > 1.f)
+ {
+ setState(IMAGE_DIRTY);
+ }
+ }
+
+ return TRUE;
}
void LLSpatialGroup::rebuildGeom()
{
- if (!isDead())
- {
- getSpatialPartition()->rebuildGeom(this);
+ if (!isDead())
+ {
+ getSpatialPartition()->rebuildGeom(this);
- if (hasState(LLSpatialGroup::MESH_DIRTY))
- {
- gPipeline.markMeshDirty(this);
- }
- }
+ if (hasState(LLSpatialGroup::MESH_DIRTY))
+ {
+ gPipeline.markMeshDirty(this);
+ }
+ }
}
void LLSpatialGroup::rebuildMesh()
{
- if (!isDead())
- {
- getSpatialPartition()->rebuildMesh(this);
- }
+ if (!isDead())
+ {
+ getSpatialPartition()->rebuildMesh(this);
+ }
}
void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group)
{
- if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY))
- {
- return;
- }
-
- if (group->changeLOD())
- {
- group->mLastUpdateDistance = group->mDistance;
- group->mLastUpdateViewAngle = group->mViewAngle;
- }
-
+ if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY))
+ {
+ return;
+ }
+
+ if (group->changeLOD())
+ {
+ group->mLastUpdateDistance = group->mDistance;
+ group->mLastUpdateViewAngle = group->mViewAngle;
+ }
+
LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
- group->clearDrawMap();
-
- //get geometry count
- U32 index_count = 0;
- U32 vertex_count = 0;
+ group->clearDrawMap();
+
+ //get geometry count
+ U32 index_count = 0;
+ U32 vertex_count = 0;
addGeometryCount(group, vertex_count, index_count);
-
- if (vertex_count > 0 && index_count > 0)
- { //create vertex buffer containing volume geometry for this node
- {
- group->mBuilt = 1.f;
- if (group->mVertexBuffer.isNull() ||
+
+ if (vertex_count > 0 && index_count > 0)
+ { //create vertex buffer containing volume geometry for this node
+ {
+ group->mBuilt = 1.f;
+ if (group->mVertexBuffer.isNull() ||
group->mVertexBuffer->getNumVerts() != vertex_count ||
group->mVertexBuffer->getNumVerts() != index_count)
- {
- group->mVertexBuffer = new LLVertexBuffer(mVertexDataMask);
- if (!group->mVertexBuffer->allocateBuffer(vertex_count, index_count))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer on rebuild to "
- << vertex_count << " vertices and "
- << index_count << " indices" << LL_ENDL;
- group->mVertexBuffer = NULL;
- group->mBufferMap.clear();
- }
- }
- }
-
- if (group->mVertexBuffer)
- {
- getGeometry(group);
- }
- }
- else
- {
- group->mVertexBuffer = NULL;
- group->mBufferMap.clear();
- }
-
- group->mLastUpdateTime = gFrameTimeSeconds;
- group->clearState(LLSpatialGroup::GEOM_DIRTY);
+ {
+ group->mVertexBuffer = new LLVertexBuffer(mVertexDataMask);
+ if (!group->mVertexBuffer->allocateBuffer(vertex_count, index_count))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer on rebuild to "
+ << vertex_count << " vertices and "
+ << index_count << " indices" << LL_ENDL;
+ group->mVertexBuffer = NULL;
+ group->mBufferMap.clear();
+ }
+ }
+ }
+
+ if (group->mVertexBuffer)
+ {
+ getGeometry(group);
+ }
+ }
+ else
+ {
+ group->mVertexBuffer = NULL;
+ group->mBufferMap.clear();
+ }
+
+ group->mLastUpdateTime = gFrameTimeSeconds;
+ group->clearState(LLSpatialGroup::GEOM_DIRTY);
}
@@ -403,198 +403,198 @@ void LLSpatialPartition::rebuildMesh(LLSpatialGroup* group)
LLSpatialGroup* LLSpatialGroup::getParent()
{
- return (LLSpatialGroup*)LLViewerOctreeGroup::getParent();
- }
+ return (LLSpatialGroup*)LLViewerOctreeGroup::getParent();
+ }
BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
-
- if(!drawablep)
- {
- return FALSE;
- }
-
- unbound();
- if (mOctreeNode && !from_octree)
- {
- drawablep->setGroup(NULL);
- }
- else
- {
- drawablep->setGroup(NULL);
- setState(GEOM_DIRTY);
- gPipeline.markRebuild(this);
-
- if (drawablep->isSpatialBridge())
- {
- for (bridge_list_t::iterator i = mBridgeList.begin(); i != mBridgeList.end(); ++i)
- {
- if (*i == drawablep)
- {
- mBridgeList.erase(i);
- break;
- }
- }
- }
-
- if (getElementCount() == 0)
- { //delete draw map on last element removal since a rebuild might never happen
- clearDrawMap();
- }
- }
- return TRUE;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+
+ if(!drawablep)
+ {
+ return FALSE;
+ }
+
+ unbound();
+ if (mOctreeNode && !from_octree)
+ {
+ drawablep->setGroup(NULL);
+ }
+ else
+ {
+ drawablep->setGroup(NULL);
+ setState(GEOM_DIRTY);
+ gPipeline.markRebuild(this);
+
+ if (drawablep->isSpatialBridge())
+ {
+ for (bridge_list_t::iterator i = mBridgeList.begin(); i != mBridgeList.end(); ++i)
+ {
+ if (*i == drawablep)
+ {
+ mBridgeList.erase(i);
+ break;
+ }
+ }
+ }
+
+ if (getElementCount() == 0)
+ { //delete draw map on last element removal since a rebuild might never happen
+ clearDrawMap();
+ }
+ }
+ return TRUE;
}
void LLSpatialGroup::shift(const LLVector4a &offset)
{
- LLVector4a t = mOctreeNode->getCenter();
- t.add(offset);
- mOctreeNode->setCenter(t);
- mOctreeNode->updateMinMax();
- mBounds[0].add(offset);
- mExtents[0].add(offset);
- mExtents[1].add(offset);
- mObjectBounds[0].add(offset);
- mObjectExtents[0].add(offset);
- mObjectExtents[1].add(offset);
-
- if (!getSpatialPartition()->mRenderByGroup &&
- getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_TREE &&
- getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_TERRAIN &&
- getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_BRIDGE &&
- getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_AVATAR &&
- getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_CONTROL_AV)
- {
- setState(GEOM_DIRTY);
- gPipeline.markRebuild(this);
- }
+ LLVector4a t = mOctreeNode->getCenter();
+ t.add(offset);
+ mOctreeNode->setCenter(t);
+ mOctreeNode->updateMinMax();
+ mBounds[0].add(offset);
+ mExtents[0].add(offset);
+ mExtents[1].add(offset);
+ mObjectBounds[0].add(offset);
+ mObjectExtents[0].add(offset);
+ mObjectExtents[1].add(offset);
+
+ if (!getSpatialPartition()->mRenderByGroup &&
+ getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_TREE &&
+ getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_TERRAIN &&
+ getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_BRIDGE &&
+ getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_AVATAR &&
+ getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_CONTROL_AV)
+ {
+ setState(GEOM_DIRTY);
+ gPipeline.markRebuild(this);
+ }
}
class LLSpatialSetState : public OctreeTraveler
{
public:
- U32 mState;
- LLSpatialSetState(U32 state) : mState(state) { }
- virtual void visit(const OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->setState(mState); }
+ U32 mState;
+ LLSpatialSetState(U32 state) : mState(state) { }
+ virtual void visit(const OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->setState(mState); }
};
class LLSpatialSetStateDiff : public LLSpatialSetState
{
public:
- LLSpatialSetStateDiff(U32 state) : LLSpatialSetState(state) { }
-
- virtual void traverse(const OctreeNode* n)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0);
-
- if (!group->hasState(mState))
- {
- OctreeTraveler::traverse(n);
- }
- }
+ LLSpatialSetStateDiff(U32 state) : LLSpatialSetState(state) { }
+
+ virtual void traverse(const OctreeNode* n)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0);
+
+ if (!group->hasState(mState))
+ {
+ OctreeTraveler::traverse(n);
+ }
+ }
};
-void LLSpatialGroup::setState(U32 state, S32 mode)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
-
- llassert(state <= LLSpatialGroup::STATE_MASK);
-
- if (mode > STATE_MODE_SINGLE)
- {
- if (mode == STATE_MODE_DIFF)
- {
- LLSpatialSetStateDiff setter(state);
- setter.traverse(mOctreeNode);
- }
- else
- {
- LLSpatialSetState setter(state);
- setter.traverse(mOctreeNode);
- }
- }
- else
- {
- mState |= state;
- }
+void LLSpatialGroup::setState(U32 state, S32 mode)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+
+ llassert(state <= LLSpatialGroup::STATE_MASK);
+
+ if (mode > STATE_MODE_SINGLE)
+ {
+ if (mode == STATE_MODE_DIFF)
+ {
+ LLSpatialSetStateDiff setter(state);
+ setter.traverse(mOctreeNode);
+ }
+ else
+ {
+ LLSpatialSetState setter(state);
+ setter.traverse(mOctreeNode);
+ }
+ }
+ else
+ {
+ mState |= state;
+ }
}
class LLSpatialClearState : public OctreeTraveler
{
public:
- U32 mState;
- LLSpatialClearState(U32 state) : mState(state) { }
- virtual void visit(const OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->clearState(mState); }
+ U32 mState;
+ LLSpatialClearState(U32 state) : mState(state) { }
+ virtual void visit(const OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->clearState(mState); }
};
class LLSpatialClearStateDiff : public LLSpatialClearState
{
public:
- LLSpatialClearStateDiff(U32 state) : LLSpatialClearState(state) { }
-
- virtual void traverse(const OctreeNode* n)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0);
-
- if (group->hasState(mState))
- {
- OctreeTraveler::traverse(n);
- }
- }
+ LLSpatialClearStateDiff(U32 state) : LLSpatialClearState(state) { }
+
+ virtual void traverse(const OctreeNode* n)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0);
+
+ if (group->hasState(mState))
+ {
+ OctreeTraveler::traverse(n);
+ }
+ }
};
void LLSpatialGroup::clearState(U32 state, S32 mode)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
-
- llassert(state <= LLSpatialGroup::STATE_MASK);
-
- if (mode > STATE_MODE_SINGLE)
- {
- if (mode == STATE_MODE_DIFF)
- {
- LLSpatialClearStateDiff clearer(state);
- clearer.traverse(mOctreeNode);
- }
- else
- {
- LLSpatialClearState clearer(state);
- clearer.traverse(mOctreeNode);
- }
- }
- else
- {
- mState &= ~state;
- }
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+
+ llassert(state <= LLSpatialGroup::STATE_MASK);
+
+ if (mode > STATE_MODE_SINGLE)
+ {
+ if (mode == STATE_MODE_DIFF)
+ {
+ LLSpatialClearStateDiff clearer(state);
+ clearer.traverse(mOctreeNode);
+ }
+ else
+ {
+ LLSpatialClearState clearer(state);
+ clearer.traverse(mOctreeNode);
+ }
+ }
+ else
+ {
+ mState &= ~state;
+ }
}
//======================================
-// Octree Listener Implementation
+// Octree Listener Implementation
//======================================
LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : LLOcclusionCullingGroup(node, part),
- mObjectBoxSize(1.f),
- mGeometryBytes(0),
- mSurfaceArea(0.f),
- mBuilt(0.f),
- mVertexBuffer(NULL),
- mDistance(0.f),
- mDepth(0.f),
- mLastUpdateDistance(-1.f),
- mLastUpdateTime(gFrameTimeSeconds)
-{
- ll_assert_aligned(this,16);
-
- sNodeCount++;
-
- mViewAngle.splat(0.f);
- mLastUpdateViewAngle.splat(-1.f);
-
- sg_assert(mOctreeNode->getListenerCount() == 0);
- setState(SG_INITIAL_STATE_MASK);
- gPipeline.markRebuild(this);
-
+ mObjectBoxSize(1.f),
+ mGeometryBytes(0),
+ mSurfaceArea(0.f),
+ mBuilt(0.f),
+ mVertexBuffer(NULL),
+ mDistance(0.f),
+ mDepth(0.f),
+ mLastUpdateDistance(-1.f),
+ mLastUpdateTime(gFrameTimeSeconds)
+{
+ ll_assert_aligned(this,16);
+
+ sNodeCount++;
+
+ mViewAngle.splat(0.f);
+ mLastUpdateViewAngle.splat(-1.f);
+
+ sg_assert(mOctreeNode->getListenerCount() == 0);
+ setState(SG_INITIAL_STATE_MASK);
+ gPipeline.markRebuild(this);
+
// let the reflection map manager know about this spatial group
mReflectionProbe = gPipeline.mReflectionMapManager.registerSpatialGroup(this);
@@ -604,141 +604,141 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : LLO
void LLSpatialGroup::updateDistance(LLCamera &camera)
{
- if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
- {
- LL_WARNS() << "Attempted to update distance for camera other than world camera!" << LL_ENDL;
+ if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
+ {
+ LL_WARNS() << "Attempted to update distance for camera other than world camera!" << LL_ENDL;
llassert(false);
- return;
- }
+ return;
+ }
- if (gShiftFrame)
- {
- return;
- }
+ if (gShiftFrame)
+ {
+ return;
+ }
#if !LL_RELEASE_FOR_DOWNLOAD
- if (hasState(LLSpatialGroup::OBJECT_DIRTY))
- {
- LL_ERRS() << "Spatial group dirty on distance update." << LL_ENDL;
- }
+ if (hasState(LLSpatialGroup::OBJECT_DIRTY))
+ {
+ LL_ERRS() << "Spatial group dirty on distance update." << LL_ENDL;
+ }
#endif
- if (!isEmpty())
- {
- mRadius = getSpatialPartition()->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() :
- (F32) mOctreeNode->getSize().getLength3().getF32();
- mDistance = getSpatialPartition()->calcDistance(this, camera);
- mPixelArea = getSpatialPartition()->calcPixelArea(this, camera);
- }
+ if (!isEmpty())
+ {
+ mRadius = getSpatialPartition()->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() :
+ (F32) mOctreeNode->getSize().getLength3().getF32();
+ mDistance = getSpatialPartition()->calcDistance(this, camera);
+ mPixelArea = getSpatialPartition()->calcPixelArea(this, camera);
+ }
}
F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
-
- LLVector4a eye;
- LLVector4a origin;
- origin.load3(camera.getOrigin().mV);
-
- eye.setSub(group->mObjectBounds[0], origin);
-
- F32 dist = 0.f;
-
- if (group->mDrawMap.find(LLRenderPass::PASS_ALPHA) != group->mDrawMap.end())
- {
- LLVector4a v = eye;
-
- dist = eye.getLength3().getF32();
- eye.normalize3fast();
-
- if (!group->hasState(LLSpatialGroup::ALPHA_DIRTY))
- {
- if (!group->getSpatialPartition()->isBridge())
- {
- LLVector4a view_angle = eye;
-
- LLVector4a diff;
- diff.setSub(view_angle, group->mLastUpdateViewAngle);
-
- if (diff.getLength3().getF32() > 0.64f)
- {
- group->mViewAngle = view_angle;
- group->mLastUpdateViewAngle = view_angle;
- //for occasional alpha sorting within the group
- //NOTE: If there is a trivial way to detect that alpha sorting here would not change the render order,
- //not setting this node to dirty would be a very good thing
- group->setState(LLSpatialGroup::ALPHA_DIRTY);
- gPipeline.markRebuild(group);
- }
- }
- }
-
- //calculate depth of node for alpha sorting
-
- LLVector3 at = camera.getAtAxis();
-
- LLVector4a ata;
- ata.load3(at.mV);
-
- LLVector4a t = ata;
- //front of bounding box
- t.mul(0.25f);
- t.mul(group->mObjectBounds[1]);
- v.sub(t);
-
- group->mDepth = v.dot3(ata).getF32();
- }
- else
- {
- dist = eye.getLength3().getF32();
- }
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+
+ LLVector4a eye;
+ LLVector4a origin;
+ origin.load3(camera.getOrigin().mV);
+
+ eye.setSub(group->mObjectBounds[0], origin);
+
+ F32 dist = 0.f;
+
+ if (group->mDrawMap.find(LLRenderPass::PASS_ALPHA) != group->mDrawMap.end())
+ {
+ LLVector4a v = eye;
+
+ dist = eye.getLength3().getF32();
+ eye.normalize3fast();
+
+ if (!group->hasState(LLSpatialGroup::ALPHA_DIRTY))
+ {
+ if (!group->getSpatialPartition()->isBridge())
+ {
+ LLVector4a view_angle = eye;
+
+ LLVector4a diff;
+ diff.setSub(view_angle, group->mLastUpdateViewAngle);
+
+ if (diff.getLength3().getF32() > 0.64f)
+ {
+ group->mViewAngle = view_angle;
+ group->mLastUpdateViewAngle = view_angle;
+ //for occasional alpha sorting within the group
+ //NOTE: If there is a trivial way to detect that alpha sorting here would not change the render order,
+ //not setting this node to dirty would be a very good thing
+ group->setState(LLSpatialGroup::ALPHA_DIRTY);
+ gPipeline.markRebuild(group);
+ }
+ }
+ }
+
+ //calculate depth of node for alpha sorting
+
+ LLVector3 at = camera.getAtAxis();
+
+ LLVector4a ata;
+ ata.load3(at.mV);
+
+ LLVector4a t = ata;
+ //front of bounding box
+ t.mul(0.25f);
+ t.mul(group->mObjectBounds[1]);
+ v.sub(t);
+
+ group->mDepth = v.dot3(ata).getF32();
+ }
+ else
+ {
+ dist = eye.getLength3().getF32();
+ }
#if !LL_RELEASE
- LL_DEBUGS("RiggedBox") << "calcDistance, group " << group << " camera " << origin << " obj bounds "
- << group->mObjectBounds[0] << ", " << group->mObjectBounds[1]
+ LL_DEBUGS("RiggedBox") << "calcDistance, group " << group << " camera " << origin << " obj bounds "
+ << group->mObjectBounds[0] << ", " << group->mObjectBounds[1]
<< " dist " << dist << " radius " << group->mRadius << LL_ENDL;
#endif
- if (dist < 16.f)
- {
- dist /= 16.f;
- dist *= dist;
- dist *= 16.f;
- }
+ if (dist < 16.f)
+ {
+ dist /= 16.f;
+ dist *= dist;
+ dist *= 16.f;
+ }
- return dist;
+ return dist;
}
F32 LLSpatialPartition::calcPixelArea(LLSpatialGroup* group, LLCamera& camera)
{
- return LLPipeline::calcPixelArea(group->mObjectBounds[0], group->mObjectBounds[1], camera);
+ return LLPipeline::calcPixelArea(group->mObjectBounds[0], group->mObjectBounds[1], camera);
}
F32 LLSpatialGroup::getUpdateUrgency() const
{
- if (!isVisible())
- {
- return 0.f;
- }
- else
- {
- F32 time = gFrameTimeSeconds-mLastUpdateTime+4.f;
- return time + (mObjectBounds[1].dot3(mObjectBounds[1]).getF32()+1.f)/mDistance;
- }
+ if (!isVisible())
+ {
+ return 0.f;
+ }
+ else
+ {
+ F32 time = gFrameTimeSeconds-mLastUpdateTime+4.f;
+ return time + (mObjectBounds[1].dot3(mObjectBounds[1]).getF32()+1.f)/mDistance;
+ }
}
BOOL LLSpatialGroup::changeLOD()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
- if (hasState(ALPHA_DIRTY | OBJECT_DIRTY))
- {
- //a rebuild is going to happen, update distance and LoD
- return TRUE;
- }
+ if (hasState(ALPHA_DIRTY | OBJECT_DIRTY))
+ {
+ //a rebuild is going to happen, update distance and LoD
+ return TRUE;
+ }
- if (getSpatialPartition()->mSlopRatio > 0.f)
- {
- F32 ratio = (mDistance - mLastUpdateDistance)/(llmax(mLastUpdateDistance, mRadius));
+ if (getSpatialPartition()->mSlopRatio > 0.f)
+ {
+ F32 ratio = (mDistance - mLastUpdateDistance)/(llmax(mLastUpdateDistance, mRadius));
// MAINT-8264 - this check is not robust if it needs to work
// for bounding boxes much larger than the actual enclosed
@@ -752,85 +752,85 @@ BOOL LLSpatialGroup::changeLOD()
// was large only due to another error, so this logic did not
// need to be changed.
- if (fabsf(ratio) >= getSpatialPartition()->mSlopRatio)
- {
+ if (fabsf(ratio) >= getSpatialPartition()->mSlopRatio)
+ {
LL_DEBUGS("RiggedBox") << "changeLOD true because of ratio compare "
<< fabsf(ratio) << " " << getSpatialPartition()->mSlopRatio << LL_ENDL;
LL_DEBUGS("RiggedBox") << "sg " << this << "\nmDistance " << mDistance
<< " mLastUpdateDistance " << mLastUpdateDistance
<< " mRadius " << mRadius
- << " fab ratio " << fabsf(ratio)
+ << " fab ratio " << fabsf(ratio)
<< " slop " << getSpatialPartition()->mSlopRatio << LL_ENDL;
-
- return TRUE;
- }
- }
-
- if (needsUpdate())
- {
- return TRUE;
- }
-
- return FALSE;
+
+ return TRUE;
+ }
+ }
+
+ if (needsUpdate())
+ {
+ return TRUE;
+ }
+
+ return FALSE;
}
void LLSpatialGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry* entry)
{
- addObject((LLDrawable*)entry->getDrawable());
- unbound();
- setState(OBJECT_DIRTY);
+ addObject((LLDrawable*)entry->getDrawable());
+ unbound();
+ setState(OBJECT_DIRTY);
}
void LLSpatialGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* entry)
{
- removeObject((LLDrawable*)entry->getDrawable(), TRUE);
- LLViewerOctreeGroup::handleRemoval(node, entry);
+ removeObject((LLDrawable*)entry->getDrawable(), TRUE);
+ LLViewerOctreeGroup::handleRemoval(node, entry);
}
void LLSpatialGroup::handleDestruction(const TreeNode* node)
{
- if(isDead())
- {
- return;
- }
- setState(DEAD);
-
- for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)
- {
- LLViewerOctreeEntry* entry = *i;
-
- if (entry->getGroup() == this)
- {
- if(entry->hasDrawable())
- {
- ((LLDrawable*)entry->getDrawable())->setGroup(NULL);
- }
- }
- }
-
- clearDrawMap();
- mVertexBuffer = NULL;
- mBufferMap.clear();
- sZombieGroups++;
- mOctreeNode = NULL;
+ if(isDead())
+ {
+ return;
+ }
+ setState(DEAD);
+
+ for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)
+ {
+ LLViewerOctreeEntry* entry = *i;
+
+ if (entry->getGroup() == this)
+ {
+ if(entry->hasDrawable())
+ {
+ ((LLDrawable*)entry->getDrawable())->setGroup(NULL);
+ }
+ }
+ }
+
+ clearDrawMap();
+ mVertexBuffer = NULL;
+ mBufferMap.clear();
+ sZombieGroups++;
+ mOctreeNode = NULL;
}
-void LLSpatialGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child)
+void LLSpatialGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
- if (child->getListenerCount() == 0)
- {
- new LLSpatialGroup(child, getSpatialPartition());
- }
- else
- {
- OCT_ERRS << "LLSpatialGroup redundancy detected." << LL_ENDL;
- }
+ if (child->getListenerCount() == 0)
+ {
+ new LLSpatialGroup(child, getSpatialPartition());
+ }
+ else
+ {
+ OCT_ERRS << "LLSpatialGroup redundancy detected." << LL_ENDL;
+ }
- unbound();
+ unbound();
- assert_states_valid(this);
+ assert_states_valid(this);
}
//virtual
@@ -871,41 +871,41 @@ void LLSpatialGroup::rebound()
void LLSpatialGroup::destroyGLState(bool keep_occlusion)
{
- setState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::IMAGE_DIRTY);
-
- if (!keep_occlusion)
- { //going to need a rebuild
- gPipeline.markRebuild(this);
- }
-
- mLastUpdateTime = gFrameTimeSeconds;
- mVertexBuffer = NULL;
- mBufferMap.clear();
-
- clearDrawMap();
-
- if (!keep_occlusion)
- {
- releaseOcclusionQueryObjectNames();
- }
-
-
- for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i)
- {
- LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
- if(!drawable)
- {
- continue;
- }
- for (S32 j = 0; j < drawable->getNumFaces(); j++)
- {
- LLFace* facep = drawable->getFace(j);
- if (facep)
- {
- facep->clearVertexBuffer();
- }
- }
- }
+ setState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::IMAGE_DIRTY);
+
+ if (!keep_occlusion)
+ { //going to need a rebuild
+ gPipeline.markRebuild(this);
+ }
+
+ mLastUpdateTime = gFrameTimeSeconds;
+ mVertexBuffer = NULL;
+ mBufferMap.clear();
+
+ clearDrawMap();
+
+ if (!keep_occlusion)
+ {
+ releaseOcclusionQueryObjectNames();
+ }
+
+
+ for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i)
+ {
+ LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
+ if(!drawable)
+ {
+ continue;
+ }
+ for (S32 j = 0; j < drawable->getNumFaces(); j++)
+ {
+ LLFace* facep = drawable->getFace(j);
+ if (facep)
+ {
+ facep->clearVertexBuffer();
+ }
+ }
+ }
}
//==============================================
@@ -913,14 +913,14 @@ void LLSpatialGroup::destroyGLState(bool keep_occlusion)
LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, LLViewerRegion* regionp)
: mRenderByGroup(render_by_group), mBridge(NULL)
{
- mRegionp = regionp;
- mPartitionType = LLViewerRegion::PARTITION_NONE;
- mVertexDataMask = data_mask;
- mDepthMask = FALSE;
- mSlopRatio = 0.25f;
- mInfiniteFarClip = FALSE;
+ mRegionp = regionp;
+ mPartitionType = LLViewerRegion::PARTITION_NONE;
+ mVertexDataMask = data_mask;
+ mDepthMask = FALSE;
+ mSlopRatio = 0.25f;
+ mInfiniteFarClip = FALSE;
- new LLSpatialGroup(mOctree, this);
+ new LLSpatialGroup(mOctree, this);
}
@@ -932,391 +932,391 @@ LLSpatialPartition::~LLSpatialPartition()
LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, BOOL was_visible)
{
LL_PROFILE_ZONE_SCOPED;
- drawablep->updateSpatialExtents();
-
- //keep drawable from being garbage collected
- LLPointer<LLDrawable> ptr = drawablep;
-
- if(!drawablep->getGroup())
- {
- assert_octree_valid(mOctree);
- mOctree->insert(drawablep->getEntry());
- assert_octree_valid(mOctree);
- }
-
- LLSpatialGroup* group = drawablep->getSpatialGroup();
- //llassert(group != NULL);
-
- if (group && was_visible && group->isOcclusionState(LLSpatialGroup::QUERY_PENDING))
- {
- group->setOcclusionState(LLSpatialGroup::DISCARD_QUERY, LLSpatialGroup::STATE_MODE_ALL_CAMERAS);
- }
-
- return group;
+ drawablep->updateSpatialExtents();
+
+ //keep drawable from being garbage collected
+ LLPointer<LLDrawable> ptr = drawablep;
+
+ if(!drawablep->getGroup())
+ {
+ assert_octree_valid(mOctree);
+ mOctree->insert(drawablep->getEntry());
+ assert_octree_valid(mOctree);
+ }
+
+ LLSpatialGroup* group = drawablep->getSpatialGroup();
+ //llassert(group != NULL);
+
+ if (group && was_visible && group->isOcclusionState(LLSpatialGroup::QUERY_PENDING))
+ {
+ group->setOcclusionState(LLSpatialGroup::DISCARD_QUERY, LLSpatialGroup::STATE_MODE_ALL_CAMERAS);
+ }
+
+ return group;
}
BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp)
{
LL_PROFILE_ZONE_SCOPED;
- if (!curp->removeObject(drawablep))
- {
- OCT_ERRS << "Failed to remove drawable from octree!" << LL_ENDL;
- }
- else
- {
- drawablep->setGroup(NULL);
- }
-
- assert_octree_valid(mOctree);
-
- return TRUE;
+ if (!curp->removeObject(drawablep))
+ {
+ OCT_ERRS << "Failed to remove drawable from octree!" << LL_ENDL;
+ }
+ else
+ {
+ drawablep->setGroup(NULL);
+ }
+
+ assert_octree_valid(mOctree);
+
+ return TRUE;
}
void LLSpatialPartition::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate)
{
LL_PROFILE_ZONE_SCOPED;
- // sanity check submitted by open source user bushing Spatula
- // who was seeing crashing here. (See VWR-424 reported by Bunny Mayne)
- if (!drawablep)
- {
- OCT_ERRS << "LLSpatialPartition::move was passed a bad drawable." << LL_ENDL;
- return;
- }
-
- BOOL was_visible = curp ? curp->isVisible() : FALSE;
-
- if (curp && curp->getSpatialPartition() != this)
- {
- //keep drawable from being garbage collected
- LLPointer<LLDrawable> ptr = drawablep;
- if (curp->getSpatialPartition()->remove(drawablep, curp))
- {
- put(drawablep, was_visible);
- return;
- }
- else
- {
- OCT_ERRS << "Drawable lost between spatial partitions on outbound transition." << LL_ENDL;
- }
- }
-
- if (curp && curp->updateInGroup(drawablep, immediate))
- {
- // Already updated, don't need to do anything
- assert_octree_valid(mOctree);
- return;
- }
-
- //keep drawable from being garbage collected
- LLPointer<LLDrawable> ptr = drawablep;
- if (curp && !remove(drawablep, curp))
- {
- OCT_ERRS << "Move couldn't find existing spatial group!" << LL_ENDL;
- }
-
- put(drawablep, was_visible);
+ // sanity check submitted by open source user bushing Spatula
+ // who was seeing crashing here. (See VWR-424 reported by Bunny Mayne)
+ if (!drawablep)
+ {
+ OCT_ERRS << "LLSpatialPartition::move was passed a bad drawable." << LL_ENDL;
+ return;
+ }
+
+ BOOL was_visible = curp ? curp->isVisible() : FALSE;
+
+ if (curp && curp->getSpatialPartition() != this)
+ {
+ //keep drawable from being garbage collected
+ LLPointer<LLDrawable> ptr = drawablep;
+ if (curp->getSpatialPartition()->remove(drawablep, curp))
+ {
+ put(drawablep, was_visible);
+ return;
+ }
+ else
+ {
+ OCT_ERRS << "Drawable lost between spatial partitions on outbound transition." << LL_ENDL;
+ }
+ }
+
+ if (curp && curp->updateInGroup(drawablep, immediate))
+ {
+ // Already updated, don't need to do anything
+ assert_octree_valid(mOctree);
+ return;
+ }
+
+ //keep drawable from being garbage collected
+ LLPointer<LLDrawable> ptr = drawablep;
+ if (curp && !remove(drawablep, curp))
+ {
+ OCT_ERRS << "Move couldn't find existing spatial group!" << LL_ENDL;
+ }
+
+ put(drawablep, was_visible);
}
class LLSpatialShift : public OctreeTraveler
{
public:
- const LLVector4a& mOffset;
+ const LLVector4a& mOffset;
- LLSpatialShift(const LLVector4a& offset) : mOffset(offset) { }
- virtual void visit(const OctreeNode* branch)
- {
- ((LLSpatialGroup*) branch->getListener(0))->shift(mOffset);
- }
+ LLSpatialShift(const LLVector4a& offset) : mOffset(offset) { }
+ virtual void visit(const OctreeNode* branch)
+ {
+ ((LLSpatialGroup*) branch->getListener(0))->shift(mOffset);
+ }
};
void LLSpatialPartition::shift(const LLVector4a &offset)
{ //shift octree node bounding boxes by offset
- LLSpatialShift shifter(offset);
- shifter.traverse(mOctree);
+ LLSpatialShift shifter(offset);
+ shifter.traverse(mOctree);
}
class LLOctreeCull : public LLViewerOctreeCull
{
public:
- LLOctreeCull(LLCamera* camera) : LLViewerOctreeCull(camera) {}
+ LLOctreeCull(LLCamera* camera) : LLViewerOctreeCull(camera) {}
- virtual bool earlyFail(LLViewerOctreeGroup* base_group)
- {
+ virtual bool earlyFail(LLViewerOctreeGroup* base_group)
+ {
if (LLPipeline::sReflectionRender)
{
return false;
}
- LLSpatialGroup* group = (LLSpatialGroup*)base_group;
- group->checkOcclusion();
-
- if (group->getOctreeNode()->getParent() && //never occlusion cull the root node
- LLPipeline::sUseOcclusion && //ignore occlusion if disabled
- group->isOcclusionState(LLSpatialGroup::OCCLUDED))
- {
- gPipeline.markOccluder(group);
- return true;
- }
-
- return false;
- }
-
- virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
- {
- S32 res = AABBInFrustumNoFarClipGroupBounds(group);
- if (res != 0)
- {
- res = llmin(res, AABBSphereIntersectGroupExtents(group));
- }
- return res;
- }
-
- virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
- {
- S32 res = AABBInFrustumNoFarClipObjectBounds(group);
- if (res != 0)
- {
- res = llmin(res, AABBSphereIntersectObjectExtents(group));
- }
- return res;
- }
-
- virtual void processGroup(LLViewerOctreeGroup* base_group)
- {
- LLSpatialGroup* group = (LLSpatialGroup*)base_group;
- /*if (group->needsUpdate() ||
- group->getVisible(LLViewerCamera::sCurCameraID) < LLDrawable::getCurrentFrame() - 1)
- {
- group->doOcclusion(mCamera);
- }*/
- gPipeline.markNotCulled(group, *mCamera);
- }
+ LLSpatialGroup* group = (LLSpatialGroup*)base_group;
+ group->checkOcclusion();
+
+ if (group->getOctreeNode()->getParent() && //never occlusion cull the root node
+ LLPipeline::sUseOcclusion && //ignore occlusion if disabled
+ group->isOcclusionState(LLSpatialGroup::OCCLUDED))
+ {
+ gPipeline.markOccluder(group);
+ return true;
+ }
+
+ return false;
+ }
+
+ virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
+ {
+ S32 res = AABBInFrustumNoFarClipGroupBounds(group);
+ if (res != 0)
+ {
+ res = llmin(res, AABBSphereIntersectGroupExtents(group));
+ }
+ return res;
+ }
+
+ virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
+ {
+ S32 res = AABBInFrustumNoFarClipObjectBounds(group);
+ if (res != 0)
+ {
+ res = llmin(res, AABBSphereIntersectObjectExtents(group));
+ }
+ return res;
+ }
+
+ virtual void processGroup(LLViewerOctreeGroup* base_group)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*)base_group;
+ /*if (group->needsUpdate() ||
+ group->getVisible(LLViewerCamera::sCurCameraID) < LLDrawable::getCurrentFrame() - 1)
+ {
+ group->doOcclusion(mCamera);
+ }*/
+ gPipeline.markNotCulled(group, *mCamera);
+ }
};
class LLOctreeCullNoFarClip : public LLOctreeCull
{
-public:
- LLOctreeCullNoFarClip(LLCamera* camera)
- : LLOctreeCull(camera) { }
+public:
+ LLOctreeCullNoFarClip(LLCamera* camera)
+ : LLOctreeCull(camera) { }
- virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
- {
- return AABBInFrustumNoFarClipGroupBounds(group);
- }
+ virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
+ {
+ return AABBInFrustumNoFarClipGroupBounds(group);
+ }
- virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
- {
- S32 res = AABBInFrustumNoFarClipObjectBounds(group);
- return res;
- }
+ virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
+ {
+ S32 res = AABBInFrustumNoFarClipObjectBounds(group);
+ return res;
+ }
};
class LLOctreeCullShadow : public LLOctreeCull
{
public:
- LLOctreeCullShadow(LLCamera* camera)
- : LLOctreeCull(camera) { }
-
- virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
- {
- return AABBInFrustumGroupBounds(group);
- }
-
- virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
- {
- return AABBInFrustumObjectBounds(group);
- }
+ LLOctreeCullShadow(LLCamera* camera)
+ : LLOctreeCull(camera) { }
+
+ virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
+ {
+ return AABBInFrustumGroupBounds(group);
+ }
+
+ virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
+ {
+ return AABBInFrustumObjectBounds(group);
+ }
};
class LLOctreeCullVisExtents: public LLOctreeCullShadow
{
public:
- LLOctreeCullVisExtents(LLCamera* camera, LLVector4a& min, LLVector4a& max)
- : LLOctreeCullShadow(camera), mMin(min), mMax(max), mEmpty(TRUE) { }
-
- virtual bool earlyFail(LLViewerOctreeGroup* base_group)
- {
- LLSpatialGroup* group = (LLSpatialGroup*)base_group;
-
- if (group->getOctreeNode()->getParent() && //never occlusion cull the root node
- LLPipeline::sUseOcclusion && //ignore occlusion if disabled
- group->isOcclusionState(LLSpatialGroup::OCCLUDED))
- {
- return true;
- }
-
- return false;
- }
-
- virtual void traverse(const OctreeNode* n)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0);
-
- if (earlyFail(group))
- {
- return;
- }
-
- if ((mRes && group->hasState(LLSpatialGroup::SKIP_FRUSTUM_CHECK)) ||
- mRes == 2)
- { //don't need to do frustum check
- OctreeTraveler::traverse(n);
- }
- else
- {
- mRes = frustumCheck(group);
-
- if (mRes)
- { //at least partially in, run on down
- OctreeTraveler::traverse(n);
- }
-
- mRes = 0;
- }
- }
-
- virtual void processGroup(LLViewerOctreeGroup* base_group)
- {
- LLSpatialGroup* group = (LLSpatialGroup*)base_group;
-
- llassert(!group->hasState(LLSpatialGroup::DIRTY) && !group->isEmpty());
-
- if (mRes < 2)
- {
- if (AABBInFrustumObjectBounds(group) > 0)
- {
- mEmpty = FALSE;
- const LLVector4a* exts = group->getObjectExtents();
- update_min_max(mMin, mMax, exts[0]);
- update_min_max(mMin, mMax, exts[1]);
- }
- }
- else
- {
- mEmpty = FALSE;
- const LLVector4a* exts = group->getExtents();
- update_min_max(mMin, mMax, exts[0]);
- update_min_max(mMin, mMax, exts[1]);
- }
- }
-
- BOOL mEmpty;
- LLVector4a& mMin;
- LLVector4a& mMax;
+ LLOctreeCullVisExtents(LLCamera* camera, LLVector4a& min, LLVector4a& max)
+ : LLOctreeCullShadow(camera), mMin(min), mMax(max), mEmpty(TRUE) { }
+
+ virtual bool earlyFail(LLViewerOctreeGroup* base_group)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*)base_group;
+
+ if (group->getOctreeNode()->getParent() && //never occlusion cull the root node
+ LLPipeline::sUseOcclusion && //ignore occlusion if disabled
+ group->isOcclusionState(LLSpatialGroup::OCCLUDED))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ virtual void traverse(const OctreeNode* n)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0);
+
+ if (earlyFail(group))
+ {
+ return;
+ }
+
+ if ((mRes && group->hasState(LLSpatialGroup::SKIP_FRUSTUM_CHECK)) ||
+ mRes == 2)
+ { //don't need to do frustum check
+ OctreeTraveler::traverse(n);
+ }
+ else
+ {
+ mRes = frustumCheck(group);
+
+ if (mRes)
+ { //at least partially in, run on down
+ OctreeTraveler::traverse(n);
+ }
+
+ mRes = 0;
+ }
+ }
+
+ virtual void processGroup(LLViewerOctreeGroup* base_group)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*)base_group;
+
+ llassert(!group->hasState(LLSpatialGroup::DIRTY) && !group->isEmpty());
+
+ if (mRes < 2)
+ {
+ if (AABBInFrustumObjectBounds(group) > 0)
+ {
+ mEmpty = FALSE;
+ const LLVector4a* exts = group->getObjectExtents();
+ update_min_max(mMin, mMax, exts[0]);
+ update_min_max(mMin, mMax, exts[1]);
+ }
+ }
+ else
+ {
+ mEmpty = FALSE;
+ const LLVector4a* exts = group->getExtents();
+ update_min_max(mMin, mMax, exts[0]);
+ update_min_max(mMin, mMax, exts[1]);
+ }
+ }
+
+ BOOL mEmpty;
+ LLVector4a& mMin;
+ LLVector4a& mMax;
};
class LLOctreeCullDetectVisible: public LLOctreeCullShadow
{
public:
- LLOctreeCullDetectVisible(LLCamera* camera)
- : LLOctreeCullShadow(camera), mResult(FALSE) { }
-
- virtual bool earlyFail(LLViewerOctreeGroup* base_group)
- {
- LLSpatialGroup* group = (LLSpatialGroup*)base_group;
-
- if (mResult || //already found a node, don't check any more
- (group->getOctreeNode()->getParent() && //never occlusion cull the root node
- LLPipeline::sUseOcclusion && //ignore occlusion if disabled
- group->isOcclusionState(LLSpatialGroup::OCCLUDED)))
- {
- return true;
- }
-
- return false;
- }
-
- virtual void processGroup(LLViewerOctreeGroup* base_group)
- {
- if (base_group->isVisible())
- {
- mResult = TRUE;
- }
- }
-
- BOOL mResult;
+ LLOctreeCullDetectVisible(LLCamera* camera)
+ : LLOctreeCullShadow(camera), mResult(FALSE) { }
+
+ virtual bool earlyFail(LLViewerOctreeGroup* base_group)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*)base_group;
+
+ if (mResult || //already found a node, don't check any more
+ (group->getOctreeNode()->getParent() && //never occlusion cull the root node
+ LLPipeline::sUseOcclusion && //ignore occlusion if disabled
+ group->isOcclusionState(LLSpatialGroup::OCCLUDED)))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ virtual void processGroup(LLViewerOctreeGroup* base_group)
+ {
+ if (base_group->isVisible())
+ {
+ mResult = TRUE;
+ }
+ }
+
+ BOOL mResult;
};
class LLOctreeSelect : public LLOctreeCull
{
public:
- LLOctreeSelect(LLCamera* camera, std::vector<LLDrawable*>* results)
- : LLOctreeCull(camera), mResults(results) { }
-
- virtual bool earlyFail(LLViewerOctreeGroup* group) { return false; }
- virtual void preprocess(LLViewerOctreeGroup* group) { }
-
- virtual void processGroup(LLViewerOctreeGroup* base_group)
- {
- LLSpatialGroup* group = (LLSpatialGroup*)base_group;
- OctreeNode* branch = group->getOctreeNode();
-
- for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
- {
- LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
- if(!drawable)
- {
- continue;
- }
- if (!drawable->isDead())
- {
- if (drawable->isSpatialBridge())
- {
- drawable->setVisible(*mCamera, mResults, TRUE);
- }
- else
- {
- mResults->push_back(drawable);
- }
- }
- }
- }
-
- std::vector<LLDrawable*>* mResults;
+ LLOctreeSelect(LLCamera* camera, std::vector<LLDrawable*>* results)
+ : LLOctreeCull(camera), mResults(results) { }
+
+ virtual bool earlyFail(LLViewerOctreeGroup* group) { return false; }
+ virtual void preprocess(LLViewerOctreeGroup* group) { }
+
+ virtual void processGroup(LLViewerOctreeGroup* base_group)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*)base_group;
+ OctreeNode* branch = group->getOctreeNode();
+
+ for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
+ {
+ LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
+ if(!drawable)
+ {
+ continue;
+ }
+ if (!drawable->isDead())
+ {
+ if (drawable->isSpatialBridge())
+ {
+ drawable->setVisible(*mCamera, mResults, TRUE);
+ }
+ else
+ {
+ mResults->push_back(drawable);
+ }
+ }
+ }
+ }
+
+ std::vector<LLDrawable*>* mResults;
};
void drawBox(const LLVector3& c, const LLVector3& r)
{
- LLVertexBuffer::unbind();
-
- gGL.begin(LLRender::TRIANGLE_STRIP);
- //left front
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV);
- //right front
- gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,-1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,1))).mV);
- //right back
- gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,-1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,1))).mV);
- //left back
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,-1,-1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,-1,1))).mV);
- //left front
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV);
- gGL.end();
-
- //bottom
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,-1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,-1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,-1,-1))).mV);
- gGL.end();
-
- //top
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,1))).mV);
- gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,-1,1))).mV);
- gGL.end();
+ LLVertexBuffer::unbind();
+
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ //left front
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV);
+ //right front
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,-1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,1))).mV);
+ //right back
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,-1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,1))).mV);
+ //left back
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,-1,-1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,-1,1))).mV);
+ //left front
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV);
+ gGL.end();
+
+ //bottom
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,-1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,-1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,-1,-1))).mV);
+ gGL.end();
+
+ //top
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(1,1,1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(1,-1,1))).mV);
+ gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,-1,1))).mV);
+ gGL.end();
}
void drawBox(const LLVector4a& c, const LLVector4a& r)
{
- drawBox(reinterpret_cast<const LLVector3&>(c), reinterpret_cast<const LLVector3&>(r));
+ drawBox(reinterpret_cast<const LLVector3&>(c), reinterpret_cast<const LLVector3&>(r));
}
void drawBoxOutline(const LLVector3& pos, const LLVector3& size)
@@ -1324,53 +1324,53 @@ void drawBoxOutline(const LLVector3& pos, const LLVector3& size)
if (!pos.isFinite() || !size.isFinite())
return;
- LLVector3 v1 = size.scaledVec(LLVector3( 1, 1,1));
- LLVector3 v2 = size.scaledVec(LLVector3(-1, 1,1));
- LLVector3 v3 = size.scaledVec(LLVector3(-1,-1,1));
- LLVector3 v4 = size.scaledVec(LLVector3( 1,-1,1));
-
- gGL.begin(LLRender::LINES);
-
- //top
- gGL.vertex3fv((pos+v1).mV);
- gGL.vertex3fv((pos+v2).mV);
- gGL.vertex3fv((pos+v2).mV);
- gGL.vertex3fv((pos+v3).mV);
- gGL.vertex3fv((pos+v3).mV);
- gGL.vertex3fv((pos+v4).mV);
- gGL.vertex3fv((pos+v4).mV);
- gGL.vertex3fv((pos+v1).mV);
-
- //bottom
- gGL.vertex3fv((pos-v1).mV);
- gGL.vertex3fv((pos-v2).mV);
- gGL.vertex3fv((pos-v2).mV);
- gGL.vertex3fv((pos-v3).mV);
- gGL.vertex3fv((pos-v3).mV);
- gGL.vertex3fv((pos-v4).mV);
- gGL.vertex3fv((pos-v4).mV);
- gGL.vertex3fv((pos-v1).mV);
-
- //right
- gGL.vertex3fv((pos+v1).mV);
- gGL.vertex3fv((pos-v3).mV);
-
- gGL.vertex3fv((pos+v4).mV);
- gGL.vertex3fv((pos-v2).mV);
-
- //left
- gGL.vertex3fv((pos+v2).mV);
- gGL.vertex3fv((pos-v4).mV);
-
- gGL.vertex3fv((pos+v3).mV);
- gGL.vertex3fv((pos-v1).mV);
-
- gGL.end();
+ LLVector3 v1 = size.scaledVec(LLVector3( 1, 1,1));
+ LLVector3 v2 = size.scaledVec(LLVector3(-1, 1,1));
+ LLVector3 v3 = size.scaledVec(LLVector3(-1,-1,1));
+ LLVector3 v4 = size.scaledVec(LLVector3( 1,-1,1));
+
+ gGL.begin(LLRender::LINES);
+
+ //top
+ gGL.vertex3fv((pos+v1).mV);
+ gGL.vertex3fv((pos+v2).mV);
+ gGL.vertex3fv((pos+v2).mV);
+ gGL.vertex3fv((pos+v3).mV);
+ gGL.vertex3fv((pos+v3).mV);
+ gGL.vertex3fv((pos+v4).mV);
+ gGL.vertex3fv((pos+v4).mV);
+ gGL.vertex3fv((pos+v1).mV);
+
+ //bottom
+ gGL.vertex3fv((pos-v1).mV);
+ gGL.vertex3fv((pos-v2).mV);
+ gGL.vertex3fv((pos-v2).mV);
+ gGL.vertex3fv((pos-v3).mV);
+ gGL.vertex3fv((pos-v3).mV);
+ gGL.vertex3fv((pos-v4).mV);
+ gGL.vertex3fv((pos-v4).mV);
+ gGL.vertex3fv((pos-v1).mV);
+
+ //right
+ gGL.vertex3fv((pos+v1).mV);
+ gGL.vertex3fv((pos-v3).mV);
+
+ gGL.vertex3fv((pos+v4).mV);
+ gGL.vertex3fv((pos-v2).mV);
+
+ //left
+ gGL.vertex3fv((pos+v2).mV);
+ gGL.vertex3fv((pos-v4).mV);
+
+ gGL.vertex3fv((pos+v3).mV);
+ gGL.vertex3fv((pos-v1).mV);
+
+ gGL.end();
}
void drawBoxOutline(const LLVector4a& pos, const LLVector4a& size)
{
- drawBoxOutline(reinterpret_cast<const LLVector3&>(pos), reinterpret_cast<const LLVector3&>(size));
+ drawBoxOutline(reinterpret_cast<const LLVector3&>(pos), reinterpret_cast<const LLVector3&>(size));
}
@@ -1381,49 +1381,49 @@ void LLSpatialPartition::restoreGL()
BOOL LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
- LLVector4a visMina, visMaxa;
- visMina.load3(visMin.mV);
- visMaxa.load3(visMax.mV);
+ LLVector4a visMina, visMaxa;
+ visMina.load3(visMin.mV);
+ visMaxa.load3(visMax.mV);
- {
- LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0);
- group->rebound();
- }
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0);
+ group->rebound();
+ }
- LLOctreeCullVisExtents vis(&camera, visMina, visMaxa);
- vis.traverse(mOctree);
+ LLOctreeCullVisExtents vis(&camera, visMina, visMaxa);
+ vis.traverse(mOctree);
- visMin.set(visMina.getF32ptr());
- visMax.set(visMaxa.getF32ptr());
- return vis.mEmpty;
+ visMin.set(visMina.getF32ptr());
+ visMax.set(visMaxa.getF32ptr());
+ return vis.mEmpty;
}
BOOL LLSpatialPartition::visibleObjectsInFrustum(LLCamera& camera)
{
- LLOctreeCullDetectVisible vis(&camera);
- vis.traverse(mOctree);
- return vis.mResult;
+ LLOctreeCullDetectVisible vis(&camera);
+ vis.traverse(mOctree);
+ return vis.mResult;
}
S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* results, BOOL for_select)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
#if LL_OCTREE_PARANOIA_CHECK
- ((LLSpatialGroup*)mOctree->getListener(0))->checkStates();
+ ((LLSpatialGroup*)mOctree->getListener(0))->checkStates();
#endif
- {
- LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0);
- group->rebound();
- }
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0);
+ group->rebound();
+ }
#if LL_OCTREE_PARANOIA_CHECK
- ((LLSpatialGroup*)mOctree->getListener(0))->validate();
+ ((LLSpatialGroup*)mOctree->getListener(0))->validate();
#endif
- LLOctreeSelect selecter(&camera, results);
- selecter.traverse(mOctree);
-
- return 0;
+ LLOctreeSelect selecter(&camera, results);
+ selecter.traverse(mOctree);
+
+ return 0;
}
extern BOOL gCubeSnapshot;
@@ -1432,13 +1432,13 @@ S32 LLSpatialPartition::cull(LLCamera &camera, bool do_occlusion)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
#if LL_OCTREE_PARANOIA_CHECK
- ((LLSpatialGroup*)mOctree->getListener(0))->checkStates();
+ ((LLSpatialGroup*)mOctree->getListener(0))->checkStates();
#endif
- LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0);
- group->rebound();
+ LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0);
+ group->rebound();
#if LL_OCTREE_PARANOIA_CHECK
- ((LLSpatialGroup*)mOctree->getListener(0))->validate();
+ ((LLSpatialGroup*)mOctree->getListener(0))->validate();
#endif
if (LLPipeline::sShadowRender)
@@ -1456,132 +1456,132 @@ S32 LLSpatialPartition::cull(LLCamera &camera, bool do_occlusion)
LLOctreeCull culler(&camera);
culler.traverse(mOctree);
}
-
- return 0;
+
+ return 0;
}
void pushVerts(LLDrawInfo* params)
{
- LLRenderPass::applyModelMatrix(*params);
- params->mVertexBuffer->setBuffer();
- params->mVertexBuffer->drawRange(LLRender::TRIANGLES,
- params->mStart, params->mEnd, params->mCount, params->mOffset);
+ LLRenderPass::applyModelMatrix(*params);
+ params->mVertexBuffer->setBuffer();
+ params->mVertexBuffer->drawRange(LLRender::TRIANGLES,
+ params->mStart, params->mEnd, params->mCount, params->mOffset);
}
void pushVerts(LLSpatialGroup* group)
{
- LLDrawInfo* params = NULL;
+ LLDrawInfo* params = NULL;
- for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
- {
- for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
- {
- params = *j;
- pushVerts(params);
- }
- }
+ for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
+ {
+ for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
+ {
+ params = *j;
+ pushVerts(params);
+ }
+ }
}
void pushVerts(LLFace* face)
{
- if (face)
- {
- llassert(face->verify());
+ if (face)
+ {
+ llassert(face->verify());
face->renderIndexed();
- }
+ }
}
void pushVerts(LLDrawable* drawable)
{
- for (S32 i = 0; i < drawable->getNumFaces(); ++i)
- {
- pushVerts(drawable->getFace(i));
- }
+ for (S32 i = 0; i < drawable->getNumFaces(); ++i)
+ {
+ pushVerts(drawable->getFace(i));
+ }
}
void pushVerts(LLVolume* volume)
{
- LLVertexBuffer::unbind();
- for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
- {
- const LLVolumeFace& face = volume->getVolumeFace(i);
- LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices);
- }
+ LLVertexBuffer::unbind();
+ for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
+ {
+ const LLVolumeFace& face = volume->getVolumeFace(i);
+ LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices);
+ }
}
void pushBufferVerts(LLVertexBuffer* buffer)
{
- if (buffer)
- {
- buffer->setBuffer();
- buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
- }
+ if (buffer)
+ {
+ buffer->setBuffer();
+ buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
+ }
}
void pushBufferVerts(LLSpatialGroup* group, bool push_alpha = true)
{
- if (group->getSpatialPartition()->mRenderByGroup)
- {
- if (!group->mDrawMap.empty())
- {
- LLDrawInfo* params = *(group->mDrawMap.begin()->second.begin());
- LLRenderPass::applyModelMatrix(*params);
-
- if (push_alpha)
- {
- pushBufferVerts(group->mVertexBuffer);
- }
-
- for (LLSpatialGroup::buffer_map_t::iterator i = group->mBufferMap.begin(); i != group->mBufferMap.end(); ++i)
- {
- for (LLSpatialGroup::buffer_texture_map_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
- {
- for (LLSpatialGroup::buffer_list_t::iterator k = j->second.begin(); k != j->second.end(); ++k)
- {
- pushBufferVerts(*k);
- }
- }
- }
- }
- }
- /*else
- {
- //const LLVector4a* bounds = group->getBounds();
- //drawBox(bounds[0], bounds[1]);
- }*/
+ if (group->getSpatialPartition()->mRenderByGroup)
+ {
+ if (!group->mDrawMap.empty())
+ {
+ LLDrawInfo* params = *(group->mDrawMap.begin()->second.begin());
+ LLRenderPass::applyModelMatrix(*params);
+
+ if (push_alpha)
+ {
+ pushBufferVerts(group->mVertexBuffer);
+ }
+
+ for (LLSpatialGroup::buffer_map_t::iterator i = group->mBufferMap.begin(); i != group->mBufferMap.end(); ++i)
+ {
+ for (LLSpatialGroup::buffer_texture_map_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
+ {
+ for (LLSpatialGroup::buffer_list_t::iterator k = j->second.begin(); k != j->second.end(); ++k)
+ {
+ pushBufferVerts(*k);
+ }
+ }
+ }
+ }
+ }
+ /*else
+ {
+ //const LLVector4a* bounds = group->getBounds();
+ //drawBox(bounds[0], bounds[1]);
+ }*/
}
void pushVertsColorCoded(LLSpatialGroup* group)
{
- LLDrawInfo* params = NULL;
-
- static const LLColor4 colors[] = {
- LLColor4::green,
- LLColor4::green1,
- LLColor4::green2,
- LLColor4::green3,
- LLColor4::green4,
- LLColor4::green5,
- LLColor4::green6
- };
-
- static const U32 col_count = LL_ARRAY_SIZE(colors);
-
- U32 col = 0;
-
- for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
- {
- for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
- {
- params = *j;
- LLRenderPass::applyModelMatrix(*params);
- gGL.diffuseColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
- params->mVertexBuffer->setBuffer();
- params->mVertexBuffer->drawRange(LLRender::TRIANGLES,
- params->mStart, params->mEnd, params->mCount, params->mOffset);
- col = (col+1)%col_count;
- }
- }
+ LLDrawInfo* params = NULL;
+
+ static const LLColor4 colors[] = {
+ LLColor4::green,
+ LLColor4::green1,
+ LLColor4::green2,
+ LLColor4::green3,
+ LLColor4::green4,
+ LLColor4::green5,
+ LLColor4::green6
+ };
+
+ static const U32 col_count = LL_ARRAY_SIZE(colors);
+
+ U32 col = 0;
+
+ for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
+ {
+ for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
+ {
+ params = *j;
+ LLRenderPass::applyModelMatrix(*params);
+ gGL.diffuseColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
+ params->mVertexBuffer->setBuffer();
+ params->mVertexBuffer->drawRange(LLRender::TRIANGLES,
+ params->mStart, params->mEnd, params->mCount, params->mOffset);
+ col = (col+1)%col_count;
+ }
+ }
}
// return false if drawable is rigged and:
@@ -1629,7 +1629,7 @@ bool check_rigged_group(LLDrawable* drawable)
last_draw_index = face->getDrawOrderIndex();
}
}
-
+
if (child->mDrawable->getSpatialGroup() != group)
{
llassert(false);
@@ -1643,49 +1643,49 @@ bool check_rigged_group(LLDrawable* drawable)
void renderOctree(LLSpatialGroup* group)
{
- //render solid object bounding box, color
- //coded by buffer usage and activity
- gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
- LLVector4 col;
- if (group->mBuilt > 0.f)
- {
- group->mBuilt -= 2.f * gFrameIntervalSeconds.value();
- col.setVec(0.1f,0.1f,1,0.1f);
-
- {
- LLGLDepthTest gl_depth(FALSE, FALSE);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- gGL.diffuseColor4f(1,0,0,group->mBuilt);
- gGL.flush();
- glLineWidth(5.f);
-
- const LLVector4a* bounds = group->getObjectBounds();
- drawBoxOutline(bounds[0], bounds[1]);
- gGL.flush();
- glLineWidth(1.f);
- gGL.flush();
+ //render solid object bounding box, color
+ //coded by buffer usage and activity
+ gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
+ LLVector4 col;
+ if (group->mBuilt > 0.f)
+ {
+ group->mBuilt -= 2.f * gFrameIntervalSeconds.value();
+ col.setVec(0.1f,0.1f,1,0.1f);
+
+ {
+ LLGLDepthTest gl_depth(FALSE, FALSE);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
+ gGL.diffuseColor4f(1,0,0,group->mBuilt);
+ gGL.flush();
+ glLineWidth(5.f);
+
+ const LLVector4a* bounds = group->getObjectBounds();
+ drawBoxOutline(bounds[0], bounds[1]);
+ gGL.flush();
+ glLineWidth(1.f);
+ gGL.flush();
LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
- for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
- {
- LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
- if(!drawable || drawable->getNumFaces() == 0)
- {
- continue;
- }
+ for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+ {
+ LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
+ if(!drawable || drawable->getNumFaces() == 0)
+ {
+ continue;
+ }
llassert(check_rigged_group(drawable));
- if (!group->getSpatialPartition()->isBridge())
- {
- gGL.pushMatrix();
- LLVector3 trans = drawable->getRegion()->getOriginAgent();
- gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
- }
-
+ if (!group->getSpatialPartition()->isBridge())
+ {
+ gGL.pushMatrix();
+ LLVector3 trans = drawable->getRegion()->getOriginAgent();
+ gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+ }
+
LLFace* face = drawable->getFace(0);
bool rigged = face->isState(LLFace::RIGGED);
gDebugProgram.bind(rigged);
@@ -1707,11 +1707,11 @@ void renderOctree(LLSpatialGroup* group)
lastMeshId = face->mSkinInfo->mHash;
}
}
- for (S32 j = 0; j < drawable->getNumFaces(); j++)
- {
- LLFace* face = drawable->getFace(j);
- if (face && face->getVertexBuffer())
- {
+ for (S32 j = 0; j < drawable->getNumFaces(); j++)
+ {
+ LLFace* face = drawable->getFace(j);
+ if (face && face->getVertexBuffer())
+ {
LLVOVolume* vol = drawable->getVOVolume();
if (gFrameTimeSeconds - face->mLastUpdateTime < 0.5f)
@@ -1741,40 +1741,40 @@ void renderOctree(LLSpatialGroup* group)
continue;
}
- face->getVertexBuffer()->setBuffer();
- face->getVertexBuffer()->draw(LLRender::TRIANGLES, face->getIndicesCount(), face->getIndicesStart());
- }
- }
+ face->getVertexBuffer()->setBuffer();
+ face->getVertexBuffer()->draw(LLRender::TRIANGLES, face->getIndicesCount(), face->getIndicesStart());
+ }
+ }
if (rigged)
{
gGL.popMatrix();
}
- if (!group->getSpatialPartition()->isBridge())
- {
- gGL.popMatrix();
- }
- }
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ if (!group->getSpatialPartition()->isBridge())
+ {
+ gGL.popMatrix();
+ }
+ }
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
gDebugProgram.bind(); // make sure non-rigged variant is bound
- gGL.diffuseColor4f(1,1,1,1);
- }
- }
+ gGL.diffuseColor4f(1,1,1,1);
+ }
+ }
- gGL.diffuseColor4fv(col.mV);
- LLVector4a fudge;
- fudge.splat(0.001f);
+ gGL.diffuseColor4fv(col.mV);
+ LLVector4a fudge;
+ fudge.splat(0.001f);
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
- {
- //draw opaque outline
- gGL.diffuseColor4f(0,1,1,1);
+ {
+ //draw opaque outline
+ gGL.diffuseColor4f(0,1,1,1);
- const LLVector4a* bounds = group->getBounds();
- drawBoxOutline(bounds[0], bounds[1]);
- }
+ const LLVector4a* bounds = group->getBounds();
+ drawBoxOutline(bounds[0], bounds[1]);
+ }
}
std::set<LLSpatialGroup*> visible_selected_groups;
@@ -1783,212 +1783,212 @@ std::set<LLSpatialGroup*> visible_selected_groups;
void renderXRay(LLSpatialGroup* group, LLCamera* camera)
{
- BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() &&
- !group->isEmpty();
-
- if (render_objects)
- {
- pushBufferVerts(group, false);
-
- bool selected = false;
-
- for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
- {
- LLDrawable* drawable = (LLDrawable*)(*iter)->getDrawable();
- if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
- {
- selected = true;
- break;
- }
- }
-
- if (selected)
- { //store for rendering occlusion volume as overlay
-
- if (!group->getSpatialPartition()->isBridge())
- {
- visible_selected_groups.insert(group);
- }
- else
- {
- visible_selected_groups.insert(group->getSpatialPartition()->asBridge()->getSpatialGroup());
- }
- }
- }
+ BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() &&
+ !group->isEmpty();
+
+ if (render_objects)
+ {
+ pushBufferVerts(group, false);
+
+ bool selected = false;
+
+ for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
+ {
+ LLDrawable* drawable = (LLDrawable*)(*iter)->getDrawable();
+ if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
+ {
+ selected = true;
+ break;
+ }
+ }
+
+ if (selected)
+ { //store for rendering occlusion volume as overlay
+
+ if (!group->getSpatialPartition()->isBridge())
+ {
+ visible_selected_groups.insert(group);
+ }
+ else
+ {
+ visible_selected_groups.insert(group->getSpatialPartition()->asBridge()->getSpatialGroup());
+ }
+ }
+ }
}
void renderCrossHairs(LLVector3 position, F32 size, LLColor4 color)
{
- gGL.color4fv(color.mV);
- gGL.begin(LLRender::LINES);
- {
- gGL.vertex3fv((position - LLVector3(size, 0.f, 0.f)).mV);
- gGL.vertex3fv((position + LLVector3(size, 0.f, 0.f)).mV);
- gGL.vertex3fv((position - LLVector3(0.f, size, 0.f)).mV);
- gGL.vertex3fv((position + LLVector3(0.f, size, 0.f)).mV);
- gGL.vertex3fv((position - LLVector3(0.f, 0.f, size)).mV);
- gGL.vertex3fv((position + LLVector3(0.f, 0.f, size)).mV);
- }
- gGL.end();
+ gGL.color4fv(color.mV);
+ gGL.begin(LLRender::LINES);
+ {
+ gGL.vertex3fv((position - LLVector3(size, 0.f, 0.f)).mV);
+ gGL.vertex3fv((position + LLVector3(size, 0.f, 0.f)).mV);
+ gGL.vertex3fv((position - LLVector3(0.f, size, 0.f)).mV);
+ gGL.vertex3fv((position + LLVector3(0.f, size, 0.f)).mV);
+ gGL.vertex3fv((position - LLVector3(0.f, 0.f, size)).mV);
+ gGL.vertex3fv((position + LLVector3(0.f, 0.f, size)).mV);
+ }
+ gGL.end();
}
void renderUpdateType(LLDrawable* drawablep)
{
- LLViewerObject* vobj = drawablep->getVObj();
- if (!vobj || OUT_UNKNOWN == vobj->getLastUpdateType())
- {
- return;
- }
- LLGLEnable blend(GL_BLEND);
- switch (vobj->getLastUpdateType())
- {
- case OUT_FULL:
- gGL.diffuseColor4f(0,1,0,0.5f);
- break;
- case OUT_TERSE_IMPROVED:
- gGL.diffuseColor4f(0,1,1,0.5f);
- break;
- case OUT_FULL_COMPRESSED:
- if (vobj->getLastUpdateCached())
- {
- gGL.diffuseColor4f(1,0,0,0.5f);
- }
- else
- {
- gGL.diffuseColor4f(1,1,0,0.5f);
- }
- break;
- case OUT_FULL_CACHED:
- gGL.diffuseColor4f(0,0,1,0.5f);
- break;
- default:
- LL_WARNS() << "Unknown update_type " << vobj->getLastUpdateType() << LL_ENDL;
- break;
- };
- S32 num_faces = drawablep->getNumFaces();
- if (num_faces)
- {
- for (S32 i = 0; i < num_faces; ++i)
- {
- pushVerts(drawablep->getFace(i));
- }
- }
+ LLViewerObject* vobj = drawablep->getVObj();
+ if (!vobj || OUT_UNKNOWN == vobj->getLastUpdateType())
+ {
+ return;
+ }
+ LLGLEnable blend(GL_BLEND);
+ switch (vobj->getLastUpdateType())
+ {
+ case OUT_FULL:
+ gGL.diffuseColor4f(0,1,0,0.5f);
+ break;
+ case OUT_TERSE_IMPROVED:
+ gGL.diffuseColor4f(0,1,1,0.5f);
+ break;
+ case OUT_FULL_COMPRESSED:
+ if (vobj->getLastUpdateCached())
+ {
+ gGL.diffuseColor4f(1,0,0,0.5f);
+ }
+ else
+ {
+ gGL.diffuseColor4f(1,1,0,0.5f);
+ }
+ break;
+ case OUT_FULL_CACHED:
+ gGL.diffuseColor4f(0,0,1,0.5f);
+ break;
+ default:
+ LL_WARNS() << "Unknown update_type " << vobj->getLastUpdateType() << LL_ENDL;
+ break;
+ };
+ S32 num_faces = drawablep->getNumFaces();
+ if (num_faces)
+ {
+ for (S32 i = 0; i < num_faces; ++i)
+ {
+ pushVerts(drawablep->getFace(i));
+ }
+ }
}
void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
{
- if (set_color)
- {
- if (drawable->isSpatialBridge())
- {
- gGL.diffuseColor4f(1,0.5f,0,1); // orange
- }
- else if (drawable->getVOVolume())
- {
+ if (set_color)
+ {
+ if (drawable->isSpatialBridge())
+ {
+ gGL.diffuseColor4f(1,0.5f,0,1); // orange
+ }
+ else if (drawable->getVOVolume())
+ {
if (drawable->isRoot())
- {
- gGL.diffuseColor4f(1,1,0,1); // yellow
- }
- else
- {
- gGL.diffuseColor4f(0,1,0,1); // green
- }
- }
- else if (drawable->getVObj())
- {
- switch (drawable->getVObj()->getPCode())
- {
- case LLViewerObject::LL_VO_SURFACE_PATCH:
- gGL.diffuseColor4f(0,1,1,1); // cyan
- break;
- case LLViewerObject::LL_VO_CLOUDS:
- // no longer used
- break;
- case LLViewerObject::LL_VO_PART_GROUP:
- case LLViewerObject::LL_VO_HUD_PART_GROUP:
- gGL.diffuseColor4f(0,0,1,1); // blue
- break;
- case LLViewerObject::LL_VO_VOID_WATER:
- case LLViewerObject::LL_VO_WATER:
- gGL.diffuseColor4f(0,0.5f,1,1); // medium blue
- break;
- case LL_PCODE_LEGACY_TREE:
- gGL.diffuseColor4f(0,0.5f,0,1); // dark green
- break;
- default:
- LLControlAvatar *cav = dynamic_cast<LLControlAvatar*>(drawable->getVObj()->asAvatar());
- if (cav)
- {
- bool has_pos_constraint = (cav->mPositionConstraintFixup != LLVector3());
- bool has_scale_constraint = (cav->mScaleConstraintFixup != 1.0f);
- if (has_pos_constraint || has_scale_constraint)
- {
- gGL.diffuseColor4f(1,0,0,1);
- }
- else
- {
- gGL.diffuseColor4f(0,1,0.5,1);
- }
- }
- else
- {
- gGL.diffuseColor4f(1,0,1,1); // magenta
- }
- break;
- }
- }
- else
- {
- gGL.diffuseColor4f(1,0,0,1);
- }
- }
-
- const LLVector4a* ext;
- LLVector4a pos, size;
-
- if (drawable->getVOVolume())
- {
- //render face bounding boxes
- for (S32 i = 0; i < drawable->getNumFaces(); i++)
- {
- LLFace* facep = drawable->getFace(i);
- if (facep)
- {
- ext = facep->mExtents;
-
- pos.setAdd(ext[0], ext[1]);
- pos.mul(0.5f);
- size.setSub(ext[1], ext[0]);
- size.mul(0.5f);
-
- drawBoxOutline(pos,size);
- }
- }
- }
-
- //render drawable bounding box
- ext = drawable->getSpatialExtents();
-
- pos.setAdd(ext[0], ext[1]);
- pos.mul(0.5f);
- size.setSub(ext[1], ext[0]);
- size.mul(0.5f);
-
- LLViewerObject* vobj = drawable->getVObj();
- if (vobj && vobj->onActiveList())
- {
- gGL.flush();
- glLineWidth(llmax(4.f*sinf(gFrameTimeSeconds*2.f)+1.f, 1.f));
- //glLineWidth(4.f*(sinf(gFrameTimeSeconds*2.f)*0.25f+0.75f));
- stop_glerror();
- drawBoxOutline(pos,size);
- gGL.flush();
- glLineWidth(1.f);
- }
- else
- {
- drawBoxOutline(pos,size);
- }
+ {
+ gGL.diffuseColor4f(1,1,0,1); // yellow
+ }
+ else
+ {
+ gGL.diffuseColor4f(0,1,0,1); // green
+ }
+ }
+ else if (drawable->getVObj())
+ {
+ switch (drawable->getVObj()->getPCode())
+ {
+ case LLViewerObject::LL_VO_SURFACE_PATCH:
+ gGL.diffuseColor4f(0,1,1,1); // cyan
+ break;
+ case LLViewerObject::LL_VO_CLOUDS:
+ // no longer used
+ break;
+ case LLViewerObject::LL_VO_PART_GROUP:
+ case LLViewerObject::LL_VO_HUD_PART_GROUP:
+ gGL.diffuseColor4f(0,0,1,1); // blue
+ break;
+ case LLViewerObject::LL_VO_VOID_WATER:
+ case LLViewerObject::LL_VO_WATER:
+ gGL.diffuseColor4f(0,0.5f,1,1); // medium blue
+ break;
+ case LL_PCODE_LEGACY_TREE:
+ gGL.diffuseColor4f(0,0.5f,0,1); // dark green
+ break;
+ default:
+ LLControlAvatar *cav = dynamic_cast<LLControlAvatar*>(drawable->getVObj()->asAvatar());
+ if (cav)
+ {
+ bool has_pos_constraint = (cav->mPositionConstraintFixup != LLVector3());
+ bool has_scale_constraint = (cav->mScaleConstraintFixup != 1.0f);
+ if (has_pos_constraint || has_scale_constraint)
+ {
+ gGL.diffuseColor4f(1,0,0,1);
+ }
+ else
+ {
+ gGL.diffuseColor4f(0,1,0.5,1);
+ }
+ }
+ else
+ {
+ gGL.diffuseColor4f(1,0,1,1); // magenta
+ }
+ break;
+ }
+ }
+ else
+ {
+ gGL.diffuseColor4f(1,0,0,1);
+ }
+ }
+
+ const LLVector4a* ext;
+ LLVector4a pos, size;
+
+ if (drawable->getVOVolume())
+ {
+ //render face bounding boxes
+ for (S32 i = 0; i < drawable->getNumFaces(); i++)
+ {
+ LLFace* facep = drawable->getFace(i);
+ if (facep)
+ {
+ ext = facep->mExtents;
+
+ pos.setAdd(ext[0], ext[1]);
+ pos.mul(0.5f);
+ size.setSub(ext[1], ext[0]);
+ size.mul(0.5f);
+
+ drawBoxOutline(pos,size);
+ }
+ }
+ }
+
+ //render drawable bounding box
+ ext = drawable->getSpatialExtents();
+
+ pos.setAdd(ext[0], ext[1]);
+ pos.mul(0.5f);
+ size.setSub(ext[1], ext[0]);
+ size.mul(0.5f);
+
+ LLViewerObject* vobj = drawable->getVObj();
+ if (vobj && vobj->onActiveList())
+ {
+ gGL.flush();
+ glLineWidth(llmax(4.f*sinf(gFrameTimeSeconds*2.f)+1.f, 1.f));
+ //glLineWidth(4.f*(sinf(gFrameTimeSeconds*2.f)*0.25f+0.75f));
+ stop_glerror();
+ drawBoxOutline(pos,size);
+ gGL.flush();
+ glLineWidth(1.f);
+ }
+ else
+ {
+ drawBoxOutline(pos,size);
+ }
}
void renderNormals(LLDrawable *drawablep)
@@ -2080,278 +2080,278 @@ void renderNormals(LLDrawable *drawablep)
S32 get_physics_detail(const LLVolumeParams& volume_params, const LLVector3& scale)
{
- const S32 DEFAULT_DETAIL = 1;
- const F32 LARGE_THRESHOLD = 5.f;
- const F32 MEGA_THRESHOLD = 25.f;
+ const S32 DEFAULT_DETAIL = 1;
+ const F32 LARGE_THRESHOLD = 5.f;
+ const F32 MEGA_THRESHOLD = 25.f;
- S32 detail = DEFAULT_DETAIL;
- F32 avg_scale = (scale[0]+scale[1]+scale[2])/3.f;
+ S32 detail = DEFAULT_DETAIL;
+ F32 avg_scale = (scale[0]+scale[1]+scale[2])/3.f;
- if (avg_scale > LARGE_THRESHOLD)
- {
- detail += 1;
- if (avg_scale > MEGA_THRESHOLD)
- {
- detail += 1;
- }
- }
+ if (avg_scale > LARGE_THRESHOLD)
+ {
+ detail += 1;
+ if (avg_scale > MEGA_THRESHOLD)
+ {
+ detail += 1;
+ }
+ }
- return detail;
+ return detail;
}
void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color)
{
- LLUUID mesh_id = volume->getVolume()->getParams().getSculptID();
- LLModel::Decomposition* decomp = gMeshRepo.getDecomposition(mesh_id);
+ LLUUID mesh_id = volume->getVolume()->getParams().getSculptID();
+ LLModel::Decomposition* decomp = gMeshRepo.getDecomposition(mesh_id);
- const LLVector3 center(0,0,0);
- const LLVector3 size(0.25f,0.25f,0.25f);
+ const LLVector3 center(0,0,0);
+ const LLVector3 size(0.25f,0.25f,0.25f);
- if (decomp)
- {
- if (!decomp->mBaseHullMesh.empty())
- {
+ if (decomp)
+ {
+ if (!decomp->mBaseHullMesh.empty())
+ {
gGL.diffuseColor4fv(color.mV);
- LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions);
- }
- else
- {
- gMeshRepo.buildPhysicsMesh(*decomp);
- gGL.diffuseColor4f(0,1,1,1);
- drawBoxOutline(center, size);
- }
-
- }
- else
- {
- gGL.diffuseColor3f(1,0,1);
- drawBoxOutline(center, size);
- }
+ LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions);
+ }
+ else
+ {
+ gMeshRepo.buildPhysicsMesh(*decomp);
+ gGL.diffuseColor4f(0,1,1,1);
+ drawBoxOutline(center, size);
+ }
+
+ }
+ else
+ {
+ gGL.diffuseColor3f(1,0,1);
+ drawBoxOutline(center, size);
+ }
}
void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color)
{
gGL.diffuseColor4fv(color.mV);
- LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions);
+ LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions);
}
void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe)
{
- U8 physics_type = volume->getPhysicsShapeType();
+ U8 physics_type = volume->getPhysicsShapeType();
- if (physics_type == LLViewerObject::PHYSICS_SHAPE_NONE || volume->isFlexible())
- {
- return;
- }
+ if (physics_type == LLViewerObject::PHYSICS_SHAPE_NONE || volume->isFlexible())
+ {
+ return;
+ }
- //not allowed to return at this point without rendering *something*
+ //not allowed to return at this point without rendering *something*
- F32 threshold = gSavedSettings.getF32("ObjectCostHighThreshold");
- F32 cost = volume->getObjectCost();
+ F32 threshold = gSavedSettings.getF32("ObjectCostHighThreshold");
+ F32 cost = volume->getObjectCost();
- LLColor4 low = gSavedSettings.getColor4("ObjectCostLowColor");
- LLColor4 mid = gSavedSettings.getColor4("ObjectCostMidColor");
- LLColor4 high = gSavedSettings.getColor4("ObjectCostHighColor");
+ LLColor4 low = gSavedSettings.getColor4("ObjectCostLowColor");
+ LLColor4 mid = gSavedSettings.getColor4("ObjectCostMidColor");
+ LLColor4 high = gSavedSettings.getColor4("ObjectCostHighColor");
- F32 normalizedCost = 1.f - exp( -(cost / threshold) );
+ F32 normalizedCost = 1.f - exp( -(cost / threshold) );
- LLColor4 color;
- if ( normalizedCost <= 0.5f )
- {
- color = lerp( low, mid, 2.f * normalizedCost );
- }
- else
- {
- color = lerp( mid, high, 2.f * ( normalizedCost - 0.5f ) );
- }
+ LLColor4 color;
+ if ( normalizedCost <= 0.5f )
+ {
+ color = lerp( low, mid, 2.f * normalizedCost );
+ }
+ else
+ {
+ color = lerp( mid, high, 2.f * ( normalizedCost - 0.5f ) );
+ }
if (wireframe)
{
color = color * 0.5f;
}
- U32 data_mask = LLVertexBuffer::MAP_VERTEX;
+ U32 data_mask = LLVertexBuffer::MAP_VERTEX;
- LLVolumeParams volume_params = volume->getVolume()->getParams();
+ LLVolumeParams volume_params = volume->getVolume()->getParams();
- LLPhysicsVolumeParams physics_params(volume_params,
- physics_type == LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL);
+ LLPhysicsVolumeParams physics_params(volume_params,
+ physics_type == LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL);
- LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification physics_spec;
- LLPhysicsShapeBuilderUtil::determinePhysicsShape(physics_params, volume->getScale(), physics_spec);
+ LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification physics_spec;
+ LLPhysicsShapeBuilderUtil::determinePhysicsShape(physics_params, volume->getScale(), physics_spec);
- U32 type = physics_spec.getType();
+ U32 type = physics_spec.getType();
- LLVector3 center(0,0,0);
- LLVector3 size(0.25f,0.25f,0.25f);
+ LLVector3 center(0,0,0);
+ LLVector3 size(0.25f,0.25f,0.25f);
- gGL.pushMatrix();
- gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix);
-
- if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_MESH)
- {
- LLUUID mesh_id = volume->getVolume()->getParams().getSculptID();
- LLModel::Decomposition* decomp = gMeshRepo.getDecomposition(mesh_id);
-
- if (decomp)
- { //render a physics based mesh
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.pushMatrix();
+ gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix);
- if (!decomp->mHull.empty())
- { //decomposition exists, use that
+ if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_MESH)
+ {
+ LLUUID mesh_id = volume->getVolume()->getParams().getSculptID();
+ LLModel::Decomposition* decomp = gMeshRepo.getDecomposition(mesh_id);
- if (decomp->mMesh.empty())
- {
- gMeshRepo.buildPhysicsMesh(*decomp);
- }
+ if (decomp)
+ { //render a physics based mesh
- for (U32 i = 0; i < decomp->mMesh.size(); ++i)
- {
- render_hull(decomp->mMesh[i], color);
- }
- }
- else if (!decomp->mPhysicsShapeMesh.empty())
- {
- //decomp has physics mesh, render that mesh
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ if (!decomp->mHull.empty())
+ { //decomposition exists, use that
+
+ if (decomp->mMesh.empty())
+ {
+ gMeshRepo.buildPhysicsMesh(*decomp);
+ }
+
+ for (U32 i = 0; i < decomp->mMesh.size(); ++i)
+ {
+ render_hull(decomp->mMesh[i], color);
+ }
+ }
+ else if (!decomp->mPhysicsShapeMesh.empty())
+ {
+ //decomp has physics mesh, render that mesh
gGL.diffuseColor4fv(color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions);
- }
- else
- { //no mesh or decomposition, render base hull
- renderMeshBaseHull(volume, data_mask, color);
-
- if (decomp->mPhysicsShapeMesh.empty())
- {
- //attempt to fetch physics shape mesh if available
- gMeshRepo.fetchPhysicsShape(mesh_id);
- }
- }
- }
- else
- {
- gGL.diffuseColor3f(1,1,0);
- drawBoxOutline(center, size);
- }
- }
- else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_CONVEX ||
- type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_CONVEX)
- {
- if (volume->isMesh())
- {
- renderMeshBaseHull(volume, data_mask, color);
- }
- else
- {
- LLVolumeParams volume_params = volume->getVolume()->getParams();
- S32 detail = get_physics_detail(volume_params, volume->getScale());
- LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail);
-
- if (!phys_volume->mHullPoints)
- { //build convex hull
- std::vector<LLVector3> pos;
- std::vector<U16> index;
-
- S32 index_offset = 0;
-
- for (S32 i = 0; i < phys_volume->getNumVolumeFaces(); ++i)
- {
- const LLVolumeFace& face = phys_volume->getVolumeFace(i);
- if (index_offset + face.mNumVertices > 65535)
- {
- continue;
- }
-
- for (S32 j = 0; j < face.mNumVertices; ++j)
- {
- pos.push_back(LLVector3(face.mPositions[j].getF32ptr()));
- }
-
- for (S32 j = 0; j < face.mNumIndices; ++j)
- {
- index.push_back(face.mIndices[j]+index_offset);
- }
-
- index_offset += face.mNumVertices;
- }
-
- if (!pos.empty() && !index.empty())
- {
- LLCDMeshData mesh;
- mesh.mIndexBase = &index[0];
- mesh.mVertexBase = pos[0].mV;
- mesh.mNumVertices = pos.size();
- mesh.mVertexStrideBytes = 12;
- mesh.mIndexStrideBytes = 6;
- mesh.mIndexType = LLCDMeshData::INT_16;
-
- mesh.mNumTriangles = index.size()/3;
-
- LLCDMeshData res;
-
- LLConvexDecomposition::getInstance()->generateSingleHullMeshFromMesh( &mesh, &res );
-
- //copy res into phys_volume
- phys_volume->mHullPoints = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*res.mNumVertices);
- phys_volume->mNumHullPoints = res.mNumVertices;
-
- S32 idx_size = (res.mNumTriangles*3*2+0xF) & ~0xF;
- phys_volume->mHullIndices = (U16*) ll_aligned_malloc_16(idx_size);
- phys_volume->mNumHullIndices = res.mNumTriangles*3;
-
- const F32* v = res.mVertexBase;
-
- for (S32 i = 0; i < res.mNumVertices; ++i)
- {
- F32* p = (F32*) ((U8*)v+i*res.mVertexStrideBytes);
- phys_volume->mHullPoints[i].load3(p);
- }
-
- if (res.mIndexType == LLCDMeshData::INT_16)
- {
- for (S32 i = 0; i < res.mNumTriangles; ++i)
- {
- U16* idx = (U16*) (((U8*)res.mIndexBase)+i*res.mIndexStrideBytes);
-
- phys_volume->mHullIndices[i*3+0] = idx[0];
- phys_volume->mHullIndices[i*3+1] = idx[1];
- phys_volume->mHullIndices[i*3+2] = idx[2];
- }
- }
- else
- {
- for (S32 i = 0; i < res.mNumTriangles; ++i)
- {
- U32* idx = (U32*) (((U8*)res.mIndexBase)+i*res.mIndexStrideBytes);
-
- phys_volume->mHullIndices[i*3+0] = (U16) idx[0];
- phys_volume->mHullIndices[i*3+1] = (U16) idx[1];
- phys_volume->mHullIndices[i*3+2] = (U16) idx[2];
- }
- }
- }
- }
-
- if (phys_volume->mHullPoints)
- {
- //render hull
+ }
+ else
+ { //no mesh or decomposition, render base hull
+ renderMeshBaseHull(volume, data_mask, color);
+
+ if (decomp->mPhysicsShapeMesh.empty())
+ {
+ //attempt to fetch physics shape mesh if available
+ gMeshRepo.fetchPhysicsShape(mesh_id);
+ }
+ }
+ }
+ else
+ {
+ gGL.diffuseColor3f(1,1,0);
+ drawBoxOutline(center, size);
+ }
+ }
+ else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_CONVEX ||
+ type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_CONVEX)
+ {
+ if (volume->isMesh())
+ {
+ renderMeshBaseHull(volume, data_mask, color);
+ }
+ else
+ {
+ LLVolumeParams volume_params = volume->getVolume()->getParams();
+ S32 detail = get_physics_detail(volume_params, volume->getScale());
+ LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail);
+
+ if (!phys_volume->mHullPoints)
+ { //build convex hull
+ std::vector<LLVector3> pos;
+ std::vector<U16> index;
+
+ S32 index_offset = 0;
+
+ for (S32 i = 0; i < phys_volume->getNumVolumeFaces(); ++i)
+ {
+ const LLVolumeFace& face = phys_volume->getVolumeFace(i);
+ if (index_offset + face.mNumVertices > 65535)
+ {
+ continue;
+ }
+
+ for (S32 j = 0; j < face.mNumVertices; ++j)
+ {
+ pos.push_back(LLVector3(face.mPositions[j].getF32ptr()));
+ }
+
+ for (S32 j = 0; j < face.mNumIndices; ++j)
+ {
+ index.push_back(face.mIndices[j]+index_offset);
+ }
+
+ index_offset += face.mNumVertices;
+ }
+
+ if (!pos.empty() && !index.empty())
+ {
+ LLCDMeshData mesh;
+ mesh.mIndexBase = &index[0];
+ mesh.mVertexBase = pos[0].mV;
+ mesh.mNumVertices = pos.size();
+ mesh.mVertexStrideBytes = 12;
+ mesh.mIndexStrideBytes = 6;
+ mesh.mIndexType = LLCDMeshData::INT_16;
+
+ mesh.mNumTriangles = index.size()/3;
+
+ LLCDMeshData res;
+
+ LLConvexDecomposition::getInstance()->generateSingleHullMeshFromMesh( &mesh, &res );
+
+ //copy res into phys_volume
+ phys_volume->mHullPoints = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*res.mNumVertices);
+ phys_volume->mNumHullPoints = res.mNumVertices;
+
+ S32 idx_size = (res.mNumTriangles*3*2+0xF) & ~0xF;
+ phys_volume->mHullIndices = (U16*) ll_aligned_malloc_16(idx_size);
+ phys_volume->mNumHullIndices = res.mNumTriangles*3;
+
+ const F32* v = res.mVertexBase;
+
+ for (S32 i = 0; i < res.mNumVertices; ++i)
+ {
+ F32* p = (F32*) ((U8*)v+i*res.mVertexStrideBytes);
+ phys_volume->mHullPoints[i].load3(p);
+ }
+
+ if (res.mIndexType == LLCDMeshData::INT_16)
+ {
+ for (S32 i = 0; i < res.mNumTriangles; ++i)
+ {
+ U16* idx = (U16*) (((U8*)res.mIndexBase)+i*res.mIndexStrideBytes);
+
+ phys_volume->mHullIndices[i*3+0] = idx[0];
+ phys_volume->mHullIndices[i*3+1] = idx[1];
+ phys_volume->mHullIndices[i*3+2] = idx[2];
+ }
+ }
+ else
+ {
+ for (S32 i = 0; i < res.mNumTriangles; ++i)
+ {
+ U32* idx = (U32*) (((U8*)res.mIndexBase)+i*res.mIndexStrideBytes);
+
+ phys_volume->mHullIndices[i*3+0] = (U16) idx[0];
+ phys_volume->mHullIndices[i*3+1] = (U16) idx[1];
+ phys_volume->mHullIndices[i*3+2] = (U16) idx[2];
+ }
+ }
+ }
+ }
+
+ if (phys_volume->mHullPoints)
+ {
+ //render hull
gGL.diffuseColor4fv(color.mV);
LLVertexBuffer::unbind();
- LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
- }
- else
- {
- gGL.diffuseColor4f(1,0,1,1);
- drawBoxOutline(center, size);
- }
-
- LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
- }
- }
- else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::BOX)
- {
+ LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
+ }
+ else
+ {
+ gGL.diffuseColor4f(1,0,1,1);
+ drawBoxOutline(center, size);
+ }
+
+ LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
+ }
+ }
+ else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::BOX)
+ {
if (!wireframe)
{
LLVector3 center = physics_spec.getCenter();
@@ -2362,9 +2362,9 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe
gGL.diffuseColor4fv(color.mV);
drawBox(center, scale);
}
- }
- else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SPHERE)
- {
+ }
+ else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SPHERE)
+ {
if (!wireframe)
{
LLVolumeParams volume_params;
@@ -2379,9 +2379,9 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe
pushVerts(sphere);
LLPrimitive::sVolumeManager->unrefVolume(sphere);
}
- }
- else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::CYLINDER)
- {
+ }
+ else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::CYLINDER)
+ {
if (!wireframe)
{
LLVolumeParams volume_params;
@@ -2396,244 +2396,244 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe
pushVerts(cylinder);
LLPrimitive::sVolumeManager->unrefVolume(cylinder);
}
- }
- else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_MESH)
- {
- LLVolumeParams volume_params = volume->getVolume()->getParams();
- S32 detail = get_physics_detail(volume_params, volume->getScale());
+ }
+ else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_MESH)
+ {
+ LLVolumeParams volume_params = volume->getVolume()->getParams();
+ S32 detail = get_physics_detail(volume_params, volume->getScale());
- LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail);
+ LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail);
gGL.diffuseColor4fv(color.mV);
- pushVerts(phys_volume);
+ pushVerts(phys_volume);
- LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
- }
- else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_CONVEX)
- {
- LLVolumeParams volume_params = volume->getVolume()->getParams();
- S32 detail = get_physics_detail(volume_params, volume->getScale());
+ LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
+ }
+ else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_CONVEX)
+ {
+ LLVolumeParams volume_params = volume->getVolume()->getParams();
+ S32 detail = get_physics_detail(volume_params, volume->getScale());
- LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail);
+ LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail);
- if (phys_volume->mHullPoints && phys_volume->mHullIndices)
- {
-
- llassert(LLGLSLShader::sCurBoundShader != 0);
- LLVertexBuffer::unbind();
- glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
+ if (phys_volume->mHullPoints && phys_volume->mHullIndices)
+ {
+
+ llassert(LLGLSLShader::sCurBoundShader != 0);
+ LLVertexBuffer::unbind();
+ glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
gGL.diffuseColor4fv(color.mV);
gGL.syncMatrices();
- glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
- }
- else
- {
- gGL.diffuseColor3f(1,0,1);
- drawBoxOutline(center, size);
- gMeshRepo.buildHull(volume_params, detail);
- }
- LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
- }
- else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SCULPT)
- {
- //TODO: implement sculpted prim physics display
- }
- else
- {
- LL_ERRS() << "Unhandled type" << LL_ENDL;
- }
-
- gGL.popMatrix();
+ glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
+ }
+ else
+ {
+ gGL.diffuseColor3f(1,0,1);
+ drawBoxOutline(center, size);
+ gMeshRepo.buildHull(volume_params, detail);
+ }
+ LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
+ }
+ else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SCULPT)
+ {
+ //TODO: implement sculpted prim physics display
+ }
+ else
+ {
+ LL_ERRS() << "Unhandled type" << LL_ENDL;
+ }
+
+ gGL.popMatrix();
}
void renderPhysicsShapes(LLSpatialGroup* group, bool wireframe)
{
- for (OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
- {
- LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
- if(!drawable)
- {
- continue;
- }
-
- if (drawable->isSpatialBridge())
- {
- LLSpatialBridge* bridge = drawable->asPartition()->asBridge();
-
- if (bridge)
- {
- gGL.pushMatrix();
- gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
- bridge->renderPhysicsShapes(wireframe);
- gGL.popMatrix();
- }
- }
- else
- {
- LLVOVolume* volume = drawable->getVOVolume();
- if (volume && !volume->isAttachment() && volume->getPhysicsShapeType() != LLViewerObject::PHYSICS_SHAPE_NONE )
- {
- if (!group->getSpatialPartition()->isBridge())
- {
- gGL.pushMatrix();
- LLVector3 trans = drawable->getRegion()->getOriginAgent();
- gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
- renderPhysicsShape(drawable, volume, wireframe);
- gGL.popMatrix();
- }
- else
- {
- renderPhysicsShape(drawable, volume, wireframe);
- }
- }
- else
- {
-#if 0
- LLViewerObject* object = drawable->getVObj();
- if (object && object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH)
- {
- gGL.pushMatrix();
- gGL.multMatrix((F32*) object->getRegion()->mRenderMatrix.mMatrix);
- //push face vertices for terrain
- for (S32 i = 0; i < drawable->getNumFaces(); ++i)
- {
- LLFace* face = drawable->getFace(i);
- if (face)
- {
- LLVertexBuffer* buff = face->getVertexBuffer();
- if (buff)
- {
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- buff->setBuffer();
- gGL.diffuseColor4f(0.2f, 0.5f, 0.3f, 0.5f);
- buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0);
-
- gGL.diffuseColor4f(0.2f, 1.f, 0.3f, 0.75f);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0);
- }
- }
- }
- gGL.popMatrix();
- }
+ for (OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+ {
+ LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
+ if(!drawable)
+ {
+ continue;
+ }
+
+ if (drawable->isSpatialBridge())
+ {
+ LLSpatialBridge* bridge = drawable->asPartition()->asBridge();
+
+ if (bridge)
+ {
+ gGL.pushMatrix();
+ gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
+ bridge->renderPhysicsShapes(wireframe);
+ gGL.popMatrix();
+ }
+ }
+ else
+ {
+ LLVOVolume* volume = drawable->getVOVolume();
+ if (volume && !volume->isAttachment() && volume->getPhysicsShapeType() != LLViewerObject::PHYSICS_SHAPE_NONE )
+ {
+ if (!group->getSpatialPartition()->isBridge())
+ {
+ gGL.pushMatrix();
+ LLVector3 trans = drawable->getRegion()->getOriginAgent();
+ gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+ renderPhysicsShape(drawable, volume, wireframe);
+ gGL.popMatrix();
+ }
+ else
+ {
+ renderPhysicsShape(drawable, volume, wireframe);
+ }
+ }
+ else
+ {
+#if 0
+ LLViewerObject* object = drawable->getVObj();
+ if (object && object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH)
+ {
+ gGL.pushMatrix();
+ gGL.multMatrix((F32*) object->getRegion()->mRenderMatrix.mMatrix);
+ //push face vertices for terrain
+ for (S32 i = 0; i < drawable->getNumFaces(); ++i)
+ {
+ LLFace* face = drawable->getFace(i);
+ if (face)
+ {
+ LLVertexBuffer* buff = face->getVertexBuffer();
+ if (buff)
+ {
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
+ buff->setBuffer();
+ gGL.diffuseColor4f(0.2f, 0.5f, 0.3f, 0.5f);
+ buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0);
+
+ gGL.diffuseColor4f(0.2f, 1.f, 0.3f, 0.75f);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0);
+ }
+ }
+ }
+ gGL.popMatrix();
+ }
#endif
- }
- }
- }
+ }
+ }
+ }
}
void renderTexturePriority(LLDrawable* drawable)
{
- for (int face=0; face<drawable->getNumFaces(); ++face)
- {
- LLFace *facep = drawable->getFace(face);
-
- LLVector4 cold(0,0,0.25f);
- LLVector4 hot(1,0.25f,0.25f);
-
- LLVector4 boost_cold(0,0,0,0);
- LLVector4 boost_hot(0,1,0,1);
-
- LLGLDisable blend(GL_BLEND);
-
- //LLViewerTexture* imagep = facep->getTexture();
- //if (imagep)
- if (facep)
- {
-
- //F32 vsize = imagep->mMaxVirtualSize;
- F32 vsize = facep->getPixelArea();
-
- if (vsize > sCurMaxTexPriority)
- {
- sCurMaxTexPriority = vsize;
- }
-
- F32 t = vsize/sLastMaxTexPriority;
-
- LLVector4 col = lerp(cold, hot, t);
- gGL.diffuseColor4fv(col.mV);
- }
- //else
- //{
- // gGL.diffuseColor4f(1,0,1,1);
- //}
-
- LLVector4a center;
- center.setAdd(facep->mExtents[1],facep->mExtents[0]);
- center.mul(0.5f);
- LLVector4a size;
- size.setSub(facep->mExtents[1],facep->mExtents[0]);
- size.mul(0.5f);
- size.add(LLVector4a(0.01f));
- drawBox(center, size);
-
- /*S32 boost = imagep->getBoostLevel();
- if (boost>LLGLTexture::BOOST_NONE)
- {
- F32 t = (F32) boost / (F32) (LLGLTexture::BOOST_MAX_LEVEL-1);
- LLVector4 col = lerp(boost_cold, boost_hot, t);
- LLGLEnable blend_on(GL_BLEND);
- gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
- gGL.diffuseColor4fv(col.mV);
- drawBox(center, size);
- gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }*/
- }
+ for (int face=0; face<drawable->getNumFaces(); ++face)
+ {
+ LLFace *facep = drawable->getFace(face);
+
+ LLVector4 cold(0,0,0.25f);
+ LLVector4 hot(1,0.25f,0.25f);
+
+ LLVector4 boost_cold(0,0,0,0);
+ LLVector4 boost_hot(0,1,0,1);
+
+ LLGLDisable blend(GL_BLEND);
+
+ //LLViewerTexture* imagep = facep->getTexture();
+ //if (imagep)
+ if (facep)
+ {
+
+ //F32 vsize = imagep->mMaxVirtualSize;
+ F32 vsize = facep->getPixelArea();
+
+ if (vsize > sCurMaxTexPriority)
+ {
+ sCurMaxTexPriority = vsize;
+ }
+
+ F32 t = vsize/sLastMaxTexPriority;
+
+ LLVector4 col = lerp(cold, hot, t);
+ gGL.diffuseColor4fv(col.mV);
+ }
+ //else
+ //{
+ // gGL.diffuseColor4f(1,0,1,1);
+ //}
+
+ LLVector4a center;
+ center.setAdd(facep->mExtents[1],facep->mExtents[0]);
+ center.mul(0.5f);
+ LLVector4a size;
+ size.setSub(facep->mExtents[1],facep->mExtents[0]);
+ size.mul(0.5f);
+ size.add(LLVector4a(0.01f));
+ drawBox(center, size);
+
+ /*S32 boost = imagep->getBoostLevel();
+ if (boost>LLGLTexture::BOOST_NONE)
+ {
+ F32 t = (F32) boost / (F32) (LLGLTexture::BOOST_MAX_LEVEL-1);
+ LLVector4 col = lerp(boost_cold, boost_hot, t);
+ LLGLEnable blend_on(GL_BLEND);
+ gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
+ gGL.diffuseColor4fv(col.mV);
+ drawBox(center, size);
+ gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }*/
+ }
}
void renderPoints(LLDrawable* drawablep)
{
- LLGLDepthTest depth(GL_FALSE, GL_FALSE);
- if (drawablep->getNumFaces())
- {
- gGL.begin(LLRender::POINTS);
- gGL.diffuseColor3f(1,1,1);
- for (S32 i = 0; i < drawablep->getNumFaces(); i++)
- {
- LLFace * face = drawablep->getFace(i);
- if (face)
- {
- gGL.vertex3fv(face->mCenterLocal.mV);
- }
- }
- gGL.end();
- }
+ LLGLDepthTest depth(GL_FALSE, GL_FALSE);
+ if (drawablep->getNumFaces())
+ {
+ gGL.begin(LLRender::POINTS);
+ gGL.diffuseColor3f(1,1,1);
+ for (S32 i = 0; i < drawablep->getNumFaces(); i++)
+ {
+ LLFace * face = drawablep->getFace(i);
+ if (face)
+ {
+ gGL.vertex3fv(face->mCenterLocal.mV);
+ }
+ }
+ gGL.end();
+ }
}
void renderTextureAnim(LLDrawInfo* params)
{
- if (!params->mTextureMatrix)
- {
- return;
- }
-
- LLGLEnable blend(GL_BLEND);
- gGL.diffuseColor4f(1,1,0,0.5f);
- pushVerts(params);
+ if (!params->mTextureMatrix)
+ {
+ return;
+ }
+
+ LLGLEnable blend(GL_BLEND);
+ gGL.diffuseColor4f(1,1,0,0.5f);
+ pushVerts(params);
}
void renderBatchSize(LLDrawInfo* params)
{
- LLGLEnable offset(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset(-1.f, 1.f);
+ LLGLEnable offset(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(-1.f, 1.f);
LLGLSLShader* old_shader = LLGLSLShader::sCurBoundShaderPtr;
bool bind = false;
if (params->mAvatar)
- {
+ {
gGL.pushMatrix();
gGL.loadMatrix(gGLModelView);
bind = true;
old_shader->mRiggedVariant->bind();
LLRenderPass::uploadMatrixPalette(*params);
}
-
-
+
+
gGL.diffuseColor4ubv(params->getDebugColor().mV);
- pushVerts(params);
+ pushVerts(params);
if (bind)
{
@@ -2644,388 +2644,388 @@ void renderBatchSize(LLDrawInfo* params)
void renderTexelDensity(LLDrawable* drawable)
{
- if (LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_OFF
- || LLViewerTexture::sCheckerBoardImagep.isNull())
- {
- return;
- }
-
- LLGLEnable _(GL_BLEND);
-
- LLMatrix4 checkerboard_matrix;
- S32 discard_level = -1;
-
- for (S32 f = 0; f < drawable->getNumFaces(); f++)
- {
- LLFace* facep = drawable->getFace(f);
- LLVertexBuffer* buffer = facep->getVertexBuffer();
- LLViewerTexture* texturep = facep->getTexture();
-
- if (texturep == NULL) continue;
-
- switch(LLViewerTexture::sDebugTexelsMode)
- {
- case LLViewerTexture::DEBUG_TEXELS_CURRENT:
- discard_level = -1;
- break;
- case LLViewerTexture::DEBUG_TEXELS_DESIRED:
- {
- LLViewerFetchedTexture* fetched_texturep = dynamic_cast<LLViewerFetchedTexture*>(texturep);
- discard_level = fetched_texturep ? fetched_texturep->getDesiredDiscardLevel() : -1;
- break;
- }
- default:
- case LLViewerTexture::DEBUG_TEXELS_FULL:
- discard_level = 0;
- break;
- }
-
- checkerboard_matrix.initScale(LLVector3(texturep->getWidth(discard_level) / 8, texturep->getHeight(discard_level) / 8, 1.f));
-
- gGL.getTexUnit(0)->bind(LLViewerTexture::sCheckerBoardImagep, TRUE);
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadMatrix((GLfloat*)&checkerboard_matrix.mMatrix);
-
- if (buffer && (facep->getGeomCount() >= 3))
- {
- buffer->setBuffer();
- U16 start = facep->getGeomStart();
- U16 end = start + facep->getGeomCount()-1;
- U32 count = facep->getIndicesCount();
- U16 offset = facep->getIndicesStart();
- buffer->drawRange(LLRender::TRIANGLES, start, end, count, offset);
- }
-
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- }
-
- //S32 num_textures = llmax(1, (S32)params->mTextureList.size());
-
- //for (S32 i = 0; i < num_textures; i++)
- //{
- // LLViewerTexture* texturep = params->mTextureList.empty() ? params->mTexture.get() : params->mTextureList[i].get();
- // if (texturep == NULL) continue;
-
- // LLMatrix4 checkboard_matrix;
- // S32 discard_level = -1;
- // switch(LLViewerTexture::sDebugTexelsMode)
- // {
- // case LLViewerTexture::DEBUG_TEXELS_CURRENT:
- // discard_level = -1;
- // break;
- // case LLViewerTexture::DEBUG_TEXELS_DESIRED:
- // {
- // LLViewerFetchedTexture* fetched_texturep = dynamic_cast<LLViewerFetchedTexture*>(texturep);
- // discard_level = fetched_texturep ? fetched_texturep->getDesiredDiscardLevel() : -1;
- // break;
- // }
- // default:
- // case LLViewerTexture::DEBUG_TEXELS_FULL:
- // discard_level = 0;
- // break;
- // }
-
- // checkboard_matrix.initScale(LLVector3(texturep->getWidth(discard_level) / 8, texturep->getHeight(discard_level) / 8, 1.f));
- // gGL.getTexUnit(i)->activate();
-
- // glMatrixMode(GL_TEXTURE);
- // glPushMatrix();
- // glLoadIdentity();
- // //gGL.matrixMode(LLRender::MM_TEXTURE);
- // glLoadMatrixf((GLfloat*) checkboard_matrix.mMatrix);
-
- // gGL.getTexUnit(i)->bind(LLViewerTexture::sCheckerBoardImagep, TRUE);
-
- // pushVerts(params, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_NORMAL );
-
- // glPopMatrix();
- // glMatrixMode(GL_MODELVIEW);
- // //gGL.matrixMode(LLRender::MM_MODELVIEW);
- //}
+ if (LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_OFF
+ || LLViewerTexture::sCheckerBoardImagep.isNull())
+ {
+ return;
+ }
+
+ LLGLEnable _(GL_BLEND);
+
+ LLMatrix4 checkerboard_matrix;
+ S32 discard_level = -1;
+
+ for (S32 f = 0; f < drawable->getNumFaces(); f++)
+ {
+ LLFace* facep = drawable->getFace(f);
+ LLVertexBuffer* buffer = facep->getVertexBuffer();
+ LLViewerTexture* texturep = facep->getTexture();
+
+ if (texturep == NULL) continue;
+
+ switch(LLViewerTexture::sDebugTexelsMode)
+ {
+ case LLViewerTexture::DEBUG_TEXELS_CURRENT:
+ discard_level = -1;
+ break;
+ case LLViewerTexture::DEBUG_TEXELS_DESIRED:
+ {
+ LLViewerFetchedTexture* fetched_texturep = dynamic_cast<LLViewerFetchedTexture*>(texturep);
+ discard_level = fetched_texturep ? fetched_texturep->getDesiredDiscardLevel() : -1;
+ break;
+ }
+ default:
+ case LLViewerTexture::DEBUG_TEXELS_FULL:
+ discard_level = 0;
+ break;
+ }
+
+ checkerboard_matrix.initScale(LLVector3(texturep->getWidth(discard_level) / 8, texturep->getHeight(discard_level) / 8, 1.f));
+
+ gGL.getTexUnit(0)->bind(LLViewerTexture::sCheckerBoardImagep, TRUE);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((GLfloat*)&checkerboard_matrix.mMatrix);
+
+ if (buffer && (facep->getGeomCount() >= 3))
+ {
+ buffer->setBuffer();
+ U16 start = facep->getGeomStart();
+ U16 end = start + facep->getGeomCount()-1;
+ U32 count = facep->getIndicesCount();
+ U16 offset = facep->getIndicesStart();
+ buffer->drawRange(LLRender::TRIANGLES, start, end, count, offset);
+ }
+
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ }
+
+ //S32 num_textures = llmax(1, (S32)params->mTextureList.size());
+
+ //for (S32 i = 0; i < num_textures; i++)
+ //{
+ // LLViewerTexture* texturep = params->mTextureList.empty() ? params->mTexture.get() : params->mTextureList[i].get();
+ // if (texturep == NULL) continue;
+
+ // LLMatrix4 checkboard_matrix;
+ // S32 discard_level = -1;
+ // switch(LLViewerTexture::sDebugTexelsMode)
+ // {
+ // case LLViewerTexture::DEBUG_TEXELS_CURRENT:
+ // discard_level = -1;
+ // break;
+ // case LLViewerTexture::DEBUG_TEXELS_DESIRED:
+ // {
+ // LLViewerFetchedTexture* fetched_texturep = dynamic_cast<LLViewerFetchedTexture*>(texturep);
+ // discard_level = fetched_texturep ? fetched_texturep->getDesiredDiscardLevel() : -1;
+ // break;
+ // }
+ // default:
+ // case LLViewerTexture::DEBUG_TEXELS_FULL:
+ // discard_level = 0;
+ // break;
+ // }
+
+ // checkboard_matrix.initScale(LLVector3(texturep->getWidth(discard_level) / 8, texturep->getHeight(discard_level) / 8, 1.f));
+ // gGL.getTexUnit(i)->activate();
+
+ // glMatrixMode(GL_TEXTURE);
+ // glPushMatrix();
+ // glLoadIdentity();
+ // //gGL.matrixMode(LLRender::MM_TEXTURE);
+ // glLoadMatrixf((GLfloat*) checkboard_matrix.mMatrix);
+
+ // gGL.getTexUnit(i)->bind(LLViewerTexture::sCheckerBoardImagep, TRUE);
+
+ // pushVerts(params, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_NORMAL );
+
+ // glPopMatrix();
+ // glMatrixMode(GL_MODELVIEW);
+ // //gGL.matrixMode(LLRender::MM_MODELVIEW);
+ //}
}
void renderLights(LLDrawable* drawablep)
{
- if (!drawablep->isLight())
- {
- return;
- }
-
- if (drawablep->getNumFaces())
- {
- LLGLEnable blend(GL_BLEND);
- gGL.diffuseColor4f(0,1,1,0.5f);
-
- for (S32 i = 0; i < drawablep->getNumFaces(); i++)
- {
- LLFace * face = drawablep->getFace(i);
- if (face)
- {
- pushVerts(face);
- }
- }
-
- const LLVector4a* ext = drawablep->getSpatialExtents();
-
- LLVector4a pos;
- pos.setAdd(ext[0], ext[1]);
- pos.mul(0.5f);
- LLVector4a size;
- size.setSub(ext[1], ext[0]);
- size.mul(0.5f);
-
- {
- LLGLDepthTest depth(GL_FALSE, GL_TRUE);
- gGL.diffuseColor4f(1,1,1,1);
- drawBoxOutline(pos, size);
- }
-
- gGL.diffuseColor4f(1,1,0,1);
- F32 rad = drawablep->getVOVolume()->getLightRadius();
- drawBoxOutline(pos, LLVector4a(rad));
- }
+ if (!drawablep->isLight())
+ {
+ return;
+ }
+
+ if (drawablep->getNumFaces())
+ {
+ LLGLEnable blend(GL_BLEND);
+ gGL.diffuseColor4f(0,1,1,0.5f);
+
+ for (S32 i = 0; i < drawablep->getNumFaces(); i++)
+ {
+ LLFace * face = drawablep->getFace(i);
+ if (face)
+ {
+ pushVerts(face);
+ }
+ }
+
+ const LLVector4a* ext = drawablep->getSpatialExtents();
+
+ LLVector4a pos;
+ pos.setAdd(ext[0], ext[1]);
+ pos.mul(0.5f);
+ LLVector4a size;
+ size.setSub(ext[1], ext[0]);
+ size.mul(0.5f);
+
+ {
+ LLGLDepthTest depth(GL_FALSE, GL_TRUE);
+ gGL.diffuseColor4f(1,1,1,1);
+ drawBoxOutline(pos, size);
+ }
+
+ gGL.diffuseColor4f(1,1,0,1);
+ F32 rad = drawablep->getVOVolume()->getLightRadius();
+ drawBoxOutline(pos, LLVector4a(rad));
+ }
}
class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect
{
public:
-
-
- LLRenderOctreeRaycast(const LLVector4a& start, const LLVector4a& dir, F32* closest_t)
- : LLOctreeTriangleRayIntersect(start, dir, NULL, closest_t, NULL, NULL, NULL, NULL)
- {
- }
+
+ LLRenderOctreeRaycast(const LLVector4a& start, const LLVector4a& dir, F32* closest_t)
+ : LLOctreeTriangleRayIntersect(start, dir, NULL, closest_t, NULL, NULL, NULL, NULL)
+ {
+
+ }
void visit(const LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* branch)
- {
- LLVolumeOctreeListener* vl = (LLVolumeOctreeListener*) branch->getListener(0);
-
- LLVector3 center, size;
-
- if (branch->isEmpty())
- {
- gGL.diffuseColor3f(1.f,0.2f,0.f);
- center.set(branch->getCenter().getF32ptr());
- size.set(branch->getSize().getF32ptr());
- }
- else
- {
- gGL.diffuseColor3f(0.75f, 1.f, 0.f);
- center.set(vl->mBounds[0].getF32ptr());
- size.set(vl->mBounds[1].getF32ptr());
- }
-
- drawBoxOutline(center, size);
-
- for (U32 i = 0; i < 2; i++)
- {
- LLGLDepthTest depth(GL_TRUE, GL_FALSE, i == 1 ? GL_LEQUAL : GL_GREATER);
-
- if (i == 1)
- {
- gGL.diffuseColor4f(0,1,1,0.5f);
- }
- else
- {
- gGL.diffuseColor4f(0,0.5f,0.5f, 0.25f);
- drawBoxOutline(center, size);
- }
-
- if (i == 1)
- {
- gGL.flush();
- glLineWidth(3.f);
- }
-
- gGL.begin(LLRender::TRIANGLES);
+ {
+ LLVolumeOctreeListener* vl = (LLVolumeOctreeListener*) branch->getListener(0);
+
+ LLVector3 center, size;
+
+ if (branch->isEmpty())
+ {
+ gGL.diffuseColor3f(1.f,0.2f,0.f);
+ center.set(branch->getCenter().getF32ptr());
+ size.set(branch->getSize().getF32ptr());
+ }
+ else
+ {
+ gGL.diffuseColor3f(0.75f, 1.f, 0.f);
+ center.set(vl->mBounds[0].getF32ptr());
+ size.set(vl->mBounds[1].getF32ptr());
+ }
+
+ drawBoxOutline(center, size);
+
+ for (U32 i = 0; i < 2; i++)
+ {
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE, i == 1 ? GL_LEQUAL : GL_GREATER);
+
+ if (i == 1)
+ {
+ gGL.diffuseColor4f(0,1,1,0.5f);
+ }
+ else
+ {
+ gGL.diffuseColor4f(0,0.5f,0.5f, 0.25f);
+ drawBoxOutline(center, size);
+ }
+
+ if (i == 1)
+ {
+ gGL.flush();
+ glLineWidth(3.f);
+ }
+
+ gGL.begin(LLRender::TRIANGLES);
for (LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>::const_element_iter iter = branch->getDataBegin();
- iter != branch->getDataEnd();
- ++iter)
- {
- const LLVolumeTriangle* tri = *iter;
-
- gGL.vertex3fv(tri->mV[0]->getF32ptr());
- gGL.vertex3fv(tri->mV[1]->getF32ptr());
- gGL.vertex3fv(tri->mV[2]->getF32ptr());
- }
- gGL.end();
-
- if (i == 1)
- {
- gGL.flush();
- glLineWidth(1.f);
- }
- }
- }
+ iter != branch->getDataEnd();
+ ++iter)
+ {
+ const LLVolumeTriangle* tri = *iter;
+
+ gGL.vertex3fv(tri->mV[0]->getF32ptr());
+ gGL.vertex3fv(tri->mV[1]->getF32ptr());
+ gGL.vertex3fv(tri->mV[2]->getF32ptr());
+ }
+ gGL.end();
+
+ if (i == 1)
+ {
+ gGL.flush();
+ glLineWidth(1.f);
+ }
+ }
+ }
};
void renderRaycast(LLDrawable* drawablep)
{
- if (drawablep->getNumFaces())
- {
- LLGLEnable blend(GL_BLEND);
- gGL.diffuseColor4f(0,1,1,0.5f);
-
- LLVOVolume* vobj = drawablep->getVOVolume();
- if (vobj && !vobj->isDead())
- {
- //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- //pushVerts(drawablep->getFace(gDebugRaycastFaceHit), LLVertexBuffer::MAP_VERTEX);
- //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
- LLVolume* volume = vobj->getVolume();
-
- bool transform = true;
- if (drawablep->isState(LLDrawable::RIGGED))
- {
- volume = vobj->getRiggedVolume();
- transform = false;
- }
-
- if (volume)
- {
- LLVector3 trans = drawablep->getRegion()->getOriginAgent();
-
- for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
- {
- const LLVolumeFace& face = volume->getVolumeFace(i);
-
- gGL.pushMatrix();
- gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
- gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix);
-
- LLVector4a start, end;
- if (transform)
- {
- LLVector3 v_start(gDebugRaycastStart.getF32ptr());
- LLVector3 v_end(gDebugRaycastEnd.getF32ptr());
-
- v_start = vobj->agentPositionToVolume(v_start);
- v_end = vobj->agentPositionToVolume(v_end);
-
- start.load3(v_start.mV);
- end.load3(v_end.mV);
- }
- else
- {
- start = gDebugRaycastStart;
- end = gDebugRaycastEnd;
- }
-
- LLVector4a dir;
- dir.setSub(end, start);
-
- gGL.flush();
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- {
- //render face positions
- LLVertexBuffer::unbind();
- gGL.diffuseColor4f(0,1,1,0.5f);
- glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions);
- gGL.syncMatrices();
- glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
- }
-
- if (!volume->isUnique())
- {
- F32 t = 1.f;
+ if (drawablep->getNumFaces())
+ {
+ LLGLEnable blend(GL_BLEND);
+ gGL.diffuseColor4f(0,1,1,0.5f);
+
+ LLVOVolume* vobj = drawablep->getVOVolume();
+ if (vobj && !vobj->isDead())
+ {
+ //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ //pushVerts(drawablep->getFace(gDebugRaycastFaceHit), LLVertexBuffer::MAP_VERTEX);
+ //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
+ LLVolume* volume = vobj->getVolume();
+
+ bool transform = true;
+ if (drawablep->isState(LLDrawable::RIGGED))
+ {
+ volume = vobj->getRiggedVolume();
+ transform = false;
+ }
+
+ if (volume)
+ {
+ LLVector3 trans = drawablep->getRegion()->getOriginAgent();
+
+ for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
+ {
+ const LLVolumeFace& face = volume->getVolumeFace(i);
+
+ gGL.pushMatrix();
+ gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+ gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix);
+
+ LLVector4a start, end;
+ if (transform)
+ {
+ LLVector3 v_start(gDebugRaycastStart.getF32ptr());
+ LLVector3 v_end(gDebugRaycastEnd.getF32ptr());
+
+ v_start = vobj->agentPositionToVolume(v_start);
+ v_end = vobj->agentPositionToVolume(v_end);
+
+ start.load3(v_start.mV);
+ end.load3(v_end.mV);
+ }
+ else
+ {
+ start = gDebugRaycastStart;
+ end = gDebugRaycastEnd;
+ }
+
+ LLVector4a dir;
+ dir.setSub(end, start);
+
+ gGL.flush();
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
+ {
+ //render face positions
+ LLVertexBuffer::unbind();
+ gGL.diffuseColor4f(0,1,1,0.5f);
+ glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions);
+ gGL.syncMatrices();
+ glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
+ }
+
+ if (!volume->isUnique())
+ {
+ F32 t = 1.f;
if (!face.getOctree())
- {
- ((LLVolumeFace*) &face)->createOctree();
- }
+ {
+ ((LLVolumeFace*) &face)->createOctree();
+ }
+
+ LLRenderOctreeRaycast render(start, dir, &t);
- LLRenderOctreeRaycast render(start, dir, &t);
-
render.traverse(face.getOctree());
- }
-
- gGL.popMatrix();
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- }
- }
- }
- else if (drawablep->isAvatar())
- {
- if (drawablep->getVObj() == gDebugRaycastObject)
- {
- LLGLDepthTest depth(GL_FALSE);
- LLVOAvatar* av = (LLVOAvatar*) drawablep->getVObj().get();
- av->renderCollisionVolumes();
- }
- }
-
- if (drawablep->getVObj() == gDebugRaycastObject)
- {
- // draw intersection point
- gGL.pushMatrix();
- gGL.loadMatrix(gGLModelView);
- LLVector3 translate(gDebugRaycastIntersection.getF32ptr());
- gGL.translatef(translate.mV[0], translate.mV[1], translate.mV[2]);
- LLCoordFrame orient;
- LLVector4a debug_binormal;
-
- debug_binormal.setCross3(gDebugRaycastNormal, gDebugRaycastTangent);
- debug_binormal.mul(gDebugRaycastTangent.getF32ptr()[3]);
-
- LLVector3 normal(gDebugRaycastNormal.getF32ptr());
- LLVector3 binormal(debug_binormal.getF32ptr());
-
- orient.lookDir(normal, binormal);
- LLMatrix4 rotation;
- orient.getRotMatrixToParent(rotation);
- gGL.multMatrix((float*)rotation.mMatrix);
-
- gGL.diffuseColor4f(1,0,0,0.5f);
- drawBox(LLVector3(0, 0, 0), LLVector3(0.1f, 0.022f, 0.022f));
- gGL.diffuseColor4f(0,1,0,0.5f);
- drawBox(LLVector3(0, 0, 0), LLVector3(0.021f, 0.1f, 0.021f));
- gGL.diffuseColor4f(0,0,1,0.5f);
- drawBox(LLVector3(0, 0, 0), LLVector3(0.02f, 0.02f, 0.1f));
- gGL.popMatrix();
-
- // draw bounding box of prim
- const LLVector4a* ext = drawablep->getSpatialExtents();
-
- LLVector4a pos;
- pos.setAdd(ext[0], ext[1]);
- pos.mul(0.5f);
- LLVector4a size;
- size.setSub(ext[1], ext[0]);
- size.mul(0.5f);
-
- LLGLDepthTest depth(GL_FALSE, GL_TRUE);
- gGL.diffuseColor4f(0,0.5f,0.5f,1);
- drawBoxOutline(pos, size);
- }
- }
+ }
+
+ gGL.popMatrix();
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ }
+ }
+ }
+ else if (drawablep->isAvatar())
+ {
+ if (drawablep->getVObj() == gDebugRaycastObject)
+ {
+ LLGLDepthTest depth(GL_FALSE);
+ LLVOAvatar* av = (LLVOAvatar*) drawablep->getVObj().get();
+ av->renderCollisionVolumes();
+ }
+ }
+
+ if (drawablep->getVObj() == gDebugRaycastObject)
+ {
+ // draw intersection point
+ gGL.pushMatrix();
+ gGL.loadMatrix(gGLModelView);
+ LLVector3 translate(gDebugRaycastIntersection.getF32ptr());
+ gGL.translatef(translate.mV[0], translate.mV[1], translate.mV[2]);
+ LLCoordFrame orient;
+ LLVector4a debug_binormal;
+
+ debug_binormal.setCross3(gDebugRaycastNormal, gDebugRaycastTangent);
+ debug_binormal.mul(gDebugRaycastTangent.getF32ptr()[3]);
+
+ LLVector3 normal(gDebugRaycastNormal.getF32ptr());
+ LLVector3 binormal(debug_binormal.getF32ptr());
+
+ orient.lookDir(normal, binormal);
+ LLMatrix4 rotation;
+ orient.getRotMatrixToParent(rotation);
+ gGL.multMatrix((float*)rotation.mMatrix);
+
+ gGL.diffuseColor4f(1,0,0,0.5f);
+ drawBox(LLVector3(0, 0, 0), LLVector3(0.1f, 0.022f, 0.022f));
+ gGL.diffuseColor4f(0,1,0,0.5f);
+ drawBox(LLVector3(0, 0, 0), LLVector3(0.021f, 0.1f, 0.021f));
+ gGL.diffuseColor4f(0,0,1,0.5f);
+ drawBox(LLVector3(0, 0, 0), LLVector3(0.02f, 0.02f, 0.1f));
+ gGL.popMatrix();
+
+ // draw bounding box of prim
+ const LLVector4a* ext = drawablep->getSpatialExtents();
+
+ LLVector4a pos;
+ pos.setAdd(ext[0], ext[1]);
+ pos.mul(0.5f);
+ LLVector4a size;
+ size.setSub(ext[1], ext[0]);
+ size.mul(0.5f);
+
+ LLGLDepthTest depth(GL_FALSE, GL_TRUE);
+ gGL.diffuseColor4f(0,0.5f,0.5f,1);
+ drawBoxOutline(pos, size);
+ }
+ }
}
void renderAvatarCollisionVolumes(LLVOAvatar* avatar)
{
- avatar->renderCollisionVolumes();
+ avatar->renderCollisionVolumes();
}
void renderAvatarBones(LLVOAvatar* avatar)
{
- avatar->renderBones();
+ avatar->renderBones();
}
void renderAgentTarget(LLVOAvatar* avatar)
{
- // render these for self only (why, i don't know)
- if (avatar->isSelf())
- {
- renderCrossHairs(avatar->getPositionAgent(), 0.2f, LLColor4(1, 0, 0, 0.8f));
- renderCrossHairs(avatar->mDrawable->getPositionAgent(), 0.2f, LLColor4(0, 1, 0, 0.8f));
- renderCrossHairs(avatar->mRoot->getWorldPosition(), 0.2f, LLColor4(1, 1, 1, 0.8f));
- renderCrossHairs(avatar->mPelvisp->getWorldPosition(), 0.2f, LLColor4(0, 0, 1, 0.8f));
- }
+ // render these for self only (why, i don't know)
+ if (avatar->isSelf())
+ {
+ renderCrossHairs(avatar->getPositionAgent(), 0.2f, LLColor4(1, 0, 0, 0.8f));
+ renderCrossHairs(avatar->mDrawable->getPositionAgent(), 0.2f, LLColor4(0, 1, 0, 0.8f));
+ renderCrossHairs(avatar->mRoot->getWorldPosition(), 0.2f, LLColor4(1, 1, 1, 0.8f));
+ renderCrossHairs(avatar->mPelvisp->getWorldPosition(), 0.2f, LLColor4(0, 0, 1, 0.8f));
+ }
}
static void setTextureAreaDebugText(LLDrawable* drawablep)
@@ -3085,668 +3085,668 @@ static void setTextureAreaDebugText(LLDrawable* drawablep)
class LLOctreeRenderNonOccluded : public OctreeTraveler
{
public:
- LLCamera* mCamera;
- LLOctreeRenderNonOccluded(LLCamera* camera): mCamera(camera) {}
-
- virtual void traverse(const OctreeNode* node)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
-
- const LLVector4a* bounds = group->getBounds();
- if (!mCamera || mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1]))
- {
- node->accept(this);
- stop_glerror();
-
- for (U32 i = 0; i < node->getChildCount(); i++)
- {
- traverse(node->getChild(i));
- stop_glerror();
- }
-
- //draw tight fit bounding boxes for spatial group
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE))
- {
- group->rebuildGeom();
- group->rebuildMesh();
-
- renderOctree(group);
- stop_glerror();
- }
- }
- }
-
- virtual void visit(const OctreeNode* branch)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) branch->getListener(0);
- const LLVector4a* bounds = group->getBounds();
- if (group->hasState(LLSpatialGroup::GEOM_DIRTY) || (mCamera && !mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1])))
- {
- return;
- }
-
- group->rebuildGeom();
- group->rebuildMesh();
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES))
- {
- if (!group->isEmpty())
- {
- gGL.diffuseColor3f(0,0,1);
- const LLVector4a* obj_bounds = group->getObjectBounds();
- drawBoxOutline(obj_bounds[0], obj_bounds[1]);
- }
- }
-
- for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
- {
- LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
- if(!drawable || drawable->isDead())
- {
- continue;
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES))
- {
- renderBoundingBox(drawable);
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_NORMALS))
- {
- renderNormals(drawable);
- }
-
+ LLCamera* mCamera;
+ LLOctreeRenderNonOccluded(LLCamera* camera): mCamera(camera) {}
+
+ virtual void traverse(const OctreeNode* node)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
+
+ const LLVector4a* bounds = group->getBounds();
+ if (!mCamera || mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1]))
+ {
+ node->accept(this);
+ stop_glerror();
+
+ for (U32 i = 0; i < node->getChildCount(); i++)
+ {
+ traverse(node->getChild(i));
+ stop_glerror();
+ }
+
+ //draw tight fit bounding boxes for spatial group
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE))
+ {
+ group->rebuildGeom();
+ group->rebuildMesh();
+
+ renderOctree(group);
+ stop_glerror();
+ }
+ }
+ }
+
+ virtual void visit(const OctreeNode* branch)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) branch->getListener(0);
+ const LLVector4a* bounds = group->getBounds();
+ if (group->hasState(LLSpatialGroup::GEOM_DIRTY) || (mCamera && !mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1])))
+ {
+ return;
+ }
+
+ group->rebuildGeom();
+ group->rebuildMesh();
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES))
+ {
+ if (!group->isEmpty())
+ {
+ gGL.diffuseColor3f(0,0,1);
+ const LLVector4a* obj_bounds = group->getObjectBounds();
+ drawBoxOutline(obj_bounds[0], obj_bounds[1]);
+ }
+ }
+
+ for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
+ {
+ LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
+ if(!drawable || drawable->isDead())
+ {
+ continue;
+ }
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES))
+ {
+ renderBoundingBox(drawable);
+ }
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_NORMALS))
+ {
+ renderNormals(drawable);
+ }
+
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
{
setTextureAreaDebugText(drawable);
}
- /*if (drawable->getVOVolume() && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
- {
- renderTexturePriority(drawable);
- }*/
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_POINTS))
- {
- renderPoints(drawable);
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_LIGHTS))
- {
- renderLights(drawable);
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST))
- {
- renderRaycast(drawable);
- }
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_UPDATE_TYPE))
- {
- renderUpdateType(drawable);
- }
- if(gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY))
- {
- renderTexelDensity(drawable);
- }
-
- LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(drawable->getVObj().get());
-
- if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_VOLUME))
- {
- renderAvatarCollisionVolumes(avatar);
- }
-
- if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_JOINTS))
- {
- renderAvatarBones(avatar);
- }
-
- if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AGENT_TARGET))
- {
- renderAgentTarget(avatar);
- }
-
+ /*if (drawable->getVOVolume() && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
+ {
+ renderTexturePriority(drawable);
+ }*/
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_POINTS))
+ {
+ renderPoints(drawable);
+ }
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_LIGHTS))
+ {
+ renderLights(drawable);
+ }
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST))
+ {
+ renderRaycast(drawable);
+ }
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_UPDATE_TYPE))
+ {
+ renderUpdateType(drawable);
+ }
+ if(gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY))
+ {
+ renderTexelDensity(drawable);
+ }
+
+ LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(drawable->getVObj().get());
+
+ if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_VOLUME))
+ {
+ renderAvatarCollisionVolumes(avatar);
+ }
+
+ if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_JOINTS))
+ {
+ renderAvatarBones(avatar);
+ }
+
+ if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AGENT_TARGET))
+ {
+ renderAgentTarget(avatar);
+ }
+
#if 0
- if (gDebugGL)
- {
- for (U32 i = 0; i < drawable->getNumFaces(); ++i)
- {
- LLFace* facep = drawable->getFace(i);
- if (facep)
- {
- U8 index = facep->getTextureIndex();
- if (facep->mDrawInfo)
- {
- if (index < FACE_DO_NOT_BATCH_TEXTURES)
- {
- if (facep->mDrawInfo->mTextureList.size() <= index)
- {
- LL_ERRS() << "Face texture index out of bounds." << LL_ENDL;
- }
- else if (facep->mDrawInfo->mTextureList[index] != facep->getTexture())
- {
- LL_ERRS() << "Face texture index incorrect." << LL_ENDL;
- }
- }
- }
- }
- }
- }
+ if (gDebugGL)
+ {
+ for (U32 i = 0; i < drawable->getNumFaces(); ++i)
+ {
+ LLFace* facep = drawable->getFace(i);
+ if (facep)
+ {
+ U8 index = facep->getTextureIndex();
+ if (facep->mDrawInfo)
+ {
+ if (index < FACE_DO_NOT_BATCH_TEXTURES)
+ {
+ if (facep->mDrawInfo->mTextureList.size() <= index)
+ {
+ LL_ERRS() << "Face texture index out of bounds." << LL_ENDL;
+ }
+ else if (facep->mDrawInfo->mTextureList[index] != facep->getTexture())
+ {
+ LL_ERRS() << "Face texture index incorrect." << LL_ENDL;
+ }
+ }
+ }
+ }
+ }
+ }
#endif
- }
-
- for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
- {
- LLSpatialGroup::drawmap_elem_t& draw_vec = i->second;
- for (LLSpatialGroup::drawmap_elem_t::iterator j = draw_vec.begin(); j != draw_vec.end(); ++j)
- {
- LLDrawInfo* draw_info = *j;
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_ANIM))
- {
- renderTextureAnim(draw_info);
- }
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BATCH_SIZE))
- {
- renderBatchSize(draw_info);
- }
- }
- }
- }
+ }
+
+ for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
+ {
+ LLSpatialGroup::drawmap_elem_t& draw_vec = i->second;
+ for (LLSpatialGroup::drawmap_elem_t::iterator j = draw_vec.begin(); j != draw_vec.end(); ++j)
+ {
+ LLDrawInfo* draw_info = *j;
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_ANIM))
+ {
+ renderTextureAnim(draw_info);
+ }
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BATCH_SIZE))
+ {
+ renderBatchSize(draw_info);
+ }
+ }
+ }
+ }
};
class LLOctreeRenderXRay : public OctreeTraveler
{
public:
- LLCamera* mCamera;
- LLOctreeRenderXRay(LLCamera* camera): mCamera(camera) {}
-
- virtual void traverse(const OctreeNode* node)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
-
- const LLVector4a* bounds = group->getBounds();
- if (!mCamera || mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1]))
- {
- node->accept(this);
- stop_glerror();
-
- for (U32 i = 0; i < node->getChildCount(); i++)
- {
- traverse(node->getChild(i));
- stop_glerror();
- }
-
- //render visibility wireframe
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
- {
- group->rebuildGeom();
- group->rebuildMesh();
-
- gGL.flush();
- gGL.pushMatrix();
- gGLLastMatrix = NULL;
- gGL.loadMatrix(gGLModelView);
- renderXRay(group, mCamera);
- stop_glerror();
- gGLLastMatrix = NULL;
- gGL.popMatrix();
- }
- }
- }
-
- virtual void visit(const OctreeNode* node) {}
+ LLCamera* mCamera;
+ LLOctreeRenderXRay(LLCamera* camera): mCamera(camera) {}
+
+ virtual void traverse(const OctreeNode* node)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
+
+ const LLVector4a* bounds = group->getBounds();
+ if (!mCamera || mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1]))
+ {
+ node->accept(this);
+ stop_glerror();
+
+ for (U32 i = 0; i < node->getChildCount(); i++)
+ {
+ traverse(node->getChild(i));
+ stop_glerror();
+ }
+
+ //render visibility wireframe
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
+ {
+ group->rebuildGeom();
+ group->rebuildMesh();
+
+ gGL.flush();
+ gGL.pushMatrix();
+ gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
+ renderXRay(group, mCamera);
+ stop_glerror();
+ gGLLastMatrix = NULL;
+ gGL.popMatrix();
+ }
+ }
+ }
+
+ virtual void visit(const OctreeNode* node) {}
};
class LLOctreeRenderPhysicsShapes : public OctreeTraveler
{
public:
- LLCamera* mCamera;
+ LLCamera* mCamera;
bool mWireframe;
- LLOctreeRenderPhysicsShapes(LLCamera* camera, bool wireframe): mCamera(camera), mWireframe(wireframe) {}
-
- virtual void traverse(const OctreeNode* node)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
-
- const LLVector4a* bounds = group->getBounds();
- if (!mCamera || mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1]))
- {
- node->accept(this);
- stop_glerror();
-
- for (U32 i = 0; i < node->getChildCount(); i++)
- {
- traverse(node->getChild(i));
- stop_glerror();
- }
-
- group->rebuildGeom();
- group->rebuildMesh();
-
- renderPhysicsShapes(group, mWireframe);
- }
- }
-
- virtual void visit(const OctreeNode* branch)
- {
-
- }
+ LLOctreeRenderPhysicsShapes(LLCamera* camera, bool wireframe): mCamera(camera), mWireframe(wireframe) {}
+
+ virtual void traverse(const OctreeNode* node)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
+
+ const LLVector4a* bounds = group->getBounds();
+ if (!mCamera || mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1]))
+ {
+ node->accept(this);
+ stop_glerror();
+
+ for (U32 i = 0; i < node->getChildCount(); i++)
+ {
+ traverse(node->getChild(i));
+ stop_glerror();
+ }
+
+ group->rebuildGeom();
+ group->rebuildMesh();
+
+ renderPhysicsShapes(group, mWireframe);
+ }
+ }
+
+ virtual void visit(const OctreeNode* branch)
+ {
+
+ }
};
class LLOctreePushBBoxVerts : public OctreeTraveler
{
public:
- LLCamera* mCamera;
- LLOctreePushBBoxVerts(LLCamera* camera): mCamera(camera) {}
-
- virtual void traverse(const OctreeNode* node)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
-
- const LLVector4a* bounds = group->getBounds();
- if (!mCamera || mCamera->AABBInFrustum(bounds[0], bounds[1]))
- {
- node->accept(this);
-
- for (U32 i = 0; i < node->getChildCount(); i++)
- {
- traverse(node->getChild(i));
- }
- }
- }
-
- virtual void visit(const OctreeNode* branch)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) branch->getListener(0);
-
- const LLVector4a* bounds = group->getBounds();
- if (group->hasState(LLSpatialGroup::GEOM_DIRTY) || (mCamera && !mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1])))
- {
- return;
- }
-
- for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
- {
- LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
- if(!drawable)
- {
- continue;
- }
- renderBoundingBox(drawable, FALSE);
- }
- }
+ LLCamera* mCamera;
+ LLOctreePushBBoxVerts(LLCamera* camera): mCamera(camera) {}
+
+ virtual void traverse(const OctreeNode* node)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
+
+ const LLVector4a* bounds = group->getBounds();
+ if (!mCamera || mCamera->AABBInFrustum(bounds[0], bounds[1]))
+ {
+ node->accept(this);
+
+ for (U32 i = 0; i < node->getChildCount(); i++)
+ {
+ traverse(node->getChild(i));
+ }
+ }
+ }
+
+ virtual void visit(const OctreeNode* branch)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) branch->getListener(0);
+
+ const LLVector4a* bounds = group->getBounds();
+ if (group->hasState(LLSpatialGroup::GEOM_DIRTY) || (mCamera && !mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1])))
+ {
+ return;
+ }
+
+ for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
+ {
+ LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
+ if(!drawable)
+ {
+ continue;
+ }
+ renderBoundingBox(drawable, FALSE);
+ }
+ }
};
void LLSpatialPartition::renderIntersectingBBoxes(LLCamera* camera)
{
- LLOctreePushBBoxVerts pusher(camera);
- pusher.traverse(mOctree);
+ LLOctreePushBBoxVerts pusher(camera);
+ pusher.traverse(mOctree);
}
class LLOctreeStateCheck : public OctreeTraveler
{
public:
- U32 mInheritedMask[LLViewerCamera::NUM_CAMERAS];
-
- LLOctreeStateCheck()
- {
- for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
- {
- mInheritedMask[i] = 0;
- }
- }
-
- virtual void traverse(const OctreeNode* node)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
-
- node->accept(this);
-
-
- U32 temp[LLViewerCamera::NUM_CAMERAS];
-
- for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
- {
- temp[i] = mInheritedMask[i];
- mInheritedMask[i] |= group->mOcclusionState[i] & LLSpatialGroup::OCCLUDED;
- }
-
- for (U32 i = 0; i < node->getChildCount(); i++)
- {
- traverse(node->getChild(i));
- }
-
- for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
- {
- mInheritedMask[i] = temp[i];
- }
- }
-
-
- virtual void visit(const OctreeNode* state)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0);
-
- for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
- {
- if (mInheritedMask[i] && !(group->mOcclusionState[i] & mInheritedMask[i]))
- {
- LL_ERRS() << "Spatial group failed inherited mask test." << LL_ENDL;
- }
- }
-
- if (group->hasState(LLSpatialGroup::DIRTY))
- {
- assert_parent_state(group, LLSpatialGroup::DIRTY);
- }
- }
-
- void assert_parent_state(LLSpatialGroup* group, U32 state)
- {
- LLSpatialGroup* parent = group->getParent();
- while (parent)
- {
- if (!parent->hasState(state))
- {
- LL_ERRS() << "Spatial group failed parent state check." << LL_ENDL;
- }
- parent = parent->getParent();
- }
- }
+ U32 mInheritedMask[LLViewerCamera::NUM_CAMERAS];
+
+ LLOctreeStateCheck()
+ {
+ for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
+ {
+ mInheritedMask[i] = 0;
+ }
+ }
+
+ virtual void traverse(const OctreeNode* node)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
+
+ node->accept(this);
+
+
+ U32 temp[LLViewerCamera::NUM_CAMERAS];
+
+ for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
+ {
+ temp[i] = mInheritedMask[i];
+ mInheritedMask[i] |= group->mOcclusionState[i] & LLSpatialGroup::OCCLUDED;
+ }
+
+ for (U32 i = 0; i < node->getChildCount(); i++)
+ {
+ traverse(node->getChild(i));
+ }
+
+ for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
+ {
+ mInheritedMask[i] = temp[i];
+ }
+ }
+
+
+ virtual void visit(const OctreeNode* state)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0);
+
+ for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
+ {
+ if (mInheritedMask[i] && !(group->mOcclusionState[i] & mInheritedMask[i]))
+ {
+ LL_ERRS() << "Spatial group failed inherited mask test." << LL_ENDL;
+ }
+ }
+
+ if (group->hasState(LLSpatialGroup::DIRTY))
+ {
+ assert_parent_state(group, LLSpatialGroup::DIRTY);
+ }
+ }
+
+ void assert_parent_state(LLSpatialGroup* group, U32 state)
+ {
+ LLSpatialGroup* parent = group->getParent();
+ while (parent)
+ {
+ if (!parent->hasState(state))
+ {
+ LL_ERRS() << "Spatial group failed parent state check." << LL_ENDL;
+ }
+ parent = parent->getParent();
+ }
+ }
};
void LLSpatialPartition::renderPhysicsShapes(bool wireframe)
{
- LLSpatialBridge* bridge = asBridge();
- LLCamera* camera = LLViewerCamera::getInstance();
-
- if (bridge)
- {
- camera = NULL;
- }
-
- gGL.flush();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLOctreeRenderPhysicsShapes render_physics(camera, wireframe);
- render_physics.traverse(mOctree);
- gGL.flush();
+ LLSpatialBridge* bridge = asBridge();
+ LLCamera* camera = LLViewerCamera::getInstance();
+
+ if (bridge)
+ {
+ camera = NULL;
+ }
+
+ gGL.flush();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLOctreeRenderPhysicsShapes render_physics(camera, wireframe);
+ render_physics.traverse(mOctree);
+ gGL.flush();
}
void LLSpatialPartition::renderDebug()
{
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE |
- LLPipeline::RENDER_DEBUG_OCCLUSION |
- LLPipeline::RENDER_DEBUG_LIGHTS |
- LLPipeline::RENDER_DEBUG_BATCH_SIZE |
- LLPipeline::RENDER_DEBUG_UPDATE_TYPE |
- LLPipeline::RENDER_DEBUG_BBOXES |
- LLPipeline::RENDER_DEBUG_NORMALS |
- LLPipeline::RENDER_DEBUG_POINTS |
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE |
+ LLPipeline::RENDER_DEBUG_OCCLUSION |
+ LLPipeline::RENDER_DEBUG_LIGHTS |
+ LLPipeline::RENDER_DEBUG_BATCH_SIZE |
+ LLPipeline::RENDER_DEBUG_UPDATE_TYPE |
+ LLPipeline::RENDER_DEBUG_BBOXES |
+ LLPipeline::RENDER_DEBUG_NORMALS |
+ LLPipeline::RENDER_DEBUG_POINTS |
LLPipeline::RENDER_DEBUG_TEXTURE_AREA |
- LLPipeline::RENDER_DEBUG_TEXTURE_ANIM |
- LLPipeline::RENDER_DEBUG_RAYCAST |
- LLPipeline::RENDER_DEBUG_AVATAR_VOLUME |
- LLPipeline::RENDER_DEBUG_AVATAR_JOINTS |
- LLPipeline::RENDER_DEBUG_AGENT_TARGET |
- LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA |
- LLPipeline::RENDER_DEBUG_TEXEL_DENSITY))
- {
- return;
- }
-
- gDebugProgram.bind();
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
- {
- //sLastMaxTexPriority = lerp(sLastMaxTexPriority, sCurMaxTexPriority, gFrameIntervalSeconds);
- sLastMaxTexPriority = (F32) LLViewerCamera::getInstance()->getScreenPixelArea();
- sCurMaxTexPriority = 0.f;
- }
-
- LLGLDisable cullface(GL_CULL_FACE);
- LLGLEnable blend(GL_BLEND);
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gPipeline.disableLights();
-
- LLSpatialBridge* bridge = asBridge();
- LLCamera* camera = LLViewerCamera::getInstance();
-
- if (bridge)
- {
- camera = NULL;
- }
-
- LLOctreeStateCheck checker;
- checker.traverse(mOctree);
-
- LLOctreeRenderNonOccluded render_debug(camera);
- render_debug.traverse(mOctree);
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
- {
- {
- LLGLEnable cull(GL_CULL_FACE);
-
- LLGLEnable blend(GL_BLEND);
- LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- gGL.diffuseColor4f(0.5f, 0.0f, 0, 0.25f);
-
- LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
- glPolygonOffset(-1.f, -1.f);
-
- LLOctreeRenderXRay xray(camera);
- xray.traverse(mOctree);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- }
- }
- gDebugProgram.unbind();
+ LLPipeline::RENDER_DEBUG_TEXTURE_ANIM |
+ LLPipeline::RENDER_DEBUG_RAYCAST |
+ LLPipeline::RENDER_DEBUG_AVATAR_VOLUME |
+ LLPipeline::RENDER_DEBUG_AVATAR_JOINTS |
+ LLPipeline::RENDER_DEBUG_AGENT_TARGET |
+ LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA |
+ LLPipeline::RENDER_DEBUG_TEXEL_DENSITY))
+ {
+ return;
+ }
+
+ gDebugProgram.bind();
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
+ {
+ //sLastMaxTexPriority = lerp(sLastMaxTexPriority, sCurMaxTexPriority, gFrameIntervalSeconds);
+ sLastMaxTexPriority = (F32) LLViewerCamera::getInstance()->getScreenPixelArea();
+ sCurMaxTexPriority = 0.f;
+ }
+
+ LLGLDisable cullface(GL_CULL_FACE);
+ LLGLEnable blend(GL_BLEND);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gPipeline.disableLights();
+
+ LLSpatialBridge* bridge = asBridge();
+ LLCamera* camera = LLViewerCamera::getInstance();
+
+ if (bridge)
+ {
+ camera = NULL;
+ }
+
+ LLOctreeStateCheck checker;
+ checker.traverse(mOctree);
+
+ LLOctreeRenderNonOccluded render_debug(camera);
+ render_debug.traverse(mOctree);
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
+ {
+ {
+ LLGLEnable cull(GL_CULL_FACE);
+
+ LLGLEnable blend(GL_BLEND);
+ LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ gGL.diffuseColor4f(0.5f, 0.0f, 0, 0.25f);
+
+ LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
+ glPolygonOffset(-1.f, -1.f);
+
+ LLOctreeRenderXRay xray(camera);
+ xray.traverse(mOctree);
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ }
+ }
+ gDebugProgram.unbind();
}
void LLSpatialGroup::drawObjectBox(LLColor4 col)
{
- gGL.diffuseColor4fv(col.mV);
- LLVector4a size;
- size = mObjectBounds[1];
- size.mul(1.01f);
- size.add(LLVector4a(0.001f));
- drawBox(mObjectBounds[0], size);
+ gGL.diffuseColor4fv(col.mV);
+ LLVector4a size;
+ size = mObjectBounds[1];
+ size.mul(1.01f);
+ size.add(LLVector4a(0.001f));
+ drawBox(mObjectBounds[0], size);
}
-bool LLSpatialPartition::isHUDPartition()
-{
- return mPartitionType == LLViewerRegion::PARTITION_HUD ;
-}
+bool LLSpatialPartition::isHUDPartition()
+{
+ return mPartitionType == LLViewerRegion::PARTITION_HUD ;
+}
BOOL LLSpatialPartition::isVisible(const LLVector3& v)
{
- if (!LLViewerCamera::getInstance()->sphereInFrustum(v, 4.0f))
- {
- return FALSE;
- }
+ if (!LLViewerCamera::getInstance()->sphereInFrustum(v, 4.0f))
+ {
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
LL_ALIGN_PREFIX(16)
class LLOctreeIntersect : public LLOctreeTraveler<LLViewerOctreeEntry, LLPointer<LLViewerOctreeEntry>>
{
public:
- LL_ALIGN_16(LLVector4a mStart);
- LL_ALIGN_16(LLVector4a mEnd);
-
- S32 *mFaceHit;
- LLVector4a *mIntersection;
- LLVector2 *mTexCoord;
- LLVector4a *mNormal;
- LLVector4a *mTangent;
- LLDrawable* mHit;
- BOOL mPickTransparent;
- BOOL mPickRigged;
+ LL_ALIGN_16(LLVector4a mStart);
+ LL_ALIGN_16(LLVector4a mEnd);
+
+ S32 *mFaceHit;
+ LLVector4a *mIntersection;
+ LLVector2 *mTexCoord;
+ LLVector4a *mNormal;
+ LLVector4a *mTangent;
+ LLDrawable* mHit;
+ BOOL mPickTransparent;
+ BOOL mPickRigged;
BOOL mPickUnselectable;
BOOL mPickReflectionProbe;
- LLOctreeIntersect(const LLVector4a& start, const LLVector4a& end, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, BOOL pick_reflection_probe,
- S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
- : mStart(start),
- mEnd(end),
- mFaceHit(face_hit),
- mIntersection(intersection),
- mTexCoord(tex_coord),
- mNormal(normal),
- mTangent(tangent),
- mHit(NULL),
- mPickTransparent(pick_transparent),
- mPickRigged(pick_rigged),
+ LLOctreeIntersect(const LLVector4a& start, const LLVector4a& end, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, BOOL pick_reflection_probe,
+ S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
+ : mStart(start),
+ mEnd(end),
+ mFaceHit(face_hit),
+ mIntersection(intersection),
+ mTexCoord(tex_coord),
+ mNormal(normal),
+ mTangent(tangent),
+ mHit(NULL),
+ mPickTransparent(pick_transparent),
+ mPickRigged(pick_rigged),
mPickUnselectable(pick_unselectable),
mPickReflectionProbe(pick_reflection_probe)
- {
- }
-
- virtual void visit(const OctreeNode* branch)
- {
- for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
- {
- check(*i);
- }
- }
-
- virtual LLDrawable* check(const OctreeNode* node)
- {
- node->accept(this);
-
- for (U32 i = 0; i < node->getChildCount(); i++)
- {
- const OctreeNode* child = node->getChild(i);
- LLVector3 res;
-
- LLSpatialGroup* group = (LLSpatialGroup*) child->getListener(0);
-
- LLVector4a size;
- LLVector4a center;
-
- const LLVector4a* bounds = group->getBounds();
- size = bounds[1];
- center = bounds[0];
-
- LLVector4a local_start = mStart;
- LLVector4a local_end = mEnd;
-
- if (group->getSpatialPartition()->isBridge())
- {
- LLMatrix4 local_matrix = group->getSpatialPartition()->asBridge()->mDrawable->getRenderMatrix();
- local_matrix.invert();
-
- LLMatrix4a local_matrix4a;
- local_matrix4a.loadu(local_matrix);
-
- local_matrix4a.affineTransform(mStart, local_start);
- local_matrix4a.affineTransform(mEnd, local_end);
- }
-
- if (LLLineSegmentBoxIntersect(local_start, local_end, center, size))
- {
- check(child);
- }
- }
-
- return mHit;
- }
-
- virtual bool check(LLViewerOctreeEntry* entry)
- {
- LLDrawable* drawable = (LLDrawable*)entry->getDrawable();
-
- if (!drawable || !gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible())
- {
- return false;
- }
-
- if (drawable->isSpatialBridge())
- {
- LLSpatialPartition *part = drawable->asPartition();
- LLSpatialBridge* bridge = part->asBridge();
- if (bridge && gPipeline.hasRenderType(bridge->mDrawableType))
- {
- check(part->mOctree);
- }
- }
- else
- {
- LLViewerObject* vobj = drawable->getVObj();
+ {
+ }
+
+ virtual void visit(const OctreeNode* branch)
+ {
+ for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
+ {
+ check(*i);
+ }
+ }
+
+ virtual LLDrawable* check(const OctreeNode* node)
+ {
+ node->accept(this);
+
+ for (U32 i = 0; i < node->getChildCount(); i++)
+ {
+ const OctreeNode* child = node->getChild(i);
+ LLVector3 res;
+
+ LLSpatialGroup* group = (LLSpatialGroup*) child->getListener(0);
+
+ LLVector4a size;
+ LLVector4a center;
+
+ const LLVector4a* bounds = group->getBounds();
+ size = bounds[1];
+ center = bounds[0];
+
+ LLVector4a local_start = mStart;
+ LLVector4a local_end = mEnd;
+
+ if (group->getSpatialPartition()->isBridge())
+ {
+ LLMatrix4 local_matrix = group->getSpatialPartition()->asBridge()->mDrawable->getRenderMatrix();
+ local_matrix.invert();
+
+ LLMatrix4a local_matrix4a;
+ local_matrix4a.loadu(local_matrix);
+
+ local_matrix4a.affineTransform(mStart, local_start);
+ local_matrix4a.affineTransform(mEnd, local_end);
+ }
+
+ if (LLLineSegmentBoxIntersect(local_start, local_end, center, size))
+ {
+ check(child);
+ }
+ }
+
+ return mHit;
+ }
+
+ virtual bool check(LLViewerOctreeEntry* entry)
+ {
+ LLDrawable* drawable = (LLDrawable*)entry->getDrawable();
+
+ if (!drawable || !gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible())
+ {
+ return false;
+ }
+
+ if (drawable->isSpatialBridge())
+ {
+ LLSpatialPartition *part = drawable->asPartition();
+ LLSpatialBridge* bridge = part->asBridge();
+ if (bridge && gPipeline.hasRenderType(bridge->mDrawableType))
+ {
+ check(part->mOctree);
+ }
+ }
+ else
+ {
+ LLViewerObject* vobj = drawable->getVObj();
if (vobj &&
(!vobj->isReflectionProbe() || mPickReflectionProbe))
- {
- if (vobj->getClickAction() == CLICK_ACTION_IGNORE && !LLFloater::isVisible(gFloaterTools))
- {
- return false;
- }
-
- LLVector4a intersection;
- bool skip_check = false;
- if (vobj->isAvatar())
- {
- LLVOAvatar* avatar = (LLVOAvatar*) vobj;
- if ((mPickRigged) || ((avatar->isSelf()) && (LLFloater::isVisible(gFloaterTools))))
- {
- LLViewerObject* hit = avatar->lineSegmentIntersectRiggedAttachments(mStart, mEnd, -1, mPickTransparent, mPickRigged, mPickUnselectable, mFaceHit, &intersection, mTexCoord, mNormal, mTangent);
- if (hit)
- {
- mEnd = intersection;
- if (mIntersection)
- {
- *mIntersection = intersection;
- }
-
- mHit = hit->mDrawable;
- skip_check = true;
- }
-
- }
- }
-
- if (!skip_check && vobj->lineSegmentIntersect(mStart, mEnd, -1,
+ {
+ if (vobj->getClickAction() == CLICK_ACTION_IGNORE && !LLFloater::isVisible(gFloaterTools))
+ {
+ return false;
+ }
+
+ LLVector4a intersection;
+ bool skip_check = false;
+ if (vobj->isAvatar())
+ {
+ LLVOAvatar* avatar = (LLVOAvatar*) vobj;
+ if ((mPickRigged) || ((avatar->isSelf()) && (LLFloater::isVisible(gFloaterTools))))
+ {
+ LLViewerObject* hit = avatar->lineSegmentIntersectRiggedAttachments(mStart, mEnd, -1, mPickTransparent, mPickRigged, mPickUnselectable, mFaceHit, &intersection, mTexCoord, mNormal, mTangent);
+ if (hit)
+ {
+ mEnd = intersection;
+ if (mIntersection)
+ {
+ *mIntersection = intersection;
+ }
+
+ mHit = hit->mDrawable;
+ skip_check = true;
+ }
+
+ }
+ }
+
+ if (!skip_check && vobj->lineSegmentIntersect(mStart, mEnd, -1,
(mPickReflectionProbe && vobj->isReflectionProbe()) ? TRUE : mPickTransparent, // always pick transparent when picking selection probe
mPickRigged, mPickUnselectable, mFaceHit, &intersection, mTexCoord, mNormal, mTangent))
- {
- mEnd = intersection; // shorten ray so we only find CLOSER hits
- if (mIntersection)
- {
- *mIntersection = intersection;
- }
-
- mHit = vobj->mDrawable;
- }
- }
- }
-
- return false;
- }
+ {
+ mEnd = intersection; // shorten ray so we only find CLOSER hits
+ if (mIntersection)
+ {
+ *mIntersection = intersection;
+ }
+
+ mHit = vobj->mDrawable;
+ }
+ }
+ }
+
+ return false;
+ }
} LL_ALIGN_POSTFIX(16);
LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- BOOL pick_transparent,
- BOOL pick_rigged,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
BOOL pick_unselectable,
BOOL pick_reflection_probe,
- S32* face_hit, // return the face hit
- LLVector4a* intersection, // return the intersection point
- LLVector2* tex_coord, // return the texture coordinates of the intersection point
- LLVector4a* normal, // return the surface normal at the intersection point
- LLVector4a* tangent // return the surface tangent at the intersection point
- )
+ S32* face_hit, // return the face hit
+ LLVector4a* intersection, // return the intersection point
+ LLVector2* tex_coord, // return the texture coordinates of the intersection point
+ LLVector4a* normal, // return the surface normal at the intersection point
+ LLVector4a* tangent // return the surface tangent at the intersection point
+ )
{
- LLOctreeIntersect intersect(start, end, pick_transparent, pick_rigged, pick_unselectable, pick_reflection_probe, face_hit, intersection, tex_coord, normal, tangent);
- LLDrawable* drawable = intersect.check(mOctree);
+ LLOctreeIntersect intersect(start, end, pick_transparent, pick_rigged, pick_unselectable, pick_reflection_probe, face_hit, intersection, tex_coord, normal, tangent);
+ LLDrawable* drawable = intersect.check(mOctree);
- return drawable;
+ return drawable;
}
LLDrawable* LLSpatialGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
@@ -3758,7 +3758,7 @@ LLDrawable* LLSpatialGroup::lineSegmentIntersect(const LLVector4a& start, const
LLVector4a* intersection, // return the intersection point
LLVector2* tex_coord, // return the texture coordinates of the intersection point
LLVector4a* normal, // return the surface normal at the intersection point
- LLVector4a* tangent // return the surface tangent at the intersection point
+ LLVector4a* tangent // return the surface tangent at the intersection point
)
{
@@ -3768,32 +3768,32 @@ LLDrawable* LLSpatialGroup::lineSegmentIntersect(const LLVector4a& start, const
return drawable;
}
-LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset,
- LLViewerTexture* texture, LLVertexBuffer* buffer,
- bool fullbright, U8 bump)
-: mVertexBuffer(buffer),
- mTexture(texture),
- mStart(start),
- mEnd(end),
- mCount(count),
- mOffset(offset),
- mFullbright(fullbright),
- mBump(bump),
- mBlendFuncSrc(LLRender::BF_SOURCE_ALPHA),
- mBlendFuncDst(LLRender::BF_ONE_MINUS_SOURCE_ALPHA),
- mHasGlow(false),
- mEnvIntensity(0.0f),
- mAlphaMaskCutoff(0.5f)
-{
- mVertexBuffer->validateRange(mStart, mEnd, mCount, mOffset);
+LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset,
+ LLViewerTexture* texture, LLVertexBuffer* buffer,
+ bool fullbright, U8 bump)
+: mVertexBuffer(buffer),
+ mTexture(texture),
+ mStart(start),
+ mEnd(end),
+ mCount(count),
+ mOffset(offset),
+ mFullbright(fullbright),
+ mBump(bump),
+ mBlendFuncSrc(LLRender::BF_SOURCE_ALPHA),
+ mBlendFuncDst(LLRender::BF_ONE_MINUS_SOURCE_ALPHA),
+ mHasGlow(false),
+ mEnvIntensity(0.0f),
+ mAlphaMaskCutoff(0.5f)
+{
+ mVertexBuffer->validateRange(mStart, mEnd, mCount, mOffset);
}
-LLDrawInfo::~LLDrawInfo()
+LLDrawInfo::~LLDrawInfo()
{
- if (gDebugGL)
- {
- gPipeline.checkReferences(this);
- }
+ if (gDebugGL)
+ {
+ gPipeline.checkReferences(this);
+ }
}
LLColor4U LLDrawInfo::getDebugColor() const
@@ -3806,13 +3806,13 @@ LLColor4U LLDrawInfo::getDebugColor() const
*((U32*) color.mV) = hash.getCRC();
color.mV[3] = 200;
-
+
return color;
}
void LLDrawInfo::validate()
{
- mVertexBuffer->validateRange(mStart, mEnd, mCount, mOffset);
+ mVertexBuffer->validateRange(mStart, mEnd, mCount, mOffset);
}
U64 LLDrawInfo::getSkinHash()
@@ -3820,110 +3820,110 @@ U64 LLDrawInfo::getSkinHash()
return mSkinInfo ? mSkinInfo->mHash : 0;
}
-LLCullResult::LLCullResult()
+LLCullResult::LLCullResult()
{
- mVisibleGroupsAllocated = 0;
- mAlphaGroupsAllocated = 0;
+ mVisibleGroupsAllocated = 0;
+ mAlphaGroupsAllocated = 0;
mRiggedAlphaGroupsAllocated = 0;
- mOcclusionGroupsAllocated = 0;
- mDrawableGroupsAllocated = 0;
- mVisibleListAllocated = 0;
- mVisibleBridgeAllocated = 0;
-
- mVisibleGroups.clear();
- mVisibleGroups.push_back(NULL);
- mVisibleGroupsEnd = &mVisibleGroups[0];
- mAlphaGroups.clear();
- mAlphaGroups.push_back(NULL);
- mAlphaGroupsEnd = &mAlphaGroups[0];
+ mOcclusionGroupsAllocated = 0;
+ mDrawableGroupsAllocated = 0;
+ mVisibleListAllocated = 0;
+ mVisibleBridgeAllocated = 0;
+
+ mVisibleGroups.clear();
+ mVisibleGroups.push_back(NULL);
+ mVisibleGroupsEnd = &mVisibleGroups[0];
+ mAlphaGroups.clear();
+ mAlphaGroups.push_back(NULL);
+ mAlphaGroupsEnd = &mAlphaGroups[0];
mRiggedAlphaGroups.clear();
mRiggedAlphaGroups.push_back(NULL);
mRiggedAlphaGroupsEnd = &mRiggedAlphaGroups[0];
- mOcclusionGroups.clear();
- mOcclusionGroups.push_back(NULL);
- mOcclusionGroupsEnd = &mOcclusionGroups[0];
- mDrawableGroups.clear();
- mDrawableGroups.push_back(NULL);
- mDrawableGroupsEnd = &mDrawableGroups[0];
- mVisibleList.clear();
- mVisibleList.push_back(NULL);
- mVisibleListEnd = &mVisibleList[0];
- mVisibleBridge.clear();
- mVisibleBridge.push_back(NULL);
- mVisibleBridgeEnd = &mVisibleBridge[0];
-
- for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
- {
- mRenderMap[i].clear();
- mRenderMap[i].push_back(NULL);
- mRenderMapEnd[i] = &mRenderMap[i][0];
- mRenderMapAllocated[i] = 0;
- }
-
- clear();
+ mOcclusionGroups.clear();
+ mOcclusionGroups.push_back(NULL);
+ mOcclusionGroupsEnd = &mOcclusionGroups[0];
+ mDrawableGroups.clear();
+ mDrawableGroups.push_back(NULL);
+ mDrawableGroupsEnd = &mDrawableGroups[0];
+ mVisibleList.clear();
+ mVisibleList.push_back(NULL);
+ mVisibleListEnd = &mVisibleList[0];
+ mVisibleBridge.clear();
+ mVisibleBridge.push_back(NULL);
+ mVisibleBridgeEnd = &mVisibleBridge[0];
+
+ for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
+ {
+ mRenderMap[i].clear();
+ mRenderMap[i].push_back(NULL);
+ mRenderMapEnd[i] = &mRenderMap[i][0];
+ mRenderMapAllocated[i] = 0;
+ }
+
+ clear();
}
-template <class T, class V>
+template <class T, class V>
void LLCullResult::pushBack(T& head, U32& count, V* val)
{
- head[count] = val;
- head.push_back(NULL);
- count++;
+ head[count] = val;
+ head.push_back(NULL);
+ count++;
}
void LLCullResult::clear()
{
- mVisibleGroupsSize = 0;
- mVisibleGroupsEnd = &mVisibleGroups[0];
+ mVisibleGroupsSize = 0;
+ mVisibleGroupsEnd = &mVisibleGroups[0];
- mAlphaGroupsSize = 0;
- mAlphaGroupsEnd = &mAlphaGroups[0];
+ mAlphaGroupsSize = 0;
+ mAlphaGroupsEnd = &mAlphaGroups[0];
mRiggedAlphaGroupsSize = 0;
mRiggedAlphaGroupsEnd = &mRiggedAlphaGroups[0];
- mOcclusionGroupsSize = 0;
- mOcclusionGroupsEnd = &mOcclusionGroups[0];
+ mOcclusionGroupsSize = 0;
+ mOcclusionGroupsEnd = &mOcclusionGroups[0];
- mDrawableGroupsSize = 0;
- mDrawableGroupsEnd = &mDrawableGroups[0];
+ mDrawableGroupsSize = 0;
+ mDrawableGroupsEnd = &mDrawableGroups[0];
- mVisibleListSize = 0;
- mVisibleListEnd = &mVisibleList[0];
+ mVisibleListSize = 0;
+ mVisibleListEnd = &mVisibleList[0];
- mVisibleBridgeSize = 0;
- mVisibleBridgeEnd = &mVisibleBridge[0];
+ mVisibleBridgeSize = 0;
+ mVisibleBridgeEnd = &mVisibleBridge[0];
- for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
- {
- for (U32 j = 0; j < mRenderMapSize[i]; j++)
- {
- mRenderMap[i][j] = 0;
- }
- mRenderMapSize[i] = 0;
- mRenderMapEnd[i] = &(mRenderMap[i][0]);
- }
+ for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
+ {
+ for (U32 j = 0; j < mRenderMapSize[i]; j++)
+ {
+ mRenderMap[i][j] = 0;
+ }
+ mRenderMapSize[i] = 0;
+ mRenderMapEnd[i] = &(mRenderMap[i][0]);
+ }
}
LLCullResult::sg_iterator LLCullResult::beginVisibleGroups()
{
- return &mVisibleGroups[0];
+ return &mVisibleGroups[0];
}
LLCullResult::sg_iterator LLCullResult::endVisibleGroups()
{
- return mVisibleGroupsEnd;
+ return mVisibleGroupsEnd;
}
LLCullResult::sg_iterator LLCullResult::beginAlphaGroups()
{
- return &mAlphaGroups[0];
+ return &mAlphaGroups[0];
}
LLCullResult::sg_iterator LLCullResult::endAlphaGroups()
{
- return mAlphaGroupsEnd;
+ return mAlphaGroupsEnd;
}
LLCullResult::sg_iterator LLCullResult::beginRiggedAlphaGroups()
@@ -3938,80 +3938,80 @@ LLCullResult::sg_iterator LLCullResult::endRiggedAlphaGroups()
LLCullResult::sg_iterator LLCullResult::beginOcclusionGroups()
{
- return &mOcclusionGroups[0];
+ return &mOcclusionGroups[0];
}
LLCullResult::sg_iterator LLCullResult::endOcclusionGroups()
{
- return mOcclusionGroupsEnd;
+ return mOcclusionGroupsEnd;
}
LLCullResult::sg_iterator LLCullResult::beginDrawableGroups()
{
- return &mDrawableGroups[0];
+ return &mDrawableGroups[0];
}
LLCullResult::sg_iterator LLCullResult::endDrawableGroups()
{
- return mDrawableGroupsEnd;
+ return mDrawableGroupsEnd;
}
LLCullResult::drawable_iterator LLCullResult::beginVisibleList()
{
- return &mVisibleList[0];
+ return &mVisibleList[0];
}
LLCullResult::drawable_iterator LLCullResult::endVisibleList()
{
- return mVisibleListEnd;
+ return mVisibleListEnd;
}
LLCullResult::bridge_iterator LLCullResult::beginVisibleBridge()
{
- return &mVisibleBridge[0];
+ return &mVisibleBridge[0];
}
LLCullResult::bridge_iterator LLCullResult::endVisibleBridge()
{
- return mVisibleBridgeEnd;
+ return mVisibleBridgeEnd;
}
LLCullResult::drawinfo_iterator LLCullResult::beginRenderMap(U32 type)
{
- return &mRenderMap[type][0];
+ return &mRenderMap[type][0];
}
LLCullResult::drawinfo_iterator LLCullResult::endRenderMap(U32 type)
{
- return mRenderMapEnd[type];
+ return mRenderMapEnd[type];
}
void LLCullResult::pushVisibleGroup(LLSpatialGroup* group)
{
- if (mVisibleGroupsSize < mVisibleGroupsAllocated)
- {
- mVisibleGroups[mVisibleGroupsSize] = group;
- }
- else
- {
- pushBack(mVisibleGroups, mVisibleGroupsAllocated, group);
- }
- ++mVisibleGroupsSize;
- mVisibleGroupsEnd = &mVisibleGroups[mVisibleGroupsSize];
+ if (mVisibleGroupsSize < mVisibleGroupsAllocated)
+ {
+ mVisibleGroups[mVisibleGroupsSize] = group;
+ }
+ else
+ {
+ pushBack(mVisibleGroups, mVisibleGroupsAllocated, group);
+ }
+ ++mVisibleGroupsSize;
+ mVisibleGroupsEnd = &mVisibleGroups[mVisibleGroupsSize];
}
void LLCullResult::pushAlphaGroup(LLSpatialGroup* group)
{
- if (mAlphaGroupsSize < mAlphaGroupsAllocated)
- {
- mAlphaGroups[mAlphaGroupsSize] = group;
- }
- else
- {
- pushBack(mAlphaGroups, mAlphaGroupsAllocated, group);
- }
- ++mAlphaGroupsSize;
- mAlphaGroupsEnd = &mAlphaGroups[mAlphaGroupsSize];
+ if (mAlphaGroupsSize < mAlphaGroupsAllocated)
+ {
+ mAlphaGroups[mAlphaGroupsSize] = group;
+ }
+ else
+ {
+ pushBack(mAlphaGroups, mAlphaGroupsAllocated, group);
+ }
+ ++mAlphaGroupsSize;
+ mAlphaGroupsEnd = &mAlphaGroups[mAlphaGroupsSize];
}
void LLCullResult::pushRiggedAlphaGroup(LLSpatialGroup* group)
@@ -4030,16 +4030,16 @@ void LLCullResult::pushRiggedAlphaGroup(LLSpatialGroup* group)
void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group)
{
- if (mOcclusionGroupsSize < mOcclusionGroupsAllocated)
- {
- mOcclusionGroups[mOcclusionGroupsSize] = group;
- }
- else
- {
- pushBack(mOcclusionGroups, mOcclusionGroupsAllocated, group);
- }
- ++mOcclusionGroupsSize;
- mOcclusionGroupsEnd = &mOcclusionGroups[mOcclusionGroupsSize];
+ if (mOcclusionGroupsSize < mOcclusionGroupsAllocated)
+ {
+ mOcclusionGroups[mOcclusionGroupsSize] = group;
+ }
+ else
+ {
+ pushBack(mOcclusionGroups, mOcclusionGroupsAllocated, group);
+ }
+ ++mOcclusionGroupsSize;
+ mOcclusionGroupsEnd = &mOcclusionGroups[mOcclusionGroupsSize];
}
void LLCullResult::pushDrawableGroup(LLSpatialGroup* group)
@@ -4048,16 +4048,16 @@ void LLCullResult::pushDrawableGroup(LLSpatialGroup* group)
// group must NOT be in the drawble groups list already
llassert(std::find(&mDrawableGroups[0], mDrawableGroupsEnd, group) == mDrawableGroupsEnd);
#endif
- if (mDrawableGroupsSize < mDrawableGroupsAllocated)
- {
- mDrawableGroups[mDrawableGroupsSize] = group;
- }
- else
- {
- pushBack(mDrawableGroups, mDrawableGroupsAllocated, group);
- }
- ++mDrawableGroupsSize;
- mDrawableGroupsEnd = &mDrawableGroups[mDrawableGroupsSize];
+ if (mDrawableGroupsSize < mDrawableGroupsAllocated)
+ {
+ mDrawableGroups[mDrawableGroupsSize] = group;
+ }
+ else
+ {
+ pushBack(mDrawableGroups, mDrawableGroupsAllocated, group);
+ }
+ ++mDrawableGroupsSize;
+ mDrawableGroupsEnd = &mDrawableGroups[mDrawableGroupsSize];
}
void LLCullResult::pushDrawable(LLDrawable* drawable)
@@ -4066,56 +4066,56 @@ void LLCullResult::pushDrawable(LLDrawable* drawable)
// drawable must NOT be in the visible list already
llassert(std::find(&mVisibleList[0], mVisibleListEnd, drawable) == mVisibleListEnd);
#endif
- if (mVisibleListSize < mVisibleListAllocated)
- {
- mVisibleList[mVisibleListSize] = drawable;
- }
- else
- {
- pushBack(mVisibleList, mVisibleListAllocated, drawable);
- }
- ++mVisibleListSize;
- mVisibleListEnd = &mVisibleList[mVisibleListSize];
+ if (mVisibleListSize < mVisibleListAllocated)
+ {
+ mVisibleList[mVisibleListSize] = drawable;
+ }
+ else
+ {
+ pushBack(mVisibleList, mVisibleListAllocated, drawable);
+ }
+ ++mVisibleListSize;
+ mVisibleListEnd = &mVisibleList[mVisibleListSize];
}
void LLCullResult::pushBridge(LLSpatialBridge* bridge)
{
- if (mVisibleBridgeSize < mVisibleBridgeAllocated)
- {
- mVisibleBridge[mVisibleBridgeSize] = bridge;
- }
- else
- {
- pushBack(mVisibleBridge, mVisibleBridgeAllocated, bridge);
- }
- ++mVisibleBridgeSize;
- mVisibleBridgeEnd = &mVisibleBridge[mVisibleBridgeSize];
+ if (mVisibleBridgeSize < mVisibleBridgeAllocated)
+ {
+ mVisibleBridge[mVisibleBridgeSize] = bridge;
+ }
+ else
+ {
+ pushBack(mVisibleBridge, mVisibleBridgeAllocated, bridge);
+ }
+ ++mVisibleBridgeSize;
+ mVisibleBridgeEnd = &mVisibleBridge[mVisibleBridgeSize];
}
void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info)
{
- if (mRenderMapSize[type] < mRenderMapAllocated[type])
- {
- mRenderMap[type][mRenderMapSize[type]] = draw_info;
- }
- else
- {
- pushBack(mRenderMap[type], mRenderMapAllocated[type], draw_info);
- }
- ++mRenderMapSize[type];
- mRenderMapEnd[type] = &(mRenderMap[type][mRenderMapSize[type]]);
+ if (mRenderMapSize[type] < mRenderMapAllocated[type])
+ {
+ mRenderMap[type][mRenderMapSize[type]] = draw_info;
+ }
+ else
+ {
+ pushBack(mRenderMap[type], mRenderMapAllocated[type], draw_info);
+ }
+ ++mRenderMapSize[type];
+ mRenderMapEnd[type] = &(mRenderMap[type][mRenderMapSize[type]]);
}
void LLCullResult::assertDrawMapsEmpty()
{
- for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
- {
- if (mRenderMapSize[i] != 0)
- {
- LL_ERRS() << "Stale LLDrawInfo's in LLCullResult!"
- << " (mRenderMapSize[" << i << "] = " << mRenderMapSize[i] << ")" << LL_ENDL;
- }
- }
+ for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
+ {
+ if (mRenderMapSize[i] != 0)
+ {
+ LL_ERRS() << "Stale LLDrawInfo's in LLCullResult!"
+ << " (mRenderMapSize[" << i << "] = " << mRenderMapSize[i] << ")" << LL_ENDL;
+ }
+ }
}
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 758e716c00..a78997cef0 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llspatialpartition.h
* @brief LLSpatialGroup header file including definitions for supporting functions
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -68,40 +68,40 @@ class LLDrawInfo final : public LLRefCount
{
LL_ALIGN_NEW;
protected:
- ~LLDrawInfo();
-
+ ~LLDrawInfo();
+
public:
- LLDrawInfo(const LLDrawInfo& rhs)
- {
- *this = rhs;
- }
-
- const LLDrawInfo& operator=(const LLDrawInfo& rhs)
- {
- LL_ERRS() << "Illegal operation!" << LL_ENDL;
- return *this;
- }
-
+ LLDrawInfo(const LLDrawInfo& rhs)
+ {
+ *this = rhs;
+ }
+
+ const LLDrawInfo& operator=(const LLDrawInfo& rhs)
+ {
+ LL_ERRS() << "Illegal operation!" << LL_ENDL;
+ return *this;
+ }
+
// return a hash of this LLDrawInfo as a debug color
LLColor4U getDebugColor() const;
- LLDrawInfo(U16 start, U16 end, U32 count, U32 offset,
- LLViewerTexture* image, LLVertexBuffer* buffer,
- bool fullbright = false, U8 bump = 0);
-
+ LLDrawInfo(U16 start, U16 end, U32 count, U32 offset,
+ LLViewerTexture* image, LLVertexBuffer* buffer,
+ bool fullbright = false, U8 bump = 0);
+
- void validate();
+ void validate();
// return mSkinHash->mHash, or 0 if mSkinHash is null
U64 getSkinHash();
- LLPointer<LLVertexBuffer> mVertexBuffer;
+ LLPointer<LLVertexBuffer> mVertexBuffer;
U16 mStart = 0;
U16 mEnd = 0;
U32 mCount = 0;
U32 mOffset = 0;
- LLPointer<LLViewerTexture> mTexture;
+ LLPointer<LLViewerTexture> mTexture;
LLPointer<LLViewerTexture> mSpecularMap;
LLPointer<LLViewerTexture> mNormalMap;
@@ -121,136 +121,136 @@ public:
LLVector4 mSpecColor = LLVector4(1.f, 1.f, 1.f, 0.5f); // XYZ = Specular RGB, W = Specular Exponent
- std::vector<LLPointer<LLViewerTexture> > mTextureList;
+ std::vector<LLPointer<LLViewerTexture> > mTextureList;
LLUUID mMaterialID; // id of LLGLTFMaterial or LLMaterial applied to this draw info
U32 mShaderMask = 0;
F32 mEnvIntensity = 0.f;
- F32 mAlphaMaskCutoff = 0.5f;
+ F32 mAlphaMaskCutoff = 0.5f;
LLRender::eBlendFactor mBlendFuncSrc = LLRender::BF_SOURCE_ALPHA;
LLRender::eBlendFactor mBlendFuncDst = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
- U8 mDiffuseAlphaMode = 0;
+ U8 mDiffuseAlphaMode = 0;
U8 mBump = 0;
U8 mShiny = 0;
bool mFullbright = false;
bool mHasGlow = false;
- struct CompareTexture
- {
- bool operator()(const LLDrawInfo& lhs, const LLDrawInfo& rhs)
- {
- return lhs.mTexture > rhs.mTexture;
- }
- };
-
- struct CompareTexturePtr
- { //sort by texture
- bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
- {
- // sort by pointer, sort NULL down to the end
- return lhs.get() != rhs.get()
- && (lhs.isNull() || (rhs.notNull() && lhs->mTexture.get() > rhs->mTexture.get()));
- }
- };
-
- struct CompareVertexBuffer
- { //sort by texture
- bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
- {
- // sort by pointer, sort NULL down to the end
- return lhs.get() != rhs.get()
- && (lhs.isNull() || (rhs.notNull() && lhs->mVertexBuffer.get() > rhs->mVertexBuffer.get()));
- }
- };
-
- struct CompareTexturePtrMatrix
- {
- bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
- {
- return lhs.get() != rhs.get()
- && (lhs.isNull() || (rhs.notNull() && (lhs->mTexture.get() > rhs->mTexture.get() ||
- (lhs->mTexture.get() == rhs->mTexture.get() && lhs->mModelMatrix > rhs->mModelMatrix))));
- }
-
- };
-
- struct CompareMatrixTexturePtr
- {
- bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
- {
- return lhs.get() != rhs.get()
- && (lhs.isNull() || (rhs.notNull() && (lhs->mModelMatrix > rhs->mModelMatrix ||
- (lhs->mModelMatrix == rhs->mModelMatrix && lhs->mTexture.get() > rhs->mTexture.get()))));
- }
-
- };
-
- struct CompareBump
- {
- bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
- {
- // sort by mBump value, sort NULL down to the end
- return lhs.get() != rhs.get()
- && (lhs.isNull() || (rhs.notNull() && lhs->mBump > rhs->mBump));
- }
- };
+ struct CompareTexture
+ {
+ bool operator()(const LLDrawInfo& lhs, const LLDrawInfo& rhs)
+ {
+ return lhs.mTexture > rhs.mTexture;
+ }
+ };
+
+ struct CompareTexturePtr
+ { //sort by texture
+ bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
+ {
+ // sort by pointer, sort NULL down to the end
+ return lhs.get() != rhs.get()
+ && (lhs.isNull() || (rhs.notNull() && lhs->mTexture.get() > rhs->mTexture.get()));
+ }
+ };
+
+ struct CompareVertexBuffer
+ { //sort by texture
+ bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
+ {
+ // sort by pointer, sort NULL down to the end
+ return lhs.get() != rhs.get()
+ && (lhs.isNull() || (rhs.notNull() && lhs->mVertexBuffer.get() > rhs->mVertexBuffer.get()));
+ }
+ };
+
+ struct CompareTexturePtrMatrix
+ {
+ bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
+ {
+ return lhs.get() != rhs.get()
+ && (lhs.isNull() || (rhs.notNull() && (lhs->mTexture.get() > rhs->mTexture.get() ||
+ (lhs->mTexture.get() == rhs->mTexture.get() && lhs->mModelMatrix > rhs->mModelMatrix))));
+ }
+
+ };
+
+ struct CompareMatrixTexturePtr
+ {
+ bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
+ {
+ return lhs.get() != rhs.get()
+ && (lhs.isNull() || (rhs.notNull() && (lhs->mModelMatrix > rhs->mModelMatrix ||
+ (lhs->mModelMatrix == rhs->mModelMatrix && lhs->mTexture.get() > rhs->mTexture.get()))));
+ }
+
+ };
+
+ struct CompareBump
+ {
+ bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
+ {
+ // sort by mBump value, sort NULL down to the end
+ return lhs.get() != rhs.get()
+ && (lhs.isNull() || (rhs.notNull() && lhs->mBump > rhs->mBump));
+ }
+ };
};
LL_ALIGN_PREFIX(16)
class LLSpatialGroup : public LLOcclusionCullingGroup
{
- using super = LLOcclusionCullingGroup;
- friend class LLSpatialPartition;
- friend class LLOctreeStateCheck;
+ using super = LLOcclusionCullingGroup;
+ friend class LLSpatialPartition;
+ friend class LLOctreeStateCheck;
public:
- LLSpatialGroup(const LLSpatialGroup& rhs) : LLOcclusionCullingGroup(rhs)
- {
- *this = rhs;
- }
-
- const LLSpatialGroup& operator=(const LLSpatialGroup& rhs)
- {
- LL_ERRS() << "Illegal operation!" << LL_ENDL;
- return *this;
- }
-
- static U32 sNodeCount;
- static bool sNoDelete; //deletion of spatial groups and draw info not allowed if TRUE
-
- typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t;
- typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t;
- typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t;
- typedef std::unordered_map<U32, drawmap_elem_t > draw_map_t;
- typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t;
- typedef std::unordered_map<LLFace*, buffer_list_t> buffer_texture_map_t;
- typedef std::unordered_map<U32, buffer_texture_map_t> buffer_map_t;
-
- struct CompareDistanceGreater
- {
- bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs)
- {
- return lhs->mDistance > rhs->mDistance;
- }
- };
-
- struct CompareUpdateUrgency
- {
- bool operator()(const LLPointer<LLSpatialGroup> lhs, const LLPointer<LLSpatialGroup> rhs)
- {
- return lhs->getUpdateUrgency() > rhs->getUpdateUrgency();
- }
- };
-
- struct CompareDepthGreater
- {
- bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs)
- {
- return lhs->mDepth > rhs->mDepth;
- }
- };
+ LLSpatialGroup(const LLSpatialGroup& rhs) : LLOcclusionCullingGroup(rhs)
+ {
+ *this = rhs;
+ }
+
+ const LLSpatialGroup& operator=(const LLSpatialGroup& rhs)
+ {
+ LL_ERRS() << "Illegal operation!" << LL_ENDL;
+ return *this;
+ }
+
+ static U32 sNodeCount;
+ static bool sNoDelete; //deletion of spatial groups and draw info not allowed if TRUE
+
+ typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t;
+ typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t;
+ typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t;
+ typedef std::unordered_map<U32, drawmap_elem_t > draw_map_t;
+ typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t;
+ typedef std::unordered_map<LLFace*, buffer_list_t> buffer_texture_map_t;
+ typedef std::unordered_map<U32, buffer_texture_map_t> buffer_map_t;
+
+ struct CompareDistanceGreater
+ {
+ bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs)
+ {
+ return lhs->mDistance > rhs->mDistance;
+ }
+ };
+
+ struct CompareUpdateUrgency
+ {
+ bool operator()(const LLPointer<LLSpatialGroup> lhs, const LLPointer<LLSpatialGroup> rhs)
+ {
+ return lhs->getUpdateUrgency() > rhs->getUpdateUrgency();
+ }
+ };
+
+ struct CompareDepthGreater
+ {
+ bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs)
+ {
+ return lhs->mDepth > rhs->mDepth;
+ }
+ };
struct CompareRenderOrder
{
@@ -265,53 +265,53 @@ public:
}
};
- typedef enum
- {
- GEOM_DIRTY = LLViewerOctreeGroup::INVALID_STATE,
- ALPHA_DIRTY = (GEOM_DIRTY << 1),
- IN_IMAGE_QUEUE = (ALPHA_DIRTY << 1),
- IMAGE_DIRTY = (IN_IMAGE_QUEUE << 1),
- MESH_DIRTY = (IMAGE_DIRTY << 1),
- NEW_DRAWINFO = (MESH_DIRTY << 1),
- IN_BUILD_Q1 = (NEW_DRAWINFO << 1),
- IN_BUILD_Q2 = (IN_BUILD_Q1 << 1),
- STATE_MASK = 0x0000FFFF,
- } eSpatialState;
-
- LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part);
-
- BOOL isHUDGroup() ;
-
- void clearDrawMap();
- void validate();
- void validateDrawMap();
-
- void setState(U32 state, S32 mode);
- void clearState(U32 state, S32 mode);
- void clearState(U32 state) {mState &= ~state;}
-
- LLSpatialGroup* getParent();
-
- BOOL addObject(LLDrawable *drawablep);
- BOOL removeObject(LLDrawable *drawablep, BOOL from_octree = FALSE);
- BOOL updateInGroup(LLDrawable *drawablep, BOOL immediate = FALSE); // Update position if it's in the group
- void expandExtents(const LLVector4a* addingExtents, const LLXformMatrix& currentTransform);
- void shift(const LLVector4a &offset);
+ typedef enum
+ {
+ GEOM_DIRTY = LLViewerOctreeGroup::INVALID_STATE,
+ ALPHA_DIRTY = (GEOM_DIRTY << 1),
+ IN_IMAGE_QUEUE = (ALPHA_DIRTY << 1),
+ IMAGE_DIRTY = (IN_IMAGE_QUEUE << 1),
+ MESH_DIRTY = (IMAGE_DIRTY << 1),
+ NEW_DRAWINFO = (MESH_DIRTY << 1),
+ IN_BUILD_Q1 = (NEW_DRAWINFO << 1),
+ IN_BUILD_Q2 = (IN_BUILD_Q1 << 1),
+ STATE_MASK = 0x0000FFFF,
+ } eSpatialState;
+
+ LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part);
+
+ BOOL isHUDGroup() ;
+
+ void clearDrawMap();
+ void validate();
+ void validateDrawMap();
+
+ void setState(U32 state, S32 mode);
+ void clearState(U32 state, S32 mode);
+ void clearState(U32 state) {mState &= ~state;}
+
+ LLSpatialGroup* getParent();
+
+ BOOL addObject(LLDrawable *drawablep);
+ BOOL removeObject(LLDrawable *drawablep, BOOL from_octree = FALSE);
+ BOOL updateInGroup(LLDrawable *drawablep, BOOL immediate = FALSE); // Update position if it's in the group
+ void expandExtents(const LLVector4a* addingExtents, const LLXformMatrix& currentTransform);
+ void shift(const LLVector4a &offset);
// TODO: this no longer appears to be called, figure out if it's important and if not remove it
- void destroyGLState(bool keep_occlusion = false);
-
- void updateDistance(LLCamera& camera);
- F32 getUpdateUrgency() const;
- BOOL changeLOD();
- void rebuildGeom();
- void rebuildMesh();
+ void destroyGLState(bool keep_occlusion = false);
+
+ void updateDistance(LLCamera& camera);
+ F32 getUpdateUrgency() const;
+ BOOL changeLOD();
+ void rebuildGeom();
+ void rebuildMesh();
- void setState(U32 state) {mState |= state;}
- void dirtyGeom() { setState(GEOM_DIRTY); }
- void dirtyMesh() { setState(MESH_DIRTY); }
+ void setState(U32 state) {mState |= state;}
+ void dirtyGeom() { setState(GEOM_DIRTY); }
+ void dirtyMesh() { setState(MESH_DIRTY); }
- void drawObjectBox(LLColor4 col);
+ void drawObjectBox(LLColor4 col);
LLDrawable* lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
BOOL pick_transparent,
@@ -326,47 +326,47 @@ public:
);
- LLSpatialPartition* getSpatialPartition() {return (LLSpatialPartition*)mSpatialPartition;}
+ LLSpatialPartition* getSpatialPartition() {return (LLSpatialPartition*)mSpatialPartition;}
- //LISTENER FUNCTIONS
- virtual void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* face);
- virtual void handleRemoval(const TreeNode* node, LLViewerOctreeEntry* face);
- virtual void handleDestruction(const TreeNode* node);
- virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
+ //LISTENER FUNCTIONS
+ virtual void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* face);
+ virtual void handleRemoval(const TreeNode* node, LLViewerOctreeEntry* face);
+ virtual void handleDestruction(const TreeNode* node);
+ virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
- // LLViewerOctreeGroup
- virtual void rebound();
+ // LLViewerOctreeGroup
+ virtual void rebound();
public:
- LL_ALIGN_16(LLVector4a mViewAngle);
- LL_ALIGN_16(LLVector4a mLastUpdateViewAngle);
+ LL_ALIGN_16(LLVector4a mViewAngle);
+ LL_ALIGN_16(LLVector4a mLastUpdateViewAngle);
protected:
- virtual ~LLSpatialGroup();
+ virtual ~LLSpatialGroup();
public:
LLPointer<LLVertexBuffer> mVertexBuffer;
draw_map_t mDrawMap;
- bridge_list_t mBridgeList;
- buffer_map_t mBufferMap; //used by volume buffers to attempt to reuse vertex buffers
+ bridge_list_t mBridgeList;
+ buffer_map_t mBufferMap; //used by volume buffers to attempt to reuse vertex buffers
F32 mObjectBoxSize; //cached mObjectBounds[1].getLength3()
- U32 mGeometryBytes; //used by volumes to track how many bytes of geometry data are in this node
- F32 mSurfaceArea; //used by volumes to track estimated surface area of geometry in this node
- F32 mBuilt;
-
- F32 mDistance;
- F32 mDepth;
- F32 mLastUpdateDistance;
- F32 mLastUpdateTime;
-
- F32 mPixelArea;
- F32 mRadius;
+ U32 mGeometryBytes; //used by volumes to track how many bytes of geometry data are in this node
+ F32 mSurfaceArea; //used by volumes to track estimated surface area of geometry in this node
+ F32 mBuilt;
+
+ F32 mDistance;
+ F32 mDepth;
+ F32 mLastUpdateDistance;
+ F32 mLastUpdateTime;
+
+ F32 mPixelArea;
+ F32 mRadius;
//used by LLVOAVatar to set render order in alpha draw pool to preserve legacy render order behavior
LLVOAvatar* mAvatarp = nullptr;
- U32 mRenderOrder = 0;
+ U32 mRenderOrder = 0;
// Reflection Probe associated with this node (if any)
LLPointer<LLReflectionMap> mReflectionProbe = nullptr;
} LL_ALIGN_POSTFIX(16);
@@ -374,72 +374,72 @@ public:
class LLGeometryManager
{
public:
- std::vector<LLFace*> mFaceList;
- virtual ~LLGeometryManager() { }
- virtual void rebuildGeom(LLSpatialGroup* group) = 0;
- virtual void rebuildMesh(LLSpatialGroup* group) = 0;
- virtual void getGeometry(LLSpatialGroup* group) = 0;
- virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count);
+ std::vector<LLFace*> mFaceList;
+ virtual ~LLGeometryManager() { }
+ virtual void rebuildGeom(LLSpatialGroup* group) = 0;
+ virtual void rebuildMesh(LLSpatialGroup* group) = 0;
+ virtual void getGeometry(LLSpatialGroup* group) = 0;
+ virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count);
};
class LLSpatialPartition: public LLViewerOctreePartition, public LLGeometryManager
{
public:
- LLSpatialPartition(U32 data_mask, BOOL render_by_group, LLViewerRegion* regionp);
- virtual ~LLSpatialPartition();
-
- LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE);
- BOOL remove(LLDrawable *drawablep, LLSpatialGroup *curp);
-
- LLDrawable* lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- BOOL pick_transparent,
- BOOL pick_rigged,
+ LLSpatialPartition(U32 data_mask, BOOL render_by_group, LLViewerRegion* regionp);
+ virtual ~LLSpatialPartition();
+
+ LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE);
+ BOOL remove(LLDrawable *drawablep, LLSpatialGroup *curp);
+
+ LLDrawable* lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
BOOL pick_unselectable,
BOOL pick_reflection_probe,
- S32* face_hit, // return the face hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL // return the surface tangent at the intersection point
- );
-
-
- // If the drawable moves, move it here.
- virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate = FALSE);
- virtual void shift(const LLVector4a &offset);
-
- virtual F32 calcDistance(LLSpatialGroup* group, LLCamera& camera);
- virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera);
-
- virtual void rebuildGeom(LLSpatialGroup* group);
- virtual void rebuildMesh(LLSpatialGroup* group);
-
- BOOL visibleObjectsInFrustum(LLCamera& camera);
- /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion=false); // Cull on arbitrary frustum
- S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results, BOOL for_select); // Cull on arbitrary frustum
-
- BOOL isVisible(const LLVector3& v);
- bool isHUDPartition() ;
-
- LLSpatialBridge* asBridge() { return mBridge; }
- BOOL isBridge() { return asBridge() != NULL; }
-
- void renderPhysicsShapes(bool depth_only);
- void renderDebug();
- void renderIntersectingBBoxes(LLCamera* camera);
- void restoreGL();
-
- BOOL getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax);
+ S32* face_hit, // return the face hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL // return the surface tangent at the intersection point
+ );
+
+
+ // If the drawable moves, move it here.
+ virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate = FALSE);
+ virtual void shift(const LLVector4a &offset);
+
+ virtual F32 calcDistance(LLSpatialGroup* group, LLCamera& camera);
+ virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera);
+
+ virtual void rebuildGeom(LLSpatialGroup* group);
+ virtual void rebuildMesh(LLSpatialGroup* group);
+
+ BOOL visibleObjectsInFrustum(LLCamera& camera);
+ /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion=false); // Cull on arbitrary frustum
+ S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results, BOOL for_select); // Cull on arbitrary frustum
+
+ BOOL isVisible(const LLVector3& v);
+ bool isHUDPartition() ;
+
+ LLSpatialBridge* asBridge() { return mBridge; }
+ BOOL isBridge() { return asBridge() != NULL; }
+
+ void renderPhysicsShapes(bool depth_only);
+ void renderDebug();
+ void renderIntersectingBBoxes(LLCamera* camera);
+ void restoreGL();
+
+ BOOL getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax);
public:
- LLSpatialBridge* mBridge; // NULL for non-LLSpatialBridge instances, otherwise, mBridge == this
- // use a pointer instead of making "isBridge" and "asBridge" virtual so it's safe
- // to call asBridge() from the destructor
-
- bool mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane
- const bool mRenderByGroup;
- U32 mVertexDataMask;
- F32 mSlopRatio; //percentage distance must change before drawables receive LOD update (default is 0.25);
+ LLSpatialBridge* mBridge; // NULL for non-LLSpatialBridge instances, otherwise, mBridge == this
+ // use a pointer instead of making "isBridge" and "asBridge" virtual so it's safe
+ // to call asBridge() from the destructor
+
+ bool mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane
+ const bool mRenderByGroup;
+ U32 mVertexDataMask;
+ F32 mSlopRatio; //percentage distance must change before drawables receive LOD update (default is 0.25);
bool mDepthMask; //if TRUE, objects in this partition will be written to depth during alpha rendering
};
@@ -447,49 +447,49 @@ public:
class LLSpatialBridge : public LLDrawable, public LLSpatialPartition
{
protected:
- ~LLSpatialBridge();
+ ~LLSpatialBridge();
public:
- typedef std::vector<LLPointer<LLSpatialBridge> > bridge_vector_t;
-
- LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp);
-
- void destroyTree();
-
- virtual BOOL isSpatialBridge() const { return TRUE; }
- virtual void updateSpatialExtents();
- virtual void updateBinRadius();
- virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE);
- virtual void updateDistance(LLCamera& camera_in, bool force_update);
- virtual void makeActive();
- virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate = FALSE);
- virtual BOOL updateMove();
- virtual void shiftPos(const LLVector4a& vec);
- virtual void cleanupReferences();
- virtual LLSpatialPartition* asPartition() { return this; }
-
+ typedef std::vector<LLPointer<LLSpatialBridge> > bridge_vector_t;
+
+ LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp);
+
+ void destroyTree();
+
+ virtual BOOL isSpatialBridge() const { return TRUE; }
+ virtual void updateSpatialExtents();
+ virtual void updateBinRadius();
+ virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE);
+ virtual void updateDistance(LLCamera& camera_in, bool force_update);
+ virtual void makeActive();
+ virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate = FALSE);
+ virtual BOOL updateMove();
+ virtual void shiftPos(const LLVector4a& vec);
+ virtual void cleanupReferences();
+ virtual LLSpatialPartition* asPartition() { return this; }
+
//transform agent space camera into this Spatial Bridge's coordinate frame
- virtual LLCamera transformCamera(LLCamera& camera);
+ virtual LLCamera transformCamera(LLCamera& camera);
//transform agent space bounding box into this Spatial Bridge's coordinate frame
void transformExtents(const LLVector4a* src, LLVector4a* dst);
- LLDrawable* mDrawable;
+ LLDrawable* mDrawable;
};
-class LLCullResult
+class LLCullResult
{
public:
- LLCullResult();
+ LLCullResult();
- typedef std::vector<LLSpatialGroup*> sg_list_t;
- typedef std::vector<LLDrawable*> drawable_list_t;
- typedef std::vector<LLSpatialBridge*> bridge_list_t;
- typedef std::vector<LLDrawInfo*> drawinfo_list_t;
+ typedef std::vector<LLSpatialGroup*> sg_list_t;
+ typedef std::vector<LLDrawable*> drawable_list_t;
+ typedef std::vector<LLSpatialBridge*> bridge_list_t;
+ typedef std::vector<LLDrawInfo*> drawinfo_list_t;
- typedef LLSpatialGroup** sg_iterator;
- typedef LLSpatialBridge** bridge_iterator;
- typedef LLDrawInfo** drawinfo_iterator;
- typedef LLDrawable** drawable_iterator;
+ typedef LLSpatialGroup** sg_iterator;
+ typedef LLSpatialBridge** bridge_iterator;
+ typedef LLDrawInfo** drawinfo_iterator;
+ typedef LLDrawable** drawable_iterator;
// Helper function for taking advantage of _mm_prefetch when iterating over cull results
static inline void increment_iterator(LLCullResult::drawinfo_iterator& i, const LLCullResult::drawinfo_iterator& end)
@@ -508,91 +508,91 @@ public:
}
}
- void clear();
-
- sg_iterator beginVisibleGroups();
- sg_iterator endVisibleGroups();
+ void clear();
- sg_iterator beginAlphaGroups();
- sg_iterator endAlphaGroups();
+ sg_iterator beginVisibleGroups();
+ sg_iterator endVisibleGroups();
+
+ sg_iterator beginAlphaGroups();
+ sg_iterator endAlphaGroups();
sg_iterator beginRiggedAlphaGroups();
sg_iterator endRiggedAlphaGroups();
- bool hasOcclusionGroups() { return mOcclusionGroupsSize > 0; }
- sg_iterator beginOcclusionGroups();
- sg_iterator endOcclusionGroups();
+ bool hasOcclusionGroups() { return mOcclusionGroupsSize > 0; }
+ sg_iterator beginOcclusionGroups();
+ sg_iterator endOcclusionGroups();
- sg_iterator beginDrawableGroups();
- sg_iterator endDrawableGroups();
+ sg_iterator beginDrawableGroups();
+ sg_iterator endDrawableGroups();
- drawable_iterator beginVisibleList();
- drawable_iterator endVisibleList();
+ drawable_iterator beginVisibleList();
+ drawable_iterator endVisibleList();
- bridge_iterator beginVisibleBridge();
- bridge_iterator endVisibleBridge();
+ bridge_iterator beginVisibleBridge();
+ bridge_iterator endVisibleBridge();
- drawinfo_iterator beginRenderMap(U32 type);
- drawinfo_iterator endRenderMap(U32 type);
+ drawinfo_iterator beginRenderMap(U32 type);
+ drawinfo_iterator endRenderMap(U32 type);
- void pushVisibleGroup(LLSpatialGroup* group);
- void pushAlphaGroup(LLSpatialGroup* group);
+ void pushVisibleGroup(LLSpatialGroup* group);
+ void pushAlphaGroup(LLSpatialGroup* group);
void pushRiggedAlphaGroup(LLSpatialGroup* group);
- void pushOcclusionGroup(LLSpatialGroup* group);
- void pushDrawableGroup(LLSpatialGroup* group);
- void pushDrawable(LLDrawable* drawable);
- void pushBridge(LLSpatialBridge* bridge);
- void pushDrawInfo(U32 type, LLDrawInfo* draw_info);
-
- U32 getVisibleGroupsSize() { return mVisibleGroupsSize; }
- U32 getAlphaGroupsSize() { return mAlphaGroupsSize; }
- U32 getRiggedAlphaGroupsSize() { return mRiggedAlphaGroupsSize; }
- U32 getDrawableGroupsSize() { return mDrawableGroupsSize; }
- U32 getVisibleListSize() { return mVisibleListSize; }
- U32 getVisibleBridgeSize() { return mVisibleBridgeSize; }
- U32 getRenderMapSize(U32 type) { return mRenderMapSize[type]; }
-
- void assertDrawMapsEmpty();
+ void pushOcclusionGroup(LLSpatialGroup* group);
+ void pushDrawableGroup(LLSpatialGroup* group);
+ void pushDrawable(LLDrawable* drawable);
+ void pushBridge(LLSpatialBridge* bridge);
+ void pushDrawInfo(U32 type, LLDrawInfo* draw_info);
+
+ U32 getVisibleGroupsSize() { return mVisibleGroupsSize; }
+ U32 getAlphaGroupsSize() { return mAlphaGroupsSize; }
+ U32 getRiggedAlphaGroupsSize() { return mRiggedAlphaGroupsSize; }
+ U32 getDrawableGroupsSize() { return mDrawableGroupsSize; }
+ U32 getVisibleListSize() { return mVisibleListSize; }
+ U32 getVisibleBridgeSize() { return mVisibleBridgeSize; }
+ U32 getRenderMapSize(U32 type) { return mRenderMapSize[type]; }
+
+ void assertDrawMapsEmpty();
private:
- template <class T, class V> void pushBack(T &head, U32& count, V* val);
+ template <class T, class V> void pushBack(T &head, U32& count, V* val);
- U32 mVisibleGroupsSize;
- U32 mAlphaGroupsSize;
+ U32 mVisibleGroupsSize;
+ U32 mAlphaGroupsSize;
U32 mRiggedAlphaGroupsSize;
- U32 mOcclusionGroupsSize;
- U32 mDrawableGroupsSize;
- U32 mVisibleListSize;
- U32 mVisibleBridgeSize;
+ U32 mOcclusionGroupsSize;
+ U32 mDrawableGroupsSize;
+ U32 mVisibleListSize;
+ U32 mVisibleBridgeSize;
- U32 mVisibleGroupsAllocated;
- U32 mAlphaGroupsAllocated;
+ U32 mVisibleGroupsAllocated;
+ U32 mAlphaGroupsAllocated;
U32 mRiggedAlphaGroupsAllocated;
- U32 mOcclusionGroupsAllocated;
- U32 mDrawableGroupsAllocated;
- U32 mVisibleListAllocated;
- U32 mVisibleBridgeAllocated;
+ U32 mOcclusionGroupsAllocated;
+ U32 mDrawableGroupsAllocated;
+ U32 mVisibleListAllocated;
+ U32 mVisibleBridgeAllocated;
- U32 mRenderMapSize[LLRenderPass::NUM_RENDER_TYPES];
+ U32 mRenderMapSize[LLRenderPass::NUM_RENDER_TYPES];
- sg_list_t mVisibleGroups;
- sg_iterator mVisibleGroupsEnd;
- sg_list_t mAlphaGroups;
- sg_iterator mAlphaGroupsEnd;
+ sg_list_t mVisibleGroups;
+ sg_iterator mVisibleGroupsEnd;
+ sg_list_t mAlphaGroups;
+ sg_iterator mAlphaGroupsEnd;
sg_list_t mRiggedAlphaGroups;
sg_iterator mRiggedAlphaGroupsEnd;
- sg_list_t mOcclusionGroups;
- sg_iterator mOcclusionGroupsEnd;
- sg_list_t mDrawableGroups;
- sg_iterator mDrawableGroupsEnd;
- drawable_list_t mVisibleList;
- drawable_iterator mVisibleListEnd;
- bridge_list_t mVisibleBridge;
- bridge_iterator mVisibleBridgeEnd;
- drawinfo_list_t mRenderMap[LLRenderPass::NUM_RENDER_TYPES];
- U32 mRenderMapAllocated[LLRenderPass::NUM_RENDER_TYPES];
- drawinfo_iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES];
+ sg_list_t mOcclusionGroups;
+ sg_iterator mOcclusionGroupsEnd;
+ sg_list_t mDrawableGroups;
+ sg_iterator mDrawableGroupsEnd;
+ drawable_list_t mVisibleList;
+ drawable_iterator mVisibleListEnd;
+ bridge_list_t mVisibleBridge;
+ bridge_iterator mVisibleBridgeEnd;
+ drawinfo_list_t mRenderMap[LLRenderPass::NUM_RENDER_TYPES];
+ U32 mRenderMapAllocated[LLRenderPass::NUM_RENDER_TYPES];
+ drawinfo_iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES];
};
@@ -601,33 +601,33 @@ private:
class LLWaterPartition : public LLSpatialPartition
{
public:
- LLWaterPartition(LLViewerRegion* regionp);
- virtual void getGeometry(LLSpatialGroup* group) { }
- virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { }
+ LLWaterPartition(LLViewerRegion* regionp);
+ virtual void getGeometry(LLSpatialGroup* group) { }
+ virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { }
};
//spatial partition for hole and edge water (implemented in LLVOWater.cpp)
class LLVoidWaterPartition : public LLWaterPartition
{
public:
- LLVoidWaterPartition(LLViewerRegion* regionp);
+ LLVoidWaterPartition(LLViewerRegion* regionp);
};
//spatial partition for terrain (impelmented in LLVOSurfacePatch.cpp)
class LLTerrainPartition : public LLSpatialPartition
{
public:
- LLTerrainPartition(LLViewerRegion* regionp);
- virtual void getGeometry(LLSpatialGroup* group);
+ LLTerrainPartition(LLViewerRegion* regionp);
+ virtual void getGeometry(LLSpatialGroup* group);
};
//spatial partition for trees
class LLTreePartition : public LLSpatialPartition
{
public:
- LLTreePartition(LLViewerRegion* regionp);
- virtual void getGeometry(LLSpatialGroup* group) { }
- virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { }
+ LLTreePartition(LLViewerRegion* regionp);
+ virtual void getGeometry(LLSpatialGroup* group) { }
+ virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { }
};
@@ -635,137 +635,137 @@ public:
class LLParticlePartition : public LLSpatialPartition
{
public:
- LLParticlePartition(LLViewerRegion* regionp);
- virtual void rebuildGeom(LLSpatialGroup* group);
- virtual void getGeometry(LLSpatialGroup* group);
- virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count);
- virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera);
+ LLParticlePartition(LLViewerRegion* regionp);
+ virtual void rebuildGeom(LLSpatialGroup* group);
+ virtual void getGeometry(LLSpatialGroup* group);
+ virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count);
+ virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera);
protected:
- U32 mRenderPass;
+ U32 mRenderPass;
};
class LLHUDParticlePartition : public LLParticlePartition
{
public:
- LLHUDParticlePartition(LLViewerRegion* regionp);
+ LLHUDParticlePartition(LLViewerRegion* regionp);
};
//spatial partition for grass (implemented in LLVOGrass.cpp)
class LLGrassPartition : public LLSpatialPartition
{
public:
- LLGrassPartition(LLViewerRegion* regionp);
- virtual void getGeometry(LLSpatialGroup* group);
- virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count);
+ LLGrassPartition(LLViewerRegion* regionp);
+ virtual void getGeometry(LLSpatialGroup* group);
+ virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count);
protected:
- U32 mRenderPass;
+ U32 mRenderPass;
};
//class for wrangling geometry out of volumes (implemented in LLVOVolume.cpp)
class LLVolumeGeometryManager: public LLGeometryManager
{
public:
- typedef enum
- {
- NONE = 0,
- BATCH_SORT,
- DISTANCE_SORT
- } eSortType;
-
- LLVolumeGeometryManager();
- virtual ~LLVolumeGeometryManager();
- virtual void rebuildGeom(LLSpatialGroup* group);
- virtual void rebuildMesh(LLSpatialGroup* group);
- virtual void getGeometry(LLSpatialGroup* group);
+ typedef enum
+ {
+ NONE = 0,
+ BATCH_SORT,
+ DISTANCE_SORT
+ } eSortType;
+
+ LLVolumeGeometryManager();
+ virtual ~LLVolumeGeometryManager();
+ virtual void rebuildGeom(LLSpatialGroup* group);
+ virtual void rebuildMesh(LLSpatialGroup* group);
+ virtual void getGeometry(LLSpatialGroup* group);
virtual void addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count);
- U32 genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort = FALSE, BOOL batch_textures = FALSE, BOOL rigged = FALSE);
- void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type);
+ U32 genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort = FALSE, BOOL batch_textures = FALSE, BOOL rigged = FALSE);
+ void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type);
private:
- void allocateFaces(U32 pMaxFaceCount);
- void freeFaces();
-
- static int32_t sInstanceCount;
- static LLFace** sFullbrightFaces[2];
- static LLFace** sBumpFaces[2];
- static LLFace** sSimpleFaces[2];
- static LLFace** sNormFaces[2];
- static LLFace** sSpecFaces[2];
- static LLFace** sNormSpecFaces[2];
- static LLFace** sPbrFaces[2];
- static LLFace** sAlphaFaces[2];
+ void allocateFaces(U32 pMaxFaceCount);
+ void freeFaces();
+
+ static int32_t sInstanceCount;
+ static LLFace** sFullbrightFaces[2];
+ static LLFace** sBumpFaces[2];
+ static LLFace** sSimpleFaces[2];
+ static LLFace** sNormFaces[2];
+ static LLFace** sSpecFaces[2];
+ static LLFace** sNormSpecFaces[2];
+ static LLFace** sPbrFaces[2];
+ static LLFace** sAlphaFaces[2];
};
//spatial partition that uses volume geometry manager (implemented in LLVOVolume.cpp)
class LLVolumePartition : public LLSpatialPartition, public LLVolumeGeometryManager
{
public:
- LLVolumePartition(LLViewerRegion* regionp);
- virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); }
- virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); }
- virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); }
- virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); }
+ LLVolumePartition(LLViewerRegion* regionp);
+ virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); }
+ virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); }
+ virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); }
+ virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); }
};
//spatial bridge that uses volume geometry manager (implemented in LLVOVolume.cpp)
class LLVolumeBridge : public LLSpatialBridge, public LLVolumeGeometryManager
{
public:
- LLVolumeBridge(LLDrawable* drawable, LLViewerRegion* regionp);
- virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); }
- virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); }
- virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); }
- virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); }
+ LLVolumeBridge(LLDrawable* drawable, LLViewerRegion* regionp);
+ virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); }
+ virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); }
+ virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); }
+ virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); }
};
class LLAvatarBridge : public LLVolumeBridge
{
public:
- LLAvatarBridge(LLDrawable* drawablep, LLViewerRegion* regionp);
+ LLAvatarBridge(LLDrawable* drawablep, LLViewerRegion* regionp);
};
class LLControlAVBridge : public LLVolumeBridge
{
- using super = LLVolumeBridge;
+ using super = LLVolumeBridge;
public:
- LLControlAVBridge(LLDrawable* drawablep, LLViewerRegion* regionp);
- virtual void updateSpatialExtents();
+ LLControlAVBridge(LLDrawable* drawablep, LLViewerRegion* regionp);
+ virtual void updateSpatialExtents();
};
class LLHUDBridge : public LLVolumeBridge
{
public:
- LLHUDBridge(LLDrawable* drawablep, LLViewerRegion* regionp);
- virtual void shiftPos(const LLVector4a& vec);
- virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera);
+ LLHUDBridge(LLDrawable* drawablep, LLViewerRegion* regionp);
+ virtual void shiftPos(const LLVector4a& vec);
+ virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera);
};
//spatial partition that holds nothing but spatial bridges
class LLBridgePartition : public LLSpatialPartition
{
public:
- LLBridgePartition(LLViewerRegion* regionp);
- virtual void getGeometry(LLSpatialGroup* group) { }
- virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { }
+ LLBridgePartition(LLViewerRegion* regionp);
+ virtual void getGeometry(LLSpatialGroup* group) { }
+ virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { }
};
class LLAvatarPartition : public LLBridgePartition
{
public:
- LLAvatarPartition(LLViewerRegion* regionp);
+ LLAvatarPartition(LLViewerRegion* regionp);
};
class LLControlAVPartition : public LLBridgePartition
{
public:
- LLControlAVPartition(LLViewerRegion* regionp);
+ LLControlAVPartition(LLViewerRegion* regionp);
};
class LLHUDPartition : public LLBridgePartition
{
public:
- LLHUDPartition(LLViewerRegion* regionp);
- virtual void shift(const LLVector4a &offset);
+ LLHUDPartition(LLViewerRegion* regionp);
+ virtual void shift(const LLVector4a &offset);
};
extern const F32 SG_BOX_SIDE;
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 60bada8f58..2d8163d9e1 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llspeakers.cpp
* @brief Management interface for muting and controlling volume of residents currently speaking
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,48 +46,48 @@ extern LLControlGroup gSavedSettings;
const LLColor4 INACTIVE_COLOR(0.3f, 0.3f, 0.3f, 0.5f);
const LLColor4 ACTIVE_COLOR(0.5f, 0.5f, 0.5f, 1.f);
-LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerType type) :
- mStatus(LLSpeaker::STATUS_TEXT_ONLY),
- mLastSpokeTime(0.f),
- mSpeechVolume(0.f),
- mHasSpoken(FALSE),
- mHasLeftCurrentCall(FALSE),
- mDotColor(LLColor4::white),
- mID(id),
- mTyping(FALSE),
- mSortIndex(0),
- mType(type),
- mIsModerator(FALSE),
- mModeratorMutedVoice(FALSE),
- mModeratorMutedText(FALSE)
+LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerType type) :
+ mStatus(LLSpeaker::STATUS_TEXT_ONLY),
+ mLastSpokeTime(0.f),
+ mSpeechVolume(0.f),
+ mHasSpoken(FALSE),
+ mHasLeftCurrentCall(FALSE),
+ mDotColor(LLColor4::white),
+ mID(id),
+ mTyping(FALSE),
+ mSortIndex(0),
+ mType(type),
+ mIsModerator(FALSE),
+ mModeratorMutedVoice(FALSE),
+ mModeratorMutedText(FALSE)
{
- if (name.empty() && type == SPEAKER_AGENT)
- {
- lookupName();
- }
- else
- {
- mDisplayName = name;
- }
+ if (name.empty() && type == SPEAKER_AGENT)
+ {
+ lookupName();
+ }
+ else
+ {
+ mDisplayName = name;
+ }
}
void LLSpeaker::lookupName()
{
- if (mDisplayName.empty())
- {
- LLAvatarNameCache::get(mID, boost::bind(&LLSpeaker::onNameCache, this, _1, _2)); // todo: can be group???
- }
+ if (mDisplayName.empty())
+ {
+ LLAvatarNameCache::get(mID, boost::bind(&LLSpeaker::onNameCache, this, _1, _2)); // todo: can be group???
+ }
}
void LLSpeaker::onNameCache(const LLUUID& id, const LLAvatarName& av_name)
{
- mDisplayName = av_name.getUserName();
+ mDisplayName = av_name.getUserName();
}
bool LLSpeaker::isInVoiceChannel()
{
- return mStatus <= LLSpeaker::STATUS_VOICE_ACTIVE || mStatus == LLSpeaker::STATUS_MUTED;
+ return mStatus <= LLSpeaker::STATUS_VOICE_ACTIVE || mStatus == LLSpeaker::STATUS_MUTED;
}
LLSpeakerUpdateSpeakerEvent::LLSpeakerUpdateSpeakerEvent(LLSpeaker* source)
@@ -98,9 +98,9 @@ LLSpeakerUpdateSpeakerEvent::LLSpeakerUpdateSpeakerEvent(LLSpeaker* source)
LLSD LLSpeakerUpdateSpeakerEvent::getValue()
{
- LLSD ret;
- ret["id"] = mSpeakerID;
- return ret;
+ LLSD ret;
+ ret["id"] = mSpeakerID;
+ return ret;
}
LLSpeakerUpdateModeratorEvent::LLSpeakerUpdateModeratorEvent(LLSpeaker* source)
@@ -112,10 +112,10 @@ LLSpeakerUpdateModeratorEvent::LLSpeakerUpdateModeratorEvent(LLSpeaker* source)
LLSD LLSpeakerUpdateModeratorEvent::getValue()
{
- LLSD ret;
- ret["id"] = mSpeakerID;
- ret["is_moderator"] = mIsModerator;
- return ret;
+ LLSD ret;
+ ret["id"] = mSpeakerID;
+ ret["is_moderator"] = mIsModerator;
+ return ret;
}
LLSpeakerTextModerationEvent::LLSpeakerTextModerationEvent(LLSpeaker* source)
@@ -125,7 +125,7 @@ LLSpeakerTextModerationEvent::LLSpeakerTextModerationEvent(LLSpeaker* source)
LLSD LLSpeakerTextModerationEvent::getValue()
{
- return std::string("text");
+ return std::string("text");
}
@@ -136,7 +136,7 @@ LLSpeakerVoiceModerationEvent::LLSpeakerVoiceModerationEvent(LLSpeaker* source)
LLSD LLSpeakerVoiceModerationEvent::getValue()
{
- return std::string("voice");
+ return std::string("voice");
}
LLSpeakerListChangeEvent::LLSpeakerListChangeEvent(LLSpeakerMgr* source, const LLUUID& speaker_id)
@@ -147,31 +147,31 @@ LLSpeakerListChangeEvent::LLSpeakerListChangeEvent(LLSpeakerMgr* source, const L
LLSD LLSpeakerListChangeEvent::getValue()
{
- return mSpeakerID;
+ return mSpeakerID;
}
// helper sort class
struct LLSortRecentSpeakers
{
- bool operator()(const LLPointer<LLSpeaker> lhs, const LLPointer<LLSpeaker> rhs) const;
+ bool operator()(const LLPointer<LLSpeaker> lhs, const LLPointer<LLSpeaker> rhs) const;
};
bool LLSortRecentSpeakers::operator()(const LLPointer<LLSpeaker> lhs, const LLPointer<LLSpeaker> rhs) const
{
- // Sort first on status
- if (lhs->mStatus != rhs->mStatus)
- {
- return (lhs->mStatus < rhs->mStatus);
- }
-
- // and then on last speaking time
- if(lhs->mLastSpokeTime != rhs->mLastSpokeTime)
- {
- return (lhs->mLastSpokeTime > rhs->mLastSpokeTime);
- }
-
- // and finally (only if those are both equal), on name.
- return( lhs->mDisplayName.compare(rhs->mDisplayName) < 0 );
+ // Sort first on status
+ if (lhs->mStatus != rhs->mStatus)
+ {
+ return (lhs->mStatus < rhs->mStatus);
+ }
+
+ // and then on last speaking time
+ if(lhs->mLastSpokeTime != rhs->mLastSpokeTime)
+ {
+ return (lhs->mLastSpokeTime > rhs->mLastSpokeTime);
+ }
+
+ // and finally (only if those are both equal), on name.
+ return( lhs->mDisplayName.compare(rhs->mDisplayName) < 0 );
}
LLSpeakerActionTimer::LLSpeakerActionTimer(action_callback_t action_cb, F32 action_period, const LLUUID& speaker_id)
@@ -183,16 +183,16 @@ LLSpeakerActionTimer::LLSpeakerActionTimer(action_callback_t action_cb, F32 acti
BOOL LLSpeakerActionTimer::tick()
{
- if (mActionCallback)
- {
- return (BOOL)mActionCallback(mSpeakerId);
- }
- return TRUE;
+ if (mActionCallback)
+ {
+ return (BOOL)mActionCallback(mSpeakerId);
+ }
+ return TRUE;
}
void LLSpeakerActionTimer::unset()
{
- mActionCallback = 0;
+ mActionCallback = 0;
}
LLSpeakersDelayActionsStorage::LLSpeakersDelayActionsStorage(LLSpeakerActionTimer::action_callback_t action_cb, F32 action_delay)
@@ -203,454 +203,454 @@ LLSpeakersDelayActionsStorage::LLSpeakersDelayActionsStorage(LLSpeakerActionTime
LLSpeakersDelayActionsStorage::~LLSpeakersDelayActionsStorage()
{
- removeAllTimers();
+ removeAllTimers();
}
void LLSpeakersDelayActionsStorage::setActionTimer(const LLUUID& speaker_id)
{
- bool not_found = true;
- if (mActionTimersMap.size() > 0)
- {
- not_found = mActionTimersMap.find(speaker_id) == mActionTimersMap.end();
- }
-
- // If there is already a started timer for the passed UUID don't do anything.
- if (not_found)
- {
- // Starting a timer to remove an participant after delay is completed
- mActionTimersMap.insert(LLSpeakerActionTimer::action_value_t(speaker_id,
- new LLSpeakerActionTimer(
- boost::bind(&LLSpeakersDelayActionsStorage::onTimerActionCallback, this, _1),
- mActionDelay, speaker_id)));
- }
+ bool not_found = true;
+ if (mActionTimersMap.size() > 0)
+ {
+ not_found = mActionTimersMap.find(speaker_id) == mActionTimersMap.end();
+ }
+
+ // If there is already a started timer for the passed UUID don't do anything.
+ if (not_found)
+ {
+ // Starting a timer to remove an participant after delay is completed
+ mActionTimersMap.insert(LLSpeakerActionTimer::action_value_t(speaker_id,
+ new LLSpeakerActionTimer(
+ boost::bind(&LLSpeakersDelayActionsStorage::onTimerActionCallback, this, _1),
+ mActionDelay, speaker_id)));
+ }
}
void LLSpeakersDelayActionsStorage::unsetActionTimer(const LLUUID& speaker_id)
{
- if (mActionTimersMap.size() == 0) return;
+ if (mActionTimersMap.size() == 0) return;
- LLSpeakerActionTimer::action_timer_iter_t it_speaker = mActionTimersMap.find(speaker_id);
+ LLSpeakerActionTimer::action_timer_iter_t it_speaker = mActionTimersMap.find(speaker_id);
- if (it_speaker != mActionTimersMap.end())
- {
- it_speaker->second->unset();
- mActionTimersMap.erase(it_speaker);
- }
+ if (it_speaker != mActionTimersMap.end())
+ {
+ it_speaker->second->unset();
+ mActionTimersMap.erase(it_speaker);
+ }
}
void LLSpeakersDelayActionsStorage::removeAllTimers()
{
- LLSpeakerActionTimer::action_timer_iter_t iter = mActionTimersMap.begin();
- for (; iter != mActionTimersMap.end(); ++iter)
- {
- delete iter->second;
- }
- mActionTimersMap.clear();
+ LLSpeakerActionTimer::action_timer_iter_t iter = mActionTimersMap.begin();
+ for (; iter != mActionTimersMap.end(); ++iter)
+ {
+ delete iter->second;
+ }
+ mActionTimersMap.clear();
}
bool LLSpeakersDelayActionsStorage::onTimerActionCallback(const LLUUID& speaker_id)
{
- unsetActionTimer(speaker_id);
+ unsetActionTimer(speaker_id);
- if (mActionCallback)
- {
- mActionCallback(speaker_id);
- }
+ if (mActionCallback)
+ {
+ mActionCallback(speaker_id);
+ }
- return true;
+ return true;
}
bool LLSpeakersDelayActionsStorage::isTimerStarted(const LLUUID& speaker_id)
{
- return (mActionTimersMap.size() > 0) && (mActionTimersMap.find(speaker_id) != mActionTimersMap.end());
+ return (mActionTimersMap.size() > 0) && (mActionTimersMap.find(speaker_id) != mActionTimersMap.end());
}
//
// LLSpeakerMgr
//
-LLSpeakerMgr::LLSpeakerMgr(LLVoiceChannel* channelp) :
- mVoiceChannel(channelp),
- mVoiceModerated(false),
- mModerateModeHandledFirstTime(false),
- mSpeakerListUpdated(false)
+LLSpeakerMgr::LLSpeakerMgr(LLVoiceChannel* channelp) :
+ mVoiceChannel(channelp),
+ mVoiceModerated(false),
+ mModerateModeHandledFirstTime(false),
+ mSpeakerListUpdated(false)
{
mGetListTime.reset();
- static LLUICachedControl<F32> remove_delay ("SpeakerParticipantRemoveDelay", 10.0);
+ static LLUICachedControl<F32> remove_delay ("SpeakerParticipantRemoveDelay", 10.0);
- mSpeakerDelayRemover = new LLSpeakersDelayActionsStorage(boost::bind(&LLSpeakerMgr::removeSpeaker, this, _1), remove_delay);
+ mSpeakerDelayRemover = new LLSpeakersDelayActionsStorage(boost::bind(&LLSpeakerMgr::removeSpeaker, this, _1), remove_delay);
}
LLSpeakerMgr::~LLSpeakerMgr()
{
- delete mSpeakerDelayRemover;
+ delete mSpeakerDelayRemover;
}
LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::string& name, LLSpeaker::ESpeakerStatus status, LLSpeaker::ESpeakerType type)
{
- LLUUID session_id = getSessionID();
- if (id.isNull() || (id == session_id))
- {
- return NULL;
- }
-
- LLPointer<LLSpeaker> speakerp;
- if (mSpeakers.find(id) == mSpeakers.end())
- {
- speakerp = new LLSpeaker(id, name, type);
- speakerp->mStatus = status;
- mSpeakers.insert(std::make_pair(speakerp->mID, speakerp));
- mSpeakersSorted.push_back(speakerp);
- LL_DEBUGS("Speakers") << "Added speaker " << id << LL_ENDL;
- fireEvent(new LLSpeakerListChangeEvent(this, speakerp->mID), "add");
- }
- else
- {
- speakerp = findSpeaker(id);
- if (speakerp.notNull())
- {
- // keep highest priority status (lowest value) instead of overriding current value
- speakerp->mStatus = llmin(speakerp->mStatus, status);
- // RN: due to a weird behavior where IMs from attached objects come from the wearer's agent_id
- // we need to override speakers that we think are objects when we find out they are really
- // residents
- if (type == LLSpeaker::SPEAKER_AGENT)
- {
- speakerp->mType = LLSpeaker::SPEAKER_AGENT;
- speakerp->lookupName();
- }
- }
- else
- {
- LL_WARNS("Speakers") << "Speaker " << id << " not found" << LL_ENDL;
- }
- }
-
- mSpeakerDelayRemover->unsetActionTimer(speakerp->mID);
- return speakerp;
+ LLUUID session_id = getSessionID();
+ if (id.isNull() || (id == session_id))
+ {
+ return NULL;
+ }
+
+ LLPointer<LLSpeaker> speakerp;
+ if (mSpeakers.find(id) == mSpeakers.end())
+ {
+ speakerp = new LLSpeaker(id, name, type);
+ speakerp->mStatus = status;
+ mSpeakers.insert(std::make_pair(speakerp->mID, speakerp));
+ mSpeakersSorted.push_back(speakerp);
+ LL_DEBUGS("Speakers") << "Added speaker " << id << LL_ENDL;
+ fireEvent(new LLSpeakerListChangeEvent(this, speakerp->mID), "add");
+ }
+ else
+ {
+ speakerp = findSpeaker(id);
+ if (speakerp.notNull())
+ {
+ // keep highest priority status (lowest value) instead of overriding current value
+ speakerp->mStatus = llmin(speakerp->mStatus, status);
+ // RN: due to a weird behavior where IMs from attached objects come from the wearer's agent_id
+ // we need to override speakers that we think are objects when we find out they are really
+ // residents
+ if (type == LLSpeaker::SPEAKER_AGENT)
+ {
+ speakerp->mType = LLSpeaker::SPEAKER_AGENT;
+ speakerp->lookupName();
+ }
+ }
+ else
+ {
+ LL_WARNS("Speakers") << "Speaker " << id << " not found" << LL_ENDL;
+ }
+ }
+
+ mSpeakerDelayRemover->unsetActionTimer(speakerp->mID);
+ return speakerp;
}
// *TODO: Once way to request the current voice channel moderation mode is implemented
// this method with related code should be removed.
/*
Initializes "moderate_mode" of voice session on first join.
-
+
This is WORKAROUND because a way to request the current voice channel moderation mode exists
but is not implemented in viewer yet. See EXT-6937.
*/
void LLSpeakerMgr::initVoiceModerateMode()
{
- if (!mModerateModeHandledFirstTime && (mVoiceChannel && mVoiceChannel->isActive()))
- {
- LLPointer<LLSpeaker> speakerp;
-
- if (mSpeakers.find(gAgentID) != mSpeakers.end())
- {
- speakerp = mSpeakers[gAgentID];
- }
-
- if (speakerp.notNull())
- {
- mVoiceModerated = speakerp->mModeratorMutedVoice;
- mModerateModeHandledFirstTime = true;
- }
- }
+ if (!mModerateModeHandledFirstTime && (mVoiceChannel && mVoiceChannel->isActive()))
+ {
+ LLPointer<LLSpeaker> speakerp;
+
+ if (mSpeakers.find(gAgentID) != mSpeakers.end())
+ {
+ speakerp = mSpeakers[gAgentID];
+ }
+
+ if (speakerp.notNull())
+ {
+ mVoiceModerated = speakerp->mModeratorMutedVoice;
+ mModerateModeHandledFirstTime = true;
+ }
+ }
}
void LLSpeakerMgr::update(BOOL resort_ok)
{
- if (!LLVoiceClient::getInstance())
- {
- return;
- }
-
- LLColor4 speaking_color = LLUIColorTable::instance().getColor("SpeakingColor");
- LLColor4 overdriven_color = LLUIColorTable::instance().getColor("OverdrivenColor");
-
- if(resort_ok) // only allow list changes when user is not interacting with it
- {
- updateSpeakerList();
- }
-
- // update status of all current speakers
- BOOL voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
- for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); speaker_it++)
- {
- LLUUID speaker_id = speaker_it->first;
- LLSpeaker* speakerp = speaker_it->second;
-
- if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id))
- {
- speakerp->mSpeechVolume = LLVoiceClient::getInstance()->getCurrentPower(speaker_id);
- BOOL moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id);
- if (moderator_muted_voice != speakerp->mModeratorMutedVoice)
- {
- speakerp->mModeratorMutedVoice = moderator_muted_voice;
- LL_DEBUGS("Speakers") << (speakerp->mModeratorMutedVoice? "Muted" : "Umuted") << " speaker " << speaker_id<< LL_ENDL;
- speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp));
- }
-
- if (LLVoiceClient::getInstance()->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
- {
- speakerp->mStatus = LLSpeaker::STATUS_MUTED;
- }
- else if (LLVoiceClient::getInstance()->getIsSpeaking(speaker_id))
- {
- // reset inactivity expiration
- if (speakerp->mStatus != LLSpeaker::STATUS_SPEAKING)
- {
- speakerp->mLastSpokeTime = mSpeechTimer.getElapsedTimeF32();
- speakerp->mHasSpoken = TRUE;
- fireEvent(new LLSpeakerUpdateSpeakerEvent(speakerp), "update_speaker");
- }
- speakerp->mStatus = LLSpeaker::STATUS_SPEAKING;
- // interpolate between active color and full speaking color based on power of speech output
- speakerp->mDotColor = speaking_color;
- if (speakerp->mSpeechVolume > LLVoiceClient::OVERDRIVEN_POWER_LEVEL)
- {
- speakerp->mDotColor = overdriven_color;
- }
- }
- else
- {
- speakerp->mSpeechVolume = 0.f;
- speakerp->mDotColor = ACTIVE_COLOR;
-
- if (speakerp->mHasSpoken)
- {
- // have spoken once, not currently speaking
- speakerp->mStatus = LLSpeaker::STATUS_HAS_SPOKEN;
- }
- else
- {
- // default state for being in voice channel
- speakerp->mStatus = LLSpeaker::STATUS_VOICE_ACTIVE;
- }
- }
- }
- // speaker no longer registered in voice channel, demote to text only
- else if (speakerp->mStatus != LLSpeaker::STATUS_NOT_IN_CHANNEL)
- {
- if(speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL)
- {
- // external speakers should be timed out when they leave the voice channel (since they only exist via SLVoice)
- speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
- }
- else
- {
- speakerp->mStatus = LLSpeaker::STATUS_TEXT_ONLY;
- speakerp->mSpeechVolume = 0.f;
- speakerp->mDotColor = ACTIVE_COLOR;
- }
- }
- }
-
- if(resort_ok) // only allow list changes when user is not interacting with it
- {
- // sort by status then time last spoken
- std::sort(mSpeakersSorted.begin(), mSpeakersSorted.end(), LLSortRecentSpeakers());
- }
-
- // for recent speakers who are not currently speaking, show "recent" color dot for most recent
- // fading to "active" color
-
- S32 recent_speaker_count = 0;
- S32 sort_index = 0;
- speaker_list_t::iterator sorted_speaker_it;
- for(sorted_speaker_it = mSpeakersSorted.begin();
- sorted_speaker_it != mSpeakersSorted.end(); ++sorted_speaker_it)
- {
- LLPointer<LLSpeaker> speakerp = *sorted_speaker_it;
-
- // color code recent speakers who are not currently speaking
- if (speakerp->mStatus == LLSpeaker::STATUS_HAS_SPOKEN)
- {
- speakerp->mDotColor = lerp(speaking_color, ACTIVE_COLOR, clamp_rescale((F32)recent_speaker_count, -2.f, 3.f, 0.f, 1.f));
- recent_speaker_count++;
- }
-
- // stuff sort ordinal into speaker so the ui can sort by this value
- speakerp->mSortIndex = sort_index++;
- }
+ if (!LLVoiceClient::getInstance())
+ {
+ return;
+ }
+
+ LLColor4 speaking_color = LLUIColorTable::instance().getColor("SpeakingColor");
+ LLColor4 overdriven_color = LLUIColorTable::instance().getColor("OverdrivenColor");
+
+ if(resort_ok) // only allow list changes when user is not interacting with it
+ {
+ updateSpeakerList();
+ }
+
+ // update status of all current speakers
+ BOOL voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
+ for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); speaker_it++)
+ {
+ LLUUID speaker_id = speaker_it->first;
+ LLSpeaker* speakerp = speaker_it->second;
+
+ if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id))
+ {
+ speakerp->mSpeechVolume = LLVoiceClient::getInstance()->getCurrentPower(speaker_id);
+ BOOL moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id);
+ if (moderator_muted_voice != speakerp->mModeratorMutedVoice)
+ {
+ speakerp->mModeratorMutedVoice = moderator_muted_voice;
+ LL_DEBUGS("Speakers") << (speakerp->mModeratorMutedVoice? "Muted" : "Umuted") << " speaker " << speaker_id<< LL_ENDL;
+ speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp));
+ }
+
+ if (LLVoiceClient::getInstance()->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
+ {
+ speakerp->mStatus = LLSpeaker::STATUS_MUTED;
+ }
+ else if (LLVoiceClient::getInstance()->getIsSpeaking(speaker_id))
+ {
+ // reset inactivity expiration
+ if (speakerp->mStatus != LLSpeaker::STATUS_SPEAKING)
+ {
+ speakerp->mLastSpokeTime = mSpeechTimer.getElapsedTimeF32();
+ speakerp->mHasSpoken = TRUE;
+ fireEvent(new LLSpeakerUpdateSpeakerEvent(speakerp), "update_speaker");
+ }
+ speakerp->mStatus = LLSpeaker::STATUS_SPEAKING;
+ // interpolate between active color and full speaking color based on power of speech output
+ speakerp->mDotColor = speaking_color;
+ if (speakerp->mSpeechVolume > LLVoiceClient::OVERDRIVEN_POWER_LEVEL)
+ {
+ speakerp->mDotColor = overdriven_color;
+ }
+ }
+ else
+ {
+ speakerp->mSpeechVolume = 0.f;
+ speakerp->mDotColor = ACTIVE_COLOR;
+
+ if (speakerp->mHasSpoken)
+ {
+ // have spoken once, not currently speaking
+ speakerp->mStatus = LLSpeaker::STATUS_HAS_SPOKEN;
+ }
+ else
+ {
+ // default state for being in voice channel
+ speakerp->mStatus = LLSpeaker::STATUS_VOICE_ACTIVE;
+ }
+ }
+ }
+ // speaker no longer registered in voice channel, demote to text only
+ else if (speakerp->mStatus != LLSpeaker::STATUS_NOT_IN_CHANNEL)
+ {
+ if(speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL)
+ {
+ // external speakers should be timed out when they leave the voice channel (since they only exist via SLVoice)
+ speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
+ }
+ else
+ {
+ speakerp->mStatus = LLSpeaker::STATUS_TEXT_ONLY;
+ speakerp->mSpeechVolume = 0.f;
+ speakerp->mDotColor = ACTIVE_COLOR;
+ }
+ }
+ }
+
+ if(resort_ok) // only allow list changes when user is not interacting with it
+ {
+ // sort by status then time last spoken
+ std::sort(mSpeakersSorted.begin(), mSpeakersSorted.end(), LLSortRecentSpeakers());
+ }
+
+ // for recent speakers who are not currently speaking, show "recent" color dot for most recent
+ // fading to "active" color
+
+ S32 recent_speaker_count = 0;
+ S32 sort_index = 0;
+ speaker_list_t::iterator sorted_speaker_it;
+ for(sorted_speaker_it = mSpeakersSorted.begin();
+ sorted_speaker_it != mSpeakersSorted.end(); ++sorted_speaker_it)
+ {
+ LLPointer<LLSpeaker> speakerp = *sorted_speaker_it;
+
+ // color code recent speakers who are not currently speaking
+ if (speakerp->mStatus == LLSpeaker::STATUS_HAS_SPOKEN)
+ {
+ speakerp->mDotColor = lerp(speaking_color, ACTIVE_COLOR, clamp_rescale((F32)recent_speaker_count, -2.f, 3.f, 0.f, 1.f));
+ recent_speaker_count++;
+ }
+
+ // stuff sort ordinal into speaker so the ui can sort by this value
+ speakerp->mSortIndex = sort_index++;
+ }
}
void LLSpeakerMgr::updateSpeakerList()
{
- // Are we bound to the currently active voice channel?
- if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
- {
- std::set<LLUUID> participants;
- LLVoiceClient::getInstance()->getParticipantList(participants);
- // If we are, add all voice client participants to our list of known speakers
- for (std::set<LLUUID>::iterator participant_it = participants.begin(); participant_it != participants.end(); ++participant_it)
- {
- setSpeaker(*participant_it,
- LLVoiceClient::getInstance()->getDisplayName(*participant_it),
- LLSpeaker::STATUS_VOICE_ACTIVE,
- (LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
- }
- }
- else
- {
- // If not, check if the list is empty, except if it's Nearby Chat (session_id NULL).
- LLUUID session_id = getSessionID();
- if (!session_id.isNull() && !mSpeakerListUpdated)
- {
- // If the list is empty, we update it with whatever we have locally so that it doesn't stay empty too long.
- // *TODO: Fix the server side code that sometimes forgets to send back the list of participants after a chat started.
- // (IOW, fix why we get no ChatterBoxSessionAgentListUpdates message after the initial ChatterBoxSessionStartReply)
- LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id);
- if (session->isGroupSessionType() && (mSpeakers.size() <= 1))
- {
- // For groups, we need to hit the group manager.
- // Note: The session uuid and the group uuid are actually one and the same. If that was to change, this will fail.
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(session_id);
-
- if (gdatap && gdatap->isMemberDataComplete() && !gdatap->mMembers.empty())
- {
- // Add group members when we get the complete list (note: can take a while before we get that list)
- LLGroupMgrGroupData::member_list_t::iterator member_it = gdatap->mMembers.begin();
+ // Are we bound to the currently active voice channel?
+ if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
+ {
+ std::set<LLUUID> participants;
+ LLVoiceClient::getInstance()->getParticipantList(participants);
+ // If we are, add all voice client participants to our list of known speakers
+ for (std::set<LLUUID>::iterator participant_it = participants.begin(); participant_it != participants.end(); ++participant_it)
+ {
+ setSpeaker(*participant_it,
+ LLVoiceClient::getInstance()->getDisplayName(*participant_it),
+ LLSpeaker::STATUS_VOICE_ACTIVE,
+ (LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
+ }
+ }
+ else
+ {
+ // If not, check if the list is empty, except if it's Nearby Chat (session_id NULL).
+ LLUUID session_id = getSessionID();
+ if (!session_id.isNull() && !mSpeakerListUpdated)
+ {
+ // If the list is empty, we update it with whatever we have locally so that it doesn't stay empty too long.
+ // *TODO: Fix the server side code that sometimes forgets to send back the list of participants after a chat started.
+ // (IOW, fix why we get no ChatterBoxSessionAgentListUpdates message after the initial ChatterBoxSessionStartReply)
+ LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id);
+ if (session->isGroupSessionType() && (mSpeakers.size() <= 1))
+ {
+ // For groups, we need to hit the group manager.
+ // Note: The session uuid and the group uuid are actually one and the same. If that was to change, this will fail.
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(session_id);
+
+ if (gdatap && gdatap->isMemberDataComplete() && !gdatap->mMembers.empty())
+ {
+ // Add group members when we get the complete list (note: can take a while before we get that list)
+ LLGroupMgrGroupData::member_list_t::iterator member_it = gdatap->mMembers.begin();
const S32 load_group_max_members = gSavedSettings.getS32("ChatLoadGroupMaxMembers");
S32 updated = 0;
- while (member_it != gdatap->mMembers.end())
- {
- LLGroupMemberData* member = member_it->second;
+ while (member_it != gdatap->mMembers.end())
+ {
+ LLGroupMemberData* member = member_it->second;
LLUUID id = member_it->first;
- // Add only members who are online and not already in the list
- if ((member->getOnlineStatus() == "Online") && (mSpeakers.find(id) == mSpeakers.end()))
- {
- LLPointer<LLSpeaker> speakerp = setSpeaker(id, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT);
- speakerp->mIsModerator = ((member->getAgentPowers() & GP_SESSION_MODERATOR) == GP_SESSION_MODERATOR);
+ // Add only members who are online and not already in the list
+ if ((member->getOnlineStatus() == "Online") && (mSpeakers.find(id) == mSpeakers.end()))
+ {
+ LLPointer<LLSpeaker> speakerp = setSpeaker(id, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT);
+ speakerp->mIsModerator = ((member->getAgentPowers() & GP_SESSION_MODERATOR) == GP_SESSION_MODERATOR);
updated++;
- }
- ++member_it;
+ }
+ ++member_it;
// Limit the number of "manually updated" participants to a reasonable number to avoid severe fps drop
// *TODO : solve the perf issue of having several hundreds of widgets in the conversation list
if (updated >= load_group_max_members)
break;
- }
+ }
mSpeakerListUpdated = true;
- }
- }
- else if (mSpeakers.size() == 0)
- {
- // For all other session type (ad-hoc, P2P), we use the initial participants targets list
- for (uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();it!=session->mInitialTargetIDs.end();++it)
- {
- // Add buddies if they are on line, add any other avatar.
- if (!LLAvatarTracker::instance().isBuddy(*it) || LLAvatarTracker::instance().isBuddyOnline(*it))
- {
- setSpeaker(*it, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT);
- }
- }
- mSpeakerListUpdated = true;
- }
- else
- {
- // The list has been updated the normal way (i.e. by a ChatterBoxSessionAgentListUpdates received from the server)
- mSpeakerListUpdated = true;
- }
- }
- }
- // Always add the current agent (it has to be there...). Will do nothing if already there.
- setSpeaker(gAgentID, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT);
+ }
+ }
+ else if (mSpeakers.size() == 0)
+ {
+ // For all other session type (ad-hoc, P2P), we use the initial participants targets list
+ for (uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();it!=session->mInitialTargetIDs.end();++it)
+ {
+ // Add buddies if they are on line, add any other avatar.
+ if (!LLAvatarTracker::instance().isBuddy(*it) || LLAvatarTracker::instance().isBuddyOnline(*it))
+ {
+ setSpeaker(*it, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT);
+ }
+ }
+ mSpeakerListUpdated = true;
+ }
+ else
+ {
+ // The list has been updated the normal way (i.e. by a ChatterBoxSessionAgentListUpdates received from the server)
+ mSpeakerListUpdated = true;
+ }
+ }
+ }
+ // Always add the current agent (it has to be there...). Will do nothing if already there.
+ setSpeaker(gAgentID, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT);
}
void LLSpeakerMgr::setSpeakerNotInChannel(LLPointer<LLSpeaker> speakerp)
{
- if (speakerp.notNull())
- {
- speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
- speakerp->mDotColor = INACTIVE_COLOR;
- mSpeakerDelayRemover->setActionTimer(speakerp->mID);
- }
+ if (speakerp.notNull())
+ {
+ speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
+ speakerp->mDotColor = INACTIVE_COLOR;
+ mSpeakerDelayRemover->setActionTimer(speakerp->mID);
+ }
}
bool LLSpeakerMgr::removeSpeaker(const LLUUID& speaker_id)
{
- mSpeakers.erase(speaker_id);
+ mSpeakers.erase(speaker_id);
- speaker_list_t::iterator sorted_speaker_it = mSpeakersSorted.begin();
-
- for(; sorted_speaker_it != mSpeakersSorted.end(); ++sorted_speaker_it)
- {
- if (speaker_id == (*sorted_speaker_it)->mID)
- {
- mSpeakersSorted.erase(sorted_speaker_it);
- break;
- }
- }
+ speaker_list_t::iterator sorted_speaker_it = mSpeakersSorted.begin();
- LL_DEBUGS("Speakers") << "Removed speaker " << speaker_id << LL_ENDL;
- fireEvent(new LLSpeakerListChangeEvent(this, speaker_id), "remove");
+ for(; sorted_speaker_it != mSpeakersSorted.end(); ++sorted_speaker_it)
+ {
+ if (speaker_id == (*sorted_speaker_it)->mID)
+ {
+ mSpeakersSorted.erase(sorted_speaker_it);
+ break;
+ }
+ }
+
+ LL_DEBUGS("Speakers") << "Removed speaker " << speaker_id << LL_ENDL;
+ fireEvent(new LLSpeakerListChangeEvent(this, speaker_id), "remove");
- update(TRUE);
+ update(TRUE);
- return false;
+ return false;
}
LLPointer<LLSpeaker> LLSpeakerMgr::findSpeaker(const LLUUID& speaker_id)
{
- //In some conditions map causes crash if it is empty(Windows only), adding check (EK)
- if (mSpeakers.size() == 0)
- return NULL;
- speaker_map_t::iterator found_it = mSpeakers.find(speaker_id);
- if (found_it == mSpeakers.end())
- {
- return NULL;
- }
- return found_it->second;
+ //In some conditions map causes crash if it is empty(Windows only), adding check (EK)
+ if (mSpeakers.size() == 0)
+ return NULL;
+ speaker_map_t::iterator found_it = mSpeakers.find(speaker_id);
+ if (found_it == mSpeakers.end())
+ {
+ return NULL;
+ }
+ return found_it->second;
}
void LLSpeakerMgr::getSpeakerList(speaker_list_t* speaker_list, BOOL include_text)
{
- speaker_list->clear();
- for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
- {
- LLPointer<LLSpeaker> speakerp = speaker_it->second;
- // what about text only muted or inactive?
- if (include_text || speakerp->mStatus != LLSpeaker::STATUS_TEXT_ONLY)
- {
- speaker_list->push_back(speakerp);
- }
- }
+ speaker_list->clear();
+ for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
+ {
+ LLPointer<LLSpeaker> speakerp = speaker_it->second;
+ // what about text only muted or inactive?
+ if (include_text || speakerp->mStatus != LLSpeaker::STATUS_TEXT_ONLY)
+ {
+ speaker_list->push_back(speakerp);
+ }
+ }
}
-const LLUUID LLSpeakerMgr::getSessionID()
-{
- return mVoiceChannel->getSessionID();
+const LLUUID LLSpeakerMgr::getSessionID()
+{
+ return mVoiceChannel->getSessionID();
}
bool LLSpeakerMgr::isSpeakerToBeRemoved(const LLUUID& speaker_id)
{
- return mSpeakerDelayRemover && mSpeakerDelayRemover->isTimerStarted(speaker_id);
+ return mSpeakerDelayRemover && mSpeakerDelayRemover->isTimerStarted(speaker_id);
}
void LLSpeakerMgr::setSpeakerTyping(const LLUUID& speaker_id, BOOL typing)
{
- LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id);
- if (speakerp.notNull())
- {
- speakerp->mTyping = typing;
- }
+ LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id);
+ if (speakerp.notNull())
+ {
+ speakerp->mTyping = typing;
+ }
}
// speaker has chatted via either text or voice
void LLSpeakerMgr::speakerChatted(const LLUUID& speaker_id)
{
- LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id);
- if (speakerp.notNull())
- {
- speakerp->mLastSpokeTime = mSpeechTimer.getElapsedTimeF32();
- speakerp->mHasSpoken = TRUE;
- fireEvent(new LLSpeakerUpdateSpeakerEvent(speakerp), "update_speaker");
- }
+ LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id);
+ if (speakerp.notNull())
+ {
+ speakerp->mLastSpokeTime = mSpeechTimer.getElapsedTimeF32();
+ speakerp->mHasSpoken = TRUE;
+ fireEvent(new LLSpeakerUpdateSpeakerEvent(speakerp), "update_speaker");
+ }
}
BOOL LLSpeakerMgr::isVoiceActive()
{
- // mVoiceChannel = NULL means current voice channel, whatever it is
- return LLVoiceClient::getInstance()->voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
+ // mVoiceChannel = NULL means current voice channel, whatever it is
+ return LLVoiceClient::getInstance()->voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
}
@@ -663,170 +663,170 @@ LLIMSpeakerMgr::LLIMSpeakerMgr(LLVoiceChannel* channel) : LLSpeakerMgr(channel)
void LLIMSpeakerMgr::updateSpeakerList()
{
- // don't do normal updates which are pulled from voice channel
- // rely on user list reported by sim
-
- // We need to do this to allow PSTN callers into group chats to show in the list.
- LLSpeakerMgr::updateSpeakerList();
-
- return;
+ // don't do normal updates which are pulled from voice channel
+ // rely on user list reported by sim
+
+ // We need to do this to allow PSTN callers into group chats to show in the list.
+ LLSpeakerMgr::updateSpeakerList();
+
+ return;
}
void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers)
{
- if ( !speakers.isMap() ) return;
-
- if ( speakers.has("agent_info") && speakers["agent_info"].isMap() )
- {
- LLSD::map_const_iterator speaker_it;
- for(speaker_it = speakers["agent_info"].beginMap();
- speaker_it != speakers["agent_info"].endMap();
- ++speaker_it)
- {
- LLUUID agent_id(speaker_it->first);
-
- LLPointer<LLSpeaker> speakerp = setSpeaker(
- agent_id,
- LLStringUtil::null,
- LLSpeaker::STATUS_TEXT_ONLY);
-
- if ( speaker_it->second.isMap() )
- {
- BOOL is_moderator = speakerp->mIsModerator;
- speakerp->mIsModerator = speaker_it->second["is_moderator"];
- speakerp->mModeratorMutedText =
- speaker_it->second["mutes"]["text"];
- // Fire event only if moderator changed
- if ( is_moderator != speakerp->mIsModerator )
- {
- LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << LL_ENDL;
- fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
- }
- }
- }
- }
- else if ( speakers.has("agents" ) && speakers["agents"].isArray() )
- {
- //older, more decprecated way. Need here for
- //using older version of servers
- LLSD::array_const_iterator speaker_it;
- for(speaker_it = speakers["agents"].beginArray();
- speaker_it != speakers["agents"].endArray();
- ++speaker_it)
- {
- const LLUUID agent_id = (*speaker_it).asUUID();
-
- LLPointer<LLSpeaker> speakerp = setSpeaker(
- agent_id,
- LLStringUtil::null,
- LLSpeaker::STATUS_TEXT_ONLY);
- }
- }
+ if ( !speakers.isMap() ) return;
+
+ if ( speakers.has("agent_info") && speakers["agent_info"].isMap() )
+ {
+ LLSD::map_const_iterator speaker_it;
+ for(speaker_it = speakers["agent_info"].beginMap();
+ speaker_it != speakers["agent_info"].endMap();
+ ++speaker_it)
+ {
+ LLUUID agent_id(speaker_it->first);
+
+ LLPointer<LLSpeaker> speakerp = setSpeaker(
+ agent_id,
+ LLStringUtil::null,
+ LLSpeaker::STATUS_TEXT_ONLY);
+
+ if ( speaker_it->second.isMap() )
+ {
+ BOOL is_moderator = speakerp->mIsModerator;
+ speakerp->mIsModerator = speaker_it->second["is_moderator"];
+ speakerp->mModeratorMutedText =
+ speaker_it->second["mutes"]["text"];
+ // Fire event only if moderator changed
+ if ( is_moderator != speakerp->mIsModerator )
+ {
+ LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << LL_ENDL;
+ fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
+ }
+ }
+ }
+ }
+ else if ( speakers.has("agents" ) && speakers["agents"].isArray() )
+ {
+ //older, more decprecated way. Need here for
+ //using older version of servers
+ LLSD::array_const_iterator speaker_it;
+ for(speaker_it = speakers["agents"].beginArray();
+ speaker_it != speakers["agents"].endArray();
+ ++speaker_it)
+ {
+ const LLUUID agent_id = (*speaker_it).asUUID();
+
+ LLPointer<LLSpeaker> speakerp = setSpeaker(
+ agent_id,
+ LLStringUtil::null,
+ LLSpeaker::STATUS_TEXT_ONLY);
+ }
+ }
}
void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
{
- if ( !update.isMap() ) return;
-
- if ( update.has("agent_updates") && update["agent_updates"].isMap() )
- {
- LLSD::map_const_iterator update_it;
- for(
- update_it = update["agent_updates"].beginMap();
- update_it != update["agent_updates"].endMap();
- ++update_it)
- {
- LLUUID agent_id(update_it->first);
- LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id);
-
- LLSD agent_data = update_it->second;
-
- if (agent_data.isMap() && agent_data.has("transition"))
- {
- if (agent_data["transition"].asString() == "LEAVE")
- {
- setSpeakerNotInChannel(speakerp);
- }
- else if (agent_data["transition"].asString() == "ENTER")
- {
- // add or update speaker
- speakerp = setSpeaker(agent_id);
- }
- else
- {
- LL_WARNS() << "bad membership list update from 'agent_updates' for agent " << agent_id << ", transition " << ll_print_sd(agent_data["transition"]) << LL_ENDL;
- }
- }
-
- if (speakerp.isNull()) continue;
-
- // should have a valid speaker from this point on
- if (agent_data.isMap() && agent_data.has("info"))
- {
- LLSD agent_info = agent_data["info"];
-
- if (agent_info.has("is_moderator"))
- {
- BOOL is_moderator = speakerp->mIsModerator;
- speakerp->mIsModerator = agent_info["is_moderator"];
- // Fire event only if moderator changed
- if ( is_moderator != speakerp->mIsModerator )
- {
- LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << LL_ENDL;
- fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
- }
- }
-
- if (agent_info.has("mutes"))
- {
- speakerp->mModeratorMutedText = agent_info["mutes"]["text"];
- }
- }
- }
- }
- else if ( update.has("updates") && update["updates"].isMap() )
- {
- LLSD::map_const_iterator update_it;
- for (
- update_it = update["updates"].beginMap();
- update_it != update["updates"].endMap();
- ++update_it)
- {
- LLUUID agent_id(update_it->first);
- LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id);
-
- std::string agent_transition = update_it->second.asString();
- if (agent_transition == "LEAVE")
- {
- setSpeakerNotInChannel(speakerp);
- }
- else if ( agent_transition == "ENTER")
- {
- // add or update speaker
- speakerp = setSpeaker(agent_id);
- }
- else
- {
- LL_WARNS() << "bad membership list update from 'updates' for agent " << agent_id << ", transition " << agent_transition << LL_ENDL;
- }
- }
- }
+ if ( !update.isMap() ) return;
+
+ if ( update.has("agent_updates") && update["agent_updates"].isMap() )
+ {
+ LLSD::map_const_iterator update_it;
+ for(
+ update_it = update["agent_updates"].beginMap();
+ update_it != update["agent_updates"].endMap();
+ ++update_it)
+ {
+ LLUUID agent_id(update_it->first);
+ LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id);
+
+ LLSD agent_data = update_it->second;
+
+ if (agent_data.isMap() && agent_data.has("transition"))
+ {
+ if (agent_data["transition"].asString() == "LEAVE")
+ {
+ setSpeakerNotInChannel(speakerp);
+ }
+ else if (agent_data["transition"].asString() == "ENTER")
+ {
+ // add or update speaker
+ speakerp = setSpeaker(agent_id);
+ }
+ else
+ {
+ LL_WARNS() << "bad membership list update from 'agent_updates' for agent " << agent_id << ", transition " << ll_print_sd(agent_data["transition"]) << LL_ENDL;
+ }
+ }
+
+ if (speakerp.isNull()) continue;
+
+ // should have a valid speaker from this point on
+ if (agent_data.isMap() && agent_data.has("info"))
+ {
+ LLSD agent_info = agent_data["info"];
+
+ if (agent_info.has("is_moderator"))
+ {
+ BOOL is_moderator = speakerp->mIsModerator;
+ speakerp->mIsModerator = agent_info["is_moderator"];
+ // Fire event only if moderator changed
+ if ( is_moderator != speakerp->mIsModerator )
+ {
+ LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << LL_ENDL;
+ fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
+ }
+ }
+
+ if (agent_info.has("mutes"))
+ {
+ speakerp->mModeratorMutedText = agent_info["mutes"]["text"];
+ }
+ }
+ }
+ }
+ else if ( update.has("updates") && update["updates"].isMap() )
+ {
+ LLSD::map_const_iterator update_it;
+ for (
+ update_it = update["updates"].beginMap();
+ update_it != update["updates"].endMap();
+ ++update_it)
+ {
+ LLUUID agent_id(update_it->first);
+ LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id);
+
+ std::string agent_transition = update_it->second.asString();
+ if (agent_transition == "LEAVE")
+ {
+ setSpeakerNotInChannel(speakerp);
+ }
+ else if ( agent_transition == "ENTER")
+ {
+ // add or update speaker
+ speakerp = setSpeaker(agent_id);
+ }
+ else
+ {
+ LL_WARNS() << "bad membership list update from 'updates' for agent " << agent_id << ", transition " << agent_transition << LL_ENDL;
+ }
+ }
+ }
}
void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id)
{
- LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id);
- if (!speakerp) return;
-
- std::string url = gAgent.getRegionCapability("ChatSessionRequest");
- LLSD data;
- data["method"] = "mute update";
- data["session-id"] = getSessionID();
- data["params"] = LLSD::emptyMap();
- data["params"]["agent_id"] = speaker_id;
- data["params"]["mute_info"] = LLSD::emptyMap();
- //current value represents ability to type, so invert
- data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText;
+ LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id);
+ if (!speakerp) return;
+
+ std::string url = gAgent.getRegionCapability("ChatSessionRequest");
+ LLSD data;
+ data["method"] = "mute update";
+ data["session-id"] = getSessionID();
+ data["params"] = LLSD::emptyMap();
+ data["params"]["agent_id"] = speaker_id;
+ data["params"]["mute_info"] = LLSD::emptyMap();
+ //current value represents ability to type, so invert
+ data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText;
LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro",
boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data));
@@ -834,24 +834,24 @@ void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id)
void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute)
{
- LLPointer<LLSpeaker> speakerp = findSpeaker(avatar_id);
- if (!speakerp) return;
+ LLPointer<LLSpeaker> speakerp = findSpeaker(avatar_id);
+ if (!speakerp) return;
- // *NOTE: mantipov: probably this condition will be incorrect when avatar will be blocked for
- // text chat via moderation (LLSpeaker::mModeratorMutedText == TRUE)
- bool is_in_voice = speakerp->mStatus <= LLSpeaker::STATUS_VOICE_ACTIVE || speakerp->mStatus == LLSpeaker::STATUS_MUTED;
+ // *NOTE: mantipov: probably this condition will be incorrect when avatar will be blocked for
+ // text chat via moderation (LLSpeaker::mModeratorMutedText == TRUE)
+ bool is_in_voice = speakerp->mStatus <= LLSpeaker::STATUS_VOICE_ACTIVE || speakerp->mStatus == LLSpeaker::STATUS_MUTED;
- // do not send voice moderation changes for avatars not in voice channel
- if (!is_in_voice) return;
+ // do not send voice moderation changes for avatars not in voice channel
+ if (!is_in_voice) return;
- std::string url = gAgent.getRegionCapability("ChatSessionRequest");
- LLSD data;
- data["method"] = "mute update";
- data["session-id"] = getSessionID();
- data["params"] = LLSD::emptyMap();
- data["params"]["agent_id"] = avatar_id;
- data["params"]["mute_info"] = LLSD::emptyMap();
- data["params"]["mute_info"]["voice"] = !unmute;
+ std::string url = gAgent.getRegionCapability("ChatSessionRequest");
+ LLSD data;
+ data["method"] = "mute update";
+ data["session-id"] = getSessionID();
+ data["params"] = LLSD::emptyMap();
+ data["params"]["agent_id"] = avatar_id;
+ data["params"]["mute_info"] = LLSD::emptyMap();
+ data["params"]["mute_info"]["voice"] = !unmute;
LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro",
boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data));
@@ -901,39 +901,39 @@ void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action)
void LLIMSpeakerMgr::moderateVoiceAllParticipants( bool unmute_everyone )
{
- if (mVoiceModerated == !unmute_everyone)
- {
- // session already in requested state. Just force participants which do not match it.
- forceVoiceModeratedMode(mVoiceModerated);
- }
- else
- {
- // otherwise set moderated mode for a whole session.
- moderateVoiceSession(getSessionID(), !unmute_everyone);
- }
+ if (mVoiceModerated == !unmute_everyone)
+ {
+ // session already in requested state. Just force participants which do not match it.
+ forceVoiceModeratedMode(mVoiceModerated);
+ }
+ else
+ {
+ // otherwise set moderated mode for a whole session.
+ moderateVoiceSession(getSessionID(), !unmute_everyone);
+ }
}
void LLIMSpeakerMgr::processSessionUpdate(const LLSD& session_update)
{
- if (session_update.has("moderated_mode") &&
- session_update["moderated_mode"].has("voice"))
- {
- mVoiceModerated = session_update["moderated_mode"]["voice"];
- }
+ if (session_update.has("moderated_mode") &&
+ session_update["moderated_mode"].has("voice"))
+ {
+ mVoiceModerated = session_update["moderated_mode"]["voice"];
+ }
}
void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallow_voice)
{
- std::string url = gAgent.getRegionCapability("ChatSessionRequest");
- LLSD data;
- data["method"] = "session update";
- data["session-id"] = session_id;
- data["params"] = LLSD::emptyMap();
+ std::string url = gAgent.getRegionCapability("ChatSessionRequest");
+ LLSD data;
+ data["method"] = "session update";
+ data["session-id"] = session_id;
+ data["params"] = LLSD::emptyMap();
- data["params"]["update_info"] = LLSD::emptyMap();
+ data["params"]["update_info"] = LLSD::emptyMap();
- data["params"]["update_info"]["moderated_mode"] = LLSD::emptyMap();
- data["params"]["update_info"]["moderated_mode"]["voice"] = disallow_voice;
+ data["params"]["update_info"]["moderated_mode"] = LLSD::emptyMap();
+ data["params"]["update_info"]["moderated_mode"]["voice"] = disallow_voice;
LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro",
boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data));
@@ -941,17 +941,17 @@ void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallo
void LLIMSpeakerMgr::forceVoiceModeratedMode(bool should_be_muted)
{
- for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
- {
- LLUUID speaker_id = speaker_it->first;
- LLSpeaker* speakerp = speaker_it->second;
-
- // participant does not match requested state
- if (should_be_muted != (bool)speakerp->mModeratorMutedVoice)
- {
- moderateVoiceParticipant(speaker_id, !should_be_muted);
- }
- }
+ for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
+ {
+ LLUUID speaker_id = speaker_it->first;
+ LLSpeaker* speakerp = speaker_it->second;
+
+ // participant does not match requested state
+ if (should_be_muted != (bool)speakerp->mModeratorMutedVoice)
+ {
+ moderateVoiceParticipant(speaker_id, !should_be_muted);
+ }
+ }
}
//
@@ -964,31 +964,31 @@ LLActiveSpeakerMgr::LLActiveSpeakerMgr() : LLSpeakerMgr(NULL)
void LLActiveSpeakerMgr::updateSpeakerList()
{
- // point to whatever the current voice channel is
- mVoiceChannel = LLVoiceChannel::getCurrentVoiceChannel();
-
- // always populate from active voice channel
- if (LLVoiceChannel::getCurrentVoiceChannel() != mVoiceChannel) //MA: seems this is always false
- {
- LL_DEBUGS("Speakers") << "Removed all speakers" << LL_ENDL;
- fireEvent(new LLSpeakerListChangeEvent(this, LLUUID::null), "clear");
- mSpeakers.clear();
- mSpeakersSorted.clear();
- mVoiceChannel = LLVoiceChannel::getCurrentVoiceChannel();
- mSpeakerDelayRemover->removeAllTimers();
- }
- LLSpeakerMgr::updateSpeakerList();
-
- // clean up text only speakers
- for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
- {
- LLSpeaker* speakerp = speaker_it->second;
- if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
- {
- // automatically flag text only speakers for removal
- speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
- }
- }
+ // point to whatever the current voice channel is
+ mVoiceChannel = LLVoiceChannel::getCurrentVoiceChannel();
+
+ // always populate from active voice channel
+ if (LLVoiceChannel::getCurrentVoiceChannel() != mVoiceChannel) //MA: seems this is always false
+ {
+ LL_DEBUGS("Speakers") << "Removed all speakers" << LL_ENDL;
+ fireEvent(new LLSpeakerListChangeEvent(this, LLUUID::null), "clear");
+ mSpeakers.clear();
+ mSpeakersSorted.clear();
+ mVoiceChannel = LLVoiceChannel::getCurrentVoiceChannel();
+ mSpeakerDelayRemover->removeAllTimers();
+ }
+ LLSpeakerMgr::updateSpeakerList();
+
+ // clean up text only speakers
+ for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
+ {
+ LLSpeaker* speakerp = speaker_it->second;
+ if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
+ {
+ // automatically flag text only speakers for removal
+ speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
+ }
+ }
}
@@ -1008,35 +1008,35 @@ LLLocalSpeakerMgr::~LLLocalSpeakerMgr ()
void LLLocalSpeakerMgr::updateSpeakerList()
{
- // pull speakers from voice channel
- LLSpeakerMgr::updateSpeakerList();
-
- if (gDisconnected)//the world is cleared.
- {
- return ;
- }
-
- // pick up non-voice speakers in chat range
- uuid_vec_t avatar_ids;
- std::vector<LLVector3d> positions;
- LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS);
- for(U32 i=0; i<avatar_ids.size(); i++)
- {
- setSpeaker(avatar_ids[i]);
- }
-
- // check if text only speakers have moved out of chat range
- for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
- {
- LLUUID speaker_id = speaker_it->first;
- LLPointer<LLSpeaker> speakerp = speaker_it->second;
- if (speakerp.notNull() && speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
- {
- LLVOAvatar* avatarp = (LLVOAvatar*)gObjectList.findObject(speaker_id);
- if (!avatarp || dist_vec_squared(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS)
- {
- setSpeakerNotInChannel(speakerp);
- }
- }
- }
+ // pull speakers from voice channel
+ LLSpeakerMgr::updateSpeakerList();
+
+ if (gDisconnected)//the world is cleared.
+ {
+ return ;
+ }
+
+ // pick up non-voice speakers in chat range
+ uuid_vec_t avatar_ids;
+ std::vector<LLVector3d> positions;
+ LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS);
+ for(U32 i=0; i<avatar_ids.size(); i++)
+ {
+ setSpeaker(avatar_ids[i]);
+ }
+
+ // check if text only speakers have moved out of chat range
+ for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
+ {
+ LLUUID speaker_id = speaker_it->first;
+ LLPointer<LLSpeaker> speakerp = speaker_it->second;
+ if (speakerp.notNull() && speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
+ {
+ LLVOAvatar* avatarp = (LLVOAvatar*)gObjectList.findObject(speaker_id);
+ if (!avatarp || dist_vec_squared(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS)
+ {
+ setSpeakerNotInChannel(speakerp);
+ }
+ }
+ }
}
diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h
index 22c9481687..eb86fadea1 100644
--- a/indra/newview/llspeakers.h
+++ b/indra/newview/llspeakers.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llspeakers.h
* @brief Management interface for muting and controlling volume of residents currently speaking
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,94 +40,94 @@ class LLAvatarName;
class LLSpeaker : public LLRefCount, public LLOldEvents::LLObservable, public LLHandleProvider<LLSpeaker>, public boost::signals2::trackable
{
public:
- typedef enum e_speaker_type
- {
- SPEAKER_AGENT,
- SPEAKER_OBJECT,
- SPEAKER_EXTERNAL // Speaker that doesn't map to an avatar or object (i.e. PSTN caller in a group)
- } ESpeakerType;
-
- typedef enum e_speaker_status
- {
- STATUS_SPEAKING,
- STATUS_HAS_SPOKEN,
- STATUS_VOICE_ACTIVE,
- STATUS_TEXT_ONLY,
- STATUS_NOT_IN_CHANNEL,
- STATUS_MUTED
- } ESpeakerStatus;
-
-
- LLSpeaker(const LLUUID& id, const std::string& name = LLStringUtil::null, const ESpeakerType type = SPEAKER_AGENT);
- ~LLSpeaker() {};
- void lookupName();
-
- void onNameCache(const LLUUID& id, const LLAvatarName& full_name);
-
- bool isInVoiceChannel();
-
- ESpeakerStatus mStatus; // current activity status in speech group
- F32 mLastSpokeTime; // timestamp when this speaker last spoke
- F32 mSpeechVolume; // current speech amplitude (timea average rms amplitude?)
- std::string mDisplayName; // cache user name for this speaker
- BOOL mHasSpoken; // has this speaker said anything this session?
- BOOL mHasLeftCurrentCall; // has this speaker left the current voice call?
- LLColor4 mDotColor;
- LLUUID mID;
- BOOL mTyping;
- S32 mSortIndex;
- ESpeakerType mType;
- BOOL mIsModerator;
- BOOL mModeratorMutedVoice;
- BOOL mModeratorMutedText;
+ typedef enum e_speaker_type
+ {
+ SPEAKER_AGENT,
+ SPEAKER_OBJECT,
+ SPEAKER_EXTERNAL // Speaker that doesn't map to an avatar or object (i.e. PSTN caller in a group)
+ } ESpeakerType;
+
+ typedef enum e_speaker_status
+ {
+ STATUS_SPEAKING,
+ STATUS_HAS_SPOKEN,
+ STATUS_VOICE_ACTIVE,
+ STATUS_TEXT_ONLY,
+ STATUS_NOT_IN_CHANNEL,
+ STATUS_MUTED
+ } ESpeakerStatus;
+
+
+ LLSpeaker(const LLUUID& id, const std::string& name = LLStringUtil::null, const ESpeakerType type = SPEAKER_AGENT);
+ ~LLSpeaker() {};
+ void lookupName();
+
+ void onNameCache(const LLUUID& id, const LLAvatarName& full_name);
+
+ bool isInVoiceChannel();
+
+ ESpeakerStatus mStatus; // current activity status in speech group
+ F32 mLastSpokeTime; // timestamp when this speaker last spoke
+ F32 mSpeechVolume; // current speech amplitude (timea average rms amplitude?)
+ std::string mDisplayName; // cache user name for this speaker
+ BOOL mHasSpoken; // has this speaker said anything this session?
+ BOOL mHasLeftCurrentCall; // has this speaker left the current voice call?
+ LLColor4 mDotColor;
+ LLUUID mID;
+ BOOL mTyping;
+ S32 mSortIndex;
+ ESpeakerType mType;
+ BOOL mIsModerator;
+ BOOL mModeratorMutedVoice;
+ BOOL mModeratorMutedText;
};
class LLSpeakerUpdateSpeakerEvent : public LLOldEvents::LLEvent
{
public:
- LLSpeakerUpdateSpeakerEvent(LLSpeaker* source);
- /*virtual*/ LLSD getValue();
+ LLSpeakerUpdateSpeakerEvent(LLSpeaker* source);
+ /*virtual*/ LLSD getValue();
private:
- const LLUUID& mSpeakerID;
+ const LLUUID& mSpeakerID;
};
class LLSpeakerUpdateModeratorEvent : public LLOldEvents::LLEvent
{
public:
- LLSpeakerUpdateModeratorEvent(LLSpeaker* source);
- /*virtual*/ LLSD getValue();
+ LLSpeakerUpdateModeratorEvent(LLSpeaker* source);
+ /*virtual*/ LLSD getValue();
private:
- const LLUUID& mSpeakerID;
- BOOL mIsModerator;
+ const LLUUID& mSpeakerID;
+ BOOL mIsModerator;
};
class LLSpeakerTextModerationEvent : public LLOldEvents::LLEvent
{
public:
- LLSpeakerTextModerationEvent(LLSpeaker* source);
- /*virtual*/ LLSD getValue();
+ LLSpeakerTextModerationEvent(LLSpeaker* source);
+ /*virtual*/ LLSD getValue();
};
class LLSpeakerVoiceModerationEvent : public LLOldEvents::LLEvent
{
public:
- LLSpeakerVoiceModerationEvent(LLSpeaker* source);
- /*virtual*/ LLSD getValue();
+ LLSpeakerVoiceModerationEvent(LLSpeaker* source);
+ /*virtual*/ LLSD getValue();
};
class LLSpeakerListChangeEvent : public LLOldEvents::LLEvent
{
public:
- LLSpeakerListChangeEvent(LLSpeakerMgr* source, const LLUUID& speaker_id);
- /*virtual*/ LLSD getValue();
+ LLSpeakerListChangeEvent(LLSpeakerMgr* source, const LLUUID& speaker_id);
+ /*virtual*/ LLSD getValue();
private:
- const LLUUID& mSpeakerID;
+ const LLUUID& mSpeakerID;
};
/**
* class LLSpeakerActionTimer
- *
+ *
* Implements a timer that calls stored callback action for stored speaker after passed period.
*
* Action is called until callback returns "true".
@@ -138,39 +138,39 @@ private:
class LLSpeakerActionTimer : public LLEventTimer
{
public:
- typedef boost::function<bool(const LLUUID&)> action_callback_t;
- typedef std::map<LLUUID, LLSpeakerActionTimer*> action_timers_map_t;
- typedef action_timers_map_t::value_type action_value_t;
- typedef action_timers_map_t::const_iterator action_timer_const_iter_t;
- typedef action_timers_map_t::iterator action_timer_iter_t;
-
- /**
- * Constructor.
- *
- * @param action_cb - callback which will be called each time after passed action period.
- * @param action_period - time in seconds timer should tick.
- * @param speaker_id - LLUUID of speaker which will be passed into action callback.
- */
- LLSpeakerActionTimer(action_callback_t action_cb, F32 action_period, const LLUUID& speaker_id);
- virtual ~LLSpeakerActionTimer() {};
-
- /**
- * Implements timer "tick".
- *
- * If action callback is not specified returns true. Instance will be deleted by LLEventTimer::updateClass().
- */
- virtual BOOL tick();
-
- /**
- * Clears the callback.
- *
- * Use this instead of deleteing this object.
- * The next call to tick() will return true and that will destroy this object.
- */
- void unset();
+ typedef boost::function<bool(const LLUUID&)> action_callback_t;
+ typedef std::map<LLUUID, LLSpeakerActionTimer*> action_timers_map_t;
+ typedef action_timers_map_t::value_type action_value_t;
+ typedef action_timers_map_t::const_iterator action_timer_const_iter_t;
+ typedef action_timers_map_t::iterator action_timer_iter_t;
+
+ /**
+ * Constructor.
+ *
+ * @param action_cb - callback which will be called each time after passed action period.
+ * @param action_period - time in seconds timer should tick.
+ * @param speaker_id - LLUUID of speaker which will be passed into action callback.
+ */
+ LLSpeakerActionTimer(action_callback_t action_cb, F32 action_period, const LLUUID& speaker_id);
+ virtual ~LLSpeakerActionTimer() {};
+
+ /**
+ * Implements timer "tick".
+ *
+ * If action callback is not specified returns true. Instance will be deleted by LLEventTimer::updateClass().
+ */
+ virtual BOOL tick();
+
+ /**
+ * Clears the callback.
+ *
+ * Use this instead of deleteing this object.
+ * The next call to tick() will return true and that will destroy this object.
+ */
+ void unset();
private:
- action_callback_t mActionCallback;
- LLUUID mSpeakerId;
+ action_callback_t mActionCallback;
+ LLUUID mSpeakerId;
};
/**
@@ -180,153 +180,153 @@ private:
class LLSpeakersDelayActionsStorage
{
public:
- LLSpeakersDelayActionsStorage(LLSpeakerActionTimer::action_callback_t action_cb, F32 action_delay);
- ~LLSpeakersDelayActionsStorage();
+ LLSpeakersDelayActionsStorage(LLSpeakerActionTimer::action_callback_t action_cb, F32 action_delay);
+ ~LLSpeakersDelayActionsStorage();
- /**
- * Sets new LLSpeakerActionTimer with passed speaker UUID.
- */
- void setActionTimer(const LLUUID& speaker_id);
+ /**
+ * Sets new LLSpeakerActionTimer with passed speaker UUID.
+ */
+ void setActionTimer(const LLUUID& speaker_id);
- /**
- * Removes stored LLSpeakerActionTimer for passed speaker UUID from internal map and optionally deletes it.
- *
- * @see onTimerActionCallback()
- */
- void unsetActionTimer(const LLUUID& speaker_id);
+ /**
+ * Removes stored LLSpeakerActionTimer for passed speaker UUID from internal map and optionally deletes it.
+ *
+ * @see onTimerActionCallback()
+ */
+ void unsetActionTimer(const LLUUID& speaker_id);
- void removeAllTimers();
+ void removeAllTimers();
- bool isTimerStarted(const LLUUID& speaker_id);
+ bool isTimerStarted(const LLUUID& speaker_id);
private:
- /**
- * Callback of the each instance of LLSpeakerActionTimer.
- *
- * Unsets an appropriate timer instance and calls action callback for specified speacker_id.
- *
- * @see unsetActionTimer()
- */
- bool onTimerActionCallback(const LLUUID& speaker_id);
-
- LLSpeakerActionTimer::action_timers_map_t mActionTimersMap;
- LLSpeakerActionTimer::action_callback_t mActionCallback;
-
- /**
- * Delay to call action callback for speakers after timer was set.
- */
- F32 mActionDelay;
+ /**
+ * Callback of the each instance of LLSpeakerActionTimer.
+ *
+ * Unsets an appropriate timer instance and calls action callback for specified speacker_id.
+ *
+ * @see unsetActionTimer()
+ */
+ bool onTimerActionCallback(const LLUUID& speaker_id);
+
+ LLSpeakerActionTimer::action_timers_map_t mActionTimersMap;
+ LLSpeakerActionTimer::action_callback_t mActionCallback;
+
+ /**
+ * Delay to call action callback for speakers after timer was set.
+ */
+ F32 mActionDelay;
};
class LLSpeakerMgr : public LLOldEvents::LLObservable
{
- LOG_CLASS(LLSpeakerMgr);
+ LOG_CLASS(LLSpeakerMgr);
public:
- LLSpeakerMgr(LLVoiceChannel* channelp);
- virtual ~LLSpeakerMgr();
-
- LLPointer<LLSpeaker> findSpeaker(const LLUUID& avatar_id);
- void update(BOOL resort_ok);
- void setSpeakerTyping(const LLUUID& speaker_id, BOOL typing);
- void speakerChatted(const LLUUID& speaker_id);
- LLPointer<LLSpeaker> setSpeaker(const LLUUID& id,
- const std::string& name = LLStringUtil::null,
- LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY,
- LLSpeaker::ESpeakerType = LLSpeaker::SPEAKER_AGENT);
-
- BOOL isVoiceActive();
-
- typedef std::vector<LLPointer<LLSpeaker> > speaker_list_t;
- void getSpeakerList(speaker_list_t* speaker_list, BOOL include_text);
- LLVoiceChannel* getVoiceChannel() { return mVoiceChannel; }
- const LLUUID getSessionID();
- bool isSpeakerToBeRemoved(const LLUUID& speaker_id);
-
- /**
- * Initializes mVoiceModerated depend on LLSpeaker::mModeratorMutedVoice of agent's participant.
- *
- * Is used only to implement workaround to initialize mVoiceModerated on first join to group chat. See EXT-6937
- */
- void initVoiceModerateMode();
+ LLSpeakerMgr(LLVoiceChannel* channelp);
+ virtual ~LLSpeakerMgr();
+
+ LLPointer<LLSpeaker> findSpeaker(const LLUUID& avatar_id);
+ void update(BOOL resort_ok);
+ void setSpeakerTyping(const LLUUID& speaker_id, BOOL typing);
+ void speakerChatted(const LLUUID& speaker_id);
+ LLPointer<LLSpeaker> setSpeaker(const LLUUID& id,
+ const std::string& name = LLStringUtil::null,
+ LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY,
+ LLSpeaker::ESpeakerType = LLSpeaker::SPEAKER_AGENT);
+
+ BOOL isVoiceActive();
+
+ typedef std::vector<LLPointer<LLSpeaker> > speaker_list_t;
+ void getSpeakerList(speaker_list_t* speaker_list, BOOL include_text);
+ LLVoiceChannel* getVoiceChannel() { return mVoiceChannel; }
+ const LLUUID getSessionID();
+ bool isSpeakerToBeRemoved(const LLUUID& speaker_id);
+
+ /**
+ * Initializes mVoiceModerated depend on LLSpeaker::mModeratorMutedVoice of agent's participant.
+ *
+ * Is used only to implement workaround to initialize mVoiceModerated on first join to group chat. See EXT-6937
+ */
+ void initVoiceModerateMode();
protected:
- virtual void updateSpeakerList();
- void setSpeakerNotInChannel(LLPointer<LLSpeaker> speackerp);
- bool removeSpeaker(const LLUUID& speaker_id);
+ virtual void updateSpeakerList();
+ void setSpeakerNotInChannel(LLPointer<LLSpeaker> speackerp);
+ bool removeSpeaker(const LLUUID& speaker_id);
- typedef std::map<LLUUID, LLPointer<LLSpeaker> > speaker_map_t;
- speaker_map_t mSpeakers;
- bool mSpeakerListUpdated;
+ typedef std::map<LLUUID, LLPointer<LLSpeaker> > speaker_map_t;
+ speaker_map_t mSpeakers;
+ bool mSpeakerListUpdated;
LLTimer mGetListTime;
- speaker_list_t mSpeakersSorted;
- LLFrameTimer mSpeechTimer;
- LLVoiceChannel* mVoiceChannel;
+ speaker_list_t mSpeakersSorted;
+ LLFrameTimer mSpeechTimer;
+ LLVoiceChannel* mVoiceChannel;
- /**
- * time out speakers when they are not part of current session
- */
- LLSpeakersDelayActionsStorage* mSpeakerDelayRemover;
+ /**
+ * time out speakers when they are not part of current session
+ */
+ LLSpeakersDelayActionsStorage* mSpeakerDelayRemover;
- // *TODO: should be moved back into LLIMSpeakerMgr when a way to request the current voice channel
- // moderation mode is implemented: See EXT-6937
- bool mVoiceModerated;
+ // *TODO: should be moved back into LLIMSpeakerMgr when a way to request the current voice channel
+ // moderation mode is implemented: See EXT-6937
+ bool mVoiceModerated;
- // *TODO: To be removed when a way to request the current voice channel
- // moderation mode is implemented: See EXT-6937
- bool mModerateModeHandledFirstTime;
+ // *TODO: To be removed when a way to request the current voice channel
+ // moderation mode is implemented: See EXT-6937
+ bool mModerateModeHandledFirstTime;
};
class LLIMSpeakerMgr : public LLSpeakerMgr
{
- LOG_CLASS(LLIMSpeakerMgr);
+ LOG_CLASS(LLIMSpeakerMgr);
public:
- LLIMSpeakerMgr(LLVoiceChannel* channel);
-
- void updateSpeakers(const LLSD& update);
- void setSpeakers(const LLSD& speakers);
-
- void toggleAllowTextChat(const LLUUID& speaker_id);
-
- /**
- * Mutes/Unmutes avatar for current group voice chat.
- *
- * It only marks avatar as muted for session and does not use local Agent's Block list.
- * It does not mute Agent itself.
- *
- * @param[in] avatar_id UUID of avatar to be processed
- * @param[in] unmute if false - specified avatar will be muted, otherwise - unmuted.
- *
- * @see moderateVoiceAllParticipants()
- */
- void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute);
-
- /**
- * Mutes/Unmutes all avatars for current group voice chat.
- *
- * It only marks avatars as muted for session and does not use local Agent's Block list.
- * It calls forceVoiceModeratedMode() in case of session is already in requested state.
- *
- * @param[in] unmute_everyone if false - avatars will be muted, otherwise - unmuted.
- *
- * @see moderateVoiceParticipant()
- */
- void moderateVoiceAllParticipants(bool unmute_everyone);
-
- void processSessionUpdate(const LLSD& session_update);
+ LLIMSpeakerMgr(LLVoiceChannel* channel);
+
+ void updateSpeakers(const LLSD& update);
+ void setSpeakers(const LLSD& speakers);
+
+ void toggleAllowTextChat(const LLUUID& speaker_id);
+
+ /**
+ * Mutes/Unmutes avatar for current group voice chat.
+ *
+ * It only marks avatar as muted for session and does not use local Agent's Block list.
+ * It does not mute Agent itself.
+ *
+ * @param[in] avatar_id UUID of avatar to be processed
+ * @param[in] unmute if false - specified avatar will be muted, otherwise - unmuted.
+ *
+ * @see moderateVoiceAllParticipants()
+ */
+ void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute);
+
+ /**
+ * Mutes/Unmutes all avatars for current group voice chat.
+ *
+ * It only marks avatars as muted for session and does not use local Agent's Block list.
+ * It calls forceVoiceModeratedMode() in case of session is already in requested state.
+ *
+ * @param[in] unmute_everyone if false - avatars will be muted, otherwise - unmuted.
+ *
+ * @see moderateVoiceParticipant()
+ */
+ void moderateVoiceAllParticipants(bool unmute_everyone);
+
+ void processSessionUpdate(const LLSD& session_update);
protected:
- virtual void updateSpeakerList();
+ virtual void updateSpeakerList();
- void moderateVoiceSession(const LLUUID& session_id, bool disallow_voice);
+ void moderateVoiceSession(const LLUUID& session_id, bool disallow_voice);
- /**
- * Process all participants to mute/unmute them according to passed voice session state.
- */
- void forceVoiceModeratedMode(bool should_be_muted);
+ /**
+ * Process all participants to mute/unmute them according to passed voice session state.
+ */
+ void forceVoiceModeratedMode(bool should_be_muted);
void moderationActionCoro(std::string url, LLSD action);
@@ -334,20 +334,20 @@ protected:
class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLActiveSpeakerMgr>
{
- LLSINGLETON(LLActiveSpeakerMgr);
- LOG_CLASS(LLActiveSpeakerMgr);
+ LLSINGLETON(LLActiveSpeakerMgr);
+ LOG_CLASS(LLActiveSpeakerMgr);
protected:
- virtual void updateSpeakerList() override;
+ virtual void updateSpeakerList() override;
};
class LLLocalSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLLocalSpeakerMgr>
{
- LLSINGLETON(LLLocalSpeakerMgr);
- ~LLLocalSpeakerMgr ();
- LOG_CLASS(LLLocalSpeakerMgr);
+ LLSINGLETON(LLLocalSpeakerMgr);
+ ~LLLocalSpeakerMgr ();
+ LOG_CLASS(LLLocalSpeakerMgr);
protected:
- virtual void updateSpeakerList() override;
+ virtual void updateSpeakerList() override;
};
#endif // LL_LLSPEAKERS_H
diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp
index c4c9673be3..f16ab3b25a 100644
--- a/indra/newview/llspeakingindicatormanager.cpp
+++ b/indra/newview/llspeakingindicatormanager.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llspeakingindicatormanager.cpp
* @author Mike Antipov
* @brief Implementation of SpeackerIndicatorManager class to process registered LLSpeackerIndicator
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,139 +41,139 @@
*
* It stores passed instances of LLOutputMonitorCtrl in a multimap by avatar LLUUID.
* It observes changing of voice channel and changing of participant list in voice channel.
- * When voice channel or voice participant list is changed it updates visibility of an appropriate
+ * When voice channel or voice participant list is changed it updates visibility of an appropriate
* speaking indicator.
*
* Several indicators can be registered for the same avatar.
*/
class SpeakingIndicatorManager : public LLSingleton<SpeakingIndicatorManager>, LLVoiceClientParticipantObserver
{
- LLSINGLETON(SpeakingIndicatorManager);
- ~SpeakingIndicatorManager();
- LOG_CLASS(SpeakingIndicatorManager);
+ LLSINGLETON(SpeakingIndicatorManager);
+ ~SpeakingIndicatorManager();
+ LOG_CLASS(SpeakingIndicatorManager);
protected:
void cleanupSingleton() override;
public:
- /**
- * Stores passed speaking indicator to control its visibility.
- *
- * Registered indicator is set visible if an appropriate avatar is in the same voice channel with Agent.
- * It ignores instances of Agent's indicator.
- *
- * @param speaker_id LLUUID of an avatar whose speaking indicator is registered.
- * @param speaking_indicator instance of the speaking indicator to be registered.
- * @param session_id session UUID for which indicator should be shown only.
- * If this parameter is set registered indicator will be shown only in voice channel
- * which has the same session id (EXT-5562).
- */
- void registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator,
- const LLUUID& session_id = LLUUID::null);
-
- /**
- * Removes passed speaking indicator from observing.
- *
- * @param speaker_id LLUUID of an avatar whose speaking indicator should be unregistered.
- * @param speaking_indicator instance of the speaking indicator to be unregistered.
- */
- void unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator);
-
- /**
- * Callback of changing voice participant list (from LLVoiceClientParticipantObserver).
- *
- * Switches off indicators had been switched on and switches on indicators of current participants list.
- * There is only a few indicators in lists should be switched off/on.
- * So, method does not calculate difference between these list it only switches off already
- * switched on indicators and switches on indicators of voice channel participants
- */
- void onParticipantsChanged() override;
-
+ /**
+ * Stores passed speaking indicator to control its visibility.
+ *
+ * Registered indicator is set visible if an appropriate avatar is in the same voice channel with Agent.
+ * It ignores instances of Agent's indicator.
+ *
+ * @param speaker_id LLUUID of an avatar whose speaking indicator is registered.
+ * @param speaking_indicator instance of the speaking indicator to be registered.
+ * @param session_id session UUID for which indicator should be shown only.
+ * If this parameter is set registered indicator will be shown only in voice channel
+ * which has the same session id (EXT-5562).
+ */
+ void registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator,
+ const LLUUID& session_id = LLUUID::null);
+
+ /**
+ * Removes passed speaking indicator from observing.
+ *
+ * @param speaker_id LLUUID of an avatar whose speaking indicator should be unregistered.
+ * @param speaking_indicator instance of the speaking indicator to be unregistered.
+ */
+ void unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator);
+
+ /**
+ * Callback of changing voice participant list (from LLVoiceClientParticipantObserver).
+ *
+ * Switches off indicators had been switched on and switches on indicators of current participants list.
+ * There is only a few indicators in lists should be switched off/on.
+ * So, method does not calculate difference between these list it only switches off already
+ * switched on indicators and switches on indicators of voice channel participants
+ */
+ void onParticipantsChanged() override;
+
private:
- typedef std::set<LLUUID> speaker_ids_t;
- typedef std::multimap<LLUUID, LLSpeakingIndicator*> speaking_indicators_mmap_t;
- typedef speaking_indicators_mmap_t::value_type speaking_indicator_value_t;
- typedef speaking_indicators_mmap_t::const_iterator indicator_const_iterator;
- typedef std::pair<indicator_const_iterator, indicator_const_iterator> indicator_range_t;
-
- /**
- * Callback to determine when voice channel is changed.
- *
- * It switches all registered speaking indicators off.
- * To reduce overheads only switched on indicators are processed.
- */
- void sOnCurrentChannelChanged(const LLUUID& session_id);
-
- /**
- * Changes state of indicators specified by LLUUIDs
- *
- * @param speakers_uuids - avatars' LLUUIDs whose speaking indicators should be switched
- * @param switch_on - if TRUE specified indicator will be switched on, off otherwise.
- */
- void switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on);
-
- /**
- * Ensures that passed instance of Speaking Indicator does not exist among registered ones.
- * If yes, it will be removed.
- */
- void ensureInstanceDoesNotExist(LLSpeakingIndicator* const speaking_indicator);
-
-
- /**
- * Multimap with all registered speaking indicators
- */
- speaking_indicators_mmap_t mSpeakingIndicators;
-
- /**
- * LUUIDs of avatar for which we have speaking indicators switched on.
- *
- * Is used to switch off all previously ON indicators when voice participant list is changed.
- *
- * @see onChange()
- */
- speaker_ids_t mSwitchedIndicatorsOn;
+ typedef std::set<LLUUID> speaker_ids_t;
+ typedef std::multimap<LLUUID, LLSpeakingIndicator*> speaking_indicators_mmap_t;
+ typedef speaking_indicators_mmap_t::value_type speaking_indicator_value_t;
+ typedef speaking_indicators_mmap_t::const_iterator indicator_const_iterator;
+ typedef std::pair<indicator_const_iterator, indicator_const_iterator> indicator_range_t;
+
+ /**
+ * Callback to determine when voice channel is changed.
+ *
+ * It switches all registered speaking indicators off.
+ * To reduce overheads only switched on indicators are processed.
+ */
+ void sOnCurrentChannelChanged(const LLUUID& session_id);
+
+ /**
+ * Changes state of indicators specified by LLUUIDs
+ *
+ * @param speakers_uuids - avatars' LLUUIDs whose speaking indicators should be switched
+ * @param switch_on - if TRUE specified indicator will be switched on, off otherwise.
+ */
+ void switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on);
+
+ /**
+ * Ensures that passed instance of Speaking Indicator does not exist among registered ones.
+ * If yes, it will be removed.
+ */
+ void ensureInstanceDoesNotExist(LLSpeakingIndicator* const speaking_indicator);
+
+
+ /**
+ * Multimap with all registered speaking indicators
+ */
+ speaking_indicators_mmap_t mSpeakingIndicators;
+
+ /**
+ * LUUIDs of avatar for which we have speaking indicators switched on.
+ *
+ * Is used to switch off all previously ON indicators when voice participant list is changed.
+ *
+ * @see onChange()
+ */
+ speaker_ids_t mSwitchedIndicatorsOn;
};
//////////////////////////////////////////////////////////////////////////
// PUBLIC SECTION
//////////////////////////////////////////////////////////////////////////
void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator,
- const LLUUID& session_id)
+ const LLUUID& session_id)
{
- // do not exclude agent's indicators. They should be processed in the same way as others. See EXT-3889.
+ // do not exclude agent's indicators. They should be processed in the same way as others. See EXT-3889.
- LL_DEBUGS("SpeakingIndicator") << "Registering indicator: " << speaker_id << "|"<< speaking_indicator << ", session: " << session_id << LL_ENDL;
+ LL_DEBUGS("SpeakingIndicator") << "Registering indicator: " << speaker_id << "|"<< speaking_indicator << ", session: " << session_id << LL_ENDL;
- ensureInstanceDoesNotExist(speaking_indicator);
+ ensureInstanceDoesNotExist(speaking_indicator);
- speaking_indicator->setTargetSessionID(session_id);
+ speaking_indicator->setTargetSessionID(session_id);
- speaking_indicator_value_t value_type(speaker_id, speaking_indicator);
- mSpeakingIndicators.insert(value_type);
+ speaking_indicator_value_t value_type(speaker_id, speaking_indicator);
+ mSpeakingIndicators.insert(value_type);
- speaker_ids_t speakers_uuids;
- BOOL is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id);
+ speaker_ids_t speakers_uuids;
+ BOOL is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id);
- speakers_uuids.insert(speaker_id);
- switchSpeakerIndicators(speakers_uuids, is_in_same_voice);
+ speakers_uuids.insert(speaker_id);
+ switchSpeakerIndicators(speakers_uuids, is_in_same_voice);
}
void SpeakingIndicatorManager::unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator)
{
- LL_DEBUGS("SpeakingIndicator") << "Unregistering indicator: " << speaker_id << "|"<< speaking_indicator << LL_ENDL;
- speaking_indicators_mmap_t::iterator it;
- it = mSpeakingIndicators.find(speaker_id);
- for (;it != mSpeakingIndicators.end(); ++it)
- {
- if (it->second == speaking_indicator)
- {
- LL_DEBUGS("SpeakingIndicator") << "Unregistered." << LL_ENDL;
- mSpeakingIndicators.erase(it);
- break;
- }
- }
+ LL_DEBUGS("SpeakingIndicator") << "Unregistering indicator: " << speaker_id << "|"<< speaking_indicator << LL_ENDL;
+ speaking_indicators_mmap_t::iterator it;
+ it = mSpeakingIndicators.find(speaker_id);
+ for (;it != mSpeakingIndicators.end(); ++it)
+ {
+ if (it->second == speaking_indicator)
+ {
+ LL_DEBUGS("SpeakingIndicator") << "Unregistered." << LL_ENDL;
+ mSpeakingIndicators.erase(it);
+ break;
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -181,8 +181,8 @@ void SpeakingIndicatorManager::unregisterSpeakingIndicator(const LLUUID& speaker
//////////////////////////////////////////////////////////////////////////
SpeakingIndicatorManager::SpeakingIndicatorManager()
{
- LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&SpeakingIndicatorManager::sOnCurrentChannelChanged, this, _1));
- LLVoiceClient::getInstance()->addObserver(this);
+ LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&SpeakingIndicatorManager::sOnCurrentChannelChanged, this, _1));
+ LLVoiceClient::getInstance()->addObserver(this);
}
SpeakingIndicatorManager::~SpeakingIndicatorManager()
@@ -201,94 +201,94 @@ void SpeakingIndicatorManager::cleanupSingleton()
void SpeakingIndicatorManager::sOnCurrentChannelChanged(const LLUUID& /*session_id*/)
{
- switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE);
- mSwitchedIndicatorsOn.clear();
+ switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE);
+ mSwitchedIndicatorsOn.clear();
}
void SpeakingIndicatorManager::onParticipantsChanged()
{
- LL_DEBUGS("SpeakingIndicator") << "Voice participant list was changed, updating indicators" << LL_ENDL;
+ LL_DEBUGS("SpeakingIndicator") << "Voice participant list was changed, updating indicators" << LL_ENDL;
- speaker_ids_t speakers_uuids;
- LLVoiceClient::getInstance()->getParticipantList(speakers_uuids);
+ speaker_ids_t speakers_uuids;
+ LLVoiceClient::getInstance()->getParticipantList(speakers_uuids);
- LL_DEBUGS("SpeakingIndicator") << "Switching all OFF, count: " << mSwitchedIndicatorsOn.size() << LL_ENDL;
- // switch all indicators off
- switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE);
- mSwitchedIndicatorsOn.clear();
+ LL_DEBUGS("SpeakingIndicator") << "Switching all OFF, count: " << mSwitchedIndicatorsOn.size() << LL_ENDL;
+ // switch all indicators off
+ switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE);
+ mSwitchedIndicatorsOn.clear();
- LL_DEBUGS("SpeakingIndicator") << "Switching all ON, count: " << speakers_uuids.size() << LL_ENDL;
- // then switch current voice participants indicators on
- switchSpeakerIndicators(speakers_uuids, TRUE);
+ LL_DEBUGS("SpeakingIndicator") << "Switching all ON, count: " << speakers_uuids.size() << LL_ENDL;
+ // then switch current voice participants indicators on
+ switchSpeakerIndicators(speakers_uuids, TRUE);
}
void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on)
{
- LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
- LLUUID session_id;
- if (voice_channel)
- {
- session_id = voice_channel->getSessionID();
- }
-
- speaker_ids_t::const_iterator it_uuid = speakers_uuids.begin();
- for (; it_uuid != speakers_uuids.end(); ++it_uuid)
- {
- LL_DEBUGS("SpeakingIndicator") << "Looking for indicator: " << *it_uuid << LL_ENDL;
- indicator_range_t it_range = mSpeakingIndicators.equal_range(*it_uuid);
- indicator_const_iterator it_indicator = it_range.first;
- bool was_found = false;
- bool was_switched_on = false;
- for (; it_indicator != it_range.second; ++it_indicator)
- {
- was_found = true;
- LLSpeakingIndicator* indicator = (*it_indicator).second;
- was_switched_on = was_switched_on || switch_on;
-
- indicator->switchIndicator(switch_on);
- }
-
- if (was_found)
- {
- LL_DEBUGS("SpeakingIndicator") << mSpeakingIndicators.count(*it_uuid) << " indicators were found" << LL_ENDL;
-
- if (switch_on && !was_switched_on)
- {
- LL_DEBUGS("SpeakingIndicator") << "but none of them were switched on" << LL_ENDL;
- }
-
- if (was_switched_on)
- {
- // store switched on indicator to be able switch it off
- mSwitchedIndicatorsOn.insert(*it_uuid);
- }
- }
- }
+ LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
+ LLUUID session_id;
+ if (voice_channel)
+ {
+ session_id = voice_channel->getSessionID();
+ }
+
+ speaker_ids_t::const_iterator it_uuid = speakers_uuids.begin();
+ for (; it_uuid != speakers_uuids.end(); ++it_uuid)
+ {
+ LL_DEBUGS("SpeakingIndicator") << "Looking for indicator: " << *it_uuid << LL_ENDL;
+ indicator_range_t it_range = mSpeakingIndicators.equal_range(*it_uuid);
+ indicator_const_iterator it_indicator = it_range.first;
+ bool was_found = false;
+ bool was_switched_on = false;
+ for (; it_indicator != it_range.second; ++it_indicator)
+ {
+ was_found = true;
+ LLSpeakingIndicator* indicator = (*it_indicator).second;
+ was_switched_on = was_switched_on || switch_on;
+
+ indicator->switchIndicator(switch_on);
+ }
+
+ if (was_found)
+ {
+ LL_DEBUGS("SpeakingIndicator") << mSpeakingIndicators.count(*it_uuid) << " indicators were found" << LL_ENDL;
+
+ if (switch_on && !was_switched_on)
+ {
+ LL_DEBUGS("SpeakingIndicator") << "but none of them were switched on" << LL_ENDL;
+ }
+
+ if (was_switched_on)
+ {
+ // store switched on indicator to be able switch it off
+ mSwitchedIndicatorsOn.insert(*it_uuid);
+ }
+ }
+ }
}
void SpeakingIndicatorManager::ensureInstanceDoesNotExist(LLSpeakingIndicator* const speaking_indicator)
{
- LL_DEBUGS("SpeakingIndicator") << "Searching for an registered indicator instance: " << speaking_indicator << LL_ENDL;
- speaking_indicators_mmap_t::iterator it = mSpeakingIndicators.begin();
- for (;it != mSpeakingIndicators.end(); ++it)
- {
- if (it->second == speaking_indicator)
- {
- LL_DEBUGS("SpeakingIndicator") << "Found" << LL_ENDL;
- break;
- }
- }
-
- // It is possible with LLOutputMonitorCtrl the same instance of indicator is registered several
- // times with different UUIDs. This leads to crash after instance is destroyed because the
- // only one (specified by UUID in unregisterSpeakingIndicator()) is removed from the map.
- // So, using stored deleted pointer leads to crash. See EXT-4782.
- if (it != mSpeakingIndicators.end())
- {
- LL_WARNS() << "The same instance of indicator has already been registered, removing it: " << it->first << "|"<< speaking_indicator << LL_ENDL;
- llassert(it == mSpeakingIndicators.end());
- mSpeakingIndicators.erase(it);
- }
+ LL_DEBUGS("SpeakingIndicator") << "Searching for an registered indicator instance: " << speaking_indicator << LL_ENDL;
+ speaking_indicators_mmap_t::iterator it = mSpeakingIndicators.begin();
+ for (;it != mSpeakingIndicators.end(); ++it)
+ {
+ if (it->second == speaking_indicator)
+ {
+ LL_DEBUGS("SpeakingIndicator") << "Found" << LL_ENDL;
+ break;
+ }
+ }
+
+ // It is possible with LLOutputMonitorCtrl the same instance of indicator is registered several
+ // times with different UUIDs. This leads to crash after instance is destroyed because the
+ // only one (specified by UUID in unregisterSpeakingIndicator()) is removed from the map.
+ // So, using stored deleted pointer leads to crash. See EXT-4782.
+ if (it != mSpeakingIndicators.end())
+ {
+ LL_WARNS() << "The same instance of indicator has already been registered, removing it: " << it->first << "|"<< speaking_indicator << LL_ENDL;
+ llassert(it == mSpeakingIndicators.end());
+ mSpeakingIndicators.erase(it);
+ }
}
@@ -297,25 +297,25 @@ void SpeakingIndicatorManager::ensureInstanceDoesNotExist(LLSpeakingIndicator* c
/************************************************************************/
void LLSpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator,
- const LLUUID& session_id)
+ const LLUUID& session_id)
{
- SpeakingIndicatorManager::instance().registerSpeakingIndicator(speaker_id, speaking_indicator, session_id);
+ SpeakingIndicatorManager::instance().registerSpeakingIndicator(speaker_id, speaking_indicator, session_id);
}
void LLSpeakingIndicatorManager::unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator)
{
- if(SpeakingIndicatorManager::instanceExists())
- {
- SpeakingIndicatorManager::instance().unregisterSpeakingIndicator(speaker_id, speaking_indicator);
- }
+ if(SpeakingIndicatorManager::instanceExists())
+ {
+ SpeakingIndicatorManager::instance().unregisterSpeakingIndicator(speaker_id, speaking_indicator);
+ }
}
void LLSpeakingIndicatorManager::updateSpeakingIndicators()
{
- if(SpeakingIndicatorManager::instanceExists())
- {
- SpeakingIndicatorManager::instance().onParticipantsChanged();
- }
+ if(SpeakingIndicatorManager::instanceExists())
+ {
+ SpeakingIndicatorManager::instance().onParticipantsChanged();
+ }
}
// EOF
diff --git a/indra/newview/llspeakingindicatormanager.h b/indra/newview/llspeakingindicatormanager.h
index e5afcd1cb7..78d56268d2 100644
--- a/indra/newview/llspeakingindicatormanager.h
+++ b/indra/newview/llspeakingindicatormanager.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llspeakingindicatormanager.h
* @author Mike Antipov
* @brief Interfeace of LLSpeackerIndicator class to be processed depend on avatars are in the same voice channel.
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,55 +34,55 @@ class SpeakingIndicatorManager;
class LLSpeakingIndicator
{
public:
- virtual ~LLSpeakingIndicator(){}
- virtual void switchIndicator(bool switch_on) = 0;
+ virtual ~LLSpeakingIndicator(){}
+ virtual void switchIndicator(bool switch_on) = 0;
private:
- friend class SpeakingIndicatorManager;
- // Accessors for target voice session UUID.
- // They are intended to be used only from SpeakingIndicatorManager to ensure target session is
- // the same indicator was registered with.
- void setTargetSessionID(const LLUUID& session_id) { mTargetSessionID = session_id; }
- const LLUUID& getTargetSessionID() { return mTargetSessionID; }
+ friend class SpeakingIndicatorManager;
+ // Accessors for target voice session UUID.
+ // They are intended to be used only from SpeakingIndicatorManager to ensure target session is
+ // the same indicator was registered with.
+ void setTargetSessionID(const LLUUID& session_id) { mTargetSessionID = session_id; }
+ const LLUUID& getTargetSessionID() { return mTargetSessionID; }
- /**
- * session UUID for which indicator should be shown only.
- * If it is set, registered indicator will be shown only in voice channel
- * which has the same session id (EXT-5562).
- */
- LLUUID mTargetSessionID;
+ /**
+ * session UUID for which indicator should be shown only.
+ * If it is set, registered indicator will be shown only in voice channel
+ * which has the same session id (EXT-5562).
+ */
+ LLUUID mTargetSessionID;
};
// See EXT-3976.
namespace LLSpeakingIndicatorManager
{
- /**
- * Stores passed speaking indicator to control its visibility.
- *
- * Registered indicator is set visible if an appropriate avatar is in the same voice channel with Agent.
- * It ignores instances of Agent's indicator.
- *
- * @param speaker_id LLUUID of an avatar whose speaker indicator is registered.
- * @param speaking_indicator instance of the speaker indicator to be registered.
- * @param session_id session UUID for which indicator should be shown only.
- * If this parameter is set registered indicator will be shown only in voice channel
- * which has the same session id (EXT-5562).
- */
- void registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator,
- const LLUUID& session_id);
+ /**
+ * Stores passed speaking indicator to control its visibility.
+ *
+ * Registered indicator is set visible if an appropriate avatar is in the same voice channel with Agent.
+ * It ignores instances of Agent's indicator.
+ *
+ * @param speaker_id LLUUID of an avatar whose speaker indicator is registered.
+ * @param speaking_indicator instance of the speaker indicator to be registered.
+ * @param session_id session UUID for which indicator should be shown only.
+ * If this parameter is set registered indicator will be shown only in voice channel
+ * which has the same session id (EXT-5562).
+ */
+ void registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator,
+ const LLUUID& session_id);
- /**
- * Removes passed speaking indicator from observing.
- *
- * @param speaker_id LLUUID of an avatar whose speaker indicator should be unregistered.
- * @param speaking_indicator instance of the speaker indicator to be unregistered.
- */
- void unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator);
+ /**
+ * Removes passed speaking indicator from observing.
+ *
+ * @param speaker_id LLUUID of an avatar whose speaker indicator should be unregistered.
+ * @param speaking_indicator instance of the speaker indicator to be unregistered.
+ */
+ void unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator);
- /**
- * Switch on/off registered speaking indicator according to the most current voice client status
- */
- void updateSpeakingIndicators();
+ /**
+ * Switch on/off registered speaking indicator according to the most current voice client status
+ */
+ void updateSpeakingIndicators();
}
#endif // LL_LLSPEAKINGINDICATORMANAGER_H
diff --git a/indra/newview/llsplitbutton.cpp b/indra/newview/llsplitbutton.cpp
index 790305103d..60c0272a8b 100644
--- a/indra/newview/llsplitbutton.cpp
+++ b/indra/newview/llsplitbutton.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsplitbutton.cpp
* @brief LLSplitButton base class
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,8 +44,8 @@ static LLDefaultChildRegistry::Register<LLSplitButton> split_button("split_butto
void LLSplitButton::ArrowPositionValues::declareValues()
{
- declare("left", LEFT);
- declare("right", RIGHT);
+ declare("left", LEFT);
+ declare("right", RIGHT);
}
LLSplitButton::ItemParams::ItemParams()
@@ -53,214 +53,214 @@ LLSplitButton::ItemParams::ItemParams()
}
LLSplitButton::Params::Params()
-: arrow_position("arrow_position", LEFT),
- items("item"),
- arrow_button("arrow_button"),
- items_panel("items_panel")
+: arrow_position("arrow_position", LEFT),
+ items("item"),
+ arrow_button("arrow_button"),
+ items_panel("items_panel")
{
}
void LLSplitButton::onFocusLost()
{
- hideButtons();
- LLUICtrl::onFocusLost();
+ hideButtons();
+ LLUICtrl::onFocusLost();
}
void LLSplitButton::setFocus(BOOL b)
{
- LLUICtrl::setFocus(b);
-
- if (b)
- {
- if (mItemsPanel && mItemsPanel->getVisible())
- {
- mItemsPanel->setFocus(TRUE);
- }
- }
+ LLUICtrl::setFocus(b);
+
+ if (b)
+ {
+ if (mItemsPanel && mItemsPanel->getVisible())
+ {
+ mItemsPanel->setFocus(TRUE);
+ }
+ }
}
void LLSplitButton::setEnabled(BOOL enabled)
{
- LLView::setEnabled(enabled);
- mArrowBtn->setEnabled(enabled);
+ LLView::setEnabled(enabled);
+ mArrowBtn->setEnabled(enabled);
}
void LLSplitButton::onArrowBtnDown()
{
- if (!mItemsPanel->getVisible())
- {
- showButtons();
-
- setFocus(TRUE);
-
- if (mArrowBtn->hasMouseCapture() || mShownItem->hasMouseCapture())
- {
- gFocusMgr.setMouseCapture(this);
- }
- }
- else
- {
- hideButtons();
- }
+ if (!mItemsPanel->getVisible())
+ {
+ showButtons();
+
+ setFocus(TRUE);
+
+ if (mArrowBtn->hasMouseCapture() || mShownItem->hasMouseCapture())
+ {
+ gFocusMgr.setMouseCapture(this);
+ }
+ }
+ else
+ {
+ hideButtons();
+ }
}
void LLSplitButton::onHeldDownShownButton()
{
- if (!mItemsPanel->getVisible()) onArrowBtnDown();
+ if (!mItemsPanel->getVisible()) onArrowBtnDown();
}
void LLSplitButton::onItemSelected(LLUICtrl* ctrl)
{
- if (!ctrl) return;
+ if (!ctrl) return;
- hideButtons();
+ hideButtons();
- // call the callback if it exists
- if(!mSelectionCallback.empty())
- {
- mSelectionCallback(this, ctrl->getName());
- }
+ // call the callback if it exists
+ if(!mSelectionCallback.empty())
+ {
+ mSelectionCallback(this, ctrl->getName());
+ }
- gFocusMgr.setKeyboardFocus(NULL);
+ gFocusMgr.setKeyboardFocus(NULL);
}
BOOL LLSplitButton::handleMouseUp(S32 x, S32 y, MASK mask)
{
- gFocusMgr.setMouseCapture(NULL);
-
- if (mShownItem->parentPointInView(x, y))
- {
- onItemSelected(mShownItem);
- return TRUE;
- }
-
- for (std::list<LLButton*>::const_iterator it = mHidenItems.begin(); it != mHidenItems.end(); ++it)
- {
- LLButton* item = *it;
-
- S32 panel_x = 0;
- S32 panel_y = 0;
- localPointToOtherView(x, y, &panel_x, &panel_y, mItemsPanel);
-
- if (item->parentPointInView(panel_x, panel_y))
- {
- onItemSelected(item);
- return TRUE;
- }
- }
- return TRUE;
+ gFocusMgr.setMouseCapture(NULL);
+
+ if (mShownItem->parentPointInView(x, y))
+ {
+ onItemSelected(mShownItem);
+ return TRUE;
+ }
+
+ for (std::list<LLButton*>::const_iterator it = mHidenItems.begin(); it != mHidenItems.end(); ++it)
+ {
+ LLButton* item = *it;
+
+ S32 panel_x = 0;
+ S32 panel_y = 0;
+ localPointToOtherView(x, y, &panel_x, &panel_y, mItemsPanel);
+
+ if (item->parentPointInView(panel_x, panel_y))
+ {
+ onItemSelected(item);
+ return TRUE;
+ }
+ }
+ return TRUE;
}
void LLSplitButton::showButtons()
{
- mItemsPanel->setOrigin(0, getRect().getHeight());
+ mItemsPanel->setOrigin(0, getRect().getHeight());
- // register ourselves as a "top" control
- // effectively putting us into a special draw layer
- gViewerWindow->addPopup(this);
+ // register ourselves as a "top" control
+ // effectively putting us into a special draw layer
+ gViewerWindow->addPopup(this);
- mItemsPanel->setFocus(TRUE);
+ mItemsPanel->setFocus(TRUE);
- //push arrow button down and show the item buttons
- mArrowBtn->setToggleState(TRUE);
- mItemsPanel->setVisible(TRUE);
+ //push arrow button down and show the item buttons
+ mArrowBtn->setToggleState(TRUE);
+ mItemsPanel->setVisible(TRUE);
- setUseBoundingRect(TRUE);
+ setUseBoundingRect(TRUE);
}
void LLSplitButton::hideButtons()
{
- mItemsPanel->setVisible(FALSE);
- mArrowBtn->setToggleState(FALSE);
+ mItemsPanel->setVisible(FALSE);
+ mArrowBtn->setToggleState(FALSE);
- setUseBoundingRect(FALSE);
- gViewerWindow->removePopup(this);
+ setUseBoundingRect(FALSE);
+ gViewerWindow->removePopup(this);
}
// protected/private
LLSplitButton::LLSplitButton(const LLSplitButton::Params& p)
-: LLUICtrl(p),
- mArrowBtn(NULL),
- mShownItem(NULL),
- mItemsPanel(NULL),
- mArrowPosition(p.arrow_position)
+: LLUICtrl(p),
+ mArrowBtn(NULL),
+ mShownItem(NULL),
+ mItemsPanel(NULL),
+ mArrowPosition(p.arrow_position)
{
- LLRect rc(p.rect);
-
- LLButton::Params arrow_params = p.arrow_button;
- S32 arrow_width = p.arrow_button.rect.width;
-
- //Default arrow rect values for LEFT arrow position
- S32 arrow_left = 0;
- S32 arrow_right = arrow_width;
- S32 btn_left = arrow_width;
- S32 btn_right = rc.getWidth();
-
- if (mArrowPosition == RIGHT)
- {
- arrow_left = rc.getWidth()- arrow_width;
- arrow_right = rc.getWidth();
- btn_left = 0;
- btn_right = arrow_left;
- }
-
- arrow_params.rect(LLRect(arrow_left, rc.getHeight(), arrow_right, 0));
- arrow_params.label("");
- arrow_params.mouse_down_callback.function(boost::bind(&LLSplitButton::onArrowBtnDown, this));
- mArrowBtn = LLUICtrlFactory::create<LLButton>(arrow_params);
- addChild(mArrowBtn);
-
- //a panel for hidden item buttons
- LLPanel::Params panel_params = p.items_panel;
- mItemsPanel= prepareItemsPanel(panel_params, p.items.numValidElements());
- addChild(mItemsPanel);
-
-
- LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items.begin();
-
- //processing shown item button
- mShownItem = prepareItemButton(*it);
- mShownItem->setHeldDownCallback(boost::bind(&LLSplitButton::onHeldDownShownButton, this));
- mShownItem->setMouseUpCallback(boost::bind(&LLSplitButton::onItemSelected, this, _1));
- mShownItem->setRect(LLRect(btn_left, rc.getHeight(), btn_right, 0));
- addChild(mShownItem);
-
- //processing hidden item buttons
- S32 item_top = mItemsPanel->getRect().getHeight();
- for (++it; it != p.items.end(); ++it)
- {
- LLButton* hidden_button = prepareItemButton(*it);
- hidden_button->setRect(LLRect(btn_left, item_top, btn_right, item_top - rc.getHeight()));
- hidden_button->setMouseDownCallback(boost::bind(&LLSplitButton::onItemSelected, this, _1));
- mHidenItems.push_back(hidden_button);
- mItemsPanel->addChild(hidden_button);
-
- //calculate next button's top
- item_top -= (rc.getHeight() + BUTTON_PAD);
- }
-
- setTopLostCallback(boost::bind(&LLSplitButton::hideButtons, this));
+ LLRect rc(p.rect);
+
+ LLButton::Params arrow_params = p.arrow_button;
+ S32 arrow_width = p.arrow_button.rect.width;
+
+ //Default arrow rect values for LEFT arrow position
+ S32 arrow_left = 0;
+ S32 arrow_right = arrow_width;
+ S32 btn_left = arrow_width;
+ S32 btn_right = rc.getWidth();
+
+ if (mArrowPosition == RIGHT)
+ {
+ arrow_left = rc.getWidth()- arrow_width;
+ arrow_right = rc.getWidth();
+ btn_left = 0;
+ btn_right = arrow_left;
+ }
+
+ arrow_params.rect(LLRect(arrow_left, rc.getHeight(), arrow_right, 0));
+ arrow_params.label("");
+ arrow_params.mouse_down_callback.function(boost::bind(&LLSplitButton::onArrowBtnDown, this));
+ mArrowBtn = LLUICtrlFactory::create<LLButton>(arrow_params);
+ addChild(mArrowBtn);
+
+ //a panel for hidden item buttons
+ LLPanel::Params panel_params = p.items_panel;
+ mItemsPanel= prepareItemsPanel(panel_params, p.items.numValidElements());
+ addChild(mItemsPanel);
+
+
+ LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items.begin();
+
+ //processing shown item button
+ mShownItem = prepareItemButton(*it);
+ mShownItem->setHeldDownCallback(boost::bind(&LLSplitButton::onHeldDownShownButton, this));
+ mShownItem->setMouseUpCallback(boost::bind(&LLSplitButton::onItemSelected, this, _1));
+ mShownItem->setRect(LLRect(btn_left, rc.getHeight(), btn_right, 0));
+ addChild(mShownItem);
+
+ //processing hidden item buttons
+ S32 item_top = mItemsPanel->getRect().getHeight();
+ for (++it; it != p.items.end(); ++it)
+ {
+ LLButton* hidden_button = prepareItemButton(*it);
+ hidden_button->setRect(LLRect(btn_left, item_top, btn_right, item_top - rc.getHeight()));
+ hidden_button->setMouseDownCallback(boost::bind(&LLSplitButton::onItemSelected, this, _1));
+ mHidenItems.push_back(hidden_button);
+ mItemsPanel->addChild(hidden_button);
+
+ //calculate next button's top
+ item_top -= (rc.getHeight() + BUTTON_PAD);
+ }
+
+ setTopLostCallback(boost::bind(&LLSplitButton::hideButtons, this));
}
LLButton* LLSplitButton::prepareItemButton(LLButton::Params params)
{
- params.label("");
- params.is_toggle(false);
- return LLUICtrlFactory::create<LLButton>(params);
+ params.label("");
+ params.is_toggle(false);
+ return LLUICtrlFactory::create<LLButton>(params);
}
LLPanel* LLSplitButton::prepareItemsPanel(LLPanel::Params params, S32 items_count)
{
- S32 num_hiden_btns = items_count - 1;
- S32 panel_height = num_hiden_btns * (getRect().getHeight() + BUTTON_PAD);
- params.visible(false);
- params.rect.width(getRect().getWidth());
- params.rect.height(panel_height);
- return LLUICtrlFactory::create<LLPanel>(params);
+ S32 num_hiden_btns = items_count - 1;
+ S32 panel_height = num_hiden_btns * (getRect().getHeight() + BUTTON_PAD);
+ params.visible(false);
+ params.rect.width(getRect().getWidth());
+ params.rect.height(panel_height);
+ return LLUICtrlFactory::create<LLPanel>(params);
}
diff --git a/indra/newview/llsplitbutton.h b/indra/newview/llsplitbutton.h
index 4f20c8b379..427ed7ba76 100644
--- a/indra/newview/llsplitbutton.h
+++ b/indra/newview/llsplitbutton.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsplitbutton.h
* @brief LLSplitButton base class
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,69 +37,69 @@
#define LL_LLSPLITBUTTON_H
class LLSplitButton
- : public LLUICtrl
+ : public LLUICtrl
{
public:
- typedef enum e_arrow_position
- {
- LEFT,
- RIGHT
- } EArrowPosition;
+ typedef enum e_arrow_position
+ {
+ LEFT,
+ RIGHT
+ } EArrowPosition;
- struct ArrowPositionValues : public LLInitParam::TypeValuesHelper<EArrowPosition, ArrowPositionValues>
- {
- static void declareValues();
- };
+ struct ArrowPositionValues : public LLInitParam::TypeValuesHelper<EArrowPosition, ArrowPositionValues>
+ {
+ static void declareValues();
+ };
- struct ItemParams : public LLInitParam::Block<ItemParams, LLButton::Params>
- {
- ItemParams();
- };
+ struct ItemParams : public LLInitParam::Block<ItemParams, LLButton::Params>
+ {
+ ItemParams();
+ };
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<EArrowPosition, ArrowPositionValues> arrow_position;
- Optional<LLButton::Params> arrow_button;
- Optional<LLPanel::Params> items_panel;
- Multiple<ItemParams> items;
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Optional<EArrowPosition, ArrowPositionValues> arrow_position;
+ Optional<LLButton::Params> arrow_button;
+ Optional<LLPanel::Params> items_panel;
+ Multiple<ItemParams> items;
- Params();
- };
+ Params();
+ };
- virtual ~LLSplitButton() {};
+ virtual ~LLSplitButton() {};
- //Overridden
- virtual void onFocusLost();
- virtual void setFocus(BOOL b);
- virtual void setEnabled(BOOL enabled);
+ //Overridden
+ virtual void onFocusLost();
+ virtual void setFocus(BOOL b);
+ virtual void setEnabled(BOOL enabled);
- //Callbacks
- void onArrowBtnDown();
- void onHeldDownShownButton();
- void onItemSelected(LLUICtrl* ctrl);
- void setSelectionCallback(commit_callback_t cb) { mSelectionCallback = cb; }
+ //Callbacks
+ void onArrowBtnDown();
+ void onHeldDownShownButton();
+ void onItemSelected(LLUICtrl* ctrl);
+ void setSelectionCallback(commit_callback_t cb) { mSelectionCallback = cb; }
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual void showButtons();
- virtual void hideButtons();
+ virtual void showButtons();
+ virtual void hideButtons();
protected:
- friend class LLUICtrlFactory;
- LLSplitButton(const LLSplitButton::Params& p);
+ friend class LLUICtrlFactory;
+ LLSplitButton(const LLSplitButton::Params& p);
- LLButton* prepareItemButton(LLButton::Params params);
- LLPanel* prepareItemsPanel(LLPanel::Params params, S32 items_count);
+ LLButton* prepareItemButton(LLButton::Params params);
+ LLPanel* prepareItemsPanel(LLPanel::Params params, S32 items_count);
- LLPanel* mItemsPanel;
- std::list<LLButton*> mHidenItems;
- LLButton* mArrowBtn;
- LLButton* mShownItem;
- EArrowPosition mArrowPosition;
+ LLPanel* mItemsPanel;
+ std::list<LLButton*> mHidenItems;
+ LLButton* mArrowBtn;
+ LLButton* mShownItem;
+ EArrowPosition mArrowPosition;
- commit_callback_t mSelectionCallback;
+ commit_callback_t mSelectionCallback;
};
diff --git a/indra/newview/llsprite.cpp b/indra/newview/llsprite.cpp
index af0b5a40b4..60cc406742 100644
--- a/indra/newview/llsprite.cpp
+++ b/indra/newview/llsprite.cpp
@@ -1,34 +1,34 @@
-/**
+/**
* @file llsprite.cpp
* @brief LLSprite class implementation
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/* -*- c++ -*-
- * Notes:
- * PR - Should add a creator that can take a pointer rather than handle for streaming
- * object textures.
- * PR - Need to add support for lit/non-lit conditions, set normals?
+ * Notes:
+ * PR - Should add a creator that can take a pointer rather than handle for streaming
+ * object textures.
+ * PR - Need to add support for lit/non-lit conditions, set normals?
*/
#include "llviewerprecompiledheaders.h"
@@ -55,17 +55,17 @@ LLVector3 LLSprite::sNormal(0.0f,0.0f,0.0f);
// A simple initialization
LLSprite::LLSprite(const LLUUID &image_uuid) :
- mImageID(image_uuid),
- mImagep(NULL),
- mPitch(0.f),
- mYaw(0.f),
- mPosition(0.0f, 0.0f, 0.0f),
- mFollow(TRUE),
- mUseCameraUp(TRUE),
- mColor(0.5f, 0.5f, 0.5f, 1.0f),
- mTexMode(GL_REPLACE)
+ mImageID(image_uuid),
+ mImagep(NULL),
+ mPitch(0.f),
+ mYaw(0.f),
+ mPosition(0.0f, 0.0f, 0.0f),
+ mFollow(TRUE),
+ mUseCameraUp(TRUE),
+ mColor(0.5f, 0.5f, 0.5f, 1.0f),
+ mTexMode(GL_REPLACE)
{
- setSize(1.0f, 1.0f);
+ setSize(1.0f, 1.0f);
}
//////////////////////////////////////////////////////////////////////
@@ -75,220 +75,220 @@ LLSprite::~LLSprite()
void LLSprite::updateFace(LLFace &face)
{
- LLViewerCamera &camera = *LLViewerCamera::getInstance();
-
- // First, figure out how many vertices/indices we need.
- U32 num_vertices, num_indices;
-
- // Get the total number of vertices and indices
- if (mFollow)
- {
- num_vertices = 4;
- num_indices = 6;
- }
- else
- {
- num_vertices = 4;
- num_indices = 12;
- }
-
- face.setSize(num_vertices, num_indices);
-
- if (mFollow)
- {
- sCameraUp = camera.getUpAxis();
- sCameraRight = -camera.getLeftAxis();
- sCameraPosition = camera.getOrigin();
- sNormal = -camera.getAtAxis();
- if (mUseCameraUp)
- {
- // these need to live here because the height/width may change between render calls
- mScaledUp = sCameraUp;
- mScaledRight = sCameraRight;
-
- mScaledUp *= mHeightDiv2;
- mScaledRight *= mWidthDiv2;
-
- mA = mPosition + mScaledRight + mScaledUp;
- mB = mPosition - mScaledRight + mScaledUp;
- mC = mPosition - mScaledRight - mScaledUp;
- mD = mPosition + mScaledRight - mScaledUp;
- }
- else
- {
- // The up vector is perpendicular to the camera vector...
- LLVector3 camera_vec = mPosition - sCameraPosition;
- mScaledRight = camera_vec % LLVector3(0.f, 0.f, 1.f);
- mScaledUp = -(camera_vec % mScaledRight);
- mScaledUp.normalize();
- mScaledRight.normalize();
- mScaledUp *= mHeightDiv2;
- mScaledRight *= mWidthDiv2;
-
- mA = mPosition + mScaledRight + mScaledUp;
- mB = mPosition - mScaledRight + mScaledUp;
- mC = mPosition - mScaledRight - mScaledUp;
- mD = mPosition + mScaledRight - mScaledUp;
- }
- }
- else
- {
- // this is equivalent to how it was done before. . .
- // we need to establish a way to
- // identify the orientation of a particular sprite rather than
- // just banging it in on the x,z plane if it's not following the camera.
-
- LLVector3 x_axis;
- LLVector3 y_axis;
-
- F32 dot = sNormal * LLVector3(0.f, 1.f, 0.f);
- if (dot == 1.f || dot == -1.f)
- {
- x_axis.setVec(1.f, 0.f, 0.f);
- y_axis.setVec(0.f, 1.f, 0.f);
- }
- else
- {
- x_axis = sNormal % LLVector3(0.f, -1.f, 0.f);
- x_axis.normalize();
-
- y_axis = sNormal % x_axis;
- }
-
- LLQuaternion yaw_rot(mYaw, sNormal);
-
- // rotate axes by specified yaw
- x_axis = x_axis * yaw_rot;
- y_axis = y_axis * yaw_rot;
-
- // rescale axes by width and height of sprite
- x_axis = x_axis * mWidthDiv2;
- y_axis = y_axis * mHeightDiv2;
-
- mA = -x_axis + y_axis;
- mB = x_axis + y_axis;
- mC = x_axis - y_axis;
- mD = -x_axis - y_axis;
-
- mA += mPosition;
- mB += mPosition;
- mC += mPosition;
- mD += mPosition;
- }
-
- face.setFaceColor(mColor);
-
- LLStrider<LLVector3> verticesp;
- LLStrider<LLVector3> normalsp;
- LLStrider<LLVector2> tex_coordsp;
- LLStrider<U16> indicesp;
- U16 index_offset;
-
- // Setup face
- if (!face.getVertexBuffer())
- {
- LLVertexBuffer* buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0 );
- buff->allocateBuffer(4, 12);
- face.setGeomIndex(0);
- face.setIndicesIndex(0);
- face.setVertexBuffer(buff);
- }
-
- index_offset = face.getGeometry(verticesp,normalsp,tex_coordsp, indicesp);
-
- *tex_coordsp = LLVector2(0.f, 0.f);
- *verticesp = mC;
- tex_coordsp++;
- verticesp++;
-
- *tex_coordsp = LLVector2(0.f, 1.f);
- *verticesp = mB;
- tex_coordsp++;
- verticesp++;
-
- *tex_coordsp = LLVector2(1.f, 1.f);
- *verticesp = mA;
- tex_coordsp++;
- verticesp++;
-
- *tex_coordsp = LLVector2(1.f, 0.0f);
- *verticesp = mD;
- tex_coordsp++;
- verticesp++;
-
- // Generate indices, since they're easy.
- // Just a series of quads.
- *indicesp++ = index_offset;
- *indicesp++ = 2 + index_offset;
- *indicesp++ = 1 + index_offset;
-
- *indicesp++ = index_offset;
- *indicesp++ = 3 + index_offset;
- *indicesp++ = 2 + index_offset;
-
- if (!mFollow)
- {
- *indicesp++ = 0 + index_offset;
- *indicesp++ = 1 + index_offset;
- *indicesp++ = 2 + index_offset;
- *indicesp++ = 0 + index_offset;
- *indicesp++ = 2 + index_offset;
- *indicesp++ = 3 + index_offset;
- }
-
- face.getVertexBuffer()->unmapBuffer();
- face.mCenterAgent = mPosition;
+ LLViewerCamera &camera = *LLViewerCamera::getInstance();
+
+ // First, figure out how many vertices/indices we need.
+ U32 num_vertices, num_indices;
+
+ // Get the total number of vertices and indices
+ if (mFollow)
+ {
+ num_vertices = 4;
+ num_indices = 6;
+ }
+ else
+ {
+ num_vertices = 4;
+ num_indices = 12;
+ }
+
+ face.setSize(num_vertices, num_indices);
+
+ if (mFollow)
+ {
+ sCameraUp = camera.getUpAxis();
+ sCameraRight = -camera.getLeftAxis();
+ sCameraPosition = camera.getOrigin();
+ sNormal = -camera.getAtAxis();
+ if (mUseCameraUp)
+ {
+ // these need to live here because the height/width may change between render calls
+ mScaledUp = sCameraUp;
+ mScaledRight = sCameraRight;
+
+ mScaledUp *= mHeightDiv2;
+ mScaledRight *= mWidthDiv2;
+
+ mA = mPosition + mScaledRight + mScaledUp;
+ mB = mPosition - mScaledRight + mScaledUp;
+ mC = mPosition - mScaledRight - mScaledUp;
+ mD = mPosition + mScaledRight - mScaledUp;
+ }
+ else
+ {
+ // The up vector is perpendicular to the camera vector...
+ LLVector3 camera_vec = mPosition - sCameraPosition;
+ mScaledRight = camera_vec % LLVector3(0.f, 0.f, 1.f);
+ mScaledUp = -(camera_vec % mScaledRight);
+ mScaledUp.normalize();
+ mScaledRight.normalize();
+ mScaledUp *= mHeightDiv2;
+ mScaledRight *= mWidthDiv2;
+
+ mA = mPosition + mScaledRight + mScaledUp;
+ mB = mPosition - mScaledRight + mScaledUp;
+ mC = mPosition - mScaledRight - mScaledUp;
+ mD = mPosition + mScaledRight - mScaledUp;
+ }
+ }
+ else
+ {
+ // this is equivalent to how it was done before. . .
+ // we need to establish a way to
+ // identify the orientation of a particular sprite rather than
+ // just banging it in on the x,z plane if it's not following the camera.
+
+ LLVector3 x_axis;
+ LLVector3 y_axis;
+
+ F32 dot = sNormal * LLVector3(0.f, 1.f, 0.f);
+ if (dot == 1.f || dot == -1.f)
+ {
+ x_axis.setVec(1.f, 0.f, 0.f);
+ y_axis.setVec(0.f, 1.f, 0.f);
+ }
+ else
+ {
+ x_axis = sNormal % LLVector3(0.f, -1.f, 0.f);
+ x_axis.normalize();
+
+ y_axis = sNormal % x_axis;
+ }
+
+ LLQuaternion yaw_rot(mYaw, sNormal);
+
+ // rotate axes by specified yaw
+ x_axis = x_axis * yaw_rot;
+ y_axis = y_axis * yaw_rot;
+
+ // rescale axes by width and height of sprite
+ x_axis = x_axis * mWidthDiv2;
+ y_axis = y_axis * mHeightDiv2;
+
+ mA = -x_axis + y_axis;
+ mB = x_axis + y_axis;
+ mC = x_axis - y_axis;
+ mD = -x_axis - y_axis;
+
+ mA += mPosition;
+ mB += mPosition;
+ mC += mPosition;
+ mD += mPosition;
+ }
+
+ face.setFaceColor(mColor);
+
+ LLStrider<LLVector3> verticesp;
+ LLStrider<LLVector3> normalsp;
+ LLStrider<LLVector2> tex_coordsp;
+ LLStrider<U16> indicesp;
+ U16 index_offset;
+
+ // Setup face
+ if (!face.getVertexBuffer())
+ {
+ LLVertexBuffer* buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_TEXCOORD0 );
+ buff->allocateBuffer(4, 12);
+ face.setGeomIndex(0);
+ face.setIndicesIndex(0);
+ face.setVertexBuffer(buff);
+ }
+
+ index_offset = face.getGeometry(verticesp,normalsp,tex_coordsp, indicesp);
+
+ *tex_coordsp = LLVector2(0.f, 0.f);
+ *verticesp = mC;
+ tex_coordsp++;
+ verticesp++;
+
+ *tex_coordsp = LLVector2(0.f, 1.f);
+ *verticesp = mB;
+ tex_coordsp++;
+ verticesp++;
+
+ *tex_coordsp = LLVector2(1.f, 1.f);
+ *verticesp = mA;
+ tex_coordsp++;
+ verticesp++;
+
+ *tex_coordsp = LLVector2(1.f, 0.0f);
+ *verticesp = mD;
+ tex_coordsp++;
+ verticesp++;
+
+ // Generate indices, since they're easy.
+ // Just a series of quads.
+ *indicesp++ = index_offset;
+ *indicesp++ = 2 + index_offset;
+ *indicesp++ = 1 + index_offset;
+
+ *indicesp++ = index_offset;
+ *indicesp++ = 3 + index_offset;
+ *indicesp++ = 2 + index_offset;
+
+ if (!mFollow)
+ {
+ *indicesp++ = 0 + index_offset;
+ *indicesp++ = 1 + index_offset;
+ *indicesp++ = 2 + index_offset;
+ *indicesp++ = 0 + index_offset;
+ *indicesp++ = 2 + index_offset;
+ *indicesp++ = 3 + index_offset;
+ }
+
+ face.getVertexBuffer()->unmapBuffer();
+ face.mCenterAgent = mPosition;
}
-void LLSprite::setPosition(const LLVector3 &position)
+void LLSprite::setPosition(const LLVector3 &position)
{
- mPosition = position;
+ mPosition = position;
}
-void LLSprite::setPitch(const F32 pitch)
+void LLSprite::setPitch(const F32 pitch)
{
- mPitch = pitch;
+ mPitch = pitch;
}
-void LLSprite::setSize(const F32 width, const F32 height)
+void LLSprite::setSize(const F32 width, const F32 height)
{
- mWidth = width;
- mHeight = height;
- mWidthDiv2 = width/2.0f;
- mHeightDiv2 = height/2.0f;
+ mWidth = width;
+ mHeight = height;
+ mWidthDiv2 = width/2.0f;
+ mHeightDiv2 = height/2.0f;
}
-void LLSprite::setYaw(F32 yaw)
+void LLSprite::setYaw(F32 yaw)
{
- mYaw = yaw;
+ mYaw = yaw;
}
void LLSprite::setFollow(const BOOL follow)
{
- mFollow = follow;
+ mFollow = follow;
}
void LLSprite::setUseCameraUp(const BOOL use_up)
{
- mUseCameraUp = use_up;
+ mUseCameraUp = use_up;
}
-void LLSprite::setTexMode(const LLGLenum mode)
+void LLSprite::setTexMode(const LLGLenum mode)
{
- mTexMode = mode;
+ mTexMode = mode;
}
void LLSprite::setColor(const LLColor4 &color)
{
- mColor = color;
+ mColor = color;
}
void LLSprite::setColor(const F32 r, const F32 g, const F32 b, const F32 a)
{
- mColor.setVec(r, g, b, a);
+ mColor.setVec(r, g, b, a);
}
diff --git a/indra/newview/llsprite.h b/indra/newview/llsprite.h
index d00b8ef695..604ece43d2 100644
--- a/indra/newview/llsprite.h
+++ b/indra/newview/llsprite.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsprite.h
* @brief LLSprite class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,65 +40,65 @@ class LLViewerCamera;
class LLFace;
-class LLSprite
+class LLSprite
{
public:
- LLSprite(const LLUUID &image_uuid);
- ~LLSprite();
+ LLSprite(const LLUUID &image_uuid);
+ ~LLSprite();
- void render(LLViewerCamera * camerap);
+ void render(LLViewerCamera * camerap);
- F32 getWidth() const { return mWidth; }
- F32 getHeight() const { return mHeight; }
- F32 getYaw() const { return mYaw; }
- F32 getPitch() const { return mPitch; }
- F32 getAlpha() const { return mColor.mV[VALPHA]; }
+ F32 getWidth() const { return mWidth; }
+ F32 getHeight() const { return mHeight; }
+ F32 getYaw() const { return mYaw; }
+ F32 getPitch() const { return mPitch; }
+ F32 getAlpha() const { return mColor.mV[VALPHA]; }
- LLVector3 getPosition() const { return mPosition; }
- LLColor4 getColor() const { return mColor; }
+ LLVector3 getPosition() const { return mPosition; }
+ LLColor4 getColor() const { return mColor; }
- void setPosition(const LLVector3 &position);
- void setPitch(const F32 pitch);
- void setSize(const F32 width, const F32 height);
- void setYaw(const F32 yaw);
- void setFollow(const BOOL follow);
- void setUseCameraUp(const BOOL use_up);
+ void setPosition(const LLVector3 &position);
+ void setPitch(const F32 pitch);
+ void setSize(const F32 width, const F32 height);
+ void setYaw(const F32 yaw);
+ void setFollow(const BOOL follow);
+ void setUseCameraUp(const BOOL use_up);
- void setTexMode(LLGLenum mode);
- void setColor(const LLColor4 &color);
- void setColor(const F32 r, const F32 g, const F32 b, const F32 a);
- void setAlpha(const F32 alpha) { mColor.mV[VALPHA] = alpha; }
- void setNormal(const LLVector3 &normal) { sNormal = normal; sNormal.normalize();}
+ void setTexMode(LLGLenum mode);
+ void setColor(const LLColor4 &color);
+ void setColor(const F32 r, const F32 g, const F32 b, const F32 a);
+ void setAlpha(const F32 alpha) { mColor.mV[VALPHA] = alpha; }
+ void setNormal(const LLVector3 &normal) { sNormal = normal; sNormal.normalize();}
- F32 getAlpha();
+ F32 getAlpha();
- void updateFace(LLFace &face);
+ void updateFace(LLFace &face);
public:
- LLUUID mImageID;
- LLPointer<LLViewerTexture> mImagep;
+ LLUUID mImageID;
+ LLPointer<LLViewerTexture> mImagep;
private:
- F32 mWidth;
- F32 mHeight;
- F32 mWidthDiv2;
- F32 mHeightDiv2;
- F32 mPitch;
- F32 mYaw;
- LLVector3 mPosition;
- BOOL mFollow;
- BOOL mUseCameraUp;
-
- LLColor4 mColor;
- LLGLenum mTexMode;
-
- // put
- LLVector3 mScaledUp;
- LLVector3 mScaledRight;
- static LLVector3 sCameraUp;
- static LLVector3 sCameraRight;
- static LLVector3 sCameraPosition;
- static LLVector3 sNormal;
- LLVector3 mA,mB,mC,mD; // the four corners of a quad
+ F32 mWidth;
+ F32 mHeight;
+ F32 mWidthDiv2;
+ F32 mHeightDiv2;
+ F32 mPitch;
+ F32 mYaw;
+ LLVector3 mPosition;
+ BOOL mFollow;
+ BOOL mUseCameraUp;
+
+ LLColor4 mColor;
+ LLGLenum mTexMode;
+
+ // put
+ LLVector3 mScaledUp;
+ LLVector3 mScaledRight;
+ static LLVector3 sCameraUp;
+ static LLVector3 sCameraRight;
+ static LLVector3 sCameraPosition;
+ static LLVector3 sNormal;
+ LLVector3 mA,mB,mC,mD; // the four corners of a quad
};
diff --git a/indra/newview/llsrv.cpp b/indra/newview/llsrv.cpp
index 8b9aead165..53ed6969de 100644
--- a/indra/newview/llsrv.cpp
+++ b/indra/newview/llsrv.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsrv.cpp
* @brief Wrapper for DNS SRV record lookups
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,34 +31,34 @@
struct Responder : public LLAres::UriRewriteResponder
{
- std::vector<std::string> mUris;
- void rewriteResult(const std::vector<std::string> &uris) {
- for (size_t i = 0; i < uris.size(); i++)
- {
- LL_INFOS() << "[" << i << "] " << uris[i] << LL_ENDL;
- }
- mUris = uris;
- }
+ std::vector<std::string> mUris;
+ void rewriteResult(const std::vector<std::string> &uris) {
+ for (size_t i = 0; i < uris.size(); i++)
+ {
+ LL_INFOS() << "[" << i << "] " << uris[i] << LL_ENDL;
+ }
+ mUris = uris;
+ }
};
std::vector<std::string> LLSRV::rewriteURI(const std::string& uri)
{
- LLPointer<Responder> resp = new Responder;
+ LLPointer<Responder> resp = new Responder;
- gAres->rewriteURI(uri, resp);
- gAres->processAll();
+ gAres->rewriteURI(uri, resp);
+ gAres->processAll();
- // It's been observed in deployment that c-ares can return control
- // to us without firing all of our callbacks, in which case the
- // returned vector will be empty, instead of a singleton as we
- // might wish.
+ // It's been observed in deployment that c-ares can return control
+ // to us without firing all of our callbacks, in which case the
+ // returned vector will be empty, instead of a singleton as we
+ // might wish.
- if (!resp->mUris.empty())
- {
- return resp->mUris;
- }
+ if (!resp->mUris.empty())
+ {
+ return resp->mUris;
+ }
- std::vector<std::string> uris;
- uris.push_back(uri);
- return uris;
+ std::vector<std::string> uris;
+ uris.push_back(uri);
+ return uris;
}
diff --git a/indra/newview/llsrv.h b/indra/newview/llsrv.h
index db5543f772..3239ca93fd 100644
--- a/indra/newview/llsrv.h
+++ b/indra/newview/llsrv.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsrv.h
* @brief Wrapper for DNS SRV record lookups
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@
class LLSRV
{
public:
- static std::vector<std::string> rewriteURI(const std::string& uri);
+ static std::vector<std::string> rewriteURI(const std::string& uri);
};
#endif // LL_LLSRV_H
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index a0324ca82a..4ad0228bd0 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llstartup.cpp
* @brief startup routines.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,9 +31,9 @@
#include "llcallstack.h"
#if LL_WINDOWS
-# include <process.h> // _spawnl()
+# include <process.h> // _spawnl()
#else
-# include <sys/stat.h> // mkdir()
+# include <sys/stat.h> // mkdir()
#endif
#include <memory> // std::unique_ptr
@@ -84,7 +84,7 @@
#include "llversioninfo.h"
#include "llviewercontrol.h"
#include "llviewerhelp.h"
-#include "llxorcipher.h" // saved password, MAC address
+#include "llxorcipher.h" // saved password, MAC address
#include "llwindow.h"
#include "message.h"
#include "v3math.h"
@@ -121,7 +121,7 @@
#include "llinventorymodel.h"
#include "llinventorymodelbackgroundfetch.h"
#include "llkeyboard.h"
-#include "llloginhandler.h" // gLoginHandler, SLURL support
+#include "llloginhandler.h" // gLoginHandler, SLURL support
#include "lllogininstance.h" // Host the login module.
#include "llpanellogin.h"
#include "llmutelist.h"
@@ -138,7 +138,7 @@
#include "llselectmgr.h"
#include "llsky.h"
#include "llstatview.h"
-#include "llstatusbar.h" // sendMoneyBalanceRequest(), owns L$ balance
+#include "llstatusbar.h" // sendMoneyBalanceRequest(), owns L$ balance
#include "llsurface.h"
#include "lltexturecache.h"
#include "lltexturefetch.h"
@@ -236,7 +236,7 @@ extern S32 gStartImageHeight;
//
static bool gGotUseCircuitCodeAck = false;
static std::string sInitialOutfit;
-static std::string sInitialOutfitGender; // "male" or "female"
+static std::string sInitialOutfitGender; // "male" or "female"
static bool gUseCircuitCallbackCalled = false;
@@ -290,12 +290,12 @@ void transition_back_to_login_panel(const std::string& emsg);
void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group)
{
- LLNameBox::refreshAll(id, full_name, is_group);
- LLNameEditor::refreshAll(id, full_name, is_group);
-
- // TODO: Actually be intelligent about the refresh.
- // For now, just brute force refresh the dialogs.
- dialog_refresh_all();
+ LLNameBox::refreshAll(id, full_name, is_group);
+ LLNameEditor::refreshAll(id, full_name, is_group);
+
+ // TODO: Actually be intelligent about the refresh.
+ // For now, just brute force refresh the dialogs.
+ dialog_refresh_all();
}
//
@@ -320,10 +320,10 @@ void pump_idle_startup_network(void)
//
void update_texture_fetch()
{
- LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread
- LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread
- LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
- gTextureList.updateImages(0.10f);
+ LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread
+ LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread
+ LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
+ gTextureList.updateImages(0.10f);
if (LLImageGLThread::sEnabledTextures)
{
@@ -334,8 +334,8 @@ void update_texture_fetch()
void set_flags_and_update_appearance()
{
- LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
- LLAppearanceMgr::instance().updateAppearanceFromCOF(true, true, no_op);
+ LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
+ LLAppearanceMgr::instance().updateAppearanceFromCOF(true, true, no_op);
LLInventoryModelBackgroundFetch::instance().start();
}
@@ -344,310 +344,310 @@ void set_flags_and_update_appearance()
// true when all initialization done.
bool idle_startup()
{
- if (gViewerWindow == NULL)
- {
- // We expect window to be initialized
- LL_WARNS_ONCE() << "gViewerWindow is not initialized" << LL_ENDL;
- return false; // No world yet
- }
-
- const F32 PRECACHING_DELAY = gSavedSettings.getF32("PrecachingDelay");
- static LLTimer timeout;
-
- static LLTimer login_time;
-
- // until this is encapsulated, this little hack for the
- // auth/transform loop will do.
- static F32 progress = 0.10f;
-
- static std::string auth_desc;
- static std::string auth_message;
-
- static LLVector3 agent_start_position_region(10.f, 10.f, 10.f); // default for when no space server
-
- // last location by default
- static S32 agent_location_id = START_LOCATION_ID_LAST;
-
- static bool show_connect_box = true;
-
- //static bool stipend_since_login = false;
-
- // HACK: These are things from the main loop that usually aren't done
- // until initialization is complete, but need to be done here for things
- // to work.
- gIdleCallbacks.callFunctions();
- gViewerWindow->updateUI();
-
- LLMortician::updateClass();
-
- const std::string delims (" ");
- std::string system;
- int begIdx, endIdx;
- std::string osString = LLOSInfo::instance().getOSStringSimple();
-
- begIdx = osString.find_first_not_of (delims);
- endIdx = osString.find_first_of (delims, begIdx);
- system = osString.substr (begIdx, endIdx - begIdx);
- system += "Locale";
-
- LLStringUtil::setLocale (LLTrans::getString(system));
-
- //note: Removing this line will cause incorrect button size in the login screen. -- bao.
- gTextureList.updateImages(0.01f) ;
-
- if ( STATE_FIRST == LLStartUp::getStartupState() )
- {
- static bool first_call = true;
- if (first_call)
- {
- // Other phases get handled when startup state changes,
- // need to capture the initial state as well.
- LLStartUp::getPhases().startPhase(LLStartUp::getStartupStateString());
- first_call = false;
- }
-
- gViewerWindow->showCursor();
- gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
-
- /////////////////////////////////////////////////
- //
- // Initialize stuff that doesn't need data from simulators
- //
- std::string lastGPU = gSavedSettings.getString("LastGPUString");
- std::string thisGPU = LLFeatureManager::getInstance()->getGPUString();
-
- if (LLFeatureManager::getInstance()->isSafe())
- {
- LLNotificationsUtil::add("DisplaySetToSafe");
- }
- else if ((gSavedSettings.getS32("LastFeatureVersion") < LLFeatureManager::getInstance()->getVersion()) &&
- (gSavedSettings.getS32("LastFeatureVersion") != 0))
- {
- LLNotificationsUtil::add("DisplaySetToRecommendedFeatureChange");
- }
- else if ( ! lastGPU.empty() && (lastGPU != thisGPU))
- {
- LLSD subs;
- subs["LAST_GPU"] = lastGPU;
- subs["THIS_GPU"] = thisGPU;
- LLNotificationsUtil::add("DisplaySetToRecommendedGPUChange", subs);
- }
- else if (!gViewerWindow->getInitAlert().empty())
- {
- LLNotificationsUtil::add(gViewerWindow->getInitAlert());
- }
-
- //-------------------------------------------------
- // Init the SOCKS 5 proxy if the user has configured
- // one. We need to do this early in case the user
- // is using SOCKS for HTTP so we get the login
- // screen and HTTP tables via SOCKS.
- //-------------------------------------------------
- LLStartUp::startLLProxy();
-
- gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
- gSavedSettings.setString("LastGPUString", thisGPU);
-
-
- std::string xml_file = LLUI::locateSkin("xui_version.xml");
- LLXMLNodePtr root;
- bool xml_ok = false;
- if (LLXMLNode::parseFile(xml_file, root, NULL))
- {
- if( (root->hasName("xui_version") ) )
- {
- std::string value = root->getValue();
- F32 version = 0.0f;
- LLStringUtil::convertToF32(value, version);
- if (version >= 1.0f)
- {
- xml_ok = true;
- }
- }
- }
- if (!xml_ok)
- {
- // If XML is bad, there's a good possibility that notifications.xml is ALSO bad.
- // If that's so, then we'll get a fatal error on attempting to load it,
- // which will display a nontranslatable error message that says so.
- // Otherwise, we'll display a reasonable error message that IS translatable.
- LLAppViewer::instance()->earlyExit("BadInstallation");
- }
- //
- // Statistics stuff
- //
-
- // Load autopilot and stats stuff
- gAgentPilot.load();
-
- //gErrorStream.setTime(gSavedSettings.getBOOL("LogTimestamps"));
-
- // Load the throttle settings
- gViewerThrottle.load();
-
- //
- // Initialize messaging system
- //
- LL_DEBUGS("AppInit") << "Initializing messaging system..." << LL_ENDL;
-
- std::string message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message_template.msg");
-
- LLFILE* found_template = NULL;
- found_template = LLFile::fopen(message_template_path, "r"); /* Flawfinder: ignore */
-
- #if LL_WINDOWS
- // On the windows dev builds, unpackaged, the message_template.msg
- // file will be located in:
- // build-vc**/newview/<config>/app_settings
- if (!found_template)
- {
- message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "app_settings", "message_template.msg");
- found_template = LLFile::fopen(message_template_path.c_str(), "r"); /* Flawfinder: ignore */
- }
- #elif LL_DARWIN
- // On Mac dev builds, message_template.msg lives in:
- // indra/build-*/newview/<config>/Second Life/Contents/Resources/app_settings
- if (!found_template)
- {
- message_template_path =
- gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,
- "message_template.msg");
- found_template = LLFile::fopen(message_template_path.c_str(), "r"); /* Flawfinder: ignore */
- }
- #endif
-
- if (found_template)
- {
- fclose(found_template);
-
- U32 port = gSavedSettings.getU32("UserConnectionPort");
-
- if ((NET_USE_OS_ASSIGNED_PORT == port) && // if nothing specified on command line (-port)
- (gSavedSettings.getBOOL("ConnectionPortEnabled")))
- {
- port = gSavedSettings.getU32("ConnectionPort");
- }
-
- // TODO parameterize
- const F32 circuit_heartbeat_interval = 5;
- const F32 circuit_timeout = 100;
-
- const LLUseCircuitCodeResponder* responder = NULL;
- bool failure_is_fatal = true;
-
- if(!start_messaging_system(
- message_template_path,
- port,
- LLVersionInfo::instance().getMajor(),
- LLVersionInfo::instance().getMinor(),
- LLVersionInfo::instance().getPatch(),
- FALSE,
- std::string(),
- responder,
- failure_is_fatal,
- circuit_heartbeat_interval,
- circuit_timeout))
- {
- std::string diagnostic = llformat(" Error: %d", gMessageSystem->getErrorCode());
- LL_WARNS("AppInit") << diagnostic << LL_ENDL;
- LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
- }
-
- #if LL_WINDOWS
- // On the windows dev builds, unpackaged, the message.xml file will
- // be located in indra/build-vc**/newview/<config>/app_settings.
- std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml");
-
- if (!LLFile::isfile(message_path.c_str()))
- {
- LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "app_settings", ""));
- }
- else
- {
- LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""));
- }
- #else
- LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""));
- #endif
-
- }
- else
- {
- LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().with("PATH", message_template_path));
- }
-
- if(gMessageSystem && gMessageSystem->isOK())
- {
- // Initialize all of the callbacks in case of bad message
- // system data
- LLMessageSystem* msg = gMessageSystem;
- msg->setExceptionFunc(MX_UNREGISTERED_MESSAGE,
- invalid_message_callback,
- NULL);
- msg->setExceptionFunc(MX_PACKET_TOO_SHORT,
- invalid_message_callback,
- NULL);
-
- // running off end of a packet is now valid in the case
- // when a reader has a newer message template than
- // the sender
- /*msg->setExceptionFunc(MX_RAN_OFF_END_OF_PACKET,
- invalid_message_callback,
- NULL);*/
- msg->setExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE,
- invalid_message_callback,
- NULL);
-
- if (gSavedSettings.getBOOL("LogMessages"))
- {
- LL_DEBUGS("AppInit") << "Message logging activated!" << LL_ENDL;
- msg->startLogging();
- }
-
- // start the xfer system. by default, choke the downloads
- // a lot...
- const S32 VIEWER_MAX_XFER = 3;
- start_xfer_manager();
- gXferManager->setMaxIncomingXfers(VIEWER_MAX_XFER);
- F32 xfer_throttle_bps = gSavedSettings.getF32("XferThrottle");
- if (xfer_throttle_bps > 1.f)
- {
- gXferManager->setUseAckThrottling(TRUE);
- gXferManager->setAckThrottleBPS(xfer_throttle_bps);
- }
- gAssetStorage = new LLViewerAssetStorage(msg, gXferManager);
-
-
- F32 dropPercent = gSavedSettings.getF32("PacketDropPercentage");
- msg->mPacketRing.setDropPercentage(dropPercent);
-
- F32 inBandwidth = gSavedSettings.getF32("InBandwidth");
- F32 outBandwidth = gSavedSettings.getF32("OutBandwidth");
- if (inBandwidth != 0.f)
- {
- LL_DEBUGS("AppInit") << "Setting packetring incoming bandwidth to " << inBandwidth << LL_ENDL;
- msg->mPacketRing.setUseInThrottle(TRUE);
- msg->mPacketRing.setInBandwidth(inBandwidth);
- }
- if (outBandwidth != 0.f)
- {
- LL_DEBUGS("AppInit") << "Setting packetring outgoing bandwidth to " << outBandwidth << LL_ENDL;
- msg->mPacketRing.setUseOutThrottle(TRUE);
- msg->mPacketRing.setOutBandwidth(outBandwidth);
- }
- }
-
- LL_INFOS("AppInit") << "Message System Initialized." << LL_ENDL;
-
- //-------------------------------------------------
- // Init audio, which may be needed for prefs dialog
- // or audio cues in connection UI.
- //-------------------------------------------------
-
- if (FALSE == gSavedSettings.getBOOL("NoAudio"))
- {
- delete gAudiop;
- gAudiop = NULL;
+ if (gViewerWindow == NULL)
+ {
+ // We expect window to be initialized
+ LL_WARNS_ONCE() << "gViewerWindow is not initialized" << LL_ENDL;
+ return false; // No world yet
+ }
+
+ const F32 PRECACHING_DELAY = gSavedSettings.getF32("PrecachingDelay");
+ static LLTimer timeout;
+
+ static LLTimer login_time;
+
+ // until this is encapsulated, this little hack for the
+ // auth/transform loop will do.
+ static F32 progress = 0.10f;
+
+ static std::string auth_desc;
+ static std::string auth_message;
+
+ static LLVector3 agent_start_position_region(10.f, 10.f, 10.f); // default for when no space server
+
+ // last location by default
+ static S32 agent_location_id = START_LOCATION_ID_LAST;
+
+ static bool show_connect_box = true;
+
+ //static bool stipend_since_login = false;
+
+ // HACK: These are things from the main loop that usually aren't done
+ // until initialization is complete, but need to be done here for things
+ // to work.
+ gIdleCallbacks.callFunctions();
+ gViewerWindow->updateUI();
+
+ LLMortician::updateClass();
+
+ const std::string delims (" ");
+ std::string system;
+ int begIdx, endIdx;
+ std::string osString = LLOSInfo::instance().getOSStringSimple();
+
+ begIdx = osString.find_first_not_of (delims);
+ endIdx = osString.find_first_of (delims, begIdx);
+ system = osString.substr (begIdx, endIdx - begIdx);
+ system += "Locale";
+
+ LLStringUtil::setLocale (LLTrans::getString(system));
+
+ //note: Removing this line will cause incorrect button size in the login screen. -- bao.
+ gTextureList.updateImages(0.01f) ;
+
+ if ( STATE_FIRST == LLStartUp::getStartupState() )
+ {
+ static bool first_call = true;
+ if (first_call)
+ {
+ // Other phases get handled when startup state changes,
+ // need to capture the initial state as well.
+ LLStartUp::getPhases().startPhase(LLStartUp::getStartupStateString());
+ first_call = false;
+ }
+
+ gViewerWindow->showCursor();
+ gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
+
+ /////////////////////////////////////////////////
+ //
+ // Initialize stuff that doesn't need data from simulators
+ //
+ std::string lastGPU = gSavedSettings.getString("LastGPUString");
+ std::string thisGPU = LLFeatureManager::getInstance()->getGPUString();
+
+ if (LLFeatureManager::getInstance()->isSafe())
+ {
+ LLNotificationsUtil::add("DisplaySetToSafe");
+ }
+ else if ((gSavedSettings.getS32("LastFeatureVersion") < LLFeatureManager::getInstance()->getVersion()) &&
+ (gSavedSettings.getS32("LastFeatureVersion") != 0))
+ {
+ LLNotificationsUtil::add("DisplaySetToRecommendedFeatureChange");
+ }
+ else if ( ! lastGPU.empty() && (lastGPU != thisGPU))
+ {
+ LLSD subs;
+ subs["LAST_GPU"] = lastGPU;
+ subs["THIS_GPU"] = thisGPU;
+ LLNotificationsUtil::add("DisplaySetToRecommendedGPUChange", subs);
+ }
+ else if (!gViewerWindow->getInitAlert().empty())
+ {
+ LLNotificationsUtil::add(gViewerWindow->getInitAlert());
+ }
+
+ //-------------------------------------------------
+ // Init the SOCKS 5 proxy if the user has configured
+ // one. We need to do this early in case the user
+ // is using SOCKS for HTTP so we get the login
+ // screen and HTTP tables via SOCKS.
+ //-------------------------------------------------
+ LLStartUp::startLLProxy();
+
+ gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
+ gSavedSettings.setString("LastGPUString", thisGPU);
+
+
+ std::string xml_file = LLUI::locateSkin("xui_version.xml");
+ LLXMLNodePtr root;
+ bool xml_ok = false;
+ if (LLXMLNode::parseFile(xml_file, root, NULL))
+ {
+ if( (root->hasName("xui_version") ) )
+ {
+ std::string value = root->getValue();
+ F32 version = 0.0f;
+ LLStringUtil::convertToF32(value, version);
+ if (version >= 1.0f)
+ {
+ xml_ok = true;
+ }
+ }
+ }
+ if (!xml_ok)
+ {
+ // If XML is bad, there's a good possibility that notifications.xml is ALSO bad.
+ // If that's so, then we'll get a fatal error on attempting to load it,
+ // which will display a nontranslatable error message that says so.
+ // Otherwise, we'll display a reasonable error message that IS translatable.
+ LLAppViewer::instance()->earlyExit("BadInstallation");
+ }
+ //
+ // Statistics stuff
+ //
+
+ // Load autopilot and stats stuff
+ gAgentPilot.load();
+
+ //gErrorStream.setTime(gSavedSettings.getBOOL("LogTimestamps"));
+
+ // Load the throttle settings
+ gViewerThrottle.load();
+
+ //
+ // Initialize messaging system
+ //
+ LL_DEBUGS("AppInit") << "Initializing messaging system..." << LL_ENDL;
+
+ std::string message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message_template.msg");
+
+ LLFILE* found_template = NULL;
+ found_template = LLFile::fopen(message_template_path, "r"); /* Flawfinder: ignore */
+
+ #if LL_WINDOWS
+ // On the windows dev builds, unpackaged, the message_template.msg
+ // file will be located in:
+ // build-vc**/newview/<config>/app_settings
+ if (!found_template)
+ {
+ message_template_path = gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "app_settings", "message_template.msg");
+ found_template = LLFile::fopen(message_template_path.c_str(), "r"); /* Flawfinder: ignore */
+ }
+ #elif LL_DARWIN
+ // On Mac dev builds, message_template.msg lives in:
+ // indra/build-*/newview/<config>/Second Life/Contents/Resources/app_settings
+ if (!found_template)
+ {
+ message_template_path =
+ gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,
+ "message_template.msg");
+ found_template = LLFile::fopen(message_template_path.c_str(), "r"); /* Flawfinder: ignore */
+ }
+ #endif
+
+ if (found_template)
+ {
+ fclose(found_template);
+
+ U32 port = gSavedSettings.getU32("UserConnectionPort");
+
+ if ((NET_USE_OS_ASSIGNED_PORT == port) && // if nothing specified on command line (-port)
+ (gSavedSettings.getBOOL("ConnectionPortEnabled")))
+ {
+ port = gSavedSettings.getU32("ConnectionPort");
+ }
+
+ // TODO parameterize
+ const F32 circuit_heartbeat_interval = 5;
+ const F32 circuit_timeout = 100;
+
+ const LLUseCircuitCodeResponder* responder = NULL;
+ bool failure_is_fatal = true;
+
+ if(!start_messaging_system(
+ message_template_path,
+ port,
+ LLVersionInfo::instance().getMajor(),
+ LLVersionInfo::instance().getMinor(),
+ LLVersionInfo::instance().getPatch(),
+ FALSE,
+ std::string(),
+ responder,
+ failure_is_fatal,
+ circuit_heartbeat_interval,
+ circuit_timeout))
+ {
+ std::string diagnostic = llformat(" Error: %d", gMessageSystem->getErrorCode());
+ LL_WARNS("AppInit") << diagnostic << LL_ENDL;
+ LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
+ }
+
+ #if LL_WINDOWS
+ // On the windows dev builds, unpackaged, the message.xml file will
+ // be located in indra/build-vc**/newview/<config>/app_settings.
+ std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml");
+
+ if (!LLFile::isfile(message_path.c_str()))
+ {
+ LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "app_settings", ""));
+ }
+ else
+ {
+ LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""));
+ }
+ #else
+ LLMessageConfig::initClass("viewer", gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""));
+ #endif
+
+ }
+ else
+ {
+ LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().with("PATH", message_template_path));
+ }
+
+ if(gMessageSystem && gMessageSystem->isOK())
+ {
+ // Initialize all of the callbacks in case of bad message
+ // system data
+ LLMessageSystem* msg = gMessageSystem;
+ msg->setExceptionFunc(MX_UNREGISTERED_MESSAGE,
+ invalid_message_callback,
+ NULL);
+ msg->setExceptionFunc(MX_PACKET_TOO_SHORT,
+ invalid_message_callback,
+ NULL);
+
+ // running off end of a packet is now valid in the case
+ // when a reader has a newer message template than
+ // the sender
+ /*msg->setExceptionFunc(MX_RAN_OFF_END_OF_PACKET,
+ invalid_message_callback,
+ NULL);*/
+ msg->setExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE,
+ invalid_message_callback,
+ NULL);
+
+ if (gSavedSettings.getBOOL("LogMessages"))
+ {
+ LL_DEBUGS("AppInit") << "Message logging activated!" << LL_ENDL;
+ msg->startLogging();
+ }
+
+ // start the xfer system. by default, choke the downloads
+ // a lot...
+ const S32 VIEWER_MAX_XFER = 3;
+ start_xfer_manager();
+ gXferManager->setMaxIncomingXfers(VIEWER_MAX_XFER);
+ F32 xfer_throttle_bps = gSavedSettings.getF32("XferThrottle");
+ if (xfer_throttle_bps > 1.f)
+ {
+ gXferManager->setUseAckThrottling(TRUE);
+ gXferManager->setAckThrottleBPS(xfer_throttle_bps);
+ }
+ gAssetStorage = new LLViewerAssetStorage(msg, gXferManager);
+
+
+ F32 dropPercent = gSavedSettings.getF32("PacketDropPercentage");
+ msg->mPacketRing.setDropPercentage(dropPercent);
+
+ F32 inBandwidth = gSavedSettings.getF32("InBandwidth");
+ F32 outBandwidth = gSavedSettings.getF32("OutBandwidth");
+ if (inBandwidth != 0.f)
+ {
+ LL_DEBUGS("AppInit") << "Setting packetring incoming bandwidth to " << inBandwidth << LL_ENDL;
+ msg->mPacketRing.setUseInThrottle(TRUE);
+ msg->mPacketRing.setInBandwidth(inBandwidth);
+ }
+ if (outBandwidth != 0.f)
+ {
+ LL_DEBUGS("AppInit") << "Setting packetring outgoing bandwidth to " << outBandwidth << LL_ENDL;
+ msg->mPacketRing.setUseOutThrottle(TRUE);
+ msg->mPacketRing.setOutBandwidth(outBandwidth);
+ }
+ }
+
+ LL_INFOS("AppInit") << "Message System Initialized." << LL_ENDL;
+
+ //-------------------------------------------------
+ // Init audio, which may be needed for prefs dialog
+ // or audio cues in connection UI.
+ //-------------------------------------------------
+
+ if (FALSE == gSavedSettings.getBOOL("NoAudio"))
+ {
+ delete gAudiop;
+ gAudiop = NULL;
#ifdef LL_FMODSTUDIO
#if !LL_WINDOWS
@@ -660,262 +660,262 @@ bool idle_startup()
#ifdef LL_OPENAL
#if !LL_WINDOWS
- if (NULL == getenv("LL_BAD_OPENAL_DRIVER"))
+ if (NULL == getenv("LL_BAD_OPENAL_DRIVER"))
#endif // !LL_WINDOWS
- {
- gAudiop = (LLAudioEngine *) new LLAudioEngine_OpenAL();
- }
+ {
+ gAudiop = (LLAudioEngine *) new LLAudioEngine_OpenAL();
+ }
#endif
-
- if (gAudiop)
- {
+
+ if (gAudiop)
+ {
#if LL_WINDOWS
- // FMOD Ex on Windows needs the window handle to stop playing audio
- // when window is minimized. JC
- void* window_handle = (HWND)gViewerWindow->getPlatformWindow();
+ // FMOD Ex on Windows needs the window handle to stop playing audio
+ // when window is minimized. JC
+ void* window_handle = (HWND)gViewerWindow->getPlatformWindow();
#else
- void* window_handle = NULL;
+ void* window_handle = NULL;
#endif
- if (gAudiop->init(window_handle, LLAppViewer::instance()->getSecondLifeTitle()))
- {
- if (FALSE == gSavedSettings.getBOOL("UseMediaPluginsForStreamingAudio"))
- {
- LL_INFOS("AppInit") << "Using default impl to render streaming audio" << LL_ENDL;
- gAudiop->setStreamingAudioImpl(gAudiop->createDefaultStreamingAudioImpl());
- }
-
- // if the audio engine hasn't set up its own preferred handler for streaming audio
- // then set up the generic streaming audio implementation which uses media plugins
- if (NULL == gAudiop->getStreamingAudioImpl())
- {
- LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL;
- gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins());
- }
-
- gAudiop->setMuted(TRUE);
- }
- else
- {
- LL_WARNS("AppInit") << "Unable to initialize audio engine" << LL_ENDL;
- delete gAudiop;
- gAudiop = NULL;
- }
- }
- }
-
- LL_INFOS("AppInit") << "Audio Engine Initialized." << LL_ENDL;
-
- if (LLTimer::knownBadTimer())
- {
- LL_WARNS("AppInit") << "Unreliable timers detected (may be bad PCI chipset)!!" << LL_ENDL;
- }
-
- //
- // Log on to system
- //
- if (gUserCredential.isNull())
- {
- gUserCredential = gLoginHandler.initializeLoginInfo();
- }
- // Previous initializeLoginInfo may have generated user credentials. Re-check them.
- if (gUserCredential.isNull())
- {
- show_connect_box = TRUE;
- }
- else if (gSavedSettings.getBOOL("AutoLogin"))
- {
- // Log into last account
- gRememberPassword = true;
- gRememberUser = true;
- gSavedSettings.setBOOL("RememberPassword", TRUE);
- gSavedSettings.setBOOL("RememberUser", TRUE);
- show_connect_box = false;
- }
- else if (gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
- {
- // Console provided login&password
- gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
- gRememberUser = gSavedSettings.getBOOL("RememberUser");
- show_connect_box = false;
- }
- else
- {
- gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
- gRememberUser = gSavedSettings.getBOOL("RememberUser");
- show_connect_box = TRUE;
- }
-
- //setup map of datetime strings to codes and slt & local time offset from utc
- // *TODO: Does this need to be here?
- LLStringOps::setupDatetimeInfo(false);
-
- // Go to the next startup state
- LLStartUp::setStartupState( STATE_BROWSER_INIT );
- return FALSE;
- }
-
-
- if (STATE_BROWSER_INIT == LLStartUp::getStartupState())
- {
- LL_DEBUGS("AppInit") << "STATE_BROWSER_INIT" << LL_ENDL;
- std::string msg = LLTrans::getString("LoginInitializingBrowser");
- set_startup_status(0.03f, msg.c_str(), gAgent.mMOTD.c_str());
- display_startup();
- // LLViewerMedia::initBrowser();
- LLStartUp::setStartupState( STATE_LOGIN_SHOW );
- return FALSE;
- }
-
-
- if (STATE_LOGIN_SHOW == LLStartUp::getStartupState())
- {
- LL_DEBUGS("AppInit") << "Initializing Window, show_connect_box = "
- << show_connect_box << LL_ENDL;
-
- // if we've gone backwards in the login state machine, to this state where we show the UI
- // AND the debug setting to exit in this case is true, then go ahead and bail quickly
- if ( mLoginStatePastUI && gSavedSettings.getBOOL("QuitOnLoginActivated") )
- {
- LL_DEBUGS("AppInit") << "taking QuitOnLoginActivated exit" << LL_ENDL;
- // no requirement for notification here - just exit
- LLAppViewer::instance()->earlyExitNoNotify();
- }
-
- gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
-
- // Login screen needs menus for preferences, but we can enter
- // this startup phase more than once.
- if (gLoginMenuBarView == NULL)
- {
- LL_DEBUGS("AppInit") << "initializing menu bar" << LL_ENDL;
- initialize_spellcheck_menu();
- init_menus();
- }
- show_release_notes_if_required();
-
- if (show_connect_box)
- {
- LL_DEBUGS("AppInit") << "show_connect_box on" << LL_ENDL;
- // Load all the name information out of the login view
- // NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't
- // show the login view until login_show() is called below.
- if (gUserCredential.isNull())
- {
- LL_DEBUGS("AppInit") << "loading credentials from gLoginHandler" << LL_ENDL;
- gUserCredential = gLoginHandler.initializeLoginInfo();
- }
- // Make sure the process dialog doesn't hide things
- gViewerWindow->setShowProgress(FALSE);
- // Show the login dialog
- login_show();
- // connect dialog is already shown, so fill in the names
- LLPanelLogin::populateFields( gUserCredential, gRememberUser, gRememberPassword);
- LLPanelLogin::giveFocus();
-
- // MAINT-3231 Show first run dialog only for Desura viewer
- if (gSavedSettings.getString("sourceid") == "1208_desura")
- {
- if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
- {
- LL_INFOS("AppInit") << "FirstLoginThisInstall, calling show_first_run_dialog()" << LL_ENDL;
- show_first_run_dialog();
- }
- else
- {
- LL_DEBUGS("AppInit") << "FirstLoginThisInstall off" << LL_ENDL;
- }
- }
- display_startup();
- LLStartUp::setStartupState( STATE_LOGIN_WAIT ); // Wait for user input
- }
- else
- {
- LL_DEBUGS("AppInit") << "show_connect_box off, skipping to STATE_LOGIN_CLEANUP" << LL_ENDL;
- // skip directly to message template verification
- LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
- }
-
- gViewerWindow->setNormalControlsVisible( FALSE );
- gLoginMenuBarView->setVisible( TRUE );
- gLoginMenuBarView->setEnabled( TRUE );
- show_debug_menus();
-
- // Hide the splash screen
- LL_DEBUGS("AppInit") << "Hide the splash screen and show window" << LL_ENDL;
- LLSplashScreen::hide();
- // Push our window frontmost
- gViewerWindow->getWindow()->show();
-
- // DEV-16927. The following code removes errant keystrokes that happen while the window is being
- // first made visible.
+ if (gAudiop->init(window_handle, LLAppViewer::instance()->getSecondLifeTitle()))
+ {
+ if (FALSE == gSavedSettings.getBOOL("UseMediaPluginsForStreamingAudio"))
+ {
+ LL_INFOS("AppInit") << "Using default impl to render streaming audio" << LL_ENDL;
+ gAudiop->setStreamingAudioImpl(gAudiop->createDefaultStreamingAudioImpl());
+ }
+
+ // if the audio engine hasn't set up its own preferred handler for streaming audio
+ // then set up the generic streaming audio implementation which uses media plugins
+ if (NULL == gAudiop->getStreamingAudioImpl())
+ {
+ LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL;
+ gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins());
+ }
+
+ gAudiop->setMuted(TRUE);
+ }
+ else
+ {
+ LL_WARNS("AppInit") << "Unable to initialize audio engine" << LL_ENDL;
+ delete gAudiop;
+ gAudiop = NULL;
+ }
+ }
+ }
+
+ LL_INFOS("AppInit") << "Audio Engine Initialized." << LL_ENDL;
+
+ if (LLTimer::knownBadTimer())
+ {
+ LL_WARNS("AppInit") << "Unreliable timers detected (may be bad PCI chipset)!!" << LL_ENDL;
+ }
+
+ //
+ // Log on to system
+ //
+ if (gUserCredential.isNull())
+ {
+ gUserCredential = gLoginHandler.initializeLoginInfo();
+ }
+ // Previous initializeLoginInfo may have generated user credentials. Re-check them.
+ if (gUserCredential.isNull())
+ {
+ show_connect_box = TRUE;
+ }
+ else if (gSavedSettings.getBOOL("AutoLogin"))
+ {
+ // Log into last account
+ gRememberPassword = true;
+ gRememberUser = true;
+ gSavedSettings.setBOOL("RememberPassword", TRUE);
+ gSavedSettings.setBOOL("RememberUser", TRUE);
+ show_connect_box = false;
+ }
+ else if (gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
+ {
+ // Console provided login&password
+ gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
+ gRememberUser = gSavedSettings.getBOOL("RememberUser");
+ show_connect_box = false;
+ }
+ else
+ {
+ gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
+ gRememberUser = gSavedSettings.getBOOL("RememberUser");
+ show_connect_box = TRUE;
+ }
+
+ //setup map of datetime strings to codes and slt & local time offset from utc
+ // *TODO: Does this need to be here?
+ LLStringOps::setupDatetimeInfo(false);
+
+ // Go to the next startup state
+ LLStartUp::setStartupState( STATE_BROWSER_INIT );
+ return FALSE;
+ }
+
+
+ if (STATE_BROWSER_INIT == LLStartUp::getStartupState())
+ {
+ LL_DEBUGS("AppInit") << "STATE_BROWSER_INIT" << LL_ENDL;
+ std::string msg = LLTrans::getString("LoginInitializingBrowser");
+ set_startup_status(0.03f, msg.c_str(), gAgent.mMOTD.c_str());
+ display_startup();
+ // LLViewerMedia::initBrowser();
+ LLStartUp::setStartupState( STATE_LOGIN_SHOW );
+ return FALSE;
+ }
+
+
+ if (STATE_LOGIN_SHOW == LLStartUp::getStartupState())
+ {
+ LL_DEBUGS("AppInit") << "Initializing Window, show_connect_box = "
+ << show_connect_box << LL_ENDL;
+
+ // if we've gone backwards in the login state machine, to this state where we show the UI
+ // AND the debug setting to exit in this case is true, then go ahead and bail quickly
+ if ( mLoginStatePastUI && gSavedSettings.getBOOL("QuitOnLoginActivated") )
+ {
+ LL_DEBUGS("AppInit") << "taking QuitOnLoginActivated exit" << LL_ENDL;
+ // no requirement for notification here - just exit
+ LLAppViewer::instance()->earlyExitNoNotify();
+ }
+
+ gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
+
+ // Login screen needs menus for preferences, but we can enter
+ // this startup phase more than once.
+ if (gLoginMenuBarView == NULL)
+ {
+ LL_DEBUGS("AppInit") << "initializing menu bar" << LL_ENDL;
+ initialize_spellcheck_menu();
+ init_menus();
+ }
+ show_release_notes_if_required();
+
+ if (show_connect_box)
+ {
+ LL_DEBUGS("AppInit") << "show_connect_box on" << LL_ENDL;
+ // Load all the name information out of the login view
+ // NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't
+ // show the login view until login_show() is called below.
+ if (gUserCredential.isNull())
+ {
+ LL_DEBUGS("AppInit") << "loading credentials from gLoginHandler" << LL_ENDL;
+ gUserCredential = gLoginHandler.initializeLoginInfo();
+ }
+ // Make sure the process dialog doesn't hide things
+ gViewerWindow->setShowProgress(FALSE);
+ // Show the login dialog
+ login_show();
+ // connect dialog is already shown, so fill in the names
+ LLPanelLogin::populateFields( gUserCredential, gRememberUser, gRememberPassword);
+ LLPanelLogin::giveFocus();
+
+ // MAINT-3231 Show first run dialog only for Desura viewer
+ if (gSavedSettings.getString("sourceid") == "1208_desura")
+ {
+ if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
+ {
+ LL_INFOS("AppInit") << "FirstLoginThisInstall, calling show_first_run_dialog()" << LL_ENDL;
+ show_first_run_dialog();
+ }
+ else
+ {
+ LL_DEBUGS("AppInit") << "FirstLoginThisInstall off" << LL_ENDL;
+ }
+ }
+ display_startup();
+ LLStartUp::setStartupState( STATE_LOGIN_WAIT ); // Wait for user input
+ }
+ else
+ {
+ LL_DEBUGS("AppInit") << "show_connect_box off, skipping to STATE_LOGIN_CLEANUP" << LL_ENDL;
+ // skip directly to message template verification
+ LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+ }
+
+ gViewerWindow->setNormalControlsVisible( FALSE );
+ gLoginMenuBarView->setVisible( TRUE );
+ gLoginMenuBarView->setEnabled( TRUE );
+ show_debug_menus();
+
+ // Hide the splash screen
+ LL_DEBUGS("AppInit") << "Hide the splash screen and show window" << LL_ENDL;
+ LLSplashScreen::hide();
+ // Push our window frontmost
+ gViewerWindow->getWindow()->show();
+
+ // DEV-16927. The following code removes errant keystrokes that happen while the window is being
+ // first made visible.
#ifdef _WIN32
LL_DEBUGS("AppInit") << "Processing PeekMessage" << LL_ENDL;
- MSG msg;
- while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) )
+ MSG msg;
+ while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) )
{
}
LL_DEBUGS("AppInit") << "PeekMessage processed" << LL_ENDL;
#endif
display_startup();
timeout.reset();
- return FALSE;
- }
-
- if (STATE_LOGIN_WAIT == LLStartUp::getStartupState())
- {
- // when we get to this state, we've already been past the login UI
- // (possiblely automatically) - flag this so we can test in the
- // STATE_LOGIN_SHOW state if we've gone backwards
- mLoginStatePastUI = true;
-
- // Don't do anything. Wait for the login view to call the login_callback,
- // which will push us to the next state.
-
- // display() function will be the one to run display_startup()
- // Sleep so we don't spin the CPU
- ms_sleep(1);
- return FALSE;
- }
-
- if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState())
- {
- // Post login screen, we should see if any settings have changed that may
- // require us to either start/stop or change the socks proxy. As various communications
- // past this point may require the proxy to be up.
- if (!LLStartUp::startLLProxy())
- {
- // Proxy start up failed, we should now bail the state machine
- // startLLProxy() will have reported an error to the user
- // already, so we just go back to the login screen. The user
- // could then change the preferences to fix the issue.
-
- LLStartUp::setStartupState(STATE_LOGIN_SHOW);
- return FALSE;
- }
-
- // reset the values that could have come in from a slurl
- // DEV-42215: Make sure they're not empty -- gUserCredential
- // might already have been set from gSavedSettings, and it's too bad
- // to overwrite valid values with empty strings.
-
- if (show_connect_box)
- {
- // TODO if not use viewer auth
- // Load all the name information out of the login view
- LLPanelLogin::getFields(gUserCredential, gRememberUser, gRememberPassword);
- // end TODO
-
- // HACK: Try to make not jump on login
- gKeyboard->resetKeys();
- }
-
- // when we get to this state, we've already been past the login UI
- // (possiblely automatically) - flag this so we can test in the
- // STATE_LOGIN_SHOW state if we've gone backwards
- mLoginStatePastUI = true;
-
- // save the credentials
- std::string userid = "unknown";
+ return FALSE;
+ }
+
+ if (STATE_LOGIN_WAIT == LLStartUp::getStartupState())
+ {
+ // when we get to this state, we've already been past the login UI
+ // (possiblely automatically) - flag this so we can test in the
+ // STATE_LOGIN_SHOW state if we've gone backwards
+ mLoginStatePastUI = true;
+
+ // Don't do anything. Wait for the login view to call the login_callback,
+ // which will push us to the next state.
+
+ // display() function will be the one to run display_startup()
+ // Sleep so we don't spin the CPU
+ ms_sleep(1);
+ return FALSE;
+ }
+
+ if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState())
+ {
+ // Post login screen, we should see if any settings have changed that may
+ // require us to either start/stop or change the socks proxy. As various communications
+ // past this point may require the proxy to be up.
+ if (!LLStartUp::startLLProxy())
+ {
+ // Proxy start up failed, we should now bail the state machine
+ // startLLProxy() will have reported an error to the user
+ // already, so we just go back to the login screen. The user
+ // could then change the preferences to fix the issue.
+
+ LLStartUp::setStartupState(STATE_LOGIN_SHOW);
+ return FALSE;
+ }
+
+ // reset the values that could have come in from a slurl
+ // DEV-42215: Make sure they're not empty -- gUserCredential
+ // might already have been set from gSavedSettings, and it's too bad
+ // to overwrite valid values with empty strings.
+
+ if (show_connect_box)
+ {
+ // TODO if not use viewer auth
+ // Load all the name information out of the login view
+ LLPanelLogin::getFields(gUserCredential, gRememberUser, gRememberPassword);
+ // end TODO
+
+ // HACK: Try to make not jump on login
+ gKeyboard->resetKeys();
+ }
+
+ // when we get to this state, we've already been past the login UI
+ // (possiblely automatically) - flag this so we can test in the
+ // STATE_LOGIN_SHOW state if we've gone backwards
+ mLoginStatePastUI = true;
+
+ // save the credentials
+ std::string userid = "unknown";
if (gUserCredential.notNull())
{
userid = gUserCredential->userID();
@@ -927,24 +927,24 @@ bool idle_startup()
gSecAPIHandler->saveCredential(gUserCredential, gRememberPassword);
}
}
- gSavedSettings.setBOOL("RememberPassword", gRememberPassword);
- gSavedSettings.setBOOL("RememberUser", gRememberUser);
- LL_INFOS("AppInit") << "Attempting login as: " << userid << LL_ENDL;
- gDebugInfo["LoginName"] = userid;
-
- // create necessary directories
- // *FIX: these mkdir's should error check
- gDirUtilp->setLindenUserDir(userid);
- LLFile::mkdir(gDirUtilp->getLindenUserDir());
-
- // As soon as directories are ready initialize notification storages
- if (!LLPersistentNotificationStorage::instanceExists())
- {
- // check existance since this part of code can be reached
- // twice due to login failures
- LLPersistentNotificationStorage::initParamSingleton();
- LLDoNotDisturbNotificationStorage::initParamSingleton();
- }
+ gSavedSettings.setBOOL("RememberPassword", gRememberPassword);
+ gSavedSettings.setBOOL("RememberUser", gRememberUser);
+ LL_INFOS("AppInit") << "Attempting login as: " << userid << LL_ENDL;
+ gDebugInfo["LoginName"] = userid;
+
+ // create necessary directories
+ // *FIX: these mkdir's should error check
+ gDirUtilp->setLindenUserDir(userid);
+ LLFile::mkdir(gDirUtilp->getLindenUserDir());
+
+ // As soon as directories are ready initialize notification storages
+ if (!LLPersistentNotificationStorage::instanceExists())
+ {
+ // check existance since this part of code can be reached
+ // twice due to login failures
+ LLPersistentNotificationStorage::initParamSingleton();
+ LLDoNotDisturbNotificationStorage::initParamSingleton();
+ }
else
{
// reinitialize paths in case user switched grids or accounts
@@ -952,152 +952,152 @@ bool idle_startup()
LLDoNotDisturbNotificationStorage::getInstance()->reset();
}
- // Set PerAccountSettingsFile to the default value.
- std::string settings_per_account = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount"));
- gSavedSettings.setString("PerAccountSettingsFile", settings_per_account);
- gDebugInfo["PerAccountSettingsFilename"] = settings_per_account;
-
- // Note: can't store warnings files per account because some come up before login
-
- // Overwrite default user settings with user settings
- LLAppViewer::instance()->loadSettingsFromDirectory("Account");
-
- // Convert 'LogInstantMessages' into 'KeepConversationLogTranscripts' for backward compatibility (CHUI-743).
- LLControlVariablePtr logInstantMessagesControl = gSavedPerAccountSettings.getControl("LogInstantMessages");
- if (logInstantMessagesControl.notNull())
- {
- gSavedPerAccountSettings.setS32("KeepConversationLogTranscripts", logInstantMessagesControl->getValue() ? 2 : 1);
- }
-
- // Need to set the LastLogoff time here if we don't have one. LastLogoff is used for "Recent Items" calculation
- // and startup time is close enough if we don't have a real value.
- if (gSavedPerAccountSettings.getU32("LastLogoff") == 0)
- {
- gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
- }
-
- //Default the path if one isn't set.
- // *NOTE: unable to check variable differ from "InstantMessageLogPath" because it was
- // provided in pre 2.0 viewer. See EXT-6661
- if (gSavedPerAccountSettings.getString("InstantMessageLogPath").empty())
- {
- gDirUtilp->setChatLogsDir(gDirUtilp->getOSUserAppDir());
- gSavedPerAccountSettings.setString("InstantMessageLogPath", gDirUtilp->getChatLogsDir());
- }
- else
- {
- gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
- }
- gDirUtilp->setPerAccountChatLogsDir(userid);
-
- LLFile::mkdir(gDirUtilp->getChatLogsDir());
- LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
-
- if (show_connect_box)
- {
- LLSLURL slurl;
- //LLPanelLogin::closePanel();
- }
-
-
- // Load URL History File
- LLURLHistory::loadFile("url_history.xml");
- // Load location history
- LLLocationHistory::getInstance()->load();
-
- // Load Avatars icons cache
- LLAvatarIconIDCache::getInstance()->load();
-
- LLRenderMuteList::getInstance()->loadFromFile();
-
- //-------------------------------------------------
- // Handle startup progress screen
- //-------------------------------------------------
-
- // on startup the user can request to go to their home,
- // their last location, or some URL "-url //sim/x/y[/z]"
- // All accounts have both a home and a last location, and we don't support
- // more locations than that. Choose the appropriate one. JC
- switch (LLStartUp::getStartSLURL().getType())
- {
- case LLSLURL::LOCATION:
- agent_location_id = START_LOCATION_ID_URL;
- break;
- case LLSLURL::LAST_LOCATION:
- agent_location_id = START_LOCATION_ID_LAST;
- break;
- default:
- agent_location_id = START_LOCATION_ID_HOME;
- break;
- }
-
- gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
-
- // Display the startup progress bar.
- gViewerWindow->initTextures(agent_location_id);
- gViewerWindow->setShowProgress(TRUE);
- gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Quit"));
-
- gViewerWindow->revealIntroPanel();
-
- LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT );
-
- return FALSE;
- }
-
- if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
- {
- gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridId();
-
- // Update progress status and the display loop.
- auth_desc = LLTrans::getString("LoginInProgress");
- set_startup_status(progress, auth_desc, auth_message);
- progress += 0.02f;
- display_startup();
-
- // Setting initial values...
- LLLoginInstance* login = LLLoginInstance::getInstance();
- login->setNotificationsInterface(LLNotifications::getInstance());
-
- login->setSerialNumber(LLAppViewer::instance()->getSerialNumber());
- login->setLastExecEvent(gLastExecEvent);
- login->setLastExecDuration(gLastExecDuration);
-
- // This call to LLLoginInstance::connect() starts the
- // authentication process.
- login->connect(gUserCredential);
-
- LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK );
- return FALSE;
- }
-
- if(STATE_LOGIN_CURL_UNSTUCK == LLStartUp::getStartupState())
- {
- // If we get here we have gotten past the potential stall
- // in curl, so take "may appear frozen" out of progress bar. JC
- auth_desc = LLTrans::getString("LoginInProgressNoFrozen");
- set_startup_status(progress, auth_desc, auth_message);
-
- LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE );
- return FALSE;
- }
-
- if(STATE_LOGIN_PROCESS_RESPONSE == LLStartUp::getStartupState())
- {
- // Generic failure message
- std::ostringstream emsg;
- emsg << LLTrans::getString("LoginFailedHeader") << "\n";
- if(LLLoginInstance::getInstance()->authFailure())
- {
- LL_INFOS("LLStartup") << "Login failed, LLLoginInstance::getResponse(): "
- << LLLoginInstance::getInstance()->getResponse() << LL_ENDL;
- LLSD response = LLLoginInstance::getInstance()->getResponse();
- // Still have error conditions that may need some
- // sort of handling - dig up specific message
- std::string reason_response = response["reason"];
- std::string message_response = response["message"];
- std::string message_id = response["message_id"];
- std::string message; // actual string to show the user
+ // Set PerAccountSettingsFile to the default value.
+ std::string settings_per_account = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount"));
+ gSavedSettings.setString("PerAccountSettingsFile", settings_per_account);
+ gDebugInfo["PerAccountSettingsFilename"] = settings_per_account;
+
+ // Note: can't store warnings files per account because some come up before login
+
+ // Overwrite default user settings with user settings
+ LLAppViewer::instance()->loadSettingsFromDirectory("Account");
+
+ // Convert 'LogInstantMessages' into 'KeepConversationLogTranscripts' for backward compatibility (CHUI-743).
+ LLControlVariablePtr logInstantMessagesControl = gSavedPerAccountSettings.getControl("LogInstantMessages");
+ if (logInstantMessagesControl.notNull())
+ {
+ gSavedPerAccountSettings.setS32("KeepConversationLogTranscripts", logInstantMessagesControl->getValue() ? 2 : 1);
+ }
+
+ // Need to set the LastLogoff time here if we don't have one. LastLogoff is used for "Recent Items" calculation
+ // and startup time is close enough if we don't have a real value.
+ if (gSavedPerAccountSettings.getU32("LastLogoff") == 0)
+ {
+ gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
+ }
+
+ //Default the path if one isn't set.
+ // *NOTE: unable to check variable differ from "InstantMessageLogPath" because it was
+ // provided in pre 2.0 viewer. See EXT-6661
+ if (gSavedPerAccountSettings.getString("InstantMessageLogPath").empty())
+ {
+ gDirUtilp->setChatLogsDir(gDirUtilp->getOSUserAppDir());
+ gSavedPerAccountSettings.setString("InstantMessageLogPath", gDirUtilp->getChatLogsDir());
+ }
+ else
+ {
+ gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
+ }
+ gDirUtilp->setPerAccountChatLogsDir(userid);
+
+ LLFile::mkdir(gDirUtilp->getChatLogsDir());
+ LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
+
+ if (show_connect_box)
+ {
+ LLSLURL slurl;
+ //LLPanelLogin::closePanel();
+ }
+
+
+ // Load URL History File
+ LLURLHistory::loadFile("url_history.xml");
+ // Load location history
+ LLLocationHistory::getInstance()->load();
+
+ // Load Avatars icons cache
+ LLAvatarIconIDCache::getInstance()->load();
+
+ LLRenderMuteList::getInstance()->loadFromFile();
+
+ //-------------------------------------------------
+ // Handle startup progress screen
+ //-------------------------------------------------
+
+ // on startup the user can request to go to their home,
+ // their last location, or some URL "-url //sim/x/y[/z]"
+ // All accounts have both a home and a last location, and we don't support
+ // more locations than that. Choose the appropriate one. JC
+ switch (LLStartUp::getStartSLURL().getType())
+ {
+ case LLSLURL::LOCATION:
+ agent_location_id = START_LOCATION_ID_URL;
+ break;
+ case LLSLURL::LAST_LOCATION:
+ agent_location_id = START_LOCATION_ID_LAST;
+ break;
+ default:
+ agent_location_id = START_LOCATION_ID_HOME;
+ break;
+ }
+
+ gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
+
+ // Display the startup progress bar.
+ gViewerWindow->initTextures(agent_location_id);
+ gViewerWindow->setShowProgress(TRUE);
+ gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Quit"));
+
+ gViewerWindow->revealIntroPanel();
+
+ LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT );
+
+ return FALSE;
+ }
+
+ if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
+ {
+ gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridId();
+
+ // Update progress status and the display loop.
+ auth_desc = LLTrans::getString("LoginInProgress");
+ set_startup_status(progress, auth_desc, auth_message);
+ progress += 0.02f;
+ display_startup();
+
+ // Setting initial values...
+ LLLoginInstance* login = LLLoginInstance::getInstance();
+ login->setNotificationsInterface(LLNotifications::getInstance());
+
+ login->setSerialNumber(LLAppViewer::instance()->getSerialNumber());
+ login->setLastExecEvent(gLastExecEvent);
+ login->setLastExecDuration(gLastExecDuration);
+
+ // This call to LLLoginInstance::connect() starts the
+ // authentication process.
+ login->connect(gUserCredential);
+
+ LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK );
+ return FALSE;
+ }
+
+ if(STATE_LOGIN_CURL_UNSTUCK == LLStartUp::getStartupState())
+ {
+ // If we get here we have gotten past the potential stall
+ // in curl, so take "may appear frozen" out of progress bar. JC
+ auth_desc = LLTrans::getString("LoginInProgressNoFrozen");
+ set_startup_status(progress, auth_desc, auth_message);
+
+ LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE );
+ return FALSE;
+ }
+
+ if(STATE_LOGIN_PROCESS_RESPONSE == LLStartUp::getStartupState())
+ {
+ // Generic failure message
+ std::ostringstream emsg;
+ emsg << LLTrans::getString("LoginFailedHeader") << "\n";
+ if(LLLoginInstance::getInstance()->authFailure())
+ {
+ LL_INFOS("LLStartup") << "Login failed, LLLoginInstance::getResponse(): "
+ << LLLoginInstance::getInstance()->getResponse() << LL_ENDL;
+ LLSD response = LLLoginInstance::getInstance()->getResponse();
+ // Still have error conditions that may need some
+ // sort of handling - dig up specific message
+ std::string reason_response = response["reason"];
+ std::string message_response = response["message"];
+ std::string message_id = response["message_id"];
+ std::string message; // actual string to show the user
bool localized_by_id = false;
if(!message_id.empty())
@@ -1130,58 +1130,58 @@ bool idle_startup()
}
if(!localized_by_id && !message_response.empty())
- {
- // *HACK: "no_inventory_host" sent as the message itself.
- // Remove this clause when server is sending message_id as well.
- message = LLAgent::sTeleportErrorMessages[ message_response ];
- }
-
- if (message.empty())
- {
- // Fallback to server-supplied string; necessary since server
- // may add strings that this viewer is not yet aware of
- message = message_response;
- }
-
- emsg << message;
-
-
- if(reason_response == "key")
- {
- // Couldn't login because user/password is wrong
- // Clear the credential
- gUserCredential->clearAuthenticator();
- }
-
- if(reason_response == "update"
- || reason_response == "optional")
- {
- // In the case of a needed update, quit.
- // Its either downloading or declined.
- // If optional was skipped this case shouldn't
- // be reached.
-
- LL_INFOS("LLStartup") << "Forcing a quit due to update." << LL_ENDL;
- LLLoginInstance::getInstance()->disconnect();
- LLAppViewer::instance()->forceQuit();
- }
- else
- {
- if (reason_response != "tos" && reason_response != "mfa_challenge")
- {
- // Don't pop up a notification in the TOS or MFA cases because
- // the specialized floater has already scolded the user.
- std::string error_code;
- if(response.has("errorcode"))
- {
- error_code = response["errorcode"].asString();
- }
- if ((reason_response == "CURLError") &&
- (error_code == "SSL_CACERT" || error_code == "SSL_PEER_CERTIFICATE") &&
- response.has("certificate"))
- {
- // This was a certificate error, so grab the certificate
- // and throw up the appropriate dialog.
+ {
+ // *HACK: "no_inventory_host" sent as the message itself.
+ // Remove this clause when server is sending message_id as well.
+ message = LLAgent::sTeleportErrorMessages[ message_response ];
+ }
+
+ if (message.empty())
+ {
+ // Fallback to server-supplied string; necessary since server
+ // may add strings that this viewer is not yet aware of
+ message = message_response;
+ }
+
+ emsg << message;
+
+
+ if(reason_response == "key")
+ {
+ // Couldn't login because user/password is wrong
+ // Clear the credential
+ gUserCredential->clearAuthenticator();
+ }
+
+ if(reason_response == "update"
+ || reason_response == "optional")
+ {
+ // In the case of a needed update, quit.
+ // Its either downloading or declined.
+ // If optional was skipped this case shouldn't
+ // be reached.
+
+ LL_INFOS("LLStartup") << "Forcing a quit due to update." << LL_ENDL;
+ LLLoginInstance::getInstance()->disconnect();
+ LLAppViewer::instance()->forceQuit();
+ }
+ else
+ {
+ if (reason_response != "tos" && reason_response != "mfa_challenge")
+ {
+ // Don't pop up a notification in the TOS or MFA cases because
+ // the specialized floater has already scolded the user.
+ std::string error_code;
+ if(response.has("errorcode"))
+ {
+ error_code = response["errorcode"].asString();
+ }
+ if ((reason_response == "CURLError") &&
+ (error_code == "SSL_CACERT" || error_code == "SSL_PEER_CERTIFICATE") &&
+ response.has("certificate"))
+ {
+ // This was a certificate error, so grab the certificate
+ // and throw up the appropriate dialog.
LLPointer<LLCertificate> certificate;
try
{
@@ -1200,215 +1200,215 @@ bool idle_startup()
gSavedSettings.setBOOL("AutoLogin", FALSE);
show_connect_box = true;
}
- if(certificate)
- {
- LLSD args = transform_cert_args(certificate);
-
- if(error_code == "SSL_CACERT")
- {
- // if we are handling an untrusted CA, throw up the dialog
- // with the 'trust this CA' button.
- LLNotificationsUtil::add("TrustCertificateError", args, response,
- trust_cert_done);
-
- show_connect_box = true;
- }
- else
- {
- // the certificate exception returns a unique string for each type of exception.
- // we grab this string via the LLUserAuth object, and use that to grab the localized
- // string.
- args["REASON"] = LLTrans::getString(message_response);
-
- LLNotificationsUtil::add("GeneralCertificateError", args, response,
- general_cert_done);
-
- reset_login();
- gSavedSettings.setBOOL("AutoLogin", FALSE);
- show_connect_box = true;
-
- }
-
- }
- }
+ if(certificate)
+ {
+ LLSD args = transform_cert_args(certificate);
+
+ if(error_code == "SSL_CACERT")
+ {
+ // if we are handling an untrusted CA, throw up the dialog
+ // with the 'trust this CA' button.
+ LLNotificationsUtil::add("TrustCertificateError", args, response,
+ trust_cert_done);
+
+ show_connect_box = true;
+ }
+ else
+ {
+ // the certificate exception returns a unique string for each type of exception.
+ // we grab this string via the LLUserAuth object, and use that to grab the localized
+ // string.
+ args["REASON"] = LLTrans::getString(message_response);
+
+ LLNotificationsUtil::add("GeneralCertificateError", args, response,
+ general_cert_done);
+
+ reset_login();
+ gSavedSettings.setBOOL("AutoLogin", FALSE);
+ show_connect_box = true;
+
+ }
+
+ }
+ }
else if (reason_response == "BadType")
{
LLNotificationsUtil::add("LoginFailedToParse", LLSD(), LLSD(), login_alert_done);
}
- else if (!message.empty())
- {
- // This wasn't a certificate error, so throw up the normal
- // notificatioin message.
- LLSD args;
- args["ERROR_MESSAGE"] = emsg.str();
- LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
- LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
- }
- }
- transition_back_to_login_panel(emsg.str());
- show_connect_box = true;
- }
- }
- else if(LLLoginInstance::getInstance()->authSuccess())
- {
- if(process_login_success_response())
- {
- // Pass the user information to the voice chat server interface.
- LLVoiceClient::getInstance()->userAuthorized(gUserCredential->userID(), gAgentID);
- // create the default proximal channel
- LLVoiceChannel::initClass();
- LLStartUp::setStartupState( STATE_WORLD_INIT);
- LLTrace::get_frame_recording().reset();
- }
- else
- {
- LLSD args;
- args["ERROR_MESSAGE"] = emsg.str();
- LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
- LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
- transition_back_to_login_panel(emsg.str());
- show_connect_box = true;
- return FALSE;
- }
- }
- return FALSE;
- }
-
- //---------------------------------------------------------------------
- // World Init
- //---------------------------------------------------------------------
- if (STATE_WORLD_INIT == LLStartUp::getStartupState())
- {
- set_startup_status(0.30f, LLTrans::getString("LoginInitializingWorld"), gAgent.mMOTD);
- display_startup();
- // We should have an agent id by this point.
- llassert(!(gAgentID == LLUUID::null));
-
- // Finish agent initialization. (Requires gSavedSettings, builds camera)
- gAgent.init();
- display_startup();
- gAgentCamera.init();
- display_startup();
- display_startup();
-
- // Since we connected, save off the settings so the user doesn't have to
- // type the name/password again if we crash.
- gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
- LLUIColorTable::instance().saveUserSettings();
-
- display_startup();
-
- //
- // Initialize classes w/graphics stuff.
- //
- LLViewerStatsRecorder::instance(); // Since textures work in threads
- LLSurface::initClasses();
- display_startup();
-
- display_startup();
-
- LLDrawable::initClass();
- display_startup();
-
- // init the shader managers
- LLPostProcess::initClass();
- display_startup();
+ else if (!message.empty())
+ {
+ // This wasn't a certificate error, so throw up the normal
+ // notificatioin message.
+ LLSD args;
+ args["ERROR_MESSAGE"] = emsg.str();
+ LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
+ LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
+ }
+ }
+ transition_back_to_login_panel(emsg.str());
+ show_connect_box = true;
+ }
+ }
+ else if(LLLoginInstance::getInstance()->authSuccess())
+ {
+ if(process_login_success_response())
+ {
+ // Pass the user information to the voice chat server interface.
+ LLVoiceClient::getInstance()->userAuthorized(gUserCredential->userID(), gAgentID);
+ // create the default proximal channel
+ LLVoiceChannel::initClass();
+ LLStartUp::setStartupState( STATE_WORLD_INIT);
+ LLTrace::get_frame_recording().reset();
+ }
+ else
+ {
+ LLSD args;
+ args["ERROR_MESSAGE"] = emsg.str();
+ LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
+ LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
+ transition_back_to_login_panel(emsg.str());
+ show_connect_box = true;
+ return FALSE;
+ }
+ }
+ return FALSE;
+ }
+
+ //---------------------------------------------------------------------
+ // World Init
+ //---------------------------------------------------------------------
+ if (STATE_WORLD_INIT == LLStartUp::getStartupState())
+ {
+ set_startup_status(0.30f, LLTrans::getString("LoginInitializingWorld"), gAgent.mMOTD);
+ display_startup();
+ // We should have an agent id by this point.
+ llassert(!(gAgentID == LLUUID::null));
+
+ // Finish agent initialization. (Requires gSavedSettings, builds camera)
+ gAgent.init();
+ display_startup();
+ gAgentCamera.init();
+ display_startup();
+ display_startup();
+
+ // Since we connected, save off the settings so the user doesn't have to
+ // type the name/password again if we crash.
+ gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
+ LLUIColorTable::instance().saveUserSettings();
+
+ display_startup();
+
+ //
+ // Initialize classes w/graphics stuff.
+ //
+ LLViewerStatsRecorder::instance(); // Since textures work in threads
+ LLSurface::initClasses();
+ display_startup();
+
+ display_startup();
+
+ LLDrawable::initClass();
+ display_startup();
+
+ // init the shader managers
+ LLPostProcess::initClass();
+ display_startup();
LLAvatarAppearance::initClass("avatar_lad.xml","avatar_skeleton.xml");
- display_startup();
-
- LLViewerObject::initVOClasses();
- display_startup();
-
- // Initialize all our tools. Must be done after saved settings loaded.
- // NOTE: This also is where gToolMgr used to be instantiated before being turned into a singleton.
- LLToolMgr::getInstance()->initTools();
- display_startup();
-
- // Pre-load floaters, like the world map, that are slow to spawn
- // due to XML complexity.
- gViewerWindow->initWorldUI();
-
- display_startup();
-
- // This is where we used to initialize gWorldp. Original comment said:
- // World initialization must be done after above window init
-
- // User might have overridden far clip
- LLWorld::getInstance()->setLandFarClip(gAgentCamera.mDrawDistance);
- display_startup();
- // Before we create the first region, we need to set the agent's mOriginGlobal
- // This is necessary because creating objects before this is set will result in a
- // bad mPositionAgent cache.
-
- gAgent.initOriginGlobal(from_region_handle(gFirstSimHandle));
- display_startup();
-
- LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim);
- display_startup();
-
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(gFirstSimHandle);
- LL_INFOS("AppInit") << "Adding initial simulator " << regionp->getOriginGlobal() << LL_ENDL;
-
- LL_DEBUGS("CrossingCaps") << "Calling setSeedCapability from init_idle(). Seed cap == "
- << gFirstSimSeedCap << LL_ENDL;
- regionp->setSeedCapability(gFirstSimSeedCap);
- LL_DEBUGS("AppInit") << "Waiting for seed grant ...." << LL_ENDL;
- display_startup();
- // Set agent's initial region to be the one we just created.
- gAgent.setRegion(regionp);
- display_startup();
- // Set agent's initial position, which will be read by LLVOAvatar when the avatar
- // object is created. I think this must be done after setting the region. JC
- gAgent.setPositionAgent(agent_start_position_region);
-
- display_startup();
- LLStartUp::initExperiences();
-
- display_startup();
-
- // If logging should be enebled, turns it on and loads history from disk
- // Note: does not happen on init of singleton because preferences can use
- // this instance without logging in
- LLConversationLog::getInstance()->initLoggingState();
-
- LLStartUp::setStartupState( STATE_MULTIMEDIA_INIT );
-
- return FALSE;
- }
-
-
- //---------------------------------------------------------------------
- // Load QuickTime/GStreamer and other multimedia engines, can be slow.
- // Do it while we're waiting on the network for our seed capability. JC
- //---------------------------------------------------------------------
- if (STATE_MULTIMEDIA_INIT == LLStartUp::getStartupState())
- {
- LLStartUp::multimediaInit();
- LLStartUp::setStartupState( STATE_FONT_INIT );
- display_startup();
- return FALSE;
- }
-
- // Loading fonts takes several seconds
- if (STATE_FONT_INIT == LLStartUp::getStartupState())
- {
- LLStartUp::fontInit();
- LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT );
- display_startup();
- return FALSE;
- }
-
- //---------------------------------------------------------------------
- // Wait for Seed Cap Grant
- //---------------------------------------------------------------------
- if(STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
- {
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(gFirstSimHandle);
- if (regionp->capabilitiesReceived())
- {
- LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED );
- }
+ display_startup();
+
+ LLViewerObject::initVOClasses();
+ display_startup();
+
+ // Initialize all our tools. Must be done after saved settings loaded.
+ // NOTE: This also is where gToolMgr used to be instantiated before being turned into a singleton.
+ LLToolMgr::getInstance()->initTools();
+ display_startup();
+
+ // Pre-load floaters, like the world map, that are slow to spawn
+ // due to XML complexity.
+ gViewerWindow->initWorldUI();
+
+ display_startup();
+
+ // This is where we used to initialize gWorldp. Original comment said:
+ // World initialization must be done after above window init
+
+ // User might have overridden far clip
+ LLWorld::getInstance()->setLandFarClip(gAgentCamera.mDrawDistance);
+ display_startup();
+ // Before we create the first region, we need to set the agent's mOriginGlobal
+ // This is necessary because creating objects before this is set will result in a
+ // bad mPositionAgent cache.
+
+ gAgent.initOriginGlobal(from_region_handle(gFirstSimHandle));
+ display_startup();
+
+ LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim);
+ display_startup();
+
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(gFirstSimHandle);
+ LL_INFOS("AppInit") << "Adding initial simulator " << regionp->getOriginGlobal() << LL_ENDL;
+
+ LL_DEBUGS("CrossingCaps") << "Calling setSeedCapability from init_idle(). Seed cap == "
+ << gFirstSimSeedCap << LL_ENDL;
+ regionp->setSeedCapability(gFirstSimSeedCap);
+ LL_DEBUGS("AppInit") << "Waiting for seed grant ...." << LL_ENDL;
+ display_startup();
+ // Set agent's initial region to be the one we just created.
+ gAgent.setRegion(regionp);
+ display_startup();
+ // Set agent's initial position, which will be read by LLVOAvatar when the avatar
+ // object is created. I think this must be done after setting the region. JC
+ gAgent.setPositionAgent(agent_start_position_region);
+
+ display_startup();
+ LLStartUp::initExperiences();
+
+ display_startup();
+
+ // If logging should be enebled, turns it on and loads history from disk
+ // Note: does not happen on init of singleton because preferences can use
+ // this instance without logging in
+ LLConversationLog::getInstance()->initLoggingState();
+
+ LLStartUp::setStartupState( STATE_MULTIMEDIA_INIT );
+
+ return FALSE;
+ }
+
+
+ //---------------------------------------------------------------------
+ // Load QuickTime/GStreamer and other multimedia engines, can be slow.
+ // Do it while we're waiting on the network for our seed capability. JC
+ //---------------------------------------------------------------------
+ if (STATE_MULTIMEDIA_INIT == LLStartUp::getStartupState())
+ {
+ LLStartUp::multimediaInit();
+ LLStartUp::setStartupState( STATE_FONT_INIT );
+ display_startup();
+ return FALSE;
+ }
+
+ // Loading fonts takes several seconds
+ if (STATE_FONT_INIT == LLStartUp::getStartupState())
+ {
+ LLStartUp::fontInit();
+ LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT );
+ display_startup();
+ return FALSE;
+ }
+
+ //---------------------------------------------------------------------
+ // Wait for Seed Cap Grant
+ //---------------------------------------------------------------------
+ if(STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
+ {
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(gFirstSimHandle);
+ if (regionp->capabilitiesReceived())
+ {
+ LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED );
+ }
else if (regionp->capabilitiesError())
{
LL_WARNS("AppInit") << "Failed to get capabilities. Backing up to login screen!" << LL_ENDL;
@@ -1422,9 +1422,9 @@ bool idle_startup()
}
reset_login();
}
- else
- {
- U32 num_retries = regionp->getNumSeedCapRetries();
+ else
+ {
+ U32 num_retries = regionp->getNumSeedCapRetries();
if (num_retries > MAX_SEED_CAP_ATTEMPTS_BEFORE_ABORT)
{
LL_WARNS("AppInit") << "Failed to get capabilities. Backing up to login screen!" << LL_ENDL;
@@ -1438,29 +1438,29 @@ bool idle_startup()
}
reset_login();
}
- else if (num_retries > 0)
- {
- LLStringUtil::format_map_t args;
- args["[NUMBER]"] = llformat("%d", num_retries + 1);
- set_startup_status(0.4f, LLTrans::getString("LoginRetrySeedCapGrant", args), gAgent.mMOTD.c_str());
- }
- else
- {
- set_startup_status(0.4f, LLTrans::getString("LoginRequestSeedCapGrant"), gAgent.mMOTD.c_str());
- }
- }
- display_startup();
- return FALSE;
- }
-
-
- //---------------------------------------------------------------------
- // Seed Capability Granted
- // no newMessage calls should happen before this point
- //---------------------------------------------------------------------
- if (STATE_SEED_CAP_GRANTED == LLStartUp::getStartupState())
- {
- display_startup();
+ else if (num_retries > 0)
+ {
+ LLStringUtil::format_map_t args;
+ args["[NUMBER]"] = llformat("%d", num_retries + 1);
+ set_startup_status(0.4f, LLTrans::getString("LoginRetrySeedCapGrant", args), gAgent.mMOTD.c_str());
+ }
+ else
+ {
+ set_startup_status(0.4f, LLTrans::getString("LoginRequestSeedCapGrant"), gAgent.mMOTD.c_str());
+ }
+ }
+ display_startup();
+ return FALSE;
+ }
+
+
+ //---------------------------------------------------------------------
+ // Seed Capability Granted
+ // no newMessage calls should happen before this point
+ //---------------------------------------------------------------------
+ if (STATE_SEED_CAP_GRANTED == LLStartUp::getStartupState())
+ {
+ display_startup();
// These textures are not warrantied to be cached, so needs
// to hapen with caps granted
@@ -1470,291 +1470,291 @@ bool idle_startup()
LLEnvironment::getInstance()->initSingleton();
display_startup();
- update_texture_fetch();
- display_startup();
-
- if ( gViewerWindow != NULL)
- { // This isn't the first logon attempt, so show the UI
- gViewerWindow->setNormalControlsVisible( TRUE );
- }
- gLoginMenuBarView->setVisible( FALSE );
- gLoginMenuBarView->setEnabled( FALSE );
- display_startup();
-
- // direct logging to the debug console's line buffer
- LLError::logToFixedBuffer(gDebugView->mDebugConsolep);
- display_startup();
-
- // set initial visibility of debug console
- gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole"));
- display_startup();
-
- //
- // Set message handlers
- //
- LL_INFOS("AppInit") << "Initializing communications..." << LL_ENDL;
-
- // register callbacks for messages. . . do this after initial handshake to make sure that we don't catch any unwanted
- register_viewer_callbacks(gMessageSystem);
- display_startup();
-
- // Debugging info parameters
- gMessageSystem->setMaxMessageTime( 0.5f ); // Spam if decoding all msgs takes more than 500 ms
- display_startup();
-
- #ifndef LL_RELEASE_FOR_DOWNLOAD
- gMessageSystem->setTimeDecodes( TRUE ); // Time the decode of each msg
- gMessageSystem->setTimeDecodesSpamThreshold( 0.05f ); // Spam if a single msg takes over 50ms to decode
- #endif
- display_startup();
-
- gXferManager->registerCallbacks(gMessageSystem);
- display_startup();
-
- LLStartUp::initNameCache();
- display_startup();
-
- // update the voice settings *after* gCacheName initialization
- // so that we can construct voice UI that relies on the name cache
- if (LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->updateSettings();
- }
- display_startup();
-
- // create a container's instance for start a controlling conversation windows
- // by the voice's events
- LLFloaterIMContainer::getInstance();
- if (gSavedSettings.getS32("ParcelMediaAutoPlayEnable") == 2)
- {
- LLViewerParcelAskPlay::getInstance()->loadSettings();
- }
-
- gAgent.addRegionChangedCallback(boost::bind(&LLPerfStats::StatsRecorder::clearStats));
-
- // *Note: this is where gWorldMap used to be initialized.
-
- // register null callbacks for audio until the audio system is initialized
- gMessageSystem->setHandlerFuncFast(_PREHASH_SoundTrigger, null_message_callback, NULL);
- gMessageSystem->setHandlerFuncFast(_PREHASH_AttachedSound, null_message_callback, NULL);
- display_startup();
-
- //reset statistics
- LLViewerStats::instance().resetStats();
-
- display_startup();
- //
- // Set up region and surface defaults
- //
-
-
- // Sets up the parameters for the first simulator
-
- LL_DEBUGS("AppInit") << "Initializing camera..." << LL_ENDL;
- gFrameTime = totalTime();
- F32Seconds last_time = gFrameTimeSeconds;
- gFrameTimeSeconds = (gFrameTime - gStartTime);
-
- gFrameIntervalSeconds = gFrameTimeSeconds - last_time;
- if (gFrameIntervalSeconds < 0.f)
- {
- gFrameIntervalSeconds = 0.f;
- }
-
- // Make sure agent knows correct aspect ratio
- // FOV limits depend upon aspect ratio so this needs to happen before initializing the FOV below
- LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWorldViewHeightRaw());
- LLViewerCamera::getInstance()->setAspect(gViewerWindow->getWorldViewAspectRatio());
- // Initialize FOV
- LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle"));
- display_startup();
-
- // Move agent to starting location. The position handed to us by
- // the space server is in global coordinates, but the agent frame
- // is in region local coordinates. Therefore, we need to adjust
- // the coordinates handed to us to fit in the local region.
-
- gAgent.setPositionAgent(agent_start_position_region);
- gAgent.resetAxes(gAgentStartLookAt);
- gAgentCamera.stopCameraAnimation();
- gAgentCamera.resetCamera();
- display_startup();
-
- // Initialize global class data needed for surfaces (i.e. textures)
- LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL;
- // Initialize all of the viewer object classes for the first time (doing things like texture fetches.
- LLGLState::checkStates();
-
- gSky.init();
-
- LLGLState::checkStates();
-
- display_startup();
-
- LL_DEBUGS("AppInit") << "Decoding images..." << LL_ENDL;
- // For all images pre-loaded into viewer cache, init
+ update_texture_fetch();
+ display_startup();
+
+ if ( gViewerWindow != NULL)
+ { // This isn't the first logon attempt, so show the UI
+ gViewerWindow->setNormalControlsVisible( TRUE );
+ }
+ gLoginMenuBarView->setVisible( FALSE );
+ gLoginMenuBarView->setEnabled( FALSE );
+ display_startup();
+
+ // direct logging to the debug console's line buffer
+ LLError::logToFixedBuffer(gDebugView->mDebugConsolep);
+ display_startup();
+
+ // set initial visibility of debug console
+ gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole"));
+ display_startup();
+
+ //
+ // Set message handlers
+ //
+ LL_INFOS("AppInit") << "Initializing communications..." << LL_ENDL;
+
+ // register callbacks for messages. . . do this after initial handshake to make sure that we don't catch any unwanted
+ register_viewer_callbacks(gMessageSystem);
+ display_startup();
+
+ // Debugging info parameters
+ gMessageSystem->setMaxMessageTime( 0.5f ); // Spam if decoding all msgs takes more than 500 ms
+ display_startup();
+
+ #ifndef LL_RELEASE_FOR_DOWNLOAD
+ gMessageSystem->setTimeDecodes( TRUE ); // Time the decode of each msg
+ gMessageSystem->setTimeDecodesSpamThreshold( 0.05f ); // Spam if a single msg takes over 50ms to decode
+ #endif
+ display_startup();
+
+ gXferManager->registerCallbacks(gMessageSystem);
+ display_startup();
+
+ LLStartUp::initNameCache();
+ display_startup();
+
+ // update the voice settings *after* gCacheName initialization
+ // so that we can construct voice UI that relies on the name cache
+ if (LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->updateSettings();
+ }
+ display_startup();
+
+ // create a container's instance for start a controlling conversation windows
+ // by the voice's events
+ LLFloaterIMContainer::getInstance();
+ if (gSavedSettings.getS32("ParcelMediaAutoPlayEnable") == 2)
+ {
+ LLViewerParcelAskPlay::getInstance()->loadSettings();
+ }
+
+ gAgent.addRegionChangedCallback(boost::bind(&LLPerfStats::StatsRecorder::clearStats));
+
+ // *Note: this is where gWorldMap used to be initialized.
+
+ // register null callbacks for audio until the audio system is initialized
+ gMessageSystem->setHandlerFuncFast(_PREHASH_SoundTrigger, null_message_callback, NULL);
+ gMessageSystem->setHandlerFuncFast(_PREHASH_AttachedSound, null_message_callback, NULL);
+ display_startup();
+
+ //reset statistics
+ LLViewerStats::instance().resetStats();
+
+ display_startup();
+ //
+ // Set up region and surface defaults
+ //
+
+
+ // Sets up the parameters for the first simulator
+
+ LL_DEBUGS("AppInit") << "Initializing camera..." << LL_ENDL;
+ gFrameTime = totalTime();
+ F32Seconds last_time = gFrameTimeSeconds;
+ gFrameTimeSeconds = (gFrameTime - gStartTime);
+
+ gFrameIntervalSeconds = gFrameTimeSeconds - last_time;
+ if (gFrameIntervalSeconds < 0.f)
+ {
+ gFrameIntervalSeconds = 0.f;
+ }
+
+ // Make sure agent knows correct aspect ratio
+ // FOV limits depend upon aspect ratio so this needs to happen before initializing the FOV below
+ LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWorldViewHeightRaw());
+ LLViewerCamera::getInstance()->setAspect(gViewerWindow->getWorldViewAspectRatio());
+ // Initialize FOV
+ LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle"));
+ display_startup();
+
+ // Move agent to starting location. The position handed to us by
+ // the space server is in global coordinates, but the agent frame
+ // is in region local coordinates. Therefore, we need to adjust
+ // the coordinates handed to us to fit in the local region.
+
+ gAgent.setPositionAgent(agent_start_position_region);
+ gAgent.resetAxes(gAgentStartLookAt);
+ gAgentCamera.stopCameraAnimation();
+ gAgentCamera.resetCamera();
+ display_startup();
+
+ // Initialize global class data needed for surfaces (i.e. textures)
+ LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL;
+ // Initialize all of the viewer object classes for the first time (doing things like texture fetches.
+ LLGLState::checkStates();
+
+ gSky.init();
+
+ LLGLState::checkStates();
+
+ display_startup();
+
+ LL_DEBUGS("AppInit") << "Decoding images..." << LL_ENDL;
+ // For all images pre-loaded into viewer cache, init
// priorities and fetching using decodeAllImages.
// Most of the fetching and decoding likely to be done
// by update_texture_fetch() later, while viewer waits.
//
- // Need to do this AFTER we init the sky
- const S32 DECODE_TIME_SEC = 2;
- for (int i = 0; i < DECODE_TIME_SEC; i++)
- {
- F32 frac = (F32)i / (F32)DECODE_TIME_SEC;
- set_startup_status(0.45f + frac*0.1f, LLTrans::getString("LoginDecodingImages"), gAgent.mMOTD);
- display_startup();
- gTextureList.decodeAllImages(1.f);
- }
- LLStartUp::setStartupState( STATE_WORLD_WAIT );
-
- display_startup();
-
- // JC - Do this as late as possible to increase likelihood Purify
- // will run.
- LLMessageSystem* msg = gMessageSystem;
- if (!msg->mOurCircuitCode)
- {
- LL_WARNS("AppInit") << "Attempting to connect to simulator with a zero circuit code!" << LL_ENDL;
- }
-
- gUseCircuitCallbackCalled = false;
-
- msg->enableCircuit(gFirstSim, TRUE);
- // now, use the circuit info to tell simulator about us!
- LL_INFOS("AppInit") << "viewer: UserLoginLocationReply() Enabling " << gFirstSim << " with code " << msg->mOurCircuitCode << LL_ENDL;
- msg->newMessageFast(_PREHASH_UseCircuitCode);
- msg->nextBlockFast(_PREHASH_CircuitCode);
- msg->addU32Fast(_PREHASH_Code, msg->mOurCircuitCode);
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_ID, gAgent.getID());
- msg->sendReliable(
- gFirstSim,
- gSavedSettings.getS32("UseCircuitCodeMaxRetries"),
- FALSE,
- (F32Seconds)gSavedSettings.getF32("UseCircuitCodeTimeout"),
- use_circuit_callback,
- NULL);
-
- timeout.reset();
- display_startup();
-
- return FALSE;
- }
-
- //---------------------------------------------------------------------
- // World Wait
- //---------------------------------------------------------------------
- if(STATE_WORLD_WAIT == LLStartUp::getStartupState())
- {
- LL_DEBUGS("AppInit") << "Waiting for simulator ack...." << LL_ENDL;
- set_startup_status(0.59f, LLTrans::getString("LoginWaitingForRegionHandshake"), gAgent.mMOTD);
- if(gGotUseCircuitCodeAck)
- {
- LLStartUp::setStartupState( STATE_AGENT_SEND );
- }
- pump_idle_startup_network();
- return FALSE;
- }
-
- //---------------------------------------------------------------------
- // Agent Send
- //---------------------------------------------------------------------
- if (STATE_AGENT_SEND == LLStartUp::getStartupState())
- {
- LL_DEBUGS("AppInit") << "Connecting to region..." << LL_ENDL;
- set_startup_status(0.60f, LLTrans::getString("LoginConnectingToRegion"), gAgent.mMOTD);
- display_startup();
- // register with the message system so it knows we're
- // expecting this message
- LLMessageSystem* msg = gMessageSystem;
- msg->setHandlerFuncFast(
- _PREHASH_AgentMovementComplete,
- process_agent_movement_complete);
- LLViewerRegion* regionp = gAgent.getRegion();
- if(regionp)
- {
- send_complete_agent_movement(regionp->getHost());
- gAssetStorage->setUpstream(regionp->getHost());
- gCacheName->setUpstream(regionp->getHost());
- }
- display_startup();
-
- // Create login effect
- // But not on first login, because you can't see your avatar then
- if (!gAgent.isFirstLogin())
- {
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
- effectp->setPositionGlobal(gAgent.getPositionGlobal());
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- LLHUDManager::getInstance()->sendEffects();
- }
-
- LLStartUp::setStartupState( STATE_AGENT_WAIT ); // Go to STATE_AGENT_WAIT
-
- timeout.reset();
- display_startup();
- return FALSE;
- }
-
- //---------------------------------------------------------------------
- // Agent Wait
- //---------------------------------------------------------------------
- if (STATE_AGENT_WAIT == LLStartUp::getStartupState())
- {
- {
- LockMessageChecker lmc(gMessageSystem);
- while (lmc.checkAllMessages(gFrameCount, gServicePump))
- {
- if (gAgentMovementCompleted)
- {
- // Sometimes we have more than one message in the
- // queue. break out of this loop and continue
- // processing. If we don't, then this could skip one
- // or more login steps.
- break;
- }
- else
- {
- LL_DEBUGS("AppInit") << "Awaiting AvatarInitComplete, got "
- << gMessageSystem->getMessageName() << LL_ENDL;
- }
- display_startup();
- }
- lmc.processAcks();
- }
-
- display_startup();
-
- if (gAgentMovementCompleted)
- {
- LLStartUp::setStartupState( STATE_INVENTORY_SEND );
- }
- display_startup();
-
- if (!gAgentMovementCompleted && timeout.getElapsedTimeF32() > STATE_AGENT_WAIT_TIMEOUT)
- {
- LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL;
- if (gRememberPassword)
- {
- LLNotificationsUtil::add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status);
- }
- else
- {
- LLNotificationsUtil::add("LoginPacketNeverReceivedNoTP", LLSD(), LLSD(), login_alert_status);
- }
- reset_login();
- }
- return FALSE;
- }
-
- //---------------------------------------------------------------------
- // Inventory Send
- //---------------------------------------------------------------------
- if (STATE_INVENTORY_SEND == LLStartUp::getStartupState())
- {
- LL_PROFILE_ZONE_NAMED("State inventory send")
- display_startup();
+ // Need to do this AFTER we init the sky
+ const S32 DECODE_TIME_SEC = 2;
+ for (int i = 0; i < DECODE_TIME_SEC; i++)
+ {
+ F32 frac = (F32)i / (F32)DECODE_TIME_SEC;
+ set_startup_status(0.45f + frac*0.1f, LLTrans::getString("LoginDecodingImages"), gAgent.mMOTD);
+ display_startup();
+ gTextureList.decodeAllImages(1.f);
+ }
+ LLStartUp::setStartupState( STATE_WORLD_WAIT );
+
+ display_startup();
+
+ // JC - Do this as late as possible to increase likelihood Purify
+ // will run.
+ LLMessageSystem* msg = gMessageSystem;
+ if (!msg->mOurCircuitCode)
+ {
+ LL_WARNS("AppInit") << "Attempting to connect to simulator with a zero circuit code!" << LL_ENDL;
+ }
+
+ gUseCircuitCallbackCalled = false;
+
+ msg->enableCircuit(gFirstSim, TRUE);
+ // now, use the circuit info to tell simulator about us!
+ LL_INFOS("AppInit") << "viewer: UserLoginLocationReply() Enabling " << gFirstSim << " with code " << msg->mOurCircuitCode << LL_ENDL;
+ msg->newMessageFast(_PREHASH_UseCircuitCode);
+ msg->nextBlockFast(_PREHASH_CircuitCode);
+ msg->addU32Fast(_PREHASH_Code, msg->mOurCircuitCode);
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_ID, gAgent.getID());
+ msg->sendReliable(
+ gFirstSim,
+ gSavedSettings.getS32("UseCircuitCodeMaxRetries"),
+ FALSE,
+ (F32Seconds)gSavedSettings.getF32("UseCircuitCodeTimeout"),
+ use_circuit_callback,
+ NULL);
+
+ timeout.reset();
+ display_startup();
+
+ return FALSE;
+ }
+
+ //---------------------------------------------------------------------
+ // World Wait
+ //---------------------------------------------------------------------
+ if(STATE_WORLD_WAIT == LLStartUp::getStartupState())
+ {
+ LL_DEBUGS("AppInit") << "Waiting for simulator ack...." << LL_ENDL;
+ set_startup_status(0.59f, LLTrans::getString("LoginWaitingForRegionHandshake"), gAgent.mMOTD);
+ if(gGotUseCircuitCodeAck)
+ {
+ LLStartUp::setStartupState( STATE_AGENT_SEND );
+ }
+ pump_idle_startup_network();
+ return FALSE;
+ }
+
+ //---------------------------------------------------------------------
+ // Agent Send
+ //---------------------------------------------------------------------
+ if (STATE_AGENT_SEND == LLStartUp::getStartupState())
+ {
+ LL_DEBUGS("AppInit") << "Connecting to region..." << LL_ENDL;
+ set_startup_status(0.60f, LLTrans::getString("LoginConnectingToRegion"), gAgent.mMOTD);
+ display_startup();
+ // register with the message system so it knows we're
+ // expecting this message
+ LLMessageSystem* msg = gMessageSystem;
+ msg->setHandlerFuncFast(
+ _PREHASH_AgentMovementComplete,
+ process_agent_movement_complete);
+ LLViewerRegion* regionp = gAgent.getRegion();
+ if(regionp)
+ {
+ send_complete_agent_movement(regionp->getHost());
+ gAssetStorage->setUpstream(regionp->getHost());
+ gCacheName->setUpstream(regionp->getHost());
+ }
+ display_startup();
+
+ // Create login effect
+ // But not on first login, because you can't see your avatar then
+ if (!gAgent.isFirstLogin())
+ {
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
+ effectp->setPositionGlobal(gAgent.getPositionGlobal());
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ LLHUDManager::getInstance()->sendEffects();
+ }
+
+ LLStartUp::setStartupState( STATE_AGENT_WAIT ); // Go to STATE_AGENT_WAIT
+
+ timeout.reset();
+ display_startup();
+ return FALSE;
+ }
+
+ //---------------------------------------------------------------------
+ // Agent Wait
+ //---------------------------------------------------------------------
+ if (STATE_AGENT_WAIT == LLStartUp::getStartupState())
+ {
+ {
+ LockMessageChecker lmc(gMessageSystem);
+ while (lmc.checkAllMessages(gFrameCount, gServicePump))
+ {
+ if (gAgentMovementCompleted)
+ {
+ // Sometimes we have more than one message in the
+ // queue. break out of this loop and continue
+ // processing. If we don't, then this could skip one
+ // or more login steps.
+ break;
+ }
+ else
+ {
+ LL_DEBUGS("AppInit") << "Awaiting AvatarInitComplete, got "
+ << gMessageSystem->getMessageName() << LL_ENDL;
+ }
+ display_startup();
+ }
+ lmc.processAcks();
+ }
+
+ display_startup();
+
+ if (gAgentMovementCompleted)
+ {
+ LLStartUp::setStartupState( STATE_INVENTORY_SEND );
+ }
+ display_startup();
+
+ if (!gAgentMovementCompleted && timeout.getElapsedTimeF32() > STATE_AGENT_WAIT_TIMEOUT)
+ {
+ LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL;
+ if (gRememberPassword)
+ {
+ LLNotificationsUtil::add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status);
+ }
+ else
+ {
+ LLNotificationsUtil::add("LoginPacketNeverReceivedNoTP", LLSD(), LLSD(), login_alert_status);
+ }
+ reset_login();
+ }
+ return FALSE;
+ }
+
+ //---------------------------------------------------------------------
+ // Inventory Send
+ //---------------------------------------------------------------------
+ if (STATE_INVENTORY_SEND == LLStartUp::getStartupState())
+ {
+ LL_PROFILE_ZONE_NAMED("State inventory send")
+ display_startup();
// request mute list
LL_INFOS() << "Requesting Mute List" << LL_ENDL;
@@ -1766,47 +1766,47 @@ bool idle_startup()
display_startup();
- // Inform simulator of our language preference
- LLAgentLanguage::update();
-
- display_startup();
- // unpack thin inventory
- LLSD response = LLLoginInstance::getInstance()->getResponse();
- //bool dump_buffer = false;
-
- LLSD inv_lib_root = response["inventory-lib-root"];
- if(inv_lib_root.isDefined())
- {
- // should only be one
- LLSD id = inv_lib_root[0]["folder_id"];
- if(id.isDefined())
- {
- gInventory.setLibraryRootFolderID(id.asUUID());
- }
- }
- display_startup();
-
- LLSD inv_lib_owner = response["inventory-lib-owner"];
- if(inv_lib_owner.isDefined())
- {
- // should only be one
- LLSD id = inv_lib_owner[0]["agent_id"];
- if(id.isDefined())
- {
- gInventory.setLibraryOwnerID(LLUUID(id.asUUID()));
- }
- }
- display_startup();
- LLStartUp::setStartupState(STATE_INVENTORY_SKEL);
- display_startup();
- return FALSE;
- }
+ // Inform simulator of our language preference
+ LLAgentLanguage::update();
+
+ display_startup();
+ // unpack thin inventory
+ LLSD response = LLLoginInstance::getInstance()->getResponse();
+ //bool dump_buffer = false;
+
+ LLSD inv_lib_root = response["inventory-lib-root"];
+ if(inv_lib_root.isDefined())
+ {
+ // should only be one
+ LLSD id = inv_lib_root[0]["folder_id"];
+ if(id.isDefined())
+ {
+ gInventory.setLibraryRootFolderID(id.asUUID());
+ }
+ }
+ display_startup();
+
+ LLSD inv_lib_owner = response["inventory-lib-owner"];
+ if(inv_lib_owner.isDefined())
+ {
+ // should only be one
+ LLSD id = inv_lib_owner[0]["agent_id"];
+ if(id.isDefined())
+ {
+ gInventory.setLibraryOwnerID(LLUUID(id.asUUID()));
+ }
+ }
+ display_startup();
+ LLStartUp::setStartupState(STATE_INVENTORY_SKEL);
+ display_startup();
+ return FALSE;
+ }
if (STATE_INVENTORY_SKEL == LLStartUp::getStartupState())
{
LL_PROFILE_ZONE_NAMED("State inventory load skeleton")
- LLSD response = LLLoginInstance::getInstance()->getResponse();
+ LLSD response = LLLoginInstance::getInstance()->getResponse();
LLSD inv_skel_lib = response["inventory-skel-lib"];
if (inv_skel_lib.isDefined() && gInventory.getLibraryOwnerID().notNull())
@@ -1838,113 +1838,113 @@ bool idle_startup()
{
LL_PROFILE_ZONE_NAMED("State inventory send2")
- LLSD response = LLLoginInstance::getInstance()->getResponse();
-
- LLSD inv_basic = response["inventory-basic"];
- if(inv_basic.isDefined())
- {
- LL_INFOS() << "Basic inventory root folder id is " << inv_basic["folder_id"] << LL_ENDL;
- }
-
- LLSD buddy_list = response["buddy-list"];
- if(buddy_list.isDefined())
- {
- LLAvatarTracker::buddy_map_t list;
- LLUUID agent_id;
- S32 has_rights = 0, given_rights = 0;
- for(LLSD::array_const_iterator it = buddy_list.beginArray(),
- end = buddy_list.endArray(); it != end; ++it)
- {
- LLSD buddy_id = (*it)["buddy_id"];
- if(buddy_id.isDefined())
- {
- agent_id = buddy_id.asUUID();
- }
-
- LLSD buddy_rights_has = (*it)["buddy_rights_has"];
- if(buddy_rights_has.isDefined())
- {
- has_rights = buddy_rights_has.asInteger();
- }
-
- LLSD buddy_rights_given = (*it)["buddy_rights_given"];
- if(buddy_rights_given.isDefined())
- {
- given_rights = buddy_rights_given.asInteger();
- }
-
- list[agent_id] = new LLRelationship(given_rights, has_rights, false);
- }
- LLAvatarTracker::instance().addBuddyList(list);
- display_startup();
- }
-
- bool show_hud = false;
- LLSD tutorial_setting = response["tutorial_setting"];
- if(tutorial_setting.isDefined())
- {
- for(LLSD::array_const_iterator it = tutorial_setting.beginArray(),
- end = tutorial_setting.endArray(); it != end; ++it)
- {
- LLSD tutorial_url = (*it)["tutorial_url"];
- if(tutorial_url.isDefined())
- {
- // Tutorial floater will append language code
- gSavedSettings.setString("TutorialURL", tutorial_url.asString());
- }
-
- // For Viewer 2.0 we are not using the web-based tutorial
- // If we reverse that decision, put this code back and use
- // login.cgi to send a different URL with content that matches
- // the Viewer 2.0 UI.
- //LLSD use_tutorial = (*it)["use_tutorial"];
- //if(use_tutorial.asString() == "true")
- //{
- // show_hud = true;
- //}
- }
- }
- display_startup();
-
- // Either we want to show tutorial because this is the first login
- // to a Linden Help Island or the user quit with the tutorial
- // visible. JC
- if (show_hud || gSavedSettings.getBOOL("ShowTutorial"))
- {
- LLFloaterReg::showInstance("hud", LLSD(), FALSE);
- }
- display_startup();
-
- LLSD event_notifications = response["event_notifications"];
- if(event_notifications.isDefined())
- {
- gEventNotifier.load(event_notifications);
- }
- display_startup();
-
- LLSD classified_categories = response["classified_categories"];
- if(classified_categories.isDefined())
- {
- LLClassifiedInfo::loadCategories(classified_categories);
- }
- display_startup();
-
- // This method MUST be called before gInventory.findCategoryUUIDForType because of
- // gInventory.mIsAgentInvUsable is set to true in the gInventory.buildParentChildMap.
- gInventory.buildParentChildMap();
-
- // If buildParentChildMap succeeded, inventory will now be in
- // a usable state and gInventory.isInventoryUsable() will be
- // true.
-
- // if inventory is unusable, show warning.
- if (!gInventory.isInventoryUsable())
- {
- LLNotificationsUtil::add("InventoryUnusable");
- }
-
+ LLSD response = LLLoginInstance::getInstance()->getResponse();
+
+ LLSD inv_basic = response["inventory-basic"];
+ if(inv_basic.isDefined())
+ {
+ LL_INFOS() << "Basic inventory root folder id is " << inv_basic["folder_id"] << LL_ENDL;
+ }
+
+ LLSD buddy_list = response["buddy-list"];
+ if(buddy_list.isDefined())
+ {
+ LLAvatarTracker::buddy_map_t list;
+ LLUUID agent_id;
+ S32 has_rights = 0, given_rights = 0;
+ for(LLSD::array_const_iterator it = buddy_list.beginArray(),
+ end = buddy_list.endArray(); it != end; ++it)
+ {
+ LLSD buddy_id = (*it)["buddy_id"];
+ if(buddy_id.isDefined())
+ {
+ agent_id = buddy_id.asUUID();
+ }
+
+ LLSD buddy_rights_has = (*it)["buddy_rights_has"];
+ if(buddy_rights_has.isDefined())
+ {
+ has_rights = buddy_rights_has.asInteger();
+ }
+
+ LLSD buddy_rights_given = (*it)["buddy_rights_given"];
+ if(buddy_rights_given.isDefined())
+ {
+ given_rights = buddy_rights_given.asInteger();
+ }
+
+ list[agent_id] = new LLRelationship(given_rights, has_rights, false);
+ }
+ LLAvatarTracker::instance().addBuddyList(list);
+ display_startup();
+ }
+
+ bool show_hud = false;
+ LLSD tutorial_setting = response["tutorial_setting"];
+ if(tutorial_setting.isDefined())
+ {
+ for(LLSD::array_const_iterator it = tutorial_setting.beginArray(),
+ end = tutorial_setting.endArray(); it != end; ++it)
+ {
+ LLSD tutorial_url = (*it)["tutorial_url"];
+ if(tutorial_url.isDefined())
+ {
+ // Tutorial floater will append language code
+ gSavedSettings.setString("TutorialURL", tutorial_url.asString());
+ }
+
+ // For Viewer 2.0 we are not using the web-based tutorial
+ // If we reverse that decision, put this code back and use
+ // login.cgi to send a different URL with content that matches
+ // the Viewer 2.0 UI.
+ //LLSD use_tutorial = (*it)["use_tutorial"];
+ //if(use_tutorial.asString() == "true")
+ //{
+ // show_hud = true;
+ //}
+ }
+ }
+ display_startup();
+
+ // Either we want to show tutorial because this is the first login
+ // to a Linden Help Island or the user quit with the tutorial
+ // visible. JC
+ if (show_hud || gSavedSettings.getBOOL("ShowTutorial"))
+ {
+ LLFloaterReg::showInstance("hud", LLSD(), FALSE);
+ }
+ display_startup();
+
+ LLSD event_notifications = response["event_notifications"];
+ if(event_notifications.isDefined())
+ {
+ gEventNotifier.load(event_notifications);
+ }
+ display_startup();
+
+ LLSD classified_categories = response["classified_categories"];
+ if(classified_categories.isDefined())
+ {
+ LLClassifiedInfo::loadCategories(classified_categories);
+ }
+ display_startup();
+
+ // This method MUST be called before gInventory.findCategoryUUIDForType because of
+ // gInventory.mIsAgentInvUsable is set to true in the gInventory.buildParentChildMap.
+ gInventory.buildParentChildMap();
+
+ // If buildParentChildMap succeeded, inventory will now be in
+ // a usable state and gInventory.isInventoryUsable() will be
+ // true.
+
+ // if inventory is unusable, show warning.
+ if (!gInventory.isInventoryUsable())
+ {
+ LLNotificationsUtil::add("InventoryUnusable");
+ }
+
LLInventoryModelBackgroundFetch::instance().start();
- gInventory.createCommonSystemCategories();
+ gInventory.createCommonSystemCategories();
LLStartUp::setStartupState(STATE_INVENTORY_CALLBACKS );
display_startup();
@@ -1952,7 +1952,7 @@ bool idle_startup()
}
//---------------------------------------------------------------------
- // STATE_INVENTORY_CALLBACKS
+ // STATE_INVENTORY_CALLBACKS
//---------------------------------------------------------------------
if (STATE_INVENTORY_CALLBACKS == LLStartUp::getStartupState())
{
@@ -1974,86 +1974,86 @@ bool idle_startup()
}
- // It's debatable whether this flag is a good idea - sets all
- // bits, and in general it isn't true that inventory
- // initialization generates all types of changes. Maybe add an
- // INITIALIZE mask bit instead?
- gInventory.addChangedMask(LLInventoryObserver::ALL, LLUUID::null);
- gInventory.notifyObservers();
-
- display_startup();
-
- // set up callbacks
- LL_INFOS() << "Registering Callbacks" << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
- LL_INFOS() << " Inventory" << LL_ENDL;
- LLInventoryModel::registerCallbacks(msg);
- LL_INFOS() << " AvatarTracker" << LL_ENDL;
- LLAvatarTracker::instance().registerCallbacks(msg);
- LL_INFOS() << " Landmark" << LL_ENDL;
- LLLandmark::registerCallbacks(msg);
- display_startup();
-
- // request all group information
- LL_INFOS() << "Requesting Agent Data" << LL_ENDL;
- gAgent.sendAgentDataUpdateRequest();
- display_startup();
- // Create the inventory views
- LL_INFOS() << "Creating Inventory Views" << LL_ENDL;
- LLFloaterReg::getInstance("inventory");
- display_startup();
- LLStartUp::setStartupState( STATE_MISC );
- display_startup();
-
- return FALSE;
- }
-
-
- //---------------------------------------------------------------------
- // Misc
- //---------------------------------------------------------------------
- if (STATE_MISC == LLStartUp::getStartupState())
- {
- // We have a region, and just did a big inventory download.
- // We can estimate the user's connection speed, and set their
- // max bandwidth accordingly. JC
- if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
- {
- // This is actually a pessimistic computation, because TCP may not have enough
- // time to ramp up on the (small) default inventory file to truly measure max
- // bandwidth. JC
- F64 rate_bps = LLLoginInstance::getInstance()->getLastTransferRateBPS();
- const F32 FAST_RATE_BPS = 600.f * 1024.f;
- const F32 FASTER_RATE_BPS = 750.f * 1024.f;
- F32 max_bandwidth = gViewerThrottle.getMaxBandwidth();
- if (rate_bps > FASTER_RATE_BPS
- && rate_bps > max_bandwidth)
- {
- LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to "
- << FASTER_RATE_BPS/1024.f
- << " kbps" << LL_ENDL;
- gViewerThrottle.setMaxBandwidth(FASTER_RATE_BPS / 1024.f);
- }
- else if (rate_bps > FAST_RATE_BPS
- && rate_bps > max_bandwidth)
- {
- LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to "
- << FAST_RATE_BPS/1024.f
- << " kbps" << LL_ENDL;
- gViewerThrottle.setMaxBandwidth(FAST_RATE_BPS / 1024.f);
- }
-
- if (gSavedSettings.getBOOL("ShowHelpOnFirstLogin"))
- {
- gSavedSettings.setBOOL("HelpFloaterOpen", TRUE);
- }
-
- // Set the show start location to true, now that the user has logged
- // on with this install.
- gSavedSettings.setBOOL("ShowStartLocation", TRUE);
- }
-
- display_startup();
+ // It's debatable whether this flag is a good idea - sets all
+ // bits, and in general it isn't true that inventory
+ // initialization generates all types of changes. Maybe add an
+ // INITIALIZE mask bit instead?
+ gInventory.addChangedMask(LLInventoryObserver::ALL, LLUUID::null);
+ gInventory.notifyObservers();
+
+ display_startup();
+
+ // set up callbacks
+ LL_INFOS() << "Registering Callbacks" << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+ LL_INFOS() << " Inventory" << LL_ENDL;
+ LLInventoryModel::registerCallbacks(msg);
+ LL_INFOS() << " AvatarTracker" << LL_ENDL;
+ LLAvatarTracker::instance().registerCallbacks(msg);
+ LL_INFOS() << " Landmark" << LL_ENDL;
+ LLLandmark::registerCallbacks(msg);
+ display_startup();
+
+ // request all group information
+ LL_INFOS() << "Requesting Agent Data" << LL_ENDL;
+ gAgent.sendAgentDataUpdateRequest();
+ display_startup();
+ // Create the inventory views
+ LL_INFOS() << "Creating Inventory Views" << LL_ENDL;
+ LLFloaterReg::getInstance("inventory");
+ display_startup();
+ LLStartUp::setStartupState( STATE_MISC );
+ display_startup();
+
+ return FALSE;
+ }
+
+
+ //---------------------------------------------------------------------
+ // Misc
+ //---------------------------------------------------------------------
+ if (STATE_MISC == LLStartUp::getStartupState())
+ {
+ // We have a region, and just did a big inventory download.
+ // We can estimate the user's connection speed, and set their
+ // max bandwidth accordingly. JC
+ if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
+ {
+ // This is actually a pessimistic computation, because TCP may not have enough
+ // time to ramp up on the (small) default inventory file to truly measure max
+ // bandwidth. JC
+ F64 rate_bps = LLLoginInstance::getInstance()->getLastTransferRateBPS();
+ const F32 FAST_RATE_BPS = 600.f * 1024.f;
+ const F32 FASTER_RATE_BPS = 750.f * 1024.f;
+ F32 max_bandwidth = gViewerThrottle.getMaxBandwidth();
+ if (rate_bps > FASTER_RATE_BPS
+ && rate_bps > max_bandwidth)
+ {
+ LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to "
+ << FASTER_RATE_BPS/1024.f
+ << " kbps" << LL_ENDL;
+ gViewerThrottle.setMaxBandwidth(FASTER_RATE_BPS / 1024.f);
+ }
+ else if (rate_bps > FAST_RATE_BPS
+ && rate_bps > max_bandwidth)
+ {
+ LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to "
+ << FAST_RATE_BPS/1024.f
+ << " kbps" << LL_ENDL;
+ gViewerThrottle.setMaxBandwidth(FAST_RATE_BPS / 1024.f);
+ }
+
+ if (gSavedSettings.getBOOL("ShowHelpOnFirstLogin"))
+ {
+ gSavedSettings.setBOOL("HelpFloaterOpen", TRUE);
+ }
+
+ // Set the show start location to true, now that the user has logged
+ // on with this install.
+ gSavedSettings.setBOOL("ShowStartLocation", TRUE);
+ }
+
+ display_startup();
// Load stored local environment if needed.
LLEnvironment::instance().loadFromSettings();
@@ -2061,368 +2061,368 @@ bool idle_startup()
// *TODO : Uncomment that line once the whole grid migrated to SLM and suppress it from LLAgent::handleTeleportFinished() (llagent.cpp)
//check_merchant_status();
- display_startup();
-
- if (gSavedSettings.getBOOL("HelpFloaterOpen"))
- {
- // show default topic
- LLViewerHelp::instance().showTopic("");
- }
-
- display_startup();
-
- // We're successfully logged in.
- gSavedSettings.setBOOL("FirstLoginThisInstall", FALSE);
-
- LLFloaterReg::showInitialVisibleInstances();
-
- LLFloaterGridStatus::getInstance()->startGridStatusTimer();
-
- display_startup();
-
- display_startup();
- // JC: Initializing audio requests many sounds for download.
- init_audio();
- display_startup();
-
- // JC: Initialize "active" gestures. This may also trigger
- // many gesture downloads, if this is the user's first
- // time on this machine or -purge has been run.
- LLSD gesture_options
- = LLLoginInstance::getInstance()->getResponse("gestures");
- if (gesture_options.isDefined())
- {
- LL_DEBUGS("AppInit") << "Gesture Manager loading " << gesture_options.size()
- << LL_ENDL;
- uuid_vec_t item_ids;
- for(LLSD::array_const_iterator resp_it = gesture_options.beginArray(),
- end = gesture_options.endArray(); resp_it != end; ++resp_it)
- {
- // If the id is not specifed in the LLSD,
- // the LLSD operator[]() will return a null LLUUID.
- LLUUID item_id = (*resp_it)["item_id"];
- LLUUID asset_id = (*resp_it)["asset_id"];
-
- if (item_id.notNull() && asset_id.notNull())
- {
- // Could schedule and delay these for later.
- const BOOL no_inform_server = FALSE;
- const BOOL no_deactivate_similar = FALSE;
- LLGestureMgr::instance().activateGestureWithAsset(item_id, asset_id,
- no_inform_server,
- no_deactivate_similar);
- // We need to fetch the inventory items for these gestures
- // so we have the names to populate the UI.
- item_ids.push_back(item_id);
- }
- }
- // no need to add gesture to inventory observer, it's already made in constructor
- LLGestureMgr::instance().setFetchIDs(item_ids);
- LLGestureMgr::instance().startFetch();
- }
- gDisplaySwapBuffers = TRUE;
- display_startup();
-
- LLMessageSystem* msg = gMessageSystem;
- msg->setHandlerFuncFast(_PREHASH_SoundTrigger, process_sound_trigger);
- msg->setHandlerFuncFast(_PREHASH_PreloadSound, process_preload_sound);
- msg->setHandlerFuncFast(_PREHASH_AttachedSound, process_attached_sound);
- msg->setHandlerFuncFast(_PREHASH_AttachedSoundGainChange, process_attached_sound_gain_change);
-
- LL_DEBUGS("AppInit") << "Initialization complete" << LL_ENDL;
-
- LL_DEBUGS("SceneLoadTiming", "Start") << "Scene Load Started " << LL_ENDL;
- gRenderStartTime.reset();
- gForegroundTime.reset();
-
- // HACK: Inform simulator of window size.
- // Do this here so it's less likely to race with RegisterNewAgent.
- // TODO: Put this into RegisterNewAgent
- // JC - 7/20/2002
- gViewerWindow->sendShapeToSim();
-
- LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA);
-
- // The reason we show the alert is because we want to
- // reduce confusion for when you log in and your provided
- // location is not your expected location. So, if this is
- // your first login, then you do not have an expectation,
- // thus, do not show this alert.
- if (!gAgent.isFirstLogin())
- {
- LL_INFOS() << "gAgentStartLocation : " << gAgentStartLocation << LL_ENDL;
- LLSLURL start_slurl = LLStartUp::getStartSLURL();
- LL_DEBUGS("AppInit") << "start slurl "<<start_slurl.asString()<<LL_ENDL;
-
- if (((start_slurl.getType() == LLSLURL::LOCATION) && (gAgentStartLocation == "url")) ||
- ((start_slurl.getType() == LLSLURL::LAST_LOCATION) && (gAgentStartLocation == "last")) ||
- ((start_slurl.getType() == LLSLURL::HOME_LOCATION) && (gAgentStartLocation == "home")))
- {
- if (start_slurl.getType() == LLSLURL::LAST_LOCATION
- && gAgentStartLocation == "last"
- && gSavedSettings.getBOOL("RestoreCameraPosOnLogin"))
- {
- // restore old camera pos
- gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
- gAgentCamera.setCameraPosAndFocusGlobal(gSavedSettings.getVector3d("CameraPosOnLogout"), gSavedSettings.getVector3d("FocusPosOnLogout"), LLUUID::null);
- BOOL limit_hit = FALSE;
- gAgentCamera.calcCameraPositionTargetGlobal(&limit_hit);
- if (limit_hit)
- {
- gAgentCamera.setFocusOnAvatar(TRUE, FALSE);
- }
- gAgentCamera.stopCameraAnimation();
- }
- }
- else
- {
- std::string msg;
- switch(start_slurl.getType())
- {
- case LLSLURL::LOCATION:
- {
-
- msg = "AvatarMovedDesired";
- break;
- }
- case LLSLURL::HOME_LOCATION:
- {
- msg = "AvatarMovedHome";
- break;
- }
- default:
- {
- msg = "AvatarMovedLast";
- }
- }
- LLNotificationsUtil::add(msg);
- }
- }
-
- display_startup();
+ display_startup();
+
+ if (gSavedSettings.getBOOL("HelpFloaterOpen"))
+ {
+ // show default topic
+ LLViewerHelp::instance().showTopic("");
+ }
+
+ display_startup();
+
+ // We're successfully logged in.
+ gSavedSettings.setBOOL("FirstLoginThisInstall", FALSE);
+
+ LLFloaterReg::showInitialVisibleInstances();
+
+ LLFloaterGridStatus::getInstance()->startGridStatusTimer();
+
+ display_startup();
+
+ display_startup();
+ // JC: Initializing audio requests many sounds for download.
+ init_audio();
+ display_startup();
+
+ // JC: Initialize "active" gestures. This may also trigger
+ // many gesture downloads, if this is the user's first
+ // time on this machine or -purge has been run.
+ LLSD gesture_options
+ = LLLoginInstance::getInstance()->getResponse("gestures");
+ if (gesture_options.isDefined())
+ {
+ LL_DEBUGS("AppInit") << "Gesture Manager loading " << gesture_options.size()
+ << LL_ENDL;
+ uuid_vec_t item_ids;
+ for(LLSD::array_const_iterator resp_it = gesture_options.beginArray(),
+ end = gesture_options.endArray(); resp_it != end; ++resp_it)
+ {
+ // If the id is not specifed in the LLSD,
+ // the LLSD operator[]() will return a null LLUUID.
+ LLUUID item_id = (*resp_it)["item_id"];
+ LLUUID asset_id = (*resp_it)["asset_id"];
+
+ if (item_id.notNull() && asset_id.notNull())
+ {
+ // Could schedule and delay these for later.
+ const BOOL no_inform_server = FALSE;
+ const BOOL no_deactivate_similar = FALSE;
+ LLGestureMgr::instance().activateGestureWithAsset(item_id, asset_id,
+ no_inform_server,
+ no_deactivate_similar);
+ // We need to fetch the inventory items for these gestures
+ // so we have the names to populate the UI.
+ item_ids.push_back(item_id);
+ }
+ }
+ // no need to add gesture to inventory observer, it's already made in constructor
+ LLGestureMgr::instance().setFetchIDs(item_ids);
+ LLGestureMgr::instance().startFetch();
+ }
+ gDisplaySwapBuffers = TRUE;
+ display_startup();
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->setHandlerFuncFast(_PREHASH_SoundTrigger, process_sound_trigger);
+ msg->setHandlerFuncFast(_PREHASH_PreloadSound, process_preload_sound);
+ msg->setHandlerFuncFast(_PREHASH_AttachedSound, process_attached_sound);
+ msg->setHandlerFuncFast(_PREHASH_AttachedSoundGainChange, process_attached_sound_gain_change);
+
+ LL_DEBUGS("AppInit") << "Initialization complete" << LL_ENDL;
+
+ LL_DEBUGS("SceneLoadTiming", "Start") << "Scene Load Started " << LL_ENDL;
+ gRenderStartTime.reset();
+ gForegroundTime.reset();
+
+ // HACK: Inform simulator of window size.
+ // Do this here so it's less likely to race with RegisterNewAgent.
+ // TODO: Put this into RegisterNewAgent
+ // JC - 7/20/2002
+ gViewerWindow->sendShapeToSim();
+
+ LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA);
+
+ // The reason we show the alert is because we want to
+ // reduce confusion for when you log in and your provided
+ // location is not your expected location. So, if this is
+ // your first login, then you do not have an expectation,
+ // thus, do not show this alert.
+ if (!gAgent.isFirstLogin())
+ {
+ LL_INFOS() << "gAgentStartLocation : " << gAgentStartLocation << LL_ENDL;
+ LLSLURL start_slurl = LLStartUp::getStartSLURL();
+ LL_DEBUGS("AppInit") << "start slurl "<<start_slurl.asString()<<LL_ENDL;
+
+ if (((start_slurl.getType() == LLSLURL::LOCATION) && (gAgentStartLocation == "url")) ||
+ ((start_slurl.getType() == LLSLURL::LAST_LOCATION) && (gAgentStartLocation == "last")) ||
+ ((start_slurl.getType() == LLSLURL::HOME_LOCATION) && (gAgentStartLocation == "home")))
+ {
+ if (start_slurl.getType() == LLSLURL::LAST_LOCATION
+ && gAgentStartLocation == "last"
+ && gSavedSettings.getBOOL("RestoreCameraPosOnLogin"))
+ {
+ // restore old camera pos
+ gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
+ gAgentCamera.setCameraPosAndFocusGlobal(gSavedSettings.getVector3d("CameraPosOnLogout"), gSavedSettings.getVector3d("FocusPosOnLogout"), LLUUID::null);
+ BOOL limit_hit = FALSE;
+ gAgentCamera.calcCameraPositionTargetGlobal(&limit_hit);
+ if (limit_hit)
+ {
+ gAgentCamera.setFocusOnAvatar(TRUE, FALSE);
+ }
+ gAgentCamera.stopCameraAnimation();
+ }
+ }
+ else
+ {
+ std::string msg;
+ switch(start_slurl.getType())
+ {
+ case LLSLURL::LOCATION:
+ {
+
+ msg = "AvatarMovedDesired";
+ break;
+ }
+ case LLSLURL::HOME_LOCATION:
+ {
+ msg = "AvatarMovedHome";
+ break;
+ }
+ default:
+ {
+ msg = "AvatarMovedLast";
+ }
+ }
+ LLNotificationsUtil::add(msg);
+ }
+ }
+
+ display_startup();
//DEV-17797. get null folder. Any items found here moved to Lost and Found
LLInventoryModelBackgroundFetch::instance().findLostItems();
- display_startup();
-
- LLStartUp::setStartupState( STATE_PRECACHE );
- timeout.reset();
- return FALSE;
- }
-
- if (STATE_PRECACHE == LLStartUp::getStartupState())
- {
- display_startup();
- F32 timeout_frac = timeout.getElapsedTimeF32()/PRECACHING_DELAY;
-
- // We now have an inventory skeleton, so if this is a user's first
- // login, we can start setting up their clothing and avatar
- // appearance. This helps to avoid the generic "Ruth" avatar in
- // the orientation island tutorial experience. JC
- if (gAgent.isFirstLogin()
- && !sInitialOutfit.empty() // registration set up an outfit
- && !sInitialOutfitGender.empty() // and a gender
- && isAgentAvatarValid() // can't wear clothes without object
- && !gAgent.isOutfitChosen()) // nothing already loading
- {
- // Start loading the wearables, textures, gestures
- LLStartUp::loadInitialOutfit( sInitialOutfit, sInitialOutfitGender );
- }
- // If not first login, we need to fetch COF contents and
- // compute appearance from that.
- if (isAgentAvatarValid() && !gAgent.isFirstLogin() && !gAgent.isOutfitChosen())
- {
- gAgentWearables.notifyLoadingStarted();
- gAgent.setOutfitChosen(TRUE);
- gAgentWearables.sendDummyAgentWearablesUpdate();
+ display_startup();
+
+ LLStartUp::setStartupState( STATE_PRECACHE );
+ timeout.reset();
+ return FALSE;
+ }
+
+ if (STATE_PRECACHE == LLStartUp::getStartupState())
+ {
+ display_startup();
+ F32 timeout_frac = timeout.getElapsedTimeF32()/PRECACHING_DELAY;
+
+ // We now have an inventory skeleton, so if this is a user's first
+ // login, we can start setting up their clothing and avatar
+ // appearance. This helps to avoid the generic "Ruth" avatar in
+ // the orientation island tutorial experience. JC
+ if (gAgent.isFirstLogin()
+ && !sInitialOutfit.empty() // registration set up an outfit
+ && !sInitialOutfitGender.empty() // and a gender
+ && isAgentAvatarValid() // can't wear clothes without object
+ && !gAgent.isOutfitChosen()) // nothing already loading
+ {
+ // Start loading the wearables, textures, gestures
+ LLStartUp::loadInitialOutfit( sInitialOutfit, sInitialOutfitGender );
+ }
+ // If not first login, we need to fetch COF contents and
+ // compute appearance from that.
+ if (isAgentAvatarValid() && !gAgent.isFirstLogin() && !gAgent.isOutfitChosen())
+ {
+ gAgentWearables.notifyLoadingStarted();
+ gAgent.setOutfitChosen(TRUE);
+ gAgentWearables.sendDummyAgentWearablesUpdate();
callAfterCOFFetch(set_flags_and_update_appearance);
- }
-
- display_startup();
-
- // wait precache-delay and for agent's avatar or a lot longer.
- if ((timeout_frac > 1.f) && isAgentAvatarValid())
- {
- LLStartUp::setStartupState( STATE_WEARABLES_WAIT );
- }
- else if (timeout_frac > 10.f)
- {
- // If we exceed the wait above while isAgentAvatarValid is
- // not true yet, we will change startup state and
- // eventually (once avatar does get created) wind up at
- // the gender chooser. This should occur only in very
- // unusual circumstances, so set the timeout fairly high
- // to minimize mistaken hits here.
- LL_WARNS() << "Wait for valid avatar state exceeded "
- << timeout.getElapsedTimeF32() << " will invoke gender chooser" << LL_ENDL;
- LLStartUp::setStartupState( STATE_WEARABLES_WAIT );
- }
- else
- {
- update_texture_fetch();
- set_startup_status(0.60f + 0.30f * timeout_frac,
- LLTrans::getString("LoginPrecaching"),
- gAgent.mMOTD.c_str());
- display_startup();
- }
-
- return TRUE;
- }
-
- if (STATE_WEARABLES_WAIT == LLStartUp::getStartupState())
- {
- static LLFrameTimer wearables_timer;
-
- const F32 wearables_time = wearables_timer.getElapsedTimeF32();
- static LLCachedControl<F32> max_wearables_time(gSavedSettings, "ClothingLoadingDelay");
-
- if (!gAgent.isOutfitChosen() && isAgentAvatarValid())
- {
- // No point in waiting for clothing, we don't even know
- // what outfit we want. Pop up a gender chooser dialog to
- // ask and proceed to draw the world. JC
- //
- // *NOTE: We might hit this case even if we have an
- // initial outfit, but if the load hasn't started
- // already then something is wrong so fall back
- // to generic outfits. JC
- LLNotificationsUtil::add("WelcomeChooseSex", LLSD(), LLSD(),
- callback_choose_gender);
- LLStartUp::setStartupState( STATE_CLEANUP );
- }
-
- display_startup();
-
- if (gAgent.isOutfitChosen() && (wearables_time > max_wearables_time))
- {
- if (gInventory.isInventoryUsable())
- {
- LLNotificationsUtil::add("ClothingLoading");
- }
- record(LLStatViewer::LOADING_WEARABLES_LONG_DELAY, wearables_time);
- LLStartUp::setStartupState( STATE_CLEANUP );
- }
- else if (gAgent.isFirstLogin()
- && isAgentAvatarValid()
- && gAgentAvatarp->isFullyLoaded())
- {
- // wait for avatar to be completely loaded
- if (isAgentAvatarValid()
- && gAgentAvatarp->isFullyLoaded())
- {
- LL_DEBUGS("Avatar") << "avatar fully loaded" << LL_ENDL;
- LLStartUp::setStartupState( STATE_CLEANUP );
- return TRUE;
- }
- }
- else
- {
- // OK to just get the wearables
- if ( gAgentWearables.areWearablesLoaded() )
- {
- // We have our clothing, proceed.
- LL_DEBUGS("Avatar") << "wearables loaded" << LL_ENDL;
- LLStartUp::setStartupState( STATE_CLEANUP );
- return TRUE;
- }
- }
- //fall through this frame to STATE_CLEANUP
- }
-
- if (STATE_CLEANUP == LLStartUp::getStartupState())
- {
- set_startup_status(1.0, "", "");
- display_startup();
-
- if (!mBenefitsSuccessfullyInit)
- {
- LLNotificationsUtil::add("FailedToGetBenefits", LLSD(), LLSD(), boost::bind(on_benefits_failed_callback, _1, _2));
- }
-
- // Let the map know about the inventory.
- LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
- if(floater_world_map)
- {
- floater_world_map->observeInventory(&gInventory);
- floater_world_map->observeFriends();
- }
- gViewerWindow->showCursor();
- gViewerWindow->getWindow()->resetBusyCount();
- gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
- LL_DEBUGS("AppInit") << "Done releasing bitmap" << LL_ENDL;
- //gViewerWindow->revealIntroPanel();
- gViewerWindow->setStartupComplete();
- gViewerWindow->setProgressCancelButtonVisible(FALSE);
- display_startup();
-
- // We're not away from keyboard, even though login might have taken
- // a while. JC
- gAgent.clearAFK();
-
- // Have the agent start watching the friends list so we can update proxies
- gAgent.observeFriends();
-
- // Start automatic replay if the flag is set.
- if (gSavedSettings.getBOOL("StatsAutoRun") || gAgentPilot.getReplaySession())
- {
- LL_DEBUGS("AppInit") << "Starting automatic playback" << LL_ENDL;
- gAgentPilot.startPlayback();
- }
-
- show_debug_menus(); // Debug menu visiblity and First Use trigger
-
- // If we've got a startup URL, dispatch it
- //LLStartUp::dispatchURL();
-
- // Retrieve information about the land data
- // (just accessing this the first time will fetch it,
- // then the data is cached for the viewer's lifetime)
- LLProductInfoRequestManager::instance();
-
- // *FIX:Mani - What do I do here?
- // Need we really clear the Auth response data?
- // Clean up the userauth stuff.
- // LLUserAuth::getInstance()->reset();
-
- LLStartUp::setStartupState( STATE_STARTED );
- display_startup();
-
- // Unmute audio if desired and setup volumes.
- // This is a not-uncommon crash site, so surround it with
- // LL_INFOS() output to aid diagnosis.
- LL_INFOS("AppInit") << "Doing first audio_update_volume..." << LL_ENDL;
- audio_update_volume();
- LL_INFOS("AppInit") << "Done first audio_update_volume." << LL_ENDL;
-
- // reset keyboard focus to sane state of pointing at world
- gFocusMgr.setKeyboardFocus(NULL);
-
- LLAppViewer::instance()->handleLoginComplete();
-
- LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
-
- display_startup();
-
- llassert(LLPathfindingManager::getInstance() != NULL);
- LLPathfindingManager::getInstance()->initSystem();
-
- gAgentAvatarp->sendHoverHeight();
-
- // look for parcels we own
- send_places_query(LLUUID::null,
- LLUUID::null,
- "",
- DFQ_AGENT_OWNED,
- LLParcel::C_ANY,
- "");
-
- LLUIUsage::instance().clear();
+ }
+
+ display_startup();
+
+ // wait precache-delay and for agent's avatar or a lot longer.
+ if ((timeout_frac > 1.f) && isAgentAvatarValid())
+ {
+ LLStartUp::setStartupState( STATE_WEARABLES_WAIT );
+ }
+ else if (timeout_frac > 10.f)
+ {
+ // If we exceed the wait above while isAgentAvatarValid is
+ // not true yet, we will change startup state and
+ // eventually (once avatar does get created) wind up at
+ // the gender chooser. This should occur only in very
+ // unusual circumstances, so set the timeout fairly high
+ // to minimize mistaken hits here.
+ LL_WARNS() << "Wait for valid avatar state exceeded "
+ << timeout.getElapsedTimeF32() << " will invoke gender chooser" << LL_ENDL;
+ LLStartUp::setStartupState( STATE_WEARABLES_WAIT );
+ }
+ else
+ {
+ update_texture_fetch();
+ set_startup_status(0.60f + 0.30f * timeout_frac,
+ LLTrans::getString("LoginPrecaching"),
+ gAgent.mMOTD.c_str());
+ display_startup();
+ }
+
+ return TRUE;
+ }
+
+ if (STATE_WEARABLES_WAIT == LLStartUp::getStartupState())
+ {
+ static LLFrameTimer wearables_timer;
+
+ const F32 wearables_time = wearables_timer.getElapsedTimeF32();
+ static LLCachedControl<F32> max_wearables_time(gSavedSettings, "ClothingLoadingDelay");
+
+ if (!gAgent.isOutfitChosen() && isAgentAvatarValid())
+ {
+ // No point in waiting for clothing, we don't even know
+ // what outfit we want. Pop up a gender chooser dialog to
+ // ask and proceed to draw the world. JC
+ //
+ // *NOTE: We might hit this case even if we have an
+ // initial outfit, but if the load hasn't started
+ // already then something is wrong so fall back
+ // to generic outfits. JC
+ LLNotificationsUtil::add("WelcomeChooseSex", LLSD(), LLSD(),
+ callback_choose_gender);
+ LLStartUp::setStartupState( STATE_CLEANUP );
+ }
+
+ display_startup();
+
+ if (gAgent.isOutfitChosen() && (wearables_time > max_wearables_time))
+ {
+ if (gInventory.isInventoryUsable())
+ {
+ LLNotificationsUtil::add("ClothingLoading");
+ }
+ record(LLStatViewer::LOADING_WEARABLES_LONG_DELAY, wearables_time);
+ LLStartUp::setStartupState( STATE_CLEANUP );
+ }
+ else if (gAgent.isFirstLogin()
+ && isAgentAvatarValid()
+ && gAgentAvatarp->isFullyLoaded())
+ {
+ // wait for avatar to be completely loaded
+ if (isAgentAvatarValid()
+ && gAgentAvatarp->isFullyLoaded())
+ {
+ LL_DEBUGS("Avatar") << "avatar fully loaded" << LL_ENDL;
+ LLStartUp::setStartupState( STATE_CLEANUP );
+ return TRUE;
+ }
+ }
+ else
+ {
+ // OK to just get the wearables
+ if ( gAgentWearables.areWearablesLoaded() )
+ {
+ // We have our clothing, proceed.
+ LL_DEBUGS("Avatar") << "wearables loaded" << LL_ENDL;
+ LLStartUp::setStartupState( STATE_CLEANUP );
+ return TRUE;
+ }
+ }
+ //fall through this frame to STATE_CLEANUP
+ }
+
+ if (STATE_CLEANUP == LLStartUp::getStartupState())
+ {
+ set_startup_status(1.0, "", "");
+ display_startup();
+
+ if (!mBenefitsSuccessfullyInit)
+ {
+ LLNotificationsUtil::add("FailedToGetBenefits", LLSD(), LLSD(), boost::bind(on_benefits_failed_callback, _1, _2));
+ }
+
+ // Let the map know about the inventory.
+ LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
+ if(floater_world_map)
+ {
+ floater_world_map->observeInventory(&gInventory);
+ floater_world_map->observeFriends();
+ }
+ gViewerWindow->showCursor();
+ gViewerWindow->getWindow()->resetBusyCount();
+ gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
+ LL_DEBUGS("AppInit") << "Done releasing bitmap" << LL_ENDL;
+ //gViewerWindow->revealIntroPanel();
+ gViewerWindow->setStartupComplete();
+ gViewerWindow->setProgressCancelButtonVisible(FALSE);
+ display_startup();
+
+ // We're not away from keyboard, even though login might have taken
+ // a while. JC
+ gAgent.clearAFK();
+
+ // Have the agent start watching the friends list so we can update proxies
+ gAgent.observeFriends();
+
+ // Start automatic replay if the flag is set.
+ if (gSavedSettings.getBOOL("StatsAutoRun") || gAgentPilot.getReplaySession())
+ {
+ LL_DEBUGS("AppInit") << "Starting automatic playback" << LL_ENDL;
+ gAgentPilot.startPlayback();
+ }
+
+ show_debug_menus(); // Debug menu visiblity and First Use trigger
+
+ // If we've got a startup URL, dispatch it
+ //LLStartUp::dispatchURL();
+
+ // Retrieve information about the land data
+ // (just accessing this the first time will fetch it,
+ // then the data is cached for the viewer's lifetime)
+ LLProductInfoRequestManager::instance();
+
+ // *FIX:Mani - What do I do here?
+ // Need we really clear the Auth response data?
+ // Clean up the userauth stuff.
+ // LLUserAuth::getInstance()->reset();
+
+ LLStartUp::setStartupState( STATE_STARTED );
+ display_startup();
+
+ // Unmute audio if desired and setup volumes.
+ // This is a not-uncommon crash site, so surround it with
+ // LL_INFOS() output to aid diagnosis.
+ LL_INFOS("AppInit") << "Doing first audio_update_volume..." << LL_ENDL;
+ audio_update_volume();
+ LL_INFOS("AppInit") << "Done first audio_update_volume." << LL_ENDL;
+
+ // reset keyboard focus to sane state of pointing at world
+ gFocusMgr.setKeyboardFocus(NULL);
+
+ LLAppViewer::instance()->handleLoginComplete();
+
+ LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
+
+ display_startup();
+
+ llassert(LLPathfindingManager::getInstance() != NULL);
+ LLPathfindingManager::getInstance()->initSystem();
+
+ gAgentAvatarp->sendHoverHeight();
+
+ // look for parcels we own
+ send_places_query(LLUUID::null,
+ LLUUID::null,
+ "",
+ DFQ_AGENT_OWNED,
+ LLParcel::C_ANY,
+ "");
+
+ LLUIUsage::instance().clear();
LLPerfStats::StatsRecorder::setAutotuneInit();
- return TRUE;
- }
+ return TRUE;
+ }
- return TRUE;
+ return TRUE;
}
//
@@ -2431,50 +2431,50 @@ bool idle_startup()
void login_show()
{
- LL_INFOS("AppInit") << "Initializing Login Screen" << LL_ENDL;
-
- // Hide the toolbars: may happen to come back here if login fails after login agent but before login in region
- if (gToolBarView)
- {
- gToolBarView->setVisible(FALSE);
- }
-
- LLPanelLogin::show( gViewerWindow->getWindowRectScaled(), login_callback, NULL );
+ LL_INFOS("AppInit") << "Initializing Login Screen" << LL_ENDL;
+
+ // Hide the toolbars: may happen to come back here if login fails after login agent but before login in region
+ if (gToolBarView)
+ {
+ gToolBarView->setVisible(FALSE);
+ }
+
+ LLPanelLogin::show( gViewerWindow->getWindowRectScaled(), login_callback, NULL );
}
// Callback for when login screen is closed. Option 0 = connect, option 1 = quit.
void login_callback(S32 option, void *userdata)
{
- const S32 CONNECT_OPTION = 0;
- const S32 QUIT_OPTION = 1;
-
- if (CONNECT_OPTION == option)
- {
- LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
- return;
- }
- else if (QUIT_OPTION == option) // *TODO: THIS CODE SEEMS TO BE UNREACHABLE!!!!! login_callback is never called with option equal to QUIT_OPTION
- {
- if (!gSavedSettings.getBOOL("RememberPassword"))
- {
- // turn off the setting and write out to disk
- gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
- LLUIColorTable::instance().saveUserSettings();
- }
-
- // Next iteration through main loop should shut down the app cleanly.
- LLAppViewer::instance()->userQuit();
-
- if (LLAppViewer::instance()->quitRequested())
- {
- LLPanelLogin::closePanel();
- }
- return;
- }
- else
- {
- LL_WARNS("AppInit") << "Unknown login button clicked" << LL_ENDL;
- }
+ const S32 CONNECT_OPTION = 0;
+ const S32 QUIT_OPTION = 1;
+
+ if (CONNECT_OPTION == option)
+ {
+ LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+ return;
+ }
+ else if (QUIT_OPTION == option) // *TODO: THIS CODE SEEMS TO BE UNREACHABLE!!!!! login_callback is never called with option equal to QUIT_OPTION
+ {
+ if (!gSavedSettings.getBOOL("RememberPassword"))
+ {
+ // turn off the setting and write out to disk
+ gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
+ LLUIColorTable::instance().saveUserSettings();
+ }
+
+ // Next iteration through main loop should shut down the app cleanly.
+ LLAppViewer::instance()->userQuit();
+
+ if (LLAppViewer::instance()->quitRequested())
+ {
+ LLPanelLogin::closePanel();
+ }
+ return;
+ }
+ else
+ {
+ LL_WARNS("AppInit") << "Unknown login button clicked" << LL_ENDL;
+ }
}
void release_notes_coro(const std::string url)
@@ -2556,35 +2556,35 @@ void show_release_notes_if_required()
void show_first_run_dialog()
{
- LLNotificationsUtil::add("FirstRun", LLSD(), LLSD(), first_run_dialog_callback);
+ LLNotificationsUtil::add("FirstRun", LLSD(), LLSD(), first_run_dialog_callback);
}
bool first_run_dialog_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- LL_DEBUGS("AppInit") << "First run dialog cancelling" << LL_ENDL;
- LLWeb::loadURLExternal(LLTrans::getString("create_account_url") );
- }
-
- LLPanelLogin::giveFocus();
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ LL_DEBUGS("AppInit") << "First run dialog cancelling" << LL_ENDL;
+ LLWeb::loadURLExternal(LLTrans::getString("create_account_url") );
+ }
+
+ LLPanelLogin::giveFocus();
+ return false;
}
void set_startup_status(const F32 frac, const std::string& string, const std::string& msg)
{
- gViewerWindow->setProgressPercent(frac*100);
- gViewerWindow->setProgressString(string);
+ gViewerWindow->setProgressPercent(frac*100);
+ gViewerWindow->setProgressString(string);
- gViewerWindow->setProgressMessage(msg);
+ gViewerWindow->setProgressMessage(msg);
}
bool login_alert_status(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
// Buttons
switch( option )
{
@@ -2595,222 +2595,222 @@ bool login_alert_status(const LLSD& notification, const LLSD& response)
// break;
case 2: // Teleport
// Restart the login process, starting at our home locaton
- LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
break;
default:
LL_WARNS("AppInit") << "Missing case in login_alert_status switch" << LL_ENDL;
}
- LLPanelLogin::giveFocus();
- return false;
+ LLPanelLogin::giveFocus();
+ return false;
}
void use_circuit_callback(void**, S32 result)
{
- // bail if we're quitting.
- if(LLApp::isExiting()) return;
- if( !gUseCircuitCallbackCalled )
- {
- gUseCircuitCallbackCalled = true;
- if (result)
- {
- // Make sure user knows something bad happened. JC
- LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL;
- if (gRememberPassword)
- {
- LLNotificationsUtil::add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status);
- }
- else
- {
- LLNotificationsUtil::add("LoginPacketNeverReceivedNoTP", LLSD(), LLSD(), login_alert_status);
- }
- reset_login();
- }
- else
- {
- gGotUseCircuitCodeAck = true;
- }
- }
+ // bail if we're quitting.
+ if(LLApp::isExiting()) return;
+ if( !gUseCircuitCallbackCalled )
+ {
+ gUseCircuitCallbackCalled = true;
+ if (result)
+ {
+ // Make sure user knows something bad happened. JC
+ LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL;
+ if (gRememberPassword)
+ {
+ LLNotificationsUtil::add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status);
+ }
+ else
+ {
+ LLNotificationsUtil::add("LoginPacketNeverReceivedNoTP", LLSD(), LLSD(), login_alert_status);
+ }
+ reset_login();
+ }
+ else
+ {
+ gGotUseCircuitCodeAck = true;
+ }
+ }
}
void register_viewer_callbacks(LLMessageSystem* msg)
{
- msg->setHandlerFuncFast(_PREHASH_LayerData, process_layer_data );
- msg->setHandlerFuncFast(_PREHASH_ObjectUpdate, process_object_update );
- msg->setHandlerFunc("ObjectUpdateCompressed", process_compressed_object_update );
- msg->setHandlerFunc("ObjectUpdateCached", process_cached_object_update );
- msg->setHandlerFuncFast(_PREHASH_ImprovedTerseObjectUpdate, process_terse_object_update_improved );
- msg->setHandlerFunc("SimStats", process_sim_stats);
- msg->setHandlerFuncFast(_PREHASH_HealthMessage, process_health_message );
- msg->setHandlerFuncFast(_PREHASH_EconomyData, process_economy_data);
- msg->setHandlerFunc("RegionInfo", LLViewerRegion::processRegionInfo);
-
- msg->setHandlerFuncFast(_PREHASH_ChatFromSimulator, process_chat_from_simulator);
- msg->setHandlerFuncFast(_PREHASH_KillObject, process_kill_object, NULL);
- msg->setHandlerFuncFast(_PREHASH_SimulatorViewerTimeMessage, process_time_synch, NULL);
- msg->setHandlerFuncFast(_PREHASH_EnableSimulator, process_enable_simulator);
- msg->setHandlerFuncFast(_PREHASH_DisableSimulator, process_disable_simulator);
- msg->setHandlerFuncFast(_PREHASH_KickUser, process_kick_user, NULL);
-
- msg->setHandlerFunc("CrossedRegion", process_crossed_region);
- msg->setHandlerFuncFast(_PREHASH_TeleportFinish, process_teleport_finish);
-
- msg->setHandlerFuncFast(_PREHASH_AlertMessage, process_alert_message);
- msg->setHandlerFunc("AgentAlertMessage", process_agent_alert_message);
- msg->setHandlerFuncFast(_PREHASH_MeanCollisionAlert, process_mean_collision_alert_message, NULL);
- msg->setHandlerFunc("ViewerFrozenMessage", process_frozen_message);
-
- msg->setHandlerFuncFast(_PREHASH_NameValuePair, process_name_value);
- msg->setHandlerFuncFast(_PREHASH_RemoveNameValuePair, process_remove_name_value);
- msg->setHandlerFuncFast(_PREHASH_AvatarAnimation, process_avatar_animation);
- msg->setHandlerFuncFast(_PREHASH_ObjectAnimation, process_object_animation);
- msg->setHandlerFuncFast(_PREHASH_AvatarAppearance, process_avatar_appearance);
- msg->setHandlerFuncFast(_PREHASH_CameraConstraint, process_camera_constraint);
- msg->setHandlerFuncFast(_PREHASH_AvatarSitResponse, process_avatar_sit_response);
- msg->setHandlerFunc("SetFollowCamProperties", process_set_follow_cam_properties);
- msg->setHandlerFunc("ClearFollowCamProperties", process_clear_follow_cam_properties);
-
- msg->setHandlerFuncFast(_PREHASH_ImprovedInstantMessage, process_improved_im);
- msg->setHandlerFuncFast(_PREHASH_ScriptQuestion, process_script_question);
- msg->setHandlerFuncFast(_PREHASH_ObjectProperties, LLSelectMgr::processObjectProperties, NULL);
- msg->setHandlerFuncFast(_PREHASH_ObjectPropertiesFamily, LLSelectMgr::processObjectPropertiesFamily, NULL);
- msg->setHandlerFunc("ForceObjectSelect", LLSelectMgr::processForceObjectSelect);
-
- msg->setHandlerFuncFast(_PREHASH_MoneyBalanceReply, process_money_balance_reply, NULL);
- msg->setHandlerFuncFast(_PREHASH_CoarseLocationUpdate, LLWorld::processCoarseUpdate, NULL);
- msg->setHandlerFuncFast(_PREHASH_ReplyTaskInventory, LLViewerObject::processTaskInv, NULL);
- msg->setHandlerFuncFast(_PREHASH_DerezContainer, process_derez_container, NULL);
- msg->setHandlerFuncFast(_PREHASH_ScriptRunningReply,
- &LLLiveLSLEditor::processScriptRunningReply);
-
- msg->setHandlerFuncFast(_PREHASH_DeRezAck, process_derez_ack);
-
- msg->setHandlerFunc("LogoutReply", process_logout_reply);
-
- //msg->setHandlerFuncFast(_PREHASH_AddModifyAbility,
- // &LLAgent::processAddModifyAbility);
- //msg->setHandlerFuncFast(_PREHASH_RemoveModifyAbility,
- // &LLAgent::processRemoveModifyAbility);
- msg->setHandlerFuncFast(_PREHASH_AgentDataUpdate,
- &LLAgent::processAgentDataUpdate);
- msg->setHandlerFuncFast(_PREHASH_AgentGroupDataUpdate,
- &LLAgent::processAgentGroupDataUpdate);
- msg->setHandlerFunc("AgentDropGroup",
- &LLAgent::processAgentDropGroup);
- // land ownership messages
- msg->setHandlerFuncFast(_PREHASH_ParcelOverlay,
- LLViewerParcelMgr::processParcelOverlay);
- msg->setHandlerFuncFast(_PREHASH_ParcelProperties,
- LLViewerParcelMgr::processParcelProperties);
- msg->setHandlerFunc("ParcelAccessListReply",
- LLViewerParcelMgr::processParcelAccessListReply);
- msg->setHandlerFunc("ParcelDwellReply",
- LLViewerParcelMgr::processParcelDwellReply);
-
- msg->setHandlerFunc("AvatarPropertiesReply",
- &LLAvatarPropertiesProcessor::processAvatarPropertiesReply);
- msg->setHandlerFunc("AvatarInterestsReply",
- &LLAvatarPropertiesProcessor::processAvatarInterestsReply);
- msg->setHandlerFunc("AvatarGroupsReply",
- &LLAvatarPropertiesProcessor::processAvatarGroupsReply);
- // ratings deprecated
- //msg->setHandlerFuncFast(_PREHASH_AvatarStatisticsReply,
- // LLPanelAvatar::processAvatarStatisticsReply);
- msg->setHandlerFunc("AvatarNotesReply",
- &LLAvatarPropertiesProcessor::processAvatarNotesReply);
- msg->setHandlerFunc("AvatarPicksReply",
- &LLAvatarPropertiesProcessor::processAvatarPicksReply);
- msg->setHandlerFunc("AvatarClassifiedReply",
- &LLAvatarPropertiesProcessor::processAvatarClassifiedsReply);
-
- msg->setHandlerFuncFast(_PREHASH_CreateGroupReply,
- LLGroupMgr::processCreateGroupReply);
- msg->setHandlerFuncFast(_PREHASH_JoinGroupReply,
- LLGroupMgr::processJoinGroupReply);
- msg->setHandlerFuncFast(_PREHASH_EjectGroupMemberReply,
- LLGroupMgr::processEjectGroupMemberReply);
- msg->setHandlerFuncFast(_PREHASH_LeaveGroupReply,
- LLGroupMgr::processLeaveGroupReply);
- msg->setHandlerFuncFast(_PREHASH_GroupProfileReply,
- LLGroupMgr::processGroupPropertiesReply);
-
- // ratings deprecated
- // msg->setHandlerFuncFast(_PREHASH_ReputationIndividualReply,
- // LLFloaterRate::processReputationIndividualReply);
-
- msg->setHandlerFunc("ScriptControlChange",
- LLAgent::processScriptControlChange );
-
- msg->setHandlerFuncFast(_PREHASH_ViewerEffect, LLHUDManager::processViewerEffect);
-
- msg->setHandlerFuncFast(_PREHASH_GrantGodlikePowers, process_grant_godlike_powers);
-
- msg->setHandlerFuncFast(_PREHASH_GroupAccountSummaryReply,
- LLPanelGroupLandMoney::processGroupAccountSummaryReply);
- msg->setHandlerFuncFast(_PREHASH_GroupAccountDetailsReply,
- LLPanelGroupLandMoney::processGroupAccountDetailsReply);
- msg->setHandlerFuncFast(_PREHASH_GroupAccountTransactionsReply,
- LLPanelGroupLandMoney::processGroupAccountTransactionsReply);
-
- msg->setHandlerFuncFast(_PREHASH_UserInfoReply,
- process_user_info_reply);
-
- msg->setHandlerFunc("RegionHandshake", process_region_handshake, NULL);
-
- msg->setHandlerFunc("TeleportStart", process_teleport_start );
- msg->setHandlerFunc("TeleportProgress", process_teleport_progress);
- msg->setHandlerFunc("TeleportFailed", process_teleport_failed, NULL);
- msg->setHandlerFunc("TeleportLocal", process_teleport_local, NULL);
-
- msg->setHandlerFunc("ImageNotInDatabase", LLViewerTextureList::processImageNotInDatabase, NULL);
-
- msg->setHandlerFuncFast(_PREHASH_GroupMembersReply,
- LLGroupMgr::processGroupMembersReply);
- msg->setHandlerFunc("GroupRoleDataReply",
- LLGroupMgr::processGroupRoleDataReply);
- msg->setHandlerFunc("GroupRoleMembersReply",
- LLGroupMgr::processGroupRoleMembersReply);
- msg->setHandlerFunc("GroupTitlesReply",
- LLGroupMgr::processGroupTitlesReply);
- // Special handler as this message is sometimes used for group land.
- msg->setHandlerFunc("PlacesReply", process_places_reply);
- msg->setHandlerFunc("GroupNoticesListReply", LLPanelGroupNotices::processGroupNoticesListReply);
-
- msg->setHandlerFunc("AvatarPickerReply", LLFloaterAvatarPicker::processAvatarPickerReply);
-
- msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply);
- msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply);
- msg->setHandlerFunc("EventInfoReply", LLEventNotifier::processEventInfoReply);
-
- msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);
- msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply);
- msg->setHandlerFunc("ParcelInfoReply", LLRemoteParcelInfoProcessor::processParcelInfoReply);
- msg->setHandlerFunc("ScriptDialog", process_script_dialog);
- msg->setHandlerFunc("LoadURL", process_load_url);
- msg->setHandlerFunc("ScriptTeleportRequest", process_script_teleport_request);
- msg->setHandlerFunc("EstateCovenantReply", process_covenant_reply);
-
- // calling cards
- msg->setHandlerFunc("OfferCallingCard", process_offer_callingcard);
- msg->setHandlerFunc("AcceptCallingCard", process_accept_callingcard);
- msg->setHandlerFunc("DeclineCallingCard", process_decline_callingcard);
-
- msg->setHandlerFunc("ParcelObjectOwnersReply", LLPanelLandObjects::processParcelObjectOwnersReply);
-
- msg->setHandlerFunc("InitiateDownload", process_initiate_download);
- msg->setHandlerFunc("LandStatReply", LLFloaterTopObjects::handle_land_reply);
+ msg->setHandlerFuncFast(_PREHASH_LayerData, process_layer_data );
+ msg->setHandlerFuncFast(_PREHASH_ObjectUpdate, process_object_update );
+ msg->setHandlerFunc("ObjectUpdateCompressed", process_compressed_object_update );
+ msg->setHandlerFunc("ObjectUpdateCached", process_cached_object_update );
+ msg->setHandlerFuncFast(_PREHASH_ImprovedTerseObjectUpdate, process_terse_object_update_improved );
+ msg->setHandlerFunc("SimStats", process_sim_stats);
+ msg->setHandlerFuncFast(_PREHASH_HealthMessage, process_health_message );
+ msg->setHandlerFuncFast(_PREHASH_EconomyData, process_economy_data);
+ msg->setHandlerFunc("RegionInfo", LLViewerRegion::processRegionInfo);
+
+ msg->setHandlerFuncFast(_PREHASH_ChatFromSimulator, process_chat_from_simulator);
+ msg->setHandlerFuncFast(_PREHASH_KillObject, process_kill_object, NULL);
+ msg->setHandlerFuncFast(_PREHASH_SimulatorViewerTimeMessage, process_time_synch, NULL);
+ msg->setHandlerFuncFast(_PREHASH_EnableSimulator, process_enable_simulator);
+ msg->setHandlerFuncFast(_PREHASH_DisableSimulator, process_disable_simulator);
+ msg->setHandlerFuncFast(_PREHASH_KickUser, process_kick_user, NULL);
+
+ msg->setHandlerFunc("CrossedRegion", process_crossed_region);
+ msg->setHandlerFuncFast(_PREHASH_TeleportFinish, process_teleport_finish);
+
+ msg->setHandlerFuncFast(_PREHASH_AlertMessage, process_alert_message);
+ msg->setHandlerFunc("AgentAlertMessage", process_agent_alert_message);
+ msg->setHandlerFuncFast(_PREHASH_MeanCollisionAlert, process_mean_collision_alert_message, NULL);
+ msg->setHandlerFunc("ViewerFrozenMessage", process_frozen_message);
+
+ msg->setHandlerFuncFast(_PREHASH_NameValuePair, process_name_value);
+ msg->setHandlerFuncFast(_PREHASH_RemoveNameValuePair, process_remove_name_value);
+ msg->setHandlerFuncFast(_PREHASH_AvatarAnimation, process_avatar_animation);
+ msg->setHandlerFuncFast(_PREHASH_ObjectAnimation, process_object_animation);
+ msg->setHandlerFuncFast(_PREHASH_AvatarAppearance, process_avatar_appearance);
+ msg->setHandlerFuncFast(_PREHASH_CameraConstraint, process_camera_constraint);
+ msg->setHandlerFuncFast(_PREHASH_AvatarSitResponse, process_avatar_sit_response);
+ msg->setHandlerFunc("SetFollowCamProperties", process_set_follow_cam_properties);
+ msg->setHandlerFunc("ClearFollowCamProperties", process_clear_follow_cam_properties);
+
+ msg->setHandlerFuncFast(_PREHASH_ImprovedInstantMessage, process_improved_im);
+ msg->setHandlerFuncFast(_PREHASH_ScriptQuestion, process_script_question);
+ msg->setHandlerFuncFast(_PREHASH_ObjectProperties, LLSelectMgr::processObjectProperties, NULL);
+ msg->setHandlerFuncFast(_PREHASH_ObjectPropertiesFamily, LLSelectMgr::processObjectPropertiesFamily, NULL);
+ msg->setHandlerFunc("ForceObjectSelect", LLSelectMgr::processForceObjectSelect);
+
+ msg->setHandlerFuncFast(_PREHASH_MoneyBalanceReply, process_money_balance_reply, NULL);
+ msg->setHandlerFuncFast(_PREHASH_CoarseLocationUpdate, LLWorld::processCoarseUpdate, NULL);
+ msg->setHandlerFuncFast(_PREHASH_ReplyTaskInventory, LLViewerObject::processTaskInv, NULL);
+ msg->setHandlerFuncFast(_PREHASH_DerezContainer, process_derez_container, NULL);
+ msg->setHandlerFuncFast(_PREHASH_ScriptRunningReply,
+ &LLLiveLSLEditor::processScriptRunningReply);
+
+ msg->setHandlerFuncFast(_PREHASH_DeRezAck, process_derez_ack);
+
+ msg->setHandlerFunc("LogoutReply", process_logout_reply);
+
+ //msg->setHandlerFuncFast(_PREHASH_AddModifyAbility,
+ // &LLAgent::processAddModifyAbility);
+ //msg->setHandlerFuncFast(_PREHASH_RemoveModifyAbility,
+ // &LLAgent::processRemoveModifyAbility);
+ msg->setHandlerFuncFast(_PREHASH_AgentDataUpdate,
+ &LLAgent::processAgentDataUpdate);
+ msg->setHandlerFuncFast(_PREHASH_AgentGroupDataUpdate,
+ &LLAgent::processAgentGroupDataUpdate);
+ msg->setHandlerFunc("AgentDropGroup",
+ &LLAgent::processAgentDropGroup);
+ // land ownership messages
+ msg->setHandlerFuncFast(_PREHASH_ParcelOverlay,
+ LLViewerParcelMgr::processParcelOverlay);
+ msg->setHandlerFuncFast(_PREHASH_ParcelProperties,
+ LLViewerParcelMgr::processParcelProperties);
+ msg->setHandlerFunc("ParcelAccessListReply",
+ LLViewerParcelMgr::processParcelAccessListReply);
+ msg->setHandlerFunc("ParcelDwellReply",
+ LLViewerParcelMgr::processParcelDwellReply);
+
+ msg->setHandlerFunc("AvatarPropertiesReply",
+ &LLAvatarPropertiesProcessor::processAvatarPropertiesReply);
+ msg->setHandlerFunc("AvatarInterestsReply",
+ &LLAvatarPropertiesProcessor::processAvatarInterestsReply);
+ msg->setHandlerFunc("AvatarGroupsReply",
+ &LLAvatarPropertiesProcessor::processAvatarGroupsReply);
+ // ratings deprecated
+ //msg->setHandlerFuncFast(_PREHASH_AvatarStatisticsReply,
+ // LLPanelAvatar::processAvatarStatisticsReply);
+ msg->setHandlerFunc("AvatarNotesReply",
+ &LLAvatarPropertiesProcessor::processAvatarNotesReply);
+ msg->setHandlerFunc("AvatarPicksReply",
+ &LLAvatarPropertiesProcessor::processAvatarPicksReply);
+ msg->setHandlerFunc("AvatarClassifiedReply",
+ &LLAvatarPropertiesProcessor::processAvatarClassifiedsReply);
+
+ msg->setHandlerFuncFast(_PREHASH_CreateGroupReply,
+ LLGroupMgr::processCreateGroupReply);
+ msg->setHandlerFuncFast(_PREHASH_JoinGroupReply,
+ LLGroupMgr::processJoinGroupReply);
+ msg->setHandlerFuncFast(_PREHASH_EjectGroupMemberReply,
+ LLGroupMgr::processEjectGroupMemberReply);
+ msg->setHandlerFuncFast(_PREHASH_LeaveGroupReply,
+ LLGroupMgr::processLeaveGroupReply);
+ msg->setHandlerFuncFast(_PREHASH_GroupProfileReply,
+ LLGroupMgr::processGroupPropertiesReply);
+
+ // ratings deprecated
+ // msg->setHandlerFuncFast(_PREHASH_ReputationIndividualReply,
+ // LLFloaterRate::processReputationIndividualReply);
+
+ msg->setHandlerFunc("ScriptControlChange",
+ LLAgent::processScriptControlChange );
+
+ msg->setHandlerFuncFast(_PREHASH_ViewerEffect, LLHUDManager::processViewerEffect);
+
+ msg->setHandlerFuncFast(_PREHASH_GrantGodlikePowers, process_grant_godlike_powers);
+
+ msg->setHandlerFuncFast(_PREHASH_GroupAccountSummaryReply,
+ LLPanelGroupLandMoney::processGroupAccountSummaryReply);
+ msg->setHandlerFuncFast(_PREHASH_GroupAccountDetailsReply,
+ LLPanelGroupLandMoney::processGroupAccountDetailsReply);
+ msg->setHandlerFuncFast(_PREHASH_GroupAccountTransactionsReply,
+ LLPanelGroupLandMoney::processGroupAccountTransactionsReply);
+
+ msg->setHandlerFuncFast(_PREHASH_UserInfoReply,
+ process_user_info_reply);
+
+ msg->setHandlerFunc("RegionHandshake", process_region_handshake, NULL);
+
+ msg->setHandlerFunc("TeleportStart", process_teleport_start );
+ msg->setHandlerFunc("TeleportProgress", process_teleport_progress);
+ msg->setHandlerFunc("TeleportFailed", process_teleport_failed, NULL);
+ msg->setHandlerFunc("TeleportLocal", process_teleport_local, NULL);
+
+ msg->setHandlerFunc("ImageNotInDatabase", LLViewerTextureList::processImageNotInDatabase, NULL);
+
+ msg->setHandlerFuncFast(_PREHASH_GroupMembersReply,
+ LLGroupMgr::processGroupMembersReply);
+ msg->setHandlerFunc("GroupRoleDataReply",
+ LLGroupMgr::processGroupRoleDataReply);
+ msg->setHandlerFunc("GroupRoleMembersReply",
+ LLGroupMgr::processGroupRoleMembersReply);
+ msg->setHandlerFunc("GroupTitlesReply",
+ LLGroupMgr::processGroupTitlesReply);
+ // Special handler as this message is sometimes used for group land.
+ msg->setHandlerFunc("PlacesReply", process_places_reply);
+ msg->setHandlerFunc("GroupNoticesListReply", LLPanelGroupNotices::processGroupNoticesListReply);
+
+ msg->setHandlerFunc("AvatarPickerReply", LLFloaterAvatarPicker::processAvatarPickerReply);
+
+ msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply);
+ msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply);
+ msg->setHandlerFunc("EventInfoReply", LLEventNotifier::processEventInfoReply);
+
+ msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);
+ msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply);
+ msg->setHandlerFunc("ParcelInfoReply", LLRemoteParcelInfoProcessor::processParcelInfoReply);
+ msg->setHandlerFunc("ScriptDialog", process_script_dialog);
+ msg->setHandlerFunc("LoadURL", process_load_url);
+ msg->setHandlerFunc("ScriptTeleportRequest", process_script_teleport_request);
+ msg->setHandlerFunc("EstateCovenantReply", process_covenant_reply);
+
+ // calling cards
+ msg->setHandlerFunc("OfferCallingCard", process_offer_callingcard);
+ msg->setHandlerFunc("AcceptCallingCard", process_accept_callingcard);
+ msg->setHandlerFunc("DeclineCallingCard", process_decline_callingcard);
+
+ msg->setHandlerFunc("ParcelObjectOwnersReply", LLPanelLandObjects::processParcelObjectOwnersReply);
+
+ msg->setHandlerFunc("InitiateDownload", process_initiate_download);
+ msg->setHandlerFunc("LandStatReply", LLFloaterTopObjects::handle_land_reply);
msg->setHandlerFunc("GenericMessage", process_generic_message);
msg->setHandlerFunc("GenericStreamingMessage", process_generic_streaming_message);
msg->setHandlerFunc("LargeGenericMessage", process_large_generic_message);
- msg->setHandlerFuncFast(_PREHASH_FeatureDisabled, process_feature_disabled_message);
+ msg->setHandlerFuncFast(_PREHASH_FeatureDisabled, process_feature_disabled_message);
}
void asset_callback_nothing(const LLUUID&, LLAssetType::EType, void*, S32)
{
- // nothing
+ // nothing
}
const S32 OPT_CLOSED_WINDOW = -1;
@@ -2818,27 +2818,27 @@ const S32 OPT_MALE = 0;
const S32 OPT_FEMALE = 1;
const S32 OPT_TRUST_CERT = 0;
const S32 OPT_CANCEL_TRUST = 1;
-
+
bool callback_choose_gender(const LLSD& notification, const LLSD& response)
{
-
- // These defaults are returned from the server on login. They are set in login.xml.
- // If no default is returned from the server, they are retrieved from settings.xml.
-
- S32 option = LLNotification::getSelectedOption(notification, response);
- switch(option)
- {
- case OPT_MALE:
- LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultMaleAvatar"), "male" );
- break;
-
+
+ // These defaults are returned from the server on login. They are set in login.xml.
+ // If no default is returned from the server, they are retrieved from settings.xml.
+
+ S32 option = LLNotification::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case OPT_MALE:
+ LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultMaleAvatar"), "male" );
+ break;
+
case OPT_FEMALE:
case OPT_CLOSED_WINDOW:
default:
- LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultFemaleAvatar"), "female" );
- break;
- }
- return false;
+ LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultFemaleAvatar"), "female" );
+ break;
+ }
+ return false;
}
std::string get_screen_filename(const std::string& pattern)
@@ -2870,66 +2870,66 @@ std::string LLStartUp::getScreenHomeFilename()
//static
void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
- const std::string& gender_name )
+ const std::string& gender_name )
{
- LL_DEBUGS() << "starting" << LL_ENDL;
-
- // Not going through the processAgentInitialWearables path, so need to set this here.
- LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
- // Initiate creation of COF, since we're also bypassing that.
- gInventory.ensureCategoryForTypeExists(LLFolderType::FT_CURRENT_OUTFIT);
-
- ESex gender;
- if (gender_name == "male")
- {
- LL_DEBUGS() << "male" << LL_ENDL;
- gender = SEX_MALE;
- }
- else
- {
- LL_DEBUGS() << "female" << LL_ENDL;
- gender = SEX_FEMALE;
- }
-
- if (!isAgentAvatarValid())
- {
- LL_WARNS() << "Trying to load an initial outfit for an invalid agent avatar" << LL_ENDL;
- return;
- }
-
- gAgentAvatarp->setSex(gender);
-
- // try to find the requested outfit or folder
-
- // -- check for existing outfit in My Outfits
- bool do_copy = false;
- LLUUID cat_id = findDescendentCategoryIDByName(
- gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS),
- outfit_folder_name);
-
- // -- check for existing folder in Library
- if (cat_id.isNull())
- {
- cat_id = findDescendentCategoryIDByName(
- gInventory.getLibraryRootFolderID(),
- outfit_folder_name);
- if (!cat_id.isNull())
- {
- do_copy = true;
- }
- }
-
- if (cat_id.isNull())
- {
- // -- final fallback: create standard wearables
- LL_DEBUGS() << "standard wearables" << LL_ENDL;
- gAgentWearables.createStandardWearables();
- }
- else
- {
- bool do_append = false;
- LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
- // Need to fetch cof contents before we can wear.
+ LL_DEBUGS() << "starting" << LL_ENDL;
+
+ // Not going through the processAgentInitialWearables path, so need to set this here.
+ LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
+ // Initiate creation of COF, since we're also bypassing that.
+ gInventory.ensureCategoryForTypeExists(LLFolderType::FT_CURRENT_OUTFIT);
+
+ ESex gender;
+ if (gender_name == "male")
+ {
+ LL_DEBUGS() << "male" << LL_ENDL;
+ gender = SEX_MALE;
+ }
+ else
+ {
+ LL_DEBUGS() << "female" << LL_ENDL;
+ gender = SEX_FEMALE;
+ }
+
+ if (!isAgentAvatarValid())
+ {
+ LL_WARNS() << "Trying to load an initial outfit for an invalid agent avatar" << LL_ENDL;
+ return;
+ }
+
+ gAgentAvatarp->setSex(gender);
+
+ // try to find the requested outfit or folder
+
+ // -- check for existing outfit in My Outfits
+ bool do_copy = false;
+ LLUUID cat_id = findDescendentCategoryIDByName(
+ gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS),
+ outfit_folder_name);
+
+ // -- check for existing folder in Library
+ if (cat_id.isNull())
+ {
+ cat_id = findDescendentCategoryIDByName(
+ gInventory.getLibraryRootFolderID(),
+ outfit_folder_name);
+ if (!cat_id.isNull())
+ {
+ do_copy = true;
+ }
+ }
+
+ if (cat_id.isNull())
+ {
+ // -- final fallback: create standard wearables
+ LL_DEBUGS() << "standard wearables" << LL_ENDL;
+ gAgentWearables.createStandardWearables();
+ }
+ else
+ {
+ bool do_append = false;
+ LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
+ // Need to fetch cof contents before we can wear.
if (do_copy)
{
callAfterCOFFetch(boost::bind(&LLAppearanceMgr::wearInventoryCategory, LLAppearanceMgr::getInstance(), cat, do_copy, do_append));
@@ -2938,16 +2938,16 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
{
callAfterCategoryLinksFetch(cat_id, boost::bind(&LLAppearanceMgr::wearInventoryCategory, LLAppearanceMgr::getInstance(), cat, do_copy, do_append));
}
- LL_DEBUGS() << "initial outfit category id: " << cat_id << LL_ENDL;
- }
+ LL_DEBUGS() << "initial outfit category id: " << cat_id << LL_ENDL;
+ }
- gAgent.setOutfitChosen(TRUE);
- gAgentWearables.sendDummyAgentWearablesUpdate();
+ gAgent.setOutfitChosen(TRUE);
+ gAgentWearables.sendDummyAgentWearablesUpdate();
}
std::string& LLStartUp::getInitialOutfitName()
{
- return sInitialOutfit;
+ return sInitialOutfit;
}
std::string LLStartUp::getUserId()
@@ -2963,8 +2963,8 @@ std::string LLStartUp::getUserId()
// frees the bitmap
void release_start_screen()
{
- LL_DEBUGS("AppInit") << "Releasing bitmap..." << LL_ENDL;
- gStartTexture = NULL;
+ LL_DEBUGS("AppInit") << "Releasing bitmap..." << LL_ENDL;
+ gStartTexture = NULL;
}
@@ -2972,77 +2972,77 @@ void release_start_screen()
std::string LLStartUp::startupStateToString(EStartupState state)
{
#define RTNENUM(E) case E: return #E
- switch(state){
- RTNENUM( STATE_FIRST );
- RTNENUM( STATE_BROWSER_INIT );
- RTNENUM( STATE_LOGIN_SHOW );
- RTNENUM( STATE_LOGIN_WAIT );
- RTNENUM( STATE_LOGIN_CLEANUP );
- RTNENUM( STATE_LOGIN_AUTH_INIT );
- RTNENUM( STATE_LOGIN_CURL_UNSTUCK );
- RTNENUM( STATE_LOGIN_PROCESS_RESPONSE );
- RTNENUM( STATE_WORLD_INIT );
- RTNENUM( STATE_MULTIMEDIA_INIT );
- RTNENUM( STATE_FONT_INIT );
- RTNENUM( STATE_SEED_GRANTED_WAIT );
- RTNENUM( STATE_SEED_CAP_GRANTED );
- RTNENUM( STATE_WORLD_WAIT );
- RTNENUM( STATE_AGENT_SEND );
- RTNENUM( STATE_AGENT_WAIT );
- RTNENUM( STATE_INVENTORY_SEND );
+ switch(state){
+ RTNENUM( STATE_FIRST );
+ RTNENUM( STATE_BROWSER_INIT );
+ RTNENUM( STATE_LOGIN_SHOW );
+ RTNENUM( STATE_LOGIN_WAIT );
+ RTNENUM( STATE_LOGIN_CLEANUP );
+ RTNENUM( STATE_LOGIN_AUTH_INIT );
+ RTNENUM( STATE_LOGIN_CURL_UNSTUCK );
+ RTNENUM( STATE_LOGIN_PROCESS_RESPONSE );
+ RTNENUM( STATE_WORLD_INIT );
+ RTNENUM( STATE_MULTIMEDIA_INIT );
+ RTNENUM( STATE_FONT_INIT );
+ RTNENUM( STATE_SEED_GRANTED_WAIT );
+ RTNENUM( STATE_SEED_CAP_GRANTED );
+ RTNENUM( STATE_WORLD_WAIT );
+ RTNENUM( STATE_AGENT_SEND );
+ RTNENUM( STATE_AGENT_WAIT );
+ RTNENUM( STATE_INVENTORY_SEND );
RTNENUM(STATE_INVENTORY_CALLBACKS );
- RTNENUM( STATE_MISC );
- RTNENUM( STATE_PRECACHE );
- RTNENUM( STATE_WEARABLES_WAIT );
- RTNENUM( STATE_CLEANUP );
- RTNENUM( STATE_STARTED );
- default:
- return llformat("(state #%d)", state);
- }
+ RTNENUM( STATE_MISC );
+ RTNENUM( STATE_PRECACHE );
+ RTNENUM( STATE_WEARABLES_WAIT );
+ RTNENUM( STATE_CLEANUP );
+ RTNENUM( STATE_STARTED );
+ default:
+ return llformat("(state #%d)", state);
+ }
#undef RTNENUM
}
// static
void LLStartUp::setStartupState( EStartupState state )
{
- LL_INFOS("AppInit") << "Startup state changing from " <<
- getStartupStateString() << " to " <<
- startupStateToString(state) << LL_ENDL;
+ LL_INFOS("AppInit") << "Startup state changing from " <<
+ getStartupStateString() << " to " <<
+ startupStateToString(state) << LL_ENDL;
- getPhases().stopPhase(getStartupStateString());
- gStartupState = state;
- getPhases().startPhase(getStartupStateString());
+ getPhases().stopPhase(getStartupStateString());
+ gStartupState = state;
+ getPhases().startPhase(getStartupStateString());
- postStartupState();
+ postStartupState();
}
void LLStartUp::postStartupState()
{
- LLSD stateInfo;
- stateInfo["str"] = getStartupStateString();
- stateInfo["enum"] = gStartupState;
- sStateWatcher->post(stateInfo);
- gDebugInfo["StartupState"] = getStartupStateString();
+ LLSD stateInfo;
+ stateInfo["str"] = getStartupStateString();
+ stateInfo["enum"] = gStartupState;
+ sStateWatcher->post(stateInfo);
+ gDebugInfo["StartupState"] = getStartupStateString();
}
void reset_login()
{
- gAgentWearables.cleanup();
- gAgentCamera.cleanup();
- gAgent.cleanup();
+ gAgentWearables.cleanup();
+ gAgentCamera.cleanup();
+ gAgent.cleanup();
gSky.cleanup(); // mVOSkyp is an inworld object.
- LLWorld::getInstance()->resetClass();
+ LLWorld::getInstance()->resetClass();
- if ( gViewerWindow )
- { // Hide menus and normal buttons
- gViewerWindow->setNormalControlsVisible( FALSE );
- gLoginMenuBarView->setVisible( TRUE );
- gLoginMenuBarView->setEnabled( TRUE );
- }
+ if ( gViewerWindow )
+ { // Hide menus and normal buttons
+ gViewerWindow->setNormalControlsVisible( FALSE );
+ gLoginMenuBarView->setVisible( TRUE );
+ gLoginMenuBarView->setEnabled( TRUE );
+ }
- // Hide any other stuff
- LLFloaterReg::hideVisibleInstances();
+ // Hide any other stuff
+ LLFloaterReg::hideVisibleInstances();
LLStartUp::setStartupState( STATE_BROWSER_INIT );
if (LLVoiceClient::instanceExists())
@@ -3062,117 +3062,117 @@ void reset_login()
// early, before the login screen). JC
void LLStartUp::multimediaInit()
{
- LL_DEBUGS("AppInit") << "Initializing Multimedia...." << LL_ENDL;
- std::string msg = LLTrans::getString("LoginInitializingMultimedia");
- set_startup_status(0.42f, msg.c_str(), gAgent.mMOTD.c_str());
- display_startup();
+ LL_DEBUGS("AppInit") << "Initializing Multimedia...." << LL_ENDL;
+ std::string msg = LLTrans::getString("LoginInitializingMultimedia");
+ set_startup_status(0.42f, msg.c_str(), gAgent.mMOTD.c_str());
+ display_startup();
}
void LLStartUp::fontInit()
{
- LL_DEBUGS("AppInit") << "Initializing fonts...." << LL_ENDL;
- std::string msg = LLTrans::getString("LoginInitializingFonts");
- set_startup_status(0.45f, msg.c_str(), gAgent.mMOTD.c_str());
- display_startup();
+ LL_DEBUGS("AppInit") << "Initializing fonts...." << LL_ENDL;
+ std::string msg = LLTrans::getString("LoginInitializingFonts");
+ set_startup_status(0.45f, msg.c_str(), gAgent.mMOTD.c_str());
+ display_startup();
- LLFontGL::loadDefaultFonts();
+ LLFontGL::loadDefaultFonts();
}
void LLStartUp::initNameCache()
{
- // Can be called multiple times
- if ( gCacheName ) return;
-
- gCacheName = new LLCacheName(gMessageSystem);
- gCacheName->addObserver(&callback_cache_name);
- gCacheName->localizeCacheName("waiting", LLTrans::getString("AvatarNameWaiting"));
- gCacheName->localizeCacheName("nobody", LLTrans::getString("AvatarNameNobody"));
- gCacheName->localizeCacheName("none", LLTrans::getString("GroupNameNone"));
- // Load stored cache if possible
- LLAppViewer::instance()->loadNameCache();
-
- // Start cache in not-running state until we figure out if we have
- // capabilities for display name lookup
- LLAvatarNameCache* cache_inst = LLAvatarNameCache::getInstance();
- cache_inst->setUsePeopleAPI(gSavedSettings.getBOOL("UsePeopleAPI"));
- cache_inst->setUseDisplayNames(gSavedSettings.getBOOL("UseDisplayNames"));
- cache_inst->setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames"));
+ // Can be called multiple times
+ if ( gCacheName ) return;
+
+ gCacheName = new LLCacheName(gMessageSystem);
+ gCacheName->addObserver(&callback_cache_name);
+ gCacheName->localizeCacheName("waiting", LLTrans::getString("AvatarNameWaiting"));
+ gCacheName->localizeCacheName("nobody", LLTrans::getString("AvatarNameNobody"));
+ gCacheName->localizeCacheName("none", LLTrans::getString("GroupNameNone"));
+ // Load stored cache if possible
+ LLAppViewer::instance()->loadNameCache();
+
+ // Start cache in not-running state until we figure out if we have
+ // capabilities for display name lookup
+ LLAvatarNameCache* cache_inst = LLAvatarNameCache::getInstance();
+ cache_inst->setUsePeopleAPI(gSavedSettings.getBOOL("UsePeopleAPI"));
+ cache_inst->setUseDisplayNames(gSavedSettings.getBOOL("UseDisplayNames"));
+ cache_inst->setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames"));
}
void LLStartUp::initExperiences()
-{
+{
// Should trigger loading the cache.
LLExperienceCache::instance().setCapabilityQuery(
boost::bind(&LLAgent::getRegionCapability, &gAgent, _1));
- LLExperienceLog::instance().initialize();
+ LLExperienceLog::instance().initialize();
}
void LLStartUp::cleanupNameCache()
{
- delete gCacheName;
- gCacheName = NULL;
+ delete gCacheName;
+ gCacheName = NULL;
}
bool LLStartUp::dispatchURL()
{
- // ok, if we've gotten this far and have a startup URL
+ // ok, if we've gotten this far and have a startup URL
if (!getStartSLURL().isValid())
- {
- return false;
- }
+ {
+ return false;
+ }
if(getStartSLURL().getType() != LLSLURL::APP)
- {
-
- // If we started with a location, but we're already
- // at that location, don't pop dialogs open.
- LLVector3 pos = gAgent.getPositionAgent();
- LLVector3 slurlpos = getStartSLURL().getPosition();
- F32 dx = pos.mV[VX] - slurlpos.mV[VX];
- F32 dy = pos.mV[VY] - slurlpos.mV[VY];
- const F32 SLOP = 2.f; // meters
-
- if( getStartSLURL().getRegion() != gAgent.getRegion()->getName()
- || (dx*dx > SLOP*SLOP)
- || (dy*dy > SLOP*SLOP) )
- {
- LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), LLCommandHandler::NAV_TYPE_CLICKED,
- NULL, false);
- }
- return true;
- }
- return false;
+ {
+
+ // If we started with a location, but we're already
+ // at that location, don't pop dialogs open.
+ LLVector3 pos = gAgent.getPositionAgent();
+ LLVector3 slurlpos = getStartSLURL().getPosition();
+ F32 dx = pos.mV[VX] - slurlpos.mV[VX];
+ F32 dy = pos.mV[VY] - slurlpos.mV[VY];
+ const F32 SLOP = 2.f; // meters
+
+ if( getStartSLURL().getRegion() != gAgent.getRegion()->getName()
+ || (dx*dx > SLOP*SLOP)
+ || (dy*dy > SLOP*SLOP) )
+ {
+ LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), LLCommandHandler::NAV_TYPE_CLICKED,
+ NULL, false);
+ }
+ return true;
+ }
+ return false;
}
-void LLStartUp::setStartSLURL(const LLSLURL& slurl)
+void LLStartUp::setStartSLURL(const LLSLURL& slurl)
{
- LL_DEBUGS("AppInit")<<slurl.asString()<<LL_ENDL;
-
- if ( slurl.isSpatial() )
- {
- std::string new_start = slurl.getSLURLString();
- LL_DEBUGS("AppInit")<<new_start<<LL_ENDL;
- sStartSLURL = slurl;
- LLPanelLogin::onUpdateStartSLURL(slurl); // updates grid if needed
-
- // remember that this is where we wanted to log in...if the login fails,
- // the next attempt will default to the same place.
- gSavedSettings.setString("NextLoginLocation", new_start);
- // following a successful login, this is cleared
- // and the default reverts to LoginLocation
- }
- else
- {
- LL_WARNS("AppInit")<<"Invalid start SLURL (ignored): "<<slurl.asString()<<LL_ENDL;
- }
+ LL_DEBUGS("AppInit")<<slurl.asString()<<LL_ENDL;
+
+ if ( slurl.isSpatial() )
+ {
+ std::string new_start = slurl.getSLURLString();
+ LL_DEBUGS("AppInit")<<new_start<<LL_ENDL;
+ sStartSLURL = slurl;
+ LLPanelLogin::onUpdateStartSLURL(slurl); // updates grid if needed
+
+ // remember that this is where we wanted to log in...if the login fails,
+ // the next attempt will default to the same place.
+ gSavedSettings.setString("NextLoginLocation", new_start);
+ // following a successful login, this is cleared
+ // and the default reverts to LoginLocation
+ }
+ else
+ {
+ LL_WARNS("AppInit")<<"Invalid start SLURL (ignored): "<<slurl.asString()<<LL_ENDL;
+ }
}
// static
LLSLURL& LLStartUp::getStartSLURL()
{
- return sStartSLURL;
-}
+ return sStartSLURL;
+}
/**
* Read all proxy configuration settings and set up both the HTTP proxy and
@@ -3185,680 +3185,680 @@ LLSLURL& LLStartUp::getStartSLURL()
*/
bool LLStartUp::startLLProxy()
{
- bool proxy_ok = true;
- std::string httpProxyType = gSavedSettings.getString("HttpProxyType");
-
- // Set up SOCKS proxy (if needed)
- if (gSavedSettings.getBOOL("Socks5ProxyEnabled"))
- {
- // Determine and update LLProxy with the saved authentication system
- std::string auth_type = gSavedSettings.getString("Socks5AuthType");
-
- if (auth_type.compare("UserPass") == 0)
- {
- LLPointer<LLCredential> socks_cred = gSecAPIHandler->loadCredential("SOCKS5");
- std::string socks_user = socks_cred->getIdentifier()["username"].asString();
- std::string socks_password = socks_cred->getAuthenticator()["creds"].asString();
-
- bool ok = LLProxy::getInstance()->setAuthPassword(socks_user, socks_password);
-
- if (!ok)
- {
- LLNotificationsUtil::add("SOCKS_BAD_CREDS");
- proxy_ok = false;
- }
- }
- else if (auth_type.compare("None") == 0)
- {
- LLProxy::getInstance()->setAuthNone();
- }
- else
- {
- LL_WARNS("Proxy") << "Invalid SOCKS 5 authentication type."<< LL_ENDL;
-
- // Unknown or missing setting.
- gSavedSettings.setString("Socks5AuthType", "None");
-
- // Clear the SOCKS credentials.
- LLPointer<LLCredential> socks_cred = new LLCredential("SOCKS5");
- gSecAPIHandler->deleteCredential(socks_cred);
-
- LLProxy::getInstance()->setAuthNone();
- }
-
- if (proxy_ok)
- {
- // Start the proxy and check for errors
- // If status != SOCKS_OK, stopSOCKSProxy() will already have been called when startSOCKSProxy() returns.
- LLHost socks_host;
- socks_host.setHostByName(gSavedSettings.getString("Socks5ProxyHost"));
- socks_host.setPort(gSavedSettings.getU32("Socks5ProxyPort"));
- int status = LLProxy::getInstance()->startSOCKSProxy(socks_host);
-
- if (status != SOCKS_OK)
- {
- LLSD subs;
- subs["HOST"] = gSavedSettings.getString("Socks5ProxyHost");
- subs["PORT"] = (S32)gSavedSettings.getU32("Socks5ProxyPort");
-
- std::string error_string;
-
- switch(status)
- {
- case SOCKS_CONNECT_ERROR: // TCP Fail
- error_string = "SOCKS_CONNECT_ERROR";
- break;
-
- case SOCKS_NOT_PERMITTED: // SOCKS 5 server rule set refused connection
- error_string = "SOCKS_NOT_PERMITTED";
- break;
-
- case SOCKS_NOT_ACCEPTABLE: // Selected authentication is not acceptable to server
- error_string = "SOCKS_NOT_ACCEPTABLE";
- break;
-
- case SOCKS_AUTH_FAIL: // Authentication failed
- error_string = "SOCKS_AUTH_FAIL";
- break;
-
- case SOCKS_UDP_FWD_NOT_GRANTED: // UDP forward request failed
- error_string = "SOCKS_UDP_FWD_NOT_GRANTED";
- break;
-
- case SOCKS_HOST_CONNECT_FAILED: // Failed to open a TCP channel to the socks server
- error_string = "SOCKS_HOST_CONNECT_FAILED";
- break;
-
- case SOCKS_INVALID_HOST: // Improperly formatted host address or port.
- error_string = "SOCKS_INVALID_HOST";
- break;
-
- default:
- error_string = "SOCKS_UNKNOWN_STATUS"; // Something strange happened,
- LL_WARNS("Proxy") << "Unknown return from LLProxy::startProxy(): " << status << LL_ENDL;
- break;
- }
-
- LLNotificationsUtil::add(error_string, subs);
- proxy_ok = false;
- }
- }
- }
- else
- {
- LLProxy::getInstance()->stopSOCKSProxy(); // ensure no UDP proxy is running and it's all cleaned up
- }
-
- if (proxy_ok)
- {
- // Determine the HTTP proxy type (if any)
- if ((httpProxyType.compare("Web") == 0) && gSavedSettings.getBOOL("BrowserProxyEnabled"))
- {
- LLHost http_host;
- http_host.setHostByName(gSavedSettings.getString("BrowserProxyAddress"));
- http_host.setPort(gSavedSettings.getS32("BrowserProxyPort"));
- if (!LLProxy::getInstance()->enableHTTPProxy(http_host, LLPROXY_HTTP))
- {
- LLSD subs;
- subs["HOST"] = http_host.getIPString();
- subs["PORT"] = (S32)http_host.getPort();
- LLNotificationsUtil::add("PROXY_INVALID_HTTP_HOST", subs);
- proxy_ok = false;
- }
- }
- else if ((httpProxyType.compare("Socks") == 0) && gSavedSettings.getBOOL("Socks5ProxyEnabled"))
- {
- LLHost socks_host;
- socks_host.setHostByName(gSavedSettings.getString("Socks5ProxyHost"));
- socks_host.setPort(gSavedSettings.getU32("Socks5ProxyPort"));
- if (!LLProxy::getInstance()->enableHTTPProxy(socks_host, LLPROXY_SOCKS))
- {
- LLSD subs;
- subs["HOST"] = socks_host.getIPString();
- subs["PORT"] = (S32)socks_host.getPort();
- LLNotificationsUtil::add("PROXY_INVALID_SOCKS_HOST", subs);
- proxy_ok = false;
- }
- }
- else if (httpProxyType.compare("None") == 0)
- {
- LLProxy::getInstance()->disableHTTPProxy();
- }
- else
- {
- LL_WARNS("Proxy") << "Invalid other HTTP proxy configuration: " << httpProxyType << LL_ENDL;
-
- // Set the missing or wrong configuration back to something valid.
- gSavedSettings.setString("HttpProxyType", "None");
- LLProxy::getInstance()->disableHTTPProxy();
-
- // Leave proxy_ok alone, since this isn't necessarily fatal.
- }
- }
-
- return proxy_ok;
+ bool proxy_ok = true;
+ std::string httpProxyType = gSavedSettings.getString("HttpProxyType");
+
+ // Set up SOCKS proxy (if needed)
+ if (gSavedSettings.getBOOL("Socks5ProxyEnabled"))
+ {
+ // Determine and update LLProxy with the saved authentication system
+ std::string auth_type = gSavedSettings.getString("Socks5AuthType");
+
+ if (auth_type.compare("UserPass") == 0)
+ {
+ LLPointer<LLCredential> socks_cred = gSecAPIHandler->loadCredential("SOCKS5");
+ std::string socks_user = socks_cred->getIdentifier()["username"].asString();
+ std::string socks_password = socks_cred->getAuthenticator()["creds"].asString();
+
+ bool ok = LLProxy::getInstance()->setAuthPassword(socks_user, socks_password);
+
+ if (!ok)
+ {
+ LLNotificationsUtil::add("SOCKS_BAD_CREDS");
+ proxy_ok = false;
+ }
+ }
+ else if (auth_type.compare("None") == 0)
+ {
+ LLProxy::getInstance()->setAuthNone();
+ }
+ else
+ {
+ LL_WARNS("Proxy") << "Invalid SOCKS 5 authentication type."<< LL_ENDL;
+
+ // Unknown or missing setting.
+ gSavedSettings.setString("Socks5AuthType", "None");
+
+ // Clear the SOCKS credentials.
+ LLPointer<LLCredential> socks_cred = new LLCredential("SOCKS5");
+ gSecAPIHandler->deleteCredential(socks_cred);
+
+ LLProxy::getInstance()->setAuthNone();
+ }
+
+ if (proxy_ok)
+ {
+ // Start the proxy and check for errors
+ // If status != SOCKS_OK, stopSOCKSProxy() will already have been called when startSOCKSProxy() returns.
+ LLHost socks_host;
+ socks_host.setHostByName(gSavedSettings.getString("Socks5ProxyHost"));
+ socks_host.setPort(gSavedSettings.getU32("Socks5ProxyPort"));
+ int status = LLProxy::getInstance()->startSOCKSProxy(socks_host);
+
+ if (status != SOCKS_OK)
+ {
+ LLSD subs;
+ subs["HOST"] = gSavedSettings.getString("Socks5ProxyHost");
+ subs["PORT"] = (S32)gSavedSettings.getU32("Socks5ProxyPort");
+
+ std::string error_string;
+
+ switch(status)
+ {
+ case SOCKS_CONNECT_ERROR: // TCP Fail
+ error_string = "SOCKS_CONNECT_ERROR";
+ break;
+
+ case SOCKS_NOT_PERMITTED: // SOCKS 5 server rule set refused connection
+ error_string = "SOCKS_NOT_PERMITTED";
+ break;
+
+ case SOCKS_NOT_ACCEPTABLE: // Selected authentication is not acceptable to server
+ error_string = "SOCKS_NOT_ACCEPTABLE";
+ break;
+
+ case SOCKS_AUTH_FAIL: // Authentication failed
+ error_string = "SOCKS_AUTH_FAIL";
+ break;
+
+ case SOCKS_UDP_FWD_NOT_GRANTED: // UDP forward request failed
+ error_string = "SOCKS_UDP_FWD_NOT_GRANTED";
+ break;
+
+ case SOCKS_HOST_CONNECT_FAILED: // Failed to open a TCP channel to the socks server
+ error_string = "SOCKS_HOST_CONNECT_FAILED";
+ break;
+
+ case SOCKS_INVALID_HOST: // Improperly formatted host address or port.
+ error_string = "SOCKS_INVALID_HOST";
+ break;
+
+ default:
+ error_string = "SOCKS_UNKNOWN_STATUS"; // Something strange happened,
+ LL_WARNS("Proxy") << "Unknown return from LLProxy::startProxy(): " << status << LL_ENDL;
+ break;
+ }
+
+ LLNotificationsUtil::add(error_string, subs);
+ proxy_ok = false;
+ }
+ }
+ }
+ else
+ {
+ LLProxy::getInstance()->stopSOCKSProxy(); // ensure no UDP proxy is running and it's all cleaned up
+ }
+
+ if (proxy_ok)
+ {
+ // Determine the HTTP proxy type (if any)
+ if ((httpProxyType.compare("Web") == 0) && gSavedSettings.getBOOL("BrowserProxyEnabled"))
+ {
+ LLHost http_host;
+ http_host.setHostByName(gSavedSettings.getString("BrowserProxyAddress"));
+ http_host.setPort(gSavedSettings.getS32("BrowserProxyPort"));
+ if (!LLProxy::getInstance()->enableHTTPProxy(http_host, LLPROXY_HTTP))
+ {
+ LLSD subs;
+ subs["HOST"] = http_host.getIPString();
+ subs["PORT"] = (S32)http_host.getPort();
+ LLNotificationsUtil::add("PROXY_INVALID_HTTP_HOST", subs);
+ proxy_ok = false;
+ }
+ }
+ else if ((httpProxyType.compare("Socks") == 0) && gSavedSettings.getBOOL("Socks5ProxyEnabled"))
+ {
+ LLHost socks_host;
+ socks_host.setHostByName(gSavedSettings.getString("Socks5ProxyHost"));
+ socks_host.setPort(gSavedSettings.getU32("Socks5ProxyPort"));
+ if (!LLProxy::getInstance()->enableHTTPProxy(socks_host, LLPROXY_SOCKS))
+ {
+ LLSD subs;
+ subs["HOST"] = socks_host.getIPString();
+ subs["PORT"] = (S32)socks_host.getPort();
+ LLNotificationsUtil::add("PROXY_INVALID_SOCKS_HOST", subs);
+ proxy_ok = false;
+ }
+ }
+ else if (httpProxyType.compare("None") == 0)
+ {
+ LLProxy::getInstance()->disableHTTPProxy();
+ }
+ else
+ {
+ LL_WARNS("Proxy") << "Invalid other HTTP proxy configuration: " << httpProxyType << LL_ENDL;
+
+ // Set the missing or wrong configuration back to something valid.
+ gSavedSettings.setString("HttpProxyType", "None");
+ LLProxy::getInstance()->disableHTTPProxy();
+
+ // Leave proxy_ok alone, since this isn't necessarily fatal.
+ }
+ }
+
+ return proxy_ok;
}
bool login_alert_done(const LLSD& notification, const LLSD& response)
{
- LLPanelLogin::giveFocus();
- return false;
+ LLPanelLogin::giveFocus();
+ return false;
}
-// parse the certificate information into args for the
+// parse the certificate information into args for the
// certificate notifications
LLSD transform_cert_args(LLPointer<LLCertificate> cert)
{
- LLSD args = LLSD::emptyMap();
- std::string value;
- LLSD cert_info;
- cert->getLLSD(cert_info);
- // convert all of the elements in the cert into
- // args for the xml dialog, so we have flexability to
- // display various parts of the cert by only modifying
- // the cert alert dialog xml.
- for(LLSD::map_iterator iter = cert_info.beginMap();
- iter != cert_info.endMap();
- iter++)
- {
- // key usage and extended key usage
- // are actually arrays, and we want to format them as comma separated
- // strings, so special case those.
- LLSDSerialize::toXML(cert_info[iter->first], std::cout);
- if((iter->first == std::string(CERT_KEY_USAGE)) ||
- (iter->first == std::string(CERT_EXTENDED_KEY_USAGE)))
- {
- value = "";
- LLSD usage = cert_info[iter->first];
- for (LLSD::array_iterator usage_iter = usage.beginArray();
- usage_iter != usage.endArray();
- usage_iter++)
- {
-
- if(usage_iter != usage.beginArray())
- {
- value += ", ";
- }
-
- value += (*usage_iter).asString();
- }
-
- }
- else
- {
- value = iter->second.asString();
- }
-
- std::string name = iter->first;
- std::transform(name.begin(), name.end(), name.begin(),
- (int(*)(int))toupper);
- args[name.c_str()] = value;
- }
- return args;
+ LLSD args = LLSD::emptyMap();
+ std::string value;
+ LLSD cert_info;
+ cert->getLLSD(cert_info);
+ // convert all of the elements in the cert into
+ // args for the xml dialog, so we have flexability to
+ // display various parts of the cert by only modifying
+ // the cert alert dialog xml.
+ for(LLSD::map_iterator iter = cert_info.beginMap();
+ iter != cert_info.endMap();
+ iter++)
+ {
+ // key usage and extended key usage
+ // are actually arrays, and we want to format them as comma separated
+ // strings, so special case those.
+ LLSDSerialize::toXML(cert_info[iter->first], std::cout);
+ if((iter->first == std::string(CERT_KEY_USAGE)) ||
+ (iter->first == std::string(CERT_EXTENDED_KEY_USAGE)))
+ {
+ value = "";
+ LLSD usage = cert_info[iter->first];
+ for (LLSD::array_iterator usage_iter = usage.beginArray();
+ usage_iter != usage.endArray();
+ usage_iter++)
+ {
+
+ if(usage_iter != usage.beginArray())
+ {
+ value += ", ";
+ }
+
+ value += (*usage_iter).asString();
+ }
+
+ }
+ else
+ {
+ value = iter->second.asString();
+ }
+
+ std::string name = iter->first;
+ std::transform(name.begin(), name.end(), name.begin(),
+ (int(*)(int))toupper);
+ args[name.c_str()] = value;
+ }
+ return args;
}
// when we handle a cert error, give focus back to the login panel
void general_cert_done(const LLSD& notification, const LLSD& response)
{
- LLStartUp::setStartupState( STATE_LOGIN_SHOW );
- LLPanelLogin::giveFocus();
+ LLStartUp::setStartupState( STATE_LOGIN_SHOW );
+ LLPanelLogin::giveFocus();
}
// check to see if the user wants to trust the cert.
-// if they do, add it to the cert store and
+// if they do, add it to the cert store and
void trust_cert_done(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
- switch(option)
- {
- case OPT_TRUST_CERT:
- {
- LLPointer<LLCertificate> cert = gSecAPIHandler->getCertificate(notification["payload"]["certificate"]);
- LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(gSavedSettings.getString("CertStore"));
- store->add(cert);
- store->save();
- LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
- break;
- }
- case OPT_CANCEL_TRUST:
- reset_login();
- gSavedSettings.setBOOL("AutoLogin", FALSE);
- LLStartUp::setStartupState( STATE_LOGIN_SHOW );
- default:
- LLPanelLogin::giveFocus();
- break;
- }
+ S32 option = LLNotification::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case OPT_TRUST_CERT:
+ {
+ LLPointer<LLCertificate> cert = gSecAPIHandler->getCertificate(notification["payload"]["certificate"]);
+ LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(gSavedSettings.getString("CertStore"));
+ store->add(cert);
+ store->save();
+ LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+ break;
+ }
+ case OPT_CANCEL_TRUST:
+ reset_login();
+ gSavedSettings.setBOOL("AutoLogin", FALSE);
+ LLStartUp::setStartupState( STATE_LOGIN_SHOW );
+ default:
+ LLPanelLogin::giveFocus();
+ break;
+ }
}
void apply_udp_blacklist(const std::string& csv)
{
- std::string::size_type start = 0;
- std::string::size_type comma = 0;
- do
- {
- comma = csv.find(",", start);
- if (comma == std::string::npos)
- {
- comma = csv.length();
- }
- std::string item(csv, start, comma-start);
-
- LL_DEBUGS() << "udp_blacklist " << item << LL_ENDL;
- gMessageSystem->banUdpMessage(item);
-
- start = comma + 1;
-
- }
- while(comma < csv.length());
-
+ std::string::size_type start = 0;
+ std::string::size_type comma = 0;
+ do
+ {
+ comma = csv.find(",", start);
+ if (comma == std::string::npos)
+ {
+ comma = csv.length();
+ }
+ std::string item(csv, start, comma-start);
+
+ LL_DEBUGS() << "udp_blacklist " << item << LL_ENDL;
+ gMessageSystem->banUdpMessage(item);
+
+ start = comma + 1;
+
+ }
+ while(comma < csv.length());
+
}
void on_benefits_failed_callback(const LLSD& notification, const LLSD& response)
{
- LL_WARNS("Benefits") << "Failed to load benefits information" << LL_ENDL;
+ LL_WARNS("Benefits") << "Failed to load benefits information" << LL_ENDL;
}
bool init_benefits(LLSD& response)
{
- bool succ = true;
-
- std::string package_name = response["account_type"].asString();
- const LLSD& benefits_sd = response["account_level_benefits"];
- if (!LLAgentBenefitsMgr::init(package_name, benefits_sd) ||
- !LLAgentBenefitsMgr::initCurrent(package_name, benefits_sd))
- {
- succ = false;
- }
- else
- {
- LL_DEBUGS("Benefits") << "Initialized current benefits, level " << package_name << " from " << benefits_sd << LL_ENDL;
- }
- const LLSD& packages_sd = response["premium_packages"];
- for(LLSD::map_const_iterator package_iter = packages_sd.beginMap();
- package_iter != packages_sd.endMap();
- ++package_iter)
- {
- std::string package_name = package_iter->first;
- const LLSD& benefits_sd = package_iter->second["benefits"];
- if (LLAgentBenefitsMgr::init(package_name, benefits_sd))
- {
- LL_DEBUGS("Benefits") << "Initialized benefits for package " << package_name << " from " << benefits_sd << LL_ENDL;
- }
- else
- {
- LL_WARNS("Benefits") << "Failed init for package " << package_name << " from " << benefits_sd << LL_ENDL;
- succ = false;
- }
- }
-
- if (!LLAgentBenefitsMgr::has("Base"))
- {
- LL_WARNS("Benefits") << "Benefits info did not include required package Base" << LL_ENDL;
- succ = false;
- }
- if (!LLAgentBenefitsMgr::has("Premium"))
- {
- LL_WARNS("Benefits") << "Benefits info did not include required package Premium" << LL_ENDL;
- succ = false;
- }
-
- return succ;
+ bool succ = true;
+
+ std::string package_name = response["account_type"].asString();
+ const LLSD& benefits_sd = response["account_level_benefits"];
+ if (!LLAgentBenefitsMgr::init(package_name, benefits_sd) ||
+ !LLAgentBenefitsMgr::initCurrent(package_name, benefits_sd))
+ {
+ succ = false;
+ }
+ else
+ {
+ LL_DEBUGS("Benefits") << "Initialized current benefits, level " << package_name << " from " << benefits_sd << LL_ENDL;
+ }
+ const LLSD& packages_sd = response["premium_packages"];
+ for(LLSD::map_const_iterator package_iter = packages_sd.beginMap();
+ package_iter != packages_sd.endMap();
+ ++package_iter)
+ {
+ std::string package_name = package_iter->first;
+ const LLSD& benefits_sd = package_iter->second["benefits"];
+ if (LLAgentBenefitsMgr::init(package_name, benefits_sd))
+ {
+ LL_DEBUGS("Benefits") << "Initialized benefits for package " << package_name << " from " << benefits_sd << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Benefits") << "Failed init for package " << package_name << " from " << benefits_sd << LL_ENDL;
+ succ = false;
+ }
+ }
+
+ if (!LLAgentBenefitsMgr::has("Base"))
+ {
+ LL_WARNS("Benefits") << "Benefits info did not include required package Base" << LL_ENDL;
+ succ = false;
+ }
+ if (!LLAgentBenefitsMgr::has("Premium"))
+ {
+ LL_WARNS("Benefits") << "Benefits info did not include required package Premium" << LL_ENDL;
+ succ = false;
+ }
+
+ return succ;
}
bool process_login_success_response()
{
- LLSD response = LLLoginInstance::getInstance()->getResponse();
-
- mBenefitsSuccessfullyInit = init_benefits(response);
-
- std::string text(response["udp_blacklist"]);
- if(!text.empty())
- {
- apply_udp_blacklist(text);
- }
-
- // unpack login data needed by the application
- text = response["agent_id"].asString();
- if(!text.empty()) gAgentID.set(text);
- gDebugInfo["AgentID"] = text;
-
- LLPerfStats::StatsRecorder::setEnabled(gSavedSettings.getBOOL("PerfStatsCaptureEnabled"));
- LLPerfStats::StatsRecorder::setFocusAv(gAgentID);
-
- // Agent id needed for parcel info request in LLUrlEntryParcel
- // to resolve parcel name.
- LLUrlEntryParcel::setAgentID(gAgentID);
-
- text = response["session_id"].asString();
- if(!text.empty()) gAgentSessionID.set(text);
- gDebugInfo["SessionID"] = text;
-
- // Session id needed for parcel info request in LLUrlEntryParcel
- // to resolve parcel name.
- LLUrlEntryParcel::setSessionID(gAgentSessionID);
-
- text = response["secure_session_id"].asString();
- if(!text.empty()) gAgent.mSecureSessionID.set(text);
-
- // if the response contains a display name, use that,
- // otherwise if the response contains a first and/or last name,
- // use those. Otherwise use the credential identifier
-
- gDisplayName = "";
- if (response.has("display_name"))
- {
- gDisplayName.assign(response["display_name"].asString());
- if(!gDisplayName.empty())
- {
- // Remove quotes from string. Login.cgi sends these to force
- // names that look like numbers into strings.
- LLStringUtil::replaceChar(gDisplayName, '"', ' ');
- LLStringUtil::trim(gDisplayName);
- }
- }
- std::string first_name;
- if(response.has("first_name"))
- {
- first_name = response["first_name"].asString();
- LLStringUtil::replaceChar(first_name, '"', ' ');
- LLStringUtil::trim(first_name);
- gAgentUsername = first_name;
- }
-
- if(response.has("last_name") && !gAgentUsername.empty())
- {
- std::string last_name = response["last_name"].asString();
- if (last_name != "Resident")
- {
- LLStringUtil::replaceChar(last_name, '"', ' ');
- LLStringUtil::trim(last_name);
- gAgentUsername = gAgentUsername + " " + last_name;
- }
- }
-
- if(gDisplayName.empty())
- {
- if(response.has("first_name"))
- {
- gDisplayName.assign(response["first_name"].asString());
- LLStringUtil::replaceChar(gDisplayName, '"', ' ');
- LLStringUtil::trim(gDisplayName);
- }
- if(response.has("last_name"))
- {
- text.assign(response["last_name"].asString());
- LLStringUtil::replaceChar(text, '"', ' ');
- LLStringUtil::trim(text);
- if(!gDisplayName.empty())
- {
- gDisplayName += " ";
- }
- gDisplayName += text;
- }
- }
-
- if(gDisplayName.empty())
- {
- gDisplayName.assign(gUserCredential->asString());
- }
-
- // this is their actual ability to access content
- text = response["agent_access_max"].asString();
- if (!text.empty())
- {
- // agent_access can be 'A', 'M', and 'PG'.
- gAgent.setMaturity(text[0]);
- }
-
- // this is the value of their preference setting for that content
- // which will always be <= agent_access_max
- text = response["agent_region_access"].asString();
- if (!text.empty())
- {
- U32 preferredMaturity = (U32)LLAgent::convertTextToMaturity(text[0]);
-
- gSavedSettings.setU32("PreferredMaturity", preferredMaturity);
- }
-
- text = response["start_location"].asString();
- if(!text.empty())
- {
- gAgentStartLocation.assign(text);
- }
-
- text = response["circuit_code"].asString();
- if(!text.empty())
- {
- gMessageSystem->mOurCircuitCode = strtoul(text.c_str(), NULL, 10);
- }
- std::string sim_ip_str = response["sim_ip"];
- std::string sim_port_str = response["sim_port"];
- if(!sim_ip_str.empty() && !sim_port_str.empty())
- {
- U32 sim_port = strtoul(sim_port_str.c_str(), NULL, 10);
- gFirstSim.set(sim_ip_str, sim_port);
- if (gFirstSim.isOk())
- {
- gMessageSystem->enableCircuit(gFirstSim, TRUE);
- }
- }
- std::string region_x_str = response["region_x"];
- std::string region_y_str = response["region_y"];
- if(!region_x_str.empty() && !region_y_str.empty())
- {
- U32 region_x = strtoul(region_x_str.c_str(), NULL, 10);
- U32 region_y = strtoul(region_y_str.c_str(), NULL, 10);
- gFirstSimHandle = to_region_handle(region_x, region_y);
- }
-
- const std::string look_at_str = response["look_at"];
- if (!look_at_str.empty())
- {
- size_t len = look_at_str.size();
- LLMemoryStream mstr((U8*)look_at_str.c_str(), len);
- LLSD sd = LLSDSerialize::fromNotation(mstr, len);
- gAgentStartLookAt = ll_vector3_from_sd(sd);
- }
-
- text = response["seed_capability"].asString();
- if (!text.empty()) gFirstSimSeedCap = text;
-
- text = response["seconds_since_epoch"].asString();
- if(!text.empty())
- {
- U32 server_utc_time = strtoul(text.c_str(), NULL, 10);
- if(server_utc_time)
- {
- time_t now = time(NULL);
- gUTCOffset = (server_utc_time - now);
-
- // Print server timestamp
- LLSD substitution;
- substitution["datetime"] = (S32)server_utc_time;
- std::string timeStr = "[month, datetime, slt] [day, datetime, slt] [year, datetime, slt] [hour, datetime, slt]:[min, datetime, slt]:[second, datetime, slt]";
- LLStringUtil::format(timeStr, substitution);
- LL_INFOS("AppInit") << "Server SLT timestamp: " << timeStr << ". Server-viewer time offset before correction: " << gUTCOffset << "s" << LL_ENDL;
- }
- }
-
- // this is the base used to construct help URLs
- text = response["help_url_format"].asString();
- if (!text.empty())
- {
- // replace the default help URL format
- gSavedSettings.setString("HelpURLFormat",text);
- }
-
- std::string home_location = response["home"];
- if(!home_location.empty())
- {
- size_t len = home_location.size();
- LLMemoryStream mstr((U8*)home_location.c_str(), len);
- LLSD sd = LLSDSerialize::fromNotation(mstr, len);
- S32 region_x = sd["region_handle"][0].asInteger();
- S32 region_y = sd["region_handle"][1].asInteger();
- U64 region_handle = to_region_handle(region_x, region_y);
- LLVector3 position = ll_vector3_from_sd(sd["position"]);
- gAgent.setHomePosRegion(region_handle, position);
- }
-
- gAgent.mMOTD.assign(response["message"]);
-
- // Options...
- // Each 'option' is an array of submaps.
- // It appears that we only ever use the first element of the array.
- LLUUID inv_root_folder_id = response["inventory-root"][0]["folder_id"];
- if(inv_root_folder_id.notNull())
- {
- gInventory.setRootFolderID(inv_root_folder_id);
- //gInventory.mock(gAgent.getInventoryRootID());
- }
-
- LLSD login_flags = response["login-flags"][0];
- if(login_flags.size())
- {
- std::string flag = login_flags["ever_logged_in"];
- if(!flag.empty())
- {
- gAgent.setFirstLogin(flag == "N");
- }
-
- /* Flag is currently ignored by the viewer.
- flag = login_flags["stipend_since_login"];
- if(flag == "Y")
- {
- stipend_since_login = true;
- }
- */
-
- flag = login_flags["gendered"].asString();
- if(flag == "Y")
- {
- // We don't care about this flag anymore; now base whether
- // outfit is chosen on COF contents, initial outfit
- // requested and available, etc.
-
- //gAgent.setGenderChosen(TRUE);
- }
-
- bool pacific_daylight_time = false;
- flag = login_flags["daylight_savings"].asString();
- if(flag == "Y")
- {
- pacific_daylight_time = (flag == "Y");
- }
-
- //setup map of datetime strings to codes and slt & local time offset from utc
- LLStringOps::setupDatetimeInfo(pacific_daylight_time);
- }
-
- // set up the voice configuration. Ultimately, we should pass this up as part of each voice
- // channel if we need to move to multiple voice servers per grid.
- LLSD voice_config_info = response["voice-config"];
- if(voice_config_info.has("VoiceServerType"))
- {
- gSavedSettings.setString("VoiceServerType", voice_config_info["VoiceServerType"].asString());
- }
-
- // Request the map server url
- std::string map_server_url = response["map-server-url"];
- if(!map_server_url.empty())
- {
- // We got an answer from the grid -> use that for map for the current session
- gSavedSettings.setString("CurrentMapServerURL", map_server_url);
- LL_INFOS("LLStartup") << "map-server-url : we got an answer from the grid : " << map_server_url << LL_ENDL;
- }
- else
- {
- // No answer from the grid -> use the default setting for current session
- map_server_url = gSavedSettings.getString("MapServerURL");
- gSavedSettings.setString("CurrentMapServerURL", map_server_url);
- LL_INFOS("LLStartup") << "map-server-url : no map-server-url answer, we use the default setting for the map : " << map_server_url << LL_ENDL;
- }
-
- // Default male and female avatars allowing the user to choose their avatar on first login.
- // These may be passed up by SLE to allow choice of enterprise avatars instead of the standard
- // "new ruth." Not to be confused with 'initial-outfit' below
- LLSD newuser_config = response["newuser-config"][0];
- if(newuser_config.has("DefaultFemaleAvatar"))
- {
- gSavedSettings.setString("DefaultFemaleAvatar", newuser_config["DefaultFemaleAvatar"].asString());
- }
- if(newuser_config.has("DefaultMaleAvatar"))
- {
- gSavedSettings.setString("DefaultMaleAvatar", newuser_config["DefaultMaleAvatar"].asString());
- }
-
- // Initial outfit for the user.
- LLSD initial_outfit = response["initial-outfit"][0];
- if(initial_outfit.size())
- {
- std::string flag = initial_outfit["folder_name"];
- if(!flag.empty())
- {
- // Initial outfit is a folder in your inventory,
- // must be an exact folder-name match.
- sInitialOutfit = flag;
- }
-
- flag = initial_outfit["gender"].asString();
- if(!flag.empty())
- {
- sInitialOutfitGender = flag;
- }
- }
-
- std::string fake_initial_outfit_name = gSavedSettings.getString("FakeInitialOutfitName");
- if (!fake_initial_outfit_name.empty())
- {
- gAgent.setFirstLogin(true);
- sInitialOutfit = fake_initial_outfit_name;
- if (sInitialOutfitGender.empty())
- {
- sInitialOutfitGender = "female"; // just guess, will get overridden when outfit is worn anyway.
- }
-
- LL_WARNS() << "Faking first-time login with initial outfit " << sInitialOutfit << LL_ENDL;
- }
-
- // set the location of the Agent Appearance service, from which we can request
- // avatar baked textures if they are supported by the current region
- std::string agent_appearance_url = response["agent_appearance_service"];
- if (!agent_appearance_url.empty())
- {
- LLAppearanceMgr::instance().setAppearanceServiceURL(agent_appearance_url);
- }
-
- // Set the location of the snapshot sharing config endpoint
- std::string snapshot_config_url = response["snapshot_config_url"];
- if(!snapshot_config_url.empty())
- {
- gSavedSettings.setString("SnapshotConfigURL", snapshot_config_url);
- }
-
- // Start the process of fetching the OpenID session cookie for this user login
- std::string openid_url = response["openid_url"];
- if(!openid_url.empty())
- {
- std::string openid_token = response["openid_token"];
- LLViewerMedia::getInstance()->openIDSetup(openid_url, openid_token);
- }
-
-
- // Only save mfa_hash for future logins if the user wants their info remembered.
- if(response.has("mfa_hash")
+ LLSD response = LLLoginInstance::getInstance()->getResponse();
+
+ mBenefitsSuccessfullyInit = init_benefits(response);
+
+ std::string text(response["udp_blacklist"]);
+ if(!text.empty())
+ {
+ apply_udp_blacklist(text);
+ }
+
+ // unpack login data needed by the application
+ text = response["agent_id"].asString();
+ if(!text.empty()) gAgentID.set(text);
+ gDebugInfo["AgentID"] = text;
+
+ LLPerfStats::StatsRecorder::setEnabled(gSavedSettings.getBOOL("PerfStatsCaptureEnabled"));
+ LLPerfStats::StatsRecorder::setFocusAv(gAgentID);
+
+ // Agent id needed for parcel info request in LLUrlEntryParcel
+ // to resolve parcel name.
+ LLUrlEntryParcel::setAgentID(gAgentID);
+
+ text = response["session_id"].asString();
+ if(!text.empty()) gAgentSessionID.set(text);
+ gDebugInfo["SessionID"] = text;
+
+ // Session id needed for parcel info request in LLUrlEntryParcel
+ // to resolve parcel name.
+ LLUrlEntryParcel::setSessionID(gAgentSessionID);
+
+ text = response["secure_session_id"].asString();
+ if(!text.empty()) gAgent.mSecureSessionID.set(text);
+
+ // if the response contains a display name, use that,
+ // otherwise if the response contains a first and/or last name,
+ // use those. Otherwise use the credential identifier
+
+ gDisplayName = "";
+ if (response.has("display_name"))
+ {
+ gDisplayName.assign(response["display_name"].asString());
+ if(!gDisplayName.empty())
+ {
+ // Remove quotes from string. Login.cgi sends these to force
+ // names that look like numbers into strings.
+ LLStringUtil::replaceChar(gDisplayName, '"', ' ');
+ LLStringUtil::trim(gDisplayName);
+ }
+ }
+ std::string first_name;
+ if(response.has("first_name"))
+ {
+ first_name = response["first_name"].asString();
+ LLStringUtil::replaceChar(first_name, '"', ' ');
+ LLStringUtil::trim(first_name);
+ gAgentUsername = first_name;
+ }
+
+ if(response.has("last_name") && !gAgentUsername.empty())
+ {
+ std::string last_name = response["last_name"].asString();
+ if (last_name != "Resident")
+ {
+ LLStringUtil::replaceChar(last_name, '"', ' ');
+ LLStringUtil::trim(last_name);
+ gAgentUsername = gAgentUsername + " " + last_name;
+ }
+ }
+
+ if(gDisplayName.empty())
+ {
+ if(response.has("first_name"))
+ {
+ gDisplayName.assign(response["first_name"].asString());
+ LLStringUtil::replaceChar(gDisplayName, '"', ' ');
+ LLStringUtil::trim(gDisplayName);
+ }
+ if(response.has("last_name"))
+ {
+ text.assign(response["last_name"].asString());
+ LLStringUtil::replaceChar(text, '"', ' ');
+ LLStringUtil::trim(text);
+ if(!gDisplayName.empty())
+ {
+ gDisplayName += " ";
+ }
+ gDisplayName += text;
+ }
+ }
+
+ if(gDisplayName.empty())
+ {
+ gDisplayName.assign(gUserCredential->asString());
+ }
+
+ // this is their actual ability to access content
+ text = response["agent_access_max"].asString();
+ if (!text.empty())
+ {
+ // agent_access can be 'A', 'M', and 'PG'.
+ gAgent.setMaturity(text[0]);
+ }
+
+ // this is the value of their preference setting for that content
+ // which will always be <= agent_access_max
+ text = response["agent_region_access"].asString();
+ if (!text.empty())
+ {
+ U32 preferredMaturity = (U32)LLAgent::convertTextToMaturity(text[0]);
+
+ gSavedSettings.setU32("PreferredMaturity", preferredMaturity);
+ }
+
+ text = response["start_location"].asString();
+ if(!text.empty())
+ {
+ gAgentStartLocation.assign(text);
+ }
+
+ text = response["circuit_code"].asString();
+ if(!text.empty())
+ {
+ gMessageSystem->mOurCircuitCode = strtoul(text.c_str(), NULL, 10);
+ }
+ std::string sim_ip_str = response["sim_ip"];
+ std::string sim_port_str = response["sim_port"];
+ if(!sim_ip_str.empty() && !sim_port_str.empty())
+ {
+ U32 sim_port = strtoul(sim_port_str.c_str(), NULL, 10);
+ gFirstSim.set(sim_ip_str, sim_port);
+ if (gFirstSim.isOk())
+ {
+ gMessageSystem->enableCircuit(gFirstSim, TRUE);
+ }
+ }
+ std::string region_x_str = response["region_x"];
+ std::string region_y_str = response["region_y"];
+ if(!region_x_str.empty() && !region_y_str.empty())
+ {
+ U32 region_x = strtoul(region_x_str.c_str(), NULL, 10);
+ U32 region_y = strtoul(region_y_str.c_str(), NULL, 10);
+ gFirstSimHandle = to_region_handle(region_x, region_y);
+ }
+
+ const std::string look_at_str = response["look_at"];
+ if (!look_at_str.empty())
+ {
+ size_t len = look_at_str.size();
+ LLMemoryStream mstr((U8*)look_at_str.c_str(), len);
+ LLSD sd = LLSDSerialize::fromNotation(mstr, len);
+ gAgentStartLookAt = ll_vector3_from_sd(sd);
+ }
+
+ text = response["seed_capability"].asString();
+ if (!text.empty()) gFirstSimSeedCap = text;
+
+ text = response["seconds_since_epoch"].asString();
+ if(!text.empty())
+ {
+ U32 server_utc_time = strtoul(text.c_str(), NULL, 10);
+ if(server_utc_time)
+ {
+ time_t now = time(NULL);
+ gUTCOffset = (server_utc_time - now);
+
+ // Print server timestamp
+ LLSD substitution;
+ substitution["datetime"] = (S32)server_utc_time;
+ std::string timeStr = "[month, datetime, slt] [day, datetime, slt] [year, datetime, slt] [hour, datetime, slt]:[min, datetime, slt]:[second, datetime, slt]";
+ LLStringUtil::format(timeStr, substitution);
+ LL_INFOS("AppInit") << "Server SLT timestamp: " << timeStr << ". Server-viewer time offset before correction: " << gUTCOffset << "s" << LL_ENDL;
+ }
+ }
+
+ // this is the base used to construct help URLs
+ text = response["help_url_format"].asString();
+ if (!text.empty())
+ {
+ // replace the default help URL format
+ gSavedSettings.setString("HelpURLFormat",text);
+ }
+
+ std::string home_location = response["home"];
+ if(!home_location.empty())
+ {
+ size_t len = home_location.size();
+ LLMemoryStream mstr((U8*)home_location.c_str(), len);
+ LLSD sd = LLSDSerialize::fromNotation(mstr, len);
+ S32 region_x = sd["region_handle"][0].asInteger();
+ S32 region_y = sd["region_handle"][1].asInteger();
+ U64 region_handle = to_region_handle(region_x, region_y);
+ LLVector3 position = ll_vector3_from_sd(sd["position"]);
+ gAgent.setHomePosRegion(region_handle, position);
+ }
+
+ gAgent.mMOTD.assign(response["message"]);
+
+ // Options...
+ // Each 'option' is an array of submaps.
+ // It appears that we only ever use the first element of the array.
+ LLUUID inv_root_folder_id = response["inventory-root"][0]["folder_id"];
+ if(inv_root_folder_id.notNull())
+ {
+ gInventory.setRootFolderID(inv_root_folder_id);
+ //gInventory.mock(gAgent.getInventoryRootID());
+ }
+
+ LLSD login_flags = response["login-flags"][0];
+ if(login_flags.size())
+ {
+ std::string flag = login_flags["ever_logged_in"];
+ if(!flag.empty())
+ {
+ gAgent.setFirstLogin(flag == "N");
+ }
+
+ /* Flag is currently ignored by the viewer.
+ flag = login_flags["stipend_since_login"];
+ if(flag == "Y")
+ {
+ stipend_since_login = true;
+ }
+ */
+
+ flag = login_flags["gendered"].asString();
+ if(flag == "Y")
+ {
+ // We don't care about this flag anymore; now base whether
+ // outfit is chosen on COF contents, initial outfit
+ // requested and available, etc.
+
+ //gAgent.setGenderChosen(TRUE);
+ }
+
+ bool pacific_daylight_time = false;
+ flag = login_flags["daylight_savings"].asString();
+ if(flag == "Y")
+ {
+ pacific_daylight_time = (flag == "Y");
+ }
+
+ //setup map of datetime strings to codes and slt & local time offset from utc
+ LLStringOps::setupDatetimeInfo(pacific_daylight_time);
+ }
+
+ // set up the voice configuration. Ultimately, we should pass this up as part of each voice
+ // channel if we need to move to multiple voice servers per grid.
+ LLSD voice_config_info = response["voice-config"];
+ if(voice_config_info.has("VoiceServerType"))
+ {
+ gSavedSettings.setString("VoiceServerType", voice_config_info["VoiceServerType"].asString());
+ }
+
+ // Request the map server url
+ std::string map_server_url = response["map-server-url"];
+ if(!map_server_url.empty())
+ {
+ // We got an answer from the grid -> use that for map for the current session
+ gSavedSettings.setString("CurrentMapServerURL", map_server_url);
+ LL_INFOS("LLStartup") << "map-server-url : we got an answer from the grid : " << map_server_url << LL_ENDL;
+ }
+ else
+ {
+ // No answer from the grid -> use the default setting for current session
+ map_server_url = gSavedSettings.getString("MapServerURL");
+ gSavedSettings.setString("CurrentMapServerURL", map_server_url);
+ LL_INFOS("LLStartup") << "map-server-url : no map-server-url answer, we use the default setting for the map : " << map_server_url << LL_ENDL;
+ }
+
+ // Default male and female avatars allowing the user to choose their avatar on first login.
+ // These may be passed up by SLE to allow choice of enterprise avatars instead of the standard
+ // "new ruth." Not to be confused with 'initial-outfit' below
+ LLSD newuser_config = response["newuser-config"][0];
+ if(newuser_config.has("DefaultFemaleAvatar"))
+ {
+ gSavedSettings.setString("DefaultFemaleAvatar", newuser_config["DefaultFemaleAvatar"].asString());
+ }
+ if(newuser_config.has("DefaultMaleAvatar"))
+ {
+ gSavedSettings.setString("DefaultMaleAvatar", newuser_config["DefaultMaleAvatar"].asString());
+ }
+
+ // Initial outfit for the user.
+ LLSD initial_outfit = response["initial-outfit"][0];
+ if(initial_outfit.size())
+ {
+ std::string flag = initial_outfit["folder_name"];
+ if(!flag.empty())
+ {
+ // Initial outfit is a folder in your inventory,
+ // must be an exact folder-name match.
+ sInitialOutfit = flag;
+ }
+
+ flag = initial_outfit["gender"].asString();
+ if(!flag.empty())
+ {
+ sInitialOutfitGender = flag;
+ }
+ }
+
+ std::string fake_initial_outfit_name = gSavedSettings.getString("FakeInitialOutfitName");
+ if (!fake_initial_outfit_name.empty())
+ {
+ gAgent.setFirstLogin(true);
+ sInitialOutfit = fake_initial_outfit_name;
+ if (sInitialOutfitGender.empty())
+ {
+ sInitialOutfitGender = "female"; // just guess, will get overridden when outfit is worn anyway.
+ }
+
+ LL_WARNS() << "Faking first-time login with initial outfit " << sInitialOutfit << LL_ENDL;
+ }
+
+ // set the location of the Agent Appearance service, from which we can request
+ // avatar baked textures if they are supported by the current region
+ std::string agent_appearance_url = response["agent_appearance_service"];
+ if (!agent_appearance_url.empty())
+ {
+ LLAppearanceMgr::instance().setAppearanceServiceURL(agent_appearance_url);
+ }
+
+ // Set the location of the snapshot sharing config endpoint
+ std::string snapshot_config_url = response["snapshot_config_url"];
+ if(!snapshot_config_url.empty())
+ {
+ gSavedSettings.setString("SnapshotConfigURL", snapshot_config_url);
+ }
+
+ // Start the process of fetching the OpenID session cookie for this user login
+ std::string openid_url = response["openid_url"];
+ if(!openid_url.empty())
+ {
+ std::string openid_token = response["openid_token"];
+ LLViewerMedia::getInstance()->openIDSetup(openid_url, openid_token);
+ }
+
+
+ // Only save mfa_hash for future logins if the user wants their info remembered.
+ if(response.has("mfa_hash")
&& gSavedSettings.getBOOL("RememberUser")
&& LLLoginInstance::getInstance()->saveMFA())
- {
- std::string grid(LLGridManager::getInstance()->getGridId());
- std::string user_id(gUserCredential->userID());
- gSecAPIHandler->addToProtectedMap("mfa_hash", grid, user_id, response["mfa_hash"]);
- // TODO(brad) - related to SL-17223 consider building a better interface that sync's automatically
- gSecAPIHandler->syncProtectedMap();
- }
+ {
+ std::string grid(LLGridManager::getInstance()->getGridId());
+ std::string user_id(gUserCredential->userID());
+ gSecAPIHandler->addToProtectedMap("mfa_hash", grid, user_id, response["mfa_hash"]);
+ // TODO(brad) - related to SL-17223 consider building a better interface that sync's automatically
+ gSecAPIHandler->syncProtectedMap();
+ }
else if (!LLLoginInstance::getInstance()->saveMFA())
{
std::string grid(LLGridManager::getInstance()->getGridId());
@@ -3867,26 +3867,26 @@ bool process_login_success_response()
gSecAPIHandler->syncProtectedMap();
}
- bool success = false;
- // JC: gesture loading done below, when we have an asset system
- // in place. Don't delete/clear gUserCredentials until then.
- if(gAgentID.notNull()
- && gAgentSessionID.notNull()
- && gMessageSystem->mOurCircuitCode
- && gFirstSim.isOk()
- && gInventory.getRootFolderID().notNull())
- {
- success = true;
- }
+ bool success = false;
+ // JC: gesture loading done below, when we have an asset system
+ // in place. Don't delete/clear gUserCredentials until then.
+ if(gAgentID.notNull()
+ && gAgentSessionID.notNull()
+ && gMessageSystem->mOurCircuitCode
+ && gFirstSim.isOk()
+ && gInventory.getRootFolderID().notNull())
+ {
+ success = true;
+ }
LLAppViewer* pApp = LLAppViewer::instance();
- pApp->writeDebugInfo(); //Write our static data now that we have username, session_id, etc.
- return success;
+ pApp->writeDebugInfo(); //Write our static data now that we have username, session_id, etc.
+ return success;
}
void transition_back_to_login_panel(const std::string& emsg)
{
- // Bounce back to the login screen.
- reset_login(); // calls LLStartUp::setStartupState( STATE_LOGIN_SHOW );
- gSavedSettings.setBOOL("AutoLogin", FALSE);
+ // Bounce back to the login screen.
+ reset_login(); // calls LLStartUp::setStartupState( STATE_LOGIN_SHOW );
+ gSavedSettings.setBOOL("AutoLogin", FALSE);
}
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index b55b86dd91..a827fbc487 100644
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llstartup.h
* @brief startup routines and logic declaration
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,41 +45,41 @@ void pump_idle_startup_network();
// start location constants
enum EStartLocation
{
- START_LOCATION_ID_LAST,
- START_LOCATION_ID_HOME,
- START_LOCATION_ID_DIRECT,
- START_LOCATION_ID_PARCEL,
- START_LOCATION_ID_TELEHUB,
- START_LOCATION_ID_URL,
- START_LOCATION_ID_COUNT
+ START_LOCATION_ID_LAST,
+ START_LOCATION_ID_HOME,
+ START_LOCATION_ID_DIRECT,
+ START_LOCATION_ID_PARCEL,
+ START_LOCATION_ID_TELEHUB,
+ START_LOCATION_ID_URL,
+ START_LOCATION_ID_COUNT
};
typedef enum {
- STATE_FIRST, // Initial startup
- STATE_BROWSER_INIT, // Initialize web browser for login screen
- STATE_LOGIN_SHOW, // Show login screen
- STATE_LOGIN_WAIT, // Wait for user input at login screen
- STATE_LOGIN_CLEANUP, // Get rid of login screen and start login
- STATE_LOGIN_AUTH_INIT, // Start login to SL servers
- STATE_LOGIN_CURL_UNSTUCK, // Update progress to remove "SL appears frozen" msg.
- STATE_LOGIN_PROCESS_RESPONSE, // Check authentication reply
- STATE_WORLD_INIT, // Start building the world
- STATE_MULTIMEDIA_INIT, // Init the rest of multimedia library
- STATE_FONT_INIT, // Load default fonts
- STATE_SEED_GRANTED_WAIT, // Wait for seed cap grant
- STATE_SEED_CAP_GRANTED, // Have seed cap grant
- STATE_WORLD_WAIT, // Waiting for simulator
- STATE_AGENT_SEND, // Connect to a region
- STATE_AGENT_WAIT, // Wait for region
- STATE_INVENTORY_SEND, // Do inventory transfer
- STATE_INVENTORY_CALLBACKS, // Wait for missing system folders and register callbacks
- STATE_INVENTORY_SKEL, // Do more inventory skeleton loading
- STATE_INVENTORY_SEND2, // Do more inventory init after skeleton is loaded
- STATE_MISC, // Do more things (set bandwidth, start audio, save location, etc)
- STATE_PRECACHE, // Wait a bit for textures to download
- STATE_WEARABLES_WAIT, // Wait for clothing to download
- STATE_CLEANUP, // Final cleanup
- STATE_STARTED // Up and running in-world
+ STATE_FIRST, // Initial startup
+ STATE_BROWSER_INIT, // Initialize web browser for login screen
+ STATE_LOGIN_SHOW, // Show login screen
+ STATE_LOGIN_WAIT, // Wait for user input at login screen
+ STATE_LOGIN_CLEANUP, // Get rid of login screen and start login
+ STATE_LOGIN_AUTH_INIT, // Start login to SL servers
+ STATE_LOGIN_CURL_UNSTUCK, // Update progress to remove "SL appears frozen" msg.
+ STATE_LOGIN_PROCESS_RESPONSE, // Check authentication reply
+ STATE_WORLD_INIT, // Start building the world
+ STATE_MULTIMEDIA_INIT, // Init the rest of multimedia library
+ STATE_FONT_INIT, // Load default fonts
+ STATE_SEED_GRANTED_WAIT, // Wait for seed cap grant
+ STATE_SEED_CAP_GRANTED, // Have seed cap grant
+ STATE_WORLD_WAIT, // Waiting for simulator
+ STATE_AGENT_SEND, // Connect to a region
+ STATE_AGENT_WAIT, // Wait for region
+ STATE_INVENTORY_SEND, // Do inventory transfer
+ STATE_INVENTORY_CALLBACKS, // Wait for missing system folders and register callbacks
+ STATE_INVENTORY_SKEL, // Do more inventory skeleton loading
+ STATE_INVENTORY_SEND2, // Do more inventory init after skeleton is loaded
+ STATE_MISC, // Do more things (set bandwidth, start audio, save location, etc)
+ STATE_PRECACHE, // Wait a bit for textures to download
+ STATE_WEARABLES_WAIT, // Wait for clothing to download
+ STATE_CLEANUP, // Final cleanup
+ STATE_STARTED // Up and running in-world
} EStartupState;
// exported symbols
@@ -90,53 +90,53 @@ class LLStartUp
{
public:
- // Always use this to set gStartupState so changes are logged
- static void setStartupState( EStartupState state );
- static EStartupState getStartupState() { return gStartupState; };
- static std::string getStartupStateString() { return startupStateToString(gStartupState); };
- static std::string getScreenLastFilename(); // screenshot taken on exit
- static std::string getScreenHomeFilename(); // screenshot taken on setting Home
+ // Always use this to set gStartupState so changes are logged
+ static void setStartupState( EStartupState state );
+ static EStartupState getStartupState() { return gStartupState; };
+ static std::string getStartupStateString() { return startupStateToString(gStartupState); };
+ static std::string getScreenLastFilename(); // screenshot taken on exit
+ static std::string getScreenHomeFilename(); // screenshot taken on setting Home
+
+ static void multimediaInit();
+ // Initialize LLViewerMedia multimedia engine.
+
+ // Load default fonts not already loaded at start screen
+ static void fontInit();
- static void multimediaInit();
- // Initialize LLViewerMedia multimedia engine.
+ static void initNameCache();
+ static void initExperiences();
- // Load default fonts not already loaded at start screen
- static void fontInit();
+ static void cleanupNameCache();
- static void initNameCache();
- static void initExperiences();
-
- static void cleanupNameCache();
+ // outfit_folder_name can be a folder anywhere in your inventory,
+ // but the name must be a case-sensitive exact match.
+ // gender_name is either "male" or "female"
+ static void loadInitialOutfit( const std::string& outfit_folder_name,
+ const std::string& gender_name );
- // outfit_folder_name can be a folder anywhere in your inventory,
- // but the name must be a case-sensitive exact match.
- // gender_name is either "male" or "female"
- static void loadInitialOutfit( const std::string& outfit_folder_name,
- const std::string& gender_name );
+ static std::string& getInitialOutfitName();
+ static std::string getUserId();
- static std::string& getInitialOutfitName();
- static std::string getUserId();
-
- static bool dispatchURL();
- // if we have a SLURL or sim string ("Ahern/123/45") that started
- // the viewer, dispatch it
+ static bool dispatchURL();
+ // if we have a SLURL or sim string ("Ahern/123/45") that started
+ // the viewer, dispatch it
- static void postStartupState();
- static void setStartSLURL(const LLSLURL& slurl);
- static LLSLURL& getStartSLURL();
+ static void postStartupState();
+ static void setStartSLURL(const LLSLURL& slurl);
+ static LLSLURL& getStartSLURL();
- static bool startLLProxy(); // Initialize the SOCKS 5 proxy
+ static bool startLLProxy(); // Initialize the SOCKS 5 proxy
- static LLViewerStats::PhaseMap& getPhases() { return *sPhases; }
+ static LLViewerStats::PhaseMap& getPhases() { return *sPhases; }
private:
- friend class LLStartupListener;
- static LLSLURL sStartSLURL;
-
- static std::string startupStateToString(EStartupState state);
- static EStartupState gStartupState; // Do not set directly, use LLStartup::setStartupState
- static std::unique_ptr<LLEventPump> sStateWatcher;
- static std::unique_ptr<LLStartupListener> sListener;
- static std::unique_ptr<LLViewerStats::PhaseMap> sPhases;
+ friend class LLStartupListener;
+ static LLSLURL sStartSLURL;
+
+ static std::string startupStateToString(EStartupState state);
+ static EStartupState gStartupState; // Do not set directly, use LLStartup::setStartupState
+ static std::unique_ptr<LLEventPump> sStateWatcher;
+ static std::unique_ptr<LLStartupListener> sListener;
+ static std::unique_ptr<LLViewerStats::PhaseMap> sPhases;
};
diff --git a/indra/newview/llstartuplistener.cpp b/indra/newview/llstartuplistener.cpp
index 5770b595d0..50b480b097 100644
--- a/indra/newview/llstartuplistener.cpp
+++ b/indra/newview/llstartuplistener.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-12-08
* @brief Implementation for llstartuplistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llstartuplistener.h b/indra/newview/llstartuplistener.h
index 0b4380a568..2f05df9dd8 100644
--- a/indra/newview/llstartuplistener.h
+++ b/indra/newview/llstartuplistener.h
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-12-07
* @brief Event API to provide access to LLStartUp
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 5bd203cb65..f8bb4f3351 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llstatusbar.cpp
* @brief LLStatusBar class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -63,7 +63,7 @@
#include "llworld.h"
#include "llstatgraph.h"
#include "llviewermedia.h"
-#include "llviewermenu.h" // for gMenuBarView
+#include "llviewermenu.h" // for gMenuBarView
#include "llviewerparcelmgr.h"
#include "llviewerthrottle.h"
#include "lluictrlfactory.h"
@@ -102,44 +102,44 @@ const S32 SIM_STAT_WIDTH = 8;
const LLColor4 SIM_OK_COLOR(0.f, 1.f, 0.f, 1.f);
const LLColor4 SIM_WARN_COLOR(1.f, 1.f, 0.f, 1.f);
const LLColor4 SIM_FULL_COLOR(1.f, 0.f, 0.f, 1.f);
-const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons should flash after a change.
+const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons should flash after a change.
static void onClickVolume(void*);
LLStatusBar::LLStatusBar(const LLRect& rect)
-: LLPanel(),
- mTextTime(NULL),
- mSGBandwidth(NULL),
- mSGPacketLoss(NULL),
- mBtnVolume(NULL),
- mBoxBalance(NULL),
- mBalance(0),
- mHealth(100),
- mSquareMetersCredit(0),
- mSquareMetersCommitted(0),
- mFilterEdit(NULL), // Edit for filtering
- mSearchPanel(NULL) // Panel for filtering
-{
- setRect(rect);
-
- // status bar can possible overlay menus?
- setMouseOpaque(FALSE);
-
- mBalanceTimer = new LLFrameTimer();
- mHealthTimer = new LLFrameTimer();
-
- buildFromFile("panel_status_bar.xml");
+: LLPanel(),
+ mTextTime(NULL),
+ mSGBandwidth(NULL),
+ mSGPacketLoss(NULL),
+ mBtnVolume(NULL),
+ mBoxBalance(NULL),
+ mBalance(0),
+ mHealth(100),
+ mSquareMetersCredit(0),
+ mSquareMetersCommitted(0),
+ mFilterEdit(NULL), // Edit for filtering
+ mSearchPanel(NULL) // Panel for filtering
+{
+ setRect(rect);
+
+ // status bar can possible overlay menus?
+ setMouseOpaque(FALSE);
+
+ mBalanceTimer = new LLFrameTimer();
+ mHealthTimer = new LLFrameTimer();
+
+ buildFromFile("panel_status_bar.xml");
}
LLStatusBar::~LLStatusBar()
{
- delete mBalanceTimer;
- mBalanceTimer = NULL;
+ delete mBalanceTimer;
+ mBalanceTimer = NULL;
- delete mHealthTimer;
- mHealthTimer = NULL;
+ delete mHealthTimer;
+ mHealthTimer = NULL;
- // LLView destructor cleans up children
+ // LLView destructor cleans up children
}
//-----------------------------------------------------------------------
@@ -149,47 +149,47 @@ LLStatusBar::~LLStatusBar()
// virtual
void LLStatusBar::draw()
{
- refresh();
- LLPanel::draw();
+ refresh();
+ LLPanel::draw();
}
BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- show_navbar_context_menu(this,x,y);
- return TRUE;
+ show_navbar_context_menu(this,x,y);
+ return TRUE;
}
BOOL LLStatusBar::postBuild()
{
- gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3));
+ gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3));
+
+ mTextTime = getChild<LLTextBox>("TimeText" );
- mTextTime = getChild<LLTextBox>("TimeText" );
-
- getChild<LLUICtrl>("buyL")->setCommitCallback(
- boost::bind(&LLStatusBar::onClickBuyCurrency, this));
+ getChild<LLUICtrl>("buyL")->setCommitCallback(
+ boost::bind(&LLStatusBar::onClickBuyCurrency, this));
getChild<LLUICtrl>("goShop")->setCommitCallback(boost::bind(&LLWeb::loadURL, gSavedSettings.getString("MarketplaceURL"), LLStringUtil::null, LLStringUtil::null));
- mBoxBalance = getChild<LLTextBox>("balance");
- mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, this );
+ mBoxBalance = getChild<LLTextBox>("balance");
+ mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, this );
- mIconPresetsCamera = getChild<LLIconCtrl>( "presets_icon_camera" );
- mIconPresetsCamera->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresetsCamera, this));
+ mIconPresetsCamera = getChild<LLIconCtrl>( "presets_icon_camera" );
+ mIconPresetsCamera->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresetsCamera, this));
- mIconPresetsGraphic = getChild<LLIconCtrl>( "presets_icon_graphic" );
- mIconPresetsGraphic->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresets, this));
+ mIconPresetsGraphic = getChild<LLIconCtrl>( "presets_icon_graphic" );
+ mIconPresetsGraphic->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresets, this));
- mBtnVolume = getChild<LLButton>( "volume_btn" );
- mBtnVolume->setClickedCallback( onClickVolume, this );
- mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this));
+ mBtnVolume = getChild<LLButton>( "volume_btn" );
+ mBtnVolume->setClickedCallback( onClickVolume, this );
+ mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this));
- mMediaToggle = getChild<LLButton>("media_toggle_btn");
- mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this );
- mMediaToggle->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterNearbyMedia, this));
+ mMediaToggle = getChild<LLButton>("media_toggle_btn");
+ mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this );
+ mMediaToggle->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterNearbyMedia, this));
- LLHints::getInstance()->registerHintTarget("linden_balance", getChild<LLView>("balance_bg")->getHandle());
+ LLHints::getInstance()->registerHintTarget("linden_balance", getChild<LLView>("balance_bg")->getHandle());
- gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2));
+ gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2));
gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&LLStatusBar::onVoiceChanged, this, _2));
if (!gSavedSettings.getBOOL("EnableVoiceChat") && LLAppViewer::instance()->isSecondInstance())
@@ -198,231 +198,231 @@ BOOL LLStatusBar::postBuild()
mBtnVolume->setImageUnselected(LLUI::getUIImage("VoiceMute_Off"));
}
- // Adding Net Stat Graph
- S32 x = getRect().getWidth() - 2;
- S32 y = 0;
- LLRect r;
- r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1);
- LLStatGraph::Params sgp;
- sgp.name("BandwidthGraph");
- sgp.rect(r);
- sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
- sgp.mouse_opaque(false);
- sgp.stat.count_stat_float(&LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED);
- sgp.units("Kbps");
- sgp.precision(0);
- sgp.per_sec(true);
- mSGBandwidth = LLUICtrlFactory::create<LLStatGraph>(sgp);
- addChild(mSGBandwidth);
- x -= SIM_STAT_WIDTH + 2;
-
- r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1);
- //these don't seem to like being reused
- LLStatGraph::Params pgp;
- pgp.name("PacketLossPercent");
- pgp.rect(r);
- pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
- pgp.mouse_opaque(false);
- pgp.stat.sample_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT);
- pgp.units("%");
- pgp.min(0.f);
- pgp.max(5.f);
- pgp.precision(1);
- pgp.per_sec(false);
- LLStatGraph::Thresholds thresholds;
- thresholds.threshold.add(LLStatGraph::ThresholdParams().value(0.1).color(LLColor4::green))
- .add(LLStatGraph::ThresholdParams().value(0.25f).color(LLColor4::yellow))
- .add(LLStatGraph::ThresholdParams().value(0.6f).color(LLColor4::red));
-
- pgp.thresholds(thresholds);
-
- mSGPacketLoss = LLUICtrlFactory::create<LLStatGraph>(pgp);
- addChild(mSGPacketLoss);
-
- mPanelPresetsCameraPulldown = new LLPanelPresetsCameraPulldown();
- addChild(mPanelPresetsCameraPulldown);
- mPanelPresetsCameraPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
- mPanelPresetsCameraPulldown->setVisible(FALSE);
-
- mPanelPresetsPulldown = new LLPanelPresetsPulldown();
- addChild(mPanelPresetsPulldown);
- mPanelPresetsPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
- mPanelPresetsPulldown->setVisible(FALSE);
-
- mPanelVolumePulldown = new LLPanelVolumePulldown();
- addChild(mPanelVolumePulldown);
- mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
- mPanelVolumePulldown->setVisible(FALSE);
-
- mPanelNearByMedia = new LLPanelNearByMedia();
- addChild(mPanelNearByMedia);
- mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
- mPanelNearByMedia->setVisible(FALSE);
-
- updateBalancePanelPosition();
-
- // Hook up and init for filtering
- mFilterEdit = getChild<LLSearchEditor>( "search_menu_edit" );
- mSearchPanel = getChild<LLPanel>( "menu_search_panel" );
-
- BOOL search_panel_visible = gSavedSettings.getBOOL("MenuSearch");
- mSearchPanel->setVisible(search_panel_visible);
- mFilterEdit->setKeystrokeCallback(boost::bind(&LLStatusBar::onUpdateFilterTerm, this));
- mFilterEdit->setCommitCallback(boost::bind(&LLStatusBar::onUpdateFilterTerm, this));
- collectSearchableItems();
- gSavedSettings.getControl("MenuSearch")->getCommitSignal()->connect(boost::bind(&LLStatusBar::updateMenuSearchVisibility, this, _2));
-
- if (search_panel_visible)
- {
- updateMenuSearchPosition();
- }
-
- return TRUE;
+ // Adding Net Stat Graph
+ S32 x = getRect().getWidth() - 2;
+ S32 y = 0;
+ LLRect r;
+ r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1);
+ LLStatGraph::Params sgp;
+ sgp.name("BandwidthGraph");
+ sgp.rect(r);
+ sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
+ sgp.mouse_opaque(false);
+ sgp.stat.count_stat_float(&LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED);
+ sgp.units("Kbps");
+ sgp.precision(0);
+ sgp.per_sec(true);
+ mSGBandwidth = LLUICtrlFactory::create<LLStatGraph>(sgp);
+ addChild(mSGBandwidth);
+ x -= SIM_STAT_WIDTH + 2;
+
+ r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1);
+ //these don't seem to like being reused
+ LLStatGraph::Params pgp;
+ pgp.name("PacketLossPercent");
+ pgp.rect(r);
+ pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
+ pgp.mouse_opaque(false);
+ pgp.stat.sample_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT);
+ pgp.units("%");
+ pgp.min(0.f);
+ pgp.max(5.f);
+ pgp.precision(1);
+ pgp.per_sec(false);
+ LLStatGraph::Thresholds thresholds;
+ thresholds.threshold.add(LLStatGraph::ThresholdParams().value(0.1).color(LLColor4::green))
+ .add(LLStatGraph::ThresholdParams().value(0.25f).color(LLColor4::yellow))
+ .add(LLStatGraph::ThresholdParams().value(0.6f).color(LLColor4::red));
+
+ pgp.thresholds(thresholds);
+
+ mSGPacketLoss = LLUICtrlFactory::create<LLStatGraph>(pgp);
+ addChild(mSGPacketLoss);
+
+ mPanelPresetsCameraPulldown = new LLPanelPresetsCameraPulldown();
+ addChild(mPanelPresetsCameraPulldown);
+ mPanelPresetsCameraPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
+ mPanelPresetsCameraPulldown->setVisible(FALSE);
+
+ mPanelPresetsPulldown = new LLPanelPresetsPulldown();
+ addChild(mPanelPresetsPulldown);
+ mPanelPresetsPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
+ mPanelPresetsPulldown->setVisible(FALSE);
+
+ mPanelVolumePulldown = new LLPanelVolumePulldown();
+ addChild(mPanelVolumePulldown);
+ mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
+ mPanelVolumePulldown->setVisible(FALSE);
+
+ mPanelNearByMedia = new LLPanelNearByMedia();
+ addChild(mPanelNearByMedia);
+ mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
+ mPanelNearByMedia->setVisible(FALSE);
+
+ updateBalancePanelPosition();
+
+ // Hook up and init for filtering
+ mFilterEdit = getChild<LLSearchEditor>( "search_menu_edit" );
+ mSearchPanel = getChild<LLPanel>( "menu_search_panel" );
+
+ BOOL search_panel_visible = gSavedSettings.getBOOL("MenuSearch");
+ mSearchPanel->setVisible(search_panel_visible);
+ mFilterEdit->setKeystrokeCallback(boost::bind(&LLStatusBar::onUpdateFilterTerm, this));
+ mFilterEdit->setCommitCallback(boost::bind(&LLStatusBar::onUpdateFilterTerm, this));
+ collectSearchableItems();
+ gSavedSettings.getControl("MenuSearch")->getCommitSignal()->connect(boost::bind(&LLStatusBar::updateMenuSearchVisibility, this, _2));
+
+ if (search_panel_visible)
+ {
+ updateMenuSearchPosition();
+ }
+
+ return TRUE;
}
// Per-frame updates of visibility
void LLStatusBar::refresh()
{
- static LLCachedControl<bool> show_net_stats(gSavedSettings, "ShowNetStats", false);
- bool net_stats_visible = show_net_stats;
-
- if (net_stats_visible)
- {
- // Adding Net Stat Meter back in
- F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f;
- mSGBandwidth->setMin(0.f);
- mSGBandwidth->setMax(bwtotal*1.25f);
- //mSGBandwidth->setThreshold(0, bwtotal*0.75f);
- //mSGBandwidth->setThreshold(1, bwtotal);
- //mSGBandwidth->setThreshold(2, bwtotal);
- }
-
- // update clock every 10 seconds
- if(mClockUpdateTimer.getElapsedTimeF32() > 10.f)
- {
- mClockUpdateTimer.reset();
-
- // Get current UTC time, adjusted for the user's clock
- // being off.
- time_t utc_time;
- utc_time = time_corrected();
-
- std::string timeStr = getString("time");
- LLSD substitution;
- substitution["datetime"] = (S32) utc_time;
- LLStringUtil::format (timeStr, substitution);
- mTextTime->setText(timeStr);
-
- // set the tooltip to have the date
- std::string dtStr = getString("timeTooltip");
- LLStringUtil::format (dtStr, substitution);
- mTextTime->setToolTip (dtStr);
- }
-
- LLRect r;
- const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
-
- // reshape menu bar to its content's width
- if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
- {
- gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight());
- }
-
- mSGBandwidth->setVisible(net_stats_visible);
- mSGPacketLoss->setVisible(net_stats_visible);
-
- // update the master volume button state
- bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
- mBtnVolume->setToggleState(mute_audio);
-
- LLViewerMedia* media_inst = LLViewerMedia::getInstance();
-
- // Disable media toggle if there's no media, parcel media, and no parcel audio
- // (or if media is disabled)
- bool button_enabled = (gSavedSettings.getBOOL("AudioStreamingMusic")||gSavedSettings.getBOOL("AudioStreamingMedia")) &&
- (media_inst->hasInWorldMedia() || media_inst->hasParcelMedia() || media_inst->hasParcelAudio());
- mMediaToggle->setEnabled(button_enabled);
- // Note the "sense" of the toggle is opposite whether media is playing or not
- bool any_media_playing = (media_inst->isAnyMediaPlaying() ||
- media_inst->isParcelMediaPlaying() ||
- media_inst->isParcelAudioPlaying());
- mMediaToggle->setValue(!any_media_playing);
+ static LLCachedControl<bool> show_net_stats(gSavedSettings, "ShowNetStats", false);
+ bool net_stats_visible = show_net_stats;
+
+ if (net_stats_visible)
+ {
+ // Adding Net Stat Meter back in
+ F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f;
+ mSGBandwidth->setMin(0.f);
+ mSGBandwidth->setMax(bwtotal*1.25f);
+ //mSGBandwidth->setThreshold(0, bwtotal*0.75f);
+ //mSGBandwidth->setThreshold(1, bwtotal);
+ //mSGBandwidth->setThreshold(2, bwtotal);
+ }
+
+ // update clock every 10 seconds
+ if(mClockUpdateTimer.getElapsedTimeF32() > 10.f)
+ {
+ mClockUpdateTimer.reset();
+
+ // Get current UTC time, adjusted for the user's clock
+ // being off.
+ time_t utc_time;
+ utc_time = time_corrected();
+
+ std::string timeStr = getString("time");
+ LLSD substitution;
+ substitution["datetime"] = (S32) utc_time;
+ LLStringUtil::format (timeStr, substitution);
+ mTextTime->setText(timeStr);
+
+ // set the tooltip to have the date
+ std::string dtStr = getString("timeTooltip");
+ LLStringUtil::format (dtStr, substitution);
+ mTextTime->setToolTip (dtStr);
+ }
+
+ LLRect r;
+ const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
+
+ // reshape menu bar to its content's width
+ if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
+ {
+ gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight());
+ }
+
+ mSGBandwidth->setVisible(net_stats_visible);
+ mSGPacketLoss->setVisible(net_stats_visible);
+
+ // update the master volume button state
+ bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
+ mBtnVolume->setToggleState(mute_audio);
+
+ LLViewerMedia* media_inst = LLViewerMedia::getInstance();
+
+ // Disable media toggle if there's no media, parcel media, and no parcel audio
+ // (or if media is disabled)
+ bool button_enabled = (gSavedSettings.getBOOL("AudioStreamingMusic")||gSavedSettings.getBOOL("AudioStreamingMedia")) &&
+ (media_inst->hasInWorldMedia() || media_inst->hasParcelMedia() || media_inst->hasParcelAudio());
+ mMediaToggle->setEnabled(button_enabled);
+ // Note the "sense" of the toggle is opposite whether media is playing or not
+ bool any_media_playing = (media_inst->isAnyMediaPlaying() ||
+ media_inst->isParcelMediaPlaying() ||
+ media_inst->isParcelAudioPlaying());
+ mMediaToggle->setValue(!any_media_playing);
}
void LLStatusBar::setVisibleForMouselook(bool visible)
{
- mTextTime->setVisible(visible);
- getChild<LLUICtrl>("balance_bg")->setVisible(visible);
- mBoxBalance->setVisible(visible);
- mBtnVolume->setVisible(visible);
- mMediaToggle->setVisible(visible);
- mSGBandwidth->setVisible(visible);
- mSGPacketLoss->setVisible(visible);
- mSearchPanel->setVisible(visible && gSavedSettings.getBOOL("MenuSearch"));
- setBackgroundVisible(visible);
- mIconPresetsCamera->setVisible(visible);
- mIconPresetsGraphic->setVisible(visible);
+ mTextTime->setVisible(visible);
+ getChild<LLUICtrl>("balance_bg")->setVisible(visible);
+ mBoxBalance->setVisible(visible);
+ mBtnVolume->setVisible(visible);
+ mMediaToggle->setVisible(visible);
+ mSGBandwidth->setVisible(visible);
+ mSGPacketLoss->setVisible(visible);
+ mSearchPanel->setVisible(visible && gSavedSettings.getBOOL("MenuSearch"));
+ setBackgroundVisible(visible);
+ mIconPresetsCamera->setVisible(visible);
+ mIconPresetsGraphic->setVisible(visible);
}
void LLStatusBar::debitBalance(S32 debit)
{
- setBalance(getBalance() - debit);
+ setBalance(getBalance() - debit);
}
void LLStatusBar::creditBalance(S32 credit)
{
- setBalance(getBalance() + credit);
+ setBalance(getBalance() + credit);
}
void LLStatusBar::setBalance(S32 balance)
{
- if (balance > getBalance() && getBalance() != 0)
- {
- LLFirstUse::receiveLindens();
- }
+ if (balance > getBalance() && getBalance() != 0)
+ {
+ LLFirstUse::receiveLindens();
+ }
- std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance );
+ std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance );
- LLStringUtil::format_map_t string_args;
- string_args["[AMT]"] = llformat("%s", money_str.c_str());
- std::string label_str = getString("buycurrencylabel", string_args);
- mBoxBalance->setValue(label_str);
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMT]"] = llformat("%s", money_str.c_str());
+ std::string label_str = getString("buycurrencylabel", string_args);
+ mBoxBalance->setValue(label_str);
- updateBalancePanelPosition();
+ updateBalancePanelPosition();
- // If the search panel is shown, move this according to the new balance width. Parcel text will reshape itself in setParcelInfoText
- if (mSearchPanel && mSearchPanel->getVisible())
- {
- updateMenuSearchPosition();
- }
+ // If the search panel is shown, move this according to the new balance width. Parcel text will reshape itself in setParcelInfoText
+ if (mSearchPanel && mSearchPanel->getVisible())
+ {
+ updateMenuSearchPosition();
+ }
- if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold")))
- {
- if (mBalance > balance)
- make_ui_sound("UISndMoneyChangeDown");
- else
- make_ui_sound("UISndMoneyChangeUp");
- }
+ if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold")))
+ {
+ if (mBalance > balance)
+ make_ui_sound("UISndMoneyChangeDown");
+ else
+ make_ui_sound("UISndMoneyChangeUp");
+ }
- if( balance != mBalance )
- {
- mBalanceTimer->reset();
- mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY );
- mBalance = balance;
- }
+ if( balance != mBalance )
+ {
+ mBalanceTimer->reset();
+ mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY );
+ mBalance = balance;
+ }
}
// static
void LLStatusBar::sendMoneyBalanceRequest()
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MoneyBalanceRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MoneyData);
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null );
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_MoneyBalanceRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_MoneyData);
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null );
if (gDisconnected)
{
@@ -442,209 +442,209 @@ void LLStatusBar::sendMoneyBalanceRequest()
void LLStatusBar::setHealth(S32 health)
{
- //LL_INFOS() << "Setting health to: " << buffer << LL_ENDL;
- if( mHealth > health )
- {
- if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold")))
- {
- if (isAgentAvatarValid())
- {
- if (gAgentAvatarp->getSex() == SEX_FEMALE)
- {
- make_ui_sound("UISndHealthReductionF");
- }
- else
- {
- make_ui_sound("UISndHealthReductionM");
- }
- }
- }
-
- mHealthTimer->reset();
- mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY );
- }
-
- mHealth = health;
+ //LL_INFOS() << "Setting health to: " << buffer << LL_ENDL;
+ if( mHealth > health )
+ {
+ if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold")))
+ {
+ if (isAgentAvatarValid())
+ {
+ if (gAgentAvatarp->getSex() == SEX_FEMALE)
+ {
+ make_ui_sound("UISndHealthReductionF");
+ }
+ else
+ {
+ make_ui_sound("UISndHealthReductionM");
+ }
+ }
+ }
+
+ mHealthTimer->reset();
+ mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY );
+ }
+
+ mHealth = health;
}
S32 LLStatusBar::getBalance() const
{
- return mBalance;
+ return mBalance;
}
S32 LLStatusBar::getHealth() const
{
- return mHealth;
+ return mHealth;
}
void LLStatusBar::setLandCredit(S32 credit)
{
- mSquareMetersCredit = credit;
+ mSquareMetersCredit = credit;
}
void LLStatusBar::setLandCommitted(S32 committed)
{
- mSquareMetersCommitted = committed;
+ mSquareMetersCommitted = committed;
}
BOOL LLStatusBar::isUserTiered() const
{
- return (mSquareMetersCredit > 0);
+ return (mSquareMetersCredit > 0);
}
S32 LLStatusBar::getSquareMetersCredit() const
{
- return mSquareMetersCredit;
+ return mSquareMetersCredit;
}
S32 LLStatusBar::getSquareMetersCommitted() const
{
- return mSquareMetersCommitted;
+ return mSquareMetersCommitted;
}
S32 LLStatusBar::getSquareMetersLeft() const
{
- return mSquareMetersCredit - mSquareMetersCommitted;
+ return mSquareMetersCredit - mSquareMetersCommitted;
}
void LLStatusBar::onClickBuyCurrency()
{
- // open a currency floater - actual one open depends on
- // value specified in settings.xml
- LLBuyCurrencyHTML::openCurrencyFloater();
- LLFirstUse::receiveLindens(false);
+ // open a currency floater - actual one open depends on
+ // value specified in settings.xml
+ LLBuyCurrencyHTML::openCurrencyFloater();
+ LLFirstUse::receiveLindens(false);
}
void LLStatusBar::onMouseEnterPresetsCamera()
{
- LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
- LLIconCtrl* icon = getChild<LLIconCtrl>( "presets_icon_camera" );
- LLRect icon_rect = icon->getRect();
- LLRect pulldown_rect = mPanelPresetsCameraPulldown->getRect();
- pulldown_rect.setLeftTopAndSize(icon_rect.mLeft -
- (pulldown_rect.getWidth() - icon_rect.getWidth()),
- icon_rect.mBottom,
- pulldown_rect.getWidth(),
- pulldown_rect.getHeight());
+ LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
+ LLIconCtrl* icon = getChild<LLIconCtrl>( "presets_icon_camera" );
+ LLRect icon_rect = icon->getRect();
+ LLRect pulldown_rect = mPanelPresetsCameraPulldown->getRect();
+ pulldown_rect.setLeftTopAndSize(icon_rect.mLeft -
+ (pulldown_rect.getWidth() - icon_rect.getWidth()),
+ icon_rect.mBottom,
+ pulldown_rect.getWidth(),
+ pulldown_rect.getHeight());
- pulldown_rect.translate(popup_holder->getRect().getWidth() - pulldown_rect.mRight, 0);
- mPanelPresetsCameraPulldown->setShape(pulldown_rect);
+ pulldown_rect.translate(popup_holder->getRect().getWidth() - pulldown_rect.mRight, 0);
+ mPanelPresetsCameraPulldown->setShape(pulldown_rect);
- // show the master presets pull-down
- LLUI::getInstance()->clearPopups();
- LLUI::getInstance()->addPopup(mPanelPresetsCameraPulldown);
- mPanelNearByMedia->setVisible(FALSE);
- mPanelVolumePulldown->setVisible(FALSE);
- mPanelPresetsPulldown->setVisible(FALSE);
- mPanelPresetsCameraPulldown->setVisible(TRUE);
+ // show the master presets pull-down
+ LLUI::getInstance()->clearPopups();
+ LLUI::getInstance()->addPopup(mPanelPresetsCameraPulldown);
+ mPanelNearByMedia->setVisible(FALSE);
+ mPanelVolumePulldown->setVisible(FALSE);
+ mPanelPresetsPulldown->setVisible(FALSE);
+ mPanelPresetsCameraPulldown->setVisible(TRUE);
}
void LLStatusBar::onMouseEnterPresets()
{
- LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
- LLIconCtrl* icon = getChild<LLIconCtrl>( "presets_icon_graphic" );
- LLRect icon_rect = icon->getRect();
- LLRect pulldown_rect = mPanelPresetsPulldown->getRect();
- pulldown_rect.setLeftTopAndSize(icon_rect.mLeft -
- (pulldown_rect.getWidth() - icon_rect.getWidth()),
- icon_rect.mBottom,
- pulldown_rect.getWidth(),
- pulldown_rect.getHeight());
+ LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
+ LLIconCtrl* icon = getChild<LLIconCtrl>( "presets_icon_graphic" );
+ LLRect icon_rect = icon->getRect();
+ LLRect pulldown_rect = mPanelPresetsPulldown->getRect();
+ pulldown_rect.setLeftTopAndSize(icon_rect.mLeft -
+ (pulldown_rect.getWidth() - icon_rect.getWidth()),
+ icon_rect.mBottom,
+ pulldown_rect.getWidth(),
+ pulldown_rect.getHeight());
- pulldown_rect.translate(popup_holder->getRect().getWidth() - pulldown_rect.mRight, 0);
- mPanelPresetsPulldown->setShape(pulldown_rect);
+ pulldown_rect.translate(popup_holder->getRect().getWidth() - pulldown_rect.mRight, 0);
+ mPanelPresetsPulldown->setShape(pulldown_rect);
- // show the master presets pull-down
- LLUI::getInstance()->clearPopups();
- LLUI::getInstance()->addPopup(mPanelPresetsPulldown);
- mPanelNearByMedia->setVisible(FALSE);
- mPanelVolumePulldown->setVisible(FALSE);
- mPanelPresetsPulldown->setVisible(TRUE);
+ // show the master presets pull-down
+ LLUI::getInstance()->clearPopups();
+ LLUI::getInstance()->addPopup(mPanelPresetsPulldown);
+ mPanelNearByMedia->setVisible(FALSE);
+ mPanelVolumePulldown->setVisible(FALSE);
+ mPanelPresetsPulldown->setVisible(TRUE);
}
void LLStatusBar::onMouseEnterVolume()
{
- LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
- LLButton* volbtn = getChild<LLButton>( "volume_btn" );
- LLRect vol_btn_rect = volbtn->getRect();
- LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect();
- volume_pulldown_rect.setLeftTopAndSize(vol_btn_rect.mLeft -
- (volume_pulldown_rect.getWidth() - vol_btn_rect.getWidth()),
- vol_btn_rect.mBottom,
- volume_pulldown_rect.getWidth(),
- volume_pulldown_rect.getHeight());
+ LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
+ LLButton* volbtn = getChild<LLButton>( "volume_btn" );
+ LLRect vol_btn_rect = volbtn->getRect();
+ LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect();
+ volume_pulldown_rect.setLeftTopAndSize(vol_btn_rect.mLeft -
+ (volume_pulldown_rect.getWidth() - vol_btn_rect.getWidth()),
+ vol_btn_rect.mBottom,
+ volume_pulldown_rect.getWidth(),
+ volume_pulldown_rect.getHeight());
- volume_pulldown_rect.translate(popup_holder->getRect().getWidth() - volume_pulldown_rect.mRight, 0);
- mPanelVolumePulldown->setShape(volume_pulldown_rect);
+ volume_pulldown_rect.translate(popup_holder->getRect().getWidth() - volume_pulldown_rect.mRight, 0);
+ mPanelVolumePulldown->setShape(volume_pulldown_rect);
- // show the master volume pull-down
- LLUI::getInstance()->clearPopups();
- LLUI::getInstance()->addPopup(mPanelVolumePulldown);
- mPanelPresetsCameraPulldown->setVisible(FALSE);
- mPanelPresetsPulldown->setVisible(FALSE);
- mPanelNearByMedia->setVisible(FALSE);
- mPanelVolumePulldown->setVisible(TRUE);
+ // show the master volume pull-down
+ LLUI::getInstance()->clearPopups();
+ LLUI::getInstance()->addPopup(mPanelVolumePulldown);
+ mPanelPresetsCameraPulldown->setVisible(FALSE);
+ mPanelPresetsPulldown->setVisible(FALSE);
+ mPanelNearByMedia->setVisible(FALSE);
+ mPanelVolumePulldown->setVisible(TRUE);
}
void LLStatusBar::onMouseEnterNearbyMedia()
{
- LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
- LLRect nearby_media_rect = mPanelNearByMedia->getRect();
- LLButton* nearby_media_btn = getChild<LLButton>( "media_toggle_btn" );
- LLRect nearby_media_btn_rect = nearby_media_btn->getRect();
- nearby_media_rect.setLeftTopAndSize(nearby_media_btn_rect.mLeft -
- (nearby_media_rect.getWidth() - nearby_media_btn_rect.getWidth())/2,
- nearby_media_btn_rect.mBottom,
- nearby_media_rect.getWidth(),
- nearby_media_rect.getHeight());
- // force onscreen
- nearby_media_rect.translate(popup_holder->getRect().getWidth() - nearby_media_rect.mRight, 0);
-
- // show the master volume pull-down
- mPanelNearByMedia->setShape(nearby_media_rect);
- LLUI::getInstance()->clearPopups();
- LLUI::getInstance()->addPopup(mPanelNearByMedia);
-
- mPanelPresetsCameraPulldown->setVisible(FALSE);
- mPanelPresetsPulldown->setVisible(FALSE);
- mPanelVolumePulldown->setVisible(FALSE);
- mPanelNearByMedia->setVisible(TRUE);
+ LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
+ LLRect nearby_media_rect = mPanelNearByMedia->getRect();
+ LLButton* nearby_media_btn = getChild<LLButton>( "media_toggle_btn" );
+ LLRect nearby_media_btn_rect = nearby_media_btn->getRect();
+ nearby_media_rect.setLeftTopAndSize(nearby_media_btn_rect.mLeft -
+ (nearby_media_rect.getWidth() - nearby_media_btn_rect.getWidth())/2,
+ nearby_media_btn_rect.mBottom,
+ nearby_media_rect.getWidth(),
+ nearby_media_rect.getHeight());
+ // force onscreen
+ nearby_media_rect.translate(popup_holder->getRect().getWidth() - nearby_media_rect.mRight, 0);
+
+ // show the master volume pull-down
+ mPanelNearByMedia->setShape(nearby_media_rect);
+ LLUI::getInstance()->clearPopups();
+ LLUI::getInstance()->addPopup(mPanelNearByMedia);
+
+ mPanelPresetsCameraPulldown->setVisible(FALSE);
+ mPanelPresetsPulldown->setVisible(FALSE);
+ mPanelVolumePulldown->setVisible(FALSE);
+ mPanelNearByMedia->setVisible(TRUE);
}
static void onClickVolume(void* data)
{
- // toggle the master mute setting
- bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
- LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio);
+ // toggle the master mute setting
+ bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
+ LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio);
}
-//static
+//static
void LLStatusBar::onClickBalance(void* )
{
- // Force a balance request message:
- LLStatusBar::sendMoneyBalanceRequest();
- // The refresh of the display (call to setBalance()) will be done by process_money_balance_reply()
+ // Force a balance request message:
+ LLStatusBar::sendMoneyBalanceRequest();
+ // The refresh of the display (call to setBalance()) will be done by process_money_balance_reply()
}
-//static
+//static
void LLStatusBar::onClickMediaToggle(void* data)
{
- LLStatusBar *status_bar = (LLStatusBar*)data;
- // "Selected" means it was showing the "play" icon (so media was playing), and now it shows "pause", so turn off media
- bool pause = status_bar->mMediaToggle->getValue();
- LLViewerMedia::getInstance()->setAllMediaPaused(pause);
+ LLStatusBar *status_bar = (LLStatusBar*)data;
+ // "Selected" means it was showing the "play" icon (so media was playing), and now it shows "pause", so turn off media
+ bool pause = status_bar->mMediaToggle->getValue();
+ LLViewerMedia::getInstance()->setAllMediaPaused(pause);
}
BOOL can_afford_transaction(S32 cost)
{
- return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost)));
+ return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost)));
}
void LLStatusBar::onVolumeChanged(const LLSD& newvalue)
{
- refresh();
+ refresh();
}
void LLStatusBar::onVoiceChanged(const LLSD& newvalue)
@@ -659,70 +659,70 @@ void LLStatusBar::onVoiceChanged(const LLSD& newvalue)
void LLStatusBar::onUpdateFilterTerm()
{
- LLWString searchValue = utf8str_to_wstring( mFilterEdit->getValue() );
- LLWStringUtil::toLower( searchValue );
+ LLWString searchValue = utf8str_to_wstring( mFilterEdit->getValue() );
+ LLWStringUtil::toLower( searchValue );
- if( !mSearchData || mSearchData->mLastFilter == searchValue )
- return;
+ if( !mSearchData || mSearchData->mLastFilter == searchValue )
+ return;
- mSearchData->mLastFilter = searchValue;
+ mSearchData->mLastFilter = searchValue;
- mSearchData->mRootMenu->hightlightAndHide( searchValue );
- gMenuBarView->needsArrange();
+ mSearchData->mRootMenu->hightlightAndHide( searchValue );
+ gMenuBarView->needsArrange();
}
void collectChildren( LLMenuGL *aMenu, ll::statusbar::SearchableItemPtr aParentMenu )
{
- for( U32 i = 0; i < aMenu->getItemCount(); ++i )
- {
- LLMenuItemGL *pMenu = aMenu->getItem( i );
-
- ll::statusbar::SearchableItemPtr pItem( new ll::statusbar::SearchableItem );
- pItem->mCtrl = pMenu;
- pItem->mMenu = pMenu;
- pItem->mLabel = utf8str_to_wstring( pMenu->ll::ui::SearchableControl::getSearchText() );
- LLWStringUtil::toLower( pItem->mLabel );
- aParentMenu->mChildren.push_back( pItem );
-
- LLMenuItemBranchGL *pBranch = dynamic_cast< LLMenuItemBranchGL* >( pMenu );
- if( pBranch )
- collectChildren( pBranch->getBranch(), pItem );
- }
+ for( U32 i = 0; i < aMenu->getItemCount(); ++i )
+ {
+ LLMenuItemGL *pMenu = aMenu->getItem( i );
+
+ ll::statusbar::SearchableItemPtr pItem( new ll::statusbar::SearchableItem );
+ pItem->mCtrl = pMenu;
+ pItem->mMenu = pMenu;
+ pItem->mLabel = utf8str_to_wstring( pMenu->ll::ui::SearchableControl::getSearchText() );
+ LLWStringUtil::toLower( pItem->mLabel );
+ aParentMenu->mChildren.push_back( pItem );
+
+ LLMenuItemBranchGL *pBranch = dynamic_cast< LLMenuItemBranchGL* >( pMenu );
+ if( pBranch )
+ collectChildren( pBranch->getBranch(), pItem );
+ }
}
void LLStatusBar::collectSearchableItems()
{
- mSearchData.reset( new ll::statusbar::SearchData );
- ll::statusbar::SearchableItemPtr pItem( new ll::statusbar::SearchableItem );
- mSearchData->mRootMenu = pItem;
- collectChildren( gMenuBarView, pItem );
+ mSearchData.reset( new ll::statusbar::SearchData );
+ ll::statusbar::SearchableItemPtr pItem( new ll::statusbar::SearchableItem );
+ mSearchData->mRootMenu = pItem;
+ collectChildren( gMenuBarView, pItem );
}
void LLStatusBar::updateMenuSearchVisibility(const LLSD& data)
{
- bool visible = data.asBoolean();
- mSearchPanel->setVisible(visible);
- if (!visible)
- {
- mFilterEdit->setText(LLStringUtil::null);
- onUpdateFilterTerm();
- }
- else
- {
- updateMenuSearchPosition();
- }
+ bool visible = data.asBoolean();
+ mSearchPanel->setVisible(visible);
+ if (!visible)
+ {
+ mFilterEdit->setText(LLStringUtil::null);
+ onUpdateFilterTerm();
+ }
+ else
+ {
+ updateMenuSearchPosition();
+ }
}
void LLStatusBar::updateMenuSearchPosition()
{
- const S32 HPAD = 12;
- LLRect balanceRect = getChildView("balance_bg")->getRect();
- LLRect searchRect = mSearchPanel->getRect();
- S32 w = searchRect.getWidth();
- searchRect.mLeft = balanceRect.mLeft - w - HPAD;
- searchRect.mRight = searchRect.mLeft + w;
- mSearchPanel->setShape( searchRect );
+ const S32 HPAD = 12;
+ LLRect balanceRect = getChildView("balance_bg")->getRect();
+ LLRect searchRect = mSearchPanel->getRect();
+ S32 w = searchRect.getWidth();
+ searchRect.mLeft = balanceRect.mLeft - w - HPAD;
+ searchRect.mRight = searchRect.mLeft + w;
+ mSearchPanel->setShape( searchRect );
}
void LLStatusBar::updateBalancePanelPosition()
@@ -744,18 +744,18 @@ void LLStatusBar::updateBalancePanelPosition()
class LLBalanceHandler : public LLCommandHandler
{
public:
- // Requires "trusted" browser/URL source
- LLBalanceHandler() : LLCommandHandler("balance", UNTRUSTED_BLOCK) { }
- bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- if (tokens.size() == 1
- && tokens[0].asString() == "request")
- {
- LLStatusBar::sendMoneyBalanceRequest();
- return true;
- }
- return false;
- }
+ // Requires "trusted" browser/URL source
+ LLBalanceHandler() : LLCommandHandler("balance", UNTRUSTED_BLOCK) { }
+ bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ if (tokens.size() == 1
+ && tokens[0].asString() == "request")
+ {
+ LLStatusBar::sendMoneyBalanceRequest();
+ return true;
+ }
+ return false;
+ }
};
// register with command dispatch system
LLBalanceHandler gBalanceHandler;
diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h
index 3e9190652d..fb923d3d09 100644
--- a/indra/newview/llstatusbar.h
+++ b/indra/newview/llstatusbar.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llstatusbar.h
* @brief LLStatusBar class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,98 +50,98 @@ class LLSearchEditor;
namespace ll
{
- namespace statusbar
- {
- struct SearchData;
- }
+ namespace statusbar
+ {
+ struct SearchData;
+ }
}
class LLStatusBar
-: public LLPanel
+: public LLPanel
{
public:
- LLStatusBar(const LLRect& rect );
- /*virtual*/ ~LLStatusBar();
-
- /*virtual*/ void draw();
+ LLStatusBar(const LLRect& rect );
+ /*virtual*/ ~LLStatusBar();
+
+ /*virtual*/ void draw();
- /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL postBuild();
- // MANIPULATORS
- void setBalance(S32 balance);
- void debitBalance(S32 debit);
- void creditBalance(S32 credit);
+ // MANIPULATORS
+ void setBalance(S32 balance);
+ void debitBalance(S32 debit);
+ void creditBalance(S32 credit);
- // Request the latest currency balance from the server
- static void sendMoneyBalanceRequest();
+ // Request the latest currency balance from the server
+ static void sendMoneyBalanceRequest();
- void setHealth(S32 percent);
+ void setHealth(S32 percent);
- void setLandCredit(S32 credit);
- void setLandCommitted(S32 committed);
+ void setLandCredit(S32 credit);
+ void setLandCommitted(S32 committed);
- void refresh();
- void setVisibleForMouselook(bool visible);
- // some elements should hide in mouselook
+ void refresh();
+ void setVisibleForMouselook(bool visible);
+ // some elements should hide in mouselook
- // ACCESSORS
- S32 getBalance() const;
- S32 getHealth() const;
+ // ACCESSORS
+ S32 getBalance() const;
+ S32 getHealth() const;
- BOOL isUserTiered() const;
- S32 getSquareMetersCredit() const;
- S32 getSquareMetersCommitted() const;
- S32 getSquareMetersLeft() const;
+ BOOL isUserTiered() const;
+ S32 getSquareMetersCredit() const;
+ S32 getSquareMetersCommitted() const;
+ S32 getSquareMetersLeft() const;
- LLPanelNearByMedia* getNearbyMediaPanel() { return mPanelNearByMedia; }
+ LLPanelNearByMedia* getNearbyMediaPanel() { return mPanelNearByMedia; }
private:
-
- void onClickBuyCurrency();
- void onVolumeChanged(const LLSD& newvalue);
+
+ void onClickBuyCurrency();
+ void onVolumeChanged(const LLSD& newvalue);
void onVoiceChanged(const LLSD& newvalue);
- void onMouseEnterPresetsCamera();
- void onMouseEnterPresets();
- void onMouseEnterVolume();
- void onMouseEnterNearbyMedia();
+ void onMouseEnterPresetsCamera();
+ void onMouseEnterPresets();
+ void onMouseEnterVolume();
+ void onMouseEnterNearbyMedia();
- static void onClickMediaToggle(void* data);
- static void onClickBalance(void* data);
+ static void onClickMediaToggle(void* data);
+ static void onClickBalance(void* data);
- LLSearchEditor *mFilterEdit;
- LLPanel *mSearchPanel;
- void onUpdateFilterTerm();
+ LLSearchEditor *mFilterEdit;
+ LLPanel *mSearchPanel;
+ void onUpdateFilterTerm();
- std::unique_ptr< ll::statusbar::SearchData > mSearchData;
- void collectSearchableItems();
- void updateMenuSearchVisibility( const LLSD& data );
- void updateMenuSearchPosition(); // depends onto balance position
- void updateBalancePanelPosition();
+ std::unique_ptr< ll::statusbar::SearchData > mSearchData;
+ void collectSearchableItems();
+ void updateMenuSearchVisibility( const LLSD& data );
+ void updateMenuSearchPosition(); // depends onto balance position
+ void updateBalancePanelPosition();
private:
- LLTextBox *mTextTime;
-
- LLStatGraph *mSGBandwidth;
- LLStatGraph *mSGPacketLoss;
-
- LLIconCtrl *mIconPresetsCamera;
- LLIconCtrl *mIconPresetsGraphic;
- LLButton *mBtnVolume;
- LLTextBox *mBoxBalance;
- LLButton *mMediaToggle;
- LLFrameTimer mClockUpdateTimer;
-
- S32 mBalance;
- S32 mHealth;
- S32 mSquareMetersCredit;
- S32 mSquareMetersCommitted;
- LLFrameTimer* mBalanceTimer;
- LLFrameTimer* mHealthTimer;
- LLPanelPresetsCameraPulldown* mPanelPresetsCameraPulldown;
- LLPanelPresetsPulldown* mPanelPresetsPulldown;
- LLPanelVolumePulldown* mPanelVolumePulldown;
- LLPanelNearByMedia* mPanelNearByMedia;
+ LLTextBox *mTextTime;
+
+ LLStatGraph *mSGBandwidth;
+ LLStatGraph *mSGPacketLoss;
+
+ LLIconCtrl *mIconPresetsCamera;
+ LLIconCtrl *mIconPresetsGraphic;
+ LLButton *mBtnVolume;
+ LLTextBox *mBoxBalance;
+ LLButton *mMediaToggle;
+ LLFrameTimer mClockUpdateTimer;
+
+ S32 mBalance;
+ S32 mHealth;
+ S32 mSquareMetersCredit;
+ S32 mSquareMetersCommitted;
+ LLFrameTimer* mBalanceTimer;
+ LLFrameTimer* mHealthTimer;
+ LLPanelPresetsCameraPulldown* mPanelPresetsCameraPulldown;
+ LLPanelPresetsPulldown* mPanelPresetsPulldown;
+ LLPanelVolumePulldown* mPanelVolumePulldown;
+ LLPanelNearByMedia* mPanelNearByMedia;
};
// *HACK: Status bar owns your cached money balance. JC
diff --git a/indra/newview/llstylemap.cpp b/indra/newview/llstylemap.cpp
index 43fe37ac77..49eb27f710 100644
--- a/indra/newview/llstylemap.cpp
+++ b/indra/newview/llstylemap.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llstylemap.cpp
* @brief LLStyleMap class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,48 +36,48 @@
const LLStyle::Params &LLStyleMap::lookupAgent(const LLUUID &source)
{
- // Find this style in the map or add it if not. This map holds links to residents' profiles.
- if (mMap.find(source) == mMap.end())
- {
- LLStyle::Params style_params;
- if (source != LLUUID::null)
- {
- style_params.color.control = "HTMLLinkColor";
- style_params.readonly_color.control = "HTMLLinkColor";
- style_params.link_href = LLSLURL("agent", source, "inspect").getSLURLString();
- }
- mMap[source] = style_params;
- }
- return mMap[source];
+ // Find this style in the map or add it if not. This map holds links to residents' profiles.
+ if (mMap.find(source) == mMap.end())
+ {
+ LLStyle::Params style_params;
+ if (source != LLUUID::null)
+ {
+ style_params.color.control = "HTMLLinkColor";
+ style_params.readonly_color.control = "HTMLLinkColor";
+ style_params.link_href = LLSLURL("agent", source, "inspect").getSLURLString();
+ }
+ mMap[source] = style_params;
+ }
+ return mMap[source];
}
// This is similar to lookupAgent for any generic URL encoded style.
const LLStyle::Params &LLStyleMap::lookup(const LLUUID& id, const std::string& link)
{
- // Find this style in the map or add it if not.
- style_map_t::iterator iter = mMap.find(id);
- if (iter == mMap.end())
- {
- LLStyle::Params style_params;
+ // Find this style in the map or add it if not.
+ style_map_t::iterator iter = mMap.find(id);
+ if (iter == mMap.end())
+ {
+ LLStyle::Params style_params;
- if (id != LLUUID::null && !link.empty())
- {
- style_params.color.control = "HTMLLinkColor";
- style_params.readonly_color.control = "HTMLLinkColor";
- style_params.link_href = link;
- }
- else
- {
- style_params.color = LLColor4::white;
- style_params.readonly_color = LLColor4::white;
- }
- mMap[id] = style_params;
- }
- else
- {
- iter->second.link_href = link;
- }
+ if (id != LLUUID::null && !link.empty())
+ {
+ style_params.color.control = "HTMLLinkColor";
+ style_params.readonly_color.control = "HTMLLinkColor";
+ style_params.link_href = link;
+ }
+ else
+ {
+ style_params.color = LLColor4::white;
+ style_params.readonly_color = LLColor4::white;
+ }
+ mMap[id] = style_params;
+ }
+ else
+ {
+ iter->second.link_href = link;
+ }
- return mMap[id];
+ return mMap[id];
}
diff --git a/indra/newview/llstylemap.h b/indra/newview/llstylemap.h
index 96b3920593..7a9d62efc2 100644
--- a/indra/newview/llstylemap.h
+++ b/indra/newview/llstylemap.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file LLStyleMap.h
* @brief LLStyleMap class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,14 +39,14 @@ typedef std::map<LLUUID, LLStyle::Params> style_map_t;
class LLStyleMap : public LLSingleton<LLStyleMap>
{
- LLSINGLETON_EMPTY_CTOR(LLStyleMap);
+ LLSINGLETON_EMPTY_CTOR(LLStyleMap);
public:
- // Just like the [] accessor but it will add the entry in if it doesn't exist.
- const LLStyle::Params &lookupAgent(const LLUUID &source);
- const LLStyle::Params &lookup(const LLUUID &source, const std::string& link);
+ // Just like the [] accessor but it will add the entry in if it doesn't exist.
+ const LLStyle::Params &lookupAgent(const LLUUID &source);
+ const LLStyle::Params &lookup(const LLUUID &source, const std::string& link);
private:
- style_map_t mMap;
+ style_map_t mMap;
};
#endif // LL_LLSTYLE_MAP_H
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp
index 1418499f8b..93e1f9c774 100644
--- a/indra/newview/llsurface.cpp
+++ b/indra/newview/llsurface.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsurface.cpp
* @brief Implementation of LLSurface class
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -66,82 +66,82 @@ S32 LLSurface::sTextureSize = 256;
// ---------------- LLSurface:: Public Members ---------------
LLSurface::LLSurface(U32 type, LLViewerRegion *regionp) :
- mGridsPerEdge(0),
- mOOGridsPerEdge(0.f),
- mPatchesPerEdge(0),
- mNumberOfPatches(0),
- mType(type),
- mDetailTextureScale(0.f),
- mOriginGlobal(0.0, 0.0, 0.0),
- mSTexturep(NULL),
- mWaterTexturep(NULL),
- mGridsPerPatchEdge(0),
- mMetersPerGrid(1.0f),
- mMetersPerEdge(1.0f),
- mRegionp(regionp)
+ mGridsPerEdge(0),
+ mOOGridsPerEdge(0.f),
+ mPatchesPerEdge(0),
+ mNumberOfPatches(0),
+ mType(type),
+ mDetailTextureScale(0.f),
+ mOriginGlobal(0.0, 0.0, 0.0),
+ mSTexturep(NULL),
+ mWaterTexturep(NULL),
+ mGridsPerPatchEdge(0),
+ mMetersPerGrid(1.0f),
+ mMetersPerEdge(1.0f),
+ mRegionp(regionp)
{
- // Surface data
- mSurfaceZ = NULL;
- mNorm = NULL;
+ // Surface data
+ mSurfaceZ = NULL;
+ mNorm = NULL;
- // Patch data
- mPatchList = NULL;
+ // Patch data
+ mPatchList = NULL;
- // One of each for each camera
- mVisiblePatchCount = 0;
+ // One of each for each camera
+ mVisiblePatchCount = 0;
- mHasZData = FALSE;
- // "uninitialized" min/max z
- mMinZ = 10000.f;
- mMaxZ = -10000.f;
+ mHasZData = FALSE;
+ // "uninitialized" min/max z
+ mMinZ = 10000.f;
+ mMaxZ = -10000.f;
- mWaterObjp = NULL;
+ mWaterObjp = NULL;
- // In here temporarily.
- mSurfacePatchUpdateCount = 0;
+ // In here temporarily.
+ mSurfacePatchUpdateCount = 0;
- for (S32 i = 0; i < 8; i++)
- {
- mNeighbors[i] = NULL;
- }
+ for (S32 i = 0; i < 8; i++)
+ {
+ mNeighbors[i] = NULL;
+ }
}
LLSurface::~LLSurface()
{
- delete [] mSurfaceZ;
- mSurfaceZ = NULL;
-
- delete [] mNorm;
-
- mGridsPerEdge = 0;
- mGridsPerPatchEdge = 0;
- mPatchesPerEdge = 0;
- mNumberOfPatches = 0;
- destroyPatchData();
-
- LLDrawPoolTerrain *poolp = (LLDrawPoolTerrain*) gPipeline.findPool(LLDrawPool::POOL_TERRAIN, mSTexturep);
- if (!poolp)
- {
- LL_WARNS() << "No pool for terrain on destruction!" << LL_ENDL;
- }
- else if (poolp->mReferences.empty())
- {
- gPipeline.removePool(poolp);
- // Don't enable this until we blitz the draw pool for it as well. -- djs
- if (mSTexturep)
- {
- mSTexturep = NULL;
- }
- if (mWaterTexturep)
- {
- mWaterTexturep = NULL;
- }
- }
- else
- {
- LL_ERRS() << "Terrain pool not empty!" << LL_ENDL;
- }
+ delete [] mSurfaceZ;
+ mSurfaceZ = NULL;
+
+ delete [] mNorm;
+
+ mGridsPerEdge = 0;
+ mGridsPerPatchEdge = 0;
+ mPatchesPerEdge = 0;
+ mNumberOfPatches = 0;
+ destroyPatchData();
+
+ LLDrawPoolTerrain *poolp = (LLDrawPoolTerrain*) gPipeline.findPool(LLDrawPool::POOL_TERRAIN, mSTexturep);
+ if (!poolp)
+ {
+ LL_WARNS() << "No pool for terrain on destruction!" << LL_ENDL;
+ }
+ else if (poolp->mReferences.empty())
+ {
+ gPipeline.removePool(poolp);
+ // Don't enable this until we blitz the draw pool for it as well. -- djs
+ if (mSTexturep)
+ {
+ mSTexturep = NULL;
+ }
+ if (mWaterTexturep)
+ {
+ mWaterTexturep = NULL;
+ }
+ }
+ else
+ {
+ LL_ERRS() << "Terrain pool not empty!" << LL_ENDL;
+ }
}
void LLSurface::initClasses()
@@ -150,537 +150,537 @@ void LLSurface::initClasses()
void LLSurface::setRegion(LLViewerRegion *regionp)
{
- mRegionp = regionp;
- mWaterObjp = NULL; // depends on regionp, needs recreating
+ mRegionp = regionp;
+ mWaterObjp = NULL; // depends on regionp, needs recreating
}
// Assumes that arguments are powers of 2, and that
-// grids_per_edge / grids_per_patch_edge = power of 2
+// grids_per_edge / grids_per_patch_edge = power of 2
void LLSurface::create(const S32 grids_per_edge,
- const S32 grids_per_patch_edge,
- const LLVector3d &origin_global,
- const F32 width)
+ const S32 grids_per_patch_edge,
+ const LLVector3d &origin_global,
+ const F32 width)
{
- // Initialize various constants for the surface
- mGridsPerEdge = grids_per_edge + 1; // Add 1 for the east and north buffer
- mOOGridsPerEdge = 1.f / mGridsPerEdge;
- mGridsPerPatchEdge = grids_per_patch_edge;
- mPatchesPerEdge = (mGridsPerEdge - 1) / mGridsPerPatchEdge;
- mNumberOfPatches = mPatchesPerEdge * mPatchesPerEdge;
- mMetersPerGrid = width / ((F32)(mGridsPerEdge - 1));
- mMetersPerEdge = mMetersPerGrid * (mGridsPerEdge - 1);
-
- mOriginGlobal.setVec(origin_global);
-
- mPVArray.create(mGridsPerEdge, mGridsPerPatchEdge, LLWorld::getInstance()->getRegionScale());
-
- S32 number_of_grids = mGridsPerEdge * mGridsPerEdge;
-
- /////////////////////////////////////
- //
- // Initialize data arrays for surface
- ///
- mSurfaceZ = new F32[number_of_grids];
- mNorm = new LLVector3[number_of_grids];
-
- // Reset the surface to be a flat square grid
- for(S32 i=0; i < number_of_grids; i++)
- {
- // Surface is flat and zero
- // Normals all point up
- mSurfaceZ[i] = 0.0f;
- mNorm[i].setVec(0.f, 0.f, 1.f);
- }
+ // Initialize various constants for the surface
+ mGridsPerEdge = grids_per_edge + 1; // Add 1 for the east and north buffer
+ mOOGridsPerEdge = 1.f / mGridsPerEdge;
+ mGridsPerPatchEdge = grids_per_patch_edge;
+ mPatchesPerEdge = (mGridsPerEdge - 1) / mGridsPerPatchEdge;
+ mNumberOfPatches = mPatchesPerEdge * mPatchesPerEdge;
+ mMetersPerGrid = width / ((F32)(mGridsPerEdge - 1));
+ mMetersPerEdge = mMetersPerGrid * (mGridsPerEdge - 1);
+
+ mOriginGlobal.setVec(origin_global);
+
+ mPVArray.create(mGridsPerEdge, mGridsPerPatchEdge, LLWorld::getInstance()->getRegionScale());
+
+ S32 number_of_grids = mGridsPerEdge * mGridsPerEdge;
+
+ /////////////////////////////////////
+ //
+ // Initialize data arrays for surface
+ ///
+ mSurfaceZ = new F32[number_of_grids];
+ mNorm = new LLVector3[number_of_grids];
+
+ // Reset the surface to be a flat square grid
+ for(S32 i=0; i < number_of_grids; i++)
+ {
+ // Surface is flat and zero
+ // Normals all point up
+ mSurfaceZ[i] = 0.0f;
+ mNorm[i].setVec(0.f, 0.f, 1.f);
+ }
- mVisiblePatchCount = 0;
+ mVisiblePatchCount = 0;
- ///////////////////////
- //
- // Initialize textures
- //
+ ///////////////////////
+ //
+ // Initialize textures
+ //
- initTextures();
+ initTextures();
- // Has to be done after texture initialization
- createPatchData();
+ // Has to be done after texture initialization
+ createPatchData();
}
LLViewerTexture* LLSurface::getSTexture()
{
- if (mSTexturep.notNull() && !mSTexturep->hasGLTexture())
- {
- createSTexture();
- }
- return mSTexturep;
+ if (mSTexturep.notNull() && !mSTexturep->hasGLTexture())
+ {
+ createSTexture();
+ }
+ return mSTexturep;
}
LLViewerTexture* LLSurface::getWaterTexture()
{
- if (mWaterTexturep.notNull() && !mWaterTexturep->hasGLTexture())
- {
- createWaterTexture();
- }
- return mWaterTexturep;
+ if (mWaterTexturep.notNull() && !mWaterTexturep->hasGLTexture())
+ {
+ createWaterTexture();
+ }
+ return mWaterTexturep;
}
void LLSurface::createSTexture()
{
- if (!mSTexturep)
- {
- // Fill with dummy gray data.
- // GL NOT ACTIVE HERE
- LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize, sTextureSize, 3);
- U8 *default_texture = raw->getData();
- for (S32 i = 0; i < sTextureSize; i++)
- {
- for (S32 j = 0; j < sTextureSize; j++)
- {
- *(default_texture + (i*sTextureSize + j)*3) = 128;
- *(default_texture + (i*sTextureSize + j)*3 + 1) = 128;
- *(default_texture + (i*sTextureSize + j)*3 + 2) = 128;
- }
- }
-
- mSTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
- mSTexturep->dontDiscard();
- gGL.getTexUnit(0)->bind(mSTexturep);
- mSTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
- }
+ if (!mSTexturep)
+ {
+ // Fill with dummy gray data.
+ // GL NOT ACTIVE HERE
+ LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize, sTextureSize, 3);
+ U8 *default_texture = raw->getData();
+ for (S32 i = 0; i < sTextureSize; i++)
+ {
+ for (S32 j = 0; j < sTextureSize; j++)
+ {
+ *(default_texture + (i*sTextureSize + j)*3) = 128;
+ *(default_texture + (i*sTextureSize + j)*3 + 1) = 128;
+ *(default_texture + (i*sTextureSize + j)*3 + 2) = 128;
+ }
+ }
+
+ mSTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
+ mSTexturep->dontDiscard();
+ gGL.getTexUnit(0)->bind(mSTexturep);
+ mSTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
}
void LLSurface::createWaterTexture()
{
- if (!mWaterTexturep)
- {
- // Create the water texture
- LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize/2, sTextureSize/2, 4);
- U8 *default_texture = raw->getData();
- for (S32 i = 0; i < sTextureSize/2; i++)
- {
- for (S32 j = 0; j < sTextureSize/2; j++)
- {
- *(default_texture + (i*sTextureSize/2 + j)*4) = MAX_WATER_COLOR.mV[0];
- *(default_texture + (i*sTextureSize/2 + j)*4 + 1) = MAX_WATER_COLOR.mV[1];
- *(default_texture + (i*sTextureSize/2 + j)*4 + 2) = MAX_WATER_COLOR.mV[2];
- *(default_texture + (i*sTextureSize/2 + j)*4 + 3) = MAX_WATER_COLOR.mV[3];
- }
- }
-
- mWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
- mWaterTexturep->dontDiscard();
- gGL.getTexUnit(0)->bind(mWaterTexturep);
- mWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
- }
+ if (!mWaterTexturep)
+ {
+ // Create the water texture
+ LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize/2, sTextureSize/2, 4);
+ U8 *default_texture = raw->getData();
+ for (S32 i = 0; i < sTextureSize/2; i++)
+ {
+ for (S32 j = 0; j < sTextureSize/2; j++)
+ {
+ *(default_texture + (i*sTextureSize/2 + j)*4) = MAX_WATER_COLOR.mV[0];
+ *(default_texture + (i*sTextureSize/2 + j)*4 + 1) = MAX_WATER_COLOR.mV[1];
+ *(default_texture + (i*sTextureSize/2 + j)*4 + 2) = MAX_WATER_COLOR.mV[2];
+ *(default_texture + (i*sTextureSize/2 + j)*4 + 3) = MAX_WATER_COLOR.mV[3];
+ }
+ }
+
+ mWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
+ mWaterTexturep->dontDiscard();
+ gGL.getTexUnit(0)->bind(mWaterTexturep);
+ mWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
}
void LLSurface::initTextures()
{
- ///////////////////////
- //
- // Main surface texture
- //
- createSTexture();
-
- ///////////////////////
- //
- // Water texture
- //
- if (gSavedSettings.getBOOL("RenderWater") )
- {
- createWaterTexture();
- mWaterObjp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, mRegionp);
- gPipeline.createObject(mWaterObjp);
- LLVector3d water_pos_global = from_region_handle(mRegionp->getHandle());
- water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT); // region doesn't have a valid water height yet
- mWaterObjp->setPositionGlobal(water_pos_global);
- }
+ ///////////////////////
+ //
+ // Main surface texture
+ //
+ createSTexture();
+
+ ///////////////////////
+ //
+ // Water texture
+ //
+ if (gSavedSettings.getBOOL("RenderWater") )
+ {
+ createWaterTexture();
+ mWaterObjp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, mRegionp);
+ gPipeline.createObject(mWaterObjp);
+ LLVector3d water_pos_global = from_region_handle(mRegionp->getHandle());
+ water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT); // region doesn't have a valid water height yet
+ mWaterObjp->setPositionGlobal(water_pos_global);
+ }
}
-void LLSurface::setOriginGlobal(const LLVector3d &origin_global)
+void LLSurface::setOriginGlobal(const LLVector3d &origin_global)
{
- LLVector3d new_origin_global;
- mOriginGlobal = origin_global;
- LLSurfacePatch *patchp;
- S32 i, j;
- // Need to update the southwest corners of the patches
- for (j=0; j<mPatchesPerEdge; j++)
- {
- for (i=0; i<mPatchesPerEdge; i++)
- {
- patchp = getPatch(i, j);
-
- new_origin_global = patchp->getOriginGlobal();
-
- new_origin_global.mdV[0] = mOriginGlobal.mdV[0] + i * mMetersPerGrid * mGridsPerPatchEdge;
- new_origin_global.mdV[1] = mOriginGlobal.mdV[1] + j * mMetersPerGrid * mGridsPerPatchEdge;
- patchp->setOriginGlobal(new_origin_global);
- }
- }
-
- // Hack!
- if (mWaterObjp.notNull() && mWaterObjp->mDrawable.notNull())
- {
- const F64 x = origin_global.mdV[VX] + 128.0;
- const F64 y = origin_global.mdV[VY] + 128.0;
- const F64 z = mWaterObjp->getPositionGlobal().mdV[VZ];
-
- LLVector3d water_origin_global(x, y, z);
-
- mWaterObjp->setPositionGlobal(water_origin_global);
- }
+ LLVector3d new_origin_global;
+ mOriginGlobal = origin_global;
+ LLSurfacePatch *patchp;
+ S32 i, j;
+ // Need to update the southwest corners of the patches
+ for (j=0; j<mPatchesPerEdge; j++)
+ {
+ for (i=0; i<mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(i, j);
+
+ new_origin_global = patchp->getOriginGlobal();
+
+ new_origin_global.mdV[0] = mOriginGlobal.mdV[0] + i * mMetersPerGrid * mGridsPerPatchEdge;
+ new_origin_global.mdV[1] = mOriginGlobal.mdV[1] + j * mMetersPerGrid * mGridsPerPatchEdge;
+ patchp->setOriginGlobal(new_origin_global);
+ }
+ }
+
+ // Hack!
+ if (mWaterObjp.notNull() && mWaterObjp->mDrawable.notNull())
+ {
+ const F64 x = origin_global.mdV[VX] + 128.0;
+ const F64 y = origin_global.mdV[VY] + 128.0;
+ const F64 z = mWaterObjp->getPositionGlobal().mdV[VZ];
+
+ LLVector3d water_origin_global(x, y, z);
+
+ mWaterObjp->setPositionGlobal(water_origin_global);
+ }
}
void LLSurface::getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions )
{
- S32 i;
- for (i = 0; i < 8; i++)
- {
- if ( mNeighbors[i] != NULL )
- {
- uniqueRegions.push_back( mNeighbors[i]->getRegion() );
- }
- }
+ S32 i;
+ for (i = 0; i < 8; i++)
+ {
+ if ( mNeighbors[i] != NULL )
+ {
+ uniqueRegions.push_back( mNeighbors[i]->getRegion() );
+ }
+ }
}
void LLSurface::getNeighboringRegionsStatus( std::vector<S32>& regions )
{
- S32 i;
- for (i = 0; i < 8; i++)
- {
- if ( mNeighbors[i] != NULL )
- {
- regions.push_back( i );
- }
- }
+ S32 i;
+ for (i = 0; i < 8; i++)
+ {
+ if ( mNeighbors[i] != NULL )
+ {
+ regions.push_back( i );
+ }
+ }
}
void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction)
{
- S32 i;
- LLSurfacePatch *patchp, *neighbor_patchp;
-
- mNeighbors[direction] = neighborp;
- neighborp->mNeighbors[gDirOpposite[direction]] = this;
-
- // Connect patches
- if (NORTHEAST == direction)
- {
- patchp = getPatch(mPatchesPerEdge - 1, mPatchesPerEdge - 1);
- neighbor_patchp = neighborp->getPatch(0, 0);
-
- patchp->connectNeighbor(neighbor_patchp, direction);
- neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
-
- patchp->updateNorthEdge(); // Only update one of north or east.
- patchp->dirtyZ();
- }
- else if (NORTHWEST == direction)
- {
- patchp = getPatch(0, mPatchesPerEdge - 1);
- neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, 0);
-
- patchp->connectNeighbor(neighbor_patchp, direction);
- neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
- }
- else if (SOUTHWEST == direction)
- {
- patchp = getPatch(0, 0);
- neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, mPatchesPerEdge - 1);
-
- patchp->connectNeighbor(neighbor_patchp, direction);
- neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
-
- neighbor_patchp->updateNorthEdge(); // Only update one of north or east.
- neighbor_patchp->dirtyZ();
- }
- else if (SOUTHEAST == direction)
- {
- patchp = getPatch(mPatchesPerEdge - 1, 0);
- neighbor_patchp = neighborp->getPatch(0, mPatchesPerEdge - 1);
-
- patchp->connectNeighbor(neighbor_patchp, direction);
- neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
- }
- else if (EAST == direction)
- {
- // Do east/west connections, first
- for (i = 0; i < (S32)mPatchesPerEdge; i++)
- {
- patchp = getPatch(mPatchesPerEdge - 1, i);
- neighbor_patchp = neighborp->getPatch(0, i);
-
- patchp->connectNeighbor(neighbor_patchp, direction);
- neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
-
- patchp->updateEastEdge();
- patchp->dirtyZ();
- }
-
- // Now do northeast/southwest connections
- for (i = 0; i < (S32)mPatchesPerEdge - 1; i++)
- {
- patchp = getPatch(mPatchesPerEdge - 1, i);
- neighbor_patchp = neighborp->getPatch(0, i+1);
-
- patchp->connectNeighbor(neighbor_patchp, NORTHEAST);
- neighbor_patchp->connectNeighbor(patchp, SOUTHWEST);
- }
- // Now do southeast/northwest connections
- for (i = 1; i < (S32)mPatchesPerEdge; i++)
- {
- patchp = getPatch(mPatchesPerEdge - 1, i);
- neighbor_patchp = neighborp->getPatch(0, i-1);
-
- patchp->connectNeighbor(neighbor_patchp, SOUTHEAST);
- neighbor_patchp->connectNeighbor(patchp, NORTHWEST);
- }
- }
- else if (NORTH == direction)
- {
- // Do north/south connections, first
- for (i = 0; i < (S32)mPatchesPerEdge; i++)
- {
- patchp = getPatch(i, mPatchesPerEdge - 1);
- neighbor_patchp = neighborp->getPatch(i, 0);
-
- patchp->connectNeighbor(neighbor_patchp, direction);
- neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
-
- patchp->updateNorthEdge();
- patchp->dirtyZ();
- }
-
- // Do northeast/southwest connections
- for (i = 0; i < (S32)mPatchesPerEdge - 1; i++)
- {
- patchp = getPatch(i, mPatchesPerEdge - 1);
- neighbor_patchp = neighborp->getPatch(i+1, 0);
-
- patchp->connectNeighbor(neighbor_patchp, NORTHEAST);
- neighbor_patchp->connectNeighbor(patchp, SOUTHWEST);
- }
- // Do southeast/northwest connections
- for (i = 1; i < (S32)mPatchesPerEdge; i++)
- {
- patchp = getPatch(i, mPatchesPerEdge - 1);
- neighbor_patchp = neighborp->getPatch(i-1, 0);
-
- patchp->connectNeighbor(neighbor_patchp, NORTHWEST);
- neighbor_patchp->connectNeighbor(patchp, SOUTHEAST);
- }
- }
- else if (WEST == direction)
- {
- // Do east/west connections, first
- for (i = 0; i < mPatchesPerEdge; i++)
- {
- patchp = getPatch(0, i);
- neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i);
-
- patchp->connectNeighbor(neighbor_patchp, direction);
- neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
-
- neighbor_patchp->updateEastEdge();
- neighbor_patchp->dirtyZ();
- }
-
- // Now do northeast/southwest connections
- for (i = 1; i < mPatchesPerEdge; i++)
- {
- patchp = getPatch(0, i);
- neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i - 1);
-
- patchp->connectNeighbor(neighbor_patchp, SOUTHWEST);
- neighbor_patchp->connectNeighbor(patchp, NORTHEAST);
- }
-
- // Now do northwest/southeast connections
- for (i = 0; i < mPatchesPerEdge - 1; i++)
- {
- patchp = getPatch(0, i);
- neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i + 1);
-
- patchp->connectNeighbor(neighbor_patchp, NORTHWEST);
- neighbor_patchp->connectNeighbor(patchp, SOUTHEAST);
- }
- }
- else if (SOUTH == direction)
- {
- // Do north/south connections, first
- for (i = 0; i < mPatchesPerEdge; i++)
- {
- patchp = getPatch(i, 0);
- neighbor_patchp = neighborp->getPatch(i, mPatchesPerEdge - 1);
-
- patchp->connectNeighbor(neighbor_patchp, direction);
- neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
-
- neighbor_patchp->updateNorthEdge();
- neighbor_patchp->dirtyZ();
- }
-
- // Now do northeast/southwest connections
- for (i = 1; i < mPatchesPerEdge; i++)
- {
- patchp = getPatch(i, 0);
- neighbor_patchp = neighborp->getPatch(i - 1, mPatchesPerEdge - 1);
-
- patchp->connectNeighbor(neighbor_patchp, SOUTHWEST);
- neighbor_patchp->connectNeighbor(patchp, NORTHEAST);
- }
- // Now do northeast/southwest connections
- for (i = 0; i < mPatchesPerEdge - 1; i++)
- {
- patchp = getPatch(i, 0);
- neighbor_patchp = neighborp->getPatch(i + 1, mPatchesPerEdge - 1);
-
- patchp->connectNeighbor(neighbor_patchp, SOUTHEAST);
- neighbor_patchp->connectNeighbor(patchp, NORTHWEST);
- }
- }
+ S32 i;
+ LLSurfacePatch *patchp, *neighbor_patchp;
+
+ mNeighbors[direction] = neighborp;
+ neighborp->mNeighbors[gDirOpposite[direction]] = this;
+
+ // Connect patches
+ if (NORTHEAST == direction)
+ {
+ patchp = getPatch(mPatchesPerEdge - 1, mPatchesPerEdge - 1);
+ neighbor_patchp = neighborp->getPatch(0, 0);
+
+ patchp->connectNeighbor(neighbor_patchp, direction);
+ neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
+
+ patchp->updateNorthEdge(); // Only update one of north or east.
+ patchp->dirtyZ();
+ }
+ else if (NORTHWEST == direction)
+ {
+ patchp = getPatch(0, mPatchesPerEdge - 1);
+ neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, 0);
+
+ patchp->connectNeighbor(neighbor_patchp, direction);
+ neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
+ }
+ else if (SOUTHWEST == direction)
+ {
+ patchp = getPatch(0, 0);
+ neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, mPatchesPerEdge - 1);
+
+ patchp->connectNeighbor(neighbor_patchp, direction);
+ neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
+
+ neighbor_patchp->updateNorthEdge(); // Only update one of north or east.
+ neighbor_patchp->dirtyZ();
+ }
+ else if (SOUTHEAST == direction)
+ {
+ patchp = getPatch(mPatchesPerEdge - 1, 0);
+ neighbor_patchp = neighborp->getPatch(0, mPatchesPerEdge - 1);
+
+ patchp->connectNeighbor(neighbor_patchp, direction);
+ neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
+ }
+ else if (EAST == direction)
+ {
+ // Do east/west connections, first
+ for (i = 0; i < (S32)mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(mPatchesPerEdge - 1, i);
+ neighbor_patchp = neighborp->getPatch(0, i);
+
+ patchp->connectNeighbor(neighbor_patchp, direction);
+ neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
+
+ patchp->updateEastEdge();
+ patchp->dirtyZ();
+ }
+
+ // Now do northeast/southwest connections
+ for (i = 0; i < (S32)mPatchesPerEdge - 1; i++)
+ {
+ patchp = getPatch(mPatchesPerEdge - 1, i);
+ neighbor_patchp = neighborp->getPatch(0, i+1);
+
+ patchp->connectNeighbor(neighbor_patchp, NORTHEAST);
+ neighbor_patchp->connectNeighbor(patchp, SOUTHWEST);
+ }
+ // Now do southeast/northwest connections
+ for (i = 1; i < (S32)mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(mPatchesPerEdge - 1, i);
+ neighbor_patchp = neighborp->getPatch(0, i-1);
+
+ patchp->connectNeighbor(neighbor_patchp, SOUTHEAST);
+ neighbor_patchp->connectNeighbor(patchp, NORTHWEST);
+ }
+ }
+ else if (NORTH == direction)
+ {
+ // Do north/south connections, first
+ for (i = 0; i < (S32)mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(i, mPatchesPerEdge - 1);
+ neighbor_patchp = neighborp->getPatch(i, 0);
+
+ patchp->connectNeighbor(neighbor_patchp, direction);
+ neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
+
+ patchp->updateNorthEdge();
+ patchp->dirtyZ();
+ }
+
+ // Do northeast/southwest connections
+ for (i = 0; i < (S32)mPatchesPerEdge - 1; i++)
+ {
+ patchp = getPatch(i, mPatchesPerEdge - 1);
+ neighbor_patchp = neighborp->getPatch(i+1, 0);
+
+ patchp->connectNeighbor(neighbor_patchp, NORTHEAST);
+ neighbor_patchp->connectNeighbor(patchp, SOUTHWEST);
+ }
+ // Do southeast/northwest connections
+ for (i = 1; i < (S32)mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(i, mPatchesPerEdge - 1);
+ neighbor_patchp = neighborp->getPatch(i-1, 0);
+
+ patchp->connectNeighbor(neighbor_patchp, NORTHWEST);
+ neighbor_patchp->connectNeighbor(patchp, SOUTHEAST);
+ }
+ }
+ else if (WEST == direction)
+ {
+ // Do east/west connections, first
+ for (i = 0; i < mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(0, i);
+ neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i);
+
+ patchp->connectNeighbor(neighbor_patchp, direction);
+ neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
+
+ neighbor_patchp->updateEastEdge();
+ neighbor_patchp->dirtyZ();
+ }
+
+ // Now do northeast/southwest connections
+ for (i = 1; i < mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(0, i);
+ neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i - 1);
+
+ patchp->connectNeighbor(neighbor_patchp, SOUTHWEST);
+ neighbor_patchp->connectNeighbor(patchp, NORTHEAST);
+ }
+
+ // Now do northwest/southeast connections
+ for (i = 0; i < mPatchesPerEdge - 1; i++)
+ {
+ patchp = getPatch(0, i);
+ neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i + 1);
+
+ patchp->connectNeighbor(neighbor_patchp, NORTHWEST);
+ neighbor_patchp->connectNeighbor(patchp, SOUTHEAST);
+ }
+ }
+ else if (SOUTH == direction)
+ {
+ // Do north/south connections, first
+ for (i = 0; i < mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(i, 0);
+ neighbor_patchp = neighborp->getPatch(i, mPatchesPerEdge - 1);
+
+ patchp->connectNeighbor(neighbor_patchp, direction);
+ neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
+
+ neighbor_patchp->updateNorthEdge();
+ neighbor_patchp->dirtyZ();
+ }
+
+ // Now do northeast/southwest connections
+ for (i = 1; i < mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(i, 0);
+ neighbor_patchp = neighborp->getPatch(i - 1, mPatchesPerEdge - 1);
+
+ patchp->connectNeighbor(neighbor_patchp, SOUTHWEST);
+ neighbor_patchp->connectNeighbor(patchp, NORTHEAST);
+ }
+ // Now do northeast/southwest connections
+ for (i = 0; i < mPatchesPerEdge - 1; i++)
+ {
+ patchp = getPatch(i, 0);
+ neighbor_patchp = neighborp->getPatch(i + 1, mPatchesPerEdge - 1);
+
+ patchp->connectNeighbor(neighbor_patchp, SOUTHEAST);
+ neighbor_patchp->connectNeighbor(patchp, NORTHWEST);
+ }
+ }
}
void LLSurface::disconnectNeighbor(LLSurface *surfacep)
{
- S32 i;
- for (i = 0; i < 8; i++)
- {
- if (surfacep == mNeighbors[i])
- {
- mNeighbors[i] = NULL;
- }
- }
-
- // Iterate through surface patches, removing any connectivity to removed surface.
- for (i = 0; i < mNumberOfPatches; i++)
- {
- (mPatchList + i)->disconnectNeighbor(surfacep);
- }
+ S32 i;
+ for (i = 0; i < 8; i++)
+ {
+ if (surfacep == mNeighbors[i])
+ {
+ mNeighbors[i] = NULL;
+ }
+ }
+
+ // Iterate through surface patches, removing any connectivity to removed surface.
+ for (i = 0; i < mNumberOfPatches; i++)
+ {
+ (mPatchList + i)->disconnectNeighbor(surfacep);
+ }
}
void LLSurface::disconnectAllNeighbors()
{
- S32 i;
- for (i = 0; i < 8; i++)
- {
- if (mNeighbors[i])
- {
- mNeighbors[i]->disconnectNeighbor(this);
- mNeighbors[i] = NULL;
- }
- }
+ S32 i;
+ for (i = 0; i < 8; i++)
+ {
+ if (mNeighbors[i])
+ {
+ mNeighbors[i]->disconnectNeighbor(this);
+ mNeighbors[i] = NULL;
+ }
+ }
}
const LLVector3d &LLSurface::getOriginGlobal() const
{
- return mOriginGlobal;
+ return mOriginGlobal;
}
LLVector3 LLSurface::getOriginAgent() const
{
- return gAgent.getPosAgentFromGlobal(mOriginGlobal);
+ return gAgent.getPosAgentFromGlobal(mOriginGlobal);
}
F32 LLSurface::getMetersPerGrid() const
{
- return mMetersPerGrid;
+ return mMetersPerGrid;
}
S32 LLSurface::getGridsPerEdge() const
{
- return mGridsPerEdge;
+ return mGridsPerEdge;
}
S32 LLSurface::getPatchesPerEdge() const
{
- return mPatchesPerEdge;
+ return mPatchesPerEdge;
}
S32 LLSurface::getGridsPerPatchEdge() const
{
- return mGridsPerPatchEdge;
+ return mGridsPerPatchEdge;
}
void LLSurface::moveZ(const S32 x, const S32 y, const F32 delta)
{
- llassert(x >= 0);
- llassert(y >= 0);
- llassert(x < mGridsPerEdge);
- llassert(y < mGridsPerEdge);
- mSurfaceZ[x + y*mGridsPerEdge] += delta;
+ llassert(x >= 0);
+ llassert(y >= 0);
+ llassert(x < mGridsPerEdge);
+ llassert(y < mGridsPerEdge);
+ mSurfaceZ[x + y*mGridsPerEdge] += delta;
}
-void LLSurface::updatePatchVisibilities(LLAgent &agent)
+void LLSurface::updatePatchVisibilities(LLAgent &agent)
{
- if (gShiftFrame)
- {
- return;
- }
-
- LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(gAgentCamera.getCameraPositionGlobal());
-
- LLSurfacePatch *patchp;
-
- mVisiblePatchCount = 0;
- for (S32 i=0; i<mNumberOfPatches; i++)
- {
- patchp = mPatchList + i;
-
- patchp->updateVisibility();
- if (patchp->getVisible())
- {
- mVisiblePatchCount++;
- patchp->updateCameraDistanceRegion(pos_region);
- }
- }
+ if (gShiftFrame)
+ {
+ return;
+ }
+
+ LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(gAgentCamera.getCameraPositionGlobal());
+
+ LLSurfacePatch *patchp;
+
+ mVisiblePatchCount = 0;
+ for (S32 i=0; i<mNumberOfPatches; i++)
+ {
+ patchp = mPatchList + i;
+
+ patchp->updateVisibility();
+ if (patchp->getVisible())
+ {
+ mVisiblePatchCount++;
+ patchp->updateCameraDistanceRegion(pos_region);
+ }
+ }
}
BOOL LLSurface::idleUpdate(F32 max_update_time)
{
- if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TERRAIN))
- {
- return FALSE;
- }
-
- // Perform idle time update of non-critical stuff.
- // In this case, texture and normal updates.
- LLTimer update_timer;
- BOOL did_update = FALSE;
-
- // If the Z height data has changed, we need to rebuild our
- // property line vertex arrays.
- if (mDirtyPatchList.size() > 0)
- {
- getRegion()->dirtyHeights();
- }
-
- // Always call updateNormals() / updateVerticalStats()
- // every frame to avoid artifacts
- for(std::set<LLSurfacePatch *>::iterator iter = mDirtyPatchList.begin();
- iter != mDirtyPatchList.end(); )
- {
- std::set<LLSurfacePatch *>::iterator curiter = iter++;
- LLSurfacePatch *patchp = *curiter;
- patchp->updateNormals();
- patchp->updateVerticalStats();
- if (max_update_time == 0.f || update_timer.getElapsedTimeF32() < max_update_time)
- {
- if (patchp->updateTexture())
- {
- did_update = TRUE;
- patchp->clearDirty();
- mDirtyPatchList.erase(curiter);
- }
- }
- }
+ if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TERRAIN))
+ {
+ return FALSE;
+ }
+
+ // Perform idle time update of non-critical stuff.
+ // In this case, texture and normal updates.
+ LLTimer update_timer;
+ BOOL did_update = FALSE;
+
+ // If the Z height data has changed, we need to rebuild our
+ // property line vertex arrays.
+ if (mDirtyPatchList.size() > 0)
+ {
+ getRegion()->dirtyHeights();
+ }
+
+ // Always call updateNormals() / updateVerticalStats()
+ // every frame to avoid artifacts
+ for(std::set<LLSurfacePatch *>::iterator iter = mDirtyPatchList.begin();
+ iter != mDirtyPatchList.end(); )
+ {
+ std::set<LLSurfacePatch *>::iterator curiter = iter++;
+ LLSurfacePatch *patchp = *curiter;
+ patchp->updateNormals();
+ patchp->updateVerticalStats();
+ if (max_update_time == 0.f || update_timer.getElapsedTimeF32() < max_update_time)
+ {
+ if (patchp->updateTexture())
+ {
+ did_update = TRUE;
+ patchp->clearDirty();
+ mDirtyPatchList.erase(curiter);
+ }
+ }
+ }
if (did_update)
{
@@ -688,73 +688,73 @@ BOOL LLSurface::idleUpdate(F32 max_update_time)
mRegionp->updateReflectionProbes();
}
- return did_update;
+ return did_update;
}
-void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL b_large_patch)
+void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL b_large_patch)
{
- LLPatchHeader ph;
- S32 j, i;
- S32 patch[LARGE_PATCH_SIZE*LARGE_PATCH_SIZE];
- LLSurfacePatch *patchp;
-
- init_patch_decompressor(gopp->patch_size);
- gopp->stride = mGridsPerEdge;
- set_group_of_patch_header(gopp);
-
- while (1)
- {
- decode_patch_header(bitpack, &ph);
- if (ph.quant_wbits == END_OF_PATCHES)
- {
- break;
- }
-
- i = ph.patchids >> 5;
- j = ph.patchids & 0x1F;
-
- if ((i >= mPatchesPerEdge) || (j >= mPatchesPerEdge))
- {
- LL_WARNS() << "Received invalid terrain packet - patch header patch ID incorrect!"
- << " patches per edge " << mPatchesPerEdge
- << " i " << i
- << " j " << j
- << " dc_offset " << ph.dc_offset
- << " range " << (S32)ph.range
- << " quant_wbits " << (S32)ph.quant_wbits
- << " patchids " << (S32)ph.patchids
- << LL_ENDL;
- return;
- }
-
- patchp = &mPatchList[j*mPatchesPerEdge + i];
-
-
- decode_patch(bitpack, patch);
- decompress_patch(patchp->getDataZ(), patch, &ph);
-
- // Update edges for neighbors. Need to guarantee that this gets done before we generate vertical stats.
- patchp->updateNorthEdge();
- patchp->updateEastEdge();
- if (patchp->getNeighborPatch(WEST))
- {
- patchp->getNeighborPatch(WEST)->updateEastEdge();
- }
- if (patchp->getNeighborPatch(SOUTHWEST))
- {
- patchp->getNeighborPatch(SOUTHWEST)->updateEastEdge();
- patchp->getNeighborPatch(SOUTHWEST)->updateNorthEdge();
- }
- if (patchp->getNeighborPatch(SOUTH))
- {
- patchp->getNeighborPatch(SOUTH)->updateNorthEdge();
- }
-
- // Dirty patch statistics, and flag that the patch has data.
- patchp->dirtyZ();
- patchp->setHasReceivedData();
- }
+ LLPatchHeader ph;
+ S32 j, i;
+ S32 patch[LARGE_PATCH_SIZE*LARGE_PATCH_SIZE];
+ LLSurfacePatch *patchp;
+
+ init_patch_decompressor(gopp->patch_size);
+ gopp->stride = mGridsPerEdge;
+ set_group_of_patch_header(gopp);
+
+ while (1)
+ {
+ decode_patch_header(bitpack, &ph);
+ if (ph.quant_wbits == END_OF_PATCHES)
+ {
+ break;
+ }
+
+ i = ph.patchids >> 5;
+ j = ph.patchids & 0x1F;
+
+ if ((i >= mPatchesPerEdge) || (j >= mPatchesPerEdge))
+ {
+ LL_WARNS() << "Received invalid terrain packet - patch header patch ID incorrect!"
+ << " patches per edge " << mPatchesPerEdge
+ << " i " << i
+ << " j " << j
+ << " dc_offset " << ph.dc_offset
+ << " range " << (S32)ph.range
+ << " quant_wbits " << (S32)ph.quant_wbits
+ << " patchids " << (S32)ph.patchids
+ << LL_ENDL;
+ return;
+ }
+
+ patchp = &mPatchList[j*mPatchesPerEdge + i];
+
+
+ decode_patch(bitpack, patch);
+ decompress_patch(patchp->getDataZ(), patch, &ph);
+
+ // Update edges for neighbors. Need to guarantee that this gets done before we generate vertical stats.
+ patchp->updateNorthEdge();
+ patchp->updateEastEdge();
+ if (patchp->getNeighborPatch(WEST))
+ {
+ patchp->getNeighborPatch(WEST)->updateEastEdge();
+ }
+ if (patchp->getNeighborPatch(SOUTHWEST))
+ {
+ patchp->getNeighborPatch(SOUTHWEST)->updateEastEdge();
+ patchp->getNeighborPatch(SOUTHWEST)->updateNorthEdge();
+ }
+ if (patchp->getNeighborPatch(SOUTH))
+ {
+ patchp->getNeighborPatch(SOUTH)->updateNorthEdge();
+ }
+
+ // Dirty patch statistics, and flag that the patch has data.
+ patchp->dirtyZ();
+ patchp->setHasReceivedData();
+ }
}
@@ -762,157 +762,157 @@ void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL
// "position" is region-local
BOOL LLSurface::containsPosition(const LLVector3 &position)
{
- if (position.mV[VX] < 0.0f || position.mV[VX] > mMetersPerEdge ||
- position.mV[VY] < 0.0f || position.mV[VY] > mMetersPerEdge)
- {
- return FALSE;
- }
- return TRUE;
+ if (position.mV[VX] < 0.0f || position.mV[VX] > mMetersPerEdge ||
+ position.mV[VY] < 0.0f || position.mV[VY] > mMetersPerEdge)
+ {
+ return FALSE;
+ }
+ return TRUE;
}
F32 LLSurface::resolveHeightRegion(const F32 x, const F32 y) const
{
- F32 height = 0.0f;
- F32 oometerspergrid = 1.f/mMetersPerGrid;
-
- // Check to see if v is actually above surface
- // We use (mGridsPerEdge-1) below rather than (mGridsPerEdge)
- // becuase of the east and north buffers
-
- if (x >= 0.f &&
- x <= mMetersPerEdge &&
- y >= 0.f &&
- y <= mMetersPerEdge)
- {
- const S32 left = llfloor(x * oometerspergrid);
- const S32 bottom = llfloor(y * oometerspergrid);
-
- // Don't walk off the edge of the array!
- const S32 right = ( left+1 < (S32)mGridsPerEdge-1 ? left+1 : left );
- const S32 top = ( bottom+1 < (S32)mGridsPerEdge-1 ? bottom+1 : bottom );
-
- // Figure out if v is in first or second triangle of the square
- // and calculate the slopes accordingly
- // | |
- // -(i,j+1)---(i+1,j+1)--
- // | 1 / | ^
- // | / 2 | |
- // | / | j
- // --(i,j)----(i+1,j)--
- // | |
- //
- // i ->
- // where N = mGridsPerEdge
-
- const F32 left_bottom = getZ( left, bottom );
- const F32 right_bottom = getZ( right, bottom );
- const F32 left_top = getZ( left, top );
- const F32 right_top = getZ( right, top );
-
- // dx and dy are incremental steps from (mSurface + k)
- F32 dx = x - left * mMetersPerGrid;
- F32 dy = y - bottom * mMetersPerGrid;
-
- if (dy > dx)
- {
- // triangle 1
- dy *= left_top - left_bottom;
- dx *= right_top - left_top;
- }
- else
- {
- // triangle 2
- dx *= right_bottom - left_bottom;
- dy *= right_top - right_bottom;
- }
- height = left_bottom + (dx + dy) * oometerspergrid;
- }
- return height;
+ F32 height = 0.0f;
+ F32 oometerspergrid = 1.f/mMetersPerGrid;
+
+ // Check to see if v is actually above surface
+ // We use (mGridsPerEdge-1) below rather than (mGridsPerEdge)
+ // becuase of the east and north buffers
+
+ if (x >= 0.f &&
+ x <= mMetersPerEdge &&
+ y >= 0.f &&
+ y <= mMetersPerEdge)
+ {
+ const S32 left = llfloor(x * oometerspergrid);
+ const S32 bottom = llfloor(y * oometerspergrid);
+
+ // Don't walk off the edge of the array!
+ const S32 right = ( left+1 < (S32)mGridsPerEdge-1 ? left+1 : left );
+ const S32 top = ( bottom+1 < (S32)mGridsPerEdge-1 ? bottom+1 : bottom );
+
+ // Figure out if v is in first or second triangle of the square
+ // and calculate the slopes accordingly
+ // | |
+ // -(i,j+1)---(i+1,j+1)--
+ // | 1 / | ^
+ // | / 2 | |
+ // | / | j
+ // --(i,j)----(i+1,j)--
+ // | |
+ //
+ // i ->
+ // where N = mGridsPerEdge
+
+ const F32 left_bottom = getZ( left, bottom );
+ const F32 right_bottom = getZ( right, bottom );
+ const F32 left_top = getZ( left, top );
+ const F32 right_top = getZ( right, top );
+
+ // dx and dy are incremental steps from (mSurface + k)
+ F32 dx = x - left * mMetersPerGrid;
+ F32 dy = y - bottom * mMetersPerGrid;
+
+ if (dy > dx)
+ {
+ // triangle 1
+ dy *= left_top - left_bottom;
+ dx *= right_top - left_top;
+ }
+ else
+ {
+ // triangle 2
+ dx *= right_bottom - left_bottom;
+ dy *= right_top - right_bottom;
+ }
+ height = left_bottom + (dx + dy) * oometerspergrid;
+ }
+ return height;
}
F32 LLSurface::resolveHeightGlobal(const LLVector3d& v) const
{
- if (!mRegionp)
- {
- return 0.f;
- }
-
- LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(v);
-
- return resolveHeightRegion(pos_region);
+ if (!mRegionp)
+ {
+ return 0.f;
+ }
+
+ LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(v);
+
+ return resolveHeightRegion(pos_region);
}
LLVector3 LLSurface::resolveNormalGlobal(const LLVector3d& pos_global) const
{
- if (!mSurfaceZ)
- {
- // Hmm. Uninitialized surface!
- return LLVector3::z_axis;
- }
- //
- // Returns the vector normal to a surface at location specified by vector v
- //
- F32 oometerspergrid = 1.f/mMetersPerGrid;
- LLVector3 normal;
- F32 dzx, dzy;
-
- if (pos_global.mdV[VX] >= mOriginGlobal.mdV[VX] &&
- pos_global.mdV[VX] < mOriginGlobal.mdV[VX] + mMetersPerEdge &&
- pos_global.mdV[VY] >= mOriginGlobal.mdV[VY] &&
- pos_global.mdV[VY] < mOriginGlobal.mdV[VY] + mMetersPerEdge)
- {
- U32 i, j, k;
- F32 dx, dy;
- i = (U32) ((pos_global.mdV[VX] - mOriginGlobal.mdV[VX]) * oometerspergrid);
- j = (U32) ((pos_global.mdV[VY] - mOriginGlobal.mdV[VY]) * oometerspergrid );
- k = i + j*mGridsPerEdge;
-
- // Figure out if v is in first or second triangle of the square
- // and calculate the slopes accordingly
- // | |
- // -(k+N)---(k+1+N)--
- // | 1 / | ^
- // | / 2 | |
- // | / | j
- // --(k)----(k+1)--
- // | |
- //
- // i ->
- // where N = mGridsPerEdge
-
- // dx and dy are incremental steps from (mSurface + k)
- dx = (F32)(pos_global.mdV[VX] - i*mMetersPerGrid - mOriginGlobal.mdV[VX]);
- dy = (F32)(pos_global.mdV[VY] - j*mMetersPerGrid - mOriginGlobal.mdV[VY]);
- if (dy > dx)
- { // triangle 1
- dzx = *(mSurfaceZ + k + 1 + mGridsPerEdge) - *(mSurfaceZ + k + mGridsPerEdge);
- dzy = *(mSurfaceZ + k) - *(mSurfaceZ + k + mGridsPerEdge);
- normal.setVec(-dzx,dzy,1);
- }
- else
- { // triangle 2
- dzx = *(mSurfaceZ + k) - *(mSurfaceZ + k + 1);
- dzy = *(mSurfaceZ + k + 1 + mGridsPerEdge) - *(mSurfaceZ + k + 1);
- normal.setVec(dzx,-dzy,1);
- }
- }
- normal.normVec();
- return normal;
+ if (!mSurfaceZ)
+ {
+ // Hmm. Uninitialized surface!
+ return LLVector3::z_axis;
+ }
+ //
+ // Returns the vector normal to a surface at location specified by vector v
+ //
+ F32 oometerspergrid = 1.f/mMetersPerGrid;
+ LLVector3 normal;
+ F32 dzx, dzy;
+
+ if (pos_global.mdV[VX] >= mOriginGlobal.mdV[VX] &&
+ pos_global.mdV[VX] < mOriginGlobal.mdV[VX] + mMetersPerEdge &&
+ pos_global.mdV[VY] >= mOriginGlobal.mdV[VY] &&
+ pos_global.mdV[VY] < mOriginGlobal.mdV[VY] + mMetersPerEdge)
+ {
+ U32 i, j, k;
+ F32 dx, dy;
+ i = (U32) ((pos_global.mdV[VX] - mOriginGlobal.mdV[VX]) * oometerspergrid);
+ j = (U32) ((pos_global.mdV[VY] - mOriginGlobal.mdV[VY]) * oometerspergrid );
+ k = i + j*mGridsPerEdge;
+
+ // Figure out if v is in first or second triangle of the square
+ // and calculate the slopes accordingly
+ // | |
+ // -(k+N)---(k+1+N)--
+ // | 1 / | ^
+ // | / 2 | |
+ // | / | j
+ // --(k)----(k+1)--
+ // | |
+ //
+ // i ->
+ // where N = mGridsPerEdge
+
+ // dx and dy are incremental steps from (mSurface + k)
+ dx = (F32)(pos_global.mdV[VX] - i*mMetersPerGrid - mOriginGlobal.mdV[VX]);
+ dy = (F32)(pos_global.mdV[VY] - j*mMetersPerGrid - mOriginGlobal.mdV[VY]);
+ if (dy > dx)
+ { // triangle 1
+ dzx = *(mSurfaceZ + k + 1 + mGridsPerEdge) - *(mSurfaceZ + k + mGridsPerEdge);
+ dzy = *(mSurfaceZ + k) - *(mSurfaceZ + k + mGridsPerEdge);
+ normal.setVec(-dzx,dzy,1);
+ }
+ else
+ { // triangle 2
+ dzx = *(mSurfaceZ + k) - *(mSurfaceZ + k + 1);
+ dzy = *(mSurfaceZ + k + 1 + mGridsPerEdge) - *(mSurfaceZ + k + 1);
+ normal.setVec(dzx,-dzy,1);
+ }
+ }
+ normal.normVec();
+ return normal;
}
LLSurfacePatch *LLSurface::resolvePatchRegion(const F32 x, const F32 y) const
{
-// x and y should be region-local coordinates.
+// x and y should be region-local coordinates.
// If x and y are outside of the surface, then the returned
// index will be for the nearest boundary patch.
//
// 12 | 13| 14| 15
-// | | |
+// | | |
// +---+---+---+---+
// | 12| 13| 14| 15|
// ----+---+---+---+---+-----
@@ -922,393 +922,393 @@ LLSurfacePatch *LLSurface::resolvePatchRegion(const F32 x, const F32 y) const
// ----+---+---+---+---+-----
// | 0 | 1 | 2 | 3 |
// +---+---+---+---+
-// | | |
+// | | |
// 0 | 1 | 2 | 3
//
// When x and y are not region-local do the following first
- S32 i, j;
- if (x < 0.0f)
- {
- i = 0;
- }
- else if (x >= mMetersPerEdge)
- {
- i = mPatchesPerEdge - 1;
- }
- else
- {
- i = (U32) (x / (mMetersPerGrid * mGridsPerPatchEdge));
- }
-
- if (y < 0.0f)
- {
- j = 0;
- }
- else if (y >= mMetersPerEdge)
- {
- j = mPatchesPerEdge - 1;
- }
- else
- {
- j = (U32) (y / (mMetersPerGrid * mGridsPerPatchEdge));
- }
-
- // *NOTE: Super paranoia code follows.
- S32 index = i + j * mPatchesPerEdge;
- if((index < 0) || (index >= mNumberOfPatches))
- {
- if(0 == mNumberOfPatches)
- {
- LL_WARNS() << "No patches for current region!" << LL_ENDL;
- return NULL;
- }
- S32 old_index = index;
- index = llclamp(old_index, 0, (mNumberOfPatches - 1));
- LL_WARNS() << "Clamping out of range patch index " << old_index
- << " to " << index << LL_ENDL;
- }
- return &(mPatchList[index]);
+ S32 i, j;
+ if (x < 0.0f)
+ {
+ i = 0;
+ }
+ else if (x >= mMetersPerEdge)
+ {
+ i = mPatchesPerEdge - 1;
+ }
+ else
+ {
+ i = (U32) (x / (mMetersPerGrid * mGridsPerPatchEdge));
+ }
+
+ if (y < 0.0f)
+ {
+ j = 0;
+ }
+ else if (y >= mMetersPerEdge)
+ {
+ j = mPatchesPerEdge - 1;
+ }
+ else
+ {
+ j = (U32) (y / (mMetersPerGrid * mGridsPerPatchEdge));
+ }
+
+ // *NOTE: Super paranoia code follows.
+ S32 index = i + j * mPatchesPerEdge;
+ if((index < 0) || (index >= mNumberOfPatches))
+ {
+ if(0 == mNumberOfPatches)
+ {
+ LL_WARNS() << "No patches for current region!" << LL_ENDL;
+ return NULL;
+ }
+ S32 old_index = index;
+ index = llclamp(old_index, 0, (mNumberOfPatches - 1));
+ LL_WARNS() << "Clamping out of range patch index " << old_index
+ << " to " << index << LL_ENDL;
+ }
+ return &(mPatchList[index]);
}
LLSurfacePatch *LLSurface::resolvePatchRegion(const LLVector3 &pos_region) const
{
- return resolvePatchRegion(pos_region.mV[VX], pos_region.mV[VY]);
+ return resolvePatchRegion(pos_region.mV[VX], pos_region.mV[VY]);
}
LLSurfacePatch *LLSurface::resolvePatchGlobal(const LLVector3d &pos_global) const
{
- llassert(mRegionp);
- LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(pos_global);
- return resolvePatchRegion(pos_region);
+ llassert(mRegionp);
+ LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(pos_global);
+ return resolvePatchRegion(pos_region);
}
-std::ostream& operator<<(std::ostream &s, const LLSurface &S)
+std::ostream& operator<<(std::ostream &s, const LLSurface &S)
{
- s << "{ \n";
- s << " mGridsPerEdge = " << S.mGridsPerEdge - 1 << " + 1\n";
- s << " mGridsPerPatchEdge = " << S.mGridsPerPatchEdge << "\n";
- s << " mPatchesPerEdge = " << S.mPatchesPerEdge << "\n";
- s << " mOriginGlobal = " << S.mOriginGlobal << "\n";
- s << " mMetersPerGrid = " << S.mMetersPerGrid << "\n";
- s << " mVisiblePatchCount = " << S.mVisiblePatchCount << "\n";
- s << "}";
- return s;
+ s << "{ \n";
+ s << " mGridsPerEdge = " << S.mGridsPerEdge - 1 << " + 1\n";
+ s << " mGridsPerPatchEdge = " << S.mGridsPerPatchEdge << "\n";
+ s << " mPatchesPerEdge = " << S.mPatchesPerEdge << "\n";
+ s << " mOriginGlobal = " << S.mOriginGlobal << "\n";
+ s << " mMetersPerGrid = " << S.mMetersPerGrid << "\n";
+ s << " mVisiblePatchCount = " << S.mVisiblePatchCount << "\n";
+ s << "}";
+ return s;
}
// ---------------- LLSurface:: Protected ----------------
-void LLSurface::createPatchData()
+void LLSurface::createPatchData()
{
- // Assumes mGridsPerEdge, mGridsPerPatchEdge, and mPatchesPerEdge have been properly set
- // TODO -- check for create() called when surface is not empty
- S32 i, j;
- LLSurfacePatch *patchp;
-
- // Allocate memory
- mPatchList = new LLSurfacePatch[mNumberOfPatches];
-
- // One of each for each camera
- mVisiblePatchCount = mNumberOfPatches;
-
- for (j=0; j<mPatchesPerEdge; j++)
- {
- for (i=0; i<mPatchesPerEdge; i++)
- {
- patchp = getPatch(i, j);
- patchp->setSurface(this);
- }
- }
-
- for (j=0; j<mPatchesPerEdge; j++)
- {
- for (i=0; i<mPatchesPerEdge; i++)
- {
- patchp = getPatch(i, j);
- patchp->mHasReceivedData = FALSE;
- patchp->mSTexUpdate = TRUE;
-
- S32 data_offset = i * mGridsPerPatchEdge + j * mGridsPerPatchEdge * mGridsPerEdge;
-
- patchp->setDataZ(mSurfaceZ + data_offset);
- patchp->setDataNorm(mNorm + data_offset);
-
-
- // We make each patch point to its neighbors so we can do resolution checking
- // when butting up different resolutions. Patches that don't have neighbors
- // somewhere will point to NULL on that side.
- if (i < mPatchesPerEdge-1)
- {
- patchp->setNeighborPatch(EAST,getPatch(i+1, j));
- }
- else
- {
- patchp->setNeighborPatch(EAST, NULL);
- }
-
- if (j < mPatchesPerEdge-1)
- {
- patchp->setNeighborPatch(NORTH, getPatch(i, j+1));
- }
- else
- {
- patchp->setNeighborPatch(NORTH, NULL);
- }
-
- if (i > 0)
- {
- patchp->setNeighborPatch(WEST, getPatch(i - 1, j));
- }
- else
- {
- patchp->setNeighborPatch(WEST, NULL);
- }
-
- if (j > 0)
- {
- patchp->setNeighborPatch(SOUTH, getPatch(i, j-1));
- }
- else
- {
- patchp->setNeighborPatch(SOUTH, NULL);
- }
-
- if (i < (mPatchesPerEdge-1) && j < (mPatchesPerEdge-1))
- {
- patchp->setNeighborPatch(NORTHEAST, getPatch(i + 1, j + 1));
- }
- else
- {
- patchp->setNeighborPatch(NORTHEAST, NULL);
- }
-
- if (i > 0 && j < (mPatchesPerEdge-1))
- {
- patchp->setNeighborPatch(NORTHWEST, getPatch(i - 1, j + 1));
- }
- else
- {
- patchp->setNeighborPatch(NORTHWEST, NULL);
- }
-
- if (i > 0 && j > 0)
- {
- patchp->setNeighborPatch(SOUTHWEST, getPatch(i - 1, j - 1));
- }
- else
- {
- patchp->setNeighborPatch(SOUTHWEST, NULL);
- }
-
- if (i < (mPatchesPerEdge-1) && j > 0)
- {
- patchp->setNeighborPatch(SOUTHEAST, getPatch(i + 1, j - 1));
- }
- else
- {
- patchp->setNeighborPatch(SOUTHEAST, NULL);
- }
-
- LLVector3d origin_global;
- origin_global.mdV[0] = mOriginGlobal.mdV[0] + i * mMetersPerGrid * mGridsPerPatchEdge;
- origin_global.mdV[1] = mOriginGlobal.mdV[0] + j * mMetersPerGrid * mGridsPerPatchEdge;
- origin_global.mdV[2] = 0.f;
- patchp->setOriginGlobal(origin_global);
- }
- }
+ // Assumes mGridsPerEdge, mGridsPerPatchEdge, and mPatchesPerEdge have been properly set
+ // TODO -- check for create() called when surface is not empty
+ S32 i, j;
+ LLSurfacePatch *patchp;
+
+ // Allocate memory
+ mPatchList = new LLSurfacePatch[mNumberOfPatches];
+
+ // One of each for each camera
+ mVisiblePatchCount = mNumberOfPatches;
+
+ for (j=0; j<mPatchesPerEdge; j++)
+ {
+ for (i=0; i<mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(i, j);
+ patchp->setSurface(this);
+ }
+ }
+
+ for (j=0; j<mPatchesPerEdge; j++)
+ {
+ for (i=0; i<mPatchesPerEdge; i++)
+ {
+ patchp = getPatch(i, j);
+ patchp->mHasReceivedData = FALSE;
+ patchp->mSTexUpdate = TRUE;
+
+ S32 data_offset = i * mGridsPerPatchEdge + j * mGridsPerPatchEdge * mGridsPerEdge;
+
+ patchp->setDataZ(mSurfaceZ + data_offset);
+ patchp->setDataNorm(mNorm + data_offset);
+
+
+ // We make each patch point to its neighbors so we can do resolution checking
+ // when butting up different resolutions. Patches that don't have neighbors
+ // somewhere will point to NULL on that side.
+ if (i < mPatchesPerEdge-1)
+ {
+ patchp->setNeighborPatch(EAST,getPatch(i+1, j));
+ }
+ else
+ {
+ patchp->setNeighborPatch(EAST, NULL);
+ }
+
+ if (j < mPatchesPerEdge-1)
+ {
+ patchp->setNeighborPatch(NORTH, getPatch(i, j+1));
+ }
+ else
+ {
+ patchp->setNeighborPatch(NORTH, NULL);
+ }
+
+ if (i > 0)
+ {
+ patchp->setNeighborPatch(WEST, getPatch(i - 1, j));
+ }
+ else
+ {
+ patchp->setNeighborPatch(WEST, NULL);
+ }
+
+ if (j > 0)
+ {
+ patchp->setNeighborPatch(SOUTH, getPatch(i, j-1));
+ }
+ else
+ {
+ patchp->setNeighborPatch(SOUTH, NULL);
+ }
+
+ if (i < (mPatchesPerEdge-1) && j < (mPatchesPerEdge-1))
+ {
+ patchp->setNeighborPatch(NORTHEAST, getPatch(i + 1, j + 1));
+ }
+ else
+ {
+ patchp->setNeighborPatch(NORTHEAST, NULL);
+ }
+
+ if (i > 0 && j < (mPatchesPerEdge-1))
+ {
+ patchp->setNeighborPatch(NORTHWEST, getPatch(i - 1, j + 1));
+ }
+ else
+ {
+ patchp->setNeighborPatch(NORTHWEST, NULL);
+ }
+
+ if (i > 0 && j > 0)
+ {
+ patchp->setNeighborPatch(SOUTHWEST, getPatch(i - 1, j - 1));
+ }
+ else
+ {
+ patchp->setNeighborPatch(SOUTHWEST, NULL);
+ }
+
+ if (i < (mPatchesPerEdge-1) && j > 0)
+ {
+ patchp->setNeighborPatch(SOUTHEAST, getPatch(i + 1, j - 1));
+ }
+ else
+ {
+ patchp->setNeighborPatch(SOUTHEAST, NULL);
+ }
+
+ LLVector3d origin_global;
+ origin_global.mdV[0] = mOriginGlobal.mdV[0] + i * mMetersPerGrid * mGridsPerPatchEdge;
+ origin_global.mdV[1] = mOriginGlobal.mdV[0] + j * mMetersPerGrid * mGridsPerPatchEdge;
+ origin_global.mdV[2] = 0.f;
+ patchp->setOriginGlobal(origin_global);
+ }
+ }
}
void LLSurface::destroyPatchData()
{
- // Delete all of the cached patch data for these patches.
+ // Delete all of the cached patch data for these patches.
- delete [] mPatchList;
- mPatchList = NULL;
- mVisiblePatchCount = 0;
+ delete [] mPatchList;
+ mPatchList = NULL;
+ mVisiblePatchCount = 0;
}
void LLSurface::setTextureSize(const S32 texture_size)
{
- sTextureSize = texture_size;
+ sTextureSize = texture_size;
}
U32 LLSurface::getRenderLevel(const U32 render_stride) const
{
- return mPVArray.mRenderLevelp[render_stride];
+ return mPVArray.mRenderLevelp[render_stride];
}
U32 LLSurface::getRenderStride(const U32 render_level) const
{
- return mPVArray.mRenderStridep[render_level];
+ return mPVArray.mRenderStridep[render_level];
}
LLSurfacePatch *LLSurface::getPatch(const S32 x, const S32 y) const
{
- if ((x < 0) || (x >= mPatchesPerEdge))
- {
- LL_ERRS() << "Asking for patch out of bounds" << LL_ENDL;
- return NULL;
- }
- if ((y < 0) || (y >= mPatchesPerEdge))
- {
- LL_ERRS() << "Asking for patch out of bounds" << LL_ENDL;
- return NULL;
- }
-
- return mPatchList + x + y*mPatchesPerEdge;
+ if ((x < 0) || (x >= mPatchesPerEdge))
+ {
+ LL_ERRS() << "Asking for patch out of bounds" << LL_ENDL;
+ return NULL;
+ }
+ if ((y < 0) || (y >= mPatchesPerEdge))
+ {
+ LL_ERRS() << "Asking for patch out of bounds" << LL_ENDL;
+ return NULL;
+ }
+
+ return mPatchList + x + y*mPatchesPerEdge;
}
void LLSurface::dirtyAllPatches()
{
- S32 i;
- for (i = 0; i < mNumberOfPatches; i++)
- {
- mPatchList[i].dirtyZ();
- }
+ S32 i;
+ for (i = 0; i < mNumberOfPatches; i++)
+ {
+ mPatchList[i].dirtyZ();
+ }
}
void LLSurface::dirtySurfacePatch(LLSurfacePatch *patchp)
{
- // Put surface patch on dirty surface patch list
- mDirtyPatchList.insert(patchp);
+ // Put surface patch on dirty surface patch list
+ mDirtyPatchList.insert(patchp);
}
void LLSurface::setWaterHeight(F32 height)
{
- if (!mWaterObjp.isNull())
- {
- LLVector3 water_pos_region = mWaterObjp->getPositionRegion();
- bool changed = water_pos_region.mV[VZ] != height;
- water_pos_region.mV[VZ] = height;
- mWaterObjp->setPositionRegion(water_pos_region);
- if (changed)
- {
- LLWorld::getInstance()->updateWaterObjects();
- }
- }
- else
- {
- LL_WARNS() << "LLSurface::setWaterHeight with no water object!" << LL_ENDL;
- }
+ if (!mWaterObjp.isNull())
+ {
+ LLVector3 water_pos_region = mWaterObjp->getPositionRegion();
+ bool changed = water_pos_region.mV[VZ] != height;
+ water_pos_region.mV[VZ] = height;
+ mWaterObjp->setPositionRegion(water_pos_region);
+ if (changed)
+ {
+ LLWorld::getInstance()->updateWaterObjects();
+ }
+ }
+ else
+ {
+ LL_WARNS() << "LLSurface::setWaterHeight with no water object!" << LL_ENDL;
+ }
}
F32 LLSurface::getWaterHeight() const
{
- if (!mWaterObjp.isNull())
- {
- // we have a water object, the usual case
- return mWaterObjp->getPositionRegion().mV[VZ];
- }
- else
- {
- return DEFAULT_WATER_HEIGHT;
- }
+ if (!mWaterObjp.isNull())
+ {
+ // we have a water object, the usual case
+ return mWaterObjp->getPositionRegion().mV[VZ];
+ }
+ else
+ {
+ return DEFAULT_WATER_HEIGHT;
+ }
}
BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y,
- const F32 width, const F32 height)
+ const F32 width, const F32 height)
{
- LL_PROFILE_ZONE_SCOPED
- if (!getWaterTexture())
- {
- return FALSE;
- }
-
- S32 tex_width = mWaterTexturep->getWidth();
- S32 tex_height = mWaterTexturep->getHeight();
- S32 tex_comps = mWaterTexturep->getComponents();
- S32 tex_stride = tex_width * tex_comps;
- LLPointer<LLImageRaw> raw = new LLImageRaw(tex_width, tex_height, tex_comps);
- U8 *rawp = raw->getData();
-
- F32 scale = 256.f * getMetersPerGrid() / (F32)tex_width;
- F32 scale_inv = 1.f / scale;
-
- S32 x_begin, y_begin, x_end, y_end;
-
- x_begin = ll_round(x * scale_inv);
- y_begin = ll_round(y * scale_inv);
- x_end = ll_round((x + width) * scale_inv);
- y_end = ll_round((y + width) * scale_inv);
-
- if (x_end > tex_width)
- {
- x_end = tex_width;
- }
- if (y_end > tex_width)
- {
- y_end = tex_width;
- }
-
- // OK, for now, just have the composition value equal the height at the point.
- LLVector3 location;
- LLColor4U coloru;
-
- const F32 WATER_HEIGHT = getWaterHeight();
-
- S32 i, j, offset;
- for (j = y_begin; j < y_end; j++)
- {
- for (i = x_begin; i < x_end; i++)
- {
- //F32 nv[2];
- //nv[0] = i/256.f;
- //nv[1] = j/256.f;
- // const S32 modulation = noise2(nv)*40;
- offset = j*tex_stride + i*tex_comps;
- location.mV[VX] = i*scale;
- location.mV[VY] = j*scale;
-
- // Sample multiple points
- const F32 height = resolveHeightRegion(location);
-
- if (height > WATER_HEIGHT)
- {
- // Above water...
- coloru = MAX_WATER_COLOR;
- coloru.mV[3] = ABOVE_WATERLINE_ALPHA;
- *(rawp + offset++) = coloru.mV[0];
- *(rawp + offset++) = coloru.mV[1];
- *(rawp + offset++) = coloru.mV[2];
- *(rawp + offset++) = coloru.mV[3];
- }
- else
- {
- // Want non-linear curve for transparency gradient
- coloru = MAX_WATER_COLOR;
- const F32 frac = 1.f - 2.f/(2.f - (height - WATER_HEIGHT));
- S32 alpha = 64 + ll_round((255-64)*frac);
-
- alpha = llmin(ll_round((F32)MAX_WATER_COLOR.mV[3]), alpha);
- alpha = llmax(64, alpha);
-
- coloru.mV[3] = alpha;
- *(rawp + offset++) = coloru.mV[0];
- *(rawp + offset++) = coloru.mV[1];
- *(rawp + offset++) = coloru.mV[2];
- *(rawp + offset++) = coloru.mV[3];
- }
- }
- }
-
- if (!mWaterTexturep->hasGLTexture())
- {
- mWaterTexturep->createGLTexture(0, raw);
- }
-
- mWaterTexturep->setSubImage(raw, x_begin, y_begin, x_end - x_begin, y_end - y_begin);
- return TRUE;
+ LL_PROFILE_ZONE_SCOPED
+ if (!getWaterTexture())
+ {
+ return FALSE;
+ }
+
+ S32 tex_width = mWaterTexturep->getWidth();
+ S32 tex_height = mWaterTexturep->getHeight();
+ S32 tex_comps = mWaterTexturep->getComponents();
+ S32 tex_stride = tex_width * tex_comps;
+ LLPointer<LLImageRaw> raw = new LLImageRaw(tex_width, tex_height, tex_comps);
+ U8 *rawp = raw->getData();
+
+ F32 scale = 256.f * getMetersPerGrid() / (F32)tex_width;
+ F32 scale_inv = 1.f / scale;
+
+ S32 x_begin, y_begin, x_end, y_end;
+
+ x_begin = ll_round(x * scale_inv);
+ y_begin = ll_round(y * scale_inv);
+ x_end = ll_round((x + width) * scale_inv);
+ y_end = ll_round((y + width) * scale_inv);
+
+ if (x_end > tex_width)
+ {
+ x_end = tex_width;
+ }
+ if (y_end > tex_width)
+ {
+ y_end = tex_width;
+ }
+
+ // OK, for now, just have the composition value equal the height at the point.
+ LLVector3 location;
+ LLColor4U coloru;
+
+ const F32 WATER_HEIGHT = getWaterHeight();
+
+ S32 i, j, offset;
+ for (j = y_begin; j < y_end; j++)
+ {
+ for (i = x_begin; i < x_end; i++)
+ {
+ //F32 nv[2];
+ //nv[0] = i/256.f;
+ //nv[1] = j/256.f;
+ // const S32 modulation = noise2(nv)*40;
+ offset = j*tex_stride + i*tex_comps;
+ location.mV[VX] = i*scale;
+ location.mV[VY] = j*scale;
+
+ // Sample multiple points
+ const F32 height = resolveHeightRegion(location);
+
+ if (height > WATER_HEIGHT)
+ {
+ // Above water...
+ coloru = MAX_WATER_COLOR;
+ coloru.mV[3] = ABOVE_WATERLINE_ALPHA;
+ *(rawp + offset++) = coloru.mV[0];
+ *(rawp + offset++) = coloru.mV[1];
+ *(rawp + offset++) = coloru.mV[2];
+ *(rawp + offset++) = coloru.mV[3];
+ }
+ else
+ {
+ // Want non-linear curve for transparency gradient
+ coloru = MAX_WATER_COLOR;
+ const F32 frac = 1.f - 2.f/(2.f - (height - WATER_HEIGHT));
+ S32 alpha = 64 + ll_round((255-64)*frac);
+
+ alpha = llmin(ll_round((F32)MAX_WATER_COLOR.mV[3]), alpha);
+ alpha = llmax(64, alpha);
+
+ coloru.mV[3] = alpha;
+ *(rawp + offset++) = coloru.mV[0];
+ *(rawp + offset++) = coloru.mV[1];
+ *(rawp + offset++) = coloru.mV[2];
+ *(rawp + offset++) = coloru.mV[3];
+ }
+ }
+ }
+
+ if (!mWaterTexturep->hasGLTexture())
+ {
+ mWaterTexturep->createGLTexture(0, raw);
+ }
+
+ mWaterTexturep->setSubImage(raw, x_begin, y_begin, x_end - x_begin, y_end - y_begin);
+ return TRUE;
}
diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h
index 33a64ae7d5..ca86e2334e 100644
--- a/indra/newview/llsurface.h
+++ b/indra/newview/llsurface.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsurface.h
* @brief Description of LLSurface class
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,9 +52,9 @@ static const U8 NORTH_EDGE = 0x02;
static const U8 WEST_EDGE = 0x04;
static const U8 SOUTH_EDGE = 0x08;
-static const S32 ONE_MORE_THAN_NEIGHBOR = 1;
-static const S32 EQUAL_TO_NEIGHBOR = 0;
-static const S32 ONE_LESS_THAN_NEIGHBOR = -1;
+static const S32 ONE_MORE_THAN_NEIGHBOR = 1;
+static const S32 EQUAL_TO_NEIGHBOR = 0;
+static const S32 ONE_LESS_THAN_NEIGHBOR = -1;
const S32 ABOVE_WATERLINE_ALPHA = 32; // The alpha of water when the land elevation is above the waterline.
@@ -63,198 +63,198 @@ class LLSurfacePatch;
class LLBitPack;
class LLGroupHeader;
-class LLSurface
+class LLSurface
{
public:
- LLSurface(U32 type, LLViewerRegion *regionp = NULL);
- virtual ~LLSurface();
+ LLSurface(U32 type, LLViewerRegion *regionp = NULL);
+ virtual ~LLSurface();
+
+ static void initClasses(); // Do class initialization for LLSurface and its child classes.
- static void initClasses(); // Do class initialization for LLSurface and its child classes.
+ void create(const S32 surface_grid_width,
+ const S32 surface_patch_width,
+ const LLVector3d &origin_global,
+ const F32 width); // Allocates and initializes surface
- void create(const S32 surface_grid_width,
- const S32 surface_patch_width,
- const LLVector3d &origin_global,
- const F32 width); // Allocates and initializes surface
+ void setRegion(LLViewerRegion *regionp);
- void setRegion(LLViewerRegion *regionp);
+ void setOriginGlobal(const LLVector3d &origin_global);
- void setOriginGlobal(const LLVector3d &origin_global);
+ void connectNeighbor(LLSurface *neighborp, U32 direction);
+ void disconnectNeighbor(LLSurface *neighborp);
+ void disconnectAllNeighbors();
- void connectNeighbor(LLSurface *neighborp, U32 direction);
- void disconnectNeighbor(LLSurface *neighborp);
- void disconnectAllNeighbors();
+ virtual void decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL b_large_patch);
+ virtual void updatePatchVisibilities(LLAgent &agent);
- virtual void decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL b_large_patch);
- virtual void updatePatchVisibilities(LLAgent &agent);
+ inline F32 getZ(const U32 k) const { return mSurfaceZ[k]; }
+ inline F32 getZ(const S32 i, const S32 j) const { return mSurfaceZ[i + j*mGridsPerEdge]; }
- inline F32 getZ(const U32 k) const { return mSurfaceZ[k]; }
- inline F32 getZ(const S32 i, const S32 j) const { return mSurfaceZ[i + j*mGridsPerEdge]; }
+ LLVector3 getOriginAgent() const;
+ const LLVector3d &getOriginGlobal() const;
+ F32 getMetersPerGrid() const;
+ S32 getGridsPerEdge() const;
+ S32 getPatchesPerEdge() const;
+ S32 getGridsPerPatchEdge() const;
+ U32 getRenderStride(const U32 render_level) const;
+ U32 getRenderLevel(const U32 render_stride) const;
- LLVector3 getOriginAgent() const;
- const LLVector3d &getOriginGlobal() const;
- F32 getMetersPerGrid() const;
- S32 getGridsPerEdge() const;
- S32 getPatchesPerEdge() const;
- S32 getGridsPerPatchEdge() const;
- U32 getRenderStride(const U32 render_level) const;
- U32 getRenderLevel(const U32 render_stride) const;
+ // Returns the height of the surface immediately above (or below) location,
+ // or if location is not above surface returns zero.
+ F32 resolveHeightRegion(const F32 x, const F32 y) const;
+ F32 resolveHeightRegion(const LLVector3 &location) const
+ { return resolveHeightRegion( location.mV[VX], location.mV[VY] ); }
+ F32 resolveHeightGlobal(const LLVector3d &position_global) const;
+ LLVector3 resolveNormalGlobal(const LLVector3d& v) const; // Returns normal to surface
- // Returns the height of the surface immediately above (or below) location,
- // or if location is not above surface returns zero.
- F32 resolveHeightRegion(const F32 x, const F32 y) const;
- F32 resolveHeightRegion(const LLVector3 &location) const
- { return resolveHeightRegion( location.mV[VX], location.mV[VY] ); }
- F32 resolveHeightGlobal(const LLVector3d &position_global) const;
- LLVector3 resolveNormalGlobal(const LLVector3d& v) const; // Returns normal to surface
+ LLSurfacePatch *resolvePatchRegion(const F32 x, const F32 y) const;
+ LLSurfacePatch *resolvePatchRegion(const LLVector3 &position_region) const;
+ LLSurfacePatch *resolvePatchGlobal(const LLVector3d &position_global) const;
- LLSurfacePatch *resolvePatchRegion(const F32 x, const F32 y) const;
- LLSurfacePatch *resolvePatchRegion(const LLVector3 &position_region) const;
- LLSurfacePatch *resolvePatchGlobal(const LLVector3d &position_global) const;
+ // Update methods (called during idle, normally)
+ BOOL idleUpdate(F32 max_update_time);
- // Update methods (called during idle, normally)
- BOOL idleUpdate(F32 max_update_time);
+ BOOL containsPosition(const LLVector3 &position);
- BOOL containsPosition(const LLVector3 &position);
+ void moveZ(const S32 x, const S32 y, const F32 delta);
- void moveZ(const S32 x, const S32 y, const F32 delta);
+ LLViewerRegion *getRegion() const { return mRegionp; }
- LLViewerRegion *getRegion() const { return mRegionp; }
+ F32 getMinZ() const { return mMinZ; }
+ F32 getMaxZ() const { return mMaxZ; }
- F32 getMinZ() const { return mMinZ; }
- F32 getMaxZ() const { return mMaxZ; }
+ void setWaterHeight(F32 height);
+ F32 getWaterHeight() const;
- void setWaterHeight(F32 height);
- F32 getWaterHeight() const;
+ LLViewerTexture *getSTexture();
+ LLViewerTexture *getWaterTexture();
+ BOOL hasZData() const { return mHasZData; }
- LLViewerTexture *getSTexture();
- LLViewerTexture *getWaterTexture();
- BOOL hasZData() const { return mHasZData; }
+ void dirtyAllPatches(); // Use this to dirty all patches when changing terrain parameters
- void dirtyAllPatches(); // Use this to dirty all patches when changing terrain parameters
+ void dirtySurfacePatch(LLSurfacePatch *patchp);
+ LLVOWater *getWaterObj() { return mWaterObjp; }
- void dirtySurfacePatch(LLSurfacePatch *patchp);
- LLVOWater *getWaterObj() { return mWaterObjp; }
+ static void setTextureSize(const S32 texture_size);
- static void setTextureSize(const S32 texture_size);
+ friend class LLSurfacePatch;
+ friend std::ostream& operator<<(std::ostream &s, const LLSurface &S);
+
+ void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions );
+ void getNeighboringRegionsStatus( std::vector<S32>& regions );
- friend class LLSurfacePatch;
- friend std::ostream& operator<<(std::ostream &s, const LLSurface &S);
-
- void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions );
- void getNeighboringRegionsStatus( std::vector<S32>& regions );
-
public:
- // Number of grid points on one side of a region, including +1 buffer for
- // north and east edge.
- S32 mGridsPerEdge;
+ // Number of grid points on one side of a region, including +1 buffer for
+ // north and east edge.
+ S32 mGridsPerEdge;
+
+ F32 mOOGridsPerEdge; // Inverse of grids per edge
- F32 mOOGridsPerEdge; // Inverse of grids per edge
+ S32 mPatchesPerEdge; // Number of patches on one side of a region
+ S32 mNumberOfPatches; // Total number of patches
- S32 mPatchesPerEdge; // Number of patches on one side of a region
- S32 mNumberOfPatches; // Total number of patches
+ // Each surface points at 8 neighbors (or NULL)
+ // +---+---+---+
+ // |NW | N | NE|
+ // +---+---+---+
+ // | W | 0 | E |
+ // +---+---+---+
+ // |SW | S | SE|
+ // +---+---+---+
+ LLSurface *mNeighbors[8]; // Adjacent patches
- // Each surface points at 8 neighbors (or NULL)
- // +---+---+---+
- // |NW | N | NE|
- // +---+---+---+
- // | W | 0 | E |
- // +---+---+---+
- // |SW | S | SE|
- // +---+---+---+
- LLSurface *mNeighbors[8]; // Adjacent patches
+ U32 mType; // Useful for identifying derived classes
- U32 mType; // Useful for identifying derived classes
-
- F32 mDetailTextureScale; // Number of times to repeat detail texture across this surface
+ F32 mDetailTextureScale; // Number of times to repeat detail texture across this surface
protected:
- void createSTexture();
- void createWaterTexture();
- void initTextures();
- void initWater();
+ void createSTexture();
+ void createWaterTexture();
+ void initTextures();
+ void initWater();
- void createPatchData(); // Allocates memory for patches.
- void destroyPatchData(); // Deallocates memory for patches.
+ void createPatchData(); // Allocates memory for patches.
+ void destroyPatchData(); // Deallocates memory for patches.
- BOOL generateWaterTexture(const F32 x, const F32 y,
- const F32 width, const F32 height); // Generate texture from composition values.
+ BOOL generateWaterTexture(const F32 x, const F32 y,
+ const F32 width, const F32 height); // Generate texture from composition values.
- //F32 updateTexture(LLSurfacePatch *ppatch);
-
- LLSurfacePatch *getPatch(const S32 x, const S32 y) const;
+ //F32 updateTexture(LLSurfacePatch *ppatch);
+
+ LLSurfacePatch *getPatch(const S32 x, const S32 y) const;
protected:
- LLVector3d mOriginGlobal; // In absolute frame
- LLSurfacePatch *mPatchList; // Array of all patches
+ LLVector3d mOriginGlobal; // In absolute frame
+ LLSurfacePatch *mPatchList; // Array of all patches
- // Array of grid data, mGridsPerEdge * mGridsPerEdge
- F32 *mSurfaceZ;
+ // Array of grid data, mGridsPerEdge * mGridsPerEdge
+ F32 *mSurfaceZ;
- // Array of grid normals, mGridsPerEdge * mGridsPerEdge
- LLVector3 *mNorm;
+ // Array of grid normals, mGridsPerEdge * mGridsPerEdge
+ LLVector3 *mNorm;
- std::set<LLSurfacePatch *> mDirtyPatchList;
+ std::set<LLSurfacePatch *> mDirtyPatchList;
- // The textures should never be directly initialized - use the setter methods!
- LLPointer<LLViewerTexture> mSTexturep; // Texture for surface
- LLPointer<LLViewerTexture> mWaterTexturep; // Water texture
+ // The textures should never be directly initialized - use the setter methods!
+ LLPointer<LLViewerTexture> mSTexturep; // Texture for surface
+ LLPointer<LLViewerTexture> mWaterTexturep; // Water texture
- LLPointer<LLVOWater> mWaterObjp;
+ LLPointer<LLVOWater> mWaterObjp;
- // When we want multiple cameras we'll need one of each these for each camera
- S32 mVisiblePatchCount;
+ // When we want multiple cameras we'll need one of each these for each camera
+ S32 mVisiblePatchCount;
- U32 mGridsPerPatchEdge; // Number of grid points on a side of a patch
- F32 mMetersPerGrid; // Converts (i,j) indecies to distance
- F32 mMetersPerEdge; // = mMetersPerGrid * (mGridsPerEdge-1)
+ U32 mGridsPerPatchEdge; // Number of grid points on a side of a patch
+ F32 mMetersPerGrid; // Converts (i,j) indecies to distance
+ F32 mMetersPerEdge; // = mMetersPerGrid * (mGridsPerEdge-1)
- LLPatchVertexArray mPVArray;
+ LLPatchVertexArray mPVArray;
- BOOL mHasZData; // We've received any patch data for this surface.
- F32 mMinZ; // min z for this region (during the session)
- F32 mMaxZ; // max z for this region (during the session)
+ BOOL mHasZData; // We've received any patch data for this surface.
+ F32 mMinZ; // min z for this region (during the session)
+ F32 mMaxZ; // max z for this region (during the session)
- S32 mSurfacePatchUpdateCount; // Number of frames since last update.
+ S32 mSurfacePatchUpdateCount; // Number of frames since last update.
private:
- LLViewerRegion *mRegionp; // Patch whose coordinate system this surface is using.
- static S32 sTextureSize; // Size of the surface texture
+ LLViewerRegion *mRegionp; // Patch whose coordinate system this surface is using.
+ static S32 sTextureSize; // Size of the surface texture
};
// . __.
// Z /|\ /| Y North
-// | /
+// | /
// | / |<----------------- mGridsPerSurfaceEdge --------------->|
// | / __________________________________________________________
// |/______\ X /_______________________________________________________ /
-// / / / / / / / /M*M-2 /M*M-1 / /
-// /______/______/______/______/______/______/______/______/ /
-// / / / / / / / / / /
-// /______/______/______/______/______/______/______/______/ /
-// / / / / / / / / / /
-// /______/______/______/______/______/______/______/______/ /
-// West / / / / / / / / / /
+// / / / / / / / /M*M-2 /M*M-1 / /
+// /______/______/______/______/______/______/______/______/ /
+// / / / / / / / / / /
+// /______/______/______/______/______/______/______/______/ /
+// / / / / / / / / / /
+// /______/______/______/______/______/______/______/______/ /
+// West / / / / / / / / / /
// /______/______/______/______/______/______/______/______/ / East
-// /... / / / / / / / / /
-// /______/______/______/______/______/______/______/______/ /
-// _. / 2M / / / / / / / / /
-// /| /______/______/______/______/______/______/______/______/ /
-// / / M / M+1 / M+2 / ... / / / / 2M-1 / /
-// j /______/______/______/______/______/______/______/______/ /
-// / 0 / 1 / 2 / ... / / / / M-1 / /
-// /______/______/______/______/______/______/______/______/_/
+// /... / / / / / / / / /
+// /______/______/______/______/______/______/______/______/ /
+// _. / 2M / / / / / / / / /
+// /| /______/______/______/______/______/______/______/______/ /
+// / / M / M+1 / M+2 / ... / / / / 2M-1 / /
+// j /______/______/______/______/______/______/______/______/ /
+// / 0 / 1 / 2 / ... / / / / M-1 / /
+// /______/______/______/______/______/______/______/______/_/
// South |<-L->|
// i -->
//
// where M = mSurfPatchWidth
// and L = mPatchGridWidth
-//
+//
// Notice that mGridsPerSurfaceEdge = a power of two + 1
-// This provides a buffer on the east and north edges that will allow us to
+// This provides a buffer on the east and north edges that will allow us to
// fill the cracks between adjacent surfaces when rendering.
#endif
diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp
index 449d3d95c8..b71b6ae50c 100644
--- a/indra/newview/llsurfacepatch.cpp
+++ b/indra/newview/llsurfacepatch.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsurfacepatch.cpp
* @brief LLSurfacePatch class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,196 +46,196 @@ extern bool gShiftFrame;
extern U64MicrosecondsImplicit gFrameTime;
extern LLPipeline gPipeline;
-LLSurfacePatch::LLSurfacePatch()
-: mHasReceivedData(FALSE),
- mSTexUpdate(FALSE),
- mDirty(FALSE),
- mDirtyZStats(TRUE),
- mHeightsGenerated(FALSE),
- mDataOffset(0),
- mDataZ(NULL),
- mDataNorm(NULL),
- mVObjp(NULL),
- mOriginRegion(0.f, 0.f, 0.f),
- mCenterRegion(0.f, 0.f, 0.f),
- mMinZ(0.f),
- mMaxZ(0.f),
- mMeanZ(0.f),
- mRadius(0.f),
- mMinComposition(0.f),
- mMaxComposition(0.f),
- mMeanComposition(0.f),
- // This flag is used to communicate between adjacent surfaces and is
- // set to non-zero values by higher classes.
- mConnectedEdge(NO_EDGE),
- mLastUpdateTime(0),
- mSurfacep(NULL)
-{
- S32 i;
- for (i = 0; i < 8; i++)
- {
- setNeighborPatch(i, NULL);
- }
- for (i = 0; i < 9; i++)
- {
- mNormalsInvalid[i] = TRUE;
- }
+LLSurfacePatch::LLSurfacePatch()
+: mHasReceivedData(FALSE),
+ mSTexUpdate(FALSE),
+ mDirty(FALSE),
+ mDirtyZStats(TRUE),
+ mHeightsGenerated(FALSE),
+ mDataOffset(0),
+ mDataZ(NULL),
+ mDataNorm(NULL),
+ mVObjp(NULL),
+ mOriginRegion(0.f, 0.f, 0.f),
+ mCenterRegion(0.f, 0.f, 0.f),
+ mMinZ(0.f),
+ mMaxZ(0.f),
+ mMeanZ(0.f),
+ mRadius(0.f),
+ mMinComposition(0.f),
+ mMaxComposition(0.f),
+ mMeanComposition(0.f),
+ // This flag is used to communicate between adjacent surfaces and is
+ // set to non-zero values by higher classes.
+ mConnectedEdge(NO_EDGE),
+ mLastUpdateTime(0),
+ mSurfacep(NULL)
+{
+ S32 i;
+ for (i = 0; i < 8; i++)
+ {
+ setNeighborPatch(i, NULL);
+ }
+ for (i = 0; i < 9; i++)
+ {
+ mNormalsInvalid[i] = TRUE;
+ }
}
LLSurfacePatch::~LLSurfacePatch()
{
- mVObjp = NULL;
+ mVObjp = NULL;
}
void LLSurfacePatch::dirty()
{
- // These are outside of the loop in case we're still waiting for a dirty from the
- // texture being updated...
- if (mVObjp)
- {
- mVObjp->dirtyGeom();
- }
- else
- {
- LL_WARNS("Terrain") << "No viewer object for this surface patch!" << LL_ENDL;
- }
-
- mDirtyZStats = TRUE;
- mHeightsGenerated = FALSE;
-
- if (!mDirty)
- {
- mDirty = TRUE;
- mSurfacep->dirtySurfacePatch(this);
- }
+ // These are outside of the loop in case we're still waiting for a dirty from the
+ // texture being updated...
+ if (mVObjp)
+ {
+ mVObjp->dirtyGeom();
+ }
+ else
+ {
+ LL_WARNS("Terrain") << "No viewer object for this surface patch!" << LL_ENDL;
+ }
+
+ mDirtyZStats = TRUE;
+ mHeightsGenerated = FALSE;
+
+ if (!mDirty)
+ {
+ mDirty = TRUE;
+ mSurfacep->dirtySurfacePatch(this);
+ }
}
void LLSurfacePatch::setSurface(LLSurface *surfacep)
{
- mSurfacep = surfacep;
- if (mVObjp == (LLVOSurfacePatch *)NULL)
- {
- llassert(mSurfacep->mType == 'l');
-
- mVObjp = (LLVOSurfacePatch *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_SURFACE_PATCH, mSurfacep->getRegion());
- mVObjp->setPatch(this);
- mVObjp->setPositionRegion(mCenterRegion);
- gPipeline.createObject(mVObjp);
- }
-}
+ mSurfacep = surfacep;
+ if (mVObjp == (LLVOSurfacePatch *)NULL)
+ {
+ llassert(mSurfacep->mType == 'l');
+
+ mVObjp = (LLVOSurfacePatch *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_SURFACE_PATCH, mSurfacep->getRegion());
+ mVObjp->setPatch(this);
+ mVObjp->setPositionRegion(mCenterRegion);
+ gPipeline.createObject(mVObjp);
+ }
+}
void LLSurfacePatch::disconnectNeighbor(LLSurface *surfacep)
{
- U32 i;
- for (i = 0; i < 8; i++)
- {
- if (getNeighborPatch(i))
- {
- if (getNeighborPatch(i)->mSurfacep == surfacep)
- {
- setNeighborPatch(i, NULL);
- mNormalsInvalid[i] = TRUE;
- }
- }
- }
-
- // Clean up connected edges
- if (getNeighborPatch(EAST))
- {
- if (getNeighborPatch(EAST)->mSurfacep == surfacep)
- {
- mConnectedEdge &= ~EAST_EDGE;
- }
- }
- if (getNeighborPatch(NORTH))
- {
- if (getNeighborPatch(NORTH)->mSurfacep == surfacep)
- {
- mConnectedEdge &= ~NORTH_EDGE;
- }
- }
- if (getNeighborPatch(WEST))
- {
- if (getNeighborPatch(WEST)->mSurfacep == surfacep)
- {
- mConnectedEdge &= ~WEST_EDGE;
- }
- }
- if (getNeighborPatch(SOUTH))
- {
- if (getNeighborPatch(SOUTH)->mSurfacep == surfacep)
- {
- mConnectedEdge &= ~SOUTH_EDGE;
- }
- }
+ U32 i;
+ for (i = 0; i < 8; i++)
+ {
+ if (getNeighborPatch(i))
+ {
+ if (getNeighborPatch(i)->mSurfacep == surfacep)
+ {
+ setNeighborPatch(i, NULL);
+ mNormalsInvalid[i] = TRUE;
+ }
+ }
+ }
+
+ // Clean up connected edges
+ if (getNeighborPatch(EAST))
+ {
+ if (getNeighborPatch(EAST)->mSurfacep == surfacep)
+ {
+ mConnectedEdge &= ~EAST_EDGE;
+ }
+ }
+ if (getNeighborPatch(NORTH))
+ {
+ if (getNeighborPatch(NORTH)->mSurfacep == surfacep)
+ {
+ mConnectedEdge &= ~NORTH_EDGE;
+ }
+ }
+ if (getNeighborPatch(WEST))
+ {
+ if (getNeighborPatch(WEST)->mSurfacep == surfacep)
+ {
+ mConnectedEdge &= ~WEST_EDGE;
+ }
+ }
+ if (getNeighborPatch(SOUTH))
+ {
+ if (getNeighborPatch(SOUTH)->mSurfacep == surfacep)
+ {
+ mConnectedEdge &= ~SOUTH_EDGE;
+ }
+ }
}
LLVector3 LLSurfacePatch::getPointAgent(const U32 x, const U32 y) const
{
- U32 surface_stride = mSurfacep->getGridsPerEdge();
- U32 point_offset = x + y*surface_stride;
- LLVector3 pos;
- pos = getOriginAgent();
- pos.mV[VX] += x * mSurfacep->getMetersPerGrid();
- pos.mV[VY] += y * mSurfacep->getMetersPerGrid();
- pos.mV[VZ] = *(mDataZ + point_offset);
- return pos;
+ U32 surface_stride = mSurfacep->getGridsPerEdge();
+ U32 point_offset = x + y*surface_stride;
+ LLVector3 pos;
+ pos = getOriginAgent();
+ pos.mV[VX] += x * mSurfacep->getMetersPerGrid();
+ pos.mV[VY] += y * mSurfacep->getMetersPerGrid();
+ pos.mV[VZ] = *(mDataZ + point_offset);
+ return pos;
}
LLVector2 LLSurfacePatch::getTexCoords(const U32 x, const U32 y) const
{
- U32 surface_stride = mSurfacep->getGridsPerEdge();
- U32 point_offset = x + y*surface_stride;
- LLVector3 pos, rel_pos;
- pos = getOriginAgent();
- pos.mV[VX] += x * mSurfacep->getMetersPerGrid();
- pos.mV[VY] += y * mSurfacep->getMetersPerGrid();
- pos.mV[VZ] = *(mDataZ + point_offset);
- rel_pos = pos - mSurfacep->getOriginAgent();
- rel_pos *= 1.f/surface_stride;
- return LLVector2(rel_pos.mV[VX], rel_pos.mV[VY]);
+ U32 surface_stride = mSurfacep->getGridsPerEdge();
+ U32 point_offset = x + y*surface_stride;
+ LLVector3 pos, rel_pos;
+ pos = getOriginAgent();
+ pos.mV[VX] += x * mSurfacep->getMetersPerGrid();
+ pos.mV[VY] += y * mSurfacep->getMetersPerGrid();
+ pos.mV[VZ] = *(mDataZ + point_offset);
+ rel_pos = pos - mSurfacep->getOriginAgent();
+ rel_pos *= 1.f/surface_stride;
+ return LLVector2(rel_pos.mV[VX], rel_pos.mV[VY]);
}
void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3 *vertex, LLVector3 *normal,
- LLVector2 *tex0, LLVector2 *tex1)
+ LLVector2 *tex0, LLVector2 *tex1)
{
- if (!mSurfacep || !mSurfacep->getRegion() || !mSurfacep->getGridsPerEdge() || !mVObjp)
- {
- return; // failsafe
- }
- llassert_always(vertex && normal && tex0 && tex1);
-
- U32 surface_stride = mSurfacep->getGridsPerEdge();
- U32 point_offset = x + y*surface_stride;
-
- *normal = getNormal(x, y);
-
- LLVector3 pos_agent = getOriginAgent();
- pos_agent.mV[VX] += x * mSurfacep->getMetersPerGrid();
- pos_agent.mV[VY] += y * mSurfacep->getMetersPerGrid();
- pos_agent.mV[VZ] = *(mDataZ + point_offset);
- *vertex = pos_agent-mVObjp->getRegion()->getOriginAgent();
-
- LLVector3 rel_pos = pos_agent - mSurfacep->getOriginAgent();
- LLVector3 tex_pos = rel_pos * (1.f/surface_stride);
- tex0->mV[0] = tex_pos.mV[0];
- tex0->mV[1] = tex_pos.mV[1];
- tex1->mV[0] = mSurfacep->getRegion()->getCompositionXY(llfloor(mOriginRegion.mV[0])+x, llfloor(mOriginRegion.mV[1])+y);
-
- const F32 xyScale = 4.9215f*7.f; //0.93284f;
- const F32 xyScaleInv = (1.f / xyScale)*(0.2222222222f);
-
- F32 vec[3] = {
+ if (!mSurfacep || !mSurfacep->getRegion() || !mSurfacep->getGridsPerEdge() || !mVObjp)
+ {
+ return; // failsafe
+ }
+ llassert_always(vertex && normal && tex0 && tex1);
+
+ U32 surface_stride = mSurfacep->getGridsPerEdge();
+ U32 point_offset = x + y*surface_stride;
+
+ *normal = getNormal(x, y);
+
+ LLVector3 pos_agent = getOriginAgent();
+ pos_agent.mV[VX] += x * mSurfacep->getMetersPerGrid();
+ pos_agent.mV[VY] += y * mSurfacep->getMetersPerGrid();
+ pos_agent.mV[VZ] = *(mDataZ + point_offset);
+ *vertex = pos_agent-mVObjp->getRegion()->getOriginAgent();
+
+ LLVector3 rel_pos = pos_agent - mSurfacep->getOriginAgent();
+ LLVector3 tex_pos = rel_pos * (1.f/surface_stride);
+ tex0->mV[0] = tex_pos.mV[0];
+ tex0->mV[1] = tex_pos.mV[1];
+ tex1->mV[0] = mSurfacep->getRegion()->getCompositionXY(llfloor(mOriginRegion.mV[0])+x, llfloor(mOriginRegion.mV[1])+y);
+
+ const F32 xyScale = 4.9215f*7.f; //0.93284f;
+ const F32 xyScaleInv = (1.f / xyScale)*(0.2222222222f);
+
+ F32 vec[3] = {
(F32)fmod((F32)(mOriginGlobal.mdV[0] + x)*xyScaleInv, 256.f),
(F32)fmod((F32)(mOriginGlobal.mdV[1] + y)*xyScaleInv, 256.f),
- 0.f
- };
- F32 rand_val = llclamp(noise2(vec)* 0.75f + 0.5f, 0.f, 1.f);
- tex1->mV[1] = rand_val;
+ 0.f
+ };
+ F32 rand_val = llclamp(noise2(vec)* 0.75f + 0.5f, 0.f, 1.f);
+ tex1->mV[1] = rand_val;
}
@@ -243,790 +243,790 @@ void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3
void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride)
{
- U32 patch_width = mSurfacep->mPVArray.mPatchWidth;
- U32 surface_stride = mSurfacep->getGridsPerEdge();
-
- const F32 mpg = mSurfacep->getMetersPerGrid() * stride;
-
- S32 poffsets[2][2][2];
- poffsets[0][0][0] = x - stride;
- poffsets[0][0][1] = y - stride;
-
- poffsets[0][1][0] = x - stride;
- poffsets[0][1][1] = y + stride;
-
- poffsets[1][0][0] = x + stride;
- poffsets[1][0][1] = y - stride;
-
- poffsets[1][1][0] = x + stride;
- poffsets[1][1][1] = y + stride;
-
- const LLSurfacePatch *ppatches[2][2];
-
- // LLVector3 p1, p2, p3, p4;
-
- ppatches[0][0] = this;
- ppatches[0][1] = this;
- ppatches[1][0] = this;
- ppatches[1][1] = this;
-
- U32 i, j;
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 2; j++)
- {
- if (poffsets[i][j][0] < 0)
- {
- if (!ppatches[i][j]->getNeighborPatch(WEST))
- {
- poffsets[i][j][0] = 0;
- }
- else
- {
- poffsets[i][j][0] += patch_width;
- ppatches[i][j] = ppatches[i][j]->getNeighborPatch(WEST);
- }
- }
- if (poffsets[i][j][1] < 0)
- {
- if (!ppatches[i][j]->getNeighborPatch(SOUTH))
- {
- poffsets[i][j][1] = 0;
- }
- else
- {
- poffsets[i][j][1] += patch_width;
- ppatches[i][j] = ppatches[i][j]->getNeighborPatch(SOUTH);
- }
- }
- if (poffsets[i][j][0] >= (S32)patch_width)
- {
- if (!ppatches[i][j]->getNeighborPatch(EAST))
- {
- poffsets[i][j][0] = patch_width - 1;
- }
- else
- {
- poffsets[i][j][0] -= patch_width;
- ppatches[i][j] = ppatches[i][j]->getNeighborPatch(EAST);
- }
- }
- if (poffsets[i][j][1] >= (S32)patch_width)
- {
- if (!ppatches[i][j]->getNeighborPatch(NORTH))
- {
- poffsets[i][j][1] = patch_width - 1;
- }
- else
- {
- poffsets[i][j][1] -= patch_width;
- ppatches[i][j] = ppatches[i][j]->getNeighborPatch(NORTH);
- }
- }
- }
- }
-
- LLVector3 p00(-mpg,-mpg,
- *(ppatches[0][0]->mDataZ
- + poffsets[0][0][0]
- + poffsets[0][0][1]*surface_stride));
- LLVector3 p01(-mpg,+mpg,
- *(ppatches[0][1]->mDataZ
- + poffsets[0][1][0]
- + poffsets[0][1][1]*surface_stride));
- LLVector3 p10(+mpg,-mpg,
- *(ppatches[1][0]->mDataZ
- + poffsets[1][0][0]
- + poffsets[1][0][1]*surface_stride));
- LLVector3 p11(+mpg,+mpg,
- *(ppatches[1][1]->mDataZ
- + poffsets[1][1][0]
- + poffsets[1][1][1]*surface_stride));
-
- LLVector3 c1 = p11 - p00;
- LLVector3 c2 = p01 - p10;
-
- LLVector3 normal = c1;
- normal %= c2;
- normal.normVec();
-
- llassert(mDataNorm);
- *(mDataNorm + surface_stride * y + x) = normal;
+ U32 patch_width = mSurfacep->mPVArray.mPatchWidth;
+ U32 surface_stride = mSurfacep->getGridsPerEdge();
+
+ const F32 mpg = mSurfacep->getMetersPerGrid() * stride;
+
+ S32 poffsets[2][2][2];
+ poffsets[0][0][0] = x - stride;
+ poffsets[0][0][1] = y - stride;
+
+ poffsets[0][1][0] = x - stride;
+ poffsets[0][1][1] = y + stride;
+
+ poffsets[1][0][0] = x + stride;
+ poffsets[1][0][1] = y - stride;
+
+ poffsets[1][1][0] = x + stride;
+ poffsets[1][1][1] = y + stride;
+
+ const LLSurfacePatch *ppatches[2][2];
+
+ // LLVector3 p1, p2, p3, p4;
+
+ ppatches[0][0] = this;
+ ppatches[0][1] = this;
+ ppatches[1][0] = this;
+ ppatches[1][1] = this;
+
+ U32 i, j;
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ if (poffsets[i][j][0] < 0)
+ {
+ if (!ppatches[i][j]->getNeighborPatch(WEST))
+ {
+ poffsets[i][j][0] = 0;
+ }
+ else
+ {
+ poffsets[i][j][0] += patch_width;
+ ppatches[i][j] = ppatches[i][j]->getNeighborPatch(WEST);
+ }
+ }
+ if (poffsets[i][j][1] < 0)
+ {
+ if (!ppatches[i][j]->getNeighborPatch(SOUTH))
+ {
+ poffsets[i][j][1] = 0;
+ }
+ else
+ {
+ poffsets[i][j][1] += patch_width;
+ ppatches[i][j] = ppatches[i][j]->getNeighborPatch(SOUTH);
+ }
+ }
+ if (poffsets[i][j][0] >= (S32)patch_width)
+ {
+ if (!ppatches[i][j]->getNeighborPatch(EAST))
+ {
+ poffsets[i][j][0] = patch_width - 1;
+ }
+ else
+ {
+ poffsets[i][j][0] -= patch_width;
+ ppatches[i][j] = ppatches[i][j]->getNeighborPatch(EAST);
+ }
+ }
+ if (poffsets[i][j][1] >= (S32)patch_width)
+ {
+ if (!ppatches[i][j]->getNeighborPatch(NORTH))
+ {
+ poffsets[i][j][1] = patch_width - 1;
+ }
+ else
+ {
+ poffsets[i][j][1] -= patch_width;
+ ppatches[i][j] = ppatches[i][j]->getNeighborPatch(NORTH);
+ }
+ }
+ }
+ }
+
+ LLVector3 p00(-mpg,-mpg,
+ *(ppatches[0][0]->mDataZ
+ + poffsets[0][0][0]
+ + poffsets[0][0][1]*surface_stride));
+ LLVector3 p01(-mpg,+mpg,
+ *(ppatches[0][1]->mDataZ
+ + poffsets[0][1][0]
+ + poffsets[0][1][1]*surface_stride));
+ LLVector3 p10(+mpg,-mpg,
+ *(ppatches[1][0]->mDataZ
+ + poffsets[1][0][0]
+ + poffsets[1][0][1]*surface_stride));
+ LLVector3 p11(+mpg,+mpg,
+ *(ppatches[1][1]->mDataZ
+ + poffsets[1][1][0]
+ + poffsets[1][1][1]*surface_stride));
+
+ LLVector3 c1 = p11 - p00;
+ LLVector3 c2 = p01 - p10;
+
+ LLVector3 normal = c1;
+ normal %= c2;
+ normal.normVec();
+
+ llassert(mDataNorm);
+ *(mDataNorm + surface_stride * y + x) = normal;
}
const LLVector3 &LLSurfacePatch::getNormal(const U32 x, const U32 y) const
{
- U32 surface_stride = mSurfacep->getGridsPerEdge();
- llassert(mDataNorm);
- return *(mDataNorm + surface_stride * y + x);
+ U32 surface_stride = mSurfacep->getGridsPerEdge();
+ llassert(mDataNorm);
+ return *(mDataNorm + surface_stride * y + x);
}
void LLSurfacePatch::updateCameraDistanceRegion(const LLVector3 &pos_region)
{
- if (LLPipeline::sDynamicLOD)
- {
- if (!gShiftFrame)
- {
- LLVector3 dv = pos_region;
- dv -= mCenterRegion;
- mVisInfo.mDistance = llmax(0.f, (F32)(dv.magVec() - mRadius))/
- llmax(LLVOSurfacePatch::sLODFactor, 0.1f);
- }
- }
- else
- {
- mVisInfo.mDistance = 0.f;
- }
+ if (LLPipeline::sDynamicLOD)
+ {
+ if (!gShiftFrame)
+ {
+ LLVector3 dv = pos_region;
+ dv -= mCenterRegion;
+ mVisInfo.mDistance = llmax(0.f, (F32)(dv.magVec() - mRadius))/
+ llmax(LLVOSurfacePatch::sLODFactor, 0.1f);
+ }
+ }
+ else
+ {
+ mVisInfo.mDistance = 0.f;
+ }
}
F32 LLSurfacePatch::getDistance() const
{
- return mVisInfo.mDistance;
+ return mVisInfo.mDistance;
}
// Called when a patch has changed its height field
// data.
-void LLSurfacePatch::updateVerticalStats()
+void LLSurfacePatch::updateVerticalStats()
{
- if (!mDirtyZStats)
- {
- return;
- }
-
- U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
- U32 grids_per_edge = mSurfacep->getGridsPerEdge();
- F32 meters_per_grid = mSurfacep->getMetersPerGrid();
-
- U32 i, j, k;
- F32 z, total;
-
- llassert(mDataZ);
- z = *(mDataZ);
-
- mMinZ = z;
- mMaxZ = z;
-
- k = 0;
- total = 0.0f;
-
- // Iterate to +1 because we need to do the edges correctly.
- for (j=0; j<(grids_per_patch_edge+1); j++)
- {
- for (i=0; i<(grids_per_patch_edge+1); i++)
- {
- z = *(mDataZ + i + j*grids_per_edge);
-
- if (z < mMinZ)
- {
- mMinZ = z;
- }
- if (z > mMaxZ)
- {
- mMaxZ = z;
- }
- total += z;
- k++;
- }
- }
- mMeanZ = total / (F32) k;
- mCenterRegion.mV[VZ] = 0.5f * (mMinZ + mMaxZ);
-
- LLVector3 diam_vec(meters_per_grid*grids_per_patch_edge,
- meters_per_grid*grids_per_patch_edge,
- mMaxZ - mMinZ);
- mRadius = diam_vec.magVec() * 0.5f;
-
- mSurfacep->mMaxZ = llmax(mMaxZ, mSurfacep->mMaxZ);
- mSurfacep->mMinZ = llmin(mMinZ, mSurfacep->mMinZ);
- mSurfacep->mHasZData = TRUE;
- mSurfacep->getRegion()->calculateCenterGlobal();
-
- if (mVObjp)
- {
- mVObjp->dirtyPatch();
- }
- mDirtyZStats = FALSE;
+ if (!mDirtyZStats)
+ {
+ return;
+ }
+
+ U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
+ U32 grids_per_edge = mSurfacep->getGridsPerEdge();
+ F32 meters_per_grid = mSurfacep->getMetersPerGrid();
+
+ U32 i, j, k;
+ F32 z, total;
+
+ llassert(mDataZ);
+ z = *(mDataZ);
+
+ mMinZ = z;
+ mMaxZ = z;
+
+ k = 0;
+ total = 0.0f;
+
+ // Iterate to +1 because we need to do the edges correctly.
+ for (j=0; j<(grids_per_patch_edge+1); j++)
+ {
+ for (i=0; i<(grids_per_patch_edge+1); i++)
+ {
+ z = *(mDataZ + i + j*grids_per_edge);
+
+ if (z < mMinZ)
+ {
+ mMinZ = z;
+ }
+ if (z > mMaxZ)
+ {
+ mMaxZ = z;
+ }
+ total += z;
+ k++;
+ }
+ }
+ mMeanZ = total / (F32) k;
+ mCenterRegion.mV[VZ] = 0.5f * (mMinZ + mMaxZ);
+
+ LLVector3 diam_vec(meters_per_grid*grids_per_patch_edge,
+ meters_per_grid*grids_per_patch_edge,
+ mMaxZ - mMinZ);
+ mRadius = diam_vec.magVec() * 0.5f;
+
+ mSurfacep->mMaxZ = llmax(mMaxZ, mSurfacep->mMaxZ);
+ mSurfacep->mMinZ = llmin(mMinZ, mSurfacep->mMinZ);
+ mSurfacep->mHasZData = TRUE;
+ mSurfacep->getRegion()->calculateCenterGlobal();
+
+ if (mVObjp)
+ {
+ mVObjp->dirtyPatch();
+ }
+ mDirtyZStats = FALSE;
}
-void LLSurfacePatch::updateNormals()
+void LLSurfacePatch::updateNormals()
{
- if (mSurfacep->mType == 'w')
- {
- return;
- }
- U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
- U32 grids_per_edge = mSurfacep->getGridsPerEdge();
-
- BOOL dirty_patch = FALSE;
-
- U32 i, j;
- // update the east edge
- if (mNormalsInvalid[EAST] || mNormalsInvalid[NORTHEAST] || mNormalsInvalid[SOUTHEAST])
- {
- for (j = 0; j <= grids_per_patch_edge; j++)
- {
- calcNormal(grids_per_patch_edge, j, 2);
- calcNormal(grids_per_patch_edge - 1, j, 2);
- calcNormal(grids_per_patch_edge - 2, j, 2);
- }
-
- dirty_patch = TRUE;
- }
-
- // update the north edge
- if (mNormalsInvalid[NORTHEAST] || mNormalsInvalid[NORTH] || mNormalsInvalid[NORTHWEST])
- {
- for (i = 0; i <= grids_per_patch_edge; i++)
- {
- calcNormal(i, grids_per_patch_edge, 2);
- calcNormal(i, grids_per_patch_edge - 1, 2);
- calcNormal(i, grids_per_patch_edge - 2, 2);
- }
-
- dirty_patch = TRUE;
- }
-
- // update the west edge
- if (mNormalsInvalid[NORTHWEST] || mNormalsInvalid[WEST] || mNormalsInvalid[SOUTHWEST])
- {
- for (j = 0; j < grids_per_patch_edge; j++)
- {
- calcNormal(0, j, 2);
- calcNormal(1, j, 2);
- }
- dirty_patch = TRUE;
- }
-
- // update the south edge
- if (mNormalsInvalid[SOUTHWEST] || mNormalsInvalid[SOUTH] || mNormalsInvalid[SOUTHEAST])
- {
- for (i = 0; i < grids_per_patch_edge; i++)
- {
- calcNormal(i, 0, 2);
- calcNormal(i, 1, 2);
- }
- dirty_patch = TRUE;
- }
-
- // Invalidating the northeast corner is different, because depending on what the adjacent neighbors are,
- // we'll want to do different things.
- if (mNormalsInvalid[NORTHEAST])
- {
- if (!getNeighborPatch(NORTHEAST))
- {
- if (!getNeighborPatch(NORTH))
- {
- if (!getNeighborPatch(EAST))
- {
- // No north or east neighbors. Pull from the diagonal in your own patch.
- *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
- *(mDataZ + grids_per_patch_edge - 1 + (grids_per_patch_edge - 1)*grids_per_edge);
- }
- else
- {
- if (getNeighborPatch(EAST)->getHasReceivedData())
- {
- // East, but not north. Pull from your east neighbor's northwest point.
- *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
- *(getNeighborPatch(EAST)->mDataZ + (grids_per_patch_edge - 1)*grids_per_edge);
- }
- else
- {
- *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
- *(mDataZ + grids_per_patch_edge - 1 + (grids_per_patch_edge - 1)*grids_per_edge);
- }
- }
- }
- else
- {
- // We have a north.
- if (getNeighborPatch(EAST))
- {
- // North and east neighbors, but not northeast.
- // Pull from diagonal in your own patch.
- *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
- *(mDataZ + grids_per_patch_edge - 1 + (grids_per_patch_edge - 1)*grids_per_edge);
- }
- else
- {
- if (getNeighborPatch(NORTH)->getHasReceivedData())
- {
- // North, but not east. Pull from your north neighbor's southeast corner.
- *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
- *(getNeighborPatch(NORTH)->mDataZ + (grids_per_patch_edge - 1));
- }
- else
- {
- *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
- *(mDataZ + grids_per_patch_edge - 1 + (grids_per_patch_edge - 1)*grids_per_edge);
- }
- }
- }
- }
- else if (getNeighborPatch(NORTHEAST)->mSurfacep != mSurfacep)
- {
- if (
- (!getNeighborPatch(NORTH) || (getNeighborPatch(NORTH)->mSurfacep != mSurfacep))
- &&
- (!getNeighborPatch(EAST) || (getNeighborPatch(EAST)->mSurfacep != mSurfacep)))
- {
- *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
- *(getNeighborPatch(NORTHEAST)->mDataZ);
- }
- }
- else
- {
- // We've got a northeast patch in the same surface.
- // The z and normals will be handled by that patch.
- }
- calcNormal(grids_per_patch_edge, grids_per_patch_edge, 2);
- calcNormal(grids_per_patch_edge, grids_per_patch_edge - 1, 2);
- calcNormal(grids_per_patch_edge - 1, grids_per_patch_edge, 2);
- calcNormal(grids_per_patch_edge - 1, grids_per_patch_edge - 1, 2);
- dirty_patch = TRUE;
- }
-
- // update the middle normals
- if (mNormalsInvalid[MIDDLE])
- {
- for (j=2; j < grids_per_patch_edge - 2; j++)
- {
- for (i=2; i < grids_per_patch_edge - 2; i++)
- {
- calcNormal(i, j, 2);
- }
- }
- dirty_patch = TRUE;
- }
-
- if (dirty_patch)
- {
- mSurfacep->dirtySurfacePatch(this);
- }
-
- for (i = 0; i < 9; i++)
- {
- mNormalsInvalid[i] = FALSE;
- }
+ if (mSurfacep->mType == 'w')
+ {
+ return;
+ }
+ U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
+ U32 grids_per_edge = mSurfacep->getGridsPerEdge();
+
+ BOOL dirty_patch = FALSE;
+
+ U32 i, j;
+ // update the east edge
+ if (mNormalsInvalid[EAST] || mNormalsInvalid[NORTHEAST] || mNormalsInvalid[SOUTHEAST])
+ {
+ for (j = 0; j <= grids_per_patch_edge; j++)
+ {
+ calcNormal(grids_per_patch_edge, j, 2);
+ calcNormal(grids_per_patch_edge - 1, j, 2);
+ calcNormal(grids_per_patch_edge - 2, j, 2);
+ }
+
+ dirty_patch = TRUE;
+ }
+
+ // update the north edge
+ if (mNormalsInvalid[NORTHEAST] || mNormalsInvalid[NORTH] || mNormalsInvalid[NORTHWEST])
+ {
+ for (i = 0; i <= grids_per_patch_edge; i++)
+ {
+ calcNormal(i, grids_per_patch_edge, 2);
+ calcNormal(i, grids_per_patch_edge - 1, 2);
+ calcNormal(i, grids_per_patch_edge - 2, 2);
+ }
+
+ dirty_patch = TRUE;
+ }
+
+ // update the west edge
+ if (mNormalsInvalid[NORTHWEST] || mNormalsInvalid[WEST] || mNormalsInvalid[SOUTHWEST])
+ {
+ for (j = 0; j < grids_per_patch_edge; j++)
+ {
+ calcNormal(0, j, 2);
+ calcNormal(1, j, 2);
+ }
+ dirty_patch = TRUE;
+ }
+
+ // update the south edge
+ if (mNormalsInvalid[SOUTHWEST] || mNormalsInvalid[SOUTH] || mNormalsInvalid[SOUTHEAST])
+ {
+ for (i = 0; i < grids_per_patch_edge; i++)
+ {
+ calcNormal(i, 0, 2);
+ calcNormal(i, 1, 2);
+ }
+ dirty_patch = TRUE;
+ }
+
+ // Invalidating the northeast corner is different, because depending on what the adjacent neighbors are,
+ // we'll want to do different things.
+ if (mNormalsInvalid[NORTHEAST])
+ {
+ if (!getNeighborPatch(NORTHEAST))
+ {
+ if (!getNeighborPatch(NORTH))
+ {
+ if (!getNeighborPatch(EAST))
+ {
+ // No north or east neighbors. Pull from the diagonal in your own patch.
+ *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
+ *(mDataZ + grids_per_patch_edge - 1 + (grids_per_patch_edge - 1)*grids_per_edge);
+ }
+ else
+ {
+ if (getNeighborPatch(EAST)->getHasReceivedData())
+ {
+ // East, but not north. Pull from your east neighbor's northwest point.
+ *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
+ *(getNeighborPatch(EAST)->mDataZ + (grids_per_patch_edge - 1)*grids_per_edge);
+ }
+ else
+ {
+ *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
+ *(mDataZ + grids_per_patch_edge - 1 + (grids_per_patch_edge - 1)*grids_per_edge);
+ }
+ }
+ }
+ else
+ {
+ // We have a north.
+ if (getNeighborPatch(EAST))
+ {
+ // North and east neighbors, but not northeast.
+ // Pull from diagonal in your own patch.
+ *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
+ *(mDataZ + grids_per_patch_edge - 1 + (grids_per_patch_edge - 1)*grids_per_edge);
+ }
+ else
+ {
+ if (getNeighborPatch(NORTH)->getHasReceivedData())
+ {
+ // North, but not east. Pull from your north neighbor's southeast corner.
+ *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
+ *(getNeighborPatch(NORTH)->mDataZ + (grids_per_patch_edge - 1));
+ }
+ else
+ {
+ *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
+ *(mDataZ + grids_per_patch_edge - 1 + (grids_per_patch_edge - 1)*grids_per_edge);
+ }
+ }
+ }
+ }
+ else if (getNeighborPatch(NORTHEAST)->mSurfacep != mSurfacep)
+ {
+ if (
+ (!getNeighborPatch(NORTH) || (getNeighborPatch(NORTH)->mSurfacep != mSurfacep))
+ &&
+ (!getNeighborPatch(EAST) || (getNeighborPatch(EAST)->mSurfacep != mSurfacep)))
+ {
+ *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
+ *(getNeighborPatch(NORTHEAST)->mDataZ);
+ }
+ }
+ else
+ {
+ // We've got a northeast patch in the same surface.
+ // The z and normals will be handled by that patch.
+ }
+ calcNormal(grids_per_patch_edge, grids_per_patch_edge, 2);
+ calcNormal(grids_per_patch_edge, grids_per_patch_edge - 1, 2);
+ calcNormal(grids_per_patch_edge - 1, grids_per_patch_edge, 2);
+ calcNormal(grids_per_patch_edge - 1, grids_per_patch_edge - 1, 2);
+ dirty_patch = TRUE;
+ }
+
+ // update the middle normals
+ if (mNormalsInvalid[MIDDLE])
+ {
+ for (j=2; j < grids_per_patch_edge - 2; j++)
+ {
+ for (i=2; i < grids_per_patch_edge - 2; i++)
+ {
+ calcNormal(i, j, 2);
+ }
+ }
+ dirty_patch = TRUE;
+ }
+
+ if (dirty_patch)
+ {
+ mSurfacep->dirtySurfacePatch(this);
+ }
+
+ for (i = 0; i < 9; i++)
+ {
+ mNormalsInvalid[i] = FALSE;
+ }
}
void LLSurfacePatch::updateEastEdge()
{
- U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
- U32 grids_per_edge = mSurfacep->getGridsPerEdge();
-
- U32 j, k;
- F32 *west_surface, *east_surface;
-
- if (!getNeighborPatch(EAST))
- {
- west_surface = mDataZ + grids_per_patch_edge;
- east_surface = mDataZ + grids_per_patch_edge - 1;
- }
- else if (mConnectedEdge & EAST_EDGE)
- {
- west_surface = mDataZ + grids_per_patch_edge;
- east_surface = getNeighborPatch(EAST)->mDataZ;
- }
- else
- {
- return;
- }
-
- // If patchp is on the east edge of its surface, then we update the east
- // side buffer
- for (j=0; j < grids_per_patch_edge; j++)
- {
- k = j * grids_per_edge;
- *(west_surface + k) = *(east_surface + k); // update buffer Z
- }
+ U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
+ U32 grids_per_edge = mSurfacep->getGridsPerEdge();
+
+ U32 j, k;
+ F32 *west_surface, *east_surface;
+
+ if (!getNeighborPatch(EAST))
+ {
+ west_surface = mDataZ + grids_per_patch_edge;
+ east_surface = mDataZ + grids_per_patch_edge - 1;
+ }
+ else if (mConnectedEdge & EAST_EDGE)
+ {
+ west_surface = mDataZ + grids_per_patch_edge;
+ east_surface = getNeighborPatch(EAST)->mDataZ;
+ }
+ else
+ {
+ return;
+ }
+
+ // If patchp is on the east edge of its surface, then we update the east
+ // side buffer
+ for (j=0; j < grids_per_patch_edge; j++)
+ {
+ k = j * grids_per_edge;
+ *(west_surface + k) = *(east_surface + k); // update buffer Z
+ }
}
void LLSurfacePatch::updateNorthEdge()
{
- U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
- U32 grids_per_edge = mSurfacep->getGridsPerEdge();
-
- U32 i;
- F32 *south_surface, *north_surface;
-
- if (!getNeighborPatch(NORTH))
- {
- south_surface = mDataZ + grids_per_patch_edge*grids_per_edge;
- north_surface = mDataZ + (grids_per_patch_edge - 1) * grids_per_edge;
- }
- else if (mConnectedEdge & NORTH_EDGE)
- {
- south_surface = mDataZ + grids_per_patch_edge*grids_per_edge;
- north_surface = getNeighborPatch(NORTH)->mDataZ;
- }
- else
- {
- return;
- }
-
- // Update patchp's north edge ...
- for (i=0; i<grids_per_patch_edge; i++)
- {
- *(south_surface + i) = *(north_surface + i); // update buffer Z
- }
+ U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
+ U32 grids_per_edge = mSurfacep->getGridsPerEdge();
+
+ U32 i;
+ F32 *south_surface, *north_surface;
+
+ if (!getNeighborPatch(NORTH))
+ {
+ south_surface = mDataZ + grids_per_patch_edge*grids_per_edge;
+ north_surface = mDataZ + (grids_per_patch_edge - 1) * grids_per_edge;
+ }
+ else if (mConnectedEdge & NORTH_EDGE)
+ {
+ south_surface = mDataZ + grids_per_patch_edge*grids_per_edge;
+ north_surface = getNeighborPatch(NORTH)->mDataZ;
+ }
+ else
+ {
+ return;
+ }
+
+ // Update patchp's north edge ...
+ for (i=0; i<grids_per_patch_edge; i++)
+ {
+ *(south_surface + i) = *(north_surface + i); // update buffer Z
+ }
}
BOOL LLSurfacePatch::updateTexture()
{
- if (mSTexUpdate) // Update texture as needed
- {
- F32 meters_per_grid = getSurface()->getMetersPerGrid();
- F32 grids_per_patch_edge = (F32)getSurface()->getGridsPerPatchEdge();
-
- if ((!getNeighborPatch(EAST) || getNeighborPatch(EAST)->getHasReceivedData())
- && (!getNeighborPatch(WEST) || getNeighborPatch(WEST)->getHasReceivedData())
- && (!getNeighborPatch(SOUTH) || getNeighborPatch(SOUTH)->getHasReceivedData())
- && (!getNeighborPatch(NORTH) || getNeighborPatch(NORTH)->getHasReceivedData()))
- {
- LLViewerRegion *regionp = getSurface()->getRegion();
- LLVector3d origin_region = getOriginGlobal() - getSurface()->getOriginGlobal();
-
- // Have to figure out a better way to deal with these edge conditions...
- LLVLComposition* comp = regionp->getComposition();
- if (!mHeightsGenerated)
- {
- F32 patch_size = meters_per_grid*(grids_per_patch_edge+1);
- if (comp->generateHeights((F32)origin_region[VX], (F32)origin_region[VY],
- patch_size, patch_size))
- {
- mHeightsGenerated = TRUE;
- }
- else
- {
- return FALSE;
- }
- }
-
- if (comp->generateComposition())
- {
- if (mVObjp)
- {
- mVObjp->dirtyGeom();
- gPipeline.markGLRebuild(mVObjp);
- return !mSTexUpdate;
- }
- }
- }
- return FALSE;
- }
- else
- {
- return TRUE;
- }
+ if (mSTexUpdate) // Update texture as needed
+ {
+ F32 meters_per_grid = getSurface()->getMetersPerGrid();
+ F32 grids_per_patch_edge = (F32)getSurface()->getGridsPerPatchEdge();
+
+ if ((!getNeighborPatch(EAST) || getNeighborPatch(EAST)->getHasReceivedData())
+ && (!getNeighborPatch(WEST) || getNeighborPatch(WEST)->getHasReceivedData())
+ && (!getNeighborPatch(SOUTH) || getNeighborPatch(SOUTH)->getHasReceivedData())
+ && (!getNeighborPatch(NORTH) || getNeighborPatch(NORTH)->getHasReceivedData()))
+ {
+ LLViewerRegion *regionp = getSurface()->getRegion();
+ LLVector3d origin_region = getOriginGlobal() - getSurface()->getOriginGlobal();
+
+ // Have to figure out a better way to deal with these edge conditions...
+ LLVLComposition* comp = regionp->getComposition();
+ if (!mHeightsGenerated)
+ {
+ F32 patch_size = meters_per_grid*(grids_per_patch_edge+1);
+ if (comp->generateHeights((F32)origin_region[VX], (F32)origin_region[VY],
+ patch_size, patch_size))
+ {
+ mHeightsGenerated = TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+ if (comp->generateComposition())
+ {
+ if (mVObjp)
+ {
+ mVObjp->dirtyGeom();
+ gPipeline.markGLRebuild(mVObjp);
+ return !mSTexUpdate;
+ }
+ }
+ }
+ return FALSE;
+ }
+ else
+ {
+ return TRUE;
+ }
}
void LLSurfacePatch::updateGL()
{
- LL_PROFILE_ZONE_SCOPED
- F32 meters_per_grid = getSurface()->getMetersPerGrid();
- F32 grids_per_patch_edge = (F32)getSurface()->getGridsPerPatchEdge();
-
- LLViewerRegion *regionp = getSurface()->getRegion();
- LLVector3d origin_region = getOriginGlobal() - getSurface()->getOriginGlobal();
-
- LLVLComposition* comp = regionp->getComposition();
-
- updateCompositionStats();
- F32 tex_patch_size = meters_per_grid*grids_per_patch_edge;
- if (comp->generateTexture((F32)origin_region[VX], (F32)origin_region[VY],
- tex_patch_size, tex_patch_size))
- {
- mSTexUpdate = FALSE;
-
- // Also generate the water texture
- mSurfacep->generateWaterTexture((F32)origin_region.mdV[VX], (F32)origin_region.mdV[VY],
- tex_patch_size, tex_patch_size);
- }
+ LL_PROFILE_ZONE_SCOPED
+ F32 meters_per_grid = getSurface()->getMetersPerGrid();
+ F32 grids_per_patch_edge = (F32)getSurface()->getGridsPerPatchEdge();
+
+ LLViewerRegion *regionp = getSurface()->getRegion();
+ LLVector3d origin_region = getOriginGlobal() - getSurface()->getOriginGlobal();
+
+ LLVLComposition* comp = regionp->getComposition();
+
+ updateCompositionStats();
+ F32 tex_patch_size = meters_per_grid*grids_per_patch_edge;
+ if (comp->generateTexture((F32)origin_region[VX], (F32)origin_region[VY],
+ tex_patch_size, tex_patch_size))
+ {
+ mSTexUpdate = FALSE;
+
+ // Also generate the water texture
+ mSurfacep->generateWaterTexture((F32)origin_region.mdV[VX], (F32)origin_region.mdV[VY],
+ tex_patch_size, tex_patch_size);
+ }
}
void LLSurfacePatch::dirtyZ()
{
- mSTexUpdate = TRUE;
-
- // Invalidate all normals in this patch
- U32 i;
- for (i = 0; i < 9; i++)
- {
- mNormalsInvalid[i] = TRUE;
- }
-
- // Invalidate normals in this and neighboring patches
- for (i = 0; i < 8; i++)
- {
- if (getNeighborPatch(i))
- {
- getNeighborPatch(i)->mNormalsInvalid[gDirOpposite[i]] = TRUE;
- getNeighborPatch(i)->dirty();
- if (i < 4)
- {
- getNeighborPatch(i)->mNormalsInvalid[gDirAdjacent[gDirOpposite[i]][0]] = TRUE;
- getNeighborPatch(i)->mNormalsInvalid[gDirAdjacent[gDirOpposite[i]][1]] = TRUE;
- }
- }
- }
-
- dirty();
- mLastUpdateTime = gFrameTime;
+ mSTexUpdate = TRUE;
+
+ // Invalidate all normals in this patch
+ U32 i;
+ for (i = 0; i < 9; i++)
+ {
+ mNormalsInvalid[i] = TRUE;
+ }
+
+ // Invalidate normals in this and neighboring patches
+ for (i = 0; i < 8; i++)
+ {
+ if (getNeighborPatch(i))
+ {
+ getNeighborPatch(i)->mNormalsInvalid[gDirOpposite[i]] = TRUE;
+ getNeighborPatch(i)->dirty();
+ if (i < 4)
+ {
+ getNeighborPatch(i)->mNormalsInvalid[gDirAdjacent[gDirOpposite[i]][0]] = TRUE;
+ getNeighborPatch(i)->mNormalsInvalid[gDirAdjacent[gDirOpposite[i]][1]] = TRUE;
+ }
+ }
+ }
+
+ dirty();
+ mLastUpdateTime = gFrameTime;
}
const U64 &LLSurfacePatch::getLastUpdateTime() const
{
- return mLastUpdateTime;
+ return mLastUpdateTime;
}
F32 LLSurfacePatch::getMaxZ() const
{
- return mMaxZ;
+ return mMaxZ;
}
F32 LLSurfacePatch::getMinZ() const
{
- return mMinZ;
+ return mMinZ;
}
void LLSurfacePatch::setOriginGlobal(const LLVector3d &origin_global)
{
- mOriginGlobal = origin_global;
+ mOriginGlobal = origin_global;
+
+ LLVector3 origin_region;
+ origin_region.setVec(mOriginGlobal - mSurfacep->getOriginGlobal());
- LLVector3 origin_region;
- origin_region.setVec(mOriginGlobal - mSurfacep->getOriginGlobal());
+ mOriginRegion = origin_region;
+ mCenterRegion.mV[VX] = origin_region.mV[VX] + 0.5f*mSurfacep->getGridsPerPatchEdge()*mSurfacep->getMetersPerGrid();
+ mCenterRegion.mV[VY] = origin_region.mV[VY] + 0.5f*mSurfacep->getGridsPerPatchEdge()*mSurfacep->getMetersPerGrid();
- mOriginRegion = origin_region;
- mCenterRegion.mV[VX] = origin_region.mV[VX] + 0.5f*mSurfacep->getGridsPerPatchEdge()*mSurfacep->getMetersPerGrid();
- mCenterRegion.mV[VY] = origin_region.mV[VY] + 0.5f*mSurfacep->getGridsPerPatchEdge()*mSurfacep->getMetersPerGrid();
+ mVisInfo.mbIsVisible = FALSE;
+ mVisInfo.mDistance = 512.0f;
+ mVisInfo.mRenderLevel = 0;
+ mVisInfo.mRenderStride = mSurfacep->getGridsPerPatchEdge();
- mVisInfo.mbIsVisible = FALSE;
- mVisInfo.mDistance = 512.0f;
- mVisInfo.mRenderLevel = 0;
- mVisInfo.mRenderStride = mSurfacep->getGridsPerPatchEdge();
-
}
void LLSurfacePatch::connectNeighbor(LLSurfacePatch *neighbor_patchp, const U32 direction)
{
- llassert(neighbor_patchp);
- mNormalsInvalid[direction] = TRUE;
- neighbor_patchp->mNormalsInvalid[gDirOpposite[direction]] = TRUE;
-
- setNeighborPatch(direction, neighbor_patchp);
- neighbor_patchp->setNeighborPatch(gDirOpposite[direction], this);
-
- if (EAST == direction)
- {
- mConnectedEdge |= EAST_EDGE;
- neighbor_patchp->mConnectedEdge |= WEST_EDGE;
- }
- else if (NORTH == direction)
- {
- mConnectedEdge |= NORTH_EDGE;
- neighbor_patchp->mConnectedEdge |= SOUTH_EDGE;
- }
- else if (WEST == direction)
- {
- mConnectedEdge |= WEST_EDGE;
- neighbor_patchp->mConnectedEdge |= EAST_EDGE;
- }
- else if (SOUTH == direction)
- {
- mConnectedEdge |= SOUTH_EDGE;
- neighbor_patchp->mConnectedEdge |= NORTH_EDGE;
- }
+ llassert(neighbor_patchp);
+ mNormalsInvalid[direction] = TRUE;
+ neighbor_patchp->mNormalsInvalid[gDirOpposite[direction]] = TRUE;
+
+ setNeighborPatch(direction, neighbor_patchp);
+ neighbor_patchp->setNeighborPatch(gDirOpposite[direction], this);
+
+ if (EAST == direction)
+ {
+ mConnectedEdge |= EAST_EDGE;
+ neighbor_patchp->mConnectedEdge |= WEST_EDGE;
+ }
+ else if (NORTH == direction)
+ {
+ mConnectedEdge |= NORTH_EDGE;
+ neighbor_patchp->mConnectedEdge |= SOUTH_EDGE;
+ }
+ else if (WEST == direction)
+ {
+ mConnectedEdge |= WEST_EDGE;
+ neighbor_patchp->mConnectedEdge |= EAST_EDGE;
+ }
+ else if (SOUTH == direction)
+ {
+ mConnectedEdge |= SOUTH_EDGE;
+ neighbor_patchp->mConnectedEdge |= NORTH_EDGE;
+ }
}
void LLSurfacePatch::updateVisibility()
{
- if (mVObjp.isNull())
- {
- return;
- }
-
- const F32 DEFAULT_DELTA_ANGLE = (0.15f);
- U32 old_render_stride, max_render_stride;
- U32 new_render_level;
- F32 stride_per_distance = DEFAULT_DELTA_ANGLE / mSurfacep->getMetersPerGrid();
- U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
-
- LLVector4a center;
- center.load3( (mCenterRegion + mSurfacep->getOriginAgent()).mV);
- LLVector4a radius;
- radius.splat(mRadius);
-
- // sphere in frustum on global coordinates
- if (LLViewerCamera::getInstance()->AABBInFrustumNoFarClip(center, radius))
- {
- // We now need to calculate the render stride based on patchp's distance
- // from LLCamera render_stride is governed by a relation something like this...
- //
- // delta_angle * patch.distance
- // render_stride <= ----------------------------------------
- // mMetersPerGrid
- //
- // where 'delta_angle' is the desired solid angle of the average polgon on a patch.
- //
- // Any render_stride smaller than the RHS would be 'satisfactory'. Smaller
- // strides give more resolution, but efficiency suggests that we use the largest
- // of the render_strides that obey the relation. Flexibility is achieved by
- // modulating 'delta_angle' until we have an acceptable number of triangles.
-
- old_render_stride = mVisInfo.mRenderStride;
-
- // Calculate the render_stride using information in agent
- max_render_stride = lltrunc(mVisInfo.mDistance * stride_per_distance);
- max_render_stride = llmin(max_render_stride , 2*grids_per_patch_edge);
-
- // We only use render_strides that are powers of two, so we use look-up tables to figure out
- // the render_level and corresponding render_stride
- new_render_level = mVisInfo.mRenderLevel = mSurfacep->getRenderLevel(max_render_stride);
- mVisInfo.mRenderStride = mSurfacep->getRenderStride(new_render_level);
-
- if ((mVisInfo.mRenderStride != old_render_stride))
- // The reason we check !mbIsVisible is because non-visible patches normals
- // are not updated when their data is changed. When this changes we can get
- // rid of mbIsVisible altogether.
- {
- if (mVObjp)
- {
- mVObjp->dirtyGeom();
- if (getNeighborPatch(WEST))
- {
- getNeighborPatch(WEST)->mVObjp->dirtyGeom();
- }
- if (getNeighborPatch(SOUTH))
- {
- getNeighborPatch(SOUTH)->mVObjp->dirtyGeom();
- }
- }
- }
- mVisInfo.mbIsVisible = TRUE;
- }
- else
- {
- mVisInfo.mbIsVisible = FALSE;
- }
+ if (mVObjp.isNull())
+ {
+ return;
+ }
+
+ const F32 DEFAULT_DELTA_ANGLE = (0.15f);
+ U32 old_render_stride, max_render_stride;
+ U32 new_render_level;
+ F32 stride_per_distance = DEFAULT_DELTA_ANGLE / mSurfacep->getMetersPerGrid();
+ U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
+
+ LLVector4a center;
+ center.load3( (mCenterRegion + mSurfacep->getOriginAgent()).mV);
+ LLVector4a radius;
+ radius.splat(mRadius);
+
+ // sphere in frustum on global coordinates
+ if (LLViewerCamera::getInstance()->AABBInFrustumNoFarClip(center, radius))
+ {
+ // We now need to calculate the render stride based on patchp's distance
+ // from LLCamera render_stride is governed by a relation something like this...
+ //
+ // delta_angle * patch.distance
+ // render_stride <= ----------------------------------------
+ // mMetersPerGrid
+ //
+ // where 'delta_angle' is the desired solid angle of the average polgon on a patch.
+ //
+ // Any render_stride smaller than the RHS would be 'satisfactory'. Smaller
+ // strides give more resolution, but efficiency suggests that we use the largest
+ // of the render_strides that obey the relation. Flexibility is achieved by
+ // modulating 'delta_angle' until we have an acceptable number of triangles.
+
+ old_render_stride = mVisInfo.mRenderStride;
+
+ // Calculate the render_stride using information in agent
+ max_render_stride = lltrunc(mVisInfo.mDistance * stride_per_distance);
+ max_render_stride = llmin(max_render_stride , 2*grids_per_patch_edge);
+
+ // We only use render_strides that are powers of two, so we use look-up tables to figure out
+ // the render_level and corresponding render_stride
+ new_render_level = mVisInfo.mRenderLevel = mSurfacep->getRenderLevel(max_render_stride);
+ mVisInfo.mRenderStride = mSurfacep->getRenderStride(new_render_level);
+
+ if ((mVisInfo.mRenderStride != old_render_stride))
+ // The reason we check !mbIsVisible is because non-visible patches normals
+ // are not updated when their data is changed. When this changes we can get
+ // rid of mbIsVisible altogether.
+ {
+ if (mVObjp)
+ {
+ mVObjp->dirtyGeom();
+ if (getNeighborPatch(WEST))
+ {
+ getNeighborPatch(WEST)->mVObjp->dirtyGeom();
+ }
+ if (getNeighborPatch(SOUTH))
+ {
+ getNeighborPatch(SOUTH)->mVObjp->dirtyGeom();
+ }
+ }
+ }
+ mVisInfo.mbIsVisible = TRUE;
+ }
+ else
+ {
+ mVisInfo.mbIsVisible = FALSE;
+ }
}
const LLVector3d &LLSurfacePatch::getOriginGlobal() const
{
- return mOriginGlobal;
+ return mOriginGlobal;
}
LLVector3 LLSurfacePatch::getOriginAgent() const
{
- return gAgent.getPosAgentFromGlobal(mOriginGlobal);
+ return gAgent.getPosAgentFromGlobal(mOriginGlobal);
}
BOOL LLSurfacePatch::getVisible() const
{
- return mVisInfo.mbIsVisible;
+ return mVisInfo.mbIsVisible;
}
U32 LLSurfacePatch::getRenderStride() const
{
- return mVisInfo.mRenderStride;
+ return mVisInfo.mRenderStride;
}
S32 LLSurfacePatch::getRenderLevel() const
{
- return mVisInfo.mRenderLevel;
+ return mVisInfo.mRenderLevel;
}
void LLSurfacePatch::setHasReceivedData()
{
- mHasReceivedData = TRUE;
+ mHasReceivedData = TRUE;
}
BOOL LLSurfacePatch::getHasReceivedData() const
{
- return mHasReceivedData;
+ return mHasReceivedData;
}
const LLVector3 &LLSurfacePatch::getCenterRegion() const
{
- return mCenterRegion;
+ return mCenterRegion;
}
void LLSurfacePatch::updateCompositionStats()
{
- LLViewerLayer *vlp = mSurfacep->getRegion()->getComposition();
-
- F32 x, y, width, height, mpg, min, mean, max;
-
- LLVector3 origin = getOriginAgent() - mSurfacep->getOriginAgent();
- mpg = mSurfacep->getMetersPerGrid();
- x = origin.mV[VX];
- y = origin.mV[VY];
- width = mpg*(mSurfacep->getGridsPerPatchEdge()+1);
- height = mpg*(mSurfacep->getGridsPerPatchEdge()+1);
-
- mean = 0.f;
- min = vlp->getValueScaled(x, y);
- max= min;
- U32 count = 0;
- F32 i, j;
- for (j = 0; j < height; j += mpg)
- {
- for (i = 0; i < width; i += mpg)
- {
- F32 comp = vlp->getValueScaled(x + i, y + j);
- mean += comp;
- min = llmin(min, comp);
- max = llmax(max, comp);
- count++;
- }
- }
- mean /= count;
-
- mMinComposition = min;
- mMeanComposition = mean;
- mMaxComposition = max;
+ LLViewerLayer *vlp = mSurfacep->getRegion()->getComposition();
+
+ F32 x, y, width, height, mpg, min, mean, max;
+
+ LLVector3 origin = getOriginAgent() - mSurfacep->getOriginAgent();
+ mpg = mSurfacep->getMetersPerGrid();
+ x = origin.mV[VX];
+ y = origin.mV[VY];
+ width = mpg*(mSurfacep->getGridsPerPatchEdge()+1);
+ height = mpg*(mSurfacep->getGridsPerPatchEdge()+1);
+
+ mean = 0.f;
+ min = vlp->getValueScaled(x, y);
+ max= min;
+ U32 count = 0;
+ F32 i, j;
+ for (j = 0; j < height; j += mpg)
+ {
+ for (i = 0; i < width; i += mpg)
+ {
+ F32 comp = vlp->getValueScaled(x + i, y + j);
+ mean += comp;
+ min = llmin(min, comp);
+ max = llmax(max, comp);
+ count++;
+ }
+ }
+ mean /= count;
+
+ mMinComposition = min;
+ mMeanComposition = mean;
+ mMaxComposition = max;
}
F32 LLSurfacePatch::getMeanComposition() const
{
- return mMeanComposition;
+ return mMeanComposition;
}
F32 LLSurfacePatch::getMinComposition() const
{
- return mMinComposition;
+ return mMinComposition;
}
F32 LLSurfacePatch::getMaxComposition() const
{
- return mMaxComposition;
+ return mMaxComposition;
}
void LLSurfacePatch::setNeighborPatch(const U32 direction, LLSurfacePatch *neighborp)
{
- mNeighborPatches[direction] = neighborp;
- mNormalsInvalid[direction] = TRUE;
- if (direction < 4)
- {
- mNormalsInvalid[gDirAdjacent[direction][0]] = TRUE;
- mNormalsInvalid[gDirAdjacent[direction][1]] = TRUE;
- }
+ mNeighborPatches[direction] = neighborp;
+ mNormalsInvalid[direction] = TRUE;
+ if (direction < 4)
+ {
+ mNormalsInvalid[gDirAdjacent[direction][0]] = TRUE;
+ mNormalsInvalid[gDirAdjacent[direction][1]] = TRUE;
+ }
}
LLSurfacePatch *LLSurfacePatch::getNeighborPatch(const U32 direction) const
{
- return mNeighborPatches[direction];
+ return mNeighborPatches[direction];
}
void LLSurfacePatch::clearVObj()
{
- mVObjp = NULL;
+ mVObjp = NULL;
}
diff --git a/indra/newview/llsurfacepatch.h b/indra/newview/llsurfacepatch.h
index 8c8f501dce..43843aba0b 100644
--- a/indra/newview/llsurfacepatch.h
+++ b/indra/newview/llsurfacepatch.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsurfacepatch.h
* @brief LLSurfacePatch class definition
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,148 +37,148 @@ class LLVector2;
class LLColor4U;
class LLAgent;
-// A patch shouldn't know about its visibility since that really depends on the
+// A patch shouldn't know about its visibility since that really depends on the
// camera that is looking (or not looking) at it. So, anything about a patch
// that is specific to a camera should be in the class below.
class LLPatchVisibilityInfo
{
public:
- LLPatchVisibilityInfo() :
- mbIsVisible(FALSE),
- mDistance(0.f),
- mRenderLevel(0),
- mRenderStride(0) { };
- ~LLPatchVisibilityInfo() { };
-
- BOOL mbIsVisible;
- F32 mDistance; // Distance from camera
- S32 mRenderLevel;
- U32 mRenderStride;
+ LLPatchVisibilityInfo() :
+ mbIsVisible(FALSE),
+ mDistance(0.f),
+ mRenderLevel(0),
+ mRenderStride(0) { };
+ ~LLPatchVisibilityInfo() { };
+
+ BOOL mbIsVisible;
+ F32 mDistance; // Distance from camera
+ S32 mRenderLevel;
+ U32 mRenderStride;
};
-class LLSurfacePatch
+class LLSurfacePatch
{
public:
- LLSurfacePatch();
- ~LLSurfacePatch();
-
- void reset(const U32 id);
- void connectNeighbor(LLSurfacePatch *neighborp, const U32 direction);
- void disconnectNeighbor(LLSurface *surfacep);
-
- void setNeighborPatch(const U32 direction, LLSurfacePatch *neighborp);
- LLSurfacePatch *getNeighborPatch(const U32 direction) const;
-
- void colorPatch(const U8 r, const U8 g, const U8 b);
-
- BOOL updateTexture();
-
- void updateVerticalStats();
- void updateCompositionStats();
- void updateNormals();
-
- void updateEastEdge();
- void updateNorthEdge();
-
- void updateCameraDistanceRegion( const LLVector3 &pos_region);
- void updateVisibility();
- void updateGL();
-
- void dirtyZ(); // Dirty the z values of this patch
- void setHasReceivedData();
- BOOL getHasReceivedData() const;
-
- F32 getDistance() const;
- F32 getMaxZ() const;
- F32 getMinZ() const;
- F32 getMeanComposition() const;
- F32 getMinComposition() const;
- F32 getMaxComposition() const;
- const LLVector3 &getCenterRegion() const;
- const U64 &getLastUpdateTime() const;
- LLSurface *getSurface() const { return mSurfacep; }
- LLVector3 getPointAgent(const U32 x, const U32 y) const; // get the point at the offset.
- LLVector2 getTexCoords(const U32 x, const U32 y) const;
-
- void calcNormal(const U32 x, const U32 y, const U32 stride);
- const LLVector3 &getNormal(const U32 x, const U32 y) const;
-
- void eval(const U32 x, const U32 y, const U32 stride,
- LLVector3 *vertex, LLVector3 *normal, LLVector2 *tex0, LLVector2 *tex1);
-
-
-
- LLVector3 getOriginAgent() const;
- const LLVector3d &getOriginGlobal() const;
- void setOriginGlobal(const LLVector3d &origin_global);
-
- // connectivity -- each LLPatch points at 5 neighbors (or NULL)
- // +---+---+---+
- // | | 2 | 5 |
- // +---+---+---+
- // | 3 | 0 | 1 |
- // +---+---+---+
- // | 6 | 4 | |
- // +---+---+---+
-
-
- BOOL getVisible() const;
- U32 getRenderStride() const;
- S32 getRenderLevel() const;
-
- void setSurface(LLSurface *surfacep);
- void setDataZ(F32 *data_z) { mDataZ = data_z; }
- void setDataNorm(LLVector3 *data_norm) { mDataNorm = data_norm; }
- F32 *getDataZ() const { return mDataZ; }
-
- void dirty(); // Mark this surface patch as dirty...
- void clearDirty() { mDirty = FALSE; }
-
- void clearVObj();
+ LLSurfacePatch();
+ ~LLSurfacePatch();
+
+ void reset(const U32 id);
+ void connectNeighbor(LLSurfacePatch *neighborp, const U32 direction);
+ void disconnectNeighbor(LLSurface *surfacep);
+
+ void setNeighborPatch(const U32 direction, LLSurfacePatch *neighborp);
+ LLSurfacePatch *getNeighborPatch(const U32 direction) const;
+
+ void colorPatch(const U8 r, const U8 g, const U8 b);
+
+ BOOL updateTexture();
+
+ void updateVerticalStats();
+ void updateCompositionStats();
+ void updateNormals();
+
+ void updateEastEdge();
+ void updateNorthEdge();
+
+ void updateCameraDistanceRegion( const LLVector3 &pos_region);
+ void updateVisibility();
+ void updateGL();
+
+ void dirtyZ(); // Dirty the z values of this patch
+ void setHasReceivedData();
+ BOOL getHasReceivedData() const;
+
+ F32 getDistance() const;
+ F32 getMaxZ() const;
+ F32 getMinZ() const;
+ F32 getMeanComposition() const;
+ F32 getMinComposition() const;
+ F32 getMaxComposition() const;
+ const LLVector3 &getCenterRegion() const;
+ const U64 &getLastUpdateTime() const;
+ LLSurface *getSurface() const { return mSurfacep; }
+ LLVector3 getPointAgent(const U32 x, const U32 y) const; // get the point at the offset.
+ LLVector2 getTexCoords(const U32 x, const U32 y) const;
+
+ void calcNormal(const U32 x, const U32 y, const U32 stride);
+ const LLVector3 &getNormal(const U32 x, const U32 y) const;
+
+ void eval(const U32 x, const U32 y, const U32 stride,
+ LLVector3 *vertex, LLVector3 *normal, LLVector2 *tex0, LLVector2 *tex1);
+
+
+
+ LLVector3 getOriginAgent() const;
+ const LLVector3d &getOriginGlobal() const;
+ void setOriginGlobal(const LLVector3d &origin_global);
+
+ // connectivity -- each LLPatch points at 5 neighbors (or NULL)
+ // +---+---+---+
+ // | | 2 | 5 |
+ // +---+---+---+
+ // | 3 | 0 | 1 |
+ // +---+---+---+
+ // | 6 | 4 | |
+ // +---+---+---+
+
+
+ BOOL getVisible() const;
+ U32 getRenderStride() const;
+ S32 getRenderLevel() const;
+
+ void setSurface(LLSurface *surfacep);
+ void setDataZ(F32 *data_z) { mDataZ = data_z; }
+ void setDataNorm(LLVector3 *data_norm) { mDataNorm = data_norm; }
+ F32 *getDataZ() const { return mDataZ; }
+
+ void dirty(); // Mark this surface patch as dirty...
+ void clearDirty() { mDirty = FALSE; }
+
+ void clearVObj();
public:
- BOOL mHasReceivedData; // has the patch EVER received height data?
- BOOL mSTexUpdate; // Does the surface texture need to be updated?
+ BOOL mHasReceivedData; // has the patch EVER received height data?
+ BOOL mSTexUpdate; // Does the surface texture need to be updated?
protected:
- LLSurfacePatch *mNeighborPatches[8]; // Adjacent patches
- BOOL mNormalsInvalid[9]; // Which normals are invalid
+ LLSurfacePatch *mNeighborPatches[8]; // Adjacent patches
+ BOOL mNormalsInvalid[9]; // Which normals are invalid
- BOOL mDirty;
- BOOL mDirtyZStats;
- BOOL mHeightsGenerated;
+ BOOL mDirty;
+ BOOL mDirtyZStats;
+ BOOL mHeightsGenerated;
- U32 mDataOffset;
- F32 *mDataZ;
- LLVector3 *mDataNorm;
+ U32 mDataOffset;
+ F32 *mDataZ;
+ LLVector3 *mDataNorm;
- // Pointer to the LLVOSurfacePatch object which is used in the new renderer.
- LLPointer<LLVOSurfacePatch> mVObjp;
+ // Pointer to the LLVOSurfacePatch object which is used in the new renderer.
+ LLPointer<LLVOSurfacePatch> mVObjp;
- // All of the camera-dependent stuff should be in its own class...
- LLPatchVisibilityInfo mVisInfo;
+ // All of the camera-dependent stuff should be in its own class...
+ LLPatchVisibilityInfo mVisInfo;
- // pointers to beginnings of patch data fields
- LLVector3d mOriginGlobal;
- LLVector3 mOriginRegion;
+ // pointers to beginnings of patch data fields
+ LLVector3d mOriginGlobal;
+ LLVector3 mOriginRegion;
- // height field stats
- LLVector3 mCenterRegion; // Center in region-local coords
- F32 mMinZ, mMaxZ, mMeanZ;
- F32 mRadius;
+ // height field stats
+ LLVector3 mCenterRegion; // Center in region-local coords
+ F32 mMinZ, mMaxZ, mMeanZ;
+ F32 mRadius;
- F32 mMinComposition;
- F32 mMaxComposition;
- F32 mMeanComposition;
+ F32 mMinComposition;
+ F32 mMaxComposition;
+ F32 mMeanComposition;
- U8 mConnectedEdge; // This flag is non-zero iff patch is on at least one edge
- // of LLSurface that is "connected" to another LLSurface
- U64 mLastUpdateTime; // Time patch was last updated
+ U8 mConnectedEdge; // This flag is non-zero iff patch is on at least one edge
+ // of LLSurface that is "connected" to another LLSurface
+ U64 mLastUpdateTime; // Time patch was last updated
- LLSurface *mSurfacep; // Pointer to "parent" surface
+ LLSurface *mSurfacep; // Pointer to "parent" surface
};
diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp
index 10a9dee415..5114ee3672 100644
--- a/indra/newview/llsyntaxid.cpp
+++ b/indra/newview/llsyntaxid.cpp
@@ -1,7 +1,7 @@
/**
* @file LLSyntaxId
* @brief Handles downloading, saving, and checking of LSL keyword/syntax files
- * for each region.
+ * for each region.
* @author Ima Mechanique, Cinder Roxley
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
@@ -46,22 +46,22 @@ const std::string FILENAME_DEFAULT = "keywords_lsl_default.xml";
* @brief LLSyntaxIdLSL constructor
*/
LLSyntaxIdLSL::LLSyntaxIdLSL()
-: mKeywordsXml(LLSD())
-, mCapabilityURL(std::string())
-, mFilePath(LL_PATH_APP_SETTINGS)
-, mSyntaxId(LLUUID())
-, mInitialized(false)
+: mKeywordsXml(LLSD())
+, mCapabilityURL(std::string())
+, mFilePath(LL_PATH_APP_SETTINGS)
+, mSyntaxId(LLUUID())
+, mInitialized(false)
{
- loadDefaultKeywordsIntoLLSD();
- mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLSyntaxIdLSL::handleRegionChanged, this));
- handleRegionChanged(); // Kick off an initial caps query and fetch
+ loadDefaultKeywordsIntoLLSD();
+ mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLSyntaxIdLSL::handleRegionChanged, this));
+ handleRegionChanged(); // Kick off an initial caps query and fetch
}
void LLSyntaxIdLSL::buildFullFileSpec()
{
- ELLPath path = mSyntaxId.isNull() ? LL_PATH_APP_SETTINGS : LL_PATH_CACHE;
- const std::string filename = mSyntaxId.isNull() ? FILENAME_DEFAULT : "keywords_lsl_" + mSyntaxId.asString() + ".llsd.xml";
- mFullFileSpec = gDirUtilp->getExpandedFilename(path, filename);
+ ELLPath path = mSyntaxId.isNull() ? LL_PATH_APP_SETTINGS : LL_PATH_CACHE;
+ const std::string filename = mSyntaxId.isNull() ? FILENAME_DEFAULT : "keywords_lsl_" + mSyntaxId.asString() + ".llsd.xml";
+ mFullFileSpec = gDirUtilp->getExpandedFilename(path, filename);
}
//-----------------------------------------------------------------------------
@@ -69,38 +69,38 @@ void LLSyntaxIdLSL::buildFullFileSpec()
//-----------------------------------------------------------------------------
bool LLSyntaxIdLSL::syntaxIdChanged()
{
- LLViewerRegion* region = gAgent.getRegion();
-
- if (region)
- {
- if (region->capabilitiesReceived())
- {
- LLSD sim_features;
- region->getSimulatorFeatures(sim_features);
-
- if (sim_features.has(SYNTAX_ID_SIMULATOR_FEATURE))
- {
- // get and check the hash
- LLUUID new_syntax_id = sim_features[SYNTAX_ID_SIMULATOR_FEATURE].asUUID();
- mCapabilityURL = region->getCapability(SYNTAX_ID_CAPABILITY_NAME);
- LL_DEBUGS("SyntaxLSL") << SYNTAX_ID_SIMULATOR_FEATURE << " capability URL: " << mCapabilityURL << LL_ENDL;
- if (new_syntax_id != mSyntaxId)
- {
- LL_DEBUGS("SyntaxLSL") << "New SyntaxID '" << new_syntax_id << "' found." << LL_ENDL;
- mSyntaxId = new_syntax_id;
- return true;
- }
- else
- LL_DEBUGS("SyntaxLSL") << "SyntaxID matches what we have." << LL_ENDL;
- }
- }
- else
- {
- region->setCapabilitiesReceivedCallback(boost::bind(&LLSyntaxIdLSL::handleCapsReceived, this, _1));
- LL_DEBUGS("SyntaxLSL") << "Region has not received capabilities. Waiting for caps..." << LL_ENDL;
- }
- }
- return false;
+ LLViewerRegion* region = gAgent.getRegion();
+
+ if (region)
+ {
+ if (region->capabilitiesReceived())
+ {
+ LLSD sim_features;
+ region->getSimulatorFeatures(sim_features);
+
+ if (sim_features.has(SYNTAX_ID_SIMULATOR_FEATURE))
+ {
+ // get and check the hash
+ LLUUID new_syntax_id = sim_features[SYNTAX_ID_SIMULATOR_FEATURE].asUUID();
+ mCapabilityURL = region->getCapability(SYNTAX_ID_CAPABILITY_NAME);
+ LL_DEBUGS("SyntaxLSL") << SYNTAX_ID_SIMULATOR_FEATURE << " capability URL: " << mCapabilityURL << LL_ENDL;
+ if (new_syntax_id != mSyntaxId)
+ {
+ LL_DEBUGS("SyntaxLSL") << "New SyntaxID '" << new_syntax_id << "' found." << LL_ENDL;
+ mSyntaxId = new_syntax_id;
+ return true;
+ }
+ else
+ LL_DEBUGS("SyntaxLSL") << "SyntaxID matches what we have." << LL_ENDL;
+ }
+ }
+ else
+ {
+ region->setCapabilitiesReceivedCallback(boost::bind(&LLSyntaxIdLSL::handleCapsReceived, this, _1));
+ LL_DEBUGS("SyntaxLSL") << "Region has not received capabilities. Waiting for caps..." << LL_ENDL;
+ }
+ }
+ return false;
}
//-----------------------------------------------------------------------------
@@ -110,7 +110,7 @@ void LLSyntaxIdLSL::fetchKeywordsFile(const std::string& filespec)
{
LLCoros::instance().launch("LLSyntaxIdLSL::fetchKeywordsFileCoro",
boost::bind(&LLSyntaxIdLSL::fetchKeywordsFileCoro, this, mCapabilityURL, filespec));
- LL_DEBUGS("SyntaxLSL") << "LSLSyntaxId capability URL is: " << mCapabilityURL << ". Filename to use is: '" << filespec << "'." << LL_ENDL;
+ LL_DEBUGS("SyntaxLSL") << "LSLSyntaxId capability URL is: " << mCapabilityURL << ". Filename to use is: '" << filespec << "'." << LL_ENDL;
}
//-----------------------------------------------------------------------------
@@ -180,42 +180,42 @@ void LLSyntaxIdLSL::cacheFile(const std::string &fileSpec, const LLSD& content_r
//-----------------------------------------------------------------------------
void LLSyntaxIdLSL::initialize()
{
- if(mInitialized) return;
- if (mSyntaxId.isNull())
- {
- loadDefaultKeywordsIntoLLSD();
- }
- else if (!mCapabilityURL.empty())
- {
- LL_DEBUGS("SyntaxLSL") << "LSL version has changed, getting appropriate file." << LL_ENDL;
-
- // Need a full spec regardless of file source, so build it now.
- buildFullFileSpec();
- if (mSyntaxId.notNull())
- {
- if (!gDirUtilp->fileExists(mFullFileSpec))
- { // Does not exist, so fetch it from the capability
- LL_DEBUGS("SyntaxLSL") << "LSL syntax not cached, attempting download." << LL_ENDL;
- fetchKeywordsFile(mFullFileSpec);
- }
- else
- {
- LL_DEBUGS("SyntaxLSL") << "Found cached Syntax file: " << mFullFileSpec << " Loading keywords." << LL_ENDL;
- loadKeywordsIntoLLSD();
- }
- }
- else
- {
- LL_DEBUGS("SyntaxLSL") << "LSLSyntaxId is null. Loading default values" << LL_ENDL;
- loadDefaultKeywordsIntoLLSD();
- }
- }
- else
- {
- LL_DEBUGS("SyntaxLSL") << "LSLSyntaxId capability URL is empty." << LL_ENDL;
- loadDefaultKeywordsIntoLLSD();
- }
- mInitialized = true;
+ if(mInitialized) return;
+ if (mSyntaxId.isNull())
+ {
+ loadDefaultKeywordsIntoLLSD();
+ }
+ else if (!mCapabilityURL.empty())
+ {
+ LL_DEBUGS("SyntaxLSL") << "LSL version has changed, getting appropriate file." << LL_ENDL;
+
+ // Need a full spec regardless of file source, so build it now.
+ buildFullFileSpec();
+ if (mSyntaxId.notNull())
+ {
+ if (!gDirUtilp->fileExists(mFullFileSpec))
+ { // Does not exist, so fetch it from the capability
+ LL_DEBUGS("SyntaxLSL") << "LSL syntax not cached, attempting download." << LL_ENDL;
+ fetchKeywordsFile(mFullFileSpec);
+ }
+ else
+ {
+ LL_DEBUGS("SyntaxLSL") << "Found cached Syntax file: " << mFullFileSpec << " Loading keywords." << LL_ENDL;
+ loadKeywordsIntoLLSD();
+ }
+ }
+ else
+ {
+ LL_DEBUGS("SyntaxLSL") << "LSLSyntaxId is null. Loading default values" << LL_ENDL;
+ loadDefaultKeywordsIntoLLSD();
+ }
+ }
+ else
+ {
+ LL_DEBUGS("SyntaxLSL") << "LSLSyntaxId capability URL is empty." << LL_ENDL;
+ loadDefaultKeywordsIntoLLSD();
+ }
+ mInitialized = true;
}
//-----------------------------------------------------------------------------
@@ -226,27 +226,27 @@ const std::string LLSD_SYNTAX_LSL_VERSION_KEY("llsd-lsl-syntax-version");
bool LLSyntaxIdLSL::isSupportedVersion(const LLSD& content)
{
- bool is_valid = false;
- /*
- * If the schema used to store LSL keywords and hints changes, this value is incremented
- * Note that it should _not_ be changed if the keywords and hints _content_ changes.
- */
-
- if (content.has(LLSD_SYNTAX_LSL_VERSION_KEY))
- {
- LL_DEBUGS("SyntaxLSL") << "LSL syntax version: " << content[LLSD_SYNTAX_LSL_VERSION_KEY].asString() << LL_ENDL;
-
- if (content[LLSD_SYNTAX_LSL_VERSION_KEY].asInteger() == LLSD_SYNTAX_LSL_VERSION_EXPECTED)
- {
- is_valid = true;
- }
- }
- else
- {
- LL_DEBUGS("SyntaxLSL") << "Missing LSL syntax version key." << LL_ENDL;
- }
-
- return is_valid;
+ bool is_valid = false;
+ /*
+ * If the schema used to store LSL keywords and hints changes, this value is incremented
+ * Note that it should _not_ be changed if the keywords and hints _content_ changes.
+ */
+
+ if (content.has(LLSD_SYNTAX_LSL_VERSION_KEY))
+ {
+ LL_DEBUGS("SyntaxLSL") << "LSL syntax version: " << content[LLSD_SYNTAX_LSL_VERSION_KEY].asString() << LL_ENDL;
+
+ if (content[LLSD_SYNTAX_LSL_VERSION_KEY].asInteger() == LLSD_SYNTAX_LSL_VERSION_EXPECTED)
+ {
+ is_valid = true;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("SyntaxLSL") << "Missing LSL syntax version key." << LL_ENDL;
+ }
+
+ return is_valid;
}
//-----------------------------------------------------------------------------
@@ -254,74 +254,74 @@ bool LLSyntaxIdLSL::isSupportedVersion(const LLSD& content)
//-----------------------------------------------------------------------------
void LLSyntaxIdLSL::loadDefaultKeywordsIntoLLSD()
{
- mSyntaxId.setNull();
- buildFullFileSpec();
- loadKeywordsIntoLLSD();
+ mSyntaxId.setNull();
+ buildFullFileSpec();
+ loadKeywordsIntoLLSD();
}
//-----------------------------------------------------------------------------
// loadKeywordsFileIntoLLSD
//-----------------------------------------------------------------------------
/**
- * @brief Load xml serialized LLSD
- * @desc Opens the specified filespec and attempts to deserializes the
- * contained data to the specified LLSD object. indicate success/failure with
- * sLoaded/sLoadFailed members.
+ * @brief Load xml serialized LLSD
+ * @desc Opens the specified filespec and attempts to deserializes the
+ * contained data to the specified LLSD object. indicate success/failure with
+ * sLoaded/sLoadFailed members.
*/
void LLSyntaxIdLSL::loadKeywordsIntoLLSD()
{
- LLSD content;
- llifstream file;
- file.open(mFullFileSpec.c_str());
- if (file.is_open())
- {
- if (LLSDSerialize::fromXML(content, file) != LLSDParser::PARSE_FAILURE)
- {
- if (isSupportedVersion(content))
- {
- LL_DEBUGS("SyntaxLSL") << "Deserialized: " << mFullFileSpec << LL_ENDL;
- }
- else
- {
- LL_WARNS("SyntaxLSL") << "Unknown or unsupported version of syntax file." << LL_ENDL;
- }
- }
- }
- else
- {
- LL_WARNS("SyntaxLSL") << "Failed to open: " << mFullFileSpec << LL_ENDL;
- }
- mKeywordsXml = content;
- mSyntaxIDChangedSignal();
+ LLSD content;
+ llifstream file;
+ file.open(mFullFileSpec.c_str());
+ if (file.is_open())
+ {
+ if (LLSDSerialize::fromXML(content, file) != LLSDParser::PARSE_FAILURE)
+ {
+ if (isSupportedVersion(content))
+ {
+ LL_DEBUGS("SyntaxLSL") << "Deserialized: " << mFullFileSpec << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("SyntaxLSL") << "Unknown or unsupported version of syntax file." << LL_ENDL;
+ }
+ }
+ }
+ else
+ {
+ LL_WARNS("SyntaxLSL") << "Failed to open: " << mFullFileSpec << LL_ENDL;
+ }
+ mKeywordsXml = content;
+ mSyntaxIDChangedSignal();
}
bool LLSyntaxIdLSL::keywordFetchInProgress()
{
- return !mInflightFetches.empty();
+ return !mInflightFetches.empty();
}
void LLSyntaxIdLSL::handleRegionChanged()
{
- if (syntaxIdChanged())
- {
- buildFullFileSpec();
- fetchKeywordsFile(mFullFileSpec);
- mInitialized = false;
- }
+ if (syntaxIdChanged())
+ {
+ buildFullFileSpec();
+ fetchKeywordsFile(mFullFileSpec);
+ mInitialized = false;
+ }
}
void LLSyntaxIdLSL::handleCapsReceived(const LLUUID& region_uuid)
{
- LLViewerRegion* current_region = gAgent.getRegion();
-
- if (region_uuid.notNull()
- && current_region->getRegionID() == region_uuid)
- {
- syntaxIdChanged();
- }
+ LLViewerRegion* current_region = gAgent.getRegion();
+
+ if (region_uuid.notNull()
+ && current_region->getRegionID() == region_uuid)
+ {
+ syntaxIdChanged();
+ }
}
boost::signals2::connection LLSyntaxIdLSL::addSyntaxIDCallback(const syntax_id_changed_signal_t::slot_type& cb)
{
- return mSyntaxIDChangedSignal.connect(cb);
+ return mSyntaxIDChangedSignal.connect(cb);
}
diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h
index caddba5527..a00e9d6390 100644
--- a/indra/newview/llsyntaxid.h
+++ b/indra/newview/llsyntaxid.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsyntaxid.h
* @brief Contains methods to access the LSLSyntaxId feature and LSLSyntax capability
* to use the appropriate syntax file for the current region's LSL version.
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,40 +38,40 @@ class fetchKeywordsFileResponder;
class LLSyntaxIdLSL : public LLSingleton<LLSyntaxIdLSL>
{
- LLSINGLETON(LLSyntaxIdLSL);
- friend class fetchKeywordsFileResponder;
+ LLSINGLETON(LLSyntaxIdLSL);
+ friend class fetchKeywordsFileResponder;
private:
std::set<std::string> mInflightFetches;
- typedef boost::signals2::signal<void()> syntax_id_changed_signal_t;
- syntax_id_changed_signal_t mSyntaxIDChangedSignal;
- boost::signals2::connection mRegionChangedCallback;
-
- bool syntaxIdChanged();
- bool isSupportedVersion(const LLSD& content);
- void handleRegionChanged();
- void handleCapsReceived(const LLUUID& region_uuid);
- void setKeywordsXml(const LLSD& content) { mKeywordsXml = content; };
- void buildFullFileSpec();
- void fetchKeywordsFile(const std::string& filespec);
- void loadDefaultKeywordsIntoLLSD();
- void loadKeywordsIntoLLSD();
+ typedef boost::signals2::signal<void()> syntax_id_changed_signal_t;
+ syntax_id_changed_signal_t mSyntaxIDChangedSignal;
+ boost::signals2::connection mRegionChangedCallback;
+
+ bool syntaxIdChanged();
+ bool isSupportedVersion(const LLSD& content);
+ void handleRegionChanged();
+ void handleCapsReceived(const LLUUID& region_uuid);
+ void setKeywordsXml(const LLSD& content) { mKeywordsXml = content; };
+ void buildFullFileSpec();
+ void fetchKeywordsFile(const std::string& filespec);
+ void loadDefaultKeywordsIntoLLSD();
+ void loadKeywordsIntoLLSD();
void fetchKeywordsFileCoro(std::string url, std::string fileSpec);
void cacheFile(const std::string &fileSpec, const LLSD& content_ref);
- std::string mCapabilityURL;
- std::string mFullFileSpec;
- ELLPath mFilePath;
- LLUUID mSyntaxId;
- LLSD mKeywordsXml;
- bool mInitialized;
-
+ std::string mCapabilityURL;
+ std::string mFullFileSpec;
+ ELLPath mFilePath;
+ LLUUID mSyntaxId;
+ LLSD mKeywordsXml;
+ bool mInitialized;
+
public:
- void initialize();
- bool keywordFetchInProgress();
- LLSD getKeywordsXML() const { return mKeywordsXml; };
- boost::signals2::connection addSyntaxIDCallback(const syntax_id_changed_signal_t::slot_type& cb);
+ void initialize();
+ bool keywordFetchInProgress();
+ LLSD getKeywordsXML() const { return mKeywordsXml; };
+ boost::signals2::connection addSyntaxIDCallback(const syntax_id_changed_signal_t::slot_type& cb);
};
#endif // LLSYNTAXID_H
diff --git a/indra/newview/llsyswellitem.cpp b/indra/newview/llsyswellitem.cpp
index 2a58f018e7..a79146ecc8 100644
--- a/indra/newview/llsyswellitem.cpp
+++ b/indra/newview/llsyswellitem.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsyswellitem.cpp
* @brief // TODO
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,19 +35,19 @@
//---------------------------------------------------------------------------------
LLSysWellItem::LLSysWellItem(const Params& p) : LLPanel(p),
- mTitle(NULL),
- mCloseBtn(NULL)
+ mTitle(NULL),
+ mCloseBtn(NULL)
{
- buildFromFile( "panel_sys_well_item.xml");
+ buildFromFile( "panel_sys_well_item.xml");
- mTitle = getChild<LLTextBox>("title");
- mCloseBtn = getChild<LLButton>("close_btn");
+ mTitle = getChild<LLTextBox>("title");
+ mCloseBtn = getChild<LLButton>("close_btn");
- mTitle->setContentTrusted(false);
- mTitle->setValue(p.title);
- mCloseBtn->setClickedCallback(boost::bind(&LLSysWellItem::onClickCloseBtn,this));
+ mTitle->setContentTrusted(false);
+ mTitle->setValue(p.title);
+ mCloseBtn->setClickedCallback(boost::bind(&LLSysWellItem::onClickCloseBtn,this));
- mID = p.notification_id;
+ mID = p.notification_id;
}
//---------------------------------------------------------------------------------
@@ -58,35 +58,35 @@ LLSysWellItem::~LLSysWellItem()
//---------------------------------------------------------------------------------
void LLSysWellItem::setTitle( std::string title )
{
- mTitle->setValue(title);
+ mTitle->setValue(title);
}
//---------------------------------------------------------------------------------
void LLSysWellItem::onClickCloseBtn()
{
- mOnItemClose(this);
+ mOnItemClose(this);
}
//---------------------------------------------------------------------------------
BOOL LLSysWellItem::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL res = LLPanel::handleMouseDown(x, y, mask);
- if(!mCloseBtn->getRect().pointInRect(x, y))
- mOnItemClick(this);
+ BOOL res = LLPanel::handleMouseDown(x, y, mask);
+ if(!mCloseBtn->getRect().pointInRect(x, y))
+ mOnItemClick(this);
- return res;
+ return res;
}
//---------------------------------------------------------------------------------
void LLSysWellItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
- setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemSelected" ));
+ setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemSelected" ));
}
//---------------------------------------------------------------------------------
void LLSysWellItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
- setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" ));
+ setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" ));
}
//---------------------------------------------------------------------------------
diff --git a/indra/newview/llsyswellitem.h b/indra/newview/llsyswellitem.h
index d961708a01..005883460a 100644
--- a/indra/newview/llsyswellitem.h
+++ b/indra/newview/llsyswellitem.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsyswellitem.h
* @brief // TODO
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,43 +37,43 @@
class LLSysWellItem : public LLPanel
{
public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {
- LLUUID notification_id;
- std::string title;
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ LLUUID notification_id;
+ std::string title;
Params() {};
- };
+ };
- LLSysWellItem(const Params& p);
- virtual ~LLSysWellItem();
+ LLSysWellItem(const Params& p);
+ virtual ~LLSysWellItem();
- // title
- void setTitle( std::string title );
+ // title
+ void setTitle( std::string title );
- // get item's ID
- LLUUID getID() { return mID; }
+ // get item's ID
+ LLUUID getID() { return mID; }
- // handlers
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual void onMouseEnter(S32 x, S32 y, MASK mask);
- virtual void onMouseLeave(S32 x, S32 y, MASK mask);
+ // handlers
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual void onMouseEnter(S32 x, S32 y, MASK mask);
+ virtual void onMouseLeave(S32 x, S32 y, MASK mask);
- //callbacks
- typedef boost::function<void (LLSysWellItem* item)> syswell_item_callback_t;
- typedef boost::signals2::signal<void (LLSysWellItem* item)> syswell_item_signal_t;
- syswell_item_signal_t mOnItemClose;
- syswell_item_signal_t mOnItemClick;
- boost::signals2::connection setOnItemCloseCallback(syswell_item_callback_t cb) { return mOnItemClose.connect(cb); }
- boost::signals2::connection setOnItemClickCallback(syswell_item_callback_t cb) { return mOnItemClick.connect(cb); }
+ //callbacks
+ typedef boost::function<void (LLSysWellItem* item)> syswell_item_callback_t;
+ typedef boost::signals2::signal<void (LLSysWellItem* item)> syswell_item_signal_t;
+ syswell_item_signal_t mOnItemClose;
+ syswell_item_signal_t mOnItemClick;
+ boost::signals2::connection setOnItemCloseCallback(syswell_item_callback_t cb) { return mOnItemClose.connect(cb); }
+ boost::signals2::connection setOnItemClickCallback(syswell_item_callback_t cb) { return mOnItemClick.connect(cb); }
private:
- void onClickCloseBtn();
+ void onClickCloseBtn();
- LLTextBox* mTitle;
- LLButton* mCloseBtn;
- LLUUID mID;
+ LLTextBox* mTitle;
+ LLButton* mCloseBtn;
+ LLUUID mID;
};
#endif // LL_LLSYSWELLITEM_H
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index 8f64cff47c..a59e33b6ba 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llsyswellwindow.cpp
* @brief // TODO
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,55 +38,55 @@
//---------------------------------------------------------------------------------
LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLTransientDockableFloater(NULL, true, key),
- mChannel(NULL),
- mMessageList(NULL),
- mSysWellChiclet(NULL),
- NOTIFICATION_WELL_ANCHOR_NAME("notification_well_panel"),
- IM_WELL_ANCHOR_NAME("im_well_panel"),
- mIsReshapedByUser(false)
+ mChannel(NULL),
+ mMessageList(NULL),
+ mSysWellChiclet(NULL),
+ NOTIFICATION_WELL_ANCHOR_NAME("notification_well_panel"),
+ IM_WELL_ANCHOR_NAME("im_well_panel"),
+ mIsReshapedByUser(false)
{
- setOverlapsScreenChannel(true);
+ setOverlapsScreenChannel(true);
}
//---------------------------------------------------------------------------------
BOOL LLSysWellWindow::postBuild()
{
- mMessageList = getChild<LLFlatListView>("notification_list");
+ mMessageList = getChild<LLFlatListView>("notification_list");
- // get a corresponding channel
- initChannel();
+ // get a corresponding channel
+ initChannel();
- return LLTransientDockableFloater::postBuild();
+ return LLTransientDockableFloater::postBuild();
}
//---------------------------------------------------------------------------------
void LLSysWellWindow::setMinimized(BOOL minimize)
{
- LLTransientDockableFloater::setMinimized(minimize);
+ LLTransientDockableFloater::setMinimized(minimize);
}
//---------------------------------------------------------------------------------
void LLSysWellWindow::handleReshape(const LLRect& rect, bool by_user)
{
- mIsReshapedByUser |= by_user; // mark floater that it is reshaped by user
- LLTransientDockableFloater::handleReshape(rect, by_user);
+ mIsReshapedByUser |= by_user; // mark floater that it is reshaped by user
+ LLTransientDockableFloater::handleReshape(rect, by_user);
}
//---------------------------------------------------------------------------------
void LLSysWellWindow::onStartUpToastClick(S32 x, S32 y, MASK mask)
{
- // just set floater visible. Screen channels will be cleared.
- setVisible(TRUE);
+ // just set floater visible. Screen channels will be cleared.
+ setVisible(TRUE);
}
-void LLSysWellWindow::setSysWellChiclet(LLSysWellChiclet* chiclet)
-{
- mSysWellChiclet = chiclet;
- if(NULL != mSysWellChiclet)
- {
- mSysWellChiclet->updateWidget(isWindowEmpty());
- }
+void LLSysWellWindow::setSysWellChiclet(LLSysWellChiclet* chiclet)
+{
+ mSysWellChiclet = chiclet;
+ if(NULL != mSysWellChiclet)
+ {
+ mSysWellChiclet->updateWidget(isWindowEmpty());
+ }
}
//---------------------------------------------------------------------------------
@@ -97,25 +97,25 @@ LLSysWellWindow::~LLSysWellWindow()
//---------------------------------------------------------------------------------
void LLSysWellWindow::removeItemByID(const LLUUID& id)
{
- if(mMessageList->removeItemByValue(id))
- {
- if (NULL != mSysWellChiclet)
- {
- mSysWellChiclet->updateWidget(isWindowEmpty());
- }
- reshapeWindow();
- }
- else
- {
- LL_WARNS() << "Unable to remove notification from the list, ID: " << id
- << LL_ENDL;
- }
-
- // hide chiclet window if there are no items left
- if(isWindowEmpty())
- {
- setVisible(FALSE);
- }
+ if(mMessageList->removeItemByValue(id))
+ {
+ if (NULL != mSysWellChiclet)
+ {
+ mSysWellChiclet->updateWidget(isWindowEmpty());
+ }
+ reshapeWindow();
+ }
+ else
+ {
+ LL_WARNS() << "Unable to remove notification from the list, ID: " << id
+ << LL_ENDL;
+ }
+
+ // hide chiclet window if there are no items left
+ if(isWindowEmpty())
+ {
+ setVisible(FALSE);
+ }
}
LLPanel * LLSysWellWindow::findItemByID(const LLUUID& id)
@@ -125,95 +125,95 @@ void LLSysWellWindow::removeItemByID(const LLUUID& id)
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
-void LLSysWellWindow::initChannel()
+void LLSysWellWindow::initChannel()
{
- LLNotificationsUI::LLScreenChannelBase* channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(
- LLUUID(gSavedSettings.getString("NotificationChannelUUID")));
- mChannel = dynamic_cast<LLNotificationsUI::LLScreenChannel*>(channel);
- if(NULL == mChannel)
- {
- LL_WARNS() << "LLSysWellWindow::initChannel() - could not get a requested screen channel" << LL_ENDL;
- }
+ LLNotificationsUI::LLScreenChannelBase* channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(
+ LLUUID(gSavedSettings.getString("NotificationChannelUUID")));
+ mChannel = dynamic_cast<LLNotificationsUI::LLScreenChannel*>(channel);
+ if(NULL == mChannel)
+ {
+ LL_WARNS() << "LLSysWellWindow::initChannel() - could not get a requested screen channel" << LL_ENDL;
+ }
}
//---------------------------------------------------------------------------------
void LLSysWellWindow::setVisible(BOOL visible)
{
- if (visible)
- {
- if (NULL == getDockControl() && getDockTongue().notNull())
- {
- setDockControl(new LLDockControl(
- LLChicletBar::getInstance()->getChild<LLView>(getAnchorViewName()), this,
- getDockTongue(), LLDockControl::BOTTOM));
- }
- }
+ if (visible)
+ {
+ if (NULL == getDockControl() && getDockTongue().notNull())
+ {
+ setDockControl(new LLDockControl(
+ LLChicletBar::getInstance()->getChild<LLView>(getAnchorViewName()), this,
+ getDockTongue(), LLDockControl::BOTTOM));
+ }
+ }
- // do not show empty window
- if (NULL == mMessageList || isWindowEmpty()) visible = FALSE;
+ // do not show empty window
+ if (NULL == mMessageList || isWindowEmpty()) visible = FALSE;
- LLTransientDockableFloater::setVisible(visible);
+ LLTransientDockableFloater::setVisible(visible);
- // update notification channel state
- initChannel(); // make sure the channel still exists
- if(mChannel)
- {
- mChannel->updateShowToastsState();
- mChannel->redrawToasts();
- }
+ // update notification channel state
+ initChannel(); // make sure the channel still exists
+ if(mChannel)
+ {
+ mChannel->updateShowToastsState();
+ mChannel->redrawToasts();
+ }
}
//---------------------------------------------------------------------------------
void LLSysWellWindow::setDocked(bool docked, bool pop_on_undock)
{
- LLTransientDockableFloater::setDocked(docked, pop_on_undock);
+ LLTransientDockableFloater::setDocked(docked, pop_on_undock);
- // update notification channel state
- if(mChannel)
- {
- mChannel->updateShowToastsState();
- mChannel->redrawToasts();
- }
+ // update notification channel state
+ if(mChannel)
+ {
+ mChannel->updateShowToastsState();
+ mChannel->redrawToasts();
+ }
}
//---------------------------------------------------------------------------------
void LLSysWellWindow::reshapeWindow()
{
- // save difference between floater height and the list height to take it into account while calculating new window height
- // it includes height from floater top to list top and from floater bottom and list bottom
- static S32 parent_list_delta_height = getRect().getHeight() - mMessageList->getRect().getHeight();
+ // save difference between floater height and the list height to take it into account while calculating new window height
+ // it includes height from floater top to list top and from floater bottom and list bottom
+ static S32 parent_list_delta_height = getRect().getHeight() - mMessageList->getRect().getHeight();
- if (!mIsReshapedByUser) // Don't reshape Well window, if it ever was reshaped by user. See EXT-5715.
- {
- S32 notif_list_height = mMessageList->getItemsRect().getHeight() + 2 * mMessageList->getBorderWidth();
+ if (!mIsReshapedByUser) // Don't reshape Well window, if it ever was reshaped by user. See EXT-5715.
+ {
+ S32 notif_list_height = mMessageList->getItemsRect().getHeight() + 2 * mMessageList->getBorderWidth();
- LLRect curRect = getRect();
+ LLRect curRect = getRect();
- S32 new_window_height = notif_list_height + parent_list_delta_height;
+ S32 new_window_height = notif_list_height + parent_list_delta_height;
- if (new_window_height > MAX_WINDOW_HEIGHT)
- {
- new_window_height = MAX_WINDOW_HEIGHT;
- }
- S32 newWidth = curRect.getWidth() < MIN_WINDOW_WIDTH ? MIN_WINDOW_WIDTH : curRect.getWidth();
+ if (new_window_height > MAX_WINDOW_HEIGHT)
+ {
+ new_window_height = MAX_WINDOW_HEIGHT;
+ }
+ S32 newWidth = curRect.getWidth() < MIN_WINDOW_WIDTH ? MIN_WINDOW_WIDTH : curRect.getWidth();
- curRect.setLeftTopAndSize(curRect.mLeft, curRect.mTop, newWidth, new_window_height);
- reshape(curRect.getWidth(), curRect.getHeight(), TRUE);
- setRect(curRect);
- }
+ curRect.setLeftTopAndSize(curRect.mLeft, curRect.mTop, newWidth, new_window_height);
+ reshape(curRect.getWidth(), curRect.getHeight(), TRUE);
+ setRect(curRect);
+ }
- // update notification channel state
- // update on a window reshape is important only when a window is visible and docked
- if(mChannel && getVisible() && isDocked())
- {
- mChannel->updateShowToastsState();
- }
+ // update notification channel state
+ // update on a window reshape is important only when a window is visible and docked
+ if(mChannel && getVisible() && isDocked())
+ {
+ mChannel->updateShowToastsState();
+ }
}
//---------------------------------------------------------------------------------
bool LLSysWellWindow::isWindowEmpty()
{
- return mMessageList->size() == 0;
+ return mMessageList->size() == 0;
}
/************************************************************************/
@@ -224,15 +224,15 @@ LLIMWellWindow::ObjectRowPanel::ObjectRowPanel(const LLUUID& notification_id, bo
: LLPanel()
, mChiclet(NULL)
{
- buildFromFile( "panel_active_object_row.xml");
+ buildFromFile( "panel_active_object_row.xml");
- initChiclet(notification_id);
+ initChiclet(notification_id);
- LLTextBox* obj_name = getChild<LLTextBox>("object_name");
- obj_name->setValue(LLScriptFloaterManager::getObjectName(notification_id));
+ LLTextBox* obj_name = getChild<LLTextBox>("object_name");
+ obj_name->setValue(LLScriptFloaterManager::getObjectName(notification_id));
- mCloseBtn = getChild<LLButton>("hide_btn");
- mCloseBtn->setCommitCallback(boost::bind(&LLIMWellWindow::ObjectRowPanel::onClosePanel, this));
+ mCloseBtn = getChild<LLButton>("hide_btn");
+ mCloseBtn->setCommitCallback(boost::bind(&LLIMWellWindow::ObjectRowPanel::onClosePanel, this));
}
//---------------------------------------------------------------------------------
@@ -243,56 +243,56 @@ LLIMWellWindow::ObjectRowPanel::~ObjectRowPanel()
//---------------------------------------------------------------------------------
void LLIMWellWindow::ObjectRowPanel::onClosePanel()
{
- LLScriptFloaterManager::getInstance()->removeNotification(mChiclet->getSessionId());
+ LLScriptFloaterManager::getInstance()->removeNotification(mChiclet->getSessionId());
}
void LLIMWellWindow::ObjectRowPanel::initChiclet(const LLUUID& notification_id, bool new_message/* = false*/)
{
- // Choose which of the pre-created chiclets to use.
- switch(LLScriptFloaterManager::getObjectType(notification_id))
- {
- case LLScriptFloaterManager::OBJ_GIVE_INVENTORY:
- mChiclet = getChild<LLInvOfferChiclet>("inv_offer_chiclet");
- break;
- default:
- mChiclet = getChild<LLScriptChiclet>("object_chiclet");
- break;
- }
+ // Choose which of the pre-created chiclets to use.
+ switch(LLScriptFloaterManager::getObjectType(notification_id))
+ {
+ case LLScriptFloaterManager::OBJ_GIVE_INVENTORY:
+ mChiclet = getChild<LLInvOfferChiclet>("inv_offer_chiclet");
+ break;
+ default:
+ mChiclet = getChild<LLScriptChiclet>("object_chiclet");
+ break;
+ }
- mChiclet->setVisible(true);
- mChiclet->setSessionId(notification_id);
+ mChiclet->setVisible(true);
+ mChiclet->setSessionId(notification_id);
}
//---------------------------------------------------------------------------------
void LLIMWellWindow::ObjectRowPanel::onMouseEnter(S32 x, S32 y, MASK mask)
{
- setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemSelected"));
+ setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemSelected"));
}
//---------------------------------------------------------------------------------
void LLIMWellWindow::ObjectRowPanel::onMouseLeave(S32 x, S32 y, MASK mask)
{
- setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemUnselected"));
+ setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemUnselected"));
}
//---------------------------------------------------------------------------------
// virtual
BOOL LLIMWellWindow::ObjectRowPanel::handleMouseDown(S32 x, S32 y, MASK mask)
{
- // Pass the mouse down event to the chiclet (EXT-596).
- if (!mChiclet->pointInView(x, y) && !mCloseBtn->getRect().pointInRect(x, y)) // prevent double call of LLIMChiclet::onMouseDown()
- {
- mChiclet->onMouseDown();
- return TRUE;
- }
+ // Pass the mouse down event to the chiclet (EXT-596).
+ if (!mChiclet->pointInView(x, y) && !mCloseBtn->getRect().pointInRect(x, y)) // prevent double call of LLIMChiclet::onMouseDown()
+ {
+ mChiclet->onMouseDown();
+ return TRUE;
+ }
- return LLPanel::handleMouseDown(x, y, mask);
+ return LLPanel::handleMouseDown(x, y, mask);
}
// virtual
BOOL LLIMWellWindow::ObjectRowPanel::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- return mChiclet->handleRightMouseDown(x, y, mask);
+ return mChiclet->handleRightMouseDown(x, y, mask);
}
/************************************************************************/
@@ -313,38 +313,38 @@ LLIMWellWindow::~LLIMWellWindow()
// static
LLIMWellWindow* LLIMWellWindow::getInstance(const LLSD& key /*= LLSD()*/)
{
- return LLFloaterReg::getTypedInstance<LLIMWellWindow>("im_well_window", key);
+ return LLFloaterReg::getTypedInstance<LLIMWellWindow>("im_well_window", key);
}
// static
LLIMWellWindow* LLIMWellWindow::findInstance(const LLSD& key /*= LLSD()*/)
{
- return LLFloaterReg::findTypedInstance<LLIMWellWindow>("im_well_window", key);
+ return LLFloaterReg::findTypedInstance<LLIMWellWindow>("im_well_window", key);
}
BOOL LLIMWellWindow::postBuild()
{
- BOOL rv = LLSysWellWindow::postBuild();
- setTitle(getString("title_im_well_window"));
+ BOOL rv = LLSysWellWindow::postBuild();
+ setTitle(getString("title_im_well_window"));
- LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findObjectChiclet, this, _1));
+ LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findObjectChiclet, this, _1));
- return rv;
+ return rv;
}
LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& notification_id)
{
- if (!mMessageList) return NULL;
+ if (!mMessageList) return NULL;
- LLChiclet* res = NULL;
- ObjectRowPanel* panel = mMessageList->getTypedItemByValue<ObjectRowPanel>(notification_id);
- if (panel != NULL)
- {
- res = panel->mChiclet;
- }
+ LLChiclet* res = NULL;
+ ObjectRowPanel* panel = mMessageList->getTypedItemByValue<ObjectRowPanel>(notification_id);
+ if (panel != NULL)
+ {
+ res = panel->mChiclet;
+ }
- return res;
+ return res;
}
//////////////////////////////////////////////////////////////////////////
@@ -352,99 +352,99 @@ LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& notification_id)
void LLIMWellWindow::addObjectRow(const LLUUID& notification_id, bool new_message/* = false*/)
{
- if (mMessageList->getItemByValue(notification_id) == NULL)
- {
- ObjectRowPanel* item = new ObjectRowPanel(notification_id, new_message);
- if (!mMessageList->addItem(item, notification_id))
- {
- LL_WARNS() << "Unable to add Object Row into the list, notificationID: " << notification_id << LL_ENDL;
- item->die();
- }
- reshapeWindow();
- }
+ if (mMessageList->getItemByValue(notification_id) == NULL)
+ {
+ ObjectRowPanel* item = new ObjectRowPanel(notification_id, new_message);
+ if (!mMessageList->addItem(item, notification_id))
+ {
+ LL_WARNS() << "Unable to add Object Row into the list, notificationID: " << notification_id << LL_ENDL;
+ item->die();
+ }
+ reshapeWindow();
+ }
}
void LLIMWellWindow::removeObjectRow(const LLUUID& notification_id)
{
- if (!mMessageList->removeItemByValue(notification_id))
- {
- LL_WARNS() << "Unable to remove Object Row from the list, notificationID: " << notification_id << LL_ENDL;
- }
+ if (!mMessageList->removeItemByValue(notification_id))
+ {
+ LL_WARNS() << "Unable to remove Object Row from the list, notificationID: " << notification_id << LL_ENDL;
+ }
- reshapeWindow();
- // hide chiclet window if there are no items left
- if(isWindowEmpty())
- {
- setVisible(FALSE);
- }
+ reshapeWindow();
+ // hide chiclet window if there are no items left
+ if(isWindowEmpty())
+ {
+ setVisible(FALSE);
+ }
}
void LLIMWellWindow::closeAll()
{
- // Generate an ignorable alert dialog if there is an active voice IM sesion
- bool need_confirmation = false;
- const LLIMModel& im_model = LLIMModel::instance();
- std::vector<LLSD> values;
- mMessageList->getValues(values);
- for (std::vector<LLSD>::iterator
- iter = values.begin(),
- iter_end = values.end();
- iter != iter_end; ++iter)
- {
- LLIMSpeakerMgr* speaker_mgr = im_model.getSpeakerManager(*iter);
- if (speaker_mgr && speaker_mgr->isVoiceActive())
- {
- need_confirmation = true;
- break;
- }
- }
- if ( need_confirmation )
- {
- //Bring up a confirmation dialog
- LLNotificationsUtil::add
- ("ConfirmCloseAll", LLSD(), LLSD(),
- boost::bind(&LLIMWellWindow::confirmCloseAll, this, _1, _2));
- }
- else
- {
- closeAllImpl();
- }
+ // Generate an ignorable alert dialog if there is an active voice IM sesion
+ bool need_confirmation = false;
+ const LLIMModel& im_model = LLIMModel::instance();
+ std::vector<LLSD> values;
+ mMessageList->getValues(values);
+ for (std::vector<LLSD>::iterator
+ iter = values.begin(),
+ iter_end = values.end();
+ iter != iter_end; ++iter)
+ {
+ LLIMSpeakerMgr* speaker_mgr = im_model.getSpeakerManager(*iter);
+ if (speaker_mgr && speaker_mgr->isVoiceActive())
+ {
+ need_confirmation = true;
+ break;
+ }
+ }
+ if ( need_confirmation )
+ {
+ //Bring up a confirmation dialog
+ LLNotificationsUtil::add
+ ("ConfirmCloseAll", LLSD(), LLSD(),
+ boost::bind(&LLIMWellWindow::confirmCloseAll, this, _1, _2));
+ }
+ else
+ {
+ closeAllImpl();
+ }
}
void LLIMWellWindow::closeAllImpl()
{
- std::vector<LLSD> values;
- mMessageList->getValues(values);
+ std::vector<LLSD> values;
+ mMessageList->getValues(values);
- for (std::vector<LLSD>::iterator
- iter = values.begin(),
- iter_end = values.end();
- iter != iter_end; ++iter)
- {
- LLPanel* panel = mMessageList->getItemByValue(*iter);
+ for (std::vector<LLSD>::iterator
+ iter = values.begin(),
+ iter_end = values.end();
+ iter != iter_end; ++iter)
+ {
+ LLPanel* panel = mMessageList->getItemByValue(*iter);
- ObjectRowPanel* obj_panel = dynamic_cast <ObjectRowPanel*> (panel);
- if (obj_panel)
- {
- LLScriptFloaterManager::instance().removeNotification(*iter);
- }
- }
+ ObjectRowPanel* obj_panel = dynamic_cast <ObjectRowPanel*> (panel);
+ if (obj_panel)
+ {
+ LLScriptFloaterManager::instance().removeNotification(*iter);
+ }
+ }
}
bool LLIMWellWindow::confirmCloseAll(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- switch(option)
- {
- case 0:
- {
- closeAllImpl();
- return true;
- }
- default:
- break;
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ switch(option)
+ {
+ case 0:
+ {
+ closeAllImpl();
+ return true;
+ }
+ default:
+ break;
+ }
+ return false;
}
diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h
index b96a2573a1..fb65680414 100644
--- a/indra/newview/llsyswellwindow.h
+++ b/indra/newview/llsyswellwindow.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llsyswellwindow.h
* @brief // TODO
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,107 +44,107 @@ class LLSysWellChiclet;
class LLSysWellWindow : public LLTransientDockableFloater
{
public:
- LOG_CLASS(LLSysWellWindow);
+ LOG_CLASS(LLSysWellWindow);
LLSysWellWindow(const LLSD& key);
virtual ~LLSysWellWindow();
- BOOL postBuild();
+ BOOL postBuild();
- // other interface functions
- // check is window empty
- bool isWindowEmpty();
+ // other interface functions
+ // check is window empty
+ bool isWindowEmpty();
- // Operating with items
- void removeItemByID(const LLUUID& id);
- LLPanel * findItemByID(const LLUUID& id);
+ // Operating with items
+ void removeItemByID(const LLUUID& id);
+ LLPanel * findItemByID(const LLUUID& id);
- // Operating with outfit
- virtual void setVisible(BOOL visible);
- void adjustWindowPosition();
- /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
- // override LLFloater's minimization according to EXT-1216
- /*virtual*/ void setMinimized(BOOL minimize);
- /*virtual*/ void handleReshape(const LLRect& rect, bool by_user);
+ // Operating with outfit
+ virtual void setVisible(BOOL visible);
+ void adjustWindowPosition();
+ /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
+ // override LLFloater's minimization according to EXT-1216
+ /*virtual*/ void setMinimized(BOOL minimize);
+ /*virtual*/ void handleReshape(const LLRect& rect, bool by_user);
- void onStartUpToastClick(S32 x, S32 y, MASK mask);
+ void onStartUpToastClick(S32 x, S32 y, MASK mask);
- void setSysWellChiclet(LLSysWellChiclet* chiclet);
+ void setSysWellChiclet(LLSysWellChiclet* chiclet);
- // size constants for the window and for its elements
- static const S32 MAX_WINDOW_HEIGHT = 200;
- static const S32 MIN_WINDOW_WIDTH = 318;
+ // size constants for the window and for its elements
+ static const S32 MAX_WINDOW_HEIGHT = 200;
+ static const S32 MIN_WINDOW_WIDTH = 318;
protected:
- // init Window's channel
- virtual void initChannel();
+ // init Window's channel
+ virtual void initChannel();
- const std::string NOTIFICATION_WELL_ANCHOR_NAME;
- const std::string IM_WELL_ANCHOR_NAME;
- virtual const std::string& getAnchorViewName() = 0;
+ const std::string NOTIFICATION_WELL_ANCHOR_NAME;
+ const std::string IM_WELL_ANCHOR_NAME;
+ virtual const std::string& getAnchorViewName() = 0;
- void reshapeWindow();
+ void reshapeWindow();
- // pointer to a corresponding channel's instance
- LLNotificationsUI::LLScreenChannel* mChannel;
- LLFlatListView* mMessageList;
+ // pointer to a corresponding channel's instance
+ LLNotificationsUI::LLScreenChannel* mChannel;
+ LLFlatListView* mMessageList;
- /**
- * Reference to an appropriate Well chiclet to release "new message" state. EXT-3147
- */
- LLSysWellChiclet* mSysWellChiclet;
+ /**
+ * Reference to an appropriate Well chiclet to release "new message" state. EXT-3147
+ */
+ LLSysWellChiclet* mSysWellChiclet;
- bool mIsReshapedByUser;
+ bool mIsReshapedByUser;
};
/**
* Class intended to manage incoming messages in IM chats.
- *
+ *
* It contains a list list of all active IM sessions.
*/
class LLIMWellWindow : public LLSysWellWindow, LLInitClass<LLIMWellWindow>
{
public:
- LLIMWellWindow(const LLSD& key);
- ~LLIMWellWindow();
+ LLIMWellWindow(const LLSD& key);
+ ~LLIMWellWindow();
- static LLIMWellWindow* getInstance(const LLSD& key = LLSD());
- static LLIMWellWindow* findInstance(const LLSD& key = LLSD());
- static void initClass() { getInstance(); }
+ static LLIMWellWindow* getInstance(const LLSD& key = LLSD());
+ static LLIMWellWindow* findInstance(const LLSD& key = LLSD());
+ static void initClass() { getInstance(); }
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- void addObjectRow(const LLUUID& notification_id, bool new_message = false);
- void removeObjectRow(const LLUUID& notification_id);
- void closeAll();
+ void addObjectRow(const LLUUID& notification_id, bool new_message = false);
+ void removeObjectRow(const LLUUID& notification_id);
+ void closeAll();
protected:
- /*virtual*/ const std::string& getAnchorViewName() { return IM_WELL_ANCHOR_NAME; }
+ /*virtual*/ const std::string& getAnchorViewName() { return IM_WELL_ANCHOR_NAME; }
private:
- LLChiclet* findObjectChiclet(const LLUUID& notification_id);
-
- bool confirmCloseAll(const LLSD& notification, const LLSD& response);
- void closeAllImpl();
-
- class ObjectRowPanel: public LLPanel
- {
- public:
- ObjectRowPanel(const LLUUID& notification_id, bool new_message = false);
- virtual ~ObjectRowPanel();
- /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
- /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
-
- private:
- void onClosePanel();
- void initChiclet(const LLUUID& notification_id, bool new_message = false);
-
- public:
- LLIMChiclet* mChiclet;
- private:
- LLButton* mCloseBtn;
- };
+ LLChiclet* findObjectChiclet(const LLUUID& notification_id);
+
+ bool confirmCloseAll(const LLSD& notification, const LLSD& response);
+ void closeAllImpl();
+
+ class ObjectRowPanel: public LLPanel
+ {
+ public:
+ ObjectRowPanel(const LLUUID& notification_id, bool new_message = false);
+ virtual ~ObjectRowPanel();
+ /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
+ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+
+ private:
+ void onClosePanel();
+ void initChiclet(const LLUUID& notification_id, bool new_message = false);
+
+ public:
+ LLIMChiclet* mChiclet;
+ private:
+ LLButton* mCloseBtn;
+ };
};
#endif // LL_LLSYSWELLWINDOW_H
diff --git a/indra/newview/lltable.h b/indra/newview/lltable.h
index d75ef84ae4..e8099a3737 100644
--- a/indra/newview/lltable.h
+++ b/indra/newview/lltable.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltable.h
* @brief Description of LLTable template class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,37 +30,37 @@
template<class T> class LLTable
{
private:
- T *_tab;
- U32 _w;
- U32 _h;
- U32 _size;
+ T *_tab;
+ U32 _w;
+ U32 _h;
+ U32 _size;
public:
- LLTable(U32 w, U32 h = 0) : _tab(0), _w(w), _h(h)
- {
- if (_w < 0) _w = 0;
- if (_h < 0) _h = 0;
- if (0 == h)
- _h = _w;
- _size = _w * _h;
- if ((_w > 0) && (_h > 0))
- _tab = new T[_size];
- }
+ LLTable(U32 w, U32 h = 0) : _tab(0), _w(w), _h(h)
+ {
+ if (_w < 0) _w = 0;
+ if (_h < 0) _h = 0;
+ if (0 == h)
+ _h = _w;
+ _size = _w * _h;
+ if ((_w > 0) && (_h > 0))
+ _tab = new T[_size];
+ }
- ~LLTable()
- {
- delete[] _tab;
- _tab = NULL;
- }
+ ~LLTable()
+ {
+ delete[] _tab;
+ _tab = NULL;
+ }
- void init(const T& t)
- {
- for (U32 i = 0; i < _size; ++i)
- _tab[i] = t;
- }
- const T& at(U32 w, U32 h) const { return _tab[h * _w + w]; }
- T& at(U32 w, U32 h) { return _tab[h * _w + w]; }
- U32 size() const { return _size; }
- U32 w() const { return _w; }
- U32 h() const { return _h; }
+ void init(const T& t)
+ {
+ for (U32 i = 0; i < _size; ++i)
+ _tab[i] = t;
+ }
+ const T& at(U32 w, U32 h) const { return _tab[h * _w + w]; }
+ T& at(U32 w, U32 h) { return _tab[h * _w + w]; }
+ U32 size() const { return _size; }
+ U32 w() const { return _w; }
+ U32 h() const { return _h; }
};
#endif // LL_LLTABLE_H
diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp
index 3ece12931c..8fd7c7ab9a 100644
--- a/indra/newview/llteleporthistory.cpp
+++ b/indra/newview/llteleporthistory.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llteleporthistory.cpp
* @brief Teleport history
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,7 +51,7 @@
const std::string& LLTeleportHistoryItem::getTitle() const
{
- return gSavedSettings.getBOOL("NavBarShowCoordinates") ? mFullTitle : mTitle;
+ return gSavedSettings.getBOOL("NavBarShowCoordinates") ? mFullTitle : mTitle;
}
//////////////////////////////////////////////////////////////////////////////
@@ -59,207 +59,207 @@ const std::string& LLTeleportHistoryItem::getTitle() const
//////////////////////////////////////////////////////////////////////////////
LLTeleportHistory::LLTeleportHistory():
- mCurrentItem(-1),
- mRequestedItem(-1),
- mGotInitialUpdate(false),
- mTeleportHistoryStorage(NULL)
+ mCurrentItem(-1),
+ mRequestedItem(-1),
+ mGotInitialUpdate(false),
+ mTeleportHistoryStorage(NULL)
{
- mTeleportFinishedConn = LLViewerParcelMgr::getInstance()->
- setTeleportFinishedCallback(boost::bind(&LLTeleportHistory::updateCurrentLocation, this, _1));
- mTeleportFailedConn = LLViewerParcelMgr::getInstance()->
- setTeleportFailedCallback(boost::bind(&LLTeleportHistory::onTeleportFailed, this));
+ mTeleportFinishedConn = LLViewerParcelMgr::getInstance()->
+ setTeleportFinishedCallback(boost::bind(&LLTeleportHistory::updateCurrentLocation, this, _1));
+ mTeleportFailedConn = LLViewerParcelMgr::getInstance()->
+ setTeleportFailedCallback(boost::bind(&LLTeleportHistory::onTeleportFailed, this));
}
LLTeleportHistory::~LLTeleportHistory()
{
- mTeleportFinishedConn.disconnect();
- mTeleportFailedConn.disconnect();
+ mTeleportFinishedConn.disconnect();
+ mTeleportFailedConn.disconnect();
}
void LLTeleportHistory::goToItem(int idx)
{
- // Validate specified index.
- if (idx < 0 || idx >= (int)mItems.size())
- {
- LL_WARNS() << "Invalid teleport history index (" << idx << ") specified" << LL_ENDL;
- dump();
- return;
- }
-
- if (idx == mCurrentItem)
- {
- LL_WARNS() << "Will not teleport to the same location." << LL_ENDL;
- dump();
- return;
- }
-
- // Attempt to teleport to the requested item.
- gAgent.teleportViaLocation(mItems[idx].mGlobalPos);
- mRequestedItem = idx;
+ // Validate specified index.
+ if (idx < 0 || idx >= (int)mItems.size())
+ {
+ LL_WARNS() << "Invalid teleport history index (" << idx << ") specified" << LL_ENDL;
+ dump();
+ return;
+ }
+
+ if (idx == mCurrentItem)
+ {
+ LL_WARNS() << "Will not teleport to the same location." << LL_ENDL;
+ dump();
+ return;
+ }
+
+ // Attempt to teleport to the requested item.
+ gAgent.teleportViaLocation(mItems[idx].mGlobalPos);
+ mRequestedItem = idx;
}
void LLTeleportHistory::onTeleportFailed()
{
- // Are we trying to teleport within the history?
- if (mRequestedItem != -1)
- {
- // Not anymore.
- mRequestedItem = -1;
- }
+ // Are we trying to teleport within the history?
+ if (mRequestedItem != -1)
+ {
+ // Not anymore.
+ mRequestedItem = -1;
+ }
}
void LLTeleportHistory::handleLoginComplete()
{
- if( mGotInitialUpdate )
- {
- return;
- }
- updateCurrentLocation(gAgent.getPositionGlobal());
+ if( mGotInitialUpdate )
+ {
+ return;
+ }
+ updateCurrentLocation(gAgent.getPositionGlobal());
}
static void on_avatar_name_update_title(const LLAvatarName& av_name)
{
- if (gAgent.getRegion() && gViewerWindow && gViewerWindow->getWindow())
- {
- std::string region = gAgent.getRegion()->getName();
- std::string username = av_name.getUserName();
-
- // this first pass simply displays username and region name
- // but could easily be extended to include other details like
- // X/Y/Z location within a region etc.
- std::string new_title = STRINGIZE(username << " @ " << region);
- gViewerWindow->getWindow()->setTitle(new_title);
- }
+ if (gAgent.getRegion() && gViewerWindow && gViewerWindow->getWindow())
+ {
+ std::string region = gAgent.getRegion()->getName();
+ std::string username = av_name.getUserName();
+
+ // this first pass simply displays username and region name
+ // but could easily be extended to include other details like
+ // X/Y/Z location within a region etc.
+ std::string new_title = STRINGIZE(username << " @ " << region);
+ gViewerWindow->getWindow()->setTitle(new_title);
+ }
}
void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos)
{
- if (!gAgent.getRegion()) return;
-
- if (!mTeleportHistoryStorage)
- {
- mTeleportHistoryStorage = LLTeleportHistoryStorage::getInstance();
- }
- if (mRequestedItem != -1) // teleport within the history in progress?
- {
- mCurrentItem = mRequestedItem;
- mRequestedItem = -1;
- }
- else
- {
- //EXT-7034
- //skip initial update if agent avatar is no valid yet
- //this may happen when updateCurrentLocation called while login process
- //sometimes isAgentAvatarValid return false and in this case new_pos
- //(which actually is gAgent.getPositionGlobal() ) is invalid
- //if this position will be saved then teleport back will teleport user to wrong position
- if ( !mGotInitialUpdate && !isAgentAvatarValid() )
- {
- return ;
- }
-
- // If we're getting the initial location update
- // while we already have a (loaded) non-empty history,
- // there's no need to purge forward items or add a new item.
-
- if (mGotInitialUpdate || mItems.size() == 0)
- {
- // Purge forward items (if any).
- if(mItems.size())
- mItems.erase (mItems.begin() + mCurrentItem + 1, mItems.end());
-
- // Append an empty item to the history and make it current.
- mItems.push_back(LLTeleportHistoryItem("", LLVector3d()));
- mCurrentItem++;
- }
-
- // Update current history item.
- if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check
- {
- LL_WARNS() << "Invalid current item. (this should not happen)" << LL_ENDL;
- llassert(!"Invalid current teleport history item");
- return;
- }
- LLVector3 new_pos_local = gAgent.getPosAgentFromGlobal(new_pos);
- mItems[mCurrentItem].mFullTitle = getCurrentLocationTitle(true, new_pos_local);
- mItems[mCurrentItem].mTitle = getCurrentLocationTitle(false, new_pos_local);
- mItems[mCurrentItem].mGlobalPos = new_pos;
- mItems[mCurrentItem].mRegionID = gAgent.getRegion()->getRegionID();
- }
-
- dump();
-
- if (!mGotInitialUpdate)
- mGotInitialUpdate = true;
+ if (!gAgent.getRegion()) return;
+
+ if (!mTeleportHistoryStorage)
+ {
+ mTeleportHistoryStorage = LLTeleportHistoryStorage::getInstance();
+ }
+ if (mRequestedItem != -1) // teleport within the history in progress?
+ {
+ mCurrentItem = mRequestedItem;
+ mRequestedItem = -1;
+ }
+ else
+ {
+ //EXT-7034
+ //skip initial update if agent avatar is no valid yet
+ //this may happen when updateCurrentLocation called while login process
+ //sometimes isAgentAvatarValid return false and in this case new_pos
+ //(which actually is gAgent.getPositionGlobal() ) is invalid
+ //if this position will be saved then teleport back will teleport user to wrong position
+ if ( !mGotInitialUpdate && !isAgentAvatarValid() )
+ {
+ return ;
+ }
+
+ // If we're getting the initial location update
+ // while we already have a (loaded) non-empty history,
+ // there's no need to purge forward items or add a new item.
+
+ if (mGotInitialUpdate || mItems.size() == 0)
+ {
+ // Purge forward items (if any).
+ if(mItems.size())
+ mItems.erase (mItems.begin() + mCurrentItem + 1, mItems.end());
+
+ // Append an empty item to the history and make it current.
+ mItems.push_back(LLTeleportHistoryItem("", LLVector3d()));
+ mCurrentItem++;
+ }
+
+ // Update current history item.
+ if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check
+ {
+ LL_WARNS() << "Invalid current item. (this should not happen)" << LL_ENDL;
+ llassert(!"Invalid current teleport history item");
+ return;
+ }
+ LLVector3 new_pos_local = gAgent.getPosAgentFromGlobal(new_pos);
+ mItems[mCurrentItem].mFullTitle = getCurrentLocationTitle(true, new_pos_local);
+ mItems[mCurrentItem].mTitle = getCurrentLocationTitle(false, new_pos_local);
+ mItems[mCurrentItem].mGlobalPos = new_pos;
+ mItems[mCurrentItem].mRegionID = gAgent.getRegion()->getRegionID();
+ }
+
+ dump();
+
+ if (!mGotInitialUpdate)
+ mGotInitialUpdate = true;
// update Viewer window title with username and region name
- // if we are in "non-interactive mode" (SL-15999) or the debug
+ // if we are in "non-interactive mode" (SL-15999) or the debug
// setting to allow it is enabled (may be useful in other situations)
if (gNonInteractive || gSavedSettings.getBOOL("UpdateAppWindowTitleBar"))
{
- LLAvatarNameCache::get(gAgent.getID(), boost::bind(&on_avatar_name_update_title, _2));
+ LLAvatarNameCache::get(gAgent.getID(), boost::bind(&on_avatar_name_update_title, _2));
}
- // Signal the interesting party that we've changed.
- onHistoryChanged();
+ // Signal the interesting party that we've changed.
+ onHistoryChanged();
}
boost::signals2::connection LLTeleportHistory::setHistoryChangedCallback(history_callback_t cb)
{
- return mHistoryChangedSignal.connect(cb);
+ return mHistoryChangedSignal.connect(cb);
}
void LLTeleportHistory::onHistoryChanged()
{
- mHistoryChangedSignal();
+ mHistoryChangedSignal();
}
void LLTeleportHistory::purgeItems()
{
- if (mItems.size() == 0) // no entries yet (we're called before login)
- {
- // If we don't return here the history will get into inconsistent state, hence:
- // 1) updateCurrentLocation() will malfunction,
- // so further teleports will not properly update the history;
- // 2) mHistoryChangedSignal subscribers will be notified
- // of such an invalid change. (EXT-6798)
- // Both should not happen.
- return;
- }
-
- if (mItems.size() > 0)
- {
- mItems.erase(mItems.begin(), mItems.end()-1);
- }
- // reset the count
- mRequestedItem = -1;
- mCurrentItem = 0;
-
- onHistoryChanged();
+ if (mItems.size() == 0) // no entries yet (we're called before login)
+ {
+ // If we don't return here the history will get into inconsistent state, hence:
+ // 1) updateCurrentLocation() will malfunction,
+ // so further teleports will not properly update the history;
+ // 2) mHistoryChangedSignal subscribers will be notified
+ // of such an invalid change. (EXT-6798)
+ // Both should not happen.
+ return;
+ }
+
+ if (mItems.size() > 0)
+ {
+ mItems.erase(mItems.begin(), mItems.end()-1);
+ }
+ // reset the count
+ mRequestedItem = -1;
+ mCurrentItem = 0;
+
+ onHistoryChanged();
}
// static
std::string LLTeleportHistory::getCurrentLocationTitle(bool full, const LLVector3& local_pos_override)
{
- std::string location_name;
- LLAgentUI::ELocationFormat fmt = full ? LLAgentUI::LOCATION_FORMAT_NO_MATURITY : LLAgentUI::LOCATION_FORMAT_NORMAL;
+ std::string location_name;
+ LLAgentUI::ELocationFormat fmt = full ? LLAgentUI::LOCATION_FORMAT_NO_MATURITY : LLAgentUI::LOCATION_FORMAT_NORMAL;
- if (!LLAgentUI::buildLocationString(location_name, fmt, local_pos_override)) location_name = "Unknown";
- return location_name;
+ if (!LLAgentUI::buildLocationString(location_name, fmt, local_pos_override)) location_name = "Unknown";
+ return location_name;
}
void LLTeleportHistory::dump() const
{
- LL_INFOS() << "Teleport history dump (" << mItems.size() << " items):" << LL_ENDL;
-
- for (size_t i=0; i<mItems.size(); i++)
- {
- std::stringstream line;
- line << ((i == mCurrentItem) ? " * " : " ");
- line << i << ": " << mItems[i].mTitle;
- line << " REGION_ID: " << mItems[i].mRegionID;
- line << ", pos: " << mItems[i].mGlobalPos;
- LL_INFOS() << line.str() << LL_ENDL;
- }
+ LL_INFOS() << "Teleport history dump (" << mItems.size() << " items):" << LL_ENDL;
+
+ for (size_t i=0; i<mItems.size(); i++)
+ {
+ std::stringstream line;
+ line << ((i == mCurrentItem) ? " * " : " ");
+ line << i << ": " << mItems[i].mTitle;
+ line << " REGION_ID: " << mItems[i].mRegionID;
+ line << ", pos: " << mItems[i].mGlobalPos;
+ LL_INFOS() << line.str() << LL_ENDL;
+ }
}
diff --git a/indra/newview/llteleporthistory.h b/indra/newview/llteleporthistory.h
index db0ccdda59..b534b136b0 100644
--- a/indra/newview/llteleporthistory.h
+++ b/indra/newview/llteleporthistory.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llteleporthistory.h
* @brief Teleport history
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,201 +38,201 @@
/**
* An item of the teleport history.
- *
+ *
* Contains the location's global coordinates and its title.
*/
class LLTeleportHistoryItem
{
public:
- LLTeleportHistoryItem()
- {}
-
- LLTeleportHistoryItem(std::string title, LLVector3d global_pos)
- : mTitle(title), mGlobalPos(global_pos)
- {}
-
- /**
- * @return title formatted according to the current value of the
- * NavBarShowCoordinates setting.
- */
- const std::string& getTitle() const;
-
- std::string mTitle; // human-readable location title
- std::string mFullTitle; // human-readable location title including coordinates
- LLVector3d mGlobalPos; // global position
- LLUUID mRegionID; // region ID for getting the region info
+ LLTeleportHistoryItem()
+ {}
+
+ LLTeleportHistoryItem(std::string title, LLVector3d global_pos)
+ : mTitle(title), mGlobalPos(global_pos)
+ {}
+
+ /**
+ * @return title formatted according to the current value of the
+ * NavBarShowCoordinates setting.
+ */
+ const std::string& getTitle() const;
+
+ std::string mTitle; // human-readable location title
+ std::string mFullTitle; // human-readable location title including coordinates
+ LLVector3d mGlobalPos; // global position
+ LLUUID mRegionID; // region ID for getting the region info
};
/**
* Teleport history.
- *
+ *
* Along with the navigation bar "Back" and "Forward" buttons
* implements web browser-like navigation functionality.
- *
+ *
* @see LLNavigationBar
*/
class LLTeleportHistory: public LLSingleton<LLTeleportHistory>
{
- LLSINGLETON(LLTeleportHistory);
- ~LLTeleportHistory();
- LOG_CLASS(LLTeleportHistory);
+ LLSINGLETON(LLTeleportHistory);
+ ~LLTeleportHistory();
+ LOG_CLASS(LLTeleportHistory);
public:
-
- typedef std::vector<LLTeleportHistoryItem> slurl_list_t;
- typedef boost::function<void()> history_callback_t;
- typedef boost::signals2::signal<void()> history_signal_t;
-
- /**
- * Go back in the history.
- */
- void goBack() { goToItem(getCurrentItemIndex() - 1); }
-
- /**
- * Go forward in the history.
- */
- void goForward() { goToItem(getCurrentItemIndex() + 1); }
-
- /**
- * Go to specific item in the history.
- *
- * The item is specified by its index (starting from 0).
- */
- void goToItem(int idx);
-
- /**
- * @return history items.
- */
- const slurl_list_t& getItems() const { return mItems; }
- void purgeItems();
- /**
- * Is the history empty?
- *
- * History containing single item is treated as empty
- * because the item points to the current location.
- */
- bool isEmpty() const { return mItems.size() <= 1; }
-
- /**
- * Get index of the current location in the history.
- */
- int getCurrentItemIndex() const { return mCurrentItem; }
- /**
- * Set a callback to be called upon history changes.
- *
- * Multiple callbacks can be set.
- */
- boost::signals2::connection setHistoryChangedCallback(history_callback_t cb);
-
- /**
- * Save history to a file so that we can restore it on startup.
- *
- * @see load()
- */
- void dump() const;
- /**
- * Process login complete event. Basically put current location into history
- */
- void handleLoginComplete();
+
+ typedef std::vector<LLTeleportHistoryItem> slurl_list_t;
+ typedef boost::function<void()> history_callback_t;
+ typedef boost::signals2::signal<void()> history_signal_t;
+
+ /**
+ * Go back in the history.
+ */
+ void goBack() { goToItem(getCurrentItemIndex() - 1); }
+
+ /**
+ * Go forward in the history.
+ */
+ void goForward() { goToItem(getCurrentItemIndex() + 1); }
+
+ /**
+ * Go to specific item in the history.
+ *
+ * The item is specified by its index (starting from 0).
+ */
+ void goToItem(int idx);
+
+ /**
+ * @return history items.
+ */
+ const slurl_list_t& getItems() const { return mItems; }
+ void purgeItems();
+ /**
+ * Is the history empty?
+ *
+ * History containing single item is treated as empty
+ * because the item points to the current location.
+ */
+ bool isEmpty() const { return mItems.size() <= 1; }
+
+ /**
+ * Get index of the current location in the history.
+ */
+ int getCurrentItemIndex() const { return mCurrentItem; }
+ /**
+ * Set a callback to be called upon history changes.
+ *
+ * Multiple callbacks can be set.
+ */
+ boost::signals2::connection setHistoryChangedCallback(history_callback_t cb);
+
+ /**
+ * Save history to a file so that we can restore it on startup.
+ *
+ * @see load()
+ */
+ void dump() const;
+ /**
+ * Process login complete event. Basically put current location into history
+ */
+ void handleLoginComplete();
private:
-
- /**
- * Called by when a teleport fails.
- *
- * Called via callback set on the LLViewerParcelMgr "teleport failed" signal.
- *
- * @see mTeleportFailedConn
- */
- void onTeleportFailed();
-
- /**
- * Update current location.
- *
- * @param new_pos Current agent global position. After local teleports we
- * cannot rely on gAgent.getPositionGlobal(),
- * so the new position gets passed explicitly.
- *
- * Called when a teleport finishes.
- * Called via callback set on the LLViewerParcelMgr "teleport finished" signal.
- *
- * Takes mRequestedItem into consideration: if it's not -1
- * (i.e. user is teleporting to an arbitrary location, not to a history item)
- * we purge forward items and append a new one, making it current. Otherwise
- * we just modify mCurrentItem.
- *
- * @see mRequestedItem
- * @see mGotInitialUpdate
- */
- void updateCurrentLocation(const LLVector3d& new_pos);
-
- /**
- * Invokes the "history changed" callback(s).
- */
- void onHistoryChanged();
-
- /**
- * Format current agent location in a human-readable manner.
- *
- * @param full whether to include coordinates
- * @param local_pos_override hack: see description of updateCurrentLocation()
- * @return
- */
- static std::string getCurrentLocationTitle(bool full, const LLVector3& local_pos_override);
-
- /**
- * Actually, the teleport history.
- */
- slurl_list_t mItems;
-
- /**
- * Current position within the history.
- */
- int mCurrentItem;
-
- /**
- * Requested position within the history.
- *
- * When a teleport succeeds, this is checked by updateCurrentLocation() to tell
- * if this is a teleport within the history (mRequestedItem >=0) or not (-1).
- *
- * Set by goToItem(); reset by onTeleportFailed() (if teleport fails).
- *
- * @see goToItem()
- * @see updateCurrentLocation()
- */
- int mRequestedItem;
-
- /**
- * Have we received the initial location update?
- *
- * @see updateCurrentLocation()
- */
- bool mGotInitialUpdate;
-
- LLTeleportHistoryStorage* mTeleportHistoryStorage;
-
- /**
- * Signal emitted when the history gets changed.
- *
- * Invokes callbacks set with setHistoryChangedCallback().
- */
- history_signal_t mHistoryChangedSignal;
-
- /**
- * Teleport success notification connection.
- *
- * Using this connection we get notified when a teleport finishes
- * or initial location update occurs.
- */
- boost::signals2::connection mTeleportFinishedConn;
-
- /**
- * Teleport failure notification connection.
- *
- * Using this connection we get notified when a teleport fails.
- */
- boost::signals2::connection mTeleportFailedConn;
+
+ /**
+ * Called by when a teleport fails.
+ *
+ * Called via callback set on the LLViewerParcelMgr "teleport failed" signal.
+ *
+ * @see mTeleportFailedConn
+ */
+ void onTeleportFailed();
+
+ /**
+ * Update current location.
+ *
+ * @param new_pos Current agent global position. After local teleports we
+ * cannot rely on gAgent.getPositionGlobal(),
+ * so the new position gets passed explicitly.
+ *
+ * Called when a teleport finishes.
+ * Called via callback set on the LLViewerParcelMgr "teleport finished" signal.
+ *
+ * Takes mRequestedItem into consideration: if it's not -1
+ * (i.e. user is teleporting to an arbitrary location, not to a history item)
+ * we purge forward items and append a new one, making it current. Otherwise
+ * we just modify mCurrentItem.
+ *
+ * @see mRequestedItem
+ * @see mGotInitialUpdate
+ */
+ void updateCurrentLocation(const LLVector3d& new_pos);
+
+ /**
+ * Invokes the "history changed" callback(s).
+ */
+ void onHistoryChanged();
+
+ /**
+ * Format current agent location in a human-readable manner.
+ *
+ * @param full whether to include coordinates
+ * @param local_pos_override hack: see description of updateCurrentLocation()
+ * @return
+ */
+ static std::string getCurrentLocationTitle(bool full, const LLVector3& local_pos_override);
+
+ /**
+ * Actually, the teleport history.
+ */
+ slurl_list_t mItems;
+
+ /**
+ * Current position within the history.
+ */
+ int mCurrentItem;
+
+ /**
+ * Requested position within the history.
+ *
+ * When a teleport succeeds, this is checked by updateCurrentLocation() to tell
+ * if this is a teleport within the history (mRequestedItem >=0) or not (-1).
+ *
+ * Set by goToItem(); reset by onTeleportFailed() (if teleport fails).
+ *
+ * @see goToItem()
+ * @see updateCurrentLocation()
+ */
+ int mRequestedItem;
+
+ /**
+ * Have we received the initial location update?
+ *
+ * @see updateCurrentLocation()
+ */
+ bool mGotInitialUpdate;
+
+ LLTeleportHistoryStorage* mTeleportHistoryStorage;
+
+ /**
+ * Signal emitted when the history gets changed.
+ *
+ * Invokes callbacks set with setHistoryChangedCallback().
+ */
+ history_signal_t mHistoryChangedSignal;
+
+ /**
+ * Teleport success notification connection.
+ *
+ * Using this connection we get notified when a teleport finishes
+ * or initial location update occurs.
+ */
+ boost::signals2::connection mTeleportFinishedConn;
+
+ /**
+ * Teleport failure notification connection.
+ *
+ * Using this connection we get notified when a teleport fails.
+ */
+ boost::signals2::connection mTeleportFailedConn;
};
#endif
diff --git a/indra/newview/llteleporthistorystorage.cpp b/indra/newview/llteleporthistorystorage.cpp
index 7d4988c0cc..fa4e92e209 100644
--- a/indra/newview/llteleporthistorystorage.cpp
+++ b/indra/newview/llteleporthistorystorage.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,39 +41,39 @@ const F64 MAX_GLOBAL_POS_OFFSET = 5.0f;
LLTeleportHistoryPersistentItem::LLTeleportHistoryPersistentItem(const LLSD& val)
{
- mTitle = val["title"].asString();
- mGlobalPos.setValue(val["global_pos"]);
- mDate = val["date"];
+ mTitle = val["title"].asString();
+ mGlobalPos.setValue(val["global_pos"]);
+ mDate = val["date"];
}
LLSD LLTeleportHistoryPersistentItem::toLLSD() const
{
- LLSD val;
+ LLSD val;
- val["title"] = mTitle;
- val["global_pos"] = mGlobalPos.getValue();
- val["date"] = mDate;
+ val["title"] = mTitle;
+ val["global_pos"] = mGlobalPos.getValue();
+ val["date"] = mDate;
- return val;
+ return val;
}
struct LLSortItemsByDate
{
- bool operator()(const LLTeleportHistoryPersistentItem& a, const LLTeleportHistoryPersistentItem& b)
- {
- return a.mDate < b.mDate;
- }
+ bool operator()(const LLTeleportHistoryPersistentItem& a, const LLTeleportHistoryPersistentItem& b)
+ {
+ return a.mDate < b.mDate;
+ }
};
LLTeleportHistoryStorage::LLTeleportHistoryStorage() :
- mFilename("teleport_history.txt")
+ mFilename("teleport_history.txt")
{
- mItems.clear();
- LLTeleportHistory *th = LLTeleportHistory::getInstance();
- if (th)
- th->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryStorage::onTeleportHistoryChange, this));
+ mItems.clear();
+ LLTeleportHistory *th = LLTeleportHistory::getInstance();
+ if (th)
+ th->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryStorage::onTeleportHistoryChange, this));
- load();
+ load();
}
LLTeleportHistoryStorage::~LLTeleportHistoryStorage()
@@ -82,183 +82,183 @@ LLTeleportHistoryStorage::~LLTeleportHistoryStorage()
void LLTeleportHistoryStorage::onTeleportHistoryChange()
{
- LLTeleportHistory *th = LLTeleportHistory::getInstance();
- if (!th)
- return;
+ LLTeleportHistory *th = LLTeleportHistory::getInstance();
+ if (!th)
+ return;
- // Hacky sanity check. (EXT-6798)
- if (th->getItems().size() == 0)
- {
- llassert(!"Inconsistent teleport history state");
- return;
- }
+ // Hacky sanity check. (EXT-6798)
+ if (th->getItems().size() == 0)
+ {
+ llassert(!"Inconsistent teleport history state");
+ return;
+ }
- const LLTeleportHistoryItem &item = th->getItems()[th->getCurrentItemIndex()];
+ const LLTeleportHistoryItem &item = th->getItems()[th->getCurrentItemIndex()];
- addItem(item.mTitle, item.mGlobalPos);
- save();
+ addItem(item.mTitle, item.mGlobalPos);
+ save();
}
void LLTeleportHistoryStorage::purgeItems()
{
- mItems.clear();
- mHistoryChangedSignal(-1);
+ mItems.clear();
+ mHistoryChangedSignal(-1);
}
void LLTeleportHistoryStorage::addItem(const std::string title, const LLVector3d& global_pos)
{
- addItem(title, global_pos, LLDate::now());
+ addItem(title, global_pos, LLDate::now());
}
bool LLTeleportHistoryStorage::compareByTitleAndGlobalPos(const LLTeleportHistoryPersistentItem& a, const LLTeleportHistoryPersistentItem& b)
{
- return a.mTitle == b.mTitle && (a.mGlobalPos - b.mGlobalPos).length() < MAX_GLOBAL_POS_OFFSET;
+ return a.mTitle == b.mTitle && (a.mGlobalPos - b.mGlobalPos).length() < MAX_GLOBAL_POS_OFFSET;
}
void LLTeleportHistoryStorage::addItem(const std::string title, const LLVector3d& global_pos, const LLDate& date)
{
- LLTeleportHistoryPersistentItem item(title, global_pos, date);
-
- slurl_list_t::iterator item_iter = std::find_if(mItems.begin(), mItems.end(),
- boost::bind(&LLTeleportHistoryStorage::compareByTitleAndGlobalPos, this, _1, item));
-
- // If there is such item already, remove it, since new item is more recent
- S32 removed_index = -1;
- if (item_iter != mItems.end())
- {
- removed_index = item_iter - mItems.begin();
- mItems.erase(item_iter);
- }
-
- mItems.push_back(item);
-
- // Check whether sorting is needed
- if (mItems.size() > 1)
- {
- item_iter = mItems.end();
-
- item_iter--;
- item_iter--;
-
- // If second to last item is more recent than last, then resort items
- if (item_iter->mDate > item.mDate)
- {
- removed_index = -1;
- std::sort(mItems.begin(), mItems.end(), LLSortItemsByDate());
- }
- }
-
- mHistoryChangedSignal(removed_index);
+ LLTeleportHistoryPersistentItem item(title, global_pos, date);
+
+ slurl_list_t::iterator item_iter = std::find_if(mItems.begin(), mItems.end(),
+ boost::bind(&LLTeleportHistoryStorage::compareByTitleAndGlobalPos, this, _1, item));
+
+ // If there is such item already, remove it, since new item is more recent
+ S32 removed_index = -1;
+ if (item_iter != mItems.end())
+ {
+ removed_index = item_iter - mItems.begin();
+ mItems.erase(item_iter);
+ }
+
+ mItems.push_back(item);
+
+ // Check whether sorting is needed
+ if (mItems.size() > 1)
+ {
+ item_iter = mItems.end();
+
+ item_iter--;
+ item_iter--;
+
+ // If second to last item is more recent than last, then resort items
+ if (item_iter->mDate > item.mDate)
+ {
+ removed_index = -1;
+ std::sort(mItems.begin(), mItems.end(), LLSortItemsByDate());
+ }
+ }
+
+ mHistoryChangedSignal(removed_index);
}
void LLTeleportHistoryStorage::removeItem(S32 idx)
{
- if (idx < 0 || idx >= (S32)mItems.size())
- return;
+ if (idx < 0 || idx >= (S32)mItems.size())
+ return;
- mItems.erase (mItems.begin() + idx);
+ mItems.erase (mItems.begin() + idx);
}
void LLTeleportHistoryStorage::save()
{
// build filename for each user
- std::string resolvedFilename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
-
- // open the history file for writing
- llofstream file(resolvedFilename.c_str());
- if (!file.is_open())
- {
- LL_WARNS() << "can't open teleport history file \"" << mFilename << "\" for writing" << LL_ENDL;
- return;
- }
-
- for (size_t i=0; i<mItems.size(); i++)
- {
- LLSD s_item = mItems[i].toLLSD();
- file << LLSDOStreamer<LLSDNotationFormatter>(s_item) << std::endl;
- }
-
- file.close();
+ std::string resolvedFilename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
+
+ // open the history file for writing
+ llofstream file(resolvedFilename.c_str());
+ if (!file.is_open())
+ {
+ LL_WARNS() << "can't open teleport history file \"" << mFilename << "\" for writing" << LL_ENDL;
+ return;
+ }
+
+ for (size_t i=0; i<mItems.size(); i++)
+ {
+ LLSD s_item = mItems[i].toLLSD();
+ file << LLSDOStreamer<LLSDNotationFormatter>(s_item) << std::endl;
+ }
+
+ file.close();
}
void LLTeleportHistoryStorage::load()
{
// build filename for each user
- std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
-
- // open the history file for reading
- llifstream file(resolved_filename.c_str());
- if (!file.is_open())
- {
- LL_WARNS() << "can't load teleport history from file \"" << mFilename << "\"" << LL_ENDL;
- return;
- }
-
- // remove current entries before we load over them
- mItems.clear();
-
- // the parser's destructor is protected so we cannot create in the stack.
- LLPointer<LLSDParser> parser = new LLSDNotationParser();
- std::string line;
- while (std::getline(file, line))
- {
- if (line.empty())
- {
- LL_WARNS() << "Teleport history contains empty line."<< LL_ENDL;
- continue;
- }
-
- LLSD s_item;
- std::istringstream iss(line);
- if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
- {
- LL_INFOS() << "Parsing saved teleport history failed" << LL_ENDL;
- break;
- }
-
- mItems.push_back(s_item);
- }
-
- file.close();
-
- std::sort(mItems.begin(), mItems.end(), LLSortItemsByDate());
-
- mHistoryChangedSignal(-1);
+ std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
+
+ // open the history file for reading
+ llifstream file(resolved_filename.c_str());
+ if (!file.is_open())
+ {
+ LL_WARNS() << "can't load teleport history from file \"" << mFilename << "\"" << LL_ENDL;
+ return;
+ }
+
+ // remove current entries before we load over them
+ mItems.clear();
+
+ // the parser's destructor is protected so we cannot create in the stack.
+ LLPointer<LLSDParser> parser = new LLSDNotationParser();
+ std::string line;
+ while (std::getline(file, line))
+ {
+ if (line.empty())
+ {
+ LL_WARNS() << "Teleport history contains empty line."<< LL_ENDL;
+ continue;
+ }
+
+ LLSD s_item;
+ std::istringstream iss(line);
+ if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
+ {
+ LL_INFOS() << "Parsing saved teleport history failed" << LL_ENDL;
+ break;
+ }
+
+ mItems.push_back(s_item);
+ }
+
+ file.close();
+
+ std::sort(mItems.begin(), mItems.end(), LLSortItemsByDate());
+
+ mHistoryChangedSignal(-1);
}
void LLTeleportHistoryStorage::dump() const
{
- LL_INFOS() << "Teleport history storage dump (" << mItems.size() << " items):" << LL_ENDL;
+ LL_INFOS() << "Teleport history storage dump (" << mItems.size() << " items):" << LL_ENDL;
- for (size_t i=0; i<mItems.size(); i++)
- {
- std::stringstream line;
- line << i << ": " << mItems[i].mTitle;
- line << " global pos: " << mItems[i].mGlobalPos;
- line << " date: " << mItems[i].mDate;
+ for (size_t i=0; i<mItems.size(); i++)
+ {
+ std::stringstream line;
+ line << i << ": " << mItems[i].mTitle;
+ line << " global pos: " << mItems[i].mGlobalPos;
+ line << " date: " << mItems[i].mDate;
- LL_INFOS() << line.str() << LL_ENDL;
- }
+ LL_INFOS() << line.str() << LL_ENDL;
+ }
}
boost::signals2::connection LLTeleportHistoryStorage::setHistoryChangedCallback(history_callback_t cb)
{
- return mHistoryChangedSignal.connect(cb);
+ return mHistoryChangedSignal.connect(cb);
}
void LLTeleportHistoryStorage::goToItem(S32 idx)
{
- // Validate specified index.
- if (idx < 0 || idx >= (S32)mItems.size())
- {
- LL_WARNS() << "Invalid teleport history index (" << idx << ") specified" << LL_ENDL;
- dump();
- return;
- }
-
- // Attempt to teleport to the requested item.
- gAgent.teleportViaLocation(mItems[idx].mGlobalPos);
+ // Validate specified index.
+ if (idx < 0 || idx >= (S32)mItems.size())
+ {
+ LL_WARNS() << "Invalid teleport history index (" << idx << ") specified" << LL_ENDL;
+ dump();
+ return;
+ }
+
+ // Attempt to teleport to the requested item.
+ gAgent.teleportViaLocation(mItems[idx].mGlobalPos);
}
void LLTeleportHistoryStorage::showItemOnMap(S32 idx)
diff --git a/indra/newview/llteleporthistorystorage.h b/indra/newview/llteleporthistorystorage.h
index 3578923fd7..643c4a6bfc 100644
--- a/indra/newview/llteleporthistorystorage.h
+++ b/indra/newview/llteleporthistorystorage.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,23 +43,23 @@ class LLSD;
class LLTeleportHistoryPersistentItem
{
public:
- LLTeleportHistoryPersistentItem()
- {}
+ LLTeleportHistoryPersistentItem()
+ {}
- LLTeleportHistoryPersistentItem(const std::string title, const LLVector3d& global_pos)
- : mTitle(title), mGlobalPos(global_pos), mDate(LLDate::now())
- {}
+ LLTeleportHistoryPersistentItem(const std::string title, const LLVector3d& global_pos)
+ : mTitle(title), mGlobalPos(global_pos), mDate(LLDate::now())
+ {}
- LLTeleportHistoryPersistentItem(const std::string title, const LLVector3d& global_pos, const LLDate& date)
- : mTitle(title), mGlobalPos(global_pos), mDate(date)
- {}
+ LLTeleportHistoryPersistentItem(const std::string title, const LLVector3d& global_pos, const LLDate& date)
+ : mTitle(title), mGlobalPos(global_pos), mDate(date)
+ {}
- LLTeleportHistoryPersistentItem(const LLSD& val);
- LLSD toLLSD() const;
+ LLTeleportHistoryPersistentItem(const LLSD& val);
+ LLSD toLLSD() const;
- std::string mTitle;
- LLVector3d mGlobalPos;
- LLDate mDate;
+ std::string mTitle;
+ LLVector3d mGlobalPos;
+ LLDate mDate;
};
/**
@@ -68,69 +68,69 @@ public:
*/
class LLTeleportHistoryStorage: public LLSingleton<LLTeleportHistoryStorage>
{
- LLSINGLETON(LLTeleportHistoryStorage);
- ~LLTeleportHistoryStorage();
- LOG_CLASS(LLTeleportHistoryStorage);
+ LLSINGLETON(LLTeleportHistoryStorage);
+ ~LLTeleportHistoryStorage();
+ LOG_CLASS(LLTeleportHistoryStorage);
public:
- typedef std::vector<LLTeleportHistoryPersistentItem> slurl_list_t;
+ typedef std::vector<LLTeleportHistoryPersistentItem> slurl_list_t;
- // removed_index is index of removed item, which replaced by more recent
- typedef boost::function<void(S32 removed_index)> history_callback_t;
- typedef boost::signals2::signal<void(S32 removed_index)> history_signal_t;
+ // removed_index is index of removed item, which replaced by more recent
+ typedef boost::function<void(S32 removed_index)> history_callback_t;
+ typedef boost::signals2::signal<void(S32 removed_index)> history_signal_t;
- /**
- * @return history items.
- */
- const slurl_list_t& getItems() const { return mItems; }
- void purgeItems();
+ /**
+ * @return history items.
+ */
+ const slurl_list_t& getItems() const { return mItems; }
+ void purgeItems();
- void addItem(const std::string title, const LLVector3d& global_pos);
- void addItem(const std::string title, const LLVector3d& global_pos, const LLDate& date);
+ void addItem(const std::string title, const LLVector3d& global_pos);
+ void addItem(const std::string title, const LLVector3d& global_pos, const LLDate& date);
- void removeItem(S32 idx);
+ void removeItem(S32 idx);
- void save();
+ void save();
- /**
- * Set a callback to be called upon history changes.
- *
- * Multiple callbacks can be set.
- */
- boost::signals2::connection setHistoryChangedCallback(history_callback_t cb);
+ /**
+ * Set a callback to be called upon history changes.
+ *
+ * Multiple callbacks can be set.
+ */
+ boost::signals2::connection setHistoryChangedCallback(history_callback_t cb);
- /**
- * Go to specific item in the history.
- *
- * The item is specified by its index (starting from 0).
- */
- void goToItem(S32 idx);
+ /**
+ * Go to specific item in the history.
+ *
+ * The item is specified by its index (starting from 0).
+ */
+ void goToItem(S32 idx);
/**
* Show specific item on map.
*
* The item is specified by its index (starting from 0).
*/
- void showItemOnMap(S32 idx);
+ void showItemOnMap(S32 idx);
private:
- void load();
- void dump() const;
-
- void onTeleportHistoryChange();
- bool compareByTitleAndGlobalPos(const LLTeleportHistoryPersistentItem& a, const LLTeleportHistoryPersistentItem& b);
-
- slurl_list_t mItems;
- std::string mFilename;
-
- /**
- * Signal emitted when the history gets changed.
- *
- * Invokes callbacks set with setHistoryChangedCallback().
- */
- history_signal_t mHistoryChangedSignal;
+ void load();
+ void dump() const;
+
+ void onTeleportHistoryChange();
+ bool compareByTitleAndGlobalPos(const LLTeleportHistoryPersistentItem& a, const LLTeleportHistoryPersistentItem& b);
+
+ slurl_list_t mItems;
+ std::string mFilename;
+
+ /**
+ * Signal emitted when the history gets changed.
+ *
+ * Invokes callbacks set with setHistoryChangedCallback().
+ */
+ history_signal_t mHistoryChangedSignal;
};
#endif //LL_LLTELEPORTHISTORYSTORAGE_H
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index a14d4f7a30..56f26c953b 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexturecache.cpp
* @brief Object which handles local texture caching
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,7 +36,7 @@
#include "llviewercontrol.h"
// Included to allow LLTextureCache::purgeTextures() to pause watchdog timeout
-#include "llappviewer.h"
+#include "llappviewer.h"
#include "llmemory.h"
// Cache organization:
@@ -59,213 +59,213 @@ const F32 TEXTURE_PRUNING_MAX_TIME = 15.f;
class LLTextureCacheWorker : public LLWorkerClass
{
- friend class LLTextureCache;
+ friend class LLTextureCache;
private:
- class ReadResponder : public LLLFSThread::Responder
- {
- public:
- ReadResponder(LLTextureCache* cache, handle_t handle) : mCache(cache), mHandle(handle) {}
- ~ReadResponder() {}
- void completed(S32 bytes)
- {
- mCache->lockWorkers();
- LLTextureCacheWorker* reader = mCache->getReader(mHandle);
- if (reader) reader->ioComplete(bytes);
- mCache->unlockWorkers();
- }
- LLTextureCache* mCache;
- LLTextureCacheWorker::handle_t mHandle;
- };
-
- class WriteResponder : public LLLFSThread::Responder
- {
- public:
- WriteResponder(LLTextureCache* cache, handle_t handle) : mCache(cache), mHandle(handle) {}
- ~WriteResponder() {}
- void completed(S32 bytes)
- {
- mCache->lockWorkers();
- LLTextureCacheWorker* writer = mCache->getWriter(mHandle);
- if (writer) writer->ioComplete(bytes);
- mCache->unlockWorkers();
- }
- LLTextureCache* mCache;
- LLTextureCacheWorker::handle_t mHandle;
- };
-
+ class ReadResponder : public LLLFSThread::Responder
+ {
+ public:
+ ReadResponder(LLTextureCache* cache, handle_t handle) : mCache(cache), mHandle(handle) {}
+ ~ReadResponder() {}
+ void completed(S32 bytes)
+ {
+ mCache->lockWorkers();
+ LLTextureCacheWorker* reader = mCache->getReader(mHandle);
+ if (reader) reader->ioComplete(bytes);
+ mCache->unlockWorkers();
+ }
+ LLTextureCache* mCache;
+ LLTextureCacheWorker::handle_t mHandle;
+ };
+
+ class WriteResponder : public LLLFSThread::Responder
+ {
+ public:
+ WriteResponder(LLTextureCache* cache, handle_t handle) : mCache(cache), mHandle(handle) {}
+ ~WriteResponder() {}
+ void completed(S32 bytes)
+ {
+ mCache->lockWorkers();
+ LLTextureCacheWorker* writer = mCache->getWriter(mHandle);
+ if (writer) writer->ioComplete(bytes);
+ mCache->unlockWorkers();
+ }
+ LLTextureCache* mCache;
+ LLTextureCacheWorker::handle_t mHandle;
+ };
+
public:
- LLTextureCacheWorker(LLTextureCache* cache, const LLUUID& id,
- U8* data, S32 datasize, S32 offset,
- S32 imagesize, // for writes
- LLTextureCache::Responder* responder)
- : LLWorkerClass(cache, "LLTextureCacheWorker"),
- mID(id),
- mCache(cache),
- mReadData(NULL),
- mWriteData(data),
- mDataSize(datasize),
- mOffset(offset),
- mImageSize(imagesize),
- mImageFormat(IMG_CODEC_J2C),
- mImageLocal(FALSE),
- mResponder(responder),
- mFileHandle(LLLFSThread::nullHandle()),
- mBytesToRead(0),
- mBytesRead(0)
- {
- }
- ~LLTextureCacheWorker()
- {
- llassert_always(!haveWork());
- ll_aligned_free_16(mReadData);
- }
-
- // override this interface
- virtual bool doRead() = 0;
- virtual bool doWrite() = 0;
-
- virtual bool doWork(S32 param); // Called from LLWorkerThread::processRequest()
-
- handle_t read() { addWork(0); return mRequestHandle; }
- handle_t write() { addWork(1); return mRequestHandle; }
- bool complete() { return checkWork(); }
- void ioComplete(S32 bytes)
- {
- mBytesRead = bytes;
- }
+ LLTextureCacheWorker(LLTextureCache* cache, const LLUUID& id,
+ U8* data, S32 datasize, S32 offset,
+ S32 imagesize, // for writes
+ LLTextureCache::Responder* responder)
+ : LLWorkerClass(cache, "LLTextureCacheWorker"),
+ mID(id),
+ mCache(cache),
+ mReadData(NULL),
+ mWriteData(data),
+ mDataSize(datasize),
+ mOffset(offset),
+ mImageSize(imagesize),
+ mImageFormat(IMG_CODEC_J2C),
+ mImageLocal(FALSE),
+ mResponder(responder),
+ mFileHandle(LLLFSThread::nullHandle()),
+ mBytesToRead(0),
+ mBytesRead(0)
+ {
+ }
+ ~LLTextureCacheWorker()
+ {
+ llassert_always(!haveWork());
+ ll_aligned_free_16(mReadData);
+ }
+
+ // override this interface
+ virtual bool doRead() = 0;
+ virtual bool doWrite() = 0;
+
+ virtual bool doWork(S32 param); // Called from LLWorkerThread::processRequest()
+
+ handle_t read() { addWork(0); return mRequestHandle; }
+ handle_t write() { addWork(1); return mRequestHandle; }
+ bool complete() { return checkWork(); }
+ void ioComplete(S32 bytes)
+ {
+ mBytesRead = bytes;
+ }
private:
- virtual void startWork(S32 param); // called from addWork() (MAIN THREAD)
- virtual void finishWork(S32 param, bool completed); // called from finishRequest() (WORK THREAD)
- virtual void endWork(S32 param, bool aborted); // called from doWork() (MAIN THREAD)
+ virtual void startWork(S32 param); // called from addWork() (MAIN THREAD)
+ virtual void finishWork(S32 param, bool completed); // called from finishRequest() (WORK THREAD)
+ virtual void endWork(S32 param, bool aborted); // called from doWork() (MAIN THREAD)
protected:
- LLTextureCache* mCache;
- LLUUID mID;
-
- U8* mReadData;
- U8* mWriteData;
- S32 mDataSize;
- S32 mOffset;
- S32 mImageSize;
- EImageCodec mImageFormat;
- BOOL mImageLocal;
- LLPointer<LLTextureCache::Responder> mResponder;
- LLLFSThread::handle_t mFileHandle;
- S32 mBytesToRead;
- LLAtomicS32 mBytesRead;
+ LLTextureCache* mCache;
+ LLUUID mID;
+
+ U8* mReadData;
+ U8* mWriteData;
+ S32 mDataSize;
+ S32 mOffset;
+ S32 mImageSize;
+ EImageCodec mImageFormat;
+ BOOL mImageLocal;
+ LLPointer<LLTextureCache::Responder> mResponder;
+ LLLFSThread::handle_t mFileHandle;
+ S32 mBytesToRead;
+ LLAtomicS32 mBytesRead;
};
class LLTextureCacheLocalFileWorker : public LLTextureCacheWorker
{
public:
- LLTextureCacheLocalFileWorker(LLTextureCache* cache, const std::string& filename, const LLUUID& id,
- U8* data, S32 datasize, S32 offset,
- S32 imagesize, // for writes
- LLTextureCache::Responder* responder)
- : LLTextureCacheWorker(cache, id, data, datasize, offset, imagesize, responder),
- mFileName(filename)
-
- {
- }
-
- virtual bool doRead();
- virtual bool doWrite();
-
+ LLTextureCacheLocalFileWorker(LLTextureCache* cache, const std::string& filename, const LLUUID& id,
+ U8* data, S32 datasize, S32 offset,
+ S32 imagesize, // for writes
+ LLTextureCache::Responder* responder)
+ : LLTextureCacheWorker(cache, id, data, datasize, offset, imagesize, responder),
+ mFileName(filename)
+
+ {
+ }
+
+ virtual bool doRead();
+ virtual bool doWrite();
+
private:
- std::string mFileName;
+ std::string mFileName;
};
bool LLTextureCacheLocalFileWorker::doRead()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- S32 local_size = LLAPRFile::size(mFileName, mCache->getLocalAPRFilePool());
-
- if (local_size > 0 && mFileName.size() > 4)
- {
- mDataSize = local_size; // Only a complete file is valid
-
- std::string extension = mFileName.substr(mFileName.size() - 3, 3);
-
- mImageFormat = LLImageBase::getCodecFromExtension(extension);
-
- if (mImageFormat == IMG_CODEC_INVALID)
- {
-// LL_WARNS() << "Unrecognized file extension " << extension << " for local texture " << mFileName << LL_ENDL;
- mDataSize = 0; // no data
- return true;
- }
- }
- else
- {
- // file doesn't exist
- mDataSize = 0; // no data
- return true;
- }
-
- if (!mDataSize || mDataSize > local_size)
- {
- mDataSize = local_size;
- }
- mReadData = (U8*)ll_aligned_malloc_16(mDataSize);
-
- S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
-
- if (bytes_read != mDataSize)
- {
-// LL_WARNS() << "Error reading file from local cache: " << mFileName
-// << " Bytes: " << mDataSize << " Offset: " << mOffset
-// << " / " << mDataSize << LL_ENDL;
- mDataSize = 0;
- ll_aligned_free_16(mReadData);
- mReadData = NULL;
- }
- else
- {
- mImageSize = local_size;
- mImageLocal = TRUE;
- }
- return true;
+ S32 local_size = LLAPRFile::size(mFileName, mCache->getLocalAPRFilePool());
+
+ if (local_size > 0 && mFileName.size() > 4)
+ {
+ mDataSize = local_size; // Only a complete file is valid
+
+ std::string extension = mFileName.substr(mFileName.size() - 3, 3);
+
+ mImageFormat = LLImageBase::getCodecFromExtension(extension);
+
+ if (mImageFormat == IMG_CODEC_INVALID)
+ {
+// LL_WARNS() << "Unrecognized file extension " << extension << " for local texture " << mFileName << LL_ENDL;
+ mDataSize = 0; // no data
+ return true;
+ }
+ }
+ else
+ {
+ // file doesn't exist
+ mDataSize = 0; // no data
+ return true;
+ }
+
+ if (!mDataSize || mDataSize > local_size)
+ {
+ mDataSize = local_size;
+ }
+ mReadData = (U8*)ll_aligned_malloc_16(mDataSize);
+
+ S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
+
+ if (bytes_read != mDataSize)
+ {
+// LL_WARNS() << "Error reading file from local cache: " << mFileName
+// << " Bytes: " << mDataSize << " Offset: " << mOffset
+// << " / " << mDataSize << LL_ENDL;
+ mDataSize = 0;
+ ll_aligned_free_16(mReadData);
+ mReadData = NULL;
+ }
+ else
+ {
+ mImageSize = local_size;
+ mImageLocal = TRUE;
+ }
+ return true;
}
bool LLTextureCacheLocalFileWorker::doWrite()
{
- // no writes for local files
- return false;
+ // no writes for local files
+ return false;
}
class LLTextureCacheRemoteWorker : public LLTextureCacheWorker
{
public:
- LLTextureCacheRemoteWorker(LLTextureCache* cache, const LLUUID& id,
- U8* data, S32 datasize, S32 offset,
- S32 imagesize, // for writes
- LLPointer<LLImageRaw> raw, S32 discardlevel,
- LLTextureCache::Responder* responder)
- : LLTextureCacheWorker(cache, id, data, datasize, offset, imagesize, responder),
- mState(INIT),
- mRawImage(raw),
- mRawDiscardLevel(discardlevel)
- {
- }
-
- virtual bool doRead();
- virtual bool doWrite();
+ LLTextureCacheRemoteWorker(LLTextureCache* cache, const LLUUID& id,
+ U8* data, S32 datasize, S32 offset,
+ S32 imagesize, // for writes
+ LLPointer<LLImageRaw> raw, S32 discardlevel,
+ LLTextureCache::Responder* responder)
+ : LLTextureCacheWorker(cache, id, data, datasize, offset, imagesize, responder),
+ mState(INIT),
+ mRawImage(raw),
+ mRawDiscardLevel(discardlevel)
+ {
+ }
+
+ virtual bool doRead();
+ virtual bool doWrite();
private:
- enum e_state
- {
- INIT = 0,
- LOCAL = 1,
- CACHE = 2,
- HEADER = 3,
- BODY = 4
- };
-
- e_state mState;
- LLPointer<LLImageRaw> mRawImage;
- S32 mRawDiscardLevel;
+ enum e_state
+ {
+ INIT = 0,
+ LOCAL = 1,
+ CACHE = 2,
+ HEADER = 3,
+ BODY = 4
+ };
+
+ e_state mState;
+ LLPointer<LLImageRaw> mRawImage;
+ S32 mRawDiscardLevel;
};
@@ -282,248 +282,248 @@ void LLTextureCacheWorker::startWork(S32 param)
bool LLTextureCacheRemoteWorker::doRead()
{
LL_PROFILE_ZONE_SCOPED;
- bool done = false;
- S32 idx = -1;
-
- S32 local_size = 0;
- std::string local_filename;
-
- // First state / stage : find out if the file is local
- if (mState == INIT)
- {
+ bool done = false;
+ S32 idx = -1;
+
+ S32 local_size = 0;
+ std::string local_filename;
+
+ // First state / stage : find out if the file is local
+ if (mState == INIT)
+ {
#if 0
- std::string filename = mCache->getLocalFileName(mID);
- // Is it a JPEG2000 file?
- {
- local_filename = filename + ".j2c";
- local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
- if (local_size > 0)
- {
- mImageFormat = IMG_CODEC_J2C;
- }
- }
- // If not, is it a jpeg file?
- if (local_size == 0)
- {
- local_filename = filename + ".jpg";
- local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
- if (local_size > 0)
- {
- mImageFormat = IMG_CODEC_JPEG;
- mDataSize = local_size; // Only a complete .jpg file is valid
- }
- }
- // Hmm... What about a targa file? (used for UI texture mostly)
- if (local_size == 0)
- {
- local_filename = filename + ".tga";
- local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
- if (local_size > 0)
- {
- mImageFormat = IMG_CODEC_TGA;
- mDataSize = local_size; // Only a complete .tga file is valid
- }
- }
- // Determine the next stage: if we found a file, then LOCAL else CACHE
- mState = (local_size > 0 ? LOCAL : CACHE);
-
- llassert_always(mState == CACHE) ;
+ std::string filename = mCache->getLocalFileName(mID);
+ // Is it a JPEG2000 file?
+ {
+ local_filename = filename + ".j2c";
+ local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+ if (local_size > 0)
+ {
+ mImageFormat = IMG_CODEC_J2C;
+ }
+ }
+ // If not, is it a jpeg file?
+ if (local_size == 0)
+ {
+ local_filename = filename + ".jpg";
+ local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+ if (local_size > 0)
+ {
+ mImageFormat = IMG_CODEC_JPEG;
+ mDataSize = local_size; // Only a complete .jpg file is valid
+ }
+ }
+ // Hmm... What about a targa file? (used for UI texture mostly)
+ if (local_size == 0)
+ {
+ local_filename = filename + ".tga";
+ local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+ if (local_size > 0)
+ {
+ mImageFormat = IMG_CODEC_TGA;
+ mDataSize = local_size; // Only a complete .tga file is valid
+ }
+ }
+ // Determine the next stage: if we found a file, then LOCAL else CACHE
+ mState = (local_size > 0 ? LOCAL : CACHE);
+
+ llassert_always(mState == CACHE) ;
#else
- mState = CACHE;
+ mState = CACHE;
#endif
- }
-
- // Second state / stage : if the file is local, load it and leave
- if (!done && (mState == LOCAL))
- {
- llassert(local_size != 0); // we're assuming there is a non empty local file here...
- if (!mDataSize || mDataSize > local_size)
- {
- mDataSize = local_size;
- }
- // Allocate read buffer
- mReadData = (U8*)ll_aligned_malloc_16(mDataSize);
-
- if (mReadData)
- {
- S32 bytes_read = LLAPRFile::readEx( local_filename,
- mReadData,
- mOffset,
- mDataSize,
- mCache->getLocalAPRFilePool());
-
- if (bytes_read != mDataSize)
- {
- LL_WARNS() << "Error reading file from local cache: " << local_filename
- << " Bytes: " << mDataSize << " Offset: " << mOffset
- << " / " << mDataSize << LL_ENDL;
- mDataSize = 0;
- ll_aligned_free_16(mReadData);
- mReadData = NULL;
- }
- else
- {
- mImageSize = local_size;
- mImageLocal = TRUE;
- }
- }
- else
- {
- LL_WARNS() << "Error allocating memory for cache: " << local_filename
- << " of size: " << mDataSize << LL_ENDL;
- mDataSize = 0;
- }
- // We're done...
- done = true;
- }
-
- // Second state / stage : identify the cache or not...
- if (!done && (mState == CACHE))
- {
- LLTextureCache::Entry entry ;
- idx = mCache->getHeaderCacheEntry(mID, entry);
- if (idx < 0)
- {
- // The texture is *not* cached. We're done here...
- mDataSize = 0; // no data
- done = true;
- }
- else
- {
- mImageSize = entry.mImageSize ;
- // If the read offset is bigger than the header cache, we read directly from the body
- // Note that currently, we *never* read with offset from the cache, so the result is *always* HEADER
- mState = mOffset < TEXTURE_CACHE_ENTRY_SIZE ? HEADER : BODY;
- }
- }
-
- // Third state / stage : read data from the header cache (texture.entries) file
- if (!done && (mState == HEADER))
- {
- llassert_always(idx >= 0); // we need an entry here or reading the header makes no sense
- llassert_always(mOffset < TEXTURE_CACHE_ENTRY_SIZE);
- S32 offset = idx * TEXTURE_CACHE_ENTRY_SIZE + mOffset;
- // Compute the size we need to read (in bytes)
- S32 size = TEXTURE_CACHE_ENTRY_SIZE - mOffset;
- size = llmin(size, mDataSize);
- // Allocate the read buffer
- mReadData = (U8*)ll_aligned_malloc_16(size);
- if (mReadData)
- {
- S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName,
- mReadData, offset, size, mCache->getLocalAPRFilePool());
- if (bytes_read != size)
- {
- LL_WARNS() << "LLTextureCacheWorker: " << mID
- << " incorrect number of bytes read from header: " << bytes_read
- << " / " << size << LL_ENDL;
- ll_aligned_free_16(mReadData);
- mReadData = NULL;
- mDataSize = -1; // failed
- done = true;
- }
- // If we already read all we expected, we're actually done
- if (mDataSize <= bytes_read)
- {
- done = true;
- }
- else
- {
- mState = BODY;
- }
- }
- else
- {
- LL_WARNS() << "LLTextureCacheWorker: " << mID
- << " failed to allocate memory for reading: " << mDataSize << LL_ENDL;
- mReadData = NULL;
- mDataSize = -1; // failed
- done = true;
- }
- }
-
- // Fourth state / stage : read the rest of the data from the UUID based cached file
- if (!done && (mState == BODY))
- {
- std::string filename = mCache->getTextureFileName(mID);
- S32 filesize = LLAPRFile::size(filename, mCache->getLocalAPRFilePool());
-
- if (filesize && (filesize + TEXTURE_CACHE_ENTRY_SIZE) > mOffset)
- {
- S32 max_datasize = TEXTURE_CACHE_ENTRY_SIZE + filesize - mOffset;
- mDataSize = llmin(max_datasize, mDataSize);
-
- S32 data_offset, file_size, file_offset;
-
- // Reserve the whole data buffer first
- U8* data = (U8*)ll_aligned_malloc_16(mDataSize);
- if (data)
- {
- // Set the data file pointers taking the read offset into account. 2 cases:
- if (mOffset < TEXTURE_CACHE_ENTRY_SIZE)
- {
- // Offset within the header record. That means we read something from the header cache.
- // Note: most common case is (mOffset = 0), so this is the "normal" code path.
- data_offset = TEXTURE_CACHE_ENTRY_SIZE - mOffset; // i.e. TEXTURE_CACHE_ENTRY_SIZE if mOffset nul (common case)
- file_offset = 0;
- file_size = mDataSize - data_offset;
- // Copy the raw data we've been holding from the header cache into the new sized buffer
- llassert_always(mReadData);
- memcpy(data, mReadData, data_offset);
- ll_aligned_free_16(mReadData);
- mReadData = NULL;
- }
- else
- {
- // Offset bigger than the header record. That means we haven't read anything yet.
- data_offset = 0;
- file_offset = mOffset - TEXTURE_CACHE_ENTRY_SIZE;
- file_size = mDataSize;
- // No data from header cache to copy in that case, we skipped it all
- }
-
- // Now use that buffer as the object read buffer
- llassert_always(mReadData == NULL);
- mReadData = data;
-
- // Read the data at last
- S32 bytes_read = LLAPRFile::readEx(filename,
- mReadData + data_offset,
- file_offset, file_size,
- mCache->getLocalAPRFilePool());
- if (bytes_read != file_size)
- {
- LL_WARNS() << "LLTextureCacheWorker: " << mID
- << " incorrect number of bytes read from body: " << bytes_read
- << " / " << file_size << LL_ENDL;
- ll_aligned_free_16(mReadData);
- mReadData = NULL;
- mDataSize = -1; // failed
- done = true;
- }
- }
- else
- {
- LL_WARNS() << "LLTextureCacheWorker: " << mID
- << " failed to allocate memory for reading: " << mDataSize << LL_ENDL;
- ll_aligned_free_16(mReadData);
- mReadData = NULL;
- mDataSize = -1; // failed
- done = true;
- }
- }
- else
- {
- // No body, we're done.
- mDataSize = llmax(TEXTURE_CACHE_ENTRY_SIZE - mOffset, 0);
- LL_DEBUGS() << "No body file for: " << filename << LL_ENDL;
- }
- // Nothing else to do at that point...
- done = true;
- }
-
- // Clean up and exit
- return done;
+ }
+
+ // Second state / stage : if the file is local, load it and leave
+ if (!done && (mState == LOCAL))
+ {
+ llassert(local_size != 0); // we're assuming there is a non empty local file here...
+ if (!mDataSize || mDataSize > local_size)
+ {
+ mDataSize = local_size;
+ }
+ // Allocate read buffer
+ mReadData = (U8*)ll_aligned_malloc_16(mDataSize);
+
+ if (mReadData)
+ {
+ S32 bytes_read = LLAPRFile::readEx( local_filename,
+ mReadData,
+ mOffset,
+ mDataSize,
+ mCache->getLocalAPRFilePool());
+
+ if (bytes_read != mDataSize)
+ {
+ LL_WARNS() << "Error reading file from local cache: " << local_filename
+ << " Bytes: " << mDataSize << " Offset: " << mOffset
+ << " / " << mDataSize << LL_ENDL;
+ mDataSize = 0;
+ ll_aligned_free_16(mReadData);
+ mReadData = NULL;
+ }
+ else
+ {
+ mImageSize = local_size;
+ mImageLocal = TRUE;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Error allocating memory for cache: " << local_filename
+ << " of size: " << mDataSize << LL_ENDL;
+ mDataSize = 0;
+ }
+ // We're done...
+ done = true;
+ }
+
+ // Second state / stage : identify the cache or not...
+ if (!done && (mState == CACHE))
+ {
+ LLTextureCache::Entry entry ;
+ idx = mCache->getHeaderCacheEntry(mID, entry);
+ if (idx < 0)
+ {
+ // The texture is *not* cached. We're done here...
+ mDataSize = 0; // no data
+ done = true;
+ }
+ else
+ {
+ mImageSize = entry.mImageSize ;
+ // If the read offset is bigger than the header cache, we read directly from the body
+ // Note that currently, we *never* read with offset from the cache, so the result is *always* HEADER
+ mState = mOffset < TEXTURE_CACHE_ENTRY_SIZE ? HEADER : BODY;
+ }
+ }
+
+ // Third state / stage : read data from the header cache (texture.entries) file
+ if (!done && (mState == HEADER))
+ {
+ llassert_always(idx >= 0); // we need an entry here or reading the header makes no sense
+ llassert_always(mOffset < TEXTURE_CACHE_ENTRY_SIZE);
+ S32 offset = idx * TEXTURE_CACHE_ENTRY_SIZE + mOffset;
+ // Compute the size we need to read (in bytes)
+ S32 size = TEXTURE_CACHE_ENTRY_SIZE - mOffset;
+ size = llmin(size, mDataSize);
+ // Allocate the read buffer
+ mReadData = (U8*)ll_aligned_malloc_16(size);
+ if (mReadData)
+ {
+ S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName,
+ mReadData, offset, size, mCache->getLocalAPRFilePool());
+ if (bytes_read != size)
+ {
+ LL_WARNS() << "LLTextureCacheWorker: " << mID
+ << " incorrect number of bytes read from header: " << bytes_read
+ << " / " << size << LL_ENDL;
+ ll_aligned_free_16(mReadData);
+ mReadData = NULL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ // If we already read all we expected, we're actually done
+ if (mDataSize <= bytes_read)
+ {
+ done = true;
+ }
+ else
+ {
+ mState = BODY;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "LLTextureCacheWorker: " << mID
+ << " failed to allocate memory for reading: " << mDataSize << LL_ENDL;
+ mReadData = NULL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ }
+
+ // Fourth state / stage : read the rest of the data from the UUID based cached file
+ if (!done && (mState == BODY))
+ {
+ std::string filename = mCache->getTextureFileName(mID);
+ S32 filesize = LLAPRFile::size(filename, mCache->getLocalAPRFilePool());
+
+ if (filesize && (filesize + TEXTURE_CACHE_ENTRY_SIZE) > mOffset)
+ {
+ S32 max_datasize = TEXTURE_CACHE_ENTRY_SIZE + filesize - mOffset;
+ mDataSize = llmin(max_datasize, mDataSize);
+
+ S32 data_offset, file_size, file_offset;
+
+ // Reserve the whole data buffer first
+ U8* data = (U8*)ll_aligned_malloc_16(mDataSize);
+ if (data)
+ {
+ // Set the data file pointers taking the read offset into account. 2 cases:
+ if (mOffset < TEXTURE_CACHE_ENTRY_SIZE)
+ {
+ // Offset within the header record. That means we read something from the header cache.
+ // Note: most common case is (mOffset = 0), so this is the "normal" code path.
+ data_offset = TEXTURE_CACHE_ENTRY_SIZE - mOffset; // i.e. TEXTURE_CACHE_ENTRY_SIZE if mOffset nul (common case)
+ file_offset = 0;
+ file_size = mDataSize - data_offset;
+ // Copy the raw data we've been holding from the header cache into the new sized buffer
+ llassert_always(mReadData);
+ memcpy(data, mReadData, data_offset);
+ ll_aligned_free_16(mReadData);
+ mReadData = NULL;
+ }
+ else
+ {
+ // Offset bigger than the header record. That means we haven't read anything yet.
+ data_offset = 0;
+ file_offset = mOffset - TEXTURE_CACHE_ENTRY_SIZE;
+ file_size = mDataSize;
+ // No data from header cache to copy in that case, we skipped it all
+ }
+
+ // Now use that buffer as the object read buffer
+ llassert_always(mReadData == NULL);
+ mReadData = data;
+
+ // Read the data at last
+ S32 bytes_read = LLAPRFile::readEx(filename,
+ mReadData + data_offset,
+ file_offset, file_size,
+ mCache->getLocalAPRFilePool());
+ if (bytes_read != file_size)
+ {
+ LL_WARNS() << "LLTextureCacheWorker: " << mID
+ << " incorrect number of bytes read from body: " << bytes_read
+ << " / " << file_size << LL_ENDL;
+ ll_aligned_free_16(mReadData);
+ mReadData = NULL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "LLTextureCacheWorker: " << mID
+ << " failed to allocate memory for reading: " << mDataSize << LL_ENDL;
+ ll_aligned_free_16(mReadData);
+ mReadData = NULL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ }
+ else
+ {
+ // No body, we're done.
+ mDataSize = llmax(TEXTURE_CACHE_ENTRY_SIZE - mOffset, 0);
+ LL_DEBUGS() << "No body file for: " << filename << LL_ENDL;
+ }
+ // Nothing else to do at that point...
+ done = true;
+ }
+
+ // Clean up and exit
+ return done;
}
// This is where *everything* about a texture is written down in the cache system (entry map, header and body)
@@ -534,286 +534,286 @@ bool LLTextureCacheRemoteWorker::doRead()
bool LLTextureCacheRemoteWorker::doWrite()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- bool done = false;
- S32 idx = -1;
-
- // First state / stage : check that what we're trying to cache is in an OK shape
- if (mState == INIT)
- {
- if ((mOffset != 0) // We currently do not support write offsets
- || (mDataSize <= 0) // Things will go badly wrong if mDataSize is nul or negative...
- || (mImageSize < mDataSize)
- || (mRawDiscardLevel < 0)
- || (mRawImage->isBufferInvalid())) // decode failed or malfunctioned, don't write
- {
- LL_WARNS() << "INIT state check failed for image: " << mID << " Size: " << mImageSize << " DataSize: " << mDataSize << " Discard:" << mRawDiscardLevel << LL_ENDL;
- mDataSize = -1; // failed
- done = true;
- }
- else
- {
- mState = CACHE;
- }
- }
-
- // No LOCAL state for write(): because it doesn't make much sense to cache a local file...
-
- // Second state / stage : set an entry in the headers entry (texture.entries) file
- if (!done && (mState == CACHE))
- {
- bool alreadyCached = false;
- LLTextureCache::Entry entry;
-
- // Checks if this image is already in the entry list
- idx = mCache->getHeaderCacheEntry(mID, entry);
- if(idx < 0)
- {
- idx = mCache->setHeaderCacheEntry(mID, entry, mImageSize, mDataSize); // create the new entry.
- if(idx >= 0)
- {
- // write to the fast cache.
+ bool done = false;
+ S32 idx = -1;
+
+ // First state / stage : check that what we're trying to cache is in an OK shape
+ if (mState == INIT)
+ {
+ if ((mOffset != 0) // We currently do not support write offsets
+ || (mDataSize <= 0) // Things will go badly wrong if mDataSize is nul or negative...
+ || (mImageSize < mDataSize)
+ || (mRawDiscardLevel < 0)
+ || (mRawImage->isBufferInvalid())) // decode failed or malfunctioned, don't write
+ {
+ LL_WARNS() << "INIT state check failed for image: " << mID << " Size: " << mImageSize << " DataSize: " << mDataSize << " Discard:" << mRawDiscardLevel << LL_ENDL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ else
+ {
+ mState = CACHE;
+ }
+ }
+
+ // No LOCAL state for write(): because it doesn't make much sense to cache a local file...
+
+ // Second state / stage : set an entry in the headers entry (texture.entries) file
+ if (!done && (mState == CACHE))
+ {
+ bool alreadyCached = false;
+ LLTextureCache::Entry entry;
+
+ // Checks if this image is already in the entry list
+ idx = mCache->getHeaderCacheEntry(mID, entry);
+ if(idx < 0)
+ {
+ idx = mCache->setHeaderCacheEntry(mID, entry, mImageSize, mDataSize); // create the new entry.
+ if(idx >= 0)
+ {
+ // write to the fast cache.
// mRawImage is not entirely safe here since it is a pointer to one owned by cache worker,
// it could have been retrieved via getRequestFinished() and then modified.
// If writeToFastCache crashes, something is wrong around fetch worker.
- if(!mCache->writeToFastCache(mID, idx, mRawImage, mRawDiscardLevel))
- {
- LL_WARNS() << "writeToFastCache failed" << LL_ENDL;
- mDataSize = -1; // failed
- done = true;
- }
- }
- }
- else
- {
- alreadyCached = mCache->updateEntry(idx, entry, mImageSize, mDataSize); // update the existing entry.
- }
-
- if (!done)
- {
- if (idx < 0)
- {
- LL_WARNS() << "LLTextureCacheWorker: " << mID
- << " Unable to create header entry for writing!" << LL_ENDL;
- mDataSize = -1; // failed
- done = true;
- }
- else
- {
- if (alreadyCached && (mDataSize <= TEXTURE_CACHE_ENTRY_SIZE))
- {
- // Small texture already cached case: we're done with writing
- done = true;
- }
- else
- {
- // If the texture has already been cached, we don't resave the header and go directly to the body part
- mState = alreadyCached ? BODY : HEADER;
- }
- }
- }
- }
-
-
- // Third stage / state : write the header record in the header file (texture.cache)
- if (!done && (mState == HEADER))
- {
- if (idx < 0) // we need an entry here or storing the header makes no sense
- {
- LL_WARNS() << "index check failed" << LL_ENDL;
- mDataSize = -1; // failed
- done = true;
- }
- else
- {
- S32 offset = idx * TEXTURE_CACHE_ENTRY_SIZE; // skip to the correct spot in the header file
- S32 size = TEXTURE_CACHE_ENTRY_SIZE; // record size is fixed for the header
- S32 bytes_written;
-
- if (mDataSize < TEXTURE_CACHE_ENTRY_SIZE)
- {
- // We need to write a full record in the header cache so, if the amount of data is smaller
- // than a record, we need to transfer the data to a buffer padded with 0 and write that
- U8* padBuffer = (U8*)ll_aligned_malloc_16(TEXTURE_CACHE_ENTRY_SIZE);
- memset(padBuffer, 0, TEXTURE_CACHE_ENTRY_SIZE); // Init with zeros
- memcpy(padBuffer, mWriteData, mDataSize); // Copy the write buffer
- bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size, mCache->getLocalAPRFilePool());
- ll_aligned_free_16(padBuffer);
- }
- else
- {
- // Write the header record (== first TEXTURE_CACHE_ENTRY_SIZE bytes of the raw file) in the header file
- bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size, mCache->getLocalAPRFilePool());
- }
-
- if (bytes_written <= 0)
- {
- LL_WARNS() << "LLTextureCacheWorker: " << mID
- << " Unable to write header entry!" << LL_ENDL;
- mDataSize = -1; // failed
- done = true;
- }
-
- // If we wrote everything (may be more with padding) in the header cache,
- // we're done so we don't have a body to store
- if (mDataSize <= bytes_written)
- {
- done = true;
- }
- else
- {
- mState = BODY;
- }
- }
- }
-
- // Fourth stage / state : write the body file, i.e. the rest of the texture in a "UUID" file name
- if (!done && (mState == BODY))
- {
- if (mDataSize <= TEXTURE_CACHE_ENTRY_SIZE) // wouldn't make sense to be here otherwise...
- {
- LL_WARNS() << "mDataSize check failed" << LL_ENDL;
- mDataSize = -1; // failed
- done = true;
- }
- else
- {
- S32 file_size = mDataSize - TEXTURE_CACHE_ENTRY_SIZE;
-
- {
- // build the cache file name from the UUID
- std::string filename = mCache->getTextureFileName(mID);
- // LL_INFOS() << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << LL_ENDL;
- S32 bytes_written = LLAPRFile::writeEx(filename,
- mWriteData + TEXTURE_CACHE_ENTRY_SIZE,
- 0, file_size,
- mCache->getLocalAPRFilePool());
- if (bytes_written <= 0)
- {
- LL_WARNS() << "LLTextureCacheWorker: " << mID
- << " incorrect number of bytes written to body: " << bytes_written
- << " / " << file_size << LL_ENDL;
- mDataSize = -1; // failed
- done = true;
- }
- }
-
- // Nothing else to do at that point...
- done = true;
- }
- }
- mRawImage = NULL;
-
- // Clean up and exit
- return done;
+ if(!mCache->writeToFastCache(mID, idx, mRawImage, mRawDiscardLevel))
+ {
+ LL_WARNS() << "writeToFastCache failed" << LL_ENDL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ }
+ }
+ else
+ {
+ alreadyCached = mCache->updateEntry(idx, entry, mImageSize, mDataSize); // update the existing entry.
+ }
+
+ if (!done)
+ {
+ if (idx < 0)
+ {
+ LL_WARNS() << "LLTextureCacheWorker: " << mID
+ << " Unable to create header entry for writing!" << LL_ENDL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ else
+ {
+ if (alreadyCached && (mDataSize <= TEXTURE_CACHE_ENTRY_SIZE))
+ {
+ // Small texture already cached case: we're done with writing
+ done = true;
+ }
+ else
+ {
+ // If the texture has already been cached, we don't resave the header and go directly to the body part
+ mState = alreadyCached ? BODY : HEADER;
+ }
+ }
+ }
+ }
+
+
+ // Third stage / state : write the header record in the header file (texture.cache)
+ if (!done && (mState == HEADER))
+ {
+ if (idx < 0) // we need an entry here or storing the header makes no sense
+ {
+ LL_WARNS() << "index check failed" << LL_ENDL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ else
+ {
+ S32 offset = idx * TEXTURE_CACHE_ENTRY_SIZE; // skip to the correct spot in the header file
+ S32 size = TEXTURE_CACHE_ENTRY_SIZE; // record size is fixed for the header
+ S32 bytes_written;
+
+ if (mDataSize < TEXTURE_CACHE_ENTRY_SIZE)
+ {
+ // We need to write a full record in the header cache so, if the amount of data is smaller
+ // than a record, we need to transfer the data to a buffer padded with 0 and write that
+ U8* padBuffer = (U8*)ll_aligned_malloc_16(TEXTURE_CACHE_ENTRY_SIZE);
+ memset(padBuffer, 0, TEXTURE_CACHE_ENTRY_SIZE); // Init with zeros
+ memcpy(padBuffer, mWriteData, mDataSize); // Copy the write buffer
+ bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size, mCache->getLocalAPRFilePool());
+ ll_aligned_free_16(padBuffer);
+ }
+ else
+ {
+ // Write the header record (== first TEXTURE_CACHE_ENTRY_SIZE bytes of the raw file) in the header file
+ bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size, mCache->getLocalAPRFilePool());
+ }
+
+ if (bytes_written <= 0)
+ {
+ LL_WARNS() << "LLTextureCacheWorker: " << mID
+ << " Unable to write header entry!" << LL_ENDL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+
+ // If we wrote everything (may be more with padding) in the header cache,
+ // we're done so we don't have a body to store
+ if (mDataSize <= bytes_written)
+ {
+ done = true;
+ }
+ else
+ {
+ mState = BODY;
+ }
+ }
+ }
+
+ // Fourth stage / state : write the body file, i.e. the rest of the texture in a "UUID" file name
+ if (!done && (mState == BODY))
+ {
+ if (mDataSize <= TEXTURE_CACHE_ENTRY_SIZE) // wouldn't make sense to be here otherwise...
+ {
+ LL_WARNS() << "mDataSize check failed" << LL_ENDL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ else
+ {
+ S32 file_size = mDataSize - TEXTURE_CACHE_ENTRY_SIZE;
+
+ {
+ // build the cache file name from the UUID
+ std::string filename = mCache->getTextureFileName(mID);
+ // LL_INFOS() << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << LL_ENDL;
+ S32 bytes_written = LLAPRFile::writeEx(filename,
+ mWriteData + TEXTURE_CACHE_ENTRY_SIZE,
+ 0, file_size,
+ mCache->getLocalAPRFilePool());
+ if (bytes_written <= 0)
+ {
+ LL_WARNS() << "LLTextureCacheWorker: " << mID
+ << " incorrect number of bytes written to body: " << bytes_written
+ << " / " << file_size << LL_ENDL;
+ mDataSize = -1; // failed
+ done = true;
+ }
+ }
+
+ // Nothing else to do at that point...
+ done = true;
+ }
+ }
+ mRawImage = NULL;
+
+ // Clean up and exit
+ return done;
}
//virtual
bool LLTextureCacheWorker::doWork(S32 param)
{
LL_PROFILE_ZONE_SCOPED;
- bool res = false;
- if (param == 0) // read
- {
- res = doRead();
- }
- else if (param == 1) // write
- {
- res = doWrite();
- }
- else
- {
- llassert_always(0);
- }
- return res;
+ bool res = false;
+ if (param == 0) // read
+ {
+ res = doRead();
+ }
+ else if (param == 1) // write
+ {
+ res = doWrite();
+ }
+ else
+ {
+ llassert_always(0);
+ }
+ return res;
}
//virtual (WORKER THREAD)
void LLTextureCacheWorker::finishWork(S32 param, bool completed)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (mResponder.notNull())
- {
- bool success = (completed && mDataSize > 0);
- if (param == 0)
- {
+ if (mResponder.notNull())
+ {
+ bool success = (completed && mDataSize > 0);
+ if (param == 0)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("tcwfw - read");
- // read
- if (success)
- {
- mResponder->setData(mReadData, mDataSize, mImageSize, mImageFormat, mImageLocal);
- mReadData = NULL; // responder owns data
- mDataSize = 0;
- }
- else
- {
+ // read
+ if (success)
+ {
+ mResponder->setData(mReadData, mDataSize, mImageSize, mImageFormat, mImageLocal);
+ mReadData = NULL; // responder owns data
+ mDataSize = 0;
+ }
+ else
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("tcwfw - read fail");
- ll_aligned_free_16(mReadData);
- mReadData = NULL;
- }
- }
- else
- {
+ ll_aligned_free_16(mReadData);
+ mReadData = NULL;
+ }
+ }
+ else
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("tcwfw - write");
- // write
- mWriteData = NULL; // we never owned data
- mDataSize = 0;
- }
- mCache->addCompleted(mResponder, success);
- }
+ // write
+ mWriteData = NULL; // we never owned data
+ mDataSize = 0;
+ }
+ mCache->addCompleted(mResponder, success);
+ }
}
//virtual (MAIN THREAD)
void LLTextureCacheWorker::endWork(S32 param, bool aborted)
{
LL_PROFILE_ZONE_SCOPED;
- if (aborted)
- {
- // Let the destructor handle any cleanup
- return;
- }
- switch(param)
- {
- default:
- case 0: // read
- case 1: // write
- {
- if (mDataSize < 0)
- {
- // failed
- mCache->removeFromCache(mID);
- }
- break;
- }
- }
+ if (aborted)
+ {
+ // Let the destructor handle any cleanup
+ return;
+ }
+ switch(param)
+ {
+ default:
+ case 0: // read
+ case 1: // write
+ {
+ if (mDataSize < 0)
+ {
+ // failed
+ mCache->removeFromCache(mID);
+ }
+ break;
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////
LLTextureCache::LLTextureCache(bool threaded)
- : LLWorkerThread("TextureCache", threaded),
- mWorkersMutex(),
- mHeaderMutex(),
- mListMutex(),
- mFastCacheMutex(),
- mHeaderAPRFile(NULL),
- mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called.
- mTexturesSizeTotal(0),
- mDoPurge(FALSE),
- mFastCachep(NULL),
- mFastCachePoolp(NULL),
- mFastCachePadBuffer(NULL)
+ : LLWorkerThread("TextureCache", threaded),
+ mWorkersMutex(),
+ mHeaderMutex(),
+ mListMutex(),
+ mFastCacheMutex(),
+ mHeaderAPRFile(NULL),
+ mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called.
+ mTexturesSizeTotal(0),
+ mDoPurge(FALSE),
+ mFastCachep(NULL),
+ mFastCachePoolp(NULL),
+ mFastCachePadBuffer(NULL)
{
mHeaderAPRFilePoolp = new LLVolatileAPRPool(); // is_local = true, because this pool is for headers, headers are under own mutex
}
LLTextureCache::~LLTextureCache()
{
- clearDeleteList() ;
- writeUpdatedEntries() ;
- delete mFastCachep;
- delete mFastCachePoolp;
- delete mHeaderAPRFilePoolp;
- ll_aligned_free_16(mFastCachePadBuffer);
+ clearDeleteList() ;
+ writeUpdatedEntries() ;
+ delete mFastCachep;
+ delete mFastCachePoolp;
+ delete mHeaderAPRFilePoolp;
+ ll_aligned_free_16(mFastCachePadBuffer);
}
//////////////////////////////////////////////////////////////////////////////
@@ -822,103 +822,103 @@ LLTextureCache::~LLTextureCache()
size_t LLTextureCache::update(F32 max_time_ms)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- static LLFrameTimer timer ;
- static const F32 MAX_TIME_INTERVAL = 300.f ; //seconds.
-
- size_t res;
- res = LLWorkerThread::update(max_time_ms);
-
- mListMutex.lock();
- handle_list_t priorty_list = mPrioritizeWriteList; // copy list
- mPrioritizeWriteList.clear();
- responder_list_t completed_list = mCompletedList; // copy list
- mCompletedList.clear();
- mListMutex.unlock();
-
- // call 'completed' with workers list unlocked (may call readComplete() or writeComplete()
- for (responder_list_t::iterator iter1 = completed_list.begin();
- iter1 != completed_list.end(); ++iter1)
- {
- Responder *responder = iter1->first;
- bool success = iter1->second;
- responder->completed(success);
- }
-
- if(!res && timer.getElapsedTimeF32() > MAX_TIME_INTERVAL)
- {
- timer.reset() ;
- writeUpdatedEntries() ;
- }
-
- return res;
+ static LLFrameTimer timer ;
+ static const F32 MAX_TIME_INTERVAL = 300.f ; //seconds.
+
+ size_t res;
+ res = LLWorkerThread::update(max_time_ms);
+
+ mListMutex.lock();
+ handle_list_t priorty_list = mPrioritizeWriteList; // copy list
+ mPrioritizeWriteList.clear();
+ responder_list_t completed_list = mCompletedList; // copy list
+ mCompletedList.clear();
+ mListMutex.unlock();
+
+ // call 'completed' with workers list unlocked (may call readComplete() or writeComplete()
+ for (responder_list_t::iterator iter1 = completed_list.begin();
+ iter1 != completed_list.end(); ++iter1)
+ {
+ Responder *responder = iter1->first;
+ bool success = iter1->second;
+ responder->completed(success);
+ }
+
+ if(!res && timer.getElapsedTimeF32() > MAX_TIME_INTERVAL)
+ {
+ timer.reset() ;
+ writeUpdatedEntries() ;
+ }
+
+ return res;
}
//////////////////////////////////////////////////////////////////////////////
// search for local copy of UUID-based image file
std::string LLTextureCache::getLocalFileName(const LLUUID& id)
{
- // Does not include extension
- std::string idstr = id.asString();
- // TODO: should we be storing cached textures in skin directory?
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_LOCAL_ASSETS, idstr);
- return filename;
+ // Does not include extension
+ std::string idstr = id.asString();
+ // TODO: should we be storing cached textures in skin directory?
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_LOCAL_ASSETS, idstr);
+ return filename;
}
std::string LLTextureCache::getTextureFileName(const LLUUID& id)
{
- std::string idstr = id.asString();
- std::string delem = gDirUtilp->getDirDelimiter();
- std::string filename = mTexturesDirName + delem + idstr[0] + delem + idstr + ".texture";
- return filename;
+ std::string idstr = id.asString();
+ std::string delem = gDirUtilp->getDirDelimiter();
+ std::string filename = mTexturesDirName + delem + idstr[0] + delem + idstr + ".texture";
+ return filename;
}
//debug
-BOOL LLTextureCache::isInCache(const LLUUID& id)
+BOOL LLTextureCache::isInCache(const LLUUID& id)
{
- LLMutexLock lock(&mHeaderMutex);
- id_map_t::const_iterator iter = mHeaderIDMap.find(id);
-
- return (iter != mHeaderIDMap.end()) ;
+ LLMutexLock lock(&mHeaderMutex);
+ id_map_t::const_iterator iter = mHeaderIDMap.find(id);
+
+ return (iter != mHeaderIDMap.end()) ;
}
//debug
-BOOL LLTextureCache::isInLocal(const LLUUID& id)
+BOOL LLTextureCache::isInLocal(const LLUUID& id)
{
- S32 local_size = 0;
- std::string local_filename;
-
- std::string filename = getLocalFileName(id);
- // Is it a JPEG2000 file?
- {
- local_filename = filename + ".j2c";
- local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
- if (local_size > 0)
- {
- return TRUE ;
- }
- }
-
- // If not, is it a jpeg file?
- {
- local_filename = filename + ".jpg";
- local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
- if (local_size > 0)
- {
- return TRUE ;
- }
- }
-
- // Hmm... What about a targa file? (used for UI texture mostly)
- {
- local_filename = filename + ".tga";
- local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
- if (local_size > 0)
- {
- return TRUE ;
- }
- }
-
- return FALSE ;
+ S32 local_size = 0;
+ std::string local_filename;
+
+ std::string filename = getLocalFileName(id);
+ // Is it a JPEG2000 file?
+ {
+ local_filename = filename + ".j2c";
+ local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+ if (local_size > 0)
+ {
+ return TRUE ;
+ }
+ }
+
+ // If not, is it a jpeg file?
+ {
+ local_filename = filename + ".jpg";
+ local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+ if (local_size > 0)
+ {
+ return TRUE ;
+ }
+ }
+
+ // Hmm... What about a targa file? (used for UI texture mostly)
+ {
+ local_filename = filename + ".tga";
+ local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+ if (local_size > 0)
+ {
+ return TRUE ;
+ }
+ }
+
+ return FALSE ;
}
//////////////////////////////////////////////////////////////////////////////
@@ -943,102 +943,102 @@ const char* fast_cache_filename = "FastCache.cache";
void LLTextureCache::setDirNames(ELLPath location)
{
- std::string delem = gDirUtilp->getDirDelimiter();
+ std::string delem = gDirUtilp->getDirDelimiter();
- mHeaderEntriesFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, entries_filename);
- mHeaderDataFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, cache_filename);
- mTexturesDirName = gDirUtilp->getExpandedFilename(location, textures_dirname);
- mFastCacheFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, fast_cache_filename);
+ mHeaderEntriesFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, entries_filename);
+ mHeaderDataFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, cache_filename);
+ mTexturesDirName = gDirUtilp->getExpandedFilename(location, textures_dirname);
+ mFastCacheFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, fast_cache_filename);
}
void LLTextureCache::purgeCache(ELLPath location, bool remove_dir)
{
- LLMutexLock lock(&mHeaderMutex);
-
- if (!mReadOnly)
- {
- setDirNames(location);
- llassert_always(mHeaderAPRFile == NULL);
-
- //remove the legacy cache if exists
- std::string texture_dir = mTexturesDirName ;
- mTexturesDirName = gDirUtilp->getExpandedFilename(location, old_textures_dirname);
- if(LLFile::isdir(mTexturesDirName))
- {
- std::string file_name = gDirUtilp->getExpandedFilename(location, entries_filename);
- // mHeaderAPRFilePoolp because we are under header mutex, and can be in main thread
- LLAPRFile::remove(file_name, mHeaderAPRFilePoolp);
-
- file_name = gDirUtilp->getExpandedFilename(location, cache_filename);
- LLAPRFile::remove(file_name, mHeaderAPRFilePoolp);
-
- purgeAllTextures(true);
- }
- mTexturesDirName = texture_dir ;
- }
-
- //remove the current texture cache.
- purgeAllTextures(remove_dir);
+ LLMutexLock lock(&mHeaderMutex);
+
+ if (!mReadOnly)
+ {
+ setDirNames(location);
+ llassert_always(mHeaderAPRFile == NULL);
+
+ //remove the legacy cache if exists
+ std::string texture_dir = mTexturesDirName ;
+ mTexturesDirName = gDirUtilp->getExpandedFilename(location, old_textures_dirname);
+ if(LLFile::isdir(mTexturesDirName))
+ {
+ std::string file_name = gDirUtilp->getExpandedFilename(location, entries_filename);
+ // mHeaderAPRFilePoolp because we are under header mutex, and can be in main thread
+ LLAPRFile::remove(file_name, mHeaderAPRFilePoolp);
+
+ file_name = gDirUtilp->getExpandedFilename(location, cache_filename);
+ LLAPRFile::remove(file_name, mHeaderAPRFilePoolp);
+
+ purgeAllTextures(true);
+ }
+ mTexturesDirName = texture_dir ;
+ }
+
+ //remove the current texture cache.
+ purgeAllTextures(remove_dir);
}
//is called in the main thread before initCache(...) is called.
void LLTextureCache::setReadOnly(BOOL read_only)
{
- mReadOnly = read_only ;
+ mReadOnly = read_only ;
}
// Called in the main thread.
// Returns the unused amount of max_size if any
S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache_mismatch)
{
- llassert_always(getPending() == 0) ; //should not start accessing the texture cache before initialized.
-
- S64 entries_size = (max_size * 36) / 100; //0.36 * max_size
- S64 max_entries = entries_size / (TEXTURE_CACHE_ENTRY_SIZE + TEXTURE_FAST_CACHE_ENTRY_SIZE);
- sCacheMaxEntries = (S32)(llmin((S64)sCacheMaxEntries, max_entries));
- entries_size = sCacheMaxEntries * (TEXTURE_CACHE_ENTRY_SIZE + TEXTURE_FAST_CACHE_ENTRY_SIZE);
- max_size -= entries_size;
- if (sCacheMaxTexturesSize > 0)
- sCacheMaxTexturesSize = llmin(sCacheMaxTexturesSize, max_size);
- else
- sCacheMaxTexturesSize = max_size;
- max_size -= sCacheMaxTexturesSize;
-
- LL_INFOS("TextureCache") << "Headers: " << sCacheMaxEntries
- << " Textures size: " << sCacheMaxTexturesSize / (1024 * 1024) << " MB" << LL_ENDL;
-
- setDirNames(location);
-
- if(texture_cache_mismatch)
- {
- //if readonly, disable the texture cache,
- //otherwise wipe out the texture cache.
- purgeAllTextures(true);
-
- if(mReadOnly)
- {
- return max_size ;
- }
- }
-
- if (!mReadOnly)
- {
- LLFile::mkdir(mTexturesDirName);
-
- const char* subdirs = "0123456789abcdef";
- for (S32 i=0; i<16; i++)
- {
- std::string dirname = mTexturesDirName + gDirUtilp->getDirDelimiter() + subdirs[i];
- LLFile::mkdir(dirname);
- }
- }
- readHeaderCache();
- purgeTextures(true); // calc mTexturesSize and make some room in the texture cache if we need it
-
- llassert_always(getPending() == 0) ; //should not start accessing the texture cache before initialized.
- openFastCache(true);
-
- return max_size; // unused cache space
+ llassert_always(getPending() == 0) ; //should not start accessing the texture cache before initialized.
+
+ S64 entries_size = (max_size * 36) / 100; //0.36 * max_size
+ S64 max_entries = entries_size / (TEXTURE_CACHE_ENTRY_SIZE + TEXTURE_FAST_CACHE_ENTRY_SIZE);
+ sCacheMaxEntries = (S32)(llmin((S64)sCacheMaxEntries, max_entries));
+ entries_size = sCacheMaxEntries * (TEXTURE_CACHE_ENTRY_SIZE + TEXTURE_FAST_CACHE_ENTRY_SIZE);
+ max_size -= entries_size;
+ if (sCacheMaxTexturesSize > 0)
+ sCacheMaxTexturesSize = llmin(sCacheMaxTexturesSize, max_size);
+ else
+ sCacheMaxTexturesSize = max_size;
+ max_size -= sCacheMaxTexturesSize;
+
+ LL_INFOS("TextureCache") << "Headers: " << sCacheMaxEntries
+ << " Textures size: " << sCacheMaxTexturesSize / (1024 * 1024) << " MB" << LL_ENDL;
+
+ setDirNames(location);
+
+ if(texture_cache_mismatch)
+ {
+ //if readonly, disable the texture cache,
+ //otherwise wipe out the texture cache.
+ purgeAllTextures(true);
+
+ if(mReadOnly)
+ {
+ return max_size ;
+ }
+ }
+
+ if (!mReadOnly)
+ {
+ LLFile::mkdir(mTexturesDirName);
+
+ const char* subdirs = "0123456789abcdef";
+ for (S32 i=0; i<16; i++)
+ {
+ std::string dirname = mTexturesDirName + gDirUtilp->getDirDelimiter() + subdirs[i];
+ LLFile::mkdir(dirname);
+ }
+ }
+ readHeaderCache();
+ purgeTextures(true); // calc mTexturesSize and make some room in the texture cache if we need it
+
+ llassert_always(getPending() == 0) ; //should not start accessing the texture cache before initialized.
+ openFastCache(true);
+
+ return max_size; // unused cache space
}
//----------------------------------------------------------------------------
@@ -1046,506 +1046,506 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache
LLAPRFile* LLTextureCache::openHeaderEntriesFile(bool readonly, S32 offset)
{
- llassert_always(mHeaderAPRFile == NULL);
- apr_int32_t flags = readonly ? APR_READ|APR_BINARY : APR_READ|APR_WRITE|APR_BINARY;
- mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags, mHeaderAPRFilePoolp);
- if(offset > 0)
- {
- mHeaderAPRFile->seek(APR_SET, offset);
- }
- return mHeaderAPRFile;
+ llassert_always(mHeaderAPRFile == NULL);
+ apr_int32_t flags = readonly ? APR_READ|APR_BINARY : APR_READ|APR_WRITE|APR_BINARY;
+ mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags, mHeaderAPRFilePoolp);
+ if(offset > 0)
+ {
+ mHeaderAPRFile->seek(APR_SET, offset);
+ }
+ return mHeaderAPRFile;
}
void LLTextureCache::closeHeaderEntriesFile()
{
- if(!mHeaderAPRFile)
- {
- return ;
- }
+ if(!mHeaderAPRFile)
+ {
+ return ;
+ }
- delete mHeaderAPRFile;
- mHeaderAPRFile = NULL;
+ delete mHeaderAPRFile;
+ mHeaderAPRFile = NULL;
}
void LLTextureCache::readEntriesHeader()
{
- // mHeaderEntriesInfo initializes to default values so safe not to read it
- llassert_always(mHeaderAPRFile == NULL);
- if (LLAPRFile::isExist(mHeaderEntriesFileName, mHeaderAPRFilePoolp))
- {
- LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
- mHeaderAPRFilePoolp);
- }
- else //create an empty entries header.
- {
- setEntriesHeader();
- writeEntriesHeader() ;
- }
+ // mHeaderEntriesInfo initializes to default values so safe not to read it
+ llassert_always(mHeaderAPRFile == NULL);
+ if (LLAPRFile::isExist(mHeaderEntriesFileName, mHeaderAPRFilePoolp))
+ {
+ LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
+ mHeaderAPRFilePoolp);
+ }
+ else //create an empty entries header.
+ {
+ setEntriesHeader();
+ writeEntriesHeader() ;
+ }
}
void LLTextureCache::setEntriesHeader()
{
- if (sHeaderEncoderStringSize < sHeaderCacheEncoderVersion.size() + 1)
- {
- // For simplicity we use predefined size of header, so if version string
- // doesn't fit, either getEngineInfo() returned malformed string or
- // sHeaderEncoderStringSize need to be increased.
- // Also take into accout that c_str() returns additional null character
- LL_ERRS() << "Version string doesn't fit in header" << LL_ENDL;
- }
-
- mHeaderEntriesInfo.mVersion = sHeaderCacheVersion;
- mHeaderEntriesInfo.mAdressSize = sHeaderCacheAddressSize;
- strcpy(mHeaderEntriesInfo.mEncoderVersion, sHeaderCacheEncoderVersion.c_str());
- mHeaderEntriesInfo.mEntries = 0;
+ if (sHeaderEncoderStringSize < sHeaderCacheEncoderVersion.size() + 1)
+ {
+ // For simplicity we use predefined size of header, so if version string
+ // doesn't fit, either getEngineInfo() returned malformed string or
+ // sHeaderEncoderStringSize need to be increased.
+ // Also take into accout that c_str() returns additional null character
+ LL_ERRS() << "Version string doesn't fit in header" << LL_ENDL;
+ }
+
+ mHeaderEntriesInfo.mVersion = sHeaderCacheVersion;
+ mHeaderEntriesInfo.mAdressSize = sHeaderCacheAddressSize;
+ strcpy(mHeaderEntriesInfo.mEncoderVersion, sHeaderCacheEncoderVersion.c_str());
+ mHeaderEntriesInfo.mEntries = 0;
}
void LLTextureCache::writeEntriesHeader()
{
- llassert_always(mHeaderAPRFile == NULL);
- if (!mReadOnly)
- {
- LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
- mHeaderAPRFilePoolp);
- }
+ llassert_always(mHeaderAPRFile == NULL);
+ if (!mReadOnly)
+ {
+ LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
+ mHeaderAPRFilePoolp);
+ }
}
//mHeaderMutex is locked before calling this.
S32 LLTextureCache::openAndReadEntry(const LLUUID& id, Entry& entry, bool create)
{
- S32 idx = -1;
-
- id_map_t::iterator iter1 = mHeaderIDMap.find(id);
- if (iter1 != mHeaderIDMap.end())
- {
- idx = iter1->second;
- }
-
- if (idx < 0)
- {
- if (create && !mReadOnly)
- {
- if (mHeaderEntriesInfo.mEntries < sCacheMaxEntries)
- {
- // Add an entry to the end of the list
- idx = mHeaderEntriesInfo.mEntries++;
-
- }
- else if (!mFreeList.empty())
- {
- idx = *(mFreeList.begin());
- mFreeList.erase(mFreeList.begin());
- }
- else
- {
- // Look for a still valid entry in the LRU
- for (std::set<LLUUID>::iterator iter2 = mLRU.begin(); iter2 != mLRU.end();)
- {
- std::set<LLUUID>::iterator curiter2 = iter2++;
- LLUUID oldid = *curiter2;
- // Erase entry from LRU regardless
- mLRU.erase(curiter2);
- // Look up entry and use it if it is valid
- id_map_t::iterator iter3 = mHeaderIDMap.find(oldid);
- if (iter3 != mHeaderIDMap.end() && iter3->second >= 0)
- {
- idx = iter3->second;
- removeCachedTexture(oldid) ;//remove the existing cached texture to release the entry index.
- break;
- }
- }
- // if (idx < 0) at this point, we will rebuild the LRU
- // and retry if called from setHeaderCacheEntry(),
- // otherwise this shouldn't happen and will trigger an error
- }
- if (idx >= 0)
- {
- entry.mID = id ;
- entry.mImageSize = -1 ; //mark it is a brand-new entry.
- entry.mBodySize = 0 ;
- }
- }
- }
- else
- {
- // Remove this entry from the LRU if it exists
- mLRU.erase(id);
- // Read the entry
- idx_entry_map_t::iterator iter = mUpdatedEntryMap.find(idx) ;
- if(iter != mUpdatedEntryMap.end())
- {
- entry = iter->second ;
- }
- else
- {
- readEntryFromHeaderImmediately(idx, entry) ;
- }
- if(entry.mImageSize <= entry.mBodySize)//it happens on 64-bit systems, do not know why
- {
- LL_WARNS() << "corrupted entry: " << id << " entry image size: " << entry.mImageSize << " entry body size: " << entry.mBodySize << LL_ENDL ;
-
- //erase this entry and the cached texture from the cache.
- std::string tex_filename = getTextureFileName(id);
- removeEntry(idx, entry, tex_filename) ;
- mUpdatedEntryMap.erase(idx) ;
- idx = -1 ;
- }
- }
- return idx;
+ S32 idx = -1;
+
+ id_map_t::iterator iter1 = mHeaderIDMap.find(id);
+ if (iter1 != mHeaderIDMap.end())
+ {
+ idx = iter1->second;
+ }
+
+ if (idx < 0)
+ {
+ if (create && !mReadOnly)
+ {
+ if (mHeaderEntriesInfo.mEntries < sCacheMaxEntries)
+ {
+ // Add an entry to the end of the list
+ idx = mHeaderEntriesInfo.mEntries++;
+
+ }
+ else if (!mFreeList.empty())
+ {
+ idx = *(mFreeList.begin());
+ mFreeList.erase(mFreeList.begin());
+ }
+ else
+ {
+ // Look for a still valid entry in the LRU
+ for (std::set<LLUUID>::iterator iter2 = mLRU.begin(); iter2 != mLRU.end();)
+ {
+ std::set<LLUUID>::iterator curiter2 = iter2++;
+ LLUUID oldid = *curiter2;
+ // Erase entry from LRU regardless
+ mLRU.erase(curiter2);
+ // Look up entry and use it if it is valid
+ id_map_t::iterator iter3 = mHeaderIDMap.find(oldid);
+ if (iter3 != mHeaderIDMap.end() && iter3->second >= 0)
+ {
+ idx = iter3->second;
+ removeCachedTexture(oldid) ;//remove the existing cached texture to release the entry index.
+ break;
+ }
+ }
+ // if (idx < 0) at this point, we will rebuild the LRU
+ // and retry if called from setHeaderCacheEntry(),
+ // otherwise this shouldn't happen and will trigger an error
+ }
+ if (idx >= 0)
+ {
+ entry.mID = id ;
+ entry.mImageSize = -1 ; //mark it is a brand-new entry.
+ entry.mBodySize = 0 ;
+ }
+ }
+ }
+ else
+ {
+ // Remove this entry from the LRU if it exists
+ mLRU.erase(id);
+ // Read the entry
+ idx_entry_map_t::iterator iter = mUpdatedEntryMap.find(idx) ;
+ if(iter != mUpdatedEntryMap.end())
+ {
+ entry = iter->second ;
+ }
+ else
+ {
+ readEntryFromHeaderImmediately(idx, entry) ;
+ }
+ if(entry.mImageSize <= entry.mBodySize)//it happens on 64-bit systems, do not know why
+ {
+ LL_WARNS() << "corrupted entry: " << id << " entry image size: " << entry.mImageSize << " entry body size: " << entry.mBodySize << LL_ENDL ;
+
+ //erase this entry and the cached texture from the cache.
+ std::string tex_filename = getTextureFileName(id);
+ removeEntry(idx, entry, tex_filename) ;
+ mUpdatedEntryMap.erase(idx) ;
+ idx = -1 ;
+ }
+ }
+ return idx;
}
//mHeaderMutex is locked before calling this.
void LLTextureCache::writeEntryToHeaderImmediately(S32& idx, Entry& entry, bool write_header)
-{
- LLAPRFile* aprfile ;
- S32 bytes_written ;
- S32 offset = sizeof(EntriesInfo) + idx * sizeof(Entry);
- if(write_header)
- {
- aprfile = openHeaderEntriesFile(false, 0);
- bytes_written = aprfile->write((U8*)&mHeaderEntriesInfo, sizeof(EntriesInfo)) ;
- if(bytes_written != sizeof(EntriesInfo))
- {
- clearCorruptedCache() ; //clear the cache.
- idx = -1 ;//mark the idx invalid.
- return ;
- }
-
- mHeaderAPRFile->seek(APR_SET, offset);
- }
- else
- {
- aprfile = openHeaderEntriesFile(false, offset);
- }
- bytes_written = aprfile->write((void*)&entry, (S32)sizeof(Entry));
- if(bytes_written != sizeof(Entry))
- {
- clearCorruptedCache() ; //clear the cache.
- idx = -1 ;//mark the idx invalid.
-
- return ;
- }
-
- closeHeaderEntriesFile();
- mUpdatedEntryMap.erase(idx) ;
+{
+ LLAPRFile* aprfile ;
+ S32 bytes_written ;
+ S32 offset = sizeof(EntriesInfo) + idx * sizeof(Entry);
+ if(write_header)
+ {
+ aprfile = openHeaderEntriesFile(false, 0);
+ bytes_written = aprfile->write((U8*)&mHeaderEntriesInfo, sizeof(EntriesInfo)) ;
+ if(bytes_written != sizeof(EntriesInfo))
+ {
+ clearCorruptedCache() ; //clear the cache.
+ idx = -1 ;//mark the idx invalid.
+ return ;
+ }
+
+ mHeaderAPRFile->seek(APR_SET, offset);
+ }
+ else
+ {
+ aprfile = openHeaderEntriesFile(false, offset);
+ }
+ bytes_written = aprfile->write((void*)&entry, (S32)sizeof(Entry));
+ if(bytes_written != sizeof(Entry))
+ {
+ clearCorruptedCache() ; //clear the cache.
+ idx = -1 ;//mark the idx invalid.
+
+ return ;
+ }
+
+ closeHeaderEntriesFile();
+ mUpdatedEntryMap.erase(idx) ;
}
//mHeaderMutex is locked before calling this.
void LLTextureCache::readEntryFromHeaderImmediately(S32& idx, Entry& entry)
{
- S32 offset = sizeof(EntriesInfo) + idx * sizeof(Entry);
- LLAPRFile* aprfile = openHeaderEntriesFile(true, offset);
- S32 bytes_read = aprfile->read((void*)&entry, (S32)sizeof(Entry));
- closeHeaderEntriesFile();
-
- if(bytes_read != sizeof(Entry))
- {
- clearCorruptedCache() ; //clear the cache.
- idx = -1 ;//mark the idx invalid.
- }
+ S32 offset = sizeof(EntriesInfo) + idx * sizeof(Entry);
+ LLAPRFile* aprfile = openHeaderEntriesFile(true, offset);
+ S32 bytes_read = aprfile->read((void*)&entry, (S32)sizeof(Entry));
+ closeHeaderEntriesFile();
+
+ if(bytes_read != sizeof(Entry))
+ {
+ clearCorruptedCache() ; //clear the cache.
+ idx = -1 ;//mark the idx invalid.
+ }
}
//mHeaderMutex is locked before calling this.
//update an existing entry time stamp, delay writing.
void LLTextureCache::updateEntryTimeStamp(S32 idx, Entry& entry)
{
- static const U32 MAX_ENTRIES_WITHOUT_TIME_STAMP = (U32)(LLTextureCache::sCacheMaxEntries * 0.75f) ;
-
- if(mHeaderEntriesInfo.mEntries < MAX_ENTRIES_WITHOUT_TIME_STAMP)
- {
- return ; //there are enough empty entry index space, no need to stamp time.
- }
-
- if (idx >= 0)
- {
- if (!mReadOnly)
- {
- entry.mTime = time(NULL);
- mUpdatedEntryMap[idx] = entry ;
- }
- }
+ static const U32 MAX_ENTRIES_WITHOUT_TIME_STAMP = (U32)(LLTextureCache::sCacheMaxEntries * 0.75f) ;
+
+ if(mHeaderEntriesInfo.mEntries < MAX_ENTRIES_WITHOUT_TIME_STAMP)
+ {
+ return ; //there are enough empty entry index space, no need to stamp time.
+ }
+
+ if (idx >= 0)
+ {
+ if (!mReadOnly)
+ {
+ entry.mTime = time(NULL);
+ mUpdatedEntryMap[idx] = entry ;
+ }
+ }
}
//update an existing entry, write to header file immediately.
bool LLTextureCache::updateEntry(S32& idx, Entry& entry, S32 new_image_size, S32 new_data_size)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- S32 new_body_size = llmax(0, new_data_size - TEXTURE_CACHE_ENTRY_SIZE) ;
-
- if(new_image_size == entry.mImageSize && new_body_size == entry.mBodySize)
- {
- return true ; //nothing changed.
- }
- else
- {
- bool purge = false ;
-
- lockHeaders() ;
-
- bool update_header = false ;
- if(entry.mImageSize < 0) //is a brand-new entry
- {
- mHeaderIDMap[entry.mID] = idx;
- mTexturesSizeMap[entry.mID] = new_body_size ;
- mTexturesSizeTotal += new_body_size ;
-
- // Update Header
- update_header = true ;
- }
- else if (entry.mBodySize != new_body_size)
- {
- //already in mHeaderIDMap.
- mTexturesSizeMap[entry.mID] = new_body_size ;
- mTexturesSizeTotal -= entry.mBodySize ;
- mTexturesSizeTotal += new_body_size ;
- }
- entry.mTime = time(NULL);
- entry.mImageSize = new_image_size ;
- entry.mBodySize = new_body_size ;
-
- writeEntryToHeaderImmediately(idx, entry, update_header) ;
-
- if (mTexturesSizeTotal > sCacheMaxTexturesSize)
- {
- purge = true;
- }
-
- unlockHeaders() ;
-
- if (purge)
- {
- mDoPurge = TRUE;
- }
- }
-
- return false ;
+ S32 new_body_size = llmax(0, new_data_size - TEXTURE_CACHE_ENTRY_SIZE) ;
+
+ if(new_image_size == entry.mImageSize && new_body_size == entry.mBodySize)
+ {
+ return true ; //nothing changed.
+ }
+ else
+ {
+ bool purge = false ;
+
+ lockHeaders() ;
+
+ bool update_header = false ;
+ if(entry.mImageSize < 0) //is a brand-new entry
+ {
+ mHeaderIDMap[entry.mID] = idx;
+ mTexturesSizeMap[entry.mID] = new_body_size ;
+ mTexturesSizeTotal += new_body_size ;
+
+ // Update Header
+ update_header = true ;
+ }
+ else if (entry.mBodySize != new_body_size)
+ {
+ //already in mHeaderIDMap.
+ mTexturesSizeMap[entry.mID] = new_body_size ;
+ mTexturesSizeTotal -= entry.mBodySize ;
+ mTexturesSizeTotal += new_body_size ;
+ }
+ entry.mTime = time(NULL);
+ entry.mImageSize = new_image_size ;
+ entry.mBodySize = new_body_size ;
+
+ writeEntryToHeaderImmediately(idx, entry, update_header) ;
+
+ if (mTexturesSizeTotal > sCacheMaxTexturesSize)
+ {
+ purge = true;
+ }
+
+ unlockHeaders() ;
+
+ if (purge)
+ {
+ mDoPurge = TRUE;
+ }
+ }
+
+ return false ;
}
U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
{
- U32 num_entries = mHeaderEntriesInfo.mEntries;
-
- mHeaderIDMap.clear();
- mTexturesSizeMap.clear();
- mFreeList.clear();
- mTexturesSizeTotal = 0;
-
- LLAPRFile* aprfile = NULL;
- if(mUpdatedEntryMap.empty())
- {
- aprfile = openHeaderEntriesFile(true, (S32)sizeof(EntriesInfo));
- }
- else //update the header file first.
- {
- aprfile = openHeaderEntriesFile(false, 0);
- updatedHeaderEntriesFile() ;
- if(!aprfile)
- {
- return 0;
- }
- aprfile->seek(APR_SET, (S32)sizeof(EntriesInfo));
- }
- for (U32 idx=0; idx<num_entries; idx++)
- {
- Entry entry;
- S32 bytes_read = aprfile->read((void*)(&entry), (S32)sizeof(Entry));
- if (bytes_read < sizeof(Entry))
- {
- LL_WARNS() << "Corrupted header entries, failed at " << idx << " / " << num_entries << LL_ENDL;
- closeHeaderEntriesFile();
- purgeAllTextures(false);
- return 0;
- }
- entries.push_back(entry);
-// LL_INFOS() << "ENTRY: " << entry.mTime << " TEX: " << entry.mID << " IDX: " << idx << " Size: " << entry.mImageSize << LL_ENDL;
- if(entry.mImageSize > entry.mBodySize)
- {
- mHeaderIDMap[entry.mID] = idx;
- mTexturesSizeMap[entry.mID] = entry.mBodySize;
- mTexturesSizeTotal += entry.mBodySize;
- }
- else
- {
- mFreeList.insert(idx);
- }
- }
- closeHeaderEntriesFile();
- return num_entries;
+ U32 num_entries = mHeaderEntriesInfo.mEntries;
+
+ mHeaderIDMap.clear();
+ mTexturesSizeMap.clear();
+ mFreeList.clear();
+ mTexturesSizeTotal = 0;
+
+ LLAPRFile* aprfile = NULL;
+ if(mUpdatedEntryMap.empty())
+ {
+ aprfile = openHeaderEntriesFile(true, (S32)sizeof(EntriesInfo));
+ }
+ else //update the header file first.
+ {
+ aprfile = openHeaderEntriesFile(false, 0);
+ updatedHeaderEntriesFile() ;
+ if(!aprfile)
+ {
+ return 0;
+ }
+ aprfile->seek(APR_SET, (S32)sizeof(EntriesInfo));
+ }
+ for (U32 idx=0; idx<num_entries; idx++)
+ {
+ Entry entry;
+ S32 bytes_read = aprfile->read((void*)(&entry), (S32)sizeof(Entry));
+ if (bytes_read < sizeof(Entry))
+ {
+ LL_WARNS() << "Corrupted header entries, failed at " << idx << " / " << num_entries << LL_ENDL;
+ closeHeaderEntriesFile();
+ purgeAllTextures(false);
+ return 0;
+ }
+ entries.push_back(entry);
+// LL_INFOS() << "ENTRY: " << entry.mTime << " TEX: " << entry.mID << " IDX: " << idx << " Size: " << entry.mImageSize << LL_ENDL;
+ if(entry.mImageSize > entry.mBodySize)
+ {
+ mHeaderIDMap[entry.mID] = idx;
+ mTexturesSizeMap[entry.mID] = entry.mBodySize;
+ mTexturesSizeTotal += entry.mBodySize;
+ }
+ else
+ {
+ mFreeList.insert(idx);
+ }
+ }
+ closeHeaderEntriesFile();
+ return num_entries;
}
void LLTextureCache::writeEntriesAndClose(const std::vector<Entry>& entries)
{
- S32 num_entries = entries.size();
- llassert_always(num_entries == mHeaderEntriesInfo.mEntries);
-
- if (!mReadOnly)
- {
- LLAPRFile* aprfile = openHeaderEntriesFile(false, (S32)sizeof(EntriesInfo));
- for (S32 idx=0; idx<num_entries; idx++)
- {
- S32 bytes_written = aprfile->write((void*)(&entries[idx]), (S32)sizeof(Entry));
- if(bytes_written != sizeof(Entry))
- {
- clearCorruptedCache() ; //clear the cache.
- return ;
- }
- }
- closeHeaderEntriesFile();
- }
+ S32 num_entries = entries.size();
+ llassert_always(num_entries == mHeaderEntriesInfo.mEntries);
+
+ if (!mReadOnly)
+ {
+ LLAPRFile* aprfile = openHeaderEntriesFile(false, (S32)sizeof(EntriesInfo));
+ for (S32 idx=0; idx<num_entries; idx++)
+ {
+ S32 bytes_written = aprfile->write((void*)(&entries[idx]), (S32)sizeof(Entry));
+ if(bytes_written != sizeof(Entry))
+ {
+ clearCorruptedCache() ; //clear the cache.
+ return ;
+ }
+ }
+ closeHeaderEntriesFile();
+ }
}
void LLTextureCache::writeUpdatedEntries()
{
- lockHeaders() ;
- if (!mReadOnly && !mUpdatedEntryMap.empty())
- {
- openHeaderEntriesFile(false, 0);
- updatedHeaderEntriesFile() ;
- closeHeaderEntriesFile();
- }
- unlockHeaders() ;
+ lockHeaders() ;
+ if (!mReadOnly && !mUpdatedEntryMap.empty())
+ {
+ openHeaderEntriesFile(false, 0);
+ updatedHeaderEntriesFile() ;
+ closeHeaderEntriesFile();
+ }
+ unlockHeaders() ;
}
//mHeaderMutex is locked and mHeaderAPRFile is created before calling this.
void LLTextureCache::updatedHeaderEntriesFile()
{
- if (!mReadOnly && !mUpdatedEntryMap.empty() && mHeaderAPRFile)
- {
- //entriesInfo
- mHeaderAPRFile->seek(APR_SET, 0);
- S32 bytes_written = mHeaderAPRFile->write((U8*)&mHeaderEntriesInfo, sizeof(EntriesInfo)) ;
- if(bytes_written != sizeof(EntriesInfo))
- {
- clearCorruptedCache() ; //clear the cache.
- return ;
- }
-
- //write each updated entry
- S32 entry_size = (S32)sizeof(Entry) ;
- S32 prev_idx = -1 ;
- S32 delta_idx ;
- for (idx_entry_map_t::iterator iter = mUpdatedEntryMap.begin(); iter != mUpdatedEntryMap.end(); ++iter)
- {
- delta_idx = iter->first - prev_idx - 1;
- prev_idx = iter->first ;
- if(delta_idx)
- {
- mHeaderAPRFile->seek(APR_CUR, delta_idx * entry_size);
- }
-
- bytes_written = mHeaderAPRFile->write((void*)(&iter->second), entry_size);
- if(bytes_written != entry_size)
- {
- clearCorruptedCache() ; //clear the cache.
- return ;
- }
- }
- mUpdatedEntryMap.clear() ;
- }
+ if (!mReadOnly && !mUpdatedEntryMap.empty() && mHeaderAPRFile)
+ {
+ //entriesInfo
+ mHeaderAPRFile->seek(APR_SET, 0);
+ S32 bytes_written = mHeaderAPRFile->write((U8*)&mHeaderEntriesInfo, sizeof(EntriesInfo)) ;
+ if(bytes_written != sizeof(EntriesInfo))
+ {
+ clearCorruptedCache() ; //clear the cache.
+ return ;
+ }
+
+ //write each updated entry
+ S32 entry_size = (S32)sizeof(Entry) ;
+ S32 prev_idx = -1 ;
+ S32 delta_idx ;
+ for (idx_entry_map_t::iterator iter = mUpdatedEntryMap.begin(); iter != mUpdatedEntryMap.end(); ++iter)
+ {
+ delta_idx = iter->first - prev_idx - 1;
+ prev_idx = iter->first ;
+ if(delta_idx)
+ {
+ mHeaderAPRFile->seek(APR_CUR, delta_idx * entry_size);
+ }
+
+ bytes_written = mHeaderAPRFile->write((void*)(&iter->second), entry_size);
+ if(bytes_written != entry_size)
+ {
+ clearCorruptedCache() ; //clear the cache.
+ return ;
+ }
+ }
+ mUpdatedEntryMap.clear() ;
+ }
}
//----------------------------------------------------------------------------
// Called from either the main thread or the worker thread
void LLTextureCache::readHeaderCache()
{
- mHeaderMutex.lock();
-
- mLRU.clear(); // always clear the LRU
-
- readEntriesHeader();
-
- if (mHeaderEntriesInfo.mVersion != sHeaderCacheVersion
- || mHeaderEntriesInfo.mAdressSize != sHeaderCacheAddressSize
- || strcmp(mHeaderEntriesInfo.mEncoderVersion, sHeaderCacheEncoderVersion.c_str()) != 0)
- {
- if (!mReadOnly)
- {
- LL_INFOS() << "Texture Cache version mismatch, Purging." << LL_ENDL;
- purgeAllTextures(false);
- }
- }
- else
- {
- std::vector<Entry> entries;
- U32 num_entries = openAndReadEntries(entries);
- if (num_entries)
- {
- U32 empty_entries = 0;
- typedef std::pair<U32, S32> lru_data_t;
- std::set<lru_data_t> lru;
- std::set<U32> purge_list;
- for (U32 i=0; i<num_entries; i++)
- {
- Entry& entry = entries[i];
- if (entry.mImageSize <= 0)
- {
- // This will be in the Free List, don't put it in the LRU
- ++empty_entries;
- }
- else
- {
- lru.insert(std::make_pair(entry.mTime, i));
- if (entry.mBodySize > 0)
- {
- if (entry.mBodySize > entry.mImageSize)
- {
- // Shouldn't happen, failsafe only
- LL_WARNS() << "Bad entry: " << i << ": " << entry.mID << ": BodySize: " << entry.mBodySize << LL_ENDL;
- purge_list.insert(i);
- }
- }
- }
- }
- if (num_entries - empty_entries > sCacheMaxEntries)
- {
- // Special case: cache size was reduced, need to remove entries
- U32 entries_to_purge = (num_entries - empty_entries) - sCacheMaxEntries;
- LL_INFOS() << "Texture Cache Entries: " << num_entries << " Max: " << sCacheMaxEntries << " Empty: " << empty_entries << " Purging: " << entries_to_purge << LL_ENDL;
- // We can exit the following loop with the given condition, since if we'd reach the end of the lru set we'd have:
- // purge_list.size() = lru.size() = num_entries - empty_entries = entries_to_purge + sCacheMaxEntries >= entries_to_purge
- // So, it's certain that iter will never reach lru.end() first.
- std::set<lru_data_t>::iterator iter = lru.begin();
- while (purge_list.size() < entries_to_purge)
- {
- purge_list.insert(iter->second);
- ++iter;
- }
- }
-
- {
- S32 lru_entries = (S32)((F32)sCacheMaxEntries * TEXTURE_CACHE_LRU_SIZE);
- for (std::set<lru_data_t>::iterator iter = lru.begin(); iter != lru.end(); ++iter)
- {
- mLRU.insert(entries[iter->second].mID);
-// LL_INFOS() << "LRU: " << iter->first << " : " << iter->second << LL_ENDL;
- if (--lru_entries <= 0)
- break;
- }
- }
-
- if (purge_list.size() > 0)
- {
- LLTimer timer;
- for (std::set<U32>::iterator iter = purge_list.begin(); iter != purge_list.end(); ++iter)
- {
- std::string tex_filename = getTextureFileName(entries[*iter].mID);
- removeEntry((S32)*iter, entries[*iter], tex_filename);
-
- //make sure that pruning entries doesn't take too much time
- if (timer.getElapsedTimeF32() > TEXTURE_PRUNING_MAX_TIME)
- {
- break;
- }
- }
- writeEntriesAndClose(entries);
- }
- else
- {
- //entries are not changed, nothing here.
- }
- }
- }
- mHeaderMutex.unlock();
+ mHeaderMutex.lock();
+
+ mLRU.clear(); // always clear the LRU
+
+ readEntriesHeader();
+
+ if (mHeaderEntriesInfo.mVersion != sHeaderCacheVersion
+ || mHeaderEntriesInfo.mAdressSize != sHeaderCacheAddressSize
+ || strcmp(mHeaderEntriesInfo.mEncoderVersion, sHeaderCacheEncoderVersion.c_str()) != 0)
+ {
+ if (!mReadOnly)
+ {
+ LL_INFOS() << "Texture Cache version mismatch, Purging." << LL_ENDL;
+ purgeAllTextures(false);
+ }
+ }
+ else
+ {
+ std::vector<Entry> entries;
+ U32 num_entries = openAndReadEntries(entries);
+ if (num_entries)
+ {
+ U32 empty_entries = 0;
+ typedef std::pair<U32, S32> lru_data_t;
+ std::set<lru_data_t> lru;
+ std::set<U32> purge_list;
+ for (U32 i=0; i<num_entries; i++)
+ {
+ Entry& entry = entries[i];
+ if (entry.mImageSize <= 0)
+ {
+ // This will be in the Free List, don't put it in the LRU
+ ++empty_entries;
+ }
+ else
+ {
+ lru.insert(std::make_pair(entry.mTime, i));
+ if (entry.mBodySize > 0)
+ {
+ if (entry.mBodySize > entry.mImageSize)
+ {
+ // Shouldn't happen, failsafe only
+ LL_WARNS() << "Bad entry: " << i << ": " << entry.mID << ": BodySize: " << entry.mBodySize << LL_ENDL;
+ purge_list.insert(i);
+ }
+ }
+ }
+ }
+ if (num_entries - empty_entries > sCacheMaxEntries)
+ {
+ // Special case: cache size was reduced, need to remove entries
+ U32 entries_to_purge = (num_entries - empty_entries) - sCacheMaxEntries;
+ LL_INFOS() << "Texture Cache Entries: " << num_entries << " Max: " << sCacheMaxEntries << " Empty: " << empty_entries << " Purging: " << entries_to_purge << LL_ENDL;
+ // We can exit the following loop with the given condition, since if we'd reach the end of the lru set we'd have:
+ // purge_list.size() = lru.size() = num_entries - empty_entries = entries_to_purge + sCacheMaxEntries >= entries_to_purge
+ // So, it's certain that iter will never reach lru.end() first.
+ std::set<lru_data_t>::iterator iter = lru.begin();
+ while (purge_list.size() < entries_to_purge)
+ {
+ purge_list.insert(iter->second);
+ ++iter;
+ }
+ }
+
+ {
+ S32 lru_entries = (S32)((F32)sCacheMaxEntries * TEXTURE_CACHE_LRU_SIZE);
+ for (std::set<lru_data_t>::iterator iter = lru.begin(); iter != lru.end(); ++iter)
+ {
+ mLRU.insert(entries[iter->second].mID);
+// LL_INFOS() << "LRU: " << iter->first << " : " << iter->second << LL_ENDL;
+ if (--lru_entries <= 0)
+ break;
+ }
+ }
+
+ if (purge_list.size() > 0)
+ {
+ LLTimer timer;
+ for (std::set<U32>::iterator iter = purge_list.begin(); iter != purge_list.end(); ++iter)
+ {
+ std::string tex_filename = getTextureFileName(entries[*iter].mID);
+ removeEntry((S32)*iter, entries[*iter], tex_filename);
+
+ //make sure that pruning entries doesn't take too much time
+ if (timer.getElapsedTimeF32() > TEXTURE_PRUNING_MAX_TIME)
+ {
+ break;
+ }
+ }
+ writeEntriesAndClose(entries);
+ }
+ else
+ {
+ //entries are not changed, nothing here.
+ }
+ }
+ }
+ mHeaderMutex.unlock();
}
//////////////////////////////////////////////////////////////////////////////
@@ -1553,271 +1553,271 @@ void LLTextureCache::readHeaderCache()
//the header mutex is locked before calling this.
void LLTextureCache::clearCorruptedCache()
{
- LL_WARNS() << "the texture cache is corrupted, need to be cleared." << LL_ENDL ;
+ LL_WARNS() << "the texture cache is corrupted, need to be cleared." << LL_ENDL ;
- closeHeaderEntriesFile();//close possible file handler
- purgeAllTextures(false) ; //clear the cache.
+ closeHeaderEntriesFile();//close possible file handler
+ purgeAllTextures(false) ; //clear the cache.
- if (!mReadOnly) //regenerate the directory tree if not exists.
- {
- LLFile::mkdir(mTexturesDirName);
+ if (!mReadOnly) //regenerate the directory tree if not exists.
+ {
+ LLFile::mkdir(mTexturesDirName);
- const char* subdirs = "0123456789abcdef";
- for (S32 i=0; i<16; i++)
- {
- std::string dirname = mTexturesDirName + gDirUtilp->getDirDelimiter() + subdirs[i];
- LLFile::mkdir(dirname);
- }
- }
+ const char* subdirs = "0123456789abcdef";
+ for (S32 i=0; i<16; i++)
+ {
+ std::string dirname = mTexturesDirName + gDirUtilp->getDirDelimiter() + subdirs[i];
+ LLFile::mkdir(dirname);
+ }
+ }
- return ;
+ return ;
}
void LLTextureCache::purgeAllTextures(bool purge_directories)
{
- if (!mReadOnly)
- {
- const char* subdirs = "0123456789abcdef";
- std::string delem = gDirUtilp->getDirDelimiter();
- std::string mask = "*";
- for (S32 i=0; i<16; i++)
- {
- std::string dirname = mTexturesDirName + delem + subdirs[i];
- LL_INFOS() << "Deleting files in directory: " << dirname << LL_ENDL;
- if (purge_directories)
- {
- gDirUtilp->deleteDirAndContents(dirname);
- }
- else
- {
- gDirUtilp->deleteFilesInDir(dirname, mask);
- }
+ if (!mReadOnly)
+ {
+ const char* subdirs = "0123456789abcdef";
+ std::string delem = gDirUtilp->getDirDelimiter();
+ std::string mask = "*";
+ for (S32 i=0; i<16; i++)
+ {
+ std::string dirname = mTexturesDirName + delem + subdirs[i];
+ LL_INFOS() << "Deleting files in directory: " << dirname << LL_ENDL;
+ if (purge_directories)
+ {
+ gDirUtilp->deleteDirAndContents(dirname);
+ }
+ else
+ {
+ gDirUtilp->deleteFilesInDir(dirname, mask);
+ }
#if LL_WINDOWS
// Texture cache can be large and can take a while to remove
// assure OS that processes is alive and not hanging
MSG msg;
PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE | PM_NOYIELD);
#endif
- }
- gDirUtilp->deleteFilesInDir(mTexturesDirName, mask); // headers, fast cache
- if (purge_directories)
- {
- LLFile::rmdir(mTexturesDirName);
- }
- }
- mHeaderIDMap.clear();
- mTexturesSizeMap.clear();
- mTexturesSizeTotal = 0;
- mFreeList.clear();
- mTexturesSizeTotal = 0;
- mUpdatedEntryMap.clear();
-
- // Info with 0 entries
- setEntriesHeader();
- writeEntriesHeader();
-
- LL_INFOS() << "The entire texture cache is cleared." << LL_ENDL ;
+ }
+ gDirUtilp->deleteFilesInDir(mTexturesDirName, mask); // headers, fast cache
+ if (purge_directories)
+ {
+ LLFile::rmdir(mTexturesDirName);
+ }
+ }
+ mHeaderIDMap.clear();
+ mTexturesSizeMap.clear();
+ mTexturesSizeTotal = 0;
+ mFreeList.clear();
+ mTexturesSizeTotal = 0;
+ mUpdatedEntryMap.clear();
+
+ // Info with 0 entries
+ setEntriesHeader();
+ writeEntriesHeader();
+
+ LL_INFOS() << "The entire texture cache is cleared." << LL_ENDL ;
}
void LLTextureCache::purgeTexturesLazy(F32 time_limit_sec)
{
- if (mReadOnly)
- {
- return;
- }
-
- if (!mThreaded)
- {
- LLAppViewer::instance()->pauseMainloopTimeout();
- }
-
- // time_limit doesn't account for lock time
- LLMutexLock lock(&mHeaderMutex);
-
- if (mPurgeEntryList.empty())
- {
- // Read the entries list and form list of textures to purge
- std::vector<Entry> entries;
- U32 num_entries = openAndReadEntries(entries);
- if (!num_entries)
- {
- return; // nothing to purge
- }
-
- // Use mTexturesSizeMap to collect UUIDs of textures with bodies
- typedef std::set<std::pair<U32, S32> > time_idx_set_t;
- std::set<std::pair<U32, S32> > time_idx_set;
- for (size_map_t::iterator iter1 = mTexturesSizeMap.begin();
- iter1 != mTexturesSizeMap.end(); ++iter1)
- {
- if (iter1->second > 0)
- {
- id_map_t::iterator iter2 = mHeaderIDMap.find(iter1->first);
- if (iter2 != mHeaderIDMap.end())
- {
- S32 idx = iter2->second;
- time_idx_set.insert(std::make_pair(entries[idx].mTime, idx));
- }
- else
- {
- LL_ERRS("TextureCache") << "mTexturesSizeMap / mHeaderIDMap corrupted." << LL_ENDL;
- }
- }
- }
-
- S64 cache_size = mTexturesSizeTotal;
- S64 purged_cache_size = (llmax(cache_size, sCacheMaxTexturesSize) * (S64)((1.f - TEXTURE_CACHE_PURGE_AMOUNT) * 100)) / 100;
- for (time_idx_set_t::iterator iter = time_idx_set.begin();
- iter != time_idx_set.end(); ++iter)
- {
- S32 idx = iter->second;
- if (cache_size >= purged_cache_size)
- {
- cache_size -= entries[idx].mBodySize;
- mPurgeEntryList.push_back(std::pair<S32, Entry>(idx, entries[idx]));
- }
- else
- {
- break;
- }
- }
- LL_DEBUGS("TextureCache") << "Formed Purge list of " << mPurgeEntryList.size() << " entries" << LL_ENDL;
- }
- else
- {
- // Remove collected entried
- LLTimer timer;
- while (!mPurgeEntryList.empty() && timer.getElapsedTimeF32() < time_limit_sec)
- {
- S32 idx = mPurgeEntryList.back().first;
- Entry entry = mPurgeEntryList.back().second;
- mPurgeEntryList.pop_back();
- // make sure record is still valid
- id_map_t::iterator iter_header = mHeaderIDMap.find(entry.mID);
- if (iter_header != mHeaderIDMap.end() && iter_header->second == idx)
- {
- std::string tex_filename = getTextureFileName(entry.mID);
- removeEntry(idx, entry, tex_filename);
- writeEntryToHeaderImmediately(idx, entry);
- }
- }
- }
+ if (mReadOnly)
+ {
+ return;
+ }
+
+ if (!mThreaded)
+ {
+ LLAppViewer::instance()->pauseMainloopTimeout();
+ }
+
+ // time_limit doesn't account for lock time
+ LLMutexLock lock(&mHeaderMutex);
+
+ if (mPurgeEntryList.empty())
+ {
+ // Read the entries list and form list of textures to purge
+ std::vector<Entry> entries;
+ U32 num_entries = openAndReadEntries(entries);
+ if (!num_entries)
+ {
+ return; // nothing to purge
+ }
+
+ // Use mTexturesSizeMap to collect UUIDs of textures with bodies
+ typedef std::set<std::pair<U32, S32> > time_idx_set_t;
+ std::set<std::pair<U32, S32> > time_idx_set;
+ for (size_map_t::iterator iter1 = mTexturesSizeMap.begin();
+ iter1 != mTexturesSizeMap.end(); ++iter1)
+ {
+ if (iter1->second > 0)
+ {
+ id_map_t::iterator iter2 = mHeaderIDMap.find(iter1->first);
+ if (iter2 != mHeaderIDMap.end())
+ {
+ S32 idx = iter2->second;
+ time_idx_set.insert(std::make_pair(entries[idx].mTime, idx));
+ }
+ else
+ {
+ LL_ERRS("TextureCache") << "mTexturesSizeMap / mHeaderIDMap corrupted." << LL_ENDL;
+ }
+ }
+ }
+
+ S64 cache_size = mTexturesSizeTotal;
+ S64 purged_cache_size = (llmax(cache_size, sCacheMaxTexturesSize) * (S64)((1.f - TEXTURE_CACHE_PURGE_AMOUNT) * 100)) / 100;
+ for (time_idx_set_t::iterator iter = time_idx_set.begin();
+ iter != time_idx_set.end(); ++iter)
+ {
+ S32 idx = iter->second;
+ if (cache_size >= purged_cache_size)
+ {
+ cache_size -= entries[idx].mBodySize;
+ mPurgeEntryList.push_back(std::pair<S32, Entry>(idx, entries[idx]));
+ }
+ else
+ {
+ break;
+ }
+ }
+ LL_DEBUGS("TextureCache") << "Formed Purge list of " << mPurgeEntryList.size() << " entries" << LL_ENDL;
+ }
+ else
+ {
+ // Remove collected entried
+ LLTimer timer;
+ while (!mPurgeEntryList.empty() && timer.getElapsedTimeF32() < time_limit_sec)
+ {
+ S32 idx = mPurgeEntryList.back().first;
+ Entry entry = mPurgeEntryList.back().second;
+ mPurgeEntryList.pop_back();
+ // make sure record is still valid
+ id_map_t::iterator iter_header = mHeaderIDMap.find(entry.mID);
+ if (iter_header != mHeaderIDMap.end() && iter_header->second == idx)
+ {
+ std::string tex_filename = getTextureFileName(entry.mID);
+ removeEntry(idx, entry, tex_filename);
+ writeEntryToHeaderImmediately(idx, entry);
+ }
+ }
+ }
}
void LLTextureCache::purgeTextures(bool validate)
{
- if (mReadOnly)
- {
- return;
- }
-
- if (!mThreaded)
- {
- // *FIX:Mani - watchdog off.
- LLAppViewer::instance()->pauseMainloopTimeout();
- }
-
- LLMutexLock lock(&mHeaderMutex);
-
- LL_INFOS() << "TEXTURE CACHE: Purging." << LL_ENDL;
-
- // Read the entries list
- std::vector<Entry> entries;
- U32 num_entries = openAndReadEntries(entries);
- if (!num_entries)
- {
- return; // nothing to purge
- }
-
- // Use mTexturesSizeMap to collect UUIDs of textures with bodies
- typedef std::set<std::pair<U32,S32> > time_idx_set_t;
- std::set<std::pair<U32,S32> > time_idx_set;
- for (size_map_t::iterator iter1 = mTexturesSizeMap.begin();
- iter1 != mTexturesSizeMap.end(); ++iter1)
- {
- if (iter1->second > 0)
- {
- id_map_t::iterator iter2 = mHeaderIDMap.find(iter1->first);
- if (iter2 != mHeaderIDMap.end())
- {
- S32 idx = iter2->second;
- time_idx_set.insert(std::make_pair(entries[idx].mTime, idx));
-// LL_INFOS() << "TIME: " << entries[idx].mTime << " TEX: " << entries[idx].mID << " IDX: " << idx << " Size: " << entries[idx].mImageSize << LL_ENDL;
- }
- else
- {
- LL_ERRS() << "mTexturesSizeMap / mHeaderIDMap corrupted." << LL_ENDL ;
- }
- }
- }
-
- // Validate 1/256th of the files on startup
- U32 validate_idx = 0;
- if (validate)
- {
- validate_idx = gSavedSettings.getU32("CacheValidateCounter");
- U32 next_idx = (validate_idx + 1) % 256;
- gSavedSettings.setU32("CacheValidateCounter", next_idx);
- LL_DEBUGS("TextureCache") << "TEXTURE CACHE: Validating: " << validate_idx << LL_ENDL;
- }
-
- S64 cache_size = mTexturesSizeTotal;
- S64 purged_cache_size = (llmax(cache_size, sCacheMaxTexturesSize) * (S64)((1.f - TEXTURE_CACHE_PURGE_AMOUNT) * 100)) / 100;
- S32 purge_count = 0;
- for (time_idx_set_t::iterator iter = time_idx_set.begin();
- iter != time_idx_set.end(); ++iter)
- {
- S32 idx = iter->second;
- bool purge_entry = false;
-
- if (cache_size >= purged_cache_size)
- {
- purge_entry = true;
- }
- else if (validate)
- {
- // make sure file exists and is the correct size
- U32 uuididx = entries[idx].mID.mData[0];
- if (uuididx == validate_idx)
- {
- std::string filename = getTextureFileName(entries[idx].mID);
- LL_DEBUGS("TextureCache") << "Validating: " << filename << "Size: " << entries[idx].mBodySize << LL_ENDL;
- // mHeaderAPRFilePoolp because this is under header mutex in main thread
- S32 bodysize = LLAPRFile::size(filename, mHeaderAPRFilePoolp);
- if (bodysize != entries[idx].mBodySize)
- {
- LL_WARNS("TextureCache") << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mBodySize << filename << LL_ENDL;
- purge_entry = true;
- }
- }
- }
- else
- {
- break;
- }
-
- if (purge_entry)
- {
- purge_count++;
+ if (mReadOnly)
+ {
+ return;
+ }
+
+ if (!mThreaded)
+ {
+ // *FIX:Mani - watchdog off.
+ LLAppViewer::instance()->pauseMainloopTimeout();
+ }
+
+ LLMutexLock lock(&mHeaderMutex);
+
+ LL_INFOS() << "TEXTURE CACHE: Purging." << LL_ENDL;
+
+ // Read the entries list
+ std::vector<Entry> entries;
+ U32 num_entries = openAndReadEntries(entries);
+ if (!num_entries)
+ {
+ return; // nothing to purge
+ }
+
+ // Use mTexturesSizeMap to collect UUIDs of textures with bodies
+ typedef std::set<std::pair<U32,S32> > time_idx_set_t;
+ std::set<std::pair<U32,S32> > time_idx_set;
+ for (size_map_t::iterator iter1 = mTexturesSizeMap.begin();
+ iter1 != mTexturesSizeMap.end(); ++iter1)
+ {
+ if (iter1->second > 0)
+ {
+ id_map_t::iterator iter2 = mHeaderIDMap.find(iter1->first);
+ if (iter2 != mHeaderIDMap.end())
+ {
+ S32 idx = iter2->second;
+ time_idx_set.insert(std::make_pair(entries[idx].mTime, idx));
+// LL_INFOS() << "TIME: " << entries[idx].mTime << " TEX: " << entries[idx].mID << " IDX: " << idx << " Size: " << entries[idx].mImageSize << LL_ENDL;
+ }
+ else
+ {
+ LL_ERRS() << "mTexturesSizeMap / mHeaderIDMap corrupted." << LL_ENDL ;
+ }
+ }
+ }
+
+ // Validate 1/256th of the files on startup
+ U32 validate_idx = 0;
+ if (validate)
+ {
+ validate_idx = gSavedSettings.getU32("CacheValidateCounter");
+ U32 next_idx = (validate_idx + 1) % 256;
+ gSavedSettings.setU32("CacheValidateCounter", next_idx);
+ LL_DEBUGS("TextureCache") << "TEXTURE CACHE: Validating: " << validate_idx << LL_ENDL;
+ }
+
+ S64 cache_size = mTexturesSizeTotal;
+ S64 purged_cache_size = (llmax(cache_size, sCacheMaxTexturesSize) * (S64)((1.f - TEXTURE_CACHE_PURGE_AMOUNT) * 100)) / 100;
+ S32 purge_count = 0;
+ for (time_idx_set_t::iterator iter = time_idx_set.begin();
+ iter != time_idx_set.end(); ++iter)
+ {
+ S32 idx = iter->second;
+ bool purge_entry = false;
+
+ if (cache_size >= purged_cache_size)
+ {
+ purge_entry = true;
+ }
+ else if (validate)
+ {
+ // make sure file exists and is the correct size
+ U32 uuididx = entries[idx].mID.mData[0];
+ if (uuididx == validate_idx)
+ {
+ std::string filename = getTextureFileName(entries[idx].mID);
+ LL_DEBUGS("TextureCache") << "Validating: " << filename << "Size: " << entries[idx].mBodySize << LL_ENDL;
+ // mHeaderAPRFilePoolp because this is under header mutex in main thread
+ S32 bodysize = LLAPRFile::size(filename, mHeaderAPRFilePoolp);
+ if (bodysize != entries[idx].mBodySize)
+ {
+ LL_WARNS("TextureCache") << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mBodySize << filename << LL_ENDL;
+ purge_entry = true;
+ }
+ }
+ }
+ else
+ {
+ break;
+ }
+
+ if (purge_entry)
+ {
+ purge_count++;
std::string filename = getTextureFileName(entries[idx].mID);
- LL_DEBUGS("TextureCache") << "PURGING: " << filename << LL_ENDL;
- cache_size -= entries[idx].mBodySize;
- removeEntry(idx, entries[idx], filename) ;
- }
- }
-
- LL_DEBUGS("TextureCache") << "TEXTURE CACHE: Writing Entries: " << num_entries << LL_ENDL;
-
- writeEntriesAndClose(entries);
-
- // *FIX:Mani - watchdog back on.
- LLAppViewer::instance()->resumeMainloopTimeout();
-
- LL_INFOS("TextureCache") << "TEXTURE CACHE:"
- << " PURGED: " << purge_count
- << " ENTRIES: " << num_entries
- << " CACHE SIZE: " << mTexturesSizeTotal / (1024 * 1024) << " MB"
- << LL_ENDL;
+ LL_DEBUGS("TextureCache") << "PURGING: " << filename << LL_ENDL;
+ cache_size -= entries[idx].mBodySize;
+ removeEntry(idx, entries[idx], filename) ;
+ }
+ }
+
+ LL_DEBUGS("TextureCache") << "TEXTURE CACHE: Writing Entries: " << num_entries << LL_ENDL;
+
+ writeEntriesAndClose(entries);
+
+ // *FIX:Mani - watchdog back on.
+ LLAppViewer::instance()->resumeMainloopTimeout();
+
+ LL_INFOS("TextureCache") << "TEXTURE CACHE:"
+ << " PURGED: " << purge_count
+ << " ENTRIES: " << num_entries
+ << " CACHE SIZE: " << mTexturesSizeTotal / (1024 * 1024) << " MB"
+ << LL_ENDL;
}
//////////////////////////////////////////////////////////////////////////////
@@ -1826,25 +1826,25 @@ void LLTextureCache::purgeTextures(bool validate)
LLTextureCacheWorker* LLTextureCache::getReader(handle_t handle)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- LLTextureCacheWorker* res = NULL;
- handle_map_t::iterator iter = mReaders.find(handle);
- if (iter != mReaders.end())
- {
- res = iter->second;
- }
- return res;
+ LLTextureCacheWorker* res = NULL;
+ handle_map_t::iterator iter = mReaders.find(handle);
+ if (iter != mReaders.end())
+ {
+ res = iter->second;
+ }
+ return res;
}
LLTextureCacheWorker* LLTextureCache::getWriter(handle_t handle)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- LLTextureCacheWorker* res = NULL;
- handle_map_t::iterator iter = mWriters.find(handle);
- if (iter != mWriters.end())
- {
- res = iter->second;
- }
- return res;
+ LLTextureCacheWorker* res = NULL;
+ handle_map_t::iterator iter = mWriters.find(handle);
+ if (iter != mWriters.end())
+ {
+ res = iter->second;
+ }
+ return res;
}
//////////////////////////////////////////////////////////////////////////////
@@ -1854,45 +1854,45 @@ LLTextureCacheWorker* LLTextureCache::getWriter(handle_t handle)
S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, Entry& entry)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- LLMutexLock lock(&mHeaderMutex);
- S32 idx = openAndReadEntry(id, entry, false);
- if (idx >= 0)
- {
- updateEntryTimeStamp(idx, entry); // updates time
- }
- return idx;
+ LLMutexLock lock(&mHeaderMutex);
+ S32 idx = openAndReadEntry(id, entry, false);
+ if (idx >= 0)
+ {
+ updateEntryTimeStamp(idx, entry); // updates time
+ }
+ return idx;
}
// Writes imagesize to the header, updates timestamp
S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imagesize, S32 datasize)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- mHeaderMutex.lock();
- S32 idx = openAndReadEntry(id, entry, true); // read or create
- mHeaderMutex.unlock();
-
- if(idx < 0) // retry once
- {
- readHeaderCache(); // We couldn't write an entry, so refresh the LRU
-
- mHeaderMutex.lock();
- idx = openAndReadEntry(id, entry, true);
- mHeaderMutex.unlock();
- }
-
- if (idx >= 0)
- {
- updateEntry(idx, entry, imagesize, datasize);
- }
- else
- {
- LL_WARNS() << "Failed to set cache entry for image: " << id << LL_ENDL;
- // We couldn't write to file, switch to read only mode and clear data
- setReadOnly(true);
- clearCorruptedCache(); // won't remove files due to "read only"
- }
-
- return idx;
+ mHeaderMutex.lock();
+ S32 idx = openAndReadEntry(id, entry, true); // read or create
+ mHeaderMutex.unlock();
+
+ if(idx < 0) // retry once
+ {
+ readHeaderCache(); // We couldn't write an entry, so refresh the LRU
+
+ mHeaderMutex.lock();
+ idx = openAndReadEntry(id, entry, true);
+ mHeaderMutex.unlock();
+ }
+
+ if (idx >= 0)
+ {
+ updateEntry(idx, entry, imagesize, datasize);
+ }
+ else
+ {
+ LL_WARNS() << "Failed to set cache entry for image: " << id << LL_ENDL;
+ // We couldn't write to file, switch to read only mode and clear data
+ setReadOnly(true);
+ clearCorruptedCache(); // won't remove files due to "read only"
+ }
+
+ return idx;
}
//////////////////////////////////////////////////////////////////////////////
@@ -1900,307 +1900,307 @@ S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imag
// Calls from texture pipeline thread (i.e. LLTextureFetch)
LLTextureCache::handle_t LLTextureCache::readFromCache(const std::string& filename, const LLUUID& id,
- S32 offset, S32 size, ReadResponder* responder)
+ S32 offset, S32 size, ReadResponder* responder)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- // Note: checking to see if an entry exists can cause a stall,
- // so let the thread handle it
- LLMutexLock lock(&mWorkersMutex);
- LLTextureCacheWorker* worker = new LLTextureCacheLocalFileWorker(this, filename, id,
- NULL, size, offset, 0,
- responder);
- handle_t handle = worker->read();
- mReaders[handle] = worker;
- return handle;
+ // Note: checking to see if an entry exists can cause a stall,
+ // so let the thread handle it
+ LLMutexLock lock(&mWorkersMutex);
+ LLTextureCacheWorker* worker = new LLTextureCacheLocalFileWorker(this, filename, id,
+ NULL, size, offset, 0,
+ responder);
+ handle_t handle = worker->read();
+ mReaders[handle] = worker;
+ return handle;
}
LLTextureCache::handle_t LLTextureCache::readFromCache(const LLUUID& id,
- S32 offset, S32 size, ReadResponder* responder)
+ S32 offset, S32 size, ReadResponder* responder)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- // Note: checking to see if an entry exists can cause a stall,
- // so let the thread handle it
- LLMutexLock lock(&mWorkersMutex);
- LLTextureCacheWorker* worker = new LLTextureCacheRemoteWorker(this, id,
- NULL, size, offset,
- 0, NULL, 0, responder);
- handle_t handle = worker->read();
- mReaders[handle] = worker;
- return handle;
+ // Note: checking to see if an entry exists can cause a stall,
+ // so let the thread handle it
+ LLMutexLock lock(&mWorkersMutex);
+ LLTextureCacheWorker* worker = new LLTextureCacheRemoteWorker(this, id,
+ NULL, size, offset,
+ 0, NULL, 0, responder);
+ handle_t handle = worker->read();
+ mReaders[handle] = worker;
+ return handle;
}
bool LLTextureCache::readComplete(handle_t handle, bool abort)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- lockWorkers();
- handle_map_t::iterator iter = mReaders.find(handle);
- LLTextureCacheWorker* worker = NULL;
- bool complete = false;
- if (iter != mReaders.end())
- {
- worker = iter->second;
- complete = worker->complete();
-
- if(!complete && abort)
- {
- abortRequest(handle, true) ;
- }
- }
- if (worker && (complete || abort))
- {
- mReaders.erase(iter);
- unlockWorkers();
- worker->scheduleDelete();
- }
- else
- {
- unlockWorkers();
- }
- return (complete || abort);
+ lockWorkers();
+ handle_map_t::iterator iter = mReaders.find(handle);
+ LLTextureCacheWorker* worker = NULL;
+ bool complete = false;
+ if (iter != mReaders.end())
+ {
+ worker = iter->second;
+ complete = worker->complete();
+
+ if(!complete && abort)
+ {
+ abortRequest(handle, true) ;
+ }
+ }
+ if (worker && (complete || abort))
+ {
+ mReaders.erase(iter);
+ unlockWorkers();
+ worker->scheduleDelete();
+ }
+ else
+ {
+ unlockWorkers();
+ }
+ return (complete || abort);
}
LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id,
- U8* data, S32 datasize, S32 imagesize,
- LLPointer<LLImageRaw> rawimage, S32 discardlevel,
- WriteResponder* responder)
+ U8* data, S32 datasize, S32 imagesize,
+ LLPointer<LLImageRaw> rawimage, S32 discardlevel,
+ WriteResponder* responder)
{
- if (mReadOnly)
- {
- delete responder;
- return LLWorkerThread::nullHandle();
- }
- if (mDoPurge)
- {
- // NOTE: Needs to be done on the control thread
- // (i.e. here)
- purgeTexturesLazy(TEXTURE_LAZY_PURGE_TIME_LIMIT);
- mDoPurge = !mPurgeEntryList.empty();
- }
- LLMutexLock lock(&mWorkersMutex);
- LLTextureCacheWorker* worker = new LLTextureCacheRemoteWorker(this, id,
- data, datasize, 0,
- imagesize, rawimage, discardlevel, responder);
- handle_t handle = worker->write();
- mWriters[handle] = worker;
- return handle;
+ if (mReadOnly)
+ {
+ delete responder;
+ return LLWorkerThread::nullHandle();
+ }
+ if (mDoPurge)
+ {
+ // NOTE: Needs to be done on the control thread
+ // (i.e. here)
+ purgeTexturesLazy(TEXTURE_LAZY_PURGE_TIME_LIMIT);
+ mDoPurge = !mPurgeEntryList.empty();
+ }
+ LLMutexLock lock(&mWorkersMutex);
+ LLTextureCacheWorker* worker = new LLTextureCacheRemoteWorker(this, id,
+ data, datasize, 0,
+ imagesize, rawimage, discardlevel, responder);
+ handle_t handle = worker->write();
+ mWriters[handle] = worker;
+ return handle;
}
//called in the main thread
LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& discardlevel)
{
- U32 offset;
- {
- LLMutexLock lock(&mHeaderMutex);
- id_map_t::const_iterator iter = mHeaderIDMap.find(id);
- if(iter == mHeaderIDMap.end())
- {
- return NULL; //not in the cache
- }
-
- offset = iter->second;
- }
- offset *= TEXTURE_FAST_CACHE_ENTRY_SIZE;
-
- U8* data;
- S32 head[4];
- {
- LLMutexLock lock(&mFastCacheMutex);
-
- openFastCache();
-
- mFastCachep->seek(APR_SET, offset);
-
- if(mFastCachep->read(head, TEXTURE_FAST_CACHE_ENTRY_OVERHEAD) != TEXTURE_FAST_CACHE_ENTRY_OVERHEAD)
- {
- //cache corrupted or under thread race condition
- closeFastCache();
- return NULL;
- }
-
- S32 image_size = head[0] * head[1] * head[2];
+ U32 offset;
+ {
+ LLMutexLock lock(&mHeaderMutex);
+ id_map_t::const_iterator iter = mHeaderIDMap.find(id);
+ if(iter == mHeaderIDMap.end())
+ {
+ return NULL; //not in the cache
+ }
+
+ offset = iter->second;
+ }
+ offset *= TEXTURE_FAST_CACHE_ENTRY_SIZE;
+
+ U8* data;
+ S32 head[4];
+ {
+ LLMutexLock lock(&mFastCacheMutex);
+
+ openFastCache();
+
+ mFastCachep->seek(APR_SET, offset);
+
+ if(mFastCachep->read(head, TEXTURE_FAST_CACHE_ENTRY_OVERHEAD) != TEXTURE_FAST_CACHE_ENTRY_OVERHEAD)
+ {
+ //cache corrupted or under thread race condition
+ closeFastCache();
+ return NULL;
+ }
+
+ S32 image_size = head[0] * head[1] * head[2];
if(image_size <= 0
|| image_size > TEXTURE_FAST_CACHE_DATA_SIZE
|| head[3] < 0) //invalid
- {
- closeFastCache();
- return NULL;
- }
- discardlevel = head[3];
-
- data = (U8*)ll_aligned_malloc_16(image_size);
- if(mFastCachep->read(data, image_size) != image_size)
- {
- ll_aligned_free_16(data);
- closeFastCache();
- return NULL;
- }
-
- closeFastCache();
- }
- LLPointer<LLImageRaw> raw = new LLImageRaw(data, head[0], head[1], head[2], true);
-
- return raw;
+ {
+ closeFastCache();
+ return NULL;
+ }
+ discardlevel = head[3];
+
+ data = (U8*)ll_aligned_malloc_16(image_size);
+ if(mFastCachep->read(data, image_size) != image_size)
+ {
+ ll_aligned_free_16(data);
+ closeFastCache();
+ return NULL;
+ }
+
+ closeFastCache();
+ }
+ LLPointer<LLImageRaw> raw = new LLImageRaw(data, head[0], head[1], head[2], true);
+
+ return raw;
}
//return the fast cache location
bool LLTextureCache::writeToFastCache(LLUUID image_id, S32 id, LLPointer<LLImageRaw> raw, S32 discardlevel)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- //rescale image if needed
- if (raw.isNull() || raw->isBufferInvalid() || !raw->getData())
- {
- LL_ERRS() << "Attempted to write NULL raw image to fastcache" << LL_ENDL;
- return false;
- }
-
- S32 w, h, c;
- w = raw->getWidth();
- h = raw->getHeight();
- c = raw->getComponents();
-
- S32 i = 0 ;
-
- // Search for a discard level that will fit into fast cache
- while(((w >> i) * (h >> i) * c) > TEXTURE_FAST_CACHE_DATA_SIZE)
- {
- ++i ;
- }
-
- if(i)
- {
- w >>= i;
- h >>= i;
- if(w * h *c > 0) //valid
- {
+ //rescale image if needed
+ if (raw.isNull() || raw->isBufferInvalid() || !raw->getData())
+ {
+ LL_ERRS() << "Attempted to write NULL raw image to fastcache" << LL_ENDL;
+ return false;
+ }
+
+ S32 w, h, c;
+ w = raw->getWidth();
+ h = raw->getHeight();
+ c = raw->getComponents();
+
+ S32 i = 0 ;
+
+ // Search for a discard level that will fit into fast cache
+ while(((w >> i) * (h >> i) * c) > TEXTURE_FAST_CACHE_DATA_SIZE)
+ {
+ ++i ;
+ }
+
+ if(i)
+ {
+ w >>= i;
+ h >>= i;
+ if(w * h *c > 0) //valid
+ {
// Make a duplicate to keep the original raw image untouched.
raw = raw->duplicate();
- if (raw->isBufferInvalid())
- {
- LL_WARNS() << "Invalid image duplicate buffer" << LL_ENDL;
- return false;
- }
-
- raw->scale(w, h);
-
- discardlevel += i ;
- }
- }
-
- //copy data
- memcpy(mFastCachePadBuffer, &w, sizeof(S32));
- memcpy(mFastCachePadBuffer + sizeof(S32), &h, sizeof(S32));
- memcpy(mFastCachePadBuffer + sizeof(S32) * 2, &c, sizeof(S32));
- memcpy(mFastCachePadBuffer + sizeof(S32) * 3, &discardlevel, sizeof(S32));
-
- S32 copy_size = w * h * c;
- if(copy_size > 0) //valid
- {
- copy_size = llmin(copy_size, TEXTURE_FAST_CACHE_ENTRY_SIZE - TEXTURE_FAST_CACHE_ENTRY_OVERHEAD);
- memcpy(mFastCachePadBuffer + TEXTURE_FAST_CACHE_ENTRY_OVERHEAD, raw->getData(), copy_size);
- }
- S32 offset = id * TEXTURE_FAST_CACHE_ENTRY_SIZE;
-
- {
- LLMutexLock lock(&mFastCacheMutex);
-
- openFastCache();
-
- mFastCachep->seek(APR_SET, offset);
-
- //no need to do this assertion check. When it fails, let it fail quietly.
- //this failure could happen because other viewer removes the fast cache file when clearing cache.
- //--> llassert_always(mFastCachep->write(mFastCachePadBuffer, TEXTURE_FAST_CACHE_ENTRY_SIZE) == TEXTURE_FAST_CACHE_ENTRY_SIZE);
- mFastCachep->write(mFastCachePadBuffer, TEXTURE_FAST_CACHE_ENTRY_SIZE);
-
- closeFastCache(true);
- }
-
- return true;
+ if (raw->isBufferInvalid())
+ {
+ LL_WARNS() << "Invalid image duplicate buffer" << LL_ENDL;
+ return false;
+ }
+
+ raw->scale(w, h);
+
+ discardlevel += i ;
+ }
+ }
+
+ //copy data
+ memcpy(mFastCachePadBuffer, &w, sizeof(S32));
+ memcpy(mFastCachePadBuffer + sizeof(S32), &h, sizeof(S32));
+ memcpy(mFastCachePadBuffer + sizeof(S32) * 2, &c, sizeof(S32));
+ memcpy(mFastCachePadBuffer + sizeof(S32) * 3, &discardlevel, sizeof(S32));
+
+ S32 copy_size = w * h * c;
+ if(copy_size > 0) //valid
+ {
+ copy_size = llmin(copy_size, TEXTURE_FAST_CACHE_ENTRY_SIZE - TEXTURE_FAST_CACHE_ENTRY_OVERHEAD);
+ memcpy(mFastCachePadBuffer + TEXTURE_FAST_CACHE_ENTRY_OVERHEAD, raw->getData(), copy_size);
+ }
+ S32 offset = id * TEXTURE_FAST_CACHE_ENTRY_SIZE;
+
+ {
+ LLMutexLock lock(&mFastCacheMutex);
+
+ openFastCache();
+
+ mFastCachep->seek(APR_SET, offset);
+
+ //no need to do this assertion check. When it fails, let it fail quietly.
+ //this failure could happen because other viewer removes the fast cache file when clearing cache.
+ //--> llassert_always(mFastCachep->write(mFastCachePadBuffer, TEXTURE_FAST_CACHE_ENTRY_SIZE) == TEXTURE_FAST_CACHE_ENTRY_SIZE);
+ mFastCachep->write(mFastCachePadBuffer, TEXTURE_FAST_CACHE_ENTRY_SIZE);
+
+ closeFastCache(true);
+ }
+
+ return true;
}
void LLTextureCache::openFastCache(bool first_time)
{
- if(!mFastCachep)
- {
- if(first_time)
- {
- if(!mFastCachePadBuffer)
- {
- mFastCachePadBuffer = (U8*)ll_aligned_malloc_16(TEXTURE_FAST_CACHE_ENTRY_SIZE);
- }
- mFastCachePoolp = new LLVolatileAPRPool(); // is_local= true by default, so not thread safe by default
- if (LLAPRFile::isExist(mFastCacheFileName, mFastCachePoolp))
- {
- mFastCachep = new LLAPRFile(mFastCacheFileName, APR_READ|APR_WRITE|APR_BINARY, mFastCachePoolp) ;
- }
- else
- {
- mFastCachep = new LLAPRFile(mFastCacheFileName, APR_CREATE|APR_READ|APR_WRITE|APR_BINARY, mFastCachePoolp) ;
- }
- }
- else
- {
- mFastCachep = new LLAPRFile(mFastCacheFileName, APR_READ|APR_WRITE|APR_BINARY, mFastCachePoolp) ;
- }
-
- mFastCacheTimer.reset();
- }
- return;
+ if(!mFastCachep)
+ {
+ if(first_time)
+ {
+ if(!mFastCachePadBuffer)
+ {
+ mFastCachePadBuffer = (U8*)ll_aligned_malloc_16(TEXTURE_FAST_CACHE_ENTRY_SIZE);
+ }
+ mFastCachePoolp = new LLVolatileAPRPool(); // is_local= true by default, so not thread safe by default
+ if (LLAPRFile::isExist(mFastCacheFileName, mFastCachePoolp))
+ {
+ mFastCachep = new LLAPRFile(mFastCacheFileName, APR_READ|APR_WRITE|APR_BINARY, mFastCachePoolp) ;
+ }
+ else
+ {
+ mFastCachep = new LLAPRFile(mFastCacheFileName, APR_CREATE|APR_READ|APR_WRITE|APR_BINARY, mFastCachePoolp) ;
+ }
+ }
+ else
+ {
+ mFastCachep = new LLAPRFile(mFastCacheFileName, APR_READ|APR_WRITE|APR_BINARY, mFastCachePoolp) ;
+ }
+
+ mFastCacheTimer.reset();
+ }
+ return;
}
-
+
void LLTextureCache::closeFastCache(bool forced)
-{
- static const F32 timeout = 10.f ; //seconds
-
- if(!mFastCachep)
- {
- return ;
- }
-
- if(!forced && mFastCacheTimer.getElapsedTimeF32() < timeout)
- {
- return ;
- }
-
- delete mFastCachep;
- mFastCachep = NULL;
- return;
+{
+ static const F32 timeout = 10.f ; //seconds
+
+ if(!mFastCachep)
+ {
+ return ;
+ }
+
+ if(!forced && mFastCacheTimer.getElapsedTimeF32() < timeout)
+ {
+ return ;
+ }
+
+ delete mFastCachep;
+ mFastCachep = NULL;
+ return;
}
-
+
bool LLTextureCache::writeComplete(handle_t handle, bool abort)
{
- lockWorkers();
- handle_map_t::iterator iter = mWriters.find(handle);
- llassert(iter != mWriters.end());
- if (iter != mWriters.end())
- {
- LLTextureCacheWorker* worker = iter->second;
- if (worker->complete() || abort)
- {
- mWriters.erase(handle);
- unlockWorkers();
- worker->scheduleDelete();
- return true;
- }
- }
- unlockWorkers();
- return false;
+ lockWorkers();
+ handle_map_t::iterator iter = mWriters.find(handle);
+ llassert(iter != mWriters.end());
+ if (iter != mWriters.end())
+ {
+ LLTextureCacheWorker* worker = iter->second;
+ if (worker->complete() || abort)
+ {
+ mWriters.erase(handle);
+ unlockWorkers();
+ worker->scheduleDelete();
+ return true;
+ }
+ }
+ unlockWorkers();
+ return false;
}
void LLTextureCache::prioritizeWrite(handle_t handle)
{
- // Don't prioritize yet, we might be working on this now
- // which could create a deadlock
- LLMutexLock lock(&mListMutex);
- mPrioritizeWriteList.push_back(handle);
+ // Don't prioritize yet, we might be working on this now
+ // which could create a deadlock
+ LLMutexLock lock(&mListMutex);
+ mPrioritizeWriteList.push_back(handle);
}
void LLTextureCache::addCompleted(Responder* responder, bool success)
{
- LLMutexLock lock(&mListMutex);
- mCompletedList.push_back(std::make_pair(responder,success));
+ LLMutexLock lock(&mListMutex);
+ mCompletedList.push_back(std::make_pair(responder,success));
}
//////////////////////////////////////////////////////////////////////////////
@@ -2208,98 +2208,98 @@ void LLTextureCache::addCompleted(Responder* responder, bool success)
//called after mHeaderMutex is locked.
void LLTextureCache::removeCachedTexture(const LLUUID& id)
{
- if(mTexturesSizeMap.find(id) != mTexturesSizeMap.end())
- {
- mTexturesSizeTotal -= mTexturesSizeMap[id] ;
- mTexturesSizeMap.erase(id);
- }
- mHeaderIDMap.erase(id);
- // We are inside header's mutex so mHeaderAPRFilePoolp is safe to use,
- // but getLocalAPRFilePool() is not safe, it might be in use by worker
- LLAPRFile::remove(getTextureFileName(id), mHeaderAPRFilePoolp);
+ if(mTexturesSizeMap.find(id) != mTexturesSizeMap.end())
+ {
+ mTexturesSizeTotal -= mTexturesSizeMap[id] ;
+ mTexturesSizeMap.erase(id);
+ }
+ mHeaderIDMap.erase(id);
+ // We are inside header's mutex so mHeaderAPRFilePoolp is safe to use,
+ // but getLocalAPRFilePool() is not safe, it might be in use by worker
+ LLAPRFile::remove(getTextureFileName(id), mHeaderAPRFilePoolp);
}
//called after mHeaderMutex is locked.
void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename)
{
- bool file_maybe_exists = true; // Always attempt to remove when idx is invalid.
-
- if(idx >= 0) //valid entry
- {
- if (entry.mBodySize == 0) // Always attempt to remove when mBodySize > 0.
- {
- // Sanity check. Shouldn't exist when body size is 0.
- // We are inside header's mutex so mHeaderAPRFilePoolp is safe to use,
- // but getLocalAPRFilePool() is not safe, it might be in use by worker
- if (LLAPRFile::isExist(filename, mHeaderAPRFilePoolp))
- {
- LL_WARNS("TextureCache") << "Entry has body size of zero but file " << filename << " exists. Deleting this file, too." << LL_ENDL;
- }
- else
- {
- file_maybe_exists = false;
- }
- }
- mTexturesSizeTotal -= entry.mBodySize;
-
- entry.mImageSize = -1;
- entry.mBodySize = 0;
- mHeaderIDMap.erase(entry.mID);
- mTexturesSizeMap.erase(entry.mID);
- mFreeList.insert(idx);
- }
-
- if (file_maybe_exists)
- {
- LLAPRFile::remove(filename, mHeaderAPRFilePoolp);
- }
+ bool file_maybe_exists = true; // Always attempt to remove when idx is invalid.
+
+ if(idx >= 0) //valid entry
+ {
+ if (entry.mBodySize == 0) // Always attempt to remove when mBodySize > 0.
+ {
+ // Sanity check. Shouldn't exist when body size is 0.
+ // We are inside header's mutex so mHeaderAPRFilePoolp is safe to use,
+ // but getLocalAPRFilePool() is not safe, it might be in use by worker
+ if (LLAPRFile::isExist(filename, mHeaderAPRFilePoolp))
+ {
+ LL_WARNS("TextureCache") << "Entry has body size of zero but file " << filename << " exists. Deleting this file, too." << LL_ENDL;
+ }
+ else
+ {
+ file_maybe_exists = false;
+ }
+ }
+ mTexturesSizeTotal -= entry.mBodySize;
+
+ entry.mImageSize = -1;
+ entry.mBodySize = 0;
+ mHeaderIDMap.erase(entry.mID);
+ mTexturesSizeMap.erase(entry.mID);
+ mFreeList.insert(idx);
+ }
+
+ if (file_maybe_exists)
+ {
+ LLAPRFile::remove(filename, mHeaderAPRFilePoolp);
+ }
}
bool LLTextureCache::removeFromCache(const LLUUID& id)
{
- //LL_WARNS() << "Removing texture from cache: " << id << LL_ENDL;
- bool ret = false ;
- if (!mReadOnly)
- {
- lockHeaders() ;
-
- Entry entry;
- S32 idx = openAndReadEntry(id, entry, false);
- std::string tex_filename = getTextureFileName(id);
- removeEntry(idx, entry, tex_filename) ;
- if (idx >= 0)
- {
- writeEntryToHeaderImmediately(idx, entry);
- ret = true;
- }
-
- unlockHeaders() ;
- }
- return ret ;
+ //LL_WARNS() << "Removing texture from cache: " << id << LL_ENDL;
+ bool ret = false ;
+ if (!mReadOnly)
+ {
+ lockHeaders() ;
+
+ Entry entry;
+ S32 idx = openAndReadEntry(id, entry, false);
+ std::string tex_filename = getTextureFileName(id);
+ removeEntry(idx, entry, tex_filename) ;
+ if (idx >= 0)
+ {
+ writeEntryToHeaderImmediately(idx, entry);
+ ret = true;
+ }
+
+ unlockHeaders() ;
+ }
+ return ret ;
}
//////////////////////////////////////////////////////////////////////////////
LLTextureCache::ReadResponder::ReadResponder()
- : mImageSize(0),
- mImageLocal(FALSE)
+ : mImageSize(0),
+ mImageLocal(FALSE)
{
}
void LLTextureCache::ReadResponder::setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal)
{
- if (mFormattedImage.notNull())
- {
- llassert_always(mFormattedImage->getCodec() == imageformat);
- mFormattedImage->appendData(data, datasize);
- }
- else
- {
- mFormattedImage = LLImageFormatted::createFromType(imageformat);
- mFormattedImage->setData(data,datasize);
- }
- mImageSize = imagesize;
- mImageLocal = imagelocal;
+ if (mFormattedImage.notNull())
+ {
+ llassert_always(mFormattedImage->getCodec() == imageformat);
+ mFormattedImage->appendData(data, datasize);
+ }
+ else
+ {
+ mFormattedImage = LLImageFormatted::createFromType(imageformat);
+ mFormattedImage->setData(data,datasize);
+ }
+ mImageSize = imagesize;
+ mImageLocal = imagelocal;
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h
index 43e91b3e4c..6aa3a51e18 100644
--- a/indra/newview/lltexturecache.h
+++ b/indra/newview/lltexturecache.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexturecache.h
* @brief Object for managing texture cachees.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,9 +40,9 @@ class LLImageRaw;
class LLTextureCache : public LLWorkerThread
{
- friend class LLTextureCacheWorker;
- friend class LLTextureCacheRemoteWorker;
- friend class LLTextureCacheLocalFileWorker;
+ friend class LLTextureCacheWorker;
+ friend class LLTextureCacheRemoteWorker;
+ friend class LLTextureCacheLocalFileWorker;
private:
@@ -50,33 +50,33 @@ private:
#pragma pack(push,1)
#endif
- // Entries
- static const U32 sHeaderEncoderStringSize = 32;
- struct EntriesInfo
- {
- EntriesInfo() : mVersion(0.f), mAdressSize(0), mEntries(0) { memset(mEncoderVersion, 0, sHeaderEncoderStringSize); }
- F32 mVersion;
- U32 mAdressSize;
- char mEncoderVersion[sHeaderEncoderStringSize];
- U32 mEntries;
- };
- struct Entry
- {
- Entry() :
- mBodySize(0),
- mImageSize(0),
- mTime(0)
- {
- }
- Entry(const LLUUID& id, S32 imagesize, S32 bodysize, U32 time) :
- mID(id), mImageSize(imagesize), mBodySize(bodysize), mTime(time) {}
- void init(const LLUUID& id, U32 time) { mID = id, mImageSize = 0; mBodySize = 0; mTime = time; }
- Entry& operator=(const Entry& entry) {mID = entry.mID, mImageSize = entry.mImageSize; mBodySize = entry.mBodySize; mTime = entry.mTime; return *this;}
- LLUUID mID; // 16 bytes
- S32 mImageSize; // total size of image if known
- S32 mBodySize; // size of body file in body cache
- U32 mTime; // seconds since 1/1/1970
- };
+ // Entries
+ static const U32 sHeaderEncoderStringSize = 32;
+ struct EntriesInfo
+ {
+ EntriesInfo() : mVersion(0.f), mAdressSize(0), mEntries(0) { memset(mEncoderVersion, 0, sHeaderEncoderStringSize); }
+ F32 mVersion;
+ U32 mAdressSize;
+ char mEncoderVersion[sHeaderEncoderStringSize];
+ U32 mEntries;
+ };
+ struct Entry
+ {
+ Entry() :
+ mBodySize(0),
+ mImageSize(0),
+ mTime(0)
+ {
+ }
+ Entry(const LLUUID& id, S32 imagesize, S32 bodysize, U32 time) :
+ mID(id), mImageSize(imagesize), mBodySize(bodysize), mTime(time) {}
+ void init(const LLUUID& id, U32 time) { mID = id, mImageSize = 0; mBodySize = 0; mTime = time; }
+ Entry& operator=(const Entry& entry) {mID = entry.mID, mImageSize = entry.mImageSize; mBodySize = entry.mBodySize; mTime = entry.mTime; return *this;}
+ LLUUID mID; // 16 bytes
+ S32 mImageSize; // total size of image if known
+ S32 mBodySize; // size of body file in body cache
+ U32 mTime; // seconds since 1/1/1970
+ };
#if LL_WINDOWS
#pragma pack(pop)
@@ -84,170 +84,170 @@ private:
public:
- class Responder : public LLResponder
- {
- public:
- virtual void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal) = 0;
- };
-
- class ReadResponder : public Responder
- {
- public:
- ReadResponder();
- void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal);
- void setImage(LLImageFormatted* image) { mFormattedImage = image; }
- protected:
- LLPointer<LLImageFormatted> mFormattedImage;
- S32 mImageSize;
- BOOL mImageLocal;
- };
-
- class WriteResponder : public Responder
- {
- void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal)
- {
- // not used
- }
- };
-
- LLTextureCache(bool threaded);
- ~LLTextureCache();
-
- /*virtual*/ size_t update(F32 max_time_ms);
-
- void purgeCache(ELLPath location, bool remove_dir = true);
- void setReadOnly(BOOL read_only) ;
- S64 initCache(ELLPath location, S64 maxsize, BOOL texture_cache_mismatch);
-
- handle_t readFromCache(const std::string& local_filename, const LLUUID& id, S32 offset, S32 size,
- ReadResponder* responder);
-
- handle_t readFromCache(const LLUUID& id, S32 offset, S32 size,
- ReadResponder* responder);
- bool readComplete(handle_t handle, bool abort);
- handle_t writeToCache(const LLUUID& id, U8* data, S32 datasize, S32 imagesize, LLPointer<LLImageRaw> rawimage, S32 discardlevel,
- WriteResponder* responder);
- LLPointer<LLImageRaw> readFromFastCache(const LLUUID& id, S32& discardlevel);
- bool writeComplete(handle_t handle, bool abort = false);
- void prioritizeWrite(handle_t handle);
-
- bool removeFromCache(const LLUUID& id);
-
- // For LLTextureCacheWorker::Responder
- LLTextureCacheWorker* getReader(handle_t handle);
- LLTextureCacheWorker* getWriter(handle_t handle);
- void lockWorkers() { mWorkersMutex.lock(); }
- void unlockWorkers() { mWorkersMutex.unlock(); }
-
- // debug
- S32 getNumReads() { return mReaders.size(); }
- S32 getNumWrites() { return mWriters.size(); }
- S64Bytes getUsage() { return S64Bytes(mTexturesSizeTotal); }
- S64Bytes getMaxUsage() { return S64Bytes(sCacheMaxTexturesSize); }
- U32 getEntries() { return mHeaderEntriesInfo.mEntries; }
- U32 getMaxEntries() { return sCacheMaxEntries; };
- BOOL isInCache(const LLUUID& id) ;
- BOOL isInLocal(const LLUUID& id) ; //not thread safe at the moment
+ class Responder : public LLResponder
+ {
+ public:
+ virtual void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal) = 0;
+ };
+
+ class ReadResponder : public Responder
+ {
+ public:
+ ReadResponder();
+ void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal);
+ void setImage(LLImageFormatted* image) { mFormattedImage = image; }
+ protected:
+ LLPointer<LLImageFormatted> mFormattedImage;
+ S32 mImageSize;
+ BOOL mImageLocal;
+ };
+
+ class WriteResponder : public Responder
+ {
+ void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal)
+ {
+ // not used
+ }
+ };
+
+ LLTextureCache(bool threaded);
+ ~LLTextureCache();
+
+ /*virtual*/ size_t update(F32 max_time_ms);
+
+ void purgeCache(ELLPath location, bool remove_dir = true);
+ void setReadOnly(BOOL read_only) ;
+ S64 initCache(ELLPath location, S64 maxsize, BOOL texture_cache_mismatch);
+
+ handle_t readFromCache(const std::string& local_filename, const LLUUID& id, S32 offset, S32 size,
+ ReadResponder* responder);
+
+ handle_t readFromCache(const LLUUID& id, S32 offset, S32 size,
+ ReadResponder* responder);
+ bool readComplete(handle_t handle, bool abort);
+ handle_t writeToCache(const LLUUID& id, U8* data, S32 datasize, S32 imagesize, LLPointer<LLImageRaw> rawimage, S32 discardlevel,
+ WriteResponder* responder);
+ LLPointer<LLImageRaw> readFromFastCache(const LLUUID& id, S32& discardlevel);
+ bool writeComplete(handle_t handle, bool abort = false);
+ void prioritizeWrite(handle_t handle);
+
+ bool removeFromCache(const LLUUID& id);
+
+ // For LLTextureCacheWorker::Responder
+ LLTextureCacheWorker* getReader(handle_t handle);
+ LLTextureCacheWorker* getWriter(handle_t handle);
+ void lockWorkers() { mWorkersMutex.lock(); }
+ void unlockWorkers() { mWorkersMutex.unlock(); }
+
+ // debug
+ S32 getNumReads() { return mReaders.size(); }
+ S32 getNumWrites() { return mWriters.size(); }
+ S64Bytes getUsage() { return S64Bytes(mTexturesSizeTotal); }
+ S64Bytes getMaxUsage() { return S64Bytes(sCacheMaxTexturesSize); }
+ U32 getEntries() { return mHeaderEntriesInfo.mEntries; }
+ U32 getMaxEntries() { return sCacheMaxEntries; };
+ BOOL isInCache(const LLUUID& id) ;
+ BOOL isInLocal(const LLUUID& id) ; //not thread safe at the moment
protected:
- // Accessed by LLTextureCacheWorker
- std::string getLocalFileName(const LLUUID& id);
- std::string getTextureFileName(const LLUUID& id);
- void addCompleted(Responder* responder, bool success);
-
+ // Accessed by LLTextureCacheWorker
+ std::string getLocalFileName(const LLUUID& id);
+ std::string getTextureFileName(const LLUUID& id);
+ void addCompleted(Responder* responder, bool success);
+
protected:
- //void setFileAPRPool(apr_pool_t* pool) { mFileAPRPool = pool ; }
+ //void setFileAPRPool(apr_pool_t* pool) { mFileAPRPool = pool ; }
private:
- void setDirNames(ELLPath location);
- void readHeaderCache();
- void clearCorruptedCache();
- void purgeAllTextures(bool purge_directories);
- void purgeTexturesLazy(F32 time_limit_sec);
- void purgeTextures(bool validate);
- LLAPRFile* openHeaderEntriesFile(bool readonly, S32 offset);
- void closeHeaderEntriesFile();
- void readEntriesHeader();
- void setEntriesHeader();
- void writeEntriesHeader();
- S32 openAndReadEntry(const LLUUID& id, Entry& entry, bool create);
- bool updateEntry(S32& idx, Entry& entry, S32 new_image_size, S32 new_body_size);
- void updateEntryTimeStamp(S32 idx, Entry& entry) ;
- U32 openAndReadEntries(std::vector<Entry>& entries);
- void writeEntriesAndClose(const std::vector<Entry>& entries);
- void readEntryFromHeaderImmediately(S32& idx, Entry& entry) ;
- void writeEntryToHeaderImmediately(S32& idx, Entry& entry, bool write_header = false) ;
- void removeEntry(S32 idx, Entry& entry, std::string& filename);
- void removeCachedTexture(const LLUUID& id) ;
- S32 getHeaderCacheEntry(const LLUUID& id, Entry& entry);
- S32 setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imagesize, S32 datasize);
- void writeUpdatedEntries() ;
- void updatedHeaderEntriesFile() ;
- void lockHeaders() { mHeaderMutex.lock(); }
- void unlockHeaders() { mHeaderMutex.unlock(); }
-
- void openFastCache(bool first_time = false);
- void closeFastCache(bool forced = false);
- bool writeToFastCache(LLUUID image_id, S32 cache_id, LLPointer<LLImageRaw> raw, S32 discardlevel);
+ void setDirNames(ELLPath location);
+ void readHeaderCache();
+ void clearCorruptedCache();
+ void purgeAllTextures(bool purge_directories);
+ void purgeTexturesLazy(F32 time_limit_sec);
+ void purgeTextures(bool validate);
+ LLAPRFile* openHeaderEntriesFile(bool readonly, S32 offset);
+ void closeHeaderEntriesFile();
+ void readEntriesHeader();
+ void setEntriesHeader();
+ void writeEntriesHeader();
+ S32 openAndReadEntry(const LLUUID& id, Entry& entry, bool create);
+ bool updateEntry(S32& idx, Entry& entry, S32 new_image_size, S32 new_body_size);
+ void updateEntryTimeStamp(S32 idx, Entry& entry) ;
+ U32 openAndReadEntries(std::vector<Entry>& entries);
+ void writeEntriesAndClose(const std::vector<Entry>& entries);
+ void readEntryFromHeaderImmediately(S32& idx, Entry& entry) ;
+ void writeEntryToHeaderImmediately(S32& idx, Entry& entry, bool write_header = false) ;
+ void removeEntry(S32 idx, Entry& entry, std::string& filename);
+ void removeCachedTexture(const LLUUID& id) ;
+ S32 getHeaderCacheEntry(const LLUUID& id, Entry& entry);
+ S32 setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imagesize, S32 datasize);
+ void writeUpdatedEntries() ;
+ void updatedHeaderEntriesFile() ;
+ void lockHeaders() { mHeaderMutex.lock(); }
+ void unlockHeaders() { mHeaderMutex.unlock(); }
+
+ void openFastCache(bool first_time = false);
+ void closeFastCache(bool forced = false);
+ bool writeToFastCache(LLUUID image_id, S32 cache_id, LLPointer<LLImageRaw> raw, S32 discardlevel);
private:
- // Internal
- LLMutex mWorkersMutex;
- LLMutex mHeaderMutex;
- LLMutex mListMutex;
- LLMutex mFastCacheMutex;
- LLAPRFile* mHeaderAPRFile;
- LLVolatileAPRPool* mFastCachePoolp;
-
- // mLocalAPRFilePoolp is not thread safe and is meant only for workers
- // howhever mHeaderEntriesFileName is accessed not from workers' threads
- // so it needs own pool (not thread safe by itself, relies onto header's mutex)
- LLVolatileAPRPool* mHeaderAPRFilePoolp;
-
- typedef std::map<handle_t, LLTextureCacheWorker*> handle_map_t;
- handle_map_t mReaders;
- handle_map_t mWriters;
-
- typedef std::vector<handle_t> handle_list_t;
- handle_list_t mPrioritizeWriteList;
-
- typedef std::vector<std::pair<LLPointer<Responder>, bool> > responder_list_t;
- responder_list_t mCompletedList;
-
- BOOL mReadOnly;
-
- // HEADERS (Include first mip)
- std::string mHeaderEntriesFileName;
- std::string mHeaderDataFileName;
- std::string mFastCacheFileName;
- EntriesInfo mHeaderEntriesInfo;
- std::set<S32> mFreeList; // deleted entries
- std::set<LLUUID> mLRU;
- typedef std::map<LLUUID, S32> id_map_t;
- id_map_t mHeaderIDMap;
-
- LLAPRFile* mFastCachep;
- LLFrameTimer mFastCacheTimer;
- U8* mFastCachePadBuffer;
-
- // BODIES (TEXTURES minus headers)
- std::string mTexturesDirName;
- typedef std::map<LLUUID,S32> size_map_t;
- size_map_t mTexturesSizeMap;
- S64 mTexturesSizeTotal;
- LLAtomicBool mDoPurge;
-
- typedef std::map<S32, Entry> idx_entry_map_t;
- idx_entry_map_t mUpdatedEntryMap;
- typedef std::vector<std::pair<S32, Entry> > idx_entry_vector_t;
- idx_entry_vector_t mPurgeEntryList;
-
- // Statics
- static F32 sHeaderCacheVersion;
- static U32 sHeaderCacheAddressSize;
- static std::string sHeaderCacheEncoderVersion;
- static U32 sCacheMaxEntries;
- static S64 sCacheMaxTexturesSize;
+ // Internal
+ LLMutex mWorkersMutex;
+ LLMutex mHeaderMutex;
+ LLMutex mListMutex;
+ LLMutex mFastCacheMutex;
+ LLAPRFile* mHeaderAPRFile;
+ LLVolatileAPRPool* mFastCachePoolp;
+
+ // mLocalAPRFilePoolp is not thread safe and is meant only for workers
+ // howhever mHeaderEntriesFileName is accessed not from workers' threads
+ // so it needs own pool (not thread safe by itself, relies onto header's mutex)
+ LLVolatileAPRPool* mHeaderAPRFilePoolp;
+
+ typedef std::map<handle_t, LLTextureCacheWorker*> handle_map_t;
+ handle_map_t mReaders;
+ handle_map_t mWriters;
+
+ typedef std::vector<handle_t> handle_list_t;
+ handle_list_t mPrioritizeWriteList;
+
+ typedef std::vector<std::pair<LLPointer<Responder>, bool> > responder_list_t;
+ responder_list_t mCompletedList;
+
+ BOOL mReadOnly;
+
+ // HEADERS (Include first mip)
+ std::string mHeaderEntriesFileName;
+ std::string mHeaderDataFileName;
+ std::string mFastCacheFileName;
+ EntriesInfo mHeaderEntriesInfo;
+ std::set<S32> mFreeList; // deleted entries
+ std::set<LLUUID> mLRU;
+ typedef std::map<LLUUID, S32> id_map_t;
+ id_map_t mHeaderIDMap;
+
+ LLAPRFile* mFastCachep;
+ LLFrameTimer mFastCacheTimer;
+ U8* mFastCachePadBuffer;
+
+ // BODIES (TEXTURES minus headers)
+ std::string mTexturesDirName;
+ typedef std::map<LLUUID,S32> size_map_t;
+ size_map_t mTexturesSizeMap;
+ S64 mTexturesSizeTotal;
+ LLAtomicBool mDoPurge;
+
+ typedef std::map<S32, Entry> idx_entry_map_t;
+ idx_entry_map_t mUpdatedEntryMap;
+ typedef std::vector<std::pair<S32, Entry> > idx_entry_vector_t;
+ idx_entry_vector_t mPurgeEntryList;
+
+ // Statics
+ static F32 sHeaderCacheVersion;
+ static U32 sHeaderCacheAddressSize;
+ static std::string sHeaderCacheEncoderVersion;
+ static U32 sCacheMaxEntries;
+ static S64 sCacheMaxTexturesSize;
};
extern const S32 TEXTURE_CACHE_ENTRY_SIZE;
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 62d3fa28bf..fbbec56020 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lltexturectrl.cpp
* @author Richard Nelson, James Cook
* @brief LLTextureCtrl class implementation including related functions
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,7 +49,7 @@
#include "llmaterialeditor.h"
#include "llui.h"
#include "llviewerinventory.h"
-#include "llviewermenufile.h" // LLFilePickerReplyThread
+#include "llviewermenufile.h" // LLFilePickerReplyThread
#include "llpermissions.h"
#include "llpreviewtexture.h"
#include "llsaleinfo.h"
@@ -104,7 +104,7 @@ LLUUID get_copy_free_item_by_asset_id(LLUUID asset_id, bool no_trans_perm)
items,
LLInventoryModel::INCLUDE_TRASH,
asset_id_matches);
-
+
LLUUID res;
if (items.size())
{
@@ -142,53 +142,53 @@ bool get_can_copy_texture(LLUUID asset_id)
S32 LLFloaterTexturePicker::sLastPickerMode = 0;
-LLFloaterTexturePicker::LLFloaterTexturePicker(
- LLView* owner,
- LLUUID image_asset_id,
- LLUUID default_image_asset_id,
- LLUUID blank_image_asset_id,
- BOOL tentative,
- BOOL allow_no_texture,
- const std::string& label,
- PermissionMask immediate_filter_perm_mask,
- PermissionMask dnd_filter_perm_mask,
- BOOL can_apply_immediately,
- LLUIImagePtr fallback_image,
+LLFloaterTexturePicker::LLFloaterTexturePicker(
+ LLView* owner,
+ LLUUID image_asset_id,
+ LLUUID default_image_asset_id,
+ LLUUID blank_image_asset_id,
+ BOOL tentative,
+ BOOL allow_no_texture,
+ const std::string& label,
+ PermissionMask immediate_filter_perm_mask,
+ PermissionMask dnd_filter_perm_mask,
+ BOOL can_apply_immediately,
+ LLUIImagePtr fallback_image,
EPickInventoryType pick_type)
-: LLFloater(LLSD()),
- mOwner( owner ),
- mImageAssetID( image_asset_id ),
- mOriginalImageAssetID(image_asset_id),
- mFallbackImage(fallback_image),
- mDefaultImageAssetID(default_image_asset_id),
- mBlankImageAssetID(blank_image_asset_id),
- mTentative(tentative),
- mAllowNoTexture(allow_no_texture),
- mLabel(label),
- mTentativeLabel(NULL),
- mResolutionLabel(NULL),
- mActive( TRUE ),
- mFilterEdit(NULL),
- mImmediateFilterPermMask(immediate_filter_perm_mask),
- mDnDFilterPermMask(dnd_filter_perm_mask),
- mContextConeOpacity(0.f),
- mSelectedItemPinned( FALSE ),
- mCanApply(true),
- mCanPreview(true),
+: LLFloater(LLSD()),
+ mOwner( owner ),
+ mImageAssetID( image_asset_id ),
+ mOriginalImageAssetID(image_asset_id),
+ mFallbackImage(fallback_image),
+ mDefaultImageAssetID(default_image_asset_id),
+ mBlankImageAssetID(blank_image_asset_id),
+ mTentative(tentative),
+ mAllowNoTexture(allow_no_texture),
+ mLabel(label),
+ mTentativeLabel(NULL),
+ mResolutionLabel(NULL),
+ mActive( TRUE ),
+ mFilterEdit(NULL),
+ mImmediateFilterPermMask(immediate_filter_perm_mask),
+ mDnDFilterPermMask(dnd_filter_perm_mask),
+ mContextConeOpacity(0.f),
+ mSelectedItemPinned( FALSE ),
+ mCanApply(true),
+ mCanPreview(true),
mLimitsSet(false),
mMaxDim(S32_MAX),
mMinDim(0),
- mPreviewSettingChanged(false),
- mOnFloaterCommitCallback(NULL),
- mOnFloaterCloseCallback(NULL),
- mSetImageAssetIDCallback(NULL),
- mOnUpdateImageStatsCallback(NULL),
- mBakeTextureEnabled(FALSE),
+ mPreviewSettingChanged(false),
+ mOnFloaterCommitCallback(NULL),
+ mOnFloaterCloseCallback(NULL),
+ mSetImageAssetIDCallback(NULL),
+ mOnUpdateImageStatsCallback(NULL),
+ mBakeTextureEnabled(FALSE),
mInventoryPickType(pick_type)
{
- mCanApplyImmediately = can_apply_immediately;
- buildFromFile("floater_texture_ctrl.xml");
- setCanMinimize(FALSE);
+ mCanApplyImmediately = can_apply_immediately;
+ buildFromFile("floater_texture_ctrl.xml");
+ setCanMinimize(FALSE);
}
LLFloaterTexturePicker::~LLFloaterTexturePicker()
@@ -197,27 +197,27 @@ LLFloaterTexturePicker::~LLFloaterTexturePicker()
void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selection /*=true*/)
{
- if( ((mImageAssetID != image_id) || mTentative) && mActive)
- {
- mNoCopyTextureSelected = FALSE;
- mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
- mImageAssetID = image_id;
-
- if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID))
- {
- if ( mBakeTextureEnabled && mModeSelector->getValue().asInteger() != 2)
- {
- mModeSelector->selectByValue(2);
- onModeSelect(0,this);
- }
- }
- else
- {
- if (mModeSelector->getValue().asInteger() == 2)
- {
- mModeSelector->selectByValue(0);
- onModeSelect(0,this);
- }
+ if( ((mImageAssetID != image_id) || mTentative) && mActive)
+ {
+ mNoCopyTextureSelected = FALSE;
+ mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
+ mImageAssetID = image_id;
+
+ if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID))
+ {
+ if ( mBakeTextureEnabled && mModeSelector->getValue().asInteger() != 2)
+ {
+ mModeSelector->selectByValue(2);
+ onModeSelect(0,this);
+ }
+ }
+ else
+ {
+ if (mModeSelector->getValue().asInteger() == 2)
+ {
+ mModeSelector->selectByValue(0);
+ onModeSelect(0,this);
+ }
LLUUID item_id;
LLFolderView* root_folder = mInventoryPanel->getRootFolder();
@@ -243,27 +243,27 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti
{
item_id = findItemID(mImageAssetID, FALSE);
}
- if (item_id.isNull())
- {
- mInventoryPanel->getRootFolder()->clearSelection();
- }
- else
- {
- LLInventoryItem* itemp = gInventory.getItem(item_id);
- if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
- {
- // no copy texture
- getChild<LLUICtrl>("apply_immediate_check")->setValue(FALSE);
- mNoCopyTextureSelected = TRUE;
- }
- }
-
- if (set_selection)
- {
- mInventoryPanel->setSelection(item_id, TAKE_FOCUS_NO);
- }
- }
- }
+ if (item_id.isNull())
+ {
+ mInventoryPanel->getRootFolder()->clearSelection();
+ }
+ else
+ {
+ LLInventoryItem* itemp = gInventory.getItem(item_id);
+ if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ // no copy texture
+ getChild<LLUICtrl>("apply_immediate_check")->setValue(FALSE);
+ mNoCopyTextureSelected = TRUE;
+ }
+ }
+
+ if (set_selection)
+ {
+ mInventoryPanel->setSelection(item_id, TAKE_FOCUS_NO);
+ }
+ }
+ }
}
void LLFloaterTexturePicker::setImageIDFromItem(const LLInventoryItem* itemp, bool set_selection)
@@ -277,18 +277,18 @@ void LLFloaterTexturePicker::setImageIDFromItem(const LLInventoryItem* itemp, bo
setImageID(asset_id, set_selection);
}
-void LLFloaterTexturePicker::setActive( BOOL active )
+void LLFloaterTexturePicker::setActive( BOOL active )
{
- if (!active && getChild<LLUICtrl>("Pipette")->getValue().asBoolean())
- {
- stopUsingPipette();
- }
- mActive = active;
+ if (!active && getChild<LLUICtrl>("Pipette")->getValue().asBoolean())
+ {
+ stopUsingPipette();
+ }
+ mActive = active;
}
void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b)
{
- mCanApplyImmediately = b;
+ mCanApplyImmediately = b;
LLUICtrl *apply_checkbox = getChild<LLUICtrl>("apply_immediate_check");
apply_checkbox->setValue(mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview"));
@@ -297,10 +297,10 @@ void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b)
void LLFloaterTexturePicker::stopUsingPipette()
{
- if (LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance())
- {
- LLToolMgr::getInstance()->clearTransientTool();
- }
+ if (LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance())
+ {
+ LLToolMgr::getInstance()->clearTransientTool();
+ }
}
bool LLFloaterTexturePicker::updateImageStats()
@@ -358,13 +358,13 @@ bool LLFloaterTexturePicker::updateImageStats()
mResolutionLabel->setTextArg("[DIMENSIONS]", std::string(""));
}
}
- else if (mTexturep.notNull())
- {
- //RN: have we received header data for this image?
+ else if (mTexturep.notNull())
+ {
+ //RN: have we received header data for this image?
S32 width = mTexturep->getFullWidth();
S32 height = mTexturep->getFullHeight();
- if (width > 0 && height > 0)
- {
+ if (width > 0 && height > 0)
+ {
if ((mLimitsSet && (width != height))
|| width < mMinDim
|| width > mMaxDim
@@ -386,16 +386,16 @@ bool LLFloaterTexturePicker::updateImageStats()
{
mOnUpdateImageStatsCallback(mTexturep);
}
- }
- else
- {
- mResolutionLabel->setTextArg("[DIMENSIONS]", std::string("[? x ?]"));
- }
- }
- else
- {
- mResolutionLabel->setTextArg("[DIMENSIONS]", std::string(""));
- }
+ }
+ else
+ {
+ mResolutionLabel->setTextArg("[DIMENSIONS]", std::string("[? x ?]"));
+ }
+ }
+ else
+ {
+ mResolutionLabel->setTextArg("[DIMENSIONS]", std::string(""));
+ }
mResolutionLabel->setVisible(result);
mResolutionWarning->setVisible(!result);
@@ -414,16 +414,16 @@ bool LLFloaterTexturePicker::updateImageStats()
}
// virtual
-BOOL LLFloaterTexturePicker::handleDragAndDrop(
- S32 x, S32 y, MASK mask,
- BOOL drop,
- EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg)
+BOOL LLFloaterTexturePicker::handleDragAndDrop(
+ S32 x, S32 y, MASK mask,
+ BOOL drop,
+ EDragAndDropType cargo_type, void *cargo_data,
+ EAcceptance *accept,
+ std::string& tooltip_msg)
{
- BOOL handled = FALSE;
+ BOOL handled = FALSE;
- bool is_mesh = cargo_type == DAD_MESH;
+ bool is_mesh = cargo_type == DAD_MESH;
bool is_texture = cargo_type == DAD_TEXTURE;
bool is_material = cargo_type == DAD_MATERIAL;
@@ -441,83 +441,83 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
allow_dnd = is_texture || is_mesh || is_material;
}
- if (allow_dnd)
- {
- LLInventoryItem *item = (LLInventoryItem *)cargo_data;
-
- BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
- BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
- BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID());
-
- PermissionMask item_perm_mask = 0;
- if (copy) item_perm_mask |= PERM_COPY;
- if (mod) item_perm_mask |= PERM_MODIFY;
- if (xfer) item_perm_mask |= PERM_TRANSFER;
-
- PermissionMask filter_perm_mask = mDnDFilterPermMask;
- if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
- {
- if (drop)
- {
+ if (allow_dnd)
+ {
+ LLInventoryItem *item = (LLInventoryItem *)cargo_data;
+
+ BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
+ BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
+ BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ gAgent.getID());
+
+ PermissionMask item_perm_mask = 0;
+ if (copy) item_perm_mask |= PERM_COPY;
+ if (mod) item_perm_mask |= PERM_MODIFY;
+ if (xfer) item_perm_mask |= PERM_TRANSFER;
+
+ PermissionMask filter_perm_mask = mDnDFilterPermMask;
+ if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
+ {
+ if (drop)
+ {
setImageIDFromItem(item);
- commitIfImmediateSet();
- }
+ commitIfImmediateSet();
+ }
- *accept = ACCEPT_YES_SINGLE;
- }
- else
- {
- *accept = ACCEPT_NO;
- }
- }
- else
- {
- *accept = ACCEPT_NO;
- }
+ *accept = ACCEPT_YES_SINGLE;
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ }
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ }
- handled = TRUE;
- LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFloaterTexturePicker " << getName() << LL_ENDL;
+ handled = TRUE;
+ LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFloaterTexturePicker " << getName() << LL_ENDL;
- return handled;
+ return handled;
}
BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask)
{
- LLFolderView* root_folder = mInventoryPanel->getRootFolder();
-
- if (root_folder && mFilterEdit)
- {
- if (mFilterEdit->hasFocus()
- && (key == KEY_RETURN || key == KEY_DOWN)
- && mask == MASK_NONE)
- {
- if (!root_folder->getCurSelectedItem())
- {
- LLFolderViewItem* itemp = mInventoryPanel->getItemByID(gInventory.getRootFolderID());
- if (itemp)
- {
- root_folder->setSelection(itemp, FALSE, FALSE);
- }
- }
- root_folder->scrollToShowSelection();
-
- // move focus to inventory proper
- mInventoryPanel->setFocus(TRUE);
-
- // treat this as a user selection of the first filtered result
- commitIfImmediateSet();
-
- return TRUE;
- }
-
- if (mInventoryPanel->hasFocus() && key == KEY_UP)
- {
- mFilterEdit->focusFirstItem(TRUE);
- }
- }
-
- return LLFloater::handleKeyHere(key, mask);
+ LLFolderView* root_folder = mInventoryPanel->getRootFolder();
+
+ if (root_folder && mFilterEdit)
+ {
+ if (mFilterEdit->hasFocus()
+ && (key == KEY_RETURN || key == KEY_DOWN)
+ && mask == MASK_NONE)
+ {
+ if (!root_folder->getCurSelectedItem())
+ {
+ LLFolderViewItem* itemp = mInventoryPanel->getItemByID(gInventory.getRootFolderID());
+ if (itemp)
+ {
+ root_folder->setSelection(itemp, FALSE, FALSE);
+ }
+ }
+ root_folder->scrollToShowSelection();
+
+ // move focus to inventory proper
+ mInventoryPanel->setFocus(TRUE);
+
+ // treat this as a user selection of the first filtered result
+ commitIfImmediateSet();
+
+ return TRUE;
+ }
+
+ if (mInventoryPanel->hasFocus() && key == KEY_UP)
+ {
+ mFilterEdit->focusFirstItem(TRUE);
+ }
+ }
+
+ return LLFloater::handleKeyHere(key, mask);
}
void LLFloaterTexturePicker::onOpen(const LLSD& key)
@@ -531,28 +531,28 @@ void LLFloaterTexturePicker::onOpen(const LLSD& key)
void LLFloaterTexturePicker::onClose(bool app_quitting)
{
- if (mOwner && mOnFloaterCloseCallback)
- {
- mOnFloaterCloseCallback();
- }
- stopUsingPipette();
+ if (mOwner && mOnFloaterCloseCallback)
+ {
+ mOnFloaterCloseCallback();
+ }
+ stopUsingPipette();
sLastPickerMode = mModeSelector->getValue().asInteger();
}
// virtual
BOOL LLFloaterTexturePicker::postBuild()
{
- LLFloater::postBuild();
+ LLFloater::postBuild();
- if (!mLabel.empty())
- {
- std::string pick = getString("pick title");
-
- setTitle(pick + mLabel);
- }
- mTentativeLabel = getChild<LLTextBox>("Multiple");
+ if (!mLabel.empty())
+ {
+ std::string pick = getString("pick title");
+
+ setTitle(pick + mLabel);
+ }
+ mTentativeLabel = getChild<LLTextBox>("Multiple");
- mResolutionLabel = getChild<LLTextBox>("size_lbl");
+ mResolutionLabel = getChild<LLTextBox>("size_lbl");
mResolutionWarning = getChild<LLTextBox>("over_limit_lbl");
@@ -573,70 +573,70 @@ BOOL LLFloaterTexturePicker::postBuild()
mFilterEdit = getChild<LLFilterEditor>("inventory search editor");
mFilterEdit->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onFilterEdit, this, _2));
- mInventoryPanel = getChild<LLInventoryPanel>("inventory panel");
+ mInventoryPanel = getChild<LLInventoryPanel>("inventory panel");
- mModeSelector = getChild<LLComboBox>("mode_selection");
- mModeSelector->setCommitCallback(onModeSelect, this);
- mModeSelector->selectByValue(0);
+ mModeSelector = getChild<LLComboBox>("mode_selection");
+ mModeSelector->setCommitCallback(onModeSelect, this);
+ mModeSelector->selectByValue(0);
- if(mInventoryPanel)
- {
+ if(mInventoryPanel)
+ {
// to avoid having to make an assumption about which option is
// selected at startup, we call the same function that is triggered
// when a texture/materials/both choice is made and let it take care
// of setting the filters
refreshInventoryFilter();
- mInventoryPanel->setFilterPermMask(mImmediateFilterPermMask);
- mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, this, _1, _2));
- mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+ mInventoryPanel->setFilterPermMask(mImmediateFilterPermMask);
+ mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, this, _1, _2));
+ mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- // Disable auto selecting first filtered item because it takes away
- // selection from the item set by LLTextureCtrl owning this floater.
- mInventoryPanel->getRootFolder()->setAutoSelectOverride(TRUE);
+ // Disable auto selecting first filtered item because it takes away
+ // selection from the item set by LLTextureCtrl owning this floater.
+ mInventoryPanel->getRootFolder()->setAutoSelectOverride(TRUE);
- // Commented out to scroll to currently selected texture. See EXT-5403.
- // // store this filter as the default one
- // mInventoryPanel->getRootFolder()->getFilter().markDefault();
+ // Commented out to scroll to currently selected texture. See EXT-5403.
+ // // store this filter as the default one
+ // mInventoryPanel->getRootFolder()->getFilter().markDefault();
- // Commented out to stop opening all folders with textures
- // mInventoryPanel->openDefaultFolderForType(LLFolderType::FT_TEXTURE);
+ // Commented out to stop opening all folders with textures
+ // mInventoryPanel->openDefaultFolderForType(LLFolderType::FT_TEXTURE);
- // don't put keyboard focus on selected item, because the selection callback
- // will assume that this was user input
+ // don't put keyboard focus on selected item, because the selection callback
+ // will assume that this was user input
- if(!mImageAssetID.isNull() || mInventoryPickType == PICK_MATERIAL)
- {
- mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO);
- }
- }
+ if(!mImageAssetID.isNull() || mInventoryPickType == PICK_MATERIAL)
+ {
+ mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO);
+ }
+ }
- childSetAction("l_add_btn", LLFloaterTexturePicker::onBtnAdd, this);
- childSetAction("l_rem_btn", LLFloaterTexturePicker::onBtnRemove, this);
- childSetAction("l_upl_btn", LLFloaterTexturePicker::onBtnUpload, this);
+ childSetAction("l_add_btn", LLFloaterTexturePicker::onBtnAdd, this);
+ childSetAction("l_rem_btn", LLFloaterTexturePicker::onBtnRemove, this);
+ childSetAction("l_upl_btn", LLFloaterTexturePicker::onBtnUpload, this);
- mLocalScrollCtrl = getChild<LLScrollListCtrl>("l_name_list");
- mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit, this);
+ mLocalScrollCtrl = getChild<LLScrollListCtrl>("l_name_list");
+ mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit, this);
refreshLocalList();
- mNoCopyTextureSelected = FALSE;
+ mNoCopyTextureSelected = FALSE;
- getChild<LLUICtrl>("apply_immediate_check")->setValue(mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview"));
- childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this);
+ getChild<LLUICtrl>("apply_immediate_check")->setValue(mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview"));
+ childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this);
getChildView("apply_immediate_check")->setEnabled(mCanApplyImmediately);
- getChild<LLUICtrl>("Pipette")->setCommitCallback( boost::bind(&LLFloaterTexturePicker::onBtnPipette, this));
- childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this);
- childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this);
+ getChild<LLUICtrl>("Pipette")->setCommitCallback( boost::bind(&LLFloaterTexturePicker::onBtnPipette, this));
+ childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this);
+ childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this);
+
+ mSavedFolderState.setApply(FALSE);
- mSavedFolderState.setApply(FALSE);
+ LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1));
- LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1));
-
- getChild<LLComboBox>("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this);
+ getChild<LLComboBox>("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this);
- setBakeTextureEnabled(TRUE);
- return TRUE;
+ setBakeTextureEnabled(TRUE);
+ return TRUE;
}
// virtual
@@ -647,18 +647,18 @@ void LLFloaterTexturePicker::draw()
// This is going to spam mOnUpdateImageStatsCallback,
// either move elsewhere or fix to cause update once per image
- bool valid_dims = updateImageStats();
+ bool valid_dims = updateImageStats();
- // if we're inactive, gray out "apply immediate" checkbox
- getChildView("show_folders_check")->setEnabled(mActive && mCanApplyImmediately && !mNoCopyTextureSelected);
- mSelectBtn->setEnabled(mActive && mCanApply && valid_dims);
- mPipetteBtn->setEnabled(mActive);
+ // if we're inactive, gray out "apply immediate" checkbox
+ getChildView("show_folders_check")->setEnabled(mActive && mCanApplyImmediately && !mNoCopyTextureSelected);
+ mSelectBtn->setEnabled(mActive && mCanApply && valid_dims);
+ mPipetteBtn->setEnabled(mActive);
mPipetteBtn->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
- //BOOL allow_copy = FALSE;
- if( mOwner )
- {
- mTexturep = NULL;
+ //BOOL allow_copy = FALSE;
+ if( mOwner )
+ {
+ mTexturep = NULL;
mGLTFMaterial = NULL;
if (mImageAssetID.notNull())
{
@@ -693,33 +693,33 @@ void LLFloaterTexturePicker::draw()
}
}
- if (mTentativeLabel)
- {
- mTentativeLabel->setVisible( FALSE );
- }
+ if (mTentativeLabel)
+ {
+ mTentativeLabel->setVisible( FALSE );
+ }
- mDefaultBtn->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative);
- mBlankBtn->setEnabled((mImageAssetID != mBlankImageAssetID && mBlankImageAssetID.notNull()) || mTentative);
- mNoneBtn->setEnabled(mAllowNoTexture && (!mImageAssetID.isNull() || mTentative));
+ mDefaultBtn->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative);
+ mBlankBtn->setEnabled((mImageAssetID != mBlankImageAssetID && mBlankImageAssetID.notNull()) || mTentative);
+ mNoneBtn->setEnabled(mAllowNoTexture && (!mImageAssetID.isNull() || mTentative));
- LLFloater::draw();
+ LLFloater::draw();
- if( isMinimized() )
- {
- return;
- }
+ if( isMinimized() )
+ {
+ return;
+ }
- // Border
- LLRect border = getChildView("preview_widget")->getRect();
- gl_rect_2d( border, LLColor4::black, FALSE );
+ // Border
+ LLRect border = getChildView("preview_widget")->getRect();
+ gl_rect_2d( border, LLColor4::black, FALSE );
- // Interior
- LLRect interior = border;
- interior.stretch( -1 );
+ // Interior
+ LLRect interior = border;
+ interior.stretch( -1 );
- // If the floater is focused, don't apply its alpha to the texture (STORM-677).
- const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+ // If the floater is focused, don't apply its alpha to the texture (STORM-677).
+ const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
LLViewerTexture* texture = nullptr;
if (mGLTFMaterial)
{
@@ -730,68 +730,68 @@ void LLFloaterTexturePicker::draw()
texture = mTexturep.get();
}
- if( texture )
- {
- if( texture->getComponents() == 4 )
- {
- gl_rect_2d_checkerboard( interior, alpha );
- }
-
- gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), texture, UI_VERTEX_COLOR % alpha );
-
- // Pump the priority
- texture->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
- }
- else if (!mFallbackImage.isNull())
- {
- mFallbackImage->draw(interior, UI_VERTEX_COLOR % alpha);
- }
- else
- {
- gl_rect_2d( interior, LLColor4::grey % alpha, TRUE );
-
- // Draw X
- gl_draw_x(interior, LLColor4::black );
- }
-
- // Draw Tentative Label over the image
- if( mTentative && !mViewModel->isDirty() )
- {
- mTentativeLabel->setVisible( TRUE );
- drawChild(mTentativeLabel);
- }
-
- if (mSelectedItemPinned) return;
-
- LLFolderView* folder_view = mInventoryPanel->getRootFolder();
- if (!folder_view) return;
-
- LLFolderViewFilter& filter = static_cast<LLFolderViewModelInventory*>(folder_view->getFolderViewModel())->getFilter();
-
- bool is_filter_active = folder_view->getViewModelItem()->getLastFilterGeneration() < filter.getCurrentGeneration() &&
- filter.isNotDefault();
-
- // After inventory panel filter is applied we have to update
- // constraint rect for the selected item because of folder view
- // AutoSelectOverride set to TRUE. We force PinningSelectedItem
- // flag to FALSE state and setting filter "dirty" to update
- // scroll container to show selected item (see LLFolderView::doIdle()).
- if (!is_filter_active && !mSelectedItemPinned)
- {
- folder_view->setPinningSelectedItem(mSelectedItemPinned);
- folder_view->getViewModelItem()->dirtyFilter();
- mSelectedItemPinned = TRUE;
- }
- }
+ if( texture )
+ {
+ if( texture->getComponents() == 4 )
+ {
+ gl_rect_2d_checkerboard( interior, alpha );
+ }
+
+ gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), texture, UI_VERTEX_COLOR % alpha );
+
+ // Pump the priority
+ texture->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
+ }
+ else if (!mFallbackImage.isNull())
+ {
+ mFallbackImage->draw(interior, UI_VERTEX_COLOR % alpha);
+ }
+ else
+ {
+ gl_rect_2d( interior, LLColor4::grey % alpha, TRUE );
+
+ // Draw X
+ gl_draw_x(interior, LLColor4::black );
+ }
+
+ // Draw Tentative Label over the image
+ if( mTentative && !mViewModel->isDirty() )
+ {
+ mTentativeLabel->setVisible( TRUE );
+ drawChild(mTentativeLabel);
+ }
+
+ if (mSelectedItemPinned) return;
+
+ LLFolderView* folder_view = mInventoryPanel->getRootFolder();
+ if (!folder_view) return;
+
+ LLFolderViewFilter& filter = static_cast<LLFolderViewModelInventory*>(folder_view->getFolderViewModel())->getFilter();
+
+ bool is_filter_active = folder_view->getViewModelItem()->getLastFilterGeneration() < filter.getCurrentGeneration() &&
+ filter.isNotDefault();
+
+ // After inventory panel filter is applied we have to update
+ // constraint rect for the selected item because of folder view
+ // AutoSelectOverride set to TRUE. We force PinningSelectedItem
+ // flag to FALSE state and setting filter "dirty" to update
+ // scroll container to show selected item (see LLFolderView::doIdle()).
+ if (!is_filter_active && !mSelectedItemPinned)
+ {
+ folder_view->setPinningSelectedItem(mSelectedItemPinned);
+ folder_view->getViewModelItem()->dirtyFilter();
+ mSelectedItemPinned = TRUE;
+ }
+ }
}
const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library)
{
- if (asset_id.isNull())
- {
+ if (asset_id.isNull())
+ {
// null asset id means, no material or texture assigned
return LLUUID::null;
- }
+ }
LLUUID loockup_id = asset_id;
if (mInventoryPickType == PICK_MATERIAL && loockup_id == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID)
@@ -800,8 +800,8 @@ const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL co
loockup_id = LLUUID::null;
}
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
if (loockup_id.isNull())
{
@@ -825,44 +825,44 @@ const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL co
}
- if (items.size())
- {
- // search for copyable version first
- for (S32 i = 0; i < items.size(); i++)
- {
- LLInventoryItem* itemp = items[i];
- LLPermissions item_permissions = itemp->getPermissions();
- if (item_permissions.allowCopyBy(gAgent.getID(), gAgent.getGroupID()))
- {
- if(!ignore_library || !gInventory.isObjectDescendentOf(itemp->getUUID(),gInventory.getLibraryRootFolderID()))
- {
- return itemp->getUUID();
- }
- }
- }
- // otherwise just return first instance, unless copyable requested
- if (copyable_only)
- {
- return LLUUID::null;
- }
- else
- {
- if(!ignore_library || !gInventory.isObjectDescendentOf(items[0]->getUUID(),gInventory.getLibraryRootFolderID()))
- {
- return items[0]->getUUID();
- }
- }
- }
-
- return LLUUID::null;
+ if (items.size())
+ {
+ // search for copyable version first
+ for (S32 i = 0; i < items.size(); i++)
+ {
+ LLInventoryItem* itemp = items[i];
+ LLPermissions item_permissions = itemp->getPermissions();
+ if (item_permissions.allowCopyBy(gAgent.getID(), gAgent.getGroupID()))
+ {
+ if(!ignore_library || !gInventory.isObjectDescendentOf(itemp->getUUID(),gInventory.getLibraryRootFolderID()))
+ {
+ return itemp->getUUID();
+ }
+ }
+ }
+ // otherwise just return first instance, unless copyable requested
+ if (copyable_only)
+ {
+ return LLUUID::null;
+ }
+ else
+ {
+ if(!ignore_library || !gInventory.isObjectDescendentOf(items[0]->getUUID(),gInventory.getLibraryRootFolderID()))
+ {
+ return items[0]->getUUID();
+ }
+ }
+ }
+
+ return LLUUID::null;
}
void LLFloaterTexturePicker::commitIfImmediateSet()
{
- if (!mNoCopyTextureSelected && mCanApply)
- {
+ if (!mNoCopyTextureSelected && mCanApply)
+ {
commitCallback(LLTextureCtrl::TEXTURE_CHANGE);
- }
+ }
}
void LLFloaterTexturePicker::commitCallback(LLTextureCtrl::ETexturePickOp op)
@@ -944,40 +944,40 @@ void LLFloaterTexturePicker::commitCallback(LLTextureCtrl::ETexturePickOp op)
}
void LLFloaterTexturePicker::commitCancel()
{
- if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply)
- {
- mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, PICKER_UNKNOWN, mOriginalImageAssetID, LLUUID::null, LLUUID::null);
- }
+ if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply)
+ {
+ mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, PICKER_UNKNOWN, mOriginalImageAssetID, LLUUID::null, LLUUID::null);
+ }
}
// static
void LLFloaterTexturePicker::onBtnSetToDefault(void* userdata)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setCanApply(true, true);
- if (self->mOwner)
- {
- self->setImageID( self->getDefaultImageAssetID() );
- }
- self->commitIfImmediateSet();
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+ self->setCanApply(true, true);
+ if (self->mOwner)
+ {
+ self->setImageID( self->getDefaultImageAssetID() );
+ }
+ self->commitIfImmediateSet();
}
// static
void LLFloaterTexturePicker::onBtnBlank(void* userdata)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setCanApply(true, true);
- self->setImageID( self->getBlankImageAssetID() );
- self->commitIfImmediateSet();
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+ self->setCanApply(true, true);
+ self->setImageID( self->getBlankImageAssetID() );
+ self->commitIfImmediateSet();
}
// static
void LLFloaterTexturePicker::onBtnNone(void* userdata)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
- self->setImageID( LLUUID::null );
+ self->setImageID( LLUUID::null );
self->commitIfImmediateSet();
}
@@ -985,88 +985,88 @@ void LLFloaterTexturePicker::onBtnNone(void* userdata)
// static
void LLFloaterTexturePicker::onBtnRevert(void* userdata)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setImageID( self->mOriginalImageAssetID );
- // TODO: Change this to tell the owner to cancel. It needs to be
- // smart enough to restore multi-texture selections.
- self->mOwner->onFloaterCommit();
- self->mViewModel->resetDirty();
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+ self->setImageID( self->mOriginalImageAssetID );
+ // TODO: Change this to tell the owner to cancel. It needs to be
+ // smart enough to restore multi-texture selections.
+ self->mOwner->onFloaterCommit();
+ self->mViewModel->resetDirty();
}*/
// static
void LLFloaterTexturePicker::onBtnCancel(void* userdata)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setImageID( self->mOriginalImageAssetID );
- if (self->mOnFloaterCommitCallback)
- {
- self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, PICKER_UNKNOWN, self->mOriginalImageAssetID, LLUUID::null, LLUUID::null);
- }
- self->mViewModel->resetDirty();
- self->closeFloater();
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+ self->setImageID( self->mOriginalImageAssetID );
+ if (self->mOnFloaterCommitCallback)
+ {
+ self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, PICKER_UNKNOWN, self->mOriginalImageAssetID, LLUUID::null, LLUUID::null);
+ }
+ self->mViewModel->resetDirty();
+ self->closeFloater();
}
// static
void LLFloaterTexturePicker::onBtnSelect(void* userdata)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- if (self->mOnFloaterCommitCallback)
- {
- self->commitCallback(LLTextureCtrl::TEXTURE_SELECT);
- }
- self->closeFloater();
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+ if (self->mOnFloaterCommitCallback)
+ {
+ self->commitCallback(LLTextureCtrl::TEXTURE_SELECT);
+ }
+ self->closeFloater();
}
void LLFloaterTexturePicker::onBtnPipette()
{
- BOOL pipette_active = getChild<LLUICtrl>("Pipette")->getValue().asBoolean();
- pipette_active = !pipette_active;
- if (pipette_active)
- {
- LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance());
- }
- else
- {
- LLToolMgr::getInstance()->clearTransientTool();
- }
+ BOOL pipette_active = getChild<LLUICtrl>("Pipette")->getValue().asBoolean();
+ pipette_active = !pipette_active;
+ if (pipette_active)
+ {
+ LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance());
+ }
+ else
+ {
+ LLToolMgr::getInstance()->clearTransientTool();
+ }
}
void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
{
- if (items.size())
- {
- LLFolderViewItem* first_item = items.front();
- LLInventoryItem* itemp = gInventory.getItem(static_cast<LLFolderViewModelItemInventory*>(first_item->getViewModelItem())->getUUID());
- mNoCopyTextureSelected = FALSE;
- if (itemp)
- {
- if (!mTextureSelectedCallback.empty())
- {
- mTextureSelectedCallback(itemp);
- }
- if (!itemp->getPermissions().allowCopyBy(gAgent.getID()))
- {
- mNoCopyTextureSelected = TRUE;
- }
+ if (items.size())
+ {
+ LLFolderViewItem* first_item = items.front();
+ LLInventoryItem* itemp = gInventory.getItem(static_cast<LLFolderViewModelItemInventory*>(first_item->getViewModelItem())->getUUID());
+ mNoCopyTextureSelected = FALSE;
+ if (itemp)
+ {
+ if (!mTextureSelectedCallback.empty())
+ {
+ mTextureSelectedCallback(itemp);
+ }
+ if (!itemp->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ mNoCopyTextureSelected = TRUE;
+ }
setImageIDFromItem(itemp, false);
- mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
-
- if(!mPreviewSettingChanged)
- {
- mCanPreview = mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview");
- }
- else
- {
- mPreviewSettingChanged = false;
- }
-
- if (user_action && mCanPreview)
- {
- // only commit intentional selections, not implicit ones
- commitIfImmediateSet();
- }
- }
- }
+ mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
+
+ if(!mPreviewSettingChanged)
+ {
+ mCanPreview = mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview");
+ }
+ else
+ {
+ mPreviewSettingChanged = false;
+ }
+
+ if (user_action && mCanPreview)
+ {
+ // only commit intentional selections, not implicit ones
+ commitIfImmediateSet();
+ }
+ }
+ }
}
// static
@@ -1098,18 +1098,18 @@ void LLFloaterTexturePicker::onBtnAdd(void* userdata)
// static
void LLFloaterTexturePicker::onBtnRemove(void* userdata)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+ std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
- if (!selected_items.empty())
- {
+ if (!selected_items.empty())
+ {
- for(std::vector<LLScrollListItem*>::iterator iter = selected_items.begin();
- iter != selected_items.end(); iter++)
- {
- LLScrollListItem* list_item = *iter;
- if (list_item)
- {
+ for(std::vector<LLScrollListItem*>::iterator iter = selected_items.begin();
+ iter != selected_items.end(); iter++)
+ {
+ LLScrollListItem* list_item = *iter;
+ if (list_item)
+ {
LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue();
LLUUID tracking_id = data["id"];
S32 asset_type = data["type"].asInteger();
@@ -1122,28 +1122,28 @@ void LLFloaterTexturePicker::onBtnRemove(void* userdata)
{
LLLocalBitmapMgr::getInstance()->delUnit(tracking_id);
}
- }
- }
+ }
+ }
- self->getChild<LLButton>("l_rem_btn")->setEnabled(false);
- self->getChild<LLButton>("l_upl_btn")->setEnabled(false);
+ self->getChild<LLButton>("l_rem_btn")->setEnabled(false);
+ self->getChild<LLButton>("l_upl_btn")->setEnabled(false);
self->refreshLocalList();
- }
+ }
}
// static
void LLFloaterTexturePicker::onBtnUpload(void* userdata)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+ std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
- if (selected_items.empty())
- {
- return;
- }
+ if (selected_items.empty())
+ {
+ return;
+ }
- /* currently only allows uploading one by one, picks the first item from the selection list. (not the vector!)
- in the future, it might be a good idea to check the vector size and if more than one units is selected - opt for multi-image upload. */
+ /* currently only allows uploading one by one, picks the first item from the selection list. (not the vector!)
+ in the future, it might be a good idea to check the vector size and if more than one units is selected - opt for multi-image upload. */
LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue();
LLUUID tracking_id = data["id"];
@@ -1172,16 +1172,16 @@ void LLFloaterTexturePicker::onBtnUpload(void* userdata)
//static
void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
- bool has_selection = !selected_items.empty();
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
+ std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
+ bool has_selection = !selected_items.empty();
- self->getChild<LLButton>("l_rem_btn")->setEnabled(has_selection);
- self->getChild<LLButton>("l_upl_btn")->setEnabled(has_selection && (selected_items.size() < 2));
- /* since multiple-localbitmap upload is not implemented, upl button gets disabled if more than one is selected. */
+ self->getChild<LLButton>("l_rem_btn")->setEnabled(has_selection);
+ self->getChild<LLButton>("l_upl_btn")->setEnabled(has_selection && (selected_items.size() < 2));
+ /* since multiple-localbitmap upload is not implemented, upl button gets disabled if more than one is selected. */
- if (has_selection)
- {
+ if (has_selection)
+ {
LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue();
LLUUID tracking_id = data["id"];
S32 asset_type = data["type"].asInteger();
@@ -1196,114 +1196,114 @@ void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata)
inworld_id = LLLocalBitmapMgr::getInstance()->getWorldID(tracking_id);
}
- if (self->mSetImageAssetIDCallback)
- {
- self->mSetImageAssetIDCallback(inworld_id);
- }
+ if (self->mSetImageAssetIDCallback)
+ {
+ self->mSetImageAssetIDCallback(inworld_id);
+ }
- if (self->childGetValue("apply_immediate_check").asBoolean())
- {
- if (self->mOnFloaterCommitCallback)
- {
- self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, PICKER_LOCAL, inworld_id, LLUUID::null, tracking_id);
- }
- }
- }
+ if (self->childGetValue("apply_immediate_check").asBoolean())
+ {
+ if (self->mOnFloaterCommitCallback)
+ {
+ self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, PICKER_LOCAL, inworld_id, LLUUID::null, tracking_id);
+ }
+ }
+ }
}
// static
void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_data)
{
- LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data;
+ LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data;
- LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
- gSavedSettings.setBOOL("TextureLivePreview", check_box->get());
+ LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
+ gSavedSettings.setBOOL("TextureLivePreview", check_box->get());
- picker->commitIfImmediateSet();
+ picker->commitIfImmediateSet();
}
//static
void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data)
{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)user_data;
- LLComboBox* combo_box = (LLComboBox*)ctrl;
-
- S8 type = combo_box->getValue().asInteger();
-
- LLUUID imageID = self->mDefaultImageAssetID;
- if (type == 0)
- {
- imageID = IMG_USE_BAKED_HEAD;
- }
- else if (type == 1)
- {
- imageID = IMG_USE_BAKED_UPPER;
- }
- else if (type == 2)
- {
- imageID = IMG_USE_BAKED_LOWER;
- }
- else if (type == 3)
- {
- imageID = IMG_USE_BAKED_EYES;
- }
- else if (type == 4)
- {
- imageID = IMG_USE_BAKED_SKIRT;
- }
- else if (type == 5)
- {
- imageID = IMG_USE_BAKED_HAIR;
- }
- else if (type == 6)
- {
- imageID = IMG_USE_BAKED_LEFTARM;
- }
- else if (type == 7)
- {
- imageID = IMG_USE_BAKED_LEFTLEG;
- }
- else if (type == 8)
- {
- imageID = IMG_USE_BAKED_AUX1;
- }
- else if (type == 9)
- {
- imageID = IMG_USE_BAKED_AUX2;
- }
- else if (type == 10)
- {
- imageID = IMG_USE_BAKED_AUX3;
- }
-
- self->setImageID(imageID);
- self->mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
-
- if (!self->mPreviewSettingChanged)
- {
- self->mCanPreview = self->mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview");
- }
- else
- {
- self->mPreviewSettingChanged = false;
- }
-
- if (self->mCanPreview)
- {
- // only commit intentional selections, not implicit ones
- self->commitIfImmediateSet();
- }
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)user_data;
+ LLComboBox* combo_box = (LLComboBox*)ctrl;
+
+ S8 type = combo_box->getValue().asInteger();
+
+ LLUUID imageID = self->mDefaultImageAssetID;
+ if (type == 0)
+ {
+ imageID = IMG_USE_BAKED_HEAD;
+ }
+ else if (type == 1)
+ {
+ imageID = IMG_USE_BAKED_UPPER;
+ }
+ else if (type == 2)
+ {
+ imageID = IMG_USE_BAKED_LOWER;
+ }
+ else if (type == 3)
+ {
+ imageID = IMG_USE_BAKED_EYES;
+ }
+ else if (type == 4)
+ {
+ imageID = IMG_USE_BAKED_SKIRT;
+ }
+ else if (type == 5)
+ {
+ imageID = IMG_USE_BAKED_HAIR;
+ }
+ else if (type == 6)
+ {
+ imageID = IMG_USE_BAKED_LEFTARM;
+ }
+ else if (type == 7)
+ {
+ imageID = IMG_USE_BAKED_LEFTLEG;
+ }
+ else if (type == 8)
+ {
+ imageID = IMG_USE_BAKED_AUX1;
+ }
+ else if (type == 9)
+ {
+ imageID = IMG_USE_BAKED_AUX2;
+ }
+ else if (type == 10)
+ {
+ imageID = IMG_USE_BAKED_AUX3;
+ }
+
+ self->setImageID(imageID);
+ self->mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
+
+ if (!self->mPreviewSettingChanged)
+ {
+ self->mCanPreview = self->mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview");
+ }
+ else
+ {
+ self->mPreviewSettingChanged = false;
+ }
+
+ if (self->mCanPreview)
+ {
+ // only commit intentional selections, not implicit ones
+ self->commitIfImmediateSet();
+ }
}
void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply, bool inworld_image)
{
- mSelectBtn->setEnabled(can_apply);
- getChildRef<LLUICtrl>("preview_disabled").setVisible(!can_preview && inworld_image);
- getChildRef<LLUICtrl>("apply_immediate_check").setVisible(can_preview);
+ mSelectBtn->setEnabled(can_apply);
+ getChildRef<LLUICtrl>("preview_disabled").setVisible(!can_preview && inworld_image);
+ getChildRef<LLUICtrl>("apply_immediate_check").setVisible(can_preview);
- mCanApply = can_apply;
- mCanPreview = can_preview ? (mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview")) : false;
- mPreviewSettingChanged = true;
+ mCanApply = can_apply;
+ mCanPreview = can_preview ? (mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview")) : false;
+ mPreviewSettingChanged = true;
}
void LLFloaterTexturePicker::setMinDimentionsLimits(S32 min_dim)
@@ -1317,36 +1317,36 @@ void LLFloaterTexturePicker::setMinDimentionsLimits(S32 min_dim)
void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string )
{
- std::string upper_case_search_string = search_string;
- LLStringUtil::toUpper(upper_case_search_string);
-
- if (upper_case_search_string.empty())
- {
- if (mInventoryPanel->getFilterSubString().empty())
- {
- // current filter and new filter empty, do nothing
- return;
- }
-
- mSavedFolderState.setApply(TRUE);
- mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState);
- // add folder with current item to list of previously opened folders
- LLOpenFoldersWithSelection opener;
- mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener);
- mInventoryPanel->getRootFolder()->scrollToShowSelection();
-
- }
- else if (mInventoryPanel->getFilterSubString().empty())
- {
- // first letter in search term, save existing folder open state
- if (!mInventoryPanel->getFilter().isNotDefault())
- {
- mSavedFolderState.setApply(FALSE);
- mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState);
- }
- }
-
- mInventoryPanel->setFilterSubString(search_string);
+ std::string upper_case_search_string = search_string;
+ LLStringUtil::toUpper(upper_case_search_string);
+
+ if (upper_case_search_string.empty())
+ {
+ if (mInventoryPanel->getFilterSubString().empty())
+ {
+ // current filter and new filter empty, do nothing
+ return;
+ }
+
+ mSavedFolderState.setApply(TRUE);
+ mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState);
+ // add folder with current item to list of previously opened folders
+ LLOpenFoldersWithSelection opener;
+ mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener);
+ mInventoryPanel->getRootFolder()->scrollToShowSelection();
+
+ }
+ else if (mInventoryPanel->getFilterSubString().empty())
+ {
+ // first letter in search term, save existing folder open state
+ if (!mInventoryPanel->getFilter().isNotDefault())
+ {
+ mSavedFolderState.setApply(FALSE);
+ mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState);
+ }
+ }
+
+ mInventoryPanel->setFilterSubString(search_string);
}
void LLFloaterTexturePicker::changeMode()
@@ -1476,24 +1476,24 @@ void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled)
void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled)
{
- BOOL changed = (enabled != mBakeTextureEnabled);
+ BOOL changed = (enabled != mBakeTextureEnabled);
- mBakeTextureEnabled = enabled;
- mModeSelector->setEnabledByValue(2, enabled);
+ mBakeTextureEnabled = enabled;
+ mModeSelector->setEnabledByValue(2, enabled);
- if (!mBakeTextureEnabled && (mModeSelector->getValue().asInteger() == 2))
- {
- mModeSelector->selectByValue(0);
- }
-
- if (changed && mBakeTextureEnabled && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID))
- {
- if (mModeSelector->getValue().asInteger() != 2)
- {
- mModeSelector->selectByValue(2);
- }
- }
- onModeSelect(0, this);
+ if (!mBakeTextureEnabled && (mModeSelector->getValue().asInteger() == 2))
+ {
+ mModeSelector->selectByValue(0);
+ }
+
+ if (changed && mBakeTextureEnabled && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID))
+ {
+ if (mModeSelector->getValue().asInteger() != 2)
+ {
+ mModeSelector->selectByValue(2);
+ }
+ }
+ onModeSelect(0, this);
}
void LLFloaterTexturePicker::setInventoryPickType(EPickInventoryType type)
@@ -1584,10 +1584,10 @@ void LLFloaterTexturePicker::onPickerCallback(const std::vector<std::string>& fi
void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
{
- LLUUID inventory_item_id = findItemID(te.getID(), TRUE);
- if (inventory_item_id.notNull())
- {
- LLToolPipette::getInstance()->setResult(TRUE, "");
+ LLUUID inventory_item_id = findItemID(te.getID(), TRUE);
+ if (inventory_item_id.notNull())
+ {
+ LLToolPipette::getInstance()->setResult(TRUE, "");
if (mInventoryPickType == PICK_MATERIAL)
{
// tes have no data about material ids
@@ -1600,21 +1600,21 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
setImageID(te.getID());
}
- mNoCopyTextureSelected = FALSE;
- LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
+ mNoCopyTextureSelected = FALSE;
+ LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
+
+ if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ // no copy texture
+ mNoCopyTextureSelected = TRUE;
+ }
- if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
- {
- // no copy texture
- mNoCopyTextureSelected = TRUE;
- }
-
- commitIfImmediateSet();
- }
- else
- {
- LLToolPipette::getInstance()->setResult(FALSE, LLTrans::getString("InventoryNoTexture"));
- }
+ commitIfImmediateSet();
+ }
+ else
+ {
+ LLToolPipette::getInstance()->setResult(FALSE, LLTrans::getString("InventoryNoTexture"));
+ }
}
///////////////////////////////////////////////////////////////////////
@@ -1623,107 +1623,107 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
static LLDefaultChildRegistry::Register<LLTextureCtrl> r("texture_picker");
LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
-: LLUICtrl(p),
- mDragCallback(NULL),
- mDropCallback(NULL),
- mOnCancelCallback(NULL),
- mOnCloseCallback(NULL),
- mOnSelectCallback(NULL),
- mBorderColor( p.border_color() ),
- mAllowNoTexture( p.allow_no_texture ),
- mAllowLocalTexture( TRUE ),
- mImmediateFilterPermMask( PERM_NONE ),
- mCanApplyImmediately( FALSE ),
- mNeedsRawImageData( FALSE ),
- mValid( TRUE ),
- mShowLoadingPlaceholder( TRUE ),
- mOpenTexPreview(false),
+: LLUICtrl(p),
+ mDragCallback(NULL),
+ mDropCallback(NULL),
+ mOnCancelCallback(NULL),
+ mOnCloseCallback(NULL),
+ mOnSelectCallback(NULL),
+ mBorderColor( p.border_color() ),
+ mAllowNoTexture( p.allow_no_texture ),
+ mAllowLocalTexture( TRUE ),
+ mImmediateFilterPermMask( PERM_NONE ),
+ mCanApplyImmediately( FALSE ),
+ mNeedsRawImageData( FALSE ),
+ mValid( TRUE ),
+ mShowLoadingPlaceholder( TRUE ),
+ mOpenTexPreview(false),
mBakeTextureEnabled(true),
mInventoryPickType(PICK_TEXTURE),
- mImageAssetID(p.image_id),
- mDefaultImageAssetID(p.default_image_id),
- mDefaultImageName(p.default_image_name),
- mFallbackImage(p.fallback_image)
-{
-
- // Default of defaults is white image for diff tex
- //
- setBlankImageAssetID(IMG_WHITE);
-
- setAllowNoTexture(p.allow_no_texture);
- setCanApplyImmediately(p.can_apply_immediately);
- mCommitOnSelection = !p.no_commit_on_selection;
-
- LLTextBox::Params params(p.caption_text);
- params.name(p.label);
- params.rect(LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ));
- params.initial_value(p.label());
- params.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM);
- mCaption = LLUICtrlFactory::create<LLTextBox> (params);
- addChild( mCaption );
-
- S32 image_top = getRect().getHeight();
- S32 image_bottom = BTN_HEIGHT_SMALL;
- S32 image_middle = (image_top + image_bottom) / 2;
- S32 line_height = LLFontGL::getFontSansSerifSmall()->getLineHeight();
-
- LLTextBox::Params tentative_label_p(p.multiselect_text);
- tentative_label_p.name("Multiple");
- tentative_label_p.rect(LLRect (0, image_middle + line_height / 2, getRect().getWidth(), image_middle - line_height / 2 ));
- tentative_label_p.follows.flags(FOLLOWS_ALL);
- mTentativeLabel = LLUICtrlFactory::create<LLTextBox> (tentative_label_p);
-
- // It is no longer possible to associate a style with a textbox, so it has to be done in this fashion
- LLStyle::Params style_params;
- style_params.color = LLColor4::white;
-
- mTentativeLabel->setText(LLTrans::getString("multiple_textures"), style_params);
- mTentativeLabel->setHAlign(LLFontGL::HCENTER);
- addChild( mTentativeLabel );
-
- LLRect border_rect = getLocalRect();
- border_rect.mBottom += BTN_HEIGHT_SMALL;
- LLViewBorder::Params vbparams(p.border);
- vbparams.name("border");
- vbparams.rect(border_rect);
- mBorder = LLUICtrlFactory::create<LLViewBorder> (vbparams);
- addChild(mBorder);
-
- mLoadingPlaceholderString = LLTrans::getString("texture_loading");
+ mImageAssetID(p.image_id),
+ mDefaultImageAssetID(p.default_image_id),
+ mDefaultImageName(p.default_image_name),
+ mFallbackImage(p.fallback_image)
+{
+
+ // Default of defaults is white image for diff tex
+ //
+ setBlankImageAssetID(IMG_WHITE);
+
+ setAllowNoTexture(p.allow_no_texture);
+ setCanApplyImmediately(p.can_apply_immediately);
+ mCommitOnSelection = !p.no_commit_on_selection;
+
+ LLTextBox::Params params(p.caption_text);
+ params.name(p.label);
+ params.rect(LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ));
+ params.initial_value(p.label());
+ params.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM);
+ mCaption = LLUICtrlFactory::create<LLTextBox> (params);
+ addChild( mCaption );
+
+ S32 image_top = getRect().getHeight();
+ S32 image_bottom = BTN_HEIGHT_SMALL;
+ S32 image_middle = (image_top + image_bottom) / 2;
+ S32 line_height = LLFontGL::getFontSansSerifSmall()->getLineHeight();
+
+ LLTextBox::Params tentative_label_p(p.multiselect_text);
+ tentative_label_p.name("Multiple");
+ tentative_label_p.rect(LLRect (0, image_middle + line_height / 2, getRect().getWidth(), image_middle - line_height / 2 ));
+ tentative_label_p.follows.flags(FOLLOWS_ALL);
+ mTentativeLabel = LLUICtrlFactory::create<LLTextBox> (tentative_label_p);
+
+ // It is no longer possible to associate a style with a textbox, so it has to be done in this fashion
+ LLStyle::Params style_params;
+ style_params.color = LLColor4::white;
+
+ mTentativeLabel->setText(LLTrans::getString("multiple_textures"), style_params);
+ mTentativeLabel->setHAlign(LLFontGL::HCENTER);
+ addChild( mTentativeLabel );
+
+ LLRect border_rect = getLocalRect();
+ border_rect.mBottom += BTN_HEIGHT_SMALL;
+ LLViewBorder::Params vbparams(p.border);
+ vbparams.name("border");
+ vbparams.rect(border_rect);
+ mBorder = LLUICtrlFactory::create<LLViewBorder> (vbparams);
+ addChild(mBorder);
+
+ mLoadingPlaceholderString = LLTrans::getString("texture_loading");
}
LLTextureCtrl::~LLTextureCtrl()
{
- closeDependentFloater();
+ closeDependentFloater();
}
void LLTextureCtrl::setShowLoadingPlaceholder(BOOL showLoadingPlaceholder)
{
- mShowLoadingPlaceholder = showLoadingPlaceholder;
+ mShowLoadingPlaceholder = showLoadingPlaceholder;
}
void LLTextureCtrl::setCaption(const std::string& caption)
{
- mCaption->setText( caption );
+ mCaption->setText( caption );
}
void LLTextureCtrl::setCanApplyImmediately(BOOL b)
{
- mCanApplyImmediately = b;
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( floaterp )
- {
- floaterp->setCanApplyImmediately(b);
- }
+ mCanApplyImmediately = b;
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
+ if( floaterp )
+ {
+ floaterp->setCanApplyImmediately(b);
+ }
}
void LLTextureCtrl::setCanApply(bool can_preview, bool can_apply)
{
- LLFloaterTexturePicker* floaterp = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
- if( floaterp )
- {
- floaterp->setCanApply(can_preview, can_apply);
- }
+ LLFloaterTexturePicker* floaterp = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
+ if( floaterp )
+ {
+ floaterp->setCanApply(can_preview, can_apply);
+ }
}
void LLTextureCtrl::setImmediateFilterPermMask(PermissionMask mask)
@@ -1737,182 +1737,182 @@ void LLTextureCtrl::setImmediateFilterPermMask(PermissionMask mask)
}
}
-void LLTextureCtrl::setFilterPermissionMasks(PermissionMask mask)
+void LLTextureCtrl::setFilterPermissionMasks(PermissionMask mask)
{
setImmediateFilterPermMask(mask);
setDnDFilterPermMask(mask);
}
-void LLTextureCtrl::setVisible( BOOL visible )
+void LLTextureCtrl::setVisible( BOOL visible )
{
- if( !visible )
- {
- closeDependentFloater();
- }
- LLUICtrl::setVisible( visible );
+ if( !visible )
+ {
+ closeDependentFloater();
+ }
+ LLUICtrl::setVisible( visible );
}
void LLTextureCtrl::setEnabled( BOOL enabled )
{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( floaterp )
- {
- floaterp->setActive(enabled);
- }
- if( enabled )
- {
- std::string tooltip;
- if (floaterp) tooltip = floaterp->getString("choose_picture");
- setToolTip( tooltip );
- }
- else
- {
- setToolTip( std::string() );
- // *TODO: would be better to keep floater open and show
- // disabled state.
- closeDependentFloater();
- }
-
- mCaption->setEnabled( enabled );
-
- LLView::setEnabled( enabled );
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
+ if( floaterp )
+ {
+ floaterp->setActive(enabled);
+ }
+ if( enabled )
+ {
+ std::string tooltip;
+ if (floaterp) tooltip = floaterp->getString("choose_picture");
+ setToolTip( tooltip );
+ }
+ else
+ {
+ setToolTip( std::string() );
+ // *TODO: would be better to keep floater open and show
+ // disabled state.
+ closeDependentFloater();
+ }
+
+ mCaption->setEnabled( enabled );
+
+ LLView::setEnabled( enabled );
}
void LLTextureCtrl::setValid(BOOL valid )
{
- mValid = valid;
- if (!valid)
- {
- LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if (pickerp)
- {
- pickerp->setActive(FALSE);
- }
- }
+ mValid = valid;
+ if (!valid)
+ {
+ LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)mFloaterHandle.get();
+ if (pickerp)
+ {
+ pickerp->setActive(FALSE);
+ }
+ }
}
// virtual
void LLTextureCtrl::clear()
{
- setImageAssetID(LLUUID::null);
+ setImageAssetID(LLUUID::null);
}
void LLTextureCtrl::setLabel(const std::string& label)
{
- mLabel = label;
- mCaption->setText(label);
+ mLabel = label;
+ mCaption->setText(label);
}
void LLTextureCtrl::showPicker(BOOL take_focus)
{
- // show hourglass cursor when loading inventory window
- // because inventory construction is slooow
- getWindow()->setCursor(UI_CURSOR_WAIT);
- LLFloater* floaterp = mFloaterHandle.get();
-
- // Show the dialog
- if( floaterp )
- {
- floaterp->openFloater();
- }
- else
- {
- floaterp = new LLFloaterTexturePicker(
- this,
- getImageAssetID(),
- getDefaultImageAssetID(),
- getBlankImageAssetID(),
- getTentative(),
- getAllowNoTexture(),
- mLabel,
- mImmediateFilterPermMask,
- mDnDFilterPermMask,
- mCanApplyImmediately,
- mFallbackImage,
- mInventoryPickType);
- mFloaterHandle = floaterp->getHandle();
-
- LLFloaterTexturePicker* texture_floaterp = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
- if (texture_floaterp && mOnTextureSelectedCallback)
- {
- texture_floaterp->setTextureSelectedCallback(mOnTextureSelectedCallback);
- }
- if (texture_floaterp && mOnCloseCallback)
- {
- texture_floaterp->setOnFloaterCloseCallback(boost::bind(&LLTextureCtrl::onFloaterClose, this));
- }
- if (texture_floaterp)
- {
- texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2, _3, _4, _5));
- }
- if (texture_floaterp)
- {
- texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1));
-
- texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled);
- }
-
- LLFloater* root_floater = gFloaterView->getParentFloater(this);
- if (root_floater)
- root_floater->addDependentFloater(floaterp);
- floaterp->openFloater();
- }
-
- LLFloaterTexturePicker* picker_floater = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
- if (picker_floater)
- {
- picker_floater->setLocalTextureEnabled(mAllowLocalTexture);
- }
-
- if (take_focus)
- {
- floaterp->setFocus(TRUE);
- }
+ // show hourglass cursor when loading inventory window
+ // because inventory construction is slooow
+ getWindow()->setCursor(UI_CURSOR_WAIT);
+ LLFloater* floaterp = mFloaterHandle.get();
+
+ // Show the dialog
+ if( floaterp )
+ {
+ floaterp->openFloater();
+ }
+ else
+ {
+ floaterp = new LLFloaterTexturePicker(
+ this,
+ getImageAssetID(),
+ getDefaultImageAssetID(),
+ getBlankImageAssetID(),
+ getTentative(),
+ getAllowNoTexture(),
+ mLabel,
+ mImmediateFilterPermMask,
+ mDnDFilterPermMask,
+ mCanApplyImmediately,
+ mFallbackImage,
+ mInventoryPickType);
+ mFloaterHandle = floaterp->getHandle();
+
+ LLFloaterTexturePicker* texture_floaterp = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
+ if (texture_floaterp && mOnTextureSelectedCallback)
+ {
+ texture_floaterp->setTextureSelectedCallback(mOnTextureSelectedCallback);
+ }
+ if (texture_floaterp && mOnCloseCallback)
+ {
+ texture_floaterp->setOnFloaterCloseCallback(boost::bind(&LLTextureCtrl::onFloaterClose, this));
+ }
+ if (texture_floaterp)
+ {
+ texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2, _3, _4, _5));
+ }
+ if (texture_floaterp)
+ {
+ texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1));
+
+ texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled);
+ }
+
+ LLFloater* root_floater = gFloaterView->getParentFloater(this);
+ if (root_floater)
+ root_floater->addDependentFloater(floaterp);
+ floaterp->openFloater();
+ }
+
+ LLFloaterTexturePicker* picker_floater = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
+ if (picker_floater)
+ {
+ picker_floater->setLocalTextureEnabled(mAllowLocalTexture);
+ }
+
+ if (take_focus)
+ {
+ floaterp->setFocus(TRUE);
+ }
}
void LLTextureCtrl::closeDependentFloater()
{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( floaterp && floaterp->isInVisibleChain())
- {
- floaterp->setOwner(NULL);
- floaterp->setVisible(FALSE);
- floaterp->closeFloater();
- }
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
+ if( floaterp && floaterp->isInVisibleChain())
+ {
+ floaterp->setOwner(NULL);
+ floaterp->setVisible(FALSE);
+ floaterp->closeFloater();
+ }
}
// Allow us to download textures quickly when floater is shown
class LLTextureFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
{
public:
- virtual void done()
- {
- // We need to find textures in all folders, so get the main
- // background download going.
- LLInventoryModelBackgroundFetch::instance().start();
- gInventory.removeObserver(this);
- delete this;
- }
+ virtual void done()
+ {
+ // We need to find textures in all folders, so get the main
+ // background download going.
+ LLInventoryModelBackgroundFetch::instance().start();
+ gInventory.removeObserver(this);
+ delete this;
+ }
};
BOOL LLTextureCtrl::handleHover(S32 x, S32 y, MASK mask)
{
- getWindow()->setCursor(mBorder->parentPointInView(x,y) ? UI_CURSOR_HAND : UI_CURSOR_ARROW);
- return TRUE;
+ getWindow()->setCursor(mBorder->parentPointInView(x,y) ? UI_CURSOR_HAND : UI_CURSOR_ARROW);
+ return TRUE;
}
BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLUICtrl::handleMouseDown( x, y , mask );
+ BOOL handled = LLUICtrl::handleMouseDown( x, y , mask );
- if (!handled && mBorder->parentPointInView(x, y))
- {
- if (!mOpenTexPreview)
- {
- showPicker(FALSE);
+ if (!handled && mBorder->parentPointInView(x, y))
+ {
+ if (!mOpenTexPreview)
+ {
+ showPicker(FALSE);
if (mInventoryPickType == PICK_MATERIAL)
{
//grab materials first...
@@ -1923,48 +1923,48 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
//grab textures first...
LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE));
}
- //...then start full inventory fetch.
+ //...then start full inventory fetch.
if (!LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted())
{
LLInventoryModelBackgroundFetch::instance().start();
}
- handled = TRUE;
- }
- else
- {
- if (getImageAssetID().notNull())
- {
- LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", getValue());
- if (preview_texture && !preview_texture->isDependent())
- {
- LLFloater* root_floater = gFloaterView->getParentFloater(this);
- if (root_floater)
- {
- root_floater->addDependentFloater(preview_texture);
- preview_texture->hideCtrlButtons();
- }
- }
- }
- }
- }
-
- return handled;
+ handled = TRUE;
+ }
+ else
+ {
+ if (getImageAssetID().notNull())
+ {
+ LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", getValue());
+ if (preview_texture && !preview_texture->isDependent())
+ {
+ LLFloater* root_floater = gFloaterView->getParentFloater(this);
+ if (root_floater)
+ {
+ root_floater->addDependentFloater(preview_texture);
+ preview_texture->hideCtrlButtons();
+ }
+ }
+ }
+ }
+ }
+
+ return handled;
}
void LLTextureCtrl::onFloaterClose()
{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if (floaterp)
- {
- if (mOnCloseCallback)
- {
- mOnCloseCallback(this,LLSD());
- }
- floaterp->setOwner(NULL);
- }
+ if (floaterp)
+ {
+ if (mOnCloseCallback)
+ {
+ mOnCloseCallback(this,LLSD());
+ }
+ floaterp->setOwner(NULL);
+ }
- mFloaterHandle.markDead();
+ mFloaterHandle.markDead();
}
void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLPickerSource source, const LLUUID& asset_id, const LLUUID& inv_id, const LLUUID& tracking_id)
@@ -1972,18 +1972,18 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLPickerSource source, co
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if( floaterp && getEnabled())
- {
- if (op == TEXTURE_CANCEL)
- mViewModel->resetDirty();
- // If the "no_commit_on_selection" parameter is set
- // we get dirty only when user presses OK in the picker
- // (i.e. op == TEXTURE_SELECT) or texture changes via DnD.
- else if (mCommitOnSelection || op == TEXTURE_SELECT)
- mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
-
- if(floaterp->isDirty() || asset_id.notNull()) // mModelView->setDirty does not work.
- {
- setTentative( FALSE );
+ {
+ if (op == TEXTURE_CANCEL)
+ mViewModel->resetDirty();
+ // If the "no_commit_on_selection" parameter is set
+ // we get dirty only when user presses OK in the picker
+ // (i.e. op == TEXTURE_SELECT) or texture changes via DnD.
+ else if (mCommitOnSelection || op == TEXTURE_SELECT)
+ mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
+
+ if(floaterp->isDirty() || asset_id.notNull()) // mModelView->setDirty does not work.
+ {
+ setTentative( FALSE );
switch(source)
{
@@ -2012,76 +2012,76 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLPickerSource source, co
LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << ", mImageItemID: " << mImageItemID << LL_ENDL;
- if (op == TEXTURE_SELECT && mOnSelectCallback)
- {
+ if (op == TEXTURE_SELECT && mOnSelectCallback)
+ {
mOnSelectCallback(this, LLSD());
- }
- else if (op == TEXTURE_CANCEL && mOnCancelCallback)
- {
- mOnCancelCallback( this, LLSD() );
- }
- else
- {
- // If the "no_commit_on_selection" parameter is set
- // we commit only when user presses OK in the picker
- // (i.e. op == TEXTURE_SELECT) or texture changes via DnD.
+ }
+ else if (op == TEXTURE_CANCEL && mOnCancelCallback)
+ {
+ mOnCancelCallback( this, LLSD() );
+ }
+ else
+ {
+ // If the "no_commit_on_selection" parameter is set
+ // we commit only when user presses OK in the picker
+ // (i.e. op == TEXTURE_SELECT) or texture changes via DnD.
if (mCommitOnSelection || op == TEXTURE_SELECT)
{
onCommit();
}
- }
- }
- }
+ }
+ }
+ }
}
void LLTextureCtrl::setOnTextureSelectedCallback(texture_selected_callback cb)
{
- mOnTextureSelectedCallback = cb;
- LLFloaterTexturePicker* floaterp = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
- if (floaterp)
- {
- floaterp->setTextureSelectedCallback(cb);
- }
+ mOnTextureSelectedCallback = cb;
+ LLFloaterTexturePicker* floaterp = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
+ if (floaterp)
+ {
+ floaterp->setTextureSelectedCallback(cb);
+ }
}
-void LLTextureCtrl::setImageAssetName(const std::string& name)
+void LLTextureCtrl::setImageAssetName(const std::string& name)
{
- LLPointer<LLUIImage> imagep = LLUI::getUIImage(name);
- if(imagep)
- {
- LLViewerFetchedTexture* pTexture = dynamic_cast<LLViewerFetchedTexture*>(imagep->getImage().get());
- if(pTexture)
- {
- LLUUID id = pTexture->getID();
- setImageAssetID(id);
- }
- }
+ LLPointer<LLUIImage> imagep = LLUI::getUIImage(name);
+ if(imagep)
+ {
+ LLViewerFetchedTexture* pTexture = dynamic_cast<LLViewerFetchedTexture*>(imagep->getImage().get());
+ if(pTexture)
+ {
+ LLUUID id = pTexture->getID();
+ setImageAssetID(id);
+ }
+ }
}
void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id )
{
- if( mImageAssetID != asset_id )
- {
- mImageItemID.setNull();
- mImageAssetID = asset_id;
+ if( mImageAssetID != asset_id )
+ {
+ mImageItemID.setNull();
+ mImageAssetID = asset_id;
mLocalTrackingID.setNull();
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( floaterp && getEnabled() )
- {
- floaterp->setImageID( asset_id );
- floaterp->resetDirty();
- }
- }
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
+ if( floaterp && getEnabled() )
+ {
+ floaterp->setImageID( asset_id );
+ floaterp->resetDirty();
+ }
+ }
}
void LLTextureCtrl::setBakeTextureEnabled(bool enabled)
{
mBakeTextureEnabled = enabled;
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if (floaterp)
- {
- floaterp->setBakeTextureEnabled(enabled);
- }
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
+ if (floaterp)
+ {
+ floaterp->setBakeTextureEnabled(enabled);
+ }
}
void LLTextureCtrl::setInventoryPickType(EPickInventoryType type)
@@ -2095,16 +2095,16 @@ void LLTextureCtrl::setInventoryPickType(EPickInventoryType type)
}
BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg)
+ BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
+ EAcceptance *accept,
+ std::string& tooltip_msg)
{
- BOOL handled = FALSE;
+ BOOL handled = FALSE;
- // this downcast may be invalid - but if the second test below
- // returns true, then the cast was valid, and we can perform
- // the third test without problems.
- LLInventoryItem* item = (LLInventoryItem*)cargo_data;
+ // this downcast may be invalid - but if the second test below
+ // returns true, then the cast was valid, and we can perform
+ // the third test without problems.
+ LLInventoryItem* item = (LLInventoryItem*)cargo_data;
bool is_mesh = cargo_type == DAD_MESH;
bool is_texture = cargo_type == DAD_TEXTURE;
@@ -2124,60 +2124,60 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
allow_dnd = is_texture || is_mesh || is_material;
}
- if (getEnabled() && allow_dnd && allowDrop(item, cargo_type, tooltip_msg))
- {
- if (drop)
- {
- if(doDrop(item))
- {
- if (!mCommitOnSelection)
- mViewModel->setDirty();
+ if (getEnabled() && allow_dnd && allowDrop(item, cargo_type, tooltip_msg))
+ {
+ if (drop)
+ {
+ if(doDrop(item))
+ {
+ if (!mCommitOnSelection)
+ mViewModel->setDirty();
- // This removes the 'Multiple' overlay, since
- // there is now only one texture selected.
- setTentative( FALSE );
- onCommit();
- }
- }
+ // This removes the 'Multiple' overlay, since
+ // there is now only one texture selected.
+ setTentative( FALSE );
+ onCommit();
+ }
+ }
- *accept = ACCEPT_YES_SINGLE;
- }
- else
- {
- *accept = ACCEPT_NO;
- }
+ *accept = ACCEPT_YES_SINGLE;
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ }
- handled = TRUE;
- LL_DEBUGS("UserInput") << "dragAndDrop handled by LLTextureCtrl " << getName() << LL_ENDL;
+ handled = TRUE;
+ LL_DEBUGS("UserInput") << "dragAndDrop handled by LLTextureCtrl " << getName() << LL_ENDL;
- return handled;
+ return handled;
}
void LLTextureCtrl::draw()
{
- mBorder->setKeyboardFocusHighlight(hasFocus());
-
- if (!mValid)
- {
- mTexturep = NULL;
- }
- else if (!mImageAssetID.isNull())
- {
- LLPointer<LLViewerFetchedTexture> texture = NULL;
-
- if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID))
- {
- LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
- if (obj)
- {
- LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(mImageAssetID);
- texture = viewerTexture ? dynamic_cast<LLViewerFetchedTexture*>(viewerTexture) : NULL;
- }
-
- }
-
- if (texture.isNull())
- {
+ mBorder->setKeyboardFocusHighlight(hasFocus());
+
+ if (!mValid)
+ {
+ mTexturep = NULL;
+ }
+ else if (!mImageAssetID.isNull())
+ {
+ LLPointer<LLViewerFetchedTexture> texture = NULL;
+
+ if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID))
+ {
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
+ if (obj)
+ {
+ LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(mImageAssetID);
+ texture = viewerTexture ? dynamic_cast<LLViewerFetchedTexture*>(viewerTexture) : NULL;
+ }
+
+ }
+
+ if (texture.isNull())
+ {
if (mInventoryPickType == PICK_MATERIAL)
{
LLPointer<LLFetchedGLTFMaterial> material = gGLTFMaterialList.getMaterial(mImageAssetID);
@@ -2192,145 +2192,145 @@ void LLTextureCtrl::draw()
texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
texture->forceToSaveRawImage(0);
}
- }
-
- mTexturep = texture;
- }
- else//mImageAssetID == LLUUID::null
- {
- mTexturep = NULL;
- }
-
- // Border
- LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL );
- gl_rect_2d( border, mBorderColor.get(), FALSE );
-
- // Interior
- LLRect interior = border;
- interior.stretch( -1 );
-
- // If we're in a focused floater, don't apply the floater's alpha to the texture (STORM-677).
- const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
- if( mTexturep )
- {
- if( mTexturep->getComponents() == 4 )
- {
- gl_rect_2d_checkerboard( interior, alpha );
- }
-
- gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
- mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
- }
- else if (!mFallbackImage.isNull())
- {
- mFallbackImage->draw(interior, UI_VERTEX_COLOR % alpha);
- }
- else
- {
- gl_rect_2d( interior, LLColor4::grey % alpha, TRUE );
-
- // Draw X
- gl_draw_x( interior, LLColor4::black );
- }
-
- mTentativeLabel->setVisible( getTentative() );
-
- // Show "Loading..." string on the top left corner while this texture is loading.
- // Using the discard level, do not show the string if the texture is almost but not
- // fully loaded.
- if (mTexturep.notNull() &&
- (!mTexturep->isFullyLoaded()) &&
- (mShowLoadingPlaceholder == TRUE))
- {
- U32 v_offset = 25;
- LLFontGL* font = LLFontGL::getFontSansSerif();
-
- // Don't show as loaded if the texture is almost fully loaded (i.e. discard1) unless god
- if ((mTexturep->getDiscardLevel() > 1) || gAgent.isGodlike())
- {
- font->renderUTF8(
- mLoadingPlaceholderString,
- 0,
- llfloor(interior.mLeft+3),
- llfloor(interior.mTop-v_offset),
- LLColor4::white,
- LLFontGL::LEFT,
- LLFontGL::BASELINE,
- LLFontGL::DROP_SHADOW);
- }
-
- // Optionally show more detailed information.
- if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
- {
- LLFontGL* font = LLFontGL::getFontSansSerif();
- std::string tdesc;
- // Show what % the texture has loaded (0 to 100%, 100 is highest), and what level of detail (5 to 0, 0 is best).
-
- v_offset += 12;
- tdesc = llformat(" PK : %d%%", U32(mTexturep->getDownloadProgress()*100.0));
- font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
- LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
-
- v_offset += 12;
- tdesc = llformat(" LVL: %d", mTexturep->getDiscardLevel());
- font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
- LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
-
- v_offset += 12;
- tdesc = llformat(" ID : %s...", (mImageAssetID.asString().substr(0,7)).c_str());
- font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
- LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
- }
- }
-
- LLUICtrl::draw();
+ }
+
+ mTexturep = texture;
+ }
+ else//mImageAssetID == LLUUID::null
+ {
+ mTexturep = NULL;
+ }
+
+ // Border
+ LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL );
+ gl_rect_2d( border, mBorderColor.get(), FALSE );
+
+ // Interior
+ LLRect interior = border;
+ interior.stretch( -1 );
+
+ // If we're in a focused floater, don't apply the floater's alpha to the texture (STORM-677).
+ const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+ if( mTexturep )
+ {
+ if( mTexturep->getComponents() == 4 )
+ {
+ gl_rect_2d_checkerboard( interior, alpha );
+ }
+
+ gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
+ mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
+ }
+ else if (!mFallbackImage.isNull())
+ {
+ mFallbackImage->draw(interior, UI_VERTEX_COLOR % alpha);
+ }
+ else
+ {
+ gl_rect_2d( interior, LLColor4::grey % alpha, TRUE );
+
+ // Draw X
+ gl_draw_x( interior, LLColor4::black );
+ }
+
+ mTentativeLabel->setVisible( getTentative() );
+
+ // Show "Loading..." string on the top left corner while this texture is loading.
+ // Using the discard level, do not show the string if the texture is almost but not
+ // fully loaded.
+ if (mTexturep.notNull() &&
+ (!mTexturep->isFullyLoaded()) &&
+ (mShowLoadingPlaceholder == TRUE))
+ {
+ U32 v_offset = 25;
+ LLFontGL* font = LLFontGL::getFontSansSerif();
+
+ // Don't show as loaded if the texture is almost fully loaded (i.e. discard1) unless god
+ if ((mTexturep->getDiscardLevel() > 1) || gAgent.isGodlike())
+ {
+ font->renderUTF8(
+ mLoadingPlaceholderString,
+ 0,
+ llfloor(interior.mLeft+3),
+ llfloor(interior.mTop-v_offset),
+ LLColor4::white,
+ LLFontGL::LEFT,
+ LLFontGL::BASELINE,
+ LLFontGL::DROP_SHADOW);
+ }
+
+ // Optionally show more detailed information.
+ if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
+ {
+ LLFontGL* font = LLFontGL::getFontSansSerif();
+ std::string tdesc;
+ // Show what % the texture has loaded (0 to 100%, 100 is highest), and what level of detail (5 to 0, 0 is best).
+
+ v_offset += 12;
+ tdesc = llformat(" PK : %d%%", U32(mTexturep->getDownloadProgress()*100.0));
+ font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
+ LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
+
+ v_offset += 12;
+ tdesc = llformat(" LVL: %d", mTexturep->getDiscardLevel());
+ font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
+ LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
+
+ v_offset += 12;
+ tdesc = llformat(" ID : %s...", (mImageAssetID.asString().substr(0,7)).c_str());
+ font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
+ LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
+ }
+ }
+
+ LLUICtrl::draw();
}
BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg)
{
- BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
- BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
- BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID());
-
- PermissionMask item_perm_mask = 0;
- if (copy) item_perm_mask |= PERM_COPY;
- if (mod) item_perm_mask |= PERM_MODIFY;
- if (xfer) item_perm_mask |= PERM_TRANSFER;
-
- PermissionMask filter_perm_mask = mImmediateFilterPermMask;
- if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
- {
- if(mDragCallback)
- {
- return mDragCallback(this, item);
- }
- else
- {
- return TRUE;
- }
- }
- else
- {
+ BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
+ BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
+ BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ gAgent.getID());
+
+ PermissionMask item_perm_mask = 0;
+ if (copy) item_perm_mask |= PERM_COPY;
+ if (mod) item_perm_mask |= PERM_MODIFY;
+ if (xfer) item_perm_mask |= PERM_TRANSFER;
+
+ PermissionMask filter_perm_mask = mImmediateFilterPermMask;
+ if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
+ {
+ if(mDragCallback)
+ {
+ return mDragCallback(this, item);
+ }
+ else
+ {
+ return TRUE;
+ }
+ }
+ else
+ {
PermissionMask mask = PERM_COPY | PERM_TRANSFER;
if ((filter_perm_mask & mask) == mask
&& cargo_type == DAD_TEXTURE)
{
tooltip_msg.assign(LLTrans::getString("TooltipTextureRestrictedDrop"));
}
- return FALSE;
- }
+ return FALSE;
+ }
}
BOOL LLTextureCtrl::doDrop(LLInventoryItem* item)
{
- // call the callback if it exists.
- if(mDropCallback)
- {
- // if it returns TRUE, we return TRUE, and therefore the
- // commit is called above.
- return mDropCallback(this, item);
- }
+ // call the callback if it exists.
+ if(mDropCallback)
+ {
+ // if it returns TRUE, we return TRUE, and therefore the
+ // commit is called above.
+ return mDropCallback(this, item);
+ }
// no callback installed, so just set the image ids and carry on.
LLUUID asset_id = item->getAssetUUID();
@@ -2341,29 +2341,29 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item)
asset_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID;
}
- setImageAssetID(asset_id);
- mImageItemID = item->getUUID();
- return TRUE;
+ setImageAssetID(asset_id);
+ mImageItemID = item->getUUID();
+ return TRUE;
}
BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char)
{
- if( ' ' == uni_char )
- {
- showPicker(TRUE);
- return TRUE;
- }
- return LLUICtrl::handleUnicodeCharHere(uni_char);
+ if( ' ' == uni_char )
+ {
+ showPicker(TRUE);
+ return TRUE;
+ }
+ return LLUICtrl::handleUnicodeCharHere(uni_char);
}
void LLTextureCtrl::setValue( const LLSD& value )
{
- setImageAssetID(value.asUUID());
+ setImageAssetID(value.asUUID());
}
LLSD LLTextureCtrl::getValue() const
{
- return LLSD(getImageAssetID());
+ return LLSD(getImageAssetID());
}
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index cb6ce636e0..9328c2316e 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lltexturectrl.h
* @author Richard Nelson, James Cook
* @brief LLTextureCtrl class header file including related functions
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -87,147 +87,147 @@ class LLTextureCtrl
: public LLUICtrl
{
public:
- typedef enum e_texture_pick_op
- {
- TEXTURE_CHANGE,
- TEXTURE_SELECT,
- TEXTURE_CANCEL
- } ETexturePickOp;
+ typedef enum e_texture_pick_op
+ {
+ TEXTURE_CHANGE,
+ TEXTURE_SELECT,
+ TEXTURE_CANCEL
+ } ETexturePickOp;
public:
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<LLUUID> image_id;
- Optional<LLUUID> default_image_id;
- Optional<std::string> default_image_name;
- Optional<bool> allow_no_texture;
- Optional<bool> can_apply_immediately;
- Optional<bool> no_commit_on_selection; // alternative mode: commit occurs and the widget gets dirty
- // only on DnD or when OK is pressed in the picker
- Optional<S32> label_width;
- Optional<LLUIColor> border_color;
- Optional<LLUIImage*> fallback_image;
-
- Optional<LLTextBox::Params> multiselect_text,
- caption_text;
-
- Optional<LLViewBorder::Params> border;
-
- Params()
- : image_id("image"),
- default_image_id("default_image_id"),
- default_image_name("default_image_name"),
- allow_no_texture("allow_no_texture", false),
- can_apply_immediately("can_apply_immediately"),
- no_commit_on_selection("no_commit_on_selection", false),
- label_width("label_width", -1),
- border_color("border_color"),
- fallback_image("fallback_image"),
- multiselect_text("multiselect_text"),
- caption_text("caption_text"),
- border("border")
- {}
- };
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Optional<LLUUID> image_id;
+ Optional<LLUUID> default_image_id;
+ Optional<std::string> default_image_name;
+ Optional<bool> allow_no_texture;
+ Optional<bool> can_apply_immediately;
+ Optional<bool> no_commit_on_selection; // alternative mode: commit occurs and the widget gets dirty
+ // only on DnD or when OK is pressed in the picker
+ Optional<S32> label_width;
+ Optional<LLUIColor> border_color;
+ Optional<LLUIImage*> fallback_image;
+
+ Optional<LLTextBox::Params> multiselect_text,
+ caption_text;
+
+ Optional<LLViewBorder::Params> border;
+
+ Params()
+ : image_id("image"),
+ default_image_id("default_image_id"),
+ default_image_name("default_image_name"),
+ allow_no_texture("allow_no_texture", false),
+ can_apply_immediately("can_apply_immediately"),
+ no_commit_on_selection("no_commit_on_selection", false),
+ label_width("label_width", -1),
+ border_color("border_color"),
+ fallback_image("fallback_image"),
+ multiselect_text("multiselect_text"),
+ caption_text("caption_text"),
+ border("border")
+ {}
+ };
protected:
- LLTextureCtrl(const Params&);
- friend class LLUICtrlFactory;
+ LLTextureCtrl(const Params&);
+ friend class LLUICtrlFactory;
public:
- virtual ~LLTextureCtrl();
+ virtual ~LLTextureCtrl();
+
+ // LLView interface
- // LLView interface
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
+ BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
+ EAcceptance *accept,
+ std::string& tooltip_msg);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual BOOL handleUnicodeCharHere(llwchar uni_char);
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual BOOL handleUnicodeCharHere(llwchar uni_char);
+ virtual void draw();
+ virtual void setVisible( BOOL visible );
+ virtual void setEnabled( BOOL enabled );
- virtual void draw();
- virtual void setVisible( BOOL visible );
- virtual void setEnabled( BOOL enabled );
+ void setValid(BOOL valid);
- void setValid(BOOL valid);
+ // LLUICtrl interface
+ virtual void clear();
- // LLUICtrl interface
- virtual void clear();
+ // Takes a UUID, wraps get/setImageAssetID
+ virtual void setValue(const LLSD& value);
+ virtual LLSD getValue() const;
- // Takes a UUID, wraps get/setImageAssetID
- virtual void setValue(const LLSD& value);
- virtual LLSD getValue() const;
+ // LLTextureCtrl interface
+ void showPicker(BOOL take_focus);
+ bool isPickerShown() { return !mFloaterHandle.isDead(); }
+ void setLabel(const std::string& label);
+ void setLabelWidth(S32 label_width) {mLabelWidth =label_width;}
+ const std::string& getLabel() const { return mLabel; }
- // LLTextureCtrl interface
- void showPicker(BOOL take_focus);
- bool isPickerShown() { return !mFloaterHandle.isDead(); }
- void setLabel(const std::string& label);
- void setLabelWidth(S32 label_width) {mLabelWidth =label_width;}
- const std::string& getLabel() const { return mLabel; }
+ void setAllowNoTexture( BOOL b ) { mAllowNoTexture = b; }
+ bool getAllowNoTexture() const { return mAllowNoTexture; }
- void setAllowNoTexture( BOOL b ) { mAllowNoTexture = b; }
- bool getAllowNoTexture() const { return mAllowNoTexture; }
+ void setAllowLocalTexture(BOOL b) { mAllowLocalTexture = b; }
+ BOOL getAllowLocalTexture() const { return mAllowLocalTexture; }
- void setAllowLocalTexture(BOOL b) { mAllowLocalTexture = b; }
- BOOL getAllowLocalTexture() const { return mAllowLocalTexture; }
+ const LLUUID& getImageItemID() { return mImageItemID; }
- const LLUUID& getImageItemID() { return mImageItemID; }
+ virtual void setImageAssetName(const std::string& name);
- virtual void setImageAssetName(const std::string& name);
-
- void setImageAssetID(const LLUUID &image_asset_id);
- const LLUUID& getImageAssetID() const { return mImageAssetID; }
+ void setImageAssetID(const LLUUID &image_asset_id);
+ const LLUUID& getImageAssetID() const { return mImageAssetID; }
- void setDefaultImageAssetID( const LLUUID& id ) { mDefaultImageAssetID = id; }
- const LLUUID& getDefaultImageAssetID() const { return mDefaultImageAssetID; }
+ void setDefaultImageAssetID( const LLUUID& id ) { mDefaultImageAssetID = id; }
+ const LLUUID& getDefaultImageAssetID() const { return mDefaultImageAssetID; }
- const std::string& getDefaultImageName() const { return mDefaultImageName; }
+ const std::string& getDefaultImageName() const { return mDefaultImageName; }
- void setBlankImageAssetID( const LLUUID& id ) { mBlankImageAssetID = id; }
- const LLUUID& getBlankImageAssetID() const { return mBlankImageAssetID; }
+ void setBlankImageAssetID( const LLUUID& id ) { mBlankImageAssetID = id; }
+ const LLUUID& getBlankImageAssetID() const { return mBlankImageAssetID; }
- void setOpenTexPreview(bool open_preview) { mOpenTexPreview = open_preview; }
+ void setOpenTexPreview(bool open_preview) { mOpenTexPreview = open_preview; }
- void setCaption(const std::string& caption);
- void setCanApplyImmediately(BOOL b);
+ void setCaption(const std::string& caption);
+ void setCanApplyImmediately(BOOL b);
- void setCanApply(bool can_preview, bool can_apply);
+ void setCanApply(bool can_preview, bool can_apply);
- void setImmediateFilterPermMask(PermissionMask mask);
- void setDnDFilterPermMask(PermissionMask mask)
- { mDnDFilterPermMask = mask; }
- PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; }
+ void setImmediateFilterPermMask(PermissionMask mask);
+ void setDnDFilterPermMask(PermissionMask mask)
+ { mDnDFilterPermMask = mask; }
+ PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; }
void setFilterPermissionMasks(PermissionMask mask);
- void closeDependentFloater();
+ void closeDependentFloater();
- void onFloaterClose();
- void onFloaterCommit(ETexturePickOp op,
+ void onFloaterClose();
+ void onFloaterCommit(ETexturePickOp op,
LLPickerSource source,
const LLUUID& local_id,
const LLUUID& inv_id,
const LLUUID& tracking_id);
- // This call is returned when a drag is detected. Your callback
- // should return TRUE if the drag is acceptable.
- void setDragCallback(drag_n_drop_callback cb) { mDragCallback = cb; }
+ // This call is returned when a drag is detected. Your callback
+ // should return TRUE if the drag is acceptable.
+ void setDragCallback(drag_n_drop_callback cb) { mDragCallback = cb; }
+
+ // This callback is called when the drop happens. Return TRUE if
+ // the drop happened - resulting in an on commit callback, but not
+ // necessariliy any other change.
+ void setDropCallback(drag_n_drop_callback cb) { mDropCallback = cb; }
- // This callback is called when the drop happens. Return TRUE if
- // the drop happened - resulting in an on commit callback, but not
- // necessariliy any other change.
- void setDropCallback(drag_n_drop_callback cb) { mDropCallback = cb; }
-
- void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; }
- void setOnCloseCallback(commit_callback_t cb) { mOnCloseCallback = cb; }
- void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; }
+ void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; }
+ void setOnCloseCallback(commit_callback_t cb) { mOnCloseCallback = cb; }
+ void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; }
- /*
- * callback for changing texture selection in inventory list of texture floater
- */
- void setOnTextureSelectedCallback(texture_selected_callback cb);
+ /*
+ * callback for changing texture selection in inventory list of texture floater
+ */
+ void setOnTextureSelectedCallback(texture_selected_callback cb);
- void setShowLoadingPlaceholder(BOOL showLoadingPlaceholder);
+ void setShowLoadingPlaceholder(BOOL showLoadingPlaceholder);
- LLViewerFetchedTexture* getTexture() { return mTexturep; }
+ LLViewerFetchedTexture* getTexture() { return mTexturep; }
void setBakeTextureEnabled(bool enabled);
bool getBakeTextureEnabled() const { return mBakeTextureEnabled; }
@@ -239,43 +239,43 @@ public:
LLUUID getLocalTrackingID() { return mLocalTrackingID; }
private:
- BOOL allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg);
- BOOL doDrop(LLInventoryItem* item);
+ BOOL allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg);
+ BOOL doDrop(LLInventoryItem* item);
private:
- drag_n_drop_callback mDragCallback;
- drag_n_drop_callback mDropCallback;
- commit_callback_t mOnCancelCallback;
- commit_callback_t mOnSelectCallback;
- commit_callback_t mOnCloseCallback;
- texture_selected_callback mOnTextureSelectedCallback;
- LLPointer<LLViewerFetchedTexture> mTexturep;
- LLUIColor mBorderColor;
- LLUUID mImageItemID;
- LLUUID mImageAssetID;
- LLUUID mDefaultImageAssetID;
- LLUUID mBlankImageAssetID;
- LLUUID mLocalTrackingID;
- LLUIImagePtr mFallbackImage;
- std::string mDefaultImageName;
- LLHandle<LLFloater> mFloaterHandle;
- LLTextBox* mTentativeLabel;
- LLTextBox* mCaption;
- std::string mLabel;
- BOOL mAllowNoTexture; // If true, the user can select "none" as an option
- BOOL mAllowLocalTexture;
- PermissionMask mImmediateFilterPermMask;
- PermissionMask mDnDFilterPermMask;
- BOOL mCanApplyImmediately;
- BOOL mCommitOnSelection;
- BOOL mNeedsRawImageData;
- LLViewBorder* mBorder;
- BOOL mValid;
- BOOL mShowLoadingPlaceholder;
- std::string mLoadingPlaceholderString;
- S32 mLabelWidth;
- bool mOpenTexPreview;
- bool mBakeTextureEnabled;
+ drag_n_drop_callback mDragCallback;
+ drag_n_drop_callback mDropCallback;
+ commit_callback_t mOnCancelCallback;
+ commit_callback_t mOnSelectCallback;
+ commit_callback_t mOnCloseCallback;
+ texture_selected_callback mOnTextureSelectedCallback;
+ LLPointer<LLViewerFetchedTexture> mTexturep;
+ LLUIColor mBorderColor;
+ LLUUID mImageItemID;
+ LLUUID mImageAssetID;
+ LLUUID mDefaultImageAssetID;
+ LLUUID mBlankImageAssetID;
+ LLUUID mLocalTrackingID;
+ LLUIImagePtr mFallbackImage;
+ std::string mDefaultImageName;
+ LLHandle<LLFloater> mFloaterHandle;
+ LLTextBox* mTentativeLabel;
+ LLTextBox* mCaption;
+ std::string mLabel;
+ BOOL mAllowNoTexture; // If true, the user can select "none" as an option
+ BOOL mAllowLocalTexture;
+ PermissionMask mImmediateFilterPermMask;
+ PermissionMask mDnDFilterPermMask;
+ BOOL mCanApplyImmediately;
+ BOOL mCommitOnSelection;
+ BOOL mNeedsRawImageData;
+ LLViewBorder* mBorder;
+ BOOL mValid;
+ BOOL mShowLoadingPlaceholder;
+ std::string mLoadingPlaceholderString;
+ S32 mLabelWidth;
+ bool mOpenTexPreview;
+ bool mBakeTextureEnabled;
EPickInventoryType mInventoryPickType;
};
@@ -289,90 +289,90 @@ typedef boost::function<void(LLPointer<LLViewerTexture> texture)> set_on_update_
class LLFloaterTexturePicker : public LLFloater
{
public:
- LLFloaterTexturePicker(
- LLView* owner,
- LLUUID image_asset_id,
- LLUUID default_image_asset_id,
- LLUUID blank_image_asset_id,
- BOOL tentative,
- BOOL allow_no_texture,
- const std::string& label,
- PermissionMask immediate_filter_perm_mask,
- PermissionMask dnd_filter_perm_mask,
- BOOL can_apply_immediately,
- LLUIImagePtr fallback_image_name,
- EPickInventoryType pick_type);
-
- virtual ~LLFloaterTexturePicker();
-
- // LLView overrides
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg);
- /*virtual*/ void draw();
- /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
-
- // LLFloater overrides
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
- /*virtual*/ void onClose(bool app_settings);
-
- // New functions
- void setImageID(const LLUUID& image_asset_id, bool set_selection = true);
- bool updateImageStats(); // true if within limits
- const LLUUID& getAssetID() { return mImageAssetID; }
- const LLUUID& findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library = FALSE);
- void setCanApplyImmediately(BOOL b);
-
- void setActive(BOOL active);
-
- LLView* getOwner() const { return mOwner; }
- void setOwner(LLView* owner) { mOwner = owner; }
- void stopUsingPipette();
-
- void commitIfImmediateSet();
+ LLFloaterTexturePicker(
+ LLView* owner,
+ LLUUID image_asset_id,
+ LLUUID default_image_asset_id,
+ LLUUID blank_image_asset_id,
+ BOOL tentative,
+ BOOL allow_no_texture,
+ const std::string& label,
+ PermissionMask immediate_filter_perm_mask,
+ PermissionMask dnd_filter_perm_mask,
+ BOOL can_apply_immediately,
+ LLUIImagePtr fallback_image_name,
+ EPickInventoryType pick_type);
+
+ virtual ~LLFloaterTexturePicker();
+
+ // LLView overrides
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
+ BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
+ EAcceptance *accept,
+ std::string& tooltip_msg);
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
+
+ // LLFloater overrides
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_settings);
+
+ // New functions
+ void setImageID(const LLUUID& image_asset_id, bool set_selection = true);
+ bool updateImageStats(); // true if within limits
+ const LLUUID& getAssetID() { return mImageAssetID; }
+ const LLUUID& findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library = FALSE);
+ void setCanApplyImmediately(BOOL b);
+
+ void setActive(BOOL active);
+
+ LLView* getOwner() const { return mOwner; }
+ void setOwner(LLView* owner) { mOwner = owner; }
+ void stopUsingPipette();
+
+ void commitIfImmediateSet();
void commitCallback(LLTextureCtrl::ETexturePickOp op);
- void commitCancel();
+ void commitCancel();
- void onFilterEdit(const std::string& search_string);
+ void onFilterEdit(const std::string& search_string);
- void setCanApply(bool can_preview, bool can_apply, bool inworld_image = true);
+ void setCanApply(bool can_preview, bool can_apply, bool inworld_image = true);
void setMinDimentionsLimits(S32 min_dim);
- void setTextureSelectedCallback(const texture_selected_callback& cb) { mTextureSelectedCallback = cb; }
- void setOnFloaterCloseCallback(const floater_close_callback& cb) { mOnFloaterCloseCallback = cb; }
- void setOnFloaterCommitCallback(const floater_commit_callback& cb) { mOnFloaterCommitCallback = cb; }
- void setSetImageAssetIDCallback(const set_image_asset_id_callback& cb) { mSetImageAssetIDCallback = cb; }
- void setOnUpdateImageStatsCallback(const set_on_update_image_stats_callback& cb) { mOnUpdateImageStatsCallback = cb; }
- const LLUUID& getDefaultImageAssetID() { return mDefaultImageAssetID; }
- const LLUUID& getBlankImageAssetID() { return mBlankImageAssetID; }
-
- static void onBtnSetToDefault(void* userdata);
- static void onBtnSelect(void* userdata);
- static void onBtnCancel(void* userdata);
- void onBtnPipette();
- //static void onBtnRevert( void* userdata );
- static void onBtnBlank(void* userdata);
- static void onBtnNone(void* userdata);
- void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
- static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata);
- void onTextureSelect(const LLTextureEntry& te);
-
- static void onModeSelect(LLUICtrl* ctrl, void *userdata);
- static void onBtnAdd(void* userdata);
- static void onBtnRemove(void* userdata);
- static void onBtnUpload(void* userdata);
- static void onLocalScrollCommit(LLUICtrl* ctrl, void* userdata);
-
- static void onBakeTextureSelect(LLUICtrl* ctrl, void *userdata);
-
- void setLocalTextureEnabled(BOOL enabled);
- void setBakeTextureEnabled(BOOL enabled);
+ void setTextureSelectedCallback(const texture_selected_callback& cb) { mTextureSelectedCallback = cb; }
+ void setOnFloaterCloseCallback(const floater_close_callback& cb) { mOnFloaterCloseCallback = cb; }
+ void setOnFloaterCommitCallback(const floater_commit_callback& cb) { mOnFloaterCommitCallback = cb; }
+ void setSetImageAssetIDCallback(const set_image_asset_id_callback& cb) { mSetImageAssetIDCallback = cb; }
+ void setOnUpdateImageStatsCallback(const set_on_update_image_stats_callback& cb) { mOnUpdateImageStatsCallback = cb; }
+ const LLUUID& getDefaultImageAssetID() { return mDefaultImageAssetID; }
+ const LLUUID& getBlankImageAssetID() { return mBlankImageAssetID; }
+
+ static void onBtnSetToDefault(void* userdata);
+ static void onBtnSelect(void* userdata);
+ static void onBtnCancel(void* userdata);
+ void onBtnPipette();
+ //static void onBtnRevert( void* userdata );
+ static void onBtnBlank(void* userdata);
+ static void onBtnNone(void* userdata);
+ void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
+ static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata);
+ void onTextureSelect(const LLTextureEntry& te);
+
+ static void onModeSelect(LLUICtrl* ctrl, void *userdata);
+ static void onBtnAdd(void* userdata);
+ static void onBtnRemove(void* userdata);
+ static void onBtnUpload(void* userdata);
+ static void onLocalScrollCommit(LLUICtrl* ctrl, void* userdata);
+
+ static void onBakeTextureSelect(LLUICtrl* ctrl, void *userdata);
+
+ void setLocalTextureEnabled(BOOL enabled);
+ void setBakeTextureEnabled(BOOL enabled);
void setInventoryPickType(EPickInventoryType type);
void setImmediateFilterPermMask(PermissionMask mask);
- static void onPickerCallback(const std::vector<std::string>& filenames, LLHandle<LLFloater> handle);
+ static void onPickerCallback(const std::vector<std::string>& filenames, LLHandle<LLFloater> handle);
protected:
void changeMode();
@@ -380,40 +380,40 @@ protected:
void refreshInventoryFilter();
void setImageIDFromItem(const LLInventoryItem* itemp, bool set_selection = true);
- LLPointer<LLViewerTexture> mTexturep;
+ LLPointer<LLViewerTexture> mTexturep;
LLPointer<LLFetchedGLTFMaterial> mGLTFMaterial;
- LLView* mOwner;
+ LLView* mOwner;
- LLUUID mImageAssetID; // Currently selected texture
- LLUIImagePtr mFallbackImage; // What to show if currently selected texture is null.
- LLUUID mDefaultImageAssetID;
- LLUUID mBlankImageAssetID;
- BOOL mTentative;
- BOOL mAllowNoTexture;
- LLUUID mSpecialCurrentImageAssetID; // Used when the asset id has no corresponding texture in the user's inventory.
- LLUUID mOriginalImageAssetID;
+ LLUUID mImageAssetID; // Currently selected texture
+ LLUIImagePtr mFallbackImage; // What to show if currently selected texture is null.
+ LLUUID mDefaultImageAssetID;
+ LLUUID mBlankImageAssetID;
+ BOOL mTentative;
+ BOOL mAllowNoTexture;
+ LLUUID mSpecialCurrentImageAssetID; // Used when the asset id has no corresponding texture in the user's inventory.
+ LLUUID mOriginalImageAssetID;
- std::string mLabel;
+ std::string mLabel;
- LLTextBox* mTentativeLabel;
- LLTextBox* mResolutionLabel;
+ LLTextBox* mTentativeLabel;
+ LLTextBox* mResolutionLabel;
LLTextBox* mResolutionWarning;
- std::string mPendingName;
- BOOL mActive;
-
- LLFilterEditor* mFilterEdit;
- LLInventoryPanel* mInventoryPanel;
- PermissionMask mImmediateFilterPermMask;
- PermissionMask mDnDFilterPermMask;
- BOOL mCanApplyImmediately;
- BOOL mNoCopyTextureSelected;
- F32 mContextConeOpacity;
- LLSaveFolderState mSavedFolderState;
- BOOL mSelectedItemPinned;
-
- LLComboBox* mModeSelector;
- LLScrollListCtrl* mLocalScrollCtrl;
+ std::string mPendingName;
+ BOOL mActive;
+
+ LLFilterEditor* mFilterEdit;
+ LLInventoryPanel* mInventoryPanel;
+ PermissionMask mImmediateFilterPermMask;
+ PermissionMask mDnDFilterPermMask;
+ BOOL mCanApplyImmediately;
+ BOOL mNoCopyTextureSelected;
+ F32 mContextConeOpacity;
+ LLSaveFolderState mSavedFolderState;
+ BOOL mSelectedItemPinned;
+
+ LLComboBox* mModeSelector;
+ LLScrollListCtrl* mLocalScrollCtrl;
LLButton* mDefaultBtn;
LLButton* mNoneBtn;
LLButton* mBlankBtn;
@@ -422,22 +422,22 @@ protected:
LLButton* mCancelBtn;
private:
- bool mCanApply;
- bool mCanPreview;
- bool mPreviewSettingChanged;
+ bool mCanApply;
+ bool mCanPreview;
+ bool mPreviewSettingChanged;
bool mLimitsSet;
S32 mMaxDim;
S32 mMinDim;
EPickInventoryType mInventoryPickType;
- texture_selected_callback mTextureSelectedCallback;
- floater_close_callback mOnFloaterCloseCallback;
- floater_commit_callback mOnFloaterCommitCallback;
- set_image_asset_id_callback mSetImageAssetIDCallback;
- set_on_update_image_stats_callback mOnUpdateImageStatsCallback;
+ texture_selected_callback mTextureSelectedCallback;
+ floater_close_callback mOnFloaterCloseCallback;
+ floater_commit_callback mOnFloaterCommitCallback;
+ set_image_asset_id_callback mSetImageAssetIDCallback;
+ set_on_update_image_stats_callback mOnUpdateImageStatsCallback;
- BOOL mBakeTextureEnabled;
+ BOOL mBakeTextureEnabled;
static S32 sLastPickerMode;
};
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 40bbe2b934..e73ebd528e 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexturefetch.cpp
* @brief Object which fetches textures from the cache and/or network
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012-2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -212,8 +212,8 @@ const std::string sTesterName("TextureFetchTester");
// Worker State Machine
//
// "doWork" will be executed for a given worker on its respective
-// LLQueuedThread. If doWork returns true, the worker is treated
-// as completed. If doWork returns false, the worker will be
+// LLQueuedThread. If doWork returns true, the worker is treated
+// as completed. If doWork returns false, the worker will be
// put on the back of the work queue at the start of the next iteration
// of the mainloop. If a worker is waiting on a resource, it should
// return false as soon as possible and not block to avoid starving
@@ -226,8 +226,8 @@ const std::string sTesterName("TextureFetchTester");
// Tuning/Parameterization Constants
-static const S32 HTTP_PIPE_REQUESTS_HIGH_WATER = 100; // Maximum requests to have active in HTTP (pipelined)
-static const S32 HTTP_PIPE_REQUESTS_LOW_WATER = 50; // Active level at which to refill
+static const S32 HTTP_PIPE_REQUESTS_HIGH_WATER = 100; // Maximum requests to have active in HTTP (pipelined)
+static const S32 HTTP_PIPE_REQUESTS_LOW_WATER = 50; // Active level at which to refill
static const S32 HTTP_NONPIPE_REQUESTS_HIGH_WATER = 40;
static const S32 HTTP_NONPIPE_REQUESTS_LOW_WATER = 20;
@@ -247,12 +247,12 @@ static const S32 CAP_MISSING_EXPIRATION_DELAY = 1; // seconds
namespace
{
// The NoOpDeletor is used when passing certain objects (the LLTextureFetchWorker)
- // in a smart pointer below for passage into
- // the LLCore::Http libararies. When the smart pointer is destroyed, no
- // action will be taken since we do not in these cases want the object to
+ // in a smart pointer below for passage into
+ // the LLCore::Http libararies. When the smart pointer is destroyed, no
+ // action will be taken since we do not in these cases want the object to
// be destroyed at the end of the call.
- //
- // *NOTE$: Yes! It is "Deletor"
+ //
+ // *NOTE$: Yes! It is "Deletor"
// http://english.stackexchange.com/questions/4733/what-s-the-rule-for-adding-er-vs-or-when-nouning-a-verb
// "delete" derives from Latin "deletus"
void NoOpDeletor(LLCore::HttpHandler *)
@@ -261,20 +261,20 @@ namespace
static const char* e_state_name[] =
{
- "INVALID",
- "INIT",
- "LOAD_FROM_TEXTURE_CACHE",
- "CACHE_POST",
- "LOAD_FROM_NETWORK",
- "WAIT_HTTP_RESOURCE",
- "WAIT_HTTP_RESOURCE2",
- "SEND_HTTP_REQ",
- "WAIT_HTTP_REQ",
- "DECODE_IMAGE",
- "DECODE_IMAGE_UPDATE",
- "WRITE_TO_CACHE",
- "WAIT_ON_WRITE",
- "DONE"
+ "INVALID",
+ "INIT",
+ "LOAD_FROM_TEXTURE_CACHE",
+ "CACHE_POST",
+ "LOAD_FROM_NETWORK",
+ "WAIT_HTTP_RESOURCE",
+ "WAIT_HTTP_RESOURCE2",
+ "SEND_HTTP_REQ",
+ "WAIT_HTTP_REQ",
+ "DECODE_IMAGE",
+ "DECODE_IMAGE_UPDATE",
+ "WRITE_TO_CACHE",
+ "WAIT_ON_WRITE",
+ "DONE"
};
// Log scope
@@ -283,346 +283,346 @@ static const char * const LOG_TXT = "Texture";
class LLTextureFetchWorker : public LLWorkerClass, public LLCore::HttpHandler
{
- friend class LLTextureFetch;
-
+ friend class LLTextureFetch;
+
private:
- class CacheReadResponder : public LLTextureCache::ReadResponder
- {
- public:
-
- // Threads: Ttf
- CacheReadResponder(LLTextureFetch* fetcher, const LLUUID& id, LLImageFormatted* image)
- : mFetcher(fetcher), mID(id)
- {
- setImage(image);
- }
-
- // Threads: Ttc
- virtual void completed(bool success)
- {
+ class CacheReadResponder : public LLTextureCache::ReadResponder
+ {
+ public:
+
+ // Threads: Ttf
+ CacheReadResponder(LLTextureFetch* fetcher, const LLUUID& id, LLImageFormatted* image)
+ : mFetcher(fetcher), mID(id)
+ {
+ setImage(image);
+ }
+
+ // Threads: Ttc
+ virtual void completed(bool success)
+ {
LL_PROFILE_ZONE_SCOPED;
- LLTextureFetchWorker* worker = mFetcher->getWorker(mID);
- if (worker)
- {
- worker->callbackCacheRead(success, mFormattedImage, mImageSize, mImageLocal);
- }
- }
- private:
- LLTextureFetch* mFetcher;
- LLUUID mID;
- };
-
- class CacheWriteResponder : public LLTextureCache::WriteResponder
- {
- public:
-
- // Threads: Ttf
- CacheWriteResponder(LLTextureFetch* fetcher, const LLUUID& id)
- : mFetcher(fetcher), mID(id)
- {
- }
-
- // Threads: Ttc
- virtual void completed(bool success)
- {
+ LLTextureFetchWorker* worker = mFetcher->getWorker(mID);
+ if (worker)
+ {
+ worker->callbackCacheRead(success, mFormattedImage, mImageSize, mImageLocal);
+ }
+ }
+ private:
+ LLTextureFetch* mFetcher;
+ LLUUID mID;
+ };
+
+ class CacheWriteResponder : public LLTextureCache::WriteResponder
+ {
+ public:
+
+ // Threads: Ttf
+ CacheWriteResponder(LLTextureFetch* fetcher, const LLUUID& id)
+ : mFetcher(fetcher), mID(id)
+ {
+ }
+
+ // Threads: Ttc
+ virtual void completed(bool success)
+ {
LL_PROFILE_ZONE_SCOPED;
- LLTextureFetchWorker* worker = mFetcher->getWorker(mID);
- if (worker)
- {
- worker->callbackCacheWrite(success);
- }
- }
- private:
- LLTextureFetch* mFetcher;
- LLUUID mID;
- };
-
- class DecodeResponder : public LLImageDecodeThread::Responder
- {
- public:
-
- // Threads: Ttf
- DecodeResponder(LLTextureFetch* fetcher, const LLUUID& id, LLTextureFetchWorker* worker)
- : mFetcher(fetcher), mID(id)
- {
- }
-
- // Threads: Tid
- virtual void completed(bool success, LLImageRaw* raw, LLImageRaw* aux, U32 request_id)
- {
+ LLTextureFetchWorker* worker = mFetcher->getWorker(mID);
+ if (worker)
+ {
+ worker->callbackCacheWrite(success);
+ }
+ }
+ private:
+ LLTextureFetch* mFetcher;
+ LLUUID mID;
+ };
+
+ class DecodeResponder : public LLImageDecodeThread::Responder
+ {
+ public:
+
+ // Threads: Ttf
+ DecodeResponder(LLTextureFetch* fetcher, const LLUUID& id, LLTextureFetchWorker* worker)
+ : mFetcher(fetcher), mID(id)
+ {
+ }
+
+ // Threads: Tid
+ virtual void completed(bool success, LLImageRaw* raw, LLImageRaw* aux, U32 request_id)
+ {
LL_PROFILE_ZONE_SCOPED;
- LLTextureFetchWorker* worker = mFetcher->getWorker(mID);
- if (worker)
- {
- worker->callbackDecoded(success, raw, aux, request_id);
- }
- }
- private:
- LLTextureFetch* mFetcher;
- LLUUID mID;
- };
-
- struct Compare
- {
- // lhs < rhs
- bool operator()(const LLTextureFetchWorker* lhs, const LLTextureFetchWorker* rhs) const
- {
- // greater priority is "less"
+ LLTextureFetchWorker* worker = mFetcher->getWorker(mID);
+ if (worker)
+ {
+ worker->callbackDecoded(success, raw, aux, request_id);
+ }
+ }
+ private:
+ LLTextureFetch* mFetcher;
+ LLUUID mID;
+ };
+
+ struct Compare
+ {
+ // lhs < rhs
+ bool operator()(const LLTextureFetchWorker* lhs, const LLTextureFetchWorker* rhs) const
+ {
+ // greater priority is "less"
return lhs->mImagePriority > rhs->mImagePriority;
- }
- };
-
+ }
+ };
+
public:
- // Threads: Ttf
- /*virtual*/ bool doWork(S32 param); // Called from LLWorkerThread::processRequest()
-
- // Threads: Ttf
- /*virtual*/ void finishWork(S32 param, bool completed); // called from finishRequest() (WORK THREAD)
-
- // Threads: Tmain
- /*virtual*/ bool deleteOK(); // called from update()
-
- ~LLTextureFetchWorker();
-
- // Threads: Ttf
- // Locks: Mw
- S32 callbackHttpGet(LLCore::HttpResponse * response,
- bool partial, bool success);
-
- // Threads: Ttc
- void callbackCacheRead(bool success, LLImageFormatted* image,
- S32 imagesize, BOOL islocal);
-
- // Threads: Ttc
- void callbackCacheWrite(bool success);
-
- // Threads: Tid
- void callbackDecoded(bool success, LLImageRaw* raw, LLImageRaw* aux, S32 decode_id);
-
- // Threads: T*
- void setGetStatus(LLCore::HttpStatus status, const std::string& reason)
- {
- LLMutexLock lock(&mWorkMutex);
-
- mGetStatus = status;
- mGetReason = reason;
- }
-
- void setCanUseHTTP(bool can_use_http) { mCanUseHTTP = can_use_http; }
- bool getCanUseHTTP() const { return mCanUseHTTP; }
-
- void setUrl(const std::string& url) { mUrl = url; }
-
- LLTextureFetch & getFetcher() { return *mFetcher; }
-
- // Inherited from LLCore::HttpHandler
- // Threads: Ttf
- virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
-
- enum e_state // mState
- {
- // *NOTE: Do not change the order/value of state variables, some code
- // depends upon specific ordering/adjacency.
-
- // NOTE: Affects LLTextureBar::draw in lltextureview.cpp (debug hack)
- INVALID = 0,
- INIT,
- LOAD_FROM_TEXTURE_CACHE,
- CACHE_POST,
- LOAD_FROM_NETWORK,
- WAIT_HTTP_RESOURCE, // Waiting for HTTP resources
- WAIT_HTTP_RESOURCE2, // Waiting for HTTP resources
- SEND_HTTP_REQ, // Commit to sending as HTTP
- WAIT_HTTP_REQ, // Request sent, wait for completion
- DECODE_IMAGE,
- DECODE_IMAGE_UPDATE,
- WRITE_TO_CACHE,
- WAIT_ON_WRITE,
- DONE
- };
+ // Threads: Ttf
+ /*virtual*/ bool doWork(S32 param); // Called from LLWorkerThread::processRequest()
+
+ // Threads: Ttf
+ /*virtual*/ void finishWork(S32 param, bool completed); // called from finishRequest() (WORK THREAD)
+
+ // Threads: Tmain
+ /*virtual*/ bool deleteOK(); // called from update()
+
+ ~LLTextureFetchWorker();
+
+ // Threads: Ttf
+ // Locks: Mw
+ S32 callbackHttpGet(LLCore::HttpResponse * response,
+ bool partial, bool success);
+
+ // Threads: Ttc
+ void callbackCacheRead(bool success, LLImageFormatted* image,
+ S32 imagesize, BOOL islocal);
+
+ // Threads: Ttc
+ void callbackCacheWrite(bool success);
+
+ // Threads: Tid
+ void callbackDecoded(bool success, LLImageRaw* raw, LLImageRaw* aux, S32 decode_id);
+
+ // Threads: T*
+ void setGetStatus(LLCore::HttpStatus status, const std::string& reason)
+ {
+ LLMutexLock lock(&mWorkMutex);
+
+ mGetStatus = status;
+ mGetReason = reason;
+ }
+
+ void setCanUseHTTP(bool can_use_http) { mCanUseHTTP = can_use_http; }
+ bool getCanUseHTTP() const { return mCanUseHTTP; }
+
+ void setUrl(const std::string& url) { mUrl = url; }
+
+ LLTextureFetch & getFetcher() { return *mFetcher; }
+
+ // Inherited from LLCore::HttpHandler
+ // Threads: Ttf
+ virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
+
+ enum e_state // mState
+ {
+ // *NOTE: Do not change the order/value of state variables, some code
+ // depends upon specific ordering/adjacency.
+
+ // NOTE: Affects LLTextureBar::draw in lltextureview.cpp (debug hack)
+ INVALID = 0,
+ INIT,
+ LOAD_FROM_TEXTURE_CACHE,
+ CACHE_POST,
+ LOAD_FROM_NETWORK,
+ WAIT_HTTP_RESOURCE, // Waiting for HTTP resources
+ WAIT_HTTP_RESOURCE2, // Waiting for HTTP resources
+ SEND_HTTP_REQ, // Commit to sending as HTTP
+ WAIT_HTTP_REQ, // Request sent, wait for completion
+ DECODE_IMAGE,
+ DECODE_IMAGE_UPDATE,
+ WRITE_TO_CACHE,
+ WAIT_ON_WRITE,
+ DONE
+ };
protected:
- LLTextureFetchWorker(LLTextureFetch* fetcher, FTType f_type,
- const std::string& url, const LLUUID& id, const LLHost& host,
- F32 priority, S32 discard, S32 size);
+ LLTextureFetchWorker(LLTextureFetch* fetcher, FTType f_type,
+ const std::string& url, const LLUUID& id, const LLHost& host,
+ F32 priority, S32 discard, S32 size);
private:
- // Threads: Tmain
- /*virtual*/ void startWork(S32 param); // called from addWork() (MAIN THREAD)
+ // Threads: Tmain
+ /*virtual*/ void startWork(S32 param); // called from addWork() (MAIN THREAD)
- // Threads: Tmain
- /*virtual*/ void endWork(S32 param, bool aborted); // called from doWork() (MAIN THREAD)
+ // Threads: Tmain
+ /*virtual*/ void endWork(S32 param, bool aborted); // called from doWork() (MAIN THREAD)
+
+ // Locks: Mw
+ void resetFormattedData();
- // Locks: Mw
- void resetFormattedData();
-
// get the relative priority of this worker (should map to max virtual size)
F32 getImagePriority() const;
- // Locks: Mw
- void setImagePriority(F32 priority);
+ // Locks: Mw
+ void setImagePriority(F32 priority);
- // Locks: Mw (ctor invokes without lock)
- void setDesiredDiscard(S32 discard, S32 size);
+ // Locks: Mw (ctor invokes without lock)
+ void setDesiredDiscard(S32 discard, S32 size);
// Threads: T*
- // Locks: Mw
- bool insertPacket(S32 index, U8* data, S32 size);
-
- // Locks: Mw
- void clearPackets();
-
-
- // Locks: Mw
- void removeFromCache();
-
- // Threads: Ttf
- bool writeToCacheComplete();
-
- // Threads: Ttf
- void recordTextureStart(bool is_http);
-
- // Threads: Ttf
- void recordTextureDone(bool is_http, F64 byte_count);
-
- void lockWorkMutex() { mWorkMutex.lock(); }
- void unlockWorkMutex() { mWorkMutex.unlock(); }
-
- // Threads: Ttf
- // Locks: Mw
- bool acquireHttpSemaphore()
- {
- llassert(! mHttpHasResource);
- if (mFetcher->mHttpSemaphore >= mFetcher->mHttpHighWater)
- {
- return false;
- }
- mHttpHasResource = true;
- mFetcher->mHttpSemaphore++;
- return true;
- }
-
- // Threads: Ttf
- // Locks: Mw
- void releaseHttpSemaphore()
- {
- llassert(mHttpHasResource);
- mHttpHasResource = false;
- mFetcher->mHttpSemaphore--;
- llassert_always(mFetcher->mHttpSemaphore >= 0);
- }
-
+ // Locks: Mw
+ bool insertPacket(S32 index, U8* data, S32 size);
+
+ // Locks: Mw
+ void clearPackets();
+
+
+ // Locks: Mw
+ void removeFromCache();
+
+ // Threads: Ttf
+ bool writeToCacheComplete();
+
+ // Threads: Ttf
+ void recordTextureStart(bool is_http);
+
+ // Threads: Ttf
+ void recordTextureDone(bool is_http, F64 byte_count);
+
+ void lockWorkMutex() { mWorkMutex.lock(); }
+ void unlockWorkMutex() { mWorkMutex.unlock(); }
+
+ // Threads: Ttf
+ // Locks: Mw
+ bool acquireHttpSemaphore()
+ {
+ llassert(! mHttpHasResource);
+ if (mFetcher->mHttpSemaphore >= mFetcher->mHttpHighWater)
+ {
+ return false;
+ }
+ mHttpHasResource = true;
+ mFetcher->mHttpSemaphore++;
+ return true;
+ }
+
+ // Threads: Ttf
+ // Locks: Mw
+ void releaseHttpSemaphore()
+ {
+ llassert(mHttpHasResource);
+ mHttpHasResource = false;
+ mFetcher->mHttpSemaphore--;
+ llassert_always(mFetcher->mHttpSemaphore >= 0);
+ }
+
private:
- enum e_request_state // mSentRequest
- {
- UNSENT = 0,
- QUEUED = 1,
- SENT_SIM = 2
- };
- enum e_write_to_cache_state //mWriteToCacheState
- {
- NOT_WRITE = 0,
- CAN_WRITE = 1,
- SHOULD_WRITE = 2
- };
-
- e_state mState;
- void setState(e_state new_state);
+ enum e_request_state // mSentRequest
+ {
+ UNSENT = 0,
+ QUEUED = 1,
+ SENT_SIM = 2
+ };
+ enum e_write_to_cache_state //mWriteToCacheState
+ {
+ NOT_WRITE = 0,
+ CAN_WRITE = 1,
+ SHOULD_WRITE = 2
+ };
+
+ e_state mState;
+ void setState(e_state new_state);
LLViewerRegion* getRegion();
- e_write_to_cache_state mWriteToCacheState;
- LLTextureFetch* mFetcher;
- LLPointer<LLImageFormatted> mFormattedImage;
- LLPointer<LLImageRaw> mRawImage,
- mAuxImage;
- FTType mFTType;
- LLUUID mID;
- LLHost mHost;
- std::string mUrl;
- U8 mType;
- F32 mImagePriority; // should map to max virtual size
- F32 mRequestedPriority;
- S32 mDesiredDiscard;
- S32 mSimRequestedDiscard;
- S32 mRequestedDiscard;
+ e_write_to_cache_state mWriteToCacheState;
+ LLTextureFetch* mFetcher;
+ LLPointer<LLImageFormatted> mFormattedImage;
+ LLPointer<LLImageRaw> mRawImage,
+ mAuxImage;
+ FTType mFTType;
+ LLUUID mID;
+ LLHost mHost;
+ std::string mUrl;
+ U8 mType;
+ F32 mImagePriority; // should map to max virtual size
+ F32 mRequestedPriority;
+ S32 mDesiredDiscard;
+ S32 mSimRequestedDiscard;
+ S32 mRequestedDiscard;
S32 mLoadedDiscard;
S32 mDecodedDiscard;
- LLFrameTimer mRequestedDeltaTimer;
- LLFrameTimer mFetchDeltaTimer;
- LLTimer mCacheReadTimer;
+ LLFrameTimer mRequestedDeltaTimer;
+ LLFrameTimer mFetchDeltaTimer;
+ LLTimer mCacheReadTimer;
LLTimer mDecodeTimer;
- LLTimer mCacheWriteTimer;
+ LLTimer mCacheWriteTimer;
LLTimer mFetchTimer;
- LLTimer mStateTimer;
- F32 mCacheReadTime; // time for cache read only
+ LLTimer mStateTimer;
+ F32 mCacheReadTime; // time for cache read only
F32 mDecodeTime; // time for decode only
- F32 mCacheWriteTime;
+ F32 mCacheWriteTime;
F32 mFetchTime; // total time from req to finished fetch
- std::map<S32, F32> mStateTimersMap;
- F32 mSkippedStatesTime;
- LLTextureCache::handle_t mCacheReadHandle,
- mCacheWriteHandle;
- S32 mRequestedSize,
- mRequestedOffset,
- mDesiredSize,
- mFileSize,
- mCachedSize;
- e_request_state mSentRequest;
- handle_t mDecodeHandle;
- BOOL mLoaded;
- BOOL mDecoded;
- BOOL mWritten;
- BOOL mNeedsAux;
- BOOL mHaveAllData;
- BOOL mInLocalCache;
- BOOL mInCache;
+ std::map<S32, F32> mStateTimersMap;
+ F32 mSkippedStatesTime;
+ LLTextureCache::handle_t mCacheReadHandle,
+ mCacheWriteHandle;
+ S32 mRequestedSize,
+ mRequestedOffset,
+ mDesiredSize,
+ mFileSize,
+ mCachedSize;
+ e_request_state mSentRequest;
+ handle_t mDecodeHandle;
+ BOOL mLoaded;
+ BOOL mDecoded;
+ BOOL mWritten;
+ BOOL mNeedsAux;
+ BOOL mHaveAllData;
+ BOOL mInLocalCache;
+ BOOL mInCache;
bool mCanUseHTTP;
- S32 mRetryAttempt;
- S32 mActiveCount;
- LLCore::HttpStatus mGetStatus;
- std::string mGetReason;
- LLAdaptiveRetryPolicy mFetchRetryPolicy;
+ S32 mRetryAttempt;
+ S32 mActiveCount;
+ LLCore::HttpStatus mGetStatus;
+ std::string mGetReason;
+ LLAdaptiveRetryPolicy mFetchRetryPolicy;
bool mCanUseCapability;
LLTimer mRegionRetryTimer;
S32 mRegionRetryAttempt;
LLUUID mLastRegionId;
-
- // Work Data
- LLMutex mWorkMutex;
- struct PacketData
- {
- PacketData(U8* data, S32 size)
- : mData(data), mSize(size)
- {}
- ~PacketData() { clearData(); }
- void clearData() { delete[] mData; mData = NULL; }
-
- U8* mData;
- U32 mSize;
- };
- std::vector<PacketData*> mPackets;
- S32 mFirstPacket;
- S32 mLastPacket;
- U16 mTotalPackets;
- U8 mImageCodec;
-
- LLViewerAssetStats::duration_t mMetricsStartTime;
-
- LLCore::HttpHandle mHttpHandle; // Handle of any active request
- LLCore::BufferArray * mHttpBufferArray; // Refcounted pointer to response data
- S32 mHttpPolicyClass;
- bool mHttpActive; // Active request to http library
- U32 mHttpReplySize, // Actual received data size
- mHttpReplyOffset; // Actual received data offset
- bool mHttpHasResource; // Counts against Fetcher's mHttpSemaphore
-
- // State history
- U32 mCacheReadCount,
- mCacheWriteCount,
- mResourceWaitCount; // Requests entering WAIT_HTTP_RESOURCE2
+
+ // Work Data
+ LLMutex mWorkMutex;
+ struct PacketData
+ {
+ PacketData(U8* data, S32 size)
+ : mData(data), mSize(size)
+ {}
+ ~PacketData() { clearData(); }
+ void clearData() { delete[] mData; mData = NULL; }
+
+ U8* mData;
+ U32 mSize;
+ };
+ std::vector<PacketData*> mPackets;
+ S32 mFirstPacket;
+ S32 mLastPacket;
+ U16 mTotalPackets;
+ U8 mImageCodec;
+
+ LLViewerAssetStats::duration_t mMetricsStartTime;
+
+ LLCore::HttpHandle mHttpHandle; // Handle of any active request
+ LLCore::BufferArray * mHttpBufferArray; // Refcounted pointer to response data
+ S32 mHttpPolicyClass;
+ bool mHttpActive; // Active request to http library
+ U32 mHttpReplySize, // Actual received data size
+ mHttpReplyOffset; // Actual received data offset
+ bool mHttpHasResource; // Counts against Fetcher's mHttpSemaphore
+
+ // State history
+ U32 mCacheReadCount,
+ mCacheWriteCount,
+ mResourceWaitCount; // Requests entering WAIT_HTTP_RESOURCE2
};
//////////////////////////////////////////////////////////////////////////////
@@ -732,19 +732,19 @@ private:
class LLTextureFetch::TFRequest // : public LLQueuedThread::QueuedRequest
{
public:
- // Default ctors and assignment operator are correct.
+ // Default ctors and assignment operator are correct.
- virtual ~TFRequest()
- {}
+ virtual ~TFRequest()
+ {}
- // Patterned after QueuedRequest's method but expected behavior
- // is different. Always expected to complete on the first call
- // and work dispatcher will assume the same and delete the
- // request after invocation.
- virtual bool doWork(LLTextureFetch * fetcher) = 0;
+ // Patterned after QueuedRequest's method but expected behavior
+ // is different. Always expected to complete on the first call
+ // and work dispatcher will assume the same and delete the
+ // request after invocation.
+ virtual bool doWork(LLTextureFetch * fetcher) = 0;
};
-namespace
+namespace
{
/**
@@ -761,19 +761,19 @@ namespace
class TFReqSetRegion : public LLTextureFetch::TFRequest
{
public:
- TFReqSetRegion(U64 region_handle)
- : LLTextureFetch::TFRequest(),
- mRegionHandle(region_handle)
- {}
- TFReqSetRegion & operator=(const TFReqSetRegion &); // Not defined
+ TFReqSetRegion(U64 region_handle)
+ : LLTextureFetch::TFRequest(),
+ mRegionHandle(region_handle)
+ {}
+ TFReqSetRegion & operator=(const TFReqSetRegion &); // Not defined
+
+ virtual ~TFReqSetRegion()
+ {}
- virtual ~TFReqSetRegion()
- {}
+ virtual bool doWork(LLTextureFetch * fetcher);
- virtual bool doWork(LLTextureFetch * fetcher);
-
public:
- const U64 mRegionHandle;
+ const U64 mRegionHandle;
};
@@ -795,36 +795,36 @@ class TFReqSendMetrics : public LLTextureFetch::TFRequest
{
public:
/**
- * Construct the 'Send Metrics' command to have the TextureFetch
- * thread add and log metrics data.
- *
- * @param caps_url URL of a "ViewerMetrics" Caps target
- * to receive the data. Does not have to
- * be associated with a particular region.
- *
- * @param session_id UUID of the agent's session.
- *
- * @param agent_id UUID of the agent. (Being pure here...)
- *
- * @param main_stats Pointer to a clone of the main thread's
- * LLViewerAssetStats data. Thread1 takes
- * ownership of the copy and disposes of it
- * when done.
- */
+ * Construct the 'Send Metrics' command to have the TextureFetch
+ * thread add and log metrics data.
+ *
+ * @param caps_url URL of a "ViewerMetrics" Caps target
+ * to receive the data. Does not have to
+ * be associated with a particular region.
+ *
+ * @param session_id UUID of the agent's session.
+ *
+ * @param agent_id UUID of the agent. (Being pure here...)
+ *
+ * @param main_stats Pointer to a clone of the main thread's
+ * LLViewerAssetStats data. Thread1 takes
+ * ownership of the copy and disposes of it
+ * when done.
+ */
TFReqSendMetrics(const std::string & caps_url,
const LLUUID & session_id,
const LLUUID & agent_id,
LLSD& stats_sd);
- TFReqSendMetrics & operator=(const TFReqSendMetrics &); // Not defined
+ TFReqSendMetrics & operator=(const TFReqSendMetrics &); // Not defined
- virtual ~TFReqSendMetrics();
+ virtual ~TFReqSendMetrics();
+
+ virtual bool doWork(LLTextureFetch * fetcher);
- virtual bool doWork(LLTextureFetch * fetcher);
-
public:
- const std::string mCapsURL;
- const LLUUID mSessionID;
- const LLUUID mAgentID;
+ const std::string mCapsURL;
+ const LLUUID mSessionID;
+ const LLUUID mAgentID;
LLSD mStatsSD;
private:
@@ -835,11 +835,11 @@ private:
* Examines the merged viewer metrics report and if found to be too long,
* will attempt to truncate it in some reasonable fashion.
*
- * @param max_regions Limit of regions allowed in report.
+ * @param max_regions Limit of regions allowed in report.
*
- * @param metrics Full, merged viewer metrics report.
+ * @param metrics Full, merged viewer metrics report.
*
- * @returns If data was truncated, returns true.
+ * @returns If data was truncated, returns true.
*/
bool truncate_viewer_metrics(int max_regions, LLSD & metrics);
@@ -849,212 +849,212 @@ bool truncate_viewer_metrics(int max_regions, LLSD & metrics);
//////////////////////////////////////////////////////////////////////////////
const char* sStateDescs[] = {
- "INVALID",
- "INIT",
- "LOAD_FROM_TEXTURE_CACHE",
- "CACHE_POST",
- "LOAD_FROM_NETWORK",
- "WAIT_HTTP_RESOURCE",
- "WAIT_HTTP_RESOURCE2",
- "SEND_HTTP_REQ",
- "WAIT_HTTP_REQ",
- "DECODE_IMAGE",
- "DECODE_IMAGE_UPDATE",
- "WRITE_TO_CACHE",
- "WAIT_ON_WRITE",
- "DONE"
+ "INVALID",
+ "INIT",
+ "LOAD_FROM_TEXTURE_CACHE",
+ "CACHE_POST",
+ "LOAD_FROM_NETWORK",
+ "WAIT_HTTP_RESOURCE",
+ "WAIT_HTTP_RESOURCE2",
+ "SEND_HTTP_REQ",
+ "WAIT_HTTP_REQ",
+ "DECODE_IMAGE",
+ "DECODE_IMAGE_UPDATE",
+ "WRITE_TO_CACHE",
+ "WAIT_ON_WRITE",
+ "DONE"
};
const std::set<S32> LOGGED_STATES = { LLTextureFetchWorker::LOAD_FROM_TEXTURE_CACHE, LLTextureFetchWorker::LOAD_FROM_NETWORK,
- LLTextureFetchWorker::WAIT_HTTP_REQ, LLTextureFetchWorker::DECODE_IMAGE_UPDATE, LLTextureFetchWorker::WAIT_ON_WRITE };
+ LLTextureFetchWorker::WAIT_HTTP_REQ, LLTextureFetchWorker::DECODE_IMAGE_UPDATE, LLTextureFetchWorker::WAIT_ON_WRITE };
// static
-volatile bool LLTextureFetch::svMetricsDataBreak(true); // Start with a data break
+volatile bool LLTextureFetch::svMetricsDataBreak(true); // Start with a data break
// called from MAIN THREAD
LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher,
- FTType f_type, // Fetched image type
- const std::string& url, // Optional URL
- const LLUUID& id, // Image UUID
- const LLHost& host, // Simulator host
- F32 priority, // Priority
- S32 discard, // Desired discard
- S32 size) // Desired size
- : LLWorkerClass(fetcher, "TextureFetch"),
- LLCore::HttpHandler(),
- mState(INIT),
- mWriteToCacheState(NOT_WRITE),
- mFetcher(fetcher),
- mFTType(f_type),
- mID(id),
- mHost(host),
- mUrl(url),
- mImagePriority(priority),
- mRequestedPriority(0.f),
- mDesiredDiscard(-1),
- mSimRequestedDiscard(-1),
- mRequestedDiscard(-1),
- mLoadedDiscard(-1),
- mDecodedDiscard(-1),
- mCacheReadTime(0.f),
- mCacheWriteTime(0.f),
- mDecodeTime(0.f),
+ FTType f_type, // Fetched image type
+ const std::string& url, // Optional URL
+ const LLUUID& id, // Image UUID
+ const LLHost& host, // Simulator host
+ F32 priority, // Priority
+ S32 discard, // Desired discard
+ S32 size) // Desired size
+ : LLWorkerClass(fetcher, "TextureFetch"),
+ LLCore::HttpHandler(),
+ mState(INIT),
+ mWriteToCacheState(NOT_WRITE),
+ mFetcher(fetcher),
+ mFTType(f_type),
+ mID(id),
+ mHost(host),
+ mUrl(url),
+ mImagePriority(priority),
+ mRequestedPriority(0.f),
+ mDesiredDiscard(-1),
+ mSimRequestedDiscard(-1),
+ mRequestedDiscard(-1),
+ mLoadedDiscard(-1),
+ mDecodedDiscard(-1),
+ mCacheReadTime(0.f),
+ mCacheWriteTime(0.f),
+ mDecodeTime(0.f),
mFetchTime(0.f),
- mCacheReadHandle(LLTextureCache::nullHandle()),
- mCacheWriteHandle(LLTextureCache::nullHandle()),
- mRequestedSize(0),
- mRequestedOffset(0),
- mDesiredSize(TEXTURE_CACHE_ENTRY_SIZE),
- mFileSize(0),
- mSkippedStatesTime(0),
- mCachedSize(0),
- mLoaded(FALSE),
- mSentRequest(UNSENT),
- mDecodeHandle(0),
- mDecoded(FALSE),
- mWritten(FALSE),
- mNeedsAux(FALSE),
- mHaveAllData(FALSE),
- mInLocalCache(FALSE),
- mInCache(FALSE),
- mCanUseHTTP(true),
- mRetryAttempt(0),
- mActiveCount(0),
- mWorkMutex(),
- mFirstPacket(0),
- mLastPacket(-1),
- mTotalPackets(0),
- mImageCodec(IMG_CODEC_INVALID),
- mMetricsStartTime(0),
- mHttpHandle(LLCORE_HTTP_HANDLE_INVALID),
- mHttpBufferArray(NULL),
- mHttpPolicyClass(mFetcher->mHttpPolicyClass),
- mHttpActive(false),
- mHttpReplySize(0U),
- mHttpReplyOffset(0U),
- mHttpHasResource(false),
- mCacheReadCount(0U),
- mCacheWriteCount(0U),
- mResourceWaitCount(0U),
+ mCacheReadHandle(LLTextureCache::nullHandle()),
+ mCacheWriteHandle(LLTextureCache::nullHandle()),
+ mRequestedSize(0),
+ mRequestedOffset(0),
+ mDesiredSize(TEXTURE_CACHE_ENTRY_SIZE),
+ mFileSize(0),
+ mSkippedStatesTime(0),
+ mCachedSize(0),
+ mLoaded(FALSE),
+ mSentRequest(UNSENT),
+ mDecodeHandle(0),
+ mDecoded(FALSE),
+ mWritten(FALSE),
+ mNeedsAux(FALSE),
+ mHaveAllData(FALSE),
+ mInLocalCache(FALSE),
+ mInCache(FALSE),
+ mCanUseHTTP(true),
+ mRetryAttempt(0),
+ mActiveCount(0),
+ mWorkMutex(),
+ mFirstPacket(0),
+ mLastPacket(-1),
+ mTotalPackets(0),
+ mImageCodec(IMG_CODEC_INVALID),
+ mMetricsStartTime(0),
+ mHttpHandle(LLCORE_HTTP_HANDLE_INVALID),
+ mHttpBufferArray(NULL),
+ mHttpPolicyClass(mFetcher->mHttpPolicyClass),
+ mHttpActive(false),
+ mHttpReplySize(0U),
+ mHttpReplyOffset(0U),
+ mHttpHasResource(false),
+ mCacheReadCount(0U),
+ mCacheWriteCount(0U),
+ mResourceWaitCount(0U),
mFetchRetryPolicy(10.f,3600.f,2.f,10),
mCanUseCapability(true),
mRegionRetryAttempt(0)
{
- mType = host.isOk() ? LLImageBase::TYPE_AVATAR_BAKE : LLImageBase::TYPE_NORMAL;
-// LL_INFOS(LOG_TXT) << "Create: " << mID << " mHost:" << host << " Discard=" << discard << LL_ENDL;
- if (!mFetcher->mDebugPause)
- {
- addWork(0);
- }
- setDesiredDiscard(discard, size);
+ mType = host.isOk() ? LLImageBase::TYPE_AVATAR_BAKE : LLImageBase::TYPE_NORMAL;
+// LL_INFOS(LOG_TXT) << "Create: " << mID << " mHost:" << host << " Discard=" << discard << LL_ENDL;
+ if (!mFetcher->mDebugPause)
+ {
+ addWork(0);
+ }
+ setDesiredDiscard(discard, size);
}
LLTextureFetchWorker::~LLTextureFetchWorker()
{
-// LL_INFOS(LOG_TXT) << "Destroy: " << mID
-// << " Decoded=" << mDecodedDiscard
-// << " Requested=" << mRequestedDiscard
-// << " Desired=" << mDesiredDiscard << LL_ENDL;
- llassert_always(!haveWork());
-
- lockWorkMutex(); // +Mw (should be useless)
- if (mHttpHasResource)
- {
- // Last-chance catchall to recover the resource. Using an
- // atomic datatype solely because this can be running in
- // another thread.
- releaseHttpSemaphore();
- }
- if (mHttpActive)
- {
- // Issue a cancel on a live request...
+// LL_INFOS(LOG_TXT) << "Destroy: " << mID
+// << " Decoded=" << mDecodedDiscard
+// << " Requested=" << mRequestedDiscard
+// << " Desired=" << mDesiredDiscard << LL_ENDL;
+ llassert_always(!haveWork());
+
+ lockWorkMutex(); // +Mw (should be useless)
+ if (mHttpHasResource)
+ {
+ // Last-chance catchall to recover the resource. Using an
+ // atomic datatype solely because this can be running in
+ // another thread.
+ releaseHttpSemaphore();
+ }
+ if (mHttpActive)
+ {
+ // Issue a cancel on a live request...
mFetcher->getHttpRequest().requestCancel(mHttpHandle, LLCore::HttpHandler::ptr_t());
- }
- if (mCacheReadHandle != LLTextureCache::nullHandle() && mFetcher->mTextureCache)
- {
- mFetcher->mTextureCache->readComplete(mCacheReadHandle, true);
- }
- if (mCacheWriteHandle != LLTextureCache::nullHandle() && mFetcher->mTextureCache)
- {
- mFetcher->mTextureCache->writeComplete(mCacheWriteHandle, true);
- }
- mFormattedImage = NULL;
- clearPackets();
- if (mHttpBufferArray)
- {
- mHttpBufferArray->release();
- mHttpBufferArray = NULL;
- }
- unlockWorkMutex(); // -Mw
- mFetcher->removeFromHTTPQueue(mID, (S32Bytes)0);
- mFetcher->removeHttpWaiter(mID);
- mFetcher->updateStateStats(mCacheReadCount, mCacheWriteCount, mResourceWaitCount);
+ }
+ if (mCacheReadHandle != LLTextureCache::nullHandle() && mFetcher->mTextureCache)
+ {
+ mFetcher->mTextureCache->readComplete(mCacheReadHandle, true);
+ }
+ if (mCacheWriteHandle != LLTextureCache::nullHandle() && mFetcher->mTextureCache)
+ {
+ mFetcher->mTextureCache->writeComplete(mCacheWriteHandle, true);
+ }
+ mFormattedImage = NULL;
+ clearPackets();
+ if (mHttpBufferArray)
+ {
+ mHttpBufferArray->release();
+ mHttpBufferArray = NULL;
+ }
+ unlockWorkMutex(); // -Mw
+ mFetcher->removeFromHTTPQueue(mID, (S32Bytes)0);
+ mFetcher->removeHttpWaiter(mID);
+ mFetcher->updateStateStats(mCacheReadCount, mCacheWriteCount, mResourceWaitCount);
}
// Locks: Mw
void LLTextureFetchWorker::clearPackets()
{
- for_each(mPackets.begin(), mPackets.end(), DeletePointer());
- mPackets.clear();
- mTotalPackets = 0;
- mLastPacket = -1;
- mFirstPacket = 0;
+ for_each(mPackets.begin(), mPackets.end(), DeletePointer());
+ mPackets.clear();
+ mTotalPackets = 0;
+ mLastPacket = -1;
+ mFirstPacket = 0;
}
// Locks: Mw (ctor invokes without lock)
void LLTextureFetchWorker::setDesiredDiscard(S32 discard, S32 size)
{
- bool prioritize = false;
- if (mDesiredDiscard != discard)
- {
- if (!haveWork())
- {
- if (!mFetcher->mDebugPause)
- {
- addWork(0);
- }
- }
- else if (mDesiredDiscard < discard)
- {
- prioritize = true;
- }
- mDesiredDiscard = discard;
- mDesiredSize = size;
- }
- else if (size > mDesiredSize)
- {
- mDesiredSize = size;
- prioritize = true;
- }
- mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE);
- if ((prioritize && mState == INIT) || mState == DONE)
- {
- setState(INIT);
- }
+ bool prioritize = false;
+ if (mDesiredDiscard != discard)
+ {
+ if (!haveWork())
+ {
+ if (!mFetcher->mDebugPause)
+ {
+ addWork(0);
+ }
+ }
+ else if (mDesiredDiscard < discard)
+ {
+ prioritize = true;
+ }
+ mDesiredDiscard = discard;
+ mDesiredSize = size;
+ }
+ else if (size > mDesiredSize)
+ {
+ mDesiredSize = size;
+ prioritize = true;
+ }
+ mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE);
+ if ((prioritize && mState == INIT) || mState == DONE)
+ {
+ setState(INIT);
+ }
}
// Locks: Mw
void LLTextureFetchWorker::setImagePriority(F32 priority)
{
- mImagePriority = priority; //should map to max virtual size, abort if zero
+ mImagePriority = priority; //should map to max virtual size, abort if zero
}
// Locks: Mw
void LLTextureFetchWorker::resetFormattedData()
{
- if (mHttpBufferArray)
- {
- mHttpBufferArray->release();
- mHttpBufferArray = NULL;
- }
- if (mFormattedImage.notNull())
- {
- mFormattedImage->deleteData();
- }
- mHttpReplySize = 0;
- mHttpReplyOffset = 0;
- mHaveAllData = FALSE;
+ if (mHttpBufferArray)
+ {
+ mHttpBufferArray->release();
+ mHttpBufferArray = NULL;
+ }
+ if (mFormattedImage.notNull())
+ {
+ mFormattedImage->deleteData();
+ }
+ mHttpReplySize = 0;
+ mHttpReplyOffset = 0;
+ mHaveAllData = FALSE;
}
F32 LLTextureFetchWorker::getImagePriority() const
@@ -1065,41 +1065,41 @@ F32 LLTextureFetchWorker::getImagePriority() const
// Threads: Tmain
void LLTextureFetchWorker::startWork(S32 param)
{
- llassert(mFormattedImage.isNull());
+ llassert(mFormattedImage.isNull());
}
// Threads: Ttf
bool LLTextureFetchWorker::doWork(S32 param)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD;
- if (gNonInteractive)
- {
- return true;
- }
- static const LLCore::HttpStatus http_not_found(HTTP_NOT_FOUND); // 404
- static const LLCore::HttpStatus http_service_unavail(HTTP_SERVICE_UNAVAILABLE); // 503
- static const LLCore::HttpStatus http_not_sat(HTTP_REQUESTED_RANGE_NOT_SATISFIABLE); // 416;
-
- LLMutexLock lock(&mWorkMutex); // +Mw
-
- if ((mFetcher->isQuitting() || getFlags(LLWorkerClass::WCF_DELETE_REQUESTED)))
- {
- if (mState < DECODE_IMAGE)
- {
+ if (gNonInteractive)
+ {
+ return true;
+ }
+ static const LLCore::HttpStatus http_not_found(HTTP_NOT_FOUND); // 404
+ static const LLCore::HttpStatus http_service_unavail(HTTP_SERVICE_UNAVAILABLE); // 503
+ static const LLCore::HttpStatus http_not_sat(HTTP_REQUESTED_RANGE_NOT_SATISFIABLE); // 416;
+
+ LLMutexLock lock(&mWorkMutex); // +Mw
+
+ if ((mFetcher->isQuitting() || getFlags(LLWorkerClass::WCF_DELETE_REQUESTED)))
+ {
+ if (mState < DECODE_IMAGE)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - state < decode");
- return true; // abort
- }
- }
-
- if (mImagePriority < F_ALMOST_ZERO)
- {
- if (mState == INIT || mState == LOAD_FROM_NETWORK)
- {
+ return true; // abort
+ }
+ }
+
+ if (mImagePriority < F_ALMOST_ZERO)
+ {
+ if (mState == INIT || mState == LOAD_FROM_NETWORK)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - priority < 0");
- LL_DEBUGS(LOG_TXT) << mID << " abort: mImagePriority < F_ALMOST_ZERO" << LL_ENDL;
- return true; // abort
- }
- }
+ LL_DEBUGS(LOG_TXT) << mID << " abort: mImagePriority < F_ALMOST_ZERO" << LL_ENDL;
+ return true; // abort
+ }
+ }
if (mState > CACHE_POST && !mCanUseCapability && mCanUseHTTP)
{
if (mRegionRetryAttempt > MAX_CAP_MISSING_RETRIES)
@@ -1112,452 +1112,452 @@ bool LLTextureFetchWorker::doWork(S32 param)
}
// else retry
}
- if(mState > CACHE_POST && !mCanUseHTTP)
- {
+ if(mState > CACHE_POST && !mCanUseHTTP)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - state > cache_post");
- //nowhere to get data, abort.
- LL_WARNS(LOG_TXT) << mID << " abort, nowhere to get data" << LL_ENDL;
- return true ;
- }
-
- if (mFetcher->mDebugPause)
- {
- return false; // debug: don't do any work
- }
- if (mID == mFetcher->mDebugID)
- {
- mFetcher->mDebugCount++; // for setting breakpoints
- }
-
- if (mState != DONE)
- {
- mFetchDeltaTimer.reset();
- }
-
- if (mState == INIT)
- {
+ //nowhere to get data, abort.
+ LL_WARNS(LOG_TXT) << mID << " abort, nowhere to get data" << LL_ENDL;
+ return true ;
+ }
+
+ if (mFetcher->mDebugPause)
+ {
+ return false; // debug: don't do any work
+ }
+ if (mID == mFetcher->mDebugID)
+ {
+ mFetcher->mDebugCount++; // for setting breakpoints
+ }
+
+ if (mState != DONE)
+ {
+ mFetchDeltaTimer.reset();
+ }
+
+ if (mState == INIT)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - INIT");
- mStateTimer.reset();
- mFetchTimer.reset();
- for(auto i : LOGGED_STATES)
- {
- mStateTimersMap[i] = 0;
- }
- mSkippedStatesTime = 0;
- mRawImage = NULL ;
- mRequestedDiscard = -1;
- mLoadedDiscard = -1;
- mDecodedDiscard = -1;
- mRequestedSize = 0;
- mRequestedOffset = 0;
- mFileSize = 0;
- mCachedSize = 0;
- mLoaded = FALSE;
- mSentRequest = UNSENT;
- mDecoded = FALSE;
- mWritten = FALSE;
- if (mHttpBufferArray)
- {
- mHttpBufferArray->release();
- mHttpBufferArray = NULL;
- }
- mHttpReplySize = 0;
- mHttpReplyOffset = 0;
- mHaveAllData = FALSE;
- clearPackets(); // TODO: Shouldn't be necessary
- mCacheReadHandle = LLTextureCache::nullHandle();
- mCacheWriteHandle = LLTextureCache::nullHandle();
- setState(LOAD_FROM_TEXTURE_CACHE);
- mInCache = FALSE;
- mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE); // min desired size is TEXTURE_CACHE_ENTRY_SIZE
- LL_DEBUGS(LOG_TXT) << mID << ": Priority: " << llformat("%8.0f",mImagePriority)
- << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL;
-
- // fall through
- }
-
- if (mState == LOAD_FROM_TEXTURE_CACHE)
- {
+ mStateTimer.reset();
+ mFetchTimer.reset();
+ for(auto i : LOGGED_STATES)
+ {
+ mStateTimersMap[i] = 0;
+ }
+ mSkippedStatesTime = 0;
+ mRawImage = NULL ;
+ mRequestedDiscard = -1;
+ mLoadedDiscard = -1;
+ mDecodedDiscard = -1;
+ mRequestedSize = 0;
+ mRequestedOffset = 0;
+ mFileSize = 0;
+ mCachedSize = 0;
+ mLoaded = FALSE;
+ mSentRequest = UNSENT;
+ mDecoded = FALSE;
+ mWritten = FALSE;
+ if (mHttpBufferArray)
+ {
+ mHttpBufferArray->release();
+ mHttpBufferArray = NULL;
+ }
+ mHttpReplySize = 0;
+ mHttpReplyOffset = 0;
+ mHaveAllData = FALSE;
+ clearPackets(); // TODO: Shouldn't be necessary
+ mCacheReadHandle = LLTextureCache::nullHandle();
+ mCacheWriteHandle = LLTextureCache::nullHandle();
+ setState(LOAD_FROM_TEXTURE_CACHE);
+ mInCache = FALSE;
+ mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE); // min desired size is TEXTURE_CACHE_ENTRY_SIZE
+ LL_DEBUGS(LOG_TXT) << mID << ": Priority: " << llformat("%8.0f",mImagePriority)
+ << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL;
+
+ // fall through
+ }
+
+ if (mState == LOAD_FROM_TEXTURE_CACHE)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - LOAD_FROM_TEXTURE_CACHE");
- if (mCacheReadHandle == LLTextureCache::nullHandle())
- {
- S32 offset = mFormattedImage.notNull() ? mFormattedImage->getDataSize() : 0;
- S32 size = mDesiredSize - offset;
- if (size <= 0)
- {
- setState(CACHE_POST);
+ if (mCacheReadHandle == LLTextureCache::nullHandle())
+ {
+ S32 offset = mFormattedImage.notNull() ? mFormattedImage->getDataSize() : 0;
+ S32 size = mDesiredSize - offset;
+ if (size <= 0)
+ {
+ setState(CACHE_POST);
return doWork(param);
// return false;
- }
- mFileSize = 0;
- mLoaded = FALSE;
+ }
+ mFileSize = 0;
+ mLoaded = FALSE;
add(LLTextureFetch::sCacheAttempt, 1.0);
- if (mUrl.compare(0, 7, "file://") == 0)
- {
- // read file from local disk
- ++mCacheReadCount;
- std::string filename = mUrl.substr(7, std::string::npos);
- CacheReadResponder* responder = new CacheReadResponder(mFetcher, mID, mFormattedImage);
- mCacheReadTimer.reset();
- mCacheReadHandle = mFetcher->mTextureCache->readFromCache(filename, mID, offset, size, responder);
-
- }
- else if ((mUrl.empty() || mFTType==FTT_SERVER_BAKE) && mFetcher->canLoadFromCache())
- {
- ++mCacheReadCount;
- CacheReadResponder* responder = new CacheReadResponder(mFetcher, mID, mFormattedImage);
- mCacheReadTimer.reset();
- mCacheReadHandle = mFetcher->mTextureCache->readFromCache(mID,
- offset, size, responder);;
- }
- else if(!mUrl.empty() && mCanUseHTTP)
- {
- setState(WAIT_HTTP_RESOURCE);
- }
- else
- {
- setState(LOAD_FROM_NETWORK);
- }
- }
-
- if (mLoaded)
- {
- // Make sure request is complete. *TODO: make this auto-complete
- if (mFetcher->mTextureCache->readComplete(mCacheReadHandle, false))
- {
- mCacheReadHandle = LLTextureCache::nullHandle();
- setState(CACHE_POST);
+ if (mUrl.compare(0, 7, "file://") == 0)
+ {
+ // read file from local disk
+ ++mCacheReadCount;
+ std::string filename = mUrl.substr(7, std::string::npos);
+ CacheReadResponder* responder = new CacheReadResponder(mFetcher, mID, mFormattedImage);
+ mCacheReadTimer.reset();
+ mCacheReadHandle = mFetcher->mTextureCache->readFromCache(filename, mID, offset, size, responder);
+
+ }
+ else if ((mUrl.empty() || mFTType==FTT_SERVER_BAKE) && mFetcher->canLoadFromCache())
+ {
+ ++mCacheReadCount;
+ CacheReadResponder* responder = new CacheReadResponder(mFetcher, mID, mFormattedImage);
+ mCacheReadTimer.reset();
+ mCacheReadHandle = mFetcher->mTextureCache->readFromCache(mID,
+ offset, size, responder);;
+ }
+ else if(!mUrl.empty() && mCanUseHTTP)
+ {
+ setState(WAIT_HTTP_RESOURCE);
+ }
+ else
+ {
+ setState(LOAD_FROM_NETWORK);
+ }
+ }
+
+ if (mLoaded)
+ {
+ // Make sure request is complete. *TODO: make this auto-complete
+ if (mFetcher->mTextureCache->readComplete(mCacheReadHandle, false))
+ {
+ mCacheReadHandle = LLTextureCache::nullHandle();
+ setState(CACHE_POST);
add(LLTextureFetch::sCacheHit, 1.0);
- mCacheReadTime = mCacheReadTimer.getElapsedTimeF32();
- // fall through
- }
- else
- {
- //
- //This should never happen
- //
- LL_DEBUGS(LOG_TXT) << mID << " this should never happen" << LL_ENDL;
- return false;
- }
- }
- else
- {
- return false;
- }
- }
-
- if (mState == CACHE_POST)
- {
+ mCacheReadTime = mCacheReadTimer.getElapsedTimeF32();
+ // fall through
+ }
+ else
+ {
+ //
+ //This should never happen
+ //
+ LL_DEBUGS(LOG_TXT) << mID << " this should never happen" << LL_ENDL;
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ if (mState == CACHE_POST)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - CACHE_POST");
- mCachedSize = mFormattedImage.notNull() ? mFormattedImage->getDataSize() : 0;
- // Successfully loaded
- if ((mCachedSize >= mDesiredSize) || mHaveAllData)
- {
- // we have enough data, decode it
- llassert_always(mFormattedImage->getDataSize() > 0);
- mLoadedDiscard = mDesiredDiscard;
- if (mLoadedDiscard < 0)
- {
- LL_WARNS(LOG_TXT) << mID << " mLoadedDiscard is " << mLoadedDiscard
- << ", should be >=0" << LL_ENDL;
- }
- setState(DECODE_IMAGE);
- mInCache = TRUE;
- mWriteToCacheState = NOT_WRITE ;
- LL_DEBUGS(LOG_TXT) << mID << ": Cached. Bytes: " << mFormattedImage->getDataSize()
- << " Size: " << llformat("%dx%d",mFormattedImage->getWidth(),mFormattedImage->getHeight())
- << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL;
- record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(1));
- }
- else
- {
- if (mUrl.compare(0, 7, "file://") == 0)
- {
- // failed to load local file, we're done.
- LL_WARNS(LOG_TXT) << mID << ": abort, failed to load local file " << mUrl << LL_ENDL;
- return true;
- }
- // need more data
- else
- {
- LL_DEBUGS(LOG_TXT) << mID << ": Not in Cache" << LL_ENDL;
- setState(LOAD_FROM_NETWORK);
- }
- record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(0));
- // fall through
- }
- }
-
- if (mState == LOAD_FROM_NETWORK)
- {
+ mCachedSize = mFormattedImage.notNull() ? mFormattedImage->getDataSize() : 0;
+ // Successfully loaded
+ if ((mCachedSize >= mDesiredSize) || mHaveAllData)
+ {
+ // we have enough data, decode it
+ llassert_always(mFormattedImage->getDataSize() > 0);
+ mLoadedDiscard = mDesiredDiscard;
+ if (mLoadedDiscard < 0)
+ {
+ LL_WARNS(LOG_TXT) << mID << " mLoadedDiscard is " << mLoadedDiscard
+ << ", should be >=0" << LL_ENDL;
+ }
+ setState(DECODE_IMAGE);
+ mInCache = TRUE;
+ mWriteToCacheState = NOT_WRITE ;
+ LL_DEBUGS(LOG_TXT) << mID << ": Cached. Bytes: " << mFormattedImage->getDataSize()
+ << " Size: " << llformat("%dx%d",mFormattedImage->getWidth(),mFormattedImage->getHeight())
+ << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL;
+ record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(1));
+ }
+ else
+ {
+ if (mUrl.compare(0, 7, "file://") == 0)
+ {
+ // failed to load local file, we're done.
+ LL_WARNS(LOG_TXT) << mID << ": abort, failed to load local file " << mUrl << LL_ENDL;
+ return true;
+ }
+ // need more data
+ else
+ {
+ LL_DEBUGS(LOG_TXT) << mID << ": Not in Cache" << LL_ENDL;
+ setState(LOAD_FROM_NETWORK);
+ }
+ record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(0));
+ // fall through
+ }
+ }
+
+ if (mState == LOAD_FROM_NETWORK)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - LOAD_FROM_NETWORK");
- // Check for retries to previous server failures.
- F32 wait_seconds;
- if (mFetchRetryPolicy.shouldRetry(wait_seconds))
- {
- if (wait_seconds <= 0.0)
- {
- LL_INFOS(LOG_TXT) << mID << " retrying now" << LL_ENDL;
- }
- else
- {
- //LL_INFOS(LOG_TXT) << mID << " waiting to retry for " << wait_seconds << " seconds" << LL_ENDL;
- return false;
- }
- }
-
- static LLCachedControl<bool> use_http(gSavedSettings, "ImagePipelineUseHTTP", true);
-
-// if (mHost.isInvalid()) get_url = false;
- if ( use_http && mCanUseHTTP && mUrl.empty())//get http url.
- {
- LLViewerRegion* region = getRegion();
- if (region)
- {
- std::string http_url = region->getViewerAssetUrl();
- if (!http_url.empty())
- {
- if (mFTType != FTT_DEFAULT)
- {
+ // Check for retries to previous server failures.
+ F32 wait_seconds;
+ if (mFetchRetryPolicy.shouldRetry(wait_seconds))
+ {
+ if (wait_seconds <= 0.0)
+ {
+ LL_INFOS(LOG_TXT) << mID << " retrying now" << LL_ENDL;
+ }
+ else
+ {
+ //LL_INFOS(LOG_TXT) << mID << " waiting to retry for " << wait_seconds << " seconds" << LL_ENDL;
+ return false;
+ }
+ }
+
+ static LLCachedControl<bool> use_http(gSavedSettings, "ImagePipelineUseHTTP", true);
+
+// if (mHost.isInvalid()) get_url = false;
+ if ( use_http && mCanUseHTTP && mUrl.empty())//get http url.
+ {
+ LLViewerRegion* region = getRegion();
+ if (region)
+ {
+ std::string http_url = region->getViewerAssetUrl();
+ if (!http_url.empty())
+ {
+ if (mFTType != FTT_DEFAULT)
+ {
LL_WARNS(LOG_TXT) << "Trying to fetch a texture of non-default type by UUID. This probably won't work!" << LL_ENDL;
- }
- setUrl(http_url + "/?texture_id=" + mID.asString().c_str());
- LL_DEBUGS(LOG_TXT) << "Texture URL: " << mUrl << LL_ENDL;
- mWriteToCacheState = CAN_WRITE ; //because this texture has a fixed texture id.
+ }
+ setUrl(http_url + "/?texture_id=" + mID.asString().c_str());
+ LL_DEBUGS(LOG_TXT) << "Texture URL: " << mUrl << LL_ENDL;
+ mWriteToCacheState = CAN_WRITE ; //because this texture has a fixed texture id.
mCanUseCapability = true;
mRegionRetryAttempt = 0;
mLastRegionId = region->getRegionID();
- }
- else
- {
- mCanUseCapability = false;
+ }
+ else
+ {
+ mCanUseCapability = false;
mRegionRetryAttempt++;
mRegionRetryTimer.setTimerExpirySec(CAP_MISSING_EXPIRATION_DELAY);
// ex: waiting for caps
- LL_INFOS_ONCE(LOG_TXT) << "Texture not available via HTTP: empty URL." << LL_ENDL;
- }
- }
- else
- {
+ LL_INFOS_ONCE(LOG_TXT) << "Texture not available via HTTP: empty URL." << LL_ENDL;
+ }
+ }
+ else
+ {
mCanUseCapability = false;
mRegionRetryAttempt++;
mRegionRetryTimer.setTimerExpirySec(CAP_MISSING_EXPIRATION_DELAY);
- // This will happen if not logged in or if a region deoes not have HTTP Texture enabled
- //LL_WARNS(LOG_TXT) << "Region not found for host: " << mHost << LL_ENDL;
+ // This will happen if not logged in or if a region deoes not have HTTP Texture enabled
+ //LL_WARNS(LOG_TXT) << "Region not found for host: " << mHost << LL_ENDL;
LL_INFOS_ONCE(LOG_TXT) << "Texture not available via HTTP: no region " << mUrl << LL_ENDL;
- }
- }
- else if (mFTType == FTT_SERVER_BAKE)
- {
- mWriteToCacheState = CAN_WRITE;
- }
-
- if (mCanUseCapability && mCanUseHTTP && !mUrl.empty())
- {
- setState(WAIT_HTTP_RESOURCE);
- if(mWriteToCacheState != NOT_WRITE)
- {
- mWriteToCacheState = CAN_WRITE ;
- }
- // don't return, fall through to next state
- }
- else
- {
- return false;
- }
- }
-
- if (mState == WAIT_HTTP_RESOURCE)
- {
+ }
+ }
+ else if (mFTType == FTT_SERVER_BAKE)
+ {
+ mWriteToCacheState = CAN_WRITE;
+ }
+
+ if (mCanUseCapability && mCanUseHTTP && !mUrl.empty())
+ {
+ setState(WAIT_HTTP_RESOURCE);
+ if(mWriteToCacheState != NOT_WRITE)
+ {
+ mWriteToCacheState = CAN_WRITE ;
+ }
+ // don't return, fall through to next state
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ if (mState == WAIT_HTTP_RESOURCE)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - WAIT_HTTP_RESOURCE");
- // NOTE:
- // control the number of the http requests issued for:
- // 1, not openning too many file descriptors at the same time;
- // 2, control the traffic of http so udp gets bandwidth.
- //
- // If it looks like we're busy, keep this request here.
- // Otherwise, advance into the HTTP states.
-
- if (!mHttpHasResource && // sometimes we get into this state when we already have an http resource, go ahead and send the request in that case
+ // NOTE:
+ // control the number of the http requests issued for:
+ // 1, not openning too many file descriptors at the same time;
+ // 2, control the traffic of http so udp gets bandwidth.
+ //
+ // If it looks like we're busy, keep this request here.
+ // Otherwise, advance into the HTTP states.
+
+ if (!mHttpHasResource && // sometimes we get into this state when we already have an http resource, go ahead and send the request in that case
(mFetcher->getHttpWaitersCount() || ! acquireHttpSemaphore()))
- {
- setState(WAIT_HTTP_RESOURCE2);
- mFetcher->addHttpWaiter(this->mID);
- ++mResourceWaitCount;
- return false;
- }
-
- setState(SEND_HTTP_REQ);
- // *NOTE: You must invoke releaseHttpSemaphore() if you transition
- // to a state other than SEND_HTTP_REQ or WAIT_HTTP_REQ or abort
- // the request.
- }
-
- if (mState == WAIT_HTTP_RESOURCE2)
- {
+ {
+ setState(WAIT_HTTP_RESOURCE2);
+ mFetcher->addHttpWaiter(this->mID);
+ ++mResourceWaitCount;
+ return false;
+ }
+
+ setState(SEND_HTTP_REQ);
+ // *NOTE: You must invoke releaseHttpSemaphore() if you transition
+ // to a state other than SEND_HTTP_REQ or WAIT_HTTP_REQ or abort
+ // the request.
+ }
+
+ if (mState == WAIT_HTTP_RESOURCE2)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - WAIT_HTTP_RESOURCE2");
- // Just idle it if we make it to the head...
- return false;
- }
-
- if (mState == SEND_HTTP_REQ)
- {
+ // Just idle it if we make it to the head...
+ return false;
+ }
+
+ if (mState == SEND_HTTP_REQ)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - SEND_HTTP_REQ");
- // Also used in llmeshrepository
- static LLCachedControl<bool> disable_range_req(gSavedSettings, "HttpRangeRequestsDisable", false);
-
- if (! mCanUseHTTP)
- {
- releaseHttpSemaphore();
- LL_WARNS(LOG_TXT) << mID << " abort: SEND_HTTP_REQ but !mCanUseHTTP" << LL_ENDL;
- return true; // abort
- }
-
- S32 cur_size = 0;
- if (mFormattedImage.notNull())
- {
- cur_size = mFormattedImage->getDataSize(); // amount of data we already have
- if (mFormattedImage->getDiscardLevel() == 0)
- {
- if (cur_size > 0)
- {
- // We already have all the data, just decode it
- mLoadedDiscard = mFormattedImage->getDiscardLevel();
- if (mLoadedDiscard < 0)
- {
- LL_WARNS(LOG_TXT) << mID << " mLoadedDiscard is " << mLoadedDiscard
- << ", should be >=0" << LL_ENDL;
- }
- setState(DECODE_IMAGE);
- releaseHttpSemaphore();
- //return false;
+ // Also used in llmeshrepository
+ static LLCachedControl<bool> disable_range_req(gSavedSettings, "HttpRangeRequestsDisable", false);
+
+ if (! mCanUseHTTP)
+ {
+ releaseHttpSemaphore();
+ LL_WARNS(LOG_TXT) << mID << " abort: SEND_HTTP_REQ but !mCanUseHTTP" << LL_ENDL;
+ return true; // abort
+ }
+
+ S32 cur_size = 0;
+ if (mFormattedImage.notNull())
+ {
+ cur_size = mFormattedImage->getDataSize(); // amount of data we already have
+ if (mFormattedImage->getDiscardLevel() == 0)
+ {
+ if (cur_size > 0)
+ {
+ // We already have all the data, just decode it
+ mLoadedDiscard = mFormattedImage->getDiscardLevel();
+ if (mLoadedDiscard < 0)
+ {
+ LL_WARNS(LOG_TXT) << mID << " mLoadedDiscard is " << mLoadedDiscard
+ << ", should be >=0" << LL_ENDL;
+ }
+ setState(DECODE_IMAGE);
+ releaseHttpSemaphore();
+ //return false;
return doWork(param);
- }
- else
- {
- releaseHttpSemaphore();
- LL_WARNS(LOG_TXT) << mID << " SEND_HTTP_REQ abort: cur_size " << cur_size << " <=0" << LL_ENDL;
- return true; // abort.
- }
- }
- }
- mRequestedSize = mDesiredSize;
- mRequestedDiscard = mDesiredDiscard;
- mRequestedSize -= cur_size;
- mRequestedOffset = cur_size;
- if (mRequestedOffset)
- {
- // Texture fetching often issues 'speculative' loads that
- // start beyond the end of the actual asset. Some cache/web
- // systems, e.g. Varnish, will respond to this not with a
- // 416 but with a 200 and the entire asset in the response
- // body. By ensuring that we always have a partially
- // satisfiable Range request, we avoid that hit to the network.
- // We just have to deal with the overlapping data which is made
- // somewhat harder by the fact that grid services don't necessarily
- // return the Content-Range header on 206 responses. *Sigh*
- mRequestedOffset -= 1;
- mRequestedSize += 1;
- }
- mHttpHandle = LLCORE_HTTP_HANDLE_INVALID;
-
- if (mUrl.empty())
- {
- // *FIXME: This should not be reachable except it has become
- // so after some recent 'work'. Need to track this down
- // and illuminate the unenlightened.
- LL_WARNS(LOG_TXT) << "HTTP GET request failed for " << mID
- << " on empty URL." << LL_ENDL;
- resetFormattedData();
- releaseHttpSemaphore();
- return true; // failed
- }
-
- mRequestedDeltaTimer.reset();
- mLoaded = FALSE;
- mGetStatus = LLCore::HttpStatus();
- mGetReason.clear();
- LL_DEBUGS(LOG_TXT) << "HTTP GET: " << mID << " Offset: " << mRequestedOffset
- << " Bytes: " << mRequestedSize
- << " Bandwidth(kbps): " << mFetcher->getTextureBandwidth() << "/" << mFetcher->mMaxBandwidth
- << LL_ENDL;
-
- // Will call callbackHttpGet when curl request completes
- // Only server bake images use the returned headers currently, for getting retry-after field.
- LLCore::HttpOptions::ptr_t options = (mFTType == FTT_SERVER_BAKE) ? mFetcher->mHttpOptionsWithHeaders: mFetcher->mHttpOptions;
- if (disable_range_req)
- {
- // 'Range:' requests may be disabled in which case all HTTP
- // texture fetches result in full fetches. This can be used
- // by people with questionable ISPs or networking gear that
- // doesn't handle these well.
- mHttpHandle = mFetcher->mHttpRequest->requestGet(mHttpPolicyClass,
- mUrl,
- options,
- mFetcher->mHttpHeaders,
+ }
+ else
+ {
+ releaseHttpSemaphore();
+ LL_WARNS(LOG_TXT) << mID << " SEND_HTTP_REQ abort: cur_size " << cur_size << " <=0" << LL_ENDL;
+ return true; // abort.
+ }
+ }
+ }
+ mRequestedSize = mDesiredSize;
+ mRequestedDiscard = mDesiredDiscard;
+ mRequestedSize -= cur_size;
+ mRequestedOffset = cur_size;
+ if (mRequestedOffset)
+ {
+ // Texture fetching often issues 'speculative' loads that
+ // start beyond the end of the actual asset. Some cache/web
+ // systems, e.g. Varnish, will respond to this not with a
+ // 416 but with a 200 and the entire asset in the response
+ // body. By ensuring that we always have a partially
+ // satisfiable Range request, we avoid that hit to the network.
+ // We just have to deal with the overlapping data which is made
+ // somewhat harder by the fact that grid services don't necessarily
+ // return the Content-Range header on 206 responses. *Sigh*
+ mRequestedOffset -= 1;
+ mRequestedSize += 1;
+ }
+ mHttpHandle = LLCORE_HTTP_HANDLE_INVALID;
+
+ if (mUrl.empty())
+ {
+ // *FIXME: This should not be reachable except it has become
+ // so after some recent 'work'. Need to track this down
+ // and illuminate the unenlightened.
+ LL_WARNS(LOG_TXT) << "HTTP GET request failed for " << mID
+ << " on empty URL." << LL_ENDL;
+ resetFormattedData();
+ releaseHttpSemaphore();
+ return true; // failed
+ }
+
+ mRequestedDeltaTimer.reset();
+ mLoaded = FALSE;
+ mGetStatus = LLCore::HttpStatus();
+ mGetReason.clear();
+ LL_DEBUGS(LOG_TXT) << "HTTP GET: " << mID << " Offset: " << mRequestedOffset
+ << " Bytes: " << mRequestedSize
+ << " Bandwidth(kbps): " << mFetcher->getTextureBandwidth() << "/" << mFetcher->mMaxBandwidth
+ << LL_ENDL;
+
+ // Will call callbackHttpGet when curl request completes
+ // Only server bake images use the returned headers currently, for getting retry-after field.
+ LLCore::HttpOptions::ptr_t options = (mFTType == FTT_SERVER_BAKE) ? mFetcher->mHttpOptionsWithHeaders: mFetcher->mHttpOptions;
+ if (disable_range_req)
+ {
+ // 'Range:' requests may be disabled in which case all HTTP
+ // texture fetches result in full fetches. This can be used
+ // by people with questionable ISPs or networking gear that
+ // doesn't handle these well.
+ mHttpHandle = mFetcher->mHttpRequest->requestGet(mHttpPolicyClass,
+ mUrl,
+ options,
+ mFetcher->mHttpHeaders,
LLCore::HttpHandler::ptr_t(this, &NoOpDeletor));
- }
- else
- {
- mHttpHandle = mFetcher->mHttpRequest->requestGetByteRange(mHttpPolicyClass,
- mUrl,
- mRequestedOffset,
- (mRequestedOffset + mRequestedSize) > HTTP_REQUESTS_RANGE_END_MAX
- ? 0
- : mRequestedSize,
- options,
- mFetcher->mHttpHeaders,
+ }
+ else
+ {
+ mHttpHandle = mFetcher->mHttpRequest->requestGetByteRange(mHttpPolicyClass,
+ mUrl,
+ mRequestedOffset,
+ (mRequestedOffset + mRequestedSize) > HTTP_REQUESTS_RANGE_END_MAX
+ ? 0
+ : mRequestedSize,
+ options,
+ mFetcher->mHttpHeaders,
LLCore::HttpHandler::ptr_t(this, &NoOpDeletor));
- }
- if (LLCORE_HTTP_HANDLE_INVALID == mHttpHandle)
- {
- LLCore::HttpStatus status(mFetcher->mHttpRequest->getStatus());
- LL_WARNS(LOG_TXT) << "HTTP GET request failed for " << mID
- << ", Status: " << status.toTerseString()
- << " Reason: '" << status.toString() << "'"
- << LL_ENDL;
- resetFormattedData();
- releaseHttpSemaphore();
- return true; // failed
- }
-
- mHttpActive = true;
- mFetcher->addToHTTPQueue(mID);
- recordTextureStart(true);
- setState(WAIT_HTTP_REQ);
-
- // fall through
- }
-
- if (mState == WAIT_HTTP_REQ)
- {
+ }
+ if (LLCORE_HTTP_HANDLE_INVALID == mHttpHandle)
+ {
+ LLCore::HttpStatus status(mFetcher->mHttpRequest->getStatus());
+ LL_WARNS(LOG_TXT) << "HTTP GET request failed for " << mID
+ << ", Status: " << status.toTerseString()
+ << " Reason: '" << status.toString() << "'"
+ << LL_ENDL;
+ resetFormattedData();
+ releaseHttpSemaphore();
+ return true; // failed
+ }
+
+ mHttpActive = true;
+ mFetcher->addToHTTPQueue(mID);
+ recordTextureStart(true);
+ setState(WAIT_HTTP_REQ);
+
+ // fall through
+ }
+
+ if (mState == WAIT_HTTP_REQ)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - WAIT_HTTP_REQ");
- // *NOTE: As stated above, all transitions out of this state should
- // call releaseHttpSemaphore().
- if (mLoaded)
- {
- S32 cur_size = mFormattedImage.notNull() ? mFormattedImage->getDataSize() : 0;
- if (mRequestedSize < 0)
- {
- if (http_not_found == mGetStatus)
- {
- if (mFTType != FTT_MAP_TILE)
- {
- LL_WARNS(LOG_TXT) << "Texture missing from server (404): " << mUrl << LL_ENDL;
- }
-
- if(mWriteToCacheState == NOT_WRITE) //map tiles or server bakes
- {
- setState(DONE);
- releaseHttpSemaphore();
- if (mFTType != FTT_MAP_TILE)
- {
- LL_WARNS(LOG_TXT) << mID << " abort: WAIT_HTTP_REQ not found" << LL_ENDL;
- }
- return true;
- }
+ // *NOTE: As stated above, all transitions out of this state should
+ // call releaseHttpSemaphore().
+ if (mLoaded)
+ {
+ S32 cur_size = mFormattedImage.notNull() ? mFormattedImage->getDataSize() : 0;
+ if (mRequestedSize < 0)
+ {
+ if (http_not_found == mGetStatus)
+ {
+ if (mFTType != FTT_MAP_TILE)
+ {
+ LL_WARNS(LOG_TXT) << "Texture missing from server (404): " << mUrl << LL_ENDL;
+ }
+
+ if(mWriteToCacheState == NOT_WRITE) //map tiles or server bakes
+ {
+ setState(DONE);
+ releaseHttpSemaphore();
+ if (mFTType != FTT_MAP_TILE)
+ {
+ LL_WARNS(LOG_TXT) << mID << " abort: WAIT_HTTP_REQ not found" << LL_ENDL;
+ }
+ return true;
+ }
if (mCanUseHTTP && !mUrl.empty() && cur_size <= 0)
{
@@ -1572,10 +1572,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
return false;
}
}
- }
- else if (http_service_unavail == mGetStatus)
- {
- LL_INFOS_ONCE(LOG_TXT) << "Texture server busy (503): " << mUrl << LL_ENDL;
+ }
+ else if (http_service_unavail == mGetStatus)
+ {
+ LL_INFOS_ONCE(LOG_TXT) << "Texture server busy (503): " << mUrl << LL_ENDL;
if (mCanUseHTTP && !mUrl.empty() && cur_size <= 0)
{
LLViewerRegion* region = getRegion();
@@ -1589,217 +1589,217 @@ bool LLTextureFetchWorker::doWork(S32 param)
return false;
}
}
- }
- else if (http_not_sat == mGetStatus)
- {
- // Allowed, we'll accept whatever data we have as complete.
- mHaveAllData = TRUE;
- }
- else
- {
- LL_INFOS(LOG_TXT) << "HTTP GET failed for: " << mUrl
- << " Status: " << mGetStatus.toTerseString()
- << " Reason: '" << mGetReason << "'"
- << LL_ENDL;
- }
+ }
+ else if (http_not_sat == mGetStatus)
+ {
+ // Allowed, we'll accept whatever data we have as complete.
+ mHaveAllData = TRUE;
+ }
+ else
+ {
+ LL_INFOS(LOG_TXT) << "HTTP GET failed for: " << mUrl
+ << " Status: " << mGetStatus.toTerseString()
+ << " Reason: '" << mGetReason << "'"
+ << LL_ENDL;
+ }
if (mFTType != FTT_SERVER_BAKE && mFTType != FTT_MAP_TILE)
- {
- mUrl.clear();
- }
- if (cur_size > 0)
- {
- // Use available data
- mLoadedDiscard = mFormattedImage->getDiscardLevel();
- if (mLoadedDiscard < 0)
- {
- LL_WARNS(LOG_TXT) << mID << " mLoadedDiscard is " << mLoadedDiscard
- << ", should be >=0" << LL_ENDL;
- }
- setState(DECODE_IMAGE);
- releaseHttpSemaphore();
- //return false;
+ {
+ mUrl.clear();
+ }
+ if (cur_size > 0)
+ {
+ // Use available data
+ mLoadedDiscard = mFormattedImage->getDiscardLevel();
+ if (mLoadedDiscard < 0)
+ {
+ LL_WARNS(LOG_TXT) << mID << " mLoadedDiscard is " << mLoadedDiscard
+ << ", should be >=0" << LL_ENDL;
+ }
+ setState(DECODE_IMAGE);
+ releaseHttpSemaphore();
+ //return false;
return doWork(param);
- }
-
- // Fail harder
- resetFormattedData();
- setState(DONE);
- releaseHttpSemaphore();
- LL_WARNS(LOG_TXT) << mID << " abort: fail harder" << LL_ENDL;
- return true; // failed
- }
-
- // Clear the url since we're done with the fetch
- // Note: mUrl is used to check is fetching is required so failure to clear it will force an http fetch
- // next time the texture is requested, even if the data have already been fetched.
- if(mWriteToCacheState != NOT_WRITE && mFTType != FTT_SERVER_BAKE)
- {
- // Why do we want to keep url if NOT_WRITE - is this a proxy for map tiles?
- mUrl.clear();
- }
-
- if (! mHttpBufferArray || ! mHttpBufferArray->size())
- {
- // no data received.
- if (mHttpBufferArray)
- {
- mHttpBufferArray->release();
- mHttpBufferArray = NULL;
- }
-
- // abort.
- setState(DONE);
- LL_WARNS(LOG_TXT) << mID << " abort: no data received" << LL_ENDL;
- releaseHttpSemaphore();
- return true;
- }
-
- S32 append_size(mHttpBufferArray->size());
- S32 total_size(cur_size + append_size);
- S32 src_offset(0);
- llassert_always(append_size == mRequestedSize);
- if (mHttpReplyOffset && mHttpReplyOffset != cur_size)
- {
- // In case of a partial response, our offset may
- // not be trivially contiguous with the data we have.
- // Get back into alignment.
- if ( (mHttpReplyOffset > cur_size) || (cur_size > mHttpReplyOffset + append_size))
- {
- LL_WARNS(LOG_TXT) << "Partial HTTP response produces break in image data for texture "
- << mID << ". Aborting load." << LL_ENDL;
- setState(DONE);
- releaseHttpSemaphore();
- return true;
- }
- src_offset = cur_size - mHttpReplyOffset;
- append_size -= src_offset;
- total_size -= src_offset;
- mRequestedSize -= src_offset; // Make requested values reflect useful part
- mRequestedOffset += src_offset;
- }
-
- U8 * buffer = (U8 *)ll_aligned_malloc_16(total_size);
- if (!buffer)
- {
- // abort. If we have no space for packet, we have not enough space to decode image
- setState(DONE);
- LL_WARNS(LOG_TXT) << mID << " abort: out of memory" << LL_ENDL;
- releaseHttpSemaphore();
- return true;
- }
-
- if (mFormattedImage.isNull())
- {
- // For now, create formatted image based on extension
- std::string extension = gDirUtilp->getExtension(mUrl);
- mFormattedImage = LLImageFormatted::createFromType(LLImageBase::getCodecFromExtension(extension));
- if (mFormattedImage.isNull())
- {
- mFormattedImage = new LLImageJ2C; // default
- }
- }
-
- if (mHaveAllData) //the image file is fully loaded.
- {
- mFileSize = total_size;
- }
- else //the file size is unknown.
- {
- mFileSize = total_size + 1 ; //flag the file is not fully loaded.
- }
-
- if (cur_size > 0)
- {
- // Copy previously collected data into buffer
- memcpy(buffer, mFormattedImage->getData(), cur_size);
- }
- mHttpBufferArray->read(src_offset, (char *) buffer + cur_size, append_size);
-
- // NOTE: setData releases current data and owns new data (buffer)
- mFormattedImage->setData(buffer, total_size);
-
- // Done with buffer array
- mHttpBufferArray->release();
- mHttpBufferArray = NULL;
- mHttpReplySize = 0;
- mHttpReplyOffset = 0;
-
- mLoadedDiscard = mRequestedDiscard;
- if (mLoadedDiscard < 0)
- {
- LL_WARNS(LOG_TXT) << mID << " mLoadedDiscard is " << mLoadedDiscard
- << ", should be >=0" << LL_ENDL;
- }
- setState(DECODE_IMAGE);
- if (mWriteToCacheState != NOT_WRITE)
- {
- mWriteToCacheState = SHOULD_WRITE ;
- }
- releaseHttpSemaphore();
- //return false;
+ }
+
+ // Fail harder
+ resetFormattedData();
+ setState(DONE);
+ releaseHttpSemaphore();
+ LL_WARNS(LOG_TXT) << mID << " abort: fail harder" << LL_ENDL;
+ return true; // failed
+ }
+
+ // Clear the url since we're done with the fetch
+ // Note: mUrl is used to check is fetching is required so failure to clear it will force an http fetch
+ // next time the texture is requested, even if the data have already been fetched.
+ if(mWriteToCacheState != NOT_WRITE && mFTType != FTT_SERVER_BAKE)
+ {
+ // Why do we want to keep url if NOT_WRITE - is this a proxy for map tiles?
+ mUrl.clear();
+ }
+
+ if (! mHttpBufferArray || ! mHttpBufferArray->size())
+ {
+ // no data received.
+ if (mHttpBufferArray)
+ {
+ mHttpBufferArray->release();
+ mHttpBufferArray = NULL;
+ }
+
+ // abort.
+ setState(DONE);
+ LL_WARNS(LOG_TXT) << mID << " abort: no data received" << LL_ENDL;
+ releaseHttpSemaphore();
+ return true;
+ }
+
+ S32 append_size(mHttpBufferArray->size());
+ S32 total_size(cur_size + append_size);
+ S32 src_offset(0);
+ llassert_always(append_size == mRequestedSize);
+ if (mHttpReplyOffset && mHttpReplyOffset != cur_size)
+ {
+ // In case of a partial response, our offset may
+ // not be trivially contiguous with the data we have.
+ // Get back into alignment.
+ if ( (mHttpReplyOffset > cur_size) || (cur_size > mHttpReplyOffset + append_size))
+ {
+ LL_WARNS(LOG_TXT) << "Partial HTTP response produces break in image data for texture "
+ << mID << ". Aborting load." << LL_ENDL;
+ setState(DONE);
+ releaseHttpSemaphore();
+ return true;
+ }
+ src_offset = cur_size - mHttpReplyOffset;
+ append_size -= src_offset;
+ total_size -= src_offset;
+ mRequestedSize -= src_offset; // Make requested values reflect useful part
+ mRequestedOffset += src_offset;
+ }
+
+ U8 * buffer = (U8 *)ll_aligned_malloc_16(total_size);
+ if (!buffer)
+ {
+ // abort. If we have no space for packet, we have not enough space to decode image
+ setState(DONE);
+ LL_WARNS(LOG_TXT) << mID << " abort: out of memory" << LL_ENDL;
+ releaseHttpSemaphore();
+ return true;
+ }
+
+ if (mFormattedImage.isNull())
+ {
+ // For now, create formatted image based on extension
+ std::string extension = gDirUtilp->getExtension(mUrl);
+ mFormattedImage = LLImageFormatted::createFromType(LLImageBase::getCodecFromExtension(extension));
+ if (mFormattedImage.isNull())
+ {
+ mFormattedImage = new LLImageJ2C; // default
+ }
+ }
+
+ if (mHaveAllData) //the image file is fully loaded.
+ {
+ mFileSize = total_size;
+ }
+ else //the file size is unknown.
+ {
+ mFileSize = total_size + 1 ; //flag the file is not fully loaded.
+ }
+
+ if (cur_size > 0)
+ {
+ // Copy previously collected data into buffer
+ memcpy(buffer, mFormattedImage->getData(), cur_size);
+ }
+ mHttpBufferArray->read(src_offset, (char *) buffer + cur_size, append_size);
+
+ // NOTE: setData releases current data and owns new data (buffer)
+ mFormattedImage->setData(buffer, total_size);
+
+ // Done with buffer array
+ mHttpBufferArray->release();
+ mHttpBufferArray = NULL;
+ mHttpReplySize = 0;
+ mHttpReplyOffset = 0;
+
+ mLoadedDiscard = mRequestedDiscard;
+ if (mLoadedDiscard < 0)
+ {
+ LL_WARNS(LOG_TXT) << mID << " mLoadedDiscard is " << mLoadedDiscard
+ << ", should be >=0" << LL_ENDL;
+ }
+ setState(DECODE_IMAGE);
+ if (mWriteToCacheState != NOT_WRITE)
+ {
+ mWriteToCacheState = SHOULD_WRITE ;
+ }
+ releaseHttpSemaphore();
+ //return false;
return doWork(param);
- }
- else
- {
- // *HISTORY: There was a texture timeout test here originally that
- // would cancel a request that was over 120 seconds old. That's
- // probably not a good idea. Particularly rich regions can take
- // an enormous amount of time to load textures. We'll revisit the
- // various possible timeout components (total request time, connection
- // time, I/O time, with and without retries, etc.) in the future.
-
- return false;
- }
- }
-
- if (mState == DECODE_IMAGE)
- {
+ }
+ else
+ {
+ // *HISTORY: There was a texture timeout test here originally that
+ // would cancel a request that was over 120 seconds old. That's
+ // probably not a good idea. Particularly rich regions can take
+ // an enormous amount of time to load textures. We'll revisit the
+ // various possible timeout components (total request time, connection
+ // time, I/O time, with and without retries, etc.) in the future.
+
+ return false;
+ }
+ }
+
+ if (mState == DECODE_IMAGE)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - DECODE_IMAGE");
- static LLCachedControl<bool> textures_decode_disabled(gSavedSettings, "TextureDecodeDisabled", false);
-
- if (textures_decode_disabled)
- {
- // for debug use, don't decode
- setState(DONE);
- return true;
- }
-
- if (mDesiredDiscard < 0)
- {
- // We aborted, don't decode
- setState(DONE);
- LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: desired discard " << mDesiredDiscard << "<0" << LL_ENDL;
- return true;
- }
-
- if (mFormattedImage->getDataSize() <= 0)
- {
- LL_WARNS(LOG_TXT) << "Decode entered with invalid mFormattedImage. ID = " << mID << LL_ENDL;
-
- //abort, don't decode
- setState(DONE);
- LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: (mFormattedImage->getDataSize() <= 0)" << LL_ENDL;
- return true;
- }
- if (mLoadedDiscard < 0)
- {
- LL_WARNS(LOG_TXT) << "Decode entered with invalid mLoadedDiscard. ID = " << mID << LL_ENDL;
-
- //abort, don't decode
- setState(DONE);
- LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: mLoadedDiscard < 0" << LL_ENDL;
- return true;
- }
- mDecodeTimer.reset();
- mRawImage = NULL;
- mAuxImage = NULL;
- llassert_always(mFormattedImage.notNull());
- S32 discard = mHaveAllData ? 0 : mLoadedDiscard;
- mDecoded = FALSE;
- setState(DECODE_IMAGE_UPDATE);
- LL_DEBUGS(LOG_TXT) << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard
- << " All Data: " << mHaveAllData << LL_ENDL;
+ static LLCachedControl<bool> textures_decode_disabled(gSavedSettings, "TextureDecodeDisabled", false);
+
+ if (textures_decode_disabled)
+ {
+ // for debug use, don't decode
+ setState(DONE);
+ return true;
+ }
+
+ if (mDesiredDiscard < 0)
+ {
+ // We aborted, don't decode
+ setState(DONE);
+ LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: desired discard " << mDesiredDiscard << "<0" << LL_ENDL;
+ return true;
+ }
+
+ if (mFormattedImage->getDataSize() <= 0)
+ {
+ LL_WARNS(LOG_TXT) << "Decode entered with invalid mFormattedImage. ID = " << mID << LL_ENDL;
+
+ //abort, don't decode
+ setState(DONE);
+ LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: (mFormattedImage->getDataSize() <= 0)" << LL_ENDL;
+ return true;
+ }
+ if (mLoadedDiscard < 0)
+ {
+ LL_WARNS(LOG_TXT) << "Decode entered with invalid mLoadedDiscard. ID = " << mID << LL_ENDL;
+
+ //abort, don't decode
+ setState(DONE);
+ LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: mLoadedDiscard < 0" << LL_ENDL;
+ return true;
+ }
+ mDecodeTimer.reset();
+ mRawImage = NULL;
+ mAuxImage = NULL;
+ llassert_always(mFormattedImage.notNull());
+ S32 discard = mHaveAllData ? 0 : mLoadedDiscard;
+ mDecoded = FALSE;
+ setState(DECODE_IMAGE_UPDATE);
+ LL_DEBUGS(LOG_TXT) << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard
+ << " All Data: " << mHaveAllData << LL_ENDL;
// In case worked manages to request decode, be shut down,
// then init and request decode again with first decode
@@ -1816,226 +1816,226 @@ bool LLTextureFetchWorker::doWork(S32 param)
LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: failed to post for decoding" << LL_ENDL;
return true;
}
- // fall though
- }
-
- if (mState == DECODE_IMAGE_UPDATE)
- {
+ // fall though
+ }
+
+ if (mState == DECODE_IMAGE_UPDATE)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - DECODE_IMAGE_UPDATE");
- if (mDecoded)
- {
+ if (mDecoded)
+ {
mDecodeTime = mDecodeTimer.getElapsedTimeF32();
- if (mDecodedDiscard < 0)
- {
- if (mCachedSize > 0 && !mInLocalCache && mRetryAttempt == 0)
- {
- // Cache file should be deleted, try again
- LL_DEBUGS(LOG_TXT) << mID << ": Decode of cached file failed (removed), retrying" << LL_ENDL;
- llassert_always(mDecodeHandle == 0);
- mFormattedImage = NULL;
- ++mRetryAttempt;
- setState(INIT);
- //return false;
+ if (mDecodedDiscard < 0)
+ {
+ if (mCachedSize > 0 && !mInLocalCache && mRetryAttempt == 0)
+ {
+ // Cache file should be deleted, try again
+ LL_DEBUGS(LOG_TXT) << mID << ": Decode of cached file failed (removed), retrying" << LL_ENDL;
+ llassert_always(mDecodeHandle == 0);
+ mFormattedImage = NULL;
+ ++mRetryAttempt;
+ setState(INIT);
+ //return false;
return doWork(param);
- }
- else
- {
- LL_DEBUGS(LOG_TXT) << "Failed to Decode image " << mID << " after " << mRetryAttempt << " retries" << LL_ENDL;
- setState(DONE); // failed
- }
- }
- else
- {
- llassert_always(mRawImage.notNull());
- LL_DEBUGS(LOG_TXT) << mID << ": Decoded. Discard: " << mDecodedDiscard
- << " Raw Image: " << llformat("%dx%d",mRawImage->getWidth(),mRawImage->getHeight()) << LL_ENDL;
- setState(WRITE_TO_CACHE);
- }
- // fall through
- }
- else
- {
- return false;
- }
- }
-
- if (mState == WRITE_TO_CACHE)
- {
+ }
+ else
+ {
+ LL_DEBUGS(LOG_TXT) << "Failed to Decode image " << mID << " after " << mRetryAttempt << " retries" << LL_ENDL;
+ setState(DONE); // failed
+ }
+ }
+ else
+ {
+ llassert_always(mRawImage.notNull());
+ LL_DEBUGS(LOG_TXT) << mID << ": Decoded. Discard: " << mDecodedDiscard
+ << " Raw Image: " << llformat("%dx%d",mRawImage->getWidth(),mRawImage->getHeight()) << LL_ENDL;
+ setState(WRITE_TO_CACHE);
+ }
+ // fall through
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ if (mState == WRITE_TO_CACHE)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - WRITE_TO_CACHE");
- if (mWriteToCacheState != SHOULD_WRITE || mFormattedImage.isNull())
- {
- // If we're in a local cache or we didn't actually receive any new data,
- // or we failed to load anything, skip
- setState(DONE);
- //return false;
+ if (mWriteToCacheState != SHOULD_WRITE || mFormattedImage.isNull())
+ {
+ // If we're in a local cache or we didn't actually receive any new data,
+ // or we failed to load anything, skip
+ setState(DONE);
+ //return false;
return doWork(param);
- }
- S32 datasize = mFormattedImage->getDataSize();
- if(mFileSize < datasize)//This could happen when http fetching and sim fetching mixed.
- {
- if(mHaveAllData)
- {
- mFileSize = datasize ;
- }
- else
- {
- mFileSize = datasize + 1 ; //flag not fully loaded.
- }
- }
- llassert_always(datasize);
- mWritten = FALSE;
- setState(WAIT_ON_WRITE);
- ++mCacheWriteCount;
- CacheWriteResponder* responder = new CacheWriteResponder(mFetcher, mID);
+ }
+ S32 datasize = mFormattedImage->getDataSize();
+ if(mFileSize < datasize)//This could happen when http fetching and sim fetching mixed.
+ {
+ if(mHaveAllData)
+ {
+ mFileSize = datasize ;
+ }
+ else
+ {
+ mFileSize = datasize + 1 ; //flag not fully loaded.
+ }
+ }
+ llassert_always(datasize);
+ mWritten = FALSE;
+ setState(WAIT_ON_WRITE);
+ ++mCacheWriteCount;
+ CacheWriteResponder* responder = new CacheWriteResponder(mFetcher, mID);
// This call might be under work mutex, but mRawImage is not nessesary safe here.
// If something retrieves it via getRequestFinished() and modifies, image won't
// be protected by work mutex and won't be safe to use here nor in cache worker.
// So make sure users of getRequestFinished() does not attempt to modify image while
// fetcher is working
- mCacheWriteTimer.reset();
- mCacheWriteHandle = mFetcher->mTextureCache->writeToCache(mID,
- mFormattedImage->getData(), datasize,
- mFileSize, mRawImage, mDecodedDiscard, responder);
- // fall through
- }
-
- if (mState == WAIT_ON_WRITE)
- {
+ mCacheWriteTimer.reset();
+ mCacheWriteHandle = mFetcher->mTextureCache->writeToCache(mID,
+ mFormattedImage->getData(), datasize,
+ mFileSize, mRawImage, mDecodedDiscard, responder);
+ // fall through
+ }
+
+ if (mState == WAIT_ON_WRITE)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - WAIT_ON_WRITE");
- if (writeToCacheComplete())
- {
- mCacheWriteTime = mCacheWriteTimer.getElapsedTimeF32();
- setState(DONE);
- // fall through
- }
- else
- {
- if (mDesiredDiscard < mDecodedDiscard)
- {
- // We're waiting for this write to complete before we can receive more data
- // (we can't touch mFormattedImage until the write completes)
- // Prioritize the write
- mFetcher->mTextureCache->prioritizeWrite(mCacheWriteHandle);
- }
- return false;
- }
- }
-
- if (mState == DONE)
- {
+ if (writeToCacheComplete())
+ {
+ mCacheWriteTime = mCacheWriteTimer.getElapsedTimeF32();
+ setState(DONE);
+ // fall through
+ }
+ else
+ {
+ if (mDesiredDiscard < mDecodedDiscard)
+ {
+ // We're waiting for this write to complete before we can receive more data
+ // (we can't touch mFormattedImage until the write completes)
+ // Prioritize the write
+ mFetcher->mTextureCache->prioritizeWrite(mCacheWriteHandle);
+ }
+ return false;
+ }
+ }
+
+ if (mState == DONE)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - DONE");
- if (mDecodedDiscard >= 0 && mDesiredDiscard < mDecodedDiscard)
- {
- // More data was requested, return to INIT
- setState(INIT);
- LL_DEBUGS(LOG_TXT) << mID << " more data requested, returning to INIT: "
- << " mDecodedDiscard " << mDecodedDiscard << ">= 0 && mDesiredDiscard " << mDesiredDiscard
- << "<" << " mDecodedDiscard " << mDecodedDiscard << LL_ENDL;
- // return false;
+ if (mDecodedDiscard >= 0 && mDesiredDiscard < mDecodedDiscard)
+ {
+ // More data was requested, return to INIT
+ setState(INIT);
+ LL_DEBUGS(LOG_TXT) << mID << " more data requested, returning to INIT: "
+ << " mDecodedDiscard " << mDecodedDiscard << ">= 0 && mDesiredDiscard " << mDesiredDiscard
+ << "<" << " mDecodedDiscard " << mDecodedDiscard << LL_ENDL;
+ // return false;
return doWork(param);
- }
- else
- {
+ }
+ else
+ {
mFetchTime = mFetchTimer.getElapsedTimeF32();
- return true;
- }
- }
-
- return false;
-} // -Mw
+ return true;
+ }
+ }
+
+ return false;
+} // -Mw
// Threads: Ttf
// virtual
void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response)
{
LL_PROFILE_ZONE_SCOPED;
- static LLCachedControl<bool> log_to_viewer_log(gSavedSettings, "LogTextureDownloadsToViewerLog", false);
- static LLCachedControl<bool> log_to_sim(gSavedSettings, "LogTextureDownloadsToSimulator", false);
- static LLCachedControl<bool> log_texture_traffic(gSavedSettings, "LogTextureNetworkTraffic", false) ;
-
- LLMutexLock lock(&mWorkMutex); // +Mw
-
- mHttpActive = false;
-
- if (log_to_viewer_log || log_to_sim)
- {
- mFetcher->mTextureInfo.setRequestStartTime(mID, mMetricsStartTime.value());
- mFetcher->mTextureInfo.setRequestType(mID, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
- mFetcher->mTextureInfo.setRequestSize(mID, mRequestedSize);
- mFetcher->mTextureInfo.setRequestOffset(mID, mRequestedOffset);
- mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, LLTimer::getTotalTime());
- }
-
- static LLCachedControl<F32> fake_failure_rate(gSavedSettings, "TextureFetchFakeFailureRate", 0.0f);
- F32 rand_val = ll_frand();
- F32 rate = fake_failure_rate;
- if (mFTType == FTT_SERVER_BAKE && (fake_failure_rate > 0.0) && (rand_val < fake_failure_rate))
- {
- LL_WARNS(LOG_TXT) << mID << " for debugging, setting fake failure status for texture " << mID
- << " (rand was " << rand_val << "/" << rate << ")" << LL_ENDL;
- response->setStatus(LLCore::HttpStatus(503));
- }
- bool success = true;
- bool partial = false;
- LLCore::HttpStatus status(response->getStatus());
- if (!status && (mFTType == FTT_SERVER_BAKE))
- {
- LL_INFOS(LOG_TXT) << mID << " state " << e_state_name[mState] << LL_ENDL;
- mFetchRetryPolicy.onFailure(response);
- F32 retry_after;
- if (mFetchRetryPolicy.shouldRetry(retry_after))
- {
- LL_INFOS(LOG_TXT) << mID << " will retry after " << retry_after << " seconds, resetting state to LOAD_FROM_NETWORK" << LL_ENDL;
- mFetcher->removeFromHTTPQueue(mID, S32Bytes(0));
- std::string reason(status.toString());
- setGetStatus(status, reason);
- releaseHttpSemaphore();
- setState(LOAD_FROM_NETWORK);
- return;
- }
- else
- {
- LL_INFOS(LOG_TXT) << mID << " will not retry" << LL_ENDL;
- }
- }
- else
- {
- mFetchRetryPolicy.onSuccess();
- }
-
- std::string reason(status.toString());
- setGetStatus(status, reason);
- LL_DEBUGS(LOG_TXT) << "HTTP COMPLETE: " << mID
- << " status: " << status.toTerseString()
- << " '" << reason << "'"
- << LL_ENDL;
-
- if (! status)
- {
- success = false;
- if (mFTType != FTT_MAP_TILE) // missing map tiles are normal, don't complain about them.
- {
- LL_WARNS(LOG_TXT) << "CURL GET FAILED, status: " << status.toTerseString()
- << " reason: " << reason << LL_ENDL;
- }
- }
- else
- {
- // A warning about partial (HTTP 206) data. Some grid services
- // do *not* return a 'Content-Range' header in the response to
- // Range requests with a 206 status. We're forced to assume
- // we get what we asked for in these cases until we can fix
- // the services.
- static const LLCore::HttpStatus par_status(HTTP_PARTIAL_CONTENT);
-
- partial = (par_status == status);
- }
-
- S32BytesImplicit data_size = callbackHttpGet(response, partial, success);
-
- if (log_texture_traffic && data_size > 0)
- {
+ static LLCachedControl<bool> log_to_viewer_log(gSavedSettings, "LogTextureDownloadsToViewerLog", false);
+ static LLCachedControl<bool> log_to_sim(gSavedSettings, "LogTextureDownloadsToSimulator", false);
+ static LLCachedControl<bool> log_texture_traffic(gSavedSettings, "LogTextureNetworkTraffic", false) ;
+
+ LLMutexLock lock(&mWorkMutex); // +Mw
+
+ mHttpActive = false;
+
+ if (log_to_viewer_log || log_to_sim)
+ {
+ mFetcher->mTextureInfo.setRequestStartTime(mID, mMetricsStartTime.value());
+ mFetcher->mTextureInfo.setRequestType(mID, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
+ mFetcher->mTextureInfo.setRequestSize(mID, mRequestedSize);
+ mFetcher->mTextureInfo.setRequestOffset(mID, mRequestedOffset);
+ mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, LLTimer::getTotalTime());
+ }
+
+ static LLCachedControl<F32> fake_failure_rate(gSavedSettings, "TextureFetchFakeFailureRate", 0.0f);
+ F32 rand_val = ll_frand();
+ F32 rate = fake_failure_rate;
+ if (mFTType == FTT_SERVER_BAKE && (fake_failure_rate > 0.0) && (rand_val < fake_failure_rate))
+ {
+ LL_WARNS(LOG_TXT) << mID << " for debugging, setting fake failure status for texture " << mID
+ << " (rand was " << rand_val << "/" << rate << ")" << LL_ENDL;
+ response->setStatus(LLCore::HttpStatus(503));
+ }
+ bool success = true;
+ bool partial = false;
+ LLCore::HttpStatus status(response->getStatus());
+ if (!status && (mFTType == FTT_SERVER_BAKE))
+ {
+ LL_INFOS(LOG_TXT) << mID << " state " << e_state_name[mState] << LL_ENDL;
+ mFetchRetryPolicy.onFailure(response);
+ F32 retry_after;
+ if (mFetchRetryPolicy.shouldRetry(retry_after))
+ {
+ LL_INFOS(LOG_TXT) << mID << " will retry after " << retry_after << " seconds, resetting state to LOAD_FROM_NETWORK" << LL_ENDL;
+ mFetcher->removeFromHTTPQueue(mID, S32Bytes(0));
+ std::string reason(status.toString());
+ setGetStatus(status, reason);
+ releaseHttpSemaphore();
+ setState(LOAD_FROM_NETWORK);
+ return;
+ }
+ else
+ {
+ LL_INFOS(LOG_TXT) << mID << " will not retry" << LL_ENDL;
+ }
+ }
+ else
+ {
+ mFetchRetryPolicy.onSuccess();
+ }
+
+ std::string reason(status.toString());
+ setGetStatus(status, reason);
+ LL_DEBUGS(LOG_TXT) << "HTTP COMPLETE: " << mID
+ << " status: " << status.toTerseString()
+ << " '" << reason << "'"
+ << LL_ENDL;
+
+ if (! status)
+ {
+ success = false;
+ if (mFTType != FTT_MAP_TILE) // missing map tiles are normal, don't complain about them.
+ {
+ LL_WARNS(LOG_TXT) << "CURL GET FAILED, status: " << status.toTerseString()
+ << " reason: " << reason << LL_ENDL;
+ }
+ }
+ else
+ {
+ // A warning about partial (HTTP 206) data. Some grid services
+ // do *not* return a 'Content-Range' header in the response to
+ // Range requests with a 206 status. We're forced to assume
+ // we get what we asked for in these cases until we can fix
+ // the services.
+ static const LLCore::HttpStatus par_status(HTTP_PARTIAL_CONTENT);
+
+ partial = (par_status == status);
+ }
+
+ S32BytesImplicit data_size = callbackHttpGet(response, partial, success);
+
+ if (log_texture_traffic && data_size > 0)
+ {
// one worker per multiple textures
std::vector<LLViewerTexture*> textures;
LLViewerTextureManager::findTextures(mID, textures);
@@ -2048,24 +2048,24 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe
gTotalTextureBytesPerBoostLevel[tex->getBoostLevel()] += data_size;
}
}
- }
+ }
+
+ mFetcher->removeFromHTTPQueue(mID, data_size);
- mFetcher->removeFromHTTPQueue(mID, data_size);
-
- recordTextureDone(true, data_size);
-} // -Mw
+ recordTextureDone(true, data_size);
+} // -Mw
// Threads: Tmain
void LLTextureFetchWorker::endWork(S32 param, bool aborted)
{
- LL_PROFILE_ZONE_SCOPED;
- if (mDecodeHandle != 0)
- {
- // LL::ThreadPool has no operation to cancel a particular work item
- mDecodeHandle = 0;
- }
- mFormattedImage = NULL;
+ LL_PROFILE_ZONE_SCOPED;
+ if (mDecodeHandle != 0)
+ {
+ // LL::ThreadPool has no operation to cancel a particular work item
+ mDecodeHandle = 0;
+ }
+ mFormattedImage = NULL;
}
//////////////////////////////////////////////////////////////////////////////
@@ -2076,91 +2076,91 @@ void LLTextureFetchWorker::endWork(S32 param, bool aborted)
void LLTextureFetchWorker::finishWork(S32 param, bool completed)
{
LL_PROFILE_ZONE_SCOPED;
- // The following are required in case the work was aborted
- if (mCacheReadHandle != LLTextureCache::nullHandle())
- {
- mFetcher->mTextureCache->readComplete(mCacheReadHandle, true);
- mCacheReadHandle = LLTextureCache::nullHandle();
- }
- if (mCacheWriteHandle != LLTextureCache::nullHandle())
- {
- mFetcher->mTextureCache->writeComplete(mCacheWriteHandle, true);
- mCacheWriteHandle = LLTextureCache::nullHandle();
- }
+ // The following are required in case the work was aborted
+ if (mCacheReadHandle != LLTextureCache::nullHandle())
+ {
+ mFetcher->mTextureCache->readComplete(mCacheReadHandle, true);
+ mCacheReadHandle = LLTextureCache::nullHandle();
+ }
+ if (mCacheWriteHandle != LLTextureCache::nullHandle())
+ {
+ mFetcher->mTextureCache->writeComplete(mCacheWriteHandle, true);
+ mCacheWriteHandle = LLTextureCache::nullHandle();
+ }
}
// LLQueuedThread's update() method is asking if it's okay to
// delete this worker. You'll notice we're not locking in here
// which is a slight concern. Caller is expected to have made
-// this request 'quiet' by whatever means...
+// this request 'quiet' by whatever means...
//
// Threads: Tmain
// virtual
bool LLTextureFetchWorker::deleteOK()
{
- bool delete_ok = true;
-
- if (mHttpActive)
- {
- // HTTP library has a pointer to this worker
- // and will dereference it to do notification.
- delete_ok = false;
- }
-
- if (WAIT_HTTP_RESOURCE2 == mState)
- {
- if (mFetcher->isHttpWaiter(mID))
- {
- // Don't delete the worker out from under the releaseHttpWaiters()
- // method. Keep the pointers valid, clean up after that method
- // has recognized the cancelation and removed the UUID from the
- // waiter list.
- delete_ok = false;
- }
- }
-
- // Allow any pending reads or writes to complete
- if (mCacheReadHandle != LLTextureCache::nullHandle())
- {
- if (mFetcher->mTextureCache->readComplete(mCacheReadHandle, true))
- {
- mCacheReadHandle = LLTextureCache::nullHandle();
- }
- else
- {
- delete_ok = false;
- }
- }
- if (mCacheWriteHandle != LLTextureCache::nullHandle())
- {
- if (mFetcher->mTextureCache->writeComplete(mCacheWriteHandle))
- {
- mCacheWriteHandle = LLTextureCache::nullHandle();
- }
- else
- {
- delete_ok = false;
- }
- }
-
- if ((haveWork() &&
- // not ok to delete from these states
- ((mState >= WRITE_TO_CACHE && mState <= WAIT_ON_WRITE))))
- {
- delete_ok = false;
- }
-
- return delete_ok;
+ bool delete_ok = true;
+
+ if (mHttpActive)
+ {
+ // HTTP library has a pointer to this worker
+ // and will dereference it to do notification.
+ delete_ok = false;
+ }
+
+ if (WAIT_HTTP_RESOURCE2 == mState)
+ {
+ if (mFetcher->isHttpWaiter(mID))
+ {
+ // Don't delete the worker out from under the releaseHttpWaiters()
+ // method. Keep the pointers valid, clean up after that method
+ // has recognized the cancelation and removed the UUID from the
+ // waiter list.
+ delete_ok = false;
+ }
+ }
+
+ // Allow any pending reads or writes to complete
+ if (mCacheReadHandle != LLTextureCache::nullHandle())
+ {
+ if (mFetcher->mTextureCache->readComplete(mCacheReadHandle, true))
+ {
+ mCacheReadHandle = LLTextureCache::nullHandle();
+ }
+ else
+ {
+ delete_ok = false;
+ }
+ }
+ if (mCacheWriteHandle != LLTextureCache::nullHandle())
+ {
+ if (mFetcher->mTextureCache->writeComplete(mCacheWriteHandle))
+ {
+ mCacheWriteHandle = LLTextureCache::nullHandle();
+ }
+ else
+ {
+ delete_ok = false;
+ }
+ }
+
+ if ((haveWork() &&
+ // not ok to delete from these states
+ ((mState >= WRITE_TO_CACHE && mState <= WAIT_ON_WRITE))))
+ {
+ delete_ok = false;
+ }
+
+ return delete_ok;
}
// Threads: Ttf
void LLTextureFetchWorker::removeFromCache()
{
- if (!mInLocalCache)
- {
- mFetcher->mTextureCache->removeFromCache(mID);
- }
+ if (!mInLocalCache)
+ {
+ mFetcher->mTextureCache->removeFromCache(mID);
+ }
}
@@ -2169,163 +2169,163 @@ void LLTextureFetchWorker::removeFromCache()
// Threads: Ttf
// Locks: Mw
S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response,
- bool partial, bool success)
-{
- S32 data_size = 0 ;
-
- if (mState != WAIT_HTTP_REQ)
- {
- LL_WARNS(LOG_TXT) << "callbackHttpGet for unrequested fetch worker: " << mID
- << " req=" << mSentRequest << " state= " << mState << LL_ENDL;
- return data_size;
- }
- if (mLoaded)
- {
- LL_WARNS(LOG_TXT) << "Duplicate callback for " << mID.asString() << LL_ENDL;
- return data_size ; // ignore duplicate callback
- }
- if (success)
- {
- // get length of stream:
- LLCore::BufferArray * body(response->getBody());
- data_size = body ? body->size() : 0;
-
- LL_DEBUGS(LOG_TXT) << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << LL_ENDL;
- if (data_size > 0)
- {
- // *TODO: set the formatted image data here directly to avoid the copy
-
- // Hold on to body for later copy
- llassert_always(NULL == mHttpBufferArray);
- body->addRef();
- mHttpBufferArray = body;
-
- if (partial)
- {
- unsigned int offset(0), length(0), full_length(0);
- response->getRange(&offset, &length, &full_length);
- if (! offset && ! length)
- {
- // This is the case where we receive a 206 status but
- // there wasn't a useful Content-Range header in the response.
- // This could be because it was badly formatted but is more
- // likely due to capabilities services which scrub headers
- // from responses. Assume we got what we asked for...
- mHttpReplySize = data_size;
- mHttpReplyOffset = mRequestedOffset;
- }
- else
- {
- mHttpReplySize = length;
- mHttpReplyOffset = offset;
- }
- }
-
- if (! partial)
- {
- // Response indicates this is the entire asset regardless
- // of our asking for a byte range. Mark it so and drop
- // any partial data we might have so that the current
- // response body becomes the entire dataset.
- if (data_size <= mRequestedOffset)
- {
- LL_WARNS(LOG_TXT) << "Fetched entire texture " << mID
- << " when it was expected to be marked complete. mImageSize: "
- << mFileSize << " datasize: " << mFormattedImage->getDataSize()
- << LL_ENDL;
- }
- mHaveAllData = TRUE;
- llassert_always(mDecodeHandle == 0);
- mFormattedImage = NULL; // discard any previous data we had
- }
- else if (data_size < mRequestedSize)
- {
- mHaveAllData = TRUE;
- }
- else if (data_size > mRequestedSize)
- {
- // *TODO: This shouldn't be happening any more (REALLY don't expect this anymore)
- LL_WARNS(LOG_TXT) << "data_size = " << data_size << " > requested: " << mRequestedSize << LL_ENDL;
- mHaveAllData = TRUE;
- llassert_always(mDecodeHandle == 0);
- mFormattedImage = NULL; // discard any previous data we had
- }
- }
- else
- {
- // We requested data but received none (and no error),
- // so presumably we have all of it
- mHaveAllData = TRUE;
- }
- mRequestedSize = data_size;
-
- if (mHaveAllData)
+ bool partial, bool success)
+{
+ S32 data_size = 0 ;
+
+ if (mState != WAIT_HTTP_REQ)
+ {
+ LL_WARNS(LOG_TXT) << "callbackHttpGet for unrequested fetch worker: " << mID
+ << " req=" << mSentRequest << " state= " << mState << LL_ENDL;
+ return data_size;
+ }
+ if (mLoaded)
+ {
+ LL_WARNS(LOG_TXT) << "Duplicate callback for " << mID.asString() << LL_ENDL;
+ return data_size ; // ignore duplicate callback
+ }
+ if (success)
+ {
+ // get length of stream:
+ LLCore::BufferArray * body(response->getBody());
+ data_size = body ? body->size() : 0;
+
+ LL_DEBUGS(LOG_TXT) << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << LL_ENDL;
+ if (data_size > 0)
+ {
+ // *TODO: set the formatted image data here directly to avoid the copy
+
+ // Hold on to body for later copy
+ llassert_always(NULL == mHttpBufferArray);
+ body->addRef();
+ mHttpBufferArray = body;
+
+ if (partial)
+ {
+ unsigned int offset(0), length(0), full_length(0);
+ response->getRange(&offset, &length, &full_length);
+ if (! offset && ! length)
+ {
+ // This is the case where we receive a 206 status but
+ // there wasn't a useful Content-Range header in the response.
+ // This could be because it was badly formatted but is more
+ // likely due to capabilities services which scrub headers
+ // from responses. Assume we got what we asked for...
+ mHttpReplySize = data_size;
+ mHttpReplyOffset = mRequestedOffset;
+ }
+ else
+ {
+ mHttpReplySize = length;
+ mHttpReplyOffset = offset;
+ }
+ }
+
+ if (! partial)
+ {
+ // Response indicates this is the entire asset regardless
+ // of our asking for a byte range. Mark it so and drop
+ // any partial data we might have so that the current
+ // response body becomes the entire dataset.
+ if (data_size <= mRequestedOffset)
+ {
+ LL_WARNS(LOG_TXT) << "Fetched entire texture " << mID
+ << " when it was expected to be marked complete. mImageSize: "
+ << mFileSize << " datasize: " << mFormattedImage->getDataSize()
+ << LL_ENDL;
+ }
+ mHaveAllData = TRUE;
+ llassert_always(mDecodeHandle == 0);
+ mFormattedImage = NULL; // discard any previous data we had
+ }
+ else if (data_size < mRequestedSize)
+ {
+ mHaveAllData = TRUE;
+ }
+ else if (data_size > mRequestedSize)
+ {
+ // *TODO: This shouldn't be happening any more (REALLY don't expect this anymore)
+ LL_WARNS(LOG_TXT) << "data_size = " << data_size << " > requested: " << mRequestedSize << LL_ENDL;
+ mHaveAllData = TRUE;
+ llassert_always(mDecodeHandle == 0);
+ mFormattedImage = NULL; // discard any previous data we had
+ }
+ }
+ else
+ {
+ // We requested data but received none (and no error),
+ // so presumably we have all of it
+ mHaveAllData = TRUE;
+ }
+ mRequestedSize = data_size;
+
+ if (mHaveAllData)
{
LLViewerStatsRecorder::instance().textureFetch();
}
// *TODO: set the formatted image data here directly to avoid the copy
- }
- else
- {
- mRequestedSize = -1; // error
- }
-
- mLoaded = TRUE;
+ }
+ else
+ {
+ mRequestedSize = -1; // error
+ }
+
+ mLoaded = TRUE;
- return data_size ;
+ return data_size ;
}
//////////////////////////////////////////////////////////////////////////////
// Threads: Ttc
void LLTextureFetchWorker::callbackCacheRead(bool success, LLImageFormatted* image,
- S32 imagesize, BOOL islocal)
+ S32 imagesize, BOOL islocal)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- LLMutexLock lock(&mWorkMutex); // +Mw
- if (mState != LOAD_FROM_TEXTURE_CACHE)
- {
-// LL_WARNS(LOG_TXT) << "Read callback for " << mID << " with state = " << mState << LL_ENDL;
- return;
- }
- if (success)
- {
- llassert_always(imagesize >= 0);
- mFileSize = imagesize;
- mFormattedImage = image;
- mImageCodec = image->getCodec();
- mInLocalCache = islocal;
- if (mFileSize != 0 && mFormattedImage->getDataSize() >= mFileSize)
- {
- mHaveAllData = TRUE;
- }
- }
- mLoaded = TRUE;
-} // -Mw
+ LLMutexLock lock(&mWorkMutex); // +Mw
+ if (mState != LOAD_FROM_TEXTURE_CACHE)
+ {
+// LL_WARNS(LOG_TXT) << "Read callback for " << mID << " with state = " << mState << LL_ENDL;
+ return;
+ }
+ if (success)
+ {
+ llassert_always(imagesize >= 0);
+ mFileSize = imagesize;
+ mFormattedImage = image;
+ mImageCodec = image->getCodec();
+ mInLocalCache = islocal;
+ if (mFileSize != 0 && mFormattedImage->getDataSize() >= mFileSize)
+ {
+ mHaveAllData = TRUE;
+ }
+ }
+ mLoaded = TRUE;
+} // -Mw
// Threads: Ttc
void LLTextureFetchWorker::callbackCacheWrite(bool success)
{
- LLMutexLock lock(&mWorkMutex); // +Mw
- if (mState != WAIT_ON_WRITE)
- {
-// LL_WARNS(LOG_TXT) << "Write callback for " << mID << " with state = " << mState << LL_ENDL;
- return;
- }
- mWritten = TRUE;
-} // -Mw
+ LLMutexLock lock(&mWorkMutex); // +Mw
+ if (mState != WAIT_ON_WRITE)
+ {
+// LL_WARNS(LOG_TXT) << "Write callback for " << mID << " with state = " << mState << LL_ENDL;
+ return;
+ }
+ mWritten = TRUE;
+} // -Mw
//////////////////////////////////////////////////////////////////////////////
// Threads: Tid
void LLTextureFetchWorker::callbackDecoded(bool success, LLImageRaw* raw, LLImageRaw* aux, S32 decode_id)
{
- LLMutexLock lock(&mWorkMutex); // +Mw
- if (mDecodeHandle == 0)
- {
- return; // aborted, ignore
- }
+ LLMutexLock lock(&mWorkMutex); // +Mw
+ if (mDecodeHandle == 0)
+ {
+ return; // aborted, ignore
+ }
if (mDecodeHandle != decode_id)
{
// Queue doesn't support canceling old requests.
@@ -2334,87 +2334,87 @@ void LLTextureFetchWorker::callbackDecoded(bool success, LLImageRaw* raw, LLImag
LL_DEBUGS(LOG_TXT) << mID << " received obsolete decode's callback" << LL_ENDL;
return; // ignore
}
- if (mState != DECODE_IMAGE_UPDATE)
- {
- LL_DEBUGS(LOG_TXT) << "Decode callback for " << mID << " with state = " << mState << LL_ENDL;
- mDecodeHandle = 0;
- return;
- }
- llassert_always(mFormattedImage.notNull());
-
- mDecodeHandle = 0;
- if (success)
- {
- llassert_always(raw);
- mRawImage = raw;
- mAuxImage = aux;
- mDecodedDiscard = mFormattedImage->getDiscardLevel();
- LL_DEBUGS(LOG_TXT) << mID << ": Decode Finished. Discard: " << mDecodedDiscard
- << " Raw Image: " << llformat("%dx%d",mRawImage->getWidth(),mRawImage->getHeight()) << LL_ENDL;
- }
- else
- {
- LL_WARNS(LOG_TXT) << "DECODE FAILED: " << mID << " Discard: " << (S32)mFormattedImage->getDiscardLevel() << LL_ENDL;
- removeFromCache();
- mDecodedDiscard = -1; // Redundant, here for clarity and paranoia
- }
- mDecoded = TRUE;
-// LL_INFOS(LOG_TXT) << mID << " : DECODE COMPLETE " << LL_ENDL;
-} // -Mw
+ if (mState != DECODE_IMAGE_UPDATE)
+ {
+ LL_DEBUGS(LOG_TXT) << "Decode callback for " << mID << " with state = " << mState << LL_ENDL;
+ mDecodeHandle = 0;
+ return;
+ }
+ llassert_always(mFormattedImage.notNull());
+
+ mDecodeHandle = 0;
+ if (success)
+ {
+ llassert_always(raw);
+ mRawImage = raw;
+ mAuxImage = aux;
+ mDecodedDiscard = mFormattedImage->getDiscardLevel();
+ LL_DEBUGS(LOG_TXT) << mID << ": Decode Finished. Discard: " << mDecodedDiscard
+ << " Raw Image: " << llformat("%dx%d",mRawImage->getWidth(),mRawImage->getHeight()) << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS(LOG_TXT) << "DECODE FAILED: " << mID << " Discard: " << (S32)mFormattedImage->getDiscardLevel() << LL_ENDL;
+ removeFromCache();
+ mDecodedDiscard = -1; // Redundant, here for clarity and paranoia
+ }
+ mDecoded = TRUE;
+// LL_INFOS(LOG_TXT) << mID << " : DECODE COMPLETE " << LL_ENDL;
+} // -Mw
//////////////////////////////////////////////////////////////////////////////
// Threads: Ttf
bool LLTextureFetchWorker::writeToCacheComplete()
{
- // Complete write to cache
- if (mCacheWriteHandle != LLTextureCache::nullHandle())
- {
- if (!mWritten)
- {
- return false;
- }
- if (mFetcher->mTextureCache->writeComplete(mCacheWriteHandle))
- {
- mCacheWriteHandle = LLTextureCache::nullHandle();
- }
- else
- {
- return false;
- }
- }
- return true;
+ // Complete write to cache
+ if (mCacheWriteHandle != LLTextureCache::nullHandle())
+ {
+ if (!mWritten)
+ {
+ return false;
+ }
+ if (mFetcher->mTextureCache->writeComplete(mCacheWriteHandle))
+ {
+ mCacheWriteHandle = LLTextureCache::nullHandle();
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return true;
}
// Threads: Ttf
void LLTextureFetchWorker::recordTextureStart(bool is_http)
{
- if (! mMetricsStartTime.value())
- {
- mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp();
- }
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE,
- is_http,
- LLImageBase::TYPE_AVATAR_BAKE == mType);
+ if (! mMetricsStartTime.value())
+ {
+ mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp();
+ }
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE,
+ is_http,
+ LLImageBase::TYPE_AVATAR_BAKE == mType);
}
// Threads: Ttf
void LLTextureFetchWorker::recordTextureDone(bool is_http, F64 byte_count)
{
- if (mMetricsStartTime.value())
- {
- LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_TEXTURE,
+ if (mMetricsStartTime.value())
+ {
+ LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_TEXTURE,
is_http,
LLImageBase::TYPE_AVATAR_BAKE == mType,
LLViewerAssetStatsFF::get_timestamp() - mMetricsStartTime,
byte_count);
- mMetricsStartTime = (U32Seconds)0;
- }
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE,
- is_http,
- LLImageBase::TYPE_AVATAR_BAKE == mType);
+ mMetricsStartTime = (U32Seconds)0;
+ }
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE,
+ is_http,
+ LLImageBase::TYPE_AVATAR_BAKE == mType);
}
@@ -2433,201 +2433,201 @@ std::string LLTextureFetch::getStateString(S32 state)
}
LLTextureFetch::LLTextureFetch(LLTextureCache* cache, bool threaded, bool qa_mode)
- : LLWorkerThread("TextureFetch", threaded, true),
- mDebugCount(0),
- mDebugPause(FALSE),
- mPacketCount(0),
- mBadPacketCount(0),
- mQueueMutex(),
- mNetworkQueueMutex(),
- mTextureCache(cache),
- mTextureBandwidth(0),
- mHTTPTextureBits(0),
- mTotalHTTPRequests(0),
- mQAMode(qa_mode),
- mHttpRequest(NULL),
- mHttpOptions(),
- mHttpOptionsWithHeaders(),
- mHttpHeaders(),
- mHttpPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
- mHttpMetricsHeaders(),
- mHttpMetricsPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
- mTotalCacheReadCount(0U),
- mTotalCacheWriteCount(0U),
- mTotalResourceWaitCount(0U),
- mFetchSource(LLTextureFetch::FROM_ALL),
- mOriginFetchSource(LLTextureFetch::FROM_ALL),
- mTextureInfoMainThread(false)
-{
- mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS");
- mTextureInfo.setLogging(true);
-
- LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
- mHttpRequest = new LLCore::HttpRequest;
- mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
- mHttpOptionsWithHeaders = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
- mHttpOptionsWithHeaders->setWantHeaders(true);
+ : LLWorkerThread("TextureFetch", threaded, true),
+ mDebugCount(0),
+ mDebugPause(FALSE),
+ mPacketCount(0),
+ mBadPacketCount(0),
+ mQueueMutex(),
+ mNetworkQueueMutex(),
+ mTextureCache(cache),
+ mTextureBandwidth(0),
+ mHTTPTextureBits(0),
+ mTotalHTTPRequests(0),
+ mQAMode(qa_mode),
+ mHttpRequest(NULL),
+ mHttpOptions(),
+ mHttpOptionsWithHeaders(),
+ mHttpHeaders(),
+ mHttpPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
+ mHttpMetricsHeaders(),
+ mHttpMetricsPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
+ mTotalCacheReadCount(0U),
+ mTotalCacheWriteCount(0U),
+ mTotalResourceWaitCount(0U),
+ mFetchSource(LLTextureFetch::FROM_ALL),
+ mOriginFetchSource(LLTextureFetch::FROM_ALL),
+ mTextureInfoMainThread(false)
+{
+ mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS");
+ mTextureInfo.setLogging(true);
+
+ LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
+ mHttpRequest = new LLCore::HttpRequest;
+ mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+ mHttpOptionsWithHeaders = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+ mHttpOptionsWithHeaders->setWantHeaders(true);
mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders);
- mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_IMAGE_X_J2C);
- mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_TEXTURE);
+ mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_IMAGE_X_J2C);
+ mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_TEXTURE);
mHttpMetricsHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders);
- mHttpMetricsHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML);
- mHttpMetricsPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_REPORTING);
- mHttpHighWater = HTTP_NONPIPE_REQUESTS_HIGH_WATER;
- mHttpLowWater = HTTP_NONPIPE_REQUESTS_LOW_WATER;
- mHttpSemaphore = 0;
-
- // If that test log has ben requested but not yet created, create it
- if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName))
- {
- sTesterp = new LLTextureFetchTester() ;
- if (!sTesterp->isValid())
- {
- delete sTesterp;
- sTesterp = NULL;
- }
- }
+ mHttpMetricsHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML);
+ mHttpMetricsPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_REPORTING);
+ mHttpHighWater = HTTP_NONPIPE_REQUESTS_HIGH_WATER;
+ mHttpLowWater = HTTP_NONPIPE_REQUESTS_LOW_WATER;
+ mHttpSemaphore = 0;
+
+ // If that test log has ben requested but not yet created, create it
+ if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName))
+ {
+ sTesterp = new LLTextureFetchTester() ;
+ if (!sTesterp->isValid())
+ {
+ delete sTesterp;
+ sTesterp = NULL;
+ }
+ }
}
LLTextureFetch::~LLTextureFetch()
{
- clearDeleteList();
+ clearDeleteList();
- while (! mCommands.empty())
- {
- TFRequest * req(mCommands.front());
- mCommands.erase(mCommands.begin());
- delete req;
- }
+ while (! mCommands.empty())
+ {
+ TFRequest * req(mCommands.front());
+ mCommands.erase(mCommands.begin());
+ delete req;
+ }
- mHttpWaitResource.clear();
-
- delete mHttpRequest;
- mHttpRequest = NULL;
+ mHttpWaitResource.clear();
- // ~LLQueuedThread() called here
+ delete mHttpRequest;
+ mHttpRequest = NULL;
+
+ // ~LLQueuedThread() called here
}
S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority,
- S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http)
+ S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http)
{
LL_PROFILE_ZONE_SCOPED;
- if (mDebugPause)
- {
- return -1;
- }
-
- if (f_type == FTT_SERVER_BAKE)
- {
- LL_DEBUGS("Avatar") << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << " type " << f_type << LL_ENDL;
- }
- LLTextureFetchWorker* worker = getWorker(id) ;
- if (worker)
- {
- if (worker->mHost != host)
- {
- LL_WARNS(LOG_TXT) << "LLTextureFetch::createRequest " << id << " called with multiple hosts: "
- << host << " != " << worker->mHost << LL_ENDL;
- removeRequest(worker, true);
- worker = NULL;
- return -1;
- }
- }
-
- S32 desired_size;
- std::string exten = gDirUtilp->getExtension(url);
- //if (f_type == FTT_SERVER_BAKE)
+ if (mDebugPause)
+ {
+ return -1;
+ }
+
+ if (f_type == FTT_SERVER_BAKE)
+ {
+ LL_DEBUGS("Avatar") << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << " type " << f_type << LL_ENDL;
+ }
+ LLTextureFetchWorker* worker = getWorker(id) ;
+ if (worker)
+ {
+ if (worker->mHost != host)
+ {
+ LL_WARNS(LOG_TXT) << "LLTextureFetch::createRequest " << id << " called with multiple hosts: "
+ << host << " != " << worker->mHost << LL_ENDL;
+ removeRequest(worker, true);
+ worker = NULL;
+ return -1;
+ }
+ }
+
+ S32 desired_size;
+ std::string exten = gDirUtilp->getExtension(url);
+ //if (f_type == FTT_SERVER_BAKE)
if ((f_type == FTT_SERVER_BAKE) && !url.empty() && !exten.empty() && (LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C))
- {
- // SH-4030: This case should be redundant with the following one, just
- // breaking it out here to clarify that it's intended behavior.
- llassert(!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C));
-
- // Do full requests for baked textures to reduce interim blurring.
- LL_DEBUGS(LOG_TXT) << "full request for " << id << " texture is FTT_SERVER_BAKE" << LL_ENDL;
- desired_size = MAX_IMAGE_DATA_SIZE;
- desired_discard = 0;
- }
- else if (!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C))
- {
- LL_DEBUGS(LOG_TXT) << "full request for " << id << " exten is not J2C: " << exten << LL_ENDL;
- // Only do partial requests for J2C at the moment
- desired_size = MAX_IMAGE_DATA_SIZE;
- desired_discard = 0;
- }
- else if (desired_discard == 0)
- {
- // if we want the entire image, and we know its size, then get it all
- // (calcDataSizeJ2C() below makes assumptions about how the image
- // was compressed - this code ensures that when we request the entire image,
- // we really do get it.)
- desired_size = MAX_IMAGE_DATA_SIZE;
- }
- else if (w*h*c > 0)
- {
- // If the requester knows the dimensions of the image,
- // this will calculate how much data we need without having to parse the header
-
- desired_size = LLImageJ2C::calcDataSizeJ2C(w, h, c, desired_discard);
- }
- else
- {
- // If the requester knows nothing about the file, we fetch the smallest
- // amount of data at the lowest resolution (highest discard level) possible.
- desired_size = TEXTURE_CACHE_ENTRY_SIZE;
- desired_discard = MAX_DISCARD_LEVEL;
- }
-
-
- if (worker)
- {
- if (worker->wasAborted())
- {
- return -1; // need to wait for previous aborted request to complete
- }
- worker->lockWorkMutex(); // +Mw
+ {
+ // SH-4030: This case should be redundant with the following one, just
+ // breaking it out here to clarify that it's intended behavior.
+ llassert(!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C));
+
+ // Do full requests for baked textures to reduce interim blurring.
+ LL_DEBUGS(LOG_TXT) << "full request for " << id << " texture is FTT_SERVER_BAKE" << LL_ENDL;
+ desired_size = MAX_IMAGE_DATA_SIZE;
+ desired_discard = 0;
+ }
+ else if (!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C))
+ {
+ LL_DEBUGS(LOG_TXT) << "full request for " << id << " exten is not J2C: " << exten << LL_ENDL;
+ // Only do partial requests for J2C at the moment
+ desired_size = MAX_IMAGE_DATA_SIZE;
+ desired_discard = 0;
+ }
+ else if (desired_discard == 0)
+ {
+ // if we want the entire image, and we know its size, then get it all
+ // (calcDataSizeJ2C() below makes assumptions about how the image
+ // was compressed - this code ensures that when we request the entire image,
+ // we really do get it.)
+ desired_size = MAX_IMAGE_DATA_SIZE;
+ }
+ else if (w*h*c > 0)
+ {
+ // If the requester knows the dimensions of the image,
+ // this will calculate how much data we need without having to parse the header
+
+ desired_size = LLImageJ2C::calcDataSizeJ2C(w, h, c, desired_discard);
+ }
+ else
+ {
+ // If the requester knows nothing about the file, we fetch the smallest
+ // amount of data at the lowest resolution (highest discard level) possible.
+ desired_size = TEXTURE_CACHE_ENTRY_SIZE;
+ desired_discard = MAX_DISCARD_LEVEL;
+ }
+
+
+ if (worker)
+ {
+ if (worker->wasAborted())
+ {
+ return -1; // need to wait for previous aborted request to complete
+ }
+ worker->lockWorkMutex(); // +Mw
if (worker->mState == LLTextureFetchWorker::DONE && worker->mDesiredSize == llmax(desired_size, TEXTURE_CACHE_ENTRY_SIZE) && worker->mDesiredDiscard == desired_discard) {
- worker->unlockWorkMutex(); // -Mw
+ worker->unlockWorkMutex(); // -Mw
return -1; // similar request has failed or is in a transitional state
}
- worker->mActiveCount++;
- worker->mNeedsAux = needs_aux;
- worker->setImagePriority(priority);
- worker->setDesiredDiscard(desired_discard, desired_size);
- worker->setCanUseHTTP(can_use_http);
-
- //MAINT-4184 url is always empty. Do not set with it.
-
- if (!worker->haveWork())
- {
- worker->setState(LLTextureFetchWorker::INIT);
- worker->unlockWorkMutex(); // -Mw
-
- worker->addWork(0);
- }
- else
- {
- worker->unlockWorkMutex(); // -Mw
- }
- }
- else
- {
- worker = new LLTextureFetchWorker(this, f_type, url, id, host, priority, desired_discard, desired_size);
- lockQueue(); // +Mfq
- mRequestMap[id] = worker;
- unlockQueue(); // -Mfq
-
- worker->lockWorkMutex(); // +Mw
- worker->mActiveCount++;
- worker->mNeedsAux = needs_aux;
- worker->setCanUseHTTP(can_use_http) ;
- worker->unlockWorkMutex(); // -Mw
- }
-
- LL_DEBUGS(LOG_TXT) << "REQUESTED: " << id << " f_type " << fttype_to_string(f_type)
- << " Discard: " << desired_discard << " size " << desired_size << LL_ENDL;
- return desired_discard;
+ worker->mActiveCount++;
+ worker->mNeedsAux = needs_aux;
+ worker->setImagePriority(priority);
+ worker->setDesiredDiscard(desired_discard, desired_size);
+ worker->setCanUseHTTP(can_use_http);
+
+ //MAINT-4184 url is always empty. Do not set with it.
+
+ if (!worker->haveWork())
+ {
+ worker->setState(LLTextureFetchWorker::INIT);
+ worker->unlockWorkMutex(); // -Mw
+
+ worker->addWork(0);
+ }
+ else
+ {
+ worker->unlockWorkMutex(); // -Mw
+ }
+ }
+ else
+ {
+ worker = new LLTextureFetchWorker(this, f_type, url, id, host, priority, desired_discard, desired_size);
+ lockQueue(); // +Mfq
+ mRequestMap[id] = worker;
+ unlockQueue(); // -Mfq
+
+ worker->lockWorkMutex(); // +Mw
+ worker->mActiveCount++;
+ worker->mNeedsAux = needs_aux;
+ worker->setCanUseHTTP(can_use_http) ;
+ worker->unlockWorkMutex(); // -Mw
+ }
+
+ LL_DEBUGS(LOG_TXT) << "REQUESTED: " << id << " f_type " << fttype_to_string(f_type)
+ << " Discard: " << desired_discard << " size " << desired_size << LL_ENDL;
+ return desired_discard;
}
// Threads: T*
//
@@ -2635,19 +2635,19 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L
void LLTextureFetch::addToHTTPQueue(const LLUUID& id)
{
LL_PROFILE_ZONE_SCOPED;
- LLMutexLock lock(&mNetworkQueueMutex); // +Mfnq
- mHTTPTextureQueue.insert(id);
- mTotalHTTPRequests++;
-} // -Mfnq
+ LLMutexLock lock(&mNetworkQueueMutex); // +Mfnq
+ mHTTPTextureQueue.insert(id);
+ mTotalHTTPRequests++;
+} // -Mfnq
// Threads: T*
void LLTextureFetch::removeFromHTTPQueue(const LLUUID& id, S32Bytes received_size)
{
LL_PROFILE_ZONE_SCOPED;
- LLMutexLock lock(&mNetworkQueueMutex); // +Mfnq
- mHTTPTextureQueue.erase(id);
- mHTTPTextureBits += received_size; // Approximate - does not include header bits
-} // -Mfnq
+ LLMutexLock lock(&mNetworkQueueMutex); // +Mfnq
+ mHTTPTextureQueue.erase(id);
+ mHTTPTextureBits += received_size; // Approximate - does not include header bits
+} // -Mfnq
// NB: If you change deleteRequest() you should probably make
// parallel changes in removeRequest(). They're functionally
@@ -2657,22 +2657,22 @@ void LLTextureFetch::removeFromHTTPQueue(const LLUUID& id, S32Bytes received_siz
void LLTextureFetch::deleteRequest(const LLUUID& id, bool cancel)
{
LL_PROFILE_ZONE_SCOPED;
- lockQueue(); // +Mfq
- LLTextureFetchWorker* worker = getWorkerAfterLock(id);
- if (worker)
- {
- size_t erased_1 = mRequestMap.erase(worker->mID);
- unlockQueue(); // -Mfq
+ lockQueue(); // +Mfq
+ LLTextureFetchWorker* worker = getWorkerAfterLock(id);
+ if (worker)
+ {
+ size_t erased_1 = mRequestMap.erase(worker->mID);
+ unlockQueue(); // -Mfq
- llassert_always(erased_1 > 0) ;
- llassert_always(!(worker->getFlags(LLWorkerClass::WCF_DELETE_REQUESTED))) ;
+ llassert_always(erased_1 > 0) ;
+ llassert_always(!(worker->getFlags(LLWorkerClass::WCF_DELETE_REQUESTED))) ;
- worker->scheduleDelete();
- }
- else
- {
- unlockQueue(); // -Mfq
- }
+ worker->scheduleDelete();
+ }
+ else
+ {
+ unlockQueue(); // -Mfq
+ }
}
// NB: If you change removeRequest() you should probably make
@@ -2683,67 +2683,67 @@ void LLTextureFetch::deleteRequest(const LLUUID& id, bool cancel)
void LLTextureFetch::removeRequest(LLTextureFetchWorker* worker, bool cancel)
{
LL_PROFILE_ZONE_SCOPED;
- if(!worker)
- {
- return;
- }
+ if(!worker)
+ {
+ return;
+ }
- lockQueue(); // +Mfq
- size_t erased_1 = mRequestMap.erase(worker->mID);
- unlockQueue(); // -Mfq
+ lockQueue(); // +Mfq
+ size_t erased_1 = mRequestMap.erase(worker->mID);
+ unlockQueue(); // -Mfq
- llassert_always(erased_1 > 0) ;
- llassert_always(!(worker->getFlags(LLWorkerClass::WCF_DELETE_REQUESTED))) ;
+ llassert_always(erased_1 > 0) ;
+ llassert_always(!(worker->getFlags(LLWorkerClass::WCF_DELETE_REQUESTED))) ;
- worker->scheduleDelete();
+ worker->scheduleDelete();
}
void LLTextureFetch::deleteAllRequests()
{
- while(1)
- {
- lockQueue();
- if(mRequestMap.empty())
- {
- unlockQueue() ;
- break;
- }
+ while(1)
+ {
+ lockQueue();
+ if(mRequestMap.empty())
+ {
+ unlockQueue() ;
+ break;
+ }
- LLTextureFetchWorker* worker = mRequestMap.begin()->second;
- unlockQueue() ;
+ LLTextureFetchWorker* worker = mRequestMap.begin()->second;
+ unlockQueue() ;
- removeRequest(worker, true);
- }
+ removeRequest(worker, true);
+ }
}
// Threads: T*
-S32 LLTextureFetch::getNumRequests()
-{
- lockQueue(); // +Mfq
- S32 size = (S32)mRequestMap.size();
- unlockQueue(); // -Mfq
+S32 LLTextureFetch::getNumRequests()
+{
+ lockQueue(); // +Mfq
+ S32 size = (S32)mRequestMap.size();
+ unlockQueue(); // -Mfq
- return size;
+ return size;
}
// Threads: T*
-S32 LLTextureFetch::getNumHTTPRequests()
-{
- mNetworkQueueMutex.lock(); // +Mfq
- S32 size = (S32)mHTTPTextureQueue.size();
- mNetworkQueueMutex.unlock(); // -Mfq
+S32 LLTextureFetch::getNumHTTPRequests()
+{
+ mNetworkQueueMutex.lock(); // +Mfq
+ S32 size = (S32)mHTTPTextureQueue.size();
+ mNetworkQueueMutex.unlock(); // -Mfq
- return size;
+ return size;
}
// Threads: T*
U32 LLTextureFetch::getTotalNumHTTPRequests()
{
- mNetworkQueueMutex.lock(); // +Mfq
- U32 size = mTotalHTTPRequests;
- mNetworkQueueMutex.unlock(); // -Mfq
+ mNetworkQueueMutex.lock(); // +Mfq
+ U32 size = mTotalHTTPRequests;
+ mNetworkQueueMutex.unlock(); // -Mfq
- return size;
+ return size;
}
// call lockQueue() first!
@@ -2752,115 +2752,115 @@ U32 LLTextureFetch::getTotalNumHTTPRequests()
LLTextureFetchWorker* LLTextureFetch::getWorkerAfterLock(const LLUUID& id)
{
LL_PROFILE_ZONE_SCOPED;
- LLTextureFetchWorker* res = NULL;
- map_t::iterator iter = mRequestMap.find(id);
- if (iter != mRequestMap.end())
- {
- res = iter->second;
- }
- return res;
+ LLTextureFetchWorker* res = NULL;
+ map_t::iterator iter = mRequestMap.find(id);
+ if (iter != mRequestMap.end())
+ {
+ res = iter->second;
+ }
+ return res;
}
// Threads: T*
LLTextureFetchWorker* LLTextureFetch::getWorker(const LLUUID& id)
{
- LLMutexLock lock(&mQueueMutex); // +Mfq
+ LLMutexLock lock(&mQueueMutex); // +Mfq
- return getWorkerAfterLock(id);
-} // -Mfq
+ return getWorkerAfterLock(id);
+} // -Mfq
// Threads: T*
bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level,
- LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux,
- LLCore::HttpStatus& last_http_get_status)
+ LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux,
+ LLCore::HttpStatus& last_http_get_status)
{
LL_PROFILE_ZONE_SCOPED;
- bool res = false;
- LLTextureFetchWorker* worker = getWorker(id);
- if (worker)
- {
- if (worker->wasAborted())
- {
- res = true;
- }
- else if (!worker->haveWork())
- {
- // Should only happen if we set mDebugPause...
- if (!mDebugPause)
- {
-// LL_WARNS(LOG_TXT) << "Adding work for inactive worker: " << id << LL_ENDL;
- worker->addWork(0);
- }
- }
- else if (worker->checkWork())
- {
- F32 decode_time;
- F32 fetch_time;
- F32 cache_read_time;
- F32 cache_write_time;
- S32 file_size;
- std::map<S32, F32> logged_state_timers;
- F32 skipped_states_time;
- worker->lockWorkMutex(); // +Mw
- last_http_get_status = worker->mGetStatus;
- discard_level = worker->mDecodedDiscard;
- raw = worker->mRawImage;
- aux = worker->mAuxImage;
-
- decode_time = worker->mDecodeTime;
- fetch_time = worker->mFetchTime;
- cache_read_time = worker->mCacheReadTime;
- cache_write_time = worker->mCacheWriteTime;
- file_size = worker->mFileSize;
+ bool res = false;
+ LLTextureFetchWorker* worker = getWorker(id);
+ if (worker)
+ {
+ if (worker->wasAborted())
+ {
+ res = true;
+ }
+ else if (!worker->haveWork())
+ {
+ // Should only happen if we set mDebugPause...
+ if (!mDebugPause)
+ {
+// LL_WARNS(LOG_TXT) << "Adding work for inactive worker: " << id << LL_ENDL;
+ worker->addWork(0);
+ }
+ }
+ else if (worker->checkWork())
+ {
+ F32 decode_time;
+ F32 fetch_time;
+ F32 cache_read_time;
+ F32 cache_write_time;
+ S32 file_size;
+ std::map<S32, F32> logged_state_timers;
+ F32 skipped_states_time;
+ worker->lockWorkMutex(); // +Mw
+ last_http_get_status = worker->mGetStatus;
+ discard_level = worker->mDecodedDiscard;
+ raw = worker->mRawImage;
+ aux = worker->mAuxImage;
+
+ decode_time = worker->mDecodeTime;
+ fetch_time = worker->mFetchTime;
+ cache_read_time = worker->mCacheReadTime;
+ cache_write_time = worker->mCacheWriteTime;
+ file_size = worker->mFileSize;
worker->mCacheReadTimer.reset();
worker->mDecodeTimer.reset();
- worker->mCacheWriteTimer.reset();
+ worker->mCacheWriteTimer.reset();
worker->mFetchTimer.reset();
- logged_state_timers = worker->mStateTimersMap;
- skipped_states_time = worker->mSkippedStatesTime;
- worker->mStateTimer.reset();
- res = true;
- LL_DEBUGS(LOG_TXT) << id << ": Request Finished. State: " << worker->mState << " Discard: " << discard_level << LL_ENDL;
- worker->unlockWorkMutex(); // -Mw
-
- sample(sTexDecodeLatency, decode_time);
- sample(sTexFetchLatency, fetch_time);
- sample(sCacheReadLatency, cache_read_time);
- sample(sCacheWriteLatency, cache_write_time);
-
- static LLCachedControl<F32> min_time_to_log(gSavedSettings, "TextureFetchMinTimeToLog", 2.f);
- if (fetch_time > min_time_to_log)
- {
- //LL_INFOS() << "fetch_time: " << fetch_time << " cache_read_time: " << cache_read_time << " decode_time: " << decode_time << " cache_write_time: " << cache_write_time << LL_ENDL;
-
- LLTextureFetchTester* tester = (LLTextureFetchTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
- if (tester)
- {
- tester->updateStats(logged_state_timers, fetch_time, skipped_states_time, file_size) ;
- }
- }
- }
- else
- {
- worker->lockWorkMutex(); // +Mw
- if ((worker->mDecodedDiscard >= 0) &&
- (worker->mDecodedDiscard < discard_level || discard_level < 0) &&
- (worker->mState >= LLTextureFetchWorker::WAIT_ON_WRITE))
- {
- // Not finished, but data is ready
- discard_level = worker->mDecodedDiscard;
- raw = worker->mRawImage;
- aux = worker->mAuxImage;
- }
- worker->unlockWorkMutex(); // -Mw
- }
- }
- else
- {
- res = true;
- }
- return res;
+ logged_state_timers = worker->mStateTimersMap;
+ skipped_states_time = worker->mSkippedStatesTime;
+ worker->mStateTimer.reset();
+ res = true;
+ LL_DEBUGS(LOG_TXT) << id << ": Request Finished. State: " << worker->mState << " Discard: " << discard_level << LL_ENDL;
+ worker->unlockWorkMutex(); // -Mw
+
+ sample(sTexDecodeLatency, decode_time);
+ sample(sTexFetchLatency, fetch_time);
+ sample(sCacheReadLatency, cache_read_time);
+ sample(sCacheWriteLatency, cache_write_time);
+
+ static LLCachedControl<F32> min_time_to_log(gSavedSettings, "TextureFetchMinTimeToLog", 2.f);
+ if (fetch_time > min_time_to_log)
+ {
+ //LL_INFOS() << "fetch_time: " << fetch_time << " cache_read_time: " << cache_read_time << " decode_time: " << decode_time << " cache_write_time: " << cache_write_time << LL_ENDL;
+
+ LLTextureFetchTester* tester = (LLTextureFetchTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
+ if (tester)
+ {
+ tester->updateStats(logged_state_timers, fetch_time, skipped_states_time, file_size) ;
+ }
+ }
+ }
+ else
+ {
+ worker->lockWorkMutex(); // +Mw
+ if ((worker->mDecodedDiscard >= 0) &&
+ (worker->mDecodedDiscard < discard_level || discard_level < 0) &&
+ (worker->mState >= LLTextureFetchWorker::WAIT_ON_WRITE))
+ {
+ // Not finished, but data is ready
+ discard_level = worker->mDecodedDiscard;
+ raw = worker->mRawImage;
+ aux = worker->mAuxImage;
+ }
+ worker->unlockWorkMutex(); // -Mw
+ }
+ }
+ else
+ {
+ res = true;
+ }
+ return res;
}
// Threads: T*
@@ -2872,13 +2872,13 @@ bool LLTextureFetch::updateRequestPriority(const LLUUID& id, F32 priority)
LLTextureFetchWorker* worker = getWorker(id);
if (worker)
{
- worker->lockWorkMutex(); // +Mw
+ worker->lockWorkMutex(); // +Mw
worker->setImagePriority(priority);
- worker->unlockWorkMutex(); // -Mw
+ worker->unlockWorkMutex(); // -Mw
}
});
-
- return true;
+
+ return true;
}
// Replicates and expands upon the base class's
@@ -2897,14 +2897,14 @@ size_t LLTextureFetch::getPending()
{
LL_PROFILE_ZONE_SCOPED;
size_t res;
- lockData(); // +Ct
+ lockData(); // +Ct
{
- LLMutexLock lock(&mQueueMutex); // +Mfq
-
+ LLMutexLock lock(&mQueueMutex); // +Mfq
+
res = mRequestQueue.size();
res += mCommands.size();
- } // -Mfq
- unlockData(); // -Ct
+ } // -Mfq
+ unlockData(); // -Ct
return res;
}
@@ -2912,24 +2912,24 @@ size_t LLTextureFetch::getPending()
// virtual
bool LLTextureFetch::runCondition()
{
- // Caller is holding the lock on LLThread's condition variable.
-
- // LLQueuedThread, unlike its base class LLThread, makes this a
- // private method which is unfortunate. I want to use it directly
- // but I'm going to have to re-implement the logic here (or change
- // declarations, which I don't want to do right now).
- //
- // Changes here may need to be reflected in getPending().
-
- bool have_no_commands(false);
- {
- LLMutexLock lock(&mQueueMutex); // +Mfq
-
- have_no_commands = mCommands.empty();
- } // -Mfq
-
- return ! (have_no_commands
- && (mRequestQueue.size() == 0 && mIdleThread)); // From base class
+ // Caller is holding the lock on LLThread's condition variable.
+
+ // LLQueuedThread, unlike its base class LLThread, makes this a
+ // private method which is unfortunate. I want to use it directly
+ // but I'm going to have to re-implement the logic here (or change
+ // declarations, which I don't want to do right now).
+ //
+ // Changes here may need to be reflected in getPending().
+
+ bool have_no_commands(false);
+ {
+ LLMutexLock lock(&mQueueMutex); // +Mfq
+
+ have_no_commands = mCommands.empty();
+ } // -Mfq
+
+ return ! (have_no_commands
+ && (mRequestQueue.size() == 0 && mIdleThread)); // From base class
}
//////////////////////////////////////////////////////////////////////////////
@@ -2938,34 +2938,34 @@ bool LLTextureFetch::runCondition()
void LLTextureFetch::commonUpdate()
{
LL_PROFILE_ZONE_SCOPED;
- // Update low/high water levels based on pipelining. We pick
- // up setting eventually, so the semaphore/request level can
- // fall outside the [0..HIGH_WATER] range. Expect that.
- if (LLAppViewer::instance()->getAppCoreHttp().isPipelined(LLAppCoreHttp::AP_TEXTURE))
- {
- mHttpHighWater = HTTP_PIPE_REQUESTS_HIGH_WATER;
- mHttpLowWater = HTTP_PIPE_REQUESTS_LOW_WATER;
- }
- else
- {
- mHttpHighWater = HTTP_NONPIPE_REQUESTS_HIGH_WATER;
- mHttpLowWater = HTTP_NONPIPE_REQUESTS_LOW_WATER;
- }
-
- // Release waiters
- releaseHttpWaiters();
-
- // Run a cross-thread command, if any.
- cmdDoWork();
-
- // Deliver all completion notifications
- LLCore::HttpStatus status = mHttpRequest->update(0);
- if (! status)
- {
- LL_INFOS_ONCE(LOG_TXT) << "Problem during HTTP servicing. Reason: "
- << status.toString()
- << LL_ENDL;
- }
+ // Update low/high water levels based on pipelining. We pick
+ // up setting eventually, so the semaphore/request level can
+ // fall outside the [0..HIGH_WATER] range. Expect that.
+ if (LLAppViewer::instance()->getAppCoreHttp().isPipelined(LLAppCoreHttp::AP_TEXTURE))
+ {
+ mHttpHighWater = HTTP_PIPE_REQUESTS_HIGH_WATER;
+ mHttpLowWater = HTTP_PIPE_REQUESTS_LOW_WATER;
+ }
+ else
+ {
+ mHttpHighWater = HTTP_NONPIPE_REQUESTS_HIGH_WATER;
+ mHttpLowWater = HTTP_NONPIPE_REQUESTS_LOW_WATER;
+ }
+
+ // Release waiters
+ releaseHttpWaiters();
+
+ // Run a cross-thread command, if any.
+ cmdDoWork();
+
+ // Deliver all completion notifications
+ LLCore::HttpStatus status = mHttpRequest->update(0);
+ if (! status)
+ {
+ LL_INFOS_ONCE(LOG_TXT) << "Problem during HTTP servicing. Reason: "
+ << status.toString()
+ << LL_ENDL;
+ }
}
@@ -2975,89 +2975,89 @@ void LLTextureFetch::commonUpdate()
size_t LLTextureFetch::update(F32 max_time_ms)
{
LL_PROFILE_ZONE_SCOPED;
- static LLCachedControl<F32> band_width(gSavedSettings,"ThrottleBandwidthKBPS", 3000.0);
+ static LLCachedControl<F32> band_width(gSavedSettings,"ThrottleBandwidthKBPS", 3000.0);
- {
- mNetworkQueueMutex.lock(); // +Mfnq
- mMaxBandwidth = band_width();
+ {
+ mNetworkQueueMutex.lock(); // +Mfnq
+ mMaxBandwidth = band_width();
- add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, mHTTPTextureBits);
- mHTTPTextureBits = (U32Bits)0;
+ add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, mHTTPTextureBits);
+ mHTTPTextureBits = (U32Bits)0;
- mNetworkQueueMutex.unlock(); // -Mfnq
- }
+ mNetworkQueueMutex.unlock(); // -Mfnq
+ }
- size_t res = LLWorkerThread::update(max_time_ms);
-
- if (!mThreaded)
- {
- commonUpdate();
- }
+ size_t res = LLWorkerThread::update(max_time_ms);
- return res;
+ if (!mThreaded)
+ {
+ commonUpdate();
+ }
+
+ return res;
}
// called in the MAIN thread after the TextureCacheThread shuts down.
//
// Threads: Tmain
-void LLTextureFetch::shutDownTextureCacheThread()
+void LLTextureFetch::shutDownTextureCacheThread()
{
- if(mTextureCache)
- {
- llassert_always(mTextureCache->isQuitting() || mTextureCache->isStopped()) ;
- mTextureCache = NULL ;
- }
+ if(mTextureCache)
+ {
+ llassert_always(mTextureCache->isQuitting() || mTextureCache->isStopped()) ;
+ mTextureCache = NULL ;
+ }
}
-
+
// Threads: Ttf
void LLTextureFetch::startThread()
{
- mTextureInfo.startRecording();
+ mTextureInfo.startRecording();
}
// Threads: Ttf
void LLTextureFetch::endThread()
{
- LL_INFOS(LOG_TXT) << "CacheReads: " << mTotalCacheReadCount
- << ", CacheWrites: " << mTotalCacheWriteCount
- << ", ResWaits: " << mTotalResourceWaitCount
- << ", TotalHTTPReq: " << getTotalNumHTTPRequests()
- << LL_ENDL;
+ LL_INFOS(LOG_TXT) << "CacheReads: " << mTotalCacheReadCount
+ << ", CacheWrites: " << mTotalCacheWriteCount
+ << ", ResWaits: " << mTotalResourceWaitCount
+ << ", TotalHTTPReq: " << getTotalNumHTTPRequests()
+ << LL_ENDL;
- mTextureInfo.stopRecording();
+ mTextureInfo.stopRecording();
}
// Threads: Ttf
void LLTextureFetch::threadedUpdate()
{
LL_PROFILE_ZONE_SCOPED;
- llassert_always(mHttpRequest);
+ llassert_always(mHttpRequest);
#if 0
- // Limit update frequency
- const F32 PROCESS_TIME = 0.05f;
- static LLFrameTimer process_timer;
- if (process_timer.getElapsedTimeF32() < PROCESS_TIME)
- {
- return;
- }
- process_timer.reset();
+ // Limit update frequency
+ const F32 PROCESS_TIME = 0.05f;
+ static LLFrameTimer process_timer;
+ if (process_timer.getElapsedTimeF32() < PROCESS_TIME)
+ {
+ return;
+ }
+ process_timer.reset();
#endif
-
- commonUpdate();
-
+
+ commonUpdate();
+
#if 0
- const F32 INFO_TIME = 1.0f;
- static LLFrameTimer info_timer;
- if (info_timer.getElapsedTimeF32() >= INFO_TIME)
- {
- S32 q = mCurlGetRequest->getQueued();
- if (q > 0)
- {
- LL_INFOS(LOG_TXT) << "Queued gets: " << q << LL_ENDL;
- info_timer.reset();
- }
- }
+ const F32 INFO_TIME = 1.0f;
+ static LLFrameTimer info_timer;
+ if (info_timer.getElapsedTimeF32() >= INFO_TIME)
+ {
+ S32 q = mCurlGetRequest->getQueued();
+ if (q > 0)
+ {
+ LL_INFOS(LOG_TXT) << "Queued gets: " << q << LL_ENDL;
+ info_timer.reset();
+ }
+ }
#endif
}
@@ -3068,63 +3068,63 @@ void LLTextureFetch::threadedUpdate()
bool LLTextureFetchWorker::insertPacket(S32 index, U8* data, S32 size)
{
LL_PROFILE_ZONE_SCOPED;
- mRequestedDeltaTimer.reset();
- if (index >= mTotalPackets)
- {
-// LL_WARNS(LOG_TXT) << "Received Image Packet " << index << " > max: " << mTotalPackets << " for image: " << mID << LL_ENDL;
- return false;
- }
- if (index > 0 && index < mTotalPackets-1 && size != MAX_IMG_PACKET_SIZE)
- {
-// LL_WARNS(LOG_TXT) << "Received bad sized packet: " << index << ", " << size << " != " << MAX_IMG_PACKET_SIZE << " for image: " << mID << LL_ENDL;
- return false;
- }
-
- if (index >= (S32)mPackets.size())
- {
- mPackets.resize(index+1, (PacketData*)NULL); // initializes v to NULL pointers
- }
- else if (mPackets[index] != NULL)
- {
-// LL_WARNS(LOG_TXT) << "Received duplicate packet: " << index << " for image: " << mID << LL_ENDL;
- return false;
- }
-
- mPackets[index] = new PacketData(data, size);
- while (mLastPacket+1 < (S32)mPackets.size() && mPackets[mLastPacket+1] != NULL)
- {
- ++mLastPacket;
- }
- return true;
+ mRequestedDeltaTimer.reset();
+ if (index >= mTotalPackets)
+ {
+// LL_WARNS(LOG_TXT) << "Received Image Packet " << index << " > max: " << mTotalPackets << " for image: " << mID << LL_ENDL;
+ return false;
+ }
+ if (index > 0 && index < mTotalPackets-1 && size != MAX_IMG_PACKET_SIZE)
+ {
+// LL_WARNS(LOG_TXT) << "Received bad sized packet: " << index << ", " << size << " != " << MAX_IMG_PACKET_SIZE << " for image: " << mID << LL_ENDL;
+ return false;
+ }
+
+ if (index >= (S32)mPackets.size())
+ {
+ mPackets.resize(index+1, (PacketData*)NULL); // initializes v to NULL pointers
+ }
+ else if (mPackets[index] != NULL)
+ {
+// LL_WARNS(LOG_TXT) << "Received duplicate packet: " << index << " for image: " << mID << LL_ENDL;
+ return false;
+ }
+
+ mPackets[index] = new PacketData(data, size);
+ while (mLastPacket+1 < (S32)mPackets.size() && mPackets[mLastPacket+1] != NULL)
+ {
+ ++mLastPacket;
+ }
+ return true;
}
void LLTextureFetchWorker::setState(e_state new_state)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (mFTType == FTT_SERVER_BAKE)
- {
- // NOTE: turning on these log statements is a reliable way to get
- // blurry images fairly frequently. Presumably this is an
- // indication of some subtle timing or locking issue.
-
-// LL_INFOS(LOG_TXT) << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << LL_ENDL;
- }
-
- F32 d_time = mStateTimer.getElapsedTimeF32();
- if (d_time >= 0.0001F)
- {
- if (LOGGED_STATES.count(mState))
- {
- mStateTimersMap[mState] = d_time;
- }
- else
- {
- mSkippedStatesTime += d_time;
- }
- }
-
- mStateTimer.reset();
- mState = new_state;
+ if (mFTType == FTT_SERVER_BAKE)
+ {
+ // NOTE: turning on these log statements is a reliable way to get
+ // blurry images fairly frequently. Presumably this is an
+ // indication of some subtle timing or locking issue.
+
+// LL_INFOS(LOG_TXT) << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << LL_ENDL;
+ }
+
+ F32 d_time = mStateTimer.getElapsedTimeF32();
+ if (d_time >= 0.0001F)
+ {
+ if (LOGGED_STATES.count(mState))
+ {
+ mStateTimersMap[mState] = d_time;
+ }
+ else
+ {
+ mSkippedStatesTime += d_time;
+ }
+ }
+
+ mStateTimer.reset();
+ mState = new_state;
}
LLViewerRegion* LLTextureFetchWorker::getRegion()
@@ -3146,17 +3146,17 @@ LLViewerRegion* LLTextureFetchWorker::getRegion()
// Threads: T*
BOOL LLTextureFetch::isFromLocalCache(const LLUUID& id)
{
- BOOL from_cache = FALSE ;
+ BOOL from_cache = FALSE ;
- LLTextureFetchWorker* worker = getWorker(id);
- if (worker)
- {
- worker->lockWorkMutex(); // +Mw
- from_cache = worker->mInLocalCache;
- worker->unlockWorkMutex(); // -Mw
- }
+ LLTextureFetchWorker* worker = getWorker(id);
+ if (worker)
+ {
+ worker->lockWorkMutex(); // +Mw
+ from_cache = worker->mInLocalCache;
+ worker->unlockWorkMutex(); // -Mw
+ }
- return from_cache ;
+ return from_cache ;
}
S32 LLTextureFetch::getFetchState(const LLUUID& id)
@@ -3173,67 +3173,67 @@ S32 LLTextureFetch::getFetchState(const LLUUID& id)
// Threads: T*
S32 LLTextureFetch::getFetchState(const LLUUID& id, F32& data_progress_p, F32& requested_priority_p,
- U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p, bool& can_use_http)
+ U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p, bool& can_use_http)
{
LL_PROFILE_ZONE_SCOPED;
- S32 state = LLTextureFetchWorker::INVALID;
- F32 data_progress = 0.0f;
- F32 requested_priority = 0.0f;
- F32 fetch_dtime = 999999.f;
- F32 request_dtime = 999999.f;
- U32 fetch_priority = 0;
-
- LLTextureFetchWorker* worker = getWorker(id);
- if (worker && worker->haveWork())
- {
- worker->lockWorkMutex(); // +Mw
- state = worker->mState;
- fetch_dtime = worker->mFetchDeltaTimer.getElapsedTimeF32();
- request_dtime = worker->mRequestedDeltaTimer.getElapsedTimeF32();
- if (worker->mFileSize > 0)
- {
- if (worker->mFormattedImage.notNull())
- {
- data_progress = (F32)worker->mFormattedImage->getDataSize() / (F32)worker->mFileSize;
- }
- }
- if (state >= LLTextureFetchWorker::LOAD_FROM_NETWORK && state <= LLTextureFetchWorker::WAIT_HTTP_REQ)
- {
- requested_priority = worker->mRequestedPriority;
- }
- else
- {
- requested_priority = worker->mImagePriority;
- }
- fetch_priority = worker->getImagePriority();
- can_use_http = worker->getCanUseHTTP() ;
- worker->unlockWorkMutex(); // -Mw
- }
- data_progress_p = data_progress;
- requested_priority_p = requested_priority;
- fetch_priority_p = fetch_priority;
- fetch_dtime_p = fetch_dtime;
- request_dtime_p = request_dtime;
- return state;
+ S32 state = LLTextureFetchWorker::INVALID;
+ F32 data_progress = 0.0f;
+ F32 requested_priority = 0.0f;
+ F32 fetch_dtime = 999999.f;
+ F32 request_dtime = 999999.f;
+ U32 fetch_priority = 0;
+
+ LLTextureFetchWorker* worker = getWorker(id);
+ if (worker && worker->haveWork())
+ {
+ worker->lockWorkMutex(); // +Mw
+ state = worker->mState;
+ fetch_dtime = worker->mFetchDeltaTimer.getElapsedTimeF32();
+ request_dtime = worker->mRequestedDeltaTimer.getElapsedTimeF32();
+ if (worker->mFileSize > 0)
+ {
+ if (worker->mFormattedImage.notNull())
+ {
+ data_progress = (F32)worker->mFormattedImage->getDataSize() / (F32)worker->mFileSize;
+ }
+ }
+ if (state >= LLTextureFetchWorker::LOAD_FROM_NETWORK && state <= LLTextureFetchWorker::WAIT_HTTP_REQ)
+ {
+ requested_priority = worker->mRequestedPriority;
+ }
+ else
+ {
+ requested_priority = worker->mImagePriority;
+ }
+ fetch_priority = worker->getImagePriority();
+ can_use_http = worker->getCanUseHTTP() ;
+ worker->unlockWorkMutex(); // -Mw
+ }
+ data_progress_p = data_progress;
+ requested_priority_p = requested_priority;
+ fetch_priority_p = fetch_priority;
+ fetch_dtime_p = fetch_dtime;
+ request_dtime_p = request_dtime;
+ return state;
}
void LLTextureFetch::dump()
{
- LL_INFOS(LOG_TXT) << "LLTextureFetch ACTIVE_HTTP:" << LL_ENDL;
- for (queue_t::const_iterator iter(mHTTPTextureQueue.begin());
- mHTTPTextureQueue.end() != iter;
- ++iter)
- {
- LL_INFOS(LOG_TXT) << " ID: " << (*iter) << LL_ENDL;
- }
+ LL_INFOS(LOG_TXT) << "LLTextureFetch ACTIVE_HTTP:" << LL_ENDL;
+ for (queue_t::const_iterator iter(mHTTPTextureQueue.begin());
+ mHTTPTextureQueue.end() != iter;
+ ++iter)
+ {
+ LL_INFOS(LOG_TXT) << " ID: " << (*iter) << LL_ENDL;
+ }
- LL_INFOS(LOG_TXT) << "LLTextureFetch WAIT_HTTP_RESOURCE:" << LL_ENDL;
- for (wait_http_res_queue_t::const_iterator iter(mHttpWaitResource.begin());
- mHttpWaitResource.end() != iter;
- ++iter)
- {
- LL_INFOS(LOG_TXT) << " ID: " << (*iter) << LL_ENDL;
- }
+ LL_INFOS(LOG_TXT) << "LLTextureFetch WAIT_HTTP_RESOURCE:" << LL_ENDL;
+ for (wait_http_res_queue_t::const_iterator iter(mHttpWaitResource.begin());
+ mHttpWaitResource.end() != iter;
+ ++iter)
+ {
+ LL_INFOS(LOG_TXT) << " ID: " << (*iter) << LL_ENDL;
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -3243,31 +3243,31 @@ void LLTextureFetch::dump()
// Threads: Ttf
void LLTextureFetch::addHttpWaiter(const LLUUID & tid)
{
- mNetworkQueueMutex.lock(); // +Mfnq
- mHttpWaitResource.insert(tid);
- mNetworkQueueMutex.unlock(); // -Mfnq
+ mNetworkQueueMutex.lock(); // +Mfnq
+ mHttpWaitResource.insert(tid);
+ mNetworkQueueMutex.unlock(); // -Mfnq
}
// Threads: Ttf
void LLTextureFetch::removeHttpWaiter(const LLUUID & tid)
{
- mNetworkQueueMutex.lock(); // +Mfnq
- wait_http_res_queue_t::iterator iter(mHttpWaitResource.find(tid));
- if (mHttpWaitResource.end() != iter)
- {
- mHttpWaitResource.erase(iter);
- }
- mNetworkQueueMutex.unlock(); // -Mfnq
+ mNetworkQueueMutex.lock(); // +Mfnq
+ wait_http_res_queue_t::iterator iter(mHttpWaitResource.find(tid));
+ if (mHttpWaitResource.end() != iter)
+ {
+ mHttpWaitResource.erase(iter);
+ }
+ mNetworkQueueMutex.unlock(); // -Mfnq
}
// Threads: T*
bool LLTextureFetch::isHttpWaiter(const LLUUID & tid)
{
- mNetworkQueueMutex.lock(); // +Mfnq
- wait_http_res_queue_t::iterator iter(mHttpWaitResource.find(tid));
- const bool ret(mHttpWaitResource.end() != iter);
- mNetworkQueueMutex.unlock(); // -Mfnq
- return ret;
+ mNetworkQueueMutex.lock(); // +Mfnq
+ wait_http_res_queue_t::iterator iter(mHttpWaitResource.find(tid));
+ const bool ret(mHttpWaitResource.end() != iter);
+ mNetworkQueueMutex.unlock(); // -Mfnq
+ return ret;
}
// Release as many requests as permitted from the WAIT_HTTP_RESOURCE2
@@ -3286,152 +3286,152 @@ bool LLTextureFetch::isHttpWaiter(const LLUUID & tid)
void LLTextureFetch::releaseHttpWaiters()
{
LL_PROFILE_ZONE_SCOPED;
- // Use mHttpSemaphore rather than mHTTPTextureQueue.size()
- // to avoid a lock.
- if (mHttpSemaphore >= mHttpLowWater)
- return;
- S32 needed(mHttpHighWater - mHttpSemaphore);
- if (needed <= 0)
- {
- // Would only happen if High/LowWater were changed behind
- // our back. In that case, defer fill until usage falls within
- // limits.
- return;
- }
-
- // Quickly make a copy of all the LLUIDs. Get off the
- // mutex as early as possible.
- typedef std::vector<LLUUID> uuid_vec_t;
- uuid_vec_t tids;
-
- {
- LLMutexLock lock(&mNetworkQueueMutex); // +Mfnq
-
- if (mHttpWaitResource.empty())
- return;
- tids.reserve(mHttpWaitResource.size());
- tids.assign(mHttpWaitResource.begin(), mHttpWaitResource.end());
- } // -Mfnq
-
- // Now lookup the UUUIDs to find valid requests and sort
- // them in priority order, highest to lowest. We're going
- // to modify priority later as a side-effect of releasing
- // these objects. That, in turn, would violate the partial
- // ordering assumption of std::set, std::map, etc. so we
- // don't use those containers. We use a vector and an explicit
- // sort to keep the containers valid later.
- typedef std::vector<LLTextureFetchWorker *> worker_list_t;
- worker_list_t tids2;
-
- tids2.reserve(tids.size());
- for (uuid_vec_t::iterator iter(tids.begin());
- tids.end() != iter;
- ++iter)
- {
- LLTextureFetchWorker * worker(getWorker(* iter));
- if (worker)
- {
- tids2.push_back(worker);
- }
- else
- {
- // If worker isn't found, this should be due to a request
- // for deletion. We signal our recognition that this
- // uuid shouldn't be used for resource waiting anymore by
- // erasing it from the resource waiter list. That allows
- // deleteOK to do final deletion on the worker.
- removeHttpWaiter(* iter);
- }
- }
- tids.clear();
-
- // Sort into priority order, if necessary and only as much as needed
- if (tids2.size() > needed)
- {
- LLTextureFetchWorker::Compare compare;
- std::partial_sort(tids2.begin(), tids2.begin() + needed, tids2.end(), compare);
- }
-
- // Release workers up to the high water mark. Since we aren't
- // holding any locks at this point, we can be in competition
- // with other callers. Do defensive things like getting
- // refreshed counts of requests and checking if someone else
- // has moved any worker state around....
- for (worker_list_t::iterator iter2(tids2.begin()); tids2.end() != iter2; ++iter2)
- {
- LLTextureFetchWorker * worker(* iter2);
-
- worker->lockWorkMutex(); // +Mw
- if (LLTextureFetchWorker::WAIT_HTTP_RESOURCE2 != worker->mState)
- {
- // Not in expected state, remove it, try the next one
- worker->unlockWorkMutex(); // -Mw
- LL_WARNS(LOG_TXT) << "Resource-waited texture " << worker->mID
- << " in unexpected state: " << worker->mState
- << ". Removing from wait list."
- << LL_ENDL;
- removeHttpWaiter(worker->mID);
- continue;
- }
-
- if (! worker->acquireHttpSemaphore())
- {
- // Out of active slots, quit
- worker->unlockWorkMutex(); // -Mw
- break;
- }
-
- worker->setState(LLTextureFetchWorker::SEND_HTTP_REQ);
- worker->unlockWorkMutex(); // -Mw
-
- removeHttpWaiter(worker->mID);
- }
+ // Use mHttpSemaphore rather than mHTTPTextureQueue.size()
+ // to avoid a lock.
+ if (mHttpSemaphore >= mHttpLowWater)
+ return;
+ S32 needed(mHttpHighWater - mHttpSemaphore);
+ if (needed <= 0)
+ {
+ // Would only happen if High/LowWater were changed behind
+ // our back. In that case, defer fill until usage falls within
+ // limits.
+ return;
+ }
+
+ // Quickly make a copy of all the LLUIDs. Get off the
+ // mutex as early as possible.
+ typedef std::vector<LLUUID> uuid_vec_t;
+ uuid_vec_t tids;
+
+ {
+ LLMutexLock lock(&mNetworkQueueMutex); // +Mfnq
+
+ if (mHttpWaitResource.empty())
+ return;
+ tids.reserve(mHttpWaitResource.size());
+ tids.assign(mHttpWaitResource.begin(), mHttpWaitResource.end());
+ } // -Mfnq
+
+ // Now lookup the UUUIDs to find valid requests and sort
+ // them in priority order, highest to lowest. We're going
+ // to modify priority later as a side-effect of releasing
+ // these objects. That, in turn, would violate the partial
+ // ordering assumption of std::set, std::map, etc. so we
+ // don't use those containers. We use a vector and an explicit
+ // sort to keep the containers valid later.
+ typedef std::vector<LLTextureFetchWorker *> worker_list_t;
+ worker_list_t tids2;
+
+ tids2.reserve(tids.size());
+ for (uuid_vec_t::iterator iter(tids.begin());
+ tids.end() != iter;
+ ++iter)
+ {
+ LLTextureFetchWorker * worker(getWorker(* iter));
+ if (worker)
+ {
+ tids2.push_back(worker);
+ }
+ else
+ {
+ // If worker isn't found, this should be due to a request
+ // for deletion. We signal our recognition that this
+ // uuid shouldn't be used for resource waiting anymore by
+ // erasing it from the resource waiter list. That allows
+ // deleteOK to do final deletion on the worker.
+ removeHttpWaiter(* iter);
+ }
+ }
+ tids.clear();
+
+ // Sort into priority order, if necessary and only as much as needed
+ if (tids2.size() > needed)
+ {
+ LLTextureFetchWorker::Compare compare;
+ std::partial_sort(tids2.begin(), tids2.begin() + needed, tids2.end(), compare);
+ }
+
+ // Release workers up to the high water mark. Since we aren't
+ // holding any locks at this point, we can be in competition
+ // with other callers. Do defensive things like getting
+ // refreshed counts of requests and checking if someone else
+ // has moved any worker state around....
+ for (worker_list_t::iterator iter2(tids2.begin()); tids2.end() != iter2; ++iter2)
+ {
+ LLTextureFetchWorker * worker(* iter2);
+
+ worker->lockWorkMutex(); // +Mw
+ if (LLTextureFetchWorker::WAIT_HTTP_RESOURCE2 != worker->mState)
+ {
+ // Not in expected state, remove it, try the next one
+ worker->unlockWorkMutex(); // -Mw
+ LL_WARNS(LOG_TXT) << "Resource-waited texture " << worker->mID
+ << " in unexpected state: " << worker->mState
+ << ". Removing from wait list."
+ << LL_ENDL;
+ removeHttpWaiter(worker->mID);
+ continue;
+ }
+
+ if (! worker->acquireHttpSemaphore())
+ {
+ // Out of active slots, quit
+ worker->unlockWorkMutex(); // -Mw
+ break;
+ }
+
+ worker->setState(LLTextureFetchWorker::SEND_HTTP_REQ);
+ worker->unlockWorkMutex(); // -Mw
+
+ removeHttpWaiter(worker->mID);
+ }
}
// Threads: T*
void LLTextureFetch::cancelHttpWaiters()
{
- mNetworkQueueMutex.lock(); // +Mfnq
- mHttpWaitResource.clear();
- mNetworkQueueMutex.unlock(); // -Mfnq
+ mNetworkQueueMutex.lock(); // +Mfnq
+ mHttpWaitResource.clear();
+ mNetworkQueueMutex.unlock(); // -Mfnq
}
// Threads: T*
int LLTextureFetch::getHttpWaitersCount()
{
- mNetworkQueueMutex.lock(); // +Mfnq
- int ret(mHttpWaitResource.size());
- mNetworkQueueMutex.unlock(); // -Mfnq
- return ret;
+ mNetworkQueueMutex.lock(); // +Mfnq
+ int ret(mHttpWaitResource.size());
+ mNetworkQueueMutex.unlock(); // -Mfnq
+ return ret;
}
// Threads: T*
void LLTextureFetch::updateStateStats(U32 cache_read, U32 cache_write, U32 res_wait)
{
- LLMutexLock lock(&mQueueMutex); // +Mfq
+ LLMutexLock lock(&mQueueMutex); // +Mfq
- mTotalCacheReadCount += cache_read;
- mTotalCacheWriteCount += cache_write;
- mTotalResourceWaitCount += res_wait;
-} // -Mfq
+ mTotalCacheReadCount += cache_read;
+ mTotalCacheWriteCount += cache_write;
+ mTotalResourceWaitCount += res_wait;
+} // -Mfq
// Threads: T*
void LLTextureFetch::getStateStats(U32 * cache_read, U32 * cache_write, U32 * res_wait)
{
- U32 ret1(0U), ret2(0U), ret3(0U);
-
- {
- LLMutexLock lock(&mQueueMutex); // +Mfq
- ret1 = mTotalCacheReadCount;
- ret2 = mTotalCacheWriteCount;
- ret3 = mTotalResourceWaitCount;
- } // -Mfq
-
- *cache_read = ret1;
- *cache_write = ret2;
- *res_wait = ret3;
+ U32 ret1(0U), ret2(0U), ret3(0U);
+
+ {
+ LLMutexLock lock(&mQueueMutex); // +Mfq
+ ret1 = mTotalCacheReadCount;
+ ret2 = mTotalCacheWriteCount;
+ ret3 = mTotalResourceWaitCount;
+ } // -Mfq
+
+ *cache_read = ret1;
+ *cache_write = ret2;
+ *res_wait = ret3;
}
//////////////////////////////////////////////////////////////////////////////
@@ -3441,77 +3441,77 @@ void LLTextureFetch::getStateStats(U32 * cache_read, U32 * cache_write, U32 * re
// Threads: T*
void LLTextureFetch::commandSetRegion(U64 region_handle)
{
- TFReqSetRegion * req = new TFReqSetRegion(region_handle);
+ TFReqSetRegion * req = new TFReqSetRegion(region_handle);
- cmdEnqueue(req);
+ cmdEnqueue(req);
}
// Threads: T*
void LLTextureFetch::commandSendMetrics(const std::string & caps_url,
- const LLUUID & session_id,
- const LLUUID & agent_id,
- LLSD& stats_sd)
+ const LLUUID & session_id,
+ const LLUUID & agent_id,
+ LLSD& stats_sd)
{
- TFReqSendMetrics * req = new TFReqSendMetrics(caps_url, session_id, agent_id, stats_sd);
+ TFReqSendMetrics * req = new TFReqSendMetrics(caps_url, session_id, agent_id, stats_sd);
- cmdEnqueue(req);
+ cmdEnqueue(req);
}
// Threads: T*
void LLTextureFetch::commandDataBreak()
{
- // The pedantically correct way to implement this is to create a command
- // request object in the above fashion and enqueue it. However, this is
- // simple data of an advisorial not operational nature and this case
- // of shared-write access is tolerable.
+ // The pedantically correct way to implement this is to create a command
+ // request object in the above fashion and enqueue it. However, this is
+ // simple data of an advisorial not operational nature and this case
+ // of shared-write access is tolerable.
- LLTextureFetch::svMetricsDataBreak = true;
+ LLTextureFetch::svMetricsDataBreak = true;
}
// Threads: T*
void LLTextureFetch::cmdEnqueue(TFRequest * req)
{
LL_PROFILE_ZONE_SCOPED;
- lockQueue(); // +Mfq
- mCommands.push_back(req);
- unlockQueue(); // -Mfq
+ lockQueue(); // +Mfq
+ mCommands.push_back(req);
+ unlockQueue(); // -Mfq
- unpause();
+ unpause();
}
// Threads: T*
LLTextureFetch::TFRequest * LLTextureFetch::cmdDequeue()
{
LL_PROFILE_ZONE_SCOPED;
- TFRequest * ret = 0;
-
- lockQueue(); // +Mfq
- if (! mCommands.empty())
- {
- ret = mCommands.front();
- mCommands.erase(mCommands.begin());
- }
- unlockQueue(); // -Mfq
+ TFRequest * ret = 0;
- return ret;
+ lockQueue(); // +Mfq
+ if (! mCommands.empty())
+ {
+ ret = mCommands.front();
+ mCommands.erase(mCommands.begin());
+ }
+ unlockQueue(); // -Mfq
+
+ return ret;
}
// Threads: Ttf
void LLTextureFetch::cmdDoWork()
{
LL_PROFILE_ZONE_SCOPED;
- if (mDebugPause)
- {
- return; // debug: don't do any work
- }
+ if (mDebugPause)
+ {
+ return; // debug: don't do any work
+ }
- TFRequest * req = cmdDequeue();
- if (req)
- {
- // One request per pass should really be enough for this.
- req->doWork(this);
- delete req;
- }
+ TFRequest * req = cmdDequeue();
+ if (req)
+ {
+ // One request per pass should really be enough for this.
+ req->doWork(this);
+ delete req;
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -3531,23 +3531,23 @@ class AssetReportHandler : public LLCore::HttpHandler
{
public:
- // Threads: Ttf
- virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response)
- {
- LLCore::HttpStatus status(response->getStatus());
-
- if (status)
- {
- LL_DEBUGS(LOG_TXT) << "Successfully delivered asset metrics to grid."
- << LL_ENDL;
- }
- else
- {
- LL_WARNS(LOG_TXT) << "Error delivering asset metrics to grid. Status: "
- << status.toTerseString()
- << ", Reason: " << status.toString() << LL_ENDL;
- }
- }
+ // Threads: Ttf
+ virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response)
+ {
+ LLCore::HttpStatus status(response->getStatus());
+
+ if (status)
+ {
+ LL_DEBUGS(LOG_TXT) << "Successfully delivered asset metrics to grid."
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS(LOG_TXT) << "Error delivering asset metrics to grid. Status: "
+ << status.toTerseString()
+ << ", Reason: " << status.toString() << LL_ENDL;
+ }
+ }
}; // end class AssetReportHandler
/**
@@ -3558,9 +3558,9 @@ public:
bool
TFReqSetRegion::doWork(LLTextureFetch *)
{
- LLViewerAssetStatsFF::set_region(mRegionHandle);
+ LLViewerAssetStatsFF::set_region(mRegionHandle);
- return true;
+ return true;
}
TFReqSendMetrics::TFReqSendMetrics(const std::string & caps_url,
@@ -3591,143 +3591,143 @@ bool
TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
{
LL_PROFILE_ZONE_SCOPED;
-
- //if (! gViewerAssetStatsThread1)
- // return true;
- static volatile bool reporting_started(false);
- static volatile S32 report_sequence(0);
-
- // In mStatsSD, we have a copy we own of the LLSD representation
- // of the asset stats. Add some additional fields and ship it off.
+ //if (! gViewerAssetStatsThread1)
+ // return true;
+
+ static volatile bool reporting_started(false);
+ static volatile S32 report_sequence(0);
+
+ // In mStatsSD, we have a copy we own of the LLSD representation
+ // of the asset stats. Add some additional fields and ship it off.
static const S32 metrics_data_version = 2;
-
- bool initial_report = !reporting_started;
- mStatsSD["session_id"] = mSessionID;
- mStatsSD["agent_id"] = mAgentID;
- mStatsSD["message"] = "ViewerAssetMetrics";
- mStatsSD["sequence"] = report_sequence;
- mStatsSD["initial"] = initial_report;
- mStatsSD["version"] = metrics_data_version;
- mStatsSD["break"] = static_cast<bool>(LLTextureFetch::svMetricsDataBreak);
-
- // Update sequence number
- if (S32_MAX == ++report_sequence)
- {
- report_sequence = 0;
- }
- reporting_started = true;
-
- // Limit the size of the stats report if necessary.
-
- mStatsSD["truncated"] = truncate_viewer_metrics(10, mStatsSD);
+
+ bool initial_report = !reporting_started;
+ mStatsSD["session_id"] = mSessionID;
+ mStatsSD["agent_id"] = mAgentID;
+ mStatsSD["message"] = "ViewerAssetMetrics";
+ mStatsSD["sequence"] = report_sequence;
+ mStatsSD["initial"] = initial_report;
+ mStatsSD["version"] = metrics_data_version;
+ mStatsSD["break"] = static_cast<bool>(LLTextureFetch::svMetricsDataBreak);
+
+ // Update sequence number
+ if (S32_MAX == ++report_sequence)
+ {
+ report_sequence = 0;
+ }
+ reporting_started = true;
+
+ // Limit the size of the stats report if necessary.
+
+ mStatsSD["truncated"] = truncate_viewer_metrics(10, mStatsSD);
if (gSavedSettings.getBOOL("QAModeMetrics"))
{
dump_sequential_xml("metric_asset_stats",mStatsSD);
}
-
- if (! mCapsURL.empty())
- {
- // Don't care about handle, this is a fire-and-forget operation.
- LLCoreHttpUtil::requestPostWithLLSD(&fetcher->getHttpRequest(),
- fetcher->getMetricsPolicyClass(),
- mCapsURL,
- mStatsSD,
- LLCore::HttpOptions::ptr_t(),
- fetcher->getMetricsHeaders(),
- mHandler);
- LLTextureFetch::svMetricsDataBreak = false;
- }
- else
- {
- LLTextureFetch::svMetricsDataBreak = true;
- }
-
- // In QA mode, Metrics submode, log the result for ease of testing
- if (fetcher->isQAMode())
- {
- LL_INFOS(LOG_TXT) << "ViewerAssetMetrics as submitted\n" << ll_pretty_print_sd(mStatsSD) << LL_ENDL;
- }
-
- return true;
+
+ if (! mCapsURL.empty())
+ {
+ // Don't care about handle, this is a fire-and-forget operation.
+ LLCoreHttpUtil::requestPostWithLLSD(&fetcher->getHttpRequest(),
+ fetcher->getMetricsPolicyClass(),
+ mCapsURL,
+ mStatsSD,
+ LLCore::HttpOptions::ptr_t(),
+ fetcher->getMetricsHeaders(),
+ mHandler);
+ LLTextureFetch::svMetricsDataBreak = false;
+ }
+ else
+ {
+ LLTextureFetch::svMetricsDataBreak = true;
+ }
+
+ // In QA mode, Metrics submode, log the result for ease of testing
+ if (fetcher->isQAMode())
+ {
+ LL_INFOS(LOG_TXT) << "ViewerAssetMetrics as submitted\n" << ll_pretty_print_sd(mStatsSD) << LL_ENDL;
+ }
+
+ return true;
}
bool
truncate_viewer_metrics(int max_regions, LLSD & metrics)
{
- static const LLSD::String reg_tag("regions");
- static const LLSD::String duration_tag("duration");
-
- LLSD & reg_map(metrics[reg_tag]);
- if (reg_map.size() <= max_regions)
- {
- return false;
- }
-
- // Build map of region hashes ordered by duration
- typedef std::multimap<LLSD::Real, int> reg_ordered_list_t;
- reg_ordered_list_t regions_by_duration;
-
- int ind(0);
- LLSD::array_const_iterator it_end(reg_map.endArray());
- for (LLSD::array_const_iterator it(reg_map.beginArray()); it_end != it; ++it, ++ind)
- {
- LLSD::Real duration = (*it)[duration_tag].asReal();
- regions_by_duration.insert(reg_ordered_list_t::value_type(duration, ind));
- }
-
- // Build a replacement regions array with the longest-persistence regions
- LLSD new_region(LLSD::emptyArray());
- reg_ordered_list_t::const_reverse_iterator it2_end(regions_by_duration.rend());
- reg_ordered_list_t::const_reverse_iterator it2(regions_by_duration.rbegin());
- for (int i(0); i < max_regions && it2_end != it2; ++i, ++it2)
- {
- new_region.append(reg_map[it2->second]);
- }
- reg_map = new_region;
-
- return true;
+ static const LLSD::String reg_tag("regions");
+ static const LLSD::String duration_tag("duration");
+
+ LLSD & reg_map(metrics[reg_tag]);
+ if (reg_map.size() <= max_regions)
+ {
+ return false;
+ }
+
+ // Build map of region hashes ordered by duration
+ typedef std::multimap<LLSD::Real, int> reg_ordered_list_t;
+ reg_ordered_list_t regions_by_duration;
+
+ int ind(0);
+ LLSD::array_const_iterator it_end(reg_map.endArray());
+ for (LLSD::array_const_iterator it(reg_map.beginArray()); it_end != it; ++it, ++ind)
+ {
+ LLSD::Real duration = (*it)[duration_tag].asReal();
+ regions_by_duration.insert(reg_ordered_list_t::value_type(duration, ind));
+ }
+
+ // Build a replacement regions array with the longest-persistence regions
+ LLSD new_region(LLSD::emptyArray());
+ reg_ordered_list_t::const_reverse_iterator it2_end(regions_by_duration.rend());
+ reg_ordered_list_t::const_reverse_iterator it2(regions_by_duration.rbegin());
+ for (int i(0); i < max_regions && it2_end != it2; ++i, ++it2)
+ {
+ new_region.append(reg_map[it2->second]);
+ }
+ reg_map = new_region;
+
+ return true;
}
} // end of anonymous namespace
-LLTextureFetchTester::LLTextureFetchTester() : LLMetricPerformanceTesterBasic(sTesterName)
+LLTextureFetchTester::LLTextureFetchTester() : LLMetricPerformanceTesterBasic(sTesterName)
{
- mTextureFetchTime = 0;
- mSkippedStatesTime = 0;
- mFileSize = 0;
+ mTextureFetchTime = 0;
+ mSkippedStatesTime = 0;
+ mFileSize = 0;
}
LLTextureFetchTester::~LLTextureFetchTester()
{
- outputTestResults();
- LLTextureFetch::sTesterp = NULL;
+ outputTestResults();
+ LLTextureFetch::sTesterp = NULL;
}
-//virtual
-void LLTextureFetchTester::outputTestRecord(LLSD *sd)
-{
- std::string currentLabel = getCurrentLabelName();
+//virtual
+void LLTextureFetchTester::outputTestRecord(LLSD *sd)
+{
+ std::string currentLabel = getCurrentLabelName();
- (*sd)[currentLabel]["Texture Fetch Time"] = (LLSD::Real)mTextureFetchTime;
- (*sd)[currentLabel]["File Size"] = (LLSD::Integer)mFileSize;
- (*sd)[currentLabel]["Skipped States Time"] = (LLSD::String)llformat("%.6f", mSkippedStatesTime);
+ (*sd)[currentLabel]["Texture Fetch Time"] = (LLSD::Real)mTextureFetchTime;
+ (*sd)[currentLabel]["File Size"] = (LLSD::Integer)mFileSize;
+ (*sd)[currentLabel]["Skipped States Time"] = (LLSD::String)llformat("%.6f", mSkippedStatesTime);
- for(auto i : LOGGED_STATES)
- {
- (*sd)[currentLabel][sStateDescs[i]] = mStateTimersMap[i];
- }
+ for(auto i : LOGGED_STATES)
+ {
+ (*sd)[currentLabel][sStateDescs[i]] = mStateTimersMap[i];
+ }
}
void LLTextureFetchTester::updateStats(const std::map<S32, F32> state_timers, const F32 fetch_time, const F32 skipped_states_time, const S32 file_size)
{
- mTextureFetchTime = fetch_time;
- mStateTimersMap = state_timers;
- mFileSize = file_size;
- mSkippedStatesTime = skipped_states_time;
- outputTestResults();
+ mTextureFetchTime = fetch_time;
+ mStateTimersMap = state_timers;
+ mFileSize = file_size;
+ mSkippedStatesTime = skipped_states_time;
+ outputTestResults();
}
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index 9ff6468bb2..b72ecc2a65 100644
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexturefetch.h
* @brief Object for managing texture fetches.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012-2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,354 +55,354 @@ class LLTextureFetchTester;
class LLTextureFetch : public LLWorkerThread
{
- friend class LLTextureFetchWorker;
-
+ friend class LLTextureFetchWorker;
+
public:
static std::string getStateString(S32 state);
- LLTextureFetch(LLTextureCache* cache, bool threaded, bool qa_mode);
- ~LLTextureFetch();
+ LLTextureFetch(LLTextureCache* cache, bool threaded, bool qa_mode);
+ ~LLTextureFetch();
+
+ class TFRequest;
- class TFRequest;
-
// Threads: Tmain
- /*virtual*/ size_t update(F32 max_time_ms);
-
- // called in the main thread after the TextureCacheThread shuts down.
+ /*virtual*/ size_t update(F32 max_time_ms);
+
+ // called in the main thread after the TextureCacheThread shuts down.
// Threads: Tmain
- void shutDownTextureCacheThread();
+ void shutDownTextureCacheThread();
- //called in the main thread after the ImageDecodeThread shuts down.
+ //called in the main thread after the ImageDecodeThread shuts down.
// Threads: Tmain
- void shutDownImageDecodeThread();
-
- // Threads: T* (but Tmain mostly)
- S32 createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority,
- S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool can_use_http);
-
- // Requests that a fetch operation be deleted from the queue.
- // If @cancel is true, also stops any I/O operations pending.
- // Actual delete will be scheduled and performed later.
- //
- // Note: This *looks* like an override/variant of the
- // base class's deleteRequest() but is functionally quite
- // different.
- //
- // Threads: T*
- void deleteRequest(const LLUUID& id, bool cancel);
-
- void deleteAllRequests();
-
- // Threads: T*
- // keep in mind that if fetcher isn't done, it still might need original raw image
- bool getRequestFinished(const LLUUID& id, S32& discard_level,
- LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux,
- LLCore::HttpStatus& last_http_get_status);
-
- // Threads: T*
- bool updateRequestPriority(const LLUUID& id, F32 priority);
+ void shutDownImageDecodeThread();
+
+ // Threads: T* (but Tmain mostly)
+ S32 createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority,
+ S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool can_use_http);
+
+ // Requests that a fetch operation be deleted from the queue.
+ // If @cancel is true, also stops any I/O operations pending.
+ // Actual delete will be scheduled and performed later.
+ //
+ // Note: This *looks* like an override/variant of the
+ // base class's deleteRequest() but is functionally quite
+ // different.
+ //
+ // Threads: T*
+ void deleteRequest(const LLUUID& id, bool cancel);
+
+ void deleteAllRequests();
+
+ // Threads: T*
+ // keep in mind that if fetcher isn't done, it still might need original raw image
+ bool getRequestFinished(const LLUUID& id, S32& discard_level,
+ LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux,
+ LLCore::HttpStatus& last_http_get_status);
+
+ // Threads: T*
+ bool updateRequestPriority(const LLUUID& id, F32 priority);
// Threads: T* (but not safe)
- void setTextureBandwidth(F32 bandwidth) { mTextureBandwidth = bandwidth; }
-
+ void setTextureBandwidth(F32 bandwidth) { mTextureBandwidth = bandwidth; }
+
// Threads: T* (but not safe)
- F32 getTextureBandwidth() { return mTextureBandwidth; }
-
+ F32 getTextureBandwidth() { return mTextureBandwidth; }
+
// Threads: T*
- BOOL isFromLocalCache(const LLUUID& id);
+ BOOL isFromLocalCache(const LLUUID& id);
// get the current fetch state, if any, from the given UUID
S32 getFetchState(const LLUUID& id);
- // @return Fetch state of given image and associates statistics
- // See also getStateString
+ // @return Fetch state of given image and associates statistics
+ // See also getStateString
// Threads: T*
- S32 getFetchState(const LLUUID& id, F32& decode_progress_p, F32& requested_priority_p,
- U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p, bool& can_use_http);
+ S32 getFetchState(const LLUUID& id, F32& decode_progress_p, F32& requested_priority_p,
+ U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p, bool& can_use_http);
- // Debug utility - generally not safe
- void dump();
+ // Debug utility - generally not safe
+ void dump();
- // Threads: T*
- S32 getNumRequests();
+ // Threads: T*
+ S32 getNumRequests();
- // Threads: T*
- S32 getNumHTTPRequests();
+ // Threads: T*
+ S32 getNumHTTPRequests();
+
+ // Threads: T*
+ U32 getTotalNumHTTPRequests();
- // Threads: T*
- U32 getTotalNumHTTPRequests();
-
// Threads: T*
size_t getPending();
// Threads: T*
- void lockQueue() { mQueueMutex.lock(); }
+ void lockQueue() { mQueueMutex.lock(); }
+
+ // Threads: T*
+ void unlockQueue() { mQueueMutex.unlock(); }
// Threads: T*
- void unlockQueue() { mQueueMutex.unlock(); }
+ LLTextureFetchWorker* getWorker(const LLUUID& id);
- // Threads: T*
- LLTextureFetchWorker* getWorker(const LLUUID& id);
-
- // Threads: T*
- // Locks: Mfq
- LLTextureFetchWorker* getWorkerAfterLock(const LLUUID& id);
+ // Threads: T*
+ // Locks: Mfq
+ LLTextureFetchWorker* getWorkerAfterLock(const LLUUID& id);
- // Commands available to other threads to control metrics gathering operations.
+ // Commands available to other threads to control metrics gathering operations.
- // Threads: T*
- void commandSetRegion(U64 region_handle);
+ // Threads: T*
+ void commandSetRegion(U64 region_handle);
+
+ // Threads: T*
+ void commandSendMetrics(const std::string & caps_url,
+ const LLUUID & session_id,
+ const LLUUID & agent_id,
+ LLSD& stats_sd);
- // Threads: T*
- void commandSendMetrics(const std::string & caps_url,
- const LLUUID & session_id,
- const LLUUID & agent_id,
- LLSD& stats_sd);
+ // Threads: T*
+ void commandDataBreak();
- // Threads: T*
- void commandDataBreak();
+ // Threads: T*
+ LLCore::HttpRequest & getHttpRequest() { return *mHttpRequest; }
- // Threads: T*
- LLCore::HttpRequest & getHttpRequest() { return *mHttpRequest; }
+ // Threads: T*
+ LLCore::HttpRequest::policy_t getPolicyClass() const { return mHttpPolicyClass; }
- // Threads: T*
- LLCore::HttpRequest::policy_t getPolicyClass() const { return mHttpPolicyClass; }
-
- // Return a pointer to the shared metrics headers definition.
- // Does not increment the reference count, caller is required
- // to do that to hold a reference for any length of time.
- //
- // Threads: T*
- LLCore::HttpHeaders::ptr_t getMetricsHeaders() const { return mHttpMetricsHeaders; }
+ // Return a pointer to the shared metrics headers definition.
+ // Does not increment the reference count, caller is required
+ // to do that to hold a reference for any length of time.
+ //
+ // Threads: T*
+ LLCore::HttpHeaders::ptr_t getMetricsHeaders() const { return mHttpMetricsHeaders; }
- // Threads: T*
- LLCore::HttpRequest::policy_t getMetricsPolicyClass() const { return mHttpMetricsPolicyClass; }
+ // Threads: T*
+ LLCore::HttpRequest::policy_t getMetricsPolicyClass() const { return mHttpMetricsPolicyClass; }
- bool isQAMode() const { return mQAMode; }
+ bool isQAMode() const { return mQAMode; }
- // ----------------------------------
- // HTTP resource waiting methods
+ // ----------------------------------
+ // HTTP resource waiting methods
// Threads: T*
- void addHttpWaiter(const LLUUID & tid);
+ void addHttpWaiter(const LLUUID & tid);
// Threads: T*
- void removeHttpWaiter(const LLUUID & tid);
+ void removeHttpWaiter(const LLUUID & tid);
// Threads: T*
- bool isHttpWaiter(const LLUUID & tid);
-
- // If there are slots, release one or more LLTextureFetchWorker
- // requests from resource wait state (WAIT_HTTP_RESOURCE) to
- // active (SEND_HTTP_REQ).
- //
- // Because this will modify state of many workers, you may not
- // hold any Mw lock while calling. This makes it a little
- // inconvenient to use but that's the rule.
- //
+ bool isHttpWaiter(const LLUUID & tid);
+
+ // If there are slots, release one or more LLTextureFetchWorker
+ // requests from resource wait state (WAIT_HTTP_RESOURCE) to
+ // active (SEND_HTTP_REQ).
+ //
+ // Because this will modify state of many workers, you may not
+ // hold any Mw lock while calling. This makes it a little
+ // inconvenient to use but that's the rule.
+ //
// Threads: T*
- // Locks: -Mw (must not hold any worker when called)
- void releaseHttpWaiters();
+ // Locks: -Mw (must not hold any worker when called)
+ void releaseHttpWaiters();
// Threads: T*
- void cancelHttpWaiters();
+ void cancelHttpWaiters();
// Threads: T*
- int getHttpWaitersCount();
- // ----------------------------------
- // Stats management
+ int getHttpWaitersCount();
+ // ----------------------------------
+ // Stats management
- // Add given counts to the global totals for the states/requests
- // Threads: T*
- void updateStateStats(U32 cache_read, U32 cache_write, U32 res_wait);
+ // Add given counts to the global totals for the states/requests
+ // Threads: T*
+ void updateStateStats(U32 cache_read, U32 cache_write, U32 res_wait);
+
+ // Return the global counts
+ // Threads: T*
+ void getStateStats(U32 * cache_read, U32 * cache_write, U32 * res_wait);
- // Return the global counts
- // Threads: T*
- void getStateStats(U32 * cache_read, U32 * cache_write, U32 * res_wait);
+ // ----------------------------------
- // ----------------------------------
-
protected:
// Threads: T*
- void addToHTTPQueue(const LLUUID& id);
+ void addToHTTPQueue(const LLUUID& id);
+
+ // XXX possible delete
+ // Threads: T*
+ void removeFromHTTPQueue(const LLUUID& id, S32Bytes received_size);
- // XXX possible delete
+ // Identical to @deleteRequest but with different arguments
+ // (caller already has the worker pointer).
+ //
// Threads: T*
- void removeFromHTTPQueue(const LLUUID& id, S32Bytes received_size);
-
- // Identical to @deleteRequest but with different arguments
- // (caller already has the worker pointer).
- //
- // Threads: T*
- void removeRequest(LLTextureFetchWorker* worker, bool cancel);
-
- // Overrides from the LLThread tree
- // Locks: Ct
- bool runCondition();
+ void removeRequest(LLTextureFetchWorker* worker, bool cancel);
+
+ // Overrides from the LLThread tree
+ // Locks: Ct
+ bool runCondition();
private:
- // Threads: Ttf
- /*virtual*/ void startThread(void);
-
- // Threads: Ttf
- /*virtual*/ void endThread(void);
-
- // Threads: Ttf
- /*virtual*/ void threadedUpdate(void);
-
- // Threads: Ttf
- void commonUpdate();
-
- // Metrics command helpers
- /**
- * Enqueues a command request at the end of the command queue
- * and wakes up the thread as needed.
- *
- * Takes ownership of the TFRequest object.
- *
- * Method locks the command queue.
- *
- * Threads: T*
- */
- void cmdEnqueue(TFRequest *);
-
- /**
- * Returns the first TFRequest object in the command queue or
- * NULL if none is present.
- *
- * Caller acquires ownership of the object and must dispose of it.
- *
- * Method locks the command queue.
- *
- * Threads: T*
- */
- TFRequest * cmdDequeue();
-
- /**
- * Processes the first command in the queue disposing of the
- * request on completion. Successive calls are needed to perform
- * additional commands.
- *
- * Method locks the command queue.
- *
- * Threads: Ttf
- */
- void cmdDoWork();
-
+ // Threads: Ttf
+ /*virtual*/ void startThread(void);
+
+ // Threads: Ttf
+ /*virtual*/ void endThread(void);
+
+ // Threads: Ttf
+ /*virtual*/ void threadedUpdate(void);
+
+ // Threads: Ttf
+ void commonUpdate();
+
+ // Metrics command helpers
+ /**
+ * Enqueues a command request at the end of the command queue
+ * and wakes up the thread as needed.
+ *
+ * Takes ownership of the TFRequest object.
+ *
+ * Method locks the command queue.
+ *
+ * Threads: T*
+ */
+ void cmdEnqueue(TFRequest *);
+
+ /**
+ * Returns the first TFRequest object in the command queue or
+ * NULL if none is present.
+ *
+ * Caller acquires ownership of the object and must dispose of it.
+ *
+ * Method locks the command queue.
+ *
+ * Threads: T*
+ */
+ TFRequest * cmdDequeue();
+
+ /**
+ * Processes the first command in the queue disposing of the
+ * request on completion. Successive calls are needed to perform
+ * additional commands.
+ *
+ * Method locks the command queue.
+ *
+ * Threads: Ttf
+ */
+ void cmdDoWork();
+
public:
- LLUUID mDebugID;
- S32 mDebugCount;
- BOOL mDebugPause;
- S32 mPacketCount;
- S32 mBadPacketCount;
-
+ LLUUID mDebugID;
+ S32 mDebugCount;
+ BOOL mDebugPause;
+ S32 mPacketCount;
+ S32 mBadPacketCount;
+
static LLTrace::CountStatHandle<F64> sCacheHit;
static LLTrace::CountStatHandle<F64> sCacheAttempt;
static LLTrace::SampleStatHandle<F32Seconds> sCacheReadLatency;
static LLTrace::SampleStatHandle<F32Seconds> sTexDecodeLatency;
- static LLTrace::SampleStatHandle<F32Seconds> sCacheWriteLatency;
+ static LLTrace::SampleStatHandle<F32Seconds> sCacheWriteLatency;
static LLTrace::SampleStatHandle<F32Seconds> sTexFetchLatency;
static LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > sCacheHitRate;
private:
- LLMutex mQueueMutex; //to protect mRequestMap and mCommands only
- LLMutex mNetworkQueueMutex; //to protect mHTTPTextureQueue
-
- LLTextureCache* mTextureCache;
-
- // Map of all requests by UUID
- typedef std::map<LLUUID,LLTextureFetchWorker*> map_t;
- map_t mRequestMap; // Mfq
-
- // Set of requests that require network data
- typedef std::set<LLUUID> queue_t;
- queue_t mHTTPTextureQueue; // Mfnq
- typedef std::map<LLHost,std::set<LLUUID> > cancel_queue_t;
- F32 mTextureBandwidth; // <none>
- F32 mMaxBandwidth; // Mfnq
- LLTextureInfo mTextureInfo;
- LLTextureInfo mTextureInfoMainThread;
-
- // XXX possible delete
- U32Bits mHTTPTextureBits; // Mfnq
-
- // XXX possible delete
- //debug use
- U32 mTotalHTTPRequests;
-
- // Out-of-band cross-thread command queue. This command queue
- // is logically tied to LLQueuedThread's list of
- // QueuedRequest instances and so must be covered by the
- // same locks.
- typedef std::vector<TFRequest *> command_queue_t;
- command_queue_t mCommands; // Mfq
-
- // If true, modifies some behaviors that help with QA tasks.
- const bool mQAMode;
-
- // Interfaces and objects into the core http library used
- // to make our HTTP requests. These replace the various
- // LLCurl interfaces used in the past.
- LLCore::HttpRequest * mHttpRequest; // Ttf
- LLCore::HttpOptions::ptr_t mHttpOptions; // Ttf
- LLCore::HttpOptions::ptr_t mHttpOptionsWithHeaders; // Ttf
- LLCore::HttpHeaders::ptr_t mHttpHeaders; // Ttf
- LLCore::HttpRequest::policy_t mHttpPolicyClass; // T*
- LLCore::HttpHeaders::ptr_t mHttpMetricsHeaders; // Ttf
- LLCore::HttpRequest::policy_t mHttpMetricsPolicyClass; // T*
- S32 mHttpHighWater; // Ttf
- S32 mHttpLowWater; // Ttf
-
- // We use a resource semaphore to keep HTTP requests in
- // WAIT_HTTP_RESOURCE2 if there aren't sufficient slots in the
- // transport. This keeps them near where they can be cheaply
- // reprioritized rather than dumping them all across a thread
- // where it's more expensive to get at them. Requests in either
- // SEND_HTTP_REQ or WAIT_HTTP_REQ charge against the semaphore
- // and tracking state transitions is critical to liveness.
- //
- // Originally implemented as a traditional semaphore (heading towards
- // zero), it now is an outstanding request count that is allowed to
- // exceed the high water level (but not go below zero).
- LLAtomicS32 mHttpSemaphore; // Ttf
-
- typedef std::set<LLUUID> wait_http_res_queue_t;
- wait_http_res_queue_t mHttpWaitResource; // Mfnq
-
- // Cumulative stats on the states/requests issued by
- // textures running through here.
- U32 mTotalCacheReadCount; // Mfq
- U32 mTotalCacheWriteCount; // Mfq
- U32 mTotalResourceWaitCount; // Mfq
-
+ LLMutex mQueueMutex; //to protect mRequestMap and mCommands only
+ LLMutex mNetworkQueueMutex; //to protect mHTTPTextureQueue
+
+ LLTextureCache* mTextureCache;
+
+ // Map of all requests by UUID
+ typedef std::map<LLUUID,LLTextureFetchWorker*> map_t;
+ map_t mRequestMap; // Mfq
+
+ // Set of requests that require network data
+ typedef std::set<LLUUID> queue_t;
+ queue_t mHTTPTextureQueue; // Mfnq
+ typedef std::map<LLHost,std::set<LLUUID> > cancel_queue_t;
+ F32 mTextureBandwidth; // <none>
+ F32 mMaxBandwidth; // Mfnq
+ LLTextureInfo mTextureInfo;
+ LLTextureInfo mTextureInfoMainThread;
+
+ // XXX possible delete
+ U32Bits mHTTPTextureBits; // Mfnq
+
+ // XXX possible delete
+ //debug use
+ U32 mTotalHTTPRequests;
+
+ // Out-of-band cross-thread command queue. This command queue
+ // is logically tied to LLQueuedThread's list of
+ // QueuedRequest instances and so must be covered by the
+ // same locks.
+ typedef std::vector<TFRequest *> command_queue_t;
+ command_queue_t mCommands; // Mfq
+
+ // If true, modifies some behaviors that help with QA tasks.
+ const bool mQAMode;
+
+ // Interfaces and objects into the core http library used
+ // to make our HTTP requests. These replace the various
+ // LLCurl interfaces used in the past.
+ LLCore::HttpRequest * mHttpRequest; // Ttf
+ LLCore::HttpOptions::ptr_t mHttpOptions; // Ttf
+ LLCore::HttpOptions::ptr_t mHttpOptionsWithHeaders; // Ttf
+ LLCore::HttpHeaders::ptr_t mHttpHeaders; // Ttf
+ LLCore::HttpRequest::policy_t mHttpPolicyClass; // T*
+ LLCore::HttpHeaders::ptr_t mHttpMetricsHeaders; // Ttf
+ LLCore::HttpRequest::policy_t mHttpMetricsPolicyClass; // T*
+ S32 mHttpHighWater; // Ttf
+ S32 mHttpLowWater; // Ttf
+
+ // We use a resource semaphore to keep HTTP requests in
+ // WAIT_HTTP_RESOURCE2 if there aren't sufficient slots in the
+ // transport. This keeps them near where they can be cheaply
+ // reprioritized rather than dumping them all across a thread
+ // where it's more expensive to get at them. Requests in either
+ // SEND_HTTP_REQ or WAIT_HTTP_REQ charge against the semaphore
+ // and tracking state transitions is critical to liveness.
+ //
+ // Originally implemented as a traditional semaphore (heading towards
+ // zero), it now is an outstanding request count that is allowed to
+ // exceed the high water level (but not go below zero).
+ LLAtomicS32 mHttpSemaphore; // Ttf
+
+ typedef std::set<LLUUID> wait_http_res_queue_t;
+ wait_http_res_queue_t mHttpWaitResource; // Mfnq
+
+ // Cumulative stats on the states/requests issued by
+ // textures running through here.
+ U32 mTotalCacheReadCount; // Mfq
+ U32 mTotalCacheWriteCount; // Mfq
+ U32 mTotalResourceWaitCount; // Mfq
+
public:
- // A probabilistically-correct indicator that the current
- // attempt to log metrics follows a break in the metrics stream
- // reporting due to either startup or a problem POSTing data.
- static volatile bool svMetricsDataBreak;
+ // A probabilistically-correct indicator that the current
+ // attempt to log metrics follows a break in the metrics stream
+ // reporting due to either startup or a problem POSTing data.
+ static volatile bool svMetricsDataBreak;
public:
- //debug use
- enum e_tex_source
- {
- FROM_ALL = 0,
- FROM_HTTP_ONLY,
- INVALID_SOURCE
- };
+ //debug use
+ enum e_tex_source
+ {
+ FROM_ALL = 0,
+ FROM_HTTP_ONLY,
+ INVALID_SOURCE
+ };
- static LLTextureFetchTester* sTesterp;
+ static LLTextureFetchTester* sTesterp;
private:
- e_tex_source mFetchSource;
- e_tex_source mOriginFetchSource;
+ e_tex_source mFetchSource;
+ e_tex_source mOriginFetchSource;
+
+ // Retry logic
+ //LLAdaptiveRetryPolicy mFetchRetryPolicy;
- // Retry logic
- //LLAdaptiveRetryPolicy mFetchRetryPolicy;
-
public:
- void setLoadSource(e_tex_source source) {mFetchSource = source;}
- void resetLoadSource() {mFetchSource = mOriginFetchSource;}
- bool canLoadFromCache() { return mFetchSource != FROM_HTTP_ONLY;}
+ void setLoadSource(e_tex_source source) {mFetchSource = source;}
+ void resetLoadSource() {mFetchSource = mOriginFetchSource;}
+ bool canLoadFromCache() { return mFetchSource != FROM_HTTP_ONLY;}
};
//debug use
@@ -411,21 +411,21 @@ class LLViewerFetchedTexture;
class LLTextureFetchTester : public LLMetricPerformanceTesterBasic
{
public:
- LLTextureFetchTester();
- ~LLTextureFetchTester();
+ LLTextureFetchTester();
+ ~LLTextureFetchTester();
- void updateStats(const std::map<S32, F32> states_timers, const F32 fetch_time, const F32 other_states_time, const S32 file_size);
+ void updateStats(const std::map<S32, F32> states_timers, const F32 fetch_time, const F32 other_states_time, const S32 file_size);
protected:
- /*virtual*/ void outputTestRecord(LLSD* sd);
+ /*virtual*/ void outputTestRecord(LLSD* sd);
private:
- F32 mTextureFetchTime;
- F32 mSkippedStatesTime;
- S32 mFileSize;
+ F32 mTextureFetchTime;
+ F32 mSkippedStatesTime;
+ S32 mFileSize;
- std::map<S32, F32> mStateTimersMap;
+ std::map<S32, F32> mStateTimersMap;
};
#endif // LL_LLTEXTUREFETCH_H
diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp
index e79bb62a52..e3c3864025 100644
--- a/indra/newview/lltextureinfo.cpp
+++ b/indra/newview/lltextureinfo.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltextureinfo.cpp
* @brief Object which handles local texture info
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,291 +46,291 @@ static LLTrace::CountStatHandle<S32Bytes > sTextureDataDownloaded("texture_data_
static LLTrace::CountStatHandle<U32Milliseconds > sTexureDownloadTime("texture_download_time", "amount of time spent fetching textures");
LLTextureInfo::LLTextureInfo(bool postponeStartRecoreder) :
- mLoggingEnabled(false),
- mTextureDownloadProtocol("NONE")
+ mLoggingEnabled(false),
+ mTextureDownloadProtocol("NONE")
{
- if (!postponeStartRecoreder)
- {
- startRecording();
- }
+ if (!postponeStartRecoreder)
+ {
+ startRecording();
+ }
}
void LLTextureInfo::setLogging(bool log_info)
{
- mLoggingEnabled = log_info;
+ mLoggingEnabled = log_info;
}
LLTextureInfo::~LLTextureInfo()
{
- std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator;
- for (iterator = mTextures.begin(); iterator != mTextures.end(); iterator++)
- {
- LLTextureInfoDetails *info = (*iterator).second;
- delete info;
- }
-
- mTextures.clear();
+ std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator;
+ for (iterator = mTextures.begin(); iterator != mTextures.end(); iterator++)
+ {
+ LLTextureInfoDetails *info = (*iterator).second;
+ delete info;
+ }
+
+ mTextures.clear();
}
void LLTextureInfo::addRequest(const LLUUID& id)
{
- LLTextureInfoDetails *info = new LLTextureInfoDetails();
- mTextures[id] = info;
+ LLTextureInfoDetails *info = new LLTextureInfoDetails();
+ mTextures[id] = info;
}
U32 LLTextureInfo::getTextureInfoMapSize()
{
- return mTextures.size();
+ return mTextures.size();
}
bool LLTextureInfo::has(const LLUUID& id)
{
- return mTextures.end() != mTextures.find(id);
+ return mTextures.end() != mTextures.find(id);
}
void LLTextureInfo::setRequestStartTime(const LLUUID& id, U64 startTime)
{
- if (!has(id))
- {
- addRequest(id);
- }
- mTextures[id]->mStartTime = (U64Microseconds)startTime;
- add(sTextureDownloadsStarted, 1);
+ if (!has(id))
+ {
+ addRequest(id);
+ }
+ mTextures[id]->mStartTime = (U64Microseconds)startTime;
+ add(sTextureDownloadsStarted, 1);
}
void LLTextureInfo::setRequestSize(const LLUUID& id, U32 size)
{
- if (!has(id))
- {
- addRequest(id);
- }
- mTextures[id]->mSize = (U32Bytes)size;
+ if (!has(id))
+ {
+ addRequest(id);
+ }
+ mTextures[id]->mSize = (U32Bytes)size;
}
void LLTextureInfo::setRequestOffset(const LLUUID& id, U32 offset)
{
- if (!has(id))
- {
- addRequest(id);
- }
- mTextures[id]->mOffset = offset;
+ if (!has(id))
+ {
+ addRequest(id);
+ }
+ mTextures[id]->mOffset = offset;
}
void LLTextureInfo::setRequestType(const LLUUID& id, LLTextureInfoDetails::LLRequestType type)
{
- if (!has(id))
- {
- addRequest(id);
- }
- mTextures[id]->mType = type;
+ if (!has(id))
+ {
+ addRequest(id);
+ }
+ mTextures[id]->mType = type;
}
void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64Microseconds completeTime)
{
- if (!has(id))
- {
- addRequest(id);
- }
-
- LLTextureInfoDetails& details = *mTextures[id];
-
- details.mCompleteTime = completeTime;
-
- std::string protocol = "NONE";
- switch(details.mType)
- {
- case LLTextureInfoDetails::REQUEST_TYPE_HTTP:
- protocol = "HTTP";
- break;
-
- case LLTextureInfoDetails::REQUEST_TYPE_UDP:
- protocol = "UDP";
- break;
-
- case LLTextureInfoDetails::REQUEST_TYPE_NONE:
- default:
- break;
- }
-
- if (mLoggingEnabled)
- {
- static LLCachedControl<bool> log_to_viewer_log(gSavedSettings, "LogTextureDownloadsToViewerLog", false);
- static LLCachedControl<bool> log_to_simulator(gSavedSettings, "LogTextureDownloadsToSimulator", false);
- static LLCachedControl<U32> texture_log_threshold(gSavedSettings, "TextureLoggingThreshold", 1);
-
- if (log_to_viewer_log)
- {
- LL_INFOS() << "texture=" << id
- << " start=" << details.mStartTime
- << " end=" << details.mCompleteTime
- << " size=" << details.mSize
- << " offset=" << details.mOffset
- << " length=" << U32Milliseconds(details.mCompleteTime - details.mStartTime)
- << " protocol=" << protocol
- << LL_ENDL;
- }
-
- if(log_to_simulator)
- {
- add(sTextureDataDownloaded, details.mSize);
- add(sTexureDownloadTime, details.mCompleteTime - details.mStartTime);
- add(sTextureDownloadsCompleted, 1);
- mTextureDownloadProtocol = protocol;
- if (mRecording.getSum(sTextureDataDownloaded) >= U32Bytes(texture_log_threshold))
- {
- LLSD texture_data;
- std::stringstream startTime;
- startTime << mCurrentStatsBundleStartTime;
- texture_data["start_time"] = startTime.str();
- std::stringstream endTime;
- endTime << completeTime;
- texture_data["end_time"] = endTime.str();
- texture_data["averages"] = getAverages();
-
- // Texture cache
- LLSD texture_cache;
- U32 cache_read = 0, cache_write = 0, res_wait = 0;
- F64 cache_hit_rate = 0;
- LLAppViewer::getTextureFetch()->getStateStats(&cache_read, &cache_write, &res_wait);
- if (cache_read > 0 || cache_write > 0)
- {
- cache_hit_rate = cache_read / (cache_read + cache_write);
- }
- texture_cache["cache_read"] = LLSD::Integer(cache_read);
- texture_cache["cache_write"] = LLSD::Integer(cache_write);
- texture_cache["hit_rate"] = LLSD::Real(cache_hit_rate);
- texture_cache["entries"] = LLSD::Integer(LLAppViewer::getTextureCache()->getEntries());
- texture_cache["space_max"] = ll_sd_from_U64((U64)LLAppViewer::getTextureCache()->getMaxUsage().value()); // bytes
- texture_cache["space_used"] = ll_sd_from_U64((U64)LLAppViewer::getTextureCache()->getUsage().value()); // bytes
- texture_data["texture_cache"] = texture_cache;
-
- // VO and mesh cache
- LLSD object_cache;
- object_cache["vo_entries_max"] = LLSD::Integer(LLVOCache::getInstance()->getCacheEntriesMax());
- object_cache["vo_entries_curent"] = LLSD::Integer(LLVOCache::getInstance()->getCacheEntries());
- object_cache["vo_active_entries"] = LLSD::Integer(LLWorld::getInstance()->getNumOfActiveCachedObjects());
- U64 region_hit_count = gAgent.getRegion() != NULL ? gAgent.getRegion()->getRegionCacheHitCount() : 0;
- U64 region_miss_count = gAgent.getRegion() != NULL ? gAgent.getRegion()->getRegionCacheMissCount() : 0;
- F64 region_vocache_hit_rate = 0;
- if (region_hit_count > 0 || region_miss_count > 0)
- {
- region_vocache_hit_rate = region_hit_count / (region_hit_count + region_miss_count);
- }
- object_cache["vo_region_hitcount"] = ll_sd_from_U64(region_hit_count);
- object_cache["vo_region_misscount"] = ll_sd_from_U64(region_miss_count);
- object_cache["vo_region_hitrate"] = LLSD::Real(region_vocache_hit_rate);
- object_cache["mesh_reads"] = LLSD::Integer(LLMeshRepository::sCacheReads);
- object_cache["mesh_writes"] = LLSD::Integer(LLMeshRepository::sCacheWrites);
- texture_data["object_cache"] = object_cache;
-
- send_texture_stats_to_sim(texture_data);
- resetTextureStatistics();
- }
- }
- }
-
- mTextures.erase(id);
+ if (!has(id))
+ {
+ addRequest(id);
+ }
+
+ LLTextureInfoDetails& details = *mTextures[id];
+
+ details.mCompleteTime = completeTime;
+
+ std::string protocol = "NONE";
+ switch(details.mType)
+ {
+ case LLTextureInfoDetails::REQUEST_TYPE_HTTP:
+ protocol = "HTTP";
+ break;
+
+ case LLTextureInfoDetails::REQUEST_TYPE_UDP:
+ protocol = "UDP";
+ break;
+
+ case LLTextureInfoDetails::REQUEST_TYPE_NONE:
+ default:
+ break;
+ }
+
+ if (mLoggingEnabled)
+ {
+ static LLCachedControl<bool> log_to_viewer_log(gSavedSettings, "LogTextureDownloadsToViewerLog", false);
+ static LLCachedControl<bool> log_to_simulator(gSavedSettings, "LogTextureDownloadsToSimulator", false);
+ static LLCachedControl<U32> texture_log_threshold(gSavedSettings, "TextureLoggingThreshold", 1);
+
+ if (log_to_viewer_log)
+ {
+ LL_INFOS() << "texture=" << id
+ << " start=" << details.mStartTime
+ << " end=" << details.mCompleteTime
+ << " size=" << details.mSize
+ << " offset=" << details.mOffset
+ << " length=" << U32Milliseconds(details.mCompleteTime - details.mStartTime)
+ << " protocol=" << protocol
+ << LL_ENDL;
+ }
+
+ if(log_to_simulator)
+ {
+ add(sTextureDataDownloaded, details.mSize);
+ add(sTexureDownloadTime, details.mCompleteTime - details.mStartTime);
+ add(sTextureDownloadsCompleted, 1);
+ mTextureDownloadProtocol = protocol;
+ if (mRecording.getSum(sTextureDataDownloaded) >= U32Bytes(texture_log_threshold))
+ {
+ LLSD texture_data;
+ std::stringstream startTime;
+ startTime << mCurrentStatsBundleStartTime;
+ texture_data["start_time"] = startTime.str();
+ std::stringstream endTime;
+ endTime << completeTime;
+ texture_data["end_time"] = endTime.str();
+ texture_data["averages"] = getAverages();
+
+ // Texture cache
+ LLSD texture_cache;
+ U32 cache_read = 0, cache_write = 0, res_wait = 0;
+ F64 cache_hit_rate = 0;
+ LLAppViewer::getTextureFetch()->getStateStats(&cache_read, &cache_write, &res_wait);
+ if (cache_read > 0 || cache_write > 0)
+ {
+ cache_hit_rate = cache_read / (cache_read + cache_write);
+ }
+ texture_cache["cache_read"] = LLSD::Integer(cache_read);
+ texture_cache["cache_write"] = LLSD::Integer(cache_write);
+ texture_cache["hit_rate"] = LLSD::Real(cache_hit_rate);
+ texture_cache["entries"] = LLSD::Integer(LLAppViewer::getTextureCache()->getEntries());
+ texture_cache["space_max"] = ll_sd_from_U64((U64)LLAppViewer::getTextureCache()->getMaxUsage().value()); // bytes
+ texture_cache["space_used"] = ll_sd_from_U64((U64)LLAppViewer::getTextureCache()->getUsage().value()); // bytes
+ texture_data["texture_cache"] = texture_cache;
+
+ // VO and mesh cache
+ LLSD object_cache;
+ object_cache["vo_entries_max"] = LLSD::Integer(LLVOCache::getInstance()->getCacheEntriesMax());
+ object_cache["vo_entries_curent"] = LLSD::Integer(LLVOCache::getInstance()->getCacheEntries());
+ object_cache["vo_active_entries"] = LLSD::Integer(LLWorld::getInstance()->getNumOfActiveCachedObjects());
+ U64 region_hit_count = gAgent.getRegion() != NULL ? gAgent.getRegion()->getRegionCacheHitCount() : 0;
+ U64 region_miss_count = gAgent.getRegion() != NULL ? gAgent.getRegion()->getRegionCacheMissCount() : 0;
+ F64 region_vocache_hit_rate = 0;
+ if (region_hit_count > 0 || region_miss_count > 0)
+ {
+ region_vocache_hit_rate = region_hit_count / (region_hit_count + region_miss_count);
+ }
+ object_cache["vo_region_hitcount"] = ll_sd_from_U64(region_hit_count);
+ object_cache["vo_region_misscount"] = ll_sd_from_U64(region_miss_count);
+ object_cache["vo_region_hitrate"] = LLSD::Real(region_vocache_hit_rate);
+ object_cache["mesh_reads"] = LLSD::Integer(LLMeshRepository::sCacheReads);
+ object_cache["mesh_writes"] = LLSD::Integer(LLMeshRepository::sCacheWrites);
+ texture_data["object_cache"] = object_cache;
+
+ send_texture_stats_to_sim(texture_data);
+ resetTextureStatistics();
+ }
+ }
+ }
+
+ mTextures.erase(id);
}
LLSD LLTextureInfo::getAverages()
{
- LLSD averagedTextureData;
- S32 averageDownloadRate = 0;
- unsigned int download_time = mRecording.getSum(sTexureDownloadTime).valueInUnits<LLUnits::Seconds>();
-
- if (0 != download_time)
- {
- averageDownloadRate = mRecording.getSum(sTextureDataDownloaded).valueInUnits<LLUnits::Bits>() / download_time;
- }
-
- averagedTextureData["bits_per_second"] = averageDownloadRate;
- averagedTextureData["bytes_downloaded"] = mRecording.getSum(sTextureDataDownloaded).valueInUnits<LLUnits::Bytes>();
- averagedTextureData["texture_downloads_started"] = mRecording.getSum(sTextureDownloadsStarted);
- averagedTextureData["texture_downloads_completed"] = mRecording.getSum(sTextureDownloadsCompleted);
- averagedTextureData["transport"] = mTextureDownloadProtocol;
-
- return averagedTextureData;
+ LLSD averagedTextureData;
+ S32 averageDownloadRate = 0;
+ unsigned int download_time = mRecording.getSum(sTexureDownloadTime).valueInUnits<LLUnits::Seconds>();
+
+ if (0 != download_time)
+ {
+ averageDownloadRate = mRecording.getSum(sTextureDataDownloaded).valueInUnits<LLUnits::Bits>() / download_time;
+ }
+
+ averagedTextureData["bits_per_second"] = averageDownloadRate;
+ averagedTextureData["bytes_downloaded"] = mRecording.getSum(sTextureDataDownloaded).valueInUnits<LLUnits::Bytes>();
+ averagedTextureData["texture_downloads_started"] = mRecording.getSum(sTextureDownloadsStarted);
+ averagedTextureData["texture_downloads_completed"] = mRecording.getSum(sTextureDownloadsCompleted);
+ averagedTextureData["transport"] = mTextureDownloadProtocol;
+
+ return averagedTextureData;
}
void LLTextureInfo::startRecording()
{
- mRecording.start();
+ mRecording.start();
}
void LLTextureInfo::stopRecording()
{
- mRecording.stop();
+ mRecording.stop();
}
void LLTextureInfo::resetTextureStatistics()
{
- mRecording.restart();
- mTextureDownloadProtocol = "NONE";
- mCurrentStatsBundleStartTime = LLTimer::getTotalTime();
+ mRecording.restart();
+ mTextureDownloadProtocol = "NONE";
+ mCurrentStatsBundleStartTime = LLTimer::getTotalTime();
}
U32Microseconds LLTextureInfo::getRequestStartTime(const LLUUID& id)
{
- if (!has(id))
- {
- return U32Microseconds(0);
- }
- else
- {
- std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
- return (*iterator).second->mStartTime;
- }
+ if (!has(id))
+ {
+ return U32Microseconds(0);
+ }
+ else
+ {
+ std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
+ return (*iterator).second->mStartTime;
+ }
}
U32Bytes LLTextureInfo::getRequestSize(const LLUUID& id)
{
- if (!has(id))
- {
- return U32Bytes(0);
- }
- else
- {
- std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
- return (*iterator).second->mSize;
- }
+ if (!has(id))
+ {
+ return U32Bytes(0);
+ }
+ else
+ {
+ std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
+ return (*iterator).second->mSize;
+ }
}
U32 LLTextureInfo::getRequestOffset(const LLUUID& id)
{
- if (!has(id))
- {
- return 0;
- }
- else
- {
- std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
- return (*iterator).second->mOffset;
- }
+ if (!has(id))
+ {
+ return 0;
+ }
+ else
+ {
+ std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
+ return (*iterator).second->mOffset;
+ }
}
LLTextureInfoDetails::LLRequestType LLTextureInfo::getRequestType(const LLUUID& id)
{
- if (!has(id))
- {
- return LLTextureInfoDetails::REQUEST_TYPE_NONE;
- }
- else
- {
- std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
- return (*iterator).second->mType;
- }
+ if (!has(id))
+ {
+ return LLTextureInfoDetails::REQUEST_TYPE_NONE;
+ }
+ else
+ {
+ std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
+ return (*iterator).second->mType;
+ }
}
U32Microseconds LLTextureInfo::getRequestCompleteTime(const LLUUID& id)
{
- if (!has(id))
- {
- return U32Microseconds(0);
- }
- else
- {
- std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
- return (*iterator).second->mCompleteTime;
- }
+ if (!has(id))
+ {
+ return U32Microseconds(0);
+ }
+ else
+ {
+ std::map<LLUUID, LLTextureInfoDetails *>::iterator iterator = mTextures.find(id);
+ return (*iterator).second->mCompleteTime;
+ }
}
diff --git a/indra/newview/lltextureinfo.h b/indra/newview/lltextureinfo.h
index 46378eb7f8..cbedc89281 100644
--- a/indra/newview/lltextureinfo.h
+++ b/indra/newview/lltextureinfo.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltextureinfo.h
* @brief Object for managing texture information.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,36 +35,36 @@
class LLTextureInfo
{
public:
- LLTextureInfo(bool postponeStartRecoreder = true);
- ~LLTextureInfo();
+ LLTextureInfo(bool postponeStartRecoreder = true);
+ ~LLTextureInfo();
- void setLogging(bool log_info);
- bool has(const LLUUID& id);
- void setRequestStartTime(const LLUUID& id, U64 startTime);
- void setRequestSize(const LLUUID& id, U32 size);
- void setRequestOffset(const LLUUID& id, U32 offset);
- void setRequestType(const LLUUID& id, LLTextureInfoDetails::LLRequestType type);
- void setRequestCompleteTimeAndLog(const LLUUID& id, U64Microseconds completeTime);
- U32Microseconds getRequestStartTime(const LLUUID& id);
- U32Bytes getRequestSize(const LLUUID& id);
- U32 getRequestOffset(const LLUUID& id);
- LLTextureInfoDetails::LLRequestType getRequestType(const LLUUID& id);
- U32Microseconds getRequestCompleteTime(const LLUUID& id);
- void resetTextureStatistics();
- U32 getTextureInfoMapSize();
- LLSD getAverages();
- void startRecording();
- void stopRecording();
+ void setLogging(bool log_info);
+ bool has(const LLUUID& id);
+ void setRequestStartTime(const LLUUID& id, U64 startTime);
+ void setRequestSize(const LLUUID& id, U32 size);
+ void setRequestOffset(const LLUUID& id, U32 offset);
+ void setRequestType(const LLUUID& id, LLTextureInfoDetails::LLRequestType type);
+ void setRequestCompleteTimeAndLog(const LLUUID& id, U64Microseconds completeTime);
+ U32Microseconds getRequestStartTime(const LLUUID& id);
+ U32Bytes getRequestSize(const LLUUID& id);
+ U32 getRequestOffset(const LLUUID& id);
+ LLTextureInfoDetails::LLRequestType getRequestType(const LLUUID& id);
+ U32Microseconds getRequestCompleteTime(const LLUUID& id);
+ void resetTextureStatistics();
+ U32 getTextureInfoMapSize();
+ LLSD getAverages();
+ void startRecording();
+ void stopRecording();
private:
- void addRequest(const LLUUID& id);
+ void addRequest(const LLUUID& id);
- std::map<LLUUID, LLTextureInfoDetails *> mTextures;
- LLSD mAverages;
- bool mLoggingEnabled;
- std::string mTextureDownloadProtocol;
- U64Microseconds mCurrentStatsBundleStartTime;
- LLTrace::Recording mRecording;
+ std::map<LLUUID, LLTextureInfoDetails *> mTextures;
+ LLSD mAverages;
+ bool mLoggingEnabled;
+ std::string mTextureDownloadProtocol;
+ U64Microseconds mCurrentStatsBundleStartTime;
+ LLTrace::Recording mRecording;
};
diff --git a/indra/newview/lltextureinfodetails.cpp b/indra/newview/lltextureinfodetails.cpp
index cab16eb922..7fed155b23 100644
--- a/indra/newview/lltextureinfodetails.cpp
+++ b/indra/newview/lltextureinfodetails.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltextureinfodetails.cpp
* @brief Object which handles details of any individual texture
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,9 +28,9 @@
#include "lltextureinfodetails.h"
-LLTextureInfoDetails::LLTextureInfoDetails()
-: mType(REQUEST_TYPE_NONE),
- mOffset(0)
+LLTextureInfoDetails::LLTextureInfoDetails()
+: mType(REQUEST_TYPE_NONE),
+ mOffset(0)
{
}
diff --git a/indra/newview/lltextureinfodetails.h b/indra/newview/lltextureinfodetails.h
index a42c335035..8ba98ea3f8 100644
--- a/indra/newview/lltextureinfodetails.h
+++ b/indra/newview/lltextureinfodetails.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltextureinfo.h
* @brief Object for managing texture information.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,20 +32,20 @@
struct LLTextureInfoDetails
{
- enum LLRequestType
- {
- REQUEST_TYPE_NONE,
- REQUEST_TYPE_HTTP,
- REQUEST_TYPE_UDP
- };
+ enum LLRequestType
+ {
+ REQUEST_TYPE_NONE,
+ REQUEST_TYPE_HTTP,
+ REQUEST_TYPE_UDP
+ };
- U32Microseconds mStartTime,
- mCompleteTime;
- U32 mOffset;
- U32Bytes mSize;
- LLRequestType mType;
+ U32Microseconds mStartTime,
+ mCompleteTime;
+ U32 mOffset;
+ U32Bytes mSize;
+ LLRequestType mType;
- LLTextureInfoDetails();
+ LLTextureInfoDetails();
};
#endif // LL_LLTEXTUREINFODETAILS_H
diff --git a/indra/newview/lltexturestats.cpp b/indra/newview/lltexturestats.cpp
index 8f4b7d000c..1e46104e4a 100644
--- a/indra/newview/lltexturestats.cpp
+++ b/indra/newview/lltexturestats.cpp
@@ -1,34 +1,34 @@
-/**
+/**
* @file lltexturerstats.cpp
* @brief texture stats helper methods
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
-#include "pipeline.h"
+#include "pipeline.h"
#include "llagent.h"
-#include "lltexturefetch.h"
+#include "lltexturefetch.h"
#include "lltexturestats.h"
#include "llversioninfo.h"
#include "llviewerregion.h"
@@ -36,22 +36,22 @@
void send_texture_stats_to_sim(const LLSD &texture_stats)
{
- LLSD texture_stats_report;
- // Only send stats if the agent is connected to a region.
- if (!gAgent.getRegion())
- {
- return;
- }
+ LLSD texture_stats_report;
+ // Only send stats if the agent is connected to a region.
+ if (!gAgent.getRegion())
+ {
+ return;
+ }
- LLUUID agent_id = gAgent.getID();
- texture_stats_report["agent_id"] = agent_id;
- texture_stats_report["region_id"] = gAgent.getRegion()->getRegionID();
- texture_stats_report["viewer_channel"] = LLVersionInfo::instance().getChannel();
- texture_stats_report["viewer_version"] = LLVersionInfo::instance().getVersion();
- texture_stats_report["stats_data"] = texture_stats;
+ LLUUID agent_id = gAgent.getID();
+ texture_stats_report["agent_id"] = agent_id;
+ texture_stats_report["region_id"] = gAgent.getRegion()->getRegionID();
+ texture_stats_report["viewer_channel"] = LLVersionInfo::instance().getChannel();
+ texture_stats_report["viewer_version"] = LLVersionInfo::instance().getVersion();
+ texture_stats_report["stats_data"] = texture_stats;
- std::string texture_cap_url = gAgent.getRegion()->getCapability("TextureStats");
- LL_INFOS() << "uploading texture stats data to simulator" << LL_ENDL;
+ std::string texture_cap_url = gAgent.getRegion()->getCapability("TextureStats");
+ LL_INFOS() << "uploading texture stats data to simulator" << LL_ENDL;
if (texture_cap_url != "")
{
diff --git a/indra/newview/lltexturestats.h b/indra/newview/lltexturestats.h
index 09bab41fc3..237879dabb 100644
--- a/indra/newview/lltexturestats.h
+++ b/indra/newview/lltexturestats.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexturestats.h
* @brief texture stats utilities
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index 84cd6e2da7..3da0ab779a 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltextureview.cpp
* @brief LLTextureView class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012-2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -87,120 +87,120 @@ static S32 texture_bar_height = 8;
class LLTextureBar : public LLView
{
public:
- LLPointer<LLViewerFetchedTexture> mImagep;
- S32 mHilite;
+ LLPointer<LLViewerFetchedTexture> mImagep;
+ S32 mHilite;
public:
- struct Params : public LLInitParam::Block<Params, LLView::Params>
- {
- Mandatory<LLTextureView*> texture_view;
- Params()
- : texture_view("texture_view")
- {
- changeDefault(mouse_opaque, false);
- }
- };
- LLTextureBar(const Params& p)
- : LLView(p),
- mHilite(0),
- mTextureView(p.texture_view)
- {}
-
- virtual void draw();
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual LLRect getRequiredRect(); // Return the height of this object, given the set options.
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ Mandatory<LLTextureView*> texture_view;
+ Params()
+ : texture_view("texture_view")
+ {
+ changeDefault(mouse_opaque, false);
+ }
+ };
+ LLTextureBar(const Params& p)
+ : LLView(p),
+ mHilite(0),
+ mTextureView(p.texture_view)
+ {}
+
+ virtual void draw();
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual LLRect getRequiredRect(); // Return the height of this object, given the set options.
// Used for sorting
- struct sort
- {
- bool operator()(const LLView* i1, const LLView* i2)
- {
- LLTextureBar* bar1p = (LLTextureBar*)i1;
- LLTextureBar* bar2p = (LLTextureBar*)i2;
- LLViewerFetchedTexture *i1p = bar1p->mImagep;
- LLViewerFetchedTexture *i2p = bar2p->mImagep;
- F32 pri1 = i1p->getMaxVirtualSize();
- F32 pri2 = i2p->getMaxVirtualSize();
- if (pri1 > pri2)
- return true;
- else if (pri2 > pri1)
- return false;
- else
- return i1p->getID() < i2p->getID();
- }
- };
-
- struct sort_fetch
- {
- bool operator()(const LLView* i1, const LLView* i2)
- {
- LLTextureBar* bar1p = (LLTextureBar*)i1;
- LLTextureBar* bar2p = (LLTextureBar*)i2;
- LLViewerFetchedTexture *i1p = bar1p->mImagep;
- LLViewerFetchedTexture *i2p = bar2p->mImagep;
- U32 pri1 = i1p->getFetchPriority() ;
- U32 pri2 = i2p->getFetchPriority() ;
- if (pri1 > pri2)
- return true;
- else if (pri2 > pri1)
- return false;
- else
- return i1p->getID() < i2p->getID();
- }
- };
+ struct sort
+ {
+ bool operator()(const LLView* i1, const LLView* i2)
+ {
+ LLTextureBar* bar1p = (LLTextureBar*)i1;
+ LLTextureBar* bar2p = (LLTextureBar*)i2;
+ LLViewerFetchedTexture *i1p = bar1p->mImagep;
+ LLViewerFetchedTexture *i2p = bar2p->mImagep;
+ F32 pri1 = i1p->getMaxVirtualSize();
+ F32 pri2 = i2p->getMaxVirtualSize();
+ if (pri1 > pri2)
+ return true;
+ else if (pri2 > pri1)
+ return false;
+ else
+ return i1p->getID() < i2p->getID();
+ }
+ };
+
+ struct sort_fetch
+ {
+ bool operator()(const LLView* i1, const LLView* i2)
+ {
+ LLTextureBar* bar1p = (LLTextureBar*)i1;
+ LLTextureBar* bar2p = (LLTextureBar*)i2;
+ LLViewerFetchedTexture *i1p = bar1p->mImagep;
+ LLViewerFetchedTexture *i2p = bar2p->mImagep;
+ U32 pri1 = i1p->getFetchPriority() ;
+ U32 pri2 = i2p->getFetchPriority() ;
+ if (pri1 > pri2)
+ return true;
+ else if (pri2 > pri1)
+ return false;
+ else
+ return i1p->getID() < i2p->getID();
+ }
+ };
private:
- LLTextureView* mTextureView;
+ LLTextureView* mTextureView;
};
void LLTextureBar::draw()
{
- if (!mImagep)
- {
- return;
- }
-
- LLColor4 color;
- if (mImagep->getID() == LLAppViewer::getTextureFetch()->mDebugID)
- {
- color = LLColor4::cyan2;
- }
- else if (mHilite)
- {
- S32 idx = llclamp(mHilite,1,3);
- if (idx==1) color = LLColor4::orange;
- else if (idx==2) color = LLColor4::yellow;
- else color = LLColor4::pink2;
- }
- else if (mImagep->mDontDiscard)
- {
- color = LLColor4::green4;
- }
- else if (mImagep->getMaxVirtualSize() <= 0.0f)
- {
- color = LLColor4::grey; color[VALPHA] = .7f;
- }
- else
- {
- color = LLColor4::white; color[VALPHA] = .7f;
- }
-
- // We need to draw:
- // The texture UUID or name
- // The progress bar for the texture, highlighted if it's being download
- // Various numerical stats.
- std::string tex_str;
- S32 left, right;
- S32 top = 0;
- S32 bottom = top + 6;
- LLColor4 clr;
-
- LLGLSUIDefault gls_ui;
-
- // Name, pixel_area, requested pixel area, decode priority
- std::string uuid_str;
- mImagep->mID.toString(uuid_str);
- uuid_str = uuid_str.substr(0,7);
-
+ if (!mImagep)
+ {
+ return;
+ }
+
+ LLColor4 color;
+ if (mImagep->getID() == LLAppViewer::getTextureFetch()->mDebugID)
+ {
+ color = LLColor4::cyan2;
+ }
+ else if (mHilite)
+ {
+ S32 idx = llclamp(mHilite,1,3);
+ if (idx==1) color = LLColor4::orange;
+ else if (idx==2) color = LLColor4::yellow;
+ else color = LLColor4::pink2;
+ }
+ else if (mImagep->mDontDiscard)
+ {
+ color = LLColor4::green4;
+ }
+ else if (mImagep->getMaxVirtualSize() <= 0.0f)
+ {
+ color = LLColor4::grey; color[VALPHA] = .7f;
+ }
+ else
+ {
+ color = LLColor4::white; color[VALPHA] = .7f;
+ }
+
+ // We need to draw:
+ // The texture UUID or name
+ // The progress bar for the texture, highlighted if it's being download
+ // Various numerical stats.
+ std::string tex_str;
+ S32 left, right;
+ S32 top = 0;
+ S32 bottom = top + 6;
+ LLColor4 clr;
+
+ LLGLSUIDefault gls_ui;
+
+ // Name, pixel_area, requested pixel area, decode priority
+ std::string uuid_str;
+ mImagep->mID.toString(uuid_str);
+ uuid_str = uuid_str.substr(0,7);
+
tex_str = llformat("%s %7.0f %d(%d)",
uuid_str.c_str(),
mImagep->mMaxVirtualSize,
@@ -208,158 +208,158 @@ void LLTextureBar::draw()
mImagep->mRequestedDiscardLevel);
- LLFontGL::getFontMonospace()->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(),
- color, LLFontGL::LEFT, LLFontGL::TOP);
-
- // State
- // Hack: mirrored from lltexturefetch.cpp
- struct { const std::string desc; LLColor4 color; } fetch_state_desc[] = {
- { "---", LLColor4::red }, // INVALID
- { "INI", LLColor4::white }, // INIT
- { "DSK", LLColor4::cyan }, // LOAD_FROM_TEXTURE_CACHE
- { "DSK", LLColor4::blue }, // CACHE_POST
- { "NET", LLColor4::green }, // LOAD_FROM_NETWORK
- { "HTW", LLColor4::green }, // WAIT_HTTP_RESOURCE
- { "HTW", LLColor4::green }, // WAIT_HTTP_RESOURCE2
- { "REQ", LLColor4::yellow },// SEND_HTTP_REQ
- { "HTP", LLColor4::green }, // WAIT_HTTP_REQ
- { "DEC", LLColor4::yellow },// DECODE_IMAGE
- { "DEU", LLColor4::green }, // DECODE_IMAGE_UPDATE
- { "WRT", LLColor4::purple },// WRITE_TO_CACHE
- { "WWT", LLColor4::orange },// WAIT_ON_WRITE
- { "END", LLColor4::red }, // DONE
+ LLFontGL::getFontMonospace()->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(),
+ color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ // State
+ // Hack: mirrored from lltexturefetch.cpp
+ struct { const std::string desc; LLColor4 color; } fetch_state_desc[] = {
+ { "---", LLColor4::red }, // INVALID
+ { "INI", LLColor4::white }, // INIT
+ { "DSK", LLColor4::cyan }, // LOAD_FROM_TEXTURE_CACHE
+ { "DSK", LLColor4::blue }, // CACHE_POST
+ { "NET", LLColor4::green }, // LOAD_FROM_NETWORK
+ { "HTW", LLColor4::green }, // WAIT_HTTP_RESOURCE
+ { "HTW", LLColor4::green }, // WAIT_HTTP_RESOURCE2
+ { "REQ", LLColor4::yellow },// SEND_HTTP_REQ
+ { "HTP", LLColor4::green }, // WAIT_HTTP_REQ
+ { "DEC", LLColor4::yellow },// DECODE_IMAGE
+ { "DEU", LLColor4::green }, // DECODE_IMAGE_UPDATE
+ { "WRT", LLColor4::purple },// WRITE_TO_CACHE
+ { "WWT", LLColor4::orange },// WAIT_ON_WRITE
+ { "END", LLColor4::red }, // DONE
#define LAST_STATE 14
- { "CRE", LLColor4::magenta }, // LAST_STATE+1
- { "FUL", LLColor4::green }, // LAST_STATE+2
- { "BAD", LLColor4::red }, // LAST_STATE+3
- { "MIS", LLColor4::red }, // LAST_STATE+4
- { "---", LLColor4::white }, // LAST_STATE+5
- };
- const S32 fetch_state_desc_size = (S32)LL_ARRAY_SIZE(fetch_state_desc);
- S32 state =
- mImagep->mNeedsCreateTexture ? LAST_STATE+1 :
- mImagep->mFullyLoaded ? LAST_STATE+2 :
- mImagep->mMinDiscardLevel > 0 ? LAST_STATE+3 :
- mImagep->mIsMissingAsset ? LAST_STATE+4 :
- !mImagep->mIsFetching ? LAST_STATE+5 :
- mImagep->mFetchState;
- state = llclamp(state,0,fetch_state_desc_size-1);
-
- LLFontGL::getFontMonospace()->renderUTF8(fetch_state_desc[state].desc, 0, title_x2, getRect().getHeight(),
- fetch_state_desc[state].color,
- LLFontGL::LEFT, LLFontGL::TOP);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- // Draw the progress bar.
- S32 bar_width = 100;
- S32 bar_left = 260;
- left = bar_left;
- right = left + bar_width;
-
- gGL.color4f(0.f, 0.f, 0.f, 0.75f);
- gl_rect_2d(left, top, right, bottom);
-
- F32 data_progress = mImagep->mDownloadProgress;
-
- if (data_progress > 0.0f)
- {
- // Downloaded bytes
- right = left + llfloor(data_progress * (F32)bar_width);
- if (right > left)
- {
- gGL.color4f(0.f, 0.f, 1.f, 0.75f);
- gl_rect_2d(left, top, right, bottom);
- }
- }
-
- S32 pip_width = 6;
- S32 pip_space = 14;
- S32 pip_x = title_x3 + pip_space/2;
-
- // Draw the packet pip
- const F32 pip_max_time = 5.f;
- F32 last_event = mImagep->mLastPacketTimer.getElapsedTimeF32();
- if (last_event < pip_max_time)
- {
- clr = LLColor4::white;
- }
- else
- {
- last_event = mImagep->mRequestDeltaTime;
- if (last_event < pip_max_time)
- {
- clr = LLColor4::green;
- }
- else
- {
- last_event = mImagep->mFetchDeltaTime;
- if (last_event < pip_max_time)
- {
- clr = LLColor4::yellow;
- }
- }
- }
- if (last_event < pip_max_time)
- {
- clr.setAlpha(1.f - last_event/pip_max_time);
- gGL.color4fv(clr.mV);
- gl_rect_2d(pip_x, top, pip_x + pip_width, bottom);
- }
- pip_x += pip_width + pip_space;
-
- // we don't want to show bind/resident pips for textures using the default texture
- if (mImagep->hasGLTexture())
- {
- // Draw the bound pip
- last_event = mImagep->getTimePassedSinceLastBound();
- if (last_event < 1.f)
- {
- clr = mImagep->getMissed() ? LLColor4::red : LLColor4::magenta1;
- clr.setAlpha(1.f - last_event);
- gGL.color4fv(clr.mV);
- gl_rect_2d(pip_x, top, pip_x + pip_width, bottom);
- }
- }
- pip_x += pip_width + pip_space;
-
-
- {
- LLGLSUIDefault gls_ui;
- // draw the packet data
-// {
-// std::string num_str = llformat("%3d/%3d", mImagep->mLastPacket+1, mImagep->mPackets);
-// LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, bar_left + 100, getRect().getHeight(), color,
-// LLFontGL::LEFT, LLFontGL::TOP);
-// }
-
- // draw the image size at the end
- {
- std::string num_str = llformat("%3dx%3d (%2d) %7d", mImagep->getWidth(), mImagep->getHeight(),
- mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory().value() : 0);
- LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color,
- LLFontGL::LEFT, LLFontGL::TOP);
- }
- }
+ { "CRE", LLColor4::magenta }, // LAST_STATE+1
+ { "FUL", LLColor4::green }, // LAST_STATE+2
+ { "BAD", LLColor4::red }, // LAST_STATE+3
+ { "MIS", LLColor4::red }, // LAST_STATE+4
+ { "---", LLColor4::white }, // LAST_STATE+5
+ };
+ const S32 fetch_state_desc_size = (S32)LL_ARRAY_SIZE(fetch_state_desc);
+ S32 state =
+ mImagep->mNeedsCreateTexture ? LAST_STATE+1 :
+ mImagep->mFullyLoaded ? LAST_STATE+2 :
+ mImagep->mMinDiscardLevel > 0 ? LAST_STATE+3 :
+ mImagep->mIsMissingAsset ? LAST_STATE+4 :
+ !mImagep->mIsFetching ? LAST_STATE+5 :
+ mImagep->mFetchState;
+ state = llclamp(state,0,fetch_state_desc_size-1);
+
+ LLFontGL::getFontMonospace()->renderUTF8(fetch_state_desc[state].desc, 0, title_x2, getRect().getHeight(),
+ fetch_state_desc[state].color,
+ LLFontGL::LEFT, LLFontGL::TOP);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ // Draw the progress bar.
+ S32 bar_width = 100;
+ S32 bar_left = 260;
+ left = bar_left;
+ right = left + bar_width;
+
+ gGL.color4f(0.f, 0.f, 0.f, 0.75f);
+ gl_rect_2d(left, top, right, bottom);
+
+ F32 data_progress = mImagep->mDownloadProgress;
+
+ if (data_progress > 0.0f)
+ {
+ // Downloaded bytes
+ right = left + llfloor(data_progress * (F32)bar_width);
+ if (right > left)
+ {
+ gGL.color4f(0.f, 0.f, 1.f, 0.75f);
+ gl_rect_2d(left, top, right, bottom);
+ }
+ }
+
+ S32 pip_width = 6;
+ S32 pip_space = 14;
+ S32 pip_x = title_x3 + pip_space/2;
+
+ // Draw the packet pip
+ const F32 pip_max_time = 5.f;
+ F32 last_event = mImagep->mLastPacketTimer.getElapsedTimeF32();
+ if (last_event < pip_max_time)
+ {
+ clr = LLColor4::white;
+ }
+ else
+ {
+ last_event = mImagep->mRequestDeltaTime;
+ if (last_event < pip_max_time)
+ {
+ clr = LLColor4::green;
+ }
+ else
+ {
+ last_event = mImagep->mFetchDeltaTime;
+ if (last_event < pip_max_time)
+ {
+ clr = LLColor4::yellow;
+ }
+ }
+ }
+ if (last_event < pip_max_time)
+ {
+ clr.setAlpha(1.f - last_event/pip_max_time);
+ gGL.color4fv(clr.mV);
+ gl_rect_2d(pip_x, top, pip_x + pip_width, bottom);
+ }
+ pip_x += pip_width + pip_space;
+
+ // we don't want to show bind/resident pips for textures using the default texture
+ if (mImagep->hasGLTexture())
+ {
+ // Draw the bound pip
+ last_event = mImagep->getTimePassedSinceLastBound();
+ if (last_event < 1.f)
+ {
+ clr = mImagep->getMissed() ? LLColor4::red : LLColor4::magenta1;
+ clr.setAlpha(1.f - last_event);
+ gGL.color4fv(clr.mV);
+ gl_rect_2d(pip_x, top, pip_x + pip_width, bottom);
+ }
+ }
+ pip_x += pip_width + pip_space;
+
+
+ {
+ LLGLSUIDefault gls_ui;
+ // draw the packet data
+// {
+// std::string num_str = llformat("%3d/%3d", mImagep->mLastPacket+1, mImagep->mPackets);
+// LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, bar_left + 100, getRect().getHeight(), color,
+// LLFontGL::LEFT, LLFontGL::TOP);
+// }
+
+ // draw the image size at the end
+ {
+ std::string num_str = llformat("%3dx%3d (%2d) %7d", mImagep->getWidth(), mImagep->getHeight(),
+ mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory().value() : 0);
+ LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color,
+ LLFontGL::LEFT, LLFontGL::TOP);
+ }
+ }
}
BOOL LLTextureBar::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if ((mask & (MASK_CONTROL|MASK_SHIFT|MASK_ALT)) == MASK_ALT)
- {
- LLAppViewer::getTextureFetch()->mDebugID = mImagep->getID();
- return TRUE;
- }
- return LLView::handleMouseDown(x,y,mask);
+ if ((mask & (MASK_CONTROL|MASK_SHIFT|MASK_ALT)) == MASK_ALT)
+ {
+ LLAppViewer::getTextureFetch()->mDebugID = mImagep->getID();
+ return TRUE;
+ }
+ return LLView::handleMouseDown(x,y,mask);
}
LLRect LLTextureBar::getRequiredRect()
{
- LLRect rect;
+ LLRect rect;
- rect.mTop = texture_bar_height;
+ rect.mTop = texture_bar_height;
- return rect;
+ return rect;
}
////////////////////////////////////////////////////////////////////////////
@@ -367,90 +367,90 @@ LLRect LLTextureBar::getRequiredRect()
class LLAvatarTexBar : public LLView
{
public:
- struct Params : public LLInitParam::Block<Params, LLView::Params>
- {
- Mandatory<LLTextureView*> texture_view;
- Params()
- : texture_view("texture_view")
- {
- S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
- changeDefault(rect, LLRect(0,0,100,line_height * 4));
- }
- };
-
- LLAvatarTexBar(const Params& p)
- : LLView(p),
- mTextureView(p.texture_view)
- {}
-
- virtual void draw();
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual LLRect getRequiredRect(); // Return the height of this object, given the set options.
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ Mandatory<LLTextureView*> texture_view;
+ Params()
+ : texture_view("texture_view")
+ {
+ S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
+ changeDefault(rect, LLRect(0,0,100,line_height * 4));
+ }
+ };
+
+ LLAvatarTexBar(const Params& p)
+ : LLView(p),
+ mTextureView(p.texture_view)
+ {}
+
+ virtual void draw();
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual LLRect getRequiredRect(); // Return the height of this object, given the set options.
private:
- LLTextureView* mTextureView;
+ LLTextureView* mTextureView;
};
void LLAvatarTexBar::draw()
-{
- if (!gSavedSettings.getBOOL("DebugAvatarRezTime")) return;
-
- LLVOAvatarSelf* avatarp = gAgentAvatarp;
- if (!avatarp) return;
-
- const S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
- const S32 v_offset = 0;
- const S32 l_offset = 3;
-
- //----------------------------------------------------------------------------
- LLGLSUIDefault gls_ui;
- LLColor4 color;
-
- U32 line_num = 1;
- for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearance::getDictionary()->getBakedTextures().begin();
- baked_iter != LLAvatarAppearance::getDictionary()->getBakedTextures().end();
- ++baked_iter)
- {
- const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first;
- const LLViewerTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index);
- if (!layerset) continue;
- const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite();
- if (!layerset_buffer) continue;
-
- LLColor4 text_color = LLColor4::white;
-
- std::string text = layerset_buffer->dumpTextureInfo();
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, l_offset, v_offset + line_height*line_num,
- text_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT);
- line_num++;
- }
- const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout");
- const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
-
- LLColor4 header_color(1.f, 1.f, 1.f, 0.9f);
-
- const std::string texture_timeout_str = texture_timeout ? llformat("%d",texture_timeout) : "Disabled";
- const std::string override_tex_discard_level_str = override_tex_discard_level ? llformat("%d",override_tex_discard_level) : "Disabled";
- std::string header_text = llformat("[ Timeout('AvatarBakedTextureUploadTimeout'):%s ] [ LOD_Override('TextureDiscardLevel'):%s ]", texture_timeout_str.c_str(), override_tex_discard_level_str.c_str());
- LLFontGL::getFontMonospace()->renderUTF8(header_text, 0, l_offset, v_offset + line_height*line_num,
- header_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT);
- line_num++;
- std::string section_text = "Avatar Textures Information:";
- LLFontGL::getFontMonospace()->renderUTF8(section_text, 0, 0, v_offset + line_height*line_num,
- header_color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT);
+{
+ if (!gSavedSettings.getBOOL("DebugAvatarRezTime")) return;
+
+ LLVOAvatarSelf* avatarp = gAgentAvatarp;
+ if (!avatarp) return;
+
+ const S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
+ const S32 v_offset = 0;
+ const S32 l_offset = 3;
+
+ //----------------------------------------------------------------------------
+ LLGLSUIDefault gls_ui;
+ LLColor4 color;
+
+ U32 line_num = 1;
+ for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearance::getDictionary()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearance::getDictionary()->getBakedTextures().end();
+ ++baked_iter)
+ {
+ const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first;
+ const LLViewerTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index);
+ if (!layerset) continue;
+ const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite();
+ if (!layerset_buffer) continue;
+
+ LLColor4 text_color = LLColor4::white;
+
+ std::string text = layerset_buffer->dumpTextureInfo();
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, l_offset, v_offset + line_height*line_num,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT);
+ line_num++;
+ }
+ const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout");
+ const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
+
+ LLColor4 header_color(1.f, 1.f, 1.f, 0.9f);
+
+ const std::string texture_timeout_str = texture_timeout ? llformat("%d",texture_timeout) : "Disabled";
+ const std::string override_tex_discard_level_str = override_tex_discard_level ? llformat("%d",override_tex_discard_level) : "Disabled";
+ std::string header_text = llformat("[ Timeout('AvatarBakedTextureUploadTimeout'):%s ] [ LOD_Override('TextureDiscardLevel'):%s ]", texture_timeout_str.c_str(), override_tex_discard_level_str.c_str());
+ LLFontGL::getFontMonospace()->renderUTF8(header_text, 0, l_offset, v_offset + line_height*line_num,
+ header_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT);
+ line_num++;
+ std::string section_text = "Avatar Textures Information:";
+ LLFontGL::getFontMonospace()->renderUTF8(section_text, 0, 0, v_offset + line_height*line_num,
+ header_color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT);
}
BOOL LLAvatarTexBar::handleMouseDown(S32 x, S32 y, MASK mask)
{
- return FALSE;
+ return FALSE;
}
LLRect LLAvatarTexBar::getRequiredRect()
{
- LLRect rect;
- rect.mTop = 100;
- if (!gSavedSettings.getBOOL("DebugAvatarRezTime")) rect.mTop = 0;
- return rect;
+ LLRect rect;
+ rect.mTop = 100;
+ if (!gSavedSettings.getBOOL("DebugAvatarRezTime")) rect.mTop = 0;
+ return rect;
}
////////////////////////////////////////////////////////////////////////////
@@ -458,64 +458,64 @@ LLRect LLAvatarTexBar::getRequiredRect()
class LLGLTexMemBar : public LLView
{
public:
- struct Params : public LLInitParam::Block<Params, LLView::Params>
- {
- Mandatory<LLTextureView*> texture_view;
- Params()
- : texture_view("texture_view")
- {
- S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
- changeDefault(rect, LLRect(0,0,100,line_height * 4));
- }
- };
-
- LLGLTexMemBar(const Params& p)
- : LLView(p),
- mTextureView(p.texture_view)
- {}
-
- virtual void draw();
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual LLRect getRequiredRect(); // Return the height of this object, given the set options.
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ Mandatory<LLTextureView*> texture_view;
+ Params()
+ : texture_view("texture_view")
+ {
+ S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
+ changeDefault(rect, LLRect(0,0,100,line_height * 4));
+ }
+ };
+
+ LLGLTexMemBar(const Params& p)
+ : LLView(p),
+ mTextureView(p.texture_view)
+ {}
+
+ virtual void draw();
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual LLRect getRequiredRect(); // Return the height of this object, given the set options.
private:
- LLTextureView* mTextureView;
+ LLTextureView* mTextureView;
};
void LLGLTexMemBar::draw()
{
- F32 discard_bias = LLViewerTexture::sDesiredDiscardBias;
- F32 cache_usage = LLAppViewer::getTextureCache()->getUsage().valueInUnits<LLUnits::Megabytes>();
- F32 cache_max_usage = LLAppViewer::getTextureCache()->getMaxUsage().valueInUnits<LLUnits::Megabytes>();
- S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
- S32 v_offset = 0;//(S32)((texture_bar_height + 2.2f) * mTextureView->mNumTextureBars + 2.0f);
- F32Bytes total_texture_downloaded = gTotalTextureData;
- F32Bytes total_object_downloaded = gTotalObjectData;
- U32 total_http_requests = LLAppViewer::getTextureFetch()->getTotalNumHTTPRequests();
- U32 total_active_cached_objects = LLWorld::getInstance()->getNumOfActiveCachedObjects();
- U32 total_objects = gObjectList.getNumObjects();
- F32 x_right = 0.0;
-
- //----------------------------------------------------------------------------
- LLGLSUIDefault gls_ui;
- LLColor4 text_color(1.f, 1.f, 1.f, 0.75f);
- LLColor4 color;
-
- // Gray background using completely magic numbers
- gGL.color4f(0.f, 0.f, 0.f, 0.25f);
- // const LLRect & rect(getRect());
- // gl_rect_2d(-4, v_offset, rect.mRight - rect.mLeft + 2, v_offset + line_height*4);
-
- std::string text = "";
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*6,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ F32 discard_bias = LLViewerTexture::sDesiredDiscardBias;
+ F32 cache_usage = LLAppViewer::getTextureCache()->getUsage().valueInUnits<LLUnits::Megabytes>();
+ F32 cache_max_usage = LLAppViewer::getTextureCache()->getMaxUsage().valueInUnits<LLUnits::Megabytes>();
+ S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
+ S32 v_offset = 0;//(S32)((texture_bar_height + 2.2f) * mTextureView->mNumTextureBars + 2.0f);
+ F32Bytes total_texture_downloaded = gTotalTextureData;
+ F32Bytes total_object_downloaded = gTotalObjectData;
+ U32 total_http_requests = LLAppViewer::getTextureFetch()->getTotalNumHTTPRequests();
+ U32 total_active_cached_objects = LLWorld::getInstance()->getNumOfActiveCachedObjects();
+ U32 total_objects = gObjectList.getNumObjects();
+ F32 x_right = 0.0;
+
+ //----------------------------------------------------------------------------
+ LLGLSUIDefault gls_ui;
+ LLColor4 text_color(1.f, 1.f, 1.f, 0.75f);
+ LLColor4 color;
+
+ // Gray background using completely magic numbers
+ gGL.color4f(0.f, 0.f, 0.f, 0.25f);
+ // const LLRect & rect(getRect());
+ // gl_rect_2d(-4, v_offset, rect.mRight - rect.mLeft + 2, v_offset + line_height*4);
+
+ std::string text = "";
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*6,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
LLTrace::Recording& recording = LLViewerStats::instance().getRecording();
F64 cacheHits = recording.getSampleCount(LLTextureFetch::sCacheHit);
F64 cacheAttempts = recording.getSampleCount(LLTextureFetch::sCacheAttempt);
- F32 cacheHitRate = (cacheAttempts > 0.0) ? F32((cacheHits / cacheAttempts) * 100.0f) : 0.0f;
+ F32 cacheHitRate = (cacheAttempts > 0.0) ? F32((cacheHits / cacheAttempts) * 100.0f) : 0.0f;
U32 cacheReadLatMin = U32(recording.getMin(LLTextureFetch::sCacheReadLatency).value() * 1000.0f);
U32 cacheReadLatMed = U32(recording.getMean(LLTextureFetch::sCacheReadLatency).value() * 1000.0f);
@@ -532,30 +532,30 @@ void LLGLTexMemBar::draw()
text = llformat("GL Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f Cache: %.1f/%.1f MB",
gViewerWindow->getWindow()->getAvailableVRAMMegabytes(),
LLMemory::getAvailableMemKB()/1024,
- LLRenderTarget::sBytesAllocated/(1024*1024),
- discard_bias,
- cache_usage,
- cache_max_usage);
- //, cache_entries, cache_max_entries
-
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*6,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
-
- U32 cache_read(0U), cache_write(0U), res_wait(0U);
- LLAppViewer::getTextureFetch()->getStateStats(&cache_read, &cache_write, &res_wait);
-
- text = llformat("Net Tot Tex: %.1f MB Tot Obj: %.1f MB #Objs/#Cached: %d/%d Tot Htp: %d Cread: %u Cwrite: %u Rwait: %u",
- total_texture_downloaded.valueInUnits<LLUnits::Megabytes>(),
- total_object_downloaded.valueInUnits<LLUnits::Megabytes>(),
- total_objects,
- total_active_cached_objects,
- total_http_requests,
- cache_read,
- cache_write,
- res_wait);
-
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*5,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ LLRenderTarget::sBytesAllocated/(1024*1024),
+ discard_bias,
+ cache_usage,
+ cache_max_usage);
+ //, cache_entries, cache_max_entries
+
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*6,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ U32 cache_read(0U), cache_write(0U), res_wait(0U);
+ LLAppViewer::getTextureFetch()->getStateStats(&cache_read, &cache_write, &res_wait);
+
+ text = llformat("Net Tot Tex: %.1f MB Tot Obj: %.1f MB #Objs/#Cached: %d/%d Tot Htp: %d Cread: %u Cwrite: %u Rwait: %u",
+ total_texture_downloaded.valueInUnits<LLUnits::Megabytes>(),
+ total_object_downloaded.valueInUnits<LLUnits::Megabytes>(),
+ total_objects,
+ total_active_cached_objects,
+ total_http_requests,
+ cache_read,
+ cache_write,
+ res_wait);
+
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*5,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
text = llformat("CacheHitRate: %3.2f Read: %d/%d/%d Decode: %d/%d/%d Fetch: %d/%d/%d",
cacheHitRate,
@@ -569,463 +569,463 @@ void LLGLTexMemBar::draw()
texFetchLatMed,
texFetchLatMax);
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*4,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
-
- //----------------------------------------------------------------------------
-
- text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d RAW:%d HTP:%d DEC:%d CRE:%d ",
- gTextureList.getNumImages(),
- LLAppViewer::getTextureFetch()->getNumRequests(), LLAppViewer::getTextureFetch()->getNumDeletes(),
- LLAppViewer::getTextureFetch()->mPacketCount, LLAppViewer::getTextureFetch()->mBadPacketCount,
- LLAppViewer::getTextureCache()->getNumReads(), LLAppViewer::getTextureCache()->getNumWrites(),
- LLLFSThread::sLocal->getPending(),
- LLImageRaw::sRawImageCount,
- LLAppViewer::getTextureFetch()->getNumHTTPRequests(),
- LLAppViewer::getImageDecodeThread()->getPending(),
- gTextureList.mCreateTextureList.size());
-
- x_right = 550.0;
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*3,
- text_color, LLFontGL::LEFT, LLFontGL::TOP,
- LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &x_right);
-
- F32Kilobits bandwidth(LLAppViewer::getTextureFetch()->getTextureBandwidth());
- F32Kilobits max_bandwidth(gSavedSettings.getF32("ThrottleBandwidthKBPS"));
- color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color;
- color[VALPHA] = text_color[VALPHA];
- text = llformat("BW:%.0f/%.0f",bandwidth.value(), max_bandwidth.value());
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, x_right, v_offset + line_height*3,
- color, LLFontGL::LEFT, LLFontGL::TOP);
-
- // Mesh status line
- text = llformat("Mesh: Reqs(Tot/Htp/Big): %u/%u/%u Rtr/Err: %u/%u Cread/Cwrite: %u/%u Low/At/High: %d/%d/%d",
- LLMeshRepository::sMeshRequestCount, LLMeshRepository::sHTTPRequestCount, LLMeshRepository::sHTTPLargeRequestCount,
- LLMeshRepository::sHTTPRetryCount, LLMeshRepository::sHTTPErrorCount,
- LLMeshRepository::sCacheReads, LLMeshRepository::sCacheWrites,
- LLMeshRepoThread::sRequestLowWater, LLMeshRepoThread::sRequestWaterLevel, LLMeshRepoThread::sRequestHighWater);
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*2,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
-
- // Header for texture table columns
- S32 dx1 = 0;
- if (LLAppViewer::getTextureFetch()->mDebugPause)
- {
- LLFontGL::getFontMonospace()->renderUTF8(std::string("!"), 0, title_x1, v_offset + line_height,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
- dx1 += 8;
- }
- if (mTextureView->mFreezeView)
- {
- LLFontGL::getFontMonospace()->renderUTF8(std::string("*"), 0, title_x1, v_offset + line_height,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
- dx1 += 8;
- }
- if (mTextureView->mOrderFetch)
- {
- LLFontGL::getFontMonospace()->renderUTF8(title_string1b, 0, title_x1+dx1, v_offset + line_height,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
- }
- else
- {
- LLFontGL::getFontMonospace()->renderUTF8(title_string1a, 0, title_x1+dx1, v_offset + line_height,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
- }
-
- LLFontGL::getFontMonospace()->renderUTF8(title_string2, 0, title_x2, v_offset + line_height,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
-
- LLFontGL::getFontMonospace()->renderUTF8(title_string3, 0, title_x3, v_offset + line_height,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
-
- LLFontGL::getFontMonospace()->renderUTF8(title_string4, 0, title_x4, v_offset + line_height,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*4,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ //----------------------------------------------------------------------------
+
+ text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d RAW:%d HTP:%d DEC:%d CRE:%d ",
+ gTextureList.getNumImages(),
+ LLAppViewer::getTextureFetch()->getNumRequests(), LLAppViewer::getTextureFetch()->getNumDeletes(),
+ LLAppViewer::getTextureFetch()->mPacketCount, LLAppViewer::getTextureFetch()->mBadPacketCount,
+ LLAppViewer::getTextureCache()->getNumReads(), LLAppViewer::getTextureCache()->getNumWrites(),
+ LLLFSThread::sLocal->getPending(),
+ LLImageRaw::sRawImageCount,
+ LLAppViewer::getTextureFetch()->getNumHTTPRequests(),
+ LLAppViewer::getImageDecodeThread()->getPending(),
+ gTextureList.mCreateTextureList.size());
+
+ x_right = 550.0;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*3,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP,
+ LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &x_right);
+
+ F32Kilobits bandwidth(LLAppViewer::getTextureFetch()->getTextureBandwidth());
+ F32Kilobits max_bandwidth(gSavedSettings.getF32("ThrottleBandwidthKBPS"));
+ color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color;
+ color[VALPHA] = text_color[VALPHA];
+ text = llformat("BW:%.0f/%.0f",bandwidth.value(), max_bandwidth.value());
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, x_right, v_offset + line_height*3,
+ color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ // Mesh status line
+ text = llformat("Mesh: Reqs(Tot/Htp/Big): %u/%u/%u Rtr/Err: %u/%u Cread/Cwrite: %u/%u Low/At/High: %d/%d/%d",
+ LLMeshRepository::sMeshRequestCount, LLMeshRepository::sHTTPRequestCount, LLMeshRepository::sHTTPLargeRequestCount,
+ LLMeshRepository::sHTTPRetryCount, LLMeshRepository::sHTTPErrorCount,
+ LLMeshRepository::sCacheReads, LLMeshRepository::sCacheWrites,
+ LLMeshRepoThread::sRequestLowWater, LLMeshRepoThread::sRequestWaterLevel, LLMeshRepoThread::sRequestHighWater);
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*2,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ // Header for texture table columns
+ S32 dx1 = 0;
+ if (LLAppViewer::getTextureFetch()->mDebugPause)
+ {
+ LLFontGL::getFontMonospace()->renderUTF8(std::string("!"), 0, title_x1, v_offset + line_height,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ dx1 += 8;
+ }
+ if (mTextureView->mFreezeView)
+ {
+ LLFontGL::getFontMonospace()->renderUTF8(std::string("*"), 0, title_x1, v_offset + line_height,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ dx1 += 8;
+ }
+ if (mTextureView->mOrderFetch)
+ {
+ LLFontGL::getFontMonospace()->renderUTF8(title_string1b, 0, title_x1+dx1, v_offset + line_height,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ }
+ else
+ {
+ LLFontGL::getFontMonospace()->renderUTF8(title_string1a, 0, title_x1+dx1, v_offset + line_height,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ }
+
+ LLFontGL::getFontMonospace()->renderUTF8(title_string2, 0, title_x2, v_offset + line_height,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ LLFontGL::getFontMonospace()->renderUTF8(title_string3, 0, title_x3, v_offset + line_height,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ LLFontGL::getFontMonospace()->renderUTF8(title_string4, 0, title_x4, v_offset + line_height,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
}
BOOL LLGLTexMemBar::handleMouseDown(S32 x, S32 y, MASK mask)
{
- return FALSE;
+ return FALSE;
}
LLRect LLGLTexMemBar::getRequiredRect()
{
- LLRect rect;
- rect.mTop = 78; //LLFontGL::getFontMonospace()->getLineHeight() * 6;
- return rect;
+ LLRect rect;
+ rect.mTop = 78; //LLFontGL::getFontMonospace()->getLineHeight() * 6;
+ return rect;
}
////////////////////////////////////////////////////////////////////////////
class LLGLTexSizeBar
{
public:
- LLGLTexSizeBar(S32 index, S32 left, S32 bottom, S32 right, S32 line_height)
- {
- mIndex = index ;
- mLeft = left ;
- mBottom = bottom ;
- mRight = right ;
- mLineHeight = line_height ;
- mTopLoaded = 0 ;
- mTopBound = 0 ;
- mScale = 1.0f ;
- }
-
- void setTop(S32 loaded, S32 bound, F32 scale) {mTopLoaded = loaded ; mTopBound = bound; mScale = scale ;}
-
- void draw();
- BOOL handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size) ;
-
+ LLGLTexSizeBar(S32 index, S32 left, S32 bottom, S32 right, S32 line_height)
+ {
+ mIndex = index ;
+ mLeft = left ;
+ mBottom = bottom ;
+ mRight = right ;
+ mLineHeight = line_height ;
+ mTopLoaded = 0 ;
+ mTopBound = 0 ;
+ mScale = 1.0f ;
+ }
+
+ void setTop(S32 loaded, S32 bound, F32 scale) {mTopLoaded = loaded ; mTopBound = bound; mScale = scale ;}
+
+ void draw();
+ BOOL handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size) ;
+
private:
- S32 mIndex ;
- S32 mLeft ;
- S32 mBottom ;
- S32 mRight ;
- S32 mTopLoaded ;
- S32 mTopBound ;
- S32 mLineHeight ;
- F32 mScale ;
+ S32 mIndex ;
+ S32 mLeft ;
+ S32 mBottom ;
+ S32 mRight ;
+ S32 mTopLoaded ;
+ S32 mTopBound ;
+ S32 mLineHeight ;
+ F32 mScale ;
};
-BOOL LLGLTexSizeBar::handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size)
+BOOL LLGLTexSizeBar::handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size)
{
- if(y > mBottom && (y < mBottom + (S32)(mTopLoaded * mScale) || y < mBottom + (S32)(mTopBound * mScale)))
- {
- LLImageGL::setCurTexSizebar(mIndex, set_pick_size);
- }
- return TRUE ;
+ if(y > mBottom && (y < mBottom + (S32)(mTopLoaded * mScale) || y < mBottom + (S32)(mTopBound * mScale)))
+ {
+ LLImageGL::setCurTexSizebar(mIndex, set_pick_size);
+ }
+ return TRUE ;
}
void LLGLTexSizeBar::draw()
{
- LLGLSUIDefault gls_ui;
-
- if(LLImageGL::sCurTexSizeBar == mIndex)
- {
- LLColor4 text_color(1.f, 1.f, 1.f, 0.75f);
- std::string text;
-
- text = llformat("%d", mTopLoaded) ;
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, mLeft, mBottom + (S32)(mTopLoaded * mScale) + mLineHeight,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
-
- text = llformat("%d", mTopBound) ;
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, (mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale) + mLineHeight,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
- }
-
- LLColor4 loaded_color(1.0f, 0.0f, 0.0f, 0.75f);
- LLColor4 bound_color(1.0f, 1.0f, 0.0f, 0.75f);
- gl_rect_2d(mLeft, mBottom + (S32)(mTopLoaded * mScale), (mLeft + mRight) / 2, mBottom, loaded_color) ;
- gl_rect_2d((mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale), mRight, mBottom, bound_color) ;
+ LLGLSUIDefault gls_ui;
+
+ if(LLImageGL::sCurTexSizeBar == mIndex)
+ {
+ LLColor4 text_color(1.f, 1.f, 1.f, 0.75f);
+ std::string text;
+
+ text = llformat("%d", mTopLoaded) ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, mLeft, mBottom + (S32)(mTopLoaded * mScale) + mLineHeight,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ text = llformat("%d", mTopBound) ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, (mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale) + mLineHeight,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ }
+
+ LLColor4 loaded_color(1.0f, 0.0f, 0.0f, 0.75f);
+ LLColor4 bound_color(1.0f, 1.0f, 0.0f, 0.75f);
+ gl_rect_2d(mLeft, mBottom + (S32)(mTopLoaded * mScale), (mLeft + mRight) / 2, mBottom, loaded_color) ;
+ gl_rect_2d((mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale), mRight, mBottom, bound_color) ;
}
////////////////////////////////////////////////////////////////////////////
LLTextureView::LLTextureView(const LLTextureView::Params& p)
- : LLContainerView(p),
- mFreezeView(FALSE),
- mOrderFetch(FALSE),
- mPrintList(FALSE),
- mNumTextureBars(0)
+ : LLContainerView(p),
+ mFreezeView(FALSE),
+ mOrderFetch(FALSE),
+ mPrintList(FALSE),
+ mNumTextureBars(0)
{
- setVisible(FALSE);
-
- setDisplayChildren(TRUE);
- mGLTexMemBar = 0;
- mAvatarTexBar = 0;
+ setVisible(FALSE);
+
+ setDisplayChildren(TRUE);
+ mGLTexMemBar = 0;
+ mAvatarTexBar = 0;
}
LLTextureView::~LLTextureView()
{
- // Children all cleaned up by default view destructor.
- delete mGLTexMemBar;
- mGLTexMemBar = 0;
-
- delete mAvatarTexBar;
- mAvatarTexBar = 0;
+ // Children all cleaned up by default view destructor.
+ delete mGLTexMemBar;
+ mGLTexMemBar = 0;
+
+ delete mAvatarTexBar;
+ mAvatarTexBar = 0;
}
typedef std::pair<F32,LLViewerFetchedTexture*> decode_pair_t;
struct compare_decode_pair
{
- bool operator()(const decode_pair_t& a, const decode_pair_t& b) const
- {
- return a.first > b.first;
- }
+ bool operator()(const decode_pair_t& a, const decode_pair_t& b) const
+ {
+ return a.first > b.first;
+ }
};
struct KillView
{
- void operator()(LLView* viewp)
- {
- viewp->getParent()->removeChild(viewp);
- viewp->die();
- }
+ void operator()(LLView* viewp)
+ {
+ viewp->getParent()->removeChild(viewp);
+ viewp->die();
+ }
};
void LLTextureView::draw()
{
- if (!mFreezeView)
- {
-// LLViewerObject *objectp;
-// S32 te;
-
- for_each(mTextureBars.begin(), mTextureBars.end(), KillView());
- mTextureBars.clear();
-
- if (mGLTexMemBar)
- {
- removeChild(mGLTexMemBar);
- mGLTexMemBar->die();
- mGLTexMemBar = 0;
- }
-
- if (mAvatarTexBar)
- {
- removeChild(mAvatarTexBar);
- mAvatarTexBar->die();
- mAvatarTexBar = 0;
- }
-
- typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t;
- display_list_t display_image_list;
-
- if (mPrintList)
- {
- LL_INFOS() << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << LL_ENDL;
- }
-
- for (LLViewerTextureList::image_priority_list_t::iterator iter = gTextureList.mImageList.begin();
- iter != gTextureList.mImageList.end(); )
- {
- LLPointer<LLViewerFetchedTexture> imagep = *iter++;
- if(!imagep->hasFetcher())
- {
- continue ;
- }
-
- S32 cur_discard = imagep->getDiscardLevel();
- S32 desired_discard = imagep->mDesiredDiscardLevel;
-
- if (mPrintList)
- {
- S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory().value() : 0 ;
- LL_INFOS() << imagep->getID()
- << "\t" << tex_mem
- << "\t" << imagep->getBoostLevel()
- << "\t" << imagep->getMaxVirtualSize()
- << "\t" << imagep->getWidth()
- << "\t" << imagep->getHeight()
- << "\t" << cur_discard
- << LL_ENDL;
- }
-
- if (imagep->getID() == LLAppViewer::getTextureFetch()->mDebugID)
- {
-// static S32 debug_count = 0;
-// ++debug_count; // for breakpoints
- }
-
- F32 pri;
- if (mOrderFetch)
- {
- pri = ((F32)imagep->mFetchPriority)/256.f;
- }
- else
- {
- pri = imagep->getMaxVirtualSize();
- }
- pri = llclamp(pri, 0.0f, HIGH_PRIORITY-1.f);
-
- if (sDebugImages.find(imagep) != sDebugImages.end())
- {
- pri += 4*HIGH_PRIORITY;
- }
-
- if (!mOrderFetch)
- {
- if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance())
- {
- struct f : public LLSelectedTEFunctor
- {
- LLViewerFetchedTexture* mImage;
- f(LLViewerFetchedTexture* image) : mImage(image) {}
- virtual bool apply(LLViewerObject* object, S32 te)
- {
- return (mImage == object->getTEImage(te));
- }
- } func(imagep);
- const bool firstonly = true;
- bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly);
- if (match)
- {
- pri += 3*HIGH_PRIORITY;
- }
- }
-
- if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard))
- {
- LLSelectNode* hover_node = LLSelectMgr::instance().getHoverNode();
- if (hover_node)
- {
- LLViewerObject *objectp = hover_node->getObject();
- if (objectp)
- {
- S32 tex_count = objectp->getNumTEs();
- for (S32 i = 0; i < tex_count; i++)
- {
- if (imagep == objectp->getTEImage(i))
- {
- pri += 2*HIGH_PRIORITY;
- break;
- }
- }
- }
- }
- }
-
- if (pri > 0.f && pri < HIGH_PRIORITY)
- {
- if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f ||
- imagep->mFetchDeltaTime < 0.25f)
- {
- pri += 1*HIGH_PRIORITY;
- }
- }
- }
-
- if (pri > 0.0f)
- {
- display_image_list.insert(std::make_pair(pri, imagep));
- }
- }
-
- if (mPrintList)
- {
- mPrintList = FALSE;
- }
-
- static S32 max_count = 50;
- S32 count = 0;
- mNumTextureBars = 0 ;
- for (display_list_t::iterator iter = display_image_list.begin();
- iter != display_image_list.end(); iter++)
- {
- LLViewerFetchedTexture* imagep = iter->second;
- S32 hilite = 0;
- F32 pri = iter->first;
- if (pri >= 1 * HIGH_PRIORITY)
- {
- hilite = (S32)((pri+1) / HIGH_PRIORITY) - 1;
- }
- if ((hilite || count < max_count-10) && (count < max_count))
- {
- if (addBar(imagep, hilite))
- {
- count++;
- }
- }
- }
-
- if (mOrderFetch)
- sortChildren(LLTextureBar::sort_fetch());
- else
- sortChildren(LLTextureBar::sort());
-
- LLGLTexMemBar::Params tmbp;
- LLRect tmbr;
- tmbp.name("gl texmem bar");
- tmbp.rect(tmbr);
- tmbp.follows.flags = FOLLOWS_LEFT|FOLLOWS_TOP;
- tmbp.texture_view(this);
- mGLTexMemBar = LLUICtrlFactory::create<LLGLTexMemBar>(tmbp);
- addChild(mGLTexMemBar);
- sendChildToFront(mGLTexMemBar);
-
- LLAvatarTexBar::Params atbp;
- LLRect atbr;
- atbp.name("gl avatartex bar");
- atbp.texture_view(this);
- atbp.rect(atbr);
- mAvatarTexBar = LLUICtrlFactory::create<LLAvatarTexBar>(atbp);
- addChild(mAvatarTexBar);
- sendChildToFront(mAvatarTexBar);
-
- reshape(getRect().getWidth(), getRect().getHeight(), TRUE);
-
- LLUI::popMatrix();
- LLUI::pushMatrix();
- LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom);
-
- for (child_list_const_iter_t child_iter = getChildList()->begin();
- child_iter != getChildList()->end(); ++child_iter)
- {
- LLView *viewp = *child_iter;
- if (viewp->getRect().mBottom < 0)
- {
- viewp->setVisible(FALSE);
- }
- }
- }
-
- LLContainerView::draw();
+ if (!mFreezeView)
+ {
+// LLViewerObject *objectp;
+// S32 te;
+
+ for_each(mTextureBars.begin(), mTextureBars.end(), KillView());
+ mTextureBars.clear();
+
+ if (mGLTexMemBar)
+ {
+ removeChild(mGLTexMemBar);
+ mGLTexMemBar->die();
+ mGLTexMemBar = 0;
+ }
+
+ if (mAvatarTexBar)
+ {
+ removeChild(mAvatarTexBar);
+ mAvatarTexBar->die();
+ mAvatarTexBar = 0;
+ }
+
+ typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t;
+ display_list_t display_image_list;
+
+ if (mPrintList)
+ {
+ LL_INFOS() << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << LL_ENDL;
+ }
+
+ for (LLViewerTextureList::image_priority_list_t::iterator iter = gTextureList.mImageList.begin();
+ iter != gTextureList.mImageList.end(); )
+ {
+ LLPointer<LLViewerFetchedTexture> imagep = *iter++;
+ if(!imagep->hasFetcher())
+ {
+ continue ;
+ }
+
+ S32 cur_discard = imagep->getDiscardLevel();
+ S32 desired_discard = imagep->mDesiredDiscardLevel;
+
+ if (mPrintList)
+ {
+ S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory().value() : 0 ;
+ LL_INFOS() << imagep->getID()
+ << "\t" << tex_mem
+ << "\t" << imagep->getBoostLevel()
+ << "\t" << imagep->getMaxVirtualSize()
+ << "\t" << imagep->getWidth()
+ << "\t" << imagep->getHeight()
+ << "\t" << cur_discard
+ << LL_ENDL;
+ }
+
+ if (imagep->getID() == LLAppViewer::getTextureFetch()->mDebugID)
+ {
+// static S32 debug_count = 0;
+// ++debug_count; // for breakpoints
+ }
+
+ F32 pri;
+ if (mOrderFetch)
+ {
+ pri = ((F32)imagep->mFetchPriority)/256.f;
+ }
+ else
+ {
+ pri = imagep->getMaxVirtualSize();
+ }
+ pri = llclamp(pri, 0.0f, HIGH_PRIORITY-1.f);
+
+ if (sDebugImages.find(imagep) != sDebugImages.end())
+ {
+ pri += 4*HIGH_PRIORITY;
+ }
+
+ if (!mOrderFetch)
+ {
+ if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance())
+ {
+ struct f : public LLSelectedTEFunctor
+ {
+ LLViewerFetchedTexture* mImage;
+ f(LLViewerFetchedTexture* image) : mImage(image) {}
+ virtual bool apply(LLViewerObject* object, S32 te)
+ {
+ return (mImage == object->getTEImage(te));
+ }
+ } func(imagep);
+ const bool firstonly = true;
+ bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly);
+ if (match)
+ {
+ pri += 3*HIGH_PRIORITY;
+ }
+ }
+
+ if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard))
+ {
+ LLSelectNode* hover_node = LLSelectMgr::instance().getHoverNode();
+ if (hover_node)
+ {
+ LLViewerObject *objectp = hover_node->getObject();
+ if (objectp)
+ {
+ S32 tex_count = objectp->getNumTEs();
+ for (S32 i = 0; i < tex_count; i++)
+ {
+ if (imagep == objectp->getTEImage(i))
+ {
+ pri += 2*HIGH_PRIORITY;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (pri > 0.f && pri < HIGH_PRIORITY)
+ {
+ if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f ||
+ imagep->mFetchDeltaTime < 0.25f)
+ {
+ pri += 1*HIGH_PRIORITY;
+ }
+ }
+ }
+
+ if (pri > 0.0f)
+ {
+ display_image_list.insert(std::make_pair(pri, imagep));
+ }
+ }
+
+ if (mPrintList)
+ {
+ mPrintList = FALSE;
+ }
+
+ static S32 max_count = 50;
+ S32 count = 0;
+ mNumTextureBars = 0 ;
+ for (display_list_t::iterator iter = display_image_list.begin();
+ iter != display_image_list.end(); iter++)
+ {
+ LLViewerFetchedTexture* imagep = iter->second;
+ S32 hilite = 0;
+ F32 pri = iter->first;
+ if (pri >= 1 * HIGH_PRIORITY)
+ {
+ hilite = (S32)((pri+1) / HIGH_PRIORITY) - 1;
+ }
+ if ((hilite || count < max_count-10) && (count < max_count))
+ {
+ if (addBar(imagep, hilite))
+ {
+ count++;
+ }
+ }
+ }
+
+ if (mOrderFetch)
+ sortChildren(LLTextureBar::sort_fetch());
+ else
+ sortChildren(LLTextureBar::sort());
+
+ LLGLTexMemBar::Params tmbp;
+ LLRect tmbr;
+ tmbp.name("gl texmem bar");
+ tmbp.rect(tmbr);
+ tmbp.follows.flags = FOLLOWS_LEFT|FOLLOWS_TOP;
+ tmbp.texture_view(this);
+ mGLTexMemBar = LLUICtrlFactory::create<LLGLTexMemBar>(tmbp);
+ addChild(mGLTexMemBar);
+ sendChildToFront(mGLTexMemBar);
+
+ LLAvatarTexBar::Params atbp;
+ LLRect atbr;
+ atbp.name("gl avatartex bar");
+ atbp.texture_view(this);
+ atbp.rect(atbr);
+ mAvatarTexBar = LLUICtrlFactory::create<LLAvatarTexBar>(atbp);
+ addChild(mAvatarTexBar);
+ sendChildToFront(mAvatarTexBar);
+
+ reshape(getRect().getWidth(), getRect().getHeight(), TRUE);
+
+ LLUI::popMatrix();
+ LLUI::pushMatrix();
+ LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom);
+
+ for (child_list_const_iter_t child_iter = getChildList()->begin();
+ child_iter != getChildList()->end(); ++child_iter)
+ {
+ LLView *viewp = *child_iter;
+ if (viewp->getRect().mBottom < 0)
+ {
+ viewp->setVisible(FALSE);
+ }
+ }
+ }
+
+ LLContainerView::draw();
}
BOOL LLTextureView::addBar(LLViewerFetchedTexture *imagep, S32 hilite)
{
- llassert(imagep);
-
- LLTextureBar *barp;
- LLRect r;
+ llassert(imagep);
+
+ LLTextureBar *barp;
+ LLRect r;
- mNumTextureBars++;
+ mNumTextureBars++;
- LLTextureBar::Params tbp;
- tbp.name("texture bar");
- tbp.rect(r);
- tbp.texture_view(this);
- barp = LLUICtrlFactory::create<LLTextureBar>(tbp);
- barp->mImagep = imagep;
- barp->mHilite = hilite;
+ LLTextureBar::Params tbp;
+ tbp.name("texture bar");
+ tbp.rect(r);
+ tbp.texture_view(this);
+ barp = LLUICtrlFactory::create<LLTextureBar>(tbp);
+ barp->mImagep = imagep;
+ barp->mHilite = hilite;
- addChild(barp);
- mTextureBars.push_back(barp);
+ addChild(barp);
+ mTextureBars.push_back(barp);
- return TRUE;
+ return TRUE;
}
BOOL LLTextureView::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if ((mask & (MASK_CONTROL|MASK_SHIFT|MASK_ALT)) == (MASK_ALT|MASK_SHIFT))
- {
- mPrintList = TRUE;
- return TRUE;
- }
- if ((mask & (MASK_CONTROL|MASK_SHIFT|MASK_ALT)) == (MASK_CONTROL|MASK_SHIFT))
- {
- LLAppViewer::getTextureFetch()->mDebugPause = !LLAppViewer::getTextureFetch()->mDebugPause;
- return TRUE;
- }
- if (mask & MASK_SHIFT)
- {
- mFreezeView = !mFreezeView;
- return TRUE;
- }
- if (mask & MASK_CONTROL)
- {
- mOrderFetch = !mOrderFetch;
- return TRUE;
- }
- return LLView::handleMouseDown(x,y,mask);
+ if ((mask & (MASK_CONTROL|MASK_SHIFT|MASK_ALT)) == (MASK_ALT|MASK_SHIFT))
+ {
+ mPrintList = TRUE;
+ return TRUE;
+ }
+ if ((mask & (MASK_CONTROL|MASK_SHIFT|MASK_ALT)) == (MASK_CONTROL|MASK_SHIFT))
+ {
+ LLAppViewer::getTextureFetch()->mDebugPause = !LLAppViewer::getTextureFetch()->mDebugPause;
+ return TRUE;
+ }
+ if (mask & MASK_SHIFT)
+ {
+ mFreezeView = !mFreezeView;
+ return TRUE;
+ }
+ if (mask & MASK_CONTROL)
+ {
+ mOrderFetch = !mOrderFetch;
+ return TRUE;
+ }
+ return LLView::handleMouseDown(x,y,mask);
}
BOOL LLTextureView::handleMouseUp(S32 x, S32 y, MASK mask)
{
- return FALSE;
+ return FALSE;
}
BOOL LLTextureView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
{
- return FALSE;
+ return FALSE;
}
diff --git a/indra/newview/lltextureview.h b/indra/newview/lltextureview.h
index 900b4e17d8..7e95f0f149 100644
--- a/indra/newview/lltextureview.h
+++ b/indra/newview/lltextureview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltextureview.h
* @brief LLTextureView class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,42 +36,42 @@ class LLAvatarTexBar;
class LLTextureView : public LLContainerView
{
- friend class LLTextureBar;
- friend class LLGLTexMemBar;
- friend class LLAvatarTexBar;
+ friend class LLTextureBar;
+ friend class LLGLTexMemBar;
+ friend class LLAvatarTexBar;
protected:
- LLTextureView(const Params&);
- friend class LLUICtrlFactory;
+ LLTextureView(const Params&);
+ friend class LLUICtrlFactory;
public:
- ~LLTextureView();
+ ~LLTextureView();
- /*virtual*/ void draw();
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
- static void addDebugImage(LLViewerFetchedTexture* image) { sDebugImages.insert(image); }
- static void removeDebugImage(LLViewerFetchedTexture* image) { sDebugImages.insert(image); }
- static void clearDebugImages() { sDebugImages.clear(); }
+ static void addDebugImage(LLViewerFetchedTexture* image) { sDebugImages.insert(image); }
+ static void removeDebugImage(LLViewerFetchedTexture* image) { sDebugImages.insert(image); }
+ static void clearDebugImages() { sDebugImages.clear(); }
private:
- BOOL addBar(LLViewerFetchedTexture *image, BOOL hilight = FALSE);
- void removeAllBars();
+ BOOL addBar(LLViewerFetchedTexture *image, BOOL hilight = FALSE);
+ void removeAllBars();
private:
- BOOL mFreezeView;
- BOOL mOrderFetch;
- BOOL mPrintList;
-
- LLTextBox *mInfoTextp;
+ BOOL mFreezeView;
+ BOOL mOrderFetch;
+ BOOL mPrintList;
+
+ LLTextBox *mInfoTextp;
- std::vector<LLTextureBar*> mTextureBars;
- U32 mNumTextureBars;
+ std::vector<LLTextureBar*> mTextureBars;
+ U32 mNumTextureBars;
- LLGLTexMemBar* mGLTexMemBar;
- LLAvatarTexBar* mAvatarTexBar;
+ LLGLTexMemBar* mGLTexMemBar;
+ LLAvatarTexBar* mAvatarTexBar;
public:
- static std::set<LLViewerFetchedTexture*> sDebugImages;
+ static std::set<LLViewerFetchedTexture*> sDebugImages;
};
class LLGLTexSizeBar;
diff --git a/indra/newview/llthumbnailctrl.cpp b/indra/newview/llthumbnailctrl.cpp
index b558c249cb..8291b0b061 100644
--- a/indra/newview/llthumbnailctrl.cpp
+++ b/indra/newview/llthumbnailctrl.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llthumbnailctrl.cpp
* @brief LLThumbnailCtrl base class
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,7 +51,7 @@ LLThumbnailCtrl::Params::Params()
{}
LLThumbnailCtrl::LLThumbnailCtrl(const LLThumbnailCtrl::Params& p)
-: LLUICtrl(p)
+: LLUICtrl(p)
, mBorderColor(p.border_color())
, mBorderVisible(p.border_visible())
, mFallbackImagep(p.fallback_image)
@@ -61,14 +61,14 @@ LLThumbnailCtrl::LLThumbnailCtrl(const LLThumbnailCtrl::Params& p)
, mInitImmediately(true)
{
mLoadingPlaceholderString = LLTrans::getString("texture_loading");
-
+
LLRect border_rect = getLocalRect();
LLViewBorder::Params vbparams(p.border);
vbparams.name("border");
vbparams.rect(border_rect);
mBorder = LLUICtrlFactory::create<LLViewBorder> (vbparams);
addChild(mBorder);
-
+
if (p.image_name.isProvided())
{
setValue(p.image_name());
@@ -77,7 +77,7 @@ LLThumbnailCtrl::LLThumbnailCtrl(const LLThumbnailCtrl::Params& p)
LLThumbnailCtrl::~LLThumbnailCtrl()
{
- mTexturep = nullptr;
+ mTexturep = nullptr;
mImagep = nullptr;
mFallbackImagep = nullptr;
}
@@ -90,11 +90,11 @@ void LLThumbnailCtrl::draw()
initImage();
}
LLRect draw_rect = getLocalRect();
-
+
if (mBorderVisible)
{
mBorder->setKeyboardFocusHighlight(hasFocus());
-
+
gl_rect_2d( draw_rect, mBorderColor.get(), FALSE );
draw_rect.stretch( -1 );
}
@@ -108,9 +108,9 @@ void LLThumbnailCtrl::draw()
const LLColor4 color(.098f, .098f, .098f);
gl_rect_2d( draw_rect, color, TRUE);
}
-
+
gl_draw_scaled_image( draw_rect.mLeft, draw_rect.mBottom, draw_rect.getWidth(), draw_rect.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
-
+
mTexturep->setKnownDrawSize(draw_rect.getWidth(), draw_rect.getHeight());
}
else if( mImagep.notNull() )
@@ -195,15 +195,15 @@ void LLThumbnailCtrl::clearTexture()
// value might be a string or a UUID
void LLThumbnailCtrl::setValue(const LLSD& value)
{
- LLSD tvalue(value);
- if (value.isString() && LLUUID::validate(value.asString()))
- {
- //RN: support UUIDs masquerading as strings
- tvalue = LLSD(LLUUID(value.asString()));
- }
-
- LLUICtrl::setValue(tvalue);
-
+ LLSD tvalue(value);
+ if (value.isString() && LLUUID::validate(value.asString()))
+ {
+ //RN: support UUIDs masquerading as strings
+ tvalue = LLSD(LLUUID(value.asString()));
+ }
+
+ LLUICtrl::setValue(tvalue);
+
unloadImage();
if (mInitImmediately)
diff --git a/indra/newview/llthumbnailctrl.h b/indra/newview/llthumbnailctrl.h
index f84a583271..45cc6e541e 100644
--- a/indra/newview/llthumbnailctrl.h
+++ b/indra/newview/llthumbnailctrl.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llthumbnailctrl.h
* @brief LLThumbnailCtrl base class
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023 Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,13 +39,13 @@ class LLViewerFetchedTexture;
// Classes
//
-//
+//
class LLThumbnailCtrl
: public LLUICtrl
{
public:
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
Optional<LLViewBorder::Params> border;
Optional<LLUIColor> border_color;
Optional<std::string> image_name;
@@ -53,29 +53,29 @@ public:
Optional<bool> border_visible;
Optional<bool> interactable;
Optional<bool> show_loading;
-
- Params();
- };
+
+ Params();
+ };
protected:
LLThumbnailCtrl(const Params&);
- friend class LLUICtrlFactory;
+ friend class LLUICtrlFactory;
public:
- virtual ~LLThumbnailCtrl();
+ virtual ~LLThumbnailCtrl();
- virtual void draw() override;
+ virtual void draw() override;
void setVisible(BOOL visible) override;
- virtual void setValue(const LLSD& value ) override;
+ virtual void setValue(const LLSD& value ) override;
void setInitImmediately(bool val) { mInitImmediately = val; }
void clearTexture();
-
+
virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
protected:
void initImage();
void unloadImage();
-
+
private:
bool mBorderVisible;
bool mInteractable;
@@ -86,8 +86,8 @@ private:
LLUUID mImageAssetID;
LLViewBorder* mBorder;
LLUIColor mBorderColor;
-
- LLPointer<LLViewerFetchedTexture> mTexturep;
+
+ LLPointer<LLViewerFetchedTexture> mTexturep;
LLPointer<LLUIImage> mImagep;
LLPointer<LLUIImage> mFallbackImagep;
};
diff --git a/indra/newview/lltinygltfhelper.cpp b/indra/newview/lltinygltfhelper.cpp
index 5b75db37d0..cd1b071574 100644
--- a/indra/newview/lltinygltfhelper.cpp
+++ b/indra/newview/lltinygltfhelper.cpp
@@ -187,7 +187,7 @@ LLImageRaw * LLTinyGLTFHelper::getTexture(const std::string & folder, const tiny
bool LLTinyGLTFHelper::loadModel(const std::string& filename, tinygltf::Model& model_in)
{
std::string exten = gDirUtilp->getExtension(filename);
-
+
if (exten == "gltf" || exten == "glb")
{
tinygltf::TinyGLTF loader;
@@ -224,7 +224,7 @@ bool LLTinyGLTFHelper::loadModel(const std::string& filename, tinygltf::Model& m
LL_WARNS("GLTF") << "Cannot load. File has no materials " << filename << LL_ENDL;
return false;
}
-
+
return true;
}
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 223aaad811..2e00b2c382 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoast.cpp
* @brief This class implements a placeholder for any notification panel.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,183 +38,183 @@ std::list<LLToast*> LLToast::sModalToastsList;
//--------------------------------------------------------------------------
LLToastLifeTimer::LLToastLifeTimer(LLToast* toast, F32 period)
- : mToast(toast),
- LLEventTimer(period)
+ : mToast(toast),
+ LLEventTimer(period)
{
}
/*virtual*/
BOOL LLToastLifeTimer::tick()
{
- if (mEventTimer.hasExpired())
- {
- mToast->expire();
- }
- return FALSE;
+ if (mEventTimer.hasExpired())
+ {
+ mToast->expire();
+ }
+ return FALSE;
}
void LLToastLifeTimer::stop()
{
- mEventTimer.stop();
+ mEventTimer.stop();
}
void LLToastLifeTimer::start()
{
- mEventTimer.start();
+ mEventTimer.start();
}
void LLToastLifeTimer::restart()
{
- mEventTimer.reset();
+ mEventTimer.reset();
}
BOOL LLToastLifeTimer::getStarted()
{
- return mEventTimer.getStarted();
+ return mEventTimer.getStarted();
}
void LLToastLifeTimer::setPeriod(F32 period)
{
- mPeriod = period;
+ mPeriod = period;
}
F32 LLToastLifeTimer::getRemainingTimeF32()
{
- F32 et = mEventTimer.getElapsedTimeF32();
- if (!getStarted() || et > mPeriod) return 0.0f;
- return mPeriod - et;
+ F32 et = mEventTimer.getElapsedTimeF32();
+ if (!getStarted() || et > mPeriod) return 0.0f;
+ return mPeriod - et;
}
//--------------------------------------------------------------------------
-LLToast::Params::Params()
-: can_fade("can_fade", true),
- can_be_stored("can_be_stored", true),
- is_modal("is_modal", false),
- is_tip("is_tip", false),
- enable_hide_btn("enable_hide_btn", true),
- force_show("force_show", false),
- force_store("force_store", false),
- fading_time_secs("fading_time_secs", gSavedSettings.getS32("ToastFadingTime")),
- lifetime_secs("lifetime_secs", gSavedSettings.getS32("NotificationToastLifeTime"))
+LLToast::Params::Params()
+: can_fade("can_fade", true),
+ can_be_stored("can_be_stored", true),
+ is_modal("is_modal", false),
+ is_tip("is_tip", false),
+ enable_hide_btn("enable_hide_btn", true),
+ force_show("force_show", false),
+ force_store("force_store", false),
+ fading_time_secs("fading_time_secs", gSavedSettings.getS32("ToastFadingTime")),
+ lifetime_secs("lifetime_secs", gSavedSettings.getS32("NotificationToastLifeTime"))
{};
-LLToast::LLToast(const LLToast::Params& p)
-: LLModalDialog(LLSD(), p.is_modal),
- mToastLifetime(p.lifetime_secs),
- mToastFadingTime(p.fading_time_secs),
- mNotificationID(p.notif_id),
- mSessionID(p.session_id),
- mCanFade(p.can_fade),
- mCanBeStored(p.can_be_stored),
- mHideBtnEnabled(p.enable_hide_btn),
- mHideBtn(NULL),
- mPanel(NULL),
- mNotification(p.notification),
- mIsHidden(false),
- mHideBtnPressed(false),
- mIsTip(p.is_tip),
- mWrapperPanel(NULL),
- mIsFading(false),
- mIsHovered(false)
-{
- mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs));
-
- buildFromFile("panel_toast.xml");
-
- setCanDrag(FALSE);
-
- mWrapperPanel = getChild<LLPanel>("wrapper_panel");
-
- setBackgroundOpaque(TRUE); // *TODO: obsolete
- updateTransparency();
-
- if(p.panel())
- {
- insertPanel(p.panel);
- }
-
- if(mHideBtnEnabled)
- {
- mHideBtn = getChild<LLButton>("hide_btn");
- mHideBtn->setClickedCallback(boost::bind(&LLToast::hide,this));
- }
-
- // init callbacks if present
- if(!p.on_delete_toast().empty())
- {
- mOnDeleteToastSignal.connect(p.on_delete_toast());
- }
-
- if (isModal())
- {
- sModalToastsList.push_front(this);
- }
+LLToast::LLToast(const LLToast::Params& p)
+: LLModalDialog(LLSD(), p.is_modal),
+ mToastLifetime(p.lifetime_secs),
+ mToastFadingTime(p.fading_time_secs),
+ mNotificationID(p.notif_id),
+ mSessionID(p.session_id),
+ mCanFade(p.can_fade),
+ mCanBeStored(p.can_be_stored),
+ mHideBtnEnabled(p.enable_hide_btn),
+ mHideBtn(NULL),
+ mPanel(NULL),
+ mNotification(p.notification),
+ mIsHidden(false),
+ mHideBtnPressed(false),
+ mIsTip(p.is_tip),
+ mWrapperPanel(NULL),
+ mIsFading(false),
+ mIsHovered(false)
+{
+ mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs));
+
+ buildFromFile("panel_toast.xml");
+
+ setCanDrag(FALSE);
+
+ mWrapperPanel = getChild<LLPanel>("wrapper_panel");
+
+ setBackgroundOpaque(TRUE); // *TODO: obsolete
+ updateTransparency();
+
+ if(p.panel())
+ {
+ insertPanel(p.panel);
+ }
+
+ if(mHideBtnEnabled)
+ {
+ mHideBtn = getChild<LLButton>("hide_btn");
+ mHideBtn->setClickedCallback(boost::bind(&LLToast::hide,this));
+ }
+
+ // init callbacks if present
+ if(!p.on_delete_toast().empty())
+ {
+ mOnDeleteToastSignal.connect(p.on_delete_toast());
+ }
+
+ if (isModal())
+ {
+ sModalToastsList.push_front(this);
+ }
}
void LLToast::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- // We shouldn't use reshape from LLModalDialog since it changes toasts position.
- // Toasts position should be controlled only by toast screen channel, see LLScreenChannelBase.
- // see EXT-8044
- LLFloater::reshape(width, height, called_from_parent);
+ // We shouldn't use reshape from LLModalDialog since it changes toasts position.
+ // Toasts position should be controlled only by toast screen channel, see LLScreenChannelBase.
+ // see EXT-8044
+ LLFloater::reshape(width, height, called_from_parent);
}
//--------------------------------------------------------------------------
BOOL LLToast::postBuild()
{
- if(!mCanFade)
- {
- mTimer->stop();
- }
+ if(!mCanFade)
+ {
+ mTimer->stop();
+ }
- return TRUE;
+ return TRUE;
}
//--------------------------------------------------------------------------
void LLToast::setHideButtonEnabled(bool enabled)
{
- if(mHideBtn)
- mHideBtn->setEnabled(enabled);
+ if(mHideBtn)
+ mHideBtn->setEnabled(enabled);
}
//--------------------------------------------------------------------------
LLToast::~LLToast()
{
- if(LLApp::isQuitting())
- {
- mOnFadeSignal.disconnect_all_slots();
- mOnDeleteToastSignal.disconnect_all_slots();
- mOnToastDestroyedSignal.disconnect_all_slots();
- mOnToastHoverSignal.disconnect_all_slots();
- mToastMouseEnterSignal.disconnect_all_slots();
- mToastMouseLeaveSignal.disconnect_all_slots();
- }
- else
- {
- mOnToastDestroyedSignal(this);
- }
-
- if (isModal())
- {
- std::list<LLToast*>::iterator iter = std::find(sModalToastsList.begin(), sModalToastsList.end(), this);
- if (iter != sModalToastsList.end())
- {
- sModalToastsList.erase(iter);
- }
- }
+ if(LLApp::isQuitting())
+ {
+ mOnFadeSignal.disconnect_all_slots();
+ mOnDeleteToastSignal.disconnect_all_slots();
+ mOnToastDestroyedSignal.disconnect_all_slots();
+ mOnToastHoverSignal.disconnect_all_slots();
+ mToastMouseEnterSignal.disconnect_all_slots();
+ mToastMouseLeaveSignal.disconnect_all_slots();
+ }
+ else
+ {
+ mOnToastDestroyedSignal(this);
+ }
+
+ if (isModal())
+ {
+ std::list<LLToast*>::iterator iter = std::find(sModalToastsList.begin(), sModalToastsList.end(), this);
+ if (iter != sModalToastsList.end())
+ {
+ sModalToastsList.erase(iter);
+ }
+ }
}
//--------------------------------------------------------------------------
void LLToast::hide()
{
- if (!mIsHidden)
- {
- setVisible(FALSE);
- setFading(false);
- mTimer->stop();
- mIsHidden = true;
- mOnFadeSignal(this);
- }
+ if (!mIsHidden)
+ {
+ setVisible(FALSE);
+ setFading(false);
+ mTimer->stop();
+ mIsHidden = true;
+ mOnFadeSignal(this);
+ }
}
/*virtual*/
@@ -238,188 +238,188 @@ void LLToast::setFocus(BOOL b)
void LLToast::onFocusLost()
{
- if(mWrapperPanel && !isBackgroundVisible())
- {
- // Lets make wrapper panel behave like a floater
- updateTransparency();
- }
+ if(mWrapperPanel && !isBackgroundVisible())
+ {
+ // Lets make wrapper panel behave like a floater
+ updateTransparency();
+ }
}
void LLToast::onFocusReceived()
{
- if(mWrapperPanel && !isBackgroundVisible())
- {
- // Lets make wrapper panel behave like a floater
- updateTransparency();
- }
+ if(mWrapperPanel && !isBackgroundVisible())
+ {
+ // Lets make wrapper panel behave like a floater
+ updateTransparency();
+ }
}
void LLToast::setLifetime(S32 seconds)
{
- mToastLifetime = seconds;
+ mToastLifetime = seconds;
}
void LLToast::setFadingTime(S32 seconds)
{
- mToastFadingTime = seconds;
+ mToastFadingTime = seconds;
}
void LLToast::closeToast()
{
- mOnDeleteToastSignal(this);
+ mOnDeleteToastSignal(this);
- setSoundFlags(SILENT);
+ setSoundFlags(SILENT);
- closeFloater();
+ closeFloater();
}
S32 LLToast::getTopPad()
{
- if(mWrapperPanel)
- {
- return getRect().getHeight() - mWrapperPanel->getRect().getHeight();
- }
- return 0;
+ if(mWrapperPanel)
+ {
+ return getRect().getHeight() - mWrapperPanel->getRect().getHeight();
+ }
+ return 0;
}
S32 LLToast::getRightPad()
{
- if(mWrapperPanel)
- {
- return getRect().getWidth() - mWrapperPanel->getRect().getWidth();
- }
- return 0;
+ if(mWrapperPanel)
+ {
+ return getRect().getWidth() - mWrapperPanel->getRect().getWidth();
+ }
+ return 0;
}
//--------------------------------------------------------------------------
-void LLToast::setCanFade(bool can_fade)
-{
- mCanFade = can_fade;
- if(!mCanFade)
- {
- mTimer->stop();
- }
+void LLToast::setCanFade(bool can_fade)
+{
+ mCanFade = can_fade;
+ if(!mCanFade)
+ {
+ mTimer->stop();
+ }
}
//--------------------------------------------------------------------------
void LLToast::expire()
{
- if (mCanFade)
- {
- if (mIsFading)
- {
- // Fade timer expired. Time to hide.
- hide();
- }
- else
- {
- // "Life" time has ended. Time to fade.
- setFading(true);
- mTimer->restart();
- }
- }
+ if (mCanFade)
+ {
+ if (mIsFading)
+ {
+ // Fade timer expired. Time to hide.
+ hide();
+ }
+ else
+ {
+ // "Life" time has ended. Time to fade.
+ setFading(true);
+ mTimer->restart();
+ }
+ }
}
void LLToast::setFading(bool transparent)
{
- mIsFading = transparent;
- updateTransparency();
+ mIsFading = transparent;
+ updateTransparency();
- if (transparent)
- {
- mTimer->setPeriod(mToastFadingTime);
- }
- else
- {
- mTimer->setPeriod(mToastLifetime);
- }
+ if (transparent)
+ {
+ mTimer->setPeriod(mToastFadingTime);
+ }
+ else
+ {
+ mTimer->setPeriod(mToastLifetime);
+ }
}
F32 LLToast::getTimeLeftToLive()
{
- F32 time_to_live = mTimer->getRemainingTimeF32();
+ F32 time_to_live = mTimer->getRemainingTimeF32();
- if (!mIsFading)
- {
- time_to_live += mToastFadingTime;
- }
+ if (!mIsFading)
+ {
+ time_to_live += mToastFadingTime;
+ }
- return time_to_live;
+ return time_to_live;
}
//--------------------------------------------------------------------------
void LLToast::reshapeToPanel()
{
- LLPanel* panel = getPanel();
- if(!panel)
- return;
+ LLPanel* panel = getPanel();
+ if(!panel)
+ return;
+
+ LLRect panel_rect = panel->getLocalRect();
+ panel->setShape(panel_rect);
- LLRect panel_rect = panel->getLocalRect();
- panel->setShape(panel_rect);
-
- LLRect toast_rect = getRect();
+ LLRect toast_rect = getRect();
- toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop,
- panel_rect.getWidth() + getRightPad(), panel_rect.getHeight() + getTopPad());
- setShape(toast_rect);
+ toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop,
+ panel_rect.getWidth() + getRightPad(), panel_rect.getHeight() + getTopPad());
+ setShape(toast_rect);
}
void LLToast::insertPanel(LLPanel* panel)
{
- mPanel = panel;
- mWrapperPanel->addChild(panel);
- reshapeToPanel();
+ mPanel = panel;
+ mWrapperPanel->addChild(panel);
+ reshapeToPanel();
}
//--------------------------------------------------------------------------
void LLToast::draw()
{
- LLFloater::draw();
+ LLFloater::draw();
- if(!isBackgroundVisible())
- {
- // Floater background is invisible, lets make wrapper panel look like a
- // floater - draw shadow.
- drawShadow(mWrapperPanel);
-
- // Shadow will probably overlap close button, lets redraw the button
- if(mHideBtn)
- {
- drawChild(mHideBtn);
- }
- }
+ if(!isBackgroundVisible())
+ {
+ // Floater background is invisible, lets make wrapper panel look like a
+ // floater - draw shadow.
+ drawShadow(mWrapperPanel);
+
+ // Shadow will probably overlap close button, lets redraw the button
+ if(mHideBtn)
+ {
+ drawChild(mHideBtn);
+ }
+ }
}
//--------------------------------------------------------------------------
void LLToast::setVisible(BOOL show)
{
- if(mIsHidden)
- {
- // this toast is invisible after fade until its ScreenChannel will allow it
- //
- // (EXT-1849) according to this bug a toast can be resurrected from
- // invisible state if it faded during a teleportation
- // then it fades a second time and causes a crash
- return;
- }
-
- if (show && getVisible())
- {
- return;
- }
-
- if(show)
- {
- if(!mTimer->getStarted() && mCanFade)
- {
- mTimer->start();
- }
- }
- else
- {
- //hide "hide" button in case toast was hidden without mouse_leave
- if(mHideBtn)
- mHideBtn->setVisible(show);
+ if(mIsHidden)
+ {
+ // this toast is invisible after fade until its ScreenChannel will allow it
+ //
+ // (EXT-1849) according to this bug a toast can be resurrected from
+ // invisible state if it faded during a teleportation
+ // then it fades a second time and causes a crash
+ return;
+ }
+
+ if (show && getVisible())
+ {
+ return;
+ }
+
+ if(show)
+ {
+ if(!mTimer->getStarted() && mCanFade)
+ {
+ mTimer->start();
+ }
+ }
+ else
+ {
+ //hide "hide" button in case toast was hidden without mouse_leave
+ if(mHideBtn)
+ mHideBtn->setVisible(show);
}
LLFloater::setVisible(show);
if (mPanel
@@ -436,198 +436,198 @@ void LLToast::setVisible(BOOL show)
void LLToast::updateHoveredState()
{
- S32 x, y;
- LLUI::getInstance()->getMousePositionScreen(&x, &y);
-
- LLRect panel_rc = mWrapperPanel->calcScreenRect();
- LLRect button_rc;
- if(mHideBtn)
- {
- button_rc = mHideBtn->calcScreenRect();
- }
-
- if (!panel_rc.pointInRect(x, y) && !button_rc.pointInRect(x, y))
- {
- // mouse is not over this toast
- mIsHovered = false;
- }
- else
- {
- bool is_overlapped_by_other_floater = false;
-
- const child_list_t* child_list = gFloaterView->getChildList();
-
- // find this toast in gFloaterView child list to check whether any floater
- // with higher Z-order is visible under the mouse pointer overlapping this toast
- child_list_const_reverse_iter_t r_iter = std::find(child_list->rbegin(), child_list->rend(), this);
- if (r_iter != child_list->rend())
- {
- // skip this toast and proceed to views above in Z-order
- for (++r_iter; r_iter != child_list->rend(); ++r_iter)
- {
- LLView* view = *r_iter;
- is_overlapped_by_other_floater = view->isInVisibleChain() && view->calcScreenRect().pointInRect(x, y);
- if (is_overlapped_by_other_floater)
- {
- break;
- }
- }
- }
-
- mIsHovered = !is_overlapped_by_other_floater;
- }
-
- LLToastLifeTimer* timer = getTimer();
-
- if (timer)
- {
- // Started timer means the mouse had left the toast previously.
- // If toast is hovered in the current frame we should handle
- // a mouse enter event.
- if(timer->getStarted() && mIsHovered)
- {
- mOnToastHoverSignal(this, MOUSE_ENTER);
-
- updateTransparency();
-
- //toasts fading is management by Screen Channel
-
- sendChildToFront(mHideBtn);
- if(mHideBtn && mHideBtn->getEnabled())
- {
- mHideBtn->setVisible(TRUE);
- }
-
- mToastMouseEnterSignal(this, getValue());
- }
- // Stopped timer means the mouse had entered the toast previously.
- // If the toast is not hovered in the current frame we should handle
- // a mouse leave event.
- else if(!timer->getStarted() && !mIsHovered)
- {
- mOnToastHoverSignal(this, MOUSE_LEAVE);
-
- updateTransparency();
-
- //toasts fading is management by Screen Channel
-
- if(mHideBtn && mHideBtn->getEnabled())
- {
- if( mHideBtnPressed )
- {
- mHideBtnPressed = false;
- return;
- }
- mHideBtn->setVisible(FALSE);
- }
-
- mToastMouseLeaveSignal(this, getValue());
- }
- }
+ S32 x, y;
+ LLUI::getInstance()->getMousePositionScreen(&x, &y);
+
+ LLRect panel_rc = mWrapperPanel->calcScreenRect();
+ LLRect button_rc;
+ if(mHideBtn)
+ {
+ button_rc = mHideBtn->calcScreenRect();
+ }
+
+ if (!panel_rc.pointInRect(x, y) && !button_rc.pointInRect(x, y))
+ {
+ // mouse is not over this toast
+ mIsHovered = false;
+ }
+ else
+ {
+ bool is_overlapped_by_other_floater = false;
+
+ const child_list_t* child_list = gFloaterView->getChildList();
+
+ // find this toast in gFloaterView child list to check whether any floater
+ // with higher Z-order is visible under the mouse pointer overlapping this toast
+ child_list_const_reverse_iter_t r_iter = std::find(child_list->rbegin(), child_list->rend(), this);
+ if (r_iter != child_list->rend())
+ {
+ // skip this toast and proceed to views above in Z-order
+ for (++r_iter; r_iter != child_list->rend(); ++r_iter)
+ {
+ LLView* view = *r_iter;
+ is_overlapped_by_other_floater = view->isInVisibleChain() && view->calcScreenRect().pointInRect(x, y);
+ if (is_overlapped_by_other_floater)
+ {
+ break;
+ }
+ }
+ }
+
+ mIsHovered = !is_overlapped_by_other_floater;
+ }
+
+ LLToastLifeTimer* timer = getTimer();
+
+ if (timer)
+ {
+ // Started timer means the mouse had left the toast previously.
+ // If toast is hovered in the current frame we should handle
+ // a mouse enter event.
+ if(timer->getStarted() && mIsHovered)
+ {
+ mOnToastHoverSignal(this, MOUSE_ENTER);
+
+ updateTransparency();
+
+ //toasts fading is management by Screen Channel
+
+ sendChildToFront(mHideBtn);
+ if(mHideBtn && mHideBtn->getEnabled())
+ {
+ mHideBtn->setVisible(TRUE);
+ }
+
+ mToastMouseEnterSignal(this, getValue());
+ }
+ // Stopped timer means the mouse had entered the toast previously.
+ // If the toast is not hovered in the current frame we should handle
+ // a mouse leave event.
+ else if(!timer->getStarted() && !mIsHovered)
+ {
+ mOnToastHoverSignal(this, MOUSE_LEAVE);
+
+ updateTransparency();
+
+ //toasts fading is management by Screen Channel
+
+ if(mHideBtn && mHideBtn->getEnabled())
+ {
+ if( mHideBtnPressed )
+ {
+ mHideBtnPressed = false;
+ return;
+ }
+ mHideBtn->setVisible(FALSE);
+ }
+
+ mToastMouseLeaveSignal(this, getValue());
+ }
+ }
}
void LLToast::setBackgroundOpaque(BOOL b)
{
- if(mWrapperPanel && !isBackgroundVisible())
- {
- mWrapperPanel->setBackgroundOpaque(b);
- }
- else
- {
- LLModalDialog::setBackgroundOpaque(b);
- }
+ if(mWrapperPanel && !isBackgroundVisible())
+ {
+ mWrapperPanel->setBackgroundOpaque(b);
+ }
+ else
+ {
+ LLModalDialog::setBackgroundOpaque(b);
+ }
}
void LLToast::updateTransparency()
{
- ETypeTransparency transparency_type;
-
- if (mCanFade)
- {
- // Notification toasts (including IM/chat toasts) change their transparency on hover.
- if (isHovered())
- {
- transparency_type = TT_ACTIVE;
- }
- else
- {
- transparency_type = mIsFading ? TT_FADING : TT_INACTIVE;
- }
- }
- else
- {
- // Transparency of alert toasts depends on focus.
- transparency_type = hasFocus() ? TT_ACTIVE : TT_INACTIVE;
- }
-
- LLFloater::updateTransparency(transparency_type);
+ ETypeTransparency transparency_type;
+
+ if (mCanFade)
+ {
+ // Notification toasts (including IM/chat toasts) change their transparency on hover.
+ if (isHovered())
+ {
+ transparency_type = TT_ACTIVE;
+ }
+ else
+ {
+ transparency_type = mIsFading ? TT_FADING : TT_INACTIVE;
+ }
+ }
+ else
+ {
+ // Transparency of alert toasts depends on focus.
+ transparency_type = hasFocus() ? TT_ACTIVE : TT_INACTIVE;
+ }
+
+ LLFloater::updateTransparency(transparency_type);
}
void LLNotificationsUI::LLToast::stopTimer()
{
- if(mCanFade)
- {
- setFading(false);
- mTimer->stop();
- }
+ if(mCanFade)
+ {
+ setFading(false);
+ mTimer->stop();
+ }
}
void LLNotificationsUI::LLToast::startTimer()
{
- if(mCanFade)
- {
- setFading(false);
- mTimer->start();
- }
+ if(mCanFade)
+ {
+ setFading(false);
+ mTimer->start();
+ }
}
//--------------------------------------------------------------------------
BOOL LLToast::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if(mHideBtn && mHideBtn->getEnabled())
- {
- mHideBtnPressed = mHideBtn->getRect().pointInRect(x, y);
- }
+ if(mHideBtn && mHideBtn->getEnabled())
+ {
+ mHideBtnPressed = mHideBtn->getRect().pointInRect(x, y);
+ }
- return LLModalDialog::handleMouseDown(x, y, mask);
+ return LLModalDialog::handleMouseDown(x, y, mask);
}
//--------------------------------------------------------------------------
bool LLToast::isNotificationValid()
{
- if(mNotification)
- {
- return !mNotification->isCancelled();
- }
- return false;
+ if(mNotification)
+ {
+ return !mNotification->isCancelled();
+ }
+ return false;
}
//--------------------------------------------------------------------------
-S32 LLToast::notifyParent(const LLSD& info)
+S32 LLToast::notifyParent(const LLSD& info)
{
- if (info.has("action") && "hide_toast" == info["action"].asString())
- {
- hide();
- return 1;
- }
+ if (info.has("action") && "hide_toast" == info["action"].asString())
+ {
+ hide();
+ return 1;
+ }
- return LLModalDialog::notifyParent(info);
+ return LLModalDialog::notifyParent(info);
}
//static
void LLToast::updateClass()
{
- for (auto& toast : LLInstanceTracker<LLToast>::instance_snapshot())
- {
- toast.updateHoveredState();
- }
+ for (auto& toast : LLInstanceTracker<LLToast>::instance_snapshot())
+ {
+ toast.updateHoveredState();
+ }
}
-// static
+// static
void LLToast::cleanupToasts()
{
- LLInstanceTracker<LLToast>::instance_snapshot().deleteAll();
+ LLInstanceTracker<LLToast>::instance_snapshot().deleteAll();
}
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index ab559f1e6f..a0003dfa70 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoast.h
* @brief This class implements a placeholder for any notification panel.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,20 +50,20 @@ class LLToast;
class LLToastLifeTimer: public LLEventTimer
{
public:
- LLToastLifeTimer(LLToast* toast, F32 period);
-
- /*virtual*/
- BOOL tick();
- void stop();
- void start();
- void restart();
- BOOL getStarted();
- void setPeriod(F32 period);
- F32 getRemainingTimeF32();
-
- LLTimer& getEventTimer() { return mEventTimer;}
+ LLToastLifeTimer(LLToast* toast, F32 period);
+
+ /*virtual*/
+ BOOL tick();
+ void stop();
+ void start();
+ void restart();
+ BOOL getStarted();
+ void setPeriod(F32 period);
+ F32 getRemainingTimeF32();
+
+ LLTimer& getEventTimer() { return mEventTimer;}
private :
- LLToast* mToast;
+ LLToast* mToast;
};
/**
@@ -72,184 +72,184 @@ private :
*/
class LLToast : public LLModalDialog, public LLInstanceTracker<LLToast>
{
- friend class LLToastLifeTimer;
+ friend class LLToastLifeTimer;
public:
- typedef boost::function<void (LLToast* toast)> toast_callback_t;
- typedef boost::signals2::signal<void (LLToast* toast)> toast_signal_t;
- typedef boost::signals2::signal<void (LLToast* toast, bool mouse_enter)> toast_hover_check_signal_t;
+ typedef boost::function<void (LLToast* toast)> toast_callback_t;
+ typedef boost::signals2::signal<void (LLToast* toast)> toast_signal_t;
+ typedef boost::signals2::signal<void (LLToast* toast, bool mouse_enter)> toast_hover_check_signal_t;
+
+ struct Params : public LLInitParam::Block<Params>
+ {
+ Mandatory<LLPanel*> panel;
+ Optional<LLUUID> notif_id, //notification ID
+ session_id; //im session ID
+ Optional<LLNotificationPtr> notification;
- struct Params : public LLInitParam::Block<Params>
- {
- Mandatory<LLPanel*> panel;
- Optional<LLUUID> notif_id, //notification ID
- session_id; //im session ID
- Optional<LLNotificationPtr> notification;
+ //NOTE: Life time of a toast (i.e. period of time from the moment toast was shown
+ //till the moment when toast was hidden) is the sum of lifetime_secs and fading_time_secs.
- //NOTE: Life time of a toast (i.e. period of time from the moment toast was shown
- //till the moment when toast was hidden) is the sum of lifetime_secs and fading_time_secs.
+ Optional<F32> lifetime_secs, // Number of seconds while a toast is non-transparent
+ fading_time_secs; // Number of seconds while a toast is transparent
- Optional<F32> lifetime_secs, // Number of seconds while a toast is non-transparent
- fading_time_secs; // Number of seconds while a toast is transparent
+ Optional<toast_callback_t> on_delete_toast;
+ Optional<bool> can_fade,
+ can_be_stored,
+ enable_hide_btn,
+ is_modal,
+ is_tip,
+ force_show,
+ force_store;
- Optional<toast_callback_t> on_delete_toast;
- Optional<bool> can_fade,
- can_be_stored,
- enable_hide_btn,
- is_modal,
- is_tip,
- force_show,
- force_store;
+ Params();
+ };
- Params();
- };
-
- static void updateClass();
- static void cleanupToasts();
+ static void updateClass();
+ static void cleanupToasts();
- static BOOL isAlertToastShown() { return sModalToastsList.size() > 0; }
+ static BOOL isAlertToastShown() { return sModalToastsList.size() > 0; }
- LLToast(const LLToast::Params& p);
- virtual ~LLToast();
- BOOL postBuild();
+ LLToast(const LLToast::Params& p);
+ virtual ~LLToast();
+ BOOL postBuild();
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
- // Toast handlers
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ // Toast handlers
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- //Fading
+ //Fading
- /** Stop lifetime/fading timer */
- virtual void stopTimer();
+ /** Stop lifetime/fading timer */
+ virtual void stopTimer();
- /** Start lifetime/fading timer */
- virtual void startTimer();
+ /** Start lifetime/fading timer */
+ virtual void startTimer();
- bool isHovered() { return mIsHovered; }
+ bool isHovered() { return mIsHovered; }
- // Operating with toasts
- // insert a panel to a toast
- void insertPanel(LLPanel* panel);
+ // Operating with toasts
+ // insert a panel to a toast
+ void insertPanel(LLPanel* panel);
- void reshapeToPanel();
+ void reshapeToPanel();
- // get toast's panel
- LLPanel* getPanel() const { return mPanel; }
- // enable/disable Toast's Hide button
- void setHideButtonEnabled(bool enabled);
- //
- F32 getTimeLeftToLive();
- //
- LLToastLifeTimer* getTimer() { return mTimer.get();}
- //
- virtual void draw();
- //
- virtual void setVisible(BOOL show);
+ // get toast's panel
+ LLPanel* getPanel() const { return mPanel; }
+ // enable/disable Toast's Hide button
+ void setHideButtonEnabled(bool enabled);
+ //
+ F32 getTimeLeftToLive();
+ //
+ LLToastLifeTimer* getTimer() { return mTimer.get();}
+ //
+ virtual void draw();
+ //
+ virtual void setVisible(BOOL show);
- /*virtual*/ void setBackgroundOpaque(BOOL b);
- //
- virtual void hide();
+ /*virtual*/ void setBackgroundOpaque(BOOL b);
+ //
+ virtual void hide();
- /*virtual*/ void setFocus(BOOL b);
+ /*virtual*/ void setFocus(BOOL b);
- /*virtual*/ void onFocusLost();
+ /*virtual*/ void onFocusLost();
- /*virtual*/ void onFocusReceived();
+ /*virtual*/ void onFocusReceived();
- void setLifetime(S32 seconds);
+ void setLifetime(S32 seconds);
- void setFadingTime(S32 seconds);
+ void setFadingTime(S32 seconds);
- void closeToast();
+ void closeToast();
- /**
- * Returns padding between floater top and wrapper_panel top.
- * This padding should be taken into account when positioning or reshaping toasts
- */
- S32 getTopPad();
+ /**
+ * Returns padding between floater top and wrapper_panel top.
+ * This padding should be taken into account when positioning or reshaping toasts
+ */
+ S32 getTopPad();
- S32 getRightPad();
+ S32 getRightPad();
- // get/set Toast's flags or states
- // get information whether the notification corresponding to the toast is valid or not
- bool isNotificationValid();
+ // get/set Toast's flags or states
+ // get information whether the notification corresponding to the toast is valid or not
+ bool isNotificationValid();
- // get toast's Notification ID
- const LLUUID getNotificationID() const { return mNotificationID;}
- // get toast's Session ID
- const LLUUID getSessionID() const { return mSessionID;}
- //
- void setCanFade(bool can_fade);
- //
- void setCanBeStored(bool can_be_stored) { mCanBeStored = can_be_stored; }
- //
- bool getCanBeStored() { return mCanBeStored; }
- // set whether this toast considered as hidden or not
- void setIsHidden( bool is_toast_hidden ) { mIsHidden = is_toast_hidden; }
+ // get toast's Notification ID
+ const LLUUID getNotificationID() const { return mNotificationID;}
+ // get toast's Session ID
+ const LLUUID getSessionID() const { return mSessionID;}
+ //
+ void setCanFade(bool can_fade);
+ //
+ void setCanBeStored(bool can_be_stored) { mCanBeStored = can_be_stored; }
+ //
+ bool getCanBeStored() { return mCanBeStored; }
+ // set whether this toast considered as hidden or not
+ void setIsHidden( bool is_toast_hidden ) { mIsHidden = is_toast_hidden; }
- const LLNotificationPtr& getNotification() const { return mNotification;}
+ const LLNotificationPtr& getNotification() const { return mNotification;}
- // Registers signals/callbacks for events
- boost::signals2::connection setOnFadeCallback(const toast_signal_t::slot_type& cb) { return mOnFadeSignal.connect(cb); }
- boost::signals2::connection setOnToastDestroyedCallback(const toast_signal_t::slot_type& cb) { return mOnToastDestroyedSignal.connect(cb); }
- boost::signals2::connection setOnToastHoverCallback(const toast_hover_check_signal_t::slot_type& cb) { return mOnToastHoverSignal.connect(cb); }
+ // Registers signals/callbacks for events
+ boost::signals2::connection setOnFadeCallback(const toast_signal_t::slot_type& cb) { return mOnFadeSignal.connect(cb); }
+ boost::signals2::connection setOnToastDestroyedCallback(const toast_signal_t::slot_type& cb) { return mOnToastDestroyedSignal.connect(cb); }
+ boost::signals2::connection setOnToastHoverCallback(const toast_hover_check_signal_t::slot_type& cb) { return mOnToastHoverSignal.connect(cb); }
- boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseEnterSignal.connect(cb); };
- boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseLeaveSignal.connect(cb); };
+ boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseEnterSignal.connect(cb); };
+ boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseLeaveSignal.connect(cb); };
- virtual S32 notifyParent(const LLSD& info);
+ virtual S32 notifyParent(const LLSD& info);
- LLHandle<LLToast> getHandle() const { return getDerivedHandle<LLToast>(); }
+ LLHandle<LLToast> getHandle() const { return getDerivedHandle<LLToast>(); }
protected:
- void updateTransparency();
+ void updateTransparency();
private:
- void updateHoveredState();
+ void updateHoveredState();
+
+ void expire();
+
+ void setFading(bool fading);
- void expire();
+ LLUUID mNotificationID;
+ LLUUID mSessionID;
+ LLNotificationPtr mNotification;
- void setFading(bool fading);
+ //LLRootHandle<LLToast> mHandle;
- LLUUID mNotificationID;
- LLUUID mSessionID;
- LLNotificationPtr mNotification;
+ LLPanel* mWrapperPanel;
- //LLRootHandle<LLToast> mHandle;
-
- LLPanel* mWrapperPanel;
+ // timer counts a lifetime of a toast
+ std::unique_ptr<LLToastLifeTimer> mTimer;
- // timer counts a lifetime of a toast
- std::unique_ptr<LLToastLifeTimer> mTimer;
+ F32 mToastLifetime; // in seconds
+ F32 mToastFadingTime; // in seconds
- F32 mToastLifetime; // in seconds
- F32 mToastFadingTime; // in seconds
-
- LLPanel* mPanel;
- LLButton* mHideBtn;
+ LLPanel* mPanel;
+ LLButton* mHideBtn;
- LLColor4 mBgColor;
- bool mCanFade;
- bool mCanBeStored;
- bool mHideBtnEnabled;
- bool mHideBtnPressed;
- bool mIsHidden; // this flag is TRUE when a toast has faded or was hidden with (x) button (EXT-1849)
- bool mIsTip;
- bool mIsFading;
- bool mIsHovered;
+ LLColor4 mBgColor;
+ bool mCanFade;
+ bool mCanBeStored;
+ bool mHideBtnEnabled;
+ bool mHideBtnPressed;
+ bool mIsHidden; // this flag is TRUE when a toast has faded or was hidden with (x) button (EXT-1849)
+ bool mIsTip;
+ bool mIsFading;
+ bool mIsHovered;
- toast_signal_t mOnFadeSignal;
- toast_signal_t mOnDeleteToastSignal;
- toast_signal_t mOnToastDestroyedSignal;
- toast_hover_check_signal_t mOnToastHoverSignal;
+ toast_signal_t mOnFadeSignal;
+ toast_signal_t mOnDeleteToastSignal;
+ toast_signal_t mOnToastDestroyedSignal;
+ toast_hover_check_signal_t mOnToastHoverSignal;
- commit_signal_t mToastMouseEnterSignal;
- commit_signal_t mToastMouseLeaveSignal;
+ commit_signal_t mToastMouseEnterSignal;
+ commit_signal_t mToastMouseLeaveSignal;
- static std::list<LLToast*> sModalToastsList;
+ static std::list<LLToast*> sModalToastsList;
};
}
diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp
index 8bf078477a..c873167729 100644
--- a/indra/newview/lltoastalertpanel.cpp
+++ b/indra/newview/lltoastalertpanel.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -61,11 +61,11 @@ static const S32 HPAD = 25;
static const S32 BTN_HPAD = 8;
LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal)
- : LLCheckBoxToastPanel(notification),
- mDefaultOption( 0 ),
- mCaution(notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH),
- mLabel(notification->getName()),
- mLineEditor(NULL)
+ : LLCheckBoxToastPanel(notification),
+ mDefaultOption( 0 ),
+ mCaution(notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH),
+ mLabel(notification->getName()),
+ mLineEditor(NULL)
{
// EXP-1822
// save currently focused view, so that return focus to it
@@ -81,341 +81,341 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
current_selection = current_selection->getParent();
}
- const LLFontGL* font = LLFontGL::getFontSansSerif();
- const S32 LINE_HEIGHT = font->getLineHeight();
- const S32 EDITOR_HEIGHT = 20;
-
- LLNotificationFormPtr form = mNotification->getForm();
- std::string edit_text_name;
- std::string edit_text_contents;
- S32 edit_text_max_chars = 0;
- bool is_password = false;
-
- LLToastPanel::setBackgroundVisible(FALSE);
- LLToastPanel::setBackgroundOpaque(TRUE);
-
-
- typedef std::vector<std::pair<std::string, std::string> > options_t;
- options_t supplied_options;
-
- // for now, get LLSD to iterator over form elements
- LLSD form_sd = form->asLLSD();
-
- S32 option_index = 0;
- for (LLSD::array_const_iterator it = form_sd.beginArray(); it != form_sd.endArray(); ++it)
- {
- std::string type = (*it)["type"].asString();
- if (type == "button")
- {
- if((*it)["default"])
- {
- mDefaultOption = option_index;
- }
-
- supplied_options.push_back(std::make_pair((*it)["name"].asString(), (*it)["text"].asString()));
-
- ButtonData data;
- if (option_index == mNotification->getURLOption())
- {
- data.mURL = mNotification->getURL();
- data.mURLExternal = mNotification->getURLOpenExternally();
- }
-
- if((*it).has("width"))
- {
- data.mWidth = (*it)["width"].asInteger();
- }
-
- mButtonData.push_back(data);
- option_index++;
- }
- else if (type == "text")
- {
- edit_text_contents = (*it)["value"].asString();
- edit_text_name = (*it)["name"].asString();
- edit_text_max_chars = (*it)["max_length_chars"].asInteger();
- }
- else if (type == "password")
- {
- edit_text_contents = (*it)["value"].asString();
- edit_text_name = (*it)["name"].asString();
- is_password = true;
- }
- }
-
- // Buttons
- options_t options;
- if (supplied_options.empty())
- {
- options.push_back(std::make_pair(std::string("close"), LLNotifications::instance().getGlobalString("implicitclosebutton")));
-
- // add data for ok button.
- ButtonData ok_button;
- mButtonData.push_back(ok_button);
- mDefaultOption = 0;
- }
- else
- {
- options = supplied_options;
- }
-
- S32 num_options = options.size();
-
- // Calc total width of buttons
- S32 button_width = 0;
- S32 sp = font->getWidth(std::string("OO"));
- S32 btn_total_width = 0;
- S32 default_size_btns = 0;
- for( S32 i = 0; i < num_options; i++ )
- {
- S32 w = S32(font->getWidth( options[i].second ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD;
- if (mButtonData[i].mWidth > w)
- {
- btn_total_width += mButtonData[i].mWidth;
- }
- else
- {
- button_width = llmax(w, button_width);
- default_size_btns++;
- }
- }
-
- if( num_options > 1 )
- {
- btn_total_width = btn_total_width + (button_width * default_size_btns) + ((num_options - 1) * BTN_HPAD);
- }
- else
- {
- btn_total_width = llmax(btn_total_width, button_width);
- }
-
- // Message: create text box using raw string, as text has been structure deliberately
- // Use size of created text box to generate dialog box size
- std::string msg = mNotification->getMessage();
- LL_WARNS() << "Alert: " << msg << LL_ENDL;
- LLTextBox::Params params;
- params.name("Alert message");
- params.font(font);
- params.tab_stop(false);
- params.wrap(true);
- params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP);
- params.allow_scroll(true);
- params.force_urls_external(mNotification->getForceUrlsExternal());
-
- LLTextBox * msg_box = LLUICtrlFactory::create<LLTextBox> (params);
- // Compute max allowable height for the dialog text, so we can allocate
- // space before wrapping the text to fit.
- S32 max_allowed_msg_height =
- gFloaterView->getRect().getHeight()
- - LINE_HEIGHT // title bar
- - 3*VPAD - BTN_HEIGHT;
- // reshape to calculate real text width and height
- msg_box->reshape( MAX_ALLOWED_MSG_WIDTH, max_allowed_msg_height );
-
- if ("GroupLimitInfo" == mNotification->getName() || "GroupLimitInfoPlus" == mNotification->getName())
- {
- msg_box->setSkipLinkUnderline(true);
- }
- msg_box->setValue(msg);
-
- S32 pixel_width = msg_box->getTextPixelWidth();
- S32 pixel_height = msg_box->getTextPixelHeight();
-
- // We should use some space to prevent set textbox's scroller visible when it is unnecessary.
- msg_box->reshape( llmin(MAX_ALLOWED_MSG_WIDTH,pixel_width + 2 * msg_box->getHPad() + HPAD),
- llmin(max_allowed_msg_height,pixel_height + 2 * msg_box->getVPad()) ) ;
-
- const LLRect& text_rect = msg_box->getRect();
- S32 dialog_width = llmax( btn_total_width, text_rect.getWidth() ) + 2 * HPAD;
- S32 dialog_height = text_rect.getHeight() + 3 * VPAD + BTN_HEIGHT;
-
- if (hasTitleBar())
- {
- dialog_height += LINE_HEIGHT; // room for title bar
- }
-
- // it's ok for the edit text body to be empty, but we want the name to exist if we're going to draw it
- if (!edit_text_name.empty())
- {
- dialog_height += EDITOR_HEIGHT + VPAD;
- dialog_width = llmax(dialog_width, (S32)(font->getWidth( edit_text_contents ) + 0.99f));
- }
-
- if (mCaution)
- {
- // Make room for the caution icon.
- dialog_width += 32 + HPAD;
- }
-
- LLToastPanel::reshape( dialog_width, dialog_height, FALSE );
-
- S32 msg_y = LLToastPanel::getRect().getHeight() - VPAD;
- S32 msg_x = HPAD;
- if (hasTitleBar())
- {
- msg_y -= LINE_HEIGHT; // room for title
- }
-
- static LLUIColor alert_caution_text_color = LLUIColorTable::instance().getColor("AlertCautionTextColor");
- if (mCaution)
- {
- LLIconCtrl* icon = LLUICtrlFactory::getInstance()->createFromFile<LLIconCtrl>("alert_icon.xml", this, LLPanel::child_registry_t::instance());
- if(icon)
- {
- icon->setRect(LLRect(msg_x, msg_y, msg_x+32, msg_y-32));
- LLToastPanel::addChild(icon);
- }
-
- msg_x += 32 + HPAD;
- msg_box->setColor( alert_caution_text_color );
- }
-
- LLRect rect;
- rect.setLeftTopAndSize( msg_x, msg_y, text_rect.getWidth(), text_rect.getHeight() );
- msg_box->setRect( rect );
- LLToastPanel::addChild(msg_box);
-
- // (Optional) Edit Box
- if (!edit_text_name.empty())
- {
- S32 y = VPAD + BTN_HEIGHT + VPAD/2;
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
+ const S32 LINE_HEIGHT = font->getLineHeight();
+ const S32 EDITOR_HEIGHT = 20;
+
+ LLNotificationFormPtr form = mNotification->getForm();
+ std::string edit_text_name;
+ std::string edit_text_contents;
+ S32 edit_text_max_chars = 0;
+ bool is_password = false;
+
+ LLToastPanel::setBackgroundVisible(FALSE);
+ LLToastPanel::setBackgroundOpaque(TRUE);
+
+
+ typedef std::vector<std::pair<std::string, std::string> > options_t;
+ options_t supplied_options;
+
+ // for now, get LLSD to iterator over form elements
+ LLSD form_sd = form->asLLSD();
+
+ S32 option_index = 0;
+ for (LLSD::array_const_iterator it = form_sd.beginArray(); it != form_sd.endArray(); ++it)
+ {
+ std::string type = (*it)["type"].asString();
+ if (type == "button")
+ {
+ if((*it)["default"])
+ {
+ mDefaultOption = option_index;
+ }
+
+ supplied_options.push_back(std::make_pair((*it)["name"].asString(), (*it)["text"].asString()));
+
+ ButtonData data;
+ if (option_index == mNotification->getURLOption())
+ {
+ data.mURL = mNotification->getURL();
+ data.mURLExternal = mNotification->getURLOpenExternally();
+ }
+
+ if((*it).has("width"))
+ {
+ data.mWidth = (*it)["width"].asInteger();
+ }
+
+ mButtonData.push_back(data);
+ option_index++;
+ }
+ else if (type == "text")
+ {
+ edit_text_contents = (*it)["value"].asString();
+ edit_text_name = (*it)["name"].asString();
+ edit_text_max_chars = (*it)["max_length_chars"].asInteger();
+ }
+ else if (type == "password")
+ {
+ edit_text_contents = (*it)["value"].asString();
+ edit_text_name = (*it)["name"].asString();
+ is_password = true;
+ }
+ }
+
+ // Buttons
+ options_t options;
+ if (supplied_options.empty())
+ {
+ options.push_back(std::make_pair(std::string("close"), LLNotifications::instance().getGlobalString("implicitclosebutton")));
+
+ // add data for ok button.
+ ButtonData ok_button;
+ mButtonData.push_back(ok_button);
+ mDefaultOption = 0;
+ }
+ else
+ {
+ options = supplied_options;
+ }
+
+ S32 num_options = options.size();
+
+ // Calc total width of buttons
+ S32 button_width = 0;
+ S32 sp = font->getWidth(std::string("OO"));
+ S32 btn_total_width = 0;
+ S32 default_size_btns = 0;
+ for( S32 i = 0; i < num_options; i++ )
+ {
+ S32 w = S32(font->getWidth( options[i].second ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD;
+ if (mButtonData[i].mWidth > w)
+ {
+ btn_total_width += mButtonData[i].mWidth;
+ }
+ else
+ {
+ button_width = llmax(w, button_width);
+ default_size_btns++;
+ }
+ }
+
+ if( num_options > 1 )
+ {
+ btn_total_width = btn_total_width + (button_width * default_size_btns) + ((num_options - 1) * BTN_HPAD);
+ }
+ else
+ {
+ btn_total_width = llmax(btn_total_width, button_width);
+ }
+
+ // Message: create text box using raw string, as text has been structure deliberately
+ // Use size of created text box to generate dialog box size
+ std::string msg = mNotification->getMessage();
+ LL_WARNS() << "Alert: " << msg << LL_ENDL;
+ LLTextBox::Params params;
+ params.name("Alert message");
+ params.font(font);
+ params.tab_stop(false);
+ params.wrap(true);
+ params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP);
+ params.allow_scroll(true);
+ params.force_urls_external(mNotification->getForceUrlsExternal());
+
+ LLTextBox * msg_box = LLUICtrlFactory::create<LLTextBox> (params);
+ // Compute max allowable height for the dialog text, so we can allocate
+ // space before wrapping the text to fit.
+ S32 max_allowed_msg_height =
+ gFloaterView->getRect().getHeight()
+ - LINE_HEIGHT // title bar
+ - 3*VPAD - BTN_HEIGHT;
+ // reshape to calculate real text width and height
+ msg_box->reshape( MAX_ALLOWED_MSG_WIDTH, max_allowed_msg_height );
+
+ if ("GroupLimitInfo" == mNotification->getName() || "GroupLimitInfoPlus" == mNotification->getName())
+ {
+ msg_box->setSkipLinkUnderline(true);
+ }
+ msg_box->setValue(msg);
+
+ S32 pixel_width = msg_box->getTextPixelWidth();
+ S32 pixel_height = msg_box->getTextPixelHeight();
+
+ // We should use some space to prevent set textbox's scroller visible when it is unnecessary.
+ msg_box->reshape( llmin(MAX_ALLOWED_MSG_WIDTH,pixel_width + 2 * msg_box->getHPad() + HPAD),
+ llmin(max_allowed_msg_height,pixel_height + 2 * msg_box->getVPad()) ) ;
+
+ const LLRect& text_rect = msg_box->getRect();
+ S32 dialog_width = llmax( btn_total_width, text_rect.getWidth() ) + 2 * HPAD;
+ S32 dialog_height = text_rect.getHeight() + 3 * VPAD + BTN_HEIGHT;
+
+ if (hasTitleBar())
+ {
+ dialog_height += LINE_HEIGHT; // room for title bar
+ }
+
+ // it's ok for the edit text body to be empty, but we want the name to exist if we're going to draw it
+ if (!edit_text_name.empty())
+ {
+ dialog_height += EDITOR_HEIGHT + VPAD;
+ dialog_width = llmax(dialog_width, (S32)(font->getWidth( edit_text_contents ) + 0.99f));
+ }
+
+ if (mCaution)
+ {
+ // Make room for the caution icon.
+ dialog_width += 32 + HPAD;
+ }
+
+ LLToastPanel::reshape( dialog_width, dialog_height, FALSE );
+
+ S32 msg_y = LLToastPanel::getRect().getHeight() - VPAD;
+ S32 msg_x = HPAD;
+ if (hasTitleBar())
+ {
+ msg_y -= LINE_HEIGHT; // room for title
+ }
+
+ static LLUIColor alert_caution_text_color = LLUIColorTable::instance().getColor("AlertCautionTextColor");
+ if (mCaution)
+ {
+ LLIconCtrl* icon = LLUICtrlFactory::getInstance()->createFromFile<LLIconCtrl>("alert_icon.xml", this, LLPanel::child_registry_t::instance());
+ if(icon)
+ {
+ icon->setRect(LLRect(msg_x, msg_y, msg_x+32, msg_y-32));
+ LLToastPanel::addChild(icon);
+ }
+
+ msg_x += 32 + HPAD;
+ msg_box->setColor( alert_caution_text_color );
+ }
+
+ LLRect rect;
+ rect.setLeftTopAndSize( msg_x, msg_y, text_rect.getWidth(), text_rect.getHeight() );
+ msg_box->setRect( rect );
+ LLToastPanel::addChild(msg_box);
+
+ // (Optional) Edit Box
+ if (!edit_text_name.empty())
+ {
+ S32 y = VPAD + BTN_HEIGHT + VPAD/2;
if (form->getIgnoreType() != LLNotificationForm::IGNORE_NO)
{
y += EDITOR_HEIGHT;
}
- mLineEditor = LLUICtrlFactory::getInstance()->createFromFile<LLLineEditor>("alert_line_editor.xml", this, LLPanel::child_registry_t::instance());
-
- if (mLineEditor)
- {
- LLRect leditor_rect = LLRect( HPAD, y+EDITOR_HEIGHT, dialog_width-HPAD, y);
- mLineEditor->setName(edit_text_name);
- mLineEditor->reshape(leditor_rect.getWidth(), leditor_rect.getHeight());
- mLineEditor->setRect(leditor_rect);
- mLineEditor->setMaxTextChars(edit_text_max_chars);
- mLineEditor->setText(edit_text_contents);
-
- std::string notif_name = mNotification->getName();
- if (("SaveOutfitAs" == notif_name) || ("SaveSettingAs" == notif_name) || ("CreateLandmarkFolder" == notif_name) ||
+ mLineEditor = LLUICtrlFactory::getInstance()->createFromFile<LLLineEditor>("alert_line_editor.xml", this, LLPanel::child_registry_t::instance());
+
+ if (mLineEditor)
+ {
+ LLRect leditor_rect = LLRect( HPAD, y+EDITOR_HEIGHT, dialog_width-HPAD, y);
+ mLineEditor->setName(edit_text_name);
+ mLineEditor->reshape(leditor_rect.getWidth(), leditor_rect.getHeight());
+ mLineEditor->setRect(leditor_rect);
+ mLineEditor->setMaxTextChars(edit_text_max_chars);
+ mLineEditor->setText(edit_text_contents);
+
+ std::string notif_name = mNotification->getName();
+ if (("SaveOutfitAs" == notif_name) || ("SaveSettingAs" == notif_name) || ("CreateLandmarkFolder" == notif_name) ||
("CreateSubfolder" == notif_name) || ("SaveMaterialAs" == notif_name))
- {
- mLineEditor->setPrevalidate(&LLTextValidate::validateASCII);
- }
-
- // decrease limit of line editor of teleport offer dialog to avoid truncation of
- // location URL in invitation message, see EXT-6891
- if ("OfferTeleport" == notif_name)
- {
- mLineEditor->setMaxTextLength(gSavedSettings.getS32(
- "teleport_offer_invitation_max_length"));
- }
- else
- {
- mLineEditor->setMaxTextLength(STD_STRING_STR_LEN - 1);
- }
-
- LLToastPanel::addChild(mLineEditor);
-
- mLineEditor->setDrawAsterixes(is_password);
-
- setEditTextArgs(notification->getSubstitutions());
-
- mLineEditor->setFollowsLeft();
- mLineEditor->setFollowsRight();
-
- // find form text input field
- LLSD form_text;
- for (LLSD::array_const_iterator it = form_sd.beginArray(); it != form_sd.endArray(); ++it)
- {
- std::string type = (*it)["type"].asString();
- if (type == "text")
- {
- form_text = (*it);
- }
- }
-
- // if form text input field has width attribute
- if (form_text.has("width"))
- {
- // adjust floater width to fit line editor
- S32 editor_width = form_text["width"];
- LLRect editor_rect = mLineEditor->getRect();
- U32 width_delta = editor_width - editor_rect.getWidth();
- LLRect toast_rect = getRect();
- reshape(toast_rect.getWidth() + width_delta, toast_rect.getHeight());
- }
- }
- }
-
- // Buttons
- S32 button_left = (LLToastPanel::getRect().getWidth() - btn_total_width) / 2;
-
- for( S32 i = 0; i < num_options; i++ )
- {
- LLRect button_rect;
-
- LLButton* btn = LLUICtrlFactory::getInstance()->createFromFile<LLButton>("alert_button.xml", this, LLPanel::child_registry_t::instance());
- if(btn)
- {
- btn->setName(options[i].first);
- btn->setRect(button_rect.setOriginAndSize( button_left, VPAD, (mButtonData[i].mWidth == 0) ? button_width : mButtonData[i].mWidth, BTN_HEIGHT ));
- btn->setLabel(options[i].second);
- btn->setFont(font);
-
- btn->setClickedCallback(boost::bind(&LLToastAlertPanel::onButtonPressed, this, _2, i));
-
- mButtonData[i].mButton = btn;
-
- LLToastPanel::addChild(btn);
-
- if( i == mDefaultOption )
- {
- btn->setFocus(TRUE);
- }
- }
- button_left += ((mButtonData[i].mWidth == 0) ? button_width : mButtonData[i].mWidth) + BTN_HPAD;
- }
-
- setCheckBoxes(HPAD, VPAD);
-
- // *TODO: check necessity of this code
- //gFloaterView->adjustToFitScreen(this, FALSE);
- if (mLineEditor)
- {
- mLineEditor->selectAll();
- mLineEditor->setFocus(TRUE);
- }
- if(mDefaultOption >= 0)
- {
- // delay before enabling default button
- mDefaultBtnTimer.start();
- mDefaultBtnTimer.setTimerExpirySec(DEFAULT_BUTTON_DELAY);
- }
-
- LLTransientFloaterMgr::instance().addControlView(
- LLTransientFloaterMgr::GLOBAL, this);
+ {
+ mLineEditor->setPrevalidate(&LLTextValidate::validateASCII);
+ }
+
+ // decrease limit of line editor of teleport offer dialog to avoid truncation of
+ // location URL in invitation message, see EXT-6891
+ if ("OfferTeleport" == notif_name)
+ {
+ mLineEditor->setMaxTextLength(gSavedSettings.getS32(
+ "teleport_offer_invitation_max_length"));
+ }
+ else
+ {
+ mLineEditor->setMaxTextLength(STD_STRING_STR_LEN - 1);
+ }
+
+ LLToastPanel::addChild(mLineEditor);
+
+ mLineEditor->setDrawAsterixes(is_password);
+
+ setEditTextArgs(notification->getSubstitutions());
+
+ mLineEditor->setFollowsLeft();
+ mLineEditor->setFollowsRight();
+
+ // find form text input field
+ LLSD form_text;
+ for (LLSD::array_const_iterator it = form_sd.beginArray(); it != form_sd.endArray(); ++it)
+ {
+ std::string type = (*it)["type"].asString();
+ if (type == "text")
+ {
+ form_text = (*it);
+ }
+ }
+
+ // if form text input field has width attribute
+ if (form_text.has("width"))
+ {
+ // adjust floater width to fit line editor
+ S32 editor_width = form_text["width"];
+ LLRect editor_rect = mLineEditor->getRect();
+ U32 width_delta = editor_width - editor_rect.getWidth();
+ LLRect toast_rect = getRect();
+ reshape(toast_rect.getWidth() + width_delta, toast_rect.getHeight());
+ }
+ }
+ }
+
+ // Buttons
+ S32 button_left = (LLToastPanel::getRect().getWidth() - btn_total_width) / 2;
+
+ for( S32 i = 0; i < num_options; i++ )
+ {
+ LLRect button_rect;
+
+ LLButton* btn = LLUICtrlFactory::getInstance()->createFromFile<LLButton>("alert_button.xml", this, LLPanel::child_registry_t::instance());
+ if(btn)
+ {
+ btn->setName(options[i].first);
+ btn->setRect(button_rect.setOriginAndSize( button_left, VPAD, (mButtonData[i].mWidth == 0) ? button_width : mButtonData[i].mWidth, BTN_HEIGHT ));
+ btn->setLabel(options[i].second);
+ btn->setFont(font);
+
+ btn->setClickedCallback(boost::bind(&LLToastAlertPanel::onButtonPressed, this, _2, i));
+
+ mButtonData[i].mButton = btn;
+
+ LLToastPanel::addChild(btn);
+
+ if( i == mDefaultOption )
+ {
+ btn->setFocus(TRUE);
+ }
+ }
+ button_left += ((mButtonData[i].mWidth == 0) ? button_width : mButtonData[i].mWidth) + BTN_HPAD;
+ }
+
+ setCheckBoxes(HPAD, VPAD);
+
+ // *TODO: check necessity of this code
+ //gFloaterView->adjustToFitScreen(this, FALSE);
+ if (mLineEditor)
+ {
+ mLineEditor->selectAll();
+ mLineEditor->setFocus(TRUE);
+ }
+ if(mDefaultOption >= 0)
+ {
+ // delay before enabling default button
+ mDefaultBtnTimer.start();
+ mDefaultBtnTimer.setTimerExpirySec(DEFAULT_BUTTON_DELAY);
+ }
+
+ LLTransientFloaterMgr::instance().addControlView(
+ LLTransientFloaterMgr::GLOBAL, this);
}
void LLToastAlertPanel::setVisible( BOOL visible )
{
- // only make the "ding" sound if it's newly visible
- if( visible && !LLToastPanel::getVisible() )
- {
- make_ui_sound("UISndAlert");
- }
-
- LLToastPanel::setVisible( visible );
-
+ // only make the "ding" sound if it's newly visible
+ if( visible && !LLToastPanel::getVisible() )
+ {
+ make_ui_sound("UISndAlert");
+ }
+
+ LLToastPanel::setVisible( visible );
+
}
LLToastAlertPanel::~LLToastAlertPanel()
{
- LLTransientFloaterMgr::instance().removeControlView(
- LLTransientFloaterMgr::GLOBAL, this);
+ LLTransientFloaterMgr::instance().removeControlView(
+ LLTransientFloaterMgr::GLOBAL, this);
- // EXP-1822
- // return focus to the previously focused view if the viewer is not exiting
- if (mPreviouslyFocusedView.get() && !LLApp::isExiting())
- {
+ // EXP-1822
+ // return focus to the previously focused view if the viewer is not exiting
+ if (mPreviouslyFocusedView.get() && !LLApp::isExiting())
+ {
LLView* current_selection = dynamic_cast<LLView*>(gFocusMgr.getKeyboardFocus());
while(current_selection)
{
@@ -434,117 +434,117 @@ LLToastAlertPanel::~LLToastAlertPanel()
{
mPreviouslyFocusedView.get()->setFocus(TRUE);
}
- }
+ }
}
BOOL LLToastAlertPanel::hasTitleBar() const
{
- // *TODO: check necessity of this code
- /*
- return (getCurrentTitle() != "" && getCurrentTitle() != " ") // has title
- || isMinimizeable()
- || isCloseable();
- */
- return false;
+ // *TODO: check necessity of this code
+ /*
+ return (getCurrentTitle() != "" && getCurrentTitle() != " ") // has title
+ || isMinimizeable()
+ || isCloseable();
+ */
+ return false;
}
BOOL LLToastAlertPanel::handleKeyHere(KEY key, MASK mask )
{
- if( KEY_RETURN == key && mask == MASK_NONE )
- {
- LLButton* defaultBtn = getDefaultButton();
- if(defaultBtn && defaultBtn->getVisible() && defaultBtn->getEnabled())
- {
- // If we have a default button, click it when return is pressed
- defaultBtn->onCommit();
- }
- return TRUE;
- }
- else if (KEY_RIGHT == key)
- {
- LLToastPanel::focusNextItem(FALSE);
- return TRUE;
- }
- else if (KEY_LEFT == key)
- {
- LLToastPanel::focusPrevItem(FALSE);
- return TRUE;
- }
- else if (KEY_TAB == key && mask == MASK_NONE)
- {
- LLToastPanel::focusNextItem(FALSE);
- return TRUE;
- }
- else if (KEY_TAB == key && mask == MASK_SHIFT)
- {
- LLToastPanel::focusPrevItem(FALSE);
- return TRUE;
- }
- else
- {
- return TRUE;
- }
+ if( KEY_RETURN == key && mask == MASK_NONE )
+ {
+ LLButton* defaultBtn = getDefaultButton();
+ if(defaultBtn && defaultBtn->getVisible() && defaultBtn->getEnabled())
+ {
+ // If we have a default button, click it when return is pressed
+ defaultBtn->onCommit();
+ }
+ return TRUE;
+ }
+ else if (KEY_RIGHT == key)
+ {
+ LLToastPanel::focusNextItem(FALSE);
+ return TRUE;
+ }
+ else if (KEY_LEFT == key)
+ {
+ LLToastPanel::focusPrevItem(FALSE);
+ return TRUE;
+ }
+ else if (KEY_TAB == key && mask == MASK_NONE)
+ {
+ LLToastPanel::focusNextItem(FALSE);
+ return TRUE;
+ }
+ else if (KEY_TAB == key && mask == MASK_SHIFT)
+ {
+ LLToastPanel::focusPrevItem(FALSE);
+ return TRUE;
+ }
+ else
+ {
+ return TRUE;
+ }
}
// virtual
void LLToastAlertPanel::draw()
{
- // if the default button timer has just expired, activate the default button
- if(mDefaultBtnTimer.hasExpired() && mDefaultBtnTimer.getStarted())
- {
- mDefaultBtnTimer.stop(); // prevent this block from being run more than once
- LLToastPanel::setDefaultBtn(mButtonData[mDefaultOption].mButton);
- }
+ // if the default button timer has just expired, activate the default button
+ if(mDefaultBtnTimer.hasExpired() && mDefaultBtnTimer.getStarted())
+ {
+ mDefaultBtnTimer.stop(); // prevent this block from being run more than once
+ LLToastPanel::setDefaultBtn(mButtonData[mDefaultOption].mButton);
+ }
- static LLUIColor shadow_color = LLUIColorTable::instance().getColor("ColorDropShadow");
- static LLUICachedControl<S32> shadow_lines ("DropShadowFloater", 5);
+ static LLUIColor shadow_color = LLUIColorTable::instance().getColor("ColorDropShadow");
+ static LLUICachedControl<S32> shadow_lines ("DropShadowFloater", 5);
- gl_drop_shadow( 0, LLToastPanel::getRect().getHeight(), LLToastPanel::getRect().getWidth(), 0,
- shadow_color, shadow_lines);
+ gl_drop_shadow( 0, LLToastPanel::getRect().getHeight(), LLToastPanel::getRect().getWidth(), 0,
+ shadow_color, shadow_lines);
- LLToastPanel::draw();
+ LLToastPanel::draw();
}
void LLToastAlertPanel::setEditTextArgs(const LLSD& edit_args)
{
- if (mLineEditor)
- {
- std::string msg = mLineEditor->getText();
- mLineEditor->setText(msg);
- }
- else
- {
- LL_WARNS() << "LLToastAlertPanel::setEditTextArgs called on dialog with no line editor" << LL_ENDL;
- }
+ if (mLineEditor)
+ {
+ std::string msg = mLineEditor->getText();
+ mLineEditor->setText(msg);
+ }
+ else
+ {
+ LL_WARNS() << "LLToastAlertPanel::setEditTextArgs called on dialog with no line editor" << LL_ENDL;
+ }
}
void LLToastAlertPanel::onButtonPressed( const LLSD& data, S32 button )
{
- ButtonData* button_data = &mButtonData[button];
+ ButtonData* button_data = &mButtonData[button];
- LLSD response = mNotification->getResponseTemplate();
- if (mLineEditor)
- {
- response[mLineEditor->getName()] = mLineEditor->getValue();
- }
+ LLSD response = mNotification->getResponseTemplate();
+ if (mLineEditor)
+ {
+ response[mLineEditor->getName()] = mLineEditor->getValue();
+ }
if (mNotification->getForm()->getIgnoreType() != LLNotificationForm::IGNORE_NO)
{
response["ignore"] = mNotification->isIgnored();
}
- response[button_data->mButton->getName()] = true;
-
- // If we declared a URL and chose the URL option, go to the url
- if (!button_data->mURL.empty())
- {
- if (button_data->mURLExternal)
- {
- LLWeb::loadURLExternal(button_data->mURL);
- }
- else
- {
- LLWeb::loadURL(button_data->mURL);
- }
- }
-
- mNotification->respond(response); // new notification reponse
+ response[button_data->mButton->getName()] = true;
+
+ // If we declared a URL and chose the URL option, go to the url
+ if (!button_data->mURL.empty())
+ {
+ if (button_data->mURLExternal)
+ {
+ LLWeb::loadURLExternal(button_data->mURL);
+ }
+ else
+ {
+ LLWeb::loadURL(button_data->mURL);
+ }
+ }
+
+ mNotification->respond(response); // new notification reponse
}
diff --git a/indra/newview/lltoastalertpanel.h b/indra/newview/lltoastalertpanel.h
index bd34e40642..2a9aaf8ce2 100644
--- a/indra/newview/lltoastalertpanel.h
+++ b/indra/newview/lltoastalertpanel.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,61 +46,61 @@ class LLLineEditor;
*/
class LLToastAlertPanel
- : public LLCheckBoxToastPanel
+ : public LLCheckBoxToastPanel
{
- LOG_CLASS(LLToastAlertPanel);
+ LOG_CLASS(LLToastAlertPanel);
public:
- typedef bool (*display_callback_t)(S32 modal);
+ typedef bool (*display_callback_t)(S32 modal);
public:
- // User's responsibility to call show() after creating these.
- LLToastAlertPanel( LLNotificationPtr notep, bool is_modal );
+ // User's responsibility to call show() after creating these.
+ LLToastAlertPanel( LLNotificationPtr notep, bool is_modal );
+
+ virtual BOOL handleKeyHere(KEY key, MASK mask );
+
+ virtual void draw();
+ virtual void setVisible( BOOL visible );
- virtual BOOL handleKeyHere(KEY key, MASK mask );
+ void setCaution(BOOL val = TRUE) { mCaution = val; }
+ // If mUnique==TRUE only one copy of this message should exist
+ void setUnique(BOOL val = TRUE) { mUnique = val; }
+ void setEditTextArgs(const LLSD& edit_args);
- virtual void draw();
- virtual void setVisible( BOOL visible );
+ void onButtonPressed(const LLSD& data, S32 button);
- void setCaution(BOOL val = TRUE) { mCaution = val; }
- // If mUnique==TRUE only one copy of this message should exist
- void setUnique(BOOL val = TRUE) { mUnique = val; }
- void setEditTextArgs(const LLSD& edit_args);
-
- void onButtonPressed(const LLSD& data, S32 button);
-
private:
- static std::map<std::string, LLToastAlertPanel*> sUniqueActiveMap;
+ static std::map<std::string, LLToastAlertPanel*> sUniqueActiveMap;
- virtual ~LLToastAlertPanel();
- // No you can't kill it. It can only kill itself.
+ virtual ~LLToastAlertPanel();
+ // No you can't kill it. It can only kill itself.
- // Does it have a readable title label, or minimize or close buttons?
- BOOL hasTitleBar() const;
+ // Does it have a readable title label, or minimize or close buttons?
+ BOOL hasTitleBar() const;
private:
- static LLControlGroup* sSettings;
-
- struct ButtonData
- {
- ButtonData()
- : mWidth(0)
- {}
-
- LLButton* mButton;
- std::string mURL;
- U32 mURLExternal;
- S32 mWidth;
- };
- std::vector<ButtonData> mButtonData;
-
- S32 mDefaultOption;
- BOOL mCaution;
- BOOL mUnique;
- LLUIString mLabel;
- LLFrameTimer mDefaultBtnTimer;
- // For Dialogs that take a line as text as input:
- LLLineEditor* mLineEditor;
- LLHandle<LLView> mPreviouslyFocusedView;
+ static LLControlGroup* sSettings;
+
+ struct ButtonData
+ {
+ ButtonData()
+ : mWidth(0)
+ {}
+
+ LLButton* mButton;
+ std::string mURL;
+ U32 mURLExternal;
+ S32 mWidth;
+ };
+ std::vector<ButtonData> mButtonData;
+
+ S32 mDefaultOption;
+ BOOL mCaution;
+ BOOL mUnique;
+ LLUIString mLabel;
+ LLFrameTimer mDefaultBtnTimer;
+ // For Dialogs that take a line as text as input:
+ LLLineEditor* mLineEditor;
+ LLHandle<LLView> mPreviouslyFocusedView;
};
diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp
index 817d1dd7b4..2bbf37680b 100644
--- a/indra/newview/lltoastgroupnotifypanel.cpp
+++ b/indra/newview/lltoastgroupnotifypanel.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,108 +49,108 @@
#include "llavatariconctrl.h"
#include "llinventorytype.h"
-const S32 LLToastGroupNotifyPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7;
+const S32 LLToastGroupNotifyPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7;
LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notification)
-: LLToastPanel(notification),
- mInventoryOffer(NULL)
+: LLToastPanel(notification),
+ mInventoryOffer(NULL)
{
- buildFromFile( "panel_group_notify.xml");
- const LLSD& payload = notification->getPayload();
- LLGroupData groupData;
- if (!gAgent.getGroupData(payload["group_id"].asUUID(),groupData))
- {
- LL_WARNS() << "Group notice for unknown group: " << payload["group_id"].asUUID() << LL_ENDL;
- }
-
- //group icon
- LLGroupIconCtrl* pGroupIcon = getChild<LLGroupIconCtrl>("group_icon", TRUE);
-
- // We should already have this data preloaded, so no sense in setting icon through setValue(group_id)
- pGroupIcon->setIconId(groupData.mInsigniaID);
-
- //header title
- std::string from_name = payload["sender_name"].asString();
- from_name = LLCacheName::buildUsername(from_name);
-
- std::stringstream from;
- from << from_name << "/" << groupData.mName;
- LLTextBox* pTitleText = getChild<LLTextBox>("title");
- pTitleText->setValue(from.str());
- pTitleText->setToolTip(from.str());
-
- //message subject
- const std::string& subject = payload["subject"].asString();
- //message body
- const std::string& message = payload["message"].asString();
-
- std::string timeStr = "[" + LLTrans::getString("TimeWeek") + "], ["
- + LLTrans::getString("TimeMonth") + "]/["
- + LLTrans::getString("TimeDay") + "]/["
- + LLTrans::getString("TimeYear") + "] ["
- + LLTrans::getString("TimeHour") + "]:["
- + LLTrans::getString("TimeMin") + "] ["
- + LLTrans::getString("TimeTimezone") + "]";
-
- const LLDate timeStamp = notification->getDate();
- LLDate notice_date = timeStamp.notNull() ? timeStamp : payload["received_time"].asDate();
- LLSD substitution;
- substitution["datetime"] = (S32) notice_date.secondsSinceEpoch();
- LLStringUtil::format(timeStr, substitution);
-
- LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message");
- pMessageText->setContentTrusted(false);
- pMessageText->clear();
-
- LLStyle::Params style;
- LLFontGL* subject_font = LLFontGL::getFontByName(getString("subject_font"));
- if (subject_font)
- style.font = subject_font;
- pMessageText->appendText(subject, FALSE, style);
-
- LLFontGL* date_font = LLFontGL::getFontByName(getString("date_font"));
- if (date_font)
- style.font = date_font;
- pMessageText->appendText(timeStr + "\n", TRUE, style);
-
- style.font = pMessageText->getFont();
- pMessageText->appendText(message, TRUE, style);
-
- //attachment
- BOOL hasInventory = payload["inventory_offer"].isDefined();
-
- //attachment text
- LLTextBox * pAttachLink = getChild<LLTextBox>("attachment");
- //attachment icon
- LLIconCtrl* pAttachIcon = getChild<LLIconCtrl>("attachment_icon", TRUE);
-
- //If attachment is empty let it be invisible and not take place at the panel
- pAttachLink->setVisible(hasInventory);
- pAttachIcon->setVisible(hasInventory);
- if (hasInventory) {
- pAttachLink->setValue(payload["inventory_name"]);
-
- mInventoryOffer = new LLOfferInfo(payload["inventory_offer"]);
- getChild<LLTextBox>("attachment")->setClickedCallback(boost::bind(
- &LLToastGroupNotifyPanel::onClickAttachment, this));
-
- LLUIImagePtr attachIconImg = LLInventoryIcon::getIcon(mInventoryOffer->mType,
- LLInventoryType::IT_TEXTURE);
- pAttachIcon->setValue(attachIconImg->getName());
- }
-
- //ok button
- LLButton* pOkBtn = getChild<LLButton>("btn_ok");
- pOkBtn->setClickedCallback((boost::bind(&LLToastGroupNotifyPanel::onClickOk, this)));
- setDefaultBtn(pOkBtn);
-
- S32 maxLinesCount;
- std::istringstream ss( getString("message_max_lines_count") );
- if (!(ss >> maxLinesCount))
- {
- maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT;
- }
- snapToMessageHeight(pMessageText, maxLinesCount);
+ buildFromFile( "panel_group_notify.xml");
+ const LLSD& payload = notification->getPayload();
+ LLGroupData groupData;
+ if (!gAgent.getGroupData(payload["group_id"].asUUID(),groupData))
+ {
+ LL_WARNS() << "Group notice for unknown group: " << payload["group_id"].asUUID() << LL_ENDL;
+ }
+
+ //group icon
+ LLGroupIconCtrl* pGroupIcon = getChild<LLGroupIconCtrl>("group_icon", TRUE);
+
+ // We should already have this data preloaded, so no sense in setting icon through setValue(group_id)
+ pGroupIcon->setIconId(groupData.mInsigniaID);
+
+ //header title
+ std::string from_name = payload["sender_name"].asString();
+ from_name = LLCacheName::buildUsername(from_name);
+
+ std::stringstream from;
+ from << from_name << "/" << groupData.mName;
+ LLTextBox* pTitleText = getChild<LLTextBox>("title");
+ pTitleText->setValue(from.str());
+ pTitleText->setToolTip(from.str());
+
+ //message subject
+ const std::string& subject = payload["subject"].asString();
+ //message body
+ const std::string& message = payload["message"].asString();
+
+ std::string timeStr = "[" + LLTrans::getString("TimeWeek") + "], ["
+ + LLTrans::getString("TimeMonth") + "]/["
+ + LLTrans::getString("TimeDay") + "]/["
+ + LLTrans::getString("TimeYear") + "] ["
+ + LLTrans::getString("TimeHour") + "]:["
+ + LLTrans::getString("TimeMin") + "] ["
+ + LLTrans::getString("TimeTimezone") + "]";
+
+ const LLDate timeStamp = notification->getDate();
+ LLDate notice_date = timeStamp.notNull() ? timeStamp : payload["received_time"].asDate();
+ LLSD substitution;
+ substitution["datetime"] = (S32) notice_date.secondsSinceEpoch();
+ LLStringUtil::format(timeStr, substitution);
+
+ LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message");
+ pMessageText->setContentTrusted(false);
+ pMessageText->clear();
+
+ LLStyle::Params style;
+ LLFontGL* subject_font = LLFontGL::getFontByName(getString("subject_font"));
+ if (subject_font)
+ style.font = subject_font;
+ pMessageText->appendText(subject, FALSE, style);
+
+ LLFontGL* date_font = LLFontGL::getFontByName(getString("date_font"));
+ if (date_font)
+ style.font = date_font;
+ pMessageText->appendText(timeStr + "\n", TRUE, style);
+
+ style.font = pMessageText->getFont();
+ pMessageText->appendText(message, TRUE, style);
+
+ //attachment
+ BOOL hasInventory = payload["inventory_offer"].isDefined();
+
+ //attachment text
+ LLTextBox * pAttachLink = getChild<LLTextBox>("attachment");
+ //attachment icon
+ LLIconCtrl* pAttachIcon = getChild<LLIconCtrl>("attachment_icon", TRUE);
+
+ //If attachment is empty let it be invisible and not take place at the panel
+ pAttachLink->setVisible(hasInventory);
+ pAttachIcon->setVisible(hasInventory);
+ if (hasInventory) {
+ pAttachLink->setValue(payload["inventory_name"]);
+
+ mInventoryOffer = new LLOfferInfo(payload["inventory_offer"]);
+ getChild<LLTextBox>("attachment")->setClickedCallback(boost::bind(
+ &LLToastGroupNotifyPanel::onClickAttachment, this));
+
+ LLUIImagePtr attachIconImg = LLInventoryIcon::getIcon(mInventoryOffer->mType,
+ LLInventoryType::IT_TEXTURE);
+ pAttachIcon->setValue(attachIconImg->getName());
+ }
+
+ //ok button
+ LLButton* pOkBtn = getChild<LLButton>("btn_ok");
+ pOkBtn->setClickedCallback((boost::bind(&LLToastGroupNotifyPanel::onClickOk, this)));
+ setDefaultBtn(pOkBtn);
+
+ S32 maxLinesCount;
+ std::istringstream ss( getString("message_max_lines_count") );
+ if (!(ss >> maxLinesCount))
+ {
+ maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT;
+ }
+ snapToMessageHeight(pMessageText, maxLinesCount);
}
// virtual
@@ -160,62 +160,62 @@ LLToastGroupNotifyPanel::~LLToastGroupNotifyPanel()
void LLToastGroupNotifyPanel::close()
{
- // The group notice dialog may be an inventory offer.
- // If it has an inventory save button and that button is still enabled
- // Then we need to send the inventory declined message
- if(mInventoryOffer != NULL)
- {
- mInventoryOffer->forceResponse(IOR_DECLINE);
- mInventoryOffer = NULL;
- }
-
- die();
+ // The group notice dialog may be an inventory offer.
+ // If it has an inventory save button and that button is still enabled
+ // Then we need to send the inventory declined message
+ if(mInventoryOffer != NULL)
+ {
+ mInventoryOffer->forceResponse(IOR_DECLINE);
+ mInventoryOffer = NULL;
+ }
+
+ die();
}
void LLToastGroupNotifyPanel::onClickOk()
{
- LLSD response = mNotification->getResponseTemplate();
- mNotification->respond(response);
- close();
+ LLSD response = mNotification->getResponseTemplate();
+ mNotification->respond(response);
+ close();
}
void LLToastGroupNotifyPanel::onClickAttachment()
{
- if (mInventoryOffer != NULL) {
- mInventoryOffer->forceResponse(IOR_ACCEPT);
+ if (mInventoryOffer != NULL) {
+ mInventoryOffer->forceResponse(IOR_ACCEPT);
- LLTextBox * pAttachLink = getChild<LLTextBox> ("attachment");
- static const LLUIColor textColor = LLUIColorTable::instance().getColor(
- "GroupNotifyDimmedTextColor");
- pAttachLink->setColor(textColor);
+ LLTextBox * pAttachLink = getChild<LLTextBox> ("attachment");
+ static const LLUIColor textColor = LLUIColorTable::instance().getColor(
+ "GroupNotifyDimmedTextColor");
+ pAttachLink->setColor(textColor);
- LLIconCtrl* pAttachIcon =
- getChild<LLIconCtrl> ("attachment_icon", TRUE);
- pAttachIcon->setEnabled(FALSE);
+ LLIconCtrl* pAttachIcon =
+ getChild<LLIconCtrl> ("attachment_icon", TRUE);
+ pAttachIcon->setEnabled(FALSE);
- //if attachment isn't openable - notify about saving
- if (!isAttachmentOpenable(mInventoryOffer->mType)) {
- LLNotifications::instance().add("AttachmentSaved", LLSD(), LLSD());
- }
+ //if attachment isn't openable - notify about saving
+ if (!isAttachmentOpenable(mInventoryOffer->mType)) {
+ LLNotifications::instance().add("AttachmentSaved", LLSD(), LLSD());
+ }
- mInventoryOffer = NULL;
- }
+ mInventoryOffer = NULL;
+ }
}
//static
bool LLToastGroupNotifyPanel::isAttachmentOpenable(LLAssetType::EType type)
{
- switch(type)
- {
- case LLAssetType::AT_LANDMARK:
- case LLAssetType::AT_NOTECARD:
- case LLAssetType::AT_IMAGE_JPEG:
- case LLAssetType::AT_IMAGE_TGA:
- case LLAssetType::AT_TEXTURE:
- case LLAssetType::AT_TEXTURE_TGA:
- return true;
- default:
- return false;
- }
+ switch(type)
+ {
+ case LLAssetType::AT_LANDMARK:
+ case LLAssetType::AT_NOTECARD:
+ case LLAssetType::AT_IMAGE_JPEG:
+ case LLAssetType::AT_IMAGE_TGA:
+ case LLAssetType::AT_TEXTURE:
+ case LLAssetType::AT_TEXTURE_TGA:
+ return true;
+ default:
+ return false;
+ }
}
diff --git a/indra/newview/lltoastgroupnotifypanel.h b/indra/newview/lltoastgroupnotifypanel.h
index 269c23798c..d30f08099a 100644
--- a/indra/newview/lltoastgroupnotifypanel.h
+++ b/indra/newview/lltoastgroupnotifypanel.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,27 +41,27 @@ class LLButton;
* Replaces class LLGroupNotifyBox.
*/
class LLToastGroupNotifyPanel
-: public LLToastPanel
+: public LLToastPanel
{
public:
- void close();
+ void close();
- // Non-transient messages. You can specify non-default button
- // layouts (like one for script dialogs) by passing various
- // numbers in for "layout".
- LLToastGroupNotifyPanel(const LLNotificationPtr& notification);
+ // Non-transient messages. You can specify non-default button
+ // layouts (like one for script dialogs) by passing various
+ // numbers in for "layout".
+ LLToastGroupNotifyPanel(const LLNotificationPtr& notification);
- /*virtual*/ ~LLToastGroupNotifyPanel();
+ /*virtual*/ ~LLToastGroupNotifyPanel();
protected:
- void onClickOk();
- void onClickAttachment();
+ void onClickOk();
+ void onClickAttachment();
private:
- static bool isAttachmentOpenable(LLAssetType::EType);
+ static bool isAttachmentOpenable(LLAssetType::EType);
- static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT;
+ static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT;
- LLUUID mGroupID;
- LLOfferInfo* mInventoryOffer;
+ LLUUID mGroupID;
+ LLOfferInfo* mInventoryOffer;
};
// This view contains the stack of notification windows.
diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp
index c4c4b13a2f..f7e2d49e13 100644
--- a/indra/newview/lltoastimpanel.cpp
+++ b/indra/newview/lltoastimpanel.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,76 +39,76 @@
#include "llviewerchat.h"
-const S32 LLToastIMPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT = 6;
+const S32 LLToastIMPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT = 6;
//--------------------------------------------------------------------------
-LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notification),
- mAvatarIcon(NULL), mAvatarName(NULL),
- mTime(NULL), mMessage(NULL), mGroupIcon(NULL)
+LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notification),
+ mAvatarIcon(NULL), mAvatarName(NULL),
+ mTime(NULL), mMessage(NULL), mGroupIcon(NULL)
{
- buildFromFile( "panel_instant_message.xml");
-
- mGroupIcon = getChild<LLGroupIconCtrl>("group_icon");
- mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon");
- mAdhocIcon = getChild<LLAvatarIconCtrl>("adhoc_icon");
- mAvatarName = getChild<LLTextBox>("user_name");
- mTime = getChild<LLTextBox>("time_box");
- mMessage = getChild<LLTextBox>("message");
- mMessage->setContentTrusted(false);
-
- LLStyle::Params style_params;
- LLFontGL* fontp = LLViewerChat::getChatFont();
- std::string font_name = LLFontGL::nameFromFont(fontp);
- std::string font_size = LLFontGL::sizeFromFont(fontp);
- style_params.font.name(font_name);
- style_params.font.size(font_size);
-
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(p.session_id);
- mIsGroupMsg = (im_session && im_session->mSessionType == LLIMModel::LLIMSession::GROUP_SESSION);
- std::string title = mIsGroupMsg ? im_session->mName : p.from;
- mAvatarName->setValue(title);
-
- //Handle IRC styled /me messages.
- std::string prefix = p.message.substr(0, 4);
- if (prefix == "/me " || prefix == "/me'")
- {
- //style_params.font.style = "UNDERLINE";
- mMessage->clear();
-
- style_params.font.style ="ITALIC";
- mMessage->appendText(p.from, FALSE, style_params);
-
- style_params.font.style = "ITALIC";
- mMessage->appendText(p.message.substr(3), FALSE, style_params);
- }
- else
- {
- if (mIsGroupMsg)
- {
- LLAvatarName avatar_name;
- LLAvatarNameCache::get(p.avatar_id, &avatar_name);
- p.message = "[From " + avatar_name.getDisplayName() + "]\n" + p.message;
- }
- style_params.font.style = "NORMAL";
- mMessage->setText(p.message, style_params);
- }
-
- mTime->setValue(p.time);
- mSessionID = p.session_id;
- mAvatarID = p.avatar_id;
- mNotification = p.notification;
-
-
-
- initIcon();
-
- S32 maxLinesCount;
- std::istringstream ss( getString("message_max_lines_count") );
- if (!(ss >> maxLinesCount))
- {
- maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT;
- }
- snapToMessageHeight(mMessage, maxLinesCount);
+ buildFromFile( "panel_instant_message.xml");
+
+ mGroupIcon = getChild<LLGroupIconCtrl>("group_icon");
+ mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon");
+ mAdhocIcon = getChild<LLAvatarIconCtrl>("adhoc_icon");
+ mAvatarName = getChild<LLTextBox>("user_name");
+ mTime = getChild<LLTextBox>("time_box");
+ mMessage = getChild<LLTextBox>("message");
+ mMessage->setContentTrusted(false);
+
+ LLStyle::Params style_params;
+ LLFontGL* fontp = LLViewerChat::getChatFont();
+ std::string font_name = LLFontGL::nameFromFont(fontp);
+ std::string font_size = LLFontGL::sizeFromFont(fontp);
+ style_params.font.name(font_name);
+ style_params.font.size(font_size);
+
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(p.session_id);
+ mIsGroupMsg = (im_session && im_session->mSessionType == LLIMModel::LLIMSession::GROUP_SESSION);
+ std::string title = mIsGroupMsg ? im_session->mName : p.from;
+ mAvatarName->setValue(title);
+
+ //Handle IRC styled /me messages.
+ std::string prefix = p.message.substr(0, 4);
+ if (prefix == "/me " || prefix == "/me'")
+ {
+ //style_params.font.style = "UNDERLINE";
+ mMessage->clear();
+
+ style_params.font.style ="ITALIC";
+ mMessage->appendText(p.from, FALSE, style_params);
+
+ style_params.font.style = "ITALIC";
+ mMessage->appendText(p.message.substr(3), FALSE, style_params);
+ }
+ else
+ {
+ if (mIsGroupMsg)
+ {
+ LLAvatarName avatar_name;
+ LLAvatarNameCache::get(p.avatar_id, &avatar_name);
+ p.message = "[From " + avatar_name.getDisplayName() + "]\n" + p.message;
+ }
+ style_params.font.style = "NORMAL";
+ mMessage->setText(p.message, style_params);
+ }
+
+ mTime->setValue(p.time);
+ mSessionID = p.session_id;
+ mAvatarID = p.avatar_id;
+ mNotification = p.notification;
+
+
+
+ initIcon();
+
+ S32 maxLinesCount;
+ std::istringstream ss( getString("message_max_lines_count") );
+ if (!(ss >> maxLinesCount))
+ {
+ maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT;
+ }
+ snapToMessageHeight(mMessage, maxLinesCount);
}
//--------------------------------------------------------------------------
@@ -119,131 +119,131 @@ LLToastIMPanel::~LLToastIMPanel()
//virtual
BOOL LLToastIMPanel::handleMouseUp(S32 x, S32 y, MASK mask)
{
- if (LLPanel::handleMouseUp(x,y,mask) == FALSE)
- {
- mNotification->respond(mNotification->getResponseTemplate());
- }
+ if (LLPanel::handleMouseUp(x,y,mask) == FALSE)
+ {
+ mNotification->respond(mNotification->getResponseTemplate());
+ }
- return TRUE;
+ return TRUE;
}
//virtual
BOOL LLToastIMPanel::handleToolTip(S32 x, S32 y, MASK mask)
{
- // It's not our direct child, so parentPointInView() doesn't work.
- LLRect ctrl_rect;
-
- mAvatarName->localRectToOtherView(mAvatarName->getLocalRect(), &ctrl_rect, this);
- if (ctrl_rect.pointInRect(x, y))
- {
- spawnNameToolTip();
- return TRUE;
- }
-
- mGroupIcon->localRectToOtherView(mGroupIcon->getLocalRect(), &ctrl_rect, this);
- if(mGroupIcon->getVisible() && ctrl_rect.pointInRect(x, y))
- {
- spawnGroupIconToolTip();
- return TRUE;
- }
-
- return LLToastPanel::handleToolTip(x, y, mask);
+ // It's not our direct child, so parentPointInView() doesn't work.
+ LLRect ctrl_rect;
+
+ mAvatarName->localRectToOtherView(mAvatarName->getLocalRect(), &ctrl_rect, this);
+ if (ctrl_rect.pointInRect(x, y))
+ {
+ spawnNameToolTip();
+ return TRUE;
+ }
+
+ mGroupIcon->localRectToOtherView(mGroupIcon->getLocalRect(), &ctrl_rect, this);
+ if(mGroupIcon->getVisible() && ctrl_rect.pointInRect(x, y))
+ {
+ spawnGroupIconToolTip();
+ return TRUE;
+ }
+
+ return LLToastPanel::handleToolTip(x, y, mask);
}
void LLToastIMPanel::spawnNameToolTip()
{
- // Spawn at right side of the name textbox.
- LLRect sticky_rect = mAvatarName->calcScreenRect();
- S32 icon_x =
- llmin(sticky_rect.mLeft + mAvatarName->getTextPixelWidth() + 3, sticky_rect.mRight);
- LLCoordGL pos(icon_x, sticky_rect.mTop);
-
- LLToolTip::Params params;
- params.background_visible(false);
- if(!mIsGroupMsg)
- {
- params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_avatar", LLSD().with("avatar_id", mAvatarID), FALSE));
- }
- else
- {
- params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_group", LLSD().with("group_id", mSessionID), FALSE));
- }
- params.delay_time(0.0f); // spawn instantly on hover
- params.image(LLUI::getUIImage("Info_Small"));
- params.message("");
- params.padding(0);
- params.pos(pos);
- params.sticky_rect(sticky_rect);
-
- LLToolTipMgr::getInstance()->show(params);
+ // Spawn at right side of the name textbox.
+ LLRect sticky_rect = mAvatarName->calcScreenRect();
+ S32 icon_x =
+ llmin(sticky_rect.mLeft + mAvatarName->getTextPixelWidth() + 3, sticky_rect.mRight);
+ LLCoordGL pos(icon_x, sticky_rect.mTop);
+
+ LLToolTip::Params params;
+ params.background_visible(false);
+ if(!mIsGroupMsg)
+ {
+ params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_avatar", LLSD().with("avatar_id", mAvatarID), FALSE));
+ }
+ else
+ {
+ params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_group", LLSD().with("group_id", mSessionID), FALSE));
+ }
+ params.delay_time(0.0f); // spawn instantly on hover
+ params.image(LLUI::getUIImage("Info_Small"));
+ params.message("");
+ params.padding(0);
+ params.pos(pos);
+ params.sticky_rect(sticky_rect);
+
+ LLToolTipMgr::getInstance()->show(params);
}
void LLToastIMPanel::spawnGroupIconToolTip()
{
- // Spawn at right bottom side of group icon.
- LLRect sticky_rect = mGroupIcon->calcScreenRect();
- LLCoordGL pos(sticky_rect.mRight, sticky_rect.mBottom);
-
- LLGroupData g_data;
- if(!gAgent.getGroupData(mSessionID, g_data))
- {
- LL_WARNS() << "Error getting group data" << LL_ENDL;
- }
-
- LLInspector::Params params;
- params.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
- params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_group", LLSD().with("group_id", mSessionID), FALSE));
- params.delay_time(0.100f);
- params.image(LLUI::getUIImage("Info_Small"));
- params.message(g_data.mName);
- params.padding(3);
- params.pos(pos);
- params.max_width(300);
-
- LLToolTipMgr::getInstance()->show(params);
+ // Spawn at right bottom side of group icon.
+ LLRect sticky_rect = mGroupIcon->calcScreenRect();
+ LLCoordGL pos(sticky_rect.mRight, sticky_rect.mBottom);
+
+ LLGroupData g_data;
+ if(!gAgent.getGroupData(mSessionID, g_data))
+ {
+ LL_WARNS() << "Error getting group data" << LL_ENDL;
+ }
+
+ LLInspector::Params params;
+ params.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
+ params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_group", LLSD().with("group_id", mSessionID), FALSE));
+ params.delay_time(0.100f);
+ params.image(LLUI::getUIImage("Info_Small"));
+ params.message(g_data.mName);
+ params.padding(3);
+ params.pos(pos);
+ params.max_width(300);
+
+ LLToolTipMgr::getInstance()->show(params);
}
void LLToastIMPanel::initIcon()
{
- mAvatarIcon->setVisible(FALSE);
- mGroupIcon->setVisible(FALSE);
- mAdhocIcon->setVisible(FALSE);
-
- if(mAvatarName->getValue().asString() == SYSTEM_FROM)
- {
- // "sys_msg_icon" was disabled by Erica in the changeset: 5109 (85181bc92cbe)
- // and "dummy widget" warnings appeared in log.
- // It does not make sense to have such image with empty name. Removed for EXT-5057.
- }
- else
- {
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionID);
- if(!im_session)
- {
- LL_WARNS() << "Invalid IM session" << LL_ENDL;
- return;
- }
-
- switch(im_session->mSessionType)
- {
- case LLIMModel::LLIMSession::P2P_SESSION:
- mAvatarIcon->setVisible(TRUE);
- mAvatarIcon->setValue(mAvatarID);
- break;
- case LLIMModel::LLIMSession::GROUP_SESSION:
- mGroupIcon->setVisible(TRUE);
- mGroupIcon->setValue(mSessionID);
- break;
- case LLIMModel::LLIMSession::ADHOC_SESSION:
- mAdhocIcon->setVisible(TRUE);
- mAdhocIcon->setValue(im_session->mOtherParticipantID);
- mAdhocIcon->setToolTip(im_session->mName);
- break;
- default:
- LL_WARNS() << "Unknown IM session type" << LL_ENDL;
- break;
- }
- }
+ mAvatarIcon->setVisible(FALSE);
+ mGroupIcon->setVisible(FALSE);
+ mAdhocIcon->setVisible(FALSE);
+
+ if(mAvatarName->getValue().asString() == SYSTEM_FROM)
+ {
+ // "sys_msg_icon" was disabled by Erica in the changeset: 5109 (85181bc92cbe)
+ // and "dummy widget" warnings appeared in log.
+ // It does not make sense to have such image with empty name. Removed for EXT-5057.
+ }
+ else
+ {
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionID);
+ if(!im_session)
+ {
+ LL_WARNS() << "Invalid IM session" << LL_ENDL;
+ return;
+ }
+
+ switch(im_session->mSessionType)
+ {
+ case LLIMModel::LLIMSession::P2P_SESSION:
+ mAvatarIcon->setVisible(TRUE);
+ mAvatarIcon->setValue(mAvatarID);
+ break;
+ case LLIMModel::LLIMSession::GROUP_SESSION:
+ mGroupIcon->setVisible(TRUE);
+ mGroupIcon->setValue(mSessionID);
+ break;
+ case LLIMModel::LLIMSession::ADHOC_SESSION:
+ mAdhocIcon->setVisible(TRUE);
+ mAdhocIcon->setValue(im_session->mOtherParticipantID);
+ mAdhocIcon->setToolTip(im_session->mName);
+ break;
+ default:
+ LL_WARNS() << "Unknown IM session type" << LL_ENDL;
+ break;
+ }
+ }
}
// EOF
diff --git a/indra/newview/lltoastimpanel.h b/indra/newview/lltoastimpanel.h
index 767617dabc..07985f205e 100644
--- a/indra/newview/lltoastimpanel.h
+++ b/indra/newview/lltoastimpanel.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,46 +35,46 @@
class LLGroupIconCtrl;
-class LLToastIMPanel: public LLToastPanel
+class LLToastIMPanel: public LLToastPanel
{
public:
- struct Params
- {
- LLNotificationPtr notification;
- LLUUID avatar_id,
- session_id;
- std::string from,
- time,
- message;
+ struct Params
+ {
+ LLNotificationPtr notification;
+ LLUUID avatar_id,
+ session_id;
+ std::string from,
+ time,
+ message;
- Params() {}
- };
+ Params() {}
+ };
- LLToastIMPanel(LLToastIMPanel::Params &p);
- virtual ~LLToastIMPanel();
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ LLToastIMPanel(LLToastIMPanel::Params &p);
+ virtual ~LLToastIMPanel();
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
private:
- void showInspector();
+ void showInspector();
- void spawnNameToolTip();
- void spawnGroupIconToolTip();
+ void spawnNameToolTip();
+ void spawnGroupIconToolTip();
- void initIcon();
+ void initIcon();
- static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT;
+ static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT;
- LLNotificationPtr mNotification;
- LLUUID mSessionID;
- LLUUID mAvatarID;
- LLAvatarIconCtrl* mAvatarIcon;
- LLGroupIconCtrl* mGroupIcon;
- LLAvatarIconCtrl* mAdhocIcon;
- LLTextBox* mAvatarName;
- LLTextBox* mTime;
- LLTextBox* mMessage;
+ LLNotificationPtr mNotification;
+ LLUUID mSessionID;
+ LLUUID mAvatarID;
+ LLAvatarIconCtrl* mAvatarIcon;
+ LLGroupIconCtrl* mGroupIcon;
+ LLAvatarIconCtrl* mAdhocIcon;
+ LLTextBox* mAvatarName;
+ LLTextBox* mTime;
+ LLTextBox* mMessage;
- bool mIsGroupMsg;
+ bool mIsGroupMsg;
};
#endif // LLTOASTIMPANEL_H_
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index bf3f4c1e88..dc5d9c9e1f 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,201 +55,201 @@ const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL;
LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal;
-LLToastNotifyPanel::LLToastNotifyPanel(const LLNotificationPtr& notification, const LLRect& rect, bool show_images)
-: LLCheckBoxToastPanel(notification),
- LLInstanceTracker<LLToastNotifyPanel, LLUUID, LLInstanceTrackerReplaceOnCollision>(notification->getID())
+LLToastNotifyPanel::LLToastNotifyPanel(const LLNotificationPtr& notification, const LLRect& rect, bool show_images)
+: LLCheckBoxToastPanel(notification),
+ LLInstanceTracker<LLToastNotifyPanel, LLUUID, LLInstanceTrackerReplaceOnCollision>(notification->getID())
{
- init(rect, show_images);
+ init(rect, show_images);
}
void LLToastNotifyPanel::addDefaultButton()
{
- LLSD form_element;
- form_element.with("name", "OK").with("text", LLTrans::getString("ok")).with("default", true);
- LLButton* ok_btn = createButton(form_element, FALSE);
- LLRect new_btn_rect(ok_btn->getRect());
-
- new_btn_rect.setOriginAndSize(llabs(getRect().getWidth() - BUTTON_WIDTH)/ 2, BOTTOM_PAD,
- //auto_size for ok button makes it very small, so let's make it wider
- BUTTON_WIDTH, new_btn_rect.getHeight());
- ok_btn->setRect(new_btn_rect);
- addChild(ok_btn, -1);
- mNumButtons = 1;
- mAddedDefaultBtn = true;
+ LLSD form_element;
+ form_element.with("name", "OK").with("text", LLTrans::getString("ok")).with("default", true);
+ LLButton* ok_btn = createButton(form_element, FALSE);
+ LLRect new_btn_rect(ok_btn->getRect());
+
+ new_btn_rect.setOriginAndSize(llabs(getRect().getWidth() - BUTTON_WIDTH)/ 2, BOTTOM_PAD,
+ //auto_size for ok button makes it very small, so let's make it wider
+ BUTTON_WIDTH, new_btn_rect.getHeight());
+ ok_btn->setRect(new_btn_rect);
+ addChild(ok_btn, -1);
+ mNumButtons = 1;
+ mAddedDefaultBtn = true;
}
LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_option)
{
- InstanceAndS32* userdata = new InstanceAndS32;
- userdata->mSelf = this;
- userdata->mButtonName = is_option ? form_element["name"].asString() : "";
-
- mBtnCallbackData.push_back(userdata);
-
- LLButton::Params p;
- bool make_small_btn = form_element["index"].asInteger() == -1 || form_element["index"].asInteger() == -2;
- const LLFontGL* font = make_small_btn ? sFontSmall: sFont; // for block and ignore buttons in script dialog
- p.name = form_element["name"].asString();
- p.label = form_element["text"].asString();
- p.tool_tip = form_element["text"].asString();
- p.font = font;
- p.rect.height = BTN_HEIGHT;
- p.click_callback.function(boost::bind(&LLToastNotifyPanel::onClickButton, userdata));
- p.rect.width = BUTTON_WIDTH;
- p.auto_resize = false;
- p.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
- p.enabled = !form_element.has("enabled") || form_element["enabled"].asBoolean();
- if (mIsCaution)
- {
- p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
- p.image_color_disabled(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
- }
- // for the scriptdialog buttons we use fixed button size. This is a limit!
- if (!mIsScriptDialog && font->getWidth(form_element["text"].asString()) > (BUTTON_WIDTH-2*HPAD))
- {
- p.rect.width = 1;
- p.auto_resize = true;
- }
- else if (mIsScriptDialog && make_small_btn)
- {
- // this is ignore button, make it smaller
- p.rect.height = BTN_HEIGHT_SMALL;
- p.rect.width = 1;
- p.auto_resize = true;
- }
- LLButton* btn = LLUICtrlFactory::create<LLButton>(p);
- mNumButtons++;
- btn->autoResize();
- if (form_element["default"].asBoolean())
- {
- setDefaultBtn(btn);
- }
-
- return btn;
+ InstanceAndS32* userdata = new InstanceAndS32;
+ userdata->mSelf = this;
+ userdata->mButtonName = is_option ? form_element["name"].asString() : "";
+
+ mBtnCallbackData.push_back(userdata);
+
+ LLButton::Params p;
+ bool make_small_btn = form_element["index"].asInteger() == -1 || form_element["index"].asInteger() == -2;
+ const LLFontGL* font = make_small_btn ? sFontSmall: sFont; // for block and ignore buttons in script dialog
+ p.name = form_element["name"].asString();
+ p.label = form_element["text"].asString();
+ p.tool_tip = form_element["text"].asString();
+ p.font = font;
+ p.rect.height = BTN_HEIGHT;
+ p.click_callback.function(boost::bind(&LLToastNotifyPanel::onClickButton, userdata));
+ p.rect.width = BUTTON_WIDTH;
+ p.auto_resize = false;
+ p.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
+ p.enabled = !form_element.has("enabled") || form_element["enabled"].asBoolean();
+ if (mIsCaution)
+ {
+ p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
+ p.image_color_disabled(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
+ }
+ // for the scriptdialog buttons we use fixed button size. This is a limit!
+ if (!mIsScriptDialog && font->getWidth(form_element["text"].asString()) > (BUTTON_WIDTH-2*HPAD))
+ {
+ p.rect.width = 1;
+ p.auto_resize = true;
+ }
+ else if (mIsScriptDialog && make_small_btn)
+ {
+ // this is ignore button, make it smaller
+ p.rect.height = BTN_HEIGHT_SMALL;
+ p.rect.width = 1;
+ p.auto_resize = true;
+ }
+ LLButton* btn = LLUICtrlFactory::create<LLButton>(p);
+ mNumButtons++;
+ btn->autoResize();
+ if (form_element["default"].asBoolean())
+ {
+ setDefaultBtn(btn);
+ }
+
+ return btn;
}
-LLToastNotifyPanel::~LLToastNotifyPanel()
+LLToastNotifyPanel::~LLToastNotifyPanel()
{
- mButtonClickConnection.disconnect();
+ mButtonClickConnection.disconnect();
- std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer());
- mBtnCallbackData.clear();
- if (mIsTip)
- {
- LLNotifications::getInstance()->cancel(mNotification);
- }
- }
+ std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer());
+ mBtnCallbackData.clear();
+ if (mIsTip)
+ {
+ LLNotifications::getInstance()->cancel(mNotification);
+ }
+ }
void LLToastNotifyPanel::updateButtonsLayout(const std::vector<index_button_pair_t>& buttons, S32 h_pad)
{
- S32 left = 0;
- //reserve place for ignore button
- S32 bottom_offset = mIsScriptDialog ? (BTN_HEIGHT + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD) : BOTTOM_PAD;
- S32 max_width = mControlPanel->getRect().getWidth();
- LLButton* ignore_btn = NULL;
- LLButton* mute_btn = NULL;
- for (std::vector<index_button_pair_t>::const_iterator it = buttons.begin(); it != buttons.end(); it++)
- {
- if (-2 == it->first)
- {
- mute_btn = it->second;
- continue;
- }
- if (it->first == -1)
- {
- ignore_btn = it->second;
- continue;
- }
- LLButton* btn = it->second;
- LLRect btn_rect(btn->getRect());
- if (buttons.size() == 1) // for the one-button forms, center that button
- {
- left = (max_width - btn_rect.getWidth()) / 2;
- }
- else if (left == 0 && buttons.size() == 2)
- {
- // Note: this and "size() == 1" shouldn't be inside the cycle, might be good idea to refactor whole placing process
- left = (max_width - (btn_rect.getWidth() * 2) - h_pad) / 2;
- }
- else if (left + btn_rect.getWidth() > max_width)// whether there is still some place for button+h_pad in the mControlPanel
- {
- // looks like we need to add button to the next row
- left = 0;
- bottom_offset += (BTN_HEIGHT + VPAD);
- }
- //we arrange buttons from bottom to top for backward support of old script
- btn_rect.setOriginAndSize(left, bottom_offset, btn_rect.getWidth(), btn_rect.getHeight());
- btn->setRect(btn_rect);
- left = btn_rect.mLeft + btn_rect.getWidth() + h_pad;
- mControlPanel->addChild(btn, -1);
- }
-
- U32 ignore_btn_width = 0;
- U32 mute_btn_pad = 0;
- if (mIsScriptDialog && ignore_btn != NULL)
- {
- LLRect ignore_btn_rect(ignore_btn->getRect());
- S32 ignore_btn_left = max_width - ignore_btn_rect.getWidth();
- ignore_btn_rect.setOriginAndSize(ignore_btn_left, BOTTOM_PAD,// always move ignore button at the bottom
- ignore_btn_rect.getWidth(), ignore_btn_rect.getHeight());
- ignore_btn->setRect(ignore_btn_rect);
- ignore_btn_width = ignore_btn_rect.getWidth();
- mControlPanel->addChild(ignore_btn, -1);
- mute_btn_pad = 4 * HPAD; //only use a 4 * HPAD padding if an ignore button exists
- }
-
- if (mIsScriptDialog && mute_btn != NULL)
- {
- LLRect mute_btn_rect(mute_btn->getRect());
- // Place mute (Block) button to the left of the ignore button.
- S32 mute_btn_left = max_width - mute_btn_rect.getWidth() - ignore_btn_width - mute_btn_pad;
- mute_btn_rect.setOriginAndSize(mute_btn_left, BOTTOM_PAD,// always move mute button at the bottom
- mute_btn_rect.getWidth(), mute_btn_rect.getHeight());
- mute_btn->setRect(mute_btn_rect);
- mControlPanel->addChild(mute_btn);
- }
+ S32 left = 0;
+ //reserve place for ignore button
+ S32 bottom_offset = mIsScriptDialog ? (BTN_HEIGHT + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD) : BOTTOM_PAD;
+ S32 max_width = mControlPanel->getRect().getWidth();
+ LLButton* ignore_btn = NULL;
+ LLButton* mute_btn = NULL;
+ for (std::vector<index_button_pair_t>::const_iterator it = buttons.begin(); it != buttons.end(); it++)
+ {
+ if (-2 == it->first)
+ {
+ mute_btn = it->second;
+ continue;
+ }
+ if (it->first == -1)
+ {
+ ignore_btn = it->second;
+ continue;
+ }
+ LLButton* btn = it->second;
+ LLRect btn_rect(btn->getRect());
+ if (buttons.size() == 1) // for the one-button forms, center that button
+ {
+ left = (max_width - btn_rect.getWidth()) / 2;
+ }
+ else if (left == 0 && buttons.size() == 2)
+ {
+ // Note: this and "size() == 1" shouldn't be inside the cycle, might be good idea to refactor whole placing process
+ left = (max_width - (btn_rect.getWidth() * 2) - h_pad) / 2;
+ }
+ else if (left + btn_rect.getWidth() > max_width)// whether there is still some place for button+h_pad in the mControlPanel
+ {
+ // looks like we need to add button to the next row
+ left = 0;
+ bottom_offset += (BTN_HEIGHT + VPAD);
+ }
+ //we arrange buttons from bottom to top for backward support of old script
+ btn_rect.setOriginAndSize(left, bottom_offset, btn_rect.getWidth(), btn_rect.getHeight());
+ btn->setRect(btn_rect);
+ left = btn_rect.mLeft + btn_rect.getWidth() + h_pad;
+ mControlPanel->addChild(btn, -1);
+ }
+
+ U32 ignore_btn_width = 0;
+ U32 mute_btn_pad = 0;
+ if (mIsScriptDialog && ignore_btn != NULL)
+ {
+ LLRect ignore_btn_rect(ignore_btn->getRect());
+ S32 ignore_btn_left = max_width - ignore_btn_rect.getWidth();
+ ignore_btn_rect.setOriginAndSize(ignore_btn_left, BOTTOM_PAD,// always move ignore button at the bottom
+ ignore_btn_rect.getWidth(), ignore_btn_rect.getHeight());
+ ignore_btn->setRect(ignore_btn_rect);
+ ignore_btn_width = ignore_btn_rect.getWidth();
+ mControlPanel->addChild(ignore_btn, -1);
+ mute_btn_pad = 4 * HPAD; //only use a 4 * HPAD padding if an ignore button exists
+ }
+
+ if (mIsScriptDialog && mute_btn != NULL)
+ {
+ LLRect mute_btn_rect(mute_btn->getRect());
+ // Place mute (Block) button to the left of the ignore button.
+ S32 mute_btn_left = max_width - mute_btn_rect.getWidth() - ignore_btn_width - mute_btn_pad;
+ mute_btn_rect.setOriginAndSize(mute_btn_left, BOTTOM_PAD,// always move mute button at the bottom
+ mute_btn_rect.getWidth(), mute_btn_rect.getHeight());
+ mute_btn->setRect(mute_btn_rect);
+ mControlPanel->addChild(mute_btn);
+ }
}
void LLToastNotifyPanel::adjustPanelForScriptNotice(S32 button_panel_width, S32 button_panel_height)
{
- //adjust layout
- // we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed
- reshape(getRect().getWidth(), mInfoPanel->getRect().getHeight() + button_panel_height + VPAD);
- mControlPanel->reshape( button_panel_width, button_panel_height);
+ //adjust layout
+ // we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed
+ reshape(getRect().getWidth(), mInfoPanel->getRect().getHeight() + button_panel_height + VPAD);
+ mControlPanel->reshape( button_panel_width, button_panel_height);
}
void LLToastNotifyPanel::adjustPanelForTipNotice()
{
- //we don't need display ControlPanel for tips because they doesn't contain any buttons.
- mControlPanel->setVisible(FALSE);
- reshape(getRect().getWidth(), mInfoPanel->getRect().getHeight());
-
- if (mNotification->getPayload().has("respond_on_mousedown")
- && mNotification->getPayload()["respond_on_mousedown"] )
- {
- mInfoPanel->setMouseDownCallback(
- boost::bind(&LLNotification::respond,
- mNotification,
- mNotification->getResponseTemplate()));
- }
+ //we don't need display ControlPanel for tips because they doesn't contain any buttons.
+ mControlPanel->setVisible(FALSE);
+ reshape(getRect().getWidth(), mInfoPanel->getRect().getHeight());
+
+ if (mNotification->getPayload().has("respond_on_mousedown")
+ && mNotification->getPayload()["respond_on_mousedown"] )
+ {
+ mInfoPanel->setMouseDownCallback(
+ boost::bind(&LLNotification::respond,
+ mNotification,
+ mNotification->getResponseTemplate()));
+ }
}
// static
void LLToastNotifyPanel::onClickButton(void* data)
{
- InstanceAndS32* self_and_button = (InstanceAndS32*)data;
- LLToastNotifyPanel* self = self_and_button->mSelf;
- std::string button_name = self_and_button->mButtonName;
+ InstanceAndS32* self_and_button = (InstanceAndS32*)data;
+ LLToastNotifyPanel* self = self_and_button->mSelf;
+ std::string button_name = self_and_button->mButtonName;
- LLSD response = self->mNotification->getResponseTemplate();
- if (!self->mAddedDefaultBtn && !button_name.empty())
- {
- response[button_name] = true;
- }
+ LLSD response = self->mNotification->getResponseTemplate();
+ if (!self->mAddedDefaultBtn && !button_name.empty())
+ {
+ response[button_name] = true;
+ }
- // disable all buttons
- self->mControlPanel->setEnabled(FALSE);
+ // disable all buttons
+ self->mControlPanel->setEnabled(FALSE);
- // this might repost notification with new form data/enabled buttons
- self->mNotification->respond(response);
+ // this might repost notification with new form data/enabled buttons
+ self->mNotification->respond(response);
}
void LLToastNotifyPanel::init( LLRect rect, bool show_images )
@@ -263,10 +263,10 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
mNumButtons = 0;
mAddedDefaultBtn = false;
- LLRect current_rect = getRect();
+ LLRect current_rect = getRect();
- setXMLFilename("");
- buildFromFile("panel_notification.xml");
+ setXMLFilename("");
+ buildFromFile("panel_notification.xml");
if(rect != LLRect::null)
{
@@ -310,7 +310,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
// customize panel's outfit
// preliminary adjust panel's layout
- //move to the end
+ //move to the end
//mIsTip ? adjustPanelForTipNotice() : adjustPanelForScriptNotice(form);
// adjust text options according to the notification type
@@ -321,7 +321,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
}
else
{
- mTextBox = getChild<LLTextEditor>("text_editor_box");
+ mTextBox = getChild<LLTextEditor>("text_editor_box");
}
mTextBox->setMaxTextLength(LLToastPanel::MAX_TEXT_LENGTH);
@@ -329,7 +329,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
mTextBox->setPlainText(!show_images);
mTextBox->setContentTrusted(is_content_trusted);
mTextBox->setValue(mNotification->getMessage());
- mTextBox->setIsFriendCallback(LLAvatarActions::isFriend);
+ mTextBox->setIsFriendCallback(LLAvatarActions::isFriend);
mTextBox->setIsObjectBlockedCallback(boost::bind(&LLMuteList::isMuted, LLMuteList::getInstance(), _1, _2, 0));
// add buttons for a script notification
@@ -376,10 +376,10 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
/*
* Probably it is a scriptdialog toast
* for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons.
- * In last case set default h_pad to avoid heaping of buttons
+ * In last case set default h_pad to avoid heaping of buttons
*/
S32 button_per_row = button_panel_width / BUTTON_WIDTH;
- h_pad = (button_panel_width % BUTTON_WIDTH) / (button_per_row - 1);// -1 because we do not need space after last button in a row
+ h_pad = (button_panel_width % BUTTON_WIDTH) / (button_per_row - 1);// -1 because we do not need space after last button in a row
if(h_pad < 2*HPAD) // still not enough space between buttons ?
{
h_pad = 2*HPAD;
@@ -394,15 +394,15 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
//reserve one row for the ignore_btn
button_rows++;
//calculate required panel height for scripdialog notification.
- button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD;
+ button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD;
}
else
{
// in common case buttons can have different widths so we need to calculate button_rows according to buttons_width
//S32 button_rows = llceil(F32(buttons.size()) * (buttons_width + h_pad) / button_panel_width);
S32 button_rows = llceil(F32((buttons.size() - 1) * h_pad + buttons_width) / button_panel_width);
- //calculate required panel height
- button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + BOTTOM_PAD;
+ //calculate required panel height
+ button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + BOTTOM_PAD;
}
// we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed
@@ -413,9 +413,9 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
}
}
- //.xml file intially makes info panel only follow left/right/top. This is so that when control buttons are added the info panel
- //can shift upward making room for the buttons inside mControlPanel. After the buttons are added, the info panel can then be set to follow 'all'.
- mInfoPanel->setFollowsAll();
+ //.xml file intially makes info panel only follow left/right/top. This is so that when control buttons are added the info panel
+ //can shift upward making room for the buttons inside mControlPanel. After the buttons are added, the info panel can then be set to follow 'all'.
+ mInfoPanel->setFollowsAll();
// Add checkbox (one of couple types) if nessesary.
setCheckBoxes(HPAD * 2, 0, mInfoPanel);
@@ -431,43 +431,43 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
reshape(getRect().getWidth(), new_panel_height);
}
- // reshape the panel to its previous size
- if (current_rect.notEmpty())
- {
- reshape(current_rect.getWidth(), current_rect.getHeight());
- }
+ // reshape the panel to its previous size
+ if (current_rect.notEmpty())
+ {
+ reshape(current_rect.getWidth(), current_rect.getHeight());
+ }
}
bool LLToastNotifyPanel::isControlPanelEnabled() const
{
- bool cp_enabled = mControlPanel->getEnabled();
- bool some_buttons_enabled = false;
- if (cp_enabled)
- {
- LLView::child_list_const_iter_t child_it = mControlPanel->beginChild();
- LLView::child_list_const_iter_t child_it_end = mControlPanel->endChild();
- for(; child_it != child_it_end; ++child_it)
- {
- LLButton * buttonp = dynamic_cast<LLButton *>(*child_it);
- if (buttonp && buttonp->getEnabled())
- {
- some_buttons_enabled = true;
- break;
- }
- }
- }
-
- return cp_enabled && some_buttons_enabled;
+ bool cp_enabled = mControlPanel->getEnabled();
+ bool some_buttons_enabled = false;
+ if (cp_enabled)
+ {
+ LLView::child_list_const_iter_t child_it = mControlPanel->beginChild();
+ LLView::child_list_const_iter_t child_it_end = mControlPanel->endChild();
+ for(; child_it != child_it_end; ++child_it)
+ {
+ LLButton * buttonp = dynamic_cast<LLButton *>(*child_it);
+ if (buttonp && buttonp->getEnabled())
+ {
+ some_buttons_enabled = true;
+ break;
+ }
+ }
+ }
+
+ return cp_enabled && some_buttons_enabled;
}
//////////////////////////////////////////////////////////////////////////
LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLUUID& session_id, const LLRect& rect /* = LLRect::null */,
- bool show_images /* = true */, LLTextBase* parent_text)
-: mSessionID(session_id), LLToastNotifyPanel(pNotification, rect, show_images),
- mParentText(parent_text)
+ bool show_images /* = true */, LLTextBase* parent_text)
+: mSessionID(session_id), LLToastNotifyPanel(pNotification, rect, show_images),
+ mParentText(parent_text)
{
- compactButtons();
+ compactButtons();
}
LLIMToastNotifyPanel::~LLIMToastNotifyPanel()
@@ -476,75 +476,75 @@ LLIMToastNotifyPanel::~LLIMToastNotifyPanel()
void LLIMToastNotifyPanel::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
{
- LLToastPanel::reshape(width, height, called_from_parent);
- snapToMessageHeight();
+ LLToastPanel::reshape(width, height, called_from_parent);
+ snapToMessageHeight();
}
void LLIMToastNotifyPanel::snapToMessageHeight()
{
- if(!mTextBox)
- {
- return;
- }
-
- //Add message height if it is visible
- if (mTextBox->getVisible())
- {
- S32 new_panel_height = computeSnappedToMessageHeight(mTextBox, LLToastPanel::MAX_TEXT_LENGTH);
-
- //reshape the panel with new height
- if (new_panel_height != getRect().getHeight())
- {
- LLToastNotifyPanel::reshape( getRect().getWidth(), new_panel_height);
- }
- }
+ if(!mTextBox)
+ {
+ return;
+ }
+
+ //Add message height if it is visible
+ if (mTextBox->getVisible())
+ {
+ S32 new_panel_height = computeSnappedToMessageHeight(mTextBox, LLToastPanel::MAX_TEXT_LENGTH);
+
+ //reshape the panel with new height
+ if (new_panel_height != getRect().getHeight())
+ {
+ LLToastNotifyPanel::reshape( getRect().getWidth(), new_panel_height);
+ }
+ }
}
void LLIMToastNotifyPanel::compactButtons()
{
- //we can't set follows in xml since it broke toasts behavior
- setFollows(FOLLOWS_LEFT|FOLLOWS_RIGHT|FOLLOWS_TOP);
-
- const child_list_t* children = getControlPanel()->getChildList();
- S32 offset = 0;
- // Children were added by addChild() which uses push_front to insert them into list,
- // so to get buttons in correct order reverse iterator is used (EXT-5906)
- for (child_list_t::const_reverse_iterator it = children->rbegin(); it != children->rend(); it++)
- {
- LLButton * button = dynamic_cast<LLButton*> (*it);
- if (button != NULL)
- {
- button->setOrigin( offset,button->getRect().mBottom);
- button->setLeftHPad(2 * HPAD);
- button->setRightHPad(2 * HPAD);
- // set zero width before perform autoResize()
- button->setRect(LLRect(button->getRect().mLeft,
- button->getRect().mTop,
- button->getRect().mLeft,
- button->getRect().mBottom));
- button->setAutoResize(true);
- button->autoResize();
- offset += HPAD + button->getRect().getWidth();
- button->setFollowsNone();
- }
- }
-
- if (mParentText)
- {
- mParentText->needsReflow();
- }
+ //we can't set follows in xml since it broke toasts behavior
+ setFollows(FOLLOWS_LEFT|FOLLOWS_RIGHT|FOLLOWS_TOP);
+
+ const child_list_t* children = getControlPanel()->getChildList();
+ S32 offset = 0;
+ // Children were added by addChild() which uses push_front to insert them into list,
+ // so to get buttons in correct order reverse iterator is used (EXT-5906)
+ for (child_list_t::const_reverse_iterator it = children->rbegin(); it != children->rend(); it++)
+ {
+ LLButton * button = dynamic_cast<LLButton*> (*it);
+ if (button != NULL)
+ {
+ button->setOrigin( offset,button->getRect().mBottom);
+ button->setLeftHPad(2 * HPAD);
+ button->setRightHPad(2 * HPAD);
+ // set zero width before perform autoResize()
+ button->setRect(LLRect(button->getRect().mLeft,
+ button->getRect().mTop,
+ button->getRect().mLeft,
+ button->getRect().mBottom));
+ button->setAutoResize(true);
+ button->autoResize();
+ offset += HPAD + button->getRect().getWidth();
+ button->setFollowsNone();
+ }
+ }
+
+ if (mParentText)
+ {
+ mParentText->needsReflow();
+ }
}
void LLIMToastNotifyPanel::updateNotification()
- {
- init(LLRect(), true);
- }
+ {
+ init(LLRect(), true);
+ }
void LLIMToastNotifyPanel::init( LLRect rect, bool show_images )
{
- LLToastNotifyPanel::init(LLRect(), show_images);
+ LLToastNotifyPanel::init(LLRect(), show_images);
- compactButtons();
+ compactButtons();
}
// EOF
diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h
index a5a637c6fa..952841a012 100644
--- a/indra/newview/lltoastnotifypanel.h
+++ b/indra/newview/lltoastnotifypanel.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,118 +50,118 @@ class LLNotificationForm;
class LLToastNotifyPanel: public LLCheckBoxToastPanel, public LLInstanceTracker<LLToastNotifyPanel, LLUUID, LLInstanceTrackerReplaceOnCollision>
{
public:
- /**
- * Constructor for LLToastNotifyPanel.
- *
- * @param pNotification a shared pointer to LLNotification
- * @param rect an initial rectangle of the toast panel.
- * If it is null then a loaded from xml rectangle will be used.
- * @see LLNotification
- * @deprecated if you intend to instantiate LLToastNotifyPanel - it's point to
- * implement right class for desired toast panel. @see LLGenericTipPanel as example.
- */
- LLToastNotifyPanel(const LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null, bool show_images = true);
+ /**
+ * Constructor for LLToastNotifyPanel.
+ *
+ * @param pNotification a shared pointer to LLNotification
+ * @param rect an initial rectangle of the toast panel.
+ * If it is null then a loaded from xml rectangle will be used.
+ * @see LLNotification
+ * @deprecated if you intend to instantiate LLToastNotifyPanel - it's point to
+ * implement right class for desired toast panel. @see LLGenericTipPanel as example.
+ */
+ LLToastNotifyPanel(const LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null, bool show_images = true);
- virtual void init( LLRect rect, bool show_images );
+ virtual void init( LLRect rect, bool show_images );
- virtual ~LLToastNotifyPanel();
- LLPanel * getControlPanel() { return mControlPanel; }
+ virtual ~LLToastNotifyPanel();
+ LLPanel * getControlPanel() { return mControlPanel; }
- virtual void updateNotification() {}
+ virtual void updateNotification() {}
- bool isControlPanelEnabled() const;
+ bool isControlPanelEnabled() const;
protected:
- LLButton* createButton(const LLSD& form_element, BOOL is_option);
-
- // Used for callbacks
- struct InstanceAndS32
- {
- LLToastNotifyPanel* mSelf;
- std::string mButtonName;
- };
- std::vector<InstanceAndS32*> mBtnCallbackData;
-
- typedef std::pair<int,LLButton*> index_button_pair_t;
- void adjustPanelForScriptNotice(S32 max_width, S32 max_height);
- void adjustPanelForTipNotice();
- void addDefaultButton();
- /*
- * It lays out buttons of the notification in mControlPanel.
- * Buttons will be placed from BOTTOM to TOP.
- * @param h_pad horizontal space between buttons. It is depend on number of buttons.
- * @param buttons vector of button to be added.
- */
- void updateButtonsLayout(const std::vector<index_button_pair_t>& buttons, S32 h_pad);
-
- /**
- * Disable specific button(s) based on notification name and clicked button
- */
- //void disableButtons(const std::string& notification_name, const std::string& selected_button);
-
- //std::vector<index_button_pair_t> mButtons;
-
- // panel elements
- LLTextBase* mTextBox;
- LLPanel* mInfoPanel; // a panel, that contains an information
- LLPanel* mControlPanel; // a panel, that contains buttons (if present)
-
- // internal handler for button being clicked
- static void onClickButton(void* data);
-
- typedef boost::signals2::signal <void (const LLUUID& notification_id, const std::string btn_name)>
- button_click_signal_t;
- static button_click_signal_t sButtonClickSignal;
- boost::signals2::connection mButtonClickConnection;
-
- /**
- * handle sButtonClickSignal (to disable buttons) across all panels with given notification_id
- */
- void onToastPanelButtonClicked(const LLUUID& notification_id, const std::string btn_name);
-
- /**
- * Process response data. Will disable selected options
- */
- //void disableRespondedOptions(const LLNotificationPtr& notification);
-
- bool mIsTip;
- bool mAddedDefaultBtn;
- bool mIsScriptDialog;
- bool mIsCaution;
-
- std::string mMessage;
- S32 mNumOptions;
- S32 mNumButtons;
-
- static const LLFontGL* sFont;
- static const LLFontGL* sFontSmall;
+ LLButton* createButton(const LLSD& form_element, BOOL is_option);
+
+ // Used for callbacks
+ struct InstanceAndS32
+ {
+ LLToastNotifyPanel* mSelf;
+ std::string mButtonName;
+ };
+ std::vector<InstanceAndS32*> mBtnCallbackData;
+
+ typedef std::pair<int,LLButton*> index_button_pair_t;
+ void adjustPanelForScriptNotice(S32 max_width, S32 max_height);
+ void adjustPanelForTipNotice();
+ void addDefaultButton();
+ /*
+ * It lays out buttons of the notification in mControlPanel.
+ * Buttons will be placed from BOTTOM to TOP.
+ * @param h_pad horizontal space between buttons. It is depend on number of buttons.
+ * @param buttons vector of button to be added.
+ */
+ void updateButtonsLayout(const std::vector<index_button_pair_t>& buttons, S32 h_pad);
+
+ /**
+ * Disable specific button(s) based on notification name and clicked button
+ */
+ //void disableButtons(const std::string& notification_name, const std::string& selected_button);
+
+ //std::vector<index_button_pair_t> mButtons;
+
+ // panel elements
+ LLTextBase* mTextBox;
+ LLPanel* mInfoPanel; // a panel, that contains an information
+ LLPanel* mControlPanel; // a panel, that contains buttons (if present)
+
+ // internal handler for button being clicked
+ static void onClickButton(void* data);
+
+ typedef boost::signals2::signal <void (const LLUUID& notification_id, const std::string btn_name)>
+ button_click_signal_t;
+ static button_click_signal_t sButtonClickSignal;
+ boost::signals2::connection mButtonClickConnection;
+
+ /**
+ * handle sButtonClickSignal (to disable buttons) across all panels with given notification_id
+ */
+ void onToastPanelButtonClicked(const LLUUID& notification_id, const std::string btn_name);
+
+ /**
+ * Process response data. Will disable selected options
+ */
+ //void disableRespondedOptions(const LLNotificationPtr& notification);
+
+ bool mIsTip;
+ bool mAddedDefaultBtn;
+ bool mIsScriptDialog;
+ bool mIsCaution;
+
+ std::string mMessage;
+ S32 mNumOptions;
+ S32 mNumButtons;
+
+ static const LLFontGL* sFont;
+ static const LLFontGL* sFontSmall;
};
class LLIMToastNotifyPanel : public LLToastNotifyPanel
{
public:
- LLIMToastNotifyPanel(LLNotificationPtr& pNotification,
- const LLUUID& session_id,
- const LLRect& rect = LLRect::null,
- bool show_images = true,
- LLTextBase* parent_text = NULL);
+ LLIMToastNotifyPanel(LLNotificationPtr& pNotification,
+ const LLUUID& session_id,
+ const LLRect& rect = LLRect::null,
+ bool show_images = true,
+ LLTextBase* parent_text = NULL);
- void compactButtons();
+ void compactButtons();
- virtual void updateNotification();
- virtual void init( LLRect rect, bool show_images );
+ virtual void updateNotification();
+ virtual void init( LLRect rect, bool show_images );
- ~LLIMToastNotifyPanel();
+ ~LLIMToastNotifyPanel();
- /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
protected:
- LLTextBase* mParentText;
- LLUUID mSessionID;
+ LLTextBase* mParentText;
+ LLUUID mSessionID;
private:
- void snapToMessageHeight();
+ void snapToMessageHeight();
};
#endif /* LLTOASTNOTIFYPANEL_H_ */
diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp
index d43da93c61..2834143dd6 100644
--- a/indra/newview/lltoastpanel.cpp
+++ b/indra/newview/lltoastpanel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoastpanel.cpp
* @brief Creates a panel of a specific kind for a toast
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,110 +44,110 @@ const S32 LLToastPanel::MAX_TEXT_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB
LLToastPanel::LLToastPanel(const LLNotificationPtr& notification)
{
- mNotification = notification;
+ mNotification = notification;
}
-LLToastPanel::~LLToastPanel()
+LLToastPanel::~LLToastPanel()
{
}
//virtual
std::string LLToastPanel::getTitle()
{
- // *TODO: create Title and localize it. If it will be required.
- return mNotification->getMessage();
+ // *TODO: create Title and localize it. If it will be required.
+ return mNotification->getMessage();
}
//virtual
const std::string& LLToastPanel::getNotificationName()
{
- return mNotification->getName();
+ return mNotification->getName();
}
//virtual
const LLUUID& LLToastPanel::getID()
{
- return mNotification->id();
+ return mNotification->id();
}
S32 LLToastPanel::computeSnappedToMessageHeight(LLTextBase* message, S32 maxLineCount)
{
- S32 heightDelta = 0;
- S32 maxTextHeight = message->getFont()->getLineHeight() * maxLineCount;
+ S32 heightDelta = 0;
+ S32 maxTextHeight = message->getFont()->getLineHeight() * maxLineCount;
- LLRect messageRect = message->getRect();
- S32 oldTextHeight = messageRect.getHeight();
+ LLRect messageRect = message->getRect();
+ S32 oldTextHeight = messageRect.getHeight();
- //Knowing the height is set to max allowed, getTextPixelHeight returns needed text height
- //Perhaps we need to pass maxLineCount as parameter to getTextPixelHeight to avoid previous reshape.
- S32 requiredTextHeight = message->getTextBoundingRect().getHeight();
- S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
+ //Knowing the height is set to max allowed, getTextPixelHeight returns needed text height
+ //Perhaps we need to pass maxLineCount as parameter to getTextPixelHeight to avoid previous reshape.
+ S32 requiredTextHeight = message->getTextBoundingRect().getHeight();
+ S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
- heightDelta = newTextHeight - oldTextHeight;
- S32 new_panel_height = llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT);
+ heightDelta = newTextHeight - oldTextHeight;
+ S32 new_panel_height = llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT);
- return new_panel_height;
+ return new_panel_height;
}
//snap to the message height if it is visible
void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
{
- if(!message)
- {
- return;
- }
-
- //Add message height if it is visible
- if (message->getVisible())
- {
- S32 new_panel_height = computeSnappedToMessageHeight(message, maxLineCount);
-
- //reshape the panel with new height
- if (new_panel_height != getRect().getHeight())
- {
- reshape( getRect().getWidth(), new_panel_height);
- }
- }
+ if(!message)
+ {
+ return;
+ }
+
+ //Add message height if it is visible
+ if (message->getVisible())
+ {
+ S32 new_panel_height = computeSnappedToMessageHeight(message, maxLineCount);
+
+ //reshape the panel with new height
+ if (new_panel_height != getRect().getHeight())
+ {
+ reshape( getRect().getWidth(), new_panel_height);
+ }
+ }
}
// static
LLToastPanel* LLToastPanel::buidPanelFromNotification(
- const LLNotificationPtr& notification)
+ const LLNotificationPtr& notification)
{
LL_PROFILE_ZONE_SCOPED
LLToastPanel* res = NULL;
- //process tip toast panels
- if ("notifytip" == notification->getType())
- {
- // if it is online/offline notification
- if ("FriendOnlineOffline" == notification->getName())
- {
- res = new LLPanelOnlineStatus(notification);
- }
- // in all other case we use generic tip panel
- else
- {
- res = new LLPanelGenericTip(notification);
- }
- }
- else if("notify" == notification->getType())
- {
- if (notification->getPriority() == NOTIFICATION_PRIORITY_CRITICAL)
- {
- res = new LLToastScriptQuestion(notification);
- }
- else
- {
- res = new LLToastNotifyPanel(notification);
- }
- }
- /*
- else if(...)
- create all other specific non-public toast panel
- */
-
- return res;
+ //process tip toast panels
+ if ("notifytip" == notification->getType())
+ {
+ // if it is online/offline notification
+ if ("FriendOnlineOffline" == notification->getName())
+ {
+ res = new LLPanelOnlineStatus(notification);
+ }
+ // in all other case we use generic tip panel
+ else
+ {
+ res = new LLPanelGenericTip(notification);
+ }
+ }
+ else if("notify" == notification->getType())
+ {
+ if (notification->getPriority() == NOTIFICATION_PRIORITY_CRITICAL)
+ {
+ res = new LLToastScriptQuestion(notification);
+ }
+ else
+ {
+ res = new LLToastNotifyPanel(notification);
+ }
+ }
+ /*
+ else if(...)
+ create all other specific non-public toast panel
+ */
+
+ return res;
}
LLCheckBoxToastPanel::LLCheckBoxToastPanel(const LLNotificationPtr& p_ntf)
@@ -164,7 +164,7 @@ void LLCheckBoxToastPanel::setCheckBoxes(const S32 &h_pad, const S32 &v_pad, LLV
if (form->getIgnoreType() == LLNotificationForm::IGNORE_CHECKBOX_ONLY)
{
- // Normally text is only used to describe notification in preferences,
+ // Normally text is only used to describe notification in preferences,
// but this one is not displayed in preferences and works on case by case
// basis.
// Display text if present, display 'always chose' if not.
diff --git a/indra/newview/lltoastpanel.h b/indra/newview/lltoastpanel.h
index f4c758ade9..eae3718398 100644
--- a/indra/newview/lltoastpanel.h
+++ b/indra/newview/lltoastpanel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoastpanel.h
* @brief Creates a panel of a specific kind for a toast.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,27 +41,27 @@
*/
class LLToastPanel : public LLPanel {
public:
- LLToastPanel(const LLNotificationPtr&);
- virtual ~LLToastPanel() = 0;
+ LLToastPanel(const LLNotificationPtr&);
+ virtual ~LLToastPanel() = 0;
- virtual std::string getTitle();
- virtual const std::string& getNotificationName();
- virtual const LLUUID& getID();
+ virtual std::string getTitle();
+ virtual const std::string& getNotificationName();
+ virtual const LLUUID& getID();
- static const S32 MIN_PANEL_HEIGHT;
- static const S32 MAX_TEXT_LENGTH;
+ static const S32 MIN_PANEL_HEIGHT;
+ static const S32 MAX_TEXT_LENGTH;
- /**
- * Builder method for constructing notification specific panels.
- * Normally type of created panels shouldn't be publicated and should be hidden
- * from other functionality.
- */
- static LLToastPanel* buidPanelFromNotification(
- const LLNotificationPtr& notification);
+ /**
+ * Builder method for constructing notification specific panels.
+ * Normally type of created panels shouldn't be publicated and should be hidden
+ * from other functionality.
+ */
+ static LLToastPanel* buidPanelFromNotification(
+ const LLNotificationPtr& notification);
protected:
- LLNotificationPtr mNotification;
- void snapToMessageHeight(LLTextBase* message, S32 maxLineCount);
- S32 computeSnappedToMessageHeight(LLTextBase* message, S32 maxLineCount);
+ LLNotificationPtr mNotification;
+ void snapToMessageHeight(LLTextBase* message, S32 maxLineCount);
+ S32 computeSnappedToMessageHeight(LLTextBase* message, S32 maxLineCount);
};
class LLCheckBoxCtrl;
@@ -70,17 +70,17 @@ class LLCheckBoxCtrl;
class LLCheckBoxToastPanel : public LLToastPanel
{
public:
- LLCheckBoxToastPanel(const LLNotificationPtr& p_ntf);
- virtual ~LLCheckBoxToastPanel() {};
+ LLCheckBoxToastPanel(const LLNotificationPtr& p_ntf);
+ virtual ~LLCheckBoxToastPanel() {};
- // set checkboxes acording to defaults from form
- void setCheckBoxes(const S32 &h_pad, const S32 &v_pad, LLView *parent_view = NULL);
- // set single checkbox
- bool setCheckBox(const std::string&, const std::string&, const commit_signal_t::slot_type& cb, const S32 &h_pad, const S32 &v_pad, LLView *parent_view = NULL);
+ // set checkboxes acording to defaults from form
+ void setCheckBoxes(const S32 &h_pad, const S32 &v_pad, LLView *parent_view = NULL);
+ // set single checkbox
+ bool setCheckBox(const std::string&, const std::string&, const commit_signal_t::slot_type& cb, const S32 &h_pad, const S32 &v_pad, LLView *parent_view = NULL);
protected:
- void onCommitCheckbox(LLUICtrl* ctrl);
+ void onCommitCheckbox(LLUICtrl* ctrl);
- LLCheckBoxCtrl* mCheck;
+ LLCheckBoxCtrl* mCheck;
};
#endif /* LL_TOASTPANEL_H */
diff --git a/indra/newview/lltoastscriptquestion.cpp b/indra/newview/lltoastscriptquestion.cpp
index 7a3a1d8fd7..fd1e30345c 100644
--- a/indra/newview/lltoastscriptquestion.cpp
+++ b/indra/newview/lltoastscriptquestion.cpp
@@ -37,22 +37,22 @@ LLToastScriptQuestion::LLToastScriptQuestion(const LLNotificationPtr& notificati
:
LLToastPanel(notification)
{
- buildFromFile("panel_script_question_toast.xml");
+ buildFromFile("panel_script_question_toast.xml");
}
BOOL LLToastScriptQuestion::postBuild()
{
- createButtons();
+ createButtons();
- LLTextBox* mMessage = getChild<LLTextBox>("top_info_message");
- LLTextBox* mFooter = getChild<LLTextBox>("bottom_info_message");
+ LLTextBox* mMessage = getChild<LLTextBox>("top_info_message");
+ LLTextBox* mFooter = getChild<LLTextBox>("bottom_info_message");
- mMessage->setValue(mNotification->getMessage());
- mFooter->setValue(mNotification->getFooter());
+ mMessage->setValue(mNotification->getMessage());
+ mFooter->setValue(mNotification->getFooter());
- snapToMessageHeight();
+ snapToMessageHeight();
- return TRUE;
+ return TRUE;
}
// virtual
@@ -69,81 +69,81 @@ void LLToastScriptQuestion::setFocus(BOOL b)
void LLToastScriptQuestion::snapToMessageHeight()
{
- LLTextBox* mMessage = getChild<LLTextBox>("top_info_message");
- LLTextBox* mFooter = getChild<LLTextBox>("bottom_info_message");
- if (!mMessage || !mFooter)
- {
- return;
- }
+ LLTextBox* mMessage = getChild<LLTextBox>("top_info_message");
+ LLTextBox* mFooter = getChild<LLTextBox>("bottom_info_message");
+ if (!mMessage || !mFooter)
+ {
+ return;
+ }
- if (mMessage->getVisible() && mFooter->getVisible())
- {
- S32 heightDelta = 0;
- S32 maxTextHeight = (mMessage->getFont()->getLineHeight() * MAX_LINES_COUNT)
- + (mFooter->getFont()->getLineHeight() * MAX_LINES_COUNT);
+ if (mMessage->getVisible() && mFooter->getVisible())
+ {
+ S32 heightDelta = 0;
+ S32 maxTextHeight = (mMessage->getFont()->getLineHeight() * MAX_LINES_COUNT)
+ + (mFooter->getFont()->getLineHeight() * MAX_LINES_COUNT);
- LLRect messageRect = mMessage->getRect();
- LLRect footerRect = mFooter->getRect();
+ LLRect messageRect = mMessage->getRect();
+ LLRect footerRect = mFooter->getRect();
- S32 oldTextHeight = messageRect.getHeight() + footerRect.getHeight();
+ S32 oldTextHeight = messageRect.getHeight() + footerRect.getHeight();
- S32 requiredTextHeight = mMessage->getTextBoundingRect().getHeight() + mFooter->getTextBoundingRect().getHeight();
- S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
+ S32 requiredTextHeight = mMessage->getTextBoundingRect().getHeight() + mFooter->getTextBoundingRect().getHeight();
+ S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
- heightDelta = newTextHeight - oldTextHeight - heightDelta;
+ heightDelta = newTextHeight - oldTextHeight - heightDelta;
- reshape( getRect().getWidth(), llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT));
- }
+ reshape( getRect().getWidth(), llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT));
+ }
}
void LLToastScriptQuestion::createButtons()
{
- LLNotificationFormPtr form = mNotification->getForm();
- int num_elements = form->getNumElements();
- int buttons_width = 0;
-
- for (int i = 0; i < num_elements; ++i)
- {
- LLSD form_element = form->getElement(i);
- if ("button" == form_element["type"].asString())
- {
- LLButton::Params p;
- const LLFontGL* font = LLFontGL::getFontSansSerif();
- p.name(form_element["name"].asString());
- p.label(form_element["text"].asString());
- p.layout("topleft");
- p.font(font);
- p.rect.height(BUTTON_HEIGHT);
- p.click_callback.function(boost::bind(&LLToastScriptQuestion::onButtonClicked, this, form_element["name"].asString()));
- p.rect.left = LEFT_PAD;
- p.rect.width = font->getWidth(form_element["text"].asString());
- p.auto_resize = true;
- p.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
- p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
- p.image_color_disabled(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
-
- LLButton* button = LLUICtrlFactory::create<LLButton>(p);
- button->autoResize();
- getChild<LLPanel>("buttons_panel")->addChild(button);
-
- LLRect rect = button->getRect();
- rect.setLeftTopAndSize(buttons_width, rect.mTop, rect.getWidth(), rect.getHeight());
- button->setRect(rect);
-
- buttons_width += rect.getWidth() + LEFT_PAD;
-
- if (form_element.has("default") && form_element["default"].asBoolean())
- {
- button->setFocus(TRUE);
- setDefaultBtn(button);
- }
- }
- }
+ LLNotificationFormPtr form = mNotification->getForm();
+ int num_elements = form->getNumElements();
+ int buttons_width = 0;
+
+ for (int i = 0; i < num_elements; ++i)
+ {
+ LLSD form_element = form->getElement(i);
+ if ("button" == form_element["type"].asString())
+ {
+ LLButton::Params p;
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
+ p.name(form_element["name"].asString());
+ p.label(form_element["text"].asString());
+ p.layout("topleft");
+ p.font(font);
+ p.rect.height(BUTTON_HEIGHT);
+ p.click_callback.function(boost::bind(&LLToastScriptQuestion::onButtonClicked, this, form_element["name"].asString()));
+ p.rect.left = LEFT_PAD;
+ p.rect.width = font->getWidth(form_element["text"].asString());
+ p.auto_resize = true;
+ p.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
+ p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
+ p.image_color_disabled(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
+
+ LLButton* button = LLUICtrlFactory::create<LLButton>(p);
+ button->autoResize();
+ getChild<LLPanel>("buttons_panel")->addChild(button);
+
+ LLRect rect = button->getRect();
+ rect.setLeftTopAndSize(buttons_width, rect.mTop, rect.getWidth(), rect.getHeight());
+ button->setRect(rect);
+
+ buttons_width += rect.getWidth() + LEFT_PAD;
+
+ if (form_element.has("default") && form_element["default"].asBoolean())
+ {
+ button->setFocus(TRUE);
+ setDefaultBtn(button);
+ }
+ }
+ }
}
void LLToastScriptQuestion::onButtonClicked(std::string btn_name)
{
- LLSD response = mNotification->getResponseTemplate();
- response[btn_name] = true;
- mNotification->respond(response);
+ LLSD response = mNotification->getResponseTemplate();
+ response[btn_name] = true;
+ mNotification->respond(response);
}
diff --git a/indra/newview/lltoastscriptquestion.h b/indra/newview/lltoastscriptquestion.h
index a756f88415..fc129236db 100644
--- a/indra/newview/lltoastscriptquestion.h
+++ b/indra/newview/lltoastscriptquestion.h
@@ -32,20 +32,20 @@
class LLToastScriptQuestion : public LLToastPanel
{
- LOG_CLASS(LLToastScriptQuestion);
+ LOG_CLASS(LLToastScriptQuestion);
public:
- LLToastScriptQuestion(const LLNotificationPtr& notification);
- virtual BOOL postBuild();
- virtual ~LLToastScriptQuestion(){};
+ LLToastScriptQuestion(const LLNotificationPtr& notification);
+ virtual BOOL postBuild();
+ virtual ~LLToastScriptQuestion(){};
- /*virtual*/ void setFocus(BOOL b);
+ /*virtual*/ void setFocus(BOOL b);
private:
- void snapToMessageHeight();
+ void snapToMessageHeight();
- void createButtons();
- void onButtonClicked(std::string btn_name);
+ void createButtons();
+ void onButtonClicked(std::string btn_name);
};
#endif /* LLTOASTSCRIPTQUESTION_H_ */
diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp
index eb86a44055..72057fe42b 100644
--- a/indra/newview/lltoastscripttextbox.cpp
+++ b/indra/newview/lltoastscripttextbox.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,34 +38,34 @@
const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT= 14;
LLToastScriptTextbox::LLToastScriptTextbox(const LLNotificationPtr& notification)
-: LLToastPanel(notification)
+: LLToastPanel(notification)
{
- buildFromFile( "panel_notify_textbox.xml");
+ buildFromFile( "panel_notify_textbox.xml");
- mInfoText = getChild<LLTextEditor>("text_editor_box");
- mInfoText->setMaxTextLength(LLToastPanel::MAX_TEXT_LENGTH);
- mInfoText->setValue(notification->getMessage());
+ mInfoText = getChild<LLTextEditor>("text_editor_box");
+ mInfoText->setMaxTextLength(LLToastPanel::MAX_TEXT_LENGTH);
+ mInfoText->setValue(notification->getMessage());
- getChild<LLButton>("ignore_btn")->setClickedCallback(boost::bind(&LLToastScriptTextbox::onClickIgnore, this));
+ getChild<LLButton>("ignore_btn")->setClickedCallback(boost::bind(&LLToastScriptTextbox::onClickIgnore, this));
- const LLSD& payload = notification->getPayload();
+ const LLSD& payload = notification->getPayload();
- //message body
- const std::string& message = payload["message"].asString();
+ //message body
+ const std::string& message = payload["message"].asString();
- LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message");
- pMessageText->clear();
+ LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message");
+ pMessageText->clear();
- LLStyle::Params style;
- style.font = pMessageText->getFont();
- pMessageText->appendText(message, TRUE, style);
+ LLStyle::Params style;
+ style.font = pMessageText->getFont();
+ pMessageText->appendText(message, TRUE, style);
- //submit button
- LLButton* pSubmitBtn = getChild<LLButton>("btn_submit");
- pSubmitBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickSubmit, this)));
- setDefaultBtn(pSubmitBtn);
+ //submit button
+ LLButton* pSubmitBtn = getChild<LLButton>("btn_submit");
+ pSubmitBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickSubmit, this)));
+ setDefaultBtn(pSubmitBtn);
- snapToMessageHeight();
+ snapToMessageHeight();
}
// virtual
@@ -75,58 +75,58 @@ LLToastScriptTextbox::~LLToastScriptTextbox()
void LLToastScriptTextbox::close()
{
- die();
+ die();
}
void LLToastScriptTextbox::onClickSubmit()
{
- LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message");
-
- if (pMessageText)
- {
- LLSD response = mNotification->getResponseTemplate();
- response[TEXTBOX_MAGIC_TOKEN] = pMessageText->getText();
- if (response[TEXTBOX_MAGIC_TOKEN].asString().empty())
- {
- // so we can distinguish between a successfully
- // submitted blank textbox, and an ignored toast
- response[TEXTBOX_MAGIC_TOKEN] = true;
- }
- mNotification->respond(response);
- close();
- LL_WARNS() << response << LL_ENDL;
- }
+ LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message");
+
+ if (pMessageText)
+ {
+ LLSD response = mNotification->getResponseTemplate();
+ response[TEXTBOX_MAGIC_TOKEN] = pMessageText->getText();
+ if (response[TEXTBOX_MAGIC_TOKEN].asString().empty())
+ {
+ // so we can distinguish between a successfully
+ // submitted blank textbox, and an ignored toast
+ response[TEXTBOX_MAGIC_TOKEN] = true;
+ }
+ mNotification->respond(response);
+ close();
+ LL_WARNS() << response << LL_ENDL;
+ }
}
void LLToastScriptTextbox::onClickIgnore()
{
- LLSD response = mNotification->getResponseTemplate();
- mNotification->respond(response);
- close();
+ LLSD response = mNotification->getResponseTemplate();
+ mNotification->respond(response);
+ close();
}
void LLToastScriptTextbox::snapToMessageHeight()
{
- LLPanel* info_pan = getChild<LLPanel>("info_panel");
- if (!info_pan)
- {
- return;
- }
+ LLPanel* info_pan = getChild<LLPanel>("info_panel");
+ if (!info_pan)
+ {
+ return;
+ }
- S32 maxLinesCount;
- std::istringstream ss( getString("message_max_lines_count") );
- if (!(ss >> maxLinesCount))
- {
- maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT;
- }
+ S32 maxLinesCount;
+ std::istringstream ss( getString("message_max_lines_count") );
+ if (!(ss >> maxLinesCount))
+ {
+ maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT;
+ }
- S32 maxTextHeight = (mInfoText->getFont()->getLineHeight() * maxLinesCount);
- S32 oldTextHeight = mInfoText->getRect().getHeight();
- S32 newTextHeight = llmin(mInfoText->getTextBoundingRect().getHeight(), maxTextHeight);
+ S32 maxTextHeight = (mInfoText->getFont()->getLineHeight() * maxLinesCount);
+ S32 oldTextHeight = mInfoText->getRect().getHeight();
+ S32 newTextHeight = llmin(mInfoText->getTextBoundingRect().getHeight(), maxTextHeight);
- S32 heightDelta = newTextHeight - oldTextHeight;
+ S32 heightDelta = newTextHeight - oldTextHeight;
- reshape( getRect().getWidth(), llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT));
- info_pan->reshape(info_pan->getRect().getWidth(),newTextHeight);
+ reshape( getRect().getWidth(), llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT));
+ info_pan->reshape(info_pan->getRect().getWidth(),newTextHeight);
}
diff --git a/indra/newview/lltoastscripttextbox.h b/indra/newview/lltoastscripttextbox.h
index a539124ef1..df8d9a4d77 100644
--- a/indra/newview/lltoastscripttextbox.h
+++ b/indra/newview/lltoastscripttextbox.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,27 +34,27 @@
* Toast panel for scripted llTextbox notifications.
*/
class LLToastScriptTextbox
-: public LLToastPanel
+: public LLToastPanel
{
public:
- void close();
+ void close();
- // Non-transient messages. You can specify non-default button
- // layouts (like one for script dialogs) by passing various
- // numbers in for "layout".
- LLToastScriptTextbox(const LLNotificationPtr& notification);
+ // Non-transient messages. You can specify non-default button
+ // layouts (like one for script dialogs) by passing various
+ // numbers in for "layout".
+ LLToastScriptTextbox(const LLNotificationPtr& notification);
- /*virtual*/ ~LLToastScriptTextbox();
+ /*virtual*/ ~LLToastScriptTextbox();
private:
- LLTextEditor* mInfoText;
+ LLTextEditor* mInfoText;
- void onClickSubmit();
- void onClickIgnore();
+ void onClickSubmit();
+ void onClickIgnore();
- void snapToMessageHeight();
- static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT;
+ void snapToMessageHeight();
+ static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT;
};
#endif
diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp
index 5235914c34..1746e805ad 100644
--- a/indra/newview/lltool.cpp
+++ b/indra/newview/lltool.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltool.cpp
* @brief LLTool class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,73 +46,73 @@ extern BOOL gDebugClicks;
const std::string LLTool::sNameNull("null");
LLTool::LLTool( const std::string& name, LLToolComposite* composite ) :
- mComposite( composite ),
- mName(name)
+ mComposite( composite ),
+ mName(name)
{
}
LLTool::~LLTool()
{
- if( hasMouseCapture() )
- {
- LL_WARNS() << "Tool deleted holding mouse capture. Mouse capture removed." << LL_ENDL;
- gFocusMgr.removeMouseCaptureWithoutCallback( this );
- }
+ if( hasMouseCapture() )
+ {
+ LL_WARNS() << "Tool deleted holding mouse capture. Mouse capture removed." << LL_ENDL;
+ gFocusMgr.removeMouseCaptureWithoutCallback( this );
+ }
}
BOOL LLTool::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down)
{
- BOOL result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down);
-
- // This behavior was moved here from LLViewerWindow::handleAnyMouseClick, so it can be selectively overridden by LLTool subclasses.
- if(down && result)
- {
- // This is necessary to force clicks in the world to cause edit
- // boxes that might have keyboard focus to relinquish it, and hence
- // cause a commit to update their value. JC
- gFocusMgr.setKeyboardFocus(NULL);
- }
-
- return result;
+ BOOL result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down);
+
+ // This behavior was moved here from LLViewerWindow::handleAnyMouseClick, so it can be selectively overridden by LLTool subclasses.
+ if(down && result)
+ {
+ // This is necessary to force clicks in the world to cause edit
+ // boxes that might have keyboard focus to relinquish it, and hence
+ // cause a commit to update their value. JC
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+
+ return result;
}
BOOL LLTool::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if (gDebugClicks)
- {
- LL_INFOS() << "LLTool left mouse down" << LL_ENDL;
- }
- // by default, didn't handle it
- // AGENT_CONTROL_LBUTTON_DOWN is handled by scanMouse() and scanKey()
- // LL_INFOS() << "LLTool::handleMouseDown" << LL_ENDL;
- return FALSE;
+ if (gDebugClicks)
+ {
+ LL_INFOS() << "LLTool left mouse down" << LL_ENDL;
+ }
+ // by default, didn't handle it
+ // AGENT_CONTROL_LBUTTON_DOWN is handled by scanMouse() and scanKey()
+ // LL_INFOS() << "LLTool::handleMouseDown" << LL_ENDL;
+ return FALSE;
}
BOOL LLTool::handleMouseUp(S32 x, S32 y, MASK mask)
{
- if (gDebugClicks)
- {
- LL_INFOS() << "LLTool left mouse up" << LL_ENDL;
- }
- // by default, didn't handle it
- // AGENT_CONTROL_LBUTTON_UP is handled by scanMouse() and scanKey()
- // LL_INFOS() << "LLTool::handleMouseUp" << LL_ENDL;
- return TRUE;
+ if (gDebugClicks)
+ {
+ LL_INFOS() << "LLTool left mouse up" << LL_ENDL;
+ }
+ // by default, didn't handle it
+ // AGENT_CONTROL_LBUTTON_UP is handled by scanMouse() and scanKey()
+ // LL_INFOS() << "LLTool::handleMouseUp" << LL_ENDL;
+ return TRUE;
}
BOOL LLTool::handleHover(S32 x, S32 y, MASK mask)
{
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- LL_DEBUGS("UserInput") << "hover handled by a tool" << LL_ENDL;
- // by default, do nothing, say we handled it
- return TRUE;
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ LL_DEBUGS("UserInput") << "hover handled by a tool" << LL_ENDL;
+ // by default, do nothing, say we handled it
+ return TRUE;
}
BOOL LLTool::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
- // by default, didn't handle it
- // LL_INFOS() << "LLTool::handleScrollWheel" << LL_ENDL;
- return FALSE;
+ // by default, didn't handle it
+ // LL_INFOS() << "LLTool::handleScrollWheel" << LL_ENDL;
+ return FALSE;
}
BOOL LLTool::handleScrollHWheel(S32 x, S32 y, S32 clicks)
@@ -123,57 +123,57 @@ BOOL LLTool::handleScrollHWheel(S32 x, S32 y, S32 clicks)
BOOL LLTool::handleDoubleClick(S32 x,S32 y,MASK mask)
{
- // LL_INFOS() << "LLTool::handleDoubleClick" << LL_ENDL;
- // by default, pretend it's a left click
- return FALSE;
+ // LL_INFOS() << "LLTool::handleDoubleClick" << LL_ENDL;
+ // by default, pretend it's a left click
+ return FALSE;
}
BOOL LLTool::handleRightMouseDown(S32 x,S32 y,MASK mask)
{
- // by default, didn't handle it
- // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL;
- return FALSE;
+ // by default, didn't handle it
+ // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL;
+ return FALSE;
}
BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask)
{
- // by default, didn't handle it
- // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL;
- return FALSE;
+ // by default, didn't handle it
+ // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL;
+ return FALSE;
}
-
+
BOOL LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask)
{
- // by default, didn't handle it
- // LL_INFOS() << "LLTool::handleMiddleMouseDown" << LL_ENDL;
- return FALSE;
+ // by default, didn't handle it
+ // LL_INFOS() << "LLTool::handleMiddleMouseDown" << LL_ENDL;
+ return FALSE;
}
BOOL LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask)
{
- // by default, didn't handle it
- // LL_INFOS() << "LLTool::handleMiddleMouseUp" << LL_ENDL;
- return FALSE;
+ // by default, didn't handle it
+ // LL_INFOS() << "LLTool::handleMiddleMouseUp" << LL_ENDL;
+ return FALSE;
}
BOOL LLTool::handleToolTip(S32 x, S32 y, MASK mask)
{
- // by default, didn't handle it
- // LL_INFOS() << "LLTool::handleToolTip" << LL_ENDL;
- return FALSE;
+ // by default, didn't handle it
+ // LL_INFOS() << "LLTool::handleToolTip" << LL_ENDL;
+ return FALSE;
}
void LLTool::setMouseCapture( BOOL b )
{
- if( b )
- {
- gFocusMgr.setMouseCapture(mComposite ? mComposite : this );
- }
- else
- if( hasMouseCapture() )
- {
- gFocusMgr.setMouseCapture( NULL );
- }
+ if( b )
+ {
+ gFocusMgr.setMouseCapture(mComposite ? mComposite : this );
+ }
+ else
+ if( hasMouseCapture() )
+ {
+ gFocusMgr.setMouseCapture( NULL );
+ }
}
// virtual
@@ -182,29 +182,29 @@ void LLTool::draw()
BOOL LLTool::hasMouseCapture()
{
- return gFocusMgr.getMouseCapture() == (mComposite ? mComposite : this);
+ return gFocusMgr.getMouseCapture() == (mComposite ? mComposite : this);
}
BOOL LLTool::handleKey(KEY key, MASK mask)
{
- return FALSE;
+ return FALSE;
}
LLTool* LLTool::getOverrideTool(MASK mask)
{
- // NOTE: if in flycam mode, ALT-ZOOM camera should be disabled
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- return NULL;
- }
-
- static LLCachedControl<bool> alt_zoom(gSavedSettings, "EnableAltZoom", true);
- if (alt_zoom)
- {
- if (mask & MASK_ALT)
- {
- return LLToolCamera::getInstance();
- }
- }
- return NULL;
+ // NOTE: if in flycam mode, ALT-ZOOM camera should be disabled
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ return NULL;
+ }
+
+ static LLCachedControl<bool> alt_zoom(gSavedSettings, "EnableAltZoom", true);
+ if (alt_zoom)
+ {
+ if (mask & MASK_ALT)
+ {
+ return LLToolCamera::getInstance();
+ }
+ }
+ return NULL;
}
diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h
index 41a38804ce..ba0a73fc72 100644
--- a/indra/newview/lltool.h
+++ b/indra/newview/lltool.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltool.h
* @brief LLTool class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,71 +39,71 @@ class LLView;
class LLPanel;
class LLTool
-: public LLMouseHandler, public LLThreadSafeRefCount
+: public LLMouseHandler, public LLThreadSafeRefCount
{
public:
- LLTool( const std::string& name, LLToolComposite* composite = NULL );
- virtual ~LLTool();
+ LLTool( const std::string& name, LLToolComposite* composite = NULL );
+ virtual ~LLTool();
- // Hack to support LLFocusMgr
- virtual BOOL isView() const { return FALSE; }
+ // Hack to support LLFocusMgr
+ virtual BOOL isView() const { return FALSE; }
- // Virtual functions inherited from LLMouseHandler
- virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down);
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask);
+ // Virtual functions inherited from LLMouseHandler
+ virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down);
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
- virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks);
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+ virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks);
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
- // Return FALSE to allow context menu to be shown.
- virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
- { *local_x = screen_x; *local_y = screen_y; }
- virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
- { *screen_x = local_x; *screen_y = local_y; }
+ // Return FALSE to allow context menu to be shown.
+ virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
+ { *local_x = screen_x; *local_y = screen_y; }
+ virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
+ { *screen_x = local_x; *screen_y = local_y; }
- virtual const std::string& getName() const { return mName; }
+ virtual const std::string& getName() const { return mName; }
- // New virtual functions
- virtual LLViewerObject* getEditingObject() { return NULL; }
- virtual LLVector3d getEditingPointGlobal() { return LLVector3d(); }
- virtual BOOL isEditing() { return (getEditingObject() != NULL); }
- virtual void stopEditing() {}
+ // New virtual functions
+ virtual LLViewerObject* getEditingObject() { return NULL; }
+ virtual LLVector3d getEditingPointGlobal() { return LLVector3d(); }
+ virtual BOOL isEditing() { return (getEditingObject() != NULL); }
+ virtual void stopEditing() {}
- virtual BOOL clipMouseWhenDown() { return TRUE; }
+ virtual BOOL clipMouseWhenDown() { return TRUE; }
- virtual void handleSelect() { } // do stuff when your tool is selected
- virtual void handleDeselect() { } // clean up when your tool is deselected
+ virtual void handleSelect() { } // do stuff when your tool is selected
+ virtual void handleDeselect() { } // clean up when your tool is deselected
- virtual LLTool* getOverrideTool(MASK mask);
+ virtual LLTool* getOverrideTool(MASK mask);
- // isAlwaysRendered() - return true if this is a tool that should
- // always be rendered regardless of selection.
- virtual BOOL isAlwaysRendered() { return FALSE; }
+ // isAlwaysRendered() - return true if this is a tool that should
+ // always be rendered regardless of selection.
+ virtual BOOL isAlwaysRendered() { return FALSE; }
- virtual void render() {} // draw tool specific 3D content in world
- virtual void draw(); // draw tool specific 2D overlay
+ virtual void render() {} // draw tool specific 3D content in world
+ virtual void draw(); // draw tool specific 2D overlay
- virtual BOOL handleKey(KEY key, MASK mask);
+ virtual BOOL handleKey(KEY key, MASK mask);
- // Note: NOT virtual. Subclasses should call this version.
- void setMouseCapture(BOOL b);
- BOOL hasMouseCapture();
- virtual void onMouseCaptureLost() {} // override this one as needed.
+ // Note: NOT virtual. Subclasses should call this version.
+ void setMouseCapture(BOOL b);
+ BOOL hasMouseCapture();
+ virtual void onMouseCaptureLost() {} // override this one as needed.
protected:
- LLToolComposite* mComposite; // Composite will handle mouse captures.
- std::string mName;
-
+ LLToolComposite* mComposite; // Composite will handle mouse captures.
+ std::string mName;
+
public:
- static const std::string sNameNull;
+ static const std::string sNameNull;
};
#endif
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 9157d20f98..6b9125b385 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lltoolbarview.cpp
* @author Merov Linden
* @brief User customizable toolbar class
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,272 +52,272 @@ static LLDefaultChildRegistry::Register<LLToolBarView> r("toolbar_view");
bool isToolDragged()
{
- return (LLToolDragAndDrop::getInstance()->getSource() == LLToolDragAndDrop::SOURCE_VIEWER);
+ return (LLToolDragAndDrop::getInstance()->getSource() == LLToolDragAndDrop::SOURCE_VIEWER);
}
LLToolBarView::Toolbar::Toolbar()
-: button_display_mode("button_display_mode"),
- commands("command")
+: button_display_mode("button_display_mode"),
+ commands("command")
{}
LLToolBarView::ToolbarSet::ToolbarSet()
-: left_toolbar("left_toolbar"),
- right_toolbar("right_toolbar"),
- bottom_toolbar("bottom_toolbar")
+: left_toolbar("left_toolbar"),
+ right_toolbar("right_toolbar"),
+ bottom_toolbar("bottom_toolbar")
{}
LLToolBarView::LLToolBarView(const LLToolBarView::Params& p)
-: LLUICtrl(p),
- mDragStarted(false),
- mShowToolbars(true),
- mDragToolbarButton(NULL),
- mDragItem(NULL),
- mToolbarsLoaded(false),
- mBottomToolbarPanel(NULL)
+: LLUICtrl(p),
+ mDragStarted(false),
+ mShowToolbars(true),
+ mDragToolbarButton(NULL),
+ mDragItem(NULL),
+ mToolbarsLoaded(false),
+ mBottomToolbarPanel(NULL)
{
- for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; i++)
- {
- mToolbars[i] = NULL;
- }
+ for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; i++)
+ {
+ mToolbars[i] = NULL;
+ }
}
void LLToolBarView::initFromParams(const LLToolBarView::Params& p)
{
- // Initialize the base object
- LLUICtrl::initFromParams(p);
+ // Initialize the base object
+ LLUICtrl::initFromParams(p);
}
LLToolBarView::~LLToolBarView()
{
- saveToolbars();
+ saveToolbars();
}
BOOL LLToolBarView::postBuild()
{
- mToolbars[LLToolBarEnums::TOOLBAR_LEFT] = getChild<LLToolBar>("toolbar_left");
- mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_LEFT);
-
- mToolbars[LLToolBarEnums::TOOLBAR_RIGHT] = getChild<LLToolBar>("toolbar_right");
- mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_RIGHT);
-
- mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM] = getChild<LLToolBar>("toolbar_bottom");
- mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_BOTTOM);
-
- mBottomToolbarPanel = getChild<LLView>("bottom_toolbar_panel");
-
- for (int i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
- {
- mToolbars[i]->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
- mToolbars[i]->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
- mToolbars[i]->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
- mToolbars[i]->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded,_1));
- mToolbars[i]->setButtonRemoveCallback(boost::bind(LLToolBarView::onToolBarButtonRemoved,_1));
- }
-
- return TRUE;
+ mToolbars[LLToolBarEnums::TOOLBAR_LEFT] = getChild<LLToolBar>("toolbar_left");
+ mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_LEFT);
+
+ mToolbars[LLToolBarEnums::TOOLBAR_RIGHT] = getChild<LLToolBar>("toolbar_right");
+ mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_RIGHT);
+
+ mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM] = getChild<LLToolBar>("toolbar_bottom");
+ mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_BOTTOM);
+
+ mBottomToolbarPanel = getChild<LLView>("bottom_toolbar_panel");
+
+ for (int i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
+ {
+ mToolbars[i]->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
+ mToolbars[i]->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
+ mToolbars[i]->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
+ mToolbars[i]->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded,_1));
+ mToolbars[i]->setButtonRemoveCallback(boost::bind(LLToolBarView::onToolBarButtonRemoved,_1));
+ }
+
+ return TRUE;
}
S32 LLToolBarView::hasCommand(const LLCommandId& commandId) const
{
- S32 command_location = LLToolBarEnums::TOOLBAR_NONE;
-
- for (S32 loc = LLToolBarEnums::TOOLBAR_FIRST; loc <= LLToolBarEnums::TOOLBAR_LAST; loc++)
- {
- if (mToolbars[loc]->hasCommand(commandId))
- {
- command_location = loc;
- break;
- }
- }
-
- return command_location;
+ S32 command_location = LLToolBarEnums::TOOLBAR_NONE;
+
+ for (S32 loc = LLToolBarEnums::TOOLBAR_FIRST; loc <= LLToolBarEnums::TOOLBAR_LAST; loc++)
+ {
+ if (mToolbars[loc]->hasCommand(commandId))
+ {
+ command_location = loc;
+ break;
+ }
+ }
+
+ return command_location;
}
S32 LLToolBarView::addCommand(const LLCommandId& commandId, LLToolBarEnums::EToolBarLocation toolbar, int rank)
{
- int old_rank;
- removeCommand(commandId, old_rank);
+ int old_rank;
+ removeCommand(commandId, old_rank);
- S32 command_location = mToolbars[toolbar]->addCommand(commandId, rank);
+ S32 command_location = mToolbars[toolbar]->addCommand(commandId, rank);
- return command_location;
+ return command_location;
}
S32 LLToolBarView::removeCommand(const LLCommandId& commandId, int& rank)
{
- S32 command_location = hasCommand(commandId);
- rank = LLToolBar::RANK_NONE;
+ S32 command_location = hasCommand(commandId);
+ rank = LLToolBar::RANK_NONE;
- if (command_location != LLToolBarEnums::TOOLBAR_NONE)
- {
- rank = mToolbars[command_location]->removeCommand(commandId);
- }
+ if (command_location != LLToolBarEnums::TOOLBAR_NONE)
+ {
+ rank = mToolbars[command_location]->removeCommand(commandId);
+ }
- return command_location;
+ return command_location;
}
S32 LLToolBarView::enableCommand(const LLCommandId& commandId, bool enabled)
{
- S32 command_location = hasCommand(commandId);
+ S32 command_location = hasCommand(commandId);
- if (command_location != LLToolBarEnums::TOOLBAR_NONE)
- {
- mToolbars[command_location]->enableCommand(commandId, enabled);
- }
+ if (command_location != LLToolBarEnums::TOOLBAR_NONE)
+ {
+ mToolbars[command_location]->enableCommand(commandId, enabled);
+ }
- return command_location;
+ return command_location;
}
S32 LLToolBarView::stopCommandInProgress(const LLCommandId& commandId)
{
- S32 command_location = hasCommand(commandId);
+ S32 command_location = hasCommand(commandId);
- if (command_location != LLToolBarEnums::TOOLBAR_NONE)
- {
- mToolbars[command_location]->stopCommandInProgress(commandId);
- }
+ if (command_location != LLToolBarEnums::TOOLBAR_NONE)
+ {
+ mToolbars[command_location]->stopCommandInProgress(commandId);
+ }
- return command_location;
+ return command_location;
}
S32 LLToolBarView::flashCommand(const LLCommandId& commandId, bool flash, bool force_flashing/* = false */)
{
- S32 command_location = hasCommand(commandId);
+ S32 command_location = hasCommand(commandId);
- if (command_location != LLToolBarEnums::TOOLBAR_NONE)
- {
- mToolbars[command_location]->flashCommand(commandId, flash, force_flashing);
- }
+ if (command_location != LLToolBarEnums::TOOLBAR_NONE)
+ {
+ mToolbars[command_location]->flashCommand(commandId, flash, force_flashing);
+ }
- return command_location;
+ return command_location;
}
bool LLToolBarView::addCommandInternal(const LLCommandId& command, LLToolBar* toolbar)
{
- LLCommandManager& mgr = LLCommandManager::instance();
- if (mgr.getCommand(command))
- {
- toolbar->addCommand(command);
- }
- else
- {
- LL_WARNS() << "Toolbars creation : the command with id " << command.uuid().asString() << " cannot be found in the command manager" << LL_ENDL;
- return false;
- }
- return true;
+ LLCommandManager& mgr = LLCommandManager::instance();
+ if (mgr.getCommand(command))
+ {
+ toolbar->addCommand(command);
+ }
+ else
+ {
+ LL_WARNS() << "Toolbars creation : the command with id " << command.uuid().asString() << " cannot be found in the command manager" << LL_ENDL;
+ return false;
+ }
+ return true;
}
bool LLToolBarView::loadToolbars(bool force_default)
{
- LLToolBarView::ToolbarSet toolbar_set;
- bool err = false;
-
- // Load the toolbars.xml file
- std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml");
- if (force_default)
- {
- toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml");
- }
- else if (!gDirUtilp->fileExists(toolbar_file))
- {
- LL_WARNS() << "User toolbars def not found -> use default" << LL_ENDL;
- toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml");
- }
-
- LLXMLNodePtr root;
- if(!LLXMLNode::parseFile(toolbar_file, root, NULL))
- {
- LL_WARNS() << "Unable to load toolbars from file: " << toolbar_file << LL_ENDL;
- err = true;
- }
-
- if (!err && !root->hasName("toolbars"))
- {
- LL_WARNS() << toolbar_file << " is not a valid toolbars definition file" << LL_ENDL;
- err = true;
- }
-
- // Parse the toolbar settings
- LLXUIParser parser;
- if (!err)
- {
- parser.readXUI(root, toolbar_set, toolbar_file);
- }
-
- if (!err && !toolbar_set.validateBlock())
- {
- LL_WARNS() << "Unable to validate toolbars from file: " << toolbar_file << LL_ENDL;
- err = true;
- }
-
- if (err)
- {
- if (force_default)
- {
- LL_ERRS() << "Unable to load toolbars from default file : " << toolbar_file << LL_ENDL;
- return false;
- }
-
- // Try to load the default toolbars
- return loadToolbars(true);
- }
-
- // Clear the toolbars now before adding the loaded commands and settings
- for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
- {
- if (mToolbars[i])
- {
- mToolbars[i]->clearCommandsList();
- }
- }
-
- // Add commands to each toolbar
- if (toolbar_set.left_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_LEFT])
- {
- if (toolbar_set.left_toolbar.button_display_mode.isProvided())
- {
- LLToolBarEnums::ButtonType button_type = toolbar_set.left_toolbar.button_display_mode;
- mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->setButtonType(button_type);
- }
- for (const LLCommandId::Params& command_params : toolbar_set.left_toolbar.commands)
- {
- if (!addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_LEFT]))
- {
- LL_WARNS() << "Error adding command '" << command_params.name() << "' to left toolbar." << LL_ENDL;
- }
- }
- }
- if (toolbar_set.right_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])
- {
- if (toolbar_set.right_toolbar.button_display_mode.isProvided())
- {
- LLToolBarEnums::ButtonType button_type = toolbar_set.right_toolbar.button_display_mode;
- mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->setButtonType(button_type);
- }
- for (const LLCommandId::Params& command_params : toolbar_set.right_toolbar.commands)
- {
- if (!addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]))
- {
- LL_WARNS() << "Error adding command '" << command_params.name() << "' to right toolbar." << LL_ENDL;
- }
- }
- }
- if (toolbar_set.bottom_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])
- {
- if (toolbar_set.bottom_toolbar.button_display_mode.isProvided())
- {
- LLToolBarEnums::ButtonType button_type = toolbar_set.bottom_toolbar.button_display_mode;
- mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->setButtonType(button_type);
- }
- for (const LLCommandId::Params& command_params : toolbar_set.bottom_toolbar.commands)
- {
- if (!addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]))
- {
- LL_WARNS() << "Error adding command '" << command_params.name() << "' to bottom toolbar." << LL_ENDL;
- }
- }
- }
+ LLToolBarView::ToolbarSet toolbar_set;
+ bool err = false;
+
+ // Load the toolbars.xml file
+ std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml");
+ if (force_default)
+ {
+ toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml");
+ }
+ else if (!gDirUtilp->fileExists(toolbar_file))
+ {
+ LL_WARNS() << "User toolbars def not found -> use default" << LL_ENDL;
+ toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml");
+ }
+
+ LLXMLNodePtr root;
+ if(!LLXMLNode::parseFile(toolbar_file, root, NULL))
+ {
+ LL_WARNS() << "Unable to load toolbars from file: " << toolbar_file << LL_ENDL;
+ err = true;
+ }
+
+ if (!err && !root->hasName("toolbars"))
+ {
+ LL_WARNS() << toolbar_file << " is not a valid toolbars definition file" << LL_ENDL;
+ err = true;
+ }
+
+ // Parse the toolbar settings
+ LLXUIParser parser;
+ if (!err)
+ {
+ parser.readXUI(root, toolbar_set, toolbar_file);
+ }
+
+ if (!err && !toolbar_set.validateBlock())
+ {
+ LL_WARNS() << "Unable to validate toolbars from file: " << toolbar_file << LL_ENDL;
+ err = true;
+ }
+
+ if (err)
+ {
+ if (force_default)
+ {
+ LL_ERRS() << "Unable to load toolbars from default file : " << toolbar_file << LL_ENDL;
+ return false;
+ }
+
+ // Try to load the default toolbars
+ return loadToolbars(true);
+ }
+
+ // Clear the toolbars now before adding the loaded commands and settings
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
+ {
+ if (mToolbars[i])
+ {
+ mToolbars[i]->clearCommandsList();
+ }
+ }
+
+ // Add commands to each toolbar
+ if (toolbar_set.left_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_LEFT])
+ {
+ if (toolbar_set.left_toolbar.button_display_mode.isProvided())
+ {
+ LLToolBarEnums::ButtonType button_type = toolbar_set.left_toolbar.button_display_mode;
+ mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->setButtonType(button_type);
+ }
+ for (const LLCommandId::Params& command_params : toolbar_set.left_toolbar.commands)
+ {
+ if (!addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_LEFT]))
+ {
+ LL_WARNS() << "Error adding command '" << command_params.name() << "' to left toolbar." << LL_ENDL;
+ }
+ }
+ }
+ if (toolbar_set.right_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])
+ {
+ if (toolbar_set.right_toolbar.button_display_mode.isProvided())
+ {
+ LLToolBarEnums::ButtonType button_type = toolbar_set.right_toolbar.button_display_mode;
+ mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->setButtonType(button_type);
+ }
+ for (const LLCommandId::Params& command_params : toolbar_set.right_toolbar.commands)
+ {
+ if (!addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]))
+ {
+ LL_WARNS() << "Error adding command '" << command_params.name() << "' to right toolbar." << LL_ENDL;
+ }
+ }
+ }
+ if (toolbar_set.bottom_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])
+ {
+ if (toolbar_set.bottom_toolbar.button_display_mode.isProvided())
+ {
+ LLToolBarEnums::ButtonType button_type = toolbar_set.bottom_toolbar.button_display_mode;
+ mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->setButtonType(button_type);
+ }
+ for (const LLCommandId::Params& command_params : toolbar_set.bottom_toolbar.commands)
+ {
+ if (!addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]))
+ {
+ LL_WARNS() << "Error adding command '" << command_params.name() << "' to bottom toolbar." << LL_ENDL;
+ }
+ }
+ }
// SL-18581: Don't show the starter avatar toolbar button for NUX users
if (gAgent.isFirstLogin())
@@ -337,244 +337,244 @@ bool LLToolBarView::loadToolbars(bool force_default)
}
}
- mToolbarsLoaded = true;
- return true;
+ mToolbarsLoaded = true;
+ return true;
}
bool LLToolBarView::clearToolbars()
{
- for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
- {
- if (mToolbars[i])
- {
- mToolbars[i]->clearCommandsList();
- }
- }
-
- return true;
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
+ {
+ if (mToolbars[i])
+ {
+ mToolbars[i]->clearCommandsList();
+ }
+ }
+
+ return true;
}
//static
bool LLToolBarView::loadDefaultToolbars()
{
- bool retval = false;
-
- if (gToolBarView)
- {
- retval = gToolBarView->loadToolbars(true);
- if (retval)
- {
- gToolBarView->saveToolbars();
- }
- }
-
- return retval;
+ bool retval = false;
+
+ if (gToolBarView)
+ {
+ retval = gToolBarView->loadToolbars(true);
+ if (retval)
+ {
+ gToolBarView->saveToolbars();
+ }
+ }
+
+ return retval;
}
//static
bool LLToolBarView::clearAllToolbars()
{
- bool retval = false;
-
- if (gToolBarView)
- {
- retval = gToolBarView->clearToolbars();
- if (retval)
- {
- gToolBarView->saveToolbars();
- }
- }
-
- return retval;
+ bool retval = false;
+
+ if (gToolBarView)
+ {
+ retval = gToolBarView->clearToolbars();
+ if (retval)
+ {
+ gToolBarView->saveToolbars();
+ }
+ }
+
+ return retval;
}
void LLToolBarView::saveToolbars() const
{
- if (!mToolbarsLoaded)
- return;
-
- // Build the parameter tree from the toolbar data
- LLToolBarView::ToolbarSet toolbar_set;
- if (mToolbars[LLToolBarEnums::TOOLBAR_LEFT])
- {
- toolbar_set.left_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getButtonType();
- addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getCommandsList(), toolbar_set.left_toolbar);
- }
- if (mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])
- {
- toolbar_set.right_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getButtonType();
- addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getCommandsList(), toolbar_set.right_toolbar);
- }
- if (mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])
- {
- toolbar_set.bottom_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getButtonType();
- addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getCommandsList(), toolbar_set.bottom_toolbar);
- }
-
- // Serialize the parameter tree
- LLXMLNodePtr output_node = new LLXMLNode("toolbars", false);
- LLXUIParser parser;
- parser.writeXUI(output_node, toolbar_set);
-
- // Write the resulting XML to file
- if(!output_node->isNull())
- {
- const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml");
- LLFILE *fp = LLFile::fopen(filename, "w");
- if (fp != NULL)
- {
- LLXMLNode::writeHeaderToFile(fp);
- output_node->writeToFile(fp);
- fclose(fp);
- }
- }
+ if (!mToolbarsLoaded)
+ return;
+
+ // Build the parameter tree from the toolbar data
+ LLToolBarView::ToolbarSet toolbar_set;
+ if (mToolbars[LLToolBarEnums::TOOLBAR_LEFT])
+ {
+ toolbar_set.left_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getButtonType();
+ addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getCommandsList(), toolbar_set.left_toolbar);
+ }
+ if (mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])
+ {
+ toolbar_set.right_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getButtonType();
+ addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getCommandsList(), toolbar_set.right_toolbar);
+ }
+ if (mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])
+ {
+ toolbar_set.bottom_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getButtonType();
+ addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getCommandsList(), toolbar_set.bottom_toolbar);
+ }
+
+ // Serialize the parameter tree
+ LLXMLNodePtr output_node = new LLXMLNode("toolbars", false);
+ LLXUIParser parser;
+ parser.writeXUI(output_node, toolbar_set);
+
+ // Write the resulting XML to file
+ if(!output_node->isNull())
+ {
+ const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml");
+ LLFILE *fp = LLFile::fopen(filename, "w");
+ if (fp != NULL)
+ {
+ LLXMLNode::writeHeaderToFile(fp);
+ output_node->writeToFile(fp);
+ fclose(fp);
+ }
+ }
}
// Enumerate the commands in command_list and add them as Params to the toolbar
void LLToolBarView::addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const
{
- LLCommandManager& mgr = LLCommandManager::instance();
-
- for (command_id_list_t::const_iterator it = command_list.begin();
- it != command_list.end();
- ++it)
- {
- LLCommand* command = mgr.getCommand(*it);
- if (command)
- {
- LLCommandId::Params command_name_param;
- command_name_param.name = command->name();
- toolbar.commands.add(command_name_param);
- }
- }
+ LLCommandManager& mgr = LLCommandManager::instance();
+
+ for (command_id_list_t::const_iterator it = command_list.begin();
+ it != command_list.end();
+ ++it)
+ {
+ LLCommand* command = mgr.getCommand(*it);
+ if (command)
+ {
+ LLCommandId::Params command_name_param;
+ command_name_param.name = command->name();
+ toolbar.commands.add(command_name_param);
+ }
+ }
}
void LLToolBarView::onToolBarButtonAdded(LLView* button)
{
- llassert(button);
-
- if (button->getName() == "speak")
- {
- // Add the "Speak" button as a control view in LLTransientFloaterMgr
- // to prevent hiding the transient IM floater upon pressing "Speak".
- LLTransientFloaterMgr::getInstance()->addControlView(button);
-
- // Redock incoming and/or outgoing call windows, if applicable
-
- LLFloater* incoming_floater = LLFloaterReg::getLastFloaterInGroup("incoming_call");
- LLFloater* outgoing_floater = LLFloaterReg::getLastFloaterInGroup("outgoing_call");
-
- if (incoming_floater && incoming_floater->isShown())
- {
- LLCallDialog* incoming = dynamic_cast<LLCallDialog *>(incoming_floater);
- llassert(incoming);
-
- LLDockControl* dock_control = incoming->getDockControl();
- if (dock_control->getDock() == NULL)
- {
- incoming->dockToToolbarButton("speak");
- }
- }
-
- if (outgoing_floater && outgoing_floater->isShown())
- {
- LLCallDialog* outgoing = dynamic_cast<LLCallDialog *>(outgoing_floater);
- llassert(outgoing);
-
- LLDockControl* dock_control = outgoing->getDockControl();
- if (dock_control->getDock() == NULL)
- {
- outgoing->dockToToolbarButton("speak");
- }
- }
- }
- else if (button->getName() == "voice")
- {
- // Add the "Voice controls" button as a control view in LLTransientFloaterMgr
- // to prevent hiding the transient IM floater upon pressing "Voice controls".
- LLTransientFloaterMgr::getInstance()->addControlView(button);
- }
+ llassert(button);
+
+ if (button->getName() == "speak")
+ {
+ // Add the "Speak" button as a control view in LLTransientFloaterMgr
+ // to prevent hiding the transient IM floater upon pressing "Speak".
+ LLTransientFloaterMgr::getInstance()->addControlView(button);
+
+ // Redock incoming and/or outgoing call windows, if applicable
+
+ LLFloater* incoming_floater = LLFloaterReg::getLastFloaterInGroup("incoming_call");
+ LLFloater* outgoing_floater = LLFloaterReg::getLastFloaterInGroup("outgoing_call");
+
+ if (incoming_floater && incoming_floater->isShown())
+ {
+ LLCallDialog* incoming = dynamic_cast<LLCallDialog *>(incoming_floater);
+ llassert(incoming);
+
+ LLDockControl* dock_control = incoming->getDockControl();
+ if (dock_control->getDock() == NULL)
+ {
+ incoming->dockToToolbarButton("speak");
+ }
+ }
+
+ if (outgoing_floater && outgoing_floater->isShown())
+ {
+ LLCallDialog* outgoing = dynamic_cast<LLCallDialog *>(outgoing_floater);
+ llassert(outgoing);
+
+ LLDockControl* dock_control = outgoing->getDockControl();
+ if (dock_control->getDock() == NULL)
+ {
+ outgoing->dockToToolbarButton("speak");
+ }
+ }
+ }
+ else if (button->getName() == "voice")
+ {
+ // Add the "Voice controls" button as a control view in LLTransientFloaterMgr
+ // to prevent hiding the transient IM floater upon pressing "Voice controls".
+ LLTransientFloaterMgr::getInstance()->addControlView(button);
+ }
}
void LLToolBarView::onToolBarButtonRemoved(LLView* button)
{
- llassert(button);
-
- if (button->getName() == "speak")
- {
- LLTransientFloaterMgr::getInstance()->removeControlView(button);
-
- // Undock incoming and/or outgoing call windows
-
- LLFloater* incoming_floater = LLFloaterReg::getLastFloaterInGroup("incoming_call");
- LLFloater* outgoing_floater = LLFloaterReg::getLastFloaterInGroup("outgoing_call");
-
- if (incoming_floater && incoming_floater->isShown())
- {
- LLDockableFloater* incoming = dynamic_cast<LLDockableFloater *>(incoming_floater);
- llassert(incoming);
-
- LLDockControl* dock_control = incoming->getDockControl();
- dock_control->setDock(NULL);
- }
-
- if (outgoing_floater && outgoing_floater->isShown())
- {
- LLDockableFloater* outgoing = dynamic_cast<LLDockableFloater *>(outgoing_floater);
- llassert(outgoing);
-
- LLDockControl* dock_control = outgoing->getDockControl();
- dock_control->setDock(NULL);
- }
- }
- else if (button->getName() == "voice")
- {
- LLTransientFloaterMgr::getInstance()->removeControlView(button);
- }
+ llassert(button);
+
+ if (button->getName() == "speak")
+ {
+ LLTransientFloaterMgr::getInstance()->removeControlView(button);
+
+ // Undock incoming and/or outgoing call windows
+
+ LLFloater* incoming_floater = LLFloaterReg::getLastFloaterInGroup("incoming_call");
+ LLFloater* outgoing_floater = LLFloaterReg::getLastFloaterInGroup("outgoing_call");
+
+ if (incoming_floater && incoming_floater->isShown())
+ {
+ LLDockableFloater* incoming = dynamic_cast<LLDockableFloater *>(incoming_floater);
+ llassert(incoming);
+
+ LLDockControl* dock_control = incoming->getDockControl();
+ dock_control->setDock(NULL);
+ }
+
+ if (outgoing_floater && outgoing_floater->isShown())
+ {
+ LLDockableFloater* outgoing = dynamic_cast<LLDockableFloater *>(outgoing_floater);
+ llassert(outgoing);
+
+ LLDockControl* dock_control = outgoing->getDockControl();
+ dock_control->setDock(NULL);
+ }
+ }
+ else if (button->getName() == "voice")
+ {
+ LLTransientFloaterMgr::getInstance()->removeControlView(button);
+ }
}
void LLToolBarView::draw()
{
- LLRect toolbar_rects[LLToolBarEnums::TOOLBAR_COUNT];
-
- for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
- {
- if (mToolbars[i])
- {
- LLView::EOrientation orientation = LLToolBarEnums::getOrientation(mToolbars[i]->getSideType());
-
- if (orientation == LLLayoutStack::HORIZONTAL)
- {
- mToolbars[i]->getParent()->reshape(mToolbars[i]->getParent()->getRect().getWidth(), mToolbars[i]->getRect().getHeight());
- }
- else
- {
- mToolbars[i]->getParent()->reshape(mToolbars[i]->getRect().getWidth(), mToolbars[i]->getParent()->getRect().getHeight());
- }
-
- mToolbars[i]->localRectToOtherView(mToolbars[i]->getLocalRect(), &toolbar_rects[i], this);
- }
- }
-
- for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
- {
- mToolbars[i]->getParent()->setVisible(mShowToolbars
- && (mToolbars[i]->hasButtons()
- || isToolDragged()));
- }
-
- // Draw drop zones if drop of a tool is active
- if (isToolDragged())
- {
- LLColor4 drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" );
-
- for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
- {
- gl_rect_2d(toolbar_rects[i], drop_color, TRUE);
- }
- }
-
- LLUICtrl::draw();
+ LLRect toolbar_rects[LLToolBarEnums::TOOLBAR_COUNT];
+
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
+ {
+ if (mToolbars[i])
+ {
+ LLView::EOrientation orientation = LLToolBarEnums::getOrientation(mToolbars[i]->getSideType());
+
+ if (orientation == LLLayoutStack::HORIZONTAL)
+ {
+ mToolbars[i]->getParent()->reshape(mToolbars[i]->getParent()->getRect().getWidth(), mToolbars[i]->getRect().getHeight());
+ }
+ else
+ {
+ mToolbars[i]->getParent()->reshape(mToolbars[i]->getRect().getWidth(), mToolbars[i]->getParent()->getRect().getHeight());
+ }
+
+ mToolbars[i]->localRectToOtherView(mToolbars[i]->getLocalRect(), &toolbar_rects[i], this);
+ }
+ }
+
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
+ {
+ mToolbars[i]->getParent()->setVisible(mShowToolbars
+ && (mToolbars[i]->hasButtons()
+ || isToolDragged()));
+ }
+
+ // Draw drop zones if drop of a tool is active
+ if (isToolDragged())
+ {
+ LLColor4 drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" );
+
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
+ {
+ gl_rect_2d(toolbar_rects[i], drop_color, TRUE);
+ }
+ }
+
+ LLUICtrl::draw();
}
@@ -585,134 +585,134 @@ void LLToolBarView::draw()
void LLToolBarView::startDragTool(S32 x, S32 y, LLToolBarButton* toolbarButton)
{
- resetDragTool(toolbarButton);
+ resetDragTool(toolbarButton);
- // Flag the tool dragging but don't start it yet
- LLToolDragAndDrop::getInstance()->setDragStart( x, y );
+ // Flag the tool dragging but don't start it yet
+ LLToolDragAndDrop::getInstance()->setDragStart( x, y );
}
BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)
{
- if (LLToolDragAndDrop::getInstance()->isOverThreshold( x, y ))
- {
- if (!gToolBarView->mDragStarted)
- {
- // Start the tool dragging:
-
- // First, create the global drag and drop object
- std::vector<EDragAndDropType> types;
- uuid_vec_t cargo_ids;
- types.push_back(DAD_WIDGET);
- cargo_ids.push_back(uuid);
- LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER;
- LLUUID srcID;
- LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID);
-
- // Second, stop the command if it is in progress and requires stopping!
- LLCommandId command_id = LLCommandId(uuid);
- gToolBarView->stopCommandInProgress(command_id);
-
- gToolBarView->mDragStarted = true;
- return TRUE;
- }
- else
- {
- MASK mask = 0;
- return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask );
- }
- }
- return FALSE;
+ if (LLToolDragAndDrop::getInstance()->isOverThreshold( x, y ))
+ {
+ if (!gToolBarView->mDragStarted)
+ {
+ // Start the tool dragging:
+
+ // First, create the global drag and drop object
+ std::vector<EDragAndDropType> types;
+ uuid_vec_t cargo_ids;
+ types.push_back(DAD_WIDGET);
+ cargo_ids.push_back(uuid);
+ LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER;
+ LLUUID srcID;
+ LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID);
+
+ // Second, stop the command if it is in progress and requires stopping!
+ LLCommandId command_id = LLCommandId(uuid);
+ gToolBarView->stopCommandInProgress(command_id);
+
+ gToolBarView->mDragStarted = true;
+ return TRUE;
+ }
+ else
+ {
+ MASK mask = 0;
+ return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask );
+ }
+ }
+ return FALSE;
}
BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar)
{
- BOOL handled = FALSE;
- LLInventoryObject* inv_item = static_cast<LLInventoryObject*>(cargo_data);
-
- LLAssetType::EType type = inv_item->getType();
- if (type == LLAssetType::AT_WIDGET)
- {
- handled = TRUE;
- // Get the command from its uuid
- LLCommandManager& mgr = LLCommandManager::instance();
- LLCommandId command_id(inv_item->getUUID());
- LLCommand* command = mgr.getCommand(command_id);
- if (command)
- {
- // Suppress the command from the toolbars (including the one it's dropped in,
- // this will handle move position).
- S32 old_toolbar_loc = gToolBarView->hasCommand(command_id);
- LLToolBar* old_toolbar = NULL;
-
- if (old_toolbar_loc != LLToolBarEnums::TOOLBAR_NONE)
- {
- llassert(gToolBarView->mDragToolbarButton);
- old_toolbar = gToolBarView->mDragToolbarButton->getParentByType<LLToolBar>();
- if (old_toolbar->isReadOnly() && toolbar->isReadOnly())
- {
- // do nothing
- }
- else
- {
- int old_rank = LLToolBar::RANK_NONE;
- gToolBarView->removeCommand(command_id, old_rank);
- }
- }
-
- // Convert the (x,y) position in rank in toolbar
- if (!toolbar->isReadOnly())
- {
- int new_rank = toolbar->getRankFromPosition(x,y);
- toolbar->addCommand(command_id, new_rank);
- }
-
- // Save the new toolbars configuration
- gToolBarView->saveToolbars();
- }
- else
- {
- LL_WARNS() << "Command couldn't be found in command manager" << LL_ENDL;
- }
- }
-
- resetDragTool(NULL);
- return handled;
+ BOOL handled = FALSE;
+ LLInventoryObject* inv_item = static_cast<LLInventoryObject*>(cargo_data);
+
+ LLAssetType::EType type = inv_item->getType();
+ if (type == LLAssetType::AT_WIDGET)
+ {
+ handled = TRUE;
+ // Get the command from its uuid
+ LLCommandManager& mgr = LLCommandManager::instance();
+ LLCommandId command_id(inv_item->getUUID());
+ LLCommand* command = mgr.getCommand(command_id);
+ if (command)
+ {
+ // Suppress the command from the toolbars (including the one it's dropped in,
+ // this will handle move position).
+ S32 old_toolbar_loc = gToolBarView->hasCommand(command_id);
+ LLToolBar* old_toolbar = NULL;
+
+ if (old_toolbar_loc != LLToolBarEnums::TOOLBAR_NONE)
+ {
+ llassert(gToolBarView->mDragToolbarButton);
+ old_toolbar = gToolBarView->mDragToolbarButton->getParentByType<LLToolBar>();
+ if (old_toolbar->isReadOnly() && toolbar->isReadOnly())
+ {
+ // do nothing
+ }
+ else
+ {
+ int old_rank = LLToolBar::RANK_NONE;
+ gToolBarView->removeCommand(command_id, old_rank);
+ }
+ }
+
+ // Convert the (x,y) position in rank in toolbar
+ if (!toolbar->isReadOnly())
+ {
+ int new_rank = toolbar->getRankFromPosition(x,y);
+ toolbar->addCommand(command_id, new_rank);
+ }
+
+ // Save the new toolbars configuration
+ gToolBarView->saveToolbars();
+ }
+ else
+ {
+ LL_WARNS() << "Command couldn't be found in command manager" << LL_ENDL;
+ }
+ }
+
+ resetDragTool(NULL);
+ return handled;
}
void LLToolBarView::resetDragTool(LLToolBarButton* toolbarButton)
{
- // Clear the saved command, toolbar and rank
- gToolBarView->mDragStarted = false;
- gToolBarView->mDragToolbarButton = toolbarButton;
+ // Clear the saved command, toolbar and rank
+ gToolBarView->mDragStarted = false;
+ gToolBarView->mDragToolbarButton = toolbarButton;
}
// Provide a handle on a free standing inventory item containing references to the tool.
// This might be used by Drag and Drop to move around references to tool items.
LLInventoryObject* LLToolBarView::getDragItem()
{
- if (mDragToolbarButton)
- {
- LLUUID item_uuid = mDragToolbarButton->getCommandId().uuid();
- mDragItem = new LLInventoryObject (item_uuid, LLUUID::null, LLAssetType::AT_WIDGET, "");
- }
- return mDragItem;
+ if (mDragToolbarButton)
+ {
+ LLUUID item_uuid = mDragToolbarButton->getCommandId().uuid();
+ mDragItem = new LLInventoryObject (item_uuid, LLUUID::null, LLAssetType::AT_WIDGET, "");
+ }
+ return mDragItem;
}
void LLToolBarView::setToolBarsVisible(bool visible)
{
- mShowToolbars = visible;
+ mShowToolbars = visible;
}
bool LLToolBarView::isModified() const
{
- bool modified = false;
+ bool modified = false;
- for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
- {
- modified |= mToolbars[i]->isModified();
- }
+ for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
+ {
+ modified |= mToolbars[i]->isModified();
+ }
- return modified;
+ return modified;
}
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index a230c2fdee..19f72102c1 100644
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lltoolbarview.h
* @author Merov Linden
* @brief User customizable toolbar class
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,88 +40,88 @@ class LLUICtrlFactory;
class LLToolBarView : public LLUICtrl
{
public:
- // Xui structure of the toolbar panel
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> {};
-
- // Note: valid children for LLToolBarView are stored in this registry
- typedef LLDefaultChildRegistry child_registry_t;
-
- // Xml structure of the toolbars.xml setting
- // Those live in a toolbars.xml found in app_settings (for the default) and in
- // the user folder for the user specific (saved) settings
- struct Toolbar : public LLInitParam::Block<Toolbar>
- {
- Mandatory<LLToolBarEnums::ButtonType> button_display_mode;
- Multiple<LLCommandId::Params> commands;
-
- Toolbar();
- };
- struct ToolbarSet : public LLInitParam::Block<ToolbarSet>
- {
- Optional<Toolbar> left_toolbar,
- right_toolbar,
- bottom_toolbar;
-
- ToolbarSet();
- };
-
- // Derived methods
- virtual ~LLToolBarView();
- virtual BOOL postBuild();
- virtual void draw();
-
- // Toolbar view interface with the rest of the world
- // Checks if the commandId is being used somewhere in one of the toolbars, returns LLToolBarEnums::EToolBarLocation
- S32 hasCommand(const LLCommandId& commandId) const;
- S32 addCommand(const LLCommandId& commandId, LLToolBarEnums::EToolBarLocation toolbar, int rank = LLToolBar::RANK_NONE);
- S32 removeCommand(const LLCommandId& commandId, int& rank); // Sets the rank the removed command was at, RANK_NONE if not found
- S32 enableCommand(const LLCommandId& commandId, bool enabled);
- S32 stopCommandInProgress(const LLCommandId& commandId);
- S32 flashCommand(const LLCommandId& commandId, bool flash, bool force_flashing = false);
-
- // Loads the toolbars from the existing user or default settings
- bool loadToolbars(bool force_default = false); // return false if load fails
-
- // Clears all buttons off the toolbars
- bool clearToolbars();
-
- void setToolBarsVisible(bool visible);
-
- static bool loadDefaultToolbars();
- static bool clearAllToolbars();
-
- static void startDragTool(S32 x, S32 y, LLToolBarButton* toolbarButton);
- static BOOL handleDragTool(S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type);
- static BOOL handleDropTool(void* cargo_data, S32 x, S32 y, LLToolBar* toolbar);
- static void resetDragTool(LLToolBarButton* toolbarButton);
- LLInventoryObject* getDragItem();
- LLView* getBottomToolbar() { return mBottomToolbarPanel; }
- LLToolBar* getToolbar(LLToolBarEnums::EToolBarLocation toolbar) { return mToolbars[toolbar]; }
- bool isModified() const;
-
+ // Xui structure of the toolbar panel
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> {};
+
+ // Note: valid children for LLToolBarView are stored in this registry
+ typedef LLDefaultChildRegistry child_registry_t;
+
+ // Xml structure of the toolbars.xml setting
+ // Those live in a toolbars.xml found in app_settings (for the default) and in
+ // the user folder for the user specific (saved) settings
+ struct Toolbar : public LLInitParam::Block<Toolbar>
+ {
+ Mandatory<LLToolBarEnums::ButtonType> button_display_mode;
+ Multiple<LLCommandId::Params> commands;
+
+ Toolbar();
+ };
+ struct ToolbarSet : public LLInitParam::Block<ToolbarSet>
+ {
+ Optional<Toolbar> left_toolbar,
+ right_toolbar,
+ bottom_toolbar;
+
+ ToolbarSet();
+ };
+
+ // Derived methods
+ virtual ~LLToolBarView();
+ virtual BOOL postBuild();
+ virtual void draw();
+
+ // Toolbar view interface with the rest of the world
+ // Checks if the commandId is being used somewhere in one of the toolbars, returns LLToolBarEnums::EToolBarLocation
+ S32 hasCommand(const LLCommandId& commandId) const;
+ S32 addCommand(const LLCommandId& commandId, LLToolBarEnums::EToolBarLocation toolbar, int rank = LLToolBar::RANK_NONE);
+ S32 removeCommand(const LLCommandId& commandId, int& rank); // Sets the rank the removed command was at, RANK_NONE if not found
+ S32 enableCommand(const LLCommandId& commandId, bool enabled);
+ S32 stopCommandInProgress(const LLCommandId& commandId);
+ S32 flashCommand(const LLCommandId& commandId, bool flash, bool force_flashing = false);
+
+ // Loads the toolbars from the existing user or default settings
+ bool loadToolbars(bool force_default = false); // return false if load fails
+
+ // Clears all buttons off the toolbars
+ bool clearToolbars();
+
+ void setToolBarsVisible(bool visible);
+
+ static bool loadDefaultToolbars();
+ static bool clearAllToolbars();
+
+ static void startDragTool(S32 x, S32 y, LLToolBarButton* toolbarButton);
+ static BOOL handleDragTool(S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type);
+ static BOOL handleDropTool(void* cargo_data, S32 x, S32 y, LLToolBar* toolbar);
+ static void resetDragTool(LLToolBarButton* toolbarButton);
+ LLInventoryObject* getDragItem();
+ LLView* getBottomToolbar() { return mBottomToolbarPanel; }
+ LLToolBar* getToolbar(LLToolBarEnums::EToolBarLocation toolbar) { return mToolbars[toolbar]; }
+ bool isModified() const;
+
protected:
- friend class LLUICtrlFactory;
- LLToolBarView(const Params&);
+ friend class LLUICtrlFactory;
+ LLToolBarView(const Params&);
- void initFromParams(const Params&);
+ void initFromParams(const Params&);
private:
- void saveToolbars() const;
- bool addCommandInternal(const LLCommandId& commandId, LLToolBar* toolbar);
- void addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const;
-
- static void onToolBarButtonAdded(LLView* button);
- static void onToolBarButtonRemoved(LLView* button);
-
- // Pointers to the toolbars handled by the toolbar view
- LLToolBar* mToolbars[LLToolBarEnums::TOOLBAR_COUNT];
- bool mToolbarsLoaded;
-
- bool mDragStarted;
- LLToolBarButton* mDragToolbarButton;
- LLInventoryObject* mDragItem;
- bool mShowToolbars;
- LLView* mBottomToolbarPanel;
+ void saveToolbars() const;
+ bool addCommandInternal(const LLCommandId& commandId, LLToolBar* toolbar);
+ void addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const;
+
+ static void onToolBarButtonAdded(LLView* button);
+ static void onToolBarButtonRemoved(LLView* button);
+
+ // Pointers to the toolbars handled by the toolbar view
+ LLToolBar* mToolbars[LLToolBarEnums::TOOLBAR_COUNT];
+ bool mToolbarsLoaded;
+
+ bool mDragStarted;
+ LLToolBarButton* mDragToolbarButton;
+ LLInventoryObject* mDragItem;
+ bool mShowToolbars;
+ LLView* mBottomToolbarPanel;
};
extern LLToolBarView* gToolBarView;
diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp
index 0a0bfaf58b..05ec09883d 100644
--- a/indra/newview/lltoolbrush.cpp
+++ b/indra/newview/lltoolbrush.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolbrush.cpp
* @brief Implementation of the toolbrushes
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,7 +56,7 @@
#include "llglheaders.h"
const std::string REGION_BLOCKS_TERRAFORM_MSG = "This region does not allow terraforming.\n"
- "You will need to buy land in another part of the world to terraform it.";
+ "You will need to buy land in another part of the world to terraform it.";
///============================================================================
@@ -68,13 +68,13 @@ const F32 LAND_BRUSH_SIZE[LAND_BRUSH_SIZE_COUNT] = {1.0f, 2.0f, 4.0f};
enum
{
- E_LAND_LEVEL = 0,
- E_LAND_RAISE = 1,
- E_LAND_LOWER = 2,
- E_LAND_SMOOTH = 3,
- E_LAND_NOISE = 4,
- E_LAND_REVERT = 5,
- E_LAND_INVALID = 6,
+ E_LAND_LEVEL = 0,
+ E_LAND_RAISE = 1,
+ E_LAND_LOWER = 2,
+ E_LAND_SMOOTH = 3,
+ E_LAND_NOISE = 4,
+ E_LAND_REVERT = 5,
+ E_LAND_INVALID = 6,
};
const LLColor4 OVERLAY_COLOR(1.0f, 1.0f, 1.0f, 1.0f);
@@ -84,417 +84,417 @@ const LLColor4 OVERLAY_COLOR(1.0f, 1.0f, 1.0f, 1.0f);
// constructor
LLToolBrushLand::LLToolBrushLand()
-: LLTool(std::string("Land")),
- mStartingZ( 0.0f ),
- mMouseX( 0 ),
- mMouseY(0),
- mGotHover(FALSE),
- mBrushSelected(FALSE)
+: LLTool(std::string("Land")),
+ mStartingZ( 0.0f ),
+ mMouseX( 0 ),
+ mMouseY(0),
+ mGotHover(FALSE),
+ mBrushSelected(FALSE)
{
- mBrushSize = gSavedSettings.getF32("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;
+ // 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,
- MASK mask)
+ MASK mask)
{
- S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
-
- mLastAffectedRegions.clear();
- determineAffectedRegions(mLastAffectedRegions, pos_global);
- for(region_list_t::iterator iter = mLastAffectedRegions.begin();
- iter != mLastAffectedRegions.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- //BOOL is_changed = FALSE;
- LLVector3 pos_region = regionp->getPosRegionFromGlobal(pos_global);
- LLSurface &land = regionp->getLand();
- char action = E_LAND_LEVEL;
- switch (radioAction)
- {
- case 0:
- // // average toward mStartingZ
- action = E_LAND_LEVEL;
- break;
- case 1:
- action = E_LAND_RAISE;
- break;
- case 2:
- action = E_LAND_LOWER;
- break;
- case 3:
- action = E_LAND_SMOOTH;
- break;
- case 4:
- action = E_LAND_NOISE;
- break;
- case 5:
- action = E_LAND_REVERT;
- break;
- default:
- action = E_LAND_INVALID;
- break;
- }
-
- // Don't send a message to the region if nothing changed.
- //if(!is_changed) continue;
-
- // Now to update the patch information so it will redraw correctly.
- LLSurfacePatch *patchp= land.resolvePatchRegion(pos_region);
- if (patchp)
- {
- patchp->dirtyZ();
- }
-
- // Also force the property lines to update, normals to recompute, etc.
- regionp->forceUpdate();
-
- // tell the simulator what we've done
- F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce");
- F32 x_pos = (F32)pos_region.mV[VX];
- F32 y_pos = (F32)pos_region.mV[VY];
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ModifyLand);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ModifyBlock);
- msg->addU8Fast(_PREHASH_Action, (U8)action);
- msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex());
- msg->addF32Fast(_PREHASH_Seconds, seconds);
- msg->addF32Fast(_PREHASH_Height, mStartingZ);
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, -1);
- msg->addF32Fast(_PREHASH_West, x_pos );
- 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());
- }
+ S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
+
+ mLastAffectedRegions.clear();
+ determineAffectedRegions(mLastAffectedRegions, pos_global);
+ for(region_list_t::iterator iter = mLastAffectedRegions.begin();
+ iter != mLastAffectedRegions.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ //BOOL is_changed = FALSE;
+ LLVector3 pos_region = regionp->getPosRegionFromGlobal(pos_global);
+ LLSurface &land = regionp->getLand();
+ char action = E_LAND_LEVEL;
+ switch (radioAction)
+ {
+ case 0:
+ // // average toward mStartingZ
+ action = E_LAND_LEVEL;
+ break;
+ case 1:
+ action = E_LAND_RAISE;
+ break;
+ case 2:
+ action = E_LAND_LOWER;
+ break;
+ case 3:
+ action = E_LAND_SMOOTH;
+ break;
+ case 4:
+ action = E_LAND_NOISE;
+ break;
+ case 5:
+ action = E_LAND_REVERT;
+ break;
+ default:
+ action = E_LAND_INVALID;
+ break;
+ }
+
+ // Don't send a message to the region if nothing changed.
+ //if(!is_changed) continue;
+
+ // Now to update the patch information so it will redraw correctly.
+ LLSurfacePatch *patchp= land.resolvePatchRegion(pos_region);
+ if (patchp)
+ {
+ patchp->dirtyZ();
+ }
+
+ // Also force the property lines to update, normals to recompute, etc.
+ regionp->forceUpdate();
+
+ // tell the simulator what we've done
+ F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce");
+ F32 x_pos = (F32)pos_region.mV[VX];
+ F32 y_pos = (F32)pos_region.mV[VY];
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ModifyLand);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ModifyBlock);
+ msg->addU8Fast(_PREHASH_Action, (U8)action);
+ msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex());
+ msg->addF32Fast(_PREHASH_Seconds, seconds);
+ msg->addF32Fast(_PREHASH_Height, mStartingZ);
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, -1);
+ msg->addF32Fast(_PREHASH_West, x_pos );
+ 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());
+ }
}
void LLToolBrushLand::modifyLandInSelectionGlobal()
{
- if (LLViewerParcelMgr::getInstance()->selectionEmpty())
- {
- return;
- }
-
- if (LLToolMgr::getInstance()->getCurrentTool() == LLToolSelectLand::getInstance())
- {
- // selecting land, don't do anything
- return;
- }
-
- LLVector3d min;
- LLVector3d max;
-
- LLViewerParcelMgr::getInstance()->getSelection(min, max);
-
- S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
-
- mLastAffectedRegions.clear();
-
- determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], min.mdV[VY], 0));
- determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], max.mdV[VY], 0));
- determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], min.mdV[VY], 0));
- determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], max.mdV[VY], 0));
-
- LLRegionPosition mid_point_region((min + max) * 0.5);
- LLViewerRegion* center_region = mid_point_region.getRegion();
- if (center_region)
- {
- LLVector3 pos_region = mid_point_region.getPositionRegion();
- U32 grids = center_region->getLand().mGridsPerEdge;
- S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids );
- S32 j = llclamp( (S32)pos_region.mV[VY], 0, (S32)grids );
- mStartingZ = center_region->getLand().getZ(i+j*grids);
- }
- else
- {
- mStartingZ = 0.f;
- }
-
- // Stop if our selection include a no-terraform region
- for(region_list_t::iterator iter = mLastAffectedRegions.begin();
- iter != mLastAffectedRegions.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if (!canTerraformRegion(regionp))
- {
- alertNoTerraformRegion(regionp);
- return;
- }
- }
-
- for(region_list_t::iterator iter = mLastAffectedRegions.begin();
- iter != mLastAffectedRegions.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- //BOOL is_changed = FALSE;
- LLVector3 min_region = regionp->getPosRegionFromGlobal(min);
- LLVector3 max_region = regionp->getPosRegionFromGlobal(max);
-
- min_region.clamp(0.f, regionp->getWidth());
- max_region.clamp(0.f, regionp->getWidth());
- F32 seconds = gSavedSettings.getF32("LandBrushForce");
-
- LLSurface &land = regionp->getLand();
- char action = E_LAND_LEVEL;
- switch (radioAction)
- {
- case 0:
- // // average toward mStartingZ
- action = E_LAND_LEVEL;
- seconds *= 0.25f;
- break;
- case 1:
- action = E_LAND_RAISE;
- seconds *= 0.25f;
- break;
- case 2:
- action = E_LAND_LOWER;
- seconds *= 0.25f;
- break;
- case 3:
- action = E_LAND_SMOOTH;
- seconds *= 5.0f;
- break;
- case 4:
- action = E_LAND_NOISE;
- seconds *= 0.5f;
- break;
- case 5:
- action = E_LAND_REVERT;
- seconds = 0.5f;
- break;
- default:
- //action = E_LAND_INVALID;
- //seconds = 0.0f;
- return;
- break;
- }
-
- // Don't send a message to the region if nothing changed.
- //if(!is_changed) continue;
-
- // Now to update the patch information so it will redraw correctly.
- LLSurfacePatch *patchp= land.resolvePatchRegion(min_region);
- if (patchp)
- {
- patchp->dirtyZ();
- }
-
- // Also force the property lines to update, normals to recompute, etc.
- regionp->forceUpdate();
-
- // tell the simulator what we've done
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ModifyLand);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ModifyBlock);
- msg->addU8Fast(_PREHASH_Action, (U8)action);
- msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex());
- msg->addF32Fast(_PREHASH_Seconds, seconds);
- msg->addF32Fast(_PREHASH_Height, mStartingZ);
-
- BOOL parcel_selected = LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected();
- LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
-
- if (parcel_selected && selected_parcel)
- {
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, selected_parcel->getLocalID());
- msg->addF32Fast(_PREHASH_West, min_region.mV[VX] );
- msg->addF32Fast(_PREHASH_South, min_region.mV[VY] );
- msg->addF32Fast(_PREHASH_East, max_region.mV[VX] );
- msg->addF32Fast(_PREHASH_North, max_region.mV[VY] );
- }
- else
- {
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, -1);
- msg->addF32Fast(_PREHASH_West, min_region.mV[VX] );
- msg->addF32Fast(_PREHASH_South, min_region.mV[VY] );
- 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());
- }
+ if (LLViewerParcelMgr::getInstance()->selectionEmpty())
+ {
+ return;
+ }
+
+ if (LLToolMgr::getInstance()->getCurrentTool() == LLToolSelectLand::getInstance())
+ {
+ // selecting land, don't do anything
+ return;
+ }
+
+ LLVector3d min;
+ LLVector3d max;
+
+ LLViewerParcelMgr::getInstance()->getSelection(min, max);
+
+ S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
+
+ mLastAffectedRegions.clear();
+
+ determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], min.mdV[VY], 0));
+ determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], max.mdV[VY], 0));
+ determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], min.mdV[VY], 0));
+ determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], max.mdV[VY], 0));
+
+ LLRegionPosition mid_point_region((min + max) * 0.5);
+ LLViewerRegion* center_region = mid_point_region.getRegion();
+ if (center_region)
+ {
+ LLVector3 pos_region = mid_point_region.getPositionRegion();
+ U32 grids = center_region->getLand().mGridsPerEdge;
+ S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids );
+ S32 j = llclamp( (S32)pos_region.mV[VY], 0, (S32)grids );
+ mStartingZ = center_region->getLand().getZ(i+j*grids);
+ }
+ else
+ {
+ mStartingZ = 0.f;
+ }
+
+ // Stop if our selection include a no-terraform region
+ for(region_list_t::iterator iter = mLastAffectedRegions.begin();
+ iter != mLastAffectedRegions.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if (!canTerraformRegion(regionp))
+ {
+ alertNoTerraformRegion(regionp);
+ return;
+ }
+ }
+
+ for(region_list_t::iterator iter = mLastAffectedRegions.begin();
+ iter != mLastAffectedRegions.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ //BOOL is_changed = FALSE;
+ LLVector3 min_region = regionp->getPosRegionFromGlobal(min);
+ LLVector3 max_region = regionp->getPosRegionFromGlobal(max);
+
+ min_region.clamp(0.f, regionp->getWidth());
+ max_region.clamp(0.f, regionp->getWidth());
+ F32 seconds = gSavedSettings.getF32("LandBrushForce");
+
+ LLSurface &land = regionp->getLand();
+ char action = E_LAND_LEVEL;
+ switch (radioAction)
+ {
+ case 0:
+ // // average toward mStartingZ
+ action = E_LAND_LEVEL;
+ seconds *= 0.25f;
+ break;
+ case 1:
+ action = E_LAND_RAISE;
+ seconds *= 0.25f;
+ break;
+ case 2:
+ action = E_LAND_LOWER;
+ seconds *= 0.25f;
+ break;
+ case 3:
+ action = E_LAND_SMOOTH;
+ seconds *= 5.0f;
+ break;
+ case 4:
+ action = E_LAND_NOISE;
+ seconds *= 0.5f;
+ break;
+ case 5:
+ action = E_LAND_REVERT;
+ seconds = 0.5f;
+ break;
+ default:
+ //action = E_LAND_INVALID;
+ //seconds = 0.0f;
+ return;
+ break;
+ }
+
+ // Don't send a message to the region if nothing changed.
+ //if(!is_changed) continue;
+
+ // Now to update the patch information so it will redraw correctly.
+ LLSurfacePatch *patchp= land.resolvePatchRegion(min_region);
+ if (patchp)
+ {
+ patchp->dirtyZ();
+ }
+
+ // Also force the property lines to update, normals to recompute, etc.
+ regionp->forceUpdate();
+
+ // tell the simulator what we've done
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ModifyLand);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ModifyBlock);
+ msg->addU8Fast(_PREHASH_Action, (U8)action);
+ msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex());
+ msg->addF32Fast(_PREHASH_Seconds, seconds);
+ msg->addF32Fast(_PREHASH_Height, mStartingZ);
+
+ BOOL parcel_selected = LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected();
+ LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+
+ if (parcel_selected && selected_parcel)
+ {
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, selected_parcel->getLocalID());
+ msg->addF32Fast(_PREHASH_West, min_region.mV[VX] );
+ msg->addF32Fast(_PREHASH_South, min_region.mV[VY] );
+ msg->addF32Fast(_PREHASH_East, max_region.mV[VX] );
+ msg->addF32Fast(_PREHASH_North, max_region.mV[VY] );
+ }
+ else
+ {
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, -1);
+ msg->addF32Fast(_PREHASH_West, min_region.mV[VX] );
+ msg->addF32Fast(_PREHASH_South, min_region.mV[VY] );
+ 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());
+ }
}
void LLToolBrushLand::brush( void )
{
- LLVector3d spot;
- if( gViewerWindow->mousePointOnLandGlobal( mMouseX, mMouseY, &spot ) )
- {
- // Round to nearest X,Y grid
- spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
- spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
-
- modifyLandAtPointGlobal(spot, gKeyboard->currentMask(TRUE));
- }
+ LLVector3d spot;
+ if( gViewerWindow->mousePointOnLandGlobal( mMouseX, mMouseY, &spot ) )
+ {
+ // Round to nearest X,Y grid
+ spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
+ spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
+
+ modifyLandAtPointGlobal(spot, gKeyboard->currentMask(TRUE));
+ }
}
BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
-
- // Find the z value of the initial click.
- LLVector3d spot;
- if( gViewerWindow->mousePointOnLandGlobal( x, y, &spot ) )
- {
- // Round to nearest X,Y grid
- spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
- spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
-
- LLRegionPosition region_position( spot );
- LLViewerRegion* regionp = region_position.getRegion();
-
- if (!canTerraformRegion(regionp))
- {
- alertNoTerraformRegion(regionp);
- return TRUE;
- }
-
- if (!canTerraformParcel(regionp))
- {
- alertNoTerraformParcel();
- }
-
- LLVector3 pos_region = region_position.getPositionRegion();
- U32 grids = regionp->getLand().mGridsPerEdge;
- S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids );
- S32 j = llclamp( (S32)pos_region.mV[VY], 0, (S32)grids );
- mStartingZ = regionp->getLand().getZ(i+j*grids);
- mMouseX = x;
- mMouseY = y;
- gIdleCallbacks.addFunction( &LLToolBrushLand::onIdle, (void*)this );
- setMouseCapture( TRUE );
-
- LLViewerParcelMgr::getInstance()->setSelectionVisible(FALSE);
- handled = TRUE;
- }
-
- return handled;
+ BOOL handled = FALSE;
+
+ // Find the z value of the initial click.
+ LLVector3d spot;
+ if( gViewerWindow->mousePointOnLandGlobal( x, y, &spot ) )
+ {
+ // Round to nearest X,Y grid
+ spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
+ spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
+
+ LLRegionPosition region_position( spot );
+ LLViewerRegion* regionp = region_position.getRegion();
+
+ if (!canTerraformRegion(regionp))
+ {
+ alertNoTerraformRegion(regionp);
+ return TRUE;
+ }
+
+ if (!canTerraformParcel(regionp))
+ {
+ alertNoTerraformParcel();
+ }
+
+ LLVector3 pos_region = region_position.getPositionRegion();
+ U32 grids = regionp->getLand().mGridsPerEdge;
+ S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids );
+ S32 j = llclamp( (S32)pos_region.mV[VY], 0, (S32)grids );
+ mStartingZ = regionp->getLand().getZ(i+j*grids);
+ mMouseX = x;
+ mMouseY = y;
+ gIdleCallbacks.addFunction( &LLToolBrushLand::onIdle, (void*)this );
+ setMouseCapture( TRUE );
+
+ LLViewerParcelMgr::getInstance()->setSelectionVisible(FALSE);
+ handled = TRUE;
+ }
+
+ return handled;
}
BOOL LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask )
{
- LL_DEBUGS("UserInput") << "hover handled by LLToolBrushLand ("
- << (hasMouseCapture() ? "active":"inactive")
- << ")" << LL_ENDL;
- mMouseX = x;
- mMouseY = y;
- mGotHover = TRUE;
- gViewerWindow->setCursor(UI_CURSOR_TOOLLAND);
-
- LLVector3d spot;
- if( gViewerWindow->mousePointOnLandGlobal( mMouseX, mMouseY, &spot ) )
- {
-
- spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
- spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
-
- LLViewerParcelMgr::getInstance()->setHoverParcel(spot);
- }
- return TRUE;
+ LL_DEBUGS("UserInput") << "hover handled by LLToolBrushLand ("
+ << (hasMouseCapture() ? "active":"inactive")
+ << ")" << LL_ENDL;
+ mMouseX = x;
+ mMouseY = y;
+ mGotHover = TRUE;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLLAND);
+
+ LLVector3d spot;
+ if( gViewerWindow->mousePointOnLandGlobal( mMouseX, mMouseY, &spot ) )
+ {
+
+ spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
+ spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
+
+ LLViewerParcelMgr::getInstance()->setHoverParcel(spot);
+ }
+ return TRUE;
}
BOOL LLToolBrushLand::handleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
- mLastAffectedRegions.clear();
- if( hasMouseCapture() )
- {
- // Release the mouse
- setMouseCapture( FALSE );
+ BOOL handled = FALSE;
+ mLastAffectedRegions.clear();
+ if( hasMouseCapture() )
+ {
+ // Release the mouse
+ setMouseCapture( FALSE );
- LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE);
+ LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE);
- gIdleCallbacks.deleteFunction( &LLToolBrushLand::onIdle, (void*)this );
- handled = TRUE;
- }
+ gIdleCallbacks.deleteFunction( &LLToolBrushLand::onIdle, (void*)this );
+ handled = TRUE;
+ }
- return handled;
+ return handled;
}
void LLToolBrushLand::handleSelect()
{
- gEditMenuHandler = this;
+ gEditMenuHandler = this;
- gFloaterTools->setStatusText("modifyland");
-// if (!mBrushSelected)
- {
- mBrushSelected = TRUE;
- }
+ gFloaterTools->setStatusText("modifyland");
+// if (!mBrushSelected)
+ {
+ mBrushSelected = TRUE;
+ }
}
void LLToolBrushLand::handleDeselect()
{
- if( gEditMenuHandler == this )
- {
- gEditMenuHandler = NULL;
- }
- LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE);
- mBrushSelected = FALSE;
+ if( gEditMenuHandler == this )
+ {
+ gEditMenuHandler = NULL;
+ }
+ LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE);
+ mBrushSelected = FALSE;
}
// Draw the area that will be affected.
void LLToolBrushLand::render()
{
- if(mGotHover)
- {
- //LL_INFOS() << "LLToolBrushLand::render()" << LL_ENDL;
- LLVector3d spot;
- if(gViewerWindow->mousePointOnLandGlobal(mMouseX, mMouseY, &spot))
- {
- spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
- spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
-
- mBrushSize = gSavedSettings.getF32("LandBrushSize");
-
- region_list_t regions;
- determineAffectedRegions(regions, spot);
-
- // Now, for each region, render the overlay
- LLVector3 pos_world = gAgent.getRegion()->getPosRegionFromGlobal(spot);
- for(region_list_t::iterator iter = regions.begin();
- iter != regions.end(); ++iter)
- {
- LLViewerRegion* region = *iter;
- renderOverlay(region->getLand(),
- region->getPosRegionFromGlobal(spot),
- pos_world);
- }
- }
- mGotHover = FALSE;
- }
+ if(mGotHover)
+ {
+ //LL_INFOS() << "LLToolBrushLand::render()" << LL_ENDL;
+ LLVector3d spot;
+ if(gViewerWindow->mousePointOnLandGlobal(mMouseX, mMouseY, &spot))
+ {
+ spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
+ spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
+
+ mBrushSize = gSavedSettings.getF32("LandBrushSize");
+
+ region_list_t regions;
+ determineAffectedRegions(regions, spot);
+
+ // Now, for each region, render the overlay
+ LLVector3 pos_world = gAgent.getRegion()->getPosRegionFromGlobal(spot);
+ for(region_list_t::iterator iter = regions.begin();
+ iter != regions.end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+ renderOverlay(region->getLand(),
+ region->getPosRegionFromGlobal(spot),
+ pos_world);
+ }
+ }
+ mGotHover = FALSE;
+ }
}
/*
@@ -502,214 +502,214 @@ void LLToolBrushLand::render()
* with lengths indicating the current "strength" slider.
* Decorate the tops and bottoms of the lines like this:
*
- * Raise Revert
- * /|\ ___
- * | |
- * | |
+ * Raise Revert
+ * /|\ ___
+ * | |
+ * | |
*
- * Rough Smooth
- * /|\ ___
- * | |
- * | |
- * \|/..........._|_
+ * Rough Smooth
+ * /|\ ___
+ * | |
+ * | |
+ * \|/..........._|_
*
- * Lower Flatten
- * | |
- * | |
- * \|/..........._|_
+ * Lower Flatten
+ * | |
+ * | |
+ * \|/..........._|_
*/
void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region,
- const LLVector3& pos_world)
+ const LLVector3& pos_world)
{
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest mDepthTest(GL_TRUE);
- gGL.pushMatrix();
- gGL.color4fv(OVERLAY_COLOR.mV);
- gGL.translatef(0.0f, 0.0f, 1.0f);
-
- S32 i = (S32) pos_region.mV[VX];
- S32 j = (S32) pos_region.mV[VY];
- S32 half_edge = llfloor(mBrushSize);
- S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
- F32 force = gSavedSettings.getF32("LandBrushForce"); // .1 to 100?
-
- gGL.begin(LLRender::LINES);
- for(S32 di = -half_edge; di <= half_edge; di++)
- {
- if((i+di) < 0 || (i+di) >= (S32)land.mGridsPerEdge) continue;
- for(S32 dj = -half_edge; dj <= half_edge; dj++)
- {
- if( (j+dj) < 0 || (j+dj) >= (S32)land.mGridsPerEdge ) continue;
- const F32
- wx = pos_world.mV[VX] + di,
- wy = pos_world.mV[VY] + dj,
- wz = land.getZ((i+di)+(j+dj)*land.mGridsPerEdge),
- norm_dist = sqrt((float)di*di + dj*dj) / half_edge,
- force_scale = sqrt(2.f) - norm_dist, // 1 at center, 0 at corner
- wz2 = wz + .2 + (.2 + force/100) * force_scale, // top vertex
- tic = .075f; // arrowhead size
- // vertical line
- gGL.vertex3f(wx, wy, wz);
- gGL.vertex3f(wx, wy, wz2);
- if(radioAction == E_LAND_RAISE || radioAction == E_LAND_NOISE) // up arrow
- {
- gGL.vertex3f(wx, wy, wz2);
- gGL.vertex3f(wx+tic, wy, wz2-tic);
- gGL.vertex3f(wx, wy, wz2);
- gGL.vertex3f(wx-tic, wy, wz2-tic);
- }
- if(radioAction == E_LAND_LOWER || radioAction == E_LAND_NOISE) // down arrow
- {
- gGL.vertex3f(wx, wy, wz);
- gGL.vertex3f(wx+tic, wy, wz+tic);
- gGL.vertex3f(wx, wy, wz);
- gGL.vertex3f(wx-tic, wy, wz+tic);
- }
- if(radioAction == E_LAND_REVERT || radioAction == E_LAND_SMOOTH) // flat top
- {
- gGL.vertex3f(wx-tic, wy, wz2);
- gGL.vertex3f(wx+tic, wy, wz2);
- }
- if(radioAction == E_LAND_LEVEL || radioAction == E_LAND_SMOOTH) // flat bottom
- {
- gGL.vertex3f(wx-tic, wy, wz);
- gGL.vertex3f(wx+tic, wy, wz);
- }
- }
- }
- gGL.end();
-
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest mDepthTest(GL_TRUE);
+ gGL.pushMatrix();
+ gGL.color4fv(OVERLAY_COLOR.mV);
+ gGL.translatef(0.0f, 0.0f, 1.0f);
+
+ S32 i = (S32) pos_region.mV[VX];
+ S32 j = (S32) pos_region.mV[VY];
+ S32 half_edge = llfloor(mBrushSize);
+ S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
+ F32 force = gSavedSettings.getF32("LandBrushForce"); // .1 to 100?
+
+ gGL.begin(LLRender::LINES);
+ for(S32 di = -half_edge; di <= half_edge; di++)
+ {
+ if((i+di) < 0 || (i+di) >= (S32)land.mGridsPerEdge) continue;
+ for(S32 dj = -half_edge; dj <= half_edge; dj++)
+ {
+ if( (j+dj) < 0 || (j+dj) >= (S32)land.mGridsPerEdge ) continue;
+ const F32
+ wx = pos_world.mV[VX] + di,
+ wy = pos_world.mV[VY] + dj,
+ wz = land.getZ((i+di)+(j+dj)*land.mGridsPerEdge),
+ norm_dist = sqrt((float)di*di + dj*dj) / half_edge,
+ force_scale = sqrt(2.f) - norm_dist, // 1 at center, 0 at corner
+ wz2 = wz + .2 + (.2 + force/100) * force_scale, // top vertex
+ tic = .075f; // arrowhead size
+ // vertical line
+ gGL.vertex3f(wx, wy, wz);
+ gGL.vertex3f(wx, wy, wz2);
+ if(radioAction == E_LAND_RAISE || radioAction == E_LAND_NOISE) // up arrow
+ {
+ gGL.vertex3f(wx, wy, wz2);
+ gGL.vertex3f(wx+tic, wy, wz2-tic);
+ gGL.vertex3f(wx, wy, wz2);
+ gGL.vertex3f(wx-tic, wy, wz2-tic);
+ }
+ if(radioAction == E_LAND_LOWER || radioAction == E_LAND_NOISE) // down arrow
+ {
+ gGL.vertex3f(wx, wy, wz);
+ gGL.vertex3f(wx+tic, wy, wz+tic);
+ gGL.vertex3f(wx, wy, wz);
+ gGL.vertex3f(wx-tic, wy, wz+tic);
+ }
+ if(radioAction == E_LAND_REVERT || radioAction == E_LAND_SMOOTH) // flat top
+ {
+ gGL.vertex3f(wx-tic, wy, wz2);
+ gGL.vertex3f(wx+tic, wy, wz2);
+ }
+ if(radioAction == E_LAND_LEVEL || radioAction == E_LAND_SMOOTH) // flat bottom
+ {
+ gGL.vertex3f(wx-tic, wy, wz);
+ gGL.vertex3f(wx+tic, wy, wz);
+ }
+ }
+ }
+ gGL.end();
+
+ gGL.popMatrix();
}
void LLToolBrushLand::determineAffectedRegions(region_list_t& regions,
- const LLVector3d& spot ) const
+ const LLVector3d& spot ) const
{
- LLVector3d corner(spot);
- 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] += mBrushSize;
- region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
- if(region && regions.find(region) == regions.end())
- {
- regions.insert(region);
- }
- corner.mdV[VX] += mBrushSize;
- region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
- if(region && regions.find(region) == regions.end())
- {
- regions.insert(region);
- }
- corner.mdV[VY] -= mBrushSize;
- region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
- if(region && regions.find(region) == regions.end())
- {
- regions.insert(region);
- }
+ LLVector3d corner(spot);
+ 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] += mBrushSize;
+ region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
+ if(region && regions.find(region) == regions.end())
+ {
+ regions.insert(region);
+ }
+ corner.mdV[VX] += mBrushSize;
+ region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
+ if(region && regions.find(region) == regions.end())
+ {
+ regions.insert(region);
+ }
+ corner.mdV[VY] -= mBrushSize;
+ region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
+ if(region && regions.find(region) == regions.end())
+ {
+ regions.insert(region);
+ }
}
// static
void LLToolBrushLand::onIdle( void* brush_tool )
{
- LLToolBrushLand* self = reinterpret_cast<LLToolBrushLand*>(brush_tool);
-
- if( LLToolMgr::getInstance()->getCurrentTool() == self )
- {
- self->brush();
- }
- else
- {
- gIdleCallbacks.deleteFunction( &LLToolBrushLand::onIdle, self );
- }
+ LLToolBrushLand* self = reinterpret_cast<LLToolBrushLand*>(brush_tool);
+
+ if( LLToolMgr::getInstance()->getCurrentTool() == self )
+ {
+ self->brush();
+ }
+ else
+ {
+ gIdleCallbacks.deleteFunction( &LLToolBrushLand::onIdle, self );
+ }
}
void LLToolBrushLand::onMouseCaptureLost()
{
- gIdleCallbacks.deleteFunction(&LLToolBrushLand::onIdle, this);
+ gIdleCallbacks.deleteFunction(&LLToolBrushLand::onIdle, this);
}
// static
void LLToolBrushLand::undo()
{
- for(region_list_t::iterator iter = mLastAffectedRegions.begin();
- iter != mLastAffectedRegions.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- gMessageSystem->newMessageFast(_PREHASH_UndoLand);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->sendMessage(regionp->getHost());
- }
+ for(region_list_t::iterator iter = mLastAffectedRegions.begin();
+ iter != mLastAffectedRegions.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ gMessageSystem->newMessageFast(_PREHASH_UndoLand);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->sendMessage(regionp->getHost());
+ }
}
// static
/*
void LLToolBrushLand::redo()
{
- for(region_list_t::iterator iter = mLastAffectedRegions.begin();
- iter != mLastAffectedRegions.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- gMessageSystem->newMessageFast(_PREHASH_RedoLand);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->sendMessage(regionp->getHost());
- }
+ for(region_list_t::iterator iter = mLastAffectedRegions.begin();
+ iter != mLastAffectedRegions.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ gMessageSystem->newMessageFast(_PREHASH_RedoLand);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->sendMessage(regionp->getHost());
+ }
}*/
// static
bool LLToolBrushLand::canTerraformRegion(LLViewerRegion* regionp) const
{
- if (!regionp) return false;
- if (regionp->canManageEstate()) return true;
- return !regionp->getRegionFlag(REGION_FLAGS_BLOCK_TERRAFORM);
+ if (!regionp) return false;
+ if (regionp->canManageEstate()) return true;
+ return !regionp->getRegionFlag(REGION_FLAGS_BLOCK_TERRAFORM);
}
// static
bool LLToolBrushLand::canTerraformParcel(LLViewerRegion* regionp) const
{
- LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
- bool is_terraform_allowed = false;
- if (selected_parcel)
- {
- BOOL owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(selected_parcel, GP_LAND_ALLOW_EDIT_LAND);
- is_terraform_allowed = ( gAgent.canManageEstate() || (selected_parcel->getOwnerID() == regionp->getOwner()) || owner_release);
- }
-
- return is_terraform_allowed;
+ LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
+ bool is_terraform_allowed = false;
+ if (selected_parcel)
+ {
+ BOOL owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(selected_parcel, GP_LAND_ALLOW_EDIT_LAND);
+ is_terraform_allowed = ( gAgent.canManageEstate() || (selected_parcel->getOwnerID() == regionp->getOwner()) || owner_release);
+ }
+
+ return is_terraform_allowed;
}
// static
void LLToolBrushLand::alertNoTerraformRegion(LLViewerRegion* regionp)
{
- if (!regionp) return;
-
- LLSD args;
- args["REGION"] = regionp->getName();
- LLNotificationsUtil::add("RegionNoTerraforming", args);
+ if (!regionp) return;
+
+ LLSD args;
+ args["REGION"] = regionp->getName();
+ LLNotificationsUtil::add("RegionNoTerraforming", args);
}
// static
void LLToolBrushLand::alertNoTerraformParcel()
{
- LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
- if (selected_parcel)
- {
- LLSD args;
- args["PARCEL"] = selected_parcel->getName();
- LLNotificationsUtil::add("ParcelNoTerraforming", args);
- }
+ LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
+ if (selected_parcel)
+ {
+ LLSD args;
+ args["PARCEL"] = selected_parcel->getName();
+ LLNotificationsUtil::add("ParcelNoTerraforming", args);
+ }
}
diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h
index 6545ee3611..4dc70d8a5e 100644
--- a/indra/newview/lltoolbrush.h
+++ b/indra/newview/lltoolbrush.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolbrush.h
* @brief toolbrush class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,65 +43,65 @@ class LLViewerRegion;
class LLToolBrushLand : public LLTool, public LLEditMenuHandler, public LLSingleton<LLToolBrushLand>
{
- LLSINGLETON(LLToolBrushLand);
- typedef std::set<LLViewerRegion*> region_list_t;
+ LLSINGLETON(LLToolBrushLand);
+ typedef std::set<LLViewerRegion*> region_list_t;
public:
-
- // x,y in window coords, 0,0 = left,bot
- virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ) override;
- virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ) override;
- virtual BOOL handleHover( S32 x, S32 y, MASK mask ) override;
- virtual void handleSelect() override;
- virtual void handleDeselect() override;
- // isAlwaysRendered() - return true if this is a tool that should
- // always be rendered regardless of selection.
- virtual BOOL isAlwaysRendered() override { return TRUE; }
+ // x,y in window coords, 0,0 = left,bot
+ virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ) override;
+ virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ) override;
+ virtual BOOL handleHover( S32 x, S32 y, MASK mask ) override;
+ virtual void handleSelect() override;
+ virtual void handleDeselect() override;
+
+ // isAlwaysRendered() - return true if this is a tool that should
+ // always be rendered regardless of selection.
+ virtual BOOL isAlwaysRendered() override { return TRUE; }
- // Draw the area that will be affected.
- virtual void render() override;
+ // Draw the area that will be affected.
+ virtual void render() override;
- // on Idle is where the land modification actually occurs
- static void onIdle(void* brush_tool);
+ // on Idle is where the land modification actually occurs
+ static void onIdle(void* brush_tool);
- void onMouseCaptureLost() override;
+ void onMouseCaptureLost() override;
- void modifyLandInSelectionGlobal();
- virtual void undo() override;
- virtual BOOL canUndo() const override { return TRUE; }
+ void modifyLandInSelectionGlobal();
+ virtual void undo() override;
+ virtual BOOL canUndo() const override { return TRUE; }
protected:
- void brush( void );
- void modifyLandAtPointGlobal( const LLVector3d &spot, MASK mask );
+ void brush( void );
+ void modifyLandAtPointGlobal( const LLVector3d &spot, MASK mask );
- void determineAffectedRegions(region_list_t& regions,
- const LLVector3d& spot) const;
- void renderOverlay(LLSurface& land, const LLVector3& pos_region,
- const LLVector3& pos_world);
+ void determineAffectedRegions(region_list_t& regions,
+ const LLVector3d& spot) const;
+ void renderOverlay(LLSurface& land, const LLVector3& pos_region,
+ const LLVector3& pos_world);
- // Does region allow terraform, or are we a god?
- bool canTerraformRegion(LLViewerRegion* regionp) const;
+ // Does region allow terraform, or are we a god?
+ bool canTerraformRegion(LLViewerRegion* regionp) const;
- bool canTerraformParcel(LLViewerRegion* regionp) const;
+ bool canTerraformParcel(LLViewerRegion* regionp) const;
- // Modal dialog that you can't terraform the region
- void alertNoTerraformRegion(LLViewerRegion* regionp);
+ // Modal dialog that you can't terraform the region
+ void alertNoTerraformRegion(LLViewerRegion* regionp);
- void alertNoTerraformParcel();
+ void alertNoTerraformParcel();
protected:
- F32 mStartingZ;
- S32 mMouseX;
- S32 mMouseY;
- 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;
+ F32 mStartingZ;
+ S32 mMouseX;
+ S32 mMouseY;
+ 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();
+ U8 getBrushIndex();
};
diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp
index aaf2bacc7b..1060d79641 100644
--- a/indra/newview/lltoolcomp.cpp
+++ b/indra/newview/lltoolcomp.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolcomp.cpp
* @brief Composite tools
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,7 +36,7 @@
#include "llmaniprotate.h"
#include "llmanipscale.h"
#include "llmaniptranslate.h"
-#include "llmenugl.h" // for right-click menu hack
+#include "llmenugl.h" // for right-click menu hack
#include "llselectmgr.h"
#include "lltoolfocus.h"
#include "lltoolgrab.h"
@@ -56,7 +56,7 @@
extern LLControlGroup gSavedSettings;
// we use this in various places instead of NULL
-static LLPointer<LLTool> sNullTool(new LLTool(std::string("null"), NULL));
+static LLPointer<LLTool> sNullTool(new LLTool(std::string("null"), NULL));
//-----------------------------------------------------------------------
// LLToolComposite
@@ -64,68 +64,68 @@ static LLPointer<LLTool> sNullTool(new LLTool(std::string("null"), NULL));
//static
void LLToolComposite::setCurrentTool( LLTool* new_tool )
{
- if( mCur != new_tool )
- {
- if( mSelected )
- {
- mCur->handleDeselect();
- mCur = new_tool;
- mCur->handleSelect();
- }
- else
- {
- mCur = new_tool;
- }
- }
+ if( mCur != new_tool )
+ {
+ if( mSelected )
+ {
+ mCur->handleDeselect();
+ mCur = new_tool;
+ mCur->handleSelect();
+ }
+ else
+ {
+ mCur = new_tool;
+ }
+ }
}
LLToolComposite::LLToolComposite(const std::string& name)
- : LLTool(name),
- mCur(sNullTool),
- mDefault(sNullTool),
- mSelected(FALSE),
- mMouseDown(FALSE), mManip(NULL), mSelectRect(NULL)
+ : LLTool(name),
+ mCur(sNullTool),
+ mDefault(sNullTool),
+ mSelected(FALSE),
+ mMouseDown(FALSE), mManip(NULL), mSelectRect(NULL)
{
}
// Returns to the default tool
BOOL LLToolComposite::handleMouseUp(S32 x, S32 y, MASK mask)
-{
- BOOL handled = mCur->handleMouseUp( x, y, mask );
- if( handled )
- {
- setCurrentTool( mDefault );
- }
+{
+ BOOL handled = mCur->handleMouseUp( x, y, mask );
+ if( handled )
+ {
+ setCurrentTool( mDefault );
+ }
return handled;
}
void LLToolComposite::onMouseCaptureLost()
{
- mCur->onMouseCaptureLost();
- setCurrentTool( mDefault );
+ mCur->onMouseCaptureLost();
+ setCurrentTool( mDefault );
}
BOOL LLToolComposite::isSelecting()
-{
- return mCur == mSelectRect;
+{
+ return mCur == mSelectRect;
}
void LLToolComposite::handleSelect()
{
- if (!gSavedSettings.getBOOL("EditLinkedParts"))
- {
- LLSelectMgr::getInstance()->promoteSelectionToRoot();
- }
- mCur = mDefault;
- mCur->handleSelect();
- mSelected = TRUE;
+ if (!gSavedSettings.getBOOL("EditLinkedParts"))
+ {
+ LLSelectMgr::getInstance()->promoteSelectionToRoot();
+ }
+ mCur = mDefault;
+ mCur->handleSelect();
+ mSelected = TRUE;
}
void LLToolComposite::handleDeselect()
{
- mCur->handleDeselect();
- mCur = mDefault;
- mSelected = FALSE;
+ mCur->handleDeselect();
+ mCur = mDefault;
+ mSelected = FALSE;
}
//----------------------------------------------------------------------------
@@ -136,100 +136,100 @@ LLToolCompInspect::LLToolCompInspect()
: LLToolComposite(std::string("Inspect")),
mIsToolCameraActive(FALSE)
{
- mSelectRect = new LLToolSelectRect(this);
- mDefault = mSelectRect;
+ mSelectRect = new LLToolSelectRect(this);
+ mDefault = mSelectRect;
}
LLToolCompInspect::~LLToolCompInspect()
{
- delete mSelectRect;
- mSelectRect = NULL;
+ delete mSelectRect;
+ mSelectRect = NULL;
}
BOOL LLToolCompInspect::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
+ BOOL handled = FALSE;
- if (mCur == LLToolCamera::getInstance())
- {
- handled = mCur->handleMouseDown(x, y, mask);
- }
- else
- {
- mMouseDown = TRUE;
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
- handled = TRUE;
- }
+ if (mCur == LLToolCamera::getInstance())
+ {
+ handled = mCur->handleMouseDown(x, y, mask);
+ }
+ else
+ {
+ mMouseDown = TRUE;
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ handled = TRUE;
+ }
- return handled;
+ return handled;
}
BOOL LLToolCompInspect::handleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLToolComposite::handleMouseUp(x, y, mask);
- mIsToolCameraActive = getCurrentTool() == LLToolCamera::getInstance();
- return handled;
+ BOOL handled = LLToolComposite::handleMouseUp(x, y, mask);
+ mIsToolCameraActive = getCurrentTool() == LLToolCamera::getInstance();
+ return handled;
}
void LLToolCompInspect::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = pick_info.getObject();
- LLToolCompInspect * tool_inspectp = LLToolCompInspect::getInstance();
+ LLViewerObject* hit_obj = pick_info.getObject();
+ LLToolCompInspect * tool_inspectp = LLToolCompInspect::getInstance();
- if (!tool_inspectp->mMouseDown)
- {
- // fast click on object, but mouse is already up...just do select
- tool_inspectp->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
- return;
- }
+ if (!tool_inspectp->mMouseDown)
+ {
+ // fast click on object, but mouse is already up...just do select
+ tool_inspectp->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
+ return;
+ }
- LLSelectMgr * mgr_selectp = LLSelectMgr::getInstance();
- if( hit_obj && mgr_selectp->getSelection()->getObjectCount()) {
- LLEditMenuHandler::gEditMenuHandler = mgr_selectp;
- }
+ LLSelectMgr * mgr_selectp = LLSelectMgr::getInstance();
+ if( hit_obj && mgr_selectp->getSelection()->getObjectCount()) {
+ LLEditMenuHandler::gEditMenuHandler = mgr_selectp;
+ }
- tool_inspectp->setCurrentTool( tool_inspectp->mSelectRect );
- tool_inspectp->mIsToolCameraActive = FALSE;
- tool_inspectp->mSelectRect->handlePick( pick_info );
+ tool_inspectp->setCurrentTool( tool_inspectp->mSelectRect );
+ tool_inspectp->mIsToolCameraActive = FALSE;
+ tool_inspectp->mSelectRect->handlePick( pick_info );
}
BOOL LLToolCompInspect::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- return TRUE;
+ return TRUE;
}
BOOL LLToolCompInspect::handleKey(KEY key, MASK mask)
{
- BOOL handled = FALSE;
+ BOOL handled = FALSE;
- if(KEY_ALT == key)
- {
- setCurrentTool(LLToolCamera::getInstance());
- mIsToolCameraActive = TRUE;
- handled = TRUE;
- }
- else
- {
- handled = LLToolComposite::handleKey(key, mask);
- }
+ if(KEY_ALT == key)
+ {
+ setCurrentTool(LLToolCamera::getInstance());
+ mIsToolCameraActive = TRUE;
+ handled = TRUE;
+ }
+ else
+ {
+ handled = LLToolComposite::handleKey(key, mask);
+ }
- return handled;
+ return handled;
}
void LLToolCompInspect::onMouseCaptureLost()
{
- LLToolComposite::onMouseCaptureLost();
- mIsToolCameraActive = FALSE;
+ LLToolComposite::onMouseCaptureLost();
+ mIsToolCameraActive = FALSE;
}
void LLToolCompInspect::keyUp(KEY key, MASK mask)
{
- if (KEY_ALT == key && mCur == LLToolCamera::getInstance())
- {
- setCurrentTool(mDefault);
- mIsToolCameraActive = FALSE;
- }
+ if (KEY_ALT == key && mCur == LLToolCamera::getInstance())
+ {
+ setCurrentTool(mDefault);
+ mIsToolCameraActive = FALSE;
+ }
}
//----------------------------------------------------------------------------
@@ -237,129 +237,129 @@ void LLToolCompInspect::keyUp(KEY key, MASK mask)
//----------------------------------------------------------------------------
LLToolCompTranslate::LLToolCompTranslate()
- : LLToolComposite(std::string("Move"))
+ : LLToolComposite(std::string("Move"))
{
- mManip = new LLManipTranslate(this);
- mSelectRect = new LLToolSelectRect(this);
+ mManip = new LLManipTranslate(this);
+ mSelectRect = new LLToolSelectRect(this);
- mCur = mManip;
- mDefault = mManip;
+ mCur = mManip;
+ mDefault = mManip;
}
LLToolCompTranslate::~LLToolCompTranslate()
{
- delete mManip;
- mManip = NULL;
+ delete mManip;
+ mManip = NULL;
- delete mSelectRect;
- mSelectRect = NULL;
+ delete mSelectRect;
+ mSelectRect = NULL;
}
BOOL LLToolCompTranslate::handleHover(S32 x, S32 y, MASK mask)
{
- if( !mCur->hasMouseCapture() )
- {
- setCurrentTool( mManip );
- }
- return mCur->handleHover( x, y, mask );
+ if( !mCur->hasMouseCapture() )
+ {
+ setCurrentTool( mManip );
+ }
+ return mCur->handleHover( x, y, mask );
}
BOOL LLToolCompTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
{
- mMouseDown = TRUE;
+ mMouseDown = TRUE;
gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ FALSE, LLFloaterReg::instanceVisible("build"), FALSE,
gSavedSettings.getBOOL("SelectReflectionProbes"));;
- return TRUE;
+ return TRUE;
}
void LLToolCompTranslate::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = pick_info.getObject();
-
- LLToolCompTranslate::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
- if (!LLToolCompTranslate::getInstance()->mMouseDown)
- {
- // fast click on object, but mouse is already up...just do select
- LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
- return;
- }
-
- if( hit_obj || LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART )
- {
- if (LLToolCompTranslate::getInstance()->mManip->getSelection()->getObjectCount())
- {
- LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
- }
-
- BOOL can_move = LLToolCompTranslate::getInstance()->mManip->canAffectSelection();
-
- if( LLManip::LL_NO_PART != LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() && can_move)
- {
- LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mManip );
- LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
- }
- else
- {
- LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
- LLToolCompTranslate::getInstance()->mSelectRect->handlePick( pick_info );
-
- // *TODO: add toggle to trigger old click-drag functionality
- // LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( XY_part, x, y, mask);
- }
- }
- else
- {
- LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
- LLToolCompTranslate::getInstance()->mSelectRect->handlePick( pick_info );
- }
+ LLViewerObject* hit_obj = pick_info.getObject();
+
+ LLToolCompTranslate::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
+ if (!LLToolCompTranslate::getInstance()->mMouseDown)
+ {
+ // fast click on object, but mouse is already up...just do select
+ LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
+ return;
+ }
+
+ if( hit_obj || LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART )
+ {
+ if (LLToolCompTranslate::getInstance()->mManip->getSelection()->getObjectCount())
+ {
+ LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
+ }
+
+ BOOL can_move = LLToolCompTranslate::getInstance()->mManip->canAffectSelection();
+
+ if( LLManip::LL_NO_PART != LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() && can_move)
+ {
+ LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mManip );
+ LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
+ }
+ else
+ {
+ LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
+ LLToolCompTranslate::getInstance()->mSelectRect->handlePick( pick_info );
+
+ // *TODO: add toggle to trigger old click-drag functionality
+ // LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( XY_part, x, y, mask);
+ }
+ }
+ else
+ {
+ LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect );
+ LLToolCompTranslate::getInstance()->mSelectRect->handlePick( pick_info );
+ }
}
BOOL LLToolCompTranslate::handleMouseUp(S32 x, S32 y, MASK mask)
{
- mMouseDown = FALSE;
- return LLToolComposite::handleMouseUp(x, y, mask);
+ mMouseDown = FALSE;
+ return LLToolComposite::handleMouseUp(x, y, mask);
}
LLTool* LLToolCompTranslate::getOverrideTool(MASK mask)
{
- if (mask == MASK_CONTROL)
- {
- return LLToolCompRotate::getInstance();
- }
- else if (mask == (MASK_CONTROL | MASK_SHIFT))
- {
- return LLToolCompScale::getInstance();
- }
- return LLToolComposite::getOverrideTool(mask);
+ if (mask == MASK_CONTROL)
+ {
+ return LLToolCompRotate::getInstance();
+ }
+ else if (mask == (MASK_CONTROL | MASK_SHIFT))
+ {
+ return LLToolCompScale::getInstance();
+ }
+ return LLToolComposite::getOverrideTool(mask);
}
BOOL LLToolCompTranslate::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- if (mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
- {
- // You should already have an object selected from the mousedown.
- // If so, show its properties
- LLFloaterReg::showInstance("build", "Content");
- return TRUE;
- }
- // Nothing selected means the first mouse click was probably
- // bad, so try again.
- // This also consumes the event to prevent things like double-click
- // teleport from triggering.
- return handleMouseDown(x, y, mask);
+ if (mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
+ {
+ // You should already have an object selected from the mousedown.
+ // If so, show its properties
+ LLFloaterReg::showInstance("build", "Content");
+ return TRUE;
+ }
+ // Nothing selected means the first mouse click was probably
+ // bad, so try again.
+ // This also consumes the event to prevent things like double-click
+ // teleport from triggering.
+ return handleMouseDown(x, y, mask);
}
void LLToolCompTranslate::render()
{
- mCur->render(); // removing this will not draw the RGB arrows and guidelines
+ mCur->render(); // removing this will not draw the RGB arrows and guidelines
- if( mCur != mManip )
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- mManip->renderGuidelines();
- }
+ if( mCur != mManip )
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ mManip->renderGuidelines();
+ }
}
@@ -367,316 +367,316 @@ void LLToolCompTranslate::render()
// LLToolCompScale
LLToolCompScale::LLToolCompScale()
- : LLToolComposite(std::string("Stretch"))
+ : LLToolComposite(std::string("Stretch"))
{
- mManip = new LLManipScale(this);
- mSelectRect = new LLToolSelectRect(this);
+ mManip = new LLManipScale(this);
+ mSelectRect = new LLToolSelectRect(this);
- mCur = mManip;
- mDefault = mManip;
+ mCur = mManip;
+ mDefault = mManip;
}
LLToolCompScale::~LLToolCompScale()
{
- delete mManip;
- delete mSelectRect;
+ delete mManip;
+ delete mSelectRect;
}
BOOL LLToolCompScale::handleHover(S32 x, S32 y, MASK mask)
{
- if( !mCur->hasMouseCapture() )
- {
- setCurrentTool(mManip );
- }
- return mCur->handleHover( x, y, mask );
+ if( !mCur->hasMouseCapture() )
+ {
+ setCurrentTool(mManip );
+ }
+ return mCur->handleHover( x, y, mask );
}
BOOL LLToolCompScale::handleMouseDown(S32 x, S32 y, MASK mask)
{
- mMouseDown = TRUE;
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
- return TRUE;
+ mMouseDown = TRUE;
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ return TRUE;
}
void LLToolCompScale::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = pick_info.getObject();
-
- LLToolCompScale::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
- if (!LLToolCompScale::getInstance()->mMouseDown)
- {
- // fast click on object, but mouse is already up...just do select
- LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
-
- return;
- }
-
- if( hit_obj || LLToolCompScale::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
- {
- if (LLToolCompScale::getInstance()->mManip->getSelection()->getObjectCount())
- {
- LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
- }
- if( LLManip::LL_NO_PART != LLToolCompScale::getInstance()->mManip->getHighlightedPart() )
- {
- LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mManip );
- LLToolCompScale::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
- }
- else
- {
- LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
- LLToolCompScale::getInstance()->mSelectRect->handlePick( pick_info );
- }
- }
- else
- {
- LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
- LLToolCompScale::getInstance()->mSelectRect->handlePick( pick_info );
- }
+ LLViewerObject* hit_obj = pick_info.getObject();
+
+ LLToolCompScale::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
+ if (!LLToolCompScale::getInstance()->mMouseDown)
+ {
+ // fast click on object, but mouse is already up...just do select
+ LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
+
+ return;
+ }
+
+ if( hit_obj || LLToolCompScale::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
+ {
+ if (LLToolCompScale::getInstance()->mManip->getSelection()->getObjectCount())
+ {
+ LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
+ }
+ if( LLManip::LL_NO_PART != LLToolCompScale::getInstance()->mManip->getHighlightedPart() )
+ {
+ LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mManip );
+ LLToolCompScale::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
+ }
+ else
+ {
+ LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
+ LLToolCompScale::getInstance()->mSelectRect->handlePick( pick_info );
+ }
+ }
+ else
+ {
+ LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect );
+ LLToolCompScale::getInstance()->mSelectRect->handlePick( pick_info );
+ }
}
BOOL LLToolCompScale::handleMouseUp(S32 x, S32 y, MASK mask)
{
- mMouseDown = FALSE;
- return LLToolComposite::handleMouseUp(x, y, mask);
+ mMouseDown = FALSE;
+ return LLToolComposite::handleMouseUp(x, y, mask);
}
LLTool* LLToolCompScale::getOverrideTool(MASK mask)
{
- if (mask == MASK_CONTROL)
- {
- return LLToolCompRotate::getInstance();
- }
+ if (mask == MASK_CONTROL)
+ {
+ return LLToolCompRotate::getInstance();
+ }
- return LLToolComposite::getOverrideTool(mask);
+ return LLToolComposite::getOverrideTool(mask);
}
BOOL LLToolCompScale::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
- {
- // You should already have an object selected from the mousedown.
- // If so, show its properties
- LLFloaterReg::showInstance("build", "Content");
- return TRUE;
- }
- else
- {
- // Nothing selected means the first mouse click was probably
- // bad, so try again.
- return handleMouseDown(x, y, mask);
- }
+ if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
+ {
+ // You should already have an object selected from the mousedown.
+ // If so, show its properties
+ LLFloaterReg::showInstance("build", "Content");
+ return TRUE;
+ }
+ else
+ {
+ // Nothing selected means the first mouse click was probably
+ // bad, so try again.
+ return handleMouseDown(x, y, mask);
+ }
}
void LLToolCompScale::render()
{
- mCur->render();
+ mCur->render();
- if( mCur != mManip )
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- mManip->renderGuidelines();
- }
+ if( mCur != mManip )
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ mManip->renderGuidelines();
+ }
}
//-----------------------------------------------------------------------
// LLToolCompCreate
LLToolCompCreate::LLToolCompCreate()
- : LLToolComposite(std::string("Create"))
+ : LLToolComposite(std::string("Create"))
{
- mPlacer = new LLToolPlacer();
- mSelectRect = new LLToolSelectRect(this);
+ mPlacer = new LLToolPlacer();
+ mSelectRect = new LLToolSelectRect(this);
- mCur = mPlacer;
- mDefault = mPlacer;
- mObjectPlacedOnMouseDown = FALSE;
+ mCur = mPlacer;
+ mDefault = mPlacer;
+ mObjectPlacedOnMouseDown = FALSE;
}
LLToolCompCreate::~LLToolCompCreate()
{
- delete mPlacer;
- delete mSelectRect;
+ delete mPlacer;
+ delete mSelectRect;
}
BOOL LLToolCompCreate::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
- mMouseDown = TRUE;
+ BOOL handled = FALSE;
+ mMouseDown = TRUE;
+
+ if ( (mask == MASK_SHIFT) || (mask == MASK_CONTROL) )
+ {
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ handled = TRUE;
+ }
+ else
+ {
+ setCurrentTool( mPlacer );
+ handled = mPlacer->placeObject( x, y, mask );
+ }
- if ( (mask == MASK_SHIFT) || (mask == MASK_CONTROL) )
- {
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
- handled = TRUE;
- }
- else
- {
- setCurrentTool( mPlacer );
- handled = mPlacer->placeObject( x, y, mask );
- }
-
- mObjectPlacedOnMouseDown = TRUE;
+ mObjectPlacedOnMouseDown = TRUE;
- return handled;
+ return handled;
}
void LLToolCompCreate::pickCallback(const LLPickInfo& pick_info)
{
- // *NOTE: We mask off shift and control, so you cannot
- // multi-select multiple objects with the create tool.
- MASK mask = (pick_info.mKeyMask & ~MASK_SHIFT);
- mask = (mask & ~MASK_CONTROL);
+ // *NOTE: We mask off shift and control, so you cannot
+ // multi-select multiple objects with the create tool.
+ MASK mask = (pick_info.mKeyMask & ~MASK_SHIFT);
+ mask = (mask & ~MASK_CONTROL);
- LLToolCompCreate::getInstance()->setCurrentTool( LLToolCompCreate::getInstance()->mSelectRect );
- LLToolCompCreate::getInstance()->mSelectRect->handlePick( pick_info );
+ LLToolCompCreate::getInstance()->setCurrentTool( LLToolCompCreate::getInstance()->mSelectRect );
+ LLToolCompCreate::getInstance()->mSelectRect->handlePick( pick_info );
}
BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- return handleMouseDown(x, y, mask);
+ return handleMouseDown(x, y, mask);
}
BOOL LLToolCompCreate::handleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
+ BOOL handled = FALSE;
- if ( mMouseDown && !mObjectPlacedOnMouseDown && !(mask == MASK_SHIFT) && !(mask == MASK_CONTROL) )
- {
- setCurrentTool( mPlacer );
- handled = mPlacer->placeObject( x, y, mask );
- }
+ if ( mMouseDown && !mObjectPlacedOnMouseDown && !(mask == MASK_SHIFT) && !(mask == MASK_CONTROL) )
+ {
+ setCurrentTool( mPlacer );
+ handled = mPlacer->placeObject( x, y, mask );
+ }
- mObjectPlacedOnMouseDown = FALSE;
- mMouseDown = FALSE;
+ mObjectPlacedOnMouseDown = FALSE;
+ mMouseDown = FALSE;
- if (!handled)
- {
- handled = LLToolComposite::handleMouseUp(x, y, mask);
- }
+ if (!handled)
+ {
+ handled = LLToolComposite::handleMouseUp(x, y, mask);
+ }
- return handled;
+ return handled;
}
//-----------------------------------------------------------------------
// LLToolCompRotate
LLToolCompRotate::LLToolCompRotate()
- : LLToolComposite(std::string("Rotate"))
+ : LLToolComposite(std::string("Rotate"))
{
- mManip = new LLManipRotate(this);
- mSelectRect = new LLToolSelectRect(this);
+ mManip = new LLManipRotate(this);
+ mSelectRect = new LLToolSelectRect(this);
- mCur = mManip;
- mDefault = mManip;
+ mCur = mManip;
+ mDefault = mManip;
}
LLToolCompRotate::~LLToolCompRotate()
{
- delete mManip;
- delete mSelectRect;
+ delete mManip;
+ delete mSelectRect;
}
BOOL LLToolCompRotate::handleHover(S32 x, S32 y, MASK mask)
{
- if( !mCur->hasMouseCapture() )
- {
- setCurrentTool( mManip );
- }
- return mCur->handleHover( x, y, mask );
+ if( !mCur->hasMouseCapture() )
+ {
+ setCurrentTool( mManip );
+ }
+ return mCur->handleHover( x, y, mask );
}
BOOL LLToolCompRotate::handleMouseDown(S32 x, S32 y, MASK mask)
{
- mMouseDown = TRUE;
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
- return TRUE;
+ mMouseDown = TRUE;
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ return TRUE;
}
void LLToolCompRotate::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = pick_info.getObject();
-
- LLToolCompRotate::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
- if (!LLToolCompRotate::getInstance()->mMouseDown)
- {
- // fast click on object, but mouse is already up...just do select
- LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
- return;
- }
-
- if( hit_obj || LLToolCompRotate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
- {
- if (LLToolCompRotate::getInstance()->mManip->getSelection()->getObjectCount())
- {
- LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
- }
- if( LLManip::LL_NO_PART != LLToolCompRotate::getInstance()->mManip->getHighlightedPart() )
- {
- LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mManip );
- LLToolCompRotate::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
- }
- else
- {
- LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
- LLToolCompRotate::getInstance()->mSelectRect->handlePick( pick_info );
- }
- }
- else
- {
- LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
- LLToolCompRotate::getInstance()->mSelectRect->handlePick( pick_info );
- }
+ LLViewerObject* hit_obj = pick_info.getObject();
+
+ LLToolCompRotate::getInstance()->mManip->highlightManipulators(pick_info.mMousePt.mX, pick_info.mMousePt.mY);
+ if (!LLToolCompRotate::getInstance()->mMouseDown)
+ {
+ // fast click on object, but mouse is already up...just do select
+ LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE);
+ return;
+ }
+
+ if( hit_obj || LLToolCompRotate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
+ {
+ if (LLToolCompRotate::getInstance()->mManip->getSelection()->getObjectCount())
+ {
+ LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
+ }
+ if( LLManip::LL_NO_PART != LLToolCompRotate::getInstance()->mManip->getHighlightedPart() )
+ {
+ LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mManip );
+ LLToolCompRotate::getInstance()->mManip->handleMouseDownOnPart( pick_info.mMousePt.mX, pick_info.mMousePt.mY, pick_info.mKeyMask );
+ }
+ else
+ {
+ LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
+ LLToolCompRotate::getInstance()->mSelectRect->handlePick( pick_info );
+ }
+ }
+ else
+ {
+ LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect );
+ LLToolCompRotate::getInstance()->mSelectRect->handlePick( pick_info );
+ }
}
BOOL LLToolCompRotate::handleMouseUp(S32 x, S32 y, MASK mask)
{
- mMouseDown = FALSE;
- return LLToolComposite::handleMouseUp(x, y, mask);
+ mMouseDown = FALSE;
+ return LLToolComposite::handleMouseUp(x, y, mask);
}
LLTool* LLToolCompRotate::getOverrideTool(MASK mask)
{
- if (mask == (MASK_CONTROL | MASK_SHIFT))
- {
- return LLToolCompScale::getInstance();
- }
- return LLToolComposite::getOverrideTool(mask);
+ if (mask == (MASK_CONTROL | MASK_SHIFT))
+ {
+ return LLToolCompScale::getInstance();
+ }
+ return LLToolComposite::getOverrideTool(mask);
}
BOOL LLToolCompRotate::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
- {
- // You should already have an object selected from the mousedown.
- // If so, show its properties
- LLFloaterReg::showInstance("build", "Content");
- return TRUE;
- }
- else
- {
- // Nothing selected means the first mouse click was probably
- // bad, so try again.
- return handleMouseDown(x, y, mask);
- }
+ if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
+ {
+ // You should already have an object selected from the mousedown.
+ // If so, show its properties
+ LLFloaterReg::showInstance("build", "Content");
+ return TRUE;
+ }
+ else
+ {
+ // Nothing selected means the first mouse click was probably
+ // bad, so try again.
+ return handleMouseDown(x, y, mask);
+ }
}
void LLToolCompRotate::render()
{
- mCur->render();
+ mCur->render();
- if( mCur != mManip )
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- mManip->renderGuidelines();
- }
+ if( mCur != mManip )
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ mManip->renderGuidelines();
+ }
}
@@ -684,115 +684,115 @@ void LLToolCompRotate::render()
// LLToolCompGun
LLToolCompGun::LLToolCompGun()
- : LLToolComposite(std::string("Mouselook"))
+ : LLToolComposite(std::string("Mouselook"))
{
- mGun = new LLToolGun(this);
- mGrab = new LLToolGrabBase(this);
- mNull = sNullTool;
+ mGun = new LLToolGun(this);
+ mGrab = new LLToolGrabBase(this);
+ mNull = sNullTool;
- setCurrentTool(mGun);
- mDefault = mGun;
+ setCurrentTool(mGun);
+ mDefault = mGun;
}
LLToolCompGun::~LLToolCompGun()
{
- delete mGun;
- mGun = NULL;
+ delete mGun;
+ mGun = NULL;
- delete mGrab;
- mGrab = NULL;
+ delete mGrab;
+ mGrab = NULL;
- // don't delete a static object
- // delete mNull;
- mNull = NULL;
+ // don't delete a static object
+ // delete mNull;
+ mNull = NULL;
}
BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask)
{
- // *NOTE: This hack is here to make mouselook kick in again after
- // item selected from context menu.
- if ( mCur == mNull && !gPopupMenuView->getVisible() )
- {
- LLSelectMgr::getInstance()->deselectAll();
- setCurrentTool( (LLTool*) mGrab );
- }
+ // *NOTE: This hack is here to make mouselook kick in again after
+ // item selected from context menu.
+ if ( mCur == mNull && !gPopupMenuView->getVisible() )
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ setCurrentTool( (LLTool*) mGrab );
+ }
- // Note: if the tool changed, we can't delegate the current mouse event
- // after the change because tools can modify the mouse during selection and deselection.
- // Instead we let the current tool handle the event and then make the change.
- // The new tool will take effect on the next frame.
+ // Note: if the tool changed, we can't delegate the current mouse event
+ // after the change because tools can modify the mouse during selection and deselection.
+ // Instead we let the current tool handle the event and then make the change.
+ // The new tool will take effect on the next frame.
- mCur->handleHover( x, y, mask );
+ mCur->handleHover( x, y, mask );
- // If mouse button not down...
- if( !gViewerWindow->getLeftMouseDown())
- {
- // let ALT switch from gun to grab
- if ( mCur == mGun && (mask & MASK_ALT) )
- {
- setCurrentTool( (LLTool*) mGrab );
- }
- else if ( mCur == mGrab && !(mask & MASK_ALT) )
- {
- setCurrentTool( (LLTool*) mGun );
- setMouseCapture(TRUE);
- }
- }
+ // If mouse button not down...
+ if( !gViewerWindow->getLeftMouseDown())
+ {
+ // let ALT switch from gun to grab
+ if ( mCur == mGun && (mask & MASK_ALT) )
+ {
+ setCurrentTool( (LLTool*) mGrab );
+ }
+ else if ( mCur == mGrab && !(mask & MASK_ALT) )
+ {
+ setCurrentTool( (LLTool*) mGun );
+ setMouseCapture(TRUE);
+ }
+ }
- return TRUE;
+ return TRUE;
}
BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask)
-{
- // if the left button is grabbed, don't put up the pie menu
- if (gAgent.leftButtonGrabbed() && gViewerInput.isLMouseHandlingDefault(MODE_FIRST_PERSON))
- {
- gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
- return FALSE;
- }
+{
+ // if the left button is grabbed, don't put up the pie menu
+ if (gAgent.leftButtonGrabbed() && gViewerInput.isLMouseHandlingDefault(MODE_FIRST_PERSON))
+ {
+ gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
+ return FALSE;
+ }
- // On mousedown, start grabbing
- gGrabTransientTool = this;
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
+ // On mousedown, start grabbing
+ gGrabTransientTool = this;
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
- return LLToolGrab::getInstance()->handleMouseDown(x, y, mask);
+ return LLToolGrab::getInstance()->handleMouseDown(x, y, mask);
}
BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- // if the left button is grabbed, don't put up the pie menu
- if (gAgent.leftButtonGrabbed() && gViewerInput.isLMouseHandlingDefault(MODE_FIRST_PERSON))
- {
- gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
- return FALSE;
- }
+ // if the left button is grabbed, don't put up the pie menu
+ if (gAgent.leftButtonGrabbed() && gViewerInput.isLMouseHandlingDefault(MODE_FIRST_PERSON))
+ {
+ gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
+ return FALSE;
+ }
- // On mousedown, start grabbing
- gGrabTransientTool = this;
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
+ // On mousedown, start grabbing
+ gGrabTransientTool = this;
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab );
- return LLToolGrab::getInstance()->handleDoubleClick(x, y, mask);
+ return LLToolGrab::getInstance()->handleDoubleClick(x, y, mask);
}
BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- /* JC - suppress context menu 8/29/2002
+ /* JC - suppress context menu 8/29/2002
- // On right mouse, go through some convoluted steps to
- // make the build menu appear.
- setCurrentTool( (LLTool*) mNull );
+ // On right mouse, go through some convoluted steps to
+ // make the build menu appear.
+ setCurrentTool( (LLTool*) mNull );
- // This should return FALSE, meaning the context menu will
- // be shown.
- return FALSE;
- */
+ // This should return FALSE, meaning the context menu will
+ // be shown.
+ return FALSE;
+ */
- // Returning true will suppress the context menu
- return TRUE;
+ // Returning true will suppress the context menu
+ return TRUE;
}
@@ -802,39 +802,39 @@ BOOL LLToolCompGun::handleMouseUp(S32 x, S32 y, MASK mask)
{
gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_UP);
}
- setCurrentTool( (LLTool*) mGun );
- return TRUE;
+ setCurrentTool( (LLTool*) mGun );
+ return TRUE;
}
void LLToolCompGun::onMouseCaptureLost()
{
- if (mComposite)
- {
- mComposite->onMouseCaptureLost();
- return;
- }
- mCur->onMouseCaptureLost();
+ if (mComposite)
+ {
+ mComposite->onMouseCaptureLost();
+ return;
+ }
+ mCur->onMouseCaptureLost();
}
-void LLToolCompGun::handleSelect()
+void LLToolCompGun::handleSelect()
{
- LLToolComposite::handleSelect();
- setMouseCapture(TRUE);
+ LLToolComposite::handleSelect();
+ setMouseCapture(TRUE);
}
-void LLToolCompGun::handleDeselect()
+void LLToolCompGun::handleDeselect()
{
- LLToolComposite::handleDeselect();
- setMouseCapture(FALSE);
+ LLToolComposite::handleDeselect();
+ setMouseCapture(FALSE);
}
BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
- if (clicks > 0)
- {
- gAgentCamera.changeCameraToDefault();
+ if (clicks > 0)
+ {
+ gAgentCamera.changeCameraToDefault();
- }
- return TRUE;
+ }
+ return TRUE;
}
diff --git a/indra/newview/lltoolcomp.h b/indra/newview/lltoolcomp.h
index f539a045b7..2ed8d73f41 100644
--- a/indra/newview/lltoolcomp.h
+++ b/indra/newview/lltoolcomp.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolcomp.h
* @brief Composite tools
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,58 +43,58 @@ class LLTextBox;
class LLToolComposite : public LLTool
{
public:
- LLToolComposite(const std::string& name);
+ LLToolComposite(const std::string& name);
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; // Sets the current tool
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0;
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; // Sets the current tool
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0;
- // Map virtual functions to the currently active internal tool
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) { return mCur->handleHover( x, y, mask ); }
- virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) { return mCur->handleScrollWheel( x, y, clicks ); }
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) { return mCur->handleRightMouseDown( x, y, mask ); }
+ // Map virtual functions to the currently active internal tool
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) { return mCur->handleHover( x, y, mask ); }
+ virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) { return mCur->handleScrollWheel( x, y, clicks ); }
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) { return mCur->handleRightMouseDown( x, y, mask ); }
- virtual LLViewerObject* getEditingObject() { return mCur->getEditingObject(); }
- virtual LLVector3d getEditingPointGlobal() { return mCur->getEditingPointGlobal(); }
- virtual BOOL isEditing() { return mCur->isEditing(); }
- virtual void stopEditing() { mCur->stopEditing(); mCur = mDefault; }
+ virtual LLViewerObject* getEditingObject() { return mCur->getEditingObject(); }
+ virtual LLVector3d getEditingPointGlobal() { return mCur->getEditingPointGlobal(); }
+ virtual BOOL isEditing() { return mCur->isEditing(); }
+ virtual void stopEditing() { mCur->stopEditing(); mCur = mDefault; }
- virtual BOOL clipMouseWhenDown() { return mCur->clipMouseWhenDown(); }
+ virtual BOOL clipMouseWhenDown() { return mCur->clipMouseWhenDown(); }
- virtual void handleSelect();
- virtual void handleDeselect();
+ virtual void handleSelect();
+ virtual void handleDeselect();
- virtual void render() { mCur->render(); }
- virtual void draw() { mCur->draw(); }
+ virtual void render() { mCur->render(); }
+ virtual void draw() { mCur->draw(); }
- virtual BOOL handleKey(KEY key, MASK mask) { return mCur->handleKey( key, mask ); }
+ virtual BOOL handleKey(KEY key, MASK mask) { return mCur->handleKey( key, mask ); }
- virtual void onMouseCaptureLost();
+ virtual void onMouseCaptureLost();
- virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
- { mCur->screenPointToLocal(screen_x, screen_y, local_x, local_y); }
+ virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
+ { mCur->screenPointToLocal(screen_x, screen_y, local_x, local_y); }
- virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
- { mCur->localPointToScreen(local_x, local_y, screen_x, screen_y); }
+ virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
+ { mCur->localPointToScreen(local_x, local_y, screen_x, screen_y); }
- BOOL isSelecting();
- LLTool* getCurrentTool() { return mCur; }
+ BOOL isSelecting();
+ LLTool* getCurrentTool() { return mCur; }
protected:
- void setCurrentTool( LLTool* new_tool );
- // In hover handler, call this to auto-switch tools
- void setToolFromMask( MASK mask, LLTool *normal );
+ void setCurrentTool( LLTool* new_tool );
+ // In hover handler, call this to auto-switch tools
+ void setToolFromMask( MASK mask, LLTool *normal );
protected:
- LLTool* mCur; // The tool to which we're delegating.
- LLTool* mDefault;
- BOOL mSelected;
- BOOL mMouseDown;
- LLManip* mManip;
- LLToolSelectRect* mSelectRect;
+ LLTool* mCur; // The tool to which we're delegating.
+ LLTool* mDefault;
+ BOOL mSelected;
+ BOOL mMouseDown;
+ LLManip* mManip;
+ LLToolSelectRect* mSelectRect;
public:
- static const std::string sNameComp;
+ static const std::string sNameComp;
};
@@ -103,24 +103,24 @@ public:
class LLToolCompInspect : public LLToolComposite, public LLSingleton<LLToolCompInspect>
{
- LLSINGLETON(LLToolCompInspect);
- virtual ~LLToolCompInspect();
+ LLSINGLETON(LLToolCompInspect);
+ virtual ~LLToolCompInspect();
public:
- // Overridden from LLToolComposite
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleKey(KEY key, MASK mask) override;
- virtual void onMouseCaptureLost() override;
- void keyUp(KEY key, MASK mask);
+ // Overridden from LLToolComposite
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleKey(KEY key, MASK mask) override;
+ virtual void onMouseCaptureLost() override;
+ void keyUp(KEY key, MASK mask);
- static void pickCallback(const LLPickInfo& pick_info);
+ static void pickCallback(const LLPickInfo& pick_info);
- BOOL isToolCameraActive() const { return mIsToolCameraActive; }
+ BOOL isToolCameraActive() const { return mIsToolCameraActive; }
private:
- BOOL mIsToolCameraActive;
+ BOOL mIsToolCameraActive;
};
//-----------------------------------------------------------------------
@@ -128,20 +128,20 @@ private:
class LLToolCompTranslate : public LLToolComposite, public LLSingleton<LLToolCompTranslate>
{
- LLSINGLETON(LLToolCompTranslate);
- virtual ~LLToolCompTranslate();
+ LLSINGLETON(LLToolCompTranslate);
+ virtual ~LLToolCompTranslate();
public:
- // Overridden from LLToolComposite
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; // Returns to the default tool
- virtual void render() override;
+ // Overridden from LLToolComposite
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; // Returns to the default tool
+ virtual void render() override;
- virtual LLTool* getOverrideTool(MASK mask) override;
+ virtual LLTool* getOverrideTool(MASK mask) override;
- static void pickCallback(const LLPickInfo& pick_info);
+ static void pickCallback(const LLPickInfo& pick_info);
};
//-----------------------------------------------------------------------
@@ -149,20 +149,20 @@ public:
class LLToolCompScale : public LLToolComposite, public LLSingleton<LLToolCompScale>
{
- LLSINGLETON(LLToolCompScale);
- virtual ~LLToolCompScale();
+ LLSINGLETON(LLToolCompScale);
+ virtual ~LLToolCompScale();
public:
- // Overridden from LLToolComposite
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; // Returns to the default tool
- virtual void render() override;
+ // Overridden from LLToolComposite
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; // Returns to the default tool
+ virtual void render() override;
+
+ virtual LLTool* getOverrideTool(MASK mask) override;
- virtual LLTool* getOverrideTool(MASK mask) override;
-
- static void pickCallback(const LLPickInfo& pick_info);
+ static void pickCallback(const LLPickInfo& pick_info);
};
@@ -171,20 +171,20 @@ public:
class LLToolCompRotate : public LLToolComposite, public LLSingleton<LLToolCompRotate>
{
- LLSINGLETON(LLToolCompRotate);
- virtual ~LLToolCompRotate();
+ LLSINGLETON(LLToolCompRotate);
+ virtual ~LLToolCompRotate();
public:
- // Overridden from LLToolComposite
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
- virtual void render() override;
+ // Overridden from LLToolComposite
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+ virtual void render() override;
- virtual LLTool* getOverrideTool(MASK mask) override;
+ virtual LLTool* getOverrideTool(MASK mask) override;
- static void pickCallback(const LLPickInfo& pick_info);
+ static void pickCallback(const LLPickInfo& pick_info);
protected:
};
@@ -194,19 +194,19 @@ protected:
class LLToolCompCreate : public LLToolComposite, public LLSingleton<LLToolCompCreate>
{
- LLSINGLETON(LLToolCompCreate);
- virtual ~LLToolCompCreate();
+ LLSINGLETON(LLToolCompCreate);
+ virtual ~LLToolCompCreate();
public:
- // Overridden from LLToolComposite
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
-
- static void pickCallback(const LLPickInfo& pick_info);
+ // Overridden from LLToolComposite
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+
+ static void pickCallback(const LLPickInfo& pick_info);
protected:
- LLToolPlacer* mPlacer;
- BOOL mObjectPlacedOnMouseDown;
+ LLToolPlacer* mPlacer;
+ BOOL mObjectPlacedOnMouseDown;
};
@@ -219,26 +219,26 @@ class LLToolSelect;
class LLToolCompGun : public LLToolComposite, public LLSingleton<LLToolCompGun>
{
- LLSINGLETON(LLToolCompGun);
- virtual ~LLToolCompGun();
+ LLSINGLETON(LLToolCompGun);
+ virtual ~LLToolCompGun();
public:
- // Overridden from LLToolComposite
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override;
- virtual void onMouseCaptureLost() override;
- virtual void handleSelect() override;
- virtual void handleDeselect() override;
- virtual LLTool* getOverrideTool(MASK mask) override { return NULL; }
+ // Overridden from LLToolComposite
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override;
+ virtual void onMouseCaptureLost() override;
+ virtual void handleSelect() override;
+ virtual void handleDeselect() override;
+ virtual LLTool* getOverrideTool(MASK mask) override { return NULL; }
protected:
- LLToolGun* mGun;
- LLToolGrabBase* mGrab;
- LLTool* mNull;
+ LLToolGun* mGun;
+ LLToolGrabBase* mGrab;
+ LLTool* mNull;
};
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index bfa9386cd4..7e70c25d5e 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltooldraganddrop.cpp
* @brief LLToolDragAndDrop class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -69,887 +69,887 @@
class LLNoPreferredType : public LLInventoryCollectFunctor
{
public:
- LLNoPreferredType() {}
- virtual ~LLNoPreferredType() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
- {
- if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
- {
- return true;
- }
- return false;
- }
+ LLNoPreferredType() {}
+ virtual ~LLNoPreferredType() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item)
+ {
+ if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
+ {
+ return true;
+ }
+ return false;
+ }
};
class LLNoPreferredTypeOrItem : public LLInventoryCollectFunctor
{
public:
- LLNoPreferredTypeOrItem() {}
- virtual ~LLNoPreferredTypeOrItem() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
- {
- if (item) return true;
- if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
- {
- return true;
- }
- return false;
- }
+ LLNoPreferredTypeOrItem() {}
+ virtual ~LLNoPreferredTypeOrItem() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item)
+ {
+ if (item) return true;
+ if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
+ {
+ return true;
+ }
+ return false;
+ }
};
class LLDroppableItem : public LLInventoryCollectFunctor
{
public:
- LLDroppableItem(BOOL is_transfer) :
- mCountLosing(0), mIsTransfer(is_transfer) {}
- virtual ~LLDroppableItem() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
- S32 countNoCopy() const { return mCountLosing; }
+ LLDroppableItem(BOOL is_transfer) :
+ mCountLosing(0), mIsTransfer(is_transfer) {}
+ virtual ~LLDroppableItem() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
+ S32 countNoCopy() const { return mCountLosing; }
protected:
- S32 mCountLosing;
- BOOL mIsTransfer;
+ S32 mCountLosing;
+ BOOL mIsTransfer;
};
bool LLDroppableItem::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
-{
- bool allowed = false;
- if (item)
- {
- allowed = itemTransferCommonlyAllowed(item);
-
- if (allowed
- && mIsTransfer
- && !item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID()))
- {
- allowed = false;
- }
- if (allowed && !item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- ++mCountLosing;
- }
- }
- return allowed;
+ LLInventoryItem* item)
+{
+ bool allowed = false;
+ if (item)
+ {
+ allowed = itemTransferCommonlyAllowed(item);
+
+ if (allowed
+ && mIsTransfer
+ && !item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ gAgent.getID()))
+ {
+ allowed = false;
+ }
+ if (allowed && !item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ ++mCountLosing;
+ }
+ }
+ return allowed;
}
class LLDropCopyableItems : public LLInventoryCollectFunctor
{
public:
- LLDropCopyableItems() {}
- virtual ~LLDropCopyableItems() {}
- virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+ LLDropCopyableItems() {}
+ virtual ~LLDropCopyableItems() {}
+ virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
};
bool LLDropCopyableItems::operator()(
- LLInventoryCategory* cat,
- LLInventoryItem* item)
-{
- bool allowed = false;
- if (item)
- {
- allowed = itemTransferCommonlyAllowed(item);
- if (allowed &&
- !item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- // whoops, can't copy it - don't allow it.
- allowed = false;
- }
- }
- return allowed;
-}
-
-// Starts a fetch on folders and items. This is really not used
+ LLInventoryCategory* cat,
+ LLInventoryItem* item)
+{
+ bool allowed = false;
+ if (item)
+ {
+ allowed = itemTransferCommonlyAllowed(item);
+ if (allowed &&
+ !item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ // whoops, can't copy it - don't allow it.
+ allowed = false;
+ }
+ }
+ return allowed;
+}
+
+// Starts a fetch on folders and items. This is really not used
// as an observer in the traditional sense; we're just using it to
// request a fetch and we don't care about when/if the response arrives.
class LLCategoryFireAndForget : public LLInventoryFetchComboObserver
{
public:
- LLCategoryFireAndForget(const uuid_vec_t& folder_ids,
- const uuid_vec_t& item_ids) :
- LLInventoryFetchComboObserver(folder_ids, item_ids)
- {}
- ~LLCategoryFireAndForget() {}
- virtual void done()
- {
- /* no-op: it's fire n forget right? */
- LL_DEBUGS() << "LLCategoryFireAndForget::done()" << LL_ENDL;
- }
+ LLCategoryFireAndForget(const uuid_vec_t& folder_ids,
+ const uuid_vec_t& item_ids) :
+ LLInventoryFetchComboObserver(folder_ids, item_ids)
+ {}
+ ~LLCategoryFireAndForget() {}
+ virtual void done()
+ {
+ /* no-op: it's fire n forget right? */
+ LL_DEBUGS() << "LLCategoryFireAndForget::done()" << LL_ENDL;
+ }
};
class LLCategoryDropObserver : public LLInventoryFetchItemsObserver
{
public:
- LLCategoryDropObserver(
- const uuid_vec_t& ids,
- const LLUUID& obj_id, LLToolDragAndDrop::ESource src) :
- LLInventoryFetchItemsObserver(ids),
- mObjectID(obj_id),
- mSource(src)
- {}
- ~LLCategoryDropObserver() {}
- virtual void done();
+ LLCategoryDropObserver(
+ const uuid_vec_t& ids,
+ const LLUUID& obj_id, LLToolDragAndDrop::ESource src) :
+ LLInventoryFetchItemsObserver(ids),
+ mObjectID(obj_id),
+ mSource(src)
+ {}
+ ~LLCategoryDropObserver() {}
+ virtual void done();
protected:
- LLUUID mObjectID;
- LLToolDragAndDrop::ESource mSource;
+ LLUUID mObjectID;
+ LLToolDragAndDrop::ESource mSource;
};
void LLCategoryDropObserver::done()
{
- gInventory.removeObserver(this);
- LLViewerObject* dst_obj = gObjectList.findObject(mObjectID);
- if (dst_obj)
- {
- // *FIX: coalesce these...
- LLInventoryItem* item = NULL;
- uuid_vec_t::iterator it = mComplete.begin();
- uuid_vec_t::iterator end = mComplete.end();
- for(; it < end; ++it)
- {
- item = gInventory.getItem(*it);
- if (item)
- {
- LLToolDragAndDrop::dropInventory(
- dst_obj,
- item,
- mSource,
- LLUUID::null);
- }
- }
- }
- delete this;
+ gInventory.removeObserver(this);
+ LLViewerObject* dst_obj = gObjectList.findObject(mObjectID);
+ if (dst_obj)
+ {
+ // *FIX: coalesce these...
+ LLInventoryItem* item = NULL;
+ uuid_vec_t::iterator it = mComplete.begin();
+ uuid_vec_t::iterator end = mComplete.end();
+ for(; it < end; ++it)
+ {
+ item = gInventory.getItem(*it);
+ if (item)
+ {
+ LLToolDragAndDrop::dropInventory(
+ dst_obj,
+ item,
+ mSource,
+ LLUUID::null);
+ }
+ }
+ }
+ delete this;
}
S32 LLToolDragAndDrop::sOperationId = 0;
LLToolDragAndDrop::DragAndDropEntry::DragAndDropEntry(dragOrDrop3dImpl f_none,
- dragOrDrop3dImpl f_self,
- dragOrDrop3dImpl f_avatar,
- dragOrDrop3dImpl f_object,
- dragOrDrop3dImpl f_land) :
- LLDictionaryEntry("")
+ dragOrDrop3dImpl f_self,
+ dragOrDrop3dImpl f_avatar,
+ dragOrDrop3dImpl f_object,
+ dragOrDrop3dImpl f_land) :
+ LLDictionaryEntry("")
{
- mFunctions[DT_NONE] = f_none;
- mFunctions[DT_SELF] = f_self;
- mFunctions[DT_AVATAR] = f_avatar;
- mFunctions[DT_OBJECT] = f_object;
- mFunctions[DT_LAND] = f_land;
+ mFunctions[DT_NONE] = f_none;
+ mFunctions[DT_SELF] = f_self;
+ mFunctions[DT_AVATAR] = f_avatar;
+ mFunctions[DT_OBJECT] = f_object;
+ mFunctions[DT_LAND] = f_land;
}
LLToolDragAndDrop::dragOrDrop3dImpl LLToolDragAndDrop::LLDragAndDropDictionary::get(EDragAndDropType dad_type, LLToolDragAndDrop::EDropTarget drop_target)
{
- const DragAndDropEntry *entry = lookup(dad_type);
- if (entry)
- {
- return (entry->mFunctions[(U8)drop_target]);
- }
- return &LLToolDragAndDrop::dad3dNULL;
+ const DragAndDropEntry *entry = lookup(dad_type);
+ if (entry)
+ {
+ return (entry->mFunctions[(U8)drop_target]);
+ }
+ return &LLToolDragAndDrop::dad3dNULL;
}
LLToolDragAndDrop::LLDragAndDropDictionary::LLDragAndDropDictionary()
{
- // DT_NONE DT_SELF DT_AVATAR DT_OBJECT DT_LAND
- // |-------------------------------|----------------------------------------------|-----------------------------------------------|---------------------------------------------------|--------------------------------|
- addEntry(DAD_NONE, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_TEXTURE, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dTextureObject, &LLToolDragAndDrop::dad3dNULL));
+ // DT_NONE DT_SELF DT_AVATAR DT_OBJECT DT_LAND
+ // |-------------------------------|----------------------------------------------|-----------------------------------------------|---------------------------------------------------|--------------------------------|
+ addEntry(DAD_NONE, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_TEXTURE, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dTextureObject, &LLToolDragAndDrop::dad3dNULL));
addEntry(DAD_MATERIAL, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dMaterialObject, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_SOUND, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_CALLINGCARD, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_LANDMARK, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_SCRIPT, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dRezScript, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_CLOTHING, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dWearItem, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_OBJECT, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dRezAttachmentFromInv, &LLToolDragAndDrop::dad3dGiveInventoryObject, &LLToolDragAndDrop::dad3dRezObjectOnObject, &LLToolDragAndDrop::dad3dRezObjectOnLand));
- addEntry(DAD_NOTECARD, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_CATEGORY, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dWearCategory, &LLToolDragAndDrop::dad3dGiveInventoryCategory, &LLToolDragAndDrop::dad3dRezCategoryOnObject, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_ROOT_CATEGORY, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_BODYPART, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dWearItem, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_ANIMATION, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_GESTURE, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dActivateGesture, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_LINK, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL));
- addEntry(DAD_MESH, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dMeshObject, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_SOUND, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_CALLINGCARD, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_LANDMARK, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_SCRIPT, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dRezScript, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_CLOTHING, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dWearItem, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_OBJECT, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dRezAttachmentFromInv, &LLToolDragAndDrop::dad3dGiveInventoryObject, &LLToolDragAndDrop::dad3dRezObjectOnObject, &LLToolDragAndDrop::dad3dRezObjectOnLand));
+ addEntry(DAD_NOTECARD, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_CATEGORY, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dWearCategory, &LLToolDragAndDrop::dad3dGiveInventoryCategory, &LLToolDragAndDrop::dad3dRezCategoryOnObject, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_ROOT_CATEGORY, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_BODYPART, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dWearItem, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_ANIMATION, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_GESTURE, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dActivateGesture, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_LINK, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL));
+ addEntry(DAD_MESH, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dMeshObject, &LLToolDragAndDrop::dad3dNULL));
addEntry(DAD_SETTINGS, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dGiveInventory, &LLToolDragAndDrop::dad3dUpdateInventory, &LLToolDragAndDrop::dad3dNULL));
-
+
// TODO: animation on self could play it? edit it?
- // TODO: gesture on self could play it? edit it?
+ // TODO: gesture on self could play it? edit it?
};
LLToolDragAndDrop::LLToolDragAndDrop()
-: LLTool(std::string("draganddrop"), NULL),
- mCargoCount(0),
- mDragStartX(0),
- mDragStartY(0),
- mSource(SOURCE_AGENT),
- mCursor(UI_CURSOR_NO),
- mLastAccept(ACCEPT_NO),
- mDrop(FALSE),
- mCurItemIndex(0)
+: LLTool(std::string("draganddrop"), NULL),
+ mCargoCount(0),
+ mDragStartX(0),
+ mDragStartY(0),
+ mSource(SOURCE_AGENT),
+ mCursor(UI_CURSOR_NO),
+ mLastAccept(ACCEPT_NO),
+ mDrop(FALSE),
+ mCurItemIndex(0)
{
}
void LLToolDragAndDrop::setDragStart(S32 x, S32 y)
{
- mDragStartX = x;
- mDragStartY = y;
+ mDragStartX = x;
+ mDragStartY = y;
}
BOOL LLToolDragAndDrop::isOverThreshold(S32 x,S32 y)
{
- static LLCachedControl<S32> drag_and_drop_threshold(gSavedSettings,"DragAndDropDistanceThreshold", 3);
-
- S32 mouse_delta_x = x - mDragStartX;
- S32 mouse_delta_y = y - mDragStartY;
-
- return (mouse_delta_x * mouse_delta_x) + (mouse_delta_y * mouse_delta_y) > drag_and_drop_threshold * drag_and_drop_threshold;
+ static LLCachedControl<S32> drag_and_drop_threshold(gSavedSettings,"DragAndDropDistanceThreshold", 3);
+
+ S32 mouse_delta_x = x - mDragStartX;
+ S32 mouse_delta_y = y - mDragStartY;
+
+ return (mouse_delta_x * mouse_delta_x) + (mouse_delta_y * mouse_delta_y) > drag_and_drop_threshold * drag_and_drop_threshold;
}
void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
- const LLUUID& cargo_id,
- ESource source,
- const LLUUID& source_id,
- const LLUUID& object_id)
-{
- if (type == DAD_NONE)
- {
- LL_WARNS() << "Attempted to start drag without a cargo type" << LL_ENDL;
- return;
- }
- mCargoTypes.clear();
- mCargoTypes.push_back(type);
- mCargoIDs.clear();
- mCargoIDs.push_back(cargo_id);
- mSource = source;
- mSourceID = source_id;
- mObjectID = object_id;
-
- setMouseCapture( TRUE );
- LLToolMgr::getInstance()->setTransientTool( this );
- mCursor = UI_CURSOR_NO;
- if ((mCargoTypes[0] == DAD_CATEGORY)
- && ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)))
- {
- LLInventoryCategory* cat = gInventory.getCategory(cargo_id);
- // go ahead and fire & forget the descendents if we are not
- // dragging a protected folder.
- if (cat)
- {
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLNoPreferredTypeOrItem is_not_preferred;
- uuid_vec_t folder_ids;
- uuid_vec_t item_ids;
- if (is_not_preferred(cat, NULL))
- {
- folder_ids.push_back(cargo_id);
- }
- gInventory.collectDescendentsIf(
- cargo_id,
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_not_preferred);
- S32 count = cats.size();
- S32 i;
- for(i = 0; i < count; ++i)
- {
- folder_ids.push_back(cats.at(i)->getUUID());
- }
- count = items.size();
- for(i = 0; i < count; ++i)
- {
- item_ids.push_back(items.at(i)->getUUID());
- }
- if (!folder_ids.empty() || !item_ids.empty())
- {
- LLCategoryFireAndForget *fetcher = new LLCategoryFireAndForget(folder_ids, item_ids);
- fetcher->startFetch();
- delete fetcher;
- }
- }
- }
+ const LLUUID& cargo_id,
+ ESource source,
+ const LLUUID& source_id,
+ const LLUUID& object_id)
+{
+ if (type == DAD_NONE)
+ {
+ LL_WARNS() << "Attempted to start drag without a cargo type" << LL_ENDL;
+ return;
+ }
+ mCargoTypes.clear();
+ mCargoTypes.push_back(type);
+ mCargoIDs.clear();
+ mCargoIDs.push_back(cargo_id);
+ mSource = source;
+ mSourceID = source_id;
+ mObjectID = object_id;
+
+ setMouseCapture( TRUE );
+ LLToolMgr::getInstance()->setTransientTool( this );
+ mCursor = UI_CURSOR_NO;
+ if ((mCargoTypes[0] == DAD_CATEGORY)
+ && ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)))
+ {
+ LLInventoryCategory* cat = gInventory.getCategory(cargo_id);
+ // go ahead and fire & forget the descendents if we are not
+ // dragging a protected folder.
+ if (cat)
+ {
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLNoPreferredTypeOrItem is_not_preferred;
+ uuid_vec_t folder_ids;
+ uuid_vec_t item_ids;
+ if (is_not_preferred(cat, NULL))
+ {
+ folder_ids.push_back(cargo_id);
+ }
+ gInventory.collectDescendentsIf(
+ cargo_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_not_preferred);
+ S32 count = cats.size();
+ S32 i;
+ for(i = 0; i < count; ++i)
+ {
+ folder_ids.push_back(cats.at(i)->getUUID());
+ }
+ count = items.size();
+ for(i = 0; i < count; ++i)
+ {
+ item_ids.push_back(items.at(i)->getUUID());
+ }
+ if (!folder_ids.empty() || !item_ids.empty())
+ {
+ LLCategoryFireAndForget *fetcher = new LLCategoryFireAndForget(folder_ids, item_ids);
+ fetcher->startFetch();
+ delete fetcher;
+ }
+ }
+ }
}
void LLToolDragAndDrop::beginMultiDrag(
- const std::vector<EDragAndDropType> types,
- const uuid_vec_t& cargo_ids,
- ESource source,
- const LLUUID& source_id)
-{
- // assert on public api is evil
- //llassert( type != DAD_NONE );
-
- std::vector<EDragAndDropType>::const_iterator types_it;
- for (types_it = types.begin(); types_it != types.end(); ++types_it)
- {
- if (DAD_NONE == *types_it)
- {
- LL_WARNS() << "Attempted to start drag without a cargo type" << LL_ENDL;
- return;
- }
- }
- mCargoTypes = types;
- mCargoIDs = cargo_ids;
- mSource = source;
- mSourceID = source_id;
-
- setMouseCapture( TRUE );
- LLToolMgr::getInstance()->setTransientTool( this );
- mCursor = UI_CURSOR_NO;
- if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
- {
- // find categories (i.e. inventory folders) in the cargo.
- LLInventoryCategory* cat = NULL;
- S32 count = llmin(cargo_ids.size(), types.size());
- std::set<LLUUID> cat_ids;
- for(S32 i = 0; i < count; ++i)
- {
- cat = gInventory.getCategory(cargo_ids[i]);
- if (cat)
- {
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLNoPreferredType is_not_preferred;
- if (is_not_preferred(cat, NULL))
- {
- cat_ids.insert(cat->getUUID());
- }
- gInventory.collectDescendentsIf(
- cat->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_not_preferred);
- S32 cat_count = cats.size();
- for(S32 i = 0; i < cat_count; ++i)
- {
- cat_ids.insert(cat->getUUID());
- }
- }
- }
- if (!cat_ids.empty())
- {
- uuid_vec_t folder_ids;
- uuid_vec_t item_ids;
- std::back_insert_iterator<uuid_vec_t> copier(folder_ids);
- std::copy(cat_ids.begin(), cat_ids.end(), copier);
- LLCategoryFireAndForget fetcher(folder_ids, item_ids);
- }
- }
+ const std::vector<EDragAndDropType> types,
+ const uuid_vec_t& cargo_ids,
+ ESource source,
+ const LLUUID& source_id)
+{
+ // assert on public api is evil
+ //llassert( type != DAD_NONE );
+
+ std::vector<EDragAndDropType>::const_iterator types_it;
+ for (types_it = types.begin(); types_it != types.end(); ++types_it)
+ {
+ if (DAD_NONE == *types_it)
+ {
+ LL_WARNS() << "Attempted to start drag without a cargo type" << LL_ENDL;
+ return;
+ }
+ }
+ mCargoTypes = types;
+ mCargoIDs = cargo_ids;
+ mSource = source;
+ mSourceID = source_id;
+
+ setMouseCapture( TRUE );
+ LLToolMgr::getInstance()->setTransientTool( this );
+ mCursor = UI_CURSOR_NO;
+ if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
+ {
+ // find categories (i.e. inventory folders) in the cargo.
+ LLInventoryCategory* cat = NULL;
+ S32 count = llmin(cargo_ids.size(), types.size());
+ std::set<LLUUID> cat_ids;
+ for(S32 i = 0; i < count; ++i)
+ {
+ cat = gInventory.getCategory(cargo_ids[i]);
+ if (cat)
+ {
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLNoPreferredType is_not_preferred;
+ if (is_not_preferred(cat, NULL))
+ {
+ cat_ids.insert(cat->getUUID());
+ }
+ gInventory.collectDescendentsIf(
+ cat->getUUID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_not_preferred);
+ S32 cat_count = cats.size();
+ for(S32 i = 0; i < cat_count; ++i)
+ {
+ cat_ids.insert(cat->getUUID());
+ }
+ }
+ }
+ if (!cat_ids.empty())
+ {
+ uuid_vec_t folder_ids;
+ uuid_vec_t item_ids;
+ std::back_insert_iterator<uuid_vec_t> copier(folder_ids);
+ std::copy(cat_ids.begin(), cat_ids.end(), copier);
+ LLCategoryFireAndForget fetcher(folder_ids, item_ids);
+ }
+ }
}
void LLToolDragAndDrop::endDrag()
{
- mEndDragSignal();
- LLSelectMgr::getInstance()->unhighlightAll();
- setMouseCapture(FALSE);
+ mEndDragSignal();
+ LLSelectMgr::getInstance()->unhighlightAll();
+ setMouseCapture(FALSE);
}
void LLToolDragAndDrop::onMouseCaptureLost()
{
- // Called whenever the drag ends or if mouse capture is simply lost
- LLToolMgr::getInstance()->clearTransientTool();
- mCargoTypes.clear();
- mCargoIDs.clear();
- mSource = SOURCE_AGENT;
- mSourceID.setNull();
- mObjectID.setNull();
- mCustomMsg.clear();
+ // Called whenever the drag ends or if mouse capture is simply lost
+ LLToolMgr::getInstance()->clearTransientTool();
+ mCargoTypes.clear();
+ mCargoIDs.clear();
+ mSource = SOURCE_AGENT;
+ mSourceID.setNull();
+ mObjectID.setNull();
+ mCustomMsg.clear();
}
BOOL LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask )
{
- if (hasMouseCapture())
- {
- EAcceptance acceptance = ACCEPT_NO;
- dragOrDrop( x, y, mask, TRUE, &acceptance );
- endDrag();
- }
- return TRUE;
+ if (hasMouseCapture())
+ {
+ EAcceptance acceptance = ACCEPT_NO;
+ dragOrDrop( x, y, mask, TRUE, &acceptance );
+ endDrag();
+ }
+ return TRUE;
}
ECursorType LLToolDragAndDrop::acceptanceToCursor( EAcceptance acceptance )
{
- switch (acceptance)
- {
- case ACCEPT_YES_MULTI:
- if (mCargoIDs.size() > 1)
- {
- mCursor = UI_CURSOR_ARROWDRAGMULTI;
- }
- else
- {
- mCursor = UI_CURSOR_ARROWDRAG;
- }
- break;
- case ACCEPT_YES_SINGLE:
- if (mCargoIDs.size() > 1)
- {
- mToolTipMsg = LLTrans::getString("TooltipMustSingleDrop");
- mCursor = UI_CURSOR_NO;
- }
- else
- {
- mCursor = UI_CURSOR_ARROWDRAG;
- }
- break;
-
- case ACCEPT_NO_LOCKED:
- mCursor = UI_CURSOR_NOLOCKED;
- break;
-
- case ACCEPT_NO_CUSTOM:
- mToolTipMsg = mCustomMsg;
- mCursor = UI_CURSOR_NO;
- break;
-
-
- case ACCEPT_NO:
- mCursor = UI_CURSOR_NO;
- break;
-
- case ACCEPT_YES_COPY_MULTI:
- if (mCargoIDs.size() > 1)
- {
- mCursor = UI_CURSOR_ARROWCOPYMULTI;
- }
- else
- {
- mCursor = UI_CURSOR_ARROWCOPY;
- }
- break;
- case ACCEPT_YES_COPY_SINGLE:
- if (mCargoIDs.size() > 1)
- {
- mToolTipMsg = LLTrans::getString("TooltipMustSingleDrop");
- mCursor = UI_CURSOR_NO;
- }
- else
- {
- mCursor = UI_CURSOR_ARROWCOPY;
- }
- break;
- case ACCEPT_POSTPONED:
- break;
- default:
- llassert( FALSE );
- }
-
- return mCursor;
+ switch (acceptance)
+ {
+ case ACCEPT_YES_MULTI:
+ if (mCargoIDs.size() > 1)
+ {
+ mCursor = UI_CURSOR_ARROWDRAGMULTI;
+ }
+ else
+ {
+ mCursor = UI_CURSOR_ARROWDRAG;
+ }
+ break;
+ case ACCEPT_YES_SINGLE:
+ if (mCargoIDs.size() > 1)
+ {
+ mToolTipMsg = LLTrans::getString("TooltipMustSingleDrop");
+ mCursor = UI_CURSOR_NO;
+ }
+ else
+ {
+ mCursor = UI_CURSOR_ARROWDRAG;
+ }
+ break;
+
+ case ACCEPT_NO_LOCKED:
+ mCursor = UI_CURSOR_NOLOCKED;
+ break;
+
+ case ACCEPT_NO_CUSTOM:
+ mToolTipMsg = mCustomMsg;
+ mCursor = UI_CURSOR_NO;
+ break;
+
+
+ case ACCEPT_NO:
+ mCursor = UI_CURSOR_NO;
+ break;
+
+ case ACCEPT_YES_COPY_MULTI:
+ if (mCargoIDs.size() > 1)
+ {
+ mCursor = UI_CURSOR_ARROWCOPYMULTI;
+ }
+ else
+ {
+ mCursor = UI_CURSOR_ARROWCOPY;
+ }
+ break;
+ case ACCEPT_YES_COPY_SINGLE:
+ if (mCargoIDs.size() > 1)
+ {
+ mToolTipMsg = LLTrans::getString("TooltipMustSingleDrop");
+ mCursor = UI_CURSOR_NO;
+ }
+ else
+ {
+ mCursor = UI_CURSOR_ARROWCOPY;
+ }
+ break;
+ case ACCEPT_POSTPONED:
+ break;
+ default:
+ llassert( FALSE );
+ }
+
+ return mCursor;
}
BOOL LLToolDragAndDrop::handleHover( S32 x, S32 y, MASK mask )
{
- EAcceptance acceptance = ACCEPT_NO;
- dragOrDrop( x, y, mask, FALSE, &acceptance );
+ EAcceptance acceptance = ACCEPT_NO;
+ dragOrDrop( x, y, mask, FALSE, &acceptance );
- ECursorType cursor = acceptanceToCursor(acceptance);
- gViewerWindow->getWindow()->setCursor( cursor );
+ ECursorType cursor = acceptanceToCursor(acceptance);
+ gViewerWindow->getWindow()->setCursor( cursor );
- LL_DEBUGS("UserInput") << "hover handled by LLToolDragAndDrop" << LL_ENDL;
- return TRUE;
+ LL_DEBUGS("UserInput") << "hover handled by LLToolDragAndDrop" << LL_ENDL;
+ return TRUE;
}
BOOL LLToolDragAndDrop::handleKey(KEY key, MASK mask)
{
- if (key == KEY_ESCAPE)
- {
- // cancel drag and drop operation
- endDrag();
- return TRUE;
- }
+ if (key == KEY_ESCAPE)
+ {
+ // cancel drag and drop operation
+ endDrag();
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
BOOL LLToolDragAndDrop::handleToolTip(S32 x, S32 y, MASK mask)
{
- if (!mToolTipMsg.empty())
- {
- LLToolTipMgr::instance().unblockToolTips();
- LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(mToolTipMsg)
- .delay_time(gSavedSettings.getF32( "DragAndDropToolTipDelay" )));
- return TRUE;
- }
- return FALSE;
+ if (!mToolTipMsg.empty())
+ {
+ LLToolTipMgr::instance().unblockToolTips();
+ LLToolTipMgr::instance().show(LLToolTip::Params()
+ .message(mToolTipMsg)
+ .delay_time(gSavedSettings.getF32( "DragAndDropToolTipDelay" )));
+ return TRUE;
+ }
+ return FALSE;
}
void LLToolDragAndDrop::handleDeselect()
{
- mToolTipMsg.clear();
- mCustomMsg.clear();
+ mToolTipMsg.clear();
+ mCustomMsg.clear();
- LLToolTipMgr::instance().blockToolTips();
+ LLToolTipMgr::instance().blockToolTips();
}
// protected
-void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
- EAcceptance* acceptance)
-{
- *acceptance = ACCEPT_YES_MULTI;
-
- BOOL handled = FALSE;
-
- LLView* top_view = gFocusMgr.getTopCtrl();
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
-
- mToolTipMsg.clear();
-
- // Increment the operation id for every drop
- if (drop)
- {
- sOperationId++;
- }
-
- // For people drag and drop we don't need an actual inventory object,
- // instead we need the current cargo id, which should be a person id.
- bool is_uuid_dragged = (mSource == SOURCE_PEOPLE);
-
- if (top_view)
- {
- handled = TRUE;
-
- for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
- {
- S32 local_x, local_y;
- top_view->screenPointToLocal( x, y, &local_x, &local_y );
- EAcceptance item_acceptance = ACCEPT_NO;
-
- LLInventoryObject* cargo = locateInventory(item, cat);
- if (cargo)
- {
- handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
- mCargoTypes[mCurItemIndex],
- (void*)cargo,
- &item_acceptance,
- mToolTipMsg);
- }
- else if (is_uuid_dragged)
- {
- handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
- mCargoTypes[mCurItemIndex],
- (void*)&mCargoIDs[mCurItemIndex],
- &item_acceptance,
- mToolTipMsg);
- }
- if (handled)
- {
- // use sort order to determine priority of acceptance
- *acceptance = (EAcceptance)llmin((U32)item_acceptance, (U32)*acceptance);
- }
- }
-
- // all objects passed, go ahead and perform drop if necessary
- if (handled && drop && (U32)*acceptance >= ACCEPT_YES_COPY_SINGLE)
- {
- if ((U32)*acceptance < ACCEPT_YES_COPY_MULTI &&
- mCargoIDs.size() > 1)
- {
- // tried to give multi-cargo to a single-acceptor - refuse and return.
- *acceptance = ACCEPT_NO;
- return;
- }
-
- for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
- {
- S32 local_x, local_y;
- EAcceptance item_acceptance;
- top_view->screenPointToLocal( x, y, &local_x, &local_y );
-
- LLInventoryObject* cargo = locateInventory(item, cat);
- if (cargo)
- {
- handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, TRUE,
- mCargoTypes[mCurItemIndex],
- (void*)cargo,
- &item_acceptance,
- mToolTipMsg);
- }
- else if (is_uuid_dragged)
- {
- handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
- mCargoTypes[mCurItemIndex],
- (void*)&mCargoIDs[mCurItemIndex],
- &item_acceptance,
- mToolTipMsg);
- }
- }
- }
- if (handled)
- {
- mLastAccept = (EAcceptance)*acceptance;
- }
- }
-
- if (!handled)
- {
- handled = TRUE;
-
- LLRootView* root_view = gViewerWindow->getRootView();
-
- for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
- {
- EAcceptance item_acceptance = ACCEPT_NO;
-
- LLInventoryObject* cargo = locateInventory(item, cat);
-
- // fix for EXT-3191
- if (cargo)
- {
- handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE,
- mCargoTypes[mCurItemIndex],
- (void*)cargo,
- &item_acceptance,
- mToolTipMsg);
- }
- else if (is_uuid_dragged)
- {
- handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE,
- mCargoTypes[mCurItemIndex],
- (void*)&mCargoIDs[mCurItemIndex],
- &item_acceptance,
- mToolTipMsg);
- }
- if (handled)
- {
- // use sort order to determine priority of acceptance
- *acceptance = (EAcceptance)llmin((U32)item_acceptance, (U32)*acceptance);
- }
- }
- // all objects passed, go ahead and perform drop if necessary
- if (handled && drop && (U32)*acceptance > ACCEPT_NO_LOCKED)
- {
- if ((U32)*acceptance < ACCEPT_YES_COPY_MULTI &&
- mCargoIDs.size() > 1)
- {
- // tried to give multi-cargo to a single-acceptor - refuse and return.
- *acceptance = ACCEPT_NO;
- return;
- }
-
- for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
- {
- EAcceptance item_acceptance;
-
- LLInventoryObject* cargo = locateInventory(item, cat);
- if (cargo)
- {
- handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE,
- mCargoTypes[mCurItemIndex],
- (void*)cargo,
- &item_acceptance,
- mToolTipMsg);
- }
- else if (is_uuid_dragged)
- {
- handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE,
- mCargoTypes[mCurItemIndex],
- (void*)&mCargoIDs[mCurItemIndex],
- &item_acceptance,
- mToolTipMsg);
- }
- }
- }
-
- if (handled)
- {
- mLastAccept = (EAcceptance)*acceptance;
- }
- }
-
- if (!handled)
- {
- // Disallow drag and drop to 3D from the marketplace
+void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
+ EAcceptance* acceptance)
+{
+ *acceptance = ACCEPT_YES_MULTI;
+
+ BOOL handled = FALSE;
+
+ LLView* top_view = gFocusMgr.getTopCtrl();
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+
+ mToolTipMsg.clear();
+
+ // Increment the operation id for every drop
+ if (drop)
+ {
+ sOperationId++;
+ }
+
+ // For people drag and drop we don't need an actual inventory object,
+ // instead we need the current cargo id, which should be a person id.
+ bool is_uuid_dragged = (mSource == SOURCE_PEOPLE);
+
+ if (top_view)
+ {
+ handled = TRUE;
+
+ for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
+ {
+ S32 local_x, local_y;
+ top_view->screenPointToLocal( x, y, &local_x, &local_y );
+ EAcceptance item_acceptance = ACCEPT_NO;
+
+ LLInventoryObject* cargo = locateInventory(item, cat);
+ if (cargo)
+ {
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
+ mCargoTypes[mCurItemIndex],
+ (void*)cargo,
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ else if (is_uuid_dragged)
+ {
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
+ mCargoTypes[mCurItemIndex],
+ (void*)&mCargoIDs[mCurItemIndex],
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ if (handled)
+ {
+ // use sort order to determine priority of acceptance
+ *acceptance = (EAcceptance)llmin((U32)item_acceptance, (U32)*acceptance);
+ }
+ }
+
+ // all objects passed, go ahead and perform drop if necessary
+ if (handled && drop && (U32)*acceptance >= ACCEPT_YES_COPY_SINGLE)
+ {
+ if ((U32)*acceptance < ACCEPT_YES_COPY_MULTI &&
+ mCargoIDs.size() > 1)
+ {
+ // tried to give multi-cargo to a single-acceptor - refuse and return.
+ *acceptance = ACCEPT_NO;
+ return;
+ }
+
+ for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
+ {
+ S32 local_x, local_y;
+ EAcceptance item_acceptance;
+ top_view->screenPointToLocal( x, y, &local_x, &local_y );
+
+ LLInventoryObject* cargo = locateInventory(item, cat);
+ if (cargo)
+ {
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, TRUE,
+ mCargoTypes[mCurItemIndex],
+ (void*)cargo,
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ else if (is_uuid_dragged)
+ {
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
+ mCargoTypes[mCurItemIndex],
+ (void*)&mCargoIDs[mCurItemIndex],
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ }
+ }
+ if (handled)
+ {
+ mLastAccept = (EAcceptance)*acceptance;
+ }
+ }
+
+ if (!handled)
+ {
+ handled = TRUE;
+
+ LLRootView* root_view = gViewerWindow->getRootView();
+
+ for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
+ {
+ EAcceptance item_acceptance = ACCEPT_NO;
+
+ LLInventoryObject* cargo = locateInventory(item, cat);
+
+ // fix for EXT-3191
+ if (cargo)
+ {
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE,
+ mCargoTypes[mCurItemIndex],
+ (void*)cargo,
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ else if (is_uuid_dragged)
+ {
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE,
+ mCargoTypes[mCurItemIndex],
+ (void*)&mCargoIDs[mCurItemIndex],
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ if (handled)
+ {
+ // use sort order to determine priority of acceptance
+ *acceptance = (EAcceptance)llmin((U32)item_acceptance, (U32)*acceptance);
+ }
+ }
+ // all objects passed, go ahead and perform drop if necessary
+ if (handled && drop && (U32)*acceptance > ACCEPT_NO_LOCKED)
+ {
+ if ((U32)*acceptance < ACCEPT_YES_COPY_MULTI &&
+ mCargoIDs.size() > 1)
+ {
+ // tried to give multi-cargo to a single-acceptor - refuse and return.
+ *acceptance = ACCEPT_NO;
+ return;
+ }
+
+ for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
+ {
+ EAcceptance item_acceptance;
+
+ LLInventoryObject* cargo = locateInventory(item, cat);
+ if (cargo)
+ {
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE,
+ mCargoTypes[mCurItemIndex],
+ (void*)cargo,
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ else if (is_uuid_dragged)
+ {
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE,
+ mCargoTypes[mCurItemIndex],
+ (void*)&mCargoIDs[mCurItemIndex],
+ &item_acceptance,
+ mToolTipMsg);
+ }
+ }
+ }
+
+ if (handled)
+ {
+ mLastAccept = (EAcceptance)*acceptance;
+ }
+ }
+
+ if (!handled)
+ {
+ // Disallow drag and drop to 3D from the marketplace
const LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
- if (marketplacelistings_id.notNull())
- {
- for (S32 item_index = 0; item_index < (S32)mCargoIDs.size(); item_index++)
- {
- if (gInventory.isObjectDescendentOf(mCargoIDs[item_index], marketplacelistings_id))
- {
- *acceptance = ACCEPT_NO;
- mToolTipMsg = LLTrans::getString("TooltipOutboxDragToWorld");
- return;
- }
- }
- }
-
- dragOrDrop3D( x, y, mask, drop, acceptance );
- }
+ if (marketplacelistings_id.notNull())
+ {
+ for (S32 item_index = 0; item_index < (S32)mCargoIDs.size(); item_index++)
+ {
+ if (gInventory.isObjectDescendentOf(mCargoIDs[item_index], marketplacelistings_id))
+ {
+ *acceptance = ACCEPT_NO;
+ mToolTipMsg = LLTrans::getString("TooltipOutboxDragToWorld");
+ return;
+ }
+ }
+ }
+
+ dragOrDrop3D( x, y, mask, drop, acceptance );
+ }
}
void LLToolDragAndDrop::dragOrDrop3D( S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* acceptance )
{
- mDrop = drop;
- if (mDrop)
- {
- // don't allow drag and drop onto rigged or transparent objects
- pick(gViewerWindow->pickImmediate(x, y, FALSE, FALSE));
- }
- else
- {
- // don't allow drag and drop onto transparent objects
- gViewerWindow->pickAsync(x, y, mask, pickCallback, FALSE, FALSE);
- }
+ mDrop = drop;
+ if (mDrop)
+ {
+ // don't allow drag and drop onto rigged or transparent objects
+ pick(gViewerWindow->pickImmediate(x, y, FALSE, FALSE));
+ }
+ else
+ {
+ // don't allow drag and drop onto transparent objects
+ gViewerWindow->pickAsync(x, y, mask, pickCallback, FALSE, FALSE);
+ }
- *acceptance = mLastAccept;
+ *acceptance = mLastAccept;
}
void LLToolDragAndDrop::pickCallback(const LLPickInfo& pick_info)
{
- if (getInstance() != NULL)
- {
- getInstance()->pick(pick_info);
- }
+ if (getInstance() != NULL)
+ {
+ getInstance()->pick(pick_info);
+ }
}
void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
{
- EDropTarget target = DT_NONE;
- S32 hit_face = -1;
-
- LLViewerObject* hit_obj = pick_info.getObject();
- LLSelectMgr::getInstance()->unhighlightAll();
- bool highlight_object = false;
- // Treat attachments as part of the avatar they are attached to.
- if (hit_obj != NULL)
- {
- // don't allow drag and drop on grass, trees, etc.
- if (pick_info.mPickType == LLPickInfo::PICK_FLORA)
- {
- mCursor = UI_CURSOR_NO;
- gViewerWindow->getWindow()->setCursor( mCursor );
- return;
- }
-
- if (hit_obj->isAttachment() && !hit_obj->isHUDAttachment())
- {
- LLVOAvatar* avatar = LLVOAvatar::findAvatarFromAttachment( hit_obj );
- if (!avatar)
- {
- mLastAccept = ACCEPT_NO;
- mCursor = UI_CURSOR_NO;
- gViewerWindow->getWindow()->setCursor( mCursor );
- return;
- }
- hit_obj = avatar;
- }
-
- if (hit_obj->isAvatar())
- {
- if (((LLVOAvatar*) hit_obj)->isSelf())
- {
- target = DT_SELF;
- hit_face = -1;
- }
- else
- {
- target = DT_AVATAR;
- hit_face = -1;
- }
- }
- else
- {
- target = DT_OBJECT;
- hit_face = pick_info.mObjectFace;
- highlight_object = true;
- }
- }
- else if (pick_info.mPickType == LLPickInfo::PICK_LAND)
- {
- target = DT_LAND;
- hit_face = -1;
- }
-
- mLastAccept = ACCEPT_YES_MULTI;
-
- for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
- {
- const S32 item_index = mCurItemIndex;
- const EDragAndDropType dad_type = mCargoTypes[item_index];
- // Call the right implementation function
- mLastAccept = (EAcceptance)llmin(
- (U32)mLastAccept,
- (U32)callMemberFunction(*this,
- LLDragAndDropDictionary::instance().get(dad_type, target))
- (hit_obj, hit_face, pick_info.mKeyMask, FALSE));
- }
-
- if (mDrop && ((U32)mLastAccept >= ACCEPT_YES_COPY_SINGLE))
- {
- // if target allows multi-drop or there is only one item being dropped, go ahead
- if ((mLastAccept >= ACCEPT_YES_COPY_MULTI) || (mCargoIDs.size() == 1))
- {
- // Target accepts multi, or cargo is a single-drop
- for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
- {
- const S32 item_index = mCurItemIndex;
- const EDragAndDropType dad_type = mCargoTypes[item_index];
- // Call the right implementation function
- callMemberFunction(*this, LLDragAndDropDictionary::instance().get(dad_type, target))
- (hit_obj, hit_face, pick_info.mKeyMask, TRUE);
- }
- }
- else
- {
- // Target does not accept multi, but cargo is multi
- mLastAccept = ACCEPT_NO;
- }
- }
-
- if (highlight_object && mLastAccept > ACCEPT_NO_LOCKED)
- {
- // if any item being dragged will be applied to the object under our cursor
- // highlight that object
- for (S32 i = 0; i < (S32)mCargoIDs.size(); i++)
- {
- if (mCargoTypes[i] != DAD_OBJECT || (pick_info.mKeyMask & MASK_CONTROL))
- {
- LLSelectMgr::getInstance()->highlightObjectAndFamily(hit_obj);
- break;
- }
- }
- }
- ECursorType cursor = acceptanceToCursor( mLastAccept );
- gViewerWindow->getWindow()->setCursor( cursor );
-
- mLastHitPos = pick_info.mPosGlobal;
- mLastCameraPos = gAgentCamera.getCameraPositionGlobal();
+ EDropTarget target = DT_NONE;
+ S32 hit_face = -1;
+
+ LLViewerObject* hit_obj = pick_info.getObject();
+ LLSelectMgr::getInstance()->unhighlightAll();
+ bool highlight_object = false;
+ // Treat attachments as part of the avatar they are attached to.
+ if (hit_obj != NULL)
+ {
+ // don't allow drag and drop on grass, trees, etc.
+ if (pick_info.mPickType == LLPickInfo::PICK_FLORA)
+ {
+ mCursor = UI_CURSOR_NO;
+ gViewerWindow->getWindow()->setCursor( mCursor );
+ return;
+ }
+
+ if (hit_obj->isAttachment() && !hit_obj->isHUDAttachment())
+ {
+ LLVOAvatar* avatar = LLVOAvatar::findAvatarFromAttachment( hit_obj );
+ if (!avatar)
+ {
+ mLastAccept = ACCEPT_NO;
+ mCursor = UI_CURSOR_NO;
+ gViewerWindow->getWindow()->setCursor( mCursor );
+ return;
+ }
+ hit_obj = avatar;
+ }
+
+ if (hit_obj->isAvatar())
+ {
+ if (((LLVOAvatar*) hit_obj)->isSelf())
+ {
+ target = DT_SELF;
+ hit_face = -1;
+ }
+ else
+ {
+ target = DT_AVATAR;
+ hit_face = -1;
+ }
+ }
+ else
+ {
+ target = DT_OBJECT;
+ hit_face = pick_info.mObjectFace;
+ highlight_object = true;
+ }
+ }
+ else if (pick_info.mPickType == LLPickInfo::PICK_LAND)
+ {
+ target = DT_LAND;
+ hit_face = -1;
+ }
+
+ mLastAccept = ACCEPT_YES_MULTI;
+
+ for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
+ {
+ const S32 item_index = mCurItemIndex;
+ const EDragAndDropType dad_type = mCargoTypes[item_index];
+ // Call the right implementation function
+ mLastAccept = (EAcceptance)llmin(
+ (U32)mLastAccept,
+ (U32)callMemberFunction(*this,
+ LLDragAndDropDictionary::instance().get(dad_type, target))
+ (hit_obj, hit_face, pick_info.mKeyMask, FALSE));
+ }
+
+ if (mDrop && ((U32)mLastAccept >= ACCEPT_YES_COPY_SINGLE))
+ {
+ // if target allows multi-drop or there is only one item being dropped, go ahead
+ if ((mLastAccept >= ACCEPT_YES_COPY_MULTI) || (mCargoIDs.size() == 1))
+ {
+ // Target accepts multi, or cargo is a single-drop
+ for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
+ {
+ const S32 item_index = mCurItemIndex;
+ const EDragAndDropType dad_type = mCargoTypes[item_index];
+ // Call the right implementation function
+ callMemberFunction(*this, LLDragAndDropDictionary::instance().get(dad_type, target))
+ (hit_obj, hit_face, pick_info.mKeyMask, TRUE);
+ }
+ }
+ else
+ {
+ // Target does not accept multi, but cargo is multi
+ mLastAccept = ACCEPT_NO;
+ }
+ }
+
+ if (highlight_object && mLastAccept > ACCEPT_NO_LOCKED)
+ {
+ // if any item being dragged will be applied to the object under our cursor
+ // highlight that object
+ for (S32 i = 0; i < (S32)mCargoIDs.size(); i++)
+ {
+ if (mCargoTypes[i] != DAD_OBJECT || (pick_info.mKeyMask & MASK_CONTROL))
+ {
+ LLSelectMgr::getInstance()->highlightObjectAndFamily(hit_obj);
+ break;
+ }
+ }
+ }
+ ECursorType cursor = acceptanceToCursor( mLastAccept );
+ gViewerWindow->getWindow()->setCursor( cursor );
+
+ mLastHitPos = pick_info.mPosGlobal;
+ mLastCameraPos = gAgentCamera.getCameraPositionGlobal();
}
// static
BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- LLToolDragAndDrop::ESource source,
- const LLUUID& src_id)
-{
- if (!item) return FALSE;
-
- // Always succeed if....
- // material is from the library
- // or already in the contents of the object
- if (SOURCE_LIBRARY == source)
- {
- // dropping a material from the library always just works.
- return TRUE;
- }
-
- // In case the inventory has not been loaded (e.g. due to some recent operation
- // causing a dirty inventory) and we can do an update, stall the user
- // while fetching the inventory.
- //
- // Fetch if inventory is dirty and listener is present (otherwise we will not receive update)
- if (hit_obj->isInventoryDirty() && hit_obj->hasInventoryListeners())
- {
- hit_obj->requestInventory();
- LLSD args;
+ LLInventoryItem* item,
+ LLToolDragAndDrop::ESource source,
+ const LLUUID& src_id)
+{
+ if (!item) return FALSE;
+
+ // Always succeed if....
+ // material is from the library
+ // or already in the contents of the object
+ if (SOURCE_LIBRARY == source)
+ {
+ // dropping a material from the library always just works.
+ return TRUE;
+ }
+
+ // In case the inventory has not been loaded (e.g. due to some recent operation
+ // causing a dirty inventory) and we can do an update, stall the user
+ // while fetching the inventory.
+ //
+ // Fetch if inventory is dirty and listener is present (otherwise we will not receive update)
+ if (hit_obj->isInventoryDirty() && hit_obj->hasInventoryListeners())
+ {
+ hit_obj->requestInventory();
+ LLSD args;
if (LLAssetType::AT_MATERIAL == item->getType())
{
args["ERROR_MESSAGE"] = "Unable to add material.\nPlease wait a few seconds and try again.";
@@ -958,117 +958,117 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
{
args["ERROR_MESSAGE"] = "Unable to add texture.\nPlease wait a few seconds and try again.";
}
- LLNotificationsUtil::add("ErrorMessage", args);
- return FALSE;
- }
+ LLNotificationsUtil::add("ErrorMessage", args);
+ return FALSE;
+ }
// Make sure to verify both id and type since 'null'
// is a shared default for some asset types.
if (hit_obj->getInventoryItemByAsset(item->getAssetUUID(), item->getType()))
- {
- // if the asset is already in the object's inventory
- // then it can always be added to a side.
- // This saves some work if the task's inventory is already loaded
- // and ensures that the asset item is only added once.
- return TRUE;
- }
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
- {
- // Check that we can add the material as inventory to the object
- if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
- {
- return FALSE;
- }
- // make sure the object has the material in it's inventory.
- if (SOURCE_AGENT == source)
- {
- // Remove the material from local inventory. The server
- // will actually remove the item from agent inventory.
- gInventory.deleteObject(item->getUUID());
- gInventory.notifyObservers();
- }
- else if (SOURCE_WORLD == source)
- {
- // *FIX: if the objects are in different regions, and the
- // source region has crashed, you can bypass these
- // permissions.
- LLViewerObject* src_obj = gObjectList.findObject(src_id);
- if (src_obj)
- {
- src_obj->removeInventory(item->getUUID());
- }
- else
- {
- LL_WARNS() << "Unable to find source object." << LL_ENDL;
- return FALSE;
- }
- }
- // Add the asset item to the target object's inventory.
+ {
+ // if the asset is already in the object's inventory
+ // then it can always be added to a side.
+ // This saves some work if the task's inventory is already loaded
+ // and ensures that the asset item is only added once.
+ return TRUE;
+ }
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
+ {
+ // Check that we can add the material as inventory to the object
+ if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
+ {
+ return FALSE;
+ }
+ // make sure the object has the material in it's inventory.
+ if (SOURCE_AGENT == source)
+ {
+ // Remove the material from local inventory. The server
+ // will actually remove the item from agent inventory.
+ gInventory.deleteObject(item->getUUID());
+ gInventory.notifyObservers();
+ }
+ else if (SOURCE_WORLD == source)
+ {
+ // *FIX: if the objects are in different regions, and the
+ // source region has crashed, you can bypass these
+ // permissions.
+ LLViewerObject* src_obj = gObjectList.findObject(src_id);
+ if (src_obj)
+ {
+ src_obj->removeInventory(item->getUUID());
+ }
+ else
+ {
+ LL_WARNS() << "Unable to find source object." << LL_ENDL;
+ return FALSE;
+ }
+ }
+ // Add the asset item to the target object's inventory.
if (LLAssetType::AT_TEXTURE == new_item->getType()
|| LLAssetType::AT_MATERIAL == new_item->getType())
{
hit_obj->updateMaterialInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
}
- else
- {
- hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
- }
- // Force the object to update and refetch its inventory so it has this asset.
- hit_obj->dirtyInventory();
- hit_obj->requestInventory();
- // TODO: Check to see if adding the item was successful; if not, then
- // we should return false here. This will requre a separate listener
- // since without listener, we have no way to receive update
- }
- else if (!item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID()))
- {
- // Check that we can add the asset as inventory to the object
- if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
- {
- return FALSE;
- }
- // *FIX: may want to make sure agent can paint hit_obj.
-
- // Add the asset item to the target object's inventory.
- if (LLAssetType::AT_TEXTURE == new_item->getType()
+ else
+ {
+ hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
+ }
+ // Force the object to update and refetch its inventory so it has this asset.
+ hit_obj->dirtyInventory();
+ hit_obj->requestInventory();
+ // TODO: Check to see if adding the item was successful; if not, then
+ // we should return false here. This will requre a separate listener
+ // since without listener, we have no way to receive update
+ }
+ else if (!item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ gAgent.getID()))
+ {
+ // Check that we can add the asset as inventory to the object
+ if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
+ {
+ return FALSE;
+ }
+ // *FIX: may want to make sure agent can paint hit_obj.
+
+ // Add the asset item to the target object's inventory.
+ if (LLAssetType::AT_TEXTURE == new_item->getType()
|| LLAssetType::AT_MATERIAL == new_item->getType())
- {
- hit_obj->updateMaterialInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
- }
- else
- {
- hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
- }
- // Force the object to update and refetch its inventory so it has this asset.
- hit_obj->dirtyInventory();
- hit_obj->requestInventory();
- // TODO: Check to see if adding the item was successful; if not, then
- // we should return false here. This will requre a separate listener
- // since without listener, we have no way to receive update
- }
- else if (LLAssetType::AT_MATERIAL == new_item->getType() &&
+ {
+ hit_obj->updateMaterialInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
+ }
+ else
+ {
+ hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
+ }
+ // Force the object to update and refetch its inventory so it has this asset.
+ hit_obj->dirtyInventory();
+ hit_obj->requestInventory();
+ // TODO: Check to see if adding the item was successful; if not, then
+ // we should return false here. This will requre a separate listener
+ // since without listener, we have no way to receive update
+ }
+ else if (LLAssetType::AT_MATERIAL == new_item->getType() &&
!item->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID()))
- {
- // Check that we can add the material as inventory to the object
- if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
- {
- return FALSE;
- }
- // *FIX: may want to make sure agent can paint hit_obj.
-
- // Add the material item to the target object's inventory.
+ {
+ // Check that we can add the material as inventory to the object
+ if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
+ {
+ return FALSE;
+ }
+ // *FIX: may want to make sure agent can paint hit_obj.
+
+ // Add the material item to the target object's inventory.
hit_obj->updateMaterialInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
- // Force the object to update and refetch its inventory so it has this material.
- hit_obj->dirtyInventory();
- hit_obj->requestInventory();
- // TODO: Check to see if adding the item was successful; if not, then
- // we should return false here. This will requre a separate listener
- // since without listener, we have no way to receive update
- }
- return TRUE;
+ // Force the object to update and refetch its inventory so it has this material.
+ hit_obj->dirtyInventory();
+ hit_obj->requestInventory();
+ // TODO: Check to see if adding the item was successful; if not, then
+ // we should return false here. This will requre a separate listener
+ // since without listener, we have no way to receive update
+ }
+ return TRUE;
}
void set_texture_to_material(LLViewerObject* hit_obj,
@@ -1125,16 +1125,16 @@ void set_texture_to_material(LLViewerObject* hit_obj,
}
void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- LLToolDragAndDrop::ESource source,
- const LLUUID& src_id,
+ LLInventoryItem* item,
+ LLToolDragAndDrop::ESource source,
+ const LLUUID& src_id,
bool remove_pbr)
{
- if (!item)
- {
- LL_WARNS() << "LLToolDragAndDrop::dropTextureAllFaces no texture item." << LL_ENDL;
- return;
- }
+ if (!item)
+ {
+ LL_WARNS() << "LLToolDragAndDrop::dropTextureAllFaces no texture item." << LL_ENDL;
+ return;
+ }
S32 num_faces = hit_obj->getNumTEs();
bool has_non_pbr_faces = false;
for (S32 face = 0; face < num_faces; face++)
@@ -1154,17 +1154,17 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,
return;
}
}
- LLUUID asset_id = item->getAssetUUID();
+ LLUUID asset_id = item->getAssetUUID();
// Overrides require textures to be copy and transfer free
LLPermissions item_permissions = item->getPermissions();
bool allow_adding_to_override = item_permissions.allowOperationBy(PERM_COPY, gAgent.getID());
allow_adding_to_override &= item_permissions.allowOperationBy(PERM_TRANSFER, gAgent.getID());
- LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id);
- add(LLStatViewer::EDIT_TEXTURE, 1);
- for( S32 face = 0; face < num_faces; face++ )
- {
+ LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id);
+ add(LLStatViewer::EDIT_TEXTURE, 1);
+ for( S32 face = 0; face < num_faces; face++ )
+ {
if (remove_pbr)
{
hit_obj->setRenderMaterialID(face, LLUUID::null);
@@ -1181,11 +1181,11 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,
{
set_texture_to_material(hit_obj, face, asset_id, LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR);
}
- }
+ }
- // send the update to the simulator
+ // send the update to the simulator
LLGLTFMaterialList::flushUpdates(nullptr);
- hit_obj->sendTEUpdate();
+ hit_obj->sendTEUpdate();
}
void LLToolDragAndDrop::dropMaterial(LLViewerObject* hit_obj,
@@ -1309,27 +1309,27 @@ void LLToolDragAndDrop::dropMaterialAllFaces(LLViewerObject* hit_obj,
void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- LLToolDragAndDrop::ESource source,
- const LLUUID& src_id)
-{
- if (!item)
- {
- LL_WARNS() << "no inventory item." << LL_ENDL;
- return;
- }
- LLUUID asset_id = item->getAssetUUID();
- BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
- if(!success)
- {
- return;
- }
-
- LLSculptParams sculpt_params;
- sculpt_params.setSculptTexture(asset_id, LL_SCULPT_TYPE_MESH);
- hit_obj->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
-
- dialog_refresh_all();
+ LLInventoryItem* item,
+ LLToolDragAndDrop::ESource source,
+ const LLUUID& src_id)
+{
+ if (!item)
+ {
+ LL_WARNS() << "no inventory item." << LL_ENDL;
+ return;
+ }
+ LLUUID asset_id = item->getAssetUUID();
+ BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
+ if(!success)
+ {
+ return;
+ }
+
+ LLSculptParams sculpt_params;
+ sculpt_params.setSculptTexture(asset_id, LL_SCULPT_TYPE_MESH);
+ hit_obj->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
+
+ dialog_refresh_all();
}
void LLToolDragAndDrop::dropTexture(LLViewerObject* hit_obj,
@@ -1434,19 +1434,19 @@ void LLToolDragAndDrop::dropTexture(LLViewerObject* hit_obj,
}
void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
- S32 hit_face,
- LLInventoryItem* item,
- LLToolDragAndDrop::ESource source,
- const LLUUID& src_id,
+ S32 hit_face,
+ LLInventoryItem* item,
+ LLToolDragAndDrop::ESource source,
+ const LLUUID& src_id,
bool remove_pbr,
S32 tex_channel)
{
- if (hit_face == -1) return;
- if (!item)
- {
- LL_WARNS() << "LLToolDragAndDrop::dropTextureOneFace no texture item." << LL_ENDL;
- return;
- }
+ if (hit_face == -1) return;
+ if (!item)
+ {
+ LL_WARNS() << "LLToolDragAndDrop::dropTextureOneFace no texture item." << LL_ENDL;
+ return;
+ }
LLUUID asset_id = item->getAssetUUID();
@@ -1470,593 +1470,593 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
}
return;
}
- BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
- if (!success)
- {
- return;
- }
+ BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
+ if (!success)
+ {
+ return;
+ }
if (remove_pbr)
{
hit_obj->setRenderMaterialID(hit_face, LLUUID::null);
}
- // update viewer side image in anticipation of update from simulator
- LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id);
- add(LLStatViewer::EDIT_TEXTURE, 1);
+ // update viewer side image in anticipation of update from simulator
+ LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id);
+ add(LLStatViewer::EDIT_TEXTURE, 1);
- LLTextureEntry* tep = hit_obj->getTE(hit_face);
+ LLTextureEntry* tep = hit_obj->getTE(hit_face);
- LLPanelFace* panel_face = gFloaterTools->getPanelFace();
+ LLPanelFace* panel_face = gFloaterTools->getPanelFace();
- if (gFloaterTools->getVisible() && panel_face)
- {
+ if (gFloaterTools->getVisible() && panel_face)
+ {
tex_channel = (tex_channel > -1) ? tex_channel : panel_face->getTextureDropChannel();
switch (tex_channel)
- {
+ {
- case 0:
- default:
- {
- hit_obj->setTEImage(hit_face, image);
- }
- break;
+ case 0:
+ default:
+ {
+ hit_obj->setTEImage(hit_face, image);
+ }
+ break;
- case 1:
+ case 1:
if (tep)
- {
- LLMaterialPtr old_mat = tep->getMaterialParams();
- LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
- new_mat->setNormalID(asset_id);
- tep->setMaterialParams(new_mat);
- hit_obj->setTENormalMap(hit_face, asset_id);
- LLMaterialMgr::getInstance()->put(hit_obj->getID(), hit_face, *new_mat);
- }
- break;
-
- case 2:
+ {
+ LLMaterialPtr old_mat = tep->getMaterialParams();
+ LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
+ new_mat->setNormalID(asset_id);
+ tep->setMaterialParams(new_mat);
+ hit_obj->setTENormalMap(hit_face, asset_id);
+ LLMaterialMgr::getInstance()->put(hit_obj->getID(), hit_face, *new_mat);
+ }
+ break;
+
+ case 2:
if (tep)
- {
- LLMaterialPtr old_mat = tep->getMaterialParams();
- LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
- new_mat->setSpecularID(asset_id);
- tep->setMaterialParams(new_mat);
- hit_obj->setTESpecularMap(hit_face, asset_id);
- LLMaterialMgr::getInstance()->put(hit_obj->getID(), hit_face, *new_mat);
- }
- break;
- }
- }
- else
- {
- hit_obj->setTEImage(hit_face, image);
- }
-
- dialog_refresh_all();
-
- // send the update to the simulator
- hit_obj->sendTEUpdate();
+ {
+ LLMaterialPtr old_mat = tep->getMaterialParams();
+ LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
+ new_mat->setSpecularID(asset_id);
+ tep->setMaterialParams(new_mat);
+ hit_obj->setTESpecularMap(hit_face, asset_id);
+ LLMaterialMgr::getInstance()->put(hit_obj->getID(), hit_face, *new_mat);
+ }
+ break;
+ }
+ }
+ else
+ {
+ hit_obj->setTEImage(hit_face, image);
+ }
+
+ dialog_refresh_all();
+
+ // send the update to the simulator
+ hit_obj->sendTEUpdate();
}
void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- BOOL active,
- ESource source,
- const LLUUID& src_id)
-{
- // *HACK: In order to resolve SL-22177, we need to block drags
- // from notecards and objects onto other objects.
- if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
- || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
- {
- LL_WARNS() << "Call to LLToolDragAndDrop::dropScript() from world"
- << " or notecard." << LL_ENDL;
- return;
- }
- if (hit_obj && item)
- {
- LLPointer<LLViewerInventoryItem> new_script = new LLViewerInventoryItem(item);
- if (!item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- if (SOURCE_AGENT == source)
- {
- // Remove the script from local inventory. The server
- // will actually remove the item from agent inventory.
- gInventory.deleteObject(item->getUUID());
- gInventory.notifyObservers();
- }
- else if (SOURCE_WORLD == source)
- {
- // *FIX: if the objects are in different regions, and
- // the source region has crashed, you can bypass
- // these permissions.
- LLViewerObject* src_obj = gObjectList.findObject(src_id);
- if (src_obj)
- {
- src_obj->removeInventory(item->getUUID());
- }
- else
- {
- LL_WARNS() << "Unable to find source object." << LL_ENDL;
- return;
- }
- }
- }
- hit_obj->saveScript(new_script, active, true);
- gFloaterTools->dirty();
-
- // VEFFECT: SetScript
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgentAvatarp);
- effectp->setTargetObject(hit_obj);
- effectp->setDuration(LL_HUD_DUR_SHORT);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- }
+ LLInventoryItem* item,
+ BOOL active,
+ ESource source,
+ const LLUUID& src_id)
+{
+ // *HACK: In order to resolve SL-22177, we need to block drags
+ // from notecards and objects onto other objects.
+ if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
+ || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
+ {
+ LL_WARNS() << "Call to LLToolDragAndDrop::dropScript() from world"
+ << " or notecard." << LL_ENDL;
+ return;
+ }
+ if (hit_obj && item)
+ {
+ LLPointer<LLViewerInventoryItem> new_script = new LLViewerInventoryItem(item);
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ if (SOURCE_AGENT == source)
+ {
+ // Remove the script from local inventory. The server
+ // will actually remove the item from agent inventory.
+ gInventory.deleteObject(item->getUUID());
+ gInventory.notifyObservers();
+ }
+ else if (SOURCE_WORLD == source)
+ {
+ // *FIX: if the objects are in different regions, and
+ // the source region has crashed, you can bypass
+ // these permissions.
+ LLViewerObject* src_obj = gObjectList.findObject(src_id);
+ if (src_obj)
+ {
+ src_obj->removeInventory(item->getUUID());
+ }
+ else
+ {
+ LL_WARNS() << "Unable to find source object." << LL_ENDL;
+ return;
+ }
+ }
+ }
+ hit_obj->saveScript(new_script, active, true);
+ gFloaterTools->dirty();
+
+ // VEFFECT: SetScript
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ effectp->setSourceObject(gAgentAvatarp);
+ effectp->setTargetObject(hit_obj);
+ effectp->setDuration(LL_HUD_DUR_SHORT);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ }
}
void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
- BOOL bypass_sim_raycast,
- BOOL from_task_inventory,
- BOOL remove_from_inventory)
-{
- LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(mLastHitPos);
- if (!regionp)
- {
- LL_WARNS() << "Couldn't find region to rez object" << LL_ENDL;
- return;
- }
-
- //LL_INFOS() << "Rezzing object" << LL_ENDL;
- make_ui_sound("UISndObjectRezIn");
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return;
-
- //if (regionp
- // && (regionp->getRegionFlag(REGION_FLAGS_SANDBOX)))
- //{
- // LLFirstUse::useSandbox();
- //}
- // check if it cannot be copied, and mark as remove if it is -
- // this will remove the object from inventory after rez. Only
- // bother with this check if we would not normally remove from
- // inventory.
- if (!remove_from_inventory
- && !item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- remove_from_inventory = TRUE;
- }
-
- // Limit raycast to a single object.
- // Speeds up server raycast + avoid problems with server ray
- // hitting objects that were clipped by the near plane or culled
- // on the viewer.
- LLUUID ray_target_id;
- if (raycast_target)
- {
- ray_target_id = raycast_target->getID();
- }
- else
- {
- ray_target_id.setNull();
- }
-
- // Check if it's in the trash.
- bool is_in_trash = false;
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
- {
- is_in_trash = true;
- }
-
- LLUUID source_id = from_task_inventory ? mSourceID : LLUUID::null;
-
- // Select the object only if we're editing.
- BOOL rez_selected = LLToolMgr::getInstance()->inEdit();
-
-
- LLVector3 ray_start = regionp->getPosRegionFromGlobal(mLastCameraPos);
- LLVector3 ray_end = regionp->getPosRegionFromGlobal(mLastHitPos);
- // currently the ray's end point is an approximation,
- // and is sometimes too short (causing failure.) so we
- // double the ray's length:
- if (bypass_sim_raycast == FALSE)
- {
- LLVector3 ray_direction = ray_start - ray_end;
- ray_end = ray_end - ray_direction;
- }
-
-
- // Message packing code should be it's own uninterrupted block
- LLMessageSystem* msg = gMessageSystem;
- if (mSource == SOURCE_NOTECARD)
- {
- LLUIUsage::instance().logCommand("Object.RezObjectFromNotecard");
- msg->newMessageFast(_PREHASH_RezObjectFromNotecard);
- }
- else
- {
- LLUIUsage::instance().logCommand("Object.RezObject");
- msg->newMessageFast(_PREHASH_RezObject);
- }
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
-
- msg->nextBlock("RezData");
- // if it's being rezzed from task inventory, we need to enable
- // saving it back into the task inventory.
- // *FIX: We can probably compress this to a single byte, since I
- // think folderid == mSourceID. This will be a later
- // optimization.
- msg->addUUIDFast(_PREHASH_FromTaskID, source_id);
- msg->addU8Fast(_PREHASH_BypassRaycast, (U8) bypass_sim_raycast);
- msg->addVector3Fast(_PREHASH_RayStart, ray_start);
- msg->addVector3Fast(_PREHASH_RayEnd, ray_end);
- msg->addUUIDFast(_PREHASH_RayTargetID, ray_target_id );
- msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE);
- msg->addBOOLFast(_PREHASH_RezSelected, rez_selected);
- msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory);
-
- // deal with permissions slam logic
- pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
-
- LLUUID folder_id = item->getParentUUID();
- if ((SOURCE_LIBRARY == mSource) || (is_in_trash))
- {
- // since it's coming from the library or trash, we want to not
- // 'take' it back to the same place.
- item->setParent(LLUUID::null);
- // *TODO this code isn't working - the parent (FolderID) is still
- // set when the object is "taken". so code on the "take" side is
- // checking for trash and library as well (llviewermenu.cpp)
- }
- if (mSource == SOURCE_NOTECARD)
- {
- msg->nextBlockFast(_PREHASH_NotecardData);
- msg->addUUIDFast(_PREHASH_NotecardItemID, mSourceID);
- msg->addUUIDFast(_PREHASH_ObjectID, mObjectID);
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
- }
- else
- {
- msg->nextBlockFast(_PREHASH_InventoryData);
- item->packMessage(msg);
- }
- msg->sendReliable(regionp->getHost());
- // back out the change. no actual internal changes take place.
- item->setParent(folder_id);
-
- // If we're going to select it, get ready for the incoming
- // selected object.
- if (rez_selected)
- {
- LLSelectMgr::getInstance()->deselectAll();
- gViewerWindow->getWindow()->incBusyCount();
- }
-
- if (remove_from_inventory)
- {
- // Delete it from inventory immediately so that users cannot
- // easily bypass copy protection in laggy situations. If the
- // rez fails, we will put it back on the server.
- gInventory.deleteObject(item->getUUID());
- gInventory.notifyObservers();
- }
-
- // VEFFECT: DropObject
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgentAvatarp);
- effectp->setPositionGlobal(mLastHitPos);
- effectp->setDuration(LL_HUD_DUR_SHORT);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
-
- add(LLStatViewer::OBJECT_REZ, 1);
+ BOOL bypass_sim_raycast,
+ BOOL from_task_inventory,
+ BOOL remove_from_inventory)
+{
+ LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(mLastHitPos);
+ if (!regionp)
+ {
+ LL_WARNS() << "Couldn't find region to rez object" << LL_ENDL;
+ return;
+ }
+
+ //LL_INFOS() << "Rezzing object" << LL_ENDL;
+ make_ui_sound("UISndObjectRezIn");
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return;
+
+ //if (regionp
+ // && (regionp->getRegionFlag(REGION_FLAGS_SANDBOX)))
+ //{
+ // LLFirstUse::useSandbox();
+ //}
+ // check if it cannot be copied, and mark as remove if it is -
+ // this will remove the object from inventory after rez. Only
+ // bother with this check if we would not normally remove from
+ // inventory.
+ if (!remove_from_inventory
+ && !item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ remove_from_inventory = TRUE;
+ }
+
+ // Limit raycast to a single object.
+ // Speeds up server raycast + avoid problems with server ray
+ // hitting objects that were clipped by the near plane or culled
+ // on the viewer.
+ LLUUID ray_target_id;
+ if (raycast_target)
+ {
+ ray_target_id = raycast_target->getID();
+ }
+ else
+ {
+ ray_target_id.setNull();
+ }
+
+ // Check if it's in the trash.
+ bool is_in_trash = false;
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+ {
+ is_in_trash = true;
+ }
+
+ LLUUID source_id = from_task_inventory ? mSourceID : LLUUID::null;
+
+ // Select the object only if we're editing.
+ BOOL rez_selected = LLToolMgr::getInstance()->inEdit();
+
+
+ LLVector3 ray_start = regionp->getPosRegionFromGlobal(mLastCameraPos);
+ LLVector3 ray_end = regionp->getPosRegionFromGlobal(mLastHitPos);
+ // currently the ray's end point is an approximation,
+ // and is sometimes too short (causing failure.) so we
+ // double the ray's length:
+ if (bypass_sim_raycast == FALSE)
+ {
+ LLVector3 ray_direction = ray_start - ray_end;
+ ray_end = ray_end - ray_direction;
+ }
+
+
+ // Message packing code should be it's own uninterrupted block
+ LLMessageSystem* msg = gMessageSystem;
+ if (mSource == SOURCE_NOTECARD)
+ {
+ LLUIUsage::instance().logCommand("Object.RezObjectFromNotecard");
+ msg->newMessageFast(_PREHASH_RezObjectFromNotecard);
+ }
+ else
+ {
+ LLUIUsage::instance().logCommand("Object.RezObject");
+ msg->newMessageFast(_PREHASH_RezObject);
+ }
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
+
+ msg->nextBlock("RezData");
+ // if it's being rezzed from task inventory, we need to enable
+ // saving it back into the task inventory.
+ // *FIX: We can probably compress this to a single byte, since I
+ // think folderid == mSourceID. This will be a later
+ // optimization.
+ msg->addUUIDFast(_PREHASH_FromTaskID, source_id);
+ msg->addU8Fast(_PREHASH_BypassRaycast, (U8) bypass_sim_raycast);
+ msg->addVector3Fast(_PREHASH_RayStart, ray_start);
+ msg->addVector3Fast(_PREHASH_RayEnd, ray_end);
+ msg->addUUIDFast(_PREHASH_RayTargetID, ray_target_id );
+ msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE);
+ msg->addBOOLFast(_PREHASH_RezSelected, rez_selected);
+ msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory);
+
+ // deal with permissions slam logic
+ pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
+
+ LLUUID folder_id = item->getParentUUID();
+ if ((SOURCE_LIBRARY == mSource) || (is_in_trash))
+ {
+ // since it's coming from the library or trash, we want to not
+ // 'take' it back to the same place.
+ item->setParent(LLUUID::null);
+ // *TODO this code isn't working - the parent (FolderID) is still
+ // set when the object is "taken". so code on the "take" side is
+ // checking for trash and library as well (llviewermenu.cpp)
+ }
+ if (mSource == SOURCE_NOTECARD)
+ {
+ msg->nextBlockFast(_PREHASH_NotecardData);
+ msg->addUUIDFast(_PREHASH_NotecardItemID, mSourceID);
+ msg->addUUIDFast(_PREHASH_ObjectID, mObjectID);
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
+ }
+ else
+ {
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ item->packMessage(msg);
+ }
+ msg->sendReliable(regionp->getHost());
+ // back out the change. no actual internal changes take place.
+ item->setParent(folder_id);
+
+ // If we're going to select it, get ready for the incoming
+ // selected object.
+ if (rez_selected)
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ gViewerWindow->getWindow()->incBusyCount();
+ }
+
+ if (remove_from_inventory)
+ {
+ // Delete it from inventory immediately so that users cannot
+ // easily bypass copy protection in laggy situations. If the
+ // rez fails, we will put it back on the server.
+ gInventory.deleteObject(item->getUUID());
+ gInventory.notifyObservers();
+ }
+
+ // VEFFECT: DropObject
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ effectp->setSourceObject(gAgentAvatarp);
+ effectp->setPositionGlobal(mLastHitPos);
+ effectp->setDuration(LL_HUD_DUR_SHORT);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+
+ add(LLStatViewer::OBJECT_REZ, 1);
}
void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- LLToolDragAndDrop::ESource source,
- const LLUUID& src_id)
-{
- // *HACK: In order to resolve SL-22177, we need to block drags
- // from notecards and objects onto other objects.
- if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
- || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
- {
- LL_WARNS() << "Call to LLToolDragAndDrop::dropInventory() from world"
- << " or notecard." << LL_ENDL;
- return;
- }
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- time_t creation_date = time_corrected();
- new_item->setCreationDate(creation_date);
-
- if (!item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- if (SOURCE_AGENT == source)
- {
- // Remove the inventory item from local inventory. The
- // server will actually remove the item from agent
- // inventory.
- gInventory.deleteObject(item->getUUID());
- gInventory.notifyObservers();
- }
- else if (SOURCE_WORLD == source)
- {
- // *FIX: if the objects are in different regions, and the
- // source region has crashed, you can bypass these
- // permissions.
- LLViewerObject* src_obj = gObjectList.findObject(src_id);
- if (src_obj)
- {
- src_obj->removeInventory(item->getUUID());
- }
- else
- {
- LL_WARNS() << "Unable to find source object." << LL_ENDL;
- return;
- }
- }
- }
- hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
- if (LLFloaterReg::instanceVisible("build"))
- {
- // *FIX: only show this if panel not expanded?
- LLFloaterReg::showInstance("build", "Content");
- }
-
- // VEFFECT: AddToInventory
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgentAvatarp);
- effectp->setTargetObject(hit_obj);
- effectp->setDuration(LL_HUD_DUR_SHORT);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- gFloaterTools->dirty();
+ LLInventoryItem* item,
+ LLToolDragAndDrop::ESource source,
+ const LLUUID& src_id)
+{
+ // *HACK: In order to resolve SL-22177, we need to block drags
+ // from notecards and objects onto other objects.
+ if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
+ || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
+ {
+ LL_WARNS() << "Call to LLToolDragAndDrop::dropInventory() from world"
+ << " or notecard." << LL_ENDL;
+ return;
+ }
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ time_t creation_date = time_corrected();
+ new_item->setCreationDate(creation_date);
+
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ if (SOURCE_AGENT == source)
+ {
+ // Remove the inventory item from local inventory. The
+ // server will actually remove the item from agent
+ // inventory.
+ gInventory.deleteObject(item->getUUID());
+ gInventory.notifyObservers();
+ }
+ else if (SOURCE_WORLD == source)
+ {
+ // *FIX: if the objects are in different regions, and the
+ // source region has crashed, you can bypass these
+ // permissions.
+ LLViewerObject* src_obj = gObjectList.findObject(src_id);
+ if (src_obj)
+ {
+ src_obj->removeInventory(item->getUUID());
+ }
+ else
+ {
+ LL_WARNS() << "Unable to find source object." << LL_ENDL;
+ return;
+ }
+ }
+ }
+ hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
+ if (LLFloaterReg::instanceVisible("build"))
+ {
+ // *FIX: only show this if panel not expanded?
+ LLFloaterReg::showInstance("build", "Content");
+ }
+
+ // VEFFECT: AddToInventory
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ effectp->setSourceObject(gAgentAvatarp);
+ effectp->setTargetObject(hit_obj);
+ effectp->setDuration(LL_HUD_DUR_SHORT);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ gFloaterTools->dirty();
}
// accessor that looks at permissions, copyability, and names of
// inventory items to determine if a drop would be ok.
EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LLInventoryItem* item, EDragAndDropType type)
{
- // check the basics
- if (!item || !obj) return ACCEPT_NO;
- // HACK: downcast
- LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item;
- if (!vitem->isFinished() && (type != DAD_CATEGORY))
- {
- // Note: for DAD_CATEGORY we assume that folder version check passed and folder
- // is complete, meaning that items inside are up to date.
- // (isFinished() == false) at the moment shows that item was loaded from cache.
- // Library or agent inventory only.
- return ACCEPT_NO;
- }
- if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links
-
- // deny attempts to drop from an object onto itself. This is to
- // help make sure that drops that are from an object to an object
- // don't have to worry about order of evaluation. Think of this
- // like check for self in assignment.
- if(obj->getID() == item->getParentUUID())
- {
- return ACCEPT_NO;
- }
-
- //BOOL copy = (perm.allowCopyBy(gAgent.getID(),
- // gAgent.getGroupID())
- // && (obj->mPermModify || obj->mFlagAllowInventoryAdd));
- BOOL worn = FALSE;
- LLVOAvatarSelf* my_avatar = NULL;
- switch(item->getType())
- {
- case LLAssetType::AT_OBJECT:
- my_avatar = gAgentAvatarp;
- if(my_avatar && my_avatar->isWearingAttachment(item->getUUID()))
- {
- worn = TRUE;
- }
- break;
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_CLOTHING:
- if(gAgentWearables.isWearingItem(item->getUUID()))
- {
- worn = TRUE;
- }
- break;
- case LLAssetType::AT_CALLINGCARD:
- // Calling Cards in object are disabled for now
- // because of incomplete LSL support. See STORM-1117.
- return ACCEPT_NO;
- default:
- break;
- }
- const LLPermissions& perm = item->getPermissions();
- BOOL modify = (obj->permModify() || obj->flagAllowInventoryAdd());
- BOOL transfer = FALSE;
- if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
- || perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
- {
- transfer = TRUE;
- }
- BOOL volume = (LL_PCODE_VOLUME == obj->getPCode());
- BOOL attached = obj->isAttachment();
- BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE;
- if(attached && !unrestricted)
- {
+ // check the basics
+ if (!item || !obj) return ACCEPT_NO;
+ // HACK: downcast
+ LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item;
+ if (!vitem->isFinished() && (type != DAD_CATEGORY))
+ {
+ // Note: for DAD_CATEGORY we assume that folder version check passed and folder
+ // is complete, meaning that items inside are up to date.
+ // (isFinished() == false) at the moment shows that item was loaded from cache.
+ // Library or agent inventory only.
+ return ACCEPT_NO;
+ }
+ if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links
+
+ // deny attempts to drop from an object onto itself. This is to
+ // help make sure that drops that are from an object to an object
+ // don't have to worry about order of evaluation. Think of this
+ // like check for self in assignment.
+ if(obj->getID() == item->getParentUUID())
+ {
+ return ACCEPT_NO;
+ }
+
+ //BOOL copy = (perm.allowCopyBy(gAgent.getID(),
+ // gAgent.getGroupID())
+ // && (obj->mPermModify || obj->mFlagAllowInventoryAdd));
+ BOOL worn = FALSE;
+ LLVOAvatarSelf* my_avatar = NULL;
+ switch(item->getType())
+ {
+ case LLAssetType::AT_OBJECT:
+ my_avatar = gAgentAvatarp;
+ if(my_avatar && my_avatar->isWearingAttachment(item->getUUID()))
+ {
+ worn = TRUE;
+ }
+ break;
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ if(gAgentWearables.isWearingItem(item->getUUID()))
+ {
+ worn = TRUE;
+ }
+ break;
+ case LLAssetType::AT_CALLINGCARD:
+ // Calling Cards in object are disabled for now
+ // because of incomplete LSL support. See STORM-1117.
+ return ACCEPT_NO;
+ default:
+ break;
+ }
+ const LLPermissions& perm = item->getPermissions();
+ BOOL modify = (obj->permModify() || obj->flagAllowInventoryAdd());
+ BOOL transfer = FALSE;
+ if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
+ || perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+ {
+ transfer = TRUE;
+ }
+ BOOL volume = (LL_PCODE_VOLUME == obj->getPCode());
+ BOOL attached = obj->isAttachment();
+ BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE;
+ if(attached && !unrestricted)
+ {
// Attachments are in world and in inventory simultaneously,
// at the moment server doesn't support such a situation.
- return ACCEPT_NO_LOCKED;
- }
- else if(modify && transfer && volume && !worn)
- {
- return ACCEPT_YES_MULTI;
- }
- else if(!modify)
- {
- return ACCEPT_NO_LOCKED;
- }
- return ACCEPT_NO;
+ return ACCEPT_NO_LOCKED;
+ }
+ else if(modify && transfer && volume && !worn)
+ {
+ return ACCEPT_YES_MULTI;
+ }
+ else if(!modify)
+ {
+ return ACCEPT_NO_LOCKED;
+ }
+ return ACCEPT_NO;
}
static void give_inventory_cb(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- // if Cancel pressed
- if (option == 1)
- {
- return;
- }
-
- LLSD payload = notification["payload"];
- const LLUUID& session_id = payload["session_id"];
- const LLUUID& agent_id = payload["agent_id"];
- LLViewerInventoryItem * inv_item = gInventory.getItem(payload["item_id"]);
- LLViewerInventoryCategory * inv_cat = gInventory.getCategory(payload["item_id"]);
- if (NULL == inv_item && NULL == inv_cat)
- {
- llassert( FALSE );
- return;
- }
- bool successfully_shared;
- if (inv_item)
- {
- successfully_shared = LLGiveInventory::doGiveInventoryItem(agent_id, inv_item, session_id);
- }
- else
- {
- successfully_shared = LLGiveInventory::doGiveInventoryCategory(agent_id, inv_cat, session_id);
- }
- if (successfully_shared)
- {
- if ("avatarpicker" == payload["d&d_dest"].asString())
- {
- LLFloaterReg::hideInstance("avatar_picker");
- }
- LLNotificationsUtil::add("ItemsShared");
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ // if Cancel pressed
+ if (option == 1)
+ {
+ return;
+ }
+
+ LLSD payload = notification["payload"];
+ const LLUUID& session_id = payload["session_id"];
+ const LLUUID& agent_id = payload["agent_id"];
+ LLViewerInventoryItem * inv_item = gInventory.getItem(payload["item_id"]);
+ LLViewerInventoryCategory * inv_cat = gInventory.getCategory(payload["item_id"]);
+ if (NULL == inv_item && NULL == inv_cat)
+ {
+ llassert( FALSE );
+ return;
+ }
+ bool successfully_shared;
+ if (inv_item)
+ {
+ successfully_shared = LLGiveInventory::doGiveInventoryItem(agent_id, inv_item, session_id);
+ }
+ else
+ {
+ successfully_shared = LLGiveInventory::doGiveInventoryCategory(agent_id, inv_cat, session_id);
+ }
+ if (successfully_shared)
+ {
+ if ("avatarpicker" == payload["d&d_dest"].asString())
+ {
+ LLFloaterReg::hideInstance("avatar_picker");
+ }
+ LLNotificationsUtil::add("ItemsShared");
+ }
}
static void show_object_sharing_confirmation(const std::string name,
- LLInventoryObject* inv_item,
- const LLSD& dest,
- const LLUUID& dest_agent,
- const LLUUID& session_id = LLUUID::null)
-{
- if (!inv_item)
- {
- llassert(NULL != inv_item);
- return;
- }
- LLSD substitutions;
- substitutions["RESIDENTS"] = name;
- substitutions["ITEMS"] = inv_item->getName();
- LLSD payload;
- payload["agent_id"] = dest_agent;
- payload["item_id"] = inv_item->getUUID();
- payload["session_id"] = session_id;
- payload["d&d_dest"] = dest.asString();
- LLNotificationsUtil::add("ShareItemsConfirmation", substitutions, payload, &give_inventory_cb);
+ LLInventoryObject* inv_item,
+ const LLSD& dest,
+ const LLUUID& dest_agent,
+ const LLUUID& session_id = LLUUID::null)
+{
+ if (!inv_item)
+ {
+ llassert(NULL != inv_item);
+ return;
+ }
+ LLSD substitutions;
+ substitutions["RESIDENTS"] = name;
+ substitutions["ITEMS"] = inv_item->getName();
+ LLSD payload;
+ payload["agent_id"] = dest_agent;
+ payload["item_id"] = inv_item->getUUID();
+ payload["session_id"] = session_id;
+ payload["d&d_dest"] = dest.asString();
+ LLNotificationsUtil::add("ShareItemsConfirmation", substitutions, payload, &give_inventory_cb);
}
static void get_name_cb(const LLUUID& id,
- const LLAvatarName& av_name,
- LLInventoryObject* inv_obj,
- const LLSD& dest,
- const LLUUID& dest_agent)
+ const LLAvatarName& av_name,
+ LLInventoryObject* inv_obj,
+ const LLSD& dest,
+ const LLUUID& dest_agent)
{
- show_object_sharing_confirmation(av_name.getUserName(),
- inv_obj,
- dest,
- id,
- LLUUID::null);
+ show_object_sharing_confirmation(av_name.getUserName(),
+ inv_obj,
+ dest,
+ id,
+ LLUUID::null);
}
// function used as drag-and-drop handler for simple agent give inventory requests
//static
bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_id, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- const LLSD& dest)
-{
- // check the type
- switch(cargo_type)
- {
- case DAD_TEXTURE:
- case DAD_SOUND:
- case DAD_LANDMARK:
- case DAD_SCRIPT:
- case DAD_OBJECT:
- case DAD_NOTECARD:
- case DAD_CLOTHING:
- case DAD_BODYPART:
- case DAD_ANIMATION:
- case DAD_GESTURE:
- case DAD_CALLINGCARD:
- case DAD_MESH:
- case DAD_CATEGORY:
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ const LLSD& dest)
+{
+ // check the type
+ switch(cargo_type)
+ {
+ case DAD_TEXTURE:
+ case DAD_SOUND:
+ case DAD_LANDMARK:
+ case DAD_SCRIPT:
+ case DAD_OBJECT:
+ case DAD_NOTECARD:
+ case DAD_CLOTHING:
+ case DAD_BODYPART:
+ case DAD_ANIMATION:
+ case DAD_GESTURE:
+ case DAD_CALLINGCARD:
+ case DAD_MESH:
+ case DAD_CATEGORY:
case DAD_SETTINGS:
case DAD_MATERIAL:
- {
- LLInventoryObject* inv_obj = (LLInventoryObject*)cargo_data;
- if(gInventory.getCategory(inv_obj->getUUID()) || (gInventory.getItem(inv_obj->getUUID())
- && LLGiveInventory::isInventoryGiveAcceptable(dynamic_cast<LLInventoryItem*>(inv_obj))))
- {
- // *TODO: get multiple object transfers working
- *accept = ACCEPT_YES_COPY_SINGLE;
- if(drop)
- {
- LLIMModel::LLIMSession * session = LLIMModel::instance().findIMSession(session_id);
-
- // If no IM session found get the destination agent's name by id.
- if (NULL == session)
- {
- LLAvatarName av_name;
-
- // If destination agent's name is found in cash proceed to showing the confirmation dialog.
- // Otherwise set up a callback to show the dialog when the name arrives.
- if (LLAvatarNameCache::get(dest_agent, &av_name))
- {
- show_object_sharing_confirmation(av_name.getUserName(), inv_obj, dest, dest_agent, LLUUID::null);
- }
- else
- {
- LLAvatarNameCache::get(dest_agent, boost::bind(&get_name_cb, _1, _2, inv_obj, dest, dest_agent));
- }
-
- return true;
- }
- std::string dest_name = session->mName;
- LLAvatarName av_name;
- if(LLAvatarNameCache::get(dest_agent, &av_name))
- {
- dest_name = av_name.getCompleteName();
- }
- // If an IM session with destination agent is found item offer will be logged in this session.
- show_object_sharing_confirmation(dest_name, inv_obj, dest, dest_agent, session_id);
- }
- }
- else
- {
- // It's not in the user's inventory (it's probably
- // in an object's contents), so disallow dragging
- // it here. You can't give something you don't
- // yet have.
- *accept = ACCEPT_NO;
- }
- break;
- }
- default:
- *accept = ACCEPT_NO;
- break;
- }
-
- return TRUE;
+ {
+ LLInventoryObject* inv_obj = (LLInventoryObject*)cargo_data;
+ if(gInventory.getCategory(inv_obj->getUUID()) || (gInventory.getItem(inv_obj->getUUID())
+ && LLGiveInventory::isInventoryGiveAcceptable(dynamic_cast<LLInventoryItem*>(inv_obj))))
+ {
+ // *TODO: get multiple object transfers working
+ *accept = ACCEPT_YES_COPY_SINGLE;
+ if(drop)
+ {
+ LLIMModel::LLIMSession * session = LLIMModel::instance().findIMSession(session_id);
+
+ // If no IM session found get the destination agent's name by id.
+ if (NULL == session)
+ {
+ LLAvatarName av_name;
+
+ // If destination agent's name is found in cash proceed to showing the confirmation dialog.
+ // Otherwise set up a callback to show the dialog when the name arrives.
+ if (LLAvatarNameCache::get(dest_agent, &av_name))
+ {
+ show_object_sharing_confirmation(av_name.getUserName(), inv_obj, dest, dest_agent, LLUUID::null);
+ }
+ else
+ {
+ LLAvatarNameCache::get(dest_agent, boost::bind(&get_name_cb, _1, _2, inv_obj, dest, dest_agent));
+ }
+
+ return true;
+ }
+ std::string dest_name = session->mName;
+ LLAvatarName av_name;
+ if(LLAvatarNameCache::get(dest_agent, &av_name))
+ {
+ dest_name = av_name.getCompleteName();
+ }
+ // If an IM session with destination agent is found item offer will be logged in this session.
+ show_object_sharing_confirmation(dest_name, inv_obj, dest, dest_agent, session_id);
+ }
+ }
+ else
+ {
+ // It's not in the user's inventory (it's probably
+ // in an object's contents), so disallow dragging
+ // it here. You can't give something you don't
+ // yet have.
+ *accept = ACCEPT_NO;
+ }
+ break;
+ }
+ default:
+ *accept = ACCEPT_NO;
+ break;
+ }
+
+ return TRUE;
}
@@ -2066,278 +2066,278 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
///
EAcceptance LLToolDragAndDrop::dad3dNULL(
- LLViewerObject*, S32, MASK, BOOL)
+ LLViewerObject*, S32, MASK, BOOL)
{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dNULL()" << LL_ENDL;
- return ACCEPT_NO;
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dNULL()" << LL_ENDL;
+ return ACCEPT_NO;
}
EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << LL_ENDL;
- // must be in the user's inventory
- if(mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY)
- {
- return ACCEPT_NO;
- }
-
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
-
- // must not be in the trash
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
- {
- return ACCEPT_NO;
- }
-
- // must not be already wearing it
- LLVOAvatarSelf* avatar = gAgentAvatarp;
- if( !avatar || avatar->isWearingAttachment(item->getUUID()) )
- {
- return ACCEPT_NO;
- }
-
- const LLUUID &outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX);
- if(outbox_id.notNull() && gInventory.isObjectDescendentOf(item->getUUID(), outbox_id))
- {
- // Legacy
- return ACCEPT_NO;
- }
-
-
- if( drop )
- {
- if(mSource == SOURCE_LIBRARY)
- {
- LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0));
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- LLUUID::null,
- std::string(),
- cb);
- }
- else
- {
- rez_attachment(item, 0);
- }
- }
- return ACCEPT_YES_SINGLE;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << LL_ENDL;
+ // must be in the user's inventory
+ if(mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY)
+ {
+ return ACCEPT_NO;
+ }
+
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+
+ // must not be in the trash
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
+ {
+ return ACCEPT_NO;
+ }
+
+ // must not be already wearing it
+ LLVOAvatarSelf* avatar = gAgentAvatarp;
+ if( !avatar || avatar->isWearingAttachment(item->getUUID()) )
+ {
+ return ACCEPT_NO;
+ }
+
+ const LLUUID &outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX);
+ if(outbox_id.notNull() && gInventory.isObjectDescendentOf(item->getUUID(), outbox_id))
+ {
+ // Legacy
+ return ACCEPT_NO;
+ }
+
+
+ if( drop )
+ {
+ if(mSource == SOURCE_LIBRARY)
+ {
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0));
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ else
+ {
+ rez_attachment(item, 0);
+ }
+ }
+ return ACCEPT_YES_SINGLE;
}
EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- if (mSource == SOURCE_WORLD)
- {
- return dad3dRezFromObjectOnLand(obj, face, mask, drop);
- }
-
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezObjectOnLand()" << LL_ENDL;
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
-
- LLVOAvatarSelf* my_avatar = gAgentAvatarp;
- if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
- {
- return ACCEPT_NO;
- }
-
- EAcceptance accept;
- BOOL remove_inventory;
-
- // Get initial settings based on shift key
- if (mask & MASK_SHIFT)
- {
- // For now, always make copy
- //accept = ACCEPT_YES_SINGLE;
- //remove_inventory = TRUE;
- accept = ACCEPT_YES_COPY_SINGLE;
- remove_inventory = FALSE;
- }
- else
- {
- accept = ACCEPT_YES_COPY_SINGLE;
- remove_inventory = FALSE;
- }
-
- // check if the item can be copied. If not, send that to the sim
- // which will remove the inventory item.
- if(!item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- accept = ACCEPT_YES_SINGLE;
- remove_inventory = TRUE;
- }
-
- // Check if it's in the trash.
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
- {
- accept = ACCEPT_YES_SINGLE;
- }
-
- if(drop)
- {
- dropObject(obj, TRUE, FALSE, remove_inventory);
- }
-
- return accept;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ if (mSource == SOURCE_WORLD)
+ {
+ return dad3dRezFromObjectOnLand(obj, face, mask, drop);
+ }
+
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezObjectOnLand()" << LL_ENDL;
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+
+ LLVOAvatarSelf* my_avatar = gAgentAvatarp;
+ if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
+ {
+ return ACCEPT_NO;
+ }
+
+ EAcceptance accept;
+ BOOL remove_inventory;
+
+ // Get initial settings based on shift key
+ if (mask & MASK_SHIFT)
+ {
+ // For now, always make copy
+ //accept = ACCEPT_YES_SINGLE;
+ //remove_inventory = TRUE;
+ accept = ACCEPT_YES_COPY_SINGLE;
+ remove_inventory = FALSE;
+ }
+ else
+ {
+ accept = ACCEPT_YES_COPY_SINGLE;
+ remove_inventory = FALSE;
+ }
+
+ // check if the item can be copied. If not, send that to the sim
+ // which will remove the inventory item.
+ if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ accept = ACCEPT_YES_SINGLE;
+ remove_inventory = TRUE;
+ }
+
+ // Check if it's in the trash.
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+ {
+ accept = ACCEPT_YES_SINGLE;
+ }
+
+ if(drop)
+ {
+ dropObject(obj, TRUE, FALSE, remove_inventory);
+ }
+
+ return accept;
}
EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- // handle objects coming from object inventory
- if (mSource == SOURCE_WORLD)
- {
- return dad3dRezFromObjectOnObject(obj, face, mask, drop);
- }
-
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezObjectOnObject()" << LL_ENDL;
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
- LLVOAvatarSelf* my_avatar = gAgentAvatarp;
- if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
- {
- return ACCEPT_NO;
- }
-
- if((mask & MASK_CONTROL))
- {
- // *HACK: In order to resolve SL-22177, we need to block drags
- // from notecards and objects onto other objects.
- if(mSource == SOURCE_NOTECARD)
- {
- return ACCEPT_NO;
- }
-
- EAcceptance rv = willObjectAcceptInventory(obj, item);
- if(drop && (ACCEPT_YES_SINGLE <= rv))
- {
- dropInventory(obj, item, mSource, mSourceID);
- }
- return rv;
- }
-
- EAcceptance accept;
- BOOL remove_inventory;
-
- if (mask & MASK_SHIFT)
- {
- // For now, always make copy
- //accept = ACCEPT_YES_SINGLE;
- //remove_inventory = TRUE;
- accept = ACCEPT_YES_COPY_SINGLE;
- remove_inventory = FALSE;
- }
- else
- {
- accept = ACCEPT_YES_COPY_SINGLE;
- remove_inventory = FALSE;
- }
-
- // check if the item can be copied. If not, send that to the sim
- // which will remove the inventory item.
- if(!item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- accept = ACCEPT_YES_SINGLE;
- remove_inventory = TRUE;
- }
-
- // Check if it's in the trash.
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
- {
- accept = ACCEPT_YES_SINGLE;
- remove_inventory = TRUE;
- }
-
- if(drop)
- {
- dropObject(obj, FALSE, FALSE, remove_inventory);
- }
-
- return accept;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ // handle objects coming from object inventory
+ if (mSource == SOURCE_WORLD)
+ {
+ return dad3dRezFromObjectOnObject(obj, face, mask, drop);
+ }
+
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezObjectOnObject()" << LL_ENDL;
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ LLVOAvatarSelf* my_avatar = gAgentAvatarp;
+ if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
+ {
+ return ACCEPT_NO;
+ }
+
+ if((mask & MASK_CONTROL))
+ {
+ // *HACK: In order to resolve SL-22177, we need to block drags
+ // from notecards and objects onto other objects.
+ if(mSource == SOURCE_NOTECARD)
+ {
+ return ACCEPT_NO;
+ }
+
+ EAcceptance rv = willObjectAcceptInventory(obj, item);
+ if(drop && (ACCEPT_YES_SINGLE <= rv))
+ {
+ dropInventory(obj, item, mSource, mSourceID);
+ }
+ return rv;
+ }
+
+ EAcceptance accept;
+ BOOL remove_inventory;
+
+ if (mask & MASK_SHIFT)
+ {
+ // For now, always make copy
+ //accept = ACCEPT_YES_SINGLE;
+ //remove_inventory = TRUE;
+ accept = ACCEPT_YES_COPY_SINGLE;
+ remove_inventory = FALSE;
+ }
+ else
+ {
+ accept = ACCEPT_YES_COPY_SINGLE;
+ remove_inventory = FALSE;
+ }
+
+ // check if the item can be copied. If not, send that to the sim
+ // which will remove the inventory item.
+ if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ accept = ACCEPT_YES_SINGLE;
+ remove_inventory = TRUE;
+ }
+
+ // Check if it's in the trash.
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+ {
+ accept = ACCEPT_YES_SINGLE;
+ remove_inventory = TRUE;
+ }
+
+ if(drop)
+ {
+ dropObject(obj, FALSE, FALSE, remove_inventory);
+ }
+
+ return accept;
}
EAcceptance LLToolDragAndDrop::dad3dRezScript(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezScript()" << LL_ENDL;
-
- // *HACK: In order to resolve SL-22177, we need to block drags
- // from notecards and objects onto other objects.
- if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
- {
- return ACCEPT_NO;
- }
-
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
- EAcceptance rv = willObjectAcceptInventory(obj, item);
- if(drop && (ACCEPT_YES_SINGLE <= rv))
- {
- // rez in the script active by default, rez in inactive if the
- // control key is being held down.
- BOOL active = ((mask & MASK_CONTROL) == 0);
-
- LLViewerObject* root_object = obj;
- if (obj && obj->getParent())
- {
- LLViewerObject* parent_obj = (LLViewerObject*)obj->getParent();
- if (!parent_obj->isAvatar())
- {
- root_object = parent_obj;
- }
- }
-
- dropScript(root_object, item, active, mSource, mSourceID);
- }
- return rv;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezScript()" << LL_ENDL;
+
+ // *HACK: In order to resolve SL-22177, we need to block drags
+ // from notecards and objects onto other objects.
+ if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
+ {
+ return ACCEPT_NO;
+ }
+
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ EAcceptance rv = willObjectAcceptInventory(obj, item);
+ if(drop && (ACCEPT_YES_SINGLE <= rv))
+ {
+ // rez in the script active by default, rez in inactive if the
+ // control key is being held down.
+ BOOL active = ((mask & MASK_CONTROL) == 0);
+
+ LLViewerObject* root_object = obj;
+ if (obj && obj->getParent())
+ {
+ LLViewerObject* parent_obj = (LLViewerObject*)obj->getParent();
+ if (!parent_obj->isAvatar())
+ {
+ root_object = parent_obj;
+ }
+ }
+
+ dropScript(root_object, item, active, mSource, mSourceID);
+ }
+ return rv;
}
EAcceptance LLToolDragAndDrop::dad3dApplyToObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop, EDragAndDropType cargo_type)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dApplyToObject()" << LL_ENDL;
-
- // *HACK: In order to resolve SL-22177, we need to block drags
- // from notecards and objects onto other objects.
- if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
- {
- return ACCEPT_NO;
- }
-
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop, EDragAndDropType cargo_type)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dApplyToObject()" << LL_ENDL;
+
+ // *HACK: In order to resolve SL-22177, we need to block drags
+ // from notecards and objects onto other objects.
+ if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
+ {
+ return ACCEPT_NO;
+ }
+
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
LLPermissions item_permissions = item->getPermissions();
- EAcceptance rv = willObjectAcceptInventory(obj, item);
- if((mask & MASK_CONTROL))
- {
- if((ACCEPT_YES_SINGLE <= rv) && drop)
- {
- dropInventory(obj, item, mSource, mSourceID);
- }
- return rv;
- }
- if(!obj->permModify())
- {
- return ACCEPT_NO_LOCKED;
- }
+ EAcceptance rv = willObjectAcceptInventory(obj, item);
+ if((mask & MASK_CONTROL))
+ {
+ if((ACCEPT_YES_SINGLE <= rv) && drop)
+ {
+ dropInventory(obj, item, mSource, mSourceID);
+ }
+ return rv;
+ }
+ if(!obj->permModify())
+ {
+ return ACCEPT_NO_LOCKED;
+ }
if (cargo_type == DAD_TEXTURE && (mask & MASK_ALT) == 0)
{
@@ -2369,10 +2369,10 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject(
}
}
- if(drop && (ACCEPT_YES_SINGLE <= rv))
- {
- if (cargo_type == DAD_TEXTURE)
- {
+ if(drop && (ACCEPT_YES_SINGLE <= rv))
+ {
+ if (cargo_type == DAD_TEXTURE)
+ {
bool all_faces = mask & MASK_SHIFT;
bool remove_pbr = mask & MASK_ALT;
if (item_permissions.allowOperationBy(PERM_COPY, gAgent.getID()))
@@ -2394,7 +2394,7 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject(
dropTexture(obj, face, item, source, source_id, all_faces, remove_pbr);
});
}
- }
+ }
else if (cargo_type == DAD_MATERIAL)
{
bool all_faces = mask & MASK_SHIFT;
@@ -2418,32 +2418,32 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject(
});
}
}
- else if (cargo_type == DAD_MESH)
- {
- dropMesh(obj, item, mSource, mSourceID);
- }
- else
- {
- LL_WARNS() << "unsupported asset type" << LL_ENDL;
- }
-
- // VEFFECT: SetTexture
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgentAvatarp);
- effectp->setTargetObject(obj);
- effectp->setDuration(LL_HUD_DUR_SHORT);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- }
+ else if (cargo_type == DAD_MESH)
+ {
+ dropMesh(obj, item, mSource, mSourceID);
+ }
+ else
+ {
+ LL_WARNS() << "unsupported asset type" << LL_ENDL;
+ }
- // enable multi-drop, although last texture will win
- return ACCEPT_YES_MULTI;
+ // VEFFECT: SetTexture
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ effectp->setSourceObject(gAgentAvatarp);
+ effectp->setTargetObject(obj);
+ effectp->setDuration(LL_HUD_DUR_SHORT);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ }
+
+ // enable multi-drop, although last texture will win
+ return ACCEPT_YES_MULTI;
}
EAcceptance LLToolDragAndDrop::dad3dTextureObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
{
- return dad3dApplyToObject(obj, face, mask, drop, DAD_TEXTURE);
+ return dad3dApplyToObject(obj, face, mask, drop, DAD_TEXTURE);
}
EAcceptance LLToolDragAndDrop::dad3dMaterialObject(
@@ -2453,506 +2453,506 @@ EAcceptance LLToolDragAndDrop::dad3dMaterialObject(
}
EAcceptance LLToolDragAndDrop::dad3dMeshObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
{
- return dad3dApplyToObject(obj, face, mask, drop, DAD_MESH);
+ return dad3dApplyToObject(obj, face, mask, drop, DAD_MESH);
}
EAcceptance LLToolDragAndDrop::dad3dWearItem(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearItem()" << LL_ENDL;
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
-
- if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
- {
- // it's in the agent inventory
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
- {
- return ACCEPT_NO;
- }
-
- if( drop )
- {
- // TODO: investigate wearables may not be loaded at this point EXT-8231
-
- LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(),true, !(mask & MASK_CONTROL));
- }
- return ACCEPT_YES_MULTI;
- }
- else
- {
- // TODO: copy/move item to avatar's inventory and then wear it.
- return ACCEPT_NO;
- }
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearItem()" << LL_ENDL;
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+
+ if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
+ {
+ // it's in the agent inventory
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
+ {
+ return ACCEPT_NO;
+ }
+
+ if( drop )
+ {
+ // TODO: investigate wearables may not be loaded at this point EXT-8231
+
+ LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(),true, !(mask & MASK_CONTROL));
+ }
+ return ACCEPT_YES_MULTI;
+ }
+ else
+ {
+ // TODO: copy/move item to avatar's inventory and then wear it.
+ return ACCEPT_NO;
+ }
}
EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dActivateGesture()" << LL_ENDL;
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
-
- if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
- {
- // it's in the agent inventory
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
- {
- return ACCEPT_NO;
- }
-
- if( drop )
- {
- LLUUID item_id;
- if(mSource == SOURCE_LIBRARY)
- {
- // create item based on that one, and put it on if that
- // was a success.
- LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(activate_gesture_cb);
- copy_inventory_item(
- gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- LLUUID::null,
- std::string(),
- cb);
- }
- else
- {
- LLGestureMgr::instance().activateGesture(item->getUUID());
- gInventory.updateItem(item);
- gInventory.notifyObservers();
- }
- }
- return ACCEPT_YES_MULTI;
- }
- else
- {
- return ACCEPT_NO;
- }
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dActivateGesture()" << LL_ENDL;
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+
+ if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
+ {
+ // it's in the agent inventory
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
+ {
+ return ACCEPT_NO;
+ }
+
+ if( drop )
+ {
+ LLUUID item_id;
+ if(mSource == SOURCE_LIBRARY)
+ {
+ // create item based on that one, and put it on if that
+ // was a success.
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(activate_gesture_cb);
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ else
+ {
+ LLGestureMgr::instance().activateGesture(item->getUUID());
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+ }
+ return ACCEPT_YES_MULTI;
+ }
+ else
+ {
+ return ACCEPT_NO;
+ }
}
EAcceptance LLToolDragAndDrop::dad3dWearCategory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearCategory()" << LL_ENDL;
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* category;
- locateInventory(item, category);
- if(!category) return ACCEPT_NO;
-
- if (drop)
- {
- // TODO: investigate wearables may not be loaded at this point EXT-8231
- }
-
- U32 max_items = gSavedSettings.getU32("WearFolderLimit");
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
- gInventory.collectDescendentsIf(category->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- not_worn);
- if (items.size() > max_items)
- {
- LLStringUtil::format_map_t args;
- args["AMOUNT"] = llformat("%d", max_items);
- mCustomMsg = LLTrans::getString("TooltipTooManyWearables",args);
- return ACCEPT_NO_CUSTOM;
- }
-
- if(mSource == SOURCE_AGENT)
- {
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if( gInventory.isObjectDescendentOf( category->getUUID(), trash_id ) )
- {
- return ACCEPT_NO;
- }
-
- const LLUUID &outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX);
- if(outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id))
- {
- // Legacy
- return ACCEPT_NO;
- }
-
- if(drop)
- {
- BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE );
- LLAppearanceMgr::instance().wearInventoryCategory(category, false, append);
- }
- return ACCEPT_YES_MULTI;
- }
- else if(mSource == SOURCE_LIBRARY)
- {
- if(drop)
- {
- LLAppearanceMgr::instance().wearInventoryCategory(category, true, false);
- }
- return ACCEPT_YES_MULTI;
- }
- else
- {
- // TODO: copy/move category to avatar's inventory and then wear it.
- return ACCEPT_NO;
- }
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearCategory()" << LL_ENDL;
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* category;
+ locateInventory(item, category);
+ if(!category) return ACCEPT_NO;
+
+ if (drop)
+ {
+ // TODO: investigate wearables may not be loaded at this point EXT-8231
+ }
+
+ U32 max_items = gSavedSettings.getU32("WearFolderLimit");
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
+ gInventory.collectDescendentsIf(category->getUUID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ not_worn);
+ if (items.size() > max_items)
+ {
+ LLStringUtil::format_map_t args;
+ args["AMOUNT"] = llformat("%d", max_items);
+ mCustomMsg = LLTrans::getString("TooltipTooManyWearables",args);
+ return ACCEPT_NO_CUSTOM;
+ }
+
+ if(mSource == SOURCE_AGENT)
+ {
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if( gInventory.isObjectDescendentOf( category->getUUID(), trash_id ) )
+ {
+ return ACCEPT_NO;
+ }
+
+ const LLUUID &outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX);
+ if(outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id))
+ {
+ // Legacy
+ return ACCEPT_NO;
+ }
+
+ if(drop)
+ {
+ BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE );
+ LLAppearanceMgr::instance().wearInventoryCategory(category, false, append);
+ }
+ return ACCEPT_YES_MULTI;
+ }
+ else if(mSource == SOURCE_LIBRARY)
+ {
+ if(drop)
+ {
+ LLAppearanceMgr::instance().wearInventoryCategory(category, true, false);
+ }
+ return ACCEPT_YES_MULTI;
+ }
+ else
+ {
+ // TODO: copy/move category to avatar's inventory and then wear it.
+ return ACCEPT_NO;
+ }
}
EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dadUpdateInventory()" << LL_ENDL;
-
- // *HACK: In order to resolve SL-22177, we need to block drags
- // from notecards and objects onto other objects.
- if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
- {
- return ACCEPT_NO;
- }
-
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
- LLViewerObject* root_object = obj;
- if (obj && obj->getParent())
- {
- LLViewerObject* parent_obj = (LLViewerObject*)obj->getParent();
- if (!parent_obj->isAvatar())
- {
- root_object = parent_obj;
- }
- }
-
- EAcceptance rv = willObjectAcceptInventory(root_object, item);
- if(root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
- {
- dropInventory(root_object, item, mSource, mSourceID);
- }
- return rv;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dadUpdateInventory()" << LL_ENDL;
+
+ // *HACK: In order to resolve SL-22177, we need to block drags
+ // from notecards and objects onto other objects.
+ if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
+ {
+ return ACCEPT_NO;
+ }
+
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ LLViewerObject* root_object = obj;
+ if (obj && obj->getParent())
+ {
+ LLViewerObject* parent_obj = (LLViewerObject*)obj->getParent();
+ if (!parent_obj->isAvatar())
+ {
+ root_object = parent_obj;
+ }
+ }
+
+ EAcceptance rv = willObjectAcceptInventory(root_object, item);
+ if(root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
+ {
+ dropInventory(root_object, item, mSource, mSourceID);
+ }
+ return rv;
}
BOOL LLToolDragAndDrop::dadUpdateInventory(LLViewerObject* obj, BOOL drop)
{
- EAcceptance rv = dad3dUpdateInventory(obj, -1, MASK_NONE, drop);
- return (rv >= ACCEPT_YES_COPY_SINGLE);
+ EAcceptance rv = dad3dUpdateInventory(obj, -1, MASK_NONE, drop);
+ return (rv >= ACCEPT_YES_COPY_SINGLE);
}
EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dUpdateInventoryCategory()" << LL_ENDL;
- if (obj == NULL)
- {
- LL_WARNS() << "obj is NULL; aborting func with ACCEPT_NO" << LL_ENDL;
- return ACCEPT_NO;
- }
-
- if ((mSource != SOURCE_AGENT) && (mSource != SOURCE_LIBRARY))
- {
- return ACCEPT_NO;
- }
- if (obj->isAttachment())
- {
- return ACCEPT_NO_LOCKED;
- }
-
- LLViewerInventoryItem* item = NULL;
- LLViewerInventoryCategory* cat = NULL;
- locateInventory(item, cat);
- if (!cat)
- {
- return ACCEPT_NO;
- }
-
- // Find all the items in the category
- LLDroppableItem droppable(!obj->permYouOwner());
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendentsIf(cat->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- droppable);
- cats.push_back(cat);
- if (droppable.countNoCopy() > 0)
- {
- LL_WARNS() << "*** Need to confirm this step" << LL_ENDL;
- }
- LLViewerObject* root_object = obj;
- if (obj->getParent())
- {
- LLViewerObject* parent_obj = (LLViewerObject*)obj->getParent();
- if (!parent_obj->isAvatar())
- {
- root_object = parent_obj;
- }
- }
-
- EAcceptance rv = ACCEPT_NO;
-
- // Check for accept
- for (LLInventoryModel::cat_array_t::const_iterator cat_iter = cats.begin();
- cat_iter != cats.end();
- ++cat_iter)
- {
- const LLViewerInventoryCategory *cat = (*cat_iter);
- rv = gInventory.isCategoryComplete(cat->getUUID()) ? ACCEPT_YES_MULTI : ACCEPT_NO;
- if(rv < ACCEPT_YES_SINGLE)
- {
- LL_DEBUGS() << "Category " << cat->getUUID() << "is not complete." << LL_ENDL;
- break;
- }
- }
- if (ACCEPT_YES_COPY_SINGLE <= rv)
- {
- for (LLInventoryModel::item_array_t::const_iterator item_iter = items.begin();
- item_iter != items.end();
- ++item_iter)
- {
- LLViewerInventoryItem *item = (*item_iter);
- /*
- // Pass the base objects, not the links.
- if (item && item->getIsLinkType())
- {
- item = item->getLinkedItem();
- (*item_iter) = item;
- }
- */
- rv = willObjectAcceptInventory(root_object, item, DAD_CATEGORY);
- if (rv < ACCEPT_YES_COPY_SINGLE)
- {
- LL_DEBUGS() << "Object will not accept " << item->getUUID() << LL_ENDL;
- break;
- }
- }
- }
-
- // If every item is accepted, send it on
- if (drop && (ACCEPT_YES_COPY_SINGLE <= rv))
- {
- uuid_vec_t ids;
- for (LLInventoryModel::item_array_t::const_iterator item_iter = items.begin();
- item_iter != items.end();
- ++item_iter)
- {
- const LLViewerInventoryItem *item = (*item_iter);
- ids.push_back(item->getUUID());
- }
- LLCategoryDropObserver* dropper = new LLCategoryDropObserver(ids, obj->getID(), mSource);
- dropper->startFetch();
- if (dropper->isFinished())
- {
- dropper->done();
- }
- else
- {
- gInventory.addObserver(dropper);
- }
- }
- return rv;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dUpdateInventoryCategory()" << LL_ENDL;
+ if (obj == NULL)
+ {
+ LL_WARNS() << "obj is NULL; aborting func with ACCEPT_NO" << LL_ENDL;
+ return ACCEPT_NO;
+ }
+
+ if ((mSource != SOURCE_AGENT) && (mSource != SOURCE_LIBRARY))
+ {
+ return ACCEPT_NO;
+ }
+ if (obj->isAttachment())
+ {
+ return ACCEPT_NO_LOCKED;
+ }
+
+ LLViewerInventoryItem* item = NULL;
+ LLViewerInventoryCategory* cat = NULL;
+ locateInventory(item, cat);
+ if (!cat)
+ {
+ return ACCEPT_NO;
+ }
+
+ // Find all the items in the category
+ LLDroppableItem droppable(!obj->permYouOwner());
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendentsIf(cat->getUUID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ droppable);
+ cats.push_back(cat);
+ if (droppable.countNoCopy() > 0)
+ {
+ LL_WARNS() << "*** Need to confirm this step" << LL_ENDL;
+ }
+ LLViewerObject* root_object = obj;
+ if (obj->getParent())
+ {
+ LLViewerObject* parent_obj = (LLViewerObject*)obj->getParent();
+ if (!parent_obj->isAvatar())
+ {
+ root_object = parent_obj;
+ }
+ }
+
+ EAcceptance rv = ACCEPT_NO;
+
+ // Check for accept
+ for (LLInventoryModel::cat_array_t::const_iterator cat_iter = cats.begin();
+ cat_iter != cats.end();
+ ++cat_iter)
+ {
+ const LLViewerInventoryCategory *cat = (*cat_iter);
+ rv = gInventory.isCategoryComplete(cat->getUUID()) ? ACCEPT_YES_MULTI : ACCEPT_NO;
+ if(rv < ACCEPT_YES_SINGLE)
+ {
+ LL_DEBUGS() << "Category " << cat->getUUID() << "is not complete." << LL_ENDL;
+ break;
+ }
+ }
+ if (ACCEPT_YES_COPY_SINGLE <= rv)
+ {
+ for (LLInventoryModel::item_array_t::const_iterator item_iter = items.begin();
+ item_iter != items.end();
+ ++item_iter)
+ {
+ LLViewerInventoryItem *item = (*item_iter);
+ /*
+ // Pass the base objects, not the links.
+ if (item && item->getIsLinkType())
+ {
+ item = item->getLinkedItem();
+ (*item_iter) = item;
+ }
+ */
+ rv = willObjectAcceptInventory(root_object, item, DAD_CATEGORY);
+ if (rv < ACCEPT_YES_COPY_SINGLE)
+ {
+ LL_DEBUGS() << "Object will not accept " << item->getUUID() << LL_ENDL;
+ break;
+ }
+ }
+ }
+
+ // If every item is accepted, send it on
+ if (drop && (ACCEPT_YES_COPY_SINGLE <= rv))
+ {
+ uuid_vec_t ids;
+ for (LLInventoryModel::item_array_t::const_iterator item_iter = items.begin();
+ item_iter != items.end();
+ ++item_iter)
+ {
+ const LLViewerInventoryItem *item = (*item_iter);
+ ids.push_back(item->getUUID());
+ }
+ LLCategoryDropObserver* dropper = new LLCategoryDropObserver(ids, obj->getID(), mSource);
+ dropper->startFetch();
+ if (dropper->isFinished())
+ {
+ dropper->done();
+ }
+ else
+ {
+ gInventory.addObserver(dropper);
+ }
+ }
+ return rv;
}
EAcceptance LLToolDragAndDrop::dad3dRezCategoryOnObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
{
- if ((mask & MASK_CONTROL))
- {
- return dad3dUpdateInventoryCategory(obj, face, mask, drop);
- }
- else
- {
- return ACCEPT_NO;
- }
+ if ((mask & MASK_CONTROL))
+ {
+ return dad3dUpdateInventoryCategory(obj, face, mask, drop);
+ }
+ else
+ {
+ return ACCEPT_NO;
+ }
}
BOOL LLToolDragAndDrop::dadUpdateInventoryCategory(LLViewerObject* obj,
- BOOL drop)
+ BOOL drop)
{
- EAcceptance rv = dad3dUpdateInventoryCategory(obj, -1, MASK_NONE, drop);
- return (rv >= ACCEPT_YES_COPY_SINGLE);
+ EAcceptance rv = dad3dUpdateInventoryCategory(obj, -1, MASK_NONE, drop);
+ return (rv >= ACCEPT_YES_COPY_SINGLE);
}
EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << LL_ENDL;
-
- // item has to be in agent inventory.
- if(mSource != SOURCE_AGENT) return ACCEPT_NO;
-
- // find the item now.
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
- if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
- {
- // cannot give away no-transfer objects
- return ACCEPT_NO;
- }
- LLVOAvatarSelf* avatar = gAgentAvatarp;
- if(avatar && avatar->isWearingAttachment( item->getUUID() ) )
- {
- // You can't give objects that are attached to you
- return ACCEPT_NO;
- }
- if( obj && avatar )
- {
- if(drop)
- {
- LLGiveInventory::doGiveInventoryItem(obj->getID(), item );
- }
- // *TODO: deal with all the issues surrounding multi-object
- // inventory transfers.
- return ACCEPT_YES_SINGLE;
- }
- return ACCEPT_NO;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << LL_ENDL;
+
+ // item has to be in agent inventory.
+ if(mSource != SOURCE_AGENT) return ACCEPT_NO;
+
+ // find the item now.
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+ {
+ // cannot give away no-transfer objects
+ return ACCEPT_NO;
+ }
+ LLVOAvatarSelf* avatar = gAgentAvatarp;
+ if(avatar && avatar->isWearingAttachment( item->getUUID() ) )
+ {
+ // You can't give objects that are attached to you
+ return ACCEPT_NO;
+ }
+ if( obj && avatar )
+ {
+ if(drop)
+ {
+ LLGiveInventory::doGiveInventoryItem(obj->getID(), item );
+ }
+ // *TODO: deal with all the issues surrounding multi-object
+ // inventory transfers.
+ return ACCEPT_YES_SINGLE;
+ }
+ return ACCEPT_NO;
}
EAcceptance LLToolDragAndDrop::dad3dGiveInventory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventory()" << LL_ENDL;
- // item has to be in agent inventory.
- if(mSource != SOURCE_AGENT) return ACCEPT_NO;
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
- if (!LLGiveInventory::isInventoryGiveAcceptable(item))
- {
- return ACCEPT_NO;
- }
- if (drop && obj)
- {
- LLGiveInventory::doGiveInventoryItem(obj->getID(), item);
- }
- // *TODO: deal with all the issues surrounding multi-object
- // inventory transfers.
- return ACCEPT_YES_SINGLE;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventory()" << LL_ENDL;
+ // item has to be in agent inventory.
+ if(mSource != SOURCE_AGENT) return ACCEPT_NO;
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ if (!LLGiveInventory::isInventoryGiveAcceptable(item))
+ {
+ return ACCEPT_NO;
+ }
+ if (drop && obj)
+ {
+ LLGiveInventory::doGiveInventoryItem(obj->getID(), item);
+ }
+ // *TODO: deal with all the issues surrounding multi-object
+ // inventory transfers.
+ return ACCEPT_YES_SINGLE;
}
EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << LL_ENDL;
- if(drop && obj)
- {
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if(!cat) return ACCEPT_NO;
- LLGiveInventory::doGiveInventoryCategory(obj->getID(), cat);
- }
- // *TODO: deal with all the issues surrounding multi-object
- // inventory transfers.
- return ACCEPT_YES_SINGLE;
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << LL_ENDL;
+ if(drop && obj)
+ {
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if(!cat) return ACCEPT_NO;
+ LLGiveInventory::doGiveInventoryCategory(obj->getID(), cat);
+ }
+ // *TODO: deal with all the issues surrounding multi-object
+ // inventory transfers.
+ return ACCEPT_YES_SINGLE;
}
EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnLand()" << LL_ENDL;
- LLViewerInventoryItem* item = NULL;
- LLViewerInventoryCategory* cat = NULL;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
-
- if(!gAgent.allowOperation(PERM_COPY, item->getPermissions())
- || !item->getPermissions().allowTransferTo(LLUUID::null))
- {
- return ACCEPT_NO_LOCKED;
- }
- if(drop)
- {
- dropObject(obj, TRUE, TRUE, FALSE);
- }
- return ACCEPT_YES_SINGLE;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnLand()" << LL_ENDL;
+ LLViewerInventoryItem* item = NULL;
+ LLViewerInventoryCategory* cat = NULL;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+
+ if(!gAgent.allowOperation(PERM_COPY, item->getPermissions())
+ || !item->getPermissions().allowTransferTo(LLUUID::null))
+ {
+ return ACCEPT_NO_LOCKED;
+ }
+ if(drop)
+ {
+ dropObject(obj, TRUE, TRUE, FALSE);
+ }
+ return ACCEPT_YES_SINGLE;
}
EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
-{
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnObject()" << LL_ENDL;
- LLViewerInventoryItem* item;
- LLViewerInventoryCategory* cat;
- locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
- if((mask & MASK_CONTROL))
- {
- // *HACK: In order to resolve SL-22177, we need to block drags
- // from notecards and objects onto other objects.
- return ACCEPT_NO;
-
- // *HACK: uncomment this when appropriate
- //EAcceptance rv = willObjectAcceptInventory(obj, item);
- //if(drop && (ACCEPT_YES_SINGLE <= rv))
- //{
- // dropInventory(obj, item, mSource, mSourceID);
- //}
- //return rv;
- }
- if(!item->getPermissions().allowCopyBy(gAgent.getID(),
- gAgent.getGroupID())
- || !item->getPermissions().allowTransferTo(LLUUID::null))
- {
- return ACCEPT_NO_LOCKED;
- }
- if(drop)
- {
- dropObject(obj, FALSE, TRUE, FALSE);
- }
- return ACCEPT_YES_SINGLE;
+ LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnObject()" << LL_ENDL;
+ LLViewerInventoryItem* item;
+ LLViewerInventoryCategory* cat;
+ locateInventory(item, cat);
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ if((mask & MASK_CONTROL))
+ {
+ // *HACK: In order to resolve SL-22177, we need to block drags
+ // from notecards and objects onto other objects.
+ return ACCEPT_NO;
+
+ // *HACK: uncomment this when appropriate
+ //EAcceptance rv = willObjectAcceptInventory(obj, item);
+ //if(drop && (ACCEPT_YES_SINGLE <= rv))
+ //{
+ // dropInventory(obj, item, mSource, mSourceID);
+ //}
+ //return rv;
+ }
+ if(!item->getPermissions().allowCopyBy(gAgent.getID(),
+ gAgent.getGroupID())
+ || !item->getPermissions().allowTransferTo(LLUUID::null))
+ {
+ return ACCEPT_NO_LOCKED;
+ }
+ if(drop)
+ {
+ dropObject(obj, FALSE, TRUE, FALSE);
+ }
+ return ACCEPT_YES_SINGLE;
}
EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand(
- LLViewerObject *obj, S32 face, MASK mask, BOOL drop)
-{
- return ACCEPT_NO;
- /*
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dCategoryOnLand()" << LL_ENDL;
- LLInventoryItem* item;
- LLInventoryCategory* cat;
- locateInventory(item, cat);
- if(!cat) return ACCEPT_NO;
- EAcceptance rv = ACCEPT_NO;
-
- // find all the items in the category
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLDropCopyableItems droppable;
- gInventory.collectDescendentsIf(cat->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- droppable);
- if(items.size() > 0)
- {
- rv = ACCEPT_YES_SINGLE;
- }
- if((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
- {
- createContainer(items, cat->getName());
- return ACCEPT_NO;
- }
- return rv;
- */
+ LLViewerObject *obj, S32 face, MASK mask, BOOL drop)
+{
+ return ACCEPT_NO;
+ /*
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dCategoryOnLand()" << LL_ENDL;
+ LLInventoryItem* item;
+ LLInventoryCategory* cat;
+ locateInventory(item, cat);
+ if(!cat) return ACCEPT_NO;
+ EAcceptance rv = ACCEPT_NO;
+
+ // find all the items in the category
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLDropCopyableItems droppable;
+ gInventory.collectDescendentsIf(cat->getUUID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ droppable);
+ if(items.size() > 0)
+ {
+ rv = ACCEPT_YES_SINGLE;
+ }
+ if((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
+ {
+ createContainer(items, cat->getName());
+ return ACCEPT_NO;
+ }
+ return rv;
+ */
}
@@ -2960,163 +2960,163 @@ EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand(
// This shortcuts alot of steps to make a basic object
// w/ an inventory and a special permissions set
EAcceptance LLToolDragAndDrop::dad3dAssetOnLand(
- LLViewerObject *obj, S32 face, MASK mask, BOOL drop)
-{
- return ACCEPT_NO;
- /*
- LL_DEBUGS() << "LLToolDragAndDrop::dad3dAssetOnLand()" << LL_ENDL;
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLViewerInventoryItem::item_array_t copyable_items;
- locateMultipleInventory(items, cats);
- if(!items.size()) return ACCEPT_NO;
- EAcceptance rv = ACCEPT_NO;
- for (S32 i = 0; i < items.size(); i++)
- {
- LLInventoryItem* item = items[i];
- if(item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- copyable_items.push_back(item);
- rv = ACCEPT_YES_SINGLE;
- }
- }
-
- if((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
- {
- createContainer(copyable_items, NULL);
- }
-
- return rv;
- */
+ LLViewerObject *obj, S32 face, MASK mask, BOOL drop)
+{
+ return ACCEPT_NO;
+ /*
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dAssetOnLand()" << LL_ENDL;
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLViewerInventoryItem::item_array_t copyable_items;
+ locateMultipleInventory(items, cats);
+ if(!items.size()) return ACCEPT_NO;
+ EAcceptance rv = ACCEPT_NO;
+ for (S32 i = 0; i < items.size(); i++)
+ {
+ LLInventoryItem* item = items[i];
+ if(item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ copyable_items.push_back(item);
+ rv = ACCEPT_YES_SINGLE;
+ }
+ }
+
+ if((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
+ {
+ createContainer(copyable_items, NULL);
+ }
+
+ return rv;
+ */
}
LLInventoryObject* LLToolDragAndDrop::locateInventory(
- LLViewerInventoryItem*& item,
- LLViewerInventoryCategory*& cat)
-{
- item = NULL;
- cat = NULL;
-
- if (mCargoIDs.empty()
- || (mSource == SOURCE_PEOPLE)) ///< There is no inventory item for people drag and drop.
- {
- return NULL;
- }
-
- if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
- {
- // The object should be in user inventory.
- item = (LLViewerInventoryItem*)gInventory.getItem(mCargoIDs[mCurItemIndex]);
- cat = (LLViewerInventoryCategory*)gInventory.getCategory(mCargoIDs[mCurItemIndex]);
- }
- else if(mSource == SOURCE_WORLD)
- {
- // This object is in some task inventory somewhere.
- LLViewerObject* obj = gObjectList.findObject(mSourceID);
- if(obj)
- {
- if((mCargoTypes[mCurItemIndex] == DAD_CATEGORY)
- || (mCargoTypes[mCurItemIndex] == DAD_ROOT_CATEGORY))
- {
- cat = (LLViewerInventoryCategory*)obj->getInventoryObject(mCargoIDs[mCurItemIndex]);
- }
- else
- {
- item = (LLViewerInventoryItem*)obj->getInventoryObject(mCargoIDs[mCurItemIndex]);
- }
- }
- }
- else if(mSource == SOURCE_NOTECARD)
- {
- LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", mSourceID);
- if(preview)
- {
- item = (LLViewerInventoryItem*)preview->getDragItem();
- }
- }
- else if(mSource == SOURCE_VIEWER)
- {
- item = (LLViewerInventoryItem*)gToolBarView->getDragItem();
- }
-
- if(item) return item;
- if(cat) return cat;
- return NULL;
+ LLViewerInventoryItem*& item,
+ LLViewerInventoryCategory*& cat)
+{
+ item = NULL;
+ cat = NULL;
+
+ if (mCargoIDs.empty()
+ || (mSource == SOURCE_PEOPLE)) ///< There is no inventory item for people drag and drop.
+ {
+ return NULL;
+ }
+
+ if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
+ {
+ // The object should be in user inventory.
+ item = (LLViewerInventoryItem*)gInventory.getItem(mCargoIDs[mCurItemIndex]);
+ cat = (LLViewerInventoryCategory*)gInventory.getCategory(mCargoIDs[mCurItemIndex]);
+ }
+ else if(mSource == SOURCE_WORLD)
+ {
+ // This object is in some task inventory somewhere.
+ LLViewerObject* obj = gObjectList.findObject(mSourceID);
+ if(obj)
+ {
+ if((mCargoTypes[mCurItemIndex] == DAD_CATEGORY)
+ || (mCargoTypes[mCurItemIndex] == DAD_ROOT_CATEGORY))
+ {
+ cat = (LLViewerInventoryCategory*)obj->getInventoryObject(mCargoIDs[mCurItemIndex]);
+ }
+ else
+ {
+ item = (LLViewerInventoryItem*)obj->getInventoryObject(mCargoIDs[mCurItemIndex]);
+ }
+ }
+ }
+ else if(mSource == SOURCE_NOTECARD)
+ {
+ LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", mSourceID);
+ if(preview)
+ {
+ item = (LLViewerInventoryItem*)preview->getDragItem();
+ }
+ }
+ else if(mSource == SOURCE_VIEWER)
+ {
+ item = (LLViewerInventoryItem*)gToolBarView->getDragItem();
+ }
+
+ if(item) return item;
+ if(cat) return cat;
+ return NULL;
}
/*
LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryCategory::cat_array_t& cats,
- LLViewerInventoryItem::item_array_t& items)
-{
- if(mCargoIDs.size() == 0) return NULL;
- if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
- {
- // The object should be in user inventory.
- for (S32 i = 0; i < mCargoIDs.size(); i++)
- {
- LLInventoryItem* item = gInventory.getItem(mCargoIDs[i]);
- if (item)
- {
- items.push_back(item);
- }
- LLInventoryCategory* category = gInventory.getCategory(mCargoIDs[i]);
- if (category)
- {
- cats.push_back(category);
- }
- }
- }
- else if(mSource == SOURCE_WORLD)
- {
- // This object is in some task inventory somewhere.
- LLViewerObject* obj = gObjectList.findObject(mSourceID);
- if(obj)
- {
- if((mCargoType == DAD_CATEGORY)
- || (mCargoType == DAD_ROOT_CATEGORY))
- {
- // The object should be in user inventory.
- for (S32 i = 0; i < mCargoIDs.size(); i++)
- {
- LLInventoryCategory* category = (LLInventoryCategory*)obj->getInventoryObject(mCargoIDs[i]);
- if (category)
- {
- cats.push_back(category);
- }
- }
- }
- else
- {
- for (S32 i = 0; i < mCargoIDs.size(); i++)
- {
- LLInventoryItem* item = (LLInventoryItem*)obj->getInventoryObject(mCargoIDs[i]);
- if (item)
- {
- items.push_back(item);
- }
- }
- }
- }
- }
- else if(mSource == SOURCE_NOTECARD)
- {
- LLPreviewNotecard* card;
- card = (LLPreviewNotecard*)LLPreview::find(mSourceID);
- if(card)
- {
- items.push_back((LLInventoryItem*)card->getDragItem());
- }
- }
- if(items.size()) return items[0];
- if(cats.size()) return cats[0];
- return NULL;
+ LLViewerInventoryItem::item_array_t& items)
+{
+ if(mCargoIDs.size() == 0) return NULL;
+ if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
+ {
+ // The object should be in user inventory.
+ for (S32 i = 0; i < mCargoIDs.size(); i++)
+ {
+ LLInventoryItem* item = gInventory.getItem(mCargoIDs[i]);
+ if (item)
+ {
+ items.push_back(item);
+ }
+ LLInventoryCategory* category = gInventory.getCategory(mCargoIDs[i]);
+ if (category)
+ {
+ cats.push_back(category);
+ }
+ }
+ }
+ else if(mSource == SOURCE_WORLD)
+ {
+ // This object is in some task inventory somewhere.
+ LLViewerObject* obj = gObjectList.findObject(mSourceID);
+ if(obj)
+ {
+ if((mCargoType == DAD_CATEGORY)
+ || (mCargoType == DAD_ROOT_CATEGORY))
+ {
+ // The object should be in user inventory.
+ for (S32 i = 0; i < mCargoIDs.size(); i++)
+ {
+ LLInventoryCategory* category = (LLInventoryCategory*)obj->getInventoryObject(mCargoIDs[i]);
+ if (category)
+ {
+ cats.push_back(category);
+ }
+ }
+ }
+ else
+ {
+ for (S32 i = 0; i < mCargoIDs.size(); i++)
+ {
+ LLInventoryItem* item = (LLInventoryItem*)obj->getInventoryObject(mCargoIDs[i]);
+ if (item)
+ {
+ items.push_back(item);
+ }
+ }
+ }
+ }
+ }
+ else if(mSource == SOURCE_NOTECARD)
+ {
+ LLPreviewNotecard* card;
+ card = (LLPreviewNotecard*)LLPreview::find(mSourceID);
+ if(card)
+ {
+ items.push_back((LLInventoryItem*)card->getDragItem());
+ }
+ }
+ if(items.size()) return items[0];
+ if(cats.size()) return cats[0];
+ return NULL;
}
*/
// void LLToolDragAndDrop::createContainer(LLViewerInventoryItem::item_array_t &items, const char* preferred_name )
// {
-// LL_WARNS() << "LLToolDragAndDrop::createContainer()" << LL_ENDL;
-// return;
+// LL_WARNS() << "LLToolDragAndDrop::createContainer()" << LL_ENDL;
+// return;
// }
@@ -3124,13 +3124,13 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC
void pack_permissions_slam(LLMessageSystem* msg, U32 flags, const LLPermissions& perms)
{
- // CRUFT -- the server no longer pays attention to this data
- U32 group_mask = perms.getMaskGroup();
- U32 everyone_mask = perms.getMaskEveryone();
- U32 next_owner_mask = perms.getMaskNextOwner();
-
- msg->addU32Fast(_PREHASH_ItemFlags, flags);
- msg->addU32Fast(_PREHASH_GroupMask, group_mask);
- msg->addU32Fast(_PREHASH_EveryoneMask, everyone_mask);
- msg->addU32Fast(_PREHASH_NextOwnerMask, next_owner_mask);
+ // CRUFT -- the server no longer pays attention to this data
+ U32 group_mask = perms.getMaskGroup();
+ U32 everyone_mask = perms.getMaskEveryone();
+ U32 next_owner_mask = perms.getMaskNextOwner();
+
+ msg->addU32Fast(_PREHASH_ItemFlags, flags);
+ msg->addU32Fast(_PREHASH_GroupMask, group_mask);
+ msg->addU32Fast(_PREHASH_EveryoneMask, everyone_mask);
+ msg->addU32Fast(_PREHASH_NextOwnerMask, next_owner_mask);
}
diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h
index 60a2f01107..5d10daca4d 100644
--- a/indra/newview/lltooldraganddrop.h
+++ b/indra/newview/lltooldraganddrop.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltooldraganddrop.h
* @brief LLToolDragAndDrop class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,206 +43,206 @@ class LLPickInfo;
class LLToolDragAndDrop : public LLTool, public LLSingleton<LLToolDragAndDrop>
{
- LLSINGLETON(LLToolDragAndDrop);
+ LLSINGLETON(LLToolDragAndDrop);
public:
- typedef boost::signals2::signal<void ()> enddrag_signal_t;
-
- // overridden from LLTool
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleKey(KEY key, MASK mask) override;
- virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override;
- virtual void onMouseCaptureLost() override;
- virtual void handleDeselect() override;
-
- void setDragStart( S32 x, S32 y ); // In screen space
- BOOL isOverThreshold( S32 x, S32 y ); // In screen space
-
- enum ESource
- {
- SOURCE_AGENT,
- SOURCE_WORLD,
- SOURCE_NOTECARD,
- SOURCE_LIBRARY,
- SOURCE_VIEWER,
- SOURCE_PEOPLE
- };
-
- void beginDrag(EDragAndDropType type,
- const LLUUID& cargo_id,
- ESource source,
- const LLUUID& source_id = LLUUID::null,
- const LLUUID& object_id = LLUUID::null);
- void beginMultiDrag(const std::vector<EDragAndDropType> types,
- const uuid_vec_t& cargo_ids,
- ESource source,
- const LLUUID& source_id = LLUUID::null);
- void endDrag();
- ESource getSource() const { return mSource; }
- const LLUUID& getSourceID() const { return mSourceID; }
- const LLUUID& getObjectID() const { return mObjectID; }
- EAcceptance getLastAccept() { return mLastAccept; }
-
- boost::signals2::connection setEndDragCallback( const enddrag_signal_t::slot_type& cb ) { return mEndDragSignal.connect(cb); }
-
- void setCargoCount(U32 count) { mCargoCount = count; }
- void resetCargoCount() { mCargoCount = 0; }
- U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : mCargoIDs.size(); }
+ typedef boost::signals2::signal<void ()> enddrag_signal_t;
+
+ // overridden from LLTool
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleKey(KEY key, MASK mask) override;
+ virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override;
+ virtual void onMouseCaptureLost() override;
+ virtual void handleDeselect() override;
+
+ void setDragStart( S32 x, S32 y ); // In screen space
+ BOOL isOverThreshold( S32 x, S32 y ); // In screen space
+
+ enum ESource
+ {
+ SOURCE_AGENT,
+ SOURCE_WORLD,
+ SOURCE_NOTECARD,
+ SOURCE_LIBRARY,
+ SOURCE_VIEWER,
+ SOURCE_PEOPLE
+ };
+
+ void beginDrag(EDragAndDropType type,
+ const LLUUID& cargo_id,
+ ESource source,
+ const LLUUID& source_id = LLUUID::null,
+ const LLUUID& object_id = LLUUID::null);
+ void beginMultiDrag(const std::vector<EDragAndDropType> types,
+ const uuid_vec_t& cargo_ids,
+ ESource source,
+ const LLUUID& source_id = LLUUID::null);
+ void endDrag();
+ ESource getSource() const { return mSource; }
+ const LLUUID& getSourceID() const { return mSourceID; }
+ const LLUUID& getObjectID() const { return mObjectID; }
+ EAcceptance getLastAccept() { return mLastAccept; }
+
+ boost::signals2::connection setEndDragCallback( const enddrag_signal_t::slot_type& cb ) { return mEndDragSignal.connect(cb); }
+
+ void setCargoCount(U32 count) { mCargoCount = count; }
+ void resetCargoCount() { mCargoCount = 0; }
+ U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : mCargoIDs.size(); }
S32 getCargoIndex() const { return mCurItemIndex; }
- static S32 getOperationId() { return sOperationId; }
+ static S32 getOperationId() { return sOperationId; }
- // deal with permissions of object, etc. returns TRUE if drop can
- // proceed, otherwise FALSE.
- static BOOL handleDropMaterialProtections(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- LLToolDragAndDrop::ESource source,
- const LLUUID& src_id);
+ // deal with permissions of object, etc. returns TRUE if drop can
+ // proceed, otherwise FALSE.
+ static BOOL handleDropMaterialProtections(LLViewerObject* hit_obj,
+ LLInventoryItem* item,
+ LLToolDragAndDrop::ESource source,
+ const LLUUID& src_id);
protected:
- enum EDropTarget
- {
- DT_NONE = 0,
- DT_SELF = 1,
- DT_AVATAR = 2,
- DT_OBJECT = 3,
- DT_LAND = 4,
- DT_COUNT = 5
- };
+ enum EDropTarget
+ {
+ DT_NONE = 0,
+ DT_SELF = 1,
+ DT_AVATAR = 2,
+ DT_OBJECT = 3,
+ DT_LAND = 4,
+ DT_COUNT = 5
+ };
protected:
- // dragOrDrop3dImpl points to a member of LLToolDragAndDrop that
- // takes parameters (LLViewerObject* obj, S32 face, MASK, BOOL
- // drop) and returns a BOOL if drop is ok
- typedef EAcceptance (LLToolDragAndDrop::*dragOrDrop3dImpl)
- (LLViewerObject*, S32, MASK, BOOL);
-
- void dragOrDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EAcceptance* acceptance);
- void dragOrDrop3D(S32 x, S32 y, MASK mask, BOOL drop,
- EAcceptance* acceptance);
-
- static void pickCallback(const LLPickInfo& pick_info);
- void pick(const LLPickInfo& pick_info);
+ // dragOrDrop3dImpl points to a member of LLToolDragAndDrop that
+ // takes parameters (LLViewerObject* obj, S32 face, MASK, BOOL
+ // drop) and returns a BOOL if drop is ok
+ typedef EAcceptance (LLToolDragAndDrop::*dragOrDrop3dImpl)
+ (LLViewerObject*, S32, MASK, BOOL);
+
+ void dragOrDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EAcceptance* acceptance);
+ void dragOrDrop3D(S32 x, S32 y, MASK mask, BOOL drop,
+ EAcceptance* acceptance);
+
+ static void pickCallback(const LLPickInfo& pick_info);
+ void pick(const LLPickInfo& pick_info);
protected:
- U32 mCargoCount;
+ U32 mCargoCount;
+
+ S32 mDragStartX;
+ S32 mDragStartY;
- S32 mDragStartX;
- S32 mDragStartY;
-
- std::vector<EDragAndDropType> mCargoTypes;
- //void* mCargoData;
- uuid_vec_t mCargoIDs;
- ESource mSource;
- LLUUID mSourceID;
- LLUUID mObjectID;
+ std::vector<EDragAndDropType> mCargoTypes;
+ //void* mCargoData;
+ uuid_vec_t mCargoIDs;
+ ESource mSource;
+ LLUUID mSourceID;
+ LLUUID mObjectID;
- static S32 sOperationId;
+ static S32 sOperationId;
- LLVector3d mLastCameraPos;
- LLVector3d mLastHitPos;
+ LLVector3d mLastCameraPos;
+ LLVector3d mLastHitPos;
- ECursorType mCursor;
- EAcceptance mLastAccept;
- BOOL mDrop;
- S32 mCurItemIndex;
- std::string mToolTipMsg;
- std::string mCustomMsg;
+ ECursorType mCursor;
+ EAcceptance mLastAccept;
+ BOOL mDrop;
+ S32 mCurItemIndex;
+ std::string mToolTipMsg;
+ std::string mCustomMsg;
- enddrag_signal_t mEndDragSignal;
+ enddrag_signal_t mEndDragSignal;
protected:
- // 3d drop functions. these call down into the static functions
- // named drop<ThingToDrop> if drop is TRUE and permissions allow
- // that behavior.
- EAcceptance dad3dNULL(LLViewerObject*, S32, MASK, BOOL);
- EAcceptance dad3dRezObjectOnLand(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dRezObjectOnObject(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dRezCategoryOnObject(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dRezScript(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dTextureObject(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
+ // 3d drop functions. these call down into the static functions
+ // named drop<ThingToDrop> if drop is TRUE and permissions allow
+ // that behavior.
+ EAcceptance dad3dNULL(LLViewerObject*, S32, MASK, BOOL);
+ EAcceptance dad3dRezObjectOnLand(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dRezObjectOnObject(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dRezCategoryOnObject(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dRezScript(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dTextureObject(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
EAcceptance dad3dMaterialObject(LLViewerObject* obj, S32 face,
MASK mask, BOOL drop);
- EAcceptance dad3dMeshObject(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
-// EAcceptance dad3dTextureSelf(LLViewerObject* obj, S32 face,
-// MASK mask, BOOL drop);
- EAcceptance dad3dWearItem(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dWearCategory(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dUpdateInventory(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dUpdateInventoryCategory(LLViewerObject* obj,
- S32 face,
- MASK mask,
- BOOL drop);
- EAcceptance dad3dGiveInventoryObject(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dGiveInventory(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dGiveInventoryCategory(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dRezFromObjectOnLand(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dRezFromObjectOnObject(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dRezAttachmentFromInv(LLViewerObject* obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dCategoryOnLand(LLViewerObject *obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dAssetOnLand(LLViewerObject *obj, S32 face,
- MASK mask, BOOL drop);
- EAcceptance dad3dActivateGesture(LLViewerObject *obj, S32 face,
- MASK mask, BOOL drop);
-
- // helper called by methods above to handle "application" of an item
- // to an object (texture applied to face, mesh applied to shape, etc.)
- EAcceptance dad3dApplyToObject(LLViewerObject* obj, S32 face, MASK mask, BOOL drop, EDragAndDropType cargo_type);
-
-
- // set the LLToolDragAndDrop's cursor based on the given acceptance
- ECursorType acceptanceToCursor( EAcceptance acceptance );
-
- // This method converts mCargoID to an inventory item or
- // folder. If no item or category is found, both pointers will be
- // returned NULL.
- LLInventoryObject* locateInventory(LLViewerInventoryItem*& item,
- LLViewerInventoryCategory*& cat);
-
- //LLInventoryObject* locateMultipleInventory(
- // LLViewerInventoryCategory::cat_array_t& cats,
- // LLViewerInventoryItem::item_array_t& items);
-
- void dropObject(LLViewerObject* raycast_target,
- BOOL bypass_sim_raycast,
- BOOL from_task_inventory,
- BOOL remove_from_inventory);
-
- // accessor that looks at permissions, copyability, and names of
- // inventory items to determine if a drop would be ok.
- static EAcceptance willObjectAcceptInventory(LLViewerObject* obj, LLInventoryItem* item, EDragAndDropType type = DAD_NONE);
+ EAcceptance dad3dMeshObject(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+// EAcceptance dad3dTextureSelf(LLViewerObject* obj, S32 face,
+// MASK mask, BOOL drop);
+ EAcceptance dad3dWearItem(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dWearCategory(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dUpdateInventory(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dUpdateInventoryCategory(LLViewerObject* obj,
+ S32 face,
+ MASK mask,
+ BOOL drop);
+ EAcceptance dad3dGiveInventoryObject(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dGiveInventory(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dGiveInventoryCategory(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dRezFromObjectOnLand(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dRezFromObjectOnObject(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dRezAttachmentFromInv(LLViewerObject* obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dCategoryOnLand(LLViewerObject *obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dAssetOnLand(LLViewerObject *obj, S32 face,
+ MASK mask, BOOL drop);
+ EAcceptance dad3dActivateGesture(LLViewerObject *obj, S32 face,
+ MASK mask, BOOL drop);
+
+ // helper called by methods above to handle "application" of an item
+ // to an object (texture applied to face, mesh applied to shape, etc.)
+ EAcceptance dad3dApplyToObject(LLViewerObject* obj, S32 face, MASK mask, BOOL drop, EDragAndDropType cargo_type);
+
+
+ // set the LLToolDragAndDrop's cursor based on the given acceptance
+ ECursorType acceptanceToCursor( EAcceptance acceptance );
+
+ // This method converts mCargoID to an inventory item or
+ // folder. If no item or category is found, both pointers will be
+ // returned NULL.
+ LLInventoryObject* locateInventory(LLViewerInventoryItem*& item,
+ LLViewerInventoryCategory*& cat);
+
+ //LLInventoryObject* locateMultipleInventory(
+ // LLViewerInventoryCategory::cat_array_t& cats,
+ // LLViewerInventoryItem::item_array_t& items);
+
+ void dropObject(LLViewerObject* raycast_target,
+ BOOL bypass_sim_raycast,
+ BOOL from_task_inventory,
+ BOOL remove_from_inventory);
+
+ // accessor that looks at permissions, copyability, and names of
+ // inventory items to determine if a drop would be ok.
+ static EAcceptance willObjectAcceptInventory(LLViewerObject* obj, LLInventoryItem* item, EDragAndDropType type = DAD_NONE);
public:
- // helper functions
- static BOOL isInventoryDropAcceptable(LLViewerObject* obj, LLInventoryItem* item) { return (ACCEPT_YES_COPY_SINGLE <= willObjectAcceptInventory(obj, item)); }
-
- BOOL dadUpdateInventory(LLViewerObject* obj, BOOL drop);
- BOOL dadUpdateInventoryCategory(LLViewerObject* obj, BOOL drop);
-
- // methods that act on the simulator state.
- static void dropScript(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- BOOL active,
- ESource source,
- const LLUUID& src_id);
+ // helper functions
+ static BOOL isInventoryDropAcceptable(LLViewerObject* obj, LLInventoryItem* item) { return (ACCEPT_YES_COPY_SINGLE <= willObjectAcceptInventory(obj, item)); }
+
+ BOOL dadUpdateInventory(LLViewerObject* obj, BOOL drop);
+ BOOL dadUpdateInventoryCategory(LLViewerObject* obj, BOOL drop);
+
+ // methods that act on the simulator state.
+ static void dropScript(LLViewerObject* hit_obj,
+ LLInventoryItem* item,
+ BOOL active,
+ ESource source,
+ const LLUUID& src_id);
static void dropTexture(LLViewerObject* hit_obj,
S32 hit_face,
LLInventoryItem* item,
@@ -251,17 +251,17 @@ public:
bool all_faces,
bool replace_pbr,
S32 tex_channel = -1);
- static void dropTextureOneFace(LLViewerObject* hit_obj,
+ static void dropTextureOneFace(LLViewerObject* hit_obj,
S32 hit_face,
- LLInventoryItem* item,
- ESource source,
- const LLUUID& src_id,
+ LLInventoryItem* item,
+ ESource source,
+ const LLUUID& src_id,
bool remove_pbr,
S32 tex_channel = -1);
- static void dropTextureAllFaces(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- ESource source,
- const LLUUID& src_id,
+ static void dropTextureAllFaces(LLViewerObject* hit_obj,
+ LLInventoryItem* item,
+ ESource source,
+ const LLUUID& src_id,
bool remove_pbr);
static void dropMaterial(LLViewerObject* hit_obj,
S32 hit_face,
@@ -278,43 +278,43 @@ public:
LLInventoryItem* item,
ESource source,
const LLUUID& src_id);
- static void dropMesh(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- ESource source,
- const LLUUID& src_id);
-
- //static void dropTextureOneFaceAvatar(LLVOAvatar* avatar,S32 hit_face,
- // LLInventoryItem* item)
-
- static void dropInventory(LLViewerObject* hit_obj,
- LLInventoryItem* item,
- ESource source,
- const LLUUID& src_id);
-
- static bool handleGiveDragAndDrop(LLUUID agent, LLUUID session, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- const LLSD& dest = LLSD());
-
- // Classes used for determining 3d drag and drop types.
+ static void dropMesh(LLViewerObject* hit_obj,
+ LLInventoryItem* item,
+ ESource source,
+ const LLUUID& src_id);
+
+ //static void dropTextureOneFaceAvatar(LLVOAvatar* avatar,S32 hit_face,
+ // LLInventoryItem* item)
+
+ static void dropInventory(LLViewerObject* hit_obj,
+ LLInventoryItem* item,
+ ESource source,
+ const LLUUID& src_id);
+
+ static bool handleGiveDragAndDrop(LLUUID agent, LLUUID session, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ const LLSD& dest = LLSD());
+
+ // Classes used for determining 3d drag and drop types.
private:
- struct DragAndDropEntry : public LLDictionaryEntry
- {
- DragAndDropEntry(dragOrDrop3dImpl f_none,
- dragOrDrop3dImpl f_self,
- dragOrDrop3dImpl f_avatar,
- dragOrDrop3dImpl f_object,
- dragOrDrop3dImpl f_land);
- dragOrDrop3dImpl mFunctions[DT_COUNT];
- };
- class LLDragAndDropDictionary : public LLSingleton<LLDragAndDropDictionary>,
- public LLDictionary<EDragAndDropType, DragAndDropEntry>
- {
- LLSINGLETON(LLDragAndDropDictionary);
- public:
- dragOrDrop3dImpl get(EDragAndDropType dad_type, EDropTarget drop_target);
- };
+ struct DragAndDropEntry : public LLDictionaryEntry
+ {
+ DragAndDropEntry(dragOrDrop3dImpl f_none,
+ dragOrDrop3dImpl f_self,
+ dragOrDrop3dImpl f_avatar,
+ dragOrDrop3dImpl f_object,
+ dragOrDrop3dImpl f_land);
+ dragOrDrop3dImpl mFunctions[DT_COUNT];
+ };
+ class LLDragAndDropDictionary : public LLSingleton<LLDragAndDropDictionary>,
+ public LLDictionary<EDragAndDropType, DragAndDropEntry>
+ {
+ LLSINGLETON(LLDragAndDropDictionary);
+ public:
+ dragOrDrop3dImpl get(EDragAndDropType dad_type, EDropTarget drop_target);
+ };
};
// utility functions
diff --git a/indra/newview/lltoolface.cpp b/indra/newview/lltoolface.cpp
index a00ac10698..3176ba4bd5 100644
--- a/indra/newview/lltoolface.cpp
+++ b/indra/newview/lltoolface.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolface.cpp
* @brief A tool to manipulate faces
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
#include "llviewerprecompiledheaders.h"
// File includes
-#include "lltoolface.h"
+#include "lltoolface.h"
// Library includes
#include "llfloaterreg.h"
@@ -45,7 +45,7 @@
//
LLToolFace::LLToolFace()
-: LLTool(std::string("Texture"))
+: LLTool(std::string("Texture"))
{ }
@@ -55,97 +55,97 @@ LLToolFace::~LLToolFace()
BOOL LLToolFace::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- if (!LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- // You should already have an object selected from the mousedown.
- // If so, show its properties
- LLFloaterReg::showInstance("build", "Texture");
- return TRUE;
- }
- else
- {
- // Nothing selected means the first mouse click was probably
- // bad, so try again.
- return FALSE;
- }
+ if (!LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ // You should already have an object selected from the mousedown.
+ // If so, show its properties
+ LLFloaterReg::showInstance("build", "Texture");
+ return TRUE;
+ }
+ else
+ {
+ // Nothing selected means the first mouse click was probably
+ // bad, so try again.
+ return FALSE;
+ }
}
BOOL LLToolFace::handleMouseDown(S32 x, S32 y, MASK mask)
{
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
- return TRUE;
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ return TRUE;
}
void LLToolFace::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = pick_info.getObject();
- if (hit_obj)
- {
- S32 hit_face = pick_info.mObjectFace;
-
- if (hit_obj->isAvatar())
- {
- // ...clicked on an avatar, so don't do anything
- return;
- }
-
- // ...clicked on a world object, try to pick the appropriate face
-
- if (pick_info.mKeyMask & MASK_SHIFT)
- {
- // If object not selected, need to inform sim
- if ( !hit_obj->isSelected() )
- {
- // object wasn't selected so add the object and face
- LLSelectMgr::getInstance()->selectObjectOnly(hit_obj, hit_face);
- }
- else if (!LLSelectMgr::getInstance()->getSelection()->contains(hit_obj, hit_face) )
- {
- // object is selected, but not this face, so add it.
- LLSelectMgr::getInstance()->addAsIndividual(hit_obj, hit_face);
- }
- else
- {
- // object is selected, as is this face, so remove the face.
- LLSelectMgr::getInstance()->remove(hit_obj, hit_face);
-
- // BUG: If you remove the last face, the simulator won't know about it.
- }
- }
- else
- {
- // clicked without modifiers, select only
- // this face
- LLSelectMgr::getInstance()->deselectAll();
- LLSelectMgr::getInstance()->selectObjectOnly(hit_obj, hit_face);
- }
- }
- else
- {
- if (!(pick_info.mKeyMask == MASK_SHIFT))
- {
- LLSelectMgr::getInstance()->deselectAll();
- }
- }
+ LLViewerObject* hit_obj = pick_info.getObject();
+ if (hit_obj)
+ {
+ S32 hit_face = pick_info.mObjectFace;
+
+ if (hit_obj->isAvatar())
+ {
+ // ...clicked on an avatar, so don't do anything
+ return;
+ }
+
+ // ...clicked on a world object, try to pick the appropriate face
+
+ if (pick_info.mKeyMask & MASK_SHIFT)
+ {
+ // If object not selected, need to inform sim
+ if ( !hit_obj->isSelected() )
+ {
+ // object wasn't selected so add the object and face
+ LLSelectMgr::getInstance()->selectObjectOnly(hit_obj, hit_face);
+ }
+ else if (!LLSelectMgr::getInstance()->getSelection()->contains(hit_obj, hit_face) )
+ {
+ // object is selected, but not this face, so add it.
+ LLSelectMgr::getInstance()->addAsIndividual(hit_obj, hit_face);
+ }
+ else
+ {
+ // object is selected, as is this face, so remove the face.
+ LLSelectMgr::getInstance()->remove(hit_obj, hit_face);
+
+ // BUG: If you remove the last face, the simulator won't know about it.
+ }
+ }
+ else
+ {
+ // clicked without modifiers, select only
+ // this face
+ LLSelectMgr::getInstance()->deselectAll();
+ LLSelectMgr::getInstance()->selectObjectOnly(hit_obj, hit_face);
+ }
+ }
+ else
+ {
+ if (!(pick_info.mKeyMask == MASK_SHIFT))
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+ }
}
void LLToolFace::handleSelect()
{
- // From now on, draw faces
- LLSelectMgr::getInstance()->setTEMode(TRUE);
+ // From now on, draw faces
+ LLSelectMgr::getInstance()->setTEMode(TRUE);
}
void LLToolFace::handleDeselect()
{
- // Stop drawing faces
- LLSelectMgr::getInstance()->setTEMode(FALSE);
+ // Stop drawing faces
+ LLSelectMgr::getInstance()->setTEMode(FALSE);
}
void LLToolFace::render()
{
- // for now, do nothing
+ // for now, do nothing
}
diff --git a/indra/newview/lltoolface.h b/indra/newview/lltoolface.h
index 7c8ff20480..ff3eead6a6 100644
--- a/indra/newview/lltoolface.h
+++ b/indra/newview/lltoolface.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolface.h
* @brief A tool to select object faces
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,19 +33,19 @@ class LLViewerObject;
class LLPickInfo;
class LLToolFace
-: public LLTool, public LLSingleton<LLToolFace>
+: public LLTool, public LLSingleton<LLToolFace>
{
- LLSINGLETON(LLToolFace);
- virtual ~LLToolFace();
+ LLSINGLETON(LLToolFace);
+ virtual ~LLToolFace();
public:
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- virtual void handleSelect() override;
- virtual void handleDeselect() override;
- virtual void render() override; // draw face highlights
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ virtual void handleSelect() override;
+ virtual void handleDeselect() override;
+ virtual void render() override; // draw face highlights
- static void pickCallback(const LLPickInfo& pick_info);
+ static void pickCallback(const LLPickInfo& pick_info);
};
#endif
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index 4e94895a3e..e34e0cce50 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolfocus.cpp
* @brief A tool to set the build focus point.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
#include "llviewerprecompiledheaders.h"
// File includes
-#include "lltoolfocus.h"
+#include "lltoolfocus.h"
// Library includes
#include "v3math.h"
@@ -67,20 +67,20 @@ const S32 SLOP_RANGE = 4;
//
LLToolCamera::LLToolCamera()
-: LLTool(std::string("Camera")),
- mAccumX(0),
- mAccumY(0),
- mMouseDownX(0),
- mMouseDownY(0),
- mOutsideSlopX(FALSE),
- mOutsideSlopY(FALSE),
- mValidClickPoint(FALSE),
+: LLTool(std::string("Camera")),
+ mAccumX(0),
+ mAccumY(0),
+ mMouseDownX(0),
+ mMouseDownY(0),
+ mOutsideSlopX(FALSE),
+ mOutsideSlopY(FALSE),
+ mValidClickPoint(FALSE),
mClickPickPending(false),
- mValidSelection(FALSE),
- mMouseSteering(FALSE),
- mMouseUpX(0),
- mMouseUpY(0),
- mMouseUpMask(MASK_NONE)
+ mValidSelection(FALSE),
+ mMouseSteering(FALSE),
+ mMouseUpX(0),
+ mMouseUpY(0),
+ mMouseUpMask(MASK_NONE)
{ }
@@ -90,171 +90,171 @@ LLToolCamera::~LLToolCamera()
// virtual
void LLToolCamera::handleSelect()
{
- if (gFloaterTools)
- {
- gFloaterTools->setStatusText("camera");
- // in case we start from tools floater, we count any selection as valid
- mValidSelection = gFloaterTools->getVisible();
- }
+ if (gFloaterTools)
+ {
+ gFloaterTools->setStatusText("camera");
+ // in case we start from tools floater, we count any selection as valid
+ mValidSelection = gFloaterTools->getVisible();
+ }
}
// virtual
void LLToolCamera::handleDeselect()
{
-// gAgent.setLookingAtAvatar(FALSE);
-
- // Make sure that temporary selection won't pass anywhere except pie tool.
- MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0;
- if (!mValidSelection && (override_mask != MASK_NONE || (gFloaterTools && gFloaterTools->getVisible())))
- {
- LLMenuGL::sMenuContainer->hideMenus();
- LLSelectMgr::getInstance()->validateSelection();
- }
+// gAgent.setLookingAtAvatar(FALSE);
+
+ // Make sure that temporary selection won't pass anywhere except pie tool.
+ MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0;
+ if (!mValidSelection && (override_mask != MASK_NONE || (gFloaterTools && gFloaterTools->getVisible())))
+ {
+ LLMenuGL::sMenuContainer->hideMenus();
+ LLSelectMgr::getInstance()->validateSelection();
+ }
}
BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask)
{
- // Ensure a mouseup
- setMouseCapture(TRUE);
+ // Ensure a mouseup
+ setMouseCapture(TRUE);
- // call the base class to propogate info to sim
- LLTool::handleMouseDown(x, y, mask);
+ // call the base class to propogate info to sim
+ LLTool::handleMouseDown(x, y, mask);
- mAccumX = 0;
- mAccumY = 0;
+ mAccumX = 0;
+ mAccumY = 0;
- mOutsideSlopX = FALSE;
- mOutsideSlopY = FALSE;
+ mOutsideSlopX = FALSE;
+ mOutsideSlopY = FALSE;
- mValidClickPoint = FALSE;
+ mValidClickPoint = FALSE;
// Sometimes Windows issues down and up events near simultaneously
// without giving async pick a chance to trigged
// Ex: mouse from numlock emulation
mClickPickPending = true;
- // If mouse capture gets ripped away, claim we moused up
- // at the point we moused down. JC
- mMouseUpX = x;
- mMouseUpY = y;
- mMouseUpMask = mask;
+ // If mouse capture gets ripped away, claim we moused up
+ // at the point we moused down. JC
+ mMouseUpX = x;
+ mMouseUpY = y;
+ mMouseUpMask = mask;
- gViewerWindow->hideCursor();
+ gViewerWindow->hideCursor();
- gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ FALSE, /*BOOL pick_rigged*/ FALSE, /*BOOL pick_unselectable*/ TRUE);
+ gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ FALSE, /*BOOL pick_rigged*/ FALSE, /*BOOL pick_unselectable*/ TRUE);
- return TRUE;
+ return TRUE;
}
void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
{
LLToolCamera* camera = LLToolCamera::getInstance();
- if (!camera->mClickPickPending)
- {
- return;
- }
+ if (!camera->mClickPickPending)
+ {
+ return;
+ }
camera->mClickPickPending = false;
camera->mMouseDownX = pick_info.mMousePt.mX;
camera->mMouseDownY = pick_info.mMousePt.mY;
- gViewerWindow->moveCursorToCenter();
+ gViewerWindow->moveCursorToCenter();
- // Potentially recenter if click outside rectangle
- LLViewerObject* hit_obj = pick_info.getObject();
+ // Potentially recenter if click outside rectangle
+ LLViewerObject* hit_obj = pick_info.getObject();
- // Check for hit the sky, or some other invalid point
- if (!hit_obj && pick_info.mPosGlobal.isExactlyZero())
- {
+ // Check for hit the sky, or some other invalid point
+ if (!hit_obj && pick_info.mPosGlobal.isExactlyZero())
+ {
camera->mValidClickPoint = FALSE;
- return;
- }
-
- // check for hud attachments
- if (hit_obj && hit_obj->isHUDAttachment())
- {
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD)
- {
+ return;
+ }
+
+ // check for hud attachments
+ if (hit_obj && hit_obj->isHUDAttachment())
+ {
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD)
+ {
camera->mValidClickPoint = FALSE;
- return;
- }
- }
-
- if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() )
- {
- BOOL good_customize_avatar_hit = FALSE;
- if( hit_obj )
- {
- if (isAgentAvatarValid() && (hit_obj == gAgentAvatarp))
- {
- // It's you
- good_customize_avatar_hit = TRUE;
- }
- else if (hit_obj->isAttachment() && hit_obj->permYouOwner())
- {
- // It's an attachment that you're wearing
- good_customize_avatar_hit = TRUE;
- }
- }
-
- if( !good_customize_avatar_hit )
- {
+ return;
+ }
+ }
+
+ if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() )
+ {
+ BOOL good_customize_avatar_hit = FALSE;
+ if( hit_obj )
+ {
+ if (isAgentAvatarValid() && (hit_obj == gAgentAvatarp))
+ {
+ // It's you
+ good_customize_avatar_hit = TRUE;
+ }
+ else if (hit_obj->isAttachment() && hit_obj->permYouOwner())
+ {
+ // It's an attachment that you're wearing
+ good_customize_avatar_hit = TRUE;
+ }
+ }
+
+ if( !good_customize_avatar_hit )
+ {
camera->mValidClickPoint = FALSE;
- return;
- }
-
- if( gMorphView )
- {
- gMorphView->setCameraDrivenByKeys( FALSE );
- }
- }
- //RN: check to see if this is mouse-driving as opposed to ALT-zoom or Focus tool
- else if (pick_info.mKeyMask & MASK_ALT ||
- (LLToolMgr::getInstance()->getCurrentTool()->getName() == "Camera"))
- {
- LLViewerObject* hit_obj = pick_info.getObject();
- if (hit_obj)
- {
- // ...clicked on a world object, so focus at its position
- if (!hit_obj->isHUDAttachment())
- {
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
- gAgentCamera.setFocusGlobal(pick_info);
- }
- }
- else if (!pick_info.mPosGlobal.isExactlyZero())
- {
- // Hit the ground
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
- gAgentCamera.setFocusGlobal(pick_info);
- }
-
- BOOL zoom_tool = gCameraBtnZoom && (LLToolMgr::getInstance()->getBaseTool() == LLToolCamera::getInstance());
- if (!(pick_info.mKeyMask & MASK_ALT) &&
- !LLFloaterCamera::inFreeCameraMode() &&
- !zoom_tool &&
- gAgentCamera.cameraThirdPerson() &&
- gViewerWindow->getLeftMouseDown() &&
- !gSavedSettings.getBOOL("FreezeTime") &&
- (hit_obj == gAgentAvatarp ||
- (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf())))
- {
- LLToolCamera::getInstance()->mMouseSteering = TRUE;
- }
-
- }
+ return;
+ }
+
+ if( gMorphView )
+ {
+ gMorphView->setCameraDrivenByKeys( FALSE );
+ }
+ }
+ //RN: check to see if this is mouse-driving as opposed to ALT-zoom or Focus tool
+ else if (pick_info.mKeyMask & MASK_ALT ||
+ (LLToolMgr::getInstance()->getCurrentTool()->getName() == "Camera"))
+ {
+ LLViewerObject* hit_obj = pick_info.getObject();
+ if (hit_obj)
+ {
+ // ...clicked on a world object, so focus at its position
+ if (!hit_obj->isHUDAttachment())
+ {
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+ gAgentCamera.setFocusGlobal(pick_info);
+ }
+ }
+ else if (!pick_info.mPosGlobal.isExactlyZero())
+ {
+ // Hit the ground
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+ gAgentCamera.setFocusGlobal(pick_info);
+ }
+
+ BOOL zoom_tool = gCameraBtnZoom && (LLToolMgr::getInstance()->getBaseTool() == LLToolCamera::getInstance());
+ if (!(pick_info.mKeyMask & MASK_ALT) &&
+ !LLFloaterCamera::inFreeCameraMode() &&
+ !zoom_tool &&
+ gAgentCamera.cameraThirdPerson() &&
+ gViewerWindow->getLeftMouseDown() &&
+ !gSavedSettings.getBOOL("FreezeTime") &&
+ (hit_obj == gAgentAvatarp ||
+ (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf())))
+ {
+ LLToolCamera::getInstance()->mMouseSteering = TRUE;
+ }
+
+ }
camera->mValidClickPoint = TRUE;
- if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() )
- {
- gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
-
- LLVector3d cam_pos = gAgentCamera.getCameraPositionGlobal();
+ if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() )
+ {
+ gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
- gAgentCamera.setCameraPosAndFocusGlobal( cam_pos, pick_info.mPosGlobal, pick_info.mObjectID);
- }
+ LLVector3d cam_pos = gAgentCamera.getCameraPositionGlobal();
+
+ gAgentCamera.setCameraPosAndFocusGlobal( cam_pos, pick_info.mPosGlobal, pick_info.mObjectID);
+ }
}
@@ -263,35 +263,35 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
// if a modal dialog pops up during Alt-Zoom. JC
void LLToolCamera::releaseMouse()
{
- // Need to tell the sim that the mouse button is up, since this
- // tool is no longer working and cursor is visible (despite actual
- // mouse button status).
- LLTool::handleMouseUp(mMouseUpX, mMouseUpY, mMouseUpMask);
-
- gViewerWindow->showCursor();
-
- //for the situation when left click was performed on the Agent
- if (!LLFloaterCamera::inFreeCameraMode())
- {
- LLToolMgr::getInstance()->clearTransientTool();
- }
-
- mMouseSteering = FALSE;
- mValidClickPoint = FALSE;
- mOutsideSlopX = FALSE;
- mOutsideSlopY = FALSE;
+ // Need to tell the sim that the mouse button is up, since this
+ // tool is no longer working and cursor is visible (despite actual
+ // mouse button status).
+ LLTool::handleMouseUp(mMouseUpX, mMouseUpY, mMouseUpMask);
+
+ gViewerWindow->showCursor();
+
+ //for the situation when left click was performed on the Agent
+ if (!LLFloaterCamera::inFreeCameraMode())
+ {
+ LLToolMgr::getInstance()->clearTransientTool();
+ }
+
+ mMouseSteering = FALSE;
+ mValidClickPoint = FALSE;
+ mOutsideSlopX = FALSE;
+ mOutsideSlopY = FALSE;
}
BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask)
{
- // Claim that we're mousing up somewhere
- mMouseUpX = x;
- mMouseUpY = y;
- mMouseUpMask = mask;
+ // Claim that we're mousing up somewhere
+ mMouseUpX = x;
+ mMouseUpY = y;
+ mMouseUpMask = mask;
- if (hasMouseCapture())
- {
+ if (hasMouseCapture())
+ {
// Do not move camera if we haven't gotten a pick
if (!mClickPickPending)
{
@@ -323,156 +323,156 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask)
}
}
- // calls releaseMouse() internally
- setMouseCapture(FALSE);
- }
- else
- {
- releaseMouse();
- }
+ // calls releaseMouse() internally
+ setMouseCapture(FALSE);
+ }
+ else
+ {
+ releaseMouse();
+ }
- return TRUE;
+ return TRUE;
}
BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
{
- S32 dx = gViewerWindow->getCurrentMouseDX();
- S32 dy = gViewerWindow->getCurrentMouseDY();
-
- if (hasMouseCapture() && mValidClickPoint)
- {
- mAccumX += llabs(dx);
- mAccumY += llabs(dy);
-
- if (mAccumX >= SLOP_RANGE)
- {
- mOutsideSlopX = TRUE;
- }
-
- if (mAccumY >= SLOP_RANGE)
- {
- mOutsideSlopY = TRUE;
- }
- }
-
- if (mOutsideSlopX || mOutsideSlopY)
- {
- if (!mValidClickPoint)
- {
- LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [invalid point]" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_NO);
- gViewerWindow->showCursor();
- return TRUE;
- }
-
- if (gCameraBtnOrbit ||
- mask == MASK_ORBIT ||
- mask == (MASK_ALT | MASK_ORBIT))
- {
- // Orbit tool
- if (hasMouseCapture())
- {
- const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled();
-
- if (dx != 0)
- {
- gAgentCamera.cameraOrbitAround( -dx * RADIANS_PER_PIXEL );
- }
-
- if (dy != 0)
- {
- gAgentCamera.cameraOrbitOver( -dy * RADIANS_PER_PIXEL );
- }
-
- gViewerWindow->moveCursorToCenter();
- }
- LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [active]" << LL_ENDL;
- }
- else if ( gCameraBtnPan ||
- mask == MASK_PAN ||
- mask == (MASK_PAN | MASK_ALT) )
- {
- // Pan tool
- if (hasMouseCapture())
- {
- LLVector3d camera_to_focus = gAgentCamera.getCameraPositionGlobal();
- camera_to_focus -= gAgentCamera.getFocusGlobal();
- F32 dist = (F32) camera_to_focus.normVec();
-
- // Fudge factor for pan
- F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthScaled();
-
- if (dx != 0)
- {
- gAgentCamera.cameraPanLeft( dx * meters_per_pixel );
- }
-
- if (dy != 0)
- {
- gAgentCamera.cameraPanUp( -dy * meters_per_pixel );
- }
-
- gViewerWindow->moveCursorToCenter();
- }
- LL_DEBUGS("UserInput") << "hover handled by LLToolPan" << LL_ENDL;
- }
- else if (gCameraBtnZoom)
- {
- // Zoom tool
- if (hasMouseCapture())
- {
-
- const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled();
-
- if (dx != 0)
- {
- gAgentCamera.cameraOrbitAround( -dx * RADIANS_PER_PIXEL );
- }
-
- const F32 IN_FACTOR = 0.99f;
-
- if (dy != 0 && mOutsideSlopY )
- {
- if (mMouseSteering)
- {
- gAgentCamera.cameraOrbitOver( -dy * RADIANS_PER_PIXEL );
- }
- else
- {
- gAgentCamera.cameraZoomIn( pow( IN_FACTOR, dy ) );
- }
- }
-
- gViewerWindow->moveCursorToCenter();
- }
-
- LL_DEBUGS("UserInput") << "hover handled by LLToolZoom" << LL_ENDL;
- }
- }
-
- if (gCameraBtnOrbit ||
- mask == MASK_ORBIT ||
- mask == (MASK_ALT | MASK_ORBIT))
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA);
- }
- else if ( gCameraBtnPan ||
- mask == MASK_PAN ||
- mask == (MASK_PAN | MASK_ALT) )
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLPAN);
- }
- else
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
- }
-
- return TRUE;
+ S32 dx = gViewerWindow->getCurrentMouseDX();
+ S32 dy = gViewerWindow->getCurrentMouseDY();
+
+ if (hasMouseCapture() && mValidClickPoint)
+ {
+ mAccumX += llabs(dx);
+ mAccumY += llabs(dy);
+
+ if (mAccumX >= SLOP_RANGE)
+ {
+ mOutsideSlopX = TRUE;
+ }
+
+ if (mAccumY >= SLOP_RANGE)
+ {
+ mOutsideSlopY = TRUE;
+ }
+ }
+
+ if (mOutsideSlopX || mOutsideSlopY)
+ {
+ if (!mValidClickPoint)
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [invalid point]" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_NO);
+ gViewerWindow->showCursor();
+ return TRUE;
+ }
+
+ if (gCameraBtnOrbit ||
+ mask == MASK_ORBIT ||
+ mask == (MASK_ALT | MASK_ORBIT))
+ {
+ // Orbit tool
+ if (hasMouseCapture())
+ {
+ const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled();
+
+ if (dx != 0)
+ {
+ gAgentCamera.cameraOrbitAround( -dx * RADIANS_PER_PIXEL );
+ }
+
+ if (dy != 0)
+ {
+ gAgentCamera.cameraOrbitOver( -dy * RADIANS_PER_PIXEL );
+ }
+
+ gViewerWindow->moveCursorToCenter();
+ }
+ LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [active]" << LL_ENDL;
+ }
+ else if ( gCameraBtnPan ||
+ mask == MASK_PAN ||
+ mask == (MASK_PAN | MASK_ALT) )
+ {
+ // Pan tool
+ if (hasMouseCapture())
+ {
+ LLVector3d camera_to_focus = gAgentCamera.getCameraPositionGlobal();
+ camera_to_focus -= gAgentCamera.getFocusGlobal();
+ F32 dist = (F32) camera_to_focus.normVec();
+
+ // Fudge factor for pan
+ F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthScaled();
+
+ if (dx != 0)
+ {
+ gAgentCamera.cameraPanLeft( dx * meters_per_pixel );
+ }
+
+ if (dy != 0)
+ {
+ gAgentCamera.cameraPanUp( -dy * meters_per_pixel );
+ }
+
+ gViewerWindow->moveCursorToCenter();
+ }
+ LL_DEBUGS("UserInput") << "hover handled by LLToolPan" << LL_ENDL;
+ }
+ else if (gCameraBtnZoom)
+ {
+ // Zoom tool
+ if (hasMouseCapture())
+ {
+
+ const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthScaled();
+
+ if (dx != 0)
+ {
+ gAgentCamera.cameraOrbitAround( -dx * RADIANS_PER_PIXEL );
+ }
+
+ const F32 IN_FACTOR = 0.99f;
+
+ if (dy != 0 && mOutsideSlopY )
+ {
+ if (mMouseSteering)
+ {
+ gAgentCamera.cameraOrbitOver( -dy * RADIANS_PER_PIXEL );
+ }
+ else
+ {
+ gAgentCamera.cameraZoomIn( pow( IN_FACTOR, dy ) );
+ }
+ }
+
+ gViewerWindow->moveCursorToCenter();
+ }
+
+ LL_DEBUGS("UserInput") << "hover handled by LLToolZoom" << LL_ENDL;
+ }
+ }
+
+ if (gCameraBtnOrbit ||
+ mask == MASK_ORBIT ||
+ mask == (MASK_ALT | MASK_ORBIT))
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA);
+ }
+ else if ( gCameraBtnPan ||
+ mask == MASK_PAN ||
+ mask == (MASK_PAN | MASK_ALT) )
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLPAN);
+ }
+ else
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
+ }
+
+ return TRUE;
}
void LLToolCamera::onMouseCaptureLost()
{
- releaseMouse();
+ releaseMouse();
}
diff --git a/indra/newview/lltoolfocus.h b/indra/newview/lltoolfocus.h
index 54d9827ae6..29a548d635 100644
--- a/indra/newview/lltoolfocus.h
+++ b/indra/newview/lltoolfocus.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolfocus.h
* @brief A tool to set the build focus point.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,46 +32,46 @@
class LLPickInfo;
class LLToolCamera
-: public LLTool, public LLSingleton<LLToolCamera>
+: public LLTool, public LLSingleton<LLToolCamera>
{
- LLSINGLETON(LLToolCamera);
- virtual ~LLToolCamera();
+ LLSINGLETON(LLToolCamera);
+ virtual ~LLToolCamera();
public:
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
- virtual void onMouseCaptureLost() override;
+ virtual void onMouseCaptureLost() override;
- virtual void handleSelect() override;
- virtual void handleDeselect() override;
+ virtual void handleSelect() override;
+ virtual void handleDeselect() override;
- virtual LLTool* getOverrideTool(MASK mask) override { return NULL; }
+ virtual LLTool* getOverrideTool(MASK mask) override { return NULL; }
void setClickPickPending() { mClickPickPending = true; }
- static void pickCallback(const LLPickInfo& pick_info);
- BOOL mouseSteerMode() { return mMouseSteering; }
+ static void pickCallback(const LLPickInfo& pick_info);
+ BOOL mouseSteerMode() { return mMouseSteering; }
protected:
- // called from handleMouseUp and onMouseCaptureLost to "let go"
- // of the mouse and make it visible JC
- void releaseMouse();
+ // called from handleMouseUp and onMouseCaptureLost to "let go"
+ // of the mouse and make it visible JC
+ void releaseMouse();
protected:
- S32 mAccumX;
- S32 mAccumY;
- S32 mMouseDownX;
- S32 mMouseDownY;
- BOOL mOutsideSlopX;
- BOOL mOutsideSlopY;
- BOOL mValidClickPoint;
- bool mClickPickPending;
- BOOL mValidSelection;
- BOOL mMouseSteering;
- S32 mMouseUpX; // needed for releaseMouse()
- S32 mMouseUpY;
- MASK mMouseUpMask;
+ S32 mAccumX;
+ S32 mAccumY;
+ S32 mMouseDownX;
+ S32 mMouseDownY;
+ BOOL mOutsideSlopX;
+ BOOL mOutsideSlopY;
+ BOOL mValidClickPoint;
+ bool mClickPickPending;
+ BOOL mValidSelection;
+ BOOL mMouseSteering;
+ S32 mMouseUpX; // needed for releaseMouse()
+ S32 mMouseUpY;
+ MASK mMouseUpMask;
};
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp
index 897f8c1e5f..59bfebafe4 100644
--- a/indra/newview/lltoolgrab.cpp
+++ b/indra/newview/lltoolgrab.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolgrab.cpp
* @brief LLToolGrab class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,9 +27,9 @@
#include "llviewerprecompiledheaders.h"
#include "lltoolgrab.h"
-
+
// library headers
-#include "indra_constants.h" // for agent control flags
+#include "indra_constants.h" // for agent control flags
#include "llviewercontrol.h"
#include "llquaternion.h"
#include "llbox.h"
@@ -53,7 +53,7 @@
#include "llviewercamera.h"
#include "llviewerinput.h"
#include "llviewerobject.h"
-#include "llviewerobjectlist.h"
+#include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "llvoavatarself.h"
#include "llworld.h"
@@ -71,22 +71,22 @@ extern BOOL gDebugClicks;
// Methods
//
LLToolGrabBase::LLToolGrabBase( LLToolComposite* composite )
-: LLTool( std::string("Grab"), composite ),
- mMode( GRAB_INACTIVE ),
- mVerticalDragging( FALSE ),
- mHitLand(FALSE),
- mLastMouseX(0),
- mLastMouseY(0),
- mAccumDeltaX(0),
- mAccumDeltaY(0),
- mHasMoved( FALSE ),
- mOutsideSlop(FALSE),
- mDeselectedThisClick(FALSE),
- mLastFace(0),
- mSpinGrabbing( FALSE ),
- mSpinRotation(),
- mClickedInMouselook( FALSE ),
- mHideBuildHighlight(FALSE)
+: LLTool( std::string("Grab"), composite ),
+ mMode( GRAB_INACTIVE ),
+ mVerticalDragging( FALSE ),
+ mHitLand(FALSE),
+ mLastMouseX(0),
+ mLastMouseY(0),
+ mAccumDeltaX(0),
+ mAccumDeltaY(0),
+ mHasMoved( FALSE ),
+ mOutsideSlop(FALSE),
+ mDeselectedThisClick(FALSE),
+ mLastFace(0),
+ mSpinGrabbing( FALSE ),
+ mSpinRotation(),
+ mClickedInMouselook( FALSE ),
+ mHideBuildHighlight(FALSE)
{ }
LLToolGrabBase::~LLToolGrabBase()
@@ -96,60 +96,60 @@ LLToolGrabBase::~LLToolGrabBase()
// virtual
void LLToolGrabBase::handleSelect()
{
- if(gFloaterTools)
- {
- // viewer can crash during startup if we don't check.
- gFloaterTools->setStatusText("grab");
- // in case we start from tools floater, we count any selection as valid
- mValidSelection = gFloaterTools->getVisible();
- }
- gGrabBtnVertical = FALSE;
- gGrabBtnSpin = FALSE;
+ if(gFloaterTools)
+ {
+ // viewer can crash during startup if we don't check.
+ gFloaterTools->setStatusText("grab");
+ // in case we start from tools floater, we count any selection as valid
+ mValidSelection = gFloaterTools->getVisible();
+ }
+ gGrabBtnVertical = FALSE;
+ gGrabBtnSpin = FALSE;
}
void LLToolGrabBase::handleDeselect()
{
- if( hasMouseCapture() )
- {
- setMouseCapture( FALSE );
- }
-
- // Make sure that temporary(invalid) selection won't pass anywhere except pie tool.
- MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0;
- if (!mValidSelection && (override_mask != MASK_NONE || (gFloaterTools && gFloaterTools->getVisible())))
- {
- LLMenuGL::sMenuContainer->hideMenus();
- LLSelectMgr::getInstance()->validateSelection();
- }
+ if( hasMouseCapture() )
+ {
+ setMouseCapture( FALSE );
+ }
+
+ // Make sure that temporary(invalid) selection won't pass anywhere except pie tool.
+ MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0;
+ if (!mValidSelection && (override_mask != MASK_NONE || (gFloaterTools && gFloaterTools->getVisible())))
+ {
+ LLMenuGL::sMenuContainer->hideMenus();
+ LLSelectMgr::getInstance()->validateSelection();
+ }
}
BOOL LLToolGrabBase::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- if (gDebugClicks)
- {
- LL_INFOS() << "LLToolGrab handleDoubleClick (becoming mouseDown)" << LL_ENDL;
- }
+ if (gDebugClicks)
+ {
+ LL_INFOS() << "LLToolGrab handleDoubleClick (becoming mouseDown)" << LL_ENDL;
+ }
- return FALSE;
+ return FALSE;
}
BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if (gDebugClicks)
- {
- LL_INFOS() << "LLToolGrab handleMouseDown" << LL_ENDL;
- }
+ if (gDebugClicks)
+ {
+ LL_INFOS() << "LLToolGrab handleMouseDown" << LL_ENDL;
+ }
- LLTool::handleMouseDown(x, y, mask);
+ LLTool::handleMouseDown(x, y, mask);
- // leftButtonGrabbed() checks if controls are reserved by scripts, but does not take masks into account
- if (!gAgent.leftButtonGrabbed() || ((mask & DEFAULT_GRAB_MASK) != 0 && !gAgentCamera.cameraMouselook()))
- {
- // can grab transparent objects (how touch event propagates, scripters rely on this)
- gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ TRUE);
- }
- mClickedInMouselook = gAgentCamera.cameraMouselook();
+ // leftButtonGrabbed() checks if controls are reserved by scripts, but does not take masks into account
+ if (!gAgent.leftButtonGrabbed() || ((mask & DEFAULT_GRAB_MASK) != 0 && !gAgentCamera.cameraMouselook()))
+ {
+ // can grab transparent objects (how touch event propagates, scripters rely on this)
+ gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ TRUE);
+ }
+ mClickedInMouselook = gAgentCamera.cameraMouselook();
if (mClickedInMouselook && gViewerInput.isLMouseHandlingDefault(MODE_FIRST_PERSON))
{
@@ -163,314 +163,314 @@ BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask)
// Todo: LLToolGrabBase probably shouldn't consume the event if there is nothing
// to grab in Mouselook, it intercepts handling in scanMouse
}
- return TRUE;
+ return TRUE;
}
void LLToolGrabBase::pickCallback(const LLPickInfo& pick_info)
{
- LLToolGrab::getInstance()->mGrabPick = pick_info;
- LLViewerObject *objectp = pick_info.getObject();
-
- BOOL extend_select = (pick_info.mKeyMask & MASK_SHIFT);
-
- if (!extend_select && !LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- LLSelectMgr::getInstance()->deselectAll();
- LLToolGrab::getInstance()->mDeselectedThisClick = TRUE;
- }
- else
- {
- LLToolGrab::getInstance()->mDeselectedThisClick = FALSE;
- }
-
- // if not over object, do nothing
- if (!objectp)
- {
- LLToolGrab::getInstance()->setMouseCapture(TRUE);
- LLToolGrab::getInstance()->mMode = GRAB_NOOBJECT;
- LLToolGrab::getInstance()->mGrabPick.mObjectID.setNull();
- }
- else
- {
- LLToolGrab::getInstance()->handleObjectHit(LLToolGrab::getInstance()->mGrabPick);
- }
+ LLToolGrab::getInstance()->mGrabPick = pick_info;
+ LLViewerObject *objectp = pick_info.getObject();
+
+ BOOL extend_select = (pick_info.mKeyMask & MASK_SHIFT);
+
+ if (!extend_select && !LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ LLToolGrab::getInstance()->mDeselectedThisClick = TRUE;
+ }
+ else
+ {
+ LLToolGrab::getInstance()->mDeselectedThisClick = FALSE;
+ }
+
+ // if not over object, do nothing
+ if (!objectp)
+ {
+ LLToolGrab::getInstance()->setMouseCapture(TRUE);
+ LLToolGrab::getInstance()->mMode = GRAB_NOOBJECT;
+ LLToolGrab::getInstance()->mGrabPick.mObjectID.setNull();
+ }
+ else
+ {
+ LLToolGrab::getInstance()->handleObjectHit(LLToolGrab::getInstance()->mGrabPick);
+ }
}
BOOL LLToolGrabBase::handleObjectHit(const LLPickInfo& info)
{
- mGrabPick = info;
- LLViewerObject* objectp = mGrabPick.getObject();
-
- if (gDebugClicks)
- {
- LL_INFOS() << "LLToolGrab handleObjectHit " << info.mMousePt.mX << "," << info.mMousePt.mY << LL_ENDL;
- }
-
- if (NULL == objectp) // unexpected
- {
- LL_WARNS() << "objectp was NULL; returning FALSE" << LL_ENDL;
- return FALSE;
- }
-
- if (objectp->isAvatar())
- {
- if (gGrabTransientTool)
- {
- gBasicToolset->selectTool( gGrabTransientTool );
- gGrabTransientTool = NULL;
- }
- return TRUE;
- }
-
- setMouseCapture( TRUE );
-
- // Grabs always start from the root
- // objectp = (LLViewerObject *)objectp->getRoot();
-
- LLViewerObject* parent = objectp->getRootEdit();
- BOOL script_touch = (objectp->flagHandleTouch()) || (parent && parent->flagHandleTouch());
-
- // Clicks on scripted or physical objects are temporary grabs, so
- // not "Build mode"
- mHideBuildHighlight = script_touch || objectp->flagUsePhysics();
-
- if (!objectp->flagUsePhysics())
- {
- if (script_touch)
- {
- mMode = GRAB_NONPHYSICAL; // if it has a script, use the non-physical grab
- }
- else
- {
- // In mouselook, we shouldn't be able to grab non-physical,
- // non-touchable objects. If it has a touch handler, we
- // do grab it (so llDetectedGrab works), but movement is
- // blocked on the server side. JC
- if (gAgentCamera.cameraMouselook())
- {
- mMode = GRAB_LOCKED;
- gViewerWindow->hideCursor();
- gViewerWindow->moveCursorToCenter();
- }
- else if (objectp->permMove() && !objectp->isPermanentEnforced())
- {
- mMode = GRAB_ACTIVE_CENTER;
- gViewerWindow->hideCursor();
- gViewerWindow->moveCursorToCenter();
- }
- else
- {
- mMode = GRAB_LOCKED;
- }
-
-
- }
- }
- else if( objectp->flagCharacter() || !objectp->permMove() || objectp->isPermanentEnforced())
- {
- // if mouse is over a physical object without move permission, show feedback if user tries to move it.
- mMode = GRAB_LOCKED;
-
- // Don't bail out here, go on and grab so buttons can get
- // their "touched" event.
- }
- else
- {
- // if mouse is over a physical object with move permission,
- // select it and enter "grab" mode (hiding cursor, etc.)
-
- mMode = GRAB_ACTIVE_CENTER;
-
- gViewerWindow->hideCursor();
- gViewerWindow->moveCursorToCenter();
- }
-
- // Always send "touched" message
-
- mLastMouseX = gViewerWindow->getCurrentMouseX();
- mLastMouseY = gViewerWindow->getCurrentMouseY();
- mAccumDeltaX = 0;
- mAccumDeltaY = 0;
- mHasMoved = FALSE;
- mOutsideSlop = FALSE;
-
- mVerticalDragging = (info.mKeyMask == MASK_VERTICAL) || gGrabBtnVertical;
-
- startGrab();
-
- if ((info.mKeyMask == MASK_SPIN) || gGrabBtnSpin)
- {
- startSpin();
- }
-
- LLSelectMgr::getInstance()->updateSelectionCenter(); // update selection beam
-
- // update point at
- LLViewerObject *edit_object = info.getObject();
- if (edit_object && info.mPickType != LLPickInfo::PICK_FLORA)
- {
- LLVector3 local_edit_point = gAgent.getPosAgentFromGlobal(info.mPosGlobal);
- local_edit_point -= edit_object->getPositionAgent();
- local_edit_point = local_edit_point * ~edit_object->getRenderRotation();
- gAgentCamera.setPointAt(POINTAT_TARGET_GRAB, edit_object, local_edit_point );
- gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, edit_object, local_edit_point );
- }
-
- // on transient grabs (clicks on world objects), kill the grab immediately
- if (!gViewerWindow->getLeftMouseDown()
- && gGrabTransientTool
- && (mMode == GRAB_NONPHYSICAL || mMode == GRAB_LOCKED))
- {
- gBasicToolset->selectTool( gGrabTransientTool );
- gGrabTransientTool = NULL;
- }
-
- return TRUE;
+ mGrabPick = info;
+ LLViewerObject* objectp = mGrabPick.getObject();
+
+ if (gDebugClicks)
+ {
+ LL_INFOS() << "LLToolGrab handleObjectHit " << info.mMousePt.mX << "," << info.mMousePt.mY << LL_ENDL;
+ }
+
+ if (NULL == objectp) // unexpected
+ {
+ LL_WARNS() << "objectp was NULL; returning FALSE" << LL_ENDL;
+ return FALSE;
+ }
+
+ if (objectp->isAvatar())
+ {
+ if (gGrabTransientTool)
+ {
+ gBasicToolset->selectTool( gGrabTransientTool );
+ gGrabTransientTool = NULL;
+ }
+ return TRUE;
+ }
+
+ setMouseCapture( TRUE );
+
+ // Grabs always start from the root
+ // objectp = (LLViewerObject *)objectp->getRoot();
+
+ LLViewerObject* parent = objectp->getRootEdit();
+ BOOL script_touch = (objectp->flagHandleTouch()) || (parent && parent->flagHandleTouch());
+
+ // Clicks on scripted or physical objects are temporary grabs, so
+ // not "Build mode"
+ mHideBuildHighlight = script_touch || objectp->flagUsePhysics();
+
+ if (!objectp->flagUsePhysics())
+ {
+ if (script_touch)
+ {
+ mMode = GRAB_NONPHYSICAL; // if it has a script, use the non-physical grab
+ }
+ else
+ {
+ // In mouselook, we shouldn't be able to grab non-physical,
+ // non-touchable objects. If it has a touch handler, we
+ // do grab it (so llDetectedGrab works), but movement is
+ // blocked on the server side. JC
+ if (gAgentCamera.cameraMouselook())
+ {
+ mMode = GRAB_LOCKED;
+ gViewerWindow->hideCursor();
+ gViewerWindow->moveCursorToCenter();
+ }
+ else if (objectp->permMove() && !objectp->isPermanentEnforced())
+ {
+ mMode = GRAB_ACTIVE_CENTER;
+ gViewerWindow->hideCursor();
+ gViewerWindow->moveCursorToCenter();
+ }
+ else
+ {
+ mMode = GRAB_LOCKED;
+ }
+
+
+ }
+ }
+ else if( objectp->flagCharacter() || !objectp->permMove() || objectp->isPermanentEnforced())
+ {
+ // if mouse is over a physical object without move permission, show feedback if user tries to move it.
+ mMode = GRAB_LOCKED;
+
+ // Don't bail out here, go on and grab so buttons can get
+ // their "touched" event.
+ }
+ else
+ {
+ // if mouse is over a physical object with move permission,
+ // select it and enter "grab" mode (hiding cursor, etc.)
+
+ mMode = GRAB_ACTIVE_CENTER;
+
+ gViewerWindow->hideCursor();
+ gViewerWindow->moveCursorToCenter();
+ }
+
+ // Always send "touched" message
+
+ mLastMouseX = gViewerWindow->getCurrentMouseX();
+ mLastMouseY = gViewerWindow->getCurrentMouseY();
+ mAccumDeltaX = 0;
+ mAccumDeltaY = 0;
+ mHasMoved = FALSE;
+ mOutsideSlop = FALSE;
+
+ mVerticalDragging = (info.mKeyMask == MASK_VERTICAL) || gGrabBtnVertical;
+
+ startGrab();
+
+ if ((info.mKeyMask == MASK_SPIN) || gGrabBtnSpin)
+ {
+ startSpin();
+ }
+
+ LLSelectMgr::getInstance()->updateSelectionCenter(); // update selection beam
+
+ // update point at
+ LLViewerObject *edit_object = info.getObject();
+ if (edit_object && info.mPickType != LLPickInfo::PICK_FLORA)
+ {
+ LLVector3 local_edit_point = gAgent.getPosAgentFromGlobal(info.mPosGlobal);
+ local_edit_point -= edit_object->getPositionAgent();
+ local_edit_point = local_edit_point * ~edit_object->getRenderRotation();
+ gAgentCamera.setPointAt(POINTAT_TARGET_GRAB, edit_object, local_edit_point );
+ gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, edit_object, local_edit_point );
+ }
+
+ // on transient grabs (clicks on world objects), kill the grab immediately
+ if (!gViewerWindow->getLeftMouseDown()
+ && gGrabTransientTool
+ && (mMode == GRAB_NONPHYSICAL || mMode == GRAB_LOCKED))
+ {
+ gBasicToolset->selectTool( gGrabTransientTool );
+ gGrabTransientTool = NULL;
+ }
+
+ return TRUE;
}
void LLToolGrabBase::startSpin()
{
- LLViewerObject* objectp = mGrabPick.getObject();
- if (!objectp)
- {
- return;
- }
- mSpinGrabbing = TRUE;
-
- // Was saveSelectedObjectTransform()
- LLViewerObject *root = (LLViewerObject *)objectp->getRoot();
- mSpinRotation = root->getRotation();
-
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ObjectSpinStart);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addUUIDFast(_PREHASH_ObjectID, mGrabPick.mObjectID );
- msg->sendMessage( objectp->getRegion()->getHost() );
+ LLViewerObject* objectp = mGrabPick.getObject();
+ if (!objectp)
+ {
+ return;
+ }
+ mSpinGrabbing = TRUE;
+
+ // Was saveSelectedObjectTransform()
+ LLViewerObject *root = (LLViewerObject *)objectp->getRoot();
+ mSpinRotation = root->getRotation();
+
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ObjectSpinStart);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addUUIDFast(_PREHASH_ObjectID, mGrabPick.mObjectID );
+ msg->sendMessage( objectp->getRegion()->getHost() );
}
void LLToolGrabBase::stopSpin()
{
- mSpinGrabbing = FALSE;
-
- LLViewerObject* objectp = mGrabPick.getObject();
- if (!objectp)
- {
- return;
- }
-
- LLMessageSystem *msg = gMessageSystem;
- switch(mMode)
- {
- case GRAB_ACTIVE_CENTER:
- case GRAB_NONPHYSICAL:
- case GRAB_LOCKED:
- msg->newMessageFast(_PREHASH_ObjectSpinStop);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
- msg->sendMessage( objectp->getRegion()->getHost() );
- break;
-
- case GRAB_NOOBJECT:
- case GRAB_INACTIVE:
- default:
- // do nothing
- break;
- }
+ mSpinGrabbing = FALSE;
+
+ LLViewerObject* objectp = mGrabPick.getObject();
+ if (!objectp)
+ {
+ return;
+ }
+
+ LLMessageSystem *msg = gMessageSystem;
+ switch(mMode)
+ {
+ case GRAB_ACTIVE_CENTER:
+ case GRAB_NONPHYSICAL:
+ case GRAB_LOCKED:
+ msg->newMessageFast(_PREHASH_ObjectSpinStop);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
+ msg->sendMessage( objectp->getRegion()->getHost() );
+ break;
+
+ case GRAB_NOOBJECT:
+ case GRAB_INACTIVE:
+ default:
+ // do nothing
+ break;
+ }
}
void LLToolGrabBase::startGrab()
{
- // Compute grab_offset in the OBJECT's root's coordinate frame
- // (sometimes root == object)
- LLViewerObject* objectp = mGrabPick.getObject();
- if (!objectp)
- {
- return;
- }
-
- LLViewerObject *root = (LLViewerObject *)objectp->getRoot();
-
- // drag from center
- LLVector3d grab_start_global = root->getPositionGlobal();
-
- // Where the grab starts, relative to the center of the root object of the set.
- // JC - This code looks wonky, but I believe it does the right thing.
- // Otherwise, when you grab a linked object set, it "pops" on the start
- // of the drag.
- LLVector3d grab_offsetd = root->getPositionGlobal() - objectp->getPositionGlobal();
-
- LLVector3 grab_offset;
- grab_offset.setVec(grab_offsetd);
-
- LLQuaternion rotation = root->getRotation();
- rotation.conjQuat();
- grab_offset = grab_offset * rotation;
-
- // This planar drag starts at the grab point
- mDragStartPointGlobal = grab_start_global;
- mDragStartFromCamera = grab_start_global - gAgentCamera.getCameraPositionGlobal();
-
- send_ObjectGrab_message(objectp, mGrabPick, grab_offset);
-
- mGrabOffsetFromCenterInitial = grab_offset;
- mGrabHiddenOffsetFromCamera = mDragStartFromCamera;
-
- mGrabTimer.reset();
-
- mLastUVCoords = mGrabPick.mUVCoords;
- mLastSTCoords = mGrabPick.mSTCoords;
- mLastFace = mGrabPick.mObjectFace;
- mLastIntersection = mGrabPick.mIntersection;
- mLastNormal = mGrabPick.mNormal;
- mLastBinormal = mGrabPick.mBinormal;
- mLastGrabPos = LLVector3(-1.f, -1.f, -1.f);
+ // Compute grab_offset in the OBJECT's root's coordinate frame
+ // (sometimes root == object)
+ LLViewerObject* objectp = mGrabPick.getObject();
+ if (!objectp)
+ {
+ return;
+ }
+
+ LLViewerObject *root = (LLViewerObject *)objectp->getRoot();
+
+ // drag from center
+ LLVector3d grab_start_global = root->getPositionGlobal();
+
+ // Where the grab starts, relative to the center of the root object of the set.
+ // JC - This code looks wonky, but I believe it does the right thing.
+ // Otherwise, when you grab a linked object set, it "pops" on the start
+ // of the drag.
+ LLVector3d grab_offsetd = root->getPositionGlobal() - objectp->getPositionGlobal();
+
+ LLVector3 grab_offset;
+ grab_offset.setVec(grab_offsetd);
+
+ LLQuaternion rotation = root->getRotation();
+ rotation.conjQuat();
+ grab_offset = grab_offset * rotation;
+
+ // This planar drag starts at the grab point
+ mDragStartPointGlobal = grab_start_global;
+ mDragStartFromCamera = grab_start_global - gAgentCamera.getCameraPositionGlobal();
+
+ send_ObjectGrab_message(objectp, mGrabPick, grab_offset);
+
+ mGrabOffsetFromCenterInitial = grab_offset;
+ mGrabHiddenOffsetFromCamera = mDragStartFromCamera;
+
+ mGrabTimer.reset();
+
+ mLastUVCoords = mGrabPick.mUVCoords;
+ mLastSTCoords = mGrabPick.mSTCoords;
+ mLastFace = mGrabPick.mObjectFace;
+ mLastIntersection = mGrabPick.mIntersection;
+ mLastNormal = mGrabPick.mNormal;
+ mLastBinormal = mGrabPick.mBinormal;
+ mLastGrabPos = LLVector3(-1.f, -1.f, -1.f);
}
BOOL LLToolGrabBase::handleHover(S32 x, S32 y, MASK mask)
{
- if (!gViewerWindow->getLeftMouseDown())
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
- setMouseCapture(FALSE);
- return TRUE;
- }
-
- // Do the right hover based on mode
- switch( mMode )
- {
- case GRAB_ACTIVE_CENTER:
- handleHoverActive( x, y, mask ); // cursor hidden
- break;
-
- case GRAB_NONPHYSICAL:
- handleHoverNonPhysical(x, y, mask);
- break;
-
- case GRAB_INACTIVE:
- handleHoverInactive( x, y, mask ); // cursor set here
- break;
-
- case GRAB_NOOBJECT:
- case GRAB_LOCKED:
- handleHoverFailed( x, y, mask );
- break;
-
- }
-
- mLastMouseX = x;
- mLastMouseY = y;
-
- return TRUE;
+ if (!gViewerWindow->getLeftMouseDown())
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
+ setMouseCapture(FALSE);
+ return TRUE;
+ }
+
+ // Do the right hover based on mode
+ switch( mMode )
+ {
+ case GRAB_ACTIVE_CENTER:
+ handleHoverActive( x, y, mask ); // cursor hidden
+ break;
+
+ case GRAB_NONPHYSICAL:
+ handleHoverNonPhysical(x, y, mask);
+ break;
+
+ case GRAB_INACTIVE:
+ handleHoverInactive( x, y, mask ); // cursor set here
+ break;
+
+ case GRAB_NOOBJECT:
+ case GRAB_LOCKED:
+ handleHoverFailed( x, y, mask );
+ break;
+
+ }
+
+ mLastMouseX = x;
+ mLastMouseY = y;
+
+ return TRUE;
}
const F32 GRAB_SENSITIVITY_X = 0.0075f;
@@ -478,487 +478,487 @@ const F32 GRAB_SENSITIVITY_Y = 0.0075f;
-
+
// Dragging.
void LLToolGrabBase::handleHoverActive(S32 x, S32 y, MASK mask)
{
- LLViewerObject* objectp = mGrabPick.getObject();
- if (!objectp || !hasMouseCapture() ) return;
- if (objectp->isDead())
- {
- // Bail out of drag because object has been killed
- setMouseCapture(FALSE);
- return;
- }
-
- //--------------------------------------------------
- // Determine target mode
- //--------------------------------------------------
- bool vertical_dragging = false;
- bool spin_grabbing = false;
- if ((mask == MASK_VERTICAL)
- || (gGrabBtnVertical && (mask != MASK_SPIN)))
- {
- vertical_dragging = TRUE;
- }
- else if ((mask == MASK_SPIN)
- || (gGrabBtnSpin && (mask != MASK_VERTICAL)))
- {
- spin_grabbing = TRUE;
- }
-
- //--------------------------------------------------
- // Toggle spinning
- //--------------------------------------------------
- if (mSpinGrabbing && !spin_grabbing)
- {
- // user released or switched mask key(s), stop spinning
- stopSpin();
- }
- else if (!mSpinGrabbing && spin_grabbing)
- {
- // user pressed mask key(s), start spinning
- startSpin();
- }
- mSpinGrabbing = spin_grabbing;
-
- //--------------------------------------------------
- // Toggle vertical dragging
- //--------------------------------------------------
- if (mVerticalDragging && !vertical_dragging)
- {
- // ...switch to horizontal dragging
- mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp);
- mDragStartFromCamera = mDragStartPointGlobal - gAgentCamera.getCameraPositionGlobal();
- }
- else if (!mVerticalDragging && vertical_dragging)
- {
- // ...switch to vertical dragging
- mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp);
- mDragStartFromCamera = mDragStartPointGlobal - gAgentCamera.getCameraPositionGlobal();
- }
- mVerticalDragging = vertical_dragging;
-
- const F32 RADIANS_PER_PIXEL_X = 0.01f;
- const F32 RADIANS_PER_PIXEL_Y = 0.01f;
+ LLViewerObject* objectp = mGrabPick.getObject();
+ if (!objectp || !hasMouseCapture() ) return;
+ if (objectp->isDead())
+ {
+ // Bail out of drag because object has been killed
+ setMouseCapture(FALSE);
+ return;
+ }
+
+ //--------------------------------------------------
+ // Determine target mode
+ //--------------------------------------------------
+ bool vertical_dragging = false;
+ bool spin_grabbing = false;
+ if ((mask == MASK_VERTICAL)
+ || (gGrabBtnVertical && (mask != MASK_SPIN)))
+ {
+ vertical_dragging = TRUE;
+ }
+ else if ((mask == MASK_SPIN)
+ || (gGrabBtnSpin && (mask != MASK_VERTICAL)))
+ {
+ spin_grabbing = TRUE;
+ }
+
+ //--------------------------------------------------
+ // Toggle spinning
+ //--------------------------------------------------
+ if (mSpinGrabbing && !spin_grabbing)
+ {
+ // user released or switched mask key(s), stop spinning
+ stopSpin();
+ }
+ else if (!mSpinGrabbing && spin_grabbing)
+ {
+ // user pressed mask key(s), start spinning
+ startSpin();
+ }
+ mSpinGrabbing = spin_grabbing;
+
+ //--------------------------------------------------
+ // Toggle vertical dragging
+ //--------------------------------------------------
+ if (mVerticalDragging && !vertical_dragging)
+ {
+ // ...switch to horizontal dragging
+ mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp);
+ mDragStartFromCamera = mDragStartPointGlobal - gAgentCamera.getCameraPositionGlobal();
+ }
+ else if (!mVerticalDragging && vertical_dragging)
+ {
+ // ...switch to vertical dragging
+ mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp);
+ mDragStartFromCamera = mDragStartPointGlobal - gAgentCamera.getCameraPositionGlobal();
+ }
+ mVerticalDragging = vertical_dragging;
+
+ const F32 RADIANS_PER_PIXEL_X = 0.01f;
+ const F32 RADIANS_PER_PIXEL_Y = 0.01f;
S32 dx = gViewerWindow->getCurrentMouseDX();
S32 dy = gViewerWindow->getCurrentMouseDY();
- if (dx != 0 || dy != 0)
- {
- mAccumDeltaX += dx;
- mAccumDeltaY += dy;
- S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY;
- if (dist_sq > SLOP_DIST_SQ)
- {
- mOutsideSlop = TRUE;
- }
-
- // mouse has moved outside center
- mHasMoved = TRUE;
-
- if (mSpinGrabbing)
- {
- //------------------------------------------------------
- // Handle spinning
- //------------------------------------------------------
-
- // x motion maps to rotation around vertical axis
- LLVector3 up(0.f, 0.f, 1.f);
- LLQuaternion rotation_around_vertical( dx*RADIANS_PER_PIXEL_X, up );
-
- // y motion maps to rotation around left axis
- const LLVector3 &agent_left = LLViewerCamera::getInstance()->getLeftAxis();
- LLQuaternion rotation_around_left( dy*RADIANS_PER_PIXEL_Y, agent_left );
-
- // compose with current rotation
- mSpinRotation = mSpinRotation * rotation_around_vertical;
- mSpinRotation = mSpinRotation * rotation_around_left;
-
- // TODO: Throttle these
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ObjectSpinUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
- msg->addQuatFast(_PREHASH_Rotation, mSpinRotation );
- msg->sendMessage( objectp->getRegion()->getHost() );
- }
- else
- {
- //------------------------------------------------------
- // Handle grabbing
- //------------------------------------------------------
-
- LLVector3d x_part;
- x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis());
- x_part.mdV[VZ] = 0.0;
- x_part.normVec();
-
- LLVector3d y_part;
- if( mVerticalDragging )
- {
- y_part.setVec(LLViewerCamera::getInstance()->getUpAxis());
- // y_part.setVec(0.f, 0.f, 1.f);
- }
- else
- {
- // drag toward camera
- y_part = x_part % LLVector3d::z_axis;
- y_part.mdV[VZ] = 0.0;
- y_part.normVec();
- }
-
- mGrabHiddenOffsetFromCamera = mGrabHiddenOffsetFromCamera
- + (x_part * (-dx * GRAB_SENSITIVITY_X))
- + (y_part * ( dy * GRAB_SENSITIVITY_Y));
-
-
- // Send the message to the viewer.
- F32 dt = mGrabTimer.getElapsedTimeAndResetF32();
- U32 dt_milliseconds = (U32) (1000.f * dt);
-
- // need to return offset from mGrabStartPoint
- LLVector3d grab_point_global;
-
- grab_point_global = gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera;
-
- /* Snap to grid disabled for grab tool - very confusing
- // Handle snapping to grid, but only when the tool is formally selected.
- BOOL snap_on = gSavedSettings.getBOOL("SnapEnabled");
- if (snap_on && !gGrabTransientTool)
- {
- F64 snap_size = gSavedSettings.getF32("GridResolution");
- U8 snap_dimensions = (mVerticalDragging ? 3 : 2);
-
- for (U8 i = 0; i < snap_dimensions; i++)
- {
- grab_point_global.mdV[i] += snap_size / 2;
- grab_point_global.mdV[i] -= fmod(grab_point_global.mdV[i], snap_size);
- }
- }
- */
-
- // Don't let object centers go underground.
- F32 land_height = LLWorld::getInstance()->resolveLandHeightGlobal(grab_point_global);
-
- if (grab_point_global.mdV[VZ] < land_height)
- {
- grab_point_global.mdV[VZ] = land_height;
- }
-
- // For safety, cap heights where objects can be dragged
- if (grab_point_global.mdV[VZ] > MAX_OBJECT_Z)
- {
- grab_point_global.mdV[VZ] = MAX_OBJECT_Z;
- }
-
- grab_point_global = LLWorld::getInstance()->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global);
- // propagate constrained grab point back to grab offset
- mGrabHiddenOffsetFromCamera = grab_point_global - gAgentCamera.getCameraPositionGlobal();
-
- // Handle auto-rotation at screen edge.
- LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global );
-
- LLCoordGL grab_center_gl( gViewerWindow->getWorldViewWidthScaled() / 2, gViewerWindow->getWorldViewHeightScaled() / 2);
- LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl);
-
- const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidthScaled() / 20;
- const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD;
- const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
- // ...build mode moves camera about focus point
- if (grab_center_gl.mX < ROTATE_H_MARGIN)
- {
- if (gAgentCamera.getFocusOnAvatar())
- {
- gAgent.yaw(rotate_angle);
- }
- else
- {
- gAgentCamera.cameraOrbitAround(rotate_angle);
- }
- }
- else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidthScaled() - ROTATE_H_MARGIN)
- {
- if (gAgentCamera.getFocusOnAvatar())
- {
- gAgent.yaw(-rotate_angle);
- }
- else
- {
- gAgentCamera.cameraOrbitAround(-rotate_angle);
- }
- }
-
- // Don't move above top of screen or below bottom
- if ((grab_center_gl.mY < gViewerWindow->getWorldViewHeightScaled() - 6)
- && (grab_center_gl.mY > 24))
- {
- // Transmit update to simulator
- LLVector3 grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global );
-
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ObjectGrabUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
- msg->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial );
- msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region );
- msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds );
- msg->nextBlock("SurfaceInfo");
- msg->addVector3("UVCoord", LLVector3(mGrabPick.mUVCoords));
- msg->addVector3("STCoord", LLVector3(mGrabPick.mSTCoords));
- msg->addS32Fast(_PREHASH_FaceIndex, mGrabPick.mObjectFace);
- msg->addVector3("Position", mGrabPick.mIntersection);
- msg->addVector3("Normal", mGrabPick.mNormal);
- msg->addVector3("Binormal", mGrabPick.mBinormal);
-
- msg->sendMessage( objectp->getRegion()->getHost() );
- }
- }
-
- gViewerWindow->moveCursorToCenter();
-
- LLSelectMgr::getInstance()->updateSelectionCenter();
-
- }
-
- // once we've initiated a drag, lock the camera down
- if (mHasMoved)
- {
- if (!gAgentCamera.cameraMouselook() &&
- !objectp->isHUDAttachment() &&
- objectp->getRoot() == gAgentAvatarp->getRoot())
- {
- // we are essentially editing object position
- if (!gSavedSettings.getBOOL("EditCameraMovement"))
- {
- // force focus to point in space where we were looking previously
- // Example of use: follow cam scripts shouldn't affect you when movng objects arouns
- gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null);
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
- }
- }
- else
- {
- gAgentCamera.clearFocusObject();
- }
- }
-
- // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden.
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
-
- LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (active) [cursor hidden]" << LL_ENDL;
+ if (dx != 0 || dy != 0)
+ {
+ mAccumDeltaX += dx;
+ mAccumDeltaY += dy;
+ S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY;
+ if (dist_sq > SLOP_DIST_SQ)
+ {
+ mOutsideSlop = TRUE;
+ }
+
+ // mouse has moved outside center
+ mHasMoved = TRUE;
+
+ if (mSpinGrabbing)
+ {
+ //------------------------------------------------------
+ // Handle spinning
+ //------------------------------------------------------
+
+ // x motion maps to rotation around vertical axis
+ LLVector3 up(0.f, 0.f, 1.f);
+ LLQuaternion rotation_around_vertical( dx*RADIANS_PER_PIXEL_X, up );
+
+ // y motion maps to rotation around left axis
+ const LLVector3 &agent_left = LLViewerCamera::getInstance()->getLeftAxis();
+ LLQuaternion rotation_around_left( dy*RADIANS_PER_PIXEL_Y, agent_left );
+
+ // compose with current rotation
+ mSpinRotation = mSpinRotation * rotation_around_vertical;
+ mSpinRotation = mSpinRotation * rotation_around_left;
+
+ // TODO: Throttle these
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ObjectSpinUpdate);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
+ msg->addQuatFast(_PREHASH_Rotation, mSpinRotation );
+ msg->sendMessage( objectp->getRegion()->getHost() );
+ }
+ else
+ {
+ //------------------------------------------------------
+ // Handle grabbing
+ //------------------------------------------------------
+
+ LLVector3d x_part;
+ x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis());
+ x_part.mdV[VZ] = 0.0;
+ x_part.normVec();
+
+ LLVector3d y_part;
+ if( mVerticalDragging )
+ {
+ y_part.setVec(LLViewerCamera::getInstance()->getUpAxis());
+ // y_part.setVec(0.f, 0.f, 1.f);
+ }
+ else
+ {
+ // drag toward camera
+ y_part = x_part % LLVector3d::z_axis;
+ y_part.mdV[VZ] = 0.0;
+ y_part.normVec();
+ }
+
+ mGrabHiddenOffsetFromCamera = mGrabHiddenOffsetFromCamera
+ + (x_part * (-dx * GRAB_SENSITIVITY_X))
+ + (y_part * ( dy * GRAB_SENSITIVITY_Y));
+
+
+ // Send the message to the viewer.
+ F32 dt = mGrabTimer.getElapsedTimeAndResetF32();
+ U32 dt_milliseconds = (U32) (1000.f * dt);
+
+ // need to return offset from mGrabStartPoint
+ LLVector3d grab_point_global;
+
+ grab_point_global = gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera;
+
+ /* Snap to grid disabled for grab tool - very confusing
+ // Handle snapping to grid, but only when the tool is formally selected.
+ BOOL snap_on = gSavedSettings.getBOOL("SnapEnabled");
+ if (snap_on && !gGrabTransientTool)
+ {
+ F64 snap_size = gSavedSettings.getF32("GridResolution");
+ U8 snap_dimensions = (mVerticalDragging ? 3 : 2);
+
+ for (U8 i = 0; i < snap_dimensions; i++)
+ {
+ grab_point_global.mdV[i] += snap_size / 2;
+ grab_point_global.mdV[i] -= fmod(grab_point_global.mdV[i], snap_size);
+ }
+ }
+ */
+
+ // Don't let object centers go underground.
+ F32 land_height = LLWorld::getInstance()->resolveLandHeightGlobal(grab_point_global);
+
+ if (grab_point_global.mdV[VZ] < land_height)
+ {
+ grab_point_global.mdV[VZ] = land_height;
+ }
+
+ // For safety, cap heights where objects can be dragged
+ if (grab_point_global.mdV[VZ] > MAX_OBJECT_Z)
+ {
+ grab_point_global.mdV[VZ] = MAX_OBJECT_Z;
+ }
+
+ grab_point_global = LLWorld::getInstance()->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global);
+ // propagate constrained grab point back to grab offset
+ mGrabHiddenOffsetFromCamera = grab_point_global - gAgentCamera.getCameraPositionGlobal();
+
+ // Handle auto-rotation at screen edge.
+ LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global );
+
+ LLCoordGL grab_center_gl( gViewerWindow->getWorldViewWidthScaled() / 2, gViewerWindow->getWorldViewHeightScaled() / 2);
+ LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl);
+
+ const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidthScaled() / 20;
+ const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD;
+ const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
+ // ...build mode moves camera about focus point
+ if (grab_center_gl.mX < ROTATE_H_MARGIN)
+ {
+ if (gAgentCamera.getFocusOnAvatar())
+ {
+ gAgent.yaw(rotate_angle);
+ }
+ else
+ {
+ gAgentCamera.cameraOrbitAround(rotate_angle);
+ }
+ }
+ else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidthScaled() - ROTATE_H_MARGIN)
+ {
+ if (gAgentCamera.getFocusOnAvatar())
+ {
+ gAgent.yaw(-rotate_angle);
+ }
+ else
+ {
+ gAgentCamera.cameraOrbitAround(-rotate_angle);
+ }
+ }
+
+ // Don't move above top of screen or below bottom
+ if ((grab_center_gl.mY < gViewerWindow->getWorldViewHeightScaled() - 6)
+ && (grab_center_gl.mY > 24))
+ {
+ // Transmit update to simulator
+ LLVector3 grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global );
+
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ObjectGrabUpdate);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
+ msg->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial );
+ msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region );
+ msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds );
+ msg->nextBlock("SurfaceInfo");
+ msg->addVector3("UVCoord", LLVector3(mGrabPick.mUVCoords));
+ msg->addVector3("STCoord", LLVector3(mGrabPick.mSTCoords));
+ msg->addS32Fast(_PREHASH_FaceIndex, mGrabPick.mObjectFace);
+ msg->addVector3("Position", mGrabPick.mIntersection);
+ msg->addVector3("Normal", mGrabPick.mNormal);
+ msg->addVector3("Binormal", mGrabPick.mBinormal);
+
+ msg->sendMessage( objectp->getRegion()->getHost() );
+ }
+ }
+
+ gViewerWindow->moveCursorToCenter();
+
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+
+ }
+
+ // once we've initiated a drag, lock the camera down
+ if (mHasMoved)
+ {
+ if (!gAgentCamera.cameraMouselook() &&
+ !objectp->isHUDAttachment() &&
+ objectp->getRoot() == gAgentAvatarp->getRoot())
+ {
+ // we are essentially editing object position
+ if (!gSavedSettings.getBOOL("EditCameraMovement"))
+ {
+ // force focus to point in space where we were looking previously
+ // Example of use: follow cam scripts shouldn't affect you when movng objects arouns
+ gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null);
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+ }
+ }
+ else
+ {
+ gAgentCamera.clearFocusObject();
+ }
+ }
+
+ // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden.
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+
+ LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (active) [cursor hidden]" << LL_ENDL;
}
-
+
void LLToolGrabBase::handleHoverNonPhysical(S32 x, S32 y, MASK mask)
{
- LLViewerObject* objectp = mGrabPick.getObject();
- if (!objectp || !hasMouseCapture() ) return;
- if (objectp->isDead())
- {
- // Bail out of drag because object has been killed
- setMouseCapture(FALSE);
- return;
- }
-
- LLPickInfo pick = mGrabPick;
- pick.mMousePt = LLCoordGL(x, y);
- pick.getSurfaceInfo();
-
- // compute elapsed time
- F32 dt = mGrabTimer.getElapsedTimeAndResetF32();
- U32 dt_milliseconds = (U32) (1000.f * dt);
-
- // i'm not a big fan of the following code - it's been culled from the physical grab case.
- // ideally these two would be nicely integrated - but the code in that method is a serious
- // mess of spaghetti. so here we go:
-
- LLVector3 grab_pos_region(0,0,0);
-
- const BOOL SUPPORT_LLDETECTED_GRAB = TRUE;
- if (SUPPORT_LLDETECTED_GRAB)
- {
- //--------------------------------------------------
- // Toggle vertical dragging
- //--------------------------------------------------
- if (!(mask == MASK_VERTICAL) && !gGrabBtnVertical)
- {
- mVerticalDragging = FALSE;
- }
-
- else if ((gGrabBtnVertical && (mask != MASK_SPIN))
- || (mask == MASK_VERTICAL))
- {
- mVerticalDragging = TRUE;
- }
-
- S32 dx = x - mLastMouseX;
- S32 dy = y - mLastMouseY;
-
- if (dx != 0 || dy != 0)
- {
- mAccumDeltaX += dx;
- mAccumDeltaY += dy;
-
- S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY;
- if (dist_sq > SLOP_DIST_SQ)
- {
- mOutsideSlop = TRUE;
- }
-
- // mouse has moved
- mHasMoved = TRUE;
-
- //------------------------------------------------------
- // Handle grabbing
- //------------------------------------------------------
-
- LLVector3d x_part;
- x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis());
- x_part.mdV[VZ] = 0.0;
- x_part.normVec();
-
- LLVector3d y_part;
- if( mVerticalDragging )
- {
- y_part.setVec(LLViewerCamera::getInstance()->getUpAxis());
- // y_part.setVec(0.f, 0.f, 1.f);
- }
- else
- {
- // drag toward camera
- y_part = x_part % LLVector3d::z_axis;
- y_part.mdV[VZ] = 0.0;
- y_part.normVec();
- }
-
- mGrabHiddenOffsetFromCamera = mGrabHiddenOffsetFromCamera
- + (x_part * (-dx * GRAB_SENSITIVITY_X))
- + (y_part * ( dy * GRAB_SENSITIVITY_Y));
-
- }
-
- // need to return offset from mGrabStartPoint
- LLVector3d grab_point_global = gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera;
- grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global );
- }
-
-
- // only send message if something has changed since last message
-
- BOOL changed_since_last_update = FALSE;
-
- // test if touch data needs to be updated
- if ((pick.mObjectFace != mLastFace) ||
- (pick.mUVCoords != mLastUVCoords) ||
- (pick.mSTCoords != mLastSTCoords) ||
- (pick.mIntersection != mLastIntersection) ||
- (pick.mNormal != mLastNormal) ||
- (pick.mBinormal != mLastBinormal) ||
- (grab_pos_region != mLastGrabPos))
- {
- changed_since_last_update = TRUE;
- }
-
- if (changed_since_last_update)
- {
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ObjectGrabUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
- msg->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial );
- msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region );
- msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds );
- msg->nextBlock("SurfaceInfo");
- msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
- msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
- msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
- msg->addVector3("Position", pick.mIntersection);
- msg->addVector3("Normal", pick.mNormal);
- msg->addVector3("Binormal", pick.mBinormal);
-
- msg->sendMessage( objectp->getRegion()->getHost() );
-
- mLastUVCoords = pick.mUVCoords;
- mLastSTCoords = pick.mSTCoords;
- mLastFace = pick.mObjectFace;
- mLastIntersection = pick.mIntersection;
- mLastNormal= pick.mNormal;
- mLastBinormal= pick.mBinormal;
- mLastGrabPos = grab_pos_region;
- }
-
- // update point-at / look-at
- if (pick.mObjectFace != -1) // if the intersection was on the surface of the obejct
- {
- LLVector3 local_edit_point = pick.mIntersection;
- local_edit_point -= objectp->getPositionAgent();
- local_edit_point = local_edit_point * ~objectp->getRenderRotation();
- gAgentCamera.setPointAt(POINTAT_TARGET_GRAB, objectp, local_edit_point );
- gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, objectp, local_edit_point );
- }
-
-
-
- gViewerWindow->setCursor(UI_CURSOR_HAND);
+ LLViewerObject* objectp = mGrabPick.getObject();
+ if (!objectp || !hasMouseCapture() ) return;
+ if (objectp->isDead())
+ {
+ // Bail out of drag because object has been killed
+ setMouseCapture(FALSE);
+ return;
+ }
+
+ LLPickInfo pick = mGrabPick;
+ pick.mMousePt = LLCoordGL(x, y);
+ pick.getSurfaceInfo();
+
+ // compute elapsed time
+ F32 dt = mGrabTimer.getElapsedTimeAndResetF32();
+ U32 dt_milliseconds = (U32) (1000.f * dt);
+
+ // i'm not a big fan of the following code - it's been culled from the physical grab case.
+ // ideally these two would be nicely integrated - but the code in that method is a serious
+ // mess of spaghetti. so here we go:
+
+ LLVector3 grab_pos_region(0,0,0);
+
+ const BOOL SUPPORT_LLDETECTED_GRAB = TRUE;
+ if (SUPPORT_LLDETECTED_GRAB)
+ {
+ //--------------------------------------------------
+ // Toggle vertical dragging
+ //--------------------------------------------------
+ if (!(mask == MASK_VERTICAL) && !gGrabBtnVertical)
+ {
+ mVerticalDragging = FALSE;
+ }
+
+ else if ((gGrabBtnVertical && (mask != MASK_SPIN))
+ || (mask == MASK_VERTICAL))
+ {
+ mVerticalDragging = TRUE;
+ }
+
+ S32 dx = x - mLastMouseX;
+ S32 dy = y - mLastMouseY;
+
+ if (dx != 0 || dy != 0)
+ {
+ mAccumDeltaX += dx;
+ mAccumDeltaY += dy;
+
+ S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY;
+ if (dist_sq > SLOP_DIST_SQ)
+ {
+ mOutsideSlop = TRUE;
+ }
+
+ // mouse has moved
+ mHasMoved = TRUE;
+
+ //------------------------------------------------------
+ // Handle grabbing
+ //------------------------------------------------------
+
+ LLVector3d x_part;
+ x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis());
+ x_part.mdV[VZ] = 0.0;
+ x_part.normVec();
+
+ LLVector3d y_part;
+ if( mVerticalDragging )
+ {
+ y_part.setVec(LLViewerCamera::getInstance()->getUpAxis());
+ // y_part.setVec(0.f, 0.f, 1.f);
+ }
+ else
+ {
+ // drag toward camera
+ y_part = x_part % LLVector3d::z_axis;
+ y_part.mdV[VZ] = 0.0;
+ y_part.normVec();
+ }
+
+ mGrabHiddenOffsetFromCamera = mGrabHiddenOffsetFromCamera
+ + (x_part * (-dx * GRAB_SENSITIVITY_X))
+ + (y_part * ( dy * GRAB_SENSITIVITY_Y));
+
+ }
+
+ // need to return offset from mGrabStartPoint
+ LLVector3d grab_point_global = gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera;
+ grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global );
+ }
+
+
+ // only send message if something has changed since last message
+
+ BOOL changed_since_last_update = FALSE;
+
+ // test if touch data needs to be updated
+ if ((pick.mObjectFace != mLastFace) ||
+ (pick.mUVCoords != mLastUVCoords) ||
+ (pick.mSTCoords != mLastSTCoords) ||
+ (pick.mIntersection != mLastIntersection) ||
+ (pick.mNormal != mLastNormal) ||
+ (pick.mBinormal != mLastBinormal) ||
+ (grab_pos_region != mLastGrabPos))
+ {
+ changed_since_last_update = TRUE;
+ }
+
+ if (changed_since_last_update)
+ {
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ObjectGrabUpdate);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
+ msg->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial );
+ msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region );
+ msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds );
+ msg->nextBlock("SurfaceInfo");
+ msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
+ msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
+ msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
+ msg->addVector3("Position", pick.mIntersection);
+ msg->addVector3("Normal", pick.mNormal);
+ msg->addVector3("Binormal", pick.mBinormal);
+
+ msg->sendMessage( objectp->getRegion()->getHost() );
+
+ mLastUVCoords = pick.mUVCoords;
+ mLastSTCoords = pick.mSTCoords;
+ mLastFace = pick.mObjectFace;
+ mLastIntersection = pick.mIntersection;
+ mLastNormal= pick.mNormal;
+ mLastBinormal= pick.mBinormal;
+ mLastGrabPos = grab_pos_region;
+ }
+
+ // update point-at / look-at
+ if (pick.mObjectFace != -1) // if the intersection was on the surface of the obejct
+ {
+ LLVector3 local_edit_point = pick.mIntersection;
+ local_edit_point -= objectp->getPositionAgent();
+ local_edit_point = local_edit_point * ~objectp->getRenderRotation();
+ gAgentCamera.setPointAt(POINTAT_TARGET_GRAB, objectp, local_edit_point );
+ gAgentCamera.setLookAt(LOOKAT_TARGET_SELECT, objectp, local_edit_point );
+ }
+
+
+
+ gViewerWindow->setCursor(UI_CURSOR_HAND);
}
-
+
// Not dragging. Just showing affordances
void LLToolGrabBase::handleHoverInactive(S32 x, S32 y, MASK mask)
{
- // JC - TODO - change cursor based on gGrabBtnVertical, gGrabBtnSpin
- LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (inactive-not over editable object)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
+ // JC - TODO - change cursor based on gGrabBtnVertical, gGrabBtnSpin
+ LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (inactive-not over editable object)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
}
// User is trying to do something that's not allowed.
void LLToolGrabBase::handleHoverFailed(S32 x, S32 y, MASK mask)
{
- if( GRAB_NOOBJECT == mMode )
- {
- gViewerWindow->setCursor(UI_CURSOR_NO);
- LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (not on object)" << LL_ENDL;
- }
- else
- {
- S32 dist_sq = (x-mGrabPick.mMousePt.mX) * (x-mGrabPick.mMousePt.mX) + (y-mGrabPick.mMousePt.mY) * (y-mGrabPick.mMousePt.mY);
- if( mOutsideSlop || dist_sq > SLOP_DIST_SQ )
- {
- mOutsideSlop = TRUE;
-
- switch( mMode )
- {
- case GRAB_LOCKED:
- gViewerWindow->setCursor(UI_CURSOR_GRABLOCKED);
- LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed, no move permission)" << LL_ENDL;
- break;
-
-// Non physical now handled by handleHoverActive - CRO
-// case GRAB_NONPHYSICAL:
-// gViewerWindow->setCursor(UI_CURSOR_ARROW);
-// LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed, nonphysical)" << LL_ENDL;
-// break;
- default:
- llassert(0);
- }
- }
- else
- {
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed but within slop)" << LL_ENDL;
- }
- }
+ if( GRAB_NOOBJECT == mMode )
+ {
+ gViewerWindow->setCursor(UI_CURSOR_NO);
+ LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (not on object)" << LL_ENDL;
+ }
+ else
+ {
+ S32 dist_sq = (x-mGrabPick.mMousePt.mX) * (x-mGrabPick.mMousePt.mX) + (y-mGrabPick.mMousePt.mY) * (y-mGrabPick.mMousePt.mY);
+ if( mOutsideSlop || dist_sq > SLOP_DIST_SQ )
+ {
+ mOutsideSlop = TRUE;
+
+ switch( mMode )
+ {
+ case GRAB_LOCKED:
+ gViewerWindow->setCursor(UI_CURSOR_GRABLOCKED);
+ LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed, no move permission)" << LL_ENDL;
+ break;
+
+// Non physical now handled by handleHoverActive - CRO
+// case GRAB_NONPHYSICAL:
+// gViewerWindow->setCursor(UI_CURSOR_ARROW);
+// LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed, nonphysical)" << LL_ENDL;
+// break;
+ default:
+ llassert(0);
+ }
+ }
+ else
+ {
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed but within slop)" << LL_ENDL;
+ }
+ }
}
@@ -966,7 +966,7 @@ void LLToolGrabBase::handleHoverFailed(S32 x, S32 y, MASK mask)
BOOL LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask)
{
- LLTool::handleMouseUp(x, y, mask);
+ LLTool::handleMouseUp(x, y, mask);
if (gAgentCamera.cameraMouselook() && gViewerInput.isLMouseHandlingDefault(MODE_FIRST_PERSON))
{
@@ -978,135 +978,135 @@ BOOL LLToolGrabBase::handleMouseUp(S32 x, S32 y, MASK mask)
gAgent.setControlFlags(AGENT_CONTROL_LBUTTON_UP);
}
- if( hasMouseCapture() )
- {
- setMouseCapture( FALSE );
- }
+ if( hasMouseCapture() )
+ {
+ setMouseCapture( FALSE );
+ }
- mMode = GRAB_INACTIVE;
+ mMode = GRAB_INACTIVE;
- if(mClickedInMouselook && !gAgentCamera.cameraMouselook())
- {
- mClickedInMouselook = FALSE;
- }
- else
- {
- // HACK: Make some grabs temporary
- if (gGrabTransientTool)
- {
- gBasicToolset->selectTool( gGrabTransientTool );
- gGrabTransientTool = NULL;
- }
- }
+ if(mClickedInMouselook && !gAgentCamera.cameraMouselook())
+ {
+ mClickedInMouselook = FALSE;
+ }
+ else
+ {
+ // HACK: Make some grabs temporary
+ if (gGrabTransientTool)
+ {
+ gBasicToolset->selectTool( gGrabTransientTool );
+ gGrabTransientTool = NULL;
+ }
+ }
- //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
+ //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
- return TRUE;
-}
+ return TRUE;
+}
void LLToolGrabBase::stopEditing()
{
- if( hasMouseCapture() )
- {
- setMouseCapture( FALSE );
- }
+ if( hasMouseCapture() )
+ {
+ setMouseCapture( FALSE );
+ }
}
void LLToolGrabBase::onMouseCaptureLost()
{
- LLViewerObject* objectp = mGrabPick.getObject();
- if (!objectp)
- {
- gViewerWindow->showCursor();
- return;
- }
- // First, fix cursor placement
- if( !gAgentCamera.cameraMouselook()
- && (GRAB_ACTIVE_CENTER == mMode))
- {
- if (objectp->isHUDAttachment())
- {
- // ...move cursor "naturally", as if it had moved when hidden
- S32 x = mGrabPick.mMousePt.mX + mAccumDeltaX;
- S32 y = mGrabPick.mMousePt.mY + mAccumDeltaY;
- LLUI::getInstance()->setMousePositionScreen(x, y);
- }
- else if (mHasMoved)
- {
- // ...move cursor back to the center of the object
- LLVector3 grab_point_agent = objectp->getRenderPosition();
-
- LLCoordGL gl_point;
- if (LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_point_agent, gl_point))
- {
- LLUI::getInstance()->setMousePositionScreen(gl_point.mX, gl_point.mY);
- }
- }
- else
- {
- // ...move cursor back to click position
- LLUI::getInstance()->setMousePositionScreen(mGrabPick.mMousePt.mX, mGrabPick.mMousePt.mY);
- }
-
- gViewerWindow->showCursor();
- }
-
- stopGrab();
- if (mSpinGrabbing)
- stopSpin();
-
- mMode = GRAB_INACTIVE;
-
- mHideBuildHighlight = FALSE;
-
- mGrabPick.mObjectID.setNull();
-
- LLSelectMgr::getInstance()->updateSelectionCenter();
- gAgentCamera.setPointAt(POINTAT_TARGET_CLEAR);
- gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
-
- dialog_refresh_all();
+ LLViewerObject* objectp = mGrabPick.getObject();
+ if (!objectp)
+ {
+ gViewerWindow->showCursor();
+ return;
+ }
+ // First, fix cursor placement
+ if( !gAgentCamera.cameraMouselook()
+ && (GRAB_ACTIVE_CENTER == mMode))
+ {
+ if (objectp->isHUDAttachment())
+ {
+ // ...move cursor "naturally", as if it had moved when hidden
+ S32 x = mGrabPick.mMousePt.mX + mAccumDeltaX;
+ S32 y = mGrabPick.mMousePt.mY + mAccumDeltaY;
+ LLUI::getInstance()->setMousePositionScreen(x, y);
+ }
+ else if (mHasMoved)
+ {
+ // ...move cursor back to the center of the object
+ LLVector3 grab_point_agent = objectp->getRenderPosition();
+
+ LLCoordGL gl_point;
+ if (LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_point_agent, gl_point))
+ {
+ LLUI::getInstance()->setMousePositionScreen(gl_point.mX, gl_point.mY);
+ }
+ }
+ else
+ {
+ // ...move cursor back to click position
+ LLUI::getInstance()->setMousePositionScreen(mGrabPick.mMousePt.mX, mGrabPick.mMousePt.mY);
+ }
+
+ gViewerWindow->showCursor();
+ }
+
+ stopGrab();
+ if (mSpinGrabbing)
+ stopSpin();
+
+ mMode = GRAB_INACTIVE;
+
+ mHideBuildHighlight = FALSE;
+
+ mGrabPick.mObjectID.setNull();
+
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ gAgentCamera.setPointAt(POINTAT_TARGET_CLEAR);
+ gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
+
+ dialog_refresh_all();
}
void LLToolGrabBase::stopGrab()
{
- LLViewerObject* objectp = mGrabPick.getObject();
- if (!objectp)
- {
- return;
- }
-
- LLPickInfo pick = mGrabPick;
-
- if (mMode == GRAB_NONPHYSICAL)
- {
- // for non-physical (touch) grabs,
- // gather surface info for this degrab (mouse-up)
- S32 x = gViewerWindow->getCurrentMouseX();
- S32 y = gViewerWindow->getCurrentMouseY();
- pick.mMousePt = LLCoordGL(x, y);
- pick.getSurfaceInfo();
- }
-
- // Next, send messages to simulator
- switch(mMode)
- {
- case GRAB_ACTIVE_CENTER:
- case GRAB_NONPHYSICAL:
- case GRAB_LOCKED:
- send_ObjectDeGrab_message(objectp, pick);
- mVerticalDragging = FALSE;
- break;
-
- case GRAB_NOOBJECT:
- case GRAB_INACTIVE:
- default:
- // do nothing
- break;
- }
-
- mHideBuildHighlight = FALSE;
+ LLViewerObject* objectp = mGrabPick.getObject();
+ if (!objectp)
+ {
+ return;
+ }
+
+ LLPickInfo pick = mGrabPick;
+
+ if (mMode == GRAB_NONPHYSICAL)
+ {
+ // for non-physical (touch) grabs,
+ // gather surface info for this degrab (mouse-up)
+ S32 x = gViewerWindow->getCurrentMouseX();
+ S32 y = gViewerWindow->getCurrentMouseY();
+ pick.mMousePt = LLCoordGL(x, y);
+ pick.getSurfaceInfo();
+ }
+
+ // Next, send messages to simulator
+ switch(mMode)
+ {
+ case GRAB_ACTIVE_CENTER:
+ case GRAB_NONPHYSICAL:
+ case GRAB_LOCKED:
+ send_ObjectDeGrab_message(objectp, pick);
+ mVerticalDragging = FALSE;
+ break;
+
+ case GRAB_NOOBJECT:
+ case GRAB_INACTIVE:
+ default:
+ // do nothing
+ break;
+ }
+
+ mHideBuildHighlight = FALSE;
}
@@ -1118,94 +1118,94 @@ void LLToolGrabBase::render()
BOOL LLToolGrabBase::isEditing()
{
- return (mGrabPick.getObject().notNull());
+ return (mGrabPick.getObject().notNull());
}
LLViewerObject* LLToolGrabBase::getEditingObject()
{
- return mGrabPick.getObject();
+ return mGrabPick.getObject();
}
LLVector3d LLToolGrabBase::getEditingPointGlobal()
{
- return getGrabPointGlobal();
+ return getGrabPointGlobal();
}
LLVector3d LLToolGrabBase::getGrabPointGlobal()
{
- switch(mMode)
- {
- case GRAB_ACTIVE_CENTER:
- case GRAB_NONPHYSICAL:
- case GRAB_LOCKED:
- return gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera;
-
- case GRAB_NOOBJECT:
- case GRAB_INACTIVE:
- default:
- return gAgent.getPositionGlobal();
- }
+ switch(mMode)
+ {
+ case GRAB_ACTIVE_CENTER:
+ case GRAB_NONPHYSICAL:
+ case GRAB_LOCKED:
+ return gAgentCamera.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera;
+
+ case GRAB_NOOBJECT:
+ case GRAB_INACTIVE:
+ default:
+ return gAgent.getPositionGlobal();
+ }
}
void send_ObjectGrab_message(LLViewerObject* object, const LLPickInfo & pick, const LLVector3 &grab_offset)
{
- if (!object) return;
-
- LLMessageSystem *msg = gMessageSystem;
-
- msg->newMessageFast(_PREHASH_ObjectGrab);
- msg->nextBlockFast( _PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast( _PREHASH_ObjectData);
- msg->addU32Fast( _PREHASH_LocalID, object->mLocalID);
- msg->addVector3Fast(_PREHASH_GrabOffset, grab_offset);
- msg->nextBlock("SurfaceInfo");
- msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
- msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
- msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
- msg->addVector3("Position", pick.mIntersection);
- msg->addVector3("Normal", pick.mNormal);
- msg->addVector3("Binormal", pick.mBinormal);
- msg->sendMessage( object->getRegion()->getHost());
-
- /* Diagnostic code
- LL_INFOS() << "mUVCoords: " << pick.mUVCoords
- << ", mSTCoords: " << pick.mSTCoords
- << ", mObjectFace: " << pick.mObjectFace
- << ", mIntersection: " << pick.mIntersection
- << ", mNormal: " << pick.mNormal
- << ", mBinormal: " << pick.mBinormal
- << LL_ENDL;
-
- LL_INFOS() << "Avatar pos: " << gAgent.getPositionAgent() << LL_ENDL;
- LL_INFOS() << "Object pos: " << object->getPosition() << LL_ENDL;
- */
+ if (!object) return;
+
+ LLMessageSystem *msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_ObjectGrab);
+ msg->nextBlockFast( _PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast( _PREHASH_ObjectData);
+ msg->addU32Fast( _PREHASH_LocalID, object->mLocalID);
+ msg->addVector3Fast(_PREHASH_GrabOffset, grab_offset);
+ msg->nextBlock("SurfaceInfo");
+ msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
+ msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
+ msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
+ msg->addVector3("Position", pick.mIntersection);
+ msg->addVector3("Normal", pick.mNormal);
+ msg->addVector3("Binormal", pick.mBinormal);
+ msg->sendMessage( object->getRegion()->getHost());
+
+ /* Diagnostic code
+ LL_INFOS() << "mUVCoords: " << pick.mUVCoords
+ << ", mSTCoords: " << pick.mSTCoords
+ << ", mObjectFace: " << pick.mObjectFace
+ << ", mIntersection: " << pick.mIntersection
+ << ", mNormal: " << pick.mNormal
+ << ", mBinormal: " << pick.mBinormal
+ << LL_ENDL;
+
+ LL_INFOS() << "Avatar pos: " << gAgent.getPositionAgent() << LL_ENDL;
+ LL_INFOS() << "Object pos: " << object->getPosition() << LL_ENDL;
+ */
}
void send_ObjectDeGrab_message(LLViewerObject* object, const LLPickInfo & pick)
{
- if (!object) return;
-
- LLMessageSystem *msg = gMessageSystem;
-
- msg->newMessageFast(_PREHASH_ObjectDeGrab);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU32Fast(_PREHASH_LocalID, object->mLocalID);
- msg->nextBlock("SurfaceInfo");
- msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
- msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
- msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
- msg->addVector3("Position", pick.mIntersection);
- msg->addVector3("Normal", pick.mNormal);
- msg->addVector3("Binormal", pick.mBinormal);
- msg->sendMessage(object->getRegion()->getHost());
+ if (!object) return;
+
+ LLMessageSystem *msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_ObjectDeGrab);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addU32Fast(_PREHASH_LocalID, object->mLocalID);
+ msg->nextBlock("SurfaceInfo");
+ msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
+ msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
+ msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
+ msg->addVector3("Position", pick.mIntersection);
+ msg->addVector3("Normal", pick.mNormal);
+ msg->addVector3("Binormal", pick.mBinormal);
+ msg->sendMessage(object->getRegion()->getHost());
}
diff --git a/indra/newview/lltoolgrab.h b/indra/newview/lltoolgrab.h
index ce0de0f946..65a1f3cbdb 100644
--- a/indra/newview/lltoolgrab.h
+++ b/indra/newview/lltoolgrab.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolgrab.h
* @brief LLToolGrab class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,101 +55,101 @@ const MASK DEFAULT_GRAB_MASK = MASK_CONTROL;
class LLToolGrabBase : public LLTool
{
public:
- LLToolGrabBase(LLToolComposite* composite=NULL);
- ~LLToolGrabBase();
-
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
- /*virtual*/ void render(); // 3D elements
- /*virtual*/ void draw(); // 2D elements
-
- virtual void handleSelect();
- virtual void handleDeselect();
-
- virtual LLViewerObject* getEditingObject();
- virtual LLVector3d getEditingPointGlobal();
- virtual BOOL isEditing();
- virtual void stopEditing();
-
- virtual void onMouseCaptureLost();
-
- BOOL hasGrabOffset() { return TRUE; } // HACK
- LLVector3 getGrabOffset(S32 x, S32 y); // HACK
-
- // Capture the mouse and start grabbing.
- BOOL handleObjectHit(const LLPickInfo& info);
-
- // Certain grabs should not highlight the "Build" toolbar button
- BOOL getHideBuildHighlight() { return mHideBuildHighlight; }
-
- void setClickedInMouselook(BOOL is_clickedInMouselook) {mClickedInMouselook = is_clickedInMouselook;}
-
- static void pickCallback(const LLPickInfo& pick_info);
+ LLToolGrabBase(LLToolComposite* composite=NULL);
+ ~LLToolGrabBase();
+
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+ /*virtual*/ void render(); // 3D elements
+ /*virtual*/ void draw(); // 2D elements
+
+ virtual void handleSelect();
+ virtual void handleDeselect();
+
+ virtual LLViewerObject* getEditingObject();
+ virtual LLVector3d getEditingPointGlobal();
+ virtual BOOL isEditing();
+ virtual void stopEditing();
+
+ virtual void onMouseCaptureLost();
+
+ BOOL hasGrabOffset() { return TRUE; } // HACK
+ LLVector3 getGrabOffset(S32 x, S32 y); // HACK
+
+ // Capture the mouse and start grabbing.
+ BOOL handleObjectHit(const LLPickInfo& info);
+
+ // Certain grabs should not highlight the "Build" toolbar button
+ BOOL getHideBuildHighlight() { return mHideBuildHighlight; }
+
+ void setClickedInMouselook(BOOL is_clickedInMouselook) {mClickedInMouselook = is_clickedInMouselook;}
+
+ static void pickCallback(const LLPickInfo& pick_info);
private:
- LLVector3d getGrabPointGlobal();
- void startGrab();
- void stopGrab();
+ LLVector3d getGrabPointGlobal();
+ void startGrab();
+ void stopGrab();
- void startSpin();
- void stopSpin();
+ void startSpin();
+ void stopSpin();
- void handleHoverSpin(S32 x, S32 y, MASK mask);
- void handleHoverActive(S32 x, S32 y, MASK mask);
- void handleHoverNonPhysical(S32 x, S32 y, MASK mask);
- void handleHoverInactive(S32 x, S32 y, MASK mask);
- void handleHoverFailed(S32 x, S32 y, MASK mask);
+ void handleHoverSpin(S32 x, S32 y, MASK mask);
+ void handleHoverActive(S32 x, S32 y, MASK mask);
+ void handleHoverNonPhysical(S32 x, S32 y, MASK mask);
+ void handleHoverInactive(S32 x, S32 y, MASK mask);
+ void handleHoverFailed(S32 x, S32 y, MASK mask);
private:
- enum EGrabMode { GRAB_INACTIVE, GRAB_ACTIVE_CENTER, GRAB_NONPHYSICAL, GRAB_LOCKED, GRAB_NOOBJECT };
+ enum EGrabMode { GRAB_INACTIVE, GRAB_ACTIVE_CENTER, GRAB_NONPHYSICAL, GRAB_LOCKED, GRAB_NOOBJECT };
- EGrabMode mMode;
+ EGrabMode mMode;
- BOOL mVerticalDragging;
+ BOOL mVerticalDragging;
- BOOL mHitLand;
+ BOOL mHitLand;
- LLTimer mGrabTimer; // send simulator time between hover movements
+ LLTimer mGrabTimer; // send simulator time between hover movements
- LLVector3 mGrabOffsetFromCenterInitial; // meters from CG of object
- LLVector3d mGrabHiddenOffsetFromCamera; // in cursor hidden drag, how far is grab offset from camera
+ LLVector3 mGrabOffsetFromCenterInitial; // meters from CG of object
+ LLVector3d mGrabHiddenOffsetFromCamera; // in cursor hidden drag, how far is grab offset from camera
- LLVector3d mDragStartPointGlobal; // projected into world
- LLVector3d mDragStartFromCamera; // drag start relative to camera
+ LLVector3d mDragStartPointGlobal; // projected into world
+ LLVector3d mDragStartFromCamera; // drag start relative to camera
- LLPickInfo mGrabPick;
+ LLPickInfo mGrabPick;
- S32 mLastMouseX;
- S32 mLastMouseY;
- S32 mAccumDeltaX; // since cursor hidden, how far have you moved?
- S32 mAccumDeltaY;
- BOOL mHasMoved; // has mouse moved off center at all?
- BOOL mOutsideSlop; // has mouse moved outside center 5 pixels?
- BOOL mDeselectedThisClick;
- BOOL mValidSelection;
+ S32 mLastMouseX;
+ S32 mLastMouseY;
+ S32 mAccumDeltaX; // since cursor hidden, how far have you moved?
+ S32 mAccumDeltaY;
+ BOOL mHasMoved; // has mouse moved off center at all?
+ BOOL mOutsideSlop; // has mouse moved outside center 5 pixels?
+ BOOL mDeselectedThisClick;
+ BOOL mValidSelection;
- S32 mLastFace;
- LLVector2 mLastUVCoords;
- LLVector2 mLastSTCoords;
- LLVector3 mLastIntersection;
- LLVector3 mLastNormal;
- LLVector3 mLastBinormal;
- LLVector3 mLastGrabPos;
+ S32 mLastFace;
+ LLVector2 mLastUVCoords;
+ LLVector2 mLastSTCoords;
+ LLVector3 mLastIntersection;
+ LLVector3 mLastNormal;
+ LLVector3 mLastBinormal;
+ LLVector3 mLastGrabPos;
- BOOL mSpinGrabbing;
- LLQuaternion mSpinRotation;
+ BOOL mSpinGrabbing;
+ LLQuaternion mSpinRotation;
- BOOL mHideBuildHighlight;
+ BOOL mHideBuildHighlight;
- BOOL mClickedInMouselook;
+ BOOL mClickedInMouselook;
};
/// This is the LLSingleton instance of LLToolGrab.
class LLToolGrab : public LLToolGrabBase, public LLSingleton<LLToolGrab>
{
- LLSINGLETON_EMPTY_CTOR(LLToolGrab);
+ LLSINGLETON_EMPTY_CTOR(LLToolGrab);
};
extern BOOL gGrabBtnVertical;
diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp
index 9539081f30..a79f287503 100644
--- a/indra/newview/lltoolgun.cpp
+++ b/indra/newview/lltoolgun.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolgun.cpp
* @brief LLToolGun class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,105 +44,105 @@
#include "lltoolgrab.h"
#include "lluiimage.h"
// Linden library includes
-#include "llwindow.h" // setMouseClipping()
+#include "llwindow.h" // setMouseClipping()
LLToolGun::LLToolGun( LLToolComposite* composite )
-: LLTool( std::string("gun"), composite ),
- mIsSelected(FALSE)
+: LLTool( std::string("gun"), composite ),
+ mIsSelected(FALSE)
{
}
void LLToolGun::handleSelect()
{
- gViewerWindow->hideCursor();
- gViewerWindow->moveCursorToCenter();
- gViewerWindow->getWindow()->setMouseClipping(TRUE);
- mIsSelected = TRUE;
+ gViewerWindow->hideCursor();
+ gViewerWindow->moveCursorToCenter();
+ gViewerWindow->getWindow()->setMouseClipping(TRUE);
+ mIsSelected = TRUE;
}
void LLToolGun::handleDeselect()
{
- gViewerWindow->moveCursorToCenter();
- gViewerWindow->showCursor();
- gViewerWindow->getWindow()->setMouseClipping(FALSE);
- mIsSelected = FALSE;
+ gViewerWindow->moveCursorToCenter();
+ gViewerWindow->showCursor();
+ gViewerWindow->getWindow()->setMouseClipping(FALSE);
+ mIsSelected = FALSE;
}
BOOL LLToolGun::handleMouseDown(S32 x, S32 y, MASK mask)
{
- gGrabTransientTool = this;
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
+ gGrabTransientTool = this;
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
- return LLToolGrab::getInstance()->handleMouseDown(x, y, mask);
+ return LLToolGrab::getInstance()->handleMouseDown(x, y, mask);
}
-BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask)
+BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask)
{
- if( gAgentCamera.cameraMouselook() && mIsSelected )
- {
- const F32 NOMINAL_MOUSE_SENSITIVITY = 0.0025f;
-
- F32 mouse_sensitivity = gSavedSettings.getF32("MouseSensitivity");
- mouse_sensitivity = clamp_rescale(mouse_sensitivity, 0.f, 15.f, 0.5f, 2.75f) * NOMINAL_MOUSE_SENSITIVITY;
-
- // ...move the view with the mouse
-
- // get mouse movement delta
- S32 dx = -gViewerWindow->getCurrentMouseDX();
- S32 dy = -gViewerWindow->getCurrentMouseDY();
-
- if (dx != 0 || dy != 0)
- {
- // ...actually moved off center
- if (gSavedSettings.getBOOL("InvertMouse"))
- {
- gAgent.pitch(mouse_sensitivity * -dy);
- }
- else
- {
- gAgent.pitch(mouse_sensitivity * dy);
- }
- LLVector3 skyward = gAgent.getReferenceUpVector();
- gAgent.rotate(mouse_sensitivity * dx, skyward.mV[VX], skyward.mV[VY], skyward.mV[VZ]);
-
- if (gSavedSettings.getBOOL("MouseSun"))
- {
+ if( gAgentCamera.cameraMouselook() && mIsSelected )
+ {
+ const F32 NOMINAL_MOUSE_SENSITIVITY = 0.0025f;
+
+ F32 mouse_sensitivity = gSavedSettings.getF32("MouseSensitivity");
+ mouse_sensitivity = clamp_rescale(mouse_sensitivity, 0.f, 15.f, 0.5f, 2.75f) * NOMINAL_MOUSE_SENSITIVITY;
+
+ // ...move the view with the mouse
+
+ // get mouse movement delta
+ S32 dx = -gViewerWindow->getCurrentMouseDX();
+ S32 dy = -gViewerWindow->getCurrentMouseDY();
+
+ if (dx != 0 || dy != 0)
+ {
+ // ...actually moved off center
+ if (gSavedSettings.getBOOL("InvertMouse"))
+ {
+ gAgent.pitch(mouse_sensitivity * -dy);
+ }
+ else
+ {
+ gAgent.pitch(mouse_sensitivity * dy);
+ }
+ LLVector3 skyward = gAgent.getReferenceUpVector();
+ gAgent.rotate(mouse_sensitivity * dx, skyward.mV[VX], skyward.mV[VY], skyward.mV[VZ]);
+
+ if (gSavedSettings.getBOOL("MouseSun"))
+ {
LLVector3 sunpos = LLViewerCamera::getInstance()->getAtAxis();
- gSky.setSunDirectionCFR(sunpos);
- gSavedSettings.setVector3("SkySunDefaultPosition", LLViewerCamera::getInstance()->getAtAxis());
- }
+ gSky.setSunDirectionCFR(sunpos);
+ gSavedSettings.setVector3("SkySunDefaultPosition", LLViewerCamera::getInstance()->getAtAxis());
+ }
if (gSavedSettings.getBOOL("MouseMoon"))
- {
+ {
LLVector3 moonpos = LLViewerCamera::getInstance()->getAtAxis();
- gSky.setMoonDirectionCFR(moonpos);
- gSavedSettings.setVector3("SkyMoonDefaultPosition", LLViewerCamera::getInstance()->getAtAxis());
- }
+ gSky.setMoonDirectionCFR(moonpos);
+ gSavedSettings.setVector3("SkyMoonDefaultPosition", LLViewerCamera::getInstance()->getAtAxis());
+ }
- gViewerWindow->moveCursorToCenter();
- gViewerWindow->hideCursor();
- }
+ gViewerWindow->moveCursorToCenter();
+ gViewerWindow->hideCursor();
+ }
- LL_DEBUGS("UserInput") << "hover handled by LLToolGun (mouselook)" << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("UserInput") << "hover handled by LLToolGun (not mouselook)" << LL_ENDL;
- }
+ LL_DEBUGS("UserInput") << "hover handled by LLToolGun (mouselook)" << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLToolGun (not mouselook)" << LL_ENDL;
+ }
- // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden.
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden.
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
- return TRUE;
+ return TRUE;
}
void LLToolGun::draw()
{
- if( gSavedSettings.getBOOL("ShowCrosshairs") )
- {
- LLUIImagePtr crosshair = LLUI::getUIImage("crosshairs.tga");
- crosshair->draw(
- ( gViewerWindow->getWorldViewRectScaled().getWidth() - crosshair->getWidth() ) / 2,
- ( gViewerWindow->getWorldViewRectScaled().getHeight() - crosshair->getHeight() ) / 2);
- }
+ if( gSavedSettings.getBOOL("ShowCrosshairs") )
+ {
+ LLUIImagePtr crosshair = LLUI::getUIImage("crosshairs.tga");
+ crosshair->draw(
+ ( gViewerWindow->getWorldViewRectScaled().getWidth() - crosshair->getWidth() ) / 2,
+ ( gViewerWindow->getWorldViewRectScaled().getHeight() - crosshair->getHeight() ) / 2);
+ }
}
diff --git a/indra/newview/lltoolgun.h b/indra/newview/lltoolgun.h
index 8ae926b741..0220d5f327 100644
--- a/indra/newview/lltoolgun.h
+++ b/indra/newview/lltoolgun.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolgun.h
* @brief LLToolGun class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,20 +34,20 @@
class LLToolGun : public LLTool
{
public:
- LLToolGun( LLToolComposite* composite=NULL );
+ LLToolGun( LLToolComposite* composite=NULL );
- virtual void draw();
+ virtual void draw();
- virtual void handleSelect();
- virtual void handleDeselect();
+ virtual void handleSelect();
+ virtual void handleDeselect();
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual LLTool* getOverrideTool(MASK mask) { return NULL; }
- virtual BOOL clipMouseWhenDown() { return FALSE; }
+ virtual LLTool* getOverrideTool(MASK mask) { return NULL; }
+ virtual BOOL clipMouseWhenDown() { return FALSE; }
private:
- BOOL mIsSelected;
+ BOOL mIsSelected;
};
#endif
diff --git a/indra/newview/lltoolindividual.cpp b/indra/newview/lltoolindividual.cpp
index 885c1442a0..50b4cb0c93 100644
--- a/indra/newview/lltoolindividual.cpp
+++ b/indra/newview/lltoolindividual.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolindividual.cpp
* @brief LLToolIndividual class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -68,46 +68,46 @@ LLToolIndividual::~LLToolIndividual()
BOOL LLToolIndividual::handleMouseDown(S32 x, S32 y, MASK mask)
{
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
- return TRUE;
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ return TRUE;
}
void LLToolIndividual::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* obj = pick_info.getObject();
- LLSelectMgr::getInstance()->deselectAll();
- if(obj)
- {
- LLSelectMgr::getInstance()->selectObjectOnly(obj);
- }
+ LLViewerObject* obj = pick_info.getObject();
+ LLSelectMgr::getInstance()->deselectAll();
+ if(obj)
+ {
+ LLSelectMgr::getInstance()->selectObjectOnly(obj);
+ }
}
BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- if(!LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- // You should already have an object selected from the mousedown.
- // If so, show its inventory.
- LLFloaterReg::showInstance("build", "Content");
- return TRUE;
- }
- else
- {
- // Nothing selected means the first mouse click was probably
- // bad, so try again.
- return FALSE;
- }
+ if(!LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ // You should already have an object selected from the mousedown.
+ // If so, show its inventory.
+ LLFloaterReg::showInstance("build", "Content");
+ return TRUE;
+ }
+ else
+ {
+ // Nothing selected means the first mouse click was probably
+ // bad, so try again.
+ return FALSE;
+ }
}
void LLToolIndividual::handleSelect()
{
- const BOOL children_ok = TRUE;
- LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok);
- LLSelectMgr::getInstance()->deselectAll();
- if(obj)
- {
- LLSelectMgr::getInstance()->selectObjectOnly(obj);
- }
+ const BOOL children_ok = TRUE;
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok);
+ LLSelectMgr::getInstance()->deselectAll();
+ if(obj)
+ {
+ LLSelectMgr::getInstance()->selectObjectOnly(obj);
+ }
}
///----------------------------------------------------------------------------
diff --git a/indra/newview/lltoolindividual.h b/indra/newview/lltoolindividual.h
index 89dd9d9796..8373606e32 100644
--- a/indra/newview/lltoolindividual.h
+++ b/indra/newview/lltoolindividual.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolindividual.h
* @brief LLToolIndividual class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,15 +39,15 @@ class LLPickInfo;
class LLToolIndividual : public LLTool, public LLSingleton<LLToolIndividual>
{
- LLSINGLETON(LLToolIndividual);
- virtual ~LLToolIndividual();
+ LLSINGLETON(LLToolIndividual);
+ virtual ~LLToolIndividual();
public:
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- virtual void handleSelect() override;
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ virtual void handleSelect() override;
- static void pickCallback(const LLPickInfo& pick_info);
+ static void pickCallback(const LLPickInfo& pick_info);
protected:
diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp
index fa2dd60ee0..b1f895317a 100644
--- a/indra/newview/lltoolmgr.cpp
+++ b/indra/newview/lltoolmgr.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolmgr.cpp
* @brief LLToolMgr class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -60,373 +60,373 @@
// Used when app not active to avoid processing hover.
-LLTool* gToolNull = NULL;
+LLTool* gToolNull = NULL;
-LLToolset* gBasicToolset = NULL;
-LLToolset* gCameraToolset = NULL;
-//LLToolset* gLandToolset = NULL;
-LLToolset* gMouselookToolset = NULL;
-LLToolset* gFaceEditToolset = NULL;
+LLToolset* gBasicToolset = NULL;
+LLToolset* gCameraToolset = NULL;
+//LLToolset* gLandToolset = NULL;
+LLToolset* gMouselookToolset = NULL;
+LLToolset* gFaceEditToolset = NULL;
/////////////////////////////////////////////////////
// LLToolMgr
LLToolMgr::LLToolMgr()
- :
- mBaseTool(NULL),
- mSavedTool(NULL),
- mTransientTool( NULL ),
- mOverrideTool( NULL ),
- mSelectedTool( NULL ),
- mCurrentToolset( NULL )
+ :
+ mBaseTool(NULL),
+ mSavedTool(NULL),
+ mTransientTool( NULL ),
+ mOverrideTool( NULL ),
+ mSelectedTool( NULL ),
+ mCurrentToolset( NULL )
{
- // Not a panel, register these callbacks globally.
- LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this));
- LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this));
- LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.EnabledOrActive", boost::bind(&LLToolMgr::buildEnabledOrActive, this));
- LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this, _2));
- LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Marketplace.Enabled", boost::bind(&LLToolMgr::canAccessMarketplace, this));
- LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Marketplace.Toggle", boost::bind(&LLToolMgr::toggleMarketplace, this, _2));
-
- gToolNull = new LLTool(LLStringUtil::null); // Does nothing
- setCurrentTool(gToolNull);
-
- gBasicToolset = new LLToolset();
- gCameraToolset = new LLToolset();
-// gLandToolset = new LLToolset();
- gMouselookToolset = new LLToolset();
- gFaceEditToolset = new LLToolset();
- gMouselookToolset->setShowFloaterTools(false);
- gFaceEditToolset->setShowFloaterTools(false);
+ // Not a panel, register these callbacks globally.
+ LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this));
+ LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this));
+ LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.EnabledOrActive", boost::bind(&LLToolMgr::buildEnabledOrActive, this));
+ LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this, _2));
+ LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Marketplace.Enabled", boost::bind(&LLToolMgr::canAccessMarketplace, this));
+ LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Marketplace.Toggle", boost::bind(&LLToolMgr::toggleMarketplace, this, _2));
+
+ gToolNull = new LLTool(LLStringUtil::null); // Does nothing
+ setCurrentTool(gToolNull);
+
+ gBasicToolset = new LLToolset();
+ gCameraToolset = new LLToolset();
+// gLandToolset = new LLToolset();
+ gMouselookToolset = new LLToolset();
+ gFaceEditToolset = new LLToolset();
+ gMouselookToolset->setShowFloaterTools(false);
+ gFaceEditToolset->setShowFloaterTools(false);
}
void LLToolMgr::initTools()
{
- static BOOL initialized = FALSE;
- if(initialized)
- {
- return;
- }
- initialized = TRUE;
- gBasicToolset->addTool( LLToolPie::getInstance() );
- gBasicToolset->addTool( LLToolCamera::getInstance() );
- gCameraToolset->addTool( LLToolCamera::getInstance() );
- gBasicToolset->addTool( LLToolGrab::getInstance() );
- gBasicToolset->addTool( LLToolCompTranslate::getInstance() );
- gBasicToolset->addTool( LLToolCompCreate::getInstance() );
- gBasicToolset->addTool( LLToolBrushLand::getInstance() );
- gMouselookToolset->addTool( LLToolCompGun::getInstance() );
- gBasicToolset->addTool( LLToolCompInspect::getInstance() );
- gFaceEditToolset->addTool( LLToolCamera::getInstance() );
-
- // On startup, use "select" tool
- setCurrentToolset(gBasicToolset);
-
- gBasicToolset->selectTool( LLToolPie::getInstance() );
+ static BOOL initialized = FALSE;
+ if(initialized)
+ {
+ return;
+ }
+ initialized = TRUE;
+ gBasicToolset->addTool( LLToolPie::getInstance() );
+ gBasicToolset->addTool( LLToolCamera::getInstance() );
+ gCameraToolset->addTool( LLToolCamera::getInstance() );
+ gBasicToolset->addTool( LLToolGrab::getInstance() );
+ gBasicToolset->addTool( LLToolCompTranslate::getInstance() );
+ gBasicToolset->addTool( LLToolCompCreate::getInstance() );
+ gBasicToolset->addTool( LLToolBrushLand::getInstance() );
+ gMouselookToolset->addTool( LLToolCompGun::getInstance() );
+ gBasicToolset->addTool( LLToolCompInspect::getInstance() );
+ gFaceEditToolset->addTool( LLToolCamera::getInstance() );
+
+ // On startup, use "select" tool
+ setCurrentToolset(gBasicToolset);
+
+ gBasicToolset->selectTool( LLToolPie::getInstance() );
}
LLToolMgr::~LLToolMgr()
{
- delete gBasicToolset;
- gBasicToolset = NULL;
+ delete gBasicToolset;
+ gBasicToolset = NULL;
- delete gMouselookToolset;
- gMouselookToolset = NULL;
+ delete gMouselookToolset;
+ gMouselookToolset = NULL;
- delete gFaceEditToolset;
- gFaceEditToolset = NULL;
+ delete gFaceEditToolset;
+ gFaceEditToolset = NULL;
- delete gCameraToolset;
- gCameraToolset = NULL;
-
- delete gToolNull;
- gToolNull = NULL;
+ delete gCameraToolset;
+ gCameraToolset = NULL;
+
+ delete gToolNull;
+ gToolNull = NULL;
}
BOOL LLToolMgr::usingTransientTool()
{
- return mTransientTool ? TRUE : FALSE;
+ return mTransientTool ? TRUE : FALSE;
}
void LLToolMgr::setCurrentToolset(LLToolset* current)
{
- if (!current) return;
-
- // switching toolsets?
- if (current != mCurrentToolset)
- {
- // deselect current tool
- if (mSelectedTool)
- {
- mSelectedTool->handleDeselect();
- }
- mCurrentToolset = current;
- // select first tool of new toolset only if toolset changed
- mCurrentToolset->selectFirstTool();
- }
- // update current tool based on new toolset
- setCurrentTool( mCurrentToolset->getSelectedTool() );
+ if (!current) return;
+
+ // switching toolsets?
+ if (current != mCurrentToolset)
+ {
+ // deselect current tool
+ if (mSelectedTool)
+ {
+ mSelectedTool->handleDeselect();
+ }
+ mCurrentToolset = current;
+ // select first tool of new toolset only if toolset changed
+ mCurrentToolset->selectFirstTool();
+ }
+ // update current tool based on new toolset
+ setCurrentTool( mCurrentToolset->getSelectedTool() );
}
LLToolset* LLToolMgr::getCurrentToolset()
{
- return mCurrentToolset;
+ return mCurrentToolset;
}
void LLToolMgr::setCurrentTool( LLTool* tool )
{
- if (mTransientTool)
- {
- mTransientTool = NULL;
- }
+ if (mTransientTool)
+ {
+ mTransientTool = NULL;
+ }
- mBaseTool = tool;
- updateToolStatus();
+ mBaseTool = tool;
+ updateToolStatus();
- mSavedTool = NULL;
+ mSavedTool = NULL;
}
LLTool* LLToolMgr::getCurrentTool()
{
- MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0;
-
- LLTool* cur_tool = NULL;
- // always use transient tools if available
- if (mTransientTool)
- {
- mOverrideTool = NULL;
- cur_tool = mTransientTool;
- }
- // tools currently grabbing mouse input will stay active
- else if (mSelectedTool && mSelectedTool->hasMouseCapture())
- {
- cur_tool = mSelectedTool;
- }
- else
- {
- mOverrideTool = mBaseTool ? mBaseTool->getOverrideTool(override_mask) : NULL;
-
- // use override tool if available otherwise drop back to base tool
- cur_tool = mOverrideTool ? mOverrideTool : mBaseTool;
- }
-
- LLTool* prev_tool = mSelectedTool;
- // Set the selected tool to avoid infinite recursion
- mSelectedTool = cur_tool;
-
- //update tool selection status
- if (prev_tool != cur_tool)
- {
- if (prev_tool)
- {
- prev_tool->handleDeselect();
- }
- if (cur_tool)
- {
- if ( LLToolCompInspect::getInstance()->isToolCameraActive()
- && prev_tool == LLToolCamera::getInstance()
- && cur_tool == LLToolPie::getInstance() )
- {
- LLFloaterInspect * inspect_instance = LLFloaterReg::getTypedInstance<LLFloaterInspect>("inspect");
- if(inspect_instance && inspect_instance->getVisible())
- {
- setTransientTool(LLToolCompInspect::getInstance());
- }
- }
- else
- {
- cur_tool->handleSelect();
- }
- }
- }
-
- return mSelectedTool;
+ MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0;
+
+ LLTool* cur_tool = NULL;
+ // always use transient tools if available
+ if (mTransientTool)
+ {
+ mOverrideTool = NULL;
+ cur_tool = mTransientTool;
+ }
+ // tools currently grabbing mouse input will stay active
+ else if (mSelectedTool && mSelectedTool->hasMouseCapture())
+ {
+ cur_tool = mSelectedTool;
+ }
+ else
+ {
+ mOverrideTool = mBaseTool ? mBaseTool->getOverrideTool(override_mask) : NULL;
+
+ // use override tool if available otherwise drop back to base tool
+ cur_tool = mOverrideTool ? mOverrideTool : mBaseTool;
+ }
+
+ LLTool* prev_tool = mSelectedTool;
+ // Set the selected tool to avoid infinite recursion
+ mSelectedTool = cur_tool;
+
+ //update tool selection status
+ if (prev_tool != cur_tool)
+ {
+ if (prev_tool)
+ {
+ prev_tool->handleDeselect();
+ }
+ if (cur_tool)
+ {
+ if ( LLToolCompInspect::getInstance()->isToolCameraActive()
+ && prev_tool == LLToolCamera::getInstance()
+ && cur_tool == LLToolPie::getInstance() )
+ {
+ LLFloaterInspect * inspect_instance = LLFloaterReg::getTypedInstance<LLFloaterInspect>("inspect");
+ if(inspect_instance && inspect_instance->getVisible())
+ {
+ setTransientTool(LLToolCompInspect::getInstance());
+ }
+ }
+ else
+ {
+ cur_tool->handleSelect();
+ }
+ }
+ }
+
+ return mSelectedTool;
}
LLTool* LLToolMgr::getBaseTool()
{
- return mBaseTool;
+ return mBaseTool;
}
void LLToolMgr::updateToolStatus()
{
- // call getcurrenttool() to calculate active tool and call handleSelect() and handleDeselect() immediately
- // when active tool changes
- getCurrentTool();
+ // call getcurrenttool() to calculate active tool and call handleSelect() and handleDeselect() immediately
+ // when active tool changes
+ getCurrentTool();
}
bool LLToolMgr::inEdit()
{
- return mBaseTool != LLToolPie::getInstance() && mBaseTool != gToolNull;
+ return mBaseTool != LLToolPie::getInstance() && mBaseTool != gToolNull;
}
bool LLToolMgr::canEdit()
{
- return LLViewerParcelMgr::getInstance()->allowAgentBuild();
+ return LLViewerParcelMgr::getInstance()->allowAgentBuild();
}
bool LLToolMgr::buildEnabledOrActive()
{
- return LLFloaterReg::instanceVisible("build") || canEdit();
+ return LLFloaterReg::instanceVisible("build") || canEdit();
}
void LLToolMgr::toggleBuildMode(const LLSD& sdname)
{
- const std::string& param = sdname.asString();
-
- LLFloaterReg::toggleInstanceOrBringToFront("build");
- if (param == "build" && !canEdit())
- {
- return;
- }
-
- bool build_visible = LLFloaterReg::instanceVisible("build");
- if (build_visible)
- {
- ECameraMode camMode = gAgentCamera.getCameraMode();
- if (CAMERA_MODE_MOUSELOOK == camMode || CAMERA_MODE_CUSTOMIZE_AVATAR == camMode)
- {
- // pull the user out of mouselook or appearance mode when entering build mode
- handle_reset_view();
- }
-
- if (gSavedSettings.getBOOL("EditCameraMovement"))
- {
- // camera should be set
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- handle_toggle_flycam();
- }
-
- if (gAgentCamera.getFocusOnAvatar())
- {
- // zoom in if we're looking at the avatar
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
- gAgentCamera.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis()));
- gAgentCamera.cameraZoomIn(0.666f);
- gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD );
- }
- }
-
-
- setCurrentToolset(gBasicToolset);
- getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
-
- // Could be first use
- //LLFirstUse::useBuild();
-
- gAgentCamera.resetView(false);
-
- // avoid spurious avatar movements
- LLViewerJoystick::getInstance()->setNeedsReset();
-
- }
- else
- {
- if (gSavedSettings.getBOOL("EditCameraMovement"))
- {
- // just reset the view, will pull us out of edit mode
- handle_reset_view();
- }
- else
- {
- // manually disable edit mode, but do not affect the camera
- gAgentCamera.resetView(false);
- LLFloaterReg::hideInstance("build");
- gViewerWindow->showCursor();
- }
- // avoid spurious avatar movements pulling out of edit mode
- LLViewerJoystick::getInstance()->setNeedsReset();
- }
+ const std::string& param = sdname.asString();
+
+ LLFloaterReg::toggleInstanceOrBringToFront("build");
+ if (param == "build" && !canEdit())
+ {
+ return;
+ }
+
+ bool build_visible = LLFloaterReg::instanceVisible("build");
+ if (build_visible)
+ {
+ ECameraMode camMode = gAgentCamera.getCameraMode();
+ if (CAMERA_MODE_MOUSELOOK == camMode || CAMERA_MODE_CUSTOMIZE_AVATAR == camMode)
+ {
+ // pull the user out of mouselook or appearance mode when entering build mode
+ handle_reset_view();
+ }
+
+ if (gSavedSettings.getBOOL("EditCameraMovement"))
+ {
+ // camera should be set
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ handle_toggle_flycam();
+ }
+
+ if (gAgentCamera.getFocusOnAvatar())
+ {
+ // zoom in if we're looking at the avatar
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+ gAgentCamera.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis()));
+ gAgentCamera.cameraZoomIn(0.666f);
+ gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD );
+ }
+ }
+
+
+ setCurrentToolset(gBasicToolset);
+ getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
+
+ // Could be first use
+ //LLFirstUse::useBuild();
+
+ gAgentCamera.resetView(false);
+
+ // avoid spurious avatar movements
+ LLViewerJoystick::getInstance()->setNeedsReset();
+
+ }
+ else
+ {
+ if (gSavedSettings.getBOOL("EditCameraMovement"))
+ {
+ // just reset the view, will pull us out of edit mode
+ handle_reset_view();
+ }
+ else
+ {
+ // manually disable edit mode, but do not affect the camera
+ gAgentCamera.resetView(false);
+ LLFloaterReg::hideInstance("build");
+ gViewerWindow->showCursor();
+ }
+ // avoid spurious avatar movements pulling out of edit mode
+ LLViewerJoystick::getInstance()->setNeedsReset();
+ }
}
bool LLToolMgr::inBuildMode()
{
- // when entering mouselook inEdit() immediately returns true before
- // cameraMouselook() actually starts returning true. Also, appearance edit
- // sets build mode to true, so let's exclude that.
- bool b=(inEdit()
- && !gAgentCamera.cameraMouselook()
- && mCurrentToolset != gFaceEditToolset);
-
- return b;
+ // when entering mouselook inEdit() immediately returns true before
+ // cameraMouselook() actually starts returning true. Also, appearance edit
+ // sets build mode to true, so let's exclude that.
+ bool b=(inEdit()
+ && !gAgentCamera.cameraMouselook()
+ && mCurrentToolset != gFaceEditToolset);
+
+ return b;
}
bool LLToolMgr::canAccessMarketplace()
{
- return (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_PLACE_NOT_MIGRATED_MERCHANT);
+ return (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_PLACE_NOT_MIGRATED_MERCHANT);
}
void LLToolMgr::toggleMarketplace(const LLSD& sdname)
{
- const std::string& param = sdname.asString();
-
- if ((param != "marketplace") || !canAccessMarketplace())
- {
- return;
- }
-
- LLFloaterReg::toggleInstanceOrBringToFront("marketplace_listings");
+ const std::string& param = sdname.asString();
+
+ if ((param != "marketplace") || !canAccessMarketplace())
+ {
+ return;
+ }
+
+ LLFloaterReg::toggleInstanceOrBringToFront("marketplace_listings");
}
void LLToolMgr::setTransientTool(LLTool* tool)
{
- if (!tool)
- {
- clearTransientTool();
- }
- else
- {
- if (mTransientTool)
- {
- mTransientTool = NULL;
- }
-
- mTransientTool = tool;
- }
-
- updateToolStatus();
+ if (!tool)
+ {
+ clearTransientTool();
+ }
+ else
+ {
+ if (mTransientTool)
+ {
+ mTransientTool = NULL;
+ }
+
+ mTransientTool = tool;
+ }
+
+ updateToolStatus();
}
void LLToolMgr::clearTransientTool()
{
- if (mTransientTool)
- {
- mTransientTool = NULL;
- if (!mBaseTool)
- {
- LL_WARNS() << "mBaseTool is NULL" << LL_ENDL;
- }
- }
- updateToolStatus();
+ if (mTransientTool)
+ {
+ mTransientTool = NULL;
+ if (!mBaseTool)
+ {
+ LL_WARNS() << "mBaseTool is NULL" << LL_ENDL;
+ }
+ }
+ updateToolStatus();
}
void LLToolMgr::onAppFocusLost()
{
- if (LLApp::isExiting())
- return;
-
- if (mSelectedTool)
- {
- mSelectedTool->handleDeselect();
- }
- updateToolStatus();
+ if (LLApp::isExiting())
+ return;
+
+ if (mSelectedTool)
+ {
+ mSelectedTool->handleDeselect();
+ }
+ updateToolStatus();
}
void LLToolMgr::onAppFocusGained()
{
- if (mSelectedTool)
- {
- mSelectedTool->handleSelect();
- }
- updateToolStatus();
+ if (mSelectedTool)
+ {
+ mSelectedTool->handleSelect();
+ }
+ updateToolStatus();
}
void LLToolMgr::clearSavedTool()
{
- mSavedTool = NULL;
+ mSavedTool = NULL;
}
/////////////////////////////////////////////////////
@@ -434,93 +434,93 @@ void LLToolMgr::clearSavedTool()
void LLToolset::addTool(LLTool* tool)
{
- mToolList.push_back( tool );
- if( !mSelectedTool )
- {
- mSelectedTool = tool;
- }
+ mToolList.push_back( tool );
+ if( !mSelectedTool )
+ {
+ mSelectedTool = tool;
+ }
}
void LLToolset::selectTool(LLTool* tool)
{
- mSelectedTool = tool;
- LLToolMgr::getInstance()->setCurrentTool( mSelectedTool );
+ mSelectedTool = tool;
+ LLToolMgr::getInstance()->setCurrentTool( mSelectedTool );
}
void LLToolset::selectToolByIndex( S32 index )
{
- LLTool *tool = (index >= 0 && index < (S32)mToolList.size()) ? mToolList[index] : NULL;
- if (tool)
- {
- mSelectedTool = tool;
- LLToolMgr::getInstance()->setCurrentTool( tool );
- }
+ LLTool *tool = (index >= 0 && index < (S32)mToolList.size()) ? mToolList[index] : NULL;
+ if (tool)
+ {
+ mSelectedTool = tool;
+ LLToolMgr::getInstance()->setCurrentTool( tool );
+ }
}
BOOL LLToolset::isToolSelected( S32 index )
{
- LLTool *tool = (index >= 0 && index < (S32)mToolList.size()) ? mToolList[index] : NULL;
- return (tool == mSelectedTool);
+ LLTool *tool = (index >= 0 && index < (S32)mToolList.size()) ? mToolList[index] : NULL;
+ return (tool == mSelectedTool);
}
void LLToolset::selectFirstTool()
{
- mSelectedTool = (0 < mToolList.size()) ? mToolList[0] : NULL;
- LLToolMgr::getInstance()->setCurrentTool( mSelectedTool );
+ mSelectedTool = (0 < mToolList.size()) ? mToolList[0] : NULL;
+ LLToolMgr::getInstance()->setCurrentTool( mSelectedTool );
}
void LLToolset::selectNextTool()
{
- LLTool* next = NULL;
- for( tool_list_t::iterator iter = mToolList.begin();
- iter != mToolList.end(); )
- {
- LLTool* cur = *iter++;
- if( cur == mSelectedTool && iter != mToolList.end() )
- {
- next = *iter;
- break;
- }
- }
-
- if( next )
- {
- mSelectedTool = next;
- LLToolMgr::getInstance()->setCurrentTool( mSelectedTool );
- }
- else
- {
- selectFirstTool();
- }
+ LLTool* next = NULL;
+ for( tool_list_t::iterator iter = mToolList.begin();
+ iter != mToolList.end(); )
+ {
+ LLTool* cur = *iter++;
+ if( cur == mSelectedTool && iter != mToolList.end() )
+ {
+ next = *iter;
+ break;
+ }
+ }
+
+ if( next )
+ {
+ mSelectedTool = next;
+ LLToolMgr::getInstance()->setCurrentTool( mSelectedTool );
+ }
+ else
+ {
+ selectFirstTool();
+ }
}
void LLToolset::selectPrevTool()
{
- LLTool* prev = NULL;
- for( tool_list_t::reverse_iterator iter = mToolList.rbegin();
- iter != mToolList.rend(); )
- {
- LLTool* cur = *iter++;
- if( cur == mSelectedTool && iter != mToolList.rend() )
- {
- prev = *iter;
- break;
- }
- }
-
- if( prev )
- {
- mSelectedTool = prev;
- LLToolMgr::getInstance()->setCurrentTool( mSelectedTool );
- }
- else if (mToolList.size() > 0)
- {
- selectToolByIndex((S32)mToolList.size()-1);
- }
+ LLTool* prev = NULL;
+ for( tool_list_t::reverse_iterator iter = mToolList.rbegin();
+ iter != mToolList.rend(); )
+ {
+ LLTool* cur = *iter++;
+ if( cur == mSelectedTool && iter != mToolList.rend() )
+ {
+ prev = *iter;
+ break;
+ }
+ }
+
+ if( prev )
+ {
+ mSelectedTool = prev;
+ LLToolMgr::getInstance()->setCurrentTool( mSelectedTool );
+ }
+ else if (mToolList.size() > 0)
+ {
+ selectToolByIndex((S32)mToolList.size()-1);
+ }
}
////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h
index 28465d5d2c..fd7d063740 100644
--- a/indra/newview/lltoolmgr.h
+++ b/indra/newview/lltoolmgr.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolmgr.h
* @brief LLToolMgr class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,89 +33,89 @@ class LLTool;
class LLToolset;
// Key bindings for common operations
-const MASK MASK_VERTICAL = MASK_CONTROL;
-const MASK MASK_SPIN = MASK_CONTROL | MASK_SHIFT;
-const MASK MASK_ZOOM = MASK_NONE;
-const MASK MASK_ORBIT = MASK_CONTROL;
-const MASK MASK_PAN = MASK_CONTROL | MASK_SHIFT;
-const MASK MASK_COPY = MASK_SHIFT;
+const MASK MASK_VERTICAL = MASK_CONTROL;
+const MASK MASK_SPIN = MASK_CONTROL | MASK_SHIFT;
+const MASK MASK_ZOOM = MASK_NONE;
+const MASK MASK_ORBIT = MASK_CONTROL;
+const MASK MASK_PAN = MASK_CONTROL | MASK_SHIFT;
+const MASK MASK_COPY = MASK_SHIFT;
class LLToolMgr : public LLSingleton<LLToolMgr>
{
- LLSINGLETON(LLToolMgr);
- ~LLToolMgr();
+ LLSINGLETON(LLToolMgr);
+ ~LLToolMgr();
public:
- // Must be called after gSavedSettings set up.
- void initTools();
+ // Must be called after gSavedSettings set up.
+ void initTools();
- LLTool* getCurrentTool(); // returns active tool, taking into account keyboard state
- LLTool* getBaseTool(); // returns active tool when overrides are deactivated
+ LLTool* getCurrentTool(); // returns active tool, taking into account keyboard state
+ LLTool* getBaseTool(); // returns active tool when overrides are deactivated
- bool inEdit();
- bool canEdit();
- bool buildEnabledOrActive();
+ bool inEdit();
+ bool canEdit();
+ bool buildEnabledOrActive();
bool canAccessMarketplace();
- void toggleBuildMode(const LLSD& sdname);
- void toggleMarketplace(const LLSD& sdname);
-
- /* Determines if we are in Build mode or not. */
- bool inBuildMode();
+ void toggleBuildMode(const LLSD& sdname);
+ void toggleMarketplace(const LLSD& sdname);
+
+ /* Determines if we are in Build mode or not. */
+ bool inBuildMode();
- void setTransientTool(LLTool* tool);
- void clearTransientTool();
- BOOL usingTransientTool();
+ void setTransientTool(LLTool* tool);
+ void clearTransientTool();
+ BOOL usingTransientTool();
- void setCurrentToolset(LLToolset* current);
- LLToolset* getCurrentToolset();
+ void setCurrentToolset(LLToolset* current);
+ LLToolset* getCurrentToolset();
- void onAppFocusGained();
- void onAppFocusLost();
+ void onAppFocusGained();
+ void onAppFocusLost();
- void clearSavedTool();
+ void clearSavedTool();
protected:
- friend class LLToolset; // to allow access to setCurrentTool();
- void setCurrentTool(LLTool* tool);
- void updateToolStatus();
+ friend class LLToolset; // to allow access to setCurrentTool();
+ void setCurrentTool(LLTool* tool);
+ void updateToolStatus();
protected:
- LLTool* mBaseTool;
- LLTool* mSavedTool; // The current tool at the time application focus was lost.
- LLTool* mTransientTool;
- LLTool* mOverrideTool; // Tool triggered by keyboard override
- LLTool* mSelectedTool; // last known active tool
- LLToolset* mCurrentToolset;
+ LLTool* mBaseTool;
+ LLTool* mSavedTool; // The current tool at the time application focus was lost.
+ LLTool* mTransientTool;
+ LLTool* mOverrideTool; // Tool triggered by keyboard override
+ LLTool* mSelectedTool; // last known active tool
+ LLToolset* mCurrentToolset;
};
// Sets of tools for various modes
class LLToolset
{
public:
- LLToolset() : mSelectedTool(NULL), mIsShowFloaterTools(true) {}
+ LLToolset() : mSelectedTool(NULL), mIsShowFloaterTools(true) {}
- LLTool* getSelectedTool() { return mSelectedTool; }
+ LLTool* getSelectedTool() { return mSelectedTool; }
- void addTool(LLTool* tool);
+ void addTool(LLTool* tool);
- void selectTool( LLTool* tool );
- void selectToolByIndex( S32 index );
- void selectFirstTool();
- void selectNextTool();
- void selectPrevTool();
+ void selectTool( LLTool* tool );
+ void selectToolByIndex( S32 index );
+ void selectFirstTool();
+ void selectNextTool();
+ void selectPrevTool();
- void handleScrollWheel(S32 clicks);
+ void handleScrollWheel(S32 clicks);
- BOOL isToolSelected( S32 index );
+ BOOL isToolSelected( S32 index );
- void setShowFloaterTools(bool pShowFloaterTools) {mIsShowFloaterTools = pShowFloaterTools;};
- bool isShowFloaterTools() const {return mIsShowFloaterTools;};
+ void setShowFloaterTools(bool pShowFloaterTools) {mIsShowFloaterTools = pShowFloaterTools;};
+ bool isShowFloaterTools() const {return mIsShowFloaterTools;};
protected:
- LLTool* mSelectedTool;
- typedef std::vector<LLTool*> tool_list_t;
- tool_list_t mToolList;
- bool mIsShowFloaterTools;
+ LLTool* mSelectedTool;
+ typedef std::vector<LLTool*> tool_list_t;
+ tool_list_t mToolList;
+ bool mIsShowFloaterTools;
};
// Globals
@@ -126,6 +126,6 @@ extern LLToolset *gCameraToolset;
extern LLToolset* gMouselookToolset;
extern LLToolset* gFaceEditToolset;
-extern LLTool* gToolNull;
+extern LLTool* gToolNull;
#endif
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index d99c0ba2a6..e1b8796535 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolmorph.cpp
* @brief A tool to manipulate faces..
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
#include "llviewerprecompiledheaders.h"
// File includes
-#include "lltoolmorph.h"
+#include "lltoolmorph.h"
#include "llrender.h"
// Library includes
@@ -70,32 +70,32 @@ BOOL LLVisualParamReset::sDirty = FALSE;
// static
LLVisualParamHint::LLVisualParamHint(
- S32 pos_x, S32 pos_y,
- S32 width, S32 height,
- LLViewerJointMesh *mesh,
- LLViewerVisualParam *param,
- LLWearable *wearable,
- F32 param_weight,
- LLJoint* jointp)
- :
- LLViewerDynamicTexture(width, height, 3, LLViewerDynamicTexture::ORDER_MIDDLE, TRUE ),
- mNeedsUpdate( TRUE ),
- mIsVisible( FALSE ),
- mJointMesh( mesh ),
- mVisualParam( param ),
- mWearablePtr( wearable ),
- mVisualParamWeight( param_weight ),
- mAllowsUpdates( TRUE ),
- mDelayFrames( 0 ),
- mRect( pos_x, pos_y + height, pos_x + width, pos_y ),
- mLastParamWeight(0.f),
- mCamTargetJoint(jointp)
+ S32 pos_x, S32 pos_y,
+ S32 width, S32 height,
+ LLViewerJointMesh *mesh,
+ LLViewerVisualParam *param,
+ LLWearable *wearable,
+ F32 param_weight,
+ LLJoint* jointp)
+ :
+ LLViewerDynamicTexture(width, height, 3, LLViewerDynamicTexture::ORDER_MIDDLE, TRUE ),
+ mNeedsUpdate( TRUE ),
+ mIsVisible( FALSE ),
+ mJointMesh( mesh ),
+ mVisualParam( param ),
+ mWearablePtr( wearable ),
+ mVisualParamWeight( param_weight ),
+ mAllowsUpdates( TRUE ),
+ mDelayFrames( 0 ),
+ mRect( pos_x, pos_y + height, pos_x + width, pos_y ),
+ mLastParamWeight(0.f),
+ mCamTargetJoint(jointp)
{
- LLVisualParamHint::sInstances.insert( this );
- mBackgroundp = LLUI::getUIImage("avatar_thumb_bkgrnd.png");
+ LLVisualParamHint::sInstances.insert( this );
+ mBackgroundp = LLUI::getUIImage("avatar_thumb_bkgrnd.png");
- llassert(width != 0);
- llassert(height != 0);
+ llassert(width != 0);
+ llassert(height != 0);
}
//-----------------------------------------------------------------------------
@@ -103,13 +103,13 @@ LLVisualParamHint::LLVisualParamHint(
//-----------------------------------------------------------------------------
LLVisualParamHint::~LLVisualParamHint()
{
- LLVisualParamHint::sInstances.erase( this );
+ LLVisualParamHint::sInstances.erase( this );
}
//virtual
S8 LLVisualParamHint::getType() const
{
- return LLViewerDynamicTexture::LL_VISUAL_PARAM_HINT ;
+ return LLViewerDynamicTexture::LL_VISUAL_PARAM_HINT ;
}
//-----------------------------------------------------------------------------
@@ -119,61 +119,61 @@ S8 LLVisualParamHint::getType() const
//-----------------------------------------------------------------------------
void LLVisualParamHint::requestHintUpdates( LLVisualParamHint* exception1, LLVisualParamHint* exception2 )
{
- S32 delay_frames = 0;
- for (instance_list_t::iterator iter = sInstances.begin();
- iter != sInstances.end(); ++iter)
- {
- LLVisualParamHint* instance = *iter;
- if( (instance != exception1) && (instance != exception2) )
- {
- if( instance->mAllowsUpdates )
- {
- instance->mNeedsUpdate = TRUE;
- instance->mDelayFrames = delay_frames;
- delay_frames++;
- }
- else
- {
- instance->mNeedsUpdate = TRUE;
- instance->mDelayFrames = 0;
- }
- }
- }
+ S32 delay_frames = 0;
+ for (instance_list_t::iterator iter = sInstances.begin();
+ iter != sInstances.end(); ++iter)
+ {
+ LLVisualParamHint* instance = *iter;
+ if( (instance != exception1) && (instance != exception2) )
+ {
+ if( instance->mAllowsUpdates )
+ {
+ instance->mNeedsUpdate = TRUE;
+ instance->mDelayFrames = delay_frames;
+ delay_frames++;
+ }
+ else
+ {
+ instance->mNeedsUpdate = TRUE;
+ instance->mDelayFrames = 0;
+ }
+ }
+ }
}
BOOL LLVisualParamHint::needsRender()
{
- return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatarp->getIsAppearanceAnimating() && mAllowsUpdates;
+ return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatarp->getIsAppearanceAnimating() && mAllowsUpdates;
}
void LLVisualParamHint::preRender(BOOL clear_depth)
{
- LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr;
- if (wearable)
- {
- wearable->setVolatile(TRUE);
- }
- mLastParamWeight = mVisualParam->getWeight();
- mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight);
- gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight);
- gAgentAvatarp->setVisualParamWeight("Blink_Left", 0.f);
- gAgentAvatarp->setVisualParamWeight("Blink_Right", 0.f);
- gAgentAvatarp->updateComposites();
- // Calling LLCharacter version, as we don't want position/height changes to cause the avatar to jump
- // up and down when we're doing preview renders. -Nyx
- gAgentAvatarp->LLCharacter::updateVisualParams();
-
- if (gAgentAvatarp->mDrawable.notNull())
- {
- gAgentAvatarp->updateGeometry(gAgentAvatarp->mDrawable);
- gAgentAvatarp->updateLOD();
- }
- else
- {
- LL_WARNS() << "Attempting to update avatar's geometry, but drawable doesn't exist yet" << LL_ENDL;
- }
-
- LLViewerDynamicTexture::preRender(clear_depth);
+ LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr;
+ if (wearable)
+ {
+ wearable->setVolatile(TRUE);
+ }
+ mLastParamWeight = mVisualParam->getWeight();
+ mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight);
+ gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight);
+ gAgentAvatarp->setVisualParamWeight("Blink_Left", 0.f);
+ gAgentAvatarp->setVisualParamWeight("Blink_Right", 0.f);
+ gAgentAvatarp->updateComposites();
+ // Calling LLCharacter version, as we don't want position/height changes to cause the avatar to jump
+ // up and down when we're doing preview renders. -Nyx
+ gAgentAvatarp->LLCharacter::updateVisualParams();
+
+ if (gAgentAvatarp->mDrawable.notNull())
+ {
+ gAgentAvatarp->updateGeometry(gAgentAvatarp->mDrawable);
+ gAgentAvatarp->updateLOD();
+ }
+ else
+ {
+ LL_WARNS() << "Attempting to update avatar's geometry, but drawable doesn't exist yet" << LL_ENDL;
+ }
+
+ LLViewerDynamicTexture::preRender(clear_depth);
}
//-----------------------------------------------------------------------------
@@ -181,63 +181,63 @@ void LLVisualParamHint::preRender(BOOL clear_depth)
//-----------------------------------------------------------------------------
BOOL LLVisualParamHint::render()
{
- LLVisualParamReset::sDirty = TRUE;
+ LLVisualParamReset::sDirty = TRUE;
- gGL.pushUIMatrix();
- gGL.loadUIIdentity();
+ gGL.pushUIMatrix();
+ gGL.loadUIIdentity();
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadIdentity();
- gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
- gUIProgram.bind();
+ gUIProgram.bind();
- LLGLSUIDefault gls_ui;
- //LLGLState::verify(TRUE);
- mBackgroundp->draw(0, 0, mFullWidth, mFullHeight);
+ LLGLSUIDefault gls_ui;
+ //LLGLState::verify(TRUE);
+ mBackgroundp->draw(0, 0, mFullWidth, mFullHeight);
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
- mNeedsUpdate = FALSE;
- mIsVisible = TRUE;
+ mNeedsUpdate = FALSE;
+ mIsVisible = TRUE;
- LLQuaternion avatar_rotation;
- LLJoint* root_joint = gAgentAvatarp->getRootJoint();
- if( root_joint )
- {
- avatar_rotation = root_joint->getWorldRotation();
- }
+ LLQuaternion avatar_rotation;
+ LLJoint* root_joint = gAgentAvatarp->getRootJoint();
+ if( root_joint )
+ {
+ avatar_rotation = root_joint->getWorldRotation();
+ }
+
+ LLVector3 target_joint_pos = mCamTargetJoint->getWorldPosition();
- LLVector3 target_joint_pos = mCamTargetJoint->getWorldPosition();
+ LLVector3 target_offset( 0, 0, mVisualParam->getCameraElevation() );
+ LLVector3 target_pos = target_joint_pos + (target_offset * avatar_rotation);
- LLVector3 target_offset( 0, 0, mVisualParam->getCameraElevation() );
- LLVector3 target_pos = target_joint_pos + (target_offset * avatar_rotation);
+ F32 cam_angle_radians = mVisualParam->getCameraAngle() * DEG_TO_RAD;
+ LLVector3 camera_snapshot_offset(
+ mVisualParam->getCameraDistance() * cosf( cam_angle_radians ),
+ mVisualParam->getCameraDistance() * sinf( cam_angle_radians ),
+ mVisualParam->getCameraElevation() );
+ LLVector3 camera_pos = target_joint_pos + (camera_snapshot_offset * avatar_rotation);
- F32 cam_angle_radians = mVisualParam->getCameraAngle() * DEG_TO_RAD;
- LLVector3 camera_snapshot_offset(
- mVisualParam->getCameraDistance() * cosf( cam_angle_radians ),
- mVisualParam->getCameraDistance() * sinf( cam_angle_radians ),
- mVisualParam->getCameraElevation() );
- LLVector3 camera_pos = target_joint_pos + (camera_snapshot_offset * avatar_rotation);
-
- gGL.flush();
-
- LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / (F32)mFullHeight);
- LLViewerCamera::getInstance()->setOriginAndLookAt(
- camera_pos, // camera
- LLVector3::z_axis, // up
- target_pos ); // point of interest
+ gGL.flush();
- LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
+ LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / (F32)mFullHeight);
+ LLViewerCamera::getInstance()->setOriginAndLookAt(
+ camera_pos, // camera
+ LLVector3::z_axis, // up
+ target_pos ); // point of interest
+
+ LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
if (gAgentAvatarp->mDrawable.notNull())
{
@@ -249,20 +249,20 @@ BOOL LLVisualParamHint::render()
gGL.flush();
}
- gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
- mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
- LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr;
- if (wearable)
- {
- wearable->setVolatile(FALSE);
- }
+ gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
+ mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
+ LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr;
+ if (wearable)
+ {
+ wearable->setVolatile(FALSE);
+ }
- gAgentAvatarp->updateVisualParams();
- gGL.color4f(1,1,1,1);
- mGLTexturep->setGLTextureCreated(true);
- gGL.popUIMatrix();
+ gAgentAvatarp->updateVisualParams();
+ gGL.color4f(1,1,1,1);
+ mGLTexturep->setGLTextureCreated(true);
+ gGL.popUIMatrix();
- return TRUE;
+ return TRUE;
}
@@ -271,40 +271,40 @@ BOOL LLVisualParamHint::render()
//-----------------------------------------------------------------------------
void LLVisualParamHint::draw(F32 alpha)
{
- if (!mIsVisible) return;
-
- gGL.getTexUnit(0)->bind(this);
-
- gGL.color4f(1.f, 1.f, 1.f, alpha);
-
- LLGLSUIDefault gls_ui;
- gGL.begin(LLRender::QUADS);
- {
- gGL.texCoord2i(0, 1);
- gGL.vertex2i(0, mFullHeight);
- gGL.texCoord2i(0, 0);
- gGL.vertex2i(0, 0);
- gGL.texCoord2i(1, 0);
- gGL.vertex2i(mFullWidth, 0);
- gGL.texCoord2i(1, 1);
- gGL.vertex2i(mFullWidth, mFullHeight);
- }
- gGL.end();
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ if (!mIsVisible) return;
+
+ gGL.getTexUnit(0)->bind(this);
+
+ gGL.color4f(1.f, 1.f, 1.f, alpha);
+
+ LLGLSUIDefault gls_ui;
+ gGL.begin(LLRender::QUADS);
+ {
+ gGL.texCoord2i(0, 1);
+ gGL.vertex2i(0, mFullHeight);
+ gGL.texCoord2i(0, 0);
+ gGL.vertex2i(0, 0);
+ gGL.texCoord2i(1, 0);
+ gGL.vertex2i(mFullWidth, 0);
+ gGL.texCoord2i(1, 1);
+ gGL.vertex2i(mFullWidth, mFullHeight);
+ }
+ gGL.end();
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
//-----------------------------------------------------------------------------
// LLVisualParamReset()
//-----------------------------------------------------------------------------
LLVisualParamReset::LLVisualParamReset() : LLViewerDynamicTexture(1, 1, 1, ORDER_RESET, FALSE)
-{
+{
}
//virtual
S8 LLVisualParamReset::getType() const
{
- return LLViewerDynamicTexture::LL_VISUAL_PARAM_RESET ;
+ return LLViewerDynamicTexture::LL_VISUAL_PARAM_RESET ;
}
//-----------------------------------------------------------------------------
@@ -312,13 +312,13 @@ S8 LLVisualParamReset::getType() const
//-----------------------------------------------------------------------------
BOOL LLVisualParamReset::render()
{
- if (sDirty)
- {
- gAgentAvatarp->updateComposites();
- gAgentAvatarp->updateVisualParams();
- gAgentAvatarp->updateGeometry(gAgentAvatarp->mDrawable);
- sDirty = FALSE;
- }
-
- return FALSE;
+ if (sDirty)
+ {
+ gAgentAvatarp->updateComposites();
+ gAgentAvatarp->updateVisualParams();
+ gAgentAvatarp->updateGeometry(gAgentAvatarp->mDrawable);
+ sDirty = FALSE;
+ }
+
+ return FALSE;
}
diff --git a/indra/newview/lltoolmorph.h b/indra/newview/lltoolmorph.h
index a6889be151..5bfb4e694f 100644
--- a/indra/newview/lltoolmorph.h
+++ b/indra/newview/lltoolmorph.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolmorph.h
* @brief A tool to select object faces.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,68 +49,68 @@ class LLJoint;
class LLVisualParamHint : public LLViewerDynamicTexture
{
protected:
- virtual ~LLVisualParamHint();
+ virtual ~LLVisualParamHint();
public:
- LLVisualParamHint(
- S32 pos_x, S32 pos_y,
- S32 width, S32 height,
- LLViewerJointMesh *mesh,
- LLViewerVisualParam *param,
- LLWearable *wearable,
- F32 param_weight,
- LLJoint* jointp);
-
- /*virtual*/ S8 getType() const ;
-
- BOOL needsRender();
- void preRender(BOOL clear_depth);
- BOOL render();
- void requestUpdate( S32 delay_frames ) {mNeedsUpdate = TRUE; mDelayFrames = delay_frames; }
- void setUpdateDelayFrames( S32 delay_frames ) { mDelayFrames = delay_frames; }
- void draw(F32 alpha);
-
- LLViewerVisualParam* getVisualParam() { return mVisualParam; }
- F32 getVisualParamWeight() { return mVisualParamWeight; }
- BOOL getVisible() { return mIsVisible; }
-
- void setAllowsUpdates( BOOL b ) { mAllowsUpdates = b; }
-
- const LLRect& getRect() { return mRect; }
-
- // Requests updates for all instances (excluding two possible exceptions) Grungy but efficient.
- static void requestHintUpdates( LLVisualParamHint* exception1 = NULL, LLVisualParamHint* exception2 = NULL );
+ LLVisualParamHint(
+ S32 pos_x, S32 pos_y,
+ S32 width, S32 height,
+ LLViewerJointMesh *mesh,
+ LLViewerVisualParam *param,
+ LLWearable *wearable,
+ F32 param_weight,
+ LLJoint* jointp);
+
+ /*virtual*/ S8 getType() const ;
+
+ BOOL needsRender();
+ void preRender(BOOL clear_depth);
+ BOOL render();
+ void requestUpdate( S32 delay_frames ) {mNeedsUpdate = TRUE; mDelayFrames = delay_frames; }
+ void setUpdateDelayFrames( S32 delay_frames ) { mDelayFrames = delay_frames; }
+ void draw(F32 alpha);
+
+ LLViewerVisualParam* getVisualParam() { return mVisualParam; }
+ F32 getVisualParamWeight() { return mVisualParamWeight; }
+ BOOL getVisible() { return mIsVisible; }
+
+ void setAllowsUpdates( BOOL b ) { mAllowsUpdates = b; }
+
+ const LLRect& getRect() { return mRect; }
+
+ // Requests updates for all instances (excluding two possible exceptions) Grungy but efficient.
+ static void requestHintUpdates( LLVisualParamHint* exception1 = NULL, LLVisualParamHint* exception2 = NULL );
protected:
- BOOL mNeedsUpdate; // does this texture need to be re-rendered?
- BOOL mIsVisible; // is this distortion hint visible?
- LLViewerJointMesh* mJointMesh; // mesh that this distortion applies to
- LLViewerVisualParam* mVisualParam; // visual param applied by this hint
- LLWearable* mWearablePtr; // wearable we're editing
- F32 mVisualParamWeight; // weight for this visual parameter
- BOOL mAllowsUpdates; // updates are blocked unless this is true
- S32 mDelayFrames; // updates are blocked for this many frames
- LLRect mRect;
- F32 mLastParamWeight;
- LLJoint* mCamTargetJoint; // joint to target with preview camera
-
- LLUIImagePtr mBackgroundp;
-
- typedef std::set< LLVisualParamHint* > instance_list_t;
- static instance_list_t sInstances;
+ BOOL mNeedsUpdate; // does this texture need to be re-rendered?
+ BOOL mIsVisible; // is this distortion hint visible?
+ LLViewerJointMesh* mJointMesh; // mesh that this distortion applies to
+ LLViewerVisualParam* mVisualParam; // visual param applied by this hint
+ LLWearable* mWearablePtr; // wearable we're editing
+ F32 mVisualParamWeight; // weight for this visual parameter
+ BOOL mAllowsUpdates; // updates are blocked unless this is true
+ S32 mDelayFrames; // updates are blocked for this many frames
+ LLRect mRect;
+ F32 mLastParamWeight;
+ LLJoint* mCamTargetJoint; // joint to target with preview camera
+
+ LLUIImagePtr mBackgroundp;
+
+ typedef std::set< LLVisualParamHint* > instance_list_t;
+ static instance_list_t sInstances;
};
// this class resets avatar data at the end of an update cycle
class LLVisualParamReset : public LLViewerDynamicTexture
{
protected:
- /*virtual */ ~LLVisualParamReset(){}
+ /*virtual */ ~LLVisualParamReset(){}
public:
- LLVisualParamReset();
- /*virtual */ BOOL render();
- /*virtual*/ S8 getType() const ;
+ LLVisualParamReset();
+ /*virtual */ BOOL render();
+ /*virtual*/ S8 getType() const ;
- static BOOL sDirty;
+ static BOOL sDirty;
};
#endif
diff --git a/indra/newview/lltoolobjpicker.cpp b/indra/newview/lltoolobjpicker.cpp
index 0d9fe9e577..b91ab03ab9 100644
--- a/indra/newview/lltoolobjpicker.cpp
+++ b/indra/newview/lltoolobjpicker.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolobjpicker.cpp
* @brief LLToolObjPicker class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,128 +46,128 @@
LLToolObjPicker::LLToolObjPicker()
-: LLTool( std::string("ObjPicker"), NULL ),
- mPicked( FALSE ),
- mHitObjectID( LLUUID::null ),
- mExitCallback( NULL ),
- mExitCallbackData( NULL )
+: LLTool( std::string("ObjPicker"), NULL ),
+ mPicked( FALSE ),
+ mHitObjectID( LLUUID::null ),
+ mExitCallback( NULL ),
+ mExitCallbackData( NULL )
{ }
-// returns TRUE if an object was selected
+// returns TRUE if an object was selected
BOOL LLToolObjPicker::handleMouseDown(S32 x, S32 y, MASK mask)
{
- LLRootView* viewp = gViewerWindow->getRootView();
- BOOL handled = viewp->handleMouseDown(x, y, mask);
-
- mHitObjectID.setNull();
-
- if (! handled)
- {
- // didn't click in any UI object, so must have clicked in the world
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
- handled = TRUE;
- }
- else
- {
- if (hasMouseCapture())
- {
- setMouseCapture(FALSE);
- }
- else
- {
- LL_WARNS() << "PickerTool doesn't have mouse capture on mouseDown" << LL_ENDL;
- }
- }
-
- // Pass mousedown to base class
- LLTool::handleMouseDown(x, y, mask);
-
- return handled;
+ LLRootView* viewp = gViewerWindow->getRootView();
+ BOOL handled = viewp->handleMouseDown(x, y, mask);
+
+ mHitObjectID.setNull();
+
+ if (! handled)
+ {
+ // didn't click in any UI object, so must have clicked in the world
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ handled = TRUE;
+ }
+ else
+ {
+ if (hasMouseCapture())
+ {
+ setMouseCapture(FALSE);
+ }
+ else
+ {
+ LL_WARNS() << "PickerTool doesn't have mouse capture on mouseDown" << LL_ENDL;
+ }
+ }
+
+ // Pass mousedown to base class
+ LLTool::handleMouseDown(x, y, mask);
+
+ return handled;
}
void LLToolObjPicker::pickCallback(const LLPickInfo& pick_info)
{
- LLToolObjPicker::getInstance()->mHitObjectID = pick_info.mObjectID;
- LLToolObjPicker::getInstance()->mPicked = pick_info.mObjectID.notNull();
+ LLToolObjPicker::getInstance()->mHitObjectID = pick_info.mObjectID;
+ LLToolObjPicker::getInstance()->mPicked = pick_info.mObjectID.notNull();
}
BOOL LLToolObjPicker::handleMouseUp(S32 x, S32 y, MASK mask)
{
- LLView* viewp = gViewerWindow->getRootView();
- BOOL handled = viewp->handleHover(x, y, mask);
- if (handled)
- {
- // let UI handle this
- }
-
- LLTool::handleMouseUp(x, y, mask);
- if (hasMouseCapture())
- {
- setMouseCapture(FALSE);
- }
- else
- {
- LL_WARNS() << "PickerTool doesn't have mouse capture on mouseUp" << LL_ENDL;
- }
- return handled;
+ LLView* viewp = gViewerWindow->getRootView();
+ BOOL handled = viewp->handleHover(x, y, mask);
+ if (handled)
+ {
+ // let UI handle this
+ }
+
+ LLTool::handleMouseUp(x, y, mask);
+ if (hasMouseCapture())
+ {
+ setMouseCapture(FALSE);
+ }
+ else
+ {
+ LL_WARNS() << "PickerTool doesn't have mouse capture on mouseUp" << LL_ENDL;
+ }
+ return handled;
}
BOOL LLToolObjPicker::handleHover(S32 x, S32 y, MASK mask)
{
- LLView *viewp = gViewerWindow->getRootView();
- BOOL handled = viewp->handleHover(x, y, mask);
- if (!handled)
- {
- // Used to do pick on hover. Now we just always display the cursor.
- ECursorType cursor = UI_CURSOR_ARROWLOCKED;
-
- cursor = UI_CURSOR_TOOLPICKOBJECT3;
-
- gViewerWindow->setCursor(cursor);
- }
- return handled;
+ LLView *viewp = gViewerWindow->getRootView();
+ BOOL handled = viewp->handleHover(x, y, mask);
+ if (!handled)
+ {
+ // Used to do pick on hover. Now we just always display the cursor.
+ ECursorType cursor = UI_CURSOR_ARROWLOCKED;
+
+ cursor = UI_CURSOR_TOOLPICKOBJECT3;
+
+ gViewerWindow->setCursor(cursor);
+ }
+ return handled;
}
void LLToolObjPicker::onMouseCaptureLost()
{
- if (mExitCallback)
- {
- mExitCallback(mExitCallbackData);
+ if (mExitCallback)
+ {
+ mExitCallback(mExitCallbackData);
- mExitCallback = NULL;
- mExitCallbackData = NULL;
- }
+ mExitCallback = NULL;
+ mExitCallbackData = NULL;
+ }
- mPicked = FALSE;
- mHitObjectID.setNull();
+ mPicked = FALSE;
+ mHitObjectID.setNull();
}
// virtual
void LLToolObjPicker::setExitCallback(void (*callback)(void *), void *callback_data)
{
- mExitCallback = callback;
- mExitCallbackData = callback_data;
+ mExitCallback = callback;
+ mExitCallbackData = callback_data;
}
// virtual
void LLToolObjPicker::handleSelect()
{
- LLTool::handleSelect();
- setMouseCapture(TRUE);
+ LLTool::handleSelect();
+ setMouseCapture(TRUE);
}
// virtual
void LLToolObjPicker::handleDeselect()
{
- if (hasMouseCapture())
- {
- LLTool::handleDeselect();
- setMouseCapture(FALSE);
- }
+ if (hasMouseCapture())
+ {
+ LLTool::handleDeselect();
+ setMouseCapture(FALSE);
+ }
}
diff --git a/indra/newview/lltoolobjpicker.h b/indra/newview/lltoolobjpicker.h
index a55cd223de..ceeb45c74e 100644
--- a/indra/newview/lltoolobjpicker.h
+++ b/indra/newview/lltoolobjpicker.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolobjpicker.h
* @brief LLToolObjPicker class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,30 +35,30 @@ class LLPickInfo;
class LLToolObjPicker : public LLTool, public LLSingleton<LLToolObjPicker>
{
- LLSINGLETON(LLToolObjPicker);
+ LLSINGLETON(LLToolObjPicker);
public:
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
- virtual void handleSelect() override;
- virtual void handleDeselect() override;
+ virtual void handleSelect() override;
+ virtual void handleDeselect() override;
- virtual void onMouseCaptureLost() override;
+ virtual void onMouseCaptureLost() override;
- void setExitCallback(void (*callback)(void *), void *callback_data);
+ void setExitCallback(void (*callback)(void *), void *callback_data);
- LLUUID getObjectID() const { return mHitObjectID; }
+ LLUUID getObjectID() const { return mHitObjectID; }
- static void pickCallback(const LLPickInfo& pick_info);
+ static void pickCallback(const LLPickInfo& pick_info);
protected:
- BOOL mPicked;
- LLUUID mHitObjectID;
- void (*mExitCallback)(void *callback_data);
- void *mExitCallbackData;
+ BOOL mPicked;
+ LLUUID mHitObjectID;
+ void (*mExitCallback)(void *callback_data);
+ void *mExitCallbackData;
};
-#endif
+#endif
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 83a707472e..def9b5e778 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolpie.cpp
* @brief LLToolPie class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -70,7 +70,7 @@
#include "llworld.h"
#include "llui.h"
#include "llweb.h"
-#include "pipeline.h" // setHighlightObject
+#include "pipeline.h" // setHighlightObject
#include "lluiusage.h"
extern BOOL gDebugClicks;
@@ -80,26 +80,26 @@ static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp);
static ECursorType cursor_from_parcel_media(U8 click_action);
LLToolPie::LLToolPie()
-: LLTool(std::string("Pie")),
- mMouseButtonDown( false ),
- mMouseOutsideSlop( false ),
- mMouseSteerX(-1),
- mMouseSteerY(-1),
- mClickAction(0),
- mClickActionBuyEnabled( gSavedSettings.getBOOL("ClickActionBuyEnabled") ),
- mClickActionPayEnabled( gSavedSettings.getBOOL("ClickActionPayEnabled") ),
- mDoubleClickTimer()
+: LLTool(std::string("Pie")),
+ mMouseButtonDown( false ),
+ mMouseOutsideSlop( false ),
+ mMouseSteerX(-1),
+ mMouseSteerY(-1),
+ mClickAction(0),
+ mClickActionBuyEnabled( gSavedSettings.getBOOL("ClickActionBuyEnabled") ),
+ mClickActionPayEnabled( gSavedSettings.getBOOL("ClickActionPayEnabled") ),
+ mDoubleClickTimer()
{
}
BOOL LLToolPie::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down)
{
- BOOL result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down);
-
- // This override DISABLES the keyboard focus reset that LLTool::handleAnyMouseClick adds.
- // LLToolPie will do the right thing in its pick callback.
-
- return result;
+ BOOL result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down);
+
+ // This override DISABLES the keyboard focus reset that LLTool::handleAnyMouseClick adds.
+ // LLToolPie will do the right thing in its pick callback.
+
+ return result;
}
BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -110,71 +110,71 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
}
mMouseOutsideSlop = FALSE;
- mMouseDownX = x;
- mMouseDownY = y;
- LLTimer pick_timer;
- BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick");
- LLPickInfo transparent_pick = gViewerWindow->pickImmediate(x, y, TRUE /*includes transparent*/, pick_rigged, FALSE, TRUE, FALSE);
- LLPickInfo visible_pick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged);
- LLViewerObject *transp_object = transparent_pick.getObject();
- LLViewerObject *visible_object = visible_pick.getObject();
-
- // Current set of priorities
- // 1. Transparent attachment pick
- // 2. Transparent actionable pick
- // 3. Visible attachment pick (e.x we click on attachment under invisible floor)
- // 4. Visible actionable pick
- // 5. Transparent pick (e.x. movement on transparent object/floor, our default pick)
- // left mouse down always picks transparent (but see handleMouseUp).
- // Also see LLToolPie::handleHover() - priorities are a bit different there.
- // Todo: we need a more consistent set of rules to work with
- if (transp_object == visible_object || !visible_object ||
+ mMouseDownX = x;
+ mMouseDownY = y;
+ LLTimer pick_timer;
+ BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick");
+ LLPickInfo transparent_pick = gViewerWindow->pickImmediate(x, y, TRUE /*includes transparent*/, pick_rigged, FALSE, TRUE, FALSE);
+ LLPickInfo visible_pick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged);
+ LLViewerObject *transp_object = transparent_pick.getObject();
+ LLViewerObject *visible_object = visible_pick.getObject();
+
+ // Current set of priorities
+ // 1. Transparent attachment pick
+ // 2. Transparent actionable pick
+ // 3. Visible attachment pick (e.x we click on attachment under invisible floor)
+ // 4. Visible actionable pick
+ // 5. Transparent pick (e.x. movement on transparent object/floor, our default pick)
+ // left mouse down always picks transparent (but see handleMouseUp).
+ // Also see LLToolPie::handleHover() - priorities are a bit different there.
+ // Todo: we need a more consistent set of rules to work with
+ if (transp_object == visible_object || !visible_object ||
!transp_object) // avoid potential for null dereference below, don't make assumptions about behavior of pickImmediate
- {
- mPick = transparent_pick;
- }
- else
- {
- // Select between two non-null picks
- LLViewerObject *transp_parent = transp_object->getRootEdit();
- LLViewerObject *visible_parent = visible_object->getRootEdit();
- if (transp_object->isAttachment())
- {
- // 1. Transparent attachment
- mPick = transparent_pick;
- }
- else if (transp_object->getClickAction() != CLICK_ACTION_DISABLED
- && (useClickAction(mask, transp_object, transp_parent) || transp_object->flagHandleTouch() || (transp_parent && transp_parent->flagHandleTouch())))
- {
- // 2. Transparent actionable pick
- mPick = transparent_pick;
- }
- else if (visible_object->isAttachment())
- {
- // 3. Visible attachment pick
- mPick = visible_pick;
- }
- else if (visible_object->getClickAction() != CLICK_ACTION_DISABLED
- && (useClickAction(mask, visible_object, visible_parent) || visible_object->flagHandleTouch() || (visible_parent && visible_parent->flagHandleTouch())))
- {
- // 4. Visible actionable pick
- mPick = visible_pick;
- }
- else
- {
- // 5. Default: transparent
- mPick = transparent_pick;
- }
- }
- LL_INFOS() << "pick_rigged is " << (S32) pick_rigged << " pick time elapsed " << pick_timer.getElapsedTimeF32() << LL_ENDL;
-
- mPick.mKeyMask = mask;
-
- mMouseButtonDown = true;
-
- // If nothing clickable is picked, needs to return
- // false for click-to-walk or click-to-teleport to work.
- return handleLeftClickPick();
+ {
+ mPick = transparent_pick;
+ }
+ else
+ {
+ // Select between two non-null picks
+ LLViewerObject *transp_parent = transp_object->getRootEdit();
+ LLViewerObject *visible_parent = visible_object->getRootEdit();
+ if (transp_object->isAttachment())
+ {
+ // 1. Transparent attachment
+ mPick = transparent_pick;
+ }
+ else if (transp_object->getClickAction() != CLICK_ACTION_DISABLED
+ && (useClickAction(mask, transp_object, transp_parent) || transp_object->flagHandleTouch() || (transp_parent && transp_parent->flagHandleTouch())))
+ {
+ // 2. Transparent actionable pick
+ mPick = transparent_pick;
+ }
+ else if (visible_object->isAttachment())
+ {
+ // 3. Visible attachment pick
+ mPick = visible_pick;
+ }
+ else if (visible_object->getClickAction() != CLICK_ACTION_DISABLED
+ && (useClickAction(mask, visible_object, visible_parent) || visible_object->flagHandleTouch() || (visible_parent && visible_parent->flagHandleTouch())))
+ {
+ // 4. Visible actionable pick
+ mPick = visible_pick;
+ }
+ else
+ {
+ // 5. Default: transparent
+ mPick = transparent_pick;
+ }
+ }
+ LL_INFOS() << "pick_rigged is " << (S32) pick_rigged << " pick time elapsed " << pick_timer.getElapsedTimeF32() << LL_ENDL;
+
+ mPick.mKeyMask = mask;
+
+ mMouseButtonDown = true;
+
+ // If nothing clickable is picked, needs to return
+ // false for click-to-walk or click-to-teleport to work.
+ return handleLeftClickPick();
}
// Spawn context menus on right mouse down so you can drag over and select
@@ -183,27 +183,27 @@ BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
BOOL pick_reflection_probe = gSavedSettings.getBOOL("SelectReflectionProbes");
- // don't pick transparent so users can't "pay" transparent objects
- mPick = gViewerWindow->pickImmediate(x, y,
+ // don't pick transparent so users can't "pay" transparent objects
+ mPick = gViewerWindow->pickImmediate(x, y,
/*BOOL pick_transparent*/ FALSE,
/*BOOL pick_rigged*/ TRUE,
/*BOOL pick_particle*/ TRUE,
- /*BOOL pick_unselectable*/ TRUE,
+ /*BOOL pick_unselectable*/ TRUE,
pick_reflection_probe);
- mPick.mKeyMask = mask;
-
- // claim not handled so UI focus stays same
- if(gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
- {
- handleRightClickPick();
- }
- return FALSE;
+ mPick.mKeyMask = mask;
+
+ // claim not handled so UI focus stays same
+ if(gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
+ {
+ handleRightClickPick();
+ }
+ return FALSE;
}
BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask)
{
- LLToolMgr::getInstance()->clearTransientTool();
- return LLTool::handleRightMouseUp(x, y, mask);
+ LLToolMgr::getInstance()->clearTransientTool();
+ return LLTool::handleRightMouseUp(x, y, mask);
}
BOOL LLToolPie::handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y)
@@ -236,250 +236,250 @@ BOOL LLToolPie::handleScrollHWheel(S32 x, S32 y, S32 clicks)
// True if you selected an object.
BOOL LLToolPie::handleLeftClickPick()
{
- S32 x = mPick.mMousePt.mX;
- S32 y = mPick.mMousePt.mY;
- MASK mask = mPick.mKeyMask;
- if (mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL)
- {
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel();
- if (parcel)
- {
- LLViewerParcelMgr::getInstance()->selectCollisionParcel();
- if (parcel->getParcelFlag(PF_USE_PASS_LIST)
- && !LLViewerParcelMgr::getInstance()->isCollisionBanned())
- {
- // if selling passes, just buy one
- void* deselect_when_done = (void*)TRUE;
- LLPanelLandGeneral::onClickBuyPass(deselect_when_done);
- }
- else
- {
- // not selling passes, get info
- LLFloaterReg::showInstance("about_land");
- }
- }
-
- gFocusMgr.setKeyboardFocus(NULL);
- return LLTool::handleMouseDown(x, y, mask);
- }
-
- // didn't click in any UI object, so must have clicked in the world
- LLViewerObject *object = mPick.getObject();
- LLViewerObject *parent = NULL;
-
- if (mPick.mPickType != LLPickInfo::PICK_LAND)
- {
- LLViewerParcelMgr::getInstance()->deselectLand();
- }
-
- if (object)
- {
- parent = object->getRootEdit();
- }
-
- if (handleMediaClick(mPick))
- {
- return TRUE;
- }
-
- // If it's a left-click, and we have a special action, do it.
- if (useClickAction(mask, object, parent))
- {
- mClickAction = 0;
- if (object && object->getClickAction())
- {
- mClickAction = object->getClickAction();
- }
- else if (parent && parent->getClickAction())
- {
- mClickAction = parent->getClickAction();
- }
-
- switch(mClickAction)
- {
- case CLICK_ACTION_TOUCH:
- // touch behavior down below...
- break;
- case CLICK_ACTION_SIT:
- {
- if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // agent not already sitting
- {
- handle_object_sit_or_stand();
- // put focus in world when sitting on an object
- gFocusMgr.setKeyboardFocus(NULL);
- return TRUE;
- } // else nothing (fall through to touch)
- }
- case CLICK_ACTION_PAY:
- if ( mClickActionPayEnabled )
- {
- if ((object && object->flagTakesMoney())
- || (parent && parent->flagTakesMoney()))
- {
- // pay event goes to object actually clicked on
- mClickActionObject = object;
- mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
- if (LLSelectMgr::getInstance()->selectGetAllValid())
- {
- // call this right away, since we have all the info we need to continue the action
- selectionPropertiesReceived();
- }
- return TRUE;
- }
- }
- break;
- case CLICK_ACTION_BUY:
- if ( mClickActionBuyEnabled )
- {
- mClickActionObject = parent;
- mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE);
- if (LLSelectMgr::getInstance()->selectGetAllValid())
- {
- // call this right away, since we have all the info we need to continue the action
- selectionPropertiesReceived();
- }
- return TRUE;
- }
- break;
- case CLICK_ACTION_OPEN:
- if (parent && parent->allowOpen())
- {
- mClickActionObject = parent;
- mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE);
- if (LLSelectMgr::getInstance()->selectGetAllValid())
- {
- // call this right away, since we have all the info we need to continue the action
- selectionPropertiesReceived();
- }
- }
- return TRUE;
- case CLICK_ACTION_PLAY:
- handle_click_action_play();
- return TRUE;
- case CLICK_ACTION_OPEN_MEDIA:
- // mClickActionObject = object;
- handle_click_action_open_media(object);
- return TRUE;
- case CLICK_ACTION_ZOOM:
- {
- const F32 PADDING_FACTOR = 2.f;
- LLViewerObject* object = gObjectList.findObject(mPick.mObjectID);
-
- if (object)
- {
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
-
- LLBBox bbox = object->getBoundingBoxAgent() ;
- F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView());
- F32 distance = bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view);
-
- LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent();
- obj_to_cam.normVec();
-
- LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
- gAgentCamera.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance),
- object_center_global,
- mPick.mObjectID );
- }
- }
- return TRUE;
- case CLICK_ACTION_DISABLED:
- return TRUE;
- default:
- // nothing
- break;
- }
- }
-
- // put focus back "in world"
- if (gFocusMgr.getKeyboardFocus())
- {
- gFocusMgr.setKeyboardFocus(NULL);
- }
+ S32 x = mPick.mMousePt.mX;
+ S32 y = mPick.mMousePt.mY;
+ MASK mask = mPick.mKeyMask;
+ if (mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL)
+ {
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel();
+ if (parcel)
+ {
+ LLViewerParcelMgr::getInstance()->selectCollisionParcel();
+ if (parcel->getParcelFlag(PF_USE_PASS_LIST)
+ && !LLViewerParcelMgr::getInstance()->isCollisionBanned())
+ {
+ // if selling passes, just buy one
+ void* deselect_when_done = (void*)TRUE;
+ LLPanelLandGeneral::onClickBuyPass(deselect_when_done);
+ }
+ else
+ {
+ // not selling passes, get info
+ LLFloaterReg::showInstance("about_land");
+ }
+ }
+
+ gFocusMgr.setKeyboardFocus(NULL);
+ return LLTool::handleMouseDown(x, y, mask);
+ }
+
+ // didn't click in any UI object, so must have clicked in the world
+ LLViewerObject *object = mPick.getObject();
+ LLViewerObject *parent = NULL;
+
+ if (mPick.mPickType != LLPickInfo::PICK_LAND)
+ {
+ LLViewerParcelMgr::getInstance()->deselectLand();
+ }
+
+ if (object)
+ {
+ parent = object->getRootEdit();
+ }
+
+ if (handleMediaClick(mPick))
+ {
+ return TRUE;
+ }
+
+ // If it's a left-click, and we have a special action, do it.
+ if (useClickAction(mask, object, parent))
+ {
+ mClickAction = 0;
+ if (object && object->getClickAction())
+ {
+ mClickAction = object->getClickAction();
+ }
+ else if (parent && parent->getClickAction())
+ {
+ mClickAction = parent->getClickAction();
+ }
+
+ switch(mClickAction)
+ {
+ case CLICK_ACTION_TOUCH:
+ // touch behavior down below...
+ break;
+ case CLICK_ACTION_SIT:
+ {
+ if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // agent not already sitting
+ {
+ handle_object_sit_or_stand();
+ // put focus in world when sitting on an object
+ gFocusMgr.setKeyboardFocus(NULL);
+ return TRUE;
+ } // else nothing (fall through to touch)
+ }
+ case CLICK_ACTION_PAY:
+ if ( mClickActionPayEnabled )
+ {
+ if ((object && object->flagTakesMoney())
+ || (parent && parent->flagTakesMoney()))
+ {
+ // pay event goes to object actually clicked on
+ mClickActionObject = object;
+ mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
+ if (LLSelectMgr::getInstance()->selectGetAllValid())
+ {
+ // call this right away, since we have all the info we need to continue the action
+ selectionPropertiesReceived();
+ }
+ return TRUE;
+ }
+ }
+ break;
+ case CLICK_ACTION_BUY:
+ if ( mClickActionBuyEnabled )
+ {
+ mClickActionObject = parent;
+ mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE);
+ if (LLSelectMgr::getInstance()->selectGetAllValid())
+ {
+ // call this right away, since we have all the info we need to continue the action
+ selectionPropertiesReceived();
+ }
+ return TRUE;
+ }
+ break;
+ case CLICK_ACTION_OPEN:
+ if (parent && parent->allowOpen())
+ {
+ mClickActionObject = parent;
+ mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE);
+ if (LLSelectMgr::getInstance()->selectGetAllValid())
+ {
+ // call this right away, since we have all the info we need to continue the action
+ selectionPropertiesReceived();
+ }
+ }
+ return TRUE;
+ case CLICK_ACTION_PLAY:
+ handle_click_action_play();
+ return TRUE;
+ case CLICK_ACTION_OPEN_MEDIA:
+ // mClickActionObject = object;
+ handle_click_action_open_media(object);
+ return TRUE;
+ case CLICK_ACTION_ZOOM:
+ {
+ const F32 PADDING_FACTOR = 2.f;
+ LLViewerObject* object = gObjectList.findObject(mPick.mObjectID);
+
+ if (object)
+ {
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+
+ LLBBox bbox = object->getBoundingBoxAgent() ;
+ F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView());
+ F32 distance = bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view);
+
+ LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent();
+ obj_to_cam.normVec();
+
+ LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
+ gAgentCamera.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance),
+ object_center_global,
+ mPick.mObjectID );
+ }
+ }
+ return TRUE;
+ case CLICK_ACTION_DISABLED:
+ return TRUE;
+ default:
+ // nothing
+ break;
+ }
+ }
+
+ // put focus back "in world"
+ if (gFocusMgr.getKeyboardFocus())
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
bool touchable = object
&& (object->getClickAction() != CLICK_ACTION_DISABLED)
&& (object->flagHandleTouch() || (parent && parent->flagHandleTouch()));
- // Switch to grab tool if physical or triggerable
- if (object &&
- !object->isAvatar() &&
- ((object->flagUsePhysics() || (parent && !parent->isAvatar() && parent->flagUsePhysics())) || touchable)
- )
- {
- gGrabTransientTool = this;
- mMouseButtonDown = false;
- LLToolGrab::getInstance()->setClickedInMouselook(gAgentCamera.cameraMouselook());
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
- return LLToolGrab::getInstance()->handleObjectHit( mPick );
- }
-
- LLHUDIcon* last_hit_hud_icon = mPick.mHUDIcon;
- if (!object && last_hit_hud_icon && last_hit_hud_icon->getSourceObject())
- {
- LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID());
- }
-
- // If left-click never selects or spawns a menu
- // Eat the event.
-
- // mouse already released
- if (!mMouseButtonDown)
- {
- return true;
- }
-
- while (object && object->isAttachment() && !object->flagHandleTouch())
- {
- // don't pick avatar through hud attachment
- if (object->isHUDAttachment())
- {
- break;
- }
- object = (LLViewerObject*)object->getParent();
- }
- if (object && object == gAgentAvatarp)
- {
- // we left clicked on avatar, switch to focus mode
- mMouseButtonDown = false;
- LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
- gViewerWindow->hideCursor();
- LLToolCamera::getInstance()->setMouseCapture(TRUE);
+ // Switch to grab tool if physical or triggerable
+ if (object &&
+ !object->isAvatar() &&
+ ((object->flagUsePhysics() || (parent && !parent->isAvatar() && parent->flagUsePhysics())) || touchable)
+ )
+ {
+ gGrabTransientTool = this;
+ mMouseButtonDown = false;
+ LLToolGrab::getInstance()->setClickedInMouselook(gAgentCamera.cameraMouselook());
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
+ return LLToolGrab::getInstance()->handleObjectHit( mPick );
+ }
+
+ LLHUDIcon* last_hit_hud_icon = mPick.mHUDIcon;
+ if (!object && last_hit_hud_icon && last_hit_hud_icon->getSourceObject())
+ {
+ LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID());
+ }
+
+ // If left-click never selects or spawns a menu
+ // Eat the event.
+
+ // mouse already released
+ if (!mMouseButtonDown)
+ {
+ return true;
+ }
+
+ while (object && object->isAttachment() && !object->flagHandleTouch())
+ {
+ // don't pick avatar through hud attachment
+ if (object->isHUDAttachment())
+ {
+ break;
+ }
+ object = (LLViewerObject*)object->getParent();
+ }
+ if (object && object == gAgentAvatarp)
+ {
+ // we left clicked on avatar, switch to focus mode
+ mMouseButtonDown = false;
+ LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
+ gViewerWindow->hideCursor();
+ LLToolCamera::getInstance()->setMouseCapture(TRUE);
LLToolCamera::getInstance()->setClickPickPending();
- LLToolCamera::getInstance()->pickCallback(mPick);
- gAgentCamera.setFocusOnAvatar(TRUE, TRUE);
+ LLToolCamera::getInstance()->pickCallback(mPick);
+ gAgentCamera.setFocusOnAvatar(TRUE, TRUE);
- return TRUE;
- }
- //////////
- // // Could be first left-click on nothing
- // LLFirstUse::useLeftClickNoHit();
- /////////
+ return TRUE;
+ }
+ //////////
+ // // Could be first left-click on nothing
+ // LLFirstUse::useLeftClickNoHit();
+ /////////
- return LLTool::handleMouseDown(x, y, mask);
+ return LLTool::handleMouseDown(x, y, mask);
}
-BOOL LLToolPie::useClickAction(MASK mask,
- LLViewerObject* object,
- LLViewerObject* parent)
+BOOL LLToolPie::useClickAction(MASK mask,
+ LLViewerObject* object,
+ LLViewerObject* parent)
{
- return mask == MASK_NONE
- && object
- && !object->isAttachment()
- && LLPrimitive::isPrimitive(object->getPCode())
- // useClickAction does not handle Touch (0) or Disabled action
- && ((object->getClickAction() && object->getClickAction() != CLICK_ACTION_DISABLED)
- || (parent && parent->getClickAction() && parent->getClickAction() != CLICK_ACTION_DISABLED));
+ return mask == MASK_NONE
+ && object
+ && !object->isAttachment()
+ && LLPrimitive::isPrimitive(object->getPCode())
+ // useClickAction does not handle Touch (0) or Disabled action
+ && ((object->getClickAction() && object->getClickAction() != CLICK_ACTION_DISABLED)
+ || (parent && parent->getClickAction() && parent->getClickAction() != CLICK_ACTION_DISABLED));
}
U8 final_click_action(LLViewerObject* obj)
{
- if (!obj) return CLICK_ACTION_NONE;
- if (obj->isAttachment()) return CLICK_ACTION_NONE;
+ if (!obj) return CLICK_ACTION_NONE;
+ if (obj->isAttachment()) return CLICK_ACTION_NONE;
- U8 click_action = CLICK_ACTION_TOUCH;
- LLViewerObject* parent = obj->getRootEdit();
+ U8 click_action = CLICK_ACTION_TOUCH;
+ LLViewerObject* parent = obj->getRootEdit();
U8 object_action = obj->getClickAction();
U8 parent_action = parent ? parent->getClickAction() : CLICK_ACTION_TOUCH;
if (parent_action == CLICK_ACTION_DISABLED || object_action)
@@ -492,88 +492,88 @@ U8 final_click_action(LLViewerObject* obj)
{
click_action = parent_action;
}
- return click_action;
+ return click_action;
}
ECursorType LLToolPie::cursorFromObject(LLViewerObject* object)
{
- LLViewerObject* parent = NULL;
- if (object)
- {
- parent = object->getRootEdit();
- }
- U8 click_action = final_click_action(object);
- ECursorType cursor = UI_CURSOR_ARROW;
- switch(click_action)
- {
- case CLICK_ACTION_SIT:
- {
- if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting?
- {
- cursor = UI_CURSOR_TOOLSIT;
- }
- }
- break;
- case CLICK_ACTION_BUY:
- if ( mClickActionBuyEnabled )
- {
- LLSelectNode* node = LLSelectMgr::getInstance()->getHoverNode();
- if (!node || node->mSaleInfo.isForSale())
- {
- cursor = UI_CURSOR_TOOLBUY;
- }
- }
- break;
- case CLICK_ACTION_OPEN:
- // Open always opens the parent.
- if (parent && parent->allowOpen())
- {
- cursor = UI_CURSOR_TOOLOPEN;
- }
- break;
- case CLICK_ACTION_PAY:
- if ( mClickActionPayEnabled )
- {
- if ((object && object->flagTakesMoney())
- || (parent && parent->flagTakesMoney()))
- {
- cursor = UI_CURSOR_TOOLBUY;
- }
- }
- break;
- case CLICK_ACTION_ZOOM:
- cursor = UI_CURSOR_TOOLZOOMIN;
- break;
- case CLICK_ACTION_PLAY:
- case CLICK_ACTION_OPEN_MEDIA:
- cursor = cursor_from_parcel_media(click_action);
- break;
- case CLICK_ACTION_DISABLED:
- break;
- default:
- break;
- }
- return cursor;
+ LLViewerObject* parent = NULL;
+ if (object)
+ {
+ parent = object->getRootEdit();
+ }
+ U8 click_action = final_click_action(object);
+ ECursorType cursor = UI_CURSOR_ARROW;
+ switch(click_action)
+ {
+ case CLICK_ACTION_SIT:
+ {
+ if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting?
+ {
+ cursor = UI_CURSOR_TOOLSIT;
+ }
+ }
+ break;
+ case CLICK_ACTION_BUY:
+ if ( mClickActionBuyEnabled )
+ {
+ LLSelectNode* node = LLSelectMgr::getInstance()->getHoverNode();
+ if (!node || node->mSaleInfo.isForSale())
+ {
+ cursor = UI_CURSOR_TOOLBUY;
+ }
+ }
+ break;
+ case CLICK_ACTION_OPEN:
+ // Open always opens the parent.
+ if (parent && parent->allowOpen())
+ {
+ cursor = UI_CURSOR_TOOLOPEN;
+ }
+ break;
+ case CLICK_ACTION_PAY:
+ if ( mClickActionPayEnabled )
+ {
+ if ((object && object->flagTakesMoney())
+ || (parent && parent->flagTakesMoney()))
+ {
+ cursor = UI_CURSOR_TOOLBUY;
+ }
+ }
+ break;
+ case CLICK_ACTION_ZOOM:
+ cursor = UI_CURSOR_TOOLZOOMIN;
+ break;
+ case CLICK_ACTION_PLAY:
+ case CLICK_ACTION_OPEN_MEDIA:
+ cursor = cursor_from_parcel_media(click_action);
+ break;
+ case CLICK_ACTION_DISABLED:
+ break;
+ default:
+ break;
+ }
+ return cursor;
}
void LLToolPie::resetSelection()
{
- mLeftClickSelection = NULL;
- mClickActionObject = NULL;
- mClickAction = 0;
+ mLeftClickSelection = NULL;
+ mClickActionObject = NULL;
+ mClickAction = 0;
}
bool LLToolPie::walkToClickedLocation()
{
- if (gAgent.getFlying() // don't auto-navigate while flying until that works
+ if (gAgent.getFlying() // don't auto-navigate while flying until that works
|| !gAgentAvatarp
|| gAgentAvatarp->isSitting())
{
return false;
}
- LLUIUsage::instance().logCommand("Agent.WalkToClickedLocation");
-
+ LLUIUsage::instance().logCommand("Agent.WalkToClickedLocation");
+
LLPickInfo saved_pick = mPick;
if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
{
@@ -693,126 +693,126 @@ bool LLToolPie::teleportToClickedLocation()
// static
void LLToolPie::selectionPropertiesReceived()
{
- // Make sure all data has been received.
- // This function will be called repeatedly as the data comes in.
- if (!LLSelectMgr::getInstance()->selectGetAllValid())
- {
- return;
- }
-
- LLObjectSelection* selection = LLToolPie::getInstance()->getLeftClickSelection();
- if (selection)
- {
- LLViewerObject* selected_object = selection->getPrimaryObject();
- // since we don't currently have a way to lock a selection, it could have changed
- // after we initially clicked on the object
- if (selected_object == LLToolPie::getInstance()->getClickActionObject())
- {
- U8 click_action = LLToolPie::getInstance()->getClickAction();
- switch (click_action)
- {
- case CLICK_ACTION_BUY:
- if ( LLToolPie::getInstance()->mClickActionBuyEnabled )
- {
- handle_buy();
- }
- break;
- case CLICK_ACTION_PAY:
- if ( LLToolPie::getInstance()->mClickActionPayEnabled )
- {
- handle_give_money_dialog();
- }
- break;
- case CLICK_ACTION_OPEN:
- LLFloaterReg::showInstance("openobject");
- break;
- case CLICK_ACTION_DISABLED:
- break;
- default:
- break;
- }
- }
- }
- LLToolPie::getInstance()->resetSelection();
+ // Make sure all data has been received.
+ // This function will be called repeatedly as the data comes in.
+ if (!LLSelectMgr::getInstance()->selectGetAllValid())
+ {
+ return;
+ }
+
+ LLObjectSelection* selection = LLToolPie::getInstance()->getLeftClickSelection();
+ if (selection)
+ {
+ LLViewerObject* selected_object = selection->getPrimaryObject();
+ // since we don't currently have a way to lock a selection, it could have changed
+ // after we initially clicked on the object
+ if (selected_object == LLToolPie::getInstance()->getClickActionObject())
+ {
+ U8 click_action = LLToolPie::getInstance()->getClickAction();
+ switch (click_action)
+ {
+ case CLICK_ACTION_BUY:
+ if ( LLToolPie::getInstance()->mClickActionBuyEnabled )
+ {
+ handle_buy();
+ }
+ break;
+ case CLICK_ACTION_PAY:
+ if ( LLToolPie::getInstance()->mClickActionPayEnabled )
+ {
+ handle_give_money_dialog();
+ }
+ break;
+ case CLICK_ACTION_OPEN:
+ LLFloaterReg::showInstance("openobject");
+ break;
+ case CLICK_ACTION_DISABLED:
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ LLToolPie::getInstance()->resetSelection();
}
BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
{
BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick");
- mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged);
- LLViewerObject *parent = NULL;
- LLViewerObject *object = mHoverPick.getObject();
- LLSelectMgr::getInstance()->setHoverObject(object, mHoverPick.mObjectFace);
- if (object)
- {
- parent = object->getRootEdit();
- }
-
- if (!handleMediaHover(mHoverPick)
- && !mMouseOutsideSlop
- && mMouseButtonDown
- // disable camera steering if click on land is not used for moving
- && gViewerInput.isMouseBindUsed(CLICK_LEFT, MASK_NONE, MODE_THIRD_PERSON))
- {
- S32 delta_x = x - mMouseDownX;
- S32 delta_y = y - mMouseDownY;
- S32 threshold = gSavedSettings.getS32("DragAndDropDistanceThreshold");
- if (delta_x * delta_x + delta_y * delta_y > threshold * threshold)
- {
- startCameraSteering();
- steerCameraWithMouse(x, y);
- gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
- }
- else
- {
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- }
- }
- else if (inCameraSteerMode())
- {
- steerCameraWithMouse(x, y);
- gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
- }
- else
- {
- // perform a separate pick that detects transparent objects since they respond to 1-click actions
- LLPickInfo click_action_pick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged);
-
- LLViewerObject* click_action_object = click_action_pick.getObject();
-
- if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit()))
- {
- ECursorType cursor = cursorFromObject(click_action_object);
- gViewerWindow->setCursor(cursor);
- LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL;
- }
-
- else if ((object && !object->isAvatar() && object->flagUsePhysics())
- || (parent && !parent->isAvatar() && parent->flagUsePhysics()))
- {
- gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
- LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL;
- }
- else if ((!object || object->getClickAction() != CLICK_ACTION_DISABLED)
- && ((object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch()))
- && (!object || !object->isAvatar()))
- {
- gViewerWindow->setCursor(UI_CURSOR_HAND);
- LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL;
- }
- else
- {
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL;
- }
- }
-
- if(!object)
- {
- LLViewerMediaFocus::getInstance()->clearHover();
- }
-
- return TRUE;
+ mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged);
+ LLViewerObject *parent = NULL;
+ LLViewerObject *object = mHoverPick.getObject();
+ LLSelectMgr::getInstance()->setHoverObject(object, mHoverPick.mObjectFace);
+ if (object)
+ {
+ parent = object->getRootEdit();
+ }
+
+ if (!handleMediaHover(mHoverPick)
+ && !mMouseOutsideSlop
+ && mMouseButtonDown
+ // disable camera steering if click on land is not used for moving
+ && gViewerInput.isMouseBindUsed(CLICK_LEFT, MASK_NONE, MODE_THIRD_PERSON))
+ {
+ S32 delta_x = x - mMouseDownX;
+ S32 delta_y = y - mMouseDownY;
+ S32 threshold = gSavedSettings.getS32("DragAndDropDistanceThreshold");
+ if (delta_x * delta_x + delta_y * delta_y > threshold * threshold)
+ {
+ startCameraSteering();
+ steerCameraWithMouse(x, y);
+ gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
+ }
+ else
+ {
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ }
+ }
+ else if (inCameraSteerMode())
+ {
+ steerCameraWithMouse(x, y);
+ gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
+ }
+ else
+ {
+ // perform a separate pick that detects transparent objects since they respond to 1-click actions
+ LLPickInfo click_action_pick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged);
+
+ LLViewerObject* click_action_object = click_action_pick.getObject();
+
+ if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit()))
+ {
+ ECursorType cursor = cursorFromObject(click_action_object);
+ gViewerWindow->setCursor(cursor);
+ LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL;
+ }
+
+ else if ((object && !object->isAvatar() && object->flagUsePhysics())
+ || (parent && !parent->isAvatar() && parent->flagUsePhysics()))
+ {
+ gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
+ LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL;
+ }
+ else if ((!object || object->getClickAction() != CLICK_ACTION_DISABLED)
+ && ((object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch()))
+ && (!object || !object->isAvatar()))
+ {
+ gViewerWindow->setCursor(UI_CURSOR_HAND);
+ LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL;
+ }
+ else
+ {
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL;
+ }
+ }
+
+ if(!object)
+ {
+ LLViewerMediaFocus::getInstance()->clearHover();
+ }
+
+ return TRUE;
}
BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
@@ -827,112 +827,112 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
}
LLViewerObject* obj = mPick.getObject();
- stopCameraSteering();
- mMouseButtonDown = false;
+ stopCameraSteering();
+ mMouseButtonDown = false;
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- if (hasMouseCapture())
- {
- setMouseCapture(FALSE);
- }
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ if (hasMouseCapture())
+ {
+ setMouseCapture(FALSE);
+ }
- LLToolMgr::getInstance()->clearTransientTool();
- gAgentCamera.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on
+ LLToolMgr::getInstance()->clearTransientTool();
+ gAgentCamera.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on
- return LLTool::handleMouseUp(x, y, mask);
+ return LLTool::handleMouseUp(x, y, mask);
}
void LLToolPie::stopClickToWalk()
{
- mPick.mPosGlobal = gAgent.getPositionGlobal();
- handle_go_to();
- if(mAutoPilotDestination)
- {
- mAutoPilotDestination->markDead();
- }
+ mPick.mPosGlobal = gAgent.getPositionGlobal();
+ handle_go_to();
+ if(mAutoPilotDestination)
+ {
+ mAutoPilotDestination->markDead();
+ }
}
BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- if (gDebugClicks)
- {
- LL_INFOS() << "LLToolPie handleDoubleClick (becoming mouseDown)" << LL_ENDL;
- }
-
- if (handleMediaDblClick(mPick))
- {
- return TRUE;
- }
-
- if (!mDoubleClickTimer.getStarted() || (mDoubleClickTimer.getElapsedTimeF32() > 0.3f))
- {
- mDoubleClickTimer.stop();
- return FALSE;
- }
- mDoubleClickTimer.stop();
-
- return FALSE;
+ if (gDebugClicks)
+ {
+ LL_INFOS() << "LLToolPie handleDoubleClick (becoming mouseDown)" << LL_ENDL;
+ }
+
+ if (handleMediaDblClick(mPick))
+ {
+ return TRUE;
+ }
+
+ if (!mDoubleClickTimer.getStarted() || (mDoubleClickTimer.getElapsedTimeF32() > 0.3f))
+ {
+ mDoubleClickTimer.stop();
+ return FALSE;
+ }
+ mDoubleClickTimer.stop();
+
+ return FALSE;
}
static bool needs_tooltip(LLSelectNode* nodep)
{
- if (!nodep || !nodep->mValid)
- return false;
- return true;
+ if (!nodep || !nodep->mValid)
+ return false;
+ return true;
}
BOOL LLToolPie::handleTooltipLand(std::string line, std::string tooltip_msg)
{
- // Do not show hover for land unless prefs are set to allow it.
- if (!gSavedSettings.getBOOL("ShowLandHoverTip")) return TRUE;
-
- LLViewerParcelMgr::getInstance()->setHoverParcel( mHoverPick.mPosGlobal );
-
- // Didn't hit an object, but since we have a land point we
- // must be hovering over land.
-
- LLParcel* hover_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
- LLUUID owner;
-
- if ( hover_parcel )
- {
- owner = hover_parcel->getOwnerID();
- }
-
- // Line: "Land"
- line.clear();
- line.append(LLTrans::getString("TooltipLand"));
- if (hover_parcel)
- {
- line.append(hover_parcel->getName());
- }
- tooltip_msg.append(line);
- tooltip_msg.push_back('\n');
-
- // Line: "Owner: James Linden"
- line.clear();
- line.append(LLTrans::getString("TooltipOwner") + " ");
-
- if ( hover_parcel )
- {
- std::string name;
- if (LLUUID::null == owner)
- {
- line.append(LLTrans::getString("TooltipPublic"));
- }
- else if (hover_parcel->getIsGroupOwned())
- {
- if (gCacheName->getGroupName(owner, name))
- {
- line.append(name);
- line.append(LLTrans::getString("TooltipIsGroup"));
- }
- else
- {
- line.append(LLTrans::getString("RetrievingData"));
- }
- }
+ // Do not show hover for land unless prefs are set to allow it.
+ if (!gSavedSettings.getBOOL("ShowLandHoverTip")) return TRUE;
+
+ LLViewerParcelMgr::getInstance()->setHoverParcel( mHoverPick.mPosGlobal );
+
+ // Didn't hit an object, but since we have a land point we
+ // must be hovering over land.
+
+ LLParcel* hover_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
+ LLUUID owner;
+
+ if ( hover_parcel )
+ {
+ owner = hover_parcel->getOwnerID();
+ }
+
+ // Line: "Land"
+ line.clear();
+ line.append(LLTrans::getString("TooltipLand"));
+ if (hover_parcel)
+ {
+ line.append(hover_parcel->getName());
+ }
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+
+ // Line: "Owner: James Linden"
+ line.clear();
+ line.append(LLTrans::getString("TooltipOwner") + " ");
+
+ if ( hover_parcel )
+ {
+ std::string name;
+ if (LLUUID::null == owner)
+ {
+ line.append(LLTrans::getString("TooltipPublic"));
+ }
+ else if (hover_parcel->getIsGroupOwned())
+ {
+ if (gCacheName->getGroupName(owner, name))
+ {
+ line.append(name);
+ line.append(LLTrans::getString("TooltipIsGroup"));
+ }
+ else
+ {
+ line.append(LLTrans::getString("RetrievingData"));
+ }
+ }
else
{
LLAvatarName av_name;
@@ -946,408 +946,408 @@ BOOL LLToolPie::handleTooltipLand(std::string line, std::string tooltip_msg)
line.append(LLTrans::getString("RetrievingData"));
}
}
- }
- else
- {
- line.append(LLTrans::getString("RetrievingData"));
- }
- tooltip_msg.append(line);
- tooltip_msg.push_back('\n');
-
- // Line: "no fly, not safe, no build"
-
- // Don't display properties for your land. This is just
- // confusing, because you can do anything on your own land.
- if ( hover_parcel && owner != gAgent.getID() )
- {
- S32 words = 0;
-
- line.clear();
- // JC - Keep this in the same order as the checkboxes
- // on the land info panel
- if ( !hover_parcel->getAllowModify() )
- {
- if ( hover_parcel->getAllowGroupModify() )
- {
- line.append(LLTrans::getString("TooltipFlagGroupBuild"));
- }
- else
- {
- line.append(LLTrans::getString("TooltipFlagNoBuild"));
- }
- words++;
- }
-
- if ( !hover_parcel->getAllowTerraform() )
- {
- if (words) line.append(", ");
- line.append(LLTrans::getString("TooltipFlagNoEdit"));
- words++;
- }
-
- if ( hover_parcel->getAllowDamage() )
- {
- if (words) line.append(", ");
- line.append(LLTrans::getString("TooltipFlagNotSafe"));
- words++;
- }
-
- // Maybe we should reflect the estate's block fly bit here as well? DK 12/1/04
- if ( !hover_parcel->getAllowFly() )
- {
- if (words) line.append(", ");
- line.append(LLTrans::getString("TooltipFlagNoFly"));
- words++;
- }
-
- if ( !hover_parcel->getAllowOtherScripts() )
- {
- if (words) line.append(", ");
- if ( hover_parcel->getAllowGroupScripts() )
- {
- line.append(LLTrans::getString("TooltipFlagGroupScripts"));
- }
- else
- {
- line.append(LLTrans::getString("TooltipFlagNoScripts"));
- }
-
- words++;
- }
-
- if (words)
- {
- tooltip_msg.append(line);
- tooltip_msg.push_back('\n');
- }
- }
-
- if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE))
- {
- LLStringUtil::format_map_t args;
- S32 price = hover_parcel->getSalePrice();
- args["[AMOUNT]"] = LLResMgr::getInstance()->getMonetaryString(price);
- line = LLTrans::getString("TooltipForSaleL$", args);
- tooltip_msg.append(line);
- tooltip_msg.push_back('\n');
- }
-
- // trim last newlines
- if (!tooltip_msg.empty())
- {
- tooltip_msg.erase(tooltip_msg.size() - 1);
- LLToolTipMgr::instance().show(tooltip_msg);
- }
-
- return TRUE;
+ }
+ else
+ {
+ line.append(LLTrans::getString("RetrievingData"));
+ }
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+
+ // Line: "no fly, not safe, no build"
+
+ // Don't display properties for your land. This is just
+ // confusing, because you can do anything on your own land.
+ if ( hover_parcel && owner != gAgent.getID() )
+ {
+ S32 words = 0;
+
+ line.clear();
+ // JC - Keep this in the same order as the checkboxes
+ // on the land info panel
+ if ( !hover_parcel->getAllowModify() )
+ {
+ if ( hover_parcel->getAllowGroupModify() )
+ {
+ line.append(LLTrans::getString("TooltipFlagGroupBuild"));
+ }
+ else
+ {
+ line.append(LLTrans::getString("TooltipFlagNoBuild"));
+ }
+ words++;
+ }
+
+ if ( !hover_parcel->getAllowTerraform() )
+ {
+ if (words) line.append(", ");
+ line.append(LLTrans::getString("TooltipFlagNoEdit"));
+ words++;
+ }
+
+ if ( hover_parcel->getAllowDamage() )
+ {
+ if (words) line.append(", ");
+ line.append(LLTrans::getString("TooltipFlagNotSafe"));
+ words++;
+ }
+
+ // Maybe we should reflect the estate's block fly bit here as well? DK 12/1/04
+ if ( !hover_parcel->getAllowFly() )
+ {
+ if (words) line.append(", ");
+ line.append(LLTrans::getString("TooltipFlagNoFly"));
+ words++;
+ }
+
+ if ( !hover_parcel->getAllowOtherScripts() )
+ {
+ if (words) line.append(", ");
+ if ( hover_parcel->getAllowGroupScripts() )
+ {
+ line.append(LLTrans::getString("TooltipFlagGroupScripts"));
+ }
+ else
+ {
+ line.append(LLTrans::getString("TooltipFlagNoScripts"));
+ }
+
+ words++;
+ }
+
+ if (words)
+ {
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+ }
+ }
+
+ if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE))
+ {
+ LLStringUtil::format_map_t args;
+ S32 price = hover_parcel->getSalePrice();
+ args["[AMOUNT]"] = LLResMgr::getInstance()->getMonetaryString(price);
+ line = LLTrans::getString("TooltipForSaleL$", args);
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+ }
+
+ // trim last newlines
+ if (!tooltip_msg.empty())
+ {
+ tooltip_msg.erase(tooltip_msg.size() - 1);
+ LLToolTipMgr::instance().show(tooltip_msg);
+ }
+
+ return TRUE;
}
BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string line, std::string tooltip_msg)
{
- if ( hover_object->isHUDAttachment() )
- {
- // no hover tips for HUD elements, since they can obscure
- // what the HUD is displaying
- return TRUE;
- }
-
- if ( hover_object->isAttachment() )
- {
- // get root of attachment then parent, which is avatar
- LLViewerObject* root_edit = hover_object->getRootEdit();
- if (!root_edit)
- {
- // Strange parenting issue, don't show any text
- return TRUE;
- }
- hover_object = (LLViewerObject*)root_edit->getParent();
- if (!hover_object)
- {
- // another strange parenting issue, bail out
- return TRUE;
- }
- }
-
- line.clear();
- if (hover_object->isAvatar())
- {
- // only show tooltip if same inspector not already open
- LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_avatar");
- if (!existing_inspector
- || !existing_inspector->getVisible()
- || existing_inspector->getKey()["avatar_id"].asUUID() != hover_object->getID())
- {
- // Try to get display name + username
- std::string final_name;
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(hover_object->getID(), &av_name))
- {
- final_name = av_name.getCompleteName();
- }
- else
- {
- final_name = LLTrans::getString("TooltipPerson");;
- }
-
- LLInspector::Params p;
- p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
- p.message(final_name);
- p.image.name("Inspector_I");
- p.click_callback(boost::bind(showAvatarInspector, hover_object->getID()));
- p.visible_time_near(6.f);
- p.visible_time_far(3.f);
- p.delay_time(gSavedSettings.getF32("AvatarInspectorTooltipDelay"));
- p.wrap(false);
-
- LLToolTipMgr::instance().show(p);
- }
- }
- else
- {
- //
- // We have hit a regular object (not an avatar or attachment)
- //
-
- //
- // Default prefs will suppress display unless the object is interactive
- //
- bool show_all_object_tips =
- (bool)gSavedSettings.getBOOL("ShowAllObjectHoverTip");
- LLSelectNode *nodep = LLSelectMgr::getInstance()->getHoverNode();
-
- // only show tooltip if same inspector not already open
- LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_object");
- if (nodep &&
- (!existing_inspector
- || !existing_inspector->getVisible()
- || existing_inspector->getKey()["object_id"].asUUID() != hover_object->getID()))
- {
-
- // Add price to tooltip for items on sale
- bool for_sale = for_sale_selection(nodep);
- if(for_sale)
- {
- LLStringUtil::format_map_t args;
- S32 price = nodep->mSaleInfo.getSalePrice();
- args["[AMOUNT]"] = LLResMgr::getInstance()->getMonetaryString(price);
- tooltip_msg.append(LLTrans::getString("TooltipPrice", args) );
- }
-
- if (nodep->mName.empty())
- {
- tooltip_msg.append(LLTrans::getString("TooltipNoName"));
- }
- else
- {
- tooltip_msg.append( nodep->mName );
- }
-
- bool has_media = false;
- bool is_time_based_media = false;
- bool is_web_based_media = false;
- bool is_media_playing = false;
- bool is_media_displaying = false;
-
- // Does this face have media?
- const LLTextureEntry* tep = hover_object->getTE(mHoverPick.mObjectFace);
-
- if(tep)
- {
- has_media = tep->hasMedia();
- const LLMediaEntry* mep = has_media ? tep->getMediaData() : NULL;
- if (mep)
- {
- viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
- LLPluginClassMedia* media_plugin = NULL;
-
- if (media_impl.notNull() && (media_impl->hasMedia()))
- {
- is_media_displaying = true;
- //LLStringUtil::format_map_t args;
-
- media_plugin = media_impl->getMediaPlugin();
- if(media_plugin)
- {
- if(media_plugin->pluginSupportsMediaTime())
- {
- is_time_based_media = true;
- is_web_based_media = false;
- //args["[CurrentURL]"] = media_impl->getMediaURL();
- is_media_playing = media_impl->isMediaPlaying();
- }
- else
- {
- is_time_based_media = false;
- is_web_based_media = true;
- //args["[CurrentURL]"] = media_plugin->getLocation();
- }
- //tooltip_msg.append(LLTrans::getString("CurrentURL", args));
- }
- }
- }
- }
-
-
- // Avoid showing tip over media that's displaying unless it's for sale
- // also check the primary node since sometimes it can have an action even though
- // the root node doesn't
-
- bool needs_tip = (!is_media_displaying ||
- for_sale) &&
- (has_media ||
- needs_tooltip(nodep) ||
- needs_tooltip(LLSelectMgr::getInstance()->getPrimaryHoverNode()));
-
- if (show_all_object_tips || needs_tip)
- {
- LLInspector::Params p;
- p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
- p.message(tooltip_msg);
- p.image.name("Inspector_I");
- p.click_callback(boost::bind(showObjectInspector, hover_object->getID(), mHoverPick.mObjectFace));
- p.time_based_media(is_time_based_media);
- p.web_based_media(is_web_based_media);
- p.media_playing(is_media_playing);
- p.click_playmedia_callback(boost::bind(playCurrentMedia, mHoverPick));
- p.click_homepage_callback(boost::bind(VisitHomePage, mHoverPick));
- p.visible_time_near(6.f);
- p.visible_time_far(3.f);
- p.delay_time(gSavedSettings.getF32("ObjectInspectorTooltipDelay"));
- p.wrap(false);
-
- LLToolTipMgr::instance().show(p);
- }
- }
- }
-
- return TRUE;
+ if ( hover_object->isHUDAttachment() )
+ {
+ // no hover tips for HUD elements, since they can obscure
+ // what the HUD is displaying
+ return TRUE;
+ }
+
+ if ( hover_object->isAttachment() )
+ {
+ // get root of attachment then parent, which is avatar
+ LLViewerObject* root_edit = hover_object->getRootEdit();
+ if (!root_edit)
+ {
+ // Strange parenting issue, don't show any text
+ return TRUE;
+ }
+ hover_object = (LLViewerObject*)root_edit->getParent();
+ if (!hover_object)
+ {
+ // another strange parenting issue, bail out
+ return TRUE;
+ }
+ }
+
+ line.clear();
+ if (hover_object->isAvatar())
+ {
+ // only show tooltip if same inspector not already open
+ LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_avatar");
+ if (!existing_inspector
+ || !existing_inspector->getVisible()
+ || existing_inspector->getKey()["avatar_id"].asUUID() != hover_object->getID())
+ {
+ // Try to get display name + username
+ std::string final_name;
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(hover_object->getID(), &av_name))
+ {
+ final_name = av_name.getCompleteName();
+ }
+ else
+ {
+ final_name = LLTrans::getString("TooltipPerson");;
+ }
+
+ LLInspector::Params p;
+ p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
+ p.message(final_name);
+ p.image.name("Inspector_I");
+ p.click_callback(boost::bind(showAvatarInspector, hover_object->getID()));
+ p.visible_time_near(6.f);
+ p.visible_time_far(3.f);
+ p.delay_time(gSavedSettings.getF32("AvatarInspectorTooltipDelay"));
+ p.wrap(false);
+
+ LLToolTipMgr::instance().show(p);
+ }
+ }
+ else
+ {
+ //
+ // We have hit a regular object (not an avatar or attachment)
+ //
+
+ //
+ // Default prefs will suppress display unless the object is interactive
+ //
+ bool show_all_object_tips =
+ (bool)gSavedSettings.getBOOL("ShowAllObjectHoverTip");
+ LLSelectNode *nodep = LLSelectMgr::getInstance()->getHoverNode();
+
+ // only show tooltip if same inspector not already open
+ LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_object");
+ if (nodep &&
+ (!existing_inspector
+ || !existing_inspector->getVisible()
+ || existing_inspector->getKey()["object_id"].asUUID() != hover_object->getID()))
+ {
+
+ // Add price to tooltip for items on sale
+ bool for_sale = for_sale_selection(nodep);
+ if(for_sale)
+ {
+ LLStringUtil::format_map_t args;
+ S32 price = nodep->mSaleInfo.getSalePrice();
+ args["[AMOUNT]"] = LLResMgr::getInstance()->getMonetaryString(price);
+ tooltip_msg.append(LLTrans::getString("TooltipPrice", args) );
+ }
+
+ if (nodep->mName.empty())
+ {
+ tooltip_msg.append(LLTrans::getString("TooltipNoName"));
+ }
+ else
+ {
+ tooltip_msg.append( nodep->mName );
+ }
+
+ bool has_media = false;
+ bool is_time_based_media = false;
+ bool is_web_based_media = false;
+ bool is_media_playing = false;
+ bool is_media_displaying = false;
+
+ // Does this face have media?
+ const LLTextureEntry* tep = hover_object->getTE(mHoverPick.mObjectFace);
+
+ if(tep)
+ {
+ has_media = tep->hasMedia();
+ const LLMediaEntry* mep = has_media ? tep->getMediaData() : NULL;
+ if (mep)
+ {
+ viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
+ LLPluginClassMedia* media_plugin = NULL;
+
+ if (media_impl.notNull() && (media_impl->hasMedia()))
+ {
+ is_media_displaying = true;
+ //LLStringUtil::format_map_t args;
+
+ media_plugin = media_impl->getMediaPlugin();
+ if(media_plugin)
+ {
+ if(media_plugin->pluginSupportsMediaTime())
+ {
+ is_time_based_media = true;
+ is_web_based_media = false;
+ //args["[CurrentURL]"] = media_impl->getMediaURL();
+ is_media_playing = media_impl->isMediaPlaying();
+ }
+ else
+ {
+ is_time_based_media = false;
+ is_web_based_media = true;
+ //args["[CurrentURL]"] = media_plugin->getLocation();
+ }
+ //tooltip_msg.append(LLTrans::getString("CurrentURL", args));
+ }
+ }
+ }
+ }
+
+
+ // Avoid showing tip over media that's displaying unless it's for sale
+ // also check the primary node since sometimes it can have an action even though
+ // the root node doesn't
+
+ bool needs_tip = (!is_media_displaying ||
+ for_sale) &&
+ (has_media ||
+ needs_tooltip(nodep) ||
+ needs_tooltip(LLSelectMgr::getInstance()->getPrimaryHoverNode()));
+
+ if (show_all_object_tips || needs_tip)
+ {
+ LLInspector::Params p;
+ p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
+ p.message(tooltip_msg);
+ p.image.name("Inspector_I");
+ p.click_callback(boost::bind(showObjectInspector, hover_object->getID(), mHoverPick.mObjectFace));
+ p.time_based_media(is_time_based_media);
+ p.web_based_media(is_web_based_media);
+ p.media_playing(is_media_playing);
+ p.click_playmedia_callback(boost::bind(playCurrentMedia, mHoverPick));
+ p.click_homepage_callback(boost::bind(VisitHomePage, mHoverPick));
+ p.visible_time_near(6.f);
+ p.visible_time_far(3.f);
+ p.delay_time(gSavedSettings.getF32("ObjectInspectorTooltipDelay"));
+ p.wrap(false);
+
+ LLToolTipMgr::instance().show(p);
+ }
+ }
+ }
+
+ return TRUE;
}
BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask)
{
- static LLCachedControl<bool> show_hover_tips(*LLUI::getInstance()->mSettingGroups["config"], "ShowHoverTips", true);
- if (!show_hover_tips) return TRUE;
- if (!mHoverPick.isValid()) return TRUE;
-
- LLViewerObject* hover_object = mHoverPick.getObject();
-
- // update hover object and hover parcel
- LLSelectMgr::getInstance()->setHoverObject(hover_object, mHoverPick.mObjectFace);
-
-
- std::string tooltip_msg;
- std::string line;
-
- if ( hover_object )
- {
- handleTooltipObject(hover_object, line, tooltip_msg );
- }
- else if (mHoverPick.mPickType == LLPickInfo::PICK_LAND)
- {
- handleTooltipLand(line, tooltip_msg);
- }
-
- return TRUE;
+ static LLCachedControl<bool> show_hover_tips(*LLUI::getInstance()->mSettingGroups["config"], "ShowHoverTips", true);
+ if (!show_hover_tips) return TRUE;
+ if (!mHoverPick.isValid()) return TRUE;
+
+ LLViewerObject* hover_object = mHoverPick.getObject();
+
+ // update hover object and hover parcel
+ LLSelectMgr::getInstance()->setHoverObject(hover_object, mHoverPick.mObjectFace);
+
+
+ std::string tooltip_msg;
+ std::string line;
+
+ if ( hover_object )
+ {
+ handleTooltipObject(hover_object, line, tooltip_msg );
+ }
+ else if (mHoverPick.mPickType == LLPickInfo::PICK_LAND)
+ {
+ handleTooltipLand(line, tooltip_msg);
+ }
+
+ return TRUE;
}
static void show_inspector(const char* inspector, const char* param, const LLUUID& source_id)
{
- LLSD params;
- params[param] = source_id;
- if (LLToolTipMgr::instance().toolTipVisible())
- {
- LLRect rect = LLToolTipMgr::instance().getToolTipRect();
- params["pos"]["x"] = rect.mLeft;
- params["pos"]["y"] = rect.mTop;
- }
-
- LLFloaterReg::showInstance(inspector, params);
+ LLSD params;
+ params[param] = source_id;
+ if (LLToolTipMgr::instance().toolTipVisible())
+ {
+ LLRect rect = LLToolTipMgr::instance().getToolTipRect();
+ params["pos"]["x"] = rect.mLeft;
+ params["pos"]["y"] = rect.mTop;
+ }
+
+ LLFloaterReg::showInstance(inspector, params);
}
static void show_inspector(const char* inspector, LLSD& params)
{
- if (LLToolTipMgr::instance().toolTipVisible())
- {
- LLRect rect = LLToolTipMgr::instance().getToolTipRect();
- params["pos"]["x"] = rect.mLeft;
- params["pos"]["y"] = rect.mTop;
- }
-
- LLFloaterReg::showInstance(inspector, params);
+ if (LLToolTipMgr::instance().toolTipVisible())
+ {
+ LLRect rect = LLToolTipMgr::instance().getToolTipRect();
+ params["pos"]["x"] = rect.mLeft;
+ params["pos"]["y"] = rect.mTop;
+ }
+
+ LLFloaterReg::showInstance(inspector, params);
}
// static
void LLToolPie::showAvatarInspector(const LLUUID& avatar_id)
{
- show_inspector("inspect_avatar", "avatar_id", avatar_id);
+ show_inspector("inspect_avatar", "avatar_id", avatar_id);
}
// static
void LLToolPie::showObjectInspector(const LLUUID& object_id)
{
- show_inspector("inspect_object", "object_id", object_id);
+ show_inspector("inspect_object", "object_id", object_id);
}
// static
void LLToolPie::showObjectInspector(const LLUUID& object_id, const S32& object_face)
{
- LLSD params;
- params["object_id"] = object_id;
- params["object_face"] = object_face;
- show_inspector("inspect_object", params);
+ LLSD params;
+ params["object_id"] = object_id;
+ params["object_face"] = object_face;
+ show_inspector("inspect_object", params);
}
// static
void LLToolPie::playCurrentMedia(const LLPickInfo& info)
{
- //FIXME: how do we handle object in different parcel than us?
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!parcel) return;
-
- LLPointer<LLViewerObject> objectp = info.getObject();
-
- // Early out cases. Must clear media hover.
- // did not hit an object or did not hit a valid face
- if ( objectp.isNull() ||
- info.mObjectFace < 0 ||
- info.mObjectFace >= objectp->getNumTEs() )
- {
- return;
- }
-
- // Does this face have media?
- const LLTextureEntry* tep = objectp->getTE(info.mObjectFace);
- if (!tep)
- return;
-
- const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
- if(!mep)
- return;
-
- //TODO: Can you Use it?
-
- LLPluginClassMedia* media_plugin = NULL;
-
- viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
-
- if(media_impl.notNull() && media_impl->hasMedia())
- {
- media_plugin = media_impl->getMediaPlugin();
- if (media_plugin && media_plugin->pluginSupportsMediaTime())
- {
- if(media_impl->isMediaPlaying())
- {
- media_impl->pause();
- }
- else
- {
- media_impl->play();
- }
- }
- }
+ //FIXME: how do we handle object in different parcel than us?
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!parcel) return;
+
+ LLPointer<LLViewerObject> objectp = info.getObject();
+
+ // Early out cases. Must clear media hover.
+ // did not hit an object or did not hit a valid face
+ if ( objectp.isNull() ||
+ info.mObjectFace < 0 ||
+ info.mObjectFace >= objectp->getNumTEs() )
+ {
+ return;
+ }
+
+ // Does this face have media?
+ const LLTextureEntry* tep = objectp->getTE(info.mObjectFace);
+ if (!tep)
+ return;
+
+ const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
+ if(!mep)
+ return;
+
+ //TODO: Can you Use it?
+
+ LLPluginClassMedia* media_plugin = NULL;
+
+ viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
+
+ if(media_impl.notNull() && media_impl->hasMedia())
+ {
+ media_plugin = media_impl->getMediaPlugin();
+ if (media_plugin && media_plugin->pluginSupportsMediaTime())
+ {
+ if(media_impl->isMediaPlaying())
+ {
+ media_impl->pause();
+ }
+ else
+ {
+ media_impl->play();
+ }
+ }
+ }
}
@@ -1355,148 +1355,148 @@ void LLToolPie::playCurrentMedia(const LLPickInfo& info)
// static
void LLToolPie::VisitHomePage(const LLPickInfo& info)
{
- //FIXME: how do we handle object in different parcel than us?
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!parcel) return;
-
- LLPointer<LLViewerObject> objectp = info.getObject();
-
- // Early out cases. Must clear media hover.
- // did not hit an object or did not hit a valid face
- if ( objectp.isNull() ||
- info.mObjectFace < 0 ||
- info.mObjectFace >= objectp->getNumTEs() )
- {
- return;
- }
-
- // Does this face have media?
- const LLTextureEntry* tep = objectp->getTE(info.mObjectFace);
- if (!tep)
- return;
-
- const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
- if(!mep)
- return;
-
- //TODO: Can you Use it?
-
- LLPluginClassMedia* media_plugin = NULL;
-
- viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
-
- if(media_impl.notNull() && media_impl->hasMedia())
- {
- media_plugin = media_impl->getMediaPlugin();
-
- if (media_plugin && !(media_plugin->pluginSupportsMediaTime()))
- {
- media_impl->navigateHome();
- }
- }
+ //FIXME: how do we handle object in different parcel than us?
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!parcel) return;
+
+ LLPointer<LLViewerObject> objectp = info.getObject();
+
+ // Early out cases. Must clear media hover.
+ // did not hit an object or did not hit a valid face
+ if ( objectp.isNull() ||
+ info.mObjectFace < 0 ||
+ info.mObjectFace >= objectp->getNumTEs() )
+ {
+ return;
+ }
+
+ // Does this face have media?
+ const LLTextureEntry* tep = objectp->getTE(info.mObjectFace);
+ if (!tep)
+ return;
+
+ const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
+ if(!mep)
+ return;
+
+ //TODO: Can you Use it?
+
+ LLPluginClassMedia* media_plugin = NULL;
+
+ viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
+
+ if(media_impl.notNull() && media_impl->hasMedia())
+ {
+ media_plugin = media_impl->getMediaPlugin();
+
+ if (media_plugin && !(media_plugin->pluginSupportsMediaTime()))
+ {
+ media_impl->navigateHome();
+ }
+ }
}
void LLToolPie::handleSelect()
{
- // tool is reselected when app gets focus, etc.
+ // tool is reselected when app gets focus, etc.
}
void LLToolPie::handleDeselect()
{
- if( hasMouseCapture() )
- {
- setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
- }
- // remove temporary selection for pie menu
- LLSelectMgr::getInstance()->setHoverObject(NULL);
-
- // Menu may be still up during transfer to different tool.
- // toolfocus and toolgrab should retain menu, they will clear it if needed
- MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0;
- if (gMenuHolder && (!gMenuHolder->getVisible() || (override_mask & (MASK_ALT | MASK_CONTROL)) == 0))
- {
- // in most cases menu is useless without correct selection, so either keep both or discard both
- gMenuHolder->hideMenus();
- LLSelectMgr::getInstance()->validateSelection();
- }
+ if( hasMouseCapture() )
+ {
+ setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
+ }
+ // remove temporary selection for pie menu
+ LLSelectMgr::getInstance()->setHoverObject(NULL);
+
+ // Menu may be still up during transfer to different tool.
+ // toolfocus and toolgrab should retain menu, they will clear it if needed
+ MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0;
+ if (gMenuHolder && (!gMenuHolder->getVisible() || (override_mask & (MASK_ALT | MASK_CONTROL)) == 0))
+ {
+ // in most cases menu is useless without correct selection, so either keep both or discard both
+ gMenuHolder->hideMenus();
+ LLSelectMgr::getInstance()->validateSelection();
+ }
}
LLTool* LLToolPie::getOverrideTool(MASK mask)
{
- if (gSavedSettings.getBOOL("EnableGrab"))
- {
- if (mask == DEFAULT_GRAB_MASK)
- {
- return LLToolGrab::getInstance();
- }
- else if (mask == (MASK_CONTROL | MASK_SHIFT))
- {
- return LLToolGrab::getInstance();
- }
- }
- return LLTool::getOverrideTool(mask);
+ if (gSavedSettings.getBOOL("EnableGrab"))
+ {
+ if (mask == DEFAULT_GRAB_MASK)
+ {
+ return LLToolGrab::getInstance();
+ }
+ else if (mask == (MASK_CONTROL | MASK_SHIFT))
+ {
+ return LLToolGrab::getInstance();
+ }
+ }
+ return LLTool::getOverrideTool(mask);
}
void LLToolPie::stopEditing()
{
- if( hasMouseCapture() )
- {
- setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
- }
+ if( hasMouseCapture() )
+ {
+ setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
+ }
}
void LLToolPie::onMouseCaptureLost()
{
- stopCameraSteering();
- mMouseButtonDown = false;
- handleMediaMouseUp();
+ stopCameraSteering();
+ mMouseButtonDown = false;
+ handleMediaMouseUp();
}
void LLToolPie::stopCameraSteering()
{
- mMouseOutsideSlop = false;
+ mMouseOutsideSlop = false;
}
bool LLToolPie::inCameraSteerMode()
{
- return mMouseButtonDown && mMouseOutsideSlop;
+ return mMouseButtonDown && mMouseOutsideSlop;
}
// true if x,y outside small box around start_x,start_y
BOOL LLToolPie::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y)
{
- S32 dx = x - start_x;
- S32 dy = y - start_y;
+ S32 dx = x - start_x;
+ S32 dy = y - start_y;
- return (dx <= -2 || 2 <= dx || dy <= -2 || 2 <= dy);
+ return (dx <= -2 || 2 <= dx || dy <= -2 || 2 <= dy);
}
void LLToolPie::render()
{
- return;
+ return;
}
static void handle_click_action_play()
{
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!parcel) return;
-
- LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getInstance()->getStatus();
- switch(status)
- {
- case LLViewerMediaImpl::MEDIA_PLAYING:
- LLViewerParcelMedia::getInstance()->pause();
- break;
-
- case LLViewerMediaImpl::MEDIA_PAUSED:
- LLViewerParcelMedia::getInstance()->start();
- break;
-
- default:
- LLViewerParcelMedia::getInstance()->play(parcel);
- break;
- }
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!parcel) return;
+
+ LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getInstance()->getStatus();
+ switch(status)
+ {
+ case LLViewerMediaImpl::MEDIA_PLAYING:
+ LLViewerParcelMedia::getInstance()->pause();
+ break;
+
+ case LLViewerMediaImpl::MEDIA_PAUSED:
+ LLViewerParcelMedia::getInstance()->start();
+ break;
+
+ default:
+ LLViewerParcelMedia::getInstance()->play(parcel);
+ break;
+ }
}
bool LLToolPie::handleMediaClick(const LLPickInfo& pick)
@@ -1609,427 +1609,427 @@ bool LLToolPie::handleMediaDblClick(const LLPickInfo& pick)
bool LLToolPie::handleMediaHover(const LLPickInfo& pick)
{
- //FIXME: how do we handle object in different parcel than us?
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!parcel) return false;
-
- LLPointer<LLViewerObject> objectp = pick.getObject();
-
- // Early out cases. Must clear media hover.
- // did not hit an object or did not hit a valid face
- if ( objectp.isNull() ||
- pick.mObjectFace < 0 ||
- pick.mObjectFace >= objectp->getNumTEs() )
- {
- LLViewerMediaFocus::getInstance()->clearHover();
- return false;
- }
-
- // Does this face have media?
- const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace);
- if(!tep)
- return false;
-
- const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
- if (mep
- && gSavedSettings.getBOOL("MediaOnAPrimUI"))
- {
- viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
-
- if(media_impl.notNull())
- {
- // Update media hover object
- if (!LLViewerMediaFocus::getInstance()->isHoveringOverFace(objectp, pick.mObjectFace))
- {
- LLViewerMediaFocus::getInstance()->setHoverFace(objectp, pick.mObjectFace, media_impl, pick.mNormal);
- }
-
- // If this is the focused media face, send mouse move events.
- if (LLViewerMediaFocus::getInstance()->isFocusedOnFace(objectp, pick.mObjectFace))
- {
- media_impl->mouseMove(pick.mUVCoords, gKeyboard->currentMask(TRUE));
- gViewerWindow->setCursor(media_impl->getLastSetCursor());
- }
- else
- {
- // This is not the focused face -- set the default cursor.
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- }
-
- return true;
- }
- }
-
- // In all other cases, clear media hover.
- LLViewerMediaFocus::getInstance()->clearHover();
-
- return false;
+ //FIXME: how do we handle object in different parcel than us?
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!parcel) return false;
+
+ LLPointer<LLViewerObject> objectp = pick.getObject();
+
+ // Early out cases. Must clear media hover.
+ // did not hit an object or did not hit a valid face
+ if ( objectp.isNull() ||
+ pick.mObjectFace < 0 ||
+ pick.mObjectFace >= objectp->getNumTEs() )
+ {
+ LLViewerMediaFocus::getInstance()->clearHover();
+ return false;
+ }
+
+ // Does this face have media?
+ const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace);
+ if(!tep)
+ return false;
+
+ const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
+ if (mep
+ && gSavedSettings.getBOOL("MediaOnAPrimUI"))
+ {
+ viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID());
+
+ if(media_impl.notNull())
+ {
+ // Update media hover object
+ if (!LLViewerMediaFocus::getInstance()->isHoveringOverFace(objectp, pick.mObjectFace))
+ {
+ LLViewerMediaFocus::getInstance()->setHoverFace(objectp, pick.mObjectFace, media_impl, pick.mNormal);
+ }
+
+ // If this is the focused media face, send mouse move events.
+ if (LLViewerMediaFocus::getInstance()->isFocusedOnFace(objectp, pick.mObjectFace))
+ {
+ media_impl->mouseMove(pick.mUVCoords, gKeyboard->currentMask(TRUE));
+ gViewerWindow->setCursor(media_impl->getLastSetCursor());
+ }
+ else
+ {
+ // This is not the focused face -- set the default cursor.
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ }
+
+ return true;
+ }
+ }
+
+ // In all other cases, clear media hover.
+ LLViewerMediaFocus::getInstance()->clearHover();
+
+ return false;
}
bool LLToolPie::handleMediaMouseUp()
{
- bool result = false;
- if(mMediaMouseCaptureID.notNull())
- {
- // Face media needs to know the mouse went up.
- viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mMediaMouseCaptureID);
- if(media_impl)
- {
- // This will send a mouseUp event to the plugin using the last known mouse coordinate (from a mouseDown or mouseMove), which is what we want.
- media_impl->onMouseCaptureLost();
- }
-
- mMediaMouseCaptureID.setNull();
-
- result = true;
- }
-
- return result;
+ bool result = false;
+ if(mMediaMouseCaptureID.notNull())
+ {
+ // Face media needs to know the mouse went up.
+ viewer_media_t media_impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mMediaMouseCaptureID);
+ if(media_impl)
+ {
+ // This will send a mouseUp event to the plugin using the last known mouse coordinate (from a mouseDown or mouseMove), which is what we want.
+ media_impl->onMouseCaptureLost();
+ }
+
+ mMediaMouseCaptureID.setNull();
+
+ result = true;
+ }
+
+ return result;
}
static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp)
{
- //FIXME: how do we handle object in different parcel than us?
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!parcel) return;
-
- // did we hit an object?
- if (objectp.isNull()) return;
-
- // did we hit a valid face on the object?
- S32 face = LLToolPie::getInstance()->getPick().mObjectFace;
- if( face < 0 || face >= objectp->getNumTEs() ) return;
-
- // is media playing on this face?
- if (LLViewerMedia::getInstance()->getMediaImplFromTextureID(objectp->getTE(face)->getID()) != NULL)
- {
- handle_click_action_play();
- return;
- }
-
- std::string media_url = std::string ( parcel->getMediaURL () );
- std::string media_type = std::string ( parcel->getMediaType() );
- LLStringUtil::trim(media_url);
-
- LLWeb::loadURL(media_url);
+ //FIXME: how do we handle object in different parcel than us?
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!parcel) return;
+
+ // did we hit an object?
+ if (objectp.isNull()) return;
+
+ // did we hit a valid face on the object?
+ S32 face = LLToolPie::getInstance()->getPick().mObjectFace;
+ if( face < 0 || face >= objectp->getNumTEs() ) return;
+
+ // is media playing on this face?
+ if (LLViewerMedia::getInstance()->getMediaImplFromTextureID(objectp->getTE(face)->getID()) != NULL)
+ {
+ handle_click_action_play();
+ return;
+ }
+
+ std::string media_url = std::string ( parcel->getMediaURL () );
+ std::string media_type = std::string ( parcel->getMediaType() );
+ LLStringUtil::trim(media_url);
+
+ LLWeb::loadURL(media_url);
}
static ECursorType cursor_from_parcel_media(U8 click_action)
{
- // HACK: This is directly referencing an impl name. BAD!
- // This can be removed when we have a truly generic media browser that only
- // builds an impl based on the type of url it is passed.
-
- //FIXME: how do we handle object in different parcel than us?
- ECursorType open_cursor = UI_CURSOR_ARROW;
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (!parcel) return open_cursor;
-
- std::string media_url = std::string ( parcel->getMediaURL () );
- std::string media_type = std::string ( parcel->getMediaType() );
- LLStringUtil::trim(media_url);
-
- open_cursor = UI_CURSOR_TOOLMEDIAOPEN;
-
- LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getInstance()->getStatus();
- switch(status)
- {
- case LLViewerMediaImpl::MEDIA_PLAYING:
- return click_action == CLICK_ACTION_PLAY ? UI_CURSOR_TOOLPAUSE : open_cursor;
- default:
- return UI_CURSOR_TOOLPLAY;
- }
+ // HACK: This is directly referencing an impl name. BAD!
+ // This can be removed when we have a truly generic media browser that only
+ // builds an impl based on the type of url it is passed.
+
+ //FIXME: how do we handle object in different parcel than us?
+ ECursorType open_cursor = UI_CURSOR_ARROW;
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!parcel) return open_cursor;
+
+ std::string media_url = std::string ( parcel->getMediaURL () );
+ std::string media_type = std::string ( parcel->getMediaType() );
+ LLStringUtil::trim(media_url);
+
+ open_cursor = UI_CURSOR_TOOLMEDIAOPEN;
+
+ LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getInstance()->getStatus();
+ switch(status)
+ {
+ case LLViewerMediaImpl::MEDIA_PLAYING:
+ return click_action == CLICK_ACTION_PLAY ? UI_CURSOR_TOOLPAUSE : open_cursor;
+ default:
+ return UI_CURSOR_TOOLPLAY;
+ }
}
// True if we handled the event.
BOOL LLToolPie::handleRightClickPick()
{
- S32 x = mPick.mMousePt.mX;
- S32 y = mPick.mMousePt.mY;
- MASK mask = mPick.mKeyMask;
-
- if (mPick.mPickType != LLPickInfo::PICK_LAND)
- {
- LLViewerParcelMgr::getInstance()->deselectLand();
- }
-
- // didn't click in any UI object, so must have clicked in the world
- LLViewerObject *object = mPick.getObject();
-
- // Can't ignore children here.
- LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
-
- // Spawn pie menu
- if (mPick.mPickType == LLPickInfo::PICK_LAND)
- {
- LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal );
- gMenuHolder->setParcelSelection(selection);
- gMenuLand->show(x, y);
-
- showVisualContextMenuEffect();
-
- }
- else if (mPick.mObjectID == gAgent.getID() )
- {
- if(!gMenuAvatarSelf)
- {
- //either at very early startup stage or at late quitting stage,
- //this event is ignored.
- return TRUE ;
- }
-
- gMenuAvatarSelf->show(x, y);
- }
- else if (object)
- {
- gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
-
- bool is_other_attachment = (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner());
- if (object->isAvatar() || is_other_attachment)
- {
- // Find the attachment's avatar
- while( object && object->isAttachment())
- {
- object = (LLViewerObject*)object->getParent();
- llassert(object);
- }
-
- if (!object)
- {
- return TRUE; // unexpected, but escape
- }
-
- // Object is an avatar, so check for mute by id.
- LLVOAvatar* avatar = (LLVOAvatar*)object;
- std::string name = avatar->getFullname();
- std::string mute_msg;
- if (LLMuteList::getInstance()->isMuted(avatar->getID(), avatar->getFullname()))
- {
- mute_msg = LLTrans::getString("UnmuteAvatar");
- }
- else
- {
- mute_msg = LLTrans::getString("MuteAvatar");
- }
-
- if (is_other_attachment)
- {
- gMenuAttachmentOther->getChild<LLUICtrl>("Avatar Mute")->setValue(mute_msg);
- gMenuAttachmentOther->show(x, y);
- }
- else
- {
- gMenuAvatarOther->getChild<LLUICtrl>("Avatar Mute")->setValue(mute_msg);
- gMenuAvatarOther->show(x, y);
- }
- }
- else if (object->isAttachment())
- {
- gMenuAttachmentSelf->show(x, y);
- }
- else
- {
- // BUG: What about chatting child objects?
- std::string name;
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (node)
- {
- name = node->mName;
- }
-
- gMenuObject->show(x, y);
-
- showVisualContextMenuEffect();
- }
- }
- else if (mPick.mParticleOwnerID.notNull())
- {
- if (gMenuMuteParticle && mPick.mParticleOwnerID != gAgent.getID())
- {
- gMenuMuteParticle->show(x,y);
- }
- }
-
- // non UI object - put focus back "in world"
- if (gFocusMgr.getKeyboardFocus())
- {
- gFocusMgr.setKeyboardFocus(NULL);
- }
-
- LLTool::handleRightMouseDown(x, y, mask);
- // We handled the event.
- return TRUE;
+ S32 x = mPick.mMousePt.mX;
+ S32 y = mPick.mMousePt.mY;
+ MASK mask = mPick.mKeyMask;
+
+ if (mPick.mPickType != LLPickInfo::PICK_LAND)
+ {
+ LLViewerParcelMgr::getInstance()->deselectLand();
+ }
+
+ // didn't click in any UI object, so must have clicked in the world
+ LLViewerObject *object = mPick.getObject();
+
+ // Can't ignore children here.
+ LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
+
+ // Spawn pie menu
+ if (mPick.mPickType == LLPickInfo::PICK_LAND)
+ {
+ LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal );
+ gMenuHolder->setParcelSelection(selection);
+ gMenuLand->show(x, y);
+
+ showVisualContextMenuEffect();
+
+ }
+ else if (mPick.mObjectID == gAgent.getID() )
+ {
+ if(!gMenuAvatarSelf)
+ {
+ //either at very early startup stage or at late quitting stage,
+ //this event is ignored.
+ return TRUE ;
+ }
+
+ gMenuAvatarSelf->show(x, y);
+ }
+ else if (object)
+ {
+ gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
+
+ bool is_other_attachment = (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner());
+ if (object->isAvatar() || is_other_attachment)
+ {
+ // Find the attachment's avatar
+ while( object && object->isAttachment())
+ {
+ object = (LLViewerObject*)object->getParent();
+ llassert(object);
+ }
+
+ if (!object)
+ {
+ return TRUE; // unexpected, but escape
+ }
+
+ // Object is an avatar, so check for mute by id.
+ LLVOAvatar* avatar = (LLVOAvatar*)object;
+ std::string name = avatar->getFullname();
+ std::string mute_msg;
+ if (LLMuteList::getInstance()->isMuted(avatar->getID(), avatar->getFullname()))
+ {
+ mute_msg = LLTrans::getString("UnmuteAvatar");
+ }
+ else
+ {
+ mute_msg = LLTrans::getString("MuteAvatar");
+ }
+
+ if (is_other_attachment)
+ {
+ gMenuAttachmentOther->getChild<LLUICtrl>("Avatar Mute")->setValue(mute_msg);
+ gMenuAttachmentOther->show(x, y);
+ }
+ else
+ {
+ gMenuAvatarOther->getChild<LLUICtrl>("Avatar Mute")->setValue(mute_msg);
+ gMenuAvatarOther->show(x, y);
+ }
+ }
+ else if (object->isAttachment())
+ {
+ gMenuAttachmentSelf->show(x, y);
+ }
+ else
+ {
+ // BUG: What about chatting child objects?
+ std::string name;
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if (node)
+ {
+ name = node->mName;
+ }
+
+ gMenuObject->show(x, y);
+
+ showVisualContextMenuEffect();
+ }
+ }
+ else if (mPick.mParticleOwnerID.notNull())
+ {
+ if (gMenuMuteParticle && mPick.mParticleOwnerID != gAgent.getID())
+ {
+ gMenuMuteParticle->show(x,y);
+ }
+ }
+
+ // non UI object - put focus back "in world"
+ if (gFocusMgr.getKeyboardFocus())
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+
+ LLTool::handleRightMouseDown(x, y, mask);
+ // We handled the event.
+ return TRUE;
}
void LLToolPie::showVisualContextMenuEffect()
{
- // VEFFECT: ShowPie
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
- effectp->setPositionGlobal(mPick.mPosGlobal);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- effectp->setDuration(0.25f);
+ // VEFFECT: ShowPie
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
+ effectp->setPositionGlobal(mPick.mPosGlobal);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ effectp->setDuration(0.25f);
}
typedef enum e_near_far
{
- NEAR_INTERSECTION,
- FAR_INTERSECTION
+ NEAR_INTERSECTION,
+ FAR_INTERSECTION
} ENearFar;
bool intersect_ray_with_sphere( const LLVector3& ray_pt, const LLVector3& ray_dir, const LLVector3& sphere_center, F32 sphere_radius, e_near_far near_far, LLVector3& intersection_pt)
{
- // do ray/sphere intersection by solving quadratic equation
- LLVector3 sphere_to_ray_start_vec = ray_pt - sphere_center;
- F32 B = 2.f * ray_dir * sphere_to_ray_start_vec;
- F32 C = sphere_to_ray_start_vec.lengthSquared() - (sphere_radius * sphere_radius);
-
- F32 discriminant = B*B - 4.f*C;
- if (discriminant >= 0.f)
- { // intersection detected, now find closest one
- F32 t0 = (-B - sqrtf(discriminant)) / 2.f;
-
- if (t0 > 0.f && near_far == NEAR_INTERSECTION)
- {
- intersection_pt = ray_pt + ray_dir * t0;
- }
- else
- {
- F32 t1 = (-B + sqrtf(discriminant)) / 2.f;
- intersection_pt = ray_pt + ray_dir * t1;
- }
- return true;
- }
- else
- { // no intersection
- return false;
- }
+ // do ray/sphere intersection by solving quadratic equation
+ LLVector3 sphere_to_ray_start_vec = ray_pt - sphere_center;
+ F32 B = 2.f * ray_dir * sphere_to_ray_start_vec;
+ F32 C = sphere_to_ray_start_vec.lengthSquared() - (sphere_radius * sphere_radius);
+
+ F32 discriminant = B*B - 4.f*C;
+ if (discriminant >= 0.f)
+ { // intersection detected, now find closest one
+ F32 t0 = (-B - sqrtf(discriminant)) / 2.f;
+
+ if (t0 > 0.f && near_far == NEAR_INTERSECTION)
+ {
+ intersection_pt = ray_pt + ray_dir * t0;
+ }
+ else
+ {
+ F32 t1 = (-B + sqrtf(discriminant)) / 2.f;
+ intersection_pt = ray_pt + ray_dir * t1;
+ }
+ return true;
+ }
+ else
+ { // no intersection
+ return false;
+ }
}
void LLToolPie::startCameraSteering()
{
- LLFirstUse::notMoving(false);
- mMouseOutsideSlop = true;
-
- if (gAgentCamera.getFocusOnAvatar())
- {
- mSteerPick = mPick;
-
- // handle special cases of steering picks
- LLViewerObject* avatar_object = mSteerPick.getObject();
-
- // get pointer to avatar
- while (avatar_object && !avatar_object->isAvatar())
- {
- avatar_object = (LLViewerObject*)avatar_object->getParent();
- }
-
- // if clicking on own avatar...
- if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf())
- {
- // ...project pick point a few meters in front of avatar
- mSteerPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * 3.0;
- }
-
- if (!mSteerPick.isValid())
- {
- mSteerPick.mPosGlobal = gAgent.getPosGlobalFromAgent(
- LLViewerCamera::instance().getOrigin() + gViewerWindow->mouseDirectionGlobal(mSteerPick.mMousePt.mX, mSteerPick.mMousePt.mY) * 100.f);
- }
-
- setMouseCapture(TRUE);
-
- mMouseSteerX = mMouseDownX;
- mMouseSteerY = mMouseDownY;
- const LLVector3 camera_to_rotation_center = gAgent.getFrameAgent().getOrigin() - LLViewerCamera::instance().getOrigin();
- const LLVector3 rotation_center_to_pick = gAgent.getPosAgentFromGlobal(mSteerPick.mPosGlobal) - gAgent.getFrameAgent().getOrigin();
-
- mClockwise = camera_to_rotation_center * rotation_center_to_pick < 0.f;
- if (mMouseSteerGrabPoint) { mMouseSteerGrabPoint->markDead(); }
- mMouseSteerGrabPoint = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE);
- mMouseSteerGrabPoint->setPositionGlobal(mSteerPick.mPosGlobal);
- mMouseSteerGrabPoint->setColor(LLColor4U(170, 210, 190));
- mMouseSteerGrabPoint->setPixelSize(5);
- mMouseSteerGrabPoint->setDuration(2.f);
- }
+ LLFirstUse::notMoving(false);
+ mMouseOutsideSlop = true;
+
+ if (gAgentCamera.getFocusOnAvatar())
+ {
+ mSteerPick = mPick;
+
+ // handle special cases of steering picks
+ LLViewerObject* avatar_object = mSteerPick.getObject();
+
+ // get pointer to avatar
+ while (avatar_object && !avatar_object->isAvatar())
+ {
+ avatar_object = (LLViewerObject*)avatar_object->getParent();
+ }
+
+ // if clicking on own avatar...
+ if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf())
+ {
+ // ...project pick point a few meters in front of avatar
+ mSteerPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * 3.0;
+ }
+
+ if (!mSteerPick.isValid())
+ {
+ mSteerPick.mPosGlobal = gAgent.getPosGlobalFromAgent(
+ LLViewerCamera::instance().getOrigin() + gViewerWindow->mouseDirectionGlobal(mSteerPick.mMousePt.mX, mSteerPick.mMousePt.mY) * 100.f);
+ }
+
+ setMouseCapture(TRUE);
+
+ mMouseSteerX = mMouseDownX;
+ mMouseSteerY = mMouseDownY;
+ const LLVector3 camera_to_rotation_center = gAgent.getFrameAgent().getOrigin() - LLViewerCamera::instance().getOrigin();
+ const LLVector3 rotation_center_to_pick = gAgent.getPosAgentFromGlobal(mSteerPick.mPosGlobal) - gAgent.getFrameAgent().getOrigin();
+
+ mClockwise = camera_to_rotation_center * rotation_center_to_pick < 0.f;
+ if (mMouseSteerGrabPoint) { mMouseSteerGrabPoint->markDead(); }
+ mMouseSteerGrabPoint = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE);
+ mMouseSteerGrabPoint->setPositionGlobal(mSteerPick.mPosGlobal);
+ mMouseSteerGrabPoint->setColor(LLColor4U(170, 210, 190));
+ mMouseSteerGrabPoint->setPixelSize(5);
+ mMouseSteerGrabPoint->setDuration(2.f);
+ }
}
void LLToolPie::steerCameraWithMouse(S32 x, S32 y)
{
- const LLViewerCamera& camera = LLViewerCamera::instance();
- const LLCoordFrame& rotation_frame = gAgent.getFrameAgent();
- const LLVector3 pick_pos = gAgent.getPosAgentFromGlobal(mSteerPick.mPosGlobal);
- const LLVector3 pick_rotation_center = rotation_frame.getOrigin() + parallel_component(pick_pos - rotation_frame.getOrigin(), rotation_frame.getUpAxis());
- const F32 MIN_ROTATION_RADIUS_FRACTION = 0.2f;
- const F32 min_rotation_radius = MIN_ROTATION_RADIUS_FRACTION * dist_vec(pick_rotation_center, camera.getOrigin());;
- const F32 pick_distance_from_rotation_center = llclamp(dist_vec(pick_pos, pick_rotation_center), min_rotation_radius, F32_MAX);
- const LLVector3 camera_to_rotation_center = pick_rotation_center - camera.getOrigin();
- const LLVector3 adjusted_camera_pos = LLViewerCamera::instance().getOrigin() + projected_vec(camera_to_rotation_center, rotation_frame.getUpAxis());
- const F32 camera_distance_from_rotation_center = dist_vec(adjusted_camera_pos, pick_rotation_center);
-
- LLVector3 mouse_ray = orthogonal_component(gViewerWindow->mouseDirectionGlobal(x, y), rotation_frame.getUpAxis());
- mouse_ray.normalize();
-
- LLVector3 old_mouse_ray = orthogonal_component(gViewerWindow->mouseDirectionGlobal(mMouseSteerX, mMouseSteerY), rotation_frame.getUpAxis());
- old_mouse_ray.normalize();
-
- F32 yaw_angle;
- F32 old_yaw_angle;
- LLVector3 mouse_on_sphere;
- LLVector3 old_mouse_on_sphere;
-
- if (intersect_ray_with_sphere(
- adjusted_camera_pos,
- mouse_ray,
- pick_rotation_center,
- pick_distance_from_rotation_center,
- FAR_INTERSECTION,
- mouse_on_sphere))
- {
- LLVector3 mouse_sphere_offset = mouse_on_sphere - pick_rotation_center;
- yaw_angle = atan2f(mouse_sphere_offset * rotation_frame.getLeftAxis(), mouse_sphere_offset * rotation_frame.getAtAxis());
- }
- else
- {
- yaw_angle = F_PI_BY_TWO + asinf(pick_distance_from_rotation_center / camera_distance_from_rotation_center);
- if (mouse_ray * rotation_frame.getLeftAxis() < 0.f)
- {
- yaw_angle *= -1.f;
- }
- }
-
- if (intersect_ray_with_sphere(
- adjusted_camera_pos,
- old_mouse_ray,
- pick_rotation_center,
- pick_distance_from_rotation_center,
- FAR_INTERSECTION,
- old_mouse_on_sphere))
- {
- LLVector3 mouse_sphere_offset = old_mouse_on_sphere - pick_rotation_center;
- old_yaw_angle = atan2f(mouse_sphere_offset * rotation_frame.getLeftAxis(), mouse_sphere_offset * rotation_frame.getAtAxis());
- }
- else
- {
- old_yaw_angle = F_PI_BY_TWO + asinf(pick_distance_from_rotation_center / camera_distance_from_rotation_center);
-
- if (mouse_ray * rotation_frame.getLeftAxis() < 0.f)
- {
- old_yaw_angle *= -1.f;
- }
- }
-
- const F32 delta_angle = yaw_angle - old_yaw_angle;
-
- if (mClockwise)
- {
- gAgent.yaw(delta_angle);
- }
- else
- {
- gAgent.yaw(-delta_angle);
- }
-
- mMouseSteerX = x;
- mMouseSteerY = y;
+ const LLViewerCamera& camera = LLViewerCamera::instance();
+ const LLCoordFrame& rotation_frame = gAgent.getFrameAgent();
+ const LLVector3 pick_pos = gAgent.getPosAgentFromGlobal(mSteerPick.mPosGlobal);
+ const LLVector3 pick_rotation_center = rotation_frame.getOrigin() + parallel_component(pick_pos - rotation_frame.getOrigin(), rotation_frame.getUpAxis());
+ const F32 MIN_ROTATION_RADIUS_FRACTION = 0.2f;
+ const F32 min_rotation_radius = MIN_ROTATION_RADIUS_FRACTION * dist_vec(pick_rotation_center, camera.getOrigin());;
+ const F32 pick_distance_from_rotation_center = llclamp(dist_vec(pick_pos, pick_rotation_center), min_rotation_radius, F32_MAX);
+ const LLVector3 camera_to_rotation_center = pick_rotation_center - camera.getOrigin();
+ const LLVector3 adjusted_camera_pos = LLViewerCamera::instance().getOrigin() + projected_vec(camera_to_rotation_center, rotation_frame.getUpAxis());
+ const F32 camera_distance_from_rotation_center = dist_vec(adjusted_camera_pos, pick_rotation_center);
+
+ LLVector3 mouse_ray = orthogonal_component(gViewerWindow->mouseDirectionGlobal(x, y), rotation_frame.getUpAxis());
+ mouse_ray.normalize();
+
+ LLVector3 old_mouse_ray = orthogonal_component(gViewerWindow->mouseDirectionGlobal(mMouseSteerX, mMouseSteerY), rotation_frame.getUpAxis());
+ old_mouse_ray.normalize();
+
+ F32 yaw_angle;
+ F32 old_yaw_angle;
+ LLVector3 mouse_on_sphere;
+ LLVector3 old_mouse_on_sphere;
+
+ if (intersect_ray_with_sphere(
+ adjusted_camera_pos,
+ mouse_ray,
+ pick_rotation_center,
+ pick_distance_from_rotation_center,
+ FAR_INTERSECTION,
+ mouse_on_sphere))
+ {
+ LLVector3 mouse_sphere_offset = mouse_on_sphere - pick_rotation_center;
+ yaw_angle = atan2f(mouse_sphere_offset * rotation_frame.getLeftAxis(), mouse_sphere_offset * rotation_frame.getAtAxis());
+ }
+ else
+ {
+ yaw_angle = F_PI_BY_TWO + asinf(pick_distance_from_rotation_center / camera_distance_from_rotation_center);
+ if (mouse_ray * rotation_frame.getLeftAxis() < 0.f)
+ {
+ yaw_angle *= -1.f;
+ }
+ }
+
+ if (intersect_ray_with_sphere(
+ adjusted_camera_pos,
+ old_mouse_ray,
+ pick_rotation_center,
+ pick_distance_from_rotation_center,
+ FAR_INTERSECTION,
+ old_mouse_on_sphere))
+ {
+ LLVector3 mouse_sphere_offset = old_mouse_on_sphere - pick_rotation_center;
+ old_yaw_angle = atan2f(mouse_sphere_offset * rotation_frame.getLeftAxis(), mouse_sphere_offset * rotation_frame.getAtAxis());
+ }
+ else
+ {
+ old_yaw_angle = F_PI_BY_TWO + asinf(pick_distance_from_rotation_center / camera_distance_from_rotation_center);
+
+ if (mouse_ray * rotation_frame.getLeftAxis() < 0.f)
+ {
+ old_yaw_angle *= -1.f;
+ }
+ }
+
+ const F32 delta_angle = yaw_angle - old_yaw_angle;
+
+ if (mClockwise)
+ {
+ gAgent.yaw(delta_angle);
+ }
+ else
+ {
+ gAgent.yaw(-delta_angle);
+ }
+
+ mMouseSteerX = x;
+ mMouseSteerY = y;
}
diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h
index dca0d12cf6..94f87d5b0f 100644
--- a/indra/newview/lltoolpie.h
+++ b/indra/newview/lltoolpie.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolpie.h
* @brief LLToolPie class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,90 +37,90 @@ class LLObjectSelection;
class LLToolPie : public LLTool, public LLSingleton<LLToolPie>
{
- LLSINGLETON(LLToolPie);
- LOG_CLASS(LLToolPie);
+ LLSINGLETON(LLToolPie);
+ LOG_CLASS(LLToolPie);
public:
- // Virtual functions inherited from LLMouseHandler
- virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) override;
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- BOOL handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y);
- virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override;
- virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) override;
- virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override;
-
- virtual void render() override;
-
- virtual void stopEditing() override;
-
- virtual void onMouseCaptureLost() override;
- virtual void handleSelect() override;
- virtual void handleDeselect() override;
- virtual LLTool* getOverrideTool(MASK mask) override;
-
- LLPickInfo& getPick() { return mPick; }
- U8 getClickAction() { return mClickAction; }
- LLViewerObject* getClickActionObject() { return mClickActionObject; }
- LLObjectSelection* getLeftClickSelection() { return (LLObjectSelection*)mLeftClickSelection; }
- void resetSelection();
- bool walkToClickedLocation();
- bool teleportToClickedLocation();
- void stopClickToWalk();
-
- static void selectionPropertiesReceived();
-
- static void showAvatarInspector(const LLUUID& avatar_id);
- static void showObjectInspector(const LLUUID& object_id);
- static void showObjectInspector(const LLUUID& object_id, const S32& object_face);
- static void playCurrentMedia(const LLPickInfo& info);
- static void VisitHomePage(const LLPickInfo& info);
-
+ // Virtual functions inherited from LLMouseHandler
+ virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) override;
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ BOOL handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y);
+ virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override;
+ virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) override;
+ virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override;
+
+ virtual void render() override;
+
+ virtual void stopEditing() override;
+
+ virtual void onMouseCaptureLost() override;
+ virtual void handleSelect() override;
+ virtual void handleDeselect() override;
+ virtual LLTool* getOverrideTool(MASK mask) override;
+
+ LLPickInfo& getPick() { return mPick; }
+ U8 getClickAction() { return mClickAction; }
+ LLViewerObject* getClickActionObject() { return mClickActionObject; }
+ LLObjectSelection* getLeftClickSelection() { return (LLObjectSelection*)mLeftClickSelection; }
+ void resetSelection();
+ bool walkToClickedLocation();
+ bool teleportToClickedLocation();
+ void stopClickToWalk();
+
+ static void selectionPropertiesReceived();
+
+ static void showAvatarInspector(const LLUUID& avatar_id);
+ static void showObjectInspector(const LLUUID& object_id);
+ static void showObjectInspector(const LLUUID& object_id, const S32& object_face);
+ static void playCurrentMedia(const LLPickInfo& info);
+ static void VisitHomePage(const LLPickInfo& info);
+
private:
- BOOL outsideSlop (S32 x, S32 y, S32 start_x, S32 start_y);
- BOOL handleLeftClickPick();
- BOOL handleRightClickPick();
- BOOL useClickAction (MASK mask, LLViewerObject* object,LLViewerObject* parent);
-
- void showVisualContextMenuEffect();
- ECursorType cursorFromObject(LLViewerObject* object);
-
- bool handleMediaClick(const LLPickInfo& info);
+ BOOL outsideSlop (S32 x, S32 y, S32 start_x, S32 start_y);
+ BOOL handleLeftClickPick();
+ BOOL handleRightClickPick();
+ BOOL useClickAction (MASK mask, LLViewerObject* object,LLViewerObject* parent);
+
+ void showVisualContextMenuEffect();
+ ECursorType cursorFromObject(LLViewerObject* object);
+
+ bool handleMediaClick(const LLPickInfo& info);
bool handleMediaDblClick(const LLPickInfo& info);
bool handleMediaHover(const LLPickInfo& info);
- bool handleMediaMouseUp();
- BOOL handleTooltipLand(std::string line, std::string tooltip_msg);
- BOOL handleTooltipObject( LLViewerObject* hover_object, std::string line, std::string tooltip_msg);
+ bool handleMediaMouseUp();
+ BOOL handleTooltipLand(std::string line, std::string tooltip_msg);
+ BOOL handleTooltipObject( LLViewerObject* hover_object, std::string line, std::string tooltip_msg);
- void steerCameraWithMouse(S32 x, S32 y);
- void startCameraSteering();
- void stopCameraSteering();
- bool inCameraSteerMode();
+ void steerCameraWithMouse(S32 x, S32 y);
+ void startCameraSteering();
+ void stopCameraSteering();
+ bool inCameraSteerMode();
private:
- bool mMouseButtonDown;
- bool mMouseOutsideSlop; // for this drag, has mouse moved outside slop region
- S32 mMouseDownX;
- S32 mMouseDownY;
- S32 mMouseSteerX;
- S32 mMouseSteerY;
- LLPointer<LLHUDEffectBlob> mAutoPilotDestination;
- LLPointer<LLHUDEffectBlob> mMouseSteerGrabPoint;
- bool mClockwise;
- LLUUID mMediaMouseCaptureID;
- LLPickInfo mPick;
- LLPickInfo mHoverPick;
- LLPickInfo mSteerPick;
- LLPointer<LLViewerObject> mClickActionObject;
- U8 mClickAction;
- LLSafeHandle<LLObjectSelection> mLeftClickSelection;
- BOOL mClickActionBuyEnabled;
- BOOL mClickActionPayEnabled;
- LLFrameTimer mDoubleClickTimer;
+ bool mMouseButtonDown;
+ bool mMouseOutsideSlop; // for this drag, has mouse moved outside slop region
+ S32 mMouseDownX;
+ S32 mMouseDownY;
+ S32 mMouseSteerX;
+ S32 mMouseSteerY;
+ LLPointer<LLHUDEffectBlob> mAutoPilotDestination;
+ LLPointer<LLHUDEffectBlob> mMouseSteerGrabPoint;
+ bool mClockwise;
+ LLUUID mMediaMouseCaptureID;
+ LLPickInfo mPick;
+ LLPickInfo mHoverPick;
+ LLPickInfo mSteerPick;
+ LLPointer<LLViewerObject> mClickActionObject;
+ U8 mClickAction;
+ LLSafeHandle<LLObjectSelection> mLeftClickSelection;
+ BOOL mClickActionBuyEnabled;
+ BOOL mClickActionPayEnabled;
+ LLFrameTimer mDoubleClickTimer;
};
#endif
diff --git a/indra/newview/lltoolpipette.cpp b/indra/newview/lltoolpipette.cpp
index ff3dad2675..e1b2352c76 100644
--- a/indra/newview/lltoolpipette.cpp
+++ b/indra/newview/lltoolpipette.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolpipette.cpp
* @brief LLToolPipette class implementation
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,7 +31,7 @@
#include "llviewerprecompiledheaders.h"
// File includes
-#include "lltoolpipette.h"
+#include "lltoolpipette.h"
// Library includes
#include "lltooltip.h"
@@ -47,9 +47,9 @@
//
LLToolPipette::LLToolPipette()
-: LLTool(std::string("Pipette")),
- mSuccess(TRUE)
-{
+: LLTool(std::string("Pipette")),
+ mSuccess(TRUE)
+{
}
@@ -59,78 +59,78 @@ LLToolPipette::~LLToolPipette()
BOOL LLToolPipette::handleMouseDown(S32 x, S32 y, MASK mask)
{
- mSuccess = TRUE;
- mTooltipMsg.clear();
- setMouseCapture(TRUE);
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
- return TRUE;
+ mSuccess = TRUE;
+ mTooltipMsg.clear();
+ setMouseCapture(TRUE);
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ return TRUE;
}
BOOL LLToolPipette::handleMouseUp(S32 x, S32 y, MASK mask)
{
- mSuccess = TRUE;
- LLSelectMgr::getInstance()->unhighlightAll();
- // *NOTE: This assumes the pipette tool is a transient tool.
- LLToolMgr::getInstance()->clearTransientTool();
- setMouseCapture(FALSE);
- return TRUE;
+ mSuccess = TRUE;
+ LLSelectMgr::getInstance()->unhighlightAll();
+ // *NOTE: This assumes the pipette tool is a transient tool.
+ LLToolMgr::getInstance()->clearTransientTool();
+ setMouseCapture(FALSE);
+ return TRUE;
}
BOOL LLToolPipette::handleHover(S32 x, S32 y, MASK mask)
{
- gViewerWindow->setCursor(mSuccess ? UI_CURSOR_PIPETTE : UI_CURSOR_NO);
- if (hasMouseCapture()) // mouse button is down
- {
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
- return TRUE;
- }
- return FALSE;
+ gViewerWindow->setCursor(mSuccess ? UI_CURSOR_PIPETTE : UI_CURSOR_NO);
+ if (hasMouseCapture()) // mouse button is down
+ {
+ gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ return TRUE;
+ }
+ return FALSE;
}
BOOL LLToolPipette::handleToolTip(S32 x, S32 y, MASK mask)
{
- if (mTooltipMsg.empty())
- {
- return FALSE;
- }
-
- LLRect sticky_rect;
- sticky_rect.setCenterAndSize(x, y, 20, 20);
- LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(mTooltipMsg)
- .sticky_rect(sticky_rect));
-
- return TRUE;
+ if (mTooltipMsg.empty())
+ {
+ return FALSE;
+ }
+
+ LLRect sticky_rect;
+ sticky_rect.setCenterAndSize(x, y, 20, 20);
+ LLToolTipMgr::instance().show(LLToolTip::Params()
+ .message(mTooltipMsg)
+ .sticky_rect(sticky_rect));
+
+ return TRUE;
}
void LLToolPipette::setTextureEntry(const LLTextureEntry* entry)
{
- if (entry)
- {
- mTextureEntry = *entry;
- mSignal(mTextureEntry);
- }
+ if (entry)
+ {
+ mTextureEntry = *entry;
+ mSignal(mTextureEntry);
+ }
}
void LLToolPipette::pickCallback(const LLPickInfo& pick_info)
{
- LLViewerObject* hit_obj = pick_info.getObject();
- LLSelectMgr::getInstance()->unhighlightAll();
-
- // if we clicked on a face of a valid prim, save off texture entry data
- if (hit_obj &&
- hit_obj->getPCode() == LL_PCODE_VOLUME &&
- pick_info.mObjectFace != -1)
- {
- //TODO: this should highlight the selected face only
- LLSelectMgr::getInstance()->highlightObjectOnly(hit_obj);
- const LLTextureEntry* entry = hit_obj->getTE(pick_info.mObjectFace);
- LLToolPipette::getInstance()->setTextureEntry(entry);
- }
+ LLViewerObject* hit_obj = pick_info.getObject();
+ LLSelectMgr::getInstance()->unhighlightAll();
+
+ // if we clicked on a face of a valid prim, save off texture entry data
+ if (hit_obj &&
+ hit_obj->getPCode() == LL_PCODE_VOLUME &&
+ pick_info.mObjectFace != -1)
+ {
+ //TODO: this should highlight the selected face only
+ LLSelectMgr::getInstance()->highlightObjectOnly(hit_obj);
+ const LLTextureEntry* entry = hit_obj->getTE(pick_info.mObjectFace);
+ LLToolPipette::getInstance()->setTextureEntry(entry);
+ }
}
void LLToolPipette::setResult(BOOL success, const std::string& msg)
{
- mTooltipMsg = msg;
- mSuccess = success;
+ mTooltipMsg = msg;
+ mSuccess = success;
}
diff --git a/indra/newview/lltoolpipette.h b/indra/newview/lltoolpipette.h
index 2636811c66..44d06f5383 100644
--- a/indra/newview/lltoolpipette.h
+++ b/indra/newview/lltoolpipette.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolpipette.h
* @brief LLToolPipette class header file
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,30 +41,30 @@ class LLViewerObject;
class LLPickInfo;
class LLToolPipette
-: public LLTool, public LLSingleton<LLToolPipette>
+: public LLTool, public LLSingleton<LLToolPipette>
{
- LLSINGLETON(LLToolPipette);
- virtual ~LLToolPipette();
+ LLSINGLETON(LLToolPipette);
+ virtual ~LLToolPipette();
public:
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
- virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override;
+
+ // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots
+ typedef boost::signals2::signal<void (const LLTextureEntry& te)> signal_t;
+ void setToolSelectCallback(const signal_t::slot_type& cb) { mSignal.connect(cb); }
+ void setResult(BOOL success, const std::string& msg);
- // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots
- typedef boost::signals2::signal<void (const LLTextureEntry& te)> signal_t;
- void setToolSelectCallback(const signal_t::slot_type& cb) { mSignal.connect(cb); }
- void setResult(BOOL success, const std::string& msg);
-
- void setTextureEntry(const LLTextureEntry* entry);
- static void pickCallback(const LLPickInfo& pick_info);
+ void setTextureEntry(const LLTextureEntry* entry);
+ static void pickCallback(const LLPickInfo& pick_info);
protected:
- LLTextureEntry mTextureEntry;
- signal_t mSignal;
- BOOL mSuccess;
- std::string mTooltipMsg;
+ LLTextureEntry mTextureEntry;
+ signal_t mSignal;
+ BOOL mSuccess;
+ std::string mTooltipMsg;
};
#endif //LL_LLTOOLPIPETTE_H
diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp
index 7cdd7cc5c8..2519c57e86 100644
--- a/indra/newview/lltoolplacer.cpp
+++ b/indra/newview/lltoolplacer.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolplacer.cpp
* @brief Tool for placing new objects into the world
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -60,474 +60,474 @@
// linden library headers
#include "llprimitive.h"
-#include "llwindow.h" // incBusyCount()
+#include "llwindow.h" // incBusyCount()
#include "material_codes.h"
#include "lluiusage.h"
const LLVector3 DEFAULT_OBJECT_SCALE(0.5f, 0.5f, 0.5f);
-//static
-LLPCode LLToolPlacer::sObjectType = LL_PCODE_CUBE;
+//static
+LLPCode LLToolPlacer::sObjectType = LL_PCODE_CUBE;
LLToolPlacer::LLToolPlacer()
-: LLTool( "Create" )
+: LLTool( "Create" )
{
}
-BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face,
- BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region )
+BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face,
+ BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region )
{
- F32 max_dist_from_camera = gSavedSettings.getF32( "MaxSelectDistance" ) - 1.f;
-
- // Viewer-side pick to find the right sim to create the object on.
- // First find the surface the object will be created on.
- LLPickInfo pick = gViewerWindow->pickImmediate(x, y, FALSE, FALSE);
-
- // Note: use the frontmost non-flora version because (a) plants usually have lots of alpha and (b) pants' Havok
- // representations (if any) are NOT the same as their viewer representation.
- if (pick.mPickType == LLPickInfo::PICK_FLORA)
- {
- *hit_obj = NULL;
- *hit_face = -1;
- }
- else
- {
- *hit_obj = pick.getObject();
- *hit_face = pick.mObjectFace;
- }
- *b_hit_land = !(*hit_obj) && !pick.mPosGlobal.isExactlyZero();
- LLVector3d land_pos_global = pick.mPosGlobal;
-
- // Make sure there's a surface to place the new object on.
- BOOL bypass_sim_raycast = FALSE;
- LLVector3d surface_pos_global;
- if (*b_hit_land)
- {
- surface_pos_global = land_pos_global;
- bypass_sim_raycast = TRUE;
- }
- else
- if (*hit_obj)
- {
- surface_pos_global = (*hit_obj)->getPositionGlobal();
- }
- else
- {
- return FALSE;
- }
-
- // Make sure the surface isn't too far away.
- LLVector3d ray_start_global = gAgentCamera.getCameraPositionGlobal();
- F32 dist_to_surface_sq = (F32)((surface_pos_global - ray_start_global).magVecSquared());
- if( dist_to_surface_sq > (max_dist_from_camera * max_dist_from_camera) )
- {
- return FALSE;
- }
-
- // Find the sim where the surface lives.
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(surface_pos_global);
- if (!regionp)
- {
- LL_WARNS() << "Trying to add object outside of all known regions!" << LL_ENDL;
- return FALSE;
- }
-
- // Find the simulator-side ray that will be used to place the object accurately
- LLVector3d mouse_direction;
- mouse_direction.setVec( gViewerWindow->mouseDirectionGlobal( x, y ) );
-
- *region = regionp;
- *ray_start_region = regionp->getPosRegionFromGlobal( ray_start_global );
- F32 near_clip = LLViewerCamera::getInstance()->getNear() + 0.01f; // Include an epsilon to avoid rounding issues.
- *ray_start_region += LLViewerCamera::getInstance()->getAtAxis() * near_clip;
-
- if( bypass_sim_raycast )
- {
- // Hack to work around Havok's inability to ray cast onto height fields
- *ray_end_region = regionp->getPosRegionFromGlobal( surface_pos_global ); // ray end is the viewer's intersection point
- }
- else
- {
- LLVector3d ray_end_global = ray_start_global + (1.f + max_dist_from_camera) * mouse_direction; // add an epsilon to the sim version of the ray to avoid rounding problems.
- *ray_end_region = regionp->getPosRegionFromGlobal( ray_end_global );
- }
-
- return TRUE;
+ F32 max_dist_from_camera = gSavedSettings.getF32( "MaxSelectDistance" ) - 1.f;
+
+ // Viewer-side pick to find the right sim to create the object on.
+ // First find the surface the object will be created on.
+ LLPickInfo pick = gViewerWindow->pickImmediate(x, y, FALSE, FALSE);
+
+ // Note: use the frontmost non-flora version because (a) plants usually have lots of alpha and (b) pants' Havok
+ // representations (if any) are NOT the same as their viewer representation.
+ if (pick.mPickType == LLPickInfo::PICK_FLORA)
+ {
+ *hit_obj = NULL;
+ *hit_face = -1;
+ }
+ else
+ {
+ *hit_obj = pick.getObject();
+ *hit_face = pick.mObjectFace;
+ }
+ *b_hit_land = !(*hit_obj) && !pick.mPosGlobal.isExactlyZero();
+ LLVector3d land_pos_global = pick.mPosGlobal;
+
+ // Make sure there's a surface to place the new object on.
+ BOOL bypass_sim_raycast = FALSE;
+ LLVector3d surface_pos_global;
+ if (*b_hit_land)
+ {
+ surface_pos_global = land_pos_global;
+ bypass_sim_raycast = TRUE;
+ }
+ else
+ if (*hit_obj)
+ {
+ surface_pos_global = (*hit_obj)->getPositionGlobal();
+ }
+ else
+ {
+ return FALSE;
+ }
+
+ // Make sure the surface isn't too far away.
+ LLVector3d ray_start_global = gAgentCamera.getCameraPositionGlobal();
+ F32 dist_to_surface_sq = (F32)((surface_pos_global - ray_start_global).magVecSquared());
+ if( dist_to_surface_sq > (max_dist_from_camera * max_dist_from_camera) )
+ {
+ return FALSE;
+ }
+
+ // Find the sim where the surface lives.
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(surface_pos_global);
+ if (!regionp)
+ {
+ LL_WARNS() << "Trying to add object outside of all known regions!" << LL_ENDL;
+ return FALSE;
+ }
+
+ // Find the simulator-side ray that will be used to place the object accurately
+ LLVector3d mouse_direction;
+ mouse_direction.setVec( gViewerWindow->mouseDirectionGlobal( x, y ) );
+
+ *region = regionp;
+ *ray_start_region = regionp->getPosRegionFromGlobal( ray_start_global );
+ F32 near_clip = LLViewerCamera::getInstance()->getNear() + 0.01f; // Include an epsilon to avoid rounding issues.
+ *ray_start_region += LLViewerCamera::getInstance()->getAtAxis() * near_clip;
+
+ if( bypass_sim_raycast )
+ {
+ // Hack to work around Havok's inability to ray cast onto height fields
+ *ray_end_region = regionp->getPosRegionFromGlobal( surface_pos_global ); // ray end is the viewer's intersection point
+ }
+ else
+ {
+ LLVector3d ray_end_global = ray_start_global + (1.f + max_dist_from_camera) * mouse_direction; // add an epsilon to the sim version of the ray to avoid rounding problems.
+ *ray_end_region = regionp->getPosRegionFromGlobal( ray_end_global );
+ }
+
+ return TRUE;
}
BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
{
- LLVector3 ray_start_region;
- LLVector3 ray_end_region;
- LLViewerRegion* regionp = NULL;
- BOOL b_hit_land = FALSE;
- S32 hit_face = -1;
- LLViewerObject* hit_obj = NULL;
- U8 state = 0;
- BOOL success = raycastForNewObjPos( x, y, &hit_obj, &hit_face, &b_hit_land, &ray_start_region, &ray_end_region, &regionp );
- if( !success )
- {
- return FALSE;
- }
-
- if( hit_obj && (hit_obj->isAvatar() || hit_obj->isAttachment()) )
- {
- // Can't create objects on avatars or attachments
- return FALSE;
- }
-
- if (NULL == regionp)
- {
- LL_WARNS() << "regionp was NULL; aborting function." << LL_ENDL;
- return FALSE;
- }
-
- if (regionp->getRegionFlag(REGION_FLAGS_SANDBOX))
- {
- //LLFirstUse::useSandbox();
- }
-
- // Set params for new object based on its PCode.
- LLQuaternion rotation;
- LLVector3 scale = DEFAULT_OBJECT_SCALE;
- U8 material = LL_MCODE_WOOD;
- BOOL create_selected = FALSE;
- LLVolumeParams volume_params;
-
- switch (pcode)
- {
- case LL_PCODE_LEGACY_GRASS:
- // Randomize size of grass patch
- scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f), 1.f + ll_frand(2.f));
- state = rand() % LLVOGrass::sMaxGrassSpecies;
- break;
-
-
- case LL_PCODE_LEGACY_TREE:
- case LL_PCODE_TREE_NEW:
- state = rand() % LLVOTree::sMaxTreeSpecies;
- break;
-
- case LL_PCODE_SPHERE:
- case LL_PCODE_CONE:
- case LL_PCODE_CUBE:
- case LL_PCODE_CYLINDER:
- case LL_PCODE_TORUS:
- case LLViewerObject::LL_VO_SQUARE_TORUS:
- case LLViewerObject::LL_VO_TRIANGLE_TORUS:
- default:
- create_selected = TRUE;
- break;
- }
-
- // Play creation sound
- if (gAudiop)
- {
- gAudiop->triggerSound( LLUUID(gSavedSettings.getString("UISndObjectCreate")),
- gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
- }
-
- LLUIUsage::instance().logCommand("Build.ObjectAdd");
- gMessageSystem->newMessageFast(_PREHASH_ObjectAdd);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU8Fast(_PREHASH_Material, material);
-
- U32 flags = 0; // not selected
- if (use_physics)
- {
- flags |= FLAGS_USE_PHYSICS;
- }
- if (create_selected)
- {
- flags |= FLAGS_CREATE_SELECTED;
- }
- gMessageSystem->addU32Fast(_PREHASH_AddFlags, flags );
-
- LLPCode volume_pcode; // ...PCODE_VOLUME, or the original on error
- switch (pcode)
- {
- case LL_PCODE_SPHERE:
- rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
-
- volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 1, 1 );
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_TORUS:
- rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
-
- volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 1.f, 0.25f ); // "top size"
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LLViewerObject::LL_VO_SQUARE_TORUS:
- rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
-
- volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_CIRCLE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 1.f, 0.25f ); // "top size"
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LLViewerObject::LL_VO_TRIANGLE_TORUS:
- rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
-
- volume_params.setType( LL_PCODE_PROFILE_EQUALTRI, LL_PCODE_PATH_CIRCLE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 1.f, 0.25f ); // "top size"
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_SPHERE_HEMI:
- volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE );
- //volume_params.setBeginAndEndS( 0.5f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 0.5f );
- volume_params.setRatio ( 1, 1 );
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_CUBE:
- volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 1, 1 );
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_PRISM:
- volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 0, 1 );
- volume_params.setShear ( -0.5f, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_PYRAMID:
- volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 0, 0 );
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_TETRAHEDRON:
- volume_params.setType( LL_PCODE_PROFILE_EQUALTRI, LL_PCODE_PATH_LINE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 0, 0 );
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_CYLINDER:
- volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 1, 1 );
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_CYLINDER_HEMI:
- volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
- volume_params.setBeginAndEndS( 0.25f, 0.75f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 1, 1 );
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_CONE:
- volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
- volume_params.setBeginAndEndS( 0.f, 1.f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 0, 0 );
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- case LL_PCODE_CONE_HEMI:
- volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
- volume_params.setBeginAndEndS( 0.25f, 0.75f );
- volume_params.setBeginAndEndT( 0.f, 1.f );
- volume_params.setRatio ( 0, 0 );
- volume_params.setShear ( 0, 0 );
- LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
- volume_pcode = LL_PCODE_VOLUME;
- break;
-
- default:
- LLVolumeMessage::packVolumeParams(0, gMessageSystem);
- volume_pcode = pcode;
- break;
- }
- gMessageSystem->addU8Fast(_PREHASH_PCode, volume_pcode);
-
- gMessageSystem->addVector3Fast(_PREHASH_Scale, scale );
- gMessageSystem->addQuatFast(_PREHASH_Rotation, rotation );
- gMessageSystem->addVector3Fast(_PREHASH_RayStart, ray_start_region );
- gMessageSystem->addVector3Fast(_PREHASH_RayEnd, ray_end_region );
- gMessageSystem->addU8Fast(_PREHASH_BypassRaycast, (U8)b_hit_land );
- gMessageSystem->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
- gMessageSystem->addU8Fast(_PREHASH_State, state);
-
- // Limit raycast to a single object.
- // Speeds up server raycast + avoid problems with server ray hitting objects
- // that were clipped by the near plane or culled on the viewer.
- LLUUID ray_target_id;
- if( hit_obj )
- {
- ray_target_id = hit_obj->getID();
- }
- else
- {
- ray_target_id.setNull();
- }
- gMessageSystem->addUUIDFast(_PREHASH_RayTargetID, ray_target_id );
-
- // Pack in name value pairs
- gMessageSystem->sendReliable(regionp->getHost());
-
- // Spawns a message, so must be after above send
- if (create_selected)
- {
- LLSelectMgr::getInstance()->deselectAll();
- gViewerWindow->getWindow()->incBusyCount();
- }
-
- // VEFFECT: AddObject
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject((LLViewerObject*)gAgentAvatarp);
- effectp->setPositionGlobal(regionp->getPosGlobalFromRegion(ray_end_region));
- effectp->setDuration(LL_HUD_DUR_SHORT);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
-
- add(LLStatViewer::OBJECT_CREATE, 1);
-
- return TRUE;
+ LLVector3 ray_start_region;
+ LLVector3 ray_end_region;
+ LLViewerRegion* regionp = NULL;
+ BOOL b_hit_land = FALSE;
+ S32 hit_face = -1;
+ LLViewerObject* hit_obj = NULL;
+ U8 state = 0;
+ BOOL success = raycastForNewObjPos( x, y, &hit_obj, &hit_face, &b_hit_land, &ray_start_region, &ray_end_region, &regionp );
+ if( !success )
+ {
+ return FALSE;
+ }
+
+ if( hit_obj && (hit_obj->isAvatar() || hit_obj->isAttachment()) )
+ {
+ // Can't create objects on avatars or attachments
+ return FALSE;
+ }
+
+ if (NULL == regionp)
+ {
+ LL_WARNS() << "regionp was NULL; aborting function." << LL_ENDL;
+ return FALSE;
+ }
+
+ if (regionp->getRegionFlag(REGION_FLAGS_SANDBOX))
+ {
+ //LLFirstUse::useSandbox();
+ }
+
+ // Set params for new object based on its PCode.
+ LLQuaternion rotation;
+ LLVector3 scale = DEFAULT_OBJECT_SCALE;
+ U8 material = LL_MCODE_WOOD;
+ BOOL create_selected = FALSE;
+ LLVolumeParams volume_params;
+
+ switch (pcode)
+ {
+ case LL_PCODE_LEGACY_GRASS:
+ // Randomize size of grass patch
+ scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f), 1.f + ll_frand(2.f));
+ state = rand() % LLVOGrass::sMaxGrassSpecies;
+ break;
+
+
+ case LL_PCODE_LEGACY_TREE:
+ case LL_PCODE_TREE_NEW:
+ state = rand() % LLVOTree::sMaxTreeSpecies;
+ break;
+
+ case LL_PCODE_SPHERE:
+ case LL_PCODE_CONE:
+ case LL_PCODE_CUBE:
+ case LL_PCODE_CYLINDER:
+ case LL_PCODE_TORUS:
+ case LLViewerObject::LL_VO_SQUARE_TORUS:
+ case LLViewerObject::LL_VO_TRIANGLE_TORUS:
+ default:
+ create_selected = TRUE;
+ break;
+ }
+
+ // Play creation sound
+ if (gAudiop)
+ {
+ gAudiop->triggerSound( LLUUID(gSavedSettings.getString("UISndObjectCreate")),
+ gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
+ }
+
+ LLUIUsage::instance().logCommand("Build.ObjectAdd");
+ gMessageSystem->newMessageFast(_PREHASH_ObjectAdd);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU8Fast(_PREHASH_Material, material);
+
+ U32 flags = 0; // not selected
+ if (use_physics)
+ {
+ flags |= FLAGS_USE_PHYSICS;
+ }
+ if (create_selected)
+ {
+ flags |= FLAGS_CREATE_SELECTED;
+ }
+ gMessageSystem->addU32Fast(_PREHASH_AddFlags, flags );
+
+ LLPCode volume_pcode; // ...PCODE_VOLUME, or the original on error
+ switch (pcode)
+ {
+ case LL_PCODE_SPHERE:
+ rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
+
+ volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 1, 1 );
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_TORUS:
+ rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
+
+ volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 1.f, 0.25f ); // "top size"
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LLViewerObject::LL_VO_SQUARE_TORUS:
+ rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
+
+ volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_CIRCLE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 1.f, 0.25f ); // "top size"
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LLViewerObject::LL_VO_TRIANGLE_TORUS:
+ rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
+
+ volume_params.setType( LL_PCODE_PROFILE_EQUALTRI, LL_PCODE_PATH_CIRCLE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 1.f, 0.25f ); // "top size"
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_SPHERE_HEMI:
+ volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE );
+ //volume_params.setBeginAndEndS( 0.5f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 0.5f );
+ volume_params.setRatio ( 1, 1 );
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_CUBE:
+ volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 1, 1 );
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_PRISM:
+ volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 0, 1 );
+ volume_params.setShear ( -0.5f, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_PYRAMID:
+ volume_params.setType( LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 0, 0 );
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_TETRAHEDRON:
+ volume_params.setType( LL_PCODE_PROFILE_EQUALTRI, LL_PCODE_PATH_LINE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 0, 0 );
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_CYLINDER:
+ volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 1, 1 );
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_CYLINDER_HEMI:
+ volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
+ volume_params.setBeginAndEndS( 0.25f, 0.75f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 1, 1 );
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_CONE:
+ volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
+ volume_params.setBeginAndEndS( 0.f, 1.f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 0, 0 );
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ case LL_PCODE_CONE_HEMI:
+ volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE );
+ volume_params.setBeginAndEndS( 0.25f, 0.75f );
+ volume_params.setBeginAndEndT( 0.f, 1.f );
+ volume_params.setRatio ( 0, 0 );
+ volume_params.setShear ( 0, 0 );
+ LLVolumeMessage::packVolumeParams(&volume_params, gMessageSystem);
+ volume_pcode = LL_PCODE_VOLUME;
+ break;
+
+ default:
+ LLVolumeMessage::packVolumeParams(0, gMessageSystem);
+ volume_pcode = pcode;
+ break;
+ }
+ gMessageSystem->addU8Fast(_PREHASH_PCode, volume_pcode);
+
+ gMessageSystem->addVector3Fast(_PREHASH_Scale, scale );
+ gMessageSystem->addQuatFast(_PREHASH_Rotation, rotation );
+ gMessageSystem->addVector3Fast(_PREHASH_RayStart, ray_start_region );
+ gMessageSystem->addVector3Fast(_PREHASH_RayEnd, ray_end_region );
+ gMessageSystem->addU8Fast(_PREHASH_BypassRaycast, (U8)b_hit_land );
+ gMessageSystem->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
+ gMessageSystem->addU8Fast(_PREHASH_State, state);
+
+ // Limit raycast to a single object.
+ // Speeds up server raycast + avoid problems with server ray hitting objects
+ // that were clipped by the near plane or culled on the viewer.
+ LLUUID ray_target_id;
+ if( hit_obj )
+ {
+ ray_target_id = hit_obj->getID();
+ }
+ else
+ {
+ ray_target_id.setNull();
+ }
+ gMessageSystem->addUUIDFast(_PREHASH_RayTargetID, ray_target_id );
+
+ // Pack in name value pairs
+ gMessageSystem->sendReliable(regionp->getHost());
+
+ // Spawns a message, so must be after above send
+ if (create_selected)
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ gViewerWindow->getWindow()->incBusyCount();
+ }
+
+ // VEFFECT: AddObject
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ effectp->setSourceObject((LLViewerObject*)gAgentAvatarp);
+ effectp->setPositionGlobal(regionp->getPosGlobalFromRegion(ray_end_region));
+ effectp->setDuration(LL_HUD_DUR_SHORT);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+
+ add(LLStatViewer::OBJECT_CREATE, 1);
+
+ return TRUE;
}
// Used by the placer tool to add copies of the current selection.
// Inspired by add_object(). JC
BOOL LLToolPlacer::addDuplicate(S32 x, S32 y)
{
- LLVector3 ray_start_region;
- LLVector3 ray_end_region;
- LLViewerRegion* regionp = NULL;
- BOOL b_hit_land = FALSE;
- S32 hit_face = -1;
- LLViewerObject* hit_obj = NULL;
- BOOL success = raycastForNewObjPos( x, y, &hit_obj, &hit_face, &b_hit_land, &ray_start_region, &ray_end_region, &regionp );
- if( !success )
- {
- make_ui_sound("UISndInvalidOp");
- return FALSE;
- }
- if( hit_obj && (hit_obj->isAvatar() || hit_obj->isAttachment()) )
- {
- // Can't create objects on avatars or attachments
- make_ui_sound("UISndInvalidOp");
- return FALSE;
- }
-
-
- // Limit raycast to a single object.
- // Speeds up server raycast + avoid problems with server ray hitting objects
- // that were clipped by the near plane or culled on the viewer.
- LLUUID ray_target_id;
- if( hit_obj )
- {
- ray_target_id = hit_obj->getID();
- }
- else
- {
- ray_target_id.setNull();
- }
-
- LLSelectMgr::getInstance()->selectDuplicateOnRay(ray_start_region,
- ray_end_region,
- b_hit_land, // suppress raycast
- FALSE, // intersection
- ray_target_id,
- gSavedSettings.getBOOL("CreateToolCopyCenters"),
- gSavedSettings.getBOOL("CreateToolCopyRotates"),
- FALSE); // select copy
-
- if (regionp
- && (regionp->getRegionFlag(REGION_FLAGS_SANDBOX)))
- {
- //LLFirstUse::useSandbox();
- }
-
- return TRUE;
+ LLVector3 ray_start_region;
+ LLVector3 ray_end_region;
+ LLViewerRegion* regionp = NULL;
+ BOOL b_hit_land = FALSE;
+ S32 hit_face = -1;
+ LLViewerObject* hit_obj = NULL;
+ BOOL success = raycastForNewObjPos( x, y, &hit_obj, &hit_face, &b_hit_land, &ray_start_region, &ray_end_region, &regionp );
+ if( !success )
+ {
+ make_ui_sound("UISndInvalidOp");
+ return FALSE;
+ }
+ if( hit_obj && (hit_obj->isAvatar() || hit_obj->isAttachment()) )
+ {
+ // Can't create objects on avatars or attachments
+ make_ui_sound("UISndInvalidOp");
+ return FALSE;
+ }
+
+
+ // Limit raycast to a single object.
+ // Speeds up server raycast + avoid problems with server ray hitting objects
+ // that were clipped by the near plane or culled on the viewer.
+ LLUUID ray_target_id;
+ if( hit_obj )
+ {
+ ray_target_id = hit_obj->getID();
+ }
+ else
+ {
+ ray_target_id.setNull();
+ }
+
+ LLSelectMgr::getInstance()->selectDuplicateOnRay(ray_start_region,
+ ray_end_region,
+ b_hit_land, // suppress raycast
+ FALSE, // intersection
+ ray_target_id,
+ gSavedSettings.getBOOL("CreateToolCopyCenters"),
+ gSavedSettings.getBOOL("CreateToolCopyRotates"),
+ FALSE); // select copy
+
+ if (regionp
+ && (regionp->getRegionFlag(REGION_FLAGS_SANDBOX)))
+ {
+ //LLFirstUse::useSandbox();
+ }
+
+ return TRUE;
}
BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask)
{
- BOOL added = TRUE;
-
- if (gSavedSettings.getBOOL("CreateToolCopySelection"))
- {
- added = addDuplicate(x, y);
- }
- else
- {
- added = addObject( sObjectType, x, y, FALSE );
- }
-
- // ...and go back to the default tool
- if (added && !gSavedSettings.getBOOL("CreateToolKeepSelected"))
- {
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompTranslate::getInstance() );
- }
-
- return added;
+ BOOL added = TRUE;
+
+ if (gSavedSettings.getBOOL("CreateToolCopySelection"))
+ {
+ added = addDuplicate(x, y);
+ }
+ else
+ {
+ added = addObject( sObjectType, x, y, FALSE );
+ }
+
+ // ...and go back to the default tool
+ if (added && !gSavedSettings.getBOOL("CreateToolKeepSelected"))
+ {
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompTranslate::getInstance() );
+ }
+
+ return added;
}
BOOL LLToolPlacer::handleHover(S32 x, S32 y, MASK mask)
{
- LL_DEBUGS("UserInput") << "hover handled by LLToolPlacer" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_TOOLCREATE);
- return TRUE;
+ LL_DEBUGS("UserInput") << "hover handled by LLToolPlacer" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_TOOLCREATE);
+ return TRUE;
}
void LLToolPlacer::handleSelect()
{
- gFloaterTools->setStatusText("place");
+ gFloaterTools->setStatusText("place");
}
void LLToolPlacer::handleDeselect()
diff --git a/indra/newview/lltoolplacer.h b/indra/newview/lltoolplacer.h
index ad59cb0daa..d5e4a587d7 100644
--- a/indra/newview/lltoolplacer.h
+++ b/indra/newview/lltoolplacer.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolplacer.h
* @brief Tool for placing new objects into the world
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,27 +37,27 @@ class LLViewerRegion;
// LLToolPlacer
class LLToolPlacer
- : public LLTool
+ : public LLTool
{
public:
- LLToolPlacer();
+ LLToolPlacer();
- virtual BOOL placeObject(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual void handleSelect(); // do stuff when your tool is selected
- virtual void handleDeselect(); // clean up when your tool is deselected
+ virtual BOOL placeObject(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual void handleSelect(); // do stuff when your tool is selected
+ virtual void handleDeselect(); // clean up when your tool is deselected
- static void setObjectType( LLPCode type ) { sObjectType = type; }
- static LLPCode getObjectType() { return sObjectType; }
+ static void setObjectType( LLPCode type ) { sObjectType = type; }
+ static LLPCode getObjectType() { return sObjectType; }
protected:
- static LLPCode sObjectType;
+ static LLPCode sObjectType;
private:
- BOOL addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics );
- BOOL raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face,
- BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region );
- BOOL addDuplicate(S32 x, S32 y);
+ BOOL addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics );
+ BOOL raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face,
+ BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region );
+ BOOL addDuplicate(S32 x, S32 y);
};
#endif
diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp
index f7455c6cb8..b294f42123 100644
--- a/indra/newview/lltoolselect.cpp
+++ b/indra/newview/lltoolselect.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolselect.cpp
* @brief LLToolSelect class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,8 +42,8 @@
#include "llviewercamera.h"
#include "llviewermenu.h"
#include "llviewerobject.h"
-#include "llviewerobjectlist.h"
-#include "llviewerregion.h"
+#include "llviewerobjectlist.h"
+#include "llviewerregion.h"
#include "llviewerwindow.h"
#include "llvoavatarself.h"
#include "llworld.h"
@@ -55,235 +55,235 @@ const F32 SELECTION_ROTATION_TRESHOLD = 0.1f;
const F32 SELECTION_SITTING_ROTATION_TRESHOLD = 3.2f; //radian
LLToolSelect::LLToolSelect( LLToolComposite* composite )
-: LLTool( std::string("Select"), composite ),
- mIgnoreGroup( FALSE )
+: LLTool( std::string("Select"), composite ),
+ mIgnoreGroup( FALSE )
{
}
// True if you selected an object.
BOOL LLToolSelect::handleMouseDown(S32 x, S32 y, MASK mask)
{
- // do immediate pick query
+ // do immediate pick query
BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick");
BOOL pick_transparent = gSavedSettings.getBOOL("SelectInvisibleObjects");
BOOL pick_reflection_probe = gSavedSettings.getBOOL("SelectReflectionProbes");
- mPick = gViewerWindow->pickImmediate(x, y, pick_transparent, pick_rigged, FALSE, TRUE, pick_reflection_probe);
+ mPick = gViewerWindow->pickImmediate(x, y, pick_transparent, pick_rigged, FALSE, TRUE, pick_reflection_probe);
- // Pass mousedown to agent
- LLTool::handleMouseDown(x, y, mask);
+ // Pass mousedown to agent
+ LLTool::handleMouseDown(x, y, mask);
- return mPick.getObject().notNull();
+ return mPick.getObject().notNull();
}
// static
LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pick, BOOL ignore_group, BOOL temp_select, BOOL select_root)
{
- LLViewerObject* object = pick.getObject();
- if (select_root)
- {
- object = object->getRootEdit();
- }
- BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly");
- BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly");
+ LLViewerObject* object = pick.getObject();
+ if (select_root)
+ {
+ object = object->getRootEdit();
+ }
+ BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly");
+ BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly");
// *NOTE: These settings must be cleaned up at bottom of function.
- if (temp_select || LLSelectMgr::getInstance()->mAllowSelectAvatar)
- {
- gSavedSettings.setBOOL("SelectOwnedOnly", FALSE);
- gSavedSettings.setBOOL("SelectMovableOnly", FALSE);
- LLSelectMgr::getInstance()->setForceSelection(TRUE);
- }
-
- BOOL extend_select = (pick.mKeyMask == MASK_SHIFT) || (pick.mKeyMask == MASK_CONTROL);
-
- // If no object, check for icon, then just deselect
- if (!object)
- {
- LLHUDIcon* last_hit_hud_icon = pick.mHUDIcon;
-
- if (last_hit_hud_icon && last_hit_hud_icon->getSourceObject())
- {
- LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID());
- }
- else if (!extend_select)
- {
- LLSelectMgr::getInstance()->deselectAll();
- }
- }
- else
- {
- BOOL already_selected = object->isSelected();
-
- if (already_selected &&
- object->getNumTEs() > 0 &&
- !LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES))
- {
- const LLTextureEntry* tep = object->getTE(pick.mObjectFace);
- if (tep && !tep->isSelected() && !LLViewerMediaFocus::getInstance()->getFocusedObjectID().isNull())
- {
- // we were interacting with media and clicked on non selected face, drop media focus
- LLViewerMediaFocus::getInstance()->clearFocus();
- // selection was removed and zoom preserved by clearFocus(), continue with regular selection
- already_selected = false;
- extend_select = true;
- }
- }
-
- if ( extend_select )
- {
- if ( already_selected )
- {
- if ( ignore_group )
- {
- LLSelectMgr::getInstance()->deselectObjectOnly(object);
- }
- else
- {
- LLSelectMgr::getInstance()->deselectObjectAndFamily(object, TRUE, TRUE);
- }
- }
- else
- {
- if ( ignore_group )
- {
- LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES);
- }
- else
- {
- LLSelectMgr::getInstance()->selectObjectAndFamily(object);
- }
- }
- }
- else
- {
- // Save the current zoom values because deselect resets them.
- F32 target_zoom;
- F32 current_zoom;
- LLSelectMgr::getInstance()->getAgentHUDZoom(target_zoom, current_zoom);
-
- // JC - Change behavior to make it easier to select children
- // of linked sets. 9/3/2002
- if( !already_selected || ignore_group)
- {
- // ...lose current selection in favor of just this object
- LLSelectMgr::getInstance()->deselectAll();
- }
-
- if ( ignore_group )
- {
- LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES);
- }
- else
- {
- LLSelectMgr::getInstance()->selectObjectAndFamily(object);
- }
-
- // restore the zoom to the previously stored values.
- LLSelectMgr::getInstance()->setAgentHUDZoom(target_zoom, current_zoom);
- }
-
- if (!gAgentCamera.getFocusOnAvatar() && // if camera not glued to avatar
- LLVOAvatar::findAvatarFromAttachment(object) != gAgentAvatarp && // and it's not one of your attachments
- object != gAgentAvatarp) // and it's not you
- {
- // have avatar turn to face the selected object(s)
- LLVector3d selection_center = LLSelectMgr::getInstance()->getSelectionCenterGlobal();
- selection_center = selection_center - gAgent.getPositionGlobal();
- LLVector3 selection_dir;
- selection_dir.setVec(selection_center);
- selection_dir.mV[VZ] = 0.f;
- selection_dir.normVec();
- if (!object->isAvatar() && gAgent.getAtAxis() * selection_dir < 0.6f)
- {
- LLQuaternion target_rot;
- target_rot.shortestArc(LLVector3::x_axis, selection_dir);
- gAgent.startAutoPilotGlobal(gAgent.getPositionGlobal(),
- "",
- &target_rot,
- NULL,
- NULL,
- MAX_FAR_CLIP /*stop_distance, don't care since we are looking, not moving*/,
- gAgentAvatarp->isSitting() ? SELECTION_SITTING_ROTATION_TRESHOLD : SELECTION_ROTATION_TRESHOLD);
- }
- }
-
- if (temp_select)
- {
- if (!already_selected)
- {
- LLViewerObject* root_object = (LLViewerObject*)object->getRootEdit();
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
-
- // this is just a temporary selection
- LLSelectNode* select_node = selection->findNode(root_object);
- if (select_node)
- {
- select_node->setTransient(TRUE);
- }
-
- LLViewerObject::const_child_list_t& child_list = root_object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- select_node = selection->findNode(child);
- if (select_node)
- {
- select_node->setTransient(TRUE);
- }
- }
-
- }
- } //if(temp_select)
- } //if(!object)
-
- // Cleanup temp select settings above.
- if (temp_select ||LLSelectMgr::getInstance()->mAllowSelectAvatar)
- {
- gSavedSettings.setBOOL("SelectOwnedOnly", select_owned);
- gSavedSettings.setBOOL("SelectMovableOnly", select_movable);
- LLSelectMgr::getInstance()->setForceSelection(FALSE);
- }
-
- return LLSelectMgr::getInstance()->getSelection();
+ if (temp_select || LLSelectMgr::getInstance()->mAllowSelectAvatar)
+ {
+ gSavedSettings.setBOOL("SelectOwnedOnly", FALSE);
+ gSavedSettings.setBOOL("SelectMovableOnly", FALSE);
+ LLSelectMgr::getInstance()->setForceSelection(TRUE);
+ }
+
+ BOOL extend_select = (pick.mKeyMask == MASK_SHIFT) || (pick.mKeyMask == MASK_CONTROL);
+
+ // If no object, check for icon, then just deselect
+ if (!object)
+ {
+ LLHUDIcon* last_hit_hud_icon = pick.mHUDIcon;
+
+ if (last_hit_hud_icon && last_hit_hud_icon->getSourceObject())
+ {
+ LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID());
+ }
+ else if (!extend_select)
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+ }
+ else
+ {
+ BOOL already_selected = object->isSelected();
+
+ if (already_selected &&
+ object->getNumTEs() > 0 &&
+ !LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES))
+ {
+ const LLTextureEntry* tep = object->getTE(pick.mObjectFace);
+ if (tep && !tep->isSelected() && !LLViewerMediaFocus::getInstance()->getFocusedObjectID().isNull())
+ {
+ // we were interacting with media and clicked on non selected face, drop media focus
+ LLViewerMediaFocus::getInstance()->clearFocus();
+ // selection was removed and zoom preserved by clearFocus(), continue with regular selection
+ already_selected = false;
+ extend_select = true;
+ }
+ }
+
+ if ( extend_select )
+ {
+ if ( already_selected )
+ {
+ if ( ignore_group )
+ {
+ LLSelectMgr::getInstance()->deselectObjectOnly(object);
+ }
+ else
+ {
+ LLSelectMgr::getInstance()->deselectObjectAndFamily(object, TRUE, TRUE);
+ }
+ }
+ else
+ {
+ if ( ignore_group )
+ {
+ LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES);
+ }
+ else
+ {
+ LLSelectMgr::getInstance()->selectObjectAndFamily(object);
+ }
+ }
+ }
+ else
+ {
+ // Save the current zoom values because deselect resets them.
+ F32 target_zoom;
+ F32 current_zoom;
+ LLSelectMgr::getInstance()->getAgentHUDZoom(target_zoom, current_zoom);
+
+ // JC - Change behavior to make it easier to select children
+ // of linked sets. 9/3/2002
+ if( !already_selected || ignore_group)
+ {
+ // ...lose current selection in favor of just this object
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+
+ if ( ignore_group )
+ {
+ LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES);
+ }
+ else
+ {
+ LLSelectMgr::getInstance()->selectObjectAndFamily(object);
+ }
+
+ // restore the zoom to the previously stored values.
+ LLSelectMgr::getInstance()->setAgentHUDZoom(target_zoom, current_zoom);
+ }
+
+ if (!gAgentCamera.getFocusOnAvatar() && // if camera not glued to avatar
+ LLVOAvatar::findAvatarFromAttachment(object) != gAgentAvatarp && // and it's not one of your attachments
+ object != gAgentAvatarp) // and it's not you
+ {
+ // have avatar turn to face the selected object(s)
+ LLVector3d selection_center = LLSelectMgr::getInstance()->getSelectionCenterGlobal();
+ selection_center = selection_center - gAgent.getPositionGlobal();
+ LLVector3 selection_dir;
+ selection_dir.setVec(selection_center);
+ selection_dir.mV[VZ] = 0.f;
+ selection_dir.normVec();
+ if (!object->isAvatar() && gAgent.getAtAxis() * selection_dir < 0.6f)
+ {
+ LLQuaternion target_rot;
+ target_rot.shortestArc(LLVector3::x_axis, selection_dir);
+ gAgent.startAutoPilotGlobal(gAgent.getPositionGlobal(),
+ "",
+ &target_rot,
+ NULL,
+ NULL,
+ MAX_FAR_CLIP /*stop_distance, don't care since we are looking, not moving*/,
+ gAgentAvatarp->isSitting() ? SELECTION_SITTING_ROTATION_TRESHOLD : SELECTION_ROTATION_TRESHOLD);
+ }
+ }
+
+ if (temp_select)
+ {
+ if (!already_selected)
+ {
+ LLViewerObject* root_object = (LLViewerObject*)object->getRootEdit();
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+
+ // this is just a temporary selection
+ LLSelectNode* select_node = selection->findNode(root_object);
+ if (select_node)
+ {
+ select_node->setTransient(TRUE);
+ }
+
+ LLViewerObject::const_child_list_t& child_list = root_object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ select_node = selection->findNode(child);
+ if (select_node)
+ {
+ select_node->setTransient(TRUE);
+ }
+ }
+
+ }
+ } //if(temp_select)
+ } //if(!object)
+
+ // Cleanup temp select settings above.
+ if (temp_select ||LLSelectMgr::getInstance()->mAllowSelectAvatar)
+ {
+ gSavedSettings.setBOOL("SelectOwnedOnly", select_owned);
+ gSavedSettings.setBOOL("SelectMovableOnly", select_movable);
+ LLSelectMgr::getInstance()->setForceSelection(FALSE);
+ }
+
+ return LLSelectMgr::getInstance()->getSelection();
}
BOOL LLToolSelect::handleMouseUp(S32 x, S32 y, MASK mask)
{
- mIgnoreGroup = gSavedSettings.getBOOL("EditLinkedParts");
+ mIgnoreGroup = gSavedSettings.getBOOL("EditLinkedParts");
- handleObjectSelection(mPick, mIgnoreGroup, FALSE);
+ handleObjectSelection(mPick, mIgnoreGroup, FALSE);
- return LLTool::handleMouseUp(x, y, mask);
+ return LLTool::handleMouseUp(x, y, mask);
}
void LLToolSelect::handleDeselect()
{
- if( hasMouseCapture() )
- {
- setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
- }
+ if( hasMouseCapture() )
+ {
+ setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
+ }
}
void LLToolSelect::stopEditing()
{
- if( hasMouseCapture() )
- {
- setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
- }
+ if( hasMouseCapture() )
+ {
+ setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
+ }
}
void LLToolSelect::onMouseCaptureLost()
{
- // Finish drag
+ // Finish drag
- LLSelectMgr::getInstance()->enableSilhouette(TRUE);
+ LLSelectMgr::getInstance()->enableSilhouette(TRUE);
- // Clean up drag-specific variables
- mIgnoreGroup = FALSE;
+ // Clean up drag-specific variables
+ mIgnoreGroup = FALSE;
}
diff --git a/indra/newview/lltoolselect.h b/indra/newview/lltoolselect.h
index 74dababe8c..c28e71b199 100644
--- a/indra/newview/lltoolselect.h
+++ b/indra/newview/lltoolselect.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolselect.h
* @brief LLToolSelect class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,22 +37,22 @@ class LLObjectSelection;
class LLToolSelect : public LLTool
{
public:
- LLToolSelect( LLToolComposite* composite );
+ LLToolSelect( LLToolComposite* composite );
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual void stopEditing();
+ virtual void stopEditing();
- static LLSafeHandle<LLObjectSelection> handleObjectSelection(const LLPickInfo& pick, BOOL ignore_group, BOOL temp_select, BOOL select_root = FALSE);
+ static LLSafeHandle<LLObjectSelection> handleObjectSelection(const LLPickInfo& pick, BOOL ignore_group, BOOL temp_select, BOOL select_root = FALSE);
- virtual void onMouseCaptureLost();
- virtual void handleDeselect();
+ virtual void onMouseCaptureLost();
+ virtual void handleDeselect();
protected:
- BOOL mIgnoreGroup;
- LLUUID mSelectObjectID;
- LLPickInfo mPick;
+ BOOL mIgnoreGroup;
+ LLUUID mSelectObjectID;
+ LLPickInfo mPick;
};
diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp
index ff991dc9fd..04fe837d2b 100644
--- a/indra/newview/lltoolselectland.cpp
+++ b/indra/newview/lltoolselectland.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolselectland.cpp
* @brief LLToolSelectLand class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,17 +44,17 @@
//
LLToolSelectLand::LLToolSelectLand( )
-: LLTool( std::string("Parcel") ),
- mDragStartGlobal(),
- mDragEndGlobal(),
- mDragEndValid(FALSE),
- mDragStartX(0),
- mDragStartY(0),
- mDragEndX(0),
- mDragEndY(0),
- mMouseOutsideSlop(FALSE),
- mWestSouthBottom(),
- mEastNorthTop()
+: LLTool( std::string("Parcel") ),
+ mDragStartGlobal(),
+ mDragEndGlobal(),
+ mDragEndValid(FALSE),
+ mDragStartX(0),
+ mDragStartY(0),
+ mDragEndX(0),
+ mDragEndY(0),
+ mMouseOutsideSlop(FALSE),
+ mWestSouthBottom(),
+ mEastNorthTop()
{ }
LLToolSelectLand::~LLToolSelectLand()
@@ -64,171 +64,171 @@ LLToolSelectLand::~LLToolSelectLand()
BOOL LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &mDragStartGlobal);
- if (hit_land)
- {
- setMouseCapture( TRUE );
+ BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &mDragStartGlobal);
+ if (hit_land)
+ {
+ setMouseCapture( TRUE );
- mDragStartX = x;
- mDragStartY = y;
- mDragEndX = x;
- mDragEndY = y;
+ mDragStartX = x;
+ mDragStartY = y;
+ mDragEndX = x;
+ mDragEndY = y;
- mDragEndValid = TRUE;
- mDragEndGlobal = mDragStartGlobal;
+ mDragEndValid = TRUE;
+ mDragEndGlobal = mDragStartGlobal;
- sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop);
+ sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop);
- mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
- mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
+ mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
+ mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
- roundXY(mWestSouthBottom);
- roundXY(mEastNorthTop);
+ roundXY(mWestSouthBottom);
+ roundXY(mEastNorthTop);
- mMouseOutsideSlop = TRUE; //FALSE;
+ mMouseOutsideSlop = TRUE; //FALSE;
- LLViewerParcelMgr::getInstance()->deselectLand();
- }
+ LLViewerParcelMgr::getInstance()->deselectLand();
+ }
- return hit_land;
+ return hit_land;
}
BOOL LLToolSelectLand::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- LLVector3d pos_global;
- BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &pos_global);
- if (hit_land)
- {
- // Auto-select this parcel
- LLViewerParcelMgr::getInstance()->selectParcelAt( pos_global );
- return TRUE;
- }
- return FALSE;
+ LLVector3d pos_global;
+ BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &pos_global);
+ if (hit_land)
+ {
+ // Auto-select this parcel
+ LLViewerParcelMgr::getInstance()->selectParcelAt( pos_global );
+ return TRUE;
+ }
+ return FALSE;
}
BOOL LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask)
{
- if( hasMouseCapture() )
- {
- setMouseCapture( FALSE );
-
- if (mMouseOutsideSlop && mDragEndValid)
- {
- // Take the drag start and end locations, then map the southwest
- // point down to the next grid location, and the northeast point up
- // to the next grid location.
-
- sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop);
-
- mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
- mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
-
- roundXY(mWestSouthBottom);
- roundXY(mEastNorthTop);
-
- // Don't auto-select entire parcel.
- mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, FALSE );
- }
-
- mMouseOutsideSlop = FALSE;
- mDragEndValid = FALSE;
-
- return TRUE;
- }
- return FALSE;
+ if( hasMouseCapture() )
+ {
+ setMouseCapture( FALSE );
+
+ if (mMouseOutsideSlop && mDragEndValid)
+ {
+ // Take the drag start and end locations, then map the southwest
+ // point down to the next grid location, and the northeast point up
+ // to the next grid location.
+
+ sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop);
+
+ mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
+ mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
+
+ roundXY(mWestSouthBottom);
+ roundXY(mEastNorthTop);
+
+ // Don't auto-select entire parcel.
+ mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, FALSE );
+ }
+
+ mMouseOutsideSlop = FALSE;
+ mDragEndValid = FALSE;
+
+ return TRUE;
+ }
+ return FALSE;
}
BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask)
{
- if( hasMouseCapture() )
- {
- if (mMouseOutsideSlop || outsideSlop(x, y, mDragStartX, mDragStartY))
- {
- mMouseOutsideSlop = TRUE;
-
- // Must do this every frame, in case the camera moved or the land moved
- // since last frame.
-
- // If doesn't hit land, doesn't change old value
- LLVector3d land_global;
- BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &land_global);
- if (hit_land)
- {
- mDragEndValid = TRUE;
- mDragEndGlobal = land_global;
-
- sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop);
-
- mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
- mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
-
- roundXY(mWestSouthBottom);
- roundXY(mEastNorthTop);
-
- LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, land)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- }
- else
- {
- mDragEndValid = FALSE;
- LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, no land)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_NO);
- }
-
- mDragEndX = x;
- mDragEndY = y;
- }
- else
- {
- LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, in slop)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- }
- }
- else
- {
- LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (inactive)" << LL_ENDL;
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- }
-
- return TRUE;
+ if( hasMouseCapture() )
+ {
+ if (mMouseOutsideSlop || outsideSlop(x, y, mDragStartX, mDragStartY))
+ {
+ mMouseOutsideSlop = TRUE;
+
+ // Must do this every frame, in case the camera moved or the land moved
+ // since last frame.
+
+ // If doesn't hit land, doesn't change old value
+ LLVector3d land_global;
+ BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &land_global);
+ if (hit_land)
+ {
+ mDragEndValid = TRUE;
+ mDragEndGlobal = land_global;
+
+ sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop);
+
+ mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
+ mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
+
+ roundXY(mWestSouthBottom);
+ roundXY(mEastNorthTop);
+
+ LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, land)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ }
+ else
+ {
+ mDragEndValid = FALSE;
+ LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, no land)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_NO);
+ }
+
+ mDragEndX = x;
+ mDragEndY = y;
+ }
+ else
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, in slop)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ }
+ }
+ else
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (inactive)" << LL_ENDL;
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ }
+
+ return TRUE;
}
void LLToolSelectLand::render()
{
- if( hasMouseCapture() && /*mMouseOutsideSlop &&*/ mDragEndValid)
- {
- LLViewerParcelMgr::getInstance()->renderRect( mWestSouthBottom, mEastNorthTop );
- }
+ if( hasMouseCapture() && /*mMouseOutsideSlop &&*/ mDragEndValid)
+ {
+ LLViewerParcelMgr::getInstance()->renderRect( mWestSouthBottom, mEastNorthTop );
+ }
}
void LLToolSelectLand::handleSelect()
{
- gFloaterTools->setStatusText("selectland");
+ gFloaterTools->setStatusText("selectland");
}
void LLToolSelectLand::handleDeselect()
{
- mSelection = NULL;
+ mSelection = NULL;
}
void LLToolSelectLand::roundXY(LLVector3d &vec)
{
- vec.mdV[VX] = ll_round( vec.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
- vec.mdV[VY] = ll_round( vec.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
+ vec.mdV[VX] = ll_round( vec.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
+ vec.mdV[VY] = ll_round( vec.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
}
// true if x,y outside small box around start_x,start_y
BOOL LLToolSelectLand::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y)
{
- S32 dx = x - start_x;
- S32 dy = y - start_y;
+ S32 dx = x - start_x;
+ S32 dy = y - start_y;
- return (dx <= -2 || 2 <= dx || dy <= -2 || 2 <= dy);
+ return (dx <= -2 || 2 <= dx || dy <= -2 || 2 <= dy);
}
diff --git a/indra/newview/lltoolselectland.h b/indra/newview/lltoolselectland.h
index 88bc4e2e3d..553211f7a0 100644
--- a/indra/newview/lltoolselectland.h
+++ b/indra/newview/lltoolselectland.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolselectland.h
* @brief LLToolSelectLand class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,43 +33,43 @@
class LLParcelSelection;
class LLToolSelectLand
-: public LLTool, public LLSingleton<LLToolSelectLand>
+: public LLTool, public LLSingleton<LLToolSelectLand>
{
- LLSINGLETON(LLToolSelectLand);
- virtual ~LLToolSelectLand();
+ LLSINGLETON(LLToolSelectLand);
+ virtual ~LLToolSelectLand();
public:
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
- /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override;
- /*virtual*/ void render() override; // draw the select rectangle
- /*virtual*/ BOOL isAlwaysRendered() override { return TRUE; }
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override;
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override;
+ /*virtual*/ void render() override; // draw the select rectangle
+ /*virtual*/ BOOL isAlwaysRendered() override { return TRUE; }
- /*virtual*/ void handleSelect() override;
- /*virtual*/ void handleDeselect() override;
+ /*virtual*/ void handleSelect() override;
+ /*virtual*/ void handleDeselect() override;
protected:
- BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y);
- void roundXY(LLVector3d& vec);
+ BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y);
+ void roundXY(LLVector3d& vec);
protected:
- LLVector3d mDragStartGlobal; // global coords
- LLVector3d mDragEndGlobal; // global coords
- BOOL mDragEndValid; // is drag end a valid point in the world?
+ LLVector3d mDragStartGlobal; // global coords
+ LLVector3d mDragEndGlobal; // global coords
+ BOOL mDragEndValid; // is drag end a valid point in the world?
- S32 mDragStartX; // screen coords, from left
- S32 mDragStartY; // screen coords, from bottom
+ S32 mDragStartX; // screen coords, from left
+ S32 mDragStartY; // screen coords, from bottom
- S32 mDragEndX;
- S32 mDragEndY;
+ S32 mDragEndX;
+ S32 mDragEndY;
- BOOL mMouseOutsideSlop; // has mouse ever gone outside slop region?
+ BOOL mMouseOutsideSlop; // has mouse ever gone outside slop region?
- LLVector3d mWestSouthBottom; // global coords, from drag
- LLVector3d mEastNorthTop; // global coords, from drag
+ LLVector3d mWestSouthBottom; // global coords, from drag
+ LLVector3d mEastNorthTop; // global coords, from drag
- LLSafeHandle<LLParcelSelection> mSelection; // hold on to a parcel selection
+ LLSafeHandle<LLParcelSelection> mSelection; // hold on to a parcel selection
};
diff --git a/indra/newview/lltoolselectrect.cpp b/indra/newview/lltoolselectrect.cpp
index bae32f7bc0..eceb4e2675 100644
--- a/indra/newview/lltoolselectrect.cpp
+++ b/indra/newview/lltoolselectrect.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolselectrect.cpp
* @brief A tool to select multiple objects with a screen-space rectangle.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,15 +54,15 @@ const S32 SLOP_RADIUS = 5;
//
LLToolSelectRect::LLToolSelectRect( LLToolComposite* composite )
- :
- LLToolSelect( composite ),
- mDragStartX(0),
- mDragStartY(0),
- mDragEndX(0),
- mDragEndY(0),
- mDragLastWidth(0),
- mDragLastHeight(0),
- mMouseOutsideSlop(FALSE)
+ :
+ LLToolSelect( composite ),
+ mDragStartX(0),
+ mDragStartY(0),
+ mDragEndX(0),
+ mDragEndY(0),
+ mDragLastWidth(0),
+ mDragLastHeight(0),
+ mMouseOutsideSlop(FALSE)
{ }
@@ -72,133 +72,133 @@ void dialog_refresh_all(void);
BOOL LLToolSelectRect::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick");
- handlePick(gViewerWindow->pickImmediate(x, y, TRUE /* pick_transparent */, pick_rigged));
+ handlePick(gViewerWindow->pickImmediate(x, y, TRUE /* pick_transparent */, pick_rigged));
- LLTool::handleMouseDown(x, y, mask);
+ LLTool::handleMouseDown(x, y, mask);
- return mPick.getObject().notNull();
+ return mPick.getObject().notNull();
}
void LLToolSelectRect::handlePick(const LLPickInfo& pick)
{
- mPick = pick;
+ mPick = pick;
- // start dragging rectangle
- setMouseCapture( TRUE );
+ // start dragging rectangle
+ setMouseCapture( TRUE );
- mDragStartX = pick.mMousePt.mX;
- mDragStartY = pick.mMousePt.mY;
- mDragEndX = pick.mMousePt.mX;
- mDragEndY = pick.mMousePt.mY;
+ mDragStartX = pick.mMousePt.mX;
+ mDragStartY = pick.mMousePt.mY;
+ mDragEndX = pick.mMousePt.mX;
+ mDragEndY = pick.mMousePt.mY;
- mMouseOutsideSlop = FALSE;
+ mMouseOutsideSlop = FALSE;
}
BOOL LLToolSelectRect::handleMouseUp(S32 x, S32 y, MASK mask)
{
- setMouseCapture( FALSE );
-
- if( mMouseOutsideSlop )
- {
- mDragLastWidth = 0;
- mDragLastHeight = 0;
-
- mMouseOutsideSlop = FALSE;
-
- if (mask == MASK_CONTROL)
- {
- LLSelectMgr::getInstance()->deselectHighlightedObjects();
- }
- else
- {
- LLSelectMgr::getInstance()->selectHighlightedObjects();
- }
- return TRUE;
- }
- else
- {
- return LLToolSelect::handleMouseUp(x, y, mask);
- }
+ setMouseCapture( FALSE );
+
+ if( mMouseOutsideSlop )
+ {
+ mDragLastWidth = 0;
+ mDragLastHeight = 0;
+
+ mMouseOutsideSlop = FALSE;
+
+ if (mask == MASK_CONTROL)
+ {
+ LLSelectMgr::getInstance()->deselectHighlightedObjects();
+ }
+ else
+ {
+ LLSelectMgr::getInstance()->selectHighlightedObjects();
+ }
+ return TRUE;
+ }
+ else
+ {
+ return LLToolSelect::handleMouseUp(x, y, mask);
+ }
}
BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask)
{
- if( hasMouseCapture() )
- {
- if (mMouseOutsideSlop || outsideSlop(x, y, mDragStartX, mDragStartY))
- {
- if (!mMouseOutsideSlop && !(mask & MASK_SHIFT) && !(mask & MASK_CONTROL))
- {
- // just started rect select, and not adding to current selection
- LLSelectMgr::getInstance()->deselectAll();
- }
- mMouseOutsideSlop = TRUE;
- mDragEndX = x;
- mDragEndY = y;
-
- handleRectangleSelection(x, y, mask);
- }
- else
- {
- return LLToolSelect::handleHover(x, y, mask);
- }
-
- LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (active)" << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (inactive)" << LL_ENDL;
- }
-
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- return TRUE;
+ if( hasMouseCapture() )
+ {
+ if (mMouseOutsideSlop || outsideSlop(x, y, mDragStartX, mDragStartY))
+ {
+ if (!mMouseOutsideSlop && !(mask & MASK_SHIFT) && !(mask & MASK_CONTROL))
+ {
+ // just started rect select, and not adding to current selection
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+ mMouseOutsideSlop = TRUE;
+ mDragEndX = x;
+ mDragEndY = y;
+
+ handleRectangleSelection(x, y, mask);
+ }
+ else
+ {
+ return LLToolSelect::handleHover(x, y, mask);
+ }
+
+ LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (active)" << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (inactive)" << LL_ENDL;
+ }
+
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ return TRUE;
}
void LLToolSelectRect::draw()
{
- if( hasMouseCapture() && mMouseOutsideSlop)
- {
- if (gKeyboard->currentMask(TRUE) == MASK_CONTROL)
- {
- gGL.color4f(1.f, 0.f, 0.f, 1.f);
- }
- else
- {
- gGL.color4f(1.f, 1.f, 0.f, 1.f);
- }
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gl_rect_2d(
- llmin(mDragStartX, mDragEndX),
- llmax(mDragStartY, mDragEndY),
- llmax(mDragStartX, mDragEndX),
- llmin(mDragStartY, mDragEndY),
- FALSE);
- if (gKeyboard->currentMask(TRUE) == MASK_CONTROL)
- {
- gGL.color4f(1.f, 0.f, 0.f, 0.1f);
- }
- else
- {
- gGL.color4f(1.f, 1.f, 0.f, 0.1f);
- }
- gl_rect_2d(
- llmin(mDragStartX, mDragEndX),
- llmax(mDragStartY, mDragEndY),
- llmax(mDragStartX, mDragEndX),
- llmin(mDragStartY, mDragEndY));
- }
+ if( hasMouseCapture() && mMouseOutsideSlop)
+ {
+ if (gKeyboard->currentMask(TRUE) == MASK_CONTROL)
+ {
+ gGL.color4f(1.f, 0.f, 0.f, 1.f);
+ }
+ else
+ {
+ gGL.color4f(1.f, 1.f, 0.f, 1.f);
+ }
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gl_rect_2d(
+ llmin(mDragStartX, mDragEndX),
+ llmax(mDragStartY, mDragEndY),
+ llmax(mDragStartX, mDragEndX),
+ llmin(mDragStartY, mDragEndY),
+ FALSE);
+ if (gKeyboard->currentMask(TRUE) == MASK_CONTROL)
+ {
+ gGL.color4f(1.f, 0.f, 0.f, 0.1f);
+ }
+ else
+ {
+ gGL.color4f(1.f, 1.f, 0.f, 0.1f);
+ }
+ gl_rect_2d(
+ llmin(mDragStartX, mDragEndX),
+ llmax(mDragStartY, mDragEndY),
+ llmax(mDragStartX, mDragEndX),
+ llmin(mDragStartY, mDragEndY));
+ }
}
// true if x,y outside small box around start_x,start_y
BOOL LLToolSelectRect::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y)
{
- S32 dx = x - start_x;
- S32 dy = y - start_y;
+ S32 dx = x - start_x;
+ S32 dy = y - start_y;
- return (dx <= -SLOP_RADIUS || SLOP_RADIUS <= dx || dy <= -SLOP_RADIUS || SLOP_RADIUS <= dy);
+ return (dx <= -SLOP_RADIUS || SLOP_RADIUS <= dx || dy <= -SLOP_RADIUS || SLOP_RADIUS <= dy);
}
diff --git a/indra/newview/lltoolselectrect.h b/indra/newview/lltoolselectrect.h
index 5fdf622b49..8fc4ec0c1b 100644
--- a/indra/newview/lltoolselectrect.h
+++ b/indra/newview/lltoolselectrect.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolselectrect.h
* @brief A tool to select multiple objects with a screen-space rectangle.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,33 +31,33 @@
#include "lltoolselect.h"
class LLToolSelectRect
-: public LLToolSelect
+: public LLToolSelect
{
public:
- LLToolSelectRect( LLToolComposite* composite );
+ LLToolSelectRect( LLToolComposite* composite );
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual void draw(); // draw the select rectangle
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual void draw(); // draw the select rectangle
- void handlePick(const LLPickInfo& pick);
+ void handlePick(const LLPickInfo& pick);
protected:
- void handleRectangleSelection(S32 x, S32 y, MASK mask); // true if you selected one
- BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y);
+ void handleRectangleSelection(S32 x, S32 y, MASK mask); // true if you selected one
+ BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y);
protected:
- S32 mDragStartX; // screen coords, from left
- S32 mDragStartY; // screen coords, from bottom
+ S32 mDragStartX; // screen coords, from left
+ S32 mDragStartY; // screen coords, from bottom
- S32 mDragEndX;
- S32 mDragEndY;
+ S32 mDragEndX;
+ S32 mDragEndY;
- S32 mDragLastWidth;
- S32 mDragLastHeight;
+ S32 mDragLastWidth;
+ S32 mDragLastHeight;
- BOOL mMouseOutsideSlop; // has mouse ever gone outside slop region?
+ BOOL mMouseOutsideSlop; // has mouse ever gone outside slop region?
};
diff --git a/indra/newview/lltoolview.cpp b/indra/newview/lltoolview.cpp
index 678e2c241a..179aae1e02 100644
--- a/indra/newview/lltoolview.cpp
+++ b/indra/newview/lltoolview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolview.cpp
* @brief A UI contains for tool palette tools
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,155 +41,155 @@
LLToolContainer::LLToolContainer(LLToolView* parent)
-: mParent(parent),
- mButton(NULL),
- mPanel(NULL),
- mTool(NULL)
+: mParent(parent),
+ mButton(NULL),
+ mPanel(NULL),
+ mTool(NULL)
{ }
LLToolContainer::~LLToolContainer()
{
- // mParent is a pointer to the tool view
- // mButton is owned by the tool view
- // mPanel is owned by the tool view
- delete mTool;
- mTool = NULL;
+ // mParent is a pointer to the tool view
+ // mButton is owned by the tool view
+ // mPanel is owned by the tool view
+ delete mTool;
+ mTool = NULL;
}
LLToolView::LLToolView(const std::string& name, const LLRect& rect)
-: mButtonCount(0)
+: mButtonCount(0)
{
- LLView::init(LLView::Params().name(name).rect(rect).mouse_opaque(true));
+ LLView::init(LLView::Params().name(name).rect(rect).mouse_opaque(true));
}
LLToolView::~LLToolView()
{
- for_each(mContainList.begin(), mContainList.end(), DeletePointer());
- mContainList.clear();
+ for_each(mContainList.begin(), mContainList.end(), DeletePointer());
+ mContainList.clear();
}
//*TODO:translate?
// void LLToolView::addTool(const std::string& icon_off, const std::string& icon_on, LLPanel* panel, LLTool* tool, LLView* hoverView, const char* label)
// {
-// llassert(tool);
-
-// LLToolContainer* contain = new LLToolContainer(this);
-
-// LLRect btn_rect = getButtonRect(mButtonCount);
-
-// contain->mButton = new LLButton("ToolBtn",
-// btn_rect,
-// icon_off,
-// icon_on,
-// "",
-// &LLToolView::onClickToolButton,
-// contain,
-// LLFontGL::getFontSansSerif());
-
-// contain->mPanel = panel;
-// contain->mTool = tool;
-
-// addChild(contain->mButton);
-// mButtonCount++;
-
-// const S32 LABEL_TOP_SPACING = 0;
-// const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
-// S32 label_width = font->getWidth( label );
-// LLRect label_rect;
-// label_rect.setLeftTopAndSize(
-// btn_rect.mLeft + btn_rect.getWidth() / 2 - label_width / 2,
-// btn_rect.mBottom - LABEL_TOP_SPACING,
-// label_width,
-// llfloor(font->getLineHeight()));
-// addChild( new LLTextBox( "tool label", label_rect, label, font ) );
-
-// // Can optionally ignore panel
-// if (contain->mPanel)
-// {
-// contain->mPanel->setBackgroundVisible( FALSE );
-// contain->mPanel->setBorderVisible( FALSE );
-// addChild(contain->mPanel);
-// }
-
-// mContainList.push_back(contain);
+// llassert(tool);
+
+// LLToolContainer* contain = new LLToolContainer(this);
+
+// LLRect btn_rect = getButtonRect(mButtonCount);
+
+// contain->mButton = new LLButton("ToolBtn",
+// btn_rect,
+// icon_off,
+// icon_on,
+// "",
+// &LLToolView::onClickToolButton,
+// contain,
+// LLFontGL::getFontSansSerif());
+
+// contain->mPanel = panel;
+// contain->mTool = tool;
+
+// addChild(contain->mButton);
+// mButtonCount++;
+
+// const S32 LABEL_TOP_SPACING = 0;
+// const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
+// S32 label_width = font->getWidth( label );
+// LLRect label_rect;
+// label_rect.setLeftTopAndSize(
+// btn_rect.mLeft + btn_rect.getWidth() / 2 - label_width / 2,
+// btn_rect.mBottom - LABEL_TOP_SPACING,
+// label_width,
+// llfloor(font->getLineHeight()));
+// addChild( new LLTextBox( "tool label", label_rect, label, font ) );
+
+// // Can optionally ignore panel
+// if (contain->mPanel)
+// {
+// contain->mPanel->setBackgroundVisible( FALSE );
+// contain->mPanel->setBorderVisible( FALSE );
+// addChild(contain->mPanel);
+// }
+
+// mContainList.push_back(contain);
// }
LLRect LLToolView::getButtonRect(S32 button_index)
{
- const S32 HPAD = 7;
- const S32 VPAD = 7;
- const S32 TOOL_SIZE = 32;
- const S32 HORIZ_SPACING = TOOL_SIZE + 5;
- const S32 VERT_SPACING = TOOL_SIZE + 14;
-
- S32 tools_per_row = getRect().getWidth() / HORIZ_SPACING;
-
- S32 row = button_index / tools_per_row;
- S32 column = button_index % tools_per_row;
-
- // Build the rectangle, recalling the origin is at lower left
- // and we want the icons to build down from the top.
- LLRect rect;
- rect.setLeftTopAndSize( HPAD + (column * HORIZ_SPACING),
- -VPAD + getRect().getHeight() - (row * VERT_SPACING),
- TOOL_SIZE,
- TOOL_SIZE
- );
-
- return rect;
+ const S32 HPAD = 7;
+ const S32 VPAD = 7;
+ const S32 TOOL_SIZE = 32;
+ const S32 HORIZ_SPACING = TOOL_SIZE + 5;
+ const S32 VERT_SPACING = TOOL_SIZE + 14;
+
+ S32 tools_per_row = getRect().getWidth() / HORIZ_SPACING;
+
+ S32 row = button_index / tools_per_row;
+ S32 column = button_index % tools_per_row;
+
+ // Build the rectangle, recalling the origin is at lower left
+ // and we want the icons to build down from the top.
+ LLRect rect;
+ rect.setLeftTopAndSize( HPAD + (column * HORIZ_SPACING),
+ -VPAD + getRect().getHeight() - (row * VERT_SPACING),
+ TOOL_SIZE,
+ TOOL_SIZE
+ );
+
+ return rect;
}
void LLToolView::draw()
{
- // turn off highlighting for all containers
- // and hide all option panels except for the selected one.
- LLTool* selected = LLToolMgr::getInstance()->getCurrentToolset()->getSelectedTool();
- for (contain_list_t::iterator iter = mContainList.begin();
- iter != mContainList.end(); ++iter)
- {
- LLToolContainer* contain = *iter;
- BOOL state = (contain->mTool == selected);
- contain->mButton->setToggleState( state );
- if (contain->mPanel)
- {
- contain->mPanel->setVisible( state );
- }
- }
-
- // Draw children normally
- LLView::draw();
+ // turn off highlighting for all containers
+ // and hide all option panels except for the selected one.
+ LLTool* selected = LLToolMgr::getInstance()->getCurrentToolset()->getSelectedTool();
+ for (contain_list_t::iterator iter = mContainList.begin();
+ iter != mContainList.end(); ++iter)
+ {
+ LLToolContainer* contain = *iter;
+ BOOL state = (contain->mTool == selected);
+ contain->mButton->setToggleState( state );
+ if (contain->mPanel)
+ {
+ contain->mPanel->setVisible( state );
+ }
+ }
+
+ // Draw children normally
+ LLView::draw();
}
// protected
LLToolContainer* LLToolView::findToolContainer( LLTool *tool )
{
- // Find the container for this tool
- llassert( tool );
- for (contain_list_t::iterator iter = mContainList.begin();
- iter != mContainList.end(); ++iter)
- {
- LLToolContainer* contain = *iter;
- if( contain->mTool == tool )
- {
- return contain;
- }
- }
- LL_ERRS() << "LLToolView::findToolContainer - tool not found" << LL_ENDL;
- return NULL;
+ // Find the container for this tool
+ llassert( tool );
+ for (contain_list_t::iterator iter = mContainList.begin();
+ iter != mContainList.end(); ++iter)
+ {
+ LLToolContainer* contain = *iter;
+ if( contain->mTool == tool )
+ {
+ return contain;
+ }
+ }
+ LL_ERRS() << "LLToolView::findToolContainer - tool not found" << LL_ENDL;
+ return NULL;
}
// static
void LLToolView::onClickToolButton(void* userdata)
{
- LLToolContainer* clicked = (LLToolContainer*) userdata;
+ LLToolContainer* clicked = (LLToolContainer*) userdata;
- // Switch to this one
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( clicked->mTool );
+ // Switch to this one
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( clicked->mTool );
}
diff --git a/indra/newview/lltoolview.h b/indra/newview/lltoolview.h
index 3b5fb55cce..7b348e7088 100644
--- a/indra/newview/lltoolview.h
+++ b/indra/newview/lltoolview.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltoolview.h
* @brief UI container for tools.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,14 +43,14 @@ class LLToolView;
class LLToolContainer
{
public:
- LLToolContainer(LLToolView* parent);
- ~LLToolContainer();
+ LLToolContainer(LLToolView* parent);
+ ~LLToolContainer();
public:
- LLToolView* mParent; // toolview that owns this container
- LLButton* mButton;
- LLPanel* mPanel;
- LLTool* mTool; // if not NULL, this is a tool ref
+ LLToolView* mParent; // toolview that owns this container
+ LLButton* mButton;
+ LLPanel* mPanel;
+ LLTool* mTool; // if not NULL, this is a tool ref
};
@@ -58,27 +58,27 @@ public:
// tools. The icons sit on top of panels containing options for each
// tool.
class LLToolView
-: public LLView
+: public LLView
{
public:
- LLToolView(const std::string& name, const LLRect& rect);
- ~LLToolView();
+ LLToolView(const std::string& name, const LLRect& rect);
+ ~LLToolView();
- virtual void draw(); // handle juggling tool button highlights, panel visibility
+ virtual void draw(); // handle juggling tool button highlights, panel visibility
- static void onClickToolButton(void* container);
+ static void onClickToolButton(void* container);
- LLView* getCurrentHoverView();
+ LLView* getCurrentHoverView();
private:
- LLRect getButtonRect(S32 button_index); // return rect for button to add, zero-based index
- LLToolContainer *findToolContainer(LLTool *tool);
+ LLRect getButtonRect(S32 button_index); // return rect for button to add, zero-based index
+ LLToolContainer *findToolContainer(LLTool *tool);
private:
- typedef std::vector<LLToolContainer*> contain_list_t;
- contain_list_t mContainList;
- S32 mButtonCount; // used to compute rectangles
+ typedef std::vector<LLToolContainer*> contain_list_t;
+ contain_list_t mContainList;
+ S32 mButtonCount; // used to compute rectangles
};
#endif
diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp
index 4c55ea1fc6..caa91d204b 100644
--- a/indra/newview/lltracker.cpp
+++ b/indra/newview/lltracker.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltracker.cpp
* @brief Container for objects user is tracking.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -78,31 +78,31 @@ LLTracker *LLTracker::sTrackerp = NULL;
BOOL LLTracker::sCheesyBeacon = FALSE;
LLTracker::LLTracker()
-: mTrackingStatus(TRACKING_NOTHING),
- mTrackingLocationType(LOCATION_NOTHING),
- mHUDArrowCenterX(0),
- mHUDArrowCenterY(0),
- mToolTip( "" ),
- mTrackedLandmarkName(""),
- mHasReachedLandmark(FALSE),
- mHasLandmarkPosition(FALSE),
- mLandmarkHasBeenVisited(FALSE),
- mTrackedLocationName( "" ),
- mIsTrackingLocation(FALSE),
- mHasReachedLocation(FALSE)
+: mTrackingStatus(TRACKING_NOTHING),
+ mTrackingLocationType(LOCATION_NOTHING),
+ mHUDArrowCenterX(0),
+ mHUDArrowCenterY(0),
+ mToolTip( "" ),
+ mTrackedLandmarkName(""),
+ mHasReachedLandmark(FALSE),
+ mHasLandmarkPosition(FALSE),
+ mLandmarkHasBeenVisited(FALSE),
+ mTrackedLocationName( "" ),
+ mIsTrackingLocation(FALSE),
+ mHasReachedLocation(FALSE)
{ }
LLTracker::~LLTracker()
-{
- purgeBeaconText();
+{
+ purgeBeaconText();
}
// static
void LLTracker::stopTracking(bool clear_ui)
{
- instance()->stopTrackingAll(clear_ui);
+ instance()->stopTrackingAll(clear_ui);
}
@@ -120,740 +120,740 @@ void LLTracker::drawHUDArrow()
return;
}
- if (gViewerWindow->getProgressView()->getVisible()) return;
-
- static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
-
- /* tracking autopilot destination has been disabled
- -- 2004.01.09, Leviathan
- // Draw dot for autopilot target
- if (gAgent.getAutoPilot())
- {
- instance()->drawMarker( gAgent.getAutoPilotTargetGlobal(), map_track_color );
- return;
- }
- */
- switch (getTrackingStatus())
- {
- case TRACKING_AVATAR:
- // Tracked avatar
- if(LLAvatarTracker::instance().haveTrackingInfo())
- {
- instance()->drawMarker( LLAvatarTracker::instance().getGlobalPos(), map_track_color );
- }
- break;
-
- case TRACKING_LANDMARK:
- instance()->drawMarker( getTrackedPositionGlobal(), map_track_color );
- break;
-
- case TRACKING_LOCATION:
- // HACK -- try to keep the location just above the terrain
+ if (gViewerWindow->getProgressView()->getVisible()) return;
+
+ static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
+
+ /* tracking autopilot destination has been disabled
+ -- 2004.01.09, Leviathan
+ // Draw dot for autopilot target
+ if (gAgent.getAutoPilot())
+ {
+ instance()->drawMarker( gAgent.getAutoPilotTargetGlobal(), map_track_color );
+ return;
+ }
+ */
+ switch (getTrackingStatus())
+ {
+ case TRACKING_AVATAR:
+ // Tracked avatar
+ if(LLAvatarTracker::instance().haveTrackingInfo())
+ {
+ instance()->drawMarker( LLAvatarTracker::instance().getGlobalPos(), map_track_color );
+ }
+ break;
+
+ case TRACKING_LANDMARK:
+ instance()->drawMarker( getTrackedPositionGlobal(), map_track_color );
+ break;
+
+ case TRACKING_LOCATION:
+ // HACK -- try to keep the location just above the terrain
#if 0
- // UNHACKED by CRO - keep location where the location is
- instance()->mTrackedPositionGlobal.mdV[VZ] =
- 0.9f * instance()->mTrackedPositionGlobal.mdV[VZ]
- + 0.1f * (LLWorld::getInstance()->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f);
+ // UNHACKED by CRO - keep location where the location is
+ instance()->mTrackedPositionGlobal.mdV[VZ] =
+ 0.9f * instance()->mTrackedPositionGlobal.mdV[VZ]
+ + 0.1f * (LLWorld::getInstance()->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f);
#endif
- instance()->mTrackedPositionGlobal.mdV[VZ] = llclamp((F32)instance()->mTrackedPositionGlobal.mdV[VZ], LLWorld::getInstance()->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f, (F32)instance()->getTrackedPositionGlobal().mdV[VZ]);
- instance()->drawMarker( getTrackedPositionGlobal(), map_track_color );
- break;
+ instance()->mTrackedPositionGlobal.mdV[VZ] = llclamp((F32)instance()->mTrackedPositionGlobal.mdV[VZ], LLWorld::getInstance()->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f, (F32)instance()->getTrackedPositionGlobal().mdV[VZ]);
+ instance()->drawMarker( getTrackedPositionGlobal(), map_track_color );
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
}
-// static
+// static
void LLTracker::render3D()
{
- if (!gFloaterWorldMap || !gSavedSettings.getBOOL("RenderTrackerBeacon"))
- {
- return;
- }
-
- static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
- static LLUIColor map_track_color_under = LLUIColorTable::instance().getColor("MapTrackColorUnder", LLColor4::white);
-
- // Arbitary location beacon
- if( instance()->mIsTrackingLocation )
- {
- if (!instance()->mBeaconText)
- {
- instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
- instance()->mBeaconText->setDoFade(FALSE);
- }
-
- LLVector3d pos_global = instance()->mTrackedPositionGlobal;
- // (z-attenuation < 1) means compute "shorter" distance in z-axis,
- // so cancel tracking even if avatar is a little above or below.
- F32 dist = gFloaterWorldMap->getDistanceToDestination(pos_global, 0.5f);
- if (dist < DESTINATION_REACHED_RADIUS)
- {
- instance()->stopTrackingLocation(false,true);
- }
- else
- {
- renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, map_track_color_under,
- instance()->mBeaconText, instance()->mTrackedLocationName );
- }
- }
-
- // Landmark beacon
- else if( !instance()->mTrackedLandmarkAssetID.isNull() )
- {
- if (!instance()->mBeaconText)
- {
- instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
- instance()->mBeaconText->setDoFade(FALSE);
- }
-
- if (instance()->mHasLandmarkPosition)
- {
- F32 dist = gFloaterWorldMap->getDistanceToDestination(instance()->mTrackedPositionGlobal, 1.0f);
-
- if ( !instance()->mLandmarkHasBeenVisited
- && dist < DESTINATION_VISITED_RADIUS )
- {
- // its close enough ==> flag as visited
- instance()->setLandmarkVisited();
- }
-
- if ( !instance()->mHasReachedLandmark
- && dist < DESTINATION_REACHED_RADIUS )
- {
- // its VERY CLOSE ==> automatically stop tracking
- instance()->stopTrackingLandmark();
- }
- else
- {
- if ( instance()->mHasReachedLandmark
- && dist > DESTINATION_UNVISITED_RADIUS )
- {
- // this is so that landmark beacons don't immediately
- // disappear when they're created only a few meters
- // away, yet disappear when the agent wanders away
- // and back again
- instance()->mHasReachedLandmark = FALSE;
- }
- renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, map_track_color_under,
- instance()->mBeaconText, instance()->mTrackedLandmarkName );
- }
- }
- else
- {
- // probably just finished downloading the asset
- instance()->cacheLandmarkPosition();
- }
- }
- else
- {
- // Avatar beacon
- LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
- if(av_tracker.haveTrackingInfo())
- {
- if (!instance()->mBeaconText)
- {
- instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
- instance()->mBeaconText->setDoFade(FALSE);
- }
-
- F32 dist = gFloaterWorldMap->getDistanceToDestination(instance()->getTrackedPositionGlobal(), 0.0f);
- if (dist < DESTINATION_REACHED_RADIUS)
- {
- instance()->stopTrackingAvatar();
- }
- else
- {
- renderBeacon( av_tracker.getGlobalPos(), map_track_color, map_track_color_under,
- instance()->mBeaconText, av_tracker.getName() );
- }
- }
- else
- {
- BOOL stop_tracking = FALSE;
- const LLUUID& avatar_id = av_tracker.getAvatarID();
- if(avatar_id.isNull())
- {
- stop_tracking = TRUE;
- }
- else
- {
- const LLRelationship* buddy = av_tracker.getBuddyInfo(avatar_id);
- if(buddy && !buddy->isOnline() && !gAgent.isGodlike())
- {
- stop_tracking = TRUE;
- }
- if(!buddy && !gAgent.isGodlike())
- {
- stop_tracking = TRUE;
- }
- }
- if(stop_tracking)
- {
- instance()->stopTrackingAvatar();
- }
- }
- }
+ if (!gFloaterWorldMap || !gSavedSettings.getBOOL("RenderTrackerBeacon"))
+ {
+ return;
+ }
+
+ static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
+ static LLUIColor map_track_color_under = LLUIColorTable::instance().getColor("MapTrackColorUnder", LLColor4::white);
+
+ // Arbitary location beacon
+ if( instance()->mIsTrackingLocation )
+ {
+ if (!instance()->mBeaconText)
+ {
+ instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
+ instance()->mBeaconText->setDoFade(FALSE);
+ }
+
+ LLVector3d pos_global = instance()->mTrackedPositionGlobal;
+ // (z-attenuation < 1) means compute "shorter" distance in z-axis,
+ // so cancel tracking even if avatar is a little above or below.
+ F32 dist = gFloaterWorldMap->getDistanceToDestination(pos_global, 0.5f);
+ if (dist < DESTINATION_REACHED_RADIUS)
+ {
+ instance()->stopTrackingLocation(false,true);
+ }
+ else
+ {
+ renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, map_track_color_under,
+ instance()->mBeaconText, instance()->mTrackedLocationName );
+ }
+ }
+
+ // Landmark beacon
+ else if( !instance()->mTrackedLandmarkAssetID.isNull() )
+ {
+ if (!instance()->mBeaconText)
+ {
+ instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
+ instance()->mBeaconText->setDoFade(FALSE);
+ }
+
+ if (instance()->mHasLandmarkPosition)
+ {
+ F32 dist = gFloaterWorldMap->getDistanceToDestination(instance()->mTrackedPositionGlobal, 1.0f);
+
+ if ( !instance()->mLandmarkHasBeenVisited
+ && dist < DESTINATION_VISITED_RADIUS )
+ {
+ // its close enough ==> flag as visited
+ instance()->setLandmarkVisited();
+ }
+
+ if ( !instance()->mHasReachedLandmark
+ && dist < DESTINATION_REACHED_RADIUS )
+ {
+ // its VERY CLOSE ==> automatically stop tracking
+ instance()->stopTrackingLandmark();
+ }
+ else
+ {
+ if ( instance()->mHasReachedLandmark
+ && dist > DESTINATION_UNVISITED_RADIUS )
+ {
+ // this is so that landmark beacons don't immediately
+ // disappear when they're created only a few meters
+ // away, yet disappear when the agent wanders away
+ // and back again
+ instance()->mHasReachedLandmark = FALSE;
+ }
+ renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, map_track_color_under,
+ instance()->mBeaconText, instance()->mTrackedLandmarkName );
+ }
+ }
+ else
+ {
+ // probably just finished downloading the asset
+ instance()->cacheLandmarkPosition();
+ }
+ }
+ else
+ {
+ // Avatar beacon
+ LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
+ if(av_tracker.haveTrackingInfo())
+ {
+ if (!instance()->mBeaconText)
+ {
+ instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
+ instance()->mBeaconText->setDoFade(FALSE);
+ }
+
+ F32 dist = gFloaterWorldMap->getDistanceToDestination(instance()->getTrackedPositionGlobal(), 0.0f);
+ if (dist < DESTINATION_REACHED_RADIUS)
+ {
+ instance()->stopTrackingAvatar();
+ }
+ else
+ {
+ renderBeacon( av_tracker.getGlobalPos(), map_track_color, map_track_color_under,
+ instance()->mBeaconText, av_tracker.getName() );
+ }
+ }
+ else
+ {
+ BOOL stop_tracking = FALSE;
+ const LLUUID& avatar_id = av_tracker.getAvatarID();
+ if(avatar_id.isNull())
+ {
+ stop_tracking = TRUE;
+ }
+ else
+ {
+ const LLRelationship* buddy = av_tracker.getBuddyInfo(avatar_id);
+ if(buddy && !buddy->isOnline() && !gAgent.isGodlike())
+ {
+ stop_tracking = TRUE;
+ }
+ if(!buddy && !gAgent.isGodlike())
+ {
+ stop_tracking = TRUE;
+ }
+ }
+ if(stop_tracking)
+ {
+ instance()->stopTrackingAvatar();
+ }
+ }
+ }
}
-// static
+// static
void LLTracker::trackAvatar( const LLUUID& avatar_id, const std::string& name )
{
- instance()->stopTrackingLandmark();
- instance()->stopTrackingLocation();
-
- LLAvatarTracker::instance().track( avatar_id, name );
- instance()->mTrackingStatus = TRACKING_AVATAR;
- instance()->mLabel = name;
- instance()->mToolTip = "";
+ instance()->stopTrackingLandmark();
+ instance()->stopTrackingLocation();
+
+ LLAvatarTracker::instance().track( avatar_id, name );
+ instance()->mTrackingStatus = TRACKING_AVATAR;
+ instance()->mLabel = name;
+ instance()->mToolTip = "";
}
-// static
+// static
void LLTracker::trackLandmark( const LLUUID& asset_id, const LLUUID& item_id, const std::string& name)
{
- instance()->stopTrackingAvatar();
- instance()->stopTrackingLocation();
-
- instance()->mTrackedLandmarkAssetID = asset_id;
- instance()->mTrackedLandmarkItemID = item_id;
- instance()->mTrackedLandmarkName = name;
- instance()->cacheLandmarkPosition();
- instance()->mTrackingStatus = TRACKING_LANDMARK;
- instance()->mLabel = name;
- instance()->mToolTip = "";
+ instance()->stopTrackingAvatar();
+ instance()->stopTrackingLocation();
+
+ instance()->mTrackedLandmarkAssetID = asset_id;
+ instance()->mTrackedLandmarkItemID = item_id;
+ instance()->mTrackedLandmarkName = name;
+ instance()->cacheLandmarkPosition();
+ instance()->mTrackingStatus = TRACKING_LANDMARK;
+ instance()->mLabel = name;
+ instance()->mToolTip = "";
}
-// static
+// static
void LLTracker::trackLocation(const LLVector3d& pos_global, const std::string& full_name, const std::string& tooltip, ETrackingLocationType location_type)
{
- instance()->stopTrackingAvatar();
- instance()->stopTrackingLandmark();
-
- instance()->mTrackedPositionGlobal = pos_global;
- instance()->mTrackedLocationName = full_name;
- instance()->mIsTrackingLocation = TRUE;
- instance()->mTrackingStatus = TRACKING_LOCATION;
- instance()->mTrackingLocationType = location_type;
- instance()->mLabel = full_name;
- instance()->mToolTip = tooltip;
+ instance()->stopTrackingAvatar();
+ instance()->stopTrackingLandmark();
+
+ instance()->mTrackedPositionGlobal = pos_global;
+ instance()->mTrackedLocationName = full_name;
+ instance()->mIsTrackingLocation = TRUE;
+ instance()->mTrackingStatus = TRACKING_LOCATION;
+ instance()->mTrackingLocationType = location_type;
+ instance()->mLabel = full_name;
+ instance()->mToolTip = tooltip;
}
-// static
+// static
BOOL LLTracker::handleMouseDown(S32 x, S32 y)
{
- BOOL eat_mouse_click = FALSE;
- // fortunately, we can always compute the tracking arrow center
- S32 dist_sqrd = (x - instance()->mHUDArrowCenterX) * (x - instance()->mHUDArrowCenterX) +
- (y - instance()->mHUDArrowCenterY) * (y - instance()->mHUDArrowCenterY);
- if (dist_sqrd < ARROW_OFF_RADIUS_SQRD)
- {
- /* tracking autopilot destination has been disabled
- -- 2004.01.09, Leviathan
- // turn off tracking
- if (gAgent.getAutoPilot())
- {
- gAgent.stopAutoPilot(TRUE); // TRUE because cancelled by user
- eat_mouse_click = TRUE;
- }
- */
- if (getTrackingStatus())
- {
- instance()->stopTrackingAll();
- eat_mouse_click = TRUE;
- }
- }
- return eat_mouse_click;
+ BOOL eat_mouse_click = FALSE;
+ // fortunately, we can always compute the tracking arrow center
+ S32 dist_sqrd = (x - instance()->mHUDArrowCenterX) * (x - instance()->mHUDArrowCenterX) +
+ (y - instance()->mHUDArrowCenterY) * (y - instance()->mHUDArrowCenterY);
+ if (dist_sqrd < ARROW_OFF_RADIUS_SQRD)
+ {
+ /* tracking autopilot destination has been disabled
+ -- 2004.01.09, Leviathan
+ // turn off tracking
+ if (gAgent.getAutoPilot())
+ {
+ gAgent.stopAutoPilot(TRUE); // TRUE because cancelled by user
+ eat_mouse_click = TRUE;
+ }
+ */
+ if (getTrackingStatus())
+ {
+ instance()->stopTrackingAll();
+ eat_mouse_click = TRUE;
+ }
+ }
+ return eat_mouse_click;
}
-// static
+// static
LLVector3d LLTracker::getTrackedPositionGlobal()
{
- LLVector3d pos_global;
- switch (getTrackingStatus())
- {
- case TRACKING_AVATAR:
- {
- LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
- if (av_tracker.haveTrackingInfo())
- {
- pos_global = av_tracker.getGlobalPos(); }
- break;
- }
- case TRACKING_LANDMARK:
- if( instance()->mHasLandmarkPosition )
- {
- pos_global = instance()->mTrackedPositionGlobal;
- }
- break;
- case TRACKING_LOCATION:
- pos_global = instance()->mTrackedPositionGlobal;
- break;
- default:
- break;
- }
- return pos_global;
+ LLVector3d pos_global;
+ switch (getTrackingStatus())
+ {
+ case TRACKING_AVATAR:
+ {
+ LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
+ if (av_tracker.haveTrackingInfo())
+ {
+ pos_global = av_tracker.getGlobalPos(); }
+ break;
+ }
+ case TRACKING_LANDMARK:
+ if( instance()->mHasLandmarkPosition )
+ {
+ pos_global = instance()->mTrackedPositionGlobal;
+ }
+ break;
+ case TRACKING_LOCATION:
+ pos_global = instance()->mTrackedPositionGlobal;
+ break;
+ default:
+ break;
+ }
+ return pos_global;
}
// static
BOOL LLTracker::hasLandmarkPosition()
{
- if (!instance()->mHasLandmarkPosition)
- {
- // maybe we just received the landmark position info
- instance()->cacheLandmarkPosition();
- }
- return instance()->mHasLandmarkPosition;
+ if (!instance()->mHasLandmarkPosition)
+ {
+ // maybe we just received the landmark position info
+ instance()->cacheLandmarkPosition();
+ }
+ return instance()->mHasLandmarkPosition;
}
// static
const std::string& LLTracker::getTrackedLocationName()
{
- return instance()->mTrackedLocationName;
+ return instance()->mTrackedLocationName;
}
F32 pulse_func(F32 t, F32 z, bool tracking_avatar, std::string direction)
{
- if (!LLTracker::sCheesyBeacon)
- {
- return 0.f;
- }
-
- t *= F_PI;
- if ("DOWN" == direction)
- {
- z += t*64.f - 256.f;
- }
- else
- {
- z -= t*64.f - 256.f;
- }
-
- F32 a = cosf(z*F_PI/512.f)*10.0f;
- a = llmax(a, 9.9f);
- a -= 9.9f;
- a *= 10.f;
- return a;
+ if (!LLTracker::sCheesyBeacon)
+ {
+ return 0.f;
+ }
+
+ t *= F_PI;
+ if ("DOWN" == direction)
+ {
+ z += t*64.f - 256.f;
+ }
+ else
+ {
+ z -= t*64.f - 256.f;
+ }
+
+ F32 a = cosf(z*F_PI/512.f)*10.0f;
+ a = llmax(a, 9.9f);
+ a -= 9.9f;
+ a *= 10.f;
+ return a;
}
void draw_shockwave(F32 center_z, F32 t, S32 steps, LLColor4 color)
{
- if (!LLTracker::sCheesyBeacon)
- {
- return;
- }
-
- t *= 0.6284f/F_PI;
-
- t -= (F32) (S32) t;
-
- t = llmax(t, 0.5f);
- t -= 0.5f;
- t *= 2.0f;
-
- F32 radius = t*16536.f;
-
- // Inexact, but reasonably fast.
- F32 delta = F_TWO_PI / steps;
- F32 sin_delta = sin( delta );
- F32 cos_delta = cos( delta );
- F32 x = radius;
- F32 y = 0.f;
-
- LLColor4 ccol = LLColor4(1,1,1,(1.f-t)*0.25f);
- gGL.begin(LLRender::TRIANGLE_FAN);
- gGL.color4fv(ccol.mV);
- gGL.vertex3f(0.f, 0.f, center_z);
- // make sure circle is complete
- steps += 1;
-
- color.mV[3] = (1.f-t*t);
-
- gGL.color4fv(color.mV);
- while( steps-- )
- {
- // Successive rotations
- gGL.vertex3f( x, y, center_z );
- F32 x_new = x * cos_delta - y * sin_delta;
- y = x * sin_delta + y * cos_delta;
- x = x_new;
- }
- gGL.end();
+ if (!LLTracker::sCheesyBeacon)
+ {
+ return;
+ }
+
+ t *= 0.6284f/F_PI;
+
+ t -= (F32) (S32) t;
+
+ t = llmax(t, 0.5f);
+ t -= 0.5f;
+ t *= 2.0f;
+
+ F32 radius = t*16536.f;
+
+ // Inexact, but reasonably fast.
+ F32 delta = F_TWO_PI / steps;
+ F32 sin_delta = sin( delta );
+ F32 cos_delta = cos( delta );
+ F32 x = radius;
+ F32 y = 0.f;
+
+ LLColor4 ccol = LLColor4(1,1,1,(1.f-t)*0.25f);
+ gGL.begin(LLRender::TRIANGLE_FAN);
+ gGL.color4fv(ccol.mV);
+ gGL.vertex3f(0.f, 0.f, center_z);
+ // make sure circle is complete
+ steps += 1;
+
+ color.mV[3] = (1.f-t*t);
+
+ gGL.color4fv(color.mV);
+ while( steps-- )
+ {
+ // Successive rotations
+ gGL.vertex3f( x, y, center_z );
+ F32 x_new = x * cos_delta - y * sin_delta;
+ y = x * sin_delta + y * cos_delta;
+ x = x_new;
+ }
+ gGL.end();
}
void LLTracker::drawBeacon(LLVector3 pos_agent, std::string direction, LLColor4 fogged_color, F32 dist)
{
- const U32 BEACON_VERTS = 256;
- F32 step;
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
-
- if ("DOWN" == direction)
- {
- gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
- draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color);
- step = (5020.0f - pos_agent.mV[2]) / BEACON_VERTS;
- }
- else
- {
- gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], 0);
- step = pos_agent.mV[2] / BEACON_VERTS;
- }
-
- gGL.color4fv(fogged_color.mV);
-
- LLVector3 x_axis = LLViewerCamera::getInstance()->getLeftAxis();
- F32 t = gRenderStartTime.getElapsedTimeF32();
-
- for (U32 i = 0; i < BEACON_VERTS; i++)
- {
- F32 x = x_axis.mV[0];
- F32 y = x_axis.mV[1];
-
- F32 z = i * step;
- F32 z_next = (i+1)*step;
-
- bool tracking_avatar = getTrackingStatus() == TRACKING_AVATAR;
- F32 a = pulse_func(t, z, tracking_avatar, direction);
- F32 an = pulse_func(t, z_next, tracking_avatar, direction);
-
- LLColor4 c_col = fogged_color + LLColor4(a,a,a,a);
- LLColor4 col_next = fogged_color + LLColor4(an,an,an,an);
- LLColor4 col_edge = fogged_color * LLColor4(a,a,a,0.0f);
- LLColor4 col_edge_next = fogged_color * LLColor4(an,an,an,0.0f);
-
- a *= 2.f;
- a += 1.0f;
-
- an *= 2.f;
- an += 1.0f;
-
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.color4fv(col_edge.mV);
- gGL.vertex3f(-x*a, -y*a, z);
- gGL.color4fv(col_edge_next.mV);
- gGL.vertex3f(-x*an, -y*an, z_next);
-
- gGL.color4fv(c_col.mV);
- gGL.vertex3f(0, 0, z);
- gGL.color4fv(col_next.mV);
- gGL.vertex3f(0, 0, z_next);
-
- gGL.color4fv(col_edge.mV);
- gGL.vertex3f(x*a,y*a,z);
- gGL.color4fv(col_edge_next.mV);
- gGL.vertex3f(x*an,y*an,z_next);
- gGL.end();
- }
- gGL.popMatrix();
+ const U32 BEACON_VERTS = 256;
+ F32 step;
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+
+ if ("DOWN" == direction)
+ {
+ gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
+ draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color);
+ step = (5020.0f - pos_agent.mV[2]) / BEACON_VERTS;
+ }
+ else
+ {
+ gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], 0);
+ step = pos_agent.mV[2] / BEACON_VERTS;
+ }
+
+ gGL.color4fv(fogged_color.mV);
+
+ LLVector3 x_axis = LLViewerCamera::getInstance()->getLeftAxis();
+ F32 t = gRenderStartTime.getElapsedTimeF32();
+
+ for (U32 i = 0; i < BEACON_VERTS; i++)
+ {
+ F32 x = x_axis.mV[0];
+ F32 y = x_axis.mV[1];
+
+ F32 z = i * step;
+ F32 z_next = (i+1)*step;
+
+ bool tracking_avatar = getTrackingStatus() == TRACKING_AVATAR;
+ F32 a = pulse_func(t, z, tracking_avatar, direction);
+ F32 an = pulse_func(t, z_next, tracking_avatar, direction);
+
+ LLColor4 c_col = fogged_color + LLColor4(a,a,a,a);
+ LLColor4 col_next = fogged_color + LLColor4(an,an,an,an);
+ LLColor4 col_edge = fogged_color * LLColor4(a,a,a,0.0f);
+ LLColor4 col_edge_next = fogged_color * LLColor4(an,an,an,0.0f);
+
+ a *= 2.f;
+ a += 1.0f;
+
+ an *= 2.f;
+ an += 1.0f;
+
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.color4fv(col_edge.mV);
+ gGL.vertex3f(-x*a, -y*a, z);
+ gGL.color4fv(col_edge_next.mV);
+ gGL.vertex3f(-x*an, -y*an, z_next);
+
+ gGL.color4fv(c_col.mV);
+ gGL.vertex3f(0, 0, z);
+ gGL.color4fv(col_next.mV);
+ gGL.vertex3f(0, 0, z_next);
+
+ gGL.color4fv(col_edge.mV);
+ gGL.vertex3f(x*a,y*a,z);
+ gGL.color4fv(col_edge_next.mV);
+ gGL.vertex3f(x*an,y*an,z_next);
+ gGL.end();
+ }
+ gGL.popMatrix();
}
-
-// static
-void LLTracker::renderBeacon(LLVector3d pos_global,
- const LLColor4& color,
- const LLColor4& color_under,
- LLHUDText* hud_textp,
- const std::string& label )
+
+// static
+void LLTracker::renderBeacon(LLVector3d pos_global,
+ const LLColor4& color,
+ const LLColor4& color_under,
+ LLHUDText* hud_textp,
+ const std::string& label )
{
- sCheesyBeacon = gSavedSettings.getBOOL("CheesyBeacon");
- LLVector3d to_vec = pos_global - gAgentCamera.getCameraPositionGlobal();
-
- F32 dist = (F32)to_vec.magVec();
- F32 color_frac = 1.f;
- if (dist > 0.99f * LLViewerCamera::getInstance()->getFar())
- {
- color_frac = 0.4f;
- // pos_global = gAgentCamera.getCameraPositionGlobal() + 0.99f*(LLViewerCamera::getInstance()->getFar()/dist)*to_vec;
- }
- else
- {
- color_frac = 1.f - 0.6f*(dist/LLViewerCamera::getInstance()->getFar());
- }
-
- LLColor4 fogged_color = color_frac * color + (1 - color_frac)*gSky.getSkyFogColor();
- LLColor4 fogged_color_under = color_frac * color_under + (1 - color_frac) * gSky.getSkyFogColor();
-
- F32 FADE_DIST = 3.f;
- fogged_color.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST));
- fogged_color_under.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST));
-
- LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(pos_global);
-
- LLGLSTracker gls_tracker;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDisable cull_face(GL_CULL_FACE);
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
-
- LLTracker::drawBeacon(pos_agent, "DOWN", fogged_color, dist);
- LLTracker::drawBeacon(pos_agent, "UP", fogged_color_under, dist);
-
- std::string text;
- text = llformat( "%.0f m", to_vec.magVec());
-
- std::string str;
- str += label;
- str += '\n';
- str += text;
-
- hud_textp->setFont(LLFontGL::getFontSansSerif());
- hud_textp->setZCompare(FALSE);
- hud_textp->setColor(LLColor4(1.f, 1.f, 1.f, llmax(0.2f, llmin(1.f,(dist-FADE_DIST)/FADE_DIST))));
-
- hud_textp->setString(str);
- hud_textp->setVertAlignment(LLHUDText::ALIGN_VERT_CENTER);
- hud_textp->setPositionAgent(pos_agent);
+ sCheesyBeacon = gSavedSettings.getBOOL("CheesyBeacon");
+ LLVector3d to_vec = pos_global - gAgentCamera.getCameraPositionGlobal();
+
+ F32 dist = (F32)to_vec.magVec();
+ F32 color_frac = 1.f;
+ if (dist > 0.99f * LLViewerCamera::getInstance()->getFar())
+ {
+ color_frac = 0.4f;
+ // pos_global = gAgentCamera.getCameraPositionGlobal() + 0.99f*(LLViewerCamera::getInstance()->getFar()/dist)*to_vec;
+ }
+ else
+ {
+ color_frac = 1.f - 0.6f*(dist/LLViewerCamera::getInstance()->getFar());
+ }
+
+ LLColor4 fogged_color = color_frac * color + (1 - color_frac)*gSky.getSkyFogColor();
+ LLColor4 fogged_color_under = color_frac * color_under + (1 - color_frac) * gSky.getSkyFogColor();
+
+ F32 FADE_DIST = 3.f;
+ fogged_color.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST));
+ fogged_color_under.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST));
+
+ LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(pos_global);
+
+ LLGLSTracker gls_tracker;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDisable cull_face(GL_CULL_FACE);
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+
+ LLTracker::drawBeacon(pos_agent, "DOWN", fogged_color, dist);
+ LLTracker::drawBeacon(pos_agent, "UP", fogged_color_under, dist);
+
+ std::string text;
+ text = llformat( "%.0f m", to_vec.magVec());
+
+ std::string str;
+ str += label;
+ str += '\n';
+ str += text;
+
+ hud_textp->setFont(LLFontGL::getFontSansSerif());
+ hud_textp->setZCompare(FALSE);
+ hud_textp->setColor(LLColor4(1.f, 1.f, 1.f, llmax(0.2f, llmin(1.f,(dist-FADE_DIST)/FADE_DIST))));
+
+ hud_textp->setString(str);
+ hud_textp->setVertAlignment(LLHUDText::ALIGN_VERT_CENTER);
+ hud_textp->setPositionAgent(pos_agent);
}
void LLTracker::stopTrackingAll(bool clear_ui)
{
- switch (mTrackingStatus)
- {
- case TRACKING_AVATAR :
- stopTrackingAvatar(clear_ui);
- break;
- case TRACKING_LANDMARK :
- stopTrackingLandmark(clear_ui);
- break;
- case TRACKING_LOCATION :
- stopTrackingLocation(clear_ui);
- break;
- default:
- mTrackingStatus = TRACKING_NOTHING;
- break;
- }
+ switch (mTrackingStatus)
+ {
+ case TRACKING_AVATAR :
+ stopTrackingAvatar(clear_ui);
+ break;
+ case TRACKING_LANDMARK :
+ stopTrackingLandmark(clear_ui);
+ break;
+ case TRACKING_LOCATION :
+ stopTrackingLocation(clear_ui);
+ break;
+ default:
+ mTrackingStatus = TRACKING_NOTHING;
+ break;
+ }
}
void LLTracker::stopTrackingAvatar(bool clear_ui)
{
- LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
- if( !av_tracker.getAvatarID().isNull() )
- {
- av_tracker.untrack( av_tracker.getAvatarID() );
- }
-
- purgeBeaconText();
- gFloaterWorldMap->clearAvatarSelection(clear_ui);
- mTrackingStatus = TRACKING_NOTHING;
+ LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
+ if( !av_tracker.getAvatarID().isNull() )
+ {
+ av_tracker.untrack( av_tracker.getAvatarID() );
+ }
+
+ purgeBeaconText();
+ gFloaterWorldMap->clearAvatarSelection(clear_ui);
+ mTrackingStatus = TRACKING_NOTHING;
}
void LLTracker::stopTrackingLandmark(bool clear_ui)
{
- purgeBeaconText();
- mTrackedLandmarkAssetID.setNull();
- mTrackedLandmarkItemID.setNull();
- mTrackedLandmarkName.assign("");
- mTrackedPositionGlobal.zeroVec();
- mHasLandmarkPosition = FALSE;
- mHasReachedLandmark = FALSE;
- mLandmarkHasBeenVisited = TRUE;
- gFloaterWorldMap->clearLandmarkSelection(clear_ui);
- mTrackingStatus = TRACKING_NOTHING;
+ purgeBeaconText();
+ mTrackedLandmarkAssetID.setNull();
+ mTrackedLandmarkItemID.setNull();
+ mTrackedLandmarkName.assign("");
+ mTrackedPositionGlobal.zeroVec();
+ mHasLandmarkPosition = FALSE;
+ mHasReachedLandmark = FALSE;
+ mLandmarkHasBeenVisited = TRUE;
+ gFloaterWorldMap->clearLandmarkSelection(clear_ui);
+ mTrackingStatus = TRACKING_NOTHING;
}
void LLTracker::stopTrackingLocation(bool clear_ui, bool dest_reached)
{
- purgeBeaconText();
- mTrackedLocationName.assign("");
- mIsTrackingLocation = FALSE;
- mTrackedPositionGlobal.zeroVec();
- gFloaterWorldMap->clearLocationSelection(clear_ui, dest_reached);
- mTrackingStatus = TRACKING_NOTHING;
- mTrackingLocationType = LOCATION_NOTHING;
+ purgeBeaconText();
+ mTrackedLocationName.assign("");
+ mIsTrackingLocation = FALSE;
+ mTrackedPositionGlobal.zeroVec();
+ gFloaterWorldMap->clearLocationSelection(clear_ui, dest_reached);
+ mTrackingStatus = TRACKING_NOTHING;
+ mTrackingLocationType = LOCATION_NOTHING;
}
void LLTracker::clearFocus()
{
- instance()->mTrackingStatus = TRACKING_NOTHING;
+ instance()->mTrackingStatus = TRACKING_NOTHING;
}
void LLTracker::drawMarker(const LLVector3d& pos_global, const LLColor4& color)
{
- // get position
- LLVector3 pos_local = gAgent.getPosAgentFromGlobal(pos_global);
-
- // check in frustum
- LLCoordGL screen;
- S32 x = 0;
- S32 y = 0;
- const BOOL CLAMP = TRUE;
-
- if (LLViewerCamera::getInstance()->projectPosAgentToScreen(pos_local, screen, CLAMP)
- || LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(pos_local, screen) )
- {
- gHUDView->screenPointToLocal(screen.mX, screen.mY, &x, &y);
-
- // the center of the rendered position of the arrow obeys
- // the following rules:
- // (1) it lies on an ellipse centered on the target position
- // (2) it lies on the line between the target and the window center
- // (3) right now the radii of the ellipse are fixed, but eventually
- // they will be a function of the target text
- //
- // from those rules we can compute the position of the
- // lower left corner of the image
- LLRect rect = gHUDView->getRect();
- S32 x_center = lltrunc(0.5f * (F32)rect.getWidth());
- S32 y_center = lltrunc(0.5f * (F32)rect.getHeight());
- x = x - x_center; // x and y relative to center
- y = y - y_center;
- F32 dist = sqrt((F32)(x*x + y*y));
- S32 half_arrow_size = lltrunc(0.5f * HUD_ARROW_SIZE);
- if (dist > 0.f)
- {
- const F32 ARROW_ELLIPSE_RADIUS_X = 2 * HUD_ARROW_SIZE;
- const F32 ARROW_ELLIPSE_RADIUS_Y = HUD_ARROW_SIZE;
-
- // compute where the arrow should be
- F32 x_target = (F32)(x + x_center) - (ARROW_ELLIPSE_RADIUS_X * ((F32)x / dist) );
- F32 y_target = (F32)(y + y_center) - (ARROW_ELLIPSE_RADIUS_Y * ((F32)y / dist) );
-
- // keep the arrow within the window
- F32 x_clamped = llclamp( x_target, (F32)half_arrow_size, (F32)(rect.getWidth() - half_arrow_size));
- F32 y_clamped = llclamp( y_target, (F32)half_arrow_size, (F32)(rect.getHeight() - half_arrow_size));
-
- F32 slope = (F32)(y) / (F32)(x);
- F32 window_ratio = (F32)(rect.getHeight() - HUD_ARROW_SIZE) / (F32)(rect.getWidth() - HUD_ARROW_SIZE);
-
- // if the arrow has been clamped on one axis
- // then we need to compute the other axis
- if (llabs(slope) > window_ratio)
- {
- if (y_clamped != (F32)y_target)
- {
- // clamp by y
- x_clamped = (y_clamped - (F32)y_center) / slope + (F32)x_center;
- }
- }
- else if (x_clamped != (F32)x_target)
- {
- // clamp by x
- y_clamped = (x_clamped - (F32)x_center) * slope + (F32)y_center;
- }
- mHUDArrowCenterX = lltrunc(x_clamped);
- mHUDArrowCenterY = lltrunc(y_clamped);
- }
- else
- {
- // recycle the old values
- x = mHUDArrowCenterX - x_center;
- y = mHUDArrowCenterY - y_center;
- }
-
- F32 angle = atan2( (F32)y, (F32)x );
-
- gl_draw_scaled_rotated_image(mHUDArrowCenterX - half_arrow_size,
- mHUDArrowCenterY - half_arrow_size,
- HUD_ARROW_SIZE, HUD_ARROW_SIZE,
- RAD_TO_DEG * angle,
- LLWorldMapView::sTrackArrowImage->getImage(),
- color);
- }
+ // get position
+ LLVector3 pos_local = gAgent.getPosAgentFromGlobal(pos_global);
+
+ // check in frustum
+ LLCoordGL screen;
+ S32 x = 0;
+ S32 y = 0;
+ const BOOL CLAMP = TRUE;
+
+ if (LLViewerCamera::getInstance()->projectPosAgentToScreen(pos_local, screen, CLAMP)
+ || LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(pos_local, screen) )
+ {
+ gHUDView->screenPointToLocal(screen.mX, screen.mY, &x, &y);
+
+ // the center of the rendered position of the arrow obeys
+ // the following rules:
+ // (1) it lies on an ellipse centered on the target position
+ // (2) it lies on the line between the target and the window center
+ // (3) right now the radii of the ellipse are fixed, but eventually
+ // they will be a function of the target text
+ //
+ // from those rules we can compute the position of the
+ // lower left corner of the image
+ LLRect rect = gHUDView->getRect();
+ S32 x_center = lltrunc(0.5f * (F32)rect.getWidth());
+ S32 y_center = lltrunc(0.5f * (F32)rect.getHeight());
+ x = x - x_center; // x and y relative to center
+ y = y - y_center;
+ F32 dist = sqrt((F32)(x*x + y*y));
+ S32 half_arrow_size = lltrunc(0.5f * HUD_ARROW_SIZE);
+ if (dist > 0.f)
+ {
+ const F32 ARROW_ELLIPSE_RADIUS_X = 2 * HUD_ARROW_SIZE;
+ const F32 ARROW_ELLIPSE_RADIUS_Y = HUD_ARROW_SIZE;
+
+ // compute where the arrow should be
+ F32 x_target = (F32)(x + x_center) - (ARROW_ELLIPSE_RADIUS_X * ((F32)x / dist) );
+ F32 y_target = (F32)(y + y_center) - (ARROW_ELLIPSE_RADIUS_Y * ((F32)y / dist) );
+
+ // keep the arrow within the window
+ F32 x_clamped = llclamp( x_target, (F32)half_arrow_size, (F32)(rect.getWidth() - half_arrow_size));
+ F32 y_clamped = llclamp( y_target, (F32)half_arrow_size, (F32)(rect.getHeight() - half_arrow_size));
+
+ F32 slope = (F32)(y) / (F32)(x);
+ F32 window_ratio = (F32)(rect.getHeight() - HUD_ARROW_SIZE) / (F32)(rect.getWidth() - HUD_ARROW_SIZE);
+
+ // if the arrow has been clamped on one axis
+ // then we need to compute the other axis
+ if (llabs(slope) > window_ratio)
+ {
+ if (y_clamped != (F32)y_target)
+ {
+ // clamp by y
+ x_clamped = (y_clamped - (F32)y_center) / slope + (F32)x_center;
+ }
+ }
+ else if (x_clamped != (F32)x_target)
+ {
+ // clamp by x
+ y_clamped = (x_clamped - (F32)x_center) * slope + (F32)y_center;
+ }
+ mHUDArrowCenterX = lltrunc(x_clamped);
+ mHUDArrowCenterY = lltrunc(y_clamped);
+ }
+ else
+ {
+ // recycle the old values
+ x = mHUDArrowCenterX - x_center;
+ y = mHUDArrowCenterY - y_center;
+ }
+
+ F32 angle = atan2( (F32)y, (F32)x );
+
+ gl_draw_scaled_rotated_image(mHUDArrowCenterX - half_arrow_size,
+ mHUDArrowCenterY - half_arrow_size,
+ HUD_ARROW_SIZE, HUD_ARROW_SIZE,
+ RAD_TO_DEG * angle,
+ LLWorldMapView::sTrackArrowImage->getImage(),
+ color);
+ }
}
void LLTracker::setLandmarkVisited()
{
- // poke the inventory item
- if (!mTrackedLandmarkItemID.isNull())
- {
- LLInventoryItem* i = gInventory.getItem( mTrackedLandmarkItemID );
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)i;
- if ( item
- && !(item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED))
- {
- U32 flags = item->getFlags();
- flags |= LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED;
- item->setFlags(flags);
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ChangeInventoryItemFlags");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("InventoryData");
- msg->addUUID("ItemID", mTrackedLandmarkItemID);
- msg->addU32("Flags", flags);
- gAgent.sendReliableMessage();
-
- LLInventoryModel::LLCategoryUpdate up(item->getParentUUID(), 0);
- gInventory.accountForUpdate(up);
-
- // need to communicate that the icon needs to change...
- gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item->getUUID());
- gInventory.notifyObservers();
- }
- }
+ // poke the inventory item
+ if (!mTrackedLandmarkItemID.isNull())
+ {
+ LLInventoryItem* i = gInventory.getItem( mTrackedLandmarkItemID );
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)i;
+ if ( item
+ && !(item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED))
+ {
+ U32 flags = item->getFlags();
+ flags |= LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED;
+ item->setFlags(flags);
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ChangeInventoryItemFlags");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("InventoryData");
+ msg->addUUID("ItemID", mTrackedLandmarkItemID);
+ msg->addU32("Flags", flags);
+ gAgent.sendReliableMessage();
+
+ LLInventoryModel::LLCategoryUpdate up(item->getParentUUID(), 0);
+ gInventory.accountForUpdate(up);
+
+ // need to communicate that the icon needs to change...
+ gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item->getUUID());
+ gInventory.notifyObservers();
+ }
+ }
}
void LLTracker::cacheLandmarkPosition()
{
- // the landmark asset download may have finished, in which case
- // we'll now be able to figure out where we're trying to go
- BOOL found_landmark = FALSE;
- if( mTrackedLandmarkAssetID == LLFloaterWorldMap::getHomeID())
- {
- LLVector3d pos_global;
- if ( gAgent.getHomePosGlobal( &mTrackedPositionGlobal ))
- {
- found_landmark = TRUE;
- }
- else
- {
- LL_WARNS() << "LLTracker couldn't find home pos" << LL_ENDL;
- mTrackedLandmarkAssetID.setNull();
- mTrackedLandmarkItemID.setNull();
- }
- }
- else
- {
- LLLandmark* landmark = gLandmarkList.getAsset(mTrackedLandmarkAssetID);
- if(landmark && landmark->getGlobalPos(mTrackedPositionGlobal))
- {
- found_landmark = TRUE;
-
- // cache the object's visitation status
- mLandmarkHasBeenVisited = FALSE;
- LLInventoryItem* item = gInventory.getItem(mTrackedLandmarkItemID);
- if ( item
- && item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED)
- {
- mLandmarkHasBeenVisited = TRUE;
- }
- }
- }
- if ( found_landmark && gFloaterWorldMap )
- {
- mHasReachedLandmark = FALSE;
- F32 dist = gFloaterWorldMap->getDistanceToDestination(mTrackedPositionGlobal, 1.0f);
- if ( dist < DESTINATION_UNVISITED_RADIUS )
- {
- mHasReachedLandmark = TRUE;
- }
- mHasLandmarkPosition = TRUE;
- }
- mHasLandmarkPosition = found_landmark;
+ // the landmark asset download may have finished, in which case
+ // we'll now be able to figure out where we're trying to go
+ BOOL found_landmark = FALSE;
+ if( mTrackedLandmarkAssetID == LLFloaterWorldMap::getHomeID())
+ {
+ LLVector3d pos_global;
+ if ( gAgent.getHomePosGlobal( &mTrackedPositionGlobal ))
+ {
+ found_landmark = TRUE;
+ }
+ else
+ {
+ LL_WARNS() << "LLTracker couldn't find home pos" << LL_ENDL;
+ mTrackedLandmarkAssetID.setNull();
+ mTrackedLandmarkItemID.setNull();
+ }
+ }
+ else
+ {
+ LLLandmark* landmark = gLandmarkList.getAsset(mTrackedLandmarkAssetID);
+ if(landmark && landmark->getGlobalPos(mTrackedPositionGlobal))
+ {
+ found_landmark = TRUE;
+
+ // cache the object's visitation status
+ mLandmarkHasBeenVisited = FALSE;
+ LLInventoryItem* item = gInventory.getItem(mTrackedLandmarkItemID);
+ if ( item
+ && item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED)
+ {
+ mLandmarkHasBeenVisited = TRUE;
+ }
+ }
+ }
+ if ( found_landmark && gFloaterWorldMap )
+ {
+ mHasReachedLandmark = FALSE;
+ F32 dist = gFloaterWorldMap->getDistanceToDestination(mTrackedPositionGlobal, 1.0f);
+ if ( dist < DESTINATION_UNVISITED_RADIUS )
+ {
+ mHasReachedLandmark = TRUE;
+ }
+ mHasLandmarkPosition = TRUE;
+ }
+ mHasLandmarkPosition = found_landmark;
}
void LLTracker::purgeBeaconText()
{
- if(!mBeaconText.isNull())
- {
- mBeaconText->markDead();
- mBeaconText = NULL;
- }
+ if(!mBeaconText.isNull())
+ {
+ mBeaconText->markDead();
+ mBeaconText = NULL;
+ }
}
diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h
index 4a6f10b767..c22432abb9 100644
--- a/indra/newview/lltracker.h
+++ b/indra/newview/lltracker.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltracker.h
* @brief Container for objects user is tracking.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
// A singleton class for tracking stuff.
//
// TODO -- LLAvatarTracker functionality should probably be moved
-// to the LLTracker class.
+// to the LLTracker class.
#ifndef LL_LLTRACKER_H
@@ -44,110 +44,110 @@ class LLHUDText;
class LLTracker
{
public:
- enum ETrackingStatus
- {
- TRACKING_NOTHING = 0,
- TRACKING_AVATAR = 1,
- TRACKING_LANDMARK = 2,
- TRACKING_LOCATION = 3,
- };
-
- enum ETrackingLocationType
- {
- LOCATION_NOTHING,
- LOCATION_EVENT,
- LOCATION_ITEM,
- };
-
- static LLTracker* instance()
- {
- if (!sTrackerp)
- {
- sTrackerp = new LLTracker();
- }
- return sTrackerp;
- }
-
- static void cleanupInstance() { delete sTrackerp; sTrackerp = NULL; }
-
- //static void drawTrackerArrow();
- // these are static so that they can be used a callbacks
- static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; }
- static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; }
- static bool isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; }
- static void stopTracking(bool);
- static void clearFocus();
-
- static const LLUUID& getTrackedLandmarkAssetID() { return instance()->mTrackedLandmarkAssetID; }
- static const LLUUID& getTrackedLandmarkItemID() { return instance()->mTrackedLandmarkItemID; }
-
- static void trackAvatar( const LLUUID& avatar_id, const std::string& name );
- static void trackLandmark( const LLUUID& landmark_asset_id, const LLUUID& landmark_item_id , const std::string& name);
- static void trackLocation(const LLVector3d& pos, const std::string& full_name, const std::string& tooltip, ETrackingLocationType location_type = LOCATION_NOTHING);
-
- // returns global pos of tracked thing
- static LLVector3d getTrackedPositionGlobal();
-
- static BOOL hasLandmarkPosition();
- static const std::string& getTrackedLocationName();
-
- static void drawHUDArrow();
-
- // Draw in-world 3D tracking stuff
- static void render3D();
-
- static BOOL handleMouseDown(S32 x, S32 y);
-
- static LLTracker* sTrackerp;
- static BOOL sCheesyBeacon;
-
- static const std::string& getLabel() { return instance()->mLabel; }
- static const std::string& getToolTip() { return instance()->mToolTip; }
+ enum ETrackingStatus
+ {
+ TRACKING_NOTHING = 0,
+ TRACKING_AVATAR = 1,
+ TRACKING_LANDMARK = 2,
+ TRACKING_LOCATION = 3,
+ };
+
+ enum ETrackingLocationType
+ {
+ LOCATION_NOTHING,
+ LOCATION_EVENT,
+ LOCATION_ITEM,
+ };
+
+ static LLTracker* instance()
+ {
+ if (!sTrackerp)
+ {
+ sTrackerp = new LLTracker();
+ }
+ return sTrackerp;
+ }
+
+ static void cleanupInstance() { delete sTrackerp; sTrackerp = NULL; }
+
+ //static void drawTrackerArrow();
+ // these are static so that they can be used a callbacks
+ static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; }
+ static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; }
+ static bool isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; }
+ static void stopTracking(bool);
+ static void clearFocus();
+
+ static const LLUUID& getTrackedLandmarkAssetID() { return instance()->mTrackedLandmarkAssetID; }
+ static const LLUUID& getTrackedLandmarkItemID() { return instance()->mTrackedLandmarkItemID; }
+
+ static void trackAvatar( const LLUUID& avatar_id, const std::string& name );
+ static void trackLandmark( const LLUUID& landmark_asset_id, const LLUUID& landmark_item_id , const std::string& name);
+ static void trackLocation(const LLVector3d& pos, const std::string& full_name, const std::string& tooltip, ETrackingLocationType location_type = LOCATION_NOTHING);
+
+ // returns global pos of tracked thing
+ static LLVector3d getTrackedPositionGlobal();
+
+ static BOOL hasLandmarkPosition();
+ static const std::string& getTrackedLocationName();
+
+ static void drawHUDArrow();
+
+ // Draw in-world 3D tracking stuff
+ static void render3D();
+
+ static BOOL handleMouseDown(S32 x, S32 y);
+
+ static LLTracker* sTrackerp;
+ static BOOL sCheesyBeacon;
+
+ static const std::string& getLabel() { return instance()->mLabel; }
+ static const std::string& getToolTip() { return instance()->mToolTip; }
protected:
- LLTracker();
- ~LLTracker();
-
- static void drawBeacon(LLVector3 pos_agent, std::string direction, LLColor4 fogged_color, F32 dist);
- static void renderBeacon( LLVector3d pos_global,
- const LLColor4& color,
- const LLColor4& color_under,
- LLHUDText* hud_textp,
- const std::string& label );
-
- void stopTrackingAll(bool clear_ui = false);
- void stopTrackingAvatar(bool clear_ui = false);
- void stopTrackingLocation(bool clear_ui = false, bool dest_reached = false);
- void stopTrackingLandmark(bool clear_ui = false);
-
- void drawMarker(const LLVector3d& pos_global, const LLColor4& color);
- void setLandmarkVisited();
- void cacheLandmarkPosition();
- void purgeBeaconText();
+ LLTracker();
+ ~LLTracker();
+
+ static void drawBeacon(LLVector3 pos_agent, std::string direction, LLColor4 fogged_color, F32 dist);
+ static void renderBeacon( LLVector3d pos_global,
+ const LLColor4& color,
+ const LLColor4& color_under,
+ LLHUDText* hud_textp,
+ const std::string& label );
+
+ void stopTrackingAll(bool clear_ui = false);
+ void stopTrackingAvatar(bool clear_ui = false);
+ void stopTrackingLocation(bool clear_ui = false, bool dest_reached = false);
+ void stopTrackingLandmark(bool clear_ui = false);
+
+ void drawMarker(const LLVector3d& pos_global, const LLColor4& color);
+ void setLandmarkVisited();
+ void cacheLandmarkPosition();
+ void purgeBeaconText();
protected:
- ETrackingStatus mTrackingStatus;
- ETrackingLocationType mTrackingLocationType;
- LLPointer<LLHUDText> mBeaconText;
- S32 mHUDArrowCenterX;
- S32 mHUDArrowCenterY;
-
- LLVector3d mTrackedPositionGlobal;
-
- std::string mLabel;
- std::string mToolTip;
-
- std::string mTrackedLandmarkName;
- LLUUID mTrackedLandmarkAssetID;
- LLUUID mTrackedLandmarkItemID;
- std::vector<LLUUID> mLandmarkAssetIDList;
- std::vector<LLUUID> mLandmarkItemIDList;
- BOOL mHasReachedLandmark;
- BOOL mHasLandmarkPosition;
- BOOL mLandmarkHasBeenVisited;
-
- std::string mTrackedLocationName;
- BOOL mIsTrackingLocation;
- BOOL mHasReachedLocation;
+ ETrackingStatus mTrackingStatus;
+ ETrackingLocationType mTrackingLocationType;
+ LLPointer<LLHUDText> mBeaconText;
+ S32 mHUDArrowCenterX;
+ S32 mHUDArrowCenterY;
+
+ LLVector3d mTrackedPositionGlobal;
+
+ std::string mLabel;
+ std::string mToolTip;
+
+ std::string mTrackedLandmarkName;
+ LLUUID mTrackedLandmarkAssetID;
+ LLUUID mTrackedLandmarkItemID;
+ std::vector<LLUUID> mLandmarkAssetIDList;
+ std::vector<LLUUID> mLandmarkItemIDList;
+ BOOL mHasReachedLandmark;
+ BOOL mHasLandmarkPosition;
+ BOOL mLandmarkHasBeenVisited;
+
+ std::string mTrackedLocationName;
+ BOOL mIsTrackingLocation;
+ BOOL mHasReachedLocation;
};
diff --git a/indra/newview/lltrackpicker.cpp b/indra/newview/lltrackpicker.cpp
index fe6256a8a9..36ca93a801 100644
--- a/indra/newview/lltrackpicker.cpp
+++ b/indra/newview/lltrackpicker.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @author AndreyK Productengine
* @brief LLTrackPicker class header file including related functions
*
diff --git a/indra/newview/lltrackpicker.h b/indra/newview/lltrackpicker.h
index dab3b72915..a00cc87c51 100644
--- a/indra/newview/lltrackpicker.h
+++ b/indra/newview/lltrackpicker.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file lltrackpicker.h
* @author AndreyK Productengine
* @brief LLTrackPicker class header file including related functions
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2018&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2018, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/lltransientdockablefloater.cpp b/indra/newview/lltransientdockablefloater.cpp
index c108f1dfdc..4fb4edb0e6 100644
--- a/indra/newview/lltransientdockablefloater.cpp
+++ b/indra/newview/lltransientdockablefloater.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltransientdockablefloater.cpp
* @brief Creates a panel of a specific kind for a toast
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,68 +32,68 @@
LLTransientDockableFloater::LLTransientDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
- const LLSD& key, const Params& params) :
- LLDockableFloater(dockControl, uniqueDocking, key, params)
+ const LLSD& key, const Params& params) :
+ LLDockableFloater(dockControl, uniqueDocking, key, params)
{
- LLTransientFloaterMgr::getInstance()->registerTransientFloater(this);
- LLTransientFloater::init(this);
+ LLTransientFloaterMgr::getInstance()->registerTransientFloater(this);
+ LLTransientFloater::init(this);
}
LLTransientDockableFloater::~LLTransientDockableFloater()
{
- LLTransientFloaterMgr::getInstance()->unregisterTransientFloater(this);
- LLView* dock = getDockWidget();
- LLTransientFloaterMgr::getInstance()->removeControlView(
- LLTransientFloaterMgr::DOCKED, this);
- if (dock != NULL)
- {
- LLTransientFloaterMgr::getInstance()->removeControlView(
- LLTransientFloaterMgr::DOCKED, dock);
- }
+ LLTransientFloaterMgr::getInstance()->unregisterTransientFloater(this);
+ LLView* dock = getDockWidget();
+ LLTransientFloaterMgr::getInstance()->removeControlView(
+ LLTransientFloaterMgr::DOCKED, this);
+ if (dock != NULL)
+ {
+ LLTransientFloaterMgr::getInstance()->removeControlView(
+ LLTransientFloaterMgr::DOCKED, dock);
+ }
}
void LLTransientDockableFloater::setVisible(BOOL visible)
{
- LLView* dock = getDockWidget();
- if(visible && isDocked())
- {
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, this);
- if (dock != NULL)
- {
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, dock);
- }
- }
- else
- {
- LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, this);
- if (dock != NULL)
- {
- LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, dock);
- }
- }
+ LLView* dock = getDockWidget();
+ if(visible && isDocked())
+ {
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, this);
+ if (dock != NULL)
+ {
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, dock);
+ }
+ }
+ else
+ {
+ LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, this);
+ if (dock != NULL)
+ {
+ LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, dock);
+ }
+ }
- LLDockableFloater::setVisible(visible);
+ LLDockableFloater::setVisible(visible);
}
void LLTransientDockableFloater::setDocked(bool docked, bool pop_on_undock)
{
- LLView* dock = getDockWidget();
- if(docked)
- {
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, this);
- if (dock != NULL)
- {
- LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, dock);
- }
- }
- else
- {
- LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, this);
- if (dock != NULL)
- {
- LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, dock);
- }
- }
+ LLView* dock = getDockWidget();
+ if(docked)
+ {
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, this);
+ if (dock != NULL)
+ {
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, dock);
+ }
+ }
+ else
+ {
+ LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, this);
+ if (dock != NULL)
+ {
+ LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, dock);
+ }
+ }
- LLDockableFloater::setDocked(docked, pop_on_undock);
+ LLDockableFloater::setDocked(docked, pop_on_undock);
}
diff --git a/indra/newview/lltransientdockablefloater.h b/indra/newview/lltransientdockablefloater.h
index 5fb79597f4..27e74d8880 100644
--- a/indra/newview/lltransientdockablefloater.h
+++ b/indra/newview/lltransientdockablefloater.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltransientdockablefloater.h
* @brief Creates a panel of a specific kind for a toast.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,14 +40,14 @@
class LLTransientDockableFloater : public LLDockableFloater, LLTransientFloater
{
public:
- LOG_CLASS(LLTransientDockableFloater);
- LLTransientDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
- const LLSD& key, const Params& params = getDefaultParams());
- virtual ~LLTransientDockableFloater();
+ LOG_CLASS(LLTransientDockableFloater);
+ LLTransientDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
+ const LLSD& key, const Params& params = getDefaultParams());
+ virtual ~LLTransientDockableFloater();
- /*virtual*/ void setVisible(BOOL visible);
- /* virtual */void setDocked(bool docked, bool pop_on_undock = true);
- virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; }
+ /*virtual*/ void setVisible(BOOL visible);
+ /* virtual */void setDocked(bool docked, bool pop_on_undock = true);
+ virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; }
};
#endif /* LL_TRANSIENTDOCKABLEFLOATER_H */
diff --git a/indra/newview/lltransientfloatermgr.cpp b/indra/newview/lltransientfloatermgr.cpp
index 3d68c10489..bb226efb2c 100644
--- a/indra/newview/lltransientfloatermgr.cpp
+++ b/indra/newview/lltransientfloatermgr.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltransientfloatermgr.cpp
* @brief LLFocusMgr base class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,134 +36,134 @@
LLTransientFloaterMgr::LLTransientFloaterMgr()
{
- if(gViewerWindow)
- {
- gViewerWindow->getRootView()->getChild<LLUICtrl>("popup_holder")->setMouseDownCallback(boost::bind(
- &LLTransientFloaterMgr::leftMouseClickCallback, this, _2, _3, _4));
- }
-
- mGroupControls.insert(std::pair<ETransientGroup, controls_set_t >(GLOBAL, controls_set_t()));
- mGroupControls.insert(std::pair<ETransientGroup, controls_set_t >(DOCKED, controls_set_t()));
- mGroupControls.insert(std::pair<ETransientGroup, controls_set_t >(IM, controls_set_t()));
+ if(gViewerWindow)
+ {
+ gViewerWindow->getRootView()->getChild<LLUICtrl>("popup_holder")->setMouseDownCallback(boost::bind(
+ &LLTransientFloaterMgr::leftMouseClickCallback, this, _2, _3, _4));
+ }
+
+ mGroupControls.insert(std::pair<ETransientGroup, controls_set_t >(GLOBAL, controls_set_t()));
+ mGroupControls.insert(std::pair<ETransientGroup, controls_set_t >(DOCKED, controls_set_t()));
+ mGroupControls.insert(std::pair<ETransientGroup, controls_set_t >(IM, controls_set_t()));
}
void LLTransientFloaterMgr::registerTransientFloater(LLTransientFloater* floater)
{
- mTransSet.insert(floater);
+ mTransSet.insert(floater);
}
void LLTransientFloaterMgr::unregisterTransientFloater(LLTransientFloater* floater)
{
- mTransSet.erase(floater);
+ mTransSet.erase(floater);
}
void LLTransientFloaterMgr::addControlView(ETransientGroup group, LLView* view)
{
- if (!view) return;
+ if (!view) return;
- mGroupControls.find(group)->second.insert(view->getHandle());
+ mGroupControls.find(group)->second.insert(view->getHandle());
}
void LLTransientFloaterMgr::removeControlView(ETransientGroup group, LLView* view)
{
- if (!view) return;
+ if (!view) return;
- mGroupControls.find(group)->second.erase(view->getHandle());
+ mGroupControls.find(group)->second.erase(view->getHandle());
}
void LLTransientFloaterMgr::addControlView(LLView* view)
{
- addControlView(GLOBAL, view);
+ addControlView(GLOBAL, view);
}
void LLTransientFloaterMgr::removeControlView(LLView* view)
{
- // we will still get focus lost callbacks on this view, but that's ok
- // since we run sanity checking logic every time
- removeControlView(GLOBAL, view);
+ // we will still get focus lost callbacks on this view, but that's ok
+ // since we run sanity checking logic every time
+ removeControlView(GLOBAL, view);
}
void LLTransientFloaterMgr::hideTransientFloaters(S32 x, S32 y)
{
- for (std::set<LLTransientFloater*>::iterator it = mTransSet.begin(); it
- != mTransSet.end(); it++)
- {
- LLTransientFloater* floater = *it;
- if (floater->isTransientDocked())
- {
- ETransientGroup group = floater->getGroup();
-
- bool hide = isControlClicked(group, mGroupControls.find(group)->second, x, y);
- if (hide)
- {
- floater->setTransientVisible(FALSE);
- }
- }
- }
+ for (std::set<LLTransientFloater*>::iterator it = mTransSet.begin(); it
+ != mTransSet.end(); it++)
+ {
+ LLTransientFloater* floater = *it;
+ if (floater->isTransientDocked())
+ {
+ ETransientGroup group = floater->getGroup();
+
+ bool hide = isControlClicked(group, mGroupControls.find(group)->second, x, y);
+ if (hide)
+ {
+ floater->setTransientVisible(FALSE);
+ }
+ }
+ }
}
bool LLTransientFloaterMgr::isControlClicked(ETransientGroup group, controls_set_t& set, S32 x, S32 y)
{
- std::list< LLHandle<LLView> > dead_handles;
-
- bool res = true;
- for (controls_set_t::iterator it = set.begin(); it
- != set.end(); it++)
- {
- LLView* control_view = NULL;
-
- LLHandle<LLView> handle = *it;
- if (handle.isDead())
- {
- dead_handles.push_back(handle);
- continue;
- }
-
- control_view = handle.get();
-
- if (!control_view->getVisible())
- {
- continue;
- }
-
- LLRect rect = control_view->calcScreenRect();
- // if click inside view rect
- if (rect.pointInRect(x, y))
- {
- res = false;
- break;
- }
- }
-
- for (std::list< LLHandle<LLView> >::iterator it = dead_handles.begin(); it != dead_handles.end(); ++it)
- {
- LLHandle<LLView> handle = *it;
- mGroupControls.find(group)->second.erase(handle);
- }
-
- return res;
+ std::list< LLHandle<LLView> > dead_handles;
+
+ bool res = true;
+ for (controls_set_t::iterator it = set.begin(); it
+ != set.end(); it++)
+ {
+ LLView* control_view = NULL;
+
+ LLHandle<LLView> handle = *it;
+ if (handle.isDead())
+ {
+ dead_handles.push_back(handle);
+ continue;
+ }
+
+ control_view = handle.get();
+
+ if (!control_view->getVisible())
+ {
+ continue;
+ }
+
+ LLRect rect = control_view->calcScreenRect();
+ // if click inside view rect
+ if (rect.pointInRect(x, y))
+ {
+ res = false;
+ break;
+ }
+ }
+
+ for (std::list< LLHandle<LLView> >::iterator it = dead_handles.begin(); it != dead_handles.end(); ++it)
+ {
+ LLHandle<LLView> handle = *it;
+ mGroupControls.find(group)->second.erase(handle);
+ }
+
+ return res;
}
void LLTransientFloaterMgr::leftMouseClickCallback(S32 x, S32 y,
- MASK mask)
+ MASK mask)
{
- // don't hide transient floater if any context menu opened
- if (LLMenuGL::sMenuContainer->getVisibleMenu() != NULL)
- {
- return;
- }
-
- bool hide = isControlClicked(DOCKED, mGroupControls.find(DOCKED)->second, x, y)
- && isControlClicked(GLOBAL, mGroupControls.find(GLOBAL)->second, x, y);
- if (hide)
- {
- hideTransientFloaters(x, y);
- }
+ // don't hide transient floater if any context menu opened
+ if (LLMenuGL::sMenuContainer->getVisibleMenu() != NULL)
+ {
+ return;
+ }
+
+ bool hide = isControlClicked(DOCKED, mGroupControls.find(DOCKED)->second, x, y)
+ && isControlClicked(GLOBAL, mGroupControls.find(GLOBAL)->second, x, y);
+ if (hide)
+ {
+ hideTransientFloaters(x, y);
+ }
}
void LLTransientFloater::init(LLFloater* thiz)
{
- // used since LLTransientFloater(this) can't be used in descendant constructor parameter initialization.
- mFloater = thiz;
+ // used since LLTransientFloater(this) can't be used in descendant constructor parameter initialization.
+ mFloater = thiz;
}
diff --git a/indra/newview/lltransientfloatermgr.h b/indra/newview/lltransientfloatermgr.h
index d126543f15..18025cc9da 100644
--- a/indra/newview/lltransientfloatermgr.h
+++ b/indra/newview/lltransientfloatermgr.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltransientfloatermgr.h
* @brief LLFocusMgr base class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,32 +38,32 @@ class LLTransientFloater;
*/
class LLTransientFloaterMgr: public LLSingleton<LLTransientFloaterMgr>
{
- LLSINGLETON(LLTransientFloaterMgr);
+ LLSINGLETON(LLTransientFloaterMgr);
public:
- enum ETransientGroup
- {
- GLOBAL, DOCKED, IM
- };
+ enum ETransientGroup
+ {
+ GLOBAL, DOCKED, IM
+ };
- void registerTransientFloater(LLTransientFloater* floater);
- void unregisterTransientFloater(LLTransientFloater* floater);
- void addControlView(ETransientGroup group, LLView* view);
- void removeControlView(ETransientGroup group, LLView* view);
- void addControlView(LLView* view);
- void removeControlView(LLView* view);
+ void registerTransientFloater(LLTransientFloater* floater);
+ void unregisterTransientFloater(LLTransientFloater* floater);
+ void addControlView(ETransientGroup group, LLView* view);
+ void removeControlView(ETransientGroup group, LLView* view);
+ void addControlView(LLView* view);
+ void removeControlView(LLView* view);
private:
- typedef std::set<LLHandle<LLView> > controls_set_t;
- typedef std::map<ETransientGroup, controls_set_t > group_controls_t;
+ typedef std::set<LLHandle<LLView> > controls_set_t;
+ typedef std::map<ETransientGroup, controls_set_t > group_controls_t;
- void hideTransientFloaters(S32 x, S32 y);
- void leftMouseClickCallback(S32 x, S32 y, MASK mask);
- bool isControlClicked(ETransientGroup group, controls_set_t& set, S32 x, S32 y);
+ void hideTransientFloaters(S32 x, S32 y);
+ void leftMouseClickCallback(S32 x, S32 y, MASK mask);
+ bool isControlClicked(ETransientGroup group, controls_set_t& set, S32 x, S32 y);
- std::set<LLTransientFloater*> mTransSet;
+ std::set<LLTransientFloater*> mTransSet;
- group_controls_t mGroupControls;
+ group_controls_t mGroupControls;
};
/**
@@ -72,18 +72,18 @@ private:
class LLTransientFloater
{
protected:
- /**
- * Class initialization method.
- * Should be called from descendant constructor.
- */
- void init(LLFloater* thiz);
+ /**
+ * Class initialization method.
+ * Should be called from descendant constructor.
+ */
+ void init(LLFloater* thiz);
public:
- virtual LLTransientFloaterMgr::ETransientGroup getGroup() = 0;
- bool isTransientDocked() { return mFloater->isDocked(); };
- void setTransientVisible(BOOL visible) {mFloater->setVisible(visible); }
+ virtual LLTransientFloaterMgr::ETransientGroup getGroup() = 0;
+ bool isTransientDocked() { return mFloater->isDocked(); };
+ void setTransientVisible(BOOL visible) {mFloater->setVisible(visible); }
private:
- LLFloater* mFloater;
+ LLFloater* mFloater;
};
#endif // LL_LLTRANSIENTFLOATERMGR_H
diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp
index 979b495906..fe83c7314b 100644
--- a/indra/newview/lltranslate.cpp
+++ b/indra/newview/lltranslate.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -357,22 +357,22 @@ private:
//-------------------------------------------------------------------------
// virtual
std::string LLGoogleTranslationHandler::getTranslateURL(
- const std::string &from_lang,
- const std::string &to_lang,
- const std::string &text) const
+ const std::string &from_lang,
+ const std::string &to_lang,
+ const std::string &text) const
{
- std::string url = std::string("https://www.googleapis.com/language/translate/v2?key=")
- + getAPIKey() + "&q=" + LLURI::escape(text) + "&target=" + to_lang;
- if (!from_lang.empty())
- {
- url += "&source=" + from_lang;
- }
+ std::string url = std::string("https://www.googleapis.com/language/translate/v2?key=")
+ + getAPIKey() + "&q=" + LLURI::escape(text) + "&target=" + to_lang;
+ if (!from_lang.empty())
+ {
+ url += "&source=" + from_lang;
+ }
return url;
}
// virtual
std::string LLGoogleTranslationHandler::getKeyVerificationURL(
- const LLSD& key) const
+ const LLSD& key) const
{
std::string url = std::string("https://www.googleapis.com/language/translate/v2/languages?key=")
+ key.asString() +"&target=en";
@@ -389,100 +389,100 @@ bool LLGoogleTranslationHandler::checkVerificationResponse(
// virtual
bool LLGoogleTranslationHandler::parseResponse(
- const LLSD& http_response,
- int& status,
- const std::string& body,
- std::string& translation,
- std::string& detected_lang,
- std::string& err_msg) const
+ const LLSD& http_response,
+ int& status,
+ const std::string& body,
+ std::string& translation,
+ std::string& detected_lang,
+ std::string& err_msg) const
{
- const std::string& text = !body.empty() ? body : http_response["error_body"].asStringRef();
-
- Json::Value root;
- Json::Reader reader;
-
- if (reader.parse(text, root))
- {
- if (root.isObject())
- {
- // Request succeeded, extract translation from the XML body.
- if (parseTranslation(root, translation, detected_lang))
- return true;
-
- // Request failed. Extract error message from the XML body.
- parseErrorResponse(root, status, err_msg);
- }
- }
- else
- {
- // XML parsing failed. Extract error message from the XML parser.
- err_msg = reader.getFormatedErrorMessages();
- }
-
- return false;
+ const std::string& text = !body.empty() ? body : http_response["error_body"].asStringRef();
+
+ Json::Value root;
+ Json::Reader reader;
+
+ if (reader.parse(text, root))
+ {
+ if (root.isObject())
+ {
+ // Request succeeded, extract translation from the XML body.
+ if (parseTranslation(root, translation, detected_lang))
+ return true;
+
+ // Request failed. Extract error message from the XML body.
+ parseErrorResponse(root, status, err_msg);
+ }
+ }
+ else
+ {
+ // XML parsing failed. Extract error message from the XML parser.
+ err_msg = reader.getFormatedErrorMessages();
+ }
+
+ return false;
}
// virtual
bool LLGoogleTranslationHandler::isConfigured() const
{
- return !getAPIKey().empty();
+ return !getAPIKey().empty();
}
// static
void LLGoogleTranslationHandler::parseErrorResponse(
- const Json::Value& root,
- int& status,
- std::string& err_msg)
+ const Json::Value& root,
+ int& status,
+ std::string& err_msg)
{
- const Json::Value& error = root.get("error", 0);
- if (!error.isObject() || !error.isMember("message") || !error.isMember("code"))
- {
- return;
- }
-
- err_msg = error["message"].asString();
- status = error["code"].asInt();
+ const Json::Value& error = root.get("error", 0);
+ if (!error.isObject() || !error.isMember("message") || !error.isMember("code"))
+ {
+ return;
+ }
+
+ err_msg = error["message"].asString();
+ status = error["code"].asInt();
}
// static
bool LLGoogleTranslationHandler::parseTranslation(
- const Json::Value& root,
- std::string& translation,
- std::string& detected_lang)
+ const Json::Value& root,
+ std::string& translation,
+ std::string& detected_lang)
{
- // JsonCpp is prone to aborting the program on failed assertions,
- // so be super-careful and verify the response format.
- const Json::Value& data = root.get("data", 0);
- if (!data.isObject() || !data.isMember("translations"))
- {
- return false;
- }
-
- const Json::Value& translations = data["translations"];
- if (!translations.isArray() || translations.size() == 0)
- {
- return false;
- }
-
- const Json::Value& first = translations[0U];
- if (!first.isObject() || !first.isMember("translatedText"))
- {
- return false;
- }
-
- translation = first["translatedText"].asString();
- detected_lang = first.get("detectedSourceLanguage", "").asString();
- return true;
+ // JsonCpp is prone to aborting the program on failed assertions,
+ // so be super-careful and verify the response format.
+ const Json::Value& data = root.get("data", 0);
+ if (!data.isObject() || !data.isMember("translations"))
+ {
+ return false;
+ }
+
+ const Json::Value& translations = data["translations"];
+ if (!translations.isArray() || translations.size() == 0)
+ {
+ return false;
+ }
+
+ const Json::Value& first = translations[0U];
+ if (!first.isObject() || !first.isMember("translatedText"))
+ {
+ return false;
+ }
+
+ translation = first["translatedText"].asString();
+ detected_lang = first.get("detectedSourceLanguage", "").asString();
+ return true;
}
// static
std::string LLGoogleTranslationHandler::getAPIKey()
{
static LLCachedControl<std::string> google_key(gSavedSettings, "GoogleTranslateAPIKey");
- return google_key;
+ return google_key;
}
-/*virtual*/
+/*virtual*/
void LLGoogleTranslationHandler::verifyKey(const LLSD &key, LLTranslate::KeyVerificationResult_fn fnc)
{
LLCoros::instance().launch("Google /Verify Key", boost::bind(&LLTranslationAPIHandler::verifyKeyCoro,
@@ -582,9 +582,9 @@ private:
//-------------------------------------------------------------------------
// virtual
std::string LLAzureTranslationHandler::getTranslateURL(
- const std::string &from_lang,
- const std::string &to_lang,
- const std::string &text) const
+ const std::string &from_lang,
+ const std::string &to_lang,
+ const std::string &text) const
{
std::string url;
LLSD key = getAPIKey();
@@ -605,7 +605,7 @@ std::string LLAzureTranslationHandler::getTranslateURL(
// virtual
std::string LLAzureTranslationHandler::getKeyVerificationURL(
- const LLSD& key) const
+ const LLSD& key) const
{
std::string url;
if (key.isMap())
@@ -667,18 +667,18 @@ bool LLAzureTranslationHandler::checkVerificationResponse(
// virtual
bool LLAzureTranslationHandler::parseResponse(
const LLSD& http_response,
- int& status,
- const std::string& body,
- std::string& translation,
- std::string& detected_lang,
- std::string& err_msg) const
+ int& status,
+ const std::string& body,
+ std::string& translation,
+ std::string& detected_lang,
+ std::string& err_msg) const
{
- if (status != HTTP_OK)
- {
+ if (status != HTTP_OK)
+ {
if (http_response.has("error_body"))
err_msg = parseErrorResponse(http_response["error_body"].asString());
- return false;
- }
+ return false;
+ }
//Example:
// "[{\"detectedLanguage\":{\"language\":\"en\",\"score\":1.0},\"translations\":[{\"text\":\"Hello, what is your name?\",\"to\":\"en\"}]}]"
@@ -734,7 +734,7 @@ bool LLAzureTranslationHandler::parseResponse(
// virtual
bool LLAzureTranslationHandler::isConfigured() const
{
- return getAPIKey().isMap();
+ return getAPIKey().isMap();
}
//static
@@ -771,19 +771,19 @@ std::string LLAzureTranslationHandler::parseErrorResponse(
LLSD LLAzureTranslationHandler::getAPIKey()
{
static LLCachedControl<LLSD> azure_key(gSavedSettings, "AzureTranslateAPIKey");
- return azure_key;
+ return azure_key;
}
// static
std::string LLAzureTranslationHandler::getAPILanguageCode(const std::string& lang)
{
- return lang == "zh" ? "zh-CHT" : lang; // treat Chinese as Traditional Chinese
+ return lang == "zh" ? "zh-CHT" : lang; // treat Chinese as Traditional Chinese
}
/*virtual*/
void LLAzureTranslationHandler::verifyKey(const LLSD &key, LLTranslate::KeyVerificationResult_fn fnc)
{
- LLCoros::instance().launch("Azure /Verify Key", boost::bind(&LLTranslationAPIHandler::verifyKeyCoro,
+ LLCoros::instance().launch("Azure /Verify Key", boost::bind(&LLTranslationAPIHandler::verifyKeyCoro,
this, LLTranslate::SERVICE_AZURE, key, fnc));
}
/*virtual*/
@@ -1121,10 +1121,10 @@ LLSD LLDeepLTranslationHandler::verifyAndSuspend(LLCoreHttpUtil::HttpCoroutineAd
//=========================================================================
LLTranslate::LLTranslate():
- mCharsSeen(0),
- mCharsSent(0),
- mFailureCount(0),
- mSuccessCount(0)
+ mCharsSeen(0),
+ mCharsSent(0),
+ mFailureCount(0),
+ mSuccessCount(0)
{
}
@@ -1225,68 +1225,68 @@ void LLTranslate::verifyKey(EService service, const LLSD &key, KeyVerificationRe
//static
std::string LLTranslate::getTranslateLanguage()
{
- std::string language = gSavedSettings.getString("TranslateLanguage");
- if (language.empty() || language == "default")
- {
- language = LLUI::getLanguage();
- }
- language = language.substr(0,2);
- return language;
+ std::string language = gSavedSettings.getString("TranslateLanguage");
+ if (language.empty() || language == "default")
+ {
+ language = LLUI::getLanguage();
+ }
+ language = language.substr(0,2);
+ return language;
}
// static
bool LLTranslate::isTranslationConfigured()
{
- return getPreferredHandler().isConfigured();
+ return getPreferredHandler().isConfigured();
}
void LLTranslate::logCharsSeen(size_t count)
{
- mCharsSeen += count;
+ mCharsSeen += count;
}
void LLTranslate::logCharsSent(size_t count)
{
- mCharsSent += count;
+ mCharsSent += count;
}
void LLTranslate::logSuccess(S32 count)
{
- mSuccessCount += count;
+ mSuccessCount += count;
}
void LLTranslate::logFailure(S32 count)
{
- mFailureCount += count;
+ mFailureCount += count;
}
LLSD LLTranslate::asLLSD() const
{
- LLSD res;
- bool on = gSavedSettings.getBOOL("TranslateChat");
- res["on"] = on;
- res["chars_seen"] = (S32) mCharsSeen;
- if (on)
- {
- res["chars_sent"] = (S32) mCharsSent;
- res["success_count"] = mSuccessCount;
- res["failure_count"] = mFailureCount;
- res["language"] = getTranslateLanguage();
- res["service"] = gSavedSettings.getString("TranslationService");
- }
- return res;
+ LLSD res;
+ bool on = gSavedSettings.getBOOL("TranslateChat");
+ res["on"] = on;
+ res["chars_seen"] = (S32) mCharsSeen;
+ if (on)
+ {
+ res["chars_sent"] = (S32) mCharsSent;
+ res["success_count"] = mSuccessCount;
+ res["failure_count"] = mFailureCount;
+ res["language"] = getTranslateLanguage();
+ res["service"] = gSavedSettings.getString("TranslationService");
+ }
+ return res;
}
// static
LLTranslationAPIHandler& LLTranslate::getPreferredHandler()
{
- EService service = SERVICE_AZURE;
+ EService service = SERVICE_AZURE;
- std::string service_str = gSavedSettings.getString("TranslationService");
- if (service_str == "google")
- {
- service = SERVICE_GOOGLE;
- }
+ std::string service_str = gSavedSettings.getString("TranslationService");
+ if (service_str == "google")
+ {
+ service = SERVICE_GOOGLE;
+ }
if (service_str == "azure")
{
service = SERVICE_AZURE;
@@ -1296,14 +1296,14 @@ LLTranslationAPIHandler& LLTranslate::getPreferredHandler()
service = SERVICE_DEEPL;
}
- return getHandler(service);
+ return getHandler(service);
}
// static
LLTranslationAPIHandler& LLTranslate::getHandler(EService service)
{
- static LLGoogleTranslationHandler google;
- static LLAzureTranslationHandler azure;
+ static LLGoogleTranslationHandler google;
+ static LLAzureTranslationHandler azure;
static LLDeepLTranslationHandler deepl;
switch (service)
diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h
index 4a5d80737c..67f528c090 100644
--- a/indra/newview/lltranslate.h
+++ b/indra/newview/lltranslate.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,30 +52,30 @@ class LLTranslationAPIHandler;
*/
class LLTranslate: public LLSingleton<LLTranslate>
{
- LLSINGLETON(LLTranslate);
- ~LLTranslate();
- LOG_CLASS(LLTranslate);
+ LLSINGLETON(LLTranslate);
+ ~LLTranslate();
+ LOG_CLASS(LLTranslate);
public :
- typedef enum e_service {
- SERVICE_AZURE,
- SERVICE_GOOGLE,
- SERVICE_DEEPL,
- } EService;
+ typedef enum e_service {
+ SERVICE_AZURE,
+ SERVICE_GOOGLE,
+ SERVICE_DEEPL,
+ } EService;
typedef boost::function<void(EService, bool, S32)> KeyVerificationResult_fn;
typedef boost::function<void(std::string , std::string )> TranslationSuccess_fn;
typedef boost::function<void(int, std::string)> TranslationFailure_fn;
- /**
- * Translate given text.
- *
- * @param receiver Object to pass translation result to.
- * @param from_lang Source language. Leave empty for auto-detection.
- * @param to_lang Target language.
- * @param mesg Text to translate.
- */
+ /**
+ * Translate given text.
+ *
+ * @param receiver Object to pass translation result to.
+ * @param from_lang Source language. Leave empty for auto-detection.
+ * @param to_lang Target language.
+ * @param mesg Text to translate.
+ */
static void translateMessage(const std::string &from_lang, const std::string &to_lang, const std::string &mesg, TranslationSuccess_fn success, TranslationFailure_fn failure);
/**
@@ -86,32 +86,32 @@ public :
*/
static void verifyKey(EService service, const LLSD &key, KeyVerificationResult_fn fnc);
- /**
- * @return translation target language
- */
- static std::string getTranslateLanguage();
+ /**
+ * @return translation target language
+ */
+ static std::string getTranslateLanguage();
- /**
- * @return true if translation is configured properly.
- */
- static bool isTranslationConfigured();
+ /**
+ * @return true if translation is configured properly.
+ */
+ static bool isTranslationConfigured();
static std::string addNoTranslateTags(std::string mesg);
static std::string removeNoTranslateTags(std::string mesg);
- void logCharsSeen(size_t count);
- void logCharsSent(size_t count);
- void logSuccess(S32 count);
- void logFailure(S32 count);
- LLSD asLLSD() const;
+ void logCharsSeen(size_t count);
+ void logCharsSent(size_t count);
+ void logSuccess(S32 count);
+ void logFailure(S32 count);
+ LLSD asLLSD() const;
private:
- static LLTranslationAPIHandler& getPreferredHandler();
- static LLTranslationAPIHandler& getHandler(EService service);
+ static LLTranslationAPIHandler& getPreferredHandler();
+ static LLTranslationAPIHandler& getHandler(EService service);
- size_t mCharsSeen;
- size_t mCharsSent;
- S32 mFailureCount;
- S32 mSuccessCount;
+ size_t mCharsSeen;
+ size_t mCharsSent;
+ S32 mFailureCount;
+ S32 mSuccessCount;
};
#endif
diff --git a/indra/newview/lluiavatar.cpp b/indra/newview/lluiavatar.cpp
index e4e266c92a..1742126ba3 100644
--- a/indra/newview/lluiavatar.cpp
+++ b/indra/newview/lluiavatar.cpp
@@ -52,10 +52,10 @@ void LLUIAvatar::initInstance()
LLVOAvatar::initInstance();
createDrawable( &gPipeline );
- setPositionAgent(LLVector3::zero);
- slamPosition();
- updateJointLODs();
- updateGeometry(mDrawable);
+ setPositionAgent(LLVector3::zero);
+ slamPosition();
+ updateJointLODs();
+ updateGeometry(mDrawable);
mInitFlags |= 1<<3;
}
diff --git a/indra/newview/lluiavatar.h b/indra/newview/lluiavatar.h
index bcdffedef2..c539539306 100644
--- a/indra/newview/lluiavatar.h
+++ b/indra/newview/lluiavatar.h
@@ -37,8 +37,8 @@ class LLUIAvatar:
public:
LLUIAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
- virtual void initInstance(); // Called after construction to initialize the class.
- virtual ~LLUIAvatar();
+ virtual void initInstance(); // Called after construction to initialize the class.
+ virtual ~LLUIAvatar();
};
#endif //LL_CONTROLAVATAR_H
diff --git a/indra/newview/lluiconstants.h b/indra/newview/lluiconstants.h
index 1479e58c43..5fdfd37c6e 100644
--- a/indra/newview/lluiconstants.h
+++ b/indra/newview/lluiconstants.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lluiconstants.h
* @brief Compile-time configuration for UI
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,11 +40,11 @@ const S32 VPAD = 4;
const S32 HPAD = 4;
// Account History, how far to look into past
-const S32 SUMMARY_INTERVAL = 7; // one week
-const S32 SUMMARY_MAX = 8; //
-const S32 DETAILS_INTERVAL = 1; // one day
-const S32 DETAILS_MAX = 30; // one month
+const S32 SUMMARY_INTERVAL = 7; // one week
+const S32 SUMMARY_MAX = 8; //
+const S32 DETAILS_INTERVAL = 1; // one day
+const S32 DETAILS_MAX = 30; // one month
const S32 TRANSACTIONS_INTERVAL = 1;// one day
-const S32 TRANSACTIONS_MAX = 30; // one month
+const S32 TRANSACTIONS_MAX = 30; // one month
#endif
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp
index 956f5cf187..beae71e7bf 100644
--- a/indra/newview/lluilistener.cpp
+++ b/indra/newview/lluilistener.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-08-18
* @brief Implementation for lluilistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -88,7 +88,7 @@ void LLUIListener::getValue(const LLSD&event) const
const LLView* view = LLUI::getInstance()->resolvePath(root, event["path"].asString());
const LLUICtrl* ctrl(dynamic_cast<const LLUICtrl*>(view));
- if (ctrl)
+ if (ctrl)
{
reply["value"] = ctrl->getValue();
}
@@ -96,6 +96,6 @@ void LLUIListener::getValue(const LLSD&event) const
{
// *TODO: ??? return something indicating failure to resolve
}
-
+
sendReply(reply, event);
}
diff --git a/indra/newview/lluilistener.h b/indra/newview/lluilistener.h
index 08724024dc..70455c2c68 100644
--- a/indra/newview/lluilistener.h
+++ b/indra/newview/lluilistener.h
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-08-18
* @brief Engage named functions as specified by XUI
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp
index e59064c074..fc90b4fbed 100644
--- a/indra/newview/lluploaddialog.cpp
+++ b/indra/newview/lluploaddialog.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lluploaddialog.cpp
* @brief LLUploadDialog class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,21 +38,21 @@
#include "llrootview.h"
// static
-LLUploadDialog* LLUploadDialog::sDialog = NULL;
+LLUploadDialog* LLUploadDialog::sDialog = NULL;
// static
LLUploadDialog* LLUploadDialog::modalUploadDialog(const std::string& msg)
{
- // Note: object adds, removes, and destroys itself.
- return new LLUploadDialog(msg);
+ // Note: object adds, removes, and destroys itself.
+ return new LLUploadDialog(msg);
}
// static
void LLUploadDialog::modalUploadFinished()
{
- // Note: object adds, removes, and destroys itself.
- delete LLUploadDialog::sDialog;
- LLUploadDialog::sDialog = NULL;
+ // Note: object adds, removes, and destroys itself.
+ delete LLUploadDialog::sDialog;
+ LLUploadDialog::sDialog = NULL;
}
////////////////////////////////////////////////////////////
@@ -61,100 +61,100 @@ void LLUploadDialog::modalUploadFinished()
LLUploadDialog::LLUploadDialog( const std::string& msg)
: LLPanel()
{
- setBackgroundVisible( TRUE );
-
- if( LLUploadDialog::sDialog )
- {
- delete LLUploadDialog::sDialog;
- }
- LLUploadDialog::sDialog = this;
-
- const LLFontGL* font = LLFontGL::getFontSansSerif();
- LLRect msg_rect;
- for (int line_num=0; line_num<16; ++line_num)
- {
- LLTextBox::Params params;
- params.name("Filename");
- params.rect(msg_rect);
- params.initial_value("Filename");
- params.font(font);
- mLabelBox[line_num] = LLUICtrlFactory::create<LLTextBox> (params);
- addChild(mLabelBox[line_num]);
- }
-
- setMessage(msg);
-
- // The dialog view is a root view
- gViewerWindow->addPopup(this);
+ setBackgroundVisible( TRUE );
+
+ if( LLUploadDialog::sDialog )
+ {
+ delete LLUploadDialog::sDialog;
+ }
+ LLUploadDialog::sDialog = this;
+
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
+ LLRect msg_rect;
+ for (int line_num=0; line_num<16; ++line_num)
+ {
+ LLTextBox::Params params;
+ params.name("Filename");
+ params.rect(msg_rect);
+ params.initial_value("Filename");
+ params.font(font);
+ mLabelBox[line_num] = LLUICtrlFactory::create<LLTextBox> (params);
+ addChild(mLabelBox[line_num]);
+ }
+
+ setMessage(msg);
+
+ // The dialog view is a root view
+ gViewerWindow->addPopup(this);
}
void LLUploadDialog::setMessage( const std::string& msg)
{
- const LLFontGL* font = LLFontGL::getFontSansSerif();
-
- const S32 VPAD = 16;
- const S32 HPAD = 25;
-
- // Make the text boxes a little wider than the text
- const S32 TEXT_PAD = 8;
-
- // Split message into lines, separated by '\n'
- S32 max_msg_width = 0;
- std::list<std::string> msg_lines;
-
- S32 size = msg.size() + 1;
- std::vector<char> temp_msg(size); // non-const copy to make strtok happy
- strcpy( &temp_msg[0], msg.c_str());
- char* token = strtok( &temp_msg[0], "\n" );
- while( token )
- {
- std::string tokstr(token);
- S32 cur_width = S32(font->getWidth(tokstr) + 0.99f) + TEXT_PAD;
- max_msg_width = llmax( max_msg_width, cur_width );
- msg_lines.push_back( tokstr );
- token = strtok( NULL, "\n" );
- }
-
- S32 line_height = font->getLineHeight();
- S32 dialog_width = max_msg_width + 2 * HPAD;
- S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD;
-
- reshape( dialog_width, dialog_height, FALSE );
-
- // Message
- S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;
- S32 msg_y = getRect().getHeight() - VPAD - line_height;
- int line_num;
- for (line_num=0; line_num<16; ++line_num)
- {
- mLabelBox[line_num]->setVisible(FALSE);
- }
- line_num = 0;
- for (std::list<std::string>::iterator iter = msg_lines.begin();
- iter != msg_lines.end(); ++iter)
- {
- std::string& cur_line = *iter;
- LLRect msg_rect;
- msg_rect.setOriginAndSize( msg_x, msg_y, max_msg_width, line_height );
- mLabelBox[line_num]->setRect(msg_rect);
- mLabelBox[line_num]->setText(cur_line);
- mLabelBox[line_num]->setColor( LLUIColorTable::instance().getColor( "LabelTextColor" ) );
- mLabelBox[line_num]->setVisible(TRUE);
- msg_y -= line_height;
- ++line_num;
- }
-
- centerWithin(gViewerWindow->getRootView()->getRect());
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
+
+ const S32 VPAD = 16;
+ const S32 HPAD = 25;
+
+ // Make the text boxes a little wider than the text
+ const S32 TEXT_PAD = 8;
+
+ // Split message into lines, separated by '\n'
+ S32 max_msg_width = 0;
+ std::list<std::string> msg_lines;
+
+ S32 size = msg.size() + 1;
+ std::vector<char> temp_msg(size); // non-const copy to make strtok happy
+ strcpy( &temp_msg[0], msg.c_str());
+ char* token = strtok( &temp_msg[0], "\n" );
+ while( token )
+ {
+ std::string tokstr(token);
+ S32 cur_width = S32(font->getWidth(tokstr) + 0.99f) + TEXT_PAD;
+ max_msg_width = llmax( max_msg_width, cur_width );
+ msg_lines.push_back( tokstr );
+ token = strtok( NULL, "\n" );
+ }
+
+ S32 line_height = font->getLineHeight();
+ S32 dialog_width = max_msg_width + 2 * HPAD;
+ S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD;
+
+ reshape( dialog_width, dialog_height, FALSE );
+
+ // Message
+ S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;
+ S32 msg_y = getRect().getHeight() - VPAD - line_height;
+ int line_num;
+ for (line_num=0; line_num<16; ++line_num)
+ {
+ mLabelBox[line_num]->setVisible(FALSE);
+ }
+ line_num = 0;
+ for (std::list<std::string>::iterator iter = msg_lines.begin();
+ iter != msg_lines.end(); ++iter)
+ {
+ std::string& cur_line = *iter;
+ LLRect msg_rect;
+ msg_rect.setOriginAndSize( msg_x, msg_y, max_msg_width, line_height );
+ mLabelBox[line_num]->setRect(msg_rect);
+ mLabelBox[line_num]->setText(cur_line);
+ mLabelBox[line_num]->setColor( LLUIColorTable::instance().getColor( "LabelTextColor" ) );
+ mLabelBox[line_num]->setVisible(TRUE);
+ msg_y -= line_height;
+ ++line_num;
+ }
+
+ centerWithin(gViewerWindow->getRootView()->getRect());
}
LLUploadDialog::~LLUploadDialog()
{
- gFocusMgr.releaseFocusIfNeeded( this );
+ gFocusMgr.releaseFocusIfNeeded( this );
// LLFilePicker::instance().reset();
- LLUploadDialog::sDialog = NULL;
+ LLUploadDialog::sDialog = NULL;
}
diff --git a/indra/newview/lluploaddialog.h b/indra/newview/lluploaddialog.h
index 3aa9583315..b6d401982d 100644
--- a/indra/newview/lluploaddialog.h
+++ b/indra/newview/lluploaddialog.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lluploaddialog.h
* @brief LLUploadDialog class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,26 +29,26 @@
#include "llpanel.h"
#include "lltextbox.h"
-
+
class LLUploadDialog : public LLPanel
{
public:
- // Use this function to open a modal dialog and display it until the user presses the "close" button.
- static LLUploadDialog* modalUploadDialog(const std::string& msg); // Message to display
- static void modalUploadFinished(); // Message to display
+ // Use this function to open a modal dialog and display it until the user presses the "close" button.
+ static LLUploadDialog* modalUploadDialog(const std::string& msg); // Message to display
+ static void modalUploadFinished(); // Message to display
- static bool modalUploadIsFinished() { return (sDialog == NULL); }
+ static bool modalUploadIsFinished() { return (sDialog == NULL); }
- void setMessage( const std::string& msg );
+ void setMessage( const std::string& msg );
private:
- LLUploadDialog( const std::string& msg);
- virtual ~LLUploadDialog(); // No you can't kill it. It can only kill itself.
+ LLUploadDialog( const std::string& msg);
+ virtual ~LLUploadDialog(); // No you can't kill it. It can only kill itself.
- LLTextBox* mLabelBox[16];
+ LLTextBox* mLabelBox[16];
private:
- static LLUploadDialog* sDialog; // Hidden singleton instance, created and destroyed as needed.
+ static LLUploadDialog* sDialog; // Hidden singleton instance, created and destroyed as needed.
};
#endif // LL_UPLOADDIALOG_H
diff --git a/indra/newview/lluploadfloaterobservers.h b/indra/newview/lluploadfloaterobservers.h
index 77e950a1c9..fa63e3ad19 100644
--- a/indra/newview/lluploadfloaterobservers.h
+++ b/indra/newview/lluploadfloaterobservers.h
@@ -34,48 +34,48 @@ class LLUploadPermissionsObserver
{
public:
- LLUploadPermissionsObserver(){mUploadPermObserverHandle.bind(this);}
- virtual ~LLUploadPermissionsObserver() {}
+ LLUploadPermissionsObserver(){mUploadPermObserverHandle.bind(this);}
+ virtual ~LLUploadPermissionsObserver() {}
- virtual void onPermissionsReceived(const LLSD& result) = 0;
- virtual void setPermissonsErrorStatus(S32 status, const std::string& reason) = 0;
+ virtual void onPermissionsReceived(const LLSD& result) = 0;
+ virtual void setPermissonsErrorStatus(S32 status, const std::string& reason) = 0;
- LLHandle<LLUploadPermissionsObserver> getPermObserverHandle() const {return mUploadPermObserverHandle;}
+ LLHandle<LLUploadPermissionsObserver> getPermObserverHandle() const {return mUploadPermObserverHandle;}
protected:
- LLRootHandle<LLUploadPermissionsObserver> mUploadPermObserverHandle;
+ LLRootHandle<LLUploadPermissionsObserver> mUploadPermObserverHandle;
};
class LLWholeModelFeeObserver
{
public:
- LLWholeModelFeeObserver() { mWholeModelFeeObserverHandle.bind(this); }
- virtual ~LLWholeModelFeeObserver() {}
+ LLWholeModelFeeObserver() { mWholeModelFeeObserverHandle.bind(this); }
+ virtual ~LLWholeModelFeeObserver() {}
- virtual void onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url) = 0;
- virtual void setModelPhysicsFeeErrorStatus(S32 status, const std::string& reason, const LLSD& result) = 0;
+ virtual void onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url) = 0;
+ virtual void setModelPhysicsFeeErrorStatus(S32 status, const std::string& reason, const LLSD& result) = 0;
- LLHandle<LLWholeModelFeeObserver> getWholeModelFeeObserverHandle() const { return mWholeModelFeeObserverHandle; }
+ LLHandle<LLWholeModelFeeObserver> getWholeModelFeeObserverHandle() const { return mWholeModelFeeObserverHandle; }
protected:
- LLRootHandle<LLWholeModelFeeObserver> mWholeModelFeeObserverHandle;
+ LLRootHandle<LLWholeModelFeeObserver> mWholeModelFeeObserverHandle;
};
class LLWholeModelUploadObserver
{
public:
- LLWholeModelUploadObserver() { mWholeModelUploadObserverHandle.bind(this); }
- virtual ~LLWholeModelUploadObserver() {}
+ LLWholeModelUploadObserver() { mWholeModelUploadObserverHandle.bind(this); }
+ virtual ~LLWholeModelUploadObserver() {}
- virtual void onModelUploadSuccess() = 0;
+ virtual void onModelUploadSuccess() = 0;
- virtual void onModelUploadFailure() = 0;
+ virtual void onModelUploadFailure() = 0;
- LLHandle<LLWholeModelUploadObserver> getWholeModelUploadObserverHandle() const { return mWholeModelUploadObserverHandle; }
+ LLHandle<LLWholeModelUploadObserver> getWholeModelUploadObserverHandle() const { return mWholeModelUploadObserverHandle; }
protected:
- LLRootHandle<LLWholeModelUploadObserver> mWholeModelUploadObserverHandle;
+ LLRootHandle<LLWholeModelUploadObserver> mWholeModelUploadObserverHandle;
};
#endif /* LL_LLUPLOADFLOATEROBSERVERS_H */
diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp
index 01a81c5f83..2cb7f1a877 100644
--- a/indra/newview/llurl.cpp
+++ b/indra/newview/llurl.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llurl.cpp
* @brief Text url class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,109 +30,109 @@
LLURL::LLURL()
{
- init("");
+ init("");
}
LLURL::LLURL(const LLURL &url)
{
- if (this != &url)
- {
- init(url.getFQURL());
- }
- else
- {
- init("");
- }
+ if (this != &url)
+ {
+ init(url.getFQURL());
+ }
+ else
+ {
+ init("");
+ }
}
LLURL::LLURL(const char * url)
{
- init(url);
+ init(url);
}
LLURL::~LLURL()
{
- cleanup();
+ cleanup();
}
void LLURL::init(const char * url)
{
- mURI[0] = '\0';
- mAuthority[0] = '\0';
- mPath[0] = '\0';
- mFilename[0] = '\0';
- mExtension[0] = '\0';
- mTag[0] = '\0';
-
- char url_copy[MAX_STRING]; /* Flawfinder: ignore */
-
- strncpy (url_copy,url, MAX_STRING -1); /* Flawfinder: ignore */
- url_copy[MAX_STRING -1] = '\0';
-
- char *parse;
- char *leftover_url = url_copy;
- S32 span = 0;
-
- // copy and lop off tag
- if ((parse = strchr(url_copy,'#')))
- {
- strncpy(mTag,parse+1, LL_MAX_PATH -1); /* Flawfinder: ignore */
- mTag[LL_MAX_PATH -1] = '\0';
- *parse = '\0';
- }
-
- // copy out URI if it exists, update leftover_url
- if ((parse = strchr(url_copy,':')))
- {
- *parse = '\0';
- strncpy(mURI,leftover_url, LL_MAX_PATH -1); /* Flawfinder: ignore */
- mURI[LL_MAX_PATH -1] = '\0';
- leftover_url = parse + 1;
- }
-
- // copy out authority if it exists, update leftover_url
- if ((leftover_url[0] == '/') && (leftover_url[1] == '/'))
- {
- leftover_url += 2; // skip the "//"
-
- span = strcspn(leftover_url, "/");
- strncat(mAuthority,leftover_url,span); /* Flawfinder: ignore */
- leftover_url += span;
- }
-
- if ((parse = strrchr(leftover_url,'.')))
- {
- // copy and lop off extension
- strncpy(mExtension,parse+1, LL_MAX_PATH -1); /* Flawfinder: ignore */
- mExtension[LL_MAX_PATH -1] = '\0';
- *parse = '\0';
- }
-
- if ((parse = strrchr(leftover_url,'/')))
- {
- parse++;
- }
- else
- {
- parse = leftover_url;
- }
-
- // copy and lop off filename
- strncpy(mFilename,parse, LL_MAX_PATH -1);/* Flawfinder: ignore */
- mFilename[LL_MAX_PATH -1] = '\0';
- *parse = '\0';
-
- // what's left should be the path
- strncpy(mPath,leftover_url, LL_MAX_PATH -1); /* Flawfinder: ignore */
- mPath[LL_MAX_PATH -1] = '\0';
-
-// LL_INFOS() << url << " decomposed into: " << LL_ENDL;
-// LL_INFOS() << " URI : <" << mURI << ">" << LL_ENDL;
-// LL_INFOS() << " Auth: <" << mAuthority << ">" << LL_ENDL;
-// LL_INFOS() << " Path: <" << mPath << ">" << LL_ENDL;
-// LL_INFOS() << " File: <" << mFilename << ">" << LL_ENDL;
-// LL_INFOS() << " Ext : <" << mExtension << ">" << LL_ENDL;
-// LL_INFOS() << " Tag : <" << mTag << ">" << LL_ENDL;
+ mURI[0] = '\0';
+ mAuthority[0] = '\0';
+ mPath[0] = '\0';
+ mFilename[0] = '\0';
+ mExtension[0] = '\0';
+ mTag[0] = '\0';
+
+ char url_copy[MAX_STRING]; /* Flawfinder: ignore */
+
+ strncpy (url_copy,url, MAX_STRING -1); /* Flawfinder: ignore */
+ url_copy[MAX_STRING -1] = '\0';
+
+ char *parse;
+ char *leftover_url = url_copy;
+ S32 span = 0;
+
+ // copy and lop off tag
+ if ((parse = strchr(url_copy,'#')))
+ {
+ strncpy(mTag,parse+1, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ mTag[LL_MAX_PATH -1] = '\0';
+ *parse = '\0';
+ }
+
+ // copy out URI if it exists, update leftover_url
+ if ((parse = strchr(url_copy,':')))
+ {
+ *parse = '\0';
+ strncpy(mURI,leftover_url, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ mURI[LL_MAX_PATH -1] = '\0';
+ leftover_url = parse + 1;
+ }
+
+ // copy out authority if it exists, update leftover_url
+ if ((leftover_url[0] == '/') && (leftover_url[1] == '/'))
+ {
+ leftover_url += 2; // skip the "//"
+
+ span = strcspn(leftover_url, "/");
+ strncat(mAuthority,leftover_url,span); /* Flawfinder: ignore */
+ leftover_url += span;
+ }
+
+ if ((parse = strrchr(leftover_url,'.')))
+ {
+ // copy and lop off extension
+ strncpy(mExtension,parse+1, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ mExtension[LL_MAX_PATH -1] = '\0';
+ *parse = '\0';
+ }
+
+ if ((parse = strrchr(leftover_url,'/')))
+ {
+ parse++;
+ }
+ else
+ {
+ parse = leftover_url;
+ }
+
+ // copy and lop off filename
+ strncpy(mFilename,parse, LL_MAX_PATH -1);/* Flawfinder: ignore */
+ mFilename[LL_MAX_PATH -1] = '\0';
+ *parse = '\0';
+
+ // what's left should be the path
+ strncpy(mPath,leftover_url, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ mPath[LL_MAX_PATH -1] = '\0';
+
+// LL_INFOS() << url << " decomposed into: " << LL_ENDL;
+// LL_INFOS() << " URI : <" << mURI << ">" << LL_ENDL;
+// LL_INFOS() << " Auth: <" << mAuthority << ">" << LL_ENDL;
+// LL_INFOS() << " Path: <" << mPath << ">" << LL_ENDL;
+// LL_INFOS() << " File: <" << mFilename << ">" << LL_ENDL;
+// LL_INFOS() << " Ext : <" << mExtension << ">" << LL_ENDL;
+// LL_INFOS() << " Tag : <" << mTag << ">" << LL_ENDL;
}
void LLURL::cleanup()
@@ -142,149 +142,149 @@ void LLURL::cleanup()
// Copy assignment
LLURL &LLURL::operator=(const LLURL &rhs)
{
- if (this != &rhs)
- {
- this->init(rhs.getFQURL());
- }
-
- return *this;
+ if (this != &rhs)
+ {
+ this->init(rhs.getFQURL());
+ }
+
+ return *this;
}
// Compare
bool LLURL::operator==(const LLURL &rhs) const
{
- if ((strcmp(mURI, rhs.mURI))
- || (strcmp(mAuthority, rhs.mAuthority))
- || (strcmp(mPath, rhs.mPath))
- || (strcmp(mFilename, rhs.mFilename))
- || (strcmp(mExtension, rhs.mExtension))
- || (strcmp(mTag, rhs.mTag))
- )
- {
- return FALSE;
- }
- return TRUE;
+ if ((strcmp(mURI, rhs.mURI))
+ || (strcmp(mAuthority, rhs.mAuthority))
+ || (strcmp(mPath, rhs.mPath))
+ || (strcmp(mFilename, rhs.mFilename))
+ || (strcmp(mExtension, rhs.mExtension))
+ || (strcmp(mTag, rhs.mTag))
+ )
+ {
+ return FALSE;
+ }
+ return TRUE;
}
bool LLURL::operator!=(const LLURL& rhs) const
{
- return !(*this == rhs);
+ return !(*this == rhs);
}
const char * LLURL::getFQURL() const
{
- char fqurl[LL_MAX_PATH]; /* Flawfinder: ignore */
-
- fqurl[0] = '\0';
-
- if (mURI[0])
- {
- strncat(fqurl,mURI, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
- strcat(fqurl,":"); /* Flawfinder: ignore */
- if (mAuthority[0])
- {
- strcat(fqurl,"//"); /* Flawfinder: ignore */
- }
- }
-
- if (mAuthority[0])
- {
- strncat(fqurl,mAuthority, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
- }
-
- strncat(fqurl,mPath, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
-
- strncat(fqurl,mFilename, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
-
- if (mExtension[0])
- {
- strcat(fqurl,"."); /* Flawfinder: ignore */
- strncat(fqurl,mExtension, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
- }
-
- if (mTag[0])
- {
- strcat(fqurl,"#"); /* Flawfinder: ignore */
- strncat(fqurl,mTag, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
- }
-
- strncpy(LLURL::sReturnString,fqurl, LL_MAX_PATH -1); /* Flawfinder: ignore */
- LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
-
- return(LLURL::sReturnString);
+ char fqurl[LL_MAX_PATH]; /* Flawfinder: ignore */
+
+ fqurl[0] = '\0';
+
+ if (mURI[0])
+ {
+ strncat(fqurl,mURI, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
+ strcat(fqurl,":"); /* Flawfinder: ignore */
+ if (mAuthority[0])
+ {
+ strcat(fqurl,"//"); /* Flawfinder: ignore */
+ }
+ }
+
+ if (mAuthority[0])
+ {
+ strncat(fqurl,mAuthority, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
+ }
+
+ strncat(fqurl,mPath, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
+
+ strncat(fqurl,mFilename, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
+
+ if (mExtension[0])
+ {
+ strcat(fqurl,"."); /* Flawfinder: ignore */
+ strncat(fqurl,mExtension, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
+ }
+
+ if (mTag[0])
+ {
+ strcat(fqurl,"#"); /* Flawfinder: ignore */
+ strncat(fqurl,mTag, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
+ }
+
+ strncpy(LLURL::sReturnString,fqurl, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
+
+ return(LLURL::sReturnString);
}
const char* LLURL::updateRelativePath(const LLURL &url)
{
- char new_path[LL_MAX_PATH]; /* Flawfinder: ignore */
- char tmp_path[LL_MAX_PATH]; /* Flawfinder: ignore */
-
- char *parse;
-
- if (mPath[0] != '/')
- {
- //start with existing path
- strncpy (new_path,url.mPath, LL_MAX_PATH -1); /* Flawfinder: ignore */
- new_path[LL_MAX_PATH -1] = '\0';
- strncpy (tmp_path,mPath, LL_MAX_PATH -1); /* Flawfinder: ignore */
- tmp_path[LL_MAX_PATH -1] = '\0';
-
- parse = strtok(tmp_path,"/");
- while (parse)
- {
- if (!strcmp(parse,"."))
- {
- // skip this, it's meaningless
- }
- else if (!strcmp(parse,".."))
- {
- if ((parse = strrchr(new_path, '/')))
- {
- *parse = '\0';
- if ((parse = strrchr(new_path, '/')))
- {
- *(parse+1) = '\0';
- }
- else
- {
- new_path[0] = '\0';
- }
- }
- else
- {
- strcat(new_path,"../"); /* Flawfinder: ignore */
- }
-
- }
- else
- {
- strncat(new_path,parse, LL_MAX_PATH - strlen(new_path) -1 ); /* Flawfinder: ignore */
- strcat(new_path,"/"); /* Flawfinder: ignore */
- }
- parse = strtok(NULL,"/");
- }
- strncpy(mPath,new_path, LL_MAX_PATH -1); /* Flawfinder: ignore */
- mPath[LL_MAX_PATH -1] = '\0';
- }
- return mPath;
+ char new_path[LL_MAX_PATH]; /* Flawfinder: ignore */
+ char tmp_path[LL_MAX_PATH]; /* Flawfinder: ignore */
+
+ char *parse;
+
+ if (mPath[0] != '/')
+ {
+ //start with existing path
+ strncpy (new_path,url.mPath, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ new_path[LL_MAX_PATH -1] = '\0';
+ strncpy (tmp_path,mPath, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ tmp_path[LL_MAX_PATH -1] = '\0';
+
+ parse = strtok(tmp_path,"/");
+ while (parse)
+ {
+ if (!strcmp(parse,"."))
+ {
+ // skip this, it's meaningless
+ }
+ else if (!strcmp(parse,".."))
+ {
+ if ((parse = strrchr(new_path, '/')))
+ {
+ *parse = '\0';
+ if ((parse = strrchr(new_path, '/')))
+ {
+ *(parse+1) = '\0';
+ }
+ else
+ {
+ new_path[0] = '\0';
+ }
+ }
+ else
+ {
+ strcat(new_path,"../"); /* Flawfinder: ignore */
+ }
+
+ }
+ else
+ {
+ strncat(new_path,parse, LL_MAX_PATH - strlen(new_path) -1 ); /* Flawfinder: ignore */
+ strcat(new_path,"/"); /* Flawfinder: ignore */
+ }
+ parse = strtok(NULL,"/");
+ }
+ strncpy(mPath,new_path, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ mPath[LL_MAX_PATH -1] = '\0';
+ }
+ return mPath;
}
const char * LLURL::getFullPath()
{
- strncpy(LLURL::sReturnString,mPath, LL_MAX_PATH -1); /* Flawfinder: ignore */
- LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
- strncat(LLURL::sReturnString,mFilename, LL_MAX_PATH - strlen(LLURL::sReturnString) -1); /* Flawfinder: ignore */
- strcat(LLURL::sReturnString,"."); /* Flawfinder: ignore */
- strncat(LLURL::sReturnString,mExtension, LL_MAX_PATH - strlen(LLURL::sReturnString) -1); /* Flawfinder: ignore */
- return(sReturnString);
+ strncpy(LLURL::sReturnString,mPath, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
+ strncat(LLURL::sReturnString,mFilename, LL_MAX_PATH - strlen(LLURL::sReturnString) -1); /* Flawfinder: ignore */
+ strcat(LLURL::sReturnString,"."); /* Flawfinder: ignore */
+ strncat(LLURL::sReturnString,mExtension, LL_MAX_PATH - strlen(LLURL::sReturnString) -1); /* Flawfinder: ignore */
+ return(sReturnString);
}
const char * LLURL::getAuthority()
{
- strncpy(LLURL::sReturnString,mAuthority, LL_MAX_PATH -1); /* Flawfinder: ignore */
- LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
- return(sReturnString);
+ strncpy(LLURL::sReturnString,mAuthority, LL_MAX_PATH -1); /* Flawfinder: ignore */
+ LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
+ return(sReturnString);
}
char LLURL::sReturnString[LL_MAX_PATH] = "";
diff --git a/indra/newview/llurl.h b/indra/newview/llurl.h
index 01ab3bdfc2..214cf09da1 100644
--- a/indra/newview/llurl.h
+++ b/indra/newview/llurl.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llurl.h
* @brief Text url class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,38 +57,38 @@
class LLURL
{
public:
- LLURL();
- LLURL(const LLURL &url);
- LLURL(const char * url);
+ LLURL();
+ LLURL(const LLURL &url);
+ LLURL(const char * url);
+
+ LLURL &operator=(const LLURL &rhs);
- LLURL &operator=(const LLURL &rhs);
+ virtual ~LLURL();
- virtual ~LLURL();
+ virtual void init (const char * url);
+ virtual void cleanup ();
- virtual void init (const char * url);
- virtual void cleanup ();
+ bool operator==(const LLURL &rhs) const;
+ bool operator!=(const LLURL &rhs) const;
- bool operator==(const LLURL &rhs) const;
- bool operator!=(const LLURL &rhs) const;
+ virtual const char *getFQURL() const;
+ virtual const char *getFullPath();
+ virtual const char *getAuthority();
- virtual const char *getFQURL() const;
- virtual const char *getFullPath();
- virtual const char *getAuthority();
+ virtual const char *updateRelativePath(const LLURL &url);
- virtual const char *updateRelativePath(const LLURL &url);
+ virtual BOOL isExtension(const char *compare) {return (!strcmp(mExtension,compare));};
- virtual BOOL isExtension(const char *compare) {return (!strcmp(mExtension,compare));};
+public:
-public:
-
- char mURI[LL_MAX_PATH]; /* Flawfinder: ignore */
- char mAuthority[LL_MAX_PATH]; /* Flawfinder: ignore */
- char mPath[LL_MAX_PATH]; /* Flawfinder: ignore */
- char mFilename[LL_MAX_PATH]; /* Flawfinder: ignore */
- char mExtension[LL_MAX_PATH]; /* Flawfinder: ignore */
- char mTag[LL_MAX_PATH]; /* Flawfinder: ignore */
+ char mURI[LL_MAX_PATH]; /* Flawfinder: ignore */
+ char mAuthority[LL_MAX_PATH]; /* Flawfinder: ignore */
+ char mPath[LL_MAX_PATH]; /* Flawfinder: ignore */
+ char mFilename[LL_MAX_PATH]; /* Flawfinder: ignore */
+ char mExtension[LL_MAX_PATH]; /* Flawfinder: ignore */
+ char mTag[LL_MAX_PATH]; /* Flawfinder: ignore */
- static char sReturnString[LL_MAX_PATH]; /* Flawfinder: ignore */
+ static char sReturnString[LL_MAX_PATH]; /* Flawfinder: ignore */
};
#endif // LL_LLURL_H
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 07ea8a4ec6..fbcaaef1b8 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,7 +28,7 @@
#include "llurldispatcher.h"
// viewer includes
-#include "llagent.h" // teleportViaLocation()
+#include "llagent.h" // teleportViaLocation()
#include "llcommandhandler.h"
#include "llfloaterhelpbrowser.h"
#include "llfloaterreg.h"
@@ -38,7 +38,7 @@
#include "llpanellogin.h"
#include "llregionhandle.h"
#include "llslurl.h"
-#include "llstartup.h" // gStartupState
+#include "llstartup.h" // gStartupState
#include "llweb.h"
#include "llworldmapmessage.h"
#include "llurldispatcherlistener.h"
@@ -54,162 +54,162 @@ static LLURLDispatcherListener sURLDispatcherListener;
class LLURLDispatcherImpl
{
public:
- static bool dispatch(const LLSLURL& slurl,
- const std::string& nav_type,
- LLMediaCtrl* web,
- bool trusted_browser);
- // returns true if handled or explicitly blocked.
+ static bool dispatch(const LLSLURL& slurl,
+ const std::string& nav_type,
+ LLMediaCtrl* web,
+ bool trusted_browser);
+ // returns true if handled or explicitly blocked.
- static bool dispatchRightClick(const LLSLURL& slurl);
+ static bool dispatchRightClick(const LLSLURL& slurl);
private:
- static bool dispatchCore(const LLSLURL& slurl,
- const std::string& nav_type,
- bool right_mouse,
- LLMediaCtrl* web,
- bool trusted_browser);
- // handles both left and right click
-
- static bool dispatchHelp(const LLSLURL& slurl, bool right_mouse);
- // Handles sl://app.floater.html.help by showing Help floater.
- // Returns true if handled.
-
- static bool dispatchApp(const LLSLURL& slurl,
- const std::string& nav_type,
- bool right_mouse,
- LLMediaCtrl* web,
- bool trusted_browser);
- // Handles secondlife:///app/agent/<agent_id>/about and similar
- // by showing panel in Search floater.
- // Returns true if handled or explicitly blocked.
-
- static bool dispatchRegion(const LLSLURL& slurl, const std::string& nav_type, bool right_mouse);
- // handles secondlife://Ahern/123/45/67/
- // Returns true if handled.
-
- static void regionHandleCallback(U64 handle, const LLSLURL& slurl,
- const LLUUID& snapshot_id, bool teleport);
- // Called by LLWorldMap when a location has been resolved to a
- // region name
-
- static void regionNameCallback(U64 handle, const LLSLURL& slurl,
- const LLUUID& snapshot_id, bool teleport);
- // Called by LLWorldMap when a region name has been resolved to a
- // location in-world, used by places-panel display.
+ static bool dispatchCore(const LLSLURL& slurl,
+ const std::string& nav_type,
+ bool right_mouse,
+ LLMediaCtrl* web,
+ bool trusted_browser);
+ // handles both left and right click
+
+ static bool dispatchHelp(const LLSLURL& slurl, bool right_mouse);
+ // Handles sl://app.floater.html.help by showing Help floater.
+ // Returns true if handled.
+
+ static bool dispatchApp(const LLSLURL& slurl,
+ const std::string& nav_type,
+ bool right_mouse,
+ LLMediaCtrl* web,
+ bool trusted_browser);
+ // Handles secondlife:///app/agent/<agent_id>/about and similar
+ // by showing panel in Search floater.
+ // Returns true if handled or explicitly blocked.
+
+ static bool dispatchRegion(const LLSLURL& slurl, const std::string& nav_type, bool right_mouse);
+ // handles secondlife://Ahern/123/45/67/
+ // Returns true if handled.
+
+ static void regionHandleCallback(U64 handle, const LLSLURL& slurl,
+ const LLUUID& snapshot_id, bool teleport);
+ // Called by LLWorldMap when a location has been resolved to a
+ // region name
+
+ static void regionNameCallback(U64 handle, const LLSLURL& slurl,
+ const LLUUID& snapshot_id, bool teleport);
+ // Called by LLWorldMap when a region name has been resolved to a
+ // location in-world, used by places-panel display.
static bool handleGrid(const LLSLURL& slurl);
- friend class LLTeleportHandler;
+ friend class LLTeleportHandler;
};
// static
bool LLURLDispatcherImpl::dispatchCore(const LLSLURL& slurl,
- const std::string& nav_type,
- bool right_mouse,
- LLMediaCtrl* web,
- bool trusted_browser)
+ const std::string& nav_type,
+ bool right_mouse,
+ LLMediaCtrl* web,
+ bool trusted_browser)
{
- //if (dispatchHelp(slurl, right_mouse)) return true;
- switch(slurl.getType())
- {
- case LLSLURL::APP:
- return dispatchApp(slurl, nav_type, right_mouse, web, trusted_browser);
- case LLSLURL::LOCATION:
- return dispatchRegion(slurl, nav_type, right_mouse);
- default:
- return false;
- }
-
- /*
- // Inform the user we can't handle this
- std::map<std::string, std::string> args;
- args["SLURL"] = slurl;
- r;
- */
+ //if (dispatchHelp(slurl, right_mouse)) return true;
+ switch(slurl.getType())
+ {
+ case LLSLURL::APP:
+ return dispatchApp(slurl, nav_type, right_mouse, web, trusted_browser);
+ case LLSLURL::LOCATION:
+ return dispatchRegion(slurl, nav_type, right_mouse);
+ default:
+ return false;
+ }
+
+ /*
+ // Inform the user we can't handle this
+ std::map<std::string, std::string> args;
+ args["SLURL"] = slurl;
+ r;
+ */
}
// static
bool LLURLDispatcherImpl::dispatch(const LLSLURL& slurl,
- const std::string& nav_type,
- LLMediaCtrl* web,
- bool trusted_browser)
+ const std::string& nav_type,
+ LLMediaCtrl* web,
+ bool trusted_browser)
{
// SL-20422 : Clicking the "Bring it back" link on Aditi displays a teleport alert
// Stop further processing empty urls like [secondlife:/// Bring it back.]
if (slurl.getType() == LLSLURL::EMPTY)
return true;
- const bool right_click = false;
- return dispatchCore(slurl, nav_type, right_click, web, trusted_browser);
+ const bool right_click = false;
+ return dispatchCore(slurl, nav_type, right_click, web, trusted_browser);
}
// static
bool LLURLDispatcherImpl::dispatchRightClick(const LLSLURL& slurl)
{
- const bool right_click = true;
- LLMediaCtrl* web = NULL;
- const bool trusted_browser = false;
+ const bool right_click = true;
+ LLMediaCtrl* web = NULL;
+ const bool trusted_browser = false;
return dispatchCore(slurl, LLCommandHandler::NAV_TYPE_CLICKED, right_click, web, trusted_browser);
}
// static
-bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl,
- const std::string& nav_type,
- bool right_mouse,
- LLMediaCtrl* web,
- bool trusted_browser)
+bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl,
+ const std::string& nav_type,
+ bool right_mouse,
+ LLMediaCtrl* web,
+ bool trusted_browser)
{
- LL_INFOS() << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << LL_ENDL;
- const LLSD& query_map = LLURI::queryMap(slurl.getAppQuery());
- bool handled = LLCommandDispatcher::dispatch(
- slurl.getAppCmd(), slurl.getAppPath(), query_map, slurl.getGrid(), web, nav_type, trusted_browser);
-
- // alert if we didn't handle this secondlife:///app/ SLURL
- // (but still return true because it is a valid app SLURL)
- if (! handled)
- {
- LLNotificationsUtil::add("UnsupportedCommandSLURL");
- }
- return true;
+ LL_INFOS() << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << LL_ENDL;
+ const LLSD& query_map = LLURI::queryMap(slurl.getAppQuery());
+ bool handled = LLCommandDispatcher::dispatch(
+ slurl.getAppCmd(), slurl.getAppPath(), query_map, slurl.getGrid(), web, nav_type, trusted_browser);
+
+ // alert if we didn't handle this secondlife:///app/ SLURL
+ // (but still return true because it is a valid app SLURL)
+ if (! handled)
+ {
+ LLNotificationsUtil::add("UnsupportedCommandSLURL");
+ }
+ return true;
}
// static
bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string& nav_type, bool right_mouse)
{
- if(slurl.getType() != LLSLURL::LOCATION)
+ if(slurl.getType() != LLSLURL::LOCATION)
+ {
+ return false;
+ }
+ // Before we're logged in, need to update the startup screen
+ // to tell the user where they are going.
+ if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
{
- return false;
+ // We're at the login screen, so make sure user can see
+ // the login location box to know where they are going.
+
+ LLPanelLogin::setLocation(slurl);
+ return true;
}
- // Before we're logged in, need to update the startup screen
- // to tell the user where they are going.
- if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
- {
- // We're at the login screen, so make sure user can see
- // the login location box to know where they are going.
-
- LLPanelLogin::setLocation(slurl);
- return true;
- }
if (!handleGrid(slurl))
{
return true;
}
- // Request a region handle by name
- LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
- LLURLDispatcherImpl::regionNameCallback,
- slurl.getSLURLString(),
- LLUI::getInstance()->mSettingGroups["config"]->getBOOL("SLURLTeleportDirectly")); // don't teleport
- return true;
+ // Request a region handle by name
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
+ LLURLDispatcherImpl::regionNameCallback,
+ slurl.getSLURLString(),
+ LLUI::getInstance()->mSettingGroups["config"]->getBOOL("SLURLTeleportDirectly")); // don't teleport
+ return true;
}
/*static*/
void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
{
-
+
if(slurl.getType() == LLSLURL::LOCATION)
- {
+ {
regionHandleCallback(region_handle, slurl, snapshot_id, teleport);
}
}
@@ -247,29 +247,29 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL&
// we can't teleport cross grid at this point
return;
}
-
- LLVector3d global_pos = from_region_handle(region_handle);
- global_pos += LLVector3d(slurl.getPosition());
-
- if (teleport)
- {
- gAgent.teleportViaLocation(global_pos);
- LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
- if(instance)
- {
- instance->trackLocation(global_pos);
- }
- }
- else
- {
- LLSD key;
- key["type"] = "remote_place";
- key["x"] = global_pos.mdV[VX];
- key["y"] = global_pos.mdV[VY];
- key["z"] = global_pos.mdV[VZ];
-
- LLFloaterSidePanelContainer::showPanel("places", key);
- }
+
+ LLVector3d global_pos = from_region_handle(region_handle);
+ global_pos += LLVector3d(slurl.getPosition());
+
+ if (teleport)
+ {
+ gAgent.teleportViaLocation(global_pos);
+ LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
+ if(instance)
+ {
+ instance->trackLocation(global_pos);
+ }
+ }
+ else
+ {
+ LLSD key;
+ key["type"] = "remote_place";
+ key["x"] = global_pos.mdV[VX];
+ key["y"] = global_pos.mdV[VY];
+ key["z"] = global_pos.mdV[VZ];
+
+ LLFloaterSidePanelContainer::showPanel("places", key);
+ }
}
//---------------------------------------------------------------------------
@@ -279,111 +279,111 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL&
class LLTeleportHandler : public LLCommandHandler, public LLEventAPI
{
public:
- // Teleport requests *must* come from a trusted browser
- // inside the app, otherwise a malicious web page could
- // cause a constant teleport loop. JC
- LLTeleportHandler() :
- LLCommandHandler("teleport", UNTRUSTED_CLICK_ONLY),
- LLEventAPI("LLTeleportHandler", "Low-level teleport API")
- {
- LLEventAPI::add("teleport",
- "Teleport to specified [\"regionname\"] at\n"
- "specified region-relative [\"x\"], [\"y\"], [\"z\"].\n"
- "If [\"regionname\"] omitted, teleport to GLOBAL\n"
- "coordinates [\"x\"], [\"y\"], [\"z\"].",
- &LLTeleportHandler::from_event);
- }
-
- bool handle(const LLSD& tokens,
+ // Teleport requests *must* come from a trusted browser
+ // inside the app, otherwise a malicious web page could
+ // cause a constant teleport loop. JC
+ LLTeleportHandler() :
+ LLCommandHandler("teleport", UNTRUSTED_CLICK_ONLY),
+ LLEventAPI("LLTeleportHandler", "Low-level teleport API")
+ {
+ LLEventAPI::add("teleport",
+ "Teleport to specified [\"regionname\"] at\n"
+ "specified region-relative [\"x\"], [\"y\"], [\"z\"].\n"
+ "If [\"regionname\"] omitted, teleport to GLOBAL\n"
+ "coordinates [\"x\"], [\"y\"], [\"z\"].",
+ &LLTeleportHandler::from_event);
+ }
+
+ bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- // construct a "normal" SLURL, resolve the region to
- // a global position, and teleport to it
- if (tokens.size() < 1) return false;
-
- LLVector3 coords(128, 128, 0);
- if (tokens.size() <= 4)
- {
- coords = LLVector3(tokens[1].asReal(),
- tokens[2].asReal(),
- tokens[3].asReal());
- }
-
- // Region names may be %20 escaped.
- std::string region_name = LLURI::unescape(tokens[0]);
-
- LLSD args;
- args["LOCATION"] = region_name;
-
- LLSD payload;
- payload["region_name"] = region_name;
- payload["callback_url"] = LLSLURL(grid, region_name, coords).getSLURLString();
-
- LLNotificationsUtil::add("TeleportViaSLAPP", args, payload);
- return true;
- }
-
- void from_event(const LLSD& params) const
- {
- Response response(LLSD(), params);
- if (params.has("regionname"))
- {
- // region specified, coordinates (if any) are region-local
- LLVector3 local_pos(
- params.has("x")? params["x"].asReal() : 128,
- params.has("y")? params["y"].asReal() : 128,
- params.has("z")? params["z"].asReal() : 0);
- std::string regionname(params["regionname"]);
- std::string destination(LLSLURL(regionname, local_pos).getSLURLString());
- // have to resolve region's global coordinates first
- teleport_via_slapp(regionname, destination);
- response["message"] = "Teleporting to " + destination;
- }
- else // no regionname
- {
- // coordinates are global, and at least (x, y) are required
- if (! (params.has("x") && params.has("y")))
- {
- return response.error("Specify either regionname or global (x, y)");
- }
- LLVector3d global_pos(params["x"].asReal(), params["y"].asReal(),
- params["z"].asReal());
- gAgent.teleportViaLocation(global_pos);
- LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
- if (instance)
- {
- instance->trackLocation(global_pos);
- }
- response["message"] = STRINGIZE("Teleporting to global " << global_pos);
- }
- }
-
- static void teleport_via_slapp(std::string region_name, std::string callback_url)
- {
-
- LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
- LLURLDispatcherImpl::regionHandleCallback,
- callback_url,
- true); // teleport
- }
-
- static bool teleport_via_slapp_callback(const LLSD& notification, const LLSD& response)
- {
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- std::string region_name = notification["payload"]["region_name"].asString();
- std::string callback_url = notification["payload"]["callback_url"].asString();
-
- if (option == 0)
- {
- teleport_via_slapp(region_name, callback_url);
- return true;
- }
-
- return false;
- }
+ {
+ // construct a "normal" SLURL, resolve the region to
+ // a global position, and teleport to it
+ if (tokens.size() < 1) return false;
+
+ LLVector3 coords(128, 128, 0);
+ if (tokens.size() <= 4)
+ {
+ coords = LLVector3(tokens[1].asReal(),
+ tokens[2].asReal(),
+ tokens[3].asReal());
+ }
+
+ // Region names may be %20 escaped.
+ std::string region_name = LLURI::unescape(tokens[0]);
+
+ LLSD args;
+ args["LOCATION"] = region_name;
+
+ LLSD payload;
+ payload["region_name"] = region_name;
+ payload["callback_url"] = LLSLURL(grid, region_name, coords).getSLURLString();
+
+ LLNotificationsUtil::add("TeleportViaSLAPP", args, payload);
+ return true;
+ }
+
+ void from_event(const LLSD& params) const
+ {
+ Response response(LLSD(), params);
+ if (params.has("regionname"))
+ {
+ // region specified, coordinates (if any) are region-local
+ LLVector3 local_pos(
+ params.has("x")? params["x"].asReal() : 128,
+ params.has("y")? params["y"].asReal() : 128,
+ params.has("z")? params["z"].asReal() : 0);
+ std::string regionname(params["regionname"]);
+ std::string destination(LLSLURL(regionname, local_pos).getSLURLString());
+ // have to resolve region's global coordinates first
+ teleport_via_slapp(regionname, destination);
+ response["message"] = "Teleporting to " + destination;
+ }
+ else // no regionname
+ {
+ // coordinates are global, and at least (x, y) are required
+ if (! (params.has("x") && params.has("y")))
+ {
+ return response.error("Specify either regionname or global (x, y)");
+ }
+ LLVector3d global_pos(params["x"].asReal(), params["y"].asReal(),
+ params["z"].asReal());
+ gAgent.teleportViaLocation(global_pos);
+ LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
+ if (instance)
+ {
+ instance->trackLocation(global_pos);
+ }
+ response["message"] = STRINGIZE("Teleporting to global " << global_pos);
+ }
+ }
+
+ static void teleport_via_slapp(std::string region_name, std::string callback_url)
+ {
+
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
+ LLURLDispatcherImpl::regionHandleCallback,
+ callback_url,
+ true); // teleport
+ }
+
+ static bool teleport_via_slapp_callback(const LLSD& notification, const LLSD& response)
+ {
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ std::string region_name = notification["payload"]["region_name"].asString();
+ std::string callback_url = notification["payload"]["callback_url"].asString();
+
+ if (option == 0)
+ {
+ teleport_via_slapp(region_name, callback_url);
+ return true;
+ }
+
+ return false;
+ }
};
LLTeleportHandler gTeleportHandler;
@@ -395,30 +395,30 @@ static LLNotificationFunctorRegistration open_landmark_callback_reg("TeleportVia
// static
bool LLURLDispatcher::dispatch(const std::string& slurl,
- const std::string& nav_type,
- LLMediaCtrl* web,
- bool trusted_browser)
+ const std::string& nav_type,
+ LLMediaCtrl* web,
+ bool trusted_browser)
{
- return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), nav_type, web, trusted_browser);
+ return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), nav_type, web, trusted_browser);
}
// static
bool LLURLDispatcher::dispatchRightClick(const std::string& slurl)
{
- return LLURLDispatcherImpl::dispatchRightClick(LLSLURL(slurl));
+ return LLURLDispatcherImpl::dispatchRightClick(LLSLURL(slurl));
}
// static
bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl, bool trusted_content)
{
- // *NOTE: Text editors are considered sources of trusted URLs
- // in order to make avatar profile links in chat history work.
- // While a malicious resident could chat an app SLURL, the
- // receiving resident will see it and must affirmatively
- // click on it.
- // *TODO: Make this trust model more refined. JC
-
- LLMediaCtrl* web = NULL;
+ // *NOTE: Text editors are considered sources of trusted URLs
+ // in order to make avatar profile links in chat history work.
+ // While a malicious resident could chat an app SLURL, the
+ // receiving resident will see it and must affirmatively
+ // click on it.
+ // *TODO: Make this trust model more refined. JC
+
+ LLMediaCtrl* web = NULL;
return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), LLCommandHandler::NAV_TYPE_CLICKED, web, trusted_content);
}
diff --git a/indra/newview/llurldispatcher.h b/indra/newview/llurldispatcher.h
index 9b05260af1..c7fdacccca 100644
--- a/indra/newview/llurldispatcher.h
+++ b/indra/newview/llurldispatcher.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,29 +31,29 @@ class LLMediaCtrl;
class LLURLDispatcher
{
public:
-
- static bool dispatch(const std::string& slurl,
- const std::string& nav_type,
- LLMediaCtrl* web,
- bool trusted_browser);
- // At startup time and on clicks in internal web browsers,
- // teleport, open map, or run requested command.
- // @param url
- // secondlife://RegionName/123/45/67/
- // secondlife:///app/agent/3d6181b0-6a4b-97ef-18d8-722652995cf1/show
- // sl://app/foo/bar
- // @param nav_type
- // type of navigation type (see LLQtWebKit::LLWebPage::acceptNavigationRequest)
- // @param web
- // Pointer to LLMediaCtrl sending URL, can be NULL
- // @param trusted_browser
- // True if coming inside the app AND from a brower instance
- // that navigates to trusted (Linden Lab) pages.
- // Returns true if someone handled the URL.
- static bool dispatchRightClick(const std::string& slurl);
+ static bool dispatch(const std::string& slurl,
+ const std::string& nav_type,
+ LLMediaCtrl* web,
+ bool trusted_browser);
+ // At startup time and on clicks in internal web browsers,
+ // teleport, open map, or run requested command.
+ // @param url
+ // secondlife://RegionName/123/45/67/
+ // secondlife:///app/agent/3d6181b0-6a4b-97ef-18d8-722652995cf1/show
+ // sl://app/foo/bar
+ // @param nav_type
+ // type of navigation type (see LLQtWebKit::LLWebPage::acceptNavigationRequest)
+ // @param web
+ // Pointer to LLMediaCtrl sending URL, can be NULL
+ // @param trusted_browser
+ // True if coming inside the app AND from a brower instance
+ // that navigates to trusted (Linden Lab) pages.
+ // Returns true if someone handled the URL.
+
+ static bool dispatchRightClick(const std::string& slurl);
- static bool dispatchFromTextEditor(const std::string& slurl, bool trusted_content);
+ static bool dispatchFromTextEditor(const std::string& slurl, bool trusted_content);
};
#endif
diff --git a/indra/newview/llurldispatcherlistener.cpp b/indra/newview/llurldispatcherlistener.cpp
index 7545f3a9b3..9d62a16370 100644
--- a/indra/newview/llurldispatcherlistener.cpp
+++ b/indra/newview/llurldispatcherlistener.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-12-10
* @brief Implementation for llurldispatcherlistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -71,5 +71,5 @@ void LLURLDispatcherListener::dispatchRightClick(const LLSD& params) const
void LLURLDispatcherListener::dispatchFromTextEditor(const LLSD& params) const
{
- LLURLDispatcher::dispatchFromTextEditor(params["url"], false);
+ LLURLDispatcher::dispatchFromTextEditor(params["url"], false);
}
diff --git a/indra/newview/llurldispatcherlistener.h b/indra/newview/llurldispatcherlistener.h
index b09594bb39..e789d41b83 100644
--- a/indra/newview/llurldispatcherlistener.h
+++ b/indra/newview/llurldispatcherlistener.h
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-12-10
* @brief LLEventAPI for LLURLDispatcher
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llurlfloaterdispatchhandler.cpp b/indra/newview/llurlfloaterdispatchhandler.cpp
index 6b1a373beb..9bee4870be 100644
--- a/indra/newview/llurlfloaterdispatchhandler.cpp
+++ b/indra/newview/llurlfloaterdispatchhandler.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llurlfloaterdispatchhandler.cpp
* @brief Handles URLFloater generic message from server
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -170,7 +170,7 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
}
LLFloaterReg::toggleInstanceOrBringToFront("guidebook", params);
-
+
if (command_params.isMap())
{
LLFloater* instance = LLFloaterReg::findInstance("guidebook");
diff --git a/indra/newview/llurlfloaterdispatchhandler.h b/indra/newview/llurlfloaterdispatchhandler.h
index 1dff52c66f..62b90f9a9d 100644
--- a/indra/newview/llurlfloaterdispatchhandler.h
+++ b/indra/newview/llurlfloaterdispatchhandler.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llurlfloaterdispatchhandler.h
* @brief Handles URLFloater generic message from server
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp
index f7064e152a..b44d0a57bd 100644
--- a/indra/newview/llurlhistory.cpp
+++ b/indra/newview/llurlhistory.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,7 +42,7 @@ bool LLURLHistory::loadFile(const std::string& filename)
{
bool dataloaded = false;
sHistorySD = LLSD();
- LLSD data;
+ LLSD data;
std::string user_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename);
@@ -65,60 +65,60 @@ bool LLURLHistory::loadFile(const std::string& filename)
{
LL_INFOS() << "Unable to open history file at " << user_filename << LL_ENDL;
}
- return dataloaded;
+ return dataloaded;
}
// static
bool LLURLHistory::saveFile(const std::string& filename)
-{
- std::string temp_str = gDirUtilp->getLindenUserDir();
- if( temp_str.empty() )
- {
- LL_INFOS() << "Can't save URL history - no user directory set yet." << LL_ENDL;
- return false;
- }
-
- temp_str += gDirUtilp->getDirDelimiter() + filename;
- llofstream out(temp_str.c_str());
- if (!out.good())
- {
- LL_WARNS() << "Unable to open " << temp_str << " for output." << LL_ENDL;
- return false;
- }
-
- LLSDSerialize::toXML(sHistorySD, out);
-
- out.close();
- return true;
+{
+ std::string temp_str = gDirUtilp->getLindenUserDir();
+ if( temp_str.empty() )
+ {
+ LL_INFOS() << "Can't save URL history - no user directory set yet." << LL_ENDL;
+ return false;
+ }
+
+ temp_str += gDirUtilp->getDirDelimiter() + filename;
+ llofstream out(temp_str.c_str());
+ if (!out.good())
+ {
+ LL_WARNS() << "Unable to open " << temp_str << " for output." << LL_ENDL;
+ return false;
+ }
+
+ LLSDSerialize::toXML(sHistorySD, out);
+
+ out.close();
+ return true;
}
// static
// This function returns a portion of the history llsd that contains the collected
// url history
LLSD LLURLHistory::getURLHistory(const std::string& collection)
{
- if(sHistorySD.has(collection))
- {
- return sHistorySD[collection];
- }
- return LLSD();
+ if(sHistorySD.has(collection))
+ {
+ return sHistorySD[collection];
+ }
+ return LLSD();
}
// static
void LLURLHistory::addURL(const std::string& collection, const std::string& url)
{
- if(!url.empty())
- {
+ if(!url.empty())
+ {
LLURI u(url);
std::string simplified_url = u.scheme() + "://" + u.authority() + u.path();
- sHistorySD[collection].insert(0, simplified_url);
- LLURLHistory::limitSize(collection);
- }
+ sHistorySD[collection].insert(0, simplified_url);
+ LLURLHistory::limitSize(collection);
+ }
}
// static
void LLURLHistory::removeURL(const std::string& collection, const std::string& url)
{
- if(!url.empty())
- {
+ if(!url.empty())
+ {
LLURI u(url);
std::string simplified_url = u.scheme() + "://" + u.authority() + u.path();
for(int index = 0; index < sHistorySD[collection].size(); index++)
@@ -134,14 +134,14 @@ void LLURLHistory::removeURL(const std::string& collection, const std::string& u
// static
void LLURLHistory::clear(const std::string& collection)
{
- sHistorySD[ collection ] = LLSD();
+ sHistorySD[ collection ] = LLSD();
}
void LLURLHistory::limitSize(const std::string& collection)
{
- while(sHistorySD[collection].size() > MAX_URL_COUNT)
- {
- sHistorySD[collection].erase(MAX_URL_COUNT);
- }
+ while(sHistorySD[collection].size() > MAX_URL_COUNT)
+ {
+ sHistorySD[collection].erase(MAX_URL_COUNT);
+ }
}
diff --git a/indra/newview/llurlhistory.h b/indra/newview/llurlhistory.h
index 3cce4cbe1d..68b5a36c0b 100644
--- a/indra/newview/llurlhistory.h
+++ b/indra/newview/llurlhistory.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,22 +34,22 @@ class LLSD;
class LLURLHistory
{
public:
- // Loads an xml file of URLs. Currently only supports Parcel URL history
- static bool loadFile(const std::string& filename);
+ // Loads an xml file of URLs. Currently only supports Parcel URL history
+ static bool loadFile(const std::string& filename);
- // Saves the current history to XML
- static bool saveFile(const std::string& filename);
+ // Saves the current history to XML
+ static bool saveFile(const std::string& filename);
- static LLSD getURLHistory(const std::string& collection);
+ static LLSD getURLHistory(const std::string& collection);
- static void addURL(const std::string& collection, const std::string& url);
- static void removeURL(const std::string& collection, const std::string& url);
- static void clear(const std::string& collection);
+ static void addURL(const std::string& collection, const std::string& url);
+ static void removeURL(const std::string& collection, const std::string& url);
+ static void clear(const std::string& collection);
- static void limitSize(const std::string& collection);
+ static void limitSize(const std::string& collection);
private:
- static LLSD sHistorySD;
+ static LLSD sHistorySD;
};
#endif // LLURLHISTORY_H
diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp
index 2b7e598a59..cf6e021cb8 100644
--- a/indra/newview/llurllineeditorctrl.cpp
+++ b/indra/newview/llurllineeditorctrl.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llurllineeditorctrl.cpp
* @brief LLURLLineEditor base class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,51 +43,51 @@ LLURLLineEditor::LLURLLineEditor(const LLLineEditor::Params& p)
// copy selection to clipboard
void LLURLLineEditor::copy()
{
- if( canCopy() )
- {
- copyEscapedURLToClipboard();
- }
+ if( canCopy() )
+ {
+ copyEscapedURLToClipboard();
+ }
}
// cut selection to clipboard
void LLURLLineEditor::cut()
{
- if( canCut() )
- {
- // Prepare for possible rollback
- LLURLLineEditorRollback rollback( this );
+ if( canCut() )
+ {
+ // Prepare for possible rollback
+ LLURLLineEditorRollback rollback( this );
- copyEscapedURLToClipboard();
+ copyEscapedURLToClipboard();
- deleteSelection();
+ deleteSelection();
- // Validate new string and rollback the if needed.
- BOOL need_to_rollback = ( mPrevalidateFunc && !mPrevalidateFunc( mText.getWString() ) );
- if( need_to_rollback )
- {
- rollback.doRollback( this );
- LLUI::getInstance()->reportBadKeystroke();
- }
- else
- if( mKeystrokeCallback )
- {
- mKeystrokeCallback( this );
- }
- }
+ // Validate new string and rollback the if needed.
+ BOOL need_to_rollback = ( mPrevalidateFunc && !mPrevalidateFunc( mText.getWString() ) );
+ if( need_to_rollback )
+ {
+ rollback.doRollback( this );
+ LLUI::getInstance()->reportBadKeystroke();
+ }
+ else
+ if( mKeystrokeCallback )
+ {
+ mKeystrokeCallback( this );
+ }
+ }
}
// Copies escaped URL to clipboard
void LLURLLineEditor::copyEscapedURLToClipboard()
{
- S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
- S32 length = llabs( mSelectionStart - mSelectionEnd );
+ S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
+ S32 length = llabs( mSelectionStart - mSelectionEnd );
+
+ const std::string unescaped_text = wstring_to_utf8str(mText.getWString().substr(left_pos, length));
+ LLWString text_to_copy;
+ // *HACK: Because LLSLURL is currently broken we cannot use it to check if unescaped_text is a valid SLURL (see EXT-8335).
+ if (LLStringUtil::startsWith(unescaped_text, "http://") || LLStringUtil::startsWith(unescaped_text, "secondlife://")) // SLURL
+ text_to_copy = utf8str_to_wstring(LLWeb::escapeURL(unescaped_text));
+ else // human-readable location
+ text_to_copy = utf8str_to_wstring(unescaped_text);
- const std::string unescaped_text = wstring_to_utf8str(mText.getWString().substr(left_pos, length));
- LLWString text_to_copy;
- // *HACK: Because LLSLURL is currently broken we cannot use it to check if unescaped_text is a valid SLURL (see EXT-8335).
- if (LLStringUtil::startsWith(unescaped_text, "http://") || LLStringUtil::startsWith(unescaped_text, "secondlife://")) // SLURL
- text_to_copy = utf8str_to_wstring(LLWeb::escapeURL(unescaped_text));
- else // human-readable location
- text_to_copy = utf8str_to_wstring(unescaped_text);
-
- LLClipboard::instance().copyToClipboard(text_to_copy, 0, text_to_copy.size());
+ LLClipboard::instance().copyToClipboard(text_to_copy, 0, text_to_copy.size());
}
diff --git a/indra/newview/llurllineeditorctrl.h b/indra/newview/llurllineeditorctrl.h
index b9540dd571..5d2203ae46 100644
--- a/indra/newview/llurllineeditorctrl.h
+++ b/indra/newview/llurllineeditorctrl.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llurllineeditorctrl.h
* @brief Combobox-like location input control
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,58 +34,58 @@
// LLURLLineEditor class performing escaping of an URL while copying or cutting the target text
class LLURLLineEditor: public LLLineEditor {
- LOG_CLASS( LLURLLineEditor);
+ LOG_CLASS( LLURLLineEditor);
public:
- // LLLineEditor overrides to do necessary escaping
- /*virtual*/ void copy();
- /*virtual*/ void cut();
+ // LLLineEditor overrides to do necessary escaping
+ /*virtual*/ void copy();
+ /*virtual*/ void cut();
protected:
- LLURLLineEditor(const Params&);
- friend class LLUICtrlFactory;
- friend class LLFloaterEditUI;
+ LLURLLineEditor(const Params&);
+ friend class LLUICtrlFactory;
+ friend class LLFloaterEditUI;
private:
- // util function to escape selected text and copy it to clipboard
- void copyEscapedURLToClipboard();
+ // util function to escape selected text and copy it to clipboard
+ void copyEscapedURLToClipboard();
- // Helper class to do rollback if needed
- class LLURLLineEditorRollback
- {
- public:
- LLURLLineEditorRollback( LLURLLineEditor* ed )
- :
- mCursorPos( ed->mCursorPos ),
- mScrollHPos( ed->mScrollHPos ),
- mIsSelecting( ed->mIsSelecting ),
- mSelectionStart( ed->mSelectionStart ),
- mSelectionEnd( ed->mSelectionEnd )
- {
- mText = ed->getText();
- }
+ // Helper class to do rollback if needed
+ class LLURLLineEditorRollback
+ {
+ public:
+ LLURLLineEditorRollback( LLURLLineEditor* ed )
+ :
+ mCursorPos( ed->mCursorPos ),
+ mScrollHPos( ed->mScrollHPos ),
+ mIsSelecting( ed->mIsSelecting ),
+ mSelectionStart( ed->mSelectionStart ),
+ mSelectionEnd( ed->mSelectionEnd )
+ {
+ mText = ed->getText();
+ }
- void doRollback( LLURLLineEditor* ed )
- {
- ed->mCursorPos = mCursorPos;
- ed->mScrollHPos = mScrollHPos;
- ed->mIsSelecting = mIsSelecting;
- ed->mSelectionStart = mSelectionStart;
- ed->mSelectionEnd = mSelectionEnd;
- ed->mText = mText;
- ed->mPrevText = mText;
- }
+ void doRollback( LLURLLineEditor* ed )
+ {
+ ed->mCursorPos = mCursorPos;
+ ed->mScrollHPos = mScrollHPos;
+ ed->mIsSelecting = mIsSelecting;
+ ed->mSelectionStart = mSelectionStart;
+ ed->mSelectionEnd = mSelectionEnd;
+ ed->mText = mText;
+ ed->mPrevText = mText;
+ }
- std::string getText() { return mText; }
+ std::string getText() { return mText; }
- private:
- std::string mText;
- S32 mCursorPos;
- S32 mScrollHPos;
- BOOL mIsSelecting;
- S32 mSelectionStart;
- S32 mSelectionEnd;
- }; // end class LLURLLineEditorRollback
+ private:
+ std::string mText;
+ S32 mCursorPos;
+ S32 mScrollHPos;
+ BOOL mIsSelecting;
+ S32 mSelectionStart;
+ S32 mSelectionEnd;
+ }; // end class LLURLLineEditorRollback
};
diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp
index b4d38f5d1e..f5651646a6 100644
--- a/indra/newview/llurlwhitelist.cpp
+++ b/indra/newview/llurlwhitelist.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llurlwhitelist.cpp
* @author Callum Prentice
* @brief maintains a "white list" of acceptable URLS that are stored on disk
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,10 +34,10 @@
///////////////////////////////////////////////////////////////////////////////
//
LLUrlWhiteList::LLUrlWhiteList () :
- mLoaded ( false ),
- mFilename ( "url_whitelist.ini" ),
- mUrlList ( 0 ),
- mCurIndex ( 0 )
+ mLoaded ( false ),
+ mFilename ( "url_whitelist.ini" ),
+ mUrlList ( 0 ),
+ mCurIndex ( 0 )
{
}
@@ -51,146 +51,146 @@ LLUrlWhiteList::~LLUrlWhiteList ()
//
bool LLUrlWhiteList::load ()
{
- // don't load if we're already loaded
- if ( mLoaded )
- return ( true );
+ // don't load if we're already loaded
+ if ( mLoaded )
+ return ( true );
- // remove current entries before we load over them
- clear ();
+ // remove current entries before we load over them
+ clear ();
- // build filename for each user
- std::string resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename );
+ // build filename for each user
+ std::string resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename );
- // open a file for reading
- llifstream file(resolvedFilename.c_str());
- if ( file.is_open () )
- {
- // add each line in the file to the list
- std::string line;
- while ( std::getline ( file, line ) )
- {
- addItem ( line, false );
- };
+ // open a file for reading
+ llifstream file(resolvedFilename.c_str());
+ if ( file.is_open () )
+ {
+ // add each line in the file to the list
+ std::string line;
+ while ( std::getline ( file, line ) )
+ {
+ addItem ( line, false );
+ };
- file.close ();
+ file.close ();
- // flag as loaded
- mLoaded = true;
+ // flag as loaded
+ mLoaded = true;
- return true;
- };
+ return true;
+ };
- return false;
+ return false;
}
///////////////////////////////////////////////////////////////////////////////
//
bool LLUrlWhiteList::save ()
{
- // build filename for each user
- std::string resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename );
-
- if (resolvedFilename.empty())
- {
- LL_INFOS() << "No per-user dir for saving URL whitelist - presumably not logged in yet. Skipping." << LL_ENDL;
- return false;
- }
-
- // open a file for writing
- llofstream file(resolvedFilename.c_str());
- if ( file.is_open () )
- {
- // for each entry we have
- for ( string_list_t::iterator iter = mUrlList.begin (); iter != mUrlList.end (); ++iter )
- {
- file << ( *iter ) << std::endl;
- }
-
- file.close ();
-
- return true;
- };
-
- return false;
+ // build filename for each user
+ std::string resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename );
+
+ if (resolvedFilename.empty())
+ {
+ LL_INFOS() << "No per-user dir for saving URL whitelist - presumably not logged in yet. Skipping." << LL_ENDL;
+ return false;
+ }
+
+ // open a file for writing
+ llofstream file(resolvedFilename.c_str());
+ if ( file.is_open () )
+ {
+ // for each entry we have
+ for ( string_list_t::iterator iter = mUrlList.begin (); iter != mUrlList.end (); ++iter )
+ {
+ file << ( *iter ) << std::endl;
+ }
+
+ file.close ();
+
+ return true;
+ };
+
+ return false;
}
///////////////////////////////////////////////////////////////////////////////
//
bool LLUrlWhiteList::clear ()
{
- mUrlList.clear ();
+ mUrlList.clear ();
- mCurIndex = 0;
+ mCurIndex = 0;
- return true;
+ return true;
}
std::string url_cleanup(std::string pattern)
{
- LLStringUtil::trim(pattern);
- S32 length = pattern.length();
- S32 position = 0;
- std::string::reverse_iterator it = pattern.rbegin();
- ++it; // skip last char, might be '/'
- ++position;
- for (; it < pattern.rend(); ++it)
- {
- char c = *it;
- if (c == '/')
- {
- // found second to last '/'
- S32 desired_length = length - position;
- LLStringUtil::truncate(pattern, desired_length);
- break;
- }
- ++position;
- }
- return pattern;
+ LLStringUtil::trim(pattern);
+ S32 length = pattern.length();
+ S32 position = 0;
+ std::string::reverse_iterator it = pattern.rbegin();
+ ++it; // skip last char, might be '/'
+ ++position;
+ for (; it < pattern.rend(); ++it)
+ {
+ char c = *it;
+ if (c == '/')
+ {
+ // found second to last '/'
+ S32 desired_length = length - position;
+ LLStringUtil::truncate(pattern, desired_length);
+ break;
+ }
+ ++position;
+ }
+ return pattern;
}
///////////////////////////////////////////////////////////////////////////////
//
bool LLUrlWhiteList::addItem ( const std::string& itemIn, bool saveAfterAdd )
{
- std::string item = url_cleanup(itemIn);
-
- mUrlList.push_back ( item );
+ std::string item = url_cleanup(itemIn);
+
+ mUrlList.push_back ( item );
- // use this when all you want to do is call addItem ( ... ) where necessary
- if ( saveAfterAdd )
- save ();
+ // use this when all you want to do is call addItem ( ... ) where necessary
+ if ( saveAfterAdd )
+ save ();
- return true;
+ return true;
}
///////////////////////////////////////////////////////////////////////////////
//
bool LLUrlWhiteList::getFirst ( std::string& valueOut )
{
- if ( mUrlList.size () == 0 )
- return false;
+ if ( mUrlList.size () == 0 )
+ return false;
- mCurIndex = 0;
- valueOut = mUrlList[mCurIndex++];
+ mCurIndex = 0;
+ valueOut = mUrlList[mCurIndex++];
- return true;
+ return true;
}
///////////////////////////////////////////////////////////////////////////////
//
bool LLUrlWhiteList::getNext ( std::string& valueOut )
{
- if ( mCurIndex >= mUrlList.size () )
- return false;
+ if ( mCurIndex >= mUrlList.size () )
+ return false;
- valueOut = mUrlList[mCurIndex++];
+ valueOut = mUrlList[mCurIndex++];
- return true;
+ return true;
}
///////////////////////////////////////////////////////////////////////////////
//
bool LLUrlWhiteList::containsMatch ( const std::string& patternIn )
{
- return false;
+ return false;
}
diff --git a/indra/newview/llurlwhitelist.h b/indra/newview/llurlwhitelist.h
index c2511b08fd..8326c1057f 100644
--- a/indra/newview/llurlwhitelist.h
+++ b/indra/newview/llurlwhitelist.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llurlwhitelist.h
* @author Callum Prentice
* @brief maintains a "white list" of acceptable URLS that are stored on disk
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,27 +32,27 @@
class LLUrlWhiteList : public LLSingleton<LLUrlWhiteList>
{
- LLSINGLETON(LLUrlWhiteList);
- ~LLUrlWhiteList();
- public:
- bool load ();
- bool save ();
+ LLSINGLETON(LLUrlWhiteList);
+ ~LLUrlWhiteList();
+ public:
+ bool load ();
+ bool save ();
- bool clear ();
- bool addItem ( const std::string& itemIn, bool saveAfterAdd );
+ bool clear ();
+ bool addItem ( const std::string& itemIn, bool saveAfterAdd );
- bool containsMatch ( const std::string& patternIn );
+ bool containsMatch ( const std::string& patternIn );
- bool getFirst ( std::string& valueOut );
- bool getNext ( std::string& valueOut );
+ bool getFirst ( std::string& valueOut );
+ bool getNext ( std::string& valueOut );
- private:
- typedef std::vector < std::string > string_list_t ;
+ private:
+ typedef std::vector < std::string > string_list_t ;
- bool mLoaded;
- const std::string mFilename;
- string_list_t mUrlList;
- U32 mCurIndex;
+ bool mLoaded;
+ const std::string mFilename;
+ string_list_t mUrlList;
+ U32 mCurIndex;
};
#endif // LL_LLURLWHITELIST_H
diff --git a/indra/newview/llvectorperfoptions.cpp b/indra/newview/llvectorperfoptions.cpp
index b80058d98c..91ca56fefe 100644
--- a/indra/newview/llvectorperfoptions.cpp
+++ b/indra/newview/llvectorperfoptions.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvectorperfoptions.h
* @brief SSE/SSE2 vector math performance options.
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llvectorperfoptions.h b/indra/newview/llvectorperfoptions.h
index e7a5748256..5bfc48b240 100644
--- a/indra/newview/llvectorperfoptions.h
+++ b/indra/newview/llvectorperfoptions.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvectorperfoptions.h
* @brief SSE/SSE2 vector math performance options.
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp
index 9551df7bee..c3dc07f357 100644
--- a/indra/newview/llversioninfo.cpp
+++ b/indra/newview/llversioninfo.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llversioninfo.cpp
* @brief Routines to access the viewer version and build information
* @author Martin Reddy
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,31 +45,31 @@
//
LLVersionInfo::LLVersionInfo():
- short_version(STRINGIZE(LL_VIEWER_VERSION_MAJOR << "."
- << LL_VIEWER_VERSION_MINOR << "."
- << LL_VIEWER_VERSION_PATCH)),
- // LL_VIEWER_CHANNEL is a macro defined on the compiler command line. The
- // macro expands to the string name of the channel, but without quotes. We
- // need to turn it into a quoted string. LL_TO_STRING() does that.
- mWorkingChannelName(LL_TO_STRING(LL_VIEWER_CHANNEL)),
- build_configuration(LLBUILD_CONFIG), // set in indra/cmake/BuildVersion.cmake
- // instantiate an LLEventMailDrop with canonical name to listen for news
- // from SLVersionChecker
- mPump{new LLEventMailDrop("relnotes")},
- // immediately listen on mPump, store arriving URL into mReleaseNotes
- mStore{new LLStoreListener<std::string>(*mPump, mReleaseNotes)}
+ short_version(STRINGIZE(LL_VIEWER_VERSION_MAJOR << "."
+ << LL_VIEWER_VERSION_MINOR << "."
+ << LL_VIEWER_VERSION_PATCH)),
+ // LL_VIEWER_CHANNEL is a macro defined on the compiler command line. The
+ // macro expands to the string name of the channel, but without quotes. We
+ // need to turn it into a quoted string. LL_TO_STRING() does that.
+ mWorkingChannelName(LL_TO_STRING(LL_VIEWER_CHANNEL)),
+ build_configuration(LLBUILD_CONFIG), // set in indra/cmake/BuildVersion.cmake
+ // instantiate an LLEventMailDrop with canonical name to listen for news
+ // from SLVersionChecker
+ mPump{new LLEventMailDrop("relnotes")},
+ // immediately listen on mPump, store arriving URL into mReleaseNotes
+ mStore{new LLStoreListener<std::string>(*mPump, mReleaseNotes)}
{
}
void LLVersionInfo::initSingleton()
{
- // We override initSingleton() not because we have dependencies on other
- // LLSingletons, but because certain initializations call other member
- // functions. We should refrain from calling methods until this object is
- // fully constructed; such calls don't really belong in the constructor.
+ // We override initSingleton() not because we have dependencies on other
+ // LLSingletons, but because certain initializations call other member
+ // functions. We should refrain from calling methods until this object is
+ // fully constructed; such calls don't really belong in the constructor.
- // cache the version string
- version = stringize(getShortVersion(), ".", getBuild());
+ // cache the version string
+ version = stringize(getShortVersion(), ".", getBuild());
}
LLVersionInfo::~LLVersionInfo()
@@ -78,66 +78,66 @@ LLVersionInfo::~LLVersionInfo()
S32 LLVersionInfo::getMajor()
{
- return LL_VIEWER_VERSION_MAJOR;
+ return LL_VIEWER_VERSION_MAJOR;
}
S32 LLVersionInfo::getMinor()
{
- return LL_VIEWER_VERSION_MINOR;
+ return LL_VIEWER_VERSION_MINOR;
}
S32 LLVersionInfo::getPatch()
{
- return LL_VIEWER_VERSION_PATCH;
+ return LL_VIEWER_VERSION_PATCH;
}
U64 LLVersionInfo::getBuild()
{
- return LL_VIEWER_VERSION_BUILD;
+ return LL_VIEWER_VERSION_BUILD;
}
std::string LLVersionInfo::getVersion()
{
- return version;
+ return version;
}
std::string LLVersionInfo::getShortVersion()
{
- return short_version;
+ return short_version;
}
std::string LLVersionInfo::getChannelAndVersion()
{
- if (mVersionChannel.empty())
- {
- // cache the version string
- mVersionChannel = getChannel() + " " + getVersion();
- }
+ if (mVersionChannel.empty())
+ {
+ // cache the version string
+ mVersionChannel = getChannel() + " " + getVersion();
+ }
- return mVersionChannel;
+ return mVersionChannel;
}
std::string LLVersionInfo::getChannel()
{
- return mWorkingChannelName;
+ return mWorkingChannelName;
}
void LLVersionInfo::resetChannel(const std::string& channel)
{
- mWorkingChannelName = channel;
- mVersionChannel.clear(); // Reset version and channel string til next use.
+ mWorkingChannelName = channel;
+ mVersionChannel.clear(); // Reset version and channel string til next use.
}
LLVersionInfo::ViewerMaturity LLVersionInfo::getViewerMaturity()
{
ViewerMaturity maturity;
-
+
std::string channel = getChannel();
- static const boost::regex is_test_channel("\\bTest\\b");
- static const boost::regex is_beta_channel("\\bBeta\\b");
- static const boost::regex is_project_channel("\\bProject\\b");
- static const boost::regex is_release_channel("\\bRelease\\b");
+ static const boost::regex is_test_channel("\\bTest\\b");
+ static const boost::regex is_beta_channel("\\bBeta\\b");
+ static const boost::regex is_project_channel("\\bProject\\b");
+ static const boost::regex is_release_channel("\\bRelease\\b");
if (ll_regex_search(channel, is_release_channel))
{
@@ -165,7 +165,7 @@ LLVersionInfo::ViewerMaturity LLVersionInfo::getViewerMaturity()
return maturity;
}
-
+
std::string LLVersionInfo::getBuildConfig()
{
return build_configuration;
diff --git a/indra/newview/llversioninfo.h b/indra/newview/llversioninfo.h
index f82c5ffa98..aed43263a6 100644
--- a/indra/newview/llversioninfo.h
+++ b/indra/newview/llversioninfo.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llversioninfo.h
* @brief Routines to access the viewer version and build information
* @author Martin Reddy
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,46 +41,46 @@ class LLStoreListener;
/// This API provides version information for the viewer. This
/// includes access to the major, minor, patch, and build integer
/// values, as well as human-readable string representations. All
-/// viewer code that wants to query the current version should
+/// viewer code that wants to query the current version should
/// use this API.
///
class LLVersionInfo: public LLSingleton<LLVersionInfo>
{
- LLSINGLETON(LLVersionInfo);
- void initSingleton() override;
+ LLSINGLETON(LLVersionInfo);
+ void initSingleton() override;
public:
- ~LLVersionInfo();
+ ~LLVersionInfo();
+
+ /// return the major version number as an integer
+ S32 getMajor();
- /// return the major version number as an integer
- S32 getMajor();
+ /// return the minor version number as an integer
+ S32 getMinor();
- /// return the minor version number as an integer
- S32 getMinor();
+ /// return the patch version number as an integer
+ S32 getPatch();
- /// return the patch version number as an integer
- S32 getPatch();
+ /// return the build number as an integer
+ U64 getBuild();
- /// return the build number as an integer
- U64 getBuild();
+ /// return the full viewer version as a string like "2.0.0.200030"
+ std::string getVersion();
- /// return the full viewer version as a string like "2.0.0.200030"
- std::string getVersion();
+ /// return the viewer version as a string like "2.0.0"
+ std::string getShortVersion();
- /// return the viewer version as a string like "2.0.0"
- std::string getShortVersion();
+ /// return the viewer version and channel as a string
+ /// like "Second Life Release 2.0.0.200030"
+ std::string getChannelAndVersion();
- /// return the viewer version and channel as a string
- /// like "Second Life Release 2.0.0.200030"
- std::string getChannelAndVersion();
+ /// return the channel name, e.g. "Second Life"
+ std::string getChannel();
- /// return the channel name, e.g. "Second Life"
- std::string getChannel();
-
/// return the CMake build type
std::string getBuildConfig();
- /// reset the channel name used by the viewer.
- void resetChannel(const std::string& channel);
+ /// reset the channel name used by the viewer.
+ void resetChannel(const std::string& channel);
/// return the bit width of an address
S32 getAddressSize() { return ADDRESS_SIZE; }
@@ -94,29 +94,29 @@ public:
} ViewerMaturity;
ViewerMaturity getViewerMaturity();
- /// get the release-notes URL, once it becomes available -- until then,
- /// return empty string
- std::string getReleaseNotes();
+ /// get the release-notes URL, once it becomes available -- until then,
+ /// return empty string
+ std::string getReleaseNotes();
private:
- std::string version;
- std::string short_version;
- /// Storage of the channel name the viewer is using.
- // The channel name is set by hardcoded constant,
- // or by calling resetChannel()
- std::string mWorkingChannelName;
- // Storage for the "version and channel" string.
- // This will get reset too.
- std::string mVersionChannel;
- std::string build_configuration;
- std::string mReleaseNotes;
- // Store unique_ptrs to the next couple things so we don't have to explain
- // to every consumer of this header file all the details of each.
- // mPump is the LLEventMailDrop on which we listen for SLVersionChecker to
- // post the release-notes URL from the Viewer Version Manager.
- std::unique_ptr<LLEventMailDrop> mPump;
- // mStore is an adapter that stores the release-notes URL in mReleaseNotes.
- std::unique_ptr<LLStoreListener<std::string>> mStore;
+ std::string version;
+ std::string short_version;
+ /// Storage of the channel name the viewer is using.
+ // The channel name is set by hardcoded constant,
+ // or by calling resetChannel()
+ std::string mWorkingChannelName;
+ // Storage for the "version and channel" string.
+ // This will get reset too.
+ std::string mVersionChannel;
+ std::string build_configuration;
+ std::string mReleaseNotes;
+ // Store unique_ptrs to the next couple things so we don't have to explain
+ // to every consumer of this header file all the details of each.
+ // mPump is the LLEventMailDrop on which we listen for SLVersionChecker to
+ // post the release-notes URL from the Viewer Version Manager.
+ std::unique_ptr<LLEventMailDrop> mPump;
+ // mStore is an adapter that stores the release-notes URL in mReleaseNotes.
+ std::unique_ptr<LLStoreListener<std::string>> mStore;
};
#endif
diff --git a/indra/newview/llviewchildren.cpp b/indra/newview/llviewchildren.cpp
index 32b2f7e9f5..67f1c653bb 100644
--- a/indra/newview/llviewchildren.cpp
+++ b/indra/newview/llviewchildren.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewchildren.cpp
* @brief LLViewChildren class implementation
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,58 +42,58 @@
// *NOTE: Do not use mParent reference in the constructor, since it is
// potentially not fully constructud.
LLViewChildren::LLViewChildren(LLPanel& parent)
- : mParent(parent)
+ : mParent(parent)
{
}
void LLViewChildren::show(const std::string& id, bool visible)
{
- mParent.getChildView(id)->setVisible(visible);
+ mParent.getChildView(id)->setVisible(visible);
}
void LLViewChildren::enable(const std::string& id, bool enabled)
{
- mParent.getChildView(id)->setEnabled(enabled);
+ mParent.getChildView(id)->setEnabled(enabled);
}
void LLViewChildren::setText(
- const std::string& id, const std::string& text, bool visible)
+ const std::string& id, const std::string& text, bool visible)
{
- LLTextBox* child = mParent.getChild<LLTextBox>(id);
- if (child)
- {
- child->setVisible(visible);
- child->setText(text);
- }
+ LLTextBox* child = mParent.getChild<LLTextBox>(id);
+ if (child)
+ {
+ child->setVisible(visible);
+ child->setText(text);
+ }
}
void LLViewChildren::setBadge(const std::string& id, Badge badge, bool visible)
{
- LLIconCtrl* child = mParent.getChild<LLIconCtrl>(id);
- if (child)
- {
- child->setVisible(visible);
- switch (badge)
- {
- default:
- case BADGE_OK: child->setValue(std::string("badge_ok.j2c")); break;
- case BADGE_NOTE: child->setValue(std::string("badge_note.j2c")); break;
- case BADGE_WARN:
- case BADGE_ERROR:
- child->setValue(std::string("badge_warn.j2c")); break;
- }
- }
+ LLIconCtrl* child = mParent.getChild<LLIconCtrl>(id);
+ if (child)
+ {
+ child->setVisible(visible);
+ switch (badge)
+ {
+ default:
+ case BADGE_OK: child->setValue(std::string("badge_ok.j2c")); break;
+ case BADGE_NOTE: child->setValue(std::string("badge_note.j2c")); break;
+ case BADGE_WARN:
+ case BADGE_ERROR:
+ child->setValue(std::string("badge_warn.j2c")); break;
+ }
+ }
}
void LLViewChildren::setAction(const std::string& id,
- void(*function)(void*), void* value)
+ void(*function)(void*), void* value)
{
- LLButton* button = mParent.getChild<LLButton>(id);
- if (button)
- {
- button->setClickedCallback(function, value);
- }
+ LLButton* button = mParent.getChild<LLButton>(id);
+ if (button)
+ {
+ button->setClickedCallback(function, value);
+ }
}
diff --git a/indra/newview/llviewchildren.h b/indra/newview/llviewchildren.h
index 4cd8209259..9f1532f94a 100644
--- a/indra/newview/llviewchildren.h
+++ b/indra/newview/llviewchildren.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewchildren.h
* @brief LLViewChildren class header file
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,36 +30,36 @@
class LLPanel;
class LLViewChildren
- // makes it easy to manipulate children of a view by id safely
- // encapsulates common operations into simple, one line calls
+ // makes it easy to manipulate children of a view by id safely
+ // encapsulates common operations into simple, one line calls
{
public:
- LLViewChildren(LLPanel& parent);
-
- // all views
- void show(const std::string& id, bool visible = true);
- void hide(const std::string& id) { show(id, false); }
+ LLViewChildren(LLPanel& parent);
+
+ // all views
+ void show(const std::string& id, bool visible = true);
+ void hide(const std::string& id) { show(id, false); }
+
+ void enable(const std::string& id, bool enabled = true);
+ void disable(const std::string& id) { enable(id, false); };
+
+ //
+ // LLTextBox
+ void setText(const std::string& id,
+ const std::string& text, bool visible = true);
- void enable(const std::string& id, bool enabled = true);
- void disable(const std::string& id) { enable(id, false); };
+ // LLIconCtrl
+ enum Badge { BADGE_OK, BADGE_NOTE, BADGE_WARN, BADGE_ERROR };
- //
- // LLTextBox
- void setText(const std::string& id,
- const std::string& text, bool visible = true);
+ void setBadge(const std::string& id, Badge b, bool visible = true);
- // LLIconCtrl
- enum Badge { BADGE_OK, BADGE_NOTE, BADGE_WARN, BADGE_ERROR };
-
- void setBadge(const std::string& id, Badge b, bool visible = true);
-
- // LLButton
- void setAction(const std::string& id, void(*function)(void*), void* value);
+ // LLButton
+ void setAction(const std::string& id, void(*function)(void*), void* value);
private:
- LLPanel& mParent;
+ LLPanel& mParent;
};
#endif
diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp
index 14e05fd440..011b8afd73 100644
--- a/indra/newview/llviewerassetstats.cpp
+++ b/indra/newview/llviewerassetstats.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerassetstats.cpp
- * @brief
+ * @brief
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -123,17 +123,17 @@ public:
namespace LLViewerAssetStatsFF
{
- static EViewerAssetCategories asset_type_to_category(const LLViewerAssetType::EType at, bool with_http, bool is_temp)
- {
- // For statistical purposes, we divide GETs into several
- // populations of asset fetches:
- // - textures which are de-prioritized in the asset system
- // - wearables (clothing, bodyparts) which directly affect
- // user experiences when they log in
- // - sounds
- // - gestures, including animations
- // - everything else.
- //
+ static EViewerAssetCategories asset_type_to_category(const LLViewerAssetType::EType at, bool with_http, bool is_temp)
+ {
+ // For statistical purposes, we divide GETs into several
+ // populations of asset fetches:
+ // - textures which are de-prioritized in the asset system
+ // - wearables (clothing, bodyparts) which directly affect
+ // user experiences when they log in
+ // - sounds
+ // - gestures, including animations
+ // - everything else.
+ //
EViewerAssetCategories ret;
switch (at)
@@ -163,13 +163,13 @@ namespace LLViewerAssetStatsFF
ret = with_http ? EVACOtherHTTPGet : EVACOtherUDPGet;
break;
}
- return ret;
- }
+ return ret;
+ }
- static LLTrace::DCCountStatHandle<> sEnqueued[EVACCount];
- static LLTrace::DCCountStatHandle<> sDequeued[EVACCount];
- static LLTrace::DCEventStatHandle<> sBytesFetched[EVACCount];
- static LLTrace::DCEventStatHandle<F64Seconds > sResponse[EVACCount];
+ static LLTrace::DCCountStatHandle<> sEnqueued[EVACCount];
+ static LLTrace::DCCountStatHandle<> sDequeued[EVACCount];
+ static LLTrace::DCEventStatHandle<> sBytesFetched[EVACCount];
+ static LLTrace::DCEventStatHandle<F64Seconds > sResponse[EVACCount];
}
// ------------------------------------------------------
@@ -181,99 +181,99 @@ LLViewerAssetStats * gViewerAssetStats(0);
// LLViewerAssetStats class definition
// ------------------------------------------------------
LLViewerAssetStats::LLViewerAssetStats()
-: mRegionHandle(U64(0)),
- mCurRecording(NULL)
+: mRegionHandle(U64(0)),
+ mCurRecording(NULL)
{
- start();
+ start();
}
LLViewerAssetStats::LLViewerAssetStats(const LLViewerAssetStats & src)
-: mRegionHandle(src.mRegionHandle)
+: mRegionHandle(src.mRegionHandle)
{
- mRegionRecordings = src.mRegionRecordings;
-
- mCurRecording = &mRegionRecordings[mRegionHandle];
-
- // assume this is being passed to another thread, so make sure we have unique copies of recording data
- for (PerRegionRecordingContainer::iterator it = mRegionRecordings.begin(), end_it = mRegionRecordings.end();
- it != end_it;
- ++it)
- {
- it->second.stop();
- it->second.makeUnique();
- }
-
- LLStopWatchControlsMixin<LLViewerAssetStats>::setPlayState(src.getPlayState());
+ mRegionRecordings = src.mRegionRecordings;
+
+ mCurRecording = &mRegionRecordings[mRegionHandle];
+
+ // assume this is being passed to another thread, so make sure we have unique copies of recording data
+ for (PerRegionRecordingContainer::iterator it = mRegionRecordings.begin(), end_it = mRegionRecordings.end();
+ it != end_it;
+ ++it)
+ {
+ it->second.stop();
+ it->second.makeUnique();
+ }
+
+ LLStopWatchControlsMixin<LLViewerAssetStats>::setPlayState(src.getPlayState());
}
void LLViewerAssetStats::handleStart()
{
- if (mCurRecording)
- {
- mCurRecording->start();
- }
+ if (mCurRecording)
+ {
+ mCurRecording->start();
+ }
}
void LLViewerAssetStats::handleStop()
{
- if (mCurRecording)
- {
- mCurRecording->stop();
- }
+ if (mCurRecording)
+ {
+ mCurRecording->stop();
+ }
}
void LLViewerAssetStats::handleReset()
{
- reset();
+ reset();
}
void LLViewerAssetStats::reset()
{
- // Empty the map of all region stats
- mRegionRecordings.clear();
-
- // initialize new recording for current region
- if (mRegionHandle)
- {
- mCurRecording = &mRegionRecordings[mRegionHandle];
- mCurRecording->setPlayState(getPlayState());
- }
+ // Empty the map of all region stats
+ mRegionRecordings.clear();
+
+ // initialize new recording for current region
+ if (mRegionHandle)
+ {
+ mCurRecording = &mRegionRecordings[mRegionHandle];
+ mCurRecording->setPlayState(getPlayState());
+ }
}
void LLViewerAssetStats::setRegion(region_handle_t region_handle)
{
- if (region_handle == mRegionHandle)
- {
- // Already active, ignore.
- return;
- }
-
- if (mCurRecording)
- {
- mCurRecording->pause();
- }
- if (region_handle)
- {
- mCurRecording = &mRegionRecordings[region_handle];
- mCurRecording->setPlayState(getPlayState());
- }
-
- mRegionHandle = region_handle;
+ if (region_handle == mRegionHandle)
+ {
+ // Already active, ignore.
+ return;
+ }
+
+ if (mCurRecording)
+ {
+ mCurRecording->pause();
+ }
+ if (region_handle)
+ {
+ mCurRecording = &mRegionRecordings[region_handle];
+ mCurRecording->setPlayState(getPlayState());
+ }
+
+ mRegionHandle = region_handle;
}
template <typename T>
void LLViewerAssetStats::getStat(LLTrace::Recording& rec, T& req, LLViewerAssetStatsFF::EViewerAssetCategories cat, bool compact_output)
{
- using namespace LLViewerAssetStatsFF;
+ using namespace LLViewerAssetStatsFF;
if (!compact_output
- || rec.getSampleCount(sEnqueued[cat])
+ || rec.getSampleCount(sEnqueued[cat])
|| rec.getSampleCount(sDequeued[cat])
|| rec.getSampleCount(sResponse[cat]))
{
- req .enqueued(rec.getSampleCount(sEnqueued[cat]))
+ req .enqueued(rec.getSampleCount(sEnqueued[cat]))
.dequeued(rec.getSampleCount(sDequeued[cat]))
.resp_count(rec.getSampleCount(sResponse[cat]))
.resp_min(rec.getMin(sResponse[cat]).value())
@@ -285,16 +285,16 @@ void LLViewerAssetStats::getStat(LLTrace::Recording& rec, T& req, LLViewerAssetS
void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output)
{
- using namespace LLViewerAssetStatsFF;
+ using namespace LLViewerAssetStatsFF;
- stats.regions.setProvided();
-
- for (PerRegionRecordingContainer::iterator it = mRegionRecordings.begin(), end_it = mRegionRecordings.end();
- it != end_it;
- ++it)
- {
- RegionStats& r = stats.regions.add();
- LLTrace::Recording& rec = it->second;
+ stats.regions.setProvided();
+
+ for (PerRegionRecordingContainer::iterator it = mRegionRecordings.begin(), end_it = mRegionRecordings.end();
+ it != end_it;
+ ++it)
+ {
+ RegionStats& r = stats.regions.add();
+ LLTrace::Recording& rec = it->second;
getStat(rec, r.get_texture_temp_http, EVACTextureTempHTTPGet, compact_output);
getStat(rec, r.get_texture_temp_udp, EVACTextureTempUDPGet, compact_output);
@@ -310,38 +310,38 @@ void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output)
getStat(rec, r.get_landmark_udp, EVACLandmarkUDPGet, compact_output);
getStat(rec, r.get_other_http, EVACOtherHTTPGet, compact_output);
getStat(rec, r.get_other_udp, EVACOtherUDPGet, compact_output);
-
- S32 fps = (S32)rec.getLastValue(LLStatViewer::FPS_SAMPLE);
- if (!compact_output || fps != 0)
- {
- r.fps .count(fps)
- .min(rec.getMin(LLStatViewer::FPS_SAMPLE))
- .max(rec.getMax(LLStatViewer::FPS_SAMPLE))
- .mean(rec.getMean(LLStatViewer::FPS_SAMPLE));
- }
- U32 grid_x(0), grid_y(0);
- grid_from_region_handle(it->first, &grid_x, &grid_y);
- r .grid_x(grid_x)
- .grid_y(grid_y)
- .duration(F64Seconds(rec.getDuration()).value());
- }
-
- stats.duration(mCurRecording ? F64Seconds(mCurRecording->getDuration()).value() : 0.0);
+
+ S32 fps = (S32)rec.getLastValue(LLStatViewer::FPS_SAMPLE);
+ if (!compact_output || fps != 0)
+ {
+ r.fps .count(fps)
+ .min(rec.getMin(LLStatViewer::FPS_SAMPLE))
+ .max(rec.getMax(LLStatViewer::FPS_SAMPLE))
+ .mean(rec.getMean(LLStatViewer::FPS_SAMPLE));
+ }
+ U32 grid_x(0), grid_y(0);
+ grid_from_region_handle(it->first, &grid_x, &grid_y);
+ r .grid_x(grid_x)
+ .grid_y(grid_y)
+ .duration(F64Seconds(rec.getDuration()).value());
+ }
+
+ stats.duration(mCurRecording ? F64Seconds(mCurRecording->getDuration()).value() : 0.0);
}
LLSD LLViewerAssetStats::asLLSD(bool compact_output)
{
- LLParamSDParser parser;
- LLSD sd;
- AssetStats stats;
- getStats(stats, compact_output);
- LLInitParam::predicate_rule_t rule = LLInitParam::default_parse_rules();
- if (!compact_output)
- {
- rule.allow(LLInitParam::EMPTY);
- }
- parser.writeSD(sd, stats, rule);
- return sd;
+ LLParamSDParser parser;
+ LLSD sd;
+ AssetStats stats;
+ getStats(stats, compact_output);
+ LLInitParam::predicate_rule_t rule = LLInitParam::default_parse_rules();
+ if (!compact_output)
+ {
+ rule.allow(LLInitParam::EMPTY);
+ }
+ parser.writeSD(sd, stats, rule);
+ return sd;
}
// ------------------------------------------------------
@@ -352,47 +352,47 @@ namespace LLViewerAssetStatsFF
{
void set_region(LLViewerAssetStats::region_handle_t region_handle)
{
- if (! gViewerAssetStats)
- return;
+ if (! gViewerAssetStats)
+ return;
- gViewerAssetStats->setRegion(region_handle);
+ gViewerAssetStats->setRegion(region_handle);
}
void record_enqueue(LLViewerAssetType::EType at, bool with_http, bool is_temp)
{
- const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
+ const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
- add(sEnqueued[int(eac)], 1);
+ add(sEnqueued[int(eac)], 1);
}
void record_dequeue(LLViewerAssetType::EType at, bool with_http, bool is_temp)
{
- const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
+ const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
- add(sDequeued[int(eac)], 1);
+ add(sDequeued[int(eac)], 1);
}
void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration, F64 bytes)
{
- const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
+ const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
- record(sResponse[int(eac)], F64Seconds(duration));
- record(sBytesFetched[int(eac)], bytes);
+ record(sResponse[int(eac)], F64Seconds(duration));
+ record(sBytesFetched[int(eac)], bytes);
}
void init()
{
- if (! gViewerAssetStats)
- {
- gViewerAssetStats = new LLViewerAssetStats();
- }
+ if (! gViewerAssetStats)
+ {
+ gViewerAssetStats = new LLViewerAssetStats();
+ }
}
void
cleanup()
{
- delete gViewerAssetStats;
- gViewerAssetStats = 0;
+ delete gViewerAssetStats;
+ gViewerAssetStats = 0;
}
@@ -400,51 +400,51 @@ cleanup()
-LLViewerAssetStats::AssetRequestType::AssetRequestType()
-: enqueued("enqueued"),
- dequeued("dequeued"),
- resp_count("resp_count"),
- resp_min("resp_min"),
- resp_max("resp_max"),
- resp_mean("resp_mean"),
+LLViewerAssetStats::AssetRequestType::AssetRequestType()
+: enqueued("enqueued"),
+ dequeued("dequeued"),
+ resp_count("resp_count"),
+ resp_min("resp_min"),
+ resp_max("resp_max"),
+ resp_mean("resp_mean"),
resp_mean_bytes("resp_mean_bytes")
{}
-
-LLViewerAssetStats::FPSStats::FPSStats()
-: count("count"),
- min("min"),
- max("max"),
- mean("mean")
+
+LLViewerAssetStats::FPSStats::FPSStats()
+: count("count"),
+ min("min"),
+ max("max"),
+ mean("mean")
{}
-LLViewerAssetStats::RegionStats::RegionStats()
-: get_texture_temp_http("get_texture_temp_http"),
- get_texture_temp_udp("get_texture_temp_udp"),
- get_texture_non_temp_http("get_texture_non_temp_http"),
- get_texture_non_temp_udp("get_texture_non_temp_udp"),
- get_wearable_http("get_wearable_http"),
- get_wearable_udp("get_wearable_udp"),
- get_sound_http("get_sound_http"),
- get_sound_udp("get_sound_udp"),
- get_gesture_http("get_gesture_http"),
- get_gesture_udp("get_gesture_udp"),
- get_landmark_http("get_landmark_http"),
- get_landmark_udp("get_landmark_udp"),
- get_other_http("get_other_http"),
- get_other_udp("get_other_udp"),
- fps("fps"),
- grid_x("grid_x"),
- grid_y("grid_y"),
- duration("duration")
+LLViewerAssetStats::RegionStats::RegionStats()
+: get_texture_temp_http("get_texture_temp_http"),
+ get_texture_temp_udp("get_texture_temp_udp"),
+ get_texture_non_temp_http("get_texture_non_temp_http"),
+ get_texture_non_temp_udp("get_texture_non_temp_udp"),
+ get_wearable_http("get_wearable_http"),
+ get_wearable_udp("get_wearable_udp"),
+ get_sound_http("get_sound_http"),
+ get_sound_udp("get_sound_udp"),
+ get_gesture_http("get_gesture_http"),
+ get_gesture_udp("get_gesture_udp"),
+ get_landmark_http("get_landmark_http"),
+ get_landmark_udp("get_landmark_udp"),
+ get_other_http("get_other_http"),
+ get_other_udp("get_other_udp"),
+ fps("fps"),
+ grid_x("grid_x"),
+ grid_y("grid_y"),
+ duration("duration")
{}
-LLViewerAssetStats::AssetStats::AssetStats()
-: regions("regions"),
- duration("duration"),
- session_id("session_id"),
- agent_id("agent_id"),
- message("message"),
- sequence("sequence"),
- initial("initial"),
- break_("break")
+LLViewerAssetStats::AssetStats::AssetStats()
+: regions("regions"),
+ duration("duration"),
+ session_id("session_id"),
+ agent_id("agent_id"),
+ message("message"),
+ sequence("sequence"),
+ initial("initial"),
+ break_("break")
{}
diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h
index 718c284224..de395da285 100644
--- a/indra/newview/llviewerassetstats.h
+++ b/indra/newview/llviewerassetstats.h
@@ -1,31 +1,31 @@
-/**
+/**
* @file llviewerassetstats.h
* @brief Client-side collection of asset request statistics
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLVIEWERASSETSTATUS_H
-#define LL_LLVIEWERASSETSTATUS_H
+#define LL_LLVIEWERASSETSTATUS_H
#include "linden_common.h"
@@ -41,25 +41,25 @@
namespace LLViewerAssetStatsFF
{
- enum EViewerAssetCategories
- {
- EVACTextureTempHTTPGet, //< Texture GETs - temp/baked, HTTP
- EVACTextureTempUDPGet, //< Texture GETs - temp/baked, UDP
- EVACTextureNonTempHTTPGet, //< Texture GETs - perm, HTTP
- EVACTextureNonTempUDPGet, //< Texture GETs - perm, UDP
- EVACWearableHTTPGet, //< Wearable GETs HTTP
- EVACWearableUDPGet, //< Wearable GETs UDP
- EVACSoundHTTPGet, //< Sound GETs HTTP
- EVACSoundUDPGet, //< Sound GETs UDP
- EVACGestureHTTPGet, //< Gesture GETs HTTP
- EVACGestureUDPGet, //< Gesture GETs UDP
- EVACLandmarkHTTPGet, //< Landmark GETs HTTP
- EVACLandmarkUDPGet, //< Landmark GETs UDP
- EVACOtherHTTPGet, //< Other GETs HTTP
- EVACOtherUDPGet, //< Other GETs UDP
-
- EVACCount // Must be last
- };
+ enum EViewerAssetCategories
+ {
+ EVACTextureTempHTTPGet, //< Texture GETs - temp/baked, HTTP
+ EVACTextureTempUDPGet, //< Texture GETs - temp/baked, UDP
+ EVACTextureNonTempHTTPGet, //< Texture GETs - perm, HTTP
+ EVACTextureNonTempUDPGet, //< Texture GETs - perm, UDP
+ EVACWearableHTTPGet, //< Wearable GETs HTTP
+ EVACWearableUDPGet, //< Wearable GETs UDP
+ EVACSoundHTTPGet, //< Sound GETs HTTP
+ EVACSoundUDPGet, //< Sound GETs UDP
+ EVACGestureHTTPGet, //< Gesture GETs HTTP
+ EVACGestureUDPGet, //< Gesture GETs UDP
+ EVACLandmarkHTTPGet, //< Landmark GETs HTTP
+ EVACLandmarkUDPGet, //< Landmark GETs UDP
+ EVACOtherHTTPGet, //< Other GETs HTTP
+ EVACOtherUDPGet, //< Other GETs UDP
+
+ EVACCount // Must be last
+ };
}
/**
@@ -101,125 +101,125 @@ namespace LLViewerAssetStatsFF
class LLViewerAssetStats : public LLStopWatchControlsMixin<LLViewerAssetStats>
{
public:
- /**
- * Type for duration and other time values in the metrics. Selected
- * for compatibility with the pre-existing timestamp on the texture
- * fetcher class, LLTextureFetch.
- */
- typedef U64Microseconds duration_t;
-
- /**
- * Type for the region identifier used in stats. Currently uses
- * the region handle's type (a U64) rather than the regions's LLUUID
- * as the latter isn't available immediately.
- */
- typedef U64 region_handle_t;
-
- struct AssetRequestType : public LLInitParam::Block<AssetRequestType>
- {
- Mandatory<S32> enqueued,
- dequeued,
- resp_count;
- Mandatory<F64> resp_min,
- resp_max,
- resp_mean,
- resp_mean_bytes;
-
- AssetRequestType();
- };
-
- struct FPSStats : public LLInitParam::Block<FPSStats>
+ /**
+ * Type for duration and other time values in the metrics. Selected
+ * for compatibility with the pre-existing timestamp on the texture
+ * fetcher class, LLTextureFetch.
+ */
+ typedef U64Microseconds duration_t;
+
+ /**
+ * Type for the region identifier used in stats. Currently uses
+ * the region handle's type (a U64) rather than the regions's LLUUID
+ * as the latter isn't available immediately.
+ */
+ typedef U64 region_handle_t;
+
+ struct AssetRequestType : public LLInitParam::Block<AssetRequestType>
{
- Mandatory<S32> count;
- Mandatory<F64> min,
- max,
- mean;
- FPSStats();
- };
-
- struct RegionStats : public LLInitParam::Block<RegionStats>
+ Mandatory<S32> enqueued,
+ dequeued,
+ resp_count;
+ Mandatory<F64> resp_min,
+ resp_max,
+ resp_mean,
+ resp_mean_bytes;
+
+ AssetRequestType();
+ };
+
+ struct FPSStats : public LLInitParam::Block<FPSStats>
{
- Optional<AssetRequestType> get_texture_temp_http,
- get_texture_temp_udp,
- get_texture_non_temp_http,
- get_texture_non_temp_udp,
- get_wearable_http,
- get_wearable_udp,
- get_sound_http,
- get_sound_udp,
- get_gesture_http,
- get_gesture_udp,
- get_landmark_http,
- get_landmark_udp,
- get_other_http,
- get_other_udp;
- Optional<FPSStats> fps;
- Optional<S32> grid_x,
- grid_y;
- Optional<F64> duration;
-
- RegionStats();
- };
-
- struct AssetStats : public LLInitParam::Block<AssetStats>
- {
- Multiple<RegionStats> regions;
- Mandatory<F64> duration;
-
- Mandatory<LLUUID> session_id,
- agent_id;
-
- Mandatory<std::string> message;
- Mandatory<S32> sequence;
- Mandatory<bool> initial,
- break_;
-
- AssetStats();
- };
+ Mandatory<S32> count;
+ Mandatory<F64> min,
+ max,
+ mean;
+ FPSStats();
+ };
+
+ struct RegionStats : public LLInitParam::Block<RegionStats>
+ {
+ Optional<AssetRequestType> get_texture_temp_http,
+ get_texture_temp_udp,
+ get_texture_non_temp_http,
+ get_texture_non_temp_udp,
+ get_wearable_http,
+ get_wearable_udp,
+ get_sound_http,
+ get_sound_udp,
+ get_gesture_http,
+ get_gesture_udp,
+ get_landmark_http,
+ get_landmark_udp,
+ get_other_http,
+ get_other_udp;
+ Optional<FPSStats> fps;
+ Optional<S32> grid_x,
+ grid_y;
+ Optional<F64> duration;
+
+ RegionStats();
+ };
+
+ struct AssetStats : public LLInitParam::Block<AssetStats>
+ {
+ Multiple<RegionStats> regions;
+ Mandatory<F64> duration;
+
+ Mandatory<LLUUID> session_id,
+ agent_id;
+
+ Mandatory<std::string> message;
+ Mandatory<S32> sequence;
+ Mandatory<bool> initial,
+ break_;
+
+ AssetStats();
+ };
public:
- LLViewerAssetStats();
- LLViewerAssetStats(const LLViewerAssetStats &);
+ LLViewerAssetStats();
+ LLViewerAssetStats(const LLViewerAssetStats &);
- // Default destructor is correct.
- LLViewerAssetStats & operator=(const LLViewerAssetStats &); // Not defined
+ // Default destructor is correct.
+ LLViewerAssetStats & operator=(const LLViewerAssetStats &); // Not defined
- // Clear all metrics data. This leaves the currently-active region
- // in place but with zero'd data for all metrics. All other regions
- // are removed from the collection map.
- void reset();
+ // Clear all metrics data. This leaves the currently-active region
+ // in place but with zero'd data for all metrics. All other regions
+ // are removed from the collection map.
+ void reset();
- // Set hidden region argument and establish context for subsequent
- // collection calls.
- void setRegion(region_handle_t region_handle);
+ // Set hidden region argument and establish context for subsequent
+ // collection calls.
+ void setRegion(region_handle_t region_handle);
- // Retrieve current metrics for all visited regions (NULL region UUID/handle excluded)
+ // Retrieve current metrics for all visited regions (NULL region UUID/handle excluded)
// Uses AssetStats structure seen above
- void getStats(AssetStats& stats, bool compact_output);
+ void getStats(AssetStats& stats, bool compact_output);
// Retrieve a single asset request type (taken from a single region)
template <typename T>
void getStat(LLTrace::Recording& rec, T& req, LLViewerAssetStatsFF::EViewerAssetCategories cat, bool compact_output);
- LLSD asLLSD(bool compact_output);
+ LLSD asLLSD(bool compact_output);
protected:
- void handleStart();
- void handleStop();
- void handleReset();
+ void handleStart();
+ void handleStop();
+ void handleReset();
- typedef std::map<region_handle_t, LLTrace::Recording > PerRegionRecordingContainer;
+ typedef std::map<region_handle_t, LLTrace::Recording > PerRegionRecordingContainer;
- // Region of the currently-active region. Always valid but may
- // be zero after construction or when explicitly set. Unchanged
- // by a reset() call.
- region_handle_t mRegionHandle;
+ // Region of the currently-active region. Always valid but may
+ // be zero after construction or when explicitly set. Unchanged
+ // by a reset() call.
+ region_handle_t mRegionHandle;
- // Pointer to metrics collection for currently-active region.
- LLTrace::Recording* mCurRecording;
+ // Pointer to metrics collection for currently-active region.
+ LLTrace::Recording* mCurRecording;
- // Metrics data for all regions during one collection cycle
- PerRegionRecordingContainer mRegionRecordings;
+ // Metrics data for all regions during one collection cycle
+ PerRegionRecordingContainer mRegionRecordings;
};
@@ -260,7 +260,7 @@ void cleanup();
*/
inline LLViewerAssetStats::duration_t get_timestamp()
{
- return LLTimer::getTotalTime();
+ return LLTimer::getTotalTime();
}
/**
diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp
index aa9ff012c3..2fe4018aba 100644
--- a/indra/newview/llviewerassetstorage.cpp
+++ b/indra/newview/llviewerassetstorage.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerassetstorage.cpp
* @brief Subclass capable of loading asset data to/from an external source.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,10 +67,10 @@ public:
mWithHTTP(with_http)
{
}
-
+
LLViewerAssetRequest & operator=(const LLViewerAssetRequest &); // Not defined
// Default assignment operator valid
-
+
// virtual
~LLViewerAssetRequest()
{
@@ -92,7 +92,7 @@ protected:
mMetricsStartTime = (U32Seconds)0;
}
}
-
+
public:
LLViewerAssetStats::duration_t mMetricsStartTime;
bool mWithHTTP;
@@ -131,12 +131,12 @@ LLViewerAssetStorage::~LLViewerAssetStorage()
{
if (!LLCoprocedureManager::wasDeleted())
{
- // This class has dedicated coroutine pool, clean it up, otherwise coroutines will crash later.
+ // This class has dedicated coroutine pool, clean it up, otherwise coroutines will crash later.
LLCoprocedureManager::instance().close(VIEWER_ASSET_STORAGE_CORO_POOL);
}
}
-// virtual
+// virtual
void LLViewerAssetStorage::storeAssetData(
const LLTransactionID& tid,
LLAssetType::EType asset_type,
@@ -151,7 +151,7 @@ void LLViewerAssetStorage::storeAssetData(
LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type)
<< " ASSET_ID: " << asset_id << LL_ENDL;
-
+
if (mUpstreamHost.isOk())
{
if (LLFileSystem::getExists(asset_id, asset_type))
@@ -201,7 +201,7 @@ void LLViewerAssetStorage::storeAssetData(
{
BOOL res = vfile.read(buffer, asset_size); /* Flawfinder: ignore */
S32 bytes_read = res ? vfile.getLastBytesRead() : 0;
-
+
if( bytes_read == asset_size )
{
req->mDataSentInFirstPacket = TRUE;
@@ -272,7 +272,7 @@ void LLViewerAssetStorage::storeAssetData(
LL_ERRS() << "No filename specified" << LL_ENDL;
return;
}
-
+
LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL;
@@ -289,7 +289,7 @@ void LLViewerAssetStorage::storeAssetData(
if( size )
{
LLLegacyAssetRequest *legacy = new LLLegacyAssetRequest;
-
+
legacy->mUpCallback = callback;
legacy->mUserData = user_data;
@@ -385,7 +385,7 @@ void LLViewerAssetStorage::queueRequestHttp(
req->mIsPriority = is_priority;
if (!duplicate)
{
- // Only collect metrics for non-duplicate requests. Others
+ // Only collect metrics for non-duplicate requests. Others
// are piggy-backing and will artificially lower averages.
req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp();
}
@@ -446,7 +446,7 @@ void LLViewerAssetStorage::assetRequestCoro(
void *user_data)
{
LLScopedIncrement coro_count_boost(sAssetCoroCount); // static counter since corotine can outlive LLViewerAssetStorage
-
+
S32 result_code = LL_ERR_NOERR;
LLExtStat ext_status = LLExtStat::NONE;
@@ -464,7 +464,7 @@ void LLViewerAssetStorage::assetRequestCoro(
result_code = LL_ERR_ASSET_REQUEST_FAILED;
ext_status = LLExtStat::NONE;
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status);
- return;
+ return;
}
else if (!gAgent.getRegion()->capabilitiesReceived())
{
@@ -474,7 +474,7 @@ void LLViewerAssetStorage::assetRequestCoro(
gAgent.getRegion()->setCapabilitiesReceivedCallback(
boost::bind(&LLViewerAssetStorage::capsRecvForRegion, this, _1, capsRecv.getName()));
-
+
llcoro::suspendUntilEventOn(capsRecv);
if (LLApp::isExiting() || !gAssetStorage)
@@ -495,7 +495,7 @@ void LLViewerAssetStorage::assetRequestCoro(
result_code = LL_ERR_ASSET_REQUEST_FAILED;
ext_status = LLExtStat::NONE;
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status);
- return;
+ return;
}
std::string url = getAssetURL(mViewerAssetUrl, uuid,atype);
LL_DEBUGS("ViewerAsset") << "request url: " << url << LL_ENDL;
@@ -515,7 +515,7 @@ void LLViewerAssetStorage::assetRequestCoro(
}
mCountCompleted++;
-
+
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
@@ -546,10 +546,10 @@ void LLViewerAssetStorage::assetRequestCoro(
if (size > 0)
{
mTotalBytesFetched += size;
-
- // This create-then-rename flow is modeled on
- // LLTransferTargetVFile, which is what was used in the UDP
- // case.
+
+ // This create-then-rename flow is modeled on
+ // LLTransferTargetVFile, which is what was used in the UDP
+ // case.
LLUUID temp_id;
temp_id.generate();
LLFileSystem vf(temp_id, atype, LLFileSystem::WRITE);
@@ -575,7 +575,7 @@ void LLViewerAssetStorage::assetRequestCoro(
else
{
// TODO asset-http: handle invalid size case
- LL_WARNS("ViewerAsset") << "bad size" << LL_ENDL;
+ LL_WARNS("ViewerAsset") << "bad size" << LL_ENDL;
result_code = LL_ERR_ASSET_REQUEST_FAILED;
ext_status = LLExtStat::NONE;
}
diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h
index c3719d0918..19eb26e809 100644
--- a/indra/newview/llviewerassetstorage.h
+++ b/indra/newview/llviewerassetstorage.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerassetstorage.h
* @brief Class for loading asset data to/from an external source.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,41 +37,41 @@ class LLViewerAssetRequest;
class LLViewerAssetStorage : public LLAssetStorage
{
public:
- LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, const LLHost &upstream_host);
-
- LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer);
-
- ~LLViewerAssetStorage();
-
- void storeAssetData(
- const LLTransactionID& tid,
- LLAssetType::EType atype,
- LLStoreAssetCallback callback,
- void* user_data,
- bool temp_file = false,
- bool is_priority = false,
- bool store_local = false,
- bool user_waiting=FALSE,
- F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override;
-
- void storeAssetData(
- const std::string& filename,
- const LLTransactionID& tid,
- LLAssetType::EType type,
- LLStoreAssetCallback callback,
- void* user_data,
- bool temp_file = false,
- bool is_priority = false,
- bool user_waiting=FALSE,
- F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override;
+ LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, const LLHost &upstream_host);
+
+ LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer);
+
+ ~LLViewerAssetStorage();
+
+ void storeAssetData(
+ const LLTransactionID& tid,
+ LLAssetType::EType atype,
+ LLStoreAssetCallback callback,
+ void* user_data,
+ bool temp_file = false,
+ bool is_priority = false,
+ bool store_local = false,
+ bool user_waiting=FALSE,
+ F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override;
+
+ void storeAssetData(
+ const std::string& filename,
+ const LLTransactionID& tid,
+ LLAssetType::EType type,
+ LLStoreAssetCallback callback,
+ void* user_data,
+ bool temp_file = false,
+ bool is_priority = false,
+ bool user_waiting=FALSE,
+ F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override;
protected:
- void _queueDataRequest(const LLUUID& uuid,
- LLAssetType::EType type,
+ void _queueDataRequest(const LLUUID& uuid,
+ LLAssetType::EType type,
LLGetAssetCallback callback,
- void *user_data,
- BOOL duplicate,
- BOOL is_priority) override;
+ void *user_data,
+ BOOL duplicate,
+ BOOL is_priority) override;
void queueRequestHttp(const LLUUID& uuid,
LLAssetType::EType type,
@@ -81,7 +81,7 @@ protected:
BOOL is_priority);
void capsRecvForRegion(const LLUUID& region_id, std::string pumpname);
-
+
void assetRequestCoro(LLViewerAssetRequest *req,
const LLUUID uuid,
LLAssetType::EType atype,
diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp
index 481086f760..3e3347ff33 100644
--- a/indra/newview/llviewerassettype.cpp
+++ b/indra/newview/llviewerassettype.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llassettype.cpp
* @brief Implementatino of LLViewerAssetType functionality.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,82 +35,82 @@ static const std::string empty_string;
struct ViewerAssetEntry : public LLDictionaryEntry
{
- ViewerAssetEntry(EDragAndDropType dad_type // drag and drop type
- )
- :
- LLDictionaryEntry(empty_string), // no reverse lookup needed for now, so just leave this blank
- mDadType(dad_type)
- {
- }
- EDragAndDropType mDadType;
+ ViewerAssetEntry(EDragAndDropType dad_type // drag and drop type
+ )
+ :
+ LLDictionaryEntry(empty_string), // no reverse lookup needed for now, so just leave this blank
+ mDadType(dad_type)
+ {
+ }
+ EDragAndDropType mDadType;
};
class LLViewerAssetDictionary : public LLSingleton<LLViewerAssetDictionary>,
- public LLDictionary<LLViewerAssetType::EType, ViewerAssetEntry>
+ public LLDictionary<LLViewerAssetType::EType, ViewerAssetEntry>
{
- LLSINGLETON(LLViewerAssetDictionary);
+ LLSINGLETON(LLViewerAssetDictionary);
};
LLViewerAssetDictionary::LLViewerAssetDictionary()
{
- // DRAG&DROP TYPE
- // |--------------------|
- addEntry(LLViewerAssetType::AT_TEXTURE, new ViewerAssetEntry(DAD_TEXTURE));
- addEntry(LLViewerAssetType::AT_SOUND, new ViewerAssetEntry(DAD_SOUND));
- addEntry(LLViewerAssetType::AT_CALLINGCARD, new ViewerAssetEntry(DAD_CALLINGCARD));
- addEntry(LLViewerAssetType::AT_LANDMARK, new ViewerAssetEntry(DAD_LANDMARK));
- addEntry(LLViewerAssetType::AT_SCRIPT, new ViewerAssetEntry(DAD_NONE));
- addEntry(LLViewerAssetType::AT_CLOTHING, new ViewerAssetEntry(DAD_CLOTHING));
- addEntry(LLViewerAssetType::AT_OBJECT, new ViewerAssetEntry(DAD_OBJECT));
- addEntry(LLViewerAssetType::AT_NOTECARD, new ViewerAssetEntry(DAD_NOTECARD));
- addEntry(LLViewerAssetType::AT_CATEGORY, new ViewerAssetEntry(DAD_CATEGORY));
- addEntry(LLViewerAssetType::AT_LSL_TEXT, new ViewerAssetEntry(DAD_SCRIPT));
- addEntry(LLViewerAssetType::AT_LSL_BYTECODE, new ViewerAssetEntry(DAD_NONE));
- addEntry(LLViewerAssetType::AT_TEXTURE_TGA, new ViewerAssetEntry(DAD_NONE));
- addEntry(LLViewerAssetType::AT_BODYPART, new ViewerAssetEntry(DAD_BODYPART));
- addEntry(LLViewerAssetType::AT_SOUND_WAV, new ViewerAssetEntry(DAD_NONE));
- addEntry(LLViewerAssetType::AT_IMAGE_TGA, new ViewerAssetEntry(DAD_NONE));
- addEntry(LLViewerAssetType::AT_IMAGE_JPEG, new ViewerAssetEntry(DAD_NONE));
- addEntry(LLViewerAssetType::AT_ANIMATION, new ViewerAssetEntry(DAD_ANIMATION));
- addEntry(LLViewerAssetType::AT_GESTURE, new ViewerAssetEntry(DAD_GESTURE));
- addEntry(LLViewerAssetType::AT_SIMSTATE, new ViewerAssetEntry(DAD_NONE));
+ // DRAG&DROP TYPE
+ // |--------------------|
+ addEntry(LLViewerAssetType::AT_TEXTURE, new ViewerAssetEntry(DAD_TEXTURE));
+ addEntry(LLViewerAssetType::AT_SOUND, new ViewerAssetEntry(DAD_SOUND));
+ addEntry(LLViewerAssetType::AT_CALLINGCARD, new ViewerAssetEntry(DAD_CALLINGCARD));
+ addEntry(LLViewerAssetType::AT_LANDMARK, new ViewerAssetEntry(DAD_LANDMARK));
+ addEntry(LLViewerAssetType::AT_SCRIPT, new ViewerAssetEntry(DAD_NONE));
+ addEntry(LLViewerAssetType::AT_CLOTHING, new ViewerAssetEntry(DAD_CLOTHING));
+ addEntry(LLViewerAssetType::AT_OBJECT, new ViewerAssetEntry(DAD_OBJECT));
+ addEntry(LLViewerAssetType::AT_NOTECARD, new ViewerAssetEntry(DAD_NOTECARD));
+ addEntry(LLViewerAssetType::AT_CATEGORY, new ViewerAssetEntry(DAD_CATEGORY));
+ addEntry(LLViewerAssetType::AT_LSL_TEXT, new ViewerAssetEntry(DAD_SCRIPT));
+ addEntry(LLViewerAssetType::AT_LSL_BYTECODE, new ViewerAssetEntry(DAD_NONE));
+ addEntry(LLViewerAssetType::AT_TEXTURE_TGA, new ViewerAssetEntry(DAD_NONE));
+ addEntry(LLViewerAssetType::AT_BODYPART, new ViewerAssetEntry(DAD_BODYPART));
+ addEntry(LLViewerAssetType::AT_SOUND_WAV, new ViewerAssetEntry(DAD_NONE));
+ addEntry(LLViewerAssetType::AT_IMAGE_TGA, new ViewerAssetEntry(DAD_NONE));
+ addEntry(LLViewerAssetType::AT_IMAGE_JPEG, new ViewerAssetEntry(DAD_NONE));
+ addEntry(LLViewerAssetType::AT_ANIMATION, new ViewerAssetEntry(DAD_ANIMATION));
+ addEntry(LLViewerAssetType::AT_GESTURE, new ViewerAssetEntry(DAD_GESTURE));
+ addEntry(LLViewerAssetType::AT_SIMSTATE, new ViewerAssetEntry(DAD_NONE));
+
+ addEntry(LLViewerAssetType::AT_LINK, new ViewerAssetEntry(DAD_LINK));
+ addEntry(LLViewerAssetType::AT_LINK_FOLDER, new ViewerAssetEntry(DAD_LINK));
+
+ addEntry(LLViewerAssetType::AT_MESH, new ViewerAssetEntry(DAD_MESH));
- addEntry(LLViewerAssetType::AT_LINK, new ViewerAssetEntry(DAD_LINK));
- addEntry(LLViewerAssetType::AT_LINK_FOLDER, new ViewerAssetEntry(DAD_LINK));
+ addEntry(LLViewerAssetType::AT_WIDGET, new ViewerAssetEntry(DAD_WIDGET));
- addEntry(LLViewerAssetType::AT_MESH, new ViewerAssetEntry(DAD_MESH));
-
- addEntry(LLViewerAssetType::AT_WIDGET, new ViewerAssetEntry(DAD_WIDGET));
-
- addEntry(LLViewerAssetType::AT_PERSON, new ViewerAssetEntry(DAD_PERSON));
+ addEntry(LLViewerAssetType::AT_PERSON, new ViewerAssetEntry(DAD_PERSON));
- addEntry(LLViewerAssetType::AT_UNKNOWN, new ViewerAssetEntry(DAD_NONE));
+ addEntry(LLViewerAssetType::AT_UNKNOWN, new ViewerAssetEntry(DAD_NONE));
- addEntry(LLViewerAssetType::AT_NONE, new ViewerAssetEntry(DAD_NONE));
+ addEntry(LLViewerAssetType::AT_NONE, new ViewerAssetEntry(DAD_NONE));
addEntry(LLViewerAssetType::AT_SETTINGS, new ViewerAssetEntry(DAD_SETTINGS));
addEntry(LLViewerAssetType::AT_MATERIAL, new ViewerAssetEntry(DAD_MATERIAL));
};
EDragAndDropType LLViewerAssetType::lookupDragAndDropType(EType asset_type)
{
- const LLViewerAssetDictionary *dict = LLViewerAssetDictionary::getInstance();
- const ViewerAssetEntry *entry = dict->lookup(asset_type);
- if (entry)
- return entry->mDadType;
- else
- return DAD_NONE;
+ const LLViewerAssetDictionary *dict = LLViewerAssetDictionary::getInstance();
+ const ViewerAssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
+ return entry->mDadType;
+ else
+ return DAD_NONE;
}
// Generate a good default description
void LLViewerAssetType::generateDescriptionFor(LLViewerAssetType::EType asset_type,
- std::string& description)
+ std::string& description)
{
- const S32 BUF_SIZE = 30;
- char time_str[BUF_SIZE]; /* Flawfinder: ignore */
- time_t now;
- time(&now);
- memset(time_str, '\0', BUF_SIZE);
- strftime(time_str, BUF_SIZE - 1, "%Y-%m-%d %H:%M:%S ", localtime(&now));
- description.assign(time_str);
- description.append(LLAssetType::lookupHumanReadable(asset_type));
+ const S32 BUF_SIZE = 30;
+ char time_str[BUF_SIZE]; /* Flawfinder: ignore */
+ time_t now;
+ time(&now);
+ memset(time_str, '\0', BUF_SIZE);
+ strftime(time_str, BUF_SIZE - 1, "%Y-%m-%d %H:%M:%S ", localtime(&now));
+ description.assign(time_str);
+ description.append(LLAssetType::lookupHumanReadable(asset_type));
}
diff --git a/indra/newview/llviewerassettype.h b/indra/newview/llviewerassettype.h
index 9ad8ea7eeb..f68510d2e5 100644
--- a/indra/newview/llviewerassettype.h
+++ b/indra/newview/llviewerassettype.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerassettype.h
* @brief Declaration of LLViewerViewerAssetType.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,14 +36,14 @@
class LLViewerAssetType : public LLAssetType
{
public:
- // Generate a good default description. You may want to add a verb
- // or agent name after this depending on your application.
- static void generateDescriptionFor(LLViewerAssetType::EType asset_type,
- std::string& description);
- static EDragAndDropType lookupDragAndDropType(EType asset_type);
+ // Generate a good default description. You may want to add a verb
+ // or agent name after this depending on your application.
+ static void generateDescriptionFor(LLViewerAssetType::EType asset_type,
+ std::string& description);
+ static EDragAndDropType lookupDragAndDropType(EType asset_type);
protected:
- LLViewerAssetType() {}
- ~LLViewerAssetType() {}
+ LLViewerAssetType() {}
+ ~LLViewerAssetType() {}
};
#endif // LL_LLVIEWERASSETTYPE_H
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index e2e321af0d..438b06f954 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -81,9 +81,9 @@ LLResourceUploadInfo::LLResourceUploadInfo(LLTransactionID transactId,
{ }
-LLResourceUploadInfo::LLResourceUploadInfo(std::string name,
- std::string description, S32 compressionInfo,
- LLFolderType::EType destinationType, LLInventoryType::EType inventoryType,
+LLResourceUploadInfo::LLResourceUploadInfo(std::string name,
+ std::string description, S32 compressionInfo,
+ LLFolderType::EType destinationType, LLInventoryType::EType inventoryType,
U32 nextOWnerPerms, U32 groupPerms, U32 everyonePerms, S32 expectedCost, bool showInventory) :
mName(name),
mDescription(description),
@@ -100,7 +100,7 @@ LLResourceUploadInfo::LLResourceUploadInfo(std::string name,
mFolderId(LLUUID::null),
mItemId(LLUUID::null),
mAssetId(LLAssetID::null)
-{
+{
mTransactionId.generate();
}
@@ -311,39 +311,39 @@ std::string LLResourceUploadInfo::getDisplayName() const
bool LLResourceUploadInfo::findAssetTypeOfExtension(const std::string& exten, LLAssetType::EType& asset_type)
{
- U32 codec;
- return findAssetTypeAndCodecOfExtension(exten, asset_type, codec, false);
+ U32 codec;
+ return findAssetTypeAndCodecOfExtension(exten, asset_type, codec, false);
}
// static
bool LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec, bool bulk_upload)
{
- bool succ = false;
- std::string exten_lc(exten);
- LLStringUtil::toLower(exten_lc);
- codec = LLImageBase::getCodecFromExtension(exten_lc);
- if (codec != IMG_CODEC_INVALID)
- {
- asset_type = LLAssetType::AT_TEXTURE;
- succ = true;
- }
- else if (exten_lc == "wav")
- {
- asset_type = LLAssetType::AT_SOUND;
- succ = true;
- }
- else if (exten_lc == "anim")
- {
- asset_type = LLAssetType::AT_ANIMATION;
- succ = true;
- }
- else if (!bulk_upload && (exten_lc == "bvh"))
- {
- asset_type = LLAssetType::AT_ANIMATION;
- succ = true;
- }
-
- return succ;
+ bool succ = false;
+ std::string exten_lc(exten);
+ LLStringUtil::toLower(exten_lc);
+ codec = LLImageBase::getCodecFromExtension(exten_lc);
+ if (codec != IMG_CODEC_INVALID)
+ {
+ asset_type = LLAssetType::AT_TEXTURE;
+ succ = true;
+ }
+ else if (exten_lc == "wav")
+ {
+ asset_type = LLAssetType::AT_SOUND;
+ succ = true;
+ }
+ else if (exten_lc == "anim")
+ {
+ asset_type = LLAssetType::AT_ANIMATION;
+ succ = true;
+ }
+ else if (!bulk_upload && (exten_lc == "bvh"))
+ {
+ asset_type = LLAssetType::AT_ANIMATION;
+ succ = true;
+ }
+
+ return succ;
}
//=========================================================================
@@ -385,8 +385,8 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
std::string exten = gDirUtilp->getExtension(getFileName());
LLAssetType::EType assetType = LLAssetType::AT_NONE;
- U32 codec = IMG_CODEC_INVALID;
- bool found_type = findAssetTypeAndCodecOfExtension(exten, assetType, codec);
+ U32 codec = IMG_CODEC_INVALID;
+ bool found_type = findAssetTypeAndCodecOfExtension(exten, assetType, codec);
std::string errorMessage;
std::string errorLabel;
@@ -455,53 +455,53 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
}
else if (exten == "anim")
{
- // Default unless everything succeeds
- errorLabel = "ProblemWithFile";
- error = true;
+ // Default unless everything succeeds
+ errorLabel = "ProblemWithFile";
+ error = true;
// read from getFileName()
- LLAPRFile infile;
- infile.open(getFileName(),LL_APR_RB);
- if (!infile.getFileHandle())
- {
- LL_WARNS() << "Couldn't open file for reading: " << getFileName() << LL_ENDL;
- errorMessage = llformat("Failed to open animation file %s\n", getFileName().c_str());
- }
- else
- {
- S32 size = LLAPRFile::size(getFileName());
- U8* buffer = new U8[size];
- S32 size_read = infile.read(buffer,size);
- if (size_read != size)
- {
- errorMessage = llformat("Failed to read animation file %s: wanted %d bytes, got %d\n", getFileName().c_str(), size, size_read);
- }
- else
- {
- LLDataPackerBinaryBuffer dp(buffer, size);
- LLKeyframeMotion *motionp = new LLKeyframeMotion(getAssetId());
- motionp->setCharacter(gAgentAvatarp);
- if (motionp->deserialize(dp, getAssetId(), false))
- {
- // write to temp file
- bool succ = motionp->dumpToFile(filename);
- if (succ)
- {
- assetType = LLAssetType::AT_ANIMATION;
- errorLabel = "";
- error = false;
- }
- else
- {
- errorMessage = "Failed saving temporary animation file";
- }
- }
- else
- {
- errorMessage = "Failed reading animation file";
- }
- }
- }
+ LLAPRFile infile;
+ infile.open(getFileName(),LL_APR_RB);
+ if (!infile.getFileHandle())
+ {
+ LL_WARNS() << "Couldn't open file for reading: " << getFileName() << LL_ENDL;
+ errorMessage = llformat("Failed to open animation file %s\n", getFileName().c_str());
+ }
+ else
+ {
+ S32 size = LLAPRFile::size(getFileName());
+ U8* buffer = new U8[size];
+ S32 size_read = infile.read(buffer,size);
+ if (size_read != size)
+ {
+ errorMessage = llformat("Failed to read animation file %s: wanted %d bytes, got %d\n", getFileName().c_str(), size, size_read);
+ }
+ else
+ {
+ LLDataPackerBinaryBuffer dp(buffer, size);
+ LLKeyframeMotion *motionp = new LLKeyframeMotion(getAssetId());
+ motionp->setCharacter(gAgentAvatarp);
+ if (motionp->deserialize(dp, getAssetId(), false))
+ {
+ // write to temp file
+ bool succ = motionp->dumpToFile(filename);
+ if (succ)
+ {
+ assetType = LLAssetType::AT_ANIMATION;
+ errorLabel = "";
+ error = false;
+ }
+ else
+ {
+ errorMessage = "Failed saving temporary animation file";
+ }
+ }
+ else
+ {
+ errorMessage = "Failed reading animation file";
+ }
+ }
+ }
}
else
{
@@ -596,10 +596,10 @@ LLSD LLNewBufferedResourceUploadInfo::exportTempFile()
{
std::string filename = gDirUtilp->getTempFilename();
- // copy buffer to the cache for upload
+ // copy buffer to the cache for upload
LLFileSystem file(getAssetId(), getAssetType(), LLFileSystem::APPEND);
file.write((U8*) mBuffer.c_str(), mBuffer.size());
-
+
return LLSD();
}
@@ -828,8 +828,8 @@ LLSD LLScriptAssetUpload::generatePostBody()
LLUUID LLViewerAssetUpload::EnqueueInventoryUpload(const std::string &url, const LLResourceUploadInfo::ptr_t &uploadInfo)
{
std::string procName("LLViewerAssetUpload::AssetInventoryUploadCoproc(");
-
- LLUUID queueId = LLCoprocedureManager::instance().enqueueCoprocedure("Upload",
+
+ LLUUID queueId = LLCoprocedureManager::instance().enqueueCoprocedure("Upload",
procName + LLAssetType::lookup(uploadInfo->getAssetType()) + ")",
boost::bind(&LLViewerAssetUpload::AssetInventoryUploadCoproc, _1, _2, url, uploadInfo));
@@ -838,7 +838,7 @@ LLUUID LLViewerAssetUpload::EnqueueInventoryUpload(const std::string &url, const
//=========================================================================
/*static*/
-void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter,
+void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter,
const LLUUID &id, std::string url, LLResourceUploadInfo::ptr_t uploadInfo)
{
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h
index 7f7707f5bb..5a07fbf802 100644
--- a/indra/newview/llviewerassetupload.h
+++ b/indra/newview/llviewerassetupload.h
@@ -90,8 +90,8 @@ public:
LLUUID getItemId() const { return mItemId; }
LLAssetID getAssetId() const { return mAssetId; }
- static bool findAssetTypeOfExtension(const std::string& exten, LLAssetType::EType& asset_type);
- static bool findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec, bool bulk_upload = true);
+ static bool findAssetTypeOfExtension(const std::string& exten, LLAssetType::EType& asset_type);
+ static bool findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec, bool bulk_upload = true);
protected:
LLResourceUploadInfo(
@@ -256,7 +256,7 @@ public:
};
LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed);
- LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, TargetType_t targetType,
+ LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, TargetType_t targetType,
bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed);
virtual LLSD generatePostBody();
diff --git a/indra/newview/llviewerattachmenu.cpp b/indra/newview/llviewerattachmenu.cpp
index 3975292ed3..f2557e299c 100644
--- a/indra/newview/llviewerattachmenu.cpp
+++ b/indra/newview/llviewerattachmenu.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerattachmenu.cpp
* @brief "Attach to" / "Attach to HUD" submenus.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,91 +43,91 @@
// static
void LLViewerAttachMenu::populateMenus(const std::string& attach_to_menu_name, const std::string& attach_to_hud_menu_name)
{
- // *TODO: share this code with other similar menus
- // (inventory panel context menu, in-world object menu).
+ // *TODO: share this code with other similar menus
+ // (inventory panel context menu, in-world object menu).
- if (attach_to_menu_name.empty() || attach_to_hud_menu_name.empty() || !isAgentAvatarValid()) return;
+ if (attach_to_menu_name.empty() || attach_to_hud_menu_name.empty() || !isAgentAvatarValid()) return;
- LLContextMenu* attach_menu = gMenuHolder->getChild<LLContextMenu>(attach_to_menu_name);
- LLContextMenu* attach_hud_menu = gMenuHolder->getChild<LLContextMenu>(attach_to_hud_menu_name);
+ LLContextMenu* attach_menu = gMenuHolder->getChild<LLContextMenu>(attach_to_menu_name);
+ LLContextMenu* attach_hud_menu = gMenuHolder->getChild<LLContextMenu>(attach_to_hud_menu_name);
- if (!attach_menu || attach_menu->getChildCount() != 0 ||
- !attach_hud_menu || attach_hud_menu->getChildCount() != 0)
- {
- return;
- }
+ if (!attach_menu || attach_menu->getChildCount() != 0 ||
+ !attach_hud_menu || attach_hud_menu->getChildCount() != 0)
+ {
+ return;
+ }
- // Populate "Attach to..." / "Attach to HUD..." submenus.
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); )
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- LLMenuItemCallGL::Params p;
- std::string submenu_name = attachment->getName();
- std::string translated_submenu_name;
+ // Populate "Attach to..." / "Attach to HUD..." submenus.
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ LLMenuItemCallGL::Params p;
+ std::string submenu_name = attachment->getName();
+ std::string translated_submenu_name;
- if (LLTrans::findString(translated_submenu_name, submenu_name))
- {
- p.name = (" ") + translated_submenu_name + " ";
- }
- else
- {
- p.name = submenu_name;
- }
+ if (LLTrans::findString(translated_submenu_name, submenu_name))
+ {
+ p.name = (" ") + translated_submenu_name + " ";
+ }
+ else
+ {
+ p.name = submenu_name;
+ }
- LLSD cbparams;
- cbparams["index"] = curiter->first;
- cbparams["label"] = p.name;
- p.on_click.function_name = "Object.Attach";
- p.on_click.parameter = LLSD(attachment->getName());
- p.on_enable.function_name = "Attachment.Label";
- p.on_enable.parameter = cbparams;
+ LLSD cbparams;
+ cbparams["index"] = curiter->first;
+ cbparams["label"] = p.name;
+ p.on_click.function_name = "Object.Attach";
+ p.on_click.parameter = LLSD(attachment->getName());
+ p.on_enable.function_name = "Attachment.Label";
+ p.on_enable.parameter = cbparams;
- LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(p);
- LLView* parent_menu = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu;
- parent_menu->addChild(item);
- }
+ LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(p);
+ LLView* parent_menu = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu;
+ parent_menu->addChild(item);
+ }
}
// static
void LLViewerAttachMenu::attachObjects(const uuid_vec_t& items, const std::string& joint_name)
{
- LLViewerJointAttachment* attachmentp = NULL;
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); )
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- if (attachment->getName() == joint_name)
- {
- attachmentp = attachment;
- break;
- }
- }
- if (attachmentp == NULL)
- {
- return;
- }
+ LLViewerJointAttachment* attachmentp = NULL;
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ if (attachment->getName() == joint_name)
+ {
+ attachmentp = attachment;
+ break;
+ }
+ }
+ if (attachmentp == NULL)
+ {
+ return;
+ }
- for (uuid_vec_t::const_iterator it = items.begin(); it != items.end(); ++it)
- {
- const LLUUID &id = *it;
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getLinkedItem(id);
- if(item && gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID()))
- {
- rez_attachment(item, attachmentp); // don't replace if called from an "Attach To..." menu
- }
- else if(item && item->isFinished())
- {
- // must be in library. copy it to our inventory and put it on.
- LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, attachmentp));
- copy_inventory_item(gAgent.getID(),
- item->getPermissions().getOwner(),
- item->getUUID(),
- LLUUID::null,
- std::string(),
- cb);
- }
- }
+ for (uuid_vec_t::const_iterator it = items.begin(); it != items.end(); ++it)
+ {
+ const LLUUID &id = *it;
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getLinkedItem(id);
+ if(item && gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID()))
+ {
+ rez_attachment(item, attachmentp); // don't replace if called from an "Attach To..." menu
+ }
+ else if(item && item->isFinished())
+ {
+ // must be in library. copy it to our inventory and put it on.
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, attachmentp));
+ copy_inventory_item(gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ }
}
diff --git a/indra/newview/llviewerattachmenu.h b/indra/newview/llviewerattachmenu.h
index 064c69ef4d..d41b1dc60d 100644
--- a/indra/newview/llviewerattachmenu.h
+++ b/indra/newview/llviewerattachmenu.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerattachmenu.h
* @brief "Attach to" / "Attach to HUD" submenus.
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,8 +30,8 @@
class LLViewerAttachMenu
{
public:
- static void populateMenus(const std::string& attach_to_menu_name, const std::string& attach_to_hud_menu_name);
- static void attachObjects(const uuid_vec_t& items, const std::string& joint_name);
+ static void populateMenus(const std::string& attach_to_menu_name, const std::string& attach_to_hud_menu_name);
+ static void attachObjects(const uuid_vec_t& items, const std::string& joint_name);
};
#endif // LL_LLVIEWERATTACHMENU_H
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index 6a0edbecb1..b93fc5d2fb 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvieweraudio.cpp
* @brief Audio functions that used to be in viewer.cpp
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,450 +50,450 @@
/////////////////////////////////////////////////////////
LLViewerAudio::LLViewerAudio() :
- mDone(true),
- mFadeState(FADE_IDLE),
- mFadeTime(),
+ mDone(true),
+ mFadeState(FADE_IDLE),
+ mFadeTime(),
mIdleListnerActive(false),
- mForcedTeleportFade(false),
- mWasPlaying(false)
+ mForcedTeleportFade(false),
+ mWasPlaying(false)
{
- mTeleportFailedConnection = LLViewerParcelMgr::getInstance()->
- setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this));
- mTeleportFinishedConnection = LLViewerParcelMgr::getInstance()->
- setTeleportFinishedCallback(boost::bind(&LLViewerAudio::onTeleportFinished, this, _1, _2));
- mTeleportStartedConnection = LLViewerMessage::getInstance()->
- setTeleportStartedCallback(boost::bind(&LLViewerAudio::onTeleportStarted, this));
+ mTeleportFailedConnection = LLViewerParcelMgr::getInstance()->
+ setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this));
+ mTeleportFinishedConnection = LLViewerParcelMgr::getInstance()->
+ setTeleportFinishedCallback(boost::bind(&LLViewerAudio::onTeleportFinished, this, _1, _2));
+ mTeleportStartedConnection = LLViewerMessage::getInstance()->
+ setTeleportStartedCallback(boost::bind(&LLViewerAudio::onTeleportStarted, this));
}
LLViewerAudio::~LLViewerAudio()
{
- mTeleportFailedConnection.disconnect();
- mTeleportFinishedConnection.disconnect();
- mTeleportStartedConnection.disconnect();
+ mTeleportFailedConnection.disconnect();
+ mTeleportFinishedConnection.disconnect();
+ mTeleportStartedConnection.disconnect();
}
void LLViewerAudio::registerIdleListener()
{
- if(mIdleListnerActive==false)
- {
- mIdleListnerActive = true;
- doOnIdleRepeating(boost::bind(boost::bind(&LLViewerAudio::onIdleUpdate, this)));
- }
+ if(mIdleListnerActive==false)
+ {
+ mIdleListnerActive = true;
+ doOnIdleRepeating(boost::bind(boost::bind(&LLViewerAudio::onIdleUpdate, this)));
+ }
}
void LLViewerAudio::startInternetStreamWithAutoFade(const std::string &streamURI)
{
LL_DEBUGS("AudioEngine") << "Start with outo fade: " << streamURI << LL_ENDL;
- // Old and new stream are identical
- if (mNextStreamURI == streamURI)
- {
- return;
- }
-
- if (!gAudiop)
- {
- LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
- return;
- }
-
- // Record the URI we are going to be switching to
- mNextStreamURI = streamURI;
-
- switch (mFadeState)
- {
- case FADE_IDLE:
- // If a stream is playing fade it out first
- if (!gAudiop->getInternetStreamURL().empty())
- {
- // The order of these tests is important, state FADE_OUT will be processed below
- mFadeState = FADE_OUT;
- }
- // Otherwise the new stream can be faded in
- else
- {
- mFadeState = FADE_IN;
-
- LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl();
- if (stream && stream->supportsAdjustableBufferSizes())
- stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"), gSavedSettings.getU32("FMODExDecodeBufferSize"));
-
- gAudiop->startInternetStream(mNextStreamURI);
- }
-
- startFading();
- break;
-
- case FADE_OUT:
- startFading();
- break;
-
- case FADE_IN:
- break;
-
- default:
- LL_WARNS() << "Unknown fading state: " << mFadeState << LL_ENDL;
- return;
- }
-
- registerIdleListener();
+ // Old and new stream are identical
+ if (mNextStreamURI == streamURI)
+ {
+ return;
+ }
+
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
+
+ // Record the URI we are going to be switching to
+ mNextStreamURI = streamURI;
+
+ switch (mFadeState)
+ {
+ case FADE_IDLE:
+ // If a stream is playing fade it out first
+ if (!gAudiop->getInternetStreamURL().empty())
+ {
+ // The order of these tests is important, state FADE_OUT will be processed below
+ mFadeState = FADE_OUT;
+ }
+ // Otherwise the new stream can be faded in
+ else
+ {
+ mFadeState = FADE_IN;
+
+ LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl();
+ if (stream && stream->supportsAdjustableBufferSizes())
+ stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"), gSavedSettings.getU32("FMODExDecodeBufferSize"));
+
+ gAudiop->startInternetStream(mNextStreamURI);
+ }
+
+ startFading();
+ break;
+
+ case FADE_OUT:
+ startFading();
+ break;
+
+ case FADE_IN:
+ break;
+
+ default:
+ LL_WARNS() << "Unknown fading state: " << mFadeState << LL_ENDL;
+ return;
+ }
+
+ registerIdleListener();
}
// A return of false from onIdleUpdate means it will be called again next idle update.
// A return of true means we have finished with it and the callback will be deleted.
bool LLViewerAudio::onIdleUpdate()
{
- bool fadeIsFinished = false;
-
- // There is a delay in the login sequence between when the parcel information has
- // arrived and the music stream is started and when the audio system is called to set
- // initial volume levels. This code extends the fade time so you hear a full fade in.
- if ((LLStartUp::getStartupState() < STATE_STARTED))
- {
- stream_fade_timer.reset();
- stream_fade_timer.setTimerExpirySec(mFadeTime);
- }
-
- if (mDone)
- {
- // This should be a rare or never occurring state.
- if (mFadeState == FADE_IDLE)
- {
- deregisterIdleListener();
- fadeIsFinished = true; // Stop calling onIdleUpdate
- }
-
- // we have finished the current fade operation
- if (mFadeState == FADE_OUT)
- {
- if (gAudiop)
- {
- // Clear URI
+ bool fadeIsFinished = false;
+
+ // There is a delay in the login sequence between when the parcel information has
+ // arrived and the music stream is started and when the audio system is called to set
+ // initial volume levels. This code extends the fade time so you hear a full fade in.
+ if ((LLStartUp::getStartupState() < STATE_STARTED))
+ {
+ stream_fade_timer.reset();
+ stream_fade_timer.setTimerExpirySec(mFadeTime);
+ }
+
+ if (mDone)
+ {
+ // This should be a rare or never occurring state.
+ if (mFadeState == FADE_IDLE)
+ {
+ deregisterIdleListener();
+ fadeIsFinished = true; // Stop calling onIdleUpdate
+ }
+
+ // we have finished the current fade operation
+ if (mFadeState == FADE_OUT)
+ {
+ if (gAudiop)
+ {
+ // Clear URI
LL_DEBUGS("AudioEngine") << "Done with audio fade" << LL_ENDL;
- gAudiop->startInternetStream(LLStringUtil::null);
- gAudiop->stopInternetStream();
- }
-
- if (!mNextStreamURI.empty())
- {
- mFadeState = FADE_IN;
-
- if (gAudiop)
- {
+ gAudiop->startInternetStream(LLStringUtil::null);
+ gAudiop->stopInternetStream();
+ }
+
+ if (!mNextStreamURI.empty())
+ {
+ mFadeState = FADE_IN;
+
+ if (gAudiop)
+ {
LL_DEBUGS("AudioEngine") << "Audio fade in: " << mNextStreamURI << LL_ENDL;
- LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl();
- if(stream && stream->supportsAdjustableBufferSizes())
- stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"),gSavedSettings.getU32("FMODExDecodeBufferSize"));
-
- gAudiop->startInternetStream(mNextStreamURI);
- }
-
- startFading();
- }
- else
- {
- mFadeState = FADE_IDLE;
- deregisterIdleListener();
- fadeIsFinished = true; // Stop calling onIdleUpdate
- }
- }
- else if (mFadeState == FADE_IN)
- {
- if (gAudiop && mNextStreamURI != gAudiop->getInternetStreamURL())
- {
- mFadeState = FADE_OUT;
- startFading();
- }
- else
- {
- mFadeState = FADE_IDLE;
- deregisterIdleListener();
- fadeIsFinished = true; // Stop calling onIdleUpdate
- }
- }
- }
-
- return fadeIsFinished;
+ LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl();
+ if(stream && stream->supportsAdjustableBufferSizes())
+ stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"),gSavedSettings.getU32("FMODExDecodeBufferSize"));
+
+ gAudiop->startInternetStream(mNextStreamURI);
+ }
+
+ startFading();
+ }
+ else
+ {
+ mFadeState = FADE_IDLE;
+ deregisterIdleListener();
+ fadeIsFinished = true; // Stop calling onIdleUpdate
+ }
+ }
+ else if (mFadeState == FADE_IN)
+ {
+ if (gAudiop && mNextStreamURI != gAudiop->getInternetStreamURL())
+ {
+ mFadeState = FADE_OUT;
+ startFading();
+ }
+ else
+ {
+ mFadeState = FADE_IDLE;
+ deregisterIdleListener();
+ fadeIsFinished = true; // Stop calling onIdleUpdate
+ }
+ }
+ }
+
+ return fadeIsFinished;
}
void LLViewerAudio::stopInternetStreamWithAutoFade()
{
- mFadeState = FADE_IDLE;
- mNextStreamURI = LLStringUtil::null;
- mDone = true;
-
- if (gAudiop)
- {
+ mFadeState = FADE_IDLE;
+ mNextStreamURI = LLStringUtil::null;
+ mDone = true;
+
+ if (gAudiop)
+ {
LL_DEBUGS("AudioEngine") << "Stop audio fade" << LL_ENDL;
- gAudiop->startInternetStream(LLStringUtil::null);
- gAudiop->stopInternetStream();
- }
+ gAudiop->startInternetStream(LLStringUtil::null);
+ gAudiop->stopInternetStream();
+ }
}
void LLViewerAudio::startFading()
{
- const F32 AUDIO_MUSIC_FADE_IN_TIME = 3.0f;
- const F32 AUDIO_MUSIC_FADE_OUT_TIME = 2.0f;
- // This minimum fade time prevents divide by zero and negative times
- const F32 AUDIO_MUSIC_MINIMUM_FADE_TIME = 0.01f;
-
- if (mDone)
- {
- // The fade state here should only be one of FADE_IN or FADE_OUT, but, in case it is not,
- // rather than check for both states assume a fade in and check for the fade out case.
- mFadeTime = LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT ?
- AUDIO_MUSIC_FADE_OUT_TIME : AUDIO_MUSIC_FADE_IN_TIME;
-
- // Prevent invalid fade time
- mFadeTime = llmax(mFadeTime, AUDIO_MUSIC_MINIMUM_FADE_TIME);
-
- stream_fade_timer.reset();
- stream_fade_timer.setTimerExpirySec(mFadeTime);
- mDone = false;
- }
+ const F32 AUDIO_MUSIC_FADE_IN_TIME = 3.0f;
+ const F32 AUDIO_MUSIC_FADE_OUT_TIME = 2.0f;
+ // This minimum fade time prevents divide by zero and negative times
+ const F32 AUDIO_MUSIC_MINIMUM_FADE_TIME = 0.01f;
+
+ if (mDone)
+ {
+ // The fade state here should only be one of FADE_IN or FADE_OUT, but, in case it is not,
+ // rather than check for both states assume a fade in and check for the fade out case.
+ mFadeTime = LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT ?
+ AUDIO_MUSIC_FADE_OUT_TIME : AUDIO_MUSIC_FADE_IN_TIME;
+
+ // Prevent invalid fade time
+ mFadeTime = llmax(mFadeTime, AUDIO_MUSIC_MINIMUM_FADE_TIME);
+
+ stream_fade_timer.reset();
+ stream_fade_timer.setTimerExpirySec(mFadeTime);
+ mDone = false;
+ }
}
F32 LLViewerAudio::getFadeVolume()
{
- F32 fade_volume = 1.0f;
-
- if (stream_fade_timer.hasExpired())
- {
- mDone = true;
- // If we have been fading out set volume to 0 until the next fade state occurs to prevent
- // an audio transient.
- if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT)
- {
- fade_volume = 0.0f;
- }
- }
-
- if (!mDone)
- {
- // Calculate how far we are into the fade time
- fade_volume = stream_fade_timer.getElapsedTimeF32() / mFadeTime;
-
- if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT)
- {
- // If we are not fading in then we are fading out, so invert the fade
- // direction; start loud and move towards zero volume.
- fade_volume = 1.0f - fade_volume;
- }
- }
-
- return fade_volume;
+ F32 fade_volume = 1.0f;
+
+ if (stream_fade_timer.hasExpired())
+ {
+ mDone = true;
+ // If we have been fading out set volume to 0 until the next fade state occurs to prevent
+ // an audio transient.
+ if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT)
+ {
+ fade_volume = 0.0f;
+ }
+ }
+
+ if (!mDone)
+ {
+ // Calculate how far we are into the fade time
+ fade_volume = stream_fade_timer.getElapsedTimeF32() / mFadeTime;
+
+ if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT)
+ {
+ // If we are not fading in then we are fading out, so invert the fade
+ // direction; start loud and move towards zero volume.
+ fade_volume = 1.0f - fade_volume;
+ }
+ }
+
+ return fade_volume;
}
void LLViewerAudio::onTeleportStarted()
{
- if (gAudiop && !LLViewerAudio::getInstance()->getForcedTeleportFade())
- {
- // Even though the music was turned off it was starting up (with autoplay disabled) occasionally
- // after a failed teleport or after an intra-parcel teleport. Also, the music sometimes was not
- // restarting after a successful intra-parcel teleport. Setting mWasPlaying fixes these issues.
- LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty());
- LLViewerAudio::getInstance()->setForcedTeleportFade(true);
- LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
- LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null);
- }
+ if (gAudiop && !LLViewerAudio::getInstance()->getForcedTeleportFade())
+ {
+ // Even though the music was turned off it was starting up (with autoplay disabled) occasionally
+ // after a failed teleport or after an intra-parcel teleport. Also, the music sometimes was not
+ // restarting after a successful intra-parcel teleport. Setting mWasPlaying fixes these issues.
+ LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty());
+ LLViewerAudio::getInstance()->setForcedTeleportFade(true);
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
+ LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null);
+ }
}
void LLViewerAudio::onTeleportFailed()
{
- // Calling audio_update_volume makes sure that the music stream is properly set to be restored to
- // its previous value
- audio_update_volume(false);
-
- if (gAudiop && mWasPlaying)
- {
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (parcel)
- {
- mNextStreamURI = parcel->getMusicURL();
- LL_INFOS() << "Teleport failed -- setting music stream to " << mNextStreamURI << LL_ENDL;
- }
- }
- mWasPlaying = false;
+ // Calling audio_update_volume makes sure that the music stream is properly set to be restored to
+ // its previous value
+ audio_update_volume(false);
+
+ if (gAudiop && mWasPlaying)
+ {
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (parcel)
+ {
+ mNextStreamURI = parcel->getMusicURL();
+ LL_INFOS() << "Teleport failed -- setting music stream to " << mNextStreamURI << LL_ENDL;
+ }
+ }
+ mWasPlaying = false;
}
void LLViewerAudio::onTeleportFinished(const LLVector3d& pos, const bool& local)
{
- // Calling audio_update_volume makes sure that the music stream is properly set to be restored to
- // its previous value
- audio_update_volume(false);
-
- if (gAudiop && local && mWasPlaying)
- {
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (parcel)
- {
- mNextStreamURI = parcel->getMusicURL();
- LL_INFOS() << "Intraparcel teleport -- setting music stream to " << mNextStreamURI << LL_ENDL;
- }
- }
- mWasPlaying = false;
+ // Calling audio_update_volume makes sure that the music stream is properly set to be restored to
+ // its previous value
+ audio_update_volume(false);
+
+ if (gAudiop && local && mWasPlaying)
+ {
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (parcel)
+ {
+ mNextStreamURI = parcel->getMusicURL();
+ LL_INFOS() << "Intraparcel teleport -- setting music stream to " << mNextStreamURI << LL_ENDL;
+ }
+ }
+ mWasPlaying = false;
}
-void init_audio()
+void init_audio()
{
- if (!gAudiop)
- {
- LL_WARNS() << "Failed to create an appropriate Audio Engine" << LL_ENDL;
- return;
- }
- LLVector3d lpos_global = gAgentCamera.getCameraPositionGlobal();
- LLVector3 lpos_global_f;
-
- lpos_global_f.setVec(lpos_global);
-
- gAudiop->setListener(lpos_global_f,
- LLVector3::zero, // LLViewerCamera::getInstance()->getVelocity(), // !!! BUG need to replace this with smoothed velocity!
- LLViewerCamera::getInstance()->getUpAxis(),
- LLViewerCamera::getInstance()->getAtAxis());
+ if (!gAudiop)
+ {
+ LL_WARNS() << "Failed to create an appropriate Audio Engine" << LL_ENDL;
+ return;
+ }
+ LLVector3d lpos_global = gAgentCamera.getCameraPositionGlobal();
+ LLVector3 lpos_global_f;
+
+ lpos_global_f.setVec(lpos_global);
+
+ gAudiop->setListener(lpos_global_f,
+ LLVector3::zero, // LLViewerCamera::getInstance()->getVelocity(), // !!! BUG need to replace this with smoothed velocity!
+ LLViewerCamera::getInstance()->getUpAxis(),
+ LLViewerCamera::getInstance()->getAtAxis());
// load up our initial set of sounds we'll want so they're in memory and ready to be played
- BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
-
- if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload"))
- {
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndAlert")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndBadKeystroke")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndChatFromObject")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClick")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClickRelease")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionF")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionM")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingChat")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingIM")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvApplyToObject")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvalidOp")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInventoryCopyToInv")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeDown")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeUp")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCopyToInv")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCreate")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectDelete")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezIn")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezOut")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndSnapshot")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartAutopilot")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartFollowpilot")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartIM")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStopAutopilot")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTeleportOut")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureApplyToObject")));
- //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureCopyToInv")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTyping")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowClose")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowOpen")));
- gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndRestart")));
- }
-
- audio_update_volume(true);
+ BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
+
+ if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload"))
+ {
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndAlert")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndBadKeystroke")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndChatFromObject")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClick")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClickRelease")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionF")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionM")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingChat")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingIM")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvApplyToObject")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvalidOp")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInventoryCopyToInv")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeDown")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeUp")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCopyToInv")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCreate")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectDelete")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezIn")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezOut")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndSnapshot")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartAutopilot")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartFollowpilot")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartIM")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStopAutopilot")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTeleportOut")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureApplyToObject")));
+ //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureCopyToInv")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTyping")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowClose")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowOpen")));
+ gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndRestart")));
+ }
+
+ audio_update_volume(true);
}
void audio_update_volume(bool force_update)
{
- F32 master_volume = gSavedSettings.getF32("AudioLevelMaster");
- BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
-
- LLProgressView* progress = gViewerWindow->getProgressView();
- BOOL progress_view_visible = FALSE;
-
- if (progress)
- {
- progress_view_visible = progress->getVisible();
- }
-
- if (!gViewerWindow->getActive() && gSavedSettings.getBOOL("MuteWhenMinimized"))
- {
- mute_audio = TRUE;
- }
- F32 mute_volume = mute_audio ? 0.0f : 1.0f;
-
- if (gAudiop)
- {
- // Sound Effects
-
- gAudiop->setMasterGain ( master_volume );
-
- gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler"));
-
- if(!LLViewerCamera::getInstance()->cameraUnderWater())
- gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff"));
- else
- gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelUnderwaterRolloff"));
-
- gAudiop->setMuted(mute_audio || progress_view_visible);
-
- //Play any deferred sounds when unmuted
- if(!gAudiop->getMuted())
- {
- LLDeferredSounds::instance().playdeferredSounds();
- }
-
- if (force_update)
- {
- audio_update_wind(true);
- }
-
- // handle secondary gains
- gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_SFX,
- gSavedSettings.getBOOL("MuteSounds") ? 0.f : gSavedSettings.getF32("AudioLevelSFX"));
- gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_UI,
- gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"));
- gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_AMBIENT,
- gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient"));
-
- // Streaming Music
-
- if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade())
- {
- LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty());
- LLViewerAudio::getInstance()->setForcedTeleportFade(false);
- }
-
- F32 music_volume = gSavedSettings.getF32("AudioLevelMusic");
- BOOL music_muted = gSavedSettings.getBOOL("MuteMusic");
- F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume();
-
- music_volume = mute_volume * master_volume * music_volume * fade_volume;
- gAudiop->setInternetStreamGain (music_muted ? 0.f : music_volume);
- }
-
- // Streaming Media
- F32 media_volume = gSavedSettings.getF32("AudioLevelMedia");
- BOOL media_muted = gSavedSettings.getBOOL("MuteMedia");
- media_volume = mute_volume * master_volume * media_volume;
- LLViewerMedia::getInstance()->setVolume( media_muted ? 0.0f : media_volume );
-
- // Voice, this is parametric singleton, it gets initialized when ready
- if (LLVoiceClient::instanceExists())
- {
- F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice");
- voice_volume = mute_volume * master_volume * voice_volume;
- BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice");
- LLVoiceClient *voice_inst = LLVoiceClient::getInstance();
- voice_inst->setVoiceVolume(voice_mute ? 0.f : voice_volume);
- voice_inst->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
-
- if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized")))
- {
- voice_inst->setMuteMic(true);
- }
- else
- {
- voice_inst->setMuteMic(false);
- }
- }
+ F32 master_volume = gSavedSettings.getF32("AudioLevelMaster");
+ BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
+
+ LLProgressView* progress = gViewerWindow->getProgressView();
+ BOOL progress_view_visible = FALSE;
+
+ if (progress)
+ {
+ progress_view_visible = progress->getVisible();
+ }
+
+ if (!gViewerWindow->getActive() && gSavedSettings.getBOOL("MuteWhenMinimized"))
+ {
+ mute_audio = TRUE;
+ }
+ F32 mute_volume = mute_audio ? 0.0f : 1.0f;
+
+ if (gAudiop)
+ {
+ // Sound Effects
+
+ gAudiop->setMasterGain ( master_volume );
+
+ gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler"));
+
+ if(!LLViewerCamera::getInstance()->cameraUnderWater())
+ gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff"));
+ else
+ gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelUnderwaterRolloff"));
+
+ gAudiop->setMuted(mute_audio || progress_view_visible);
+
+ //Play any deferred sounds when unmuted
+ if(!gAudiop->getMuted())
+ {
+ LLDeferredSounds::instance().playdeferredSounds();
+ }
+
+ if (force_update)
+ {
+ audio_update_wind(true);
+ }
+
+ // handle secondary gains
+ gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_SFX,
+ gSavedSettings.getBOOL("MuteSounds") ? 0.f : gSavedSettings.getF32("AudioLevelSFX"));
+ gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_UI,
+ gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"));
+ gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_AMBIENT,
+ gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient"));
+
+ // Streaming Music
+
+ if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade())
+ {
+ LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty());
+ LLViewerAudio::getInstance()->setForcedTeleportFade(false);
+ }
+
+ F32 music_volume = gSavedSettings.getF32("AudioLevelMusic");
+ BOOL music_muted = gSavedSettings.getBOOL("MuteMusic");
+ F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume();
+
+ music_volume = mute_volume * master_volume * music_volume * fade_volume;
+ gAudiop->setInternetStreamGain (music_muted ? 0.f : music_volume);
+ }
+
+ // Streaming Media
+ F32 media_volume = gSavedSettings.getF32("AudioLevelMedia");
+ BOOL media_muted = gSavedSettings.getBOOL("MuteMedia");
+ media_volume = mute_volume * master_volume * media_volume;
+ LLViewerMedia::getInstance()->setVolume( media_muted ? 0.0f : media_volume );
+
+ // Voice, this is parametric singleton, it gets initialized when ready
+ if (LLVoiceClient::instanceExists())
+ {
+ F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice");
+ voice_volume = mute_volume * master_volume * voice_volume;
+ BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice");
+ LLVoiceClient *voice_inst = LLVoiceClient::getInstance();
+ voice_inst->setVoiceVolume(voice_mute ? 0.f : voice_volume);
+ voice_inst->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
+
+ if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized")))
+ {
+ voice_inst->setMuteMic(true);
+ }
+ else
+ {
+ voice_inst->setMuteMic(false);
+ }
+ }
}
void audio_update_listener()
{
- if (gAudiop)
- {
- // update listener position because agent has moved
+ if (gAudiop)
+ {
+ // update listener position because agent has moved
static LLUICachedControl<S32> mEarLocation("MediaSoundsEarLocation", 0);
LLVector3d ear_position;
switch(mEarLocation)
@@ -507,26 +507,26 @@ void audio_update_listener()
ear_position = gAgent.getPositionGlobal();
break;
}
- LLVector3d lpos_global = ear_position;
- LLVector3 lpos_global_f;
- lpos_global_f.setVec(lpos_global);
-
- gAudiop->setListener(lpos_global_f,
- // LLViewerCamera::getInstance()VelocitySmoothed,
- // LLVector3::zero,
- gAgent.getVelocity(), // !!! *TODO: need to replace this with smoothed velocity!
- LLViewerCamera::getInstance()->getUpAxis(),
- LLViewerCamera::getInstance()->getAtAxis());
- }
+ LLVector3d lpos_global = ear_position;
+ LLVector3 lpos_global_f;
+ lpos_global_f.setVec(lpos_global);
+
+ gAudiop->setListener(lpos_global_f,
+ // LLViewerCamera::getInstance()VelocitySmoothed,
+ // LLVector3::zero,
+ gAgent.getVelocity(), // !!! *TODO: need to replace this with smoothed velocity!
+ LLViewerCamera::getInstance()->getUpAxis(),
+ LLViewerCamera::getInstance()->getAtAxis());
+ }
}
void audio_update_wind(bool force_update)
{
#ifdef kAUDIO_ENABLE_WIND
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
// Scale down the contribution of weather-simulation wind to the
// ambient wind noise. Wind velocity averages 3.5 m/s, with gusts to 7 m/s
// whereas steady-state avatar walk velocity is only 3.2 m/s.
@@ -534,50 +534,50 @@ void audio_update_wind(bool force_update)
// standing still.
static LLUICachedControl<F32> wind_level("AudioLevelWind", 0.5f);
LLVector3 scaled_wind_vec = gWindVec * wind_level;
-
+
// Mix in the avatar's motion, subtract because when you walk north,
// the apparent wind moves south.
LLVector3 final_wind_vec = scaled_wind_vec - gAgent.getVelocity();
-
- // rotate the wind vector to be listener (agent) relative
- gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal( final_wind_vec );
-
- // don't use the setter setMaxWindGain() because we don't
- // want to screw up the fade-in on startup by setting actual source gain
- // outside the fade-in.
- F32 master_volume = gSavedSettings.getBOOL("MuteAudio") ? 0.f : gSavedSettings.getF32("AudioLevelMaster");
- F32 ambient_volume = gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient");
- F32 max_wind_volume = master_volume * ambient_volume;
-
- const F32 WIND_SOUND_TRANSITION_TIME = 2.f;
- // amount to change volume this frame
- F32 volume_delta = (LLFrameTimer::getFrameDeltaTimeF32() / WIND_SOUND_TRANSITION_TIME) * max_wind_volume;
- if (force_update)
- {
- // initialize wind volume (force_update) by using large volume_delta
- // which is sufficient to completely turn off or turn on wind noise
- volume_delta = 1.f;
- }
-
- if (!gAudiop)
- {
- LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
- return;
- }
-
- // mute wind when not flying
- if (gAgent.getFlying())
- {
- // volume increases by volume_delta, up to no more than max_wind_volume
- gAudiop->mMaxWindGain = llmin(gAudiop->mMaxWindGain + volume_delta, max_wind_volume);
- }
- else
- {
- // volume decreases by volume_delta, down to no less than 0
- gAudiop->mMaxWindGain = llmax(gAudiop->mMaxWindGain - volume_delta, 0.f);
- }
-
- gAudiop->updateWind(gRelativeWindVec, gAgentCamera.getCameraPositionAgent()[VZ] - gAgent.getRegion()->getWaterHeight());
- }
+
+ // rotate the wind vector to be listener (agent) relative
+ gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal( final_wind_vec );
+
+ // don't use the setter setMaxWindGain() because we don't
+ // want to screw up the fade-in on startup by setting actual source gain
+ // outside the fade-in.
+ F32 master_volume = gSavedSettings.getBOOL("MuteAudio") ? 0.f : gSavedSettings.getF32("AudioLevelMaster");
+ F32 ambient_volume = gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient");
+ F32 max_wind_volume = master_volume * ambient_volume;
+
+ const F32 WIND_SOUND_TRANSITION_TIME = 2.f;
+ // amount to change volume this frame
+ F32 volume_delta = (LLFrameTimer::getFrameDeltaTimeF32() / WIND_SOUND_TRANSITION_TIME) * max_wind_volume;
+ if (force_update)
+ {
+ // initialize wind volume (force_update) by using large volume_delta
+ // which is sufficient to completely turn off or turn on wind noise
+ volume_delta = 1.f;
+ }
+
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
+
+ // mute wind when not flying
+ if (gAgent.getFlying())
+ {
+ // volume increases by volume_delta, up to no more than max_wind_volume
+ gAudiop->mMaxWindGain = llmin(gAudiop->mMaxWindGain + volume_delta, max_wind_volume);
+ }
+ else
+ {
+ // volume decreases by volume_delta, down to no less than 0
+ gAudiop->mMaxWindGain = llmax(gAudiop->mMaxWindGain - volume_delta, 0.f);
+ }
+
+ gAudiop->updateWind(gRelativeWindVec, gAgentCamera.getCameraPositionAgent()[VZ] - gAgent.getRegion()->getWaterHeight());
+ }
#endif
}
diff --git a/indra/newview/llvieweraudio.h b/indra/newview/llvieweraudio.h
index febae36ae8..827b14f4de 100644
--- a/indra/newview/llvieweraudio.h
+++ b/indra/newview/llvieweraudio.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvieweraudio.h
* @brief Audio functions that used to be in viewer.cpp
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,8 +31,8 @@
#include "llsingleton.h"
// comment out to turn off wind
-#define kAUDIO_ENABLE_WIND
-//#define kAUDIO_ENABLE_WATER 1 // comment out to turn off water
+#define kAUDIO_ENABLE_WIND
+//#define kAUDIO_ENABLE_WATER 1 // comment out to turn off water
void init_audio();
void audio_update_volume(bool force_update = true);
@@ -41,52 +41,52 @@ void audio_update_wind(bool force_update = true);
class LLViewerAudio : public LLSingleton<LLViewerAudio>
{
- LLSINGLETON(LLViewerAudio);
- virtual ~LLViewerAudio();
+ LLSINGLETON(LLViewerAudio);
+ virtual ~LLViewerAudio();
public:
- enum EFadeState
- {
- FADE_IDLE,
- FADE_IN,
- FADE_OUT,
- };
+ enum EFadeState
+ {
+ FADE_IDLE,
+ FADE_IN,
+ FADE_OUT,
+ };
+
+ void startInternetStreamWithAutoFade(const std::string &streamURI);
+ void stopInternetStreamWithAutoFade();
- void startInternetStreamWithAutoFade(const std::string &streamURI);
- void stopInternetStreamWithAutoFade();
-
- bool onIdleUpdate();
+ bool onIdleUpdate();
- EFadeState getFadeState() { return mFadeState; }
- bool isDone() { return mDone; };
- F32 getFadeVolume();
- bool getForcedTeleportFade() { return mForcedTeleportFade; };
- void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ;
- std::string getNextStreamURI() { return mNextStreamURI; };
- void setNextStreamURI(const std::string &stream) { mNextStreamURI = stream; } ;
- void setWasPlaying(bool playing) { mWasPlaying = playing;} ;
+ EFadeState getFadeState() { return mFadeState; }
+ bool isDone() { return mDone; };
+ F32 getFadeVolume();
+ bool getForcedTeleportFade() { return mForcedTeleportFade; };
+ void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ;
+ std::string getNextStreamURI() { return mNextStreamURI; };
+ void setNextStreamURI(const std::string &stream) { mNextStreamURI = stream; } ;
+ void setWasPlaying(bool playing) { mWasPlaying = playing;} ;
private:
- bool mDone;
- F32 mFadeTime;
- std::string mNextStreamURI;
- EFadeState mFadeState;
- LLFrameTimer stream_fade_timer;
- bool mIdleListnerActive;
- bool mForcedTeleportFade;
- bool mWasPlaying;
- boost::signals2::connection mTeleportFailedConnection;
- boost::signals2::connection mTeleportFinishedConnection;
- boost::signals2::connection mTeleportStartedConnection;
+ bool mDone;
+ F32 mFadeTime;
+ std::string mNextStreamURI;
+ EFadeState mFadeState;
+ LLFrameTimer stream_fade_timer;
+ bool mIdleListnerActive;
+ bool mForcedTeleportFade;
+ bool mWasPlaying;
+ boost::signals2::connection mTeleportFailedConnection;
+ boost::signals2::connection mTeleportFinishedConnection;
+ boost::signals2::connection mTeleportStartedConnection;
- void registerIdleListener();
- void deregisterIdleListener() { mIdleListnerActive = false; };
- void startFading();
- void onTeleportFailed();
- void onTeleportFinished(const LLVector3d& pos, const bool& local);
- void onTeleportStarted();
+ void registerIdleListener();
+ void deregisterIdleListener() { mIdleListnerActive = false; };
+ void startFading();
+ void onTeleportFailed();
+ void onTeleportFinished(const LLVector3d& pos, const bool& local);
+ void onTeleportStarted();
};
#endif //LL_VIEWER_H
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index 4134e35f87..d261190d22 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewercamera.cpp
* @brief LLViewerCamera class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,7 +48,7 @@
#include "llgl.h"
#include "llglheaders.h"
#include "llquaternion.h"
-#include "llwindow.h" // getPixelAspectRatio()
+#include "llwindow.h" // getPixelAspectRatio()
#include "lltracerecording.h"
#include "llenvironment.h"
@@ -63,38 +63,38 @@ LLViewerCamera::eCameraID LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_
//glu pick matrix implementation borrowed from Mesa3D
glh::matrix4f gl_pick_matrix(GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLint* viewport)
{
- GLfloat m[16];
- GLfloat sx, sy;
- GLfloat tx, ty;
-
- sx = viewport[2] / width;
- sy = viewport[3] / height;
- tx = (viewport[2] + 2.f * (viewport[0] - x)) / width;
- ty = (viewport[3] + 2.f * (viewport[1] - y)) / height;
-
- #define M(row,col) m[col*4+row]
- M(0,0) = sx; M(0,1) = 0.f; M(0,2) = 0.f; M(0,3) = tx;
- M(1,0) = 0.f; M(1,1) = sy; M(1,2) = 0.f; M(1,3) = ty;
- M(2,0) = 0.f; M(2,1) = 0.f; M(2,2) = 1.f; M(2,3) = 0.f;
- M(3,0) = 0.f; M(3,1) = 0.f; M(3,2) = 0.f; M(3,3) = 1.f;
- #undef M
-
- return glh::matrix4f(m);
+ GLfloat m[16];
+ GLfloat sx, sy;
+ GLfloat tx, ty;
+
+ sx = viewport[2] / width;
+ sy = viewport[3] / height;
+ tx = (viewport[2] + 2.f * (viewport[0] - x)) / width;
+ ty = (viewport[3] + 2.f * (viewport[1] - y)) / height;
+
+ #define M(row,col) m[col*4+row]
+ M(0,0) = sx; M(0,1) = 0.f; M(0,2) = 0.f; M(0,3) = tx;
+ M(1,0) = 0.f; M(1,1) = sy; M(1,2) = 0.f; M(1,3) = ty;
+ M(2,0) = 0.f; M(2,1) = 0.f; M(2,2) = 1.f; M(2,3) = 0.f;
+ M(3,0) = 0.f; M(3,1) = 0.f; M(3,2) = 0.f; M(3,3) = 1.f;
+ #undef M
+
+ return glh::matrix4f(m);
}
LLViewerCamera::LLViewerCamera() : LLCamera()
{
- calcProjection(getFar());
- mCameraFOVDefault = DEFAULT_FIELD_OF_VIEW;
- mPrevCameraFOVDefault = DEFAULT_FIELD_OF_VIEW;
- mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f);
- mPixelMeterRatio = 0.f;
- mScreenPixelArea = 0;
- mZoomFactor = 1.f;
- mZoomSubregion = 1;
- mAverageSpeed = 0.f;
- mAverageAngularSpeed = 0.f;
- gSavedSettings.getControl("CameraAngle")->getCommitSignal()->connect(boost::bind(&LLViewerCamera::updateCameraAngle, this, _2));
+ calcProjection(getFar());
+ mCameraFOVDefault = DEFAULT_FIELD_OF_VIEW;
+ mPrevCameraFOVDefault = DEFAULT_FIELD_OF_VIEW;
+ mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f);
+ mPixelMeterRatio = 0.f;
+ mScreenPixelArea = 0;
+ mZoomFactor = 1.f;
+ mZoomSubregion = 1;
+ mAverageSpeed = 0.f;
+ mAverageAngularSpeed = 0.f;
+ gSavedSettings.getControl("CameraAngle")->getCommitSignal()->connect(boost::bind(&LLViewerCamera::updateCameraAngle, this, _2));
}
void LLViewerCamera::updateCameraLocation(const LLVector3 &center, const LLVector3 &up_direction, const LLVector3 &point_of_interest)
@@ -133,61 +133,61 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 &center, const LLVecto
}
}
- setOriginAndLookAt(origin, up_direction, point_of_interest);
+ setOriginAndLookAt(origin, up_direction, point_of_interest);
+
+ mVelocityDir = origin - last_position ;
+ F32 dpos = mVelocityDir.normVec() ;
+ LLQuaternion rotation;
+ rotation.shortestArc(last_axis, getAtAxis());
- mVelocityDir = origin - last_position ;
- F32 dpos = mVelocityDir.normVec() ;
- LLQuaternion rotation;
- rotation.shortestArc(last_axis, getAtAxis());
+ F32 x, y, z;
+ F32 drot;
+ rotation.getAngleAxis(&drot, &x, &y, &z);
- F32 x, y, z;
- F32 drot;
- rotation.getAngleAxis(&drot, &x, &y, &z);
+ add(sVelocityStat, dpos);
+ add(sAngularVelocityStat, drot);
- add(sVelocityStat, dpos);
- add(sAngularVelocityStat, drot);
-
- mAverageSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sVelocityStat, 50);
- mAverageAngularSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sAngularVelocityStat);
- mCosHalfCameraFOV = cosf(0.5f * getView() * llmax(1.0f, getAspect()));
+ mAverageSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sVelocityStat, 50);
+ mAverageAngularSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sAngularVelocityStat);
+ mCosHalfCameraFOV = cosf(0.5f * getView() * llmax(1.0f, getAspect()));
- // update pixel meter ratio using default fov, not modified one
- mPixelMeterRatio = getViewHeightInPixels()/ (2.f*tanf(mCameraFOVDefault*0.5));
- // update screen pixel area
- mScreenPixelArea =(S32)((F32)getViewHeightInPixels() * ((F32)getViewHeightInPixels() * getAspect()));
+ // update pixel meter ratio using default fov, not modified one
+ mPixelMeterRatio = getViewHeightInPixels()/ (2.f*tanf(mCameraFOVDefault*0.5));
+ // update screen pixel area
+ mScreenPixelArea =(S32)((F32)getViewHeightInPixels() * ((F32)getViewHeightInPixels() * getAspect()));
}
const LLMatrix4 &LLViewerCamera::getProjection() const
{
- calcProjection(getFar());
- return mProjectionMatrix;
+ calcProjection(getFar());
+ return mProjectionMatrix;
}
const LLMatrix4 &LLViewerCamera::getModelview() const
{
- LLMatrix4 cfr(OGL_TO_CFR_ROTATION);
- getMatrixToLocal(mModelviewMatrix);
- mModelviewMatrix *= cfr;
- return mModelviewMatrix;
+ LLMatrix4 cfr(OGL_TO_CFR_ROTATION);
+ getMatrixToLocal(mModelviewMatrix);
+ mModelviewMatrix *= cfr;
+ return mModelviewMatrix;
}
void LLViewerCamera::calcProjection(const F32 far_distance) const
{
- F32 fov_y, z_far, z_near, aspect, f;
- fov_y = getView();
- z_far = far_distance;
- z_near = getNear();
- aspect = getAspect();
-
- f = 1/tan(fov_y*0.5f);
-
- mProjectionMatrix.setZero();
- mProjectionMatrix.mMatrix[0][0] = f/aspect;
- mProjectionMatrix.mMatrix[1][1] = f;
- mProjectionMatrix.mMatrix[2][2] = (z_far + z_near)/(z_near - z_far);
- mProjectionMatrix.mMatrix[3][2] = (2*z_far*z_near)/(z_near - z_far);
- mProjectionMatrix.mMatrix[2][3] = -1;
+ F32 fov_y, z_far, z_near, aspect, f;
+ fov_y = getView();
+ z_far = far_distance;
+ z_near = getNear();
+ aspect = getAspect();
+
+ f = 1/tan(fov_y*0.5f);
+
+ mProjectionMatrix.setZero();
+ mProjectionMatrix.mMatrix[0][0] = f/aspect;
+ mProjectionMatrix.mMatrix[1][1] = f;
+ mProjectionMatrix.mMatrix[2][2] = (z_far + z_near)/(z_near - z_far);
+ mProjectionMatrix.mMatrix[3][2] = (2*z_far*z_near)/(z_near - z_far);
+ mProjectionMatrix.mMatrix[2][3] = -1;
}
// Sets up opengl state for 3D drawing. If for selection, also
@@ -198,222 +198,222 @@ void LLViewerCamera::calcProjection(const F32 far_distance) const
//static
void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, BOOL ortho, BOOL zflip, BOOL no_hacks)
{
- GLint* viewport = (GLint*) gGLViewport;
- F64 model[16];
- F64 proj[16];
-
- for (U32 i = 0; i < 16; i++)
- {
- model[i] = (F64) gGLModelView[i];
- proj[i] = (F64) gGLProjection[i];
- }
-
- GLdouble objX,objY,objZ;
-
- LLVector3 frust[8];
-
- if (no_hacks)
- {
- gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
-
- gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
- frust[4].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
- frust[5].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
- frust[6].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
- frust[7].setVec((F32)objX,(F32)objY,(F32)objZ);
- }
- else if (zflip)
- {
- gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
-
- gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
- frust[4].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
- frust[5].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
- frust[6].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
- frust[7].setVec((F32)objX,(F32)objY,(F32)objZ);
-
- for (U32 i = 0; i < 4; i++)
- {
- frust[i+4] = frust[i+4]-frust[i];
- frust[i+4].normVec();
- frust[i+4] = frust[i] + frust[i+4]*camera.getFar();
- }
- }
- else
- {
- gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
- gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
- frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
-
- if (ortho)
- {
- LLVector3 far_shift = camera.getAtAxis()*camera.getFar()*2.f;
- for (U32 i = 0; i < 4; i++)
- {
- frust[i+4] = frust[i] + far_shift;
- }
- }
- else
- {
- for (U32 i = 0; i < 4; i++)
- {
- LLVector3 vec = frust[i] - camera.getOrigin();
- vec.normVec();
- frust[i+4] = camera.getOrigin() + vec*camera.getFar();
- }
- }
- }
-
- camera.calcAgentFrustumPlanes(frust);
+ GLint* viewport = (GLint*) gGLViewport;
+ F64 model[16];
+ F64 proj[16];
+
+ for (U32 i = 0; i < 16; i++)
+ {
+ model[i] = (F64) gGLModelView[i];
+ proj[i] = (F64) gGLProjection[i];
+ }
+
+ GLdouble objX,objY,objZ;
+
+ LLVector3 frust[8];
+
+ if (no_hacks)
+ {
+ gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
+
+ gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
+ frust[4].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
+ frust[5].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
+ frust[6].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
+ frust[7].setVec((F32)objX,(F32)objY,(F32)objZ);
+ }
+ else if (zflip)
+ {
+ gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
+
+ gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
+ frust[4].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
+ frust[5].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
+ frust[6].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
+ frust[7].setVec((F32)objX,(F32)objY,(F32)objZ);
+
+ for (U32 i = 0; i < 4; i++)
+ {
+ frust[i+4] = frust[i+4]-frust[i];
+ frust[i+4].normVec();
+ frust[i+4] = frust[i] + frust[i+4]*camera.getFar();
+ }
+ }
+ else
+ {
+ gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
+ gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
+ frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
+
+ if (ortho)
+ {
+ LLVector3 far_shift = camera.getAtAxis()*camera.getFar()*2.f;
+ for (U32 i = 0; i < 4; i++)
+ {
+ frust[i+4] = frust[i] + far_shift;
+ }
+ }
+ else
+ {
+ for (U32 i = 0; i < 4; i++)
+ {
+ LLVector3 vec = frust[i] - camera.getOrigin();
+ vec.normVec();
+ frust[i+4] = camera.getOrigin() + vec*camera.getFar();
+ }
+ }
+ }
+
+ camera.calcAgentFrustumPlanes(frust);
}
void LLViewerCamera::setPerspective(BOOL for_selection,
- S32 x, S32 y_from_bot, S32 width, S32 height,
- BOOL limit_select_distance,
- F32 z_near, F32 z_far)
+ S32 x, S32 y_from_bot, S32 width, S32 height,
+ BOOL limit_select_distance,
+ F32 z_near, F32 z_far)
{
- F32 fov_y, aspect;
- fov_y = RAD_TO_DEG * getView();
- BOOL z_default_far = FALSE;
- if (z_far <= 0)
- {
- z_default_far = TRUE;
- z_far = getFar();
- }
- if (z_near <= 0)
- {
- z_near = getNear();
- }
- aspect = getAspect();
-
- // Load camera view matrix
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.loadIdentity();
-
- glh::matrix4f proj_mat;
-
- if (for_selection)
- {
- // make a tiny little viewport
- // anything drawn into this viewport will be "selected"
-
- GLint viewport[4];
- viewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
- viewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
- viewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
- viewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
-
- proj_mat = gl_pick_matrix(x+width/2.f, y_from_bot+height/2.f, (GLfloat) width, (GLfloat) height, viewport);
-
- if (limit_select_distance)
- {
- // ...select distance from control
- z_far = gSavedSettings.getF32("MaxSelectDistance");
- }
- else
- {
- z_far = gAgentCamera.mDrawDistance;
- }
- }
- else
- {
- // Only override the far clip if it's not passed in explicitly.
- if (z_default_far)
- {
- z_far = MAX_FAR_CLIP;
- }
- glViewport(x, y_from_bot, width, height);
- gGLViewport[0] = x;
- gGLViewport[1] = y_from_bot;
- gGLViewport[2] = width;
- gGLViewport[3] = height;
- }
-
- if (mZoomFactor > 1.f)
- {
- float offset = mZoomFactor - 1.f;
- int pos_y = mZoomSubregion / llceil(mZoomFactor);
- int pos_x = mZoomSubregion - (pos_y*llceil(mZoomFactor));
- glh::matrix4f translate;
- translate.set_translate(glh::vec3f(offset - (F32)pos_x * 2.f, offset - (F32)pos_y * 2.f, 0.f));
- glh::matrix4f scale;
- scale.set_scale(glh::vec3f(mZoomFactor, mZoomFactor, 1.f));
-
- proj_mat = scale*proj_mat;
- proj_mat = translate*proj_mat;
- }
-
- calcProjection(z_far); // Update the projection matrix cache
-
- proj_mat *= gl_perspective(fov_y,aspect,z_near,z_far);
-
- gGL.loadMatrix(proj_mat.m);
-
- for (U32 i = 0; i < 16; i++)
- {
- gGLProjection[i] = proj_mat.m[i];
- }
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- glh::matrix4f modelview((GLfloat*) OGL_TO_CFR_ROTATION);
-
- GLfloat ogl_matrix[16];
-
- getOpenGLTransform(ogl_matrix);
-
- modelview *= glh::matrix4f(ogl_matrix);
-
- gGL.loadMatrix(modelview.m);
-
- if (for_selection && (width > 1 || height > 1))
- {
- // NB: as of this writing, i believe the code below is broken (doesn't take into account the world view, assumes entire window)
- // however, it is also unused (the GL matricies are used for selection, (see LLCamera::sphereInFrustum())) and so i'm not
- // comfortable hacking on it.
- calculateFrustumPlanesFromWindow((F32)(x - width / 2) / (F32)gViewerWindow->getWindowWidthScaled() - 0.5f,
- (F32)(y_from_bot - height / 2) / (F32)gViewerWindow->getWindowHeightScaled() - 0.5f,
- (F32)(x + width / 2) / (F32)gViewerWindow->getWindowWidthScaled() - 0.5f,
- (F32)(y_from_bot + height / 2) / (F32)gViewerWindow->getWindowHeightScaled() - 0.5f);
-
- }
-
- // if not picking and not doing a snapshot, cache various GL matrices
- if (!for_selection && mZoomFactor == 1.f)
- {
- // Save GL matrices for access elsewhere in code, especially project_world_to_screen
- for (U32 i = 0; i < 16; i++)
- {
- gGLModelView[i] = modelview.m[i];
- }
- }
-
- updateFrustumPlanes(*this);
+ F32 fov_y, aspect;
+ fov_y = RAD_TO_DEG * getView();
+ BOOL z_default_far = FALSE;
+ if (z_far <= 0)
+ {
+ z_default_far = TRUE;
+ z_far = getFar();
+ }
+ if (z_near <= 0)
+ {
+ z_near = getNear();
+ }
+ aspect = getAspect();
+
+ // Load camera view matrix
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadIdentity();
+
+ glh::matrix4f proj_mat;
+
+ if (for_selection)
+ {
+ // make a tiny little viewport
+ // anything drawn into this viewport will be "selected"
+
+ GLint viewport[4];
+ viewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+ viewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+ viewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+ viewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+
+ proj_mat = gl_pick_matrix(x+width/2.f, y_from_bot+height/2.f, (GLfloat) width, (GLfloat) height, viewport);
+
+ if (limit_select_distance)
+ {
+ // ...select distance from control
+ z_far = gSavedSettings.getF32("MaxSelectDistance");
+ }
+ else
+ {
+ z_far = gAgentCamera.mDrawDistance;
+ }
+ }
+ else
+ {
+ // Only override the far clip if it's not passed in explicitly.
+ if (z_default_far)
+ {
+ z_far = MAX_FAR_CLIP;
+ }
+ glViewport(x, y_from_bot, width, height);
+ gGLViewport[0] = x;
+ gGLViewport[1] = y_from_bot;
+ gGLViewport[2] = width;
+ gGLViewport[3] = height;
+ }
+
+ if (mZoomFactor > 1.f)
+ {
+ float offset = mZoomFactor - 1.f;
+ int pos_y = mZoomSubregion / llceil(mZoomFactor);
+ int pos_x = mZoomSubregion - (pos_y*llceil(mZoomFactor));
+ glh::matrix4f translate;
+ translate.set_translate(glh::vec3f(offset - (F32)pos_x * 2.f, offset - (F32)pos_y * 2.f, 0.f));
+ glh::matrix4f scale;
+ scale.set_scale(glh::vec3f(mZoomFactor, mZoomFactor, 1.f));
+
+ proj_mat = scale*proj_mat;
+ proj_mat = translate*proj_mat;
+ }
+
+ calcProjection(z_far); // Update the projection matrix cache
+
+ proj_mat *= gl_perspective(fov_y,aspect,z_near,z_far);
+
+ gGL.loadMatrix(proj_mat.m);
+
+ for (U32 i = 0; i < 16; i++)
+ {
+ gGLProjection[i] = proj_mat.m[i];
+ }
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ glh::matrix4f modelview((GLfloat*) OGL_TO_CFR_ROTATION);
+
+ GLfloat ogl_matrix[16];
+
+ getOpenGLTransform(ogl_matrix);
+
+ modelview *= glh::matrix4f(ogl_matrix);
+
+ gGL.loadMatrix(modelview.m);
+
+ if (for_selection && (width > 1 || height > 1))
+ {
+ // NB: as of this writing, i believe the code below is broken (doesn't take into account the world view, assumes entire window)
+ // however, it is also unused (the GL matricies are used for selection, (see LLCamera::sphereInFrustum())) and so i'm not
+ // comfortable hacking on it.
+ calculateFrustumPlanesFromWindow((F32)(x - width / 2) / (F32)gViewerWindow->getWindowWidthScaled() - 0.5f,
+ (F32)(y_from_bot - height / 2) / (F32)gViewerWindow->getWindowHeightScaled() - 0.5f,
+ (F32)(x + width / 2) / (F32)gViewerWindow->getWindowWidthScaled() - 0.5f,
+ (F32)(y_from_bot + height / 2) / (F32)gViewerWindow->getWindowHeightScaled() - 0.5f);
+
+ }
+
+ // if not picking and not doing a snapshot, cache various GL matrices
+ if (!for_selection && mZoomFactor == 1.f)
+ {
+ // Save GL matrices for access elsewhere in code, especially project_world_to_screen
+ for (U32 i = 0; i < 16; i++)
+ {
+ gGLModelView[i] = modelview.m[i];
+ }
+ }
+
+ updateFrustumPlanes(*this);
}
@@ -421,24 +421,24 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
// screen coordinates to the agent's region.
void LLViewerCamera::projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent) const
{
- GLdouble x, y, z;
-
- F64 mdlv[16];
- F64 proj[16];
-
- for (U32 i = 0; i < 16; i++)
- {
- mdlv[i] = (F64) gGLModelView[i];
- proj[i] = (F64) gGLProjection[i];
- }
-
- gluUnProject(
- GLdouble(screen_x), GLdouble(screen_y), 0.0,
- mdlv, proj, (GLint*)gGLViewport,
- &x,
- &y,
- &z );
- pos_agent->setVec( (F32)x, (F32)y, (F32)z );
+ GLdouble x, y, z;
+
+ F64 mdlv[16];
+ F64 proj[16];
+
+ for (U32 i = 0; i < 16; i++)
+ {
+ mdlv[i] = (F64) gGLModelView[i];
+ proj[i] = (F64) gGLProjection[i];
+ }
+
+ gluUnProject(
+ GLdouble(screen_x), GLdouble(screen_y), 0.0,
+ mdlv, proj, (GLint*)gGLViewport,
+ &x,
+ &y,
+ &z );
+ pos_agent->setVec( (F32)x, (F32)y, (F32)z );
}
// Uses the last GL matrices set in set_perspective to project a point from
@@ -446,318 +446,318 @@ void LLViewerCamera::projectScreenToPosAgent(const S32 screen_x, const S32 scree
// the current window.
BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp) const
{
- BOOL in_front = TRUE;
- GLdouble x, y, z; // object's window coords, GL-style
-
- LLVector3 dir_to_point = pos_agent - getOrigin();
- dir_to_point /= dir_to_point.magVec();
-
- if (dir_to_point * getAtAxis() < 0.f)
- {
- if (clamp)
- {
- return FALSE;
- }
- else
- {
- in_front = FALSE;
- }
- }
-
- LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
- S32 viewport[4];
- viewport[0] = world_view_rect.mLeft;
- viewport[1] = world_view_rect.mBottom;
- viewport[2] = world_view_rect.getWidth();
- viewport[3] = world_view_rect.getHeight();
-
- F64 mdlv[16];
- F64 proj[16];
-
- for (U32 i = 0; i < 16; i++)
- {
- mdlv[i] = (F64) gGLModelView[i];
- proj[i] = (F64) gGLProjection[i];
- }
-
- if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ],
- mdlv, proj, (GLint*)viewport,
- &x, &y, &z))
- {
- // convert screen coordinates to virtual UI coordinates
- x /= gViewerWindow->getDisplayScale().mV[VX];
- y /= gViewerWindow->getDisplayScale().mV[VY];
-
- // should now have the x,y coords of grab_point in screen space
- LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
-
- // convert to pixel coordinates
- S32 int_x = lltrunc(x);
- S32 int_y = lltrunc(y);
-
- BOOL valid = TRUE;
-
- if (clamp)
- {
- if (int_x < world_rect.mLeft)
- {
- out_point.mX = world_rect.mLeft;
- valid = FALSE;
- }
- else if (int_x > world_rect.mRight)
- {
- out_point.mX = world_rect.mRight;
- valid = FALSE;
- }
- else
- {
- out_point.mX = int_x;
- }
-
- if (int_y < world_rect.mBottom)
- {
- out_point.mY = world_rect.mBottom;
- valid = FALSE;
- }
- else if (int_y > world_rect.mTop)
- {
- out_point.mY = world_rect.mTop;
- valid = FALSE;
- }
- else
- {
- out_point.mY = int_y;
- }
- return valid;
- }
- else
- {
- out_point.mX = int_x;
- out_point.mY = int_y;
-
- if (int_x < world_rect.mLeft)
- {
- valid = FALSE;
- }
- else if (int_x > world_rect.mRight)
- {
- valid = FALSE;
- }
- if (int_y < world_rect.mBottom)
- {
- valid = FALSE;
- }
- else if (int_y > world_rect.mTop)
- {
- valid = FALSE;
- }
-
- return in_front && valid;
- }
- }
- else
- {
- return FALSE;
- }
+ BOOL in_front = TRUE;
+ GLdouble x, y, z; // object's window coords, GL-style
+
+ LLVector3 dir_to_point = pos_agent - getOrigin();
+ dir_to_point /= dir_to_point.magVec();
+
+ if (dir_to_point * getAtAxis() < 0.f)
+ {
+ if (clamp)
+ {
+ return FALSE;
+ }
+ else
+ {
+ in_front = FALSE;
+ }
+ }
+
+ LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
+ S32 viewport[4];
+ viewport[0] = world_view_rect.mLeft;
+ viewport[1] = world_view_rect.mBottom;
+ viewport[2] = world_view_rect.getWidth();
+ viewport[3] = world_view_rect.getHeight();
+
+ F64 mdlv[16];
+ F64 proj[16];
+
+ for (U32 i = 0; i < 16; i++)
+ {
+ mdlv[i] = (F64) gGLModelView[i];
+ proj[i] = (F64) gGLProjection[i];
+ }
+
+ if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ],
+ mdlv, proj, (GLint*)viewport,
+ &x, &y, &z))
+ {
+ // convert screen coordinates to virtual UI coordinates
+ x /= gViewerWindow->getDisplayScale().mV[VX];
+ y /= gViewerWindow->getDisplayScale().mV[VY];
+
+ // should now have the x,y coords of grab_point in screen space
+ LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
+
+ // convert to pixel coordinates
+ S32 int_x = lltrunc(x);
+ S32 int_y = lltrunc(y);
+
+ BOOL valid = TRUE;
+
+ if (clamp)
+ {
+ if (int_x < world_rect.mLeft)
+ {
+ out_point.mX = world_rect.mLeft;
+ valid = FALSE;
+ }
+ else if (int_x > world_rect.mRight)
+ {
+ out_point.mX = world_rect.mRight;
+ valid = FALSE;
+ }
+ else
+ {
+ out_point.mX = int_x;
+ }
+
+ if (int_y < world_rect.mBottom)
+ {
+ out_point.mY = world_rect.mBottom;
+ valid = FALSE;
+ }
+ else if (int_y > world_rect.mTop)
+ {
+ out_point.mY = world_rect.mTop;
+ valid = FALSE;
+ }
+ else
+ {
+ out_point.mY = int_y;
+ }
+ return valid;
+ }
+ else
+ {
+ out_point.mX = int_x;
+ out_point.mY = int_y;
+
+ if (int_x < world_rect.mLeft)
+ {
+ valid = FALSE;
+ }
+ else if (int_x > world_rect.mRight)
+ {
+ valid = FALSE;
+ }
+ if (int_y < world_rect.mBottom)
+ {
+ valid = FALSE;
+ }
+ else if (int_y > world_rect.mTop)
+ {
+ valid = FALSE;
+ }
+
+ return in_front && valid;
+ }
+ }
+ else
+ {
+ return FALSE;
+ }
}
// Uses the last GL matrices set in set_perspective to project a point from
// the agent's region space to the nearest edge in screen coordinates.
// Returns TRUE if projection succeeds.
BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
- LLCoordGL &out_point) const
+ LLCoordGL &out_point) const
{
- LLVector3 dir_to_point = pos_agent - getOrigin();
- dir_to_point /= dir_to_point.magVec();
-
- BOOL in_front = TRUE;
- if (dir_to_point * getAtAxis() < 0.f)
- {
- in_front = FALSE;
- }
-
- LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
- S32 viewport[4];
- viewport[0] = world_view_rect.mLeft;
- viewport[1] = world_view_rect.mBottom;
- viewport[2] = world_view_rect.getWidth();
- viewport[3] = world_view_rect.getHeight();
- GLdouble x, y, z; // object's window coords, GL-style
-
- F64 mdlv[16];
- F64 proj[16];
-
- for (U32 i = 0; i < 16; i++)
- {
- mdlv[i] = (F64) gGLModelView[i];
- proj[i] = (F64) gGLProjection[i];
- }
-
- if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY],
- pos_agent.mV[VZ], mdlv,
- proj, (GLint*)viewport,
- &x, &y, &z))
- {
- x /= gViewerWindow->getDisplayScale().mV[VX];
- y /= gViewerWindow->getDisplayScale().mV[VY];
- // should now have the x,y coords of grab_point in screen space
- const LLRect& world_rect = gViewerWindow->getWorldViewRectScaled();
-
- // ...sanity check
- S32 int_x = lltrunc(x);
- S32 int_y = lltrunc(y);
-
- // find the center
- GLdouble center_x = (GLdouble)world_rect.getCenterX();
- GLdouble center_y = (GLdouble)world_rect.getCenterY();
-
- if (x == center_x && y == center_y)
- {
- // can't project to edge from exact center
- return FALSE;
- }
-
- // find the line from center to local
- GLdouble line_x = x - center_x;
- GLdouble line_y = y - center_y;
-
- int_x = lltrunc(center_x);
- int_y = lltrunc(center_y);
-
-
- if (0.f == line_x)
- {
- // the slope of the line is undefined
- if (line_y > 0.f)
- {
- int_y = world_rect.mTop;
- }
- else
- {
- int_y = world_rect.mBottom;
- }
- }
- else if (0 == world_rect.getWidth())
- {
- // the diagonal slope of the view is undefined
- if (y < world_rect.mBottom)
- {
- int_y = world_rect.mBottom;
- }
- else if ( y > world_rect.mTop)
- {
- int_y = world_rect.mTop;
- }
- }
- else
- {
- F32 line_slope = (F32)(line_y / line_x);
- F32 rect_slope = ((F32)world_rect.getHeight()) / ((F32)world_rect.getWidth());
-
- if (fabs(line_slope) > rect_slope)
- {
- if (line_y < 0.f)
- {
- // bottom
- int_y = world_rect.mBottom;
- }
- else
- {
- // top
- int_y = world_rect.mTop;
- }
- int_x = lltrunc(((GLdouble)int_y - center_y) / line_slope + center_x);
- }
- else if (fabs(line_slope) < rect_slope)
- {
- if (line_x < 0.f)
- {
- // left
- int_x = world_rect.mLeft;
- }
- else
- {
- // right
- int_x = world_rect.mRight;
- }
- int_y = lltrunc(((GLdouble)int_x - center_x) * line_slope + center_y);
- }
- else
- {
- // exactly parallel ==> push to the corners
- if (line_x > 0.f)
- {
- int_x = world_rect.mRight;
- }
- else
- {
- int_x = world_rect.mLeft;
- }
- if (line_y > 0.0f)
- {
- int_y = world_rect.mTop;
- }
- else
- {
- int_y = world_rect.mBottom;
- }
- }
- }
- if (!in_front)
- {
- int_x = world_rect.mLeft + world_rect.mRight - int_x;
- int_y = world_rect.mBottom + world_rect.mTop - int_y;
- }
-
- out_point.mX = int_x + world_rect.mLeft;
- out_point.mY = int_y + world_rect.mBottom;
- return TRUE;
- }
- return FALSE;
+ LLVector3 dir_to_point = pos_agent - getOrigin();
+ dir_to_point /= dir_to_point.magVec();
+
+ BOOL in_front = TRUE;
+ if (dir_to_point * getAtAxis() < 0.f)
+ {
+ in_front = FALSE;
+ }
+
+ LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
+ S32 viewport[4];
+ viewport[0] = world_view_rect.mLeft;
+ viewport[1] = world_view_rect.mBottom;
+ viewport[2] = world_view_rect.getWidth();
+ viewport[3] = world_view_rect.getHeight();
+ GLdouble x, y, z; // object's window coords, GL-style
+
+ F64 mdlv[16];
+ F64 proj[16];
+
+ for (U32 i = 0; i < 16; i++)
+ {
+ mdlv[i] = (F64) gGLModelView[i];
+ proj[i] = (F64) gGLProjection[i];
+ }
+
+ if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY],
+ pos_agent.mV[VZ], mdlv,
+ proj, (GLint*)viewport,
+ &x, &y, &z))
+ {
+ x /= gViewerWindow->getDisplayScale().mV[VX];
+ y /= gViewerWindow->getDisplayScale().mV[VY];
+ // should now have the x,y coords of grab_point in screen space
+ const LLRect& world_rect = gViewerWindow->getWorldViewRectScaled();
+
+ // ...sanity check
+ S32 int_x = lltrunc(x);
+ S32 int_y = lltrunc(y);
+
+ // find the center
+ GLdouble center_x = (GLdouble)world_rect.getCenterX();
+ GLdouble center_y = (GLdouble)world_rect.getCenterY();
+
+ if (x == center_x && y == center_y)
+ {
+ // can't project to edge from exact center
+ return FALSE;
+ }
+
+ // find the line from center to local
+ GLdouble line_x = x - center_x;
+ GLdouble line_y = y - center_y;
+
+ int_x = lltrunc(center_x);
+ int_y = lltrunc(center_y);
+
+
+ if (0.f == line_x)
+ {
+ // the slope of the line is undefined
+ if (line_y > 0.f)
+ {
+ int_y = world_rect.mTop;
+ }
+ else
+ {
+ int_y = world_rect.mBottom;
+ }
+ }
+ else if (0 == world_rect.getWidth())
+ {
+ // the diagonal slope of the view is undefined
+ if (y < world_rect.mBottom)
+ {
+ int_y = world_rect.mBottom;
+ }
+ else if ( y > world_rect.mTop)
+ {
+ int_y = world_rect.mTop;
+ }
+ }
+ else
+ {
+ F32 line_slope = (F32)(line_y / line_x);
+ F32 rect_slope = ((F32)world_rect.getHeight()) / ((F32)world_rect.getWidth());
+
+ if (fabs(line_slope) > rect_slope)
+ {
+ if (line_y < 0.f)
+ {
+ // bottom
+ int_y = world_rect.mBottom;
+ }
+ else
+ {
+ // top
+ int_y = world_rect.mTop;
+ }
+ int_x = lltrunc(((GLdouble)int_y - center_y) / line_slope + center_x);
+ }
+ else if (fabs(line_slope) < rect_slope)
+ {
+ if (line_x < 0.f)
+ {
+ // left
+ int_x = world_rect.mLeft;
+ }
+ else
+ {
+ // right
+ int_x = world_rect.mRight;
+ }
+ int_y = lltrunc(((GLdouble)int_x - center_x) * line_slope + center_y);
+ }
+ else
+ {
+ // exactly parallel ==> push to the corners
+ if (line_x > 0.f)
+ {
+ int_x = world_rect.mRight;
+ }
+ else
+ {
+ int_x = world_rect.mLeft;
+ }
+ if (line_y > 0.0f)
+ {
+ int_y = world_rect.mTop;
+ }
+ else
+ {
+ int_y = world_rect.mBottom;
+ }
+ }
+ }
+ if (!in_front)
+ {
+ int_x = world_rect.mLeft + world_rect.mRight - int_x;
+ int_y = world_rect.mBottom + world_rect.mTop - int_y;
+ }
+
+ out_point.mX = int_x + world_rect.mLeft;
+ out_point.mY = int_y + world_rect.mBottom;
+ return TRUE;
+ }
+ return FALSE;
}
void LLViewerCamera::getPixelVectors(const LLVector3 &pos_agent, LLVector3 &up, LLVector3 &right)
{
- LLVector3 to_vec = pos_agent - getOrigin();
+ LLVector3 to_vec = pos_agent - getOrigin();
- F32 at_dist = to_vec * getAtAxis();
+ F32 at_dist = to_vec * getAtAxis();
- F32 height_meters = at_dist* (F32)tan(getView()/2.f);
- F32 height_pixels = getViewHeightInPixels()/2.f;
+ F32 height_meters = at_dist* (F32)tan(getView()/2.f);
+ F32 height_pixels = getViewHeightInPixels()/2.f;
- F32 pixel_aspect = gViewerWindow->getWindow()->getPixelAspectRatio();
+ F32 pixel_aspect = gViewerWindow->getWindow()->getPixelAspectRatio();
- F32 meters_per_pixel = height_meters / height_pixels;
- up = getUpAxis() * meters_per_pixel * gViewerWindow->getDisplayScale().mV[VY];
- right = -1.f * pixel_aspect * meters_per_pixel * getLeftAxis() * gViewerWindow->getDisplayScale().mV[VX];
+ F32 meters_per_pixel = height_meters / height_pixels;
+ up = getUpAxis() * meters_per_pixel * gViewerWindow->getDisplayScale().mV[VY];
+ right = -1.f * pixel_aspect * meters_per_pixel * getLeftAxis() * gViewerWindow->getDisplayScale().mV[VX];
}
LLVector3 LLViewerCamera::roundToPixel(const LLVector3 &pos_agent)
{
- F32 dist = (pos_agent - getOrigin()).magVec();
- // Convert to screen space and back, preserving the depth.
- LLCoordGL screen_point;
- if (!projectPosAgentToScreen(pos_agent, screen_point, FALSE))
- {
- // Off the screen, just return the original position.
- return pos_agent;
- }
-
- LLVector3 ray_dir;
-
- projectScreenToPosAgent(screen_point.mX, screen_point.mY, &ray_dir);
- ray_dir -= getOrigin();
- ray_dir.normVec();
-
- LLVector3 pos_agent_rounded = getOrigin() + ray_dir*dist;
-
- /*
- LLVector3 pixel_x, pixel_y;
- getPixelVectors(pos_agent_rounded, pixel_y, pixel_x);
- pos_agent_rounded += 0.5f*pixel_x, 0.5f*pixel_y;
- */
- return pos_agent_rounded;
+ F32 dist = (pos_agent - getOrigin()).magVec();
+ // Convert to screen space and back, preserving the depth.
+ LLCoordGL screen_point;
+ if (!projectPosAgentToScreen(pos_agent, screen_point, FALSE))
+ {
+ // Off the screen, just return the original position.
+ return pos_agent;
+ }
+
+ LLVector3 ray_dir;
+
+ projectScreenToPosAgent(screen_point.mX, screen_point.mY, &ray_dir);
+ ray_dir -= getOrigin();
+ ray_dir.normVec();
+
+ LLVector3 pos_agent_rounded = getOrigin() + ray_dir*dist;
+
+ /*
+ LLVector3 pixel_x, pixel_y;
+ getPixelVectors(pos_agent_rounded, pixel_y, pixel_x);
+ pos_agent_rounded += 0.5f*pixel_x, 0.5f*pixel_y;
+ */
+ return pos_agent_rounded;
}
BOOL LLViewerCamera::cameraUnderWater() const
@@ -769,69 +769,69 @@ BOOL LLViewerCamera::cameraUnderWater() const
regionp = gAgent.getRegion();
}
- if(!regionp)
- {
- return FALSE ;
- }
+ if(!regionp)
+ {
+ return FALSE ;
+ }
- return getOrigin().mV[VZ] < regionp->getWaterHeight();
+ return getOrigin().mV[VZ] < regionp->getWaterHeight();
}
BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts)
{
- S32 i, num_faces;
- LLDrawable* drawablep = volumep->mDrawable;
-
- if (!drawablep)
- {
- return FALSE;
- }
-
- LLVolume* volume = volumep->getVolume();
- if (!volume)
- {
- return FALSE;
- }
-
- LLVOVolume* vo_volume = (LLVOVolume*) volumep;
-
- vo_volume->updateRelativeXform();
- LLMatrix4 mat = vo_volume->getRelativeXform();
-
- LLMatrix4 render_mat(vo_volume->getRenderRotation(), LLVector4(vo_volume->getRenderPosition()));
-
- LLMatrix4a render_mata;
- render_mata.loadu(render_mat);
- LLMatrix4a mata;
- mata.loadu(mat);
-
- num_faces = volume->getNumVolumeFaces();
- for (i = 0; i < num_faces; i++)
- {
- const LLVolumeFace& face = volume->getVolumeFace(i);
-
- for (U32 v = 0; v < face.mNumVertices; v++)
- {
- const LLVector4a& src_vec = face.mPositions[v];
- LLVector4a vec;
- mata.affineTransform(src_vec, vec);
-
- if (drawablep->isActive())
- {
- LLVector4a t = vec;
- render_mata.affineTransform(t, vec);
- }
-
- BOOL in_frustum = pointInFrustum(LLVector3(vec.getF32ptr())) > 0;
-
- if (( !in_frustum && all_verts) ||
- (in_frustum && !all_verts))
- {
- return !all_verts;
- }
- }
- }
- return all_verts;
+ S32 i, num_faces;
+ LLDrawable* drawablep = volumep->mDrawable;
+
+ if (!drawablep)
+ {
+ return FALSE;
+ }
+
+ LLVolume* volume = volumep->getVolume();
+ if (!volume)
+ {
+ return FALSE;
+ }
+
+ LLVOVolume* vo_volume = (LLVOVolume*) volumep;
+
+ vo_volume->updateRelativeXform();
+ LLMatrix4 mat = vo_volume->getRelativeXform();
+
+ LLMatrix4 render_mat(vo_volume->getRenderRotation(), LLVector4(vo_volume->getRenderPosition()));
+
+ LLMatrix4a render_mata;
+ render_mata.loadu(render_mat);
+ LLMatrix4a mata;
+ mata.loadu(mat);
+
+ num_faces = volume->getNumVolumeFaces();
+ for (i = 0; i < num_faces; i++)
+ {
+ const LLVolumeFace& face = volume->getVolumeFace(i);
+
+ for (U32 v = 0; v < face.mNumVertices; v++)
+ {
+ const LLVector4a& src_vec = face.mPositions[v];
+ LLVector4a vec;
+ mata.affineTransform(src_vec, vec);
+
+ if (drawablep->isActive())
+ {
+ LLVector4a t = vec;
+ render_mata.affineTransform(t, vec);
+ }
+
+ BOOL in_frustum = pointInFrustum(LLVector3(vec.getF32ptr())) > 0;
+
+ if (( !in_frustum && all_verts) ||
+ (in_frustum && !all_verts))
+ {
+ return !all_verts;
+ }
+ }
+ }
+ return all_verts;
}
extern BOOL gCubeSnapshot;
@@ -841,29 +841,29 @@ extern BOOL gCubeSnapshot;
{
llassert(!gCubeSnapshot);
- F32 old_fov = LLViewerCamera::getInstance()->getView();
+ F32 old_fov = LLViewerCamera::getInstance()->getView();
- // cap the FoV
- vertical_fov_rads = llclamp(vertical_fov_rads, getMinView(), getMaxView());
+ // cap the FoV
+ vertical_fov_rads = llclamp(vertical_fov_rads, getMinView(), getMaxView());
- if (vertical_fov_rads == old_fov) return;
+ if (vertical_fov_rads == old_fov) return;
- // send the new value to the simulator
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_AgentFOV);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addU32Fast(_PREHASH_CircuitCode, gMessageSystem->mOurCircuitCode);
+ // send the new value to the simulator
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_AgentFOV);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addU32Fast(_PREHASH_CircuitCode, gMessageSystem->mOurCircuitCode);
- msg->nextBlockFast(_PREHASH_FOVBlock);
- msg->addU32Fast(_PREHASH_GenCounter, 0);
- msg->addF32Fast(_PREHASH_VerticalAngle, vertical_fov_rads);
+ msg->nextBlockFast(_PREHASH_FOVBlock);
+ msg->addU32Fast(_PREHASH_GenCounter, 0);
+ msg->addF32Fast(_PREHASH_VerticalAngle, vertical_fov_rads);
- gAgent.sendReliableMessage();
+ gAgent.sendReliableMessage();
- // sync the camera with the new value
- LLCamera::setView(vertical_fov_rads); // call base implementation
+ // sync the camera with the new value
+ LLCamera::setView(vertical_fov_rads); // call base implementation
}
void LLViewerCamera::setViewNoBroadcast(F32 vertical_fov_rads)
@@ -871,28 +871,28 @@ void LLViewerCamera::setViewNoBroadcast(F32 vertical_fov_rads)
LLCamera::setView(vertical_fov_rads);
}
-void LLViewerCamera::setDefaultFOV(F32 vertical_fov_rads)
+void LLViewerCamera::setDefaultFOV(F32 vertical_fov_rads)
{
- vertical_fov_rads = llclamp(vertical_fov_rads, getMinView(), getMaxView());
- setView(vertical_fov_rads);
- mCameraFOVDefault = vertical_fov_rads;
- mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f);
+ vertical_fov_rads = llclamp(vertical_fov_rads, getMinView(), getMaxView());
+ setView(vertical_fov_rads);
+ mCameraFOVDefault = vertical_fov_rads;
+ mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f);
}
BOOL LLViewerCamera::isDefaultFOVChanged()
{
- if(mPrevCameraFOVDefault != mCameraFOVDefault)
- {
- mPrevCameraFOVDefault = mCameraFOVDefault;
- return !gSavedSettings.getBOOL("IgnoreFOVZoomForLODs");
- }
- return FALSE;
+ if(mPrevCameraFOVDefault != mCameraFOVDefault)
+ {
+ mPrevCameraFOVDefault = mCameraFOVDefault;
+ return !gSavedSettings.getBOOL("IgnoreFOVZoomForLODs");
+ }
+ return FALSE;
}
// static
void LLViewerCamera::updateCameraAngle( void* user_data, const LLSD& value)
{
- LLViewerCamera* self=(LLViewerCamera*)user_data;
- self->setDefaultFOV(value.asReal());
+ LLViewerCamera* self=(LLViewerCamera*)user_data;
+ self->setDefaultFOV(value.asReal());
}
diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h
index 78ca2b3076..3bbb33f82c 100644
--- a/indra/newview/llviewercamera.h
+++ b/indra/newview/llviewercamera.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewercamera.h
* @brief LLViewerCamera class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,86 +44,86 @@ class alignas(16) LLViewerCamera : public LLCamera, public LLSimpleton<LLViewerC
public:
LLViewerCamera();
- typedef enum
- {
- CAMERA_WORLD = 0,
- CAMERA_SUN_SHADOW0,
- CAMERA_SUN_SHADOW1,
- CAMERA_SUN_SHADOW2,
- CAMERA_SUN_SHADOW3,
- CAMERA_SPOT_SHADOW0,
- CAMERA_SPOT_SHADOW1,
- CAMERA_WATER0,
- CAMERA_WATER1,
- NUM_CAMERAS
- } eCameraID;
-
- static eCameraID sCurCameraID;
-
- void updateCameraLocation(const LLVector3 &center,
- const LLVector3 &up_direction,
- const LLVector3 &point_of_interest);
-
- static void updateFrustumPlanes(LLCamera& camera, BOOL ortho = FALSE, BOOL zflip = FALSE, BOOL no_hacks = FALSE);
- static void updateCameraAngle(void* user_data, const LLSD& value);
- void setPerspective(BOOL for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, BOOL limit_select_distance, F32 z_near = 0, F32 z_far = 0);
-
- const LLMatrix4 &getProjection() const;
- const LLMatrix4 &getModelview() const;
-
- // Warning! These assume the current global matrices are correct
- void projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent ) const;
- BOOL projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp = TRUE) const;
- BOOL projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const;
-
- LLVector3 getVelocityDir() const {return mVelocityDir;}
- static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; }
- static LLTrace::CountStatHandle<>* getAngularVelocityStat() {return &sAngularVelocityStat; }
- F32 getCosHalfFov() {return mCosHalfCameraFOV;}
- F32 getAverageSpeed() {return mAverageSpeed ;}
- F32 getAverageAngularSpeed() {return mAverageAngularSpeed;}
-
- void getPixelVectors(const LLVector3 &pos_agent, LLVector3 &up, LLVector3 &right);
- LLVector3 roundToPixel(const LLVector3 &pos_agent);
-
- // Sets the current matrix
- /* virtual */ void setView(F32 vertical_fov_rads); // NOTE: broadcasts to simulator
+ typedef enum
+ {
+ CAMERA_WORLD = 0,
+ CAMERA_SUN_SHADOW0,
+ CAMERA_SUN_SHADOW1,
+ CAMERA_SUN_SHADOW2,
+ CAMERA_SUN_SHADOW3,
+ CAMERA_SPOT_SHADOW0,
+ CAMERA_SPOT_SHADOW1,
+ CAMERA_WATER0,
+ CAMERA_WATER1,
+ NUM_CAMERAS
+ } eCameraID;
+
+ static eCameraID sCurCameraID;
+
+ void updateCameraLocation(const LLVector3 &center,
+ const LLVector3 &up_direction,
+ const LLVector3 &point_of_interest);
+
+ static void updateFrustumPlanes(LLCamera& camera, BOOL ortho = FALSE, BOOL zflip = FALSE, BOOL no_hacks = FALSE);
+ static void updateCameraAngle(void* user_data, const LLSD& value);
+ void setPerspective(BOOL for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, BOOL limit_select_distance, F32 z_near = 0, F32 z_far = 0);
+
+ const LLMatrix4 &getProjection() const;
+ const LLMatrix4 &getModelview() const;
+
+ // Warning! These assume the current global matrices are correct
+ void projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent ) const;
+ BOOL projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp = TRUE) const;
+ BOOL projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const;
+
+ LLVector3 getVelocityDir() const {return mVelocityDir;}
+ static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; }
+ static LLTrace::CountStatHandle<>* getAngularVelocityStat() {return &sAngularVelocityStat; }
+ F32 getCosHalfFov() {return mCosHalfCameraFOV;}
+ F32 getAverageSpeed() {return mAverageSpeed ;}
+ F32 getAverageAngularSpeed() {return mAverageAngularSpeed;}
+
+ void getPixelVectors(const LLVector3 &pos_agent, LLVector3 &up, LLVector3 &right);
+ LLVector3 roundToPixel(const LLVector3 &pos_agent);
+
+ // Sets the current matrix
+ /* virtual */ void setView(F32 vertical_fov_rads); // NOTE: broadcasts to simulator
void setViewNoBroadcast(F32 vertical_fov_rads); // set FOV without broadcasting to simulator (for temporary local cameras)
- void setDefaultFOV(F32 fov) ;
- F32 getDefaultFOV() { return mCameraFOVDefault; }
+ void setDefaultFOV(F32 fov) ;
+ F32 getDefaultFOV() { return mCameraFOVDefault; }
- BOOL isDefaultFOVChanged();
+ BOOL isDefaultFOVChanged();
- BOOL cameraUnderWater() const;
- BOOL areVertsVisible(LLViewerObject* volumep, BOOL all_verts);
+ BOOL cameraUnderWater() const;
+ BOOL areVertsVisible(LLViewerObject* volumep, BOOL all_verts);
- const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; }
- F32 getPixelMeterRatio() const { return mPixelMeterRatio; }
- S32 getScreenPixelArea() const { return mScreenPixelArea; }
+ const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; }
+ F32 getPixelMeterRatio() const { return mPixelMeterRatio; }
+ S32 getScreenPixelArea() const { return mScreenPixelArea; }
- void setZoomParameters(F32 factor, S16 subregion) { mZoomFactor = factor; mZoomSubregion = subregion; }
- F32 getZoomFactor() { return mZoomFactor; }
- S16 getZoomSubRegion() { return mZoomSubregion; }
+ void setZoomParameters(F32 factor, S16 subregion) { mZoomFactor = factor; mZoomSubregion = subregion; }
+ F32 getZoomFactor() { return mZoomFactor; }
+ S16 getZoomSubRegion() { return mZoomSubregion; }
protected:
- void calcProjection(const F32 far_distance) const;
-
- static LLTrace::CountStatHandle<> sVelocityStat;
- static LLTrace::CountStatHandle<> sAngularVelocityStat;
-
- LLVector3 mVelocityDir ;
- F32 mAverageSpeed ;
- F32 mAverageAngularSpeed ;
- mutable LLMatrix4 mProjectionMatrix; // Cache of perspective matrix
- mutable LLMatrix4 mModelviewMatrix;
- F32 mCameraFOVDefault;
- F32 mPrevCameraFOVDefault;
- F32 mCosHalfCameraFOV;
- LLVector3 mLastPointOfInterest;
- F32 mPixelMeterRatio; // Divide by distance from camera to get pixels per meter at that distance.
- S32 mScreenPixelArea; // Pixel area of entire window
- F32 mZoomFactor;
- S16 mZoomSubregion;
+ void calcProjection(const F32 far_distance) const;
+
+ static LLTrace::CountStatHandle<> sVelocityStat;
+ static LLTrace::CountStatHandle<> sAngularVelocityStat;
+
+ LLVector3 mVelocityDir ;
+ F32 mAverageSpeed ;
+ F32 mAverageAngularSpeed ;
+ mutable LLMatrix4 mProjectionMatrix; // Cache of perspective matrix
+ mutable LLMatrix4 mModelviewMatrix;
+ F32 mCameraFOVDefault;
+ F32 mPrevCameraFOVDefault;
+ F32 mCosHalfCameraFOV;
+ LLVector3 mLastPointOfInterest;
+ F32 mPixelMeterRatio; // Divide by distance from camera to get pixels per meter at that distance.
+ S32 mScreenPixelArea; // Pixel area of entire window
+ F32 mZoomFactor;
+ S16 mZoomSubregion;
public:
};
diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp
index 0d2d62fd77..597cf3c98c 100644
--- a/indra/newview/llviewerchat.cpp
+++ b/indra/newview/llviewerchat.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerchat.cpp
* @brief Builds menus out of items.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -28,7 +28,7 @@
#include "llviewerchat.h"
// newview includes
-#include "llagent.h" // gAgent
+#include "llagent.h" // gAgent
#include "llslurl.h"
#include "lluicolor.h"
#include "lluicolortable.h"
@@ -40,245 +40,245 @@
// LLViewerChat
LLViewerChat::font_change_signal_t LLViewerChat::sChatFontChangedSignal;
-//static
+//static
void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color)
{
- if(chat.mMuted)
- {
- r_color= LLUIColorTable::instance().getColor("LtGray");
- }
- else
- {
- switch(chat.mSourceType)
- {
- case CHAT_SOURCE_SYSTEM:
- r_color = LLUIColorTable::instance().getColor("SystemChatColor");
- break;
- case CHAT_SOURCE_AGENT:
- if (chat.mFromID.isNull() || SYSTEM_FROM == chat.mFromName)
- {
- r_color = LLUIColorTable::instance().getColor("SystemChatColor");
- }
- else
- {
- if(gAgentID == chat.mFromID)
- {
- r_color = LLUIColorTable::instance().getColor("UserChatColor");
- }
- else
- {
- r_color = LLUIColorTable::instance().getColor("AgentChatColor");
- }
- }
- break;
- case CHAT_SOURCE_OBJECT:
- if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
- {
- r_color = LLUIColorTable::instance().getColor("ScriptErrorColor");
- }
- else if ( chat.mChatType == CHAT_TYPE_OWNER )
- {
- r_color = LLUIColorTable::instance().getColor("llOwnerSayChatColor");
- }
- else if ( chat.mChatType == CHAT_TYPE_DIRECT )
- {
- r_color = LLUIColorTable::instance().getColor("DirectChatColor");
- }
- else
- {
- r_color = LLUIColorTable::instance().getColor("ObjectChatColor");
- }
- break;
- default:
- r_color.setToWhite();
- }
-
- if (!chat.mPosAgent.isExactlyZero())
- {
- LLVector3 pos_agent = gAgent.getPositionAgent();
- F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent);
- F32 dist_near_chat = gAgent.getNearChatRadius();
- if (distance_squared > dist_near_chat * dist_near_chat)
- {
- // diminish far-off chat
- r_color.mV[VALPHA] = 0.8f;
- }
- }
- }
+ if(chat.mMuted)
+ {
+ r_color= LLUIColorTable::instance().getColor("LtGray");
+ }
+ else
+ {
+ switch(chat.mSourceType)
+ {
+ case CHAT_SOURCE_SYSTEM:
+ r_color = LLUIColorTable::instance().getColor("SystemChatColor");
+ break;
+ case CHAT_SOURCE_AGENT:
+ if (chat.mFromID.isNull() || SYSTEM_FROM == chat.mFromName)
+ {
+ r_color = LLUIColorTable::instance().getColor("SystemChatColor");
+ }
+ else
+ {
+ if(gAgentID == chat.mFromID)
+ {
+ r_color = LLUIColorTable::instance().getColor("UserChatColor");
+ }
+ else
+ {
+ r_color = LLUIColorTable::instance().getColor("AgentChatColor");
+ }
+ }
+ break;
+ case CHAT_SOURCE_OBJECT:
+ if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
+ {
+ r_color = LLUIColorTable::instance().getColor("ScriptErrorColor");
+ }
+ else if ( chat.mChatType == CHAT_TYPE_OWNER )
+ {
+ r_color = LLUIColorTable::instance().getColor("llOwnerSayChatColor");
+ }
+ else if ( chat.mChatType == CHAT_TYPE_DIRECT )
+ {
+ r_color = LLUIColorTable::instance().getColor("DirectChatColor");
+ }
+ else
+ {
+ r_color = LLUIColorTable::instance().getColor("ObjectChatColor");
+ }
+ break;
+ default:
+ r_color.setToWhite();
+ }
+
+ if (!chat.mPosAgent.isExactlyZero())
+ {
+ LLVector3 pos_agent = gAgent.getPositionAgent();
+ F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent);
+ F32 dist_near_chat = gAgent.getNearChatRadius();
+ if (distance_squared > dist_near_chat * dist_near_chat)
+ {
+ // diminish far-off chat
+ r_color.mV[VALPHA] = 0.8f;
+ }
+ }
+ }
}
-//static
+//static
void LLViewerChat::getChatColor(const LLChat& chat, std::string& r_color_name, F32& r_color_alpha)
{
- if(chat.mMuted)
- {
- r_color_name = "LtGray";
- }
- else
- {
- switch(chat.mSourceType)
- {
- case CHAT_SOURCE_SYSTEM:
- r_color_name = "SystemChatColor";
- break;
-
- case CHAT_SOURCE_AGENT:
- if (chat.mFromID.isNull())
- {
- r_color_name = "SystemChatColor";
- }
- else
- {
- if(gAgentID == chat.mFromID)
- {
- r_color_name = "UserChatColor";
- }
- else
- {
- r_color_name = "AgentChatColor";
- }
- }
- break;
-
- case CHAT_SOURCE_OBJECT:
- if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
- {
- r_color_name = "ScriptErrorColor";
- }
- else if ( chat.mChatType == CHAT_TYPE_OWNER )
- {
- r_color_name = "llOwnerSayChatColor";
- }
- else if ( chat.mChatType == CHAT_TYPE_DIRECT )
- {
- r_color_name = "DirectChatColor";
- }
- else
- {
- r_color_name = "ObjectChatColor";
- }
- break;
- default:
- r_color_name = "White";
- }
-
- if (!chat.mPosAgent.isExactlyZero())
- {
- LLVector3 pos_agent = gAgent.getPositionAgent();
- F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent);
- F32 dist_near_chat = gAgent.getNearChatRadius();
- if (distance_squared > dist_near_chat * dist_near_chat)
- {
- // diminish far-off chat
- r_color_alpha = 0.8f;
- }
- else
- {
- r_color_alpha = 1.0f;
- }
- }
- }
-
+ if(chat.mMuted)
+ {
+ r_color_name = "LtGray";
+ }
+ else
+ {
+ switch(chat.mSourceType)
+ {
+ case CHAT_SOURCE_SYSTEM:
+ r_color_name = "SystemChatColor";
+ break;
+
+ case CHAT_SOURCE_AGENT:
+ if (chat.mFromID.isNull())
+ {
+ r_color_name = "SystemChatColor";
+ }
+ else
+ {
+ if(gAgentID == chat.mFromID)
+ {
+ r_color_name = "UserChatColor";
+ }
+ else
+ {
+ r_color_name = "AgentChatColor";
+ }
+ }
+ break;
+
+ case CHAT_SOURCE_OBJECT:
+ if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
+ {
+ r_color_name = "ScriptErrorColor";
+ }
+ else if ( chat.mChatType == CHAT_TYPE_OWNER )
+ {
+ r_color_name = "llOwnerSayChatColor";
+ }
+ else if ( chat.mChatType == CHAT_TYPE_DIRECT )
+ {
+ r_color_name = "DirectChatColor";
+ }
+ else
+ {
+ r_color_name = "ObjectChatColor";
+ }
+ break;
+ default:
+ r_color_name = "White";
+ }
+
+ if (!chat.mPosAgent.isExactlyZero())
+ {
+ LLVector3 pos_agent = gAgent.getPositionAgent();
+ F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent);
+ F32 dist_near_chat = gAgent.getNearChatRadius();
+ if (distance_squared > dist_near_chat * dist_near_chat)
+ {
+ // diminish far-off chat
+ r_color_alpha = 0.8f;
+ }
+ else
+ {
+ r_color_alpha = 1.0f;
+ }
+ }
+ }
+
}
-//static
+//static
LLFontGL* LLViewerChat::getChatFont()
{
- S32 font_size = gSavedSettings.getS32("ChatFontSize");
- LLFontGL* fontp = NULL;
- switch(font_size)
- {
- case 0:
- fontp = LLFontGL::getFontSansSerifSmall();
- break;
- default:
- case 1:
- fontp = LLFontGL::getFontSansSerif();
- break;
- case 2:
- fontp = LLFontGL::getFontSansSerifBig();
- break;
- }
-
- return fontp;
-
+ S32 font_size = gSavedSettings.getS32("ChatFontSize");
+ LLFontGL* fontp = NULL;
+ switch(font_size)
+ {
+ case 0:
+ fontp = LLFontGL::getFontSansSerifSmall();
+ break;
+ default:
+ case 1:
+ fontp = LLFontGL::getFontSansSerif();
+ break;
+ case 2:
+ fontp = LLFontGL::getFontSansSerifBig();
+ break;
+ }
+
+ return fontp;
+
}
//static
S32 LLViewerChat::getChatFontSize()
{
- return gSavedSettings.getS32("ChatFontSize");
+ return gSavedSettings.getS32("ChatFontSize");
}
//static
void LLViewerChat::formatChatMsg(const LLChat& chat, std::string& formated_msg)
{
- std::string tmpmsg = chat.mText;
-
- if(chat.mChatStyle == CHAT_STYLE_IRC)
- {
- formated_msg = chat.mFromName + tmpmsg.substr(3);
- }
- else
- {
- formated_msg = tmpmsg;
- }
+ std::string tmpmsg = chat.mText;
+
+ if(chat.mChatStyle == CHAT_STYLE_IRC)
+ {
+ formated_msg = chat.mFromName + tmpmsg.substr(3);
+ }
+ else
+ {
+ formated_msg = tmpmsg;
+ }
}
//static
std::string LLViewerChat::getSenderSLURL(const LLChat& chat, const LLSD& args)
{
- switch (chat.mSourceType)
- {
- case CHAT_SOURCE_AGENT:
- return LLSLURL("agent", chat.mFromID, "about").getSLURLString();
+ switch (chat.mSourceType)
+ {
+ case CHAT_SOURCE_AGENT:
+ return LLSLURL("agent", chat.mFromID, "about").getSLURLString();
- case CHAT_SOURCE_OBJECT:
- return getObjectImSLURL(chat, args);
+ case CHAT_SOURCE_OBJECT:
+ return getObjectImSLURL(chat, args);
- default:
- LL_WARNS() << "Getting SLURL for an unsupported sender type: " << chat.mSourceType << LL_ENDL;
- }
+ default:
+ LL_WARNS() << "Getting SLURL for an unsupported sender type: " << chat.mSourceType << LL_ENDL;
+ }
- return LLStringUtil::null;
+ return LLStringUtil::null;
}
//static
std::string LLViewerChat::getObjectImSLURL(const LLChat& chat, const LLSD& args)
{
- std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString();
- url += "?name=" + chat.mFromName;
- url += "&owner=" + chat.mOwnerID.asString();
+ std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString();
+ url += "?name=" + chat.mFromName;
+ url += "&owner=" + chat.mOwnerID.asString();
- std::string slurl = args["slurl"].asString();
- if (slurl.empty())
- {
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
- if(region)
- {
- LLSLURL region_slurl(region->getName(), chat.mPosAgent);
- slurl = region_slurl.getLocationString();
- }
- }
+ std::string slurl = args["slurl"].asString();
+ if (slurl.empty())
+ {
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
+ if(region)
+ {
+ LLSLURL region_slurl(region->getName(), chat.mPosAgent);
+ slurl = region_slurl.getLocationString();
+ }
+ }
- url += "&slurl=" + LLURI::escape(slurl);
+ url += "&slurl=" + LLURI::escape(slurl);
- return url;
+ return url;
}
-//static
+//static
boost::signals2::connection LLViewerChat::setFontChangedCallback(const font_change_signal_t::slot_type& cb)
{
- return sChatFontChangedSignal.connect(cb);
+ return sChatFontChangedSignal.connect(cb);
}
//static
void LLViewerChat::signalChatFontChanged()
{
- // Notify all observers that our font has changed
- sChatFontChangedSignal(getChatFont());
+ // Notify all observers that our font has changed
+ sChatFontChangedSignal(getChatFont());
}
diff --git a/indra/newview/llviewerchat.h b/indra/newview/llviewerchat.h
index c05caf0a95..a84d7dbc5d 100644
--- a/indra/newview/llviewerchat.h
+++ b/indra/newview/llviewerchat.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerchat.h
* @brief wrapper of LLChat in viewer
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,24 +32,24 @@
#include "v4color.h"
-class LLViewerChat
+class LLViewerChat
{
public:
- typedef boost::signals2::signal<void (LLFontGL*)> font_change_signal_t;
+ typedef boost::signals2::signal<void (LLFontGL*)> font_change_signal_t;
- static void getChatColor(const LLChat& chat, LLColor4& r_color);
- static void getChatColor(const LLChat& chat, std::string& r_color_name, F32& r_color_alpha);
- static LLFontGL* getChatFont();
- static S32 getChatFontSize();
- static void formatChatMsg(const LLChat& chat, std::string& formated_msg);
- static std::string getSenderSLURL(const LLChat& chat, const LLSD& args);
+ static void getChatColor(const LLChat& chat, LLColor4& r_color);
+ static void getChatColor(const LLChat& chat, std::string& r_color_name, F32& r_color_alpha);
+ static LLFontGL* getChatFont();
+ static S32 getChatFontSize();
+ static void formatChatMsg(const LLChat& chat, std::string& formated_msg);
+ static std::string getSenderSLURL(const LLChat& chat, const LLSD& args);
- static boost::signals2::connection setFontChangedCallback(const font_change_signal_t::slot_type& cb);
- static void signalChatFontChanged();
+ static boost::signals2::connection setFontChangedCallback(const font_change_signal_t::slot_type& cb);
+ static void signalChatFontChanged();
private:
- static std::string getObjectImSLURL(const LLChat& chat, const LLSD& args);
- static font_change_signal_t sChatFontChangedSignal;
+ static std::string getObjectImSLURL(const LLChat& chat, const LLSD& args);
+ static font_change_signal_t sChatFontChangedSignal;
};
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 7738cb904e..377110cd94 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewercontrol.cpp
* @brief Viewer configuration
* @author Richard Nelson
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@
#include "llviewercontrol.h"
// Library includes
-#include "llwindow.h" // getGamma()
+#include "llwindow.h" // getGamma()
// For Listeners
#include "llaudioengine.h"
@@ -80,15 +80,15 @@
#include <boost/algorithm/string.hpp>
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-BOOL gHackGodmode = FALSE;
+BOOL gHackGodmode = FALSE;
#endif
// Should you contemplate changing the name "Global", please first grep for
// that string literal. There are at least a couple other places in the C++
// code that assume the LLControlGroup named "Global" is gSavedSettings.
-LLControlGroup gSavedSettings("Global"); // saved at end of session
+LLControlGroup gSavedSettings("Global"); // saved at end of session
LLControlGroup gSavedPerAccountSettings("PerAccount"); // saved at end of session
-LLControlGroup gCrashSettings("CrashSettings"); // saved at end of session
+LLControlGroup gCrashSettings("CrashSettings"); // saved at end of session
LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warnings
std::string gLastRunVersion;
@@ -101,8 +101,8 @@ extern BOOL gDebugGL;
static bool handleRenderAvatarMouselookChanged(const LLSD& newvalue)
{
- LLVOAvatar::sVisibleInFirstPerson = newvalue.asBoolean();
- return true;
+ LLVOAvatar::sVisibleInFirstPerson = newvalue.asBoolean();
+ return true;
}
static bool handleRenderFarClipChanged(const LLSD& newvalue)
@@ -110,17 +110,17 @@ static bool handleRenderFarClipChanged(const LLSD& newvalue)
if (LLStartUp::getStartupState() >= STATE_STARTED)
{
F32 draw_distance = (F32)newvalue.asReal();
- gAgentCamera.mDrawDistance = draw_distance;
- LLWorld::getInstance()->setLandFarClip(draw_distance);
- return true;
+ gAgentCamera.mDrawDistance = draw_distance;
+ LLWorld::getInstance()->setLandFarClip(draw_distance);
+ return true;
}
return false;
}
static bool handleTerrainDetailChanged(const LLSD& newvalue)
{
- LLDrawPoolTerrain::sDetailMode = newvalue.asInteger();
- return true;
+ LLDrawPoolTerrain::sDetailMode = newvalue.asInteger();
+ return true;
}
@@ -133,19 +133,19 @@ static bool handleDebugAvatarJointsChanged(const LLSD& newvalue)
static bool handleAvatarHoverOffsetChanged(const LLSD& newvalue)
{
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->setHoverIfRegionEnabled();
- }
- return true;
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->setHoverIfRegionEnabled();
+ }
+ return true;
}
static bool handleSetShaderChanged(const LLSD& newvalue)
{
- // changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache
- gBumpImageList.destroyGL();
- gBumpImageList.restoreGL();
+ // changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache
+ gBumpImageList.destroyGL();
+ gBumpImageList.restoreGL();
if (gPipeline.isInit())
{
@@ -153,9 +153,9 @@ static bool handleSetShaderChanged(const LLSD& newvalue)
LLPipeline::refreshCachedSettings();
}
- // else, leave terrain detail as is
- LLViewerShaderMgr::instance()->setShaders();
- return true;
+ // else, leave terrain detail as is
+ LLViewerShaderMgr::instance()->setShaders();
+ return true;
}
static bool handleRenderPerfTestChanged(const LLSD& newvalue)
@@ -172,10 +172,10 @@ static bool handleRenderPerfTestChanged(const LLSD& newvalue)
LLPipeline::RENDER_TYPE_HUD,
LLPipeline::RENDER_TYPE_CLOUDS,
LLPipeline::RENDER_TYPE_HUD_PARTICLES,
- LLPipeline::END_RENDER_TYPES);
+ LLPipeline::END_RENDER_TYPES);
gPipeline.setRenderDebugFeatureControl(LLPipeline::RENDER_DEBUG_FEATURE_UI, false);
}
- else
+ else
{
gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_WL_SKY,
LLPipeline::RENDER_TYPE_TERRAIN,
@@ -195,55 +195,55 @@ static bool handleRenderPerfTestChanged(const LLSD& newvalue)
bool handleRenderTransparentWaterChanged(const LLSD& newvalue)
{
- if (gPipeline.isInit())
- {
- gPipeline.updateRenderTransparentWater();
- gPipeline.releaseGLBuffers();
- gPipeline.createGLBuffers();
- LLViewerShaderMgr::instance()->setShaders();
- }
- LLWorld::getInstance()->updateWaterObjects();
- return true;
+ if (gPipeline.isInit())
+ {
+ gPipeline.updateRenderTransparentWater();
+ gPipeline.releaseGLBuffers();
+ gPipeline.createGLBuffers();
+ LLViewerShaderMgr::instance()->setShaders();
+ }
+ LLWorld::getInstance()->updateWaterObjects();
+ return true;
}
static bool handleShadowsResized(const LLSD& newvalue)
{
- gPipeline.requestResizeShadowTexture();
- return true;
+ gPipeline.requestResizeShadowTexture();
+ return true;
}
static bool handleWindowResized(const LLSD& newvalue)
{
- gPipeline.requestResizeScreenTexture();
- return true;
+ gPipeline.requestResizeScreenTexture();
+ return true;
}
static bool handleReleaseGLBufferChanged(const LLSD& newvalue)
{
- if (gPipeline.isInit())
- {
- gPipeline.releaseGLBuffers();
- gPipeline.createGLBuffers();
- }
- return true;
+ if (gPipeline.isInit())
+ {
+ gPipeline.releaseGLBuffers();
+ gPipeline.createGLBuffers();
+ }
+ return true;
}
static bool handleLUTBufferChanged(const LLSD& newvalue)
{
- if (gPipeline.isInit())
- {
- gPipeline.releaseLUTBuffers();
- gPipeline.createLUTBuffers();
- }
- return true;
+ if (gPipeline.isInit())
+ {
+ gPipeline.releaseLUTBuffers();
+ gPipeline.createLUTBuffers();
+ }
+ return true;
}
static bool handleAnisotropicChanged(const LLSD& newvalue)
{
- LLImageGL::sGlobalUseAnisotropic = newvalue.asBoolean();
- LLImageGL::dirtyTexOptions();
- return true;
+ LLImageGL::sGlobalUseAnisotropic = newvalue.asBoolean();
+ LLImageGL::dirtyTexOptions();
+ return true;
}
static bool handleVSyncChanged(const LLSD& newvalue)
@@ -262,62 +262,62 @@ static bool handleVSyncChanged(const LLSD& newvalue)
static bool handleVolumeLODChanged(const LLSD& newvalue)
{
- LLVOVolume::sLODFactor = llclamp((F32) newvalue.asReal(), 0.01f, MAX_LOD_FACTOR);
- LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
- return true;
+ LLVOVolume::sLODFactor = llclamp((F32) newvalue.asReal(), 0.01f, MAX_LOD_FACTOR);
+ LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
+ return true;
}
static bool handleAvatarLODChanged(const LLSD& newvalue)
{
- LLVOAvatar::sLODFactor = llclamp((F32) newvalue.asReal(), 0.f, MAX_AVATAR_LOD_FACTOR);
- return true;
+ LLVOAvatar::sLODFactor = llclamp((F32) newvalue.asReal(), 0.f, MAX_AVATAR_LOD_FACTOR);
+ return true;
}
static bool handleAvatarPhysicsLODChanged(const LLSD& newvalue)
{
- LLVOAvatar::sPhysicsLODFactor = llclamp((F32) newvalue.asReal(), 0.f, MAX_AVATAR_LOD_FACTOR);
- return true;
+ LLVOAvatar::sPhysicsLODFactor = llclamp((F32) newvalue.asReal(), 0.f, MAX_AVATAR_LOD_FACTOR);
+ return true;
}
static bool handleTerrainLODChanged(const LLSD& newvalue)
{
- LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal();
- //sqaure lod factor to get exponential range of [0,4] and keep
- //a value of 1 in the middle of the detail slider for consistency
- //with other detail sliders (see panel_preferences_graphics1.xml)
- LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor;
- return true;
+ LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal();
+ //sqaure lod factor to get exponential range of [0,4] and keep
+ //a value of 1 in the middle of the detail slider for consistency
+ //with other detail sliders (see panel_preferences_graphics1.xml)
+ LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor;
+ return true;
}
static bool handleTreeLODChanged(const LLSD& newvalue)
{
- LLVOTree::sTreeFactor = (F32) newvalue.asReal();
- return true;
+ LLVOTree::sTreeFactor = (F32) newvalue.asReal();
+ return true;
}
static bool handleFlexLODChanged(const LLSD& newvalue)
{
- LLVolumeImplFlexible::sUpdateFactor = (F32) newvalue.asReal();
- return true;
+ LLVolumeImplFlexible::sUpdateFactor = (F32) newvalue.asReal();
+ return true;
}
static bool handleGammaChanged(const LLSD& newvalue)
{
- F32 gamma = (F32) newvalue.asReal();
- if (gamma == 0.0f)
- {
- gamma = 1.0f; // restore normal gamma
- }
- if (gViewerWindow && gViewerWindow->getWindow() && gamma != gViewerWindow->getWindow()->getGamma())
- {
- // Only save it if it's changed
- if (!gViewerWindow->getWindow()->setGamma(gamma))
- {
- LL_WARNS() << "setGamma failed!" << LL_ENDL;
- }
- }
+ F32 gamma = (F32) newvalue.asReal();
+ if (gamma == 0.0f)
+ {
+ gamma = 1.0f; // restore normal gamma
+ }
+ if (gViewerWindow && gViewerWindow->getWindow() && gamma != gViewerWindow->getWindow()->getGamma())
+ {
+ // Only save it if it's changed
+ if (!gViewerWindow->getWindow()->setGamma(gamma))
+ {
+ LL_WARNS() << "setGamma failed!" << LL_ENDL;
+ }
+ }
- return true;
+ return true;
}
const F32 MAX_USER_FOG_RATIO = 10.f;
@@ -325,93 +325,93 @@ const F32 MIN_USER_FOG_RATIO = 0.5f;
static bool handleFogRatioChanged(const LLSD& newvalue)
{
- F32 fog_ratio = llmax(MIN_USER_FOG_RATIO, llmin((F32) newvalue.asReal(), MAX_USER_FOG_RATIO));
- gSky.setFogRatio(fog_ratio);
- return true;
+ F32 fog_ratio = llmax(MIN_USER_FOG_RATIO, llmin((F32) newvalue.asReal(), MAX_USER_FOG_RATIO));
+ gSky.setFogRatio(fog_ratio);
+ return true;
}
static bool handleMaxPartCountChanged(const LLSD& newvalue)
{
- LLViewerPartSim::setMaxPartCount(newvalue.asInteger());
- return true;
+ LLViewerPartSim::setMaxPartCount(newvalue.asInteger());
+ return true;
}
static bool handleChatFontSizeChanged(const LLSD& newvalue)
{
- if(gConsole)
- {
- gConsole->setFontSize(newvalue.asInteger());
- }
- return true;
+ if(gConsole)
+ {
+ gConsole->setFontSize(newvalue.asInteger());
+ }
+ return true;
}
static bool handleChatPersistTimeChanged(const LLSD& newvalue)
{
- if(gConsole)
- {
- gConsole->setLinePersistTime((F32) newvalue.asReal());
- }
- return true;
+ if(gConsole)
+ {
+ gConsole->setLinePersistTime((F32) newvalue.asReal());
+ }
+ return true;
}
static bool handleConsoleMaxLinesChanged(const LLSD& newvalue)
{
- if(gConsole)
- {
- gConsole->setMaxLines(newvalue.asInteger());
- }
- return true;
+ if(gConsole)
+ {
+ gConsole->setMaxLines(newvalue.asInteger());
+ }
+ return true;
}
static void handleAudioVolumeChanged(const LLSD& newvalue)
{
- audio_update_volume(true);
+ audio_update_volume(true);
}
static bool handleJoystickChanged(const LLSD& newvalue)
{
- LLViewerJoystick::getInstance()->setCameraNeedsUpdate(TRUE);
- return true;
+ LLViewerJoystick::getInstance()->setCameraNeedsUpdate(TRUE);
+ return true;
}
static bool handleUseOcclusionChanged(const LLSD& newvalue)
{
- LLPipeline::sUseOcclusion = (newvalue.asBoolean()
- && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && !gUseWireframe) ? 2 : 0;
- return true;
+ LLPipeline::sUseOcclusion = (newvalue.asBoolean()
+ && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && !gUseWireframe) ? 2 : 0;
+ return true;
}
static bool handleUploadBakedTexOldChanged(const LLSD& newvalue)
{
- LLPipeline::sForceOldBakedUpload = newvalue.asBoolean();
- return true;
+ LLPipeline::sForceOldBakedUpload = newvalue.asBoolean();
+ return true;
}
static bool handleWLSkyDetailChanged(const LLSD&)
{
- if (gSky.mVOWLSkyp.notNull())
- {
- gSky.mVOWLSkyp->updateGeometry(gSky.mVOWLSkyp->mDrawable);
- }
- return true;
+ if (gSky.mVOWLSkyp.notNull())
+ {
+ gSky.mVOWLSkyp->updateGeometry(gSky.mVOWLSkyp->mDrawable);
+ }
+ return true;
}
static bool handleRepartition(const LLSD&)
{
- if (gPipeline.isInit())
- {
- gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");
- gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize");
- gObjectList.repartitionObjects();
- }
- return true;
+ if (gPipeline.isInit())
+ {
+ gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");
+ gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize");
+ gObjectList.repartitionObjects();
+ }
+ return true;
}
static bool handleRenderDynamicLODChanged(const LLSD& newvalue)
{
- LLPipeline::sDynamicLOD = newvalue.asBoolean();
- return true;
+ LLPipeline::sDynamicLOD = newvalue.asBoolean();
+ return true;
}
static bool handleReflectionProbeDetailChanged(const LLSD& newvalue)
@@ -429,161 +429,161 @@ static bool handleReflectionProbeDetailChanged(const LLSD& newvalue)
static bool handleRenderDebugPipelineChanged(const LLSD& newvalue)
{
- gDebugPipeline = newvalue.asBoolean();
- return true;
+ gDebugPipeline = newvalue.asBoolean();
+ return true;
}
static bool handleRenderResolutionDivisorChanged(const LLSD&)
{
- gResizeScreenTexture = TRUE;
- return true;
+ gResizeScreenTexture = TRUE;
+ return true;
}
static bool handleDebugViewsChanged(const LLSD& newvalue)
{
- LLView::sDebugRects = newvalue.asBoolean();
- return true;
+ LLView::sDebugRects = newvalue.asBoolean();
+ return true;
}
static bool handleLogFileChanged(const LLSD& newvalue)
{
- std::string log_filename = newvalue.asString();
- LLFile::remove(log_filename);
- LLError::logToFile(log_filename);
- return true;
+ std::string log_filename = newvalue.asString();
+ LLFile::remove(log_filename);
+ LLError::logToFile(log_filename);
+ return true;
}
bool handleHideGroupTitleChanged(const LLSD& newvalue)
{
- gAgent.setHideGroupTitle(newvalue);
- return true;
+ gAgent.setHideGroupTitle(newvalue);
+ return true;
}
bool handleEffectColorChanged(const LLSD& newvalue)
{
- gAgent.setEffectColor(LLColor4(newvalue));
- return true;
+ gAgent.setEffectColor(LLColor4(newvalue));
+ return true;
}
bool handleHighResSnapshotChanged(const LLSD& newvalue)
{
- // High Res Snapshot active, must uncheck RenderUIInSnapshot
- if (newvalue.asBoolean())
- {
- gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE );
- }
- return true;
+ // High Res Snapshot active, must uncheck RenderUIInSnapshot
+ if (newvalue.asBoolean())
+ {
+ gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE );
+ }
+ return true;
}
bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
{
- if (LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->updateSettings();
- }
- return true;
+ if (LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->updateSettings();
+ }
+ return true;
}
bool handleVelocityInterpolate(const LLSD& newvalue)
{
- LLMessageSystem* msg = gMessageSystem;
- if ( newvalue.asBoolean() )
- {
- msg->newMessageFast(_PREHASH_VelocityInterpolateOn);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gAgent.sendReliableMessage();
- LL_INFOS() << "Velocity Interpolation On" << LL_ENDL;
- }
- else
- {
- msg->newMessageFast(_PREHASH_VelocityInterpolateOff);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gAgent.sendReliableMessage();
- LL_INFOS() << "Velocity Interpolation Off" << LL_ENDL;
- }
- return true;
+ LLMessageSystem* msg = gMessageSystem;
+ if ( newvalue.asBoolean() )
+ {
+ msg->newMessageFast(_PREHASH_VelocityInterpolateOn);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gAgent.sendReliableMessage();
+ LL_INFOS() << "Velocity Interpolation On" << LL_ENDL;
+ }
+ else
+ {
+ msg->newMessageFast(_PREHASH_VelocityInterpolateOff);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gAgent.sendReliableMessage();
+ LL_INFOS() << "Velocity Interpolation Off" << LL_ENDL;
+ }
+ return true;
}
bool handleForceShowGrid(const LLSD& newvalue)
{
- LLPanelLogin::updateLocationSelectorsVisibility();
- return true;
+ LLPanelLogin::updateLocationSelectorsVisibility();
+ return true;
}
bool handleLoginLocationChanged()
{
- /*
- * This connects the default preference setting to the state of the login
- * panel if it is displayed; if you open the preferences panel before
- * logging in, and change the default login location there, the login
- * panel immediately changes to match your new preference.
- */
- std::string new_login_location = gSavedSettings.getString("LoginLocation");
- LL_DEBUGS("AppInit")<<new_login_location<<LL_ENDL;
- LLStartUp::setStartSLURL(LLSLURL(new_login_location));
- return true;
+ /*
+ * This connects the default preference setting to the state of the login
+ * panel if it is displayed; if you open the preferences panel before
+ * logging in, and change the default login location there, the login
+ * panel immediately changes to match your new preference.
+ */
+ std::string new_login_location = gSavedSettings.getString("LoginLocation");
+ LL_DEBUGS("AppInit")<<new_login_location<<LL_ENDL;
+ LLStartUp::setStartSLURL(LLSLURL(new_login_location));
+ return true;
}
bool handleSpellCheckChanged()
{
- if (gSavedSettings.getBOOL("SpellCheck"))
- {
- std::list<std::string> dict_list;
- std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary");
- boost::split(dict_list, dict_setting, boost::is_any_of(std::string(",")));
- if (!dict_list.empty())
- {
- LLSpellChecker::setUseSpellCheck(dict_list.front());
- dict_list.pop_front();
- LLSpellChecker::instance().setSecondaryDictionaries(dict_list);
- return true;
- }
- }
- LLSpellChecker::setUseSpellCheck(LLStringUtil::null);
- return true;
+ if (gSavedSettings.getBOOL("SpellCheck"))
+ {
+ std::list<std::string> dict_list;
+ std::string dict_setting = gSavedSettings.getString("SpellCheckDictionary");
+ boost::split(dict_list, dict_setting, boost::is_any_of(std::string(",")));
+ if (!dict_list.empty())
+ {
+ LLSpellChecker::setUseSpellCheck(dict_list.front());
+ dict_list.pop_front();
+ LLSpellChecker::instance().setSecondaryDictionaries(dict_list);
+ return true;
+ }
+ }
+ LLSpellChecker::setUseSpellCheck(LLStringUtil::null);
+ return true;
}
bool toggle_agent_pause(const LLSD& newvalue)
{
- if ( newvalue.asBoolean() )
- {
- send_agent_pause();
- }
- else
- {
- send_agent_resume();
- }
- return true;
+ if ( newvalue.asBoolean() )
+ {
+ send_agent_pause();
+ }
+ else
+ {
+ send_agent_resume();
+ }
+ return true;
}
bool toggle_show_navigation_panel(const LLSD& newvalue)
{
- bool value = newvalue.asBoolean();
+ bool value = newvalue.asBoolean();
- LLNavigationBar::getInstance()->setVisible(value);
- gSavedSettings.setBOOL("ShowMiniLocationPanel", !value);
+ LLNavigationBar::getInstance()->setVisible(value);
+ gSavedSettings.setBOOL("ShowMiniLocationPanel", !value);
gViewerWindow->reshapeStatusBarContainer();
- return true;
+ return true;
}
bool toggle_show_mini_location_panel(const LLSD& newvalue)
{
- bool value = newvalue.asBoolean();
+ bool value = newvalue.asBoolean();
- LLPanelTopInfoBar::getInstance()->setVisible(value);
- gSavedSettings.setBOOL("ShowNavbarNavigationPanel", !value);
+ LLPanelTopInfoBar::getInstance()->setVisible(value);
+ gSavedSettings.setBOOL("ShowNavbarNavigationPanel", !value);
- return true;
+ return true;
}
bool toggle_show_object_render_cost(const LLSD& newvalue)
{
- LLFloaterTools::sShowObjectCost = newvalue.asBoolean();
- return true;
+ LLFloaterTools::sShowObjectCost = newvalue.asBoolean();
+ return true;
}
void handleTargetFPSChanged(const LLSD& newValue)
@@ -716,7 +716,7 @@ void settings_setup_listeners()
setting_setup_signal_listener(gSavedSettings, "RenderFogRatio", handleFogRatioChanged);
setting_setup_signal_listener(gSavedSettings, "RenderMaxPartCount", handleMaxPartCountChanged);
setting_setup_signal_listener(gSavedSettings, "RenderDynamicLOD", handleRenderDynamicLODChanged);
- setting_setup_signal_listener(gSavedSettings, "RenderVSyncEnable", handleVSyncChanged);
+ setting_setup_signal_listener(gSavedSettings, "RenderVSyncEnable", handleVSyncChanged);
setting_setup_signal_listener(gSavedSettings, "RenderDeferredNoise", handleReleaseGLBufferChanged);
setting_setup_signal_listener(gSavedSettings, "RenderDebugPipeline", handleRenderDebugPipelineChanged);
setting_setup_signal_listener(gSavedSettings, "RenderResolutionDivisor", handleRenderResolutionDivisorChanged);
@@ -806,7 +806,7 @@ void settings_setup_listeners()
setting_setup_signal_listener(gSavedSettings, "VoiceInputAudioDevice", handleVoiceClientPrefsChanged);
setting_setup_signal_listener(gSavedSettings, "VoiceOutputAudioDevice", handleVoiceClientPrefsChanged);
setting_setup_signal_listener(gSavedSettings, "AudioLevelMic", handleVoiceClientPrefsChanged);
- setting_setup_signal_listener(gSavedSettings, "LipSyncEnabled", handleVoiceClientPrefsChanged);
+ setting_setup_signal_listener(gSavedSettings, "LipSyncEnabled", handleVoiceClientPrefsChanged);
setting_setup_signal_listener(gSavedSettings, "VelocityInterpolate", handleVelocityInterpolate);
setting_setup_signal_listener(gSavedSettings, "QAMode", show_debug_menus);
setting_setup_signal_listener(gSavedSettings, "UseDebugMenus", show_debug_menus);
@@ -858,21 +858,21 @@ static LLCachedControl<std::string> test_BrowserHomePage("BrowserHomePage", "hah
void test_cached_control()
{
#define do { TEST_LLCC(T, V) if((T)mySetting_##T != V) LL_ERRS() << "Fail "#T << LL_ENDL; } while(0)
- TEST_LLCC(U32, 666);
- TEST_LLCC(S32, (S32)-666);
- TEST_LLCC(F32, (F32)-666.666);
- TEST_LLCC(bool, true);
- TEST_LLCC(BOOL, FALSE);
- if((std::string)mySetting_string != "Default String Value") LL_ERRS() << "Fail string" << LL_ENDL;
- TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
- TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));
- TEST_LLCC(LLRect, LLRect(0, 0, 100, 500));
- TEST_LLCC(LLColor4, LLColor4(0.0f, 0.5f, 1.0f));
- TEST_LLCC(LLColor3, LLColor3(1.0f, 0.f, 0.5f));
- TEST_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255));
-//There's no LLSD comparsion for LLCC yet. TEST_LLCC(LLSD, test_llsd);
-
- if((std::string)test_BrowserHomePage != "http://www.secondlife.com") LL_ERRS() << "Fail BrowserHomePage" << LL_ENDL;
+ TEST_LLCC(U32, 666);
+ TEST_LLCC(S32, (S32)-666);
+ TEST_LLCC(F32, (F32)-666.666);
+ TEST_LLCC(bool, true);
+ TEST_LLCC(BOOL, FALSE);
+ if((std::string)mySetting_string != "Default String Value") LL_ERRS() << "Fail string" << LL_ENDL;
+ TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
+ TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));
+ TEST_LLCC(LLRect, LLRect(0, 0, 100, 500));
+ TEST_LLCC(LLColor4, LLColor4(0.0f, 0.5f, 1.0f));
+ TEST_LLCC(LLColor3, LLColor3(1.0f, 0.f, 0.5f));
+ TEST_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255));
+//There's no LLSD comparsion for LLCC yet. TEST_LLCC(LLSD, test_llsd);
+
+ if((std::string)test_BrowserHomePage != "http://www.secondlife.com") LL_ERRS() << "Fail BrowserHomePage" << LL_ENDL;
}
#endif // TEST_CACHED_CONTROL
diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h
index d7191f5c8d..d1ee932cc6 100644
--- a/indra/newview/llviewercontrol.h
+++ b/indra/newview/llviewercontrol.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewercontrol.h
* @brief references to viewer-specific control files
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,7 +32,7 @@
// Enabled this definition to compile a 'hacked' viewer that
// allows a hacked godmode to be toggled on and off.
-#define TOGGLE_HACKED_GODLIKE_VIEWER
+#define TOGGLE_HACKED_GODLIKE_VIEWER
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
extern BOOL gHackGodmode;
#endif
diff --git a/indra/newview/llviewercontrollistener.cpp b/indra/newview/llviewercontrollistener.cpp
index 8820f9ec56..6f77e21fcc 100644
--- a/indra/newview/llviewercontrollistener.cpp
+++ b/indra/newview/llviewercontrollistener.cpp
@@ -3,25 +3,25 @@
* @author Brad Kittenbrink
* @date 2009-07-09
* @brief Implementation for llviewercontrollistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,179 +44,179 @@ LLViewerControlListener sSavedSettingsListener;
} // unnamed namespace
LLViewerControlListener::LLViewerControlListener()
- : LLEventAPI("LLViewerControl",
- "LLViewerControl listener: set, toggle or set default for various controls")
+ : LLEventAPI("LLViewerControl",
+ "LLViewerControl listener: set, toggle or set default for various controls")
{
- std::ostringstream groupnames;
- groupnames << "[\"group\"] is one of ";
- const char* delim = "";
- for (const auto& key : LLControlGroup::key_snapshot())
- {
- groupnames << delim << '"' << key << '"';
- delim = ", ";
- }
- groupnames << '\n';
- std::string grouphelp(groupnames.str());
- std::string replyhelp("If [\"reply\"] requested, send new [\"value\"] on specified LLEventPump\n");
-
- add("set",
- std::string("Set [\"group\"] control [\"key\"] to optional value [\"value\"]\n"
- "If [\"value\"] omitted, set to control's defined default value\n") +
- grouphelp + replyhelp,
- &LLViewerControlListener::set,
- LLSDMap("group", LLSD())("key", LLSD()));
- add("toggle",
- std::string("Toggle [\"group\"] control [\"key\"], if boolean\n") + grouphelp + replyhelp,
- &LLViewerControlListener::toggle,
- LLSDMap("group", LLSD())("key", LLSD()));
- add("get",
- std::string("Query [\"group\"] control [\"key\"], replying on LLEventPump [\"reply\"]\n") +
- grouphelp,
- &LLViewerControlListener::get,
- LLSDMap("group", LLSD())("key", LLSD())("reply", LLSD()));
- add("groups",
- "Send on LLEventPump [\"reply\"] an array [\"groups\"] of valid group names",
- &LLViewerControlListener::groups,
- LLSDMap("reply", LLSD()));
- add("vars",
- std::string("For [\"group\"], send on LLEventPump [\"reply\"] an array [\"vars\"],\n"
- "each of whose entries looks like:\n"
- " [\"name\"], [\"type\"], [\"value\"], [\"comment\"]\n") + grouphelp,
- &LLViewerControlListener::vars,
- LLSDMap("group", LLSD())("reply", LLSD()));
+ std::ostringstream groupnames;
+ groupnames << "[\"group\"] is one of ";
+ const char* delim = "";
+ for (const auto& key : LLControlGroup::key_snapshot())
+ {
+ groupnames << delim << '"' << key << '"';
+ delim = ", ";
+ }
+ groupnames << '\n';
+ std::string grouphelp(groupnames.str());
+ std::string replyhelp("If [\"reply\"] requested, send new [\"value\"] on specified LLEventPump\n");
+
+ add("set",
+ std::string("Set [\"group\"] control [\"key\"] to optional value [\"value\"]\n"
+ "If [\"value\"] omitted, set to control's defined default value\n") +
+ grouphelp + replyhelp,
+ &LLViewerControlListener::set,
+ LLSDMap("group", LLSD())("key", LLSD()));
+ add("toggle",
+ std::string("Toggle [\"group\"] control [\"key\"], if boolean\n") + grouphelp + replyhelp,
+ &LLViewerControlListener::toggle,
+ LLSDMap("group", LLSD())("key", LLSD()));
+ add("get",
+ std::string("Query [\"group\"] control [\"key\"], replying on LLEventPump [\"reply\"]\n") +
+ grouphelp,
+ &LLViewerControlListener::get,
+ LLSDMap("group", LLSD())("key", LLSD())("reply", LLSD()));
+ add("groups",
+ "Send on LLEventPump [\"reply\"] an array [\"groups\"] of valid group names",
+ &LLViewerControlListener::groups,
+ LLSDMap("reply", LLSD()));
+ add("vars",
+ std::string("For [\"group\"], send on LLEventPump [\"reply\"] an array [\"vars\"],\n"
+ "each of whose entries looks like:\n"
+ " [\"name\"], [\"type\"], [\"value\"], [\"comment\"]\n") + grouphelp,
+ &LLViewerControlListener::vars,
+ LLSDMap("group", LLSD())("reply", LLSD()));
}
struct Info
{
- Info(const LLSD& request):
- response(LLSD(), request),
- groupname(request["group"]),
- group(LLControlGroup::getInstance(groupname)),
- key(request["key"]),
- control(NULL)
- {
- if (! group)
- {
- response.error(STRINGIZE("Unrecognized group '" << groupname << "'"));
- return;
- }
-
- control = group->getControl(key);
- if (! control)
- {
- response.error(STRINGIZE("In group '" << groupname
- << "', unrecognized control key '" << key << "'"));
- }
- }
-
- ~Info()
- {
- // If in fact the request passed to our constructor names a valid
- // group and key, grab the final value of the indicated control and
- // stuff it in our response. Since this outer destructor runs before
- // the contained Response destructor, this data will go into the
- // response we send.
- if (control)
- {
- response["name"] = control->getName();
- response["type"] = LLControlGroup::typeEnumToString(control->type());
- response["value"] = control->get();
- response["comment"] = control->getComment();
- }
- }
-
- LLEventAPI::Response response;
- std::string groupname;
- LLControlGroup::ptr_t group;
- std::string key;
- LLControlVariable* control;
+ Info(const LLSD& request):
+ response(LLSD(), request),
+ groupname(request["group"]),
+ group(LLControlGroup::getInstance(groupname)),
+ key(request["key"]),
+ control(NULL)
+ {
+ if (! group)
+ {
+ response.error(STRINGIZE("Unrecognized group '" << groupname << "'"));
+ return;
+ }
+
+ control = group->getControl(key);
+ if (! control)
+ {
+ response.error(STRINGIZE("In group '" << groupname
+ << "', unrecognized control key '" << key << "'"));
+ }
+ }
+
+ ~Info()
+ {
+ // If in fact the request passed to our constructor names a valid
+ // group and key, grab the final value of the indicated control and
+ // stuff it in our response. Since this outer destructor runs before
+ // the contained Response destructor, this data will go into the
+ // response we send.
+ if (control)
+ {
+ response["name"] = control->getName();
+ response["type"] = LLControlGroup::typeEnumToString(control->type());
+ response["value"] = control->get();
+ response["comment"] = control->getComment();
+ }
+ }
+
+ LLEventAPI::Response response;
+ std::string groupname;
+ LLControlGroup::ptr_t group;
+ std::string key;
+ LLControlVariable* control;
};
//static
void LLViewerControlListener::set(LLSD const & request)
{
- Info info(request);
- if (! info.control)
- return;
-
- if (request.has("value"))
- {
- info.control->setValue(request["value"]);
- }
- else
- {
- info.control->resetToDefault();
- }
+ Info info(request);
+ if (! info.control)
+ return;
+
+ if (request.has("value"))
+ {
+ info.control->setValue(request["value"]);
+ }
+ else
+ {
+ info.control->resetToDefault();
+ }
}
//static
void LLViewerControlListener::toggle(LLSD const & request)
{
- Info info(request);
- if (! info.control)
- return;
-
- if (info.control->isType(TYPE_BOOLEAN))
- {
- info.control->set(! info.control->get().asBoolean());
- }
- else
- {
- info.response.error(STRINGIZE("toggle of non-boolean '" << info.groupname
- << "' control '" << info.key
- << "', type is "
- << LLControlGroup::typeEnumToString(info.control->type())));
- }
+ Info info(request);
+ if (! info.control)
+ return;
+
+ if (info.control->isType(TYPE_BOOLEAN))
+ {
+ info.control->set(! info.control->get().asBoolean());
+ }
+ else
+ {
+ info.response.error(STRINGIZE("toggle of non-boolean '" << info.groupname
+ << "' control '" << info.key
+ << "', type is "
+ << LLControlGroup::typeEnumToString(info.control->type())));
+ }
}
void LLViewerControlListener::get(LLSD const & request)
{
- // The Info constructor and destructor actually do all the work here.
- Info info(request);
+ // The Info constructor and destructor actually do all the work here.
+ Info info(request);
}
void LLViewerControlListener::groups(LLSD const & request)
{
- // No Info, we're not looking up either a group or a control name.
- Response response(LLSD(), request);
- for (const auto& key : LLControlGroup::key_snapshot())
- {
- response["groups"].append(key);
- }
+ // No Info, we're not looking up either a group or a control name.
+ Response response(LLSD(), request);
+ for (const auto& key : LLControlGroup::key_snapshot())
+ {
+ response["groups"].append(key);
+ }
}
struct CollectVars: public LLControlGroup::ApplyFunctor
{
- CollectVars(LLControlGroup::ptr_t g):
- mGroup(g)
- {}
-
- virtual void apply(const std::string& name, LLControlVariable* control)
- {
- vars.append(LLSDMap
- ("name", name)
- ("type", LLControlGroup::typeEnumToString(control->type()))
- ("value", control->get())
- ("comment", control->getComment()));
- }
-
- LLControlGroup::ptr_t mGroup;
- LLSD vars;
+ CollectVars(LLControlGroup::ptr_t g):
+ mGroup(g)
+ {}
+
+ virtual void apply(const std::string& name, LLControlVariable* control)
+ {
+ vars.append(LLSDMap
+ ("name", name)
+ ("type", LLControlGroup::typeEnumToString(control->type()))
+ ("value", control->get())
+ ("comment", control->getComment()));
+ }
+
+ LLControlGroup::ptr_t mGroup;
+ LLSD vars;
};
void LLViewerControlListener::vars(LLSD const & request)
{
- // This method doesn't use Info, because we're not looking up a specific
- // control name.
- Response response(LLSD(), request);
- std::string groupname(request["group"]);
- auto group(LLControlGroup::getInstance(groupname));
- if (! group)
- {
- return response.error(STRINGIZE("Unrecognized group '" << groupname << "'"));
- }
-
- CollectVars collector(group);
- group->applyToAll(&collector);
- response["vars"] = collector.vars;
+ // This method doesn't use Info, because we're not looking up a specific
+ // control name.
+ Response response(LLSD(), request);
+ std::string groupname(request["group"]);
+ auto group(LLControlGroup::getInstance(groupname));
+ if (! group)
+ {
+ return response.error(STRINGIZE("Unrecognized group '" << groupname << "'"));
+ }
+
+ CollectVars collector(group);
+ group->applyToAll(&collector);
+ response["vars"] = collector.vars;
}
diff --git a/indra/newview/llviewercontrollistener.h b/indra/newview/llviewercontrollistener.h
index 2e72046924..346acac439 100644
--- a/indra/newview/llviewercontrollistener.h
+++ b/indra/newview/llviewercontrollistener.h
@@ -3,25 +3,25 @@
* @author Brad Kittenbrink
* @date 2009-07-09
* @brief Event API for subset of LLViewerControl methods
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,14 +37,14 @@ class LLSD;
class LLViewerControlListener : public LLEventAPI
{
public:
- LLViewerControlListener();
+ LLViewerControlListener();
private:
- static void set(LLSD const & event_data);
- static void toggle(LLSD const & event_data);
- static void get(LLSD const & event_data);
- static void groups(LLSD const & event_data);
- static void vars(LLSD const & event_data);
+ static void set(LLSD const & event_data);
+ static void toggle(LLSD const & event_data);
+ static void get(LLSD const & event_data);
+ static void groups(LLSD const & event_data);
+ static void vars(LLSD const & event_data);
};
#endif // LL_LLVIEWERCONTROLLISTENER_H
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index e1d6f71cce..f1538d0abc 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerdisplay.cpp
* @brief LLViewerDisplay class implementation
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -87,10 +87,10 @@ extern bool gShiftFrame;
LLPointer<LLViewerTexture> gDisconnectedImagep = NULL;
// used to toggle renderer back on after teleport
-BOOL gTeleportDisplay = FALSE;
+BOOL gTeleportDisplay = FALSE;
LLFrameTimer gTeleportDisplayTimer;
LLFrameTimer gTeleportArrivalTimer;
-const F32 RESTORE_GL_TIME = 5.f; // Wait this long while reloading textures before we raise the curtain
+const F32 RESTORE_GL_TIME = 5.f; // Wait this long while reloading textures before we raise the curtain
BOOL gForceRenderLandFence = FALSE;
BOOL gDisplaySwapBuffers = FALSE;
@@ -125,84 +125,84 @@ void render_disconnected_background();
void display_startup()
{
- if ( !gViewerWindow
- || !gViewerWindow->getActive()
- || !gViewerWindow->getWindow()->getVisible()
- || gViewerWindow->getWindow()->getMinimized()
- || gNonInteractive)
- {
- return;
- }
-
- gPipeline.updateGL();
-
- // Written as branch to appease GCC which doesn't like different
- // pointer types across ternary ops
- //
- if (!LLViewerFetchedTexture::sWhiteImagep.isNull())
- {
- LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
- }
-
- LLGLSDefault gls_default;
-
- // Required for HTML update in login screen
- static S32 frame_count = 0;
-
- LLGLState::checkStates();
-
- if (frame_count++ > 1) // make sure we have rendered a frame first
- {
- LLViewerDynamicTexture::updateAllInstances();
- }
+ if ( !gViewerWindow
+ || !gViewerWindow->getActive()
+ || !gViewerWindow->getWindow()->getVisible()
+ || gViewerWindow->getWindow()->getMinimized()
+ || gNonInteractive)
+ {
+ return;
+ }
+
+ gPipeline.updateGL();
+
+ // Written as branch to appease GCC which doesn't like different
+ // pointer types across ternary ops
+ //
+ if (!LLViewerFetchedTexture::sWhiteImagep.isNull())
+ {
+ LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
+ }
+
+ LLGLSDefault gls_default;
+
+ // Required for HTML update in login screen
+ static S32 frame_count = 0;
+
+ LLGLState::checkStates();
+
+ if (frame_count++ > 1) // make sure we have rendered a frame first
+ {
+ LLViewerDynamicTexture::updateAllInstances();
+ }
else
{
LL_DEBUGS("Window") << "First display_startup frame" << LL_ENDL;
}
- LLGLState::checkStates();
+ LLGLState::checkStates();
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT);
- LLGLSUIDefault gls_ui;
- gPipeline.disableLights();
+ LLGLSUIDefault gls_ui;
+ gPipeline.disableLights();
- if (gViewerWindow)
- gViewerWindow->setup2DRender();
- if (gViewerWindow)
- gViewerWindow->draw();
- gGL.flush();
+ if (gViewerWindow)
+ gViewerWindow->setup2DRender();
+ if (gViewerWindow)
+ gViewerWindow->draw();
+ gGL.flush();
- LLVertexBuffer::unbind();
+ LLVertexBuffer::unbind();
- LLGLState::checkStates();
+ LLGLState::checkStates();
- if (gViewerWindow && gViewerWindow->getWindow())
- gViewerWindow->getWindow()->swapBuffers();
+ if (gViewerWindow && gViewerWindow->getWindow())
+ gViewerWindow->getWindow()->swapBuffers();
- glClear(GL_DEPTH_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT);
}
void display_update_camera()
{
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Update Camera");
- // TODO: cut draw distance down if customizing avatar?
- // TODO: cut draw distance on per-parcel basis?
+ // TODO: cut draw distance down if customizing avatar?
+ // TODO: cut draw distance on per-parcel basis?
- // Cut draw distance in half when customizing avatar,
- // but on the viewer only.
- F32 final_far = gAgentCamera.mDrawDistance;
+ // Cut draw distance in half when customizing avatar,
+ // but on the viewer only.
+ F32 final_far = gAgentCamera.mDrawDistance;
if (gCubeSnapshot)
{
final_far = gSavedSettings.getF32("RenderReflectionProbeDrawDistance");
}
else if (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode())
-
- {
- final_far *= 0.5f;
- }
- LLViewerCamera::getInstance()->setFar(final_far);
- gViewerWindow->setup3DRender();
-
+
+ {
+ final_far *= 0.5f;
+ }
+ LLViewerCamera::getInstance()->setFar(final_far);
+ gViewerWindow->setup3DRender();
+
if (!gCubeSnapshot)
{
// Update land visibility too
@@ -213,30 +213,30 @@ void display_update_camera()
// Write some stats to LL_INFOS()
void display_stats()
{
- LL_PROFILE_ZONE_SCOPED
- F32 fps_log_freq = gSavedSettings.getF32("FPSLogFrequency");
- if (fps_log_freq > 0.f && gRecentFPSTime.getElapsedTimeF32() >= fps_log_freq)
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - FPS");
- F32 fps = gRecentFrameCount / fps_log_freq;
- LL_INFOS() << llformat("FPS: %.02f", fps) << LL_ENDL;
- gRecentFrameCount = 0;
- gRecentFPSTime.reset();
- }
- F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency");
- if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq)
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - Memory");
- gMemoryAllocated = U64Bytes(LLMemory::getCurrentRSS());
- U32Megabytes memory = gMemoryAllocated;
- LL_INFOS() << "MEMORY: " << memory << LL_ENDL;
- LLMemory::logMemoryInfo(TRUE) ;
- gRecentMemoryTime.reset();
- }
+ LL_PROFILE_ZONE_SCOPED
+ F32 fps_log_freq = gSavedSettings.getF32("FPSLogFrequency");
+ if (fps_log_freq > 0.f && gRecentFPSTime.getElapsedTimeF32() >= fps_log_freq)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - FPS");
+ F32 fps = gRecentFrameCount / fps_log_freq;
+ LL_INFOS() << llformat("FPS: %.02f", fps) << LL_ENDL;
+ gRecentFrameCount = 0;
+ gRecentFPSTime.reset();
+ }
+ F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency");
+ if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - Memory");
+ gMemoryAllocated = U64Bytes(LLMemory::getCurrentRSS());
+ U32Megabytes memory = gMemoryAllocated;
+ LL_INFOS() << "MEMORY: " << memory << LL_ENDL;
+ LLMemory::logMemoryInfo(TRUE) ;
+ gRecentMemoryTime.reset();
+ }
F32 asset_storage_log_freq = gSavedSettings.getF32("AssetStorageLogFrequency");
if (asset_storage_log_freq > 0.f && gAssetStorageLogTime.getElapsedTimeF32() >= asset_storage_log_freq)
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - Asset Storage");
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - Asset Storage");
gAssetStorageLogTime.reset();
gAssetStorage->logAssetStorageInfo();
}
@@ -244,144 +244,144 @@ void display_stats()
static void update_tp_display(bool minimized)
{
- static LLCachedControl<F32> teleport_arrival_delay(gSavedSettings, "TeleportArrivalDelay");
- static LLCachedControl<F32> teleport_local_delay(gSavedSettings, "TeleportLocalDelay");
-
- S32 attach_count = 0;
- if (isAgentAvatarValid())
- {
- attach_count = gAgentAvatarp->getAttachmentCount();
- }
- F32 teleport_save_time = TELEPORT_EXPIRY + TELEPORT_EXPIRY_PER_ATTACHMENT * attach_count;
- F32 teleport_elapsed = gTeleportDisplayTimer.getElapsedTimeF32();
- F32 teleport_percent = teleport_elapsed * (100.f / teleport_save_time);
- if (gAgent.getTeleportState() != LLAgent::TELEPORT_START && teleport_percent > 100.f)
- {
- // Give up. Don't keep the UI locked forever.
- LL_WARNS("Teleport") << "Giving up on teleport. elapsed time " << teleport_elapsed << " exceeds max time " << teleport_save_time << LL_ENDL;
- gAgent.setTeleportState(LLAgent::TELEPORT_NONE);
- gAgent.setTeleportMessage(std::string());
- }
-
- // Make sure the TP progress panel gets hidden in case the viewer window
- // is minimized *during* a TP. HB
- if (minimized)
- {
- gViewerWindow->setShowProgress(FALSE);
- }
-
- const std::string& message = gAgent.getTeleportMessage();
- switch (gAgent.getTeleportState())
- {
- case LLAgent::TELEPORT_PENDING:
- {
- gTeleportDisplayTimer.reset();
- const std::string& msg = LLAgent::sTeleportProgressMessages["pending"];
- if (!minimized)
- {
- gViewerWindow->setShowProgress(TRUE);
- gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f));
- gViewerWindow->setProgressString(msg);
- }
- gAgent.setTeleportMessage(msg);
- break;
- }
-
- case LLAgent::TELEPORT_START:
- {
- // Transition to REQUESTED. Viewer has sent some kind
- // of TeleportRequest to the source simulator
- gTeleportDisplayTimer.reset();
- const std::string& msg = LLAgent::sTeleportProgressMessages["requesting"];
- LL_INFOS("Teleport") << "A teleport request has been sent, setting state to TELEPORT_REQUESTED" << LL_ENDL;
- gAgent.setTeleportState(LLAgent::TELEPORT_REQUESTED);
- gAgent.setTeleportMessage(msg);
- if (!minimized)
- {
- gViewerWindow->setShowProgress(TRUE);
- gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f));
- gViewerWindow->setProgressString(msg);
- gViewerWindow->setProgressMessage(gAgent.mMOTD);
- }
- break;
- }
-
- case LLAgent::TELEPORT_REQUESTED:
- // Waiting for source simulator to respond
- if (!minimized)
- {
- gViewerWindow->setProgressPercent(llmin(teleport_percent, 37.5f));
- gViewerWindow->setProgressString(message);
- }
- break;
-
- case LLAgent::TELEPORT_MOVING:
- // Viewer has received destination location from source simulator
- if (!minimized)
- {
- gViewerWindow->setProgressPercent(llmin(teleport_percent, 75.f));
- gViewerWindow->setProgressString(message);
- }
- break;
-
- case LLAgent::TELEPORT_START_ARRIVAL:
- // Transition to ARRIVING. Viewer has received avatar update, etc.,
- // from destination simulator
- gTeleportArrivalTimer.reset();
- LL_INFOS("Teleport") << "Changing state to TELEPORT_ARRIVING" << LL_ENDL;
- gAgent.setTeleportState(LLAgent::TELEPORT_ARRIVING);
- gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["arriving"]);
- gAgent.sheduleTeleportIM();
- gTextureList.mForceResetTextureStats = TRUE;
- gAgentCamera.resetView(TRUE, TRUE);
- if (!minimized)
- {
- gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel"));
- gViewerWindow->setProgressPercent(75.f);
- }
- break;
-
- case LLAgent::TELEPORT_ARRIVING:
- // Make the user wait while content "pre-caches"
- {
- F32 arrival_fraction = (gTeleportArrivalTimer.getElapsedTimeF32() / teleport_arrival_delay());
- if (arrival_fraction > 1.f)
- {
- arrival_fraction = 1.f;
- //LLFirstUse::useTeleport();
- LL_INFOS("Teleport") << "arrival_fraction is " << arrival_fraction << " changing state to TELEPORT_NONE" << LL_ENDL;
- gAgent.setTeleportState(LLAgent::TELEPORT_NONE);
- }
- if (!minimized)
- {
- gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel"));
- gViewerWindow->setProgressPercent(arrival_fraction * 25.f + 75.f);
- gViewerWindow->setProgressString(message);
- }
- break;
- }
-
- case LLAgent::TELEPORT_LOCAL:
- // Short delay when teleporting in the same sim (progress screen active but not shown - did not
- // fall-through from TELEPORT_START)
- {
- if (gTeleportDisplayTimer.getElapsedTimeF32() > teleport_local_delay())
- {
- //LLFirstUse::useTeleport();
- LL_INFOS("Teleport") << "State is local and gTeleportDisplayTimer " << gTeleportDisplayTimer.getElapsedTimeF32()
- << " exceeds teleport_local_delete " << teleport_local_delay
- << "; setting state to TELEPORT_NONE"
- << LL_ENDL;
- gAgent.setTeleportState(LLAgent::TELEPORT_NONE);
- }
- break;
- }
-
- case LLAgent::TELEPORT_NONE:
- // No teleport in progress
- gViewerWindow->setShowProgress(FALSE);
- gTeleportDisplay = FALSE;
- }
+ static LLCachedControl<F32> teleport_arrival_delay(gSavedSettings, "TeleportArrivalDelay");
+ static LLCachedControl<F32> teleport_local_delay(gSavedSettings, "TeleportLocalDelay");
+
+ S32 attach_count = 0;
+ if (isAgentAvatarValid())
+ {
+ attach_count = gAgentAvatarp->getAttachmentCount();
+ }
+ F32 teleport_save_time = TELEPORT_EXPIRY + TELEPORT_EXPIRY_PER_ATTACHMENT * attach_count;
+ F32 teleport_elapsed = gTeleportDisplayTimer.getElapsedTimeF32();
+ F32 teleport_percent = teleport_elapsed * (100.f / teleport_save_time);
+ if (gAgent.getTeleportState() != LLAgent::TELEPORT_START && teleport_percent > 100.f)
+ {
+ // Give up. Don't keep the UI locked forever.
+ LL_WARNS("Teleport") << "Giving up on teleport. elapsed time " << teleport_elapsed << " exceeds max time " << teleport_save_time << LL_ENDL;
+ gAgent.setTeleportState(LLAgent::TELEPORT_NONE);
+ gAgent.setTeleportMessage(std::string());
+ }
+
+ // Make sure the TP progress panel gets hidden in case the viewer window
+ // is minimized *during* a TP. HB
+ if (minimized)
+ {
+ gViewerWindow->setShowProgress(FALSE);
+ }
+
+ const std::string& message = gAgent.getTeleportMessage();
+ switch (gAgent.getTeleportState())
+ {
+ case LLAgent::TELEPORT_PENDING:
+ {
+ gTeleportDisplayTimer.reset();
+ const std::string& msg = LLAgent::sTeleportProgressMessages["pending"];
+ if (!minimized)
+ {
+ gViewerWindow->setShowProgress(TRUE);
+ gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f));
+ gViewerWindow->setProgressString(msg);
+ }
+ gAgent.setTeleportMessage(msg);
+ break;
+ }
+
+ case LLAgent::TELEPORT_START:
+ {
+ // Transition to REQUESTED. Viewer has sent some kind
+ // of TeleportRequest to the source simulator
+ gTeleportDisplayTimer.reset();
+ const std::string& msg = LLAgent::sTeleportProgressMessages["requesting"];
+ LL_INFOS("Teleport") << "A teleport request has been sent, setting state to TELEPORT_REQUESTED" << LL_ENDL;
+ gAgent.setTeleportState(LLAgent::TELEPORT_REQUESTED);
+ gAgent.setTeleportMessage(msg);
+ if (!minimized)
+ {
+ gViewerWindow->setShowProgress(TRUE);
+ gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f));
+ gViewerWindow->setProgressString(msg);
+ gViewerWindow->setProgressMessage(gAgent.mMOTD);
+ }
+ break;
+ }
+
+ case LLAgent::TELEPORT_REQUESTED:
+ // Waiting for source simulator to respond
+ if (!minimized)
+ {
+ gViewerWindow->setProgressPercent(llmin(teleport_percent, 37.5f));
+ gViewerWindow->setProgressString(message);
+ }
+ break;
+
+ case LLAgent::TELEPORT_MOVING:
+ // Viewer has received destination location from source simulator
+ if (!minimized)
+ {
+ gViewerWindow->setProgressPercent(llmin(teleport_percent, 75.f));
+ gViewerWindow->setProgressString(message);
+ }
+ break;
+
+ case LLAgent::TELEPORT_START_ARRIVAL:
+ // Transition to ARRIVING. Viewer has received avatar update, etc.,
+ // from destination simulator
+ gTeleportArrivalTimer.reset();
+ LL_INFOS("Teleport") << "Changing state to TELEPORT_ARRIVING" << LL_ENDL;
+ gAgent.setTeleportState(LLAgent::TELEPORT_ARRIVING);
+ gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["arriving"]);
+ gAgent.sheduleTeleportIM();
+ gTextureList.mForceResetTextureStats = TRUE;
+ gAgentCamera.resetView(TRUE, TRUE);
+ if (!minimized)
+ {
+ gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel"));
+ gViewerWindow->setProgressPercent(75.f);
+ }
+ break;
+
+ case LLAgent::TELEPORT_ARRIVING:
+ // Make the user wait while content "pre-caches"
+ {
+ F32 arrival_fraction = (gTeleportArrivalTimer.getElapsedTimeF32() / teleport_arrival_delay());
+ if (arrival_fraction > 1.f)
+ {
+ arrival_fraction = 1.f;
+ //LLFirstUse::useTeleport();
+ LL_INFOS("Teleport") << "arrival_fraction is " << arrival_fraction << " changing state to TELEPORT_NONE" << LL_ENDL;
+ gAgent.setTeleportState(LLAgent::TELEPORT_NONE);
+ }
+ if (!minimized)
+ {
+ gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel"));
+ gViewerWindow->setProgressPercent(arrival_fraction * 25.f + 75.f);
+ gViewerWindow->setProgressString(message);
+ }
+ break;
+ }
+
+ case LLAgent::TELEPORT_LOCAL:
+ // Short delay when teleporting in the same sim (progress screen active but not shown - did not
+ // fall-through from TELEPORT_START)
+ {
+ if (gTeleportDisplayTimer.getElapsedTimeF32() > teleport_local_delay())
+ {
+ //LLFirstUse::useTeleport();
+ LL_INFOS("Teleport") << "State is local and gTeleportDisplayTimer " << gTeleportDisplayTimer.getElapsedTimeF32()
+ << " exceeds teleport_local_delete " << teleport_local_delay
+ << "; setting state to TELEPORT_NONE"
+ << LL_ENDL;
+ gAgent.setTeleportState(LLAgent::TELEPORT_NONE);
+ }
+ break;
+ }
+
+ case LLAgent::TELEPORT_NONE:
+ // No teleport in progress
+ gViewerWindow->setShowProgress(FALSE);
+ gTeleportDisplay = FALSE;
+ }
}
// Paint the display!
@@ -390,513 +390,513 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Render");
LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_DISPLAY); // render time capture - This is the main stat for overall rendering.
-
- if (gWindowResized)
- { //skip render on frames where window has been resized
- LL_DEBUGS("Window") << "Resizing window" << LL_ENDL;
+
+ if (gWindowResized)
+ { //skip render on frames where window has been resized
+ LL_DEBUGS("Window") << "Resizing window" << LL_ENDL;
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Resize Window");
- gGL.flush();
- glClear(GL_COLOR_BUFFER_BIT);
- gViewerWindow->getWindow()->swapBuffers();
- LLPipeline::refreshCachedSettings();
- gPipeline.resizeScreenTexture();
- gResizeScreenTexture = FALSE;
- gWindowResized = FALSE;
- return;
- }
+ gGL.flush();
+ glClear(GL_COLOR_BUFFER_BIT);
+ gViewerWindow->getWindow()->swapBuffers();
+ LLPipeline::refreshCachedSettings();
+ gPipeline.resizeScreenTexture();
+ gResizeScreenTexture = FALSE;
+ gWindowResized = FALSE;
+ return;
+ }
if (gResizeShadowTexture)
- { //skip render on frames where window has been resized
- gPipeline.resizeShadowTexture();
- gResizeShadowTexture = FALSE;
- }
-
- gSnapshot = for_snapshot;
-
- if (LLPipeline::sRenderDeferred)
- { //hack to make sky show up in deferred snapshots
- for_snapshot = FALSE;
- }
-
- LLGLSDefault gls_default;
- LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE, GL_LEQUAL);
-
- LLVertexBuffer::unbind();
-
- LLGLState::checkStates();
-
- gPipeline.disableLights();
-
- // Don't draw if the window is hidden or minimized.
- // In fact, must explicitly check the minimized state before drawing.
- // Attempting to draw into a minimized window causes a GL error. JC
- if ( !gViewerWindow->getActive()
- || !gViewerWindow->getWindow()->getVisible()
- || gViewerWindow->getWindow()->getMinimized()
- || gNonInteractive)
- {
- // Clean up memory the pools may have allocated
- if (rebuild)
- {
- stop_glerror();
- gPipeline.rebuildPools();
- stop_glerror();
- }
-
- stop_glerror();
- gViewerWindow->returnEmptyPicks();
- stop_glerror();
-
- // We still need to update the teleport progress (to get changes done
- // in TP states, else the sim does not get the messages signaling the
- // agent's arrival). This fixes BUG-230616. HB
- if (gTeleportDisplay)
- {
- // true = minimized, do not show/update the TP screen. HB
- update_tp_display(true);
- }
- return;
- }
-
- gViewerWindow->checkSettings();
-
- {
+ { //skip render on frames where window has been resized
+ gPipeline.resizeShadowTexture();
+ gResizeShadowTexture = FALSE;
+ }
+
+ gSnapshot = for_snapshot;
+
+ if (LLPipeline::sRenderDeferred)
+ { //hack to make sky show up in deferred snapshots
+ for_snapshot = FALSE;
+ }
+
+ LLGLSDefault gls_default;
+ LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE, GL_LEQUAL);
+
+ LLVertexBuffer::unbind();
+
+ LLGLState::checkStates();
+
+ gPipeline.disableLights();
+
+ // Don't draw if the window is hidden or minimized.
+ // In fact, must explicitly check the minimized state before drawing.
+ // Attempting to draw into a minimized window causes a GL error. JC
+ if ( !gViewerWindow->getActive()
+ || !gViewerWindow->getWindow()->getVisible()
+ || gViewerWindow->getWindow()->getMinimized()
+ || gNonInteractive)
+ {
+ // Clean up memory the pools may have allocated
+ if (rebuild)
+ {
+ stop_glerror();
+ gPipeline.rebuildPools();
+ stop_glerror();
+ }
+
+ stop_glerror();
+ gViewerWindow->returnEmptyPicks();
+ stop_glerror();
+
+ // We still need to update the teleport progress (to get changes done
+ // in TP states, else the sim does not get the messages signaling the
+ // agent's arrival). This fixes BUG-230616. HB
+ if (gTeleportDisplay)
+ {
+ // true = minimized, do not show/update the TP screen. HB
+ update_tp_display(true);
+ }
+ return;
+ }
+
+ gViewerWindow->checkSettings();
+
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Picking");
- gViewerWindow->performPick();
- }
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:CheckStates");
- LLGLState::checkStates();
-
- //////////////////////////////////////////////////////////
- //
- // Logic for forcing window updates if we're in drone mode.
- //
-
- // *TODO: Investigate running display() during gHeadlessClient. See if this early exit is needed DK 2011-02-18
- if (gHeadlessClient)
- {
+ gViewerWindow->performPick();
+ }
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:CheckStates");
+ LLGLState::checkStates();
+
+ //////////////////////////////////////////////////////////
+ //
+ // Logic for forcing window updates if we're in drone mode.
+ //
+
+ // *TODO: Investigate running display() during gHeadlessClient. See if this early exit is needed DK 2011-02-18
+ if (gHeadlessClient)
+ {
#if LL_WINDOWS
- static F32 last_update_time = 0.f;
- if ((gFrameTimeSeconds - last_update_time) > 1.f)
- {
- InvalidateRect((HWND)gViewerWindow->getPlatformWindow(), NULL, FALSE);
- last_update_time = gFrameTimeSeconds;
- }
+ static F32 last_update_time = 0.f;
+ if ((gFrameTimeSeconds - last_update_time) > 1.f)
+ {
+ InvalidateRect((HWND)gViewerWindow->getPlatformWindow(), NULL, FALSE);
+ last_update_time = gFrameTimeSeconds;
+ }
#elif LL_DARWIN
- // MBW -- Do something clever here.
+ // MBW -- Do something clever here.
#endif
- // Not actually rendering, don't bother.
- return;
- }
-
-
- //
- // Bail out if we're in the startup state and don't want to try to
- // render the world.
- //
- if (LLStartUp::getStartupState() < STATE_PRECACHE)
- {
- LLAppViewer::instance()->pingMainloopTimeout("Display:Startup");
- display_startup();
- return;
- }
-
-
- if (gShaderProfileFrame)
- {
- LLGLSLShader::initProfile();
- }
-
- //LLGLState::verify(FALSE);
-
- /////////////////////////////////////////////////
- //
- // Update GL Texture statistics (used for discard logic?)
- //
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:TextureStats");
- stop_glerror();
-
- LLImageGL::updateStats(gFrameTimeSeconds);
-
- LLVOAvatar::sRenderName = gSavedSettings.getS32("AvatarNameTagMode");
- LLVOAvatar::sRenderGroupTitles = (gSavedSettings.getBOOL("NameTagShowGroupTitles") && gSavedSettings.getS32("AvatarNameTagMode"));
-
- gPipeline.mBackfaceCull = TRUE;
- gFrameCount++;
- gRecentFrameCount++;
- if (gFocusMgr.getAppHasFocus())
- {
- gForegroundFrameCount++;
- }
-
- //////////////////////////////////////////////////////////
- //
- // Display start screen if we're teleporting, and skip render
- //
-
- if (gTeleportDisplay)
- {
+ // Not actually rendering, don't bother.
+ return;
+ }
+
+
+ //
+ // Bail out if we're in the startup state and don't want to try to
+ // render the world.
+ //
+ if (LLStartUp::getStartupState() < STATE_PRECACHE)
+ {
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Startup");
+ display_startup();
+ return;
+ }
+
+
+ if (gShaderProfileFrame)
+ {
+ LLGLSLShader::initProfile();
+ }
+
+ //LLGLState::verify(FALSE);
+
+ /////////////////////////////////////////////////
+ //
+ // Update GL Texture statistics (used for discard logic?)
+ //
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:TextureStats");
+ stop_glerror();
+
+ LLImageGL::updateStats(gFrameTimeSeconds);
+
+ LLVOAvatar::sRenderName = gSavedSettings.getS32("AvatarNameTagMode");
+ LLVOAvatar::sRenderGroupTitles = (gSavedSettings.getBOOL("NameTagShowGroupTitles") && gSavedSettings.getS32("AvatarNameTagMode"));
+
+ gPipeline.mBackfaceCull = TRUE;
+ gFrameCount++;
+ gRecentFrameCount++;
+ if (gFocusMgr.getAppHasFocus())
+ {
+ gForegroundFrameCount++;
+ }
+
+ //////////////////////////////////////////////////////////
+ //
+ // Display start screen if we're teleporting, and skip render
+ //
+
+ if (gTeleportDisplay)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Teleport Display");
- LLAppViewer::instance()->pingMainloopTimeout("Display:Teleport");
- // Note: false = not minimized, do update the TP screen. HB
- update_tp_display(false);
- }
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Teleport");
+ // Note: false = not minimized, do update the TP screen. HB
+ update_tp_display(false);
+ }
else if(LLAppViewer::instance()->logoutRequestSent())
- {
- LLAppViewer::instance()->pingMainloopTimeout("Display:Logout");
- F32 percent_done = gLogoutTimer.getElapsedTimeF32() * 100.f / gLogoutMaxTime;
- if (percent_done > 100.f)
- {
- percent_done = 100.f;
- }
-
- if( LLApp::isExiting() )
- {
- percent_done = 100.f;
- }
-
- gViewerWindow->setProgressPercent( percent_done );
- gViewerWindow->setProgressMessage(std::string());
- }
- else
- if (gRestoreGL)
- {
- LLAppViewer::instance()->pingMainloopTimeout("Display:RestoreGL");
- F32 percent_done = gRestoreGLTimer.getElapsedTimeF32() * 100.f / RESTORE_GL_TIME;
- if( percent_done > 100.f )
- {
- gViewerWindow->setShowProgress(FALSE);
- gRestoreGL = FALSE;
- }
- else
- {
-
- if( LLApp::isExiting() )
- {
- percent_done = 100.f;
- }
-
- gViewerWindow->setProgressPercent( percent_done );
- }
- gViewerWindow->setProgressMessage(std::string());
- }
-
- //////////////////////////
- //
- // Prepare for the next frame
- //
-
- /////////////////////////////
- //
- // Update the camera
- //
- //
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:Camera");
+ {
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Logout");
+ F32 percent_done = gLogoutTimer.getElapsedTimeF32() * 100.f / gLogoutMaxTime;
+ if (percent_done > 100.f)
+ {
+ percent_done = 100.f;
+ }
+
+ if( LLApp::isExiting() )
+ {
+ percent_done = 100.f;
+ }
+
+ gViewerWindow->setProgressPercent( percent_done );
+ gViewerWindow->setProgressMessage(std::string());
+ }
+ else
+ if (gRestoreGL)
+ {
+ LLAppViewer::instance()->pingMainloopTimeout("Display:RestoreGL");
+ F32 percent_done = gRestoreGLTimer.getElapsedTimeF32() * 100.f / RESTORE_GL_TIME;
+ if( percent_done > 100.f )
+ {
+ gViewerWindow->setShowProgress(FALSE);
+ gRestoreGL = FALSE;
+ }
+ else
+ {
+
+ if( LLApp::isExiting() )
+ {
+ percent_done = 100.f;
+ }
+
+ gViewerWindow->setProgressPercent( percent_done );
+ }
+ gViewerWindow->setProgressMessage(std::string());
+ }
+
+ //////////////////////////
+ //
+ // Prepare for the next frame
+ //
+
+ /////////////////////////////
+ //
+ // Update the camera
+ //
+ //
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Camera");
if (LLViewerCamera::instanceExists())
{
LLViewerCamera::getInstance()->setZoomParameters(zoom_factor, subfield);
LLViewerCamera::getInstance()->setNear(MIN_NEAR_PLANE);
}
- //////////////////////////
- //
- // clear the next buffer
- // (must follow dynamic texture writing since that uses the frame buffer)
- //
-
- if (gDisconnected)
- {
- LLAppViewer::instance()->pingMainloopTimeout("Display:Disconnected");
- render_ui();
- swap();
- }
-
- //////////////////////////
- //
- // Set rendering options
- //
- //
- LLAppViewer::instance()->pingMainloopTimeout("Display:RenderSetup");
- stop_glerror();
-
- ///////////////////////////////////////
- //
- // Slam lighting parameters back to our defaults.
- // Note that these are not the same as GL defaults...
-
- stop_glerror();
- gGL.setAmbientLightColor(LLColor4::white);
- stop_glerror();
-
- /////////////////////////////////////
- //
- // Render
- //
- // Actually push all of our triangles to the screen.
- //
-
- // do render-to-texture stuff here
- if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES))
- {
- LLAppViewer::instance()->pingMainloopTimeout("Display:DynamicTextures");
+ //////////////////////////
+ //
+ // clear the next buffer
+ // (must follow dynamic texture writing since that uses the frame buffer)
+ //
+
+ if (gDisconnected)
+ {
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Disconnected");
+ render_ui();
+ swap();
+ }
+
+ //////////////////////////
+ //
+ // Set rendering options
+ //
+ //
+ LLAppViewer::instance()->pingMainloopTimeout("Display:RenderSetup");
+ stop_glerror();
+
+ ///////////////////////////////////////
+ //
+ // Slam lighting parameters back to our defaults.
+ // Note that these are not the same as GL defaults...
+
+ stop_glerror();
+ gGL.setAmbientLightColor(LLColor4::white);
+ stop_glerror();
+
+ /////////////////////////////////////
+ //
+ // Render
+ //
+ // Actually push all of our triangles to the screen.
+ //
+
+ // do render-to-texture stuff here
+ if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES))
+ {
+ LLAppViewer::instance()->pingMainloopTimeout("Display:DynamicTextures");
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Update Dynamic Textures");
- if (LLViewerDynamicTexture::updateAllInstances())
- {
- gGL.setColorMask(true, true);
- glClear(GL_DEPTH_BUFFER_BIT);
- }
- }
-
- gViewerWindow->setup3DViewport();
-
- gPipeline.resetFrameStats(); // Reset per-frame statistics.
-
- if (!gDisconnected)
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 1");
- LLAppViewer::instance()->pingMainloopTimeout("Display:Update");
- if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
- { //don't draw hud objects in this frame
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
- }
-
- if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES))
- { //don't draw hud particles in this frame
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES);
- }
-
- stop_glerror();
- display_update_camera();
- stop_glerror();
-
- {
+ if (LLViewerDynamicTexture::updateAllInstances())
+ {
+ gGL.setColorMask(true, true);
+ glClear(GL_DEPTH_BUFFER_BIT);
+ }
+ }
+
+ gViewerWindow->setup3DViewport();
+
+ gPipeline.resetFrameStats(); // Reset per-frame statistics.
+
+ if (!gDisconnected)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 1");
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Update");
+ if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
+ { //don't draw hud objects in this frame
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
+ }
+
+ if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES))
+ { //don't draw hud particles in this frame
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES);
+ }
+
+ stop_glerror();
+ display_update_camera();
+ stop_glerror();
+
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Env Update");
// update all the sky/atmospheric/water settings
LLEnvironment::instance().update(LLViewerCamera::getInstance());
- }
+ }
- // *TODO: merge these two methods
- {
+ // *TODO: merge these two methods
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("HUD Update");
- LLHUDManager::getInstance()->updateEffects();
- LLHUDObject::updateAll();
- stop_glerror();
- }
+ LLHUDManager::getInstance()->updateEffects();
+ LLHUDObject::updateAll();
+ stop_glerror();
+ }
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Update Geom");
- const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds.value(); // 50 ms/second update time
- gPipeline.createObjects(max_geom_update_time);
- gPipeline.processPartitionQ();
- gPipeline.updateGeom(max_geom_update_time);
- stop_glerror();
- }
-
- gPipeline.updateGL();
-
- stop_glerror();
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:Cull");
-
- //Increment drawable frame counter
- LLDrawable::incrementVisible();
-
- LLSpatialGroup::sNoDelete = TRUE;
- LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
-
- S32 occlusion = LLPipeline::sUseOcclusion;
- if (gDepthDirty)
- { //depth buffer is invalid, don't overwrite occlusion state
- LLPipeline::sUseOcclusion = llmin(occlusion, 1);
- }
- gDepthDirty = FALSE;
-
- LLGLState::checkStates();
-
- static LLCullResult result;
- LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
- LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater();
- gPipeline.updateCull(*LLViewerCamera::getInstance(), result);
- stop_glerror();
-
- LLGLState::checkStates();
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:Swap");
-
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 2")
- if (gResizeScreenTexture)
- {
- gPipeline.resizeScreenTexture();
+ const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds.value(); // 50 ms/second update time
+ gPipeline.createObjects(max_geom_update_time);
+ gPipeline.processPartitionQ();
+ gPipeline.updateGeom(max_geom_update_time);
+ stop_glerror();
+ }
+
+ gPipeline.updateGL();
+
+ stop_glerror();
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Cull");
+
+ //Increment drawable frame counter
+ LLDrawable::incrementVisible();
+
+ LLSpatialGroup::sNoDelete = TRUE;
+ LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
+
+ S32 occlusion = LLPipeline::sUseOcclusion;
+ if (gDepthDirty)
+ { //depth buffer is invalid, don't overwrite occlusion state
+ LLPipeline::sUseOcclusion = llmin(occlusion, 1);
+ }
+ gDepthDirty = FALSE;
+
+ LLGLState::checkStates();
+
+ static LLCullResult result;
+ LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+ LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater();
+ gPipeline.updateCull(*LLViewerCamera::getInstance(), result);
+ stop_glerror();
+
+ LLGLState::checkStates();
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Swap");
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 2")
+ if (gResizeScreenTexture)
+ {
+ gPipeline.resizeScreenTexture();
gResizeScreenTexture = FALSE;
- }
+ }
- gGL.setColorMask(true, true);
- glClearColor(0,0,0,0);
+ gGL.setColorMask(true, true);
+ glClearColor(0,0,0,0);
- LLGLState::checkStates();
+ LLGLState::checkStates();
- if (!for_snapshot)
- {
+ if (!for_snapshot)
+ {
if (gFrameCount > 1 && !for_snapshot)
- { //for some reason, ATI 4800 series will error out if you
+ { //for some reason, ATI 4800 series will error out if you
//try to generate a shadow before the first frame is through
gPipeline.generateSunShadow(*LLViewerCamera::getInstance());
}
- LLVertexBuffer::unbind();
+ LLVertexBuffer::unbind();
- LLGLState::checkStates();
+ LLGLState::checkStates();
- glh::matrix4f proj = get_current_projection();
- glh::matrix4f mod = get_current_modelview();
- glViewport(0,0,512,512);
+ glh::matrix4f proj = get_current_projection();
+ glh::matrix4f mod = get_current_modelview();
+ glViewport(0,0,512,512);
- LLVOAvatar::updateImpostors();
+ LLVOAvatar::updateImpostors();
- set_current_projection(proj);
- set_current_modelview(mod);
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.loadMatrix(proj.m);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.loadMatrix(mod.m);
- gViewerWindow->setup3DViewport();
+ set_current_projection(proj);
+ set_current_modelview(mod);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadMatrix(proj.m);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.loadMatrix(mod.m);
+ gViewerWindow->setup3DViewport();
- LLGLState::checkStates();
- }
+ LLGLState::checkStates();
+ }
glClear(GL_DEPTH_BUFFER_BIT);
- }
-
- //////////////////////////////////////
- //
- // Update images, using the image stats generated during object update/culling
- //
- // Can put objects onto the retextured list.
- //
- // Doing this here gives hardware occlusion queries extra time to complete
- LLAppViewer::instance()->pingMainloopTimeout("Display:UpdateImages");
-
- {
+ }
+
+ //////////////////////////////////////
+ //
+ // Update images, using the image stats generated during object update/culling
+ //
+ // Can put objects onto the retextured list.
+ //
+ // Doing this here gives hardware occlusion queries extra time to complete
+ LLAppViewer::instance()->pingMainloopTimeout("Display:UpdateImages");
+
+ {
LL_PROFILE_ZONE_NAMED("Update Images");
-
- {
+
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Class");
- LLViewerTexture::updateClass();
- }
+ LLViewerTexture::updateClass();
+ }
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Image Update Bump");
- gBumpImageList.updateImages(); // must be called before gTextureList version so that it's textures are thrown out first.
- }
+ gBumpImageList.updateImages(); // must be called before gTextureList version so that it's textures are thrown out first.
+ }
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("List");
- F32 max_image_decode_time = 0.050f*gFrameIntervalSeconds.value(); // 50 ms/second decode time
- max_image_decode_time = llclamp(max_image_decode_time, 0.002f, 0.005f ); // min 2ms/frame, max 5ms/frame)
- gTextureList.updateImages(max_image_decode_time);
- }
+ F32 max_image_decode_time = 0.050f*gFrameIntervalSeconds.value(); // 50 ms/second decode time
+ max_image_decode_time = llclamp(max_image_decode_time, 0.002f, 0.005f ); // min 2ms/frame, max 5ms/frame)
+ gTextureList.updateImages(max_image_decode_time);
+ }
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("GLTF Materials Cleanup");
- //remove dead gltf materials
+ //remove dead gltf materials
gGLTFMaterialList.flushMaterials();
- }
- }
-
- LLGLState::checkStates();
-
- ///////////////////////////////////
- //
- // StateSort
- //
- // Responsible for taking visible objects, and adding them to the appropriate draw orders.
- // In the case of alpha objects, z-sorts them first.
- // Also creates special lists for outlines and selected face rendering.
- //
- LLAppViewer::instance()->pingMainloopTimeout("Display:StateSort");
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 4")
- LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
- gPipeline.stateSort(*LLViewerCamera::getInstance(), result);
- stop_glerror();
-
- if (rebuild)
- {
- //////////////////////////////////////
- //
- // rebuildPools
- //
- //
- gPipeline.rebuildPools();
- stop_glerror();
- }
- }
-
- LLSceneMonitor::getInstance()->fetchQueryResult();
-
- LLGLState::checkStates();
-
- LLPipeline::sUseOcclusion = occlusion;
-
- {
- LLAppViewer::instance()->pingMainloopTimeout("Display:Sky");
- LL_PROFILE_ZONE_NAMED_CATEGORY_ENVIRONMENT("update sky"); //LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKY);
- gSky.updateSky();
- }
-
- if(gUseWireframe)
- {
- glClearColor(0.5f, 0.5f, 0.5f, 0.f);
- glClear(GL_COLOR_BUFFER_BIT);
- }
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:RenderStart");
-
- //// render frontmost floater opaque for occlusion culling purposes
- //LLFloater* frontmost_floaterp = gFloaterView->getFrontmost();
- //// assumes frontmost floater with focus is opaque
- //if (frontmost_floaterp && gFocusMgr.childHasKeyboardFocus(frontmost_floaterp))
- //{
- // gGL.matrixMode(LLRender::MM_MODELVIEW);
- // gGL.pushMatrix();
- // {
- // gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- // glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
- // gGL.loadIdentity();
-
- // LLRect floater_rect = frontmost_floaterp->calcScreenRect();
- // // deflate by one pixel so rounding errors don't occlude outside of floater extents
- // floater_rect.stretch(-1);
- // LLRectf floater_3d_rect((F32)floater_rect.mLeft / (F32)gViewerWindow->getWindowWidthScaled(),
- // (F32)floater_rect.mTop / (F32)gViewerWindow->getWindowHeightScaled(),
- // (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidthScaled(),
- // (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeightScaled());
- // floater_3d_rect.translate(-0.5f, -0.5f);
- // gGL.translatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear());
- // gGL.scalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f);
- // gGL.color4fv(LLColor4::white.mV);
- // gGL.begin(LLVertexBuffer::QUADS);
- // {
- // gGL.vertex3f(floater_3d_rect.mLeft, floater_3d_rect.mBottom, 0.f);
- // gGL.vertex3f(floater_3d_rect.mLeft, floater_3d_rect.mTop, 0.f);
- // gGL.vertex3f(floater_3d_rect.mRight, floater_3d_rect.mTop, 0.f);
- // gGL.vertex3f(floater_3d_rect.mRight, floater_3d_rect.mBottom, 0.f);
- // }
- // gGL.end();
- // glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- // }
- // gGL.popMatrix();
- //}
-
- LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
-
- LLGLState::checkStates();
-
- stop_glerror();
+ }
+ }
+
+ LLGLState::checkStates();
+
+ ///////////////////////////////////
+ //
+ // StateSort
+ //
+ // Responsible for taking visible objects, and adding them to the appropriate draw orders.
+ // In the case of alpha objects, z-sorts them first.
+ // Also creates special lists for outlines and selected face rendering.
+ //
+ LLAppViewer::instance()->pingMainloopTimeout("Display:StateSort");
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 4")
+ LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+ gPipeline.stateSort(*LLViewerCamera::getInstance(), result);
+ stop_glerror();
+
+ if (rebuild)
+ {
+ //////////////////////////////////////
+ //
+ // rebuildPools
+ //
+ //
+ gPipeline.rebuildPools();
+ stop_glerror();
+ }
+ }
+
+ LLSceneMonitor::getInstance()->fetchQueryResult();
+
+ LLGLState::checkStates();
+
+ LLPipeline::sUseOcclusion = occlusion;
+
+ {
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Sky");
+ LL_PROFILE_ZONE_NAMED_CATEGORY_ENVIRONMENT("update sky"); //LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKY);
+ gSky.updateSky();
+ }
+
+ if(gUseWireframe)
+ {
+ glClearColor(0.5f, 0.5f, 0.5f, 0.f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:RenderStart");
+
+ //// render frontmost floater opaque for occlusion culling purposes
+ //LLFloater* frontmost_floaterp = gFloaterView->getFrontmost();
+ //// assumes frontmost floater with focus is opaque
+ //if (frontmost_floaterp && gFocusMgr.childHasKeyboardFocus(frontmost_floaterp))
+ //{
+ // gGL.matrixMode(LLRender::MM_MODELVIEW);
+ // gGL.pushMatrix();
+ // {
+ // gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ // glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
+ // gGL.loadIdentity();
+
+ // LLRect floater_rect = frontmost_floaterp->calcScreenRect();
+ // // deflate by one pixel so rounding errors don't occlude outside of floater extents
+ // floater_rect.stretch(-1);
+ // LLRectf floater_3d_rect((F32)floater_rect.mLeft / (F32)gViewerWindow->getWindowWidthScaled(),
+ // (F32)floater_rect.mTop / (F32)gViewerWindow->getWindowHeightScaled(),
+ // (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidthScaled(),
+ // (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeightScaled());
+ // floater_3d_rect.translate(-0.5f, -0.5f);
+ // gGL.translatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear());
+ // gGL.scalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f);
+ // gGL.color4fv(LLColor4::white.mV);
+ // gGL.begin(LLVertexBuffer::QUADS);
+ // {
+ // gGL.vertex3f(floater_3d_rect.mLeft, floater_3d_rect.mBottom, 0.f);
+ // gGL.vertex3f(floater_3d_rect.mLeft, floater_3d_rect.mTop, 0.f);
+ // gGL.vertex3f(floater_3d_rect.mRight, floater_3d_rect.mTop, 0.f);
+ // gGL.vertex3f(floater_3d_rect.mRight, floater_3d_rect.mBottom, 0.f);
+ // }
+ // gGL.end();
+ // glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ // }
+ // gGL.popMatrix();
+ //}
+
+ LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
+
+ LLGLState::checkStates();
+
+ stop_glerror();
gGL.setColorMask(true, true);
@@ -928,94 +928,94 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gGL.setColorMask(true, false);
LLAppViewer::instance()->pingMainloopTimeout("Display:RenderGeom");
-
- if (!(LLAppViewer::instance()->logoutRequestSent() && LLAppViewer::instance()->hasSavedFinalSnapshot())
- && !gRestoreGL)
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 5")
- LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
-
- if (gSavedSettings.getBOOL("RenderDepthPrePass"))
- {
- gGL.setColorMask(false, false);
-
- static const U32 types[] = {
- LLRenderPass::PASS_SIMPLE,
- LLRenderPass::PASS_FULLBRIGHT,
- LLRenderPass::PASS_SHINY
- };
-
- U32 num_types = LL_ARRAY_SIZE(types);
- gOcclusionProgram.bind();
- for (U32 i = 0; i < num_types; i++)
- {
- gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
- }
-
- gOcclusionProgram.unbind();
-
- }
-
- gGL.setColorMask(true, true);
- gPipeline.renderGeomDeferred(*LLViewerCamera::getInstance(), true);
- }
-
- {
+
+ if (!(LLAppViewer::instance()->logoutRequestSent() && LLAppViewer::instance()->hasSavedFinalSnapshot())
+ && !gRestoreGL)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 5")
+ LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+
+ if (gSavedSettings.getBOOL("RenderDepthPrePass"))
+ {
+ gGL.setColorMask(false, false);
+
+ static const U32 types[] = {
+ LLRenderPass::PASS_SIMPLE,
+ LLRenderPass::PASS_FULLBRIGHT,
+ LLRenderPass::PASS_SHINY
+ };
+
+ U32 num_types = LL_ARRAY_SIZE(types);
+ gOcclusionProgram.bind();
+ for (U32 i = 0; i < num_types; i++)
+ {
+ gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
+ }
+
+ gOcclusionProgram.unbind();
+
+ }
+
+ gGL.setColorMask(true, true);
+ gPipeline.renderGeomDeferred(*LLViewerCamera::getInstance(), true);
+ }
+
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Texture Unbind");
- for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++)
- { //dummy cleanup of any currently bound textures
- if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE)
- {
- gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType());
- gGL.getTexUnit(i)->disable();
- }
- }
- }
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:RenderFlush");
+ for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++)
+ { //dummy cleanup of any currently bound textures
+ if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE)
+ {
+ gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType());
+ gGL.getTexUnit(i)->disable();
+ }
+ }
+ }
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:RenderFlush");
LLRenderTarget &rt = (gPipeline.sRenderDeferred ? gPipeline.mRT->deferredScreen : gPipeline.mRT->screen);
rt.flush();
if (LLPipeline::sRenderDeferred)
{
- gPipeline.renderDeferredLighting();
- }
-
- LLPipeline::sUnderWaterRender = FALSE;
-
- {
- //capture the frame buffer.
- LLSceneMonitor::getInstance()->capture();
- }
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI");
- if (!for_snapshot)
- {
- render_ui();
- swap();
- }
-
-
- LLSpatialGroup::sNoDelete = FALSE;
- gPipeline.clearReferences();
- }
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:FrameStats");
-
- stop_glerror();
-
- display_stats();
-
- LLAppViewer::instance()->pingMainloopTimeout("Display:Done");
-
- gShiftFrame = false;
-
- if (gShaderProfileFrame)
- {
- gShaderProfileFrame = FALSE;
- LLGLSLShader::finishProfile();
- }
+ gPipeline.renderDeferredLighting();
+ }
+
+ LLPipeline::sUnderWaterRender = FALSE;
+
+ {
+ //capture the frame buffer.
+ LLSceneMonitor::getInstance()->capture();
+ }
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI");
+ if (!for_snapshot)
+ {
+ render_ui();
+ swap();
+ }
+
+
+ LLSpatialGroup::sNoDelete = FALSE;
+ gPipeline.clearReferences();
+ }
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:FrameStats");
+
+ stop_glerror();
+
+ display_stats();
+
+ LLAppViewer::instance()->pingMainloopTimeout("Display:Done");
+
+ gShiftFrame = false;
+
+ if (gShaderProfileFrame)
+ {
+ gShaderProfileFrame = FALSE;
+ LLGLSLShader::finishProfile();
+ }
}
// WIP simplified copy of display() that does minimal work
@@ -1062,7 +1062,7 @@ void display_cube_face()
}
LLSpatialGroup::sNoDelete = TRUE;
-
+
S32 occlusion = LLPipeline::sUseOcclusion;
LLPipeline::sUseOcclusion = 0; // occlusion data is from main camera point of view, don't read or write it during cube snapshots
//gDepthDirty = TRUE; //let "real" render pipe know it can't trust the depth buffer for occlusion data
@@ -1076,7 +1076,7 @@ void display_cube_face()
glClearColor(0, 0, 0, 0);
gPipeline.generateSunShadow(*LLViewerCamera::getInstance());
-
+
glClear(GL_DEPTH_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT);
{
@@ -1094,7 +1094,7 @@ void display_cube_face()
stop_glerror();
}
}
-
+
LLPipeline::sUseOcclusion = occlusion;
LLAppViewer::instance()->pingMainloopTimeout("Display:RenderStart");
@@ -1113,13 +1113,13 @@ void display_cube_face()
glClearColor(1, 0, 1, 1);
}
gPipeline.mRT->deferredScreen.clear();
-
+
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
gPipeline.renderGeomDeferred(*LLViewerCamera::getInstance());
gPipeline.mRT->deferredScreen.flush();
-
+
gPipeline.renderDeferredLighting();
LLPipeline::sUnderWaterRender = FALSE;
@@ -1135,200 +1135,200 @@ void render_hud_attachments()
{
LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_HUDS); // render time capture - Primary contributor to HUDs (though these end up in render batches)
gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
-
- glh::matrix4f current_proj = get_current_projection();
- glh::matrix4f current_mod = get_current_modelview();
-
- // clamp target zoom level to reasonable values
- gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f);
- // smoothly interpolate current zoom level
- gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.getAgentHUDTargetZoom(), LLSmoothInterpolation::getInterpolant(0.03f));
-
- if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices())
- {
- LLPipeline::sRenderingHUDs = TRUE;
- LLCamera hud_cam = *LLViewerCamera::getInstance();
- hud_cam.setOrigin(-1.f,0,0);
- hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1));
- LLViewerCamera::updateFrustumPlanes(hud_cam, TRUE);
-
- bool render_particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) && gSavedSettings.getBOOL("RenderHUDParticles");
-
- //only render hud objects
- gPipeline.pushRenderTypeMask();
-
- // turn off everything
- gPipeline.andRenderTypeMask(LLPipeline::END_RENDER_TYPES);
- // turn on HUD
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
- // turn on HUD particles
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES);
-
- // if particles are off, turn off hud-particles as well
- if (!render_particles)
- {
- // turn back off HUD particles
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES);
- }
-
- bool has_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
- if (has_ui)
- {
- gPipeline.toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
- }
-
- S32 use_occlusion = LLPipeline::sUseOcclusion;
- LLPipeline::sUseOcclusion = 0;
-
- //cull, sort, and render hud objects
- static LLCullResult result;
- LLSpatialGroup::sNoDelete = TRUE;
-
- LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
- gPipeline.updateCull(hud_cam, result);
+ gGL.pushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+
+ glh::matrix4f current_proj = get_current_projection();
+ glh::matrix4f current_mod = get_current_modelview();
+
+ // clamp target zoom level to reasonable values
+ gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f);
+ // smoothly interpolate current zoom level
+ gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.getAgentHUDTargetZoom(), LLSmoothInterpolation::getInterpolant(0.03f));
+
+ if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices())
+ {
+ LLPipeline::sRenderingHUDs = TRUE;
+ LLCamera hud_cam = *LLViewerCamera::getInstance();
+ hud_cam.setOrigin(-1.f,0,0);
+ hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1));
+ LLViewerCamera::updateFrustumPlanes(hud_cam, TRUE);
+
+ bool render_particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) && gSavedSettings.getBOOL("RenderHUDParticles");
+
+ //only render hud objects
+ gPipeline.pushRenderTypeMask();
+
+ // turn off everything
+ gPipeline.andRenderTypeMask(LLPipeline::END_RENDER_TYPES);
+ // turn on HUD
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
+ // turn on HUD particles
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES);
+
+ // if particles are off, turn off hud-particles as well
+ if (!render_particles)
+ {
+ // turn back off HUD particles
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES);
+ }
+
+ bool has_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
+ if (has_ui)
+ {
+ gPipeline.toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
+ }
+
+ S32 use_occlusion = LLPipeline::sUseOcclusion;
+ LLPipeline::sUseOcclusion = 0;
+
+ //cull, sort, and render hud objects
+ static LLCullResult result;
+ LLSpatialGroup::sNoDelete = TRUE;
+
+ LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+ gPipeline.updateCull(hud_cam, result);
// Toggle render types
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_BUMP);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_SIMPLE);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_BUMP);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_SIMPLE);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA);
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA_PRE_WATER);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA_MASK);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA_MASK);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT);
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_GLTF_PBR);
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_GLTF_PBR_ALPHA_MASK);
// Toggle render passes
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_BUMP);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_MATERIAL);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_SHINY);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISIBLE);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_BUMP);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_MATERIAL);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_SHINY);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISIBLE);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY);
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_GLTF_PBR);
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK);
-
- gPipeline.stateSort(hud_cam, result);
-
- gPipeline.renderGeomPostDeferred(hud_cam);
-
- LLSpatialGroup::sNoDelete = FALSE;
- //gPipeline.clearReferences();
-
- render_hud_elements();
-
- //restore type mask
- gPipeline.popRenderTypeMask();
-
- if (has_ui)
- {
- gPipeline.toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
- }
- LLPipeline::sUseOcclusion = use_occlusion;
- LLPipeline::sRenderingHUDs = FALSE;
- }
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
-
- set_current_projection(current_proj);
- set_current_modelview(current_mod);
+
+ gPipeline.stateSort(hud_cam, result);
+
+ gPipeline.renderGeomPostDeferred(hud_cam);
+
+ LLSpatialGroup::sNoDelete = FALSE;
+ //gPipeline.clearReferences();
+
+ render_hud_elements();
+
+ //restore type mask
+ gPipeline.popRenderTypeMask();
+
+ if (has_ui)
+ {
+ gPipeline.toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
+ }
+ LLPipeline::sUseOcclusion = use_occlusion;
+ LLPipeline::sRenderingHUDs = FALSE;
+ }
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+
+ set_current_projection(current_proj);
+ set_current_modelview(current_mod);
}
LLRect get_whole_screen_region()
{
- LLRect whole_screen = gViewerWindow->getWorldViewRectScaled();
-
- // apply camera zoom transform (for high res screenshots)
- F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
- S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();
- if (zoom_factor > 1.f)
- {
- S32 num_horizontal_tiles = llceil(zoom_factor);
- S32 tile_width = ll_round((F32)gViewerWindow->getWorldViewWidthScaled() / zoom_factor);
- S32 tile_height = ll_round((F32)gViewerWindow->getWorldViewHeightScaled() / zoom_factor);
- int tile_y = sub_region / num_horizontal_tiles;
- int tile_x = sub_region - (tile_y * num_horizontal_tiles);
-
- whole_screen.setLeftTopAndSize(tile_x * tile_width, gViewerWindow->getWorldViewHeightScaled() - (tile_y * tile_height), tile_width, tile_height);
- }
- return whole_screen;
+ LLRect whole_screen = gViewerWindow->getWorldViewRectScaled();
+
+ // apply camera zoom transform (for high res screenshots)
+ F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
+ S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();
+ if (zoom_factor > 1.f)
+ {
+ S32 num_horizontal_tiles = llceil(zoom_factor);
+ S32 tile_width = ll_round((F32)gViewerWindow->getWorldViewWidthScaled() / zoom_factor);
+ S32 tile_height = ll_round((F32)gViewerWindow->getWorldViewHeightScaled() / zoom_factor);
+ int tile_y = sub_region / num_horizontal_tiles;
+ int tile_x = sub_region - (tile_y * num_horizontal_tiles);
+
+ whole_screen.setLeftTopAndSize(tile_x * tile_width, gViewerWindow->getWorldViewHeightScaled() - (tile_y * tile_height), tile_width, tile_height);
+ }
+ return whole_screen;
}
bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model)
{
- if (isAgentAvatarValid() && gAgentAvatarp->hasHUDAttachment())
- {
- F32 zoom_level = gAgentCamera.mHUDCurZoom;
- LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
-
- F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
- proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth);
- proj.element(2,2) = -0.01f;
-
- F32 aspect_ratio = LLViewerCamera::getInstance()->getAspect();
-
- glh::matrix4f mat;
- F32 scale_x = (F32)gViewerWindow->getWorldViewWidthScaled() / (F32)screen_region.getWidth();
- F32 scale_y = (F32)gViewerWindow->getWorldViewHeightScaled() / (F32)screen_region.getHeight();
- mat.set_scale(glh::vec3f(scale_x, scale_y, 1.f));
- mat.set_translate(
- glh::vec3f(clamp_rescale((F32)(screen_region.getCenterX() - screen_region.mLeft), 0.f, (F32)gViewerWindow->getWorldViewWidthScaled(), 0.5f * scale_x * aspect_ratio, -0.5f * scale_x * aspect_ratio),
- clamp_rescale((F32)(screen_region.getCenterY() - screen_region.mBottom), 0.f, (F32)gViewerWindow->getWorldViewHeightScaled(), 0.5f * scale_y, -0.5f * scale_y),
- 0.f));
- proj *= mat;
-
- glh::matrix4f tmp_model((GLfloat*) OGL_TO_CFR_ROTATION);
-
- mat.set_scale(glh::vec3f(zoom_level, zoom_level, zoom_level));
- mat.set_translate(glh::vec3f(-hud_bbox.getCenterLocal().mV[VX] + (hud_depth * 0.5f), 0.f, 0.f));
-
- tmp_model *= mat;
- model = tmp_model;
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ if (isAgentAvatarValid() && gAgentAvatarp->hasHUDAttachment())
+ {
+ F32 zoom_level = gAgentCamera.mHUDCurZoom;
+ LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
+
+ F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
+ proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth);
+ proj.element(2,2) = -0.01f;
+
+ F32 aspect_ratio = LLViewerCamera::getInstance()->getAspect();
+
+ glh::matrix4f mat;
+ F32 scale_x = (F32)gViewerWindow->getWorldViewWidthScaled() / (F32)screen_region.getWidth();
+ F32 scale_y = (F32)gViewerWindow->getWorldViewHeightScaled() / (F32)screen_region.getHeight();
+ mat.set_scale(glh::vec3f(scale_x, scale_y, 1.f));
+ mat.set_translate(
+ glh::vec3f(clamp_rescale((F32)(screen_region.getCenterX() - screen_region.mLeft), 0.f, (F32)gViewerWindow->getWorldViewWidthScaled(), 0.5f * scale_x * aspect_ratio, -0.5f * scale_x * aspect_ratio),
+ clamp_rescale((F32)(screen_region.getCenterY() - screen_region.mBottom), 0.f, (F32)gViewerWindow->getWorldViewHeightScaled(), 0.5f * scale_y, -0.5f * scale_y),
+ 0.f));
+ proj *= mat;
+
+ glh::matrix4f tmp_model((GLfloat*) OGL_TO_CFR_ROTATION);
+
+ mat.set_scale(glh::vec3f(zoom_level, zoom_level, zoom_level));
+ mat.set_translate(glh::vec3f(-hud_bbox.getCenterLocal().mV[VX] + (hud_depth * 0.5f), 0.f, 0.f));
+
+ tmp_model *= mat;
+ model = tmp_model;
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
bool get_hud_matrices(glh::matrix4f &proj, glh::matrix4f &model)
{
- LLRect whole_screen = get_whole_screen_region();
- return get_hud_matrices(whole_screen, proj, model);
+ LLRect whole_screen = get_whole_screen_region();
+ return get_hud_matrices(whole_screen, proj, model);
}
bool setup_hud_matrices()
{
- LLRect whole_screen = get_whole_screen_region();
- return setup_hud_matrices(whole_screen);
+ LLRect whole_screen = get_whole_screen_region();
+ return setup_hud_matrices(whole_screen);
}
bool setup_hud_matrices(const LLRect& screen_region)
{
- glh::matrix4f proj, model;
- bool result = get_hud_matrices(screen_region, proj, model);
- if (!result) return result;
-
- // set up transform to keep HUD objects in front of camera
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.loadMatrix(proj.m);
- set_current_projection(proj);
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.loadMatrix(model.m);
- set_current_modelview(model);
- return TRUE;
+ glh::matrix4f proj, model;
+ bool result = get_hud_matrices(screen_region, proj, model);
+ if (!result) return result;
+
+ // set up transform to keep HUD objects in front of camera
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadMatrix(proj.m);
+ set_current_projection(proj);
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.loadMatrix(model.m);
+ set_current_modelview(model);
+ return TRUE;
}
void render_ui(F32 zoom_factor, int subfield)
@@ -1336,45 +1336,45 @@ void render_ui(F32 zoom_factor, int subfield)
LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_UI ); // render time capture - Primary UI stat can have HUD time overlap (TODO)
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI);
LL_PROFILE_GPU_ZONE("ui");
- LLGLState::checkStates();
-
- glh::matrix4f saved_view = get_current_modelview();
-
- if (!gSnapshot)
- {
- gGL.pushMatrix();
- gGL.loadMatrix(gGLLastModelView);
- set_current_modelview(copy_matrix(gGLLastModelView));
- }
-
- if(LLSceneMonitor::getInstance()->needsUpdate())
- {
- gGL.pushMatrix();
- gViewerWindow->setup2DRender();
- LLSceneMonitor::getInstance()->compare();
- gViewerWindow->setup3DRender();
- gGL.popMatrix();
- }
+ LLGLState::checkStates();
+
+ glh::matrix4f saved_view = get_current_modelview();
+
+ if (!gSnapshot)
+ {
+ gGL.pushMatrix();
+ gGL.loadMatrix(gGLLastModelView);
+ set_current_modelview(copy_matrix(gGLLastModelView));
+ }
+
+ if(LLSceneMonitor::getInstance()->needsUpdate())
+ {
+ gGL.pushMatrix();
+ gViewerWindow->setup2DRender();
+ LLSceneMonitor::getInstance()->compare();
+ gViewerWindow->setup3DRender();
+ gGL.popMatrix();
+ }
// apply gamma correction and post effects
gPipeline.renderFinalize();
- {
+ {
LLGLState::checkStates();
LL_PROFILE_ZONE_NAMED_CATEGORY_UI("HUD");
- render_hud_elements();
+ render_hud_elements();
LLGLState::checkStates();
- render_hud_attachments();
+ render_hud_attachments();
LLGLState::checkStates();
- LLGLSDefault gls_default;
- LLGLSUIDefault gls_ui;
- {
- gPipeline.disableLights();
- }
+ LLGLSDefault gls_default;
+ LLGLSUIDefault gls_ui;
+ {
+ gPipeline.disableLights();
+ }
bool render_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
if (render_ui)
@@ -1402,13 +1402,13 @@ void render_ui(F32 zoom_factor, int subfield)
gViewerWindow->setup2DRender();
gViewerWindow->updateDebugText();
gViewerWindow->drawDebugText();
- }
+ }
- if (!gSnapshot)
- {
- set_current_modelview(saved_view);
- gGL.popMatrix();
- }
+ if (!gSnapshot)
+ {
+ set_current_modelview(saved_view);
+ gGL.popMatrix();
+ }
}
void swap()
@@ -1416,112 +1416,112 @@ void swap()
LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_SWAP ); // render time capture - Swap buffer time - can signify excessive data transfer to/from GPU
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Swap");
LL_PROFILE_GPU_ZONE("swap");
- if (gDisplaySwapBuffers)
- {
- gViewerWindow->getWindow()->swapBuffers();
- }
- gDisplaySwapBuffers = TRUE;
+ if (gDisplaySwapBuffers)
+ {
+ gViewerWindow->getWindow()->swapBuffers();
+ }
+ gDisplaySwapBuffers = TRUE;
}
void renderCoordinateAxes()
{
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.begin(LLRender::LINES);
- gGL.color3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red
- gGL.vertex3f(0.0f, 0.0f, 0.0f);
- gGL.vertex3f(2.0f, 0.0f, 0.0f);
- gGL.vertex3f(3.0f, 0.0f, 0.0f);
- gGL.vertex3f(5.0f, 0.0f, 0.0f);
- gGL.vertex3f(6.0f, 0.0f, 0.0f);
- gGL.vertex3f(8.0f, 0.0f, 0.0f);
- // Make an X
- gGL.vertex3f(11.0f, 1.0f, 1.0f);
- gGL.vertex3f(11.0f, -1.0f, -1.0f);
- gGL.vertex3f(11.0f, 1.0f, -1.0f);
- gGL.vertex3f(11.0f, -1.0f, 1.0f);
-
- gGL.color3f(0.0f, 1.0f, 0.0f); // j direction = Y-Axis = green
- gGL.vertex3f(0.0f, 0.0f, 0.0f);
- gGL.vertex3f(0.0f, 2.0f, 0.0f);
- gGL.vertex3f(0.0f, 3.0f, 0.0f);
- gGL.vertex3f(0.0f, 5.0f, 0.0f);
- gGL.vertex3f(0.0f, 6.0f, 0.0f);
- gGL.vertex3f(0.0f, 8.0f, 0.0f);
- // Make a Y
- gGL.vertex3f(1.0f, 11.0f, 1.0f);
- gGL.vertex3f(0.0f, 11.0f, 0.0f);
- gGL.vertex3f(-1.0f, 11.0f, 1.0f);
- gGL.vertex3f(0.0f, 11.0f, 0.0f);
- gGL.vertex3f(0.0f, 11.0f, 0.0f);
- gGL.vertex3f(0.0f, 11.0f, -1.0f);
-
- gGL.color3f(0.0f, 0.0f, 1.0f); // Z-Axis = blue
- gGL.vertex3f(0.0f, 0.0f, 0.0f);
- gGL.vertex3f(0.0f, 0.0f, 2.0f);
- gGL.vertex3f(0.0f, 0.0f, 3.0f);
- gGL.vertex3f(0.0f, 0.0f, 5.0f);
- gGL.vertex3f(0.0f, 0.0f, 6.0f);
- gGL.vertex3f(0.0f, 0.0f, 8.0f);
- // Make a Z
- gGL.vertex3f(-1.0f, 1.0f, 11.0f);
- gGL.vertex3f(1.0f, 1.0f, 11.0f);
- gGL.vertex3f(1.0f, 1.0f, 11.0f);
- gGL.vertex3f(-1.0f, -1.0f, 11.0f);
- gGL.vertex3f(-1.0f, -1.0f, 11.0f);
- gGL.vertex3f(1.0f, -1.0f, 11.0f);
- gGL.end();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.begin(LLRender::LINES);
+ gGL.color3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red
+ gGL.vertex3f(0.0f, 0.0f, 0.0f);
+ gGL.vertex3f(2.0f, 0.0f, 0.0f);
+ gGL.vertex3f(3.0f, 0.0f, 0.0f);
+ gGL.vertex3f(5.0f, 0.0f, 0.0f);
+ gGL.vertex3f(6.0f, 0.0f, 0.0f);
+ gGL.vertex3f(8.0f, 0.0f, 0.0f);
+ // Make an X
+ gGL.vertex3f(11.0f, 1.0f, 1.0f);
+ gGL.vertex3f(11.0f, -1.0f, -1.0f);
+ gGL.vertex3f(11.0f, 1.0f, -1.0f);
+ gGL.vertex3f(11.0f, -1.0f, 1.0f);
+
+ gGL.color3f(0.0f, 1.0f, 0.0f); // j direction = Y-Axis = green
+ gGL.vertex3f(0.0f, 0.0f, 0.0f);
+ gGL.vertex3f(0.0f, 2.0f, 0.0f);
+ gGL.vertex3f(0.0f, 3.0f, 0.0f);
+ gGL.vertex3f(0.0f, 5.0f, 0.0f);
+ gGL.vertex3f(0.0f, 6.0f, 0.0f);
+ gGL.vertex3f(0.0f, 8.0f, 0.0f);
+ // Make a Y
+ gGL.vertex3f(1.0f, 11.0f, 1.0f);
+ gGL.vertex3f(0.0f, 11.0f, 0.0f);
+ gGL.vertex3f(-1.0f, 11.0f, 1.0f);
+ gGL.vertex3f(0.0f, 11.0f, 0.0f);
+ gGL.vertex3f(0.0f, 11.0f, 0.0f);
+ gGL.vertex3f(0.0f, 11.0f, -1.0f);
+
+ gGL.color3f(0.0f, 0.0f, 1.0f); // Z-Axis = blue
+ gGL.vertex3f(0.0f, 0.0f, 0.0f);
+ gGL.vertex3f(0.0f, 0.0f, 2.0f);
+ gGL.vertex3f(0.0f, 0.0f, 3.0f);
+ gGL.vertex3f(0.0f, 0.0f, 5.0f);
+ gGL.vertex3f(0.0f, 0.0f, 6.0f);
+ gGL.vertex3f(0.0f, 0.0f, 8.0f);
+ // Make a Z
+ gGL.vertex3f(-1.0f, 1.0f, 11.0f);
+ gGL.vertex3f(1.0f, 1.0f, 11.0f);
+ gGL.vertex3f(1.0f, 1.0f, 11.0f);
+ gGL.vertex3f(-1.0f, -1.0f, 11.0f);
+ gGL.vertex3f(-1.0f, -1.0f, 11.0f);
+ gGL.vertex3f(1.0f, -1.0f, 11.0f);
+ gGL.end();
}
-void draw_axes()
+void draw_axes()
{
- LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- // A vertical white line at origin
- LLVector3 v = gAgent.getPositionAgent();
- gGL.begin(LLRender::LINES);
- gGL.color3f(1.0f, 1.0f, 1.0f);
- gGL.vertex3f(0.0f, 0.0f, 0.0f);
- gGL.vertex3f(0.0f, 0.0f, 40.0f);
- gGL.end();
- // Some coordinate axes
- gGL.pushMatrix();
- gGL.translatef( v.mV[VX], v.mV[VY], v.mV[VZ] );
- renderCoordinateAxes();
- gGL.popMatrix();
+ LLGLSUIDefault gls_ui;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ // A vertical white line at origin
+ LLVector3 v = gAgent.getPositionAgent();
+ gGL.begin(LLRender::LINES);
+ gGL.color3f(1.0f, 1.0f, 1.0f);
+ gGL.vertex3f(0.0f, 0.0f, 0.0f);
+ gGL.vertex3f(0.0f, 0.0f, 40.0f);
+ gGL.end();
+ // Some coordinate axes
+ gGL.pushMatrix();
+ gGL.translatef( v.mV[VX], v.mV[VY], v.mV[VZ] );
+ renderCoordinateAxes();
+ gGL.popMatrix();
}
void render_ui_3d()
{
- LLGLSPipeline gls_pipeline;
-
- //////////////////////////////////////
- //
- // Render 3D UI elements
- // NOTE: zbuffer is cleared before we get here by LLDrawPoolHUD,
- // so 3d elements requiring Z buffer are moved to LLDrawPoolHUD
- //
-
- /////////////////////////////////////////////////////////////
- //
- // Render 2.5D elements (2D elements in the world)
- // Stuff without z writes
- //
-
- // Debugging stuff goes before the UI.
-
- stop_glerror();
-
- gUIProgram.bind();
+ LLGLSPipeline gls_pipeline;
+
+ //////////////////////////////////////
+ //
+ // Render 3D UI elements
+ // NOTE: zbuffer is cleared before we get here by LLDrawPoolHUD,
+ // so 3d elements requiring Z buffer are moved to LLDrawPoolHUD
+ //
+
+ /////////////////////////////////////////////////////////////
+ //
+ // Render 2.5D elements (2D elements in the world)
+ // Stuff without z writes
+ //
+
+ // Debugging stuff goes before the UI.
+
+ stop_glerror();
+
+ gUIProgram.bind();
gGL.color4f(1, 1, 1, 1);
- // Coordinate axes
- if (gSavedSettings.getBOOL("ShowAxes"))
- {
- draw_axes();
- }
+ // Coordinate axes
+ if (gSavedSettings.getBOOL("ShowAxes"))
+ {
+ draw_axes();
+ }
- gViewerWindow->renderSelections(FALSE, FALSE, TRUE); // Non HUD call in render_hud_elements
+ gViewerWindow->renderSelections(FALSE, FALSE, TRUE); // Non HUD call in render_hud_elements
if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
{
@@ -1531,205 +1531,205 @@ void render_ui_3d()
gSky.addSunMoonBeacons();
}
- stop_glerror();
+ stop_glerror();
}
void render_ui_2d()
{
- LLGLSUIDefault gls_ui;
+ LLGLSUIDefault gls_ui;
- /////////////////////////////////////////////////////////////
- //
- // Render 2D UI elements that overlay the world (no z compare)
+ /////////////////////////////////////////////////////////////
+ //
+ // Render 2D UI elements that overlay the world (no z compare)
- // Disable wireframe mode below here, as this is HUD/menus
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ // Disable wireframe mode below here, as this is HUD/menus
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- // Menu overlays, HUD, etc
- gViewerWindow->setup2DRender();
+ // Menu overlays, HUD, etc
+ gViewerWindow->setup2DRender();
- F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
- S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();
+ F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
+ S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();
- if (zoom_factor > 1.f)
- {
- //decompose subregion number to x and y values
- int pos_y = sub_region / llceil(zoom_factor);
- int pos_x = sub_region - (pos_y*llceil(zoom_factor));
- // offset for this tile
- LLFontGL::sCurOrigin.mX -= ll_round((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor);
- LLFontGL::sCurOrigin.mY -= ll_round((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor);
- }
+ if (zoom_factor > 1.f)
+ {
+ //decompose subregion number to x and y values
+ int pos_y = sub_region / llceil(zoom_factor);
+ int pos_x = sub_region - (pos_y*llceil(zoom_factor));
+ // offset for this tile
+ LLFontGL::sCurOrigin.mX -= ll_round((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor);
+ LLFontGL::sCurOrigin.mY -= ll_round((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor);
+ }
- stop_glerror();
+ stop_glerror();
- // render outline for HUD
- if (isAgentAvatarValid() && gAgentCamera.mHUDCurZoom < 0.98f)
- {
+ // render outline for HUD
+ if (isAgentAvatarValid() && gAgentCamera.mHUDCurZoom < 0.98f)
+ {
gUIProgram.bind();
- gGL.pushMatrix();
- S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2);
- S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2);
- gGL.scalef(LLUI::getScaleFactor().mV[0], LLUI::getScaleFactor().mV[1], 1.f);
- gGL.translatef((F32)half_width, (F32)half_height, 0.f);
- F32 zoom = gAgentCamera.mHUDCurZoom;
- gGL.scalef(zoom,zoom,1.f);
- gGL.color4fv(LLColor4::white.mV);
- gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE);
- gGL.popMatrix();
+ gGL.pushMatrix();
+ S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2);
+ S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2);
+ gGL.scalef(LLUI::getScaleFactor().mV[0], LLUI::getScaleFactor().mV[1], 1.f);
+ gGL.translatef((F32)half_width, (F32)half_height, 0.f);
+ F32 zoom = gAgentCamera.mHUDCurZoom;
+ gGL.scalef(zoom,zoom,1.f);
+ gGL.color4fv(LLColor4::white.mV);
+ gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE);
+ gGL.popMatrix();
gUIProgram.unbind();
- stop_glerror();
- }
-
-
- if (gSavedSettings.getBOOL("RenderUIBuffer"))
- {
- if (LLView::sIsRectDirty)
- {
+ stop_glerror();
+ }
+
+
+ if (gSavedSettings.getBOOL("RenderUIBuffer"))
+ {
+ if (LLView::sIsRectDirty)
+ {
LLView::sIsRectDirty = false;
- LLRect t_rect;
+ LLRect t_rect;
- gPipeline.mRT->uiScreen.bindTarget();
- gGL.setColorMask(true, true);
- {
- static const S32 pad = 8;
+ gPipeline.mRT->uiScreen.bindTarget();
+ gGL.setColorMask(true, true);
+ {
+ static const S32 pad = 8;
LLView::sDirtyRect.mLeft -= pad;
LLView::sDirtyRect.mRight += pad;
LLView::sDirtyRect.mBottom -= pad;
LLView::sDirtyRect.mTop += pad;
- LLGLEnable scissor(GL_SCISSOR_TEST);
- static LLRect last_rect = LLView::sDirtyRect;
+ LLGLEnable scissor(GL_SCISSOR_TEST);
+ static LLRect last_rect = LLView::sDirtyRect;
+
+ //union with last rect to avoid mouse poop
+ last_rect.unionWith(LLView::sDirtyRect);
- //union with last rect to avoid mouse poop
- last_rect.unionWith(LLView::sDirtyRect);
-
- t_rect = LLView::sDirtyRect;
+ t_rect = LLView::sDirtyRect;
LLView::sDirtyRect = last_rect;
- last_rect = t_rect;
+ last_rect = t_rect;
+
+ last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::getScaleFactor().mV[0]);
+ last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::getScaleFactor().mV[0]);
+ last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::getScaleFactor().mV[1]);
+ last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::getScaleFactor().mV[1]);
- last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::getScaleFactor().mV[0]);
- last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::getScaleFactor().mV[0]);
- last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::getScaleFactor().mV[1]);
- last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::getScaleFactor().mV[1]);
+ LLRect clip_rect(last_rect);
- LLRect clip_rect(last_rect);
-
- glClear(GL_COLOR_BUFFER_BIT);
+ glClear(GL_COLOR_BUFFER_BIT);
- gViewerWindow->draw();
- }
+ gViewerWindow->draw();
+ }
- gPipeline.mRT->uiScreen.flush();
- gGL.setColorMask(true, false);
+ gPipeline.mRT->uiScreen.flush();
+ gGL.setColorMask(true, false);
LLView::sDirtyRect = t_rect;
- }
-
- LLGLDisable cull(GL_CULL_FACE);
- LLGLDisable blend(GL_BLEND);
- S32 width = gViewerWindow->getWindowWidthScaled();
- S32 height = gViewerWindow->getWindowHeightScaled();
- gGL.getTexUnit(0)->bind(&gPipeline.mRT->uiScreen);
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.color4f(1,1,1,1);
- gGL.texCoord2f(0, 0); gGL.vertex2i(0, 0);
- gGL.texCoord2f(width, 0); gGL.vertex2i(width, 0);
- gGL.texCoord2f(0, height); gGL.vertex2i(0, height);
- gGL.texCoord2f(width, height); gGL.vertex2i(width, height);
- gGL.end();
- }
- else
- {
- gViewerWindow->draw();
- }
-
-
-
- // reset current origin for font rendering, in case of tiling render
- LLFontGL::sCurOrigin.set(0, 0);
+ }
+
+ LLGLDisable cull(GL_CULL_FACE);
+ LLGLDisable blend(GL_BLEND);
+ S32 width = gViewerWindow->getWindowWidthScaled();
+ S32 height = gViewerWindow->getWindowHeightScaled();
+ gGL.getTexUnit(0)->bind(&gPipeline.mRT->uiScreen);
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.color4f(1,1,1,1);
+ gGL.texCoord2f(0, 0); gGL.vertex2i(0, 0);
+ gGL.texCoord2f(width, 0); gGL.vertex2i(width, 0);
+ gGL.texCoord2f(0, height); gGL.vertex2i(0, height);
+ gGL.texCoord2f(width, height); gGL.vertex2i(width, height);
+ gGL.end();
+ }
+ else
+ {
+ gViewerWindow->draw();
+ }
+
+
+
+ // reset current origin for font rendering, in case of tiling render
+ LLFontGL::sCurOrigin.set(0, 0);
}
void render_disconnected_background()
{
- gUIProgram.bind();
-
- gGL.color4f(1,1,1,1);
- if (!gDisconnectedImagep && gDisconnected)
- {
- LL_INFOS() << "Loading last bitmap..." << LL_ENDL;
-
- std::string temp_str;
- temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + LLStartUp::getScreenLastFilename();
-
- LLPointer<LLImagePNG> image_png = new LLImagePNG;
- if( !image_png->load(temp_str) )
- {
- //LL_INFOS() << "Bitmap load failed" << LL_ENDL;
- return;
- }
-
- LLPointer<LLImageRaw> raw = new LLImageRaw;
- if (!image_png->decode(raw, 0.0f))
- {
- LL_INFOS() << "Bitmap decode failed" << LL_ENDL;
- gDisconnectedImagep = NULL;
- return;
- }
-
- U8 *rawp = raw->getData();
- S32 npixels = (S32)image_png->getWidth()*(S32)image_png->getHeight();
- for (S32 i = 0; i < npixels; i++)
- {
- S32 sum = 0;
- sum = *rawp + *(rawp+1) + *(rawp+2);
- sum /= 3;
- *rawp = ((S32)sum*6 + *rawp)/7;
- rawp++;
- *rawp = ((S32)sum*6 + *rawp)/7;
- rawp++;
- *rawp = ((S32)sum*6 + *rawp)/7;
- rawp++;
- }
-
-
- raw->expandToPowerOfTwo();
- gDisconnectedImagep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE );
- gStartTexture = gDisconnectedImagep;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- }
-
- // Make sure the progress view always fills the entire window.
- S32 width = gViewerWindow->getWindowWidthScaled();
- S32 height = gViewerWindow->getWindowHeightScaled();
-
- if (gDisconnectedImagep)
- {
- LLGLSUIDefault gls_ui;
- gViewerWindow->setup2DRender();
- gGL.pushMatrix();
- {
- // scale ui to reflect UIScaleFactor
- // this can't be done in setup2DRender because it requires a
- // pushMatrix/popMatrix pair
- const LLVector2& display_scale = gViewerWindow->getDisplayScale();
- gGL.scalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
-
- gGL.getTexUnit(0)->bind(gDisconnectedImagep);
- gGL.color4f(1.f, 1.f, 1.f, 1.f);
- gl_rect_2d_simple_tex(width, height);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- }
- gGL.popMatrix();
- }
- gGL.flush();
-
- gUIProgram.unbind();
+ gUIProgram.bind();
+
+ gGL.color4f(1,1,1,1);
+ if (!gDisconnectedImagep && gDisconnected)
+ {
+ LL_INFOS() << "Loading last bitmap..." << LL_ENDL;
+
+ std::string temp_str;
+ temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + LLStartUp::getScreenLastFilename();
+
+ LLPointer<LLImagePNG> image_png = new LLImagePNG;
+ if( !image_png->load(temp_str) )
+ {
+ //LL_INFOS() << "Bitmap load failed" << LL_ENDL;
+ return;
+ }
+
+ LLPointer<LLImageRaw> raw = new LLImageRaw;
+ if (!image_png->decode(raw, 0.0f))
+ {
+ LL_INFOS() << "Bitmap decode failed" << LL_ENDL;
+ gDisconnectedImagep = NULL;
+ return;
+ }
+
+ U8 *rawp = raw->getData();
+ S32 npixels = (S32)image_png->getWidth()*(S32)image_png->getHeight();
+ for (S32 i = 0; i < npixels; i++)
+ {
+ S32 sum = 0;
+ sum = *rawp + *(rawp+1) + *(rawp+2);
+ sum /= 3;
+ *rawp = ((S32)sum*6 + *rawp)/7;
+ rawp++;
+ *rawp = ((S32)sum*6 + *rawp)/7;
+ rawp++;
+ *rawp = ((S32)sum*6 + *rawp)/7;
+ rawp++;
+ }
+
+
+ raw->expandToPowerOfTwo();
+ gDisconnectedImagep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE );
+ gStartTexture = gDisconnectedImagep;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+
+ // Make sure the progress view always fills the entire window.
+ S32 width = gViewerWindow->getWindowWidthScaled();
+ S32 height = gViewerWindow->getWindowHeightScaled();
+
+ if (gDisconnectedImagep)
+ {
+ LLGLSUIDefault gls_ui;
+ gViewerWindow->setup2DRender();
+ gGL.pushMatrix();
+ {
+ // scale ui to reflect UIScaleFactor
+ // this can't be done in setup2DRender because it requires a
+ // pushMatrix/popMatrix pair
+ const LLVector2& display_scale = gViewerWindow->getDisplayScale();
+ gGL.scalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
+
+ gGL.getTexUnit(0)->bind(gDisconnectedImagep);
+ gGL.color4f(1.f, 1.f, 1.f, 1.f);
+ gl_rect_2d_simple_tex(width, height);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ gGL.popMatrix();
+ }
+ gGL.flush();
+
+ gUIProgram.unbind();
}
void display_cleanup()
{
- gDisconnectedImagep = NULL;
+ gDisconnectedImagep = NULL;
}
diff --git a/indra/newview/llviewerdisplay.h b/indra/newview/llviewerdisplay.h
index e8072193ea..dbbf56200a 100644
--- a/indra/newview/llviewerdisplay.h
+++ b/indra/newview/llviewerdisplay.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerdisplay.h
* @brief LLViewerDisplay class header file
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,9 +36,9 @@ void display(BOOL rebuild = TRUE, F32 zoom_factor = 1.f, int subfield = 0, BOOL
extern BOOL gDisplaySwapBuffers;
extern BOOL gDepthDirty;
-extern BOOL gTeleportDisplay;
-extern LLFrameTimer gTeleportDisplayTimer;
-extern BOOL gForceRenderLandFence;
+extern BOOL gTeleportDisplay;
+extern LLFrameTimer gTeleportDisplayTimer;
+extern BOOL gForceRenderLandFence;
extern BOOL gResizeScreenTexture;
extern BOOL gResizeShadowTexture;
extern BOOL gWindowResized;
diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp
index cec08c4f15..243d4dec0e 100644
--- a/indra/newview/llviewerdisplayname.cpp
+++ b/indra/newview/llviewerdisplayname.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerdisplayname.cpp
* @brief Wrapper for display name functionality
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,63 +39,63 @@
#include "llavatarnamecache.h"
#include "llhttpnode.h"
#include "llnotificationsutil.h"
-#include "llui.h" // getLanguage()
+#include "llui.h" // getLanguage()
namespace LLViewerDisplayName
{
- // Fired when viewer receives server response to display name change
- set_name_signal_t sSetDisplayNameSignal;
+ // Fired when viewer receives server response to display name change
+ set_name_signal_t sSetDisplayNameSignal;
- // Fired when there is a change in the agent's name
- name_changed_signal_t sNameChangedSignal;
+ // Fired when there is a change in the agent's name
+ name_changed_signal_t sNameChangedSignal;
- void addNameChangedCallback(const name_changed_signal_t::slot_type& cb)
- {
- sNameChangedSignal.connect(cb);
- }
+ void addNameChangedCallback(const name_changed_signal_t::slot_type& cb)
+ {
+ sNameChangedSignal.connect(cb);
+ }
- void doNothing() { }
+ void doNothing() { }
}
void LLViewerDisplayName::set(const std::string& display_name, const set_name_slot_t& slot)
{
- // TODO: simple validation here
-
- LLViewerRegion* region = gAgent.getRegion();
- llassert(region);
- std::string cap_url = region->getCapability("SetDisplayName");
- if (cap_url.empty())
- {
- // this server does not support display names, report error
- slot(false, "unsupported", LLSD());
- return;
- }
-
- // People API requires both the old and new value to change a variable.
- // Our display name will be in cache before the viewer's UI is available
- // to request a change, so we can use direct lookup without callback.
- LLAvatarName av_name;
- if (!LLAvatarNameCache::get( gAgent.getID(), &av_name))
- {
- slot(false, "name unavailable", LLSD());
- return;
- }
-
- // People API expects array of [ "old value", "new value" ]
- LLSD change_array = LLSD::emptyArray();
- change_array.append(av_name.getDisplayName());
- change_array.append(display_name);
-
- LL_INFOS() << "Set name POST to " << cap_url << LL_ENDL;
-
- // Record our caller for when the server sends back a reply
- sSetDisplayNameSignal.connect(slot);
-
- // POST the requested change. The sim will not send a response back to
- // this request directly, rather it will send a separate message after it
- // communicates with the back-end.
- LLSD body;
- body["display_name"] = change_array;
+ // TODO: simple validation here
+
+ LLViewerRegion* region = gAgent.getRegion();
+ llassert(region);
+ std::string cap_url = region->getCapability("SetDisplayName");
+ if (cap_url.empty())
+ {
+ // this server does not support display names, report error
+ slot(false, "unsupported", LLSD());
+ return;
+ }
+
+ // People API requires both the old and new value to change a variable.
+ // Our display name will be in cache before the viewer's UI is available
+ // to request a change, so we can use direct lookup without callback.
+ LLAvatarName av_name;
+ if (!LLAvatarNameCache::get( gAgent.getID(), &av_name))
+ {
+ slot(false, "name unavailable", LLSD());
+ return;
+ }
+
+ // People API expects array of [ "old value", "new value" ]
+ LLSD change_array = LLSD::emptyArray();
+ change_array.append(av_name.getDisplayName());
+ change_array.append(display_name);
+
+ LL_INFOS() << "Set name POST to " << cap_url << LL_ENDL;
+
+ // Record our caller for when the server sends back a reply
+ sSetDisplayNameSignal.connect(slot);
+
+ // POST the requested change. The sim will not send a response back to
+ // this request directly, rather it will send a separate message after it
+ // communicates with the back-end.
+ LLSD body;
+ body["display_name"] = change_array;
LLCoros::instance().launch("LLViewerDisplayName::SetDisplayNameCoro",
boost::bind(&LLViewerDisplayName::setDisplayNameCoro, cap_url, body));
}
@@ -127,100 +127,100 @@ void LLViewerDisplayName::setDisplayNameCoro(const std::string& cap_url, const L
class LLSetDisplayNameReply : public LLHTTPNode
{
- LOG_CLASS(LLSetDisplayNameReply);
+ LOG_CLASS(LLSetDisplayNameReply);
public:
- /*virtual*/ void post(
- LLHTTPNode::ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- LLSD body = input["body"];
-
- S32 status = body["status"].asInteger();
- bool success = (status == HTTP_OK);
- std::string reason = body["reason"].asString();
- LLSD content = body["content"];
-
- LL_INFOS() << "status " << status << " reason " << reason << LL_ENDL;
-
- // If viewer's concept of display name is out-of-date, the set request
- // will fail with 409 Conflict. If that happens, fetch up-to-date
- // name information.
- if (status == HTTP_CONFLICT)
- {
- LLUUID agent_id = gAgent.getID();
- // Flush stale data
- LLAvatarNameCache::getInstance()->erase( agent_id );
- // Queue request for new data: nothing to do on callback though...
- // Note: no need to disconnect the callback as it never gets out of scope
+ /*virtual*/ void post(
+ LLHTTPNode::ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LLSD body = input["body"];
+
+ S32 status = body["status"].asInteger();
+ bool success = (status == HTTP_OK);
+ std::string reason = body["reason"].asString();
+ LLSD content = body["content"];
+
+ LL_INFOS() << "status " << status << " reason " << reason << LL_ENDL;
+
+ // If viewer's concept of display name is out-of-date, the set request
+ // will fail with 409 Conflict. If that happens, fetch up-to-date
+ // name information.
+ if (status == HTTP_CONFLICT)
+ {
+ LLUUID agent_id = gAgent.getID();
+ // Flush stale data
+ LLAvatarNameCache::getInstance()->erase( agent_id );
+ // Queue request for new data: nothing to do on callback though...
+ // Note: no need to disconnect the callback as it never gets out of scope
LLAvatarNameCache::getInstance()->get(agent_id, boost::bind(&LLViewerDisplayName::doNothing));
- // Kill name tag, as it is wrong
- LLVOAvatar::invalidateNameTag( agent_id );
- }
-
- // inform caller of result
- LLViewerDisplayName::sSetDisplayNameSignal(success, reason, content);
- LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots();
- }
+ // Kill name tag, as it is wrong
+ LLVOAvatar::invalidateNameTag( agent_id );
+ }
+
+ // inform caller of result
+ LLViewerDisplayName::sSetDisplayNameSignal(success, reason, content);
+ LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots();
+ }
};
class LLDisplayNameUpdate : public LLHTTPNode
{
- /*virtual*/ void post(
- LLHTTPNode::ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- LLSD body = input["body"];
- LLUUID agent_id = body["agent_id"];
- std::string old_display_name = body["old_display_name"];
- // By convention this record is called "agent" in the People API
- LLSD name_data = body["agent"];
-
- // Inject the new name data into cache
- LLAvatarName av_name;
- av_name.fromLLSD( name_data );
-
- LL_INFOS() << "name-update now " << LLDate::now()
- << " next_update " << LLDate(av_name.mNextUpdate)
- << LL_ENDL;
-
- // Name expiration time may be provided in headers, or we may use a
- // default value
- // *TODO: get actual headers out of ResponsePtr
- //LLSD headers = response->mHeaders;
- LLSD headers;
- av_name.mExpires =
+ /*virtual*/ void post(
+ LLHTTPNode::ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LLSD body = input["body"];
+ LLUUID agent_id = body["agent_id"];
+ std::string old_display_name = body["old_display_name"];
+ // By convention this record is called "agent" in the People API
+ LLSD name_data = body["agent"];
+
+ // Inject the new name data into cache
+ LLAvatarName av_name;
+ av_name.fromLLSD( name_data );
+
+ LL_INFOS() << "name-update now " << LLDate::now()
+ << " next_update " << LLDate(av_name.mNextUpdate)
+ << LL_ENDL;
+
+ // Name expiration time may be provided in headers, or we may use a
+ // default value
+ // *TODO: get actual headers out of ResponsePtr
+ //LLSD headers = response->mHeaders;
+ LLSD headers;
+ av_name.mExpires =
LLAvatarNameCache::getInstance()->nameExpirationFromHeaders(headers);
LLAvatarNameCache::getInstance()->insert(agent_id, av_name);
- // force name tag to update
- LLVOAvatar::invalidateNameTag(agent_id);
+ // force name tag to update
+ LLVOAvatar::invalidateNameTag(agent_id);
- LLSD args;
- args["OLD_NAME"] = old_display_name;
- args["SLID"] = av_name.getUserName();
- args["NEW_NAME"] = av_name.getDisplayName();
- LLNotificationsUtil::add("DisplayNameUpdate", args);
- if (agent_id == gAgent.getID())
- {
- LLViewerDisplayName::sNameChangedSignal();
- }
+ LLSD args;
+ args["OLD_NAME"] = old_display_name;
+ args["SLID"] = av_name.getUserName();
+ args["NEW_NAME"] = av_name.getDisplayName();
+ LLNotificationsUtil::add("DisplayNameUpdate", args);
+ if (agent_id == gAgent.getID())
+ {
+ LLViewerDisplayName::sNameChangedSignal();
+ }
LLFloaterProfile* profile_floater = dynamic_cast<LLFloaterProfile*>(LLFloaterReg::findInstance("profile", LLSD().with("id", agent_id)));
if (profile_floater)
{
profile_floater->refreshName();
}
- }
+ }
};
LLHTTPRegistration<LLSetDisplayNameReply>
gHTTPRegistrationMessageSetDisplayNameReply(
- "/message/SetDisplayNameReply");
+ "/message/SetDisplayNameReply");
LLHTTPRegistration<LLDisplayNameUpdate>
gHTTPRegistrationMessageDisplayNameUpdate(
- "/message/DisplayNameUpdate");
+ "/message/DisplayNameUpdate");
diff --git a/indra/newview/llviewerdisplayname.h b/indra/newview/llviewerdisplayname.h
index 337aaa68b6..6da3108780 100644
--- a/indra/newview/llviewerdisplayname.h
+++ b/indra/newview/llviewerdisplayname.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerdisplayname.h
* @brief Wrapper for display name functionality
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,22 +34,22 @@ class LLUUID;
namespace LLViewerDisplayName
{
- typedef boost::signals2::signal<
- void (bool success, const std::string& reason, const LLSD& content)>
- set_name_signal_t;
- typedef set_name_signal_t::slot_type set_name_slot_t;
-
- typedef boost::signals2::signal<void (void)> name_changed_signal_t;
- typedef name_changed_signal_t::slot_type name_changed_slot_t;
-
- // Sends an update to the server to change a display name
- // and call back when done. May not succeed due to service
- // unavailable or name not available.
- void set(const std::string& display_name, const set_name_slot_t& slot);
+ typedef boost::signals2::signal<
+ void (bool success, const std::string& reason, const LLSD& content)>
+ set_name_signal_t;
+ typedef set_name_signal_t::slot_type set_name_slot_t;
+
+ typedef boost::signals2::signal<void (void)> name_changed_signal_t;
+ typedef name_changed_signal_t::slot_type name_changed_slot_t;
+
+ // Sends an update to the server to change a display name
+ // and call back when done. May not succeed due to service
+ // unavailable or name not available.
+ void set(const std::string& display_name, const set_name_slot_t& slot);
void setDisplayNameCoro(const std::string& cap_url, const LLSD& body);
- void addNameChangedCallback(const name_changed_signal_t::slot_type& cb);
+ void addNameChangedCallback(const name_changed_signal_t::slot_type& cb);
}
#endif // LLVIEWERDISPLAYNAME_H
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 1b34bed2da..ceda2675d5 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerfloaterreg.cpp
* @brief LLViewerFloaterReg class registers floaters used in the viewer
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -180,8 +180,8 @@ const std::string FLOATER_PROFILE("profile");
class LLFloaterOpenHandler : public LLCommandHandler
{
public:
- // requires trusted browser to trigger or an explicit click
- LLFloaterOpenHandler() : LLCommandHandler("openfloater", UNTRUSTED_THROTTLE) { }
+ // requires trusted browser to trigger or an explicit click
+ LLFloaterOpenHandler() : LLCommandHandler("openfloater", UNTRUSTED_THROTTLE) { }
bool canHandleUntrusted(
const LLSD& params,
@@ -193,7 +193,7 @@ public:
{
return true; // will fail silently
}
-
+
std::string fl_name = params[0].asString();
// External browsers explicitly ask user about opening links
@@ -280,234 +280,234 @@ public:
return true;
}
- bool handle(
+ bool handle(
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web) override
- {
- if (params.size() != 1)
- {
- return false;
- }
+ {
+ if (params.size() != 1)
+ {
+ return false;
+ }
- const std::string floater_name = LLURI::unescape(params[0].asString());
+ const std::string floater_name = LLURI::unescape(params[0].asString());
LLSD key;
if (floater_name == FLOATER_PROFILE)
{
key["id"] = gAgentID;
}
- LLFloaterReg::showInstance(floater_name, key);
+ LLFloaterReg::showInstance(floater_name, key);
- return true;
- }
+ return true;
+ }
};
LLFloaterOpenHandler gFloaterOpenHandler;
void LLViewerFloaterReg::registerFloaters()
{
- if (gNonInteractive)
- {
- return;
- }
- // *NOTE: Please keep these alphabetized for easier merges
-
- LLFloaterAboutUtil::registerFloater();
- LLFloaterReg::add("360capture", "floater_360capture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater360Capture>);
- LLFloaterReg::add("block_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFastTimerView>);
- LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLand>);
- LLFloaterReg::add("add_payment_method", "floater_add_payment_method.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAddPaymentMethod>);
- LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
- LLFloaterReg::add("associate_listing", "floater_associate_listing.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAssociateListing>);
- LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>);
- LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatar>);
- LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarPicker>);
- LLFloaterReg::add("avatar_render_settings", "floater_avatar_render_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarRenderSettings>);
- LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarTextures>);
-
- LLFloaterReg::add("ban_duration", "floater_ban_duration.xml", &LLFloaterReg::build<LLFloaterBanDuration>);
- LLFloaterReg::add("beacons", "floater_beacons.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBeacons>);
- LLFloaterReg::add("bulk_perms", "floater_bulk_perms.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBulkPermission>);
- LLFloaterReg::add("buy_currency", "floater_buy_currency.xml", &LLFloaterBuyCurrency::buildFloater);
- LLFloaterReg::add("buy_currency_html", "floater_buy_currency_html.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuyCurrencyHTML>);
- LLFloaterReg::add("buy_land", "floater_buy_land.xml", &LLFloaterBuyLand::buildFloater);
- LLFloaterReg::add("buy_object", "floater_buy_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuy>);
- LLFloaterReg::add("buy_object_contents", "floater_buy_contents.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuyContents>);
- LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTools>);
- LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuildOptions>);
- LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBump>);
-
- LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCamera>);
- LLFloaterReg::add("camera_presets", "floater_camera_presets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCameraPresets>);
- LLFloaterReg::add("chat_voice", "floater_voice_chat_volume.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterChatVoiceVolume>);
+ if (gNonInteractive)
+ {
+ return;
+ }
+ // *NOTE: Please keep these alphabetized for easier merges
+
+ LLFloaterAboutUtil::registerFloater();
+ LLFloaterReg::add("360capture", "floater_360capture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater360Capture>);
+ LLFloaterReg::add("block_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFastTimerView>);
+ LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLand>);
+ LLFloaterReg::add("add_payment_method", "floater_add_payment_method.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAddPaymentMethod>);
+ LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
+ LLFloaterReg::add("associate_listing", "floater_associate_listing.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAssociateListing>);
+ LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>);
+ LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatar>);
+ LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarPicker>);
+ LLFloaterReg::add("avatar_render_settings", "floater_avatar_render_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarRenderSettings>);
+ LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarTextures>);
+
+ LLFloaterReg::add("ban_duration", "floater_ban_duration.xml", &LLFloaterReg::build<LLFloaterBanDuration>);
+ LLFloaterReg::add("beacons", "floater_beacons.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBeacons>);
+ LLFloaterReg::add("bulk_perms", "floater_bulk_perms.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBulkPermission>);
+ LLFloaterReg::add("buy_currency", "floater_buy_currency.xml", &LLFloaterBuyCurrency::buildFloater);
+ LLFloaterReg::add("buy_currency_html", "floater_buy_currency_html.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuyCurrencyHTML>);
+ LLFloaterReg::add("buy_land", "floater_buy_land.xml", &LLFloaterBuyLand::buildFloater);
+ LLFloaterReg::add("buy_object", "floater_buy_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuy>);
+ LLFloaterReg::add("buy_object_contents", "floater_buy_contents.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuyContents>);
+ LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTools>);
+ LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuildOptions>);
+ LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBump>);
+
+ LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCamera>);
+ LLFloaterReg::add("camera_presets", "floater_camera_presets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCameraPresets>);
+ LLFloaterReg::add("chat_voice", "floater_voice_chat_volume.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterChatVoiceVolume>);
LLFloaterReg::add("change_item_thumbnail", "floater_change_item_thumbnail.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterChangeItemThumbnail>);
- LLFloaterReg::add("nearby_chat", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterIMNearbyChat::buildFloater);
- LLFloaterReg::add("classified", "floater_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterClassified>);
- LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCompileQueue>);
- LLFloaterReg::add("conversation", "floater_conversation_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterConversationLog>);
- LLFloaterReg::add("add_landmark", "floater_create_landmark.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCreateLandmark>);
-
- LLFloaterReg::add("delete_pref_preset", "floater_delete_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDeletePrefPreset>);
- LLFloaterReg::add("destinations", "floater_destinations.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDestinations>);
-
- LLFloaterReg::add("emoji_picker", "floater_emoji_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEmojiPicker>);
- LLFloaterReg::add("emoji_complete", "floater_emoji_complete.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEmojiComplete>);
- LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPostProcess>);
-
- LLFloaterReg::add("env_fixed_environmentent_water", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFixedEnvironmentWater>);
- LLFloaterReg::add("env_fixed_environmentent_sky", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFixedEnvironmentSky>);
-
- LLFloaterReg::add("env_adjust_snapshot", "floater_adjust_environment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvironmentAdjust>);
-
- LLFloaterReg::add("env_edit_extdaycycle", "floater_edit_ext_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditExtDayCycle>);
- LLFloaterReg::add("my_environments", "floater_my_environments.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyEnvironment>);
-
- LLFloaterReg::add("event", "floater_event.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEvent>);
- LLFloaterReg::add("experiences", "floater_experiences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterExperiences>);
- LLFloaterReg::add("experience_profile", "floater_experienceprofile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterExperienceProfile>);
- LLFloaterReg::add("experience_search", "floater_experience_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterExperiencePicker>);
-
- LLFloaterReg::add("font_test", "floater_font_test.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFontTest>);
- LLFloaterReg::add("forget_username", "floater_forget_user.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterForgetUser>);
-
- LLFloaterReg::add("gestures", "floater_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGesture>);
- LLFloaterReg::add("god_tools", "floater_god_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGodTools>);
- LLFloaterReg::add("grid_status", "floater_grid_status.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGridStatus>);
- LLFloaterReg::add("group_picker", "floater_choose_group.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGroupPicker>);
-
- LLFloaterReg::add("help_browser", "floater_help_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHelpBrowser>);
- LLFloaterReg::add("edit_hover_height", "floater_edit_hover_height.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHoverHeight>);
- LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHUD>);
-
- LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterIMSession>);
- LLFloaterReg::add("im_container", "floater_im_container.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterIMContainer>);
- LLFloaterReg::add("im_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMWellWindow>);
- LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIncomingCallDialog>);
- LLFloaterReg::add("inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
- LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInspect>);
+ LLFloaterReg::add("nearby_chat", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterIMNearbyChat::buildFloater);
+ LLFloaterReg::add("classified", "floater_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterClassified>);
+ LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCompileQueue>);
+ LLFloaterReg::add("conversation", "floater_conversation_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterConversationLog>);
+ LLFloaterReg::add("add_landmark", "floater_create_landmark.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCreateLandmark>);
+
+ LLFloaterReg::add("delete_pref_preset", "floater_delete_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDeletePrefPreset>);
+ LLFloaterReg::add("destinations", "floater_destinations.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDestinations>);
+
+ LLFloaterReg::add("emoji_picker", "floater_emoji_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEmojiPicker>);
+ LLFloaterReg::add("emoji_complete", "floater_emoji_complete.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEmojiComplete>);
+ LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPostProcess>);
+
+ LLFloaterReg::add("env_fixed_environmentent_water", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFixedEnvironmentWater>);
+ LLFloaterReg::add("env_fixed_environmentent_sky", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFixedEnvironmentSky>);
+
+ LLFloaterReg::add("env_adjust_snapshot", "floater_adjust_environment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvironmentAdjust>);
+
+ LLFloaterReg::add("env_edit_extdaycycle", "floater_edit_ext_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditExtDayCycle>);
+ LLFloaterReg::add("my_environments", "floater_my_environments.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyEnvironment>);
+
+ LLFloaterReg::add("event", "floater_event.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEvent>);
+ LLFloaterReg::add("experiences", "floater_experiences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterExperiences>);
+ LLFloaterReg::add("experience_profile", "floater_experienceprofile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterExperienceProfile>);
+ LLFloaterReg::add("experience_search", "floater_experience_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterExperiencePicker>);
+
+ LLFloaterReg::add("font_test", "floater_font_test.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFontTest>);
+ LLFloaterReg::add("forget_username", "floater_forget_user.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterForgetUser>);
+
+ LLFloaterReg::add("gestures", "floater_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGesture>);
+ LLFloaterReg::add("god_tools", "floater_god_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGodTools>);
+ LLFloaterReg::add("grid_status", "floater_grid_status.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGridStatus>);
+ LLFloaterReg::add("group_picker", "floater_choose_group.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGroupPicker>);
+
+ LLFloaterReg::add("help_browser", "floater_help_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHelpBrowser>);
+ LLFloaterReg::add("edit_hover_height", "floater_edit_hover_height.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHoverHeight>);
+ LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHUD>);
+
+ LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterIMSession>);
+ LLFloaterReg::add("im_container", "floater_im_container.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterIMContainer>);
+ LLFloaterReg::add("im_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMWellWindow>);
+ LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIncomingCallDialog>);
+ LLFloaterReg::add("inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
+ LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInspect>);
LLFloaterReg::add("inventory_thumbnails_helper", "floater_inventory_thumbnails_helper.xml", (LLFloaterBuildFunc) &LLFloaterReg::build<LLFloaterInventoryThumbnailsHelper>);
- LLFloaterReg::add("item_properties", "floater_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterItemProperties>);
+ LLFloaterReg::add("item_properties", "floater_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterItemProperties>);
LLFloaterReg::add("task_properties", "floater_task_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterItemProperties>);
LLFloaterReg::add("inventory_settings", "floater_inventory_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInventorySettings>);
- LLInspectAvatarUtil::registerFloater();
- LLInspectGroupUtil::registerFloater();
- LLInspectObjectUtil::registerFloater();
- LLInspectRemoteObjectUtil::registerFloater();
- LLFloaterVoiceVolumeUtil::registerFloater();
- LLNotificationsUI::registerFloater();
- LLFloaterDisplayNameUtil::registerFloater();
-
- LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLagMeter>);
- LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLandHoldings>);
- LLFloaterReg::add("linkreplace", "floater_linkreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLinkReplace>);
- LLFloaterReg::add("load_pref_preset", "floater_load_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLoadPrefPreset>);
-
- LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMemLeak>);
-
- LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMediaSettings>);
- LLFloaterReg::add("marketplace_listings", "floater_marketplace_listings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMarketplaceListings>);
- LLFloaterReg::add("marketplace_validation", "floater_marketplace_validation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMarketplaceValidation>);
- LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);
- LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);
- LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMove>);
- LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGetBlockedObjectName>);
- LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMap>);
+ LLInspectAvatarUtil::registerFloater();
+ LLInspectGroupUtil::registerFloater();
+ LLInspectObjectUtil::registerFloater();
+ LLInspectRemoteObjectUtil::registerFloater();
+ LLFloaterVoiceVolumeUtil::registerFloater();
+ LLNotificationsUI::registerFloater();
+ LLFloaterDisplayNameUtil::registerFloater();
+
+ LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLagMeter>);
+ LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLandHoldings>);
+ LLFloaterReg::add("linkreplace", "floater_linkreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLinkReplace>);
+ LLFloaterReg::add("load_pref_preset", "floater_load_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLoadPrefPreset>);
+
+ LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMemLeak>);
+
+ LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMediaSettings>);
+ LLFloaterReg::add("marketplace_listings", "floater_marketplace_listings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMarketplaceListings>);
+ LLFloaterReg::add("marketplace_validation", "floater_marketplace_validation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMarketplaceValidation>);
+ LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);
+ LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);
+ LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMove>);
+ LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGetBlockedObjectName>);
+ LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMap>);
LLFloaterReg::add("new_feature_notification", "floater_new_feature_notification.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNewFeatureNotification>);
- LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotificationConsole>);
-
- LLFloaterReg::add("notification_well_window", "floater_notifications_tabbed.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotificationsTabbed>);
-
- LLFloaterReg::add("object_weights", "floater_object_weights.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterObjectWeights>);
- LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOpenObject>);
- LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>);
- LLFloaterPayUtil::registerFloater();
-
- LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingCharacters>);
- LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingLinksets>);
- LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingConsole>);
- LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
- LLFloaterReg::add("performance", "floater_performance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPerformance>);
- LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPermsDefault>);
- LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
- LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
- LLFloaterReg::add("prefs_graphics_advanced", "floater_preferences_graphics_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceGraphicsAdvanced>);
- LLFloaterReg::add("prefs_view_advanced", "floater_preferences_view_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceViewAdvanced>);
- LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceProxy>);
- LLFloaterReg::add("prefs_spellchecker_import", "floater_spellcheck_import.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSpellCheckerImport>);
- LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTranslationSettings>);
- LLFloaterReg::add("prefs_spellchecker", "floater_spellcheck.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSpellCheckerSettings>);
- LLFloaterReg::add("prefs_autoreplace", "floater_autoreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAutoReplaceSettings>);
- LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterJoystick>);
- LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewAnim>, "preview");
- LLFloaterReg::add("preview_conversation", "floater_conversation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterConversationPreview>);
- LLFloaterReg::add("preview_gesture", "floater_preview_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewGesture>, "preview");
- LLFloaterReg::add("preview_notecard", "floater_preview_notecard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewNotecard>, "preview");
- LLFloaterReg::add("preview_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewLSL>, "preview");
- LLFloaterReg::add("preview_scriptedit", "floater_live_lsleditor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLLiveLSLEditor>, "preview");
- LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewSound>, "preview");
- LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewTexture>, "preview");
- LLFloaterReg::add("preview_trash", "floater_preview_trash.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreviewTrash>);
- LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPublishClassifiedFloater>);
- LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSavePrefPreset>);
- LLFloaterReg::add("save_camera_preset", "floater_save_camera_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSaveCameraPreset>);
- LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptEdPrefs>);
+ LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotificationConsole>);
+
+ LLFloaterReg::add("notification_well_window", "floater_notifications_tabbed.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotificationsTabbed>);
+
+ LLFloaterReg::add("object_weights", "floater_object_weights.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterObjectWeights>);
+ LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOpenObject>);
+ LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>);
+ LLFloaterPayUtil::registerFloater();
+
+ LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingCharacters>);
+ LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingLinksets>);
+ LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingConsole>);
+ LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
+ LLFloaterReg::add("performance", "floater_performance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPerformance>);
+ LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPermsDefault>);
+ LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
+ LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
+ LLFloaterReg::add("prefs_graphics_advanced", "floater_preferences_graphics_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceGraphicsAdvanced>);
+ LLFloaterReg::add("prefs_view_advanced", "floater_preferences_view_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceViewAdvanced>);
+ LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceProxy>);
+ LLFloaterReg::add("prefs_spellchecker_import", "floater_spellcheck_import.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSpellCheckerImport>);
+ LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTranslationSettings>);
+ LLFloaterReg::add("prefs_spellchecker", "floater_spellcheck.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSpellCheckerSettings>);
+ LLFloaterReg::add("prefs_autoreplace", "floater_autoreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAutoReplaceSettings>);
+ LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterJoystick>);
+ LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewAnim>, "preview");
+ LLFloaterReg::add("preview_conversation", "floater_conversation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterConversationPreview>);
+ LLFloaterReg::add("preview_gesture", "floater_preview_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewGesture>, "preview");
+ LLFloaterReg::add("preview_notecard", "floater_preview_notecard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewNotecard>, "preview");
+ LLFloaterReg::add("preview_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewLSL>, "preview");
+ LLFloaterReg::add("preview_scriptedit", "floater_live_lsleditor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLLiveLSLEditor>, "preview");
+ LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewSound>, "preview");
+ LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewTexture>, "preview");
+ LLFloaterReg::add("preview_trash", "floater_preview_trash.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreviewTrash>);
+ LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPublishClassifiedFloater>);
+ LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSavePrefPreset>);
+ LLFloaterReg::add("save_camera_preset", "floater_save_camera_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSaveCameraPreset>);
+ LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptEdPrefs>);
LLFloaterReg::add("material_editor", "floater_material_editor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLMaterialEditor>);
LLFloaterReg::add("live_material_editor", "floater_live_material_editor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLMaterialEditor>);
-
- LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build<LLFloaterTelehub>);
- LLFloaterReg::add("test_inspectors", "floater_test_inspectors.xml", &LLFloaterReg::build<LLFloaterTestInspectors>);
- //LLFloaterReg::add("test_list_view", "floater_test_list_view.xml",&LLFloaterReg::build<LLFloaterTestListView>);
- LLFloaterReg::add("test_textbox", "floater_test_textbox.xml", &LLFloaterReg::build<LLFloater>);
- LLFloaterReg::add("test_text_editor", "floater_test_text_editor.xml", &LLFloaterReg::build<LLFloater>);
- LLFloaterReg::add("test_widgets", "floater_test_widgets.xml", &LLFloaterReg::build<LLFloater>);
- LLFloaterReg::add("top_objects", "floater_top_objects.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTopObjects>);
- LLFloaterReg::add("toybox", "floater_toybox.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterToybox>);
-
- LLFloaterReg::add("reporter", "floater_report_abuse.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterReporter>);
- LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterResetQueue>);
- LLFloaterReg::add("region_debug_console", "floater_region_debug_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionDebugConsole>);
- LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionInfo>);
- LLFloaterReg::add("region_restarting", "floater_region_restarting.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionRestarting>);
-
- LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebug>);
- LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebugOutput>);
- LLFloaterReg::add("script_floater", "floater_script.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLScriptFloater>);
- LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptLimits>);
- LLFloaterReg::add("my_scripts", "floater_my_scripts.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyScripts>);
- LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater);
- LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>);
- LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundDevices>);
- LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>);
- LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRunQueue>);
- LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSceneLoadStats>);
- LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>);
- LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>);
+
+ LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build<LLFloaterTelehub>);
+ LLFloaterReg::add("test_inspectors", "floater_test_inspectors.xml", &LLFloaterReg::build<LLFloaterTestInspectors>);
+ //LLFloaterReg::add("test_list_view", "floater_test_list_view.xml",&LLFloaterReg::build<LLFloaterTestListView>);
+ LLFloaterReg::add("test_textbox", "floater_test_textbox.xml", &LLFloaterReg::build<LLFloater>);
+ LLFloaterReg::add("test_text_editor", "floater_test_text_editor.xml", &LLFloaterReg::build<LLFloater>);
+ LLFloaterReg::add("test_widgets", "floater_test_widgets.xml", &LLFloaterReg::build<LLFloater>);
+ LLFloaterReg::add("top_objects", "floater_top_objects.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTopObjects>);
+ LLFloaterReg::add("toybox", "floater_toybox.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterToybox>);
+
+ LLFloaterReg::add("reporter", "floater_report_abuse.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterReporter>);
+ LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterResetQueue>);
+ LLFloaterReg::add("region_debug_console", "floater_region_debug_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionDebugConsole>);
+ LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionInfo>);
+ LLFloaterReg::add("region_restarting", "floater_region_restarting.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionRestarting>);
+
+ LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebug>);
+ LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebugOutput>);
+ LLFloaterReg::add("script_floater", "floater_script.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLScriptFloater>);
+ LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptLimits>);
+ LLFloaterReg::add("my_scripts", "floater_my_scripts.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyScripts>);
+ LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater);
+ LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>);
+ LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundDevices>);
+ LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>);
+ LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRunQueue>);
+ LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSceneLoadStats>);
+ LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>);
+ LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>);
LLFloaterReg::add("simple_snapshot", "floater_simple_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSimpleSnapshot>);
LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
LLFloaterReg::add("profile", "floater_profile.xml",(LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterProfile>);
- LLFloaterReg::add("guidebook", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHowTo>);
-
- LLFloaterReg::add("big_preview", "floater_big_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBigPreview>);
-
- LLFloaterUIPreviewUtil::registerFloater();
- LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBvhPreview>, "upload");
- LLFloaterReg::add("upload_anim_anim", "floater_animation_anim_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAnimPreview>, "upload");
- LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterImagePreview>, "upload");
- LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterModelPreview>, "upload");
- LLFloaterReg::add("upload_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptPreview>, "upload");
- LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundPreview>, "upload");
-
- LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterVoiceEffect>);
-
- LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
- LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWhiteListEntry>);
- LLFloaterReg::add("window_size", "floater_window_size.xml", &LLFloaterReg::build<LLFloaterWindowSize>);
- LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWorldMap>);
-
- // *NOTE: Please keep these alphabetized for easier merges
-
- LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving
+ LLFloaterReg::add("guidebook", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHowTo>);
+
+ LLFloaterReg::add("big_preview", "floater_big_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBigPreview>);
+
+ LLFloaterUIPreviewUtil::registerFloater();
+ LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBvhPreview>, "upload");
+ LLFloaterReg::add("upload_anim_anim", "floater_animation_anim_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAnimPreview>, "upload");
+ LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterImagePreview>, "upload");
+ LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterModelPreview>, "upload");
+ LLFloaterReg::add("upload_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptPreview>, "upload");
+ LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundPreview>, "upload");
+
+ LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterVoiceEffect>);
+
+ LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
+ LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWhiteListEntry>);
+ LLFloaterReg::add("window_size", "floater_window_size.xml", &LLFloaterReg::build<LLFloaterWindowSize>);
+ LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWorldMap>);
+
+ // *NOTE: Please keep these alphabetized for easier merges
+
+ LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving
}
diff --git a/indra/newview/llviewerfloaterreg.h b/indra/newview/llviewerfloaterreg.h
index 8a827a003e..428d7ae5b9 100644
--- a/indra/newview/llviewerfloaterreg.h
+++ b/indra/newview/llviewerfloaterreg.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerfloaterreg.h
* @brief The LLViewerFloaterReg class declaration
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@
class LLViewerFloaterReg
{
public:
- static void registerFloaters();
+ static void registerFloaters();
};
diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp
index c8d4aae8fd..69eb82bb0b 100644
--- a/indra/newview/llviewerfoldertype.cpp
+++ b/indra/newview/llviewerfoldertype.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfoldertype.cpp
* @brief Implementation of LLViewerFolderType functionality.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,284 +38,284 @@ static const std::string empty_string;
struct ViewerFolderEntry : public LLDictionaryEntry
{
- // Constructor for non-ensembles
- ViewerFolderEntry(const std::string &new_category_name, // default name when creating a new category of this type
- const std::string &icon_name_open, // name of the folder icon
- const std::string &icon_name_closed,
- BOOL is_quiet, // folder doesn't need a UI update when changed
- bool hide_if_empty, // folder not shown if empty
- const std::string &dictionary_name = empty_string // no reverse lookup needed on non-ensembles, so in most cases just leave this blank
- )
- :
- LLDictionaryEntry(dictionary_name),
- mNewCategoryName(new_category_name),
- mIconNameOpen(icon_name_open),
- mIconNameClosed(icon_name_closed),
- mIsQuiet(is_quiet),
- mHideIfEmpty(hide_if_empty)
- {
- mAllowedNames.clear();
- }
-
- // Constructor for ensembles
- ViewerFolderEntry(const std::string &xui_name, // name of the xui menu item
- const std::string &new_category_name, // default name when creating a new category of this type
- const std::string &icon_name, // name of the folder icon
- const std::string allowed_names // allowed item typenames for this folder type
- )
- :
- LLDictionaryEntry(xui_name),
- /* Just use default icons until we actually support ensembles
- mIconNameOpen(icon_name),
- mIconNameClosed(icon_name),
- */
- mIconNameOpen("Inv_FolderOpen"), mIconNameClosed("Inv_FolderClosed"),
- mNewCategoryName(new_category_name),
- mIsQuiet(FALSE),
- mHideIfEmpty(false)
- {
- const std::string delims (",");
- LLStringUtilBase<char>::getTokens(allowed_names, mAllowedNames, delims);
- }
-
- bool getIsAllowedName(const std::string &name) const
- {
- if (mAllowedNames.empty())
- return false;
- for (name_vec_t::const_iterator iter = mAllowedNames.begin();
- iter != mAllowedNames.end();
- iter++)
- {
- if (name == (*iter))
- return true;
- }
- return false;
- }
- const std::string mIconNameOpen;
- const std::string mIconNameClosed;
- const std::string mNewCategoryName;
- typedef std::vector<std::string> name_vec_t;
- name_vec_t mAllowedNames;
- BOOL mIsQuiet;
- bool mHideIfEmpty;
+ // Constructor for non-ensembles
+ ViewerFolderEntry(const std::string &new_category_name, // default name when creating a new category of this type
+ const std::string &icon_name_open, // name of the folder icon
+ const std::string &icon_name_closed,
+ BOOL is_quiet, // folder doesn't need a UI update when changed
+ bool hide_if_empty, // folder not shown if empty
+ const std::string &dictionary_name = empty_string // no reverse lookup needed on non-ensembles, so in most cases just leave this blank
+ )
+ :
+ LLDictionaryEntry(dictionary_name),
+ mNewCategoryName(new_category_name),
+ mIconNameOpen(icon_name_open),
+ mIconNameClosed(icon_name_closed),
+ mIsQuiet(is_quiet),
+ mHideIfEmpty(hide_if_empty)
+ {
+ mAllowedNames.clear();
+ }
+
+ // Constructor for ensembles
+ ViewerFolderEntry(const std::string &xui_name, // name of the xui menu item
+ const std::string &new_category_name, // default name when creating a new category of this type
+ const std::string &icon_name, // name of the folder icon
+ const std::string allowed_names // allowed item typenames for this folder type
+ )
+ :
+ LLDictionaryEntry(xui_name),
+ /* Just use default icons until we actually support ensembles
+ mIconNameOpen(icon_name),
+ mIconNameClosed(icon_name),
+ */
+ mIconNameOpen("Inv_FolderOpen"), mIconNameClosed("Inv_FolderClosed"),
+ mNewCategoryName(new_category_name),
+ mIsQuiet(FALSE),
+ mHideIfEmpty(false)
+ {
+ const std::string delims (",");
+ LLStringUtilBase<char>::getTokens(allowed_names, mAllowedNames, delims);
+ }
+
+ bool getIsAllowedName(const std::string &name) const
+ {
+ if (mAllowedNames.empty())
+ return false;
+ for (name_vec_t::const_iterator iter = mAllowedNames.begin();
+ iter != mAllowedNames.end();
+ iter++)
+ {
+ if (name == (*iter))
+ return true;
+ }
+ return false;
+ }
+ const std::string mIconNameOpen;
+ const std::string mIconNameClosed;
+ const std::string mNewCategoryName;
+ typedef std::vector<std::string> name_vec_t;
+ name_vec_t mAllowedNames;
+ BOOL mIsQuiet;
+ bool mHideIfEmpty;
};
class LLViewerFolderDictionary : public LLSingleton<LLViewerFolderDictionary>,
- public LLDictionary<LLFolderType::EType, ViewerFolderEntry>
+ public LLDictionary<LLFolderType::EType, ViewerFolderEntry>
{
- LLSINGLETON(LLViewerFolderDictionary);
+ LLSINGLETON(LLViewerFolderDictionary);
protected:
- bool initEnsemblesFromFile(); // Reads in ensemble information from foldertypes.xml
+ bool initEnsemblesFromFile(); // Reads in ensemble information from foldertypes.xml
};
LLViewerFolderDictionary::LLViewerFolderDictionary()
{
- // NEW CATEGORY NAME FOLDER OPEN FOLDER CLOSED QUIET? HIDE IF EMPTY?
- // |-------------------------|-----------------------|----------------------|-----------|--------------|
- addEntry(LLFolderType::FT_TEXTURE, new ViewerFolderEntry("Textures", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_SOUND, new ViewerFolderEntry("Sounds", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_CALLINGCARD, new ViewerFolderEntry("Calling Cards", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_LANDMARK, new ViewerFolderEntry("Landmarks", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_CLOTHING, new ViewerFolderEntry("Clothing", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_OBJECT, new ViewerFolderEntry("Objects", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_NOTECARD, new ViewerFolderEntry("Notecards", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_ROOT_INVENTORY, new ViewerFolderEntry("My Inventory", "Inv_SysOpen", "Inv_SysClosed", FALSE, false));
- addEntry(LLFolderType::FT_LSL_TEXT, new ViewerFolderEntry("Scripts", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_BODYPART, new ViewerFolderEntry("Body Parts", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_TRASH, new ViewerFolderEntry("Trash", "Inv_TrashOpen", "Inv_TrashClosed", TRUE, false));
- addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new ViewerFolderEntry("Photo Album", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_LOST_AND_FOUND, new ViewerFolderEntry("Lost And Found", "Inv_LostOpen", "Inv_LostClosed", TRUE, true));
- addEntry(LLFolderType::FT_ANIMATION, new ViewerFolderEntry("Animations", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_GESTURE, new ViewerFolderEntry("Gestures", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_FAVORITE, new ViewerFolderEntry("Favorites", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
-
- addEntry(LLFolderType::FT_CURRENT_OUTFIT, new ViewerFolderEntry("Current Outfit", "Inv_SysOpen", "Inv_SysClosed", TRUE, false));
- addEntry(LLFolderType::FT_OUTFIT, new ViewerFolderEntry("New Outfit", "Inv_LookFolderOpen", "Inv_LookFolderClosed", TRUE, false));
- addEntry(LLFolderType::FT_MY_OUTFITS, new ViewerFolderEntry("My Outfits", "Inv_SysOpen", "Inv_SysClosed", TRUE, true));
- addEntry(LLFolderType::FT_MESH, new ViewerFolderEntry("Meshes", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_SETTINGS, new ViewerFolderEntry("Settings", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
- addEntry(LLFolderType::FT_MATERIAL, new ViewerFolderEntry("Materials", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
-
- bool boxes_invisible = !gSavedSettings.getBOOL("InventoryOutboxMakeVisible");
- addEntry(LLFolderType::FT_INBOX, new ViewerFolderEntry("Received Items", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible));
- addEntry(LLFolderType::FT_OUTBOX, new ViewerFolderEntry("Merchant Outbox", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
-
- addEntry(LLFolderType::FT_BASIC_ROOT, new ViewerFolderEntry("Basic Root", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
-
- addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new ViewerFolderEntry("Marketplace Listings", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible));
- addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new ViewerFolderEntry("New Stock", "Inv_StockFolderOpen", "Inv_StockFolderClosed", FALSE, false, "default"));
- addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new ViewerFolderEntry("New Version", "Inv_VersionFolderOpen","Inv_VersionFolderClosed", FALSE, false, "default"));
-
- addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default"));
-
- for (U32 type = (U32)LLFolderType::FT_ENSEMBLE_START; type <= (U32)LLFolderType::FT_ENSEMBLE_END; ++type)
- {
- addEntry((LLFolderType::EType)type, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false));
- }
+ // NEW CATEGORY NAME FOLDER OPEN FOLDER CLOSED QUIET? HIDE IF EMPTY?
+ // |-------------------------|-----------------------|----------------------|-----------|--------------|
+ addEntry(LLFolderType::FT_TEXTURE, new ViewerFolderEntry("Textures", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_SOUND, new ViewerFolderEntry("Sounds", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_CALLINGCARD, new ViewerFolderEntry("Calling Cards", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_LANDMARK, new ViewerFolderEntry("Landmarks", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_CLOTHING, new ViewerFolderEntry("Clothing", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_OBJECT, new ViewerFolderEntry("Objects", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_NOTECARD, new ViewerFolderEntry("Notecards", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_ROOT_INVENTORY, new ViewerFolderEntry("My Inventory", "Inv_SysOpen", "Inv_SysClosed", FALSE, false));
+ addEntry(LLFolderType::FT_LSL_TEXT, new ViewerFolderEntry("Scripts", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_BODYPART, new ViewerFolderEntry("Body Parts", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_TRASH, new ViewerFolderEntry("Trash", "Inv_TrashOpen", "Inv_TrashClosed", TRUE, false));
+ addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new ViewerFolderEntry("Photo Album", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_LOST_AND_FOUND, new ViewerFolderEntry("Lost And Found", "Inv_LostOpen", "Inv_LostClosed", TRUE, true));
+ addEntry(LLFolderType::FT_ANIMATION, new ViewerFolderEntry("Animations", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_GESTURE, new ViewerFolderEntry("Gestures", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_FAVORITE, new ViewerFolderEntry("Favorites", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+
+ addEntry(LLFolderType::FT_CURRENT_OUTFIT, new ViewerFolderEntry("Current Outfit", "Inv_SysOpen", "Inv_SysClosed", TRUE, false));
+ addEntry(LLFolderType::FT_OUTFIT, new ViewerFolderEntry("New Outfit", "Inv_LookFolderOpen", "Inv_LookFolderClosed", TRUE, false));
+ addEntry(LLFolderType::FT_MY_OUTFITS, new ViewerFolderEntry("My Outfits", "Inv_SysOpen", "Inv_SysClosed", TRUE, true));
+ addEntry(LLFolderType::FT_MESH, new ViewerFolderEntry("Meshes", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_SETTINGS, new ViewerFolderEntry("Settings", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+ addEntry(LLFolderType::FT_MATERIAL, new ViewerFolderEntry("Materials", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+
+ bool boxes_invisible = !gSavedSettings.getBOOL("InventoryOutboxMakeVisible");
+ addEntry(LLFolderType::FT_INBOX, new ViewerFolderEntry("Received Items", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible));
+ addEntry(LLFolderType::FT_OUTBOX, new ViewerFolderEntry("Merchant Outbox", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+
+ addEntry(LLFolderType::FT_BASIC_ROOT, new ViewerFolderEntry("Basic Root", "Inv_SysOpen", "Inv_SysClosed", FALSE, true));
+
+ addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new ViewerFolderEntry("Marketplace Listings", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible));
+ addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new ViewerFolderEntry("New Stock", "Inv_StockFolderOpen", "Inv_StockFolderClosed", FALSE, false, "default"));
+ addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new ViewerFolderEntry("New Version", "Inv_VersionFolderOpen","Inv_VersionFolderClosed", FALSE, false, "default"));
+
+ addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default"));
+
+ for (U32 type = (U32)LLFolderType::FT_ENSEMBLE_START; type <= (U32)LLFolderType::FT_ENSEMBLE_END; ++type)
+ {
+ addEntry((LLFolderType::EType)type, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false));
+ }
}
bool LLViewerFolderDictionary::initEnsemblesFromFile()
{
- std::string xml_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"foldertypes.xml");
- LLXmlTree folder_def;
- if (!folder_def.parseFile(xml_filename))
- {
- LL_ERRS() << "Failed to parse folders file " << xml_filename << LL_ENDL;
- return false;
- }
-
- LLXmlTreeNode* rootp = folder_def.getRoot();
- for (LLXmlTreeNode* ensemble = rootp->getFirstChild();
- ensemble;
- ensemble = rootp->getNextChild())
- {
- if (!ensemble->hasName("ensemble"))
- {
- LL_WARNS() << "Invalid ensemble definition node " << ensemble->getName() << LL_ENDL;
- continue;
- }
-
- S32 ensemble_type;
- static LLStdStringHandle ensemble_num_string = LLXmlTree::addAttributeString("foldertype_num");
- if (!ensemble->getFastAttributeS32(ensemble_num_string, ensemble_type))
- {
- LL_WARNS() << "No ensemble type defined" << LL_ENDL;
- continue;
- }
-
-
- if (ensemble_type < S32(LLFolderType::FT_ENSEMBLE_START) || ensemble_type > S32(LLFolderType::FT_ENSEMBLE_END))
- {
- LL_WARNS() << "Exceeded maximum ensemble index" << LLFolderType::FT_ENSEMBLE_END << LL_ENDL;
- break;
- }
-
- std::string xui_name;
- static LLStdStringHandle xui_name_string = LLXmlTree::addAttributeString("xui_name");
- if (!ensemble->getFastAttributeString(xui_name_string, xui_name))
- {
- LL_WARNS() << "No xui name defined" << LL_ENDL;
- continue;
- }
-
- std::string icon_name;
- static LLStdStringHandle icon_name_string = LLXmlTree::addAttributeString("icon_name");
- if (!ensemble->getFastAttributeString(icon_name_string, icon_name))
- {
- LL_WARNS() << "No ensemble icon name defined" << LL_ENDL;
- continue;
- }
-
- std::string allowed_names;
- static LLStdStringHandle allowed_names_string = LLXmlTree::addAttributeString("allowed");
- if (!ensemble->getFastAttributeString(allowed_names_string, allowed_names))
- {
- }
-
- // Add the entry and increment the asset number.
- const static std::string new_ensemble_name = "New Ensemble";
- addEntry(LLFolderType::EType(ensemble_type), new ViewerFolderEntry(xui_name, new_ensemble_name, icon_name, allowed_names));
- }
-
- return true;
+ std::string xml_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"foldertypes.xml");
+ LLXmlTree folder_def;
+ if (!folder_def.parseFile(xml_filename))
+ {
+ LL_ERRS() << "Failed to parse folders file " << xml_filename << LL_ENDL;
+ return false;
+ }
+
+ LLXmlTreeNode* rootp = folder_def.getRoot();
+ for (LLXmlTreeNode* ensemble = rootp->getFirstChild();
+ ensemble;
+ ensemble = rootp->getNextChild())
+ {
+ if (!ensemble->hasName("ensemble"))
+ {
+ LL_WARNS() << "Invalid ensemble definition node " << ensemble->getName() << LL_ENDL;
+ continue;
+ }
+
+ S32 ensemble_type;
+ static LLStdStringHandle ensemble_num_string = LLXmlTree::addAttributeString("foldertype_num");
+ if (!ensemble->getFastAttributeS32(ensemble_num_string, ensemble_type))
+ {
+ LL_WARNS() << "No ensemble type defined" << LL_ENDL;
+ continue;
+ }
+
+
+ if (ensemble_type < S32(LLFolderType::FT_ENSEMBLE_START) || ensemble_type > S32(LLFolderType::FT_ENSEMBLE_END))
+ {
+ LL_WARNS() << "Exceeded maximum ensemble index" << LLFolderType::FT_ENSEMBLE_END << LL_ENDL;
+ break;
+ }
+
+ std::string xui_name;
+ static LLStdStringHandle xui_name_string = LLXmlTree::addAttributeString("xui_name");
+ if (!ensemble->getFastAttributeString(xui_name_string, xui_name))
+ {
+ LL_WARNS() << "No xui name defined" << LL_ENDL;
+ continue;
+ }
+
+ std::string icon_name;
+ static LLStdStringHandle icon_name_string = LLXmlTree::addAttributeString("icon_name");
+ if (!ensemble->getFastAttributeString(icon_name_string, icon_name))
+ {
+ LL_WARNS() << "No ensemble icon name defined" << LL_ENDL;
+ continue;
+ }
+
+ std::string allowed_names;
+ static LLStdStringHandle allowed_names_string = LLXmlTree::addAttributeString("allowed");
+ if (!ensemble->getFastAttributeString(allowed_names_string, allowed_names))
+ {
+ }
+
+ // Add the entry and increment the asset number.
+ const static std::string new_ensemble_name = "New Ensemble";
+ addEntry(LLFolderType::EType(ensemble_type), new ViewerFolderEntry(xui_name, new_ensemble_name, icon_name, allowed_names));
+ }
+
+ return true;
}
const std::string &LLViewerFolderType::lookupXUIName(LLFolderType::EType folder_type)
{
- const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
- if (entry)
- {
- return entry->mName;
- }
- return badLookup();
+ const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
+ if (entry)
+ {
+ return entry->mName;
+ }
+ return badLookup();
}
LLFolderType::EType LLViewerFolderType::lookupTypeFromXUIName(const std::string &name)
{
- return LLViewerFolderDictionary::getInstance()->lookup(name);
+ return LLViewerFolderDictionary::getInstance()->lookup(name);
}
const std::string &LLViewerFolderType::lookupIconName(LLFolderType::EType folder_type, BOOL is_open)
{
- const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
- if (entry)
- {
- if (is_open)
- return entry->mIconNameOpen;
- else
- return entry->mIconNameClosed;
- }
-
- // Error condition. Return something so that we don't show a grey box in inventory view.
- const ViewerFolderEntry *default_entry = LLViewerFolderDictionary::getInstance()->lookup(LLFolderType::FT_NONE);
- if (default_entry)
- {
- return default_entry->mIconNameClosed;
- }
-
- // Should not get here unless there's something corrupted with the FT_NONE entry.
- return badLookup();
+ const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
+ if (entry)
+ {
+ if (is_open)
+ return entry->mIconNameOpen;
+ else
+ return entry->mIconNameClosed;
+ }
+
+ // Error condition. Return something so that we don't show a grey box in inventory view.
+ const ViewerFolderEntry *default_entry = LLViewerFolderDictionary::getInstance()->lookup(LLFolderType::FT_NONE);
+ if (default_entry)
+ {
+ return default_entry->mIconNameClosed;
+ }
+
+ // Should not get here unless there's something corrupted with the FT_NONE entry.
+ return badLookup();
}
BOOL LLViewerFolderType::lookupIsQuietType(LLFolderType::EType folder_type)
{
- const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
- if (entry)
- {
- return entry->mIsQuiet;
- }
- return FALSE;
+ const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
+ if (entry)
+ {
+ return entry->mIsQuiet;
+ }
+ return FALSE;
}
bool LLViewerFolderType::lookupIsHiddenIfEmpty(LLFolderType::EType folder_type)
{
- const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
- if (entry)
- {
- return entry->mHideIfEmpty;
- }
- return false;
+ const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
+ if (entry)
+ {
+ return entry->mHideIfEmpty;
+ }
+ return false;
}
const std::string &LLViewerFolderType::lookupNewCategoryName(LLFolderType::EType folder_type)
{
- const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
- if (entry)
- {
- return entry->mNewCategoryName;
- }
- return badLookup();
+ const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type);
+ if (entry)
+ {
+ return entry->mNewCategoryName;
+ }
+ return badLookup();
}
LLFolderType::EType LLViewerFolderType::lookupTypeFromNewCategoryName(const std::string& name)
{
- for (LLViewerFolderDictionary::const_iterator iter = LLViewerFolderDictionary::getInstance()->begin();
- iter != LLViewerFolderDictionary::getInstance()->end();
- iter++)
- {
- const ViewerFolderEntry *entry = iter->second;
- if (entry->mNewCategoryName == name)
- {
- return iter->first;
- }
- }
- return FT_NONE;
+ for (LLViewerFolderDictionary::const_iterator iter = LLViewerFolderDictionary::getInstance()->begin();
+ iter != LLViewerFolderDictionary::getInstance()->end();
+ iter++)
+ {
+ const ViewerFolderEntry *entry = iter->second;
+ if (entry->mNewCategoryName == name)
+ {
+ return iter->first;
+ }
+ }
+ return FT_NONE;
}
U64 LLViewerFolderType::lookupValidFolderTypes(const std::string& item_name)
{
- U64 matching_folders = 0;
- for (LLViewerFolderDictionary::const_iterator iter = LLViewerFolderDictionary::getInstance()->begin();
- iter != LLViewerFolderDictionary::getInstance()->end();
- iter++)
- {
- const ViewerFolderEntry *entry = iter->second;
- if (entry->getIsAllowedName(item_name))
- {
- matching_folders |= 1LL << iter->first;
- }
- }
- return matching_folders;
+ U64 matching_folders = 0;
+ for (LLViewerFolderDictionary::const_iterator iter = LLViewerFolderDictionary::getInstance()->begin();
+ iter != LLViewerFolderDictionary::getInstance()->end();
+ iter++)
+ {
+ const ViewerFolderEntry *entry = iter->second;
+ if (entry->getIsAllowedName(item_name))
+ {
+ matching_folders |= 1LL << iter->first;
+ }
+ }
+ return matching_folders;
}
diff --git a/indra/newview/llviewerfoldertype.h b/indra/newview/llviewerfoldertype.h
index 13d5a8fbbd..9d65002c86 100644
--- a/indra/newview/llviewerfoldertype.h
+++ b/indra/newview/llviewerfoldertype.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerfoldertype.h
* @brief Declaration of LLAssetType.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,20 +35,20 @@
class LLViewerFolderType : public LLFolderType
{
public:
- static const std::string& lookupXUIName(EType folder_type); // name used by the UI
- static LLFolderType::EType lookupTypeFromXUIName(const std::string& name);
+ static const std::string& lookupXUIName(EType folder_type); // name used by the UI
+ static LLFolderType::EType lookupTypeFromXUIName(const std::string& name);
- static const std::string& lookupIconName(EType folder_type, BOOL is_open = FALSE); // folder icon name
- static BOOL lookupIsQuietType(EType folder_type); // folder doesn't require UI update when changes have occured
- static bool lookupIsHiddenIfEmpty(EType folder_type); // folder is not displayed if empty
- static const std::string& lookupNewCategoryName(EType folder_type); // default name when creating new category
- static LLFolderType::EType lookupTypeFromNewCategoryName(const std::string& name); // default name when creating new category
+ static const std::string& lookupIconName(EType folder_type, BOOL is_open = FALSE); // folder icon name
+ static BOOL lookupIsQuietType(EType folder_type); // folder doesn't require UI update when changes have occured
+ static bool lookupIsHiddenIfEmpty(EType folder_type); // folder is not displayed if empty
+ static const std::string& lookupNewCategoryName(EType folder_type); // default name when creating new category
+ static LLFolderType::EType lookupTypeFromNewCategoryName(const std::string& name); // default name when creating new category
- static U64 lookupValidFolderTypes(const std::string& item_name); // which folders allow an item of this type?
+ static U64 lookupValidFolderTypes(const std::string& item_name); // which folders allow an item of this type?
protected:
- LLViewerFolderType() {}
- ~LLViewerFolderType() {}
+ LLViewerFolderType() {}
+ ~LLViewerFolderType() {}
};
#endif // LL_LLVIEWERFOLDERTYPE_H
diff --git a/indra/newview/llviewergenericmessage.cpp b/indra/newview/llviewergenericmessage.cpp
index aaa1313ff6..fd894a5997 100644
--- a/indra/newview/llviewergenericmessage.cpp
+++ b/indra/newview/llviewergenericmessage.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewergenericmessage.cpp
* @brief Handle processing of "generic messages" which contain short lists of strings.
* @author James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,56 +41,56 @@ LLDispatcher gGenericDispatcher;
void send_generic_message(const std::string& method,
- const std::vector<std::string>& strings,
- const LLUUID& invoice)
+ const std::vector<std::string>& strings,
+ const LLUUID& invoice)
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GenericMessage");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", method);
- msg->addUUID("Invoice", invoice);
- if(strings.empty())
- {
- msg->nextBlock("ParamList");
- msg->addString("Parameter", NULL);
- }
- else
- {
- std::vector<std::string>::const_iterator it = strings.begin();
- std::vector<std::string>::const_iterator end = strings.end();
- for(; it != end; ++it)
- {
- msg->nextBlock("ParamList");
- msg->addString("Parameter", *it);
- }
- }
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GenericMessage");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ msg->nextBlock("MethodData");
+ msg->addString("Method", method);
+ msg->addUUID("Invoice", invoice);
+ if(strings.empty())
+ {
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", NULL);
+ }
+ else
+ {
+ std::vector<std::string>::const_iterator it = strings.begin();
+ std::vector<std::string>::const_iterator end = strings.end();
+ for(; it != end; ++it)
+ {
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", *it);
+ }
+ }
+ gAgent.sendReliableMessage();
}
void process_generic_message(LLMessageSystem* msg, void**)
{
- LLUUID agent_id;
- msg->getUUID("AgentData", "AgentID", agent_id);
- if (agent_id != gAgent.getID())
- {
- LL_WARNS() << "GenericMessage for wrong agent" << LL_ENDL;
- return;
- }
+ LLUUID agent_id;
+ msg->getUUID("AgentData", "AgentID", agent_id);
+ if (agent_id != gAgent.getID())
+ {
+ LL_WARNS() << "GenericMessage for wrong agent" << LL_ENDL;
+ return;
+ }
- std::string request;
- LLUUID invoice;
- LLDispatcher::sparam_t strings;
- LLDispatcher::unpackMessage(msg, request, invoice, strings);
+ std::string request;
+ LLUUID invoice;
+ LLDispatcher::sparam_t strings;
+ LLDispatcher::unpackMessage(msg, request, invoice, strings);
- if(!gGenericDispatcher.dispatch(request, invoice, strings))
- {
- LL_WARNS() << "GenericMessage " << request << " failed to dispatch"
- << LL_ENDL;
- }
+ if(!gGenericDispatcher.dispatch(request, invoice, strings))
+ {
+ LL_WARNS() << "GenericMessage " << request << " failed to dispatch"
+ << LL_ENDL;
+ }
}
void process_generic_streaming_message(LLMessageSystem* msg, void**)
diff --git a/indra/newview/llviewergenericmessage.h b/indra/newview/llviewergenericmessage.h
index 96a73a3d5f..e3cf39201a 100644
--- a/indra/newview/llviewergenericmessage.h
+++ b/indra/newview/llviewergenericmessage.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewergenericmessage.h
* @brief Handle processing of "generic messages" which contain short lists of strings.
* @author James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,8 +34,8 @@ class LLMessageSystem;
void send_generic_message(const std::string& method,
- const std::vector<std::string>& strings,
- const LLUUID& invoice = LLUUID::null);
+ const std::vector<std::string>& strings,
+ const LLUUID& invoice = LLUUID::null);
void process_generic_message(LLMessageSystem* msg, void**);
void process_generic_streaming_message(LLMessageSystem* msg, void**);
diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp
index f30279d1e9..2f7d4110fb 100644
--- a/indra/newview/llviewergesture.cpp
+++ b/indra/newview/llviewergesture.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewergesture.cpp
* @brief LLViewerGesture class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,10 +31,10 @@
#include "llaudioengine.h"
#include "lldir.h"
#include "llviewerinventory.h"
-#include "sound_ids.h" // for testing
+#include "sound_ids.h" // for testing
#include "llfloaterreg.h"
-#include "llkeyboard.h" // for key shortcuts for testing
+#include "llkeyboard.h" // for key shortcuts for testing
#include "llinventorymodel.h"
#include "llvoavatar.h"
#include "llxfermanager.h"
@@ -49,105 +49,105 @@ LLViewerGestureList gGestureList;
const F32 LLViewerGesture::SOUND_VOLUME = 1.f;
LLViewerGesture::LLViewerGesture()
-: LLGesture()
+: LLGesture()
{ }
LLViewerGesture::LLViewerGesture(KEY key, MASK mask, const std::string &trigger,
- const LLUUID &sound_item_id,
- const std::string &animation,
- const std::string &output_string)
-: LLGesture(key, mask, trigger, sound_item_id, animation, output_string)
+ const LLUUID &sound_item_id,
+ const std::string &animation,
+ const std::string &output_string)
+: LLGesture(key, mask, trigger, sound_item_id, animation, output_string)
{
}
LLViewerGesture::LLViewerGesture(U8 **buffer, S32 max_size)
-: LLGesture(buffer, max_size)
+: LLGesture(buffer, max_size)
{
}
LLViewerGesture::LLViewerGesture(const LLViewerGesture &rhs)
-: LLGesture((LLGesture)rhs)
+: LLGesture((LLGesture)rhs)
{
}
BOOL LLViewerGesture::trigger(KEY key, MASK mask)
{
- if (mKey == key && mMask == mask)
- {
- doTrigger( TRUE );
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ if (mKey == key && mMask == mask)
+ {
+ doTrigger( TRUE );
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
BOOL LLViewerGesture::trigger(const std::string &trigger_string)
{
- // Assumes trigger_string is lowercase
- if (mTriggerLower == trigger_string)
- {
- doTrigger( FALSE );
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ // Assumes trigger_string is lowercase
+ if (mTriggerLower == trigger_string)
+ {
+ doTrigger( FALSE );
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
// private
void LLViewerGesture::doTrigger( BOOL send_chat )
{
- if (mSoundItemID != LLUUID::null)
- {
- LLViewerInventoryItem *item;
- item = gInventory.getItem(mSoundItemID);
- if (item)
- {
- send_sound_trigger(item->getAssetUUID(), SOUND_VOLUME);
- }
- }
-
- if (!mAnimation.empty())
- {
- // AFK animations trigger the special "away" state, which
- // includes agent control settings. JC
- if (mAnimation == "enter_away_from_keyboard_state" || mAnimation == "away")
- {
- gAgent.setAFK();
- }
- else
- {
- LLUUID anim_id = gAnimLibrary.stringToAnimState(mAnimation);
- gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_START);
- }
- }
-
- if (send_chat && !mOutputString.empty())
- {
- // Don't play nodding animation, since that might not blend
- // with the gesture animation.
- (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->
- sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
- }
+ if (mSoundItemID != LLUUID::null)
+ {
+ LLViewerInventoryItem *item;
+ item = gInventory.getItem(mSoundItemID);
+ if (item)
+ {
+ send_sound_trigger(item->getAssetUUID(), SOUND_VOLUME);
+ }
+ }
+
+ if (!mAnimation.empty())
+ {
+ // AFK animations trigger the special "away" state, which
+ // includes agent control settings. JC
+ if (mAnimation == "enter_away_from_keyboard_state" || mAnimation == "away")
+ {
+ gAgent.setAFK();
+ }
+ else
+ {
+ LLUUID anim_id = gAnimLibrary.stringToAnimState(mAnimation);
+ gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_START);
+ }
+ }
+
+ if (send_chat && !mOutputString.empty())
+ {
+ // Don't play nodding animation, since that might not blend
+ // with the gesture animation.
+ (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->
+ sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
+ }
}
LLViewerGestureList::LLViewerGestureList()
-: LLGestureList()
+: LLGestureList()
{
- mIsLoaded = FALSE;
+ mIsLoaded = FALSE;
}
// helper for deserialize that creates the right LLGesture subclass
LLGesture *LLViewerGestureList::create_gesture(U8 **buffer, S32 max_size)
{
- return new LLViewerGesture(buffer, max_size);
+ return new LLViewerGesture(buffer, max_size);
}
@@ -156,51 +156,51 @@ LLGesture *LLViewerGestureList::create_gesture(U8 **buffer, S32 max_size)
// output_str
BOOL LLViewerGestureList::matchPrefix(const std::string& in_str, std::string* out_str)
{
- S32 in_len = in_str.length();
-
- std::string in_str_lc = in_str;
- LLStringUtil::toLower(in_str_lc);
-
- for (S32 i = 0; i < count(); i++)
- {
- LLGesture* gesture = get(i);
- const std::string &trigger = gesture->getTrigger();
-
- if (in_len > (S32)trigger.length())
- {
- // too short, bail out
- continue;
- }
-
- std::string trigger_trunc = utf8str_truncate(trigger, in_len);
- LLStringUtil::toLower(trigger_trunc);
- if (in_str_lc == trigger_trunc)
- {
- *out_str = trigger;
- return TRUE;
- }
- }
- return FALSE;
+ S32 in_len = in_str.length();
+
+ std::string in_str_lc = in_str;
+ LLStringUtil::toLower(in_str_lc);
+
+ for (S32 i = 0; i < count(); i++)
+ {
+ LLGesture* gesture = get(i);
+ const std::string &trigger = gesture->getTrigger();
+
+ if (in_len > (S32)trigger.length())
+ {
+ // too short, bail out
+ continue;
+ }
+
+ std::string trigger_trunc = utf8str_truncate(trigger, in_len);
+ LLStringUtil::toLower(trigger_trunc);
+ if (in_str_lc == trigger_trunc)
+ {
+ *out_str = trigger;
+ return TRUE;
+ }
+ }
+ return FALSE;
}
// static
void LLViewerGestureList::xferCallback(void *data, S32 size, void** /*user_data*/, S32 status)
{
- if (LL_ERR_NOERR == status)
- {
- U8 *buffer = (U8 *)data;
- U8 *end = gGestureList.deserialize(buffer, size);
-
- if (end - buffer > size)
- {
- LL_ERRS() << "Read off of end of array, error in serialization" << LL_ENDL;
- }
-
- gGestureList.mIsLoaded = TRUE;
- }
- else
- {
- LL_WARNS() << "Unable to load gesture list!" << LL_ENDL;
- }
+ if (LL_ERR_NOERR == status)
+ {
+ U8 *buffer = (U8 *)data;
+ U8 *end = gGestureList.deserialize(buffer, size);
+
+ if (end - buffer > size)
+ {
+ LL_ERRS() << "Read off of end of array, error in serialization" << LL_ENDL;
+ }
+
+ gGestureList.mIsLoaded = TRUE;
+ }
+ else
+ {
+ LL_WARNS() << "Unable to load gesture list!" << LL_ENDL;
+ }
}
diff --git a/indra/newview/llviewergesture.h b/indra/newview/llviewergesture.h
index 8b621850ea..222b0a1327 100644
--- a/indra/newview/llviewergesture.h
+++ b/indra/newview/llviewergesture.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewergesture.h
* @brief LLViewerGesture class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,48 +37,48 @@ class LLMessageSystem;
class LLViewerGesture : public LLGesture
{
public:
- LLViewerGesture();
- LLViewerGesture(KEY key, MASK mask, const std::string &trigger,
- const LLUUID &sound_item_id, const std::string &animation,
- const std::string &output_string);
+ LLViewerGesture();
+ LLViewerGesture(KEY key, MASK mask, const std::string &trigger,
+ const LLUUID &sound_item_id, const std::string &animation,
+ const std::string &output_string);
- LLViewerGesture(U8 **buffer, S32 max_size); // deserializes, advances buffer
- LLViewerGesture(const LLViewerGesture &gesture);
+ LLViewerGesture(U8 **buffer, S32 max_size); // deserializes, advances buffer
+ LLViewerGesture(const LLViewerGesture &gesture);
- // Triggers if a key/mask matches it
- virtual BOOL trigger(KEY key, MASK mask);
+ // Triggers if a key/mask matches it
+ virtual BOOL trigger(KEY key, MASK mask);
- // Triggers if case-insensitive substring matches (assumes string is lowercase)
- virtual BOOL trigger(const std::string &string);
+ // Triggers if case-insensitive substring matches (assumes string is lowercase)
+ virtual BOOL trigger(const std::string &string);
- void doTrigger( BOOL send_chat );
+ void doTrigger( BOOL send_chat );
protected:
- static const F32 SOUND_VOLUME;
+ static const F32 SOUND_VOLUME;
};
class LLViewerGestureList : public LLGestureList
{
public:
- LLViewerGestureList();
+ LLViewerGestureList();
- //void requestFromServer();
- BOOL getIsLoaded() { return mIsLoaded; }
+ //void requestFromServer();
+ BOOL getIsLoaded() { return mIsLoaded; }
- //void requestResetFromServer( BOOL is_male );
+ //void requestResetFromServer( BOOL is_male );
- // See if the prefix matches any gesture. If so, return TRUE
- // and place the full text of the gesture trigger into
- // output_str
- BOOL matchPrefix(const std::string& in_str, std::string* out_str);
+ // See if the prefix matches any gesture. If so, return TRUE
+ // and place the full text of the gesture trigger into
+ // output_str
+ BOOL matchPrefix(const std::string& in_str, std::string* out_str);
- static void xferCallback(void *data, S32 size, void** /*user_data*/, S32 status);
+ static void xferCallback(void *data, S32 size, void** /*user_data*/, S32 status);
protected:
- LLGesture *create_gesture(U8 **buffer, S32 max_size);
+ LLGesture *create_gesture(U8 **buffer, S32 max_size);
protected:
- BOOL mIsLoaded;
+ BOOL mIsLoaded;
};
extern LLViewerGestureList gGestureList;
diff --git a/indra/newview/llviewerhelp.cpp b/indra/newview/llviewerhelp.cpp
index 3181ae6283..e7b150965d 100644
--- a/indra/newview/llviewerhelp.cpp
+++ b/indra/newview/llviewerhelp.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewerhelp.cpp
* @brief Utility functions for the Help system
* @author Tofu Linden
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,27 +42,27 @@
class LLHelpHandler : public LLCommandHandler
{
public:
- // requests will be throttled from a non-trusted browser
- LLHelpHandler() : LLCommandHandler("help", UNTRUSTED_CLICK_ONLY) {}
-
- bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- LLViewerHelp* vhelp = LLViewerHelp::getInstance();
- if (! vhelp)
- {
- return false;
- }
-
- // get the requested help topic name, or use the fallback if none
- std::string help_topic = vhelp->defaultTopic();
- if (params.size() >= 1)
- {
- help_topic = params[0].asString();
- }
-
- vhelp->showTopic(help_topic);
- return true;
- }
+ // requests will be throttled from a non-trusted browser
+ LLHelpHandler() : LLCommandHandler("help", UNTRUSTED_CLICK_ONLY) {}
+
+ bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ LLViewerHelp* vhelp = LLViewerHelp::getInstance();
+ if (! vhelp)
+ {
+ return false;
+ }
+
+ // get the requested help topic name, or use the fallback if none
+ std::string help_topic = vhelp->defaultTopic();
+ if (params.size() >= 1)
+ {
+ help_topic = params[0].asString();
+ }
+
+ vhelp->showTopic(help_topic);
+ return true;
+ }
};
LLHelpHandler gHelpHandler;
@@ -71,49 +71,49 @@ LLHelpHandler gHelpHandler;
std::string LLViewerHelp::getURL(const std::string &topic)
{
- // if the help topic is empty, use the default topic
- std::string help_topic = topic;
- if (help_topic.empty())
- {
- help_topic = defaultTopic();
- }
-
- // f1 help topic means: if the user is not logged in yet, show
- // the pre-login topic instead of the default fallback topic,
- // otherwise show help for the focused item
- if (help_topic == f1HelpTopic())
- {
- help_topic = getTopicFromFocus();
- if (help_topic == defaultTopic() && ! LLLoginInstance::getInstance()->authSuccess())
- {
- help_topic = preLoginTopic();
- }
- }
-
- return LLViewerHelpUtil::buildHelpURL( help_topic );
+ // if the help topic is empty, use the default topic
+ std::string help_topic = topic;
+ if (help_topic.empty())
+ {
+ help_topic = defaultTopic();
+ }
+
+ // f1 help topic means: if the user is not logged in yet, show
+ // the pre-login topic instead of the default fallback topic,
+ // otherwise show help for the focused item
+ if (help_topic == f1HelpTopic())
+ {
+ help_topic = getTopicFromFocus();
+ if (help_topic == defaultTopic() && ! LLLoginInstance::getInstance()->authSuccess())
+ {
+ help_topic = preLoginTopic();
+ }
+ }
+
+ return LLViewerHelpUtil::buildHelpURL( help_topic );
}
void LLViewerHelp::showTopic(const std::string& topic)
{
- LLFloaterReg::showInstance("help_browser", topic);
+ LLFloaterReg::showInstance("help_browser", topic);
}
std::string LLViewerHelp::defaultTopic()
{
- // *hack: to be done properly
- return "this_is_fallbacktopic";
+ // *hack: to be done properly
+ return "this_is_fallbacktopic";
}
std::string LLViewerHelp::preLoginTopic()
{
- // *hack: to be done properly
- return "pre_login_help";
+ // *hack: to be done properly
+ return "pre_login_help";
}
std::string LLViewerHelp::f1HelpTopic()
{
- // *hack: to be done properly
- return "f1_help";
+ // *hack: to be done properly
+ return "f1_help";
}
//////////////////////////////
@@ -121,20 +121,20 @@ std::string LLViewerHelp::f1HelpTopic()
std::string LLViewerHelp::getTopicFromFocus()
{
- // use UI element with viewer's keyboard focus as basis for searching
- LLUICtrl* focused = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
-
- if (focused)
- {
- std::string topic;
- if (focused->findHelpTopic(topic))
- {
- return topic;
- }
- }
-
- // didn't find a help topic in the UI hierarchy for focused
- // element, return the fallback topic name instead.
- return defaultTopic();
+ // use UI element with viewer's keyboard focus as basis for searching
+ LLUICtrl* focused = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
+
+ if (focused)
+ {
+ std::string topic;
+ if (focused->findHelpTopic(topic))
+ {
+ return topic;
+ }
+ }
+
+ // didn't find a help topic in the UI hierarchy for focused
+ // element, return the fallback topic name instead.
+ return defaultTopic();
}
diff --git a/indra/newview/llviewerhelp.h b/indra/newview/llviewerhelp.h
index bbd20bc07e..7f38565d3b 100644
--- a/indra/newview/llviewerhelp.h
+++ b/indra/newview/llviewerhelp.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewerhelp.h
* @brief Utility functions for the Help system
* @author Tofu Linden
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,25 +39,25 @@ class LLUICtrl;
class LLViewerHelp : public LLHelp, public LLSingleton<LLViewerHelp>
{
- LLSINGLETON_EMPTY_CTOR(LLViewerHelp);
+ LLSINGLETON_EMPTY_CTOR(LLViewerHelp);
public:
- /// display the specified help topic in the help viewer
- /*virtual*/ void showTopic(const std::string &topic) override;
+ /// display the specified help topic in the help viewer
+ /*virtual*/ void showTopic(const std::string &topic) override;
- std::string getURL(const std::string& topic) override;
+ std::string getURL(const std::string& topic) override;
- // return topic derived from viewer UI focus, else default topic
- std::string getTopicFromFocus();
+ // return topic derived from viewer UI focus, else default topic
+ std::string getTopicFromFocus();
- /// return default (fallback) topic name suitable for showTopic()
- /*virtual*/ std::string defaultTopic() override;
+ /// return default (fallback) topic name suitable for showTopic()
+ /*virtual*/ std::string defaultTopic() override;
- // return topic to use before the user logs in
- /*virtual*/ std::string preLoginTopic() override;
+ // return topic to use before the user logs in
+ /*virtual*/ std::string preLoginTopic() override;
- // return topic to use for the top-level help, invoked by F1
- /*virtual*/ std::string f1HelpTopic() override;
+ // return topic to use for the top-level help, invoked by F1
+ /*virtual*/ std::string f1HelpTopic() override;
};
#endif // header guard
diff --git a/indra/newview/llviewerhelputil.cpp b/indra/newview/llviewerhelputil.cpp
index ef4b955a5e..2eb0037a8c 100644
--- a/indra/newview/llviewerhelputil.cpp
+++ b/indra/newview/llviewerhelputil.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewerhelp.cpp
* @brief Utility functions for the Help system
* @author Soft Linden
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,27 +41,27 @@
//static
std::string LLViewerHelpUtil::helpURLEncode( const std::string &component )
{
- // Every character rfc3986 allows as unreserved in 2.3, minus the tilde
- // which we may grant special meaning. Yay.
- const char* allowed =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789"
- "-._";
- std::string escaped = LLURI::escape(component, allowed);
-
- return escaped;
+ // Every character rfc3986 allows as unreserved in 2.3, minus the tilde
+ // which we may grant special meaning. Yay.
+ const char* allowed =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789"
+ "-._";
+ std::string escaped = LLURI::escape(component, allowed);
+
+ return escaped;
}
//static
std::string LLViewerHelpUtil::buildHelpURL( const std::string &topic)
{
- LLSD substitution;
- substitution["TOPIC"] = helpURLEncode(topic);
- substitution["DEBUG_MODE"] = gAgent.isGodlike() ? "/debug" : "";
-
- // get the help URL and expand all of the substitutions
- // (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
- std::string helpURL = gSavedSettings.getString("HelpURLFormat");
- return LLWeb::expandURLSubstitutions(helpURL, substitution);
+ LLSD substitution;
+ substitution["TOPIC"] = helpURLEncode(topic);
+ substitution["DEBUG_MODE"] = gAgent.isGodlike() ? "/debug" : "";
+
+ // get the help URL and expand all of the substitutions
+ // (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
+ std::string helpURL = gSavedSettings.getString("HelpURLFormat");
+ return LLWeb::expandURLSubstitutions(helpURL, substitution);
}
diff --git a/indra/newview/llviewerhelputil.h b/indra/newview/llviewerhelputil.h
index d8f08f3f04..6f60c9c859 100644
--- a/indra/newview/llviewerhelputil.h
+++ b/indra/newview/llviewerhelputil.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewerhelputil.h
* @brief Utility functions for the Help system
* @author Soft Linden
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,8 +34,8 @@ class LLOSInfo;
class LLViewerHelpUtil
{
public:
- static std::string helpURLEncode( const std::string &component );
- static std::string buildHelpURL( const std::string &topic );
+ static std::string helpURLEncode( const std::string &component );
+ static std::string buildHelpURL( const std::string &topic );
};
#endif // header guard
diff --git a/indra/newview/llviewerhome.cpp b/indra/newview/llviewerhome.cpp
index e4e60b981c..d7dc96813f 100644
--- a/indra/newview/llviewerhome.cpp
+++ b/indra/newview/llviewerhome.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewerhome.cpp
* @brief Model (non-View) component for the web-based Home side panel
* @author Martin Reddy
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,41 +37,41 @@
//static
std::string LLViewerHome::getHomeURL()
-{
- // Return the URL to display in the Home side tray. We read
- // this value from settings.xml and support various substitutions
+{
+ // Return the URL to display in the Home side tray. We read
+ // this value from settings.xml and support various substitutions
- LLSD substitution;
- substitution["AUTH_TOKEN"] = LLURI::escape(getAuthKey());
+ LLSD substitution;
+ substitution["AUTH_TOKEN"] = LLURI::escape(getAuthKey());
- // get the home URL from the settings.xml file
- std::string homeURL = gSavedSettings.getString("HomeSidePanelURL");
+ // get the home URL from the settings.xml file
+ std::string homeURL = gSavedSettings.getString("HomeSidePanelURL");
- // support a grid-level override of the URL from login.cgi
- LLSD grid_url = LLLoginInstance::getInstance()->getResponse("home_sidetray_url");
- if (! grid_url.asString().empty())
- {
- homeURL = grid_url.asString();
- }
+ // support a grid-level override of the URL from login.cgi
+ LLSD grid_url = LLLoginInstance::getInstance()->getResponse("home_sidetray_url");
+ if (! grid_url.asString().empty())
+ {
+ homeURL = grid_url.asString();
+ }
- // expand all substitution strings in the URL and return it
- // (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
- return LLWeb::expandURLSubstitutions(homeURL, substitution);
+ // expand all substitution strings in the URL and return it
+ // (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
+ return LLWeb::expandURLSubstitutions(homeURL, substitution);
}
//static
std::string LLViewerHome::getAuthKey()
{
- // return the value of the (optional) auth token returned by login.cgi
- // this lets the server provide an authentication token that we can
- // blindly pass to the Home web page for it to perform authentication.
- // We use "home_sidetray_token", and fallback to "auth_token" if not
- // present.
- LLSD auth_token = LLLoginInstance::getInstance()->getResponse("home_sidetray_token");
- if (auth_token.asString().empty())
- {
- auth_token = LLLoginInstance::getInstance()->getResponse("auth_token");
- }
- return auth_token.asString();
+ // return the value of the (optional) auth token returned by login.cgi
+ // this lets the server provide an authentication token that we can
+ // blindly pass to the Home web page for it to perform authentication.
+ // We use "home_sidetray_token", and fallback to "auth_token" if not
+ // present.
+ LLSD auth_token = LLLoginInstance::getInstance()->getResponse("home_sidetray_token");
+ if (auth_token.asString().empty())
+ {
+ auth_token = LLLoginInstance::getInstance()->getResponse("auth_token");
+ }
+ return auth_token.asString();
}
diff --git a/indra/newview/llviewerhome.h b/indra/newview/llviewerhome.h
index 8e0cdc85ec..6d8ce62616 100644
--- a/indra/newview/llviewerhome.h
+++ b/indra/newview/llviewerhome.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewerhome.h
* @brief Model (non-View) component for the web-based Home side panel
* @author Martin Reddy
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,11 +33,11 @@
class LLViewerHome
{
public:
- /// return the URL to use for the web-based Home side panel
- static std::string getHomeURL();
+ /// return the URL to use for the web-based Home side panel
+ static std::string getHomeURL();
- /// return the authentication key for the Home web site
- static std::string getAuthKey();
+ /// return the authentication key for the Home web site
+ static std::string getAuthKey();
};
#endif
diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp
index 97e180df71..4d7d331433 100644
--- a/indra/newview/llviewerinput.cpp
+++ b/indra/newview/llviewerinput.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerinput.cpp
* @brief LLViewerInput class implementation
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -74,563 +74,563 @@ struct LLKeybindFunctionData
bool mIsGlobal;
};
-struct LLKeyboardActionRegistry
-: public LLRegistrySingleton<const std::string, LLKeybindFunctionData, LLKeyboardActionRegistry>
+struct LLKeyboardActionRegistry
+: public LLRegistrySingleton<const std::string, LLKeybindFunctionData, LLKeyboardActionRegistry>
{
- LLSINGLETON_EMPTY_CTOR(LLKeyboardActionRegistry);
+ LLSINGLETON_EMPTY_CTOR(LLKeyboardActionRegistry);
};
LLViewerInput gViewerInput;
bool agent_jump( EKeystate s )
{
- static BOOL first_fly_attempt(TRUE);
- if (KEYSTATE_UP == s)
- {
- first_fly_attempt = TRUE;
- return true;
- }
- F32 time = gKeyboard->getCurKeyElapsedTime();
- S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());
-
- if( time < FLY_TIME
- || frame_count <= FLY_FRAMES
- || gAgent.upGrabbed()
- || !gSavedSettings.getBOOL("AutomaticFly"))
- {
- gAgent.moveUp(1);
- }
- else
- {
- gAgent.setFlying(TRUE, first_fly_attempt);
- first_fly_attempt = FALSE;
- gAgent.moveUp(1);
- }
- return true;
+ static BOOL first_fly_attempt(TRUE);
+ if (KEYSTATE_UP == s)
+ {
+ first_fly_attempt = TRUE;
+ return true;
+ }
+ F32 time = gKeyboard->getCurKeyElapsedTime();
+ S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());
+
+ if( time < FLY_TIME
+ || frame_count <= FLY_FRAMES
+ || gAgent.upGrabbed()
+ || !gSavedSettings.getBOOL("AutomaticFly"))
+ {
+ gAgent.moveUp(1);
+ }
+ else
+ {
+ gAgent.setFlying(TRUE, first_fly_attempt);
+ first_fly_attempt = FALSE;
+ gAgent.moveUp(1);
+ }
+ return true;
}
bool agent_push_down( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgent.moveUp(-1);
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgent.moveUp(-1);
+ return true;
}
static void agent_check_temporary_run(LLAgent::EDoubleTapRunMode mode)
{
- if (gAgent.mDoubleTapRunMode == mode &&
- gAgent.getRunning() &&
- !gAgent.getAlwaysRun())
- {
- // Turn off temporary running.
- gAgent.clearRunning();
- gAgent.sendWalkRun(gAgent.getRunning());
- }
+ if (gAgent.mDoubleTapRunMode == mode &&
+ gAgent.getRunning() &&
+ !gAgent.getAlwaysRun())
+ {
+ // Turn off temporary running.
+ gAgent.clearRunning();
+ gAgent.sendWalkRun(gAgent.getRunning());
+ }
}
static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode mode)
{
- if (KEYSTATE_UP == s)
- {
- // Note: in case shift is already released, slide left/right run
- // will be released in agent_turn_left()/agent_turn_right()
- agent_check_temporary_run(mode);
- }
- else if (gSavedSettings.getBOOL("AllowTapTapHoldRun") &&
- KEYSTATE_DOWN == s &&
- !gAgent.getRunning())
- {
- if (gAgent.mDoubleTapRunMode == mode &&
- gAgent.mDoubleTapRunTimer.getElapsedTimeF32() < NUDGE_TIME)
- {
- // Same walk-key was pushed again quickly; this is a
- // double-tap so engage temporary running.
- gAgent.setRunning();
- gAgent.sendWalkRun(gAgent.getRunning());
- }
-
- // Pressing any walk-key resets the double-tap timer
- gAgent.mDoubleTapRunTimer.reset();
- gAgent.mDoubleTapRunMode = mode;
- }
+ if (KEYSTATE_UP == s)
+ {
+ // Note: in case shift is already released, slide left/right run
+ // will be released in agent_turn_left()/agent_turn_right()
+ agent_check_temporary_run(mode);
+ }
+ else if (gSavedSettings.getBOOL("AllowTapTapHoldRun") &&
+ KEYSTATE_DOWN == s &&
+ !gAgent.getRunning())
+ {
+ if (gAgent.mDoubleTapRunMode == mode &&
+ gAgent.mDoubleTapRunTimer.getElapsedTimeF32() < NUDGE_TIME)
+ {
+ // Same walk-key was pushed again quickly; this is a
+ // double-tap so engage temporary running.
+ gAgent.setRunning();
+ gAgent.sendWalkRun(gAgent.getRunning());
+ }
+
+ // Pressing any walk-key resets the double-tap timer
+ gAgent.mDoubleTapRunTimer.reset();
+ gAgent.mDoubleTapRunMode = mode;
+ }
}
static void agent_push_forwardbackward( EKeystate s, S32 direction, LLAgent::EDoubleTapRunMode mode )
{
- agent_handle_doubletap_run(s, mode);
- if (KEYSTATE_UP == s) return;
+ agent_handle_doubletap_run(s, mode);
+ if (KEYSTATE_UP == s) return;
- F32 time = gKeyboard->getCurKeyElapsedTime();
- S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());
+ F32 time = gKeyboard->getCurKeyElapsedTime();
+ S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());
- if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES)
- {
- gAgent.moveAtNudge(direction);
- }
- else
- {
- gAgent.moveAt(direction);
- }
+ if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES)
+ {
+ gAgent.moveAtNudge(direction);
+ }
+ else
+ {
+ gAgent.moveAt(direction);
+ }
}
bool camera_move_forward( EKeystate s );
bool agent_push_forward( EKeystate s )
{
- if(gAgent.isMovementLocked()) return true;
+ if(gAgent.isMovementLocked()) return true;
- //in free camera control mode we need to intercept keyboard events for avatar movements
- if (LLFloaterCamera::inFreeCameraMode())
- {
- camera_move_forward(s);
- }
- else
- {
- agent_push_forwardbackward(s, 1, LLAgent::DOUBLETAP_FORWARD);
- }
- return true;
+ //in free camera control mode we need to intercept keyboard events for avatar movements
+ if (LLFloaterCamera::inFreeCameraMode())
+ {
+ camera_move_forward(s);
+ }
+ else
+ {
+ agent_push_forwardbackward(s, 1, LLAgent::DOUBLETAP_FORWARD);
+ }
+ return true;
}
bool camera_move_backward( EKeystate s );
bool agent_push_backward( EKeystate s )
{
- if(gAgent.isMovementLocked()) return true;
+ if(gAgent.isMovementLocked()) return true;
- //in free camera control mode we need to intercept keyboard events for avatar movements
- if (LLFloaterCamera::inFreeCameraMode())
- {
- camera_move_backward(s);
- }
- else if (!gAgent.backwardGrabbed() && gAgentAvatarp->isSitting() && gSavedSettings.getBOOL("LeaveMouselook"))
- {
- gAgentCamera.changeCameraToThirdPerson();
- }
- else
- {
- agent_push_forwardbackward(s, -1, LLAgent::DOUBLETAP_BACKWARD);
- }
- return true;
+ //in free camera control mode we need to intercept keyboard events for avatar movements
+ if (LLFloaterCamera::inFreeCameraMode())
+ {
+ camera_move_backward(s);
+ }
+ else if (!gAgent.backwardGrabbed() && gAgentAvatarp->isSitting() && gSavedSettings.getBOOL("LeaveMouselook"))
+ {
+ gAgentCamera.changeCameraToThirdPerson();
+ }
+ else
+ {
+ agent_push_forwardbackward(s, -1, LLAgent::DOUBLETAP_BACKWARD);
+ }
+ return true;
}
static void agent_slide_leftright( EKeystate s, S32 direction, LLAgent::EDoubleTapRunMode mode )
{
- agent_handle_doubletap_run(s, mode);
- if( KEYSTATE_UP == s ) return;
- F32 time = gKeyboard->getCurKeyElapsedTime();
- S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());
+ agent_handle_doubletap_run(s, mode);
+ if( KEYSTATE_UP == s ) return;
+ F32 time = gKeyboard->getCurKeyElapsedTime();
+ S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());
- if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES)
- {
- gAgent.moveLeftNudge(direction);
- }
- else
- {
- gAgent.moveLeft(direction);
- }
+ if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES)
+ {
+ gAgent.moveLeftNudge(direction);
+ }
+ else
+ {
+ gAgent.moveLeft(direction);
+ }
}
bool agent_slide_left( EKeystate s )
{
- if(gAgent.isMovementLocked()) return true;
- agent_slide_leftright(s, 1, LLAgent::DOUBLETAP_SLIDELEFT);
- return true;
+ if(gAgent.isMovementLocked()) return true;
+ agent_slide_leftright(s, 1, LLAgent::DOUBLETAP_SLIDELEFT);
+ return true;
}
bool agent_slide_right( EKeystate s )
{
- if(gAgent.isMovementLocked()) return true;
- agent_slide_leftright(s, -1, LLAgent::DOUBLETAP_SLIDERIGHT);
- return true;
+ if(gAgent.isMovementLocked()) return true;
+ agent_slide_leftright(s, -1, LLAgent::DOUBLETAP_SLIDERIGHT);
+ return true;
}
bool camera_spin_around_cw( EKeystate s );
bool agent_turn_left(EKeystate s)
{
- //in free camera control mode we need to intercept keyboard events for avatar movements
- if (LLFloaterCamera::inFreeCameraMode())
- {
- camera_spin_around_cw(s);
- return true;
- }
-
- if(gAgent.isMovementLocked()) return false;
-
- if (LLToolCamera::getInstance()->mouseSteerMode())
- {
- agent_slide_left(s);
- }
- else
- {
- if (KEYSTATE_UP == s)
- {
- // Check temporary running. In case user released 'left' key with shift already released.
- agent_check_temporary_run(LLAgent::DOUBLETAP_SLIDELEFT);
- return true;
- }
- F32 time = gKeyboard->getCurKeyElapsedTime();
- gAgent.moveYaw( LLFloaterMove::getYawRate( time ) );
- }
- return true;
+ //in free camera control mode we need to intercept keyboard events for avatar movements
+ if (LLFloaterCamera::inFreeCameraMode())
+ {
+ camera_spin_around_cw(s);
+ return true;
+ }
+
+ if(gAgent.isMovementLocked()) return false;
+
+ if (LLToolCamera::getInstance()->mouseSteerMode())
+ {
+ agent_slide_left(s);
+ }
+ else
+ {
+ if (KEYSTATE_UP == s)
+ {
+ // Check temporary running. In case user released 'left' key with shift already released.
+ agent_check_temporary_run(LLAgent::DOUBLETAP_SLIDELEFT);
+ return true;
+ }
+ F32 time = gKeyboard->getCurKeyElapsedTime();
+ gAgent.moveYaw( LLFloaterMove::getYawRate( time ) );
+ }
+ return true;
}
bool camera_spin_around_ccw( EKeystate s );
bool agent_turn_right( EKeystate s )
{
- //in free camera control mode we need to intercept keyboard events for avatar movements
- if (LLFloaterCamera::inFreeCameraMode())
- {
- camera_spin_around_ccw(s);
- return true;
- }
-
- if(gAgent.isMovementLocked()) return false;
-
- if (LLToolCamera::getInstance()->mouseSteerMode())
- {
- agent_slide_right(s);
- }
- else
- {
- if (KEYSTATE_UP == s)
- {
- // Check temporary running. In case user released 'right' key with shift already released.
- agent_check_temporary_run(LLAgent::DOUBLETAP_SLIDERIGHT);
- return true;
- }
- F32 time = gKeyboard->getCurKeyElapsedTime();
- gAgent.moveYaw( -LLFloaterMove::getYawRate( time ) );
- }
- return true;
+ //in free camera control mode we need to intercept keyboard events for avatar movements
+ if (LLFloaterCamera::inFreeCameraMode())
+ {
+ camera_spin_around_ccw(s);
+ return true;
+ }
+
+ if(gAgent.isMovementLocked()) return false;
+
+ if (LLToolCamera::getInstance()->mouseSteerMode())
+ {
+ agent_slide_right(s);
+ }
+ else
+ {
+ if (KEYSTATE_UP == s)
+ {
+ // Check temporary running. In case user released 'right' key with shift already released.
+ agent_check_temporary_run(LLAgent::DOUBLETAP_SLIDERIGHT);
+ return true;
+ }
+ F32 time = gKeyboard->getCurKeyElapsedTime();
+ gAgent.moveYaw( -LLFloaterMove::getYawRate( time ) );
+ }
+ return true;
}
bool agent_look_up( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgent.movePitch(-1);
- //gAgent.rotate(-2.f * DEG_TO_RAD, gAgent.getFrame().getLeftAxis() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgent.movePitch(-1);
+ //gAgent.rotate(-2.f * DEG_TO_RAD, gAgent.getFrame().getLeftAxis() );
+ return true;
}
bool agent_look_down( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgent.movePitch(1);
- //gAgent.rotate(2.f * DEG_TO_RAD, gAgent.getFrame().getLeftAxis() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgent.movePitch(1);
+ //gAgent.rotate(2.f * DEG_TO_RAD, gAgent.getFrame().getLeftAxis() );
+ return true;
}
bool agent_toggle_fly( EKeystate s )
{
- // Only catch the edge
- if (KEYSTATE_DOWN == s )
- {
- LLAgent::toggleFlying();
- }
- return true;
+ // Only catch the edge
+ if (KEYSTATE_DOWN == s )
+ {
+ LLAgent::toggleFlying();
+ }
+ return true;
}
F32 get_orbit_rate()
{
- F32 time = gKeyboard->getCurKeyElapsedTime();
- if( time < NUDGE_TIME )
- {
- F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME;
- //LL_INFOS() << rate << LL_ENDL;
- return rate;
- }
- else
- {
- return 1;
- }
+ F32 time = gKeyboard->getCurKeyElapsedTime();
+ if( time < NUDGE_TIME )
+ {
+ F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME;
+ //LL_INFOS() << rate << LL_ENDL;
+ return rate;
+ }
+ else
+ {
+ return 1;
+ }
}
bool camera_spin_around_ccw( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitLeftKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitLeftKey( get_orbit_rate() );
+ return true;
}
bool camera_spin_around_cw( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitRightKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitRightKey( get_orbit_rate() );
+ return true;
}
bool camera_spin_around_ccw_sitting( EKeystate s )
{
- if( KEYSTATE_UP == s && gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_SLIDERIGHT ) return true;
- if (gAgent.rotateGrabbed() || gAgentCamera.sitCameraEnabled() || gAgent.getRunning())
- {
- //send keystrokes, but do not change camera
- agent_turn_right(s);
- }
- else
- {
- //change camera but do not send keystrokes
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitLeftKey( get_orbit_rate() );
- }
- return true;
+ if( KEYSTATE_UP == s && gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_SLIDERIGHT ) return true;
+ if (gAgent.rotateGrabbed() || gAgentCamera.sitCameraEnabled() || gAgent.getRunning())
+ {
+ //send keystrokes, but do not change camera
+ agent_turn_right(s);
+ }
+ else
+ {
+ //change camera but do not send keystrokes
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitLeftKey( get_orbit_rate() );
+ }
+ return true;
}
bool camera_spin_around_cw_sitting( EKeystate s )
{
- if( KEYSTATE_UP == s && gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_SLIDELEFT ) return true;
- if (gAgent.rotateGrabbed() || gAgentCamera.sitCameraEnabled() || gAgent.getRunning())
- {
- //send keystrokes, but do not change camera
- agent_turn_left(s);
- }
- else
- {
- //change camera but do not send keystrokes
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitRightKey( get_orbit_rate() );
- }
- return true;
+ if( KEYSTATE_UP == s && gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_SLIDELEFT ) return true;
+ if (gAgent.rotateGrabbed() || gAgentCamera.sitCameraEnabled() || gAgent.getRunning())
+ {
+ //send keystrokes, but do not change camera
+ agent_turn_left(s);
+ }
+ else
+ {
+ //change camera but do not send keystrokes
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitRightKey( get_orbit_rate() );
+ }
+ return true;
}
bool camera_spin_over( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitUpKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitUpKey( get_orbit_rate() );
+ return true;
}
bool camera_spin_under( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitDownKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitDownKey( get_orbit_rate() );
+ return true;
}
bool camera_spin_over_sitting( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- if (gAgent.upGrabbed() || gAgentCamera.sitCameraEnabled())
- {
- //send keystrokes, but do not change camera
- agent_jump(s);
- }
- else
- {
- //change camera but do not send keystrokes
- gAgentCamera.setOrbitUpKey( get_orbit_rate() );
- }
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ if (gAgent.upGrabbed() || gAgentCamera.sitCameraEnabled())
+ {
+ //send keystrokes, but do not change camera
+ agent_jump(s);
+ }
+ else
+ {
+ //change camera but do not send keystrokes
+ gAgentCamera.setOrbitUpKey( get_orbit_rate() );
+ }
+ return true;
}
bool camera_spin_under_sitting( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- if (gAgent.downGrabbed() || gAgentCamera.sitCameraEnabled())
- {
- //send keystrokes, but do not change camera
- agent_push_down(s);
- }
- else
- {
- //change camera but do not send keystrokes
- gAgentCamera.setOrbitDownKey( get_orbit_rate() );
- }
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ if (gAgent.downGrabbed() || gAgentCamera.sitCameraEnabled())
+ {
+ //send keystrokes, but do not change camera
+ agent_push_down(s);
+ }
+ else
+ {
+ //change camera but do not send keystrokes
+ gAgentCamera.setOrbitDownKey( get_orbit_rate() );
+ }
+ return true;
}
bool camera_move_forward( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitInKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitInKey( get_orbit_rate() );
+ return true;
}
bool camera_move_backward( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitOutKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitOutKey( get_orbit_rate() );
+ return true;
}
bool camera_move_forward_sitting( EKeystate s )
{
- if( KEYSTATE_UP == s && gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_FORWARD ) return true;
- if (gAgent.forwardGrabbed() || gAgentCamera.sitCameraEnabled() || (gAgent.getRunning() && !gAgent.getAlwaysRun()))
- {
- agent_push_forward(s);
- }
- else
- {
- gAgentCamera.setOrbitInKey( get_orbit_rate() );
- }
- return true;
+ if( KEYSTATE_UP == s && gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_FORWARD ) return true;
+ if (gAgent.forwardGrabbed() || gAgentCamera.sitCameraEnabled() || (gAgent.getRunning() && !gAgent.getAlwaysRun()))
+ {
+ agent_push_forward(s);
+ }
+ else
+ {
+ gAgentCamera.setOrbitInKey( get_orbit_rate() );
+ }
+ return true;
}
bool camera_move_backward_sitting( EKeystate s )
{
- if( KEYSTATE_UP == s && gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_BACKWARD ) return true;
+ if( KEYSTATE_UP == s && gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_BACKWARD ) return true;
- if (gAgent.backwardGrabbed() || gAgentCamera.sitCameraEnabled() || (gAgent.getRunning() && !gAgent.getAlwaysRun()))
- {
- agent_push_backward(s);
- }
- else
- {
- gAgentCamera.setOrbitOutKey( get_orbit_rate() );
- }
- return true;
+ if (gAgent.backwardGrabbed() || gAgentCamera.sitCameraEnabled() || (gAgent.getRunning() && !gAgent.getAlwaysRun()))
+ {
+ agent_push_backward(s);
+ }
+ else
+ {
+ gAgentCamera.setOrbitOutKey( get_orbit_rate() );
+ }
+ return true;
}
bool camera_pan_up( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setPanUpKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanUpKey( get_orbit_rate() );
+ return true;
}
bool camera_pan_down( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setPanDownKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanDownKey( get_orbit_rate() );
+ return true;
}
bool camera_pan_left( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setPanLeftKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanLeftKey( get_orbit_rate() );
+ return true;
}
bool camera_pan_right( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setPanRightKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanRightKey( get_orbit_rate() );
+ return true;
}
bool camera_pan_in( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setPanInKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanInKey( get_orbit_rate() );
+ return true;
}
bool camera_pan_out( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setPanOutKey( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setPanOutKey( get_orbit_rate() );
+ return true;
}
bool camera_move_forward_fast( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitInKey(2.5f);
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitInKey(2.5f);
+ return true;
}
bool camera_move_backward_fast( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gAgentCamera.unlockView();
- gAgentCamera.setOrbitOutKey(2.5f);
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gAgentCamera.unlockView();
+ gAgentCamera.setOrbitOutKey(2.5f);
+ return true;
}
bool edit_avatar_spin_ccw( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gMorphView->setCameraDrivenByKeys( TRUE );
- gAgentCamera.setOrbitLeftKey( get_orbit_rate() );
- //gMorphView->orbitLeft( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gMorphView->setCameraDrivenByKeys( TRUE );
+ gAgentCamera.setOrbitLeftKey( get_orbit_rate() );
+ //gMorphView->orbitLeft( get_orbit_rate() );
+ return true;
}
bool edit_avatar_spin_cw( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gMorphView->setCameraDrivenByKeys( TRUE );
- gAgentCamera.setOrbitRightKey( get_orbit_rate() );
- //gMorphView->orbitRight( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gMorphView->setCameraDrivenByKeys( TRUE );
+ gAgentCamera.setOrbitRightKey( get_orbit_rate() );
+ //gMorphView->orbitRight( get_orbit_rate() );
+ return true;
}
bool edit_avatar_spin_over( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gMorphView->setCameraDrivenByKeys( TRUE );
- gAgentCamera.setOrbitUpKey( get_orbit_rate() );
- //gMorphView->orbitUp( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gMorphView->setCameraDrivenByKeys( TRUE );
+ gAgentCamera.setOrbitUpKey( get_orbit_rate() );
+ //gMorphView->orbitUp( get_orbit_rate() );
+ return true;
}
bool edit_avatar_spin_under( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gMorphView->setCameraDrivenByKeys( TRUE );
- gAgentCamera.setOrbitDownKey( get_orbit_rate() );
- //gMorphView->orbitDown( get_orbit_rate() );
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gMorphView->setCameraDrivenByKeys( TRUE );
+ gAgentCamera.setOrbitDownKey( get_orbit_rate() );
+ //gMorphView->orbitDown( get_orbit_rate() );
+ return true;
}
bool edit_avatar_move_forward( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gMorphView->setCameraDrivenByKeys( TRUE );
- gAgentCamera.setOrbitInKey( get_orbit_rate() );
- //gMorphView->orbitIn();
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gMorphView->setCameraDrivenByKeys( TRUE );
+ gAgentCamera.setOrbitInKey( get_orbit_rate() );
+ //gMorphView->orbitIn();
+ return true;
}
bool edit_avatar_move_backward( EKeystate s )
{
- if( KEYSTATE_UP == s ) return true;
- gMorphView->setCameraDrivenByKeys( TRUE );
- gAgentCamera.setOrbitOutKey( get_orbit_rate() );
- //gMorphView->orbitOut();
- return true;
+ if( KEYSTATE_UP == s ) return true;
+ gMorphView->setCameraDrivenByKeys( TRUE );
+ gAgentCamera.setOrbitOutKey( get_orbit_rate() );
+ //gMorphView->orbitOut();
+ return true;
}
bool stop_moving( EKeystate s )
{
- //it's supposed that 'stop moving' key will be held down for some time
- if( KEYSTATE_UP == s ) return true;
- // stop agent
- gAgent.setControlFlags(AGENT_CONTROL_STOP);
+ //it's supposed that 'stop moving' key will be held down for some time
+ if( KEYSTATE_UP == s ) return true;
+ // stop agent
+ gAgent.setControlFlags(AGENT_CONTROL_STOP);
- // cancel autopilot
- gAgent.stopAutoPilot();
- return true;
+ // cancel autopilot
+ gAgent.stopAutoPilot();
+ return true;
}
bool start_chat( EKeystate s )
@@ -641,29 +641,29 @@ bool start_chat( EKeystate s )
}
if (KEYSTATE_DOWN != s) return true;
- // start chat
- LLFloaterIMNearbyChat::startChat(NULL);
- return true;
+ // start chat
+ LLFloaterIMNearbyChat::startChat(NULL);
+ return true;
}
bool start_gesture( EKeystate s )
{
- LLUICtrl* focus_ctrlp = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- if (KEYSTATE_UP == s &&
- ! (focus_ctrlp && focus_ctrlp->acceptsTextInput()))
- {
- if ((LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->getCurrentChat().empty())
- {
- // No existing chat in chat editor, insert '/'
- LLFloaterIMNearbyChat::startChat("/");
- }
- else
- {
- // Don't overwrite existing text in chat editor
- LLFloaterIMNearbyChat::startChat(NULL);
- }
- }
- return true;
+ LLUICtrl* focus_ctrlp = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
+ if (KEYSTATE_UP == s &&
+ ! (focus_ctrlp && focus_ctrlp->acceptsTextInput()))
+ {
+ if ((LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->getCurrentChat().empty())
+ {
+ // No existing chat in chat editor, insert '/'
+ LLFloaterIMNearbyChat::startChat("/");
+ }
+ else
+ {
+ // Don't overwrite existing text in chat editor
+ LLFloaterIMNearbyChat::startChat(NULL);
+ }
+ }
+ return true;
}
bool run_forward(EKeystate s)
@@ -781,7 +781,7 @@ bool toggle_run(EKeystate s)
gAgent.setRunning();
}
gAgent.sendWalkRun(!run);
- return true;
+ return true;
}
bool toggle_sit(EKeystate s)
@@ -795,7 +795,7 @@ bool toggle_sit(EKeystate s)
{
gAgent.sitDown();
}
- return true;
+ return true;
}
bool toggle_pause_media(EKeystate s) // analogue of play/pause button in top bar
@@ -976,19 +976,19 @@ LLViewerInput::LLViewerInput()
{
resetBindings();
- for (S32 i = 0; i < KEY_COUNT; i++)
- {
- mKeyHandledByUI[i] = FALSE;
+ for (S32 i = 0; i < KEY_COUNT; i++)
+ {
+ mKeyHandledByUI[i] = FALSE;
}
for (S32 i = 0; i < CLICK_COUNT; i++)
{
mMouseLevel[i] = MOUSE_STATE_SILENT;
}
- // we want the UI to never see these keys so that they can always control the avatar/camera
- for(KEY k = KEY_PAD_UP; k <= KEY_PAD_DIVIDE; k++)
- {
- mKeysSkippedByUI.insert(k);
- }
+ // we want the UI to never see these keys so that they can always control the avatar/camera
+ for(KEY k = KEY_PAD_UP; k <= KEY_PAD_DIVIDE; k++)
+ {
+ mKeysSkippedByUI.insert(k);
+ }
}
LLViewerInput::~LLViewerInput()
@@ -1006,26 +1006,26 @@ bool LLViewerInput::modeFromString(const std::string& string, S32 *mode)
std::string cmp_string = string;
LLStringUtil::toLower(cmp_string);
- if (cmp_string == "first_person")
- {
- *mode = MODE_FIRST_PERSON;
- return true;
- }
- else if (cmp_string == "third_person")
- {
- *mode = MODE_THIRD_PERSON;
- return true;
- }
- else if (cmp_string == "edit_avatar")
- {
- *mode = MODE_EDIT_AVATAR;
- return true;
- }
- else if (cmp_string == "sitting")
- {
- *mode = MODE_SITTING;
- return true;
- }
+ if (cmp_string == "first_person")
+ {
+ *mode = MODE_FIRST_PERSON;
+ return true;
+ }
+ else if (cmp_string == "third_person")
+ {
+ *mode = MODE_THIRD_PERSON;
+ return true;
+ }
+ else if (cmp_string == "edit_avatar")
+ {
+ *mode = MODE_EDIT_AVATAR;
+ return true;
+ }
+ else if (cmp_string == "sitting")
+ {
+ *mode = MODE_SITTING;
+ return true;
+ }
S32 val = atoi(string.c_str());
if (val >= 0 && val < MODE_COUNT)
@@ -1074,45 +1074,45 @@ BOOL LLViewerInput::mouseFromString(const std::string& string, EMouseClickType *
BOOL LLViewerInput::handleKey(KEY translated_key, MASK translated_mask, BOOL repeated)
{
- // check for re-map
- EKeyboardMode mode = gViewerInput.getMode();
- U32 keyidx = (translated_mask<<16) | translated_key;
- key_remap_t::iterator iter = mRemapKeys[mode].find(keyidx);
- if (iter != mRemapKeys[mode].end())
- {
- translated_key = (iter->second) & 0xff;
- translated_mask = (iter->second)>>16;
- }
-
- // No repeats of F-keys
- BOOL repeatable_key = (translated_key < KEY_F1 || translated_key > KEY_F12);
- if (!repeatable_key && repeated)
- {
- return FALSE;
- }
-
- LL_DEBUGS("UserInput") << "keydown -" << translated_key << "-" << LL_ENDL;
- // skip skipped keys
- if(mKeysSkippedByUI.find(translated_key) != mKeysSkippedByUI.end())
- {
- mKeyHandledByUI[translated_key] = FALSE;
- LL_INFOS("KeyboardHandling") << "Key wasn't handled by UI!" << LL_ENDL;
- }
- else
- {
- // it is sufficient to set this value once per call to handlekey
- // without clearing it, as it is only used in the subsequent call to scanKey
- mKeyHandledByUI[translated_key] = gViewerWindow->handleKey(translated_key, translated_mask);
- // mKeyHandledByUI is not what you think ... this indicates whether the UI has handled this keypress yet (any keypress)
- // NOT whether some UI shortcut wishes to handle the keypress
-
- }
- return mKeyHandledByUI[translated_key];
+ // check for re-map
+ EKeyboardMode mode = gViewerInput.getMode();
+ U32 keyidx = (translated_mask<<16) | translated_key;
+ key_remap_t::iterator iter = mRemapKeys[mode].find(keyidx);
+ if (iter != mRemapKeys[mode].end())
+ {
+ translated_key = (iter->second) & 0xff;
+ translated_mask = (iter->second)>>16;
+ }
+
+ // No repeats of F-keys
+ BOOL repeatable_key = (translated_key < KEY_F1 || translated_key > KEY_F12);
+ if (!repeatable_key && repeated)
+ {
+ return FALSE;
+ }
+
+ LL_DEBUGS("UserInput") << "keydown -" << translated_key << "-" << LL_ENDL;
+ // skip skipped keys
+ if(mKeysSkippedByUI.find(translated_key) != mKeysSkippedByUI.end())
+ {
+ mKeyHandledByUI[translated_key] = FALSE;
+ LL_INFOS("KeyboardHandling") << "Key wasn't handled by UI!" << LL_ENDL;
+ }
+ else
+ {
+ // it is sufficient to set this value once per call to handlekey
+ // without clearing it, as it is only used in the subsequent call to scanKey
+ mKeyHandledByUI[translated_key] = gViewerWindow->handleKey(translated_key, translated_mask);
+ // mKeyHandledByUI is not what you think ... this indicates whether the UI has handled this keypress yet (any keypress)
+ // NOT whether some UI shortcut wishes to handle the keypress
+
+ }
+ return mKeyHandledByUI[translated_key];
}
BOOL LLViewerInput::handleKeyUp(KEY translated_key, MASK translated_mask)
{
- return gViewerWindow->handleKeyUp(translated_key, translated_mask);
+ return gViewerWindow->handleKeyUp(translated_key, translated_mask);
}
bool LLViewerInput::handleGlobalBindsKeyDown(KEY key, MASK mask)
@@ -1164,43 +1164,43 @@ bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask,
BOOL LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name)
{
- S32 index;
- typedef boost::function<bool(EKeystate)> function_t;
- function_t function = NULL;
- std::string name;
-
- // Allow remapping of F2-F12
- if (function_name[0] == 'F')
- {
- int c1 = function_name[1] - '0';
- int c2 = function_name[2] ? function_name[2] - '0' : -1;
- if (c1 >= 0 && c1 <= 9 && c2 >= -1 && c2 <= 9)
- {
- int idx = c1;
- if (c2 >= 0)
- idx = idx*10 + c2;
- if (idx >=2 && idx <= 12)
- {
- U32 keyidx = ((mask<<16)|key);
- (mRemapKeys[mode])[keyidx] = ((0<<16)|(KEY_F1+(idx-1)));
- return TRUE;
- }
- }
- }
-
- // Not remapped, look for a function
+ S32 index;
+ typedef boost::function<bool(EKeystate)> function_t;
+ function_t function = NULL;
+ std::string name;
+
+ // Allow remapping of F2-F12
+ if (function_name[0] == 'F')
+ {
+ int c1 = function_name[1] - '0';
+ int c2 = function_name[2] ? function_name[2] - '0' : -1;
+ if (c1 >= 0 && c1 <= 9 && c2 >= -1 && c2 <= 9)
+ {
+ int idx = c1;
+ if (c2 >= 0)
+ idx = idx*10 + c2;
+ if (idx >=2 && idx <= 12)
+ {
+ U32 keyidx = ((mask<<16)|key);
+ (mRemapKeys[mode])[keyidx] = ((0<<16)|(KEY_F1+(idx-1)));
+ return TRUE;
+ }
+ }
+ }
+
+ // Not remapped, look for a function
LLKeybindFunctionData* result = LLKeyboardActionRegistry::getValue(function_name);
- if (result)
- {
- function = result->mFunction;
- }
+ if (result)
+ {
+ function = result->mFunction;
+ }
- if (!function)
- {
- LL_WARNS_ONCE() << "Can't bind key to function " << function_name << ", no function with this name found" << LL_ENDL;
- return FALSE;
- }
+ if (!function)
+ {
+ LL_WARNS_ONCE() << "Can't bind key to function " << function_name << ", no function with this name found" << LL_ENDL;
+ return FALSE;
+ }
if (mode >= MODE_COUNT)
{
@@ -1208,7 +1208,7 @@ BOOL LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons
return FALSE;
}
- // check for duplicate first and overwrite
+ // check for duplicate first and overwrite
if (result->mIsGlobal)
{
S32 size = mGlobalKeyBindings[mode].size();
@@ -1249,7 +1249,7 @@ BOOL LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons
mKeyBindings[mode].push_back(bind);
}
- return TRUE;
+ return TRUE;
}
BOOL LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name)
@@ -1335,22 +1335,22 @@ BOOL LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const
}
LLViewerInput::KeyBinding::KeyBinding()
-: key("key"),
- mouse("mouse"),
- mask("mask"),
- command("command")
+: key("key"),
+ mouse("mouse"),
+ mask("mask"),
+ command("command")
{}
LLViewerInput::KeyMode::KeyMode()
-: bindings("binding")
+: bindings("binding")
{}
LLViewerInput::Keys::Keys()
-: first_person("first_person"),
- third_person("third_person"),
- sitting("sitting"),
- edit_avatar("edit_avatar"),
- xml_version("xml_version", 0)
+: first_person("first_person"),
+ third_person("third_person"),
+ sitting("sitting"),
+ edit_avatar("edit_avatar"),
+ xml_version("xml_version", 0)
{}
void LLViewerInput::resetBindings()
@@ -1369,17 +1369,17 @@ S32 LLViewerInput::loadBindingsXML(const std::string& filename)
{
resetBindings();
- S32 binding_count = 0;
- Keys keys;
- LLSimpleXUIParser parser;
+ S32 binding_count = 0;
+ Keys keys;
+ LLSimpleXUIParser parser;
- if (parser.readXUI(filename, keys)
- && keys.validateBlock())
- {
- binding_count += loadBindingMode(keys.first_person, MODE_FIRST_PERSON);
- binding_count += loadBindingMode(keys.third_person, MODE_THIRD_PERSON);
- binding_count += loadBindingMode(keys.sitting, MODE_SITTING);
- binding_count += loadBindingMode(keys.edit_avatar, MODE_EDIT_AVATAR);
+ if (parser.readXUI(filename, keys)
+ && keys.validateBlock())
+ {
+ binding_count += loadBindingMode(keys.first_person, MODE_FIRST_PERSON);
+ binding_count += loadBindingMode(keys.third_person, MODE_THIRD_PERSON);
+ binding_count += loadBindingMode(keys.sitting, MODE_SITTING);
+ binding_count += loadBindingMode(keys.edit_avatar, MODE_EDIT_AVATAR);
// verify version
if (keys.xml_version < 1)
@@ -1439,8 +1439,8 @@ S32 LLViewerInput::loadBindingsXML(const std::string& filename)
}
}
}
- }
- return binding_count;
+ }
+ return binding_count;
}
S32 count_masks(const MASK &mask)
@@ -1473,12 +1473,12 @@ bool compare_mouse_by_mask(LLMouseBinding i1, LLMouseBinding i2)
S32 LLViewerInput::loadBindingMode(const LLViewerInput::KeyMode& keymode, S32 mode)
{
- S32 binding_count = 0;
- for (LLInitParam::ParamIterator<KeyBinding>::const_iterator it = keymode.bindings.begin(),
- end_it = keymode.bindings.end();
- it != end_it;
- ++it)
- {
+ S32 binding_count = 0;
+ for (LLInitParam::ParamIterator<KeyBinding>::const_iterator it = keymode.bindings.begin(),
+ end_it = keymode.bindings.end();
+ it != end_it;
+ ++it)
+ {
bool processed = false;
std::string key_str = it->key.getValue();
if (!key_str.empty() && key_str != "NONE")
@@ -1524,27 +1524,27 @@ S32 LLViewerInput::loadBindingMode(const LLViewerInput::KeyMode& keymode, S32 mo
std::sort(mKeyBindings[mode].begin(), mKeyBindings[mode].end(), compare_key_by_mask);
std::sort(mMouseBindings[mode].begin(), mMouseBindings[mode].end(), compare_mouse_by_mask);
- return binding_count;
+ return binding_count;
}
EKeyboardMode LLViewerInput::getMode() const
{
- if ( gAgentCamera.cameraMouselook() )
- {
- return MODE_FIRST_PERSON;
- }
- else if ( gMorphView && gMorphView->getVisible())
- {
- return MODE_EDIT_AVATAR;
- }
- else if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
- {
- return MODE_SITTING;
- }
- else
- {
- return MODE_THIRD_PERSON;
- }
+ if ( gAgentCamera.cameraMouselook() )
+ {
+ return MODE_FIRST_PERSON;
+ }
+ else if ( gMorphView && gMorphView->getVisible())
+ {
+ return MODE_EDIT_AVATAR;
+ }
+ else if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
+ {
+ return MODE_SITTING;
+ }
+ else
+ {
+ return MODE_THIRD_PERSON;
+ }
}
bool LLViewerInput::scanKey(const std::vector<LLKeyboardBinding> &binding,
@@ -1556,57 +1556,57 @@ bool LLViewerInput::scanKey(const std::vector<LLKeyboardBinding> &binding,
BOOL key_level,
bool repeat) const
{
- for (S32 i = 0; i < binding_count; i++)
- {
- if (binding[i].mKey == key)
- {
- if ((binding[i].mMask & mask) == binding[i].mMask)
- {
- bool res = false;
- if (key_down && !repeat)
- {
- // ...key went down this frame, call function
- res = binding[i].mFunction( KEYSTATE_DOWN );
- return true;
- }
- else if (key_up)
- {
- // ...key went down this frame, call function
- res = binding[i].mFunction( KEYSTATE_UP );
- }
- else if (key_level)
- {
- // ...key held down from previous frame
- // Not windows, just call the function.
- res = binding[i].mFunction( KEYSTATE_LEVEL );
- }//if
- // Key+Mask combinations are supposed to be unique, so we won't find anything else
- return res;
- }//if
- }//if
- }//for
- return false;
+ for (S32 i = 0; i < binding_count; i++)
+ {
+ if (binding[i].mKey == key)
+ {
+ if ((binding[i].mMask & mask) == binding[i].mMask)
+ {
+ bool res = false;
+ if (key_down && !repeat)
+ {
+ // ...key went down this frame, call function
+ res = binding[i].mFunction( KEYSTATE_DOWN );
+ return true;
+ }
+ else if (key_up)
+ {
+ // ...key went down this frame, call function
+ res = binding[i].mFunction( KEYSTATE_UP );
+ }
+ else if (key_level)
+ {
+ // ...key held down from previous frame
+ // Not windows, just call the function.
+ res = binding[i].mFunction( KEYSTATE_LEVEL );
+ }//if
+ // Key+Mask combinations are supposed to be unique, so we won't find anything else
+ return res;
+ }//if
+ }//if
+ }//for
+ return false;
}
// Called from scanKeyboard.
bool LLViewerInput::scanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) const
{
- if (LLApp::isExiting())
- {
- return false;
- }
+ if (LLApp::isExiting())
+ {
+ return false;
+ }
- S32 mode = getMode();
- // Consider keyboard scanning as NOT mouse event. JC
- MASK mask = gKeyboard->currentMask(FALSE);
+ S32 mode = getMode();
+ // Consider keyboard scanning as NOT mouse event. JC
+ MASK mask = gKeyboard->currentMask(FALSE);
- if (mKeyHandledByUI[key])
- {
- return false;
- }
+ if (mKeyHandledByUI[key])
+ {
+ return false;
+ }
- // don't process key down on repeated keys
- BOOL repeat = gKeyboard->getKeyRepeated(key);
+ // don't process key down on repeated keys
+ BOOL repeat = gKeyboard->getKeyRepeated(key);
bool res = scanKey(mKeyBindings[mode], mKeyBindings[mode].size(), key, mask, key_down, key_up, key_level, repeat);
@@ -1686,7 +1686,7 @@ BOOL LLViewerInput::handleMouse(LLWindow *window_impl, LLCoordGL pos, MASK mask,
{
mMouseLevel[clicktype] = MOUSE_STATE_CLICK;
}
- else
+ else
{
mMouseLevel[clicktype] = MOUSE_STATE_UP;
}
diff --git a/indra/newview/llviewerinput.h b/indra/newview/llviewerinput.h
index 41e289ac1d..29bc5d6886 100644
--- a/indra/newview/llviewerinput.h
+++ b/indra/newview/llviewerinput.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerinput.h
* @brief LLViewerInput class header file
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,91 +38,91 @@ class LLWindow;
class LLNamedFunction
{
public:
- LLNamedFunction() : mFunction(NULL) { };
- ~LLNamedFunction() { };
+ LLNamedFunction() : mFunction(NULL) { };
+ ~LLNamedFunction() { };
- std::string mName;
- LLKeyFunc mFunction;
+ std::string mName;
+ LLKeyFunc mFunction;
};
class LLKeyboardBinding
{
public:
- KEY mKey;
- MASK mMask;
+ KEY mKey;
+ MASK mMask;
- LLKeyFunc mFunction;
+ LLKeyFunc mFunction;
std::string mFunctionName;
};
class LLMouseBinding
{
public:
- EMouseClickType mMouse;
- MASK mMask;
+ EMouseClickType mMouse;
+ MASK mMask;
- LLKeyFunc mFunction;
+ LLKeyFunc mFunction;
std::string mFunctionName;
};
typedef enum e_keyboard_mode
{
- MODE_FIRST_PERSON,
- MODE_THIRD_PERSON,
- MODE_EDIT_AVATAR,
- MODE_SITTING,
- MODE_COUNT
+ MODE_FIRST_PERSON,
+ MODE_THIRD_PERSON,
+ MODE_EDIT_AVATAR,
+ MODE_SITTING,
+ MODE_COUNT
} EKeyboardMode;
class LLViewerInput : public LLKeyBindingToStringHandler
{
public:
- struct KeyBinding : public LLInitParam::Block<KeyBinding>
- {
- Mandatory<std::string> key,
- mask,
- command;
- Optional<std::string> mouse; // Note, not mandatory for the sake of backward campatibility with keys.xml
-
- KeyBinding();
- };
-
- struct KeyMode : public LLInitParam::Block<KeyMode>
- {
- Multiple<KeyBinding> bindings;
-
- KeyMode();
- };
-
- struct Keys : public LLInitParam::Block<Keys>
- {
- Optional<KeyMode> first_person,
- third_person,
- sitting,
- edit_avatar;
- Optional<S32> xml_version; // 'xml', because 'version' appears to be reserved
- Keys();
- };
-
- LLViewerInput();
+ struct KeyBinding : public LLInitParam::Block<KeyBinding>
+ {
+ Mandatory<std::string> key,
+ mask,
+ command;
+ Optional<std::string> mouse; // Note, not mandatory for the sake of backward campatibility with keys.xml
+
+ KeyBinding();
+ };
+
+ struct KeyMode : public LLInitParam::Block<KeyMode>
+ {
+ Multiple<KeyBinding> bindings;
+
+ KeyMode();
+ };
+
+ struct Keys : public LLInitParam::Block<Keys>
+ {
+ Optional<KeyMode> first_person,
+ third_person,
+ sitting,
+ edit_avatar;
+ Optional<S32> xml_version; // 'xml', because 'version' appears to be reserved
+ Keys();
+ };
+
+ LLViewerInput();
virtual ~LLViewerInput();
- BOOL handleKey(KEY key, MASK mask, BOOL repeated);
- BOOL handleKeyUp(KEY key, MASK mask);
+ BOOL handleKey(KEY key, MASK mask, BOOL repeated);
+ BOOL handleKeyUp(KEY key, MASK mask);
// Handle 'global' keybindings that do not consume event,
// yet need to be processed early
// Example: we want voice to toggle even if some floater is focused
- bool handleGlobalBindsKeyDown(KEY key, MASK mask);
- bool handleGlobalBindsKeyUp(KEY key, MASK mask);
- bool handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, bool down);
+ bool handleGlobalBindsKeyDown(KEY key, MASK mask);
+ bool handleGlobalBindsKeyUp(KEY key, MASK mask);
+ bool handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, bool down);
- S32 loadBindingsXML(const std::string& filename); // returns number bound, 0 on error
- EKeyboardMode getMode() const;
+ S32 loadBindingsXML(const std::string& filename); // returns number bound, 0 on error
+ EKeyboardMode getMode() const;
- static bool modeFromString(const std::string& string, S32 *mode); // False on failure
- static BOOL mouseFromString(const std::string& string, EMouseClickType *mode);// False on failure
+ static bool modeFromString(const std::string& string, S32 *mode); // False on failure
+ static BOOL mouseFromString(const std::string& string, EMouseClickType *mode);// False on failure
bool scanKey(KEY key,
BOOL key_down,
@@ -157,7 +157,7 @@ private:
MOUSE_STATE_UP, // went up this frame
MOUSE_STATE_SILENT // notified about 'up', do not notify again
};
- bool scanMouse(EMouseClickType click, EMouseState state) const;
+ bool scanMouse(EMouseClickType click, EMouseState state) const;
bool scanMouse(const std::vector<LLMouseBinding> &binding,
S32 binding_count,
EMouseClickType mouse,
@@ -165,32 +165,32 @@ private:
EMouseState state,
bool ignore_additional_masks) const;
- S32 loadBindingMode(const LLViewerInput::KeyMode& keymode, S32 mode);
- BOOL bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name);
- BOOL bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name);
- void resetBindings();
+ S32 loadBindingMode(const LLViewerInput::KeyMode& keymode, S32 mode);
+ BOOL bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name);
+ BOOL bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name);
+ void resetBindings();
- // Hold all the ugly stuff torn out to make LLKeyboard non-viewer-specific here
+ // Hold all the ugly stuff torn out to make LLKeyboard non-viewer-specific here
// TODO: at some point it is better to remake this, especially keyaboard part
// would be much better to send to functions actual state of the button than
// to send what we think function wants based on collection of bools (mKeyRepeated, mKeyLevel, mKeyDown)
- std::vector<LLKeyboardBinding> mKeyBindings[MODE_COUNT];
- std::vector<LLMouseBinding> mMouseBindings[MODE_COUNT];
- bool mLMouseDefaultHandling[MODE_COUNT]; // Due to having special priority
+ std::vector<LLKeyboardBinding> mKeyBindings[MODE_COUNT];
+ std::vector<LLMouseBinding> mMouseBindings[MODE_COUNT];
+ bool mLMouseDefaultHandling[MODE_COUNT]; // Due to having special priority
// keybindings that do not consume event and are handled earlier, before floaters
- std::vector<LLKeyboardBinding> mGlobalKeyBindings[MODE_COUNT];
- std::vector<LLMouseBinding> mGlobalMouseBindings[MODE_COUNT];
+ std::vector<LLKeyboardBinding> mGlobalKeyBindings[MODE_COUNT];
+ std::vector<LLMouseBinding> mGlobalMouseBindings[MODE_COUNT];
- typedef std::map<U32, U32> key_remap_t;
- key_remap_t mRemapKeys[MODE_COUNT];
- std::set<KEY> mKeysSkippedByUI;
- BOOL mKeyHandledByUI[KEY_COUNT]; // key processed successfully by UI
+ typedef std::map<U32, U32> key_remap_t;
+ key_remap_t mRemapKeys[MODE_COUNT];
+ std::set<KEY> mKeysSkippedByUI;
+ BOOL mKeyHandledByUI[KEY_COUNT]; // key processed successfully by UI
// This is indentical to what llkeyboard does (mKeyRepeated, mKeyLevel, mKeyDown e t c),
// just instead of remembering individually as bools, we record state as enum
- EMouseState mMouseLevel[CLICK_COUNT]; // records of key state
+ EMouseState mMouseLevel[CLICK_COUNT]; // records of key state
};
extern LLViewerInput gViewerInput;
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index b9a7c9448f..16810efa01 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerinventory.cpp
* @brief Implementation of the viewer side inventory objects.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -73,7 +73,7 @@
#include "llsettingsvo.h"
// do-nothing ops for use in callbacks.
-void no_op_inventory_func(const LLUUID&) {}
+void no_op_inventory_func(const LLUUID&) {}
void no_op_llsd_func(const LLSD&) {}
void no_op() {}
@@ -99,130 +99,130 @@ void doInventoryCb(LLPointer<LLInventoryCallback> cb, LLUUID id)
///----------------------------------------------------------------------------
class LLLocalizedInventoryItemsDictionary : public LLSingleton<LLLocalizedInventoryItemsDictionary>
{
- LLSINGLETON(LLLocalizedInventoryItemsDictionary);
+ LLSINGLETON(LLLocalizedInventoryItemsDictionary);
public:
- std::map<std::string, std::string> mInventoryItemsDict;
-
- /**
- * Finds passed name in dictionary and replaces it with found localized value.
- *
- * @param object_name - string to be localized.
- * @return true if passed name was found and localized, false otherwise.
- */
- bool localizeInventoryObjectName(std::string& object_name)
- {
- LL_DEBUGS(LOG_LOCAL) << "Searching for localization: " << object_name << LL_ENDL;
-
- std::map<std::string, std::string>::const_iterator dictionary_iter = mInventoryItemsDict.find(object_name);
-
- bool found = dictionary_iter != mInventoryItemsDict.end();
- if(found)
- {
- object_name = dictionary_iter->second;
- LL_DEBUGS(LOG_LOCAL) << "Found, new name is: " << object_name << LL_ENDL;
- }
- return found;
- }
+ std::map<std::string, std::string> mInventoryItemsDict;
+
+ /**
+ * Finds passed name in dictionary and replaces it with found localized value.
+ *
+ * @param object_name - string to be localized.
+ * @return true if passed name was found and localized, false otherwise.
+ */
+ bool localizeInventoryObjectName(std::string& object_name)
+ {
+ LL_DEBUGS(LOG_LOCAL) << "Searching for localization: " << object_name << LL_ENDL;
+
+ std::map<std::string, std::string>::const_iterator dictionary_iter = mInventoryItemsDict.find(object_name);
+
+ bool found = dictionary_iter != mInventoryItemsDict.end();
+ if(found)
+ {
+ object_name = dictionary_iter->second;
+ LL_DEBUGS(LOG_LOCAL) << "Found, new name is: " << object_name << LL_ENDL;
+ }
+ return found;
+ }
};
LLLocalizedInventoryItemsDictionary::LLLocalizedInventoryItemsDictionary()
{
- mInventoryItemsDict["New Shape"] = LLTrans::getString("New Shape");
- mInventoryItemsDict["New Skin"] = LLTrans::getString("New Skin");
- mInventoryItemsDict["New Hair"] = LLTrans::getString("New Hair");
- mInventoryItemsDict["New Eyes"] = LLTrans::getString("New Eyes");
- mInventoryItemsDict["New Shirt"] = LLTrans::getString("New Shirt");
- mInventoryItemsDict["New Pants"] = LLTrans::getString("New Pants");
- mInventoryItemsDict["New Shoes"] = LLTrans::getString("New Shoes");
- mInventoryItemsDict["New Socks"] = LLTrans::getString("New Socks");
- mInventoryItemsDict["New Jacket"] = LLTrans::getString("New Jacket");
- mInventoryItemsDict["New Gloves"] = LLTrans::getString("New Gloves");
- mInventoryItemsDict["New Undershirt"] = LLTrans::getString("New Undershirt");
- mInventoryItemsDict["New Underpants"] = LLTrans::getString("New Underpants");
- mInventoryItemsDict["New Skirt"] = LLTrans::getString("New Skirt");
- mInventoryItemsDict["New Alpha"] = LLTrans::getString("New Alpha");
- mInventoryItemsDict["New Tattoo"] = LLTrans::getString("New Tattoo");
- mInventoryItemsDict["New Universal"] = LLTrans::getString("New Universal");
- mInventoryItemsDict["New Physics"] = LLTrans::getString("New Physics");
- mInventoryItemsDict["Invalid Wearable"] = LLTrans::getString("Invalid Wearable");
-
- mInventoryItemsDict["New Gesture"] = LLTrans::getString("New Gesture");
+ mInventoryItemsDict["New Shape"] = LLTrans::getString("New Shape");
+ mInventoryItemsDict["New Skin"] = LLTrans::getString("New Skin");
+ mInventoryItemsDict["New Hair"] = LLTrans::getString("New Hair");
+ mInventoryItemsDict["New Eyes"] = LLTrans::getString("New Eyes");
+ mInventoryItemsDict["New Shirt"] = LLTrans::getString("New Shirt");
+ mInventoryItemsDict["New Pants"] = LLTrans::getString("New Pants");
+ mInventoryItemsDict["New Shoes"] = LLTrans::getString("New Shoes");
+ mInventoryItemsDict["New Socks"] = LLTrans::getString("New Socks");
+ mInventoryItemsDict["New Jacket"] = LLTrans::getString("New Jacket");
+ mInventoryItemsDict["New Gloves"] = LLTrans::getString("New Gloves");
+ mInventoryItemsDict["New Undershirt"] = LLTrans::getString("New Undershirt");
+ mInventoryItemsDict["New Underpants"] = LLTrans::getString("New Underpants");
+ mInventoryItemsDict["New Skirt"] = LLTrans::getString("New Skirt");
+ mInventoryItemsDict["New Alpha"] = LLTrans::getString("New Alpha");
+ mInventoryItemsDict["New Tattoo"] = LLTrans::getString("New Tattoo");
+ mInventoryItemsDict["New Universal"] = LLTrans::getString("New Universal");
+ mInventoryItemsDict["New Physics"] = LLTrans::getString("New Physics");
+ mInventoryItemsDict["Invalid Wearable"] = LLTrans::getString("Invalid Wearable");
+
+ mInventoryItemsDict["New Gesture"] = LLTrans::getString("New Gesture");
mInventoryItemsDict["New Material"] = LLTrans::getString("New Material");
- mInventoryItemsDict["New Script"] = LLTrans::getString("New Script");
- mInventoryItemsDict["New Folder"] = LLTrans::getString("New Folder");
- mInventoryItemsDict["New Note"] = LLTrans::getString("New Note");
- mInventoryItemsDict["Contents"] = LLTrans::getString("Contents");
-
- mInventoryItemsDict["Gesture"] = LLTrans::getString("Gesture");
- mInventoryItemsDict["Male Gestures"] = LLTrans::getString("Male Gestures");
- mInventoryItemsDict["Female Gestures"] = LLTrans::getString("Female Gestures");
- mInventoryItemsDict["Other Gestures"] = LLTrans::getString("Other Gestures");
- mInventoryItemsDict["Speech Gestures"] = LLTrans::getString("Speech Gestures");
- mInventoryItemsDict["Common Gestures"] = LLTrans::getString("Common Gestures");
-
- //predefined gestures
-
- //male
- mInventoryItemsDict["Male - Excuse me"] = LLTrans::getString("Male - Excuse me");
- mInventoryItemsDict["Male - Get lost"] = LLTrans::getString("Male - Get lost"); // double space after Male. EXT-8319
- mInventoryItemsDict["Male - Blow kiss"] = LLTrans::getString("Male - Blow kiss");
- mInventoryItemsDict["Male - Boo"] = LLTrans::getString("Male - Boo");
- mInventoryItemsDict["Male - Bored"] = LLTrans::getString("Male - Bored");
- mInventoryItemsDict["Male - Hey"] = LLTrans::getString("Male - Hey");
- mInventoryItemsDict["Male - Laugh"] = LLTrans::getString("Male - Laugh");
- mInventoryItemsDict["Male - Repulsed"] = LLTrans::getString("Male - Repulsed");
- mInventoryItemsDict["Male - Shrug"] = LLTrans::getString("Male - Shrug");
- mInventoryItemsDict["Male - Stick tougue out"] = LLTrans::getString("Male - Stick tougue out");
- mInventoryItemsDict["Male - Wow"] = LLTrans::getString("Male - Wow");
-
- //female
- mInventoryItemsDict["Female - Chuckle"] = LLTrans::getString("Female - Chuckle");
- mInventoryItemsDict["Female - Cry"] = LLTrans::getString("Female - Cry");
- mInventoryItemsDict["Female - Embarrassed"] = LLTrans::getString("Female - Embarrassed");
- mInventoryItemsDict["Female - Excuse me"] = LLTrans::getString("Female - Excuse me");
- mInventoryItemsDict["Female - Get lost"] = LLTrans::getString("Female - Get lost"); // double space after Female. EXT-8319
- mInventoryItemsDict["Female - Blow kiss"] = LLTrans::getString("Female - Blow kiss");
- mInventoryItemsDict["Female - Boo"] = LLTrans::getString("Female - Boo");
- mInventoryItemsDict["Female - Bored"] = LLTrans::getString("Female - Bored");
- mInventoryItemsDict["Female - Hey"] = LLTrans::getString("Female - Hey");
- mInventoryItemsDict["Female - Hey baby"] = LLTrans::getString("Female - Hey baby");
- mInventoryItemsDict["Female - Laugh"] = LLTrans::getString("Female - Laugh");
- mInventoryItemsDict["Female - Looking good"] = LLTrans::getString("Female - Looking good");
- mInventoryItemsDict["Female - Over here"] = LLTrans::getString("Female - Over here");
- mInventoryItemsDict["Female - Please"] = LLTrans::getString("Female - Please");
- mInventoryItemsDict["Female - Repulsed"] = LLTrans::getString("Female - Repulsed");
- mInventoryItemsDict["Female - Shrug"] = LLTrans::getString("Female - Shrug");
- mInventoryItemsDict["Female - Stick tougue out"]= LLTrans::getString("Female - Stick tougue out");
- mInventoryItemsDict["Female - Wow"] = LLTrans::getString("Female - Wow");
-
- //common
- mInventoryItemsDict["/bow"] = LLTrans::getString("/bow");
- mInventoryItemsDict["/clap"] = LLTrans::getString("/clap");
- mInventoryItemsDict["/count"] = LLTrans::getString("/count");
- mInventoryItemsDict["/extinguish"] = LLTrans::getString("/extinguish");
- mInventoryItemsDict["/kmb"] = LLTrans::getString("/kmb");
- mInventoryItemsDict["/muscle"] = LLTrans::getString("/muscle");
- mInventoryItemsDict["/no"] = LLTrans::getString("/no");
- mInventoryItemsDict["/no!"] = LLTrans::getString("/no!");
- mInventoryItemsDict["/paper"] = LLTrans::getString("/paper");
- mInventoryItemsDict["/pointme"] = LLTrans::getString("/pointme");
- mInventoryItemsDict["/pointyou"] = LLTrans::getString("/pointyou");
- mInventoryItemsDict["/rock"] = LLTrans::getString("/rock");
- mInventoryItemsDict["/scissor"] = LLTrans::getString("/scissor");
- mInventoryItemsDict["/smoke"] = LLTrans::getString("/smoke");
- mInventoryItemsDict["/stretch"] = LLTrans::getString("/stretch");
- mInventoryItemsDict["/whistle"] = LLTrans::getString("/whistle");
- mInventoryItemsDict["/yes"] = LLTrans::getString("/yes");
- mInventoryItemsDict["/yes!"] = LLTrans::getString("/yes!");
- mInventoryItemsDict["afk"] = LLTrans::getString("afk");
- mInventoryItemsDict["dance1"] = LLTrans::getString("dance1");
- mInventoryItemsDict["dance2"] = LLTrans::getString("dance2");
- mInventoryItemsDict["dance3"] = LLTrans::getString("dance3");
- mInventoryItemsDict["dance4"] = LLTrans::getString("dance4");
- mInventoryItemsDict["dance5"] = LLTrans::getString("dance5");
- mInventoryItemsDict["dance6"] = LLTrans::getString("dance6");
- mInventoryItemsDict["dance7"] = LLTrans::getString("dance7");
- mInventoryItemsDict["dance8"] = LLTrans::getString("dance8");
+ mInventoryItemsDict["New Script"] = LLTrans::getString("New Script");
+ mInventoryItemsDict["New Folder"] = LLTrans::getString("New Folder");
+ mInventoryItemsDict["New Note"] = LLTrans::getString("New Note");
+ mInventoryItemsDict["Contents"] = LLTrans::getString("Contents");
+
+ mInventoryItemsDict["Gesture"] = LLTrans::getString("Gesture");
+ mInventoryItemsDict["Male Gestures"] = LLTrans::getString("Male Gestures");
+ mInventoryItemsDict["Female Gestures"] = LLTrans::getString("Female Gestures");
+ mInventoryItemsDict["Other Gestures"] = LLTrans::getString("Other Gestures");
+ mInventoryItemsDict["Speech Gestures"] = LLTrans::getString("Speech Gestures");
+ mInventoryItemsDict["Common Gestures"] = LLTrans::getString("Common Gestures");
+
+ //predefined gestures
+
+ //male
+ mInventoryItemsDict["Male - Excuse me"] = LLTrans::getString("Male - Excuse me");
+ mInventoryItemsDict["Male - Get lost"] = LLTrans::getString("Male - Get lost"); // double space after Male. EXT-8319
+ mInventoryItemsDict["Male - Blow kiss"] = LLTrans::getString("Male - Blow kiss");
+ mInventoryItemsDict["Male - Boo"] = LLTrans::getString("Male - Boo");
+ mInventoryItemsDict["Male - Bored"] = LLTrans::getString("Male - Bored");
+ mInventoryItemsDict["Male - Hey"] = LLTrans::getString("Male - Hey");
+ mInventoryItemsDict["Male - Laugh"] = LLTrans::getString("Male - Laugh");
+ mInventoryItemsDict["Male - Repulsed"] = LLTrans::getString("Male - Repulsed");
+ mInventoryItemsDict["Male - Shrug"] = LLTrans::getString("Male - Shrug");
+ mInventoryItemsDict["Male - Stick tougue out"] = LLTrans::getString("Male - Stick tougue out");
+ mInventoryItemsDict["Male - Wow"] = LLTrans::getString("Male - Wow");
+
+ //female
+ mInventoryItemsDict["Female - Chuckle"] = LLTrans::getString("Female - Chuckle");
+ mInventoryItemsDict["Female - Cry"] = LLTrans::getString("Female - Cry");
+ mInventoryItemsDict["Female - Embarrassed"] = LLTrans::getString("Female - Embarrassed");
+ mInventoryItemsDict["Female - Excuse me"] = LLTrans::getString("Female - Excuse me");
+ mInventoryItemsDict["Female - Get lost"] = LLTrans::getString("Female - Get lost"); // double space after Female. EXT-8319
+ mInventoryItemsDict["Female - Blow kiss"] = LLTrans::getString("Female - Blow kiss");
+ mInventoryItemsDict["Female - Boo"] = LLTrans::getString("Female - Boo");
+ mInventoryItemsDict["Female - Bored"] = LLTrans::getString("Female - Bored");
+ mInventoryItemsDict["Female - Hey"] = LLTrans::getString("Female - Hey");
+ mInventoryItemsDict["Female - Hey baby"] = LLTrans::getString("Female - Hey baby");
+ mInventoryItemsDict["Female - Laugh"] = LLTrans::getString("Female - Laugh");
+ mInventoryItemsDict["Female - Looking good"] = LLTrans::getString("Female - Looking good");
+ mInventoryItemsDict["Female - Over here"] = LLTrans::getString("Female - Over here");
+ mInventoryItemsDict["Female - Please"] = LLTrans::getString("Female - Please");
+ mInventoryItemsDict["Female - Repulsed"] = LLTrans::getString("Female - Repulsed");
+ mInventoryItemsDict["Female - Shrug"] = LLTrans::getString("Female - Shrug");
+ mInventoryItemsDict["Female - Stick tougue out"]= LLTrans::getString("Female - Stick tougue out");
+ mInventoryItemsDict["Female - Wow"] = LLTrans::getString("Female - Wow");
+
+ //common
+ mInventoryItemsDict["/bow"] = LLTrans::getString("/bow");
+ mInventoryItemsDict["/clap"] = LLTrans::getString("/clap");
+ mInventoryItemsDict["/count"] = LLTrans::getString("/count");
+ mInventoryItemsDict["/extinguish"] = LLTrans::getString("/extinguish");
+ mInventoryItemsDict["/kmb"] = LLTrans::getString("/kmb");
+ mInventoryItemsDict["/muscle"] = LLTrans::getString("/muscle");
+ mInventoryItemsDict["/no"] = LLTrans::getString("/no");
+ mInventoryItemsDict["/no!"] = LLTrans::getString("/no!");
+ mInventoryItemsDict["/paper"] = LLTrans::getString("/paper");
+ mInventoryItemsDict["/pointme"] = LLTrans::getString("/pointme");
+ mInventoryItemsDict["/pointyou"] = LLTrans::getString("/pointyou");
+ mInventoryItemsDict["/rock"] = LLTrans::getString("/rock");
+ mInventoryItemsDict["/scissor"] = LLTrans::getString("/scissor");
+ mInventoryItemsDict["/smoke"] = LLTrans::getString("/smoke");
+ mInventoryItemsDict["/stretch"] = LLTrans::getString("/stretch");
+ mInventoryItemsDict["/whistle"] = LLTrans::getString("/whistle");
+ mInventoryItemsDict["/yes"] = LLTrans::getString("/yes");
+ mInventoryItemsDict["/yes!"] = LLTrans::getString("/yes!");
+ mInventoryItemsDict["afk"] = LLTrans::getString("afk");
+ mInventoryItemsDict["dance1"] = LLTrans::getString("dance1");
+ mInventoryItemsDict["dance2"] = LLTrans::getString("dance2");
+ mInventoryItemsDict["dance3"] = LLTrans::getString("dance3");
+ mInventoryItemsDict["dance4"] = LLTrans::getString("dance4");
+ mInventoryItemsDict["dance5"] = LLTrans::getString("dance5");
+ mInventoryItemsDict["dance6"] = LLTrans::getString("dance6");
+ mInventoryItemsDict["dance7"] = LLTrans::getString("dance7");
+ mInventoryItemsDict["dance8"] = LLTrans::getString("dance8");
}
///----------------------------------------------------------------------------
@@ -255,66 +255,66 @@ public:
return false;
}
- bool handle(const LLSD& params,
+ bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
- {
- if (params.size() < 1)
- {
- return false;
- }
-
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableInventory"))
- {
- LLNotificationsUtil::add("NoInventory", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
-
- // support secondlife:///app/inventory/show
- if (params[0].asString() == "show")
- {
- LLFloaterSidePanelContainer::showPanel("inventory", LLSD());
- return true;
- }
-
- if (params[0].asString() == "filters")
- {
- LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
- if (sidepanel_inventory)
- {
- LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel();
- if (main_inventory)
- {
- main_inventory->toggleFindOptions();
- }
- }
- return true;
- }
-
- // otherwise, we need a UUID and a verb...
- if (params.size() < 2)
- {
- return false;
- }
- LLUUID inventory_id;
- if (!inventory_id.set(params[0], FALSE))
- {
- return false;
- }
-
- const std::string verb = params[1].asString();
- if (verb == "select")
- {
- uuid_vec_t items_to_open;
- items_to_open.push_back(inventory_id);
- //inventory_handler is just a stub, because we don't know from who this offer
- open_inventory_offer(items_to_open, "inventory_handler");
- return true;
- }
-
- return false;
- }
+ {
+ if (params.size() < 1)
+ {
+ return false;
+ }
+
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableInventory"))
+ {
+ LLNotificationsUtil::add("NoInventory", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ // support secondlife:///app/inventory/show
+ if (params[0].asString() == "show")
+ {
+ LLFloaterSidePanelContainer::showPanel("inventory", LLSD());
+ return true;
+ }
+
+ if (params[0].asString() == "filters")
+ {
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ if (sidepanel_inventory)
+ {
+ LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel();
+ if (main_inventory)
+ {
+ main_inventory->toggleFindOptions();
+ }
+ }
+ return true;
+ }
+
+ // otherwise, we need a UUID and a verb...
+ if (params.size() < 2)
+ {
+ return false;
+ }
+ LLUUID inventory_id;
+ if (!inventory_id.set(params[0], FALSE))
+ {
+ return false;
+ }
+
+ const std::string verb = params[1].asString();
+ if (verb == "select")
+ {
+ uuid_vec_t items_to_open;
+ items_to_open.push_back(inventory_id);
+ //inventory_handler is just a stub, because we don't know from who this offer
+ open_inventory_offer(items_to_open, "inventory_handler");
+ return true;
+ }
+
+ return false;
+ }
};
LLInventoryHandler gInventoryHandler;
@@ -323,55 +323,55 @@ LLInventoryHandler gInventoryHandler;
///----------------------------------------------------------------------------
LLViewerInventoryItem::LLViewerInventoryItem(const LLUUID& uuid,
- const LLUUID& parent_uuid,
- const LLPermissions& perm,
- const LLUUID& asset_uuid,
- LLAssetType::EType type,
- LLInventoryType::EType inv_type,
- const std::string& name,
- const std::string& desc,
- const LLSaleInfo& sale_info,
- U32 flags,
- time_t creation_date_utc) :
- LLInventoryItem(uuid, parent_uuid, perm, asset_uuid, type, inv_type,
- name, desc, sale_info, flags, creation_date_utc),
- mIsComplete(true)
+ const LLUUID& parent_uuid,
+ const LLPermissions& perm,
+ const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ LLInventoryType::EType inv_type,
+ const std::string& name,
+ const std::string& desc,
+ const LLSaleInfo& sale_info,
+ U32 flags,
+ time_t creation_date_utc) :
+ LLInventoryItem(uuid, parent_uuid, perm, asset_uuid, type, inv_type,
+ name, desc, sale_info, flags, creation_date_utc),
+ mIsComplete(true)
{
}
LLViewerInventoryItem::LLViewerInventoryItem(const LLUUID& item_id,
- const LLUUID& parent_id,
- const std::string& name,
- LLInventoryType::EType inv_type) :
- LLInventoryItem(),
- mIsComplete(false)
+ const LLUUID& parent_id,
+ const std::string& name,
+ LLInventoryType::EType inv_type) :
+ LLInventoryItem(),
+ mIsComplete(false)
{
- mUUID = item_id;
- mParentUUID = parent_id;
- mInventoryType = inv_type;
- mName = name;
+ mUUID = item_id;
+ mParentUUID = parent_id;
+ mInventoryType = inv_type;
+ mName = name;
}
LLViewerInventoryItem::LLViewerInventoryItem() :
- LLInventoryItem(),
- mIsComplete(false)
+ LLInventoryItem(),
+ mIsComplete(false)
{
}
LLViewerInventoryItem::LLViewerInventoryItem(const LLViewerInventoryItem* other) :
- LLInventoryItem()
+ LLInventoryItem()
{
- copyViewerItem(other);
- if (!mIsComplete)
- {
- LL_WARNS(LOG_INV) << "LLViewerInventoryItem copy constructor for incomplete item"
- << mUUID << LL_ENDL;
- }
+ copyViewerItem(other);
+ if (!mIsComplete)
+ {
+ LL_WARNS(LOG_INV) << "LLViewerInventoryItem copy constructor for incomplete item"
+ << mUUID << LL_ENDL;
+ }
}
LLViewerInventoryItem::LLViewerInventoryItem(const LLInventoryItem *other) :
- LLInventoryItem(other),
- mIsComplete(true)
+ LLInventoryItem(other),
+ mIsComplete(true)
{
}
@@ -382,50 +382,50 @@ LLViewerInventoryItem::~LLViewerInventoryItem()
void LLViewerInventoryItem::copyViewerItem(const LLViewerInventoryItem* other)
{
- LLInventoryItem::copyItem(other);
- mIsComplete = other->mIsComplete;
- mTransactionID = other->mTransactionID;
+ LLInventoryItem::copyItem(other);
+ mIsComplete = other->mIsComplete;
+ mTransactionID = other->mTransactionID;
}
// virtual
void LLViewerInventoryItem::copyItem(const LLInventoryItem *other)
{
- LLInventoryItem::copyItem(other);
- mIsComplete = true;
- mTransactionID.setNull();
+ LLInventoryItem::copyItem(other);
+ mIsComplete = true;
+ mTransactionID.setNull();
}
void LLViewerInventoryItem::cloneViewerItem(LLPointer<LLViewerInventoryItem>& newitem) const
{
- newitem = new LLViewerInventoryItem(this);
- if(newitem.notNull())
- {
- LLUUID item_id;
- item_id.generate();
- newitem->setUUID(item_id);
- }
+ newitem = new LLViewerInventoryItem(this);
+ if(newitem.notNull())
+ {
+ LLUUID item_id;
+ item_id.generate();
+ newitem->setUUID(item_id);
+ }
}
void LLViewerInventoryItem::updateServer(BOOL is_new) const
{
- if(!mIsComplete)
- {
- // *FIX: deal with this better.
- // If we're crashing here then the UI is incorrectly enabled.
- LL_ERRS(LOG_INV) << "LLViewerInventoryItem::updateServer() - for incomplete item"
- << LL_ENDL;
- return;
- }
- if(gAgent.getID() != mPermissions.getOwner())
- {
- // *FIX: deal with this better.
- LL_WARNS(LOG_INV) << "LLViewerInventoryItem::updateServer() - for unowned item "
- << ll_pretty_print_sd(this->asLLSD())
- << LL_ENDL;
- return;
- }
- LLInventoryModel::LLCategoryUpdate up(mParentUUID, is_new ? 1 : 0);
- gInventory.accountForUpdate(up);
+ if(!mIsComplete)
+ {
+ // *FIX: deal with this better.
+ // If we're crashing here then the UI is incorrectly enabled.
+ LL_ERRS(LOG_INV) << "LLViewerInventoryItem::updateServer() - for incomplete item"
+ << LL_ENDL;
+ return;
+ }
+ if(gAgent.getID() != mPermissions.getOwner())
+ {
+ // *FIX: deal with this better.
+ LL_WARNS(LOG_INV) << "LLViewerInventoryItem::updateServer() - for unowned item "
+ << ll_pretty_print_sd(this->asLLSD())
+ << LL_ENDL;
+ return;
+ }
+ LLInventoryModel::LLCategoryUpdate up(mParentUUID, is_new ? 1 : 0);
+ gInventory.accountForUpdate(up);
LLSD updates = asLLSD();
// Replace asset_id and/or shadow_id with transaction_id (hash_id)
@@ -451,8 +451,8 @@ void LLViewerInventoryItem::updateServer(BOOL is_new) const
void LLViewerInventoryItem::fetchFromServer(void) const
{
- if(!mIsComplete)
- {
+ if(!mIsComplete)
+ {
if (AISAPI::isAvailable()) // AIS v 3
{
LLInventoryModelBackgroundFetch::getInstance()->scheduleItemFetch(mUUID);
@@ -490,86 +490,86 @@ void LLViewerInventoryItem::fetchFromServer(void) const
gInventory.requestPost(true, url, body, handler, "Inventory Item");
}
}
- }
+ }
}
// virtual
BOOL LLViewerInventoryItem::unpackMessage(const LLSD& item)
{
- BOOL rv = LLInventoryItem::fromLLSD(item);
+ BOOL rv = LLInventoryItem::fromLLSD(item);
- LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName);
+ LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName);
- mIsComplete = TRUE;
- return rv;
+ mIsComplete = TRUE;
+ return rv;
}
// virtual
BOOL LLViewerInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num)
{
- BOOL rv = LLInventoryItem::unpackMessage(msg, block, block_num);
+ BOOL rv = LLInventoryItem::unpackMessage(msg, block, block_num);
- LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName);
+ LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName);
- mIsComplete = TRUE;
- return rv;
+ mIsComplete = TRUE;
+ return rv;
}
void LLViewerInventoryItem::setTransactionID(const LLTransactionID& transaction_id)
{
- mTransactionID = transaction_id;
+ mTransactionID = transaction_id;
}
void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const
{
- msg->addUUIDFast(_PREHASH_ItemID, mUUID);
- msg->addUUIDFast(_PREHASH_FolderID, mParentUUID);
- mPermissions.packMessage(msg);
- msg->addUUIDFast(_PREHASH_TransactionID, mTransactionID);
- S8 type = static_cast<S8>(mType);
- msg->addS8Fast(_PREHASH_Type, type);
- type = static_cast<S8>(mInventoryType);
- msg->addS8Fast(_PREHASH_InvType, type);
- msg->addU32Fast(_PREHASH_Flags, mFlags);
- mSaleInfo.packMessage(msg);
- msg->addStringFast(_PREHASH_Name, mName);
- msg->addStringFast(_PREHASH_Description, mDescription);
- msg->addS32Fast(_PREHASH_CreationDate, mCreationDate);
- U32 crc = getCRC32();
- msg->addU32Fast(_PREHASH_CRC, crc);
+ msg->addUUIDFast(_PREHASH_ItemID, mUUID);
+ msg->addUUIDFast(_PREHASH_FolderID, mParentUUID);
+ mPermissions.packMessage(msg);
+ msg->addUUIDFast(_PREHASH_TransactionID, mTransactionID);
+ S8 type = static_cast<S8>(mType);
+ msg->addS8Fast(_PREHASH_Type, type);
+ type = static_cast<S8>(mInventoryType);
+ msg->addS8Fast(_PREHASH_InvType, type);
+ msg->addU32Fast(_PREHASH_Flags, mFlags);
+ mSaleInfo.packMessage(msg);
+ msg->addStringFast(_PREHASH_Name, mName);
+ msg->addStringFast(_PREHASH_Description, mDescription);
+ msg->addS32Fast(_PREHASH_CreationDate, mCreationDate);
+ U32 crc = getCRC32();
+ msg->addU32Fast(_PREHASH_CRC, crc);
}
// virtual
BOOL LLViewerInventoryItem::importLegacyStream(std::istream& input_stream)
{
- BOOL rv = LLInventoryItem::importLegacyStream(input_stream);
- mIsComplete = TRUE;
- return rv;
+ BOOL rv = LLInventoryItem::importLegacyStream(input_stream);
+ mIsComplete = TRUE;
+ return rv;
}
void LLViewerInventoryItem::updateParentOnServer(BOOL restamp) const
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MoveInventoryItem);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addBOOLFast(_PREHASH_Stamp, restamp);
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addUUIDFast(_PREHASH_ItemID, mUUID);
- msg->addUUIDFast(_PREHASH_FolderID, mParentUUID);
- msg->addString("NewName", NULL);
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_MoveInventoryItem);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addBOOLFast(_PREHASH_Stamp, restamp);
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addUUIDFast(_PREHASH_ItemID, mUUID);
+ msg->addUUIDFast(_PREHASH_FolderID, mParentUUID);
+ msg->addString("NewName", NULL);
+ gAgent.sendReliableMessage();
}
//void LLViewerInventoryItem::setCloneCount(S32 clones)
//{
-// mClones = clones;
+// mClones = clones;
//}
//S32 LLViewerInventoryItem::getCloneCount() const
//{
-// return mClones;
+// return mClones;
//}
///----------------------------------------------------------------------------
@@ -577,31 +577,31 @@ void LLViewerInventoryItem::updateParentOnServer(BOOL restamp) const
///----------------------------------------------------------------------------
LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& uuid,
- const LLUUID& parent_uuid,
- LLFolderType::EType pref,
- const std::string& name,
- const LLUUID& owner_id) :
- LLInventoryCategory(uuid, parent_uuid, pref, name),
- mOwnerID(owner_id),
- mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN),
- mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN),
+ const LLUUID& parent_uuid,
+ LLFolderType::EType pref,
+ const std::string& name,
+ const LLUUID& owner_id) :
+ LLInventoryCategory(uuid, parent_uuid, pref, name),
+ mOwnerID(owner_id),
+ mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN),
+ mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN),
mFetching(FETCH_NONE)
{
- mDescendentsRequested.reset();
+ mDescendentsRequested.reset();
}
LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& owner_id) :
- mOwnerID(owner_id),
- mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN),
- mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN),
+ mOwnerID(owner_id),
+ mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN),
+ mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN),
mFetching(FETCH_NONE)
{
- mDescendentsRequested.reset();
+ mDescendentsRequested.reset();
}
LLViewerInventoryCategory::LLViewerInventoryCategory(const LLViewerInventoryCategory* other)
{
- copyViewerCategory(other);
+ copyViewerCategory(other);
mFetching = FETCH_NONE;
}
@@ -611,47 +611,47 @@ LLViewerInventoryCategory::~LLViewerInventoryCategory()
void LLViewerInventoryCategory::copyViewerCategory(const LLViewerInventoryCategory* other)
{
- copyCategory(other);
- mOwnerID = other->mOwnerID;
- setVersion(other->getVersion());
- mDescendentCount = other->mDescendentCount;
- mDescendentsRequested = other->mDescendentsRequested;
+ copyCategory(other);
+ mOwnerID = other->mOwnerID;
+ setVersion(other->getVersion());
+ mDescendentCount = other->mDescendentCount;
+ mDescendentsRequested = other->mDescendentsRequested;
}
void LLViewerInventoryCategory::packMessage(LLMessageSystem* msg) const
{
- msg->addUUIDFast(_PREHASH_FolderID, mUUID);
- msg->addUUIDFast(_PREHASH_ParentID, mParentUUID);
- S8 type = static_cast<S8>(mPreferredType);
- msg->addS8Fast(_PREHASH_Type, type);
- msg->addStringFast(_PREHASH_Name, mName);
+ msg->addUUIDFast(_PREHASH_FolderID, mUUID);
+ msg->addUUIDFast(_PREHASH_ParentID, mParentUUID);
+ S8 type = static_cast<S8>(mPreferredType);
+ msg->addS8Fast(_PREHASH_Type, type);
+ msg->addStringFast(_PREHASH_Name, mName);
}
void LLViewerInventoryCategory::updateParentOnServer(BOOL restamp) const
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MoveInventoryFolder);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_MoveInventoryFolder);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addBOOL("Stamp", restamp);
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addUUIDFast(_PREHASH_FolderID, mUUID);
- msg->addUUIDFast(_PREHASH_ParentID, mParentUUID);
- gAgent.sendReliableMessage();
+ msg->addBOOL("Stamp", restamp);
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addUUIDFast(_PREHASH_FolderID, mUUID);
+ msg->addUUIDFast(_PREHASH_ParentID, mParentUUID);
+ gAgent.sendReliableMessage();
}
void LLViewerInventoryCategory::updateServer(BOOL is_new) const
{
- // communicate that change with the server.
+ // communicate that change with the server.
- if (LLFolderType::lookupIsProtectedType(mPreferredType))
- {
- LLNotificationsUtil::add("CannotModifyProtectedCategories");
- return;
- }
+ if (LLFolderType::lookupIsProtectedType(mPreferredType))
+ {
+ LLNotificationsUtil::add("CannotModifyProtectedCategories");
+ return;
+ }
LLSD new_llsd = asLLSD();
AISAPI::completion_t cr = boost::bind(&doInventoryCb, (LLPointer<LLInventoryCallback>)NULL, _1);
@@ -660,39 +660,39 @@ void LLViewerInventoryCategory::updateServer(BOOL is_new) const
S32 LLViewerInventoryCategory::getVersion() const
{
- return mVersion;
+ return mVersion;
}
void LLViewerInventoryCategory::setVersion(S32 version)
{
- mVersion = version;
+ mVersion = version;
}
bool LLViewerInventoryCategory::fetch(S32 expiry_seconds)
{
- if((VERSION_UNKNOWN == getVersion())
- && mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads.
- {
- LL_DEBUGS(LOG_INV) << "Fetching category children: " << mName << ", UUID: " << mUUID << LL_ENDL;
- mDescendentsRequested.reset();
- mDescendentsRequested.setTimerExpirySec(expiry_seconds);
-
- std::string url;
- if (gAgent.getRegion())
- {
- url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2");
- }
- else
- {
- LL_WARNS_ONCE(LOG_INV) << "agent region is null" << LL_ENDL;
- }
- if (!url.empty() || AISAPI::isAvailable())
- {
- LLInventoryModelBackgroundFetch::instance().start(mUUID, false);
- }
- return true;
- }
- return false;
+ if((VERSION_UNKNOWN == getVersion())
+ && mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads.
+ {
+ LL_DEBUGS(LOG_INV) << "Fetching category children: " << mName << ", UUID: " << mUUID << LL_ENDL;
+ mDescendentsRequested.reset();
+ mDescendentsRequested.setTimerExpirySec(expiry_seconds);
+
+ std::string url;
+ if (gAgent.getRegion())
+ {
+ url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2");
+ }
+ else
+ {
+ LL_WARNS_ONCE(LOG_INV) << "agent region is null" << LL_ENDL;
+ }
+ if (!url.empty() || AISAPI::isAvailable())
+ {
+ LLInventoryModelBackgroundFetch::instance().start(mUUID, false);
+ }
+ return true;
+ }
+ return false;
}
LLViewerInventoryCategory::EFetchType LLViewerInventoryCategory::getFetching()
@@ -740,38 +740,38 @@ void LLViewerInventoryCategory::setFetching(LLViewerInventoryCategory::EFetchTyp
S32 LLViewerInventoryCategory::getViewerDescendentCount() const
{
- LLInventoryModel::cat_array_t* cats;
- LLInventoryModel::item_array_t* items;
- gInventory.getDirectDescendentsOf(getUUID(), cats, items);
- S32 descendents_actual = 0;
- if(cats && items)
- {
- descendents_actual = cats->size() + items->size();
- }
- return descendents_actual;
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ gInventory.getDirectDescendentsOf(getUUID(), cats, items);
+ S32 descendents_actual = 0;
+ if(cats && items)
+ {
+ descendents_actual = cats->size() + items->size();
+ }
+ return descendents_actual;
}
LLSD LLViewerInventoryCategory::exportLLSD() const
{
- LLSD cat_data = LLInventoryCategory::exportLLSD();
- cat_data[INV_OWNER_ID] = mOwnerID;
- cat_data[INV_VERSION] = mVersion;
+ LLSD cat_data = LLInventoryCategory::exportLLSD();
+ cat_data[INV_OWNER_ID] = mOwnerID;
+ cat_data[INV_VERSION] = mVersion;
- return cat_data;
+ return cat_data;
}
bool LLViewerInventoryCategory::importLLSD(const LLSD& cat_data)
{
- LLInventoryCategory::importLLSD(cat_data);
- if (cat_data.has(INV_OWNER_ID))
- {
- mOwnerID = cat_data[INV_OWNER_ID].asUUID();
- }
- if (cat_data.has(INV_VERSION))
- {
- setVersion(cat_data[INV_VERSION].asInteger());
- }
- return true;
+ LLInventoryCategory::importLLSD(cat_data);
+ if (cat_data.has(INV_OWNER_ID))
+ {
+ mOwnerID = cat_data[INV_OWNER_ID].asUUID();
+ }
+ if (cat_data.has(INV_VERSION))
+ {
+ setVersion(cat_data[INV_VERSION].asInteger());
+ }
+ return true;
}
bool LLViewerInventoryCategory::acceptItem(LLInventoryItem* inv_item)
@@ -806,94 +806,94 @@ bool LLViewerInventoryCategory::acceptItem(LLInventoryItem* inv_item)
void LLViewerInventoryCategory::determineFolderType()
{
- /* Do NOT uncomment this code. This is for future 2.1 support of ensembles.
- llassert(FALSE);
- LLFolderType::EType original_type = getPreferredType();
- if (LLFolderType::lookupIsProtectedType(original_type))
- return;
-
- U64 folder_valid = 0;
- U64 folder_invalid = 0;
- LLInventoryModel::cat_array_t category_array;
- LLInventoryModel::item_array_t item_array;
- gInventory.collectDescendents(getUUID(),category_array,item_array,FALSE);
-
- // For ensembles
- if (category_array.empty())
- {
- for (LLInventoryModel::item_array_t::iterator item_iter = item_array.begin();
- item_iter != item_array.end();
- item_iter++)
- {
- const LLViewerInventoryItem *item = (*item_iter);
- if (item->getIsLinkType())
- return;
- if (item->isWearableType())
- {
- const LLWearableType::EType wearable_type = item->getWearableType();
- const std::string& wearable_name = LLWearableType::getTypeName(wearable_type);
- U64 valid_folder_types = LLViewerFolderType::lookupValidFolderTypes(wearable_name);
- folder_valid |= valid_folder_types;
- folder_invalid |= ~valid_folder_types;
- }
- }
- for (U8 i = LLFolderType::FT_ENSEMBLE_START; i <= LLFolderType::FT_ENSEMBLE_END; i++)
- {
- if ((folder_valid & (1LL << i)) &&
- !(folder_invalid & (1LL << i)))
- {
- changeType((LLFolderType::EType)i);
- return;
- }
- }
- }
- if (LLFolderType::lookupIsEnsembleType(original_type))
- {
- changeType(LLFolderType::FT_NONE);
- }
- llassert(FALSE);
- */
+ /* Do NOT uncomment this code. This is for future 2.1 support of ensembles.
+ llassert(FALSE);
+ LLFolderType::EType original_type = getPreferredType();
+ if (LLFolderType::lookupIsProtectedType(original_type))
+ return;
+
+ U64 folder_valid = 0;
+ U64 folder_invalid = 0;
+ LLInventoryModel::cat_array_t category_array;
+ LLInventoryModel::item_array_t item_array;
+ gInventory.collectDescendents(getUUID(),category_array,item_array,FALSE);
+
+ // For ensembles
+ if (category_array.empty())
+ {
+ for (LLInventoryModel::item_array_t::iterator item_iter = item_array.begin();
+ item_iter != item_array.end();
+ item_iter++)
+ {
+ const LLViewerInventoryItem *item = (*item_iter);
+ if (item->getIsLinkType())
+ return;
+ if (item->isWearableType())
+ {
+ const LLWearableType::EType wearable_type = item->getWearableType();
+ const std::string& wearable_name = LLWearableType::getTypeName(wearable_type);
+ U64 valid_folder_types = LLViewerFolderType::lookupValidFolderTypes(wearable_name);
+ folder_valid |= valid_folder_types;
+ folder_invalid |= ~valid_folder_types;
+ }
+ }
+ for (U8 i = LLFolderType::FT_ENSEMBLE_START; i <= LLFolderType::FT_ENSEMBLE_END; i++)
+ {
+ if ((folder_valid & (1LL << i)) &&
+ !(folder_invalid & (1LL << i)))
+ {
+ changeType((LLFolderType::EType)i);
+ return;
+ }
+ }
+ }
+ if (LLFolderType::lookupIsEnsembleType(original_type))
+ {
+ changeType(LLFolderType::FT_NONE);
+ }
+ llassert(FALSE);
+ */
}
void LLViewerInventoryCategory::changeType(LLFolderType::EType new_folder_type)
{
- const LLUUID &folder_id = getUUID();
- const LLUUID &parent_id = getParentUUID();
- const std::string &name = getName();
-
+ const LLUUID &folder_id = getUUID();
+ const LLUUID &parent_id = getParentUUID();
+ const std::string &name = getName();
+
LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(folder_id,
parent_id,
new_folder_type,
name,
gAgent.getID());
-
-
+
+
LLSD new_llsd = new_cat->asLLSD();
AISAPI::completion_t cr = boost::bind(&doInventoryCb, (LLPointer<LLInventoryCallback>) NULL, _1);
AISAPI::UpdateCategory(folder_id, new_llsd, cr);
- setPreferredType(new_folder_type);
- gInventory.addChangedMask(LLInventoryObserver::LABEL, folder_id);
+ setPreferredType(new_folder_type);
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, folder_id);
}
void LLViewerInventoryCategory::localizeName()
{
- LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName);
+ LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName);
}
// virtual
BOOL LLViewerInventoryCategory::unpackMessage(const LLSD& category)
{
- BOOL rv = LLInventoryCategory::fromLLSD(category);
- localizeName();
- return rv;
+ BOOL rv = LLInventoryCategory::fromLLSD(category);
+ localizeName();
+ return rv;
}
// virtual
void LLViewerInventoryCategory::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num)
{
- LLInventoryCategory::unpackMessage(msg, block, block_num);
- localizeName();
+ LLInventoryCategory::unpackMessage(msg, block, block_num);
+ localizeName();
}
///----------------------------------------------------------------------------
@@ -903,161 +903,161 @@ void LLViewerInventoryCategory::unpackMessage(LLMessageSystem* msg, const char*
LLInventoryCallbackManager *LLInventoryCallbackManager::sInstance = NULL;
LLInventoryCallbackManager::LLInventoryCallbackManager() :
- mLastCallback(0)
+ mLastCallback(0)
{
- if( sInstance != NULL )
- {
- LL_WARNS(LOG_INV) << "LLInventoryCallbackManager::LLInventoryCallbackManager: unexpected multiple instances" << LL_ENDL;
- return;
- }
- sInstance = this;
+ if( sInstance != NULL )
+ {
+ LL_WARNS(LOG_INV) << "LLInventoryCallbackManager::LLInventoryCallbackManager: unexpected multiple instances" << LL_ENDL;
+ return;
+ }
+ sInstance = this;
}
LLInventoryCallbackManager::~LLInventoryCallbackManager()
{
- if( sInstance != this )
- {
- LL_WARNS(LOG_INV) << "LLInventoryCallbackManager::~LLInventoryCallbackManager: unexpected multiple instances" << LL_ENDL;
- return;
- }
- sInstance = NULL;
+ if( sInstance != this )
+ {
+ LL_WARNS(LOG_INV) << "LLInventoryCallbackManager::~LLInventoryCallbackManager: unexpected multiple instances" << LL_ENDL;
+ return;
+ }
+ sInstance = NULL;
}
-//static
+//static
void LLInventoryCallbackManager::destroyClass()
{
- if (sInstance)
- {
- for (callback_map_t::iterator it = sInstance->mMap.begin(), end_it = sInstance->mMap.end(); it != end_it; ++it)
- {
- // drop LLPointer reference to callback
- it->second = NULL;
- }
- sInstance->mMap.clear();
- }
+ if (sInstance)
+ {
+ for (callback_map_t::iterator it = sInstance->mMap.begin(), end_it = sInstance->mMap.end(); it != end_it; ++it)
+ {
+ // drop LLPointer reference to callback
+ it->second = NULL;
+ }
+ sInstance->mMap.clear();
+ }
}
U32 LLInventoryCallbackManager::registerCB(LLPointer<LLInventoryCallback> cb)
{
- if (cb.isNull())
- return 0;
+ if (cb.isNull())
+ return 0;
- mLastCallback++;
- if (!mLastCallback)
- mLastCallback++;
+ mLastCallback++;
+ if (!mLastCallback)
+ mLastCallback++;
- mMap[mLastCallback] = cb;
- return mLastCallback;
+ mMap[mLastCallback] = cb;
+ return mLastCallback;
}
void LLInventoryCallbackManager::fire(U32 callback_id, const LLUUID& item_id)
{
- if (!callback_id || item_id.isNull())
- return;
+ if (!callback_id || item_id.isNull())
+ return;
- std::map<U32, LLPointer<LLInventoryCallback> >::iterator i;
+ std::map<U32, LLPointer<LLInventoryCallback> >::iterator i;
- i = mMap.find(callback_id);
- if (i != mMap.end())
- {
- (*i).second->fire(item_id);
- mMap.erase(i);
- }
+ i = mMap.find(callback_id);
+ if (i != mMap.end())
+ {
+ (*i).second->fire(item_id);
+ mMap.erase(i);
+ }
}
void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp)
{
- if (inv_item.isNull())
- return;
+ if (inv_item.isNull())
+ return;
- LLViewerInventoryItem *item = gInventory.getItem(inv_item);
- if (item)
- {
- rez_attachment(item, attachmentp);
- }
+ LLViewerInventoryItem *item = gInventory.getItem(inv_item);
+ if (item)
+ {
+ rez_attachment(item, attachmentp);
+ }
}
void activate_gesture_cb(const LLUUID& inv_item)
{
- if (inv_item.isNull())
- return;
- LLViewerInventoryItem* item = gInventory.getItem(inv_item);
- if (!item)
- return;
- if (item->getType() != LLAssetType::AT_GESTURE)
- return;
+ if (inv_item.isNull())
+ return;
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (!item)
+ return;
+ if (item->getType() != LLAssetType::AT_GESTURE)
+ return;
- LLGestureMgr::instance().activateGesture(inv_item);
+ LLGestureMgr::instance().activateGesture(inv_item);
}
void set_default_permissions(LLViewerInventoryItem* item, std::string perm_type)
{
- llassert(item);
- LLPermissions perm = item->getPermissions();
- if (perm.getMaskEveryone() != LLFloaterPerms::getEveryonePerms(perm_type)
- || perm.getMaskGroup() != LLFloaterPerms::getGroupPerms(perm_type))
- {
- perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms(perm_type));
- perm.setMaskGroup(LLFloaterPerms::getGroupPerms(perm_type));
+ llassert(item);
+ LLPermissions perm = item->getPermissions();
+ if (perm.getMaskEveryone() != LLFloaterPerms::getEveryonePerms(perm_type)
+ || perm.getMaskGroup() != LLFloaterPerms::getGroupPerms(perm_type))
+ {
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms(perm_type));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms(perm_type));
- item->setPermissions(perm);
+ item->setPermissions(perm);
- item->updateServer(FALSE);
- }
+ item->updateServer(FALSE);
+ }
}
void create_script_cb(const LLUUID& inv_item)
{
- if (!inv_item.isNull())
- {
- LLViewerInventoryItem* item = gInventory.getItem(inv_item);
- if (item)
- {
- set_default_permissions(item, "Scripts");
+ if (!inv_item.isNull())
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (item)
+ {
+ set_default_permissions(item, "Scripts");
- // item was just created, update even if permissions did not changed
- gInventory.updateItem(item);
- gInventory.notifyObservers();
- }
- }
+ // item was just created, update even if permissions did not changed
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+ }
}
void create_gesture_cb(const LLUUID& inv_item)
{
- if (!inv_item.isNull())
- {
- LLGestureMgr::instance().activateGesture(inv_item);
-
- LLViewerInventoryItem* item = gInventory.getItem(inv_item);
- if (item)
- {
- set_default_permissions(item, "Gestures");
+ if (!inv_item.isNull())
+ {
+ LLGestureMgr::instance().activateGesture(inv_item);
+
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (item)
+ {
+ set_default_permissions(item, "Gestures");
- gInventory.updateItem(item);
- gInventory.notifyObservers();
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
- LLPreviewGesture* preview = LLPreviewGesture::show(inv_item, LLUUID::null);
- // Force to be entirely onscreen.
- gFloaterView->adjustToFitScreen(preview, FALSE);
- }
- }
+ LLPreviewGesture* preview = LLPreviewGesture::show(inv_item, LLUUID::null);
+ // Force to be entirely onscreen.
+ gFloaterView->adjustToFitScreen(preview, FALSE);
+ }
+ }
}
void create_notecard_cb(const LLUUID& inv_item)
{
- if (!inv_item.isNull())
- {
- LLViewerInventoryItem* item = gInventory.getItem(inv_item);
- if (item)
- {
- set_default_permissions(item, "Notecards");
+ if (!inv_item.isNull())
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (item)
+ {
+ set_default_permissions(item, "Notecards");
- gInventory.updateItem(item);
- gInventory.notifyObservers();
- }
- }
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+ }
}
void create_gltf_material_cb(const LLUUID& inv_item)
@@ -1090,24 +1090,24 @@ void create_inventory_item(
U32 next_owner_perm,
LLPointer<LLInventoryCallback> cb)
{
- //check if name is equal to one of special inventory items names
- //EXT-5839
- std::string server_name = name;
-
- {
- std::map<std::string, std::string>::const_iterator dictionary_iter;
-
- for (dictionary_iter = LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.begin();
- dictionary_iter != LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.end();
- dictionary_iter++)
- {
- const std::string& localized_name = dictionary_iter->second;
- if(localized_name == name)
- {
- server_name = dictionary_iter->first;
- }
- }
- }
+ //check if name is equal to one of special inventory items names
+ //EXT-5839
+ std::string server_name = name;
+
+ {
+ std::map<std::string, std::string>::const_iterator dictionary_iter;
+
+ for (dictionary_iter = LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.begin();
+ dictionary_iter != LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.end();
+ dictionary_iter++)
+ {
+ const std::string& localized_name = dictionary_iter->second;
+ if(localized_name == name)
+ {
+ server_name = dictionary_iter->first;
+ }
+ }
+ }
#ifdef USE_AIS_FOR_NC
// D567 18.03.2023 not yet implemented within AIS3
@@ -1157,23 +1157,23 @@ void create_inventory_item(
}
#endif
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_CreateInventoryItem);
- msg->nextBlock(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, agent_id);
- msg->addUUIDFast(_PREHASH_SessionID, session_id);
- msg->nextBlock(_PREHASH_InventoryBlock);
- msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb));
- msg->addUUIDFast(_PREHASH_FolderID, parent_id);
- msg->addUUIDFast(_PREHASH_TransactionID, transaction_id);
- msg->addU32Fast(_PREHASH_NextOwnerMask, next_owner_perm);
- msg->addS8Fast(_PREHASH_Type, (S8)asset_type);
- msg->addS8Fast(_PREHASH_InvType, (S8)inv_type);
- msg->addU8Fast(_PREHASH_WearableType, (U8)subtype);
- msg->addStringFast(_PREHASH_Name, server_name);
- msg->addStringFast(_PREHASH_Description, desc);
-
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_CreateInventoryItem);
+ msg->nextBlock(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, agent_id);
+ msg->addUUIDFast(_PREHASH_SessionID, session_id);
+ msg->nextBlock(_PREHASH_InventoryBlock);
+ msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb));
+ msg->addUUIDFast(_PREHASH_FolderID, parent_id);
+ msg->addUUIDFast(_PREHASH_TransactionID, transaction_id);
+ msg->addU32Fast(_PREHASH_NextOwnerMask, next_owner_perm);
+ msg->addS8Fast(_PREHASH_Type, (S8)asset_type);
+ msg->addS8Fast(_PREHASH_InvType, (S8)inv_type);
+ msg->addU8Fast(_PREHASH_WearableType, (U8)subtype);
+ msg->addStringFast(_PREHASH_Name, server_name);
+ msg->addStringFast(_PREHASH_Description, desc);
+
+ gAgent.sendReliableMessage();
}
void create_inventory_callingcard_callback(LLPointer<LLInventoryCallback> cb,
@@ -1197,7 +1197,7 @@ void create_inventory_callingcard_callback(LLPointer<LLInventoryCallback> cb,
void create_inventory_callingcard(const LLUUID& avatar_id, const LLUUID& parent /*= LLUUID::null*/, LLPointer<LLInventoryCallback> cb/*=NULL*/)
{
- LLAvatarName av_name;
+ LLAvatarName av_name;
LLAvatarNameCache::get(avatar_id, boost::bind(&create_inventory_callingcard_callback, cb, parent, _1, _2));
}
@@ -1217,145 +1217,145 @@ void create_inventory_wearable(const LLUUID& agent_id, const LLUUID& session_id,
void create_inventory_settings(const LLUUID& agent_id, const LLUUID& session_id,
const LLUUID& parent, const LLTransactionID& transaction_id,
const std::string& name,
- const std::string& desc,
+ const std::string& desc,
LLSettingsType::type_e settype,
U32 next_owner_perm,
LLPointer<LLInventoryCallback> cb)
{
create_inventory_item(agent_id, session_id, parent, transaction_id,
- name, desc, LLAssetType::AT_SETTINGS, LLInventoryType::IT_SETTINGS,
+ name, desc, LLAssetType::AT_SETTINGS, LLInventoryType::IT_SETTINGS,
static_cast<U8>(settype), next_owner_perm, cb);
}
void copy_inventory_item(
- const LLUUID& agent_id,
- const LLUUID& current_owner,
- const LLUUID& item_id,
- const LLUUID& parent_id,
- const std::string& new_name,
- LLPointer<LLInventoryCallback> cb)
-{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_CopyInventoryItem);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, agent_id);
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb));
- msg->addUUIDFast(_PREHASH_OldAgentID, current_owner);
- msg->addUUIDFast(_PREHASH_OldItemID, item_id);
- msg->addUUIDFast(_PREHASH_NewFolderID, parent_id);
- msg->addStringFast(_PREHASH_NewName, new_name);
- gAgent.sendReliableMessage();
+ const LLUUID& agent_id,
+ const LLUUID& current_owner,
+ const LLUUID& item_id,
+ const LLUUID& parent_id,
+ const std::string& new_name,
+ LLPointer<LLInventoryCallback> cb)
+{
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_CopyInventoryItem);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, agent_id);
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb));
+ msg->addUUIDFast(_PREHASH_OldAgentID, current_owner);
+ msg->addUUIDFast(_PREHASH_OldItemID, item_id);
+ msg->addUUIDFast(_PREHASH_NewFolderID, parent_id);
+ msg->addStringFast(_PREHASH_NewName, new_name);
+ gAgent.sendReliableMessage();
}
// Create link to single inventory object.
void link_inventory_object(const LLUUID& category,
- LLConstPointer<LLInventoryObject> baseobj,
- LLPointer<LLInventoryCallback> cb)
+ LLConstPointer<LLInventoryObject> baseobj,
+ LLPointer<LLInventoryCallback> cb)
{
- if (!baseobj)
- {
- LL_WARNS(LOG_INV) << "Attempt to link to non-existent object" << LL_ENDL;
- return;
- }
+ if (!baseobj)
+ {
+ LL_WARNS(LOG_INV) << "Attempt to link to non-existent object" << LL_ENDL;
+ return;
+ }
- LLInventoryObject::const_object_list_t obj_array;
- obj_array.push_back(baseobj);
- link_inventory_array(category, obj_array, cb);
+ LLInventoryObject::const_object_list_t obj_array;
+ obj_array.push_back(baseobj);
+ link_inventory_array(category, obj_array, cb);
}
void link_inventory_object(const LLUUID& category,
- const LLUUID& id,
- LLPointer<LLInventoryCallback> cb)
+ const LLUUID& id,
+ LLPointer<LLInventoryCallback> cb)
{
- LLConstPointer<LLInventoryObject> baseobj = gInventory.getObject(id);
- link_inventory_object(category, baseobj, cb);
+ LLConstPointer<LLInventoryObject> baseobj = gInventory.getObject(id);
+ link_inventory_object(category, baseobj, cb);
}
// Create links to all listed inventory objects.
void link_inventory_array(const LLUUID& category,
- LLInventoryObject::const_object_list_t& baseobj_array,
- LLPointer<LLInventoryCallback> cb)
+ LLInventoryObject::const_object_list_t& baseobj_array,
+ LLPointer<LLInventoryCallback> cb)
{
#ifndef LL_RELEASE_FOR_DOWNLOAD
- const LLViewerInventoryCategory *cat = gInventory.getCategory(category);
- const std::string cat_name = cat ? cat->getName() : "CAT NOT FOUND";
+ const LLViewerInventoryCategory *cat = gInventory.getCategory(category);
+ const std::string cat_name = cat ? cat->getName() : "CAT NOT FOUND";
#endif
- LLInventoryObject::const_object_list_t::const_iterator it = baseobj_array.begin();
- LLInventoryObject::const_object_list_t::const_iterator end = baseobj_array.end();
- LLSD links = LLSD::emptyArray();
- for (; it != end; ++it)
- {
- const LLInventoryObject* baseobj = *it;
- if (!baseobj)
- {
- LL_WARNS(LOG_INV) << "attempt to link to unknown object" << LL_ENDL;
- continue;
- }
-
- if (!LLAssetType::lookupCanLink(baseobj->getType()))
- {
- // Fail if item can be found but is of a type that can't be linked.
- // Arguably should fail if the item can't be found too, but that could
- // be a larger behavioral change.
- LL_WARNS(LOG_INV) << "attempt to link an unlinkable object, type = " << baseobj->getActualType() << LL_ENDL;
- continue;
- }
-
- LLInventoryType::EType inv_type = LLInventoryType::IT_NONE;
- LLAssetType::EType asset_type = LLAssetType::AT_NONE;
- std::string new_desc;
- LLUUID linkee_id;
- if (dynamic_cast<const LLInventoryCategory *>(baseobj))
- {
- inv_type = LLInventoryType::IT_CATEGORY;
- asset_type = LLAssetType::AT_LINK_FOLDER;
- linkee_id = baseobj->getUUID();
- }
- else
- {
- const LLViewerInventoryItem *baseitem = dynamic_cast<const LLViewerInventoryItem *>(baseobj);
- if (baseitem)
- {
- inv_type = baseitem->getInventoryType();
- new_desc = baseitem->getActualDescription();
- switch (baseitem->getActualType())
- {
- case LLAssetType::AT_LINK:
- case LLAssetType::AT_LINK_FOLDER:
- linkee_id = baseobj->getLinkedUUID();
- asset_type = baseitem->getActualType();
- break;
- default:
- linkee_id = baseobj->getUUID();
- asset_type = LLAssetType::AT_LINK;
- break;
- }
- }
- else
- {
- LL_WARNS(LOG_INV) << "could not convert object into an item or category: " << baseobj->getUUID() << LL_ENDL;
- continue;
- }
- }
-
- LLSD link = LLSD::emptyMap();
- link["linked_id"] = linkee_id;
- link["type"] = (S8)asset_type;
- link["inv_type"] = (S8)inv_type;
- link["name"] = baseobj->getName();
- link["desc"] = new_desc;
- links.append(link);
+ LLInventoryObject::const_object_list_t::const_iterator it = baseobj_array.begin();
+ LLInventoryObject::const_object_list_t::const_iterator end = baseobj_array.end();
+ LLSD links = LLSD::emptyArray();
+ for (; it != end; ++it)
+ {
+ const LLInventoryObject* baseobj = *it;
+ if (!baseobj)
+ {
+ LL_WARNS(LOG_INV) << "attempt to link to unknown object" << LL_ENDL;
+ continue;
+ }
+
+ if (!LLAssetType::lookupCanLink(baseobj->getType()))
+ {
+ // Fail if item can be found but is of a type that can't be linked.
+ // Arguably should fail if the item can't be found too, but that could
+ // be a larger behavioral change.
+ LL_WARNS(LOG_INV) << "attempt to link an unlinkable object, type = " << baseobj->getActualType() << LL_ENDL;
+ continue;
+ }
+
+ LLInventoryType::EType inv_type = LLInventoryType::IT_NONE;
+ LLAssetType::EType asset_type = LLAssetType::AT_NONE;
+ std::string new_desc;
+ LLUUID linkee_id;
+ if (dynamic_cast<const LLInventoryCategory *>(baseobj))
+ {
+ inv_type = LLInventoryType::IT_CATEGORY;
+ asset_type = LLAssetType::AT_LINK_FOLDER;
+ linkee_id = baseobj->getUUID();
+ }
+ else
+ {
+ const LLViewerInventoryItem *baseitem = dynamic_cast<const LLViewerInventoryItem *>(baseobj);
+ if (baseitem)
+ {
+ inv_type = baseitem->getInventoryType();
+ new_desc = baseitem->getActualDescription();
+ switch (baseitem->getActualType())
+ {
+ case LLAssetType::AT_LINK:
+ case LLAssetType::AT_LINK_FOLDER:
+ linkee_id = baseobj->getLinkedUUID();
+ asset_type = baseitem->getActualType();
+ break;
+ default:
+ linkee_id = baseobj->getUUID();
+ asset_type = LLAssetType::AT_LINK;
+ break;
+ }
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "could not convert object into an item or category: " << baseobj->getUUID() << LL_ENDL;
+ continue;
+ }
+ }
+
+ LLSD link = LLSD::emptyMap();
+ link["linked_id"] = linkee_id;
+ link["type"] = (S8)asset_type;
+ link["inv_type"] = (S8)inv_type;
+ link["name"] = baseobj->getName();
+ link["desc"] = new_desc;
+ links.append(link);
#ifndef LL_RELEASE_FOR_DOWNLOAD
- LL_DEBUGS(LOG_INV) << "Linking Object [ name:" << baseobj->getName()
- << " UUID:" << baseobj->getUUID()
- << " ] into Category [ name:" << cat_name
- << " UUID:" << category << " ] " << LL_ENDL;
+ LL_DEBUGS(LOG_INV) << "Linking Object [ name:" << baseobj->getName()
+ << " UUID:" << baseobj->getUUID()
+ << " ] into Category [ name:" << cat_name
+ << " UUID:" << category << " ] " << LL_ENDL;
#endif
- }
+ }
LLSD new_inventory = LLSD::emptyMap();
new_inventory["links"] = links;
AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1);
@@ -1363,35 +1363,35 @@ void link_inventory_array(const LLUUID& category,
}
void move_inventory_item(
- const LLUUID& agent_id,
- const LLUUID& session_id,
- const LLUUID& item_id,
- const LLUUID& parent_id,
- const std::string& new_name,
- LLPointer<LLInventoryCallback> cb)
-{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MoveInventoryItem);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, agent_id);
- msg->addUUIDFast(_PREHASH_SessionID, session_id);
- msg->addBOOLFast(_PREHASH_Stamp, FALSE);
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addUUIDFast(_PREHASH_ItemID, item_id);
- msg->addUUIDFast(_PREHASH_FolderID, parent_id);
- msg->addStringFast(_PREHASH_NewName, new_name);
- gAgent.sendReliableMessage();
+ const LLUUID& agent_id,
+ const LLUUID& session_id,
+ const LLUUID& item_id,
+ const LLUUID& parent_id,
+ const std::string& new_name,
+ LLPointer<LLInventoryCallback> cb)
+{
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_MoveInventoryItem);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, agent_id);
+ msg->addUUIDFast(_PREHASH_SessionID, session_id);
+ msg->addBOOLFast(_PREHASH_Stamp, FALSE);
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addUUIDFast(_PREHASH_ItemID, item_id);
+ msg->addUUIDFast(_PREHASH_FolderID, parent_id);
+ msg->addStringFast(_PREHASH_NewName, new_name);
+ gAgent.sendReliableMessage();
}
// Should call this with an update_item that's been copied and
// modified from an original source item, rather than modifying the
// source item directly.
void update_inventory_item(
- LLViewerInventoryItem *update_item,
- LLPointer<LLInventoryCallback> cb)
+ LLViewerInventoryItem *update_item,
+ LLPointer<LLInventoryCallback> cb)
{
- const LLUUID& item_id = update_item->getUUID();
-
+ const LLUUID& item_id = update_item->getUUID();
+
LLSD updates = update_item->asLLSD();
// Replace asset_id and/or shadow_id with transaction_id (hash_id)
if (updates.has("asset_id"))
@@ -1418,159 +1418,159 @@ void update_inventory_item(
// code path where available. Not all uses of item->updateServer() can
// easily be switched to this paradigm.
void update_inventory_item(
- const LLUUID& item_id,
- const LLSD& updates,
- LLPointer<LLInventoryCallback> cb)
+ const LLUUID& item_id,
+ const LLSD& updates,
+ LLPointer<LLInventoryCallback> cb)
{
AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1);
AISAPI::UpdateItem(item_id, updates, cr);
}
void update_inventory_category(
- const LLUUID& cat_id,
- const LLSD& updates,
- LLPointer<LLInventoryCallback> cb)
-{
- LLPointer<LLViewerInventoryCategory> obj = gInventory.getCategory(cat_id);
- LL_DEBUGS(LOG_INV) << "cat_id: [" << cat_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << LL_ENDL;
- if(obj)
- {
+ const LLUUID& cat_id,
+ const LLSD& updates,
+ LLPointer<LLInventoryCallback> cb)
+{
+ LLPointer<LLViewerInventoryCategory> obj = gInventory.getCategory(cat_id);
+ LL_DEBUGS(LOG_INV) << "cat_id: [" << cat_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << LL_ENDL;
+ if(obj)
+ {
if (LLFolderType::lookupIsProtectedType(obj->getPreferredType())
&& (updates.size() != 1 || !updates.has("thumbnail")))
- {
- LLNotificationsUtil::add("CannotModifyProtectedCategories");
- return;
- }
+ {
+ LLNotificationsUtil::add("CannotModifyProtectedCategories");
+ return;
+ }
AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1);
AISAPI::UpdateCategory(cat_id, updates, cr);
- }
+ }
}
void remove_inventory_items(
- LLInventoryObject::object_list_t& items_to_kill,
- LLPointer<LLInventoryCallback> cb
- )
+ LLInventoryObject::object_list_t& items_to_kill,
+ LLPointer<LLInventoryCallback> cb
+ )
{
- for (LLInventoryObject::object_list_t::iterator it = items_to_kill.begin();
- it != items_to_kill.end();
- ++it)
- {
- remove_inventory_item(*it, cb);
- }
+ for (LLInventoryObject::object_list_t::iterator it = items_to_kill.begin();
+ it != items_to_kill.end();
+ ++it)
+ {
+ remove_inventory_item(*it, cb);
+ }
}
void remove_inventory_item(
- const LLUUID& item_id,
- LLPointer<LLInventoryCallback> cb,
- bool immediate_delete)
+ const LLUUID& item_id,
+ LLPointer<LLInventoryCallback> cb,
+ bool immediate_delete)
{
- LLPointer<LLInventoryObject> obj = gInventory.getItem(item_id);
- if (obj)
- {
- remove_inventory_item(obj, cb, immediate_delete);
- }
- else
- {
- LL_DEBUGS(LOG_INV) << "item_id: [" << item_id << "] name " << "(NOT FOUND)" << LL_ENDL;
- }
+ LLPointer<LLInventoryObject> obj = gInventory.getItem(item_id);
+ if (obj)
+ {
+ remove_inventory_item(obj, cb, immediate_delete);
+ }
+ else
+ {
+ LL_DEBUGS(LOG_INV) << "item_id: [" << item_id << "] name " << "(NOT FOUND)" << LL_ENDL;
+ }
}
void remove_inventory_item(
- LLPointer<LLInventoryObject> obj,
- LLPointer<LLInventoryCallback> cb,
- bool immediate_delete)
-{
- if(obj)
- {
- const LLUUID item_id(obj->getUUID());
- LL_DEBUGS(LOG_INV) << "item_id: [" << item_id << "] name " << obj->getName() << LL_ENDL;
+ LLPointer<LLInventoryObject> obj,
+ LLPointer<LLInventoryCallback> cb,
+ bool immediate_delete)
+{
+ if(obj)
+ {
+ const LLUUID item_id(obj->getUUID());
+ LL_DEBUGS(LOG_INV) << "item_id: [" << item_id << "] name " << obj->getName() << LL_ENDL;
if (AISAPI::isAvailable())
- {
+ {
AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();
AISAPI::RemoveItem(item_id, cr);
- if (immediate_delete)
- {
- gInventory.onObjectDeletedFromServer(item_id);
- }
- }
+ if (immediate_delete)
+ {
+ gInventory.onObjectDeletedFromServer(item_id);
+ }
+ }
else
{
LL_WARNS(LOG_INV) << "Tried to use inventory without AIS API" << LL_ENDL;
}
- }
- else
- {
- // *TODO: Clean up callback?
- LL_WARNS(LOG_INV) << "remove_inventory_item called for invalid or nonexistent item." << LL_ENDL;
- }
+ }
+ else
+ {
+ // *TODO: Clean up callback?
+ LL_WARNS(LOG_INV) << "remove_inventory_item called for invalid or nonexistent item." << LL_ENDL;
+ }
}
class LLRemoveCategoryOnDestroy: public LLInventoryCallback
{
public:
- LLRemoveCategoryOnDestroy(const LLUUID& cat_id, LLPointer<LLInventoryCallback> cb):
- mID(cat_id),
- mCB(cb)
- {
- }
- /* virtual */ void fire(const LLUUID& item_id) {}
- ~LLRemoveCategoryOnDestroy()
- {
- LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(mID);
- if(children != LLInventoryModel::CHILDREN_NO)
- {
- LL_WARNS(LOG_INV) << "remove descendents failed, cannot remove category " << LL_ENDL;
- }
- else
- {
- remove_inventory_category(mID, mCB);
- }
- }
+ LLRemoveCategoryOnDestroy(const LLUUID& cat_id, LLPointer<LLInventoryCallback> cb):
+ mID(cat_id),
+ mCB(cb)
+ {
+ }
+ /* virtual */ void fire(const LLUUID& item_id) {}
+ ~LLRemoveCategoryOnDestroy()
+ {
+ LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(mID);
+ if(children != LLInventoryModel::CHILDREN_NO)
+ {
+ LL_WARNS(LOG_INV) << "remove descendents failed, cannot remove category " << LL_ENDL;
+ }
+ else
+ {
+ remove_inventory_category(mID, mCB);
+ }
+ }
private:
- LLUUID mID;
- LLPointer<LLInventoryCallback> mCB;
+ LLUUID mID;
+ LLPointer<LLInventoryCallback> mCB;
};
void remove_inventory_category(
- const LLUUID& cat_id,
- LLPointer<LLInventoryCallback> cb)
-{
- LL_DEBUGS(LOG_INV) << "cat_id: [" << cat_id << "] " << LL_ENDL;
- LLPointer<LLViewerInventoryCategory> obj = gInventory.getCategory(cat_id);
- if(obj)
- {
- if (!gInventory.isCategoryComplete(cat_id))
- {
- LL_WARNS() << "Removing (purging) incomplete category " << obj->getName() << LL_ENDL;
- }
- if(LLFolderType::lookupIsProtectedType(obj->getPreferredType()))
- {
- LLNotificationsUtil::add("CannotRemoveProtectedCategories");
- return;
- }
+ const LLUUID& cat_id,
+ LLPointer<LLInventoryCallback> cb)
+{
+ LL_DEBUGS(LOG_INV) << "cat_id: [" << cat_id << "] " << LL_ENDL;
+ LLPointer<LLViewerInventoryCategory> obj = gInventory.getCategory(cat_id);
+ if(obj)
+ {
+ if (!gInventory.isCategoryComplete(cat_id))
+ {
+ LL_WARNS() << "Removing (purging) incomplete category " << obj->getName() << LL_ENDL;
+ }
+ if(LLFolderType::lookupIsProtectedType(obj->getPreferredType()))
+ {
+ LLNotificationsUtil::add("CannotRemoveProtectedCategories");
+ return;
+ }
AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1);
AISAPI::RemoveCategory(cat_id, cr);
- }
- else
- {
- LL_WARNS(LOG_INV) << "remove_inventory_category called for invalid or nonexistent item " << cat_id << LL_ENDL;
- }
+ }
+ else
+ {
+ LL_WARNS(LOG_INV) << "remove_inventory_category called for invalid or nonexistent item " << cat_id << LL_ENDL;
+ }
}
void remove_inventory_object(
- const LLUUID& object_id,
- LLPointer<LLInventoryCallback> cb)
+ const LLUUID& object_id,
+ LLPointer<LLInventoryCallback> cb)
{
- if (gInventory.getCategory(object_id))
- {
- remove_inventory_category(object_id, cb);
- }
- else
- {
- remove_inventory_item(object_id, cb);
- }
+ if (gInventory.getCategory(object_id))
+ {
+ remove_inventory_category(object_id, cb);
+ }
+ else
+ {
+ remove_inventory_item(object_id, cb);
+ }
}
// This is a method which collects the descendents of the id
@@ -1580,105 +1580,105 @@ void remove_inventory_object(
// folders, items, etc in a fairly efficient manner.
void purge_descendents_of(const LLUUID& id, LLPointer<LLInventoryCallback> cb)
{
- LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(id);
- if(children == LLInventoryModel::CHILDREN_NO)
- {
- LL_DEBUGS(LOG_INV) << "No descendents to purge for " << id << LL_ENDL;
- return;
- }
- LLPointer<LLViewerInventoryCategory> cat = gInventory.getCategory(id);
- if (cat.notNull())
- {
- if (LLClipboard::instance().hasContents())
- {
- // Remove items from clipboard or it will remain active even if there is nothing to paste/copy
- LLInventoryModel::cat_array_t categories;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(id, categories, items, TRUE);
-
- for (LLInventoryModel::cat_array_t::const_iterator it = categories.begin(); it != categories.end(); ++it)
- {
- if (LLClipboard::instance().isOnClipboard((*it)->getUUID()))
- {
- // No sense in removing single items, partial 'paste' will result in confusion only
- LLClipboard::instance().reset();
- break;
- }
- }
- if (LLClipboard::instance().hasContents())
- {
- for (LLInventoryModel::item_array_t::const_iterator it = items.begin(); it != items.end(); ++it)
- {
- if (LLClipboard::instance().isOnClipboard((*it)->getUUID()))
- {
- LLClipboard::instance().reset();
- break;
- }
- }
- }
- }
-
- if (AISAPI::isAvailable())
- {
- if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN)
- {
- LL_WARNS() << "Purging not fetched folder: " << cat->getName() << LL_ENDL;
- }
- AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();
- AISAPI::PurgeDescendents(id, cr);
- }
+ LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(id);
+ if(children == LLInventoryModel::CHILDREN_NO)
+ {
+ LL_DEBUGS(LOG_INV) << "No descendents to purge for " << id << LL_ENDL;
+ return;
+ }
+ LLPointer<LLViewerInventoryCategory> cat = gInventory.getCategory(id);
+ if (cat.notNull())
+ {
+ if (LLClipboard::instance().hasContents())
+ {
+ // Remove items from clipboard or it will remain active even if there is nothing to paste/copy
+ LLInventoryModel::cat_array_t categories;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendents(id, categories, items, TRUE);
+
+ for (LLInventoryModel::cat_array_t::const_iterator it = categories.begin(); it != categories.end(); ++it)
+ {
+ if (LLClipboard::instance().isOnClipboard((*it)->getUUID()))
+ {
+ // No sense in removing single items, partial 'paste' will result in confusion only
+ LLClipboard::instance().reset();
+ break;
+ }
+ }
+ if (LLClipboard::instance().hasContents())
+ {
+ for (LLInventoryModel::item_array_t::const_iterator it = items.begin(); it != items.end(); ++it)
+ {
+ if (LLClipboard::instance().isOnClipboard((*it)->getUUID()))
+ {
+ LLClipboard::instance().reset();
+ break;
+ }
+ }
+ }
+ }
+
+ if (AISAPI::isAvailable())
+ {
+ if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN)
+ {
+ LL_WARNS() << "Purging not fetched folder: " << cat->getName() << LL_ENDL;
+ }
+ AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t();
+ AISAPI::PurgeDescendents(id, cr);
+ }
else
{
LL_WARNS(LOG_INV) << "Tried to use inventory without AIS API" << LL_ENDL;
}
- }
+ }
}
const LLUUID get_folder_by_itemtype(const LLInventoryItem *src)
{
- LLUUID retval = LLUUID::null;
-
- if (src)
- {
- retval = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType()));
- }
-
- return retval;
+ LLUUID retval = LLUUID::null;
+
+ if (src)
+ {
+ retval = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType()));
+ }
+
+ return retval;
}
void copy_inventory_from_notecard(const LLUUID& destination_id,
- const LLUUID& object_id,
- const LLUUID& notecard_inv_id,
- const LLInventoryItem *src,
- U32 callback_id)
-{
- if (NULL == src)
- {
- LL_WARNS(LOG_NOTECARD) << "Null pointer to item was passed for object_id "
- << object_id << " and notecard_inv_id "
- << notecard_inv_id << LL_ENDL;
- return;
- }
-
- LLViewerRegion* viewer_region = NULL;
+ const LLUUID& object_id,
+ const LLUUID& notecard_inv_id,
+ const LLInventoryItem *src,
+ U32 callback_id)
+{
+ if (NULL == src)
+ {
+ LL_WARNS(LOG_NOTECARD) << "Null pointer to item was passed for object_id "
+ << object_id << " and notecard_inv_id "
+ << notecard_inv_id << LL_ENDL;
+ return;
+ }
+
+ LLViewerRegion* viewer_region = NULL;
LLViewerObject* vo = NULL;
- if (object_id.notNull() && (vo = gObjectList.findObject(object_id)) != NULL)
+ if (object_id.notNull() && (vo = gObjectList.findObject(object_id)) != NULL)
{
viewer_region = vo->getRegion();
- }
+ }
- // Fallback to the agents region if for some reason the
- // object isn't found in the viewer.
- if (! viewer_region)
- {
- viewer_region = gAgent.getRegion();
- }
+ // Fallback to the agents region if for some reason the
+ // object isn't found in the viewer.
+ if (! viewer_region)
+ {
+ viewer_region = gAgent.getRegion();
+ }
- if (! viewer_region)
- {
+ if (! viewer_region)
+ {
LL_WARNS(LOG_NOTECARD) << "Can't find region from object_id "
- << object_id << " or gAgent"
- << LL_ENDL;
+ << object_id << " or gAgent"
+ << LL_ENDL;
return;
}
@@ -1686,11 +1686,11 @@ void copy_inventory_from_notecard(const LLUUID& destination_id,
body["notecard-id"] = notecard_inv_id;
body["object-id"] = object_id;
body["item-id"] = src->getUUID();
- body["folder-id"] = destination_id;
+ body["folder-id"] = destination_id;
body["callback-id"] = (LLSD::Integer)callback_id;
- /// *TODO: RIDER: This posts the request under the agents policy.
- /// When I convert the inventory over this call should be moved under that
+ /// *TODO: RIDER: This posts the request under the agents policy.
+ /// When I convert the inventory over this call should be moved under that
/// policy as well.
if (!gAgent.requestPostCapability("CopyInventoryFromNotecard", body))
{
@@ -1699,40 +1699,40 @@ void copy_inventory_from_notecard(const LLUUID& destination_id,
}
void create_new_item(const std::string& name,
- const LLUUID& parent_id,
- LLAssetType::EType asset_type,
- LLInventoryType::EType inv_type,
- U32 next_owner_perm,
+ const LLUUID& parent_id,
+ LLAssetType::EType asset_type,
+ LLInventoryType::EType inv_type,
+ U32 next_owner_perm,
std::function<void(const LLUUID&)> created_cb = NULL)
{
- std::string desc;
- LLViewerAssetType::generateDescriptionFor(asset_type, desc);
- next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER;
-
- LLPointer<LLBoostFuncInventoryCallback> cb = NULL;
-
- switch (inv_type)
- {
- case LLInventoryType::IT_LSL:
- {
- cb = new LLBoostFuncInventoryCallback(create_script_cb);
- next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Scripts");
- break;
- }
-
- case LLInventoryType::IT_GESTURE:
- {
- cb = new LLBoostFuncInventoryCallback(create_gesture_cb);
- next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Gestures");
- break;
- }
-
- case LLInventoryType::IT_NOTECARD:
- {
- cb = new LLBoostFuncInventoryCallback(create_notecard_cb);
- next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards");
- break;
- }
+ std::string desc;
+ LLViewerAssetType::generateDescriptionFor(asset_type, desc);
+ next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER;
+
+ LLPointer<LLBoostFuncInventoryCallback> cb = NULL;
+
+ switch (inv_type)
+ {
+ case LLInventoryType::IT_LSL:
+ {
+ cb = new LLBoostFuncInventoryCallback(create_script_cb);
+ next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Scripts");
+ break;
+ }
+
+ case LLInventoryType::IT_GESTURE:
+ {
+ cb = new LLBoostFuncInventoryCallback(create_gesture_cb);
+ next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Gestures");
+ break;
+ }
+
+ case LLInventoryType::IT_NOTECARD:
+ {
+ cb = new LLBoostFuncInventoryCallback(create_notecard_cb);
+ next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards");
+ break;
+ }
case LLInventoryType::IT_MATERIAL:
{
@@ -1751,22 +1751,22 @@ void create_new_item(const std::string& name,
cb->addOnFireFunc(created_cb);
}
- create_inventory_item(gAgent.getID(),
- gAgent.getSessionID(),
- parent_id,
- LLTransactionID::tnull,
- name,
- desc,
- asset_type,
- inv_type,
+ create_inventory_item(gAgent.getID(),
+ gAgent.getSessionID(),
+ parent_id,
+ LLTransactionID::tnull,
+ name,
+ desc,
+ asset_type,
+ inv_type,
NO_INV_SUBTYPE,
- next_owner_perm,
- cb);
-}
+ next_owner_perm,
+ cb);
+}
void slam_inventory_folder(const LLUUID& folder_id,
- const LLSD& contents,
- LLPointer<LLInventoryCallback> cb)
+ const LLSD& contents,
+ LLPointer<LLInventoryCallback> cb)
{
LL_DEBUGS(LOG_INV) << "using AISv3 to slam folder, id " << folder_id
<< " new contents: " << ll_pretty_print_sd(contents) << LL_ENDL;
@@ -1776,22 +1776,22 @@ void slam_inventory_folder(const LLUUID& folder_id,
}
void remove_folder_contents(const LLUUID& category, bool keep_outfit_links,
- LLPointer<LLInventoryCallback> cb)
-{
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(category, cats, items,
- LLInventoryModel::EXCLUDE_TRASH);
- for (S32 i = 0; i < items.size(); ++i)
- {
- LLViewerInventoryItem *item = items.at(i);
- if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER))
- continue;
- if (item->getIsLinkType())
- {
- remove_inventory_item(item->getUUID(), cb);
- }
- }
+ LLPointer<LLInventoryCallback> cb)
+{
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendents(category, cats, items,
+ LLInventoryModel::EXCLUDE_TRASH);
+ for (S32 i = 0; i < items.size(); ++i)
+ {
+ LLViewerInventoryItem *item = items.at(i);
+ if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER))
+ continue;
+ if (item->getIsLinkType())
+ {
+ remove_inventory_item(item->getUUID(), cb);
+ }
+ }
}
const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not)
@@ -1808,7 +1808,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge,
void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const LLSD& userdata, const LLUUID& default_parent_uuid, std::function<void(const LLUUID&)> created_cb)
{
std::string type_name = userdata.asString();
-
+
if (("inbox" == type_name) || ("category" == type_name) || ("current" == type_name) || ("outfit" == type_name) || ("my_otfts" == type_name))
{
LLFolderType::EType preferred_type = LLFolderType::lookup(type_name);
@@ -1890,7 +1890,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const L
LLAssetType::AT_MATERIAL,
LLInventoryType::IT_MATERIAL,
PERM_ALL,
- created_cb); // overridden in create_new_item
+ created_cb); // overridden in create_new_item
}
else if (("sky" == type_name) || ("water" == type_name) || ("daycycle" == type_name))
{
@@ -1940,125 +1940,125 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const L
LLAssetType::EType LLViewerInventoryItem::getType() const
{
- if (const LLViewerInventoryItem *linked_item = getLinkedItem())
- {
- return linked_item->getType();
- }
- if (const LLViewerInventoryCategory *linked_category = getLinkedCategory())
- {
- return linked_category->getType();
- }
- return LLInventoryItem::getType();
+ if (const LLViewerInventoryItem *linked_item = getLinkedItem())
+ {
+ return linked_item->getType();
+ }
+ if (const LLViewerInventoryCategory *linked_category = getLinkedCategory())
+ {
+ return linked_category->getType();
+ }
+ return LLInventoryItem::getType();
}
const LLUUID& LLViewerInventoryItem::getAssetUUID() const
{
- if (const LLViewerInventoryItem *linked_item = getLinkedItem())
- {
- return linked_item->getAssetUUID();
- }
+ if (const LLViewerInventoryItem *linked_item = getLinkedItem())
+ {
+ return linked_item->getAssetUUID();
+ }
- return LLInventoryItem::getAssetUUID();
+ return LLInventoryItem::getAssetUUID();
}
const LLUUID& LLViewerInventoryItem::getProtectedAssetUUID() const
{
- if (const LLViewerInventoryItem *linked_item = getLinkedItem())
- {
- return linked_item->getProtectedAssetUUID();
- }
+ if (const LLViewerInventoryItem *linked_item = getLinkedItem())
+ {
+ return linked_item->getProtectedAssetUUID();
+ }
- // check for conditions under which we may return a visible UUID to the user
- bool item_is_fullperm = getIsFullPerm();
- bool agent_is_godlike = gAgent.isGodlikeWithoutAdminMenuFakery();
- if (item_is_fullperm || agent_is_godlike)
- {
- return LLInventoryItem::getAssetUUID();
- }
+ // check for conditions under which we may return a visible UUID to the user
+ bool item_is_fullperm = getIsFullPerm();
+ bool agent_is_godlike = gAgent.isGodlikeWithoutAdminMenuFakery();
+ if (item_is_fullperm || agent_is_godlike)
+ {
+ return LLInventoryItem::getAssetUUID();
+ }
- return LLUUID::null;
+ return LLUUID::null;
}
const bool LLViewerInventoryItem::getIsFullPerm() const
{
- LLPermissions item_permissions = getPermissions();
+ LLPermissions item_permissions = getPermissions();
- // modify-ok & copy-ok & transfer-ok
- return ( item_permissions.allowOperationBy(PERM_MODIFY,
- gAgent.getID(),
- gAgent.getGroupID()) &&
- item_permissions.allowOperationBy(PERM_COPY,
- gAgent.getID(),
- gAgent.getGroupID()) &&
- item_permissions.allowOperationBy(PERM_TRANSFER,
- gAgent.getID(),
- gAgent.getGroupID()) );
+ // modify-ok & copy-ok & transfer-ok
+ return ( item_permissions.allowOperationBy(PERM_MODIFY,
+ gAgent.getID(),
+ gAgent.getGroupID()) &&
+ item_permissions.allowOperationBy(PERM_COPY,
+ gAgent.getID(),
+ gAgent.getGroupID()) &&
+ item_permissions.allowOperationBy(PERM_TRANSFER,
+ gAgent.getID(),
+ gAgent.getGroupID()) );
}
const std::string& LLViewerInventoryItem::getName() const
{
- if (const LLViewerInventoryItem *linked_item = getLinkedItem())
- {
- return linked_item->getName();
- }
- if (const LLViewerInventoryCategory *linked_category = getLinkedCategory())
- {
- return linked_category->getName();
- }
+ if (const LLViewerInventoryItem *linked_item = getLinkedItem())
+ {
+ return linked_item->getName();
+ }
+ if (const LLViewerInventoryCategory *linked_category = getLinkedCategory())
+ {
+ return linked_category->getName();
+ }
- return LLInventoryItem::getName();
+ return LLInventoryItem::getName();
}
S32 LLViewerInventoryItem::getSortField() const
{
- return LLFavoritesOrderStorage::instance().getSortIndex(mUUID);
+ return LLFavoritesOrderStorage::instance().getSortIndex(mUUID);
}
//void LLViewerInventoryItem::setSortField(S32 sortField)
//{
-// LLFavoritesOrderStorage::instance().setSortIndex(mUUID, sortField);
-// getSLURL();
+// LLFavoritesOrderStorage::instance().setSortIndex(mUUID, sortField);
+// getSLURL();
//}
void LLViewerInventoryItem::getSLURL()
{
- LLFavoritesOrderStorage::instance().getSLURL(mAssetUUID);
+ LLFavoritesOrderStorage::instance().getSLURL(mAssetUUID);
}
const LLPermissions& LLViewerInventoryItem::getPermissions() const
{
- // Use the actual permissions of the symlink, not its parent.
- return LLInventoryItem::getPermissions();
+ // Use the actual permissions of the symlink, not its parent.
+ return LLInventoryItem::getPermissions();
}
const LLUUID& LLViewerInventoryItem::getCreatorUUID() const
{
- if (const LLViewerInventoryItem *linked_item = getLinkedItem())
- {
- return linked_item->getCreatorUUID();
- }
+ if (const LLViewerInventoryItem *linked_item = getLinkedItem())
+ {
+ return linked_item->getCreatorUUID();
+ }
- return LLInventoryItem::getCreatorUUID();
+ return LLInventoryItem::getCreatorUUID();
}
const std::string& LLViewerInventoryItem::getDescription() const
{
- if (const LLViewerInventoryItem *linked_item = getLinkedItem())
- {
- return linked_item->getDescription();
- }
+ if (const LLViewerInventoryItem *linked_item = getLinkedItem())
+ {
+ return linked_item->getDescription();
+ }
- return LLInventoryItem::getDescription();
+ return LLInventoryItem::getDescription();
}
const LLSaleInfo& LLViewerInventoryItem::getSaleInfo() const
-{
- if (const LLViewerInventoryItem *linked_item = getLinkedItem())
- {
- return linked_item->getSaleInfo();
- }
+{
+ if (const LLViewerInventoryItem *linked_item = getLinkedItem())
+ {
+ return linked_item->getSaleInfo();
+ }
- return LLInventoryItem::getSaleInfo();
+ return LLInventoryItem::getSaleInfo();
}
const LLUUID& LLViewerInventoryItem::getThumbnailUUID() const
@@ -2082,42 +2082,42 @@ const LLUUID& LLViewerInventoryItem::getThumbnailUUID() const
LLInventoryType::EType LLViewerInventoryItem::getInventoryType() const
{
- if (const LLViewerInventoryItem *linked_item = getLinkedItem())
- {
- return linked_item->getInventoryType();
- }
+ if (const LLViewerInventoryItem *linked_item = getLinkedItem())
+ {
+ return linked_item->getInventoryType();
+ }
- // Categories don't have types. If this item is an AT_FOLDER_LINK,
- // treat it as a category.
- if (getLinkedCategory())
- {
- return LLInventoryType::IT_CATEGORY;
- }
+ // Categories don't have types. If this item is an AT_FOLDER_LINK,
+ // treat it as a category.
+ if (getLinkedCategory())
+ {
+ return LLInventoryType::IT_CATEGORY;
+ }
- return LLInventoryItem::getInventoryType();
+ return LLInventoryItem::getInventoryType();
}
U32 LLViewerInventoryItem::getFlags() const
{
- if (const LLViewerInventoryItem *linked_item = getLinkedItem())
- {
- return linked_item->getFlags();
- }
- return LLInventoryItem::getFlags();
+ if (const LLViewerInventoryItem *linked_item = getLinkedItem())
+ {
+ return linked_item->getFlags();
+ }
+ return LLInventoryItem::getFlags();
}
bool LLViewerInventoryItem::isWearableType() const
{
- return (getInventoryType() == LLInventoryType::IT_WEARABLE);
+ return (getInventoryType() == LLInventoryType::IT_WEARABLE);
}
LLWearableType::EType LLViewerInventoryItem::getWearableType() const
{
- if (!isWearableType())
- {
- return LLWearableType::WT_INVALID;
- }
- return LLWearableType::inventoryFlagsToWearableType(getFlags());
+ if (!isWearableType())
+ {
+ return LLWearableType::WT_INVALID;
+ }
+ return LLWearableType::inventoryFlagsToWearableType(getFlags());
}
bool LLViewerInventoryItem::isSettingsType() const
@@ -2136,197 +2136,197 @@ LLSettingsType::type_e LLViewerInventoryItem::getSettingsType() const
time_t LLViewerInventoryItem::getCreationDate() const
{
- return LLInventoryItem::getCreationDate();
+ return LLInventoryItem::getCreationDate();
}
U32 LLViewerInventoryItem::getCRC32() const
{
- return LLInventoryItem::getCRC32();
+ return LLInventoryItem::getCRC32();
}
// *TODO: mantipov: should be removed with LMSortPrefix patch in llinventorymodel.cpp, EXT-3985
static char getSeparator() { return '@'; }
BOOL LLViewerInventoryItem::extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName)
{
- using std::string;
- using std::stringstream;
+ using std::string;
+ using std::stringstream;
- const char separator = getSeparator();
- const string::size_type separatorPos = name.find(separator, 0);
+ const char separator = getSeparator();
+ const string::size_type separatorPos = name.find(separator, 0);
- BOOL result = FALSE;
+ BOOL result = FALSE;
- if (separatorPos < string::npos)
- {
- if (sortField)
- {
- /*
- * The conversion from string to S32 is made this way instead of old plain
- * atoi() to ensure portability. If on some other platform S32 will not be
- * defined to be signed int, this conversion will still work because of
- * operators overloading, but atoi() may fail.
- */
- stringstream ss(name.substr(0, separatorPos));
- ss >> *sortField;
- }
+ if (separatorPos < string::npos)
+ {
+ if (sortField)
+ {
+ /*
+ * The conversion from string to S32 is made this way instead of old plain
+ * atoi() to ensure portability. If on some other platform S32 will not be
+ * defined to be signed int, this conversion will still work because of
+ * operators overloading, but atoi() may fail.
+ */
+ stringstream ss(name.substr(0, separatorPos));
+ ss >> *sortField;
+ }
- if (displayName)
- {
- *displayName = name.substr(separatorPos + 1, string::npos);
- }
+ if (displayName)
+ {
+ *displayName = name.substr(separatorPos + 1, string::npos);
+ }
- result = TRUE;
- }
+ result = TRUE;
+ }
- return result;
+ return result;
}
-// This returns true if the item that this item points to
+// This returns true if the item that this item points to
// doesn't exist in memory (i.e. LLInventoryModel). The baseitem
// might still be in the database but just not loaded yet.
bool LLViewerInventoryItem::getIsBrokenLink() const
{
- // If the item's type resolves to be a link, that means either:
- // A. It wasn't able to perform indirection, i.e. the baseobj doesn't exist in memory.
- // B. It's pointing to another link, which is illegal.
- return LLAssetType::lookupIsLinkType(getType());
+ // If the item's type resolves to be a link, that means either:
+ // A. It wasn't able to perform indirection, i.e. the baseobj doesn't exist in memory.
+ // B. It's pointing to another link, which is illegal.
+ return LLAssetType::lookupIsLinkType(getType());
}
LLViewerInventoryItem *LLViewerInventoryItem::getLinkedItem() const
{
- if (mType == LLAssetType::AT_LINK)
- {
- LLViewerInventoryItem *linked_item = gInventory.getItem(mAssetUUID);
- if (linked_item && linked_item->getIsLinkType())
- {
- LL_WARNS(LOG_INV) << "Warning: Accessing link to link" << LL_ENDL;
- return NULL;
- }
- return linked_item;
- }
- return NULL;
+ if (mType == LLAssetType::AT_LINK)
+ {
+ LLViewerInventoryItem *linked_item = gInventory.getItem(mAssetUUID);
+ if (linked_item && linked_item->getIsLinkType())
+ {
+ LL_WARNS(LOG_INV) << "Warning: Accessing link to link" << LL_ENDL;
+ return NULL;
+ }
+ return linked_item;
+ }
+ return NULL;
}
LLViewerInventoryCategory *LLViewerInventoryItem::getLinkedCategory() const
{
- if (mType == LLAssetType::AT_LINK_FOLDER)
- {
- LLViewerInventoryCategory *linked_category = gInventory.getCategory(mAssetUUID);
- return linked_category;
- }
- return NULL;
+ if (mType == LLAssetType::AT_LINK_FOLDER)
+ {
+ LLViewerInventoryCategory *linked_category = gInventory.getCategory(mAssetUUID);
+ return linked_category;
+ }
+ return NULL;
}
bool LLViewerInventoryItem::checkPermissionsSet(PermissionMask mask) const
{
- const LLPermissions& perm = getPermissions();
- PermissionMask curr_mask = PERM_NONE;
- if(perm.getOwner() == gAgent.getID())
- {
- curr_mask = perm.getMaskBase();
- }
- else if(gAgent.isInGroup(perm.getGroup()))
- {
- curr_mask = perm.getMaskGroup();
- }
- else
- {
- curr_mask = perm.getMaskEveryone();
- }
- return ((curr_mask & mask) == mask);
+ const LLPermissions& perm = getPermissions();
+ PermissionMask curr_mask = PERM_NONE;
+ if(perm.getOwner() == gAgent.getID())
+ {
+ curr_mask = perm.getMaskBase();
+ }
+ else if(gAgent.isInGroup(perm.getGroup()))
+ {
+ curr_mask = perm.getMaskGroup();
+ }
+ else
+ {
+ curr_mask = perm.getMaskEveryone();
+ }
+ return ((curr_mask & mask) == mask);
}
PermissionMask LLViewerInventoryItem::getPermissionMask() const
{
- const LLPermissions& permissions = getPermissions();
+ const LLPermissions& permissions = getPermissions();
- BOOL copy = permissions.allowCopyBy(gAgent.getID());
- BOOL mod = permissions.allowModifyBy(gAgent.getID());
- BOOL xfer = permissions.allowOperationBy(PERM_TRANSFER, gAgent.getID());
- PermissionMask perm_mask = 0;
- if (copy) perm_mask |= PERM_COPY;
- if (mod) perm_mask |= PERM_MODIFY;
- if (xfer) perm_mask |= PERM_TRANSFER;
- return perm_mask;
+ BOOL copy = permissions.allowCopyBy(gAgent.getID());
+ BOOL mod = permissions.allowModifyBy(gAgent.getID());
+ BOOL xfer = permissions.allowOperationBy(PERM_TRANSFER, gAgent.getID());
+ PermissionMask perm_mask = 0;
+ if (copy) perm_mask |= PERM_COPY;
+ if (mod) perm_mask |= PERM_MODIFY;
+ if (xfer) perm_mask |= PERM_TRANSFER;
+ return perm_mask;
}
//----------
void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const LLAvatarName& name)
{
- rename(name.getUserName());
- gInventory.addChangedMask(LLInventoryObserver::LABEL, getUUID());
- gInventory.notifyObservers();
+ rename(name.getUserName());
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, getUUID());
+ gInventory.notifyObservers();
}
class LLRegenerateLinkCollector : public LLInventoryCollectFunctor
{
public:
- LLRegenerateLinkCollector(const LLViewerInventoryItem *target_item) : mTargetItem(target_item) {}
- virtual ~LLRegenerateLinkCollector() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
- {
- if (item)
- {
- if ((item->getName() == mTargetItem->getName()) &&
- (item->getInventoryType() == mTargetItem->getInventoryType()) &&
- (!item->getIsLinkType()))
- {
- return true;
- }
- }
- return false;
- }
+ LLRegenerateLinkCollector(const LLViewerInventoryItem *target_item) : mTargetItem(target_item) {}
+ virtual ~LLRegenerateLinkCollector() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item)
+ {
+ if (item)
+ {
+ if ((item->getName() == mTargetItem->getName()) &&
+ (item->getInventoryType() == mTargetItem->getInventoryType()) &&
+ (!item->getIsLinkType()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
protected:
- const LLViewerInventoryItem* mTargetItem;
+ const LLViewerInventoryItem* mTargetItem;
};
LLUUID find_possible_item_for_regeneration(const LLViewerInventoryItem *target_item)
{
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
-
- LLRegenerateLinkCollector candidate_matches(target_item);
- gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- candidate_matches);
- for (LLViewerInventoryItem::item_array_t::const_iterator item_iter = items.begin();
- item_iter != items.end();
- ++item_iter)
- {
- const LLViewerInventoryItem *item = (*item_iter);
- if (true) return item->getUUID();
- }
- return LLUUID::null;
-}
-
-// This currently dosen't work, because the sim does not allow us
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+
+ LLRegenerateLinkCollector candidate_matches(target_item);
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ candidate_matches);
+ for (LLViewerInventoryItem::item_array_t::const_iterator item_iter = items.begin();
+ item_iter != items.end();
+ ++item_iter)
+ {
+ const LLViewerInventoryItem *item = (*item_iter);
+ if (true) return item->getUUID();
+ }
+ return LLUUID::null;
+}
+
+// This currently dosen't work, because the sim does not allow us
// to change an item's assetID.
BOOL LLViewerInventoryItem::regenerateLink()
{
- const LLUUID target_item_id = find_possible_item_for_regeneration(this);
- if (target_item_id.isNull())
- return FALSE;
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLAssetIDMatches asset_id_matches(getAssetUUID());
- gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- asset_id_matches);
- for (LLViewerInventoryItem::item_array_t::iterator item_iter = items.begin();
- item_iter != items.end();
- item_iter++)
- {
- LLViewerInventoryItem *item = (*item_iter);
- item->setAssetUUID(target_item_id);
- item->updateServer(FALSE);
- gInventory.addChangedMask(LLInventoryObserver::REBUILD, item->getUUID());
- }
- gInventory.notifyObservers();
- return TRUE;
+ const LLUUID target_item_id = find_possible_item_for_regeneration(this);
+ if (target_item_id.isNull())
+ return FALSE;
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLAssetIDMatches asset_id_matches(getAssetUUID());
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ asset_id_matches);
+ for (LLViewerInventoryItem::item_array_t::iterator item_iter = items.begin();
+ item_iter != items.end();
+ item_iter++)
+ {
+ LLViewerInventoryItem *item = (*item_iter);
+ item->setAssetUUID(target_item_id);
+ item->updateServer(FALSE);
+ gInventory.addChangedMask(LLInventoryObserver::REBUILD, item->getUUID());
+ }
+ gInventory.notifyObservers();
+ return TRUE;
}
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index 0d0ccc6643..158965fc88 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerinventory.h
* @brief Declaration of the inventory bits that only used on the viewer.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
#include "llinitdestroyclass.h" //for LLDestroyClass
#include "llinventorysettings.h"
-#include <boost/signals2.hpp> // boost::signals2::trackable
+#include <boost/signals2.hpp> // boost::signals2::trackable
class LLInventoryPanel;
class LLFolderView;
@@ -52,120 +52,120 @@ class LLAvatarName;
class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::trackable
{
public:
- typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
-
+ typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
+
protected:
- ~LLViewerInventoryItem( void ); // ref counted
- BOOL extractSortFieldAndDisplayName(S32* sortField, std::string* displayName) const { return extractSortFieldAndDisplayName(mName, sortField, displayName); }
- mutable std::string mDisplayName;
-
+ ~LLViewerInventoryItem( void ); // ref counted
+ BOOL extractSortFieldAndDisplayName(S32* sortField, std::string* displayName) const { return extractSortFieldAndDisplayName(mName, sortField, displayName); }
+ mutable std::string mDisplayName;
+
public:
- virtual LLAssetType::EType getType() const;
- virtual const LLUUID& getAssetUUID() const;
- virtual const LLUUID& getProtectedAssetUUID() const; // returns LLUUID::null if current agent does not have permission to expose this asset's UUID to the user
- virtual const std::string& getName() const;
- virtual S32 getSortField() const;
- //virtual void setSortField(S32 sortField);
- virtual void getSLURL(); //Caches SLURL for landmark. //*TODO: Find a better way to do it and remove this method from here.
- virtual const LLPermissions& getPermissions() const;
- virtual const bool getIsFullPerm() const; // 'fullperm' in the popular sense: modify-ok & copy-ok & transfer-ok, no special god rules applied
- virtual const LLUUID& getCreatorUUID() const;
- virtual const std::string& getDescription() const;
- virtual const LLSaleInfo& getSaleInfo() const;
+ virtual LLAssetType::EType getType() const;
+ virtual const LLUUID& getAssetUUID() const;
+ virtual const LLUUID& getProtectedAssetUUID() const; // returns LLUUID::null if current agent does not have permission to expose this asset's UUID to the user
+ virtual const std::string& getName() const;
+ virtual S32 getSortField() const;
+ //virtual void setSortField(S32 sortField);
+ virtual void getSLURL(); //Caches SLURL for landmark. //*TODO: Find a better way to do it and remove this method from here.
+ virtual const LLPermissions& getPermissions() const;
+ virtual const bool getIsFullPerm() const; // 'fullperm' in the popular sense: modify-ok & copy-ok & transfer-ok, no special god rules applied
+ virtual const LLUUID& getCreatorUUID() const;
+ virtual const std::string& getDescription() const;
+ virtual const LLSaleInfo& getSaleInfo() const;
virtual const LLUUID& getThumbnailUUID() const;
- virtual LLInventoryType::EType getInventoryType() const;
- virtual bool isWearableType() const;
- virtual LLWearableType::EType getWearableType() const;
+ virtual LLInventoryType::EType getInventoryType() const;
+ virtual bool isWearableType() const;
+ virtual LLWearableType::EType getWearableType() const;
virtual bool isSettingsType() const;
virtual LLSettingsType::type_e getSettingsType() const;
- virtual U32 getFlags() const;
- virtual time_t getCreationDate() const;
- virtual U32 getCRC32() const; // really more of a checksum.
-
- static BOOL extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName);
-
- // construct a complete viewer inventory item
- LLViewerInventoryItem(const LLUUID& uuid, const LLUUID& parent_uuid,
- const LLPermissions& permissions,
- const LLUUID& asset_uuid,
- LLAssetType::EType type,
- LLInventoryType::EType inv_type,
- const std::string& name,
- const std::string& desc,
- const LLSaleInfo& sale_info,
- U32 flags,
- time_t creation_date_utc);
-
- // construct a viewer inventory item which has the minimal amount
- // of information to use in the UI.
- LLViewerInventoryItem(
- const LLUUID& item_id,
- const LLUUID& parent_id,
- const std::string& name,
- LLInventoryType::EType inv_type);
-
- // construct an invalid and incomplete viewer inventory item.
- // usually useful for unpacking or importing or what have you.
- // *NOTE: it is important to call setComplete() if you expect the
- // operations to provide all necessary information.
- LLViewerInventoryItem();
- // Create a copy of an inventory item from a pointer to another item
- // Note: Because InventoryItems are ref counted,
- // reference copy (a = b) is prohibited
- LLViewerInventoryItem(const LLViewerInventoryItem* other);
- LLViewerInventoryItem(const LLInventoryItem* other);
-
- void copyViewerItem(const LLViewerInventoryItem* other);
- /*virtual*/ void copyItem(const LLInventoryItem* other);
-
- // construct a new clone of this item - it creates a new viewer
- // inventory item using the copy constructor, and returns it.
- // It is up to the caller to delete (unref) the item.
- void cloneViewerItem(LLPointer<LLViewerInventoryItem>& newitem) const;
-
- // virtual methods
- virtual void updateParentOnServer(BOOL restamp) const;
- virtual void updateServer(BOOL is_new) const;
- void fetchFromServer(void) const;
-
- virtual void packMessage(LLMessageSystem* msg) const;
- virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
- virtual BOOL unpackMessage(const LLSD& item);
- virtual BOOL importLegacyStream(std::istream& input_stream);
-
- // new methods
- bool isFinished() const { return mIsComplete; }
- void setComplete(bool complete) { mIsComplete = complete; }
- //void updateAssetOnServer() const;
-
- virtual void setTransactionID(const LLTransactionID& transaction_id);
- struct comparePointers
- {
- bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
- {
- return a->getName().compare(b->getName()) < 0;
- }
- };
- LLTransactionID getTransactionID() const { return mTransactionID; }
-
- bool getIsBrokenLink() const; // true if the baseitem this points to doesn't exist in memory.
- LLViewerInventoryItem *getLinkedItem() const;
- LLViewerInventoryCategory *getLinkedCategory() const;
-
- // Checks the items permissions (for owner, group, or everyone) and returns true if all mask bits are set.
- bool checkPermissionsSet(PermissionMask mask) const;
- PermissionMask getPermissionMask() const;
-
- // callback
- void onCallingCardNameLookup(const LLUUID& id, const LLAvatarName& name);
-
- // If this is a broken link, try to fix it and any other identical link.
- BOOL regenerateLink();
+ virtual U32 getFlags() const;
+ virtual time_t getCreationDate() const;
+ virtual U32 getCRC32() const; // really more of a checksum.
+
+ static BOOL extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName);
+
+ // construct a complete viewer inventory item
+ LLViewerInventoryItem(const LLUUID& uuid, const LLUUID& parent_uuid,
+ const LLPermissions& permissions,
+ const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ LLInventoryType::EType inv_type,
+ const std::string& name,
+ const std::string& desc,
+ const LLSaleInfo& sale_info,
+ U32 flags,
+ time_t creation_date_utc);
+
+ // construct a viewer inventory item which has the minimal amount
+ // of information to use in the UI.
+ LLViewerInventoryItem(
+ const LLUUID& item_id,
+ const LLUUID& parent_id,
+ const std::string& name,
+ LLInventoryType::EType inv_type);
+
+ // construct an invalid and incomplete viewer inventory item.
+ // usually useful for unpacking or importing or what have you.
+ // *NOTE: it is important to call setComplete() if you expect the
+ // operations to provide all necessary information.
+ LLViewerInventoryItem();
+ // Create a copy of an inventory item from a pointer to another item
+ // Note: Because InventoryItems are ref counted,
+ // reference copy (a = b) is prohibited
+ LLViewerInventoryItem(const LLViewerInventoryItem* other);
+ LLViewerInventoryItem(const LLInventoryItem* other);
+
+ void copyViewerItem(const LLViewerInventoryItem* other);
+ /*virtual*/ void copyItem(const LLInventoryItem* other);
+
+ // construct a new clone of this item - it creates a new viewer
+ // inventory item using the copy constructor, and returns it.
+ // It is up to the caller to delete (unref) the item.
+ void cloneViewerItem(LLPointer<LLViewerInventoryItem>& newitem) const;
+
+ // virtual methods
+ virtual void updateParentOnServer(BOOL restamp) const;
+ virtual void updateServer(BOOL is_new) const;
+ void fetchFromServer(void) const;
+
+ virtual void packMessage(LLMessageSystem* msg) const;
+ virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
+ virtual BOOL unpackMessage(const LLSD& item);
+ virtual BOOL importLegacyStream(std::istream& input_stream);
+
+ // new methods
+ bool isFinished() const { return mIsComplete; }
+ void setComplete(bool complete) { mIsComplete = complete; }
+ //void updateAssetOnServer() const;
+
+ virtual void setTransactionID(const LLTransactionID& transaction_id);
+ struct comparePointers
+ {
+ bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
+ {
+ return a->getName().compare(b->getName()) < 0;
+ }
+ };
+ LLTransactionID getTransactionID() const { return mTransactionID; }
+
+ bool getIsBrokenLink() const; // true if the baseitem this points to doesn't exist in memory.
+ LLViewerInventoryItem *getLinkedItem() const;
+ LLViewerInventoryCategory *getLinkedCategory() const;
+
+ // Checks the items permissions (for owner, group, or everyone) and returns true if all mask bits are set.
+ bool checkPermissionsSet(PermissionMask mask) const;
+ PermissionMask getPermissionMask() const;
+
+ // callback
+ void onCallingCardNameLookup(const LLUUID& id, const LLAvatarName& name);
+
+ // If this is a broken link, try to fix it and any other identical link.
+ BOOL regenerateLink();
public:
- bool mIsComplete;
- LLTransactionID mTransactionID;
+ bool mIsComplete;
+ LLTransactionID mTransactionID;
};
@@ -180,34 +180,34 @@ public:
class LLViewerInventoryCategory : public LLInventoryCategory
{
public:
- typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t;
-
+ typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t;
+
protected:
- ~LLViewerInventoryCategory();
-
+ ~LLViewerInventoryCategory();
+
public:
- LLViewerInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid,
- LLFolderType::EType preferred_type,
- const std::string& name,
- const LLUUID& owner_id);
- LLViewerInventoryCategory(const LLUUID& owner_id);
- // Create a copy of an inventory category from a pointer to another category
- // Note: Because InventoryCategorys are ref counted, reference copy (a = b)
- // is prohibited
- LLViewerInventoryCategory(const LLViewerInventoryCategory* other);
- void copyViewerCategory(const LLViewerInventoryCategory* other);
+ LLViewerInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid,
+ LLFolderType::EType preferred_type,
+ const std::string& name,
+ const LLUUID& owner_id);
+ LLViewerInventoryCategory(const LLUUID& owner_id);
+ // Create a copy of an inventory category from a pointer to another category
+ // Note: Because InventoryCategorys are ref counted, reference copy (a = b)
+ // is prohibited
+ LLViewerInventoryCategory(const LLViewerInventoryCategory* other);
+ void copyViewerCategory(const LLViewerInventoryCategory* other);
- virtual void updateParentOnServer(BOOL restamp_children) const;
- virtual void updateServer(BOOL is_new) const;
+ virtual void updateParentOnServer(BOOL restamp_children) const;
+ virtual void updateServer(BOOL is_new) const;
- virtual void packMessage(LLMessageSystem* msg) const;
+ virtual void packMessage(LLMessageSystem* msg) const;
- const LLUUID& getOwnerID() const { return mOwnerID; }
+ const LLUUID& getOwnerID() const { return mOwnerID; }
- // Version handling
- enum { VERSION_UNKNOWN = -1, VERSION_INITIAL = 1 };
- S32 getVersion() const;
- void setVersion(S32 version);
+ // Version handling
+ enum { VERSION_UNKNOWN = -1, VERSION_INITIAL = 1 };
+ S32 getVersion() const;
+ void setVersion(S32 version);
// Returns true if a fetch was issued (not nessesary in progress).
// no requests will happen during expiry_seconds even if fetch completed
@@ -223,43 +223,43 @@ public:
// marks as fetch being in progress or as done
void setFetching(EFetchType);
- // used to help make caching more robust - for example, if
- // someone is getting 4 packets but logs out after 3. the viewer
- // may never know the cache is wrong.
- enum { DESCENDENT_COUNT_UNKNOWN = -1 };
- S32 getDescendentCount() const { return mDescendentCount; }
- void setDescendentCount(S32 descendents) { mDescendentCount = descendents; }
- // How many descendents do we currently have information for in the InventoryModel?
- S32 getViewerDescendentCount() const;
-
- LLSD exportLLSD() const;
- bool importLLSD(const LLSD& cat_data);
-
- void determineFolderType();
- void changeType(LLFolderType::EType new_folder_type);
- virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
- virtual BOOL unpackMessage(const LLSD& category);
-
+ // used to help make caching more robust - for example, if
+ // someone is getting 4 packets but logs out after 3. the viewer
+ // may never know the cache is wrong.
+ enum { DESCENDENT_COUNT_UNKNOWN = -1 };
+ S32 getDescendentCount() const { return mDescendentCount; }
+ void setDescendentCount(S32 descendents) { mDescendentCount = descendents; }
+ // How many descendents do we currently have information for in the InventoryModel?
+ S32 getViewerDescendentCount() const;
+
+ LLSD exportLLSD() const;
+ bool importLLSD(const LLSD& cat_data);
+
+ void determineFolderType();
+ void changeType(LLFolderType::EType new_folder_type);
+ virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
+ virtual BOOL unpackMessage(const LLSD& category);
+
// returns true if the category object will accept the incoming item
bool acceptItem(LLInventoryItem* inv_item);
private:
- friend class LLInventoryModel;
- void localizeName(); // intended to be called from the LLInventoryModel
+ friend class LLInventoryModel;
+ void localizeName(); // intended to be called from the LLInventoryModel
protected:
- LLUUID mOwnerID;
- S32 mVersion;
- S32 mDescendentCount;
+ LLUUID mOwnerID;
+ S32 mVersion;
+ S32 mDescendentCount;
EFetchType mFetching;
- LLFrameTimer mDescendentsRequested;
+ LLFrameTimer mDescendentsRequested;
};
class LLInventoryCallback : public LLRefCount
{
public:
virtual ~LLInventoryCallback() {}
- virtual void fire(const LLUUID& inv_item) = 0;
+ virtual void fire(const LLUUID& inv_item) = 0;
};
class LLViewerJointAttachment;
@@ -275,13 +275,13 @@ void create_notecard_cb(const LLUUID& inv_item);
class AddFavoriteLandmarkCallback : public LLInventoryCallback
{
public:
- AddFavoriteLandmarkCallback() : mTargetLandmarkId(LLUUID::null) {}
- void setTargetLandmarkId(const LLUUID& target_uuid) { mTargetLandmarkId = target_uuid; }
-
+ AddFavoriteLandmarkCallback() : mTargetLandmarkId(LLUUID::null) {}
+ void setTargetLandmarkId(const LLUUID& target_uuid) { mTargetLandmarkId = target_uuid; }
+
private:
- void fire(const LLUUID& inv_item);
+ void fire(const LLUUID& inv_item);
- LLUUID mTargetLandmarkId;
+ LLUUID mTargetLandmarkId;
};
typedef boost::function<void(const LLUUID&)> inventory_func_type;
@@ -297,12 +297,12 @@ class LLBoostFuncInventoryCallback: public LLInventoryCallback
{
public:
- LLBoostFuncInventoryCallback(inventory_func_type fire_func,
- nullary_func_type destroy_func = no_op):
- mDestroyFunc(destroy_func)
- {
+ LLBoostFuncInventoryCallback(inventory_func_type fire_func,
+ nullary_func_type destroy_func = no_op):
+ mDestroyFunc(destroy_func)
+ {
mFireFuncs.push_back(fire_func);
- }
+ }
LLBoostFuncInventoryCallback()
{
@@ -313,25 +313,25 @@ public:
mFireFuncs.push_back(fire_func);
}
- // virtual
- void fire(const LLUUID& item_id)
+ // virtual
+ void fire(const LLUUID& item_id)
{
for (inventory_func_type &func: mFireFuncs)
{
func(item_id);
}
- }
+ }
- // virtual
- ~LLBoostFuncInventoryCallback()
+ // virtual
+ ~LLBoostFuncInventoryCallback()
{
- mDestroyFunc();
- }
-
+ mDestroyFunc();
+ }
+
private:
- std::list<inventory_func_type> mFireFuncs;
- nullary_func_type mDestroyFunc;
+ std::list<inventory_func_type> mFireFuncs;
+ nullary_func_type mDestroyFunc;
};
// misc functions
@@ -339,22 +339,22 @@ private:
class LLInventoryCallbackManager : public LLDestroyClass<LLInventoryCallbackManager>
{
- friend class LLDestroyClass<LLInventoryCallbackManager>;
+ friend class LLDestroyClass<LLInventoryCallbackManager>;
public:
- LLInventoryCallbackManager();
- ~LLInventoryCallbackManager();
+ LLInventoryCallbackManager();
+ ~LLInventoryCallbackManager();
- void fire(U32 callback_id, const LLUUID& item_id);
- U32 registerCB(LLPointer<LLInventoryCallback> cb);
+ void fire(U32 callback_id, const LLUUID& item_id);
+ U32 registerCB(LLPointer<LLInventoryCallback> cb);
private:
- typedef std::map<U32, LLPointer<LLInventoryCallback> > callback_map_t;
- callback_map_t mMap;
- U32 mLastCallback;
- static LLInventoryCallbackManager *sInstance;
- static void destroyClass();
+ typedef std::map<U32, LLPointer<LLInventoryCallback> > callback_map_t;
+ callback_map_t mMap;
+ U32 mLastCallback;
+ static LLInventoryCallbackManager *sInstance;
+ static void destroyClass();
public:
- static bool is_instantiated() { return sInstance != NULL; }
+ static bool is_instantiated() { return sInstance != NULL; }
};
extern LLInventoryCallbackManager gInventoryCallbacks;
@@ -363,12 +363,12 @@ const U8 NO_INV_SUBTYPE{ 0 };
// *TODO: Find a home for these
void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
- const LLUUID& parent, const LLTransactionID& transaction_id,
- const std::string& name,
- const std::string& desc, LLAssetType::EType asset_type,
- LLInventoryType::EType inv_type, U8 subtype,
- U32 next_owner_perm,
- LLPointer<LLInventoryCallback> cb);
+ const LLUUID& parent, const LLTransactionID& transaction_id,
+ const std::string& name,
+ const std::string& desc, LLAssetType::EType asset_type,
+ LLInventoryType::EType inv_type, U8 subtype,
+ U32 next_owner_perm,
+ LLPointer<LLInventoryCallback> cb);
void create_inventory_wearable(const LLUUID& agent_id, const LLUUID& session_id,
const LLUUID& parent, const LLTransactionID& transaction_id,
@@ -380,8 +380,8 @@ void create_inventory_wearable(const LLUUID& agent_id, const LLUUID& session_id,
void create_inventory_settings(const LLUUID& agent_id, const LLUUID& session_id,
const LLUUID& parent, const LLTransactionID& transaction_id,
- const std::string& name, const std::string& desc,
- LLSettingsType::type_e settype,
+ const std::string& name, const std::string& desc,
+ LLSettingsType::type_e settype,
U32 next_owner_perm, LLPointer<LLInventoryCallback> cb);
@@ -391,40 +391,40 @@ void create_inventory_callingcard(const LLUUID& avatar_id, const LLUUID& parent
* @brief Securely create a new inventory item by copying from another.
*/
void copy_inventory_item(
- const LLUUID& agent_id,
- const LLUUID& current_owner,
- const LLUUID& item_id,
- const LLUUID& parent_id,
- const std::string& new_name,
- LLPointer<LLInventoryCallback> cb);
+ const LLUUID& agent_id,
+ const LLUUID& current_owner,
+ const LLUUID& item_id,
+ const LLUUID& parent_id,
+ const std::string& new_name,
+ LLPointer<LLInventoryCallback> cb);
// utility functions for inventory linking.
void link_inventory_object(const LLUUID& category,
- LLConstPointer<LLInventoryObject> baseobj,
- LLPointer<LLInventoryCallback> cb);
+ LLConstPointer<LLInventoryObject> baseobj,
+ LLPointer<LLInventoryCallback> cb);
void link_inventory_object(const LLUUID& category,
- const LLUUID& id,
- LLPointer<LLInventoryCallback> cb);
+ const LLUUID& id,
+ LLPointer<LLInventoryCallback> cb);
void link_inventory_array(const LLUUID& category,
- LLInventoryObject::const_object_list_t& baseobj_array,
- LLPointer<LLInventoryCallback> cb);
+ LLInventoryObject::const_object_list_t& baseobj_array,
+ LLPointer<LLInventoryCallback> cb);
void move_inventory_item(
- const LLUUID& agent_id,
- const LLUUID& session_id,
- const LLUUID& item_id,
- const LLUUID& parent_id,
- const std::string& new_name,
- LLPointer<LLInventoryCallback> cb);
+ const LLUUID& agent_id,
+ const LLUUID& session_id,
+ const LLUUID& item_id,
+ const LLUUID& parent_id,
+ const std::string& new_name,
+ LLPointer<LLInventoryCallback> cb);
void update_inventory_item(
- LLViewerInventoryItem *update_item,
- LLPointer<LLInventoryCallback> cb);
+ LLViewerInventoryItem *update_item,
+ LLPointer<LLInventoryCallback> cb);
void update_inventory_item(
- const LLUUID& item_id,
- const LLSD& updates,
- LLPointer<LLInventoryCallback> cb);
+ const LLUUID& item_id,
+ const LLSD& updates,
+ LLPointer<LLInventoryCallback> cb);
void update_inventory_category(
const LLUUID& cat_id,
@@ -432,51 +432,51 @@ void update_inventory_category(
LLPointer<LLInventoryCallback> cb);
void remove_inventory_items(
- LLInventoryObject::object_list_t& items,
- LLPointer<LLInventoryCallback> cb);
+ LLInventoryObject::object_list_t& items,
+ LLPointer<LLInventoryCallback> cb);
void remove_inventory_item(
- LLPointer<LLInventoryObject> obj,
- LLPointer<LLInventoryCallback> cb,
- bool immediate_delete = false);
+ LLPointer<LLInventoryObject> obj,
+ LLPointer<LLInventoryCallback> cb,
+ bool immediate_delete = false);
void remove_inventory_item(
- const LLUUID& item_id,
- LLPointer<LLInventoryCallback> cb,
- bool immediate_delete = false);
-
+ const LLUUID& item_id,
+ LLPointer<LLInventoryCallback> cb,
+ bool immediate_delete = false);
+
void remove_inventory_category(
- const LLUUID& cat_id,
- LLPointer<LLInventoryCallback> cb);
-
+ const LLUUID& cat_id,
+ LLPointer<LLInventoryCallback> cb);
+
void remove_inventory_object(
- const LLUUID& object_id,
- LLPointer<LLInventoryCallback> cb);
+ const LLUUID& object_id,
+ LLPointer<LLInventoryCallback> cb);
void purge_descendents_of(
- const LLUUID& cat_id,
- LLPointer<LLInventoryCallback> cb);
+ const LLUUID& cat_id,
+ LLPointer<LLInventoryCallback> cb);
const LLUUID get_folder_by_itemtype(const LLInventoryItem *src);
void copy_inventory_from_notecard(const LLUUID& destination_id,
- const LLUUID& object_id,
- const LLUUID& notecard_inv_id,
- const LLInventoryItem *src,
- U32 callback_id = 0);
+ const LLUUID& object_id,
+ const LLUUID& notecard_inv_id,
+ const LLInventoryItem *src,
+ U32 callback_id = 0);
void menu_create_inventory_item(LLInventoryPanel* root,
- LLFolderBridge* bridge,
- const LLSD& userdata,
- const LLUUID& default_parent_uuid = LLUUID::null);
+ LLFolderBridge* bridge,
+ const LLSD& userdata,
+ const LLUUID& default_parent_uuid = LLUUID::null);
void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const LLSD& userdata, const LLUUID& default_parent_uuid = LLUUID::null, std::function<void(const LLUUID&)> folder_created_cb = NULL);
void slam_inventory_folder(const LLUUID& folder_id,
- const LLSD& contents,
- LLPointer<LLInventoryCallback> cb);
+ const LLSD& contents,
+ LLPointer<LLInventoryCallback> cb);
void remove_folder_contents(const LLUUID& folder_id, bool keep_outfit_links,
- LLPointer<LLInventoryCallback> cb);
+ LLPointer<LLInventoryCallback> cb);
#endif // LL_LLVIEWERINVENTORY_H
diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp
index 9653e80b53..75dcb8af52 100644
--- a/indra/newview/llviewerjoint.cpp
+++ b/indra/newview/llviewerjoint.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerjoint.cpp
* @brief Implementation of LLViewerJoint class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,15 +45,15 @@ static const S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64;
// Class Constructors
//-----------------------------------------------------------------------------
LLViewerJoint::LLViewerJoint() :
- LLAvatarJoint()
+ LLAvatarJoint()
{ }
LLViewerJoint::LLViewerJoint(S32 joint_num) :
- LLAvatarJoint(joint_num)
+ LLAvatarJoint(joint_num)
{ }
LLViewerJoint::LLViewerJoint(const std::string &name, LLJoint *parent) :
- LLAvatarJoint(name, parent)
+ LLAvatarJoint(name, parent)
{ }
//-----------------------------------------------------------------------------
@@ -69,96 +69,96 @@ LLViewerJoint::~LLViewerJoint()
//--------------------------------------------------------------------
U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
{
- stop_glerror();
-
- U32 triangle_count = 0;
-
- //----------------------------------------------------------------
- // ignore invisible objects
- //----------------------------------------------------------------
- if ( mValid )
- {
-
-
- //----------------------------------------------------------------
- // if object is transparent, defer it, otherwise
- // give the joint subclass a chance to draw itself
- //----------------------------------------------------------------
- if ( is_dummy )
- {
- triangle_count += drawShape( pixelArea, first_pass, is_dummy );
- }
- else if (LLPipeline::sShadowRender)
- {
- triangle_count += drawShape(pixelArea, first_pass, is_dummy );
- }
- else if ( isTransparent() && !LLPipeline::sReflectionRender)
- {
- // Hair and Skirt
- if ((pixelArea > MIN_PIXEL_AREA_3PASS_HAIR))
- {
- // render all three passes
- LLGLDisable cull(GL_CULL_FACE);
- // first pass renders without writing to the z buffer
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- triangle_count += drawShape( pixelArea, first_pass, is_dummy );
- }
- // second pass writes to z buffer only
- gGL.setColorMask(false, false);
- {
- triangle_count += drawShape( pixelArea, FALSE, is_dummy );
- }
- // third past respects z buffer and writes color
- gGL.setColorMask(true, false);
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- triangle_count += drawShape( pixelArea, FALSE, is_dummy );
- }
- }
- else
- {
- // Render Inside (no Z buffer write)
- glCullFace(GL_FRONT);
- {
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- triangle_count += drawShape( pixelArea, first_pass, is_dummy );
- }
- // Render Outside (write to the Z buffer)
- glCullFace(GL_BACK);
- {
- triangle_count += drawShape( pixelArea, FALSE, is_dummy );
- }
- }
- }
- else
- {
- // set up render state
- triangle_count += drawShape( pixelArea, first_pass );
- }
- }
-
- //----------------------------------------------------------------
- // render children
- //----------------------------------------------------------------
- for (LLJoint* j : mChildren)
- {
- // LLViewerJoint is derived from LLAvatarJoint,
- // all children of LLAvatarJoint are assumed to be LLAvatarJoint
- LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(j);
- F32 jointLOD = joint->getLOD();
- if (pixelArea >= jointLOD || sDisableLOD)
- {
- triangle_count += joint->render( pixelArea, TRUE, is_dummy );
-
- if (jointLOD != DEFAULT_AVATAR_JOINT_LOD)
- {
- break;
- }
- }
- }
-
- return triangle_count;
+ stop_glerror();
+
+ U32 triangle_count = 0;
+
+ //----------------------------------------------------------------
+ // ignore invisible objects
+ //----------------------------------------------------------------
+ if ( mValid )
+ {
+
+
+ //----------------------------------------------------------------
+ // if object is transparent, defer it, otherwise
+ // give the joint subclass a chance to draw itself
+ //----------------------------------------------------------------
+ if ( is_dummy )
+ {
+ triangle_count += drawShape( pixelArea, first_pass, is_dummy );
+ }
+ else if (LLPipeline::sShadowRender)
+ {
+ triangle_count += drawShape(pixelArea, first_pass, is_dummy );
+ }
+ else if ( isTransparent() && !LLPipeline::sReflectionRender)
+ {
+ // Hair and Skirt
+ if ((pixelArea > MIN_PIXEL_AREA_3PASS_HAIR))
+ {
+ // render all three passes
+ LLGLDisable cull(GL_CULL_FACE);
+ // first pass renders without writing to the z buffer
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ triangle_count += drawShape( pixelArea, first_pass, is_dummy );
+ }
+ // second pass writes to z buffer only
+ gGL.setColorMask(false, false);
+ {
+ triangle_count += drawShape( pixelArea, FALSE, is_dummy );
+ }
+ // third past respects z buffer and writes color
+ gGL.setColorMask(true, false);
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ triangle_count += drawShape( pixelArea, FALSE, is_dummy );
+ }
+ }
+ else
+ {
+ // Render Inside (no Z buffer write)
+ glCullFace(GL_FRONT);
+ {
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ triangle_count += drawShape( pixelArea, first_pass, is_dummy );
+ }
+ // Render Outside (write to the Z buffer)
+ glCullFace(GL_BACK);
+ {
+ triangle_count += drawShape( pixelArea, FALSE, is_dummy );
+ }
+ }
+ }
+ else
+ {
+ // set up render state
+ triangle_count += drawShape( pixelArea, first_pass );
+ }
+ }
+
+ //----------------------------------------------------------------
+ // render children
+ //----------------------------------------------------------------
+ for (LLJoint* j : mChildren)
+ {
+ // LLViewerJoint is derived from LLAvatarJoint,
+ // all children of LLAvatarJoint are assumed to be LLAvatarJoint
+ LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(j);
+ F32 jointLOD = joint->getLOD();
+ if (pixelArea >= jointLOD || sDisableLOD)
+ {
+ triangle_count += joint->render( pixelArea, TRUE, is_dummy );
+
+ if (jointLOD != DEFAULT_AVATAR_JOINT_LOD)
+ {
+ break;
+ }
+ }
+ }
+
+ return triangle_count;
}
//--------------------------------------------------------------------
@@ -166,7 +166,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
//--------------------------------------------------------------------
U32 LLViewerJoint::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
{
- return 0;
+ return 0;
}
// End
diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h
index abe11bbf5c..67d83908bd 100644
--- a/indra/newview/llviewerjoint.h
+++ b/indra/newview/llviewerjoint.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerjoint.h
* @brief Implementation of LLViewerJoint class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,26 +40,26 @@ class LLViewerJointMesh;
// class LLViewerJoint
//-----------------------------------------------------------------------------
class LLViewerJoint :
- public virtual LLAvatarJoint
+ public virtual LLAvatarJoint
{
public:
- LLViewerJoint();
+ LLViewerJoint();
LLViewerJoint(S32 joint_num);
- // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
- LLViewerJoint(const std::string &name, LLJoint *parent = NULL);
- virtual ~LLViewerJoint();
+ // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
+ LLViewerJoint(const std::string &name, LLJoint *parent = NULL);
+ virtual ~LLViewerJoint();
- // Render character hierarchy.
- // Traverses the entire joint hierarchy, setting up
- // transforms and calling the drawShape().
- // Derived classes may add text/graphic output.
- virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ); // Returns triangle count
+ // Render character hierarchy.
+ // Traverses the entire joint hierarchy, setting up
+ // transforms and calling the drawShape().
+ // Derived classes may add text/graphic output.
+ virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ); // Returns triangle count
- // Draws the shape attached to a joint.
- // Called by render().
- virtual U32 drawShape( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
- virtual void drawNormals() {}
+ // Draws the shape attached to a joint.
+ // Called by render().
+ virtual U32 drawShape( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
+ virtual void drawNormals() {}
};
#endif // LL_LLVIEWERJOINT_H
diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp
index b3bfb86b99..d7fe28d77c 100644
--- a/indra/newview/llviewerjointattachment.cpp
+++ b/indra/newview/llviewerjointattachment.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerjointattachment.cpp
* @brief Implementation of LLViewerJointAttachment class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -51,14 +51,14 @@ const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters
// LLViewerJointAttachment()
//-----------------------------------------------------------------------------
LLViewerJointAttachment::LLViewerJointAttachment() :
- mVisibleInFirst(FALSE),
- mGroup(0),
- mIsHUDAttachment(FALSE),
- mPieSlice(-1)
+ mVisibleInFirst(FALSE),
+ mGroup(0),
+ mIsHUDAttachment(FALSE),
+ mPieSlice(-1)
{
- mValid = FALSE;
- mUpdateXform = FALSE;
- mAttachedObjects.clear();
+ mValid = FALSE;
+ mUpdateXform = FALSE;
+ mAttachedObjects.clear();
}
//-----------------------------------------------------------------------------
@@ -73,7 +73,7 @@ LLViewerJointAttachment::~LLViewerJointAttachment()
//-----------------------------------------------------------------------------
BOOL LLViewerJointAttachment::isTransparent()
{
- return FALSE;
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -81,82 +81,82 @@ BOOL LLViewerJointAttachment::isTransparent()
//-----------------------------------------------------------------------------
U32 LLViewerJointAttachment::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
{
- if (LLVOAvatar::sShowAttachmentPoints)
- {
- LLGLDisable cull_face(GL_CULL_FACE);
-
- gGL.color4f(1.f, 1.f, 1.f, 1.f);
- gGL.begin(LLRender::QUADS);
- {
- gGL.vertex3f(-0.1f, 0.1f, 0.f);
- gGL.vertex3f(-0.1f, -0.1f, 0.f);
- gGL.vertex3f(0.1f, -0.1f, 0.f);
- gGL.vertex3f(0.1f, 0.1f, 0.f);
- }gGL.end();
- }
- return 0;
+ if (LLVOAvatar::sShowAttachmentPoints)
+ {
+ LLGLDisable cull_face(GL_CULL_FACE);
+
+ gGL.color4f(1.f, 1.f, 1.f, 1.f);
+ gGL.begin(LLRender::QUADS);
+ {
+ gGL.vertex3f(-0.1f, 0.1f, 0.f);
+ gGL.vertex3f(-0.1f, -0.1f, 0.f);
+ gGL.vertex3f(0.1f, -0.1f, 0.f);
+ gGL.vertex3f(0.1f, 0.1f, 0.f);
+ }gGL.end();
+ }
+ return 0;
}
void LLViewerJointAttachment::setupDrawable(LLViewerObject *object)
{
- if (!object->mDrawable)
- return;
- if (object->mDrawable->isActive())
- {
- object->mDrawable->makeStatic(FALSE);
- }
-
- object->mDrawable->mXform.setParent(getXform()); // LLViewerJointAttachment::lazyAttach
- object->mDrawable->makeActive();
- LLVector3 current_pos = object->getRenderPosition();
- LLQuaternion current_rot = object->getRenderRotation();
- LLQuaternion attachment_pt_inv_rot = ~(getWorldRotation());
-
- current_pos -= getWorldPosition();
- current_pos.rotVec(attachment_pt_inv_rot);
-
- current_rot = current_rot * attachment_pt_inv_rot;
-
- object->mDrawable->mXform.setPosition(current_pos);
- object->mDrawable->mXform.setRotation(current_rot);
- gPipeline.markMoved(object->mDrawable);
- gPipeline.markTextured(object->mDrawable); // face may need to change draw pool to/from POOL_HUD
-
- if(mIsHUDAttachment)
- {
- for (S32 face_num = 0; face_num < object->mDrawable->getNumFaces(); face_num++)
- {
- LLFace *face = object->mDrawable->getFace(face_num);
- if (face)
- {
- face->setState(LLFace::HUD_RENDER);
- }
- }
- }
-
- LLViewerObject::const_child_list_t& child_list = object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* childp = *iter;
- if (childp && childp->mDrawable.notNull())
- {
- gPipeline.markTextured(childp->mDrawable); // face may need to change draw pool to/from POOL_HUD
- gPipeline.markMoved(childp->mDrawable);
-
- if(mIsHUDAttachment)
- {
- for (S32 face_num = 0; face_num < childp->mDrawable->getNumFaces(); face_num++)
- {
- LLFace * face = childp->mDrawable->getFace(face_num);
- if (face)
- {
- face->setState(LLFace::HUD_RENDER);
- }
- }
- }
- }
- }
+ if (!object->mDrawable)
+ return;
+ if (object->mDrawable->isActive())
+ {
+ object->mDrawable->makeStatic(FALSE);
+ }
+
+ object->mDrawable->mXform.setParent(getXform()); // LLViewerJointAttachment::lazyAttach
+ object->mDrawable->makeActive();
+ LLVector3 current_pos = object->getRenderPosition();
+ LLQuaternion current_rot = object->getRenderRotation();
+ LLQuaternion attachment_pt_inv_rot = ~(getWorldRotation());
+
+ current_pos -= getWorldPosition();
+ current_pos.rotVec(attachment_pt_inv_rot);
+
+ current_rot = current_rot * attachment_pt_inv_rot;
+
+ object->mDrawable->mXform.setPosition(current_pos);
+ object->mDrawable->mXform.setRotation(current_rot);
+ gPipeline.markMoved(object->mDrawable);
+ gPipeline.markTextured(object->mDrawable); // face may need to change draw pool to/from POOL_HUD
+
+ if(mIsHUDAttachment)
+ {
+ for (S32 face_num = 0; face_num < object->mDrawable->getNumFaces(); face_num++)
+ {
+ LLFace *face = object->mDrawable->getFace(face_num);
+ if (face)
+ {
+ face->setState(LLFace::HUD_RENDER);
+ }
+ }
+ }
+
+ LLViewerObject::const_child_list_t& child_list = object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* childp = *iter;
+ if (childp && childp->mDrawable.notNull())
+ {
+ gPipeline.markTextured(childp->mDrawable); // face may need to change draw pool to/from POOL_HUD
+ gPipeline.markMoved(childp->mDrawable);
+
+ if(mIsHUDAttachment)
+ {
+ for (S32 face_num = 0; face_num < childp->mDrawable->getNumFaces(); face_num++)
+ {
+ LLFace * face = childp->mDrawable->getFace(face_num);
+ if (face)
+ {
+ face->setState(LLFace::HUD_RENDER);
+ }
+ }
+ }
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -164,53 +164,53 @@ void LLViewerJointAttachment::setupDrawable(LLViewerObject *object)
//-----------------------------------------------------------------------------
BOOL LLViewerJointAttachment::addObject(LLViewerObject* object)
{
- object->extractAttachmentItemID();
-
- // Same object reattached
- if (isObjectAttached(object))
- {
- LL_INFOS() << "(same object re-attached)" << LL_ENDL;
- removeObject(object);
- // Pass through anyway to let setupDrawable()
- // re-connect object to the joint correctly
- }
-
- // Two instances of the same inventory item attached --
- // Request detach, and kill the object in the meantime.
- if (getAttachedObject(object->getAttachmentItemID()))
- {
- LL_INFOS() << "(same object re-attached)" << LL_ENDL;
- object->markDead();
-
- // If this happens to be attached to self, then detach.
- LLVOAvatarSelf::detachAttachmentIntoInventory(object->getAttachmentItemID());
- return FALSE;
- }
-
- mAttachedObjects.push_back(object);
- setupDrawable(object);
-
- if (mIsHUDAttachment)
- {
- if (object->mText.notNull())
- {
- object->mText->setOnHUDAttachment(TRUE);
- }
- LLViewerObject::const_child_list_t& child_list = object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* childp = *iter;
- if (childp && childp->mText.notNull())
- {
- childp->mText->setOnHUDAttachment(TRUE);
- }
- }
- }
- calcLOD();
- mUpdateXform = TRUE;
-
- return TRUE;
+ object->extractAttachmentItemID();
+
+ // Same object reattached
+ if (isObjectAttached(object))
+ {
+ LL_INFOS() << "(same object re-attached)" << LL_ENDL;
+ removeObject(object);
+ // Pass through anyway to let setupDrawable()
+ // re-connect object to the joint correctly
+ }
+
+ // Two instances of the same inventory item attached --
+ // Request detach, and kill the object in the meantime.
+ if (getAttachedObject(object->getAttachmentItemID()))
+ {
+ LL_INFOS() << "(same object re-attached)" << LL_ENDL;
+ object->markDead();
+
+ // If this happens to be attached to self, then detach.
+ LLVOAvatarSelf::detachAttachmentIntoInventory(object->getAttachmentItemID());
+ return FALSE;
+ }
+
+ mAttachedObjects.push_back(object);
+ setupDrawable(object);
+
+ if (mIsHUDAttachment)
+ {
+ if (object->mText.notNull())
+ {
+ object->mText->setOnHUDAttachment(TRUE);
+ }
+ LLViewerObject::const_child_list_t& child_list = object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* childp = *iter;
+ if (childp && childp->mText.notNull())
+ {
+ childp->mText->setOnHUDAttachment(TRUE);
+ }
+ }
+ }
+ calcLOD();
+ mUpdateXform = TRUE;
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -218,100 +218,100 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object)
//-----------------------------------------------------------------------------
void LLViewerJointAttachment::removeObject(LLViewerObject *object)
{
- attachedobjs_vec_t::iterator iter;
- for (iter = mAttachedObjects.begin();
- iter != mAttachedObjects.end();
- ++iter)
- {
- LLViewerObject *attached_object = iter->get();
- if (attached_object == object)
- {
- break;
- }
- }
- if (iter == mAttachedObjects.end())
- {
- LL_WARNS() << "Could not find object to detach" << LL_ENDL;
- return;
- }
-
- // force object visibile
- setAttachmentVisibility(TRUE);
-
- mAttachedObjects.erase(iter);
- if (object->mDrawable.notNull())
- {
- //if object is active, make it static
- if(object->mDrawable->isActive())
- {
- object->mDrawable->makeStatic(FALSE);
- }
-
- LLVector3 cur_position = object->getRenderPosition();
- LLQuaternion cur_rotation = object->getRenderRotation();
-
- object->mDrawable->mXform.setPosition(cur_position);
- object->mDrawable->mXform.setRotation(cur_rotation);
- gPipeline.markMoved(object->mDrawable, TRUE);
- gPipeline.markTextured(object->mDrawable); // face may need to change draw pool to/from POOL_HUD
-
- if (mIsHUDAttachment)
- {
- for (S32 face_num = 0; face_num < object->mDrawable->getNumFaces(); face_num++)
- {
- LLFace * face = object->mDrawable->getFace(face_num);
- if (face)
- {
- face->clearState(LLFace::HUD_RENDER);
- }
- }
- }
- }
-
- LLViewerObject::const_child_list_t& child_list = object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* childp = *iter;
- if (childp && childp->mDrawable.notNull())
- {
- gPipeline.markTextured(childp->mDrawable); // face may need to change draw pool to/from POOL_HUD
- if (mIsHUDAttachment)
- {
- for (S32 face_num = 0; face_num < childp->mDrawable->getNumFaces(); face_num++)
- {
- LLFace * face = childp->mDrawable->getFace(face_num);
- if (face)
- {
- face->clearState(LLFace::HUD_RENDER);
- }
- }
- }
- }
- }
-
- if (mIsHUDAttachment)
- {
- if (object->mText.notNull())
- {
- object->mText->setOnHUDAttachment(FALSE);
- }
- LLViewerObject::const_child_list_t& child_list = object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* childp = *iter;
- if (childp->mText.notNull())
- {
- childp->mText->setOnHUDAttachment(FALSE);
- }
- }
- }
- if (mAttachedObjects.size() == 0)
- {
- mUpdateXform = FALSE;
- }
- object->setAttachmentItemID(LLUUID::null);
+ attachedobjs_vec_t::iterator iter;
+ for (iter = mAttachedObjects.begin();
+ iter != mAttachedObjects.end();
+ ++iter)
+ {
+ LLViewerObject *attached_object = iter->get();
+ if (attached_object == object)
+ {
+ break;
+ }
+ }
+ if (iter == mAttachedObjects.end())
+ {
+ LL_WARNS() << "Could not find object to detach" << LL_ENDL;
+ return;
+ }
+
+ // force object visibile
+ setAttachmentVisibility(TRUE);
+
+ mAttachedObjects.erase(iter);
+ if (object->mDrawable.notNull())
+ {
+ //if object is active, make it static
+ if(object->mDrawable->isActive())
+ {
+ object->mDrawable->makeStatic(FALSE);
+ }
+
+ LLVector3 cur_position = object->getRenderPosition();
+ LLQuaternion cur_rotation = object->getRenderRotation();
+
+ object->mDrawable->mXform.setPosition(cur_position);
+ object->mDrawable->mXform.setRotation(cur_rotation);
+ gPipeline.markMoved(object->mDrawable, TRUE);
+ gPipeline.markTextured(object->mDrawable); // face may need to change draw pool to/from POOL_HUD
+
+ if (mIsHUDAttachment)
+ {
+ for (S32 face_num = 0; face_num < object->mDrawable->getNumFaces(); face_num++)
+ {
+ LLFace * face = object->mDrawable->getFace(face_num);
+ if (face)
+ {
+ face->clearState(LLFace::HUD_RENDER);
+ }
+ }
+ }
+ }
+
+ LLViewerObject::const_child_list_t& child_list = object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* childp = *iter;
+ if (childp && childp->mDrawable.notNull())
+ {
+ gPipeline.markTextured(childp->mDrawable); // face may need to change draw pool to/from POOL_HUD
+ if (mIsHUDAttachment)
+ {
+ for (S32 face_num = 0; face_num < childp->mDrawable->getNumFaces(); face_num++)
+ {
+ LLFace * face = childp->mDrawable->getFace(face_num);
+ if (face)
+ {
+ face->clearState(LLFace::HUD_RENDER);
+ }
+ }
+ }
+ }
+ }
+
+ if (mIsHUDAttachment)
+ {
+ if (object->mText.notNull())
+ {
+ object->mText->setOnHUDAttachment(FALSE);
+ }
+ LLViewerObject::const_child_list_t& child_list = object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* childp = *iter;
+ if (childp->mText.notNull())
+ {
+ childp->mText->setOnHUDAttachment(FALSE);
+ }
+ }
+ }
+ if (mAttachedObjects.size() == 0)
+ {
+ mUpdateXform = FALSE;
+ }
+ object->setAttachmentItemID(LLUUID::null);
}
//-----------------------------------------------------------------------------
@@ -319,27 +319,27 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object)
//-----------------------------------------------------------------------------
void LLViewerJointAttachment::setAttachmentVisibility(BOOL visible)
{
- for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
- iter != mAttachedObjects.end();
- ++iter)
- {
- LLViewerObject *attached_obj = iter->get();
- if (!attached_obj || attached_obj->mDrawable.isNull() ||
- !(attached_obj->mDrawable->getSpatialBridge()))
- continue;
-
- if (visible)
- {
- // Hack to make attachments not visible by disabling their type mask!
- // This will break if you can ever attach non-volumes! - djs 02/14/03
- attached_obj->mDrawable->getSpatialBridge()->mDrawableType =
- attached_obj->isHUDAttachment() ? LLPipeline::RENDER_TYPE_HUD : LLPipeline::RENDER_TYPE_VOLUME;
- }
- else
- {
- attached_obj->mDrawable->getSpatialBridge()->mDrawableType = 0;
- }
- }
+ for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
+ iter != mAttachedObjects.end();
+ ++iter)
+ {
+ LLViewerObject *attached_obj = iter->get();
+ if (!attached_obj || attached_obj->mDrawable.isNull() ||
+ !(attached_obj->mDrawable->getSpatialBridge()))
+ continue;
+
+ if (visible)
+ {
+ // Hack to make attachments not visible by disabling their type mask!
+ // This will break if you can ever attach non-volumes! - djs 02/14/03
+ attached_obj->mDrawable->getSpatialBridge()->mDrawableType =
+ attached_obj->isHUDAttachment() ? LLPipeline::RENDER_TYPE_HUD : LLPipeline::RENDER_TYPE_VOLUME;
+ }
+ else
+ {
+ attached_obj->mDrawable->getSpatialBridge()->mDrawableType = 0;
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -347,9 +347,9 @@ void LLViewerJointAttachment::setAttachmentVisibility(BOOL visible)
//-----------------------------------------------------------------------------
void LLViewerJointAttachment::setOriginalPosition(LLVector3& position)
{
- mOriginalPos = position;
- // SL-315
- setPosition(position);
+ mOriginalPos = position;
+ // SL-315
+ setPosition(position);
}
//-----------------------------------------------------------------------------
@@ -358,10 +358,10 @@ void LLViewerJointAttachment::setOriginalPosition(LLVector3& position)
S32 LLViewerJointAttachment::getNumAnimatedObjects() const
{
S32 count = 0;
- for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
- iter != mAttachedObjects.end();
- ++iter)
- {
+ for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
+ iter != mAttachedObjects.end();
+ ++iter)
+ {
const LLViewerObject *attached_object = iter->get();
if (attached_object->isAnimatedObject())
{
@@ -376,20 +376,20 @@ S32 LLViewerJointAttachment::getNumAnimatedObjects() const
//-----------------------------------------------------------------------------
void LLViewerJointAttachment::clampObjectPosition()
{
- for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
- iter != mAttachedObjects.end();
- ++iter)
- {
- if (LLViewerObject *attached_object = iter->get())
- {
- // *NOTE: object can drift when hitting maximum radius
- LLVector3 attachmentPos = attached_object->getPosition();
- F32 dist = attachmentPos.normVec();
- dist = llmin(dist, MAX_ATTACHMENT_DIST);
- attachmentPos *= dist;
- attached_object->setPosition(attachmentPos);
- }
- }
+ for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
+ iter != mAttachedObjects.end();
+ ++iter)
+ {
+ if (LLViewerObject *attached_object = iter->get())
+ {
+ // *NOTE: object can drift when hitting maximum radius
+ LLVector3 attachmentPos = attached_object->getPosition();
+ F32 dist = attachmentPos.normVec();
+ dist = llmin(dist, MAX_ATTACHMENT_DIST);
+ attachmentPos *= dist;
+ attached_object->setPosition(attachmentPos);
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -397,28 +397,28 @@ void LLViewerJointAttachment::clampObjectPosition()
//-----------------------------------------------------------------------------
void LLViewerJointAttachment::calcLOD()
{
- F32 maxarea = 0;
- for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
- iter != mAttachedObjects.end();
- ++iter)
- {
- if (LLViewerObject *attached_object = iter->get())
- {
- maxarea = llmax(maxarea,attached_object->getMaxScale() * attached_object->getMidScale());
- LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* childp = *iter;
- F32 area = childp->getMaxScale() * childp->getMidScale();
- maxarea = llmax(maxarea, area);
- }
- }
- }
- maxarea = llclamp(maxarea, .01f*.01f, 1.f);
- F32 avatar_area = (4.f * 4.f); // pixels for an avatar sized attachment
- F32 min_pixel_area = avatar_area / maxarea;
- setLOD(min_pixel_area);
+ F32 maxarea = 0;
+ for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
+ iter != mAttachedObjects.end();
+ ++iter)
+ {
+ if (LLViewerObject *attached_object = iter->get())
+ {
+ maxarea = llmax(maxarea,attached_object->getMaxScale() * attached_object->getMidScale());
+ LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* childp = *iter;
+ F32 area = childp->getMaxScale() * childp->getMidScale();
+ maxarea = llmax(maxarea, area);
+ }
+ }
+ }
+ maxarea = llclamp(maxarea, .01f*.01f, 1.f);
+ F32 avatar_area = (4.f * 4.f); // pixels for an avatar sized attachment
+ F32 min_pixel_area = avatar_area / maxarea;
+ setLOD(min_pixel_area);
}
//-----------------------------------------------------------------------------
@@ -426,56 +426,56 @@ void LLViewerJointAttachment::calcLOD()
//-----------------------------------------------------------------------------
BOOL LLViewerJointAttachment::updateLOD(F32 pixel_area, BOOL activate)
{
- BOOL res = FALSE;
- if (!mValid)
- {
- setValid(TRUE, TRUE);
- res = TRUE;
- }
- return res;
+ BOOL res = FALSE;
+ if (!mValid)
+ {
+ setValid(TRUE, TRUE);
+ res = TRUE;
+ }
+ return res;
}
BOOL LLViewerJointAttachment::isObjectAttached(const LLViewerObject *viewer_object) const
{
- for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
- iter != mAttachedObjects.end();
- ++iter)
- {
- const LLViewerObject* attached_object = iter->get();
- if (attached_object == viewer_object)
- {
- return TRUE;
- }
- }
- return FALSE;
+ for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
+ iter != mAttachedObjects.end();
+ ++iter)
+ {
+ const LLViewerObject* attached_object = iter->get();
+ if (attached_object == viewer_object)
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
const LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &object_id) const
{
- for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
- iter != mAttachedObjects.end();
- ++iter)
- {
- const LLViewerObject* attached_object = iter->get();
- if (attached_object->getAttachmentItemID() == object_id)
- {
- return attached_object;
- }
- }
- return NULL;
+ for (attachedobjs_vec_t::const_iterator iter = mAttachedObjects.begin();
+ iter != mAttachedObjects.end();
+ ++iter)
+ {
+ const LLViewerObject* attached_object = iter->get();
+ if (attached_object->getAttachmentItemID() == object_id)
+ {
+ return attached_object;
+ }
+ }
+ return NULL;
}
LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &object_id)
{
- for (attachedobjs_vec_t::iterator iter = mAttachedObjects.begin();
- iter != mAttachedObjects.end();
- ++iter)
- {
- LLViewerObject* attached_object = iter->get();
- if (attached_object->getAttachmentItemID() == object_id)
- {
- return attached_object;
- }
- }
- return NULL;
+ for (attachedobjs_vec_t::iterator iter = mAttachedObjects.begin();
+ iter != mAttachedObjects.end();
+ ++iter)
+ {
+ LLViewerObject* attached_object = iter->get();
+ if (attached_object->getAttachmentItemID() == object_id)
+ {
+ return attached_object;
+ }
+ }
+ return NULL;
}
diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h
index e5edf2c06b..3ce790d38d 100644
--- a/indra/newview/llviewerjointattachment.h
+++ b/indra/newview/llviewerjointattachment.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerjointattachment.h
* @brief Implementation of LLViewerJointAttachment class
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,73 +41,73 @@ class LLViewerObject;
// class LLViewerJointAttachment
//-----------------------------------------------------------------------------
class LLViewerJointAttachment :
- public LLViewerJoint
+ public LLViewerJoint
{
public:
- LLViewerJointAttachment();
- virtual ~LLViewerJointAttachment();
-
- //virtual U32 render( F32 pixelArea ); // Returns triangle count
-
- // Returns true if this object is transparent.
- // This is used to determine in which order to draw objects.
- /*virtual*/ BOOL isTransparent();
-
- // Draws the shape attached to a joint.
- // Called by render().
- /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy );
-
- /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate);
-
- //
- // accessors
- //
-
- void setPieSlice(S32 pie_slice) { mPieSlice = pie_slice; }
- void setVisibleInFirstPerson(BOOL visibility) { mVisibleInFirst = visibility; }
- BOOL getVisibleInFirstPerson() const { return mVisibleInFirst; }
- void setGroup(S32 group) { mGroup = group; }
- void setOriginalPosition(LLVector3 &position);
- void setAttachmentVisibility(BOOL visible);
- void setIsHUDAttachment(BOOL is_hud) { mIsHUDAttachment = is_hud; }
- BOOL getIsHUDAttachment() const { return mIsHUDAttachment; }
-
- BOOL isAnimatable() const { return FALSE; }
-
- S32 getGroup() const { return mGroup; }
- S32 getPieSlice() const { return mPieSlice; }
- S32 getNumObjects() const { return mAttachedObjects.size(); }
- S32 getNumAnimatedObjects() const;
-
- void clampObjectPosition();
-
- //
- // unique methods
- //
- BOOL addObject(LLViewerObject* object);
- void removeObject(LLViewerObject *object);
-
- //
- // attachments operations
- //
- BOOL isObjectAttached(const LLViewerObject *viewer_object) const;
- const LLViewerObject *getAttachedObject(const LLUUID &object_id) const;
- LLViewerObject *getAttachedObject(const LLUUID &object_id);
-
- // list of attachments for this joint
- typedef std::vector<LLPointer<LLViewerObject> > attachedobjs_vec_t;
- attachedobjs_vec_t mAttachedObjects;
+ LLViewerJointAttachment();
+ virtual ~LLViewerJointAttachment();
+
+ //virtual U32 render( F32 pixelArea ); // Returns triangle count
+
+ // Returns true if this object is transparent.
+ // This is used to determine in which order to draw objects.
+ /*virtual*/ BOOL isTransparent();
+
+ // Draws the shape attached to a joint.
+ // Called by render().
+ /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy );
+
+ /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate);
+
+ //
+ // accessors
+ //
+
+ void setPieSlice(S32 pie_slice) { mPieSlice = pie_slice; }
+ void setVisibleInFirstPerson(BOOL visibility) { mVisibleInFirst = visibility; }
+ BOOL getVisibleInFirstPerson() const { return mVisibleInFirst; }
+ void setGroup(S32 group) { mGroup = group; }
+ void setOriginalPosition(LLVector3 &position);
+ void setAttachmentVisibility(BOOL visible);
+ void setIsHUDAttachment(BOOL is_hud) { mIsHUDAttachment = is_hud; }
+ BOOL getIsHUDAttachment() const { return mIsHUDAttachment; }
+
+ BOOL isAnimatable() const { return FALSE; }
+
+ S32 getGroup() const { return mGroup; }
+ S32 getPieSlice() const { return mPieSlice; }
+ S32 getNumObjects() const { return mAttachedObjects.size(); }
+ S32 getNumAnimatedObjects() const;
+
+ void clampObjectPosition();
+
+ //
+ // unique methods
+ //
+ BOOL addObject(LLViewerObject* object);
+ void removeObject(LLViewerObject *object);
+
+ //
+ // attachments operations
+ //
+ BOOL isObjectAttached(const LLViewerObject *viewer_object) const;
+ const LLViewerObject *getAttachedObject(const LLUUID &object_id) const;
+ LLViewerObject *getAttachedObject(const LLUUID &object_id);
+
+ // list of attachments for this joint
+ typedef std::vector<LLPointer<LLViewerObject> > attachedobjs_vec_t;
+ attachedobjs_vec_t mAttachedObjects;
protected:
- void calcLOD();
- void setupDrawable(LLViewerObject *object);
+ void calcLOD();
+ void setupDrawable(LLViewerObject *object);
private:
- BOOL mVisibleInFirst;
- LLVector3 mOriginalPos;
- S32 mGroup;
- BOOL mIsHUDAttachment;
- S32 mPieSlice;
+ BOOL mVisibleInFirst;
+ LLVector3 mOriginalPos;
+ S32 mGroup;
+ BOOL mIsHUDAttachment;
+ S32 mPieSlice;
};
#endif // LL_LLVIEWERJOINTATTACHMENT_H
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index 5d46c695b7..fa3bfe6e2a 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -1,25 +1,25 @@
- /**
+ /**
* @file llviewerjointmesh.cpp
* @brief Implementation of LLViewerJointMesh class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,7 +54,7 @@
#include "m3math.h"
#include "m4math.h"
#include "llmatrix4a.h"
-#include "llperfstats.h"
+#include "llperfstats.h"
#if !LL_DARWIN && !LL_LINUX
extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB;
@@ -73,8 +73,8 @@ extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB;
// LLViewerJointMesh()
//-----------------------------------------------------------------------------
LLViewerJointMesh::LLViewerJointMesh()
- :
- LLAvatarJointMesh()
+ :
+ LLAvatarJointMesh()
{
}
@@ -95,104 +95,104 @@ const S32 NUM_AXES = 3;
// rotation Z 0-n
// pivot parent 0-n -- child = n+1
-static LLMatrix4 gJointMatUnaligned[32];
-static LLMatrix4a gJointMatAligned[32];
-static LLMatrix3 gJointRotUnaligned[32];
-static LLVector4 gJointPivot[32];
+static LLMatrix4 gJointMatUnaligned[32];
+static LLMatrix4a gJointMatAligned[32];
+static LLMatrix3 gJointRotUnaligned[32];
+static LLVector4 gJointPivot[32];
//-----------------------------------------------------------------------------
// uploadJointMatrices()
//-----------------------------------------------------------------------------
void LLViewerJointMesh::uploadJointMatrices()
{
- S32 joint_num;
- LLPolyMesh *reference_mesh = mMesh->getReferenceMesh();
- LLDrawPool *poolp = mFace ? mFace->getPool() : NULL;
- BOOL hardware_skinning = (poolp && poolp->getShaderLevel() > 0) ? TRUE : FALSE;
-
- //calculate joint matrices
- for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++)
- {
- LLMatrix4 joint_mat = *reference_mesh->mJointRenderData[joint_num]->mWorldMatrix;
-
- if (hardware_skinning)
- {
- joint_mat *= LLDrawPoolAvatar::getModelView();
- }
- gJointMatUnaligned[joint_num] = joint_mat;
- gJointRotUnaligned[joint_num] = joint_mat.getMat3();
- }
-
- BOOL last_pivot_uploaded = FALSE;
- S32 j = 0;
-
- //upload joint pivots
- for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++)
- {
- LLSkinJoint *sj = reference_mesh->mJointRenderData[joint_num]->mSkinJoint;
- if (sj)
- {
- if (!last_pivot_uploaded)
- {
- LLVector4 parent_pivot(sj->mRootToParentJointSkinOffset);
- parent_pivot.mV[VW] = 0.f;
- gJointPivot[j++] = parent_pivot;
- }
-
- LLVector4 child_pivot(sj->mRootToJointSkinOffset);
- child_pivot.mV[VW] = 0.f;
-
- gJointPivot[j++] = child_pivot;
-
- last_pivot_uploaded = TRUE;
- }
- else
- {
- last_pivot_uploaded = FALSE;
- }
- }
-
- //add pivot point into transform
- for (S32 i = 0; i < j; i++)
- {
- LLVector3 pivot;
- pivot = LLVector3(gJointPivot[i]);
- pivot = pivot * gJointRotUnaligned[i];
- gJointMatUnaligned[i].translate(pivot);
- }
-
- // upload matrices
- if (hardware_skinning)
- {
- GLfloat mat[45*4];
- memset(mat, 0, sizeof(GLfloat)*45*4);
-
- for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++)
- {
- gJointMatUnaligned[joint_num].transpose();
-
- for (S32 axis = 0; axis < NUM_AXES; axis++)
- {
- F32* vector = gJointMatUnaligned[joint_num].mMatrix[axis];
- U32 offset = LL_CHARACTER_MAX_JOINTS_PER_MESH*axis+joint_num;
- memcpy(mat+offset*4, vector, sizeof(GLfloat)*4);
- }
- }
- stop_glerror();
- if (LLGLSLShader::sCurBoundShaderPtr)
- {
- LLGLSLShader::sCurBoundShaderPtr->uniform4fv(LLViewerShaderMgr::AVATAR_MATRIX, 45, mat);
- }
- stop_glerror();
- }
- else
- {
- //load gJointMatUnaligned into gJointMatAligned
- for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); ++joint_num)
- {
- gJointMatAligned[joint_num].loadu(gJointMatUnaligned[joint_num]);
- }
- }
+ S32 joint_num;
+ LLPolyMesh *reference_mesh = mMesh->getReferenceMesh();
+ LLDrawPool *poolp = mFace ? mFace->getPool() : NULL;
+ BOOL hardware_skinning = (poolp && poolp->getShaderLevel() > 0) ? TRUE : FALSE;
+
+ //calculate joint matrices
+ for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++)
+ {
+ LLMatrix4 joint_mat = *reference_mesh->mJointRenderData[joint_num]->mWorldMatrix;
+
+ if (hardware_skinning)
+ {
+ joint_mat *= LLDrawPoolAvatar::getModelView();
+ }
+ gJointMatUnaligned[joint_num] = joint_mat;
+ gJointRotUnaligned[joint_num] = joint_mat.getMat3();
+ }
+
+ BOOL last_pivot_uploaded = FALSE;
+ S32 j = 0;
+
+ //upload joint pivots
+ for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++)
+ {
+ LLSkinJoint *sj = reference_mesh->mJointRenderData[joint_num]->mSkinJoint;
+ if (sj)
+ {
+ if (!last_pivot_uploaded)
+ {
+ LLVector4 parent_pivot(sj->mRootToParentJointSkinOffset);
+ parent_pivot.mV[VW] = 0.f;
+ gJointPivot[j++] = parent_pivot;
+ }
+
+ LLVector4 child_pivot(sj->mRootToJointSkinOffset);
+ child_pivot.mV[VW] = 0.f;
+
+ gJointPivot[j++] = child_pivot;
+
+ last_pivot_uploaded = TRUE;
+ }
+ else
+ {
+ last_pivot_uploaded = FALSE;
+ }
+ }
+
+ //add pivot point into transform
+ for (S32 i = 0; i < j; i++)
+ {
+ LLVector3 pivot;
+ pivot = LLVector3(gJointPivot[i]);
+ pivot = pivot * gJointRotUnaligned[i];
+ gJointMatUnaligned[i].translate(pivot);
+ }
+
+ // upload matrices
+ if (hardware_skinning)
+ {
+ GLfloat mat[45*4];
+ memset(mat, 0, sizeof(GLfloat)*45*4);
+
+ for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++)
+ {
+ gJointMatUnaligned[joint_num].transpose();
+
+ for (S32 axis = 0; axis < NUM_AXES; axis++)
+ {
+ F32* vector = gJointMatUnaligned[joint_num].mMatrix[axis];
+ U32 offset = LL_CHARACTER_MAX_JOINTS_PER_MESH*axis+joint_num;
+ memcpy(mat+offset*4, vector, sizeof(GLfloat)*4);
+ }
+ }
+ stop_glerror();
+ if (LLGLSLShader::sCurBoundShaderPtr)
+ {
+ LLGLSLShader::sCurBoundShaderPtr->uniform4fv(LLViewerShaderMgr::AVATAR_MATRIX, 45, mat);
+ }
+ stop_glerror();
+ }
+ else
+ {
+ //load gJointMatUnaligned into gJointMatAligned
+ for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); ++joint_num)
+ {
+ gJointMatAligned[joint_num].loadu(gJointMatUnaligned[joint_num]);
+ }
+ }
}
//--------------------------------------------------------------------
@@ -202,15 +202,15 @@ void LLViewerJointMesh::uploadJointMatrices()
// compare_int is used by the qsort function to sort the index array
int compare_int(const void *a, const void *b)
{
- if (*(U32*)a < *(U32*)b)
- {
- return -1;
- }
- else if (*(U32*)a > *(U32*)b)
- {
- return 1;
- }
- else return 0;
+ if (*(U32*)a < *(U32*)b)
+ {
+ return -1;
+ }
+ else if (*(U32*)a > *(U32*)b)
+ {
+ return 1;
+ }
+ else return 0;
}
//--------------------------------------------------------------------
@@ -218,105 +218,105 @@ int compare_int(const void *a, const void *b)
//--------------------------------------------------------------------
U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
{
- if (!mValid || !mMesh || !mFace || !mVisible ||
- !mFace->getVertexBuffer() ||
- mMesh->getNumFaces() == 0 ||
- LLGLSLShader::sCurBoundShaderPtr == NULL)
- {
- return 0;
- }
-
- U32 triangle_count = 0;
-
- S32 diffuse_channel = LLDrawPoolAvatar::sDiffuseChannel;
-
- stop_glerror();
-
- //----------------------------------------------------------------
- // setup current color
- //----------------------------------------------------------------
- if (is_dummy)
- gGL.diffuseColor4fv(LLVOAvatar::getDummyColor().mV);
- else
- gGL.diffuseColor4fv(mColor.mV);
-
- stop_glerror();
-
- LLGLSSpecular specular(LLColor4(1.f,1.f,1.f,1.f), 0.f);
-
- //----------------------------------------------------------------
- // setup current texture
- //----------------------------------------------------------------
- llassert( !(mTexture.notNull() && mLayerSet) ); // mutually exclusive
-
- LLViewerTexLayerSet *layerset = dynamic_cast<LLViewerTexLayerSet*>(mLayerSet);
- if (mTestImageName)
- {
- gGL.getTexUnit(diffuse_channel)->bindManual(LLTexUnit::TT_TEXTURE, mTestImageName);
-
- if (mIsTransparent)
- {
- gGL.diffuseColor4f(1.f, 1.f, 1.f, 1.f);
- }
- else
- {
- gGL.diffuseColor4f(0.7f, 0.6f, 0.3f, 1.f);
- }
- }
- else if( !is_dummy && layerset )
- {
- if( layerset->hasComposite() )
- {
- gGL.getTexUnit(diffuse_channel)->bind(layerset->getViewerComposite());
- }
- else
- {
- gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
- }
- }
- else if ( !is_dummy && mTexture.notNull() )
- {
- gGL.getTexUnit(diffuse_channel)->bind(mTexture);
- }
- else
- {
- gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
- }
-
- U32 start = mMesh->mFaceVertexOffset;
- U32 end = start + mMesh->mFaceVertexCount - 1;
- U32 count = mMesh->mFaceIndexCount;
- U32 offset = mMesh->mFaceIndexOffset;
-
- LLVertexBuffer* buff = mFace->getVertexBuffer();
-
- if (mMesh->hasWeights())
- {
- if ((mFace->getPool()->getShaderLevel() > 0))
- {
- if (first_pass)
- {
- uploadJointMatrices();
- }
- }
-
- buff->setBuffer();
- buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
- }
- else
- {
- gGL.pushMatrix();
- LLMatrix4 jointToWorld = getWorldMatrix();
- gGL.multMatrix((GLfloat*)jointToWorld.mMatrix);
- buff->setBuffer();
- buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
- gGL.popMatrix();
- }
- gPipeline.addTrianglesDrawn(count);
-
- triangle_count += count;
-
- return triangle_count;
+ if (!mValid || !mMesh || !mFace || !mVisible ||
+ !mFace->getVertexBuffer() ||
+ mMesh->getNumFaces() == 0 ||
+ LLGLSLShader::sCurBoundShaderPtr == NULL)
+ {
+ return 0;
+ }
+
+ U32 triangle_count = 0;
+
+ S32 diffuse_channel = LLDrawPoolAvatar::sDiffuseChannel;
+
+ stop_glerror();
+
+ //----------------------------------------------------------------
+ // setup current color
+ //----------------------------------------------------------------
+ if (is_dummy)
+ gGL.diffuseColor4fv(LLVOAvatar::getDummyColor().mV);
+ else
+ gGL.diffuseColor4fv(mColor.mV);
+
+ stop_glerror();
+
+ LLGLSSpecular specular(LLColor4(1.f,1.f,1.f,1.f), 0.f);
+
+ //----------------------------------------------------------------
+ // setup current texture
+ //----------------------------------------------------------------
+ llassert( !(mTexture.notNull() && mLayerSet) ); // mutually exclusive
+
+ LLViewerTexLayerSet *layerset = dynamic_cast<LLViewerTexLayerSet*>(mLayerSet);
+ if (mTestImageName)
+ {
+ gGL.getTexUnit(diffuse_channel)->bindManual(LLTexUnit::TT_TEXTURE, mTestImageName);
+
+ if (mIsTransparent)
+ {
+ gGL.diffuseColor4f(1.f, 1.f, 1.f, 1.f);
+ }
+ else
+ {
+ gGL.diffuseColor4f(0.7f, 0.6f, 0.3f, 1.f);
+ }
+ }
+ else if( !is_dummy && layerset )
+ {
+ if( layerset->hasComposite() )
+ {
+ gGL.getTexUnit(diffuse_channel)->bind(layerset->getViewerComposite());
+ }
+ else
+ {
+ gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
+ }
+ }
+ else if ( !is_dummy && mTexture.notNull() )
+ {
+ gGL.getTexUnit(diffuse_channel)->bind(mTexture);
+ }
+ else
+ {
+ gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
+ }
+
+ U32 start = mMesh->mFaceVertexOffset;
+ U32 end = start + mMesh->mFaceVertexCount - 1;
+ U32 count = mMesh->mFaceIndexCount;
+ U32 offset = mMesh->mFaceIndexOffset;
+
+ LLVertexBuffer* buff = mFace->getVertexBuffer();
+
+ if (mMesh->hasWeights())
+ {
+ if ((mFace->getPool()->getShaderLevel() > 0))
+ {
+ if (first_pass)
+ {
+ uploadJointMatrices();
+ }
+ }
+
+ buff->setBuffer();
+ buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
+ }
+ else
+ {
+ gGL.pushMatrix();
+ LLMatrix4 jointToWorld = getWorldMatrix();
+ gGL.multMatrix((GLfloat*)jointToWorld.mMatrix);
+ buff->setBuffer();
+ buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
+ gGL.popMatrix();
+ }
+ gPipeline.addTrianglesDrawn(count);
+
+ triangle_count += count;
+
+ return triangle_count;
}
//-----------------------------------------------------------------------------
@@ -324,22 +324,22 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
//-----------------------------------------------------------------------------
void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area)
{
- //bump num_vertices to next multiple of 4
- num_vertices = (num_vertices + 0x3) & ~0x3;
-
- // Do a pre-alloc pass to determine sizes of data.
- if (mMesh && mValid)
- {
- mMesh->mFaceVertexOffset = num_vertices;
- mMesh->mFaceVertexCount = mMesh->getNumVertices();
- mMesh->mFaceIndexOffset = num_indices;
- mMesh->mFaceIndexCount = mMesh->getSharedData()->mNumTriangleIndices;
-
- mMesh->getReferenceMesh()->mCurVertexCount = mMesh->mFaceVertexCount;
-
- num_vertices += mMesh->getNumVertices();
- num_indices += mMesh->mFaceIndexCount;
- }
+ //bump num_vertices to next multiple of 4
+ num_vertices = (num_vertices + 0x3) & ~0x3;
+
+ // Do a pre-alloc pass to determine sizes of data.
+ if (mMesh && mValid)
+ {
+ mMesh->mFaceVertexOffset = num_vertices;
+ mMesh->mFaceVertexCount = mMesh->getNumVertices();
+ mMesh->mFaceIndexOffset = num_indices;
+ mMesh->mFaceIndexCount = mMesh->getSharedData()->mNumTriangleIndices;
+
+ mMesh->getReferenceMesh()->mCurVertexCount = mMesh->mFaceVertexCount;
+
+ num_vertices += mMesh->getNumVertices();
+ num_indices += mMesh->mFaceIndexCount;
+ }
}
//-----------------------------------------------------------------------------
@@ -348,87 +348,87 @@ void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32
void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update)
{
- //IF THIS FUNCTION BREAKS, SEE LLPOLYMESH CONSTRUCTOR AND CHECK ALIGNMENT OF INPUT ARRAYS
+ //IF THIS FUNCTION BREAKS, SEE LLPOLYMESH CONSTRUCTOR AND CHECK ALIGNMENT OF INPUT ARRAYS
+
+ mFace = face;
- mFace = face;
+ if (!mFace->getVertexBuffer())
+ {
+ return;
+ }
- if (!mFace->getVertexBuffer())
- {
- return;
- }
+ LLDrawPool *poolp = mFace->getPool();
+ BOOL hardware_skinning = (poolp && poolp->getShaderLevel() > 0) ? TRUE : FALSE;
- LLDrawPool *poolp = mFace->getPool();
- BOOL hardware_skinning = (poolp && poolp->getShaderLevel() > 0) ? TRUE : FALSE;
+ if (!hardware_skinning && terse_update)
+ { //no need to do terse updates if we're doing software vertex skinning
+ // since mMesh is being copied into mVertexBuffer every frame
+ return;
+ }
- if (!hardware_skinning && terse_update)
- { //no need to do terse updates if we're doing software vertex skinning
- // since mMesh is being copied into mVertexBuffer every frame
- return;
- }
-
LL_PROFILE_ZONE_SCOPED;
- LLStrider<LLVector3> verticesp;
- LLStrider<LLVector3> normalsp;
- LLStrider<LLVector2> tex_coordsp;
- LLStrider<F32> vertex_weightsp;
- LLStrider<LLVector4> clothing_weightsp;
- LLStrider<U16> indicesp;
-
- // Copy data into the faces from the polymesh data.
- if (mMesh && mValid)
- {
- const U32 num_verts = mMesh->getNumVertices();
-
- if (num_verts)
- {
- face->getVertexBuffer()->getIndexStrider(indicesp);
- face->getGeometryAvatar(verticesp, normalsp, tex_coordsp, vertex_weightsp, clothing_weightsp);
-
- verticesp += mMesh->mFaceVertexOffset;
- normalsp += mMesh->mFaceVertexOffset;
-
- F32* v = (F32*) verticesp.get();
- F32* n = (F32*) normalsp.get();
-
- U32 words = num_verts*4;
-
- LLVector4a::memcpyNonAliased16(v, (F32*) mMesh->getCoords(), words*sizeof(F32));
- LLVector4a::memcpyNonAliased16(n, (F32*) mMesh->getNormals(), words*sizeof(F32));
-
-
- if (!terse_update)
- {
- vertex_weightsp += mMesh->mFaceVertexOffset;
- clothing_weightsp += mMesh->mFaceVertexOffset;
- tex_coordsp += mMesh->mFaceVertexOffset;
-
- F32* tc = (F32*) tex_coordsp.get();
- F32* vw = (F32*) vertex_weightsp.get();
- F32* cw = (F32*) clothing_weightsp.get();
-
- S32 tc_size = (num_verts*2*sizeof(F32)+0xF) & ~0xF;
- LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), tc_size);
- S32 vw_size = (num_verts*sizeof(F32)+0xF) & ~0xF;
- LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), vw_size);
- LLVector4a::memcpyNonAliased16(cw, (F32*) mMesh->getClothingWeights(), num_verts*4*sizeof(F32));
- }
-
- const U32 idx_count = mMesh->getNumFaces()*3;
-
- indicesp += mMesh->mFaceIndexOffset;
-
- U16* __restrict idx = indicesp.get();
- S32* __restrict src_idx = (S32*) mMesh->getFaces();
-
- const S32 offset = (S32) mMesh->mFaceVertexOffset;
-
- for (S32 i = 0; i < idx_count; ++i)
- {
- *(idx++) = *(src_idx++)+offset;
- }
- }
- }
+ LLStrider<LLVector3> verticesp;
+ LLStrider<LLVector3> normalsp;
+ LLStrider<LLVector2> tex_coordsp;
+ LLStrider<F32> vertex_weightsp;
+ LLStrider<LLVector4> clothing_weightsp;
+ LLStrider<U16> indicesp;
+
+ // Copy data into the faces from the polymesh data.
+ if (mMesh && mValid)
+ {
+ const U32 num_verts = mMesh->getNumVertices();
+
+ if (num_verts)
+ {
+ face->getVertexBuffer()->getIndexStrider(indicesp);
+ face->getGeometryAvatar(verticesp, normalsp, tex_coordsp, vertex_weightsp, clothing_weightsp);
+
+ verticesp += mMesh->mFaceVertexOffset;
+ normalsp += mMesh->mFaceVertexOffset;
+
+ F32* v = (F32*) verticesp.get();
+ F32* n = (F32*) normalsp.get();
+
+ U32 words = num_verts*4;
+
+ LLVector4a::memcpyNonAliased16(v, (F32*) mMesh->getCoords(), words*sizeof(F32));
+ LLVector4a::memcpyNonAliased16(n, (F32*) mMesh->getNormals(), words*sizeof(F32));
+
+
+ if (!terse_update)
+ {
+ vertex_weightsp += mMesh->mFaceVertexOffset;
+ clothing_weightsp += mMesh->mFaceVertexOffset;
+ tex_coordsp += mMesh->mFaceVertexOffset;
+
+ F32* tc = (F32*) tex_coordsp.get();
+ F32* vw = (F32*) vertex_weightsp.get();
+ F32* cw = (F32*) clothing_weightsp.get();
+
+ S32 tc_size = (num_verts*2*sizeof(F32)+0xF) & ~0xF;
+ LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), tc_size);
+ S32 vw_size = (num_verts*sizeof(F32)+0xF) & ~0xF;
+ LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), vw_size);
+ LLVector4a::memcpyNonAliased16(cw, (F32*) mMesh->getClothingWeights(), num_verts*4*sizeof(F32));
+ }
+
+ const U32 idx_count = mMesh->getNumFaces()*3;
+
+ indicesp += mMesh->mFaceIndexOffset;
+
+ U16* __restrict idx = indicesp.get();
+ S32* __restrict src_idx = (S32*) mMesh->getFaces();
+
+ const S32 offset = (S32) mMesh->mFaceVertexOffset;
+
+ for (S32 i = 0; i < idx_count; ++i)
+ {
+ *(idx++) = *(src_idx++)+offset;
+ }
+ }
+ }
}
@@ -438,88 +438,88 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w
//-----------------------------------------------------------------------------
BOOL LLViewerJointMesh::updateLOD(F32 pixel_area, BOOL activate)
{
- BOOL valid = mValid;
- setValid(activate, TRUE);
- return (valid != activate);
+ BOOL valid = mValid;
+ setValid(activate, TRUE);
+ return (valid != activate);
}
// static
void LLViewerJointMesh::updateGeometry(LLFace *mFace, LLPolyMesh *mMesh)
{
- LLStrider<LLVector3> o_vertices;
- LLStrider<LLVector3> o_normals;
-
- //get vertex and normal striders
- LLVertexBuffer* buffer = mFace->getVertexBuffer();
- buffer->getVertexStrider(o_vertices, 0);
- buffer->getNormalStrider(o_normals, 0);
-
- F32* __restrict vert = o_vertices[0].mV;
- F32* __restrict norm = o_normals[0].mV;
-
- const F32* __restrict weights = mMesh->getWeights();
- const LLVector4a* __restrict coords = (LLVector4a*) mMesh->getCoords();
- const LLVector4a* __restrict normals = (LLVector4a*) mMesh->getNormals();
-
- U32 offset = mMesh->mFaceVertexOffset*4;
- vert += offset;
- norm += offset;
-
- for (U32 index = 0; index < mMesh->getNumVertices(); index++)
- {
- // equivalent to joint = floorf(weights[index]);
- S32 joint = _mm_cvtt_ss2si(_mm_load_ss(weights+index));
- F32 w = weights[index] - joint;
-
- LLMatrix4a gBlendMat;
-
- if (w != 0.f)
- {
- // blend between matrices and apply
- gBlendMat.setLerp(gJointMatAligned[joint+0],
- gJointMatAligned[joint+1], w);
-
- LLVector4a res;
- gBlendMat.affineTransform(coords[index], res);
- res.store4a(vert+index*4);
- gBlendMat.rotate(normals[index], res);
- res.store4a(norm+index*4);
- }
- else
- { // No lerp required in this case.
- LLVector4a res;
- gJointMatAligned[joint].affineTransform(coords[index], res);
- res.store4a(vert+index*4);
- gJointMatAligned[joint].rotate(normals[index], res);
- res.store4a(norm+index*4);
- }
- }
-
- buffer->unmapBuffer();
+ LLStrider<LLVector3> o_vertices;
+ LLStrider<LLVector3> o_normals;
+
+ //get vertex and normal striders
+ LLVertexBuffer* buffer = mFace->getVertexBuffer();
+ buffer->getVertexStrider(o_vertices, 0);
+ buffer->getNormalStrider(o_normals, 0);
+
+ F32* __restrict vert = o_vertices[0].mV;
+ F32* __restrict norm = o_normals[0].mV;
+
+ const F32* __restrict weights = mMesh->getWeights();
+ const LLVector4a* __restrict coords = (LLVector4a*) mMesh->getCoords();
+ const LLVector4a* __restrict normals = (LLVector4a*) mMesh->getNormals();
+
+ U32 offset = mMesh->mFaceVertexOffset*4;
+ vert += offset;
+ norm += offset;
+
+ for (U32 index = 0; index < mMesh->getNumVertices(); index++)
+ {
+ // equivalent to joint = floorf(weights[index]);
+ S32 joint = _mm_cvtt_ss2si(_mm_load_ss(weights+index));
+ F32 w = weights[index] - joint;
+
+ LLMatrix4a gBlendMat;
+
+ if (w != 0.f)
+ {
+ // blend between matrices and apply
+ gBlendMat.setLerp(gJointMatAligned[joint+0],
+ gJointMatAligned[joint+1], w);
+
+ LLVector4a res;
+ gBlendMat.affineTransform(coords[index], res);
+ res.store4a(vert+index*4);
+ gBlendMat.rotate(normals[index], res);
+ res.store4a(norm+index*4);
+ }
+ else
+ { // No lerp required in this case.
+ LLVector4a res;
+ gJointMatAligned[joint].affineTransform(coords[index], res);
+ res.store4a(vert+index*4);
+ gJointMatAligned[joint].rotate(normals[index], res);
+ res.store4a(norm+index*4);
+ }
+ }
+
+ buffer->unmapBuffer();
}
void LLViewerJointMesh::updateJointGeometry()
{
- if (!(mValid
- && mMesh
- && mFace
- && mMesh->hasWeights()
- && mFace->getVertexBuffer()
- && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) == 0))
- {
- return;
- }
-
- uploadJointMatrices();
- updateGeometry(mFace, mMesh);
+ if (!(mValid
+ && mMesh
+ && mFace
+ && mMesh->hasWeights()
+ && mFace->getVertexBuffer()
+ && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) == 0))
+ {
+ return;
+ }
+
+ uploadJointMatrices();
+ updateGeometry(mFace, mMesh);
}
void LLViewerJointMesh::dump()
{
- if (mValid)
- {
- LL_INFOS() << "Usable LOD " << mName << LL_ENDL;
- }
+ if (mValid)
+ {
+ LL_INFOS() << "Usable LOD " << mName << LL_ENDL;
+ }
}
// End
diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h
index 0db2836e15..deeec727a9 100644
--- a/indra/newview/llviewerjointmesh.h
+++ b/indra/newview/llviewerjointmesh.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerjointmesh.h
* @brief Declaration of LLViewerJointMesh class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,34 +44,34 @@ class LLViewerTexLayerSet;
class LLViewerJointMesh : public LLAvatarJointMesh, public LLViewerJoint
{
public:
- // Constructor
- LLViewerJointMesh();
+ // Constructor
+ LLViewerJointMesh();
+
+ // Destructor
+ virtual ~LLViewerJointMesh();
- // Destructor
- virtual ~LLViewerJointMesh();
+ // Render time method to upload batches of joint matrices
+ void uploadJointMatrices();
- // Render time method to upload batches of joint matrices
- void uploadJointMatrices();
+ // overloaded from base class
+ /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy );
- // overloaded from base class
- /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy );
+ // necessary because MS's compiler warns on function inheritance via dominance in the diamond inheritance here.
+ // warns even though LLViewerJoint holds the only non virtual implementation.
+ /*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) { return LLViewerJoint::render(pixelArea,first_pass,is_dummy);}
- // necessary because MS's compiler warns on function inheritance via dominance in the diamond inheritance here.
- // warns even though LLViewerJoint holds the only non virtual implementation.
- /*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) { return LLViewerJoint::render(pixelArea,first_pass,is_dummy);}
+ /*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
+ /*virtual*/ void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
+ /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate);
+ /*virtual*/ void updateJointGeometry();
+ /*virtual*/ void dump();
- /*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
- /*virtual*/ void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
- /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate);
- /*virtual*/ void updateJointGeometry();
- /*virtual*/ void dump();
+ /*virtual*/ BOOL isAnimatable() const { return FALSE; }
- /*virtual*/ BOOL isAnimatable() const { return FALSE; }
-
private:
- //copy mesh into given face's vertex buffer, applying current animation pose
- static void updateGeometry(LLFace* face, LLPolyMesh* mesh);
+ //copy mesh into given face's vertex buffer, applying current animation pose
+ static void updateGeometry(LLFace* face, LLPolyMesh* mesh);
};
#endif // LL_LLVIEWERJOINTMESH_H
diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp
index e35cb26ce1..c09e6a433a 100644
--- a/indra/newview/llviewerjoystick.cpp
+++ b/indra/newview/llviewerjoystick.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerjoystick.cpp
* @brief Joystick / NDOF device functionality.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,20 +53,20 @@
// ----------------------------------------------------------------------------
// Constants
-#define X_I 1
-#define Y_I 2
-#define Z_I 0
-#define RX_I 4
-#define RY_I 5
-#define RZ_I 3
+#define X_I 1
+#define Y_I 2
+#define Z_I 0
+#define RX_I 4
+#define RY_I 5
+#define RZ_I 3
F32 LLViewerJoystick::sLastDelta[] = {0,0,0,0,0,0,0};
F32 LLViewerJoystick::sDelta[] = {0,0,0,0,0,0,0};
// These constants specify the maximum absolute value coming in from the device.
-// HACK ALERT! the value of MAX_JOYSTICK_INPUT_VALUE is not arbitrary as it
+// HACK ALERT! the value of MAX_JOYSTICK_INPUT_VALUE is not arbitrary as it
// should be. It has to be equal to 3000 because the SpaceNavigator on Windows
-// refuses to respond to the DirectInput SetProperty call; it always returns
+// refuses to respond to the DirectInput SetProperty call; it always returns
// values in the [-3000, 3000] range.
#define MAX_SPACENAVIGATOR_INPUT 3000.0f
#define MAX_JOYSTICK_INPUT_VALUE MAX_SPACENAVIGATOR_INPUT
@@ -232,56 +232,56 @@ std::string string_from_guid(const GUID &guid)
// -----------------------------------------------------------------------------
void LLViewerJoystick::updateEnabled(bool autoenable)
{
- if (mDriverState == JDS_UNINITIALIZED)
- {
- gSavedSettings.setBOOL("JoystickEnabled", FALSE );
- }
- else
- {
- // autoenable if user specifically chose this device
- if (autoenable && (isLikeSpaceNavigator() || isDeviceUUIDSet()))
- {
- gSavedSettings.setBOOL("JoystickEnabled", TRUE );
- }
- }
- if (!gSavedSettings.getBOOL("JoystickEnabled"))
- {
- mOverrideCamera = FALSE;
- }
+ if (mDriverState == JDS_UNINITIALIZED)
+ {
+ gSavedSettings.setBOOL("JoystickEnabled", FALSE );
+ }
+ else
+ {
+ // autoenable if user specifically chose this device
+ if (autoenable && (isLikeSpaceNavigator() || isDeviceUUIDSet()))
+ {
+ gSavedSettings.setBOOL("JoystickEnabled", TRUE );
+ }
+ }
+ if (!gSavedSettings.getBOOL("JoystickEnabled"))
+ {
+ mOverrideCamera = FALSE;
+ }
}
void LLViewerJoystick::setOverrideCamera(bool val)
{
- if (!gSavedSettings.getBOOL("JoystickEnabled"))
- {
- mOverrideCamera = FALSE;
- }
- else
- {
- mOverrideCamera = val;
- }
-
- if (mOverrideCamera)
- {
- gAgentCamera.changeCameraToDefault();
- }
+ if (!gSavedSettings.getBOOL("JoystickEnabled"))
+ {
+ mOverrideCamera = FALSE;
+ }
+ else
+ {
+ mOverrideCamera = val;
+ }
+
+ if (mOverrideCamera)
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
}
// -----------------------------------------------------------------------------
#if LIB_NDOF
NDOF_HotPlugResult LLViewerJoystick::HotPlugAddCallback(NDOF_Device *dev)
{
- NDOF_HotPlugResult res = NDOF_DISCARD_HOTPLUGGED;
- LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
- if (joystick->mDriverState == JDS_UNINITIALIZED)
- {
- LL_INFOS("Joystick") << "HotPlugAddCallback: will use device:" << LL_ENDL;
- ndof_dump(stderr, dev);
- joystick->mNdofDev = dev;
- joystick->mDriverState = JDS_INITIALIZED;
- res = NDOF_KEEP_HOTPLUGGED;
- }
- joystick->updateEnabled(true);
+ NDOF_HotPlugResult res = NDOF_DISCARD_HOTPLUGGED;
+ LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
+ if (joystick->mDriverState == JDS_UNINITIALIZED)
+ {
+ LL_INFOS("Joystick") << "HotPlugAddCallback: will use device:" << LL_ENDL;
+ ndof_dump(stderr, dev);
+ joystick->mNdofDev = dev;
+ joystick->mDriverState = JDS_INITIALIZED;
+ res = NDOF_KEEP_HOTPLUGGED;
+ }
+ joystick->updateEnabled(true);
return res;
}
#endif
@@ -290,36 +290,36 @@ NDOF_HotPlugResult LLViewerJoystick::HotPlugAddCallback(NDOF_Device *dev)
#if LIB_NDOF
void LLViewerJoystick::HotPlugRemovalCallback(NDOF_Device *dev)
{
- LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
- if (joystick->mNdofDev == dev)
- {
+ LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
+ if (joystick->mNdofDev == dev)
+ {
LL_INFOS("Joystick") << "HotPlugRemovalCallback: joystick->mNdofDev="
- << joystick->mNdofDev << "; removed device:" << LL_ENDL;
- ndof_dump(stderr, dev);
- joystick->mDriverState = JDS_UNINITIALIZED;
- }
- joystick->updateEnabled(true);
+ << joystick->mNdofDev << "; removed device:" << LL_ENDL;
+ ndof_dump(stderr, dev);
+ joystick->mDriverState = JDS_UNINITIALIZED;
+ }
+ joystick->updateEnabled(true);
}
#endif
// -----------------------------------------------------------------------------
LLViewerJoystick::LLViewerJoystick()
-: mDriverState(JDS_UNINITIALIZED),
- mNdofDev(NULL),
- mResetFlag(false),
- mCameraUpdated(true),
- mOverrideCamera(false),
- mJoystickRun(0)
+: mDriverState(JDS_UNINITIALIZED),
+ mNdofDev(NULL),
+ mResetFlag(false),
+ mCameraUpdated(true),
+ mOverrideCamera(false),
+ mJoystickRun(0)
{
- for (int i = 0; i < 6; i++)
- {
- mAxes[i] = sDelta[i] = sLastDelta[i] = 0.0f;
- }
-
- memset(mBtn, 0, sizeof(mBtn));
+ for (int i = 0; i < 6; i++)
+ {
+ mAxes[i] = sDelta[i] = sLastDelta[i] = 0.0f;
+ }
+
+ memset(mBtn, 0, sizeof(mBtn));
- // factor in bandwidth? bandwidth = gViewerStats->mKBitStat
- mPerfScale = 4000.f / gSysCPU.getMHz(); // hmm. why?
+ // factor in bandwidth? bandwidth = gViewerStats->mKBitStat
+ mPerfScale = 4000.f / gSysCPU.getMHz(); // hmm. why?
mLastDeviceUUID = LLSD::Integer(1);
}
@@ -327,43 +327,43 @@ LLViewerJoystick::LLViewerJoystick()
// -----------------------------------------------------------------------------
LLViewerJoystick::~LLViewerJoystick()
{
- if (mDriverState == JDS_INITIALIZED)
- {
- terminate();
- }
+ if (mDriverState == JDS_INITIALIZED)
+ {
+ terminate();
+ }
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::init(bool autoenable)
{
#if LIB_NDOF
- static bool libinit = false;
- mDriverState = JDS_INITIALIZING;
+ static bool libinit = false;
+ mDriverState = JDS_INITIALIZING;
loadDeviceIdFromSettings();
- if (libinit == false)
- {
- // Note: The HotPlug callbacks are not actually getting called on Windows
- if (ndof_libinit(HotPlugAddCallback,
- HotPlugRemovalCallback,
- gViewerWindow->getWindow()->getDirectInput8()))
- {
- mDriverState = JDS_UNINITIALIZED;
- }
- else
- {
- // NB: ndof_libinit succeeds when there's no device
- libinit = true;
-
- // allocate memory once for an eventual device
- mNdofDev = ndof_create();
- }
- }
-
- if (libinit)
- {
- if (mNdofDev)
+ if (libinit == false)
+ {
+ // Note: The HotPlug callbacks are not actually getting called on Windows
+ if (ndof_libinit(HotPlugAddCallback,
+ HotPlugRemovalCallback,
+ gViewerWindow->getWindow()->getDirectInput8()))
+ {
+ mDriverState = JDS_UNINITIALIZED;
+ }
+ else
+ {
+ // NB: ndof_libinit succeeds when there's no device
+ libinit = true;
+
+ // allocate memory once for an eventual device
+ mNdofDev = ndof_create();
+ }
+ }
+
+ if (libinit)
+ {
+ if (mNdofDev)
{
// di8_devices_callback callback is immediate and happens in scope of getInputDevices()
#if LL_WINDOWS && !LL_MESA_HEADLESS
@@ -391,46 +391,46 @@ void LLViewerJoystick::init(bool autoenable)
LL_INFOS("Joystick") << "Found no matching joystick devices." << LL_ENDL;
mDriverState = JDS_UNINITIALIZED;
}
- }
- else
- {
- mDriverState = JDS_UNINITIALIZED;
- }
- }
-
- // Autoenable the joystick for recognized devices if nothing was connected previously
- if (!autoenable)
- {
- autoenable = gSavedSettings.getString("JoystickInitialized").empty() ? true : false;
- }
- updateEnabled(autoenable);
-
- if (mDriverState == JDS_INITIALIZED)
- {
- // A Joystick device is plugged in
- if (isLikeSpaceNavigator())
- {
- // It's a space navigator, we have defaults for it.
- if (gSavedSettings.getString("JoystickInitialized") != "SpaceNavigator")
- {
- // Only set the defaults if we haven't already (in case they were overridden)
- setSNDefaults();
- gSavedSettings.setString("JoystickInitialized", "SpaceNavigator");
- }
- }
- else
- {
- // It's not a Space Navigator
- gSavedSettings.setString("JoystickInitialized", "UnknownDevice");
- }
- }
- else
- {
- // No device connected, don't change any settings
- }
-
- LL_INFOS("Joystick") << "ndof: mDriverState=" << mDriverState << "; mNdofDev="
- << mNdofDev << "; libinit=" << libinit << LL_ENDL;
+ }
+ else
+ {
+ mDriverState = JDS_UNINITIALIZED;
+ }
+ }
+
+ // Autoenable the joystick for recognized devices if nothing was connected previously
+ if (!autoenable)
+ {
+ autoenable = gSavedSettings.getString("JoystickInitialized").empty() ? true : false;
+ }
+ updateEnabled(autoenable);
+
+ if (mDriverState == JDS_INITIALIZED)
+ {
+ // A Joystick device is plugged in
+ if (isLikeSpaceNavigator())
+ {
+ // It's a space navigator, we have defaults for it.
+ if (gSavedSettings.getString("JoystickInitialized") != "SpaceNavigator")
+ {
+ // Only set the defaults if we haven't already (in case they were overridden)
+ setSNDefaults();
+ gSavedSettings.setString("JoystickInitialized", "SpaceNavigator");
+ }
+ }
+ else
+ {
+ // It's not a Space Navigator
+ gSavedSettings.setString("JoystickInitialized", "UnknownDevice");
+ }
+ }
+ else
+ {
+ // No device connected, don't change any settings
+ }
+
+ LL_INFOS("Joystick") << "ndof: mDriverState=" << mDriverState << "; mNdofDev="
+ << mNdofDev << "; libinit=" << libinit << LL_ENDL;
#endif
}
@@ -451,7 +451,7 @@ void LLViewerJoystick::initDevice(LLSD &guid)
void* callback = NULL;
#endif
- mDriverState = JDS_INITIALIZING;
+ mDriverState = JDS_INITIALIZING;
if (!gViewerWindow->getWindow()->getInputDevices(device_type, callback, NULL))
{
LL_INFOS("Joystick") << "Failed to gather devices from window. Falling back to ndof's init" << LL_ENDL;
@@ -485,16 +485,16 @@ void LLViewerJoystick::initDevice(void * preffered_device /* LPDIRECTINPUTDEVICE
{
#if LIB_NDOF
// Different joysticks will return different ranges of raw values.
- // Since we want to handle every device in the same uniform way,
- // we initialize the mNdofDev struct and we set the range
- // of values we would like to receive.
- //
- // HACK: On Windows, libndofdev passes our range to DI with a
+ // Since we want to handle every device in the same uniform way,
+ // we initialize the mNdofDev struct and we set the range
+ // of values we would like to receive.
+ //
+ // HACK: On Windows, libndofdev passes our range to DI with a
// SetProperty call. This works but with one notable exception, the
// SpaceNavigator, who doesn't seem to care about the SetProperty
- // call. In theory, we should handle this case inside libndofdev.
- // However, the range we're setting here is arbitrary anyway,
- // so let's just use the SpaceNavigator range for our purposes.
+ // call. In theory, we should handle this case inside libndofdev.
+ // However, the range we're setting here is arbitrary anyway,
+ // so let's just use the SpaceNavigator range for our purposes.
mNdofDev->axes_min = (long)-MAX_JOYSTICK_INPUT_VALUE;
mNdofDev->axes_max = (long)+MAX_JOYSTICK_INPUT_VALUE;
@@ -534,73 +534,73 @@ void LLViewerJoystick::updateStatus()
{
#if LIB_NDOF
- ndof_update(mNdofDev);
+ ndof_update(mNdofDev);
- for (int i=0; i<6; i++)
- {
- mAxes[i] = (F32) mNdofDev->axes[i] / mNdofDev->axes_max;
- }
+ for (int i=0; i<6; i++)
+ {
+ mAxes[i] = (F32) mNdofDev->axes[i] / mNdofDev->axes_max;
+ }
+
+ for (int i=0; i<16; i++)
+ {
+ mBtn[i] = mNdofDev->buttons[i];
+ }
- for (int i=0; i<16; i++)
- {
- mBtn[i] = mNdofDev->buttons[i];
- }
-
#endif
}
// -----------------------------------------------------------------------------
F32 LLViewerJoystick::getJoystickAxis(U32 axis) const
{
- if (axis < 6)
- {
- return mAxes[axis];
- }
- return 0.f;
+ if (axis < 6)
+ {
+ return mAxes[axis];
+ }
+ return 0.f;
}
// -----------------------------------------------------------------------------
U32 LLViewerJoystick::getJoystickButton(U32 button) const
{
- if (button < 16)
- {
- return mBtn[button];
- }
- return 0;
+ if (button < 16)
+ {
+ return mBtn[button];
+ }
+ return 0;
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::handleRun(F32 inc)
{
- // Decide whether to walk or run by applying a threshold, with slight
- // hysteresis to avoid oscillating between the two with input spikes.
- // Analog speed control would be better, but not likely any time soon.
- if (inc > gSavedSettings.getF32("JoystickRunThreshold"))
- {
- if (1 == mJoystickRun)
- {
- ++mJoystickRun;
- gAgent.setRunning();
- gAgent.sendWalkRun(gAgent.getRunning());
- }
- else if (0 == mJoystickRun)
- {
- // hysteresis - respond NEXT frame
- ++mJoystickRun;
- }
- }
- else
- {
- if (mJoystickRun > 0)
- {
- --mJoystickRun;
- if (0 == mJoystickRun)
- {
- gAgent.clearRunning();
- gAgent.sendWalkRun(gAgent.getRunning());
- }
- }
- }
+ // Decide whether to walk or run by applying a threshold, with slight
+ // hysteresis to avoid oscillating between the two with input spikes.
+ // Analog speed control would be better, but not likely any time soon.
+ if (inc > gSavedSettings.getF32("JoystickRunThreshold"))
+ {
+ if (1 == mJoystickRun)
+ {
+ ++mJoystickRun;
+ gAgent.setRunning();
+ gAgent.sendWalkRun(gAgent.getRunning());
+ }
+ else if (0 == mJoystickRun)
+ {
+ // hysteresis - respond NEXT frame
+ ++mJoystickRun;
+ }
+ }
+ else
+ {
+ if (mJoystickRun > 0)
+ {
+ --mJoystickRun;
+ if (0 == mJoystickRun)
+ {
+ gAgent.clearRunning();
+ gAgent.sendWalkRun(gAgent.getRunning());
+ }
+ }
+ }
}
// -----------------------------------------------------------------------------
@@ -612,706 +612,706 @@ void LLViewerJoystick::agentJump()
// -----------------------------------------------------------------------------
void LLViewerJoystick::agentSlide(F32 inc)
{
- if (inc < 0.f)
- {
- gAgent.moveLeft(1);
- }
- else if (inc > 0.f)
- {
- gAgent.moveLeft(-1);
- }
+ if (inc < 0.f)
+ {
+ gAgent.moveLeft(1);
+ }
+ else if (inc > 0.f)
+ {
+ gAgent.moveLeft(-1);
+ }
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::agentPush(F32 inc)
{
- if (inc < 0.f) // forward
- {
- gAgent.moveAt(1, false);
- }
- else if (inc > 0.f) // backward
- {
- gAgent.moveAt(-1, false);
- }
+ if (inc < 0.f) // forward
+ {
+ gAgent.moveAt(1, false);
+ }
+ else if (inc > 0.f) // backward
+ {
+ gAgent.moveAt(-1, false);
+ }
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::agentFly(F32 inc)
{
- if (inc < 0.f)
- {
- if (! (gAgent.getFlying() ||
- !gAgent.canFly() ||
- gAgent.upGrabbed() ||
- !gSavedSettings.getBOOL("AutomaticFly")) )
- {
- gAgent.setFlying(true);
- }
- gAgent.moveUp(1);
- }
- else if (inc > 0.f)
- {
- // crouch
- gAgent.moveUp(-1);
- }
+ if (inc < 0.f)
+ {
+ if (! (gAgent.getFlying() ||
+ !gAgent.canFly() ||
+ gAgent.upGrabbed() ||
+ !gSavedSettings.getBOOL("AutomaticFly")) )
+ {
+ gAgent.setFlying(true);
+ }
+ gAgent.moveUp(1);
+ }
+ else if (inc > 0.f)
+ {
+ // crouch
+ gAgent.moveUp(-1);
+ }
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::agentPitch(F32 pitch_inc)
{
- if (pitch_inc < 0)
- {
- gAgent.setControlFlags(AGENT_CONTROL_PITCH_POS);
- }
- else if (pitch_inc > 0)
- {
- gAgent.setControlFlags(AGENT_CONTROL_PITCH_NEG);
- }
-
- gAgent.pitch(-pitch_inc);
+ if (pitch_inc < 0)
+ {
+ gAgent.setControlFlags(AGENT_CONTROL_PITCH_POS);
+ }
+ else if (pitch_inc > 0)
+ {
+ gAgent.setControlFlags(AGENT_CONTROL_PITCH_NEG);
+ }
+
+ gAgent.pitch(-pitch_inc);
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::agentYaw(F32 yaw_inc)
-{
- // Cannot steer some vehicles in mouselook if the script grabs the controls
- if (gAgentCamera.cameraMouselook() && !gSavedSettings.getBOOL("JoystickMouselookYaw"))
- {
- gAgent.rotate(-yaw_inc, gAgent.getReferenceUpVector());
- }
- else
- {
- if (yaw_inc < 0)
- {
- gAgent.setControlFlags(AGENT_CONTROL_YAW_POS);
- }
- else if (yaw_inc > 0)
- {
- gAgent.setControlFlags(AGENT_CONTROL_YAW_NEG);
- }
-
- gAgent.yaw(-yaw_inc);
- }
+{
+ // Cannot steer some vehicles in mouselook if the script grabs the controls
+ if (gAgentCamera.cameraMouselook() && !gSavedSettings.getBOOL("JoystickMouselookYaw"))
+ {
+ gAgent.rotate(-yaw_inc, gAgent.getReferenceUpVector());
+ }
+ else
+ {
+ if (yaw_inc < 0)
+ {
+ gAgent.setControlFlags(AGENT_CONTROL_YAW_POS);
+ }
+ else if (yaw_inc > 0)
+ {
+ gAgent.setControlFlags(AGENT_CONTROL_YAW_NEG);
+ }
+
+ gAgent.yaw(-yaw_inc);
+ }
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::resetDeltas(S32 axis[])
{
- for (U32 i = 0; i < 6; i++)
- {
- sLastDelta[i] = -mAxes[axis[i]];
- sDelta[i] = 0.f;
- }
-
- sLastDelta[6] = sDelta[6] = 0.f;
- mResetFlag = false;
+ for (U32 i = 0; i < 6; i++)
+ {
+ sLastDelta[i] = -mAxes[axis[i]];
+ sDelta[i] = 0.f;
+ }
+
+ sLastDelta[6] = sDelta[6] = 0.f;
+ mResetFlag = false;
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::moveObjects(bool reset)
{
- static bool toggle_send_to_sim = false;
-
- if (!gFocusMgr.getAppHasFocus() || mDriverState != JDS_INITIALIZED
- || !gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickBuildEnabled"))
- {
- return;
- }
-
- S32 axis[] =
- {
- gSavedSettings.getS32("JoystickAxis0"),
- gSavedSettings.getS32("JoystickAxis1"),
- gSavedSettings.getS32("JoystickAxis2"),
- gSavedSettings.getS32("JoystickAxis3"),
- gSavedSettings.getS32("JoystickAxis4"),
- gSavedSettings.getS32("JoystickAxis5"),
- };
-
- if (reset || mResetFlag)
- {
- resetDeltas(axis);
- return;
- }
-
- F32 axis_scale[] =
- {
- gSavedSettings.getF32("BuildAxisScale0"),
- gSavedSettings.getF32("BuildAxisScale1"),
- gSavedSettings.getF32("BuildAxisScale2"),
- gSavedSettings.getF32("BuildAxisScale3"),
- gSavedSettings.getF32("BuildAxisScale4"),
- gSavedSettings.getF32("BuildAxisScale5"),
- };
-
- F32 dead_zone[] =
- {
- gSavedSettings.getF32("BuildAxisDeadZone0"),
- gSavedSettings.getF32("BuildAxisDeadZone1"),
- gSavedSettings.getF32("BuildAxisDeadZone2"),
- gSavedSettings.getF32("BuildAxisDeadZone3"),
- gSavedSettings.getF32("BuildAxisDeadZone4"),
- gSavedSettings.getF32("BuildAxisDeadZone5"),
- };
-
- F32 cur_delta[6];
- F32 time = gFrameIntervalSeconds.value();
-
- // avoid making ridicously big movements if there's a big drop in fps
- if (time > .2f)
- {
- time = .2f;
- }
-
- // max feather is 32
- F32 feather = gSavedSettings.getF32("BuildFeathering");
- bool is_zero = true, absolute = gSavedSettings.getBOOL("Cursor3D");
-
- for (U32 i = 0; i < 6; i++)
- {
- cur_delta[i] = -mAxes[axis[i]];
- F32 tmp = cur_delta[i];
- if (absolute)
- {
- cur_delta[i] = cur_delta[i] - sLastDelta[i];
- }
- sLastDelta[i] = tmp;
- is_zero = is_zero && (cur_delta[i] == 0.f);
-
- if (cur_delta[i] > 0)
- {
- cur_delta[i] = llmax(cur_delta[i]-dead_zone[i], 0.f);
- }
- else
- {
- cur_delta[i] = llmin(cur_delta[i]+dead_zone[i], 0.f);
- }
- cur_delta[i] *= axis_scale[i];
-
- if (!absolute)
- {
- cur_delta[i] *= time;
- }
-
- sDelta[i] = sDelta[i] + (cur_delta[i]-sDelta[i])*time*feather;
- }
-
- U32 upd_type = UPD_NONE;
- LLVector3 v;
-
- if (!is_zero)
- {
- // Clear AFK state if moved beyond the deadzone
- if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
- {
- gAgent.clearAFK();
- }
-
- if (sDelta[0] || sDelta[1] || sDelta[2])
- {
- upd_type |= UPD_POSITION;
- v.setVec(sDelta[0], sDelta[1], sDelta[2]);
- }
-
- if (sDelta[3] || sDelta[4] || sDelta[5])
- {
- upd_type |= UPD_ROTATION;
- }
-
- // the selection update could fail, so we won't send
- if (LLSelectMgr::getInstance()->selectionMove(v, sDelta[3],sDelta[4],sDelta[5], upd_type))
- {
- toggle_send_to_sim = true;
- }
- }
- else if (toggle_send_to_sim)
- {
- LLSelectMgr::getInstance()->sendSelectionMove();
- toggle_send_to_sim = false;
- }
+ static bool toggle_send_to_sim = false;
+
+ if (!gFocusMgr.getAppHasFocus() || mDriverState != JDS_INITIALIZED
+ || !gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickBuildEnabled"))
+ {
+ return;
+ }
+
+ S32 axis[] =
+ {
+ gSavedSettings.getS32("JoystickAxis0"),
+ gSavedSettings.getS32("JoystickAxis1"),
+ gSavedSettings.getS32("JoystickAxis2"),
+ gSavedSettings.getS32("JoystickAxis3"),
+ gSavedSettings.getS32("JoystickAxis4"),
+ gSavedSettings.getS32("JoystickAxis5"),
+ };
+
+ if (reset || mResetFlag)
+ {
+ resetDeltas(axis);
+ return;
+ }
+
+ F32 axis_scale[] =
+ {
+ gSavedSettings.getF32("BuildAxisScale0"),
+ gSavedSettings.getF32("BuildAxisScale1"),
+ gSavedSettings.getF32("BuildAxisScale2"),
+ gSavedSettings.getF32("BuildAxisScale3"),
+ gSavedSettings.getF32("BuildAxisScale4"),
+ gSavedSettings.getF32("BuildAxisScale5"),
+ };
+
+ F32 dead_zone[] =
+ {
+ gSavedSettings.getF32("BuildAxisDeadZone0"),
+ gSavedSettings.getF32("BuildAxisDeadZone1"),
+ gSavedSettings.getF32("BuildAxisDeadZone2"),
+ gSavedSettings.getF32("BuildAxisDeadZone3"),
+ gSavedSettings.getF32("BuildAxisDeadZone4"),
+ gSavedSettings.getF32("BuildAxisDeadZone5"),
+ };
+
+ F32 cur_delta[6];
+ F32 time = gFrameIntervalSeconds.value();
+
+ // avoid making ridicously big movements if there's a big drop in fps
+ if (time > .2f)
+ {
+ time = .2f;
+ }
+
+ // max feather is 32
+ F32 feather = gSavedSettings.getF32("BuildFeathering");
+ bool is_zero = true, absolute = gSavedSettings.getBOOL("Cursor3D");
+
+ for (U32 i = 0; i < 6; i++)
+ {
+ cur_delta[i] = -mAxes[axis[i]];
+ F32 tmp = cur_delta[i];
+ if (absolute)
+ {
+ cur_delta[i] = cur_delta[i] - sLastDelta[i];
+ }
+ sLastDelta[i] = tmp;
+ is_zero = is_zero && (cur_delta[i] == 0.f);
+
+ if (cur_delta[i] > 0)
+ {
+ cur_delta[i] = llmax(cur_delta[i]-dead_zone[i], 0.f);
+ }
+ else
+ {
+ cur_delta[i] = llmin(cur_delta[i]+dead_zone[i], 0.f);
+ }
+ cur_delta[i] *= axis_scale[i];
+
+ if (!absolute)
+ {
+ cur_delta[i] *= time;
+ }
+
+ sDelta[i] = sDelta[i] + (cur_delta[i]-sDelta[i])*time*feather;
+ }
+
+ U32 upd_type = UPD_NONE;
+ LLVector3 v;
+
+ if (!is_zero)
+ {
+ // Clear AFK state if moved beyond the deadzone
+ if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
+ {
+ gAgent.clearAFK();
+ }
+
+ if (sDelta[0] || sDelta[1] || sDelta[2])
+ {
+ upd_type |= UPD_POSITION;
+ v.setVec(sDelta[0], sDelta[1], sDelta[2]);
+ }
+
+ if (sDelta[3] || sDelta[4] || sDelta[5])
+ {
+ upd_type |= UPD_ROTATION;
+ }
+
+ // the selection update could fail, so we won't send
+ if (LLSelectMgr::getInstance()->selectionMove(v, sDelta[3],sDelta[4],sDelta[5], upd_type))
+ {
+ toggle_send_to_sim = true;
+ }
+ }
+ else if (toggle_send_to_sim)
+ {
+ LLSelectMgr::getInstance()->sendSelectionMove();
+ toggle_send_to_sim = false;
+ }
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::moveAvatar(bool reset)
{
- if (!gFocusMgr.getAppHasFocus() || mDriverState != JDS_INITIALIZED
- || !gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickAvatarEnabled"))
- {
- return;
- }
-
- S32 axis[] =
- {
- // [1 0 2 4 3 5]
- // [Z X Y RZ RX RY]
- gSavedSettings.getS32("JoystickAxis0"),
- gSavedSettings.getS32("JoystickAxis1"),
- gSavedSettings.getS32("JoystickAxis2"),
- gSavedSettings.getS32("JoystickAxis3"),
- gSavedSettings.getS32("JoystickAxis4"),
- gSavedSettings.getS32("JoystickAxis5")
- };
-
- if (reset || mResetFlag)
- {
- resetDeltas(axis);
- if (reset)
- {
- // Note: moving the agent triggers agent camera mode;
- // don't do this every time we set mResetFlag (e.g. because we gained focus)
- gAgent.moveAt(0, true);
- }
- return;
- }
-
- bool is_zero = true;
- static bool button_held = false;
-
- if (mBtn[1] == 1)
- {
- // If AutomaticFly is enabled, then button1 merely causes a
- // jump (as the up/down axis already controls flying) if on the
- // ground, or cease flight if already flying.
- // If AutomaticFly is disabled, then button1 toggles flying.
- if (gSavedSettings.getBOOL("AutomaticFly"))
- {
- if (!gAgent.getFlying())
- {
- gAgent.moveUp(1);
- }
- else if (!button_held)
- {
- button_held = true;
- gAgent.setFlying(FALSE);
- }
- }
- else if (!button_held)
- {
- button_held = true;
- gAgent.setFlying(!gAgent.getFlying());
- }
-
- is_zero = false;
- }
- else
- {
- button_held = false;
- }
-
- F32 axis_scale[] =
- {
- gSavedSettings.getF32("AvatarAxisScale0"),
- gSavedSettings.getF32("AvatarAxisScale1"),
- gSavedSettings.getF32("AvatarAxisScale2"),
- gSavedSettings.getF32("AvatarAxisScale3"),
- gSavedSettings.getF32("AvatarAxisScale4"),
- gSavedSettings.getF32("AvatarAxisScale5")
- };
-
- F32 dead_zone[] =
- {
- gSavedSettings.getF32("AvatarAxisDeadZone0"),
- gSavedSettings.getF32("AvatarAxisDeadZone1"),
- gSavedSettings.getF32("AvatarAxisDeadZone2"),
- gSavedSettings.getF32("AvatarAxisDeadZone3"),
- gSavedSettings.getF32("AvatarAxisDeadZone4"),
- gSavedSettings.getF32("AvatarAxisDeadZone5")
- };
-
- // time interval in seconds between this frame and the previous
- F32 time = gFrameIntervalSeconds.value();
-
- // avoid making ridicously big movements if there's a big drop in fps
- if (time > .2f)
- {
- time = .2f;
- }
-
- // note: max feather is 32.0
- F32 feather = gSavedSettings.getF32("AvatarFeathering");
-
- F32 cur_delta[6];
- F32 val, dom_mov = 0.f;
- U32 dom_axis = Z_I;
+ if (!gFocusMgr.getAppHasFocus() || mDriverState != JDS_INITIALIZED
+ || !gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickAvatarEnabled"))
+ {
+ return;
+ }
+
+ S32 axis[] =
+ {
+ // [1 0 2 4 3 5]
+ // [Z X Y RZ RX RY]
+ gSavedSettings.getS32("JoystickAxis0"),
+ gSavedSettings.getS32("JoystickAxis1"),
+ gSavedSettings.getS32("JoystickAxis2"),
+ gSavedSettings.getS32("JoystickAxis3"),
+ gSavedSettings.getS32("JoystickAxis4"),
+ gSavedSettings.getS32("JoystickAxis5")
+ };
+
+ if (reset || mResetFlag)
+ {
+ resetDeltas(axis);
+ if (reset)
+ {
+ // Note: moving the agent triggers agent camera mode;
+ // don't do this every time we set mResetFlag (e.g. because we gained focus)
+ gAgent.moveAt(0, true);
+ }
+ return;
+ }
+
+ bool is_zero = true;
+ static bool button_held = false;
+
+ if (mBtn[1] == 1)
+ {
+ // If AutomaticFly is enabled, then button1 merely causes a
+ // jump (as the up/down axis already controls flying) if on the
+ // ground, or cease flight if already flying.
+ // If AutomaticFly is disabled, then button1 toggles flying.
+ if (gSavedSettings.getBOOL("AutomaticFly"))
+ {
+ if (!gAgent.getFlying())
+ {
+ gAgent.moveUp(1);
+ }
+ else if (!button_held)
+ {
+ button_held = true;
+ gAgent.setFlying(FALSE);
+ }
+ }
+ else if (!button_held)
+ {
+ button_held = true;
+ gAgent.setFlying(!gAgent.getFlying());
+ }
+
+ is_zero = false;
+ }
+ else
+ {
+ button_held = false;
+ }
+
+ F32 axis_scale[] =
+ {
+ gSavedSettings.getF32("AvatarAxisScale0"),
+ gSavedSettings.getF32("AvatarAxisScale1"),
+ gSavedSettings.getF32("AvatarAxisScale2"),
+ gSavedSettings.getF32("AvatarAxisScale3"),
+ gSavedSettings.getF32("AvatarAxisScale4"),
+ gSavedSettings.getF32("AvatarAxisScale5")
+ };
+
+ F32 dead_zone[] =
+ {
+ gSavedSettings.getF32("AvatarAxisDeadZone0"),
+ gSavedSettings.getF32("AvatarAxisDeadZone1"),
+ gSavedSettings.getF32("AvatarAxisDeadZone2"),
+ gSavedSettings.getF32("AvatarAxisDeadZone3"),
+ gSavedSettings.getF32("AvatarAxisDeadZone4"),
+ gSavedSettings.getF32("AvatarAxisDeadZone5")
+ };
+
+ // time interval in seconds between this frame and the previous
+ F32 time = gFrameIntervalSeconds.value();
+
+ // avoid making ridicously big movements if there's a big drop in fps
+ if (time > .2f)
+ {
+ time = .2f;
+ }
+
+ // note: max feather is 32.0
+ F32 feather = gSavedSettings.getF32("AvatarFeathering");
+
+ F32 cur_delta[6];
+ F32 val, dom_mov = 0.f;
+ U32 dom_axis = Z_I;
#if LIB_NDOF
bool absolute = (gSavedSettings.getBOOL("Cursor3D") && mNdofDev->absolute);
#else
bool absolute = false;
#endif
- // remove dead zones and determine biggest movement on the joystick
- for (U32 i = 0; i < 6; i++)
- {
- cur_delta[i] = -mAxes[axis[i]];
- if (absolute)
- {
- F32 tmp = cur_delta[i];
- cur_delta[i] = cur_delta[i] - sLastDelta[i];
- sLastDelta[i] = tmp;
- }
-
- if (cur_delta[i] > 0)
- {
- cur_delta[i] = llmax(cur_delta[i]-dead_zone[i], 0.f);
- }
- else
- {
- cur_delta[i] = llmin(cur_delta[i]+dead_zone[i], 0.f);
- }
-
- // we don't care about Roll (RZ) and Z is calculated after the loop
+ // remove dead zones and determine biggest movement on the joystick
+ for (U32 i = 0; i < 6; i++)
+ {
+ cur_delta[i] = -mAxes[axis[i]];
+ if (absolute)
+ {
+ F32 tmp = cur_delta[i];
+ cur_delta[i] = cur_delta[i] - sLastDelta[i];
+ sLastDelta[i] = tmp;
+ }
+
+ if (cur_delta[i] > 0)
+ {
+ cur_delta[i] = llmax(cur_delta[i]-dead_zone[i], 0.f);
+ }
+ else
+ {
+ cur_delta[i] = llmin(cur_delta[i]+dead_zone[i], 0.f);
+ }
+
+ // we don't care about Roll (RZ) and Z is calculated after the loop
if (i != Z_I && i != RZ_I)
- {
- // find out the axis with the biggest joystick motion
- val = fabs(cur_delta[i]);
- if (val > dom_mov)
- {
- dom_axis = i;
- dom_mov = val;
- }
- }
-
- is_zero = is_zero && (cur_delta[i] == 0.f);
- }
-
- if (!is_zero)
- {
- // Clear AFK state if moved beyond the deadzone
- if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
- {
- gAgent.clearAFK();
- }
-
- setCameraNeedsUpdate(true);
- }
-
- // forward|backward movements overrule the real dominant movement if
- // they're bigger than its 20%. This is what you want 'cos moving forward
- // is what you do most. We also added a special (even more lenient) case
- // for RX|RY to allow walking while pitching and turning
- if (fabs(cur_delta[Z_I]) > .2f * dom_mov
- || ((dom_axis == RX_I || dom_axis == RY_I)
- && fabs(cur_delta[Z_I]) > .05f * dom_mov))
- {
- dom_axis = Z_I;
- }
-
- sDelta[X_I] = -cur_delta[X_I] * axis_scale[X_I];
- sDelta[Y_I] = -cur_delta[Y_I] * axis_scale[Y_I];
- sDelta[Z_I] = -cur_delta[Z_I] * axis_scale[Z_I];
- cur_delta[RX_I] *= -axis_scale[RX_I] * mPerfScale;
- cur_delta[RY_I] *= -axis_scale[RY_I] * mPerfScale;
-
- if (!absolute)
- {
- cur_delta[RX_I] *= time;
- cur_delta[RY_I] *= time;
- }
- sDelta[RX_I] += (cur_delta[RX_I] - sDelta[RX_I]) * time * feather;
- sDelta[RY_I] += (cur_delta[RY_I] - sDelta[RY_I]) * time * feather;
-
- handleRun((F32) sqrt(sDelta[Z_I]*sDelta[Z_I] + sDelta[X_I]*sDelta[X_I]));
-
- // Allow forward/backward movement some priority
- if (dom_axis == Z_I)
- {
- agentPush(sDelta[Z_I]); // forward/back
-
- if (fabs(sDelta[X_I]) > .1f)
- {
- agentSlide(sDelta[X_I]); // move sideways
- }
-
- if (fabs(sDelta[Y_I]) > .1f)
- {
- agentFly(sDelta[Y_I]); // up/down & crouch
- }
-
- // too many rotations during walking can be confusing, so apply
- // the deadzones one more time (quick & dirty), at 50%|30% power
- F32 eff_rx = .3f * dead_zone[RX_I];
- F32 eff_ry = .3f * dead_zone[RY_I];
-
- if (sDelta[RX_I] > 0)
- {
- eff_rx = llmax(sDelta[RX_I] - eff_rx, 0.f);
- }
- else
- {
- eff_rx = llmin(sDelta[RX_I] + eff_rx, 0.f);
- }
-
- if (sDelta[RY_I] > 0)
- {
- eff_ry = llmax(sDelta[RY_I] - eff_ry, 0.f);
- }
- else
- {
- eff_ry = llmin(sDelta[RY_I] + eff_ry, 0.f);
- }
-
-
- if (fabs(eff_rx) > 0.f || fabs(eff_ry) > 0.f)
- {
- if (gAgent.getFlying())
- {
- agentPitch(eff_rx);
- agentYaw(eff_ry);
- }
- else
- {
- agentPitch(eff_rx);
- agentYaw(2.f * eff_ry);
- }
- }
- }
- else
- {
- agentSlide(sDelta[X_I]); // move sideways
- agentFly(sDelta[Y_I]); // up/down & crouch
- agentPush(sDelta[Z_I]); // forward/back
- agentPitch(sDelta[RX_I]); // pitch
- agentYaw(sDelta[RY_I]); // turn
- }
+ {
+ // find out the axis with the biggest joystick motion
+ val = fabs(cur_delta[i]);
+ if (val > dom_mov)
+ {
+ dom_axis = i;
+ dom_mov = val;
+ }
+ }
+
+ is_zero = is_zero && (cur_delta[i] == 0.f);
+ }
+
+ if (!is_zero)
+ {
+ // Clear AFK state if moved beyond the deadzone
+ if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
+ {
+ gAgent.clearAFK();
+ }
+
+ setCameraNeedsUpdate(true);
+ }
+
+ // forward|backward movements overrule the real dominant movement if
+ // they're bigger than its 20%. This is what you want 'cos moving forward
+ // is what you do most. We also added a special (even more lenient) case
+ // for RX|RY to allow walking while pitching and turning
+ if (fabs(cur_delta[Z_I]) > .2f * dom_mov
+ || ((dom_axis == RX_I || dom_axis == RY_I)
+ && fabs(cur_delta[Z_I]) > .05f * dom_mov))
+ {
+ dom_axis = Z_I;
+ }
+
+ sDelta[X_I] = -cur_delta[X_I] * axis_scale[X_I];
+ sDelta[Y_I] = -cur_delta[Y_I] * axis_scale[Y_I];
+ sDelta[Z_I] = -cur_delta[Z_I] * axis_scale[Z_I];
+ cur_delta[RX_I] *= -axis_scale[RX_I] * mPerfScale;
+ cur_delta[RY_I] *= -axis_scale[RY_I] * mPerfScale;
+
+ if (!absolute)
+ {
+ cur_delta[RX_I] *= time;
+ cur_delta[RY_I] *= time;
+ }
+ sDelta[RX_I] += (cur_delta[RX_I] - sDelta[RX_I]) * time * feather;
+ sDelta[RY_I] += (cur_delta[RY_I] - sDelta[RY_I]) * time * feather;
+
+ handleRun((F32) sqrt(sDelta[Z_I]*sDelta[Z_I] + sDelta[X_I]*sDelta[X_I]));
+
+ // Allow forward/backward movement some priority
+ if (dom_axis == Z_I)
+ {
+ agentPush(sDelta[Z_I]); // forward/back
+
+ if (fabs(sDelta[X_I]) > .1f)
+ {
+ agentSlide(sDelta[X_I]); // move sideways
+ }
+
+ if (fabs(sDelta[Y_I]) > .1f)
+ {
+ agentFly(sDelta[Y_I]); // up/down & crouch
+ }
+
+ // too many rotations during walking can be confusing, so apply
+ // the deadzones one more time (quick & dirty), at 50%|30% power
+ F32 eff_rx = .3f * dead_zone[RX_I];
+ F32 eff_ry = .3f * dead_zone[RY_I];
+
+ if (sDelta[RX_I] > 0)
+ {
+ eff_rx = llmax(sDelta[RX_I] - eff_rx, 0.f);
+ }
+ else
+ {
+ eff_rx = llmin(sDelta[RX_I] + eff_rx, 0.f);
+ }
+
+ if (sDelta[RY_I] > 0)
+ {
+ eff_ry = llmax(sDelta[RY_I] - eff_ry, 0.f);
+ }
+ else
+ {
+ eff_ry = llmin(sDelta[RY_I] + eff_ry, 0.f);
+ }
+
+
+ if (fabs(eff_rx) > 0.f || fabs(eff_ry) > 0.f)
+ {
+ if (gAgent.getFlying())
+ {
+ agentPitch(eff_rx);
+ agentYaw(eff_ry);
+ }
+ else
+ {
+ agentPitch(eff_rx);
+ agentYaw(2.f * eff_ry);
+ }
+ }
+ }
+ else
+ {
+ agentSlide(sDelta[X_I]); // move sideways
+ agentFly(sDelta[Y_I]); // up/down & crouch
+ agentPush(sDelta[Z_I]); // forward/back
+ agentPitch(sDelta[RX_I]); // pitch
+ agentYaw(sDelta[RY_I]); // turn
+ }
}
// -----------------------------------------------------------------------------
void LLViewerJoystick::moveFlycam(bool reset)
{
- static LLQuaternion sFlycamRotation;
- static LLVector3 sFlycamPosition;
- static F32 sFlycamZoom;
-
- if (!gFocusMgr.getAppHasFocus() || mDriverState != JDS_INITIALIZED
- || !gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickFlycamEnabled"))
- {
- return;
- }
-
- S32 axis[] =
- {
- gSavedSettings.getS32("JoystickAxis0"),
- gSavedSettings.getS32("JoystickAxis1"),
- gSavedSettings.getS32("JoystickAxis2"),
- gSavedSettings.getS32("JoystickAxis3"),
- gSavedSettings.getS32("JoystickAxis4"),
- gSavedSettings.getS32("JoystickAxis5"),
- gSavedSettings.getS32("JoystickAxis6")
- };
-
- bool in_build_mode = LLToolMgr::getInstance()->inBuildMode();
- if (reset || mResetFlag)
- {
- sFlycamPosition = LLViewerCamera::getInstance()->getOrigin();
- sFlycamRotation = LLViewerCamera::getInstance()->getQuaternion();
- sFlycamZoom = LLViewerCamera::getInstance()->getView();
-
- resetDeltas(axis);
-
- return;
- }
-
- F32 axis_scale[] =
- {
- gSavedSettings.getF32("FlycamAxisScale0"),
- gSavedSettings.getF32("FlycamAxisScale1"),
- gSavedSettings.getF32("FlycamAxisScale2"),
- gSavedSettings.getF32("FlycamAxisScale3"),
- gSavedSettings.getF32("FlycamAxisScale4"),
- gSavedSettings.getF32("FlycamAxisScale5"),
- gSavedSettings.getF32("FlycamAxisScale6")
- };
-
- F32 dead_zone[] =
- {
- gSavedSettings.getF32("FlycamAxisDeadZone0"),
- gSavedSettings.getF32("FlycamAxisDeadZone1"),
- gSavedSettings.getF32("FlycamAxisDeadZone2"),
- gSavedSettings.getF32("FlycamAxisDeadZone3"),
- gSavedSettings.getF32("FlycamAxisDeadZone4"),
- gSavedSettings.getF32("FlycamAxisDeadZone5"),
- gSavedSettings.getF32("FlycamAxisDeadZone6")
- };
-
- F32 time = gFrameIntervalSeconds.value();
-
- // avoid making ridiculously big movements if there's a big drop in fps
- if (time > .2f)
- {
- time = .2f;
- }
-
- F32 cur_delta[7];
- F32 feather = gSavedSettings.getF32("FlycamFeathering");
- bool absolute = gSavedSettings.getBOOL("Cursor3D");
- bool is_zero = true;
-
- for (U32 i = 0; i < 7; i++)
- {
- cur_delta[i] = -getJoystickAxis(axis[i]);
-
-
- F32 tmp = cur_delta[i];
- if (absolute)
- {
- cur_delta[i] = cur_delta[i] - sLastDelta[i];
- }
- sLastDelta[i] = tmp;
-
- if (cur_delta[i] > 0)
- {
- cur_delta[i] = llmax(cur_delta[i]-dead_zone[i], 0.f);
- }
- else
- {
- cur_delta[i] = llmin(cur_delta[i]+dead_zone[i], 0.f);
- }
-
- // We may want to scale camera movements up or down in build mode.
- // NOTE: this needs to remain after the deadzone calculation, otherwise
- // we have issues with flycam "jumping" when the build dialog is opened/closed -Nyx
- if (in_build_mode)
- {
- if (i == X_I || i == Y_I || i == Z_I)
- {
- static LLCachedControl<F32> build_mode_scale(gSavedSettings,"FlycamBuildModeScale", 1.0);
- cur_delta[i] *= build_mode_scale;
- }
- }
-
- cur_delta[i] *= axis_scale[i];
-
- if (!absolute)
- {
- cur_delta[i] *= time;
- }
-
- sDelta[i] = sDelta[i] + (cur_delta[i]-sDelta[i])*time*feather;
-
- is_zero = is_zero && (cur_delta[i] == 0.f);
-
- }
-
- // Clear AFK state if moved beyond the deadzone
- if (!is_zero && gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
- {
- gAgent.clearAFK();
- }
-
- sFlycamPosition += LLVector3(sDelta) * sFlycamRotation;
-
- LLMatrix3 rot_mat(sDelta[3], sDelta[4], sDelta[5]);
- sFlycamRotation = LLQuaternion(rot_mat)*sFlycamRotation;
-
- if (gSavedSettings.getBOOL("AutoLeveling"))
- {
- LLMatrix3 level(sFlycamRotation);
-
- LLVector3 x = LLVector3(level.mMatrix[0]);
- LLVector3 y = LLVector3(level.mMatrix[1]);
- LLVector3 z = LLVector3(level.mMatrix[2]);
-
- y.mV[2] = 0.f;
- y.normVec();
-
- level.setRows(x,y,z);
- level.orthogonalize();
-
- LLQuaternion quat(level);
- sFlycamRotation = nlerp(llmin(feather*time,1.f), sFlycamRotation, quat);
- }
-
- if (gSavedSettings.getBOOL("ZoomDirect"))
- {
- sFlycamZoom = sLastDelta[6]*axis_scale[6]+dead_zone[6];
- }
- else
- {
- sFlycamZoom += sDelta[6];
- }
-
- LLMatrix3 mat(sFlycamRotation);
-
- LLViewerCamera::getInstance()->setView(sFlycamZoom);
- LLViewerCamera::getInstance()->setOrigin(sFlycamPosition);
- LLViewerCamera::getInstance()->mXAxis = LLVector3(mat.mMatrix[0]);
- LLViewerCamera::getInstance()->mYAxis = LLVector3(mat.mMatrix[1]);
- LLViewerCamera::getInstance()->mZAxis = LLVector3(mat.mMatrix[2]);
+ static LLQuaternion sFlycamRotation;
+ static LLVector3 sFlycamPosition;
+ static F32 sFlycamZoom;
+
+ if (!gFocusMgr.getAppHasFocus() || mDriverState != JDS_INITIALIZED
+ || !gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickFlycamEnabled"))
+ {
+ return;
+ }
+
+ S32 axis[] =
+ {
+ gSavedSettings.getS32("JoystickAxis0"),
+ gSavedSettings.getS32("JoystickAxis1"),
+ gSavedSettings.getS32("JoystickAxis2"),
+ gSavedSettings.getS32("JoystickAxis3"),
+ gSavedSettings.getS32("JoystickAxis4"),
+ gSavedSettings.getS32("JoystickAxis5"),
+ gSavedSettings.getS32("JoystickAxis6")
+ };
+
+ bool in_build_mode = LLToolMgr::getInstance()->inBuildMode();
+ if (reset || mResetFlag)
+ {
+ sFlycamPosition = LLViewerCamera::getInstance()->getOrigin();
+ sFlycamRotation = LLViewerCamera::getInstance()->getQuaternion();
+ sFlycamZoom = LLViewerCamera::getInstance()->getView();
+
+ resetDeltas(axis);
+
+ return;
+ }
+
+ F32 axis_scale[] =
+ {
+ gSavedSettings.getF32("FlycamAxisScale0"),
+ gSavedSettings.getF32("FlycamAxisScale1"),
+ gSavedSettings.getF32("FlycamAxisScale2"),
+ gSavedSettings.getF32("FlycamAxisScale3"),
+ gSavedSettings.getF32("FlycamAxisScale4"),
+ gSavedSettings.getF32("FlycamAxisScale5"),
+ gSavedSettings.getF32("FlycamAxisScale6")
+ };
+
+ F32 dead_zone[] =
+ {
+ gSavedSettings.getF32("FlycamAxisDeadZone0"),
+ gSavedSettings.getF32("FlycamAxisDeadZone1"),
+ gSavedSettings.getF32("FlycamAxisDeadZone2"),
+ gSavedSettings.getF32("FlycamAxisDeadZone3"),
+ gSavedSettings.getF32("FlycamAxisDeadZone4"),
+ gSavedSettings.getF32("FlycamAxisDeadZone5"),
+ gSavedSettings.getF32("FlycamAxisDeadZone6")
+ };
+
+ F32 time = gFrameIntervalSeconds.value();
+
+ // avoid making ridiculously big movements if there's a big drop in fps
+ if (time > .2f)
+ {
+ time = .2f;
+ }
+
+ F32 cur_delta[7];
+ F32 feather = gSavedSettings.getF32("FlycamFeathering");
+ bool absolute = gSavedSettings.getBOOL("Cursor3D");
+ bool is_zero = true;
+
+ for (U32 i = 0; i < 7; i++)
+ {
+ cur_delta[i] = -getJoystickAxis(axis[i]);
+
+
+ F32 tmp = cur_delta[i];
+ if (absolute)
+ {
+ cur_delta[i] = cur_delta[i] - sLastDelta[i];
+ }
+ sLastDelta[i] = tmp;
+
+ if (cur_delta[i] > 0)
+ {
+ cur_delta[i] = llmax(cur_delta[i]-dead_zone[i], 0.f);
+ }
+ else
+ {
+ cur_delta[i] = llmin(cur_delta[i]+dead_zone[i], 0.f);
+ }
+
+ // We may want to scale camera movements up or down in build mode.
+ // NOTE: this needs to remain after the deadzone calculation, otherwise
+ // we have issues with flycam "jumping" when the build dialog is opened/closed -Nyx
+ if (in_build_mode)
+ {
+ if (i == X_I || i == Y_I || i == Z_I)
+ {
+ static LLCachedControl<F32> build_mode_scale(gSavedSettings,"FlycamBuildModeScale", 1.0);
+ cur_delta[i] *= build_mode_scale;
+ }
+ }
+
+ cur_delta[i] *= axis_scale[i];
+
+ if (!absolute)
+ {
+ cur_delta[i] *= time;
+ }
+
+ sDelta[i] = sDelta[i] + (cur_delta[i]-sDelta[i])*time*feather;
+
+ is_zero = is_zero && (cur_delta[i] == 0.f);
+
+ }
+
+ // Clear AFK state if moved beyond the deadzone
+ if (!is_zero && gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
+ {
+ gAgent.clearAFK();
+ }
+
+ sFlycamPosition += LLVector3(sDelta) * sFlycamRotation;
+
+ LLMatrix3 rot_mat(sDelta[3], sDelta[4], sDelta[5]);
+ sFlycamRotation = LLQuaternion(rot_mat)*sFlycamRotation;
+
+ if (gSavedSettings.getBOOL("AutoLeveling"))
+ {
+ LLMatrix3 level(sFlycamRotation);
+
+ LLVector3 x = LLVector3(level.mMatrix[0]);
+ LLVector3 y = LLVector3(level.mMatrix[1]);
+ LLVector3 z = LLVector3(level.mMatrix[2]);
+
+ y.mV[2] = 0.f;
+ y.normVec();
+
+ level.setRows(x,y,z);
+ level.orthogonalize();
+
+ LLQuaternion quat(level);
+ sFlycamRotation = nlerp(llmin(feather*time,1.f), sFlycamRotation, quat);
+ }
+
+ if (gSavedSettings.getBOOL("ZoomDirect"))
+ {
+ sFlycamZoom = sLastDelta[6]*axis_scale[6]+dead_zone[6];
+ }
+ else
+ {
+ sFlycamZoom += sDelta[6];
+ }
+
+ LLMatrix3 mat(sFlycamRotation);
+
+ LLViewerCamera::getInstance()->setView(sFlycamZoom);
+ LLViewerCamera::getInstance()->setOrigin(sFlycamPosition);
+ LLViewerCamera::getInstance()->mXAxis = LLVector3(mat.mMatrix[0]);
+ LLViewerCamera::getInstance()->mYAxis = LLVector3(mat.mMatrix[1]);
+ LLViewerCamera::getInstance()->mZAxis = LLVector3(mat.mMatrix[2]);
}
// -----------------------------------------------------------------------------
bool LLViewerJoystick::toggleFlycam()
{
- if (!gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickFlycamEnabled"))
- {
- mOverrideCamera = false;
- return false;
- }
-
- if (!mOverrideCamera)
- {
- gAgentCamera.changeCameraToDefault();
- }
-
- if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
- {
- gAgent.clearAFK();
- }
-
- mOverrideCamera = !mOverrideCamera;
- if (mOverrideCamera)
- {
- moveFlycam(true);
-
- }
- else
- {
- // Exiting from the flycam mode: since we are going to keep the flycam POV for
- // the main camera until the avatar moves, we need to track this situation.
- setCameraNeedsUpdate(false);
- setNeedsReset(true);
- }
- return true;
+ if (!gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickFlycamEnabled"))
+ {
+ mOverrideCamera = false;
+ return false;
+ }
+
+ if (!mOverrideCamera)
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+
+ if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
+ {
+ gAgent.clearAFK();
+ }
+
+ mOverrideCamera = !mOverrideCamera;
+ if (mOverrideCamera)
+ {
+ moveFlycam(true);
+
+ }
+ else
+ {
+ // Exiting from the flycam mode: since we are going to keep the flycam POV for
+ // the main camera until the avatar moves, we need to track this situation.
+ setCameraNeedsUpdate(false);
+ setNeedsReset(true);
+ }
+ return true;
}
void LLViewerJoystick::scanJoystick()
{
- if (mDriverState != JDS_INITIALIZED || !gSavedSettings.getBOOL("JoystickEnabled"))
- {
- return;
- }
+ if (mDriverState != JDS_INITIALIZED || !gSavedSettings.getBOOL("JoystickEnabled"))
+ {
+ return;
+ }
#if LL_WINDOWS
- // On windows, the flycam is updated syncronously with a timer, so there is
- // no need to update the status of the joystick here.
- if (!mOverrideCamera)
+ // On windows, the flycam is updated syncronously with a timer, so there is
+ // no need to update the status of the joystick here.
+ if (!mOverrideCamera)
#endif
- updateStatus();
-
- // App focus check Needs to happen AFTER updateStatus in case the joystick
- // is not centred when the app loses focus.
- if (!gFocusMgr.getAppHasFocus())
- {
- return;
- }
-
- static long toggle_flycam = 0;
-
- if (mBtn[0] == 1)
- {
- if (mBtn[0] != toggle_flycam)
- {
- toggle_flycam = toggleFlycam() ? 1 : 0;
- }
- }
- else
- {
- toggle_flycam = 0;
- }
-
- if (!mOverrideCamera && !(LLToolMgr::getInstance()->inBuildMode() && gSavedSettings.getBOOL("JoystickBuildEnabled")))
- {
- moveAvatar();
- }
+ updateStatus();
+
+ // App focus check Needs to happen AFTER updateStatus in case the joystick
+ // is not centred when the app loses focus.
+ if (!gFocusMgr.getAppHasFocus())
+ {
+ return;
+ }
+
+ static long toggle_flycam = 0;
+
+ if (mBtn[0] == 1)
+ {
+ if (mBtn[0] != toggle_flycam)
+ {
+ toggle_flycam = toggleFlycam() ? 1 : 0;
+ }
+ }
+ else
+ {
+ toggle_flycam = 0;
+ }
+
+ if (!mOverrideCamera && !(LLToolMgr::getInstance()->inBuildMode() && gSavedSettings.getBOOL("JoystickBuildEnabled")))
+ {
+ moveAvatar();
+ }
}
// -----------------------------------------------------------------------------
@@ -1385,26 +1385,26 @@ void LLViewerJoystick::loadDeviceIdFromSettings()
// -----------------------------------------------------------------------------
std::string LLViewerJoystick::getDescription()
{
- std::string res;
+ std::string res;
#if LIB_NDOF
- if (mDriverState == JDS_INITIALIZED && mNdofDev)
- {
- res = ll_safe_string(mNdofDev->product);
- }
+ if (mDriverState == JDS_INITIALIZED && mNdofDev)
+ {
+ res = ll_safe_string(mNdofDev->product);
+ }
#endif
- return res;
+ return res;
}
bool LLViewerJoystick::isLikeSpaceNavigator() const
{
#if LIB_NDOF
- return (isJoystickInitialized()
- && (strncmp(mNdofDev->product, "SpaceNavigator", 14) == 0
- || strncmp(mNdofDev->product, "SpaceExplorer", 13) == 0
- || strncmp(mNdofDev->product, "SpaceTraveler", 13) == 0
- || strncmp(mNdofDev->product, "SpacePilot", 10) == 0));
+ return (isJoystickInitialized()
+ && (strncmp(mNdofDev->product, "SpaceNavigator", 14) == 0
+ || strncmp(mNdofDev->product, "SpaceExplorer", 13) == 0
+ || strncmp(mNdofDev->product, "SpaceTraveler", 13) == 0
+ || strncmp(mNdofDev->product, "SpacePilot", 10) == 0));
#else
- return false;
+ return false;
#endif
}
@@ -1412,72 +1412,72 @@ bool LLViewerJoystick::isLikeSpaceNavigator() const
void LLViewerJoystick::setSNDefaults()
{
#if LL_DARWIN || LL_LINUX
- const float platformScale = 20.f;
- const float platformScaleAvXZ = 1.f;
- // The SpaceNavigator doesn't act as a 3D cursor on OS X / Linux.
- const bool is_3d_cursor = false;
+ const float platformScale = 20.f;
+ const float platformScaleAvXZ = 1.f;
+ // The SpaceNavigator doesn't act as a 3D cursor on OS X / Linux.
+ const bool is_3d_cursor = false;
#else
- const float platformScale = 1.f;
- const float platformScaleAvXZ = 2.f;
- const bool is_3d_cursor = true;
+ const float platformScale = 1.f;
+ const float platformScaleAvXZ = 2.f;
+ const bool is_3d_cursor = true;
#endif
- //gViewerWindow->alertXml("CacheWillClear");
- LL_INFOS("Joystick") << "restoring SpaceNavigator defaults..." << LL_ENDL;
-
- gSavedSettings.setS32("JoystickAxis0", 1); // z (at)
- gSavedSettings.setS32("JoystickAxis1", 0); // x (slide)
- gSavedSettings.setS32("JoystickAxis2", 2); // y (up)
- gSavedSettings.setS32("JoystickAxis3", 4); // pitch
- gSavedSettings.setS32("JoystickAxis4", 3); // roll
- gSavedSettings.setS32("JoystickAxis5", 5); // yaw
- gSavedSettings.setS32("JoystickAxis6", -1);
-
- gSavedSettings.setBOOL("Cursor3D", is_3d_cursor);
- gSavedSettings.setBOOL("AutoLeveling", true);
- gSavedSettings.setBOOL("ZoomDirect", false);
-
- gSavedSettings.setF32("AvatarAxisScale0", 1.f * platformScaleAvXZ);
- gSavedSettings.setF32("AvatarAxisScale1", 1.f * platformScaleAvXZ);
- gSavedSettings.setF32("AvatarAxisScale2", 1.f);
- gSavedSettings.setF32("AvatarAxisScale4", .1f * platformScale);
- gSavedSettings.setF32("AvatarAxisScale5", .1f * platformScale);
- gSavedSettings.setF32("AvatarAxisScale3", 0.f * platformScale);
- gSavedSettings.setF32("BuildAxisScale1", .3f * platformScale);
- gSavedSettings.setF32("BuildAxisScale2", .3f * platformScale);
- gSavedSettings.setF32("BuildAxisScale0", .3f * platformScale);
- gSavedSettings.setF32("BuildAxisScale4", .3f * platformScale);
- gSavedSettings.setF32("BuildAxisScale5", .3f * platformScale);
- gSavedSettings.setF32("BuildAxisScale3", .3f * platformScale);
- gSavedSettings.setF32("FlycamAxisScale1", 2.f * platformScale);
- gSavedSettings.setF32("FlycamAxisScale2", 2.f * platformScale);
- gSavedSettings.setF32("FlycamAxisScale0", 2.1f * platformScale);
- gSavedSettings.setF32("FlycamAxisScale4", .1f * platformScale);
- gSavedSettings.setF32("FlycamAxisScale5", .15f * platformScale);
- gSavedSettings.setF32("FlycamAxisScale3", 0.f * platformScale);
- gSavedSettings.setF32("FlycamAxisScale6", 0.f * platformScale);
-
- gSavedSettings.setF32("AvatarAxisDeadZone0", .1f);
- gSavedSettings.setF32("AvatarAxisDeadZone1", .1f);
- gSavedSettings.setF32("AvatarAxisDeadZone2", .1f);
- gSavedSettings.setF32("AvatarAxisDeadZone3", 1.f);
- gSavedSettings.setF32("AvatarAxisDeadZone4", .02f);
- gSavedSettings.setF32("AvatarAxisDeadZone5", .01f);
- gSavedSettings.setF32("BuildAxisDeadZone0", .01f);
- gSavedSettings.setF32("BuildAxisDeadZone1", .01f);
- gSavedSettings.setF32("BuildAxisDeadZone2", .01f);
- gSavedSettings.setF32("BuildAxisDeadZone3", .01f);
- gSavedSettings.setF32("BuildAxisDeadZone4", .01f);
- gSavedSettings.setF32("BuildAxisDeadZone5", .01f);
- gSavedSettings.setF32("FlycamAxisDeadZone0", .01f);
- gSavedSettings.setF32("FlycamAxisDeadZone1", .01f);
- gSavedSettings.setF32("FlycamAxisDeadZone2", .01f);
- gSavedSettings.setF32("FlycamAxisDeadZone3", .01f);
- gSavedSettings.setF32("FlycamAxisDeadZone4", .01f);
- gSavedSettings.setF32("FlycamAxisDeadZone5", .01f);
- gSavedSettings.setF32("FlycamAxisDeadZone6", 1.f);
-
- gSavedSettings.setF32("AvatarFeathering", 6.f);
- gSavedSettings.setF32("BuildFeathering", 12.f);
- gSavedSettings.setF32("FlycamFeathering", 5.f);
+ //gViewerWindow->alertXml("CacheWillClear");
+ LL_INFOS("Joystick") << "restoring SpaceNavigator defaults..." << LL_ENDL;
+
+ gSavedSettings.setS32("JoystickAxis0", 1); // z (at)
+ gSavedSettings.setS32("JoystickAxis1", 0); // x (slide)
+ gSavedSettings.setS32("JoystickAxis2", 2); // y (up)
+ gSavedSettings.setS32("JoystickAxis3", 4); // pitch
+ gSavedSettings.setS32("JoystickAxis4", 3); // roll
+ gSavedSettings.setS32("JoystickAxis5", 5); // yaw
+ gSavedSettings.setS32("JoystickAxis6", -1);
+
+ gSavedSettings.setBOOL("Cursor3D", is_3d_cursor);
+ gSavedSettings.setBOOL("AutoLeveling", true);
+ gSavedSettings.setBOOL("ZoomDirect", false);
+
+ gSavedSettings.setF32("AvatarAxisScale0", 1.f * platformScaleAvXZ);
+ gSavedSettings.setF32("AvatarAxisScale1", 1.f * platformScaleAvXZ);
+ gSavedSettings.setF32("AvatarAxisScale2", 1.f);
+ gSavedSettings.setF32("AvatarAxisScale4", .1f * platformScale);
+ gSavedSettings.setF32("AvatarAxisScale5", .1f * platformScale);
+ gSavedSettings.setF32("AvatarAxisScale3", 0.f * platformScale);
+ gSavedSettings.setF32("BuildAxisScale1", .3f * platformScale);
+ gSavedSettings.setF32("BuildAxisScale2", .3f * platformScale);
+ gSavedSettings.setF32("BuildAxisScale0", .3f * platformScale);
+ gSavedSettings.setF32("BuildAxisScale4", .3f * platformScale);
+ gSavedSettings.setF32("BuildAxisScale5", .3f * platformScale);
+ gSavedSettings.setF32("BuildAxisScale3", .3f * platformScale);
+ gSavedSettings.setF32("FlycamAxisScale1", 2.f * platformScale);
+ gSavedSettings.setF32("FlycamAxisScale2", 2.f * platformScale);
+ gSavedSettings.setF32("FlycamAxisScale0", 2.1f * platformScale);
+ gSavedSettings.setF32("FlycamAxisScale4", .1f * platformScale);
+ gSavedSettings.setF32("FlycamAxisScale5", .15f * platformScale);
+ gSavedSettings.setF32("FlycamAxisScale3", 0.f * platformScale);
+ gSavedSettings.setF32("FlycamAxisScale6", 0.f * platformScale);
+
+ gSavedSettings.setF32("AvatarAxisDeadZone0", .1f);
+ gSavedSettings.setF32("AvatarAxisDeadZone1", .1f);
+ gSavedSettings.setF32("AvatarAxisDeadZone2", .1f);
+ gSavedSettings.setF32("AvatarAxisDeadZone3", 1.f);
+ gSavedSettings.setF32("AvatarAxisDeadZone4", .02f);
+ gSavedSettings.setF32("AvatarAxisDeadZone5", .01f);
+ gSavedSettings.setF32("BuildAxisDeadZone0", .01f);
+ gSavedSettings.setF32("BuildAxisDeadZone1", .01f);
+ gSavedSettings.setF32("BuildAxisDeadZone2", .01f);
+ gSavedSettings.setF32("BuildAxisDeadZone3", .01f);
+ gSavedSettings.setF32("BuildAxisDeadZone4", .01f);
+ gSavedSettings.setF32("BuildAxisDeadZone5", .01f);
+ gSavedSettings.setF32("FlycamAxisDeadZone0", .01f);
+ gSavedSettings.setF32("FlycamAxisDeadZone1", .01f);
+ gSavedSettings.setF32("FlycamAxisDeadZone2", .01f);
+ gSavedSettings.setF32("FlycamAxisDeadZone3", .01f);
+ gSavedSettings.setF32("FlycamAxisDeadZone4", .01f);
+ gSavedSettings.setF32("FlycamAxisDeadZone5", .01f);
+ gSavedSettings.setF32("FlycamAxisDeadZone6", 1.f);
+
+ gSavedSettings.setF32("AvatarFeathering", 6.f);
+ gSavedSettings.setF32("BuildFeathering", 12.f);
+ gSavedSettings.setF32("FlycamFeathering", 5.f);
}
diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h
index 3b4f898710..47da263150 100644
--- a/indra/newview/llviewerjoystick.h
+++ b/indra/newview/llviewerjoystick.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerjoystick.h
* @brief Viewer joystick / NDOF device functionality.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,81 +32,81 @@
#if LIB_NDOF
#include "ndofdev_external.h"
#else
-#define NDOF_Device void
+#define NDOF_Device void
#define NDOF_HotPlugResult S32
#endif
typedef enum e_joystick_driver_state
{
- JDS_UNINITIALIZED,
- JDS_INITIALIZED,
- JDS_INITIALIZING
+ JDS_UNINITIALIZED,
+ JDS_INITIALIZED,
+ JDS_INITIALIZING
} EJoystickDriverState;
class LLViewerJoystick : public LLSingleton<LLViewerJoystick>
{
- LLSINGLETON(LLViewerJoystick);
- virtual ~LLViewerJoystick();
+ LLSINGLETON(LLViewerJoystick);
+ virtual ~LLViewerJoystick();
LOG_CLASS(LLViewerJoystick);
public:
- void init(bool autoenable);
- void initDevice(LLSD &guid);
- void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/);
- void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid);
- void terminate();
+ void init(bool autoenable);
+ void initDevice(LLSD &guid);
+ void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/);
+ void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid);
+ void terminate();
- void updateStatus();
- void scanJoystick();
- void moveObjects(bool reset = false);
- void moveAvatar(bool reset = false);
- void moveFlycam(bool reset = false);
- F32 getJoystickAxis(U32 axis) const;
- U32 getJoystickButton(U32 button) const;
- bool isJoystickInitialized() const {return (mDriverState==JDS_INITIALIZED);}
- bool isLikeSpaceNavigator() const;
- void setNeedsReset(bool reset = true) { mResetFlag = reset; }
- void setCameraNeedsUpdate(bool b) { mCameraUpdated = b; }
- bool getCameraNeedsUpdate() const { return mCameraUpdated; }
- bool getOverrideCamera() { return mOverrideCamera; }
- void setOverrideCamera(bool val);
- bool toggleFlycam();
- void setSNDefaults();
- bool isDeviceUUIDSet();
- LLSD getDeviceUUID(); //unconverted, OS dependent value wrapped into LLSD, for comparison/search
- std::string getDeviceUUIDString(); // converted readable value for settings
- std::string getDescription();
+ void updateStatus();
+ void scanJoystick();
+ void moveObjects(bool reset = false);
+ void moveAvatar(bool reset = false);
+ void moveFlycam(bool reset = false);
+ F32 getJoystickAxis(U32 axis) const;
+ U32 getJoystickButton(U32 button) const;
+ bool isJoystickInitialized() const {return (mDriverState==JDS_INITIALIZED);}
+ bool isLikeSpaceNavigator() const;
+ void setNeedsReset(bool reset = true) { mResetFlag = reset; }
+ void setCameraNeedsUpdate(bool b) { mCameraUpdated = b; }
+ bool getCameraNeedsUpdate() const { return mCameraUpdated; }
+ bool getOverrideCamera() { return mOverrideCamera; }
+ void setOverrideCamera(bool val);
+ bool toggleFlycam();
+ void setSNDefaults();
+ bool isDeviceUUIDSet();
+ LLSD getDeviceUUID(); //unconverted, OS dependent value wrapped into LLSD, for comparison/search
+ std::string getDeviceUUIDString(); // converted readable value for settings
+ std::string getDescription();
protected:
- void updateEnabled(bool autoenable);
- void handleRun(F32 inc);
- void agentSlide(F32 inc);
- void agentPush(F32 inc);
- void agentFly(F32 inc);
- void agentPitch(F32 pitch_inc);
- void agentYaw(F32 yaw_inc);
- void agentJump();
- void resetDeltas(S32 axis[]);
- void loadDeviceIdFromSettings();
+ void updateEnabled(bool autoenable);
+ void handleRun(F32 inc);
+ void agentSlide(F32 inc);
+ void agentPush(F32 inc);
+ void agentFly(F32 inc);
+ void agentPitch(F32 pitch_inc);
+ void agentYaw(F32 yaw_inc);
+ void agentJump();
+ void resetDeltas(S32 axis[]);
+ void loadDeviceIdFromSettings();
#if LIB_NDOF
- static NDOF_HotPlugResult HotPlugAddCallback(NDOF_Device *dev);
- static void HotPlugRemovalCallback(NDOF_Device *dev);
+ static NDOF_HotPlugResult HotPlugAddCallback(NDOF_Device *dev);
+ static void HotPlugRemovalCallback(NDOF_Device *dev);
#endif
-
+
private:
- F32 mAxes[6];
- long mBtn[16];
- EJoystickDriverState mDriverState;
- NDOF_Device *mNdofDev;
- bool mResetFlag;
- F32 mPerfScale;
- bool mCameraUpdated;
- bool mOverrideCamera;
- U32 mJoystickRun;
- LLSD mLastDeviceUUID; // _GUID as U8 binary map, integer 1 for no device/ndof's device
-
- static F32 sLastDelta[7];
- static F32 sDelta[7];
+ F32 mAxes[6];
+ long mBtn[16];
+ EJoystickDriverState mDriverState;
+ NDOF_Device *mNdofDev;
+ bool mResetFlag;
+ F32 mPerfScale;
+ bool mCameraUpdated;
+ bool mOverrideCamera;
+ U32 mJoystickRun;
+ LLSD mLastDeviceUUID; // _GUID as U8 binary map, integer 1 for no device/ndof's device
+
+ static F32 sLastDelta[7];
+ static F32 sDelta[7];
};
#endif
diff --git a/indra/newview/llviewerlayer.cpp b/indra/newview/llviewerlayer.cpp
index 1a07251e92..24b72de1d5 100644
--- a/indra/newview/llviewerlayer.cpp
+++ b/indra/newview/llviewerlayer.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerlayer.cpp
* @brief LLViewerLayer class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,69 +32,69 @@
LLViewerLayer::LLViewerLayer(const S32 width, const F32 scale)
{
- mWidth = width;
- mScale = scale;
- mScaleInv = 1.f/scale;
- mDatap = new F32[width*width];
+ mWidth = width;
+ mScale = scale;
+ mScaleInv = 1.f/scale;
+ mDatap = new F32[width*width];
- for (S32 i = 0; i < width*width; i++)
- {
- *(mDatap + i) = 0.f;
- }
+ for (S32 i = 0; i < width*width; i++)
+ {
+ *(mDatap + i) = 0.f;
+ }
}
LLViewerLayer::~LLViewerLayer()
{
- delete[] mDatap;
- mDatap = NULL;
+ delete[] mDatap;
+ mDatap = NULL;
}
F32 LLViewerLayer::getValue(const S32 x, const S32 y) const
{
-// llassert(x >= 0);
-// llassert(x < mWidth);
-// llassert(y >= 0);
-// llassert(y < mWidth);
+// llassert(x >= 0);
+// llassert(x < mWidth);
+// llassert(y >= 0);
+// llassert(y < mWidth);
- return *(mDatap + x + y*mWidth);
+ return *(mDatap + x + y*mWidth);
}
F32 LLViewerLayer::getValueScaled(const F32 x, const F32 y) const
{
- S32 x1, x2, y1, y2;
- F32 x_frac, y_frac;
+ S32 x1, x2, y1, y2;
+ F32 x_frac, y_frac;
+
+ x_frac = x*mScaleInv;
+ x1 = llfloor(x_frac);
+ x2 = x1 + 1;
+ x_frac -= x1;
+
+ y_frac = y*mScaleInv;
+ y1 = llfloor(y_frac);
+ y2 = y1 + 1;
+ y_frac -= y1;
+
+ x1 = llmin((S32)mWidth-1, x1);
+ x1 = llmax(0, x1);
+ x2 = llmin((S32)mWidth-1, x2);
+ x2 = llmax(0, x2);
+ y1 = llmin((S32)mWidth-1, y1);
+ y1 = llmax(0, y1);
+ y2 = llmin((S32)mWidth-1, y2);
+ y2 = llmax(0, y2);
- x_frac = x*mScaleInv;
- x1 = llfloor(x_frac);
- x2 = x1 + 1;
- x_frac -= x1;
+ // Take weighted average of all four points (bilinear interpolation)
+ S32 row1 = y1 * mWidth;
+ S32 row2 = y2 * mWidth;
- y_frac = y*mScaleInv;
- y1 = llfloor(y_frac);
- y2 = y1 + 1;
- y_frac -= y1;
+ // Access in squential order in memory, and don't use immediately.
+ F32 row1_left = mDatap[ row1 + x1 ];
+ F32 row1_right = mDatap[ row1 + x2 ];
+ F32 row2_left = mDatap[ row2 + x1 ];
+ F32 row2_right = mDatap[ row2 + x2 ];
- x1 = llmin((S32)mWidth-1, x1);
- x1 = llmax(0, x1);
- x2 = llmin((S32)mWidth-1, x2);
- x2 = llmax(0, x2);
- y1 = llmin((S32)mWidth-1, y1);
- y1 = llmax(0, y1);
- y2 = llmin((S32)mWidth-1, y2);
- y2 = llmax(0, y2);
+ F32 row1_interp = row1_left - x_frac * (row1_left - row1_right);
+ F32 row2_interp = row2_left - x_frac * (row2_left - row2_right);
- // Take weighted average of all four points (bilinear interpolation)
- S32 row1 = y1 * mWidth;
- S32 row2 = y2 * mWidth;
-
- // Access in squential order in memory, and don't use immediately.
- F32 row1_left = mDatap[ row1 + x1 ];
- F32 row1_right = mDatap[ row1 + x2 ];
- F32 row2_left = mDatap[ row2 + x1 ];
- F32 row2_right = mDatap[ row2 + x2 ];
-
- F32 row1_interp = row1_left - x_frac * (row1_left - row1_right);
- F32 row2_interp = row2_left - x_frac * (row2_left - row2_right);
-
- return row1_interp - y_frac * (row1_interp - row2_interp);
+ return row1_interp - y_frac * (row1_interp - row2_interp);
}
diff --git a/indra/newview/llviewerlayer.h b/indra/newview/llviewerlayer.h
index f9ec9c0c83..53a28a38f8 100644
--- a/indra/newview/llviewerlayer.h
+++ b/indra/newview/llviewerlayer.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerlayer.h
* @brief LLViewerLayer class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,17 +32,17 @@
class LLViewerLayer
{
public:
- LLViewerLayer(const S32 width, const F32 scale = 1.f);
- virtual ~LLViewerLayer();
+ LLViewerLayer(const S32 width, const F32 scale = 1.f);
+ virtual ~LLViewerLayer();
- F32 getValueScaled(const F32 x, const F32 y) const;
+ F32 getValueScaled(const F32 x, const F32 y) const;
protected:
- F32 getValue(const S32 x, const S32 y) const;
+ F32 getValue(const S32 x, const S32 y) const;
protected:
- S32 mWidth;
- F32 mScale;
- F32 mScaleInv;
- F32 *mDatap;
+ S32 mWidth;
+ F32 mScale;
+ F32 mScaleInv;
+ F32 *mDatap;
};
#endif // LL_LLVIEWERLAYER_H
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 02108e861a..66182684ad 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -35,9 +35,9 @@
#include "llcallbacklist.h"
#include "lldir.h"
#include "lldiriterator.h"
-#include "llevent.h" // LLSimpleListener
+#include "llevent.h" // LLSimpleListener
#include "llfilepicker.h"
-#include "llfloaterwebcontent.h" // for handling window close requests and geometry change requests in media browser windows.
+#include "llfloaterwebcontent.h" // for handling window close requests and geometry change requests in media browser windows.
#include "llfocusmgr.h"
#include "llimagegl.h"
#include "llkeyboard.h"
@@ -74,9 +74,9 @@
#include "llvieweraudio.h"
#include "llcorehttputil.h"
-#include "llfloaterwebcontent.h" // for handling window close requests and geometry change requests in media browser windows.
+#include "llfloaterwebcontent.h" // for handling window close requests and geometry change requests in media browser windows.
-#include <boost/bind.hpp> // for SkinFolder listener
+#include <boost/bind.hpp> // for SkinFolder listener
#include <boost/signals2.hpp>
extern BOOL gCubeSnapshot;
@@ -95,70 +95,70 @@ void init_threaded_picker_load_dialog(LLPluginClassMedia* plugin, LLFilePicker::
LLViewerMediaEventEmitter::~LLViewerMediaEventEmitter()
{
- observerListType::iterator iter = mObservers.begin();
+ observerListType::iterator iter = mObservers.begin();
- while( iter != mObservers.end() )
- {
- LLViewerMediaObserver *self = *iter;
- iter++;
- remObserver(self);
- }
+ while( iter != mObservers.end() )
+ {
+ LLViewerMediaObserver *self = *iter;
+ iter++;
+ remObserver(self);
+ }
}
///////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaEventEmitter::addObserver( LLViewerMediaObserver* observer )
{
- if ( ! observer )
- return false;
+ if ( ! observer )
+ return false;
- if ( std::find( mObservers.begin(), mObservers.end(), observer ) != mObservers.end() )
- return false;
+ if ( std::find( mObservers.begin(), mObservers.end(), observer ) != mObservers.end() )
+ return false;
- mObservers.push_back( observer );
- observer->mEmitters.push_back( this );
+ mObservers.push_back( observer );
+ observer->mEmitters.push_back( this );
- return true;
+ return true;
}
///////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaEventEmitter::remObserver( LLViewerMediaObserver* observer )
{
- if ( ! observer )
- return false;
+ if ( ! observer )
+ return false;
- mObservers.remove( observer );
- observer->mEmitters.remove(this);
+ mObservers.remove( observer );
+ observer->mEmitters.remove(this);
- return true;
+ return true;
}
///////////////////////////////////////////////////////////////////////////////
//
void LLViewerMediaEventEmitter::emitEvent( LLPluginClassMedia* media, LLViewerMediaObserver::EMediaEvent event )
{
- // Broadcast the event to any observers.
- observerListType::iterator iter = mObservers.begin();
- while( iter != mObservers.end() )
- {
- LLViewerMediaObserver *self = *iter;
- ++iter;
- self->handleMediaEvent( media, event );
- }
+ // Broadcast the event to any observers.
+ observerListType::iterator iter = mObservers.begin();
+ while( iter != mObservers.end() )
+ {
+ LLViewerMediaObserver *self = *iter;
+ ++iter;
+ self->handleMediaEvent( media, event );
+ }
}
// Move this to its own file.
LLViewerMediaObserver::~LLViewerMediaObserver()
{
- std::list<LLViewerMediaEventEmitter *>::iterator iter = mEmitters.begin();
+ std::list<LLViewerMediaEventEmitter *>::iterator iter = mEmitters.begin();
- while( iter != mEmitters.end() )
- {
- LLViewerMediaEventEmitter *self = *iter;
- iter++;
- self->remObserver( this );
- }
+ while( iter != mEmitters.end() )
+ {
+ LLViewerMediaEventEmitter *self = *iter;
+ iter++;
+ self->remObserver( this );
+ }
}
@@ -174,28 +174,28 @@ static F64 sLowestLoadableImplInterest = 0.0f;
//////////////////////////////////////////////////////////////////////////////////////////
static void add_media_impl(LLViewerMediaImpl* media)
{
- sViewerMediaImplList.push_back(media);
+ sViewerMediaImplList.push_back(media);
}
//////////////////////////////////////////////////////////////////////////////////////////
static void remove_media_impl(LLViewerMediaImpl* media)
{
- LLViewerMedia::impl_list::iterator iter = sViewerMediaImplList.begin();
- LLViewerMedia::impl_list::iterator end = sViewerMediaImplList.end();
+ LLViewerMedia::impl_list::iterator iter = sViewerMediaImplList.begin();
+ LLViewerMedia::impl_list::iterator end = sViewerMediaImplList.end();
- for(; iter != end; iter++)
- {
- if(media == *iter)
- {
- sViewerMediaImplList.erase(iter);
- return;
- }
- }
+ for(; iter != end; iter++)
+ {
+ if(media == *iter)
+ {
+ sViewerMediaImplList.erase(iter);
+ return;
+ }
+ }
}
class LLViewerMediaMuteListObserver : public LLMuteListObserver
{
- /* virtual */ void onChange() { LLViewerMedia::getInstance()->muteListChanged();}
+ /* virtual */ void onChange() { LLViewerMedia::getInstance()->muteListChanged();}
};
static LLViewerMediaMuteListObserver sViewerMediaMuteListObserver;
@@ -239,374 +239,374 @@ void LLViewerMedia::initSingleton()
//////////////////////////////////////////////////////////////////////////////////////////
viewer_media_t LLViewerMedia::newMediaImpl(
- const LLUUID& texture_id,
- S32 media_width,
- S32 media_height,
- U8 media_auto_scale,
- U8 media_loop)
-{
- LLViewerMediaImpl* media_impl = getMediaImplFromTextureID(texture_id);
- if(media_impl == NULL || texture_id.isNull())
- {
- // Create the media impl
- media_impl = new LLViewerMediaImpl(texture_id, media_width, media_height, media_auto_scale, media_loop);
- }
- else
- {
- media_impl->unload();
- media_impl->setTextureID(texture_id);
- media_impl->mMediaWidth = media_width;
- media_impl->mMediaHeight = media_height;
- media_impl->mMediaAutoScale = media_auto_scale;
- media_impl->mMediaLoop = media_loop;
- }
-
- return media_impl;
+ const LLUUID& texture_id,
+ S32 media_width,
+ S32 media_height,
+ U8 media_auto_scale,
+ U8 media_loop)
+{
+ LLViewerMediaImpl* media_impl = getMediaImplFromTextureID(texture_id);
+ if(media_impl == NULL || texture_id.isNull())
+ {
+ // Create the media impl
+ media_impl = new LLViewerMediaImpl(texture_id, media_width, media_height, media_auto_scale, media_loop);
+ }
+ else
+ {
+ media_impl->unload();
+ media_impl->setTextureID(texture_id);
+ media_impl->mMediaWidth = media_width;
+ media_impl->mMediaHeight = media_height;
+ media_impl->mMediaAutoScale = media_auto_scale;
+ media_impl->mMediaLoop = media_loop;
+ }
+
+ return media_impl;
}
viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const std::string& previous_url, bool update_from_self)
{
llassert(!gCubeSnapshot);
- // Try to find media with the same media ID
- viewer_media_t media_impl = getMediaImplFromTextureID(media_entry->getMediaID());
-
- LL_DEBUGS() << "called, current URL is \"" << media_entry->getCurrentURL()
- << "\", previous URL is \"" << previous_url
- << "\", update_from_self is " << (update_from_self?"true":"false")
- << LL_ENDL;
-
- bool was_loaded = false;
- bool needs_navigate = false;
-
- if(media_impl)
- {
- was_loaded = media_impl->hasMedia();
-
- media_impl->setHomeURL(media_entry->getHomeURL());
-
- media_impl->mMediaAutoScale = media_entry->getAutoScale();
- media_impl->mMediaLoop = media_entry->getAutoLoop();
- media_impl->mMediaWidth = media_entry->getWidthPixels();
- media_impl->mMediaHeight = media_entry->getHeightPixels();
- media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
- media_impl->mMediaEntryURL = media_entry->getCurrentURL();
- if (media_impl->mMediaSource)
- {
- media_impl->mMediaSource->setAutoScale(media_impl->mMediaAutoScale);
- media_impl->mMediaSource->setLoop(media_impl->mMediaLoop);
- media_impl->mMediaSource->setSize(media_entry->getWidthPixels(), media_entry->getHeightPixels());
- }
-
- bool url_changed = (media_impl->mMediaEntryURL != previous_url);
- if(media_impl->mMediaEntryURL.empty())
- {
- if(url_changed)
- {
- // The current media URL is now empty. Unload the media source.
- media_impl->unload();
-
- LL_DEBUGS() << "Unloading media instance (new current URL is empty)." << LL_ENDL;
- }
- }
- else
- {
- // The current media URL is not empty.
- // If (the media was already loaded OR the media was set to autoplay) AND this update didn't come from this agent,
- // do a navigate.
- bool auto_play = media_impl->isAutoPlayable();
- if((was_loaded || auto_play) && !update_from_self)
- {
- needs_navigate = url_changed;
- }
-
- LL_DEBUGS() << "was_loaded is " << (was_loaded?"true":"false")
- << ", auto_play is " << (auto_play?"true":"false")
- << ", needs_navigate is " << (needs_navigate?"true":"false") << LL_ENDL;
- }
- }
- else
- {
- media_impl = newMediaImpl(
- media_entry->getMediaID(),
- media_entry->getWidthPixels(),
- media_entry->getHeightPixels(),
- media_entry->getAutoScale(),
- media_entry->getAutoLoop());
-
- media_impl->setHomeURL(media_entry->getHomeURL());
- media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
- media_impl->mMediaEntryURL = media_entry->getCurrentURL();
- if(media_impl->isAutoPlayable())
- {
- needs_navigate = true;
- }
- }
-
- if(media_impl)
- {
- if(needs_navigate)
- {
- media_impl->navigateTo(media_impl->mMediaEntryURL, "", true, true);
- LL_DEBUGS() << "navigating to URL " << media_impl->mMediaEntryURL << LL_ENDL;
- }
- else if(!media_impl->mMediaURL.empty() && (media_impl->mMediaURL != media_impl->mMediaEntryURL))
- {
- // If we already have a non-empty media URL set and we aren't doing a navigate, update the media URL to match the media entry.
- media_impl->mMediaURL = media_impl->mMediaEntryURL;
-
- // If this causes a navigate at some point (such as after a reload), it should be considered server-driven so it isn't broadcast.
- media_impl->mNavigateServerRequest = true;
-
- LL_DEBUGS() << "updating URL in the media impl to " << media_impl->mMediaEntryURL << LL_ENDL;
- }
- }
-
- return media_impl;
+ // Try to find media with the same media ID
+ viewer_media_t media_impl = getMediaImplFromTextureID(media_entry->getMediaID());
+
+ LL_DEBUGS() << "called, current URL is \"" << media_entry->getCurrentURL()
+ << "\", previous URL is \"" << previous_url
+ << "\", update_from_self is " << (update_from_self?"true":"false")
+ << LL_ENDL;
+
+ bool was_loaded = false;
+ bool needs_navigate = false;
+
+ if(media_impl)
+ {
+ was_loaded = media_impl->hasMedia();
+
+ media_impl->setHomeURL(media_entry->getHomeURL());
+
+ media_impl->mMediaAutoScale = media_entry->getAutoScale();
+ media_impl->mMediaLoop = media_entry->getAutoLoop();
+ media_impl->mMediaWidth = media_entry->getWidthPixels();
+ media_impl->mMediaHeight = media_entry->getHeightPixels();
+ media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
+ media_impl->mMediaEntryURL = media_entry->getCurrentURL();
+ if (media_impl->mMediaSource)
+ {
+ media_impl->mMediaSource->setAutoScale(media_impl->mMediaAutoScale);
+ media_impl->mMediaSource->setLoop(media_impl->mMediaLoop);
+ media_impl->mMediaSource->setSize(media_entry->getWidthPixels(), media_entry->getHeightPixels());
+ }
+
+ bool url_changed = (media_impl->mMediaEntryURL != previous_url);
+ if(media_impl->mMediaEntryURL.empty())
+ {
+ if(url_changed)
+ {
+ // The current media URL is now empty. Unload the media source.
+ media_impl->unload();
+
+ LL_DEBUGS() << "Unloading media instance (new current URL is empty)." << LL_ENDL;
+ }
+ }
+ else
+ {
+ // The current media URL is not empty.
+ // If (the media was already loaded OR the media was set to autoplay) AND this update didn't come from this agent,
+ // do a navigate.
+ bool auto_play = media_impl->isAutoPlayable();
+ if((was_loaded || auto_play) && !update_from_self)
+ {
+ needs_navigate = url_changed;
+ }
+
+ LL_DEBUGS() << "was_loaded is " << (was_loaded?"true":"false")
+ << ", auto_play is " << (auto_play?"true":"false")
+ << ", needs_navigate is " << (needs_navigate?"true":"false") << LL_ENDL;
+ }
+ }
+ else
+ {
+ media_impl = newMediaImpl(
+ media_entry->getMediaID(),
+ media_entry->getWidthPixels(),
+ media_entry->getHeightPixels(),
+ media_entry->getAutoScale(),
+ media_entry->getAutoLoop());
+
+ media_impl->setHomeURL(media_entry->getHomeURL());
+ media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
+ media_impl->mMediaEntryURL = media_entry->getCurrentURL();
+ if(media_impl->isAutoPlayable())
+ {
+ needs_navigate = true;
+ }
+ }
+
+ if(media_impl)
+ {
+ if(needs_navigate)
+ {
+ media_impl->navigateTo(media_impl->mMediaEntryURL, "", true, true);
+ LL_DEBUGS() << "navigating to URL " << media_impl->mMediaEntryURL << LL_ENDL;
+ }
+ else if(!media_impl->mMediaURL.empty() && (media_impl->mMediaURL != media_impl->mMediaEntryURL))
+ {
+ // If we already have a non-empty media URL set and we aren't doing a navigate, update the media URL to match the media entry.
+ media_impl->mMediaURL = media_impl->mMediaEntryURL;
+
+ // If this causes a navigate at some point (such as after a reload), it should be considered server-driven so it isn't broadcast.
+ media_impl->mNavigateServerRequest = true;
+
+ LL_DEBUGS() << "updating URL in the media impl to " << media_impl->mMediaEntryURL << LL_ENDL;
+ }
+ }
+
+ return media_impl;
}
//////////////////////////////////////////////////////////////////////////////////////////
LLViewerMediaImpl* LLViewerMedia::getMediaImplFromTextureID(const LLUUID& texture_id)
{
- LLViewerMediaImpl* result = NULL;
+ LLViewerMediaImpl* result = NULL;
- // Look up the texture ID in the texture id->impl map.
- impl_id_map::iterator iter = sViewerMediaTextureIDMap.find(texture_id);
- if(iter != sViewerMediaTextureIDMap.end())
- {
- result = iter->second;
- }
+ // Look up the texture ID in the texture id->impl map.
+ impl_id_map::iterator iter = sViewerMediaTextureIDMap.find(texture_id);
+ if(iter != sViewerMediaTextureIDMap.end())
+ {
+ result = iter->second;
+ }
- return result;
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
std::string LLViewerMedia::getCurrentUserAgent()
{
- // Don't use user-visible string to avoid
- // punctuation and strange characters.
- std::string skin_name = gSavedSettings.getString("SkinCurrent");
+ // Don't use user-visible string to avoid
+ // punctuation and strange characters.
+ std::string skin_name = gSavedSettings.getString("SkinCurrent");
- // Just in case we need to check browser differences in A/B test
- // builds.
- std::string channel = LLVersionInfo::instance().getChannel();
+ // Just in case we need to check browser differences in A/B test
+ // builds.
+ std::string channel = LLVersionInfo::instance().getChannel();
- // append our magic version number string to the browser user agent id
- // See the HTTP 1.0 and 1.1 specifications for allowed formats:
- // http://www.ietf.org/rfc/rfc1945.txt section 10.15
- // http://www.ietf.org/rfc/rfc2068.txt section 3.8
- // This was also helpful:
- // http://www.mozilla.org/build/revised-user-agent-strings.html
- std::ostringstream codec;
- codec << "SecondLife/";
- codec << LLVersionInfo::instance().getVersion();
- codec << " (" << channel << "; " << skin_name << " skin)";
- LL_INFOS() << codec.str() << LL_ENDL;
+ // append our magic version number string to the browser user agent id
+ // See the HTTP 1.0 and 1.1 specifications for allowed formats:
+ // http://www.ietf.org/rfc/rfc1945.txt section 10.15
+ // http://www.ietf.org/rfc/rfc2068.txt section 3.8
+ // This was also helpful:
+ // http://www.mozilla.org/build/revised-user-agent-strings.html
+ std::ostringstream codec;
+ codec << "SecondLife/";
+ codec << LLVersionInfo::instance().getVersion();
+ codec << " (" << channel << "; " << skin_name << " skin)";
+ LL_INFOS() << codec.str() << LL_ENDL;
- return codec.str();
+ return codec.str();
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::updateBrowserUserAgent()
{
- std::string user_agent = getCurrentUserAgent();
+ std::string user_agent = getCurrentUserAgent();
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
- for(; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- if(pimpl->mMediaSource && pimpl->mMediaSource->pluginSupportsMediaBrowser())
- {
- pimpl->mMediaSource->setBrowserUserAgent(user_agent);
- }
- }
+ for(; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ if(pimpl->mMediaSource && pimpl->mMediaSource->pluginSupportsMediaBrowser())
+ {
+ pimpl->mMediaSource->setBrowserUserAgent(user_agent);
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMedia::handleSkinCurrentChanged(const LLSD& /*newvalue*/)
{
- // gSavedSettings is already updated when this function is called.
- updateBrowserUserAgent();
- return true;
+ // gSavedSettings is already updated when this function is called.
+ updateBrowserUserAgent();
+ return true;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMedia::textureHasMedia(const LLUUID& texture_id)
{
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
- for(; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- if(pimpl->getMediaTextureID() == texture_id)
- {
- return true;
- }
- }
- return false;
+ for(; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ if(pimpl->getMediaTextureID() == texture_id)
+ {
+ return true;
+ }
+ }
+ return false;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::setVolume(F32 volume)
{
- if(volume != sGlobalVolume || sForceUpdate)
- {
- sGlobalVolume = volume;
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
+ if(volume != sGlobalVolume || sForceUpdate)
+ {
+ sGlobalVolume = volume;
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
- for(; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- pimpl->updateVolume();
- }
+ for(; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ pimpl->updateVolume();
+ }
- sForceUpdate = false;
- }
+ sForceUpdate = false;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
F32 LLViewerMedia::getVolume()
{
- return sGlobalVolume;
+ return sGlobalVolume;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::muteListChanged()
{
- // When the mute list changes, we need to check mute status on all impls.
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
+ // When the mute list changes, we need to check mute status on all impls.
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
- for(; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- pimpl->mNeedsMuteCheck = true;
- }
+ for(; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ pimpl->mNeedsMuteCheck = true;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMedia::isInterestingEnough(const LLVOVolume *object, const F64 &object_interest)
{
- bool result = false;
-
- if (NULL == object)
- {
- result = false;
- }
- // Focused? Then it is interesting!
- else if (LLViewerMediaFocus::getInstance()->getFocusedObjectID() == object->getID())
- {
- result = true;
- }
- // Selected? Then it is interesting!
- // XXX Sadly, 'contains()' doesn't take a const :(
- else if (LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(object)))
- {
- result = true;
- }
- else
- {
- LL_DEBUGS() << "object interest = " << object_interest << ", lowest loadable = " << sLowestLoadableImplInterest << LL_ENDL;
- if(object_interest >= sLowestLoadableImplInterest)
- result = true;
- }
-
- return result;
+ bool result = false;
+
+ if (NULL == object)
+ {
+ result = false;
+ }
+ // Focused? Then it is interesting!
+ else if (LLViewerMediaFocus::getInstance()->getFocusedObjectID() == object->getID())
+ {
+ result = true;
+ }
+ // Selected? Then it is interesting!
+ // XXX Sadly, 'contains()' doesn't take a const :(
+ else if (LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(object)))
+ {
+ result = true;
+ }
+ else
+ {
+ LL_DEBUGS() << "object interest = " << object_interest << ", lowest loadable = " << sLowestLoadableImplInterest << LL_ENDL;
+ if(object_interest >= sLowestLoadableImplInterest)
+ result = true;
+ }
+
+ return result;
}
LLViewerMedia::impl_list &LLViewerMedia::getPriorityList()
{
- return sViewerMediaImplList;
+ return sViewerMediaImplList;
}
// static
// This is the predicate function used to sort sViewerMediaImplList by priority.
bool LLViewerMedia::priorityComparitor(const LLViewerMediaImpl* i1, const LLViewerMediaImpl* i2)
{
- if(i1->isForcedUnloaded() && !i2->isForcedUnloaded())
- {
- // Muted or failed items always go to the end of the list, period.
- return false;
- }
- else if(i2->isForcedUnloaded() && !i1->isForcedUnloaded())
- {
- // Muted or failed items always go to the end of the list, period.
- return true;
- }
- else if(i1->hasFocus())
- {
- // The item with user focus always comes to the front of the list, period.
- return true;
- }
- else if(i2->hasFocus())
- {
- // The item with user focus always comes to the front of the list, period.
- return false;
- }
- else if(i1->isParcelMedia())
- {
- // The parcel media impl sorts above all other inworld media, unless one has focus.
- return true;
- }
- else if(i2->isParcelMedia())
- {
- // The parcel media impl sorts above all other inworld media, unless one has focus.
- return false;
- }
- else if(i1->getUsedInUI() && !i2->getUsedInUI())
- {
- // i1 is a UI element, i2 is not. This makes i1 "less than" i2, so it sorts earlier in our list.
- return true;
- }
- else if(i2->getUsedInUI() && !i1->getUsedInUI())
- {
- // i2 is a UI element, i1 is not. This makes i2 "less than" i1, so it sorts earlier in our list.
- return false;
- }
- else if(i1->isPlayable() && !i2->isPlayable())
- {
- // Playable items sort above ones that wouldn't play even if they got high enough priority
- return true;
- }
- else if(!i1->isPlayable() && i2->isPlayable())
- {
- // Playable items sort above ones that wouldn't play even if they got high enough priority
- return false;
- }
- else if(i1->getInterest() == i2->getInterest())
- {
- // Generally this will mean both objects have zero interest. In this case, sort on distance.
- return (i1->getProximityDistance() < i2->getProximityDistance());
- }
- else
- {
- // The object with the larger interest value should be earlier in the list, so we reverse the sense of the comparison here.
- return (i1->getInterest() > i2->getInterest());
- }
+ if(i1->isForcedUnloaded() && !i2->isForcedUnloaded())
+ {
+ // Muted or failed items always go to the end of the list, period.
+ return false;
+ }
+ else if(i2->isForcedUnloaded() && !i1->isForcedUnloaded())
+ {
+ // Muted or failed items always go to the end of the list, period.
+ return true;
+ }
+ else if(i1->hasFocus())
+ {
+ // The item with user focus always comes to the front of the list, period.
+ return true;
+ }
+ else if(i2->hasFocus())
+ {
+ // The item with user focus always comes to the front of the list, period.
+ return false;
+ }
+ else if(i1->isParcelMedia())
+ {
+ // The parcel media impl sorts above all other inworld media, unless one has focus.
+ return true;
+ }
+ else if(i2->isParcelMedia())
+ {
+ // The parcel media impl sorts above all other inworld media, unless one has focus.
+ return false;
+ }
+ else if(i1->getUsedInUI() && !i2->getUsedInUI())
+ {
+ // i1 is a UI element, i2 is not. This makes i1 "less than" i2, so it sorts earlier in our list.
+ return true;
+ }
+ else if(i2->getUsedInUI() && !i1->getUsedInUI())
+ {
+ // i2 is a UI element, i1 is not. This makes i2 "less than" i1, so it sorts earlier in our list.
+ return false;
+ }
+ else if(i1->isPlayable() && !i2->isPlayable())
+ {
+ // Playable items sort above ones that wouldn't play even if they got high enough priority
+ return true;
+ }
+ else if(!i1->isPlayable() && i2->isPlayable())
+ {
+ // Playable items sort above ones that wouldn't play even if they got high enough priority
+ return false;
+ }
+ else if(i1->getInterest() == i2->getInterest())
+ {
+ // Generally this will mean both objects have zero interest. In this case, sort on distance.
+ return (i1->getProximityDistance() < i2->getProximityDistance());
+ }
+ else
+ {
+ // The object with the larger interest value should be earlier in the list, so we reverse the sense of the comparison here.
+ return (i1->getInterest() > i2->getInterest());
+ }
}
static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMediaImpl* i2)
{
- if(i1->getProximityDistance() < i2->getProximityDistance())
- {
- return true;
- }
- else if(i1->getProximityDistance() > i2->getProximityDistance())
- {
- return false;
- }
- else
- {
- // Both objects have the same distance. This most likely means they're two faces of the same object.
- // They may also be faces on different objects with exactly the same distance (like HUD objects).
- // We don't actually care what the sort order is for this case, as long as it's stable and doesn't change when you enable/disable media.
- // Comparing the impl pointers gives a completely arbitrary ordering, but it will be stable.
- return (i1 < i2);
- }
+ if(i1->getProximityDistance() < i2->getProximityDistance())
+ {
+ return true;
+ }
+ else if(i1->getProximityDistance() > i2->getProximityDistance())
+ {
+ return false;
+ }
+ else
+ {
+ // Both objects have the same distance. This most likely means they're two faces of the same object.
+ // They may also be faces on different objects with exactly the same distance (like HUD objects).
+ // We don't actually care what the sort order is for this case, as long as it's stable and doesn't change when you enable/disable media.
+ // Comparing the impl pointers gives a completely arbitrary ordering, but it will be stable.
+ return (i1 < i2);
+ }
}
static LLTrace::BlockTimerStatHandle FTM_MEDIA_UPDATE("Update Media");
@@ -631,8 +631,8 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
llassert(!gCubeSnapshot);
- // Enable/disable the plugin read thread
- LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread"));
+ // Enable/disable the plugin read thread
+ LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread"));
// SL-16418 We can't call LLViewerMediaImpl->update() if we are in the state of shutting down.
if(LLApp::isExiting())
@@ -641,192 +641,192 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
return;
}
- // HACK: we always try to keep a spare running webkit plugin around to improve launch times.
- // 2017-04-19 Removed CP - this doesn't appear to buy us much and consumes a lot of resources so
- // removing it for now.
- //createSpareBrowserMediaSource();
+ // HACK: we always try to keep a spare running webkit plugin around to improve launch times.
+ // 2017-04-19 Removed CP - this doesn't appear to buy us much and consumes a lot of resources so
+ // removing it for now.
+ //createSpareBrowserMediaSource();
- mAnyMediaShowing = false;
- mAnyMediaPlaying = false;
+ mAnyMediaShowing = false;
+ mAnyMediaPlaying = false;
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media update interest"); //LL_RECORD_BLOCK_TIME(FTM_MEDIA_UPDATE_INTEREST);
- for(; iter != end;)
- {
- LLViewerMediaImpl* pimpl = *iter++;
- pimpl->update();
- pimpl->calculateInterest();
- }
- }
-
- // Let the spare media source actually launch
- if(mSpareBrowserMediaSource)
- {
+ for(; iter != end;)
+ {
+ LLViewerMediaImpl* pimpl = *iter++;
+ pimpl->update();
+ pimpl->calculateInterest();
+ }
+ }
+
+ // Let the spare media source actually launch
+ if(mSpareBrowserMediaSource)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media spare idle"); //LL_RECORD_BLOCK_TIME(FTM_MEDIA_SPARE_IDLE);
- mSpareBrowserMediaSource->idle();
- }
+ mSpareBrowserMediaSource->idle();
+ }
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media sort"); //LL_RECORD_BLOCK_TIME(FTM_MEDIA_SORT);
- // Sort the static instance list using our interest criteria
- sViewerMediaImplList.sort(priorityComparitor);
- }
+ // Sort the static instance list using our interest criteria
+ sViewerMediaImplList.sort(priorityComparitor);
+ }
- // Go through the list again and adjust according to priority.
- iter = sViewerMediaImplList.begin();
- end = sViewerMediaImplList.end();
+ // Go through the list again and adjust according to priority.
+ iter = sViewerMediaImplList.begin();
+ end = sViewerMediaImplList.end();
- F64 total_cpu = 0.0f;
- int impl_count_total = 0;
- int impl_count_interest_low = 0;
- int impl_count_interest_normal = 0;
+ F64 total_cpu = 0.0f;
+ int impl_count_total = 0;
+ int impl_count_interest_low = 0;
+ int impl_count_interest_normal = 0;
- std::vector<LLViewerMediaImpl*> proximity_order;
+ std::vector<LLViewerMediaImpl*> proximity_order;
- static LLCachedControl<bool> inworld_media_enabled(gSavedSettings, "AudioStreamingMedia", true);
- static LLCachedControl<bool> inworld_audio_enabled(gSavedSettings, "AudioStreamingMusic", true);
- U32 max_instances = gSavedSettings.getU32("PluginInstancesTotal");
- U32 max_normal = gSavedSettings.getU32("PluginInstancesNormal");
- U32 max_low = gSavedSettings.getU32("PluginInstancesLow");
- F32 max_cpu = gSavedSettings.getF32("PluginInstancesCPULimit");
- // Setting max_cpu to 0.0 disables CPU usage checking.
- bool check_cpu_usage = (max_cpu != 0.0f);
+ static LLCachedControl<bool> inworld_media_enabled(gSavedSettings, "AudioStreamingMedia", true);
+ static LLCachedControl<bool> inworld_audio_enabled(gSavedSettings, "AudioStreamingMusic", true);
+ U32 max_instances = gSavedSettings.getU32("PluginInstancesTotal");
+ U32 max_normal = gSavedSettings.getU32("PluginInstancesNormal");
+ U32 max_low = gSavedSettings.getU32("PluginInstancesLow");
+ F32 max_cpu = gSavedSettings.getF32("PluginInstancesCPULimit");
+ // Setting max_cpu to 0.0 disables CPU usage checking.
+ bool check_cpu_usage = (max_cpu != 0.0f);
- LLViewerMediaImpl* lowest_interest_loadable = NULL;
+ LLViewerMediaImpl* lowest_interest_loadable = NULL;
- // Notes on tweakable params:
- // max_instances must be set high enough to allow the various instances used in the UI (for the help browser, search, etc.) to be loaded.
- // If max_normal + max_low is less than max_instances, things will tend to get unloaded instead of being set to slideshow.
+ // Notes on tweakable params:
+ // max_instances must be set high enough to allow the various instances used in the UI (for the help browser, search, etc.) to be loaded.
+ // If max_normal + max_low is less than max_instances, things will tend to get unloaded instead of being set to slideshow.
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media misc"); //LL_RECORD_BLOCK_TIME(FTM_MEDIA_MISC);
- for(; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
-
- LLPluginClassMedia::EPriority new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
-
- if(pimpl->isForcedUnloaded() || (impl_count_total >= (int)max_instances))
- {
- // Never load muted or failed impls.
- // Hard limit on the number of instances that will be loaded at one time
- new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
- }
- else if(!pimpl->getVisible())
- {
- new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
- }
- else if(pimpl->hasFocus())
- {
- new_priority = LLPluginClassMedia::PRIORITY_HIGH;
- impl_count_interest_normal++; // count this against the count of "normal" instances for priority purposes
- }
- else if(pimpl->getUsedInUI())
- {
- new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
- impl_count_interest_normal++;
- }
- else if(pimpl->isParcelMedia())
- {
- new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
- impl_count_interest_normal++;
- }
- else
- {
- // Look at interest and CPU usage for instances that aren't in any of the above states.
-
- // Heuristic -- if the media texture's approximate screen area is less than 1/4 of the native area of the texture,
- // turn it down to low instead of normal. This may downsample for plugins that support it.
- bool media_is_small = false;
- F64 approximate_interest = pimpl->getApproximateTextureInterest();
- if(approximate_interest == 0.0f)
- {
- // this media has no current size, which probably means it's not loaded.
- media_is_small = true;
- }
- else if(pimpl->getInterest() < (approximate_interest / 4))
- {
- media_is_small = true;
- }
-
- if(pimpl->getInterest() == 0.0f)
- {
- // This media is completely invisible, due to being outside the view frustrum or out of range.
- new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
- }
- else if(check_cpu_usage && (total_cpu > max_cpu))
- {
- // Higher priority plugins have already used up the CPU budget. Set remaining ones to slideshow priority.
- new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
- }
- else if((impl_count_interest_normal < (int)max_normal) && !media_is_small)
- {
- // Up to max_normal inworld get normal priority
- new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
- impl_count_interest_normal++;
- }
- else if (impl_count_interest_low + impl_count_interest_normal < (int)max_low + (int)max_normal)
- {
- // The next max_low inworld get turned down
- new_priority = LLPluginClassMedia::PRIORITY_LOW;
- impl_count_interest_low++;
-
- // Set the low priority size for downsampling to approximately the size the texture is displayed at.
- {
- F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest());
-
- pimpl->setLowPrioritySizeLimit(ll_round(approximate_interest_dimension));
- }
- }
- else
- {
- // Any additional impls (up to max_instances) get very infrequent time
- new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
- }
- }
-
- if(!pimpl->getUsedInUI() && (new_priority != LLPluginClassMedia::PRIORITY_UNLOADED))
- {
- // This is a loadable inworld impl -- the last one in the list in this class defines the lowest loadable interest.
- lowest_interest_loadable = pimpl;
-
- impl_count_total++;
- }
-
- // Overrides if the window is minimized or we lost focus (taking care
- // not to accidentally "raise" the priority either)
- if (!gViewerWindow->getActive() /* viewer window minimized? */
- && new_priority > LLPluginClassMedia::PRIORITY_HIDDEN)
- {
- new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
- }
- else if (!gFocusMgr.getAppHasFocus() /* viewer window lost focus? */
- && new_priority > LLPluginClassMedia::PRIORITY_LOW)
- {
- new_priority = LLPluginClassMedia::PRIORITY_LOW;
- }
-
- if(!inworld_media_enabled)
- {
- // If inworld media is locked out, force all inworld media to stay unloaded.
- if(!pimpl->getUsedInUI())
- {
- new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
- }
- }
- // update the audio stream here as well
- static bool restore_parcel_audio = false;
- if( !inworld_audio_enabled)
- {
- if(LLViewerMedia::isParcelAudioPlaying() && gAudiop && LLViewerMedia::hasParcelAudio())
- {
- LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
- restore_parcel_audio = true;
- }
- }
+ for(; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+
+ LLPluginClassMedia::EPriority new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+
+ if(pimpl->isForcedUnloaded() || (impl_count_total >= (int)max_instances))
+ {
+ // Never load muted or failed impls.
+ // Hard limit on the number of instances that will be loaded at one time
+ new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
+ }
+ else if(!pimpl->getVisible())
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+ }
+ else if(pimpl->hasFocus())
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_HIGH;
+ impl_count_interest_normal++; // count this against the count of "normal" instances for priority purposes
+ }
+ else if(pimpl->getUsedInUI())
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+ impl_count_interest_normal++;
+ }
+ else if(pimpl->isParcelMedia())
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+ impl_count_interest_normal++;
+ }
+ else
+ {
+ // Look at interest and CPU usage for instances that aren't in any of the above states.
+
+ // Heuristic -- if the media texture's approximate screen area is less than 1/4 of the native area of the texture,
+ // turn it down to low instead of normal. This may downsample for plugins that support it.
+ bool media_is_small = false;
+ F64 approximate_interest = pimpl->getApproximateTextureInterest();
+ if(approximate_interest == 0.0f)
+ {
+ // this media has no current size, which probably means it's not loaded.
+ media_is_small = true;
+ }
+ else if(pimpl->getInterest() < (approximate_interest / 4))
+ {
+ media_is_small = true;
+ }
+
+ if(pimpl->getInterest() == 0.0f)
+ {
+ // This media is completely invisible, due to being outside the view frustrum or out of range.
+ new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+ }
+ else if(check_cpu_usage && (total_cpu > max_cpu))
+ {
+ // Higher priority plugins have already used up the CPU budget. Set remaining ones to slideshow priority.
+ new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
+ }
+ else if((impl_count_interest_normal < (int)max_normal) && !media_is_small)
+ {
+ // Up to max_normal inworld get normal priority
+ new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+ impl_count_interest_normal++;
+ }
+ else if (impl_count_interest_low + impl_count_interest_normal < (int)max_low + (int)max_normal)
+ {
+ // The next max_low inworld get turned down
+ new_priority = LLPluginClassMedia::PRIORITY_LOW;
+ impl_count_interest_low++;
+
+ // Set the low priority size for downsampling to approximately the size the texture is displayed at.
+ {
+ F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest());
+
+ pimpl->setLowPrioritySizeLimit(ll_round(approximate_interest_dimension));
+ }
+ }
+ else
+ {
+ // Any additional impls (up to max_instances) get very infrequent time
+ new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
+ }
+ }
+
+ if(!pimpl->getUsedInUI() && (new_priority != LLPluginClassMedia::PRIORITY_UNLOADED))
+ {
+ // This is a loadable inworld impl -- the last one in the list in this class defines the lowest loadable interest.
+ lowest_interest_loadable = pimpl;
+
+ impl_count_total++;
+ }
+
+ // Overrides if the window is minimized or we lost focus (taking care
+ // not to accidentally "raise" the priority either)
+ if (!gViewerWindow->getActive() /* viewer window minimized? */
+ && new_priority > LLPluginClassMedia::PRIORITY_HIDDEN)
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+ }
+ else if (!gFocusMgr.getAppHasFocus() /* viewer window lost focus? */
+ && new_priority > LLPluginClassMedia::PRIORITY_LOW)
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_LOW;
+ }
+
+ if(!inworld_media_enabled)
+ {
+ // If inworld media is locked out, force all inworld media to stay unloaded.
+ if(!pimpl->getUsedInUI())
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
+ }
+ }
+ // update the audio stream here as well
+ static bool restore_parcel_audio = false;
+ if( !inworld_audio_enabled)
+ {
+ if(LLViewerMedia::isParcelAudioPlaying() && gAudiop && LLViewerMedia::hasParcelAudio())
+ {
+ LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
+ restore_parcel_audio = true;
+ }
+ }
else
{
if(gAudiop && LLViewerMedia::hasParcelAudio() && restore_parcel_audio && gSavedSettings.getBOOL("MediaTentativeAutoPlay"))
@@ -836,76 +836,76 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
}
- pimpl->setPriority(new_priority);
-
- if(pimpl->getUsedInUI())
- {
- // Any impls used in the UI should not be in the proximity list.
- pimpl->mProximity = -1;
- }
- else
- {
- proximity_order.push_back(pimpl);
- }
-
- total_cpu += pimpl->getCPUUsage();
-
- if (!pimpl->getUsedInUI() && pimpl->hasMedia())
- {
- mAnyMediaShowing = true;
- }
-
- if (!pimpl->getUsedInUI() && pimpl->hasMedia() && (pimpl->isMediaPlaying() || !pimpl->isMediaTimeBased()))
- {
- // consider visible non-timebased media as playing
- mAnyMediaPlaying = true;
- }
-
- }
- }
-
- // Re-calculate this every time.
- sLowestLoadableImplInterest = 0.0f;
-
- // Only do this calculation if we've hit the impl count limit -- up until that point we always need to load media data.
- if(lowest_interest_loadable && (impl_count_total >= (int)max_instances))
- {
- // Get the interest value of this impl's object for use by isInterestingEnough
- LLVOVolume *object = lowest_interest_loadable->getSomeObject();
- if(object)
- {
- // NOTE: Don't use getMediaInterest() here. We want the pixel area, not the total media interest,
- // so that we match up with the calculation done in LLMediaDataClient.
- sLowestLoadableImplInterest = object->getPixelArea();
- }
- }
-
- if(gSavedSettings.getBOOL("MediaPerformanceManagerDebug"))
- {
- // Give impls the same ordering as the priority list
- // they're already in the right order for this.
- }
- else
- {
+ pimpl->setPriority(new_priority);
+
+ if(pimpl->getUsedInUI())
+ {
+ // Any impls used in the UI should not be in the proximity list.
+ pimpl->mProximity = -1;
+ }
+ else
+ {
+ proximity_order.push_back(pimpl);
+ }
+
+ total_cpu += pimpl->getCPUUsage();
+
+ if (!pimpl->getUsedInUI() && pimpl->hasMedia())
+ {
+ mAnyMediaShowing = true;
+ }
+
+ if (!pimpl->getUsedInUI() && pimpl->hasMedia() && (pimpl->isMediaPlaying() || !pimpl->isMediaTimeBased()))
+ {
+ // consider visible non-timebased media as playing
+ mAnyMediaPlaying = true;
+ }
+
+ }
+ }
+
+ // Re-calculate this every time.
+ sLowestLoadableImplInterest = 0.0f;
+
+ // Only do this calculation if we've hit the impl count limit -- up until that point we always need to load media data.
+ if(lowest_interest_loadable && (impl_count_total >= (int)max_instances))
+ {
+ // Get the interest value of this impl's object for use by isInterestingEnough
+ LLVOVolume *object = lowest_interest_loadable->getSomeObject();
+ if(object)
+ {
+ // NOTE: Don't use getMediaInterest() here. We want the pixel area, not the total media interest,
+ // so that we match up with the calculation done in LLMediaDataClient.
+ sLowestLoadableImplInterest = object->getPixelArea();
+ }
+ }
+
+ if(gSavedSettings.getBOOL("MediaPerformanceManagerDebug"))
+ {
+ // Give impls the same ordering as the priority list
+ // they're already in the right order for this.
+ }
+ else
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media sort2"); // LL_RECORD_BLOCK_TIME(FTM_MEDIA_SORT2);
- // Use a distance-based sort for proximity values.
- std::stable_sort(proximity_order.begin(), proximity_order.end(), proximity_comparitor);
- }
+ // Use a distance-based sort for proximity values.
+ std::stable_sort(proximity_order.begin(), proximity_order.end(), proximity_comparitor);
+ }
- // Transfer the proximity order to the proximity fields in the objects.
- for(int i = 0; i < (int)proximity_order.size(); i++)
- {
- proximity_order[i]->mProximity = i;
- }
+ // Transfer the proximity order to the proximity fields in the objects.
+ for(int i = 0; i < (int)proximity_order.size(); i++)
+ {
+ proximity_order[i]->mProximity = i;
+ }
- LL_DEBUGS("PluginPriority") << "Total reported CPU usage is " << total_cpu << LL_ENDL;
+ LL_DEBUGS("PluginPriority") << "Total reported CPU usage is " << total_cpu << LL_ENDL;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMedia::isAnyMediaShowing()
{
- return mAnyMediaShowing;
+ return mAnyMediaShowing;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -917,56 +917,56 @@ bool LLViewerMedia::isAnyMediaPlaying()
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::setAllMediaEnabled(bool val)
{
- // Set "tentative" autoplay first. We need to do this here or else
- // re-enabling won't start up the media below.
- gSavedSettings.setBOOL("MediaTentativeAutoPlay", val);
-
- // Then
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
-
- for(; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- if (!pimpl->getUsedInUI())
- {
- pimpl->setDisabled(!val);
- }
- }
-
- // Also do Parcel Media and Parcel Audio
- if (val)
- {
- if (!LLViewerMedia::isParcelMediaPlaying() && LLViewerMedia::hasParcelMedia())
- {
- LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
- }
-
- static LLCachedControl<bool> audio_streaming_music(gSavedSettings, "AudioStreamingMusic", true);
- if (audio_streaming_music &&
- !LLViewerMedia::isParcelAudioPlaying() &&
- gAudiop &&
- LLViewerMedia::hasParcelAudio())
- {
- if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying())
- {
- // 'false' means unpause
- gAudiop->pauseInternetStream(false);
- }
- else
- {
- LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL());
- }
- }
- }
- else {
- // This actually unloads the impl, as opposed to "stop"ping the media
- LLViewerParcelMedia::getInstance()->stop();
- if (gAudiop)
- {
- LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
- }
- }
+ // Set "tentative" autoplay first. We need to do this here or else
+ // re-enabling won't start up the media below.
+ gSavedSettings.setBOOL("MediaTentativeAutoPlay", val);
+
+ // Then
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
+
+ for(; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ if (!pimpl->getUsedInUI())
+ {
+ pimpl->setDisabled(!val);
+ }
+ }
+
+ // Also do Parcel Media and Parcel Audio
+ if (val)
+ {
+ if (!LLViewerMedia::isParcelMediaPlaying() && LLViewerMedia::hasParcelMedia())
+ {
+ LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
+ }
+
+ static LLCachedControl<bool> audio_streaming_music(gSavedSettings, "AudioStreamingMusic", true);
+ if (audio_streaming_music &&
+ !LLViewerMedia::isParcelAudioPlaying() &&
+ gAudiop &&
+ LLViewerMedia::hasParcelAudio())
+ {
+ if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying())
+ {
+ // 'false' means unpause
+ gAudiop->pauseInternetStream(false);
+ }
+ else
+ {
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL());
+ }
+ }
+ }
+ else {
+ // This actually unloads the impl, as opposed to "stop"ping the media
+ LLViewerParcelMedia::getInstance()->stop();
+ if (gAudiop)
+ {
+ LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -1058,7 +1058,7 @@ bool LLViewerMedia::isParcelMediaPlaying()
/////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMedia::isParcelAudioPlaying()
{
- return (LLViewerMedia::hasParcelAudio() && gAudiop && LLAudioEngine::AUDIO_PLAYING == gAudiop->isInternetStreamPlaying());
+ return (LLViewerMedia::hasParcelAudio() && gAudiop && LLAudioEngine::AUDIO_PLAYING == gAudiop->isInternetStreamPlaying());
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1070,120 +1070,120 @@ void LLViewerMedia::authSubmitCallback(const LLSD& notification, const LLSD& res
void LLViewerMedia::onAuthSubmit(const LLSD& notification, const LLSD& response)
{
- LLViewerMediaImpl *impl = LLViewerMedia::getMediaImplFromTextureID(notification["payload"]["media_id"]);
- if(impl)
- {
- LLPluginClassMedia* media = impl->getMediaPlugin();
- if(media)
- {
- if (response["ok"])
- {
- media->sendAuthResponse(true, response["username"], response["password"]);
- }
- else
- {
- media->sendAuthResponse(false, "", "");
- }
- }
- }
+ LLViewerMediaImpl *impl = LLViewerMedia::getMediaImplFromTextureID(notification["payload"]["media_id"]);
+ if(impl)
+ {
+ LLPluginClassMedia* media = impl->getMediaPlugin();
+ if(media)
+ {
+ if (response["ok"])
+ {
+ media->sendAuthResponse(true, response["username"], response["password"]);
+ }
+ else
+ {
+ media->sendAuthResponse(false, "", "");
+ }
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::clearAllCookies()
{
- // Clear all cookies for all plugins
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
- for (; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- if(pimpl->mMediaSource)
- {
- pimpl->mMediaSource->clear_cookies();
- }
- }
+ // Clear all cookies for all plugins
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
+ for (; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ if(pimpl->mMediaSource)
+ {
+ pimpl->mMediaSource->clear_cookies();
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::clearAllCaches()
{
- // Clear all plugins' caches
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
- for (; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- pimpl->clearCache();
- }
+ // Clear all plugins' caches
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
+ for (; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ pimpl->clearCache();
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::setCookiesEnabled(bool enabled)
{
- // Set the "cookies enabled" flag for all loaded plugins
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
- for (; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- if(pimpl->mMediaSource)
- {
- pimpl->mMediaSource->cookies_enabled(enabled);
- }
- }
+ // Set the "cookies enabled" flag for all loaded plugins
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
+ for (; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ if(pimpl->mMediaSource)
+ {
+ pimpl->mMediaSource->cookies_enabled(enabled);
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int port)
{
- // Set the proxy config for all loaded plugins
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
- for (; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- if(pimpl->mMediaSource)
- {
- pimpl->mMediaSource->proxy_setup(enable, host, port);
- }
- }
+ // Set the proxy config for all loaded plugins
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
+ for (; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ if(pimpl->mMediaSource)
+ {
+ pimpl->mMediaSource->proxy_setup(enable, host, port);
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
LLSD LLViewerMedia::getHeaders()
{
- LLSD headers = LLSD::emptyMap();
- headers[HTTP_OUT_HEADER_ACCEPT] = "*/*";
- // *TODO: Should this be 'application/llsd+xml' ?
- // *TODO: Should this even be set at all? This header is only not overridden in 'GET' methods.
- headers[HTTP_OUT_HEADER_CONTENT_TYPE] = HTTP_CONTENT_XML;
- headers[HTTP_OUT_HEADER_COOKIE] = mOpenIDCookie;
- headers[HTTP_OUT_HEADER_USER_AGENT] = getCurrentUserAgent();
+ LLSD headers = LLSD::emptyMap();
+ headers[HTTP_OUT_HEADER_ACCEPT] = "*/*";
+ // *TODO: Should this be 'application/llsd+xml' ?
+ // *TODO: Should this even be set at all? This header is only not overridden in 'GET' methods.
+ headers[HTTP_OUT_HEADER_CONTENT_TYPE] = HTTP_CONTENT_XML;
+ headers[HTTP_OUT_HEADER_COOKIE] = mOpenIDCookie;
+ headers[HTTP_OUT_HEADER_USER_AGENT] = getCurrentUserAgent();
- return headers;
+ return headers;
}
/////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path, bool& httponly, bool& secure)
{
- std::size_t name_pos = raw_cookie.find_first_of("=");
- if (name_pos != std::string::npos)
- {
- name = raw_cookie.substr(0, name_pos);
- std::size_t value_pos = raw_cookie.find_first_of(";", name_pos);
- if (value_pos != std::string::npos)
- {
- value = raw_cookie.substr(name_pos + 1, value_pos - name_pos - 1);
- path = "/"; // assume root path for now
+ std::size_t name_pos = raw_cookie.find_first_of("=");
+ if (name_pos != std::string::npos)
+ {
+ name = raw_cookie.substr(0, name_pos);
+ std::size_t value_pos = raw_cookie.find_first_of(";", name_pos);
+ if (value_pos != std::string::npos)
+ {
+ value = raw_cookie.substr(name_pos + 1, value_pos - name_pos - 1);
+ path = "/"; // assume root path for now
- httponly = true; // hard coded for now
- secure = true;
+ httponly = true; // hard coded for now
+ secure = true;
- return true;
- }
- }
+ return true;
+ }
+ }
- return false;
+ return false;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1203,13 +1203,13 @@ LLCore::HttpHeaders::ptr_t LLViewerMedia::getHttpHeaders()
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::setOpenIDCookie(const std::string& url)
{
- if(!gNonInteractive && !mOpenIDCookie.empty())
- {
+ if(!gNonInteractive && !mOpenIDCookie.empty())
+ {
std::string profileUrl = getProfileURL("");
LLCoros::instance().launch("LLViewerMedia::getOpenIDCookieCoro",
boost::bind(&LLViewerMedia::getOpenIDCookieCoro, profileUrl));
- }
+ }
}
//static
@@ -1221,7 +1221,7 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders);
-
+
httpOpts->setFollowRedirects(true);
httpOpts->setWantHeaders(true);
httpOpts->setSSLVerifyPeer(false); // viewer's cert bundle doesn't appear to agree with web certs from "https://my.secondlife.com/"
@@ -1229,7 +1229,7 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
LLURL hostUrl(url.c_str());
std::string hostAuth = hostUrl.getAuthority();
- // *TODO: Expand LLURL to split and extract this information better.
+ // *TODO: Expand LLURL to split and extract this information better.
// The structure of a URL is well defined and needing to retrieve parts of it are common.
// original comment:
// The LLURL can give me the 'authority', which is of the form: [username[:password]@]hostname[:port]
@@ -1242,8 +1242,8 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
hostStart = 0;
}
else
- { // Hostname starts after the @.
- // Hostname starts after the @.
+ { // Hostname starts after the @.
+ // Hostname starts after the @.
// (If the hostname part is empty, this may put host_start at the end of the string. In that case, it will end up passing through an empty hostname, which is correct.)
++hostStart;
}
@@ -1252,54 +1252,54 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
{ // no port
hostEnd = authority.size();
}
-
- LLViewerMedia* inst = getInstance();
- if (url.length())
- {
- LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
- if (media_instance)
- {
- std::string cookie_host = authority.substr(hostStart, hostEnd - hostStart);
- std::string cookie_name = "";
- std::string cookie_value = "";
- std::string cookie_path = "";
- bool httponly = true;
- bool secure = true;
- if (inst->parseRawCookie(inst->mOpenIDCookie, cookie_name, cookie_value, cookie_path, httponly, secure) &&
- media_instance->getMediaPlugin())
- {
- // MAINT-5711 - inexplicably, the CEF setCookie function will no longer set the cookie if the
- // url and domain are not the same. This used to be my.sl.com and id.sl.com respectively and worked.
- // For now, we use the URL for the OpenID POST request since it will have the same authority
- // as the domain field.
- // (Feels like there must be a less dirty way to construct a URL from component LLURL parts)
- // MAINT-6392 - Rider: Do not change, however, the original URI requested, since it is used further
- // down.
- std::string cefUrl(std::string(inst->mOpenIDURL.mURI) + "://" + std::string(inst->mOpenIDURL.mAuthority));
-
- media_instance->getMediaPlugin()->setCookie(cefUrl, cookie_name, cookie_value, cookie_host,
+
+ LLViewerMedia* inst = getInstance();
+ if (url.length())
+ {
+ LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
+ if (media_instance)
+ {
+ std::string cookie_host = authority.substr(hostStart, hostEnd - hostStart);
+ std::string cookie_name = "";
+ std::string cookie_value = "";
+ std::string cookie_path = "";
+ bool httponly = true;
+ bool secure = true;
+ if (inst->parseRawCookie(inst->mOpenIDCookie, cookie_name, cookie_value, cookie_path, httponly, secure) &&
+ media_instance->getMediaPlugin())
+ {
+ // MAINT-5711 - inexplicably, the CEF setCookie function will no longer set the cookie if the
+ // url and domain are not the same. This used to be my.sl.com and id.sl.com respectively and worked.
+ // For now, we use the URL for the OpenID POST request since it will have the same authority
+ // as the domain field.
+ // (Feels like there must be a less dirty way to construct a URL from component LLURL parts)
+ // MAINT-6392 - Rider: Do not change, however, the original URI requested, since it is used further
+ // down.
+ std::string cefUrl(std::string(inst->mOpenIDURL.mURI) + "://" + std::string(inst->mOpenIDURL.mAuthority));
+
+ media_instance->getMediaPlugin()->setCookie(cefUrl, cookie_name, cookie_value, cookie_host,
cookie_path, httponly, secure);
// Now that we have parsed the raw cookie, we must store it so that each new media instance
// can also get a copy and faciliate logging into internal SL sites.
- media_instance->getMediaPlugin()->storeOpenIDCookie(cefUrl, cookie_name, cookie_value,
+ media_instance->getMediaPlugin()->storeOpenIDCookie(cefUrl, cookie_name, cookie_value,
cookie_host, cookie_path, httponly, secure);
- }
- }
- }
+ }
+ }
+ }
- // Note: Rider: MAINT-6392 - Some viewer code requires access to the my.sl.com openid cookie for such
- // actions as posting snapshots to the feed. This is handled through HTTPCore rather than CEF and so
+ // Note: Rider: MAINT-6392 - Some viewer code requires access to the my.sl.com openid cookie for such
+ // actions as posting snapshots to the feed. This is handled through HTTPCore rather than CEF and so
// we must learn to SHARE the cookies.
- // Do a web profile get so we can store the cookie
+ // Do a web profile get so we can store the cookie
httpHeaders->append(HTTP_OUT_HEADER_ACCEPT, "*/*");
httpHeaders->append(HTTP_OUT_HEADER_COOKIE, inst->mOpenIDCookie);
httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, inst->getCurrentUserAgent());
LL_DEBUGS("MediaAuth") << "Requesting " << url << LL_ENDL;
LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << inst->mOpenIDCookie << "]" << LL_ENDL;
-
+
LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts, httpHeaders);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
@@ -1329,7 +1329,7 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::openIDSetup(const std::string &openidUrl, const std::string &openidToken)
{
- LL_DEBUGS("MediaAuth") << "url = \"" << openidUrl << "\", token = \"" << openidToken << "\"" << LL_ENDL;
+ LL_DEBUGS("MediaAuth") << "url = \"" << openidUrl << "\", token = \"" << openidToken << "\"" << LL_ENDL;
LLCoros::instance().launch("LLViewerMedia::openIDSetupCoro",
boost::bind(&LLViewerMedia::openIDSetupCoro, openidUrl, openidToken));
@@ -1346,11 +1346,11 @@ void LLViewerMedia::openIDSetupCoro(std::string openidUrl, std::string openidTok
httpOpts->setWantHeaders(true);
- // post the token to the url
+ // post the token to the url
// the responder will need to extract the cookie(s).
// Save the OpenID URL for later -- we may need the host when adding the cookie.
getInstance()->mOpenIDURL.init(openidUrl.c_str());
-
+
// We shouldn't ever do this twice, but just in case this code gets repurposed later, clear existing cookies.
getInstance()->mOpenIDCookie.clear();
@@ -1383,200 +1383,200 @@ void LLViewerMedia::openIDSetupCoro(std::string openidUrl, std::string openidTok
// We don't care about the content of the response, only the Set-Cookie header.
const std::string& cookie = resultHeaders[HTTP_IN_HEADER_SET_COOKIE].asString();
- // *TODO: What about bad status codes? Does this destroy previous cookies?
+ // *TODO: What about bad status codes? Does this destroy previous cookies?
LLViewerMedia::getInstance()->openIDCookieResponse(openidUrl, cookie);
LL_DEBUGS("MediaAuth") << "OpenID cookie set." << LL_ENDL;
-
+
}
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::openIDCookieResponse(const std::string& url, const std::string &cookie)
{
- LL_DEBUGS("MediaAuth") << "Cookie received: \"" << cookie << "\"" << LL_ENDL;
+ LL_DEBUGS("MediaAuth") << "Cookie received: \"" << cookie << "\"" << LL_ENDL;
- mOpenIDCookie += cookie;
+ mOpenIDCookie += cookie;
- setOpenIDCookie(url);
+ setOpenIDCookie(url);
}
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::proxyWindowOpened(const std::string &target, const std::string &uuid)
{
- if(uuid.empty())
- return;
+ if(uuid.empty())
+ return;
- for (impl_list::iterator iter = sViewerMediaImplList.begin(); iter != sViewerMediaImplList.end(); iter++)
- {
- if((*iter)->mMediaSource && (*iter)->mMediaSource->pluginSupportsMediaBrowser())
- {
- (*iter)->mMediaSource->proxyWindowOpened(target, uuid);
- }
- }
+ for (impl_list::iterator iter = sViewerMediaImplList.begin(); iter != sViewerMediaImplList.end(); iter++)
+ {
+ if((*iter)->mMediaSource && (*iter)->mMediaSource->pluginSupportsMediaBrowser())
+ {
+ (*iter)->mMediaSource->proxyWindowOpened(target, uuid);
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::proxyWindowClosed(const std::string &uuid)
{
- if(uuid.empty())
- return;
+ if(uuid.empty())
+ return;
- for (impl_list::iterator iter = sViewerMediaImplList.begin(); iter != sViewerMediaImplList.end(); iter++)
- {
- if((*iter)->mMediaSource && (*iter)->mMediaSource->pluginSupportsMediaBrowser())
- {
- (*iter)->mMediaSource->proxyWindowClosed(uuid);
- }
- }
+ for (impl_list::iterator iter = sViewerMediaImplList.begin(); iter != sViewerMediaImplList.end(); iter++)
+ {
+ if((*iter)->mMediaSource && (*iter)->mMediaSource->pluginSupportsMediaBrowser())
+ {
+ (*iter)->mMediaSource->proxyWindowClosed(uuid);
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::createSpareBrowserMediaSource()
{
- // If we don't have a spare browser media source, create one.
- // However, if PluginAttachDebuggerToPlugins is set then don't spawn a spare
- // SLPlugin process in order to not be confused by an unrelated gdb terminal
- // popping up at the moment we start a media plugin.
- if (!mSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))
- {
- // The null owner will keep the browser plugin from fully initializing
- // (specifically, it keeps LLPluginClassMedia from negotiating a size change,
- // which keeps MediaPluginWebkit::initBrowserWindow from doing anything until we have some necessary data, like the background color)
- mSpareBrowserMediaSource = LLViewerMediaImpl::newSourceFromMediaType(HTTP_CONTENT_TEXT_HTML, NULL, 0, 0, 1.0);
- }
+ // If we don't have a spare browser media source, create one.
+ // However, if PluginAttachDebuggerToPlugins is set then don't spawn a spare
+ // SLPlugin process in order to not be confused by an unrelated gdb terminal
+ // popping up at the moment we start a media plugin.
+ if (!mSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))
+ {
+ // The null owner will keep the browser plugin from fully initializing
+ // (specifically, it keeps LLPluginClassMedia from negotiating a size change,
+ // which keeps MediaPluginWebkit::initBrowserWindow from doing anything until we have some necessary data, like the background color)
+ mSpareBrowserMediaSource = LLViewerMediaImpl::newSourceFromMediaType(HTTP_CONTENT_TEXT_HTML, NULL, 0, 0, 1.0);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
LLPluginClassMedia* LLViewerMedia::getSpareBrowserMediaSource()
{
- LLPluginClassMedia* result = mSpareBrowserMediaSource;
- mSpareBrowserMediaSource = NULL;
- return result;
+ LLPluginClassMedia* result = mSpareBrowserMediaSource;
+ mSpareBrowserMediaSource = NULL;
+ return result;
};
bool LLViewerMedia::hasInWorldMedia()
{
- impl_list::iterator iter = sViewerMediaImplList.begin();
- impl_list::iterator end = sViewerMediaImplList.end();
- // This should be quick, because there should be very few non-in-world-media impls
- for (; iter != end; iter++)
- {
- LLViewerMediaImpl* pimpl = *iter;
- if (!pimpl->getUsedInUI() && !pimpl->isParcelMedia())
- {
- // Found an in-world media impl
- return true;
- }
- }
- return false;
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
+ // This should be quick, because there should be very few non-in-world-media impls
+ for (; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ if (!pimpl->getUsedInUI() && !pimpl->isParcelMedia())
+ {
+ // Found an in-world media impl
+ return true;
+ }
+ }
+ return false;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMedia::hasParcelMedia()
{
- return !LLViewerParcelMedia::getInstance()->getURL().empty();
+ return !LLViewerParcelMedia::getInstance()->getURL().empty();
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMedia::hasParcelAudio()
{
- return !LLViewerMedia::getParcelAudioURL().empty();
+ return !LLViewerMedia::getParcelAudioURL().empty();
}
//////////////////////////////////////////////////////////////////////////////////////////
std::string LLViewerMedia::getParcelAudioURL()
{
- return LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL();
+ return LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL();
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::onTeleportFinished()
{
- // On teleport, clear this setting (i.e. set it to true)
- gSavedSettings.setBOOL("MediaTentativeAutoPlay", true);
+ // On teleport, clear this setting (i.e. set it to true)
+ gSavedSettings.setBOOL("MediaTentativeAutoPlay", true);
- LLViewerMediaImpl::sMimeTypesFailed.clear();
+ LLViewerMediaImpl::sMimeTypesFailed.clear();
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::setOnlyAudibleMediaTextureID(const LLUUID& texture_id)
{
- sOnlyAudibleTextureID = texture_id;
- sForceUpdate = true;
+ sOnlyAudibleTextureID = texture_id;
+ sForceUpdate = true;
}
std::vector<std::string> LLViewerMediaImpl::sMimeTypesFailed;
//////////////////////////////////////////////////////////////////////////////////////////
// LLViewerMediaImpl
//////////////////////////////////////////////////////////////////////////////////////////
-LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
- S32 media_width,
- S32 media_height,
- U8 media_auto_scale,
- U8 media_loop)
+LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
+ S32 media_width,
+ S32 media_height,
+ U8 media_auto_scale,
+ U8 media_loop)
:
- mMediaSource( NULL ),
- mMovieImageHasMips(false),
- mMediaWidth(media_width),
- mMediaHeight(media_height),
- mMediaAutoScale(media_auto_scale),
- mMediaLoop(media_loop),
- mNeedsNewTexture(true),
- mTextureUsedWidth(0),
- mTextureUsedHeight(0),
- mSuspendUpdates(false),
- mVisible(true),
- mLastSetCursor( UI_CURSOR_ARROW ),
- mMediaNavState( MEDIANAVSTATE_NONE ),
- mInterest(0.0f),
- mUsedInUI(false),
- mHasFocus(false),
- mPriority(LLPluginClassMedia::PRIORITY_UNLOADED),
- mNavigateRediscoverType(false),
- mNavigateServerRequest(false),
- mMediaSourceFailed(false),
- mRequestedVolume(1.0f),
- mPreviousVolume(1.0f),
- mIsMuted(false),
- mNeedsMuteCheck(false),
- mPreviousMediaState(MEDIA_NONE),
- mPreviousMediaTime(0.0f),
- mIsDisabled(false),
- mIsParcelMedia(false),
- mProximity(-1),
- mProximityDistance(0.0f),
- mMediaAutoPlay(false),
- mInNearbyMediaList(false),
- mClearCache(false),
- mBackgroundColor(LLColor4::white),
- mNavigateSuspended(false),
- mNavigateSuspendedDeferred(false),
- mIsUpdated(false),
- mTrustedBrowser(false),
- mZoomFactor(1.0),
+ mMediaSource( NULL ),
+ mMovieImageHasMips(false),
+ mMediaWidth(media_width),
+ mMediaHeight(media_height),
+ mMediaAutoScale(media_auto_scale),
+ mMediaLoop(media_loop),
+ mNeedsNewTexture(true),
+ mTextureUsedWidth(0),
+ mTextureUsedHeight(0),
+ mSuspendUpdates(false),
+ mVisible(true),
+ mLastSetCursor( UI_CURSOR_ARROW ),
+ mMediaNavState( MEDIANAVSTATE_NONE ),
+ mInterest(0.0f),
+ mUsedInUI(false),
+ mHasFocus(false),
+ mPriority(LLPluginClassMedia::PRIORITY_UNLOADED),
+ mNavigateRediscoverType(false),
+ mNavigateServerRequest(false),
+ mMediaSourceFailed(false),
+ mRequestedVolume(1.0f),
+ mPreviousVolume(1.0f),
+ mIsMuted(false),
+ mNeedsMuteCheck(false),
+ mPreviousMediaState(MEDIA_NONE),
+ mPreviousMediaTime(0.0f),
+ mIsDisabled(false),
+ mIsParcelMedia(false),
+ mProximity(-1),
+ mProximityDistance(0.0f),
+ mMediaAutoPlay(false),
+ mInNearbyMediaList(false),
+ mClearCache(false),
+ mBackgroundColor(LLColor4::white),
+ mNavigateSuspended(false),
+ mNavigateSuspendedDeferred(false),
+ mIsUpdated(false),
+ mTrustedBrowser(false),
+ mZoomFactor(1.0),
mCleanBrowser(false),
mMimeProbe(),
mCanceling(false)
{
- // Set up the mute list observer if it hasn't been set up already.
- if(!sViewerMediaMuteListObserverInitialized)
- {
- LLMuteList::getInstance()->addObserver(&sViewerMediaMuteListObserver);
- sViewerMediaMuteListObserverInitialized = true;
- }
+ // Set up the mute list observer if it hasn't been set up already.
+ if(!sViewerMediaMuteListObserverInitialized)
+ {
+ LLMuteList::getInstance()->addObserver(&sViewerMediaMuteListObserver);
+ sViewerMediaMuteListObserverInitialized = true;
+ }
- add_media_impl(this);
+ add_media_impl(this);
- setTextureID(texture_id);
+ setTextureID(texture_id);
- // connect this media_impl to the media texture, creating it if it doesn't exist.0
- // This is necessary because we need to be able to use getMaxVirtualSize() even if the media plugin is not loaded.
+ // connect this media_impl to the media texture, creating it if it doesn't exist.0
+ // This is necessary because we need to be able to use getMaxVirtualSize() even if the media plugin is not loaded.
// *TODO: Consider enabling mipmaps (they have been disabled for a long time). Likely has a significant performance impact for tiled/high texture repeat media. Mip generation in a shader may also be an option if necessary.
- LLViewerMediaTexture* media_tex = LLViewerTextureManager::getMediaTexture(mTextureId, USE_MIPMAPS);
- if(media_tex)
- {
- media_tex->setMediaImpl();
- }
+ LLViewerMediaTexture* media_tex = LLViewerTextureManager::getMediaTexture(mTextureId, USE_MIPMAPS);
+ if(media_tex)
+ {
+ media_tex->setMediaImpl();
+ }
mMainQueue = LL::WorkQueue::getInstance("mainloop");
mTexUpdateQueue = LL::WorkQueue::getInstance("LLImageGL"); // Share work queue with tex loader.
@@ -1585,86 +1585,86 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
//////////////////////////////////////////////////////////////////////////////////////////
LLViewerMediaImpl::~LLViewerMediaImpl()
{
- destroyMediaSource();
+ destroyMediaSource();
- LLViewerMediaTexture::removeMediaImplFromTexture(mTextureId) ;
+ LLViewerMediaTexture::removeMediaImplFromTexture(mTextureId) ;
- setTextureID();
- remove_media_impl(this);
+ setTextureID();
+ remove_media_impl(this);
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::emitEvent(LLPluginClassMedia* plugin, LLViewerMediaObserver::EMediaEvent event)
{
- // Broadcast to observers using the superclass version
- LLViewerMediaEventEmitter::emitEvent(plugin, event);
+ // Broadcast to observers using the superclass version
+ LLViewerMediaEventEmitter::emitEvent(plugin, event);
- // If this media is on one or more LLVOVolume objects, tell them about the event as well.
- std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
- while(iter != mObjectList.end())
- {
- LLVOVolume *self = *iter;
- ++iter;
- self->mediaEvent(this, plugin, event);
- }
+ // If this media is on one or more LLVOVolume objects, tell them about the event as well.
+ std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
+ while(iter != mObjectList.end())
+ {
+ LLVOVolume *self = *iter;
+ ++iter;
+ self->mediaEvent(this, plugin, event);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::initializeMedia(const std::string& mime_type)
{
- bool mimeTypeChanged = (mMimeType != mime_type);
- bool pluginChanged = (LLMIMETypes::implType(mCurrentMimeType) != LLMIMETypes::implType(mime_type));
+ bool mimeTypeChanged = (mMimeType != mime_type);
+ bool pluginChanged = (LLMIMETypes::implType(mCurrentMimeType) != LLMIMETypes::implType(mime_type));
- if(!mMediaSource || pluginChanged)
- {
- // We don't have a plugin at all, or the new mime type is handled by a different plugin than the old mime type.
- (void)initializePlugin(mime_type);
- }
- else if(mimeTypeChanged)
- {
- // The same plugin should be able to handle the new media -- just update the stored mime type.
- mMimeType = mime_type;
- }
+ if(!mMediaSource || pluginChanged)
+ {
+ // We don't have a plugin at all, or the new mime type is handled by a different plugin than the old mime type.
+ (void)initializePlugin(mime_type);
+ }
+ else if(mimeTypeChanged)
+ {
+ // The same plugin should be able to handle the new media -- just update the stored mime type.
+ mMimeType = mime_type;
+ }
- return (mMediaSource != NULL);
+ return (mMediaSource != NULL);
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::createMediaSource()
{
- if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED)
- {
- // This media shouldn't be created yet.
- return;
- }
+ if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED)
+ {
+ // This media shouldn't be created yet.
+ return;
+ }
- if(! mMediaURL.empty())
- {
- navigateInternal();
- }
- else if(! mMimeType.empty())
- {
- if (!initializeMedia(mMimeType))
- {
- LL_WARNS("Media") << "Failed to initialize media for mime type " << mMimeType << LL_ENDL;
- }
- }
+ if(! mMediaURL.empty())
+ {
+ navigateInternal();
+ }
+ else if(! mMimeType.empty())
+ {
+ if (!initializeMedia(mMimeType))
+ {
+ LL_WARNS("Media") << "Failed to initialize media for mime type " << mMimeType << LL_ENDL;
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::destroyMediaSource()
{
- mNeedsNewTexture = true;
+ mNeedsNewTexture = true;
- // Tell the viewer media texture it's no longer active
- LLViewerMediaTexture* oldImage = LLViewerTextureManager::findMediaTexture( mTextureId );
- if (oldImage)
- {
- oldImage->setPlaying(FALSE) ;
- }
+ // Tell the viewer media texture it's no longer active
+ LLViewerMediaTexture* oldImage = LLViewerTextureManager::findMediaTexture( mTextureId );
+ if (oldImage)
+ {
+ oldImage->setPlaying(FALSE) ;
+ }
- cancelMimeTypeProbe();
+ cancelMimeTypeProbe();
{
LLMutexLock lock(&mLock); // Delay tear-down while bg thread is updating
@@ -1679,215 +1679,215 @@ void LLViewerMediaImpl::destroyMediaSource()
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::setMediaType(const std::string& media_type)
{
- mMimeType = media_type;
+ mMimeType = media_type;
}
//////////////////////////////////////////////////////////////////////////////////////////
/*static*/
LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, F64 zoom_factor, const std::string target, bool clean_browser)
{
- if (gNonInteractive)
+ if (gNonInteractive)
{
return NULL;
}
- std::string plugin_basename = LLMIMETypes::implType(media_type);
- LLPluginClassMedia* media_source = NULL;
+ std::string plugin_basename = LLMIMETypes::implType(media_type);
+ LLPluginClassMedia* media_source = NULL;
- // HACK: we always try to keep a spare running webkit plugin around to improve launch times.
- // If a spare was already created before PluginAttachDebuggerToPlugins was set, don't use it.
+ // HACK: we always try to keep a spare running webkit plugin around to improve launch times.
+ // If a spare was already created before PluginAttachDebuggerToPlugins was set, don't use it.
// Do not use a spare if launching with full viewer control (e.g. Twitter and few others)
- if ((plugin_basename == "media_plugin_cef") &&
+ if ((plugin_basename == "media_plugin_cef") &&
!gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins") && !clean_browser)
- {
- media_source = LLViewerMedia::getInstance()->getSpareBrowserMediaSource();
- if(media_source)
- {
- media_source->setOwner(owner);
- media_source->setTarget(target);
- media_source->setSize(default_width, default_height);
- media_source->setZoomFactor(zoom_factor);
-
- return media_source;
- }
- }
- if(plugin_basename.empty())
- {
- LL_WARNS_ONCE("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL;
- }
- else
- {
- std::string launcher_name = gDirUtilp->getLLPluginLauncher();
- std::string plugin_name = gDirUtilp->getLLPluginFilename(plugin_basename);
-
- std::string user_data_path_cache = gDirUtilp->getCacheDir(false);
- user_data_path_cache += gDirUtilp->getDirDelimiter();
-
- std::string user_data_path_cef_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "cef_log.txt");
-
- // See if the plugin executable exists
- llstat s;
- if(LLFile::stat(launcher_name, &s))
- {
- LL_WARNS_ONCE("Media") << "Couldn't find launcher at " << launcher_name << LL_ENDL;
- }
- else if(LLFile::stat(plugin_name, &s))
- {
+ {
+ media_source = LLViewerMedia::getInstance()->getSpareBrowserMediaSource();
+ if(media_source)
+ {
+ media_source->setOwner(owner);
+ media_source->setTarget(target);
+ media_source->setSize(default_width, default_height);
+ media_source->setZoomFactor(zoom_factor);
+
+ return media_source;
+ }
+ }
+ if(plugin_basename.empty())
+ {
+ LL_WARNS_ONCE("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL;
+ }
+ else
+ {
+ std::string launcher_name = gDirUtilp->getLLPluginLauncher();
+ std::string plugin_name = gDirUtilp->getLLPluginFilename(plugin_basename);
+
+ std::string user_data_path_cache = gDirUtilp->getCacheDir(false);
+ user_data_path_cache += gDirUtilp->getDirDelimiter();
+
+ std::string user_data_path_cef_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "cef_log.txt");
+
+ // See if the plugin executable exists
+ llstat s;
+ if(LLFile::stat(launcher_name, &s))
+ {
+ LL_WARNS_ONCE("Media") << "Couldn't find launcher at " << launcher_name << LL_ENDL;
+ }
+ else if(LLFile::stat(plugin_name, &s))
+ {
#if !LL_LINUX
- LL_WARNS_ONCE("Media") << "Couldn't find plugin at " << plugin_name << LL_ENDL;
+ LL_WARNS_ONCE("Media") << "Couldn't find plugin at " << plugin_name << LL_ENDL;
#endif
- }
- else
- {
- media_source = new LLPluginClassMedia(owner);
- media_source->setSize(default_width, default_height);
- media_source->setUserDataPath(user_data_path_cache, gDirUtilp->getUserName(), user_data_path_cef_log);
- media_source->setLanguageCode(LLUI::getLanguage());
- media_source->setZoomFactor(zoom_factor);
-
- // collect 'cookies enabled' setting from prefs and send to embedded browser
- bool cookies_enabled = gSavedSettings.getBOOL( "CookiesEnabled" );
- media_source->cookies_enabled( cookies_enabled || clean_browser);
-
- // collect 'javascript enabled' setting from prefs and send to embedded browser
- bool javascript_enabled = gSavedSettings.getBOOL("BrowserJavascriptEnabled");
- media_source->setJavascriptEnabled(javascript_enabled || clean_browser);
-
- // collect 'web security disabled' (see Chrome --web-security-disabled) setting from prefs and send to embedded browser
- bool web_security_disabled = gSavedSettings.getBOOL("BrowserWebSecurityDisabled");
- media_source->setWebSecurityDisabled(web_security_disabled || clean_browser);
-
- // collect setting indicates if local file access from file URLs is allowed from prefs and send to embedded browser
- bool file_access_from_file_urls = gSavedSettings.getBOOL("BrowserFileAccessFromFileUrls");
- media_source->setFileAccessFromFileUrlsEnabled(file_access_from_file_urls || clean_browser);
-
- // As of SL-15559 PDF files do not load in CEF v91 we enable plugins
- // but explicitly disable Flash (PDF support in CEF is now treated as a plugin)
- media_source->setPluginsEnabled(true);
-
- bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
- media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled || clean_browser);
-
- // need to set agent string here before instance created
- media_source->setBrowserUserAgent(LLViewerMedia::getInstance()->getCurrentUserAgent());
-
- // configure and pass proxy setup based on debug settings that are
+ }
+ else
+ {
+ media_source = new LLPluginClassMedia(owner);
+ media_source->setSize(default_width, default_height);
+ media_source->setUserDataPath(user_data_path_cache, gDirUtilp->getUserName(), user_data_path_cef_log);
+ media_source->setLanguageCode(LLUI::getLanguage());
+ media_source->setZoomFactor(zoom_factor);
+
+ // collect 'cookies enabled' setting from prefs and send to embedded browser
+ bool cookies_enabled = gSavedSettings.getBOOL( "CookiesEnabled" );
+ media_source->cookies_enabled( cookies_enabled || clean_browser);
+
+ // collect 'javascript enabled' setting from prefs and send to embedded browser
+ bool javascript_enabled = gSavedSettings.getBOOL("BrowserJavascriptEnabled");
+ media_source->setJavascriptEnabled(javascript_enabled || clean_browser);
+
+ // collect 'web security disabled' (see Chrome --web-security-disabled) setting from prefs and send to embedded browser
+ bool web_security_disabled = gSavedSettings.getBOOL("BrowserWebSecurityDisabled");
+ media_source->setWebSecurityDisabled(web_security_disabled || clean_browser);
+
+ // collect setting indicates if local file access from file URLs is allowed from prefs and send to embedded browser
+ bool file_access_from_file_urls = gSavedSettings.getBOOL("BrowserFileAccessFromFileUrls");
+ media_source->setFileAccessFromFileUrlsEnabled(file_access_from_file_urls || clean_browser);
+
+ // As of SL-15559 PDF files do not load in CEF v91 we enable plugins
+ // but explicitly disable Flash (PDF support in CEF is now treated as a plugin)
+ media_source->setPluginsEnabled(true);
+
+ bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
+ media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled || clean_browser);
+
+ // need to set agent string here before instance created
+ media_source->setBrowserUserAgent(LLViewerMedia::getInstance()->getCurrentUserAgent());
+
+ // configure and pass proxy setup based on debug settings that are
// configured by UI in prefs -> setup
media_source->proxy_setup(gSavedSettings.getBOOL("BrowserProxyEnabled"), gSavedSettings.getString("BrowserProxyAddress"), gSavedSettings.getS32("BrowserProxyPort"));
- media_source->setTarget(target);
-
- const std::string plugin_dir = gDirUtilp->getLLPluginDir();
- if (media_source->init(launcher_name, plugin_dir, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
- {
- return media_source;
- }
- else
- {
- LL_WARNS("Media") << "Failed to init plugin. Destroying." << LL_ENDL;
- delete media_source;
- }
- }
- }
+ media_source->setTarget(target);
+
+ const std::string plugin_dir = gDirUtilp->getLLPluginDir();
+ if (media_source->init(launcher_name, plugin_dir, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
+ {
+ return media_source;
+ }
+ else
+ {
+ LL_WARNS("Media") << "Failed to init plugin. Destroying." << LL_ENDL;
+ delete media_source;
+ }
+ }
+ }
#if !LL_LINUX
- LL_WARNS_ONCE("Plugin") << "plugin initialization failed for mime type: " << media_type << LL_ENDL;
+ LL_WARNS_ONCE("Plugin") << "plugin initialization failed for mime type: " << media_type << LL_ENDL;
#endif
- if(gAgent.isInitialized())
- {
- if (std::find(sMimeTypesFailed.begin(), sMimeTypesFailed.end(), media_type) == sMimeTypesFailed.end())
- {
- LLSD args;
- args["MIME_TYPE"] = media_type;
- LLNotificationsUtil::add("NoPlugin", args);
- sMimeTypesFailed.push_back(media_type);
- }
- }
- return NULL;
+ if(gAgent.isInitialized())
+ {
+ if (std::find(sMimeTypesFailed.begin(), sMimeTypesFailed.end(), media_type) == sMimeTypesFailed.end())
+ {
+ LLSD args;
+ args["MIME_TYPE"] = media_type;
+ LLNotificationsUtil::add("NoPlugin", args);
+ sMimeTypesFailed.push_back(media_type);
+ }
+ }
+ return NULL;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
{
- if(mMediaSource)
- {
- // Save the previous media source's last set size before destroying it.
- mMediaWidth = mMediaSource->getSetWidth();
- mMediaHeight = mMediaSource->getSetHeight();
- mZoomFactor = mMediaSource->getZoomFactor();
- }
-
- // Always delete the old media impl first.
- destroyMediaSource();
+ if(mMediaSource)
+ {
+ // Save the previous media source's last set size before destroying it.
+ mMediaWidth = mMediaSource->getSetWidth();
+ mMediaHeight = mMediaSource->getSetHeight();
+ mZoomFactor = mMediaSource->getZoomFactor();
+ }
- // and unconditionally set the mime type
- mMimeType = media_type;
+ // Always delete the old media impl first.
+ destroyMediaSource();
- if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED)
- {
- // This impl should not be loaded at this time.
- LL_DEBUGS("PluginPriority") << this << "Not loading (PRIORITY_UNLOADED)" << LL_ENDL;
+ // and unconditionally set the mime type
+ mMimeType = media_type;
- return false;
- }
+ if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED)
+ {
+ // This impl should not be loaded at this time.
+ LL_DEBUGS("PluginPriority") << this << "Not loading (PRIORITY_UNLOADED)" << LL_ENDL;
- // If we got here, we want to ignore previous init failures.
- mMediaSourceFailed = false;
+ return false;
+ }
- // Save the MIME type that really caused the plugin to load
- mCurrentMimeType = mMimeType;
+ // If we got here, we want to ignore previous init failures.
+ mMediaSourceFailed = false;
- LLPluginClassMedia* media_source = newSourceFromMediaType(mMimeType, this, mMediaWidth, mMediaHeight, mZoomFactor, mTarget, mCleanBrowser);
+ // Save the MIME type that really caused the plugin to load
+ mCurrentMimeType = mMimeType;
- if (media_source)
- {
- media_source->injectOpenIDCookie();
- media_source->setDisableTimeout(gSavedSettings.getBOOL("DebugPluginDisableTimeout"));
- media_source->setLoop(mMediaLoop);
- media_source->setAutoScale(mMediaAutoScale);
- media_source->setBrowserUserAgent(LLViewerMedia::getInstance()->getCurrentUserAgent());
- media_source->focus(mHasFocus);
- media_source->setBackgroundColor(mBackgroundColor);
+ LLPluginClassMedia* media_source = newSourceFromMediaType(mMimeType, this, mMediaWidth, mMediaHeight, mZoomFactor, mTarget, mCleanBrowser);
- if(gSavedSettings.getBOOL("BrowserIgnoreSSLCertErrors"))
- {
- media_source->ignore_ssl_cert_errors(true);
- }
+ if (media_source)
+ {
+ media_source->injectOpenIDCookie();
+ media_source->setDisableTimeout(gSavedSettings.getBOOL("DebugPluginDisableTimeout"));
+ media_source->setLoop(mMediaLoop);
+ media_source->setAutoScale(mMediaAutoScale);
+ media_source->setBrowserUserAgent(LLViewerMedia::getInstance()->getCurrentUserAgent());
+ media_source->focus(mHasFocus);
+ media_source->setBackgroundColor(mBackgroundColor);
+
+ if(gSavedSettings.getBOOL("BrowserIgnoreSSLCertErrors"))
+ {
+ media_source->ignore_ssl_cert_errors(true);
+ }
- // the correct way to deal with certs it to load ours from ca-bundle.crt and append them to the ones
- // Qt/WebKit loads from your system location.
- std::string ca_path = gDirUtilp->getCAFile();
- media_source->addCertificateFilePath( ca_path );
+ // the correct way to deal with certs it to load ours from ca-bundle.crt and append them to the ones
+ // Qt/WebKit loads from your system location.
+ std::string ca_path = gDirUtilp->getCAFile();
+ media_source->addCertificateFilePath( ca_path );
- if(mClearCache)
- {
- mClearCache = false;
- media_source->clear_cache();
- }
+ if(mClearCache)
+ {
+ mClearCache = false;
+ media_source->clear_cache();
+ }
- mMediaSource.reset(media_source);
- mMediaSource->setDeleteOK(false) ;
- updateVolume();
+ mMediaSource.reset(media_source);
+ mMediaSource->setDeleteOK(false) ;
+ updateVolume();
- return true;
- }
+ return true;
+ }
- // Make sure the timer doesn't try re-initing this plugin repeatedly until something else changes.
- mMediaSourceFailed = true;
+ // Make sure the timer doesn't try re-initing this plugin repeatedly until something else changes.
+ mMediaSourceFailed = true;
- return false;
+ return false;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::loadURI()
{
- if(mMediaSource)
- {
- // trim whitespace from front and back of URL - fixes EXT-5363
- LLStringUtil::trim( mMediaURL );
+ if(mMediaSource)
+ {
+ // trim whitespace from front and back of URL - fixes EXT-5363
+ LLStringUtil::trim( mMediaURL );
- // URI often comes unescaped
- std::string uri = LLURI::escapePathAndData(mMediaURL);
+ // URI often comes unescaped
+ std::string uri = LLURI::escapePathAndData(mMediaURL);
{
// Do not log the query parts
LLURI u(uri);
@@ -1895,389 +1895,389 @@ void LLViewerMediaImpl::loadURI()
LL_INFOS() << "Asking media source to load URI: " << sanitized_uri << LL_ENDL;
}
- mMediaSource->loadURI( uri );
+ mMediaSource->loadURI( uri );
- // A non-zero mPreviousMediaTime means that either this media was previously unloaded by the priority code while playing/paused,
- // or a seek happened before the media loaded. In either case, seek to the saved time.
- if(mPreviousMediaTime != 0.0f)
- {
- seek(mPreviousMediaTime);
- }
+ // A non-zero mPreviousMediaTime means that either this media was previously unloaded by the priority code while playing/paused,
+ // or a seek happened before the media loaded. In either case, seek to the saved time.
+ if(mPreviousMediaTime != 0.0f)
+ {
+ seek(mPreviousMediaTime);
+ }
- if(mPreviousMediaState == MEDIA_PLAYING)
- {
- // This media was playing before this instance was unloaded.
- start();
- }
- else if(mPreviousMediaState == MEDIA_PAUSED)
- {
- // This media was paused before this instance was unloaded.
- pause();
- }
- else
- {
- // No relevant previous media play state -- if we're loading the URL, we want to start playing.
- start();
- }
- }
+ if(mPreviousMediaState == MEDIA_PLAYING)
+ {
+ // This media was playing before this instance was unloaded.
+ start();
+ }
+ else if(mPreviousMediaState == MEDIA_PAUSED)
+ {
+ // This media was paused before this instance was unloaded.
+ pause();
+ }
+ else
+ {
+ // No relevant previous media play state -- if we're loading the URL, we want to start playing.
+ start();
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::executeJavaScript(const std::string& code)
{
- if (mMediaSource)
- {
- mMediaSource->executeJavaScript(code);
- }
+ if (mMediaSource)
+ {
+ mMediaSource->executeJavaScript(code);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::setSize(int width, int height)
{
- mMediaWidth = width;
- mMediaHeight = height;
- if(mMediaSource)
- {
- mMediaSource->setSize(width, height);
- }
+ mMediaWidth = width;
+ mMediaHeight = height;
+ if(mMediaSource)
+ {
+ mMediaSource->setSize(width, height);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::showNotification(LLNotificationPtr notify)
{
- mNotification = notify;
+ mNotification = notify;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::hideNotification()
{
- mNotification.reset();
+ mNotification.reset();
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::play()
{
- // If the media source isn't there, try to initialize it and load an URL.
- if(mMediaSource == NULL)
- {
- if(!initializeMedia(mMimeType))
- {
- // This may be the case where the plugin's priority is PRIORITY_UNLOADED
- return;
- }
+ // If the media source isn't there, try to initialize it and load an URL.
+ if(mMediaSource == NULL)
+ {
+ if(!initializeMedia(mMimeType))
+ {
+ // This may be the case where the plugin's priority is PRIORITY_UNLOADED
+ return;
+ }
- // Only do this if the media source was just loaded.
- loadURI();
- }
+ // Only do this if the media source was just loaded.
+ loadURI();
+ }
- // always start the media
- start();
+ // always start the media
+ start();
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::stop()
{
- if(mMediaSource)
- {
- mMediaSource->stop();
- // destroyMediaSource();
- }
+ if(mMediaSource)
+ {
+ mMediaSource->stop();
+ // destroyMediaSource();
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::pause()
{
- if(mMediaSource)
- {
- mMediaSource->pause();
- }
- else
- {
- mPreviousMediaState = MEDIA_PAUSED;
- }
+ if(mMediaSource)
+ {
+ mMediaSource->pause();
+ }
+ else
+ {
+ mPreviousMediaState = MEDIA_PAUSED;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::start()
{
- if(mMediaSource)
- {
- mMediaSource->start();
- }
- else
- {
- mPreviousMediaState = MEDIA_PLAYING;
- }
+ if(mMediaSource)
+ {
+ mMediaSource->start();
+ }
+ else
+ {
+ mPreviousMediaState = MEDIA_PLAYING;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::seek(F32 time)
{
- if(mMediaSource)
- {
- mMediaSource->seek(time);
- }
- else
- {
- // Save the seek time to be set when the media is loaded.
- mPreviousMediaTime = time;
- }
+ if(mMediaSource)
+ {
+ mMediaSource->seek(time);
+ }
+ else
+ {
+ // Save the seek time to be set when the media is loaded.
+ mPreviousMediaTime = time;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::skipBack(F32 step_scale)
{
- if(mMediaSource)
- {
- if(mMediaSource->pluginSupportsMediaTime())
- {
- F64 back_step = mMediaSource->getCurrentTime() - (mMediaSource->getDuration()*step_scale);
- if(back_step < 0.0)
- {
- back_step = 0.0;
- }
- mMediaSource->seek(back_step);
- }
- }
+ if(mMediaSource)
+ {
+ if(mMediaSource->pluginSupportsMediaTime())
+ {
+ F64 back_step = mMediaSource->getCurrentTime() - (mMediaSource->getDuration()*step_scale);
+ if(back_step < 0.0)
+ {
+ back_step = 0.0;
+ }
+ mMediaSource->seek(back_step);
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::skipForward(F32 step_scale)
{
- if(mMediaSource)
- {
- if(mMediaSource->pluginSupportsMediaTime())
- {
- F64 forward_step = mMediaSource->getCurrentTime() + (mMediaSource->getDuration()*step_scale);
- if(forward_step > mMediaSource->getDuration())
- {
- forward_step = mMediaSource->getDuration();
- }
- mMediaSource->seek(forward_step);
- }
- }
+ if(mMediaSource)
+ {
+ if(mMediaSource->pluginSupportsMediaTime())
+ {
+ F64 forward_step = mMediaSource->getCurrentTime() + (mMediaSource->getDuration()*step_scale);
+ if(forward_step > mMediaSource->getDuration())
+ {
+ forward_step = mMediaSource->getDuration();
+ }
+ mMediaSource->seek(forward_step);
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::setVolume(F32 volume)
{
- mRequestedVolume = volume;
- updateVolume();
+ mRequestedVolume = volume;
+ updateVolume();
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::setMute(bool mute)
{
- if (mute)
- {
- mPreviousVolume = mRequestedVolume;
- setVolume(0.0);
- }
- else
- {
- setVolume(mPreviousVolume);
- }
+ if (mute)
+ {
+ mPreviousVolume = mRequestedVolume;
+ setVolume(0.0);
+ }
+ else
+ {
+ setVolume(mPreviousVolume);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::updateVolume()
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_UPDATE_VOLUME);
- if(mMediaSource)
- {
- // always scale the volume by the global media volume
- F32 volume = mRequestedVolume * LLViewerMedia::getInstance()->getVolume();
-
- if (mProximityCamera > 0)
- {
- if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMax"))
- {
- volume = 0;
- }
- else if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMin"))
- {
- // attenuated_volume = 1 / (roll_off_rate * (d - min))^2
- // the +1 is there so that for distance 0 the volume stays the same
- F64 adjusted_distance = mProximityCamera - gSavedSettings.getF32("MediaRollOffMin");
- F64 attenuation = 1.0 + (gSavedSettings.getF32("MediaRollOffRate") * adjusted_distance);
- attenuation = 1.0 / (attenuation * attenuation);
- // the attenuation multiplier should never be more than one since that would increase volume
- volume = volume * llmin(1.0, attenuation);
- }
- }
-
- if (sOnlyAudibleTextureID == LLUUID::null || sOnlyAudibleTextureID == mTextureId)
- {
- mMediaSource->setVolume(volume);
- }
- else
- {
- mMediaSource->setVolume(0.0f);
- }
- }
+ if(mMediaSource)
+ {
+ // always scale the volume by the global media volume
+ F32 volume = mRequestedVolume * LLViewerMedia::getInstance()->getVolume();
+
+ if (mProximityCamera > 0)
+ {
+ if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMax"))
+ {
+ volume = 0;
+ }
+ else if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMin"))
+ {
+ // attenuated_volume = 1 / (roll_off_rate * (d - min))^2
+ // the +1 is there so that for distance 0 the volume stays the same
+ F64 adjusted_distance = mProximityCamera - gSavedSettings.getF32("MediaRollOffMin");
+ F64 attenuation = 1.0 + (gSavedSettings.getF32("MediaRollOffRate") * adjusted_distance);
+ attenuation = 1.0 / (attenuation * attenuation);
+ // the attenuation multiplier should never be more than one since that would increase volume
+ volume = volume * llmin(1.0, attenuation);
+ }
+ }
+
+ if (sOnlyAudibleTextureID == LLUUID::null || sOnlyAudibleTextureID == mTextureId)
+ {
+ mMediaSource->setVolume(volume);
+ }
+ else
+ {
+ mMediaSource->setVolume(0.0f);
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
F32 LLViewerMediaImpl::getVolume()
{
- return mRequestedVolume;
+ return mRequestedVolume;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::focus(bool focus)
{
- mHasFocus = focus;
+ mHasFocus = focus;
- if (mMediaSource)
- {
- // call focus just for the hell of it, even though this apopears to be a nop
- mMediaSource->focus(focus);
- if (focus)
- {
- // spoof a mouse click to *actually* pass focus
- // Don't do this anymore -- it actually clicks through now.
-// mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, 1, 1, 0);
-// mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 1, 1, 0);
- }
- }
+ if (mMediaSource)
+ {
+ // call focus just for the hell of it, even though this apopears to be a nop
+ mMediaSource->focus(focus);
+ if (focus)
+ {
+ // spoof a mouse click to *actually* pass focus
+ // Don't do this anymore -- it actually clicks through now.
+// mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, 1, 1, 0);
+// mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 1, 1, 0);
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::hasFocus() const
{
- // FIXME: This might be able to be a bit smarter by hooking into LLViewerMediaFocus, etc.
- return mHasFocus;
+ // FIXME: This might be able to be a bit smarter by hooking into LLViewerMediaFocus, etc.
+ return mHasFocus;
}
std::string LLViewerMediaImpl::getCurrentMediaURL()
{
- if(!mCurrentMediaURL.empty())
- {
- return mCurrentMediaURL;
- }
+ if(!mCurrentMediaURL.empty())
+ {
+ return mCurrentMediaURL;
+ }
- return mMediaURL;
+ return mMediaURL;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::clearCache()
{
- if(mMediaSource)
- {
- mMediaSource->clear_cache();
- }
- else
- {
- mClearCache = true;
- }
+ if(mMediaSource)
+ {
+ mMediaSource->clear_cache();
+ }
+ else
+ {
+ mClearCache = true;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::setPageZoomFactor( double factor )
{
- if(mMediaSource && factor != mZoomFactor)
- {
- mZoomFactor = factor;
- mMediaSource->set_page_zoom_factor( factor );
- }
+ if(mMediaSource && factor != mZoomFactor)
+ {
+ mZoomFactor = factor;
+ mMediaSource->set_page_zoom_factor( factor );
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::mouseDown(S32 x, S32 y, MASK mask, S32 button)
{
- scaleMouse(&x, &y);
- mLastMouseX = x;
- mLastMouseY = y;
-// LL_INFOS() << "mouse down (" << x << ", " << y << ")" << LL_ENDL;
- if (mMediaSource)
- {
- mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, button, x, y, mask);
- }
+ scaleMouse(&x, &y);
+ mLastMouseX = x;
+ mLastMouseY = y;
+// LL_INFOS() << "mouse down (" << x << ", " << y << ")" << LL_ENDL;
+ if (mMediaSource)
+ {
+ mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, button, x, y, mask);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::mouseUp(S32 x, S32 y, MASK mask, S32 button)
{
- scaleMouse(&x, &y);
- mLastMouseX = x;
- mLastMouseY = y;
-// LL_INFOS() << "mouse up (" << x << ", " << y << ")" << LL_ENDL;
- if (mMediaSource)
- {
- mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, button, x, y, mask);
- }
+ scaleMouse(&x, &y);
+ mLastMouseX = x;
+ mLastMouseY = y;
+// LL_INFOS() << "mouse up (" << x << ", " << y << ")" << LL_ENDL;
+ if (mMediaSource)
+ {
+ mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, button, x, y, mask);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask)
{
scaleMouse(&x, &y);
- mLastMouseX = x;
- mLastMouseY = y;
-// LL_INFOS() << "mouse move (" << x << ", " << y << ")" << LL_ENDL;
- if (mMediaSource)
- {
- mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, 0, x, y, mask);
- }
+ mLastMouseX = x;
+ mLastMouseY = y;
+// LL_INFOS() << "mouse move (" << x << ", " << y << ")" << LL_ENDL;
+ if (mMediaSource)
+ {
+ mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, 0, x, y, mask);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
//static
void LLViewerMediaImpl::scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y)
{
- F32 texture_x = texture_coords.mV[VX];
- F32 texture_y = texture_coords.mV[VY];
+ F32 texture_x = texture_coords.mV[VX];
+ F32 texture_y = texture_coords.mV[VY];
- // Deal with repeating textures by wrapping the coordinates into the range [0, 1.0)
- texture_x = fmodf(texture_x, 1.0f);
- if(texture_x < 0.0f)
- texture_x = 1.0 + texture_x;
+ // Deal with repeating textures by wrapping the coordinates into the range [0, 1.0)
+ texture_x = fmodf(texture_x, 1.0f);
+ if(texture_x < 0.0f)
+ texture_x = 1.0 + texture_x;
- texture_y = fmodf(texture_y, 1.0f);
- if(texture_y < 0.0f)
- texture_y = 1.0 + texture_y;
+ texture_y = fmodf(texture_y, 1.0f);
+ if(texture_y < 0.0f)
+ texture_y = 1.0 + texture_y;
- // scale x and y to texel units.
- *x = ll_round(texture_x * mMediaSource->getTextureWidth());
- *y = ll_round((1.0f - texture_y) * mMediaSource->getTextureHeight());
+ // scale x and y to texel units.
+ *x = ll_round(texture_x * mMediaSource->getTextureWidth());
+ *y = ll_round((1.0f - texture_y) * mMediaSource->getTextureHeight());
- // Adjust for the difference between the actual texture height and the amount of the texture in use.
- *y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight());
+ // Adjust for the difference between the actual texture height and the amount of the texture in use.
+ *y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight());
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S32 button)
{
- if(mMediaSource)
- {
- S32 x, y;
- scaleTextureCoords(texture_coords, &x, &y);
+ if(mMediaSource)
+ {
+ S32 x, y;
+ scaleTextureCoords(texture_coords, &x, &y);
- mouseDown(x, y, mask, button);
- }
+ mouseDown(x, y, mask, button);
+ }
}
void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32 button)
{
- if(mMediaSource)
- {
- S32 x, y;
- scaleTextureCoords(texture_coords, &x, &y);
+ if(mMediaSource)
+ {
+ S32 x, y;
+ scaleTextureCoords(texture_coords, &x, &y);
- mouseUp(x, y, mask, button);
- }
+ mouseUp(x, y, mask, button);
+ }
}
void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask)
{
- if(mMediaSource)
- {
- S32 x, y;
- scaleTextureCoords(texture_coords, &x, &y);
+ if(mMediaSource)
+ {
+ S32 x, y;
+ scaleTextureCoords(texture_coords, &x, &y);
- mouseMove(x, y, mask);
- }
+ mouseMove(x, y, mask);
+ }
}
void LLViewerMediaImpl::mouseDoubleClick(const LLVector2& texture_coords, MASK mask)
@@ -2294,13 +2294,13 @@ void LLViewerMediaImpl::mouseDoubleClick(const LLVector2& texture_coords, MASK m
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::mouseDoubleClick(S32 x, S32 y, MASK mask, S32 button)
{
- scaleMouse(&x, &y);
- mLastMouseX = x;
- mLastMouseY = y;
- if (mMediaSource)
- {
- mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOUBLE_CLICK, button, x, y, mask);
- }
+ scaleMouse(&x, &y);
+ mLastMouseX = x;
+ mLastMouseY = y;
+ if (mMediaSource)
+ {
+ mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOUBLE_CLICK, button, x, y, mask);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -2318,196 +2318,196 @@ void LLViewerMediaImpl::scrollWheel(const LLVector2& texture_coords, S32 scroll_
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::scrollWheel(S32 x, S32 y, S32 scroll_x, S32 scroll_y, MASK mask)
{
- scaleMouse(&x, &y);
- mLastMouseX = x;
- mLastMouseY = y;
- if (mMediaSource)
- {
- mMediaSource->scrollEvent(x, y, scroll_x, scroll_y, mask);
- }
+ scaleMouse(&x, &y);
+ mLastMouseX = x;
+ mLastMouseY = y;
+ if (mMediaSource)
+ {
+ mMediaSource->scrollEvent(x, y, scroll_x, scroll_y, mask);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::onMouseCaptureLost()
{
- if (mMediaSource)
- {
- mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 0, mLastMouseX, mLastMouseY, 0);
- }
+ if (mMediaSource)
+ {
+ mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 0, mLastMouseX, mLastMouseY, 0);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
BOOL LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask)
{
- // NOTE: this is called when the mouse is released when we have capture.
- // Due to the way mouse coordinates are mapped to the object, we can't use the x and y coordinates that come in with the event.
+ // NOTE: this is called when the mouse is released when we have capture.
+ // Due to the way mouse coordinates are mapped to the object, we can't use the x and y coordinates that come in with the event.
- if(hasMouseCapture())
- {
- // Release the mouse -- this will also send a mouseup to the media
- gFocusMgr.setMouseCapture( FALSE );
- }
+ if(hasMouseCapture())
+ {
+ // Release the mouse -- this will also send a mouseup to the media
+ gFocusMgr.setMouseCapture( FALSE );
+ }
- return TRUE;
+ return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::updateJavascriptObject()
{
- static LLFrameTimer timer ;
-
- if ( mMediaSource )
- {
- // flag to expose this information to internal browser or not.
- bool enable = gSavedSettings.getBOOL("BrowserEnableJSObject");
-
- if(!enable)
- {
- return ; //no need to go further.
- }
-
- if(timer.getElapsedTimeF32() < 1.0f)
- {
- return ; //do not update more than once per second.
- }
- timer.reset() ;
-
- mMediaSource->jsEnableObject( enable );
-
- // these values are only menaingful after login so don't set them before
- bool logged_in = LLLoginInstance::getInstance()->authSuccess();
- if ( logged_in )
- {
- // current location within a region
- LLVector3 agent_pos = gAgent.getPositionAgent();
- double x = agent_pos.mV[ VX ];
- double y = agent_pos.mV[ VY ];
- double z = agent_pos.mV[ VZ ];
- mMediaSource->jsAgentLocationEvent( x, y, z );
-
- // current location within the grid
- LLVector3d agent_pos_global = gAgent.getLastPositionGlobal();
- double global_x = agent_pos_global.mdV[ VX ];
- double global_y = agent_pos_global.mdV[ VY ];
- double global_z = agent_pos_global.mdV[ VZ ];
- mMediaSource->jsAgentGlobalLocationEvent( global_x, global_y, global_z );
-
- // current agent orientation
- double rotation = atan2( gAgent.getAtAxis().mV[VX], gAgent.getAtAxis().mV[VY] );
- double angle = rotation * RAD_TO_DEG;
- if ( angle < 0.0f ) angle = 360.0f + angle; // TODO: has to be a better way to get orientation!
- mMediaSource->jsAgentOrientationEvent( angle );
-
- // current region agent is in
- std::string region_name("");
- LLViewerRegion* region = gAgent.getRegion();
- if ( region )
- {
- region_name = region->getName();
- };
- mMediaSource->jsAgentRegionEvent( region_name );
- }
-
- // language code the viewer is set to
- mMediaSource->jsAgentLanguageEvent( LLUI::getLanguage() );
-
- // maturity setting the agent has selected
- if ( gAgent.prefersAdult() )
- mMediaSource->jsAgentMaturityEvent( "GMA" ); // Adult means see adult, mature and general content
- else
- if ( gAgent.prefersMature() )
- mMediaSource->jsAgentMaturityEvent( "GM" ); // Mature means see mature and general content
- else
- if ( gAgent.prefersPG() )
- mMediaSource->jsAgentMaturityEvent( "G" ); // PG means only see General content
- }
+ static LLFrameTimer timer ;
+
+ if ( mMediaSource )
+ {
+ // flag to expose this information to internal browser or not.
+ bool enable = gSavedSettings.getBOOL("BrowserEnableJSObject");
+
+ if(!enable)
+ {
+ return ; //no need to go further.
+ }
+
+ if(timer.getElapsedTimeF32() < 1.0f)
+ {
+ return ; //do not update more than once per second.
+ }
+ timer.reset() ;
+
+ mMediaSource->jsEnableObject( enable );
+
+ // these values are only menaingful after login so don't set them before
+ bool logged_in = LLLoginInstance::getInstance()->authSuccess();
+ if ( logged_in )
+ {
+ // current location within a region
+ LLVector3 agent_pos = gAgent.getPositionAgent();
+ double x = agent_pos.mV[ VX ];
+ double y = agent_pos.mV[ VY ];
+ double z = agent_pos.mV[ VZ ];
+ mMediaSource->jsAgentLocationEvent( x, y, z );
+
+ // current location within the grid
+ LLVector3d agent_pos_global = gAgent.getLastPositionGlobal();
+ double global_x = agent_pos_global.mdV[ VX ];
+ double global_y = agent_pos_global.mdV[ VY ];
+ double global_z = agent_pos_global.mdV[ VZ ];
+ mMediaSource->jsAgentGlobalLocationEvent( global_x, global_y, global_z );
+
+ // current agent orientation
+ double rotation = atan2( gAgent.getAtAxis().mV[VX], gAgent.getAtAxis().mV[VY] );
+ double angle = rotation * RAD_TO_DEG;
+ if ( angle < 0.0f ) angle = 360.0f + angle; // TODO: has to be a better way to get orientation!
+ mMediaSource->jsAgentOrientationEvent( angle );
+
+ // current region agent is in
+ std::string region_name("");
+ LLViewerRegion* region = gAgent.getRegion();
+ if ( region )
+ {
+ region_name = region->getName();
+ };
+ mMediaSource->jsAgentRegionEvent( region_name );
+ }
+
+ // language code the viewer is set to
+ mMediaSource->jsAgentLanguageEvent( LLUI::getLanguage() );
+
+ // maturity setting the agent has selected
+ if ( gAgent.prefersAdult() )
+ mMediaSource->jsAgentMaturityEvent( "GMA" ); // Adult means see adult, mature and general content
+ else
+ if ( gAgent.prefersMature() )
+ mMediaSource->jsAgentMaturityEvent( "GM" ); // Mature means see mature and general content
+ else
+ if ( gAgent.prefersPG() )
+ mMediaSource->jsAgentMaturityEvent( "G" ); // PG means only see General content
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
const std::string& LLViewerMediaImpl::getName() const
{
- if (mMediaSource)
- {
- return mMediaSource->getMediaName();
- }
+ if (mMediaSource)
+ {
+ return mMediaSource->getMediaName();
+ }
- return LLStringUtil::null;
+ return LLStringUtil::null;
};
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::navigateBack()
{
- if (mMediaSource)
- {
- mMediaSource->browse_back();
- }
+ if (mMediaSource)
+ {
+ mMediaSource->browse_back();
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::navigateForward()
{
- if (mMediaSource)
- {
- mMediaSource->browse_forward();
- }
+ if (mMediaSource)
+ {
+ mMediaSource->browse_forward();
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::navigateReload()
{
- navigateTo(getCurrentMediaURL(), "", true, false);
+ navigateTo(getCurrentMediaURL(), "", true, false);
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::navigateHome()
{
- bool rediscover_mimetype = mHomeMimeType.empty();
- navigateTo(mHomeURL, mHomeMimeType, rediscover_mimetype, false);
+ bool rediscover_mimetype = mHomeMimeType.empty();
+ navigateTo(mHomeURL, mHomeMimeType, rediscover_mimetype, false);
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::unload()
{
- // Unload the media impl and clear its state.
- destroyMediaSource();
- resetPreviousMediaState();
- mMediaURL.clear();
- mMimeType.clear();
- mCurrentMediaURL.clear();
- mCurrentMimeType.clear();
+ // Unload the media impl and clear its state.
+ destroyMediaSource();
+ resetPreviousMediaState();
+ mMediaURL.clear();
+ mMimeType.clear();
+ mCurrentMediaURL.clear();
+ mCurrentMimeType.clear();
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mime_type, bool rediscover_type, bool server_request, bool clean_browser)
{
- cancelMimeTypeProbe();
+ cancelMimeTypeProbe();
- if(mMediaURL != url)
- {
- // Don't carry media play state across distinct URLs.
- resetPreviousMediaState();
- }
+ if(mMediaURL != url)
+ {
+ // Don't carry media play state across distinct URLs.
+ resetPreviousMediaState();
+ }
- // Always set the current URL and MIME type.
- mMediaURL = url;
- mMimeType = mime_type;
+ // Always set the current URL and MIME type.
+ mMediaURL = url;
+ mMimeType = mime_type;
mCleanBrowser = clean_browser;
- // Clear the current media URL, since it will no longer be correct.
- mCurrentMediaURL.clear();
+ // Clear the current media URL, since it will no longer be correct.
+ mCurrentMediaURL.clear();
- // if mime type discovery was requested, we'll need to do it when the media loads
- mNavigateRediscoverType = rediscover_type;
+ // if mime type discovery was requested, we'll need to do it when the media loads
+ mNavigateRediscoverType = rediscover_type;
- // and if this was a server request, the navigate on load will also need to be one.
- mNavigateServerRequest = server_request;
+ // and if this was a server request, the navigate on load will also need to be one.
+ mNavigateServerRequest = server_request;
- // An explicit navigate resets the "failed" flag.
- mMediaSourceFailed = false;
+ // An explicit navigate resets the "failed" flag.
+ mMediaSourceFailed = false;
- if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED)
- {
- // Helpful to have media urls in log file. Shouldn't be spammy.
+ if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED)
+ {
+ // Helpful to have media urls in log file. Shouldn't be spammy.
{
// Do not log the query parts
LLURI u(url);
@@ -2515,19 +2515,19 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi
LL_INFOS() << "NOT LOADING media id= " << mTextureId << " url=" << sanitized_url << ", mime_type=" << mime_type << LL_ENDL;
}
- // This impl should not be loaded at this time.
- LL_DEBUGS("PluginPriority") << this << "Not loading (PRIORITY_UNLOADED)" << LL_ENDL;
+ // This impl should not be loaded at this time.
+ LL_DEBUGS("PluginPriority") << this << "Not loading (PRIORITY_UNLOADED)" << LL_ENDL;
- return;
- }
+ return;
+ }
- navigateInternal();
+ navigateInternal();
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::navigateInternal()
{
- // Helpful to have media urls in log file. Shouldn't be spammy.
+ // Helpful to have media urls in log file. Shouldn't be spammy.
{
// Do not log the query parts
LLURI u(mMediaURL);
@@ -2535,81 +2535,81 @@ void LLViewerMediaImpl::navigateInternal()
LL_INFOS() << "media id= " << mTextureId << " url=" << sanitized_url << ", mime_type=" << mMimeType << LL_ENDL;
}
- if(mNavigateSuspended)
- {
- LL_WARNS() << "Deferring navigate." << LL_ENDL;
- mNavigateSuspendedDeferred = true;
- return;
- }
-
-
+ if(mNavigateSuspended)
+ {
+ LL_WARNS() << "Deferring navigate." << LL_ENDL;
+ mNavigateSuspendedDeferred = true;
+ return;
+ }
+
+
if (!mMimeProbe.expired())
- {
- LL_WARNS() << "MIME type probe already in progress -- bailing out." << LL_ENDL;
- return;
- }
-
- if(mNavigateServerRequest)
- {
- setNavState(MEDIANAVSTATE_SERVER_SENT);
- }
- else
- {
- setNavState(MEDIANAVSTATE_NONE);
- }
-
- // If the caller has specified a non-empty MIME type, look that up in our MIME types list.
- // If we have a plugin for that MIME type, use that instead of attempting auto-discovery.
- // This helps in supporting legacy media content where the server the media resides on returns a bogus MIME type
- // but the parcel owner has correctly set the MIME type in the parcel media settings.
-
- if(!mMimeType.empty() && (mMimeType != LLMIMETypes::getDefaultMimeType()))
- {
- std::string plugin_basename = LLMIMETypes::implType(mMimeType);
- if(!plugin_basename.empty())
- {
- // We have a plugin for this mime type
- mNavigateRediscoverType = false;
- }
- }
-
- if(mNavigateRediscoverType)
- {
-
- LLURI uri(mMediaURL);
- std::string scheme = uri.scheme();
-
- if(scheme.empty() || "http" == scheme || "https" == scheme)
- {
+ {
+ LL_WARNS() << "MIME type probe already in progress -- bailing out." << LL_ENDL;
+ return;
+ }
+
+ if(mNavigateServerRequest)
+ {
+ setNavState(MEDIANAVSTATE_SERVER_SENT);
+ }
+ else
+ {
+ setNavState(MEDIANAVSTATE_NONE);
+ }
+
+ // If the caller has specified a non-empty MIME type, look that up in our MIME types list.
+ // If we have a plugin for that MIME type, use that instead of attempting auto-discovery.
+ // This helps in supporting legacy media content where the server the media resides on returns a bogus MIME type
+ // but the parcel owner has correctly set the MIME type in the parcel media settings.
+
+ if(!mMimeType.empty() && (mMimeType != LLMIMETypes::getDefaultMimeType()))
+ {
+ std::string plugin_basename = LLMIMETypes::implType(mMimeType);
+ if(!plugin_basename.empty())
+ {
+ // We have a plugin for this mime type
+ mNavigateRediscoverType = false;
+ }
+ }
+
+ if(mNavigateRediscoverType)
+ {
+
+ LLURI uri(mMediaURL);
+ std::string scheme = uri.scheme();
+
+ if(scheme.empty() || "http" == scheme || "https" == scheme)
+ {
LLCoros::instance().launch("LLViewerMediaImpl::mimeDiscoveryCoro",
boost::bind(&LLViewerMediaImpl::mimeDiscoveryCoro, this, mMediaURL));
- }
- else if("data" == scheme || "file" == scheme || "about" == scheme)
- {
- // FIXME: figure out how to really discover the type for these schemes
- // We use "data" internally for a text/html url for loading the login screen
- if(initializeMedia(HTTP_CONTENT_TEXT_HTML))
- {
- loadURI();
- }
- }
- else
- {
- // This catches 'rtsp://' urls
- if(initializeMedia(scheme))
- {
- loadURI();
- }
- }
- }
- else if(initializeMedia(mMimeType))
- {
- loadURI();
- }
- else
- {
- LL_WARNS("Media") << "Couldn't navigate to: " << mMediaURL << " as there is no media type for: " << mMimeType << LL_ENDL;
- }
+ }
+ else if("data" == scheme || "file" == scheme || "about" == scheme)
+ {
+ // FIXME: figure out how to really discover the type for these schemes
+ // We use "data" internally for a text/html url for loading the login screen
+ if(initializeMedia(HTTP_CONTENT_TEXT_HTML))
+ {
+ loadURI();
+ }
+ }
+ else
+ {
+ // This catches 'rtsp://' urls
+ if(initializeMedia(scheme))
+ {
+ loadURI();
+ }
+ }
+ }
+ else if(initializeMedia(mMimeType))
+ {
+ loadURI();
+ }
+ else
+ {
+ LL_WARNS("Media") << "Couldn't navigate to: " << mMediaURL << " as there is no media type for: " << mMimeType << LL_ENDL;
+ }
}
void LLViewerMediaImpl::mimeDiscoveryCoro(std::string url)
@@ -2690,100 +2690,100 @@ void LLViewerMediaImpl::mimeDiscoveryCoro(std::string url)
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::navigateStop()
{
- if(mMediaSource)
- {
- mMediaSource->browse_stop();
- }
+ if(mMediaSource)
+ {
+ mMediaSource->browse_stop();
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::handleKeyHere(KEY key, MASK mask)
{
- bool result = false;
+ bool result = false;
- if (mMediaSource)
- {
- // FIXME: THIS IS SO WRONG.
- // Menu keys should be handled by the menu system and not passed to UI elements, but this is how LLTextEditor and LLLineEditor do it...
- if (MASK_CONTROL & mask && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END)
- {
- result = true;
- }
+ if (mMediaSource)
+ {
+ // FIXME: THIS IS SO WRONG.
+ // Menu keys should be handled by the menu system and not passed to UI elements, but this is how LLTextEditor and LLLineEditor do it...
+ if (MASK_CONTROL & mask && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END)
+ {
+ result = true;
+ }
- if (!result)
- {
+ if (!result)
+ {
LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData();
- result = mMediaSource->keyEvent(LLPluginClassMedia::KEY_EVENT_DOWN, key, mask, native_key_data);
- }
- }
+ result = mMediaSource->keyEvent(LLPluginClassMedia::KEY_EVENT_DOWN, key, mask, native_key_data);
+ }
+ }
- return result;
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::handleKeyUpHere(KEY key, MASK mask)
{
- bool result = false;
+ bool result = false;
- if (mMediaSource)
- {
- // FIXME: THIS IS SO WRONG.
- // Menu keys should be handled by the menu system and not passed to UI elements, but this is how LLTextEditor and LLLineEditor do it...
- if (MASK_CONTROL & mask && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END)
- {
- result = true;
- }
+ if (mMediaSource)
+ {
+ // FIXME: THIS IS SO WRONG.
+ // Menu keys should be handled by the menu system and not passed to UI elements, but this is how LLTextEditor and LLLineEditor do it...
+ if (MASK_CONTROL & mask && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END)
+ {
+ result = true;
+ }
- if (!result)
- {
- LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData();
- result = mMediaSource->keyEvent(LLPluginClassMedia::KEY_EVENT_UP, key, mask, native_key_data);
- }
- }
+ if (!result)
+ {
+ LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData();
+ result = mMediaSource->keyEvent(LLPluginClassMedia::KEY_EVENT_UP, key, mask, native_key_data);
+ }
+ }
- return result;
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char)
{
- bool result = false;
+ bool result = false;
- if (mMediaSource)
- {
- // only accept 'printable' characters, sigh...
- if (uni_char >= 32 // discard 'control' characters
- && uni_char != 127) // SDL thinks this is 'delete' - yuck.
- {
- LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData();
+ if (mMediaSource)
+ {
+ // only accept 'printable' characters, sigh...
+ if (uni_char >= 32 // discard 'control' characters
+ && uni_char != 127) // SDL thinks this is 'delete' - yuck.
+ {
+ LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData();
- mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE), native_key_data);
- }
- }
+ mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE), native_key_data);
+ }
+ }
- return result;
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::canNavigateForward()
{
- BOOL result = FALSE;
- if (mMediaSource)
- {
- result = mMediaSource->getHistoryForwardAvailable();
- }
- return result;
+ BOOL result = FALSE;
+ if (mMediaSource)
+ {
+ result = mMediaSource->getHistoryForwardAvailable();
+ }
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::canNavigateBack()
{
- BOOL result = FALSE;
- if (mMediaSource)
- {
- result = mMediaSource->getHistoryBackAvailable();
- }
- return result;
+ BOOL result = FALSE;
+ if (mMediaSource)
+ {
+ result = mMediaSource->getHistoryBackAvailable();
+ }
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -2870,7 +2870,7 @@ void LLViewerMediaImpl::update()
return;
}
-
+
LLViewerMediaTexture* media_tex;
U8* data;
S32 data_width;
@@ -2984,7 +2984,7 @@ void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* da
// copy just the subimage covered by the image raw to GL
media_tex->setSubImage(data, data_width, data_height, x_pos, y_pos, width, height, tex_name);
-
+
if (sync)
{
media_tex->getGLTexture()->syncToMainThread(tex_name);
@@ -2993,7 +2993,7 @@ void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* da
{
media_tex->getGLTexture()->syncTexName(tex_name);
}
-
+
// release the data pointer before freeing raw so LLImageRaw destructor doesn't
// free memory at data pointer
raw->releaseData();
@@ -3017,7 +3017,7 @@ LLViewerMediaTexture* LLViewerMediaImpl::updateMediaImage()
//llassert(!mTextureId.isNull());
// *TODO: Consider enabling mipmaps (they have been disabled for a long time). Likely has a significant performance impact for tiled/high texture repeat media. Mip generation in a shader may also be an option if necessary.
LLViewerMediaTexture* media_tex = LLViewerTextureManager::getMediaTexture( mTextureId, USE_MIPMAPS );
-
+
if ( mNeedsNewTexture
|| (media_tex->getWidth() != mMediaSource->getTextureWidth())
|| (media_tex->getHeight() != mMediaSource->getTextureHeight())
@@ -3053,7 +3053,7 @@ LLViewerMediaTexture* LLViewerMediaImpl::updateMediaImage()
// MEDIAOPT: set this dynamically on play/stop
// FIXME
-// media_tex->mIsMediaTexture = true;
+// media_tex->mIsMediaTexture = true;
mNeedsNewTexture = false;
// If the amount of the texture being drawn by the media goes down in either width or height,
@@ -3068,45 +3068,45 @@ LLViewerMediaTexture* LLViewerMediaImpl::updateMediaImage()
//////////////////////////////////////////////////////////////////////////////////////////
LLUUID LLViewerMediaImpl::getMediaTextureID() const
{
- return mTextureId;
+ return mTextureId;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::setVisible(bool visible)
{
- mVisible = visible;
+ mVisible = visible;
- if(mVisible)
- {
- if(mMediaSource && mMediaSource->isPluginExited())
- {
- destroyMediaSource();
- }
+ if(mVisible)
+ {
+ if(mMediaSource && mMediaSource->isPluginExited())
+ {
+ destroyMediaSource();
+ }
- if(!mMediaSource)
- {
- createMediaSource();
- }
- }
+ if(!mMediaSource)
+ {
+ createMediaSource();
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::mouseCapture()
{
- gFocusMgr.setMouseCapture(this);
+ gFocusMgr.setMouseCapture(this);
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::scaleMouse(S32 *mouse_x, S32 *mouse_y)
{
#if 0
- S32 media_width, media_height;
- S32 texture_width, texture_height;
- getMediaSize( &media_width, &media_height );
- getTextureSize( &texture_width, &texture_height );
- S32 y_delta = texture_height - media_height;
+ S32 media_width, media_height;
+ S32 texture_width, texture_height;
+ getMediaSize( &media_width, &media_height );
+ getTextureSize( &texture_width, &texture_height );
+ S32 y_delta = texture_height - media_height;
- *mouse_y -= y_delta;
+ *mouse_y -= y_delta;
#endif
}
@@ -3115,57 +3115,57 @@ void LLViewerMediaImpl::scaleMouse(S32 *mouse_x, S32 *mouse_y)
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::isMediaTimeBased()
{
- bool result = false;
+ bool result = false;
- if(mMediaSource)
- {
- result = mMediaSource->pluginSupportsMediaTime();
- }
+ if(mMediaSource)
+ {
+ result = mMediaSource->pluginSupportsMediaTime();
+ }
- return result;
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::isMediaPlaying()
{
- bool result = false;
+ bool result = false;
- if(mMediaSource)
- {
- EMediaStatus status = mMediaSource->getStatus();
- if(status == MEDIA_PLAYING || status == MEDIA_LOADING)
- result = true;
- }
+ if(mMediaSource)
+ {
+ EMediaStatus status = mMediaSource->getStatus();
+ if(status == MEDIA_PLAYING || status == MEDIA_LOADING)
+ result = true;
+ }
- return result;
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::isMediaPaused()
{
- bool result = false;
+ bool result = false;
- if(mMediaSource)
- {
- if(mMediaSource->getStatus() == MEDIA_PAUSED)
- result = true;
- }
+ if(mMediaSource)
+ {
+ if(mMediaSource->getStatus() == MEDIA_PAUSED)
+ result = true;
+ }
- return result;
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::hasMedia() const
{
- return mMediaSource != NULL;
+ return mMediaSource != NULL;
}
//////////////////////////////////////////////////////////////////////////////////////////
//
void LLViewerMediaImpl::resetPreviousMediaState()
{
- mPreviousMediaState = MEDIA_NONE;
- mPreviousMediaTime = 0.0f;
+ mPreviousMediaState = MEDIA_NONE;
+ mPreviousMediaTime = 0.0f;
}
@@ -3173,318 +3173,318 @@ void LLViewerMediaImpl::resetPreviousMediaState()
//
void LLViewerMediaImpl::setDisabled(bool disabled, bool forcePlayOnEnable)
{
- if(mIsDisabled != disabled)
- {
- // Only do this on actual state transitions.
- mIsDisabled = disabled;
-
- if(mIsDisabled)
- {
- // We just disabled this media. Clear all state.
- unload();
- }
- else
- {
- // We just (re)enabled this media. Do a navigate if auto-play is in order.
- if(isAutoPlayable() || forcePlayOnEnable)
- {
- navigateTo(mMediaEntryURL, "", true, true);
- }
- }
-
- }
+ if(mIsDisabled != disabled)
+ {
+ // Only do this on actual state transitions.
+ mIsDisabled = disabled;
+
+ if(mIsDisabled)
+ {
+ // We just disabled this media. Clear all state.
+ unload();
+ }
+ else
+ {
+ // We just (re)enabled this media. Do a navigate if auto-play is in order.
+ if(isAutoPlayable() || forcePlayOnEnable)
+ {
+ navigateTo(mMediaEntryURL, "", true, true);
+ }
+ }
+
+ }
};
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::isForcedUnloaded() const
{
- if(mIsMuted || mMediaSourceFailed || mIsDisabled)
- {
- return true;
- }
+ if(mIsMuted || mMediaSourceFailed || mIsDisabled)
+ {
+ return true;
+ }
- // If this media's class is not supposed to be shown, unload
- if (!shouldShowBasedOnClass() || isObscured())
- {
- return true;
- }
+ // If this media's class is not supposed to be shown, unload
+ if (!shouldShowBasedOnClass() || isObscured())
+ {
+ return true;
+ }
- return false;
+ return false;
}
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::isPlayable() const
{
- if(isForcedUnloaded())
- {
- // All of the forced-unloaded criteria also imply not playable.
- return false;
- }
+ if(isForcedUnloaded())
+ {
+ // All of the forced-unloaded criteria also imply not playable.
+ return false;
+ }
- if(hasMedia())
- {
- // Anything that's already playing is, by definition, playable.
- return true;
- }
+ if(hasMedia())
+ {
+ // Anything that's already playing is, by definition, playable.
+ return true;
+ }
- if(!mMediaURL.empty())
- {
- // If something has navigated the instance, it's ready to be played.
- return true;
- }
+ if(!mMediaURL.empty())
+ {
+ // If something has navigated the instance, it's ready to be played.
+ return true;
+ }
- return false;
+ return false;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent event)
{
- bool pass_through = true;
- switch(event)
- {
- case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
- {
- LL_DEBUGS("Media") << "MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is: " << plugin->getClickURL() << LL_ENDL;
- std::string url = plugin->getClickURL();
- std::string nav_type = plugin->getClickNavType();
- LLURLDispatcher::dispatch(url, nav_type, NULL, mTrustedBrowser);
- }
- break;
- case MEDIA_EVENT_CLICK_LINK_HREF:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << plugin->getClickTarget() << "\", uri is " << plugin->getClickURL() << LL_ENDL;
- };
- break;
- case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
- {
- // The plugin failed to load properly. Make sure the timer doesn't retry.
- // TODO: maybe mark this plugin as not loadable somehow?
- mMediaSourceFailed = true;
-
- // Reset the last known state of the media to defaults.
- resetPreviousMediaState();
-
- // TODO: may want a different message for this case?
- LLSD args;
- args["PLUGIN"] = LLMIMETypes::implType(mCurrentMimeType);
- LLNotificationsUtil::add("MediaPluginFailed", args);
- }
- break;
-
- case MEDIA_EVENT_PLUGIN_FAILED:
- {
- // The plugin crashed.
- mMediaSourceFailed = true;
-
- // Reset the last known state of the media to defaults.
- resetPreviousMediaState();
-
- LLSD args;
- args["PLUGIN"] = LLMIMETypes::implType(mCurrentMimeType);
- // SJB: This is getting called every frame if the plugin fails to load, continuously respawining the alert!
- //LLNotificationsUtil::add("MediaPluginFailed", args);
- }
- break;
-
- case MEDIA_EVENT_CURSOR_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CURSOR_CHANGED, new cursor is " << plugin->getCursorName() << LL_ENDL;
-
- std::string cursor = plugin->getCursorName();
- mLastSetCursor = getCursorFromString(cursor);
- }
- break;
-
- case LLViewerMediaObserver::MEDIA_EVENT_FILE_DOWNLOAD:
- {
- LL_DEBUGS("Media") << "Media event - file download requested - filename is " << plugin->getFileDownloadFilename() << LL_ENDL;
- }
- break;
-
- case LLViewerMediaObserver::MEDIA_EVENT_NAVIGATE_BEGIN:
- {
- LL_DEBUGS("Media") << "MEDIA_EVENT_NAVIGATE_BEGIN, uri is: " << plugin->getNavigateURI() << LL_ENDL;
- hideNotification();
-
- if(getNavState() == MEDIANAVSTATE_SERVER_SENT)
- {
- setNavState(MEDIANAVSTATE_SERVER_BEGUN);
- }
- else
- {
- setNavState(MEDIANAVSTATE_BEGUN);
- }
- }
- break;
-
- case LLViewerMediaObserver::MEDIA_EVENT_NAVIGATE_COMPLETE:
- {
- LL_DEBUGS("Media") << "MEDIA_EVENT_NAVIGATE_COMPLETE, uri is: " << plugin->getNavigateURI() << LL_ENDL;
-
- std::string url = plugin->getNavigateURI();
- if(getNavState() == MEDIANAVSTATE_BEGUN)
- {
- if(mCurrentMediaURL == url)
- {
- // This is a navigate that takes us to the same url as the previous navigate.
- setNavState(MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS);
- }
- else
- {
- mCurrentMediaURL = url;
- setNavState(MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED);
- }
- }
- else if(getNavState() == MEDIANAVSTATE_SERVER_BEGUN)
- {
- mCurrentMediaURL = url;
- setNavState(MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED);
- }
- else
- {
- // all other cases need to leave the state alone.
- }
- }
- break;
-
- case LLViewerMediaObserver::MEDIA_EVENT_LOCATION_CHANGED:
- {
- LL_DEBUGS("Media") << "MEDIA_EVENT_LOCATION_CHANGED, uri is: " << plugin->getLocation() << LL_ENDL;
-
- std::string url = plugin->getLocation();
-
- if(getNavState() == MEDIANAVSTATE_BEGUN)
- {
- if(mCurrentMediaURL == url)
- {
- // This is a navigate that takes us to the same url as the previous navigate.
- setNavState(MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS);
- }
- else
- {
- mCurrentMediaURL = url;
- setNavState(MEDIANAVSTATE_FIRST_LOCATION_CHANGED);
- }
- }
- else if(getNavState() == MEDIANAVSTATE_SERVER_BEGUN)
- {
- mCurrentMediaURL = url;
- setNavState(MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED);
- }
- else
- {
- bool internal_nav = false;
- if (url != mCurrentMediaURL)
- {
- // Check if it is internal navigation
- // Note: Not sure if we should detect internal navigations as 'address change',
- // but they are not redirects and do not cause NAVIGATE_BEGIN (also see SL-1005)
- size_t pos = url.find("#");
- if (pos != std::string::npos)
- {
- // assume that new link always have '#', so this is either
- // transfer from 'link#1' to 'link#2' or from link to 'link#2'
- // filter out cases like 'redirect?link'
- std::string base_url = url.substr(0, pos);
- pos = mCurrentMediaURL.find(base_url);
- if (pos == 0)
- {
- // base link hasn't changed
- internal_nav = true;
- }
- }
- }
-
- if (internal_nav)
- {
- // Internal navigation by '#'
- mCurrentMediaURL = url;
- setNavState(MEDIANAVSTATE_FIRST_LOCATION_CHANGED);
- }
- else
- {
- // Don't track redirects.
- setNavState(MEDIANAVSTATE_NONE);
- }
- }
- }
- break;
-
- case LLViewerMediaObserver::MEDIA_EVENT_PICK_FILE_REQUEST:
- {
- LL_DEBUGS("Media") << "Media event - file pick requested." << LL_ENDL;
-
- init_threaded_picker_load_dialog(plugin, LLFilePicker::FFLOAD_ALL, plugin->getIsMultipleFilePick());
- }
- break;
-
- case LLViewerMediaObserver::MEDIA_EVENT_AUTH_REQUEST:
- {
- LLNotification::Params auth_request_params;
- auth_request_params.name = "AuthRequest";
-
- // pass in host name and realm for site (may be zero length but will always exist)
- LLSD args;
- LLURL raw_url( plugin->getAuthURL().c_str() );
- args["HOST_NAME"] = raw_url.getAuthority();
- args["REALM"] = plugin->getAuthRealm();
- auth_request_params.substitutions = args;
-
- auth_request_params.payload = LLSD().with("media_id", mTextureId);
- auth_request_params.functor.function = boost::bind(&LLViewerMedia::authSubmitCallback, _1, _2);
- LLNotifications::instance().add(auth_request_params);
- };
- break;
-
- case LLViewerMediaObserver::MEDIA_EVENT_CLOSE_REQUEST:
- {
- std::string uuid = plugin->getClickUUID();
-
- LL_INFOS() << "MEDIA_EVENT_CLOSE_REQUEST for uuid " << uuid << LL_ENDL;
-
- if(uuid.empty())
- {
- // This close request is directed at this instance, let it fall through.
- }
- else
- {
- // This close request is directed at another instance
- pass_through = false;
- LLFloaterWebContent::closeRequest(uuid);
- }
- }
- break;
-
- case LLViewerMediaObserver::MEDIA_EVENT_GEOMETRY_CHANGE:
- {
- std::string uuid = plugin->getClickUUID();
-
- LL_INFOS() << "MEDIA_EVENT_GEOMETRY_CHANGE for uuid " << uuid << LL_ENDL;
-
- if(uuid.empty())
- {
- // This geometry change request is directed at this instance, let it fall through.
- }
- else
- {
- // This request is directed at another instance
- pass_through = false;
- LLFloaterWebContent::geometryChanged(uuid, plugin->getGeometryX(), plugin->getGeometryY(), plugin->getGeometryWidth(), plugin->getGeometryHeight());
- }
- }
- break;
-
- default:
- break;
- }
-
- if(pass_through)
- {
- // Just chain the event to observers.
- emitEvent(plugin, event);
- }
+ bool pass_through = true;
+ switch(event)
+ {
+ case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
+ {
+ LL_DEBUGS("Media") << "MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is: " << plugin->getClickURL() << LL_ENDL;
+ std::string url = plugin->getClickURL();
+ std::string nav_type = plugin->getClickNavType();
+ LLURLDispatcher::dispatch(url, nav_type, NULL, mTrustedBrowser);
+ }
+ break;
+ case MEDIA_EVENT_CLICK_LINK_HREF:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << plugin->getClickTarget() << "\", uri is " << plugin->getClickURL() << LL_ENDL;
+ };
+ break;
+ case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
+ {
+ // The plugin failed to load properly. Make sure the timer doesn't retry.
+ // TODO: maybe mark this plugin as not loadable somehow?
+ mMediaSourceFailed = true;
+
+ // Reset the last known state of the media to defaults.
+ resetPreviousMediaState();
+
+ // TODO: may want a different message for this case?
+ LLSD args;
+ args["PLUGIN"] = LLMIMETypes::implType(mCurrentMimeType);
+ LLNotificationsUtil::add("MediaPluginFailed", args);
+ }
+ break;
+
+ case MEDIA_EVENT_PLUGIN_FAILED:
+ {
+ // The plugin crashed.
+ mMediaSourceFailed = true;
+
+ // Reset the last known state of the media to defaults.
+ resetPreviousMediaState();
+
+ LLSD args;
+ args["PLUGIN"] = LLMIMETypes::implType(mCurrentMimeType);
+ // SJB: This is getting called every frame if the plugin fails to load, continuously respawining the alert!
+ //LLNotificationsUtil::add("MediaPluginFailed", args);
+ }
+ break;
+
+ case MEDIA_EVENT_CURSOR_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CURSOR_CHANGED, new cursor is " << plugin->getCursorName() << LL_ENDL;
+
+ std::string cursor = plugin->getCursorName();
+ mLastSetCursor = getCursorFromString(cursor);
+ }
+ break;
+
+ case LLViewerMediaObserver::MEDIA_EVENT_FILE_DOWNLOAD:
+ {
+ LL_DEBUGS("Media") << "Media event - file download requested - filename is " << plugin->getFileDownloadFilename() << LL_ENDL;
+ }
+ break;
+
+ case LLViewerMediaObserver::MEDIA_EVENT_NAVIGATE_BEGIN:
+ {
+ LL_DEBUGS("Media") << "MEDIA_EVENT_NAVIGATE_BEGIN, uri is: " << plugin->getNavigateURI() << LL_ENDL;
+ hideNotification();
+
+ if(getNavState() == MEDIANAVSTATE_SERVER_SENT)
+ {
+ setNavState(MEDIANAVSTATE_SERVER_BEGUN);
+ }
+ else
+ {
+ setNavState(MEDIANAVSTATE_BEGUN);
+ }
+ }
+ break;
+
+ case LLViewerMediaObserver::MEDIA_EVENT_NAVIGATE_COMPLETE:
+ {
+ LL_DEBUGS("Media") << "MEDIA_EVENT_NAVIGATE_COMPLETE, uri is: " << plugin->getNavigateURI() << LL_ENDL;
+
+ std::string url = plugin->getNavigateURI();
+ if(getNavState() == MEDIANAVSTATE_BEGUN)
+ {
+ if(mCurrentMediaURL == url)
+ {
+ // This is a navigate that takes us to the same url as the previous navigate.
+ setNavState(MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS);
+ }
+ else
+ {
+ mCurrentMediaURL = url;
+ setNavState(MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED);
+ }
+ }
+ else if(getNavState() == MEDIANAVSTATE_SERVER_BEGUN)
+ {
+ mCurrentMediaURL = url;
+ setNavState(MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED);
+ }
+ else
+ {
+ // all other cases need to leave the state alone.
+ }
+ }
+ break;
+
+ case LLViewerMediaObserver::MEDIA_EVENT_LOCATION_CHANGED:
+ {
+ LL_DEBUGS("Media") << "MEDIA_EVENT_LOCATION_CHANGED, uri is: " << plugin->getLocation() << LL_ENDL;
+
+ std::string url = plugin->getLocation();
+
+ if(getNavState() == MEDIANAVSTATE_BEGUN)
+ {
+ if(mCurrentMediaURL == url)
+ {
+ // This is a navigate that takes us to the same url as the previous navigate.
+ setNavState(MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS);
+ }
+ else
+ {
+ mCurrentMediaURL = url;
+ setNavState(MEDIANAVSTATE_FIRST_LOCATION_CHANGED);
+ }
+ }
+ else if(getNavState() == MEDIANAVSTATE_SERVER_BEGUN)
+ {
+ mCurrentMediaURL = url;
+ setNavState(MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED);
+ }
+ else
+ {
+ bool internal_nav = false;
+ if (url != mCurrentMediaURL)
+ {
+ // Check if it is internal navigation
+ // Note: Not sure if we should detect internal navigations as 'address change',
+ // but they are not redirects and do not cause NAVIGATE_BEGIN (also see SL-1005)
+ size_t pos = url.find("#");
+ if (pos != std::string::npos)
+ {
+ // assume that new link always have '#', so this is either
+ // transfer from 'link#1' to 'link#2' or from link to 'link#2'
+ // filter out cases like 'redirect?link'
+ std::string base_url = url.substr(0, pos);
+ pos = mCurrentMediaURL.find(base_url);
+ if (pos == 0)
+ {
+ // base link hasn't changed
+ internal_nav = true;
+ }
+ }
+ }
+
+ if (internal_nav)
+ {
+ // Internal navigation by '#'
+ mCurrentMediaURL = url;
+ setNavState(MEDIANAVSTATE_FIRST_LOCATION_CHANGED);
+ }
+ else
+ {
+ // Don't track redirects.
+ setNavState(MEDIANAVSTATE_NONE);
+ }
+ }
+ }
+ break;
+
+ case LLViewerMediaObserver::MEDIA_EVENT_PICK_FILE_REQUEST:
+ {
+ LL_DEBUGS("Media") << "Media event - file pick requested." << LL_ENDL;
+
+ init_threaded_picker_load_dialog(plugin, LLFilePicker::FFLOAD_ALL, plugin->getIsMultipleFilePick());
+ }
+ break;
+
+ case LLViewerMediaObserver::MEDIA_EVENT_AUTH_REQUEST:
+ {
+ LLNotification::Params auth_request_params;
+ auth_request_params.name = "AuthRequest";
+
+ // pass in host name and realm for site (may be zero length but will always exist)
+ LLSD args;
+ LLURL raw_url( plugin->getAuthURL().c_str() );
+ args["HOST_NAME"] = raw_url.getAuthority();
+ args["REALM"] = plugin->getAuthRealm();
+ auth_request_params.substitutions = args;
+
+ auth_request_params.payload = LLSD().with("media_id", mTextureId);
+ auth_request_params.functor.function = boost::bind(&LLViewerMedia::authSubmitCallback, _1, _2);
+ LLNotifications::instance().add(auth_request_params);
+ };
+ break;
+
+ case LLViewerMediaObserver::MEDIA_EVENT_CLOSE_REQUEST:
+ {
+ std::string uuid = plugin->getClickUUID();
+
+ LL_INFOS() << "MEDIA_EVENT_CLOSE_REQUEST for uuid " << uuid << LL_ENDL;
+
+ if(uuid.empty())
+ {
+ // This close request is directed at this instance, let it fall through.
+ }
+ else
+ {
+ // This close request is directed at another instance
+ pass_through = false;
+ LLFloaterWebContent::closeRequest(uuid);
+ }
+ }
+ break;
+
+ case LLViewerMediaObserver::MEDIA_EVENT_GEOMETRY_CHANGE:
+ {
+ std::string uuid = plugin->getClickUUID();
+
+ LL_INFOS() << "MEDIA_EVENT_GEOMETRY_CHANGE for uuid " << uuid << LL_ENDL;
+
+ if(uuid.empty())
+ {
+ // This geometry change request is directed at this instance, let it fall through.
+ }
+ else
+ {
+ // This request is directed at another instance
+ pass_through = false;
+ LLFloaterWebContent::geometryChanged(uuid, plugin->getGeometryX(), plugin->getGeometryY(), plugin->getGeometryWidth(), plugin->getGeometryHeight());
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if(pass_through)
+ {
+ // Just chain the event to observers.
+ emitEvent(plugin, event);
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -3492,8 +3492,8 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
void
LLViewerMediaImpl::cut()
{
- if (mMediaSource)
- mMediaSource->cut();
+ if (mMediaSource)
+ mMediaSource->cut();
}
////////////////////////////////////////////////////////////////////////////////
@@ -3501,10 +3501,10 @@ LLViewerMediaImpl::cut()
BOOL
LLViewerMediaImpl::canCut() const
{
- if (mMediaSource)
- return mMediaSource->canCut();
- else
- return FALSE;
+ if (mMediaSource)
+ return mMediaSource->canCut();
+ else
+ return FALSE;
}
////////////////////////////////////////////////////////////////////////////////
@@ -3512,8 +3512,8 @@ LLViewerMediaImpl::canCut() const
void
LLViewerMediaImpl::copy()
{
- if (mMediaSource)
- mMediaSource->copy();
+ if (mMediaSource)
+ mMediaSource->copy();
}
////////////////////////////////////////////////////////////////////////////////
@@ -3521,10 +3521,10 @@ LLViewerMediaImpl::copy()
BOOL
LLViewerMediaImpl::canCopy() const
{
- if (mMediaSource)
- return mMediaSource->canCopy();
- else
- return FALSE;
+ if (mMediaSource)
+ return mMediaSource->canCopy();
+ else
+ return FALSE;
}
////////////////////////////////////////////////////////////////////////////////
@@ -3532,8 +3532,8 @@ LLViewerMediaImpl::canCopy() const
void
LLViewerMediaImpl::paste()
{
- if (mMediaSource)
- mMediaSource->paste();
+ if (mMediaSource)
+ mMediaSource->paste();
}
////////////////////////////////////////////////////////////////////////////////
@@ -3541,20 +3541,20 @@ LLViewerMediaImpl::paste()
BOOL
LLViewerMediaImpl::canPaste() const
{
- if (mMediaSource)
- return mMediaSource->canPaste();
- else
- return FALSE;
+ if (mMediaSource)
+ return mMediaSource->canPaste();
+ else
+ return FALSE;
}
void LLViewerMediaImpl::setUpdated(BOOL updated)
{
- mIsUpdated = updated ;
+ mIsUpdated = updated ;
}
BOOL LLViewerMediaImpl::isUpdated()
{
- return mIsUpdated ;
+ return mIsUpdated ;
}
static LLTrace::BlockTimerStatHandle FTM_MEDIA_CALCULATE_INTEREST("Calculate Interest");
@@ -3562,37 +3562,37 @@ static LLTrace::BlockTimerStatHandle FTM_MEDIA_CALCULATE_INTEREST("Calculate Int
void LLViewerMediaImpl::calculateInterest()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; //LL_RECORD_BLOCK_TIME(FTM_MEDIA_CALCULATE_INTEREST);
- LLViewerMediaTexture* texture = LLViewerTextureManager::findMediaTexture( mTextureId );
+ LLViewerMediaTexture* texture = LLViewerTextureManager::findMediaTexture( mTextureId );
llassert(!gCubeSnapshot);
- if(texture != NULL)
- {
- mInterest = texture->getMaxVirtualSize();
- }
- else
- {
- // This will be a relatively common case now, since it will always be true for unloaded media.
- mInterest = 0.0f;
- }
-
- // Calculate distance from the avatar, for use in the proximity calculation.
- mProximityDistance = 0.0f;
- mProximityCamera = 0.0f;
- if(!mObjectList.empty())
- {
- // Just use the first object in the list. We could go through the list and find the closest object, but this should work well enough.
- std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
- LLVOVolume* objp = *iter ;
- llassert_always(objp != NULL) ;
-
- // The distance calculation is invalid for HUD attachments -- leave both mProximityDistance and mProximityCamera at 0 for them.
- if(!objp->isHUDAttachment())
- {
- LLVector3d obj_global = objp->getPositionGlobal() ;
- LLVector3d agent_global = gAgent.getPositionGlobal() ;
- LLVector3d global_delta = agent_global - obj_global ;
- mProximityDistance = global_delta.magVecSquared(); // use distance-squared because it's cheaper and sorts the same.
+ if(texture != NULL)
+ {
+ mInterest = texture->getMaxVirtualSize();
+ }
+ else
+ {
+ // This will be a relatively common case now, since it will always be true for unloaded media.
+ mInterest = 0.0f;
+ }
+
+ // Calculate distance from the avatar, for use in the proximity calculation.
+ mProximityDistance = 0.0f;
+ mProximityCamera = 0.0f;
+ if(!mObjectList.empty())
+ {
+ // Just use the first object in the list. We could go through the list and find the closest object, but this should work well enough.
+ std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
+ LLVOVolume* objp = *iter ;
+ llassert_always(objp != NULL) ;
+
+ // The distance calculation is invalid for HUD attachments -- leave both mProximityDistance and mProximityCamera at 0 for them.
+ if(!objp->isHUDAttachment())
+ {
+ LLVector3d obj_global = objp->getPositionGlobal() ;
+ LLVector3d agent_global = gAgent.getPositionGlobal() ;
+ LLVector3d global_delta = agent_global - obj_global ;
+ mProximityDistance = global_delta.magVecSquared(); // use distance-squared because it's cheaper and sorts the same.
static LLUICachedControl<S32> mEarLocation("MediaSoundsEarLocation", 0);
LLVector3d ear_position;
@@ -3608,185 +3608,185 @@ void LLViewerMediaImpl::calculateInterest()
break;
}
LLVector3d camera_delta = ear_position - obj_global;
- mProximityCamera = camera_delta.magVec();
- }
- }
-
- if(mNeedsMuteCheck)
- {
- // Check all objects this instance is associated with, and those objects' owners, against the mute list
- mIsMuted = false;
-
- std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
- for(; iter != mObjectList.end() ; ++iter)
- {
- LLVOVolume *obj = *iter;
- llassert(obj);
- if (!obj) continue;
- if(LLMuteList::getInstance() &&
- LLMuteList::getInstance()->isMuted(obj->getID()))
- {
- mIsMuted = true;
- }
- else
- {
- // We won't have full permissions data for all objects. Attempt to mute objects when we can tell their owners are muted.
- if (LLSelectMgr::getInstance())
- {
- LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(obj);
- if(obj_perm)
- {
- if(LLMuteList::getInstance() &&
- LLMuteList::getInstance()->isMuted(obj_perm->getOwner()))
- mIsMuted = true;
- }
- }
- }
- }
-
- mNeedsMuteCheck = false;
- }
+ mProximityCamera = camera_delta.magVec();
+ }
+ }
+
+ if(mNeedsMuteCheck)
+ {
+ // Check all objects this instance is associated with, and those objects' owners, against the mute list
+ mIsMuted = false;
+
+ std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
+ for(; iter != mObjectList.end() ; ++iter)
+ {
+ LLVOVolume *obj = *iter;
+ llassert(obj);
+ if (!obj) continue;
+ if(LLMuteList::getInstance() &&
+ LLMuteList::getInstance()->isMuted(obj->getID()))
+ {
+ mIsMuted = true;
+ }
+ else
+ {
+ // We won't have full permissions data for all objects. Attempt to mute objects when we can tell their owners are muted.
+ if (LLSelectMgr::getInstance())
+ {
+ LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(obj);
+ if(obj_perm)
+ {
+ if(LLMuteList::getInstance() &&
+ LLMuteList::getInstance()->isMuted(obj_perm->getOwner()))
+ mIsMuted = true;
+ }
+ }
+ }
+ }
+
+ mNeedsMuteCheck = false;
+ }
}
F64 LLViewerMediaImpl::getApproximateTextureInterest()
{
- F64 result = 0.0f;
+ F64 result = 0.0f;
- if(mMediaSource)
- {
- result = mMediaSource->getFullWidth();
- result *= mMediaSource->getFullHeight();
- }
- else
- {
- // No media source is loaded -- all we have to go on is the texture size that has been set on the impl, if any.
- result = mMediaWidth;
- result *= mMediaHeight;
- }
+ if(mMediaSource)
+ {
+ result = mMediaSource->getFullWidth();
+ result *= mMediaSource->getFullHeight();
+ }
+ else
+ {
+ // No media source is loaded -- all we have to go on is the texture size that has been set on the impl, if any.
+ result = mMediaWidth;
+ result *= mMediaHeight;
+ }
- return result;
+ return result;
}
void LLViewerMediaImpl::setUsedInUI(bool used_in_ui)
{
- mUsedInUI = used_in_ui;
-
- // HACK: Force elements used in UI to load right away.
- // This fixes some issues where UI code that uses the browser instance doesn't expect it to be unloaded.
- if(mUsedInUI && (mPriority == LLPluginClassMedia::PRIORITY_UNLOADED))
- {
- if(getVisible())
- {
- setPriority(LLPluginClassMedia::PRIORITY_NORMAL);
- }
- else
- {
- setPriority(LLPluginClassMedia::PRIORITY_HIDDEN);
- }
-
- createMediaSource();
- }
+ mUsedInUI = used_in_ui;
+
+ // HACK: Force elements used in UI to load right away.
+ // This fixes some issues where UI code that uses the browser instance doesn't expect it to be unloaded.
+ if(mUsedInUI && (mPriority == LLPluginClassMedia::PRIORITY_UNLOADED))
+ {
+ if(getVisible())
+ {
+ setPriority(LLPluginClassMedia::PRIORITY_NORMAL);
+ }
+ else
+ {
+ setPriority(LLPluginClassMedia::PRIORITY_HIDDEN);
+ }
+
+ createMediaSource();
+ }
};
void LLViewerMediaImpl::setBackgroundColor(LLColor4 color)
{
- mBackgroundColor = color;
+ mBackgroundColor = color;
- if(mMediaSource)
- {
- mMediaSource->setBackgroundColor(mBackgroundColor);
- }
+ if(mMediaSource)
+ {
+ mMediaSource->setBackgroundColor(mBackgroundColor);
+ }
};
F64 LLViewerMediaImpl::getCPUUsage() const
{
- F64 result = 0.0f;
+ F64 result = 0.0f;
- if(mMediaSource)
- {
- result = mMediaSource->getCPUUsage();
- }
+ if(mMediaSource)
+ {
+ result = mMediaSource->getCPUUsage();
+ }
- return result;
+ return result;
}
void LLViewerMediaImpl::setPriority(LLPluginClassMedia::EPriority priority)
{
- if(mPriority != priority)
- {
- LL_DEBUGS("PluginPriority")
- << "changing priority of media id " << mTextureId
- << " from " << LLPluginClassMedia::priorityToString(mPriority)
- << " to " << LLPluginClassMedia::priorityToString(priority)
- << LL_ENDL;
- }
+ if(mPriority != priority)
+ {
+ LL_DEBUGS("PluginPriority")
+ << "changing priority of media id " << mTextureId
+ << " from " << LLPluginClassMedia::priorityToString(mPriority)
+ << " to " << LLPluginClassMedia::priorityToString(priority)
+ << LL_ENDL;
+ }
- mPriority = priority;
+ mPriority = priority;
- if(priority == LLPluginClassMedia::PRIORITY_UNLOADED)
- {
- if(mMediaSource)
- {
- // Need to unload the media source
+ if(priority == LLPluginClassMedia::PRIORITY_UNLOADED)
+ {
+ if(mMediaSource)
+ {
+ // Need to unload the media source
- // First, save off previous media state
- mPreviousMediaState = mMediaSource->getStatus();
- mPreviousMediaTime = mMediaSource->getCurrentTime();
+ // First, save off previous media state
+ mPreviousMediaState = mMediaSource->getStatus();
+ mPreviousMediaTime = mMediaSource->getCurrentTime();
- destroyMediaSource();
- }
- }
+ destroyMediaSource();
+ }
+ }
- if(mMediaSource)
- {
- mMediaSource->setPriority(mPriority);
- }
+ if(mMediaSource)
+ {
+ mMediaSource->setPriority(mPriority);
+ }
- // NOTE: loading (or reloading) media sources whose priority has risen above PRIORITY_UNLOADED is done in update().
+ // NOTE: loading (or reloading) media sources whose priority has risen above PRIORITY_UNLOADED is done in update().
}
void LLViewerMediaImpl::setLowPrioritySizeLimit(int size)
{
- if(mMediaSource)
- {
- mMediaSource->setLowPrioritySizeLimit(size);
- }
+ if(mMediaSource)
+ {
+ mMediaSource->setLowPrioritySizeLimit(size);
+ }
}
void LLViewerMediaImpl::setNavState(EMediaNavState state)
{
- mMediaNavState = state;
+ mMediaNavState = state;
- switch (state)
- {
- case MEDIANAVSTATE_NONE: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_NONE" << LL_ENDL; break;
- case MEDIANAVSTATE_BEGUN: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_BEGUN" << LL_ENDL; break;
- case MEDIANAVSTATE_FIRST_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_FIRST_LOCATION_CHANGED" << LL_ENDL; break;
- case MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS" << LL_ENDL; break;
- case MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED" << LL_ENDL; break;
- case MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS" << LL_ENDL; break;
- case MEDIANAVSTATE_SERVER_SENT: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_SENT" << LL_ENDL; break;
- case MEDIANAVSTATE_SERVER_BEGUN: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_BEGUN" << LL_ENDL; break;
- case MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED" << LL_ENDL; break;
- case MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED" << LL_ENDL; break;
- }
+ switch (state)
+ {
+ case MEDIANAVSTATE_NONE: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_NONE" << LL_ENDL; break;
+ case MEDIANAVSTATE_BEGUN: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_BEGUN" << LL_ENDL; break;
+ case MEDIANAVSTATE_FIRST_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_FIRST_LOCATION_CHANGED" << LL_ENDL; break;
+ case MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS" << LL_ENDL; break;
+ case MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED" << LL_ENDL; break;
+ case MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS" << LL_ENDL; break;
+ case MEDIANAVSTATE_SERVER_SENT: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_SENT" << LL_ENDL; break;
+ case MEDIANAVSTATE_SERVER_BEGUN: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_BEGUN" << LL_ENDL; break;
+ case MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED" << LL_ENDL; break;
+ case MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED" << LL_ENDL; break;
+ }
}
void LLViewerMediaImpl::setNavigateSuspended(bool suspend)
{
- if(mNavigateSuspended != suspend)
- {
- mNavigateSuspended = suspend;
- if(!suspend)
- {
- // We're coming out of suspend. If someone tried to do a navigate while suspended, do one now instead.
- if(mNavigateSuspendedDeferred)
- {
- mNavigateSuspendedDeferred = false;
- navigateInternal();
- }
- }
- }
+ if(mNavigateSuspended != suspend)
+ {
+ mNavigateSuspended = suspend;
+ if(!suspend)
+ {
+ // We're coming out of suspend. If someone tried to do a navigate while suspended, do one now instead.
+ if(mNavigateSuspendedDeferred)
+ {
+ mNavigateSuspendedDeferred = false;
+ navigateInternal();
+ }
+ }
+ }
}
void LLViewerMediaImpl::cancelMimeTypeProbe()
@@ -3795,114 +3795,114 @@ void LLViewerMediaImpl::cancelMimeTypeProbe()
if (probeAdapter)
probeAdapter->cancelSuspendedOperation();
-
+
}
void LLViewerMediaImpl::addObject(LLVOVolume* obj)
{
- std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
- for(; iter != mObjectList.end() ; ++iter)
- {
- if(*iter == obj)
- {
- return ; //already in the list.
- }
- }
+ std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
+ for(; iter != mObjectList.end() ; ++iter)
+ {
+ if(*iter == obj)
+ {
+ return ; //already in the list.
+ }
+ }
- mObjectList.push_back(obj) ;
- mNeedsMuteCheck = true;
+ mObjectList.push_back(obj) ;
+ mNeedsMuteCheck = true;
}
void LLViewerMediaImpl::removeObject(LLVOVolume* obj)
{
- mObjectList.remove(obj) ;
- mNeedsMuteCheck = true;
+ mObjectList.remove(obj) ;
+ mNeedsMuteCheck = true;
}
const std::list< LLVOVolume* >* LLViewerMediaImpl::getObjectList() const
{
- return &mObjectList ;
+ return &mObjectList ;
}
LLVOVolume *LLViewerMediaImpl::getSomeObject()
{
- LLVOVolume *result = NULL;
+ LLVOVolume *result = NULL;
- std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
- if(iter != mObjectList.end())
- {
- result = *iter;
- }
+ std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
+ if(iter != mObjectList.end())
+ {
+ result = *iter;
+ }
- return result;
+ return result;
}
void LLViewerMediaImpl::setTextureID(LLUUID id)
{
- if(id != mTextureId)
- {
- if(mTextureId.notNull())
- {
- // Remove this item's entry from the map
- sViewerMediaTextureIDMap.erase(mTextureId);
- }
+ if(id != mTextureId)
+ {
+ if(mTextureId.notNull())
+ {
+ // Remove this item's entry from the map
+ sViewerMediaTextureIDMap.erase(mTextureId);
+ }
- if(id.notNull())
- {
- sViewerMediaTextureIDMap.insert(LLViewerMedia::impl_id_map::value_type(id, this));
- }
+ if(id.notNull())
+ {
+ sViewerMediaTextureIDMap.insert(LLViewerMedia::impl_id_map::value_type(id, this));
+ }
- mTextureId = id;
- }
+ mTextureId = id;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::isAutoPlayable() const
{
- return (mMediaAutoPlay &&
- gSavedSettings.getS32("ParcelMediaAutoPlayEnable") != 0 &&
- gSavedSettings.getBOOL("MediaTentativeAutoPlay"));
+ return (mMediaAutoPlay &&
+ gSavedSettings.getS32("ParcelMediaAutoPlayEnable") != 0 &&
+ gSavedSettings.getBOOL("MediaTentativeAutoPlay"));
}
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::shouldShowBasedOnClass() const
{
- // If this is parcel media or in the UI, return true always
- if (getUsedInUI() || isParcelMedia()) return true;
+ // If this is parcel media or in the UI, return true always
+ if (getUsedInUI() || isParcelMedia()) return true;
- bool attached_to_another_avatar = isAttachedToAnotherAvatar();
- bool inside_parcel = isInAgentParcel();
+ bool attached_to_another_avatar = isAttachedToAnotherAvatar();
+ bool inside_parcel = isInAgentParcel();
- // LL_INFOS() << " hasFocus = " << hasFocus() <<
- // " others = " << (attached_to_another_avatar && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING)) <<
- // " within = " << (inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING)) <<
- // " outside = " << (!inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING)) << LL_ENDL;
+ // LL_INFOS() << " hasFocus = " << hasFocus() <<
+ // " others = " << (attached_to_another_avatar && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING)) <<
+ // " within = " << (inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING)) <<
+ // " outside = " << (!inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING)) << LL_ENDL;
- // If it has focus, we should show it
- // This is incorrect, and causes EXT-6750 (disabled attachment media still plays)
-// if (hasFocus())
-// return true;
+ // If it has focus, we should show it
+ // This is incorrect, and causes EXT-6750 (disabled attachment media still plays)
+// if (hasFocus())
+// return true;
- // If it is attached to an avatar and the pref is off, we shouldn't show it
- if (attached_to_another_avatar)
- {
- static LLCachedControl<bool> show_media_on_others(gSavedSettings, LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING, false);
- return show_media_on_others;
- }
- if (inside_parcel)
- {
- static LLCachedControl<bool> show_media_within_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING, true);
+ // If it is attached to an avatar and the pref is off, we shouldn't show it
+ if (attached_to_another_avatar)
+ {
+ static LLCachedControl<bool> show_media_on_others(gSavedSettings, LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING, false);
+ return show_media_on_others;
+ }
+ if (inside_parcel)
+ {
+ static LLCachedControl<bool> show_media_within_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING, true);
- return show_media_within_parcel;
- }
- else
- {
- static LLCachedControl<bool> show_media_outside_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING, true);
+ return show_media_within_parcel;
+ }
+ else
+ {
+ static LLCachedControl<bool> show_media_outside_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING, true);
- return show_media_outside_parcel;
- }
+ return show_media_outside_parcel;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -3916,7 +3916,7 @@ bool LLViewerMediaImpl::isObscured() const
{
return false;
}
-
+
if (agent_parcel->getObscureMOAP() && !isInAgentParcel())
{
return true;
@@ -3943,19 +3943,19 @@ bool LLViewerMediaImpl::isAttachedToHUD() const
//
bool LLViewerMediaImpl::isAttachedToAnotherAvatar() const
{
- bool result = false;
+ bool result = false;
- std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
- std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
- for ( ; iter != end; iter++)
- {
- if (isObjectAttachedToAnotherAvatar(*iter))
- {
- result = true;
- break;
- }
- }
- return result;
+ std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
+ std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
+ for ( ; iter != end; iter++)
+ {
+ if (isObjectAttachedToAnotherAvatar(*iter))
+ {
+ result = true;
+ break;
+ }
+ }
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -3963,49 +3963,49 @@ bool LLViewerMediaImpl::isAttachedToAnotherAvatar() const
//static
bool LLViewerMediaImpl::isObjectAttachedToAnotherAvatar(LLVOVolume *obj)
{
- bool result = false;
- LLXform *xform = obj;
- // Walk up parent chain
- while (NULL != xform)
- {
- LLViewerObject *object = dynamic_cast<LLViewerObject*> (xform);
- if (NULL != object)
- {
- LLVOAvatar *avatar = object->asAvatar();
- if ((NULL != avatar) && (avatar != gAgentAvatarp))
- {
- result = true;
- break;
- }
- }
- xform = xform->getParent();
- }
- return result;
+ bool result = false;
+ LLXform *xform = obj;
+ // Walk up parent chain
+ while (NULL != xform)
+ {
+ LLViewerObject *object = dynamic_cast<LLViewerObject*> (xform);
+ if (NULL != object)
+ {
+ LLVOAvatar *avatar = object->asAvatar();
+ if ((NULL != avatar) && (avatar != gAgentAvatarp))
+ {
+ result = true;
+ break;
+ }
+ }
+ xform = xform->getParent();
+ }
+ return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::isInAgentParcel() const
{
- bool result = false;
+ bool result = false;
- std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
- std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
- for ( ; iter != end; iter++)
- {
- LLVOVolume *object = *iter;
- if (LLViewerMediaImpl::isObjectInAgentParcel(object))
- {
- result = true;
- break;
- }
- }
- return result;
+ std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
+ std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
+ for ( ; iter != end; iter++)
+ {
+ LLVOVolume *object = *iter;
+ if (LLViewerMediaImpl::isObjectInAgentParcel(object))
+ {
+ result = true;
+ break;
+ }
+ }
+ return result;
}
LLNotificationPtr LLViewerMediaImpl::getCurrentNotification() const
{
- return mNotification;
+ return mNotification;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -4013,5 +4013,5 @@ LLNotificationPtr LLViewerMediaImpl::getCurrentNotification() const
// static
bool LLViewerMediaImpl::isObjectInAgentParcel(LLVOVolume *obj)
{
- return (LLViewerParcelMgr::getInstance()->inAgentParcel(obj->getPositionGlobal()));
+ return (LLViewerParcelMgr::getInstance()->inAgentParcel(obj->getPositionGlobal()));
}
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 03899b6b8f..33092f1435 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,449 +57,449 @@ typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
class LLViewerMediaEventEmitter
{
public:
- virtual ~LLViewerMediaEventEmitter();
+ virtual ~LLViewerMediaEventEmitter();
- bool addObserver( LLViewerMediaObserver* subject );
- bool remObserver( LLViewerMediaObserver* subject );
- virtual void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event);
+ bool addObserver( LLViewerMediaObserver* subject );
+ bool remObserver( LLViewerMediaObserver* subject );
+ virtual void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event);
private:
- typedef std::list< LLViewerMediaObserver* > observerListType;
- observerListType mObservers;
+ typedef std::list< LLViewerMediaObserver* > observerListType;
+ observerListType mObservers;
};
class LLViewerMediaImpl;
class LLViewerMedia: public LLSingleton<LLViewerMedia>
{
- LLSINGLETON(LLViewerMedia);
- ~LLViewerMedia();
- void initSingleton() override;
- LOG_CLASS(LLViewerMedia);
+ LLSINGLETON(LLViewerMedia);
+ ~LLViewerMedia();
+ void initSingleton() override;
+ LOG_CLASS(LLViewerMedia);
public:
- // String to get/set media autoplay in gSavedSettings
- static const char* AUTO_PLAY_MEDIA_SETTING;
- static const char* SHOW_MEDIA_ON_OTHERS_SETTING;
- static const char* SHOW_MEDIA_WITHIN_PARCEL_SETTING;
- static const char* SHOW_MEDIA_OUTSIDE_PARCEL_SETTING;
-
- typedef std::list<LLViewerMediaImpl*> impl_list;
-
- typedef std::map<LLUUID, LLViewerMediaImpl*> impl_id_map;
-
- // Special case early init for just web browser component
- // so we can show login screen. See .cpp file for details. JC
-
- viewer_media_t newMediaImpl(const LLUUID& texture_id,
- S32 media_width = 0,
- S32 media_height = 0,
- U8 media_auto_scale = false,
- U8 media_loop = false);
-
- viewer_media_t updateMediaImpl(LLMediaEntry* media_entry, const std::string& previous_url, bool update_from_self);
- LLViewerMediaImpl* getMediaImplFromTextureID(const LLUUID& texture_id);
- std::string getCurrentUserAgent();
- void updateBrowserUserAgent();
- bool handleSkinCurrentChanged(const LLSD& /*newvalue*/);
- bool textureHasMedia(const LLUUID& texture_id);
- void setVolume(F32 volume);
-
- // Is any media currently "showing"? Includes Parcel Media. Does not include media in the UI.
- bool isAnyMediaShowing();
- // Shows if any media is playing, counts visible non time based media as playing. Does not include media in the UI.
- bool isAnyMediaPlaying();
- // Set all media enabled or disabled, depending on val. Does not include media in the UI.
- void setAllMediaEnabled(bool val);
- // Set all media paused(stopped for non time based) or playing, depending on val. Does not include media in the UI.
- void setAllMediaPaused(bool val);
-
- static void onIdle(void* dummy_arg = NULL); // updateMedia wrapper
- void updateMedia(void* dummy_arg = NULL);
-
- F32 getVolume();
- void muteListChanged();
- bool isInterestingEnough(const LLVOVolume* object, const F64 &object_interest);
-
- // Returns the priority-sorted list of all media impls.
- impl_list &getPriorityList();
-
- // This is the comparitor used to sort the list.
- static bool priorityComparitor(const LLViewerMediaImpl* i1, const LLViewerMediaImpl* i2);
-
- // These are just helper functions for the convenience of others working with media
- bool hasInWorldMedia();
- std::string getParcelAudioURL();
- bool hasParcelMedia();
- bool hasParcelAudio();
- bool isParcelMediaPlaying();
- bool isParcelAudioPlaying();
-
- static void authSubmitCallback(const LLSD& notification, const LLSD& response);
-
- // Clear all cookies for all plugins
- void clearAllCookies();
-
- // Clear all plugins' caches
- void clearAllCaches();
-
- // Set the "cookies enabled" flag for all loaded plugins
- void setCookiesEnabled(bool enabled);
-
- // Set the proxy config for all loaded plugins
- void setProxyConfig(bool enable, const std::string &host, int port);
-
- void openIDSetup(const std::string &openid_url, const std::string &openid_token);
- void openIDCookieResponse(const std::string& url, const std::string &cookie);
-
- void proxyWindowOpened(const std::string &target, const std::string &uuid);
- void proxyWindowClosed(const std::string &uuid);
-
- void createSpareBrowserMediaSource();
- LLPluginClassMedia* getSpareBrowserMediaSource();
-
- void setOnlyAudibleMediaTextureID(const LLUUID& texture_id);
-
- LLSD getHeaders();
- LLCore::HttpHeaders::ptr_t getHttpHeaders();
-
+ // String to get/set media autoplay in gSavedSettings
+ static const char* AUTO_PLAY_MEDIA_SETTING;
+ static const char* SHOW_MEDIA_ON_OTHERS_SETTING;
+ static const char* SHOW_MEDIA_WITHIN_PARCEL_SETTING;
+ static const char* SHOW_MEDIA_OUTSIDE_PARCEL_SETTING;
+
+ typedef std::list<LLViewerMediaImpl*> impl_list;
+
+ typedef std::map<LLUUID, LLViewerMediaImpl*> impl_id_map;
+
+ // Special case early init for just web browser component
+ // so we can show login screen. See .cpp file for details. JC
+
+ viewer_media_t newMediaImpl(const LLUUID& texture_id,
+ S32 media_width = 0,
+ S32 media_height = 0,
+ U8 media_auto_scale = false,
+ U8 media_loop = false);
+
+ viewer_media_t updateMediaImpl(LLMediaEntry* media_entry, const std::string& previous_url, bool update_from_self);
+ LLViewerMediaImpl* getMediaImplFromTextureID(const LLUUID& texture_id);
+ std::string getCurrentUserAgent();
+ void updateBrowserUserAgent();
+ bool handleSkinCurrentChanged(const LLSD& /*newvalue*/);
+ bool textureHasMedia(const LLUUID& texture_id);
+ void setVolume(F32 volume);
+
+ // Is any media currently "showing"? Includes Parcel Media. Does not include media in the UI.
+ bool isAnyMediaShowing();
+ // Shows if any media is playing, counts visible non time based media as playing. Does not include media in the UI.
+ bool isAnyMediaPlaying();
+ // Set all media enabled or disabled, depending on val. Does not include media in the UI.
+ void setAllMediaEnabled(bool val);
+ // Set all media paused(stopped for non time based) or playing, depending on val. Does not include media in the UI.
+ void setAllMediaPaused(bool val);
+
+ static void onIdle(void* dummy_arg = NULL); // updateMedia wrapper
+ void updateMedia(void* dummy_arg = NULL);
+
+ F32 getVolume();
+ void muteListChanged();
+ bool isInterestingEnough(const LLVOVolume* object, const F64 &object_interest);
+
+ // Returns the priority-sorted list of all media impls.
+ impl_list &getPriorityList();
+
+ // This is the comparitor used to sort the list.
+ static bool priorityComparitor(const LLViewerMediaImpl* i1, const LLViewerMediaImpl* i2);
+
+ // These are just helper functions for the convenience of others working with media
+ bool hasInWorldMedia();
+ std::string getParcelAudioURL();
+ bool hasParcelMedia();
+ bool hasParcelAudio();
+ bool isParcelMediaPlaying();
+ bool isParcelAudioPlaying();
+
+ static void authSubmitCallback(const LLSD& notification, const LLSD& response);
+
+ // Clear all cookies for all plugins
+ void clearAllCookies();
+
+ // Clear all plugins' caches
+ void clearAllCaches();
+
+ // Set the "cookies enabled" flag for all loaded plugins
+ void setCookiesEnabled(bool enabled);
+
+ // Set the proxy config for all loaded plugins
+ void setProxyConfig(bool enable, const std::string &host, int port);
+
+ void openIDSetup(const std::string &openid_url, const std::string &openid_token);
+ void openIDCookieResponse(const std::string& url, const std::string &cookie);
+
+ void proxyWindowOpened(const std::string &target, const std::string &uuid);
+ void proxyWindowClosed(const std::string &uuid);
+
+ void createSpareBrowserMediaSource();
+ LLPluginClassMedia* getSpareBrowserMediaSource();
+
+ void setOnlyAudibleMediaTextureID(const LLUUID& texture_id);
+
+ LLSD getHeaders();
+ LLCore::HttpHeaders::ptr_t getHttpHeaders();
+
private:
- void onAuthSubmit(const LLSD& notification, const LLSD& response);
- bool parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path, bool& httponly, bool& secure);
- void setOpenIDCookie(const std::string& url);
- void onTeleportFinished();
-
- static void openIDSetupCoro(std::string openidUrl, std::string openidToken);
- static void getOpenIDCookieCoro(std::string url);
-
- bool mAnyMediaShowing;
- bool mAnyMediaPlaying;
- LLURL mOpenIDURL;
- std::string mOpenIDCookie;
- LLPluginClassMedia* mSpareBrowserMediaSource;
- boost::signals2::connection mTeleportFinishConnection;
+ void onAuthSubmit(const LLSD& notification, const LLSD& response);
+ bool parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path, bool& httponly, bool& secure);
+ void setOpenIDCookie(const std::string& url);
+ void onTeleportFinished();
+
+ static void openIDSetupCoro(std::string openidUrl, std::string openidToken);
+ static void getOpenIDCookieCoro(std::string url);
+
+ bool mAnyMediaShowing;
+ bool mAnyMediaPlaying;
+ LLURL mOpenIDURL;
+ std::string mOpenIDCookie;
+ LLPluginClassMedia* mSpareBrowserMediaSource;
+ boost::signals2::connection mTeleportFinishConnection;
};
// Implementation functions not exported into header file
class LLViewerMediaImpl
- : public LLMouseHandler, public LLRefCount, public LLPluginClassMediaOwner, public LLViewerMediaEventEmitter, public LLEditMenuHandler
+ : public LLMouseHandler, public LLRefCount, public LLPluginClassMediaOwner, public LLViewerMediaEventEmitter, public LLEditMenuHandler
{
- LOG_CLASS(LLViewerMediaImpl);
+ LOG_CLASS(LLViewerMediaImpl);
public:
-
- friend class LLViewerMedia;
-
- LLViewerMediaImpl(
- const LLUUID& texture_id,
- S32 media_width,
- S32 media_height,
- U8 media_auto_scale,
- U8 media_loop);
-
- ~LLViewerMediaImpl();
-
- // Override inherited version from LLViewerMediaEventEmitter
- virtual void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event);
-
- void createMediaSource();
- void destroyMediaSource();
- void setMediaType(const std::string& media_type);
- bool initializeMedia(const std::string& mime_type);
- bool initializePlugin(const std::string& media_type);
- void loadURI();
- void executeJavaScript(const std::string& code);
- LLPluginClassMedia* getMediaPlugin() { return mMediaSource.get(); }
- void setSize(int width, int height);
-
- void showNotification(LLNotificationPtr notify);
- void hideNotification();
-
- void play();
- void stop();
- void pause();
- void start();
- void seek(F32 time);
- void skipBack(F32 step_scale);
- void skipForward(F32 step_scale);
- void setVolume(F32 volume);
- void setMute(bool mute);
- void updateVolume();
- F32 getVolume();
- void focus(bool focus);
- // True if the impl has user focus.
- bool hasFocus() const;
- void mouseDown(S32 x, S32 y, MASK mask, S32 button = 0);
- void mouseUp(S32 x, S32 y, MASK mask, S32 button = 0);
- void mouseMove(S32 x, S32 y, MASK mask);
- void mouseDown(const LLVector2& texture_coords, MASK mask, S32 button = 0);
- void mouseUp(const LLVector2& texture_coords, MASK mask, S32 button = 0);
- void mouseMove(const LLVector2& texture_coords, MASK mask);
+
+ friend class LLViewerMedia;
+
+ LLViewerMediaImpl(
+ const LLUUID& texture_id,
+ S32 media_width,
+ S32 media_height,
+ U8 media_auto_scale,
+ U8 media_loop);
+
+ ~LLViewerMediaImpl();
+
+ // Override inherited version from LLViewerMediaEventEmitter
+ virtual void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event);
+
+ void createMediaSource();
+ void destroyMediaSource();
+ void setMediaType(const std::string& media_type);
+ bool initializeMedia(const std::string& mime_type);
+ bool initializePlugin(const std::string& media_type);
+ void loadURI();
+ void executeJavaScript(const std::string& code);
+ LLPluginClassMedia* getMediaPlugin() { return mMediaSource.get(); }
+ void setSize(int width, int height);
+
+ void showNotification(LLNotificationPtr notify);
+ void hideNotification();
+
+ void play();
+ void stop();
+ void pause();
+ void start();
+ void seek(F32 time);
+ void skipBack(F32 step_scale);
+ void skipForward(F32 step_scale);
+ void setVolume(F32 volume);
+ void setMute(bool mute);
+ void updateVolume();
+ F32 getVolume();
+ void focus(bool focus);
+ // True if the impl has user focus.
+ bool hasFocus() const;
+ void mouseDown(S32 x, S32 y, MASK mask, S32 button = 0);
+ void mouseUp(S32 x, S32 y, MASK mask, S32 button = 0);
+ void mouseMove(S32 x, S32 y, MASK mask);
+ void mouseDown(const LLVector2& texture_coords, MASK mask, S32 button = 0);
+ void mouseUp(const LLVector2& texture_coords, MASK mask, S32 button = 0);
+ void mouseMove(const LLVector2& texture_coords, MASK mask);
void mouseDoubleClick(const LLVector2& texture_coords, MASK mask);
void mouseDoubleClick(S32 x, S32 y, MASK mask, S32 button = 0);
- void scrollWheel(const LLVector2& texture_coords, S32 scroll_x, S32 scroll_y, MASK mask);
- void scrollWheel(S32 x, S32 y, S32 scroll_x, S32 scroll_y, MASK mask);
- void mouseCapture();
-
- void navigateBack();
- void navigateForward();
- void navigateReload();
- void navigateHome();
- void unload();
- void navigateTo(const std::string& url, const std::string& mime_type = "", bool rediscover_type = false, bool server_request = false, bool clean_browser = false);
- void navigateInternal();
- void navigateStop();
- bool handleKeyHere(KEY key, MASK mask);
- bool handleKeyUpHere(KEY key, MASK mask);
- bool handleUnicodeCharHere(llwchar uni_char);
- bool canNavigateForward();
- bool canNavigateBack();
- std::string getMediaURL() const { return mMediaURL; }
- std::string getCurrentMediaURL();
- std::string getHomeURL() { return mHomeURL; }
- std::string getMediaEntryURL() { return mMediaEntryURL; }
- void setHomeURL(const std::string& home_url, const std::string& mime_type = LLStringUtil::null) { mHomeURL = home_url; mHomeMimeType = mime_type;};
- void clearCache();
- void setPageZoomFactor( double factor );
- double getPageZoomFactor() {return mZoomFactor;}
- std::string getMimeType() { return mMimeType; }
- void scaleMouse(S32 *mouse_x, S32 *mouse_y);
- void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y);
-
- void update();
+ void scrollWheel(const LLVector2& texture_coords, S32 scroll_x, S32 scroll_y, MASK mask);
+ void scrollWheel(S32 x, S32 y, S32 scroll_x, S32 scroll_y, MASK mask);
+ void mouseCapture();
+
+ void navigateBack();
+ void navigateForward();
+ void navigateReload();
+ void navigateHome();
+ void unload();
+ void navigateTo(const std::string& url, const std::string& mime_type = "", bool rediscover_type = false, bool server_request = false, bool clean_browser = false);
+ void navigateInternal();
+ void navigateStop();
+ bool handleKeyHere(KEY key, MASK mask);
+ bool handleKeyUpHere(KEY key, MASK mask);
+ bool handleUnicodeCharHere(llwchar uni_char);
+ bool canNavigateForward();
+ bool canNavigateBack();
+ std::string getMediaURL() const { return mMediaURL; }
+ std::string getCurrentMediaURL();
+ std::string getHomeURL() { return mHomeURL; }
+ std::string getMediaEntryURL() { return mMediaEntryURL; }
+ void setHomeURL(const std::string& home_url, const std::string& mime_type = LLStringUtil::null) { mHomeURL = home_url; mHomeMimeType = mime_type;};
+ void clearCache();
+ void setPageZoomFactor( double factor );
+ double getPageZoomFactor() {return mZoomFactor;}
+ std::string getMimeType() { return mMimeType; }
+ void scaleMouse(S32 *mouse_x, S32 *mouse_y);
+ void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y);
+
+ void update();
bool preMediaTexUpdate(LLViewerMediaTexture*& media_tex, U8*& data, S32& data_width, S32& data_height, S32& x_pos, S32& y_pos, S32& width, S32& height);
void doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* data, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool sync);
- void updateImagesMediaStreams();
- LLUUID getMediaTextureID() const;
-
- void suspendUpdates(bool suspend) { mSuspendUpdates = suspend; }
- void setVisible(bool visible);
- bool getVisible() const { return mVisible; }
- bool isVisible() const { return mVisible; }
-
- bool isMediaTimeBased();
- bool isMediaPlaying();
- bool isMediaPaused();
- bool hasMedia() const;
- bool isMediaFailed() const { return mMediaSourceFailed; }
- void setMediaFailed(bool val) { mMediaSourceFailed = val; }
- void resetPreviousMediaState();
-
- void setDisabled(bool disabled, bool forcePlayOnEnable = false);
- bool isMediaDisabled() const { return mIsDisabled; };
-
- void setInNearbyMediaList(bool in_list) { mInNearbyMediaList = in_list; }
- bool getInNearbyMediaList() { return mInNearbyMediaList; }
-
- // returns true if this instance should not be loaded (disabled, muted object, crashed, etc.)
- bool isForcedUnloaded() const;
-
- // returns true if this instance could be playable based on autoplay setting, current load state, etc.
- bool isPlayable() const;
-
- void setIsParcelMedia(bool is_parcel_media) { mIsParcelMedia = is_parcel_media; }
- bool isParcelMedia() const { return mIsParcelMedia; }
-
- ECursorType getLastSetCursor() { return mLastSetCursor; }
-
- void setTarget(const std::string& target) { mTarget = target; }
-
- // utility function to create a ready-to-use media instance from a desired media type.
- static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, F64 zoom_factor, const std::string target = LLStringUtil::null, bool clean_browser = false);
-
- // Internally set our desired browser user agent string, including
- // the Second Life version and skin name. Used because we can
- // switch skins without restarting the app.
- static void updateBrowserUserAgent();
-
- // Callback for when the SkinCurrent control is changed to
- // switch the user agent string to indicate the new skin.
- static bool handleSkinCurrentChanged(const LLSD& newvalue);
-
- // need these to handle mouseup...
- /*virtual*/ void onMouseCaptureLost();
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
-
- // Grr... the only thing I want as an LLMouseHandler are the onMouseCaptureLost and handleMouseUp calls.
- // Sadly, these are all pure virtual, so I have to supply implementations here:
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) { return FALSE; };
- /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; };
- /*virtual*/ BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) { return FALSE; };
- /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; };
- /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
- /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) { return FALSE; };
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; };
- /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
- /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) {return FALSE; };
- /*virtual*/ const std::string& getName() const;
-
- /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {};
- /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {};
- /*virtual*/ BOOL hasMouseCapture() { return gFocusMgr.getMouseCapture() == this; };
-
- // Inherited from LLPluginClassMediaOwner
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent);
-
- // LLEditMenuHandler overrides
- /*virtual*/ void cut();
- /*virtual*/ BOOL canCut() const;
-
- /*virtual*/ void copy();
- /*virtual*/ BOOL canCopy() const;
-
- /*virtual*/ void paste();
- /*virtual*/ BOOL canPaste() const;
-
- void addObject(LLVOVolume* obj) ;
- void removeObject(LLVOVolume* obj) ;
- const std::list< LLVOVolume* >* getObjectList() const ;
- LLVOVolume *getSomeObject();
- void setUpdated(BOOL updated) ;
- BOOL isUpdated() ;
-
- // updates the javascript object in the embedded browser with viewer values
- void updateJavascriptObject();
-
- // Updates the "interest" value in this object
- void calculateInterest();
- F64 getInterest() const { return mInterest; };
- F64 getApproximateTextureInterest();
- S32 getProximity() const { return mProximity; };
- F64 getProximityDistance() const { return mProximityDistance; };
-
- // Mark this object as being used in a UI panel instead of on a prim
- // This will be used as part of the interest sorting algorithm.
- void setUsedInUI(bool used_in_ui);
- bool getUsedInUI() const { return mUsedInUI; };
-
- void setBackgroundColor(LLColor4 color);
-
- F64 getCPUUsage() const;
-
- void setPriority(LLPluginClassMedia::EPriority priority);
- LLPluginClassMedia::EPriority getPriority() { return mPriority; };
-
- void setLowPrioritySizeLimit(int size);
-
- void setTextureID(LLUUID id = LLUUID::null);
-
- bool isTrustedBrowser() { return mTrustedBrowser; }
- void setTrustedBrowser(bool trusted) { mTrustedBrowser = trusted; }
-
- typedef enum
- {
- MEDIANAVSTATE_NONE, // State is outside what we need to track for navigation.
- MEDIANAVSTATE_BEGUN, // a MEDIA_EVENT_NAVIGATE_BEGIN has been received which was not server-directed
- MEDIANAVSTATE_FIRST_LOCATION_CHANGED, // first LOCATION_CHANGED event after a non-server-directed BEGIN
- MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS, // Same as above, but the new URL is identical to the previously navigated URL.
- MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED, // we received a NAVIGATE_COMPLETE event before the first LOCATION_CHANGED
- MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS,// Same as above, but the new URL is identical to the previously navigated URL.
- MEDIANAVSTATE_SERVER_SENT, // server-directed nav has been requested, but MEDIA_EVENT_NAVIGATE_BEGIN hasn't been received yet
- MEDIANAVSTATE_SERVER_BEGUN, // MEDIA_EVENT_NAVIGATE_BEGIN has been received which was server-directed
- MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED, // first LOCATION_CHANGED event after a server-directed BEGIN
- MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED // we received a NAVIGATE_COMPLETE event before the first LOCATION_CHANGED
-
- }EMediaNavState;
-
- // Returns the current nav state of the media.
- // note that this will be updated BEFORE listeners and objects receive media messages
- EMediaNavState getNavState() { return mMediaNavState; }
- void setNavState(EMediaNavState state);
-
- void setNavigateSuspended(bool suspend);
- bool isNavigateSuspended() { return mNavigateSuspended; };
-
- void cancelMimeTypeProbe();
-
+ void updateImagesMediaStreams();
+ LLUUID getMediaTextureID() const;
+
+ void suspendUpdates(bool suspend) { mSuspendUpdates = suspend; }
+ void setVisible(bool visible);
+ bool getVisible() const { return mVisible; }
+ bool isVisible() const { return mVisible; }
+
+ bool isMediaTimeBased();
+ bool isMediaPlaying();
+ bool isMediaPaused();
+ bool hasMedia() const;
+ bool isMediaFailed() const { return mMediaSourceFailed; }
+ void setMediaFailed(bool val) { mMediaSourceFailed = val; }
+ void resetPreviousMediaState();
+
+ void setDisabled(bool disabled, bool forcePlayOnEnable = false);
+ bool isMediaDisabled() const { return mIsDisabled; };
+
+ void setInNearbyMediaList(bool in_list) { mInNearbyMediaList = in_list; }
+ bool getInNearbyMediaList() { return mInNearbyMediaList; }
+
+ // returns true if this instance should not be loaded (disabled, muted object, crashed, etc.)
+ bool isForcedUnloaded() const;
+
+ // returns true if this instance could be playable based on autoplay setting, current load state, etc.
+ bool isPlayable() const;
+
+ void setIsParcelMedia(bool is_parcel_media) { mIsParcelMedia = is_parcel_media; }
+ bool isParcelMedia() const { return mIsParcelMedia; }
+
+ ECursorType getLastSetCursor() { return mLastSetCursor; }
+
+ void setTarget(const std::string& target) { mTarget = target; }
+
+ // utility function to create a ready-to-use media instance from a desired media type.
+ static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, F64 zoom_factor, const std::string target = LLStringUtil::null, bool clean_browser = false);
+
+ // Internally set our desired browser user agent string, including
+ // the Second Life version and skin name. Used because we can
+ // switch skins without restarting the app.
+ static void updateBrowserUserAgent();
+
+ // Callback for when the SkinCurrent control is changed to
+ // switch the user agent string to indicate the new skin.
+ static bool handleSkinCurrentChanged(const LLSD& newvalue);
+
+ // need these to handle mouseup...
+ /*virtual*/ void onMouseCaptureLost();
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+
+ // Grr... the only thing I want as an LLMouseHandler are the onMouseCaptureLost and handleMouseUp calls.
+ // Sadly, these are all pure virtual, so I have to supply implementations here:
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) { return FALSE; };
+ /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; };
+ /*virtual*/ BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) { return FALSE; };
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; };
+ /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
+ /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) { return FALSE; };
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; };
+ /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
+ /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) {return FALSE; };
+ /*virtual*/ const std::string& getName() const;
+
+ /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {};
+ /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {};
+ /*virtual*/ BOOL hasMouseCapture() { return gFocusMgr.getMouseCapture() == this; };
+
+ // Inherited from LLPluginClassMediaOwner
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent);
+
+ // LLEditMenuHandler overrides
+ /*virtual*/ void cut();
+ /*virtual*/ BOOL canCut() const;
+
+ /*virtual*/ void copy();
+ /*virtual*/ BOOL canCopy() const;
+
+ /*virtual*/ void paste();
+ /*virtual*/ BOOL canPaste() const;
+
+ void addObject(LLVOVolume* obj) ;
+ void removeObject(LLVOVolume* obj) ;
+ const std::list< LLVOVolume* >* getObjectList() const ;
+ LLVOVolume *getSomeObject();
+ void setUpdated(BOOL updated) ;
+ BOOL isUpdated() ;
+
+ // updates the javascript object in the embedded browser with viewer values
+ void updateJavascriptObject();
+
+ // Updates the "interest" value in this object
+ void calculateInterest();
+ F64 getInterest() const { return mInterest; };
+ F64 getApproximateTextureInterest();
+ S32 getProximity() const { return mProximity; };
+ F64 getProximityDistance() const { return mProximityDistance; };
+
+ // Mark this object as being used in a UI panel instead of on a prim
+ // This will be used as part of the interest sorting algorithm.
+ void setUsedInUI(bool used_in_ui);
+ bool getUsedInUI() const { return mUsedInUI; };
+
+ void setBackgroundColor(LLColor4 color);
+
+ F64 getCPUUsage() const;
+
+ void setPriority(LLPluginClassMedia::EPriority priority);
+ LLPluginClassMedia::EPriority getPriority() { return mPriority; };
+
+ void setLowPrioritySizeLimit(int size);
+
+ void setTextureID(LLUUID id = LLUUID::null);
+
+ bool isTrustedBrowser() { return mTrustedBrowser; }
+ void setTrustedBrowser(bool trusted) { mTrustedBrowser = trusted; }
+
+ typedef enum
+ {
+ MEDIANAVSTATE_NONE, // State is outside what we need to track for navigation.
+ MEDIANAVSTATE_BEGUN, // a MEDIA_EVENT_NAVIGATE_BEGIN has been received which was not server-directed
+ MEDIANAVSTATE_FIRST_LOCATION_CHANGED, // first LOCATION_CHANGED event after a non-server-directed BEGIN
+ MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS, // Same as above, but the new URL is identical to the previously navigated URL.
+ MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED, // we received a NAVIGATE_COMPLETE event before the first LOCATION_CHANGED
+ MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS,// Same as above, but the new URL is identical to the previously navigated URL.
+ MEDIANAVSTATE_SERVER_SENT, // server-directed nav has been requested, but MEDIA_EVENT_NAVIGATE_BEGIN hasn't been received yet
+ MEDIANAVSTATE_SERVER_BEGUN, // MEDIA_EVENT_NAVIGATE_BEGIN has been received which was server-directed
+ MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED, // first LOCATION_CHANGED event after a server-directed BEGIN
+ MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED // we received a NAVIGATE_COMPLETE event before the first LOCATION_CHANGED
+
+ }EMediaNavState;
+
+ // Returns the current nav state of the media.
+ // note that this will be updated BEFORE listeners and objects receive media messages
+ EMediaNavState getNavState() { return mMediaNavState; }
+ void setNavState(EMediaNavState state);
+
+ void setNavigateSuspended(bool suspend);
+ bool isNavigateSuspended() { return mNavigateSuspended; };
+
+ void cancelMimeTypeProbe();
+
bool isAttachedToHUD() const;
- // Is this media attached to an avatar *not* self
- bool isAttachedToAnotherAvatar() const;
-
- // Is this media in the agent's parcel?
- bool isInAgentParcel() const;
+ // Is this media attached to an avatar *not* self
+ bool isAttachedToAnotherAvatar() const;
+
+ // Is this media in the agent's parcel?
+ bool isInAgentParcel() const;
- // get currently active notification associated with this media instance
- LLNotificationPtr getCurrentNotification() const;
+ // get currently active notification associated with this media instance
+ LLNotificationPtr getCurrentNotification() const;
private:
- bool isAutoPlayable() const;
- bool shouldShowBasedOnClass() const;
- bool isObscured() const;
- static bool isObjectAttachedToAnotherAvatar(LLVOVolume *obj);
- static bool isObjectInAgentParcel(LLVOVolume *obj);
-
+ bool isAutoPlayable() const;
+ bool shouldShowBasedOnClass() const;
+ bool isObscured() const;
+ static bool isObjectAttachedToAnotherAvatar(LLVOVolume *obj);
+ static bool isObjectInAgentParcel(LLVOVolume *obj);
+
private:
- // a single media url with some data and an impl.
- std::shared_ptr<LLPluginClassMedia> mMediaSource;
+ // a single media url with some data and an impl.
+ std::shared_ptr<LLPluginClassMedia> mMediaSource;
LLMutex mLock;
- F64 mZoomFactor;
- LLUUID mTextureId;
- bool mMovieImageHasMips;
- std::string mMediaURL; // The last media url set with NavigateTo
- std::string mHomeURL;
- std::string mHomeMimeType; // forced mime type for home url
- std::string mMimeType;
- std::string mCurrentMediaURL; // The most current media url from the plugin (via the "location changed" or "navigate complete" events).
- std::string mCurrentMimeType; // The MIME type that caused the currently loaded plugin to be loaded.
- S32 mLastMouseX; // save the last mouse coord we get, so when we lose capture we can simulate a mouseup at that point.
- S32 mLastMouseY;
- S32 mMediaWidth;
- S32 mMediaHeight;
- bool mMediaAutoScale;
- bool mMediaLoop;
- bool mNeedsNewTexture;
- S32 mTextureUsedWidth;
- S32 mTextureUsedHeight;
- bool mSuspendUpdates;
+ F64 mZoomFactor;
+ LLUUID mTextureId;
+ bool mMovieImageHasMips;
+ std::string mMediaURL; // The last media url set with NavigateTo
+ std::string mHomeURL;
+ std::string mHomeMimeType; // forced mime type for home url
+ std::string mMimeType;
+ std::string mCurrentMediaURL; // The most current media url from the plugin (via the "location changed" or "navigate complete" events).
+ std::string mCurrentMimeType; // The MIME type that caused the currently loaded plugin to be loaded.
+ S32 mLastMouseX; // save the last mouse coord we get, so when we lose capture we can simulate a mouseup at that point.
+ S32 mLastMouseY;
+ S32 mMediaWidth;
+ S32 mMediaHeight;
+ bool mMediaAutoScale;
+ bool mMediaLoop;
+ bool mNeedsNewTexture;
+ S32 mTextureUsedWidth;
+ S32 mTextureUsedHeight;
+ bool mSuspendUpdates;
bool mTextureUpdatePending = false;
- bool mVisible;
- ECursorType mLastSetCursor;
- EMediaNavState mMediaNavState;
- F64 mInterest;
- bool mUsedInUI;
- bool mHasFocus;
- LLPluginClassMedia::EPriority mPriority;
- bool mNavigateRediscoverType;
- bool mNavigateServerRequest;
- bool mMediaSourceFailed;
- F32 mRequestedVolume;
- F32 mPreviousVolume;
- bool mIsMuted;
- bool mNeedsMuteCheck;
- int mPreviousMediaState;
- F64 mPreviousMediaTime;
- bool mIsDisabled;
- bool mIsParcelMedia;
- S32 mProximity;
- F64 mProximityDistance;
- F64 mProximityCamera;
- bool mMediaAutoPlay;
- std::string mMediaEntryURL;
- bool mInNearbyMediaList; // used by LLPanelNearbyMedia::refreshList() for performance reasons
- bool mClearCache;
- LLColor4 mBackgroundColor;
- bool mNavigateSuspended;
- bool mNavigateSuspendedDeferred;
- bool mTrustedBrowser;
- std::string mTarget;
- LLNotificationPtr mNotification;
+ bool mVisible;
+ ECursorType mLastSetCursor;
+ EMediaNavState mMediaNavState;
+ F64 mInterest;
+ bool mUsedInUI;
+ bool mHasFocus;
+ LLPluginClassMedia::EPriority mPriority;
+ bool mNavigateRediscoverType;
+ bool mNavigateServerRequest;
+ bool mMediaSourceFailed;
+ F32 mRequestedVolume;
+ F32 mPreviousVolume;
+ bool mIsMuted;
+ bool mNeedsMuteCheck;
+ int mPreviousMediaState;
+ F64 mPreviousMediaTime;
+ bool mIsDisabled;
+ bool mIsParcelMedia;
+ S32 mProximity;
+ F64 mProximityDistance;
+ F64 mProximityCamera;
+ bool mMediaAutoPlay;
+ std::string mMediaEntryURL;
+ bool mInNearbyMediaList; // used by LLPanelNearbyMedia::refreshList() for performance reasons
+ bool mClearCache;
+ LLColor4 mBackgroundColor;
+ bool mNavigateSuspended;
+ bool mNavigateSuspendedDeferred;
+ bool mTrustedBrowser;
+ std::string mTarget;
+ LLNotificationPtr mNotification;
bool mCleanBrowser; // force the creation of a clean browsing target with full options enabled
static std::vector<std::string> sMimeTypesFailed;
LLPointer<LLImageRaw> mRawImage; //backing buffer for texture updates
private:
- BOOL mIsUpdated ;
- std::list< LLVOVolume* > mObjectList ;
+ BOOL mIsUpdated ;
+ std::list< LLVOVolume* > mObjectList ;
void mimeDiscoveryCoro(std::string url);
LLCoreHttpUtil::HttpCoroutineAdapter::wptr_t mMimeProbe;
bool mCanceling;
private:
- LLViewerMediaTexture *updateMediaImage();
+ LLViewerMediaTexture *updateMediaImage();
LL::WorkQueue::weak_t mMainQueue;
LL::WorkQueue::weak_t mTexUpdateQueue;
};
-#endif // LLVIEWERMEDIA_H
+#endif // LLVIEWERMEDIA_H
diff --git a/indra/newview/llviewermedia_streamingaudio.cpp b/indra/newview/llviewermedia_streamingaudio.cpp
index d3e24aece5..af3a21c183 100644
--- a/indra/newview/llviewermedia_streamingaudio.cpp
+++ b/indra/newview/llviewermedia_streamingaudio.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewermedia_streamingaudio.h
* @author Tofu Linden, Sam Kolb
* @brief LLStreamingAudio_MediaPlugins implementation - an implementation of the streaming audio interface which is implemented as a client of the media plugin API.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,130 +36,130 @@
#include "lldir.h"
LLStreamingAudio_MediaPlugins::LLStreamingAudio_MediaPlugins() :
- mMediaPlugin(NULL),
- mGain(1.0)
+ mMediaPlugin(NULL),
+ mGain(1.0)
{
- // nothing interesting to do?
- // we will lazily create a media plugin at play-time, if none exists.
+ // nothing interesting to do?
+ // we will lazily create a media plugin at play-time, if none exists.
}
LLStreamingAudio_MediaPlugins::~LLStreamingAudio_MediaPlugins()
{
- delete mMediaPlugin;
- mMediaPlugin = NULL;
+ delete mMediaPlugin;
+ mMediaPlugin = NULL;
}
void LLStreamingAudio_MediaPlugins::start(const std::string& url)
{
- if (!mMediaPlugin) // lazy-init the underlying media plugin
- {
- mMediaPlugin = initializeMedia("audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis.
- LL_INFOS() << "streaming audio mMediaPlugin is now " << mMediaPlugin << LL_ENDL;
- }
-
- if(!mMediaPlugin)
- return;
-
- if (!url.empty()) {
- LL_INFOS() << "Starting internet stream: " << url << LL_ENDL;
- mURL = url;
- mMediaPlugin->loadURI ( url );
- mMediaPlugin->start();
- LL_INFOS() << "Playing stream..." << LL_ENDL;
- } else {
- LL_INFOS() << "setting stream to NULL"<< LL_ENDL;
- mURL.clear();
- mMediaPlugin->stop();
- }
+ if (!mMediaPlugin) // lazy-init the underlying media plugin
+ {
+ mMediaPlugin = initializeMedia("audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis.
+ LL_INFOS() << "streaming audio mMediaPlugin is now " << mMediaPlugin << LL_ENDL;
+ }
+
+ if(!mMediaPlugin)
+ return;
+
+ if (!url.empty()) {
+ LL_INFOS() << "Starting internet stream: " << url << LL_ENDL;
+ mURL = url;
+ mMediaPlugin->loadURI ( url );
+ mMediaPlugin->start();
+ LL_INFOS() << "Playing stream..." << LL_ENDL;
+ } else {
+ LL_INFOS() << "setting stream to NULL"<< LL_ENDL;
+ mURL.clear();
+ mMediaPlugin->stop();
+ }
}
void LLStreamingAudio_MediaPlugins::stop()
{
- LL_INFOS() << "Stopping internet stream." << LL_ENDL;
- if(mMediaPlugin)
- {
- mMediaPlugin->stop();
- }
+ LL_INFOS() << "Stopping internet stream." << LL_ENDL;
+ if(mMediaPlugin)
+ {
+ mMediaPlugin->stop();
+ }
- mURL.clear();
+ mURL.clear();
}
void LLStreamingAudio_MediaPlugins::pause(int pause)
{
- if(!mMediaPlugin)
- return;
-
- if(pause)
- {
- LL_INFOS() << "Pausing internet stream." << LL_ENDL;
- mMediaPlugin->pause();
- }
- else
- {
- LL_INFOS() << "Unpausing internet stream." << LL_ENDL;
- mMediaPlugin->start();
- }
+ if(!mMediaPlugin)
+ return;
+
+ if(pause)
+ {
+ LL_INFOS() << "Pausing internet stream." << LL_ENDL;
+ mMediaPlugin->pause();
+ }
+ else
+ {
+ LL_INFOS() << "Unpausing internet stream." << LL_ENDL;
+ mMediaPlugin->start();
+ }
}
void LLStreamingAudio_MediaPlugins::update()
{
- if (mMediaPlugin)
- mMediaPlugin->idle();
+ if (mMediaPlugin)
+ mMediaPlugin->idle();
}
int LLStreamingAudio_MediaPlugins::isPlaying()
{
- if (!mMediaPlugin)
- return 0; // stopped
-
- LLPluginClassMediaOwner::EMediaStatus status =
- mMediaPlugin->getStatus();
-
- switch (status)
- {
- case LLPluginClassMediaOwner::MEDIA_LOADING: // but not MEDIA_LOADED
- case LLPluginClassMediaOwner::MEDIA_PLAYING:
- return 1; // Active and playing
- case LLPluginClassMediaOwner::MEDIA_PAUSED:
- return 2; // paused
- default:
- return 0; // stopped
- }
+ if (!mMediaPlugin)
+ return 0; // stopped
+
+ LLPluginClassMediaOwner::EMediaStatus status =
+ mMediaPlugin->getStatus();
+
+ switch (status)
+ {
+ case LLPluginClassMediaOwner::MEDIA_LOADING: // but not MEDIA_LOADED
+ case LLPluginClassMediaOwner::MEDIA_PLAYING:
+ return 1; // Active and playing
+ case LLPluginClassMediaOwner::MEDIA_PAUSED:
+ return 2; // paused
+ default:
+ return 0; // stopped
+ }
}
void LLStreamingAudio_MediaPlugins::setGain(F32 vol)
{
- mGain = vol;
+ mGain = vol;
- if(!mMediaPlugin)
- return;
+ if(!mMediaPlugin)
+ return;
- vol = llclamp(vol, 0.f, 1.f);
- mMediaPlugin->setVolume(vol);
+ vol = llclamp(vol, 0.f, 1.f);
+ mMediaPlugin->setVolume(vol);
}
F32 LLStreamingAudio_MediaPlugins::getGain()
{
- return mGain;
+ return mGain;
}
std::string LLStreamingAudio_MediaPlugins::getURL()
{
- return mURL;
+ return mURL;
}
LLPluginClassMedia* LLStreamingAudio_MediaPlugins::initializeMedia(const std::string& media_type)
{
- LLPluginClassMediaOwner* owner = NULL;
- S32 default_size = 1; // audio-only - be minimal, doesn't matter
- F64 default_zoom = 1.0;
- LLPluginClassMedia* media_source = LLViewerMediaImpl::newSourceFromMediaType(media_type, owner, default_size, default_size, default_zoom);
+ LLPluginClassMediaOwner* owner = NULL;
+ S32 default_size = 1; // audio-only - be minimal, doesn't matter
+ F64 default_zoom = 1.0;
+ LLPluginClassMedia* media_source = LLViewerMediaImpl::newSourceFromMediaType(media_type, owner, default_size, default_size, default_zoom);
- if (media_source)
- {
- media_source->setLoop(false); // audio streams are not expected to loop
- }
+ if (media_source)
+ {
+ media_source->setLoop(false); // audio streams are not expected to loop
+ }
- return media_source;
+ return media_source;
}
diff --git a/indra/newview/llviewermedia_streamingaudio.h b/indra/newview/llviewermedia_streamingaudio.h
index 1e7f771e17..bf4d92c29e 100644
--- a/indra/newview/llviewermedia_streamingaudio.h
+++ b/indra/newview/llviewermedia_streamingaudio.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewermedia_streamingaudio.h
* @author Tofu Linden
* @brief Definition of LLStreamingAudio_MediaPlugins implementation - an implementation of the streaming audio interface which is implemented as a client of the media plugins API.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,25 +38,25 @@ class LLPluginClassMedia;
class LLStreamingAudio_MediaPlugins : public LLStreamingAudioInterface
{
public:
- LLStreamingAudio_MediaPlugins();
- /*virtual*/ ~LLStreamingAudio_MediaPlugins();
-
- /*virtual*/ void start(const std::string& url);
- /*virtual*/ void stop();
- /*virtual*/ void pause(int pause);
- /*virtual*/ void update();
- /*virtual*/ int isPlaying();
- /*virtual*/ void setGain(F32 vol);
- /*virtual*/ F32 getGain();
- /*virtual*/ std::string getURL();
+ LLStreamingAudio_MediaPlugins();
+ /*virtual*/ ~LLStreamingAudio_MediaPlugins();
+
+ /*virtual*/ void start(const std::string& url);
+ /*virtual*/ void stop();
+ /*virtual*/ void pause(int pause);
+ /*virtual*/ void update();
+ /*virtual*/ int isPlaying();
+ /*virtual*/ void setGain(F32 vol);
+ /*virtual*/ F32 getGain();
+ /*virtual*/ std::string getURL();
private:
- LLPluginClassMedia* initializeMedia(const std::string& media_type);
+ LLPluginClassMedia* initializeMedia(const std::string& media_type);
- LLPluginClassMedia *mMediaPlugin;
+ LLPluginClassMedia *mMediaPlugin;
- std::string mURL;
- F32 mGain;
+ std::string mURL;
+ F32 mGain;
};
diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp
index e914e2121c..978a9bc6de 100644
--- a/indra/newview/llviewermediafocus.cpp
+++ b/indra/newview/llviewermediafocus.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewermediafocus.cpp
* @brief Governs focus on Media prims
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,228 +54,228 @@
//
LLViewerMediaFocus::LLViewerMediaFocus()
-: mFocusedObjectFace(0),
- mHoverObjectFace(0)
+: mFocusedObjectFace(0),
+ mHoverObjectFace(0)
{
}
LLViewerMediaFocus::~LLViewerMediaFocus()
{
- // The destructor for LLSingletons happens at atexit() time, which is too late to do much.
- // Clean up in cleanupClass() instead.
+ // The destructor for LLSingletons happens at atexit() time, which is too late to do much.
+ // Clean up in cleanupClass() instead.
gFocusMgr.removeKeyboardFocusWithoutCallback(this);
}
void LLViewerMediaFocus::setFocusFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal)
-{
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-
- LLViewerMediaImpl *old_media_impl = getFocusedMediaImpl();
- if(old_media_impl)
- {
- old_media_impl->focus(false);
- }
-
- // Always clear the current selection. If we're setting focus on a face, we'll reselect the correct object below.
- LLSelectMgr::getInstance()->deselectAll();
- mSelection = NULL;
-
- if (media_impl.notNull() && objectp.notNull())
- {
- bool face_auto_zoom = false;
- mPrevFocusedImplID = LLUUID::null;
- mFocusedImplID = media_impl->getMediaTextureID();
- mFocusedObjectID = objectp->getID();
- mFocusedObjectFace = face;
- mFocusedObjectNormal = pick_normal;
-
- // Set the selection in the selection manager so we can draw the focus ring.
- mSelection = LLSelectMgr::getInstance()->selectObjectOnly(objectp, face);
-
- // Focusing on a media face clears its disable flag.
- media_impl->setDisabled(false);
-
- LLTextureEntry* tep = objectp->getTE(face);
- if(tep->hasMedia())
- {
- LLMediaEntry* mep = tep->getMediaData();
- face_auto_zoom = mep->getAutoZoom();
- if(!media_impl->hasMedia())
- {
- std::string url = mep->getCurrentURL().empty() ? mep->getHomeURL() : mep->getCurrentURL();
- media_impl->navigateTo(url, "", true);
- }
- }
- else
- {
- // This should never happen.
- LL_WARNS() << "Can't find media entry for focused face" << LL_ENDL;
- }
-
- media_impl->focus(true);
- gFocusMgr.setKeyboardFocus(this);
- LLViewerMediaImpl* impl = getFocusedMediaImpl();
- if (impl)
- {
- LLEditMenuHandler::gEditMenuHandler = impl;
- }
-
- // We must do this before processing the media HUD zoom, or it may zoom to the wrong face.
- update();
-
- if(mMediaControls.get())
- {
- if(face_auto_zoom && ! parcel->getMediaPreventCameraZoom())
- {
- // Zoom in on this face
- mMediaControls.get()->resetZoomLevel(false);
- mMediaControls.get()->nextZoomLevel();
- }
- else
- {
- // Reset the controls' zoom level without moving the camera.
- // This fixes the case where clicking focus between two non-autozoom faces doesn't change the zoom-out button back to a zoom-in button.
- mMediaControls.get()->resetZoomLevel(false);
- }
- }
- }
- else
- {
- if(hasFocus())
- {
- gFocusMgr.setKeyboardFocus(NULL);
- }
-
- LLViewerMediaImpl* impl = getFocusedMediaImpl();
- if (LLEditMenuHandler::gEditMenuHandler == impl)
- {
- LLEditMenuHandler::gEditMenuHandler = NULL;
- }
-
-
- mFocusedImplID = LLUUID::null;
- if (objectp.notNull())
- {
- // Still record the focused object...it may mean we need to load media data.
- // This will aid us in determining this object is "important enough"
- mFocusedObjectID = objectp->getID();
- mFocusedObjectFace = face;
- }
- else {
- mFocusedObjectID = LLUUID::null;
- mFocusedObjectFace = 0;
- }
- }
+{
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+
+ LLViewerMediaImpl *old_media_impl = getFocusedMediaImpl();
+ if(old_media_impl)
+ {
+ old_media_impl->focus(false);
+ }
+
+ // Always clear the current selection. If we're setting focus on a face, we'll reselect the correct object below.
+ LLSelectMgr::getInstance()->deselectAll();
+ mSelection = NULL;
+
+ if (media_impl.notNull() && objectp.notNull())
+ {
+ bool face_auto_zoom = false;
+ mPrevFocusedImplID = LLUUID::null;
+ mFocusedImplID = media_impl->getMediaTextureID();
+ mFocusedObjectID = objectp->getID();
+ mFocusedObjectFace = face;
+ mFocusedObjectNormal = pick_normal;
+
+ // Set the selection in the selection manager so we can draw the focus ring.
+ mSelection = LLSelectMgr::getInstance()->selectObjectOnly(objectp, face);
+
+ // Focusing on a media face clears its disable flag.
+ media_impl->setDisabled(false);
+
+ LLTextureEntry* tep = objectp->getTE(face);
+ if(tep->hasMedia())
+ {
+ LLMediaEntry* mep = tep->getMediaData();
+ face_auto_zoom = mep->getAutoZoom();
+ if(!media_impl->hasMedia())
+ {
+ std::string url = mep->getCurrentURL().empty() ? mep->getHomeURL() : mep->getCurrentURL();
+ media_impl->navigateTo(url, "", true);
+ }
+ }
+ else
+ {
+ // This should never happen.
+ LL_WARNS() << "Can't find media entry for focused face" << LL_ENDL;
+ }
+
+ media_impl->focus(true);
+ gFocusMgr.setKeyboardFocus(this);
+ LLViewerMediaImpl* impl = getFocusedMediaImpl();
+ if (impl)
+ {
+ LLEditMenuHandler::gEditMenuHandler = impl;
+ }
+
+ // We must do this before processing the media HUD zoom, or it may zoom to the wrong face.
+ update();
+
+ if(mMediaControls.get())
+ {
+ if(face_auto_zoom && ! parcel->getMediaPreventCameraZoom())
+ {
+ // Zoom in on this face
+ mMediaControls.get()->resetZoomLevel(false);
+ mMediaControls.get()->nextZoomLevel();
+ }
+ else
+ {
+ // Reset the controls' zoom level without moving the camera.
+ // This fixes the case where clicking focus between two non-autozoom faces doesn't change the zoom-out button back to a zoom-in button.
+ mMediaControls.get()->resetZoomLevel(false);
+ }
+ }
+ }
+ else
+ {
+ if(hasFocus())
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+
+ LLViewerMediaImpl* impl = getFocusedMediaImpl();
+ if (LLEditMenuHandler::gEditMenuHandler == impl)
+ {
+ LLEditMenuHandler::gEditMenuHandler = NULL;
+ }
+
+
+ mFocusedImplID = LLUUID::null;
+ if (objectp.notNull())
+ {
+ // Still record the focused object...it may mean we need to load media data.
+ // This will aid us in determining this object is "important enough"
+ mFocusedObjectID = objectp->getID();
+ mFocusedObjectFace = face;
+ }
+ else {
+ mFocusedObjectID = LLUUID::null;
+ mFocusedObjectFace = 0;
+ }
+ }
}
void LLViewerMediaFocus::clearFocus()
{
- setFocusFace(NULL, 0, NULL);
+ setFocusFace(NULL, 0, NULL);
}
void LLViewerMediaFocus::setHoverFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal)
{
- if (media_impl.notNull())
- {
- mHoverImplID = media_impl->getMediaTextureID();
- mHoverObjectID = objectp->getID();
- mHoverObjectFace = face;
- mHoverObjectNormal = pick_normal;
- }
- else
- {
- mHoverObjectID = LLUUID::null;
- mHoverObjectFace = 0;
- mHoverImplID = LLUUID::null;
- }
+ if (media_impl.notNull())
+ {
+ mHoverImplID = media_impl->getMediaTextureID();
+ mHoverObjectID = objectp->getID();
+ mHoverObjectFace = face;
+ mHoverObjectNormal = pick_normal;
+ }
+ else
+ {
+ mHoverObjectID = LLUUID::null;
+ mHoverObjectFace = 0;
+ mHoverImplID = LLUUID::null;
+ }
}
void LLViewerMediaFocus::clearHover()
{
- setHoverFace(NULL, 0, NULL);
+ setHoverFace(NULL, 0, NULL);
}
bool LLViewerMediaFocus::getFocus()
{
- if (gFocusMgr.getKeyboardFocus() == this)
- {
- return true;
- }
- return false;
+ if (gFocusMgr.getKeyboardFocus() == this)
+ {
+ return true;
+ }
+ return false;
}
// This function selects an ideal viewing distance based on the focused object, pick normal, and padding value
LLVector3d LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only)
{
- LLVector3d camera_pos;
- if (object)
- {
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
-
- LLBBox bbox = object->getBoundingBoxAgent();
- LLVector3d center = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
- F32 height;
- F32 width;
- F32 depth;
- F32 angle_of_view;
- F32 distance;
-
- // We need the aspect ratio, and the 3 components of the bbox as height, width, and depth.
- F32 aspect_ratio = getBBoxAspectRatio(bbox, normal, &height, &width, &depth);
- F32 camera_aspect = LLViewerCamera::getInstance()->getAspect();
-
- LL_DEBUGS() << "normal = " << normal << ", aspect_ratio = " << aspect_ratio << ", camera_aspect = " << camera_aspect << LL_ENDL;
-
- // We will normally use the side of the volume aligned with the short side of the screen (i.e. the height for
- // a screen in a landscape aspect ratio), however there is an edge case where the aspect ratio of the object is
- // more extreme than the screen. In this case we invert the logic, using the longer component of both the object
- // and the screen.
- bool invert = (camera_aspect > 1.0f && aspect_ratio > camera_aspect) ||
- (camera_aspect < 1.0f && aspect_ratio < camera_aspect);
-
- // To calculate the optimum viewing distance we will need the angle of the shorter side of the view rectangle.
- // In portrait mode this is the width, and in landscape it is the height.
- // We then calculate the distance based on the corresponding side of the object bbox (width for portrait, height for landscape)
- // We will add half the depth of the bounding box, as the distance projection uses the center point of the bbox.
- if(camera_aspect < 1.0f || invert)
- {
- angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect());
- distance = width * 0.5 * padding_factor / tan(angle_of_view * 0.5f );
-
- LL_DEBUGS() << "using width (" << width << "), angle_of_view = " << angle_of_view << ", distance = " << distance << LL_ENDL;
- }
- else
- {
- angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView());
- distance = height * 0.5 * padding_factor / tan(angle_of_view * 0.5f );
-
- LL_DEBUGS() << "using height (" << height << "), angle_of_view = " << angle_of_view << ", distance = " << distance << LL_ENDL;
- }
-
- distance += depth * 0.5;
-
- // Finally animate the camera to this new position and focal point
- LLVector3d target_pos;
- // The target lookat position is the center of the selection (in global coords)
- target_pos = center;
- // Target look-from (camera) position is "distance" away from the target along the normal
- LLVector3d pickNormal = LLVector3d(normal);
- pickNormal.normalize();
+ LLVector3d camera_pos;
+ if (object)
+ {
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+
+ LLBBox bbox = object->getBoundingBoxAgent();
+ LLVector3d center = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
+ F32 height;
+ F32 width;
+ F32 depth;
+ F32 angle_of_view;
+ F32 distance;
+
+ // We need the aspect ratio, and the 3 components of the bbox as height, width, and depth.
+ F32 aspect_ratio = getBBoxAspectRatio(bbox, normal, &height, &width, &depth);
+ F32 camera_aspect = LLViewerCamera::getInstance()->getAspect();
+
+ LL_DEBUGS() << "normal = " << normal << ", aspect_ratio = " << aspect_ratio << ", camera_aspect = " << camera_aspect << LL_ENDL;
+
+ // We will normally use the side of the volume aligned with the short side of the screen (i.e. the height for
+ // a screen in a landscape aspect ratio), however there is an edge case where the aspect ratio of the object is
+ // more extreme than the screen. In this case we invert the logic, using the longer component of both the object
+ // and the screen.
+ bool invert = (camera_aspect > 1.0f && aspect_ratio > camera_aspect) ||
+ (camera_aspect < 1.0f && aspect_ratio < camera_aspect);
+
+ // To calculate the optimum viewing distance we will need the angle of the shorter side of the view rectangle.
+ // In portrait mode this is the width, and in landscape it is the height.
+ // We then calculate the distance based on the corresponding side of the object bbox (width for portrait, height for landscape)
+ // We will add half the depth of the bounding box, as the distance projection uses the center point of the bbox.
+ if(camera_aspect < 1.0f || invert)
+ {
+ angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect());
+ distance = width * 0.5 * padding_factor / tan(angle_of_view * 0.5f );
+
+ LL_DEBUGS() << "using width (" << width << "), angle_of_view = " << angle_of_view << ", distance = " << distance << LL_ENDL;
+ }
+ else
+ {
+ angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView());
+ distance = height * 0.5 * padding_factor / tan(angle_of_view * 0.5f );
+
+ LL_DEBUGS() << "using height (" << height << "), angle_of_view = " << angle_of_view << ", distance = " << distance << LL_ENDL;
+ }
+
+ distance += depth * 0.5;
+
+ // Finally animate the camera to this new position and focal point
+ LLVector3d target_pos;
+ // The target lookat position is the center of the selection (in global coords)
+ target_pos = center;
+ // Target look-from (camera) position is "distance" away from the target along the normal
+ LLVector3d pickNormal = LLVector3d(normal);
+ pickNormal.normalize();
camera_pos = target_pos + pickNormal * distance;
if (pickNormal == LLVector3d::z_axis || pickNormal == LLVector3d::z_axis_neg)
{
- // If the normal points directly up, the camera will "flip" around.
- // We try to avoid this by adjusting the target camera position a
- // smidge towards current camera position
- // *NOTE: this solution is not perfect. All it attempts to solve is the
- // "looking down" problem where the camera flips around when it animates
- // to that position. You still are not guaranteed to be looking at the
- // media in the correct orientation. What this solution does is it will
- // put the camera into position keeping as best it can the current
- // orientation with respect to the face. In other words, if before zoom
- // the media appears "upside down" from the camera, after zooming it will
- // still be upside down, but at least it will not flip.
+ // If the normal points directly up, the camera will "flip" around.
+ // We try to avoid this by adjusting the target camera position a
+ // smidge towards current camera position
+ // *NOTE: this solution is not perfect. All it attempts to solve is the
+ // "looking down" problem where the camera flips around when it animates
+ // to that position. You still are not guaranteed to be looking at the
+ // media in the correct orientation. What this solution does is it will
+ // put the camera into position keeping as best it can the current
+ // orientation with respect to the face. In other words, if before zoom
+ // the media appears "upside down" from the camera, after zooming it will
+ // still be upside down, but at least it will not flip.
LLVector3d cur_camera_pos = LLVector3d(gAgentCamera.getCameraPositionGlobal());
LLVector3d delta = (cur_camera_pos - camera_pos);
F64 len = delta.length();
@@ -284,66 +284,66 @@ LLVector3d LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 n
camera_pos += 0.01 * len * delta;
}
- // If we are not allowing zooming out and the old camera position is closer to
- // the center then the new intended camera position, don't move camera and return
- if (zoom_in_only &&
- (dist_vec_squared(gAgentCamera.getCameraPositionGlobal(), target_pos) < dist_vec_squared(camera_pos, target_pos)))
- {
- return camera_pos;
- }
-
- gAgentCamera.setCameraPosAndFocusGlobal(camera_pos, target_pos, object->getID() );
-
- }
- else
- {
- // If we have no object, focus back on the avatar.
- gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
- }
- return camera_pos;
+ // If we are not allowing zooming out and the old camera position is closer to
+ // the center then the new intended camera position, don't move camera and return
+ if (zoom_in_only &&
+ (dist_vec_squared(gAgentCamera.getCameraPositionGlobal(), target_pos) < dist_vec_squared(camera_pos, target_pos)))
+ {
+ return camera_pos;
+ }
+
+ gAgentCamera.setCameraPosAndFocusGlobal(camera_pos, target_pos, object->getID() );
+
+ }
+ else
+ {
+ // If we have no object, focus back on the avatar.
+ gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
+ }
+ return camera_pos;
}
void LLViewerMediaFocus::onFocusReceived()
{
- LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
- if(media_impl)
- media_impl->focus(true);
+ LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
+ if(media_impl)
+ media_impl->focus(true);
- LLFocusableElement::onFocusReceived();
+ LLFocusableElement::onFocusReceived();
}
void LLViewerMediaFocus::onFocusLost()
{
- LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
- if(media_impl)
- media_impl->focus(false);
+ LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
+ if(media_impl)
+ media_impl->focus(false);
- gViewerWindow->focusClient();
- LLFocusableElement::onFocusLost();
+ gViewerWindow->focusClient();
+ LLFocusableElement::onFocusLost();
}
BOOL LLViewerMediaFocus::handleKey(KEY key, MASK mask, BOOL called_from_parent)
{
- LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
- if(media_impl)
- {
- media_impl->handleKeyHere(key, mask);
-
- if (KEY_ESCAPE == key)
- {
- // Reset camera zoom in this case.
- if(mFocusedImplID.notNull())
- {
- if(mMediaControls.get())
- {
- mMediaControls.get()->resetZoomLevel(true);
- }
- }
-
- clearFocus();
- }
- }
-
- return true;
+ LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
+ if(media_impl)
+ {
+ media_impl->handleKeyHere(key, mask);
+
+ if (KEY_ESCAPE == key)
+ {
+ // Reset camera zoom in this case.
+ if(mFocusedImplID.notNull())
+ {
+ if(mMediaControls.get())
+ {
+ mMediaControls.get()->resetZoomLevel(true);
+ }
+ }
+
+ clearFocus();
+ }
+ }
+
+ return true;
}
BOOL LLViewerMediaFocus::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent)
@@ -360,10 +360,10 @@ BOOL LLViewerMediaFocus::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent
BOOL LLViewerMediaFocus::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent)
{
- LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
- if(media_impl)
- media_impl->handleUnicodeCharHere(uni_char);
- return true;
+ LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
+ if(media_impl)
+ media_impl->handleUnicodeCharHere(uni_char);
+ return true;
}
BOOL LLViewerMediaFocus::handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y)
@@ -380,252 +380,252 @@ BOOL LLViewerMediaFocus::handleScrollWheel(const LLVector2& texture_coords, S32
BOOL LLViewerMediaFocus::handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y)
{
- BOOL retval = FALSE;
- LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
- if(media_impl && media_impl->hasMedia())
- {
- media_impl->scrollWheel(x, y, clicks_x, clicks_y, gKeyboard->currentMask(TRUE));
- retval = TRUE;
- }
- return retval;
+ BOOL retval = FALSE;
+ LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
+ if(media_impl && media_impl->hasMedia())
+ {
+ media_impl->scrollWheel(x, y, clicks_x, clicks_y, gKeyboard->currentMask(TRUE));
+ retval = TRUE;
+ }
+ return retval;
}
void LLViewerMediaFocus::update()
{
- if(mFocusedImplID.notNull())
- {
- // We have a focused impl/face.
- if(!getFocus())
- {
- // We've lost keyboard focus -- check to see whether the media controls have it
- if(mMediaControls.get() && mMediaControls.get()->hasFocus())
- {
- // the media controls have focus -- don't clear.
- }
- else
- {
- // Someone else has focus -- back off.
- mPrevFocusedImplID = mFocusedImplID;
- clearFocus();
- }
- }
- else if(LLToolMgr::getInstance()->inBuildMode())
- {
- // Build tools are selected -- clear focus.
- clearFocus();
- }
- }
-
-
- LLViewerMediaImpl *media_impl = getFocusedMediaImpl();
- LLViewerObject *viewer_object = getFocusedObject();
- S32 face = mFocusedObjectFace;
- LLVector3 normal = mFocusedObjectNormal;
-
- if(!media_impl || !viewer_object)
- {
- media_impl = getHoverMediaImpl();
- viewer_object = getHoverObject();
- face = mHoverObjectFace;
- normal = mHoverObjectNormal;
- }
-
- if(media_impl && viewer_object)
- {
- // We have an object and impl to point at.
-
- // Make sure the media HUD object exists.
- if(! mMediaControls.get())
- {
- LLPanelPrimMediaControls* media_controls = new LLPanelPrimMediaControls();
- mMediaControls = media_controls->getHandle();
- gHUDView->addChild(media_controls);
- }
- mMediaControls.get()->setMediaFace(viewer_object, face, media_impl, normal);
- }
- else
- {
- // The media HUD is no longer needed.
- if(mMediaControls.get())
- {
- mMediaControls.get()->setMediaFace(NULL, 0, NULL);
- }
- }
+ if(mFocusedImplID.notNull())
+ {
+ // We have a focused impl/face.
+ if(!getFocus())
+ {
+ // We've lost keyboard focus -- check to see whether the media controls have it
+ if(mMediaControls.get() && mMediaControls.get()->hasFocus())
+ {
+ // the media controls have focus -- don't clear.
+ }
+ else
+ {
+ // Someone else has focus -- back off.
+ mPrevFocusedImplID = mFocusedImplID;
+ clearFocus();
+ }
+ }
+ else if(LLToolMgr::getInstance()->inBuildMode())
+ {
+ // Build tools are selected -- clear focus.
+ clearFocus();
+ }
+ }
+
+
+ LLViewerMediaImpl *media_impl = getFocusedMediaImpl();
+ LLViewerObject *viewer_object = getFocusedObject();
+ S32 face = mFocusedObjectFace;
+ LLVector3 normal = mFocusedObjectNormal;
+
+ if(!media_impl || !viewer_object)
+ {
+ media_impl = getHoverMediaImpl();
+ viewer_object = getHoverObject();
+ face = mHoverObjectFace;
+ normal = mHoverObjectNormal;
+ }
+
+ if(media_impl && viewer_object)
+ {
+ // We have an object and impl to point at.
+
+ // Make sure the media HUD object exists.
+ if(! mMediaControls.get())
+ {
+ LLPanelPrimMediaControls* media_controls = new LLPanelPrimMediaControls();
+ mMediaControls = media_controls->getHandle();
+ gHUDView->addChild(media_controls);
+ }
+ mMediaControls.get()->setMediaFace(viewer_object, face, media_impl, normal);
+ }
+ else
+ {
+ // The media HUD is no longer needed.
+ if(mMediaControls.get())
+ {
+ mMediaControls.get()->setMediaFace(NULL, 0, NULL);
+ }
+ }
}
// This function calculates the aspect ratio and the world aligned components of a selection bounding box.
F32 LLViewerMediaFocus::getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& normal, F32* height, F32* width, F32* depth)
{
- // Convert the selection normal and an up vector to local coordinate space of the bbox
- LLVector3 local_normal = bbox.agentToLocalBasis(normal);
- LLVector3 z_vec = bbox.agentToLocalBasis(LLVector3(0.0f, 0.0f, 1.0f));
-
- LLVector3 comp1(0.f,0.f,0.f);
- LLVector3 comp2(0.f,0.f,0.f);
- LLVector3 bbox_max = bbox.getExtentLocal();
- F32 dot1 = 0.f;
- F32 dot2 = 0.f;
-
- LL_DEBUGS() << "bounding box local size = " << bbox_max << ", local_normal = " << local_normal << LL_ENDL;
-
- // The largest component of the localized normal vector is the depth component
- // meaning that the other two are the legs of the rectangle.
- local_normal.abs();
-
- // Using temporary variables for these makes the logic a bit more readable.
- bool XgtY = (local_normal.mV[VX] > local_normal.mV[VY]);
- bool XgtZ = (local_normal.mV[VX] > local_normal.mV[VZ]);
- bool YgtZ = (local_normal.mV[VY] > local_normal.mV[VZ]);
-
- if(XgtY && XgtZ)
- {
- LL_DEBUGS() << "x component of normal is longest, using y and z" << LL_ENDL;
- comp1.mV[VY] = bbox_max.mV[VY];
- comp2.mV[VZ] = bbox_max.mV[VZ];
- *depth = bbox_max.mV[VX];
- }
- else if(!XgtY && YgtZ)
- {
- LL_DEBUGS() << "y component of normal is longest, using x and z" << LL_ENDL;
- comp1.mV[VX] = bbox_max.mV[VX];
- comp2.mV[VZ] = bbox_max.mV[VZ];
- *depth = bbox_max.mV[VY];
- }
- else
- {
- LL_DEBUGS() << "z component of normal is longest, using x and y" << LL_ENDL;
- comp1.mV[VX] = bbox_max.mV[VX];
- comp2.mV[VY] = bbox_max.mV[VY];
- *depth = bbox_max.mV[VZ];
- }
-
- // The height is the vector closest to vertical in the bbox coordinate space (highest dot product value)
- dot1 = comp1 * z_vec;
- dot2 = comp2 * z_vec;
- if(fabs(dot1) > fabs(dot2))
- {
- *height = comp1.length();
- *width = comp2.length();
-
- LL_DEBUGS() << "comp1 = " << comp1 << ", height = " << *height << LL_ENDL;
- LL_DEBUGS() << "comp2 = " << comp2 << ", width = " << *width << LL_ENDL;
- }
- else
- {
- *height = comp2.length();
- *width = comp1.length();
-
- LL_DEBUGS() << "comp2 = " << comp2 << ", height = " << *height << LL_ENDL;
- LL_DEBUGS() << "comp1 = " << comp1 << ", width = " << *width << LL_ENDL;
- }
-
- LL_DEBUGS() << "returning " << (*width / *height) << LL_ENDL;
-
- // Return the aspect ratio.
- return *width / *height;
+ // Convert the selection normal and an up vector to local coordinate space of the bbox
+ LLVector3 local_normal = bbox.agentToLocalBasis(normal);
+ LLVector3 z_vec = bbox.agentToLocalBasis(LLVector3(0.0f, 0.0f, 1.0f));
+
+ LLVector3 comp1(0.f,0.f,0.f);
+ LLVector3 comp2(0.f,0.f,0.f);
+ LLVector3 bbox_max = bbox.getExtentLocal();
+ F32 dot1 = 0.f;
+ F32 dot2 = 0.f;
+
+ LL_DEBUGS() << "bounding box local size = " << bbox_max << ", local_normal = " << local_normal << LL_ENDL;
+
+ // The largest component of the localized normal vector is the depth component
+ // meaning that the other two are the legs of the rectangle.
+ local_normal.abs();
+
+ // Using temporary variables for these makes the logic a bit more readable.
+ bool XgtY = (local_normal.mV[VX] > local_normal.mV[VY]);
+ bool XgtZ = (local_normal.mV[VX] > local_normal.mV[VZ]);
+ bool YgtZ = (local_normal.mV[VY] > local_normal.mV[VZ]);
+
+ if(XgtY && XgtZ)
+ {
+ LL_DEBUGS() << "x component of normal is longest, using y and z" << LL_ENDL;
+ comp1.mV[VY] = bbox_max.mV[VY];
+ comp2.mV[VZ] = bbox_max.mV[VZ];
+ *depth = bbox_max.mV[VX];
+ }
+ else if(!XgtY && YgtZ)
+ {
+ LL_DEBUGS() << "y component of normal is longest, using x and z" << LL_ENDL;
+ comp1.mV[VX] = bbox_max.mV[VX];
+ comp2.mV[VZ] = bbox_max.mV[VZ];
+ *depth = bbox_max.mV[VY];
+ }
+ else
+ {
+ LL_DEBUGS() << "z component of normal is longest, using x and y" << LL_ENDL;
+ comp1.mV[VX] = bbox_max.mV[VX];
+ comp2.mV[VY] = bbox_max.mV[VY];
+ *depth = bbox_max.mV[VZ];
+ }
+
+ // The height is the vector closest to vertical in the bbox coordinate space (highest dot product value)
+ dot1 = comp1 * z_vec;
+ dot2 = comp2 * z_vec;
+ if(fabs(dot1) > fabs(dot2))
+ {
+ *height = comp1.length();
+ *width = comp2.length();
+
+ LL_DEBUGS() << "comp1 = " << comp1 << ", height = " << *height << LL_ENDL;
+ LL_DEBUGS() << "comp2 = " << comp2 << ", width = " << *width << LL_ENDL;
+ }
+ else
+ {
+ *height = comp2.length();
+ *width = comp1.length();
+
+ LL_DEBUGS() << "comp2 = " << comp2 << ", height = " << *height << LL_ENDL;
+ LL_DEBUGS() << "comp1 = " << comp1 << ", width = " << *width << LL_ENDL;
+ }
+
+ LL_DEBUGS() << "returning " << (*width / *height) << LL_ENDL;
+
+ // Return the aspect ratio.
+ return *width / *height;
}
bool LLViewerMediaFocus::isFocusedOnFace(LLPointer<LLViewerObject> objectp, S32 face)
{
- return objectp->getID() == mFocusedObjectID && face == mFocusedObjectFace;
+ return objectp->getID() == mFocusedObjectID && face == mFocusedObjectFace;
}
bool LLViewerMediaFocus::isHoveringOverFace(LLPointer<LLViewerObject> objectp, S32 face)
{
- return objectp->getID() == mHoverObjectID && face == mHoverObjectFace;
+ return objectp->getID() == mHoverObjectID && face == mHoverObjectFace;
}
LLViewerMediaImpl* LLViewerMediaFocus::getFocusedMediaImpl()
{
- return LLViewerMedia::getInstance()->getMediaImplFromTextureID(mFocusedImplID);
+ return LLViewerMedia::getInstance()->getMediaImplFromTextureID(mFocusedImplID);
}
LLViewerObject* LLViewerMediaFocus::getFocusedObject()
{
- return gObjectList.findObject(mFocusedObjectID);
+ return gObjectList.findObject(mFocusedObjectID);
}
LLViewerMediaImpl* LLViewerMediaFocus::getHoverMediaImpl()
{
- return LLViewerMedia::getInstance()->getMediaImplFromTextureID(mHoverImplID);
+ return LLViewerMedia::getInstance()->getMediaImplFromTextureID(mHoverImplID);
}
LLViewerObject* LLViewerMediaFocus::getHoverObject()
{
- return gObjectList.findObject(mHoverObjectID);
+ return gObjectList.findObject(mHoverObjectID);
}
void LLViewerMediaFocus::focusZoomOnMedia(LLUUID media_id)
{
- LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(media_id);
-
- if(impl)
- {
- // Get the first object from the media impl's object list. This is completely arbitrary, but should suffice.
- LLVOVolume *obj = impl->getSomeObject();
- if(obj)
- {
- // This media is attached to at least one object. Figure out which face it's on.
- S32 face = obj->getFaceIndexWithMediaImpl(impl, -1);
-
- // We don't have a proper pick normal here, and finding a face's real normal is... complicated.
- LLVector3 normal = obj->getApproximateFaceNormal(face);
- if(normal.isNull())
- {
- // If that didn't work, use the inverse of the camera "look at" axis, which should keep the camera pointed in the same direction.
-// LL_INFOS() << "approximate face normal invalid, using camera direction." << LL_ENDL;
- normal = LLViewerCamera::getInstance()->getAtAxis();
- normal *= (F32)-1.0f;
- }
-
- // Attempt to focus/zoom on that face.
- setFocusFace(obj, face, impl, normal);
-
- if(mMediaControls.get())
- {
- mMediaControls.get()->resetZoomLevel();
- mMediaControls.get()->nextZoomLevel();
- }
- }
- }
+ LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(media_id);
+
+ if(impl)
+ {
+ // Get the first object from the media impl's object list. This is completely arbitrary, but should suffice.
+ LLVOVolume *obj = impl->getSomeObject();
+ if(obj)
+ {
+ // This media is attached to at least one object. Figure out which face it's on.
+ S32 face = obj->getFaceIndexWithMediaImpl(impl, -1);
+
+ // We don't have a proper pick normal here, and finding a face's real normal is... complicated.
+ LLVector3 normal = obj->getApproximateFaceNormal(face);
+ if(normal.isNull())
+ {
+ // If that didn't work, use the inverse of the camera "look at" axis, which should keep the camera pointed in the same direction.
+// LL_INFOS() << "approximate face normal invalid, using camera direction." << LL_ENDL;
+ normal = LLViewerCamera::getInstance()->getAtAxis();
+ normal *= (F32)-1.0f;
+ }
+
+ // Attempt to focus/zoom on that face.
+ setFocusFace(obj, face, impl, normal);
+
+ if(mMediaControls.get())
+ {
+ mMediaControls.get()->resetZoomLevel();
+ mMediaControls.get()->nextZoomLevel();
+ }
+ }
+ }
}
void LLViewerMediaFocus::unZoom()
{
- if(mMediaControls.get())
- {
- mMediaControls.get()->resetZoomLevel();
- }
+ if(mMediaControls.get())
+ {
+ mMediaControls.get()->resetZoomLevel();
+ }
}
bool LLViewerMediaFocus::isZoomed() const
{
- return (mMediaControls.get() && mMediaControls.get()->getZoomLevel() != LLPanelPrimMediaControls::ZOOM_NONE);
+ return (mMediaControls.get() && mMediaControls.get()->getZoomLevel() != LLPanelPrimMediaControls::ZOOM_NONE);
}
bool LLViewerMediaFocus::isZoomedOnMedia(LLUUID media_id)
{
- if (isZoomed())
- {
- return (mFocusedImplID == media_id) || (mPrevFocusedImplID == media_id);
- }
- return false;
+ if (isZoomed())
+ {
+ return (mFocusedImplID == media_id) || (mPrevFocusedImplID == media_id);
+ }
+ return false;
}
LLUUID LLViewerMediaFocus::getControlsMediaID()
{
- if(getFocusedMediaImpl())
- {
- return mFocusedImplID;
- }
- else if(getHoverMediaImpl())
- {
- return mHoverImplID;
- }
-
- return LLUUID::null;
+ if(getFocusedMediaImpl())
+ {
+ return mFocusedImplID;
+ }
+ else if(getHoverMediaImpl())
+ {
+ return mHoverImplID;
+ }
+
+ return LLUUID::null;
}
bool LLViewerMediaFocus::wantsKeyUpKeyDown() const
diff --git a/indra/newview/llviewermediafocus.h b/indra/newview/llviewermediafocus.h
index 2310e4dbfc..855be265fc 100644
--- a/indra/newview/llviewermediafocus.h
+++ b/indra/newview/llviewermediafocus.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpanelmsgs.h
* @brief Message popup preferences panel
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,83 +37,83 @@
class LLViewerMediaImpl;
class LLPanelPrimMediaControls;
-class LLViewerMediaFocus :
- public LLFocusableElement,
- public LLSingleton<LLViewerMediaFocus>
+class LLViewerMediaFocus :
+ public LLFocusableElement,
+ public LLSingleton<LLViewerMediaFocus>
{
- LLSINGLETON(LLViewerMediaFocus);
- ~LLViewerMediaFocus();
+ LLSINGLETON(LLViewerMediaFocus);
+ ~LLViewerMediaFocus();
public:
- // Set/clear the face that has media focus (takes keyboard input and has the full set of controls)
- void setFocusFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
- void clearFocus();
-
- // Set/clear the face that has "media hover" (has the mimimal set of controls to zoom in or pop out into a media browser).
- // If a media face has focus, the media hover will be ignored.
- void setHoverFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
- void clearHover();
-
- bool getFocus();
- /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent) override;
- /*virtual*/ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override;
- /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) override;
- BOOL handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y);
- BOOL handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y);
-
- void update();
-
- static LLVector3d setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only = false);
- static F32 getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& normal, F32* height, F32* width, F32* depth);
-
- bool isFocusedOnFace(LLPointer<LLViewerObject> objectp, S32 face);
- bool isHoveringOverFace(LLPointer<LLViewerObject> objectp, S32 face);
- bool isHoveringOverFocused() { return mFocusedObjectID == mHoverObjectID && mFocusedObjectFace == mHoverObjectFace; };
-
- // These look up (by uuid) and return the values that were set with setFocusFace. They will return null if the objects have been destroyed.
- LLViewerMediaImpl* getFocusedMediaImpl();
- LLViewerObject* getFocusedObject();
- S32 getFocusedFace() { return mFocusedObjectFace; }
- LLUUID getFocusedObjectID() { return mFocusedObjectID; }
-
- // These look up (by uuid) and return the values that were set with setHoverFace. They will return null if the objects have been destroyed.
- LLViewerMediaImpl* getHoverMediaImpl();
- LLViewerObject* getHoverObject();
- S32 getHoverFace() { return mHoverObjectFace; }
-
- // Try to focus/zoom on the specified media (if it's on an object in world).
- void focusZoomOnMedia(LLUUID media_id);
- // Are we zoomed in?
- bool isZoomed() const;
- bool isZoomedOnMedia(LLUUID media_id);
- void unZoom();
-
- // Return the ID of the media instance the controls are currently attached to (either focus or hover).
- LLUUID getControlsMediaID();
+ // Set/clear the face that has media focus (takes keyboard input and has the full set of controls)
+ void setFocusFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
+ void clearFocus();
+
+ // Set/clear the face that has "media hover" (has the mimimal set of controls to zoom in or pop out into a media browser).
+ // If a media face has focus, the media hover will be ignored.
+ void setHoverFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
+ void clearHover();
+
+ bool getFocus();
+ /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent) override;
+ /*virtual*/ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override;
+ /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) override;
+ BOOL handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y);
+ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y);
+
+ void update();
+
+ static LLVector3d setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only = false);
+ static F32 getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& normal, F32* height, F32* width, F32* depth);
+
+ bool isFocusedOnFace(LLPointer<LLViewerObject> objectp, S32 face);
+ bool isHoveringOverFace(LLPointer<LLViewerObject> objectp, S32 face);
+ bool isHoveringOverFocused() { return mFocusedObjectID == mHoverObjectID && mFocusedObjectFace == mHoverObjectFace; };
+
+ // These look up (by uuid) and return the values that were set with setFocusFace. They will return null if the objects have been destroyed.
+ LLViewerMediaImpl* getFocusedMediaImpl();
+ LLViewerObject* getFocusedObject();
+ S32 getFocusedFace() { return mFocusedObjectFace; }
+ LLUUID getFocusedObjectID() { return mFocusedObjectID; }
+
+ // These look up (by uuid) and return the values that were set with setHoverFace. They will return null if the objects have been destroyed.
+ LLViewerMediaImpl* getHoverMediaImpl();
+ LLViewerObject* getHoverObject();
+ S32 getHoverFace() { return mHoverObjectFace; }
+
+ // Try to focus/zoom on the specified media (if it's on an object in world).
+ void focusZoomOnMedia(LLUUID media_id);
+ // Are we zoomed in?
+ bool isZoomed() const;
+ bool isZoomedOnMedia(LLUUID media_id);
+ void unZoom();
+
+ // Return the ID of the media instance the controls are currently attached to (either focus or hover).
+ LLUUID getControlsMediaID();
// The MoaP object wants keyup and keydown events. Overridden to return true.
virtual bool wantsKeyUpKeyDown() const override;
virtual bool wantsReturnKey() const override;
protected:
- /*virtual*/ void onFocusReceived() override;
- /*virtual*/ void onFocusLost() override;
+ /*virtual*/ void onFocusReceived() override;
+ /*virtual*/ void onFocusLost() override;
private:
-
- LLHandle<LLPanelPrimMediaControls> mMediaControls;
- LLObjectSelectionHandle mSelection;
-
- LLUUID mFocusedObjectID;
- S32 mFocusedObjectFace;
- LLUUID mFocusedImplID;
- LLUUID mPrevFocusedImplID;
- LLVector3 mFocusedObjectNormal;
-
- LLUUID mHoverObjectID;
- S32 mHoverObjectFace;
- LLUUID mHoverImplID;
- LLVector3 mHoverObjectNormal;
+
+ LLHandle<LLPanelPrimMediaControls> mMediaControls;
+ LLObjectSelectionHandle mSelection;
+
+ LLUUID mFocusedObjectID;
+ S32 mFocusedObjectFace;
+ LLUUID mFocusedImplID;
+ LLUUID mPrevFocusedImplID;
+ LLVector3 mFocusedObjectNormal;
+
+ LLUUID mHoverObjectID;
+ S32 mHoverObjectFace;
+ LLUUID mHoverImplID;
+ LLVector3 mHoverObjectNormal;
};
diff --git a/indra/newview/llviewermediaobserver.h b/indra/newview/llviewermediaobserver.h
index 5dab7e399e..3876154de8 100644
--- a/indra/newview/llviewermediaobserver.h
+++ b/indra/newview/llviewermediaobserver.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,30 +34,30 @@ class LLViewerMediaEventEmitter;
class LLViewerMediaObserver : public LLPluginClassMediaOwner
{
public:
- virtual ~LLViewerMediaObserver();
-
+ virtual ~LLViewerMediaObserver();
+
private:
- // Emitters will manage this list in addObserver/remObserver.
- friend class LLViewerMediaEventEmitter;
- std::list<LLViewerMediaEventEmitter *> mEmitters;
+ // Emitters will manage this list in addObserver/remObserver.
+ friend class LLViewerMediaEventEmitter;
+ std::list<LLViewerMediaEventEmitter *> mEmitters;
};
#if 0
- // Classes that inherit from LLViewerMediaObserver should add this to their class declaration:
-
- // inherited from LLViewerMediaObserver
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
-
- /* and will probably need to add this to their cpp file:
-
- #include "llpluginclassmedia.h"
-
- */
-
- // The list of events is in llpluginclassmediaowner.h
-
-
+ // Classes that inherit from LLViewerMediaObserver should add this to their class declaration:
+
+ // inherited from LLViewerMediaObserver
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+
+ /* and will probably need to add this to their cpp file:
+
+ #include "llpluginclassmedia.h"
+
+ */
+
+ // The list of events is in llpluginclassmediaowner.h
+
+
#endif
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 625d32f59d..37f23f9cca 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewermenu.cpp
* @brief Builds menus out of items.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@
#include "vld.h"
#endif
-#include "llviewermenu.h"
+#include "llviewermenu.h"
// linden library includes
#include "llavatarnamecache.h" // IDEVO (I Are Not Men!)
@@ -115,7 +115,7 @@
#include "llviewerdisplay.h" //for gWindowResized
#include "llviewergenericmessage.h"
#include "llviewerhelp.h"
-#include "llviewermenufile.h" // init_menu_file()
+#include "llviewermenufile.h" // init_menu_file()
#include "llviewermessage.h"
#include "llviewernetwork.h"
#include "llviewerobjectlist.h"
@@ -159,7 +159,7 @@ void handle_test_load_url(void*);
//
// Evil hackish imported globals
-//extern BOOL gHideSelectedObjects;
+//extern BOOL gHideSelectedObjects;
//extern BOOL gAllowSelectAvatar;
//extern BOOL gDebugAvatarRotation;
extern BOOL gDebugClicks;
@@ -173,20 +173,20 @@ extern BOOL gShaderProfileFrame;
// Globals
//
-LLMenuBarGL *gMenuBarView = NULL;
-LLViewerMenuHolderGL *gMenuHolder = NULL;
-LLMenuGL *gPopupMenuView = NULL;
-LLMenuGL *gEditMenu = NULL;
-LLMenuBarGL *gLoginMenuBarView = NULL;
+LLMenuBarGL *gMenuBarView = NULL;
+LLViewerMenuHolderGL *gMenuHolder = NULL;
+LLMenuGL *gPopupMenuView = NULL;
+LLMenuGL *gEditMenu = NULL;
+LLMenuBarGL *gLoginMenuBarView = NULL;
// Pie menus
-LLContextMenu *gMenuAvatarSelf = NULL;
-LLContextMenu *gMenuAvatarOther = NULL;
-LLContextMenu *gMenuObject = NULL;
-LLContextMenu *gMenuAttachmentSelf = NULL;
-LLContextMenu *gMenuAttachmentOther = NULL;
-LLContextMenu *gMenuLand = NULL;
-LLContextMenu *gMenuMuteParticle = NULL;
+LLContextMenu *gMenuAvatarSelf = NULL;
+LLContextMenu *gMenuAvatarOther = NULL;
+LLContextMenu *gMenuObject = NULL;
+LLContextMenu *gMenuAttachmentSelf = NULL;
+LLContextMenu *gMenuAttachmentOther = NULL;
+LLContextMenu *gMenuLand = NULL;
+LLContextMenu *gMenuMuteParticle = NULL;
const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents");
@@ -284,7 +284,7 @@ void handle_force_parcel_owner_to_me(void*);
void handle_force_parcel_to_content(void*);
void handle_claim_public_land(void*);
-void handle_god_request_avatar_geometry(void *); // Hack for easy testing of new avatar geometry
+void handle_god_request_avatar_geometry(void *); // Hack for easy testing of new avatar geometry
void reload_vertex_shader(void *);
void handle_disconnect_viewer(void *);
@@ -344,9 +344,9 @@ void menu_toggle_attached_particles(void* user_data);
class LLMenuParcelObserver : public LLParcelObserver
{
public:
- LLMenuParcelObserver();
- ~LLMenuParcelObserver();
- virtual void changed();
+ LLMenuParcelObserver();
+ ~LLMenuParcelObserver();
+ virtual void changed();
};
static LLMenuParcelObserver* gMenuParcelObserver = NULL;
@@ -355,17 +355,17 @@ static LLUIListener sUIListener;
LLMenuParcelObserver::LLMenuParcelObserver()
{
- LLViewerParcelMgr::getInstance()->addObserver(this);
+ LLViewerParcelMgr::getInstance()->addObserver(this);
}
LLMenuParcelObserver::~LLMenuParcelObserver()
{
- LLViewerParcelMgr::getInstance()->removeObserver(this);
+ LLViewerParcelMgr::getInstance()->removeObserver(this);
}
void LLMenuParcelObserver::changed()
{
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
if (gMenuLand && parcel)
{
LLView* child = gMenuLand->findChild<LLView>("Land Buy Pass");
@@ -438,131 +438,131 @@ void check_merchant_status(bool force)
void init_menus()
{
- // Initialize actions
- initialize_menus();
-
- ///
- /// Popup menu
- ///
- /// The popup menu is now populated by the show_context_menu()
- /// method.
-
- LLMenuGL::Params menu_params;
- menu_params.name = "Popup";
- menu_params.visible = false;
- gPopupMenuView = LLUICtrlFactory::create<LLMenuGL>(menu_params);
- gMenuHolder->addChild( gPopupMenuView );
-
- ///
- /// Context menus
- ///
-
- const widget_registry_t& registry =
- LLViewerMenuHolderGL::child_registry_t::instance();
- gEditMenu = LLUICtrlFactory::createFromFile<LLMenuGL>("menu_edit.xml", gMenuHolder, registry);
- gMenuAvatarSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_avatar_self.xml", gMenuHolder, registry);
- gMenuAvatarOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_avatar_other.xml", gMenuHolder, registry);
-
- gDetachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach HUD", true);
- gDetachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach", true);
-
- gMenuObject = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_object.xml", gMenuHolder, registry);
-
- gAttachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach HUD");
- gAttachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach");
-
- gMenuAttachmentSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_attachment_self.xml", gMenuHolder, registry);
- gMenuAttachmentOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_attachment_other.xml", gMenuHolder, registry);
-
- gDetachHUDAttSelfMenu = gMenuHolder->getChild<LLContextMenu>("Detach Self HUD", true);
- gDetachAttSelfMenu = gMenuHolder->getChild<LLContextMenu>("Detach Self", true);
-
- gMenuLand = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_land.xml", gMenuHolder, registry);
-
- gMenuMuteParticle = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_mute_particle.xml", gMenuHolder, registry);
-
- ///
- /// set up the colors
- ///
- LLColor4 color;
-
- LLColor4 context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor");
-
- gMenuAvatarSelf->setBackgroundColor( context_menu_color );
- gMenuAvatarOther->setBackgroundColor( context_menu_color );
- gMenuObject->setBackgroundColor( context_menu_color );
- gMenuAttachmentSelf->setBackgroundColor( context_menu_color );
- gMenuAttachmentOther->setBackgroundColor( context_menu_color );
-
- gMenuLand->setBackgroundColor( context_menu_color );
-
- color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" );
- gPopupMenuView->setBackgroundColor( color );
-
- // If we are not in production, use a different color to make it apparent.
- if (LLGridManager::getInstance()->isInProductionGrid())
- {
- color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
- }
- else
- {
- color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
- }
-
- LLView* menu_bar_holder = gViewerWindow->getRootView()->getChildView("menu_bar_holder");
-
- gMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_viewer.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- gMenuBarView->setRect(LLRect(0, menu_bar_holder->getRect().mTop, 0, menu_bar_holder->getRect().mTop - MENU_BAR_HEIGHT));
- gMenuBarView->setBackgroundColor( color );
-
- menu_bar_holder->addChild(gMenuBarView);
-
- gViewerWindow->setMenuBackgroundColor(false,
+ // Initialize actions
+ initialize_menus();
+
+ ///
+ /// Popup menu
+ ///
+ /// The popup menu is now populated by the show_context_menu()
+ /// method.
+
+ LLMenuGL::Params menu_params;
+ menu_params.name = "Popup";
+ menu_params.visible = false;
+ gPopupMenuView = LLUICtrlFactory::create<LLMenuGL>(menu_params);
+ gMenuHolder->addChild( gPopupMenuView );
+
+ ///
+ /// Context menus
+ ///
+
+ const widget_registry_t& registry =
+ LLViewerMenuHolderGL::child_registry_t::instance();
+ gEditMenu = LLUICtrlFactory::createFromFile<LLMenuGL>("menu_edit.xml", gMenuHolder, registry);
+ gMenuAvatarSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
+ "menu_avatar_self.xml", gMenuHolder, registry);
+ gMenuAvatarOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
+ "menu_avatar_other.xml", gMenuHolder, registry);
+
+ gDetachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach HUD", true);
+ gDetachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach", true);
+
+ gMenuObject = LLUICtrlFactory::createFromFile<LLContextMenu>(
+ "menu_object.xml", gMenuHolder, registry);
+
+ gAttachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach HUD");
+ gAttachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach");
+
+ gMenuAttachmentSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
+ "menu_attachment_self.xml", gMenuHolder, registry);
+ gMenuAttachmentOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
+ "menu_attachment_other.xml", gMenuHolder, registry);
+
+ gDetachHUDAttSelfMenu = gMenuHolder->getChild<LLContextMenu>("Detach Self HUD", true);
+ gDetachAttSelfMenu = gMenuHolder->getChild<LLContextMenu>("Detach Self", true);
+
+ gMenuLand = LLUICtrlFactory::createFromFile<LLContextMenu>(
+ "menu_land.xml", gMenuHolder, registry);
+
+ gMenuMuteParticle = LLUICtrlFactory::createFromFile<LLContextMenu>(
+ "menu_mute_particle.xml", gMenuHolder, registry);
+
+ ///
+ /// set up the colors
+ ///
+ LLColor4 color;
+
+ LLColor4 context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor");
+
+ gMenuAvatarSelf->setBackgroundColor( context_menu_color );
+ gMenuAvatarOther->setBackgroundColor( context_menu_color );
+ gMenuObject->setBackgroundColor( context_menu_color );
+ gMenuAttachmentSelf->setBackgroundColor( context_menu_color );
+ gMenuAttachmentOther->setBackgroundColor( context_menu_color );
+
+ gMenuLand->setBackgroundColor( context_menu_color );
+
+ color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" );
+ gPopupMenuView->setBackgroundColor( color );
+
+ // If we are not in production, use a different color to make it apparent.
+ if (LLGridManager::getInstance()->isInProductionGrid())
+ {
+ color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
+ }
+ else
+ {
+ color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
+ }
+
+ LLView* menu_bar_holder = gViewerWindow->getRootView()->getChildView("menu_bar_holder");
+
+ gMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_viewer.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ gMenuBarView->setRect(LLRect(0, menu_bar_holder->getRect().mTop, 0, menu_bar_holder->getRect().mTop - MENU_BAR_HEIGHT));
+ gMenuBarView->setBackgroundColor( color );
+
+ menu_bar_holder->addChild(gMenuBarView);
+
+ gViewerWindow->setMenuBackgroundColor(false,
LLGridManager::getInstance()->isInProductionGrid());
- // *TODO:Also fix cost in llfolderview.cpp for Inventory menus
- const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
- const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost());
- const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost());
- gMenuHolder->childSetLabelArg("Upload Image", "[COST]", texture_upload_cost_str);
- gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str);
- gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str);
-
- gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE);
- gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE);
-
- gDetachAvatarMenu = gMenuHolder->getChild<LLMenuGL>("Avatar Detach", true);
- gDetachHUDAvatarMenu = gMenuHolder->getChild<LLMenuGL>("Avatar Detach HUD", true);
-
- // Don't display the Memory console menu if the feature is turned off
- LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", TRUE);
- if (memoryMenu)
- {
- memoryMenu->setVisible(FALSE);
- }
-
- gMenuBarView->createJumpKeys();
-
- // Let land based option enable when parcel changes
- gMenuParcelObserver = new LLMenuParcelObserver();
-
- gLoginMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_login.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- gLoginMenuBarView->arrangeAndClear();
- LLRect menuBarRect = gLoginMenuBarView->getRect();
- menuBarRect.setLeftTopAndSize(0, menu_bar_holder->getRect().getHeight(), menuBarRect.getWidth(), menuBarRect.getHeight());
- gLoginMenuBarView->setRect(menuBarRect);
- gLoginMenuBarView->setBackgroundColor( color );
- menu_bar_holder->addChild(gLoginMenuBarView);
-
- // tooltips are on top of EVERYTHING, including menus
- gViewerWindow->getRootView()->sendChildToFront(gToolTipView);
+ // *TODO:Also fix cost in llfolderview.cpp for Inventory menus
+ const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
+ const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost());
+ const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost());
+ gMenuHolder->childSetLabelArg("Upload Image", "[COST]", texture_upload_cost_str);
+ gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str);
+ gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str);
+
+ gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE);
+ gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE);
+
+ gDetachAvatarMenu = gMenuHolder->getChild<LLMenuGL>("Avatar Detach", true);
+ gDetachHUDAvatarMenu = gMenuHolder->getChild<LLMenuGL>("Avatar Detach HUD", true);
+
+ // Don't display the Memory console menu if the feature is turned off
+ LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", TRUE);
+ if (memoryMenu)
+ {
+ memoryMenu->setVisible(FALSE);
+ }
+
+ gMenuBarView->createJumpKeys();
+
+ // Let land based option enable when parcel changes
+ gMenuParcelObserver = new LLMenuParcelObserver();
+
+ gLoginMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_login.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ gLoginMenuBarView->arrangeAndClear();
+ LLRect menuBarRect = gLoginMenuBarView->getRect();
+ menuBarRect.setLeftTopAndSize(0, menu_bar_holder->getRect().getHeight(), menuBarRect.getWidth(), menuBarRect.getHeight());
+ gLoginMenuBarView->setRect(menuBarRect);
+ gLoginMenuBarView->setBackgroundColor( color );
+ menu_bar_holder->addChild(gLoginMenuBarView);
+
+ // tooltips are on top of EVERYTHING, including menus
+ gViewerWindow->getRootView()->sendChildToFront(gToolTipView);
}
///////////////////
@@ -572,62 +572,62 @@ void init_menus()
class LLAdvancedToggleConsole : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string console_type = userdata.asString();
- if ("texture" == console_type)
- {
- toggle_visibility( (void*)gTextureView );
- }
- else if ("debug" == console_type)
- {
- toggle_visibility( (void*)static_cast<LLUICtrl*>(gDebugView->mDebugConsolep));
- }
- else if ("fast timers" == console_type)
- {
- LLFloaterReg::toggleInstance("block_timers");
- }
- else if ("scene view" == console_type)
- {
- toggle_visibility( (void*)gSceneView);
- }
- else if ("scene monitor" == console_type)
- {
- toggle_visibility( (void*)gSceneMonitorView);
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string console_type = userdata.asString();
+ if ("texture" == console_type)
+ {
+ toggle_visibility( (void*)gTextureView );
+ }
+ else if ("debug" == console_type)
+ {
+ toggle_visibility( (void*)static_cast<LLUICtrl*>(gDebugView->mDebugConsolep));
+ }
+ else if ("fast timers" == console_type)
+ {
+ LLFloaterReg::toggleInstance("block_timers");
+ }
+ else if ("scene view" == console_type)
+ {
+ toggle_visibility( (void*)gSceneView);
+ }
+ else if ("scene monitor" == console_type)
+ {
+ toggle_visibility( (void*)gSceneMonitorView);
+ }
+
+ return true;
+ }
};
class LLAdvancedCheckConsole : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string console_type = userdata.asString();
- bool new_value = false;
- if ("texture" == console_type)
- {
- new_value = get_visibility( (void*)gTextureView );
- }
- else if ("debug" == console_type)
- {
- new_value = get_visibility( (void*)((LLView*)gDebugView->mDebugConsolep) );
- }
- else if ("fast timers" == console_type)
- {
- new_value = LLFloaterReg::instanceVisible("block_timers");
- }
- else if ("scene view" == console_type)
- {
- new_value = get_visibility( (void*) gSceneView);
- }
- else if ("scene monitor" == console_type)
- {
- new_value = get_visibility( (void*) gSceneMonitorView);
- }
-
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string console_type = userdata.asString();
+ bool new_value = false;
+ if ("texture" == console_type)
+ {
+ new_value = get_visibility( (void*)gTextureView );
+ }
+ else if ("debug" == console_type)
+ {
+ new_value = get_visibility( (void*)((LLView*)gDebugView->mDebugConsolep) );
+ }
+ else if ("fast timers" == console_type)
+ {
+ new_value = LLFloaterReg::instanceVisible("block_timers");
+ }
+ else if ("scene view" == console_type)
+ {
+ new_value = get_visibility( (void*) gSceneView);
+ }
+ else if ("scene monitor" == console_type)
+ {
+ new_value = get_visibility( (void*) gSceneMonitorView);
+ }
+
+ return new_value;
+ }
};
@@ -638,24 +638,24 @@ class LLAdvancedCheckConsole : public view_listener_t
class LLAdvancedDumpInfoToConsole : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gDebugView->mDebugConsolep->setVisible(TRUE);
- std::string info_type = userdata.asString();
- if ("region" == info_type)
- {
- handle_region_dump_settings(NULL);
- }
- else if ("group" == info_type)
- {
- handle_dump_group_info(NULL);
- }
- else if ("capabilities" == info_type)
- {
- handle_dump_capabilities_info(NULL);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gDebugView->mDebugConsolep->setVisible(TRUE);
+ std::string info_type = userdata.asString();
+ if ("region" == info_type)
+ {
+ handle_region_dump_settings(NULL);
+ }
+ else if ("group" == info_type)
+ {
+ handle_dump_group_info(NULL);
+ }
+ else if ("capabilities" == info_type)
+ {
+ handle_dump_capabilities_info(NULL);
+ }
+ return true;
+ }
};
@@ -666,54 +666,54 @@ class LLAdvancedDumpInfoToConsole : public view_listener_t
class LLAdvancedToggleHUDInfo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string info_type = userdata.asString();
-
- if ("camera" == info_type)
- {
- gDisplayCameraPos = !(gDisplayCameraPos);
- }
- else if ("wind" == info_type)
- {
- gDisplayWindInfo = !(gDisplayWindInfo);
- }
- else if ("fov" == info_type)
- {
- gDisplayFOV = !(gDisplayFOV);
- }
- else if ("badge" == info_type)
- {
- gDisplayBadge = !(gDisplayBadge);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string info_type = userdata.asString();
+
+ if ("camera" == info_type)
+ {
+ gDisplayCameraPos = !(gDisplayCameraPos);
+ }
+ else if ("wind" == info_type)
+ {
+ gDisplayWindInfo = !(gDisplayWindInfo);
+ }
+ else if ("fov" == info_type)
+ {
+ gDisplayFOV = !(gDisplayFOV);
+ }
+ else if ("badge" == info_type)
+ {
+ gDisplayBadge = !(gDisplayBadge);
+ }
+ return true;
+ }
};
class LLAdvancedCheckHUDInfo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string info_type = userdata.asString();
- bool new_value = false;
- if ("camera" == info_type)
- {
- new_value = gDisplayCameraPos;
- }
- else if ("wind" == info_type)
- {
- new_value = gDisplayWindInfo;
- }
- else if ("fov" == info_type)
- {
- new_value = gDisplayFOV;
- }
- else if ("badge" == info_type)
- {
- new_value = gDisplayBadge;
- }
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string info_type = userdata.asString();
+ bool new_value = false;
+ if ("camera" == info_type)
+ {
+ new_value = gDisplayCameraPos;
+ }
+ else if ("wind" == info_type)
+ {
+ new_value = gDisplayWindInfo;
+ }
+ else if ("fov" == info_type)
+ {
+ new_value = gDisplayFOV;
+ }
+ else if ("badge" == info_type)
+ {
+ new_value = gDisplayBadge;
+ }
+ return new_value;
+ }
};
@@ -723,11 +723,11 @@ class LLAdvancedCheckHUDInfo : public view_listener_t
class LLAdvancedClearGroupCache : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLGroupMgr::debugClearAllGroups(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLGroupMgr::debugClearAllGroups(NULL);
+ return true;
+ }
};
@@ -738,97 +738,97 @@ class LLAdvancedClearGroupCache : public view_listener_t
/////////////////
U32 render_type_from_string(std::string render_type)
{
- if ("simple" == render_type)
- {
- return LLPipeline::RENDER_TYPE_SIMPLE;
- }
- else if ("alpha" == render_type)
- {
- return LLPipeline::RENDER_TYPE_ALPHA;
- }
- else if ("tree" == render_type)
- {
- return LLPipeline::RENDER_TYPE_TREE;
- }
- else if ("character" == render_type)
- {
- return LLPipeline::RENDER_TYPE_AVATAR;
- }
- else if ("controlAV" == render_type) // Animesh
- {
- return LLPipeline::RENDER_TYPE_CONTROL_AV;
- }
- else if ("surfacePatch" == render_type)
- {
- return LLPipeline::RENDER_TYPE_TERRAIN;
- }
- else if ("sky" == render_type)
- {
- return LLPipeline::RENDER_TYPE_SKY;
- }
- else if ("water" == render_type)
- {
- return LLPipeline::RENDER_TYPE_WATER;
- }
- else if ("volume" == render_type)
- {
- return LLPipeline::RENDER_TYPE_VOLUME;
- }
- else if ("grass" == render_type)
- {
- return LLPipeline::RENDER_TYPE_GRASS;
- }
- else if ("clouds" == render_type)
- {
- return LLPipeline::RENDER_TYPE_CLOUDS;
- }
- else if ("particles" == render_type)
- {
- return LLPipeline::RENDER_TYPE_PARTICLES;
- }
- else if ("bump" == render_type)
- {
- return LLPipeline::RENDER_TYPE_BUMP;
- }
- else if ("pbr" == render_type)
+ if ("simple" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_SIMPLE;
+ }
+ else if ("alpha" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_ALPHA;
+ }
+ else if ("tree" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_TREE;
+ }
+ else if ("character" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_AVATAR;
+ }
+ else if ("controlAV" == render_type) // Animesh
+ {
+ return LLPipeline::RENDER_TYPE_CONTROL_AV;
+ }
+ else if ("surfacePatch" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_TERRAIN;
+ }
+ else if ("sky" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_SKY;
+ }
+ else if ("water" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_WATER;
+ }
+ else if ("volume" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_VOLUME;
+ }
+ else if ("grass" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_GRASS;
+ }
+ else if ("clouds" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_CLOUDS;
+ }
+ else if ("particles" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_PARTICLES;
+ }
+ else if ("bump" == render_type)
+ {
+ return LLPipeline::RENDER_TYPE_BUMP;
+ }
+ else if ("pbr" == render_type)
{
return LLPipeline::RENDER_TYPE_GLTF_PBR;
}
- else
- {
- return 0;
- }
+ else
+ {
+ return 0;
+ }
}
class LLAdvancedToggleRenderType : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- U32 render_type = render_type_from_string( userdata.asString() );
- if ( render_type != 0 )
- {
- LLPipeline::toggleRenderTypeControl( render_type );
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ U32 render_type = render_type_from_string( userdata.asString() );
+ if ( render_type != 0 )
+ {
+ LLPipeline::toggleRenderTypeControl( render_type );
+ }
+ return true;
+ }
};
class LLAdvancedCheckRenderType : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- U32 render_type = render_type_from_string( userdata.asString() );
- bool new_value = false;
+ bool handleEvent(const LLSD& userdata)
+ {
+ U32 render_type = render_type_from_string( userdata.asString() );
+ bool new_value = false;
- if ( render_type != 0 )
- {
- new_value = LLPipeline::hasRenderTypeControl( render_type );
- }
+ if ( render_type != 0 )
+ {
+ new_value = LLPipeline::hasRenderTypeControl( render_type );
+ }
- return new_value;
- }
+ return new_value;
+ }
};
@@ -836,140 +836,140 @@ class LLAdvancedCheckRenderType : public view_listener_t
// FEATURE //
/////////////
U32 feature_from_string(std::string feature)
-{
- if ("ui" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_UI;
- }
- else if ("selected" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_SELECTED;
- }
- else if ("highlighted" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED;
- }
- else if ("dynamic textures" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES;
- }
- else if ("foot shadows" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS;
- }
- else if ("fog" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_FOG;
- }
- else if ("fr info" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO;
- }
- else if ("flexible" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE;
- }
- else
- {
- return 0;
- }
+{
+ if ("ui" == feature)
+ {
+ return LLPipeline::RENDER_DEBUG_FEATURE_UI;
+ }
+ else if ("selected" == feature)
+ {
+ return LLPipeline::RENDER_DEBUG_FEATURE_SELECTED;
+ }
+ else if ("highlighted" == feature)
+ {
+ return LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED;
+ }
+ else if ("dynamic textures" == feature)
+ {
+ return LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES;
+ }
+ else if ("foot shadows" == feature)
+ {
+ return LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS;
+ }
+ else if ("fog" == feature)
+ {
+ return LLPipeline::RENDER_DEBUG_FEATURE_FOG;
+ }
+ else if ("fr info" == feature)
+ {
+ return LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO;
+ }
+ else if ("flexible" == feature)
+ {
+ return LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE;
+ }
+ else
+ {
+ return 0;
+ }
};
class LLAdvancedToggleFeature : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- U32 feature = feature_from_string( userdata.asString() );
- if ( feature != 0 )
- {
- LLPipeline::toggleRenderDebugFeature( feature );
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ U32 feature = feature_from_string( userdata.asString() );
+ if ( feature != 0 )
+ {
+ LLPipeline::toggleRenderDebugFeature( feature );
+ }
+ return true;
+ }
};
class LLAdvancedCheckFeature : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
+ bool handleEvent(const LLSD& userdata)
{
- U32 feature = feature_from_string( userdata.asString() );
- bool new_value = false;
+ U32 feature = feature_from_string( userdata.asString() );
+ bool new_value = false;
- if ( feature != 0 )
- {
- new_value = LLPipeline::toggleRenderDebugFeatureControl( feature );
- }
+ if ( feature != 0 )
+ {
+ new_value = LLPipeline::toggleRenderDebugFeatureControl( feature );
+ }
- return new_value;
+ return new_value;
}
};
class LLAdvancedCheckDisplayTextureDensity : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string mode = userdata.asString();
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY))
- {
- return mode == "none";
- }
- if (mode == "current")
- {
- return LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_CURRENT;
- }
- else if (mode == "desired")
- {
- return LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_DESIRED;
- }
- else if (mode == "full")
- {
- return LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_FULL;
- }
- return false;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string mode = userdata.asString();
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY))
+ {
+ return mode == "none";
+ }
+ if (mode == "current")
+ {
+ return LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_CURRENT;
+ }
+ else if (mode == "desired")
+ {
+ return LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_DESIRED;
+ }
+ else if (mode == "full")
+ {
+ return LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_FULL;
+ }
+ return false;
+ }
};
class LLAdvancedSetDisplayTextureDensity : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string mode = userdata.asString();
- if (mode == "none")
- {
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == TRUE)
- {
- gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
- }
- LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF;
- }
- else if (mode == "current")
- {
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE)
- {
- gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
- }
- LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_CURRENT;
- }
- else if (mode == "desired")
- {
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE)
- {
- gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
- }
- gPipeline.setRenderDebugFeatureControl(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY, true);
- LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_DESIRED;
- }
- else if (mode == "full")
- {
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE)
- {
- gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
- }
- LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_FULL;
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string mode = userdata.asString();
+ if (mode == "none")
+ {
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == TRUE)
+ {
+ gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
+ }
+ LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF;
+ }
+ else if (mode == "current")
+ {
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE)
+ {
+ gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
+ }
+ LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_CURRENT;
+ }
+ else if (mode == "desired")
+ {
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE)
+ {
+ gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
+ }
+ gPipeline.setRenderDebugFeatureControl(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY, true);
+ LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_DESIRED;
+ }
+ else if (mode == "full")
+ {
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE)
+ {
+ gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
+ }
+ LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_FULL;
+ }
+ return true;
+ }
};
@@ -978,122 +978,122 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t
//////////////////
U64 info_display_from_string(std::string info_display)
{
- if ("verify" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_VERIFY;
- }
- else if ("bboxes" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_BBOXES;
- }
- else if ("normals" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_NORMALS;
- }
- else if ("points" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_POINTS;
- }
- else if ("octree" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_OCTREE;
- }
- else if ("shadow frusta" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA;
- }
- else if ("physics shapes" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES;
- }
- else if ("occlusion" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_OCCLUSION;
- }
- else if ("render batches" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_BATCH_SIZE;
- }
- else if ("update type" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_UPDATE_TYPE;
- }
- else if ("texture anim" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_TEXTURE_ANIM;
- }
- else if ("texture priority" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY;
- }
- else if ("texture area" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_TEXTURE_AREA;
- }
- else if ("face area" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_FACE_AREA;
- }
- else if ("lod info" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_LOD_INFO;
- }
- else if ("lights" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_LIGHTS;
- }
- else if ("particles" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_PARTICLES;
- }
- else if ("composition" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_COMPOSITION;
- }
- else if ("avatardrawinfo" == info_display)
- {
- return (LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO);
- }
- else if ("glow" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_GLOW;
- }
- else if ("collision skeleton" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_AVATAR_VOLUME;
- }
- else if ("joints" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_AVATAR_JOINTS;
- }
- else if ("raycast" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_RAYCAST;
- }
- else if ("agent target" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_AGENT_TARGET;
- }
- else if ("sculpt" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_SCULPTED;
- }
- else if ("wind vectors" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_WIND_VECTORS;
- }
- else if ("texel density" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_TEXEL_DENSITY;
- }
- else if ("triangle count" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_TRIANGLE_COUNT;
- }
- else if ("impostors" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_IMPOSTORS;
- }
+ if ("verify" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_VERIFY;
+ }
+ else if ("bboxes" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_BBOXES;
+ }
+ else if ("normals" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_NORMALS;
+ }
+ else if ("points" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_POINTS;
+ }
+ else if ("octree" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_OCTREE;
+ }
+ else if ("shadow frusta" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA;
+ }
+ else if ("physics shapes" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES;
+ }
+ else if ("occlusion" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_OCCLUSION;
+ }
+ else if ("render batches" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_BATCH_SIZE;
+ }
+ else if ("update type" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_UPDATE_TYPE;
+ }
+ else if ("texture anim" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_TEXTURE_ANIM;
+ }
+ else if ("texture priority" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY;
+ }
+ else if ("texture area" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_TEXTURE_AREA;
+ }
+ else if ("face area" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_FACE_AREA;
+ }
+ else if ("lod info" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_LOD_INFO;
+ }
+ else if ("lights" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_LIGHTS;
+ }
+ else if ("particles" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_PARTICLES;
+ }
+ else if ("composition" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_COMPOSITION;
+ }
+ else if ("avatardrawinfo" == info_display)
+ {
+ return (LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO);
+ }
+ else if ("glow" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_GLOW;
+ }
+ else if ("collision skeleton" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_AVATAR_VOLUME;
+ }
+ else if ("joints" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_AVATAR_JOINTS;
+ }
+ else if ("raycast" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_RAYCAST;
+ }
+ else if ("agent target" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_AGENT_TARGET;
+ }
+ else if ("sculpt" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_SCULPTED;
+ }
+ else if ("wind vectors" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_WIND_VECTORS;
+ }
+ else if ("texel density" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_TEXEL_DENSITY;
+ }
+ else if ("triangle count" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_TRIANGLE_COUNT;
+ }
+ else if ("impostors" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_IMPOSTORS;
+ }
else if ("reflection probes" == info_display)
{
return LLPipeline::RENDER_DEBUG_REFLECTION_PROBES;
@@ -1102,45 +1102,45 @@ U64 info_display_from_string(std::string info_display)
{
return LLPipeline::RENDER_DEBUG_PROBE_UPDATES;
}
- else
- {
- LL_WARNS() << "unrecognized feature name '" << info_display << "'" << LL_ENDL;
- return 0;
- }
+ else
+ {
+ LL_WARNS() << "unrecognized feature name '" << info_display << "'" << LL_ENDL;
+ return 0;
+ }
};
class LLAdvancedToggleInfoDisplay : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- U64 info_display = info_display_from_string( userdata.asString() );
+ bool handleEvent(const LLSD& userdata)
+ {
+ U64 info_display = info_display_from_string( userdata.asString() );
- LL_INFOS("ViewerMenu") << "toggle " << userdata.asString() << LL_ENDL;
-
- if ( info_display != 0 )
- {
- LLPipeline::toggleRenderDebug( info_display );
- }
+ LL_INFOS("ViewerMenu") << "toggle " << userdata.asString() << LL_ENDL;
+
+ if ( info_display != 0 )
+ {
+ LLPipeline::toggleRenderDebug( info_display );
+ }
- return true;
- }
+ return true;
+ }
};
class LLAdvancedCheckInfoDisplay : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- U64 info_display = info_display_from_string( userdata.asString() );
- bool new_value = false;
+ bool handleEvent(const LLSD& userdata)
+ {
+ U64 info_display = info_display_from_string( userdata.asString() );
+ bool new_value = false;
- if ( info_display != 0 )
- {
- new_value = LLPipeline::toggleRenderDebugControl( info_display );
- }
+ if ( info_display != 0 )
+ {
+ new_value = LLPipeline::toggleRenderDebugControl( info_display );
+ }
- return new_value;
- }
+ return new_value;
+ }
};
@@ -1151,20 +1151,20 @@ class LLAdvancedCheckInfoDisplay : public view_listener_t
class LLAdvancedToggleRandomizeFramerate : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gRandomizeFramerate = !(gRandomizeFramerate);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gRandomizeFramerate = !(gRandomizeFramerate);
+ return true;
+ }
};
class LLAdvancedCheckRandomizeFramerate : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gRandomizeFramerate;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gRandomizeFramerate;
+ return new_value;
+ }
};
///////////////////////////
@@ -1174,36 +1174,36 @@ class LLAdvancedCheckRandomizeFramerate : public view_listener_t
class LLAdvancedTogglePeriodicSlowFrame : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gPeriodicSlowFrame = !(gPeriodicSlowFrame);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gPeriodicSlowFrame = !(gPeriodicSlowFrame);
+ return true;
+ }
};
class LLAdvancedCheckPeriodicSlowFrame : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gPeriodicSlowFrame;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gPeriodicSlowFrame;
+ return new_value;
+ }
};
///////////////////////////
// SELECTED TEXTURE INFO //
-//
+//
///////////////////////////
class LLAdvancedSelectedTextureInfo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_selected_texture_info(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_selected_texture_info(NULL);
+ return true;
+ }
};
//////////////////////
@@ -1212,33 +1212,33 @@ class LLAdvancedSelectedTextureInfo : public view_listener_t
class LLAdvancedToggleWireframe : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gUseWireframe = !(gUseWireframe);
+ bool handleEvent(const LLSD& userdata)
+ {
+ gUseWireframe = !(gUseWireframe);
- return true;
- }
+ return true;
+ }
};
class LLAdvancedCheckWireframe : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return gUseWireframe;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return gUseWireframe;
+ }
};
-
+
//////////////////////////
// DUMP SCRIPTED CAMERA //
//////////////////////////
-
+
class LLAdvancedDumpScriptedCamera : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_dump_followcam(NULL);
- return true;
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_dump_followcam(NULL);
+ return true;
}
};
@@ -1251,11 +1251,11 @@ class LLAdvancedDumpScriptedCamera : public view_listener_t
class LLAdvancedDumpRegionObjectCache : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_dump_region_object_cache(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_dump_region_object_cache(NULL);
+ return true;
+ }
};
class LLAdvancedToggleInterestList360Mode : public view_listener_t
@@ -1266,22 +1266,22 @@ public:
// Toggle the mode - regions will get updated
if (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360)
{
- gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_DEFAULT);
- }
- else
- {
- gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360);
- }
+ gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_DEFAULT);
+ }
+ else
+ {
+ gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360);
+ }
return true;
}
};
class LLAdvancedCheckInterestList360Mode : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360);
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360);
+ }
};
class LLAdvancedToggleStatsRecorder : public view_listener_t
@@ -1289,13 +1289,13 @@ class LLAdvancedToggleStatsRecorder : public view_listener_t
bool handleEvent(const LLSD &userdata)
{
if (LLViewerStatsRecorder::instance().isEnabled())
- { // Turn off both recording and logging
- LLViewerStatsRecorder::instance().enableObjectStatsRecording(false);
- }
- else
- { // Turn on both recording and logging
- LLViewerStatsRecorder::instance().enableObjectStatsRecording(true, true);
- }
+ { // Turn off both recording and logging
+ LLViewerStatsRecorder::instance().enableObjectStatsRecording(false);
+ }
+ else
+ { // Turn on both recording and logging
+ LLViewerStatsRecorder::instance().enableObjectStatsRecording(true, true);
+ }
return true;
}
};
@@ -1303,7 +1303,7 @@ class LLAdvancedToggleStatsRecorder : public view_listener_t
class LLAdvancedCheckStatsRecorder : public view_listener_t
{
bool handleEvent(const LLSD &userdata)
- { // Use the logging state as the indicator of whether the stats recorder is on
+ { // Use the logging state as the indicator of whether the stats recorder is on
return LLViewerStatsRecorder::instance().isLogging();
}
};
@@ -1311,7 +1311,7 @@ class LLAdvancedCheckStatsRecorder : public view_listener_t
class LLAdvancedResetInterestLists : public view_listener_t
{
bool handleEvent(const LLSD &userdata)
- { // Reset all region interest lists
+ { // Reset all region interest lists
handle_reset_interest_lists(NULL);
return true;
}
@@ -1319,12 +1319,12 @@ class LLAdvancedResetInterestLists : public view_listener_t
class LLAdvancedBuyCurrencyTest : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_buy_currency_test(NULL);
- return true;
- }
+ {
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_buy_currency_test(NULL);
+ return true;
+ }
};
@@ -1335,11 +1335,11 @@ class LLAdvancedBuyCurrencyTest : public view_listener_t
class LLAdvancedDumpSelectMgr : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- dump_select_mgr(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ dump_select_mgr(NULL);
+ return true;
+ }
};
@@ -1351,11 +1351,11 @@ class LLAdvancedDumpSelectMgr : public view_listener_t
class LLAdvancedDumpInventory : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- dump_inventory(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ dump_inventory(NULL);
+ return true;
+ }
};
@@ -1367,11 +1367,11 @@ class LLAdvancedDumpInventory : public view_listener_t
class LLAdvancedPrintSelectedObjectInfo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- print_object_info(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ print_object_info(NULL);
+ return true;
+ }
};
@@ -1383,11 +1383,11 @@ class LLAdvancedPrintSelectedObjectInfo : public view_listener_t
class LLAdvancedPrintAgentInfo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- print_agent_nvpairs(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ print_agent_nvpairs(NULL);
+ return true;
+ }
};
//////////////////
@@ -1397,20 +1397,20 @@ class LLAdvancedPrintAgentInfo : public view_listener_t
class LLAdvancedToggleDebugClicks : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gDebugClicks = !(gDebugClicks);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gDebugClicks = !(gDebugClicks);
+ return true;
+ }
};
class LLAdvancedCheckDebugClicks : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gDebugClicks;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gDebugClicks;
+ return new_value;
+ }
};
@@ -1422,20 +1422,20 @@ class LLAdvancedCheckDebugClicks : public view_listener_t
class LLAdvancedToggleDebugViews : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLView::sDebugRects = !(LLView::sDebugRects);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLView::sDebugRects = !(LLView::sDebugRects);
+ return true;
+ }
};
class LLAdvancedCheckDebugViews : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLView::sDebugRects;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLView::sDebugRects;
+ return new_value;
+ }
};
@@ -1447,19 +1447,19 @@ class LLAdvancedCheckDebugViews : public view_listener_t
class LLAdvancedToggleDebugUnicode : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLView::sDebugUnicode = !(LLView::sDebugUnicode);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLView::sDebugUnicode = !(LLView::sDebugUnicode);
+ return true;
+ }
};
class LLAdvancedCheckDebugUnicode : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return LLView::sDebugUnicode;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return LLView::sDebugUnicode;
+ }
};
@@ -1471,20 +1471,20 @@ class LLAdvancedCheckDebugUnicode : public view_listener_t
class LLAdvancedToggleDebugCamera : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLView::sDebugCamera = !(LLView::sDebugCamera);
- LLFloaterCamera::onDebugCameraToggled();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLView::sDebugCamera = !(LLView::sDebugCamera);
+ LLFloaterCamera::onDebugCameraToggled();
+ return true;
+ }
};
class LLAdvancedCheckDebugCamera : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return LLView::sDebugCamera;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return LLView::sDebugCamera;
+ }
};
@@ -1496,20 +1496,20 @@ class LLAdvancedCheckDebugCamera : public view_listener_t
class LLAdvancedToggleXUINameTooltips : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- toggle_show_xui_names(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ toggle_show_xui_names(NULL);
+ return true;
+ }
};
class LLAdvancedCheckXUINameTooltips : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = check_show_xui_names(NULL);
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = check_show_xui_names(NULL);
+ return new_value;
+ }
};
@@ -1521,20 +1521,20 @@ class LLAdvancedCheckXUINameTooltips : public view_listener_t
class LLAdvancedToggleDebugMouseEvents : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLView::sDebugMouseHandling = !(LLView::sDebugMouseHandling);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLView::sDebugMouseHandling = !(LLView::sDebugMouseHandling);
+ return true;
+ }
};
class LLAdvancedCheckDebugMouseEvents : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLView::sDebugMouseHandling;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLView::sDebugMouseHandling;
+ return new_value;
+ }
};
@@ -1546,22 +1546,22 @@ class LLAdvancedCheckDebugMouseEvents : public view_listener_t
class LLAdvancedToggleDebugKeys : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLView::sDebugKeys = !(LLView::sDebugKeys);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLView::sDebugKeys = !(LLView::sDebugKeys);
+ return true;
+ }
};
-
+
class LLAdvancedCheckDebugKeys : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLView::sDebugKeys;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLView::sDebugKeys;
+ return new_value;
+ }
};
-
+
///////////////////////
@@ -1571,30 +1571,30 @@ class LLAdvancedCheckDebugKeys : public view_listener_t
class LLAdvancedToggleDebugWindowProc : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gDebugWindowProc = !(gDebugWindowProc);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gDebugWindowProc = !(gDebugWindowProc);
+ return true;
+ }
};
class LLAdvancedCheckDebugWindowProc : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gDebugWindowProc;
- return new_value;
- }
+ {
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gDebugWindowProc;
+ return new_value;
+ }
};
// ------------------------------XUI MENU ---------------------------
class LLAdvancedSendTestIms : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLIMModel::instance().testMessages();
- return true;
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLIMModel::instance().testMessages();
+ return true;
}
};
@@ -1606,20 +1606,20 @@ class LLAdvancedSendTestIms : public view_listener_t
class LLAdvancedToggleXUINames : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- toggle_show_xui_names(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ toggle_show_xui_names(NULL);
+ return true;
+ }
};
class LLAdvancedCheckXUINames : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = check_show_xui_names(NULL);
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = check_show_xui_names(NULL);
+ return new_value;
+ }
};
@@ -1630,71 +1630,71 @@ class LLAdvancedCheckXUINames : public view_listener_t
class LLAdvancedGrabBakedTexture : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string texture_type = userdata.asString();
- if ("iris" == texture_type)
- {
- handle_grab_baked_texture( (void*)BAKED_EYES );
- }
- else if ("head" == texture_type)
- {
- handle_grab_baked_texture( (void*)BAKED_HEAD );
- }
- else if ("upper" == texture_type)
- {
- handle_grab_baked_texture( (void*)BAKED_UPPER );
- }
- else if ("lower" == texture_type)
- {
- handle_grab_baked_texture( (void*)BAKED_LOWER );
- }
- else if ("skirt" == texture_type)
- {
- handle_grab_baked_texture( (void*)BAKED_SKIRT );
- }
- else if ("hair" == texture_type)
- {
- handle_grab_baked_texture( (void*)BAKED_HAIR );
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string texture_type = userdata.asString();
+ if ("iris" == texture_type)
+ {
+ handle_grab_baked_texture( (void*)BAKED_EYES );
+ }
+ else if ("head" == texture_type)
+ {
+ handle_grab_baked_texture( (void*)BAKED_HEAD );
+ }
+ else if ("upper" == texture_type)
+ {
+ handle_grab_baked_texture( (void*)BAKED_UPPER );
+ }
+ else if ("lower" == texture_type)
+ {
+ handle_grab_baked_texture( (void*)BAKED_LOWER );
+ }
+ else if ("skirt" == texture_type)
+ {
+ handle_grab_baked_texture( (void*)BAKED_SKIRT );
+ }
+ else if ("hair" == texture_type)
+ {
+ handle_grab_baked_texture( (void*)BAKED_HAIR );
+ }
+
+ return true;
+ }
};
class LLAdvancedEnableGrabBakedTexture : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
-{
- std::string texture_type = userdata.asString();
- bool new_value = false;
-
- if ("iris" == texture_type)
- {
- new_value = enable_grab_baked_texture( (void*)BAKED_EYES );
- }
- else if ("head" == texture_type)
- {
- new_value = enable_grab_baked_texture( (void*)BAKED_HEAD );
- }
- else if ("upper" == texture_type)
- {
- new_value = enable_grab_baked_texture( (void*)BAKED_UPPER );
- }
- else if ("lower" == texture_type)
- {
- new_value = enable_grab_baked_texture( (void*)BAKED_LOWER );
- }
- else if ("skirt" == texture_type)
- {
- new_value = enable_grab_baked_texture( (void*)BAKED_SKIRT );
- }
- else if ("hair" == texture_type)
- {
- new_value = enable_grab_baked_texture( (void*)BAKED_HAIR );
- }
-
- return new_value;
+ bool handleEvent(const LLSD& userdata)
+{
+ std::string texture_type = userdata.asString();
+ bool new_value = false;
+
+ if ("iris" == texture_type)
+ {
+ new_value = enable_grab_baked_texture( (void*)BAKED_EYES );
+ }
+ else if ("head" == texture_type)
+ {
+ new_value = enable_grab_baked_texture( (void*)BAKED_HEAD );
+ }
+ else if ("upper" == texture_type)
+ {
+ new_value = enable_grab_baked_texture( (void*)BAKED_UPPER );
+ }
+ else if ("lower" == texture_type)
+ {
+ new_value = enable_grab_baked_texture( (void*)BAKED_LOWER );
+ }
+ else if ("skirt" == texture_type)
+ {
+ new_value = enable_grab_baked_texture( (void*)BAKED_SKIRT );
+ }
+ else if ("hair" == texture_type)
+ {
+ new_value = enable_grab_baked_texture( (void*)BAKED_HAIR );
+ }
+
+ return new_value;
}
};
@@ -1705,8 +1705,8 @@ class LLAdvancedEnableGrabBakedTexture : public view_listener_t
class LLAdvancedEnableAppearanceToXML : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
+ bool handleEvent(const LLSD& userdata)
+ {
LLViewerObject *obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
if (obj && obj->isAnimatedObject() && obj->getControlAvatar())
{
@@ -1721,18 +1721,18 @@ class LLAdvancedEnableAppearanceToXML : public view_listener_t
// This has to be a non-control avatar, because control avs are invisible and unclickable.
return gSavedSettings.getBOOL("DebugAvatarAppearanceMessage");
}
- else
- {
- return false;
- }
- }
+ else
+ {
+ return false;
+ }
+ }
};
class LLAdvancedAppearanceToXML : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string emptyname;
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string emptyname;
LLViewerObject *obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
LLVOAvatar *avatar = NULL;
if (obj)
@@ -1755,14 +1755,14 @@ class LLAdvancedAppearanceToXML : public view_listener_t
else
{
// If no selection, use the self avatar.
- avatar = gAgentAvatarp;
+ avatar = gAgentAvatarp;
}
if (avatar)
{
avatar->dumpArchetypeXML(emptyname);
}
- return true;
- }
+ return true;
+ }
};
@@ -1774,44 +1774,44 @@ class LLAdvancedAppearanceToXML : public view_listener_t
class LLAdvancedToggleCharacterGeometry : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_god_request_avatar_geometry(NULL);
- return true;
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_god_request_avatar_geometry(NULL);
+ return true;
}
};
- /////////////////////////////
+ /////////////////////////////
// TEST MALE / TEST FEMALE //
/////////////////////////////
class LLAdvancedTestMale : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_test_male(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_test_male(NULL);
+ return true;
+ }
};
class LLAdvancedTestFemale : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_test_female(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_test_female(NULL);
+ return true;
+ }
};
class LLAdvancedForceParamsToDefault : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLAgent::clearVisualParams(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLAgent::clearVisualParams(NULL);
+ return true;
+ }
};
@@ -1820,47 +1820,47 @@ class LLAdvancedForceParamsToDefault : public view_listener_t
//////////////////////////
// Utility function to set all AV time factors to the same global value
-static void set_all_animation_time_factors(F32 time_factor)
+static void set_all_animation_time_factors(F32 time_factor)
{
- LLMotionController::setCurrentTimeFactor(time_factor);
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- (*iter)->setAnimTimeFactor(time_factor);
- }
+ LLMotionController::setCurrentTimeFactor(time_factor);
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ (*iter)->setAnimTimeFactor(time_factor);
+ }
}
class LLAdvancedAnimTenFaster : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- //LL_INFOS() << "LLAdvancedAnimTenFaster" << LL_ENDL;
- F32 time_factor = LLMotionController::getCurrentTimeFactor();
- time_factor = llmin(time_factor + 0.1f, 2.f); // Upper limit is 200% speed
- set_all_animation_time_factors(time_factor);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ //LL_INFOS() << "LLAdvancedAnimTenFaster" << LL_ENDL;
+ F32 time_factor = LLMotionController::getCurrentTimeFactor();
+ time_factor = llmin(time_factor + 0.1f, 2.f); // Upper limit is 200% speed
+ set_all_animation_time_factors(time_factor);
+ return true;
+ }
};
class LLAdvancedAnimTenSlower : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- //LL_INFOS() << "LLAdvancedAnimTenSlower" << LL_ENDL;
- F32 time_factor = LLMotionController::getCurrentTimeFactor();
- time_factor = llmax(time_factor - 0.1f, 0.1f); // Lower limit is at 10% of normal speed
- set_all_animation_time_factors(time_factor);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ //LL_INFOS() << "LLAdvancedAnimTenSlower" << LL_ENDL;
+ F32 time_factor = LLMotionController::getCurrentTimeFactor();
+ time_factor = llmax(time_factor - 0.1f, 0.1f); // Lower limit is at 10% of normal speed
+ set_all_animation_time_factors(time_factor);
+ return true;
+ }
};
class LLAdvancedAnimResetAll : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- set_all_animation_time_factors(1.f);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ set_all_animation_time_factors(1.f);
+ return true;
+ }
};
@@ -1871,11 +1871,11 @@ class LLAdvancedAnimResetAll : public view_listener_t
class LLAdvancedReloadVertexShader : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- reload_vertex_shader(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ reload_vertex_shader(NULL);
+ return true;
+ }
};
@@ -1887,20 +1887,20 @@ class LLAdvancedReloadVertexShader : public view_listener_t
class LLAdvancedToggleAnimationInfo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar::sShowAnimationDebug = !(LLVOAvatar::sShowAnimationDebug);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar::sShowAnimationDebug = !(LLVOAvatar::sShowAnimationDebug);
+ return true;
+ }
};
class LLAdvancedCheckAnimationInfo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLVOAvatar::sShowAnimationDebug;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLVOAvatar::sShowAnimationDebug;
+ return new_value;
+ }
};
@@ -1911,20 +1911,20 @@ class LLAdvancedCheckAnimationInfo : public view_listener_t
class LLAdvancedToggleShowLookAt : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLHUDEffectLookAt::sDebugLookAt = !(LLHUDEffectLookAt::sDebugLookAt);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLHUDEffectLookAt::sDebugLookAt = !(LLHUDEffectLookAt::sDebugLookAt);
+ return true;
+ }
};
class LLAdvancedCheckShowLookAt : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLHUDEffectLookAt::sDebugLookAt;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLHUDEffectLookAt::sDebugLookAt;
+ return new_value;
+ }
};
@@ -1936,20 +1936,20 @@ class LLAdvancedCheckShowLookAt : public view_listener_t
class LLAdvancedToggleShowPointAt : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLHUDEffectPointAt::sDebugPointAt = !(LLHUDEffectPointAt::sDebugPointAt);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLHUDEffectPointAt::sDebugPointAt = !(LLHUDEffectPointAt::sDebugPointAt);
+ return true;
+ }
};
class LLAdvancedCheckShowPointAt : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLHUDEffectPointAt::sDebugPointAt;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLHUDEffectPointAt::sDebugPointAt;
+ return new_value;
+ }
};
@@ -1961,20 +1961,20 @@ class LLAdvancedCheckShowPointAt : public view_listener_t
class LLAdvancedToggleDebugJointUpdates : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar::sJointDebug = !(LLVOAvatar::sJointDebug);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar::sJointDebug = !(LLVOAvatar::sJointDebug);
+ return true;
+ }
};
class LLAdvancedCheckDebugJointUpdates : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLVOAvatar::sJointDebug;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLVOAvatar::sJointDebug;
+ return new_value;
+ }
};
@@ -1986,20 +1986,20 @@ class LLAdvancedCheckDebugJointUpdates : public view_listener_t
class LLAdvancedToggleDisableLOD : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerJoint::sDisableLOD = !(LLViewerJoint::sDisableLOD);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLViewerJoint::sDisableLOD = !(LLViewerJoint::sDisableLOD);
+ return true;
+ }
};
-
+
class LLAdvancedCheckDisableLOD : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLViewerJoint::sDisableLOD;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLViewerJoint::sDisableLOD;
+ return new_value;
+ }
};
@@ -2011,20 +2011,20 @@ class LLAdvancedCheckDisableLOD : public view_listener_t
class LLAdvancedToggleDebugCharacterVis : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar::sDebugInvisible = !(LLVOAvatar::sDebugInvisible);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar::sDebugInvisible = !(LLVOAvatar::sDebugInvisible);
+ return true;
+ }
};
class LLAdvancedCheckDebugCharacterVis : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLVOAvatar::sDebugInvisible;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLVOAvatar::sDebugInvisible;
+ return new_value;
+ }
};
@@ -2032,33 +2032,33 @@ class LLAdvancedCheckDebugCharacterVis : public view_listener_t
// DUMP ATTACHMENTS //
//////////////////////
-
+
class LLAdvancedDumpAttachments : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_dump_attachments(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_dump_attachments(NULL);
+ return true;
+ }
};
-
+
/////////////////////
// REBAKE TEXTURES //
/////////////////////
-
-
+
+
class LLAdvancedRebakeTextures : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_rebake_textures(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_rebake_textures(NULL);
+ return true;
+ }
};
-
-
+
+
#if 1 //ndef LL_RELEASE_FOR_DOWNLOAD
///////////////////////////
// DEBUG AVATAR TEXTURES //
@@ -2067,14 +2067,14 @@ class LLAdvancedRebakeTextures : public view_listener_t
class LLAdvancedDebugAvatarTextures : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgent.isGodlike())
- {
- handle_debug_avatar_textures(NULL);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (gAgent.isGodlike())
+ {
+ handle_debug_avatar_textures(NULL);
+ }
+ return true;
+ }
};
////////////////////////////////
@@ -2084,17 +2084,17 @@ class LLAdvancedDebugAvatarTextures : public view_listener_t
class LLAdvancedDumpAvatarLocalTextures : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
+ bool handleEvent(const LLSD& userdata)
+ {
#ifndef LL_RELEASE_FOR_DOWNLOAD
- handle_dump_avatar_local_textures(NULL);
+ handle_dump_avatar_local_textures(NULL);
#endif
- return true;
- }
+ return true;
+ }
};
#endif
-
+
/////////////////
// MESSAGE LOG //
/////////////////
@@ -2102,20 +2102,20 @@ class LLAdvancedDumpAvatarLocalTextures : public view_listener_t
class LLAdvancedEnableMessageLog : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_viewer_enable_message_log(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_viewer_enable_message_log(NULL);
+ return true;
+ }
};
class LLAdvancedDisableMessageLog : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_viewer_disable_message_log(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_viewer_disable_message_log(NULL);
+ return true;
+ }
};
/////////////////
@@ -2125,11 +2125,11 @@ class LLAdvancedDisableMessageLog : public view_listener_t
class LLAdvancedDropPacket : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gMessageSystem->mPacketRing.dropPackets(1);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gMessageSystem->mPacketRing.dropPackets(1);
+ return true;
+ }
};
//////////////////////
@@ -2139,8 +2139,8 @@ class LLAdvancedDropPacket : public view_listener_t
class LLAdvancedPurgeDiskCache : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
+ bool handleEvent(const LLSD& userdata)
+ {
LL::WorkQueue::ptr_t main_queue = LL::WorkQueue::getInstance("mainloop");
LL::WorkQueue::ptr_t general_queue = LL::WorkQueue::getInstance("General");
llassert_always(main_queue);
@@ -2154,8 +2154,8 @@ class LLAdvancedPurgeDiskCache : public view_listener_t
},
[](){}); // Callback to main thread is empty as there is nothing left to do
- return true;
- }
+ return true;
+ }
};
@@ -2166,12 +2166,12 @@ class LLAdvancedPurgeDiskCache : public view_listener_t
class LLAdvancedPurgeShaderCache : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerShaderMgr::instance()->clearShaderCache();
- LLViewerShaderMgr::instance()->setShaders();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLViewerShaderMgr::instance()->clearShaderCache();
+ LLViewerShaderMgr::instance()->setShaders();
+ return true;
+ }
};
////////////////////
@@ -2181,32 +2181,32 @@ class LLAdvancedPurgeShaderCache : public view_listener_t
class LLAdvancedViewerEventRecorder : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string command = userdata.asString();
- if ("start playback" == command)
- {
- LL_INFOS() << "Event Playback starting" << LL_ENDL;
- LLViewerEventRecorder::instance().playbackRecording();
- LL_INFOS() << "Event Playback completed" << LL_ENDL;
- }
- else if ("stop playback" == command)
- {
- // Future
- }
- else if ("start recording" == command)
- {
- LLViewerEventRecorder::instance().setEventLoggingOn();
- LL_INFOS() << "Event recording started" << LL_ENDL;
- }
- else if ("stop recording" == command)
- {
- LLViewerEventRecorder::instance().setEventLoggingOff();
- LL_INFOS() << "Event recording stopped" << LL_ENDL;
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string command = userdata.asString();
+ if ("start playback" == command)
+ {
+ LL_INFOS() << "Event Playback starting" << LL_ENDL;
+ LLViewerEventRecorder::instance().playbackRecording();
+ LL_INFOS() << "Event Playback completed" << LL_ENDL;
+ }
+ else if ("stop playback" == command)
+ {
+ // Future
+ }
+ else if ("start recording" == command)
+ {
+ LLViewerEventRecorder::instance().setEventLoggingOn();
+ LL_INFOS() << "Event recording started" << LL_ENDL;
+ }
+ else if ("stop recording" == command)
+ {
+ LLViewerEventRecorder::instance().setEventLoggingOff();
+ LL_INFOS() << "Event recording stopped" << LL_ENDL;
+ }
+
+ return true;
+ }
};
@@ -2219,29 +2219,29 @@ class LLAdvancedViewerEventRecorder : public view_listener_t
class LLAdvancedAgentPilot : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string command = userdata.asString();
- if ("start playback" == command)
- {
- gAgentPilot.setNumRuns(-1);
- gAgentPilot.startPlayback();
- }
- else if ("stop playback" == command)
- {
- gAgentPilot.stopPlayback();
- }
- else if ("start record" == command)
- {
- gAgentPilot.startRecord();
- }
- else if ("stop record" == command)
- {
- gAgentPilot.stopRecord();
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string command = userdata.asString();
+ if ("start playback" == command)
+ {
+ gAgentPilot.setNumRuns(-1);
+ gAgentPilot.startPlayback();
+ }
+ else if ("stop playback" == command)
+ {
+ gAgentPilot.stopPlayback();
+ }
+ else if ("start record" == command)
+ {
+ gAgentPilot.startRecord();
+ }
+ else if ("stop record" == command)
+ {
+ gAgentPilot.stopRecord();
+ }
+
+ return true;
+ }
};
@@ -2253,20 +2253,20 @@ class LLAdvancedAgentPilot : public view_listener_t
class LLAdvancedToggleAgentPilotLoop : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gAgentPilot.setLoop(!gAgentPilot.getLoop());
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gAgentPilot.setLoop(!gAgentPilot.getLoop());
+ return true;
+ }
};
class LLAdvancedCheckAgentPilotLoop : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gAgentPilot.getLoop();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gAgentPilot.getLoop();
+ return new_value;
+ }
};
@@ -2277,20 +2277,20 @@ class LLAdvancedCheckAgentPilotLoop : public view_listener_t
class LLAdvancedToggleShowObjectUpdates : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gShowObjectUpdates = !(gShowObjectUpdates);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gShowObjectUpdates = !(gShowObjectUpdates);
+ return true;
+ }
};
class LLAdvancedCheckShowObjectUpdates : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gShowObjectUpdates;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gShowObjectUpdates;
+ return new_value;
+ }
};
@@ -2302,11 +2302,11 @@ class LLAdvancedCheckShowObjectUpdates : public view_listener_t
class LLAdvancedCompressImage : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_compress_image(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_compress_image(NULL);
+ return true;
+ }
};
@@ -2332,11 +2332,11 @@ class LLAdvancedCompressFileTest : public view_listener_t
class LLAdvancedShowDebugSettings : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloaterReg::showInstance("settings_debug",userdata);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloaterReg::showInstance("settings_debug",userdata);
+ return true;
+ }
};
@@ -2347,40 +2347,40 @@ class LLAdvancedShowDebugSettings : public view_listener_t
class LLAdvancedEnableViewAdminOptions : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- // Don't enable in god mode since the admin menu is shown anyway.
- // Only enable if the user has set the appropriate debug setting.
- bool new_value = !gAgent.getAgentAccess().isGodlikeWithoutAdminMenuFakery() && gSavedSettings.getBOOL("AdminMenu");
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ // Don't enable in god mode since the admin menu is shown anyway.
+ // Only enable if the user has set the appropriate debug setting.
+ bool new_value = !gAgent.getAgentAccess().isGodlikeWithoutAdminMenuFakery() && gSavedSettings.getBOOL("AdminMenu");
+ return new_value;
+ }
};
class LLAdvancedToggleViewAdminOptions : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_admin_override_toggle(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_admin_override_toggle(NULL);
+ return true;
+ }
};
class LLAdvancedToggleVisualLeakDetector : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_visual_leak_detector_toggle(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_visual_leak_detector_toggle(NULL);
+ return true;
+ }
};
class LLAdvancedCheckViewAdminOptions : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = check_admin_override(NULL) || gAgent.isGodlike();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = check_admin_override(NULL) || gAgent.isGodlike();
+ return new_value;
+ }
};
//////////////////
@@ -2390,20 +2390,20 @@ class LLAdvancedCheckViewAdminOptions : public view_listener_t
class LLAdvancedRequestAdminStatus : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_god_mode(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_god_mode(NULL);
+ return true;
+ }
};
class LLAdvancedLeaveAdminStatus : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_leave_god_mode(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_leave_god_mode(NULL);
+ return true;
+ }
};
//////////////////////////
@@ -2412,20 +2412,20 @@ class LLAdvancedLeaveAdminStatus : public view_listener_t
class LLAdvancedForceErrorBreakpoint : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- force_error_breakpoint(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ force_error_breakpoint(NULL);
+ return true;
+ }
};
class LLAdvancedForceErrorLlerror : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- force_error_llerror(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ force_error_llerror(NULL);
+ return true;
+ }
};
class LLAdvancedForceErrorLlerrorMsg: public view_listener_t
@@ -2439,11 +2439,11 @@ class LLAdvancedForceErrorLlerrorMsg: public view_listener_t
class LLAdvancedForceErrorBadMemoryAccess : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- force_error_bad_memory_access(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ force_error_bad_memory_access(NULL);
+ return true;
+ }
};
class LLAdvancedForceErrorBadMemoryAccessCoro : public view_listener_t
@@ -2464,20 +2464,20 @@ class LLAdvancedForceErrorBadMemoryAccessCoro : public view_listener_t
class LLAdvancedForceErrorInfiniteLoop : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- force_error_infinite_loop(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ force_error_infinite_loop(NULL);
+ return true;
+ }
};
class LLAdvancedForceErrorSoftwareException : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- force_error_software_exception(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ force_error_software_exception(NULL);
+ return true;
+ }
};
class LLAdvancedForceOSException: public view_listener_t
@@ -2507,11 +2507,11 @@ class LLAdvancedForceErrorSoftwareExceptionCoro : public view_listener_t
class LLAdvancedForceErrorDriverCrash : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- force_error_driver_crash(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ force_error_driver_crash(NULL);
+ return true;
+ }
};
class LLAdvancedForceErrorCoroutineCrash : public view_listener_t
@@ -2534,10 +2534,10 @@ class LLAdvancedForceErrorThreadCrash : public view_listener_t
class LLAdvancedForceErrorDisconnectViewer : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_disconnect_viewer(NULL);
- return true;
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_disconnect_viewer(NULL);
+ return true;
}
};
@@ -2546,29 +2546,29 @@ class LLAdvancedForceErrorDisconnectViewer : public view_listener_t
class LLAdvancedHandleToggleHackedGodmode : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_toggle_hacked_godmode(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_toggle_hacked_godmode(NULL);
+ return true;
+ }
};
class LLAdvancedCheckToggleHackedGodmode : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- check_toggle_hacked_godmode(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ check_toggle_hacked_godmode(NULL);
+ return true;
+ }
};
class LLAdvancedEnableToggleHackedGodmode : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = enable_toggle_hacked_godmode(NULL);
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = enable_toggle_hacked_godmode(NULL);
+ return new_value;
+ }
};
#endif
@@ -2585,21 +2585,21 @@ class LLAdvancedEnableToggleHackedGodmode : public view_listener_t
class LLDevelopCheckLoggingLevel : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- U32 level = userdata.asInteger();
- return (static_cast<LLError::ELevel>(level) == LLError::getDefaultLevel());
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ U32 level = userdata.asInteger();
+ return (static_cast<LLError::ELevel>(level) == LLError::getDefaultLevel());
+ }
};
class LLDevelopSetLoggingLevel : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- U32 level = userdata.asInteger();
- LLError::setDefaultLevel(static_cast<LLError::ELevel>(level));
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ U32 level = userdata.asInteger();
+ LLError::setDefaultLevel(static_cast<LLError::ELevel>(level));
+ return true;
+ }
};
//////////////////
@@ -2609,100 +2609,100 @@ class LLDevelopSetLoggingLevel : public view_listener_t
// Admin > Object
class LLAdminForceTakeCopy : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- force_take_copy(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ force_take_copy(NULL);
+ return true;
+ }
};
class LLAdminHandleObjectOwnerSelf : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_object_owner_self(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_object_owner_self(NULL);
+ return true;
+ }
};
class LLAdminHandleObjectOwnerPermissive : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_object_owner_permissive(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_object_owner_permissive(NULL);
+ return true;
+ }
};
class LLAdminHandleForceDelete : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_force_delete(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_force_delete(NULL);
+ return true;
+ }
};
class LLAdminHandleObjectLock : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_object_lock(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_object_lock(NULL);
+ return true;
+ }
};
class LLAdminHandleObjectAssetIDs: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_object_asset_ids(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_object_asset_ids(NULL);
+ return true;
+ }
};
//Admin >Parcel
class LLAdminHandleForceParcelOwnerToMe: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_force_parcel_owner_to_me(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_force_parcel_owner_to_me(NULL);
+ return true;
+ }
};
class LLAdminHandleForceParcelToContent: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_force_parcel_to_content(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_force_parcel_to_content(NULL);
+ return true;
+ }
};
class LLAdminHandleClaimPublicLand: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_claim_public_land(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_claim_public_land(NULL);
+ return true;
+ }
};
// Admin > Region
class LLAdminHandleRegionDumpTempAssetData: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_region_dump_temp_asset_data(NULL);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_region_dump_temp_asset_data(NULL);
+ return true;
+ }
};
//Admin (Top Level)
class LLAdminOnSaveState: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLPanelRegionTools::onSaveState(NULL);
- return true;
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLPanelRegionTools::onSaveState(NULL);
+ return true;
}
};
@@ -2712,38 +2712,38 @@ class LLAdminOnSaveState: public view_listener_t
//-----------------------------------------------------------------------------
void cleanup_menus()
{
- delete gMenuParcelObserver;
- gMenuParcelObserver = NULL;
+ delete gMenuParcelObserver;
+ gMenuParcelObserver = NULL;
- delete gMenuAvatarSelf;
- gMenuAvatarSelf = NULL;
+ delete gMenuAvatarSelf;
+ gMenuAvatarSelf = NULL;
- delete gMenuAvatarOther;
- gMenuAvatarOther = NULL;
+ delete gMenuAvatarOther;
+ gMenuAvatarOther = NULL;
- delete gMenuObject;
- gMenuObject = NULL;
+ delete gMenuObject;
+ gMenuObject = NULL;
- delete gMenuAttachmentSelf;
- gMenuAttachmentSelf = NULL;
+ delete gMenuAttachmentSelf;
+ gMenuAttachmentSelf = NULL;
- delete gMenuAttachmentOther;
- gMenuAttachmentSelf = NULL;
+ delete gMenuAttachmentOther;
+ gMenuAttachmentSelf = NULL;
- delete gMenuLand;
- gMenuLand = NULL;
+ delete gMenuLand;
+ gMenuLand = NULL;
- delete gMenuMuteParticle;
- gMenuMuteParticle = NULL;
+ delete gMenuMuteParticle;
+ gMenuMuteParticle = NULL;
- delete gMenuBarView;
- gMenuBarView = NULL;
+ delete gMenuBarView;
+ gMenuBarView = NULL;
- delete gPopupMenuView;
- gPopupMenuView = NULL;
+ delete gPopupMenuView;
+ gPopupMenuView = NULL;
- delete gMenuHolder;
- gMenuHolder = NULL;
+ delete gMenuHolder;
+ gMenuHolder = NULL;
}
//-----------------------------------------------------------------------------
@@ -2752,40 +2752,40 @@ void cleanup_menus()
class LLObjectReportAbuse : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (objectp)
- {
- LLFloaterReporter::showFromObject(objectp->getID());
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (objectp)
+ {
+ LLFloaterReporter::showFromObject(objectp->getID());
+ }
+ return true;
+ }
};
// Enabled it you clicked an object
class LLObjectEnableReportAbuse : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLSelectMgr::getInstance()->getSelection()->getObjectCount() != 0;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLSelectMgr::getInstance()->getSelection()->getObjectCount() != 0;
+ return new_value;
+ }
};
void handle_object_touch()
{
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return;
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (!object) return;
- LLPickInfo pick = LLToolPie::getInstance()->getPick();
+ LLPickInfo pick = LLToolPie::getInstance()->getPick();
- // *NOTE: Hope the packets arrive safely and in order or else
- // there will be some problems.
- // *TODO: Just fix this bad assumption.
- send_ObjectGrab_message(object, pick, LLVector3::zero);
- send_ObjectDeGrab_message(object, pick);
+ // *NOTE: Hope the packets arrive safely and in order or else
+ // there will be some problems.
+ // *TODO: Just fix this bad assumption.
+ send_ObjectGrab_message(object, pick, LLVector3::zero);
+ send_ObjectDeGrab_message(object, pick);
}
void handle_object_show_original()
@@ -2818,75 +2818,75 @@ void handle_object_show_original()
static void init_default_item_label(LLUICtrl* ctrl)
{
- const std::string& item_name = ctrl->getName();
- boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name);
- if (it == sDefaultItemLabels.end())
- {
- // *NOTE: This will not work for items of type LLMenuItemCheckGL because they return boolean value
- // (doesn't seem to matter much ATM).
- LLStringExplicit default_label = ctrl->getValue().asString();
- if (!default_label.empty())
- {
- sDefaultItemLabels.insert(std::pair<std::string, LLStringExplicit>(item_name, default_label));
- }
- }
+ const std::string& item_name = ctrl->getName();
+ boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name);
+ if (it == sDefaultItemLabels.end())
+ {
+ // *NOTE: This will not work for items of type LLMenuItemCheckGL because they return boolean value
+ // (doesn't seem to matter much ATM).
+ LLStringExplicit default_label = ctrl->getValue().asString();
+ if (!default_label.empty())
+ {
+ sDefaultItemLabels.insert(std::pair<std::string, LLStringExplicit>(item_name, default_label));
+ }
+ }
}
static LLStringExplicit get_default_item_label(const std::string& item_name)
{
- LLStringExplicit res("");
- boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name);
- if (it != sDefaultItemLabels.end())
- {
- res = it->second;
- }
+ LLStringExplicit res("");
+ boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name);
+ if (it != sDefaultItemLabels.end())
+ {
+ res = it->second;
+ }
- return res;
+ return res;
}
bool enable_object_touch(LLUICtrl* ctrl)
{
- bool new_value = false;
- LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (obj)
- {
- LLViewerObject* parent = (LLViewerObject*)obj->getParent();
- new_value = obj->flagHandleTouch() || (parent && parent->flagHandleTouch());
- }
+ bool new_value = false;
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (obj)
+ {
+ LLViewerObject* parent = (LLViewerObject*)obj->getParent();
+ new_value = obj->flagHandleTouch() || (parent && parent->flagHandleTouch());
+ }
- init_default_item_label(ctrl);
+ init_default_item_label(ctrl);
- // Update label based on the node touch name if available.
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (node && node->mValid && !node->mTouchName.empty())
- {
- ctrl->setValue(node->mTouchName);
- }
- else
- {
- ctrl->setValue(get_default_item_label(ctrl->getName()));
- }
+ // Update label based on the node touch name if available.
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if (node && node->mValid && !node->mTouchName.empty())
+ {
+ ctrl->setValue(node->mTouchName);
+ }
+ else
+ {
+ ctrl->setValue(get_default_item_label(ctrl->getName()));
+ }
- return new_value;
+ return new_value;
};
//void label_touch(std::string& label, void*)
//{
-// LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
-// if (node && node->mValid && !node->mTouchName.empty())
-// {
-// label.assign(node->mTouchName);
-// }
-// else
-// {
-// label.assign("Touch");
-// }
+// LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+// if (node && node->mValid && !node->mTouchName.empty())
+// {
+// label.assign(node->mTouchName);
+// }
+// else
+// {
+// label.assign("Touch");
+// }
//}
void handle_object_open()
{
- LLFloaterReg::showInstance("openobject");
+ LLFloaterReg::showInstance("openobject");
}
bool enable_object_inspect()
@@ -2941,67 +2941,67 @@ bool enable_object_edit_gltf_material()
bool enable_object_open()
{
- // Look for contents in root object, which is all the LLFloaterOpenObject
- // understands.
- LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!obj) return false;
+ // Look for contents in root object, which is all the LLFloaterOpenObject
+ // understands.
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (!obj) return false;
- LLViewerObject* root = obj->getRootEdit();
- if (!root) return false;
+ LLViewerObject* root = obj->getRootEdit();
+ if (!root) return false;
- return root->allowOpen();
+ return root->allowOpen();
}
class LLViewJoystickFlycam : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_toggle_flycam();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_toggle_flycam();
+ return true;
+ }
};
class LLViewCheckJoystickFlycam : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLViewerJoystick::getInstance()->getOverrideCamera();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLViewerJoystick::getInstance()->getOverrideCamera();
+ return new_value;
+ }
};
void handle_toggle_flycam()
{
- LLViewerJoystick::getInstance()->toggleFlycam();
+ LLViewerJoystick::getInstance()->toggleFlycam();
}
class LLObjectBuild : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") )
- {
- // zoom in if we're looking at the avatar
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
- gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gAgentCamera.cameraZoomIn(0.666f);
- gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD );
- gViewerWindow->moveCursorToCenter();
- }
- else if ( gSavedSettings.getBOOL("EditCameraMovement") )
- {
- gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gViewerWindow->moveCursorToCenter();
- }
-
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
-
- // Could be first use
- //LLFirstUse::useBuild();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") )
+ {
+ // zoom in if we're looking at the avatar
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+ gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
+ gAgentCamera.cameraZoomIn(0.666f);
+ gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD );
+ gViewerWindow->moveCursorToCenter();
+ }
+ else if ( gSavedSettings.getBOOL("EditCameraMovement") )
+ {
+ gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
+ gViewerWindow->moveCursorToCenter();
+ }
+
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
+
+ // Could be first use
+ //LLFirstUse::useBuild();
+ return true;
+ }
};
void update_camera()
@@ -3040,17 +3040,17 @@ void handle_object_edit()
{
update_camera();
- LLFloaterReg::showInstance("build");
-
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() );
-
- LLViewerJoystick::getInstance()->moveObjects(true);
- LLViewerJoystick::getInstance()->setNeedsReset(true);
-
- // Could be first use
- //LLFirstUse::useBuild();
- return;
+ LLFloaterReg::showInstance("build");
+
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() );
+
+ LLViewerJoystick::getInstance()->moveObjects(true);
+ LLViewerJoystick::getInstance()->setNeedsReset(true);
+
+ // Could be first use
+ //LLFirstUse::useBuild();
+ return;
}
void handle_object_edit_gltf_material()
@@ -3072,68 +3072,68 @@ void handle_object_edit_gltf_material()
void handle_attachment_edit(const LLUUID& inv_item_id)
{
- if (isAgentAvatarValid())
- {
- if (LLViewerObject* attached_obj = gAgentAvatarp->getWornAttachment(inv_item_id))
- {
- LLSelectMgr::getInstance()->deselectAll();
- LLSelectMgr::getInstance()->selectObjectAndFamily(attached_obj);
+ if (isAgentAvatarValid())
+ {
+ if (LLViewerObject* attached_obj = gAgentAvatarp->getWornAttachment(inv_item_id))
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ LLSelectMgr::getInstance()->selectObjectAndFamily(attached_obj);
- handle_object_edit();
- }
- }
+ handle_object_edit();
+ }
+ }
}
void handle_attachment_touch(const LLUUID& inv_item_id)
{
- if ( (isAgentAvatarValid()) && (enable_attachment_touch(inv_item_id)) )
- {
- if (LLViewerObject* attach_obj = gAgentAvatarp->getWornAttachment(gInventory.getLinkedItemID(inv_item_id)))
- {
- LLSelectMgr::getInstance()->deselectAll();
-
- LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->selectObjectAndFamily(attach_obj);
- if (!LLToolMgr::getInstance()->inBuildMode())
- {
- struct SetTransient : public LLSelectedNodeFunctor
- {
- bool apply(LLSelectNode* node)
- {
- node->setTransient(TRUE);
- return true;
- }
- } f;
- sel->applyToNodes(&f);
- }
-
- handle_object_touch();
- }
- }
+ if ( (isAgentAvatarValid()) && (enable_attachment_touch(inv_item_id)) )
+ {
+ if (LLViewerObject* attach_obj = gAgentAvatarp->getWornAttachment(gInventory.getLinkedItemID(inv_item_id)))
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+
+ LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->selectObjectAndFamily(attach_obj);
+ if (!LLToolMgr::getInstance()->inBuildMode())
+ {
+ struct SetTransient : public LLSelectedNodeFunctor
+ {
+ bool apply(LLSelectNode* node)
+ {
+ node->setTransient(TRUE);
+ return true;
+ }
+ } f;
+ sel->applyToNodes(&f);
+ }
+
+ handle_object_touch();
+ }
+ }
}
bool enable_attachment_touch(const LLUUID& inv_item_id)
{
- if (isAgentAvatarValid())
- {
- const LLViewerObject* attach_obj = gAgentAvatarp->getWornAttachment(gInventory.getLinkedItemID(inv_item_id));
- return (attach_obj) && (attach_obj->flagHandleTouch());
- }
- return false;
+ if (isAgentAvatarValid())
+ {
+ const LLViewerObject* attach_obj = gAgentAvatarp->getWornAttachment(gInventory.getLinkedItemID(inv_item_id));
+ return (attach_obj) && (attach_obj->flagHandleTouch());
+ }
+ return false;
}
void handle_object_inspect()
{
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- LLViewerObject* selected_objectp = selection->getFirstRootObject();
- if (selected_objectp)
- {
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ LLViewerObject* selected_objectp = selection->getFirstRootObject();
+ if (selected_objectp)
+ {
LLFloaterReg::showInstance("task_properties");
- }
-
- /*
- // Old floater properties
- LLFloaterReg::showInstance("inspect", LLSD());
- */
+ }
+
+ /*
+ // Old floater properties
+ LLFloaterReg::showInstance("inspect", LLSD());
+ */
}
//---------------------------------------------------------------------------
@@ -3141,133 +3141,133 @@ void handle_object_inspect()
//---------------------------------------------------------------------------
class LLLandBuild : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerParcelMgr::getInstance()->deselectLand();
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLViewerParcelMgr::getInstance()->deselectLand();
- if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") )
- {
- // zoom in if we're looking at the avatar
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
- gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gAgentCamera.cameraZoomIn(0.666f);
- gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD );
- gViewerWindow->moveCursorToCenter();
- }
- else if ( gSavedSettings.getBOOL("EditCameraMovement") )
- {
- // otherwise just move focus
- gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gViewerWindow->moveCursorToCenter();
- }
+ if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") )
+ {
+ // zoom in if we're looking at the avatar
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+ gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
+ gAgentCamera.cameraZoomIn(0.666f);
+ gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD );
+ gViewerWindow->moveCursorToCenter();
+ }
+ else if ( gSavedSettings.getBOOL("EditCameraMovement") )
+ {
+ // otherwise just move focus
+ gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
+ gViewerWindow->moveCursorToCenter();
+ }
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
- // Could be first use
- //LLFirstUse::useBuild();
- return true;
- }
+ // Could be first use
+ //LLFirstUse::useBuild();
+ return true;
+ }
};
class LLLandBuyPass : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLPanelLandGeneral::onClickBuyPass((void *)FALSE);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLPanelLandGeneral::onClickBuyPass((void *)FALSE);
+ return true;
+ }
};
class LLLandEnableBuyPass : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLPanelLandGeneral::enableBuyPass(NULL);
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLPanelLandGeneral::enableBuyPass(NULL);
+ return new_value;
+ }
};
// BUG: Should really check if CLICK POINT is in a parcel where you can build.
BOOL enable_land_build(void*)
{
- if (gAgent.isGodlike()) return TRUE;
- if (gAgent.inPrelude()) return FALSE;
+ if (gAgent.isGodlike()) return TRUE;
+ if (gAgent.inPrelude()) return FALSE;
- BOOL can_build = FALSE;
- LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (agent_parcel)
- {
- can_build = agent_parcel->getAllowModify();
- }
- return can_build;
+ BOOL can_build = FALSE;
+ LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (agent_parcel)
+ {
+ can_build = agent_parcel->getAllowModify();
+ }
+ return can_build;
}
// BUG: Should really check if OBJECT is in a parcel where you can build.
BOOL enable_object_build(void*)
{
- if (gAgent.isGodlike()) return TRUE;
- if (gAgent.inPrelude()) return FALSE;
+ if (gAgent.isGodlike()) return TRUE;
+ if (gAgent.inPrelude()) return FALSE;
- BOOL can_build = FALSE;
- LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (agent_parcel)
- {
- can_build = agent_parcel->getAllowModify();
- }
- return can_build;
+ BOOL can_build = FALSE;
+ LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (agent_parcel)
+ {
+ can_build = agent_parcel->getAllowModify();
+ }
+ return can_build;
}
bool enable_object_edit()
{
- if (!isAgentAvatarValid()) return false;
-
- // *HACK: The new "prelude" Help Islands have a build sandbox area,
- // so users need the Edit and Create pie menu options when they are
- // there. Eventually this needs to be replaced with code that only
- // lets you edit objects if you have permission to do so (edit perms,
- // group edit, god). See also lltoolbar.cpp. JC
- bool enable = false;
- if (gAgent.inPrelude())
- {
- enable = LLViewerParcelMgr::getInstance()->allowAgentBuild()
- || LLSelectMgr::getInstance()->getSelection()->isAttachment();
- }
- else if (LLSelectMgr::getInstance()->selectGetAllValidAndObjectsFound())
- {
- enable = true;
- }
-
- return enable;
+ if (!isAgentAvatarValid()) return false;
+
+ // *HACK: The new "prelude" Help Islands have a build sandbox area,
+ // so users need the Edit and Create pie menu options when they are
+ // there. Eventually this needs to be replaced with code that only
+ // lets you edit objects if you have permission to do so (edit perms,
+ // group edit, god). See also lltoolbar.cpp. JC
+ bool enable = false;
+ if (gAgent.inPrelude())
+ {
+ enable = LLViewerParcelMgr::getInstance()->allowAgentBuild()
+ || LLSelectMgr::getInstance()->getSelection()->isAttachment();
+ }
+ else if (LLSelectMgr::getInstance()->selectGetAllValidAndObjectsFound())
+ {
+ enable = true;
+ }
+
+ return enable;
}
bool enable_mute_particle()
{
- const LLPickInfo& pick = LLToolPie::getInstance()->getPick();
+ const LLPickInfo& pick = LLToolPie::getInstance()->getPick();
- return pick.mParticleOwnerID != LLUUID::null && pick.mParticleOwnerID != gAgent.getID();
+ return pick.mParticleOwnerID != LLUUID::null && pick.mParticleOwnerID != gAgent.getID();
}
// mutually exclusive - show either edit option or build in menu
bool enable_object_build()
{
- return !enable_object_edit();
+ return !enable_object_edit();
}
bool enable_object_select_in_pathfinding_linksets()
{
- return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetEditableLinksets();
+ return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetEditableLinksets();
}
bool visible_object_select_in_pathfinding_linksets()
{
- return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion();
+ return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion();
}
bool enable_object_select_in_pathfinding_characters()
{
- return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetViewableCharacters();
+ return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetViewableCharacters();
}
bool enable_os_exception()
@@ -3281,40 +3281,40 @@ bool enable_os_exception()
class LLSelfRemoveAllAttachments : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLAppearanceMgr::instance().removeAllAttachmentsFromAvatar();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLAppearanceMgr::instance().removeAllAttachmentsFromAvatar();
+ return true;
+ }
};
class LLSelfEnableRemoveAllAttachments : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = false;
- if (isAgentAvatarValid())
- {
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); )
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- if (attachment->getNumObjects() > 0)
- {
- new_value = true;
- break;
- }
- }
- }
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = false;
+ if (isAgentAvatarValid())
+ {
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ if (attachment->getNumObjects() > 0)
+ {
+ new_value = true;
+ break;
+ }
+ }
+ }
+ return new_value;
+ }
};
BOOL enable_has_attachments(void*)
{
- return FALSE;
+ return FALSE;
}
//---------------------------------------------------------------------------
@@ -3322,229 +3322,229 @@ BOOL enable_has_attachments(void*)
//---------------------------------------------------------------------------
//void handle_follow(void *userdata)
//{
-// // follow a given avatar by ID
-// LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
-// if (objectp)
-// {
-// gAgent.startFollowPilot(objectp->getID());
-// }
+// // follow a given avatar by ID
+// LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+// if (objectp)
+// {
+// gAgent.startFollowPilot(objectp->getID());
+// }
//}
bool enable_object_mute()
{
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return false;
-
- LLVOAvatar* avatar = find_avatar_from_object(object);
- if (avatar)
- {
- // It's an avatar
- LLNameValue *lastname = avatar->getNVPair("LastName");
- bool is_linden =
- lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden");
- bool is_self = avatar->isSelf();
- return !is_linden && !is_self;
- }
- else
- {
- // Just a regular object
- return LLSelectMgr::getInstance()->getSelection()->contains( object, SELECT_ALL_TES ) &&
- !LLMuteList::getInstance()->isMuted(object->getID());
- }
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (!object) return false;
+
+ LLVOAvatar* avatar = find_avatar_from_object(object);
+ if (avatar)
+ {
+ // It's an avatar
+ LLNameValue *lastname = avatar->getNVPair("LastName");
+ bool is_linden =
+ lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden");
+ bool is_self = avatar->isSelf();
+ return !is_linden && !is_self;
+ }
+ else
+ {
+ // Just a regular object
+ return LLSelectMgr::getInstance()->getSelection()->contains( object, SELECT_ALL_TES ) &&
+ !LLMuteList::getInstance()->isMuted(object->getID());
+ }
}
bool enable_object_unmute()
{
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return false;
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (!object) return false;
- LLVOAvatar* avatar = find_avatar_from_object(object);
- if (avatar)
- {
- // It's an avatar
- LLNameValue *lastname = avatar->getNVPair("LastName");
- bool is_linden =
- lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden");
- bool is_self = avatar->isSelf();
- return !is_linden && !is_self;
- }
- else
- {
- // Just a regular object
- return LLSelectMgr::getInstance()->getSelection()->contains( object, SELECT_ALL_TES ) &&
- LLMuteList::getInstance()->isMuted(object->getID());;
- }
+ LLVOAvatar* avatar = find_avatar_from_object(object);
+ if (avatar)
+ {
+ // It's an avatar
+ LLNameValue *lastname = avatar->getNVPair("LastName");
+ bool is_linden =
+ lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden");
+ bool is_self = avatar->isSelf();
+ return !is_linden && !is_self;
+ }
+ else
+ {
+ // Just a regular object
+ return LLSelectMgr::getInstance()->getSelection()->contains( object, SELECT_ALL_TES ) &&
+ LLMuteList::getInstance()->isMuted(object->getID());;
+ }
}
// 0 = normal, 1 = always, 2 = never
class LLAvatarCheckImpostorMode : public view_listener_t
-{
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return false;
-
- LLVOAvatar* avatar = find_avatar_from_object(object);
- if (!avatar) return false;
-
- U32 mode = userdata.asInteger();
- switch (mode)
- {
- case 0:
- return (avatar->getVisualMuteSettings() == LLVOAvatar::AV_RENDER_NORMALLY);
- case 1:
- return (avatar->getVisualMuteSettings() == LLVOAvatar::AV_DO_NOT_RENDER);
- case 2:
- return (avatar->getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER);
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (!object) return false;
+
+ LLVOAvatar* avatar = find_avatar_from_object(object);
+ if (!avatar) return false;
+
+ U32 mode = userdata.asInteger();
+ switch (mode)
+ {
+ case 0:
+ return (avatar->getVisualMuteSettings() == LLVOAvatar::AV_RENDER_NORMALLY);
+ case 1:
+ return (avatar->getVisualMuteSettings() == LLVOAvatar::AV_DO_NOT_RENDER);
+ case 2:
+ return (avatar->getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER);
case 4:
return (avatar->getVisualMuteSettings() != LLVOAvatar::AV_RENDER_NORMALLY);
- default:
- return false;
- }
- } // handleEvent()
+ default:
+ return false;
+ }
+ } // handleEvent()
};
// 0 = normal, 1 = always, 2 = never
class LLAvatarSetImpostorMode : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return false;
-
- LLVOAvatar* avatar = find_avatar_from_object(object);
- if (!avatar) return false;
-
- U32 mode = userdata.asInteger();
- switch (mode)
- {
- case 0:
- avatar->setVisualMuteSettings(LLVOAvatar::AV_RENDER_NORMALLY);
- break;
- case 1:
- avatar->setVisualMuteSettings(LLVOAvatar::AV_DO_NOT_RENDER);
- break;
- case 2:
- avatar->setVisualMuteSettings(LLVOAvatar::AV_ALWAYS_RENDER);
- break;
- default:
- return false;
- }
-
- LLVOAvatar::cullAvatarsByPixelArea();
- return true;
- } // handleEvent()
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (!object) return false;
+
+ LLVOAvatar* avatar = find_avatar_from_object(object);
+ if (!avatar) return false;
+
+ U32 mode = userdata.asInteger();
+ switch (mode)
+ {
+ case 0:
+ avatar->setVisualMuteSettings(LLVOAvatar::AV_RENDER_NORMALLY);
+ break;
+ case 1:
+ avatar->setVisualMuteSettings(LLVOAvatar::AV_DO_NOT_RENDER);
+ break;
+ case 2:
+ avatar->setVisualMuteSettings(LLVOAvatar::AV_ALWAYS_RENDER);
+ break;
+ default:
+ return false;
+ }
+
+ LLVOAvatar::cullAvatarsByPixelArea();
+ return true;
+ } // handleEvent()
};
class LLObjectMute : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return true;
-
- LLUUID id;
- std::string name;
- LLMute::EType type;
- LLVOAvatar* avatar = find_avatar_from_object(object);
- if (avatar)
- {
- avatar->mNeedsImpostorUpdate = TRUE;
- avatar->mLastImpostorUpdateReason = 9;
-
- id = avatar->getID();
-
- LLNameValue *firstname = avatar->getNVPair("FirstName");
- LLNameValue *lastname = avatar->getNVPair("LastName");
- if (firstname && lastname)
- {
- name = LLCacheName::buildFullName(
- firstname->getString(), lastname->getString());
- }
-
- type = LLMute::AGENT;
- }
- else
- {
- // it's an object
- id = object->getID();
-
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (node)
- {
- name = node->mName;
- }
-
- type = LLMute::OBJECT;
- }
-
- LLMute mute(id, name, type);
- if (LLMuteList::getInstance()->isMuted(mute.mID))
- {
- LLMuteList::getInstance()->remove(mute);
- }
- else
- {
- LLMuteList::getInstance()->add(mute);
- LLPanelBlockedList::showPanelAndSelect(mute.mID);
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (!object) return true;
+
+ LLUUID id;
+ std::string name;
+ LLMute::EType type;
+ LLVOAvatar* avatar = find_avatar_from_object(object);
+ if (avatar)
+ {
+ avatar->mNeedsImpostorUpdate = TRUE;
+ avatar->mLastImpostorUpdateReason = 9;
+
+ id = avatar->getID();
+
+ LLNameValue *firstname = avatar->getNVPair("FirstName");
+ LLNameValue *lastname = avatar->getNVPair("LastName");
+ if (firstname && lastname)
+ {
+ name = LLCacheName::buildFullName(
+ firstname->getString(), lastname->getString());
+ }
+
+ type = LLMute::AGENT;
+ }
+ else
+ {
+ // it's an object
+ id = object->getID();
+
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if (node)
+ {
+ name = node->mName;
+ }
+
+ type = LLMute::OBJECT;
+ }
+
+ LLMute mute(id, name, type);
+ if (LLMuteList::getInstance()->isMuted(mute.mID))
+ {
+ LLMuteList::getInstance()->remove(mute);
+ }
+ else
+ {
+ LLMuteList::getInstance()->add(mute);
+ LLPanelBlockedList::showPanelAndSelect(mute.mID);
+ }
+
+ return true;
+ }
};
bool handle_go_to()
{
- // try simulator autopilot
- std::vector<std::string> strings;
- std::string val;
- LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal;
- val = llformat("%g", pos.mdV[VX]);
- strings.push_back(val);
- val = llformat("%g", pos.mdV[VY]);
- strings.push_back(val);
- val = llformat("%g", pos.mdV[VZ]);
- strings.push_back(val);
- send_generic_message("autopilot", strings);
-
- LLViewerParcelMgr::getInstance()->deselectLand();
-
- if (isAgentAvatarValid() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
- {
- gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatarp->getID());
- }
- else
- {
- // Snap camera back to behind avatar
- gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
- }
-
- // Could be first use
- //LLFirstUse::useGoTo();
- return true;
+ // try simulator autopilot
+ std::vector<std::string> strings;
+ std::string val;
+ LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal;
+ val = llformat("%g", pos.mdV[VX]);
+ strings.push_back(val);
+ val = llformat("%g", pos.mdV[VY]);
+ strings.push_back(val);
+ val = llformat("%g", pos.mdV[VZ]);
+ strings.push_back(val);
+ send_generic_message("autopilot", strings);
+
+ LLViewerParcelMgr::getInstance()->deselectLand();
+
+ if (isAgentAvatarValid() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
+ {
+ gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatarp->getID());
+ }
+ else
+ {
+ // Snap camera back to behind avatar
+ gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
+ }
+
+ // Could be first use
+ //LLFirstUse::useGoTo();
+ return true;
}
class LLGoToObject : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return handle_go_to();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return handle_go_to();
+ }
};
class LLAvatarReportAbuse : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if(avatar)
- {
- LLFloaterReporter::showFromObject(avatar->getID());
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+ if(avatar)
+ {
+ LLFloaterReporter::showFromObject(avatar->getID());
+ }
+ return true;
+ }
};
@@ -3553,230 +3553,230 @@ class LLAvatarReportAbuse : public view_listener_t
//---------------------------------------------------------------------------
bool callback_freeze(const LLSD& notification, const LLSD& response)
{
- LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- if (0 == option || 1 == option)
- {
- U32 flags = 0x0;
- if (1 == option)
- {
- // unfreeze
- flags |= 0x1;
- }
-
- LLMessageSystem* msg = gMessageSystem;
- LLViewerObject* avatar = gObjectList.findObject(avatar_id);
-
- if (avatar)
- {
- msg->newMessage("FreezeUser");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addUUID("TargetID", avatar_id );
- msg->addU32("Flags", flags );
- msg->sendReliable( avatar->getRegion()->getHost() );
- }
- }
- return false;
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ if (0 == option || 1 == option)
+ {
+ U32 flags = 0x0;
+ if (1 == option)
+ {
+ // unfreeze
+ flags |= 0x1;
+ }
+
+ LLMessageSystem* msg = gMessageSystem;
+ LLViewerObject* avatar = gObjectList.findObject(avatar_id);
+
+ if (avatar)
+ {
+ msg->newMessage("FreezeUser");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addUUID("TargetID", avatar_id );
+ msg->addU32("Flags", flags );
+ msg->sendReliable( avatar->getRegion()->getHost() );
+ }
+ }
+ return false;
}
void handle_avatar_freeze(const LLSD& avatar_id)
{
- // Use avatar_id if available, otherwise default to right-click avatar
- LLVOAvatar* avatar = NULL;
- if (avatar_id.asUUID().notNull())
- {
- avatar = find_avatar_from_object(avatar_id.asUUID());
- }
- else
- {
- avatar = find_avatar_from_object(
- LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- }
-
- if( avatar )
- {
- std::string fullname = avatar->getFullname();
- LLSD payload;
- payload["avatar_id"] = avatar->getID();
-
- if (!fullname.empty())
- {
- LLSD args;
- args["AVATAR_NAME"] = fullname;
- LLNotificationsUtil::add("FreezeAvatarFullname",
- args,
- payload,
- callback_freeze);
- }
- else
- {
- LLNotificationsUtil::add("FreezeAvatar",
- LLSD(),
- payload,
- callback_freeze);
- }
- }
+ // Use avatar_id if available, otherwise default to right-click avatar
+ LLVOAvatar* avatar = NULL;
+ if (avatar_id.asUUID().notNull())
+ {
+ avatar = find_avatar_from_object(avatar_id.asUUID());
+ }
+ else
+ {
+ avatar = find_avatar_from_object(
+ LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
+ }
+
+ if( avatar )
+ {
+ std::string fullname = avatar->getFullname();
+ LLSD payload;
+ payload["avatar_id"] = avatar->getID();
+
+ if (!fullname.empty())
+ {
+ LLSD args;
+ args["AVATAR_NAME"] = fullname;
+ LLNotificationsUtil::add("FreezeAvatarFullname",
+ args,
+ payload,
+ callback_freeze);
+ }
+ else
+ {
+ LLNotificationsUtil::add("FreezeAvatar",
+ LLSD(),
+ payload,
+ callback_freeze);
+ }
+ }
}
class LLAvatarVisibleDebug : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return gAgent.isGodlike();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return gAgent.isGodlike();
+ }
};
class LLAvatarDebug : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if( avatar )
- {
- if (avatar->isSelf())
- {
- ((LLVOAvatarSelf *)avatar)->dumpLocalTextures();
- }
- LL_INFOS() << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << LL_ENDL;
- std::vector<std::string> strings;
- strings.push_back(avatar->getID().asString());
- LLUUID invoice;
- send_generic_message("dumptempassetdata", strings, invoice);
- LLFloaterReg::showInstance( "avatar_textures", LLSD(avatar->getID()) );
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+ if( avatar )
+ {
+ if (avatar->isSelf())
+ {
+ ((LLVOAvatarSelf *)avatar)->dumpLocalTextures();
+ }
+ LL_INFOS() << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << LL_ENDL;
+ std::vector<std::string> strings;
+ strings.push_back(avatar->getID().asString());
+ LLUUID invoice;
+ send_generic_message("dumptempassetdata", strings, invoice);
+ LLFloaterReg::showInstance( "avatar_textures", LLSD(avatar->getID()) );
+ }
+ return true;
+ }
};
bool callback_eject(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (2 == option)
- {
- // Cancel button.
- return false;
- }
- LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
- bool ban_enabled = notification["payload"]["ban_enabled"].asBoolean();
-
- if (0 == option)
- {
- // Eject button
- LLMessageSystem* msg = gMessageSystem;
- LLViewerObject* avatar = gObjectList.findObject(avatar_id);
-
- if (avatar)
- {
- U32 flags = 0x0;
- msg->newMessage("EjectUser");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID() );
- msg->nextBlock("Data");
- msg->addUUID("TargetID", avatar_id );
- msg->addU32("Flags", flags );
- msg->sendReliable( avatar->getRegion()->getHost() );
- }
- }
- else if (ban_enabled)
- {
- // This is tricky. It is similar to say if it is not an 'Eject' button,
- // and it is also not an 'Cancle' button, and ban_enabled==ture,
- // it should be the 'Eject and Ban' button.
- LLMessageSystem* msg = gMessageSystem;
- LLViewerObject* avatar = gObjectList.findObject(avatar_id);
-
- if (avatar)
- {
- U32 flags = 0x1;
- msg->newMessage("EjectUser");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID() );
- msg->nextBlock("Data");
- msg->addUUID("TargetID", avatar_id );
- msg->addU32("Flags", flags );
- msg->sendReliable( avatar->getRegion()->getHost() );
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (2 == option)
+ {
+ // Cancel button.
+ return false;
+ }
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ bool ban_enabled = notification["payload"]["ban_enabled"].asBoolean();
+
+ if (0 == option)
+ {
+ // Eject button
+ LLMessageSystem* msg = gMessageSystem;
+ LLViewerObject* avatar = gObjectList.findObject(avatar_id);
+
+ if (avatar)
+ {
+ U32 flags = 0x0;
+ msg->newMessage("EjectUser");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID() );
+ msg->nextBlock("Data");
+ msg->addUUID("TargetID", avatar_id );
+ msg->addU32("Flags", flags );
+ msg->sendReliable( avatar->getRegion()->getHost() );
+ }
+ }
+ else if (ban_enabled)
+ {
+ // This is tricky. It is similar to say if it is not an 'Eject' button,
+ // and it is also not an 'Cancle' button, and ban_enabled==ture,
+ // it should be the 'Eject and Ban' button.
+ LLMessageSystem* msg = gMessageSystem;
+ LLViewerObject* avatar = gObjectList.findObject(avatar_id);
+
+ if (avatar)
+ {
+ U32 flags = 0x1;
+ msg->newMessage("EjectUser");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID() );
+ msg->nextBlock("Data");
+ msg->addUUID("TargetID", avatar_id );
+ msg->addU32("Flags", flags );
+ msg->sendReliable( avatar->getRegion()->getHost() );
+ }
+ }
+ return false;
}
void handle_avatar_eject(const LLSD& avatar_id)
{
- // Use avatar_id if available, otherwise default to right-click avatar
- LLVOAvatar* avatar = NULL;
- if (avatar_id.asUUID().notNull())
- {
- avatar = find_avatar_from_object(avatar_id.asUUID());
- }
- else
- {
- avatar = find_avatar_from_object(
- LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- }
-
- if( avatar )
- {
- LLSD payload;
- payload["avatar_id"] = avatar->getID();
- std::string fullname = avatar->getFullname();
-
- const LLVector3d& pos = avatar->getPositionGlobal();
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel();
-
- if (LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED))
- {
+ // Use avatar_id if available, otherwise default to right-click avatar
+ LLVOAvatar* avatar = NULL;
+ if (avatar_id.asUUID().notNull())
+ {
+ avatar = find_avatar_from_object(avatar_id.asUUID());
+ }
+ else
+ {
+ avatar = find_avatar_from_object(
+ LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
+ }
+
+ if( avatar )
+ {
+ LLSD payload;
+ payload["avatar_id"] = avatar->getID();
+ std::string fullname = avatar->getFullname();
+
+ const LLVector3d& pos = avatar->getPositionGlobal();
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel();
+
+ if (LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED))
+ {
payload["ban_enabled"] = true;
- if (!fullname.empty())
- {
- LLSD args;
- args["AVATAR_NAME"] = fullname;
- LLNotificationsUtil::add("EjectAvatarFullname",
- args,
- payload,
- callback_eject);
- }
- else
- {
- LLNotificationsUtil::add("EjectAvatarFullname",
- LLSD(),
- payload,
- callback_eject);
- }
- }
- else
- {
+ if (!fullname.empty())
+ {
+ LLSD args;
+ args["AVATAR_NAME"] = fullname;
+ LLNotificationsUtil::add("EjectAvatarFullname",
+ args,
+ payload,
+ callback_eject);
+ }
+ else
+ {
+ LLNotificationsUtil::add("EjectAvatarFullname",
+ LLSD(),
+ payload,
+ callback_eject);
+ }
+ }
+ else
+ {
payload["ban_enabled"] = false;
- if (!fullname.empty())
- {
- LLSD args;
- args["AVATAR_NAME"] = fullname;
- LLNotificationsUtil::add("EjectAvatarFullnameNoBan",
- args,
- payload,
- callback_eject);
- }
- else
- {
- LLNotificationsUtil::add("EjectAvatarNoBan",
- LLSD(),
- payload,
- callback_eject);
- }
- }
- }
+ if (!fullname.empty())
+ {
+ LLSD args;
+ args["AVATAR_NAME"] = fullname;
+ LLNotificationsUtil::add("EjectAvatarFullnameNoBan",
+ args,
+ payload,
+ callback_eject);
+ }
+ else
+ {
+ LLNotificationsUtil::add("EjectAvatarNoBan",
+ LLSD(),
+ payload,
+ callback_eject);
+ }
+ }
+ }
}
bool my_profile_visible()
{
- LLFloater* floaterp = LLAvatarActions::getProfileFloater(gAgentID);
- return floaterp && floaterp->isInVisibleChain();
+ LLFloater* floaterp = LLAvatarActions::getProfileFloater(gAgentID);
+ return floaterp && floaterp->isInVisibleChain();
}
bool picks_tab_visible()
@@ -3786,192 +3786,192 @@ bool picks_tab_visible()
bool enable_freeze_eject(const LLSD& avatar_id)
{
- // Use avatar_id if available, otherwise default to right-click avatar
- LLVOAvatar* avatar = NULL;
- if (avatar_id.asUUID().notNull())
- {
- avatar = find_avatar_from_object(avatar_id.asUUID());
- }
- else
- {
- avatar = find_avatar_from_object(
- LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- }
- if (!avatar) return false;
-
- // Gods can always freeze
- if (gAgent.isGodlike()) return true;
-
- // Estate owners / managers can freeze
- // Parcel owners can also freeze
- const LLVector3& pos = avatar->getPositionRegion();
- const LLVector3d& pos_global = avatar->getPositionGlobal();
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel();
- LLViewerRegion* region = avatar->getRegion();
- if (!region) return false;
-
- bool new_value = region->isOwnedSelf(pos);
- if (!new_value || region->isOwnedGroup(pos))
- {
- new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN);
- }
- return new_value;
+ // Use avatar_id if available, otherwise default to right-click avatar
+ LLVOAvatar* avatar = NULL;
+ if (avatar_id.asUUID().notNull())
+ {
+ avatar = find_avatar_from_object(avatar_id.asUUID());
+ }
+ else
+ {
+ avatar = find_avatar_from_object(
+ LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
+ }
+ if (!avatar) return false;
+
+ // Gods can always freeze
+ if (gAgent.isGodlike()) return true;
+
+ // Estate owners / managers can freeze
+ // Parcel owners can also freeze
+ const LLVector3& pos = avatar->getPositionRegion();
+ const LLVector3d& pos_global = avatar->getPositionGlobal();
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel();
+ LLViewerRegion* region = avatar->getRegion();
+ if (!region) return false;
+
+ bool new_value = region->isOwnedSelf(pos);
+ if (!new_value || region->isOwnedGroup(pos))
+ {
+ new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN);
+ }
+ return new_value;
}
bool callback_leave_group(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- LLMessageSystem *msg = gMessageSystem;
-
- msg->newMessageFast(_PREHASH_LeaveGroupRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_GroupData);
- msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID() );
- gAgent.sendReliableMessage();
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ LLMessageSystem *msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_LeaveGroupRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_GroupData);
+ msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID() );
+ gAgent.sendReliableMessage();
+ }
+ return false;
}
void append_aggregate(std::string& string, const LLAggregatePermissions& ag_perm, PermissionBit bit, const char* txt)
{
- LLAggregatePermissions::EValue val = ag_perm.getValue(bit);
- std::string buffer;
- switch(val)
- {
- case LLAggregatePermissions::AP_NONE:
- buffer = llformat( "* %s None\n", txt);
- break;
- case LLAggregatePermissions::AP_SOME:
- buffer = llformat( "* %s Some\n", txt);
- break;
- case LLAggregatePermissions::AP_ALL:
- buffer = llformat( "* %s All\n", txt);
- break;
- case LLAggregatePermissions::AP_EMPTY:
- default:
- break;
- }
- string.append(buffer);
+ LLAggregatePermissions::EValue val = ag_perm.getValue(bit);
+ std::string buffer;
+ switch(val)
+ {
+ case LLAggregatePermissions::AP_NONE:
+ buffer = llformat( "* %s None\n", txt);
+ break;
+ case LLAggregatePermissions::AP_SOME:
+ buffer = llformat( "* %s Some\n", txt);
+ break;
+ case LLAggregatePermissions::AP_ALL:
+ buffer = llformat( "* %s All\n", txt);
+ break;
+ case LLAggregatePermissions::AP_EMPTY:
+ default:
+ break;
+ }
+ string.append(buffer);
}
bool enable_buy_object()
{
// In order to buy, there must only be 1 purchaseable object in
// the selection manager.
- if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != 1) return false;
+ if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != 1) return false;
LLViewerObject* obj = NULL;
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if(node)
+ if(node)
{
obj = node->getObject();
if(!obj) return false;
- if( for_sale_selection(node) )
- {
- // *NOTE: Is this needed? This checks to see if anyone owns the
- // object, dating back to when we had "public" objects owned by
- // no one. JC
- if(obj->permAnyOwner()) return true;
- }
+ if( for_sale_selection(node) )
+ {
+ // *NOTE: Is this needed? This checks to see if anyone owns the
+ // object, dating back to when we had "public" objects owned by
+ // no one. JC
+ if(obj->permAnyOwner()) return true;
+ }
}
- return false;
+ return false;
}
// Note: This will only work if the selected object's data has been
// received by the viewer and cached in the selection manager.
void handle_buy_object(LLSaleInfo sale_info)
{
- if(!LLSelectMgr::getInstance()->selectGetAllRootsValid())
- {
- LLNotificationsUtil::add("UnableToBuyWhileDownloading");
- return;
- }
+ if(!LLSelectMgr::getInstance()->selectGetAllRootsValid())
+ {
+ LLNotificationsUtil::add("UnableToBuyWhileDownloading");
+ return;
+ }
- LLUUID owner_id;
- std::string owner_name;
- BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
- if (!owners_identical)
- {
- LLNotificationsUtil::add("CannotBuyObjectsFromDifferentOwners");
- return;
- }
+ LLUUID owner_id;
+ std::string owner_name;
+ BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
+ if (!owners_identical)
+ {
+ LLNotificationsUtil::add("CannotBuyObjectsFromDifferentOwners");
+ return;
+ }
- LLPermissions perm;
- BOOL valid = LLSelectMgr::getInstance()->selectGetPermissions(perm);
- LLAggregatePermissions ag_perm;
- valid &= LLSelectMgr::getInstance()->selectGetAggregatePermissions(ag_perm);
- if(!valid || !sale_info.isForSale() || !perm.allowTransferTo(gAgent.getID()))
- {
- LLNotificationsUtil::add("ObjectNotForSale");
- return;
- }
+ LLPermissions perm;
+ BOOL valid = LLSelectMgr::getInstance()->selectGetPermissions(perm);
+ LLAggregatePermissions ag_perm;
+ valid &= LLSelectMgr::getInstance()->selectGetAggregatePermissions(ag_perm);
+ if(!valid || !sale_info.isForSale() || !perm.allowTransferTo(gAgent.getID()))
+ {
+ LLNotificationsUtil::add("ObjectNotForSale");
+ return;
+ }
- LLFloaterBuy::show(sale_info);
+ LLFloaterBuy::show(sale_info);
}
void handle_buy_contents(LLSaleInfo sale_info)
{
- LLFloaterBuyContents::show(sale_info);
+ LLFloaterBuyContents::show(sale_info);
}
void handle_region_dump_temp_asset_data(void*)
{
- LL_INFOS() << "Dumping temporary asset data to simulator logs" << LL_ENDL;
- std::vector<std::string> strings;
- LLUUID invoice;
- send_generic_message("dumptempassetdata", strings, invoice);
+ LL_INFOS() << "Dumping temporary asset data to simulator logs" << LL_ENDL;
+ std::vector<std::string> strings;
+ LLUUID invoice;
+ send_generic_message("dumptempassetdata", strings, invoice);
}
void handle_region_clear_temp_asset_data(void*)
{
- LL_INFOS() << "Clearing temporary asset data" << LL_ENDL;
- std::vector<std::string> strings;
- LLUUID invoice;
- send_generic_message("cleartempassetdata", strings, invoice);
+ LL_INFOS() << "Clearing temporary asset data" << LL_ENDL;
+ std::vector<std::string> strings;
+ LLUUID invoice;
+ send_generic_message("cleartempassetdata", strings, invoice);
}
void handle_region_dump_settings(void*)
{
- LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- LL_INFOS() << "Damage: " << (regionp->getAllowDamage() ? "on" : "off") << LL_ENDL;
- LL_INFOS() << "Landmark: " << (regionp->getAllowLandmark() ? "on" : "off") << LL_ENDL;
- LL_INFOS() << "SetHome: " << (regionp->getAllowSetHome() ? "on" : "off") << LL_ENDL;
- LL_INFOS() << "ResetHome: " << (regionp->getResetHomeOnTeleport() ? "on" : "off") << LL_ENDL;
- LL_INFOS() << "SunFixed: " << (regionp->getSunFixed() ? "on" : "off") << LL_ENDL;
- LL_INFOS() << "BlockFly: " << (regionp->getBlockFly() ? "on" : "off") << LL_ENDL;
- LL_INFOS() << "AllowP2P: " << (regionp->getAllowDirectTeleport() ? "on" : "off") << LL_ENDL;
- LL_INFOS() << "Water: " << (regionp->getWaterHeight()) << LL_ENDL;
- }
+ LLViewerRegion* regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ LL_INFOS() << "Damage: " << (regionp->getAllowDamage() ? "on" : "off") << LL_ENDL;
+ LL_INFOS() << "Landmark: " << (regionp->getAllowLandmark() ? "on" : "off") << LL_ENDL;
+ LL_INFOS() << "SetHome: " << (regionp->getAllowSetHome() ? "on" : "off") << LL_ENDL;
+ LL_INFOS() << "ResetHome: " << (regionp->getResetHomeOnTeleport() ? "on" : "off") << LL_ENDL;
+ LL_INFOS() << "SunFixed: " << (regionp->getSunFixed() ? "on" : "off") << LL_ENDL;
+ LL_INFOS() << "BlockFly: " << (regionp->getBlockFly() ? "on" : "off") << LL_ENDL;
+ LL_INFOS() << "AllowP2P: " << (regionp->getAllowDirectTeleport() ? "on" : "off") << LL_ENDL;
+ LL_INFOS() << "Water: " << (regionp->getWaterHeight()) << LL_ENDL;
+ }
}
void handle_dump_group_info(void *)
{
- gAgent.dumpGroupInfo();
+ gAgent.dumpGroupInfo();
}
void handle_dump_capabilities_info(void *)
{
- LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- regionp->logActiveCapabilities();
- }
+ LLViewerRegion* regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ regionp->logActiveCapabilities();
+ }
}
void handle_dump_region_object_cache(void*)
{
- LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- regionp->dumpCache();
- }
+ LLViewerRegion* regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ regionp->dumpCache();
+ }
}
void handle_reset_interest_lists(void *)
@@ -3992,18 +3992,18 @@ void handle_reset_interest_lists(void *)
void handle_dump_focus()
{
- LLUICtrl *ctrl = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
+ LLUICtrl *ctrl = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- LL_INFOS() << "Keyboard focus " << (ctrl ? ctrl->getName() : "(none)") << LL_ENDL;
+ LL_INFOS() << "Keyboard focus " << (ctrl ? ctrl->getName() : "(none)") << LL_ENDL;
}
class LLSelfStandUp : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gAgent.standUp();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gAgent.standUp();
+ return true;
+ }
};
bool enable_standup_self()
@@ -4024,202 +4024,202 @@ class LLSelfSitDown : public view_listener_t
bool show_sitdown_self()
{
- return isAgentAvatarValid() && !gAgentAvatarp->isSitting();
+ return isAgentAvatarValid() && !gAgentAvatarp->isSitting();
}
bool enable_sitdown_self()
{
- return show_sitdown_self() && !gAgentAvatarp->isEditingAppearance() && !gAgent.getFlying();
+ return show_sitdown_self() && !gAgentAvatarp->isEditingAppearance() && !gAgent.getFlying();
}
class LLSelfToggleSitStand : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (isAgentAvatarValid())
- {
- if (gAgentAvatarp->isSitting())
- {
- gAgent.standUp();
- }
- else
- {
- gAgent.sitDown();
- }
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (isAgentAvatarValid())
+ {
+ if (gAgentAvatarp->isSitting())
+ {
+ gAgent.standUp();
+ }
+ else
+ {
+ gAgent.sitDown();
+ }
+ }
+ return true;
+ }
};
bool enable_sit_stand()
{
- return enable_sitdown_self() || enable_standup_self();
+ return enable_sitdown_self() || enable_standup_self();
}
bool enable_fly_land()
{
- return gAgent.getFlying() || LLAgent::enableFlying();
+ return gAgent.getFlying() || LLAgent::enableFlying();
}
class LLCheckPanelPeopleTab : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string panel_name = userdata.asString();
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string panel_name = userdata.asString();
- LLPanel *panel = LLFloaterSidePanelContainer::getPanel("people", panel_name);
- if(panel && panel->isInVisibleChain())
- {
- return true;
- }
- return false;
- }
+ LLPanel *panel = LLFloaterSidePanelContainer::getPanel("people", panel_name);
+ if(panel && panel->isInVisibleChain())
+ {
+ return true;
+ }
+ return false;
+ }
};
// Toggle one of "People" panel tabs in side tray.
class LLTogglePanelPeopleTab : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string panel_name = userdata.asString();
-
- LLSD param;
- param["people_panel_tab_name"] = panel_name;
-
- if ( panel_name == "friends_panel"
- || panel_name == "groups_panel"
- || panel_name == "nearby_panel"
- || panel_name == "blocked_panel")
- {
- return togglePeoplePanel(panel_name, param);
- }
- else
- {
- return false;
- }
- }
-
- static bool togglePeoplePanel(const std::string& panel_name, const LLSD& param)
- {
- LLPanel *panel = LLFloaterSidePanelContainer::getPanel("people", panel_name);
- if(!panel)
- return false;
-
- if (panel->isInVisibleChain())
- {
- LLFloaterReg::hideInstance("people");
- }
- else
- {
- LLFloaterSidePanelContainer::showPanel("people", "panel_people", param) ;
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string panel_name = userdata.asString();
+
+ LLSD param;
+ param["people_panel_tab_name"] = panel_name;
+
+ if ( panel_name == "friends_panel"
+ || panel_name == "groups_panel"
+ || panel_name == "nearby_panel"
+ || panel_name == "blocked_panel")
+ {
+ return togglePeoplePanel(panel_name, param);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ static bool togglePeoplePanel(const std::string& panel_name, const LLSD& param)
+ {
+ LLPanel *panel = LLFloaterSidePanelContainer::getPanel("people", panel_name);
+ if(!panel)
+ return false;
+
+ if (panel->isInVisibleChain())
+ {
+ LLFloaterReg::hideInstance("people");
+ }
+ else
+ {
+ LLFloaterSidePanelContainer::showPanel("people", "panel_people", param) ;
+ }
+
+ return true;
+ }
};
BOOL check_admin_override(void*)
{
- return gAgent.getAdminOverride();
+ return gAgent.getAdminOverride();
}
void handle_admin_override_toggle(void*)
{
- gAgent.setAdminOverride(!gAgent.getAdminOverride());
+ gAgent.setAdminOverride(!gAgent.getAdminOverride());
- // The above may have affected which debug menus are visible
- show_debug_menus();
+ // The above may have affected which debug menus are visible
+ show_debug_menus();
}
void handle_visual_leak_detector_toggle(void*)
{
- static bool vld_enabled = false;
+ static bool vld_enabled = false;
- if ( vld_enabled )
- {
+ if ( vld_enabled )
+ {
#ifdef INCLUDE_VLD
- // only works for debug builds (hard coded into vld.h)
+ // only works for debug builds (hard coded into vld.h)
#ifdef _DEBUG
- // start with Visual Leak Detector turned off
- VLDDisable();
+ // start with Visual Leak Detector turned off
+ VLDDisable();
#endif // _DEBUG
#endif // INCLUDE_VLD
- vld_enabled = false;
- }
- else
- {
+ vld_enabled = false;
+ }
+ else
+ {
#ifdef INCLUDE_VLD
- // only works for debug builds (hard coded into vld.h)
- #ifdef _DEBUG
- // start with Visual Leak Detector turned off
- VLDEnable();
- #endif // _DEBUG
+ // only works for debug builds (hard coded into vld.h)
+ #ifdef _DEBUG
+ // start with Visual Leak Detector turned off
+ VLDEnable();
+ #endif // _DEBUG
#endif // INCLUDE_VLD
- vld_enabled = true;
- };
+ vld_enabled = true;
+ };
}
void handle_god_mode(void*)
{
- gAgent.requestEnterGodMode();
+ gAgent.requestEnterGodMode();
}
void handle_leave_god_mode(void*)
{
- gAgent.requestLeaveGodMode();
+ gAgent.requestLeaveGodMode();
}
void set_god_level(U8 god_level)
{
- U8 old_god_level = gAgent.getGodLevel();
- gAgent.setGodLevel( god_level );
- LLViewerParcelMgr::getInstance()->notifyObservers();
+ U8 old_god_level = gAgent.getGodLevel();
+ gAgent.setGodLevel( god_level );
+ LLViewerParcelMgr::getInstance()->notifyObservers();
- // God mode changes region visibility
- LLWorldMap::getInstance()->reloadItems(true);
+ // God mode changes region visibility
+ LLWorldMap::getInstance()->reloadItems(true);
- // inventory in items may change in god mode
- gObjectList.dirtyAllObjectInventory();
+ // inventory in items may change in god mode
+ gObjectList.dirtyAllObjectInventory();
if(gViewerWindow)
{
gViewerWindow->setMenuBackgroundColor(god_level > GOD_NOT,
LLGridManager::getInstance()->isInProductionGrid());
}
-
+
LLSD args;
- if(god_level > GOD_NOT)
- {
- args["LEVEL"] = llformat("%d",(S32)god_level);
- LLNotificationsUtil::add("EnteringGodMode", args);
- }
- else
- {
- args["LEVEL"] = llformat("%d",(S32)old_god_level);
- LLNotificationsUtil::add("LeavingGodMode", args);
- }
-
- // changing god-level can affect which menus we see
- show_debug_menus();
-
- // changing god-level can invalidate search results
- LLFloaterSearch *search = dynamic_cast<LLFloaterSearch*>(LLFloaterReg::getInstance("search"));
- if (search)
- {
- search->godLevelChanged(god_level);
- }
+ if(god_level > GOD_NOT)
+ {
+ args["LEVEL"] = llformat("%d",(S32)god_level);
+ LLNotificationsUtil::add("EnteringGodMode", args);
+ }
+ else
+ {
+ args["LEVEL"] = llformat("%d",(S32)old_god_level);
+ LLNotificationsUtil::add("LeavingGodMode", args);
+ }
+
+ // changing god-level can affect which menus we see
+ show_debug_menus();
+
+ // changing god-level can invalidate search results
+ LLFloaterSearch *search = dynamic_cast<LLFloaterSearch*>(LLFloaterReg::getInstance("search"));
+ if (search)
+ {
+ search->godLevelChanged(god_level);
+ }
}
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
void handle_toggle_hacked_godmode(void*)
{
- gHackGodmode = !gHackGodmode;
- set_god_level(gHackGodmode ? GOD_MAINTENANCE : GOD_NOT);
+ gHackGodmode = !gHackGodmode;
+ set_god_level(gHackGodmode ? GOD_MAINTENANCE : GOD_NOT);
}
BOOL check_toggle_hacked_godmode(void*)
{
- return gHackGodmode;
+ return gHackGodmode;
}
bool enable_toggle_hacked_godmode(void*)
@@ -4230,174 +4230,174 @@ bool enable_toggle_hacked_godmode(void*)
void process_grant_godlike_powers(LLMessageSystem* msg, void**)
{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- LLUUID session_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
- if((agent_id == gAgent.getID()) && (session_id == gAgent.getSessionID()))
- {
- U8 god_level;
- msg->getU8Fast(_PREHASH_GrantData, _PREHASH_GodLevel, god_level);
- set_god_level(god_level);
- }
- else
- {
- LL_WARNS() << "Grant godlike for wrong agent " << agent_id << LL_ENDL;
- }
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ LLUUID session_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
+ if((agent_id == gAgent.getID()) && (session_id == gAgent.getSessionID()))
+ {
+ U8 god_level;
+ msg->getU8Fast(_PREHASH_GrantData, _PREHASH_GodLevel, god_level);
+ set_god_level(god_level);
+ }
+ else
+ {
+ LL_WARNS() << "Grant godlike for wrong agent " << agent_id << LL_ENDL;
+ }
}
/*
class LLHaveCallingcard : public LLInventoryCollectFunctor
{
public:
- LLHaveCallingcard(const LLUUID& agent_id);
- virtual ~LLHaveCallingcard() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
- BOOL isThere() const { return mIsThere;}
+ LLHaveCallingcard(const LLUUID& agent_id);
+ virtual ~LLHaveCallingcard() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
+ BOOL isThere() const { return mIsThere;}
protected:
- LLUUID mID;
- BOOL mIsThere;
+ LLUUID mID;
+ BOOL mIsThere;
};
LLHaveCallingcard::LLHaveCallingcard(const LLUUID& agent_id) :
- mID(agent_id),
- mIsThere(FALSE)
+ mID(agent_id),
+ mIsThere(FALSE)
{
}
bool LLHaveCallingcard::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
-{
- if(item)
- {
- if((item->getType() == LLAssetType::AT_CALLINGCARD)
- && (item->getCreatorUUID() == mID))
- {
- mIsThere = TRUE;
- }
- }
- return FALSE;
+ LLInventoryItem* item)
+{
+ if(item)
+ {
+ if((item->getType() == LLAssetType::AT_CALLINGCARD)
+ && (item->getCreatorUUID() == mID))
+ {
+ mIsThere = TRUE;
+ }
+ }
+ return FALSE;
}
*/
BOOL is_agent_mappable(const LLUUID& agent_id)
{
- const LLRelationship* buddy_info = NULL;
- bool is_friend = LLAvatarActions::isFriend(agent_id);
+ const LLRelationship* buddy_info = NULL;
+ bool is_friend = LLAvatarActions::isFriend(agent_id);
- if (is_friend)
- buddy_info = LLAvatarTracker::instance().getBuddyInfo(agent_id);
+ if (is_friend)
+ buddy_info = LLAvatarTracker::instance().getBuddyInfo(agent_id);
- return (buddy_info &&
- buddy_info->isOnline() &&
- buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)
- );
+ return (buddy_info &&
+ buddy_info->isOnline() &&
+ buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)
+ );
}
// Enable a menu item when you don't have someone's card.
class LLAvatarEnableAddFriend : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- bool new_value = avatar && !LLAvatarActions::isFriend(avatar->getID());
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
+ bool new_value = avatar && !LLAvatarActions::isFriend(avatar->getID());
+ return new_value;
+ }
};
void request_friendship(const LLUUID& dest_id)
{
- LLViewerObject* dest = gObjectList.findObject(dest_id);
- if(dest && dest->isAvatar())
- {
- std::string full_name;
- LLNameValue* nvfirst = dest->getNVPair("FirstName");
- LLNameValue* nvlast = dest->getNVPair("LastName");
- if(nvfirst && nvlast)
- {
- full_name = LLCacheName::buildFullName(
- nvfirst->getString(), nvlast->getString());
- }
- if (!full_name.empty())
- {
- LLAvatarActions::requestFriendshipDialog(dest_id, full_name);
- }
- else
- {
- LLNotificationsUtil::add("CantOfferFriendship");
- }
- }
+ LLViewerObject* dest = gObjectList.findObject(dest_id);
+ if(dest && dest->isAvatar())
+ {
+ std::string full_name;
+ LLNameValue* nvfirst = dest->getNVPair("FirstName");
+ LLNameValue* nvlast = dest->getNVPair("LastName");
+ if(nvfirst && nvlast)
+ {
+ full_name = LLCacheName::buildFullName(
+ nvfirst->getString(), nvlast->getString());
+ }
+ if (!full_name.empty())
+ {
+ LLAvatarActions::requestFriendshipDialog(dest_id, full_name);
+ }
+ else
+ {
+ LLNotificationsUtil::add("CantOfferFriendship");
+ }
+ }
}
class LLEditEnableCustomizeAvatar : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gAgentWearables.areWearablesLoaded();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gAgentWearables.areWearablesLoaded();
+ return new_value;
+ }
};
class LLEnableEditShape : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return gAgentWearables.isWearableModifiable(LLWearableType::WT_SHAPE, 0);
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return gAgentWearables.isWearableModifiable(LLWearableType::WT_SHAPE, 0);
+ }
};
class LLEnableHoverHeight : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled();
+ }
};
class LLEnableEditPhysics : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- //return gAgentWearables.isWearableModifiable(LLWearableType::WT_SHAPE, 0);
- return TRUE;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ //return gAgentWearables.isWearableModifiable(LLWearableType::WT_SHAPE, 0);
+ return TRUE;
+ }
};
bool is_object_sittable()
{
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (object && object->getPCode() == LL_PCODE_VOLUME)
- {
- return true;
- }
- else
- {
- return false;
- }
+ if (object && object->getPCode() == LL_PCODE_VOLUME)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
// only works on pie menu
void handle_object_sit(LLViewerObject *object, const LLVector3 &offset)
{
- // get object selection offset
+ // get object selection offset
- if (object && object->getPCode() == LL_PCODE_VOLUME)
- {
+ if (object && object->getPCode() == LL_PCODE_VOLUME)
+ {
- gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_TargetObject);
- gMessageSystem->addUUIDFast(_PREHASH_TargetID, object->mID);
- gMessageSystem->addVector3Fast(_PREHASH_Offset, offset);
+ gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_TargetObject);
+ gMessageSystem->addUUIDFast(_PREHASH_TargetID, object->mID);
+ gMessageSystem->addVector3Fast(_PREHASH_Offset, offset);
- object->getRegion()->sendReliableMessage();
- }
+ object->getRegion()->sendReliableMessage();
+ }
}
void handle_object_sit_or_stand()
@@ -4432,12 +4432,12 @@ void handle_object_sit(const LLUUID& object_id)
void near_sit_down_point(BOOL success, void *)
{
- if (success)
- {
- gAgent.setFlying(FALSE);
- gAgent.clearControlFlags(AGENT_CONTROL_STAND_UP); // might have been set by autopilot
- gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
- }
+ if (success)
+ {
+ gAgent.setFlying(FALSE);
+ gAgent.clearControlFlags(AGENT_CONTROL_STAND_UP); // might have been set by autopilot
+ gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
+ }
}
class LLLandSit : public view_listener_t
@@ -4484,120 +4484,120 @@ void reset_view_final( BOOL proceed );
void handle_reset_view()
{
- if (gAgentCamera.cameraCustomizeAvatar())
- {
- // switching to outfit selector should automagically save any currently edited wearable
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits"));
- }
- gAgentCamera.setFocusOnAvatar(TRUE, FALSE, FALSE);
- reset_view_final( TRUE );
- LLFloaterCamera::resetCameraMode();
+ if (gAgentCamera.cameraCustomizeAvatar())
+ {
+ // switching to outfit selector should automagically save any currently edited wearable
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits"));
+ }
+ gAgentCamera.setFocusOnAvatar(TRUE, FALSE, FALSE);
+ reset_view_final( TRUE );
+ LLFloaterCamera::resetCameraMode();
}
class LLViewResetView : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- handle_reset_view();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ handle_reset_view();
+ return true;
+ }
};
// Note: extra parameters allow this function to be called from dialog.
-void reset_view_final( BOOL proceed )
+void reset_view_final( BOOL proceed )
{
- if( !proceed )
- {
- return;
- }
+ if( !proceed )
+ {
+ return;
+ }
- gAgentCamera.resetView(TRUE, TRUE);
- gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
+ gAgentCamera.resetView(TRUE, TRUE);
+ gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
}
class LLViewLookAtLastChatter : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gAgentCamera.lookAtLastChat();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gAgentCamera.lookAtLastChat();
+ return true;
+ }
};
class LLViewMouselook : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (!gAgentCamera.cameraMouselook())
- {
- gAgentCamera.changeCameraToMouselook();
- }
- else
- {
- gAgentCamera.changeCameraToDefault();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (!gAgentCamera.cameraMouselook())
+ {
+ gAgentCamera.changeCameraToMouselook();
+ }
+ else
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+ return true;
+ }
};
class LLViewDefaultUISize : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gSavedSettings.setF32("UIScaleFactor", 1.0f);
- gSavedSettings.setBOOL("UIAutoScale", FALSE);
- gViewerWindow->reshape(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gSavedSettings.setF32("UIScaleFactor", 1.0f);
+ gSavedSettings.setBOOL("UIAutoScale", FALSE);
+ gViewerWindow->reshape(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
+ return true;
+ }
};
class LLViewToggleUI : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if(gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
- {
- LLNotification::Params params("ConfirmHideUI");
- params.functor.function(boost::bind(&LLViewToggleUI::confirm, this, _1, _2));
- LLSD substitutions;
+ bool handleEvent(const LLSD& userdata)
+ {
+ if(gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
+ {
+ LLNotification::Params params("ConfirmHideUI");
+ params.functor.function(boost::bind(&LLViewToggleUI::confirm, this, _1, _2));
+ LLSD substitutions;
#if LL_DARWIN
- substitutions["SHORTCUT"] = "Cmd+Shift+U";
+ substitutions["SHORTCUT"] = "Cmd+Shift+U";
#else
- substitutions["SHORTCUT"] = "Ctrl+Shift+U";
+ substitutions["SHORTCUT"] = "Ctrl+Shift+U";
#endif
- params.substitutions = substitutions;
- if (!gSavedSettings.getBOOL("HideUIControls"))
- {
- // hiding, so show notification
- LLNotifications::instance().add(params);
- }
- else
- {
- LLNotifications::instance().forceResponse(params, 0);
- }
- }
- return true;
- }
-
- void confirm(const LLSD& notification, const LLSD& response)
- {
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- if (option == 0) // OK
- {
- gViewerWindow->setUIVisibility(gSavedSettings.getBOOL("HideUIControls"));
- LLPanelStandStopFlying::getInstance()->setVisible(gSavedSettings.getBOOL("HideUIControls"));
- gSavedSettings.setBOOL("HideUIControls",!gSavedSettings.getBOOL("HideUIControls"));
- }
- }
+ params.substitutions = substitutions;
+ if (!gSavedSettings.getBOOL("HideUIControls"))
+ {
+ // hiding, so show notification
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ }
+ return true;
+ }
+
+ void confirm(const LLSD& notification, const LLSD& response)
+ {
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ if (option == 0) // OK
+ {
+ gViewerWindow->setUIVisibility(gSavedSettings.getBOOL("HideUIControls"));
+ LLPanelStandStopFlying::getInstance()->setVisible(gSavedSettings.getBOOL("HideUIControls"));
+ gSavedSettings.setBOOL("HideUIControls",!gSavedSettings.getBOOL("HideUIControls"));
+ }
+ }
};
void handle_duplicate_in_place(void*)
{
- LL_INFOS() << "handle_duplicate_in_place" << LL_ENDL;
+ LL_INFOS() << "handle_duplicate_in_place" << LL_ENDL;
- LLVector3 offset(0.f, 0.f, 0.f);
- LLSelectMgr::getInstance()->selectDuplicate(offset, TRUE);
+ LLVector3 offset(0.f, 0.f, 0.f);
+ LLSelectMgr::getInstance()->selectDuplicate(offset, TRUE);
}
@@ -4606,121 +4606,121 @@ void handle_duplicate_in_place(void*)
* No longer able to support viewer side manipulations in this way
*
void god_force_inv_owner_permissive(LLViewerObject* object,
- LLInventoryObject::object_list_t* inventory,
- S32 serial_num,
- void*)
-{
- typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
- item_array_t items;
-
- LLInventoryObject::object_list_t::const_iterator inv_it = inventory->begin();
- LLInventoryObject::object_list_t::const_iterator inv_end = inventory->end();
- for ( ; inv_it != inv_end; ++inv_it)
- {
- if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY))
- {
- LLInventoryObject* obj = *inv_it;
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem((LLViewerInventoryItem*)obj);
- LLPermissions perm(new_item->getPermissions());
- perm.setMaskBase(PERM_ALL);
- perm.setMaskOwner(PERM_ALL);
- new_item->setPermissions(perm);
- items.push_back(new_item);
- }
- }
- item_array_t::iterator end = items.end();
- item_array_t::iterator it;
- for(it = items.begin(); it != end; ++it)
- {
- // since we have the inventory item in the callback, it should not
- // invalidate iteration through the selection manager.
- object->updateInventory((*it), TASK_INVENTORY_ITEM_KEY, false);
- }
+ LLInventoryObject::object_list_t* inventory,
+ S32 serial_num,
+ void*)
+{
+ typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
+ item_array_t items;
+
+ LLInventoryObject::object_list_t::const_iterator inv_it = inventory->begin();
+ LLInventoryObject::object_list_t::const_iterator inv_end = inventory->end();
+ for ( ; inv_it != inv_end; ++inv_it)
+ {
+ if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY))
+ {
+ LLInventoryObject* obj = *inv_it;
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem((LLViewerInventoryItem*)obj);
+ LLPermissions perm(new_item->getPermissions());
+ perm.setMaskBase(PERM_ALL);
+ perm.setMaskOwner(PERM_ALL);
+ new_item->setPermissions(perm);
+ items.push_back(new_item);
+ }
+ }
+ item_array_t::iterator end = items.end();
+ item_array_t::iterator it;
+ for(it = items.begin(); it != end; ++it)
+ {
+ // since we have the inventory item in the callback, it should not
+ // invalidate iteration through the selection manager.
+ object->updateInventory((*it), TASK_INVENTORY_ITEM_KEY, false);
+ }
}
*/
void handle_object_owner_permissive(void*)
{
- // only send this if they're a god.
- if(gAgent.isGodlike())
- {
- // do the objects.
- LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE);
- LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE);
- }
+ // only send this if they're a god.
+ if(gAgent.isGodlike())
+ {
+ // do the objects.
+ LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE);
+ LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE);
+ }
}
void handle_object_owner_self(void*)
{
- // only send this if they're a god.
- if(gAgent.isGodlike())
- {
- LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID(), TRUE);
- }
+ // only send this if they're a god.
+ if(gAgent.isGodlike())
+ {
+ LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID(), TRUE);
+ }
}
// Shortcut to set owner permissions to not editable.
void handle_object_lock(void*)
{
- LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY);
+ LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY);
}
void handle_object_asset_ids(void*)
{
- // only send this if they're a god.
- if (gAgent.isGodlike())
- {
- LLSelectMgr::getInstance()->sendGodlikeRequest("objectinfo", "assetids");
- }
+ // only send this if they're a god.
+ if (gAgent.isGodlike())
+ {
+ LLSelectMgr::getInstance()->sendGodlikeRequest("objectinfo", "assetids");
+ }
}
void handle_force_parcel_owner_to_me(void*)
{
- LLViewerParcelMgr::getInstance()->sendParcelGodForceOwner( gAgent.getID() );
+ LLViewerParcelMgr::getInstance()->sendParcelGodForceOwner( gAgent.getID() );
}
void handle_force_parcel_to_content(void*)
{
- LLViewerParcelMgr::getInstance()->sendParcelGodForceToContent();
+ LLViewerParcelMgr::getInstance()->sendParcelGodForceToContent();
}
void handle_claim_public_land(void*)
{
- if (LLViewerParcelMgr::getInstance()->getSelectionRegion() != gAgent.getRegion())
- {
- LLNotificationsUtil::add("ClaimPublicLand");
- return;
- }
-
- LLVector3d west_south_global;
- LLVector3d east_north_global;
- LLViewerParcelMgr::getInstance()->getSelection(west_south_global, east_north_global);
- LLVector3 west_south = gAgent.getPosAgentFromGlobal(west_south_global);
- LLVector3 east_north = gAgent.getPosAgentFromGlobal(east_north_global);
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GodlikeMessage");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", "claimpublicland");
- msg->addUUID("Invoice", LLUUID::null);
- std::string buffer;
- buffer = llformat( "%f", west_south.mV[VX]);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buffer);
- buffer = llformat( "%f", west_south.mV[VY]);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buffer);
- buffer = llformat( "%f", east_north.mV[VX]);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buffer);
- buffer = llformat( "%f", east_north.mV[VY]);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buffer);
- gAgent.sendReliableMessage();
+ if (LLViewerParcelMgr::getInstance()->getSelectionRegion() != gAgent.getRegion())
+ {
+ LLNotificationsUtil::add("ClaimPublicLand");
+ return;
+ }
+
+ LLVector3d west_south_global;
+ LLVector3d east_north_global;
+ LLViewerParcelMgr::getInstance()->getSelection(west_south_global, east_north_global);
+ LLVector3 west_south = gAgent.getPosAgentFromGlobal(west_south_global);
+ LLVector3 east_north = gAgent.getPosAgentFromGlobal(east_north_global);
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("GodlikeMessage");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
+ msg->nextBlock("MethodData");
+ msg->addString("Method", "claimpublicland");
+ msg->addUUID("Invoice", LLUUID::null);
+ std::string buffer;
+ buffer = llformat( "%f", west_south.mV[VX]);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", buffer);
+ buffer = llformat( "%f", west_south.mV[VY]);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", buffer);
+ buffer = llformat( "%f", east_north.mV[VX]);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", buffer);
+ buffer = llformat( "%f", east_north.mV[VY]);
+ msg->nextBlock("ParamList");
+ msg->addString("Parameter", buffer);
+ gAgent.sendReliableMessage();
}
@@ -4728,286 +4728,286 @@ void handle_claim_public_land(void*)
// HACK for easily testing new avatar geometry
void handle_god_request_avatar_geometry(void *)
{
- if (gAgent.isGodlike())
- {
- LLSelectMgr::getInstance()->sendGodlikeRequest("avatar toggle", "");
- }
+ if (gAgent.isGodlike())
+ {
+ LLSelectMgr::getInstance()->sendGodlikeRequest("avatar toggle", "");
+ }
}
static bool get_derezzable_objects(
- EDeRezDestination dest,
- std::string& error,
- LLViewerRegion*& first_region,
- std::vector<LLViewerObjectPtr>* derez_objectsp,
- bool only_check = false)
-{
- bool found = false;
-
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
-
- if (derez_objectsp)
- derez_objectsp->reserve(selection->getRootObjectCount());
-
- // Check conditions that we can't deal with, building a list of
- // everything that we'll actually be derezzing.
- for (LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin();
- iter != selection->valid_root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- LLViewerRegion* region = object->getRegion();
- if (!first_region)
- {
- first_region = region;
- }
- else
- {
- if(region != first_region)
- {
- // Derez doesn't work at all if the some of the objects
- // are in regions besides the first object selected.
-
- // ...crosses region boundaries
- error = "AcquireErrorObjectSpan";
- break;
- }
- }
- if (object->isAvatar())
- {
- // ...don't acquire avatars
- continue;
- }
-
- // If AssetContainers are being sent back, they will appear as
- // boxes in the owner's inventory.
- if (object->getNVPair("AssetContainer")
- && dest != DRD_RETURN_TO_OWNER)
- {
- // this object is an asset container, derez its contents, not it
- LL_WARNS() << "Attempt to derez deprecated AssetContainer object type not supported." << LL_ENDL;
- /*
- object->requestInventory(container_inventory_arrived,
- (void *)(BOOL)(DRD_TAKE_INTO_AGENT_INVENTORY == dest));
- */
- continue;
- }
- BOOL can_derez_current = FALSE;
- switch(dest)
- {
- case DRD_TAKE_INTO_AGENT_INVENTORY:
- case DRD_TRASH:
- if (!object->isPermanentEnforced() &&
- ((node->mPermissions->allowTransferTo(gAgent.getID()) && object->permModify())
- || (node->allowOperationOnNode(PERM_OWNER, GP_OBJECT_MANIPULATE))))
- {
- can_derez_current = TRUE;
- }
- break;
-
- case DRD_RETURN_TO_OWNER:
- if(!object->isAttachment())
- {
- can_derez_current = TRUE;
- }
- break;
-
- default:
- if((node->mPermissions->allowTransferTo(gAgent.getID())
- && object->permCopy())
- || gAgent.isGodlike())
- {
- can_derez_current = TRUE;
- }
- break;
- }
- if(can_derez_current)
- {
- found = true;
-
- if (only_check)
- // one found, no need to traverse to the end
- break;
-
- if (derez_objectsp)
- derez_objectsp->push_back(object);
-
- }
- }
-
- return found;
+ EDeRezDestination dest,
+ std::string& error,
+ LLViewerRegion*& first_region,
+ std::vector<LLViewerObjectPtr>* derez_objectsp,
+ bool only_check = false)
+{
+ bool found = false;
+
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+
+ if (derez_objectsp)
+ derez_objectsp->reserve(selection->getRootObjectCount());
+
+ // Check conditions that we can't deal with, building a list of
+ // everything that we'll actually be derezzing.
+ for (LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin();
+ iter != selection->valid_root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ LLViewerRegion* region = object->getRegion();
+ if (!first_region)
+ {
+ first_region = region;
+ }
+ else
+ {
+ if(region != first_region)
+ {
+ // Derez doesn't work at all if the some of the objects
+ // are in regions besides the first object selected.
+
+ // ...crosses region boundaries
+ error = "AcquireErrorObjectSpan";
+ break;
+ }
+ }
+ if (object->isAvatar())
+ {
+ // ...don't acquire avatars
+ continue;
+ }
+
+ // If AssetContainers are being sent back, they will appear as
+ // boxes in the owner's inventory.
+ if (object->getNVPair("AssetContainer")
+ && dest != DRD_RETURN_TO_OWNER)
+ {
+ // this object is an asset container, derez its contents, not it
+ LL_WARNS() << "Attempt to derez deprecated AssetContainer object type not supported." << LL_ENDL;
+ /*
+ object->requestInventory(container_inventory_arrived,
+ (void *)(BOOL)(DRD_TAKE_INTO_AGENT_INVENTORY == dest));
+ */
+ continue;
+ }
+ BOOL can_derez_current = FALSE;
+ switch(dest)
+ {
+ case DRD_TAKE_INTO_AGENT_INVENTORY:
+ case DRD_TRASH:
+ if (!object->isPermanentEnforced() &&
+ ((node->mPermissions->allowTransferTo(gAgent.getID()) && object->permModify())
+ || (node->allowOperationOnNode(PERM_OWNER, GP_OBJECT_MANIPULATE))))
+ {
+ can_derez_current = TRUE;
+ }
+ break;
+
+ case DRD_RETURN_TO_OWNER:
+ if(!object->isAttachment())
+ {
+ can_derez_current = TRUE;
+ }
+ break;
+
+ default:
+ if((node->mPermissions->allowTransferTo(gAgent.getID())
+ && object->permCopy())
+ || gAgent.isGodlike())
+ {
+ can_derez_current = TRUE;
+ }
+ break;
+ }
+ if(can_derez_current)
+ {
+ found = true;
+
+ if (only_check)
+ // one found, no need to traverse to the end
+ break;
+
+ if (derez_objectsp)
+ derez_objectsp->push_back(object);
+
+ }
+ }
+
+ return found;
}
static bool can_derez(EDeRezDestination dest)
{
- LLViewerRegion* first_region = NULL;
- std::string error;
- return get_derezzable_objects(dest, error, first_region, NULL, true);
+ LLViewerRegion* first_region = NULL;
+ std::string error;
+ return get_derezzable_objects(dest, error, first_region, NULL, true);
}
static void derez_objects(
- EDeRezDestination dest,
- const LLUUID& dest_id,
- LLViewerRegion*& first_region,
- std::string& error,
- std::vector<LLViewerObjectPtr>* objectsp)
-{
- std::vector<LLViewerObjectPtr> derez_objects;
-
- if (!objectsp) // if objects to derez not specified
- {
- // get them from selection
- if (!get_derezzable_objects(dest, error, first_region, &derez_objects, false))
- {
- LL_WARNS() << "No objects to derez" << LL_ENDL;
- return;
- }
-
- objectsp = &derez_objects;
- }
-
-
- if(gAgentCamera.cameraMouselook())
- {
- gAgentCamera.changeCameraToDefault();
- }
-
- // This constant is based on (1200 - HEADER_SIZE) / 4 bytes per
- // root. I lopped off a few (33) to provide a bit
- // pad. HEADER_SIZE is currently 67 bytes, most of which is UUIDs.
- // This gives us a maximum of 63500 root objects - which should
- // satisfy anybody.
- const S32 MAX_ROOTS_PER_PACKET = 250;
- const S32 MAX_PACKET_COUNT = 254;
- F32 packets = ceil((F32)objectsp->size() / (F32)MAX_ROOTS_PER_PACKET);
- if(packets > (F32)MAX_PACKET_COUNT)
- {
- error = "AcquireErrorTooManyObjects";
- }
-
- if(error.empty() && objectsp->size() > 0)
- {
- U8 d = (U8)dest;
- LLUUID tid;
- tid.generate();
- U8 packet_count = (U8)packets;
- S32 object_index = 0;
- S32 objects_in_packet = 0;
- LLMessageSystem* msg = gMessageSystem;
- for(U8 packet_number = 0;
- packet_number < packet_count;
- ++packet_number)
- {
- msg->newMessageFast(_PREHASH_DeRezObject);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_AgentBlock);
- msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
- msg->addU8Fast(_PREHASH_Destination, d);
- msg->addUUIDFast(_PREHASH_DestinationID, dest_id);
- msg->addUUIDFast(_PREHASH_TransactionID, tid);
- msg->addU8Fast(_PREHASH_PacketCount, packet_count);
- msg->addU8Fast(_PREHASH_PacketNumber, packet_number);
- objects_in_packet = 0;
- while((object_index < objectsp->size())
- && (objects_in_packet++ < MAX_ROOTS_PER_PACKET))
-
- {
- LLViewerObject* object = objectsp->at(object_index++);
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
- // VEFFECT: DerezObject
- LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
- effectp->setPositionGlobal(object->getPositionGlobal());
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- }
- msg->sendReliable(first_region->getHost());
- }
- make_ui_sound("UISndObjectRezOut");
-
- // Busy count decremented by inventory update, so only increment
- // if will be causing an update.
- if (dest != DRD_RETURN_TO_OWNER)
- {
- gViewerWindow->getWindow()->incBusyCount();
- }
- }
- else if(!error.empty())
- {
- LLNotificationsUtil::add(error);
- }
+ EDeRezDestination dest,
+ const LLUUID& dest_id,
+ LLViewerRegion*& first_region,
+ std::string& error,
+ std::vector<LLViewerObjectPtr>* objectsp)
+{
+ std::vector<LLViewerObjectPtr> derez_objects;
+
+ if (!objectsp) // if objects to derez not specified
+ {
+ // get them from selection
+ if (!get_derezzable_objects(dest, error, first_region, &derez_objects, false))
+ {
+ LL_WARNS() << "No objects to derez" << LL_ENDL;
+ return;
+ }
+
+ objectsp = &derez_objects;
+ }
+
+
+ if(gAgentCamera.cameraMouselook())
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+
+ // This constant is based on (1200 - HEADER_SIZE) / 4 bytes per
+ // root. I lopped off a few (33) to provide a bit
+ // pad. HEADER_SIZE is currently 67 bytes, most of which is UUIDs.
+ // This gives us a maximum of 63500 root objects - which should
+ // satisfy anybody.
+ const S32 MAX_ROOTS_PER_PACKET = 250;
+ const S32 MAX_PACKET_COUNT = 254;
+ F32 packets = ceil((F32)objectsp->size() / (F32)MAX_ROOTS_PER_PACKET);
+ if(packets > (F32)MAX_PACKET_COUNT)
+ {
+ error = "AcquireErrorTooManyObjects";
+ }
+
+ if(error.empty() && objectsp->size() > 0)
+ {
+ U8 d = (U8)dest;
+ LLUUID tid;
+ tid.generate();
+ U8 packet_count = (U8)packets;
+ S32 object_index = 0;
+ S32 objects_in_packet = 0;
+ LLMessageSystem* msg = gMessageSystem;
+ for(U8 packet_number = 0;
+ packet_number < packet_count;
+ ++packet_number)
+ {
+ msg->newMessageFast(_PREHASH_DeRezObject);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_AgentBlock);
+ msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
+ msg->addU8Fast(_PREHASH_Destination, d);
+ msg->addUUIDFast(_PREHASH_DestinationID, dest_id);
+ msg->addUUIDFast(_PREHASH_TransactionID, tid);
+ msg->addU8Fast(_PREHASH_PacketCount, packet_count);
+ msg->addU8Fast(_PREHASH_PacketNumber, packet_number);
+ objects_in_packet = 0;
+ while((object_index < objectsp->size())
+ && (objects_in_packet++ < MAX_ROOTS_PER_PACKET))
+
+ {
+ LLViewerObject* object = objectsp->at(object_index++);
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
+ // VEFFECT: DerezObject
+ LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
+ effectp->setPositionGlobal(object->getPositionGlobal());
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ }
+ msg->sendReliable(first_region->getHost());
+ }
+ make_ui_sound("UISndObjectRezOut");
+
+ // Busy count decremented by inventory update, so only increment
+ // if will be causing an update.
+ if (dest != DRD_RETURN_TO_OWNER)
+ {
+ gViewerWindow->getWindow()->incBusyCount();
+ }
+ }
+ else if(!error.empty())
+ {
+ LLNotificationsUtil::add(error);
+ }
}
static void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
{
- LLViewerRegion* first_region = NULL;
- std::string error;
- derez_objects(dest, dest_id, first_region, error, NULL);
+ LLViewerRegion* first_region = NULL;
+ std::string error;
+ derez_objects(dest, dest_id, first_region, error, NULL);
}
void handle_take_copy()
{
- if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return;
+ if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return;
- const LLUUID category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
- derez_objects(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id);
+ const LLUUID category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
+ derez_objects(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id);
}
void handle_link_objects()
{
- if (LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- LLFloaterReg::toggleInstanceOrBringToFront("places");
- }
- else
- {
- LLSelectMgr::getInstance()->linkObjects();
- }
+ if (LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ LLFloaterReg::toggleInstanceOrBringToFront("places");
+ }
+ else
+ {
+ LLSelectMgr::getInstance()->linkObjects();
+ }
}
// You can return an object to its owner if it is on your land.
class LLObjectReturn : public view_listener_t
{
public:
- LLObjectReturn() : mFirstRegion(NULL) {}
+ LLObjectReturn() : mFirstRegion(NULL) {}
private:
- bool handleEvent(const LLSD& userdata)
- {
- if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true;
-
- mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true;
+
+ mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
- // Save selected objects, so that we still know what to return after the confirmation dialog resets selection.
- get_derezzable_objects(DRD_RETURN_TO_OWNER, mError, mFirstRegion, &mReturnableObjects);
+ // Save selected objects, so that we still know what to return after the confirmation dialog resets selection.
+ get_derezzable_objects(DRD_RETURN_TO_OWNER, mError, mFirstRegion, &mReturnableObjects);
- LLNotificationsUtil::add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&LLObjectReturn::onReturnToOwner, this, _1, _2));
- return true;
- }
+ LLNotificationsUtil::add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&LLObjectReturn::onReturnToOwner, this, _1, _2));
+ return true;
+ }
- bool onReturnToOwner(const LLSD& notification, const LLSD& response)
- {
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- // Ignore category ID for this derez destination.
- derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null, mFirstRegion, mError, &mReturnableObjects);
- }
+ bool onReturnToOwner(const LLSD& notification, const LLSD& response)
+ {
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ // Ignore category ID for this derez destination.
+ derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null, mFirstRegion, mError, &mReturnableObjects);
+ }
- mReturnableObjects.clear();
- mError.clear();
- mFirstRegion = NULL;
+ mReturnableObjects.clear();
+ mError.clear();
+ mFirstRegion = NULL;
- // drop reference to current selection
- mObjectSelection = NULL;
- return false;
- }
+ // drop reference to current selection
+ mObjectSelection = NULL;
+ return false;
+ }
- LLObjectSelectionHandle mObjectSelection;
+ LLObjectSelectionHandle mObjectSelection;
- std::vector<LLViewerObjectPtr> mReturnableObjects;
- std::string mError;
- LLViewerRegion* mFirstRegion;
+ std::vector<LLViewerObjectPtr> mReturnableObjects;
+ std::string mError;
+ LLViewerRegion* mFirstRegion;
};
@@ -5015,187 +5015,187 @@ private:
// over land you own.
class LLObjectEnableReturn : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- // Do not enable if nothing selected
- return false;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ // Do not enable if nothing selected
+ return false;
+ }
#ifdef HACKED_GODLIKE_VIEWER
- bool new_value = true;
+ bool new_value = true;
#else
- bool new_value = false;
- if (gAgent.isGodlike())
- {
- new_value = true;
- }
- else
- {
- new_value = can_derez(DRD_RETURN_TO_OWNER);
- }
+ bool new_value = false;
+ if (gAgent.isGodlike())
+ {
+ new_value = true;
+ }
+ else
+ {
+ new_value = can_derez(DRD_RETURN_TO_OWNER);
+ }
#endif
- return new_value;
- }
+ return new_value;
+ }
};
void force_take_copy(void*)
{
- if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return;
- const LLUUID category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
- derez_objects(DRD_FORCE_TO_GOD_INVENTORY, category_id);
+ if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return;
+ const LLUUID category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
+ derez_objects(DRD_FORCE_TO_GOD_INVENTORY, category_id);
}
void handle_take()
{
- // we want to use the folder this was derezzed from if it's
- // available. Otherwise, derez to the normal place.
- if(LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- return;
- }
-
- BOOL you_own_everything = TRUE;
- BOOL locked_but_takeable_object = FALSE;
- LLUUID category_id;
-
- for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if(object)
- {
- if(!object->permYouOwner())
- {
- you_own_everything = FALSE;
- }
-
- if(!object->permMove())
- {
- locked_but_takeable_object = TRUE;
- }
- }
- if(node->mFolderID.notNull())
- {
- if(category_id.isNull())
- {
- category_id = node->mFolderID;
- }
- else if(category_id != node->mFolderID)
- {
- // we have found two potential destinations. break out
- // now and send to the default location.
- category_id.setNull();
- break;
- }
- }
- }
- if(category_id.notNull())
- {
- // there is an unambiguous destination. See if this agent has
- // such a location and it is not in the trash or library
- if(!gInventory.getCategory(category_id))
- {
- // nope, set to NULL.
- category_id.setNull();
- }
- if(category_id.notNull())
- {
- // check trash
- const LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if(category_id == trash || gInventory.isObjectDescendentOf(category_id, trash))
- {
- category_id.setNull();
- }
-
- // check library
- if(gInventory.isObjectDescendentOf(category_id, gInventory.getLibraryRootFolderID()))
- {
- category_id.setNull();
- }
-
- // check inbox
- const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
- if (category_id == inbox_id || gInventory.isObjectDescendentOf(category_id, inbox_id))
- {
- category_id.setNull();
- }
- }
- }
- if(category_id.isNull())
- {
- category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
- }
- LLSD payload;
- payload["folder_id"] = category_id;
-
- LLNotification::Params params("ConfirmObjectTakeLock");
- params.payload(payload);
- // MAINT-290
- // Reason: Showing the confirmation dialog resets object selection, thus there is nothing to derez.
- // Fix: pass selection to the confirm_take, so that selection doesn't "die" after confirmation dialog is opened
- params.functor.function(boost::bind(confirm_take, _1, _2, LLSelectMgr::instance().getSelection()));
-
- if(locked_but_takeable_object ||
- !you_own_everything)
- {
- if(locked_but_takeable_object && you_own_everything)
- {
- params.name("ConfirmObjectTakeLock");
- }
- else if(!locked_but_takeable_object && !you_own_everything)
- {
- params.name("ConfirmObjectTakeNoOwn");
- }
- else
- {
- params.name("ConfirmObjectTakeLockNoOwn");
- }
-
- LLNotifications::instance().add(params);
- }
- else
- {
- LLNotifications::instance().forceResponse(params, 0);
- }
+ // we want to use the folder this was derezzed from if it's
+ // available. Otherwise, derez to the normal place.
+ if(LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ return;
+ }
+
+ BOOL you_own_everything = TRUE;
+ BOOL locked_but_takeable_object = FALSE;
+ LLUUID category_id;
+
+ for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if(object)
+ {
+ if(!object->permYouOwner())
+ {
+ you_own_everything = FALSE;
+ }
+
+ if(!object->permMove())
+ {
+ locked_but_takeable_object = TRUE;
+ }
+ }
+ if(node->mFolderID.notNull())
+ {
+ if(category_id.isNull())
+ {
+ category_id = node->mFolderID;
+ }
+ else if(category_id != node->mFolderID)
+ {
+ // we have found two potential destinations. break out
+ // now and send to the default location.
+ category_id.setNull();
+ break;
+ }
+ }
+ }
+ if(category_id.notNull())
+ {
+ // there is an unambiguous destination. See if this agent has
+ // such a location and it is not in the trash or library
+ if(!gInventory.getCategory(category_id))
+ {
+ // nope, set to NULL.
+ category_id.setNull();
+ }
+ if(category_id.notNull())
+ {
+ // check trash
+ const LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if(category_id == trash || gInventory.isObjectDescendentOf(category_id, trash))
+ {
+ category_id.setNull();
+ }
+
+ // check library
+ if(gInventory.isObjectDescendentOf(category_id, gInventory.getLibraryRootFolderID()))
+ {
+ category_id.setNull();
+ }
+
+ // check inbox
+ const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
+ if (category_id == inbox_id || gInventory.isObjectDescendentOf(category_id, inbox_id))
+ {
+ category_id.setNull();
+ }
+ }
+ }
+ if(category_id.isNull())
+ {
+ category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
+ }
+ LLSD payload;
+ payload["folder_id"] = category_id;
+
+ LLNotification::Params params("ConfirmObjectTakeLock");
+ params.payload(payload);
+ // MAINT-290
+ // Reason: Showing the confirmation dialog resets object selection, thus there is nothing to derez.
+ // Fix: pass selection to the confirm_take, so that selection doesn't "die" after confirmation dialog is opened
+ params.functor.function(boost::bind(confirm_take, _1, _2, LLSelectMgr::instance().getSelection()));
+
+ if(locked_but_takeable_object ||
+ !you_own_everything)
+ {
+ if(locked_but_takeable_object && you_own_everything)
+ {
+ params.name("ConfirmObjectTakeLock");
+ }
+ else if(!locked_but_takeable_object && !you_own_everything)
+ {
+ params.name("ConfirmObjectTakeNoOwn");
+ }
+ else
+ {
+ params.name("ConfirmObjectTakeLockNoOwn");
+ }
+
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
}
void handle_object_show_inspector()
{
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- LLViewerObject* objectp = selection->getFirstRootObject(TRUE);
- if (!objectp)
- {
- return;
- }
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ LLViewerObject* objectp = selection->getFirstRootObject(TRUE);
+ if (!objectp)
+ {
+ return;
+ }
- LLSD params;
- params["object_id"] = objectp->getID();
- LLFloaterReg::showInstance("inspect_object", params);
+ LLSD params;
+ params["object_id"] = objectp->getID();
+ LLFloaterReg::showInstance("inspect_object", params);
}
void handle_avatar_show_inspector()
{
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if(avatar)
- {
- LLSD params;
- params["avatar_id"] = avatar->getID();
- LLFloaterReg::showInstance("inspect_avatar", params);
- }
+ LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+ if(avatar)
+ {
+ LLSD params;
+ params["avatar_id"] = avatar->getID();
+ LLFloaterReg::showInstance("inspect_avatar", params);
+ }
}
bool confirm_take(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle selection_handle)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if(enable_take() && (option == 0))
- {
- derez_objects(DRD_TAKE_INTO_AGENT_INVENTORY, notification["payload"]["folder_id"].asUUID());
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if(enable_take() && (option == 0))
+ {
+ derez_objects(DRD_TAKE_INTO_AGENT_INVENTORY, notification["payload"]["folder_id"].asUUID());
+ }
+ return false;
}
// You can take an item when it is public and transferrable, or when
@@ -5203,101 +5203,101 @@ bool confirm_take(const LLSD& notification, const LLSD& response, LLObjectSelect
// one item selected can be copied to inventory.
BOOL enable_take()
{
- if (sitting_on_selection())
- {
- return FALSE;
- }
-
- for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- if (object->isAvatar())
- {
- // ...don't acquire avatars
- continue;
- }
+ if (sitting_on_selection())
+ {
+ return FALSE;
+ }
+
+ for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if (object->isAvatar())
+ {
+ // ...don't acquire avatars
+ continue;
+ }
#ifdef HACKED_GODLIKE_VIEWER
- return TRUE;
+ return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLGridManager::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& gAgent.isGodlike())
- {
- return TRUE;
- }
+ {
+ return TRUE;
+ }
# endif
- if(!object->isPermanentEnforced() &&
- ((node->mPermissions->allowTransferTo(gAgent.getID())
- && object->permModify())
- || (node->mPermissions->getOwner() == gAgent.getID())))
- {
- return !object->isAttachment();
- }
+ if(!object->isPermanentEnforced() &&
+ ((node->mPermissions->allowTransferTo(gAgent.getID())
+ && object->permModify())
+ || (node->mPermissions->getOwner() == gAgent.getID())))
+ {
+ return !object->isAttachment();
+ }
#endif
- }
- return FALSE;
+ }
+ return FALSE;
}
void handle_buy_or_take()
{
- if (LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- return;
- }
-
- if (is_selection_buy_not_take())
- {
- S32 total_price = selection_price();
-
- if (total_price <= gStatusBar->getBalance() || total_price == 0)
- {
- handle_buy();
- }
- else
- {
- LLStringUtil::format_map_t args;
- args["AMOUNT"] = llformat("%d", total_price);
- LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString( "this_object_costs", args ), total_price );
- }
- }
- else
- {
- handle_take();
- }
+ if (LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ return;
+ }
+
+ if (is_selection_buy_not_take())
+ {
+ S32 total_price = selection_price();
+
+ if (total_price <= gStatusBar->getBalance() || total_price == 0)
+ {
+ handle_buy();
+ }
+ else
+ {
+ LLStringUtil::format_map_t args;
+ args["AMOUNT"] = llformat("%d", total_price);
+ LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString( "this_object_costs", args ), total_price );
+ }
+ }
+ else
+ {
+ handle_take();
+ }
}
bool visible_buy_object()
{
- return is_selection_buy_not_take() && enable_buy_object();
+ return is_selection_buy_not_take() && enable_buy_object();
}
bool visible_take_object()
{
- return !is_selection_buy_not_take() && enable_take();
+ return !is_selection_buy_not_take() && enable_take();
}
bool tools_visible_buy_object()
{
- return is_selection_buy_not_take();
+ return is_selection_buy_not_take();
}
bool tools_visible_take_object()
{
- return !is_selection_buy_not_take();
+ return !is_selection_buy_not_take();
}
class LLToolsEnableBuyOrTake : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool is_buy = is_selection_buy_not_take();
- bool new_value = is_buy ? enable_buy_object() : enable_take();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool is_buy = is_selection_buy_not_take();
+ bool new_value = is_buy ? enable_buy_object() : enable_take();
+ return new_value;
+ }
};
// This is a small helper function to determine if we have a buy or a
@@ -5318,255 +5318,255 @@ class LLToolsEnableBuyOrTake : public view_listener_t
// FALSE if selection is a 'take'
BOOL is_selection_buy_not_take()
{
- for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* obj = node->getObject();
- if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
- {
- // you do not own the object and it is for sale, thus,
- // it's a buy
- return TRUE;
- }
- }
- return FALSE;
+ for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* obj = node->getObject();
+ if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
+ {
+ // you do not own the object and it is for sale, thus,
+ // it's a buy
+ return TRUE;
+ }
+ }
+ return FALSE;
}
S32 selection_price()
{
- S32 total_price = 0;
- for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* obj = node->getObject();
- if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
- {
- // you do not own the object and it is for sale.
- // Add its price.
- total_price += node->mSaleInfo.getSalePrice();
- }
- }
-
- return total_price;
+ S32 total_price = 0;
+ for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* obj = node->getObject();
+ if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
+ {
+ // you do not own the object and it is for sale.
+ // Add its price.
+ total_price += node->mSaleInfo.getSalePrice();
+ }
+ }
+
+ return total_price;
}
/*
bool callback_show_buy_currency(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- LL_INFOS() << "Loading page " << LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL") << LL_ENDL;
- LLWeb::loadURL(LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL"));
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ LL_INFOS() << "Loading page " << LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL") << LL_ENDL;
+ LLWeb::loadURL(LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL"));
+ }
+ return false;
}
*/
void show_buy_currency(const char* extra)
{
- // Don't show currency web page for branded clients.
+ // Don't show currency web page for branded clients.
/*
- std::ostringstream mesg;
- if (extra != NULL)
- {
- mesg << extra << "\n \n";
- }
- mesg << "Go to " << LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL")<< "\nfor information on purchasing currency?";
+ std::ostringstream mesg;
+ if (extra != NULL)
+ {
+ mesg << extra << "\n \n";
+ }
+ mesg << "Go to " << LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL")<< "\nfor information on purchasing currency?";
*/
- LLSD args;
- if (extra != NULL)
- {
- args["EXTRA"] = extra;
- }
- LLNotificationsUtil::add("PromptGoToCurrencyPage", args);//, LLSD(), callback_show_buy_currency);
+ LLSD args;
+ if (extra != NULL)
+ {
+ args["EXTRA"] = extra;
+ }
+ LLNotificationsUtil::add("PromptGoToCurrencyPage", args);//, LLSD(), callback_show_buy_currency);
}
void handle_buy()
{
- if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return;
+ if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return;
- LLSaleInfo sale_info;
- BOOL valid = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
- if (!valid) return;
+ LLSaleInfo sale_info;
+ BOOL valid = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
+ if (!valid) return;
- S32 price = sale_info.getSalePrice();
-
- if (price > 0 && price > gStatusBar->getBalance())
- {
- LLStringUtil::format_map_t args;
- args["AMOUNT"] = llformat("%d", price);
- LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("this_object_costs", args), price );
- return;
- }
+ S32 price = sale_info.getSalePrice();
- if (sale_info.getSaleType() == LLSaleInfo::FS_CONTENTS)
- {
- handle_buy_contents(sale_info);
- }
- else
- {
- handle_buy_object(sale_info);
- }
+ if (price > 0 && price > gStatusBar->getBalance())
+ {
+ LLStringUtil::format_map_t args;
+ args["AMOUNT"] = llformat("%d", price);
+ LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("this_object_costs", args), price );
+ return;
+ }
+
+ if (sale_info.getSaleType() == LLSaleInfo::FS_CONTENTS)
+ {
+ handle_buy_contents(sale_info);
+ }
+ else
+ {
+ handle_buy_object(sale_info);
+ }
}
bool anyone_copy_selection(LLSelectNode* nodep)
{
- bool perm_copy = (bool)(nodep->getObject()->permCopy());
- bool all_copy = (bool)(nodep->mPermissions->getMaskEveryone() & PERM_COPY);
- return perm_copy && all_copy;
+ bool perm_copy = (bool)(nodep->getObject()->permCopy());
+ bool all_copy = (bool)(nodep->mPermissions->getMaskEveryone() & PERM_COPY);
+ return perm_copy && all_copy;
}
bool for_sale_selection(LLSelectNode* nodep)
{
- return nodep->mSaleInfo.isForSale()
- && nodep->mPermissions->getMaskOwner() & PERM_TRANSFER
- && (nodep->mPermissions->getMaskOwner() & PERM_COPY
- || nodep->mSaleInfo.getSaleType() != LLSaleInfo::FS_COPY);
+ return nodep->mSaleInfo.isForSale()
+ && nodep->mPermissions->getMaskOwner() & PERM_TRANSFER
+ && (nodep->mPermissions->getMaskOwner() & PERM_COPY
+ || nodep->mSaleInfo.getSaleType() != LLSaleInfo::FS_COPY);
}
BOOL sitting_on_selection()
{
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (!node)
- {
- return FALSE;
- }
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if (!node)
+ {
+ return FALSE;
+ }
- if (!node->mValid)
- {
- return FALSE;
- }
+ if (!node->mValid)
+ {
+ return FALSE;
+ }
- LLViewerObject* root_object = node->getObject();
- if (!root_object)
- {
- return FALSE;
- }
+ LLViewerObject* root_object = node->getObject();
+ if (!root_object)
+ {
+ return FALSE;
+ }
- // Need to determine if avatar is sitting on this object
- if (!isAgentAvatarValid()) return FALSE;
+ // Need to determine if avatar is sitting on this object
+ if (!isAgentAvatarValid()) return FALSE;
- return (gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == root_object);
+ return (gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == root_object);
}
class LLToolsSaveToObjectInventory : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if(node && (node->mValid) && (!node->mFromTaskID.isNull()))
- {
- // *TODO: check to see if the fromtaskid object exists.
- derez_objects(DRD_SAVE_INTO_TASK_INVENTORY, node->mFromTaskID);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if(node && (node->mValid) && (!node->mFromTaskID.isNull()))
+ {
+ // *TODO: check to see if the fromtaskid object exists.
+ derez_objects(DRD_SAVE_INTO_TASK_INVENTORY, node->mFromTaskID);
+ }
+ return true;
+ }
};
class LLToolsEnablePathfinding : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion();
+ }
};
class LLToolsEnablePathfindingView : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLPathfindingManager::getInstance()->isPathfindingViewEnabled();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLPathfindingManager::getInstance()->isPathfindingViewEnabled();
+ }
};
class LLToolsDoPathfindingRebakeRegion : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool hasPathfinding = (LLPathfindingManager::getInstance() != NULL);
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool hasPathfinding = (LLPathfindingManager::getInstance() != NULL);
- if (hasPathfinding)
- {
- LLMenuOptionPathfindingRebakeNavmesh::getInstance()->sendRequestRebakeNavmesh();
- }
+ if (hasPathfinding)
+ {
+ LLMenuOptionPathfindingRebakeNavmesh::getInstance()->sendRequestRebakeNavmesh();
+ }
- return hasPathfinding;
- }
+ return hasPathfinding;
+ }
};
class LLToolsEnablePathfindingRebakeRegion : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool returnValue = false;
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool returnValue = false;
if (LLNavigationBar::instanceExists())
{
returnValue = LLNavigationBar::getInstance()->isRebakeNavMeshAvailable();
}
- return returnValue;
- }
+ return returnValue;
+ }
};
// Round the position of all root objects to the grid
class LLToolsSnapObjectXY : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- F64 snap_size = (F64)gSavedSettings.getF32("GridResolution");
-
- for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* obj = node->getObject();
- if (obj->permModify())
- {
- LLVector3d pos_global = obj->getPositionGlobal();
- F64 round_x = fmod(pos_global.mdV[VX], snap_size);
- if (round_x < snap_size * 0.5)
- {
- // closer to round down
- pos_global.mdV[VX] -= round_x;
- }
- else
- {
- // closer to round up
- pos_global.mdV[VX] -= round_x;
- pos_global.mdV[VX] += snap_size;
- }
-
- F64 round_y = fmod(pos_global.mdV[VY], snap_size);
- if (round_y < snap_size * 0.5)
- {
- pos_global.mdV[VY] -= round_y;
- }
- else
- {
- pos_global.mdV[VY] -= round_y;
- pos_global.mdV[VY] += snap_size;
- }
-
- obj->setPositionGlobal(pos_global, FALSE);
- }
- }
- LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ F64 snap_size = (F64)gSavedSettings.getF32("GridResolution");
+
+ for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* obj = node->getObject();
+ if (obj->permModify())
+ {
+ LLVector3d pos_global = obj->getPositionGlobal();
+ F64 round_x = fmod(pos_global.mdV[VX], snap_size);
+ if (round_x < snap_size * 0.5)
+ {
+ // closer to round down
+ pos_global.mdV[VX] -= round_x;
+ }
+ else
+ {
+ // closer to round up
+ pos_global.mdV[VX] -= round_x;
+ pos_global.mdV[VX] += snap_size;
+ }
+
+ F64 round_y = fmod(pos_global.mdV[VY], snap_size);
+ if (round_y < snap_size * 0.5)
+ {
+ pos_global.mdV[VY] -= round_y;
+ }
+ else
+ {
+ pos_global.mdV[VY] -= round_y;
+ pos_global.mdV[VY] += snap_size;
+ }
+
+ obj->setPositionGlobal(pos_global, FALSE);
+ }
+ }
+ LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION);
+ return true;
+ }
};
// Determine if the option to cycle between linked prims is shown
class LLToolsEnableSelectNextPart : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
+ bool handleEvent(const LLSD& userdata)
+ {
bool new_value = (!LLSelectMgr::getInstance()->getSelection()->isEmpty()
&& (gSavedSettings.getBOOL("EditLinkedParts")
|| LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()));
- return new_value;
- }
+ return new_value;
+ }
};
// Cycle selection through linked children or/and faces in selected object.
@@ -5641,61 +5641,61 @@ class LLToolsSelectNextPartFace : public view_listener_t
}
}
- S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
- if (cycle_linked && object_count && restart_face_on_part)
- {
- LLViewerObject* selected = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
- if (selected && selected->getRootEdit())
- {
- LLViewerObject::child_list_t children = selected->getRootEdit()->getChildren();
- children.push_front(selected->getRootEdit()); // need root in the list too
-
- for (LLViewerObject::child_list_t::iterator iter = children.begin(); iter != children.end(); ++iter)
- {
- if ((*iter)->isSelected())
- {
- if (object_count > 1 && (fwd || prev)) // multiple selection, find first or last selected if not include
- {
- to_select = *iter;
- if (fwd)
- {
- // stop searching if going forward; repeat to get last hit if backward
- break;
- }
- }
- else if ((object_count == 1) || (ifwd || iprev)) // single selection or include
- {
- if (fwd || ifwd)
- {
- ++iter;
- while (iter != children.end() && ((*iter)->isAvatar() || (ifwd && (*iter)->isSelected())))
- {
- ++iter; // skip sitting avatars and selected if include
- }
- }
- else // backward
- {
- iter = (iter == children.begin() ? children.end() : iter);
- --iter;
- while (iter != children.begin() && ((*iter)->isAvatar() || (iprev && (*iter)->isSelected())))
- {
- --iter; // skip sitting avatars and selected if include
- }
- }
- iter = (iter == children.end() ? children.begin() : iter);
- to_select = *iter;
- break;
- }
- }
- }
- }
- }
+ S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
+ if (cycle_linked && object_count && restart_face_on_part)
+ {
+ LLViewerObject* selected = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
+ if (selected && selected->getRootEdit())
+ {
+ LLViewerObject::child_list_t children = selected->getRootEdit()->getChildren();
+ children.push_front(selected->getRootEdit()); // need root in the list too
+
+ for (LLViewerObject::child_list_t::iterator iter = children.begin(); iter != children.end(); ++iter)
+ {
+ if ((*iter)->isSelected())
+ {
+ if (object_count > 1 && (fwd || prev)) // multiple selection, find first or last selected if not include
+ {
+ to_select = *iter;
+ if (fwd)
+ {
+ // stop searching if going forward; repeat to get last hit if backward
+ break;
+ }
+ }
+ else if ((object_count == 1) || (ifwd || iprev)) // single selection or include
+ {
+ if (fwd || ifwd)
+ {
+ ++iter;
+ while (iter != children.end() && ((*iter)->isAvatar() || (ifwd && (*iter)->isSelected())))
+ {
+ ++iter; // skip sitting avatars and selected if include
+ }
+ }
+ else // backward
+ {
+ iter = (iter == children.begin() ? children.end() : iter);
+ --iter;
+ while (iter != children.begin() && ((*iter)->isAvatar() || (iprev && (*iter)->isSelected())))
+ {
+ --iter; // skip sitting avatars and selected if include
+ }
+ }
+ iter = (iter == children.end() ? children.begin() : iter);
+ to_select = *iter;
+ break;
+ }
+ }
+ }
+ }
+ }
if (to_select)
{
if (gFocusMgr.childHasKeyboardFocus(gFloaterTools))
{
- gFocusMgr.setKeyboardFocus(NULL); // force edit toolbox to commit any changes
+ gFocusMgr.setKeyboardFocus(NULL); // force edit toolbox to commit any changes
}
if (fwd || prev)
{
@@ -5723,455 +5723,455 @@ class LLToolsSelectNextPartFace : public view_listener_t
}
return true;
}
- return true;
- }
+ return true;
+ }
};
class LLToolsStopAllAnimations : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gAgent.stopCurrentAnimations();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gAgent.stopCurrentAnimations();
+ return true;
+ }
};
class LLToolsReleaseKeys : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gAgent.forceReleaseControls();
+ bool handleEvent(const LLSD& userdata)
+ {
+ gAgent.forceReleaseControls();
- return true;
- }
+ return true;
+ }
};
class LLToolsEnableReleaseKeys : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return gAgent.anyControlGrabbed();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return gAgent.anyControlGrabbed();
+ }
};
class LLEditEnableCut : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCut();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCut();
+ return new_value;
+ }
};
class LLEditCut : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if( LLEditMenuHandler::gEditMenuHandler )
- {
- LLEditMenuHandler::gEditMenuHandler->cut();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if( LLEditMenuHandler::gEditMenuHandler )
+ {
+ LLEditMenuHandler::gEditMenuHandler->cut();
+ }
+ return true;
+ }
};
class LLEditEnableCopy : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCopy();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCopy();
+ return new_value;
+ }
};
class LLEditCopy : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if( LLEditMenuHandler::gEditMenuHandler )
- {
- LLEditMenuHandler::gEditMenuHandler->copy();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if( LLEditMenuHandler::gEditMenuHandler )
+ {
+ LLEditMenuHandler::gEditMenuHandler->copy();
+ }
+ return true;
+ }
};
class LLEditEnablePaste : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canPaste();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canPaste();
+ return new_value;
+ }
};
class LLEditPaste : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if( LLEditMenuHandler::gEditMenuHandler )
- {
- LLEditMenuHandler::gEditMenuHandler->paste();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if( LLEditMenuHandler::gEditMenuHandler )
+ {
+ LLEditMenuHandler::gEditMenuHandler->paste();
+ }
+ return true;
+ }
};
class LLEditEnableDelete : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete();
+ return new_value;
+ }
};
class LLEditDelete : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- // If a text field can do a deletion, it gets precedence over deleting
- // an object in the world.
- if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete())
- {
- LLEditMenuHandler::gEditMenuHandler->doDelete();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ // If a text field can do a deletion, it gets precedence over deleting
+ // an object in the world.
+ if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete())
+ {
+ LLEditMenuHandler::gEditMenuHandler->doDelete();
+ }
- // and close any pie/context menus when done
- gMenuHolder->hideMenus();
+ // and close any pie/context menus when done
+ gMenuHolder->hideMenus();
- // When deleting an object we may not actually be done
- // Keep selection so we know what to delete when confirmation is needed about the delete
- gMenuObject->hide();
- return true;
- }
+ // When deleting an object we may not actually be done
+ // Keep selection so we know what to delete when confirmation is needed about the delete
+ gMenuObject->hide();
+ return true;
+ }
};
void handle_spellcheck_replace_with_suggestion(const LLUICtrl* ctrl, const LLSD& param)
{
- const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
- LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
- if ( (!spellcheck_handler) || (!spellcheck_handler->getSpellCheck()) )
- {
- return;
- }
+ const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
+ LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
+ if ( (!spellcheck_handler) || (!spellcheck_handler->getSpellCheck()) )
+ {
+ return;
+ }
- U32 index = 0;
- if ( (!LLStringUtil::convertToU32(param.asString(), index)) || (index >= spellcheck_handler->getSuggestionCount()) )
- {
- return;
- }
+ U32 index = 0;
+ if ( (!LLStringUtil::convertToU32(param.asString(), index)) || (index >= spellcheck_handler->getSuggestionCount()) )
+ {
+ return;
+ }
- spellcheck_handler->replaceWithSuggestion(index);
+ spellcheck_handler->replaceWithSuggestion(index);
}
bool visible_spellcheck_suggestion(LLUICtrl* ctrl, const LLSD& param)
{
- LLMenuItemGL* item = dynamic_cast<LLMenuItemGL*>(ctrl);
- const LLContextMenu* menu = (item) ? dynamic_cast<const LLContextMenu*>(item->getParent()) : NULL;
- const LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<const LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
- if ( (!spellcheck_handler) || (!spellcheck_handler->getSpellCheck()) )
- {
- return false;
- }
+ LLMenuItemGL* item = dynamic_cast<LLMenuItemGL*>(ctrl);
+ const LLContextMenu* menu = (item) ? dynamic_cast<const LLContextMenu*>(item->getParent()) : NULL;
+ const LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<const LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
+ if ( (!spellcheck_handler) || (!spellcheck_handler->getSpellCheck()) )
+ {
+ return false;
+ }
- U32 index = 0;
- if ( (!LLStringUtil::convertToU32(param.asString(), index)) || (index >= spellcheck_handler->getSuggestionCount()) )
- {
- return false;
- }
+ U32 index = 0;
+ if ( (!LLStringUtil::convertToU32(param.asString(), index)) || (index >= spellcheck_handler->getSuggestionCount()) )
+ {
+ return false;
+ }
- item->setLabel(spellcheck_handler->getSuggestion(index));
- return true;
+ item->setLabel(spellcheck_handler->getSuggestion(index));
+ return true;
}
void handle_spellcheck_add_to_dictionary(const LLUICtrl* ctrl)
{
- const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
- LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
- if ( (spellcheck_handler) && (spellcheck_handler->canAddToDictionary()) )
- {
- spellcheck_handler->addToDictionary();
- }
+ const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
+ LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
+ if ( (spellcheck_handler) && (spellcheck_handler->canAddToDictionary()) )
+ {
+ spellcheck_handler->addToDictionary();
+ }
}
bool enable_spellcheck_add_to_dictionary(const LLUICtrl* ctrl)
{
- const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
- const LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<const LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
- return (spellcheck_handler) && (spellcheck_handler->canAddToDictionary());
+ const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
+ const LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<const LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
+ return (spellcheck_handler) && (spellcheck_handler->canAddToDictionary());
}
void handle_spellcheck_add_to_ignore(const LLUICtrl* ctrl)
{
- const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
- LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
- if ( (spellcheck_handler) && (spellcheck_handler->canAddToIgnore()) )
- {
- spellcheck_handler->addToIgnore();
- }
+ const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
+ LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
+ if ( (spellcheck_handler) && (spellcheck_handler->canAddToIgnore()) )
+ {
+ spellcheck_handler->addToIgnore();
+ }
}
bool enable_spellcheck_add_to_ignore(const LLUICtrl* ctrl)
{
- const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
- const LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<const LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
- return (spellcheck_handler) && (spellcheck_handler->canAddToIgnore());
+ const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
+ const LLSpellCheckMenuHandler* spellcheck_handler = (menu) ? dynamic_cast<const LLSpellCheckMenuHandler*>(menu->getSpawningView()) : NULL;
+ return (spellcheck_handler) && (spellcheck_handler->canAddToIgnore());
}
bool enable_object_return()
{
- return (!LLSelectMgr::getInstance()->getSelection()->isEmpty() &&
- (gAgent.isGodlike() || can_derez(DRD_RETURN_TO_OWNER)));
+ return (!LLSelectMgr::getInstance()->getSelection()->isEmpty() &&
+ (gAgent.isGodlike() || can_derez(DRD_RETURN_TO_OWNER)));
}
bool enable_object_delete()
{
- bool new_value =
+ bool new_value =
#ifdef HACKED_GODLIKE_VIEWER
- TRUE;
+ TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- (!LLGridManager::getInstance()->isInProductionGrid()
+ (!LLGridManager::getInstance()->isInProductionGrid()
&& gAgent.isGodlike()) ||
# endif
- LLSelectMgr::getInstance()->canDoDelete();
+ LLSelectMgr::getInstance()->canDoDelete();
#endif
- return new_value;
+ return new_value;
}
class LLObjectsReturnPackage
{
public:
- LLObjectsReturnPackage() : mObjectSelection(), mReturnableObjects(), mError(), mFirstRegion(NULL) {};
- ~LLObjectsReturnPackage()
- {
- mObjectSelection.clear();
- mReturnableObjects.clear();
- mError.clear();
- mFirstRegion = NULL;
- };
+ LLObjectsReturnPackage() : mObjectSelection(), mReturnableObjects(), mError(), mFirstRegion(NULL) {};
+ ~LLObjectsReturnPackage()
+ {
+ mObjectSelection.clear();
+ mReturnableObjects.clear();
+ mError.clear();
+ mFirstRegion = NULL;
+ };
- LLObjectSelectionHandle mObjectSelection;
- std::vector<LLViewerObjectPtr> mReturnableObjects;
- std::string mError;
- LLViewerRegion *mFirstRegion;
+ LLObjectSelectionHandle mObjectSelection;
+ std::vector<LLViewerObjectPtr> mReturnableObjects;
+ std::string mError;
+ LLViewerRegion *mFirstRegion;
};
static void return_objects(LLObjectsReturnPackage *objectsReturnPackage, const LLSD& notification, const LLSD& response)
{
- if (LLNotificationsUtil::getSelectedOption(notification, response) == 0)
- {
- // Ignore category ID for this derez destination.
- derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null, objectsReturnPackage->mFirstRegion, objectsReturnPackage->mError, &objectsReturnPackage->mReturnableObjects);
- }
+ if (LLNotificationsUtil::getSelectedOption(notification, response) == 0)
+ {
+ // Ignore category ID for this derez destination.
+ derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null, objectsReturnPackage->mFirstRegion, objectsReturnPackage->mError, &objectsReturnPackage->mReturnableObjects);
+ }
- delete objectsReturnPackage;
+ delete objectsReturnPackage;
}
void handle_object_return()
{
- if (!LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- LLObjectsReturnPackage *objectsReturnPackage = new LLObjectsReturnPackage();
- objectsReturnPackage->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+ if (!LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ LLObjectsReturnPackage *objectsReturnPackage = new LLObjectsReturnPackage();
+ objectsReturnPackage->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
- // Save selected objects, so that we still know what to return after the confirmation dialog resets selection.
- get_derezzable_objects(DRD_RETURN_TO_OWNER, objectsReturnPackage->mError, objectsReturnPackage->mFirstRegion, &objectsReturnPackage->mReturnableObjects);
+ // Save selected objects, so that we still know what to return after the confirmation dialog resets selection.
+ get_derezzable_objects(DRD_RETURN_TO_OWNER, objectsReturnPackage->mError, objectsReturnPackage->mFirstRegion, &objectsReturnPackage->mReturnableObjects);
- LLNotificationsUtil::add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&return_objects, objectsReturnPackage, _1, _2));
- }
+ LLNotificationsUtil::add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&return_objects, objectsReturnPackage, _1, _2));
+ }
}
void handle_object_delete()
{
- if (LLSelectMgr::getInstance())
- {
- LLSelectMgr::getInstance()->doDelete();
- }
+ if (LLSelectMgr::getInstance())
+ {
+ LLSelectMgr::getInstance()->doDelete();
+ }
- // and close any pie/context menus when done
- gMenuHolder->hideMenus();
+ // and close any pie/context menus when done
+ gMenuHolder->hideMenus();
- // When deleting an object we may not actually be done
- // Keep selection so we know what to delete when confirmation is needed about the delete
- gMenuObject->hide();
- return;
+ // When deleting an object we may not actually be done
+ // Keep selection so we know what to delete when confirmation is needed about the delete
+ gMenuObject->hide();
+ return;
}
void handle_force_delete(void*)
{
- LLSelectMgr::getInstance()->selectForceDelete();
+ LLSelectMgr::getInstance()->selectForceDelete();
}
class LLViewEnableJoystickFlycam : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = (gSavedSettings.getBOOL("JoystickEnabled") && gSavedSettings.getBOOL("JoystickFlycamEnabled"));
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = (gSavedSettings.getBOOL("JoystickEnabled") && gSavedSettings.getBOOL("JoystickFlycamEnabled"));
+ return new_value;
+ }
};
class LLViewEnableLastChatter : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- // *TODO: add check that last chatter is in range
- bool new_value = (gAgentCamera.cameraThirdPerson() && gAgent.getLastChatter().notNull());
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ // *TODO: add check that last chatter is in range
+ bool new_value = (gAgentCamera.cameraThirdPerson() && gAgent.getLastChatter().notNull());
+ return new_value;
+ }
};
class LLEditEnableDeselect : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDeselect();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDeselect();
+ return new_value;
+ }
};
class LLEditDeselect : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if( LLEditMenuHandler::gEditMenuHandler )
- {
- LLEditMenuHandler::gEditMenuHandler->deselect();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if( LLEditMenuHandler::gEditMenuHandler )
+ {
+ LLEditMenuHandler::gEditMenuHandler->deselect();
+ }
+ return true;
+ }
};
class LLEditEnableSelectAll : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canSelectAll();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canSelectAll();
+ return new_value;
+ }
};
class LLEditSelectAll : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if( LLEditMenuHandler::gEditMenuHandler )
- {
- LLEditMenuHandler::gEditMenuHandler->selectAll();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if( LLEditMenuHandler::gEditMenuHandler )
+ {
+ LLEditMenuHandler::gEditMenuHandler->selectAll();
+ }
+ return true;
+ }
};
class LLEditEnableUndo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo();
+ return new_value;
+ }
};
class LLEditUndo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo() )
- {
- LLEditMenuHandler::gEditMenuHandler->undo();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo() )
+ {
+ LLEditMenuHandler::gEditMenuHandler->undo();
+ }
+ return true;
+ }
};
class LLEditEnableRedo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo();
+ return new_value;
+ }
};
class LLEditRedo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo() )
- {
- LLEditMenuHandler::gEditMenuHandler->redo();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo() )
+ {
+ LLEditMenuHandler::gEditMenuHandler->redo();
+ }
+ return true;
+ }
};
void print_object_info(void*)
{
- LLSelectMgr::getInstance()->selectionDump();
+ LLSelectMgr::getInstance()->selectionDump();
}
void print_agent_nvpairs(void*)
{
- LLViewerObject *objectp;
+ LLViewerObject *objectp;
- LL_INFOS() << "Agent Name Value Pairs" << LL_ENDL;
+ LL_INFOS() << "Agent Name Value Pairs" << LL_ENDL;
- objectp = gObjectList.findObject(gAgentID);
- if (objectp)
- {
- objectp->printNameValuePairs();
- }
- else
- {
- LL_INFOS() << "Can't find agent object" << LL_ENDL;
- }
+ objectp = gObjectList.findObject(gAgentID);
+ if (objectp)
+ {
+ objectp->printNameValuePairs();
+ }
+ else
+ {
+ LL_INFOS() << "Can't find agent object" << LL_ENDL;
+ }
- LL_INFOS() << "Camera at " << gAgentCamera.getCameraPositionGlobal() << LL_ENDL;
+ LL_INFOS() << "Camera at " << gAgentCamera.getCameraPositionGlobal() << LL_ENDL;
}
void show_debug_menus()
{
- // this might get called at login screen where there is no menu so only toggle it if one exists
- if ( gMenuBarView )
- {
- BOOL debug = gSavedSettings.getBOOL("UseDebugMenus");
- BOOL qamode = gSavedSettings.getBOOL("QAMode");
-
- gMenuBarView->setItemVisible("Advanced", debug);
-// gMenuBarView->setItemEnabled("Advanced", debug); // Don't disable Advanced keyboard shortcuts when hidden
-
- gMenuBarView->setItemVisible("Debug", qamode);
- gMenuBarView->setItemEnabled("Debug", qamode);
-
- gMenuBarView->setItemVisible("Develop", qamode);
- gMenuBarView->setItemEnabled("Develop", qamode);
-
- // Server ('Admin') menu hidden when not in godmode.
- const bool show_server_menu = (gAgent.getGodLevel() > GOD_NOT || (debug && gAgent.getAdminOverride()));
- gMenuBarView->setItemVisible("Admin", show_server_menu);
- gMenuBarView->setItemEnabled("Admin", show_server_menu);
- }
- if (gLoginMenuBarView)
- {
- BOOL debug = gSavedSettings.getBOOL("UseDebugMenus");
- gLoginMenuBarView->setItemVisible("Debug", debug);
- gLoginMenuBarView->setItemEnabled("Debug", debug);
- }
+ // this might get called at login screen where there is no menu so only toggle it if one exists
+ if ( gMenuBarView )
+ {
+ BOOL debug = gSavedSettings.getBOOL("UseDebugMenus");
+ BOOL qamode = gSavedSettings.getBOOL("QAMode");
+
+ gMenuBarView->setItemVisible("Advanced", debug);
+// gMenuBarView->setItemEnabled("Advanced", debug); // Don't disable Advanced keyboard shortcuts when hidden
+
+ gMenuBarView->setItemVisible("Debug", qamode);
+ gMenuBarView->setItemEnabled("Debug", qamode);
+
+ gMenuBarView->setItemVisible("Develop", qamode);
+ gMenuBarView->setItemEnabled("Develop", qamode);
+
+ // Server ('Admin') menu hidden when not in godmode.
+ const bool show_server_menu = (gAgent.getGodLevel() > GOD_NOT || (debug && gAgent.getAdminOverride()));
+ gMenuBarView->setItemVisible("Admin", show_server_menu);
+ gMenuBarView->setItemEnabled("Admin", show_server_menu);
+ }
+ if (gLoginMenuBarView)
+ {
+ BOOL debug = gSavedSettings.getBOOL("UseDebugMenus");
+ gLoginMenuBarView->setItemVisible("Debug", debug);
+ gLoginMenuBarView->setItemEnabled("Debug", debug);
+ }
}
void toggle_debug_menus(void*)
{
- BOOL visible = ! gSavedSettings.getBOOL("UseDebugMenus");
- gSavedSettings.setBOOL("UseDebugMenus", visible);
- show_debug_menus();
+ BOOL visible = ! gSavedSettings.getBOOL("UseDebugMenus");
+ gSavedSettings.setBOOL("UseDebugMenus", visible);
+ show_debug_menus();
}
@@ -6182,292 +6182,292 @@ void toggle_debug_menus(void*)
// void handle_export_selected( void * )
// {
-// LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
-// if (selection->isEmpty())
-// {
-// return;
-// }
-// LL_INFOS() << "Exporting selected objects:" << LL_ENDL;
-
-// gExporterRequestID.generate();
-// gExportDirectory = "";
-
-// LLMessageSystem* msg = gMessageSystem;
-// msg->newMessageFast(_PREHASH_ObjectExportSelected);
-// msg->nextBlockFast(_PREHASH_AgentData);
-// msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
-// msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID);
-// msg->addS16Fast(_PREHASH_VolumeDetail, 4);
-
-// for (LLObjectSelection::root_iterator iter = selection->root_begin();
-// iter != selection->root_end(); iter++)
-// {
-// LLSelectNode* node = *iter;
-// LLViewerObject* object = node->getObject();
-// msg->nextBlockFast(_PREHASH_ObjectData);
-// msg->addUUIDFast(_PREHASH_ObjectID, object->getID());
-// LL_INFOS() << "Object: " << object->getID() << LL_ENDL;
-// }
-// msg->sendReliable(gAgent.getRegion()->getHost());
-
-// gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects...");
+// LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+// if (selection->isEmpty())
+// {
+// return;
+// }
+// LL_INFOS() << "Exporting selected objects:" << LL_ENDL;
+
+// gExporterRequestID.generate();
+// gExportDirectory = "";
+
+// LLMessageSystem* msg = gMessageSystem;
+// msg->newMessageFast(_PREHASH_ObjectExportSelected);
+// msg->nextBlockFast(_PREHASH_AgentData);
+// msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+// msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID);
+// msg->addS16Fast(_PREHASH_VolumeDetail, 4);
+
+// for (LLObjectSelection::root_iterator iter = selection->root_begin();
+// iter != selection->root_end(); iter++)
+// {
+// LLSelectNode* node = *iter;
+// LLViewerObject* object = node->getObject();
+// msg->nextBlockFast(_PREHASH_ObjectData);
+// msg->addUUIDFast(_PREHASH_ObjectID, object->getID());
+// LL_INFOS() << "Object: " << object->getID() << LL_ENDL;
+// }
+// msg->sendReliable(gAgent.getRegion()->getHost());
+
+// gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects...");
// }
//
class LLCommunicateNearbyChat : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloaterIMContainer* im_box = LLFloaterIMContainer::getInstance();
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloaterIMContainer* im_box = LLFloaterIMContainer::getInstance();
LLFloaterIMNearbyChat* floater_nearby = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if (floater_nearby->isInVisibleChain() && !floater_nearby->isTornOff()
+ if (floater_nearby->isInVisibleChain() && !floater_nearby->isTornOff()
&& im_box->getSelectedSession() == LLUUID() && im_box->getConversationListItemSize() > 1)
- {
- im_box->selectNextorPreviousConversation(false);
- }
- else
- {
- LLFloaterReg::toggleInstanceOrBringToFront("nearby_chat");
- }
- return true;
- }
+ {
+ im_box->selectNextorPreviousConversation(false);
+ }
+ else
+ {
+ LLFloaterReg::toggleInstanceOrBringToFront("nearby_chat");
+ }
+ return true;
+ }
};
class LLWorldSetHomeLocation : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- // we just send the message and let the server check for failure cases
- // server will echo back a "Home position set." alert if it succeeds
- // and the home location screencapture happens when that alert is recieved
- gAgent.setStartPosition(START_LOCATION_ID_HOME);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ // we just send the message and let the server check for failure cases
+ // server will echo back a "Home position set." alert if it succeeds
+ // and the home location screencapture happens when that alert is recieved
+ gAgent.setStartPosition(START_LOCATION_ID_HOME);
+ return true;
+ }
};
class LLWorldLindenHome : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string url = LLFloaterLandHoldings::sHasLindenHome ? LLTrans::getString("lindenhomes_my_home_url") : LLTrans::getString("lindenhomes_get_home_url");
- LLWeb::loadURL(url);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string url = LLFloaterLandHoldings::sHasLindenHome ? LLTrans::getString("lindenhomes_my_home_url") : LLTrans::getString("lindenhomes_get_home_url");
+ LLWeb::loadURL(url);
+ return true;
+ }
};
class LLWorldTeleportHome : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gAgent.teleportHome();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gAgent.teleportHome();
+ return true;
+ }
};
class LLWorldAlwaysRun : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- // as well as altering the default walk-vs-run state,
- // we also change the *current* walk-vs-run state.
- if (gAgent.getAlwaysRun())
- {
- gAgent.clearAlwaysRun();
- gAgent.clearRunning();
- }
- else
- {
- gAgent.setAlwaysRun();
- gAgent.setRunning();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ // as well as altering the default walk-vs-run state,
+ // we also change the *current* walk-vs-run state.
+ if (gAgent.getAlwaysRun())
+ {
+ gAgent.clearAlwaysRun();
+ gAgent.clearRunning();
+ }
+ else
+ {
+ gAgent.setAlwaysRun();
+ gAgent.setRunning();
+ }
- // tell the simulator.
- gAgent.sendWalkRun(gAgent.getAlwaysRun());
+ // tell the simulator.
+ gAgent.sendWalkRun(gAgent.getAlwaysRun());
- // Update Movement Controls according to AlwaysRun mode
- LLFloaterMove::setAlwaysRunMode(gAgent.getAlwaysRun());
+ // Update Movement Controls according to AlwaysRun mode
+ LLFloaterMove::setAlwaysRunMode(gAgent.getAlwaysRun());
- return true;
- }
+ return true;
+ }
};
class LLWorldCheckAlwaysRun : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gAgent.getAlwaysRun();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gAgent.getAlwaysRun();
+ return new_value;
+ }
};
class LLWorldSetAway : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgent.getAFK())
- {
- gAgent.clearAFK();
- }
- else
- {
- gAgent.setAFK();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (gAgent.getAFK())
+ {
+ gAgent.clearAFK();
+ }
+ else
+ {
+ gAgent.setAFK();
+ }
+ return true;
+ }
};
class LLWorldSetDoNotDisturb : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgent.isDoNotDisturb())
- {
- gAgent.setDoNotDisturb(false);
- }
- else
- {
- gAgent.setDoNotDisturb(true);
- LLNotificationsUtil::add("DoNotDisturbModeSet");
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (gAgent.isDoNotDisturb())
+ {
+ gAgent.setDoNotDisturb(false);
+ }
+ else
+ {
+ gAgent.setDoNotDisturb(true);
+ LLNotificationsUtil::add("DoNotDisturbModeSet");
+ }
+ return true;
+ }
};
class LLWorldCreateLandmark : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloaterReg::showInstance("add_landmark");
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloaterReg::showInstance("add_landmark");
- return true;
- }
+ return true;
+ }
};
class LLWorldPlaceProfile : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "agent"));
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "agent"));
- return true;
- }
+ return true;
+ }
};
void handle_look_at_selection(const LLSD& param)
{
- const F32 PADDING_FACTOR = 1.75f;
- BOOL zoom = (param.asString() == "zoom");
- if (!LLSelectMgr::getInstance()->getSelection()->isEmpty())
- {
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
-
- LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
- F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView());
- F32 distance = selection_bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view);
-
- LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - selection_bbox.getCenterAgent();
- obj_to_cam.normVec();
-
- LLUUID object_id;
- if (LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())
- {
- object_id = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()->mID;
- }
- if (zoom)
- {
- // Make sure we are not increasing the distance between the camera and object
- LLVector3d orig_distance = gAgentCamera.getCameraPositionGlobal() - LLSelectMgr::getInstance()->getSelectionCenterGlobal();
- distance = llmin(distance, (F32) orig_distance.length());
-
- gAgentCamera.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance),
- LLSelectMgr::getInstance()->getSelectionCenterGlobal(),
- object_id );
-
- }
- else
- {
- gAgentCamera.setFocusGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal(), object_id );
- }
- }
+ const F32 PADDING_FACTOR = 1.75f;
+ BOOL zoom = (param.asString() == "zoom");
+ if (!LLSelectMgr::getInstance()->getSelection()->isEmpty())
+ {
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+
+ LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+ F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView());
+ F32 distance = selection_bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view);
+
+ LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - selection_bbox.getCenterAgent();
+ obj_to_cam.normVec();
+
+ LLUUID object_id;
+ if (LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())
+ {
+ object_id = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()->mID;
+ }
+ if (zoom)
+ {
+ // Make sure we are not increasing the distance between the camera and object
+ LLVector3d orig_distance = gAgentCamera.getCameraPositionGlobal() - LLSelectMgr::getInstance()->getSelectionCenterGlobal();
+ distance = llmin(distance, (F32) orig_distance.length());
+
+ gAgentCamera.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance),
+ LLSelectMgr::getInstance()->getSelectionCenterGlobal(),
+ object_id );
+
+ }
+ else
+ {
+ gAgentCamera.setFocusGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal(), object_id );
+ }
+ }
}
void handle_zoom_to_object(LLUUID object_id)
{
- const F32 PADDING_FACTOR = 2.f;
+ const F32 PADDING_FACTOR = 2.f;
- LLViewerObject* object = gObjectList.findObject(object_id);
+ LLViewerObject* object = gObjectList.findObject(object_id);
- if (object)
- {
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+ if (object)
+ {
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
- LLBBox bbox = object->getBoundingBoxAgent() ;
- F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView());
- F32 distance = bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view);
+ LLBBox bbox = object->getBoundingBoxAgent() ;
+ F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView());
+ F32 distance = bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view);
- LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent();
- obj_to_cam.normVec();
+ LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent();
+ obj_to_cam.normVec();
- LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
+ LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
- gAgentCamera.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance),
- object_center_global,
- object_id );
- }
+ gAgentCamera.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance),
+ object_center_global,
+ object_id );
+ }
}
class LLAvatarInviteToGroup : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if(avatar)
- {
- LLAvatarActions::inviteToGroup(avatar->getID());
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+ if(avatar)
+ {
+ LLAvatarActions::inviteToGroup(avatar->getID());
+ }
+ return true;
+ }
};
class LLAvatarAddFriend : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if(avatar && !LLAvatarActions::isFriend(avatar->getID()))
- {
- request_friendship(avatar->getID());
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+ if(avatar && !LLAvatarActions::isFriend(avatar->getID()))
+ {
+ request_friendship(avatar->getID());
+ }
+ return true;
+ }
};
class LLAvatarToggleMyProfile : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloater* instance = LLAvatarActions::getProfileFloater(gAgent.getID());
- if (LLFloater::isMinimized(instance))
- {
- instance->setMinimized(FALSE);
- instance->setFocus(TRUE);
- }
- else if (!LLFloater::isShown(instance))
- {
- LLAvatarActions::showProfile(gAgent.getID());
- }
- else if (!instance->hasFocus() && !instance->getIsChrome())
- {
- instance->setFocus(TRUE);
- }
- else
- {
- instance->closeFloater();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloater* instance = LLAvatarActions::getProfileFloater(gAgent.getID());
+ if (LLFloater::isMinimized(instance))
+ {
+ instance->setMinimized(FALSE);
+ instance->setFocus(TRUE);
+ }
+ else if (!LLFloater::isShown(instance))
+ {
+ LLAvatarActions::showProfile(gAgent.getID());
+ }
+ else if (!instance->hasFocus() && !instance->getIsChrome())
+ {
+ instance->setFocus(TRUE);
+ }
+ else
+ {
+ instance->closeFloater();
+ }
+ return true;
+ }
};
class LLAvatarTogglePicks : public view_listener_t
@@ -6495,41 +6495,41 @@ class LLAvatarTogglePicks : public view_listener_t
class LLAvatarToggleSearch : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloater* instance = LLFloaterReg::findInstance("search");
- if (LLFloater::isMinimized(instance))
- {
- instance->setMinimized(FALSE);
- instance->setFocus(TRUE);
- }
- else if (!LLFloater::isShown(instance))
- {
- LLFloaterReg::showInstance("search");
- }
- else if (!instance->hasFocus() && !instance->getIsChrome())
- {
- instance->setFocus(TRUE);
- }
- else
- {
- instance->closeFloater();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloater* instance = LLFloaterReg::findInstance("search");
+ if (LLFloater::isMinimized(instance))
+ {
+ instance->setMinimized(FALSE);
+ instance->setFocus(TRUE);
+ }
+ else if (!LLFloater::isShown(instance))
+ {
+ LLFloaterReg::showInstance("search");
+ }
+ else if (!instance->hasFocus() && !instance->getIsChrome())
+ {
+ instance->setFocus(TRUE);
+ }
+ else
+ {
+ instance->closeFloater();
+ }
+ return true;
+ }
};
class LLAvatarResetSkeleton: public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- LLVOAvatar* avatar = NULL;
+ LLVOAvatar* avatar = NULL;
LLViewerObject *obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
if (obj)
{
avatar = obj->getAvatar();
}
- if(avatar)
+ if(avatar)
{
avatar->resetSkeleton(false);
}
@@ -6553,184 +6553,184 @@ class LLAvatarEnableResetSkeleton: public view_listener_t
class LLAvatarResetSkeletonAndAnimations : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- if (avatar)
- {
- avatar->resetSkeleton(true);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
+ if (avatar)
+ {
+ avatar->resetSkeleton(true);
+ }
+ return true;
+ }
};
class LLAvatarResetSelfSkeletonAndAnimations : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- if (avatar)
- {
- avatar->resetSkeleton(true);
- }
- else
- {
- gAgentAvatarp->resetSkeleton(true);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
+ if (avatar)
+ {
+ avatar->resetSkeleton(true);
+ }
+ else
+ {
+ gAgentAvatarp->resetSkeleton(true);
+ }
+ return true;
+ }
};
class LLAvatarAddContact : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if(avatar)
- {
- create_inventory_callingcard(avatar->getID());
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+ if(avatar)
+ {
+ create_inventory_callingcard(avatar->getID());
+ }
+ return true;
+ }
};
bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle selection)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- gAgent.setDoNotDisturb(false);
- }
-
- LLViewerObject* objectp = selection->getPrimaryObject();
-
- // Show avatar's name if paying attachment
- if (objectp && objectp->isAttachment())
- {
- while (objectp && !objectp->isAvatar())
- {
- objectp = (LLViewerObject*)objectp->getParent();
- }
- }
-
- if (objectp)
- {
- if (objectp->isAvatar())
- {
- const bool is_group = false;
- LLFloaterPayUtil::payDirectly(&give_money,
- objectp->getID(),
- is_group);
- }
- else
- {
- LLFloaterPayUtil::payViaObject(&give_money, selection);
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ gAgent.setDoNotDisturb(false);
+ }
+
+ LLViewerObject* objectp = selection->getPrimaryObject();
+
+ // Show avatar's name if paying attachment
+ if (objectp && objectp->isAttachment())
+ {
+ while (objectp && !objectp->isAvatar())
+ {
+ objectp = (LLViewerObject*)objectp->getParent();
+ }
+ }
+
+ if (objectp)
+ {
+ if (objectp->isAvatar())
+ {
+ const bool is_group = false;
+ LLFloaterPayUtil::payDirectly(&give_money,
+ objectp->getID(),
+ is_group);
+ }
+ else
+ {
+ LLFloaterPayUtil::payViaObject(&give_money, selection);
+ }
+ }
+ return false;
}
void handle_give_money_dialog()
{
- LLNotification::Params params("DoNotDisturbModePay");
- params.functor.function(boost::bind(complete_give_money, _1, _2, LLSelectMgr::getInstance()->getSelection()));
+ LLNotification::Params params("DoNotDisturbModePay");
+ params.functor.function(boost::bind(complete_give_money, _1, _2, LLSelectMgr::getInstance()->getSelection()));
- if (gAgent.isDoNotDisturb())
- {
- // warn users of being in do not disturb mode during a transaction
- LLNotifications::instance().add(params);
- }
- else
- {
- LLNotifications::instance().forceResponse(params, 1);
- }
+ if (gAgent.isDoNotDisturb())
+ {
+ // warn users of being in do not disturb mode during a transaction
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(params, 1);
+ }
}
bool enable_pay_avatar()
{
- LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- LLVOAvatar* avatar = find_avatar_from_object(obj);
- return (avatar != NULL);
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ LLVOAvatar* avatar = find_avatar_from_object(obj);
+ return (avatar != NULL);
}
bool enable_pay_object()
{
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if( object )
- {
- LLViewerObject *parent = (LLViewerObject *)object->getParent();
- if((object->flagTakesMoney()) || (parent && parent->flagTakesMoney()))
- {
- return true;
- }
- }
- return false;
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if( object )
+ {
+ LLViewerObject *parent = (LLViewerObject *)object->getParent();
+ if((object->flagTakesMoney()) || (parent && parent->flagTakesMoney()))
+ {
+ return true;
+ }
+ }
+ return false;
}
bool enable_object_stand_up()
{
- // 'Object Stand Up' menu item is enabled when agent is sitting on selection
- return sitting_on_selection();
+ // 'Object Stand Up' menu item is enabled when agent is sitting on selection
+ return sitting_on_selection();
}
bool enable_object_sit(LLUICtrl* ctrl)
{
- // 'Object Sit' menu item is enabled when agent is not sitting on selection
- bool sitting_on_sel = sitting_on_selection();
- if (!sitting_on_sel)
- {
- // init default labels
- init_default_item_label(ctrl);
-
- // Update label
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (node && node->mValid && !node->mSitName.empty())
- {
- ctrl->setValue(node->mSitName);
- }
- else
- {
- ctrl->setValue(get_default_item_label(ctrl->getName()));
- }
- }
- return !sitting_on_sel && is_object_sittable();
+ // 'Object Sit' menu item is enabled when agent is not sitting on selection
+ bool sitting_on_sel = sitting_on_selection();
+ if (!sitting_on_sel)
+ {
+ // init default labels
+ init_default_item_label(ctrl);
+
+ // Update label
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if (node && node->mValid && !node->mSitName.empty())
+ {
+ ctrl->setValue(node->mSitName);
+ }
+ else
+ {
+ ctrl->setValue(get_default_item_label(ctrl->getName()));
+ }
+ }
+ return !sitting_on_sel && is_object_sittable();
}
void dump_select_mgr(void*)
{
- LLSelectMgr::getInstance()->dump();
+ LLSelectMgr::getInstance()->dump();
}
void dump_inventory(void*)
{
- gInventory.dumpInventory();
+ gInventory.dumpInventory();
}
void handle_dump_followcam(void*)
{
- LLFollowCamMgr::getInstance()->dump();
+ LLFollowCamMgr::getInstance()->dump();
}
void handle_viewer_enable_message_log(void*)
{
- gMessageSystem->startLogging();
+ gMessageSystem->startLogging();
}
void handle_viewer_disable_message_log(void*)
{
- gMessageSystem->stopLogging();
+ gMessageSystem->stopLogging();
}
void handle_customize_avatar()
{
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits"));
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits"));
}
void handle_edit_outfit()
{
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
}
void handle_now_wearing()
@@ -6747,225 +6747,225 @@ void handle_now_wearing()
void handle_edit_shape()
{
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_shape"));
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_shape"));
}
void handle_hover_height()
{
- LLFloaterReg::showInstance("edit_hover_height");
+ LLFloaterReg::showInstance("edit_hover_height");
}
void handle_edit_physics()
{
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_physics"));
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_physics"));
}
void handle_report_abuse()
{
- // Prevent menu from appearing in screen shot.
- gMenuHolder->hideMenus();
- LLFloaterReporter::showFromMenu(COMPLAINT_REPORT);
+ // Prevent menu from appearing in screen shot.
+ gMenuHolder->hideMenus();
+ LLFloaterReporter::showFromMenu(COMPLAINT_REPORT);
}
void handle_buy_currency()
{
- LLBuyCurrencyHTML::openCurrencyFloater();
+ LLBuyCurrencyHTML::openCurrencyFloater();
}
class LLFloaterVisible : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string floater_name = userdata.asString();
- bool new_value = false;
- {
- new_value = LLFloaterReg::instanceVisible(floater_name);
- }
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string floater_name = userdata.asString();
+ bool new_value = false;
+ {
+ new_value = LLFloaterReg::instanceVisible(floater_name);
+ }
+ return new_value;
+ }
};
class LLShowHelp : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string help_topic = userdata.asString();
- LLViewerHelp* vhelp = LLViewerHelp::getInstance();
- vhelp->showTopic(help_topic);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string help_topic = userdata.asString();
+ LLViewerHelp* vhelp = LLViewerHelp::getInstance();
+ vhelp->showTopic(help_topic);
+ return true;
+ }
};
class LLToggleHelp : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloater* help_browser = (LLFloaterReg::findInstance("help_browser"));
- if (help_browser && help_browser->isInVisibleChain())
- {
- help_browser->closeFloater();
- }
- else
- {
- std::string help_topic = userdata.asString();
- LLViewerHelp* vhelp = LLViewerHelp::getInstance();
- vhelp->showTopic(help_topic);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloater* help_browser = (LLFloaterReg::findInstance("help_browser"));
+ if (help_browser && help_browser->isInVisibleChain())
+ {
+ help_browser->closeFloater();
+ }
+ else
+ {
+ std::string help_topic = userdata.asString();
+ LLViewerHelp* vhelp = LLViewerHelp::getInstance();
+ vhelp->showTopic(help_topic);
+ }
+ return true;
+ }
};
class LLToggleSpeak : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVoiceClient::getInstance()->toggleUserPTTState();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVoiceClient::getInstance()->toggleUserPTTState();
+ return true;
+ }
};
class LLShowSidetrayPanel : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string floater_name = userdata.asString();
-
- LLPanel* panel = LLFloaterSidePanelContainer::getPanel(floater_name);
- if (panel)
- {
- if (panel->isInVisibleChain())
- {
- LLFloaterReg::getInstance(floater_name)->closeFloater();
- }
- else
- {
- LLFloaterReg::getInstance(floater_name)->openFloater();
- }
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string floater_name = userdata.asString();
+
+ LLPanel* panel = LLFloaterSidePanelContainer::getPanel(floater_name);
+ if (panel)
+ {
+ if (panel->isInVisibleChain())
+ {
+ LLFloaterReg::getInstance(floater_name)->closeFloater();
+ }
+ else
+ {
+ LLFloaterReg::getInstance(floater_name)->openFloater();
+ }
+ }
+ return true;
+ }
};
class LLSidetrayPanelVisible : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string floater_name = userdata.asString();
- // Toggle the panel
- if (LLFloaterReg::getInstance(floater_name)->isInVisibleChain())
- {
- return true;
- }
- else
- {
- return false;
- }
-
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string floater_name = userdata.asString();
+ // Toggle the panel
+ if (LLFloaterReg::getInstance(floater_name)->isInVisibleChain())
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
};
bool callback_show_url(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- LLWeb::loadURL(notification["payload"]["url"].asString());
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ LLWeb::loadURL(notification["payload"]["url"].asString());
+ }
+ return false;
}
class LLPromptShowURL : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string param = userdata.asString();
- std::string::size_type offset = param.find(",");
- if (offset != param.npos)
- {
- std::string alert = param.substr(0, offset);
- std::string url = param.substr(offset+1);
-
- if (LLWeb::useExternalBrowser(url))
- {
- LLSD payload;
- payload["url"] = url;
- LLNotificationsUtil::add(alert, LLSD(), payload, callback_show_url);
- }
- else
- {
- LLWeb::loadURL(url);
- }
- }
- else
- {
- LL_INFOS() << "PromptShowURL invalid parameters! Expecting \"ALERT,URL\"." << LL_ENDL;
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string param = userdata.asString();
+ std::string::size_type offset = param.find(",");
+ if (offset != param.npos)
+ {
+ std::string alert = param.substr(0, offset);
+ std::string url = param.substr(offset+1);
+
+ if (LLWeb::useExternalBrowser(url))
+ {
+ LLSD payload;
+ payload["url"] = url;
+ LLNotificationsUtil::add(alert, LLSD(), payload, callback_show_url);
+ }
+ else
+ {
+ LLWeb::loadURL(url);
+ }
+ }
+ else
+ {
+ LL_INFOS() << "PromptShowURL invalid parameters! Expecting \"ALERT,URL\"." << LL_ENDL;
+ }
+ return true;
+ }
};
bool callback_show_file(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- LLWeb::loadURL(notification["payload"]["url"]);
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ LLWeb::loadURL(notification["payload"]["url"]);
+ }
+ return false;
}
class LLPromptShowFile : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string param = userdata.asString();
- std::string::size_type offset = param.find(",");
- if (offset != param.npos)
- {
- std::string alert = param.substr(0, offset);
- std::string file = param.substr(offset+1);
-
- LLSD payload;
- payload["url"] = file;
- LLNotificationsUtil::add(alert, LLSD(), payload, callback_show_file);
- }
- else
- {
- LL_INFOS() << "PromptShowFile invalid parameters! Expecting \"ALERT,FILE\"." << LL_ENDL;
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string param = userdata.asString();
+ std::string::size_type offset = param.find(",");
+ if (offset != param.npos)
+ {
+ std::string alert = param.substr(0, offset);
+ std::string file = param.substr(offset+1);
+
+ LLSD payload;
+ payload["url"] = file;
+ LLNotificationsUtil::add(alert, LLSD(), payload, callback_show_file);
+ }
+ else
+ {
+ LL_INFOS() << "PromptShowFile invalid parameters! Expecting \"ALERT,FILE\"." << LL_ENDL;
+ }
+ return true;
+ }
};
class LLShowAgentProfile : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLUUID agent_id;
- if (userdata.asString() == "agent")
- {
- agent_id = gAgent.getID();
- }
- else if (userdata.asString() == "hit object")
- {
- LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (objectp)
- {
- agent_id = objectp->getID();
- }
- }
- else
- {
- agent_id = userdata.asUUID();
- }
-
- LLVOAvatar* avatar = find_avatar_from_object(agent_id);
- if (avatar)
- {
- LLAvatarActions::showProfile(avatar->getID());
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLUUID agent_id;
+ if (userdata.asString() == "agent")
+ {
+ agent_id = gAgent.getID();
+ }
+ else if (userdata.asString() == "hit object")
+ {
+ LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (objectp)
+ {
+ agent_id = objectp->getID();
+ }
+ }
+ else
+ {
+ agent_id = userdata.asUUID();
+ }
+
+ LLVOAvatar* avatar = find_avatar_from_object(agent_id);
+ if (avatar)
+ {
+ LLAvatarActions::showProfile(avatar->getID());
+ }
+ return true;
+ }
};
class LLShowAgentProfilePicks : public view_listener_t
@@ -6979,164 +6979,164 @@ class LLShowAgentProfilePicks : public view_listener_t
class LLToggleAgentProfile : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLUUID agent_id;
- if (userdata.asString() == "agent")
- {
- agent_id = gAgent.getID();
- }
- else if (userdata.asString() == "hit object")
- {
- LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (objectp)
- {
- agent_id = objectp->getID();
- }
- }
- else
- {
- agent_id = userdata.asUUID();
- }
-
- LLVOAvatar* avatar = find_avatar_from_object(agent_id);
- if (avatar)
- {
- if (!LLAvatarActions::profileVisible(avatar->getID()))
- {
- LLAvatarActions::showProfile(avatar->getID());
- }
- else
- {
- LLAvatarActions::hideProfile(avatar->getID());
- }
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLUUID agent_id;
+ if (userdata.asString() == "agent")
+ {
+ agent_id = gAgent.getID();
+ }
+ else if (userdata.asString() == "hit object")
+ {
+ LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (objectp)
+ {
+ agent_id = objectp->getID();
+ }
+ }
+ else
+ {
+ agent_id = userdata.asUUID();
+ }
+
+ LLVOAvatar* avatar = find_avatar_from_object(agent_id);
+ if (avatar)
+ {
+ if (!LLAvatarActions::profileVisible(avatar->getID()))
+ {
+ LLAvatarActions::showProfile(avatar->getID());
+ }
+ else
+ {
+ LLAvatarActions::hideProfile(avatar->getID());
+ }
+ }
+ return true;
+ }
};
class LLLandEdit : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgentCamera.getFocusOnAvatar() && gSavedSettings.getBOOL("EditCameraMovement") )
- {
- // zoom in if we're looking at the avatar
- gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
- gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (gAgentCamera.getFocusOnAvatar() && gSavedSettings.getBOOL("EditCameraMovement") )
+ {
+ // zoom in if we're looking at the avatar
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+ gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gAgentCamera.cameraOrbitOver( F_PI * 0.25f );
- gViewerWindow->moveCursorToCenter();
- }
- else if ( gSavedSettings.getBOOL("EditCameraMovement") )
- {
- gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gViewerWindow->moveCursorToCenter();
- }
+ gAgentCamera.cameraOrbitOver( F_PI * 0.25f );
+ gViewerWindow->moveCursorToCenter();
+ }
+ else if ( gSavedSettings.getBOOL("EditCameraMovement") )
+ {
+ gAgentCamera.setFocusGlobal(LLToolPie::getInstance()->getPick());
+ gViewerWindow->moveCursorToCenter();
+ }
- LLViewerParcelMgr::getInstance()->selectParcelAt( LLToolPie::getInstance()->getPick().mPosGlobal );
+ LLViewerParcelMgr::getInstance()->selectParcelAt( LLToolPie::getInstance()->getPick().mPosGlobal );
- LLFloaterReg::showInstance("build");
+ LLFloaterReg::showInstance("build");
- // Switch to land edit toolset
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolSelectLand::getInstance() );
- return true;
- }
+ // Switch to land edit toolset
+ LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolSelectLand::getInstance() );
+ return true;
+ }
};
class LLMuteParticle : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLUUID id = LLToolPie::getInstance()->getPick().mParticleOwnerID;
-
- if (id.notNull())
- {
- LLAvatarName av_name;
- LLAvatarNameCache::get(id, &av_name);
-
- LLMute mute(id, av_name.getUserName(), LLMute::AGENT);
- if (LLMuteList::getInstance()->isMuted(mute.mID))
- {
- LLMuteList::getInstance()->remove(mute);
- }
- else
- {
- LLMuteList::getInstance()->add(mute);
- LLPanelBlockedList::showPanelAndSelect(mute.mID);
- }
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLUUID id = LLToolPie::getInstance()->getPick().mParticleOwnerID;
+
+ if (id.notNull())
+ {
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(id, &av_name);
+
+ LLMute mute(id, av_name.getUserName(), LLMute::AGENT);
+ if (LLMuteList::getInstance()->isMuted(mute.mID))
+ {
+ LLMuteList::getInstance()->remove(mute);
+ }
+ else
+ {
+ LLMuteList::getInstance()->add(mute);
+ LLPanelBlockedList::showPanelAndSelect(mute.mID);
+ }
+ }
+
+ return true;
+ }
};
class LLWorldEnableBuyLand : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLViewerParcelMgr::getInstance()->canAgentBuyParcel(
- LLViewerParcelMgr::getInstance()->selectionEmpty()
- ? LLViewerParcelMgr::getInstance()->getAgentParcel()
- : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(),
- false);
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLViewerParcelMgr::getInstance()->canAgentBuyParcel(
+ LLViewerParcelMgr::getInstance()->selectionEmpty()
+ ? LLViewerParcelMgr::getInstance()->getAgentParcel()
+ : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(),
+ false);
+ return new_value;
+ }
};
BOOL enable_buy_land(void*)
{
- return LLViewerParcelMgr::getInstance()->canAgentBuyParcel(
- LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false);
+ return LLViewerParcelMgr::getInstance()->canAgentBuyParcel(
+ LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false);
}
void handle_buy_land()
{
- LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
- if (vpm->selectionEmpty())
- {
- vpm->selectParcelAt(gAgent.getPositionGlobal());
- }
- vpm->startBuyLand();
+ LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
+ if (vpm->selectionEmpty())
+ {
+ vpm->selectParcelAt(gAgent.getPositionGlobal());
+ }
+ vpm->startBuyLand();
}
class LLObjectAttachToAvatar : public view_listener_t
{
public:
- LLObjectAttachToAvatar(bool replace) : mReplace(replace) {}
- static void setObjectSelection(LLObjectSelectionHandle selection) { sObjectSelection = selection; }
+ LLObjectAttachToAvatar(bool replace) : mReplace(replace) {}
+ static void setObjectSelection(LLObjectSelectionHandle selection) { sObjectSelection = selection; }
private:
- bool handleEvent(const LLSD& userdata)
- {
- setObjectSelection(LLSelectMgr::getInstance()->getSelection());
- LLViewerObject* selectedObject = sObjectSelection->getFirstRootObject();
- if (selectedObject)
- {
- S32 index = userdata.asInteger();
- LLViewerJointAttachment* attachment_point = NULL;
- if (index > 0)
- attachment_point = get_if_there(gAgentAvatarp->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL);
- confirmReplaceAttachment(0, attachment_point);
- }
- return true;
- }
-
- static void onNearAttachObject(BOOL success, void *user_data);
- void confirmReplaceAttachment(S32 option, LLViewerJointAttachment* attachment_point);
- class CallbackData : public LLSelectionCallbackData
- {
- public:
- CallbackData(LLViewerJointAttachment* point, bool replace) : LLSelectionCallbackData(), mAttachmentPoint(point), mReplace(replace) {}
-
- LLViewerJointAttachment* mAttachmentPoint;
- bool mReplace;
- };
+ bool handleEvent(const LLSD& userdata)
+ {
+ setObjectSelection(LLSelectMgr::getInstance()->getSelection());
+ LLViewerObject* selectedObject = sObjectSelection->getFirstRootObject();
+ if (selectedObject)
+ {
+ S32 index = userdata.asInteger();
+ LLViewerJointAttachment* attachment_point = NULL;
+ if (index > 0)
+ attachment_point = get_if_there(gAgentAvatarp->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL);
+ confirmReplaceAttachment(0, attachment_point);
+ }
+ return true;
+ }
+
+ static void onNearAttachObject(BOOL success, void *user_data);
+ void confirmReplaceAttachment(S32 option, LLViewerJointAttachment* attachment_point);
+ class CallbackData : public LLSelectionCallbackData
+ {
+ public:
+ CallbackData(LLViewerJointAttachment* point, bool replace) : LLSelectionCallbackData(), mAttachmentPoint(point), mReplace(replace) {}
+
+ LLViewerJointAttachment* mAttachmentPoint;
+ bool mReplace;
+ };
protected:
- static LLObjectSelectionHandle sObjectSelection;
- bool mReplace;
+ static LLObjectSelectionHandle sObjectSelection;
+ bool mReplace;
};
LLObjectSelectionHandle LLObjectAttachToAvatar::sObjectSelection;
@@ -7144,238 +7144,238 @@ LLObjectSelectionHandle LLObjectAttachToAvatar::sObjectSelection;
// static
void LLObjectAttachToAvatar::onNearAttachObject(BOOL success, void *user_data)
{
- if (!user_data) return;
- CallbackData* cb_data = static_cast<CallbackData*>(user_data);
-
- if (success)
- {
- const LLViewerJointAttachment *attachment = cb_data->mAttachmentPoint;
-
- U8 attachment_id = 0;
- if (attachment)
- {
- for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
- {
- if (iter->second == attachment)
- {
- attachment_id = iter->first;
- break;
- }
- }
- }
- else
- {
- // interpret 0 as "default location"
- attachment_id = 0;
- }
- LLSelectMgr::getInstance()->sendAttach(cb_data->getSelection(), attachment_id, cb_data->mReplace);
- }
- LLObjectAttachToAvatar::setObjectSelection(NULL);
-
- delete cb_data;
+ if (!user_data) return;
+ CallbackData* cb_data = static_cast<CallbackData*>(user_data);
+
+ if (success)
+ {
+ const LLViewerJointAttachment *attachment = cb_data->mAttachmentPoint;
+
+ U8 attachment_id = 0;
+ if (attachment)
+ {
+ for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
+ {
+ if (iter->second == attachment)
+ {
+ attachment_id = iter->first;
+ break;
+ }
+ }
+ }
+ else
+ {
+ // interpret 0 as "default location"
+ attachment_id = 0;
+ }
+ LLSelectMgr::getInstance()->sendAttach(cb_data->getSelection(), attachment_id, cb_data->mReplace);
+ }
+ LLObjectAttachToAvatar::setObjectSelection(NULL);
+
+ delete cb_data;
}
// static
void LLObjectAttachToAvatar::confirmReplaceAttachment(S32 option, LLViewerJointAttachment* attachment_point)
{
- if (option == 0/*YES*/)
- {
- LLViewerObject* selectedObject = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
- if (selectedObject)
- {
- const F32 MIN_STOP_DISTANCE = 1.f; // meters
- const F32 ARM_LENGTH = 0.5f; // meters
- const F32 SCALE_FUDGE = 1.5f;
-
- F32 stop_distance = SCALE_FUDGE * selectedObject->getMaxScale() + ARM_LENGTH;
- if (stop_distance < MIN_STOP_DISTANCE)
- {
- stop_distance = MIN_STOP_DISTANCE;
- }
-
- LLVector3 walkToSpot = selectedObject->getPositionAgent();
-
- // make sure we stop in front of the object
- LLVector3 delta = walkToSpot - gAgent.getPositionAgent();
- delta.normVec();
- delta = delta * 0.5f;
- walkToSpot -= delta;
-
- // The callback will be called even if avatar fails to get close enough to the object, so we won't get a memory leak.
- CallbackData* user_data = new CallbackData(attachment_point, mReplace);
- gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(walkToSpot), "Attach", NULL, onNearAttachObject, user_data, stop_distance);
- gAgentCamera.clearFocusObject();
- }
- }
+ if (option == 0/*YES*/)
+ {
+ LLViewerObject* selectedObject = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject();
+ if (selectedObject)
+ {
+ const F32 MIN_STOP_DISTANCE = 1.f; // meters
+ const F32 ARM_LENGTH = 0.5f; // meters
+ const F32 SCALE_FUDGE = 1.5f;
+
+ F32 stop_distance = SCALE_FUDGE * selectedObject->getMaxScale() + ARM_LENGTH;
+ if (stop_distance < MIN_STOP_DISTANCE)
+ {
+ stop_distance = MIN_STOP_DISTANCE;
+ }
+
+ LLVector3 walkToSpot = selectedObject->getPositionAgent();
+
+ // make sure we stop in front of the object
+ LLVector3 delta = walkToSpot - gAgent.getPositionAgent();
+ delta.normVec();
+ delta = delta * 0.5f;
+ walkToSpot -= delta;
+
+ // The callback will be called even if avatar fails to get close enough to the object, so we won't get a memory leak.
+ CallbackData* user_data = new CallbackData(attachment_point, mReplace);
+ gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(walkToSpot), "Attach", NULL, onNearAttachObject, user_data, stop_distance);
+ gAgentCamera.clearFocusObject();
+ }
+ }
}
void callback_attachment_drop(const LLSD& notification, const LLSD& response)
{
- // Ensure user confirmed the drop
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0) return;
-
- // Called when the user clicked on an object attached to them
- // and selected "Drop".
- LLUUID object_id = notification["payload"]["object_id"].asUUID();
- LLViewerObject *object = gObjectList.findObject(object_id);
-
- if (!object)
- {
- LL_WARNS() << "handle_drop_attachment() - no object to drop" << LL_ENDL;
- return;
- }
-
- LLViewerObject *parent = (LLViewerObject*)object->getParent();
- while (parent)
- {
- if(parent->isAvatar())
- {
- break;
- }
- object = parent;
- parent = (LLViewerObject*)parent->getParent();
- }
-
- if (!object)
- {
- LL_WARNS() << "handle_detach() - no object to detach" << LL_ENDL;
- return;
- }
-
- if (object->isAvatar())
- {
- LL_WARNS() << "Trying to detach avatar from avatar." << LL_ENDL;
- return;
- }
-
- // reselect the object
- LLSelectMgr::getInstance()->selectObjectAndFamily(object);
-
- LLSelectMgr::getInstance()->sendDropAttachment();
-
- return;
+ // Ensure user confirmed the drop
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return;
+
+ // Called when the user clicked on an object attached to them
+ // and selected "Drop".
+ LLUUID object_id = notification["payload"]["object_id"].asUUID();
+ LLViewerObject *object = gObjectList.findObject(object_id);
+
+ if (!object)
+ {
+ LL_WARNS() << "handle_drop_attachment() - no object to drop" << LL_ENDL;
+ return;
+ }
+
+ LLViewerObject *parent = (LLViewerObject*)object->getParent();
+ while (parent)
+ {
+ if(parent->isAvatar())
+ {
+ break;
+ }
+ object = parent;
+ parent = (LLViewerObject*)parent->getParent();
+ }
+
+ if (!object)
+ {
+ LL_WARNS() << "handle_detach() - no object to detach" << LL_ENDL;
+ return;
+ }
+
+ if (object->isAvatar())
+ {
+ LL_WARNS() << "Trying to detach avatar from avatar." << LL_ENDL;
+ return;
+ }
+
+ // reselect the object
+ LLSelectMgr::getInstance()->selectObjectAndFamily(object);
+
+ LLSelectMgr::getInstance()->sendDropAttachment();
+
+ return;
}
class LLAttachmentDrop : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLSD payload;
- LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLSD payload;
+ LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (object)
- {
- payload["object_id"] = object->getID();
- }
- else
- {
- LL_WARNS() << "Drop object not found" << LL_ENDL;
- return true;
- }
+ if (object)
+ {
+ payload["object_id"] = object->getID();
+ }
+ else
+ {
+ LL_WARNS() << "Drop object not found" << LL_ENDL;
+ return true;
+ }
- LLNotificationsUtil::add("AttachmentDrop", LLSD(), payload, &callback_attachment_drop);
- return true;
- }
+ LLNotificationsUtil::add("AttachmentDrop", LLSD(), payload, &callback_attachment_drop);
+ return true;
+ }
};
// called from avatar pie menu
class LLAttachmentDetachFromPoint : public view_listener_t
{
- bool handleEvent(const LLSD& user_data)
- {
- uuid_vec_t ids_to_remove;
- const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
- if (attachment->getNumObjects() > 0)
- {
- for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator iter = attachment->mAttachedObjects.begin();
- iter != attachment->mAttachedObjects.end();
- iter++)
- {
- LLViewerObject *attached_object = iter->get();
- ids_to_remove.push_back(attached_object->getAttachmentItemID());
- }
- }
- if (!ids_to_remove.empty())
- {
- LLAppearanceMgr::instance().removeItemsFromAvatar(ids_to_remove);
- }
- return true;
- }
+ bool handleEvent(const LLSD& user_data)
+ {
+ uuid_vec_t ids_to_remove;
+ const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
+ if (attachment->getNumObjects() > 0)
+ {
+ for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator iter = attachment->mAttachedObjects.begin();
+ iter != attachment->mAttachedObjects.end();
+ iter++)
+ {
+ LLViewerObject *attached_object = iter->get();
+ ids_to_remove.push_back(attached_object->getAttachmentItemID());
+ }
+ }
+ if (!ids_to_remove.empty())
+ {
+ LLAppearanceMgr::instance().removeItemsFromAvatar(ids_to_remove);
+ }
+ return true;
+ }
};
static bool onEnableAttachmentLabel(LLUICtrl* ctrl, const LLSD& data)
{
- std::string label;
- LLMenuItemGL* menu = dynamic_cast<LLMenuItemGL*>(ctrl);
- if (menu)
- {
- const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL);
- if (attachment)
- {
- label = data["label"].asString();
- for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- const LLViewerObject* attached_object = attachment_iter->get();
- if (attached_object)
- {
- LLViewerInventoryItem* itemp = gInventory.getItem(attached_object->getAttachmentItemID());
- if (itemp)
- {
- label += std::string(" (") + itemp->getName() + std::string(")");
- break;
- }
- }
- }
- }
- menu->setLabel(label);
- }
- return true;
+ std::string label;
+ LLMenuItemGL* menu = dynamic_cast<LLMenuItemGL*>(ctrl);
+ if (menu)
+ {
+ const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL);
+ if (attachment)
+ {
+ label = data["label"].asString();
+ for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ const LLViewerObject* attached_object = attachment_iter->get();
+ if (attached_object)
+ {
+ LLViewerInventoryItem* itemp = gInventory.getItem(attached_object->getAttachmentItemID());
+ if (itemp)
+ {
+ label += std::string(" (") + itemp->getName() + std::string(")");
+ break;
+ }
+ }
+ }
+ }
+ menu->setLabel(label);
+ }
+ return true;
}
class LLAttachmentDetach : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- // Called when the user clicked on an object attached to them
- // and selected "Detach".
- LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object)
- {
- LL_WARNS() << "handle_detach() - no object to detach" << LL_ENDL;
- return true;
- }
-
- LLViewerObject *parent = (LLViewerObject*)object->getParent();
- while (parent)
- {
- if(parent->isAvatar())
- {
- break;
- }
- object = parent;
- parent = (LLViewerObject*)parent->getParent();
- }
-
- if (!object)
- {
- LL_WARNS() << "handle_detach() - no object to detach" << LL_ENDL;
- return true;
- }
-
- if (object->isAvatar())
- {
- LL_WARNS() << "Trying to detach avatar from avatar." << LL_ENDL;
- return true;
- }
-
- LLAppearanceMgr::instance().removeItemFromAvatar(object->getAttachmentItemID());
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ // Called when the user clicked on an object attached to them
+ // and selected "Detach".
+ LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (!object)
+ {
+ LL_WARNS() << "handle_detach() - no object to detach" << LL_ENDL;
+ return true;
+ }
+
+ LLViewerObject *parent = (LLViewerObject*)object->getParent();
+ while (parent)
+ {
+ if(parent->isAvatar())
+ {
+ break;
+ }
+ object = parent;
+ parent = (LLViewerObject*)parent->getParent();
+ }
+
+ if (!object)
+ {
+ LL_WARNS() << "handle_detach() - no object to detach" << LL_ENDL;
+ return true;
+ }
+
+ if (object->isAvatar())
+ {
+ LL_WARNS() << "Trying to detach avatar from avatar." << LL_ENDL;
+ return true;
+ }
+
+ LLAppearanceMgr::instance().removeItemFromAvatar(object->getAttachmentItemID());
+
+ return true;
+ }
};
//Adding an observer for a Jira 2422 and needs to be a fetch observer
@@ -7383,468 +7383,468 @@ class LLAttachmentDetach : public view_listener_t
class LLWornItemFetchedObserver : public LLInventoryFetchItemsObserver
{
public:
- LLWornItemFetchedObserver(const LLUUID& worn_item_id) :
- LLInventoryFetchItemsObserver(worn_item_id)
- {}
- virtual ~LLWornItemFetchedObserver() {}
+ LLWornItemFetchedObserver(const LLUUID& worn_item_id) :
+ LLInventoryFetchItemsObserver(worn_item_id)
+ {}
+ virtual ~LLWornItemFetchedObserver() {}
protected:
- virtual void done()
- {
- gMenuAttachmentSelf->buildDrawLabels();
- gInventory.removeObserver(this);
- delete this;
- }
+ virtual void done()
+ {
+ gMenuAttachmentSelf->buildDrawLabels();
+ gInventory.removeObserver(this);
+ delete this;
+ }
};
// You can only drop items on parcels where you can build.
class LLAttachmentEnableDrop : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- BOOL can_build = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->allowAgentBuild());
-
- //Add an inventory observer to only allow dropping the newly attached item
- //once it exists in your inventory. Look at Jira 2422.
- //-jwolk
-
- // A bug occurs when you wear/drop an item before it actively is added to your inventory
- // if this is the case (you're on a slow sim, etc.) a copy of the object,
- // well, a newly created object with the same properties, is placed
- // in your inventory. Therefore, we disable the drop option until the
- // item is in your inventory
-
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- LLViewerJointAttachment* attachment = NULL;
- LLInventoryItem* item = NULL;
-
- // Do not enable drop if all faces of object are not enabled
- if (object && LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES ))
- {
- S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getAttachmentState());
- attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
-
- if (attachment)
- {
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- // make sure item is in your inventory (it could be a delayed attach message being sent from the sim)
- // so check to see if the item is in the inventory already
- item = gInventory.getItem(attachment_iter->get()->getAttachmentItemID());
- if (!item)
- {
- // Item does not exist, make an observer to enable the pie menu
- // when the item finishes fetching worst case scenario
- // if a fetch is already out there (being sent from a slow sim)
- // we refetch and there are 2 fetches
- LLWornItemFetchedObserver* worn_item_fetched = new LLWornItemFetchedObserver((*attachment_iter)->getAttachmentItemID());
- worn_item_fetched->startFetch();
- gInventory.addObserver(worn_item_fetched);
- }
- }
- }
- }
-
- //now check to make sure that the item is actually in the inventory before we enable dropping it
- bool new_value = enable_detach() && can_build && item;
-
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ BOOL can_build = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->allowAgentBuild());
+
+ //Add an inventory observer to only allow dropping the newly attached item
+ //once it exists in your inventory. Look at Jira 2422.
+ //-jwolk
+
+ // A bug occurs when you wear/drop an item before it actively is added to your inventory
+ // if this is the case (you're on a slow sim, etc.) a copy of the object,
+ // well, a newly created object with the same properties, is placed
+ // in your inventory. Therefore, we disable the drop option until the
+ // item is in your inventory
+
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ LLViewerJointAttachment* attachment = NULL;
+ LLInventoryItem* item = NULL;
+
+ // Do not enable drop if all faces of object are not enabled
+ if (object && LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES ))
+ {
+ S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getAttachmentState());
+ attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
+
+ if (attachment)
+ {
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ // make sure item is in your inventory (it could be a delayed attach message being sent from the sim)
+ // so check to see if the item is in the inventory already
+ item = gInventory.getItem(attachment_iter->get()->getAttachmentItemID());
+ if (!item)
+ {
+ // Item does not exist, make an observer to enable the pie menu
+ // when the item finishes fetching worst case scenario
+ // if a fetch is already out there (being sent from a slow sim)
+ // we refetch and there are 2 fetches
+ LLWornItemFetchedObserver* worn_item_fetched = new LLWornItemFetchedObserver((*attachment_iter)->getAttachmentItemID());
+ worn_item_fetched->startFetch();
+ gInventory.addObserver(worn_item_fetched);
+ }
+ }
+ }
+ }
+
+ //now check to make sure that the item is actually in the inventory before we enable dropping it
+ bool new_value = enable_detach() && can_build && item;
+
+ return new_value;
+ }
};
BOOL enable_detach(const LLSD&)
{
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
-
- // Only enable detach if all faces of object are selected
- if (!object ||
- !object->isAttachment() ||
- !LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES ))
- {
- return FALSE;
- }
+ LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- // Find the avatar who owns this attachment
- LLViewerObject* avatar = object;
- while (avatar)
- {
- // ...if it's you, good to detach
- if (avatar->getID() == gAgent.getID())
- {
- return TRUE;
- }
+ // Only enable detach if all faces of object are selected
+ if (!object ||
+ !object->isAttachment() ||
+ !LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES ))
+ {
+ return FALSE;
+ }
+
+ // Find the avatar who owns this attachment
+ LLViewerObject* avatar = object;
+ while (avatar)
+ {
+ // ...if it's you, good to detach
+ if (avatar->getID() == gAgent.getID())
+ {
+ return TRUE;
+ }
- avatar = (LLViewerObject*)avatar->getParent();
- }
+ avatar = (LLViewerObject*)avatar->getParent();
+ }
- return FALSE;
+ return FALSE;
}
class LLAttachmentEnableDetach : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = enable_detach();
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = enable_detach();
+ return new_value;
+ }
};
// Used to tell if the selected object can be attached to your avatar.
BOOL object_selected_and_point_valid()
{
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- for (LLObjectSelection::root_iterator iter = selection->root_begin();
- iter != selection->root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- LLViewerObject::const_child_list_t& child_list = object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- if (child->isAvatar())
- {
- return FALSE;
- }
- }
- }
-
- return (selection->getRootObjectCount() == 1) &&
- (selection->getFirstRootObject()->getPCode() == LL_PCODE_VOLUME) &&
- selection->getFirstRootObject()->permYouOwner() &&
- selection->getFirstRootObject()->flagObjectMove() &&
- !selection->getFirstRootObject()->flagObjectPermanent() &&
- !((LLViewerObject*)selection->getFirstRootObject()->getRoot())->isAvatar() &&
- (selection->getFirstRootObject()->getNVPair("AssetContainer") == NULL);
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ for (LLObjectSelection::root_iterator iter = selection->root_begin();
+ iter != selection->root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ LLViewerObject::const_child_list_t& child_list = object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ if (child->isAvatar())
+ {
+ return FALSE;
+ }
+ }
+ }
+
+ return (selection->getRootObjectCount() == 1) &&
+ (selection->getFirstRootObject()->getPCode() == LL_PCODE_VOLUME) &&
+ selection->getFirstRootObject()->permYouOwner() &&
+ selection->getFirstRootObject()->flagObjectMove() &&
+ !selection->getFirstRootObject()->flagObjectPermanent() &&
+ !((LLViewerObject*)selection->getFirstRootObject()->getRoot())->isAvatar() &&
+ (selection->getFirstRootObject()->getNVPair("AssetContainer") == NULL);
}
BOOL object_is_wearable()
{
- if (!isAgentAvatarValid())
- {
- return FALSE;
- }
- if (!object_selected_and_point_valid())
- {
- return FALSE;
- }
- if (sitting_on_selection())
- {
- return FALSE;
- }
+ if (!isAgentAvatarValid())
+ {
+ return FALSE;
+ }
+ if (!object_selected_and_point_valid())
+ {
+ return FALSE;
+ }
+ if (sitting_on_selection())
+ {
+ return FALSE;
+ }
if (!gAgentAvatarp->canAttachMoreObjects())
{
return FALSE;
}
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- if (node->mPermissions->getOwner() == gAgent.getID())
- {
- return TRUE;
- }
- }
- return FALSE;
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ if (node->mPermissions->getOwner() == gAgent.getID())
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
class LLAttachmentPointFilled : public view_listener_t
{
- bool handleEvent(const LLSD& user_data)
- {
- bool enable = false;
- LLVOAvatar::attachment_map_t::iterator found_it = gAgentAvatarp->mAttachmentPoints.find(user_data.asInteger());
- if (found_it != gAgentAvatarp->mAttachmentPoints.end())
- {
- enable = found_it->second->getNumObjects() > 0;
- }
- return enable;
- }
+ bool handleEvent(const LLSD& user_data)
+ {
+ bool enable = false;
+ LLVOAvatar::attachment_map_t::iterator found_it = gAgentAvatarp->mAttachmentPoints.find(user_data.asInteger());
+ if (found_it != gAgentAvatarp->mAttachmentPoints.end())
+ {
+ enable = found_it->second->getNumObjects() > 0;
+ }
+ return enable;
+ }
};
class LLAvatarSendIM : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if(avatar)
- {
- LLAvatarActions::startIM(avatar->getID());
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+ if(avatar)
+ {
+ LLAvatarActions::startIM(avatar->getID());
+ }
+ return true;
+ }
};
class LLAvatarCall : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if(avatar)
- {
- LLAvatarActions::startCall(avatar->getID());
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+ if(avatar)
+ {
+ LLAvatarActions::startCall(avatar->getID());
+ }
+ return true;
+ }
};
namespace
{
- struct QueueObjects : public LLSelectedNodeFunctor
- {
- BOOL scripted;
- BOOL modifiable;
- LLFloaterScriptQueue* mQueue;
- QueueObjects(LLFloaterScriptQueue* q) : mQueue(q), scripted(FALSE), modifiable(FALSE) {}
- virtual bool apply(LLSelectNode* node)
- {
- LLViewerObject* obj = node->getObject();
- if (!obj)
- {
- return true;
- }
- scripted = obj->flagScripted();
- modifiable = obj->permModify();
-
- if( scripted && modifiable )
- {
- mQueue->addObject(obj->getID(), node->mName);
- return false;
- }
- else
- {
- return true; // fail: stop applying
- }
- }
- };
+ struct QueueObjects : public LLSelectedNodeFunctor
+ {
+ BOOL scripted;
+ BOOL modifiable;
+ LLFloaterScriptQueue* mQueue;
+ QueueObjects(LLFloaterScriptQueue* q) : mQueue(q), scripted(FALSE), modifiable(FALSE) {}
+ virtual bool apply(LLSelectNode* node)
+ {
+ LLViewerObject* obj = node->getObject();
+ if (!obj)
+ {
+ return true;
+ }
+ scripted = obj->flagScripted();
+ modifiable = obj->permModify();
+
+ if( scripted && modifiable )
+ {
+ mQueue->addObject(obj->getID(), node->mName);
+ return false;
+ }
+ else
+ {
+ return true; // fail: stop applying
+ }
+ }
+ };
}
bool queue_actions(LLFloaterScriptQueue* q, const std::string& msg)
{
- QueueObjects func(q);
- LLSelectMgr *mgr = LLSelectMgr::getInstance();
- LLObjectSelectionHandle selectHandle = mgr->getSelection();
- bool fail = selectHandle->applyToNodes(&func);
- if(fail)
- {
- if ( !func.scripted )
- {
- std::string noscriptmsg = std::string("Cannot") + msg + "SelectObjectsNoScripts";
- LLNotificationsUtil::add(noscriptmsg);
- }
- else if ( !func.modifiable )
- {
- std::string nomodmsg = std::string("Cannot") + msg + "SelectObjectsNoPermission";
- LLNotificationsUtil::add(nomodmsg);
- }
- else
- {
- LL_ERRS() << "Bad logic." << LL_ENDL;
- }
- q->closeFloater();
- }
- else
- {
- if (!q->start())
- {
- LL_WARNS() << "Unexpected script compile failure." << LL_ENDL;
- }
- }
- return !fail;
+ QueueObjects func(q);
+ LLSelectMgr *mgr = LLSelectMgr::getInstance();
+ LLObjectSelectionHandle selectHandle = mgr->getSelection();
+ bool fail = selectHandle->applyToNodes(&func);
+ if(fail)
+ {
+ if ( !func.scripted )
+ {
+ std::string noscriptmsg = std::string("Cannot") + msg + "SelectObjectsNoScripts";
+ LLNotificationsUtil::add(noscriptmsg);
+ }
+ else if ( !func.modifiable )
+ {
+ std::string nomodmsg = std::string("Cannot") + msg + "SelectObjectsNoPermission";
+ LLNotificationsUtil::add(nomodmsg);
+ }
+ else
+ {
+ LL_ERRS() << "Bad logic." << LL_ENDL;
+ }
+ q->closeFloater();
+ }
+ else
+ {
+ if (!q->start())
+ {
+ LL_WARNS() << "Unexpected script compile failure." << LL_ENDL;
+ }
+ }
+ return !fail;
}
class LLToolsSelectedScriptAction : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string action = userdata.asString();
- bool mono = false;
- std::string msg, name;
- std::string title;
- if (action == "compile mono")
- {
- name = "compile_queue";
- mono = true;
- msg = "Recompile";
- title = LLTrans::getString("CompileQueueTitle");
- }
- if (action == "compile lsl")
- {
- name = "compile_queue";
- msg = "Recompile";
- title = LLTrans::getString("CompileQueueTitle");
- }
- else if (action == "reset")
- {
- name = "reset_queue";
- msg = "Reset";
- title = LLTrans::getString("ResetQueueTitle");
- }
- else if (action == "start")
- {
- name = "start_queue";
- msg = "SetRunning";
- title = LLTrans::getString("RunQueueTitle");
- }
- else if (action == "stop")
- {
- name = "stop_queue";
- msg = "SetRunningNot";
- title = LLTrans::getString("NotRunQueueTitle");
- }
- LLUUID id; id.generate();
-
- LLFloaterScriptQueue* queue =LLFloaterReg::getTypedInstance<LLFloaterScriptQueue>(name, LLSD(id));
- if (queue)
- {
- queue->setMono(mono);
- if (queue_actions(queue, msg))
- {
- queue->setTitle(title);
- }
- }
- else
- {
- LL_WARNS() << "Failed to generate LLFloaterScriptQueue with action: " << action << LL_ENDL;
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string action = userdata.asString();
+ bool mono = false;
+ std::string msg, name;
+ std::string title;
+ if (action == "compile mono")
+ {
+ name = "compile_queue";
+ mono = true;
+ msg = "Recompile";
+ title = LLTrans::getString("CompileQueueTitle");
+ }
+ if (action == "compile lsl")
+ {
+ name = "compile_queue";
+ msg = "Recompile";
+ title = LLTrans::getString("CompileQueueTitle");
+ }
+ else if (action == "reset")
+ {
+ name = "reset_queue";
+ msg = "Reset";
+ title = LLTrans::getString("ResetQueueTitle");
+ }
+ else if (action == "start")
+ {
+ name = "start_queue";
+ msg = "SetRunning";
+ title = LLTrans::getString("RunQueueTitle");
+ }
+ else if (action == "stop")
+ {
+ name = "stop_queue";
+ msg = "SetRunningNot";
+ title = LLTrans::getString("NotRunQueueTitle");
+ }
+ LLUUID id; id.generate();
+
+ LLFloaterScriptQueue* queue =LLFloaterReg::getTypedInstance<LLFloaterScriptQueue>(name, LLSD(id));
+ if (queue)
+ {
+ queue->setMono(mono);
+ if (queue_actions(queue, msg))
+ {
+ queue->setTitle(title);
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Failed to generate LLFloaterScriptQueue with action: " << action << LL_ENDL;
+ }
+ return true;
+ }
};
void handle_selected_texture_info(void*)
{
- for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
- {
- LLSelectNode* node = *iter;
-
- std::string msg;
- msg.assign("Texture info for: ");
- msg.append(node->mName);
-
- U8 te_count = node->getObject()->getNumTEs();
- // map from texture ID to list of faces using it
- typedef std::map< LLUUID, std::vector<U8> > map_t;
- map_t faces_per_texture;
- for (U8 i = 0; i < te_count; i++)
- {
- if (!node->isTESelected(i)) continue;
-
- LLViewerTexture* img = node->getObject()->getTEImage(i);
- LLUUID image_id = img->getID();
- faces_per_texture[image_id].push_back(i);
- }
- // Per-texture, dump which faces are using it.
- map_t::iterator it;
- for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it)
- {
- U8 te = it->second[0];
- LLViewerTexture* img = node->getObject()->getTEImage(te);
- S32 height = img->getHeight();
- S32 width = img->getWidth();
- S32 components = img->getComponents();
- msg.append(llformat("\n%dx%d %s on face ",
- width,
- height,
- (components == 4 ? "alpha" : "opaque")));
- for (U8 i = 0; i < it->second.size(); ++i)
- {
- msg.append( llformat("%d ", (S32)(it->second[i])));
- }
- }
- LLSD args;
- args["MESSAGE"] = msg;
- LLNotificationsUtil::add("SystemMessage", args);
- }
+ for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+
+ std::string msg;
+ msg.assign("Texture info for: ");
+ msg.append(node->mName);
+
+ U8 te_count = node->getObject()->getNumTEs();
+ // map from texture ID to list of faces using it
+ typedef std::map< LLUUID, std::vector<U8> > map_t;
+ map_t faces_per_texture;
+ for (U8 i = 0; i < te_count; i++)
+ {
+ if (!node->isTESelected(i)) continue;
+
+ LLViewerTexture* img = node->getObject()->getTEImage(i);
+ LLUUID image_id = img->getID();
+ faces_per_texture[image_id].push_back(i);
+ }
+ // Per-texture, dump which faces are using it.
+ map_t::iterator it;
+ for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it)
+ {
+ U8 te = it->second[0];
+ LLViewerTexture* img = node->getObject()->getTEImage(te);
+ S32 height = img->getHeight();
+ S32 width = img->getWidth();
+ S32 components = img->getComponents();
+ msg.append(llformat("\n%dx%d %s on face ",
+ width,
+ height,
+ (components == 4 ? "alpha" : "opaque")));
+ for (U8 i = 0; i < it->second.size(); ++i)
+ {
+ msg.append( llformat("%d ", (S32)(it->second[i])));
+ }
+ }
+ LLSD args;
+ args["MESSAGE"] = msg;
+ LLNotificationsUtil::add("SystemMessage", args);
+ }
}
void handle_selected_material_info()
{
- for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
- {
- LLSelectNode* node = *iter;
-
- std::string msg;
- msg.assign("Material info for: \n");
- msg.append(node->mName);
-
- U8 te_count = node->getObject()->getNumTEs();
- // map from material ID to list of faces using it
- typedef std::map<LLMaterialID, std::vector<U8> > map_t;
- map_t faces_per_material;
- for (U8 i = 0; i < te_count; i++)
- {
- if (!node->isTESelected(i)) continue;
-
- const LLMaterialID& material_id = node->getObject()->getTE(i)->getMaterialID();
- faces_per_material[material_id].push_back(i);
- }
- // Per-material, dump which faces are using it.
- map_t::iterator it;
- for (it = faces_per_material.begin(); it != faces_per_material.end(); ++it)
- {
- const LLMaterialID& material_id = it->first;
- msg += llformat("%s on face ", material_id.asString().c_str());
- for (U8 i = 0; i < it->second.size(); ++i)
- {
- msg.append( llformat("%d ", (S32)(it->second[i])));
- }
- msg.append("\n");
- }
-
- LLSD args;
- args["MESSAGE"] = msg;
- LLNotificationsUtil::add("SystemMessage", args);
- }
+ for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+
+ std::string msg;
+ msg.assign("Material info for: \n");
+ msg.append(node->mName);
+
+ U8 te_count = node->getObject()->getNumTEs();
+ // map from material ID to list of faces using it
+ typedef std::map<LLMaterialID, std::vector<U8> > map_t;
+ map_t faces_per_material;
+ for (U8 i = 0; i < te_count; i++)
+ {
+ if (!node->isTESelected(i)) continue;
+
+ const LLMaterialID& material_id = node->getObject()->getTE(i)->getMaterialID();
+ faces_per_material[material_id].push_back(i);
+ }
+ // Per-material, dump which faces are using it.
+ map_t::iterator it;
+ for (it = faces_per_material.begin(); it != faces_per_material.end(); ++it)
+ {
+ const LLMaterialID& material_id = it->first;
+ msg += llformat("%s on face ", material_id.asString().c_str());
+ for (U8 i = 0; i < it->second.size(); ++i)
+ {
+ msg.append( llformat("%d ", (S32)(it->second[i])));
+ }
+ msg.append("\n");
+ }
+
+ LLSD args;
+ args["MESSAGE"] = msg;
+ LLNotificationsUtil::add("SystemMessage", args);
+ }
}
void handle_test_male(void*)
{
- LLAppearanceMgr::instance().wearOutfitByName("Male Shape & Outfit");
- //gGestureList.requestResetFromServer( TRUE );
+ LLAppearanceMgr::instance().wearOutfitByName("Male Shape & Outfit");
+ //gGestureList.requestResetFromServer( TRUE );
}
void handle_test_female(void*)
{
- LLAppearanceMgr::instance().wearOutfitByName("Female Shape & Outfit");
- //gGestureList.requestResetFromServer( FALSE );
+ LLAppearanceMgr::instance().wearOutfitByName("Female Shape & Outfit");
+ //gGestureList.requestResetFromServer( FALSE );
}
void handle_dump_attachments(void*)
{
- if(!isAgentAvatarValid()) return;
-
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); )
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- S32 key = curiter->first;
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject *attached_object = attachment_iter->get();
- BOOL visible = (attached_object != NULL &&
- attached_object->mDrawable.notNull() &&
- !attached_object->mDrawable->isRenderType(0));
- LLVector3 pos;
- if (visible) pos = attached_object->mDrawable->getPosition();
- LL_INFOS() << "ATTACHMENT " << key << ": item_id=" << attached_object->getAttachmentItemID()
- << (attached_object ? " present " : " absent ")
- << (visible ? "visible " : "invisible ")
- << " at " << pos
- << " and " << (visible ? attached_object->getPosition() : LLVector3::zero)
- << LL_ENDL;
- }
- }
+ if(!isAgentAvatarValid()) return;
+
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ S32 key = curiter->first;
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject *attached_object = attachment_iter->get();
+ BOOL visible = (attached_object != NULL &&
+ attached_object->mDrawable.notNull() &&
+ !attached_object->mDrawable->isRenderType(0));
+ LLVector3 pos;
+ if (visible) pos = attached_object->mDrawable->getPosition();
+ LL_INFOS() << "ATTACHMENT " << key << ": item_id=" << attached_object->getAttachmentItemID()
+ << (attached_object ? " present " : " absent ")
+ << (visible ? "visible " : "invisible ")
+ << " at " << pos
+ << " and " << (visible ? attached_object->getPosition() : LLVector3::zero)
+ << LL_ENDL;
+ }
+ }
}
@@ -7853,369 +7853,369 @@ class LLToggleControl : public view_listener_t
{
protected:
- bool handleEvent(const LLSD& userdata)
- {
- std::string control_name = userdata.asString();
- BOOL checked = gSavedSettings.getBOOL( control_name );
- gSavedSettings.setBOOL( control_name, !checked );
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string control_name = userdata.asString();
+ BOOL checked = gSavedSettings.getBOOL( control_name );
+ gSavedSettings.setBOOL( control_name, !checked );
+ return true;
+ }
};
class LLCheckControl : public view_listener_t
{
- bool handleEvent( const LLSD& userdata)
- {
- std::string callback_data = userdata.asString();
- bool new_value = gSavedSettings.getBOOL(callback_data);
- return new_value;
- }
+ bool handleEvent( const LLSD& userdata)
+ {
+ std::string callback_data = userdata.asString();
+ bool new_value = gSavedSettings.getBOOL(callback_data);
+ return new_value;
+ }
};
// not so generic
class LLAdvancedCheckRenderShadowOption: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string control_name = userdata.asString();
- S32 current_shadow_level = gSavedSettings.getS32(control_name);
- if (current_shadow_level == 0) // is off
- {
- return false;
- }
- else // is on
- {
- return true;
- }
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string control_name = userdata.asString();
+ S32 current_shadow_level = gSavedSettings.getS32(control_name);
+ if (current_shadow_level == 0) // is off
+ {
+ return false;
+ }
+ else // is on
+ {
+ return true;
+ }
+ }
};
class LLAdvancedClickRenderShadowOption: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string control_name = userdata.asString();
- S32 current_shadow_level = gSavedSettings.getS32(control_name);
- if (current_shadow_level == 0) // upgrade to level 2
- {
- gSavedSettings.setS32(control_name, 2);
- }
- else // downgrade to level 0
- {
- gSavedSettings.setS32(control_name, 0);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string control_name = userdata.asString();
+ S32 current_shadow_level = gSavedSettings.getS32(control_name);
+ if (current_shadow_level == 0) // upgrade to level 2
+ {
+ gSavedSettings.setS32(control_name, 2);
+ }
+ else // downgrade to level 0
+ {
+ gSavedSettings.setS32(control_name, 0);
+ }
+ return true;
+ }
};
class LLAdvancedClickRenderProfile: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gShaderProfileFrame = TRUE;
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gShaderProfileFrame = TRUE;
+ return true;
+ }
};
F32 gpu_benchmark();
class LLAdvancedClickRenderBenchmark: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gpu_benchmark();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gpu_benchmark();
+ return true;
+ }
};
// these are used in the gl menus to set control values that require shader recompilation
class LLToggleShaderControl : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
+ bool handleEvent(const LLSD& userdata)
+ {
std::string control_name = userdata.asString();
- BOOL checked = gSavedSettings.getBOOL( control_name );
- gSavedSettings.setBOOL( control_name, !checked );
+ BOOL checked = gSavedSettings.getBOOL( control_name );
+ gSavedSettings.setBOOL( control_name, !checked );
LLPipeline::refreshCachedSettings();
LLViewerShaderMgr::instance()->setShaders();
- return !checked;
- }
+ return !checked;
+ }
};
void menu_toggle_attached_lights(void* user_data)
{
- LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
+ LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
}
void menu_toggle_attached_particles(void* user_data)
{
- LLPipeline::sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles");
+ LLPipeline::sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles");
}
class LLAdvancedHandleAttachedLightParticles: public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string control_name = userdata.asString();
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string control_name = userdata.asString();
- // toggle the control
- gSavedSettings.setBOOL(control_name,
- !gSavedSettings.getBOOL(control_name));
+ // toggle the control
+ gSavedSettings.setBOOL(control_name,
+ !gSavedSettings.getBOOL(control_name));
- // update internal flags
- if (control_name == "RenderAttachedLights")
- {
- menu_toggle_attached_lights(NULL);
- }
- else if (control_name == "RenderAttachedParticles")
- {
- menu_toggle_attached_particles(NULL);
- }
- return true;
- }
+ // update internal flags
+ if (control_name == "RenderAttachedLights")
+ {
+ menu_toggle_attached_lights(NULL);
+ }
+ else if (control_name == "RenderAttachedParticles")
+ {
+ menu_toggle_attached_particles(NULL);
+ }
+ return true;
+ }
};
class LLSomethingSelected : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = !(LLSelectMgr::getInstance()->getSelection()->isEmpty());
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = !(LLSelectMgr::getInstance()->getSelection()->isEmpty());
+ return new_value;
+ }
};
class LLSomethingSelectedNoHUD : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- bool new_value = !(selection->isEmpty()) && !(selection->getSelectType() == SELECT_TYPE_HUD);
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ bool new_value = !(selection->isEmpty()) && !(selection->getSelectType() == SELECT_TYPE_HUD);
+ return new_value;
+ }
};
static bool is_editable_selected()
{
- return (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL);
+ return (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL);
}
class LLEditableSelected : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return is_editable_selected();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return is_editable_selected();
+ }
};
class LLEditableSelectedMono : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = false;
- LLViewerRegion* region = gAgent.getRegion();
- if(region && gMenuHolder)
- {
- bool have_cap = (! region->getCapability("UpdateScriptTask").empty());
- new_value = is_editable_selected() && have_cap;
- }
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = false;
+ LLViewerRegion* region = gAgent.getRegion();
+ if(region && gMenuHolder)
+ {
+ bool have_cap = (! region->getCapability("UpdateScriptTask").empty());
+ new_value = is_editable_selected() && have_cap;
+ }
+ return new_value;
+ }
};
bool enable_object_take_copy()
{
- bool all_valid = false;
- if (LLSelectMgr::getInstance())
- {
- if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() > 0)
- {
- all_valid = true;
+ bool all_valid = false;
+ if (LLSelectMgr::getInstance())
+ {
+ if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() > 0)
+ {
+ all_valid = true;
#ifndef HACKED_GODLIKE_VIEWER
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (LLGridManager::getInstance()->isInProductionGrid()
+ if (LLGridManager::getInstance()->isInProductionGrid()
|| !gAgent.isGodlike())
# endif
- {
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* obj)
- {
- return (!obj->permCopy() || obj->isAttachment());
- }
- } func;
- const bool firstonly = true;
- bool any_invalid = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly);
- all_valid = !any_invalid;
- }
+ {
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* obj)
+ {
+ return (!obj->permCopy() || obj->isAttachment());
+ }
+ } func;
+ const bool firstonly = true;
+ bool any_invalid = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly);
+ all_valid = !any_invalid;
+ }
#endif // HACKED_GODLIKE_VIEWER
- }
- }
+ }
+ }
- return all_valid;
+ return all_valid;
}
class LLHasAsset : public LLInventoryCollectFunctor
{
public:
- LLHasAsset(const LLUUID& id) : mAssetID(id), mHasAsset(FALSE) {}
- virtual ~LLHasAsset() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
- BOOL hasAsset() const { return mHasAsset; }
+ LLHasAsset(const LLUUID& id) : mAssetID(id), mHasAsset(FALSE) {}
+ virtual ~LLHasAsset() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
+ BOOL hasAsset() const { return mHasAsset; }
protected:
- LLUUID mAssetID;
- BOOL mHasAsset;
+ LLUUID mAssetID;
+ BOOL mHasAsset;
};
bool LLHasAsset::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
+ LLInventoryItem* item)
{
- if(item && item->getAssetUUID() == mAssetID)
- {
- mHasAsset = TRUE;
- }
- return FALSE;
+ if(item && item->getAssetUUID() == mAssetID)
+ {
+ mHasAsset = TRUE;
+ }
+ return FALSE;
}
BOOL enable_save_into_task_inventory(void*)
{
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if(node && (node->mValid) && (!node->mFromTaskID.isNull()))
- {
- // *TODO: check to see if the fromtaskid object exists.
- LLViewerObject* obj = node->getObject();
- if( obj && !obj->isAttachment() )
- {
- return TRUE;
- }
- }
- return FALSE;
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if(node && (node->mValid) && (!node->mFromTaskID.isNull()))
+ {
+ // *TODO: check to see if the fromtaskid object exists.
+ LLViewerObject* obj = node->getObject();
+ if( obj && !obj->isAttachment() )
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
class LLToolsEnableSaveToObjectInventory : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = enable_save_into_task_inventory(NULL);
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = enable_save_into_task_inventory(NULL);
+ return new_value;
+ }
};
class LLToggleHowTo : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloaterReg::toggleInstanceOrBringToFront("guidebook");
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloaterReg::toggleInstanceOrBringToFront("guidebook");
+ return true;
+ }
};
class LLViewEnableMouselook : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- // You can't go directly from customize avatar to mouselook.
- // TODO: write code with appropriate dialogs to handle this transition.
- bool new_value = (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() && !gSavedSettings.getBOOL("FreezeTime"));
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ // You can't go directly from customize avatar to mouselook.
+ // TODO: write code with appropriate dialogs to handle this transition.
+ bool new_value = (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() && !gSavedSettings.getBOOL("FreezeTime"));
+ return new_value;
+ }
};
class LLToolsEnableToolNotPie : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = ( LLToolMgr::getInstance()->getBaseTool() != LLToolPie::getInstance() );
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = ( LLToolMgr::getInstance()->getBaseTool() != LLToolPie::getInstance() );
+ return new_value;
+ }
};
class LLWorldEnableCreateLandmark : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return !LLLandmarkActions::landmarkAlreadyExists();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return !LLLandmarkActions::landmarkAlreadyExists();
+ }
};
class LLWorldEnableSetHomeLocation : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gAgent.isGodlike() ||
- (gAgent.getRegion() && gAgent.getRegion()->getAllowSetHome());
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gAgent.isGodlike() ||
+ (gAgent.getRegion() && gAgent.getRegion()->getAllowSetHome());
+ return new_value;
+ }
};
class LLWorldEnableTeleportHome : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerRegion* regionp = gAgent.getRegion();
- bool agent_on_prelude = (regionp && regionp->isPrelude());
- bool enable_teleport_home = gAgent.isGodlike() || !agent_on_prelude;
- return enable_teleport_home;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLViewerRegion* regionp = gAgent.getRegion();
+ bool agent_on_prelude = (regionp && regionp->isPrelude());
+ bool enable_teleport_home = gAgent.isGodlike() || !agent_on_prelude;
+ return enable_teleport_home;
+ }
};
BOOL enable_god_full(void*)
{
- return gAgent.getGodLevel() >= GOD_FULL;
+ return gAgent.getGodLevel() >= GOD_FULL;
}
BOOL enable_god_liaison(void*)
{
- return gAgent.getGodLevel() >= GOD_LIAISON;
+ return gAgent.getGodLevel() >= GOD_LIAISON;
}
bool is_god_customer_service()
{
- return gAgent.getGodLevel() >= GOD_CUSTOMER_SERVICE;
+ return gAgent.getGodLevel() >= GOD_CUSTOMER_SERVICE;
}
BOOL enable_god_basic(void*)
{
- return gAgent.getGodLevel() > GOD_NOT;
+ return gAgent.getGodLevel() > GOD_NOT;
}
void toggle_show_xui_names(void *)
{
- gSavedSettings.setBOOL("DebugShowXUINames", !gSavedSettings.getBOOL("DebugShowXUINames"));
+ gSavedSettings.setBOOL("DebugShowXUINames", !gSavedSettings.getBOOL("DebugShowXUINames"));
}
BOOL check_show_xui_names(void *)
{
- return gSavedSettings.getBOOL("DebugShowXUINames");
+ return gSavedSettings.getBOOL("DebugShowXUINames");
}
class LLToolsSelectOnlyMyObjects : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- BOOL cur_val = gSavedSettings.getBOOL("SelectOwnedOnly");
+ bool handleEvent(const LLSD& userdata)
+ {
+ BOOL cur_val = gSavedSettings.getBOOL("SelectOwnedOnly");
- gSavedSettings.setBOOL("SelectOwnedOnly", ! cur_val );
+ gSavedSettings.setBOOL("SelectOwnedOnly", ! cur_val );
- return true;
- }
+ return true;
+ }
};
class LLToolsSelectOnlyMovableObjects : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- BOOL cur_val = gSavedSettings.getBOOL("SelectMovableOnly");
+ bool handleEvent(const LLSD& userdata)
+ {
+ BOOL cur_val = gSavedSettings.getBOOL("SelectMovableOnly");
- gSavedSettings.setBOOL("SelectMovableOnly", ! cur_val );
+ gSavedSettings.setBOOL("SelectMovableOnly", ! cur_val );
- return true;
- }
+ return true;
+ }
};
class LLToolsSelectInvisibleObjects : public view_listener_t
@@ -8244,178 +8244,178 @@ class LLToolsSelectReflectionProbes: public view_listener_t
class LLToolsSelectBySurrounding : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLSelectMgr::sRectSelectInclusive = !LLSelectMgr::sRectSelectInclusive;
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLSelectMgr::sRectSelectInclusive = !LLSelectMgr::sRectSelectInclusive;
- gSavedSettings.setBOOL("RectangleSelectInclusive", LLSelectMgr::sRectSelectInclusive);
- return true;
- }
+ gSavedSettings.setBOOL("RectangleSelectInclusive", LLSelectMgr::sRectSelectInclusive);
+ return true;
+ }
};
class LLToolsShowHiddenSelection : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- // TomY TODO Merge these
- LLSelectMgr::sRenderHiddenSelections = !LLSelectMgr::sRenderHiddenSelections;
+ bool handleEvent(const LLSD& userdata)
+ {
+ // TomY TODO Merge these
+ LLSelectMgr::sRenderHiddenSelections = !LLSelectMgr::sRenderHiddenSelections;
- gSavedSettings.setBOOL("RenderHiddenSelections", LLSelectMgr::sRenderHiddenSelections);
- return true;
- }
+ gSavedSettings.setBOOL("RenderHiddenSelections", LLSelectMgr::sRenderHiddenSelections);
+ return true;
+ }
};
class LLToolsShowSelectionLightRadius : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- // TomY TODO merge these
- LLSelectMgr::sRenderLightRadius = !LLSelectMgr::sRenderLightRadius;
+ bool handleEvent(const LLSD& userdata)
+ {
+ // TomY TODO merge these
+ LLSelectMgr::sRenderLightRadius = !LLSelectMgr::sRenderLightRadius;
- gSavedSettings.setBOOL("RenderLightRadius", LLSelectMgr::sRenderLightRadius);
- return true;
- }
+ gSavedSettings.setBOOL("RenderLightRadius", LLSelectMgr::sRenderLightRadius);
+ return true;
+ }
};
class LLToolsEditLinkedParts : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- BOOL select_individuals = !gSavedSettings.getBOOL("EditLinkedParts");
- gSavedSettings.setBOOL( "EditLinkedParts", select_individuals );
- if (select_individuals)
- {
- LLSelectMgr::getInstance()->demoteSelectionToIndividuals();
- }
- else
- {
- LLSelectMgr::getInstance()->promoteSelectionToRoot();
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ BOOL select_individuals = !gSavedSettings.getBOOL("EditLinkedParts");
+ gSavedSettings.setBOOL( "EditLinkedParts", select_individuals );
+ if (select_individuals)
+ {
+ LLSelectMgr::getInstance()->demoteSelectionToIndividuals();
+ }
+ else
+ {
+ LLSelectMgr::getInstance()->promoteSelectionToRoot();
+ }
+ return true;
+ }
};
void reload_vertex_shader(void *)
{
- //THIS WOULD BE AN AWESOME PLACE TO RELOAD SHADERS... just a thought - DaveP
+ //THIS WOULD BE AN AWESOME PLACE TO RELOAD SHADERS... just a thought - DaveP
}
void handle_dump_avatar_local_textures(void*)
{
- gAgentAvatarp->dumpLocalTextures();
+ gAgentAvatarp->dumpLocalTextures();
}
void handle_dump_timers()
{
- LLTrace::BlockTimer::dumpCurTimes();
+ LLTrace::BlockTimer::dumpCurTimes();
}
void handle_debug_avatar_textures(void*)
{
- LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (objectp)
- {
- LLFloaterReg::showInstance( "avatar_textures", LLSD(objectp->getID()) );
- }
+ LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ if (objectp)
+ {
+ LLFloaterReg::showInstance( "avatar_textures", LLSD(objectp->getID()) );
+ }
}
void handle_grab_baked_texture(void* data)
{
- EBakedTextureIndex baked_tex_index = (EBakedTextureIndex)((intptr_t)data);
- if (!isAgentAvatarValid()) return;
-
- const LLUUID& asset_id = gAgentAvatarp->grabBakedTexture(baked_tex_index);
- LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << LL_ENDL;
- LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
- LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
- const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type));
- if(folder_id.notNull())
- {
- std::string name;
- name = "Baked " + LLAvatarAppearance::getDictionary()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture";
-
- LLUUID item_id;
- item_id.generate();
- LLPermissions perm;
- perm.init(gAgentID,
- gAgentID,
- LLUUID::null,
- LLUUID::null);
- U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER;
- perm.initMasks(PERM_ALL,
- PERM_ALL,
- PERM_NONE,
- PERM_NONE,
- next_owner_perm);
- time_t creation_date_now = time_corrected();
- LLPointer<LLViewerInventoryItem> item
- = new LLViewerInventoryItem(item_id,
- folder_id,
- perm,
- asset_id,
- asset_type,
- inv_type,
- name,
- LLStringUtil::null,
- LLSaleInfo::DEFAULT,
- LLInventoryItemFlags::II_FLAGS_NONE,
- creation_date_now);
-
- item->updateServer(TRUE);
- gInventory.updateItem(item);
- gInventory.notifyObservers();
-
- // Show the preview panel for textures to let
- // user know that the image is now in inventory.
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
- if(active_panel)
- {
- LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
-
- active_panel->setSelection(item_id, TAKE_FOCUS_NO);
- active_panel->openSelected();
- //LLFloaterInventory::dumpSelectionInformation((void*)view);
- // restore keyboard focus
- gFocusMgr.setKeyboardFocus(focus_ctrl);
- }
- }
- else
- {
- LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL;
- }
+ EBakedTextureIndex baked_tex_index = (EBakedTextureIndex)((intptr_t)data);
+ if (!isAgentAvatarValid()) return;
+
+ const LLUUID& asset_id = gAgentAvatarp->grabBakedTexture(baked_tex_index);
+ LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << LL_ENDL;
+ LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
+ LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
+ const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type));
+ if(folder_id.notNull())
+ {
+ std::string name;
+ name = "Baked " + LLAvatarAppearance::getDictionary()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture";
+
+ LLUUID item_id;
+ item_id.generate();
+ LLPermissions perm;
+ perm.init(gAgentID,
+ gAgentID,
+ LLUUID::null,
+ LLUUID::null);
+ U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER;
+ perm.initMasks(PERM_ALL,
+ PERM_ALL,
+ PERM_NONE,
+ PERM_NONE,
+ next_owner_perm);
+ time_t creation_date_now = time_corrected();
+ LLPointer<LLViewerInventoryItem> item
+ = new LLViewerInventoryItem(item_id,
+ folder_id,
+ perm,
+ asset_id,
+ asset_type,
+ inv_type,
+ name,
+ LLStringUtil::null,
+ LLSaleInfo::DEFAULT,
+ LLInventoryItemFlags::II_FLAGS_NONE,
+ creation_date_now);
+
+ item->updateServer(TRUE);
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+
+ // Show the preview panel for textures to let
+ // user know that the image is now in inventory.
+ LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
+ if(active_panel)
+ {
+ LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
+
+ active_panel->setSelection(item_id, TAKE_FOCUS_NO);
+ active_panel->openSelected();
+ //LLFloaterInventory::dumpSelectionInformation((void*)view);
+ // restore keyboard focus
+ gFocusMgr.setKeyboardFocus(focus_ctrl);
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL;
+ }
}
BOOL enable_grab_baked_texture(void* data)
{
- EBakedTextureIndex index = (EBakedTextureIndex)((intptr_t)data);
- if (isAgentAvatarValid())
- {
- return gAgentAvatarp->canGrabBakedTexture(index);
- }
- return FALSE;
+ EBakedTextureIndex index = (EBakedTextureIndex)((intptr_t)data);
+ if (isAgentAvatarValid())
+ {
+ return gAgentAvatarp->canGrabBakedTexture(index);
+ }
+ return FALSE;
}
// Returns a pointer to the avatar give the UUID of the avatar OR of an attachment the avatar is wearing.
// Returns NULL on failure.
LLVOAvatar* find_avatar_from_object( LLViewerObject* object )
{
- if (object)
- {
- if( object->isAttachment() )
- {
- do
- {
- object = (LLViewerObject*) object->getParent();
- }
- while( object && !object->isAvatar() );
- }
- else if( !object->isAvatar() )
- {
- object = NULL;
- }
- }
+ if (object)
+ {
+ if( object->isAttachment() )
+ {
+ do
+ {
+ object = (LLViewerObject*) object->getParent();
+ }
+ while( object && !object->isAvatar() );
+ }
+ else if( !object->isAvatar() )
+ {
+ object = NULL;
+ }
+ }
- return (LLVOAvatar*) object;
+ return (LLVOAvatar*) object;
}
@@ -8423,13 +8423,13 @@ LLVOAvatar* find_avatar_from_object( LLViewerObject* object )
// Returns NULL on failure.
LLVOAvatar* find_avatar_from_object( const LLUUID& object_id )
{
- return find_avatar_from_object( gObjectList.findObject(object_id) );
+ return find_avatar_from_object( gObjectList.findObject(object_id) );
}
void handle_disconnect_viewer(void *)
{
- LLAppViewer::instance()->forceDisconnect(LLTrans::getString("TestingDisconnect"));
+ LLAppViewer::instance()->forceDisconnect(LLTrans::getString("TestingDisconnect"));
}
void force_error_breakpoint(void *)
@@ -8484,30 +8484,30 @@ void force_error_thread_crash(void *)
class LLToolsUseSelectionForGrid : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLSelectMgr::getInstance()->clearGridObjects();
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* objectp)
- {
- LLSelectMgr::getInstance()->addGridObject(objectp);
- return true;
- }
- } func;
- LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func);
- LLSelectMgr::getInstance()->setGridMode(GRID_MODE_REF_OBJECT);
- LLFloaterTools::setGridMode((S32)GRID_MODE_REF_OBJECT);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLSelectMgr::getInstance()->clearGridObjects();
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* objectp)
+ {
+ LLSelectMgr::getInstance()->addGridObject(objectp);
+ return true;
+ }
+ } func;
+ LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func);
+ LLSelectMgr::getInstance()->setGridMode(GRID_MODE_REF_OBJECT);
+ LLFloaterTools::setGridMode((S32)GRID_MODE_REF_OBJECT);
+ return true;
+ }
};
void handle_test_load_url(void*)
{
- LLWeb::loadURL("");
- LLWeb::loadURL("hacker://www.google.com/");
- LLWeb::loadURL("http");
- LLWeb::loadURL("http://www.google.com/");
+ LLWeb::loadURL("");
+ LLWeb::loadURL("hacker://www.google.com/");
+ LLWeb::loadURL("http");
+ LLWeb::loadURL("http://www.google.com/");
}
//
@@ -8521,86 +8521,86 @@ LLViewerMenuHolderGL::LLViewerMenuHolderGL(const LLViewerMenuHolderGL::Params& p
BOOL LLViewerMenuHolderGL::hideMenus()
{
- BOOL handled = FALSE;
-
- if (LLMenuHolderGL::hideMenus())
- {
- handled = TRUE;
- }
+ BOOL handled = FALSE;
- // drop pie menu selection
- mParcelSelection = NULL;
- mObjectSelection = NULL;
+ if (LLMenuHolderGL::hideMenus())
+ {
+ handled = TRUE;
+ }
+
+ // drop pie menu selection
+ mParcelSelection = NULL;
+ mObjectSelection = NULL;
- if (gMenuBarView)
- {
- gMenuBarView->clearHoverItem();
- gMenuBarView->resetMenuTrigger();
- }
+ if (gMenuBarView)
+ {
+ gMenuBarView->clearHoverItem();
+ gMenuBarView->resetMenuTrigger();
+ }
- return handled;
+ return handled;
}
-void LLViewerMenuHolderGL::setParcelSelection(LLSafeHandle<LLParcelSelection> selection)
-{
- mParcelSelection = selection;
+void LLViewerMenuHolderGL::setParcelSelection(LLSafeHandle<LLParcelSelection> selection)
+{
+ mParcelSelection = selection;
}
-void LLViewerMenuHolderGL::setObjectSelection(LLSafeHandle<LLObjectSelection> selection)
-{
- mObjectSelection = selection;
+void LLViewerMenuHolderGL::setObjectSelection(LLSafeHandle<LLObjectSelection> selection)
+{
+ mObjectSelection = selection;
}
const LLRect LLViewerMenuHolderGL::getMenuRect() const
{
- return LLRect(0, getRect().getHeight() - MENU_BAR_HEIGHT, getRect().getWidth(), STATUS_BAR_HEIGHT);
+ return LLRect(0, getRect().getHeight() - MENU_BAR_HEIGHT, getRect().getWidth(), STATUS_BAR_HEIGHT);
}
void handle_web_browser_test(const LLSD& param)
{
- std::string url = param.asString();
- if (url.empty())
- {
- url = "about:blank";
- }
- LLWeb::loadURLInternal(url);
+ std::string url = param.asString();
+ if (url.empty())
+ {
+ url = "about:blank";
+ }
+ LLWeb::loadURLInternal(url);
}
bool callback_clear_cache_immediately(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if ( option == 0 ) // YES
- {
- //clear cache
- LLAppViewer::instance()->purgeCacheImmediate();
- }
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if ( option == 0 ) // YES
+ {
+ //clear cache
+ LLAppViewer::instance()->purgeCacheImmediate();
+ }
- return false;
+ return false;
}
void handle_cache_clear_immediately()
{
- LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache_immediately);
+ LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache_immediately);
}
void handle_web_content_test(const LLSD& param)
{
- std::string url = param.asString();
- LLWeb::loadURLInternal(url, LLStringUtil::null, LLStringUtil::null, true);
+ std::string url = param.asString();
+ LLWeb::loadURLInternal(url, LLStringUtil::null, LLStringUtil::null, true);
}
void handle_show_url(const LLSD& param)
{
- std::string url = param.asString();
- if (LLWeb::useExternalBrowser(url))
- {
- LLWeb::loadURLExternal(url);
- }
- else
- {
- LLWeb::loadURLInternal(url);
- }
+ std::string url = param.asString();
+ if (LLWeb::useExternalBrowser(url))
+ {
+ LLWeb::loadURLExternal(url);
+ }
+ else
+ {
+ LLWeb::loadURLInternal(url);
+ }
}
@@ -8612,383 +8612,383 @@ void handle_report_bug(const LLSD& param)
void handle_buy_currency_test(void*)
{
- std::string url =
- "http://sarahd-sl-13041.webdev.lindenlab.com/app/lindex/index.php?agent_id=[AGENT_ID]&secure_session_id=[SESSION_ID]&lang=[LANGUAGE]";
+ std::string url =
+ "http://sarahd-sl-13041.webdev.lindenlab.com/app/lindex/index.php?agent_id=[AGENT_ID]&secure_session_id=[SESSION_ID]&lang=[LANGUAGE]";
- LLStringUtil::format_map_t replace;
- replace["[AGENT_ID]"] = gAgent.getID().asString();
- replace["[SESSION_ID]"] = gAgent.getSecureSessionID().asString();
- replace["[LANGUAGE]"] = LLUI::getLanguage();
- LLStringUtil::format(url, replace);
+ LLStringUtil::format_map_t replace;
+ replace["[AGENT_ID]"] = gAgent.getID().asString();
+ replace["[SESSION_ID]"] = gAgent.getSecureSessionID().asString();
+ replace["[LANGUAGE]"] = LLUI::getLanguage();
+ LLStringUtil::format(url, replace);
- LL_INFOS() << "buy currency url " << url << LL_ENDL;
+ LL_INFOS() << "buy currency url " << url << LL_ENDL;
- LLFloaterReg::showInstance("buy_currency_html", LLSD(url));
+ LLFloaterReg::showInstance("buy_currency_html", LLSD(url));
}
// SUNSHINE CLEANUP - is only the request update at the end needed now?
void handle_rebake_textures(void*)
{
- if (!isAgentAvatarValid()) return;
+ if (!isAgentAvatarValid()) return;
- // Slam pending upload count to "unstick" things
- bool slam_for_debug = true;
- gAgentAvatarp->forceBakeAllTextures(slam_for_debug);
- if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion())
- {
- LLAppearanceMgr::instance().requestServerAppearanceUpdate();
- }
+ // Slam pending upload count to "unstick" things
+ bool slam_for_debug = true;
+ gAgentAvatarp->forceBakeAllTextures(slam_for_debug);
+ if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion())
+ {
+ LLAppearanceMgr::instance().requestServerAppearanceUpdate();
+ }
}
void toggle_visibility(void* user_data)
{
- LLView* viewp = (LLView*)user_data;
- viewp->setVisible(!viewp->getVisible());
+ LLView* viewp = (LLView*)user_data;
+ viewp->setVisible(!viewp->getVisible());
}
BOOL get_visibility(void* user_data)
{
- LLView* viewp = (LLView*)user_data;
- return viewp->getVisible();
+ LLView* viewp = (LLView*)user_data;
+ return viewp->getVisible();
}
class LLViewShowHoverTips : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- gSavedSettings.setBOOL("ShowHoverTips", !gSavedSettings.getBOOL("ShowHoverTips"));
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ gSavedSettings.setBOOL("ShowHoverTips", !gSavedSettings.getBOOL("ShowHoverTips"));
+ return true;
+ }
};
class LLViewCheckShowHoverTips : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gSavedSettings.getBOOL("ShowHoverTips");
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = gSavedSettings.getBOOL("ShowHoverTips");
+ return new_value;
+ }
};
class LLViewHighlightTransparent : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLDrawPoolAlpha::sShowDebugAlpha = !LLDrawPoolAlpha::sShowDebugAlpha;
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLDrawPoolAlpha::sShowDebugAlpha = !LLDrawPoolAlpha::sShowDebugAlpha;
// invisible objects skip building their render batches unless sShowDebugAlpha is true, so rebuild batches whenever toggling this flag
- gPipeline.rebuildDrawInfo();
- return true;
- }
+ gPipeline.rebuildDrawInfo();
+ return true;
+ }
};
class LLViewCheckHighlightTransparent : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLDrawPoolAlpha::sShowDebugAlpha;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLDrawPoolAlpha::sShowDebugAlpha;
+ return new_value;
+ }
};
class LLViewBeaconWidth : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string width = userdata.asString();
- if(width == "1")
- {
- gSavedSettings.setS32("DebugBeaconLineWidth", 1);
- }
- else if(width == "4")
- {
- gSavedSettings.setS32("DebugBeaconLineWidth", 4);
- }
- else if(width == "16")
- {
- gSavedSettings.setS32("DebugBeaconLineWidth", 16);
- }
- else if(width == "32")
- {
- gSavedSettings.setS32("DebugBeaconLineWidth", 32);
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string width = userdata.asString();
+ if(width == "1")
+ {
+ gSavedSettings.setS32("DebugBeaconLineWidth", 1);
+ }
+ else if(width == "4")
+ {
+ gSavedSettings.setS32("DebugBeaconLineWidth", 4);
+ }
+ else if(width == "16")
+ {
+ gSavedSettings.setS32("DebugBeaconLineWidth", 16);
+ }
+ else if(width == "32")
+ {
+ gSavedSettings.setS32("DebugBeaconLineWidth", 32);
+ }
+
+ return true;
+ }
};
class LLViewToggleBeacon : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string beacon = userdata.asString();
- if (beacon == "scriptsbeacon")
- {
- LLPipeline::toggleRenderScriptedBeacons();
- gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons() );
- // toggle the other one off if it's on
- if (LLPipeline::getRenderScriptedBeacons() && LLPipeline::getRenderScriptedTouchBeacons())
- {
- LLPipeline::toggleRenderScriptedTouchBeacons();
- gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons() );
- }
- }
- else if (beacon == "physicalbeacon")
- {
- LLPipeline::toggleRenderPhysicalBeacons();
- gSavedSettings.setBOOL( "physicalbeacon", LLPipeline::getRenderPhysicalBeacons() );
- }
- else if (beacon == "moapbeacon")
- {
- LLPipeline::toggleRenderMOAPBeacons();
- gSavedSettings.setBOOL( "moapbeacon", LLPipeline::getRenderMOAPBeacons() );
- }
- else if (beacon == "soundsbeacon")
- {
- LLPipeline::toggleRenderSoundBeacons();
- gSavedSettings.setBOOL( "soundsbeacon", LLPipeline::getRenderSoundBeacons() );
- }
- else if (beacon == "particlesbeacon")
- {
- LLPipeline::toggleRenderParticleBeacons();
- gSavedSettings.setBOOL( "particlesbeacon", LLPipeline::getRenderParticleBeacons() );
- }
- else if (beacon == "scripttouchbeacon")
- {
- LLPipeline::toggleRenderScriptedTouchBeacons();
- gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons() );
- // toggle the other one off if it's on
- if (LLPipeline::getRenderScriptedBeacons() && LLPipeline::getRenderScriptedTouchBeacons())
- {
- LLPipeline::toggleRenderScriptedBeacons();
- gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons() );
- }
- }
- else if (beacon == "sunbeacon")
- {
- gSavedSettings.setBOOL("sunbeacon", !gSavedSettings.getBOOL("sunbeacon"));
- }
- else if (beacon == "moonbeacon")
- {
- gSavedSettings.setBOOL("moonbeacon", !gSavedSettings.getBOOL("moonbeacon"));
- }
- else if (beacon == "renderbeacons")
- {
- LLPipeline::toggleRenderBeacons();
- gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons() );
- // toggle the other one on if it's not
- if (!LLPipeline::getRenderBeacons() && !LLPipeline::getRenderHighlights())
- {
- LLPipeline::toggleRenderHighlights();
- gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights() );
- }
- }
- else if (beacon == "renderhighlights")
- {
- LLPipeline::toggleRenderHighlights();
- gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights() );
- // toggle the other one on if it's not
- if (!LLPipeline::getRenderBeacons() && !LLPipeline::getRenderHighlights())
- {
- LLPipeline::toggleRenderBeacons();
- gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons() );
- }
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string beacon = userdata.asString();
+ if (beacon == "scriptsbeacon")
+ {
+ LLPipeline::toggleRenderScriptedBeacons();
+ gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons() );
+ // toggle the other one off if it's on
+ if (LLPipeline::getRenderScriptedBeacons() && LLPipeline::getRenderScriptedTouchBeacons())
+ {
+ LLPipeline::toggleRenderScriptedTouchBeacons();
+ gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons() );
+ }
+ }
+ else if (beacon == "physicalbeacon")
+ {
+ LLPipeline::toggleRenderPhysicalBeacons();
+ gSavedSettings.setBOOL( "physicalbeacon", LLPipeline::getRenderPhysicalBeacons() );
+ }
+ else if (beacon == "moapbeacon")
+ {
+ LLPipeline::toggleRenderMOAPBeacons();
+ gSavedSettings.setBOOL( "moapbeacon", LLPipeline::getRenderMOAPBeacons() );
+ }
+ else if (beacon == "soundsbeacon")
+ {
+ LLPipeline::toggleRenderSoundBeacons();
+ gSavedSettings.setBOOL( "soundsbeacon", LLPipeline::getRenderSoundBeacons() );
+ }
+ else if (beacon == "particlesbeacon")
+ {
+ LLPipeline::toggleRenderParticleBeacons();
+ gSavedSettings.setBOOL( "particlesbeacon", LLPipeline::getRenderParticleBeacons() );
+ }
+ else if (beacon == "scripttouchbeacon")
+ {
+ LLPipeline::toggleRenderScriptedTouchBeacons();
+ gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons() );
+ // toggle the other one off if it's on
+ if (LLPipeline::getRenderScriptedBeacons() && LLPipeline::getRenderScriptedTouchBeacons())
+ {
+ LLPipeline::toggleRenderScriptedBeacons();
+ gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons() );
+ }
+ }
+ else if (beacon == "sunbeacon")
+ {
+ gSavedSettings.setBOOL("sunbeacon", !gSavedSettings.getBOOL("sunbeacon"));
+ }
+ else if (beacon == "moonbeacon")
+ {
+ gSavedSettings.setBOOL("moonbeacon", !gSavedSettings.getBOOL("moonbeacon"));
+ }
+ else if (beacon == "renderbeacons")
+ {
+ LLPipeline::toggleRenderBeacons();
+ gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons() );
+ // toggle the other one on if it's not
+ if (!LLPipeline::getRenderBeacons() && !LLPipeline::getRenderHighlights())
+ {
+ LLPipeline::toggleRenderHighlights();
+ gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights() );
+ }
+ }
+ else if (beacon == "renderhighlights")
+ {
+ LLPipeline::toggleRenderHighlights();
+ gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights() );
+ // toggle the other one on if it's not
+ if (!LLPipeline::getRenderBeacons() && !LLPipeline::getRenderHighlights())
+ {
+ LLPipeline::toggleRenderBeacons();
+ gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons() );
+ }
+ }
+
+ return true;
+ }
};
class LLViewCheckBeaconEnabled : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string beacon = userdata.asString();
- bool new_value = false;
- if (beacon == "scriptsbeacon")
- {
- new_value = gSavedSettings.getBOOL( "scriptsbeacon");
- LLPipeline::setRenderScriptedBeacons(new_value);
- }
- else if (beacon == "moapbeacon")
- {
- new_value = gSavedSettings.getBOOL( "moapbeacon");
- LLPipeline::setRenderMOAPBeacons(new_value);
- }
- else if (beacon == "physicalbeacon")
- {
- new_value = gSavedSettings.getBOOL( "physicalbeacon");
- LLPipeline::setRenderPhysicalBeacons(new_value);
- }
- else if (beacon == "soundsbeacon")
- {
- new_value = gSavedSettings.getBOOL( "soundsbeacon");
- LLPipeline::setRenderSoundBeacons(new_value);
- }
- else if (beacon == "particlesbeacon")
- {
- new_value = gSavedSettings.getBOOL( "particlesbeacon");
- LLPipeline::setRenderParticleBeacons(new_value);
- }
- else if (beacon == "scripttouchbeacon")
- {
- new_value = gSavedSettings.getBOOL( "scripttouchbeacon");
- LLPipeline::setRenderScriptedTouchBeacons(new_value);
- }
- else if (beacon == "renderbeacons")
- {
- new_value = gSavedSettings.getBOOL( "renderbeacons");
- LLPipeline::setRenderBeacons(new_value);
- }
- else if (beacon == "renderhighlights")
- {
- new_value = gSavedSettings.getBOOL( "renderhighlights");
- LLPipeline::setRenderHighlights(new_value);
- }
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string beacon = userdata.asString();
+ bool new_value = false;
+ if (beacon == "scriptsbeacon")
+ {
+ new_value = gSavedSettings.getBOOL( "scriptsbeacon");
+ LLPipeline::setRenderScriptedBeacons(new_value);
+ }
+ else if (beacon == "moapbeacon")
+ {
+ new_value = gSavedSettings.getBOOL( "moapbeacon");
+ LLPipeline::setRenderMOAPBeacons(new_value);
+ }
+ else if (beacon == "physicalbeacon")
+ {
+ new_value = gSavedSettings.getBOOL( "physicalbeacon");
+ LLPipeline::setRenderPhysicalBeacons(new_value);
+ }
+ else if (beacon == "soundsbeacon")
+ {
+ new_value = gSavedSettings.getBOOL( "soundsbeacon");
+ LLPipeline::setRenderSoundBeacons(new_value);
+ }
+ else if (beacon == "particlesbeacon")
+ {
+ new_value = gSavedSettings.getBOOL( "particlesbeacon");
+ LLPipeline::setRenderParticleBeacons(new_value);
+ }
+ else if (beacon == "scripttouchbeacon")
+ {
+ new_value = gSavedSettings.getBOOL( "scripttouchbeacon");
+ LLPipeline::setRenderScriptedTouchBeacons(new_value);
+ }
+ else if (beacon == "renderbeacons")
+ {
+ new_value = gSavedSettings.getBOOL( "renderbeacons");
+ LLPipeline::setRenderBeacons(new_value);
+ }
+ else if (beacon == "renderhighlights")
+ {
+ new_value = gSavedSettings.getBOOL( "renderhighlights");
+ LLPipeline::setRenderHighlights(new_value);
+ }
+ return new_value;
+ }
};
class LLViewToggleRenderType : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string type = userdata.asString();
- if (type == "hideparticles")
- {
- LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string type = userdata.asString();
+ if (type == "hideparticles")
+ {
+ LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
+ }
+ return true;
+ }
};
class LLViewCheckRenderType : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string type = userdata.asString();
- bool new_value = false;
- if (type == "hideparticles")
- {
- new_value = LLPipeline::toggleRenderTypeControlNegated(LLPipeline::RENDER_TYPE_PARTICLES);
- }
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string type = userdata.asString();
+ bool new_value = false;
+ if (type == "hideparticles")
+ {
+ new_value = LLPipeline::toggleRenderTypeControlNegated(LLPipeline::RENDER_TYPE_PARTICLES);
+ }
+ return new_value;
+ }
};
class LLViewStatusAway : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return (gAgent.isInitialized() && gAgent.getAFK());
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return (gAgent.isInitialized() && gAgent.getAFK());
+ }
};
class LLViewStatusDoNotDisturb : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return (gAgent.isInitialized() && gAgent.isDoNotDisturb());
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return (gAgent.isInitialized() && gAgent.isDoNotDisturb());
+ }
};
class LLViewShowHUDAttachments : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLPipeline::sShowHUDAttachments = !LLPipeline::sShowHUDAttachments;
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLPipeline::sShowHUDAttachments = !LLPipeline::sShowHUDAttachments;
+ return true;
+ }
};
class LLViewCheckHUDAttachments : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLPipeline::sShowHUDAttachments;
- return new_value;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = LLPipeline::sShowHUDAttachments;
+ return new_value;
+ }
};
class LLEditEnableTakeOff : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string clothing = userdata.asString();
- LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(clothing);
- if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT)
- return LLAgentWearables::selfHasWearable(type);
- return false;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string clothing = userdata.asString();
+ LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(clothing);
+ if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT)
+ return LLAgentWearables::selfHasWearable(type);
+ return false;
+ }
};
class LLEditTakeOff : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string clothing = userdata.asString();
- if (clothing == "all")
- LLAppearanceMgr::instance().removeAllClothesFromAvatar();
- else
- {
- LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(clothing);
- if (type >= LLWearableType::WT_SHAPE
- && type < LLWearableType::WT_COUNT
- && (gAgentWearables.getWearableCount(type) > 0))
- {
- // MULTI-WEARABLES: assuming user wanted to remove top shirt.
- U32 wearable_index = gAgentWearables.getWearableCount(type) - 1;
- LLUUID item_id = gAgentWearables.getWearableItemID(type,wearable_index);
- LLAppearanceMgr::instance().removeItemFromAvatar(item_id);
- }
-
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string clothing = userdata.asString();
+ if (clothing == "all")
+ LLAppearanceMgr::instance().removeAllClothesFromAvatar();
+ else
+ {
+ LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(clothing);
+ if (type >= LLWearableType::WT_SHAPE
+ && type < LLWearableType::WT_COUNT
+ && (gAgentWearables.getWearableCount(type) > 0))
+ {
+ // MULTI-WEARABLES: assuming user wanted to remove top shirt.
+ U32 wearable_index = gAgentWearables.getWearableCount(type) - 1;
+ LLUUID item_id = gAgentWearables.getWearableItemID(type,wearable_index);
+ LLAppearanceMgr::instance().removeItemFromAvatar(item_id);
+ }
+
+ }
+ return true;
+ }
};
class LLToolsSelectTool : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string tool_name = userdata.asString();
- if (tool_name == "focus")
- {
- LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(1);
- }
- else if (tool_name == "move")
- {
- LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(2);
- }
- else if (tool_name == "edit")
- {
- LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(3);
- }
- else if (tool_name == "create")
- {
- LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(4);
- }
- else if (tool_name == "land")
- {
- LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(5);
- }
-
- // Note: if floater is not visible LLViewerWindow::updateLayout() will
- // attempt to open it, but it won't bring it to front or de-minimize.
- if (gFloaterTools && (gFloaterTools->isMinimized() || !gFloaterTools->isShown() || !gFloaterTools->isFrontmost()))
- {
- gFloaterTools->setMinimized(FALSE);
- gFloaterTools->openFloater();
- gFloaterTools->setVisibleAndFrontmost(TRUE);
- }
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string tool_name = userdata.asString();
+ if (tool_name == "focus")
+ {
+ LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(1);
+ }
+ else if (tool_name == "move")
+ {
+ LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(2);
+ }
+ else if (tool_name == "edit")
+ {
+ LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(3);
+ }
+ else if (tool_name == "create")
+ {
+ LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(4);
+ }
+ else if (tool_name == "land")
+ {
+ LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(5);
+ }
+
+ // Note: if floater is not visible LLViewerWindow::updateLayout() will
+ // attempt to open it, but it won't bring it to front or de-minimize.
+ if (gFloaterTools && (gFloaterTools->isMinimized() || !gFloaterTools->isShown() || !gFloaterTools->isFrontmost()))
+ {
+ gFloaterTools->setMinimized(FALSE);
+ gFloaterTools->openFloater();
+ gFloaterTools->setVisibleAndFrontmost(TRUE);
+ }
+ return true;
+ }
};
/// WINDLIGHT callbacks
class LLWorldEnvSettings : public view_listener_t
-{
+{
void defocusEnvFloaters()
{
//currently there is only one instance of each floater
@@ -9003,180 +9003,180 @@ class LLWorldEnvSettings : public view_listener_t
}
}
- bool handleEvent(const LLSD& userdata)
- {
- std::string event_name = userdata.asString();
-
- if (event_name == "sunrise")
- {
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string event_name = userdata.asString();
+
+ if (event_name == "sunrise")
+ {
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_SUNRISE, LLEnvironment::TRANSITION_INSTANT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_INSTANT);
defocusEnvFloaters();
- }
- else if (event_name == "noon")
- {
+ }
+ else if (event_name == "noon")
+ {
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_MIDDAY, LLEnvironment::TRANSITION_INSTANT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_INSTANT);
defocusEnvFloaters();
- }
+ }
else if (event_name == "legacy noon")
{
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_LEGACY_MIDDAY, LLEnvironment::TRANSITION_INSTANT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_INSTANT);
defocusEnvFloaters();
}
- else if (event_name == "sunset")
- {
+ else if (event_name == "sunset")
+ {
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_SUNSET, LLEnvironment::TRANSITION_INSTANT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_INSTANT);
defocusEnvFloaters();
- }
- else if (event_name == "midnight")
- {
+ }
+ else if (event_name == "midnight")
+ {
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_MIDNIGHT, LLEnvironment::TRANSITION_INSTANT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_INSTANT);
defocusEnvFloaters();
- }
+ }
else if (event_name == "region")
- {
+ {
// reset probe data when reverting back to region sky setting
gPipeline.mReflectionMapManager.reset();
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_INSTANT);
defocusEnvFloaters();
- }
+ }
else if (event_name == "pause_clouds")
{
if (LLEnvironment::instance().isCloudScrollPaused())
LLEnvironment::instance().resumeCloudScroll();
- else
+ else
LLEnvironment::instance().pauseCloudScroll();
}
else if (event_name == "adjust_tool")
- {
+ {
LLFloaterReg::showInstance("env_adjust_snapshot");
}
else if (event_name == "my_environs")
{
LLFloaterReg::showInstance("my_environments");
- }
+ }
- return true;
- }
+ return true;
+ }
};
class LLWorldEnableEnvSettings : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool result = false;
- std::string event_name = userdata.asString();
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool result = false;
+ std::string event_name = userdata.asString();
if (event_name == "pause_clouds")
- {
+ {
return LLEnvironment::instance().isCloudScrollPaused();
- }
+ }
LLSettingsSky::ptr_t sky = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL);
- if (!sky)
- {
- return (event_name == "region");
- }
+ if (!sky)
+ {
+ return (event_name == "region");
+ }
std::string skyname = (sky) ? sky->getName() : "";
LLUUID skyid = (sky) ? sky->getAssetId() : LLUUID::null;
- if (event_name == "sunrise")
- {
+ if (event_name == "sunrise")
+ {
result = (skyid == LLEnvironment::KNOWN_SKY_SUNRISE);
- }
- else if (event_name == "noon")
- {
+ }
+ else if (event_name == "noon")
+ {
result = (skyid == LLEnvironment::KNOWN_SKY_MIDDAY);
- }
+ }
else if (event_name == "legacy noon")
{
result = (skyid == LLEnvironment::KNOWN_SKY_LEGACY_MIDDAY);
}
- else if (event_name == "sunset")
- {
+ else if (event_name == "sunset")
+ {
result = (skyid == LLEnvironment::KNOWN_SKY_SUNSET);
- }
- else if (event_name == "midnight")
- {
+ }
+ else if (event_name == "midnight")
+ {
result = (skyid == LLEnvironment::KNOWN_SKY_MIDNIGHT);
- }
- else if (event_name == "region")
- {
- return false;
- }
- else
- {
- LL_WARNS() << "Unknown time-of-day item: " << event_name << LL_ENDL;
- }
- return result;
- }
+ }
+ else if (event_name == "region")
+ {
+ return false;
+ }
+ else
+ {
+ LL_WARNS() << "Unknown time-of-day item: " << event_name << LL_ENDL;
+ }
+ return result;
+ }
};
class LLWorldEnvPreset : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- std::string item = userdata.asString();
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string item = userdata.asString();
- if (item == "new_water")
- {
+ if (item == "new_water")
+ {
LLFloaterReg::showInstance("env_fixed_environmentent_water", "new");
- }
- else if (item == "edit_water")
- {
+ }
+ else if (item == "edit_water")
+ {
LLFloaterReg::showInstance("env_fixed_environmentent_water", "edit");
- }
- else if (item == "new_sky")
- {
+ }
+ else if (item == "new_sky")
+ {
LLFloaterReg::showInstance("env_fixed_environmentent_sky", "new");
- }
- else if (item == "edit_sky")
- {
+ }
+ else if (item == "edit_sky")
+ {
LLFloaterReg::showInstance("env_fixed_environmentent_sky", "edit");
- }
- else if (item == "new_day_cycle")
- {
+ }
+ else if (item == "new_day_cycle")
+ {
LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("edit_context", "inventory"));
- }
- else if (item == "edit_day_cycle")
- {
- LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("edit_context", "inventory"));
- }
- else
- {
- LL_WARNS() << "Unknown item selected" << LL_ENDL;
- }
+ }
+ else if (item == "edit_day_cycle")
+ {
+ LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("edit_context", "inventory"));
+ }
+ else
+ {
+ LL_WARNS() << "Unknown item selected" << LL_ENDL;
+ }
- return true;
- }
+ return true;
+ }
};
class LLWorldEnableEnvPreset : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
+ bool handleEvent(const LLSD& userdata)
+ {
- return false;
- }
+ return false;
+ }
};
/// Post-Process callbacks
class LLWorldPostProcess : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloaterReg::showInstance("env_post_process");
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloaterReg::showInstance("env_post_process");
+ return true;
+ }
};
class LLWorldCheckBanLines : public view_listener_t
@@ -9200,684 +9200,684 @@ class LLWorldShowBanLines : public view_listener_t
void handle_flush_name_caches()
{
- if (gCacheName) gCacheName->clear();
+ if (gCacheName) gCacheName->clear();
}
class LLUploadCostCalculator : public view_listener_t
{
- std::string mCostStr;
-
- bool handleEvent(const LLSD& userdata)
- {
- std::vector<std::string> fields;
- std::string str = userdata.asString();
- boost::split(fields, str, boost::is_any_of(","));
- if (fields.size()<1)
- {
- return false;
- }
- std::string menu_name = fields[0];
- std::string asset_type_str = "texture";
- if (fields.size()>1)
- {
- asset_type_str = fields[1];
- }
- LL_DEBUGS("Benefits") << "userdata " << userdata << " menu_name " << menu_name << " asset_type_str " << asset_type_str << LL_ENDL;
- calculateCost(asset_type_str);
- gMenuHolder->childSetLabelArg(menu_name, "[COST]", mCostStr);
-
- return true;
- }
-
- void calculateCost(const std::string& asset_type_str);
+ std::string mCostStr;
+
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::vector<std::string> fields;
+ std::string str = userdata.asString();
+ boost::split(fields, str, boost::is_any_of(","));
+ if (fields.size()<1)
+ {
+ return false;
+ }
+ std::string menu_name = fields[0];
+ std::string asset_type_str = "texture";
+ if (fields.size()>1)
+ {
+ asset_type_str = fields[1];
+ }
+ LL_DEBUGS("Benefits") << "userdata " << userdata << " menu_name " << menu_name << " asset_type_str " << asset_type_str << LL_ENDL;
+ calculateCost(asset_type_str);
+ gMenuHolder->childSetLabelArg(menu_name, "[COST]", mCostStr);
+
+ return true;
+ }
+
+ void calculateCost(const std::string& asset_type_str);
public:
- LLUploadCostCalculator()
- {
- }
+ LLUploadCostCalculator()
+ {
+ }
};
class LLUpdateMembershipLabel : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- const std::string label_str = LLAgentBenefitsMgr::isCurrent("Base") ? LLTrans::getString("MembershipUpgradeText") : LLTrans::getString("MembershipPremiumText");
- gMenuHolder->childSetLabelArg("Membership", "[Membership]", label_str);
+ bool handleEvent(const LLSD& userdata)
+ {
+ const std::string label_str = LLAgentBenefitsMgr::isCurrent("Base") ? LLTrans::getString("MembershipUpgradeText") : LLTrans::getString("MembershipPremiumText");
+ gMenuHolder->childSetLabelArg("Membership", "[Membership]", label_str);
- return true;
- }
+ return true;
+ }
};
void handle_voice_morphing_subscribe()
{
- LLWeb::loadURL(LLTrans::getString("voice_morphing_url"));
+ LLWeb::loadURL(LLTrans::getString("voice_morphing_url"));
}
void handle_premium_voice_morphing_subscribe()
{
- LLWeb::loadURL(LLTrans::getString("premium_voice_morphing_url"));
+ LLWeb::loadURL(LLTrans::getString("premium_voice_morphing_url"));
}
class LLToggleUIHints : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool ui_hints_enabled = gSavedSettings.getBOOL("EnableUIHints");
- // toggle
- ui_hints_enabled = !ui_hints_enabled;
- gSavedSettings.setBOOL("EnableUIHints", ui_hints_enabled);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool ui_hints_enabled = gSavedSettings.getBOOL("EnableUIHints");
+ // toggle
+ ui_hints_enabled = !ui_hints_enabled;
+ gSavedSettings.setBOOL("EnableUIHints", ui_hints_enabled);
+ return true;
+ }
};
void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str)
{
- S32 upload_cost = -1;
-
- if (asset_type_str == "texture")
- {
- upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
- }
- else if (asset_type_str == "animation")
- {
- upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost();
- }
- else if (asset_type_str == "sound")
- {
- upload_cost = LLAgentBenefitsMgr::current().getSoundUploadCost();
- }
- if (upload_cost < 0)
- {
- LL_WARNS() << "Unable to find upload cost for asset_type_str " << asset_type_str << LL_ENDL;
- }
- mCostStr = std::to_string(upload_cost);
+ S32 upload_cost = -1;
+
+ if (asset_type_str == "texture")
+ {
+ upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
+ }
+ else if (asset_type_str == "animation")
+ {
+ upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost();
+ }
+ else if (asset_type_str == "sound")
+ {
+ upload_cost = LLAgentBenefitsMgr::current().getSoundUploadCost();
+ }
+ if (upload_cost < 0)
+ {
+ LL_WARNS() << "Unable to find upload cost for asset_type_str " << asset_type_str << LL_ENDL;
+ }
+ mCostStr = std::to_string(upload_cost);
}
void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y)
{
- static LLMenuGL* show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml",
- gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- if(gMenuHolder->hasVisibleMenu())
- {
- gMenuHolder->hideMenus();
- }
- show_navbar_context_menu->buildDrawLabels();
- show_navbar_context_menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(ctrl, show_navbar_context_menu, x, y);
+ static LLMenuGL* show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml",
+ gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ if(gMenuHolder->hasVisibleMenu())
+ {
+ gMenuHolder->hideMenus();
+ }
+ show_navbar_context_menu->buildDrawLabels();
+ show_navbar_context_menu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(ctrl, show_navbar_context_menu, x, y);
}
void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y)
{
- static LLMenuGL* show_topbarinfo_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_topinfobar.xml",
- gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ static LLMenuGL* show_topbarinfo_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_topinfobar.xml",
+ gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- LLMenuItemGL* landmark_item = show_topbarinfo_context_menu->getChild<LLMenuItemGL>("Landmark");
- if (!LLLandmarkActions::landmarkAlreadyExists())
- {
- landmark_item->setLabel(LLTrans::getString("AddLandmarkNavBarMenu"));
- }
- else
- {
- landmark_item->setLabel(LLTrans::getString("EditLandmarkNavBarMenu"));
- }
+ LLMenuItemGL* landmark_item = show_topbarinfo_context_menu->getChild<LLMenuItemGL>("Landmark");
+ if (!LLLandmarkActions::landmarkAlreadyExists())
+ {
+ landmark_item->setLabel(LLTrans::getString("AddLandmarkNavBarMenu"));
+ }
+ else
+ {
+ landmark_item->setLabel(LLTrans::getString("EditLandmarkNavBarMenu"));
+ }
- if(gMenuHolder->hasVisibleMenu())
- {
- gMenuHolder->hideMenus();
- }
+ if(gMenuHolder->hasVisibleMenu())
+ {
+ gMenuHolder->hideMenus();
+ }
- show_topbarinfo_context_menu->buildDrawLabels();
- show_topbarinfo_context_menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(ctrl, show_topbarinfo_context_menu, x, y);
+ show_topbarinfo_context_menu->buildDrawLabels();
+ show_topbarinfo_context_menu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(ctrl, show_topbarinfo_context_menu, x, y);
}
void initialize_edit_menu()
{
- view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo");
- view_listener_t::addMenu(new LLEditRedo(), "Edit.Redo");
- view_listener_t::addMenu(new LLEditCut(), "Edit.Cut");
- view_listener_t::addMenu(new LLEditCopy(), "Edit.Copy");
- view_listener_t::addMenu(new LLEditPaste(), "Edit.Paste");
- view_listener_t::addMenu(new LLEditDelete(), "Edit.Delete");
- view_listener_t::addMenu(new LLEditSelectAll(), "Edit.SelectAll");
- view_listener_t::addMenu(new LLEditDeselect(), "Edit.Deselect");
- view_listener_t::addMenu(new LLEditTakeOff(), "Edit.TakeOff");
- view_listener_t::addMenu(new LLEditEnableUndo(), "Edit.EnableUndo");
- view_listener_t::addMenu(new LLEditEnableRedo(), "Edit.EnableRedo");
- view_listener_t::addMenu(new LLEditEnableCut(), "Edit.EnableCut");
- view_listener_t::addMenu(new LLEditEnableCopy(), "Edit.EnableCopy");
- view_listener_t::addMenu(new LLEditEnablePaste(), "Edit.EnablePaste");
- view_listener_t::addMenu(new LLEditEnableDelete(), "Edit.EnableDelete");
- view_listener_t::addMenu(new LLEditEnableSelectAll(), "Edit.EnableSelectAll");
- view_listener_t::addMenu(new LLEditEnableDeselect(), "Edit.EnableDeselect");
+ view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo");
+ view_listener_t::addMenu(new LLEditRedo(), "Edit.Redo");
+ view_listener_t::addMenu(new LLEditCut(), "Edit.Cut");
+ view_listener_t::addMenu(new LLEditCopy(), "Edit.Copy");
+ view_listener_t::addMenu(new LLEditPaste(), "Edit.Paste");
+ view_listener_t::addMenu(new LLEditDelete(), "Edit.Delete");
+ view_listener_t::addMenu(new LLEditSelectAll(), "Edit.SelectAll");
+ view_listener_t::addMenu(new LLEditDeselect(), "Edit.Deselect");
+ view_listener_t::addMenu(new LLEditTakeOff(), "Edit.TakeOff");
+ view_listener_t::addMenu(new LLEditEnableUndo(), "Edit.EnableUndo");
+ view_listener_t::addMenu(new LLEditEnableRedo(), "Edit.EnableRedo");
+ view_listener_t::addMenu(new LLEditEnableCut(), "Edit.EnableCut");
+ view_listener_t::addMenu(new LLEditEnableCopy(), "Edit.EnableCopy");
+ view_listener_t::addMenu(new LLEditEnablePaste(), "Edit.EnablePaste");
+ view_listener_t::addMenu(new LLEditEnableDelete(), "Edit.EnableDelete");
+ view_listener_t::addMenu(new LLEditEnableSelectAll(), "Edit.EnableSelectAll");
+ view_listener_t::addMenu(new LLEditEnableDeselect(), "Edit.EnableDeselect");
}
void initialize_spellcheck_menu()
{
- LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar();
- LLUICtrl::EnableCallbackRegistry::Registrar& enable = LLUICtrl::EnableCallbackRegistry::currentRegistrar();
+ LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar();
+ LLUICtrl::EnableCallbackRegistry::Registrar& enable = LLUICtrl::EnableCallbackRegistry::currentRegistrar();
- commit.add("SpellCheck.ReplaceWithSuggestion", boost::bind(&handle_spellcheck_replace_with_suggestion, _1, _2));
- enable.add("SpellCheck.VisibleSuggestion", boost::bind(&visible_spellcheck_suggestion, _1, _2));
- commit.add("SpellCheck.AddToDictionary", boost::bind(&handle_spellcheck_add_to_dictionary, _1));
- enable.add("SpellCheck.EnableAddToDictionary", boost::bind(&enable_spellcheck_add_to_dictionary, _1));
- commit.add("SpellCheck.AddToIgnore", boost::bind(&handle_spellcheck_add_to_ignore, _1));
- enable.add("SpellCheck.EnableAddToIgnore", boost::bind(&enable_spellcheck_add_to_ignore, _1));
+ commit.add("SpellCheck.ReplaceWithSuggestion", boost::bind(&handle_spellcheck_replace_with_suggestion, _1, _2));
+ enable.add("SpellCheck.VisibleSuggestion", boost::bind(&visible_spellcheck_suggestion, _1, _2));
+ commit.add("SpellCheck.AddToDictionary", boost::bind(&handle_spellcheck_add_to_dictionary, _1));
+ enable.add("SpellCheck.EnableAddToDictionary", boost::bind(&enable_spellcheck_add_to_dictionary, _1));
+ commit.add("SpellCheck.AddToIgnore", boost::bind(&handle_spellcheck_add_to_ignore, _1));
+ enable.add("SpellCheck.EnableAddToIgnore", boost::bind(&enable_spellcheck_add_to_ignore, _1));
}
void initialize_menus()
{
- // A parameterized event handler used as ctrl-8/9/0 zoom controls below.
- class LLZoomer : public view_listener_t
- {
- public:
- // The "mult" parameter says whether "val" is a multiplier or used to set the value.
- LLZoomer(F32 val, bool mult=true) : mVal(val), mMult(mult) {}
- bool handleEvent(const LLSD& userdata)
- {
- F32 new_fov_rad = mMult ? LLViewerCamera::getInstance()->getDefaultFOV() * mVal : mVal;
- LLViewerCamera::getInstance()->setDefaultFOV(new_fov_rad);
- gSavedSettings.setF32("CameraAngle", LLViewerCamera::getInstance()->getView()); // setView may have clamped it.
- return true;
- }
- private:
- F32 mVal;
- bool mMult;
- };
-
- LLUICtrl::EnableCallbackRegistry::Registrar& enable = LLUICtrl::EnableCallbackRegistry::currentRegistrar();
- LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar();
-
- // Generic enable and visible
- // Don't prepend MenuName.Foo because these can be used in any menu.
- enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service));
-
- enable.add("displayViewerEventRecorderMenuItems",boost::bind(&LLViewerEventRecorder::displayViewerEventRecorderMenuItems,&LLViewerEventRecorder::instance()));
-
- view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts");
-
- view_listener_t::addEnable(new LLUpdateMembershipLabel(), "Membership.UpdateLabel");
-
- enable.add("Conversation.IsConversationLoggingAllowed", boost::bind(&LLFloaterIMContainer::isConversationLoggingAllowed));
-
- // Agent
- commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying));
- enable.add("Agent.enableFlyLand", boost::bind(&enable_fly_land));
- commit.add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2));
- commit.add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2));
- commit.add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2));
- enable.add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2));
- enable.add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2));
-
- // File menu
- init_menu_file();
-
- view_listener_t::addMenu(new LLEditEnableTakeOff(), "Edit.EnableTakeOff");
- view_listener_t::addMenu(new LLEditEnableCustomizeAvatar(), "Edit.EnableCustomizeAvatar");
- view_listener_t::addMenu(new LLEnableEditShape(), "Edit.EnableEditShape");
- view_listener_t::addMenu(new LLEnableHoverHeight(), "Edit.EnableHoverHeight");
- view_listener_t::addMenu(new LLEnableEditPhysics(), "Edit.EnableEditPhysics");
- commit.add("CustomizeAvatar", boost::bind(&handle_customize_avatar));
+ // A parameterized event handler used as ctrl-8/9/0 zoom controls below.
+ class LLZoomer : public view_listener_t
+ {
+ public:
+ // The "mult" parameter says whether "val" is a multiplier or used to set the value.
+ LLZoomer(F32 val, bool mult=true) : mVal(val), mMult(mult) {}
+ bool handleEvent(const LLSD& userdata)
+ {
+ F32 new_fov_rad = mMult ? LLViewerCamera::getInstance()->getDefaultFOV() * mVal : mVal;
+ LLViewerCamera::getInstance()->setDefaultFOV(new_fov_rad);
+ gSavedSettings.setF32("CameraAngle", LLViewerCamera::getInstance()->getView()); // setView may have clamped it.
+ return true;
+ }
+ private:
+ F32 mVal;
+ bool mMult;
+ };
+
+ LLUICtrl::EnableCallbackRegistry::Registrar& enable = LLUICtrl::EnableCallbackRegistry::currentRegistrar();
+ LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar();
+
+ // Generic enable and visible
+ // Don't prepend MenuName.Foo because these can be used in any menu.
+ enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service));
+
+ enable.add("displayViewerEventRecorderMenuItems",boost::bind(&LLViewerEventRecorder::displayViewerEventRecorderMenuItems,&LLViewerEventRecorder::instance()));
+
+ view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts");
+
+ view_listener_t::addEnable(new LLUpdateMembershipLabel(), "Membership.UpdateLabel");
+
+ enable.add("Conversation.IsConversationLoggingAllowed", boost::bind(&LLFloaterIMContainer::isConversationLoggingAllowed));
+
+ // Agent
+ commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying));
+ enable.add("Agent.enableFlyLand", boost::bind(&enable_fly_land));
+ commit.add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2));
+ commit.add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2));
+ commit.add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2));
+ enable.add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2));
+ enable.add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2));
+
+ // File menu
+ init_menu_file();
+
+ view_listener_t::addMenu(new LLEditEnableTakeOff(), "Edit.EnableTakeOff");
+ view_listener_t::addMenu(new LLEditEnableCustomizeAvatar(), "Edit.EnableCustomizeAvatar");
+ view_listener_t::addMenu(new LLEnableEditShape(), "Edit.EnableEditShape");
+ view_listener_t::addMenu(new LLEnableHoverHeight(), "Edit.EnableHoverHeight");
+ view_listener_t::addMenu(new LLEnableEditPhysics(), "Edit.EnableEditPhysics");
+ commit.add("CustomizeAvatar", boost::bind(&handle_customize_avatar));
commit.add("NowWearing", boost::bind(&handle_now_wearing));
- commit.add("EditOutfit", boost::bind(&handle_edit_outfit));
- commit.add("EditShape", boost::bind(&handle_edit_shape));
- commit.add("HoverHeight", boost::bind(&handle_hover_height));
- commit.add("EditPhysics", boost::bind(&handle_edit_physics));
-
- // View menu
- view_listener_t::addMenu(new LLViewMouselook(), "View.Mouselook");
- view_listener_t::addMenu(new LLViewJoystickFlycam(), "View.JoystickFlycam");
- view_listener_t::addMenu(new LLViewResetView(), "View.ResetView");
- view_listener_t::addMenu(new LLViewLookAtLastChatter(), "View.LookAtLastChatter");
- view_listener_t::addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips");
- view_listener_t::addMenu(new LLViewHighlightTransparent(), "View.HighlightTransparent");
- view_listener_t::addMenu(new LLViewToggleRenderType(), "View.ToggleRenderType");
- view_listener_t::addMenu(new LLViewShowHUDAttachments(), "View.ShowHUDAttachments");
- view_listener_t::addMenu(new LLZoomer(1.2f), "View.ZoomOut");
- view_listener_t::addMenu(new LLZoomer(1/1.2f), "View.ZoomIn");
- view_listener_t::addMenu(new LLZoomer(DEFAULT_FIELD_OF_VIEW, false), "View.ZoomDefault");
- view_listener_t::addMenu(new LLViewDefaultUISize(), "View.DefaultUISize");
- view_listener_t::addMenu(new LLViewToggleUI(), "View.ToggleUI");
-
- view_listener_t::addMenu(new LLViewEnableMouselook(), "View.EnableMouselook");
- view_listener_t::addMenu(new LLViewEnableJoystickFlycam(), "View.EnableJoystickFlycam");
- view_listener_t::addMenu(new LLViewEnableLastChatter(), "View.EnableLastChatter");
-
- view_listener_t::addMenu(new LLViewCheckJoystickFlycam(), "View.CheckJoystickFlycam");
- view_listener_t::addMenu(new LLViewCheckShowHoverTips(), "View.CheckShowHoverTips");
- view_listener_t::addMenu(new LLViewCheckHighlightTransparent(), "View.CheckHighlightTransparent");
- view_listener_t::addMenu(new LLViewCheckRenderType(), "View.CheckRenderType");
- view_listener_t::addMenu(new LLViewStatusAway(), "View.Status.CheckAway");
- view_listener_t::addMenu(new LLViewStatusDoNotDisturb(), "View.Status.CheckDoNotDisturb");
- view_listener_t::addMenu(new LLViewCheckHUDAttachments(), "View.CheckHUDAttachments");
-
- //Communicate Nearby chat
- view_listener_t::addMenu(new LLCommunicateNearbyChat(), "Communicate.NearbyChat");
-
- // Communicate > Voice morphing > Subscribe...
- commit.add("Communicate.VoiceMorphing.Subscribe", boost::bind(&handle_voice_morphing_subscribe));
- // Communicate > Voice morphing > Premium perk...
- commit.add("Communicate.VoiceMorphing.PremiumPerk", boost::bind(&handle_premium_voice_morphing_subscribe));
- LLVivoxVoiceClient * voice_clientp = LLVivoxVoiceClient::getInstance();
- enable.add("Communicate.VoiceMorphing.NoVoiceMorphing.Check"
- , boost::bind(&LLVivoxVoiceClient::onCheckVoiceEffect, voice_clientp, "NoVoiceMorphing"));
- commit.add("Communicate.VoiceMorphing.NoVoiceMorphing.Click"
- , boost::bind(&LLVivoxVoiceClient::onClickVoiceEffect, voice_clientp, "NoVoiceMorphing"));
-
- // World menu
- view_listener_t::addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun");
- view_listener_t::addMenu(new LLWorldCreateLandmark(), "World.CreateLandmark");
- view_listener_t::addMenu(new LLWorldPlaceProfile(), "World.PlaceProfile");
- view_listener_t::addMenu(new LLWorldSetHomeLocation(), "World.SetHomeLocation");
- view_listener_t::addMenu(new LLWorldTeleportHome(), "World.TeleportHome");
- view_listener_t::addMenu(new LLWorldSetAway(), "World.SetAway");
- view_listener_t::addMenu(new LLWorldSetDoNotDisturb(), "World.SetDoNotDisturb");
- view_listener_t::addMenu(new LLWorldLindenHome(), "World.LindenHome");
-
- view_listener_t::addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark");
- view_listener_t::addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation");
- view_listener_t::addMenu(new LLWorldEnableTeleportHome(), "World.EnableTeleportHome");
- view_listener_t::addMenu(new LLWorldEnableBuyLand(), "World.EnableBuyLand");
-
- view_listener_t::addMenu(new LLWorldCheckAlwaysRun(), "World.CheckAlwaysRun");
-
- view_listener_t::addMenu(new LLWorldEnvSettings(), "World.EnvSettings");
- view_listener_t::addMenu(new LLWorldEnableEnvSettings(), "World.EnableEnvSettings");
- view_listener_t::addMenu(new LLWorldEnvPreset(), "World.EnvPreset");
- view_listener_t::addMenu(new LLWorldEnableEnvPreset(), "World.EnableEnvPreset");
- view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess");
+ commit.add("EditOutfit", boost::bind(&handle_edit_outfit));
+ commit.add("EditShape", boost::bind(&handle_edit_shape));
+ commit.add("HoverHeight", boost::bind(&handle_hover_height));
+ commit.add("EditPhysics", boost::bind(&handle_edit_physics));
+
+ // View menu
+ view_listener_t::addMenu(new LLViewMouselook(), "View.Mouselook");
+ view_listener_t::addMenu(new LLViewJoystickFlycam(), "View.JoystickFlycam");
+ view_listener_t::addMenu(new LLViewResetView(), "View.ResetView");
+ view_listener_t::addMenu(new LLViewLookAtLastChatter(), "View.LookAtLastChatter");
+ view_listener_t::addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips");
+ view_listener_t::addMenu(new LLViewHighlightTransparent(), "View.HighlightTransparent");
+ view_listener_t::addMenu(new LLViewToggleRenderType(), "View.ToggleRenderType");
+ view_listener_t::addMenu(new LLViewShowHUDAttachments(), "View.ShowHUDAttachments");
+ view_listener_t::addMenu(new LLZoomer(1.2f), "View.ZoomOut");
+ view_listener_t::addMenu(new LLZoomer(1/1.2f), "View.ZoomIn");
+ view_listener_t::addMenu(new LLZoomer(DEFAULT_FIELD_OF_VIEW, false), "View.ZoomDefault");
+ view_listener_t::addMenu(new LLViewDefaultUISize(), "View.DefaultUISize");
+ view_listener_t::addMenu(new LLViewToggleUI(), "View.ToggleUI");
+
+ view_listener_t::addMenu(new LLViewEnableMouselook(), "View.EnableMouselook");
+ view_listener_t::addMenu(new LLViewEnableJoystickFlycam(), "View.EnableJoystickFlycam");
+ view_listener_t::addMenu(new LLViewEnableLastChatter(), "View.EnableLastChatter");
+
+ view_listener_t::addMenu(new LLViewCheckJoystickFlycam(), "View.CheckJoystickFlycam");
+ view_listener_t::addMenu(new LLViewCheckShowHoverTips(), "View.CheckShowHoverTips");
+ view_listener_t::addMenu(new LLViewCheckHighlightTransparent(), "View.CheckHighlightTransparent");
+ view_listener_t::addMenu(new LLViewCheckRenderType(), "View.CheckRenderType");
+ view_listener_t::addMenu(new LLViewStatusAway(), "View.Status.CheckAway");
+ view_listener_t::addMenu(new LLViewStatusDoNotDisturb(), "View.Status.CheckDoNotDisturb");
+ view_listener_t::addMenu(new LLViewCheckHUDAttachments(), "View.CheckHUDAttachments");
+
+ //Communicate Nearby chat
+ view_listener_t::addMenu(new LLCommunicateNearbyChat(), "Communicate.NearbyChat");
+
+ // Communicate > Voice morphing > Subscribe...
+ commit.add("Communicate.VoiceMorphing.Subscribe", boost::bind(&handle_voice_morphing_subscribe));
+ // Communicate > Voice morphing > Premium perk...
+ commit.add("Communicate.VoiceMorphing.PremiumPerk", boost::bind(&handle_premium_voice_morphing_subscribe));
+ LLVivoxVoiceClient * voice_clientp = LLVivoxVoiceClient::getInstance();
+ enable.add("Communicate.VoiceMorphing.NoVoiceMorphing.Check"
+ , boost::bind(&LLVivoxVoiceClient::onCheckVoiceEffect, voice_clientp, "NoVoiceMorphing"));
+ commit.add("Communicate.VoiceMorphing.NoVoiceMorphing.Click"
+ , boost::bind(&LLVivoxVoiceClient::onClickVoiceEffect, voice_clientp, "NoVoiceMorphing"));
+
+ // World menu
+ view_listener_t::addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun");
+ view_listener_t::addMenu(new LLWorldCreateLandmark(), "World.CreateLandmark");
+ view_listener_t::addMenu(new LLWorldPlaceProfile(), "World.PlaceProfile");
+ view_listener_t::addMenu(new LLWorldSetHomeLocation(), "World.SetHomeLocation");
+ view_listener_t::addMenu(new LLWorldTeleportHome(), "World.TeleportHome");
+ view_listener_t::addMenu(new LLWorldSetAway(), "World.SetAway");
+ view_listener_t::addMenu(new LLWorldSetDoNotDisturb(), "World.SetDoNotDisturb");
+ view_listener_t::addMenu(new LLWorldLindenHome(), "World.LindenHome");
+
+ view_listener_t::addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark");
+ view_listener_t::addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation");
+ view_listener_t::addMenu(new LLWorldEnableTeleportHome(), "World.EnableTeleportHome");
+ view_listener_t::addMenu(new LLWorldEnableBuyLand(), "World.EnableBuyLand");
+
+ view_listener_t::addMenu(new LLWorldCheckAlwaysRun(), "World.CheckAlwaysRun");
+
+ view_listener_t::addMenu(new LLWorldEnvSettings(), "World.EnvSettings");
+ view_listener_t::addMenu(new LLWorldEnableEnvSettings(), "World.EnableEnvSettings");
+ view_listener_t::addMenu(new LLWorldEnvPreset(), "World.EnvPreset");
+ view_listener_t::addMenu(new LLWorldEnableEnvPreset(), "World.EnableEnvPreset");
+ view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess");
view_listener_t::addMenu(new LLWorldCheckBanLines() , "World.CheckBanLines");
view_listener_t::addMenu(new LLWorldShowBanLines() , "World.ShowBanLines");
- // Tools menu
- view_listener_t::addMenu(new LLToolsSelectTool(), "Tools.SelectTool");
- view_listener_t::addMenu(new LLToolsSelectOnlyMyObjects(), "Tools.SelectOnlyMyObjects");
- view_listener_t::addMenu(new LLToolsSelectOnlyMovableObjects(), "Tools.SelectOnlyMovableObjects");
+ // Tools menu
+ view_listener_t::addMenu(new LLToolsSelectTool(), "Tools.SelectTool");
+ view_listener_t::addMenu(new LLToolsSelectOnlyMyObjects(), "Tools.SelectOnlyMyObjects");
+ view_listener_t::addMenu(new LLToolsSelectOnlyMovableObjects(), "Tools.SelectOnlyMovableObjects");
view_listener_t::addMenu(new LLToolsSelectInvisibleObjects(), "Tools.SelectInvisibleObjects");
view_listener_t::addMenu(new LLToolsSelectReflectionProbes(), "Tools.SelectReflectionProbes");
- view_listener_t::addMenu(new LLToolsSelectBySurrounding(), "Tools.SelectBySurrounding");
- view_listener_t::addMenu(new LLToolsShowHiddenSelection(), "Tools.ShowHiddenSelection");
- view_listener_t::addMenu(new LLToolsShowSelectionLightRadius(), "Tools.ShowSelectionLightRadius");
- view_listener_t::addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts");
- view_listener_t::addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY");
- view_listener_t::addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid");
- view_listener_t::addMenu(new LLToolsSelectNextPartFace(), "Tools.SelectNextPart");
- commit.add("Tools.Link", boost::bind(&handle_link_objects));
- commit.add("Tools.Unlink", boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance()));
- view_listener_t::addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations");
- view_listener_t::addMenu(new LLToolsReleaseKeys(), "Tools.ReleaseKeys");
- view_listener_t::addMenu(new LLToolsEnableReleaseKeys(), "Tools.EnableReleaseKeys");
- commit.add("Tools.LookAtSelection", boost::bind(&handle_look_at_selection, _2));
- commit.add("Tools.BuyOrTake", boost::bind(&handle_buy_or_take));
- commit.add("Tools.TakeCopy", boost::bind(&handle_take_copy));
- view_listener_t::addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory");
- view_listener_t::addMenu(new LLToolsSelectedScriptAction(), "Tools.SelectedScriptAction");
-
- view_listener_t::addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie");
- view_listener_t::addMenu(new LLToolsEnableSelectNextPart(), "Tools.EnableSelectNextPart");
- enable.add("Tools.EnableLink", boost::bind(&LLSelectMgr::enableLinkObjects, LLSelectMgr::getInstance()));
- enable.add("Tools.EnableUnlink", boost::bind(&LLSelectMgr::enableUnlinkObjects, LLSelectMgr::getInstance()));
- view_listener_t::addMenu(new LLToolsEnableBuyOrTake(), "Tools.EnableBuyOrTake");
- enable.add("Tools.EnableTakeCopy", boost::bind(&enable_object_take_copy));
- enable.add("Tools.VisibleBuyObject", boost::bind(&tools_visible_buy_object));
- enable.add("Tools.VisibleTakeObject", boost::bind(&tools_visible_take_object));
- view_listener_t::addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory");
-
- view_listener_t::addMenu(new LLToolsEnablePathfinding(), "Tools.EnablePathfinding");
- view_listener_t::addMenu(new LLToolsEnablePathfindingView(), "Tools.EnablePathfindingView");
- view_listener_t::addMenu(new LLToolsDoPathfindingRebakeRegion(), "Tools.DoPathfindingRebakeRegion");
- view_listener_t::addMenu(new LLToolsEnablePathfindingRebakeRegion(), "Tools.EnablePathfindingRebakeRegion");
-
- // Help menu
- // most items use the ShowFloater method
- view_listener_t::addMenu(new LLToggleHowTo(), "Help.ToggleHowTo");
-
- // Advanced menu
- view_listener_t::addMenu(new LLAdvancedToggleConsole(), "Advanced.ToggleConsole");
- view_listener_t::addMenu(new LLAdvancedCheckConsole(), "Advanced.CheckConsole");
- view_listener_t::addMenu(new LLAdvancedDumpInfoToConsole(), "Advanced.DumpInfoToConsole");
-
- // Advanced > HUD Info
- view_listener_t::addMenu(new LLAdvancedToggleHUDInfo(), "Advanced.ToggleHUDInfo");
- view_listener_t::addMenu(new LLAdvancedCheckHUDInfo(), "Advanced.CheckHUDInfo");
-
- // Advanced Other Settings
- view_listener_t::addMenu(new LLAdvancedClearGroupCache(), "Advanced.ClearGroupCache");
-
- // Advanced > Render > Types
- view_listener_t::addMenu(new LLAdvancedToggleRenderType(), "Advanced.ToggleRenderType");
- view_listener_t::addMenu(new LLAdvancedCheckRenderType(), "Advanced.CheckRenderType");
-
- //// Advanced > Render > Features
- view_listener_t::addMenu(new LLAdvancedToggleFeature(), "Advanced.ToggleFeature");
- view_listener_t::addMenu(new LLAdvancedCheckFeature(), "Advanced.CheckFeature");
-
- view_listener_t::addMenu(new LLAdvancedCheckDisplayTextureDensity(), "Advanced.CheckDisplayTextureDensity");
- view_listener_t::addMenu(new LLAdvancedSetDisplayTextureDensity(), "Advanced.SetDisplayTextureDensity");
-
- // Advanced > Render > Info Displays
- view_listener_t::addMenu(new LLAdvancedToggleInfoDisplay(), "Advanced.ToggleInfoDisplay");
- view_listener_t::addMenu(new LLAdvancedCheckInfoDisplay(), "Advanced.CheckInfoDisplay");
- view_listener_t::addMenu(new LLAdvancedSelectedTextureInfo(), "Advanced.SelectedTextureInfo");
- commit.add("Advanced.SelectedMaterialInfo", boost::bind(&handle_selected_material_info));
- view_listener_t::addMenu(new LLAdvancedToggleWireframe(), "Advanced.ToggleWireframe");
- view_listener_t::addMenu(new LLAdvancedCheckWireframe(), "Advanced.CheckWireframe");
- // Develop > Render
- view_listener_t::addMenu(new LLAdvancedToggleRandomizeFramerate(), "Advanced.ToggleRandomizeFramerate");
- view_listener_t::addMenu(new LLAdvancedCheckRandomizeFramerate(), "Advanced.CheckRandomizeFramerate");
- view_listener_t::addMenu(new LLAdvancedTogglePeriodicSlowFrame(), "Advanced.TogglePeriodicSlowFrame");
- view_listener_t::addMenu(new LLAdvancedCheckPeriodicSlowFrame(), "Advanced.CheckPeriodicSlowFrame");
- view_listener_t::addMenu(new LLAdvancedHandleAttachedLightParticles(), "Advanced.HandleAttachedLightParticles");
- view_listener_t::addMenu(new LLAdvancedCheckRenderShadowOption(), "Advanced.CheckRenderShadowOption");
- view_listener_t::addMenu(new LLAdvancedClickRenderShadowOption(), "Advanced.ClickRenderShadowOption");
- view_listener_t::addMenu(new LLAdvancedClickRenderProfile(), "Advanced.ClickRenderProfile");
- view_listener_t::addMenu(new LLAdvancedClickRenderBenchmark(), "Advanced.ClickRenderBenchmark");
- view_listener_t::addMenu(new LLAdvancedPurgeShaderCache(), "Advanced.ClearShaderCache");
-
- #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- view_listener_t::addMenu(new LLAdvancedHandleToggleHackedGodmode(), "Advanced.HandleToggleHackedGodmode");
- view_listener_t::addMenu(new LLAdvancedCheckToggleHackedGodmode(), "Advanced.CheckToggleHackedGodmode");
- view_listener_t::addMenu(new LLAdvancedEnableToggleHackedGodmode(), "Advanced.EnableToggleHackedGodmode");
- #endif
-
- // Advanced > World
- view_listener_t::addMenu(new LLAdvancedDumpScriptedCamera(), "Advanced.DumpScriptedCamera");
- view_listener_t::addMenu(new LLAdvancedDumpRegionObjectCache(), "Advanced.DumpRegionObjectCache");
+ view_listener_t::addMenu(new LLToolsSelectBySurrounding(), "Tools.SelectBySurrounding");
+ view_listener_t::addMenu(new LLToolsShowHiddenSelection(), "Tools.ShowHiddenSelection");
+ view_listener_t::addMenu(new LLToolsShowSelectionLightRadius(), "Tools.ShowSelectionLightRadius");
+ view_listener_t::addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts");
+ view_listener_t::addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY");
+ view_listener_t::addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid");
+ view_listener_t::addMenu(new LLToolsSelectNextPartFace(), "Tools.SelectNextPart");
+ commit.add("Tools.Link", boost::bind(&handle_link_objects));
+ commit.add("Tools.Unlink", boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance()));
+ view_listener_t::addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations");
+ view_listener_t::addMenu(new LLToolsReleaseKeys(), "Tools.ReleaseKeys");
+ view_listener_t::addMenu(new LLToolsEnableReleaseKeys(), "Tools.EnableReleaseKeys");
+ commit.add("Tools.LookAtSelection", boost::bind(&handle_look_at_selection, _2));
+ commit.add("Tools.BuyOrTake", boost::bind(&handle_buy_or_take));
+ commit.add("Tools.TakeCopy", boost::bind(&handle_take_copy));
+ view_listener_t::addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory");
+ view_listener_t::addMenu(new LLToolsSelectedScriptAction(), "Tools.SelectedScriptAction");
+
+ view_listener_t::addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie");
+ view_listener_t::addMenu(new LLToolsEnableSelectNextPart(), "Tools.EnableSelectNextPart");
+ enable.add("Tools.EnableLink", boost::bind(&LLSelectMgr::enableLinkObjects, LLSelectMgr::getInstance()));
+ enable.add("Tools.EnableUnlink", boost::bind(&LLSelectMgr::enableUnlinkObjects, LLSelectMgr::getInstance()));
+ view_listener_t::addMenu(new LLToolsEnableBuyOrTake(), "Tools.EnableBuyOrTake");
+ enable.add("Tools.EnableTakeCopy", boost::bind(&enable_object_take_copy));
+ enable.add("Tools.VisibleBuyObject", boost::bind(&tools_visible_buy_object));
+ enable.add("Tools.VisibleTakeObject", boost::bind(&tools_visible_take_object));
+ view_listener_t::addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory");
+
+ view_listener_t::addMenu(new LLToolsEnablePathfinding(), "Tools.EnablePathfinding");
+ view_listener_t::addMenu(new LLToolsEnablePathfindingView(), "Tools.EnablePathfindingView");
+ view_listener_t::addMenu(new LLToolsDoPathfindingRebakeRegion(), "Tools.DoPathfindingRebakeRegion");
+ view_listener_t::addMenu(new LLToolsEnablePathfindingRebakeRegion(), "Tools.EnablePathfindingRebakeRegion");
+
+ // Help menu
+ // most items use the ShowFloater method
+ view_listener_t::addMenu(new LLToggleHowTo(), "Help.ToggleHowTo");
+
+ // Advanced menu
+ view_listener_t::addMenu(new LLAdvancedToggleConsole(), "Advanced.ToggleConsole");
+ view_listener_t::addMenu(new LLAdvancedCheckConsole(), "Advanced.CheckConsole");
+ view_listener_t::addMenu(new LLAdvancedDumpInfoToConsole(), "Advanced.DumpInfoToConsole");
+
+ // Advanced > HUD Info
+ view_listener_t::addMenu(new LLAdvancedToggleHUDInfo(), "Advanced.ToggleHUDInfo");
+ view_listener_t::addMenu(new LLAdvancedCheckHUDInfo(), "Advanced.CheckHUDInfo");
+
+ // Advanced Other Settings
+ view_listener_t::addMenu(new LLAdvancedClearGroupCache(), "Advanced.ClearGroupCache");
+
+ // Advanced > Render > Types
+ view_listener_t::addMenu(new LLAdvancedToggleRenderType(), "Advanced.ToggleRenderType");
+ view_listener_t::addMenu(new LLAdvancedCheckRenderType(), "Advanced.CheckRenderType");
+
+ //// Advanced > Render > Features
+ view_listener_t::addMenu(new LLAdvancedToggleFeature(), "Advanced.ToggleFeature");
+ view_listener_t::addMenu(new LLAdvancedCheckFeature(), "Advanced.CheckFeature");
+
+ view_listener_t::addMenu(new LLAdvancedCheckDisplayTextureDensity(), "Advanced.CheckDisplayTextureDensity");
+ view_listener_t::addMenu(new LLAdvancedSetDisplayTextureDensity(), "Advanced.SetDisplayTextureDensity");
+
+ // Advanced > Render > Info Displays
+ view_listener_t::addMenu(new LLAdvancedToggleInfoDisplay(), "Advanced.ToggleInfoDisplay");
+ view_listener_t::addMenu(new LLAdvancedCheckInfoDisplay(), "Advanced.CheckInfoDisplay");
+ view_listener_t::addMenu(new LLAdvancedSelectedTextureInfo(), "Advanced.SelectedTextureInfo");
+ commit.add("Advanced.SelectedMaterialInfo", boost::bind(&handle_selected_material_info));
+ view_listener_t::addMenu(new LLAdvancedToggleWireframe(), "Advanced.ToggleWireframe");
+ view_listener_t::addMenu(new LLAdvancedCheckWireframe(), "Advanced.CheckWireframe");
+ // Develop > Render
+ view_listener_t::addMenu(new LLAdvancedToggleRandomizeFramerate(), "Advanced.ToggleRandomizeFramerate");
+ view_listener_t::addMenu(new LLAdvancedCheckRandomizeFramerate(), "Advanced.CheckRandomizeFramerate");
+ view_listener_t::addMenu(new LLAdvancedTogglePeriodicSlowFrame(), "Advanced.TogglePeriodicSlowFrame");
+ view_listener_t::addMenu(new LLAdvancedCheckPeriodicSlowFrame(), "Advanced.CheckPeriodicSlowFrame");
+ view_listener_t::addMenu(new LLAdvancedHandleAttachedLightParticles(), "Advanced.HandleAttachedLightParticles");
+ view_listener_t::addMenu(new LLAdvancedCheckRenderShadowOption(), "Advanced.CheckRenderShadowOption");
+ view_listener_t::addMenu(new LLAdvancedClickRenderShadowOption(), "Advanced.ClickRenderShadowOption");
+ view_listener_t::addMenu(new LLAdvancedClickRenderProfile(), "Advanced.ClickRenderProfile");
+ view_listener_t::addMenu(new LLAdvancedClickRenderBenchmark(), "Advanced.ClickRenderBenchmark");
+ view_listener_t::addMenu(new LLAdvancedPurgeShaderCache(), "Advanced.ClearShaderCache");
+
+ #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
+ view_listener_t::addMenu(new LLAdvancedHandleToggleHackedGodmode(), "Advanced.HandleToggleHackedGodmode");
+ view_listener_t::addMenu(new LLAdvancedCheckToggleHackedGodmode(), "Advanced.CheckToggleHackedGodmode");
+ view_listener_t::addMenu(new LLAdvancedEnableToggleHackedGodmode(), "Advanced.EnableToggleHackedGodmode");
+ #endif
+
+ // Advanced > World
+ view_listener_t::addMenu(new LLAdvancedDumpScriptedCamera(), "Advanced.DumpScriptedCamera");
+ view_listener_t::addMenu(new LLAdvancedDumpRegionObjectCache(), "Advanced.DumpRegionObjectCache");
view_listener_t::addMenu(new LLAdvancedToggleStatsRecorder(), "Advanced.ToggleStatsRecorder");
view_listener_t::addMenu(new LLAdvancedCheckStatsRecorder(), "Advanced.CheckStatsRecorder");
view_listener_t::addMenu(new LLAdvancedToggleInterestList360Mode(), "Advanced.ToggleInterestList360Mode");
view_listener_t::addMenu(new LLAdvancedCheckInterestList360Mode(), "Advanced.CheckInterestList360Mode");
view_listener_t::addMenu(new LLAdvancedResetInterestLists(), "Advanced.ResetInterestLists");
- // Advanced > UI
- commit.add("Advanced.WebBrowserTest", boost::bind(&handle_web_browser_test, _2)); // sigh! this one opens the MEDIA browser
- commit.add("Advanced.WebContentTest", boost::bind(&handle_web_content_test, _2)); // this one opens the Web Content floater
- commit.add("Advanced.ShowURL", boost::bind(&handle_show_url, _2));
- commit.add("Advanced.ReportBug", boost::bind(&handle_report_bug, _2));
- view_listener_t::addMenu(new LLAdvancedBuyCurrencyTest(), "Advanced.BuyCurrencyTest");
- view_listener_t::addMenu(new LLAdvancedDumpSelectMgr(), "Advanced.DumpSelectMgr");
- view_listener_t::addMenu(new LLAdvancedDumpInventory(), "Advanced.DumpInventory");
- commit.add("Advanced.DumpTimers", boost::bind(&handle_dump_timers) );
- commit.add("Advanced.DumpFocusHolder", boost::bind(&handle_dump_focus) );
- view_listener_t::addMenu(new LLAdvancedPrintSelectedObjectInfo(), "Advanced.PrintSelectedObjectInfo");
- view_listener_t::addMenu(new LLAdvancedPrintAgentInfo(), "Advanced.PrintAgentInfo");
- view_listener_t::addMenu(new LLAdvancedToggleDebugClicks(), "Advanced.ToggleDebugClicks");
- view_listener_t::addMenu(new LLAdvancedCheckDebugClicks(), "Advanced.CheckDebugClicks");
- view_listener_t::addMenu(new LLAdvancedCheckDebugViews(), "Advanced.CheckDebugViews");
- view_listener_t::addMenu(new LLAdvancedToggleDebugViews(), "Advanced.ToggleDebugViews");
- view_listener_t::addMenu(new LLAdvancedCheckDebugUnicode(), "Advanced.CheckDebugUnicode");
- view_listener_t::addMenu(new LLAdvancedToggleDebugUnicode(), "Advanced.ToggleDebugUnicode");
- view_listener_t::addMenu(new LLAdvancedCheckDebugCamera(), "Advanced.CheckDebugCamera");
- view_listener_t::addMenu(new LLAdvancedToggleDebugCamera(), "Advanced.ToggleDebugCamera");
- view_listener_t::addMenu(new LLAdvancedToggleXUINameTooltips(), "Advanced.ToggleXUINameTooltips");
- view_listener_t::addMenu(new LLAdvancedCheckXUINameTooltips(), "Advanced.CheckXUINameTooltips");
- view_listener_t::addMenu(new LLAdvancedToggleDebugMouseEvents(), "Advanced.ToggleDebugMouseEvents");
- view_listener_t::addMenu(new LLAdvancedCheckDebugMouseEvents(), "Advanced.CheckDebugMouseEvents");
- view_listener_t::addMenu(new LLAdvancedToggleDebugKeys(), "Advanced.ToggleDebugKeys");
- view_listener_t::addMenu(new LLAdvancedCheckDebugKeys(), "Advanced.CheckDebugKeys");
- view_listener_t::addMenu(new LLAdvancedToggleDebugWindowProc(), "Advanced.ToggleDebugWindowProc");
- view_listener_t::addMenu(new LLAdvancedCheckDebugWindowProc(), "Advanced.CheckDebugWindowProc");
-
- // Advanced > XUI
- commit.add("Advanced.ReloadColorSettings", boost::bind(&LLUIColorTable::loadFromSettings, LLUIColorTable::getInstance()));
- view_listener_t::addMenu(new LLAdvancedToggleXUINames(), "Advanced.ToggleXUINames");
- view_listener_t::addMenu(new LLAdvancedCheckXUINames(), "Advanced.CheckXUINames");
- view_listener_t::addMenu(new LLAdvancedSendTestIms(), "Advanced.SendTestIMs");
- commit.add("Advanced.FlushNameCaches", boost::bind(&handle_flush_name_caches));
-
- // Advanced > Character > Grab Baked Texture
- view_listener_t::addMenu(new LLAdvancedGrabBakedTexture(), "Advanced.GrabBakedTexture");
- view_listener_t::addMenu(new LLAdvancedEnableGrabBakedTexture(), "Advanced.EnableGrabBakedTexture");
-
- // Advanced > Character > Character Tests
- view_listener_t::addMenu(new LLAdvancedAppearanceToXML(), "Advanced.AppearanceToXML");
- view_listener_t::addMenu(new LLAdvancedEnableAppearanceToXML(), "Advanced.EnableAppearanceToXML");
- view_listener_t::addMenu(new LLAdvancedToggleCharacterGeometry(), "Advanced.ToggleCharacterGeometry");
-
- view_listener_t::addMenu(new LLAdvancedTestMale(), "Advanced.TestMale");
- view_listener_t::addMenu(new LLAdvancedTestFemale(), "Advanced.TestFemale");
-
- // Advanced > Character > Animation Speed
- view_listener_t::addMenu(new LLAdvancedAnimTenFaster(), "Advanced.AnimTenFaster");
- view_listener_t::addMenu(new LLAdvancedAnimTenSlower(), "Advanced.AnimTenSlower");
- view_listener_t::addMenu(new LLAdvancedAnimResetAll(), "Advanced.AnimResetAll");
-
- // Advanced > Character (toplevel)
- view_listener_t::addMenu(new LLAdvancedForceParamsToDefault(), "Advanced.ForceParamsToDefault");
- view_listener_t::addMenu(new LLAdvancedReloadVertexShader(), "Advanced.ReloadVertexShader");
- view_listener_t::addMenu(new LLAdvancedToggleAnimationInfo(), "Advanced.ToggleAnimationInfo");
- view_listener_t::addMenu(new LLAdvancedCheckAnimationInfo(), "Advanced.CheckAnimationInfo");
- view_listener_t::addMenu(new LLAdvancedToggleShowLookAt(), "Advanced.ToggleShowLookAt");
- view_listener_t::addMenu(new LLAdvancedCheckShowLookAt(), "Advanced.CheckShowLookAt");
- view_listener_t::addMenu(new LLAdvancedToggleShowPointAt(), "Advanced.ToggleShowPointAt");
- view_listener_t::addMenu(new LLAdvancedCheckShowPointAt(), "Advanced.CheckShowPointAt");
- view_listener_t::addMenu(new LLAdvancedToggleDebugJointUpdates(), "Advanced.ToggleDebugJointUpdates");
- view_listener_t::addMenu(new LLAdvancedCheckDebugJointUpdates(), "Advanced.CheckDebugJointUpdates");
- view_listener_t::addMenu(new LLAdvancedToggleDisableLOD(), "Advanced.ToggleDisableLOD");
- view_listener_t::addMenu(new LLAdvancedCheckDisableLOD(), "Advanced.CheckDisableLOD");
- view_listener_t::addMenu(new LLAdvancedToggleDebugCharacterVis(), "Advanced.ToggleDebugCharacterVis");
- view_listener_t::addMenu(new LLAdvancedCheckDebugCharacterVis(), "Advanced.CheckDebugCharacterVis");
- view_listener_t::addMenu(new LLAdvancedDumpAttachments(), "Advanced.DumpAttachments");
- view_listener_t::addMenu(new LLAdvancedRebakeTextures(), "Advanced.RebakeTextures");
- view_listener_t::addMenu(new LLAdvancedDebugAvatarTextures(), "Advanced.DebugAvatarTextures");
- view_listener_t::addMenu(new LLAdvancedDumpAvatarLocalTextures(), "Advanced.DumpAvatarLocalTextures");
- // Advanced > Network
- view_listener_t::addMenu(new LLAdvancedEnableMessageLog(), "Advanced.EnableMessageLog");
- view_listener_t::addMenu(new LLAdvancedDisableMessageLog(), "Advanced.DisableMessageLog");
- view_listener_t::addMenu(new LLAdvancedDropPacket(), "Advanced.DropPacket");
+ // Advanced > UI
+ commit.add("Advanced.WebBrowserTest", boost::bind(&handle_web_browser_test, _2)); // sigh! this one opens the MEDIA browser
+ commit.add("Advanced.WebContentTest", boost::bind(&handle_web_content_test, _2)); // this one opens the Web Content floater
+ commit.add("Advanced.ShowURL", boost::bind(&handle_show_url, _2));
+ commit.add("Advanced.ReportBug", boost::bind(&handle_report_bug, _2));
+ view_listener_t::addMenu(new LLAdvancedBuyCurrencyTest(), "Advanced.BuyCurrencyTest");
+ view_listener_t::addMenu(new LLAdvancedDumpSelectMgr(), "Advanced.DumpSelectMgr");
+ view_listener_t::addMenu(new LLAdvancedDumpInventory(), "Advanced.DumpInventory");
+ commit.add("Advanced.DumpTimers", boost::bind(&handle_dump_timers) );
+ commit.add("Advanced.DumpFocusHolder", boost::bind(&handle_dump_focus) );
+ view_listener_t::addMenu(new LLAdvancedPrintSelectedObjectInfo(), "Advanced.PrintSelectedObjectInfo");
+ view_listener_t::addMenu(new LLAdvancedPrintAgentInfo(), "Advanced.PrintAgentInfo");
+ view_listener_t::addMenu(new LLAdvancedToggleDebugClicks(), "Advanced.ToggleDebugClicks");
+ view_listener_t::addMenu(new LLAdvancedCheckDebugClicks(), "Advanced.CheckDebugClicks");
+ view_listener_t::addMenu(new LLAdvancedCheckDebugViews(), "Advanced.CheckDebugViews");
+ view_listener_t::addMenu(new LLAdvancedToggleDebugViews(), "Advanced.ToggleDebugViews");
+ view_listener_t::addMenu(new LLAdvancedCheckDebugUnicode(), "Advanced.CheckDebugUnicode");
+ view_listener_t::addMenu(new LLAdvancedToggleDebugUnicode(), "Advanced.ToggleDebugUnicode");
+ view_listener_t::addMenu(new LLAdvancedCheckDebugCamera(), "Advanced.CheckDebugCamera");
+ view_listener_t::addMenu(new LLAdvancedToggleDebugCamera(), "Advanced.ToggleDebugCamera");
+ view_listener_t::addMenu(new LLAdvancedToggleXUINameTooltips(), "Advanced.ToggleXUINameTooltips");
+ view_listener_t::addMenu(new LLAdvancedCheckXUINameTooltips(), "Advanced.CheckXUINameTooltips");
+ view_listener_t::addMenu(new LLAdvancedToggleDebugMouseEvents(), "Advanced.ToggleDebugMouseEvents");
+ view_listener_t::addMenu(new LLAdvancedCheckDebugMouseEvents(), "Advanced.CheckDebugMouseEvents");
+ view_listener_t::addMenu(new LLAdvancedToggleDebugKeys(), "Advanced.ToggleDebugKeys");
+ view_listener_t::addMenu(new LLAdvancedCheckDebugKeys(), "Advanced.CheckDebugKeys");
+ view_listener_t::addMenu(new LLAdvancedToggleDebugWindowProc(), "Advanced.ToggleDebugWindowProc");
+ view_listener_t::addMenu(new LLAdvancedCheckDebugWindowProc(), "Advanced.CheckDebugWindowProc");
+
+ // Advanced > XUI
+ commit.add("Advanced.ReloadColorSettings", boost::bind(&LLUIColorTable::loadFromSettings, LLUIColorTable::getInstance()));
+ view_listener_t::addMenu(new LLAdvancedToggleXUINames(), "Advanced.ToggleXUINames");
+ view_listener_t::addMenu(new LLAdvancedCheckXUINames(), "Advanced.CheckXUINames");
+ view_listener_t::addMenu(new LLAdvancedSendTestIms(), "Advanced.SendTestIMs");
+ commit.add("Advanced.FlushNameCaches", boost::bind(&handle_flush_name_caches));
+
+ // Advanced > Character > Grab Baked Texture
+ view_listener_t::addMenu(new LLAdvancedGrabBakedTexture(), "Advanced.GrabBakedTexture");
+ view_listener_t::addMenu(new LLAdvancedEnableGrabBakedTexture(), "Advanced.EnableGrabBakedTexture");
+
+ // Advanced > Character > Character Tests
+ view_listener_t::addMenu(new LLAdvancedAppearanceToXML(), "Advanced.AppearanceToXML");
+ view_listener_t::addMenu(new LLAdvancedEnableAppearanceToXML(), "Advanced.EnableAppearanceToXML");
+ view_listener_t::addMenu(new LLAdvancedToggleCharacterGeometry(), "Advanced.ToggleCharacterGeometry");
+
+ view_listener_t::addMenu(new LLAdvancedTestMale(), "Advanced.TestMale");
+ view_listener_t::addMenu(new LLAdvancedTestFemale(), "Advanced.TestFemale");
+
+ // Advanced > Character > Animation Speed
+ view_listener_t::addMenu(new LLAdvancedAnimTenFaster(), "Advanced.AnimTenFaster");
+ view_listener_t::addMenu(new LLAdvancedAnimTenSlower(), "Advanced.AnimTenSlower");
+ view_listener_t::addMenu(new LLAdvancedAnimResetAll(), "Advanced.AnimResetAll");
+
+ // Advanced > Character (toplevel)
+ view_listener_t::addMenu(new LLAdvancedForceParamsToDefault(), "Advanced.ForceParamsToDefault");
+ view_listener_t::addMenu(new LLAdvancedReloadVertexShader(), "Advanced.ReloadVertexShader");
+ view_listener_t::addMenu(new LLAdvancedToggleAnimationInfo(), "Advanced.ToggleAnimationInfo");
+ view_listener_t::addMenu(new LLAdvancedCheckAnimationInfo(), "Advanced.CheckAnimationInfo");
+ view_listener_t::addMenu(new LLAdvancedToggleShowLookAt(), "Advanced.ToggleShowLookAt");
+ view_listener_t::addMenu(new LLAdvancedCheckShowLookAt(), "Advanced.CheckShowLookAt");
+ view_listener_t::addMenu(new LLAdvancedToggleShowPointAt(), "Advanced.ToggleShowPointAt");
+ view_listener_t::addMenu(new LLAdvancedCheckShowPointAt(), "Advanced.CheckShowPointAt");
+ view_listener_t::addMenu(new LLAdvancedToggleDebugJointUpdates(), "Advanced.ToggleDebugJointUpdates");
+ view_listener_t::addMenu(new LLAdvancedCheckDebugJointUpdates(), "Advanced.CheckDebugJointUpdates");
+ view_listener_t::addMenu(new LLAdvancedToggleDisableLOD(), "Advanced.ToggleDisableLOD");
+ view_listener_t::addMenu(new LLAdvancedCheckDisableLOD(), "Advanced.CheckDisableLOD");
+ view_listener_t::addMenu(new LLAdvancedToggleDebugCharacterVis(), "Advanced.ToggleDebugCharacterVis");
+ view_listener_t::addMenu(new LLAdvancedCheckDebugCharacterVis(), "Advanced.CheckDebugCharacterVis");
+ view_listener_t::addMenu(new LLAdvancedDumpAttachments(), "Advanced.DumpAttachments");
+ view_listener_t::addMenu(new LLAdvancedRebakeTextures(), "Advanced.RebakeTextures");
+ view_listener_t::addMenu(new LLAdvancedDebugAvatarTextures(), "Advanced.DebugAvatarTextures");
+ view_listener_t::addMenu(new LLAdvancedDumpAvatarLocalTextures(), "Advanced.DumpAvatarLocalTextures");
+ // Advanced > Network
+ view_listener_t::addMenu(new LLAdvancedEnableMessageLog(), "Advanced.EnableMessageLog");
+ view_listener_t::addMenu(new LLAdvancedDisableMessageLog(), "Advanced.DisableMessageLog");
+ view_listener_t::addMenu(new LLAdvancedDropPacket(), "Advanced.DropPacket");
// Advanced > Cache
view_listener_t::addMenu(new LLAdvancedPurgeDiskCache(), "Advanced.PurgeDiskCache");
- // Advanced > Recorder
- view_listener_t::addMenu(new LLAdvancedAgentPilot(), "Advanced.AgentPilot");
- view_listener_t::addMenu(new LLAdvancedToggleAgentPilotLoop(), "Advanced.ToggleAgentPilotLoop");
- view_listener_t::addMenu(new LLAdvancedCheckAgentPilotLoop(), "Advanced.CheckAgentPilotLoop");
- view_listener_t::addMenu(new LLAdvancedViewerEventRecorder(), "Advanced.EventRecorder");
+ // Advanced > Recorder
+ view_listener_t::addMenu(new LLAdvancedAgentPilot(), "Advanced.AgentPilot");
+ view_listener_t::addMenu(new LLAdvancedToggleAgentPilotLoop(), "Advanced.ToggleAgentPilotLoop");
+ view_listener_t::addMenu(new LLAdvancedCheckAgentPilotLoop(), "Advanced.CheckAgentPilotLoop");
+ view_listener_t::addMenu(new LLAdvancedViewerEventRecorder(), "Advanced.EventRecorder");
- // Advanced > Debugging
- view_listener_t::addMenu(new LLAdvancedForceErrorBreakpoint(), "Advanced.ForceErrorBreakpoint");
- view_listener_t::addMenu(new LLAdvancedForceErrorLlerror(), "Advanced.ForceErrorLlerror");
+ // Advanced > Debugging
+ view_listener_t::addMenu(new LLAdvancedForceErrorBreakpoint(), "Advanced.ForceErrorBreakpoint");
+ view_listener_t::addMenu(new LLAdvancedForceErrorLlerror(), "Advanced.ForceErrorLlerror");
view_listener_t::addMenu(new LLAdvancedForceErrorLlerrorMsg(), "Advanced.ForceErrorLlerrorMsg");
- view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccess(), "Advanced.ForceErrorBadMemoryAccess");
- view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccessCoro(), "Advanced.ForceErrorBadMemoryAccessCoro");
- view_listener_t::addMenu(new LLAdvancedForceErrorInfiniteLoop(), "Advanced.ForceErrorInfiniteLoop");
- view_listener_t::addMenu(new LLAdvancedForceErrorSoftwareException(), "Advanced.ForceErrorSoftwareException");
+ view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccess(), "Advanced.ForceErrorBadMemoryAccess");
+ view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccessCoro(), "Advanced.ForceErrorBadMemoryAccessCoro");
+ view_listener_t::addMenu(new LLAdvancedForceErrorInfiniteLoop(), "Advanced.ForceErrorInfiniteLoop");
+ view_listener_t::addMenu(new LLAdvancedForceErrorSoftwareException(), "Advanced.ForceErrorSoftwareException");
view_listener_t::addMenu(new LLAdvancedForceOSException(), "Advanced.ForceErrorOSException");
- view_listener_t::addMenu(new LLAdvancedForceErrorSoftwareExceptionCoro(), "Advanced.ForceErrorSoftwareExceptionCoro");
- view_listener_t::addMenu(new LLAdvancedForceErrorDriverCrash(), "Advanced.ForceErrorDriverCrash");
+ view_listener_t::addMenu(new LLAdvancedForceErrorSoftwareExceptionCoro(), "Advanced.ForceErrorSoftwareExceptionCoro");
+ view_listener_t::addMenu(new LLAdvancedForceErrorDriverCrash(), "Advanced.ForceErrorDriverCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorCoroutineCrash(), "Advanced.ForceErrorCoroutineCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorThreadCrash(), "Advanced.ForceErrorThreadCrash");
- view_listener_t::addMenu(new LLAdvancedForceErrorDisconnectViewer(), "Advanced.ForceErrorDisconnectViewer");
+ view_listener_t::addMenu(new LLAdvancedForceErrorDisconnectViewer(), "Advanced.ForceErrorDisconnectViewer");
- // Advanced (toplevel)
- view_listener_t::addMenu(new LLAdvancedToggleShowObjectUpdates(), "Advanced.ToggleShowObjectUpdates");
- view_listener_t::addMenu(new LLAdvancedCheckShowObjectUpdates(), "Advanced.CheckShowObjectUpdates");
- view_listener_t::addMenu(new LLAdvancedCompressImage(), "Advanced.CompressImage");
+ // Advanced (toplevel)
+ view_listener_t::addMenu(new LLAdvancedToggleShowObjectUpdates(), "Advanced.ToggleShowObjectUpdates");
+ view_listener_t::addMenu(new LLAdvancedCheckShowObjectUpdates(), "Advanced.CheckShowObjectUpdates");
+ view_listener_t::addMenu(new LLAdvancedCompressImage(), "Advanced.CompressImage");
view_listener_t::addMenu(new LLAdvancedCompressFileTest(), "Advanced.CompressFileTest");
- view_listener_t::addMenu(new LLAdvancedShowDebugSettings(), "Advanced.ShowDebugSettings");
- view_listener_t::addMenu(new LLAdvancedEnableViewAdminOptions(), "Advanced.EnableViewAdminOptions");
- view_listener_t::addMenu(new LLAdvancedToggleViewAdminOptions(), "Advanced.ToggleViewAdminOptions");
- view_listener_t::addMenu(new LLAdvancedCheckViewAdminOptions(), "Advanced.CheckViewAdminOptions");
- view_listener_t::addMenu(new LLAdvancedToggleVisualLeakDetector(), "Advanced.ToggleVisualLeakDetector");
-
- view_listener_t::addMenu(new LLAdvancedRequestAdminStatus(), "Advanced.RequestAdminStatus");
- view_listener_t::addMenu(new LLAdvancedLeaveAdminStatus(), "Advanced.LeaveAdminStatus");
-
- // Develop >Set logging level
- view_listener_t::addMenu(new LLDevelopCheckLoggingLevel(), "Develop.CheckLoggingLevel");
- view_listener_t::addMenu(new LLDevelopSetLoggingLevel(), "Develop.SetLoggingLevel");
-
- //Develop (clear cache immediately)
- commit.add("Develop.ClearCache", boost::bind(&handle_cache_clear_immediately) );
-
- // Develop (Fonts debugging)
- commit.add("Develop.Fonts.Dump", boost::bind(&LLFontGL::dumpFonts));
- commit.add("Develop.Fonts.DumpTextures", boost::bind(&LLFontGL::dumpFontTextures));
-
- // Admin >Object
- view_listener_t::addMenu(new LLAdminForceTakeCopy(), "Admin.ForceTakeCopy");
- view_listener_t::addMenu(new LLAdminHandleObjectOwnerSelf(), "Admin.HandleObjectOwnerSelf");
- view_listener_t::addMenu(new LLAdminHandleObjectOwnerPermissive(), "Admin.HandleObjectOwnerPermissive");
- view_listener_t::addMenu(new LLAdminHandleForceDelete(), "Admin.HandleForceDelete");
- view_listener_t::addMenu(new LLAdminHandleObjectLock(), "Admin.HandleObjectLock");
- view_listener_t::addMenu(new LLAdminHandleObjectAssetIDs(), "Admin.HandleObjectAssetIDs");
-
- // Admin >Parcel
- view_listener_t::addMenu(new LLAdminHandleForceParcelOwnerToMe(), "Admin.HandleForceParcelOwnerToMe");
- view_listener_t::addMenu(new LLAdminHandleForceParcelToContent(), "Admin.HandleForceParcelToContent");
- view_listener_t::addMenu(new LLAdminHandleClaimPublicLand(), "Admin.HandleClaimPublicLand");
-
- // Admin >Region
- view_listener_t::addMenu(new LLAdminHandleRegionDumpTempAssetData(), "Admin.HandleRegionDumpTempAssetData");
- // Admin top level
- view_listener_t::addMenu(new LLAdminOnSaveState(), "Admin.OnSaveState");
-
- // Self context menu
- view_listener_t::addMenu(new LLSelfToggleSitStand(), "Self.ToggleSitStand");
- enable.add("Self.EnableSitStand", boost::bind(&enable_sit_stand));
- view_listener_t::addMenu(new LLSelfRemoveAllAttachments(), "Self.RemoveAllAttachments");
-
- view_listener_t::addMenu(new LLSelfEnableRemoveAllAttachments(), "Self.EnableRemoveAllAttachments");
-
- // we don't use boost::bind directly to delay side tray construction
- view_listener_t::addMenu( new LLTogglePanelPeopleTab(), "SideTray.PanelPeopleTab");
- view_listener_t::addMenu( new LLCheckPanelPeopleTab(), "SideTray.CheckPanelPeopleTab");
-
- // Avatar pie menu
- view_listener_t::addMenu(new LLAvatarCheckImpostorMode(), "Avatar.CheckImpostorMode");
- view_listener_t::addMenu(new LLAvatarSetImpostorMode(), "Avatar.SetImpostorMode");
- view_listener_t::addMenu(new LLObjectMute(), "Avatar.Mute");
- view_listener_t::addMenu(new LLAvatarAddFriend(), "Avatar.AddFriend");
- view_listener_t::addMenu(new LLAvatarAddContact(), "Avatar.AddContact");
- commit.add("Avatar.Freeze", boost::bind(&handle_avatar_freeze, LLSD()));
- view_listener_t::addMenu(new LLAvatarDebug(), "Avatar.Debug");
- view_listener_t::addMenu(new LLAvatarVisibleDebug(), "Avatar.VisibleDebug");
- view_listener_t::addMenu(new LLAvatarInviteToGroup(), "Avatar.InviteToGroup");
- commit.add("Avatar.Eject", boost::bind(&handle_avatar_eject, LLSD()));
- commit.add("Avatar.ShowInspector", boost::bind(&handle_avatar_show_inspector));
- view_listener_t::addMenu(new LLAvatarSendIM(), "Avatar.SendIM");
- view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call");
- enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
- view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse");
- view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile");
- view_listener_t::addMenu(new LLAvatarTogglePicks(), "Avatar.TogglePicks");
- view_listener_t::addMenu(new LLAvatarToggleSearch(), "Avatar.ToggleSearch");
- view_listener_t::addMenu(new LLAvatarResetSkeleton(), "Avatar.ResetSkeleton");
- view_listener_t::addMenu(new LLAvatarEnableResetSkeleton(), "Avatar.EnableResetSkeleton");
- view_listener_t::addMenu(new LLAvatarResetSkeletonAndAnimations(), "Avatar.ResetSkeletonAndAnimations");
- view_listener_t::addMenu(new LLAvatarResetSelfSkeletonAndAnimations(), "Avatar.ResetSelfSkeletonAndAnimations");
- enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible));
+ view_listener_t::addMenu(new LLAdvancedShowDebugSettings(), "Advanced.ShowDebugSettings");
+ view_listener_t::addMenu(new LLAdvancedEnableViewAdminOptions(), "Advanced.EnableViewAdminOptions");
+ view_listener_t::addMenu(new LLAdvancedToggleViewAdminOptions(), "Advanced.ToggleViewAdminOptions");
+ view_listener_t::addMenu(new LLAdvancedCheckViewAdminOptions(), "Advanced.CheckViewAdminOptions");
+ view_listener_t::addMenu(new LLAdvancedToggleVisualLeakDetector(), "Advanced.ToggleVisualLeakDetector");
+
+ view_listener_t::addMenu(new LLAdvancedRequestAdminStatus(), "Advanced.RequestAdminStatus");
+ view_listener_t::addMenu(new LLAdvancedLeaveAdminStatus(), "Advanced.LeaveAdminStatus");
+
+ // Develop >Set logging level
+ view_listener_t::addMenu(new LLDevelopCheckLoggingLevel(), "Develop.CheckLoggingLevel");
+ view_listener_t::addMenu(new LLDevelopSetLoggingLevel(), "Develop.SetLoggingLevel");
+
+ //Develop (clear cache immediately)
+ commit.add("Develop.ClearCache", boost::bind(&handle_cache_clear_immediately) );
+
+ // Develop (Fonts debugging)
+ commit.add("Develop.Fonts.Dump", boost::bind(&LLFontGL::dumpFonts));
+ commit.add("Develop.Fonts.DumpTextures", boost::bind(&LLFontGL::dumpFontTextures));
+
+ // Admin >Object
+ view_listener_t::addMenu(new LLAdminForceTakeCopy(), "Admin.ForceTakeCopy");
+ view_listener_t::addMenu(new LLAdminHandleObjectOwnerSelf(), "Admin.HandleObjectOwnerSelf");
+ view_listener_t::addMenu(new LLAdminHandleObjectOwnerPermissive(), "Admin.HandleObjectOwnerPermissive");
+ view_listener_t::addMenu(new LLAdminHandleForceDelete(), "Admin.HandleForceDelete");
+ view_listener_t::addMenu(new LLAdminHandleObjectLock(), "Admin.HandleObjectLock");
+ view_listener_t::addMenu(new LLAdminHandleObjectAssetIDs(), "Admin.HandleObjectAssetIDs");
+
+ // Admin >Parcel
+ view_listener_t::addMenu(new LLAdminHandleForceParcelOwnerToMe(), "Admin.HandleForceParcelOwnerToMe");
+ view_listener_t::addMenu(new LLAdminHandleForceParcelToContent(), "Admin.HandleForceParcelToContent");
+ view_listener_t::addMenu(new LLAdminHandleClaimPublicLand(), "Admin.HandleClaimPublicLand");
+
+ // Admin >Region
+ view_listener_t::addMenu(new LLAdminHandleRegionDumpTempAssetData(), "Admin.HandleRegionDumpTempAssetData");
+ // Admin top level
+ view_listener_t::addMenu(new LLAdminOnSaveState(), "Admin.OnSaveState");
+
+ // Self context menu
+ view_listener_t::addMenu(new LLSelfToggleSitStand(), "Self.ToggleSitStand");
+ enable.add("Self.EnableSitStand", boost::bind(&enable_sit_stand));
+ view_listener_t::addMenu(new LLSelfRemoveAllAttachments(), "Self.RemoveAllAttachments");
+
+ view_listener_t::addMenu(new LLSelfEnableRemoveAllAttachments(), "Self.EnableRemoveAllAttachments");
+
+ // we don't use boost::bind directly to delay side tray construction
+ view_listener_t::addMenu( new LLTogglePanelPeopleTab(), "SideTray.PanelPeopleTab");
+ view_listener_t::addMenu( new LLCheckPanelPeopleTab(), "SideTray.CheckPanelPeopleTab");
+
+ // Avatar pie menu
+ view_listener_t::addMenu(new LLAvatarCheckImpostorMode(), "Avatar.CheckImpostorMode");
+ view_listener_t::addMenu(new LLAvatarSetImpostorMode(), "Avatar.SetImpostorMode");
+ view_listener_t::addMenu(new LLObjectMute(), "Avatar.Mute");
+ view_listener_t::addMenu(new LLAvatarAddFriend(), "Avatar.AddFriend");
+ view_listener_t::addMenu(new LLAvatarAddContact(), "Avatar.AddContact");
+ commit.add("Avatar.Freeze", boost::bind(&handle_avatar_freeze, LLSD()));
+ view_listener_t::addMenu(new LLAvatarDebug(), "Avatar.Debug");
+ view_listener_t::addMenu(new LLAvatarVisibleDebug(), "Avatar.VisibleDebug");
+ view_listener_t::addMenu(new LLAvatarInviteToGroup(), "Avatar.InviteToGroup");
+ commit.add("Avatar.Eject", boost::bind(&handle_avatar_eject, LLSD()));
+ commit.add("Avatar.ShowInspector", boost::bind(&handle_avatar_show_inspector));
+ view_listener_t::addMenu(new LLAvatarSendIM(), "Avatar.SendIM");
+ view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call");
+ enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
+ view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse");
+ view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile");
+ view_listener_t::addMenu(new LLAvatarTogglePicks(), "Avatar.TogglePicks");
+ view_listener_t::addMenu(new LLAvatarToggleSearch(), "Avatar.ToggleSearch");
+ view_listener_t::addMenu(new LLAvatarResetSkeleton(), "Avatar.ResetSkeleton");
+ view_listener_t::addMenu(new LLAvatarEnableResetSkeleton(), "Avatar.EnableResetSkeleton");
+ view_listener_t::addMenu(new LLAvatarResetSkeletonAndAnimations(), "Avatar.ResetSkeletonAndAnimations");
+ view_listener_t::addMenu(new LLAvatarResetSelfSkeletonAndAnimations(), "Avatar.ResetSelfSkeletonAndAnimations");
+ enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible));
enable.add("Avatar.IsPicksTabOpen", boost::bind(&picks_tab_visible));
- commit.add("Avatar.OpenMarketplace", boost::bind(&LLWeb::loadURLExternal, gSavedSettings.getString("MarketplaceURL")));
-
- view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
- enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2));
-
- // Object pie menu
- view_listener_t::addMenu(new LLObjectBuild(), "Object.Build");
- commit.add("Object.Touch", boost::bind(&handle_object_touch));
- commit.add("Object.ShowOriginal", boost::bind(&handle_object_show_original));
- commit.add("Object.SitOrStand", boost::bind(&handle_object_sit_or_stand));
- commit.add("Object.Delete", boost::bind(&handle_object_delete));
- view_listener_t::addMenu(new LLObjectAttachToAvatar(true), "Object.AttachToAvatar");
- view_listener_t::addMenu(new LLObjectAttachToAvatar(false), "Object.AttachAddToAvatar");
- view_listener_t::addMenu(new LLObjectReturn(), "Object.Return");
- commit.add("Object.Duplicate", boost::bind(&LLSelectMgr::duplicate, LLSelectMgr::getInstance()));
- view_listener_t::addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
- view_listener_t::addMenu(new LLObjectMute(), "Object.Mute");
-
- enable.add("Object.VisibleTake", boost::bind(&visible_take_object));
- enable.add("Object.VisibleBuy", boost::bind(&visible_buy_object));
-
- commit.add("Object.Buy", boost::bind(&handle_buy));
- commit.add("Object.Edit", boost::bind(&handle_object_edit));
+ commit.add("Avatar.OpenMarketplace", boost::bind(&LLWeb::loadURLExternal, gSavedSettings.getString("MarketplaceURL")));
+
+ view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
+ enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2));
+
+ // Object pie menu
+ view_listener_t::addMenu(new LLObjectBuild(), "Object.Build");
+ commit.add("Object.Touch", boost::bind(&handle_object_touch));
+ commit.add("Object.ShowOriginal", boost::bind(&handle_object_show_original));
+ commit.add("Object.SitOrStand", boost::bind(&handle_object_sit_or_stand));
+ commit.add("Object.Delete", boost::bind(&handle_object_delete));
+ view_listener_t::addMenu(new LLObjectAttachToAvatar(true), "Object.AttachToAvatar");
+ view_listener_t::addMenu(new LLObjectAttachToAvatar(false), "Object.AttachAddToAvatar");
+ view_listener_t::addMenu(new LLObjectReturn(), "Object.Return");
+ commit.add("Object.Duplicate", boost::bind(&LLSelectMgr::duplicate, LLSelectMgr::getInstance()));
+ view_listener_t::addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
+ view_listener_t::addMenu(new LLObjectMute(), "Object.Mute");
+
+ enable.add("Object.VisibleTake", boost::bind(&visible_take_object));
+ enable.add("Object.VisibleBuy", boost::bind(&visible_buy_object));
+
+ commit.add("Object.Buy", boost::bind(&handle_buy));
+ commit.add("Object.Edit", boost::bind(&handle_object_edit));
commit.add("Object.Edit", boost::bind(&handle_object_edit));
commit.add("Object.EditGLTFMaterial", boost::bind(&handle_object_edit_gltf_material));
- commit.add("Object.Inspect", boost::bind(&handle_object_inspect));
- commit.add("Object.Open", boost::bind(&handle_object_open));
- commit.add("Object.Take", boost::bind(&handle_take));
- commit.add("Object.ShowInspector", boost::bind(&handle_object_show_inspector));
+ commit.add("Object.Inspect", boost::bind(&handle_object_inspect));
+ commit.add("Object.Open", boost::bind(&handle_object_open));
+ commit.add("Object.Take", boost::bind(&handle_take));
+ commit.add("Object.ShowInspector", boost::bind(&handle_object_show_inspector));
enable.add("Object.EnableInspect", boost::bind(&enable_object_inspect));
enable.add("Object.EnableEditGLTFMaterial", boost::bind(&enable_object_edit_gltf_material));
- enable.add("Object.EnableOpen", boost::bind(&enable_object_open));
- enable.add("Object.EnableTouch", boost::bind(&enable_object_touch, _1));
- enable.add("Object.EnableDelete", boost::bind(&enable_object_delete));
- enable.add("Object.EnableWear", boost::bind(&object_is_wearable));
-
- enable.add("Object.EnableStandUp", boost::bind(&enable_object_stand_up));
- enable.add("Object.EnableSit", boost::bind(&enable_object_sit, _1));
-
- view_listener_t::addMenu(new LLObjectEnableReturn(), "Object.EnableReturn");
- enable.add("Object.EnableDuplicate", boost::bind(&LLSelectMgr::canDuplicate, LLSelectMgr::getInstance()));
- view_listener_t::addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse");
-
- enable.add("Avatar.EnableMute", boost::bind(&enable_object_mute));
- enable.add("Object.EnableMute", boost::bind(&enable_object_mute));
- enable.add("Object.EnableUnmute", boost::bind(&enable_object_unmute));
- enable.add("Object.EnableBuy", boost::bind(&enable_buy_object));
- commit.add("Object.ZoomIn", boost::bind(&handle_look_at_selection, "zoom"));
-
- // Attachment pie menu
- enable.add("Attachment.Label", boost::bind(&onEnableAttachmentLabel, _1, _2));
- view_listener_t::addMenu(new LLAttachmentDrop(), "Attachment.Drop");
- view_listener_t::addMenu(new LLAttachmentDetachFromPoint(), "Attachment.DetachFromPoint");
- view_listener_t::addMenu(new LLAttachmentDetach(), "Attachment.Detach");
- view_listener_t::addMenu(new LLAttachmentPointFilled(), "Attachment.PointFilled");
- view_listener_t::addMenu(new LLAttachmentEnableDrop(), "Attachment.EnableDrop");
- view_listener_t::addMenu(new LLAttachmentEnableDetach(), "Attachment.EnableDetach");
-
- // Land pie menu
- view_listener_t::addMenu(new LLLandBuild(), "Land.Build");
- view_listener_t::addMenu(new LLLandSit(), "Land.Sit");
+ enable.add("Object.EnableOpen", boost::bind(&enable_object_open));
+ enable.add("Object.EnableTouch", boost::bind(&enable_object_touch, _1));
+ enable.add("Object.EnableDelete", boost::bind(&enable_object_delete));
+ enable.add("Object.EnableWear", boost::bind(&object_is_wearable));
+
+ enable.add("Object.EnableStandUp", boost::bind(&enable_object_stand_up));
+ enable.add("Object.EnableSit", boost::bind(&enable_object_sit, _1));
+
+ view_listener_t::addMenu(new LLObjectEnableReturn(), "Object.EnableReturn");
+ enable.add("Object.EnableDuplicate", boost::bind(&LLSelectMgr::canDuplicate, LLSelectMgr::getInstance()));
+ view_listener_t::addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse");
+
+ enable.add("Avatar.EnableMute", boost::bind(&enable_object_mute));
+ enable.add("Object.EnableMute", boost::bind(&enable_object_mute));
+ enable.add("Object.EnableUnmute", boost::bind(&enable_object_unmute));
+ enable.add("Object.EnableBuy", boost::bind(&enable_buy_object));
+ commit.add("Object.ZoomIn", boost::bind(&handle_look_at_selection, "zoom"));
+
+ // Attachment pie menu
+ enable.add("Attachment.Label", boost::bind(&onEnableAttachmentLabel, _1, _2));
+ view_listener_t::addMenu(new LLAttachmentDrop(), "Attachment.Drop");
+ view_listener_t::addMenu(new LLAttachmentDetachFromPoint(), "Attachment.DetachFromPoint");
+ view_listener_t::addMenu(new LLAttachmentDetach(), "Attachment.Detach");
+ view_listener_t::addMenu(new LLAttachmentPointFilled(), "Attachment.PointFilled");
+ view_listener_t::addMenu(new LLAttachmentEnableDrop(), "Attachment.EnableDrop");
+ view_listener_t::addMenu(new LLAttachmentEnableDetach(), "Attachment.EnableDetach");
+
+ // Land pie menu
+ view_listener_t::addMenu(new LLLandBuild(), "Land.Build");
+ view_listener_t::addMenu(new LLLandSit(), "Land.Sit");
view_listener_t::addMenu(new LLLandCanSit(), "Land.CanSit");
- view_listener_t::addMenu(new LLLandBuyPass(), "Land.BuyPass");
- view_listener_t::addMenu(new LLLandEdit(), "Land.Edit");
-
- // Particle muting
- view_listener_t::addMenu(new LLMuteParticle(), "Particle.Mute");
-
- view_listener_t::addMenu(new LLLandEnableBuyPass(), "Land.EnableBuyPass");
- commit.add("Land.Buy", boost::bind(&handle_buy_land));
-
- // Generic actions
- commit.add("ReportAbuse", boost::bind(&handle_report_abuse));
- commit.add("BuyCurrency", boost::bind(&handle_buy_currency));
- view_listener_t::addMenu(new LLShowHelp(), "ShowHelp");
- view_listener_t::addMenu(new LLToggleHelp(), "ToggleHelp");
- view_listener_t::addMenu(new LLToggleSpeak(), "ToggleSpeak");
- view_listener_t::addMenu(new LLPromptShowURL(), "PromptShowURL");
- view_listener_t::addMenu(new LLShowAgentProfile(), "ShowAgentProfile");
+ view_listener_t::addMenu(new LLLandBuyPass(), "Land.BuyPass");
+ view_listener_t::addMenu(new LLLandEdit(), "Land.Edit");
+
+ // Particle muting
+ view_listener_t::addMenu(new LLMuteParticle(), "Particle.Mute");
+
+ view_listener_t::addMenu(new LLLandEnableBuyPass(), "Land.EnableBuyPass");
+ commit.add("Land.Buy", boost::bind(&handle_buy_land));
+
+ // Generic actions
+ commit.add("ReportAbuse", boost::bind(&handle_report_abuse));
+ commit.add("BuyCurrency", boost::bind(&handle_buy_currency));
+ view_listener_t::addMenu(new LLShowHelp(), "ShowHelp");
+ view_listener_t::addMenu(new LLToggleHelp(), "ToggleHelp");
+ view_listener_t::addMenu(new LLToggleSpeak(), "ToggleSpeak");
+ view_listener_t::addMenu(new LLPromptShowURL(), "PromptShowURL");
+ view_listener_t::addMenu(new LLShowAgentProfile(), "ShowAgentProfile");
view_listener_t::addMenu(new LLShowAgentProfilePicks(), "ShowAgentProfilePicks");
- view_listener_t::addMenu(new LLToggleAgentProfile(), "ToggleAgentProfile");
- view_listener_t::addMenu(new LLToggleControl(), "ToggleControl");
+ view_listener_t::addMenu(new LLToggleAgentProfile(), "ToggleAgentProfile");
+ view_listener_t::addMenu(new LLToggleControl(), "ToggleControl");
view_listener_t::addMenu(new LLToggleShaderControl(), "ToggleShaderControl");
- view_listener_t::addMenu(new LLCheckControl(), "CheckControl");
- view_listener_t::addMenu(new LLGoToObject(), "GoToObject");
- commit.add("PayObject", boost::bind(&handle_give_money_dialog));
-
- commit.add("Inventory.NewWindow", boost::bind(&LLPanelMainInventory::newWindow));
-
- enable.add("EnablePayObject", boost::bind(&enable_pay_object));
- enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar));
- enable.add("EnableEdit", boost::bind(&enable_object_edit));
- enable.add("EnableMuteParticle", boost::bind(&enable_mute_particle));
- enable.add("VisibleBuild", boost::bind(&enable_object_build));
- commit.add("Pathfinding.Linksets.Select", boost::bind(&LLFloaterPathfindingLinksets::openLinksetsWithSelectedObjects));
- enable.add("EnableSelectInPathfindingLinksets", boost::bind(&enable_object_select_in_pathfinding_linksets));
- enable.add("VisibleSelectInPathfindingLinksets", boost::bind(&visible_object_select_in_pathfinding_linksets));
- commit.add("Pathfinding.Characters.Select", boost::bind(&LLFloaterPathfindingCharacters::openCharactersWithSelectedObjects));
- enable.add("EnableSelectInPathfindingCharacters", boost::bind(&enable_object_select_in_pathfinding_characters));
+ view_listener_t::addMenu(new LLCheckControl(), "CheckControl");
+ view_listener_t::addMenu(new LLGoToObject(), "GoToObject");
+ commit.add("PayObject", boost::bind(&handle_give_money_dialog));
+
+ commit.add("Inventory.NewWindow", boost::bind(&LLPanelMainInventory::newWindow));
+
+ enable.add("EnablePayObject", boost::bind(&enable_pay_object));
+ enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar));
+ enable.add("EnableEdit", boost::bind(&enable_object_edit));
+ enable.add("EnableMuteParticle", boost::bind(&enable_mute_particle));
+ enable.add("VisibleBuild", boost::bind(&enable_object_build));
+ commit.add("Pathfinding.Linksets.Select", boost::bind(&LLFloaterPathfindingLinksets::openLinksetsWithSelectedObjects));
+ enable.add("EnableSelectInPathfindingLinksets", boost::bind(&enable_object_select_in_pathfinding_linksets));
+ enable.add("VisibleSelectInPathfindingLinksets", boost::bind(&visible_object_select_in_pathfinding_linksets));
+ commit.add("Pathfinding.Characters.Select", boost::bind(&LLFloaterPathfindingCharacters::openCharactersWithSelectedObjects));
+ enable.add("EnableSelectInPathfindingCharacters", boost::bind(&enable_object_select_in_pathfinding_characters));
enable.add("Advanced.EnableErrorOSException", boost::bind(&enable_os_exception));
- view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible");
- view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel");
- view_listener_t::addMenu(new LLSidetrayPanelVisible(), "SidetrayPanelVisible");
- view_listener_t::addMenu(new LLSomethingSelected(), "SomethingSelected");
- view_listener_t::addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD");
- view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected");
- view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono");
- view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints");
+ view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible");
+ view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel");
+ view_listener_t::addMenu(new LLSidetrayPanelVisible(), "SidetrayPanelVisible");
+ view_listener_t::addMenu(new LLSomethingSelected(), "SomethingSelected");
+ view_listener_t::addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD");
+ view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected");
+ view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono");
+ view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints");
}
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index 7142763451..6683c5f2e6 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewermenu.h
* @brief Builds menus out of objects
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -155,38 +155,38 @@ U64 info_display_from_string(std::string info_display);
class LLViewerMenuHolderGL : public LLMenuHolderGL
{
public:
- struct Params : public LLInitParam::Block<Params, LLMenuHolderGL::Params>
- {};
+ struct Params : public LLInitParam::Block<Params, LLMenuHolderGL::Params>
+ {};
+
+ LLViewerMenuHolderGL(const Params& p);
- LLViewerMenuHolderGL(const Params& p);
+ virtual BOOL hideMenus();
- virtual BOOL hideMenus();
-
- void setParcelSelection(LLSafeHandle<LLParcelSelection> selection);
- void setObjectSelection(LLSafeHandle<LLObjectSelection> selection);
+ void setParcelSelection(LLSafeHandle<LLParcelSelection> selection);
+ void setObjectSelection(LLSafeHandle<LLObjectSelection> selection);
- virtual const LLRect getMenuRect() const;
+ virtual const LLRect getMenuRect() const;
protected:
- LLSafeHandle<LLParcelSelection> mParcelSelection;
- LLSafeHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLParcelSelection> mParcelSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
};
-extern LLMenuBarGL* gMenuBarView;
-//extern LLView* gMenuBarHolder;
-extern LLMenuGL* gEditMenu;
-extern LLMenuGL* gPopupMenuView;
-extern LLViewerMenuHolderGL* gMenuHolder;
-extern LLMenuBarGL* gLoginMenuBarView;
+extern LLMenuBarGL* gMenuBarView;
+//extern LLView* gMenuBarHolder;
+extern LLMenuGL* gEditMenu;
+extern LLMenuGL* gPopupMenuView;
+extern LLViewerMenuHolderGL* gMenuHolder;
+extern LLMenuBarGL* gLoginMenuBarView;
// Context menus in 3D scene
-extern LLContextMenu *gMenuAvatarSelf;
-extern LLContextMenu *gMenuAvatarOther;
-extern LLContextMenu *gMenuObject;
-extern LLContextMenu *gMenuAttachmentSelf;
-extern LLContextMenu *gMenuAttachmentOther;
-extern LLContextMenu *gMenuLand;
-extern LLContextMenu *gMenuMuteParticle;
+extern LLContextMenu *gMenuAvatarSelf;
+extern LLContextMenu *gMenuAvatarOther;
+extern LLContextMenu *gMenuObject;
+extern LLContextMenu *gMenuAttachmentSelf;
+extern LLContextMenu *gMenuAttachmentOther;
+extern LLContextMenu *gMenuLand;
+extern LLContextMenu *gMenuMuteParticle;
// Needed to build menus when attachment site list available
extern LLMenuGL* gAttachSubMenu;
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 5461e0f362..b746d167ba 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewermenufile.cpp
* @brief "File" menu in the main menu bar.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,17 +47,17 @@
#include "llimagej2c.h"
#include "llimagejpeg.h"
#include "llimagetga.h"
-#include "llinventorymodel.h" // gInventory
+#include "llinventorymodel.h" // gInventory
#include "llpluginclassmedia.h"
#include "llresourcedata.h"
#include "llstatusbar.h"
#include "lltinygltfhelper.h"
#include "lltoast.h"
-#include "llviewercontrol.h" // gSavedSettings
+#include "llviewercontrol.h" // gSavedSettings
#include "llviewertexturelist.h"
#include "lluictrlfactory.h"
#include "llviewerinventory.h"
-#include "llviewermenu.h" // gMenuHolder
+#include "llviewermenu.h" // gMenuHolder
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llviewerstats.h"
@@ -83,24 +83,24 @@
class LLFileEnableUpload : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
+ bool handleEvent(const LLSD& userdata)
+ {
return true;
- }
+ }
};
class LLFileEnableUploadModel : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) LLFloaterReg::findInstance("upload_model");
- if (fmp && fmp->isModelLoading())
- {
- return false;
- }
-
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) LLFloaterReg::findInstance("upload_model");
+ if (fmp && fmp->isModelLoading())
+ {
+ return false;
+ }
+
+ return true;
+ }
};
class LLFileEnableUploadMaterial : public view_listener_t
@@ -118,18 +118,18 @@ class LLFileEnableUploadMaterial : public view_listener_t
class LLMeshEnabled : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return gSavedSettings.getBOOL("MeshEnabled");
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return gSavedSettings.getBOOL("MeshEnabled");
+ }
};
class LLMeshUploadVisible : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- return gMeshRepo.meshUploadEnabled();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ return gMeshRepo.meshUploadEnabled();
+ }
};
LLMutex* LLFilePickerThread::sMutex = NULL;
@@ -139,51 +139,51 @@ void LLFilePickerThread::getFile()
{
#if LL_WINDOWS
// Todo: get rid of LLFilePickerThread and make this modeless
- start();
+ start();
#elif LL_DARWIN
runModeless();
#else
- run();
+ run();
#endif
}
-//virtual
+//virtual
void LLFilePickerThread::run()
{
#if LL_WINDOWS
- bool blocking = false;
+ bool blocking = false;
#else
- bool blocking = true; // modal
+ bool blocking = true; // modal
#endif
- LLFilePicker picker;
-
- if (mIsSaveDialog)
- {
- if (picker.getSaveFile(mSaveFilter, mProposedName, blocking))
- {
- mResponses.push_back(picker.getFirstFile());
- }
- }
- else
- {
- bool result = mIsGetMultiple ? picker.getMultipleOpenFiles(mLoadFilter, blocking) : picker.getOpenFile(mLoadFilter, blocking);
- if (result)
- {
- std::string filename = picker.getFirstFile(); // consider copying mFiles directly
- do
- {
- mResponses.push_back(filename);
- filename = picker.getNextFile();
- }
- while (mIsGetMultiple && !filename.empty());
- }
- }
-
- {
- LLMutexLock lock(sMutex);
- sDeadQ.push(this);
- }
+ LLFilePicker picker;
+
+ if (mIsSaveDialog)
+ {
+ if (picker.getSaveFile(mSaveFilter, mProposedName, blocking))
+ {
+ mResponses.push_back(picker.getFirstFile());
+ }
+ }
+ else
+ {
+ bool result = mIsGetMultiple ? picker.getMultipleOpenFiles(mLoadFilter, blocking) : picker.getOpenFile(mLoadFilter, blocking);
+ if (result)
+ {
+ std::string filename = picker.getFirstFile(); // consider copying mFiles directly
+ do
+ {
+ mResponses.push_back(filename);
+ filename = picker.getNextFile();
+ }
+ while (mIsGetMultiple && !filename.empty());
+ }
+ }
+
+ {
+ LLMutexLock lock(sMutex);
+ sDeadQ.push(this);
+ }
}
void LLFilePickerThread::runModeless()
@@ -206,7 +206,7 @@ void LLFilePickerThread::runModeless()
{
result = picker.getOpenFileModeless(mLoadFilter, modelessVectorCallback, this);
}
-
+
if (!result)
{
LLMutexLock lock(sMutex);
@@ -223,7 +223,7 @@ void LLFilePickerThread::modelessStringCallback(bool success,
{
picker->mResponses.push_back(response);
}
-
+
{
LLMutexLock lock(sMutex);
sDeadQ.push(picker);
@@ -255,7 +255,7 @@ void LLFilePickerThread::modelessVectorCallback(bool success,
}
}
}
-
+
{
LLMutexLock lock(sMutex);
sDeadQ.push(picker);
@@ -265,66 +265,66 @@ void LLFilePickerThread::modelessVectorCallback(bool success,
//static
void LLFilePickerThread::initClass()
{
- sMutex = new LLMutex();
+ sMutex = new LLMutex();
}
//static
void LLFilePickerThread::cleanupClass()
{
- clearDead();
-
- delete sMutex;
- sMutex = NULL;
+ clearDead();
+
+ delete sMutex;
+ sMutex = NULL;
}
//static
void LLFilePickerThread::clearDead()
{
- if (!sDeadQ.empty())
- {
- LLMutexLock lock(sMutex);
- while (!sDeadQ.empty())
- {
- LLFilePickerThread* thread = sDeadQ.front();
- thread->notify(thread->mResponses);
- delete thread;
- sDeadQ.pop();
- }
- }
+ if (!sDeadQ.empty())
+ {
+ LLMutexLock lock(sMutex);
+ while (!sDeadQ.empty())
+ {
+ LLFilePickerThread* thread = sDeadQ.front();
+ thread->notify(thread->mResponses);
+ delete thread;
+ sDeadQ.pop();
+ }
+ }
}
LLFilePickerReplyThread::LLFilePickerReplyThread(const file_picked_signal_t::slot_type& cb, LLFilePicker::ELoadFilter filter, bool get_multiple, const file_picked_signal_t::slot_type& failure_cb)
- : LLFilePickerThread(filter, get_multiple),
- mLoadFilter(filter),
- mSaveFilter(LLFilePicker::FFSAVE_ALL),
- mFilePickedSignal(NULL),
- mFailureSignal(NULL)
+ : LLFilePickerThread(filter, get_multiple),
+ mLoadFilter(filter),
+ mSaveFilter(LLFilePicker::FFSAVE_ALL),
+ mFilePickedSignal(NULL),
+ mFailureSignal(NULL)
{
- mFilePickedSignal = new file_picked_signal_t();
- mFilePickedSignal->connect(cb);
+ mFilePickedSignal = new file_picked_signal_t();
+ mFilePickedSignal->connect(cb);
- mFailureSignal = new file_picked_signal_t();
- mFailureSignal->connect(failure_cb);
+ mFailureSignal = new file_picked_signal_t();
+ mFailureSignal->connect(failure_cb);
}
LLFilePickerReplyThread::LLFilePickerReplyThread(const file_picked_signal_t::slot_type& cb, LLFilePicker::ESaveFilter filter, const std::string &proposed_name, const file_picked_signal_t::slot_type& failure_cb)
- : LLFilePickerThread(filter, proposed_name),
- mLoadFilter(LLFilePicker::FFLOAD_ALL),
- mSaveFilter(filter),
- mFilePickedSignal(NULL),
- mFailureSignal(NULL)
+ : LLFilePickerThread(filter, proposed_name),
+ mLoadFilter(LLFilePicker::FFLOAD_ALL),
+ mSaveFilter(filter),
+ mFilePickedSignal(NULL),
+ mFailureSignal(NULL)
{
- mFilePickedSignal = new file_picked_signal_t();
- mFilePickedSignal->connect(cb);
+ mFilePickedSignal = new file_picked_signal_t();
+ mFilePickedSignal->connect(cb);
- mFailureSignal = new file_picked_signal_t();
- mFailureSignal->connect(failure_cb);
+ mFailureSignal = new file_picked_signal_t();
+ mFailureSignal->connect(failure_cb);
}
LLFilePickerReplyThread::~LLFilePickerReplyThread()
{
- delete mFilePickedSignal;
- delete mFailureSignal;
+ delete mFilePickedSignal;
+ delete mFailureSignal;
}
void LLFilePickerReplyThread::startPicker(const file_picked_signal_t::slot_type & cb, LLFilePicker::ELoadFilter filter, bool get_multiple, const file_picked_signal_t::slot_type & failure_cb)
@@ -339,20 +339,20 @@ void LLFilePickerReplyThread::startPicker(const file_picked_signal_t::slot_type
void LLFilePickerReplyThread::notify(const std::vector<std::string>& filenames)
{
- if (filenames.empty())
- {
- if (mFailureSignal)
- {
- (*mFailureSignal)(filenames, mLoadFilter, mSaveFilter);
- }
- }
- else
- {
- if (mFilePickedSignal)
- {
- (*mFilePickedSignal)(filenames, mLoadFilter, mSaveFilter);
- }
- }
+ if (filenames.empty())
+ {
+ if (mFailureSignal)
+ {
+ (*mFailureSignal)(filenames, mLoadFilter, mSaveFilter);
+ }
+ }
+ else
+ {
+ if (mFilePickedSignal)
+ {
+ (*mFilePickedSignal)(filenames, mLoadFilter, mSaveFilter);
+ }
+ }
}
@@ -389,167 +389,167 @@ static std::string MATERIAL_EXTENSIONS = "gltf glb";
std::string build_extensions_string(LLFilePicker::ELoadFilter filter)
{
- switch(filter)
- {
+ switch(filter)
+ {
#if LL_WINDOWS
- case LLFilePicker::FFLOAD_IMAGE:
- return IMAGE_EXTENSIONS;
- case LLFilePicker::FFLOAD_WAV:
- return SOUND_EXTENSIONS;
- case LLFilePicker::FFLOAD_ANIM:
- return ANIM_EXTENSIONS;
- case LLFilePicker::FFLOAD_SLOBJECT:
- return SLOBJECT_EXTENSIONS;
- case LLFilePicker::FFLOAD_MODEL:
- return MODEL_EXTENSIONS;
+ case LLFilePicker::FFLOAD_IMAGE:
+ return IMAGE_EXTENSIONS;
+ case LLFilePicker::FFLOAD_WAV:
+ return SOUND_EXTENSIONS;
+ case LLFilePicker::FFLOAD_ANIM:
+ return ANIM_EXTENSIONS;
+ case LLFilePicker::FFLOAD_SLOBJECT:
+ return SLOBJECT_EXTENSIONS;
+ case LLFilePicker::FFLOAD_MODEL:
+ return MODEL_EXTENSIONS;
case LLFilePicker::FFLOAD_MATERIAL:
return MATERIAL_EXTENSIONS;
- case LLFilePicker::FFLOAD_XML:
- return XML_EXTENSIONS;
+ case LLFilePicker::FFLOAD_XML:
+ return XML_EXTENSIONS;
case LLFilePicker::FFLOAD_ALL:
case LLFilePicker::FFLOAD_EXE:
- return ALL_FILE_EXTENSIONS;
+ return ALL_FILE_EXTENSIONS;
#endif
default:
- return ALL_FILE_EXTENSIONS;
- }
+ return ALL_FILE_EXTENSIONS;
+ }
}
const bool check_file_extension(const std::string& filename, LLFilePicker::ELoadFilter type)
{
- std::string ext = gDirUtilp->getExtension(filename);
-
- //strincmp doesn't like NULL pointers
- if (ext.empty())
- {
- std::string short_name = gDirUtilp->getBaseFileName(filename);
-
- // No extension
- LLSD args;
- args["FILE"] = short_name;
- LLNotificationsUtil::add("NoFileExtension", args);
- return false;
- }
- else
- {
- //so there is an extension
- //loop over the valid extensions and compare to see
- //if the extension is valid
-
- //now grab the set of valid file extensions
- std::string valid_extensions = build_extensions_string(type);
-
- BOOL ext_valid = FALSE;
-
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep(" ");
- tokenizer tokens(valid_extensions, sep);
- tokenizer::iterator token_iter;
-
- //now loop over all valid file extensions
- //and compare them to the extension of the file
- //to be uploaded
- for (token_iter = tokens.begin();
- token_iter != tokens.end() && ext_valid != TRUE;
- ++token_iter)
- {
- const std::string& cur_token = *token_iter;
-
- if (cur_token == ext || cur_token == "*.*")
- {
- //valid extension
- //or the acceptable extension is any
- ext_valid = TRUE;
- }
- }//end for (loop over all tokens)
-
- if (ext_valid == FALSE)
- {
- //should only get here if the extension exists
- //but is invalid
- LLSD args;
- args["EXTENSION"] = ext;
- args["VALIDS"] = valid_extensions;
- LLNotificationsUtil::add("InvalidFileExtension", args);
- return false;
- }
- }//end else (non-null extension)
- return true;
+ std::string ext = gDirUtilp->getExtension(filename);
+
+ //strincmp doesn't like NULL pointers
+ if (ext.empty())
+ {
+ std::string short_name = gDirUtilp->getBaseFileName(filename);
+
+ // No extension
+ LLSD args;
+ args["FILE"] = short_name;
+ LLNotificationsUtil::add("NoFileExtension", args);
+ return false;
+ }
+ else
+ {
+ //so there is an extension
+ //loop over the valid extensions and compare to see
+ //if the extension is valid
+
+ //now grab the set of valid file extensions
+ std::string valid_extensions = build_extensions_string(type);
+
+ BOOL ext_valid = FALSE;
+
+ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+ boost::char_separator<char> sep(" ");
+ tokenizer tokens(valid_extensions, sep);
+ tokenizer::iterator token_iter;
+
+ //now loop over all valid file extensions
+ //and compare them to the extension of the file
+ //to be uploaded
+ for (token_iter = tokens.begin();
+ token_iter != tokens.end() && ext_valid != TRUE;
+ ++token_iter)
+ {
+ const std::string& cur_token = *token_iter;
+
+ if (cur_token == ext || cur_token == "*.*")
+ {
+ //valid extension
+ //or the acceptable extension is any
+ ext_valid = TRUE;
+ }
+ }//end for (loop over all tokens)
+
+ if (ext_valid == FALSE)
+ {
+ //should only get here if the extension exists
+ //but is invalid
+ LLSD args;
+ args["EXTENSION"] = ext;
+ args["VALIDS"] = valid_extensions;
+ LLNotificationsUtil::add("InvalidFileExtension", args);
+ return false;
+ }
+ }//end else (non-null extension)
+ return true;
}
const void upload_single_file(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter type)
{
- std::string filename = filenames[0];
- if (!check_file_extension(filename, type)) return;
-
- if (!filename.empty())
- {
- if (type == LLFilePicker::FFLOAD_WAV)
- {
- // pre-qualify wavs to make sure the format is acceptable
- std::string error_msg;
- if (check_for_invalid_wav_formats(filename, error_msg))
- {
- LL_INFOS() << error_msg << ": " << filename << LL_ENDL;
- LLSD args;
- args["FILE"] = filename;
- LLNotificationsUtil::add(error_msg, args);
- return;
- }
- else
- {
- LLFloaterReg::showInstance("upload_sound", LLSD(filename));
- }
- }
- if (type == LLFilePicker::FFLOAD_IMAGE)
- {
- LLFloaterReg::showInstance("upload_image", LLSD(filename));
- }
- if (type == LLFilePicker::FFLOAD_ANIM)
- {
- std::string filename_lc(filename);
- LLStringUtil::toLower(filename_lc);
- if (filename_lc.rfind(".anim") != std::string::npos)
- {
- LLFloaterReg::showInstance("upload_anim_anim", LLSD(filename));
- }
- else
- {
- LLFloaterReg::showInstance("upload_anim_bvh", LLSD(filename));
- }
- }
- }
- return;
+ std::string filename = filenames[0];
+ if (!check_file_extension(filename, type)) return;
+
+ if (!filename.empty())
+ {
+ if (type == LLFilePicker::FFLOAD_WAV)
+ {
+ // pre-qualify wavs to make sure the format is acceptable
+ std::string error_msg;
+ if (check_for_invalid_wav_formats(filename, error_msg))
+ {
+ LL_INFOS() << error_msg << ": " << filename << LL_ENDL;
+ LLSD args;
+ args["FILE"] = filename;
+ LLNotificationsUtil::add(error_msg, args);
+ return;
+ }
+ else
+ {
+ LLFloaterReg::showInstance("upload_sound", LLSD(filename));
+ }
+ }
+ if (type == LLFilePicker::FFLOAD_IMAGE)
+ {
+ LLFloaterReg::showInstance("upload_image", LLSD(filename));
+ }
+ if (type == LLFilePicker::FFLOAD_ANIM)
+ {
+ std::string filename_lc(filename);
+ LLStringUtil::toLower(filename_lc);
+ if (filename_lc.rfind(".anim") != std::string::npos)
+ {
+ LLFloaterReg::showInstance("upload_anim_anim", LLSD(filename));
+ }
+ else
+ {
+ LLFloaterReg::showInstance("upload_anim_bvh", LLSD(filename));
+ }
+ }
+ }
+ return;
}
void do_bulk_upload(std::vector<std::string> filenames, const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option != 0)
- {
- // Cancel upload
- return;
- }
-
- for (std::vector<std::string>::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter)
- {
- std::string filename = (*in_iter);
-
- std::string name = gDirUtilp->getBaseFileName(filename, true);
- std::string asset_name = name;
- LLStringUtil::replaceNonstandardASCII(asset_name, '?');
- LLStringUtil::replaceChar(asset_name, '|', '?');
- LLStringUtil::stripNonprintable(asset_name);
- LLStringUtil::trim(asset_name);
-
- std::string ext = gDirUtilp->getExtension(filename);
- LLAssetType::EType asset_type;
- U32 codec;
- S32 expected_upload_cost;
- if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) &&
- LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost))
- {
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0)
+ {
+ // Cancel upload
+ return;
+ }
+
+ for (std::vector<std::string>::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter)
+ {
+ std::string filename = (*in_iter);
+
+ std::string name = gDirUtilp->getBaseFileName(filename, true);
+ std::string asset_name = name;
+ LLStringUtil::replaceNonstandardASCII(asset_name, '?');
+ LLStringUtil::replaceChar(asset_name, '|', '?');
+ LLStringUtil::stripNonprintable(asset_name);
+ LLStringUtil::trim(asset_name);
+
+ std::string ext = gDirUtilp->getExtension(filename);
+ LLAssetType::EType asset_type;
+ U32 codec;
+ S32 expected_upload_cost;
+ if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) &&
+ LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost))
+ {
LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo(
filename,
asset_name,
@@ -585,34 +585,34 @@ void do_bulk_upload(std::vector<std::string> filenames, const LLSD& notification
bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S32& total_cost, S32& file_count, S32& bvh_count)
{
- total_cost = 0;
- file_count = 0;
- bvh_count = 0;
- for (std::vector<std::string>::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter)
- {
- std::string filename = (*in_iter);
- std::string ext = gDirUtilp->getExtension(filename);
-
- if (ext == "bvh")
- {
- bvh_count++;
- }
-
- LLAssetType::EType asset_type;
- U32 codec;
- S32 cost;
-
- if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) &&
- LLAgentBenefitsMgr::current().findUploadCost(asset_type, cost))
- {
- total_cost += cost;
- file_count++;
- }
+ total_cost = 0;
+ file_count = 0;
+ bvh_count = 0;
+ for (std::vector<std::string>::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter)
+ {
+ std::string filename = (*in_iter);
+ std::string ext = gDirUtilp->getExtension(filename);
+
+ if (ext == "bvh")
+ {
+ bvh_count++;
+ }
+
+ LLAssetType::EType asset_type;
+ U32 codec;
+ S32 cost;
+
+ if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) &&
+ LLAgentBenefitsMgr::current().findUploadCost(asset_type, cost))
+ {
+ total_cost += cost;
+ file_count++;
+ }
if (ext == "gltf" || ext == "glb")
{
S32 texture_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
-
+
tinygltf::Model model;
if (LLTinyGLTFHelper::loadModel(filename, model))
@@ -652,87 +652,87 @@ bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S3
}
}
}
- }
-
+ }
+
return file_count > 0;
}
const void upload_bulk(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter type)
{
- // TODO:
- // Check user balance for entire cost
- // Charge user entire cost
- // Loop, uploading
- // If an upload fails, refund the user for that one
- //
- // Also fix single upload to charge first, then refund
-
- // FIXME PREMIUM what about known types that can't be bulk uploaded
- // (bvh)? These will fail in the item by item upload but won't be
- // mentioned in the notification.
- std::vector<std::string> filtered_filenames;
- for (std::vector<std::string>::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter)
- {
- const std::string& filename = *in_iter;
- if (check_file_extension(filename, type))
- {
- filtered_filenames.push_back(filename);
- }
- }
-
- S32 expected_upload_cost;
- S32 expected_upload_count;
- S32 bvh_count;
- if (get_bulk_upload_expected_cost(filtered_filenames, expected_upload_cost, expected_upload_count, bvh_count))
- {
- LLSD args;
- args["COST"] = expected_upload_cost;
- args["COUNT"] = expected_upload_count;
- LLNotificationsUtil::add("BulkUploadCostConfirmation", args, LLSD(), boost::bind(do_bulk_upload, filtered_filenames, _1, _2));
-
- if (filtered_filenames.size() > expected_upload_count)
- {
- if (bvh_count == filtered_filenames.size() - expected_upload_count)
- {
- LLNotificationsUtil::add("DoNotSupportBulkAnimationUpload");
- }
- else
- {
- LLNotificationsUtil::add("BulkUploadIncompatibleFiles");
- }
- }
- }
- else if (bvh_count == filtered_filenames.size())
- {
- LLNotificationsUtil::add("DoNotSupportBulkAnimationUpload");
- }
- else
- {
- LLNotificationsUtil::add("BulkUploadNoCompatibleFiles");
- }
+ // TODO:
+ // Check user balance for entire cost
+ // Charge user entire cost
+ // Loop, uploading
+ // If an upload fails, refund the user for that one
+ //
+ // Also fix single upload to charge first, then refund
+
+ // FIXME PREMIUM what about known types that can't be bulk uploaded
+ // (bvh)? These will fail in the item by item upload but won't be
+ // mentioned in the notification.
+ std::vector<std::string> filtered_filenames;
+ for (std::vector<std::string>::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter)
+ {
+ const std::string& filename = *in_iter;
+ if (check_file_extension(filename, type))
+ {
+ filtered_filenames.push_back(filename);
+ }
+ }
+
+ S32 expected_upload_cost;
+ S32 expected_upload_count;
+ S32 bvh_count;
+ if (get_bulk_upload_expected_cost(filtered_filenames, expected_upload_cost, expected_upload_count, bvh_count))
+ {
+ LLSD args;
+ args["COST"] = expected_upload_cost;
+ args["COUNT"] = expected_upload_count;
+ LLNotificationsUtil::add("BulkUploadCostConfirmation", args, LLSD(), boost::bind(do_bulk_upload, filtered_filenames, _1, _2));
+
+ if (filtered_filenames.size() > expected_upload_count)
+ {
+ if (bvh_count == filtered_filenames.size() - expected_upload_count)
+ {
+ LLNotificationsUtil::add("DoNotSupportBulkAnimationUpload");
+ }
+ else
+ {
+ LLNotificationsUtil::add("BulkUploadIncompatibleFiles");
+ }
+ }
+ }
+ else if (bvh_count == filtered_filenames.size())
+ {
+ LLNotificationsUtil::add("DoNotSupportBulkAnimationUpload");
+ }
+ else
+ {
+ LLNotificationsUtil::add("BulkUploadNoCompatibleFiles");
+ }
}
class LLFileUploadImage : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgentCamera.cameraMouselook())
- {
- gAgentCamera.changeCameraToDefault();
- }
- LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_IMAGE, false);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (gAgentCamera.cameraMouselook())
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+ LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_IMAGE, false);
+ return true;
+ }
};
class LLFileUploadModel : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
+ bool handleEvent(const LLSD& userdata)
+ {
LLFloaterModelPreview::showModelPreview();
return TRUE;
- }
+ }
};
class LLFileUploadMaterial : public view_listener_t
@@ -746,213 +746,213 @@ class LLFileUploadMaterial : public view_listener_t
class LLFileUploadSound : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgentCamera.cameraMouselook())
- {
- gAgentCamera.changeCameraToDefault();
- }
- LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_WAV, false);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (gAgentCamera.cameraMouselook())
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+ LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_WAV, false);
+ return true;
+ }
};
class LLFileUploadAnim : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgentCamera.cameraMouselook())
- {
- gAgentCamera.changeCameraToDefault();
- }
- LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_ANIM, false);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (gAgentCamera.cameraMouselook())
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+ LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_ANIM, false);
+ return true;
+ }
};
class LLFileUploadBulk : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgentCamera.cameraMouselook())
- {
- gAgentCamera.changeCameraToDefault();
- }
- LLFilePickerReplyThread::startPicker(boost::bind(&upload_bulk, _1, _2), LLFilePicker::FFLOAD_ALL, true);
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ if (gAgentCamera.cameraMouselook())
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+ LLFilePickerReplyThread::startPicker(boost::bind(&upload_bulk, _1, _2), LLFilePicker::FFLOAD_ALL, true);
+ return true;
+ }
};
-void upload_error(const std::string& error_message, const std::string& label, const std::string& filename, const LLSD& args)
+void upload_error(const std::string& error_message, const std::string& label, const std::string& filename, const LLSD& args)
{
- LL_WARNS() << error_message << LL_ENDL;
- LLNotificationsUtil::add(label, args);
- if(LLFile::remove(filename) == -1)
- {
- LL_DEBUGS() << "unable to remove temp file" << LL_ENDL;
- }
- LLFilePicker::instance().reset();
+ LL_WARNS() << error_message << LL_ENDL;
+ LLNotificationsUtil::add(label, args);
+ if(LLFile::remove(filename) == -1)
+ {
+ LL_DEBUGS() << "unable to remove temp file" << LL_ENDL;
+ }
+ LLFilePicker::instance().reset();
}
class LLFileEnableCloseWindow : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool frontmost_fl_exists = (NULL != gFloaterView->getFrontmostClosableFloater());
- bool frontmost_snapshot_fl_exists = (NULL != gSnapshotFloaterView->getFrontmostClosableFloater());
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool frontmost_fl_exists = (NULL != gFloaterView->getFrontmostClosableFloater());
+ bool frontmost_snapshot_fl_exists = (NULL != gSnapshotFloaterView->getFrontmostClosableFloater());
- return !LLNotificationsUI::LLToast::isAlertToastShown() && (frontmost_fl_exists || frontmost_snapshot_fl_exists);
- }
+ return !LLNotificationsUI::LLToast::isAlertToastShown() && (frontmost_fl_exists || frontmost_snapshot_fl_exists);
+ }
};
class LLFileCloseWindow : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool frontmost_fl_exists = (NULL != gFloaterView->getFrontmostClosableFloater());
- LLFloater* snapshot_floater = gSnapshotFloaterView->getFrontmostClosableFloater();
-
- if(snapshot_floater && (!frontmost_fl_exists || snapshot_floater->hasFocus()))
- {
- snapshot_floater->closeFloater();
- if (gFocusMgr.getKeyboardFocus() == NULL)
- {
- gFloaterView->focusFrontFloater();
- }
- }
- else
- {
- LLFloater::closeFrontmostFloater();
- }
- if (gMenuHolder) gMenuHolder->hideMenus();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool frontmost_fl_exists = (NULL != gFloaterView->getFrontmostClosableFloater());
+ LLFloater* snapshot_floater = gSnapshotFloaterView->getFrontmostClosableFloater();
+
+ if(snapshot_floater && (!frontmost_fl_exists || snapshot_floater->hasFocus()))
+ {
+ snapshot_floater->closeFloater();
+ if (gFocusMgr.getKeyboardFocus() == NULL)
+ {
+ gFloaterView->focusFrontFloater();
+ }
+ }
+ else
+ {
+ LLFloater::closeFrontmostFloater();
+ }
+ if (gMenuHolder) gMenuHolder->hideMenus();
+ return true;
+ }
};
class LLFileEnableCloseAllWindows : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
- bool is_floaters_snapshot_opened = (floater_snapshot && floater_snapshot->isInVisibleChain());
- bool open_children = gFloaterView->allChildrenClosed() && !is_floaters_snapshot_opened;
- return !open_children && !LLNotificationsUI::LLToast::isAlertToastShown();
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
+ bool is_floaters_snapshot_opened = (floater_snapshot && floater_snapshot->isInVisibleChain());
+ bool open_children = gFloaterView->allChildrenClosed() && !is_floaters_snapshot_opened;
+ return !open_children && !LLNotificationsUI::LLToast::isAlertToastShown();
+ }
};
class LLFileCloseAllWindows : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- bool app_quitting = false;
- gFloaterView->closeAllChildren(app_quitting);
- LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
- if (floater_snapshot)
- floater_snapshot->closeFloater(app_quitting);
- if (gMenuHolder) gMenuHolder->hideMenus();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool app_quitting = false;
+ gFloaterView->closeAllChildren(app_quitting);
+ LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
+ if (floater_snapshot)
+ floater_snapshot->closeFloater(app_quitting);
+ if (gMenuHolder) gMenuHolder->hideMenus();
+ return true;
+ }
};
class LLFileTakeSnapshotToDisk : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLPointer<LLImageRaw> raw = new LLImageRaw;
-
- S32 width = gViewerWindow->getWindowWidthRaw();
- S32 height = gViewerWindow->getWindowHeightRaw();
-
- BOOL render_ui = gSavedSettings.getBOOL("RenderUIInSnapshot");
- BOOL render_hud = gSavedSettings.getBOOL("RenderHUDInSnapshot");
- BOOL render_no_post = gSavedSettings.getBOOL("RenderSnapshotNoPost");
-
- BOOL high_res = gSavedSettings.getBOOL("HighResSnapshot");
- if (high_res)
- {
- width *= 2;
- height *= 2;
- // not compatible with UI/HUD
- render_ui = false;
- render_hud = false;
- }
-
- if (gViewerWindow->rawSnapshot(raw,
- width,
- height,
- TRUE,
- FALSE,
- render_ui,
- render_hud,
- FALSE,
- render_no_post,
- LLSnapshotModel::SNAPSHOT_TYPE_COLOR,
- high_res ? S32_MAX : MAX_SNAPSHOT_IMAGE_SIZE)) //per side
- {
- LLPointer<LLImageFormatted> formatted;
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLPointer<LLImageRaw> raw = new LLImageRaw;
+
+ S32 width = gViewerWindow->getWindowWidthRaw();
+ S32 height = gViewerWindow->getWindowHeightRaw();
+
+ BOOL render_ui = gSavedSettings.getBOOL("RenderUIInSnapshot");
+ BOOL render_hud = gSavedSettings.getBOOL("RenderHUDInSnapshot");
+ BOOL render_no_post = gSavedSettings.getBOOL("RenderSnapshotNoPost");
+
+ BOOL high_res = gSavedSettings.getBOOL("HighResSnapshot");
+ if (high_res)
+ {
+ width *= 2;
+ height *= 2;
+ // not compatible with UI/HUD
+ render_ui = false;
+ render_hud = false;
+ }
+
+ if (gViewerWindow->rawSnapshot(raw,
+ width,
+ height,
+ TRUE,
+ FALSE,
+ render_ui,
+ render_hud,
+ FALSE,
+ render_no_post,
+ LLSnapshotModel::SNAPSHOT_TYPE_COLOR,
+ high_res ? S32_MAX : MAX_SNAPSHOT_IMAGE_SIZE)) //per side
+ {
+ LLPointer<LLImageFormatted> formatted;
LLSnapshotModel::ESnapshotFormat fmt = (LLSnapshotModel::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
- switch (fmt)
- {
- case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG:
- formatted = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality"));
- break;
- default:
- LL_WARNS() << "Unknown local snapshot format: " << fmt << LL_ENDL;
- case LLSnapshotModel::SNAPSHOT_FORMAT_PNG:
- formatted = new LLImagePNG;
- break;
- case LLSnapshotModel::SNAPSHOT_FORMAT_BMP:
- formatted = new LLImageBMP;
- break;
- }
- formatted->enableOverSize() ;
- formatted->encode(raw, 0);
- formatted->disableOverSize() ;
- LLSnapshotLivePreview::saveLocal(formatted);
- }
- return true;
- }
+ switch (fmt)
+ {
+ case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG:
+ formatted = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality"));
+ break;
+ default:
+ LL_WARNS() << "Unknown local snapshot format: " << fmt << LL_ENDL;
+ case LLSnapshotModel::SNAPSHOT_FORMAT_PNG:
+ formatted = new LLImagePNG;
+ break;
+ case LLSnapshotModel::SNAPSHOT_FORMAT_BMP:
+ formatted = new LLImageBMP;
+ break;
+ }
+ formatted->enableOverSize() ;
+ formatted->encode(raw, 0);
+ formatted->disableOverSize() ;
+ LLSnapshotLivePreview::saveLocal(formatted);
+ }
+ return true;
+ }
};
class LLFileQuit : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
- LLAppViewer::instance()->userQuit();
- return true;
- }
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLAppViewer::instance()->userQuit();
+ return true;
+ }
};
void handle_compress_image(void*)
{
- LLFilePicker& picker = LLFilePicker::instance();
- if (picker.getMultipleOpenFiles(LLFilePicker::FFLOAD_IMAGE))
- {
- std::string infile = picker.getFirstFile();
- while (!infile.empty())
- {
- std::string outfile = infile + ".j2c";
-
- LL_INFOS() << "Input: " << infile << LL_ENDL;
- LL_INFOS() << "Output: " << outfile << LL_ENDL;
-
- BOOL success;
-
- success = LLViewerTextureList::createUploadFile(infile, outfile, IMG_CODEC_TGA);
-
- if (success)
- {
- LL_INFOS() << "Compression complete" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "Compression failed: " << LLImage::getLastError() << LL_ENDL;
- }
-
- infile = picker.getNextFile();
- }
- }
+ LLFilePicker& picker = LLFilePicker::instance();
+ if (picker.getMultipleOpenFiles(LLFilePicker::FFLOAD_IMAGE))
+ {
+ std::string infile = picker.getFirstFile();
+ while (!infile.empty())
+ {
+ std::string outfile = infile + ".j2c";
+
+ LL_INFOS() << "Input: " << infile << LL_ENDL;
+ LL_INFOS() << "Output: " << outfile << LL_ENDL;
+
+ BOOL success;
+
+ success = LLViewerTextureList::createUploadFile(infile, outfile, IMG_CODEC_TGA);
+
+ if (success)
+ {
+ LL_INFOS() << "Compression complete" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "Compression failed: " << LLImage::getLastError() << LL_ENDL;
+ }
+
+ infile = picker.getNextFile();
+ }
+ }
}
// No convinient check in LLFile, and correct way would be something
@@ -960,7 +960,7 @@ void handle_compress_image(void*)
// so doing dirty, but OS independent fopen and fseek
size_t get_file_size(std::string &filename)
{
- LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/
+ LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/
if (!file)
{
LL_WARNS() << "Error opening " << filename << LL_ENDL;
@@ -1045,21 +1045,21 @@ void handle_compress_file_test(void*)
LLUUID upload_new_resource(
- const std::string& src_filename,
- std::string name,
- std::string desc,
- S32 compression_info,
- LLFolderType::EType destination_folder_type,
- LLInventoryType::EType inv_type,
- U32 next_owner_perms,
- U32 group_perms,
- U32 everyone_perms,
- const std::string& display_name,
- LLAssetStorage::LLStoreAssetCallback callback,
- S32 expected_upload_cost,
- void *userdata,
- bool show_inventory)
-{
+ const std::string& src_filename,
+ std::string name,
+ std::string desc,
+ S32 compression_info,
+ LLFolderType::EType destination_folder_type,
+ LLInventoryType::EType inv_type,
+ U32 next_owner_perms,
+ U32 group_perms,
+ U32 everyone_perms,
+ const std::string& display_name,
+ LLAssetStorage::LLStoreAssetCallback callback,
+ S32 expected_upload_cost,
+ void *userdata,
+ bool show_inventory)
+{
LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLNewFileResourceUploadInfo>(
src_filename,
@@ -1073,127 +1073,127 @@ LLUUID upload_new_resource(
}
void upload_done_callback(
- const LLUUID& uuid,
- void* user_data,
- S32 result,
- LLExtStat ext_status) // StoreAssetData callback (fixed)
+ const LLUUID& uuid,
+ void* user_data,
+ S32 result,
+ LLExtStat ext_status) // StoreAssetData callback (fixed)
{
- LLResourceData* data = (LLResourceData*)user_data;
- S32 expected_upload_cost = data ? data->mExpectedUploadCost : 0;
- //LLAssetType::EType pref_loc = data->mPreferredLocation;
- BOOL is_balance_sufficient = TRUE;
-
- if(data)
- {
- if (result >= 0)
- {
- LLFolderType::EType dest_loc = (data->mPreferredLocation == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(data->mAssetInfo.mType) : data->mPreferredLocation;
-
- if (LLAssetType::AT_SOUND == data->mAssetInfo.mType ||
- LLAssetType::AT_TEXTURE == data->mAssetInfo.mType ||
- LLAssetType::AT_ANIMATION == data->mAssetInfo.mType)
- {
- // Charge the user for the upload.
- LLViewerRegion* region = gAgent.getRegion();
-
- if(!(can_afford_transaction(expected_upload_cost)))
- {
- LLBuyCurrencyHTML::openCurrencyFloater( "", expected_upload_cost );
- is_balance_sufficient = FALSE;
- }
- else if(region)
- {
- // Charge user for upload
- gStatusBar->debitBalance(expected_upload_cost);
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MoneyTransferRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MoneyData);
- msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_DestID, LLUUID::null);
- msg->addU8("Flags", 0);
- // we tell the sim how much we were expecting to pay so it
- // can respond to any discrepancy
- msg->addS32Fast(_PREHASH_Amount, expected_upload_cost);
- msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY);
- msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY);
- msg->addS32Fast(_PREHASH_TransactionType, TRANS_UPLOAD_CHARGE);
- msg->addStringFast(_PREHASH_Description, NULL);
- msg->sendReliable(region->getHost());
- }
- }
-
- if(is_balance_sufficient)
- {
- // Actually add the upload to inventory
- LL_INFOS() << "Adding " << uuid << " to inventory." << LL_ENDL;
- const LLUUID folder_id = gInventory.findCategoryUUIDForType(dest_loc);
- if(folder_id.notNull())
- {
- U32 next_owner_perms = data->mNextOwnerPerm;
- if(PERM_NONE == next_owner_perms)
- {
- next_owner_perms = PERM_MOVE | PERM_TRANSFER;
- }
- create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
- folder_id, data->mAssetInfo.mTransactionID, data->mAssetInfo.getName(),
- data->mAssetInfo.getDescription(), data->mAssetInfo.mType,
+ LLResourceData* data = (LLResourceData*)user_data;
+ S32 expected_upload_cost = data ? data->mExpectedUploadCost : 0;
+ //LLAssetType::EType pref_loc = data->mPreferredLocation;
+ BOOL is_balance_sufficient = TRUE;
+
+ if(data)
+ {
+ if (result >= 0)
+ {
+ LLFolderType::EType dest_loc = (data->mPreferredLocation == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(data->mAssetInfo.mType) : data->mPreferredLocation;
+
+ if (LLAssetType::AT_SOUND == data->mAssetInfo.mType ||
+ LLAssetType::AT_TEXTURE == data->mAssetInfo.mType ||
+ LLAssetType::AT_ANIMATION == data->mAssetInfo.mType)
+ {
+ // Charge the user for the upload.
+ LLViewerRegion* region = gAgent.getRegion();
+
+ if(!(can_afford_transaction(expected_upload_cost)))
+ {
+ LLBuyCurrencyHTML::openCurrencyFloater( "", expected_upload_cost );
+ is_balance_sufficient = FALSE;
+ }
+ else if(region)
+ {
+ // Charge user for upload
+ gStatusBar->debitBalance(expected_upload_cost);
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_MoneyTransferRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_MoneyData);
+ msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_DestID, LLUUID::null);
+ msg->addU8("Flags", 0);
+ // we tell the sim how much we were expecting to pay so it
+ // can respond to any discrepancy
+ msg->addS32Fast(_PREHASH_Amount, expected_upload_cost);
+ msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY);
+ msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY);
+ msg->addS32Fast(_PREHASH_TransactionType, TRANS_UPLOAD_CHARGE);
+ msg->addStringFast(_PREHASH_Description, NULL);
+ msg->sendReliable(region->getHost());
+ }
+ }
+
+ if(is_balance_sufficient)
+ {
+ // Actually add the upload to inventory
+ LL_INFOS() << "Adding " << uuid << " to inventory." << LL_ENDL;
+ const LLUUID folder_id = gInventory.findCategoryUUIDForType(dest_loc);
+ if(folder_id.notNull())
+ {
+ U32 next_owner_perms = data->mNextOwnerPerm;
+ if(PERM_NONE == next_owner_perms)
+ {
+ next_owner_perms = PERM_MOVE | PERM_TRANSFER;
+ }
+ create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
+ folder_id, data->mAssetInfo.mTransactionID, data->mAssetInfo.getName(),
+ data->mAssetInfo.getDescription(), data->mAssetInfo.mType,
data->mInventoryType, NO_INV_SUBTYPE, next_owner_perms,
- LLPointer<LLInventoryCallback>(NULL));
- }
- else
- {
- LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL;
- }
- }
- }
- else // if(result >= 0)
- {
- LLSD args;
- args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType);
- args["REASON"] = std::string(LLAssetStorage::getErrorString(result));
- LLNotificationsUtil::add("CannotUploadReason", args);
- }
-
- delete data;
- data = NULL;
- }
-
- LLUploadDialog::modalUploadFinished();
-
- // *NOTE: This is a pretty big hack. What this does is check the
- // file picker if there are any more pending uploads. If so,
- // upload that file.
- const std::string& next_file = LLFilePicker::instance().getNextFile();
- if(is_balance_sufficient && !next_file.empty())
- {
- std::string asset_name = gDirUtilp->getBaseFileName(next_file, true);
- LLStringUtil::replaceNonstandardASCII( asset_name, '?' );
- LLStringUtil::replaceChar(asset_name, '|', '?');
- LLStringUtil::stripNonprintable(asset_name);
- LLStringUtil::trim(asset_name);
-
- std::string display_name = LLStringUtil::null;
- LLAssetStorage::LLStoreAssetCallback callback;
- void *userdata = NULL;
- upload_new_resource(
- next_file,
- asset_name,
- asset_name, // file
- 0,
- LLFolderType::FT_NONE,
- LLInventoryType::IT_NONE,
- LLFloaterPerms::getNextOwnerPerms("Uploads"),
- LLFloaterPerms::getGroupPerms("Uploads"),
- LLFloaterPerms::getEveryonePerms("Uploads"),
- display_name,
- callback,
- expected_upload_cost, // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost
- userdata);
- }
+ LLPointer<LLInventoryCallback>(NULL));
+ }
+ else
+ {
+ LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL;
+ }
+ }
+ }
+ else // if(result >= 0)
+ {
+ LLSD args;
+ args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType);
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(result));
+ LLNotificationsUtil::add("CannotUploadReason", args);
+ }
+
+ delete data;
+ data = NULL;
+ }
+
+ LLUploadDialog::modalUploadFinished();
+
+ // *NOTE: This is a pretty big hack. What this does is check the
+ // file picker if there are any more pending uploads. If so,
+ // upload that file.
+ const std::string& next_file = LLFilePicker::instance().getNextFile();
+ if(is_balance_sufficient && !next_file.empty())
+ {
+ std::string asset_name = gDirUtilp->getBaseFileName(next_file, true);
+ LLStringUtil::replaceNonstandardASCII( asset_name, '?' );
+ LLStringUtil::replaceChar(asset_name, '|', '?');
+ LLStringUtil::stripNonprintable(asset_name);
+ LLStringUtil::trim(asset_name);
+
+ std::string display_name = LLStringUtil::null;
+ LLAssetStorage::LLStoreAssetCallback callback;
+ void *userdata = NULL;
+ upload_new_resource(
+ next_file,
+ asset_name,
+ asset_name, // file
+ 0,
+ LLFolderType::FT_NONE,
+ LLInventoryType::IT_NONE,
+ LLFloaterPerms::getNextOwnerPerms("Uploads"),
+ LLFloaterPerms::getGroupPerms("Uploads"),
+ LLFloaterPerms::getEveryonePerms("Uploads"),
+ display_name,
+ callback,
+ expected_upload_cost, // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost
+ userdata);
+ }
}
void upload_new_resource(
@@ -1201,90 +1201,90 @@ void upload_new_resource(
LLAssetStorage::LLStoreAssetCallback callback,
void *userdata)
{
- if(gDisconnected)
- {
- return ;
- }
+ if(gDisconnected)
+ {
+ return ;
+ }
// uploadInfo->setAssetType(assetType);
// uploadInfo->setTransactionId(tid);
- std::string url = gAgent.getRegionCapability("NewFileAgentInventory");
+ std::string url = gAgent.getRegionCapability("NewFileAgentInventory");
- if ( !url.empty() )
- {
+ if ( !url.empty() )
+ {
LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo);
- }
- else
- {
+ }
+ else
+ {
uploadInfo->prepareUpload();
uploadInfo->logPreparedUpload();
- LL_INFOS() << "NewAgentInventory capability not found, new agent inventory via asset system." << LL_ENDL;
- // check for adequate funds
- // TODO: do this check on the sim
- if (LLAssetType::AT_SOUND == uploadInfo->getAssetType() ||
+ LL_INFOS() << "NewAgentInventory capability not found, new agent inventory via asset system." << LL_ENDL;
+ // check for adequate funds
+ // TODO: do this check on the sim
+ if (LLAssetType::AT_SOUND == uploadInfo->getAssetType() ||
LLAssetType::AT_TEXTURE == uploadInfo->getAssetType() ||
LLAssetType::AT_ANIMATION == uploadInfo->getAssetType())
- {
- S32 balance = gStatusBar->getBalance();
- if (balance < uploadInfo->getExpectedUploadCost())
- {
- // insufficient funds, bail on this upload
+ {
+ S32 balance = gStatusBar->getBalance();
+ if (balance < uploadInfo->getExpectedUploadCost())
+ {
+ // insufficient funds, bail on this upload
LLBuyCurrencyHTML::openCurrencyFloater("", uploadInfo->getExpectedUploadCost());
- return;
- }
- }
+ return;
+ }
+ }
- LLResourceData* data = new LLResourceData;
- data->mAssetInfo.mTransactionID = uploadInfo->getTransactionId();
- data->mAssetInfo.mUuid = uploadInfo->getAssetId();
+ LLResourceData* data = new LLResourceData;
+ data->mAssetInfo.mTransactionID = uploadInfo->getTransactionId();
+ data->mAssetInfo.mUuid = uploadInfo->getAssetId();
data->mAssetInfo.mType = uploadInfo->getAssetType();
- data->mAssetInfo.mCreatorID = gAgentID;
- data->mInventoryType = uploadInfo->getInventoryType();
- data->mNextOwnerPerm = uploadInfo->getNextOwnerPerms();
- data->mExpectedUploadCost = uploadInfo->getExpectedUploadCost();
- data->mUserData = userdata;
- data->mAssetInfo.setName(uploadInfo->getName());
- data->mAssetInfo.setDescription(uploadInfo->getDescription());
- data->mPreferredLocation = uploadInfo->getDestinationFolderType();
-
- LLAssetStorage::LLStoreAssetCallback asset_callback = &upload_done_callback;
- if (callback)
- {
- asset_callback = callback;
- }
- gAssetStorage->storeAssetData(
- data->mAssetInfo.mTransactionID,
- data->mAssetInfo.mType,
- asset_callback,
- (void*)data,
- FALSE);
- }
+ data->mAssetInfo.mCreatorID = gAgentID;
+ data->mInventoryType = uploadInfo->getInventoryType();
+ data->mNextOwnerPerm = uploadInfo->getNextOwnerPerms();
+ data->mExpectedUploadCost = uploadInfo->getExpectedUploadCost();
+ data->mUserData = userdata;
+ data->mAssetInfo.setName(uploadInfo->getName());
+ data->mAssetInfo.setDescription(uploadInfo->getDescription());
+ data->mPreferredLocation = uploadInfo->getDestinationFolderType();
+
+ LLAssetStorage::LLStoreAssetCallback asset_callback = &upload_done_callback;
+ if (callback)
+ {
+ asset_callback = callback;
+ }
+ gAssetStorage->storeAssetData(
+ data->mAssetInfo.mTransactionID,
+ data->mAssetInfo.mType,
+ asset_callback,
+ (void*)data,
+ FALSE);
+ }
}
void init_menu_file()
{
- view_listener_t::addCommit(new LLFileUploadImage(), "File.UploadImage");
- view_listener_t::addCommit(new LLFileUploadSound(), "File.UploadSound");
- view_listener_t::addCommit(new LLFileUploadAnim(), "File.UploadAnim");
- view_listener_t::addCommit(new LLFileUploadModel(), "File.UploadModel");
+ view_listener_t::addCommit(new LLFileUploadImage(), "File.UploadImage");
+ view_listener_t::addCommit(new LLFileUploadSound(), "File.UploadSound");
+ view_listener_t::addCommit(new LLFileUploadAnim(), "File.UploadAnim");
+ view_listener_t::addCommit(new LLFileUploadModel(), "File.UploadModel");
view_listener_t::addCommit(new LLFileUploadMaterial(), "File.UploadMaterial");
- view_listener_t::addCommit(new LLFileUploadBulk(), "File.UploadBulk");
- view_listener_t::addCommit(new LLFileCloseWindow(), "File.CloseWindow");
- view_listener_t::addCommit(new LLFileCloseAllWindows(), "File.CloseAllWindows");
- view_listener_t::addEnable(new LLFileEnableCloseWindow(), "File.EnableCloseWindow");
- view_listener_t::addEnable(new LLFileEnableCloseAllWindows(), "File.EnableCloseAllWindows");
- view_listener_t::addCommit(new LLFileTakeSnapshotToDisk(), "File.TakeSnapshotToDisk");
- view_listener_t::addCommit(new LLFileQuit(), "File.Quit");
-
- view_listener_t::addEnable(new LLFileEnableUpload(), "File.EnableUpload");
- view_listener_t::addEnable(new LLFileEnableUploadModel(), "File.EnableUploadModel");
+ view_listener_t::addCommit(new LLFileUploadBulk(), "File.UploadBulk");
+ view_listener_t::addCommit(new LLFileCloseWindow(), "File.CloseWindow");
+ view_listener_t::addCommit(new LLFileCloseAllWindows(), "File.CloseAllWindows");
+ view_listener_t::addEnable(new LLFileEnableCloseWindow(), "File.EnableCloseWindow");
+ view_listener_t::addEnable(new LLFileEnableCloseAllWindows(), "File.EnableCloseAllWindows");
+ view_listener_t::addCommit(new LLFileTakeSnapshotToDisk(), "File.TakeSnapshotToDisk");
+ view_listener_t::addCommit(new LLFileQuit(), "File.Quit");
+
+ view_listener_t::addEnable(new LLFileEnableUpload(), "File.EnableUpload");
+ view_listener_t::addEnable(new LLFileEnableUploadModel(), "File.EnableUploadModel");
view_listener_t::addEnable(new LLFileEnableUploadMaterial(), "File.EnableUploadMaterial");
- view_listener_t::addMenu(new LLMeshEnabled(), "File.MeshEnabled");
- view_listener_t::addMenu(new LLMeshUploadVisible(), "File.VisibleUploadModel");
+ view_listener_t::addMenu(new LLMeshEnabled(), "File.MeshEnabled");
+ view_listener_t::addMenu(new LLMeshUploadVisible(), "File.VisibleUploadModel");
- // "File.SaveTexture" moved to llpanelmaininventory so that it can be properly handled.
+ // "File.SaveTexture" moved to llpanelmaininventory so that it can be properly handled.
}
diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h
index 6b9df6df28..1acb701d50 100644
--- a/indra/newview/llviewermenufile.h
+++ b/indra/newview/llviewermenufile.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewermenufile.h
* @brief "File" menu in the main menu bar.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -66,50 +66,50 @@ void upload_new_resource(
void assign_defaults_and_show_upload_message(
- LLAssetType::EType asset_type,
- LLInventoryType::EType& inventory_type,
- std::string& name,
- const std::string& display_name,
- std::string& description);
+ LLAssetType::EType asset_type,
+ LLInventoryType::EType& inventory_type,
+ std::string& name,
+ const std::string& display_name,
+ std::string& description);
//consider moving all file pickers below to more suitable place
class LLFilePickerThread : public LLThread
{ //multi-threaded file picker (runs system specific file picker in background and calls "notify" from main thread)
public:
- static std::queue<LLFilePickerThread*> sDeadQ;
- static LLMutex* sMutex;
+ static std::queue<LLFilePickerThread*> sDeadQ;
+ static LLMutex* sMutex;
- static void initClass();
- static void cleanupClass();
- static void clearDead();
+ static void initClass();
+ static void cleanupClass();
+ static void clearDead();
- std::vector<std::string> mResponses;
- std::string mProposedName;
+ std::vector<std::string> mResponses;
+ std::string mProposedName;
- LLFilePicker::ELoadFilter mLoadFilter;
- LLFilePicker::ESaveFilter mSaveFilter;
- bool mIsSaveDialog;
- bool mIsGetMultiple;
+ LLFilePicker::ELoadFilter mLoadFilter;
+ LLFilePicker::ESaveFilter mSaveFilter;
+ bool mIsSaveDialog;
+ bool mIsGetMultiple;
- LLFilePickerThread(LLFilePicker::ELoadFilter filter, bool get_multiple = false)
- : LLThread("file picker"), mLoadFilter(filter), mIsSaveDialog(false), mIsGetMultiple(get_multiple)
- {
- }
+ LLFilePickerThread(LLFilePicker::ELoadFilter filter, bool get_multiple = false)
+ : LLThread("file picker"), mLoadFilter(filter), mIsSaveDialog(false), mIsGetMultiple(get_multiple)
+ {
+ }
- LLFilePickerThread(LLFilePicker::ESaveFilter filter, const std::string &proposed_name)
- : LLThread("file picker"), mSaveFilter(filter), mIsSaveDialog(true), mProposedName(proposed_name)
- {
- }
+ LLFilePickerThread(LLFilePicker::ESaveFilter filter, const std::string &proposed_name)
+ : LLThread("file picker"), mSaveFilter(filter), mIsSaveDialog(true), mProposedName(proposed_name)
+ {
+ }
- void getFile();
+ void getFile();
- virtual void run();
+ virtual void run();
void runModeless();
static void modelessStringCallback(bool success, std::string &response, void *user_data);
static void modelessVectorCallback(bool success, std::vector<std::string> &responses, void *user_data);
- virtual void notify(const std::vector<std::string>& filenames) = 0;
+ virtual void notify(const std::vector<std::string>& filenames) = 0;
};
@@ -117,12 +117,12 @@ class LLFilePickerReplyThread : public LLFilePickerThread
{
public:
- typedef boost::signals2::signal<void(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter load_filter, LLFilePicker::ESaveFilter save_filter)> file_picked_signal_t;
+ typedef boost::signals2::signal<void(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter load_filter, LLFilePicker::ESaveFilter save_filter)> file_picked_signal_t;
static void startPicker(const file_picked_signal_t::slot_type& cb, LLFilePicker::ELoadFilter filter, bool get_multiple, const file_picked_signal_t::slot_type& failure_cb = file_picked_signal_t());
static void startPicker(const file_picked_signal_t::slot_type& cb, LLFilePicker::ESaveFilter filter, const std::string &proposed_name, const file_picked_signal_t::slot_type& failure_cb = file_picked_signal_t());
- virtual void notify(const std::vector<std::string>& filenames);
+ virtual void notify(const std::vector<std::string>& filenames);
private:
LLFilePickerReplyThread(const file_picked_signal_t::slot_type& cb, LLFilePicker::ELoadFilter filter, bool get_multiple, const file_picked_signal_t::slot_type& failure_cb = file_picked_signal_t());
@@ -130,10 +130,10 @@ private:
~LLFilePickerReplyThread();
private:
- LLFilePicker::ELoadFilter mLoadFilter;
- LLFilePicker::ESaveFilter mSaveFilter;
- file_picked_signal_t* mFilePickedSignal;
- file_picked_signal_t* mFailureSignal;
+ LLFilePicker::ELoadFilter mLoadFilter;
+ LLFilePicker::ESaveFilter mSaveFilter;
+ file_picked_signal_t* mFilePickedSignal;
+ file_picked_signal_t* mFailureSignal;
};
class LLMediaFilePicker : public LLFilePickerThread
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index ff2753d240..8cc2e80241 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewermessage.cpp
* @brief Dumping ground for viewer-side message system callbacks.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,9 +29,9 @@
// Linden libraries
#include "llanimationstates.h"
-#include "llaudioengine.h"
+#include "llaudioengine.h"
#include "llavataractions.h"
-#include "llavatarnamecache.h" // IDEVO HACK
+#include "llavatarnamecache.h" // IDEVO HACK
#include "lleventtimer.h"
#include "llfloatercreatelandmark.h"
#include "llfloaterreg.h"
@@ -91,7 +91,7 @@
#include "lltrans.h"
#include "lltranslate.h"
#include "llviewerfoldertype.h"
-#include "llvoavatar.h" // IDEVO HACK
+#include "llvoavatar.h" // IDEVO HACK
#include "lluri.h"
#include "llviewergenericmessage.h"
#include "llviewermenu.h"
@@ -136,8 +136,8 @@ const F32 CAMERA_POSITION_THRESHOLD_SQUARED = 0.001f * 0.001f;
// Determine how quickly residents' scripts can issue question dialogs
// Allow bursts of up to 5 dialogs in 10 seconds. 10*2=20 seconds recovery if throttle kicks in
-static const U32 LLREQUEST_PERMISSION_THROTTLE_LIMIT = 5; // requests
-static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds
+static const U32 LLREQUEST_PERMISSION_THROTTLE_LIMIT = 5; // requests
+static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds
extern BOOL gDebugClicks;
extern bool gShiftFrame;
@@ -154,9 +154,9 @@ const U32 OFFER_THROTTLE_MAX_COUNT=5; //number of items per time period
const F32 OFFER_THROTTLE_TIME=10.f; //time period in seconds
// Agent Update Flags (U8)
-const U8 AU_FLAGS_NONE = 0x00;
-const U8 AU_FLAGS_HIDETITLE = 0x01;
-const U8 AU_FLAGS_CLIENT_AUTOPILOT = 0x02;
+const U8 AU_FLAGS_NONE = 0x00;
+const U8 AU_FLAGS_HIDETITLE = 0x01;
+const U8 AU_FLAGS_CLIENT_AUTOPILOT = 0x02;
void accept_friendship_coro(std::string url, LLSD notification)
{
@@ -253,25 +253,25 @@ void decline_friendship_coro(std::string url, LLSD notification, S32 option)
bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLMessageSystem* msg = gMessageSystem;
- const LLSD& payload = notification["payload"];
- LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLMessageSystem* msg = gMessageSystem;
+ const LLSD& payload = notification["payload"];
+ LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
// this will be skipped if the user offering friendship is blocked
if (notification_ptr)
{
- switch(option)
- {
- case 0:
- {
- LLUIUsage::instance().logCommand("Agent.AcceptFriendship");
- // accept
- LLAvatarTracker::formFriendship(payload["from_id"]);
+ switch(option)
+ {
+ case 0:
+ {
+ LLUIUsage::instance().logCommand("Agent.AcceptFriendship");
+ // accept
+ LLAvatarTracker::formFriendship(payload["from_id"]);
- const LLUUID fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
+ const LLUUID fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
- // This will also trigger an onlinenotification if the user is online
+ // This will also trigger an onlinenotification if the user is online
std::string url = gAgent.getRegionCapability("AcceptFriendship");
LL_DEBUGS("Friendship") << "Cap string: " << url << LL_ENDL;
if (!url.empty() && payload.has("online") && payload["online"].asBoolean() == false)
@@ -302,15 +302,15 @@ bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
{
LL_WARNS("Friendship") << "Failed to accept friendship offer, neither capability nor transaction id are accessible" << LL_ENDL;
}
- break;
- }
- case 1: // Decline
- // fall-through
- case 2: // Send IM - decline and start IM session
- {
- LLUIUsage::instance().logCommand("Agent.DeclineFriendship");
- // decline
- // We no longer notify other viewers, but we DO still send
+ break;
+ }
+ case 1: // Decline
+ // fall-through
+ case 2: // Send IM - decline and start IM session
+ {
+ LLUIUsage::instance().logCommand("Agent.DeclineFriendship");
+ // decline
+ // We no longer notify other viewers, but we DO still send
// the rejection to the simulator to delete the pending userop.
std::string url = gAgent.getRegionCapability("DeclineFriendship");
LL_DEBUGS("Friendship") << "Cap string: " << url << LL_ENDL;
@@ -346,24 +346,24 @@ bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
{
LL_WARNS("Friendship") << "Failed to decline friendship offer, neither capability nor transaction id are accessible" << LL_ENDL;
}
- }
- default:
- // close button probably, possibly timed out
- break;
- }
+ }
+ default:
+ // close button probably, possibly timed out
+ break;
+ }
- // TODO: this set of calls has undesirable behavior under Windows OS (CHUI-985):
- // here appears three additional toasts instead one modified
- // need investigation and fix
+ // TODO: this set of calls has undesirable behavior under Windows OS (CHUI-985):
+ // here appears three additional toasts instead one modified
+ // need investigation and fix
- // LLNotificationFormPtr modified_form(new LLNotificationForm(*notification_ptr->getForm()));
- // modified_form->setElementEnabled("Accept", false);
- // modified_form->setElementEnabled("Decline", false);
- // notification_ptr->updateForm(modified_form);
- // notification_ptr->repost();
+ // LLNotificationFormPtr modified_form(new LLNotificationForm(*notification_ptr->getForm()));
+ // modified_form->setElementEnabled("Accept", false);
+ // modified_form->setElementEnabled("Decline", false);
+ // notification_ptr->updateForm(modified_form);
+ // notification_ptr->repost();
}
- return false;
+ return false;
}
static LLNotificationFunctorRegistration friendship_offer_callback_reg("OfferFriendship", friendship_offer_callback);
static LLNotificationFunctorRegistration friendship_offer_callback_reg_nm("OfferFriendshipNoMessage", friendship_offer_callback);
@@ -372,139 +372,139 @@ static LLNotificationFunctorRegistration friendship_offer_callback_reg_nm("Offer
//
void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group,
- S32 trx_type, const std::string& desc)
-{
- if(0 == amount || !region) return;
- amount = abs(amount);
- LL_INFOS("Messaging") << "give_money(" << uuid << "," << amount << ")"<< LL_ENDL;
- if(can_afford_transaction(amount))
- {
- if (uuid.isNull())
- {
- LL_WARNS() << "Failed to send L$ gift to to Null UUID." << LL_ENDL;
- return;
- }
-// gStatusBar->debitBalance(amount);
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MoneyTransferRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ S32 trx_type, const std::string& desc)
+{
+ if(0 == amount || !region) return;
+ amount = abs(amount);
+ LL_INFOS("Messaging") << "give_money(" << uuid << "," << amount << ")"<< LL_ENDL;
+ if(can_afford_transaction(amount))
+ {
+ if (uuid.isNull())
+ {
+ LL_WARNS() << "Failed to send L$ gift to to Null UUID." << LL_ENDL;
+ return;
+ }
+// gStatusBar->debitBalance(amount);
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_MoneyTransferRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MoneyData);
- msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_DestID, uuid);
- msg->addU8Fast(_PREHASH_Flags, pack_transaction_flags(FALSE, is_group));
- msg->addS32Fast(_PREHASH_Amount, amount);
- msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY);
- msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY);
- msg->addS32Fast(_PREHASH_TransactionType, trx_type );
- msg->addStringFast(_PREHASH_Description, desc);
- msg->sendReliable(region->getHost());
- }
- else
- {
- LLStringUtil::format_map_t args;
- args["AMOUNT"] = llformat("%d", amount);
- LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("giving", args), amount );
- }
+ msg->nextBlockFast(_PREHASH_MoneyData);
+ msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_DestID, uuid);
+ msg->addU8Fast(_PREHASH_Flags, pack_transaction_flags(FALSE, is_group));
+ msg->addS32Fast(_PREHASH_Amount, amount);
+ msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY);
+ msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY);
+ msg->addS32Fast(_PREHASH_TransactionType, trx_type );
+ msg->addStringFast(_PREHASH_Description, desc);
+ msg->sendReliable(region->getHost());
+ }
+ else
+ {
+ LLStringUtil::format_map_t args;
+ args["AMOUNT"] = llformat("%d", amount);
+ LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("giving", args), amount );
+ }
}
void send_complete_agent_movement(const LLHost& sim_host)
{
- LL_DEBUGS("Teleport", "Messaging") << "Sending CompleteAgentMovement to sim_host " << sim_host << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_CompleteAgentMovement);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addU32Fast(_PREHASH_CircuitCode, msg->mOurCircuitCode);
- msg->sendReliable(sim_host);
+ LL_DEBUGS("Teleport", "Messaging") << "Sending CompleteAgentMovement to sim_host " << sim_host << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_CompleteAgentMovement);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addU32Fast(_PREHASH_CircuitCode, msg->mOurCircuitCode);
+ msg->sendReliable(sim_host);
}
void process_logout_reply(LLMessageSystem* msg, void**)
{
- // The server has told us it's ok to quit.
- LL_DEBUGS("Messaging") << "process_logout_reply" << LL_ENDL;
-
- LLUUID agent_id;
- msg->getUUID("AgentData", "AgentID", agent_id);
- LLUUID session_id;
- msg->getUUID("AgentData", "SessionID", session_id);
- if((agent_id != gAgent.getID()) || (session_id != gAgent.getSessionID()))
- {
- LL_WARNS("Messaging") << "Bogus Logout Reply" << LL_ENDL;
- }
-
- LLInventoryModel::update_map_t parents;
- S32 count = msg->getNumberOfBlocksFast( _PREHASH_InventoryData );
- for(S32 i = 0; i < count; ++i)
- {
- LLUUID item_id;
- msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id, i);
-
- if( (1 == count) && item_id.isNull() )
- {
- // Detect dummy item. Indicates an empty list.
- break;
- }
-
- // We do not need to track the asset ids, just account for an
- // updated inventory version.
- LL_INFOS("Messaging") << "process_logout_reply itemID=" << item_id << LL_ENDL;
- LLInventoryItem* item = gInventory.getItem( item_id );
- if( item )
- {
- parents[item->getParentUUID()] = 0;
- gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id);
- }
- else
- {
- LL_INFOS("Messaging") << "process_logout_reply item not found: " << item_id << LL_ENDL;
- }
- }
+ // The server has told us it's ok to quit.
+ LL_DEBUGS("Messaging") << "process_logout_reply" << LL_ENDL;
+
+ LLUUID agent_id;
+ msg->getUUID("AgentData", "AgentID", agent_id);
+ LLUUID session_id;
+ msg->getUUID("AgentData", "SessionID", session_id);
+ if((agent_id != gAgent.getID()) || (session_id != gAgent.getSessionID()))
+ {
+ LL_WARNS("Messaging") << "Bogus Logout Reply" << LL_ENDL;
+ }
+
+ LLInventoryModel::update_map_t parents;
+ S32 count = msg->getNumberOfBlocksFast( _PREHASH_InventoryData );
+ for(S32 i = 0; i < count; ++i)
+ {
+ LLUUID item_id;
+ msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id, i);
+
+ if( (1 == count) && item_id.isNull() )
+ {
+ // Detect dummy item. Indicates an empty list.
+ break;
+ }
+
+ // We do not need to track the asset ids, just account for an
+ // updated inventory version.
+ LL_INFOS("Messaging") << "process_logout_reply itemID=" << item_id << LL_ENDL;
+ LLInventoryItem* item = gInventory.getItem( item_id );
+ if( item )
+ {
+ parents[item->getParentUUID()] = 0;
+ gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id);
+ }
+ else
+ {
+ LL_INFOS("Messaging") << "process_logout_reply item not found: " << item_id << LL_ENDL;
+ }
+ }
LLAppViewer::instance()->forceQuit();
}
void process_layer_data(LLMessageSystem *mesgsys, void **user_data)
{
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(mesgsys->getSender());
-
- LL_DEBUGS_ONCE("SceneLoadTiming") << "Received layer data" << LL_ENDL;
-
- if(!regionp)
- {
- LL_WARNS() << "Invalid region for layer data." << LL_ENDL;
- return;
- }
- S32 size;
- S8 type;
-
- mesgsys->getS8Fast(_PREHASH_LayerID, _PREHASH_Type, type);
- size = mesgsys->getSizeFast(_PREHASH_LayerData, _PREHASH_Data);
- if (0 == size)
- {
- LL_WARNS("Messaging") << "Layer data has zero size." << LL_ENDL;
- return;
- }
- if (size < 0)
- {
- // getSizeFast() is probably trying to tell us about an error
- LL_WARNS("Messaging") << "getSizeFast() returned negative result: "
- << size
- << LL_ENDL;
- return;
- }
- U8 *datap = new U8[size];
- mesgsys->getBinaryDataFast(_PREHASH_LayerData, _PREHASH_Data, datap, size);
- LLVLData *vl_datap = new LLVLData(regionp, type, datap, size);
- if (mesgsys->getReceiveCompressedSize())
- {
- gVLManager.addLayerData(vl_datap, (S32Bytes)mesgsys->getReceiveCompressedSize());
- }
- else
- {
- gVLManager.addLayerData(vl_datap, (S32Bytes)mesgsys->getReceiveSize());
- }
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(mesgsys->getSender());
+
+ LL_DEBUGS_ONCE("SceneLoadTiming") << "Received layer data" << LL_ENDL;
+
+ if(!regionp)
+ {
+ LL_WARNS() << "Invalid region for layer data." << LL_ENDL;
+ return;
+ }
+ S32 size;
+ S8 type;
+
+ mesgsys->getS8Fast(_PREHASH_LayerID, _PREHASH_Type, type);
+ size = mesgsys->getSizeFast(_PREHASH_LayerData, _PREHASH_Data);
+ if (0 == size)
+ {
+ LL_WARNS("Messaging") << "Layer data has zero size." << LL_ENDL;
+ return;
+ }
+ if (size < 0)
+ {
+ // getSizeFast() is probably trying to tell us about an error
+ LL_WARNS("Messaging") << "getSizeFast() returned negative result: "
+ << size
+ << LL_ENDL;
+ return;
+ }
+ U8 *datap = new U8[size];
+ mesgsys->getBinaryDataFast(_PREHASH_LayerData, _PREHASH_Data, datap, size);
+ LLVLData *vl_datap = new LLVLData(regionp, type, datap, size);
+ if (mesgsys->getReceiveCompressedSize())
+ {
+ gVLManager.addLayerData(vl_datap, (S32Bytes)mesgsys->getReceiveCompressedSize());
+ }
+ else
+ {
+ gVLManager.addLayerData(vl_datap, (S32Bytes)mesgsys->getReceiveSize());
+ }
}
// S32 exported_object_count = 0;
@@ -524,223 +524,223 @@ void process_layer_data(LLMessageSystem *mesgsys, void **user_data)
// void export_complete()
// {
-// LLUploadDialog::modalUploadFinished();
-// gExporterRequestID.setNull();
-// gExportDirectory = "";
-
-// LLFILE* fXML = LLFile::fopen(gExportedFile, "rb"); /* Flawfinder: ignore */
-// fseek(fXML, 0, SEEK_END);
-// long length = ftell(fXML);
-// fseek(fXML, 0, SEEK_SET);
-// U8 *buffer = new U8[length + 1];
-// size_t nread = fread(buffer, 1, length, fXML);
-// if (nread < (size_t) length)
-// {
-// LL_WARNS("Messaging") << "Short read" << LL_ENDL;
-// }
-// buffer[nread] = '\0';
-// fclose(fXML);
-
-// char *pos = (char *)buffer;
-// while ((pos = strstr(pos+1, "<sl:image ")) != 0)
-// {
-// char *pos_check = strstr(pos, "checksum=\"");
-
-// if (pos_check)
-// {
-// char *pos_uuid = strstr(pos_check, "\">");
-
-// if (pos_uuid)
-// {
-// char image_uuid_str[UUID_STR_SIZE]; /* Flawfinder: ignore */
-// memcpy(image_uuid_str, pos_uuid+2, UUID_STR_SIZE-1); /* Flawfinder: ignore */
-// image_uuid_str[UUID_STR_SIZE-1] = 0;
-
-// LLUUID image_uuid(image_uuid_str);
-
-// LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL;
-
-// std::map<LLUUID, std::string>::iterator itor = gImageChecksums.find(image_uuid);
-// if (itor != gImageChecksums.end())
-// {
-// LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL;
-// if (!itor->second.empty())
-// {
-// memcpy(&pos_check[10], itor->second.c_str(), 32); /* Flawfinder: ignore */
-// }
-// }
-// }
-// }
-// }
-
-// LLFILE* fXMLOut = LLFile::fopen(gExportedFile, "wb"); /* Flawfinder: ignore */
-// if (fwrite(buffer, 1, length, fXMLOut) != length)
-// {
-// LL_WARNS("Messaging") << "Short write" << LL_ENDL;
-// }
-// fclose(fXMLOut);
-
-// delete [] buffer;
+// LLUploadDialog::modalUploadFinished();
+// gExporterRequestID.setNull();
+// gExportDirectory = "";
+
+// LLFILE* fXML = LLFile::fopen(gExportedFile, "rb"); /* Flawfinder: ignore */
+// fseek(fXML, 0, SEEK_END);
+// long length = ftell(fXML);
+// fseek(fXML, 0, SEEK_SET);
+// U8 *buffer = new U8[length + 1];
+// size_t nread = fread(buffer, 1, length, fXML);
+// if (nread < (size_t) length)
+// {
+// LL_WARNS("Messaging") << "Short read" << LL_ENDL;
+// }
+// buffer[nread] = '\0';
+// fclose(fXML);
+
+// char *pos = (char *)buffer;
+// while ((pos = strstr(pos+1, "<sl:image ")) != 0)
+// {
+// char *pos_check = strstr(pos, "checksum=\"");
+
+// if (pos_check)
+// {
+// char *pos_uuid = strstr(pos_check, "\">");
+
+// if (pos_uuid)
+// {
+// char image_uuid_str[UUID_STR_SIZE]; /* Flawfinder: ignore */
+// memcpy(image_uuid_str, pos_uuid+2, UUID_STR_SIZE-1); /* Flawfinder: ignore */
+// image_uuid_str[UUID_STR_SIZE-1] = 0;
+
+// LLUUID image_uuid(image_uuid_str);
+
+// LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL;
+
+// std::map<LLUUID, std::string>::iterator itor = gImageChecksums.find(image_uuid);
+// if (itor != gImageChecksums.end())
+// {
+// LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL;
+// if (!itor->second.empty())
+// {
+// memcpy(&pos_check[10], itor->second.c_str(), 32); /* Flawfinder: ignore */
+// }
+// }
+// }
+// }
+// }
+
+// LLFILE* fXMLOut = LLFile::fopen(gExportedFile, "wb"); /* Flawfinder: ignore */
+// if (fwrite(buffer, 1, length, fXMLOut) != length)
+// {
+// LL_WARNS("Messaging") << "Short write" << LL_ENDL;
+// }
+// fclose(fXMLOut);
+
+// delete [] buffer;
// }
// void exported_item_complete(const LLTSCode status, void *user_data)
// {
-// //std::string *filename = (std::string *)user_data;
-
-// if (status < LLTS_OK)
-// {
-// LL_WARNS("Messaging") << "Export failed!" << LL_ENDL;
-// }
-// else
-// {
-// ++current_object_count;
-// if (current_image_count == exported_image_count && current_object_count == exported_object_count)
-// {
-// LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL;
-
-// export_complete();
-// }
-// else
-// {
-// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count));
-// }
-// }
+// //std::string *filename = (std::string *)user_data;
+
+// if (status < LLTS_OK)
+// {
+// LL_WARNS("Messaging") << "Export failed!" << LL_ENDL;
+// }
+// else
+// {
+// ++current_object_count;
+// if (current_image_count == exported_image_count && current_object_count == exported_object_count)
+// {
+// LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL;
+
+// export_complete();
+// }
+// else
+// {
+// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count));
+// }
+// }
// }
// struct exported_image_info
// {
-// LLUUID image_id;
-// std::string filename;
-// U32 image_num;
+// LLUUID image_id;
+// std::string filename;
+// U32 image_num;
// };
// void exported_j2c_complete(const LLTSCode status, void *user_data)
// {
-// exported_image_info *info = (exported_image_info *)user_data;
-// LLUUID image_id = info->image_id;
-// U32 image_num = info->image_num;
-// std::string filename = info->filename;
-// delete info;
-
-// if (status < LLTS_OK)
-// {
-// LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL;
-// }
-// else
-// {
-// LLFILE* fIn = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
-// if (fIn)
-// {
-// LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C;
-// LLPointer<LLImageTGA> TargaUtility = new LLImageTGA;
-
-// fseek(fIn, 0, SEEK_END);
-// S32 length = ftell(fIn);
-// fseek(fIn, 0, SEEK_SET);
-// U8 *buffer = ImageUtility->allocateData(length);
-// if (fread(buffer, 1, length, fIn) != length)
-// {
-// LL_WARNS("Messaging") << "Short read" << LL_ENDL;
-// }
-// fclose(fIn);
-// LLFile::remove(filename);
-
-// // Convert to TGA
-// LLPointer<LLImageRaw> image = new LLImageRaw();
-
-// ImageUtility->updateData();
-// ImageUtility->decode(image, 100000.0f);
-
-// TargaUtility->encode(image);
-// U8 *data = TargaUtility->getData();
-// S32 data_size = TargaUtility->getDataSize();
-
-// std::string file_path = gDirUtilp->getDirName(filename);
-
-// std::string output_file = llformat("%s/image-%03d.tga", file_path.c_str(), image_num);//filename;
-// //S32 name_len = output_file.length();
-// //strcpy(&output_file[name_len-3], "tga");
-// LLFILE* fOut = LLFile::fopen(output_file, "wb"); /* Flawfinder: ignore */
-// char md5_hash_string[33]; /* Flawfinder: ignore */
-// strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */
-// if (fOut)
-// {
-// if (fwrite(data, 1, data_size, fOut) != data_size)
-// {
-// LL_WARNS("Messaging") << "Short write" << LL_ENDL;
-// }
-// fseek(fOut, 0, SEEK_SET);
-// fclose(fOut);
-// fOut = LLFile::fopen(output_file, "rb"); /* Flawfinder: ignore */
-// LLMD5 my_md5_hash(fOut);
-// my_md5_hash.hex_digest(md5_hash_string);
-// }
-
-// gImageChecksums.insert(std::pair<LLUUID, std::string>(image_id, md5_hash_string));
-// }
-// }
-
-// ++current_image_count;
-// if (current_image_count == exported_image_count && current_object_count == exported_object_count)
-// {
-// LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL;
-// export_complete();
-// }
-// else
-// {
-// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count));
-// }
+// exported_image_info *info = (exported_image_info *)user_data;
+// LLUUID image_id = info->image_id;
+// U32 image_num = info->image_num;
+// std::string filename = info->filename;
+// delete info;
+
+// if (status < LLTS_OK)
+// {
+// LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL;
+// }
+// else
+// {
+// LLFILE* fIn = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
+// if (fIn)
+// {
+// LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C;
+// LLPointer<LLImageTGA> TargaUtility = new LLImageTGA;
+
+// fseek(fIn, 0, SEEK_END);
+// S32 length = ftell(fIn);
+// fseek(fIn, 0, SEEK_SET);
+// U8 *buffer = ImageUtility->allocateData(length);
+// if (fread(buffer, 1, length, fIn) != length)
+// {
+// LL_WARNS("Messaging") << "Short read" << LL_ENDL;
+// }
+// fclose(fIn);
+// LLFile::remove(filename);
+
+// // Convert to TGA
+// LLPointer<LLImageRaw> image = new LLImageRaw();
+
+// ImageUtility->updateData();
+// ImageUtility->decode(image, 100000.0f);
+
+// TargaUtility->encode(image);
+// U8 *data = TargaUtility->getData();
+// S32 data_size = TargaUtility->getDataSize();
+
+// std::string file_path = gDirUtilp->getDirName(filename);
+
+// std::string output_file = llformat("%s/image-%03d.tga", file_path.c_str(), image_num);//filename;
+// //S32 name_len = output_file.length();
+// //strcpy(&output_file[name_len-3], "tga");
+// LLFILE* fOut = LLFile::fopen(output_file, "wb"); /* Flawfinder: ignore */
+// char md5_hash_string[33]; /* Flawfinder: ignore */
+// strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */
+// if (fOut)
+// {
+// if (fwrite(data, 1, data_size, fOut) != data_size)
+// {
+// LL_WARNS("Messaging") << "Short write" << LL_ENDL;
+// }
+// fseek(fOut, 0, SEEK_SET);
+// fclose(fOut);
+// fOut = LLFile::fopen(output_file, "rb"); /* Flawfinder: ignore */
+// LLMD5 my_md5_hash(fOut);
+// my_md5_hash.hex_digest(md5_hash_string);
+// }
+
+// gImageChecksums.insert(std::pair<LLUUID, std::string>(image_id, md5_hash_string));
+// }
+// }
+
+// ++current_image_count;
+// if (current_image_count == exported_image_count && current_object_count == exported_object_count)
+// {
+// LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL;
+// export_complete();
+// }
+// else
+// {
+// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count));
+// }
//}
void process_derez_ack(LLMessageSystem*, void**)
{
- if(gViewerWindow) gViewerWindow->getWindow()->decBusyCount();
+ if(gViewerWindow) gViewerWindow->getWindow()->decBusyCount();
}
void process_places_reply(LLMessageSystem* msg, void** data)
{
- LLUUID query_id;
+ LLUUID query_id;
- msg->getUUID("AgentData", "QueryID", query_id);
- if (query_id.isNull())
- {
- LLFloaterLandHoldings::processPlacesReply(msg, data);
- }
- else if(gAgent.isInGroup(query_id))
- {
- LLPanelGroupLandMoney::processPlacesReply(msg, data);
- }
- else
- {
- LL_WARNS("Messaging") << "Got invalid PlacesReply message" << LL_ENDL;
- }
+ msg->getUUID("AgentData", "QueryID", query_id);
+ if (query_id.isNull())
+ {
+ LLFloaterLandHoldings::processPlacesReply(msg, data);
+ }
+ else if(gAgent.isInGroup(query_id))
+ {
+ LLPanelGroupLandMoney::processPlacesReply(msg, data);
+ }
+ else
+ {
+ LL_WARNS("Messaging") << "Got invalid PlacesReply message" << LL_ENDL;
+ }
}
void send_sound_trigger(const LLUUID& sound_id, F32 gain)
{
- if (sound_id.isNull() || gAgent.getRegion() == NULL)
- {
- // disconnected agent or zero guids don't get sent (no sound)
- return;
- }
+ if (sound_id.isNull() || gAgent.getRegion() == NULL)
+ {
+ // disconnected agent or zero guids don't get sent (no sound)
+ return;
+ }
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_SoundTrigger);
- msg->nextBlockFast(_PREHASH_SoundData);
- msg->addUUIDFast(_PREHASH_SoundID, sound_id);
- // Client untrusted, ids set on sim
- msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null );
- msg->addUUIDFast(_PREHASH_ObjectID, LLUUID::null );
- msg->addUUIDFast(_PREHASH_ParentID, LLUUID::null );
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_SoundTrigger);
+ msg->nextBlockFast(_PREHASH_SoundData);
+ msg->addUUIDFast(_PREHASH_SoundID, sound_id);
+ // Client untrusted, ids set on sim
+ msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null );
+ msg->addUUIDFast(_PREHASH_ObjectID, LLUUID::null );
+ msg->addUUIDFast(_PREHASH_ParentID, LLUUID::null );
- msg->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle());
+ msg->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle());
- LLVector3 position = gAgent.getPositionAgent();
- msg->addVector3Fast(_PREHASH_Position, position);
- msg->addF32Fast(_PREHASH_Gain, gain);
+ LLVector3 position = gAgent.getPositionAgent();
+ msg->addVector3Fast(_PREHASH_Position, position);
+ msg->addF32Fast(_PREHASH_Gain, gain);
- gAgent.sendMessage();
+ gAgent.sendMessage();
}
static LLSD sSavedGroupInvite;
@@ -839,10 +839,10 @@ void send_join_group_response(LLUUID group_id, LLUUID transaction_id, bool accep
EInstantMessage type = accept_invite ? IM_GROUP_INVITATION_ACCEPT : IM_GROUP_INVITATION_DECLINE;
- if (accept_invite)
- {
- LLUIUsage::instance().logCommand("Group.Join");
- }
+ if (accept_invite)
+ {
+ LLUIUsage::instance().logCommand("Group.Join");
+ }
send_improved_im(group_id,
std::string("name"),
@@ -868,122 +868,122 @@ void send_join_group_response(LLUUID group_id, LLUUID transaction_id, bool accep
bool join_group_response(const LLSD& notification, const LLSD& response)
{
-// A bit of variable saving and restoring is used to deal with the case where your group list is full and you
-// receive an invitation to another group. The data from that invitation is stored in the sSaved
-// variables. If you then drop a group and click on the Join button the stored data is restored and used
-// to join the group.
- LLSD notification_adjusted = notification;
- LLSD response_adjusted = response;
-
- std::string action = notification["name"];
-
-// Storing all the information by group id allows for the rare case of being at your maximum
-// group count and receiving more than one invitation.
- std::string id = notification_adjusted["payload"]["group_id"].asString();
-
- if ("JoinGroup" == action || "JoinGroupCanAfford" == action)
- {
- sSavedGroupInvite[id] = notification;
- sSavedResponse[id] = response;
- }
- else if ("JoinedTooManyGroupsMember" == action)
- {
- S32 opt = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == opt) // Join button pressed
- {
- notification_adjusted = sSavedGroupInvite[id];
- response_adjusted = sSavedResponse[id];
- }
- }
-
- S32 option = LLNotificationsUtil::getSelectedOption(notification_adjusted, response_adjusted);
- bool accept_invite = false;
-
- LLUUID group_id = notification_adjusted["payload"]["group_id"].asUUID();
- LLUUID transaction_id = notification_adjusted["payload"]["transaction_id"].asUUID();
- std::string name = notification_adjusted["payload"]["name"].asString();
- std::string message = notification_adjusted["payload"]["message"].asString();
- S32 fee = notification_adjusted["payload"]["fee"].asInteger();
- U8 use_offline_cap = notification_adjusted["payload"]["use_offline_cap"].asInteger();
-
- if (option == 2 && !group_id.isNull())
- {
- LLGroupActions::show(group_id);
- LLSD args;
- args["MESSAGE"] = message;
- LLNotificationsUtil::add("JoinGroup", args, notification_adjusted["payload"]);
- return false;
- }
-
- if(option == 0 && !group_id.isNull())
- {
- // check for promotion or demotion.
- S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit();
- if(gAgent.isInGroup(group_id)) ++max_groups;
-
- if(gAgent.mGroups.size() < max_groups)
- {
- accept_invite = true;
- }
- else
- {
- LLSD args;
- args["NAME"] = name;
- LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification_adjusted["payload"]);
- return false;
- }
- }
- send_join_group_response(group_id, transaction_id, accept_invite, fee, use_offline_cap, notification_adjusted["payload"]);
-
- sSavedGroupInvite[id] = LLSD::emptyMap();
- sSavedResponse[id] = LLSD::emptyMap();
-
- return false;
+// A bit of variable saving and restoring is used to deal with the case where your group list is full and you
+// receive an invitation to another group. The data from that invitation is stored in the sSaved
+// variables. If you then drop a group and click on the Join button the stored data is restored and used
+// to join the group.
+ LLSD notification_adjusted = notification;
+ LLSD response_adjusted = response;
+
+ std::string action = notification["name"];
+
+// Storing all the information by group id allows for the rare case of being at your maximum
+// group count and receiving more than one invitation.
+ std::string id = notification_adjusted["payload"]["group_id"].asString();
+
+ if ("JoinGroup" == action || "JoinGroupCanAfford" == action)
+ {
+ sSavedGroupInvite[id] = notification;
+ sSavedResponse[id] = response;
+ }
+ else if ("JoinedTooManyGroupsMember" == action)
+ {
+ S32 opt = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == opt) // Join button pressed
+ {
+ notification_adjusted = sSavedGroupInvite[id];
+ response_adjusted = sSavedResponse[id];
+ }
+ }
+
+ S32 option = LLNotificationsUtil::getSelectedOption(notification_adjusted, response_adjusted);
+ bool accept_invite = false;
+
+ LLUUID group_id = notification_adjusted["payload"]["group_id"].asUUID();
+ LLUUID transaction_id = notification_adjusted["payload"]["transaction_id"].asUUID();
+ std::string name = notification_adjusted["payload"]["name"].asString();
+ std::string message = notification_adjusted["payload"]["message"].asString();
+ S32 fee = notification_adjusted["payload"]["fee"].asInteger();
+ U8 use_offline_cap = notification_adjusted["payload"]["use_offline_cap"].asInteger();
+
+ if (option == 2 && !group_id.isNull())
+ {
+ LLGroupActions::show(group_id);
+ LLSD args;
+ args["MESSAGE"] = message;
+ LLNotificationsUtil::add("JoinGroup", args, notification_adjusted["payload"]);
+ return false;
+ }
+
+ if(option == 0 && !group_id.isNull())
+ {
+ // check for promotion or demotion.
+ S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit();
+ if(gAgent.isInGroup(group_id)) ++max_groups;
+
+ if(gAgent.mGroups.size() < max_groups)
+ {
+ accept_invite = true;
+ }
+ else
+ {
+ LLSD args;
+ args["NAME"] = name;
+ LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification_adjusted["payload"]);
+ return false;
+ }
+ }
+ send_join_group_response(group_id, transaction_id, accept_invite, fee, use_offline_cap, notification_adjusted["payload"]);
+
+ sSavedGroupInvite[id] = LLSD::emptyMap();
+ sSavedResponse[id] = LLSD::emptyMap();
+
+ return false;
}
static void highlight_inventory_objects_in_panel(const std::vector<LLUUID>& items, LLInventoryPanel *inventory_panel)
{
- if (NULL == inventory_panel) return;
-
- for (std::vector<LLUUID>::const_iterator item_iter = items.begin();
- item_iter != items.end();
- ++item_iter)
- {
- const LLUUID& item_id = (*item_iter);
- if(!highlight_offered_object(item_id))
- {
- continue;
- }
-
- LLInventoryObject* item = gInventory.getObject(item_id);
- llassert(item);
- if (!item) {
- continue;
- }
-
- LL_DEBUGS("Inventory_Move") << "Highlighting inventory item: " << item->getName() << ", " << item_id << LL_ENDL;
- LLFolderView* fv = inventory_panel->getRootFolder();
- if (fv)
- {
- LLFolderViewItem* fv_item = inventory_panel->getItemByID(item_id);
- if (fv_item)
- {
- LLFolderViewItem* fv_folder = fv_item->getParentFolder();
- if (fv_folder)
- {
- // Parent folders can be different in case of 2 consecutive drag and drop
- // operations when the second one is started before the first one completes.
- LL_DEBUGS("Inventory_Move") << "Open folder: " << fv_folder->getName() << LL_ENDL;
- fv_folder->setOpen(TRUE);
- if (fv_folder->isSelected())
- {
- fv->changeSelection(fv_folder, FALSE);
- }
- }
- fv->changeSelection(fv_item, TRUE);
- }
- }
- }
+ if (NULL == inventory_panel) return;
+
+ for (std::vector<LLUUID>::const_iterator item_iter = items.begin();
+ item_iter != items.end();
+ ++item_iter)
+ {
+ const LLUUID& item_id = (*item_iter);
+ if(!highlight_offered_object(item_id))
+ {
+ continue;
+ }
+
+ LLInventoryObject* item = gInventory.getObject(item_id);
+ llassert(item);
+ if (!item) {
+ continue;
+ }
+
+ LL_DEBUGS("Inventory_Move") << "Highlighting inventory item: " << item->getName() << ", " << item_id << LL_ENDL;
+ LLFolderView* fv = inventory_panel->getRootFolder();
+ if (fv)
+ {
+ LLFolderViewItem* fv_item = inventory_panel->getItemByID(item_id);
+ if (fv_item)
+ {
+ LLFolderViewItem* fv_folder = fv_item->getParentFolder();
+ if (fv_folder)
+ {
+ // Parent folders can be different in case of 2 consecutive drag and drop
+ // operations when the second one is started before the first one completes.
+ LL_DEBUGS("Inventory_Move") << "Open folder: " << fv_folder->getName() << LL_ENDL;
+ fv_folder->setOpen(TRUE);
+ if (fv_folder->isSelected())
+ {
+ fv->changeSelection(fv_folder, FALSE);
+ }
+ }
+ fv->changeSelection(fv_item, TRUE);
+ }
+ }
+ }
}
static LLNotificationFunctorRegistration jgr_1("JoinGroup", join_group_response);
@@ -997,30 +997,30 @@ static LLNotificationFunctorRegistration jgr_3("JoinGroupCanAfford", join_group_
class LLOpenAgentOffer : public LLInventoryFetchItemsObserver
{
public:
- LLOpenAgentOffer(const LLUUID& object_id,
- const std::string& from_name) :
- LLInventoryFetchItemsObserver(object_id),
- mFromName(from_name) {}
- /*virtual*/ void startFetch()
- {
- for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
- if (cat)
- {
- mComplete.push_back((*it));
- }
- }
- LLInventoryFetchItemsObserver::startFetch();
- }
- /*virtual*/ void done()
- {
- open_inventory_offer(mComplete, mFromName);
- gInventory.removeObserver(this);
- delete this;
- }
+ LLOpenAgentOffer(const LLUUID& object_id,
+ const std::string& from_name) :
+ LLInventoryFetchItemsObserver(object_id),
+ mFromName(from_name) {}
+ /*virtual*/ void startFetch()
+ {
+ for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
+ {
+ LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
+ if (cat)
+ {
+ mComplete.push_back((*it));
+ }
+ }
+ LLInventoryFetchItemsObserver::startFetch();
+ }
+ /*virtual*/ void done()
+ {
+ open_inventory_offer(mComplete, mFromName);
+ gInventory.removeObserver(this);
+ delete this;
+ }
private:
- std::string mFromName;
+ std::string mFromName;
};
/**
@@ -1032,117 +1032,117 @@ private:
class LLViewerInventoryMoveFromWorldObserver : public LLInventoryAddItemByAssetObserver
{
public:
- LLViewerInventoryMoveFromWorldObserver()
- : LLInventoryAddItemByAssetObserver()
- {
+ LLViewerInventoryMoveFromWorldObserver()
+ : LLInventoryAddItemByAssetObserver()
+ {
- }
+ }
- void setMoveIntoFolderID(const LLUUID& into_folder_uuid) {mMoveIntoFolderID = into_folder_uuid; }
+ void setMoveIntoFolderID(const LLUUID& into_folder_uuid) {mMoveIntoFolderID = into_folder_uuid; }
private:
- /*virtual */void onAssetAdded(const LLUUID& asset_id)
- {
- // Store active Inventory panel.
- if (LLInventoryPanel::getActiveInventoryPanel())
- {
- mActivePanel = LLInventoryPanel::getActiveInventoryPanel()->getHandle();
- }
-
- // Store selected items (without destination folder)
- mSelectedItems.clear();
- if (LLInventoryPanel::getActiveInventoryPanel())
- {
- std::set<LLFolderViewItem*> selection = LLInventoryPanel::getActiveInventoryPanel()->getRootFolder()->getSelectionList();
- for (std::set<LLFolderViewItem*>::iterator it = selection.begin(), end_it = selection.end();
- it != end_it;
- ++it)
- {
- mSelectedItems.insert(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
- }
- }
- mSelectedItems.erase(mMoveIntoFolderID);
- }
-
- /**
- * Selects added inventory items watched by their Asset UUIDs if selection was not changed since
- * all items were started to watch (dropped into a folder).
- */
- void done()
- {
- LLInventoryPanel* active_panel = dynamic_cast<LLInventoryPanel*>(mActivePanel.get());
-
- // if selection is not changed since watch started lets hightlight new items.
- if (active_panel && !isSelectionChanged())
- {
- LL_DEBUGS("Inventory_Move") << "Selecting new items..." << LL_ENDL;
- active_panel->clearSelection();
- highlight_inventory_objects_in_panel(mAddedItems, active_panel);
- }
- }
-
- /**
- * Returns true if selected inventory items were changed since moved inventory items were started to watch.
- */
- bool isSelectionChanged()
- {
- LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel();
-
- if (NULL == active_panel)
- {
- return true;
- }
-
- // get selected items (without destination folder)
- selected_items_t selected_items;
-
- std::set<LLFolderViewItem*> selection = active_panel->getRootFolder()->getSelectionList();
- for (std::set<LLFolderViewItem*>::iterator it = selection.begin(), end_it = selection.end();
- it != end_it;
- ++it)
- {
- selected_items.insert(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
- }
- selected_items.erase(mMoveIntoFolderID);
-
- // compare stored & current sets of selected items
- selected_items_t different_items;
- std::set_symmetric_difference(mSelectedItems.begin(), mSelectedItems.end(),
- selected_items.begin(), selected_items.end(), std::inserter(different_items, different_items.begin()));
-
- LL_DEBUGS("Inventory_Move") << "Selected firstly: " << mSelectedItems.size()
- << ", now: " << selected_items.size() << ", difference: " << different_items.size() << LL_ENDL;
-
- return different_items.size() > 0;
- }
-
- LLHandle<LLPanel> mActivePanel;
- typedef std::set<LLUUID> selected_items_t;
- selected_items_t mSelectedItems;
-
- /**
- * UUID of FolderViewFolder into which watched items are moved.
- *
- * Destination FolderViewFolder becomes selected while mouse hovering (when dragged items are dropped).
- *
- * If mouse is moved out it set unselected and number of selected items is changed
- * even if selected items in Inventory stay the same.
- * So, it is used to update stored selection list.
- *
- * @see onAssetAdded()
- * @see isSelectionChanged()
- */
- LLUUID mMoveIntoFolderID;
+ /*virtual */void onAssetAdded(const LLUUID& asset_id)
+ {
+ // Store active Inventory panel.
+ if (LLInventoryPanel::getActiveInventoryPanel())
+ {
+ mActivePanel = LLInventoryPanel::getActiveInventoryPanel()->getHandle();
+ }
+
+ // Store selected items (without destination folder)
+ mSelectedItems.clear();
+ if (LLInventoryPanel::getActiveInventoryPanel())
+ {
+ std::set<LLFolderViewItem*> selection = LLInventoryPanel::getActiveInventoryPanel()->getRootFolder()->getSelectionList();
+ for (std::set<LLFolderViewItem*>::iterator it = selection.begin(), end_it = selection.end();
+ it != end_it;
+ ++it)
+ {
+ mSelectedItems.insert(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
+ }
+ }
+ mSelectedItems.erase(mMoveIntoFolderID);
+ }
+
+ /**
+ * Selects added inventory items watched by their Asset UUIDs if selection was not changed since
+ * all items were started to watch (dropped into a folder).
+ */
+ void done()
+ {
+ LLInventoryPanel* active_panel = dynamic_cast<LLInventoryPanel*>(mActivePanel.get());
+
+ // if selection is not changed since watch started lets hightlight new items.
+ if (active_panel && !isSelectionChanged())
+ {
+ LL_DEBUGS("Inventory_Move") << "Selecting new items..." << LL_ENDL;
+ active_panel->clearSelection();
+ highlight_inventory_objects_in_panel(mAddedItems, active_panel);
+ }
+ }
+
+ /**
+ * Returns true if selected inventory items were changed since moved inventory items were started to watch.
+ */
+ bool isSelectionChanged()
+ {
+ LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel();
+
+ if (NULL == active_panel)
+ {
+ return true;
+ }
+
+ // get selected items (without destination folder)
+ selected_items_t selected_items;
+
+ std::set<LLFolderViewItem*> selection = active_panel->getRootFolder()->getSelectionList();
+ for (std::set<LLFolderViewItem*>::iterator it = selection.begin(), end_it = selection.end();
+ it != end_it;
+ ++it)
+ {
+ selected_items.insert(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
+ }
+ selected_items.erase(mMoveIntoFolderID);
+
+ // compare stored & current sets of selected items
+ selected_items_t different_items;
+ std::set_symmetric_difference(mSelectedItems.begin(), mSelectedItems.end(),
+ selected_items.begin(), selected_items.end(), std::inserter(different_items, different_items.begin()));
+
+ LL_DEBUGS("Inventory_Move") << "Selected firstly: " << mSelectedItems.size()
+ << ", now: " << selected_items.size() << ", difference: " << different_items.size() << LL_ENDL;
+
+ return different_items.size() > 0;
+ }
+
+ LLHandle<LLPanel> mActivePanel;
+ typedef std::set<LLUUID> selected_items_t;
+ selected_items_t mSelectedItems;
+
+ /**
+ * UUID of FolderViewFolder into which watched items are moved.
+ *
+ * Destination FolderViewFolder becomes selected while mouse hovering (when dragged items are dropped).
+ *
+ * If mouse is moved out it set unselected and number of selected items is changed
+ * even if selected items in Inventory stay the same.
+ * So, it is used to update stored selection list.
+ *
+ * @see onAssetAdded()
+ * @see isSelectionChanged()
+ */
+ LLUUID mMoveIntoFolderID;
};
LLViewerInventoryMoveFromWorldObserver* gInventoryMoveObserver = NULL;
void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid)
{
- start_new_inventory_observer();
+ start_new_inventory_observer();
- gInventoryMoveObserver->setMoveIntoFolderID(into_folder_uuid);
- gInventoryMoveObserver->watchAsset(inv_item->getAssetUUID());
+ gInventoryMoveObserver->setMoveIntoFolderID(into_folder_uuid);
+ gInventoryMoveObserver->watchAsset(inv_item->getAssetUUID());
}
@@ -1156,124 +1156,124 @@ class LLViewerInventoryMoveObserver : public LLInventoryObserver
{
public:
- LLViewerInventoryMoveObserver(const LLUUID& object_id)
- : LLInventoryObserver()
- , mObjectID(object_id)
- {
- if (LLInventoryPanel::getActiveInventoryPanel())
- {
- mActivePanel = LLInventoryPanel::getActiveInventoryPanel()->getHandle();
- }
- }
-
- virtual ~LLViewerInventoryMoveObserver() {}
- virtual void changed(U32 mask);
-
+ LLViewerInventoryMoveObserver(const LLUUID& object_id)
+ : LLInventoryObserver()
+ , mObjectID(object_id)
+ {
+ if (LLInventoryPanel::getActiveInventoryPanel())
+ {
+ mActivePanel = LLInventoryPanel::getActiveInventoryPanel()->getHandle();
+ }
+ }
+
+ virtual ~LLViewerInventoryMoveObserver() {}
+ virtual void changed(U32 mask);
+
private:
- LLUUID mObjectID;
- LLHandle<LLPanel> mActivePanel;
+ LLUUID mObjectID;
+ LLHandle<LLPanel> mActivePanel;
};
void LLViewerInventoryMoveObserver::changed(U32 mask)
{
- LLInventoryPanel* active_panel = dynamic_cast<LLInventoryPanel*>(mActivePanel.get());
-
- if (NULL == active_panel)
- {
- gInventory.removeObserver(this);
- return;
- }
-
- if((mask & (LLInventoryObserver::STRUCTURE)) != 0)
- {
- const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
-
- std::set<LLUUID>::const_iterator id_it = changed_items.begin();
- std::set<LLUUID>::const_iterator id_end = changed_items.end();
- for (;id_it != id_end; ++id_it)
- {
- if ((*id_it) == mObjectID)
- {
- active_panel->clearSelection();
- std::vector<LLUUID> items;
- items.push_back(mObjectID);
- highlight_inventory_objects_in_panel(items, active_panel);
- active_panel->getRootFolder()->scrollToShowSelection();
-
- gInventory.removeObserver(this);
- break;
- }
- }
- }
+ LLInventoryPanel* active_panel = dynamic_cast<LLInventoryPanel*>(mActivePanel.get());
+
+ if (NULL == active_panel)
+ {
+ gInventory.removeObserver(this);
+ return;
+ }
+
+ if((mask & (LLInventoryObserver::STRUCTURE)) != 0)
+ {
+ const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
+
+ std::set<LLUUID>::const_iterator id_it = changed_items.begin();
+ std::set<LLUUID>::const_iterator id_end = changed_items.end();
+ for (;id_it != id_end; ++id_it)
+ {
+ if ((*id_it) == mObjectID)
+ {
+ active_panel->clearSelection();
+ std::vector<LLUUID> items;
+ items.push_back(mObjectID);
+ highlight_inventory_objects_in_panel(items, active_panel);
+ active_panel->getRootFolder()->scrollToShowSelection();
+
+ gInventory.removeObserver(this);
+ break;
+ }
+ }
+ }
}
void set_dad_inbox_object(const LLUUID& object_id)
{
- LLViewerInventoryMoveObserver* move_observer = new LLViewerInventoryMoveObserver(object_id);
- gInventory.addObserver(move_observer);
+ LLViewerInventoryMoveObserver* move_observer = new LLViewerInventoryMoveObserver(object_id);
+ gInventory.addObserver(move_observer);
}
-//unlike the FetchObserver for AgentOffer, we only make one
+//unlike the FetchObserver for AgentOffer, we only make one
//instance of the AddedObserver for TaskOffers
-//and it never dies. We do this because we don't know the UUID of
-//task offers until they are accepted, so we don't wouldn't
+//and it never dies. We do this because we don't know the UUID of
+//task offers until they are accepted, so we don't wouldn't
//know what to watch for, so instead we just watch for all additions.
class LLOpenTaskOffer : public LLInventoryAddedObserver
{
protected:
- /*virtual*/ void done()
- {
- uuid_vec_t added;
- for(uuid_set_t::const_iterator it = gInventory.getAddedIDs().begin(); it != gInventory.getAddedIDs().end(); ++it)
- {
- added.push_back(*it);
- }
- for (uuid_vec_t::iterator it = added.begin(); it != added.end();)
- {
- const LLUUID& item_uuid = *it;
- bool was_moved = false;
- LLInventoryObject* added_object = gInventory.getObject(item_uuid);
- if (added_object)
- {
- // cast to item to get Asset UUID
- LLInventoryItem* added_item = dynamic_cast<LLInventoryItem*>(added_object);
- if (added_item)
- {
- const LLUUID& asset_uuid = added_item->getAssetUUID();
- if (gInventoryMoveObserver->isAssetWatched(asset_uuid))
- {
- LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL;
- was_moved = true;
- }
- }
- }
-
- if (was_moved)
- {
- it = added.erase(it);
- }
- else ++it;
- }
-
- open_inventory_offer(added, "");
- }
+ /*virtual*/ void done()
+ {
+ uuid_vec_t added;
+ for(uuid_set_t::const_iterator it = gInventory.getAddedIDs().begin(); it != gInventory.getAddedIDs().end(); ++it)
+ {
+ added.push_back(*it);
+ }
+ for (uuid_vec_t::iterator it = added.begin(); it != added.end();)
+ {
+ const LLUUID& item_uuid = *it;
+ bool was_moved = false;
+ LLInventoryObject* added_object = gInventory.getObject(item_uuid);
+ if (added_object)
+ {
+ // cast to item to get Asset UUID
+ LLInventoryItem* added_item = dynamic_cast<LLInventoryItem*>(added_object);
+ if (added_item)
+ {
+ const LLUUID& asset_uuid = added_item->getAssetUUID();
+ if (gInventoryMoveObserver->isAssetWatched(asset_uuid))
+ {
+ LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL;
+ was_moved = true;
+ }
+ }
+ }
+
+ if (was_moved)
+ {
+ it = added.erase(it);
+ }
+ else ++it;
+ }
+
+ open_inventory_offer(added, "");
+ }
};
class LLOpenTaskGroupOffer : public LLInventoryAddedObserver
{
protected:
- /*virtual*/ void done()
- {
- uuid_vec_t added;
- for(uuid_set_t::const_iterator it = gInventory.getAddedIDs().begin(); it != gInventory.getAddedIDs().end(); ++it)
- {
- added.push_back(*it);
- }
- open_inventory_offer(added, "group_offer");
- gInventory.removeObserver(this);
- delete this;
- }
+ /*virtual*/ void done()
+ {
+ uuid_vec_t added;
+ for(uuid_set_t::const_iterator it = gInventory.getAddedIDs().begin(); it != gInventory.getAddedIDs().end(); ++it)
+ {
+ added.push_back(*it);
+ }
+ open_inventory_offer(added, "group_offer");
+ gInventory.removeObserver(this);
+ delete this;
+ }
};
//one global instance to bind them
@@ -1281,267 +1281,267 @@ LLOpenTaskOffer* gNewInventoryObserver=NULL;
class LLNewInventoryHintObserver : public LLInventoryAddedObserver
{
protected:
- /*virtual*/ void done()
- {
- LLFirstUse::newInventory();
- }
+ /*virtual*/ void done()
+ {
+ LLFirstUse::newInventory();
+ }
};
LLNewInventoryHintObserver* gNewInventoryHintObserver=NULL;
void start_new_inventory_observer()
{
- if (!gNewInventoryObserver) //task offer observer
- {
- // Observer is deleted by gInventory
- gNewInventoryObserver = new LLOpenTaskOffer;
- gInventory.addObserver(gNewInventoryObserver);
- }
+ if (!gNewInventoryObserver) //task offer observer
+ {
+ // Observer is deleted by gInventory
+ gNewInventoryObserver = new LLOpenTaskOffer;
+ gInventory.addObserver(gNewInventoryObserver);
+ }
- if (!gInventoryMoveObserver) //inventory move from the world observer
- {
- // Observer is deleted by gInventory
- gInventoryMoveObserver = new LLViewerInventoryMoveFromWorldObserver;
- gInventory.addObserver(gInventoryMoveObserver);
- }
+ if (!gInventoryMoveObserver) //inventory move from the world observer
+ {
+ // Observer is deleted by gInventory
+ gInventoryMoveObserver = new LLViewerInventoryMoveFromWorldObserver;
+ gInventory.addObserver(gInventoryMoveObserver);
+ }
- if (!gNewInventoryHintObserver)
- {
- // Observer is deleted by gInventory
- gNewInventoryHintObserver = new LLNewInventoryHintObserver();
- gInventory.addObserver(gNewInventoryHintObserver);
- }
+ if (!gNewInventoryHintObserver)
+ {
+ // Observer is deleted by gInventory
+ gNewInventoryHintObserver = new LLNewInventoryHintObserver();
+ gInventory.addObserver(gNewInventoryHintObserver);
+ }
}
class LLDiscardAgentOffer : public LLInventoryFetchItemsObserver
{
- LOG_CLASS(LLDiscardAgentOffer);
+ LOG_CLASS(LLDiscardAgentOffer);
public:
- LLDiscardAgentOffer(const LLUUID& folder_id, const LLUUID& object_id) :
- LLInventoryFetchItemsObserver(object_id),
- mFolderID(folder_id),
- mObjectID(object_id) {}
-
- virtual void done()
- {
- LL_DEBUGS("Messaging") << "LLDiscardAgentOffer::done()" << LL_ENDL;
-
- // We're invoked from LLInventoryModel::notifyObservers().
- // If we now try to remove the inventory item, it will cause a nested
- // notifyObservers() call, which won't work.
- // So defer moving the item to trash until viewer gets idle (in a moment).
- // Use removeObject() rather than removeItem() because at this level,
- // the object could be either an item or a folder.
- LLAppViewer::instance()->addOnIdleCallback(boost::bind(&LLInventoryModel::removeObject, &gInventory, mObjectID));
- gInventory.removeObserver(this);
- delete this;
- }
+ LLDiscardAgentOffer(const LLUUID& folder_id, const LLUUID& object_id) :
+ LLInventoryFetchItemsObserver(object_id),
+ mFolderID(folder_id),
+ mObjectID(object_id) {}
+
+ virtual void done()
+ {
+ LL_DEBUGS("Messaging") << "LLDiscardAgentOffer::done()" << LL_ENDL;
+
+ // We're invoked from LLInventoryModel::notifyObservers().
+ // If we now try to remove the inventory item, it will cause a nested
+ // notifyObservers() call, which won't work.
+ // So defer moving the item to trash until viewer gets idle (in a moment).
+ // Use removeObject() rather than removeItem() because at this level,
+ // the object could be either an item or a folder.
+ LLAppViewer::instance()->addOnIdleCallback(boost::bind(&LLInventoryModel::removeObject, &gInventory, mObjectID));
+ gInventory.removeObserver(this);
+ delete this;
+ }
protected:
- LLUUID mFolderID;
- LLUUID mObjectID;
+ LLUUID mFolderID;
+ LLUUID mObjectID;
};
//Returns TRUE if we are OK, FALSE if we are throttled
-//Set check_only true if you want to know the throttle status
+//Set check_only true if you want to know the throttle status
//without registering a hit
bool check_offer_throttle(const std::string& from_name, bool check_only)
{
- static U32 throttle_count;
- static bool throttle_logged;
- LLChat chat;
- std::string log_message;
-
- if (!gSavedSettings.getBOOL("ShowNewInventory"))
- return false;
-
- if (check_only)
- {
- return gThrottleTimer.hasExpired();
- }
-
- if(gThrottleTimer.checkExpirationAndReset(OFFER_THROTTLE_TIME))
- {
- LL_DEBUGS("Messaging") << "Throttle Expired" << LL_ENDL;
- throttle_count=1;
- throttle_logged=false;
- return true;
- }
- else //has not expired
- {
- LL_DEBUGS("Messaging") << "Throttle Not Expired, Count: " << throttle_count << LL_ENDL;
- // When downloading the initial inventory we get a lot of new items
- // coming in and can't tell that from spam.
- if (LLStartUp::getStartupState() >= STATE_STARTED
- && throttle_count >= OFFER_THROTTLE_MAX_COUNT)
- {
- if (!throttle_logged)
- {
- // Use the name of the last item giver, who is probably the person
- // spamming you.
-
- LLStringUtil::format_map_t arg;
- std::string log_msg;
- std::ostringstream time ;
- time<<OFFER_THROTTLE_TIME;
-
- arg["APP_NAME"] = LLAppViewer::instance()->getSecondLifeTitle();
- arg["TIME"] = time.str();
-
- if (!from_name.empty())
- {
- arg["FROM_NAME"] = from_name;
- log_msg = LLTrans::getString("ItemsComingInTooFastFrom", arg);
- }
- else
- {
- log_msg = LLTrans::getString("ItemsComingInTooFast", arg);
- }
-
- //this is kinda important, so actually put it on screen
- LLSD args;
- args["MESSAGE"] = log_msg;
- LLNotificationsUtil::add("SystemMessage", args);
-
- throttle_logged=true;
- }
- return false;
- }
- else
- {
- throttle_count++;
- return true;
- }
- }
-}
-
+ static U32 throttle_count;
+ static bool throttle_logged;
+ LLChat chat;
+ std::string log_message;
+
+ if (!gSavedSettings.getBOOL("ShowNewInventory"))
+ return false;
+
+ if (check_only)
+ {
+ return gThrottleTimer.hasExpired();
+ }
+
+ if(gThrottleTimer.checkExpirationAndReset(OFFER_THROTTLE_TIME))
+ {
+ LL_DEBUGS("Messaging") << "Throttle Expired" << LL_ENDL;
+ throttle_count=1;
+ throttle_logged=false;
+ return true;
+ }
+ else //has not expired
+ {
+ LL_DEBUGS("Messaging") << "Throttle Not Expired, Count: " << throttle_count << LL_ENDL;
+ // When downloading the initial inventory we get a lot of new items
+ // coming in and can't tell that from spam.
+ if (LLStartUp::getStartupState() >= STATE_STARTED
+ && throttle_count >= OFFER_THROTTLE_MAX_COUNT)
+ {
+ if (!throttle_logged)
+ {
+ // Use the name of the last item giver, who is probably the person
+ // spamming you.
+
+ LLStringUtil::format_map_t arg;
+ std::string log_msg;
+ std::ostringstream time ;
+ time<<OFFER_THROTTLE_TIME;
+
+ arg["APP_NAME"] = LLAppViewer::instance()->getSecondLifeTitle();
+ arg["TIME"] = time.str();
+
+ if (!from_name.empty())
+ {
+ arg["FROM_NAME"] = from_name;
+ log_msg = LLTrans::getString("ItemsComingInTooFastFrom", arg);
+ }
+ else
+ {
+ log_msg = LLTrans::getString("ItemsComingInTooFast", arg);
+ }
+
+ //this is kinda important, so actually put it on screen
+ LLSD args;
+ args["MESSAGE"] = log_msg;
+ LLNotificationsUtil::add("SystemMessage", args);
+
+ throttle_logged=true;
+ }
+ return false;
+ }
+ else
+ {
+ throttle_count++;
+ return true;
+ }
+ }
+}
+
// Return "true" if we have a preview method for that asset type, "false" otherwise
bool check_asset_previewable(const LLAssetType::EType asset_type)
{
- return (asset_type == LLAssetType::AT_NOTECARD) ||
- (asset_type == LLAssetType::AT_LANDMARK) ||
- (asset_type == LLAssetType::AT_TEXTURE) ||
- (asset_type == LLAssetType::AT_ANIMATION) ||
- (asset_type == LLAssetType::AT_SCRIPT) ||
- (asset_type == LLAssetType::AT_SOUND) ||
+ return (asset_type == LLAssetType::AT_NOTECARD) ||
+ (asset_type == LLAssetType::AT_LANDMARK) ||
+ (asset_type == LLAssetType::AT_TEXTURE) ||
+ (asset_type == LLAssetType::AT_ANIMATION) ||
+ (asset_type == LLAssetType::AT_SCRIPT) ||
+ (asset_type == LLAssetType::AT_SOUND) ||
(asset_type == LLAssetType::AT_MATERIAL);
}
void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name)
{
- for (uuid_vec_t::const_iterator obj_iter = objects.begin();
- obj_iter != objects.end();
- ++obj_iter)
- {
- const LLUUID& obj_id = (*obj_iter);
- if(!highlight_offered_object(obj_id))
- {
- const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(obj_id);
- if (parent && (parent->getPreferredType() == LLFolderType::FT_TRASH))
- {
- gInventory.checkTrashOverflow();
- }
- continue;
- }
-
- const LLInventoryObject *obj = gInventory.getObject(obj_id);
- if (!obj)
- {
- LL_WARNS() << "Cannot find object [ itemID:" << obj_id << " ] to open." << LL_ENDL;
- continue;
- }
-
- const LLAssetType::EType asset_type = obj->getActualType();
-
- // Either an inventory item or a category.
- const LLInventoryItem* item = dynamic_cast<const LLInventoryItem*>(obj);
- if (item && check_asset_previewable(asset_type))
- {
- ////////////////////////////////////////////////////////////////////////////////
- // Special handling for various types.
- if (check_offer_throttle(from_name, false)) // If we are throttled, don't display
- {
- LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID() << LL_ENDL;
- // If we opened this ourselves, focus it
- const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
- switch(asset_type)
- {
- case LLAssetType::AT_NOTECARD:
- {
- LLFloaterReg::showInstance("preview_notecard", LLSD(obj_id), take_focus);
- break;
- }
- case LLAssetType::AT_LANDMARK:
- {
- LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID());
- if ("inventory_handler" == from_name)
- {
- LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id", item->getUUID()));
- }
- else if("group_offer" == from_name)
- {
- // "group_offer" is passed by LLOpenTaskGroupOffer
- // Notification about added landmark will be generated under the "from_name.empty()" called from LLOpenTaskOffer::done().
- LLSD args;
- args["type"] = "landmark";
- args["id"] = obj_id;
- LLFloaterSidePanelContainer::showPanel("places", args);
-
- continue;
- }
- else if(from_name.empty())
- {
- std::string folder_name;
- if (parent_folder)
- {
- // Localize folder name.
- // *TODO: share this code?
- folder_name = parent_folder->getName();
- if (LLFolderType::lookupIsProtectedType(parent_folder->getPreferredType()))
- {
- LLTrans::findString(folder_name, "InvFolder " + folder_name);
- }
- }
- else
- {
- folder_name = LLTrans::getString("Unknown");
- }
-
- // we receive a message from LLOpenTaskOffer, it mean that new landmark has been added.
- LLSD args;
- args["LANDMARK_NAME"] = item->getName();
- args["FOLDER_NAME"] = folder_name;
- LLNotificationsUtil::add("LandmarkCreated", args);
- }
- }
- break;
- case LLAssetType::AT_TEXTURE:
- {
- LLFloaterReg::showInstance("preview_texture", LLSD(obj_id), take_focus);
- break;
- }
- case LLAssetType::AT_ANIMATION:
- LLFloaterReg::showInstance("preview_anim", LLSD(obj_id), take_focus);
- break;
- case LLAssetType::AT_SCRIPT:
- LLFloaterReg::showInstance("preview_script", LLSD(obj_id), take_focus);
- break;
- case LLAssetType::AT_SOUND:
- LLFloaterReg::showInstance("preview_sound", LLSD(obj_id), take_focus);
- break;
+ for (uuid_vec_t::const_iterator obj_iter = objects.begin();
+ obj_iter != objects.end();
+ ++obj_iter)
+ {
+ const LLUUID& obj_id = (*obj_iter);
+ if(!highlight_offered_object(obj_id))
+ {
+ const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(obj_id);
+ if (parent && (parent->getPreferredType() == LLFolderType::FT_TRASH))
+ {
+ gInventory.checkTrashOverflow();
+ }
+ continue;
+ }
+
+ const LLInventoryObject *obj = gInventory.getObject(obj_id);
+ if (!obj)
+ {
+ LL_WARNS() << "Cannot find object [ itemID:" << obj_id << " ] to open." << LL_ENDL;
+ continue;
+ }
+
+ const LLAssetType::EType asset_type = obj->getActualType();
+
+ // Either an inventory item or a category.
+ const LLInventoryItem* item = dynamic_cast<const LLInventoryItem*>(obj);
+ if (item && check_asset_previewable(asset_type))
+ {
+ ////////////////////////////////////////////////////////////////////////////////
+ // Special handling for various types.
+ if (check_offer_throttle(from_name, false)) // If we are throttled, don't display
+ {
+ LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID() << LL_ENDL;
+ // If we opened this ourselves, focus it
+ const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
+ switch(asset_type)
+ {
+ case LLAssetType::AT_NOTECARD:
+ {
+ LLFloaterReg::showInstance("preview_notecard", LLSD(obj_id), take_focus);
+ break;
+ }
+ case LLAssetType::AT_LANDMARK:
+ {
+ LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID());
+ if ("inventory_handler" == from_name)
+ {
+ LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id", item->getUUID()));
+ }
+ else if("group_offer" == from_name)
+ {
+ // "group_offer" is passed by LLOpenTaskGroupOffer
+ // Notification about added landmark will be generated under the "from_name.empty()" called from LLOpenTaskOffer::done().
+ LLSD args;
+ args["type"] = "landmark";
+ args["id"] = obj_id;
+ LLFloaterSidePanelContainer::showPanel("places", args);
+
+ continue;
+ }
+ else if(from_name.empty())
+ {
+ std::string folder_name;
+ if (parent_folder)
+ {
+ // Localize folder name.
+ // *TODO: share this code?
+ folder_name = parent_folder->getName();
+ if (LLFolderType::lookupIsProtectedType(parent_folder->getPreferredType()))
+ {
+ LLTrans::findString(folder_name, "InvFolder " + folder_name);
+ }
+ }
+ else
+ {
+ folder_name = LLTrans::getString("Unknown");
+ }
+
+ // we receive a message from LLOpenTaskOffer, it mean that new landmark has been added.
+ LLSD args;
+ args["LANDMARK_NAME"] = item->getName();
+ args["FOLDER_NAME"] = folder_name;
+ LLNotificationsUtil::add("LandmarkCreated", args);
+ }
+ }
+ break;
+ case LLAssetType::AT_TEXTURE:
+ {
+ LLFloaterReg::showInstance("preview_texture", LLSD(obj_id), take_focus);
+ break;
+ }
+ case LLAssetType::AT_ANIMATION:
+ LLFloaterReg::showInstance("preview_anim", LLSD(obj_id), take_focus);
+ break;
+ case LLAssetType::AT_SCRIPT:
+ LLFloaterReg::showInstance("preview_script", LLSD(obj_id), take_focus);
+ break;
+ case LLAssetType::AT_SOUND:
+ LLFloaterReg::showInstance("preview_sound", LLSD(obj_id), take_focus);
+ break;
case LLAssetType::AT_MATERIAL:
// Explicitly do nothing -- we don't want to open the material editor every time you add a material to inventory
break;
- default:
- LL_DEBUGS("Messaging") << "No preview method for previewable asset type : " << LLAssetType::lookupHumanReadable(asset_type) << LL_ENDL;
- break;
- }
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////////
+ default:
+ LL_DEBUGS("Messaging") << "No preview method for previewable asset type : " << LLAssetType::lookupHumanReadable(asset_type) << LL_ENDL;
+ break;
+ }
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
static LLUICachedControl<bool> find_original_new_floater("FindOriginalOpenWindow", false);
//show in a new single-folder window
if(find_original_new_floater && !from_name.empty())
@@ -1578,33 +1578,33 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam
LLInventoryPanel::openInventoryPanelAndSetSelection(auto_open, obj_id, use_main_panel);
}
- }
+ }
}
bool highlight_offered_object(const LLUUID& obj_id)
{
- const LLInventoryObject* obj = gInventory.getObject(obj_id);
- if(!obj)
- {
- LL_WARNS("Messaging") << "Unable to show inventory item: " << obj_id << LL_ENDL;
- return false;
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // Don't highlight if it's in certain "quiet" folders which don't need UI
- // notification (e.g. trash, cof, lost-and-found).
- if(!gAgent.getAFK())
- {
- const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(obj_id);
- if (parent)
- {
- const LLFolderType::EType parent_type = parent->getPreferredType();
- if (LLViewerFolderType::lookupIsQuietType(parent_type))
- {
- return false;
- }
- }
- }
+ const LLInventoryObject* obj = gInventory.getObject(obj_id);
+ if(!obj)
+ {
+ LL_WARNS("Messaging") << "Unable to show inventory item: " << obj_id << LL_ENDL;
+ return false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Don't highlight if it's in certain "quiet" folders which don't need UI
+ // notification (e.g. trash, cof, lost-and-found).
+ if(!gAgent.getAFK())
+ {
+ const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(obj_id);
+ if (parent)
+ {
+ const LLFolderType::EType parent_type = parent->getPreferredType();
+ if (LLViewerFolderType::lookupIsQuietType(parent_type))
+ {
+ return false;
+ }
+ }
+ }
if (obj->getType() == LLAssetType::AT_LANDMARK)
{
@@ -1617,43 +1617,43 @@ bool highlight_offered_object(const LLUUID& obj_id)
}
}
- return true;
+ return true;
}
void inventory_offer_mute_callback(const LLUUID& blocked_id,
- const std::string& full_name,
- bool is_group)
-{
- // *NOTE: blocks owner if the offer came from an object
- LLMute::EType mute_type = is_group ? LLMute::GROUP : LLMute::AGENT;
-
- LLMute mute(blocked_id, full_name, mute_type);
- if (LLMuteList::getInstance()->add(mute))
- {
- LLPanelBlockedList::showPanelAndSelect(blocked_id);
- }
-
- // purge the message queue of any previously queued inventory offers from the same source.
- class OfferMatcher : public LLNotificationsUI::LLScreenChannel::Matcher
- {
- public:
- OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {}
- bool matches(const LLNotificationPtr notification) const
- {
- if(notification->getName() == "ObjectGiveItem"
- || notification->getName() == "OwnObjectGiveItem"
- || notification->getName() == "UserGiveItem")
- {
- return (notification->getPayload()["from_id"].asUUID() == blocked_id);
- }
- return FALSE;
- }
- private:
- const LLUUID& blocked_id;
- };
-
- LLNotificationsUI::LLChannelManager::getInstance()->killToastsFromChannel(LLUUID(
- gSavedSettings.getString("NotificationChannelUUID")), OfferMatcher(blocked_id));
+ const std::string& full_name,
+ bool is_group)
+{
+ // *NOTE: blocks owner if the offer came from an object
+ LLMute::EType mute_type = is_group ? LLMute::GROUP : LLMute::AGENT;
+
+ LLMute mute(blocked_id, full_name, mute_type);
+ if (LLMuteList::getInstance()->add(mute))
+ {
+ LLPanelBlockedList::showPanelAndSelect(blocked_id);
+ }
+
+ // purge the message queue of any previously queued inventory offers from the same source.
+ class OfferMatcher : public LLNotificationsUI::LLScreenChannel::Matcher
+ {
+ public:
+ OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {}
+ bool matches(const LLNotificationPtr notification) const
+ {
+ if(notification->getName() == "ObjectGiveItem"
+ || notification->getName() == "OwnObjectGiveItem"
+ || notification->getName() == "UserGiveItem")
+ {
+ return (notification->getPayload()["from_id"].asUUID() == blocked_id);
+ }
+ return FALSE;
+ }
+ private:
+ const LLUUID& blocked_id;
+ };
+
+ LLNotificationsUI::LLChannelManager::getInstance()->killToastsFromChannel(LLUUID(
+ gSavedSettings.getString("NotificationChannelUUID")), OfferMatcher(blocked_id));
}
@@ -1678,602 +1678,602 @@ LLOfferInfo::LLOfferInfo()
LLOfferInfo::LLOfferInfo(const LLSD& sd)
{
- mIM = (EInstantMessage)sd["im_type"].asInteger();
- mFromID = sd["from_id"].asUUID();
- mFromGroup = sd["from_group"].asBoolean();
- mFromObject = sd["from_object"].asBoolean();
- mTransactionID = sd["transaction_id"].asUUID();
- mFolderID = sd["folder_id"].asUUID();
- mObjectID = sd["object_id"].asUUID();
- mType = LLAssetType::lookup(sd["type"].asString().c_str());
- mFromName = sd["from_name"].asString();
- mDesc = sd["description"].asString();
- mHost = LLHost(sd["sender"].asString());
- mPersist = sd["persist"].asBoolean();
+ mIM = (EInstantMessage)sd["im_type"].asInteger();
+ mFromID = sd["from_id"].asUUID();
+ mFromGroup = sd["from_group"].asBoolean();
+ mFromObject = sd["from_object"].asBoolean();
+ mTransactionID = sd["transaction_id"].asUUID();
+ mFolderID = sd["folder_id"].asUUID();
+ mObjectID = sd["object_id"].asUUID();
+ mType = LLAssetType::lookup(sd["type"].asString().c_str());
+ mFromName = sd["from_name"].asString();
+ mDesc = sd["description"].asString();
+ mHost = LLHost(sd["sender"].asString());
+ mPersist = sd["persist"].asBoolean();
}
LLOfferInfo::LLOfferInfo(const LLOfferInfo& info)
{
- mIM = info.mIM;
- mFromID = info.mFromID;
- mFromGroup = info.mFromGroup;
- mFromObject = info.mFromObject;
- mTransactionID = info.mTransactionID;
- mFolderID = info.mFolderID;
- mObjectID = info.mObjectID;
- mType = info.mType;
- mFromName = info.mFromName;
- mDesc = info.mDesc;
- mHost = info.mHost;
- mPersist = info.mPersist;
+ mIM = info.mIM;
+ mFromID = info.mFromID;
+ mFromGroup = info.mFromGroup;
+ mFromObject = info.mFromObject;
+ mTransactionID = info.mTransactionID;
+ mFolderID = info.mFolderID;
+ mObjectID = info.mObjectID;
+ mType = info.mType;
+ mFromName = info.mFromName;
+ mDesc = info.mDesc;
+ mHost = info.mHost;
+ mPersist = info.mPersist;
}
LLSD LLOfferInfo::asLLSD()
{
- LLSD sd;
+ LLSD sd;
sd["responder_type"] = mResponderType;
- sd["im_type"] = mIM;
- sd["from_id"] = mFromID;
- sd["from_group"] = mFromGroup;
- sd["from_object"] = mFromObject;
- sd["transaction_id"] = mTransactionID;
- sd["folder_id"] = mFolderID;
- sd["object_id"] = mObjectID;
- sd["type"] = LLAssetType::lookup(mType);
- sd["from_name"] = mFromName;
- sd["description"] = mDesc;
- sd["sender"] = mHost.getIPandPort();
- sd["persist"] = mPersist;
- return sd;
+ sd["im_type"] = mIM;
+ sd["from_id"] = mFromID;
+ sd["from_group"] = mFromGroup;
+ sd["from_object"] = mFromObject;
+ sd["transaction_id"] = mTransactionID;
+ sd["folder_id"] = mFolderID;
+ sd["object_id"] = mObjectID;
+ sd["type"] = LLAssetType::lookup(mType);
+ sd["from_name"] = mFromName;
+ sd["description"] = mDesc;
+ sd["sender"] = mHost.getIPandPort();
+ sd["persist"] = mPersist;
+ return sd;
}
void LLOfferInfo::fromLLSD(const LLSD& params)
{
- *this = params;
+ *this = params;
}
void LLOfferInfo::sendReceiveResponse(bool accept, const LLUUID &destination_folder_id)
{
- if(IM_INVENTORY_OFFERED == mIM)
- {
- // add buddy to recent people list
- LLRecentPeople::instance().add(mFromID);
- }
-
- if (mTransactionID.isNull())
- {
- // Not provided, message won't work
- return;
- }
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MessageBlock);
- msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
- msg->addUUIDFast(_PREHASH_ToAgentID, mFromID);
- msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
- msg->addUUIDFast(_PREHASH_ID, mTransactionID);
- msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
- std::string name;
- LLAgentUI::buildFullname(name);
- msg->addStringFast(_PREHASH_FromAgentName, name);
- msg->addStringFast(_PREHASH_Message, "");
- msg->addU32Fast(_PREHASH_ParentEstateID, 0);
- msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
- msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
-
- // ACCEPT. The math for the dialog works, because the accept
- // for inventory_offered, task_inventory_offer or
- // group_notice_inventory is 1 greater than the offer integer value.
- // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED,
- // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED
- // Decline for inventory_offered, task_inventory_offer or
- // group_notice_inventory is 2 greater than the offer integer value.
-
- EInstantMessage im = mIM;
- if (mIM == IM_GROUP_NOTICE_REQUESTED)
- {
- // Request has no responder dialogs
- im = IM_GROUP_NOTICE;
- }
-
- if (accept)
- {
- msg->addU8Fast(_PREHASH_Dialog, (U8)(im + 1));
- msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(destination_folder_id.mData),
- sizeof(destination_folder_id.mData));
- }
- else
- {
- msg->addU8Fast(_PREHASH_Dialog, (U8)(im + 2));
- msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE);
- }
- // send the message
- msg->sendReliable(mHost);
-
- // transaction id is usable only once
- // Note: a bit of a hack, clicking group notice attachment will not close notice
- // so we reset no longer usable transaction id to know not to send message again
- // Once capabilities for responses will be implemented LLOfferInfo will have to
- // remember that it already responded in another way and ignore IOR_DECLINE
- mTransactionID.setNull();
+ if(IM_INVENTORY_OFFERED == mIM)
+ {
+ // add buddy to recent people list
+ LLRecentPeople::instance().add(mFromID);
+ }
+
+ if (mTransactionID.isNull())
+ {
+ // Not provided, message won't work
+ return;
+ }
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_MessageBlock);
+ msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
+ msg->addUUIDFast(_PREHASH_ToAgentID, mFromID);
+ msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
+ msg->addUUIDFast(_PREHASH_ID, mTransactionID);
+ msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
+ std::string name;
+ LLAgentUI::buildFullname(name);
+ msg->addStringFast(_PREHASH_FromAgentName, name);
+ msg->addStringFast(_PREHASH_Message, "");
+ msg->addU32Fast(_PREHASH_ParentEstateID, 0);
+ msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
+ msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
+
+ // ACCEPT. The math for the dialog works, because the accept
+ // for inventory_offered, task_inventory_offer or
+ // group_notice_inventory is 1 greater than the offer integer value.
+ // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED,
+ // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED
+ // Decline for inventory_offered, task_inventory_offer or
+ // group_notice_inventory is 2 greater than the offer integer value.
+
+ EInstantMessage im = mIM;
+ if (mIM == IM_GROUP_NOTICE_REQUESTED)
+ {
+ // Request has no responder dialogs
+ im = IM_GROUP_NOTICE;
+ }
+
+ if (accept)
+ {
+ msg->addU8Fast(_PREHASH_Dialog, (U8)(im + 1));
+ msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(destination_folder_id.mData),
+ sizeof(destination_folder_id.mData));
+ }
+ else
+ {
+ msg->addU8Fast(_PREHASH_Dialog, (U8)(im + 2));
+ msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE);
+ }
+ // send the message
+ msg->sendReliable(mHost);
+
+ // transaction id is usable only once
+ // Note: a bit of a hack, clicking group notice attachment will not close notice
+ // so we reset no longer usable transaction id to know not to send message again
+ // Once capabilities for responses will be implemented LLOfferInfo will have to
+ // remember that it already responded in another way and ignore IOR_DECLINE
+ mTransactionID.setNull();
}
void LLOfferInfo::handleRespond(const LLSD& notification, const LLSD& response)
{
- initRespondFunctionMap();
+ initRespondFunctionMap();
- const std::string name = notification["name"].asString();
- if(mRespondFunctions.find(name) == mRespondFunctions.end())
- {
- LL_WARNS() << "Unexpected notification name : " << name << LL_ENDL;
- llassert(!"Unexpected notification name");
- return;
- }
+ const std::string name = notification["name"].asString();
+ if(mRespondFunctions.find(name) == mRespondFunctions.end())
+ {
+ LL_WARNS() << "Unexpected notification name : " << name << LL_ENDL;
+ llassert(!"Unexpected notification name");
+ return;
+ }
- mRespondFunctions[name](notification, response);
+ mRespondFunctions[name](notification, response);
}
bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& response)
{
- LLChat chat;
- std::string log_message;
- S32 button = LLNotificationsUtil::getSelectedOption(notification, response);
-
- LLInventoryObserver* opener = NULL;
- LLViewerInventoryCategory* catp = NULL;
- catp = (LLViewerInventoryCategory*)gInventory.getCategory(mObjectID);
- LLViewerInventoryItem* itemp = NULL;
- if(!catp)
- {
- itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID);
- }
-
- LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
-
- // For muting, we need to add the mute, then decline the offer.
- // This must be done here because:
- // * callback may be called immediately,
- // * adding the mute sends a message,
- // * we can't build two messages at once.
- if (IOR_MUTE == button) // Block
- {
- if (notification_ptr != NULL)
- {
- if (mFromGroup)
- {
- gCacheName->getGroup(mFromID, boost::bind(&inventory_offer_mute_callback, _1, _2, _3));
- }
- else
- {
- LLAvatarNameCache::get(mFromID, boost::bind(&inventory_offer_mute_avatar_callback, _1, _2));
- }
- }
- }
-
- std::string from_string; // Used in the pop-up.
- std::string chatHistory_string; // Used in chat history.
-
- // TODO: when task inventory offers can also be handled the new way, migrate the code that sets these strings here:
- from_string = chatHistory_string = mFromName;
-
- // accept goes to proper folder, decline gets accepted to trash, muted gets declined
- bool accept_to_trash = true;
-
- LLNotificationFormPtr modified_form(notification_ptr ? new LLNotificationForm(*notification_ptr->getForm()) : new LLNotificationForm());
-
- switch(button)
- {
- case IOR_SHOW:
- // we will want to open this item when it comes back.
- LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID
- << LL_ENDL;
- switch (mIM)
- {
- case IM_INVENTORY_OFFERED:
- {
- // This is an offer from an agent. In this case, the back
- // end has already copied the items into your inventory,
- // so we can fetch it out of our inventory.
- if (gSavedSettings.getBOOL("ShowOfferedInventory"))
- {
- LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(mObjectID, from_string);
- open_agent_offer->startFetch();
- if(catp || (itemp && itemp->isFinished()))
- {
- open_agent_offer->done();
- }
- else
- {
- opener = open_agent_offer;
- }
- }
- }
- break;
- case IM_GROUP_NOTICE:
- case IM_GROUP_NOTICE_REQUESTED:
- opener = new LLOpenTaskGroupOffer;
- sendReceiveResponse(true, mFolderID);
- break;
- case IM_TASK_INVENTORY_OFFERED:
- // This is an offer from a task or group.
- // We don't use a new instance of an opener
- // We instead use the singular observer gOpenTaskOffer
- // Since it already exists, we don't need to actually do anything
- break;
- default:
- LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL;
- break;
- }
-
- if (modified_form != NULL)
- {
- modified_form->setElementEnabled("Show", false);
- }
- break;
- // end switch (mIM)
-
- case IOR_ACCEPT:
- //don't spam them if they are getting flooded
- if (check_offer_throttle(mFromName, true))
- {
- log_message = "<nolink>" + chatHistory_string + "</nolink> " + LLTrans::getString("InvOfferGaveYou") + " " + getSanitizedDescription() + LLTrans::getString(".");
- LLSD args;
- args["MESSAGE"] = log_message;
- LLNotificationsUtil::add("SystemMessageTip", args);
- }
-
- break;
-
- case IOR_MUTE:
- if (modified_form != NULL)
- {
- modified_form->setElementEnabled("Mute", false);
- }
- accept_to_trash = false; // for notices, but IOR_MUTE normally doesn't happen for notices
- // MUTE falls through to decline
- case IOR_DECLINE:
- {
- {
- LLStringUtil::format_map_t log_message_args;
- log_message_args["DESC"] = mDesc;
- log_message_args["NAME"] = mFromName;
- log_message = LLTrans::getString("InvOfferDecline", log_message_args);
- }
- chat.mText = log_message;
- if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::isLinden(mFromName) ) // muting for SL-42269
- {
- chat.mMuted = TRUE;
- accept_to_trash = false; // will send decline message
- }
-
- // *NOTE dzaporozhan
- // Disabled logging to old chat floater to fix crash in group notices - EXT-4149
- // LLFloaterChat::addChatHistory(chat);
-
- if (mObjectID.notNull()) //make sure we can discard
- {
- LLDiscardAgentOffer* discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID);
- discard_agent_offer->startFetch();
- if ((catp && gInventory.isCategoryComplete(mObjectID)) || (itemp && itemp->isFinished()))
- {
- discard_agent_offer->done();
- }
- else
- {
- opener = discard_agent_offer;
- }
- }
- else if (mIM == IM_GROUP_NOTICE)
- {
- // group notice needs to request object to trash so that user will see it later
- // Note: muted agent offers go to trash, not sure if we should do same for notices
- LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- sendReceiveResponse(accept_to_trash, trash);
- }
-
- if (modified_form != NULL)
- {
- modified_form->setElementEnabled("Show", false);
- modified_form->setElementEnabled("Discard", false);
- }
-
- break;
- }
- default:
- // close button probably
- // In case of agent offers item has already been fetched and is in your inventory, we simply won't highlight it
- // OR delete it if the notification gets killed, since we don't want that to be a vector for
- // losing inventory offers.
- if (mIM == IM_GROUP_NOTICE)
- {
- LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- sendReceiveResponse(true, trash);
- }
- break;
- }
-
- if(opener)
- {
- gInventory.addObserver(opener);
- }
-
- if(!mPersist)
- {
- delete this;
- }
-
- return false;
+ LLChat chat;
+ std::string log_message;
+ S32 button = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ LLInventoryObserver* opener = NULL;
+ LLViewerInventoryCategory* catp = NULL;
+ catp = (LLViewerInventoryCategory*)gInventory.getCategory(mObjectID);
+ LLViewerInventoryItem* itemp = NULL;
+ if(!catp)
+ {
+ itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID);
+ }
+
+ LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
+
+ // For muting, we need to add the mute, then decline the offer.
+ // This must be done here because:
+ // * callback may be called immediately,
+ // * adding the mute sends a message,
+ // * we can't build two messages at once.
+ if (IOR_MUTE == button) // Block
+ {
+ if (notification_ptr != NULL)
+ {
+ if (mFromGroup)
+ {
+ gCacheName->getGroup(mFromID, boost::bind(&inventory_offer_mute_callback, _1, _2, _3));
+ }
+ else
+ {
+ LLAvatarNameCache::get(mFromID, boost::bind(&inventory_offer_mute_avatar_callback, _1, _2));
+ }
+ }
+ }
+
+ std::string from_string; // Used in the pop-up.
+ std::string chatHistory_string; // Used in chat history.
+
+ // TODO: when task inventory offers can also be handled the new way, migrate the code that sets these strings here:
+ from_string = chatHistory_string = mFromName;
+
+ // accept goes to proper folder, decline gets accepted to trash, muted gets declined
+ bool accept_to_trash = true;
+
+ LLNotificationFormPtr modified_form(notification_ptr ? new LLNotificationForm(*notification_ptr->getForm()) : new LLNotificationForm());
+
+ switch(button)
+ {
+ case IOR_SHOW:
+ // we will want to open this item when it comes back.
+ LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID
+ << LL_ENDL;
+ switch (mIM)
+ {
+ case IM_INVENTORY_OFFERED:
+ {
+ // This is an offer from an agent. In this case, the back
+ // end has already copied the items into your inventory,
+ // so we can fetch it out of our inventory.
+ if (gSavedSettings.getBOOL("ShowOfferedInventory"))
+ {
+ LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(mObjectID, from_string);
+ open_agent_offer->startFetch();
+ if(catp || (itemp && itemp->isFinished()))
+ {
+ open_agent_offer->done();
+ }
+ else
+ {
+ opener = open_agent_offer;
+ }
+ }
+ }
+ break;
+ case IM_GROUP_NOTICE:
+ case IM_GROUP_NOTICE_REQUESTED:
+ opener = new LLOpenTaskGroupOffer;
+ sendReceiveResponse(true, mFolderID);
+ break;
+ case IM_TASK_INVENTORY_OFFERED:
+ // This is an offer from a task or group.
+ // We don't use a new instance of an opener
+ // We instead use the singular observer gOpenTaskOffer
+ // Since it already exists, we don't need to actually do anything
+ break;
+ default:
+ LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL;
+ break;
+ }
+
+ if (modified_form != NULL)
+ {
+ modified_form->setElementEnabled("Show", false);
+ }
+ break;
+ // end switch (mIM)
+
+ case IOR_ACCEPT:
+ //don't spam them if they are getting flooded
+ if (check_offer_throttle(mFromName, true))
+ {
+ log_message = "<nolink>" + chatHistory_string + "</nolink> " + LLTrans::getString("InvOfferGaveYou") + " " + getSanitizedDescription() + LLTrans::getString(".");
+ LLSD args;
+ args["MESSAGE"] = log_message;
+ LLNotificationsUtil::add("SystemMessageTip", args);
+ }
+
+ break;
+
+ case IOR_MUTE:
+ if (modified_form != NULL)
+ {
+ modified_form->setElementEnabled("Mute", false);
+ }
+ accept_to_trash = false; // for notices, but IOR_MUTE normally doesn't happen for notices
+ // MUTE falls through to decline
+ case IOR_DECLINE:
+ {
+ {
+ LLStringUtil::format_map_t log_message_args;
+ log_message_args["DESC"] = mDesc;
+ log_message_args["NAME"] = mFromName;
+ log_message = LLTrans::getString("InvOfferDecline", log_message_args);
+ }
+ chat.mText = log_message;
+ if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::isLinden(mFromName) ) // muting for SL-42269
+ {
+ chat.mMuted = TRUE;
+ accept_to_trash = false; // will send decline message
+ }
+
+ // *NOTE dzaporozhan
+ // Disabled logging to old chat floater to fix crash in group notices - EXT-4149
+ // LLFloaterChat::addChatHistory(chat);
+
+ if (mObjectID.notNull()) //make sure we can discard
+ {
+ LLDiscardAgentOffer* discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID);
+ discard_agent_offer->startFetch();
+ if ((catp && gInventory.isCategoryComplete(mObjectID)) || (itemp && itemp->isFinished()))
+ {
+ discard_agent_offer->done();
+ }
+ else
+ {
+ opener = discard_agent_offer;
+ }
+ }
+ else if (mIM == IM_GROUP_NOTICE)
+ {
+ // group notice needs to request object to trash so that user will see it later
+ // Note: muted agent offers go to trash, not sure if we should do same for notices
+ LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ sendReceiveResponse(accept_to_trash, trash);
+ }
+
+ if (modified_form != NULL)
+ {
+ modified_form->setElementEnabled("Show", false);
+ modified_form->setElementEnabled("Discard", false);
+ }
+
+ break;
+ }
+ default:
+ // close button probably
+ // In case of agent offers item has already been fetched and is in your inventory, we simply won't highlight it
+ // OR delete it if the notification gets killed, since we don't want that to be a vector for
+ // losing inventory offers.
+ if (mIM == IM_GROUP_NOTICE)
+ {
+ LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ sendReceiveResponse(true, trash);
+ }
+ break;
+ }
+
+ if(opener)
+ {
+ gInventory.addObserver(opener);
+ }
+
+ if(!mPersist)
+ {
+ delete this;
+ }
+
+ return false;
}
bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const LLSD& response)
{
- LLChat chat;
- std::string log_message;
- S32 button = LLNotification::getSelectedOption(notification, response);
-
- // For muting, we need to add the mute, then decline the offer.
- // This must be done here because:
- // * callback may be called immediately,
- // * adding the mute sends a message,
- // * we can't build two messages at once.
- if (2 == button)
- {
- LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
-
- llassert(notification_ptr != NULL);
- if (notification_ptr != NULL)
- {
- if (mFromGroup)
- {
- gCacheName->getGroup(mFromID, boost::bind(&inventory_offer_mute_callback, _1, _2, _3));
- }
- else
- {
- LLAvatarNameCache::get(mFromID, boost::bind(&inventory_offer_mute_avatar_callback, _1, _2));
- }
- }
- }
-
- std::string from_string; // Used in the pop-up.
- std::string chatHistory_string; // Used in chat history.
-
- if (mFromObject == TRUE)
- {
- if (mFromGroup)
- {
- std::string group_name;
- if (gCacheName->getGroupName(mFromID, group_name))
- {
- from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'"
- + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup")
- + " "+ "'" + group_name + "'";
-
- chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup")
- + " " + group_name + "'";
- }
- else
- {
- from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'"
- + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup");
- chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup");
- }
- }
- else
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(mFromID, &av_name))
- {
- from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName
- + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + av_name.getUserName();
- chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + av_name.getUserName();
- }
- else
- {
- from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+LLTrans::getString("'")
- + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser");
- chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser");
- }
- }
- }
- else
- {
- from_string = chatHistory_string = mFromName;
- }
-
- LLUUID destination;
- bool accept = true;
-
- // If user accepted, accept to proper folder, if user discarded, accept to trash.
- switch(button)
- {
- case IOR_ACCEPT:
- destination = mFolderID;
- //don't spam user if flooded
- if (check_offer_throttle(mFromName, true))
- {
- log_message = "<nolink>" + chatHistory_string + "</nolink> " + LLTrans::getString("InvOfferGaveYou") + " " + getSanitizedDescription() + LLTrans::getString(".");
- LLSD args;
- args["MESSAGE"] = log_message;
- LLNotificationsUtil::add("SystemMessageTip", args);
- }
- break;
- case IOR_MUTE:
- // MUTE falls through to decline
- accept = false;
- case IOR_DECLINE:
- default:
- // close button probably (or any of the fall-throughs from above)
- destination = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if (accept && LLMuteList::getInstance()->isMuted(mFromID, mFromName))
- {
- // Note: muted offers are usually declined automatically,
- // but user can mute object after receiving message
- accept = false;
- }
- break;
- }
-
- sendReceiveResponse(accept, destination);
-
- if(!mPersist)
- {
- delete this;
- }
- return false;
+ LLChat chat;
+ std::string log_message;
+ S32 button = LLNotification::getSelectedOption(notification, response);
+
+ // For muting, we need to add the mute, then decline the offer.
+ // This must be done here because:
+ // * callback may be called immediately,
+ // * adding the mute sends a message,
+ // * we can't build two messages at once.
+ if (2 == button)
+ {
+ LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
+
+ llassert(notification_ptr != NULL);
+ if (notification_ptr != NULL)
+ {
+ if (mFromGroup)
+ {
+ gCacheName->getGroup(mFromID, boost::bind(&inventory_offer_mute_callback, _1, _2, _3));
+ }
+ else
+ {
+ LLAvatarNameCache::get(mFromID, boost::bind(&inventory_offer_mute_avatar_callback, _1, _2));
+ }
+ }
+ }
+
+ std::string from_string; // Used in the pop-up.
+ std::string chatHistory_string; // Used in chat history.
+
+ if (mFromObject == TRUE)
+ {
+ if (mFromGroup)
+ {
+ std::string group_name;
+ if (gCacheName->getGroupName(mFromID, group_name))
+ {
+ from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'"
+ + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup")
+ + " "+ "'" + group_name + "'";
+
+ chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup")
+ + " " + group_name + "'";
+ }
+ else
+ {
+ from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'"
+ + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup");
+ chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup");
+ }
+ }
+ else
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(mFromID, &av_name))
+ {
+ from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName
+ + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + av_name.getUserName();
+ chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + av_name.getUserName();
+ }
+ else
+ {
+ from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+LLTrans::getString("'")
+ + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser");
+ chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser");
+ }
+ }
+ }
+ else
+ {
+ from_string = chatHistory_string = mFromName;
+ }
+
+ LLUUID destination;
+ bool accept = true;
+
+ // If user accepted, accept to proper folder, if user discarded, accept to trash.
+ switch(button)
+ {
+ case IOR_ACCEPT:
+ destination = mFolderID;
+ //don't spam user if flooded
+ if (check_offer_throttle(mFromName, true))
+ {
+ log_message = "<nolink>" + chatHistory_string + "</nolink> " + LLTrans::getString("InvOfferGaveYou") + " " + getSanitizedDescription() + LLTrans::getString(".");
+ LLSD args;
+ args["MESSAGE"] = log_message;
+ LLNotificationsUtil::add("SystemMessageTip", args);
+ }
+ break;
+ case IOR_MUTE:
+ // MUTE falls through to decline
+ accept = false;
+ case IOR_DECLINE:
+ default:
+ // close button probably (or any of the fall-throughs from above)
+ destination = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if (accept && LLMuteList::getInstance()->isMuted(mFromID, mFromName))
+ {
+ // Note: muted offers are usually declined automatically,
+ // but user can mute object after receiving message
+ accept = false;
+ }
+ break;
+ }
+
+ sendReceiveResponse(accept, destination);
+
+ if(!mPersist)
+ {
+ delete this;
+ }
+ return false;
}
std::string LLOfferInfo::getSanitizedDescription()
{
- // currently we get description from server as: 'Object' ( Location )
- // object name shouldn't be shown as a hyperlink
- std::string description = mDesc;
+ // currently we get description from server as: 'Object' ( Location )
+ // object name shouldn't be shown as a hyperlink
+ std::string description = mDesc;
- std::size_t start = mDesc.find_first_of("'");
- std::size_t end = mDesc.find_last_of("'");
- if ((start != std::string::npos) && (end != std::string::npos))
- {
- description.insert(start, "<nolink>");
- description.insert(end + 8, "</nolink>");
- }
- return description;
+ std::size_t start = mDesc.find_first_of("'");
+ std::size_t end = mDesc.find_last_of("'");
+ if ((start != std::string::npos) && (end != std::string::npos))
+ {
+ description.insert(start, "<nolink>");
+ description.insert(end + 8, "</nolink>");
+ }
+ return description;
}
void LLOfferInfo::initRespondFunctionMap()
{
- if(mRespondFunctions.empty())
- {
- mRespondFunctions["ObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
- mRespondFunctions["OwnObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
- mRespondFunctions["UserGiveItem"] = boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2);
- }
+ if(mRespondFunctions.empty())
+ {
+ mRespondFunctions["ObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
+ mRespondFunctions["OwnObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
+ mRespondFunctions["UserGiveItem"] = boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2);
+ }
}
bool lure_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = 0;
- if (response.isInteger())
- {
- option = response.asInteger();
- }
- else
- {
- option = LLNotificationsUtil::getSelectedOption(notification, response);
- }
-
- LLUUID from_id = notification["payload"]["from_id"].asUUID();
- LLUUID lure_id = notification["payload"]["lure_id"].asUUID();
- BOOL godlike = notification["payload"]["godlike"].asBoolean();
-
- switch(option)
- {
- case 0:
- {
- // accept
- gAgent.teleportViaLure(lure_id, godlike);
- }
- break;
- case 1:
- default:
- // decline
- send_simple_im(from_id,
- LLStringUtil::null,
- IM_LURE_DECLINED,
- lure_id);
- break;
- }
-
- LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
-
- if (notification_ptr)
- {
- LLNotificationFormPtr modified_form(new LLNotificationForm(*notification_ptr->getForm()));
- modified_form->setElementEnabled("Teleport", false);
- modified_form->setElementEnabled("Cancel", false);
- notification_ptr->updateForm(modified_form);
- notification_ptr->repost();
- }
-
- return false;
+ S32 option = 0;
+ if (response.isInteger())
+ {
+ option = response.asInteger();
+ }
+ else
+ {
+ option = LLNotificationsUtil::getSelectedOption(notification, response);
+ }
+
+ LLUUID from_id = notification["payload"]["from_id"].asUUID();
+ LLUUID lure_id = notification["payload"]["lure_id"].asUUID();
+ BOOL godlike = notification["payload"]["godlike"].asBoolean();
+
+ switch(option)
+ {
+ case 0:
+ {
+ // accept
+ gAgent.teleportViaLure(lure_id, godlike);
+ }
+ break;
+ case 1:
+ default:
+ // decline
+ send_simple_im(from_id,
+ LLStringUtil::null,
+ IM_LURE_DECLINED,
+ lure_id);
+ break;
+ }
+
+ LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
+
+ if (notification_ptr)
+ {
+ LLNotificationFormPtr modified_form(new LLNotificationForm(*notification_ptr->getForm()));
+ modified_form->setElementEnabled("Teleport", false);
+ modified_form->setElementEnabled("Cancel", false);
+ notification_ptr->updateForm(modified_form);
+ notification_ptr->repost();
+ }
+
+ return false;
}
static LLNotificationFunctorRegistration lure_callback_reg("TeleportOffered", lure_callback);
bool mature_lure_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = 0;
- if (response.isInteger())
- {
- option = response.asInteger();
- }
- else
- {
- option = LLNotificationsUtil::getSelectedOption(notification, response);
- }
-
- LLUUID from_id = notification["payload"]["from_id"].asUUID();
- LLUUID lure_id = notification["payload"]["lure_id"].asUUID();
- BOOL godlike = notification["payload"]["godlike"].asBoolean();
- U8 region_access = static_cast<U8>(notification["payload"]["region_maturity"].asInteger());
-
- switch(option)
- {
- case 0:
- {
- // accept
- gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(region_access));
- gAgent.setMaturityRatingChangeDuringTeleport(region_access);
- gAgent.teleportViaLure(lure_id, godlike);
- }
- break;
- case 1:
- default:
- // decline
- send_simple_im(from_id,
- LLStringUtil::null,
- IM_LURE_DECLINED,
- lure_id);
- break;
- }
- return false;
+ S32 option = 0;
+ if (response.isInteger())
+ {
+ option = response.asInteger();
+ }
+ else
+ {
+ option = LLNotificationsUtil::getSelectedOption(notification, response);
+ }
+
+ LLUUID from_id = notification["payload"]["from_id"].asUUID();
+ LLUUID lure_id = notification["payload"]["lure_id"].asUUID();
+ BOOL godlike = notification["payload"]["godlike"].asBoolean();
+ U8 region_access = static_cast<U8>(notification["payload"]["region_maturity"].asInteger());
+
+ switch(option)
+ {
+ case 0:
+ {
+ // accept
+ gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(region_access));
+ gAgent.setMaturityRatingChangeDuringTeleport(region_access);
+ gAgent.teleportViaLure(lure_id, godlike);
+ }
+ break;
+ case 1:
+ default:
+ // decline
+ send_simple_im(from_id,
+ LLStringUtil::null,
+ IM_LURE_DECLINED,
+ lure_id);
+ break;
+ }
+ return false;
}
static LLNotificationFunctorRegistration mature_lure_callback_reg("TeleportOffered_MaturityExceeded", mature_lure_callback);
bool goto_url_callback(const LLSD& notification, const LLSD& response)
{
- std::string url = notification["payload"]["url"].asString();
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if(1 == option)
- {
- LLWeb::loadURL(url);
- }
- return false;
+ std::string url = notification["payload"]["url"].asString();
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if(1 == option)
+ {
+ LLWeb::loadURL(url);
+ }
+ return false;
}
static LLNotificationFunctorRegistration goto_url_callback_reg("GotoURL", goto_url_callback);
bool inspect_remote_object_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- LLFloaterReg::showInstance("inspect_remote_object", notification["payload"]);
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ LLFloaterReg::showInstance("inspect_remote_object", notification["payload"]);
+ }
+ return false;
}
static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("ServerObjectMessage", inspect_remote_object_callback);
class LLPostponedServerObjectNotification: public LLPostponedNotification
{
protected:
- /* virtual */
- void modifyNotificationParams()
- {
- LLSD payload = mParams.payload;
- mParams.payload = payload;
- }
+ /* virtual */
+ void modifyNotificationParams()
+ {
+ LLSD payload = mParams.payload;
+ mParams.payload = payload;
+ }
};
void process_improved_im(LLMessageSystem *msg, void **user_data)
@@ -2303,7 +2303,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
msg->getU8Fast(_PREHASH_MessageBlock, _PREHASH_Dialog, d);
msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id);
msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, timestamp);
- //msg->getData("MessageBlock", "Count", &count);
+ //msg->getData("MessageBlock", "Count", &count);
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, agentName);
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message);
msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id);
@@ -2333,129 +2333,129 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id)
{
- if (gAgent.isDoNotDisturb())
- {
- std::string my_name;
- LLAgentUI::buildFullname(my_name);
- std::string response = gSavedPerAccountSettings.getString("DoNotDisturbModeResponse");
- pack_instant_message(
- msg,
- gAgent.getID(),
- FALSE,
- gAgent.getSessionID(),
- from_id,
- my_name,
- response,
- IM_ONLINE,
- IM_DO_NOT_DISTURB_AUTO_RESPONSE,
- session_id);
- gAgent.sendReliableMessage();
- }
+ if (gAgent.isDoNotDisturb())
+ {
+ std::string my_name;
+ LLAgentUI::buildFullname(my_name);
+ std::string response = gSavedPerAccountSettings.getString("DoNotDisturbModeResponse");
+ pack_instant_message(
+ msg,
+ gAgent.getID(),
+ FALSE,
+ gAgent.getSessionID(),
+ from_id,
+ my_name,
+ response,
+ IM_ONLINE,
+ IM_DO_NOT_DISTURB_AUTO_RESPONSE,
+ session_id);
+ gAgent.sendReliableMessage();
+ }
}
bool callingcard_offer_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLUUID fid;
- LLUUID from_id;
- LLMessageSystem* msg = gMessageSystem;
- switch(option)
- {
- case 0:
- // accept
- msg->newMessageFast(_PREHASH_AcceptCallingCard);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_TransactionBlock);
- msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID());
- fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
- msg->nextBlockFast(_PREHASH_FolderData);
- msg->addUUIDFast(_PREHASH_FolderID, fid);
- msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
- break;
- case 1:
- // decline
- msg->newMessageFast(_PREHASH_DeclineCallingCard);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_TransactionBlock);
- msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID());
- msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
- send_do_not_disturb_message(msg, notification["payload"]["source_id"].asUUID());
- break;
- default:
- // close button probably, possibly timed out
- break;
- }
-
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLUUID fid;
+ LLUUID from_id;
+ LLMessageSystem* msg = gMessageSystem;
+ switch(option)
+ {
+ case 0:
+ // accept
+ msg->newMessageFast(_PREHASH_AcceptCallingCard);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_TransactionBlock);
+ msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID());
+ fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
+ msg->nextBlockFast(_PREHASH_FolderData);
+ msg->addUUIDFast(_PREHASH_FolderID, fid);
+ msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
+ break;
+ case 1:
+ // decline
+ msg->newMessageFast(_PREHASH_DeclineCallingCard);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_TransactionBlock);
+ msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID());
+ msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
+ send_do_not_disturb_message(msg, notification["payload"]["source_id"].asUUID());
+ break;
+ default:
+ // close button probably, possibly timed out
+ break;
+ }
+
+ return false;
}
static LLNotificationFunctorRegistration callingcard_offer_cb_reg("OfferCallingCard", callingcard_offer_callback);
void process_offer_callingcard(LLMessageSystem* msg, void**)
{
- // someone has offered to form a friendship
- LL_DEBUGS("Messaging") << "callingcard offer" << LL_ENDL;
-
- LLUUID source_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, source_id);
- LLUUID tid;
- msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_TransactionID, tid);
-
- LLSD payload;
- payload["transaction_id"] = tid;
- payload["source_id"] = source_id;
- payload["sender"] = msg->getSender().getIPandPort();
-
- LLViewerObject* source = gObjectList.findObject(source_id);
- LLSD args;
- std::string source_name;
- if(source && source->isAvatar())
- {
- LLNameValue* nvfirst = source->getNVPair("FirstName");
- LLNameValue* nvlast = source->getNVPair("LastName");
- if (nvfirst && nvlast)
- {
- source_name = LLCacheName::buildFullName(
- nvfirst->getString(), nvlast->getString());
- }
- }
-
- if(!source_name.empty())
- {
- if (gAgent.isDoNotDisturb()
- || LLMuteList::getInstance()->isMuted(source_id, source_name, LLMute::flagTextChat))
- {
- // automatically decline offer
- LLNotifications::instance().forceResponse(LLNotification::Params("OfferCallingCard").payload(payload), 1);
- }
- else
- {
- args["NAME"] = source_name;
- LLNotificationsUtil::add("OfferCallingCard", args, payload);
- }
- }
- else
- {
- LL_WARNS("Messaging") << "Calling card offer from an unknown source." << LL_ENDL;
- }
+ // someone has offered to form a friendship
+ LL_DEBUGS("Messaging") << "callingcard offer" << LL_ENDL;
+
+ LLUUID source_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, source_id);
+ LLUUID tid;
+ msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_TransactionID, tid);
+
+ LLSD payload;
+ payload["transaction_id"] = tid;
+ payload["source_id"] = source_id;
+ payload["sender"] = msg->getSender().getIPandPort();
+
+ LLViewerObject* source = gObjectList.findObject(source_id);
+ LLSD args;
+ std::string source_name;
+ if(source && source->isAvatar())
+ {
+ LLNameValue* nvfirst = source->getNVPair("FirstName");
+ LLNameValue* nvlast = source->getNVPair("LastName");
+ if (nvfirst && nvlast)
+ {
+ source_name = LLCacheName::buildFullName(
+ nvfirst->getString(), nvlast->getString());
+ }
+ }
+
+ if(!source_name.empty())
+ {
+ if (gAgent.isDoNotDisturb()
+ || LLMuteList::getInstance()->isMuted(source_id, source_name, LLMute::flagTextChat))
+ {
+ // automatically decline offer
+ LLNotifications::instance().forceResponse(LLNotification::Params("OfferCallingCard").payload(payload), 1);
+ }
+ else
+ {
+ args["NAME"] = source_name;
+ LLNotificationsUtil::add("OfferCallingCard", args, payload);
+ }
+ }
+ else
+ {
+ LL_WARNS("Messaging") << "Calling card offer from an unknown source." << LL_ENDL;
+ }
}
void process_accept_callingcard(LLMessageSystem* msg, void**)
{
- LLNotificationsUtil::add("CallingCardAccepted");
+ LLNotificationsUtil::add("CallingCardAccepted");
}
void process_decline_callingcard(LLMessageSystem* msg, void**)
{
- LLNotificationsUtil::add("CallingCardDeclined");
+ LLNotificationsUtil::add("CallingCardDeclined");
}
void translateSuccess(LLChat chat, LLSD toastArgs, std::string originalMsg, std::string expectLang, std::string translation, const std::string detected_language)
{
- // filter out non-interesting responses
+ // filter out non-interesting responses
if (!translation.empty()
&& ((detected_language.empty()) || (expectLang != detected_language))
&& (LLStringUtil::compareInsensitive(translation, originalMsg) != 0))
@@ -2463,7 +2463,7 @@ void translateSuccess(LLChat chat, LLSD toastArgs, std::string originalMsg, std:
chat.mText += " (" + LLTranslate::removeNoTranslateTags(translation) + ")";
}
- LLTranslate::instance().logSuccess(1);
+ LLTranslate::instance().logSuccess(1);
LLNotificationsUI::LLNotificationManager::instance().onChat(chat, toastArgs);
}
@@ -2473,424 +2473,424 @@ void translateFailure(LLChat chat, LLSD toastArgs, int status, const std::string
LLStringUtil::replaceString(msg, "\n", " "); // we want one-line error messages
chat.mText += " (" + msg + ")";
- LLTranslate::instance().logFailure(1);
+ LLTranslate::instance().logFailure(1);
LLNotificationsUI::LLNotificationManager::instance().onChat(chat, toastArgs);
}
void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
{
- if (gNonInteractive)
- {
- return;
- }
- LLChat chat;
- std::string mesg;
- std::string from_name;
- U8 source_temp;
- U8 type_temp;
- U8 audible_temp;
- LLColor4 color(1.0f, 1.0f, 1.0f, 1.0f);
- LLUUID from_id;
- LLUUID owner_id;
- LLViewerObject* chatter;
-
- msg->getString("ChatData", "FromName", from_name);
-
- msg->getUUID("ChatData", "SourceID", from_id);
- chat.mFromID = from_id;
-
- // Object owner for objects
- msg->getUUID("ChatData", "OwnerID", owner_id);
-
- msg->getU8Fast(_PREHASH_ChatData, _PREHASH_SourceType, source_temp);
- chat.mSourceType = (EChatSourceType)source_temp;
-
- msg->getU8("ChatData", "ChatType", type_temp);
- chat.mChatType = (EChatType)type_temp;
-
- msg->getU8Fast(_PREHASH_ChatData, _PREHASH_Audible, audible_temp);
- chat.mAudible = (EChatAudible)audible_temp;
-
- chat.mTime = LLFrameTimer::getElapsedSeconds();
-
- // IDEVO Correct for new-style "Resident" names
- if (chat.mSourceType == CHAT_SOURCE_AGENT)
- {
- // I don't know if it's OK to change this here, if
- // anything downstream does lookups by name, for instance
-
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(from_id, &av_name))
- {
- chat.mFromName = av_name.getCompleteName();
- }
- else
- {
- chat.mFromName = LLCacheName::cleanFullName(from_name);
- }
- }
- else
- {
- // make sure that we don't have an empty or all-whitespace name
- LLStringUtil::trim(from_name);
- if (from_name.empty())
- {
- from_name = LLTrans::getString("Unnamed");
- }
- chat.mFromName = from_name;
- }
-
- BOOL is_do_not_disturb = gAgent.isDoNotDisturb();
-
- BOOL is_muted = FALSE;
- BOOL is_linden = FALSE;
- is_muted = LLMuteList::getInstance()->isMuted(
- from_id,
- from_name,
- LLMute::flagTextChat)
- || LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagTextChat);
- is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT &&
- LLMuteList::isLinden(from_name);
-
- if (is_muted && (chat.mSourceType == CHAT_SOURCE_OBJECT))
- {
- return;
- }
-
- BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible);
- chatter = gObjectList.findObject(from_id);
- if (chatter)
- {
- chat.mPosAgent = chatter->getPositionAgent();
-
- // Make swirly things only for talking objects. (not script debug messages, though)
- if (chat.mSourceType == CHAT_SOURCE_OBJECT
- && chat.mChatType != CHAT_TYPE_DEBUG_MSG
- && gSavedSettings.getBOOL("EffectScriptChatParticles") )
- {
- LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent());
- psc->setSourceObject(chatter);
- psc->setColor(color);
- //We set the particles to be owned by the object's owner,
- //just in case they should be muted by the mute list
- psc->setOwnerUUID(owner_id);
- LLViewerPartSim::getInstance()->addPartSource(psc);
- }
-
- // record last audible utterance
- if (is_audible
- && (is_linden || (!is_muted && !is_do_not_disturb)))
- {
- if (chat.mChatType != CHAT_TYPE_START
- && chat.mChatType != CHAT_TYPE_STOP)
- {
- gAgent.heardChat(chat.mFromID);
- }
- }
- }
-
- if (is_audible)
- {
- //BOOL visible_in_chat_bubble = FALSE;
-
- color.setVec(1.f,1.f,1.f,1.f);
- msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg);
-
- BOOL ircstyle = FALSE;
-
- // Look for IRC-style emotes here so chatbubbles work
- std::string prefix = mesg.substr(0, 4);
- if (prefix == "/me " || prefix == "/me'")
- {
- ircstyle = TRUE;
- }
- chat.mText = mesg;
-
- // Look for the start of typing so we can put "..." in the bubbles.
- if (CHAT_TYPE_START == chat.mChatType)
- {
- LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, TRUE);
-
- // Might not have the avatar constructed yet, eg on login.
- if (chatter && chatter->isAvatar())
- {
- ((LLVOAvatar*)chatter)->startTyping();
- }
- return;
- }
- else if (CHAT_TYPE_STOP == chat.mChatType)
- {
- LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
-
- // Might not have the avatar constructed yet, eg on login.
- if (chatter && chatter->isAvatar())
- {
- ((LLVOAvatar*)chatter)->stopTyping();
- }
- return;
- }
-
- // Look for IRC-style emotes
- if (ircstyle)
- {
- // set CHAT_STYLE_IRC to avoid adding Avatar Name as author of message. See EXT-656
- chat.mChatStyle = CHAT_STYLE_IRC;
-
- // Do nothing, ircstyle is fixed above for chat bubbles
- }
- else
- {
- chat.mText = "";
- switch(chat.mChatType)
- {
- case CHAT_TYPE_WHISPER:
- chat.mText = LLTrans::getString("whisper") + " ";
- break;
- case CHAT_TYPE_DEBUG_MSG:
- case CHAT_TYPE_OWNER:
- case CHAT_TYPE_NORMAL:
- case CHAT_TYPE_DIRECT:
- break;
- case CHAT_TYPE_SHOUT:
- chat.mText = LLTrans::getString("shout") + " ";
- break;
- case CHAT_TYPE_START:
- case CHAT_TYPE_STOP:
- LL_WARNS("Messaging") << "Got chat type start/stop in main chat processing." << LL_ENDL;
- break;
- default:
- LL_WARNS("Messaging") << "Unknown type " << chat.mChatType << " in chat!" << LL_ENDL;
- break;
- }
-
- chat.mText += mesg;
- }
-
- // We have a real utterance now, so can stop showing "..." and proceed.
- if (chatter && chatter->isAvatar())
- {
- LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
- ((LLVOAvatar*)chatter)->stopTyping();
-
- if (!is_muted && !is_do_not_disturb)
- {
- //visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles");
- std::string formated_msg = "";
- LLViewerChat::formatChatMsg(chat, formated_msg);
- LLChat chat_bubble = chat;
- chat_bubble.mText = formated_msg;
- ((LLVOAvatar*)chatter)->addChat(chat_bubble);
- }
- }
-
- if (chatter)
- {
- chat.mPosAgent = chatter->getPositionAgent();
- }
-
- // truth table:
- // LINDEN BUSY MUTED OWNED_BY_YOU TASK DISPLAY STORE IN HISTORY
- // F F F F * Yes Yes
- // F F F T * Yes Yes
- // F F T F * No No
- // F F T T * No No
- // F T F F * No Yes
- // F T F T * Yes Yes
- // F T T F * No No
- // F T T T * No No
- // T * * * F Yes Yes
-
- chat.mMuted = is_muted && !is_linden;
-
- // pass owner_id to chat so that we can display the remote
- // object inspect for an object that is chatting with you
- LLSD args;
- chat.mOwnerID = owner_id;
-
- LLTranslate::instance().logCharsSeen(mesg.size());
- if (gSavedSettings.getBOOL("TranslateChat") && chat.mSourceType != CHAT_SOURCE_SYSTEM)
- {
- if (chat.mChatStyle == CHAT_STYLE_IRC)
- {
- mesg = mesg.substr(4, std::string::npos);
- }
- const std::string from_lang = ""; // leave empty to trigger autodetect
- const std::string to_lang = LLTranslate::getTranslateLanguage();
-
- LLTranslate::instance().logCharsSent(mesg.size());
+ if (gNonInteractive)
+ {
+ return;
+ }
+ LLChat chat;
+ std::string mesg;
+ std::string from_name;
+ U8 source_temp;
+ U8 type_temp;
+ U8 audible_temp;
+ LLColor4 color(1.0f, 1.0f, 1.0f, 1.0f);
+ LLUUID from_id;
+ LLUUID owner_id;
+ LLViewerObject* chatter;
+
+ msg->getString("ChatData", "FromName", from_name);
+
+ msg->getUUID("ChatData", "SourceID", from_id);
+ chat.mFromID = from_id;
+
+ // Object owner for objects
+ msg->getUUID("ChatData", "OwnerID", owner_id);
+
+ msg->getU8Fast(_PREHASH_ChatData, _PREHASH_SourceType, source_temp);
+ chat.mSourceType = (EChatSourceType)source_temp;
+
+ msg->getU8("ChatData", "ChatType", type_temp);
+ chat.mChatType = (EChatType)type_temp;
+
+ msg->getU8Fast(_PREHASH_ChatData, _PREHASH_Audible, audible_temp);
+ chat.mAudible = (EChatAudible)audible_temp;
+
+ chat.mTime = LLFrameTimer::getElapsedSeconds();
+
+ // IDEVO Correct for new-style "Resident" names
+ if (chat.mSourceType == CHAT_SOURCE_AGENT)
+ {
+ // I don't know if it's OK to change this here, if
+ // anything downstream does lookups by name, for instance
+
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(from_id, &av_name))
+ {
+ chat.mFromName = av_name.getCompleteName();
+ }
+ else
+ {
+ chat.mFromName = LLCacheName::cleanFullName(from_name);
+ }
+ }
+ else
+ {
+ // make sure that we don't have an empty or all-whitespace name
+ LLStringUtil::trim(from_name);
+ if (from_name.empty())
+ {
+ from_name = LLTrans::getString("Unnamed");
+ }
+ chat.mFromName = from_name;
+ }
+
+ BOOL is_do_not_disturb = gAgent.isDoNotDisturb();
+
+ BOOL is_muted = FALSE;
+ BOOL is_linden = FALSE;
+ is_muted = LLMuteList::getInstance()->isMuted(
+ from_id,
+ from_name,
+ LLMute::flagTextChat)
+ || LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagTextChat);
+ is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT &&
+ LLMuteList::isLinden(from_name);
+
+ if (is_muted && (chat.mSourceType == CHAT_SOURCE_OBJECT))
+ {
+ return;
+ }
+
+ BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible);
+ chatter = gObjectList.findObject(from_id);
+ if (chatter)
+ {
+ chat.mPosAgent = chatter->getPositionAgent();
+
+ // Make swirly things only for talking objects. (not script debug messages, though)
+ if (chat.mSourceType == CHAT_SOURCE_OBJECT
+ && chat.mChatType != CHAT_TYPE_DEBUG_MSG
+ && gSavedSettings.getBOOL("EffectScriptChatParticles") )
+ {
+ LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent());
+ psc->setSourceObject(chatter);
+ psc->setColor(color);
+ //We set the particles to be owned by the object's owner,
+ //just in case they should be muted by the mute list
+ psc->setOwnerUUID(owner_id);
+ LLViewerPartSim::getInstance()->addPartSource(psc);
+ }
+
+ // record last audible utterance
+ if (is_audible
+ && (is_linden || (!is_muted && !is_do_not_disturb)))
+ {
+ if (chat.mChatType != CHAT_TYPE_START
+ && chat.mChatType != CHAT_TYPE_STOP)
+ {
+ gAgent.heardChat(chat.mFromID);
+ }
+ }
+ }
+
+ if (is_audible)
+ {
+ //BOOL visible_in_chat_bubble = FALSE;
+
+ color.setVec(1.f,1.f,1.f,1.f);
+ msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg);
+
+ BOOL ircstyle = FALSE;
+
+ // Look for IRC-style emotes here so chatbubbles work
+ std::string prefix = mesg.substr(0, 4);
+ if (prefix == "/me " || prefix == "/me'")
+ {
+ ircstyle = TRUE;
+ }
+ chat.mText = mesg;
+
+ // Look for the start of typing so we can put "..." in the bubbles.
+ if (CHAT_TYPE_START == chat.mChatType)
+ {
+ LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, TRUE);
+
+ // Might not have the avatar constructed yet, eg on login.
+ if (chatter && chatter->isAvatar())
+ {
+ ((LLVOAvatar*)chatter)->startTyping();
+ }
+ return;
+ }
+ else if (CHAT_TYPE_STOP == chat.mChatType)
+ {
+ LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
+
+ // Might not have the avatar constructed yet, eg on login.
+ if (chatter && chatter->isAvatar())
+ {
+ ((LLVOAvatar*)chatter)->stopTyping();
+ }
+ return;
+ }
+
+ // Look for IRC-style emotes
+ if (ircstyle)
+ {
+ // set CHAT_STYLE_IRC to avoid adding Avatar Name as author of message. See EXT-656
+ chat.mChatStyle = CHAT_STYLE_IRC;
+
+ // Do nothing, ircstyle is fixed above for chat bubbles
+ }
+ else
+ {
+ chat.mText = "";
+ switch(chat.mChatType)
+ {
+ case CHAT_TYPE_WHISPER:
+ chat.mText = LLTrans::getString("whisper") + " ";
+ break;
+ case CHAT_TYPE_DEBUG_MSG:
+ case CHAT_TYPE_OWNER:
+ case CHAT_TYPE_NORMAL:
+ case CHAT_TYPE_DIRECT:
+ break;
+ case CHAT_TYPE_SHOUT:
+ chat.mText = LLTrans::getString("shout") + " ";
+ break;
+ case CHAT_TYPE_START:
+ case CHAT_TYPE_STOP:
+ LL_WARNS("Messaging") << "Got chat type start/stop in main chat processing." << LL_ENDL;
+ break;
+ default:
+ LL_WARNS("Messaging") << "Unknown type " << chat.mChatType << " in chat!" << LL_ENDL;
+ break;
+ }
+
+ chat.mText += mesg;
+ }
+
+ // We have a real utterance now, so can stop showing "..." and proceed.
+ if (chatter && chatter->isAvatar())
+ {
+ LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
+ ((LLVOAvatar*)chatter)->stopTyping();
+
+ if (!is_muted && !is_do_not_disturb)
+ {
+ //visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles");
+ std::string formated_msg = "";
+ LLViewerChat::formatChatMsg(chat, formated_msg);
+ LLChat chat_bubble = chat;
+ chat_bubble.mText = formated_msg;
+ ((LLVOAvatar*)chatter)->addChat(chat_bubble);
+ }
+ }
+
+ if (chatter)
+ {
+ chat.mPosAgent = chatter->getPositionAgent();
+ }
+
+ // truth table:
+ // LINDEN BUSY MUTED OWNED_BY_YOU TASK DISPLAY STORE IN HISTORY
+ // F F F F * Yes Yes
+ // F F F T * Yes Yes
+ // F F T F * No No
+ // F F T T * No No
+ // F T F F * No Yes
+ // F T F T * Yes Yes
+ // F T T F * No No
+ // F T T T * No No
+ // T * * * F Yes Yes
+
+ chat.mMuted = is_muted && !is_linden;
+
+ // pass owner_id to chat so that we can display the remote
+ // object inspect for an object that is chatting with you
+ LLSD args;
+ chat.mOwnerID = owner_id;
+
+ LLTranslate::instance().logCharsSeen(mesg.size());
+ if (gSavedSettings.getBOOL("TranslateChat") && chat.mSourceType != CHAT_SOURCE_SYSTEM)
+ {
+ if (chat.mChatStyle == CHAT_STYLE_IRC)
+ {
+ mesg = mesg.substr(4, std::string::npos);
+ }
+ const std::string from_lang = ""; // leave empty to trigger autodetect
+ const std::string to_lang = LLTranslate::getTranslateLanguage();
+
+ LLTranslate::instance().logCharsSent(mesg.size());
LLTranslate::translateMessage(from_lang, to_lang, mesg,
boost::bind(&translateSuccess, chat, args, mesg, from_lang, _1, _2),
boost::bind(&translateFailure, chat, args, _1, _2));
- }
- else
- {
- LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
- }
+ }
+ else
+ {
+ LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
+ }
- // don't call notification for debug messages from not owned objects
- if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
- {
- if (gAgentID != chat.mOwnerID)
- {
- return;
- }
- }
+ // don't call notification for debug messages from not owned objects
+ if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
+ {
+ if (gAgentID != chat.mOwnerID)
+ {
+ return;
+ }
+ }
- if (mesg != "")
- {
- LLSD msg_notify = LLSD(LLSD::emptyMap());
- msg_notify["session_id"] = LLUUID();
- msg_notify["from_id"] = chat.mFromID;
- msg_notify["source_type"] = chat.mSourceType;
- on_new_message(msg_notify);
- }
+ if (mesg != "")
+ {
+ LLSD msg_notify = LLSD(LLSD::emptyMap());
+ msg_notify["session_id"] = LLUUID();
+ msg_notify["from_id"] = chat.mFromID;
+ msg_notify["source_type"] = chat.mSourceType;
+ on_new_message(msg_notify);
+ }
- }
+ }
}
// Simulator we're on is informing the viewer that the agent
-// is starting to teleport (perhaps to another sim, perhaps to the
-// same sim). If we initiated the teleport process by sending some kind
-// of TeleportRequest, then this info is redundant, but if the sim
-// initiated the teleport (via a script call, being killed, etc.)
+// is starting to teleport (perhaps to another sim, perhaps to the
+// same sim). If we initiated the teleport process by sending some kind
+// of TeleportRequest, then this info is redundant, but if the sim
+// initiated the teleport (via a script call, being killed, etc.)
// then this info is news to us.
void process_teleport_start(LLMessageSystem *msg, void**)
{
- // on teleport, don't tell them about destination guide anymore
- LLFirstUse::notUsingDestinationGuide(false);
- U32 teleport_flags = 0x0;
- msg->getU32("Info", "TeleportFlags", teleport_flags);
+ // on teleport, don't tell them about destination guide anymore
+ LLFirstUse::notUsingDestinationGuide(false);
+ U32 teleport_flags = 0x0;
+ msg->getU32("Info", "TeleportFlags", teleport_flags);
- if (gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING)
- {
- // Race condition?
- LL_WARNS("Messaging") << "Got TeleportStart, but teleport already in progress. TeleportFlags=" << teleport_flags << LL_ENDL;
- }
+ if (gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING)
+ {
+ // Race condition?
+ LL_WARNS("Messaging") << "Got TeleportStart, but teleport already in progress. TeleportFlags=" << teleport_flags << LL_ENDL;
+ }
- LL_DEBUGS("Messaging") << "Got TeleportStart with TeleportFlags=" << teleport_flags << ". gTeleportDisplay: " << gTeleportDisplay << ", gAgent.mTeleportState: " << gAgent.getTeleportState() << LL_ENDL;
+ LL_DEBUGS("Messaging") << "Got TeleportStart with TeleportFlags=" << teleport_flags << ". gTeleportDisplay: " << gTeleportDisplay << ", gAgent.mTeleportState: " << gAgent.getTeleportState() << LL_ENDL;
- // *NOTE: The server sends two StartTeleport packets when you are teleporting to a LM
- LLViewerMessage::getInstance()->mTeleportStartedSignal();
+ // *NOTE: The server sends two StartTeleport packets when you are teleporting to a LM
+ LLViewerMessage::getInstance()->mTeleportStartedSignal();
- if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
- {
- gViewerWindow->setProgressCancelButtonVisible(FALSE);
- }
- else
- {
- gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel"));
- }
+ if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
+ {
+ gViewerWindow->setProgressCancelButtonVisible(FALSE);
+ }
+ else
+ {
+ gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel"));
+ }
- // Freeze the UI and show progress bar
- // Note: could add data here to differentiate between normal teleport and death.
+ // Freeze the UI and show progress bar
+ // Note: could add data here to differentiate between normal teleport and death.
- if( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
- {
- gTeleportDisplay = TRUE;
- gAgent.setTeleportState( LLAgent::TELEPORT_START );
- make_ui_sound("UISndTeleportOut");
-
- LL_INFOS("Messaging") << "Teleport initiated by remote TeleportStart message with TeleportFlags: " << teleport_flags << LL_ENDL;
+ if( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
+ {
+ gTeleportDisplay = TRUE;
+ gAgent.setTeleportState( LLAgent::TELEPORT_START );
+ make_ui_sound("UISndTeleportOut");
+
+ LL_INFOS("Messaging") << "Teleport initiated by remote TeleportStart message with TeleportFlags: " << teleport_flags << LL_ENDL;
- // Don't call LLFirstUse::useTeleport here because this could be
- // due to being killed, which would send you home, not to a Telehub
- }
+ // Don't call LLFirstUse::useTeleport here because this could be
+ // due to being killed, which would send you home, not to a Telehub
+ }
}
boost::signals2::connection LLViewerMessage::setTeleportStartedCallback(teleport_started_callback_t cb)
{
- return mTeleportStartedSignal.connect(cb);
+ return mTeleportStartedSignal.connect(cb);
}
void process_teleport_progress(LLMessageSystem* msg, void**)
{
- LLUUID agent_id;
- msg->getUUID("AgentData", "AgentID", agent_id);
- if((gAgent.getID() != agent_id)
- || (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE))
- {
- LL_WARNS("Messaging") << "Unexpected teleport progress message." << LL_ENDL;
- return;
- }
- U32 teleport_flags = 0x0;
- msg->getU32("Info", "TeleportFlags", teleport_flags);
- if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
- {
- gViewerWindow->setProgressCancelButtonVisible(FALSE);
- }
- else
- {
- gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel"));
- }
- std::string buffer;
- msg->getString("Info", "Message", buffer);
- LL_DEBUGS("Messaging") << "teleport progress: " << buffer << " flags: " << teleport_flags << LL_ENDL;
-
- //Sorta hacky...default to using simulator raw messages
- //if we don't find the coresponding mapping in our progress mappings
- std::string message = buffer;
-
- if (LLAgent::sTeleportProgressMessages.find(buffer) !=
- LLAgent::sTeleportProgressMessages.end() )
- {
- message = LLAgent::sTeleportProgressMessages[buffer];
- }
-
- gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages[message]);
+ LLUUID agent_id;
+ msg->getUUID("AgentData", "AgentID", agent_id);
+ if((gAgent.getID() != agent_id)
+ || (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE))
+ {
+ LL_WARNS("Messaging") << "Unexpected teleport progress message." << LL_ENDL;
+ return;
+ }
+ U32 teleport_flags = 0x0;
+ msg->getU32("Info", "TeleportFlags", teleport_flags);
+ if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
+ {
+ gViewerWindow->setProgressCancelButtonVisible(FALSE);
+ }
+ else
+ {
+ gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel"));
+ }
+ std::string buffer;
+ msg->getString("Info", "Message", buffer);
+ LL_DEBUGS("Messaging") << "teleport progress: " << buffer << " flags: " << teleport_flags << LL_ENDL;
+
+ //Sorta hacky...default to using simulator raw messages
+ //if we don't find the coresponding mapping in our progress mappings
+ std::string message = buffer;
+
+ if (LLAgent::sTeleportProgressMessages.find(buffer) !=
+ LLAgent::sTeleportProgressMessages.end() )
+ {
+ message = LLAgent::sTeleportProgressMessages[buffer];
+ }
+
+ gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages[message]);
}
class LLFetchInWelcomeArea : public LLInventoryFetchDescendentsObserver
{
public:
- LLFetchInWelcomeArea(const uuid_vec_t &ids) :
- LLInventoryFetchDescendentsObserver(ids)
- {}
- virtual void done()
- {
- LLIsType is_landmark(LLAssetType::AT_LANDMARK);
- LLIsType is_card(LLAssetType::AT_CALLINGCARD);
-
- LLInventoryModel::cat_array_t card_cats;
- LLInventoryModel::item_array_t card_items;
- LLInventoryModel::cat_array_t land_cats;
- LLInventoryModel::item_array_t land_items;
-
- uuid_vec_t::iterator it = mComplete.begin();
- uuid_vec_t::iterator end = mComplete.end();
- for(; it != end; ++it)
- {
- gInventory.collectDescendentsIf(
- (*it),
- land_cats,
- land_items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_landmark);
- gInventory.collectDescendentsIf(
- (*it),
- card_cats,
- card_items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_card);
- }
-
- gInventory.removeObserver(this);
- delete this;
- }
+ LLFetchInWelcomeArea(const uuid_vec_t &ids) :
+ LLInventoryFetchDescendentsObserver(ids)
+ {}
+ virtual void done()
+ {
+ LLIsType is_landmark(LLAssetType::AT_LANDMARK);
+ LLIsType is_card(LLAssetType::AT_CALLINGCARD);
+
+ LLInventoryModel::cat_array_t card_cats;
+ LLInventoryModel::item_array_t card_items;
+ LLInventoryModel::cat_array_t land_cats;
+ LLInventoryModel::item_array_t land_items;
+
+ uuid_vec_t::iterator it = mComplete.begin();
+ uuid_vec_t::iterator end = mComplete.end();
+ for(; it != end; ++it)
+ {
+ gInventory.collectDescendentsIf(
+ (*it),
+ land_cats,
+ land_items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_landmark);
+ gInventory.collectDescendentsIf(
+ (*it),
+ card_cats,
+ card_items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_card);
+ }
+
+ gInventory.removeObserver(this);
+ delete this;
+ }
};
-class LLPostTeleportNotifiers : public LLEventTimer
+class LLPostTeleportNotifiers : public LLEventTimer
{
public:
- LLPostTeleportNotifiers();
- virtual ~LLPostTeleportNotifiers();
+ LLPostTeleportNotifiers();
+ virtual ~LLPostTeleportNotifiers();
- //function to be called at the supplied frequency
- virtual BOOL tick();
+ //function to be called at the supplied frequency
+ virtual BOOL tick();
};
LLPostTeleportNotifiers::LLPostTeleportNotifiers() : LLEventTimer( 2.0 )
@@ -2903,34 +2903,34 @@ LLPostTeleportNotifiers::~LLPostTeleportNotifiers()
BOOL LLPostTeleportNotifiers::tick()
{
- BOOL all_done = FALSE;
- if ( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
- {
- // get callingcards and landmarks available to the user arriving.
- uuid_vec_t folders;
- const LLUUID callingcard_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
- if(callingcard_id.notNull())
- folders.push_back(callingcard_id);
- const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
- if(folder_id.notNull())
- folders.push_back(folder_id);
- if(!folders.empty())
- {
- LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea(folders);
- fetcher->startFetch();
- if(fetcher->isFinished())
- {
- fetcher->done();
- }
- else
- {
- gInventory.addObserver(fetcher);
- }
- }
- all_done = TRUE;
- }
-
- return all_done;
+ BOOL all_done = FALSE;
+ if ( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
+ {
+ // get callingcards and landmarks available to the user arriving.
+ uuid_vec_t folders;
+ const LLUUID callingcard_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
+ if(callingcard_id.notNull())
+ folders.push_back(callingcard_id);
+ const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ if(folder_id.notNull())
+ folders.push_back(folder_id);
+ if(!folders.empty())
+ {
+ LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea(folders);
+ fetcher->startFetch();
+ if(fetcher->isFinished())
+ {
+ fetcher->done();
+ }
+ else
+ {
+ gInventory.addObserver(fetcher);
+ }
+ }
+ all_done = TRUE;
+ }
+
+ return all_done;
}
@@ -2939,14 +2939,14 @@ BOOL LLPostTeleportNotifiers::tick()
// We're going to pretend to be a new agent
void process_teleport_finish(LLMessageSystem* msg, void**)
{
- LL_DEBUGS("Teleport","Messaging") << "Received TeleportFinish message" << LL_ENDL;
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id);
- if (agent_id != gAgent.getID())
- {
- LL_WARNS("Teleport","Messaging") << "Got teleport notification for wrong agent " << agent_id << " expected " << gAgent.getID() << ", ignoring!" << LL_ENDL;
- return;
- }
+ LL_DEBUGS("Teleport","Messaging") << "Received TeleportFinish message" << LL_ENDL;
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id);
+ if (agent_id != gAgent.getID())
+ {
+ LL_WARNS("Teleport","Messaging") << "Got teleport notification for wrong agent " << agent_id << " expected " << gAgent.getID() << ", ignoring!" << LL_ENDL;
+ return;
+ }
if (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE)
{
@@ -2954,7 +2954,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
{
// Server either ignored teleport cancel message or did not receive it in time.
// This message can't be ignored since teleport is complete at server side
- LL_INFOS("Teleport") << "Restoring canceled teleport request" << LL_ENDL;
+ LL_INFOS("Teleport") << "Restoring canceled teleport request" << LL_ENDL;
gAgent.restoreCanceledTeleportRequest();
}
else
@@ -2971,348 +2971,348 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
{
LL_WARNS("Teleport","Messaging") << "Teleport message in the middle of other teleport" << LL_ENDL;
}
-
- // Teleport is finished; it can't be cancelled now.
- gViewerWindow->setProgressCancelButtonVisible(FALSE);
-
- // Do teleport effect for where you're leaving
- // VEFFECT: TeleportStart
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
- effectp->setPositionGlobal(gAgent.getPositionGlobal());
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- LLHUDManager::getInstance()->sendEffects();
-
- U32 location_id;
- U32 sim_ip;
- U16 sim_port;
- LLVector3 pos, look_at;
- U64 region_handle;
- msg->getU32Fast(_PREHASH_Info, _PREHASH_LocationID, location_id);
- msg->getIPAddrFast(_PREHASH_Info, _PREHASH_SimIP, sim_ip);
- msg->getIPPortFast(_PREHASH_Info, _PREHASH_SimPort, sim_port);
- //msg->getVector3Fast(_PREHASH_Info, _PREHASH_Position, pos);
- //msg->getVector3Fast(_PREHASH_Info, _PREHASH_LookAt, look_at);
- msg->getU64Fast(_PREHASH_Info, _PREHASH_RegionHandle, region_handle);
- U32 teleport_flags;
- msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags);
-
- std::string seedCap;
- msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, seedCap);
-
- LL_DEBUGS("Teleport") << "TeleportFinish message params are:"
- << " sim_ip " << sim_ip
- << " sim_port " << sim_port
- << " region_handle " << region_handle
- << " teleport_flags " << teleport_flags
- << " seedCap " << seedCap
- << LL_ENDL;
-
- // update home location if we are teleporting out of prelude - specific to teleporting to welcome area
- if((teleport_flags & TELEPORT_FLAGS_SET_HOME_TO_TARGET)
- && (!gAgent.isGodlike()))
- {
- gAgent.setHomePosRegion(region_handle, pos);
-
- // Create a timer that will send notices when teleporting is all finished. Since this is
- // based on the LLEventTimer class, it will be managed by that class and not orphaned or leaked.
- new LLPostTeleportNotifiers();
- }
-
- LLHost sim_host(sim_ip, sim_port);
-
- // Viewer trusts the simulator.
- gMessageSystem->enableCircuit(sim_host, TRUE);
- LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host);
+
+ // Teleport is finished; it can't be cancelled now.
+ gViewerWindow->setProgressCancelButtonVisible(FALSE);
+
+ // Do teleport effect for where you're leaving
+ // VEFFECT: TeleportStart
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
+ effectp->setPositionGlobal(gAgent.getPositionGlobal());
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ LLHUDManager::getInstance()->sendEffects();
+
+ U32 location_id;
+ U32 sim_ip;
+ U16 sim_port;
+ LLVector3 pos, look_at;
+ U64 region_handle;
+ msg->getU32Fast(_PREHASH_Info, _PREHASH_LocationID, location_id);
+ msg->getIPAddrFast(_PREHASH_Info, _PREHASH_SimIP, sim_ip);
+ msg->getIPPortFast(_PREHASH_Info, _PREHASH_SimPort, sim_port);
+ //msg->getVector3Fast(_PREHASH_Info, _PREHASH_Position, pos);
+ //msg->getVector3Fast(_PREHASH_Info, _PREHASH_LookAt, look_at);
+ msg->getU64Fast(_PREHASH_Info, _PREHASH_RegionHandle, region_handle);
+ U32 teleport_flags;
+ msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags);
+
+ std::string seedCap;
+ msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, seedCap);
+
+ LL_DEBUGS("Teleport") << "TeleportFinish message params are:"
+ << " sim_ip " << sim_ip
+ << " sim_port " << sim_port
+ << " region_handle " << region_handle
+ << " teleport_flags " << teleport_flags
+ << " seedCap " << seedCap
+ << LL_ENDL;
+
+ // update home location if we are teleporting out of prelude - specific to teleporting to welcome area
+ if((teleport_flags & TELEPORT_FLAGS_SET_HOME_TO_TARGET)
+ && (!gAgent.isGodlike()))
+ {
+ gAgent.setHomePosRegion(region_handle, pos);
+
+ // Create a timer that will send notices when teleporting is all finished. Since this is
+ // based on the LLEventTimer class, it will be managed by that class and not orphaned or leaked.
+ new LLPostTeleportNotifiers();
+ }
+
+ LLHost sim_host(sim_ip, sim_port);
+
+ // Viewer trusts the simulator.
+ gMessageSystem->enableCircuit(sim_host, TRUE);
+ LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host);
/*
- // send camera update to new region
- gAgentCamera.updateCamera();
-
- // likewise make sure the camera is behind the avatar
- gAgentCamera.resetView(TRUE);
- LLVector3 shift_vector = regionp->getPosRegionFromGlobal(gAgent.getRegion()->getOriginGlobal());
- gAgent.setRegion(regionp);
- gObjectList.shiftObjects(shift_vector);
-
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->clearChatText();
- gAgentCamera.slamLookAt(look_at);
- }
- gAgent.setPositionAgent(pos);
- gAssetStorage->setUpstream(sim);
- gCacheName->setUpstream(sim);
+ // send camera update to new region
+ gAgentCamera.updateCamera();
+
+ // likewise make sure the camera is behind the avatar
+ gAgentCamera.resetView(TRUE);
+ LLVector3 shift_vector = regionp->getPosRegionFromGlobal(gAgent.getRegion()->getOriginGlobal());
+ gAgent.setRegion(regionp);
+ gObjectList.shiftObjects(shift_vector);
+
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->clearChatText();
+ gAgentCamera.slamLookAt(look_at);
+ }
+ gAgent.setPositionAgent(pos);
+ gAssetStorage->setUpstream(sim);
+ gCacheName->setUpstream(sim);
*/
- // Make sure we're standing
- gAgent.standUp();
+ // Make sure we're standing
+ gAgent.standUp();
- // now, use the circuit info to tell simulator about us!
- LL_INFOS("Teleport","Messaging") << "process_teleport_finish() sending UseCircuitCode to enable sim_host "
- << sim_host << " with code " << msg->mOurCircuitCode << LL_ENDL;
- msg->newMessageFast(_PREHASH_UseCircuitCode);
- msg->nextBlockFast(_PREHASH_CircuitCode);
- msg->addU32Fast(_PREHASH_Code, msg->getOurCircuitCode());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_ID, gAgent.getID());
- msg->sendReliable(sim_host);
+ // now, use the circuit info to tell simulator about us!
+ LL_INFOS("Teleport","Messaging") << "process_teleport_finish() sending UseCircuitCode to enable sim_host "
+ << sim_host << " with code " << msg->mOurCircuitCode << LL_ENDL;
+ msg->newMessageFast(_PREHASH_UseCircuitCode);
+ msg->nextBlockFast(_PREHASH_CircuitCode);
+ msg->addU32Fast(_PREHASH_Code, msg->getOurCircuitCode());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_ID, gAgent.getID());
+ msg->sendReliable(sim_host);
- LL_INFOS("Teleport") << "Calling send_complete_agent_movement() and setting state to TELEPORT_MOVING" << LL_ENDL;
- send_complete_agent_movement(sim_host);
- gAgent.setTeleportState( LLAgent::TELEPORT_MOVING );
- gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["contacting"]);
+ LL_INFOS("Teleport") << "Calling send_complete_agent_movement() and setting state to TELEPORT_MOVING" << LL_ENDL;
+ send_complete_agent_movement(sim_host);
+ gAgent.setTeleportState( LLAgent::TELEPORT_MOVING );
+ gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["contacting"]);
- LL_DEBUGS("CrossingCaps") << "Calling setSeedCapability(). Seed cap == "
- << seedCap << LL_ENDL;
- regionp->setSeedCapability(seedCap);
+ LL_DEBUGS("CrossingCaps") << "Calling setSeedCapability(). Seed cap == "
+ << seedCap << LL_ENDL;
+ regionp->setSeedCapability(seedCap);
- // Don't send camera updates to the new region until we're
- // actually there...
+ // Don't send camera updates to the new region until we're
+ // actually there...
- // Now do teleport effect for where you're going.
- // VEFFECT: TeleportEnd
- effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
- effectp->setPositionGlobal(gAgent.getPositionGlobal());
+ // Now do teleport effect for where you're going.
+ // VEFFECT: TeleportEnd
+ effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
+ effectp->setPositionGlobal(gAgent.getPositionGlobal());
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- LLHUDManager::getInstance()->sendEffects();
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ LLHUDManager::getInstance()->sendEffects();
-// gTeleportDisplay = TRUE;
-// gTeleportDisplayTimer.reset();
-// gViewerWindow->setShowProgress(TRUE);
+// gTeleportDisplay = TRUE;
+// gTeleportDisplayTimer.reset();
+// gViewerWindow->setShowProgress(TRUE);
}
// stuff we have to do every time we get an AvatarInitComplete from a sim
/*
void process_avatar_init_complete(LLMessageSystem* msg, void**)
{
- LLVector3 agent_pos;
- msg->getVector3Fast(_PREHASH_AvatarData, _PREHASH_Position, agent_pos);
- agent_movement_complete(msg->getSender(), agent_pos);
+ LLVector3 agent_pos;
+ msg->getVector3Fast(_PREHASH_AvatarData, _PREHASH_Position, agent_pos);
+ agent_movement_complete(msg->getSender(), agent_pos);
}
*/
void process_agent_movement_complete(LLMessageSystem* msg, void**)
{
- LL_INFOS("Teleport","Messaging") << "Received ProcessAgentMovementComplete" << LL_ENDL;
-
- gShiftFrame = true;
- gAgentMovementCompleted = true;
-
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- LLUUID session_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
- if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id))
- {
- LL_WARNS("Teleport", "Messaging") << "Incorrect agent or session id in process_agent_movement_complete()"
- << " agent " << agent_id << " expected " << gAgent.getID()
- << " session " << session_id << " expected " << gAgent.getSessionID()
- << ", ignoring" << LL_ENDL;
- return;
- }
-
- // *TODO: check timestamp to make sure the movement compleation
- // makes sense.
- LLVector3 agent_pos;
- msg->getVector3Fast(_PREHASH_Data, _PREHASH_Position, agent_pos);
- LLVector3 look_at;
- msg->getVector3Fast(_PREHASH_Data, _PREHASH_LookAt, look_at);
- U64 region_handle;
- msg->getU64Fast(_PREHASH_Data, _PREHASH_RegionHandle, region_handle);
-
- std::string version_channel;
- msg->getString("SimData", "ChannelVersion", version_channel);
-
- if (!isAgentAvatarValid())
- {
- // Could happen if you were immediately god-teleported away on login,
- // maybe other cases. Continue, but warn.
- LL_WARNS("Teleport", "Messaging") << "agent_movement_complete() with NULL avatarp." << LL_ENDL;
- }
-
- F32 x, y;
- from_region_handle(region_handle, &x, &y);
- LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
- if (!regionp)
- {
- if (gAgent.getRegion())
- {
- LL_WARNS("Teleport", "Messaging") << "current region origin "
- << gAgent.getRegion()->getOriginGlobal() << " id " << gAgent.getRegion()->getRegionID() << LL_ENDL;
- }
-
- LL_WARNS("Teleport", "Messaging") << "Agent being sent to invalid home region: "
- << x << ":" << y
- << " current pos " << gAgent.getPositionGlobal()
- << ", calling forceDisconnect()"
- << LL_ENDL;
- LLAppViewer::instance()->forceDisconnect(LLTrans::getString("SentToInvalidRegion"));
- return;
-
- }
-
- LL_INFOS("Teleport","Messaging") << "Changing home region to region id " << regionp->getRegionID() << " handle " << region_handle << " == x,y " << x << "," << y << LL_ENDL;
-
- // set our upstream host the new simulator and shuffle things as
- // appropriate.
- LLVector3 shift_vector = regionp->getPosRegionFromGlobal(
- gAgent.getRegion()->getOriginGlobal());
- gAgent.setRegion(regionp);
- gObjectList.shiftObjects(shift_vector);
- gAssetStorage->setUpstream(msg->getSender());
- gCacheName->setUpstream(msg->getSender());
- gViewerThrottle.sendToSim();
- gViewerWindow->sendShapeToSim();
-
- bool is_teleport = gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING;
-
- if( is_teleport )
- {
- if (gAgent.getTeleportKeepsLookAt())
- {
- // *NOTE: the LookAt data we get from the sim here doesn't
- // seem to be useful, so get it from the camera instead
- look_at = LLViewerCamera::getInstance()->getAtAxis();
- }
- // Force the camera back onto the agent, don't animate.
- gAgentCamera.setFocusOnAvatar(TRUE, FALSE);
- gAgentCamera.slamLookAt(look_at);
- gAgentCamera.updateCamera();
-
- LL_INFOS("Teleport") << "Agent movement complete, setting state to TELEPORT_START_ARRIVAL" << LL_ENDL;
- gAgent.setTeleportState( LLAgent::TELEPORT_START_ARRIVAL );
-
- if (isAgentAvatarValid())
- {
- // Set the new position
- gAgentAvatarp->setPositionAgent(agent_pos);
- gAgentAvatarp->clearChat();
- gAgentAvatarp->slamPosition();
- }
- }
- else
- {
- // This is initial log-in or a region crossing
- LL_INFOS("Teleport") << "State is not TELEPORT_MOVING, so this is initial log-in or region crossing. "
- << "Setting state to TELEPORT_NONE" << LL_ENDL;
- gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
-
- if(LLStartUp::getStartupState() < STATE_STARTED)
- { // This is initial log-in, not a region crossing:
- // Set the camera looking ahead of the AV so send_agent_update() below
- // will report the correct location to the server.
- LLVector3 look_at_point = look_at;
- look_at_point = agent_pos + look_at_point.rotVec(gAgent.getQuat());
-
- static LLVector3 up_direction(0.0f, 0.0f, 1.0f);
- LLViewerCamera::getInstance()->lookAt(agent_pos, look_at_point, up_direction);
- }
- }
-
- if ( LLTracker::isTracking(NULL) )
- {
- // Check distance to beacon, if < 5m, remove beacon
- LLVector3d beacon_pos = LLTracker::getTrackedPositionGlobal();
- LLVector3 beacon_dir(agent_pos.mV[VX] - (F32)fmod(beacon_pos.mdV[VX], 256.0), agent_pos.mV[VY] - (F32)fmod(beacon_pos.mdV[VY], 256.0), 0);
- if (beacon_dir.magVecSquared() < 25.f)
- {
- LLTracker::stopTracking(false);
- }
- else if ( is_teleport && !gAgent.getTeleportKeepsLookAt() && look_at.isExactlyZero())
- {
- //look at the beacon
- LLVector3 global_agent_pos = agent_pos;
- global_agent_pos[0] += x;
- global_agent_pos[1] += y;
- look_at = (LLVector3)beacon_pos - global_agent_pos;
- look_at.normVec();
- gAgentCamera.slamLookAt(look_at);
- }
- }
-
- // TODO: Put back a check for flying status! DK 12/19/05
- // Sim tells us whether the new position is off the ground
- /*
- if (teleport_flags & TELEPORT_FLAGS_IS_FLYING)
- {
- gAgent.setFlying(TRUE);
- }
- else
- {
- gAgent.setFlying(FALSE);
- }
- */
-
- send_agent_update(TRUE, TRUE);
-
- if (gAgent.getRegion()->getBlockFly())
- {
- gAgent.setFlying(gAgent.canFly());
- }
-
- // force simulator to recognize do not disturb state
- if (gAgent.isDoNotDisturb())
- {
- gAgent.setDoNotDisturb(true);
- }
- else
- {
- gAgent.setDoNotDisturb(false);
- }
-
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->mFootPlane.clearVec();
- }
-
- // send walk-vs-run status
- gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun());
-
- // If the server version has changed, display an info box and offer
- // to display the release notes, unless this is the initial log in.
- if (gLastVersionChannel == version_channel)
- {
- return;
- }
-
- gLastVersionChannel = version_channel;
+ LL_INFOS("Teleport","Messaging") << "Received ProcessAgentMovementComplete" << LL_ENDL;
+
+ gShiftFrame = true;
+ gAgentMovementCompleted = true;
+
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ LLUUID session_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
+ if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id))
+ {
+ LL_WARNS("Teleport", "Messaging") << "Incorrect agent or session id in process_agent_movement_complete()"
+ << " agent " << agent_id << " expected " << gAgent.getID()
+ << " session " << session_id << " expected " << gAgent.getSessionID()
+ << ", ignoring" << LL_ENDL;
+ return;
+ }
+
+ // *TODO: check timestamp to make sure the movement compleation
+ // makes sense.
+ LLVector3 agent_pos;
+ msg->getVector3Fast(_PREHASH_Data, _PREHASH_Position, agent_pos);
+ LLVector3 look_at;
+ msg->getVector3Fast(_PREHASH_Data, _PREHASH_LookAt, look_at);
+ U64 region_handle;
+ msg->getU64Fast(_PREHASH_Data, _PREHASH_RegionHandle, region_handle);
+
+ std::string version_channel;
+ msg->getString("SimData", "ChannelVersion", version_channel);
+
+ if (!isAgentAvatarValid())
+ {
+ // Could happen if you were immediately god-teleported away on login,
+ // maybe other cases. Continue, but warn.
+ LL_WARNS("Teleport", "Messaging") << "agent_movement_complete() with NULL avatarp." << LL_ENDL;
+ }
+
+ F32 x, y;
+ from_region_handle(region_handle, &x, &y);
+ LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
+ if (!regionp)
+ {
+ if (gAgent.getRegion())
+ {
+ LL_WARNS("Teleport", "Messaging") << "current region origin "
+ << gAgent.getRegion()->getOriginGlobal() << " id " << gAgent.getRegion()->getRegionID() << LL_ENDL;
+ }
+
+ LL_WARNS("Teleport", "Messaging") << "Agent being sent to invalid home region: "
+ << x << ":" << y
+ << " current pos " << gAgent.getPositionGlobal()
+ << ", calling forceDisconnect()"
+ << LL_ENDL;
+ LLAppViewer::instance()->forceDisconnect(LLTrans::getString("SentToInvalidRegion"));
+ return;
+
+ }
+
+ LL_INFOS("Teleport","Messaging") << "Changing home region to region id " << regionp->getRegionID() << " handle " << region_handle << " == x,y " << x << "," << y << LL_ENDL;
+
+ // set our upstream host the new simulator and shuffle things as
+ // appropriate.
+ LLVector3 shift_vector = regionp->getPosRegionFromGlobal(
+ gAgent.getRegion()->getOriginGlobal());
+ gAgent.setRegion(regionp);
+ gObjectList.shiftObjects(shift_vector);
+ gAssetStorage->setUpstream(msg->getSender());
+ gCacheName->setUpstream(msg->getSender());
+ gViewerThrottle.sendToSim();
+ gViewerWindow->sendShapeToSim();
+
+ bool is_teleport = gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING;
+
+ if( is_teleport )
+ {
+ if (gAgent.getTeleportKeepsLookAt())
+ {
+ // *NOTE: the LookAt data we get from the sim here doesn't
+ // seem to be useful, so get it from the camera instead
+ look_at = LLViewerCamera::getInstance()->getAtAxis();
+ }
+ // Force the camera back onto the agent, don't animate.
+ gAgentCamera.setFocusOnAvatar(TRUE, FALSE);
+ gAgentCamera.slamLookAt(look_at);
+ gAgentCamera.updateCamera();
+
+ LL_INFOS("Teleport") << "Agent movement complete, setting state to TELEPORT_START_ARRIVAL" << LL_ENDL;
+ gAgent.setTeleportState( LLAgent::TELEPORT_START_ARRIVAL );
+
+ if (isAgentAvatarValid())
+ {
+ // Set the new position
+ gAgentAvatarp->setPositionAgent(agent_pos);
+ gAgentAvatarp->clearChat();
+ gAgentAvatarp->slamPosition();
+ }
+ }
+ else
+ {
+ // This is initial log-in or a region crossing
+ LL_INFOS("Teleport") << "State is not TELEPORT_MOVING, so this is initial log-in or region crossing. "
+ << "Setting state to TELEPORT_NONE" << LL_ENDL;
+ gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
+
+ if(LLStartUp::getStartupState() < STATE_STARTED)
+ { // This is initial log-in, not a region crossing:
+ // Set the camera looking ahead of the AV so send_agent_update() below
+ // will report the correct location to the server.
+ LLVector3 look_at_point = look_at;
+ look_at_point = agent_pos + look_at_point.rotVec(gAgent.getQuat());
+
+ static LLVector3 up_direction(0.0f, 0.0f, 1.0f);
+ LLViewerCamera::getInstance()->lookAt(agent_pos, look_at_point, up_direction);
+ }
+ }
+
+ if ( LLTracker::isTracking(NULL) )
+ {
+ // Check distance to beacon, if < 5m, remove beacon
+ LLVector3d beacon_pos = LLTracker::getTrackedPositionGlobal();
+ LLVector3 beacon_dir(agent_pos.mV[VX] - (F32)fmod(beacon_pos.mdV[VX], 256.0), agent_pos.mV[VY] - (F32)fmod(beacon_pos.mdV[VY], 256.0), 0);
+ if (beacon_dir.magVecSquared() < 25.f)
+ {
+ LLTracker::stopTracking(false);
+ }
+ else if ( is_teleport && !gAgent.getTeleportKeepsLookAt() && look_at.isExactlyZero())
+ {
+ //look at the beacon
+ LLVector3 global_agent_pos = agent_pos;
+ global_agent_pos[0] += x;
+ global_agent_pos[1] += y;
+ look_at = (LLVector3)beacon_pos - global_agent_pos;
+ look_at.normVec();
+ gAgentCamera.slamLookAt(look_at);
+ }
+ }
+
+ // TODO: Put back a check for flying status! DK 12/19/05
+ // Sim tells us whether the new position is off the ground
+ /*
+ if (teleport_flags & TELEPORT_FLAGS_IS_FLYING)
+ {
+ gAgent.setFlying(TRUE);
+ }
+ else
+ {
+ gAgent.setFlying(FALSE);
+ }
+ */
+
+ send_agent_update(TRUE, TRUE);
+
+ if (gAgent.getRegion()->getBlockFly())
+ {
+ gAgent.setFlying(gAgent.canFly());
+ }
+
+ // force simulator to recognize do not disturb state
+ if (gAgent.isDoNotDisturb())
+ {
+ gAgent.setDoNotDisturb(true);
+ }
+ else
+ {
+ gAgent.setDoNotDisturb(false);
+ }
+
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->mFootPlane.clearVec();
+ }
+
+ // send walk-vs-run status
+ gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun());
+
+ // If the server version has changed, display an info box and offer
+ // to display the release notes, unless this is the initial log in.
+ if (gLastVersionChannel == version_channel)
+ {
+ return;
+ }
+
+ gLastVersionChannel = version_channel;
}
void process_crossed_region(LLMessageSystem* msg, void**)
{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- LLUUID session_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
- if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id))
- {
- LL_WARNS("Messaging") << "Incorrect id in process_crossed_region()"
- << LL_ENDL;
- return;
- }
- LL_INFOS("Messaging") << "process_crossed_region()" << LL_ENDL;
- gAgentAvatarp->resetRegionCrossingTimer();
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ LLUUID session_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
+ if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id))
+ {
+ LL_WARNS("Messaging") << "Incorrect id in process_crossed_region()"
+ << LL_ENDL;
+ return;
+ }
+ LL_INFOS("Messaging") << "process_crossed_region()" << LL_ENDL;
+ gAgentAvatarp->resetRegionCrossingTimer();
- U32 sim_ip;
- msg->getIPAddrFast(_PREHASH_RegionData, _PREHASH_SimIP, sim_ip);
- U16 sim_port;
- msg->getIPPortFast(_PREHASH_RegionData, _PREHASH_SimPort, sim_port);
- LLHost sim_host(sim_ip, sim_port);
- U64 region_handle;
- msg->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
-
- std::string seedCap;
- msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, seedCap);
+ U32 sim_ip;
+ msg->getIPAddrFast(_PREHASH_RegionData, _PREHASH_SimIP, sim_ip);
+ U16 sim_port;
+ msg->getIPPortFast(_PREHASH_RegionData, _PREHASH_SimPort, sim_port);
+ LLHost sim_host(sim_ip, sim_port);
+ U64 region_handle;
+ msg->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
- send_complete_agent_movement(sim_host);
+ std::string seedCap;
+ msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, seedCap);
- LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host);
+ send_complete_agent_movement(sim_host);
- LL_DEBUGS("CrossingCaps") << "Calling setSeedCapability from process_crossed_region(). Seed cap == "
- << seedCap << LL_ENDL;
- regionp->setSeedCapability(seedCap);
+ LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host);
+
+ LL_DEBUGS("CrossingCaps") << "Calling setSeedCapability from process_crossed_region(). Seed cap == "
+ << seedCap << LL_ENDL;
+ regionp->setSeedCapability(seedCap);
}
@@ -3320,254 +3320,254 @@ void process_crossed_region(LLMessageSystem* msg, void**)
// Sends avatar and camera information to simulator.
// Sent roughly once per frame, or 20 times per second, whichever is less often
-const F32 THRESHOLD_HEAD_ROT_QDOT = 0.9997f; // ~= 2.5 degrees -- if its less than this we need to update head_rot
-const F32 MAX_HEAD_ROT_QDOT = 0.99999f; // ~= 0.5 degrees -- if its greater than this then no need to update head_rot
- // between these values we delay the updates (but no more than one second)
+const F32 THRESHOLD_HEAD_ROT_QDOT = 0.9997f; // ~= 2.5 degrees -- if its less than this we need to update head_rot
+const F32 MAX_HEAD_ROT_QDOT = 0.99999f; // ~= 0.5 degrees -- if its greater than this then no need to update head_rot
+ // between these values we delay the updates (but no more than one second)
void send_agent_update(BOOL force_send, BOOL send_reliable)
{
LL_PROFILE_ZONE_SCOPED;
llassert(!gCubeSnapshot);
- if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
- {
- // We don't care if they want to send an agent update, they're not allowed to until the simulator
- // that's the target is ready to receive them (after avatar_init_complete is received)
- return;
- }
-
- // We have already requested to log out. Don't send agent updates.
- if(LLAppViewer::instance()->logoutRequestSent())
- {
- return;
- }
-
- // no region to send update to
- if(gAgent.getRegion() == NULL)
- {
- return;
- }
-
- const F32 TRANSLATE_THRESHOLD = 0.01f;
-
- // NOTA BENE: This is (intentionally?) using the small angle sine approximation to test for rotation
- // Plus, there is an extra 0.5 in the mix since the perpendicular between last_camera_at and getAtAxis() bisects cam_rot_change
- // Thus, we're actually testing against 0.2 degrees
- const F32 ROTATION_THRESHOLD = 0.1f * 2.f*F_PI/360.f; // Rotation thresh 0.2 deg, see note above
-
- const U8 DUP_MSGS = 1; // HACK! number of times to repeat data on motionless agent
-
- // Store data on last sent update so that if no changes, no send
- static LLVector3 last_camera_pos_agent,
- last_camera_at,
- last_camera_left,
- last_camera_up;
-
- static LLVector3 cam_center_chg,
- cam_rot_chg;
-
- static LLQuaternion last_head_rot;
- static U32 last_control_flags = 0;
- static U8 last_render_state;
- static U8 duplicate_count = 0;
- static F32 head_rot_chg = 1.0;
- static U8 last_flags;
-
- LLMessageSystem *msg = gMessageSystem;
- LLVector3 camera_pos_agent; // local to avatar's region
- U8 render_state;
-
- LLQuaternion body_rotation = gAgent.getFrameAgent().getQuaternion();
- LLQuaternion head_rotation = gAgent.getHeadRotation();
-
- camera_pos_agent = gAgentCamera.getCameraPositionAgent();
-
- render_state = gAgent.getRenderState();
-
- U32 control_flag_change = 0;
- U8 flag_change = 0;
-
- cam_center_chg = last_camera_pos_agent - camera_pos_agent;
- cam_rot_chg = last_camera_at - LLViewerCamera::getInstance()->getAtAxis();
-
- // If a modifier key is held down, turn off
- // LBUTTON and ML_LBUTTON so that using the camera (alt-key) doesn't
- // trigger a control event.
- U32 control_flags = gAgent.getControlFlags();
-
- MASK key_mask = gKeyboard->currentMask(TRUE);
-
- if (key_mask & MASK_ALT || key_mask & MASK_CONTROL)
- {
- control_flags &= ~( AGENT_CONTROL_LBUTTON_DOWN |
- AGENT_CONTROL_ML_LBUTTON_DOWN );
- control_flags |= AGENT_CONTROL_LBUTTON_UP |
- AGENT_CONTROL_ML_LBUTTON_UP ;
- }
-
- control_flag_change = last_control_flags ^ control_flags;
-
- U8 flags = AU_FLAGS_NONE;
- if (gAgent.isGroupTitleHidden())
- {
- flags |= AU_FLAGS_HIDETITLE;
- }
- if (gAgent.getAutoPilot())
- {
- flags |= AU_FLAGS_CLIENT_AUTOPILOT;
- }
-
- flag_change = last_flags ^ flags;
-
- head_rot_chg = dot(last_head_rot, head_rotation);
-
- //static S32 msg_number = 0; // Used for diagnostic log messages
-
- if (force_send ||
- (cam_center_chg.magVec() > TRANSLATE_THRESHOLD) ||
- (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT) ||
- (last_render_state != render_state) ||
- (cam_rot_chg.magVec() > ROTATION_THRESHOLD) ||
- control_flag_change != 0 ||
- flag_change != 0)
- {
- /* Diagnotics to show why we send the AgentUpdate message. Also un-commment the msg_number code above and below this block
- msg_number += 1;
- if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT)
- {
- //LL_INFOS("Messaging") << "head rot " << head_rotation << LL_ENDL;
- LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", head_rot_chg " << head_rot_chg << LL_ENDL;
- }
- if (cam_rot_chg.magVec() > ROTATION_THRESHOLD)
- {
- LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", cam rot " << cam_rot_chg.magVec() << LL_ENDL;
- }
- if (cam_center_chg.magVec() > TRANSLATE_THRESHOLD)
- {
- LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", cam center " << cam_center_chg.magVec() << LL_ENDL;
- }
-// if (drag_delta_chg.magVec() > TRANSLATE_THRESHOLD)
-// {
-// LL_INFOS("Messaging") << "drag delta " << drag_delta_chg.magVec() << LL_ENDL;
-// }
- if (control_flag_change)
- {
- LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", dcf = " << control_flag_change << LL_ENDL;
- }
+ if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
+ {
+ // We don't care if they want to send an agent update, they're not allowed to until the simulator
+ // that's the target is ready to receive them (after avatar_init_complete is received)
+ return;
+ }
+
+ // We have already requested to log out. Don't send agent updates.
+ if(LLAppViewer::instance()->logoutRequestSent())
+ {
+ return;
+ }
+
+ // no region to send update to
+ if(gAgent.getRegion() == NULL)
+ {
+ return;
+ }
+
+ const F32 TRANSLATE_THRESHOLD = 0.01f;
+
+ // NOTA BENE: This is (intentionally?) using the small angle sine approximation to test for rotation
+ // Plus, there is an extra 0.5 in the mix since the perpendicular between last_camera_at and getAtAxis() bisects cam_rot_change
+ // Thus, we're actually testing against 0.2 degrees
+ const F32 ROTATION_THRESHOLD = 0.1f * 2.f*F_PI/360.f; // Rotation thresh 0.2 deg, see note above
+
+ const U8 DUP_MSGS = 1; // HACK! number of times to repeat data on motionless agent
+
+ // Store data on last sent update so that if no changes, no send
+ static LLVector3 last_camera_pos_agent,
+ last_camera_at,
+ last_camera_left,
+ last_camera_up;
+
+ static LLVector3 cam_center_chg,
+ cam_rot_chg;
+
+ static LLQuaternion last_head_rot;
+ static U32 last_control_flags = 0;
+ static U8 last_render_state;
+ static U8 duplicate_count = 0;
+ static F32 head_rot_chg = 1.0;
+ static U8 last_flags;
+
+ LLMessageSystem *msg = gMessageSystem;
+ LLVector3 camera_pos_agent; // local to avatar's region
+ U8 render_state;
+
+ LLQuaternion body_rotation = gAgent.getFrameAgent().getQuaternion();
+ LLQuaternion head_rotation = gAgent.getHeadRotation();
+
+ camera_pos_agent = gAgentCamera.getCameraPositionAgent();
+
+ render_state = gAgent.getRenderState();
+
+ U32 control_flag_change = 0;
+ U8 flag_change = 0;
+
+ cam_center_chg = last_camera_pos_agent - camera_pos_agent;
+ cam_rot_chg = last_camera_at - LLViewerCamera::getInstance()->getAtAxis();
+
+ // If a modifier key is held down, turn off
+ // LBUTTON and ML_LBUTTON so that using the camera (alt-key) doesn't
+ // trigger a control event.
+ U32 control_flags = gAgent.getControlFlags();
+
+ MASK key_mask = gKeyboard->currentMask(TRUE);
+
+ if (key_mask & MASK_ALT || key_mask & MASK_CONTROL)
+ {
+ control_flags &= ~( AGENT_CONTROL_LBUTTON_DOWN |
+ AGENT_CONTROL_ML_LBUTTON_DOWN );
+ control_flags |= AGENT_CONTROL_LBUTTON_UP |
+ AGENT_CONTROL_ML_LBUTTON_UP ;
+ }
+
+ control_flag_change = last_control_flags ^ control_flags;
+
+ U8 flags = AU_FLAGS_NONE;
+ if (gAgent.isGroupTitleHidden())
+ {
+ flags |= AU_FLAGS_HIDETITLE;
+ }
+ if (gAgent.getAutoPilot())
+ {
+ flags |= AU_FLAGS_CLIENT_AUTOPILOT;
+ }
+
+ flag_change = last_flags ^ flags;
+
+ head_rot_chg = dot(last_head_rot, head_rotation);
+
+ //static S32 msg_number = 0; // Used for diagnostic log messages
+
+ if (force_send ||
+ (cam_center_chg.magVec() > TRANSLATE_THRESHOLD) ||
+ (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT) ||
+ (last_render_state != render_state) ||
+ (cam_rot_chg.magVec() > ROTATION_THRESHOLD) ||
+ control_flag_change != 0 ||
+ flag_change != 0)
+ {
+ /* Diagnotics to show why we send the AgentUpdate message. Also un-commment the msg_number code above and below this block
+ msg_number += 1;
+ if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT)
+ {
+ //LL_INFOS("Messaging") << "head rot " << head_rotation << LL_ENDL;
+ LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", head_rot_chg " << head_rot_chg << LL_ENDL;
+ }
+ if (cam_rot_chg.magVec() > ROTATION_THRESHOLD)
+ {
+ LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", cam rot " << cam_rot_chg.magVec() << LL_ENDL;
+ }
+ if (cam_center_chg.magVec() > TRANSLATE_THRESHOLD)
+ {
+ LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", cam center " << cam_center_chg.magVec() << LL_ENDL;
+ }
+// if (drag_delta_chg.magVec() > TRANSLATE_THRESHOLD)
+// {
+// LL_INFOS("Messaging") << "drag delta " << drag_delta_chg.magVec() << LL_ENDL;
+// }
+ if (control_flag_change)
+ {
+ LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", dcf = " << control_flag_change << LL_ENDL;
+ }
*/
- duplicate_count = 0;
- }
- else
- {
- duplicate_count++;
-
- if (head_rot_chg < MAX_HEAD_ROT_QDOT && duplicate_count < AGENT_UPDATES_PER_SECOND)
- {
- // The head_rotation is sent for updating things like attached guns.
- // We only trigger a new update when head_rotation deviates beyond
- // some threshold from the last update, however this can break fine
- // adjustments when trying to aim an attached gun, so what we do here
- // (where we would normally skip sending an update when nothing has changed)
- // is gradually reduce the threshold to allow a better update to
- // eventually get sent... should update to within 0.5 degrees in less
- // than a second.
- if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT + (MAX_HEAD_ROT_QDOT - THRESHOLD_HEAD_ROT_QDOT) * duplicate_count / AGENT_UPDATES_PER_SECOND)
- {
- duplicate_count = 0;
- }
- else
- {
- return;
- }
- }
- else
- {
- return;
- }
- }
-
- if (duplicate_count < DUP_MSGS && !gDisconnected)
- {
- /* More diagnostics to count AgentUpdate messages
- static S32 update_sec = 0;
- static S32 update_count = 0;
- static S32 max_update_count = 0;
- S32 cur_sec = lltrunc( LLTimer::getTotalSeconds() );
- update_count += 1;
- if (cur_sec != update_sec)
- {
- if (update_sec != 0)
- {
- update_sec = cur_sec;
- //msg_number = 0;
- max_update_count = llmax(max_update_count, update_count);
- LL_INFOS() << "Sent " << update_count << " AgentUpdate messages per second, max is " << max_update_count << LL_ENDL;
- }
- update_sec = cur_sec;
- update_count = 0;
- }
- */
-
- // Build the message
- msg->newMessageFast(_PREHASH_AgentUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addQuatFast(_PREHASH_BodyRotation, body_rotation);
- msg->addQuatFast(_PREHASH_HeadRotation, head_rotation);
- msg->addU8Fast(_PREHASH_State, render_state);
- msg->addU8Fast(_PREHASH_Flags, flags);
-
-// if (camera_pos_agent.mV[VY] > 255.f)
-// {
-// LL_INFOS("Messaging") << "Sending camera center " << camera_pos_agent << LL_ENDL;
-// }
-
- msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent);
- msg->addVector3Fast(_PREHASH_CameraAtAxis, LLViewerCamera::getInstance()->getAtAxis());
- msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis());
- msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis());
- msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance);
-
- msg->addU32Fast(_PREHASH_ControlFlags, control_flags);
-
- if (gDebugClicks)
- {
- if (control_flags & AGENT_CONTROL_LBUTTON_DOWN)
- {
- LL_INFOS("Messaging") << "AgentUpdate left button down" << LL_ENDL;
- }
-
- if (control_flags & AGENT_CONTROL_LBUTTON_UP)
- {
- LL_INFOS("Messaging") << "AgentUpdate left button up" << LL_ENDL;
- }
- }
-
- gAgent.enableControlFlagReset();
-
- if (!send_reliable)
- {
- gAgent.sendMessage();
- }
- else
- {
- gAgent.sendReliableMessage();
- }
-
-// LL_DEBUGS("Messaging") << "agent " << avatar_pos_agent << " cam " << camera_pos_agent << LL_ENDL;
-
- // Copy the old data
- last_head_rot = head_rotation;
- last_render_state = render_state;
- last_camera_pos_agent = camera_pos_agent;
- last_camera_at = LLViewerCamera::getInstance()->getAtAxis();
- last_camera_left = LLViewerCamera::getInstance()->getLeftAxis();
- last_camera_up = LLViewerCamera::getInstance()->getUpAxis();
- last_control_flags = control_flags;
- last_flags = flags;
- }
+ duplicate_count = 0;
+ }
+ else
+ {
+ duplicate_count++;
+
+ if (head_rot_chg < MAX_HEAD_ROT_QDOT && duplicate_count < AGENT_UPDATES_PER_SECOND)
+ {
+ // The head_rotation is sent for updating things like attached guns.
+ // We only trigger a new update when head_rotation deviates beyond
+ // some threshold from the last update, however this can break fine
+ // adjustments when trying to aim an attached gun, so what we do here
+ // (where we would normally skip sending an update when nothing has changed)
+ // is gradually reduce the threshold to allow a better update to
+ // eventually get sent... should update to within 0.5 degrees in less
+ // than a second.
+ if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT + (MAX_HEAD_ROT_QDOT - THRESHOLD_HEAD_ROT_QDOT) * duplicate_count / AGENT_UPDATES_PER_SECOND)
+ {
+ duplicate_count = 0;
+ }
+ else
+ {
+ return;
+ }
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ if (duplicate_count < DUP_MSGS && !gDisconnected)
+ {
+ /* More diagnostics to count AgentUpdate messages
+ static S32 update_sec = 0;
+ static S32 update_count = 0;
+ static S32 max_update_count = 0;
+ S32 cur_sec = lltrunc( LLTimer::getTotalSeconds() );
+ update_count += 1;
+ if (cur_sec != update_sec)
+ {
+ if (update_sec != 0)
+ {
+ update_sec = cur_sec;
+ //msg_number = 0;
+ max_update_count = llmax(max_update_count, update_count);
+ LL_INFOS() << "Sent " << update_count << " AgentUpdate messages per second, max is " << max_update_count << LL_ENDL;
+ }
+ update_sec = cur_sec;
+ update_count = 0;
+ }
+ */
+
+ // Build the message
+ msg->newMessageFast(_PREHASH_AgentUpdate);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addQuatFast(_PREHASH_BodyRotation, body_rotation);
+ msg->addQuatFast(_PREHASH_HeadRotation, head_rotation);
+ msg->addU8Fast(_PREHASH_State, render_state);
+ msg->addU8Fast(_PREHASH_Flags, flags);
+
+// if (camera_pos_agent.mV[VY] > 255.f)
+// {
+// LL_INFOS("Messaging") << "Sending camera center " << camera_pos_agent << LL_ENDL;
+// }
+
+ msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent);
+ msg->addVector3Fast(_PREHASH_CameraAtAxis, LLViewerCamera::getInstance()->getAtAxis());
+ msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis());
+ msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis());
+ msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance);
+
+ msg->addU32Fast(_PREHASH_ControlFlags, control_flags);
+
+ if (gDebugClicks)
+ {
+ if (control_flags & AGENT_CONTROL_LBUTTON_DOWN)
+ {
+ LL_INFOS("Messaging") << "AgentUpdate left button down" << LL_ENDL;
+ }
+
+ if (control_flags & AGENT_CONTROL_LBUTTON_UP)
+ {
+ LL_INFOS("Messaging") << "AgentUpdate left button up" << LL_ENDL;
+ }
+ }
+
+ gAgent.enableControlFlagReset();
+
+ if (!send_reliable)
+ {
+ gAgent.sendMessage();
+ }
+ else
+ {
+ gAgent.sendReliableMessage();
+ }
+
+// LL_DEBUGS("Messaging") << "agent " << avatar_pos_agent << " cam " << camera_pos_agent << LL_ENDL;
+
+ // Copy the old data
+ last_head_rot = head_rotation;
+ last_render_state = render_state;
+ last_camera_pos_agent = camera_pos_agent;
+ last_camera_at = LLViewerCamera::getInstance()->getAtAxis();
+ last_camera_left = LLViewerCamera::getInstance()->getLeftAxis();
+ last_camera_up = LLViewerCamera::getInstance()->getUpAxis();
+ last_control_flags = control_flags;
+ last_flags = flags;
+ }
}
@@ -3681,177 +3681,177 @@ void clear_expired_postponed_sounds()
extern U32Bits gObjectData;
void process_object_update(LLMessageSystem *mesgsys, void **user_data)
-{
- // Update the data counters
- if (mesgsys->getReceiveCompressedSize())
- {
- gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
- }
- else
- {
- gObjectData += (U32Bytes)mesgsys->getReceiveSize();
- }
-
- // Update the object...
- S32 old_num_objects = gObjectList.mNumNewObjects;
- gObjectList.processObjectUpdate(mesgsys, user_data, OUT_FULL);
- if (old_num_objects != gObjectList.mNumNewObjects)
- {
- update_attached_sounds();
- }
+{
+ // Update the data counters
+ if (mesgsys->getReceiveCompressedSize())
+ {
+ gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
+ }
+ else
+ {
+ gObjectData += (U32Bytes)mesgsys->getReceiveSize();
+ }
+
+ // Update the object...
+ S32 old_num_objects = gObjectList.mNumNewObjects;
+ gObjectList.processObjectUpdate(mesgsys, user_data, OUT_FULL);
+ if (old_num_objects != gObjectList.mNumNewObjects)
+ {
+ update_attached_sounds();
+ }
}
void process_compressed_object_update(LLMessageSystem *mesgsys, void **user_data)
{
- // Update the data counters
- if (mesgsys->getReceiveCompressedSize())
- {
- gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
- }
- else
- {
- gObjectData += (U32Bytes)mesgsys->getReceiveSize();
- }
-
- // Update the object...
- S32 old_num_objects = gObjectList.mNumNewObjects;
- gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_FULL_COMPRESSED);
- if (old_num_objects != gObjectList.mNumNewObjects)
- {
- update_attached_sounds();
- }
+ // Update the data counters
+ if (mesgsys->getReceiveCompressedSize())
+ {
+ gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
+ }
+ else
+ {
+ gObjectData += (U32Bytes)mesgsys->getReceiveSize();
+ }
+
+ // Update the object...
+ S32 old_num_objects = gObjectList.mNumNewObjects;
+ gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_FULL_COMPRESSED);
+ if (old_num_objects != gObjectList.mNumNewObjects)
+ {
+ update_attached_sounds();
+ }
}
void process_cached_object_update(LLMessageSystem *mesgsys, void **user_data)
{
- // Update the data counters
- if (mesgsys->getReceiveCompressedSize())
- {
- gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
- }
- else
- {
- gObjectData += (U32Bytes)mesgsys->getReceiveSize();
- }
+ // Update the data counters
+ if (mesgsys->getReceiveCompressedSize())
+ {
+ gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
+ }
+ else
+ {
+ gObjectData += (U32Bytes)mesgsys->getReceiveSize();
+ }
- // Update the object...
- gObjectList.processCachedObjectUpdate(mesgsys, user_data, OUT_FULL_CACHED);
+ // Update the object...
+ gObjectList.processCachedObjectUpdate(mesgsys, user_data, OUT_FULL_CACHED);
}
void process_terse_object_update_improved(LLMessageSystem *mesgsys, void **user_data)
{
- if (mesgsys->getReceiveCompressedSize())
- {
- gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
- }
- else
- {
- gObjectData += (U32Bytes)mesgsys->getReceiveSize();
- }
+ if (mesgsys->getReceiveCompressedSize())
+ {
+ gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize();
+ }
+ else
+ {
+ gObjectData += (U32Bytes)mesgsys->getReceiveSize();
+ }
- S32 old_num_objects = gObjectList.mNumNewObjects;
- gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_TERSE_IMPROVED);
- if (old_num_objects != gObjectList.mNumNewObjects)
- {
- update_attached_sounds();
- }
+ S32 old_num_objects = gObjectList.mNumNewObjects;
+ gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_TERSE_IMPROVED);
+ if (old_num_objects != gObjectList.mNumNewObjects)
+ {
+ update_attached_sounds();
+ }
}
void process_kill_object(LLMessageSystem *mesgsys, void **user_data)
{
LL_PROFILE_ZONE_SCOPED;
- LLUUID id;
-
- U32 ip = mesgsys->getSenderIP();
- U32 port = mesgsys->getSenderPort();
- LLViewerRegion* regionp = NULL;
- {
- LLHost host(ip, port);
- regionp = LLWorld::getInstance()->getRegion(host);
- }
-
- bool delete_object = LLViewerRegion::sVOCacheCullingEnabled;
- S32 num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData);
- for (S32 i = 0; i < num_objects; ++i)
- {
- U32 local_id;
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
-
- LLViewerObjectList::getUUIDFromLocal(id, local_id, ip, port);
- if (id == LLUUID::null)
- {
- LL_DEBUGS("Messaging") << "Unknown kill for local " << local_id << LL_ENDL;
- continue;
- }
- else
- {
- LL_DEBUGS("Messaging") << "Kill message for local " << local_id << LL_ENDL;
- }
-
- if (id == gAgentID)
- {
- // never kill our avatar
- continue;
- }
-
- LLViewerObject *objectp = gObjectList.findObject(id);
- if (objectp)
- {
- // Display green bubble on kill
- if ( gShowObjectUpdates )
- {
- LLColor4 color(0.f,1.f,0.f,1.f);
- gPipeline.addDebugBlip(objectp->getPositionAgent(), color);
- LL_DEBUGS("MessageBlip") << "Kill blip for local " << local_id << " at " << objectp->getPositionAgent() << LL_ENDL;
- }
-
- // Do the kill
- gObjectList.killObject(objectp);
- }
-
- if(delete_object)
- {
- regionp->killCacheEntry(local_id);
- }
-
- // We should remove the object from selection after it is marked dead by gObjectList to make LLToolGrab,
+ LLUUID id;
+
+ U32 ip = mesgsys->getSenderIP();
+ U32 port = mesgsys->getSenderPort();
+ LLViewerRegion* regionp = NULL;
+ {
+ LLHost host(ip, port);
+ regionp = LLWorld::getInstance()->getRegion(host);
+ }
+
+ bool delete_object = LLViewerRegion::sVOCacheCullingEnabled;
+ S32 num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData);
+ for (S32 i = 0; i < num_objects; ++i)
+ {
+ U32 local_id;
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
+
+ LLViewerObjectList::getUUIDFromLocal(id, local_id, ip, port);
+ if (id == LLUUID::null)
+ {
+ LL_DEBUGS("Messaging") << "Unknown kill for local " << local_id << LL_ENDL;
+ continue;
+ }
+ else
+ {
+ LL_DEBUGS("Messaging") << "Kill message for local " << local_id << LL_ENDL;
+ }
+
+ if (id == gAgentID)
+ {
+ // never kill our avatar
+ continue;
+ }
+
+ LLViewerObject *objectp = gObjectList.findObject(id);
+ if (objectp)
+ {
+ // Display green bubble on kill
+ if ( gShowObjectUpdates )
+ {
+ LLColor4 color(0.f,1.f,0.f,1.f);
+ gPipeline.addDebugBlip(objectp->getPositionAgent(), color);
+ LL_DEBUGS("MessageBlip") << "Kill blip for local " << local_id << " at " << objectp->getPositionAgent() << LL_ENDL;
+ }
+
+ // Do the kill
+ gObjectList.killObject(objectp);
+ }
+
+ if(delete_object)
+ {
+ regionp->killCacheEntry(local_id);
+ }
+
+ // We should remove the object from selection after it is marked dead by gObjectList to make LLToolGrab,
// which is using the object, release the mouse capture correctly when the object dies.
// See LLToolGrab::handleHoverActive() and LLToolGrab::handleHoverNonPhysical().
- LLSelectMgr::getInstance()->removeObjectFromSelections(id);
+ LLSelectMgr::getInstance()->removeObjectFromSelections(id);
- } // end for loop
+ } // end for loop
LLViewerStatsRecorder::instance().recordObjectKills(num_objects);
}
void process_time_synch(LLMessageSystem *mesgsys, void **user_data)
{
- LLVector3 sun_direction;
+ LLVector3 sun_direction;
LLVector3 moon_direction;
- LLVector3 sun_ang_velocity;
- F32 phase;
- U64 space_time_usec;
+ LLVector3 sun_ang_velocity;
+ F32 phase;
+ U64 space_time_usec;
U32 seconds_per_day;
U32 seconds_per_year;
- // "SimulatorViewerTimeMessage"
- mesgsys->getU64Fast(_PREHASH_TimeInfo, _PREHASH_UsecSinceStart, space_time_usec);
- mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerDay, seconds_per_day);
- mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerYear, seconds_per_year);
+ // "SimulatorViewerTimeMessage"
+ mesgsys->getU64Fast(_PREHASH_TimeInfo, _PREHASH_UsecSinceStart, space_time_usec);
+ mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerDay, seconds_per_day);
+ mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerYear, seconds_per_year);
- // This should eventually be moved to an "UpdateHeavenlyBodies" message
- mesgsys->getF32Fast(_PREHASH_TimeInfo, _PREHASH_SunPhase, phase);
- mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunDirection, sun_direction);
- mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunAngVelocity, sun_ang_velocity);
+ // This should eventually be moved to an "UpdateHeavenlyBodies" message
+ mesgsys->getF32Fast(_PREHASH_TimeInfo, _PREHASH_SunPhase, phase);
+ mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunDirection, sun_direction);
+ mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunAngVelocity, sun_ang_velocity);
- LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec);
+ LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec);
- LL_DEBUGS("WindlightSync") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL;
+ LL_DEBUGS("WindlightSync") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL;
- /* LAPRAS
+ /* LAPRAS
We decode these parts of the message but ignore them
as the real values are provided elsewhere. */
(void)sun_direction, (void)moon_direction, (void)phase;
@@ -3859,396 +3859,396 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data)
void process_sound_trigger(LLMessageSystem *msg, void **)
{
- if (!gAudiop)
- {
+ if (!gAudiop)
+ {
#if !LL_LINUX
- LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
#endif
- return;
- }
-
- U64 region_handle = 0;
- F32 gain = 0;
- LLUUID sound_id;
- LLUUID owner_id;
- LLUUID object_id;
- LLUUID parent_id;
- LLVector3 pos_local;
-
- msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_SoundID, sound_id);
- msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_OwnerID, owner_id);
- msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ObjectID, object_id);
- msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ParentID, parent_id);
- msg->getU64Fast(_PREHASH_SoundData, _PREHASH_Handle, region_handle);
- msg->getVector3Fast(_PREHASH_SoundData, _PREHASH_Position, pos_local);
- msg->getF32Fast(_PREHASH_SoundData, _PREHASH_Gain, gain);
-
- // adjust sound location to true global coords
- LLVector3d pos_global = from_region_handle(region_handle);
- pos_global.mdV[VX] += pos_local.mV[VX];
- pos_global.mdV[VY] += pos_local.mV[VY];
- pos_global.mdV[VZ] += pos_local.mV[VZ];
-
- // Don't play a trigger sound if you can't hear it due
- // to parcel "local audio only" settings.
- if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global)) return;
-
- // Don't play sounds triggered by someone you muted.
- if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
-
- // Don't play sounds from an object you muted
- if (LLMuteList::getInstance()->isMuted(object_id)) return;
-
- // Don't play sounds from an object whose parent you muted
- if (parent_id.notNull()
- && LLMuteList::getInstance()->isMuted(parent_id))
- {
- return;
- }
-
- // Don't play sounds from a region with maturity above current agent maturity
- if( !gAgent.canAccessMaturityInRegion( region_handle ) )
- {
- return;
- }
-
- // Don't play sounds from gestures if they are not enabled.
- // Do play sounds triggered by avatar, since muting your own
- // gesture sounds and your own sounds played inworld from
- // Inventory can cause confusion.
- if (object_id == owner_id
+ return;
+ }
+
+ U64 region_handle = 0;
+ F32 gain = 0;
+ LLUUID sound_id;
+ LLUUID owner_id;
+ LLUUID object_id;
+ LLUUID parent_id;
+ LLVector3 pos_local;
+
+ msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_SoundID, sound_id);
+ msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_OwnerID, owner_id);
+ msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ObjectID, object_id);
+ msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ParentID, parent_id);
+ msg->getU64Fast(_PREHASH_SoundData, _PREHASH_Handle, region_handle);
+ msg->getVector3Fast(_PREHASH_SoundData, _PREHASH_Position, pos_local);
+ msg->getF32Fast(_PREHASH_SoundData, _PREHASH_Gain, gain);
+
+ // adjust sound location to true global coords
+ LLVector3d pos_global = from_region_handle(region_handle);
+ pos_global.mdV[VX] += pos_local.mV[VX];
+ pos_global.mdV[VY] += pos_local.mV[VY];
+ pos_global.mdV[VZ] += pos_local.mV[VZ];
+
+ // Don't play a trigger sound if you can't hear it due
+ // to parcel "local audio only" settings.
+ if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global)) return;
+
+ // Don't play sounds triggered by someone you muted.
+ if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
+
+ // Don't play sounds from an object you muted
+ if (LLMuteList::getInstance()->isMuted(object_id)) return;
+
+ // Don't play sounds from an object whose parent you muted
+ if (parent_id.notNull()
+ && LLMuteList::getInstance()->isMuted(parent_id))
+ {
+ return;
+ }
+
+ // Don't play sounds from a region with maturity above current agent maturity
+ if( !gAgent.canAccessMaturityInRegion( region_handle ) )
+ {
+ return;
+ }
+
+ // Don't play sounds from gestures if they are not enabled.
+ // Do play sounds triggered by avatar, since muting your own
+ // gesture sounds and your own sounds played inworld from
+ // Inventory can cause confusion.
+ if (object_id == owner_id
&& owner_id != gAgentID
&& !gSavedSettings.getBOOL("EnableGestureSounds"))
- {
- return;
- }
+ {
+ return;
+ }
- if (LLMaterialTable::basic.isCollisionSound(sound_id) && !gSavedSettings.getBOOL("EnableCollisionSounds"))
- {
- return;
- }
+ if (LLMaterialTable::basic.isCollisionSound(sound_id) && !gSavedSettings.getBOOL("EnableCollisionSounds"))
+ {
+ return;
+ }
- gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global);
+ gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global);
}
void process_preload_sound(LLMessageSystem *msg, void **user_data)
{
- if (!gAudiop)
- {
+ if (!gAudiop)
+ {
#if !LL_LINUX
- LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
#endif
- return;
- }
+ return;
+ }
- LLUUID sound_id;
- LLUUID object_id;
- LLUUID owner_id;
+ LLUUID sound_id;
+ LLUUID object_id;
+ LLUUID owner_id;
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id);
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id);
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
+ msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id);
+ msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id);
+ msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
- LLViewerObject *objectp = gObjectList.findObject(object_id);
- if (!objectp) return;
+ LLViewerObject *objectp = gObjectList.findObject(object_id);
+ if (!objectp) return;
+
+ if (LLMuteList::getInstance()->isMuted(object_id)) return;
+ if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
- if (LLMuteList::getInstance()->isMuted(object_id)) return;
- if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
-
- LLAudioSource *sourcep = objectp->getAudioSource(owner_id);
- if (!sourcep) return;
-
- LLAudioData *datap = gAudiop->getAudioData(sound_id);
+ LLAudioSource *sourcep = objectp->getAudioSource(owner_id);
+ if (!sourcep) return;
- // Note that I don't actually do any loading of the
- // audio data into a buffer at this point, as it won't actually
- // help us out.
+ LLAudioData *datap = gAudiop->getAudioData(sound_id);
- // Don't play sounds from a region with maturity above current agent maturity
- LLVector3d pos_global = objectp->getPositionGlobal();
- if (gAgent.canAccessMaturityAtGlobal(pos_global))
- {
- // Add audioData starts a transfer internally.
- sourcep->addAudioData(datap, FALSE);
- }
+ // Note that I don't actually do any loading of the
+ // audio data into a buffer at this point, as it won't actually
+ // help us out.
+
+ // Don't play sounds from a region with maturity above current agent maturity
+ LLVector3d pos_global = objectp->getPositionGlobal();
+ if (gAgent.canAccessMaturityAtGlobal(pos_global))
+ {
+ // Add audioData starts a transfer internally.
+ sourcep->addAudioData(datap, FALSE);
+ }
}
void process_attached_sound(LLMessageSystem *msg, void **user_data)
{
- F32 gain = 0;
- LLUUID sound_id;
- LLUUID object_id;
- LLUUID owner_id;
- U8 flags;
-
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id);
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id);
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
- msg->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain);
- msg->getU8Fast(_PREHASH_DataBlock, _PREHASH_Flags, flags);
-
- LLViewerObject *objectp = gObjectList.findObject(object_id);
- if (objectp)
- {
- set_attached_sound(objectp, object_id, sound_id, owner_id, gain, flags);
- }
- else if (sound_id.notNull())
- {
- // we don't know about this object yet, probably it has yet to arrive
- // std::map for dupplicate prevention.
- postponed_sounds[object_id] = (PostponedSoundData(object_id, sound_id, owner_id, gain, flags));
- clear_expired_postponed_sounds();
- }
- else
- {
- std::map<LLUUID, PostponedSoundData>::iterator iter = postponed_sounds.find(object_id);
- if (iter != postponed_sounds.end())
- {
- postponed_sounds.erase(iter);
- }
- }
+ F32 gain = 0;
+ LLUUID sound_id;
+ LLUUID object_id;
+ LLUUID owner_id;
+ U8 flags;
+
+ msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id);
+ msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id);
+ msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
+ msg->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain);
+ msg->getU8Fast(_PREHASH_DataBlock, _PREHASH_Flags, flags);
+
+ LLViewerObject *objectp = gObjectList.findObject(object_id);
+ if (objectp)
+ {
+ set_attached_sound(objectp, object_id, sound_id, owner_id, gain, flags);
+ }
+ else if (sound_id.notNull())
+ {
+ // we don't know about this object yet, probably it has yet to arrive
+ // std::map for dupplicate prevention.
+ postponed_sounds[object_id] = (PostponedSoundData(object_id, sound_id, owner_id, gain, flags));
+ clear_expired_postponed_sounds();
+ }
+ else
+ {
+ std::map<LLUUID, PostponedSoundData>::iterator iter = postponed_sounds.find(object_id);
+ if (iter != postponed_sounds.end())
+ {
+ postponed_sounds.erase(iter);
+ }
+ }
}
void process_attached_sound_gain_change(LLMessageSystem *mesgsys, void **user_data)
{
- F32 gain = 0;
- LLUUID object_guid;
- LLViewerObject *objectp = NULL;
+ F32 gain = 0;
+ LLUUID object_guid;
+ LLViewerObject *objectp = NULL;
- mesgsys->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_guid);
+ mesgsys->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_guid);
- if (!((objectp = gObjectList.findObject(object_guid))))
- {
- // we don't know about this object, just bail
- return;
- }
+ if (!((objectp = gObjectList.findObject(object_guid))))
+ {
+ // we don't know about this object, just bail
+ return;
+ }
- mesgsys->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain);
+ mesgsys->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain);
- objectp->adjustAudioGain(gain);
+ objectp->adjustAudioGain(gain);
}
void process_health_message(LLMessageSystem *mesgsys, void **user_data)
{
- F32 health;
+ F32 health;
- mesgsys->getF32Fast(_PREHASH_HealthData, _PREHASH_Health, health);
+ mesgsys->getF32Fast(_PREHASH_HealthData, _PREHASH_Health, health);
- if (gStatusBar)
- {
- gStatusBar->setHealth((S32)health);
- }
+ if (gStatusBar)
+ {
+ gStatusBar->setHealth((S32)health);
+ }
}
void process_sim_stats(LLMessageSystem *msg, void **user_data)
-{
- S32 count = msg->getNumberOfBlocks("Stat");
- for (S32 i = 0; i < count; ++i)
- {
- U32 stat_id;
- F32 stat_value;
- msg->getU32("Stat", "StatID", stat_id, i);
- msg->getF32("Stat", "StatValue", stat_value, i);
- auto measurementp = LLStatViewer::SimMeasurementSampler::getInstance((ESimStatID)stat_id);
-
- if (measurementp )
- {
- measurementp->sample(stat_value);
- }
- else
- {
- LL_WARNS() << "Unknown sim stat identifier: " << stat_id << LL_ENDL;
- }
- }
-
- //
- // Various hacks that aren't statistics, but are being handled here.
- //
- U32 max_tasks_per_region;
- U64 region_flags;
- msg->getU32("Region", "ObjectCapacity", max_tasks_per_region);
-
- if (msg->has(_PREHASH_RegionInfo))
- {
- msg->getU64("RegionInfo", "RegionFlagsExtended", region_flags);
- }
- else
- {
- U32 flags = 0;
- msg->getU32("Region", "RegionFlags", flags);
- region_flags = flags;
- }
-
- LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- BOOL was_flying = gAgent.getFlying();
- regionp->setRegionFlags(region_flags);
- regionp->setMaxTasks(max_tasks_per_region);
- // HACK: This makes agents drop from the sky if the region is
- // set to no fly while people are still in the sim.
- if (was_flying && regionp->getBlockFly())
- {
- gAgent.setFlying(gAgent.canFly());
- }
- }
+{
+ S32 count = msg->getNumberOfBlocks("Stat");
+ for (S32 i = 0; i < count; ++i)
+ {
+ U32 stat_id;
+ F32 stat_value;
+ msg->getU32("Stat", "StatID", stat_id, i);
+ msg->getF32("Stat", "StatValue", stat_value, i);
+ auto measurementp = LLStatViewer::SimMeasurementSampler::getInstance((ESimStatID)stat_id);
+
+ if (measurementp )
+ {
+ measurementp->sample(stat_value);
+ }
+ else
+ {
+ LL_WARNS() << "Unknown sim stat identifier: " << stat_id << LL_ENDL;
+ }
+ }
+
+ //
+ // Various hacks that aren't statistics, but are being handled here.
+ //
+ U32 max_tasks_per_region;
+ U64 region_flags;
+ msg->getU32("Region", "ObjectCapacity", max_tasks_per_region);
+
+ if (msg->has(_PREHASH_RegionInfo))
+ {
+ msg->getU64("RegionInfo", "RegionFlagsExtended", region_flags);
+ }
+ else
+ {
+ U32 flags = 0;
+ msg->getU32("Region", "RegionFlags", flags);
+ region_flags = flags;
+ }
+
+ LLViewerRegion* regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ BOOL was_flying = gAgent.getFlying();
+ regionp->setRegionFlags(region_flags);
+ regionp->setMaxTasks(max_tasks_per_region);
+ // HACK: This makes agents drop from the sky if the region is
+ // set to no fly while people are still in the sim.
+ if (was_flying && regionp->getBlockFly())
+ {
+ gAgent.setFlying(gAgent.canFly());
+ }
+ }
}
void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data)
{
- LLUUID animation_id;
- LLUUID uuid;
- S32 anim_sequence_id;
- LLVOAvatar *avatarp = NULL;
-
- mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid);
+ LLUUID animation_id;
+ LLUUID uuid;
+ S32 anim_sequence_id;
+ LLVOAvatar *avatarp = NULL;
+
+ mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid);
- LLViewerObject *objp = gObjectList.findObject(uuid);
+ LLViewerObject *objp = gObjectList.findObject(uuid);
if (objp)
{
avatarp = objp->asAvatar();
}
- if (!avatarp)
- {
- // no agent by this ID...error?
- LL_WARNS("Messaging") << "Received animation state for unknown avatar " << uuid << LL_ENDL;
- return;
- }
-
- S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList);
- S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList);
-
- LL_DEBUGS("Messaging", "Motion") << "Processing " << num_blocks << " Animations" << LL_ENDL;
-
- //clear animation flags
- avatarp->mSignaledAnimations.clear();
-
- if (avatarp->isSelf())
- {
- LLUUID object_id;
-
- for( S32 i = 0; i < num_blocks; i++ )
- {
- mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i);
- mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i);
-
- avatarp->mSignaledAnimations[animation_id] = anim_sequence_id;
-
- // *HACK: Disabling flying mode if it has been enabled shortly before the agent
- // stand up animation is signaled. In this case we don't get a signal to start
- // flying animation from server, the AGENT_CONTROL_FLY flag remains set but the
- // avatar does not play flying animation, so we switch flying mode off.
- // See LLAgent::setFlying(). This may cause "Stop Flying" button to blink.
- // See EXT-2781.
- if (animation_id == ANIM_AGENT_STANDUP && gAgent.getFlying())
- {
- gAgent.setFlying(FALSE);
- }
-
- if (i < num_source_blocks)
- {
- mesgsys->getUUIDFast(_PREHASH_AnimationSourceList, _PREHASH_ObjectID, object_id, i);
-
- LLViewerObject* object = gObjectList.findObject(object_id);
- if (object)
- {
- object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, TRUE);
-
- BOOL anim_found = FALSE;
- LLVOAvatar::AnimSourceIterator anim_it = avatarp->mAnimationSources.find(object_id);
- for (;anim_it != avatarp->mAnimationSources.end(); ++anim_it)
- {
- if (anim_it->first != object_id)
- {
- // elements with the same key are always contiguous, bail if we went past the
- // end of this object's animations
- break;
- }
- if (anim_it->second == animation_id)
- {
- anim_found = TRUE;
- break;
- }
- }
-
- if (!anim_found)
- {
- avatarp->mAnimationSources.insert(LLVOAvatar::AnimationSourceMap::value_type(object_id, animation_id));
- }
- }
- LL_DEBUGS("Messaging", "Motion") << "Anim sequence ID: " << anim_sequence_id
- << " Animation id: " << animation_id
- << " From block: " << object_id << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("Messaging", "Motion") << "Anim sequence ID: " << anim_sequence_id
- << " Animation id: " << animation_id << LL_ENDL;
- }
- }
- }
- else
- {
- for( S32 i = 0; i < num_blocks; i++ )
- {
- mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i);
- mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i);
- avatarp->mSignaledAnimations[animation_id] = anim_sequence_id;
- }
- }
-
- if (num_blocks)
- {
- avatarp->processAnimationStateChanges();
- }
+ if (!avatarp)
+ {
+ // no agent by this ID...error?
+ LL_WARNS("Messaging") << "Received animation state for unknown avatar " << uuid << LL_ENDL;
+ return;
+ }
+
+ S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList);
+ S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList);
+
+ LL_DEBUGS("Messaging", "Motion") << "Processing " << num_blocks << " Animations" << LL_ENDL;
+
+ //clear animation flags
+ avatarp->mSignaledAnimations.clear();
+
+ if (avatarp->isSelf())
+ {
+ LLUUID object_id;
+
+ for( S32 i = 0; i < num_blocks; i++ )
+ {
+ mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i);
+ mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i);
+
+ avatarp->mSignaledAnimations[animation_id] = anim_sequence_id;
+
+ // *HACK: Disabling flying mode if it has been enabled shortly before the agent
+ // stand up animation is signaled. In this case we don't get a signal to start
+ // flying animation from server, the AGENT_CONTROL_FLY flag remains set but the
+ // avatar does not play flying animation, so we switch flying mode off.
+ // See LLAgent::setFlying(). This may cause "Stop Flying" button to blink.
+ // See EXT-2781.
+ if (animation_id == ANIM_AGENT_STANDUP && gAgent.getFlying())
+ {
+ gAgent.setFlying(FALSE);
+ }
+
+ if (i < num_source_blocks)
+ {
+ mesgsys->getUUIDFast(_PREHASH_AnimationSourceList, _PREHASH_ObjectID, object_id, i);
+
+ LLViewerObject* object = gObjectList.findObject(object_id);
+ if (object)
+ {
+ object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, TRUE);
+
+ BOOL anim_found = FALSE;
+ LLVOAvatar::AnimSourceIterator anim_it = avatarp->mAnimationSources.find(object_id);
+ for (;anim_it != avatarp->mAnimationSources.end(); ++anim_it)
+ {
+ if (anim_it->first != object_id)
+ {
+ // elements with the same key are always contiguous, bail if we went past the
+ // end of this object's animations
+ break;
+ }
+ if (anim_it->second == animation_id)
+ {
+ anim_found = TRUE;
+ break;
+ }
+ }
+
+ if (!anim_found)
+ {
+ avatarp->mAnimationSources.insert(LLVOAvatar::AnimationSourceMap::value_type(object_id, animation_id));
+ }
+ }
+ LL_DEBUGS("Messaging", "Motion") << "Anim sequence ID: " << anim_sequence_id
+ << " Animation id: " << animation_id
+ << " From block: " << object_id << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("Messaging", "Motion") << "Anim sequence ID: " << anim_sequence_id
+ << " Animation id: " << animation_id << LL_ENDL;
+ }
+ }
+ }
+ else
+ {
+ for( S32 i = 0; i < num_blocks; i++ )
+ {
+ mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i);
+ mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i);
+ avatarp->mSignaledAnimations[animation_id] = anim_sequence_id;
+ }
+ }
+
+ if (num_blocks)
+ {
+ avatarp->processAnimationStateChanges();
+ }
}
void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
{
- LLUUID animation_id;
- LLUUID uuid;
- S32 anim_sequence_id;
-
- mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid);
+ LLUUID animation_id;
+ LLUUID uuid;
+ S32 anim_sequence_id;
+
+ mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid);
LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for object " << uuid << LL_ENDL;
signaled_animation_map_t signaled_anims;
- S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList);
- LL_DEBUGS("AnimatedObjectsNotify") << "processing object animation requests, num_blocks " << num_blocks << " uuid " << uuid << LL_ENDL;
+ S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList);
+ LL_DEBUGS("AnimatedObjectsNotify") << "processing object animation requests, num_blocks " << num_blocks << " uuid " << uuid << LL_ENDL;
for( S32 i = 0; i < num_blocks; i++ )
{
mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i);
mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i);
signaled_anims[animation_id] = anim_sequence_id;
- LL_DEBUGS("AnimatedObjectsNotify") << "added signaled_anims animation request for object "
+ LL_DEBUGS("AnimatedObjectsNotify") << "added signaled_anims animation request for object "
<< uuid << " animation id " << animation_id << LL_ENDL;
}
LLObjectSignaledAnimationMap::instance().getMap()[uuid] = signaled_anims;
-
+
LLViewerObject *objp = gObjectList.findObject(uuid);
if (!objp || objp->isDead())
{
- LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for unknown object " << uuid << LL_ENDL;
+ LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for unknown object " << uuid << LL_ENDL;
return;
}
-
- LLVOVolume *volp = dynamic_cast<LLVOVolume*>(objp);
+
+ LLVOVolume *volp = dynamic_cast<LLVOVolume*>(objp);
if (!volp)
{
- LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for non-volume object " << uuid << LL_ENDL;
+ LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for non-volume object " << uuid << LL_ENDL;
return;
}
if (!volp->isAnimatedObject())
{
- LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for non-animated object " << uuid << LL_ENDL;
+ LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for non-animated object " << uuid << LL_ENDL;
return;
}
@@ -4259,7 +4259,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
LL_DEBUGS("AnimatedObjectsNotify") << "Received animation request for object with no control avatar, ignoring " << uuid << LL_ENDL;
return;
}
-
+
if (!avatarp->mPlaying)
{
avatarp->mPlaying = true;
@@ -4269,315 +4269,315 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
avatarp->mRootVolp->recursiveMarkForUpdate();
}
}
-
+
avatarp->updateAnimations();
}
void process_avatar_appearance(LLMessageSystem *mesgsys, void **user_data)
{
- LLUUID uuid;
- mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid);
+ LLUUID uuid;
+ mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid);
- LLVOAvatar* avatarp = (LLVOAvatar *)gObjectList.findObject(uuid);
- if (avatarp)
- {
- avatarp->processAvatarAppearance( mesgsys );
- }
- else
- {
- LL_WARNS("Messaging") << "avatar_appearance sent for unknown avatar " << uuid << LL_ENDL;
- }
+ LLVOAvatar* avatarp = (LLVOAvatar *)gObjectList.findObject(uuid);
+ if (avatarp)
+ {
+ avatarp->processAvatarAppearance( mesgsys );
+ }
+ else
+ {
+ LL_WARNS("Messaging") << "avatar_appearance sent for unknown avatar " << uuid << LL_ENDL;
+ }
}
void process_camera_constraint(LLMessageSystem *mesgsys, void **user_data)
{
- LLVector4 cameraCollidePlane;
- mesgsys->getVector4Fast(_PREHASH_CameraCollidePlane, _PREHASH_Plane, cameraCollidePlane);
+ LLVector4 cameraCollidePlane;
+ mesgsys->getVector4Fast(_PREHASH_CameraCollidePlane, _PREHASH_Plane, cameraCollidePlane);
- gAgentCamera.setCameraCollidePlane(cameraCollidePlane);
+ gAgentCamera.setCameraCollidePlane(cameraCollidePlane);
}
void near_sit_object(BOOL success, void *data)
{
- if (success)
- {
- // Send message to sit on object
- gMessageSystem->newMessageFast(_PREHASH_AgentSit);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gAgent.sendReliableMessage();
- }
+ if (success)
+ {
+ // Send message to sit on object
+ gMessageSystem->newMessageFast(_PREHASH_AgentSit);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gAgent.sendReliableMessage();
+ }
}
void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
{
- LLVector3 sitPosition;
- LLQuaternion sitRotation;
- LLUUID sitObjectID;
- BOOL use_autopilot;
- mesgsys->getUUIDFast(_PREHASH_SitObject, _PREHASH_ID, sitObjectID);
- mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_AutoPilot, use_autopilot);
- mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_SitPosition, sitPosition);
- mesgsys->getQuatFast(_PREHASH_SitTransform, _PREHASH_SitRotation, sitRotation);
- LLVector3 camera_eye;
- mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraEyeOffset, camera_eye);
- LLVector3 camera_at;
- mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraAtOffset, camera_at);
- BOOL force_mouselook;
- mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook);
-
- if (isAgentAvatarValid() && dist_vec_squared(camera_eye, camera_at) > CAMERA_POSITION_THRESHOLD_SQUARED)
- {
- gAgentCamera.setSitCamera(sitObjectID, camera_eye, camera_at);
- }
-
- gAgentCamera.setForceMouselook(force_mouselook);
- // Forcing turning off flying here to prevent flying after pressing "Stand"
- // to stand up from an object. See EXT-1655.
- gAgent.setFlying(FALSE);
-
- LLViewerObject* object = gObjectList.findObject(sitObjectID);
- if (object)
- {
- LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation());
- if (!use_autopilot || (isAgentAvatarValid() && gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == object->getRoot()))
- {
- //we're already sitting on this object, so don't autopilot
- }
- else
- {
- gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(sit_spot), "Sit", &sitRotation, near_sit_object, NULL, 0.5f);
- }
- }
- else
- {
- LL_WARNS("Messaging") << "Received sit approval for unknown object " << sitObjectID << LL_ENDL;
- }
+ LLVector3 sitPosition;
+ LLQuaternion sitRotation;
+ LLUUID sitObjectID;
+ BOOL use_autopilot;
+ mesgsys->getUUIDFast(_PREHASH_SitObject, _PREHASH_ID, sitObjectID);
+ mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_AutoPilot, use_autopilot);
+ mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_SitPosition, sitPosition);
+ mesgsys->getQuatFast(_PREHASH_SitTransform, _PREHASH_SitRotation, sitRotation);
+ LLVector3 camera_eye;
+ mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraEyeOffset, camera_eye);
+ LLVector3 camera_at;
+ mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraAtOffset, camera_at);
+ BOOL force_mouselook;
+ mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook);
+
+ if (isAgentAvatarValid() && dist_vec_squared(camera_eye, camera_at) > CAMERA_POSITION_THRESHOLD_SQUARED)
+ {
+ gAgentCamera.setSitCamera(sitObjectID, camera_eye, camera_at);
+ }
+
+ gAgentCamera.setForceMouselook(force_mouselook);
+ // Forcing turning off flying here to prevent flying after pressing "Stand"
+ // to stand up from an object. See EXT-1655.
+ gAgent.setFlying(FALSE);
+
+ LLViewerObject* object = gObjectList.findObject(sitObjectID);
+ if (object)
+ {
+ LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation());
+ if (!use_autopilot || (isAgentAvatarValid() && gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == object->getRoot()))
+ {
+ //we're already sitting on this object, so don't autopilot
+ }
+ else
+ {
+ gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(sit_spot), "Sit", &sitRotation, near_sit_object, NULL, 0.5f);
+ }
+ }
+ else
+ {
+ LL_WARNS("Messaging") << "Received sit approval for unknown object " << sitObjectID << LL_ENDL;
+ }
}
void process_clear_follow_cam_properties(LLMessageSystem *mesgsys, void **user_data)
{
- LLUUID source_id;
+ LLUUID source_id;
- mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, source_id);
+ mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, source_id);
- LLFollowCamMgr::getInstance()->removeFollowCamParams(source_id);
+ LLFollowCamMgr::getInstance()->removeFollowCamParams(source_id);
}
void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_data)
{
- S32 type;
- F32 value;
- bool settingPosition = false;
- bool settingFocus = false;
- bool settingFocusOffset = false;
- LLVector3 position;
- LLVector3 focus;
- LLVector3 focus_offset;
-
- LLUUID source_id;
-
- mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, source_id);
-
- LLViewerObject* objectp = gObjectList.findObject(source_id);
- if (objectp)
- {
- objectp->setFlagsWithoutUpdate(FLAGS_CAMERA_SOURCE, TRUE);
- }
-
- S32 num_objects = mesgsys->getNumberOfBlocks("CameraProperty");
- for (S32 block_index = 0; block_index < num_objects; block_index++)
- {
- mesgsys->getS32("CameraProperty", "Type", type, block_index);
- mesgsys->getF32("CameraProperty", "Value", value, block_index);
- switch(type)
- {
- case FOLLOWCAM_PITCH:
- LLFollowCamMgr::getInstance()->setPitch(source_id, value);
- break;
- case FOLLOWCAM_FOCUS_OFFSET_X:
- focus_offset.mV[VX] = value;
- settingFocusOffset = true;
- break;
- case FOLLOWCAM_FOCUS_OFFSET_Y:
- focus_offset.mV[VY] = value;
- settingFocusOffset = true;
- break;
- case FOLLOWCAM_FOCUS_OFFSET_Z:
- focus_offset.mV[VZ] = value;
- settingFocusOffset = true;
- break;
- case FOLLOWCAM_POSITION_LAG:
- LLFollowCamMgr::getInstance()->setPositionLag(source_id, value);
- break;
- case FOLLOWCAM_FOCUS_LAG:
- LLFollowCamMgr::getInstance()->setFocusLag(source_id, value);
- break;
- case FOLLOWCAM_DISTANCE:
- LLFollowCamMgr::getInstance()->setDistance(source_id, value);
- break;
- case FOLLOWCAM_BEHINDNESS_ANGLE:
- LLFollowCamMgr::getInstance()->setBehindnessAngle(source_id, value);
- break;
- case FOLLOWCAM_BEHINDNESS_LAG:
- LLFollowCamMgr::getInstance()->setBehindnessLag(source_id, value);
- break;
- case FOLLOWCAM_POSITION_THRESHOLD:
- LLFollowCamMgr::getInstance()->setPositionThreshold(source_id, value);
- break;
- case FOLLOWCAM_FOCUS_THRESHOLD:
- LLFollowCamMgr::getInstance()->setFocusThreshold(source_id, value);
- break;
- case FOLLOWCAM_ACTIVE:
- //if 1, set using followcam,.
- LLFollowCamMgr::getInstance()->setCameraActive(source_id, value != 0.f);
- break;
- case FOLLOWCAM_POSITION_X:
- settingPosition = true;
- position.mV[ 0 ] = value;
- break;
- case FOLLOWCAM_POSITION_Y:
- settingPosition = true;
- position.mV[ 1 ] = value;
- break;
- case FOLLOWCAM_POSITION_Z:
- settingPosition = true;
- position.mV[ 2 ] = value;
- break;
- case FOLLOWCAM_FOCUS_X:
- settingFocus = true;
- focus.mV[ 0 ] = value;
- break;
- case FOLLOWCAM_FOCUS_Y:
- settingFocus = true;
- focus.mV[ 1 ] = value;
- break;
- case FOLLOWCAM_FOCUS_Z:
- settingFocus = true;
- focus.mV[ 2 ] = value;
- break;
- case FOLLOWCAM_POSITION_LOCKED:
- LLFollowCamMgr::getInstance()->setPositionLocked(source_id, value != 0.f);
- break;
- case FOLLOWCAM_FOCUS_LOCKED:
- LLFollowCamMgr::getInstance()->setFocusLocked(source_id, value != 0.f);
- break;
-
- default:
- break;
- }
- }
-
- if ( settingPosition )
- {
- LLFollowCamMgr::getInstance()->setPosition(source_id, position);
- }
- if ( settingFocus )
- {
- LLFollowCamMgr::getInstance()->setFocus(source_id, focus);
- }
- if ( settingFocusOffset )
- {
- LLFollowCamMgr::getInstance()->setFocusOffset(source_id, focus_offset);
- }
-}
-//end Ventrella
+ S32 type;
+ F32 value;
+ bool settingPosition = false;
+ bool settingFocus = false;
+ bool settingFocusOffset = false;
+ LLVector3 position;
+ LLVector3 focus;
+ LLVector3 focus_offset;
+
+ LLUUID source_id;
+
+ mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, source_id);
+
+ LLViewerObject* objectp = gObjectList.findObject(source_id);
+ if (objectp)
+ {
+ objectp->setFlagsWithoutUpdate(FLAGS_CAMERA_SOURCE, TRUE);
+ }
+
+ S32 num_objects = mesgsys->getNumberOfBlocks("CameraProperty");
+ for (S32 block_index = 0; block_index < num_objects; block_index++)
+ {
+ mesgsys->getS32("CameraProperty", "Type", type, block_index);
+ mesgsys->getF32("CameraProperty", "Value", value, block_index);
+ switch(type)
+ {
+ case FOLLOWCAM_PITCH:
+ LLFollowCamMgr::getInstance()->setPitch(source_id, value);
+ break;
+ case FOLLOWCAM_FOCUS_OFFSET_X:
+ focus_offset.mV[VX] = value;
+ settingFocusOffset = true;
+ break;
+ case FOLLOWCAM_FOCUS_OFFSET_Y:
+ focus_offset.mV[VY] = value;
+ settingFocusOffset = true;
+ break;
+ case FOLLOWCAM_FOCUS_OFFSET_Z:
+ focus_offset.mV[VZ] = value;
+ settingFocusOffset = true;
+ break;
+ case FOLLOWCAM_POSITION_LAG:
+ LLFollowCamMgr::getInstance()->setPositionLag(source_id, value);
+ break;
+ case FOLLOWCAM_FOCUS_LAG:
+ LLFollowCamMgr::getInstance()->setFocusLag(source_id, value);
+ break;
+ case FOLLOWCAM_DISTANCE:
+ LLFollowCamMgr::getInstance()->setDistance(source_id, value);
+ break;
+ case FOLLOWCAM_BEHINDNESS_ANGLE:
+ LLFollowCamMgr::getInstance()->setBehindnessAngle(source_id, value);
+ break;
+ case FOLLOWCAM_BEHINDNESS_LAG:
+ LLFollowCamMgr::getInstance()->setBehindnessLag(source_id, value);
+ break;
+ case FOLLOWCAM_POSITION_THRESHOLD:
+ LLFollowCamMgr::getInstance()->setPositionThreshold(source_id, value);
+ break;
+ case FOLLOWCAM_FOCUS_THRESHOLD:
+ LLFollowCamMgr::getInstance()->setFocusThreshold(source_id, value);
+ break;
+ case FOLLOWCAM_ACTIVE:
+ //if 1, set using followcam,.
+ LLFollowCamMgr::getInstance()->setCameraActive(source_id, value != 0.f);
+ break;
+ case FOLLOWCAM_POSITION_X:
+ settingPosition = true;
+ position.mV[ 0 ] = value;
+ break;
+ case FOLLOWCAM_POSITION_Y:
+ settingPosition = true;
+ position.mV[ 1 ] = value;
+ break;
+ case FOLLOWCAM_POSITION_Z:
+ settingPosition = true;
+ position.mV[ 2 ] = value;
+ break;
+ case FOLLOWCAM_FOCUS_X:
+ settingFocus = true;
+ focus.mV[ 0 ] = value;
+ break;
+ case FOLLOWCAM_FOCUS_Y:
+ settingFocus = true;
+ focus.mV[ 1 ] = value;
+ break;
+ case FOLLOWCAM_FOCUS_Z:
+ settingFocus = true;
+ focus.mV[ 2 ] = value;
+ break;
+ case FOLLOWCAM_POSITION_LOCKED:
+ LLFollowCamMgr::getInstance()->setPositionLocked(source_id, value != 0.f);
+ break;
+ case FOLLOWCAM_FOCUS_LOCKED:
+ LLFollowCamMgr::getInstance()->setFocusLocked(source_id, value != 0.f);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if ( settingPosition )
+ {
+ LLFollowCamMgr::getInstance()->setPosition(source_id, position);
+ }
+ if ( settingFocus )
+ {
+ LLFollowCamMgr::getInstance()->setFocus(source_id, focus);
+ }
+ if ( settingFocusOffset )
+ {
+ LLFollowCamMgr::getInstance()->setFocusOffset(source_id, focus_offset);
+ }
+}
+//end Ventrella
// Culled from newsim lltask.cpp
void process_name_value(LLMessageSystem *mesgsys, void **user_data)
{
- std::string temp_str;
- LLUUID id;
- S32 i, num_blocks;
+ std::string temp_str;
+ LLUUID id;
+ S32 i, num_blocks;
- mesgsys->getUUIDFast(_PREHASH_TaskData, _PREHASH_ID, id);
+ mesgsys->getUUIDFast(_PREHASH_TaskData, _PREHASH_ID, id);
- LLViewerObject* object = gObjectList.findObject(id);
+ LLViewerObject* object = gObjectList.findObject(id);
- if (object)
- {
- num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData);
- for (i = 0; i < num_blocks; i++)
- {
- mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i);
- LL_INFOS("Messaging") << "Added to object Name Value: " << temp_str << LL_ENDL;
- object->addNVPair(temp_str);
- }
- }
- else
- {
- LL_INFOS("Messaging") << "Can't find object " << id << " to add name value pair" << LL_ENDL;
- }
+ if (object)
+ {
+ num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData);
+ for (i = 0; i < num_blocks; i++)
+ {
+ mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i);
+ LL_INFOS("Messaging") << "Added to object Name Value: " << temp_str << LL_ENDL;
+ object->addNVPair(temp_str);
+ }
+ }
+ else
+ {
+ LL_INFOS("Messaging") << "Can't find object " << id << " to add name value pair" << LL_ENDL;
+ }
}
void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data)
{
- std::string temp_str;
- LLUUID id;
- S32 i, num_blocks;
+ std::string temp_str;
+ LLUUID id;
+ S32 i, num_blocks;
- mesgsys->getUUIDFast(_PREHASH_TaskData, _PREHASH_ID, id);
+ mesgsys->getUUIDFast(_PREHASH_TaskData, _PREHASH_ID, id);
- LLViewerObject* object = gObjectList.findObject(id);
+ LLViewerObject* object = gObjectList.findObject(id);
- if (object)
- {
- num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData);
- for (i = 0; i < num_blocks; i++)
- {
- mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i);
- LL_INFOS("Messaging") << "Removed from object Name Value: " << temp_str << LL_ENDL;
- object->removeNVPair(temp_str);
- }
- }
- else
- {
- LL_INFOS("Messaging") << "Can't find object " << id << " to remove name value pair" << LL_ENDL;
- }
+ if (object)
+ {
+ num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData);
+ for (i = 0; i < num_blocks; i++)
+ {
+ mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i);
+ LL_INFOS("Messaging") << "Removed from object Name Value: " << temp_str << LL_ENDL;
+ object->removeNVPair(temp_str);
+ }
+ }
+ else
+ {
+ LL_INFOS("Messaging") << "Can't find object " << id << " to remove name value pair" << LL_ENDL;
+ }
}
void process_kick_user(LLMessageSystem *msg, void** /*user_data*/)
{
- std::string message;
+ std::string message;
- msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, message);
+ msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, message);
- LLAppViewer::instance()->forceDisconnect(message);
+ LLAppViewer::instance()->forceDisconnect(message);
}
/*
void process_user_list_reply(LLMessageSystem *msg, void **user_data)
{
- LLUserList::processUserListReply(msg, user_data);
- return;
- char firstname[MAX_STRING+1];
- char lastname[MAX_STRING+1];
- U8 status;
- S32 user_count;
-
- user_count = msg->getNumberOfBlocks("UserBlock");
-
- for (S32 i = 0; i < user_count; i++)
- {
- msg->getData("UserBlock", i, "FirstName", firstname);
- msg->getData("UserBlock", i, "LastName", lastname);
- msg->getData("UserBlock", i, "Status", &status);
-
- if (status & 0x01)
- {
- dialog_friends_add_friend(buffer, TRUE);
- }
- else
- {
- dialog_friends_add_friend(buffer, FALSE);
- }
- }
-
- dialog_friends_done_adding();
+ LLUserList::processUserListReply(msg, user_data);
+ return;
+ char firstname[MAX_STRING+1];
+ char lastname[MAX_STRING+1];
+ U8 status;
+ S32 user_count;
+
+ user_count = msg->getNumberOfBlocks("UserBlock");
+
+ for (S32 i = 0; i < user_count; i++)
+ {
+ msg->getData("UserBlock", i, "FirstName", firstname);
+ msg->getData("UserBlock", i, "LastName", lastname);
+ msg->getData("UserBlock", i, "Status", &status);
+
+ if (status & 0x01)
+ {
+ dialog_friends_add_friend(buffer, TRUE);
+ }
+ else
+ {
+ dialog_friends_add_friend(buffer, FALSE);
+ }
+ }
+
+ dialog_friends_done_adding();
}
*/
@@ -4585,163 +4585,163 @@ void process_user_list_reply(LLMessageSystem *msg, void **user_data)
/*
void process_time_dilation(LLMessageSystem *msg, void **user_data)
{
- // get the time_dilation
- U16 foo;
- msg->getData("TimeDilation", "TimeDilation", &foo);
- F32 time_dilation = ((F32) foo) / 65535.f;
+ // get the time_dilation
+ U16 foo;
+ msg->getData("TimeDilation", "TimeDilation", &foo);
+ F32 time_dilation = ((F32) foo) / 65535.f;
- // get the pointer to the right region
- U32 ip = msg->getSenderIP();
- U32 port = msg->getSenderPort();
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(ip, port);
- if (regionp)
- {
- regionp->setTimeDilation(time_dilation);
- }
+ // get the pointer to the right region
+ U32 ip = msg->getSenderIP();
+ U32 port = msg->getSenderPort();
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(ip, port);
+ if (regionp)
+ {
+ regionp->setTimeDilation(time_dilation);
+ }
}
*/
void process_money_balance_reply( LLMessageSystem* msg, void** )
{
- S32 balance = 0;
- S32 credit = 0;
- S32 committed = 0;
- std::string desc;
- LLUUID tid;
-
- msg->getUUID("MoneyData", "TransactionID", tid);
- msg->getS32("MoneyData", "MoneyBalance", balance);
- msg->getS32("MoneyData", "SquareMetersCredit", credit);
- msg->getS32("MoneyData", "SquareMetersCommitted", committed);
- msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description, desc);
- LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " "
- << committed << LL_ENDL;
-
- if (gStatusBar)
- {
- gStatusBar->setBalance(balance);
- gStatusBar->setLandCredit(credit);
- gStatusBar->setLandCommitted(committed);
- }
-
- if (desc.empty()
- || !gSavedSettings.getBOOL("NotifyMoneyChange"))
- {
- // ...nothing to display
- return;
- }
-
- // Suppress duplicate messages about the same transaction
- static std::deque<LLUUID> recent;
- if (std::find(recent.rbegin(), recent.rend(), tid) != recent.rend())
- {
- return;
- }
-
- // Once the 'recent' container gets large enough, chop some
- // off the beginning.
- const U32 MAX_LOOKBACK = 30;
- const S32 POP_FRONT_SIZE = 12;
- if(recent.size() > MAX_LOOKBACK)
- {
- LL_DEBUGS("Messaging") << "Removing oldest transaction records" << LL_ENDL;
- recent.erase(recent.begin(), recent.begin() + POP_FRONT_SIZE);
- }
- //LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL;
- recent.push_back(tid);
-
- if (msg->has("TransactionInfo"))
- {
- // ...message has extended info for localization
- process_money_balance_reply_extended(msg);
- }
- else
- {
- // Only old dev grids will not supply the TransactionInfo block,
- // so we can just use the hard-coded English string.
- LLSD args;
- args["MESSAGE"] = desc;
- LLNotificationsUtil::add("SystemMessage", args);
- }
+ S32 balance = 0;
+ S32 credit = 0;
+ S32 committed = 0;
+ std::string desc;
+ LLUUID tid;
+
+ msg->getUUID("MoneyData", "TransactionID", tid);
+ msg->getS32("MoneyData", "MoneyBalance", balance);
+ msg->getS32("MoneyData", "SquareMetersCredit", credit);
+ msg->getS32("MoneyData", "SquareMetersCommitted", committed);
+ msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description, desc);
+ LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " "
+ << committed << LL_ENDL;
+
+ if (gStatusBar)
+ {
+ gStatusBar->setBalance(balance);
+ gStatusBar->setLandCredit(credit);
+ gStatusBar->setLandCommitted(committed);
+ }
+
+ if (desc.empty()
+ || !gSavedSettings.getBOOL("NotifyMoneyChange"))
+ {
+ // ...nothing to display
+ return;
+ }
+
+ // Suppress duplicate messages about the same transaction
+ static std::deque<LLUUID> recent;
+ if (std::find(recent.rbegin(), recent.rend(), tid) != recent.rend())
+ {
+ return;
+ }
+
+ // Once the 'recent' container gets large enough, chop some
+ // off the beginning.
+ const U32 MAX_LOOKBACK = 30;
+ const S32 POP_FRONT_SIZE = 12;
+ if(recent.size() > MAX_LOOKBACK)
+ {
+ LL_DEBUGS("Messaging") << "Removing oldest transaction records" << LL_ENDL;
+ recent.erase(recent.begin(), recent.begin() + POP_FRONT_SIZE);
+ }
+ //LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL;
+ recent.push_back(tid);
+
+ if (msg->has("TransactionInfo"))
+ {
+ // ...message has extended info for localization
+ process_money_balance_reply_extended(msg);
+ }
+ else
+ {
+ // Only old dev grids will not supply the TransactionInfo block,
+ // so we can just use the hard-coded English string.
+ LLSD args;
+ args["MESSAGE"] = desc;
+ LLNotificationsUtil::add("SystemMessage", args);
+ }
}
static std::string reason_from_transaction_type(S32 transaction_type,
- const std::string& item_desc)
-{
- // *NOTE: The keys for the reason strings are unusual because
- // an earlier version of the code used English language strings
- // extracted from hard-coded server English descriptions.
- // Keeping them so we don't have to re-localize them.
- switch (transaction_type)
- {
- case TRANS_OBJECT_SALE:
- {
- LLStringUtil::format_map_t arg;
- arg["ITEM"] = item_desc;
- return LLTrans::getString("for item", arg);
- }
- case TRANS_LAND_SALE:
- return LLTrans::getString("for a parcel of land");
-
- case TRANS_LAND_PASS_SALE:
- return LLTrans::getString("for a land access pass");
-
- case TRANS_GROUP_LAND_DEED:
- return LLTrans::getString("for deeding land");
-
- case TRANS_GROUP_CREATE:
- return LLTrans::getString("to create a group");
-
- case TRANS_GROUP_JOIN:
- return LLTrans::getString("to join a group");
-
- case TRANS_UPLOAD_CHARGE:
- return LLTrans::getString("to upload");
-
- case TRANS_CLASSIFIED_CHARGE:
- return LLTrans::getString("to publish a classified ad");
-
- case TRANS_GIFT:
- // Simulator returns "Payment" if no custom description has been entered
- return (item_desc == "Payment" ? std::string() : item_desc);
-
- // These have no reason to display, but are expected and should not
- // generate warnings
- case TRANS_PAY_OBJECT:
- case TRANS_OBJECT_PAYS:
- return std::string();
-
- default:
- LL_WARNS() << "Unknown transaction type "
- << transaction_type << LL_ENDL;
- return std::string();
- }
+ const std::string& item_desc)
+{
+ // *NOTE: The keys for the reason strings are unusual because
+ // an earlier version of the code used English language strings
+ // extracted from hard-coded server English descriptions.
+ // Keeping them so we don't have to re-localize them.
+ switch (transaction_type)
+ {
+ case TRANS_OBJECT_SALE:
+ {
+ LLStringUtil::format_map_t arg;
+ arg["ITEM"] = item_desc;
+ return LLTrans::getString("for item", arg);
+ }
+ case TRANS_LAND_SALE:
+ return LLTrans::getString("for a parcel of land");
+
+ case TRANS_LAND_PASS_SALE:
+ return LLTrans::getString("for a land access pass");
+
+ case TRANS_GROUP_LAND_DEED:
+ return LLTrans::getString("for deeding land");
+
+ case TRANS_GROUP_CREATE:
+ return LLTrans::getString("to create a group");
+
+ case TRANS_GROUP_JOIN:
+ return LLTrans::getString("to join a group");
+
+ case TRANS_UPLOAD_CHARGE:
+ return LLTrans::getString("to upload");
+
+ case TRANS_CLASSIFIED_CHARGE:
+ return LLTrans::getString("to publish a classified ad");
+
+ case TRANS_GIFT:
+ // Simulator returns "Payment" if no custom description has been entered
+ return (item_desc == "Payment" ? std::string() : item_desc);
+
+ // These have no reason to display, but are expected and should not
+ // generate warnings
+ case TRANS_PAY_OBJECT:
+ case TRANS_OBJECT_PAYS:
+ return std::string();
+
+ default:
+ LL_WARNS() << "Unknown transaction type "
+ << transaction_type << LL_ENDL;
+ return std::string();
+ }
}
static void money_balance_group_notify(const LLUUID& group_id,
- const std::string& name,
- bool is_group,
- std::string notification,
- LLSD args,
- LLSD payload)
+ const std::string& name,
+ bool is_group,
+ std::string notification,
+ LLSD args,
+ LLSD payload)
{
- // Message uses name SLURLs, don't actually have to substitute in
- // the name. We're just making sure it's available.
- // Notification is either PaymentReceived or PaymentSent
- LLNotificationsUtil::add(notification, args, payload);
+ // Message uses name SLURLs, don't actually have to substitute in
+ // the name. We're just making sure it's available.
+ // Notification is either PaymentReceived or PaymentSent
+ LLNotificationsUtil::add(notification, args, payload);
}
static void money_balance_avatar_notify(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- std::string notification,
- LLSD args,
- LLSD payload)
+ const LLAvatarName& av_name,
+ std::string notification,
+ LLSD args,
+ LLSD payload)
{
- // Message uses name SLURLs, don't actually have to substitute in
- // the name. We're just making sure it's available.
- // Notification is either PaymentReceived or PaymentSent
- LLNotificationsUtil::add(notification, args, payload);
+ // Message uses name SLURLs, don't actually have to substitute in
+ // the name. We're just making sure it's available.
+ // Notification is either PaymentReceived or PaymentSent
+ LLNotificationsUtil::add(notification, args, payload);
}
static void process_money_balance_reply_extended(LLMessageSystem* msg)
@@ -4750,470 +4750,470 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
// and agent ids for name lookup.
S32 transaction_type = 0;
LLUUID source_id;
- BOOL is_source_group = FALSE;
+ BOOL is_source_group = FALSE;
LLUUID dest_id;
- BOOL is_dest_group = FALSE;
+ BOOL is_dest_group = FALSE;
S32 amount = 0;
std::string item_description;
- BOOL success = FALSE;
+ BOOL success = FALSE;
msg->getS32("TransactionInfo", "TransactionType", transaction_type);
msg->getUUID("TransactionInfo", "SourceID", source_id);
- msg->getBOOL("TransactionInfo", "IsSourceGroup", is_source_group);
+ msg->getBOOL("TransactionInfo", "IsSourceGroup", is_source_group);
msg->getUUID("TransactionInfo", "DestID", dest_id);
- msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group);
+ msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group);
msg->getS32("TransactionInfo", "Amount", amount);
msg->getString("TransactionInfo", "ItemDescription", item_description);
- msg->getBOOL("MoneyData", "TransactionSuccess", success);
- LL_INFOS("Money") << "MoneyBalanceReply source " << source_id
- << " dest " << dest_id
- << " type " << transaction_type
- << " item " << item_description << LL_ENDL;
-
- if (source_id.isNull() && dest_id.isNull())
- {
- // this is a pure balance update, no notification required
- return;
- }
-
- std::string source_slurl;
- if (is_source_group)
- {
- source_slurl =
- LLSLURL( "group", source_id, "inspect").getSLURLString();
- }
- else
- {
- source_slurl =
- LLSLURL( "agent", source_id, "completename").getSLURLString();
- }
-
- std::string dest_slurl;
- if (is_dest_group)
- {
- dest_slurl =
- LLSLURL( "group", dest_id, "inspect").getSLURLString();
- }
- else
- {
- dest_slurl =
- LLSLURL( "agent", dest_id, "completename").getSLURLString();
- }
-
- std::string reason =
- reason_from_transaction_type(transaction_type, item_description);
-
- LLStringUtil::format_map_t args;
- args["REASON"] = reason; // could be empty
- args["AMOUNT"] = llformat("%d", amount);
-
- // Need to delay until name looked up, so need to know whether or not
- // is group
- bool is_name_group = false;
- LLUUID name_id;
- std::string message;
- std::string notification;
- LLSD final_args;
- LLSD payload;
-
- bool you_paid_someone = (source_id == gAgentID);
- std::string gift_suffix = (transaction_type == TRANS_GIFT ? "_gift" : "");
- if (you_paid_someone)
- {
- if(!gSavedSettings.getBOOL("NotifyMoneySpend"))
- {
- return;
- }
- args["NAME"] = dest_slurl;
- is_name_group = is_dest_group;
- name_id = dest_id;
- if (!reason.empty())
- {
- if (dest_id.notNull())
- {
- message = success ? LLTrans::getString("you_paid_ldollars" + gift_suffix, args) :
- LLTrans::getString("you_paid_failure_ldollars" + gift_suffix, args);
- }
- else
- {
- // transaction fee to the system, eg, to create a group
- message = success ? LLTrans::getString("you_paid_ldollars_no_name", args) :
- LLTrans::getString("you_paid_failure_ldollars_no_name", args);
- }
- }
- else
- {
- if (dest_id.notNull())
- {
- message = success ? LLTrans::getString("you_paid_ldollars_no_reason", args) :
- LLTrans::getString("you_paid_failure_ldollars_no_reason", args);
- }
- else
- {
- // no target, no reason, you just paid money
- message = success ? LLTrans::getString("you_paid_ldollars_no_info", args) :
- LLTrans::getString("you_paid_failure_ldollars_no_info", args);
- }
- }
- final_args["MESSAGE"] = message;
- payload["dest_id"] = dest_id;
- notification = success ? "PaymentSent" : "PaymentFailure";
- }
- else
- {
- // ...someone paid you
- if(!gSavedSettings.getBOOL("NotifyMoneyReceived"))
- {
- return;
- }
- args["NAME"] = source_slurl;
- is_name_group = is_source_group;
- name_id = source_id;
-
- if (!reason.empty() && !LLMuteList::getInstance()->isMuted(source_id))
- {
- message = LLTrans::getString("paid_you_ldollars" + gift_suffix, args);
- }
- else
- {
- message = LLTrans::getString("paid_you_ldollars_no_reason", args);
- }
- final_args["MESSAGE"] = message;
-
- // make notification loggable
- payload["from_id"] = source_id;
- notification = "PaymentReceived";
- }
-
- // Despite using SLURLs, wait until the name is available before
- // showing the notification, otherwise the UI layout is strange and
- // the user sees a "Loading..." message
- if (is_name_group)
- {
- gCacheName->getGroup(name_id,
- boost::bind(&money_balance_group_notify,
- _1, _2, _3,
- notification, final_args, payload));
- }
- else
- {
- LLAvatarNameCache::get(name_id, boost::bind(&money_balance_avatar_notify, _1, _2, notification, final_args, payload));
- }
+ msg->getBOOL("MoneyData", "TransactionSuccess", success);
+ LL_INFOS("Money") << "MoneyBalanceReply source " << source_id
+ << " dest " << dest_id
+ << " type " << transaction_type
+ << " item " << item_description << LL_ENDL;
+
+ if (source_id.isNull() && dest_id.isNull())
+ {
+ // this is a pure balance update, no notification required
+ return;
+ }
+
+ std::string source_slurl;
+ if (is_source_group)
+ {
+ source_slurl =
+ LLSLURL( "group", source_id, "inspect").getSLURLString();
+ }
+ else
+ {
+ source_slurl =
+ LLSLURL( "agent", source_id, "completename").getSLURLString();
+ }
+
+ std::string dest_slurl;
+ if (is_dest_group)
+ {
+ dest_slurl =
+ LLSLURL( "group", dest_id, "inspect").getSLURLString();
+ }
+ else
+ {
+ dest_slurl =
+ LLSLURL( "agent", dest_id, "completename").getSLURLString();
+ }
+
+ std::string reason =
+ reason_from_transaction_type(transaction_type, item_description);
+
+ LLStringUtil::format_map_t args;
+ args["REASON"] = reason; // could be empty
+ args["AMOUNT"] = llformat("%d", amount);
+
+ // Need to delay until name looked up, so need to know whether or not
+ // is group
+ bool is_name_group = false;
+ LLUUID name_id;
+ std::string message;
+ std::string notification;
+ LLSD final_args;
+ LLSD payload;
+
+ bool you_paid_someone = (source_id == gAgentID);
+ std::string gift_suffix = (transaction_type == TRANS_GIFT ? "_gift" : "");
+ if (you_paid_someone)
+ {
+ if(!gSavedSettings.getBOOL("NotifyMoneySpend"))
+ {
+ return;
+ }
+ args["NAME"] = dest_slurl;
+ is_name_group = is_dest_group;
+ name_id = dest_id;
+ if (!reason.empty())
+ {
+ if (dest_id.notNull())
+ {
+ message = success ? LLTrans::getString("you_paid_ldollars" + gift_suffix, args) :
+ LLTrans::getString("you_paid_failure_ldollars" + gift_suffix, args);
+ }
+ else
+ {
+ // transaction fee to the system, eg, to create a group
+ message = success ? LLTrans::getString("you_paid_ldollars_no_name", args) :
+ LLTrans::getString("you_paid_failure_ldollars_no_name", args);
+ }
+ }
+ else
+ {
+ if (dest_id.notNull())
+ {
+ message = success ? LLTrans::getString("you_paid_ldollars_no_reason", args) :
+ LLTrans::getString("you_paid_failure_ldollars_no_reason", args);
+ }
+ else
+ {
+ // no target, no reason, you just paid money
+ message = success ? LLTrans::getString("you_paid_ldollars_no_info", args) :
+ LLTrans::getString("you_paid_failure_ldollars_no_info", args);
+ }
+ }
+ final_args["MESSAGE"] = message;
+ payload["dest_id"] = dest_id;
+ notification = success ? "PaymentSent" : "PaymentFailure";
+ }
+ else
+ {
+ // ...someone paid you
+ if(!gSavedSettings.getBOOL("NotifyMoneyReceived"))
+ {
+ return;
+ }
+ args["NAME"] = source_slurl;
+ is_name_group = is_source_group;
+ name_id = source_id;
+
+ if (!reason.empty() && !LLMuteList::getInstance()->isMuted(source_id))
+ {
+ message = LLTrans::getString("paid_you_ldollars" + gift_suffix, args);
+ }
+ else
+ {
+ message = LLTrans::getString("paid_you_ldollars_no_reason", args);
+ }
+ final_args["MESSAGE"] = message;
+
+ // make notification loggable
+ payload["from_id"] = source_id;
+ notification = "PaymentReceived";
+ }
+
+ // Despite using SLURLs, wait until the name is available before
+ // showing the notification, otherwise the UI layout is strange and
+ // the user sees a "Loading..." message
+ if (is_name_group)
+ {
+ gCacheName->getGroup(name_id,
+ boost::bind(&money_balance_group_notify,
+ _1, _2, _3,
+ notification, final_args, payload));
+ }
+ else
+ {
+ LLAvatarNameCache::get(name_id, boost::bind(&money_balance_avatar_notify, _1, _2, notification, final_args, payload));
+ }
}
bool handle_prompt_for_maturity_level_change_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- // set the preference to the maturity of the region we're calling
- U8 preferredMaturity = static_cast<U8>(notification["payload"]["_region_access"].asInteger());
- gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(preferredMaturity));
- }
+ if (0 == option)
+ {
+ // set the preference to the maturity of the region we're calling
+ U8 preferredMaturity = static_cast<U8>(notification["payload"]["_region_access"].asInteger());
+ gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(preferredMaturity));
+ }
- return false;
+ return false;
}
bool handle_prompt_for_maturity_level_change_and_reteleport_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- if (0 == option)
- {
- // set the preference to the maturity of the region we're calling
- U8 preferredMaturity = static_cast<U8>(notification["payload"]["_region_access"].asInteger());
- gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(preferredMaturity));
- gAgent.setMaturityRatingChangeDuringTeleport(preferredMaturity);
- gAgent.restartFailedTeleportRequest();
- }
- else
- {
- gAgent.clearTeleportRequest();
- }
-
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ if (0 == option)
+ {
+ // set the preference to the maturity of the region we're calling
+ U8 preferredMaturity = static_cast<U8>(notification["payload"]["_region_access"].asInteger());
+ gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(preferredMaturity));
+ gAgent.setMaturityRatingChangeDuringTeleport(preferredMaturity);
+ gAgent.restartFailedTeleportRequest();
+ }
+ else
+ {
+ gAgent.clearTeleportRequest();
+ }
+
+ return false;
}
// some of the server notifications need special handling. This is where we do that.
bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
{
- bool returnValue = false;
- if(llsdBlock.has("_region_access"))
- {
- U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
- std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
- LLStringUtil::toLower(regionMaturity);
- llsdBlock["REGIONMATURITY"] = regionMaturity;
- LLNotificationPtr maturityLevelNotification;
- std::string notifySuffix = "_Notify";
- if (regionAccess == SIM_ACCESS_MATURE)
- {
- if (gAgent.isTeen())
- {
- gAgent.clearTeleportRequest();
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
- returnValue = true;
-
- notifySuffix = "_NotifyAdultsOnly";
- }
- else if (gAgent.prefersPG())
- {
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
- }
- else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
- {
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
- returnValue = true;
- }
- }
- else if (regionAccess == SIM_ACCESS_ADULT)
- {
- if (!gAgent.isAdult())
- {
- gAgent.clearTeleportRequest();
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
- returnValue = true;
-
- notifySuffix = "_NotifyAdultsOnly";
- }
- else if (gAgent.prefersPG() || gAgent.prefersMature())
- {
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
- }
- else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
- {
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
- returnValue = true;
- }
- }
-
- if ((maturityLevelNotification == NULL) || maturityLevelNotification->isIgnored())
- {
- // Given a simple notification if no maturityLevelNotification is set or it is ignore
- LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock);
- }
- }
-
- return returnValue;
+ bool returnValue = false;
+ if(llsdBlock.has("_region_access"))
+ {
+ U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
+ std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
+ LLStringUtil::toLower(regionMaturity);
+ llsdBlock["REGIONMATURITY"] = regionMaturity;
+ LLNotificationPtr maturityLevelNotification;
+ std::string notifySuffix = "_Notify";
+ if (regionAccess == SIM_ACCESS_MATURE)
+ {
+ if (gAgent.isTeen())
+ {
+ gAgent.clearTeleportRequest();
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
+ returnValue = true;
+
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG())
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
+ returnValue = true;
+ }
+ }
+ else if (regionAccess == SIM_ACCESS_ADULT)
+ {
+ if (!gAgent.isAdult())
+ {
+ gAgent.clearTeleportRequest();
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
+ returnValue = true;
+
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG() || gAgent.prefersMature())
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
+ returnValue = true;
+ }
+ }
+
+ if ((maturityLevelNotification == NULL) || maturityLevelNotification->isIgnored())
+ {
+ // Given a simple notification if no maturityLevelNotification is set or it is ignore
+ LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock);
+ }
+ }
+
+ return returnValue;
}
bool handle_trusted_experiences_notification(const LLSD& llsdBlock)
{
- if(llsdBlock.has("trusted_experiences"))
- {
- std::ostringstream str;
- const LLSD& experiences = llsdBlock["trusted_experiences"];
- LLSD::array_const_iterator it = experiences.beginArray();
- for(/**/; it != experiences.endArray(); ++it)
- {
- str<<LLSLURL("experience", it->asUUID(), "profile").getSLURLString() << "\n";
- }
- std::string str_list = str.str();
- if(!str_list.empty())
- {
- LLNotificationsUtil::add("TrustedExperiencesAvailable", LLSD::emptyMap().with("EXPERIENCE_LIST", (LLSD)str_list));
- return true;
- }
- }
- return false;
+ if(llsdBlock.has("trusted_experiences"))
+ {
+ std::ostringstream str;
+ const LLSD& experiences = llsdBlock["trusted_experiences"];
+ LLSD::array_const_iterator it = experiences.beginArray();
+ for(/**/; it != experiences.endArray(); ++it)
+ {
+ str<<LLSLURL("experience", it->asUUID(), "profile").getSLURLString() << "\n";
+ }
+ std::string str_list = str.str();
+ if(!str_list.empty())
+ {
+ LLNotificationsUtil::add("TrustedExperiencesAvailable", LLSD::emptyMap().with("EXPERIENCE_LIST", (LLSD)str_list));
+ return true;
+ }
+ }
+ return false;
}
// some of the server notifications need special handling. This is where we do that.
bool handle_teleport_access_blocked(LLSD& llsdBlock, const std::string & notificationID, const std::string & defaultMessage)
{
- bool returnValue = false;
- if(llsdBlock.has("_region_access"))
- {
- U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
- std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
- LLStringUtil::toLower(regionMaturity);
- llsdBlock["REGIONMATURITY"] = regionMaturity;
-
- LLNotificationPtr tp_failure_notification;
- std::string notifySuffix;
-
- if (notificationID == std::string("TeleportEntryAccessBlocked"))
- {
- notifySuffix = "_Notify";
- if (regionAccess == SIM_ACCESS_MATURE)
- {
- if (gAgent.isTeen())
- {
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
- returnValue = true;
-
- notifySuffix = "_NotifyAdultsOnly";
- }
- else if (gAgent.prefersPG())
- {
- if (gAgent.hasRestartableFailedTeleportRequest())
- {
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
- returnValue = true;
- }
- else
- {
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
- }
- }
- else
- {
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
- }
- }
- else if (regionAccess == SIM_ACCESS_ADULT)
- {
- if (!gAgent.isAdult())
- {
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
- returnValue = true;
-
- notifySuffix = "_NotifyAdultsOnly";
- }
- else if (gAgent.prefersPG() || gAgent.prefersMature())
- {
- if (gAgent.hasRestartableFailedTeleportRequest())
- {
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
- returnValue = true;
- }
- else
- {
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
- }
- }
- else
- {
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
- }
- }
- } // End of special handling for "TeleportEntryAccessBlocked"
- else
- { // Normal case, no message munging
- gAgent.clearTeleportRequest();
- if (LLNotifications::getInstance()->templateExists(notificationID))
- {
- tp_failure_notification = LLNotificationsUtil::add(notificationID, llsdBlock, llsdBlock);
- }
- else
- {
- llsdBlock["MESSAGE"] = defaultMessage;
- tp_failure_notification = LLNotificationsUtil::add("GenericAlertOK", llsdBlock);
- }
- returnValue = true;
- }
-
- if ((tp_failure_notification == NULL) || tp_failure_notification->isIgnored())
- {
- // Given a simple notification if no tp_failure_notification is set or it is ignore
- LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock);
- }
- }
-
- handle_trusted_experiences_notification(llsdBlock);
- return returnValue;
+ bool returnValue = false;
+ if(llsdBlock.has("_region_access"))
+ {
+ U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
+ std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
+ LLStringUtil::toLower(regionMaturity);
+ llsdBlock["REGIONMATURITY"] = regionMaturity;
+
+ LLNotificationPtr tp_failure_notification;
+ std::string notifySuffix;
+
+ if (notificationID == std::string("TeleportEntryAccessBlocked"))
+ {
+ notifySuffix = "_Notify";
+ if (regionAccess == SIM_ACCESS_MATURE)
+ {
+ if (gAgent.isTeen())
+ {
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
+ returnValue = true;
+
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG())
+ {
+ if (gAgent.hasRestartableFailedTeleportRequest())
+ {
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
+ returnValue = true;
+ }
+ else
+ {
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ }
+ else
+ {
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ }
+ else if (regionAccess == SIM_ACCESS_ADULT)
+ {
+ if (!gAgent.isAdult())
+ {
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
+ returnValue = true;
+
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG() || gAgent.prefersMature())
+ {
+ if (gAgent.hasRestartableFailedTeleportRequest())
+ {
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
+ returnValue = true;
+ }
+ else
+ {
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ }
+ else
+ {
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ }
+ } // End of special handling for "TeleportEntryAccessBlocked"
+ else
+ { // Normal case, no message munging
+ gAgent.clearTeleportRequest();
+ if (LLNotifications::getInstance()->templateExists(notificationID))
+ {
+ tp_failure_notification = LLNotificationsUtil::add(notificationID, llsdBlock, llsdBlock);
+ }
+ else
+ {
+ llsdBlock["MESSAGE"] = defaultMessage;
+ tp_failure_notification = LLNotificationsUtil::add("GenericAlertOK", llsdBlock);
+ }
+ returnValue = true;
+ }
+
+ if ((tp_failure_notification == NULL) || tp_failure_notification->isIgnored())
+ {
+ // Given a simple notification if no tp_failure_notification is set or it is ignore
+ LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock);
+ }
+ }
+
+ handle_trusted_experiences_notification(llsdBlock);
+ return returnValue;
}
bool attempt_standard_notification(LLMessageSystem* msgsystem)
{
- // if we have additional alert data
- if (msgsystem->has(_PREHASH_AlertInfo) && msgsystem->getNumberOfBlocksFast(_PREHASH_AlertInfo) > 0)
- {
- // notification was specified using the new mechanism, so we can just handle it here
- std::string notificationID;
- msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID);
-
- //SL-13824 skip notification when both joining a group and leaving a group
- //remove this after server stops sending these messages
- if (notificationID == "JoinGroupSuccess" ||
- notificationID == "GroupDepart")
- {
- return true;
- }
-
- if (!LLNotifications::getInstance()->templateExists(notificationID))
- {
- return false;
- }
-
- std::string llsdRaw;
- LLSD llsdBlock;
- msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID);
- msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_ExtraParams, llsdRaw);
- if (llsdRaw.length())
- {
- std::istringstream llsdData(llsdRaw);
- if (!LLSDSerialize::deserialize(llsdBlock, llsdData, llsdRaw.length()))
- {
- LL_WARNS() << "attempt_standard_notification: Attempted to read notification parameter data into LLSD but failed:" << llsdRaw << LL_ENDL;
- }
- }
-
-
- handle_trusted_experiences_notification(llsdBlock);
-
- if (
- (notificationID == "RegionEntryAccessBlocked") ||
- (notificationID == "LandClaimAccessBlocked") ||
- (notificationID == "LandBuyAccessBlocked")
-
- )
- {
- /*---------------------------------------------------------------------
- (Commented so a grep will find the notification strings, since
- we construct them on the fly; if you add additional notifications,
- please update the comment.)
-
- Could throw any of the following notifications:
-
- RegionEntryAccessBlocked
- RegionEntryAccessBlocked_Notify
- RegionEntryAccessBlocked_NotifyAdultsOnly
- RegionEntryAccessBlocked_Change
- RegionEntryAccessBlocked_AdultsOnlyContent
- RegionEntryAccessBlocked_ChangeAndReTeleport
- LandClaimAccessBlocked
- LandClaimAccessBlocked_Notify
- LandClaimAccessBlocked_NotifyAdultsOnly
- LandClaimAccessBlocked_Change
- LandClaimAccessBlocked_AdultsOnlyContent
- LandBuyAccessBlocked
- LandBuyAccessBlocked_Notify
- LandBuyAccessBlocked_NotifyAdultsOnly
- LandBuyAccessBlocked_Change
- LandBuyAccessBlocked_AdultsOnlyContent
-
- -----------------------------------------------------------------------*/
+ // if we have additional alert data
+ if (msgsystem->has(_PREHASH_AlertInfo) && msgsystem->getNumberOfBlocksFast(_PREHASH_AlertInfo) > 0)
+ {
+ // notification was specified using the new mechanism, so we can just handle it here
+ std::string notificationID;
+ msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID);
+
+ //SL-13824 skip notification when both joining a group and leaving a group
+ //remove this after server stops sending these messages
+ if (notificationID == "JoinGroupSuccess" ||
+ notificationID == "GroupDepart")
+ {
+ return true;
+ }
+
+ if (!LLNotifications::getInstance()->templateExists(notificationID))
+ {
+ return false;
+ }
+
+ std::string llsdRaw;
+ LLSD llsdBlock;
+ msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID);
+ msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_ExtraParams, llsdRaw);
+ if (llsdRaw.length())
+ {
+ std::istringstream llsdData(llsdRaw);
+ if (!LLSDSerialize::deserialize(llsdBlock, llsdData, llsdRaw.length()))
+ {
+ LL_WARNS() << "attempt_standard_notification: Attempted to read notification parameter data into LLSD but failed:" << llsdRaw << LL_ENDL;
+ }
+ }
+
+
+ handle_trusted_experiences_notification(llsdBlock);
+
+ if (
+ (notificationID == "RegionEntryAccessBlocked") ||
+ (notificationID == "LandClaimAccessBlocked") ||
+ (notificationID == "LandBuyAccessBlocked")
+
+ )
+ {
+ /*---------------------------------------------------------------------
+ (Commented so a grep will find the notification strings, since
+ we construct them on the fly; if you add additional notifications,
+ please update the comment.)
+
+ Could throw any of the following notifications:
+
+ RegionEntryAccessBlocked
+ RegionEntryAccessBlocked_Notify
+ RegionEntryAccessBlocked_NotifyAdultsOnly
+ RegionEntryAccessBlocked_Change
+ RegionEntryAccessBlocked_AdultsOnlyContent
+ RegionEntryAccessBlocked_ChangeAndReTeleport
+ LandClaimAccessBlocked
+ LandClaimAccessBlocked_Notify
+ LandClaimAccessBlocked_NotifyAdultsOnly
+ LandClaimAccessBlocked_Change
+ LandClaimAccessBlocked_AdultsOnlyContent
+ LandBuyAccessBlocked
+ LandBuyAccessBlocked_Notify
+ LandBuyAccessBlocked_NotifyAdultsOnly
+ LandBuyAccessBlocked_Change
+ LandBuyAccessBlocked_AdultsOnlyContent
+
+ -----------------------------------------------------------------------*/
static LLCachedControl<S32> ban_lines_mode(gSavedSettings , "ShowBanLines" , LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION);
if (ban_lines_mode == LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION)
{
LLViewerParcelMgr::getInstance()->resetCollisionTimer();
}
- if (handle_special_notification(notificationID, llsdBlock))
- {
- return true;
- }
- }
- // HACK -- handle callbacks for specific alerts.
- if( notificationID == "HomePositionSet" )
- {
- // save the home location image to disk
- std::string snap_filename = gDirUtilp->getLindenUserDir();
- snap_filename += gDirUtilp->getDirDelimiter();
- snap_filename += LLStartUp::getScreenHomeFilename();
+ if (handle_special_notification(notificationID, llsdBlock))
+ {
+ return true;
+ }
+ }
+ // HACK -- handle callbacks for specific alerts.
+ if( notificationID == "HomePositionSet" )
+ {
+ // save the home location image to disk
+ std::string snap_filename = gDirUtilp->getLindenUserDir();
+ snap_filename += gDirUtilp->getDirDelimiter();
+ snap_filename += LLStartUp::getScreenHomeFilename();
gViewerWindow->saveSnapshot(snap_filename,
gViewerWindow->getWindowWidthRaw(),
gViewerWindow->getWindowHeightRaw(),
@@ -5222,44 +5222,44 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
FALSE,
LLSnapshotModel::SNAPSHOT_TYPE_COLOR,
LLSnapshotModel::SNAPSHOT_FORMAT_PNG);
- }
-
- if (notificationID == "RegionRestartMinutes" ||
- notificationID == "RegionRestartSeconds")
- {
- S32 seconds;
- if (notificationID == "RegionRestartMinutes")
- {
- seconds = 60 * static_cast<S32>(llsdBlock["MINUTES"].asInteger());
- }
- else
- {
- seconds = static_cast<S32>(llsdBlock["SECONDS"].asInteger());
- }
-
- LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance<LLFloaterRegionRestarting>("region_restarting");
-
- if (floaterp)
- {
- LLFloaterRegionRestarting::updateTime(seconds);
- }
- else
- {
- LLSD params;
- params["NAME"] = llsdBlock["NAME"];
- params["SECONDS"] = (LLSD::Integer)seconds;
- LLFloaterRegionRestarting* restarting_floater = dynamic_cast<LLFloaterRegionRestarting*>(LLFloaterReg::showInstance("region_restarting", params));
- if(restarting_floater)
- {
- restarting_floater->center();
- }
- }
-
- make_ui_sound("UISndRestart");
- }
-
+ }
+
+ if (notificationID == "RegionRestartMinutes" ||
+ notificationID == "RegionRestartSeconds")
+ {
+ S32 seconds;
+ if (notificationID == "RegionRestartMinutes")
+ {
+ seconds = 60 * static_cast<S32>(llsdBlock["MINUTES"].asInteger());
+ }
+ else
+ {
+ seconds = static_cast<S32>(llsdBlock["SECONDS"].asInteger());
+ }
+
+ LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance<LLFloaterRegionRestarting>("region_restarting");
+
+ if (floaterp)
+ {
+ LLFloaterRegionRestarting::updateTime(seconds);
+ }
+ else
+ {
+ LLSD params;
+ params["NAME"] = llsdBlock["NAME"];
+ params["SECONDS"] = (LLSD::Integer)seconds;
+ LLFloaterRegionRestarting* restarting_floater = dynamic_cast<LLFloaterRegionRestarting*>(LLFloaterReg::showInstance("region_restarting", params));
+ if(restarting_floater)
+ {
+ restarting_floater->center();
+ }
+ }
+
+ make_ui_sound("UISndRestart");
+ }
+
// Special Marketplace update notification
- if (notificationID == "SLM_UPDATE_FOLDER")
+ if (notificationID == "SLM_UPDATE_FOLDER")
{
std::string state = llsdBlock["state"].asString();
if (state == "deleted")
@@ -5298,28 +5298,28 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
}
}
- LLNotificationsUtil::add(notificationID, llsdBlock);
- return true;
- }
- return false;
+ LLNotificationsUtil::add(notificationID, llsdBlock);
+ return true;
+ }
+ return false;
}
static void process_special_alert_messages(const std::string & message)
{
- // Do special handling for alert messages. This is a legacy hack, and any actual displayed
- // text should be altered in the notifications.xml files.
- if ( message == "You died and have been teleported to your home location")
- {
- add(LLStatViewer::KILLED, 1);
- }
- else if( message == "Home position set." )
- {
- // save the home location image to disk
- std::string snap_filename = gDirUtilp->getLindenUserDir();
- snap_filename += gDirUtilp->getDirDelimiter();
- snap_filename += LLStartUp::getScreenHomeFilename();
- gViewerWindow->saveSnapshot(snap_filename,
+ // Do special handling for alert messages. This is a legacy hack, and any actual displayed
+ // text should be altered in the notifications.xml files.
+ if ( message == "You died and have been teleported to your home location")
+ {
+ add(LLStatViewer::KILLED, 1);
+ }
+ else if( message == "Home position set." )
+ {
+ // save the home location image to disk
+ std::string snap_filename = gDirUtilp->getLindenUserDir();
+ snap_filename += gDirUtilp->getDirDelimiter();
+ snap_filename += LLStartUp::getScreenHomeFilename();
+ gViewerWindow->saveSnapshot(snap_filename,
gViewerWindow->getWindowWidthRaw(),
gViewerWindow->getWindowHeightRaw(),
FALSE,
@@ -5327,28 +5327,28 @@ static void process_special_alert_messages(const std::string & message)
FALSE,
LLSnapshotModel::SNAPSHOT_TYPE_COLOR,
LLSnapshotModel::SNAPSHOT_FORMAT_PNG);
- }
+ }
}
void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data)
{
- // make sure the cursor is back to the usual default since the
- // alert is probably due to some kind of error.
- gViewerWindow->getWindow()->resetBusyCount();
-
- std::string message;
- msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, message);
+ // make sure the cursor is back to the usual default since the
+ // alert is probably due to some kind of error.
+ gViewerWindow->getWindow()->resetBusyCount();
+
+ std::string message;
+ msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, message);
- process_special_alert_messages(message);
+ process_special_alert_messages(message);
- if (!attempt_standard_notification(msgsystem))
- {
- BOOL modal = FALSE;
- msgsystem->getBOOL("AlertData", "Modal", modal);
- process_alert_core(message, modal);
- }
+ if (!attempt_standard_notification(msgsystem))
+ {
+ BOOL modal = FALSE;
+ msgsystem->getBOOL("AlertData", "Modal", modal);
+ process_alert_core(message, modal);
+ }
}
// The only difference between this routine and the previous is the fact that
@@ -5358,18 +5358,18 @@ void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data)
// So we can't handle the messages with the same handler.
void process_alert_message(LLMessageSystem *msgsystem, void **user_data)
{
- // make sure the cursor is back to the usual default since the
- // alert is probably due to some kind of error.
- gViewerWindow->getWindow()->resetBusyCount();
-
- std::string message;
- msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, message);
- process_special_alert_messages(message);
+ // make sure the cursor is back to the usual default since the
+ // alert is probably due to some kind of error.
+ gViewerWindow->getWindow()->resetBusyCount();
- if (!attempt_standard_notification(msgsystem))
- {
- BOOL modal = FALSE;
- process_alert_core(message, modal);
+ std::string message;
+ msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, message);
+ process_special_alert_messages(message);
+
+ if (!attempt_standard_notification(msgsystem))
+ {
+ BOOL modal = FALSE;
+ process_alert_core(message, modal);
static LLCachedControl<S32> ban_lines_mode(gSavedSettings , "ShowBanLines" , LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION);
if (ban_lines_mode == LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION
@@ -5377,289 +5377,289 @@ void process_alert_message(LLMessageSystem *msgsystem, void **user_data)
{
LLViewerParcelMgr::getInstance()->resetCollisionTimer();
}
- }
+ }
}
bool handle_not_age_verified_alert(const std::string &pAlertName)
{
- LLNotificationPtr notification = LLNotificationsUtil::add(pAlertName);
- if ((notification == NULL) || notification->isIgnored())
- {
- LLNotificationsUtil::add(pAlertName + "_Notify");
- }
+ LLNotificationPtr notification = LLNotificationsUtil::add(pAlertName);
+ if ((notification == NULL) || notification->isIgnored())
+ {
+ LLNotificationsUtil::add(pAlertName + "_Notify");
+ }
- return true;
+ return true;
}
bool handle_special_alerts(const std::string &pAlertName)
{
- bool isHandled = false;
- if (LLStringUtil::compareStrings(pAlertName, "NotAgeVerified") == 0)
- {
-
- isHandled = handle_not_age_verified_alert(pAlertName);
- }
+ bool isHandled = false;
+ if (LLStringUtil::compareStrings(pAlertName, "NotAgeVerified") == 0)
+ {
- return isHandled;
+ isHandled = handle_not_age_verified_alert(pAlertName);
+ }
+
+ return isHandled;
}
void process_alert_core(const std::string& message, BOOL modal)
{
- const std::string ALERT_PREFIX("ALERT: ");
- const std::string NOTIFY_PREFIX("NOTIFY: ");
- if (message.find(ALERT_PREFIX) == 0)
- {
- // Allow the server to spawn a named alert so that server alerts can be
- // translated out of English.
- std::string alert_name(message.substr(ALERT_PREFIX.length()));
- if (!handle_special_alerts(alert_name))
- {
- LLNotificationsUtil::add(alert_name);
- }
- }
- else if (message.find(NOTIFY_PREFIX) == 0)
- {
- // Allow the server to spawn a named notification so that server notifications can be
- // translated out of English.
- std::string notify_name(message.substr(NOTIFY_PREFIX.length()));
- LLNotificationsUtil::add(notify_name);
- }
- else if (message[0] == '/')
- {
- // System message is important, show in upper-right box not tip
- std::string text(message.substr(1));
- LLSD args;
-
- // *NOTE: If the text from the server ever changes this line will need to be adjusted.
- std::string restart_cancelled = "Region restart cancelled.";
- if (text.substr(0, restart_cancelled.length()) == restart_cancelled)
- {
- LLFloaterRegionRestarting::close();
- }
-
- std::string new_msg =LLNotifications::instance().getGlobalString(text);
- args["MESSAGE"] = new_msg;
- LLNotificationsUtil::add("SystemMessage", args);
- }
- else if (modal)
- {
- LLSD args;
- std::string new_msg =LLNotifications::instance().getGlobalString(message);
- args["ERROR_MESSAGE"] = new_msg;
- LLNotificationsUtil::add("ErrorMessage", args);
- }
- else
- {
- // Hack fix for EXP-623 (blame fix on RN :)) to avoid a sim deploy
- const std::string AUTOPILOT_CANCELED_MSG("Autopilot canceled");
- if (message.find(AUTOPILOT_CANCELED_MSG) == std::string::npos )
- {
- LLSD args;
- std::string new_msg =LLNotifications::instance().getGlobalString(message);
-
- std::string localized_msg;
- bool is_message_localized = LLTrans::findString(localized_msg, new_msg);
-
- args["MESSAGE"] = is_message_localized ? localized_msg : new_msg;
- LLNotificationsUtil::add("SystemMessageTip", args);
- }
- }
-}
-
-mean_collision_list_t gMeanCollisionList;
-time_t gLastDisplayedTime = 0;
+ const std::string ALERT_PREFIX("ALERT: ");
+ const std::string NOTIFY_PREFIX("NOTIFY: ");
+ if (message.find(ALERT_PREFIX) == 0)
+ {
+ // Allow the server to spawn a named alert so that server alerts can be
+ // translated out of English.
+ std::string alert_name(message.substr(ALERT_PREFIX.length()));
+ if (!handle_special_alerts(alert_name))
+ {
+ LLNotificationsUtil::add(alert_name);
+ }
+ }
+ else if (message.find(NOTIFY_PREFIX) == 0)
+ {
+ // Allow the server to spawn a named notification so that server notifications can be
+ // translated out of English.
+ std::string notify_name(message.substr(NOTIFY_PREFIX.length()));
+ LLNotificationsUtil::add(notify_name);
+ }
+ else if (message[0] == '/')
+ {
+ // System message is important, show in upper-right box not tip
+ std::string text(message.substr(1));
+ LLSD args;
+
+ // *NOTE: If the text from the server ever changes this line will need to be adjusted.
+ std::string restart_cancelled = "Region restart cancelled.";
+ if (text.substr(0, restart_cancelled.length()) == restart_cancelled)
+ {
+ LLFloaterRegionRestarting::close();
+ }
+
+ std::string new_msg =LLNotifications::instance().getGlobalString(text);
+ args["MESSAGE"] = new_msg;
+ LLNotificationsUtil::add("SystemMessage", args);
+ }
+ else if (modal)
+ {
+ LLSD args;
+ std::string new_msg =LLNotifications::instance().getGlobalString(message);
+ args["ERROR_MESSAGE"] = new_msg;
+ LLNotificationsUtil::add("ErrorMessage", args);
+ }
+ else
+ {
+ // Hack fix for EXP-623 (blame fix on RN :)) to avoid a sim deploy
+ const std::string AUTOPILOT_CANCELED_MSG("Autopilot canceled");
+ if (message.find(AUTOPILOT_CANCELED_MSG) == std::string::npos )
+ {
+ LLSD args;
+ std::string new_msg =LLNotifications::instance().getGlobalString(message);
+
+ std::string localized_msg;
+ bool is_message_localized = LLTrans::findString(localized_msg, new_msg);
+
+ args["MESSAGE"] = is_message_localized ? localized_msg : new_msg;
+ LLNotificationsUtil::add("SystemMessageTip", args);
+ }
+ }
+}
+
+mean_collision_list_t gMeanCollisionList;
+time_t gLastDisplayedTime = 0;
void handle_show_mean_events(void *)
{
- LLFloaterReg::showInstance("bumps");
- //LLFloaterBump::showInstance();
+ LLFloaterReg::showInstance("bumps");
+ //LLFloaterBump::showInstance();
}
void mean_name_callback(const LLUUID &id, const LLAvatarName& av_name)
{
- static const U32 max_collision_list_size = 20;
- if (gMeanCollisionList.size() > max_collision_list_size)
- {
- mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
- for (U32 i=0; i<max_collision_list_size; i++) iter++;
- for_each(iter, gMeanCollisionList.end(), DeletePointer());
- gMeanCollisionList.erase(iter, gMeanCollisionList.end());
- }
-
- for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
- iter != gMeanCollisionList.end(); ++iter)
- {
- LLMeanCollisionData *mcd = *iter;
- if (mcd->mPerp == id)
- {
- mcd->mFullName = av_name.getUserName();
- }
- }
+ static const U32 max_collision_list_size = 20;
+ if (gMeanCollisionList.size() > max_collision_list_size)
+ {
+ mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
+ for (U32 i=0; i<max_collision_list_size; i++) iter++;
+ for_each(iter, gMeanCollisionList.end(), DeletePointer());
+ gMeanCollisionList.erase(iter, gMeanCollisionList.end());
+ }
+
+ for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
+ iter != gMeanCollisionList.end(); ++iter)
+ {
+ LLMeanCollisionData *mcd = *iter;
+ if (mcd->mPerp == id)
+ {
+ mcd->mFullName = av_name.getUserName();
+ }
+ }
}
void process_mean_collision_alert_message(LLMessageSystem *msgsystem, void **user_data)
{
- if (gAgent.inPrelude())
- {
- // In prelude, bumping is OK. This dialog is rather confusing to
- // newbies, so we don't show it. Drop the packet on the floor.
- return;
- }
-
- // make sure the cursor is back to the usual default since the
- // alert is probably due to some kind of error.
- gViewerWindow->getWindow()->resetBusyCount();
-
- LLUUID perp;
- U32 time;
- U8 u8type;
- EMeanCollisionType type;
- F32 mag;
-
- S32 i, num = msgsystem->getNumberOfBlocks(_PREHASH_MeanCollision);
-
- for (i = 0; i < num; i++)
- {
- msgsystem->getUUIDFast(_PREHASH_MeanCollision, _PREHASH_Perp, perp);
- msgsystem->getU32Fast(_PREHASH_MeanCollision, _PREHASH_Time, time);
- msgsystem->getF32Fast(_PREHASH_MeanCollision, _PREHASH_Mag, mag);
- msgsystem->getU8Fast(_PREHASH_MeanCollision, _PREHASH_Type, u8type);
-
- type = (EMeanCollisionType)u8type;
-
- BOOL b_found = FALSE;
-
- for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
- iter != gMeanCollisionList.end(); ++iter)
- {
- LLMeanCollisionData *mcd = *iter;
- if ((mcd->mPerp == perp) && (mcd->mType == type))
- {
- mcd->mTime = time;
- mcd->mMag = mag;
- b_found = TRUE;
- break;
- }
- }
-
- if (!b_found)
- {
- LLMeanCollisionData *mcd = new LLMeanCollisionData(gAgentID, perp, time, type, mag);
- gMeanCollisionList.push_front(mcd);
- LLAvatarNameCache::get(perp, boost::bind(&mean_name_callback, _1, _2));
- }
- }
- LLFloaterBump* bumps_floater = LLFloaterBump::getInstance();
- if(bumps_floater && bumps_floater->isInVisibleChain())
- {
- bumps_floater->populateCollisionList();
- }
+ if (gAgent.inPrelude())
+ {
+ // In prelude, bumping is OK. This dialog is rather confusing to
+ // newbies, so we don't show it. Drop the packet on the floor.
+ return;
+ }
+
+ // make sure the cursor is back to the usual default since the
+ // alert is probably due to some kind of error.
+ gViewerWindow->getWindow()->resetBusyCount();
+
+ LLUUID perp;
+ U32 time;
+ U8 u8type;
+ EMeanCollisionType type;
+ F32 mag;
+
+ S32 i, num = msgsystem->getNumberOfBlocks(_PREHASH_MeanCollision);
+
+ for (i = 0; i < num; i++)
+ {
+ msgsystem->getUUIDFast(_PREHASH_MeanCollision, _PREHASH_Perp, perp);
+ msgsystem->getU32Fast(_PREHASH_MeanCollision, _PREHASH_Time, time);
+ msgsystem->getF32Fast(_PREHASH_MeanCollision, _PREHASH_Mag, mag);
+ msgsystem->getU8Fast(_PREHASH_MeanCollision, _PREHASH_Type, u8type);
+
+ type = (EMeanCollisionType)u8type;
+
+ BOOL b_found = FALSE;
+
+ for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
+ iter != gMeanCollisionList.end(); ++iter)
+ {
+ LLMeanCollisionData *mcd = *iter;
+ if ((mcd->mPerp == perp) && (mcd->mType == type))
+ {
+ mcd->mTime = time;
+ mcd->mMag = mag;
+ b_found = TRUE;
+ break;
+ }
+ }
+
+ if (!b_found)
+ {
+ LLMeanCollisionData *mcd = new LLMeanCollisionData(gAgentID, perp, time, type, mag);
+ gMeanCollisionList.push_front(mcd);
+ LLAvatarNameCache::get(perp, boost::bind(&mean_name_callback, _1, _2));
+ }
+ }
+ LLFloaterBump* bumps_floater = LLFloaterBump::getInstance();
+ if(bumps_floater && bumps_floater->isInVisibleChain())
+ {
+ bumps_floater->populateCollisionList();
+ }
}
void process_frozen_message(LLMessageSystem *msgsystem, void **user_data)
{
- // make sure the cursor is back to the usual default since the
- // alert is probably due to some kind of error.
- gViewerWindow->getWindow()->resetBusyCount();
- BOOL b_frozen;
-
- msgsystem->getBOOL("FrozenData", "Data", b_frozen);
+ // make sure the cursor is back to the usual default since the
+ // alert is probably due to some kind of error.
+ gViewerWindow->getWindow()->resetBusyCount();
+ BOOL b_frozen;
+
+ msgsystem->getBOOL("FrozenData", "Data", b_frozen);
- // TODO: make being frozen change view
- if (b_frozen)
- {
- }
- else
- {
- }
+ // TODO: make being frozen change view
+ if (b_frozen)
+ {
+ }
+ else
+ {
+ }
}
// do some extra stuff once we get our economy data
void process_economy_data(LLMessageSystem *msg, void** /*user_data*/)
{
- LL_DEBUGS("Benefits") << "Received economy data, not currently used" << LL_ENDL;
+ LL_DEBUGS("Benefits") << "Received economy data, not currently used" << LL_ENDL;
}
void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted)
{
- // only continue if at least some permissions were requested
- if (orig_questions)
- {
- // check to see if the person we are asking
-
- // "'[OBJECTNAME]', an object owned by '[OWNERNAME]',
- // located in [REGIONNAME] at [REGIONPOS],
- // has been <granted|denied> permission to: [PERMISSIONS]."
-
- LLUIString notice(LLTrans::getString(granted ? "ScriptQuestionCautionChatGranted" : "ScriptQuestionCautionChatDenied"));
-
- // always include the object name and owner name
- notice.setArg("[OBJECTNAME]", notification["payload"]["object_name"].asString());
- notice.setArg("[OWNERNAME]", notification["payload"]["owner_name"].asString());
-
- // try to lookup viewerobject that corresponds to the object that
- // requested permissions (here, taskid->requesting object id)
- BOOL foundpos = FALSE;
- LLViewerObject* viewobj = gObjectList.findObject(notification["payload"]["task_id"].asUUID());
- if (viewobj)
- {
- // found the viewerobject, get it's position in its region
- LLVector3 objpos(viewobj->getPosition());
-
- // try to lookup the name of the region the object is in
- LLViewerRegion* viewregion = viewobj->getRegion();
- if (viewregion)
- {
- // got the region, so include the region and 3d coordinates of the object
- notice.setArg("[REGIONNAME]", viewregion->getName());
- std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]);
- notice.setArg("[REGIONPOS]", formatpos);
-
- foundpos = TRUE;
- }
- }
-
- if (!foundpos)
- {
- // unable to determine location of the object
- notice.setArg("[REGIONNAME]", "(unknown region)");
- notice.setArg("[REGIONPOS]", "(unknown position)");
- }
-
- // check each permission that was requested, and list each
- // permission that has been flagged as a caution permission
- BOOL caution = FALSE;
- S32 count = 0;
- std::string perms;
- for (const script_perm_t& script_perm : SCRIPT_PERMISSIONS)
- {
- if ((orig_questions & script_perm.permbit)
- && script_perm.caution)
- {
- count++;
- caution = TRUE;
-
- // add a comma before the permission description if it is not the first permission
- // added to the list or the last permission to check
- if (count > 1)
- {
- perms.append(", ");
- }
-
- perms.append(LLTrans::getString(script_perm.question));
- }
- }
-
- notice.setArg("[PERMISSIONS]", perms);
-
- // log a chat message as long as at least one requested permission
- // is a caution permission
- if (caution)
- {
- LLChat chat(notice.getString());
- // LLFloaterChat::addChat(chat, FALSE, FALSE);
- }
- }
+ // only continue if at least some permissions were requested
+ if (orig_questions)
+ {
+ // check to see if the person we are asking
+
+ // "'[OBJECTNAME]', an object owned by '[OWNERNAME]',
+ // located in [REGIONNAME] at [REGIONPOS],
+ // has been <granted|denied> permission to: [PERMISSIONS]."
+
+ LLUIString notice(LLTrans::getString(granted ? "ScriptQuestionCautionChatGranted" : "ScriptQuestionCautionChatDenied"));
+
+ // always include the object name and owner name
+ notice.setArg("[OBJECTNAME]", notification["payload"]["object_name"].asString());
+ notice.setArg("[OWNERNAME]", notification["payload"]["owner_name"].asString());
+
+ // try to lookup viewerobject that corresponds to the object that
+ // requested permissions (here, taskid->requesting object id)
+ BOOL foundpos = FALSE;
+ LLViewerObject* viewobj = gObjectList.findObject(notification["payload"]["task_id"].asUUID());
+ if (viewobj)
+ {
+ // found the viewerobject, get it's position in its region
+ LLVector3 objpos(viewobj->getPosition());
+
+ // try to lookup the name of the region the object is in
+ LLViewerRegion* viewregion = viewobj->getRegion();
+ if (viewregion)
+ {
+ // got the region, so include the region and 3d coordinates of the object
+ notice.setArg("[REGIONNAME]", viewregion->getName());
+ std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]);
+ notice.setArg("[REGIONPOS]", formatpos);
+
+ foundpos = TRUE;
+ }
+ }
+
+ if (!foundpos)
+ {
+ // unable to determine location of the object
+ notice.setArg("[REGIONNAME]", "(unknown region)");
+ notice.setArg("[REGIONPOS]", "(unknown position)");
+ }
+
+ // check each permission that was requested, and list each
+ // permission that has been flagged as a caution permission
+ BOOL caution = FALSE;
+ S32 count = 0;
+ std::string perms;
+ for (const script_perm_t& script_perm : SCRIPT_PERMISSIONS)
+ {
+ if ((orig_questions & script_perm.permbit)
+ && script_perm.caution)
+ {
+ count++;
+ caution = TRUE;
+
+ // add a comma before the permission description if it is not the first permission
+ // added to the list or the last permission to check
+ if (count > 1)
+ {
+ perms.append(", ");
+ }
+
+ perms.append(LLTrans::getString(script_perm.question));
+ }
+ }
+
+ notice.setArg("[PERMISSIONS]", perms);
+
+ // log a chat message as long as at least one requested permission
+ // is a caution permission
+ if (caution)
+ {
+ LLChat chat(notice.getString());
+ // LLFloaterChat::addChat(chat, FALSE, FALSE);
+ }
+ }
}
void script_question_mute(const LLUUID& item_id, const std::string& object_name);
@@ -5676,97 +5676,97 @@ void experiencePermissionBlock(LLUUID experience, LLSD result)
bool script_question_cb(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLMessageSystem *msg = gMessageSystem;
- S32 orig = notification["payload"]["questions"].asInteger();
- S32 new_questions = orig;
-
- if (response["Details"])
- {
- // respawn notification...
- LLNotificationsUtil::add(notification["name"], notification["substitutions"], notification["payload"]);
-
- // ...with description on top
- LLNotificationsUtil::add("DebitPermissionDetails");
- return false;
- }
-
- LLUUID experience;
- if(notification["payload"].has("experience"))
- {
- experience = notification["payload"]["experience"].asUUID();
- }
-
- // check whether permissions were granted or denied
- BOOL allowed = TRUE;
- // the "yes/accept" button is the first button in the template, making it button 0
- // if any other button was clicked, the permissions were denied
- if (option != 0)
- {
- new_questions = 0;
- allowed = FALSE;
- }
- else if(experience.notNull())
- {
- LLSD permission;
- LLSD data;
- permission["permission"]="Allow";
-
- data[experience.asString()]=permission;
- data["experience"]=experience;
- LLEventPumps::instance().obtain("experience_permission").post(data);
- }
-
- LLUUID task_id = notification["payload"]["task_id"].asUUID();
- LLUUID item_id = notification["payload"]["item_id"].asUUID();
-
- // reply with the permissions granted or denied
- msg->newMessageFast(_PREHASH_ScriptAnswerYes);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Data);
- msg->addUUIDFast(_PREHASH_TaskID, task_id);
- msg->addUUIDFast(_PREHASH_ItemID, item_id);
- msg->addS32Fast(_PREHASH_Questions, new_questions);
- msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
-
- // only log a chat message if caution prompts are enabled
- if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
- {
- // log a chat message, if appropriate
- notify_cautioned_script_question(notification, response, orig, allowed);
- }
-
- if ( response["Mute"] ) // mute
- {
- script_question_mute(task_id,notification["payload"]["object_name"].asString());
- }
- if ( response["BlockExperience"] )
- {
- if(experience.notNull())
- {
- LLViewerRegion* region = gAgent.getRegion();
- if (!region)
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLMessageSystem *msg = gMessageSystem;
+ S32 orig = notification["payload"]["questions"].asInteger();
+ S32 new_questions = orig;
+
+ if (response["Details"])
+ {
+ // respawn notification...
+ LLNotificationsUtil::add(notification["name"], notification["substitutions"], notification["payload"]);
+
+ // ...with description on top
+ LLNotificationsUtil::add("DebitPermissionDetails");
+ return false;
+ }
+
+ LLUUID experience;
+ if(notification["payload"].has("experience"))
+ {
+ experience = notification["payload"]["experience"].asUUID();
+ }
+
+ // check whether permissions were granted or denied
+ BOOL allowed = TRUE;
+ // the "yes/accept" button is the first button in the template, making it button 0
+ // if any other button was clicked, the permissions were denied
+ if (option != 0)
+ {
+ new_questions = 0;
+ allowed = FALSE;
+ }
+ else if(experience.notNull())
+ {
+ LLSD permission;
+ LLSD data;
+ permission["permission"]="Allow";
+
+ data[experience.asString()]=permission;
+ data["experience"]=experience;
+ LLEventPumps::instance().obtain("experience_permission").post(data);
+ }
+
+ LLUUID task_id = notification["payload"]["task_id"].asUUID();
+ LLUUID item_id = notification["payload"]["item_id"].asUUID();
+
+ // reply with the permissions granted or denied
+ msg->newMessageFast(_PREHASH_ScriptAnswerYes);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_Data);
+ msg->addUUIDFast(_PREHASH_TaskID, task_id);
+ msg->addUUIDFast(_PREHASH_ItemID, item_id);
+ msg->addS32Fast(_PREHASH_Questions, new_questions);
+ msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
+
+ // only log a chat message if caution prompts are enabled
+ if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
+ {
+ // log a chat message, if appropriate
+ notify_cautioned_script_question(notification, response, orig, allowed);
+ }
+
+ if ( response["Mute"] ) // mute
+ {
+ script_question_mute(task_id,notification["payload"]["object_name"].asString());
+ }
+ if ( response["BlockExperience"] )
+ {
+ if(experience.notNull())
+ {
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region)
+ return false;
LLExperienceCache::instance().setExperiencePermission(experience, std::string("Block"), boost::bind(&experiencePermissionBlock, experience, _1));
- }
+ }
}
- return false;
+ return false;
}
void script_question_mute(const LLUUID& task_id, const std::string& object_name)
{
- LLMuteList::getInstance()->add(LLMute(task_id, object_name, LLMute::OBJECT));
+ LLMuteList::getInstance()->add(LLMute(task_id, object_name, LLMute::OBJECT));
// purge the message queue of any previously queued requests from the same source. DEV-4879
class OfferMatcher : public LLNotificationsUI::LLScreenChannel::Matcher
{
public:
- OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {}
- bool matches(const LLNotificationPtr notification) const
+ OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {}
+ bool matches(const LLNotificationPtr notification) const
{
if (notification->getName() == "ScriptQuestionCaution"
|| notification->getName() == "ScriptQuestion")
@@ -5789,178 +5789,178 @@ static LLNotificationFunctorRegistration script_question_cb_reg_3("ScriptQuestio
void process_script_experience_details(const LLSD& experience_details, LLSD args, LLSD payload)
{
- if(experience_details[LLExperienceCache::PROPERTIES].asInteger() & LLExperienceCache::PROPERTY_GRID)
- {
- args["GRID_WIDE"] = LLTrans::getString("Grid-Scope");
- }
- else
- {
- args["GRID_WIDE"] = LLTrans::getString("Land-Scope");
- }
- args["EXPERIENCE"] = LLSLURL("experience", experience_details[LLExperienceCache::EXPERIENCE_ID].asUUID(), "profile").getSLURLString();
+ if(experience_details[LLExperienceCache::PROPERTIES].asInteger() & LLExperienceCache::PROPERTY_GRID)
+ {
+ args["GRID_WIDE"] = LLTrans::getString("Grid-Scope");
+ }
+ else
+ {
+ args["GRID_WIDE"] = LLTrans::getString("Land-Scope");
+ }
+ args["EXPERIENCE"] = LLSLURL("experience", experience_details[LLExperienceCache::EXPERIENCE_ID].asUUID(), "profile").getSLURLString();
- LLNotificationsUtil::add("ScriptQuestionExperience", args, payload);
+ LLNotificationsUtil::add("ScriptQuestionExperience", args, payload);
}
void process_script_question(LLMessageSystem *msg, void **user_data)
{
- // *TODO: Translate owner name -> [FIRST] [LAST]
-
- LLHost sender = msg->getSender();
-
- LLUUID taskid;
- LLUUID itemid;
- S32 questions;
- std::string object_name;
- std::string owner_name;
- LLUUID experienceid;
-
- // taskid -> object key of object requesting permissions
- msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid );
- // itemid -> script asset key of script requesting permissions
- msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid );
- msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, object_name);
- msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name);
- msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions );
-
- if(msg->has(_PREHASH_Experience))
- {
- msg->getUUIDFast(_PREHASH_Experience, _PREHASH_ExperienceID, experienceid);
- }
-
- // Special case. If the objects are owned by this agent, throttle per-object instead
- // of per-owner. It's common for residents to reset a ton of scripts that re-request
- // permissions, as with tier boxes. UUIDs can't be valid agent names and vice-versa,
- // so we'll reuse the same namespace for both throttle types.
- std::string throttle_name = owner_name;
- std::string self_name;
- LLAgentUI::buildFullname( self_name ); // does not include ' Resident'
- std::string clean_owner_name = LLCacheName::cleanFullName(owner_name); // removes ' Resident'
- if( clean_owner_name == self_name )
- {
- throttle_name = taskid.getString();
- }
-
- // don't display permission requests if this object is muted
- if (LLMuteList::getInstance()->isMuted(taskid)) return;
-
- // throttle excessive requests from any specific user's scripts
- typedef LLKeyThrottle<std::string> LLStringThrottle;
- static LLStringThrottle question_throttle( LLREQUEST_PERMISSION_THROTTLE_LIMIT, LLREQUEST_PERMISSION_THROTTLE_INTERVAL );
-
- switch (question_throttle.noteAction(throttle_name))
- {
- case LLStringThrottle::THROTTLE_NEWLY_BLOCKED:
- LL_INFOS("Messaging") << "process_script_question throttled"
- << " owner_name:" << owner_name
- << LL_ENDL;
- // Fall through
-
- case LLStringThrottle::THROTTLE_BLOCKED:
- // Escape altogether until we recover
- return;
-
- case LLStringThrottle::THROTTLE_OK:
- break;
- }
-
- std::string script_question;
- if (questions)
- {
- bool caution = false;
- S32 count = 0;
- LLSD args;
- args["OBJECTNAME"] = object_name;
- args["NAME"] = clean_owner_name;
- S32 known_questions = 0;
- bool has_not_only_debit = questions ^ SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_DEBIT].permbit;
- // check the received permission flags against each permission
- for (const script_perm_t& script_perm : SCRIPT_PERMISSIONS)
- {
- if (questions & script_perm.permbit)
- {
- count++;
- known_questions |= script_perm.permbit;
- // check whether permission question should cause special caution dialog
- caution |= (script_perm.caution);
-
- if (("ScriptTakeMoney" == script_perm.question) && has_not_only_debit)
- continue;
+ // *TODO: Translate owner name -> [FIRST] [LAST]
+
+ LLHost sender = msg->getSender();
+
+ LLUUID taskid;
+ LLUUID itemid;
+ S32 questions;
+ std::string object_name;
+ std::string owner_name;
+ LLUUID experienceid;
+
+ // taskid -> object key of object requesting permissions
+ msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid );
+ // itemid -> script asset key of script requesting permissions
+ msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid );
+ msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, object_name);
+ msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name);
+ msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions );
+
+ if(msg->has(_PREHASH_Experience))
+ {
+ msg->getUUIDFast(_PREHASH_Experience, _PREHASH_ExperienceID, experienceid);
+ }
+
+ // Special case. If the objects are owned by this agent, throttle per-object instead
+ // of per-owner. It's common for residents to reset a ton of scripts that re-request
+ // permissions, as with tier boxes. UUIDs can't be valid agent names and vice-versa,
+ // so we'll reuse the same namespace for both throttle types.
+ std::string throttle_name = owner_name;
+ std::string self_name;
+ LLAgentUI::buildFullname( self_name ); // does not include ' Resident'
+ std::string clean_owner_name = LLCacheName::cleanFullName(owner_name); // removes ' Resident'
+ if( clean_owner_name == self_name )
+ {
+ throttle_name = taskid.getString();
+ }
+
+ // don't display permission requests if this object is muted
+ if (LLMuteList::getInstance()->isMuted(taskid)) return;
+
+ // throttle excessive requests from any specific user's scripts
+ typedef LLKeyThrottle<std::string> LLStringThrottle;
+ static LLStringThrottle question_throttle( LLREQUEST_PERMISSION_THROTTLE_LIMIT, LLREQUEST_PERMISSION_THROTTLE_INTERVAL );
+
+ switch (question_throttle.noteAction(throttle_name))
+ {
+ case LLStringThrottle::THROTTLE_NEWLY_BLOCKED:
+ LL_INFOS("Messaging") << "process_script_question throttled"
+ << " owner_name:" << owner_name
+ << LL_ENDL;
+ // Fall through
+
+ case LLStringThrottle::THROTTLE_BLOCKED:
+ // Escape altogether until we recover
+ return;
+
+ case LLStringThrottle::THROTTLE_OK:
+ break;
+ }
+
+ std::string script_question;
+ if (questions)
+ {
+ bool caution = false;
+ S32 count = 0;
+ LLSD args;
+ args["OBJECTNAME"] = object_name;
+ args["NAME"] = clean_owner_name;
+ S32 known_questions = 0;
+ bool has_not_only_debit = questions ^ SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_DEBIT].permbit;
+ // check the received permission flags against each permission
+ for (const script_perm_t& script_perm : SCRIPT_PERMISSIONS)
+ {
+ if (questions & script_perm.permbit)
+ {
+ count++;
+ known_questions |= script_perm.permbit;
+ // check whether permission question should cause special caution dialog
+ caution |= (script_perm.caution);
+
+ if (("ScriptTakeMoney" == script_perm.question) && has_not_only_debit)
+ continue;
if (LLTrans::getString(script_perm.question).empty())
{
continue;
}
- script_question += " " + LLTrans::getString(script_perm.question) + "\n";
- }
- }
-
- args["QUESTIONS"] = script_question;
-
- if (known_questions != questions)
- {
- // This is in addition to the normal dialog.
- // Viewer got a request for not supported/implemented permission
- LL_WARNS("Messaging") << "Object \"" << object_name << "\" requested " << script_question
- << " permission. Permission is unknown and can't be granted. Item id: " << itemid
- << " taskid:" << taskid << LL_ENDL;
- }
-
- if (known_questions)
- {
- LLSD payload;
- payload["task_id"] = taskid;
- payload["item_id"] = itemid;
- payload["sender"] = sender.getIPandPort();
- payload["questions"] = known_questions;
- payload["object_name"] = object_name;
- payload["owner_name"] = owner_name;
-
- // check whether cautions are even enabled or not
- const char* notification = "ScriptQuestion";
-
- if(caution && gSavedSettings.getBOOL("PermissionsCautionEnabled"))
- {
- args["FOOTERTEXT"] = (count > 1) ? LLTrans::getString("AdditionalPermissionsRequestHeader") + "\n\n" + script_question : "";
- notification = "ScriptQuestionCaution";
- }
- else if(experienceid.notNull())
- {
- payload["experience"]=experienceid;
+ script_question += " " + LLTrans::getString(script_perm.question) + "\n";
+ }
+ }
+
+ args["QUESTIONS"] = script_question;
+
+ if (known_questions != questions)
+ {
+ // This is in addition to the normal dialog.
+ // Viewer got a request for not supported/implemented permission
+ LL_WARNS("Messaging") << "Object \"" << object_name << "\" requested " << script_question
+ << " permission. Permission is unknown and can't be granted. Item id: " << itemid
+ << " taskid:" << taskid << LL_ENDL;
+ }
+
+ if (known_questions)
+ {
+ LLSD payload;
+ payload["task_id"] = taskid;
+ payload["item_id"] = itemid;
+ payload["sender"] = sender.getIPandPort();
+ payload["questions"] = known_questions;
+ payload["object_name"] = object_name;
+ payload["owner_name"] = owner_name;
+
+ // check whether cautions are even enabled or not
+ const char* notification = "ScriptQuestion";
+
+ if(caution && gSavedSettings.getBOOL("PermissionsCautionEnabled"))
+ {
+ args["FOOTERTEXT"] = (count > 1) ? LLTrans::getString("AdditionalPermissionsRequestHeader") + "\n\n" + script_question : "";
+ notification = "ScriptQuestionCaution";
+ }
+ else if(experienceid.notNull())
+ {
+ payload["experience"]=experienceid;
LLExperienceCache::instance().get(experienceid, boost::bind(process_script_experience_details, _1, args, payload));
- return;
- }
+ return;
+ }
- LLNotificationsUtil::add(notification, args, payload);
- }
- }
+ LLNotificationsUtil::add(notification, args, payload);
+ }
+ }
}
void process_derez_container(LLMessageSystem *msg, void**)
{
- LL_WARNS("Messaging") << "call to deprecated process_derez_container" << LL_ENDL;
+ LL_WARNS("Messaging") << "call to deprecated process_derez_container" << LL_ENDL;
}
void container_inventory_arrived(LLViewerObject* object,
- LLInventoryObject::object_list_t* inventory,
- S32 serial_num,
- void* data)
-{
- LL_DEBUGS("Messaging") << "container_inventory_arrived()" << LL_ENDL;
- if( gAgentCamera.cameraMouselook() )
- {
- gAgentCamera.changeCameraToDefault();
- }
-
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
-
- if (inventory->size() > 2)
- {
- // create a new inventory category to put this in
- LLUUID cat_id;
- gInventory.createNewCategory(
+ LLInventoryObject::object_list_t* inventory,
+ S32 serial_num,
+ void* data)
+{
+ LL_DEBUGS("Messaging") << "container_inventory_arrived()" << LL_ENDL;
+ if( gAgentCamera.cameraMouselook() )
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+
+ LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
+
+ if (inventory->size() > 2)
+ {
+ // create a new inventory category to put this in
+ LLUUID cat_id;
+ gInventory.createNewCategory(
gInventory.getRootFolderID(),
LLFolderType::FT_NONE,
LLTrans::getString("AcquiredItems"),
@@ -6001,532 +6001,532 @@ void container_inventory_arrived(LLViewerObject* object,
active_panel->setSelection(new_cat_id, TAKE_FOCUS_NO);
}
});
- }
- else if (inventory->size() == 2)
- {
- // we're going to get one fake root category as well as the
- // one actual object
- LLInventoryObject::object_list_t::iterator it = inventory->begin();
-
- if ((*it)->getType() == LLAssetType::AT_CATEGORY)
- {
- ++it;
- }
-
- LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
- const LLUUID category = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(item->getType()));
-
- LLUUID item_id;
- item_id.generate();
- time_t creation_date_utc = time_corrected();
- LLPointer<LLViewerInventoryItem> new_item
- = new LLViewerInventoryItem(item_id, category,
- item->getPermissions(),
- item->getAssetUUID(),
- item->getType(),
- item->getInventoryType(),
- item->getName(),
- item->getDescription(),
- LLSaleInfo::DEFAULT,
- item->getFlags(),
- creation_date_utc);
- new_item->updateServer(TRUE);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- if(active_panel)
- {
- active_panel->setSelection(item_id, TAKE_FOCUS_NO);
- }
- }
-
- // we've got the inventory, now delete this object if this was a take
- BOOL delete_object = (BOOL)(intptr_t)data;
- LLViewerRegion *region = gAgent.getRegion();
- if (delete_object && region)
- {
- gMessageSystem->newMessageFast(_PREHASH_ObjectDelete);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- const U8 NO_FORCE = 0;
- gMessageSystem->addU8Fast(_PREHASH_Force, NO_FORCE);
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
- gMessageSystem->sendReliable(region->getHost());
- }
+ }
+ else if (inventory->size() == 2)
+ {
+ // we're going to get one fake root category as well as the
+ // one actual object
+ LLInventoryObject::object_list_t::iterator it = inventory->begin();
+
+ if ((*it)->getType() == LLAssetType::AT_CATEGORY)
+ {
+ ++it;
+ }
+
+ LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
+ const LLUUID category = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(item->getType()));
+
+ LLUUID item_id;
+ item_id.generate();
+ time_t creation_date_utc = time_corrected();
+ LLPointer<LLViewerInventoryItem> new_item
+ = new LLViewerInventoryItem(item_id, category,
+ item->getPermissions(),
+ item->getAssetUUID(),
+ item->getType(),
+ item->getInventoryType(),
+ item->getName(),
+ item->getDescription(),
+ LLSaleInfo::DEFAULT,
+ item->getFlags(),
+ creation_date_utc);
+ new_item->updateServer(TRUE);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
+ if(active_panel)
+ {
+ active_panel->setSelection(item_id, TAKE_FOCUS_NO);
+ }
+ }
+
+ // we've got the inventory, now delete this object if this was a take
+ BOOL delete_object = (BOOL)(intptr_t)data;
+ LLViewerRegion *region = gAgent.getRegion();
+ if (delete_object && region)
+ {
+ gMessageSystem->newMessageFast(_PREHASH_ObjectDelete);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ const U8 NO_FORCE = 0;
+ gMessageSystem->addU8Fast(_PREHASH_Force, NO_FORCE);
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
+ gMessageSystem->sendReliable(region->getHost());
+ }
}
// method to format the time.
std::string formatted_time(const time_t& the_time)
{
- std::string dateStr = "["+LLTrans::getString("LTimeWeek")+"] ["
- +LLTrans::getString("LTimeMonth")+"] ["
- +LLTrans::getString("LTimeDay")+"] ["
- +LLTrans::getString("LTimeHour")+"]:["
- +LLTrans::getString("LTimeMin")+"]:["
- +LLTrans::getString("LTimeSec")+"] ["
- +LLTrans::getString("LTimeYear")+"]";
+ std::string dateStr = "["+LLTrans::getString("LTimeWeek")+"] ["
+ +LLTrans::getString("LTimeMonth")+"] ["
+ +LLTrans::getString("LTimeDay")+"] ["
+ +LLTrans::getString("LTimeHour")+"]:["
+ +LLTrans::getString("LTimeMin")+"]:["
+ +LLTrans::getString("LTimeSec")+"] ["
+ +LLTrans::getString("LTimeYear")+"]";
- LLSD substitution;
- substitution["datetime"] = (S32) the_time;
- LLStringUtil::format (dateStr, substitution);
- return dateStr;
+ LLSD substitution;
+ substitution["datetime"] = (S32) the_time;
+ LLStringUtil::format (dateStr, substitution);
+ return dateStr;
}
void process_teleport_failed(LLMessageSystem *msg, void**)
{
- LL_WARNS("Teleport","Messaging") << "Received TeleportFailed message" << LL_ENDL;
-
- std::string message_id; // Tag from server, like "RegionEntryAccessBlocked"
- std::string big_reason; // Actual message to display
- LLSD args;
-
- // Let the interested parties know that teleport failed.
- LLViewerParcelMgr::getInstance()->onTeleportFailed();
-
- // if we have additional alert data
- if (msg->has(_PREHASH_AlertInfo) && msg->getSizeFast(_PREHASH_AlertInfo, _PREHASH_Message) > 0)
- {
- // Get the message ID
- msg->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, message_id);
- big_reason = LLAgent::sTeleportErrorMessages[message_id];
- if ( big_reason.size() <= 0 )
- {
- // Nothing found in the map - use what the server returned in the original message block
- msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, big_reason);
- }
- LL_WARNS("Teleport") << "AlertInfo message_id " << message_id << " reason: " << big_reason << LL_ENDL;
-
- LLSD llsd_block;
- std::string llsd_raw;
- msg->getStringFast(_PREHASH_AlertInfo, _PREHASH_ExtraParams, llsd_raw);
- if (llsd_raw.length())
- {
- std::istringstream llsd_data(llsd_raw);
- if (!LLSDSerialize::deserialize(llsd_block, llsd_data, llsd_raw.length()))
- {
- LL_WARNS("Teleport") << "process_teleport_failed: Attempted to read alert parameter data into LLSD but failed:" << llsd_raw << LL_ENDL;
- }
- else
- {
- LL_WARNS("Teleport") << "AlertInfo llsd block received: " << llsd_block << LL_ENDL;
- if(llsd_block.has("REGION_NAME"))
- {
- std::string region_name = llsd_block["REGION_NAME"].asString();
- if(!region_name.empty())
- {
- LLStringUtil::format_map_t name_args;
- name_args["[REGION_NAME]"] = region_name;
- LLStringUtil::format(big_reason, name_args);
- }
- }
- // change notification name in this special case
- if (handle_teleport_access_blocked(llsd_block, message_id, args["REASON"]))
- {
- if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
- {
- LL_WARNS("Teleport") << "called handle_teleport_access_blocked, setting state to TELEPORT_NONE" << LL_ENDL;
- gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
- }
- return;
- }
- }
- }
- args["REASON"] = big_reason;
- }
- else
- { // Extra message payload not found - use what the simulator sent
- msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, message_id);
-
- big_reason = LLAgent::sTeleportErrorMessages[message_id];
- if ( big_reason.size() > 0 )
- { // Substitute verbose reason from the local map
- args["REASON"] = big_reason;
- }
- else
- { // Nothing found in the map - use what the server returned
- args["REASON"] = message_id;
- }
- }
- LL_WARNS("Teleport") << "Displaying CouldNotTeleportReason string, REASON= " << args["REASON"] << LL_ENDL;
-
- LLNotificationsUtil::add("CouldNotTeleportReason", args);
-
- if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
- {
- LL_WARNS("Teleport") << "End of process_teleport_failed(). Reason message arg is " << args["REASON"]
- << ". Setting state to TELEPORT_NONE" << LL_ENDL;
- gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
- }
+ LL_WARNS("Teleport","Messaging") << "Received TeleportFailed message" << LL_ENDL;
+
+ std::string message_id; // Tag from server, like "RegionEntryAccessBlocked"
+ std::string big_reason; // Actual message to display
+ LLSD args;
+
+ // Let the interested parties know that teleport failed.
+ LLViewerParcelMgr::getInstance()->onTeleportFailed();
+
+ // if we have additional alert data
+ if (msg->has(_PREHASH_AlertInfo) && msg->getSizeFast(_PREHASH_AlertInfo, _PREHASH_Message) > 0)
+ {
+ // Get the message ID
+ msg->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, message_id);
+ big_reason = LLAgent::sTeleportErrorMessages[message_id];
+ if ( big_reason.size() <= 0 )
+ {
+ // Nothing found in the map - use what the server returned in the original message block
+ msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, big_reason);
+ }
+ LL_WARNS("Teleport") << "AlertInfo message_id " << message_id << " reason: " << big_reason << LL_ENDL;
+
+ LLSD llsd_block;
+ std::string llsd_raw;
+ msg->getStringFast(_PREHASH_AlertInfo, _PREHASH_ExtraParams, llsd_raw);
+ if (llsd_raw.length())
+ {
+ std::istringstream llsd_data(llsd_raw);
+ if (!LLSDSerialize::deserialize(llsd_block, llsd_data, llsd_raw.length()))
+ {
+ LL_WARNS("Teleport") << "process_teleport_failed: Attempted to read alert parameter data into LLSD but failed:" << llsd_raw << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Teleport") << "AlertInfo llsd block received: " << llsd_block << LL_ENDL;
+ if(llsd_block.has("REGION_NAME"))
+ {
+ std::string region_name = llsd_block["REGION_NAME"].asString();
+ if(!region_name.empty())
+ {
+ LLStringUtil::format_map_t name_args;
+ name_args["[REGION_NAME]"] = region_name;
+ LLStringUtil::format(big_reason, name_args);
+ }
+ }
+ // change notification name in this special case
+ if (handle_teleport_access_blocked(llsd_block, message_id, args["REASON"]))
+ {
+ if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
+ {
+ LL_WARNS("Teleport") << "called handle_teleport_access_blocked, setting state to TELEPORT_NONE" << LL_ENDL;
+ gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
+ }
+ return;
+ }
+ }
+ }
+ args["REASON"] = big_reason;
+ }
+ else
+ { // Extra message payload not found - use what the simulator sent
+ msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, message_id);
+
+ big_reason = LLAgent::sTeleportErrorMessages[message_id];
+ if ( big_reason.size() > 0 )
+ { // Substitute verbose reason from the local map
+ args["REASON"] = big_reason;
+ }
+ else
+ { // Nothing found in the map - use what the server returned
+ args["REASON"] = message_id;
+ }
+ }
+ LL_WARNS("Teleport") << "Displaying CouldNotTeleportReason string, REASON= " << args["REASON"] << LL_ENDL;
+
+ LLNotificationsUtil::add("CouldNotTeleportReason", args);
+
+ if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
+ {
+ LL_WARNS("Teleport") << "End of process_teleport_failed(). Reason message arg is " << args["REASON"]
+ << ". Setting state to TELEPORT_NONE" << LL_ENDL;
+ gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
+ }
}
void process_teleport_local(LLMessageSystem *msg,void**)
{
- LL_INFOS("Teleport","Messaging") << "Received TeleportLocal message" << LL_ENDL;
-
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id);
- if (agent_id != gAgent.getID())
- {
- LL_WARNS("Teleport", "Messaging") << "Got teleport notification for wrong agent " << agent_id << " expected " << gAgent.getID() << ", ignoring!" << LL_ENDL;
- return;
- }
-
- U32 location_id;
- LLVector3 pos, look_at;
- U32 teleport_flags;
- msg->getU32Fast(_PREHASH_Info, _PREHASH_LocationID, location_id);
- msg->getVector3Fast(_PREHASH_Info, _PREHASH_Position, pos);
- msg->getVector3Fast(_PREHASH_Info, _PREHASH_LookAt, look_at);
- msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags);
-
- LL_INFOS("Teleport") << "Message params are location_id " << location_id << " teleport_flags " << teleport_flags << LL_ENDL;
- if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
- {
- if( gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL )
- {
- // To prevent TeleportStart messages re-activating the progress screen right
- // after tp, keep the teleport state and let progress screen clear it after a short delay
- // (progress screen is active but not visible) *TODO: remove when SVC-5290 is fixed
- gTeleportDisplayTimer.reset();
- gTeleportDisplay = TRUE;
- }
- else
- {
- LL_WARNS("Teleport") << "State is not TELEPORT_LOCAL: " << gAgent.getTeleportStateName()
- << ", setting state to TELEPORT_NONE" << LL_ENDL;
- gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
- }
- }
-
- // Sim tells us whether the new position is off the ground
- if (teleport_flags & TELEPORT_FLAGS_IS_FLYING)
- {
- gAgent.setFlying(TRUE);
- }
- else
- {
- gAgent.setFlying(FALSE);
- }
-
- gAgent.setPositionAgent(pos);
- gAgentCamera.slamLookAt(look_at);
-
- if ( !(gAgent.getTeleportKeepsLookAt() && LLViewerJoystick::getInstance()->getOverrideCamera()) )
- {
- gAgentCamera.resetView(TRUE, TRUE);
- }
-
- // send camera update to new region
- gAgentCamera.updateCamera();
-
- send_agent_update(TRUE, TRUE);
-
- // Let the interested parties know we've teleported.
- // Vadim *HACK: Agent position seems to get reset (to render position?)
- // on each frame, so we have to pass the new position manually.
- LLViewerParcelMgr::getInstance()->onTeleportFinished(true, gAgent.getPosGlobalFromAgent(pos));
+ LL_INFOS("Teleport","Messaging") << "Received TeleportLocal message" << LL_ENDL;
+
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id);
+ if (agent_id != gAgent.getID())
+ {
+ LL_WARNS("Teleport", "Messaging") << "Got teleport notification for wrong agent " << agent_id << " expected " << gAgent.getID() << ", ignoring!" << LL_ENDL;
+ return;
+ }
+
+ U32 location_id;
+ LLVector3 pos, look_at;
+ U32 teleport_flags;
+ msg->getU32Fast(_PREHASH_Info, _PREHASH_LocationID, location_id);
+ msg->getVector3Fast(_PREHASH_Info, _PREHASH_Position, pos);
+ msg->getVector3Fast(_PREHASH_Info, _PREHASH_LookAt, look_at);
+ msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags);
+
+ LL_INFOS("Teleport") << "Message params are location_id " << location_id << " teleport_flags " << teleport_flags << LL_ENDL;
+ if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
+ {
+ if( gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL )
+ {
+ // To prevent TeleportStart messages re-activating the progress screen right
+ // after tp, keep the teleport state and let progress screen clear it after a short delay
+ // (progress screen is active but not visible) *TODO: remove when SVC-5290 is fixed
+ gTeleportDisplayTimer.reset();
+ gTeleportDisplay = TRUE;
+ }
+ else
+ {
+ LL_WARNS("Teleport") << "State is not TELEPORT_LOCAL: " << gAgent.getTeleportStateName()
+ << ", setting state to TELEPORT_NONE" << LL_ENDL;
+ gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
+ }
+ }
+
+ // Sim tells us whether the new position is off the ground
+ if (teleport_flags & TELEPORT_FLAGS_IS_FLYING)
+ {
+ gAgent.setFlying(TRUE);
+ }
+ else
+ {
+ gAgent.setFlying(FALSE);
+ }
+
+ gAgent.setPositionAgent(pos);
+ gAgentCamera.slamLookAt(look_at);
+
+ if ( !(gAgent.getTeleportKeepsLookAt() && LLViewerJoystick::getInstance()->getOverrideCamera()) )
+ {
+ gAgentCamera.resetView(TRUE, TRUE);
+ }
+
+ // send camera update to new region
+ gAgentCamera.updateCamera();
+
+ send_agent_update(TRUE, TRUE);
+
+ // Let the interested parties know we've teleported.
+ // Vadim *HACK: Agent position seems to get reset (to render position?)
+ // on each frame, so we have to pass the new position manually.
+ LLViewerParcelMgr::getInstance()->onTeleportFinished(true, gAgent.getPosGlobalFromAgent(pos));
}
void send_simple_im(const LLUUID& to_id,
- const std::string& message,
- EInstantMessage dialog,
- const LLUUID& id)
-{
- std::string my_name;
- LLAgentUI::buildFullname(my_name);
- send_improved_im(to_id,
- my_name,
- message,
- IM_ONLINE,
- dialog,
- id,
- NO_TIMESTAMP,
- (U8*)EMPTY_BINARY_BUCKET,
- EMPTY_BINARY_BUCKET_SIZE);
+ const std::string& message,
+ EInstantMessage dialog,
+ const LLUUID& id)
+{
+ std::string my_name;
+ LLAgentUI::buildFullname(my_name);
+ send_improved_im(to_id,
+ my_name,
+ message,
+ IM_ONLINE,
+ dialog,
+ id,
+ NO_TIMESTAMP,
+ (U8*)EMPTY_BINARY_BUCKET,
+ EMPTY_BINARY_BUCKET_SIZE);
}
void send_group_notice(const LLUUID& group_id,
- const std::string& subject,
- const std::string& message,
- const LLInventoryItem* item)
-{
- // Put this notice into an instant message form.
- // This will mean converting the item to a binary bucket,
- // and the subject/message into a single field.
- std::string my_name;
- LLAgentUI::buildFullname(my_name);
-
- // Combine subject + message into a single string.
- std::ostringstream subject_and_message;
- // TODO: turn all existing |'s into ||'s in subject and message.
- subject_and_message << subject << "|" << message;
-
- // Create an empty binary bucket.
- U8 bin_bucket[MAX_INVENTORY_BUFFER_SIZE];
- U8* bucket_to_send = bin_bucket;
- bin_bucket[0] = '\0';
- S32 bin_bucket_size = EMPTY_BINARY_BUCKET_SIZE;
- // If there is an item being sent, pack it into the binary bucket.
- if (item)
- {
- LLSD item_def;
- item_def["item_id"] = item->getUUID();
- item_def["owner_id"] = item->getPermissions().getOwner();
- std::ostringstream ostr;
- LLSDSerialize::serialize(item_def, ostr, LLSDSerialize::LLSD_XML);
- bin_bucket_size = ostr.str().copy(
- (char*)bin_bucket, ostr.str().size());
- bin_bucket[bin_bucket_size] = '\0';
- }
- else
- {
- bucket_to_send = (U8*) EMPTY_BINARY_BUCKET;
- }
-
-
- send_improved_im(
- group_id,
- my_name,
- subject_and_message.str(),
- IM_ONLINE,
- IM_GROUP_NOTICE,
- LLUUID::null,
- NO_TIMESTAMP,
- bucket_to_send,
- bin_bucket_size);
+ const std::string& subject,
+ const std::string& message,
+ const LLInventoryItem* item)
+{
+ // Put this notice into an instant message form.
+ // This will mean converting the item to a binary bucket,
+ // and the subject/message into a single field.
+ std::string my_name;
+ LLAgentUI::buildFullname(my_name);
+
+ // Combine subject + message into a single string.
+ std::ostringstream subject_and_message;
+ // TODO: turn all existing |'s into ||'s in subject and message.
+ subject_and_message << subject << "|" << message;
+
+ // Create an empty binary bucket.
+ U8 bin_bucket[MAX_INVENTORY_BUFFER_SIZE];
+ U8* bucket_to_send = bin_bucket;
+ bin_bucket[0] = '\0';
+ S32 bin_bucket_size = EMPTY_BINARY_BUCKET_SIZE;
+ // If there is an item being sent, pack it into the binary bucket.
+ if (item)
+ {
+ LLSD item_def;
+ item_def["item_id"] = item->getUUID();
+ item_def["owner_id"] = item->getPermissions().getOwner();
+ std::ostringstream ostr;
+ LLSDSerialize::serialize(item_def, ostr, LLSDSerialize::LLSD_XML);
+ bin_bucket_size = ostr.str().copy(
+ (char*)bin_bucket, ostr.str().size());
+ bin_bucket[bin_bucket_size] = '\0';
+ }
+ else
+ {
+ bucket_to_send = (U8*) EMPTY_BINARY_BUCKET;
+ }
+
+
+ send_improved_im(
+ group_id,
+ my_name,
+ subject_and_message.str(),
+ IM_ONLINE,
+ IM_GROUP_NOTICE,
+ LLUUID::null,
+ NO_TIMESTAMP,
+ bucket_to_send,
+ bin_bucket_size);
}
void send_lures(const LLSD& notification, const LLSD& response)
{
- std::string text = response["message"].asString();
- LLSLURL slurl;
- LLAgentUI::buildSLURL(slurl);
- text.append("\r\n").append(slurl.getSLURLString());
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_StartLure);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Info);
- msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in.
- msg->addStringFast(_PREHASH_Message, text);
- for(LLSD::array_const_iterator it = notification["payload"]["ids"].beginArray();
- it != notification["payload"]["ids"].endArray();
- ++it)
- {
- LLUUID target_id = it->asUUID();
-
- msg->nextBlockFast(_PREHASH_TargetData);
- msg->addUUIDFast(_PREHASH_TargetID, target_id);
-
- // Record the offer.
- {
- LLAvatarName av_name;
- LLAvatarNameCache::get(target_id, &av_name); // for im log filenames
- LLSD args;
- args["TO_NAME"] = LLSLURL("agent", target_id, "completename").getSLURLString();;
-
- LLSD payload;
-
- //*TODO please rewrite all keys to the same case, lower or upper
- payload["from_id"] = target_id;
- payload["SUPPRESS_TOAST"] = true;
- LLNotificationsUtil::add("TeleportOfferSent", args, payload);
-
- // Add the recepient to the recent people list.
- LLRecentPeople::instance().add(target_id);
- }
- }
- gAgent.sendReliableMessage();
+ std::string text = response["message"].asString();
+ LLSLURL slurl;
+ LLAgentUI::buildSLURL(slurl);
+ text.append("\r\n").append(slurl.getSLURLString());
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_StartLure);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_Info);
+ msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in.
+ msg->addStringFast(_PREHASH_Message, text);
+ for(LLSD::array_const_iterator it = notification["payload"]["ids"].beginArray();
+ it != notification["payload"]["ids"].endArray();
+ ++it)
+ {
+ LLUUID target_id = it->asUUID();
+
+ msg->nextBlockFast(_PREHASH_TargetData);
+ msg->addUUIDFast(_PREHASH_TargetID, target_id);
+
+ // Record the offer.
+ {
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(target_id, &av_name); // for im log filenames
+ LLSD args;
+ args["TO_NAME"] = LLSLURL("agent", target_id, "completename").getSLURLString();;
+
+ LLSD payload;
+
+ //*TODO please rewrite all keys to the same case, lower or upper
+ payload["from_id"] = target_id;
+ payload["SUPPRESS_TOAST"] = true;
+ LLNotificationsUtil::add("TeleportOfferSent", args, payload);
+
+ // Add the recepient to the recent people list.
+ LLRecentPeople::instance().add(target_id);
+ }
+ }
+ gAgent.sendReliableMessage();
}
bool handle_lure_callback(const LLSD& notification, const LLSD& response)
{
- static const unsigned OFFER_RECIPIENT_LIMIT = 250;
- if(notification["payload"]["ids"].size() > OFFER_RECIPIENT_LIMIT)
- {
- // More than OFFER_RECIPIENT_LIMIT targets will overload the message
- // producing an llerror.
- LLSD args;
- args["OFFERS"] = LLSD::Integer(notification["payload"]["ids"].size());
- args["LIMIT"] = static_cast<int>(OFFER_RECIPIENT_LIMIT);
- LLNotificationsUtil::add("TooManyTeleportOffers", args);
- return false;
- }
+ static const unsigned OFFER_RECIPIENT_LIMIT = 250;
+ if(notification["payload"]["ids"].size() > OFFER_RECIPIENT_LIMIT)
+ {
+ // More than OFFER_RECIPIENT_LIMIT targets will overload the message
+ // producing an llerror.
+ LLSD args;
+ args["OFFERS"] = LLSD::Integer(notification["payload"]["ids"].size());
+ args["LIMIT"] = static_cast<int>(OFFER_RECIPIENT_LIMIT);
+ LLNotificationsUtil::add("TooManyTeleportOffers", args);
+ return false;
+ }
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if(0 == option)
- {
- send_lures(notification, response);
- }
+ if(0 == option)
+ {
+ send_lures(notification, response);
+ }
- return false;
+ return false;
}
void handle_lure(const LLUUID& invitee)
{
- std::vector<LLUUID> ids;
- ids.push_back(invitee);
- handle_lure(ids);
+ std::vector<LLUUID> ids;
+ ids.push_back(invitee);
+ handle_lure(ids);
}
// Prompt for a message to the invited user.
void handle_lure(const uuid_vec_t& ids)
{
- if (ids.empty()) return;
+ if (ids.empty()) return;
- if (!gAgent.getRegion()) return;
+ if (!gAgent.getRegion()) return;
- LLSD edit_args;
- edit_args["REGION"] = gAgent.getRegion()->getName();
+ LLSD edit_args;
+ edit_args["REGION"] = gAgent.getRegion()->getName();
- LLSD payload;
- for (std::vector<LLUUID>::const_iterator it = ids.begin();
- it != ids.end();
- ++it)
- {
- payload["ids"].append(*it);
- }
- if (gAgent.isGodlike())
- {
- LLNotificationsUtil::add("OfferTeleportFromGod", edit_args, payload, handle_lure_callback);
- }
- else
- {
- LLNotificationsUtil::add("OfferTeleport", edit_args, payload, handle_lure_callback);
- }
+ LLSD payload;
+ for (std::vector<LLUUID>::const_iterator it = ids.begin();
+ it != ids.end();
+ ++it)
+ {
+ payload["ids"].append(*it);
+ }
+ if (gAgent.isGodlike())
+ {
+ LLNotificationsUtil::add("OfferTeleportFromGod", edit_args, payload, handle_lure_callback);
+ }
+ else
+ {
+ LLNotificationsUtil::add("OfferTeleport", edit_args, payload, handle_lure_callback);
+ }
}
bool teleport_request_callback(const LLSD& notification, const LLSD& response)
{
- LLUUID from_id = notification["payload"]["from_id"].asUUID();
- if(from_id.isNull())
- {
- LL_WARNS() << "from_id is NULL" << LL_ENDL;
- return false;
- }
-
- LLAvatarName av_name;
- LLAvatarNameCache::get(from_id, &av_name);
-
- if(LLMuteList::getInstance()->isMuted(from_id) && !LLMuteList::isLinden(av_name.getUserName()))
- {
- return false;
- }
-
- S32 option = 0;
- if (response.isInteger())
- {
- option = response.asInteger();
- }
- else
- {
- option = LLNotificationsUtil::getSelectedOption(notification, response);
- }
-
- switch(option)
- {
- // Yes
- case 0:
- {
- LLSD dummy_notification;
- dummy_notification["payload"]["ids"][0] = from_id;
-
- LLSD dummy_response;
- dummy_response["message"] = response["message"];
-
- send_lures(dummy_notification, dummy_response);
- }
- break;
-
- // No
- case 1:
- default:
- break;
- }
-
- return false;
+ LLUUID from_id = notification["payload"]["from_id"].asUUID();
+ if(from_id.isNull())
+ {
+ LL_WARNS() << "from_id is NULL" << LL_ENDL;
+ return false;
+ }
+
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(from_id, &av_name);
+
+ if(LLMuteList::getInstance()->isMuted(from_id) && !LLMuteList::isLinden(av_name.getUserName()))
+ {
+ return false;
+ }
+
+ S32 option = 0;
+ if (response.isInteger())
+ {
+ option = response.asInteger();
+ }
+ else
+ {
+ option = LLNotificationsUtil::getSelectedOption(notification, response);
+ }
+
+ switch(option)
+ {
+ // Yes
+ case 0:
+ {
+ LLSD dummy_notification;
+ dummy_notification["payload"]["ids"][0] = from_id;
+
+ LLSD dummy_response;
+ dummy_response["message"] = response["message"];
+
+ send_lures(dummy_notification, dummy_response);
+ }
+ break;
+
+ // No
+ case 1:
+ default:
+ break;
+ }
+
+ return false;
}
static LLNotificationFunctorRegistration teleport_request_callback_reg("TeleportRequest", teleport_request_callback);
void send_improved_im(const LLUUID& to_id,
- const std::string& name,
- const std::string& message,
- U8 offline,
- EInstantMessage dialog,
- const LLUUID& id,
- U32 timestamp,
- const U8* binary_bucket,
- S32 binary_bucket_size)
-{
- pack_instant_message(
- gMessageSystem,
- gAgent.getID(),
- FALSE,
- gAgent.getSessionID(),
- to_id,
- name,
- message,
- offline,
- dialog,
- id,
- 0,
- LLUUID::null,
- gAgent.getPositionAgent(),
- timestamp,
- binary_bucket,
- binary_bucket_size);
- gAgent.sendReliableMessage();
+ const std::string& name,
+ const std::string& message,
+ U8 offline,
+ EInstantMessage dialog,
+ const LLUUID& id,
+ U32 timestamp,
+ const U8* binary_bucket,
+ S32 binary_bucket_size)
+{
+ pack_instant_message(
+ gMessageSystem,
+ gAgent.getID(),
+ FALSE,
+ gAgent.getSessionID(),
+ to_id,
+ name,
+ message,
+ offline,
+ dialog,
+ id,
+ 0,
+ LLUUID::null,
+ gAgent.getPositionAgent(),
+ timestamp,
+ binary_bucket,
+ binary_bucket_size);
+ gAgent.sendReliableMessage();
}
void send_places_query(const LLUUID& query_id,
- const LLUUID& trans_id,
- const std::string& query_text,
- U32 query_flags,
- S32 category,
- const std::string& sim_name)
-{
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessage("PlacesQuery");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addUUID("QueryID", query_id);
- msg->nextBlock("TransactionData");
- msg->addUUID("TransactionID", trans_id);
- msg->nextBlock("QueryData");
- msg->addString("QueryText", query_text);
- msg->addU32("QueryFlags", query_flags);
- msg->addS8("Category", (S8)category);
- msg->addString("SimName", sim_name);
- gAgent.sendReliableMessage();
+ const LLUUID& trans_id,
+ const std::string& query_text,
+ U32 query_flags,
+ S32 category,
+ const std::string& sim_name)
+{
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessage("PlacesQuery");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->addUUID("QueryID", query_id);
+ msg->nextBlock("TransactionData");
+ msg->addUUID("TransactionID", trans_id);
+ msg->nextBlock("QueryData");
+ msg->addString("QueryText", query_text);
+ msg->addU32("QueryFlags", query_flags);
+ msg->addS8("Category", (S8)category);
+ msg->addString("SimName", sim_name);
+ gAgent.sendReliableMessage();
}
// Deprecated in favor of cap "UserInfo"
void process_user_info_reply(LLMessageSystem* msg, void**)
{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS("Messaging") << "process_user_info_reply - "
- << "wrong agent id." << LL_ENDL;
- }
-
- std::string email;
- msg->getStringFast(_PREHASH_UserData, _PREHASH_EMail, email);
- std::string dir_visibility;
- msg->getString( "UserData", "DirectoryVisibility", dir_visibility);
+ LLUUID agent_id;
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
+ if(agent_id != gAgent.getID())
+ {
+ LL_WARNS("Messaging") << "process_user_info_reply - "
+ << "wrong agent id." << LL_ENDL;
+ }
+
+ std::string email;
+ msg->getStringFast(_PREHASH_UserData, _PREHASH_EMail, email);
+ std::string dir_visibility;
+ msg->getString( "UserData", "DirectoryVisibility", dir_visibility);
- LLFloaterPreference::updateUserInfo(dir_visibility);
- LLFloaterSnapshot::setAgentEmail(email);
+ LLFloaterPreference::updateUserInfo(dir_visibility);
+ LLFloaterSnapshot::setAgentEmail(email);
}
@@ -6539,133 +6539,133 @@ const char* SCRIPT_DIALOG_HEADER = "Script Dialog:\n";
bool callback_script_dialog(const LLSD& notification, const LLSD& response)
{
- LLNotificationForm form(notification["form"]);
-
- std::string rtn_text;
- S32 button_idx;
- button_idx = LLNotification::getSelectedOption(notification, response);
- if (response[TEXTBOX_MAGIC_TOKEN].isDefined())
- {
- if (response[TEXTBOX_MAGIC_TOKEN].isString())
- rtn_text = response[TEXTBOX_MAGIC_TOKEN].asString();
- else
- rtn_text.clear(); // bool marks empty string
- }
- else
- {
- rtn_text = LLNotification::getSelectedOptionName(response);
- }
-
- // Button -2 = Mute
- // Button -1 = Ignore - no processing needed for this button
- // Buttons 0 and above = dialog choices
-
- if (-2 == button_idx)
- {
- std::string object_name = notification["payload"]["object_name"].asString();
- LLUUID object_id = notification["payload"]["object_id"].asUUID();
- LLMute mute(object_id, object_name, LLMute::OBJECT);
- if (LLMuteList::getInstance()->add(mute))
- {
- // This call opens the sidebar, displays the block list, and highlights the newly blocked
- // object in the list so the user can see that their block click has taken effect.
- LLPanelBlockedList::showPanelAndSelect(object_id);
- }
- }
-
- if (0 <= button_idx)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ScriptDialogReply");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addUUID("ObjectID", notification["payload"]["object_id"].asUUID());
- msg->addS32("ChatChannel", notification["payload"]["chat_channel"].asInteger());
- msg->addS32("ButtonIndex", button_idx);
- msg->addString("ButtonLabel", rtn_text);
- msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
- }
-
- return false;
+ LLNotificationForm form(notification["form"]);
+
+ std::string rtn_text;
+ S32 button_idx;
+ button_idx = LLNotification::getSelectedOption(notification, response);
+ if (response[TEXTBOX_MAGIC_TOKEN].isDefined())
+ {
+ if (response[TEXTBOX_MAGIC_TOKEN].isString())
+ rtn_text = response[TEXTBOX_MAGIC_TOKEN].asString();
+ else
+ rtn_text.clear(); // bool marks empty string
+ }
+ else
+ {
+ rtn_text = LLNotification::getSelectedOptionName(response);
+ }
+
+ // Button -2 = Mute
+ // Button -1 = Ignore - no processing needed for this button
+ // Buttons 0 and above = dialog choices
+
+ if (-2 == button_idx)
+ {
+ std::string object_name = notification["payload"]["object_name"].asString();
+ LLUUID object_id = notification["payload"]["object_id"].asUUID();
+ LLMute mute(object_id, object_name, LLMute::OBJECT);
+ if (LLMuteList::getInstance()->add(mute))
+ {
+ // This call opens the sidebar, displays the block list, and highlights the newly blocked
+ // object in the list so the user can see that their block click has taken effect.
+ LLPanelBlockedList::showPanelAndSelect(object_id);
+ }
+ }
+
+ if (0 <= button_idx)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ScriptDialogReply");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addUUID("ObjectID", notification["payload"]["object_id"].asUUID());
+ msg->addS32("ChatChannel", notification["payload"]["chat_channel"].asInteger());
+ msg->addS32("ButtonIndex", button_idx);
+ msg->addString("ButtonLabel", rtn_text);
+ msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
+ }
+
+ return false;
}
static LLNotificationFunctorRegistration callback_script_dialog_reg_1("ScriptDialog", callback_script_dialog);
static LLNotificationFunctorRegistration callback_script_dialog_reg_2("ScriptDialogGroup", callback_script_dialog);
void process_script_dialog(LLMessageSystem* msg, void**)
{
- S32 i;
- LLSD payload;
+ S32 i;
+ LLSD payload;
- LLUUID object_id;
- msg->getUUID("Data", "ObjectID", object_id);
+ LLUUID object_id;
+ msg->getUUID("Data", "ObjectID", object_id);
-// For compability with OS grids first check for presence of extended packet before fetching data.
+// For compability with OS grids first check for presence of extended packet before fetching data.
LLUUID owner_id;
- if (gMessageSystem->getNumberOfBlocks("OwnerData") > 0)
- {
+ if (gMessageSystem->getNumberOfBlocks("OwnerData") > 0)
+ {
msg->getUUID("OwnerData", "OwnerID", owner_id);
- }
-
- if (LLMuteList::getInstance()->isMuted(object_id) || LLMuteList::getInstance()->isMuted(owner_id))
- {
- return;
- }
-
- std::string message;
- std::string first_name;
- std::string last_name;
- std::string object_name;
-
- S32 chat_channel;
- msg->getString("Data", "FirstName", first_name);
- msg->getString("Data", "LastName", last_name);
- msg->getString("Data", "ObjectName", object_name);
- msg->getString("Data", "Message", message);
- msg->getS32("Data", "ChatChannel", chat_channel);
-
- // unused for now
- LLUUID image_id;
- msg->getUUID("Data", "ImageID", image_id);
-
- payload["sender"] = msg->getSender().getIPandPort();
- payload["object_id"] = object_id;
- payload["chat_channel"] = chat_channel;
- payload["object_name"] = object_name;
-
- // build up custom form
- S32 button_count = msg->getNumberOfBlocks("Buttons");
- if (button_count > SCRIPT_DIALOG_MAX_BUTTONS)
- {
- LL_WARNS() << "Too many script dialog buttons - omitting some" << LL_ENDL;
- button_count = SCRIPT_DIALOG_MAX_BUTTONS;
- }
-
- LLNotificationForm form;
- for (i = 0; i < button_count; i++)
- {
- std::string tdesc;
- msg->getString("Buttons", "ButtonLabel", tdesc, i);
- form.addElement("button", std::string(tdesc));
- }
-
- LLSD args;
- args["TITLE"] = object_name;
- args["MESSAGE"] = message;
- LLNotificationPtr notification;
- if (!first_name.empty())
- {
- args["NAME"] = LLCacheName::buildFullName(first_name, last_name);
- notification = LLNotifications::instance().add(
- LLNotification::Params("ScriptDialog").substitutions(args).payload(payload).form_elements(form.asLLSD()));
- }
- else
- {
- args["GROUPNAME"] = last_name;
- notification = LLNotifications::instance().add(
- LLNotification::Params("ScriptDialogGroup").substitutions(args).payload(payload).form_elements(form.asLLSD()));
- }
+ }
+
+ if (LLMuteList::getInstance()->isMuted(object_id) || LLMuteList::getInstance()->isMuted(owner_id))
+ {
+ return;
+ }
+
+ std::string message;
+ std::string first_name;
+ std::string last_name;
+ std::string object_name;
+
+ S32 chat_channel;
+ msg->getString("Data", "FirstName", first_name);
+ msg->getString("Data", "LastName", last_name);
+ msg->getString("Data", "ObjectName", object_name);
+ msg->getString("Data", "Message", message);
+ msg->getS32("Data", "ChatChannel", chat_channel);
+
+ // unused for now
+ LLUUID image_id;
+ msg->getUUID("Data", "ImageID", image_id);
+
+ payload["sender"] = msg->getSender().getIPandPort();
+ payload["object_id"] = object_id;
+ payload["chat_channel"] = chat_channel;
+ payload["object_name"] = object_name;
+
+ // build up custom form
+ S32 button_count = msg->getNumberOfBlocks("Buttons");
+ if (button_count > SCRIPT_DIALOG_MAX_BUTTONS)
+ {
+ LL_WARNS() << "Too many script dialog buttons - omitting some" << LL_ENDL;
+ button_count = SCRIPT_DIALOG_MAX_BUTTONS;
+ }
+
+ LLNotificationForm form;
+ for (i = 0; i < button_count; i++)
+ {
+ std::string tdesc;
+ msg->getString("Buttons", "ButtonLabel", tdesc, i);
+ form.addElement("button", std::string(tdesc));
+ }
+
+ LLSD args;
+ args["TITLE"] = object_name;
+ args["MESSAGE"] = message;
+ LLNotificationPtr notification;
+ if (!first_name.empty())
+ {
+ args["NAME"] = LLCacheName::buildFullName(first_name, last_name);
+ notification = LLNotifications::instance().add(
+ LLNotification::Params("ScriptDialog").substitutions(args).payload(payload).form_elements(form.asLLSD()));
+ }
+ else
+ {
+ args["GROUPNAME"] = last_name;
+ notification = LLNotifications::instance().add(
+ LLNotification::Params("ScriptDialogGroup").substitutions(args).payload(payload).form_elements(form.asLLSD()));
+ }
}
//---------------------------------------------------------------------------
@@ -6675,14 +6675,14 @@ std::vector<LLSD> gLoadUrlList;
bool callback_load_url(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- LLWeb::loadURL(notification["payload"]["url"].asString());
- }
+ if (0 == option)
+ {
+ LLWeb::loadURL(notification["payload"]["url"].asString());
+ }
- return false;
+ return false;
}
static LLNotificationFunctorRegistration callback_load_url_reg("LoadWebPage", callback_load_url);
@@ -6690,42 +6690,42 @@ static LLNotificationFunctorRegistration callback_load_url_reg("LoadWebPage", ca
// Display confirmation dialog.
void callback_load_url_name(const LLUUID& id, const std::string& full_name, bool is_group)
{
- std::vector<LLSD>::iterator it;
- for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); )
- {
- LLSD load_url_info = *it;
- if (load_url_info["owner_id"].asUUID() == id)
- {
- it = gLoadUrlList.erase(it);
-
- std::string owner_name;
- if (is_group)
- {
- owner_name = full_name + LLTrans::getString("Group");
- }
- else
- {
- owner_name = full_name;
- }
-
- // For legacy name-only mutes.
- if (LLMuteList::getInstance()->isMuted(LLUUID::null, owner_name))
- {
- continue;
- }
- LLSD args;
- args["URL"] = load_url_info["url"].asString();
- args["MESSAGE"] = load_url_info["message"].asString();;
- args["OBJECTNAME"] = load_url_info["object_name"].asString();
- args["NAME_SLURL"] = LLSLURL(is_group ? "group" : "agent", id, "about").getSLURLString();
-
- LLNotificationsUtil::add("LoadWebPage", args, load_url_info);
- }
- else
- {
- ++it;
- }
- }
+ std::vector<LLSD>::iterator it;
+ for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); )
+ {
+ LLSD load_url_info = *it;
+ if (load_url_info["owner_id"].asUUID() == id)
+ {
+ it = gLoadUrlList.erase(it);
+
+ std::string owner_name;
+ if (is_group)
+ {
+ owner_name = full_name + LLTrans::getString("Group");
+ }
+ else
+ {
+ owner_name = full_name;
+ }
+
+ // For legacy name-only mutes.
+ if (LLMuteList::getInstance()->isMuted(LLUUID::null, owner_name))
+ {
+ continue;
+ }
+ LLSD args;
+ args["URL"] = load_url_info["url"].asString();
+ args["MESSAGE"] = load_url_info["message"].asString();;
+ args["OBJECTNAME"] = load_url_info["object_name"].asString();
+ args["NAME_SLURL"] = LLSLURL(is_group ? "group" : "agent", id, "about").getSLURLString();
+
+ LLNotificationsUtil::add("LoadWebPage", args, load_url_info);
+ }
+ else
+ {
+ ++it;
+ }
+ }
}
// We've got the name of the person who owns the object hurling the url.
@@ -6736,296 +6736,296 @@ void callback_load_url_avatar_name(const LLUUID& id, const LLAvatarName& av_name
void process_load_url(LLMessageSystem* msg, void**)
{
- LLUUID object_id;
- LLUUID owner_id;
- BOOL owner_is_group;
- char object_name[256]; /* Flawfinder: ignore */
- char message[256]; /* Flawfinder: ignore */
- char url[256]; /* Flawfinder: ignore */
-
- msg->getString("Data", "ObjectName", 256, object_name);
- msg->getUUID( "Data", "ObjectID", object_id);
- msg->getUUID( "Data", "OwnerID", owner_id);
- msg->getBOOL( "Data", "OwnerIsGroup", owner_is_group);
- msg->getString("Data", "Message", 256, message);
- msg->getString("Data", "URL", 256, url);
-
- LLSD payload;
- payload["object_id"] = object_id;
- payload["owner_id"] = owner_id;
- payload["owner_is_group"] = owner_is_group;
- payload["object_name"] = object_name;
- payload["message"] = message;
- payload["url"] = url;
-
- // URL is safety checked in load_url above
-
- // Check if object or owner is muted
- if (LLMuteList::getInstance()->isMuted(object_id, object_name) ||
- LLMuteList::getInstance()->isMuted(owner_id))
- {
- LL_INFOS("Messaging")<<"Ignoring load_url from muted object/owner."<<LL_ENDL;
- return;
- }
-
- // Add to list of pending name lookups
- gLoadUrlList.push_back(payload);
-
- if (owner_is_group)
- {
- gCacheName->getGroup(owner_id, boost::bind(&callback_load_url_name, _1, _2, _3));
- }
- else
- {
- LLAvatarNameCache::get(owner_id, boost::bind(&callback_load_url_avatar_name, _1, _2));
- }
+ LLUUID object_id;
+ LLUUID owner_id;
+ BOOL owner_is_group;
+ char object_name[256]; /* Flawfinder: ignore */
+ char message[256]; /* Flawfinder: ignore */
+ char url[256]; /* Flawfinder: ignore */
+
+ msg->getString("Data", "ObjectName", 256, object_name);
+ msg->getUUID( "Data", "ObjectID", object_id);
+ msg->getUUID( "Data", "OwnerID", owner_id);
+ msg->getBOOL( "Data", "OwnerIsGroup", owner_is_group);
+ msg->getString("Data", "Message", 256, message);
+ msg->getString("Data", "URL", 256, url);
+
+ LLSD payload;
+ payload["object_id"] = object_id;
+ payload["owner_id"] = owner_id;
+ payload["owner_is_group"] = owner_is_group;
+ payload["object_name"] = object_name;
+ payload["message"] = message;
+ payload["url"] = url;
+
+ // URL is safety checked in load_url above
+
+ // Check if object or owner is muted
+ if (LLMuteList::getInstance()->isMuted(object_id, object_name) ||
+ LLMuteList::getInstance()->isMuted(owner_id))
+ {
+ LL_INFOS("Messaging")<<"Ignoring load_url from muted object/owner."<<LL_ENDL;
+ return;
+ }
+
+ // Add to list of pending name lookups
+ gLoadUrlList.push_back(payload);
+
+ if (owner_is_group)
+ {
+ gCacheName->getGroup(owner_id, boost::bind(&callback_load_url_name, _1, _2, _3));
+ }
+ else
+ {
+ LLAvatarNameCache::get(owner_id, boost::bind(&callback_load_url_avatar_name, _1, _2));
+ }
}
void callback_download_complete(void** data, S32 result, LLExtStat ext_status)
{
- std::string* filepath = (std::string*)data;
- LLSD args;
- args["DOWNLOAD_PATH"] = *filepath;
- LLNotificationsUtil::add("FinishedRawDownload", args);
- delete filepath;
+ std::string* filepath = (std::string*)data;
+ LLSD args;
+ args["DOWNLOAD_PATH"] = *filepath;
+ LLNotificationsUtil::add("FinishedRawDownload", args);
+ delete filepath;
}
void process_initiate_download(LLMessageSystem* msg, void**)
{
- LLUUID agent_id;
- msg->getUUID("AgentData", "AgentID", agent_id);
- if (agent_id != gAgent.getID())
- {
- LL_WARNS("Messaging") << "Initiate download for wrong agent" << LL_ENDL;
- return;
- }
-
- std::string sim_filename;
- std::string viewer_filename;
- msg->getString("FileData", "SimFilename", sim_filename);
- msg->getString("FileData", "ViewerFilename", viewer_filename);
-
- if (!gXferManager->validateFileForRequest(viewer_filename))
- {
- LL_WARNS() << "SECURITY: Unauthorized download to local file " << viewer_filename << LL_ENDL;
- return;
- }
- gXferManager->requestFile(viewer_filename,
- sim_filename,
- LL_PATH_NONE,
- msg->getSender(),
- FALSE, // don't delete remote
- callback_download_complete,
- (void**)new std::string(viewer_filename));
+ LLUUID agent_id;
+ msg->getUUID("AgentData", "AgentID", agent_id);
+ if (agent_id != gAgent.getID())
+ {
+ LL_WARNS("Messaging") << "Initiate download for wrong agent" << LL_ENDL;
+ return;
+ }
+
+ std::string sim_filename;
+ std::string viewer_filename;
+ msg->getString("FileData", "SimFilename", sim_filename);
+ msg->getString("FileData", "ViewerFilename", viewer_filename);
+
+ if (!gXferManager->validateFileForRequest(viewer_filename))
+ {
+ LL_WARNS() << "SECURITY: Unauthorized download to local file " << viewer_filename << LL_ENDL;
+ return;
+ }
+ gXferManager->requestFile(viewer_filename,
+ sim_filename,
+ LL_PATH_NONE,
+ msg->getSender(),
+ FALSE, // don't delete remote
+ callback_download_complete,
+ (void**)new std::string(viewer_filename));
}
void process_script_teleport_request(LLMessageSystem* msg, void**)
{
- if (!gSavedSettings.getBOOL("ScriptsCanShowUI")) return;
+ if (!gSavedSettings.getBOOL("ScriptsCanShowUI")) return;
+
+ std::string object_name;
+ std::string sim_name;
+ LLVector3 pos;
+ LLVector3 look_at;
+
+ msg->getString("Data", "ObjectName", object_name);
+ msg->getString("Data", "SimName", sim_name);
+ msg->getVector3("Data", "SimPosition", pos);
+ msg->getVector3("Data", "LookAt", look_at);
- std::string object_name;
- std::string sim_name;
- LLVector3 pos;
- LLVector3 look_at;
+ LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
+ if(instance)
+ {
+ LL_INFOS() << "Object named " << object_name
+ << " is offering TP to region "
+ << sim_name << " position " << pos
+ << LL_ENDL;
- msg->getString("Data", "ObjectName", object_name);
- msg->getString("Data", "SimName", sim_name);
- msg->getVector3("Data", "SimPosition", pos);
- msg->getVector3("Data", "LookAt", look_at);
+ instance->trackURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
- LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
- if(instance)
- {
- LL_INFOS() << "Object named " << object_name
- << " is offering TP to region "
- << sim_name << " position " << pos
- << LL_ENDL;
+ // remove above two lines and replace with below line
+ // to re-enable parcel browser for llMapDestination()
+ // LLURLDispatcher::dispatch(LLSLURL::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), FALSE);
- instance->trackURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]);
- LLFloaterReg::showInstance("world_map", "center");
- }
-
- // remove above two lines and replace with below line
- // to re-enable parcel browser for llMapDestination()
- // LLURLDispatcher::dispatch(LLSLURL::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), FALSE);
-
}
void process_covenant_reply(LLMessageSystem* msg, void**)
{
- LLUUID covenant_id, estate_owner_id;
- std::string estate_name;
- U32 covenant_timestamp;
- msg->getUUID("Data", "CovenantID", covenant_id);
- msg->getU32("Data", "CovenantTimestamp", covenant_timestamp);
- msg->getString("Data", "EstateName", estate_name);
- msg->getUUID("Data", "EstateOwnerID", estate_owner_id);
-
- LLPanelEstateCovenant::updateEstateName(estate_name);
- LLPanelLandCovenant::updateEstateName(estate_name);
- LLPanelEstateInfo::updateEstateName(estate_name);
- LLFloaterBuyLand::updateEstateName(estate_name);
-
- std::string owner_name =
- LLSLURL("agent", estate_owner_id, "inspect").getSLURLString();
- LLPanelEstateCovenant::updateEstateOwnerName(owner_name);
- LLPanelLandCovenant::updateEstateOwnerName(owner_name);
- LLPanelEstateInfo::updateEstateOwnerName(owner_name);
- LLFloaterBuyLand::updateEstateOwnerName(owner_name);
-
- LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile");
- if (panel)
- {
- panel->updateEstateName(estate_name);
- panel->updateEstateOwnerName(owner_name);
- }
-
- // standard message, not from system
- std::string last_modified;
- if (covenant_timestamp == 0)
- {
- last_modified = LLTrans::getString("covenant_last_modified")+LLTrans::getString("never_text");
- }
- else
- {
- last_modified = LLTrans::getString("covenant_last_modified")+"["
- +LLTrans::getString("LTimeWeek")+"] ["
- +LLTrans::getString("LTimeMonth")+"] ["
- +LLTrans::getString("LTimeDay")+"] ["
- +LLTrans::getString("LTimeHour")+"]:["
- +LLTrans::getString("LTimeMin")+"]:["
- +LLTrans::getString("LTimeSec")+"] ["
- +LLTrans::getString("LTimeYear")+"]";
- LLSD substitution;
- substitution["datetime"] = (S32) covenant_timestamp;
- LLStringUtil::format (last_modified, substitution);
- }
-
- LLPanelEstateCovenant::updateLastModified(last_modified);
- LLPanelLandCovenant::updateLastModified(last_modified);
- LLFloaterBuyLand::updateLastModified(last_modified);
-
- // load the actual covenant asset data
- const BOOL high_priority = TRUE;
- if (covenant_id.notNull())
- {
- gAssetStorage->getEstateAsset(gAgent.getRegionHost(),
- gAgent.getID(),
- gAgent.getSessionID(),
- covenant_id,
+ LLUUID covenant_id, estate_owner_id;
+ std::string estate_name;
+ U32 covenant_timestamp;
+ msg->getUUID("Data", "CovenantID", covenant_id);
+ msg->getU32("Data", "CovenantTimestamp", covenant_timestamp);
+ msg->getString("Data", "EstateName", estate_name);
+ msg->getUUID("Data", "EstateOwnerID", estate_owner_id);
+
+ LLPanelEstateCovenant::updateEstateName(estate_name);
+ LLPanelLandCovenant::updateEstateName(estate_name);
+ LLPanelEstateInfo::updateEstateName(estate_name);
+ LLFloaterBuyLand::updateEstateName(estate_name);
+
+ std::string owner_name =
+ LLSLURL("agent", estate_owner_id, "inspect").getSLURLString();
+ LLPanelEstateCovenant::updateEstateOwnerName(owner_name);
+ LLPanelLandCovenant::updateEstateOwnerName(owner_name);
+ LLPanelEstateInfo::updateEstateOwnerName(owner_name);
+ LLFloaterBuyLand::updateEstateOwnerName(owner_name);
+
+ LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile");
+ if (panel)
+ {
+ panel->updateEstateName(estate_name);
+ panel->updateEstateOwnerName(owner_name);
+ }
+
+ // standard message, not from system
+ std::string last_modified;
+ if (covenant_timestamp == 0)
+ {
+ last_modified = LLTrans::getString("covenant_last_modified")+LLTrans::getString("never_text");
+ }
+ else
+ {
+ last_modified = LLTrans::getString("covenant_last_modified")+"["
+ +LLTrans::getString("LTimeWeek")+"] ["
+ +LLTrans::getString("LTimeMonth")+"] ["
+ +LLTrans::getString("LTimeDay")+"] ["
+ +LLTrans::getString("LTimeHour")+"]:["
+ +LLTrans::getString("LTimeMin")+"]:["
+ +LLTrans::getString("LTimeSec")+"] ["
+ +LLTrans::getString("LTimeYear")+"]";
+ LLSD substitution;
+ substitution["datetime"] = (S32) covenant_timestamp;
+ LLStringUtil::format (last_modified, substitution);
+ }
+
+ LLPanelEstateCovenant::updateLastModified(last_modified);
+ LLPanelLandCovenant::updateLastModified(last_modified);
+ LLFloaterBuyLand::updateLastModified(last_modified);
+
+ // load the actual covenant asset data
+ const BOOL high_priority = TRUE;
+ if (covenant_id.notNull())
+ {
+ gAssetStorage->getEstateAsset(gAgent.getRegionHost(),
+ gAgent.getID(),
+ gAgent.getSessionID(),
+ covenant_id,
LLAssetType::AT_NOTECARD,
- ET_Covenant,
+ ET_Covenant,
onCovenantLoadComplete,
- NULL,
- high_priority);
- }
- else
- {
- std::string covenant_text;
- if (estate_owner_id.isNull())
- {
- // mainland
- covenant_text = LLTrans::getString("RegionNoCovenant");
- }
- else
- {
- covenant_text = LLTrans::getString("RegionNoCovenantOtherOwner");
- }
- LLPanelEstateCovenant::updateCovenantText(covenant_text, covenant_id);
- LLPanelLandCovenant::updateCovenantText(covenant_text);
- LLFloaterBuyLand::updateCovenantText(covenant_text, covenant_id);
- if (panel)
- {
- panel->updateCovenantText(covenant_text);
- }
- }
+ NULL,
+ high_priority);
+ }
+ else
+ {
+ std::string covenant_text;
+ if (estate_owner_id.isNull())
+ {
+ // mainland
+ covenant_text = LLTrans::getString("RegionNoCovenant");
+ }
+ else
+ {
+ covenant_text = LLTrans::getString("RegionNoCovenantOtherOwner");
+ }
+ LLPanelEstateCovenant::updateCovenantText(covenant_text, covenant_id);
+ LLPanelLandCovenant::updateCovenantText(covenant_text);
+ LLFloaterBuyLand::updateCovenantText(covenant_text, covenant_id);
+ if (panel)
+ {
+ panel->updateCovenantText(covenant_text);
+ }
+ }
}
void onCovenantLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status)
-{
- LL_DEBUGS("Messaging") << "onCovenantLoadComplete()" << LL_ENDL;
- std::string covenant_text;
- if(0 == status)
- {
- LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
-
- S32 file_length = file.getSize();
-
- std::vector<char> buffer(file_length+1);
- file.read((U8*)&buffer[0], file_length);
- // put a EOS at the end
- buffer[file_length] = '\0';
-
- if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) )
- {
- LLViewerTextEditor::Params params;
- params.name("temp");
- params.max_text_length(file_length+1);
- LLViewerTextEditor * editor = LLUICtrlFactory::create<LLViewerTextEditor> (params);
- if( !editor->importBuffer( &buffer[0], file_length+1 ) )
- {
- LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL;
- covenant_text = "Problem importing estate covenant.";
- }
- else
- {
- // Version 0 (just text, doesn't include version number)
- covenant_text = editor->getText();
- }
- delete editor;
- }
- else
- {
- LL_WARNS("Messaging") << "Problem importing estate covenant: Covenant file format error." << LL_ENDL;
- covenant_text = "Problem importing estate covenant: Covenant file format error.";
- }
- }
- else
- {
- if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
- LL_ERR_FILE_EMPTY == status)
- {
- covenant_text = "Estate covenant notecard is missing from database.";
- }
- else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
- {
- covenant_text = "Insufficient permissions to view estate covenant.";
- }
- else
- {
- covenant_text = "Unable to load estate covenant at this time.";
- }
-
- LL_WARNS("Messaging") << "Problem loading notecard: " << status << LL_ENDL;
- }
- LLPanelEstateCovenant::updateCovenantText(covenant_text, asset_uuid);
- LLPanelLandCovenant::updateCovenantText(covenant_text);
- LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid);
-
- LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile");
- if (panel)
- {
- panel->updateCovenantText(covenant_text);
- }
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status)
+{
+ LL_DEBUGS("Messaging") << "onCovenantLoadComplete()" << LL_ENDL;
+ std::string covenant_text;
+ if(0 == status)
+ {
+ LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
+
+ S32 file_length = file.getSize();
+
+ std::vector<char> buffer(file_length+1);
+ file.read((U8*)&buffer[0], file_length);
+ // put a EOS at the end
+ buffer[file_length] = '\0';
+
+ if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) )
+ {
+ LLViewerTextEditor::Params params;
+ params.name("temp");
+ params.max_text_length(file_length+1);
+ LLViewerTextEditor * editor = LLUICtrlFactory::create<LLViewerTextEditor> (params);
+ if( !editor->importBuffer( &buffer[0], file_length+1 ) )
+ {
+ LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL;
+ covenant_text = "Problem importing estate covenant.";
+ }
+ else
+ {
+ // Version 0 (just text, doesn't include version number)
+ covenant_text = editor->getText();
+ }
+ delete editor;
+ }
+ else
+ {
+ LL_WARNS("Messaging") << "Problem importing estate covenant: Covenant file format error." << LL_ENDL;
+ covenant_text = "Problem importing estate covenant: Covenant file format error.";
+ }
+ }
+ else
+ {
+ if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
+ LL_ERR_FILE_EMPTY == status)
+ {
+ covenant_text = "Estate covenant notecard is missing from database.";
+ }
+ else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
+ {
+ covenant_text = "Insufficient permissions to view estate covenant.";
+ }
+ else
+ {
+ covenant_text = "Unable to load estate covenant at this time.";
+ }
+
+ LL_WARNS("Messaging") << "Problem loading notecard: " << status << LL_ENDL;
+ }
+ LLPanelEstateCovenant::updateCovenantText(covenant_text, asset_uuid);
+ LLPanelLandCovenant::updateCovenantText(covenant_text);
+ LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid);
+
+ LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile");
+ if (panel)
+ {
+ panel->updateCovenantText(covenant_text);
+ }
}
void process_feature_disabled_message(LLMessageSystem* msg, void**)
{
- // Handle Blacklisted feature simulator response...
- LLUUID agentID;
- LLUUID transactionID;
- std::string messageText;
- msg->getStringFast(_PREHASH_FailureInfo,_PREHASH_ErrorMessage, messageText,0);
- msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_AgentID,agentID);
- msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_TransactionID,transactionID);
-
- LL_WARNS("Messaging") << "Blacklisted Feature Response:" << messageText << LL_ENDL;
+ // Handle Blacklisted feature simulator response...
+ LLUUID agentID;
+ LLUUID transactionID;
+ std::string messageText;
+ msg->getStringFast(_PREHASH_FailureInfo,_PREHASH_ErrorMessage, messageText,0);
+ msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_AgentID,agentID);
+ msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_TransactionID,transactionID);
+
+ LL_WARNS("Messaging") << "Blacklisted Feature Response:" << messageText << LL_ENDL;
}
// ------------------------------------------------------------
@@ -7033,8 +7033,8 @@ void process_feature_disabled_message(LLMessageSystem* msg, void**)
// ------------------------------------------------------------
void invalid_message_callback(LLMessageSystem* msg,
- void*,
- EMessageException exception)
+ void*,
+ EMessageException exception)
{
LLAppViewer::instance()->badNetworkHandler();
}
@@ -7044,8 +7044,8 @@ void invalid_message_callback(LLMessageSystem* msg,
void LLOfferInfo::forceResponse(InventoryOfferResponse response)
{
- LLNotification::Params params("UserGiveItem");
- params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2));
- LLNotifications::instance().forceResponse(params, response);
+ LLNotification::Params params("UserGiveItem");
+ params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2));
+ LLNotifications::instance().forceResponse(params, response);
}
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index 1e5a69ae13..2403e3de97 100644
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewermessage.h
* @brief Message system callbacks for viewer.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,20 +56,20 @@ class LLViewerRegion;
enum InventoryOfferResponse
{
- IOR_ACCEPT,
- IOR_DECLINE,
- IOR_MUTE,
- IOR_SHOW
+ IOR_ACCEPT,
+ IOR_DECLINE,
+ IOR_MUTE,
+ IOR_SHOW
};
BOOL can_afford_transaction(S32 cost);
void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group = FALSE,
- S32 trx_type = TRANS_GIFT, const std::string& desc = LLStringUtil::null);
+ S32 trx_type = TRANS_GIFT, const std::string& desc = LLStringUtil::null);
void send_join_group_response(LLUUID group_id,
- LLUUID transaction_id,
- bool accept_invite,
- S32 fee,
- bool use_offline_cap);
+ LLUUID transaction_id,
+ bool accept_invite,
+ S32 fee,
+ bool use_offline_cap);
void process_logout_reply(LLMessageSystem* msg, void**);
void process_layer_data(LLMessageSystem *mesgsys, void **user_data);
@@ -88,12 +88,12 @@ void process_cached_object_update(LLMessageSystem *mesgsys, void **user_data);
void process_terse_object_update_improved(LLMessageSystem *mesgsys, void **user_data);
void send_simulator_throttle_settings(const LLHost &host);
-void process_kill_object( LLMessageSystem *mesgsys, void **user_data);
-void process_time_synch( LLMessageSystem *mesgsys, void **user_data);
+void process_kill_object( LLMessageSystem *mesgsys, void **user_data);
+void process_time_synch( LLMessageSystem *mesgsys, void **user_data);
void process_sound_trigger(LLMessageSystem *mesgsys, void **user_data);
-void process_preload_sound( LLMessageSystem *mesgsys, void **user_data);
-void process_attached_sound( LLMessageSystem *mesgsys, void **user_data);
-void process_attached_sound_gain_change( LLMessageSystem *mesgsys, void **user_data);
+void process_preload_sound( LLMessageSystem *mesgsys, void **user_data);
+void process_attached_sound( LLMessageSystem *mesgsys, void **user_data);
+void process_attached_sound_gain_change( LLMessageSystem *mesgsys, void **user_data);
void process_energy_statistics(LLMessageSystem *mesgsys, void **user_data);
void process_health_message(LLMessageSystem *mesgsys, void **user_data);
void process_sim_stats(LLMessageSystem *mesgsys, void **user_data);
@@ -129,9 +129,9 @@ void process_frozen_message(LLMessageSystem* msg, void**);
void process_derez_container(LLMessageSystem *msg, void**);
void container_inventory_arrived(LLViewerObject* object,
- std::list<LLPointer<LLInventoryObject> >* inventory, //LLInventoryObject::object_list_t
- S32 serial_num,
- void* data);
+ std::list<LLPointer<LLInventoryObject> >* inventory, //LLInventoryObject::object_list_t
+ S32 serial_num,
+ void* data);
// agent movement
void send_complete_agent_movement(const LLHost& sim_host);
@@ -147,50 +147,50 @@ void process_teleport_local(LLMessageSystem *msg,void**);
void process_user_sim_location_reply(LLMessageSystem *msg,void**);
void send_simple_im(const LLUUID& to_id,
- const std::string& message,
- EInstantMessage dialog = IM_NOTHING_SPECIAL,
- const LLUUID& id = LLUUID::null);
+ const std::string& message,
+ EInstantMessage dialog = IM_NOTHING_SPECIAL,
+ const LLUUID& id = LLUUID::null);
void send_group_notice(const LLUUID& group_id,
- const std::string& subject,
- const std::string& message,
- const LLInventoryItem* item);
+ const std::string& subject,
+ const std::string& message,
+ const LLInventoryItem* item);
void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id = LLUUID::null);
void handle_lure(const LLUUID& invitee);
void handle_lure(const uuid_vec_t& ids);
-// always from gAgent and
+// always from gAgent and
// routes through the gAgent's current simulator
void send_improved_im(const LLUUID& to_id,
- const std::string& name,
- const std::string& message,
- U8 offline = IM_ONLINE,
- EInstantMessage dialog = IM_NOTHING_SPECIAL,
- const LLUUID& id = LLUUID::null,
- U32 timestamp = NO_TIMESTAMP,
- const U8* binary_bucket = (U8*)EMPTY_BINARY_BUCKET,
- S32 binary_bucket_size = EMPTY_BINARY_BUCKET_SIZE);
+ const std::string& name,
+ const std::string& message,
+ U8 offline = IM_ONLINE,
+ EInstantMessage dialog = IM_NOTHING_SPECIAL,
+ const LLUUID& id = LLUUID::null,
+ U32 timestamp = NO_TIMESTAMP,
+ const U8* binary_bucket = (U8*)EMPTY_BINARY_BUCKET,
+ S32 binary_bucket_size = EMPTY_BINARY_BUCKET_SIZE);
void process_user_info_reply(LLMessageSystem* msg, void**);
-// method to format the time.
+// method to format the time.
std::string formatted_time(const time_t& the_time);
void send_places_query(const LLUUID& query_id,
- const LLUUID& trans_id,
- const std::string& query_text,
- U32 query_flags,
- S32 category,
- const std::string& sim_name);
+ const LLUUID& trans_id,
+ const std::string& query_text,
+ U32 query_flags,
+ S32 category,
+ const std::string& sim_name);
void process_script_dialog(LLMessageSystem* msg, void**);
void process_load_url(LLMessageSystem* msg, void**);
void process_script_teleport_request(LLMessageSystem* msg, void**);
void process_covenant_reply(LLMessageSystem* msg, void**);
void onCovenantLoadComplete(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status);
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status);
// calling cards
void process_offer_callingcard(LLMessageSystem* msg, void**);
@@ -214,60 +214,60 @@ void set_dad_inbox_object(const LLUUID& object_id);
class LLViewerMessage : public LLSingleton<LLViewerMessage>
{
- LLSINGLETON_EMPTY_CTOR(LLViewerMessage);
+ LLSINGLETON_EMPTY_CTOR(LLViewerMessage);
public:
- typedef boost::function<void()> teleport_started_callback_t;
- typedef boost::signals2::signal<void()> teleport_started_signal_t;
- boost::signals2::connection setTeleportStartedCallback(teleport_started_callback_t cb);
+ typedef boost::function<void()> teleport_started_callback_t;
+ typedef boost::signals2::signal<void()> teleport_started_signal_t;
+ boost::signals2::connection setTeleportStartedCallback(teleport_started_callback_t cb);
- teleport_started_signal_t mTeleportStartedSignal;
+ teleport_started_signal_t mTeleportStartedSignal;
};
class LLOfferInfo : public LLNotificationResponderInterface
{
public:
- LLOfferInfo();
- LLOfferInfo(const LLSD& sd);
+ LLOfferInfo();
+ LLOfferInfo(const LLSD& sd);
- LLOfferInfo(const LLOfferInfo& info);
+ LLOfferInfo(const LLOfferInfo& info);
- void forceResponse(InventoryOfferResponse response);
+ void forceResponse(InventoryOfferResponse response);
static std::string mResponderType;
- EInstantMessage mIM;
- LLUUID mFromID;
- BOOL mFromGroup;
- BOOL mFromObject;
- LLUUID mTransactionID;
- LLUUID mFolderID;
- LLUUID mObjectID;
- LLAssetType::EType mType;
- std::string mFromName;
- std::string mDesc;
- LLHost mHost;
- bool mPersist;
-
- // LLNotificationResponderInterface implementation
- /*virtual*/ LLSD asLLSD();
- /*virtual*/ void fromLLSD(const LLSD& params);
- /*virtual*/ void handleRespond(const LLSD& notification, const LLSD& response);
-
- void send_auto_receive_response() { sendReceiveResponse(true, mFolderID); }
-
- // TODO - replace all references with handleRespond()
- bool inventory_offer_callback(const LLSD& notification, const LLSD& response);
- bool inventory_task_offer_callback(const LLSD& notification, const LLSD& response);
+ EInstantMessage mIM;
+ LLUUID mFromID;
+ BOOL mFromGroup;
+ BOOL mFromObject;
+ LLUUID mTransactionID;
+ LLUUID mFolderID;
+ LLUUID mObjectID;
+ LLAssetType::EType mType;
+ std::string mFromName;
+ std::string mDesc;
+ LLHost mHost;
+ bool mPersist;
+
+ // LLNotificationResponderInterface implementation
+ /*virtual*/ LLSD asLLSD();
+ /*virtual*/ void fromLLSD(const LLSD& params);
+ /*virtual*/ void handleRespond(const LLSD& notification, const LLSD& response);
+
+ void send_auto_receive_response() { sendReceiveResponse(true, mFolderID); }
+
+ // TODO - replace all references with handleRespond()
+ bool inventory_offer_callback(const LLSD& notification, const LLSD& response);
+ bool inventory_task_offer_callback(const LLSD& notification, const LLSD& response);
private:
- void initRespondFunctionMap();
- std::string getSanitizedDescription();
- void sendReceiveResponse(bool accept, const LLUUID &destination_folder_id);
+ void initRespondFunctionMap();
+ std::string getSanitizedDescription();
+ void sendReceiveResponse(bool accept, const LLUUID &destination_folder_id);
- typedef boost::function<bool (const LLSD&, const LLSD&)> respond_function_t;
- typedef std::map<std::string, respond_function_t> respond_function_map_t;
+ typedef boost::function<bool (const LLSD&, const LLSD&)> respond_function_t;
+ typedef std::map<std::string, respond_function_t> respond_function_map_t;
- respond_function_map_t mRespondFunctions;
+ respond_function_map_t mRespondFunctions;
};
void process_feature_disabled_message(LLMessageSystem* msg, void**);
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index be05ac0d3a..16ddc2f89c 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -79,18 +79,18 @@ const char* DEFAULT_SLURL_BASE = "https://%s/region/";
const char* DEFAULT_APP_SLURL_BASE = "x-grid-location-info://%s/app";
LLGridManager::LLGridManager()
-: mIsInProductionGrid(false)
+: mIsInProductionGrid(false)
{
- // by default, we use the 'grids.xml' file in the user settings directory
- // this file is an LLSD file containing multiple grid definitions.
- // This file does not contain definitions for secondlife.com grids,
- // as that would be a security issue when they are overwritten by
- // an attacker. Don't want someone snagging a password.
- std::string grid_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
- "grids.xml");
- LL_DEBUGS("GridManager")<<LL_ENDL;
+ // by default, we use the 'grids.xml' file in the user settings directory
+ // this file is an LLSD file containing multiple grid definitions.
+ // This file does not contain definitions for secondlife.com grids,
+ // as that would be a security issue when they are overwritten by
+ // an attacker. Don't want someone snagging a password.
+ std::string grid_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+ "grids.xml");
+ LL_DEBUGS("GridManager")<<LL_ENDL;
- initialize(grid_file);
+ initialize(grid_file);
}
@@ -107,136 +107,136 @@ LLGridManager::LLGridManager()
// and the grids.xml file
void LLGridManager::initialize(const std::string& grid_file)
{
- // default grid list.
- // Don't move to a modifiable file for security reasons,
- mGrid.clear() ;
-
- // set to undefined
- mGridList = LLSD();
- mGridFile = grid_file;
- // as we don't want an attacker to override our grid list
- // to point the default grid to an invalid grid
- addSystemGrid(LLTrans::getString("AgniGridLabel"),
- MAINGRID,
- MAIN_GRID_LOGIN_URI,
- "https://secondlife.com/helpers/",
- DEFAULT_LOGIN_PAGE,
- SL_UPDATE_QUERY_URL,
- MAIN_GRID_WEB_PROFILE_URL,
- "Agni");
- addSystemGrid(LLTrans::getString("AditiGridLabel"),
- "util.aditi.lindenlab.com",
- "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
- "https://secondlife.aditi.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE,
- SL_UPDATE_QUERY_URL,
- "https://my.secondlife-beta.com/",
- "Aditi");
-
- LLSD other_grids;
- llifstream llsd_xml;
- if (!grid_file.empty())
- {
- LL_INFOS("GridManager")<<"Grid configuration file '"<<grid_file<<"'"<<LL_ENDL;
- llsd_xml.open( grid_file.c_str(), std::ios::in | std::ios::binary );
-
- // parse through the gridfile, inserting grids into the list unless
- // they overwrite an existing grid.
- if( llsd_xml.is_open())
- {
- LLSDSerialize::fromXMLDocument( other_grids, llsd_xml );
- if(other_grids.isMap())
- {
- for(LLSD::map_iterator grid_itr = other_grids.beginMap();
- grid_itr != other_grids.endMap();
- ++grid_itr)
- {
- LLSD::String key_name = grid_itr->first;
- LLSD grid = grid_itr->second;
-
- std::string existingGrid = getGrid(grid);
- if (mGridList.has(key_name) || !existingGrid.empty())
- {
- LL_WARNS("GridManager") << "Cannot override existing grid '" << key_name << "'; ignoring definition from '"<<grid_file<<"'" << LL_ENDL;
- }
- else if ( addGrid(grid) )
- {
- LL_INFOS("GridManager") << "added grid '"<<key_name<<"'"<<LL_ENDL;
- }
- else
- {
- LL_WARNS("GridManager") << "failed to add invalid grid '"<<key_name<<"'"<<LL_ENDL;
- }
- }
- llsd_xml.close();
- }
- else
- {
- LL_WARNS("GridManager")<<"Failed to parse grid configuration '"<<grid_file<<"'"<<LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("GridManager")<<"Failed to open grid configuration '"<<grid_file<<"'"<<LL_ENDL;
- }
- }
- else
- {
- LL_DEBUGS("GridManager")<<"no grid file specified"<<LL_ENDL;
- }
-
- // load a grid from the command line.
- // if the actual grid name is specified from the command line,
- // set it as the 'selected' grid.
- std::string cmd_line_grid = gSavedSettings.getString("CmdLineGridChoice");
- if(!cmd_line_grid.empty())
- {
- // try to find the grid assuming the command line parameter is
- // the case-insensitive 'label' of the grid. ie 'Agni'
- mGrid = getGrid(cmd_line_grid);
- if(mGrid.empty())
- {
- LL_WARNS("GridManager")<<"Unknown grid '"<<cmd_line_grid<<"'"<<LL_ENDL;
- }
- else
- {
- LL_INFOS("GridManager")<<"Command line specified '"<<cmd_line_grid<<"': "<<mGrid<<LL_ENDL;
- }
- }
- else
- {
- // if a grid was not passed in via the command line, grab it from the CurrentGrid setting.
- // if there's no current grid, that's ok as it'll be either set by the value passed
- // in via the login uri if that's specified, or will default to maingrid
- std::string last_grid = gSavedSettings.getString("CurrentGrid");
- if ( ! getGrid(last_grid).empty() )
- {
- LL_INFOS("GridManager")<<"Using last grid: "<<last_grid<<LL_ENDL;
- mGrid = last_grid;
- }
- else
- {
- LL_INFOS("GridManager")<<"Last grid '"<<last_grid<<"' not configured"<<LL_ENDL;
- }
- }
-
- if(mGrid.empty())
- {
- // no grid was specified so default to maingrid
- LL_INFOS("GridManager") << "Default grid to "<<MAINGRID<< LL_ENDL;
- mGrid = MAINGRID;
- }
-
- LLControlVariablePtr grid_control = gSavedSettings.getControl("CurrentGrid");
- if (grid_control.notNull())
- {
- grid_control->getSignal()->connect(boost::bind(&LLGridManager::updateIsInProductionGrid, this));
- }
-
- // since above only triggers on changes, trigger the callback manually to initialize state
- updateIsInProductionGrid();
-
- setGridChoice(mGrid);
+ // default grid list.
+ // Don't move to a modifiable file for security reasons,
+ mGrid.clear() ;
+
+ // set to undefined
+ mGridList = LLSD();
+ mGridFile = grid_file;
+ // as we don't want an attacker to override our grid list
+ // to point the default grid to an invalid grid
+ addSystemGrid(LLTrans::getString("AgniGridLabel"),
+ MAINGRID,
+ MAIN_GRID_LOGIN_URI,
+ "https://secondlife.com/helpers/",
+ DEFAULT_LOGIN_PAGE,
+ SL_UPDATE_QUERY_URL,
+ MAIN_GRID_WEB_PROFILE_URL,
+ "Agni");
+ addSystemGrid(LLTrans::getString("AditiGridLabel"),
+ "util.aditi.lindenlab.com",
+ "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
+ "https://secondlife.aditi.lindenlab.com/helpers/",
+ DEFAULT_LOGIN_PAGE,
+ SL_UPDATE_QUERY_URL,
+ "https://my.secondlife-beta.com/",
+ "Aditi");
+
+ LLSD other_grids;
+ llifstream llsd_xml;
+ if (!grid_file.empty())
+ {
+ LL_INFOS("GridManager")<<"Grid configuration file '"<<grid_file<<"'"<<LL_ENDL;
+ llsd_xml.open( grid_file.c_str(), std::ios::in | std::ios::binary );
+
+ // parse through the gridfile, inserting grids into the list unless
+ // they overwrite an existing grid.
+ if( llsd_xml.is_open())
+ {
+ LLSDSerialize::fromXMLDocument( other_grids, llsd_xml );
+ if(other_grids.isMap())
+ {
+ for(LLSD::map_iterator grid_itr = other_grids.beginMap();
+ grid_itr != other_grids.endMap();
+ ++grid_itr)
+ {
+ LLSD::String key_name = grid_itr->first;
+ LLSD grid = grid_itr->second;
+
+ std::string existingGrid = getGrid(grid);
+ if (mGridList.has(key_name) || !existingGrid.empty())
+ {
+ LL_WARNS("GridManager") << "Cannot override existing grid '" << key_name << "'; ignoring definition from '"<<grid_file<<"'" << LL_ENDL;
+ }
+ else if ( addGrid(grid) )
+ {
+ LL_INFOS("GridManager") << "added grid '"<<key_name<<"'"<<LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("GridManager") << "failed to add invalid grid '"<<key_name<<"'"<<LL_ENDL;
+ }
+ }
+ llsd_xml.close();
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"Failed to parse grid configuration '"<<grid_file<<"'"<<LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"Failed to open grid configuration '"<<grid_file<<"'"<<LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("GridManager")<<"no grid file specified"<<LL_ENDL;
+ }
+
+ // load a grid from the command line.
+ // if the actual grid name is specified from the command line,
+ // set it as the 'selected' grid.
+ std::string cmd_line_grid = gSavedSettings.getString("CmdLineGridChoice");
+ if(!cmd_line_grid.empty())
+ {
+ // try to find the grid assuming the command line parameter is
+ // the case-insensitive 'label' of the grid. ie 'Agni'
+ mGrid = getGrid(cmd_line_grid);
+ if(mGrid.empty())
+ {
+ LL_WARNS("GridManager")<<"Unknown grid '"<<cmd_line_grid<<"'"<<LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS("GridManager")<<"Command line specified '"<<cmd_line_grid<<"': "<<mGrid<<LL_ENDL;
+ }
+ }
+ else
+ {
+ // if a grid was not passed in via the command line, grab it from the CurrentGrid setting.
+ // if there's no current grid, that's ok as it'll be either set by the value passed
+ // in via the login uri if that's specified, or will default to maingrid
+ std::string last_grid = gSavedSettings.getString("CurrentGrid");
+ if ( ! getGrid(last_grid).empty() )
+ {
+ LL_INFOS("GridManager")<<"Using last grid: "<<last_grid<<LL_ENDL;
+ mGrid = last_grid;
+ }
+ else
+ {
+ LL_INFOS("GridManager")<<"Last grid '"<<last_grid<<"' not configured"<<LL_ENDL;
+ }
+ }
+
+ if(mGrid.empty())
+ {
+ // no grid was specified so default to maingrid
+ LL_INFOS("GridManager") << "Default grid to "<<MAINGRID<< LL_ENDL;
+ mGrid = MAINGRID;
+ }
+
+ LLControlVariablePtr grid_control = gSavedSettings.getControl("CurrentGrid");
+ if (grid_control.notNull())
+ {
+ grid_control->getSignal()->connect(boost::bind(&LLGridManager::updateIsInProductionGrid, this));
+ }
+
+ // since above only triggers on changes, trigger the callback manually to initialize state
+ updateIsInProductionGrid();
+
+ setGridChoice(mGrid);
}
LLGridManager::~LLGridManager()
@@ -250,432 +250,432 @@ LLGridManager::~LLGridManager()
bool LLGridManager::addGrid(LLSD& grid_data)
{
- bool added = false;
- if (grid_data.isMap() && grid_data.has(GRID_VALUE))
- {
- std::string grid = utf8str_tolower(grid_data[GRID_VALUE].asString());
-
- if ( getGrid(grid_data[GRID_VALUE]).empty() && getGrid(grid).empty() )
- {
- std::string grid_id = grid_data.has(GRID_ID_VALUE) ? grid_data[GRID_ID_VALUE].asString() : "";
- if ( getGrid(grid_id).empty() )
- {
- // populate the other values if they don't exist
- if (!grid_data.has(GRID_LABEL_VALUE))
- {
- grid_data[GRID_LABEL_VALUE] = grid;
- }
- if (!grid_data.has(GRID_ID_VALUE))
- {
- grid_data[GRID_ID_VALUE] = grid;
- }
-
- // if the grid data doesn't include any of the URIs, then
- // generate them from the grid, which should be a dns address
- if (!grid_data.has(GRID_LOGIN_URI_VALUE))
- {
- grid_data[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
- grid_data[GRID_LOGIN_URI_VALUE].append(std::string("https://") +
- grid + "/cgi-bin/login.cgi");
- }
- // Populate to the default values
- if (!grid_data.has(GRID_LOGIN_PAGE_VALUE))
- {
- grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/";
- }
- if (!grid_data.has(GRID_HELPER_URI_VALUE))
- {
- grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/";
- }
- if (!grid_data.has(GRID_WEB_PROFILE_VALUE))
- {
- grid_data[GRID_WEB_PROFILE_VALUE] = std::string("https://") + grid + "/";
- }
-
- if (!grid_data.has(GRID_LOGIN_IDENTIFIER_TYPES))
- {
- // non system grids and grids that haven't already been configured with values
- // get both types of credentials.
- grid_data[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
- grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
- grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_ACCOUNT);
- }
-
- LL_DEBUGS("GridManager") <<grid<<"\n"
- <<" id: "<<grid_data[GRID_ID_VALUE].asString()<<"\n"
- <<" label: "<<grid_data[GRID_LABEL_VALUE].asString()<<"\n"
- <<" login page: "<<grid_data[GRID_LOGIN_PAGE_VALUE].asString()<<"\n"
- <<" helper page: "<<grid_data[GRID_HELPER_URI_VALUE].asString()<<"\n"
- <<" web profile: "<<grid_data[GRID_WEB_PROFILE_VALUE].asString()<<"\n";
- /* still in LL_DEBUGS */
- for (LLSD::array_const_iterator login_uris = grid_data[GRID_LOGIN_URI_VALUE].beginArray();
- login_uris != grid_data[GRID_LOGIN_URI_VALUE].endArray();
- login_uris++)
- {
- LL_CONT << " login uri: "<<login_uris->asString()<<"\n";
- }
- LL_CONT << LL_ENDL;
- mGridList[grid] = grid_data;
- added = true;
- }
- else
- {
- LL_WARNS("GridManager")<<"duplicate grid id'"<<grid_id<<"' ignored"<<LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("GridManager")<<"duplicate grid name '"<<grid<<"' ignored"<<LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("GridManager")<<"invalid grid definition ignored"<<LL_ENDL;
- }
- return added;
+ bool added = false;
+ if (grid_data.isMap() && grid_data.has(GRID_VALUE))
+ {
+ std::string grid = utf8str_tolower(grid_data[GRID_VALUE].asString());
+
+ if ( getGrid(grid_data[GRID_VALUE]).empty() && getGrid(grid).empty() )
+ {
+ std::string grid_id = grid_data.has(GRID_ID_VALUE) ? grid_data[GRID_ID_VALUE].asString() : "";
+ if ( getGrid(grid_id).empty() )
+ {
+ // populate the other values if they don't exist
+ if (!grid_data.has(GRID_LABEL_VALUE))
+ {
+ grid_data[GRID_LABEL_VALUE] = grid;
+ }
+ if (!grid_data.has(GRID_ID_VALUE))
+ {
+ grid_data[GRID_ID_VALUE] = grid;
+ }
+
+ // if the grid data doesn't include any of the URIs, then
+ // generate them from the grid, which should be a dns address
+ if (!grid_data.has(GRID_LOGIN_URI_VALUE))
+ {
+ grid_data[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
+ grid_data[GRID_LOGIN_URI_VALUE].append(std::string("https://") +
+ grid + "/cgi-bin/login.cgi");
+ }
+ // Populate to the default values
+ if (!grid_data.has(GRID_LOGIN_PAGE_VALUE))
+ {
+ grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/";
+ }
+ if (!grid_data.has(GRID_HELPER_URI_VALUE))
+ {
+ grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/";
+ }
+ if (!grid_data.has(GRID_WEB_PROFILE_VALUE))
+ {
+ grid_data[GRID_WEB_PROFILE_VALUE] = std::string("https://") + grid + "/";
+ }
+
+ if (!grid_data.has(GRID_LOGIN_IDENTIFIER_TYPES))
+ {
+ // non system grids and grids that haven't already been configured with values
+ // get both types of credentials.
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_ACCOUNT);
+ }
+
+ LL_DEBUGS("GridManager") <<grid<<"\n"
+ <<" id: "<<grid_data[GRID_ID_VALUE].asString()<<"\n"
+ <<" label: "<<grid_data[GRID_LABEL_VALUE].asString()<<"\n"
+ <<" login page: "<<grid_data[GRID_LOGIN_PAGE_VALUE].asString()<<"\n"
+ <<" helper page: "<<grid_data[GRID_HELPER_URI_VALUE].asString()<<"\n"
+ <<" web profile: "<<grid_data[GRID_WEB_PROFILE_VALUE].asString()<<"\n";
+ /* still in LL_DEBUGS */
+ for (LLSD::array_const_iterator login_uris = grid_data[GRID_LOGIN_URI_VALUE].beginArray();
+ login_uris != grid_data[GRID_LOGIN_URI_VALUE].endArray();
+ login_uris++)
+ {
+ LL_CONT << " login uri: "<<login_uris->asString()<<"\n";
+ }
+ LL_CONT << LL_ENDL;
+ mGridList[grid] = grid_data;
+ added = true;
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"duplicate grid id'"<<grid_id<<"' ignored"<<LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"duplicate grid name '"<<grid<<"' ignored"<<LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid definition ignored"<<LL_ENDL;
+ }
+ return added;
}
//
// LLGridManager::addSystemGrid - helper for adding a system grid.
void LLGridManager::addSystemGrid(const std::string& label,
- const std::string& name,
- const std::string& login_uri,
- const std::string& helper,
- const std::string& login_page,
- const std::string& update_url_base,
- const std::string& web_profile_url,
- const std::string& login_id)
+ const std::string& name,
+ const std::string& login_uri,
+ const std::string& helper,
+ const std::string& login_page,
+ const std::string& update_url_base,
+ const std::string& web_profile_url,
+ const std::string& login_id)
{
- LLSD grid = LLSD::emptyMap();
- grid[GRID_VALUE] = name;
- grid[GRID_LABEL_VALUE] = label;
- grid[GRID_HELPER_URI_VALUE] = helper;
- grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
- grid[GRID_LOGIN_URI_VALUE].append(login_uri);
- grid[GRID_LOGIN_PAGE_VALUE] = login_page;
- grid[GRID_UPDATE_SERVICE_URL] = update_url_base;
- grid[GRID_WEB_PROFILE_VALUE] = web_profile_url;
- grid[GRID_IS_SYSTEM_GRID_VALUE] = true;
- grid[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
- grid[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
-
- grid[GRID_APP_SLURL_BASE] = SYSTEM_GRID_APP_SLURL_BASE;
- if (login_id.empty())
- {
- grid[GRID_ID_VALUE] = name;
- }
- else
- {
- grid[GRID_ID_VALUE] = login_id;
- }
-
- if (name == std::string(MAINGRID))
- {
- grid[GRID_SLURL_BASE] = MAIN_GRID_SLURL_BASE;
- }
- else
- {
- grid[GRID_SLURL_BASE] = llformat(SYSTEM_GRID_SLURL_BASE, grid[GRID_ID_VALUE].asString().c_str());
- }
-
- addGrid(grid);
+ LLSD grid = LLSD::emptyMap();
+ grid[GRID_VALUE] = name;
+ grid[GRID_LABEL_VALUE] = label;
+ grid[GRID_HELPER_URI_VALUE] = helper;
+ grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
+ grid[GRID_LOGIN_URI_VALUE].append(login_uri);
+ grid[GRID_LOGIN_PAGE_VALUE] = login_page;
+ grid[GRID_UPDATE_SERVICE_URL] = update_url_base;
+ grid[GRID_WEB_PROFILE_VALUE] = web_profile_url;
+ grid[GRID_IS_SYSTEM_GRID_VALUE] = true;
+ grid[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
+ grid[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
+
+ grid[GRID_APP_SLURL_BASE] = SYSTEM_GRID_APP_SLURL_BASE;
+ if (login_id.empty())
+ {
+ grid[GRID_ID_VALUE] = name;
+ }
+ else
+ {
+ grid[GRID_ID_VALUE] = login_id;
+ }
+
+ if (name == std::string(MAINGRID))
+ {
+ grid[GRID_SLURL_BASE] = MAIN_GRID_SLURL_BASE;
+ }
+ else
+ {
+ grid[GRID_SLURL_BASE] = llformat(SYSTEM_GRID_SLURL_BASE, grid[GRID_ID_VALUE].asString().c_str());
+ }
+
+ addGrid(grid);
}
// return a list of grid name -> grid label mappings for UI purposes
std::map<std::string, std::string> LLGridManager::getKnownGrids()
{
- std::map<std::string, std::string> result;
- for(LLSD::map_iterator grid_iter = mGridList.beginMap();
- grid_iter != mGridList.endMap();
- grid_iter++)
- {
- result[grid_iter->first] = grid_iter->second[GRID_LABEL_VALUE].asString();
- }
-
- return result;
+ std::map<std::string, std::string> result;
+ for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+ grid_iter != mGridList.endMap();
+ grid_iter++)
+ {
+ result[grid_iter->first] = grid_iter->second[GRID_LABEL_VALUE].asString();
+ }
+
+ return result;
}
void LLGridManager::setGridChoice(const std::string& grid)
{
- // Set the grid choice based on a string.
- LL_DEBUGS("GridManager")<<"requested "<<grid<<LL_ENDL;
- std::string grid_name = getGrid(grid); // resolved either the name or the id to the name
-
- if(!grid_name.empty())
- {
- LL_INFOS("GridManager")<<"setting "<<grid_name<<LL_ENDL;
- mGrid = grid_name;
- gSavedSettings.setString("CurrentGrid", grid_name);
-
- updateIsInProductionGrid();
- }
- else
- {
- // the grid was not in the list of grids.
- LL_WARNS("GridManager")<<"unknown grid "<<grid<<LL_ENDL;
- }
+ // Set the grid choice based on a string.
+ LL_DEBUGS("GridManager")<<"requested "<<grid<<LL_ENDL;
+ std::string grid_name = getGrid(grid); // resolved either the name or the id to the name
+
+ if(!grid_name.empty())
+ {
+ LL_INFOS("GridManager")<<"setting "<<grid_name<<LL_ENDL;
+ mGrid = grid_name;
+ gSavedSettings.setString("CurrentGrid", grid_name);
+
+ updateIsInProductionGrid();
+ }
+ else
+ {
+ // the grid was not in the list of grids.
+ LL_WARNS("GridManager")<<"unknown grid "<<grid<<LL_ENDL;
+ }
}
std::string LLGridManager::getGrid( const std::string &grid )
{
- std::string grid_name;
-
- if (mGridList.has(grid))
- {
- // the grid was the long name, so we're good, return it
- grid_name = grid;
- }
- else
- {
- // search the grid list for a grid with a matching id
- for(LLSD::map_iterator grid_iter = mGridList.beginMap();
- grid_name.empty() && grid_iter != mGridList.endMap();
- grid_iter++)
- {
- if (grid_iter->second.has(GRID_ID_VALUE))
- {
- if (0 == (LLStringUtil::compareInsensitive(grid,
- grid_iter->second[GRID_ID_VALUE].asString())))
- {
- // found a matching label, return this name
- grid_name = grid_iter->first;
- }
- }
- }
- }
- return grid_name;
+ std::string grid_name;
+
+ if (mGridList.has(grid))
+ {
+ // the grid was the long name, so we're good, return it
+ grid_name = grid;
+ }
+ else
+ {
+ // search the grid list for a grid with a matching id
+ for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+ grid_name.empty() && grid_iter != mGridList.endMap();
+ grid_iter++)
+ {
+ if (grid_iter->second.has(GRID_ID_VALUE))
+ {
+ if (0 == (LLStringUtil::compareInsensitive(grid,
+ grid_iter->second[GRID_ID_VALUE].asString())))
+ {
+ // found a matching label, return this name
+ grid_name = grid_iter->first;
+ }
+ }
+ }
+ }
+ return grid_name;
}
std::string LLGridManager::getGridLabel(const std::string& grid)
{
- std::string grid_label;
- std::string grid_name = getGrid(grid);
- if (!grid.empty())
- {
- grid_label = mGridList[grid_name][GRID_LABEL_VALUE].asString();
- }
- else
- {
- LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
- }
- LL_DEBUGS("GridManager")<<"returning "<<grid_label<<LL_ENDL;
- return grid_label;
+ std::string grid_label;
+ std::string grid_name = getGrid(grid);
+ if (!grid.empty())
+ {
+ grid_label = mGridList[grid_name][GRID_LABEL_VALUE].asString();
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
+ LL_DEBUGS("GridManager")<<"returning "<<grid_label<<LL_ENDL;
+ return grid_label;
}
std::string LLGridManager::getGridId(const std::string& grid)
{
- std::string grid_id;
- std::string grid_name = getGrid(grid);
- if (!grid.empty())
- {
- grid_id = mGridList[grid_name][GRID_ID_VALUE].asString();
- }
- else
- {
- LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
- }
- LL_DEBUGS("GridManager")<<"returning "<<grid_id<<LL_ENDL;
- return grid_id;
+ std::string grid_id;
+ std::string grid_name = getGrid(grid);
+ if (!grid.empty())
+ {
+ grid_id = mGridList[grid_name][GRID_ID_VALUE].asString();
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
+ LL_DEBUGS("GridManager")<<"returning "<<grid_id<<LL_ENDL;
+ return grid_id;
}
void LLGridManager::getLoginURIs(const std::string& grid, std::vector<std::string>& uris)
{
- uris.clear();
- std::string grid_name = getGrid(grid);
- if (!grid_name.empty())
- {
+ uris.clear();
+ std::string grid_name = getGrid(grid);
+ if (!grid_name.empty())
+ {
if (mGridList[grid_name][GRID_LOGIN_URI_VALUE].isArray())
{
- for (LLSD::array_iterator llsd_uri = mGridList[grid_name][GRID_LOGIN_URI_VALUE].beginArray();
- llsd_uri != mGridList[grid_name][GRID_LOGIN_URI_VALUE].endArray();
- llsd_uri++)
- {
- uris.push_back(llsd_uri->asString());
- }
+ for (LLSD::array_iterator llsd_uri = mGridList[grid_name][GRID_LOGIN_URI_VALUE].beginArray();
+ llsd_uri != mGridList[grid_name][GRID_LOGIN_URI_VALUE].endArray();
+ llsd_uri++)
+ {
+ uris.push_back(llsd_uri->asString());
+ }
}
else
{
uris.push_back(mGridList[grid_name][GRID_LOGIN_URI_VALUE].asString());
}
- }
- else
- {
- LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
- }
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
}
void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
{
- getLoginURIs(mGrid, uris);
+ getLoginURIs(mGrid, uris);
}
std::string LLGridManager::getHelperURI(const std::string& grid)
{
- std::string helper_uri;
- std::string grid_name = getGrid(grid);
- if (!grid_name.empty())
- {
- helper_uri = mGridList[grid_name][GRID_HELPER_URI_VALUE].asString();
- }
- else
- {
- LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
- }
-
- LL_DEBUGS("GridManager")<<"returning "<<helper_uri<<LL_ENDL;
- return helper_uri;
+ std::string helper_uri;
+ std::string grid_name = getGrid(grid);
+ if (!grid_name.empty())
+ {
+ helper_uri = mGridList[grid_name][GRID_HELPER_URI_VALUE].asString();
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
+
+ LL_DEBUGS("GridManager")<<"returning "<<helper_uri<<LL_ENDL;
+ return helper_uri;
}
std::string LLGridManager::getLoginPage(const std::string& grid)
{
- std::string grid_login_page;
- std::string grid_name = getGrid(grid);
- if (!grid_name.empty())
- {
- grid_login_page = mGridList[grid_name][GRID_LOGIN_PAGE_VALUE].asString();
- }
- else
- {
- LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
- }
- return grid_login_page;
+ std::string grid_login_page;
+ std::string grid_name = getGrid(grid);
+ if (!grid_name.empty())
+ {
+ grid_login_page = mGridList[grid_name][GRID_LOGIN_PAGE_VALUE].asString();
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
+ return grid_login_page;
}
std::string LLGridManager::getLoginPage()
{
- std::string login_page = mGridList[mGrid][GRID_LOGIN_PAGE_VALUE].asString();
- LL_DEBUGS("GridManager")<<"returning "<<login_page<<LL_ENDL;
- return login_page;
+ std::string login_page = mGridList[mGrid][GRID_LOGIN_PAGE_VALUE].asString();
+ LL_DEBUGS("GridManager")<<"returning "<<login_page<<LL_ENDL;
+ return login_page;
}
std::string LLGridManager::getWebProfileURL(const std::string& grid)
{
- std::string web_profile_url;
- std::string grid_name = getGrid(grid);
- if (!grid_name.empty())
- {
- web_profile_url = mGridList[grid_name][GRID_WEB_PROFILE_VALUE].asString();
- }
- else
- {
- LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
- }
- return web_profile_url;
+ std::string web_profile_url;
+ std::string grid_name = getGrid(grid);
+ if (!grid_name.empty())
+ {
+ web_profile_url = mGridList[grid_name][GRID_WEB_PROFILE_VALUE].asString();
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
+ return web_profile_url;
}
void LLGridManager::getLoginIdentifierTypes(LLSD& idTypes)
{
- idTypes = mGridList[mGrid][GRID_LOGIN_IDENTIFIER_TYPES];
+ idTypes = mGridList[mGrid][GRID_LOGIN_IDENTIFIER_TYPES];
}
std::string LLGridManager::getGridLoginID()
{
- return mGridList[mGrid][GRID_ID_VALUE];
+ return mGridList[mGrid][GRID_ID_VALUE];
}
std::string LLGridManager::getUpdateServiceURL()
{
- std::string update_url_base = gSavedSettings.getString("CmdLineUpdateService");;
- if ( !update_url_base.empty() )
- {
- LL_INFOS("UpdaterService","GridManager")
- << "Update URL base overridden from command line: " << update_url_base
- << LL_ENDL;
- }
- else if ( mGridList[mGrid].has(GRID_UPDATE_SERVICE_URL) )
- {
- update_url_base = mGridList[mGrid][GRID_UPDATE_SERVICE_URL].asString();
- }
- else
- {
- LL_WARNS("UpdaterService","GridManager")
- << "The grid property '" << GRID_UPDATE_SERVICE_URL
- << "' is not defined for the grid '" << mGrid << "'"
- << LL_ENDL;
- }
-
- return update_url_base;
+ std::string update_url_base = gSavedSettings.getString("CmdLineUpdateService");;
+ if ( !update_url_base.empty() )
+ {
+ LL_INFOS("UpdaterService","GridManager")
+ << "Update URL base overridden from command line: " << update_url_base
+ << LL_ENDL;
+ }
+ else if ( mGridList[mGrid].has(GRID_UPDATE_SERVICE_URL) )
+ {
+ update_url_base = mGridList[mGrid][GRID_UPDATE_SERVICE_URL].asString();
+ }
+ else
+ {
+ LL_WARNS("UpdaterService","GridManager")
+ << "The grid property '" << GRID_UPDATE_SERVICE_URL
+ << "' is not defined for the grid '" << mGrid << "'"
+ << LL_ENDL;
+ }
+
+ return update_url_base;
}
void LLGridManager::updateIsInProductionGrid()
{
- mIsInProductionGrid = false;
-
- // *NOTE:Mani This used to compare GRID_INFO_AGNI to gGridChoice,
- // but it seems that loginURI trumps that.
- std::vector<std::string> uris;
- getLoginURIs(uris);
- if (uris.empty())
- {
- mIsInProductionGrid = true;
- }
- else
- {
- for ( std::vector<std::string>::iterator uri_it = uris.begin();
- ! mIsInProductionGrid && uri_it != uris.end();
- uri_it++
- )
- {
- if( MAIN_GRID_LOGIN_URI == *uri_it )
- {
- mIsInProductionGrid = true;
- }
- }
- }
+ mIsInProductionGrid = false;
+
+ // *NOTE:Mani This used to compare GRID_INFO_AGNI to gGridChoice,
+ // but it seems that loginURI trumps that.
+ std::vector<std::string> uris;
+ getLoginURIs(uris);
+ if (uris.empty())
+ {
+ mIsInProductionGrid = true;
+ }
+ else
+ {
+ for ( std::vector<std::string>::iterator uri_it = uris.begin();
+ ! mIsInProductionGrid && uri_it != uris.end();
+ uri_it++
+ )
+ {
+ if( MAIN_GRID_LOGIN_URI == *uri_it )
+ {
+ mIsInProductionGrid = true;
+ }
+ }
+ }
}
bool LLGridManager::isInProductionGrid()
{
- return mIsInProductionGrid;
+ return mIsInProductionGrid;
}
bool LLGridManager::isSystemGrid(const std::string& grid)
{
- std::string grid_name = getGrid(grid);
+ std::string grid_name = getGrid(grid);
- return ( !grid_name.empty()
- && mGridList.has(grid)
- && mGridList[grid].has(GRID_IS_SYSTEM_GRID_VALUE)
- && mGridList[grid][GRID_IS_SYSTEM_GRID_VALUE].asBoolean()
- );
+ return ( !grid_name.empty()
+ && mGridList.has(grid)
+ && mGridList[grid].has(GRID_IS_SYSTEM_GRID_VALUE)
+ && mGridList[grid][GRID_IS_SYSTEM_GRID_VALUE].asBoolean()
+ );
}
// build a slurl for the given region within the selected grid
std::string LLGridManager::getSLURLBase(const std::string& grid)
{
- std::string grid_base = "";
- std::string grid_name = getGrid(grid);
- if( ! grid_name.empty() && mGridList.has(grid_name) )
- {
- if (mGridList[grid_name].has(GRID_SLURL_BASE))
- {
- grid_base = mGridList[grid_name][GRID_SLURL_BASE].asString();
- }
- else
- {
- grid_base = llformat(DEFAULT_SLURL_BASE, grid_name.c_str());
- }
- }
- LL_DEBUGS("GridManager")<<"returning '"<<grid_base<<"'"<<LL_ENDL;
- return grid_base;
+ std::string grid_base = "";
+ std::string grid_name = getGrid(grid);
+ if( ! grid_name.empty() && mGridList.has(grid_name) )
+ {
+ if (mGridList[grid_name].has(GRID_SLURL_BASE))
+ {
+ grid_base = mGridList[grid_name][GRID_SLURL_BASE].asString();
+ }
+ else
+ {
+ grid_base = llformat(DEFAULT_SLURL_BASE, grid_name.c_str());
+ }
+ }
+ LL_DEBUGS("GridManager")<<"returning '"<<grid_base<<"'"<<LL_ENDL;
+ return grid_base;
}
// build a slurl for the given region within the selected grid
std::string LLGridManager::getAppSLURLBase(const std::string& grid)
{
- std::string grid_base = "";
- std::string grid_name = getGrid(grid);
- if(!grid_name.empty() && mGridList.has(grid))
- {
- if (mGridList[grid].has(GRID_APP_SLURL_BASE))
- {
- grid_base = mGridList[grid][GRID_APP_SLURL_BASE].asString();
- }
- else
- {
- grid_base = llformat(DEFAULT_APP_SLURL_BASE, grid_name.c_str());
- }
- }
- LL_DEBUGS("GridManager")<<"returning '"<<grid_base<<"'"<<LL_ENDL;
- return grid_base;
+ std::string grid_base = "";
+ std::string grid_name = getGrid(grid);
+ if(!grid_name.empty() && mGridList.has(grid))
+ {
+ if (mGridList[grid].has(GRID_APP_SLURL_BASE))
+ {
+ grid_base = mGridList[grid][GRID_APP_SLURL_BASE].asString();
+ }
+ else
+ {
+ grid_base = llformat(DEFAULT_APP_SLURL_BASE, grid_name.c_str());
+ }
+ }
+ LL_DEBUGS("GridManager")<<"returning '"<<grid_base<<"'"<<LL_ENDL;
+ return grid_base;
}
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index b8ff494b8b..2ed663e038 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewernetwork.h
* @author James Cook
* @brief Networking constants and globals for viewer.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,12 +35,12 @@
class LLInvalidGridName
{
public:
- LLInvalidGridName(std::string grid) : mGrid(grid)
- {
- }
- std::string name() { return mGrid; }
+ LLInvalidGridName(std::string grid) : mGrid(grid)
+ {
+ }
+ std::string name() { return mGrid; }
protected:
- std::string mGrid;
+ std::string mGrid;
};
/**
@@ -51,185 +51,185 @@ protected:
* grid. Grids are specified by either of two identifiers, each of which
* must be unique among all known grids:
* - grid name : DNS name for the grid
- * - grid id : a short form (conventionally a single word)
+ * - grid id : a short form (conventionally a single word)
*
* This class maintains the currently selected grid, and provides short
* form accessors for each of the properties of the selected grid.
**/
class LLGridManager : public LLSingleton<LLGridManager>
{
- /// Instantiate the grid manager, load default grids, selects the default grid
- LLSINGLETON(LLGridManager);
- ~LLGridManager();
+ /// Instantiate the grid manager, load default grids, selects the default grid
+ LLSINGLETON(LLGridManager);
+ ~LLGridManager();
public:
- /* ================================================================
- * @name Initialization and Configuration
- * @{
- */
- /// add grids from an external grids file
- void initialize(const std::string& grid_file);
-
- //@}
-
- /* ================================================================
- * @name Grid Identifiers
- * @{
- * The id is a short form (typically one word) grid name,
- * It should be used in URL path elements or parameters
- *
- * Each grid also has a "label", intented to be a user friendly
- * descriptive form (it is used in the login panel grid menu, for example).
- */
- /// Return the name of a grid, given either its name or its id
- std::string getGrid( const std::string &grid );
-
- /// Get the id (short form selector) for a given grid
- std::string getGridId(const std::string& grid);
-
- /// Get the id (short form selector) for the selected grid
- std::string getGridId() { return getGridId(mGrid); }
-
- /// Get the user-friendly long form descriptor for a given grid
- std::string getGridLabel(const std::string& grid);
-
- /// Get the user-friendly long form descriptor for the selected grid
- std::string getGridLabel() { return getGridLabel(mGrid); }
-
- /// Retrieve a map of grid-name -> label
- std::map<std::string, std::string> getKnownGrids();
-
- //@}
-
- /* ================================================================
- * @name Login related properties
- * @{
- */
-
- /**
- * Get the login uris for the specified grid.
- * The login uri for a grid is the target of the authentication request.
- * A grid may have multple login uris, so they are returned as a vector.
- */
- void getLoginURIs(const std::string& grid, std::vector<std::string>& uris);
-
- /// Get the login uris for the selected grid
- void getLoginURIs(std::vector<std::string>& uris);
-
- /// Get the URI for webdev help functions for the specified grid
- std::string getHelperURI(const std::string& grid);
-
- /// Get the URI for webdev help functions for the selected grid
- std::string getHelperURI() { return getHelperURI(mGrid); }
-
- /// Get the url of the splash page to be displayed prior to login
- std::string getLoginPage(const std::string& grid_name);
-
- /// Get the URI for the login splash page for the selected grid
- std::string getLoginPage();
-
- /// Get the id to be used as a short name in url path components or parameters
- std::string getGridLoginID();
-
- /// Get an array of the login types supported by the grid
- void getLoginIdentifierTypes(LLSD& idTypes);
- /**< the types are "agent" and "avatar";
- * one means single-name (someone Resident) accounts and other first/last name accounts
- * I am not sure which is which
- */
-
- //@}
- /* ================================================================
- * @name Update Related Properties
- * @{
- */
- /// Get the update service URL base (host and path) for the selected grid
- std::string getUpdateServiceURL();
-
- //@}
-
- /* ================================================================
- * @name URL Construction Properties
- * @{
- */
-
- /// Return the slurl prefix (everything up to but not including the region) for a given grid
- std::string getSLURLBase(const std::string& grid);
-
- /// Return the slurl prefix (everything up to but not including the region) for the selected grid
- std::string getSLURLBase() { return getSLURLBase(mGrid); }
-
- /// Return the application URL prefix for the given grid
- std::string getAppSLURLBase(const std::string& grid);
-
- /// Return the application URL prefix for the selected grid
- std::string getAppSLURLBase() { return getAppSLURLBase(mGrid); }
-
- /// Return the url of the resident profile web site for the given grid
- std::string getWebProfileURL(const std::string& grid);
-
- /// Return the url of the resident profile web site for the selected grid
- std::string getWebProfileURL() { return getWebProfileURL(mGrid); }
-
-
- //@}
-
- /* ================================================================
- * @name Selecting the current grid
- * @{
- * At initialization, the current grid is set by the first of:
- * -# The value supplied by the --grid command line option (setting CmdLineGridChoice);
- * Note that a default for this may be set at build time.
- * -# The grid used most recently (setting CurrentGrid)
- * -# The main grid (Agni)
- */
-
- /// Select a given grid as the current grid.
- void setGridChoice(const std::string& grid);
-
- /// Returns the name of the currently selected grid
- std::string getGrid() const { return mGrid; }
-
- //@}
-
- /// Is the given grid one of the hard-coded default grids (Agni or Aditi)
- bool isSystemGrid(const std::string& grid);
-
- /// Is the selected grid one of the hard-coded default grids (Agni or Aditi)
- bool isSystemGrid() { return isSystemGrid(mGrid); }
-
- /// Is the selected grid a production grid?
- bool isInProductionGrid();
- /**
- * yes, that's not a very helpful description.
- * I don't really know why that is different from isSystemGrid()
- * In practice, the implementation is that it
- * @returns true if the login uri for the grid is the uri for MAINGRID
- */
+ /* ================================================================
+ * @name Initialization and Configuration
+ * @{
+ */
+ /// add grids from an external grids file
+ void initialize(const std::string& grid_file);
+
+ //@}
+
+ /* ================================================================
+ * @name Grid Identifiers
+ * @{
+ * The id is a short form (typically one word) grid name,
+ * It should be used in URL path elements or parameters
+ *
+ * Each grid also has a "label", intented to be a user friendly
+ * descriptive form (it is used in the login panel grid menu, for example).
+ */
+ /// Return the name of a grid, given either its name or its id
+ std::string getGrid( const std::string &grid );
+
+ /// Get the id (short form selector) for a given grid
+ std::string getGridId(const std::string& grid);
+
+ /// Get the id (short form selector) for the selected grid
+ std::string getGridId() { return getGridId(mGrid); }
+
+ /// Get the user-friendly long form descriptor for a given grid
+ std::string getGridLabel(const std::string& grid);
+
+ /// Get the user-friendly long form descriptor for the selected grid
+ std::string getGridLabel() { return getGridLabel(mGrid); }
+
+ /// Retrieve a map of grid-name -> label
+ std::map<std::string, std::string> getKnownGrids();
+
+ //@}
+
+ /* ================================================================
+ * @name Login related properties
+ * @{
+ */
+
+ /**
+ * Get the login uris for the specified grid.
+ * The login uri for a grid is the target of the authentication request.
+ * A grid may have multple login uris, so they are returned as a vector.
+ */
+ void getLoginURIs(const std::string& grid, std::vector<std::string>& uris);
+
+ /// Get the login uris for the selected grid
+ void getLoginURIs(std::vector<std::string>& uris);
+
+ /// Get the URI for webdev help functions for the specified grid
+ std::string getHelperURI(const std::string& grid);
+
+ /// Get the URI for webdev help functions for the selected grid
+ std::string getHelperURI() { return getHelperURI(mGrid); }
+
+ /// Get the url of the splash page to be displayed prior to login
+ std::string getLoginPage(const std::string& grid_name);
+
+ /// Get the URI for the login splash page for the selected grid
+ std::string getLoginPage();
+
+ /// Get the id to be used as a short name in url path components or parameters
+ std::string getGridLoginID();
+
+ /// Get an array of the login types supported by the grid
+ void getLoginIdentifierTypes(LLSD& idTypes);
+ /**< the types are "agent" and "avatar";
+ * one means single-name (someone Resident) accounts and other first/last name accounts
+ * I am not sure which is which
+ */
+
+ //@}
+ /* ================================================================
+ * @name Update Related Properties
+ * @{
+ */
+ /// Get the update service URL base (host and path) for the selected grid
+ std::string getUpdateServiceURL();
+
+ //@}
+
+ /* ================================================================
+ * @name URL Construction Properties
+ * @{
+ */
+
+ /// Return the slurl prefix (everything up to but not including the region) for a given grid
+ std::string getSLURLBase(const std::string& grid);
+
+ /// Return the slurl prefix (everything up to but not including the region) for the selected grid
+ std::string getSLURLBase() { return getSLURLBase(mGrid); }
+
+ /// Return the application URL prefix for the given grid
+ std::string getAppSLURLBase(const std::string& grid);
+
+ /// Return the application URL prefix for the selected grid
+ std::string getAppSLURLBase() { return getAppSLURLBase(mGrid); }
+
+ /// Return the url of the resident profile web site for the given grid
+ std::string getWebProfileURL(const std::string& grid);
+
+ /// Return the url of the resident profile web site for the selected grid
+ std::string getWebProfileURL() { return getWebProfileURL(mGrid); }
+
+
+ //@}
+
+ /* ================================================================
+ * @name Selecting the current grid
+ * @{
+ * At initialization, the current grid is set by the first of:
+ * -# The value supplied by the --grid command line option (setting CmdLineGridChoice);
+ * Note that a default for this may be set at build time.
+ * -# The grid used most recently (setting CurrentGrid)
+ * -# The main grid (Agni)
+ */
+
+ /// Select a given grid as the current grid.
+ void setGridChoice(const std::string& grid);
+
+ /// Returns the name of the currently selected grid
+ std::string getGrid() const { return mGrid; }
+
+ //@}
+
+ /// Is the given grid one of the hard-coded default grids (Agni or Aditi)
+ bool isSystemGrid(const std::string& grid);
+
+ /// Is the selected grid one of the hard-coded default grids (Agni or Aditi)
+ bool isSystemGrid() { return isSystemGrid(mGrid); }
+
+ /// Is the selected grid a production grid?
+ bool isInProductionGrid();
+ /**
+ * yes, that's not a very helpful description.
+ * I don't really know why that is different from isSystemGrid()
+ * In practice, the implementation is that it
+ * @returns true if the login uri for the grid is the uri for MAINGRID
+ */
private:
-
- /// Add a grid to the list of grids
- bool addGrid(LLSD& grid_info);
- ///< @returns true if successfully added
-
- void updateIsInProductionGrid();
-
- // helper function for adding the hard coded grids
- void addSystemGrid(const std::string& label,
- const std::string& name,
- const std::string& login,
- const std::string& helper,
- const std::string& login_page,
- const std::string& update_url_base,
- const std::string& web_profile_url,
- const std::string& login_id = "");
-
-
- std::string mGrid;
- std::string mGridFile;
- LLSD mGridList;
- bool mIsInProductionGrid;
+
+ /// Add a grid to the list of grids
+ bool addGrid(LLSD& grid_info);
+ ///< @returns true if successfully added
+
+ void updateIsInProductionGrid();
+
+ // helper function for adding the hard coded grids
+ void addSystemGrid(const std::string& label,
+ const std::string& name,
+ const std::string& login,
+ const std::string& helper,
+ const std::string& login_page,
+ const std::string& update_url_base,
+ const std::string& web_profile_url,
+ const std::string& login_id = "");
+
+
+ std::string mGrid;
+ std::string mGridFile;
+ LLSD mGridList;
+ bool mIsInProductionGrid;
};
const S32 MAC_ADDRESS_BYTES = 6;
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index f1fac106c7..dd2495342b 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerobject.cpp
* @brief Base class for viewer objects
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -110,24 +110,24 @@
//#define DEBUG_UPDATE_TYPE
-BOOL LLViewerObject::sVelocityInterpolate = TRUE;
-BOOL LLViewerObject::sPingInterpolate = TRUE;
+BOOL LLViewerObject::sVelocityInterpolate = TRUE;
+BOOL LLViewerObject::sPingInterpolate = TRUE;
-U32 LLViewerObject::sNumZombieObjects = 0;
-S32 LLViewerObject::sNumObjects = 0;
-BOOL LLViewerObject::sMapDebug = TRUE;
-LLColor4 LLViewerObject::sEditSelectColor( 1.0f, 1.f, 0.f, 0.3f); // Edit OK
-LLColor4 LLViewerObject::sNoEditSelectColor( 1.0f, 0.f, 0.f, 0.3f); // Can't edit
-S32 LLViewerObject::sAxisArrowLength(50);
+U32 LLViewerObject::sNumZombieObjects = 0;
+S32 LLViewerObject::sNumObjects = 0;
+BOOL LLViewerObject::sMapDebug = TRUE;
+LLColor4 LLViewerObject::sEditSelectColor( 1.0f, 1.f, 0.f, 0.3f); // Edit OK
+LLColor4 LLViewerObject::sNoEditSelectColor( 1.0f, 0.f, 0.f, 0.3f); // Can't edit
+S32 LLViewerObject::sAxisArrowLength(50);
-BOOL LLViewerObject::sPulseEnabled(FALSE);
-BOOL LLViewerObject::sUseSharedDrawables(FALSE); // TRUE
+BOOL LLViewerObject::sPulseEnabled(FALSE);
+BOOL LLViewerObject::sUseSharedDrawables(FALSE); // TRUE
// sMaxUpdateInterpolationTime must be greater than sPhaseOutUpdateInterpolationTime
-F64Seconds LLViewerObject::sMaxUpdateInterpolationTime(3.0); // For motion interpolation: after X seconds with no updates, don't predict object motion
-F64Seconds LLViewerObject::sPhaseOutUpdateInterpolationTime(2.0); // For motion interpolation: after Y seconds with no updates, taper off motion prediction
-F64Seconds LLViewerObject::sMaxRegionCrossingInterpolationTime(1.0);// For motion interpolation: don't interpolate over this time on region crossing
+F64Seconds LLViewerObject::sMaxUpdateInterpolationTime(3.0); // For motion interpolation: after X seconds with no updates, don't predict object motion
+F64Seconds LLViewerObject::sPhaseOutUpdateInterpolationTime(2.0); // For motion interpolation: after Y seconds with no updates, taper off motion prediction
+F64Seconds LLViewerObject::sMaxRegionCrossingInterpolationTime(1.0);// For motion interpolation: don't interpolate over this time on region crossing
std::map<std::string, U32> LLViewerObject::sObjectDataMap;
@@ -151,194 +151,194 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
LL_PROFILE_ZONE_SCOPED;
LL_DEBUGS("ObjectUpdate") << "creating " << id << LL_ENDL;
dumpStack("ObjectUpdateStack");
-
- LLViewerObject *res = NULL;
-
- if (gNonInteractive
- && pcode != LL_PCODE_LEGACY_AVATAR
- && pcode != LL_VO_SURFACE_PATCH
- && pcode != LL_VO_WATER
- && pcode != LL_VO_VOID_WATER
- && pcode != LL_VO_WL_SKY
- && pcode != LL_VO_SKY
- && pcode != LL_VO_PART_GROUP
- )
- {
- return res;
- }
- switch (pcode)
- {
- case LL_PCODE_VOLUME:
- {
- res = new LLVOVolume(id, pcode, regionp); break;
- break;
- }
- case LL_PCODE_LEGACY_AVATAR:
- {
- if (id == gAgentID)
- {
- if (!gAgentAvatarp)
- {
- gAgentAvatarp = new LLVOAvatarSelf(id, pcode, regionp);
- gAgentAvatarp->initInstance();
- gAgentWearables.setAvatarObject(gAgentAvatarp);
- }
- else
- {
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->updateRegion(regionp);
- }
- }
- res = gAgentAvatarp;
- }
- else if (flags & CO_FLAG_CONTROL_AVATAR)
- {
+
+ LLViewerObject *res = NULL;
+
+ if (gNonInteractive
+ && pcode != LL_PCODE_LEGACY_AVATAR
+ && pcode != LL_VO_SURFACE_PATCH
+ && pcode != LL_VO_WATER
+ && pcode != LL_VO_VOID_WATER
+ && pcode != LL_VO_WL_SKY
+ && pcode != LL_VO_SKY
+ && pcode != LL_VO_PART_GROUP
+ )
+ {
+ return res;
+ }
+ switch (pcode)
+ {
+ case LL_PCODE_VOLUME:
+ {
+ res = new LLVOVolume(id, pcode, regionp); break;
+ break;
+ }
+ case LL_PCODE_LEGACY_AVATAR:
+ {
+ if (id == gAgentID)
+ {
+ if (!gAgentAvatarp)
+ {
+ gAgentAvatarp = new LLVOAvatarSelf(id, pcode, regionp);
+ gAgentAvatarp->initInstance();
+ gAgentWearables.setAvatarObject(gAgentAvatarp);
+ }
+ else
+ {
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->updateRegion(regionp);
+ }
+ }
+ res = gAgentAvatarp;
+ }
+ else if (flags & CO_FLAG_CONTROL_AVATAR)
+ {
LLControlAvatar *control_avatar = new LLControlAvatar(id, pcode, regionp);
- control_avatar->initInstance();
- res = control_avatar;
- }
+ control_avatar->initInstance();
+ res = control_avatar;
+ }
else if (flags & CO_FLAG_UI_AVATAR)
{
LLUIAvatar *ui_avatar = new LLUIAvatar(id, pcode, regionp);
ui_avatar->initInstance();
res = ui_avatar;
}
- else
- {
- LLVOAvatar *avatar = new LLVOAvatar(id, pcode, regionp);
- avatar->initInstance();
- res = avatar;
- }
- break;
- }
- case LL_PCODE_LEGACY_GRASS:
- res = new LLVOGrass(id, pcode, regionp); break;
- case LL_PCODE_LEGACY_PART_SYS:
-// LL_WARNS() << "Creating old part sys!" << LL_ENDL;
-// res = new LLVOPart(id, pcode, regionp); break;
- res = NULL; break;
- case LL_PCODE_LEGACY_TREE:
- res = new LLVOTree(id, pcode, regionp); break;
- case LL_PCODE_TREE_NEW:
-// LL_WARNS() << "Creating new tree!" << LL_ENDL;
-// res = new LLVOTree(id, pcode, regionp); break;
- res = NULL; break;
- case LL_VO_SURFACE_PATCH:
- res = new LLVOSurfacePatch(id, pcode, regionp); break;
- case LL_VO_SKY:
- res = new LLVOSky(id, pcode, regionp); break;
- case LL_VO_VOID_WATER:
- res = new LLVOVoidWater(id, pcode, regionp); break;
- case LL_VO_WATER:
- res = new LLVOWater(id, pcode, regionp); break;
- case LL_VO_PART_GROUP:
- res = new LLVOPartGroup(id, pcode, regionp); break;
- case LL_VO_HUD_PART_GROUP:
- res = new LLVOHUDPartGroup(id, pcode, regionp); break;
- case LL_VO_WL_SKY:
- res = new LLVOWLSky(id, pcode, regionp); break;
- default:
- LL_WARNS() << "Unknown object pcode " << (S32)pcode << LL_ENDL;
- res = NULL; break;
- }
-
- return res;
+ else
+ {
+ LLVOAvatar *avatar = new LLVOAvatar(id, pcode, regionp);
+ avatar->initInstance();
+ res = avatar;
+ }
+ break;
+ }
+ case LL_PCODE_LEGACY_GRASS:
+ res = new LLVOGrass(id, pcode, regionp); break;
+ case LL_PCODE_LEGACY_PART_SYS:
+// LL_WARNS() << "Creating old part sys!" << LL_ENDL;
+// res = new LLVOPart(id, pcode, regionp); break;
+ res = NULL; break;
+ case LL_PCODE_LEGACY_TREE:
+ res = new LLVOTree(id, pcode, regionp); break;
+ case LL_PCODE_TREE_NEW:
+// LL_WARNS() << "Creating new tree!" << LL_ENDL;
+// res = new LLVOTree(id, pcode, regionp); break;
+ res = NULL; break;
+ case LL_VO_SURFACE_PATCH:
+ res = new LLVOSurfacePatch(id, pcode, regionp); break;
+ case LL_VO_SKY:
+ res = new LLVOSky(id, pcode, regionp); break;
+ case LL_VO_VOID_WATER:
+ res = new LLVOVoidWater(id, pcode, regionp); break;
+ case LL_VO_WATER:
+ res = new LLVOWater(id, pcode, regionp); break;
+ case LL_VO_PART_GROUP:
+ res = new LLVOPartGroup(id, pcode, regionp); break;
+ case LL_VO_HUD_PART_GROUP:
+ res = new LLVOHUDPartGroup(id, pcode, regionp); break;
+ case LL_VO_WL_SKY:
+ res = new LLVOWLSky(id, pcode, regionp); break;
+ default:
+ LL_WARNS() << "Unknown object pcode " << (S32)pcode << LL_ENDL;
+ res = NULL; break;
+ }
+
+ return res;
}
LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global)
-: LLPrimitive(),
- mChildList(),
- mID(id),
- mLocalID(0),
- mTotalCRC(0),
- mListIndex(-1),
- mTEImages(NULL),
- mTENormalMaps(NULL),
- mTESpecularMaps(NULL),
- mbCanSelect(TRUE),
- mFlags(0),
- mPhysicsShapeType(0),
- mPhysicsGravity(0),
- mPhysicsFriction(0),
- mPhysicsDensity(0),
- mPhysicsRestitution(0),
- mDrawable(),
- mCreateSelected(FALSE),
- mRenderMedia(FALSE),
- mBestUpdatePrecision(0),
- mText(),
- mHudText(""),
- mHudTextColor(LLColor4::white),
+: LLPrimitive(),
+ mChildList(),
+ mID(id),
+ mLocalID(0),
+ mTotalCRC(0),
+ mListIndex(-1),
+ mTEImages(NULL),
+ mTENormalMaps(NULL),
+ mTESpecularMaps(NULL),
+ mbCanSelect(TRUE),
+ mFlags(0),
+ mPhysicsShapeType(0),
+ mPhysicsGravity(0),
+ mPhysicsFriction(0),
+ mPhysicsDensity(0),
+ mPhysicsRestitution(0),
+ mDrawable(),
+ mCreateSelected(FALSE),
+ mRenderMedia(FALSE),
+ mBestUpdatePrecision(0),
+ mText(),
+ mHudText(""),
+ mHudTextColor(LLColor4::white),
mControlAvatar(NULL),
- mLastInterpUpdateSecs(0.f),
- mLastMessageUpdateSecs(0.f),
- mLatestRecvPacketID(0),
- mRegionCrossExpire(0),
- mData(NULL),
- mAudioSourcep(NULL),
- mAudioGain(1.f),
- mSoundCutOffRadius(0.f),
- mAppAngle(0.f),
- mPixelArea(1024.f),
- mInventory(NULL),
- mInventorySerialNum(0),
- mExpectedInventorySerialNum(0),
- mInvRequestState(INVENTORY_REQUEST_STOPPED),
- mInvRequestXFerId(0),
- mInventoryDirty(FALSE),
- mRegionp(regionp),
- mDead(FALSE),
- mOrphaned(FALSE),
- mUserSelected(FALSE),
- mOnActiveList(FALSE),
- mOnMap(FALSE),
- mStatic(FALSE),
- mSeatCount(0),
- mNumFaces(0),
- mRotTime(0.f),
- mAngularVelocityRot(),
- mPreviousRotation(),
- mAttachmentState(0),
- mMedia(NULL),
- mClickAction(0),
- mObjectCost(0),
- mLinksetCost(0),
- mPhysicsCost(0),
- mLinksetPhysicsCost(0.f),
- mCostStale(true),
- mPhysicsShapeUnknown(true),
- mAttachmentItemID(LLUUID::null),
- mLastUpdateType(OUT_UNKNOWN),
- mLastUpdateCached(FALSE),
- mCachedMuteListUpdateTime(0),
- mCachedOwnerInMuteList(false),
- mRiggedAttachedWarned(false)
-{
- if (!is_global)
- {
- llassert(mRegionp);
- }
-
- LLPrimitive::init_primitive(pcode);
-
- // CP: added 12/2/2005 - this was being initialised to 0, not the current frame time
- mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds();
-
- mPositionRegion = LLVector3(0.f, 0.f, 0.f);
-
- if (!is_global && mRegionp)
- {
- mPositionAgent = mRegionp->getOriginAgent();
- }
- resetRot();
-
- LLViewerObject::sNumObjects++;
+ mLastInterpUpdateSecs(0.f),
+ mLastMessageUpdateSecs(0.f),
+ mLatestRecvPacketID(0),
+ mRegionCrossExpire(0),
+ mData(NULL),
+ mAudioSourcep(NULL),
+ mAudioGain(1.f),
+ mSoundCutOffRadius(0.f),
+ mAppAngle(0.f),
+ mPixelArea(1024.f),
+ mInventory(NULL),
+ mInventorySerialNum(0),
+ mExpectedInventorySerialNum(0),
+ mInvRequestState(INVENTORY_REQUEST_STOPPED),
+ mInvRequestXFerId(0),
+ mInventoryDirty(FALSE),
+ mRegionp(regionp),
+ mDead(FALSE),
+ mOrphaned(FALSE),
+ mUserSelected(FALSE),
+ mOnActiveList(FALSE),
+ mOnMap(FALSE),
+ mStatic(FALSE),
+ mSeatCount(0),
+ mNumFaces(0),
+ mRotTime(0.f),
+ mAngularVelocityRot(),
+ mPreviousRotation(),
+ mAttachmentState(0),
+ mMedia(NULL),
+ mClickAction(0),
+ mObjectCost(0),
+ mLinksetCost(0),
+ mPhysicsCost(0),
+ mLinksetPhysicsCost(0.f),
+ mCostStale(true),
+ mPhysicsShapeUnknown(true),
+ mAttachmentItemID(LLUUID::null),
+ mLastUpdateType(OUT_UNKNOWN),
+ mLastUpdateCached(FALSE),
+ mCachedMuteListUpdateTime(0),
+ mCachedOwnerInMuteList(false),
+ mRiggedAttachedWarned(false)
+{
+ if (!is_global)
+ {
+ llassert(mRegionp);
+ }
+
+ LLPrimitive::init_primitive(pcode);
+
+ // CP: added 12/2/2005 - this was being initialised to 0, not the current frame time
+ mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds();
+
+ mPositionRegion = LLVector3(0.f, 0.f, 0.f);
+
+ if (!is_global && mRegionp)
+ {
+ mPositionAgent = mRegionp->getOriginAgent();
+ }
+ resetRot();
+
+ LLViewerObject::sNumObjects++;
}
LLViewerObject::~LLViewerObject()
{
- deleteTEImages();
+ deleteTEImages();
// unhook from reflection probe manager
if (mReflectionProbe.notNull())
@@ -347,18 +347,18 @@ LLViewerObject::~LLViewerObject()
mReflectionProbe = nullptr;
}
- if(mInventory)
- {
- mInventory->clear(); // will deref and delete entries
- delete mInventory;
- mInventory = NULL;
- }
+ if(mInventory)
+ {
+ mInventory->clear(); // will deref and delete entries
+ delete mInventory;
+ mInventory = NULL;
+ }
- if (mPartSourcep)
- {
- mPartSourcep->setDead();
- mPartSourcep = NULL;
- }
+ if (mPartSourcep)
+ {
+ mPartSourcep->setDead();
+ mPartSourcep = NULL;
+ }
if (mText)
{
@@ -367,30 +367,30 @@ LLViewerObject::~LLViewerObject()
mText = NULL;
}
- // Delete memory associated with extra parameters.
- std::unordered_map<U16, ExtraParameter*>::iterator iter;
- for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
- {
- if(iter->second != NULL)
- {
- delete iter->second->data;
- delete iter->second;
- }
- }
- mExtraParameterList.clear();
-
- for_each(mNameValuePairs.begin(), mNameValuePairs.end(), DeletePairedPointer()) ;
- mNameValuePairs.clear();
-
- delete[] mData;
- mData = NULL;
-
- delete mMedia;
- mMedia = NULL;
-
- sNumObjects--;
- sNumZombieObjects--;
- llassert(mChildList.size() == 0);
+ // Delete memory associated with extra parameters.
+ std::unordered_map<U16, ExtraParameter*>::iterator iter;
+ for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
+ {
+ if(iter->second != NULL)
+ {
+ delete iter->second->data;
+ delete iter->second;
+ }
+ }
+ mExtraParameterList.clear();
+
+ for_each(mNameValuePairs.begin(), mNameValuePairs.end(), DeletePairedPointer()) ;
+ mNameValuePairs.clear();
+
+ delete[] mData;
+ mData = NULL;
+
+ delete mMedia;
+ mMedia = NULL;
+
+ sNumObjects--;
+ sNumZombieObjects--;
+ llassert(mChildList.size() == 0);
llassert(mControlAvatar.isNull()); // Should have been cleaned by now
if (mControlAvatar.notNull())
{
@@ -399,40 +399,40 @@ LLViewerObject::~LLViewerObject()
LL_WARNS() << "Dead object owned a live control avatar" << LL_ENDL;
}
- clearInventoryListeners();
+ clearInventoryListeners();
}
void LLViewerObject::deleteTEImages()
{
- delete[] mTEImages;
- mTEImages = NULL;
-
- if (mTENormalMaps != NULL)
- {
- delete[] mTENormalMaps;
- mTENormalMaps = NULL;
- }
-
- if (mTESpecularMaps != NULL)
- {
- delete[] mTESpecularMaps;
- mTESpecularMaps = NULL;
- }
+ delete[] mTEImages;
+ mTEImages = NULL;
+
+ if (mTENormalMaps != NULL)
+ {
+ delete[] mTENormalMaps;
+ mTENormalMaps = NULL;
+ }
+
+ if (mTESpecularMaps != NULL)
+ {
+ delete[] mTESpecularMaps;
+ mTESpecularMaps = NULL;
+ }
}
void LLViewerObject::markDead()
{
- if (!mDead)
- {
+ if (!mDead)
+ {
LL_PROFILE_ZONE_SCOPED;
- //LL_INFOS() << "Marking self " << mLocalID << " as dead." << LL_ENDL;
-
- // Root object of this hierarchy unlinks itself.
- if (getParent())
- {
- ((LLViewerObject *)getParent())->removeChild(this);
- }
- LLUUID mesh_id;
+ //LL_INFOS() << "Marking self " << mLocalID << " as dead." << LL_ENDL;
+
+ // Root object of this hierarchy unlinks itself.
+ if (getParent())
+ {
+ ((LLViewerObject *)getParent())->removeChild(this);
+ }
+ LLUUID mesh_id;
{
LLVOAvatar *av = getAvatar();
if (av && LLVOAvatar::getRiggedMeshID(this,mesh_id))
@@ -446,83 +446,83 @@ void LLViewerObject::markDead()
unlinkControlAvatar();
}
- // Mark itself as dead
- mDead = TRUE;
- if(mRegionp)
- {
- mRegionp->removeFromCreatedList(getLocalID());
- }
- gObjectList.cleanupReferences(this);
-
- LLViewerObject *childp;
- while (mChildList.size() > 0)
- {
- childp = mChildList.back();
- if (childp->getPCode() != LL_PCODE_LEGACY_AVATAR)
- {
- //LL_INFOS() << "Marking child " << childp->getLocalID() << " as dead." << LL_ENDL;
- childp->setParent(NULL); // LLViewerObject::markDead 1
- childp->markDead();
- }
- else
- {
- // make sure avatar is no longer parented,
- // so we can properly set it's position
- childp->setDrawableParent(NULL);
- ((LLVOAvatar*)childp)->getOffObject();
- childp->setParent(NULL); // LLViewerObject::markDead 2
- }
- mChildList.pop_back();
- }
-
- if (mDrawable.notNull())
- {
- // Drawables are reference counted, mark as dead, then nuke the pointer.
- mDrawable->markDead();
- mDrawable = NULL;
- }
-
- if (mText)
- {
- mText->markDead();
- mText = NULL;
- }
-
- if (mIcon)
- {
- mIcon->markDead();
- mIcon = NULL;
- }
-
- if (mPartSourcep)
- {
- mPartSourcep->setDead();
- mPartSourcep = NULL;
- }
-
- if (mAudioSourcep)
- {
- // Do some cleanup
- if (gAudiop)
- {
- gAudiop->cleanupAudioSource(mAudioSourcep);
- }
- mAudioSourcep = NULL;
- }
-
- if (flagAnimSource())
- {
- if (isAgentAvatarValid())
- {
- // stop motions associated with this object
- gAgentAvatarp->stopMotionFromSource(mID);
- }
- }
-
- if (flagCameraSource())
- {
- LLFollowCamMgr::getInstance()->removeFollowCamParams(mID);
- }
+ // Mark itself as dead
+ mDead = TRUE;
+ if(mRegionp)
+ {
+ mRegionp->removeFromCreatedList(getLocalID());
+ }
+ gObjectList.cleanupReferences(this);
+
+ LLViewerObject *childp;
+ while (mChildList.size() > 0)
+ {
+ childp = mChildList.back();
+ if (childp->getPCode() != LL_PCODE_LEGACY_AVATAR)
+ {
+ //LL_INFOS() << "Marking child " << childp->getLocalID() << " as dead." << LL_ENDL;
+ childp->setParent(NULL); // LLViewerObject::markDead 1
+ childp->markDead();
+ }
+ else
+ {
+ // make sure avatar is no longer parented,
+ // so we can properly set it's position
+ childp->setDrawableParent(NULL);
+ ((LLVOAvatar*)childp)->getOffObject();
+ childp->setParent(NULL); // LLViewerObject::markDead 2
+ }
+ mChildList.pop_back();
+ }
+
+ if (mDrawable.notNull())
+ {
+ // Drawables are reference counted, mark as dead, then nuke the pointer.
+ mDrawable->markDead();
+ mDrawable = NULL;
+ }
+
+ if (mText)
+ {
+ mText->markDead();
+ mText = NULL;
+ }
+
+ if (mIcon)
+ {
+ mIcon->markDead();
+ mIcon = NULL;
+ }
+
+ if (mPartSourcep)
+ {
+ mPartSourcep->setDead();
+ mPartSourcep = NULL;
+ }
+
+ if (mAudioSourcep)
+ {
+ // Do some cleanup
+ if (gAudiop)
+ {
+ gAudiop->cleanupAudioSource(mAudioSourcep);
+ }
+ mAudioSourcep = NULL;
+ }
+
+ if (flagAnimSource())
+ {
+ if (isAgentAvatarValid())
+ {
+ // stop motions associated with this object
+ gAgentAvatarp->stopMotionFromSource(mID);
+ }
+ }
+
+ if (flagCameraSource())
+ {
+ LLFollowCamMgr::getInstance()->removeFollowCamParams(mID);
+ }
if (mReflectionProbe.notNull())
{
@@ -530,225 +530,225 @@ void LLViewerObject::markDead()
mReflectionProbe = nullptr;
}
- sNumZombieObjects++;
- }
+ sNumZombieObjects++;
+ }
}
void LLViewerObject::dump() const
{
- LL_INFOS() << "Type: " << pCodeToString(mPrimitiveCode) << LL_ENDL;
- LL_INFOS() << "Drawable: " << (LLDrawable *)mDrawable << LL_ENDL;
- LL_INFOS() << "Update Age: " << LLFrameTimer::getElapsedSeconds() - mLastMessageUpdateSecs << LL_ENDL;
-
- LL_INFOS() << "Parent: " << getParent() << LL_ENDL;
- LL_INFOS() << "ID: " << mID << LL_ENDL;
- LL_INFOS() << "LocalID: " << mLocalID << LL_ENDL;
- LL_INFOS() << "PositionRegion: " << getPositionRegion() << LL_ENDL;
- LL_INFOS() << "PositionAgent: " << getPositionAgent() << LL_ENDL;
- LL_INFOS() << "PositionGlobal: " << getPositionGlobal() << LL_ENDL;
- LL_INFOS() << "Velocity: " << getVelocity() << LL_ENDL;
- if (mDrawable.notNull() &&
- mDrawable->getNumFaces() &&
- mDrawable->getFace(0))
- {
- LLFacePool *poolp = mDrawable->getFace(0)->getPool();
- if (poolp)
- {
- LL_INFOS() << "Pool: " << poolp << LL_ENDL;
- LL_INFOS() << "Pool reference count: " << poolp->mReferences.size() << LL_ENDL;
- }
- }
- //LL_INFOS() << "BoxTree Min: " << mDrawable->getBox()->getMin() << LL_ENDL;
- //LL_INFOS() << "BoxTree Max: " << mDrawable->getBox()->getMin() << LL_ENDL;
- /*
- LL_INFOS() << "Velocity: " << getVelocity() << LL_ENDL;
- LL_INFOS() << "AnyOwner: " << permAnyOwner() << " YouOwner: " << permYouOwner() << " Edit: " << mPermEdit << LL_ENDL;
- LL_INFOS() << "UsePhysics: " << flagUsePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << LL_ENDL;
- LL_INFOS() << "AppAngle: " << mAppAngle << LL_ENDL;
- LL_INFOS() << "PixelArea: " << mPixelArea << LL_ENDL;
-
- char buffer[1000];
- char *key;
- for (key = mNameValuePairs.getFirstKey(); key; key = mNameValuePairs.getNextKey() )
- {
- mNameValuePairs[key]->printNameValue(buffer);
- LL_INFOS() << buffer << LL_ENDL;
- }
- for (child_list_t::iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- LL_INFOS() << " child " << child->getID() << LL_ENDL;
- }
- */
+ LL_INFOS() << "Type: " << pCodeToString(mPrimitiveCode) << LL_ENDL;
+ LL_INFOS() << "Drawable: " << (LLDrawable *)mDrawable << LL_ENDL;
+ LL_INFOS() << "Update Age: " << LLFrameTimer::getElapsedSeconds() - mLastMessageUpdateSecs << LL_ENDL;
+
+ LL_INFOS() << "Parent: " << getParent() << LL_ENDL;
+ LL_INFOS() << "ID: " << mID << LL_ENDL;
+ LL_INFOS() << "LocalID: " << mLocalID << LL_ENDL;
+ LL_INFOS() << "PositionRegion: " << getPositionRegion() << LL_ENDL;
+ LL_INFOS() << "PositionAgent: " << getPositionAgent() << LL_ENDL;
+ LL_INFOS() << "PositionGlobal: " << getPositionGlobal() << LL_ENDL;
+ LL_INFOS() << "Velocity: " << getVelocity() << LL_ENDL;
+ if (mDrawable.notNull() &&
+ mDrawable->getNumFaces() &&
+ mDrawable->getFace(0))
+ {
+ LLFacePool *poolp = mDrawable->getFace(0)->getPool();
+ if (poolp)
+ {
+ LL_INFOS() << "Pool: " << poolp << LL_ENDL;
+ LL_INFOS() << "Pool reference count: " << poolp->mReferences.size() << LL_ENDL;
+ }
+ }
+ //LL_INFOS() << "BoxTree Min: " << mDrawable->getBox()->getMin() << LL_ENDL;
+ //LL_INFOS() << "BoxTree Max: " << mDrawable->getBox()->getMin() << LL_ENDL;
+ /*
+ LL_INFOS() << "Velocity: " << getVelocity() << LL_ENDL;
+ LL_INFOS() << "AnyOwner: " << permAnyOwner() << " YouOwner: " << permYouOwner() << " Edit: " << mPermEdit << LL_ENDL;
+ LL_INFOS() << "UsePhysics: " << flagUsePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << LL_ENDL;
+ LL_INFOS() << "AppAngle: " << mAppAngle << LL_ENDL;
+ LL_INFOS() << "PixelArea: " << mPixelArea << LL_ENDL;
+
+ char buffer[1000];
+ char *key;
+ for (key = mNameValuePairs.getFirstKey(); key; key = mNameValuePairs.getNextKey() )
+ {
+ mNameValuePairs[key]->printNameValue(buffer);
+ LL_INFOS() << buffer << LL_ENDL;
+ }
+ for (child_list_t::iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ LL_INFOS() << " child " << child->getID() << LL_ENDL;
+ }
+ */
}
void LLViewerObject::printNameValuePairs() const
{
- for (name_value_map_t::const_iterator iter = mNameValuePairs.begin();
- iter != mNameValuePairs.end(); iter++)
- {
- LLNameValue* nv = iter->second;
- LL_INFOS() << nv->printNameValue() << LL_ENDL;
- }
+ for (name_value_map_t::const_iterator iter = mNameValuePairs.begin();
+ iter != mNameValuePairs.end(); iter++)
+ {
+ LLNameValue* nv = iter->second;
+ LL_INFOS() << nv->printNameValue() << LL_ENDL;
+ }
}
void LLViewerObject::initVOClasses()
{
- // Initialized shared class stuff first.
- LLVOAvatar::initClass();
- LLVOTree::initClass();
- LL_INFOS() << "Viewer Object size: " << sizeof(LLViewerObject) << LL_ENDL;
- LLVOGrass::initClass();
- LLVOWater::initClass();
- LLVOVolume::initClass();
+ // Initialized shared class stuff first.
+ LLVOAvatar::initClass();
+ LLVOTree::initClass();
+ LL_INFOS() << "Viewer Object size: " << sizeof(LLViewerObject) << LL_ENDL;
+ LLVOGrass::initClass();
+ LLVOWater::initClass();
+ LLVOVolume::initClass();
- initObjectDataMap();
+ initObjectDataMap();
}
void LLViewerObject::cleanupVOClasses()
{
- SUBSYSTEM_CLEANUP(LLVOGrass);
- SUBSYSTEM_CLEANUP(LLVOWater);
- SUBSYSTEM_CLEANUP(LLVOTree);
- SUBSYSTEM_CLEANUP(LLVOAvatar);
- SUBSYSTEM_CLEANUP(LLVOVolume);
+ SUBSYSTEM_CLEANUP(LLVOGrass);
+ SUBSYSTEM_CLEANUP(LLVOWater);
+ SUBSYSTEM_CLEANUP(LLVOTree);
+ SUBSYSTEM_CLEANUP(LLVOAvatar);
+ SUBSYSTEM_CLEANUP(LLVOVolume);
- sObjectDataMap.clear();
+ sObjectDataMap.clear();
}
//object data map for compressed && !OUT_TERSE_IMPROVED
//static
void LLViewerObject::initObjectDataMap()
{
- U32 count = 0;
+ U32 count = 0;
- sObjectDataMap["ID"] = count; //full id //LLUUID
- count += sizeof(LLUUID);
+ sObjectDataMap["ID"] = count; //full id //LLUUID
+ count += sizeof(LLUUID);
- sObjectDataMap["LocalID"] = count; //U32
- count += sizeof(U32);
+ sObjectDataMap["LocalID"] = count; //U32
+ count += sizeof(U32);
- sObjectDataMap["PCode"] = count; //U8
- count += sizeof(U8);
+ sObjectDataMap["PCode"] = count; //U8
+ count += sizeof(U8);
- sObjectDataMap["State"] = count; //U8
- count += sizeof(U8);
+ sObjectDataMap["State"] = count; //U8
+ count += sizeof(U8);
- sObjectDataMap["CRC"] = count; //U32
- count += sizeof(U32);
+ sObjectDataMap["CRC"] = count; //U32
+ count += sizeof(U32);
- sObjectDataMap["Material"] = count; //U8
- count += sizeof(U8);
+ sObjectDataMap["Material"] = count; //U8
+ count += sizeof(U8);
- sObjectDataMap["ClickAction"] = count; //U8
- count += sizeof(U8);
+ sObjectDataMap["ClickAction"] = count; //U8
+ count += sizeof(U8);
- sObjectDataMap["Scale"] = count; //LLVector3
- count += sizeof(LLVector3);
+ sObjectDataMap["Scale"] = count; //LLVector3
+ count += sizeof(LLVector3);
- sObjectDataMap["Pos"] = count; //LLVector3
- count += sizeof(LLVector3);
+ sObjectDataMap["Pos"] = count; //LLVector3
+ count += sizeof(LLVector3);
- sObjectDataMap["Rot"] = count; //LLVector3
- count += sizeof(LLVector3);
+ sObjectDataMap["Rot"] = count; //LLVector3
+ count += sizeof(LLVector3);
- sObjectDataMap["SpecialCode"] = count; //U32
- count += sizeof(U32);
+ sObjectDataMap["SpecialCode"] = count; //U32
+ count += sizeof(U32);
- sObjectDataMap["Owner"] = count; //LLUUID
- count += sizeof(LLUUID);
+ sObjectDataMap["Owner"] = count; //LLUUID
+ count += sizeof(LLUUID);
- sObjectDataMap["Omega"] = count; //LLVector3, when SpecialCode & 0x80 is set
- count += sizeof(LLVector3);
+ sObjectDataMap["Omega"] = count; //LLVector3, when SpecialCode & 0x80 is set
+ count += sizeof(LLVector3);
- //ParentID is after Omega if there is Omega, otherwise is after Owner
- sObjectDataMap["ParentID"] = count;//U32, when SpecialCode & 0x20 is set
- count += sizeof(U32);
+ //ParentID is after Omega if there is Omega, otherwise is after Owner
+ sObjectDataMap["ParentID"] = count;//U32, when SpecialCode & 0x20 is set
+ count += sizeof(U32);
- //-------
- //The rest items are not included here
- //-------
+ //-------
+ //The rest items are not included here
+ //-------
}
-//static
+//static
void LLViewerObject::unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name)
{
- dp->shift(sObjectDataMap[name]);
- dp->unpackVector3(value, name.c_str());
- dp->reset();
+ dp->shift(sObjectDataMap[name]);
+ dp->unpackVector3(value, name.c_str());
+ dp->reset();
}
-//static
+//static
void LLViewerObject::unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name)
{
- dp->shift(sObjectDataMap[name]);
- dp->unpackUUID(value, name.c_str());
- dp->reset();
+ dp->shift(sObjectDataMap[name]);
+ dp->unpackUUID(value, name.c_str());
+ dp->reset();
}
-
-//static
+
+//static
void LLViewerObject::unpackU32(LLDataPackerBinaryBuffer* dp, U32& value, std::string name)
{
- dp->shift(sObjectDataMap[name]);
- dp->unpackU32(value, name.c_str());
- dp->reset();
+ dp->shift(sObjectDataMap[name]);
+ dp->unpackU32(value, name.c_str());
+ dp->reset();
}
-
-//static
+
+//static
void LLViewerObject::unpackU8(LLDataPackerBinaryBuffer* dp, U8& value, std::string name)
{
- dp->shift(sObjectDataMap[name]);
- dp->unpackU8(value, name.c_str());
- dp->reset();
+ dp->shift(sObjectDataMap[name]);
+ dp->unpackU8(value, name.c_str());
+ dp->reset();
}
-//static
+//static
U32 LLViewerObject::unpackParentID(LLDataPackerBinaryBuffer* dp, U32& parent_id)
{
- dp->shift(sObjectDataMap["SpecialCode"]);
- U32 value;
- dp->unpackU32(value, "SpecialCode");
+ dp->shift(sObjectDataMap["SpecialCode"]);
+ U32 value;
+ dp->unpackU32(value, "SpecialCode");
- parent_id = 0;
- if(value & 0x20)
- {
- S32 offset = sObjectDataMap["ParentID"];
- if(!(value & 0x80))
- {
- offset -= sizeof(LLVector3);
- }
+ parent_id = 0;
+ if(value & 0x20)
+ {
+ S32 offset = sObjectDataMap["ParentID"];
+ if(!(value & 0x80))
+ {
+ offset -= sizeof(LLVector3);
+ }
- dp->shift(offset);
- dp->unpackU32(parent_id, "ParentID");
- }
- dp->reset();
+ dp->shift(offset);
+ dp->unpackU32(parent_id, "ParentID");
+ }
+ dp->reset();
- return parent_id;
+ return parent_id;
}
// Replaces all name value pairs with data from \n delimited list
// Does not update server
void LLViewerObject::setNameValueList(const std::string& name_value_list)
{
- // Clear out the old
- for_each(mNameValuePairs.begin(), mNameValuePairs.end(), DeletePairedPointer()) ;
- mNameValuePairs.clear();
-
- // Bring in the new
- std::string::size_type length = name_value_list.length();
- std::string::size_type start = 0;
- while (start < length)
- {
- std::string::size_type end = name_value_list.find_first_of("\n", start);
- if (end == std::string::npos) end = length;
- if (end > start)
- {
- std::string tok = name_value_list.substr(start, end - start);
- addNVPair(tok);
- }
- start = end+1;
- }
+ // Clear out the old
+ for_each(mNameValuePairs.begin(), mNameValuePairs.end(), DeletePairedPointer()) ;
+ mNameValuePairs.clear();
+
+ // Bring in the new
+ std::string::size_type length = name_value_list.length();
+ std::string::size_type start = 0;
+ while (start < length)
+ {
+ std::string::size_type end = name_value_list.find_first_of("\n", start);
+ if (end == std::string::npos) end = length;
+ if (end > start)
+ {
+ std::string tok = name_value_list.substr(start, end - start);
+ addNVPair(tok);
+ }
+ start = end+1;
+ }
}
BOOL LLViewerObject::isAnySelected() const
@@ -765,183 +765,183 @@ BOOL LLViewerObject::isAnySelected() const
void LLViewerObject::setSelected(BOOL sel)
{
- mUserSelected = sel;
- resetRot();
+ mUserSelected = sel;
+ resetRot();
- if (!sel)
- {
- setAllTESelected(false);
- }
+ if (!sel)
+ {
+ setAllTESelected(false);
+ }
}
// This method returns true if the object is over land owned by the
// agent.
bool LLViewerObject::isReturnable()
{
- if (isAttachment())
- {
- return false;
- }
-
- std::vector<LLBBox> boxes;
- boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned());
- for (child_list_t::iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- boxes.push_back( LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned());
- }
-
- bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0;
-
- if ( !result )
- {
- //Get list of neighboring regions relative to this vo's region
- std::vector<LLViewerRegion*> uniqueRegions;
- mRegionp->getNeighboringRegions( uniqueRegions );
-
- //Build aabb's - for root and all children
- std::vector<PotentialReturnableObject> returnables;
- typedef std::vector<LLViewerRegion*>::iterator RegionIt;
- RegionIt regionStart = uniqueRegions.begin();
- RegionIt regionEnd = uniqueRegions.end();
-
- for (; regionStart != regionEnd; ++regionStart )
- {
- LLViewerRegion* pTargetRegion = *regionStart;
- //Add the root vo as there may be no children and we still want
- //to test for any edge overlap
- buildReturnablesForChildrenVO( returnables, this, pTargetRegion );
- //Add it's children
- for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++)
- {
- LLViewerObject* pChild = *iter;
- buildReturnablesForChildrenVO( returnables, pChild, pTargetRegion );
- }
- }
-
- //TBD#Eventually create a region -> box list map
- typedef std::vector<PotentialReturnableObject>::iterator ReturnablesIt;
- ReturnablesIt retCurrentIt = returnables.begin();
- ReturnablesIt retEndIt = returnables.end();
-
- for ( ; retCurrentIt !=retEndIt; ++retCurrentIt )
- {
- boxes.clear();
- LLViewerRegion* pRegion = (*retCurrentIt).pRegion;
- boxes.push_back( (*retCurrentIt).box );
- bool retResult = pRegion
- && pRegion->childrenObjectReturnable( boxes )
- && pRegion->canManageEstate();
- if ( retResult )
- {
- result = true;
- break;
- }
- }
- }
- return result;
+ if (isAttachment())
+ {
+ return false;
+ }
+
+ std::vector<LLBBox> boxes;
+ boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned());
+ for (child_list_t::iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ boxes.push_back( LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned());
+ }
+
+ bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0;
+
+ if ( !result )
+ {
+ //Get list of neighboring regions relative to this vo's region
+ std::vector<LLViewerRegion*> uniqueRegions;
+ mRegionp->getNeighboringRegions( uniqueRegions );
+
+ //Build aabb's - for root and all children
+ std::vector<PotentialReturnableObject> returnables;
+ typedef std::vector<LLViewerRegion*>::iterator RegionIt;
+ RegionIt regionStart = uniqueRegions.begin();
+ RegionIt regionEnd = uniqueRegions.end();
+
+ for (; regionStart != regionEnd; ++regionStart )
+ {
+ LLViewerRegion* pTargetRegion = *regionStart;
+ //Add the root vo as there may be no children and we still want
+ //to test for any edge overlap
+ buildReturnablesForChildrenVO( returnables, this, pTargetRegion );
+ //Add it's children
+ for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* pChild = *iter;
+ buildReturnablesForChildrenVO( returnables, pChild, pTargetRegion );
+ }
+ }
+
+ //TBD#Eventually create a region -> box list map
+ typedef std::vector<PotentialReturnableObject>::iterator ReturnablesIt;
+ ReturnablesIt retCurrentIt = returnables.begin();
+ ReturnablesIt retEndIt = returnables.end();
+
+ for ( ; retCurrentIt !=retEndIt; ++retCurrentIt )
+ {
+ boxes.clear();
+ LLViewerRegion* pRegion = (*retCurrentIt).pRegion;
+ boxes.push_back( (*retCurrentIt).box );
+ bool retResult = pRegion
+ && pRegion->childrenObjectReturnable( boxes )
+ && pRegion->canManageEstate();
+ if ( retResult )
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+ return result;
}
void LLViewerObject::buildReturnablesForChildrenVO( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion )
{
- if ( !pChild )
- {
- LL_ERRS()<<"child viewerobject is NULL "<<LL_ENDL;
- }
-
- constructAndAddReturnable( returnables, pChild, pTargetRegion );
-
- //We want to handle any children VO's as well
- for (child_list_t::iterator iter = pChild->mChildList.begin(); iter != pChild->mChildList.end(); iter++)
- {
- LLViewerObject* pChildofChild = *iter;
- buildReturnablesForChildrenVO( returnables, pChildofChild, pTargetRegion );
- }
+ if ( !pChild )
+ {
+ LL_ERRS()<<"child viewerobject is NULL "<<LL_ENDL;
+ }
+
+ constructAndAddReturnable( returnables, pChild, pTargetRegion );
+
+ //We want to handle any children VO's as well
+ for (child_list_t::iterator iter = pChild->mChildList.begin(); iter != pChild->mChildList.end(); iter++)
+ {
+ LLViewerObject* pChildofChild = *iter;
+ buildReturnablesForChildrenVO( returnables, pChildofChild, pTargetRegion );
+ }
}
void LLViewerObject::constructAndAddReturnable( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion )
{
-
- LLVector3 targetRegionPos;
- targetRegionPos.setVec( pChild->getPositionGlobal() );
-
- LLBBox childBBox = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f,
- pChild->getScale() * 0.5f).getAxisAligned();
-
- LLVector3 edgeA = targetRegionPos + childBBox.getMinLocal();
- LLVector3 edgeB = targetRegionPos + childBBox.getMaxLocal();
-
- LLVector3d edgeAd, edgeBd;
- edgeAd.setVec(edgeA);
- edgeBd.setVec(edgeB);
-
- //Only add the box when either of the extents are in a neighboring region
- if ( pTargetRegion->pointInRegionGlobal( edgeAd ) || pTargetRegion->pointInRegionGlobal( edgeBd ) )
- {
- PotentialReturnableObject returnableObj;
- returnableObj.box = childBBox;
- returnableObj.pRegion = pTargetRegion;
- returnables.push_back( returnableObj );
- }
+
+ LLVector3 targetRegionPos;
+ targetRegionPos.setVec( pChild->getPositionGlobal() );
+
+ LLBBox childBBox = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f,
+ pChild->getScale() * 0.5f).getAxisAligned();
+
+ LLVector3 edgeA = targetRegionPos + childBBox.getMinLocal();
+ LLVector3 edgeB = targetRegionPos + childBBox.getMaxLocal();
+
+ LLVector3d edgeAd, edgeBd;
+ edgeAd.setVec(edgeA);
+ edgeBd.setVec(edgeB);
+
+ //Only add the box when either of the extents are in a neighboring region
+ if ( pTargetRegion->pointInRegionGlobal( edgeAd ) || pTargetRegion->pointInRegionGlobal( edgeBd ) )
+ {
+ PotentialReturnableObject returnableObj;
+ returnableObj.box = childBBox;
+ returnableObj.pRegion = pTargetRegion;
+ returnables.push_back( returnableObj );
+ }
}
bool LLViewerObject::crossesParcelBounds()
{
- std::vector<LLBBox> boxes;
- boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned());
- for (child_list_t::iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- boxes.push_back(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned());
- }
+ std::vector<LLBBox> boxes;
+ boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned());
+ for (child_list_t::iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ boxes.push_back(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned());
+ }
- return mRegionp && mRegionp->objectsCrossParcel(boxes);
+ return mRegionp && mRegionp->objectsCrossParcel(boxes);
}
BOOL LLViewerObject::setParent(LLViewerObject* parent)
{
- if(mParent != parent)
- {
- LLViewerObject* old_parent = (LLViewerObject*)mParent ;
- BOOL ret = LLPrimitive::setParent(parent);
- if(ret && old_parent && parent)
- {
- old_parent->removeChild(this) ;
- }
- return ret ;
- }
+ if(mParent != parent)
+ {
+ LLViewerObject* old_parent = (LLViewerObject*)mParent ;
+ BOOL ret = LLPrimitive::setParent(parent);
+ if(ret && old_parent && parent)
+ {
+ old_parent->removeChild(this) ;
+ }
+ return ret ;
+ }
- return FALSE ;
+ return FALSE ;
}
void LLViewerObject::addChild(LLViewerObject *childp)
{
- for (child_list_t::iterator i = mChildList.begin(); i != mChildList.end(); ++i)
- {
- if (*i == childp)
- { //already has child
- return;
- }
- }
-
- if (!isAvatar())
- {
- // propagate selection properties
- childp->mbCanSelect = mbCanSelect;
- }
-
- if(childp->setParent(this))
- {
- mChildList.push_back(childp);
- childp->afterReparent();
-
- if (childp->isAvatar())
- {
- mSeatCount++;
- }
- }
+ for (child_list_t::iterator i = mChildList.begin(); i != mChildList.end(); ++i)
+ {
+ if (*i == childp)
+ { //already has child
+ return;
+ }
+ }
+
+ if (!isAvatar())
+ {
+ // propagate selection properties
+ childp->mbCanSelect = mbCanSelect;
+ }
+
+ if(childp->setParent(this))
+ {
+ mChildList.push_back(childp);
+ childp->afterReparent();
+
+ if (childp->isAvatar())
+ {
+ mSeatCount++;
+ }
+ }
}
void LLViewerObject::onReparent(LLViewerObject *old_parent, LLViewerObject *new_parent)
@@ -954,149 +954,149 @@ void LLViewerObject::afterReparent()
void LLViewerObject::removeChild(LLViewerObject *childp)
{
- for (child_list_t::iterator i = mChildList.begin(); i != mChildList.end(); ++i)
- {
- if (*i == childp)
- {
- if (!childp->isAvatar() && mDrawable.notNull() && mDrawable->isActive() && childp->mDrawable.notNull() && !isAvatar())
- {
- gPipeline.markRebuild(childp->mDrawable, LLDrawable::REBUILD_VOLUME);
- }
-
- mChildList.erase(i);
-
- if(childp->getParent() == this)
- {
- childp->setParent(NULL);
- }
-
- if (childp->isAvatar())
- {
- mSeatCount--;
- }
- break;
- }
- }
-
- if (childp->isSelected())
- {
- LLSelectMgr::getInstance()->deselectObjectAndFamily(childp);
- BOOL add_to_end = TRUE;
- LLSelectMgr::getInstance()->selectObjectAndFamily(childp, add_to_end);
- }
+ for (child_list_t::iterator i = mChildList.begin(); i != mChildList.end(); ++i)
+ {
+ if (*i == childp)
+ {
+ if (!childp->isAvatar() && mDrawable.notNull() && mDrawable->isActive() && childp->mDrawable.notNull() && !isAvatar())
+ {
+ gPipeline.markRebuild(childp->mDrawable, LLDrawable::REBUILD_VOLUME);
+ }
+
+ mChildList.erase(i);
+
+ if(childp->getParent() == this)
+ {
+ childp->setParent(NULL);
+ }
+
+ if (childp->isAvatar())
+ {
+ mSeatCount--;
+ }
+ break;
+ }
+ }
+
+ if (childp->isSelected())
+ {
+ LLSelectMgr::getInstance()->deselectObjectAndFamily(childp);
+ BOOL add_to_end = TRUE;
+ LLSelectMgr::getInstance()->selectObjectAndFamily(childp, add_to_end);
+ }
}
void LLViewerObject::addThisAndAllChildren(std::vector<LLViewerObject*>& objects)
{
- objects.push_back(this);
- for (child_list_t::iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- if (!child->isAvatar())
- {
- child->addThisAndAllChildren(objects);
- }
- }
+ objects.push_back(this);
+ for (child_list_t::iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ if (!child->isAvatar())
+ {
+ child->addThisAndAllChildren(objects);
+ }
+ }
}
void LLViewerObject::addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects)
{
- objects.push_back(this);
- // don't add any attachments when temporarily selecting avatar
- if (isAvatar())
- {
- return;
- }
- for (child_list_t::iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- if ( (!child->isAvatar()))
- {
- child->addThisAndNonJointChildren(objects);
- }
- }
+ objects.push_back(this);
+ // don't add any attachments when temporarily selecting avatar
+ if (isAvatar())
+ {
+ return;
+ }
+ for (child_list_t::iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ if ( (!child->isAvatar()))
+ {
+ child->addThisAndNonJointChildren(objects);
+ }
+ }
}
BOOL LLViewerObject::isChild(LLViewerObject *childp) const
{
- for (child_list_t::const_iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* testchild = *iter;
- if (testchild == childp)
- return TRUE;
- }
- return FALSE;
+ for (child_list_t::const_iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* testchild = *iter;
+ if (testchild == childp)
+ return TRUE;
+ }
+ return FALSE;
}
// returns TRUE if at least one avatar is sitting on this object
BOOL LLViewerObject::isSeat() const
{
- return mSeatCount > 0;
+ return mSeatCount > 0;
}
BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp)
{
- if (mDrawable.isNull())
- {
- return FALSE;
- }
-
- BOOL ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL);
- if(!ret)
- {
- return FALSE ;
- }
- LLDrawable* old_parent = mDrawable->mParent;
- mDrawable->mParent = parentp;
-
- if (parentp && mDrawable->isActive())
- {
- parentp->makeActive();
- parentp->setState(LLDrawable::ACTIVE_CHILD);
- }
-
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
- if( (old_parent != parentp && old_parent)
- || (parentp && parentp->isActive()))
- {
- // *TODO we should not be relying on setDrawable parent to call markMoved
- gPipeline.markMoved(mDrawable, FALSE);
- }
- else if (!mDrawable->isAvatar())
- {
- mDrawable->updateXform(TRUE);
- /*if (!mDrawable->getSpatialGroup())
- {
- mDrawable->movePartition();
- }*/
- }
-
- return ret;
+ if (mDrawable.isNull())
+ {
+ return FALSE;
+ }
+
+ BOOL ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL);
+ if(!ret)
+ {
+ return FALSE ;
+ }
+ LLDrawable* old_parent = mDrawable->mParent;
+ mDrawable->mParent = parentp;
+
+ if (parentp && mDrawable->isActive())
+ {
+ parentp->makeActive();
+ parentp->setState(LLDrawable::ACTIVE_CHILD);
+ }
+
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
+ if( (old_parent != parentp && old_parent)
+ || (parentp && parentp->isActive()))
+ {
+ // *TODO we should not be relying on setDrawable parent to call markMoved
+ gPipeline.markMoved(mDrawable, FALSE);
+ }
+ else if (!mDrawable->isAvatar())
+ {
+ mDrawable->updateXform(TRUE);
+ /*if (!mDrawable->getSpatialGroup())
+ {
+ mDrawable->movePartition();
+ }*/
+ }
+
+ return ret;
}
// Show or hide particles, icon and HUD
void LLViewerObject::hideExtraDisplayItems( BOOL hidden )
{
- if( mPartSourcep.notNull() )
- {
- LLViewerPartSourceScript *partSourceScript = mPartSourcep.get();
- partSourceScript->setSuspended( hidden );
- }
+ if( mPartSourcep.notNull() )
+ {
+ LLViewerPartSourceScript *partSourceScript = mPartSourcep.get();
+ partSourceScript->setSuspended( hidden );
+ }
- if( mText.notNull() )
- {
- LLHUDText *hudText = mText.get();
- hudText->setHidden( hidden );
- }
+ if( mText.notNull() )
+ {
+ LLHUDText *hudText = mText.get();
+ hudText->setHidden( hidden );
+ }
- if( mIcon.notNull() )
- {
- LLHUDIcon *hudIcon = mIcon.get();
- hudIcon->setHidden( hidden );
- }
+ if( mIcon.notNull() )
+ {
+ LLHUDIcon *hudIcon = mIcon.get();
+ hudIcon->setHidden( hidden );
+ }
}
U32 LLViewerObject::checkMediaURL(const std::string &media_url)
@@ -1121,9 +1121,9 @@ U32 LLViewerObject::checkMediaURL(const std::string &media_url)
else if (mMedia->mMediaURL != media_url) // <-- This is an optimization. If they are equal don't bother with below's test.
{
/*if (! (LLTextureEntry::getAgentIDFromMediaVersionString(media_url) == gAgent.getID() &&
- LLTextureEntry::getVersionFromMediaVersionString(media_url) ==
+ LLTextureEntry::getVersionFromMediaVersionString(media_url) ==
LLTextureEntry::getVersionFromMediaVersionString(mMedia->mMediaURL) + 1))
- */
+ */
{
// If the media URL is different and WE were not the one who
// changed it, mark dirty.
@@ -1141,1354 +1141,1354 @@ U32 LLViewerObject::checkMediaURL(const std::string &media_url)
//static
U32 LLViewerObject::extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector3& pos, LLVector3& scale, LLQuaternion& rot)
{
- U32 parent_id = 0;
- LLViewerObject::unpackParentID(dp, parent_id);
+ U32 parent_id = 0;
+ LLViewerObject::unpackParentID(dp, parent_id);
+
+ LLViewerObject::unpackVector3(dp, scale, "Scale");
+ LLViewerObject::unpackVector3(dp, pos, "Pos");
+
+ LLVector3 vec;
+ LLViewerObject::unpackVector3(dp, vec, "Rot");
+ rot.unpackFromVector3(vec);
- LLViewerObject::unpackVector3(dp, scale, "Scale");
- LLViewerObject::unpackVector3(dp, pos, "Pos");
-
- LLVector3 vec;
- LLViewerObject::unpackVector3(dp, vec, "Rot");
- rot.unpackFromVector3(vec);
-
- return parent_id;
+ return parent_id;
}
U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num,
- const EObjectUpdateType update_type,
- LLDataPacker *dp)
+ void **user_data,
+ U32 block_num,
+ const EObjectUpdateType update_type,
+ LLDataPacker *dp)
{
LL_PROFILE_ZONE_SCOPED;
- LL_DEBUGS_ONCE("SceneLoadTiming") << "Received viewer object data" << LL_ENDL;
+ LL_DEBUGS_ONCE("SceneLoadTiming") << "Received viewer object data" << LL_ENDL;
LL_DEBUGS("ObjectUpdate") << " mesgsys " << mesgsys << " dp " << dp << " id " << getID() << " update_type " << (S32) update_type << LL_ENDL;
dumpStack("ObjectUpdateStack");
- U32 retval = 0x0;
-
- // If region is removed from the list it is also deleted.
- if (!LLWorld::instance().isRegionListed(mRegionp))
- {
- LL_WARNS() << "Updating object in an invalid region" << LL_ENDL;
- return retval;
- }
-
- // Coordinates of objects on simulators are region-local.
- U64 region_handle = 0;
-
- if(mesgsys != NULL)
- {
- mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
- LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
- if(regionp != mRegionp && regionp && mRegionp)//region cross
- {
- //this is the redundant position and region update, but it is necessary in case the viewer misses the following
- //position and region update messages from sim.
- //this redundant update should not cause any problems.
- LLVector3 delta_pos = mRegionp->getOriginAgent() - regionp->getOriginAgent();
- setPositionParent(getPosition() + delta_pos); //update to the new region position immediately.
- setRegion(regionp) ; //change the region.
- }
- else
- {
- if(regionp != mRegionp)
- {
- if(mRegionp)
- {
- mRegionp->removeFromCreatedList(getLocalID());
- }
- if(regionp)
- {
- regionp->addToCreatedList(getLocalID());
- }
- }
- mRegionp = regionp ;
- }
- }
-
- if (!mRegionp)
- {
- U32 x, y;
- from_region_handle(region_handle, &x, &y);
-
- LL_ERRS() << "Object has invalid region " << x << ":" << y << "!" << LL_ENDL;
- return retval;
- }
-
- F32 time_dilation = 1.f;
- if(mesgsys != NULL)
- {
+ U32 retval = 0x0;
+
+ // If region is removed from the list it is also deleted.
+ if (!LLWorld::instance().isRegionListed(mRegionp))
+ {
+ LL_WARNS() << "Updating object in an invalid region" << LL_ENDL;
+ return retval;
+ }
+
+ // Coordinates of objects on simulators are region-local.
+ U64 region_handle = 0;
+
+ if(mesgsys != NULL)
+ {
+ mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
+ LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
+ if(regionp != mRegionp && regionp && mRegionp)//region cross
+ {
+ //this is the redundant position and region update, but it is necessary in case the viewer misses the following
+ //position and region update messages from sim.
+ //this redundant update should not cause any problems.
+ LLVector3 delta_pos = mRegionp->getOriginAgent() - regionp->getOriginAgent();
+ setPositionParent(getPosition() + delta_pos); //update to the new region position immediately.
+ setRegion(regionp) ; //change the region.
+ }
+ else
+ {
+ if(regionp != mRegionp)
+ {
+ if(mRegionp)
+ {
+ mRegionp->removeFromCreatedList(getLocalID());
+ }
+ if(regionp)
+ {
+ regionp->addToCreatedList(getLocalID());
+ }
+ }
+ mRegionp = regionp ;
+ }
+ }
+
+ if (!mRegionp)
+ {
+ U32 x, y;
+ from_region_handle(region_handle, &x, &y);
+
+ LL_ERRS() << "Object has invalid region " << x << ":" << y << "!" << LL_ENDL;
+ return retval;
+ }
+
+ F32 time_dilation = 1.f;
+ if(mesgsys != NULL)
+ {
U16 time_dilation16;
mesgsys->getU16Fast(_PREHASH_RegionData, _PREHASH_TimeDilation, time_dilation16);
time_dilation = ((F32) time_dilation16) / 65535.f;
mRegionp->setTimeDilation(time_dilation);
- }
+ }
- // this will be used to determine if we've really changed position
- // Use getPosition, not getPositionRegion, since this is what we're comparing directly against.
- LLVector3 test_pos_parent = getPosition();
+ // this will be used to determine if we've really changed position
+ // Use getPosition, not getPositionRegion, since this is what we're comparing directly against.
+ LLVector3 test_pos_parent = getPosition();
- // This needs to match the largest size below. See switch(length)
- U8 data[MAX_OBJECT_BINARY_DATA_SIZE];
+ // This needs to match the largest size below. See switch(length)
+ U8 data[MAX_OBJECT_BINARY_DATA_SIZE];
#ifdef LL_BIG_ENDIAN
- U16 valswizzle[4];
+ U16 valswizzle[4];
#endif
- U16 *val;
- const F32 size = LLWorld::getInstance()->getRegionWidthInMeters();
- const F32 MAX_HEIGHT = LLWorld::getInstance()->getRegionMaxHeight();
- const F32 MIN_HEIGHT = LLWorld::getInstance()->getRegionMinHeight();
- S32 length;
- S32 count;
- S32 this_update_precision = 32; // in bits
-
- // Temporaries, because we need to compare w/ previous to set dirty flags...
- LLVector3 new_pos_parent;
- LLVector3 new_vel;
- LLVector3 new_acc;
- LLVector3 new_angv;
- LLVector3 old_angv = getAngularVelocity();
- LLQuaternion new_rot;
- LLVector3 new_scale = getScale();
-
- U32 parent_id = 0;
- U8 material = 0;
- U8 click_action = 0;
- U32 crc = 0;
-
- bool old_special_hover_cursor = specialHoverCursor();
-
- LLViewerObject *cur_parentp = (LLViewerObject *)getParent();
-
- if (cur_parentp)
- {
- parent_id = cur_parentp->mLocalID;
- }
-
- if (!dp)
- {
- switch(update_type)
- {
- case OUT_FULL:
- {
+ U16 *val;
+ const F32 size = LLWorld::getInstance()->getRegionWidthInMeters();
+ const F32 MAX_HEIGHT = LLWorld::getInstance()->getRegionMaxHeight();
+ const F32 MIN_HEIGHT = LLWorld::getInstance()->getRegionMinHeight();
+ S32 length;
+ S32 count;
+ S32 this_update_precision = 32; // in bits
+
+ // Temporaries, because we need to compare w/ previous to set dirty flags...
+ LLVector3 new_pos_parent;
+ LLVector3 new_vel;
+ LLVector3 new_acc;
+ LLVector3 new_angv;
+ LLVector3 old_angv = getAngularVelocity();
+ LLQuaternion new_rot;
+ LLVector3 new_scale = getScale();
+
+ U32 parent_id = 0;
+ U8 material = 0;
+ U8 click_action = 0;
+ U32 crc = 0;
+
+ bool old_special_hover_cursor = specialHoverCursor();
+
+ LLViewerObject *cur_parentp = (LLViewerObject *)getParent();
+
+ if (cur_parentp)
+ {
+ parent_id = cur_parentp->mLocalID;
+ }
+
+ if (!dp)
+ {
+ switch(update_type)
+ {
+ case OUT_FULL:
+ {
#ifdef DEBUG_UPDATE_TYPE
- LL_INFOS() << "Full:" << getID() << LL_ENDL;
+ LL_INFOS() << "Full:" << getID() << LL_ENDL;
#endif
- //clear cost and linkset cost
- setObjectCostStale();
- if (isSelected())
- {
- gFloaterTools->dirty();
- }
-
- LLUUID audio_uuid;
- LLUUID owner_id; // only valid if audio_uuid or particle system is not null
- F32 gain;
- F32 cutoff;
- U8 sound_flags;
-
- mesgsys->getU32Fast( _PREHASH_ObjectData, _PREHASH_CRC, crc, block_num);
- mesgsys->getU32Fast( _PREHASH_ObjectData, _PREHASH_ParentID, parent_id, block_num);
- mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_Sound, audio_uuid, block_num );
- // HACK: Owner id only valid if non-null sound id or particle system
- mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, owner_id, block_num );
- mesgsys->getF32Fast( _PREHASH_ObjectData, _PREHASH_Gain, gain, block_num );
- mesgsys->getF32Fast( _PREHASH_ObjectData, _PREHASH_Radius, cutoff, block_num );
- mesgsys->getU8Fast( _PREHASH_ObjectData, _PREHASH_Flags, sound_flags, block_num );
- mesgsys->getU8Fast( _PREHASH_ObjectData, _PREHASH_Material, material, block_num );
- mesgsys->getU8Fast( _PREHASH_ObjectData, _PREHASH_ClickAction, click_action, block_num);
- mesgsys->getVector3Fast(_PREHASH_ObjectData, _PREHASH_Scale, new_scale, block_num );
- length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData);
- mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num, MAX_OBJECT_BINARY_DATA_SIZE);
-
- mTotalCRC = crc;
+ //clear cost and linkset cost
+ setObjectCostStale();
+ if (isSelected())
+ {
+ gFloaterTools->dirty();
+ }
+
+ LLUUID audio_uuid;
+ LLUUID owner_id; // only valid if audio_uuid or particle system is not null
+ F32 gain;
+ F32 cutoff;
+ U8 sound_flags;
+
+ mesgsys->getU32Fast( _PREHASH_ObjectData, _PREHASH_CRC, crc, block_num);
+ mesgsys->getU32Fast( _PREHASH_ObjectData, _PREHASH_ParentID, parent_id, block_num);
+ mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_Sound, audio_uuid, block_num );
+ // HACK: Owner id only valid if non-null sound id or particle system
+ mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, owner_id, block_num );
+ mesgsys->getF32Fast( _PREHASH_ObjectData, _PREHASH_Gain, gain, block_num );
+ mesgsys->getF32Fast( _PREHASH_ObjectData, _PREHASH_Radius, cutoff, block_num );
+ mesgsys->getU8Fast( _PREHASH_ObjectData, _PREHASH_Flags, sound_flags, block_num );
+ mesgsys->getU8Fast( _PREHASH_ObjectData, _PREHASH_Material, material, block_num );
+ mesgsys->getU8Fast( _PREHASH_ObjectData, _PREHASH_ClickAction, click_action, block_num);
+ mesgsys->getVector3Fast(_PREHASH_ObjectData, _PREHASH_Scale, new_scale, block_num );
+ length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData);
+ mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num, MAX_OBJECT_BINARY_DATA_SIZE);
+
+ mTotalCRC = crc;
// Might need to update mSourceMuted here to properly pick up new radius
- mSoundCutOffRadius = cutoff;
-
- // Owner ID used for sound muting or particle system muting
- setAttachedSound(audio_uuid, owner_id, gain, sound_flags);
-
- U8 old_material = getMaterial();
- if (old_material != material)
- {
- setMaterial(material);
- if (mDrawable.notNull())
- {
- gPipeline.markMoved(mDrawable, FALSE); // undamped
- }
- }
- setClickAction(click_action);
-
- count = 0;
- LLVector4 collision_plane;
-
- switch(length)
- {
- case (60 + 16):
- // pull out collision normal for avatar
- htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
- ((LLVOAvatar*)this)->setFootPlane(collision_plane);
- count += sizeof(LLVector4);
- // fall through
- case 60:
- this_update_precision = 32;
- // this is a terse update
- // pos
- htolememcpy(new_pos_parent.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- count += sizeof(LLVector3);
- // vel
- htolememcpy((void*)getVelocity().mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- count += sizeof(LLVector3);
- // acc
- htolememcpy((void*)getAcceleration().mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- count += sizeof(LLVector3);
- // theta
- {
- LLVector3 vec;
- htolememcpy(vec.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- new_rot.unpackFromVector3(vec);
- }
- count += sizeof(LLVector3);
- // omega
- htolememcpy((void*)new_angv.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- if (new_angv.isExactlyZero())
- {
- // reset rotation time
- resetRot();
- }
- setAngularVelocity(new_angv);
+ mSoundCutOffRadius = cutoff;
+
+ // Owner ID used for sound muting or particle system muting
+ setAttachedSound(audio_uuid, owner_id, gain, sound_flags);
+
+ U8 old_material = getMaterial();
+ if (old_material != material)
+ {
+ setMaterial(material);
+ if (mDrawable.notNull())
+ {
+ gPipeline.markMoved(mDrawable, FALSE); // undamped
+ }
+ }
+ setClickAction(click_action);
+
+ count = 0;
+ LLVector4 collision_plane;
+
+ switch(length)
+ {
+ case (60 + 16):
+ // pull out collision normal for avatar
+ htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
+ ((LLVOAvatar*)this)->setFootPlane(collision_plane);
+ count += sizeof(LLVector4);
+ // fall through
+ case 60:
+ this_update_precision = 32;
+ // this is a terse update
+ // pos
+ htolememcpy(new_pos_parent.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ count += sizeof(LLVector3);
+ // vel
+ htolememcpy((void*)getVelocity().mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ count += sizeof(LLVector3);
+ // acc
+ htolememcpy((void*)getAcceleration().mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ count += sizeof(LLVector3);
+ // theta
+ {
+ LLVector3 vec;
+ htolememcpy(vec.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ new_rot.unpackFromVector3(vec);
+ }
+ count += sizeof(LLVector3);
+ // omega
+ htolememcpy((void*)new_angv.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ if (new_angv.isExactlyZero())
+ {
+ // reset rotation time
+ resetRot();
+ }
+ setAngularVelocity(new_angv);
#if LL_DARWIN
- if (length == 76)
- {
- setAngularVelocity(LLVector3::zero);
- }
+ if (length == 76)
+ {
+ setAngularVelocity(LLVector3::zero);
+ }
#endif
- break;
- case(32 + 16):
- // pull out collision normal for avatar
- htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
- ((LLVOAvatar*)this)->setFootPlane(collision_plane);
- count += sizeof(LLVector4);
- // fall through
- case 32:
- this_update_precision = 16;
- test_pos_parent.quantize16(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT);
-
- // This is a terse 16 update, so treat data as an array of U16's.
+ break;
+ case(32 + 16):
+ // pull out collision normal for avatar
+ htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
+ ((LLVOAvatar*)this)->setFootPlane(collision_plane);
+ count += sizeof(LLVector4);
+ // fall through
+ case 32:
+ this_update_precision = 16;
+ test_pos_parent.quantize16(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT);
+
+ // This is a terse 16 update, so treat data as an array of U16's.
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- count += sizeof(U16)*3;
- new_pos_parent.mV[VX] = U16_to_F32(val[VX], -0.5f*size, 1.5f*size);
- new_pos_parent.mV[VY] = U16_to_F32(val[VY], -0.5f*size, 1.5f*size);
- new_pos_parent.mV[VZ] = U16_to_F32(val[VZ], MIN_HEIGHT, MAX_HEIGHT);
+ count += sizeof(U16)*3;
+ new_pos_parent.mV[VX] = U16_to_F32(val[VX], -0.5f*size, 1.5f*size);
+ new_pos_parent.mV[VY] = U16_to_F32(val[VY], -0.5f*size, 1.5f*size);
+ new_pos_parent.mV[VZ] = U16_to_F32(val[VZ], MIN_HEIGHT, MAX_HEIGHT);
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- count += sizeof(U16)*3;
- setVelocity(LLVector3(U16_to_F32(val[VX], -size, size),
- U16_to_F32(val[VY], -size, size),
- U16_to_F32(val[VZ], -size, size)));
+ count += sizeof(U16)*3;
+ setVelocity(LLVector3(U16_to_F32(val[VX], -size, size),
+ U16_to_F32(val[VY], -size, size),
+ U16_to_F32(val[VZ], -size, size)));
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- count += sizeof(U16)*3;
- setAcceleration(LLVector3(U16_to_F32(val[VX], -size, size),
- U16_to_F32(val[VY], -size, size),
- U16_to_F32(val[VZ], -size, size)));
+ count += sizeof(U16)*3;
+ setAcceleration(LLVector3(U16_to_F32(val[VX], -size, size),
+ U16_to_F32(val[VY], -size, size),
+ U16_to_F32(val[VZ], -size, size)));
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Quat, 4);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Quat, 4);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- count += sizeof(U16)*4;
- new_rot.mQ[VX] = U16_to_F32(val[VX], -1.f, 1.f);
- new_rot.mQ[VY] = U16_to_F32(val[VY], -1.f, 1.f);
- new_rot.mQ[VZ] = U16_to_F32(val[VZ], -1.f, 1.f);
- new_rot.mQ[VW] = U16_to_F32(val[VW], -1.f, 1.f);
+ count += sizeof(U16)*4;
+ new_rot.mQ[VX] = U16_to_F32(val[VX], -1.f, 1.f);
+ new_rot.mQ[VY] = U16_to_F32(val[VY], -1.f, 1.f);
+ new_rot.mQ[VZ] = U16_to_F32(val[VZ], -1.f, 1.f);
+ new_rot.mQ[VW] = U16_to_F32(val[VW], -1.f, 1.f);
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- new_angv.setVec(U16_to_F32(val[VX], -size, size),
- U16_to_F32(val[VY], -size, size),
- U16_to_F32(val[VZ], -size, size));
- if (new_angv.isExactlyZero())
- {
- // reset rotation time
- resetRot();
- }
- setAngularVelocity(new_angv);
- break;
-
- case 16:
- this_update_precision = 8;
- test_pos_parent.quantize8(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT);
- // this is a terse 8 update
- new_pos_parent.mV[VX] = U8_to_F32(data[0], -0.5f*size, 1.5f*size);
- new_pos_parent.mV[VY] = U8_to_F32(data[1], -0.5f*size, 1.5f*size);
- new_pos_parent.mV[VZ] = U8_to_F32(data[2], MIN_HEIGHT, MAX_HEIGHT);
-
- setVelocity(U8_to_F32(data[3], -size, size),
- U8_to_F32(data[4], -size, size),
- U8_to_F32(data[5], -size, size) );
-
- setAcceleration(U8_to_F32(data[6], -size, size),
- U8_to_F32(data[7], -size, size),
- U8_to_F32(data[8], -size, size) );
-
- new_rot.mQ[VX] = U8_to_F32(data[9], -1.f, 1.f);
- new_rot.mQ[VY] = U8_to_F32(data[10], -1.f, 1.f);
- new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f);
- new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f);
-
- new_angv.setVec(U8_to_F32(data[13], -size, size),
- U8_to_F32(data[14], -size, size),
- U8_to_F32(data[15], -size, size) );
- if (new_angv.isExactlyZero())
- {
- // reset rotation time
- resetRot();
- }
- setAngularVelocity(new_angv);
- break;
- }
-
- ////////////////////////////////////////////////////
- //
- // Here we handle data specific to the full message.
- //
-
- U32 flags;
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, block_num);
- // clear all but local flags
- mFlags &= FLAGS_LOCAL;
- mFlags |= flags;
-
- U8 state;
- mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_State, state, block_num );
- mAttachmentState = state;
-
- // ...new objects that should come in selected need to be added to the selected list
- mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0);
-
- // Set all name value pairs
- S32 nv_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_NameValue);
- if (nv_size > 0)
- {
- std::string name_value_list;
- mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_NameValue, name_value_list, block_num);
- setNameValueList(name_value_list);
- }
-
- // Clear out any existing generic data
- if (mData)
- {
- delete [] mData;
- }
-
- // Check for appended generic data
- S32 data_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_Data);
- if (data_size <= 0)
- {
- mData = NULL;
- }
- else
- {
- // ...has generic data
- mData = new U8[data_size];
- mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, mData, data_size, block_num);
- }
-
- S32 text_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_Text);
- if (text_size > 1)
- {
- // Setup object text
- if (!mText)
- {
- initHudText();
- }
-
- std::string temp_string;
- mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_Text, temp_string, block_num );
-
- LLColor4U coloru;
- mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextColor, coloru.mV, 4, block_num);
-
- // alpha was flipped so that it zero encoded better
- coloru.mV[3] = 255 - coloru.mV[3];
- mText->setColor(LLColor4(coloru));
- mText->setString(temp_string);
-
- mHudText = temp_string;
- mHudTextColor = LLColor4(coloru);
-
- setChanged(MOVED | SILHOUETTE);
- }
- else
- {
- if (mText.notNull())
- {
- mText->markDead();
- mText = NULL;
- }
- mHudText.clear();
- }
-
- std::string media_url;
- mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_MediaURL, media_url, block_num);
+ new_angv.setVec(U16_to_F32(val[VX], -size, size),
+ U16_to_F32(val[VY], -size, size),
+ U16_to_F32(val[VZ], -size, size));
+ if (new_angv.isExactlyZero())
+ {
+ // reset rotation time
+ resetRot();
+ }
+ setAngularVelocity(new_angv);
+ break;
+
+ case 16:
+ this_update_precision = 8;
+ test_pos_parent.quantize8(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT);
+ // this is a terse 8 update
+ new_pos_parent.mV[VX] = U8_to_F32(data[0], -0.5f*size, 1.5f*size);
+ new_pos_parent.mV[VY] = U8_to_F32(data[1], -0.5f*size, 1.5f*size);
+ new_pos_parent.mV[VZ] = U8_to_F32(data[2], MIN_HEIGHT, MAX_HEIGHT);
+
+ setVelocity(U8_to_F32(data[3], -size, size),
+ U8_to_F32(data[4], -size, size),
+ U8_to_F32(data[5], -size, size) );
+
+ setAcceleration(U8_to_F32(data[6], -size, size),
+ U8_to_F32(data[7], -size, size),
+ U8_to_F32(data[8], -size, size) );
+
+ new_rot.mQ[VX] = U8_to_F32(data[9], -1.f, 1.f);
+ new_rot.mQ[VY] = U8_to_F32(data[10], -1.f, 1.f);
+ new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f);
+ new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f);
+
+ new_angv.setVec(U8_to_F32(data[13], -size, size),
+ U8_to_F32(data[14], -size, size),
+ U8_to_F32(data[15], -size, size) );
+ if (new_angv.isExactlyZero())
+ {
+ // reset rotation time
+ resetRot();
+ }
+ setAngularVelocity(new_angv);
+ break;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Here we handle data specific to the full message.
+ //
+
+ U32 flags;
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, block_num);
+ // clear all but local flags
+ mFlags &= FLAGS_LOCAL;
+ mFlags |= flags;
+
+ U8 state;
+ mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_State, state, block_num );
+ mAttachmentState = state;
+
+ // ...new objects that should come in selected need to be added to the selected list
+ mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0);
+
+ // Set all name value pairs
+ S32 nv_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_NameValue);
+ if (nv_size > 0)
+ {
+ std::string name_value_list;
+ mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_NameValue, name_value_list, block_num);
+ setNameValueList(name_value_list);
+ }
+
+ // Clear out any existing generic data
+ if (mData)
+ {
+ delete [] mData;
+ }
+
+ // Check for appended generic data
+ S32 data_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_Data);
+ if (data_size <= 0)
+ {
+ mData = NULL;
+ }
+ else
+ {
+ // ...has generic data
+ mData = new U8[data_size];
+ mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, mData, data_size, block_num);
+ }
+
+ S32 text_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_Text);
+ if (text_size > 1)
+ {
+ // Setup object text
+ if (!mText)
+ {
+ initHudText();
+ }
+
+ std::string temp_string;
+ mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_Text, temp_string, block_num );
+
+ LLColor4U coloru;
+ mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextColor, coloru.mV, 4, block_num);
+
+ // alpha was flipped so that it zero encoded better
+ coloru.mV[3] = 255 - coloru.mV[3];
+ mText->setColor(LLColor4(coloru));
+ mText->setString(temp_string);
+
+ mHudText = temp_string;
+ mHudTextColor = LLColor4(coloru);
+
+ setChanged(MOVED | SILHOUETTE);
+ }
+ else
+ {
+ if (mText.notNull())
+ {
+ mText->markDead();
+ mText = NULL;
+ }
+ mHudText.clear();
+ }
+
+ std::string media_url;
+ mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_MediaURL, media_url, block_num);
retval |= checkMediaURL(media_url);
-
- //
- // Unpack particle system data
- //
- unpackParticleSource(block_num, owner_id);
-
- // Mark all extra parameters not used
- std::unordered_map<U16, ExtraParameter*>::iterator iter;
- for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
- {
- iter->second->in_use = FALSE;
- }
-
- // Unpack extra parameters
- S32 size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ExtraParams);
- if (size > 0)
- {
- U8 *buffer = new U8[size];
- mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ExtraParams, buffer, size, block_num);
- LLDataPackerBinaryBuffer dp(buffer, size);
-
- U8 num_parameters;
- dp.unpackU8(num_parameters, "num_params");
- U8 param_block[MAX_OBJECT_PARAMS_SIZE];
- for (U8 param=0; param<num_parameters; ++param)
- {
- U16 param_type;
- S32 param_size;
- dp.unpackU16(param_type, "param_type");
- dp.unpackBinaryData(param_block, param_size, "param_data");
- //LL_INFOS() << "Param type: " << param_type << ", Size: " << param_size << LL_ENDL;
- LLDataPackerBinaryBuffer dp2(param_block, param_size);
- unpackParameterEntry(param_type, &dp2);
- }
- delete[] buffer;
- }
-
- for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
- {
- if (!iter->second->in_use)
- {
- // Send an update message in case it was formerly in use
- parameterChanged(iter->first, iter->second->data, FALSE, false);
- }
- }
-
- break;
- }
-
- case OUT_TERSE_IMPROVED:
- {
+
+ //
+ // Unpack particle system data
+ //
+ unpackParticleSource(block_num, owner_id);
+
+ // Mark all extra parameters not used
+ std::unordered_map<U16, ExtraParameter*>::iterator iter;
+ for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
+ {
+ iter->second->in_use = FALSE;
+ }
+
+ // Unpack extra parameters
+ S32 size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ExtraParams);
+ if (size > 0)
+ {
+ U8 *buffer = new U8[size];
+ mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ExtraParams, buffer, size, block_num);
+ LLDataPackerBinaryBuffer dp(buffer, size);
+
+ U8 num_parameters;
+ dp.unpackU8(num_parameters, "num_params");
+ U8 param_block[MAX_OBJECT_PARAMS_SIZE];
+ for (U8 param=0; param<num_parameters; ++param)
+ {
+ U16 param_type;
+ S32 param_size;
+ dp.unpackU16(param_type, "param_type");
+ dp.unpackBinaryData(param_block, param_size, "param_data");
+ //LL_INFOS() << "Param type: " << param_type << ", Size: " << param_size << LL_ENDL;
+ LLDataPackerBinaryBuffer dp2(param_block, param_size);
+ unpackParameterEntry(param_type, &dp2);
+ }
+ delete[] buffer;
+ }
+
+ for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
+ {
+ if (!iter->second->in_use)
+ {
+ // Send an update message in case it was formerly in use
+ parameterChanged(iter->first, iter->second->data, FALSE, false);
+ }
+ }
+
+ break;
+ }
+
+ case OUT_TERSE_IMPROVED:
+ {
#ifdef DEBUG_UPDATE_TYPE
- LL_INFOS() << "TI:" << getID() << LL_ENDL;
+ LL_INFOS() << "TI:" << getID() << LL_ENDL;
#endif
- length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData);
- mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num, MAX_OBJECT_BINARY_DATA_SIZE);
- count = 0;
- LLVector4 collision_plane;
-
- switch(length)
- {
- case(60 + 16):
- // pull out collision normal for avatar
- htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
- ((LLVOAvatar*)this)->setFootPlane(collision_plane);
- count += sizeof(LLVector4);
- // fall through
- case 60:
- // this is a terse 32 update
- // pos
- this_update_precision = 32;
- htolememcpy(new_pos_parent.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- count += sizeof(LLVector3);
- // vel
- htolememcpy((void*)getVelocity().mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- count += sizeof(LLVector3);
- // acc
- htolememcpy((void*)getAcceleration().mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- count += sizeof(LLVector3);
- // theta
- {
- LLVector3 vec;
- htolememcpy(vec.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- new_rot.unpackFromVector3(vec);
- }
- count += sizeof(LLVector3);
- // omega
- htolememcpy((void*)new_angv.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
- if (new_angv.isExactlyZero())
- {
- // reset rotation time
- resetRot();
- }
- setAngularVelocity(new_angv);
+ length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData);
+ mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num, MAX_OBJECT_BINARY_DATA_SIZE);
+ count = 0;
+ LLVector4 collision_plane;
+
+ switch(length)
+ {
+ case(60 + 16):
+ // pull out collision normal for avatar
+ htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
+ ((LLVOAvatar*)this)->setFootPlane(collision_plane);
+ count += sizeof(LLVector4);
+ // fall through
+ case 60:
+ // this is a terse 32 update
+ // pos
+ this_update_precision = 32;
+ htolememcpy(new_pos_parent.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ count += sizeof(LLVector3);
+ // vel
+ htolememcpy((void*)getVelocity().mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ count += sizeof(LLVector3);
+ // acc
+ htolememcpy((void*)getAcceleration().mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ count += sizeof(LLVector3);
+ // theta
+ {
+ LLVector3 vec;
+ htolememcpy(vec.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ new_rot.unpackFromVector3(vec);
+ }
+ count += sizeof(LLVector3);
+ // omega
+ htolememcpy((void*)new_angv.mV, &data[count], MVT_LLVector3, sizeof(LLVector3));
+ if (new_angv.isExactlyZero())
+ {
+ // reset rotation time
+ resetRot();
+ }
+ setAngularVelocity(new_angv);
#if LL_DARWIN
- if (length == 76)
- {
- setAngularVelocity(LLVector3::zero);
- }
+ if (length == 76)
+ {
+ setAngularVelocity(LLVector3::zero);
+ }
#endif
- break;
- case(32 + 16):
- // pull out collision normal for avatar
- htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
- ((LLVOAvatar*)this)->setFootPlane(collision_plane);
- count += sizeof(LLVector4);
- // fall through
- case 32:
- // this is a terse 16 update
- this_update_precision = 16;
- test_pos_parent.quantize16(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT);
+ break;
+ case(32 + 16):
+ // pull out collision normal for avatar
+ htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4));
+ ((LLVOAvatar*)this)->setFootPlane(collision_plane);
+ count += sizeof(LLVector4);
+ // fall through
+ case 32:
+ // this is a terse 16 update
+ this_update_precision = 16;
+ test_pos_parent.quantize16(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT);
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- count += sizeof(U16)*3;
- new_pos_parent.mV[VX] = U16_to_F32(val[VX], -0.5f*size, 1.5f*size);
- new_pos_parent.mV[VY] = U16_to_F32(val[VY], -0.5f*size, 1.5f*size);
- new_pos_parent.mV[VZ] = U16_to_F32(val[VZ], MIN_HEIGHT, MAX_HEIGHT);
+ count += sizeof(U16)*3;
+ new_pos_parent.mV[VX] = U16_to_F32(val[VX], -0.5f*size, 1.5f*size);
+ new_pos_parent.mV[VY] = U16_to_F32(val[VY], -0.5f*size, 1.5f*size);
+ new_pos_parent.mV[VZ] = U16_to_F32(val[VZ], MIN_HEIGHT, MAX_HEIGHT);
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- count += sizeof(U16)*3;
- setVelocity(U16_to_F32(val[VX], -size, size),
- U16_to_F32(val[VY], -size, size),
- U16_to_F32(val[VZ], -size, size));
+ count += sizeof(U16)*3;
+ setVelocity(U16_to_F32(val[VX], -size, size),
+ U16_to_F32(val[VY], -size, size),
+ U16_to_F32(val[VZ], -size, size));
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- count += sizeof(U16)*3;
- setAcceleration(U16_to_F32(val[VX], -size, size),
- U16_to_F32(val[VY], -size, size),
- U16_to_F32(val[VZ], -size, size));
+ count += sizeof(U16)*3;
+ setAcceleration(U16_to_F32(val[VX], -size, size),
+ U16_to_F32(val[VY], -size, size),
+ U16_to_F32(val[VZ], -size, size));
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Quat, 8);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Quat, 8);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- count += sizeof(U16)*4;
- new_rot.mQ[VX] = U16_to_F32(val[VX], -1.f, 1.f);
- new_rot.mQ[VY] = U16_to_F32(val[VY], -1.f, 1.f);
- new_rot.mQ[VZ] = U16_to_F32(val[VZ], -1.f, 1.f);
- new_rot.mQ[VW] = U16_to_F32(val[VW], -1.f, 1.f);
+ count += sizeof(U16)*4;
+ new_rot.mQ[VX] = U16_to_F32(val[VX], -1.f, 1.f);
+ new_rot.mQ[VY] = U16_to_F32(val[VY], -1.f, 1.f);
+ new_rot.mQ[VZ] = U16_to_F32(val[VZ], -1.f, 1.f);
+ new_rot.mQ[VW] = U16_to_F32(val[VW], -1.f, 1.f);
#ifdef LL_BIG_ENDIAN
- htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
- val = valswizzle;
+ htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6);
+ val = valswizzle;
#else
- val = (U16 *) &data[count];
+ val = (U16 *) &data[count];
#endif
- new_angv.set(U16_to_F32(val[VX], -size, size),
- U16_to_F32(val[VY], -size, size),
- U16_to_F32(val[VZ], -size, size));
- setAngularVelocity(new_angv);
- break;
-
- case 16:
- // this is a terse 8 update
- this_update_precision = 8;
- test_pos_parent.quantize8(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT);
- new_pos_parent.mV[VX] = U8_to_F32(data[0], -0.5f*size, 1.5f*size);
- new_pos_parent.mV[VY] = U8_to_F32(data[1], -0.5f*size, 1.5f*size);
- new_pos_parent.mV[VZ] = U8_to_F32(data[2], MIN_HEIGHT, MAX_HEIGHT);
-
- setVelocity(U8_to_F32(data[3], -size, size),
- U8_to_F32(data[4], -size, size),
- U8_to_F32(data[5], -size, size) );
-
- setAcceleration(U8_to_F32(data[6], -size, size),
- U8_to_F32(data[7], -size, size),
- U8_to_F32(data[8], -size, size) );
-
- new_rot.mQ[VX] = U8_to_F32(data[9], -1.f, 1.f);
- new_rot.mQ[VY] = U8_to_F32(data[10], -1.f, 1.f);
- new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f);
- new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f);
-
- new_angv.set(U8_to_F32(data[13], -size, size),
- U8_to_F32(data[14], -size, size),
- U8_to_F32(data[15], -size, size) );
- setAngularVelocity(new_angv);
- break;
- }
-
- U8 state;
- mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_State, state, block_num );
- mAttachmentState = state;
- break;
- }
-
- default:
- break;
-
- }
- }
- else
- {
- // handle the compressed case
- LLUUID sound_uuid;
- LLUUID owner_id;
- F32 gain = 0;
- U8 sound_flags = 0;
- F32 cutoff = 0;
-
- U16 val[4];
-
- U8 state;
-
- dp->unpackU8(state, "State");
- mAttachmentState = state;
-
- switch(update_type)
- {
- case OUT_TERSE_IMPROVED:
- {
+ new_angv.set(U16_to_F32(val[VX], -size, size),
+ U16_to_F32(val[VY], -size, size),
+ U16_to_F32(val[VZ], -size, size));
+ setAngularVelocity(new_angv);
+ break;
+
+ case 16:
+ // this is a terse 8 update
+ this_update_precision = 8;
+ test_pos_parent.quantize8(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT);
+ new_pos_parent.mV[VX] = U8_to_F32(data[0], -0.5f*size, 1.5f*size);
+ new_pos_parent.mV[VY] = U8_to_F32(data[1], -0.5f*size, 1.5f*size);
+ new_pos_parent.mV[VZ] = U8_to_F32(data[2], MIN_HEIGHT, MAX_HEIGHT);
+
+ setVelocity(U8_to_F32(data[3], -size, size),
+ U8_to_F32(data[4], -size, size),
+ U8_to_F32(data[5], -size, size) );
+
+ setAcceleration(U8_to_F32(data[6], -size, size),
+ U8_to_F32(data[7], -size, size),
+ U8_to_F32(data[8], -size, size) );
+
+ new_rot.mQ[VX] = U8_to_F32(data[9], -1.f, 1.f);
+ new_rot.mQ[VY] = U8_to_F32(data[10], -1.f, 1.f);
+ new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f);
+ new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f);
+
+ new_angv.set(U8_to_F32(data[13], -size, size),
+ U8_to_F32(data[14], -size, size),
+ U8_to_F32(data[15], -size, size) );
+ setAngularVelocity(new_angv);
+ break;
+ }
+
+ U8 state;
+ mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_State, state, block_num );
+ mAttachmentState = state;
+ break;
+ }
+
+ default:
+ break;
+
+ }
+ }
+ else
+ {
+ // handle the compressed case
+ LLUUID sound_uuid;
+ LLUUID owner_id;
+ F32 gain = 0;
+ U8 sound_flags = 0;
+ F32 cutoff = 0;
+
+ U16 val[4];
+
+ U8 state;
+
+ dp->unpackU8(state, "State");
+ mAttachmentState = state;
+
+ switch(update_type)
+ {
+ case OUT_TERSE_IMPROVED:
+ {
#ifdef DEBUG_UPDATE_TYPE
- LL_INFOS() << "CompTI:" << getID() << LL_ENDL;
+ LL_INFOS() << "CompTI:" << getID() << LL_ENDL;
#endif
- U8 value;
- dp->unpackU8(value, "agent");
- if (value)
- {
- LLVector4 collision_plane;
- dp->unpackVector4(collision_plane, "Plane");
- ((LLVOAvatar*)this)->setFootPlane(collision_plane);
- }
- test_pos_parent = getPosition();
- dp->unpackVector3(new_pos_parent, "Pos");
- dp->unpackU16(val[VX], "VelX");
- dp->unpackU16(val[VY], "VelY");
- dp->unpackU16(val[VZ], "VelZ");
- setVelocity(U16_to_F32(val[VX], -128.f, 128.f),
- U16_to_F32(val[VY], -128.f, 128.f),
- U16_to_F32(val[VZ], -128.f, 128.f));
- dp->unpackU16(val[VX], "AccX");
- dp->unpackU16(val[VY], "AccY");
- dp->unpackU16(val[VZ], "AccZ");
- setAcceleration(U16_to_F32(val[VX], -64.f, 64.f),
- U16_to_F32(val[VY], -64.f, 64.f),
- U16_to_F32(val[VZ], -64.f, 64.f));
-
- dp->unpackU16(val[VX], "ThetaX");
- dp->unpackU16(val[VY], "ThetaY");
- dp->unpackU16(val[VZ], "ThetaZ");
- dp->unpackU16(val[VS], "ThetaS");
- new_rot.mQ[VX] = U16_to_F32(val[VX], -1.f, 1.f);
- new_rot.mQ[VY] = U16_to_F32(val[VY], -1.f, 1.f);
- new_rot.mQ[VZ] = U16_to_F32(val[VZ], -1.f, 1.f);
- new_rot.mQ[VS] = U16_to_F32(val[VS], -1.f, 1.f);
- dp->unpackU16(val[VX], "AccX");
- dp->unpackU16(val[VY], "AccY");
- dp->unpackU16(val[VZ], "AccZ");
- new_angv.set(U16_to_F32(val[VX], -64.f, 64.f),
- U16_to_F32(val[VY], -64.f, 64.f),
- U16_to_F32(val[VZ], -64.f, 64.f));
- setAngularVelocity(new_angv);
- }
- break;
- case OUT_FULL_COMPRESSED:
- case OUT_FULL_CACHED:
- {
+ U8 value;
+ dp->unpackU8(value, "agent");
+ if (value)
+ {
+ LLVector4 collision_plane;
+ dp->unpackVector4(collision_plane, "Plane");
+ ((LLVOAvatar*)this)->setFootPlane(collision_plane);
+ }
+ test_pos_parent = getPosition();
+ dp->unpackVector3(new_pos_parent, "Pos");
+ dp->unpackU16(val[VX], "VelX");
+ dp->unpackU16(val[VY], "VelY");
+ dp->unpackU16(val[VZ], "VelZ");
+ setVelocity(U16_to_F32(val[VX], -128.f, 128.f),
+ U16_to_F32(val[VY], -128.f, 128.f),
+ U16_to_F32(val[VZ], -128.f, 128.f));
+ dp->unpackU16(val[VX], "AccX");
+ dp->unpackU16(val[VY], "AccY");
+ dp->unpackU16(val[VZ], "AccZ");
+ setAcceleration(U16_to_F32(val[VX], -64.f, 64.f),
+ U16_to_F32(val[VY], -64.f, 64.f),
+ U16_to_F32(val[VZ], -64.f, 64.f));
+
+ dp->unpackU16(val[VX], "ThetaX");
+ dp->unpackU16(val[VY], "ThetaY");
+ dp->unpackU16(val[VZ], "ThetaZ");
+ dp->unpackU16(val[VS], "ThetaS");
+ new_rot.mQ[VX] = U16_to_F32(val[VX], -1.f, 1.f);
+ new_rot.mQ[VY] = U16_to_F32(val[VY], -1.f, 1.f);
+ new_rot.mQ[VZ] = U16_to_F32(val[VZ], -1.f, 1.f);
+ new_rot.mQ[VS] = U16_to_F32(val[VS], -1.f, 1.f);
+ dp->unpackU16(val[VX], "AccX");
+ dp->unpackU16(val[VY], "AccY");
+ dp->unpackU16(val[VZ], "AccZ");
+ new_angv.set(U16_to_F32(val[VX], -64.f, 64.f),
+ U16_to_F32(val[VY], -64.f, 64.f),
+ U16_to_F32(val[VZ], -64.f, 64.f));
+ setAngularVelocity(new_angv);
+ }
+ break;
+ case OUT_FULL_COMPRESSED:
+ case OUT_FULL_CACHED:
+ {
#ifdef DEBUG_UPDATE_TYPE
- LL_INFOS() << "CompFull:" << getID() << LL_ENDL;
+ LL_INFOS() << "CompFull:" << getID() << LL_ENDL;
#endif
- setObjectCostStale();
-
- if (isSelected())
- {
- gFloaterTools->dirty();
- }
-
- dp->unpackU32(crc, "CRC");
- mTotalCRC = crc;
- dp->unpackU8(material, "Material");
- U8 old_material = getMaterial();
- if (old_material != material)
- {
- setMaterial(material);
- if (mDrawable.notNull())
- {
- gPipeline.markMoved(mDrawable, FALSE); // undamped
- }
- }
- dp->unpackU8(click_action, "ClickAction");
- setClickAction(click_action);
- dp->unpackVector3(new_scale, "Scale");
- dp->unpackVector3(new_pos_parent, "Pos");
- LLVector3 vec;
- dp->unpackVector3(vec, "Rot");
- new_rot.unpackFromVector3(vec);
- setAcceleration(LLVector3::zero);
-
- U32 value;
- dp->unpackU32(value, "SpecialCode");
- dp->setPassFlags(value);
- dp->unpackUUID(owner_id, "Owner");
-
- mOwnerID = owner_id;
-
- if (value & 0x80)
- {
- dp->unpackVector3(new_angv, "Omega");
- setAngularVelocity(new_angv);
- }
-
- if (value & 0x20)
- {
- dp->unpackU32(parent_id, "ParentID");
- }
- else
- {
- parent_id = 0;
- }
-
- S32 sp_size;
- U32 size;
- if (value & 0x2)
- {
- sp_size = 1;
- delete [] mData;
- mData = new U8[1];
- dp->unpackU8(((U8*)mData)[0], "TreeData");
- }
- else if (value & 0x1)
- {
- dp->unpackU32(size, "ScratchPadSize");
- delete [] mData;
- mData = new U8[size];
- dp->unpackBinaryData((U8 *)mData, sp_size, "PartData");
- }
- else
- {
- mData = NULL;
- }
-
- // Setup object text
- if (!mText && (value & 0x4))
- {
- initHudText();
- }
-
- if (value & 0x4)
- {
- std::string temp_string;
- dp->unpackString(temp_string, "Text");
- LLColor4U coloru;
- dp->unpackBinaryDataFixed(coloru.mV, 4, "Color");
- coloru.mV[3] = 255 - coloru.mV[3];
- mText->setColor(LLColor4(coloru));
- mText->setString(temp_string);
+ setObjectCostStale();
+
+ if (isSelected())
+ {
+ gFloaterTools->dirty();
+ }
+
+ dp->unpackU32(crc, "CRC");
+ mTotalCRC = crc;
+ dp->unpackU8(material, "Material");
+ U8 old_material = getMaterial();
+ if (old_material != material)
+ {
+ setMaterial(material);
+ if (mDrawable.notNull())
+ {
+ gPipeline.markMoved(mDrawable, FALSE); // undamped
+ }
+ }
+ dp->unpackU8(click_action, "ClickAction");
+ setClickAction(click_action);
+ dp->unpackVector3(new_scale, "Scale");
+ dp->unpackVector3(new_pos_parent, "Pos");
+ LLVector3 vec;
+ dp->unpackVector3(vec, "Rot");
+ new_rot.unpackFromVector3(vec);
+ setAcceleration(LLVector3::zero);
+
+ U32 value;
+ dp->unpackU32(value, "SpecialCode");
+ dp->setPassFlags(value);
+ dp->unpackUUID(owner_id, "Owner");
+
+ mOwnerID = owner_id;
+
+ if (value & 0x80)
+ {
+ dp->unpackVector3(new_angv, "Omega");
+ setAngularVelocity(new_angv);
+ }
+
+ if (value & 0x20)
+ {
+ dp->unpackU32(parent_id, "ParentID");
+ }
+ else
+ {
+ parent_id = 0;
+ }
+
+ S32 sp_size;
+ U32 size;
+ if (value & 0x2)
+ {
+ sp_size = 1;
+ delete [] mData;
+ mData = new U8[1];
+ dp->unpackU8(((U8*)mData)[0], "TreeData");
+ }
+ else if (value & 0x1)
+ {
+ dp->unpackU32(size, "ScratchPadSize");
+ delete [] mData;
+ mData = new U8[size];
+ dp->unpackBinaryData((U8 *)mData, sp_size, "PartData");
+ }
+ else
+ {
+ mData = NULL;
+ }
+
+ // Setup object text
+ if (!mText && (value & 0x4))
+ {
+ initHudText();
+ }
+
+ if (value & 0x4)
+ {
+ std::string temp_string;
+ dp->unpackString(temp_string, "Text");
+ LLColor4U coloru;
+ dp->unpackBinaryDataFixed(coloru.mV, 4, "Color");
+ coloru.mV[3] = 255 - coloru.mV[3];
+ mText->setColor(LLColor4(coloru));
+ mText->setString(temp_string);
mHudText = temp_string;
mHudTextColor = LLColor4(coloru);
- setChanged(TEXTURE);
- }
- else
- {
- if (mText.notNull())
- {
- mText->markDead();
- mText = NULL;
- }
- mHudText.clear();
- }
+ setChanged(TEXTURE);
+ }
+ else
+ {
+ if (mText.notNull())
+ {
+ mText->markDead();
+ mText = NULL;
+ }
+ mHudText.clear();
+ }
std::string media_url;
- if (value & 0x200)
- {
- dp->unpackString(media_url, "MediaURL");
- }
+ if (value & 0x200)
+ {
+ dp->unpackString(media_url, "MediaURL");
+ }
retval |= checkMediaURL(media_url);
- //
- // Unpack particle system data (legacy)
- //
- if (value & 0x8)
- {
- unpackParticleSource(*dp, owner_id, true);
- }
- else if (!(value & 0x400))
- {
- deleteParticleSource();
- }
-
- // Mark all extra parameters not used
- std::unordered_map<U16, ExtraParameter*>::iterator iter;
- for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
- {
- iter->second->in_use = FALSE;
- }
-
- // Unpack extra params
- U8 num_parameters;
- dp->unpackU8(num_parameters, "num_params");
- U8 param_block[MAX_OBJECT_PARAMS_SIZE];
- for (U8 param=0; param<num_parameters; ++param)
- {
- U16 param_type;
- S32 param_size;
- dp->unpackU16(param_type, "param_type");
- dp->unpackBinaryData(param_block, param_size, "param_data");
- //LL_INFOS() << "Param type: " << param_type << ", Size: " << param_size << LL_ENDL;
- LLDataPackerBinaryBuffer dp2(param_block, param_size);
- unpackParameterEntry(param_type, &dp2);
- }
-
- for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
- {
- if (!iter->second->in_use)
- {
- // Send an update message in case it was formerly in use
- parameterChanged(iter->first, iter->second->data, FALSE, false);
- }
- }
-
- if (value & 0x10)
- {
- dp->unpackUUID(sound_uuid, "SoundUUID");
- dp->unpackF32(gain, "SoundGain");
- dp->unpackU8(sound_flags, "SoundFlags");
- dp->unpackF32(cutoff, "SoundRadius");
- }
-
- if (value & 0x100)
- {
- std::string name_value_list;
- dp->unpackString(name_value_list, "NV");
-
- setNameValueList(name_value_list);
- }
-
- mTotalCRC = crc;
- mSoundCutOffRadius = cutoff;
-
- setAttachedSound(sound_uuid, owner_id, gain, sound_flags);
-
- // only get these flags on updates from sim, not cached ones
- // Preload these five flags for every object.
- // Finer shades require the object to be selected, and the selection manager
- // stores the extended permission info.
- if(mesgsys != NULL)
- {
- U32 flags;
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, block_num);
- loadFlags(flags);
- }
- }
- break;
-
- default:
- break;
- }
- }
-
- //
- // Fix object parenting.
- //
- BOOL b_changed_status = FALSE;
-
- if (OUT_TERSE_IMPROVED != update_type)
- {
- // We only need to update parenting on full updates, terse updates
- // don't send parenting information.
- if (!cur_parentp)
- {
- if (parent_id == 0)
- {
- // No parent now, no parent in message -> do nothing
- }
- else
- {
- // No parent now, new parent in message -> attach to that parent if possible
- LLUUID parent_uuid;
-
- if(mesgsys != NULL)
- {
- LLViewerObjectList::getUUIDFromLocal(parent_uuid,
- parent_id,
- mesgsys->getSenderIP(),
- mesgsys->getSenderPort());
- }
- else
- {
- LLViewerObjectList::getUUIDFromLocal(parent_uuid,
- parent_id,
- mRegionp->getHost().getAddress(),
- mRegionp->getHost().getPort());
- }
-
- LLViewerObject *sent_parentp = gObjectList.findObject(parent_uuid);
-
- //
- // Check to see if we have the corresponding viewer object for the parent.
- //
- if (sent_parentp && sent_parentp->getParent() == this)
- {
- // Try to recover if we attempt to attach a parent to its child
- LL_WARNS() << "Attempt to attach a parent to it's child: " << this->getID() << " to " << sent_parentp->getID() << LL_ENDL;
- this->removeChild(sent_parentp);
- sent_parentp->setDrawableParent(NULL);
- }
-
- if (sent_parentp && (sent_parentp != this) && !sent_parentp->isDead())
- {
+ //
+ // Unpack particle system data (legacy)
+ //
+ if (value & 0x8)
+ {
+ unpackParticleSource(*dp, owner_id, true);
+ }
+ else if (!(value & 0x400))
+ {
+ deleteParticleSource();
+ }
+
+ // Mark all extra parameters not used
+ std::unordered_map<U16, ExtraParameter*>::iterator iter;
+ for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
+ {
+ iter->second->in_use = FALSE;
+ }
+
+ // Unpack extra params
+ U8 num_parameters;
+ dp->unpackU8(num_parameters, "num_params");
+ U8 param_block[MAX_OBJECT_PARAMS_SIZE];
+ for (U8 param=0; param<num_parameters; ++param)
+ {
+ U16 param_type;
+ S32 param_size;
+ dp->unpackU16(param_type, "param_type");
+ dp->unpackBinaryData(param_block, param_size, "param_data");
+ //LL_INFOS() << "Param type: " << param_type << ", Size: " << param_size << LL_ENDL;
+ LLDataPackerBinaryBuffer dp2(param_block, param_size);
+ unpackParameterEntry(param_type, &dp2);
+ }
+
+ for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter)
+ {
+ if (!iter->second->in_use)
+ {
+ // Send an update message in case it was formerly in use
+ parameterChanged(iter->first, iter->second->data, FALSE, false);
+ }
+ }
+
+ if (value & 0x10)
+ {
+ dp->unpackUUID(sound_uuid, "SoundUUID");
+ dp->unpackF32(gain, "SoundGain");
+ dp->unpackU8(sound_flags, "SoundFlags");
+ dp->unpackF32(cutoff, "SoundRadius");
+ }
+
+ if (value & 0x100)
+ {
+ std::string name_value_list;
+ dp->unpackString(name_value_list, "NV");
+
+ setNameValueList(name_value_list);
+ }
+
+ mTotalCRC = crc;
+ mSoundCutOffRadius = cutoff;
+
+ setAttachedSound(sound_uuid, owner_id, gain, sound_flags);
+
+ // only get these flags on updates from sim, not cached ones
+ // Preload these five flags for every object.
+ // Finer shades require the object to be selected, and the selection manager
+ // stores the extended permission info.
+ if(mesgsys != NULL)
+ {
+ U32 flags;
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, block_num);
+ loadFlags(flags);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ //
+ // Fix object parenting.
+ //
+ BOOL b_changed_status = FALSE;
+
+ if (OUT_TERSE_IMPROVED != update_type)
+ {
+ // We only need to update parenting on full updates, terse updates
+ // don't send parenting information.
+ if (!cur_parentp)
+ {
+ if (parent_id == 0)
+ {
+ // No parent now, no parent in message -> do nothing
+ }
+ else
+ {
+ // No parent now, new parent in message -> attach to that parent if possible
+ LLUUID parent_uuid;
+
+ if(mesgsys != NULL)
+ {
+ LLViewerObjectList::getUUIDFromLocal(parent_uuid,
+ parent_id,
+ mesgsys->getSenderIP(),
+ mesgsys->getSenderPort());
+ }
+ else
+ {
+ LLViewerObjectList::getUUIDFromLocal(parent_uuid,
+ parent_id,
+ mRegionp->getHost().getAddress(),
+ mRegionp->getHost().getPort());
+ }
+
+ LLViewerObject *sent_parentp = gObjectList.findObject(parent_uuid);
+
+ //
+ // Check to see if we have the corresponding viewer object for the parent.
+ //
+ if (sent_parentp && sent_parentp->getParent() == this)
+ {
+ // Try to recover if we attempt to attach a parent to its child
+ LL_WARNS() << "Attempt to attach a parent to it's child: " << this->getID() << " to " << sent_parentp->getID() << LL_ENDL;
+ this->removeChild(sent_parentp);
+ sent_parentp->setDrawableParent(NULL);
+ }
+
+ if (sent_parentp && (sent_parentp != this) && !sent_parentp->isDead())
+ {
if (((LLViewerObject*)sent_parentp)->isAvatar())
{
- //LL_DEBUGS("Avatar") << "ATT got object update for attachment " << LL_ENDL;
+ //LL_DEBUGS("Avatar") << "ATT got object update for attachment " << LL_ENDL;
+ }
+
+ //
+ // We have a viewer object for the parent, and it's not dead.
+ // Do the actual reparenting here.
+ //
+
+ // new parent is valid
+ b_changed_status = TRUE;
+ // ...no current parent, so don't try to remove child
+ if (mDrawable.notNull())
+ {
+ if (mDrawable->isDead() || !mDrawable->getVObj())
+ {
+ LL_WARNS() << "Drawable is dead or no VObj!" << LL_ENDL;
+ sent_parentp->addChild(this);
+ }
+ else
+ {
+ if (!setDrawableParent(sent_parentp->mDrawable)) // LLViewerObject::processUpdateMessage 1
+ {
+ // Bad, we got a cycle somehow.
+ // Kill both the parent and the child, and
+ // set cache misses for both of them.
+ LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL;
+ LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL;
+ LL_WARNS() << "Adding to cache miss list" << LL_ENDL;
+ setParent(NULL);
+ sent_parentp->setParent(NULL);
+ getRegion()->addCacheMissFull(getLocalID());
+ getRegion()->addCacheMissFull(sent_parentp->getLocalID());
+ gObjectList.killObject(sent_parentp);
+ gObjectList.killObject(this);
+ return retval;
+ }
+ sent_parentp->addChild(this);
+ // make sure this object gets a non-damped update
+ if (sent_parentp->mDrawable.notNull())
+ {
+ gPipeline.markMoved(sent_parentp->mDrawable, FALSE); // undamped
+ }
+ }
+ }
+ else
+ {
+ sent_parentp->addChild(this);
}
-
- //
- // We have a viewer object for the parent, and it's not dead.
- // Do the actual reparenting here.
- //
-
- // new parent is valid
- b_changed_status = TRUE;
- // ...no current parent, so don't try to remove child
- if (mDrawable.notNull())
- {
- if (mDrawable->isDead() || !mDrawable->getVObj())
- {
- LL_WARNS() << "Drawable is dead or no VObj!" << LL_ENDL;
- sent_parentp->addChild(this);
- }
- else
- {
- if (!setDrawableParent(sent_parentp->mDrawable)) // LLViewerObject::processUpdateMessage 1
- {
- // Bad, we got a cycle somehow.
- // Kill both the parent and the child, and
- // set cache misses for both of them.
- LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL;
- LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL;
- LL_WARNS() << "Adding to cache miss list" << LL_ENDL;
- setParent(NULL);
- sent_parentp->setParent(NULL);
- getRegion()->addCacheMissFull(getLocalID());
- getRegion()->addCacheMissFull(sent_parentp->getLocalID());
- gObjectList.killObject(sent_parentp);
- gObjectList.killObject(this);
- return retval;
- }
- sent_parentp->addChild(this);
- // make sure this object gets a non-damped update
- if (sent_parentp->mDrawable.notNull())
- {
- gPipeline.markMoved(sent_parentp->mDrawable, FALSE); // undamped
- }
- }
- }
- else
- {
- sent_parentp->addChild(this);
- }
-
- // Show particles, icon and HUD
- hideExtraDisplayItems( FALSE );
-
- setChanged(MOVED | SILHOUETTE);
- }
- else
- {
- //
- // No corresponding viewer object for the parent, put the various
- // pieces on the orphan list.
- //
-
- //parent_id
- U32 ip, port;
-
- if(mesgsys != NULL)
- {
- ip = mesgsys->getSenderIP();
- port = mesgsys->getSenderPort();
- }
- else
- {
- ip = mRegionp->getHost().getAddress();
- port = mRegionp->getHost().getPort();
- }
- gObjectList.orphanize(this, parent_id, ip, port);
-
- // Hide particles, icon and HUD
- hideExtraDisplayItems( TRUE );
- }
- }
- }
- else
- {
- // BUG: this is a bad assumption once border crossing is alowed
- if ( (parent_id == cur_parentp->mLocalID)
- &&(update_type == OUT_TERSE_IMPROVED))
- {
- // Parent now, same parent in message -> do nothing
-
- // Debugging for suspected problems with local ids.
- //LLUUID parent_uuid;
- //LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort() );
- //if (parent_uuid != cur_parentp->getID() )
- //{
- // LL_ERRS() << "Local ID match but UUID mismatch of viewer object" << LL_ENDL;
- //}
- }
- else
- {
- // Parented now, different parent in message
- LLViewerObject *sent_parentp;
- if (parent_id == 0)
- {
- //
- // This object is no longer parented, we sent in a zero parent ID.
- //
- sent_parentp = NULL;
- }
- else
- {
- LLUUID parent_uuid;
-
- if(mesgsys != NULL)
- {
- LLViewerObjectList::getUUIDFromLocal(parent_uuid,
- parent_id,
- gMessageSystem->getSenderIP(),
- gMessageSystem->getSenderPort());
- }
- else
- {
- LLViewerObjectList::getUUIDFromLocal(parent_uuid,
- parent_id,
- mRegionp->getHost().getAddress(),
- mRegionp->getHost().getPort());
- }
- sent_parentp = gObjectList.findObject(parent_uuid);
-
- if (isAvatar())
- {
- // This logic is meant to handle the case where a sitting avatar has reached a new sim
- // ahead of the object she was sitting on (which is common as objects are transfered through
- // a slower route than agents)...
- // In this case, the local id for the object will not be valid, since the viewer has not received
- // a full update for the object from that sim yet, so we assume that the agent is still sitting
- // where she was originally. --RN
- if (!sent_parentp)
- {
- sent_parentp = cur_parentp;
- }
- }
- else if (!sent_parentp)
- {
- //
- // Switching parents, but we don't know the new parent.
- //
- U32 ip, port;
-
- if(mesgsys != NULL)
- {
- ip = mesgsys->getSenderIP();
- port = mesgsys->getSenderPort();
- }
- else
- {
- ip = mRegionp->getHost().getAddress();
- port = mRegionp->getHost().getPort();
- }
-
- // We're an orphan, flag things appropriately.
- gObjectList.orphanize(this, parent_id, ip, port);
- }
- }
-
- // Reattach if possible.
- if (sent_parentp && sent_parentp != cur_parentp && sent_parentp != this)
- {
- // New parent is valid, detach and reattach
- b_changed_status = TRUE;
- if (mDrawable.notNull())
- {
- if (!setDrawableParent(sent_parentp->mDrawable)) // LLViewerObject::processUpdateMessage 2
- {
- // Bad, we got a cycle somehow.
- // Kill both the parent and the child, and
- // set cache misses for both of them.
- LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL;
- LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL;
- LL_WARNS() << "Adding to cache miss list" << LL_ENDL;
- setParent(NULL);
- sent_parentp->setParent(NULL);
- getRegion()->addCacheMissFull(getLocalID());
- getRegion()->addCacheMissFull(sent_parentp->getLocalID());
- gObjectList.killObject(sent_parentp);
- gObjectList.killObject(this);
- return retval;
- }
- // make sure this object gets a non-damped update
- }
- cur_parentp->removeChild(this);
- sent_parentp->addChild(this);
- setChanged(MOVED | SILHOUETTE);
- sent_parentp->setChanged(MOVED | SILHOUETTE);
- if (sent_parentp->mDrawable.notNull())
- {
- gPipeline.markMoved(sent_parentp->mDrawable, FALSE); // undamped
- }
- }
- else if (!sent_parentp)
- {
- bool remove_parent = true;
- // No new parent, or the parent that we sent doesn't exist on the viewer.
- LLViewerObject *parentp = (LLViewerObject *)getParent();
- if (parentp)
- {
- if (parentp->getRegion() != getRegion())
- {
- // This is probably an object flying across a region boundary, the
- // object probably ISN'T being reparented, but just got an object
- // update out of order (child update before parent).
- //LL_INFOS() << "Don't reparent object handoffs!" << LL_ENDL;
- remove_parent = false;
- }
- }
-
- if (remove_parent)
- {
- b_changed_status = TRUE;
- if (mDrawable.notNull())
- {
- // clear parent to removeChild can put the drawable on the damped list
- setDrawableParent(NULL); // LLViewerObject::processUpdateMessage 3
- }
-
- cur_parentp->removeChild(this);
-
- setChanged(MOVED | SILHOUETTE);
-
- if (mDrawable.notNull())
- {
- // make sure this object gets a non-damped update
- gPipeline.markMoved(mDrawable, FALSE); // undamped
- }
- }
- }
- }
- }
- }
-
- new_rot.normQuat();
-
- if (sPingInterpolate && mesgsys != NULL)
- {
- LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mesgsys->getSender());
- if (cdp)
- {
- // Note: delay is U32 and usually less then second,
- // converting it into seconds with valueInUnits will result in 0
- F32 ping_delay = 0.5f * time_dilation * ( ((F32)cdp->getPingDelay().value()) * 0.001f + gFrameDTClamped);
- LLVector3 diff = getVelocity() * ping_delay;
- new_pos_parent += diff;
- }
- else
- {
- LL_WARNS() << "findCircuit() returned NULL; skipping interpolation" << LL_ENDL;
- }
- }
-
- //////////////////////////
- //
- // Set the generic change flags...
- //
- //
-
- // If we're going to skip this message, why are we
- // doing all the parenting, etc above?
- if(mesgsys != NULL)
- {
- U32 packet_id = mesgsys->getCurrentRecvPacketID();
- if (packet_id < mLatestRecvPacketID &&
- mLatestRecvPacketID - packet_id < 65536)
- {
- //skip application of this message, it's old
- return retval;
- }
- mLatestRecvPacketID = packet_id;
- }
-
- // Set the change flags for scale
- if (new_scale != getScale())
- {
- setChanged(SCALED | SILHOUETTE);
- setScale(new_scale); // Must follow setting permYouOwner()
- }
-
- // first, let's see if the new position is actually a change
-
- //static S32 counter = 0;
-
- F32 vel_mag_sq = getVelocity().magVecSquared();
- F32 accel_mag_sq = getAcceleration().magVecSquared();
-
- if ( ((b_changed_status)||(test_pos_parent != new_pos_parent))
- ||( (!isSelected())
- &&( (vel_mag_sq != 0.f)
- ||(accel_mag_sq != 0.f)
- ||(this_update_precision > mBestUpdatePrecision))))
- {
- mBestUpdatePrecision = this_update_precision;
-
- LLVector3 diff = new_pos_parent - test_pos_parent ;
- F32 mag_sqr = diff.magVecSquared() ;
- if(llfinite(mag_sqr))
- {
- setPositionParent(new_pos_parent);
- }
- else
- {
- LL_WARNS() << "Can not move the object/avatar to an infinite location!" << LL_ENDL ;
-
- retval |= INVALID_UPDATE ;
- }
-
- if (mParent && ((LLViewerObject*)mParent)->isAvatar())
- {
- // we have changed the position of an attachment, so we need to clamp it
- LLVOAvatar *avatar = (LLVOAvatar*)mParent;
-
- avatar->clampAttachmentPositions();
- }
-
- // If we're snapping the position by more than 0.5m, update LLViewerStats::mAgentPositionSnaps
- if ( asAvatar() && asAvatar()->isSelf() && (mag_sqr > 0.25f) )
- {
- record(LLStatViewer::AGENT_POSITION_SNAP, LLUnit<F64, LLUnits::Meters>(diff.length()));
- }
- }
-
- if ((new_rot.isNotEqualEps(getRotation(), F_ALMOST_ZERO))
- || (new_angv != old_angv))
- {
- if (new_rot != mPreviousRotation)
- {
- resetRot();
- }
- else if (new_angv != old_angv)
- {
- if (flagUsePhysics())
- {
- resetRot();
- }
- else
- {
- resetRotTime();
- }
- }
-
- // Remember the last rotation value
- mPreviousRotation = new_rot;
-
- // Set the rotation of the object followed by adjusting for the accumulated angular velocity (llSetTargetOmega)
- setRotation(new_rot * mAngularVelocityRot);
- setChanged(ROTATED | SILHOUETTE);
- }
-
- if ( gShowObjectUpdates )
- {
- LLColor4 color;
- if (update_type == OUT_TERSE_IMPROVED)
- {
- color.setVec(0.f, 0.f, 1.f, 1.f);
- }
- else
- {
- color.setVec(1.f, 0.f, 0.f, 1.f);
- }
- gPipeline.addDebugBlip(getPositionAgent(), color);
- LL_DEBUGS("MessageBlip") << "Update type " << (S32)update_type << " blip for local " << mLocalID << " at " << getPositionAgent() << LL_ENDL;
- }
-
- const F32 MAG_CUTOFF = F_APPROXIMATELY_ZERO;
-
- llassert(vel_mag_sq >= 0.f);
- llassert(accel_mag_sq >= 0.f);
- llassert(getAngularVelocity().magVecSquared() >= 0.f);
-
- if ((MAG_CUTOFF >= vel_mag_sq) &&
- (MAG_CUTOFF >= accel_mag_sq) &&
- (MAG_CUTOFF >= getAngularVelocity().magVecSquared()))
- {
- mStatic = TRUE; // This object doesn't move!
- }
- else
- {
- mStatic = FALSE;
- }
+
+ // Show particles, icon and HUD
+ hideExtraDisplayItems( FALSE );
+
+ setChanged(MOVED | SILHOUETTE);
+ }
+ else
+ {
+ //
+ // No corresponding viewer object for the parent, put the various
+ // pieces on the orphan list.
+ //
+
+ //parent_id
+ U32 ip, port;
+
+ if(mesgsys != NULL)
+ {
+ ip = mesgsys->getSenderIP();
+ port = mesgsys->getSenderPort();
+ }
+ else
+ {
+ ip = mRegionp->getHost().getAddress();
+ port = mRegionp->getHost().getPort();
+ }
+ gObjectList.orphanize(this, parent_id, ip, port);
+
+ // Hide particles, icon and HUD
+ hideExtraDisplayItems( TRUE );
+ }
+ }
+ }
+ else
+ {
+ // BUG: this is a bad assumption once border crossing is alowed
+ if ( (parent_id == cur_parentp->mLocalID)
+ &&(update_type == OUT_TERSE_IMPROVED))
+ {
+ // Parent now, same parent in message -> do nothing
+
+ // Debugging for suspected problems with local ids.
+ //LLUUID parent_uuid;
+ //LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort() );
+ //if (parent_uuid != cur_parentp->getID() )
+ //{
+ // LL_ERRS() << "Local ID match but UUID mismatch of viewer object" << LL_ENDL;
+ //}
+ }
+ else
+ {
+ // Parented now, different parent in message
+ LLViewerObject *sent_parentp;
+ if (parent_id == 0)
+ {
+ //
+ // This object is no longer parented, we sent in a zero parent ID.
+ //
+ sent_parentp = NULL;
+ }
+ else
+ {
+ LLUUID parent_uuid;
+
+ if(mesgsys != NULL)
+ {
+ LLViewerObjectList::getUUIDFromLocal(parent_uuid,
+ parent_id,
+ gMessageSystem->getSenderIP(),
+ gMessageSystem->getSenderPort());
+ }
+ else
+ {
+ LLViewerObjectList::getUUIDFromLocal(parent_uuid,
+ parent_id,
+ mRegionp->getHost().getAddress(),
+ mRegionp->getHost().getPort());
+ }
+ sent_parentp = gObjectList.findObject(parent_uuid);
+
+ if (isAvatar())
+ {
+ // This logic is meant to handle the case where a sitting avatar has reached a new sim
+ // ahead of the object she was sitting on (which is common as objects are transfered through
+ // a slower route than agents)...
+ // In this case, the local id for the object will not be valid, since the viewer has not received
+ // a full update for the object from that sim yet, so we assume that the agent is still sitting
+ // where she was originally. --RN
+ if (!sent_parentp)
+ {
+ sent_parentp = cur_parentp;
+ }
+ }
+ else if (!sent_parentp)
+ {
+ //
+ // Switching parents, but we don't know the new parent.
+ //
+ U32 ip, port;
+
+ if(mesgsys != NULL)
+ {
+ ip = mesgsys->getSenderIP();
+ port = mesgsys->getSenderPort();
+ }
+ else
+ {
+ ip = mRegionp->getHost().getAddress();
+ port = mRegionp->getHost().getPort();
+ }
+
+ // We're an orphan, flag things appropriately.
+ gObjectList.orphanize(this, parent_id, ip, port);
+ }
+ }
+
+ // Reattach if possible.
+ if (sent_parentp && sent_parentp != cur_parentp && sent_parentp != this)
+ {
+ // New parent is valid, detach and reattach
+ b_changed_status = TRUE;
+ if (mDrawable.notNull())
+ {
+ if (!setDrawableParent(sent_parentp->mDrawable)) // LLViewerObject::processUpdateMessage 2
+ {
+ // Bad, we got a cycle somehow.
+ // Kill both the parent and the child, and
+ // set cache misses for both of them.
+ LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL;
+ LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL;
+ LL_WARNS() << "Adding to cache miss list" << LL_ENDL;
+ setParent(NULL);
+ sent_parentp->setParent(NULL);
+ getRegion()->addCacheMissFull(getLocalID());
+ getRegion()->addCacheMissFull(sent_parentp->getLocalID());
+ gObjectList.killObject(sent_parentp);
+ gObjectList.killObject(this);
+ return retval;
+ }
+ // make sure this object gets a non-damped update
+ }
+ cur_parentp->removeChild(this);
+ sent_parentp->addChild(this);
+ setChanged(MOVED | SILHOUETTE);
+ sent_parentp->setChanged(MOVED | SILHOUETTE);
+ if (sent_parentp->mDrawable.notNull())
+ {
+ gPipeline.markMoved(sent_parentp->mDrawable, FALSE); // undamped
+ }
+ }
+ else if (!sent_parentp)
+ {
+ bool remove_parent = true;
+ // No new parent, or the parent that we sent doesn't exist on the viewer.
+ LLViewerObject *parentp = (LLViewerObject *)getParent();
+ if (parentp)
+ {
+ if (parentp->getRegion() != getRegion())
+ {
+ // This is probably an object flying across a region boundary, the
+ // object probably ISN'T being reparented, but just got an object
+ // update out of order (child update before parent).
+ //LL_INFOS() << "Don't reparent object handoffs!" << LL_ENDL;
+ remove_parent = false;
+ }
+ }
+
+ if (remove_parent)
+ {
+ b_changed_status = TRUE;
+ if (mDrawable.notNull())
+ {
+ // clear parent to removeChild can put the drawable on the damped list
+ setDrawableParent(NULL); // LLViewerObject::processUpdateMessage 3
+ }
+
+ cur_parentp->removeChild(this);
+
+ setChanged(MOVED | SILHOUETTE);
+
+ if (mDrawable.notNull())
+ {
+ // make sure this object gets a non-damped update
+ gPipeline.markMoved(mDrawable, FALSE); // undamped
+ }
+ }
+ }
+ }
+ }
+ }
+
+ new_rot.normQuat();
+
+ if (sPingInterpolate && mesgsys != NULL)
+ {
+ LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mesgsys->getSender());
+ if (cdp)
+ {
+ // Note: delay is U32 and usually less then second,
+ // converting it into seconds with valueInUnits will result in 0
+ F32 ping_delay = 0.5f * time_dilation * ( ((F32)cdp->getPingDelay().value()) * 0.001f + gFrameDTClamped);
+ LLVector3 diff = getVelocity() * ping_delay;
+ new_pos_parent += diff;
+ }
+ else
+ {
+ LL_WARNS() << "findCircuit() returned NULL; skipping interpolation" << LL_ENDL;
+ }
+ }
+
+ //////////////////////////
+ //
+ // Set the generic change flags...
+ //
+ //
+
+ // If we're going to skip this message, why are we
+ // doing all the parenting, etc above?
+ if(mesgsys != NULL)
+ {
+ U32 packet_id = mesgsys->getCurrentRecvPacketID();
+ if (packet_id < mLatestRecvPacketID &&
+ mLatestRecvPacketID - packet_id < 65536)
+ {
+ //skip application of this message, it's old
+ return retval;
+ }
+ mLatestRecvPacketID = packet_id;
+ }
+
+ // Set the change flags for scale
+ if (new_scale != getScale())
+ {
+ setChanged(SCALED | SILHOUETTE);
+ setScale(new_scale); // Must follow setting permYouOwner()
+ }
+
+ // first, let's see if the new position is actually a change
+
+ //static S32 counter = 0;
+
+ F32 vel_mag_sq = getVelocity().magVecSquared();
+ F32 accel_mag_sq = getAcceleration().magVecSquared();
+
+ if ( ((b_changed_status)||(test_pos_parent != new_pos_parent))
+ ||( (!isSelected())
+ &&( (vel_mag_sq != 0.f)
+ ||(accel_mag_sq != 0.f)
+ ||(this_update_precision > mBestUpdatePrecision))))
+ {
+ mBestUpdatePrecision = this_update_precision;
+
+ LLVector3 diff = new_pos_parent - test_pos_parent ;
+ F32 mag_sqr = diff.magVecSquared() ;
+ if(llfinite(mag_sqr))
+ {
+ setPositionParent(new_pos_parent);
+ }
+ else
+ {
+ LL_WARNS() << "Can not move the object/avatar to an infinite location!" << LL_ENDL ;
+
+ retval |= INVALID_UPDATE ;
+ }
+
+ if (mParent && ((LLViewerObject*)mParent)->isAvatar())
+ {
+ // we have changed the position of an attachment, so we need to clamp it
+ LLVOAvatar *avatar = (LLVOAvatar*)mParent;
+
+ avatar->clampAttachmentPositions();
+ }
+
+ // If we're snapping the position by more than 0.5m, update LLViewerStats::mAgentPositionSnaps
+ if ( asAvatar() && asAvatar()->isSelf() && (mag_sqr > 0.25f) )
+ {
+ record(LLStatViewer::AGENT_POSITION_SNAP, LLUnit<F64, LLUnits::Meters>(diff.length()));
+ }
+ }
+
+ if ((new_rot.isNotEqualEps(getRotation(), F_ALMOST_ZERO))
+ || (new_angv != old_angv))
+ {
+ if (new_rot != mPreviousRotation)
+ {
+ resetRot();
+ }
+ else if (new_angv != old_angv)
+ {
+ if (flagUsePhysics())
+ {
+ resetRot();
+ }
+ else
+ {
+ resetRotTime();
+ }
+ }
+
+ // Remember the last rotation value
+ mPreviousRotation = new_rot;
+
+ // Set the rotation of the object followed by adjusting for the accumulated angular velocity (llSetTargetOmega)
+ setRotation(new_rot * mAngularVelocityRot);
+ setChanged(ROTATED | SILHOUETTE);
+ }
+
+ if ( gShowObjectUpdates )
+ {
+ LLColor4 color;
+ if (update_type == OUT_TERSE_IMPROVED)
+ {
+ color.setVec(0.f, 0.f, 1.f, 1.f);
+ }
+ else
+ {
+ color.setVec(1.f, 0.f, 0.f, 1.f);
+ }
+ gPipeline.addDebugBlip(getPositionAgent(), color);
+ LL_DEBUGS("MessageBlip") << "Update type " << (S32)update_type << " blip for local " << mLocalID << " at " << getPositionAgent() << LL_ENDL;
+ }
+
+ const F32 MAG_CUTOFF = F_APPROXIMATELY_ZERO;
+
+ llassert(vel_mag_sq >= 0.f);
+ llassert(accel_mag_sq >= 0.f);
+ llassert(getAngularVelocity().magVecSquared() >= 0.f);
+
+ if ((MAG_CUTOFF >= vel_mag_sq) &&
+ (MAG_CUTOFF >= accel_mag_sq) &&
+ (MAG_CUTOFF >= getAngularVelocity().magVecSquared()))
+ {
+ mStatic = TRUE; // This object doesn't move!
+ }
+ else
+ {
+ mStatic = FALSE;
+ }
// BUG: This code leads to problems during group rotate and any scale operation.
-// Small discepencies between the simulator and viewer representations cause the
+// Small discepencies between the simulator and viewer representations cause the
// selection center to creep, leading to objects moving around the wrong center.
-//
+//
// Removing this, however, means that if someone else drags an object you have
// selected, your selection center and dialog boxes will be wrong. It also means
// that higher precision information on selected objects will be ignored.
//
// I believe the group rotation problem is fixed. JNC 1.21.2002
//
- // Additionally, if any child is selected, need to update the dialogs and selection
- // center.
- BOOL needs_refresh = mUserSelected;
- for (child_list_t::iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- needs_refresh = needs_refresh || child->mUserSelected;
- }
+ // Additionally, if any child is selected, need to update the dialogs and selection
+ // center.
+ BOOL needs_refresh = mUserSelected;
+ for (child_list_t::iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ needs_refresh = needs_refresh || child->mUserSelected;
+ }
static LLCachedControl<bool> allow_select_avatar(gSavedSettings, "AllowSelectAvatar", FALSE);
- if (needs_refresh)
- {
- LLSelectMgr::getInstance()->updateSelectionCenter();
- dialog_refresh_all();
- }
+ if (needs_refresh)
+ {
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ dialog_refresh_all();
+ }
else if (allow_select_avatar && asAvatar())
{
// Override any avatar position updates received
@@ -2498,280 +2498,280 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
}
- // Mark update time as approx. now, with the ping delay.
- // Ping delay is off because it's not set for velocity interpolation, causing
- // much jumping and hopping around...
+ // Mark update time as approx. now, with the ping delay.
+ // Ping delay is off because it's not set for velocity interpolation, causing
+ // much jumping and hopping around...
-// U32 ping_delay = mesgsys->mCircuitInfo.getPingDelay();
- mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds();
- mLastMessageUpdateSecs = mLastInterpUpdateSecs;
- if (mDrawable.notNull())
- {
- // Don't clear invisibility flag on update if still orphaned!
- if (mDrawable->isState(LLDrawable::FORCE_INVISIBLE) && !mOrphaned)
- {
-// LL_DEBUGS() << "Clearing force invisible: " << mID << ":" << getPCodeString() << ":" << getPositionAgent() << LL_ENDL;
- mDrawable->clearState(LLDrawable::FORCE_INVISIBLE);
- gPipeline.markRebuild( mDrawable, LLDrawable::REBUILD_ALL);
- }
- }
+// U32 ping_delay = mesgsys->mCircuitInfo.getPingDelay();
+ mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds();
+ mLastMessageUpdateSecs = mLastInterpUpdateSecs;
+ if (mDrawable.notNull())
+ {
+ // Don't clear invisibility flag on update if still orphaned!
+ if (mDrawable->isState(LLDrawable::FORCE_INVISIBLE) && !mOrphaned)
+ {
+// LL_DEBUGS() << "Clearing force invisible: " << mID << ":" << getPCodeString() << ":" << getPositionAgent() << LL_ENDL;
+ mDrawable->clearState(LLDrawable::FORCE_INVISIBLE);
+ gPipeline.markRebuild( mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ }
- // Update special hover cursor status
- bool special_hover_cursor = specialHoverCursor();
- if (old_special_hover_cursor != special_hover_cursor
- && mDrawable.notNull())
- {
- mDrawable->updateSpecialHoverCursor(special_hover_cursor);
- }
+ // Update special hover cursor status
+ bool special_hover_cursor = specialHoverCursor();
+ if (old_special_hover_cursor != special_hover_cursor
+ && mDrawable.notNull())
+ {
+ mDrawable->updateSpecialHoverCursor(special_hover_cursor);
+ }
- return retval;
+ return retval;
}
BOOL LLViewerObject::isActive() const
{
- return TRUE;
+ return TRUE;
}
//load flags from cache or from message
void LLViewerObject::loadFlags(U32 flags)
{
- if(flags == (U32)(-1))
- {
- return; //invalid
- }
+ if(flags == (U32)(-1))
+ {
+ return; //invalid
+ }
- // keep local flags and overwrite remote-controlled flags
- mFlags = (mFlags & FLAGS_LOCAL) | flags;
+ // keep local flags and overwrite remote-controlled flags
+ mFlags = (mFlags & FLAGS_LOCAL) | flags;
- // ...new objects that should come in selected need to be added to the selected list
- mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0);
- return;
+ // ...new objects that should come in selected need to be added to the selected list
+ mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0);
+ return;
}
void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &frame_time)
{
- if (!mDead)
- {
- if (!mStatic && sVelocityInterpolate && !isSelected())
- {
- // calculate dt from last update
- F32 time_dilation = mRegionp ? mRegionp->getTimeDilation() : 1.0f;
- F32 dt_raw = ((F64Seconds)frame_time - mLastInterpUpdateSecs).value();
- F32 dt = time_dilation * dt_raw;
+ if (!mDead)
+ {
+ if (!mStatic && sVelocityInterpolate && !isSelected())
+ {
+ // calculate dt from last update
+ F32 time_dilation = mRegionp ? mRegionp->getTimeDilation() : 1.0f;
+ F32 dt_raw = ((F64Seconds)frame_time - mLastInterpUpdateSecs).value();
+ F32 dt = time_dilation * dt_raw;
- applyAngularVelocity(dt);
+ applyAngularVelocity(dt);
- if (isAttachment())
- {
- mLastInterpUpdateSecs = (F64Seconds)frame_time;
- return;
- }
- else
- { // Move object based on it's velocity and rotation
- interpolateLinearMotion(frame_time, dt);
- }
- }
+ if (isAttachment())
+ {
+ mLastInterpUpdateSecs = (F64Seconds)frame_time;
+ return;
+ }
+ else
+ { // Move object based on it's velocity and rotation
+ interpolateLinearMotion(frame_time, dt);
+ }
+ }
- updateDrawable(FALSE);
- }
+ updateDrawable(FALSE);
+ }
}
// Move an object due to idle-time viewer side updates by interpolating motion
void LLViewerObject::interpolateLinearMotion(const F64SecondsImplicit& frame_time, const F32SecondsImplicit& dt_seconds)
{
- // linear motion
- // PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object
- // updates represents the average velocity of the last timestep, rather than the final velocity.
- // the time dilation above should guarantee that dt is never less than PHYSICS_TIMESTEP, theoretically
- //
- // *TODO: should also wrap linear accel/velocity in check
- // to see if object is selected, instead of explicitly
- // zeroing it out
-
- F32 dt = dt_seconds;
- F64Seconds time_since_last_update = frame_time - mLastMessageUpdateSecs;
- if (time_since_last_update <= (F64Seconds)0.0 || dt <= 0.f)
- {
- return;
- }
-
- LLVector3 accel = getAcceleration();
- LLVector3 vel = getVelocity();
-
- if (sMaxUpdateInterpolationTime <= (F64Seconds)0.0)
- { // Old code path ... unbounded, simple interpolation
- if (!(accel.isExactlyZero() && vel.isExactlyZero()))
- {
- LLVector3 pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt;
-
- // region local
- setPositionRegion(pos + getPositionRegion());
- setVelocity(vel + accel*dt);
-
- // for objects that are spinning but not translating, make sure to flag them as having moved
- setChanged(MOVED | SILHOUETTE);
- }
- }
- else if (!accel.isExactlyZero() || !vel.isExactlyZero()) // object is moving
- { // Object is moving, and hasn't been too long since we got an update from the server
-
- // Calculate predicted position and velocity
- LLVector3 new_pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt;
- LLVector3 new_v = accel * dt;
-
- if (time_since_last_update > sPhaseOutUpdateInterpolationTime &&
- sPhaseOutUpdateInterpolationTime > (F64Seconds)0.0)
- { // Haven't seen a viewer update in a while, check to see if the circuit is still active
- if (mRegionp)
- { // The simulator will NOT send updates if the object continues normally on the path
- // predicted by the velocity and the acceleration (often gravity) sent to the viewer
- // So check to see if the circuit is blocked, which means the sim is likely in a long lag
- LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit( mRegionp->getHost() );
- if (cdp)
- {
- // Find out how many seconds since last packet arrived on the circuit
- F64Seconds time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime();
-
- if (!cdp->isAlive() || // Circuit is dead or blocked
- cdp->isBlocked() || // or doesn't seem to be getting any packets
- (time_since_last_packet > sPhaseOutUpdateInterpolationTime))
- {
- // Start to reduce motion interpolation since we haven't seen a server update in a while
- F64Seconds time_since_last_interpolation = frame_time - mLastInterpUpdateSecs;
- F64 phase_out = 1.0;
- if (time_since_last_update > sMaxUpdateInterpolationTime)
- { // Past the time limit, so stop the object
- phase_out = 0.0;
- //LL_INFOS() << "Motion phase out to zero" << LL_ENDL;
-
- // Kill angular motion as well. Note - not adding this due to paranoia
- // about stopping rotation for llTargetOmega objects and not having it restart
- // setAngularVelocity(LLVector3::zero);
- }
- else if (mLastInterpUpdateSecs - mLastMessageUpdateSecs > sPhaseOutUpdateInterpolationTime)
- { // Last update was already phased out a bit
- phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) /
- (sMaxUpdateInterpolationTime - time_since_last_interpolation);
- //LL_INFOS() << "Continuing motion phase out of " << (F32) phase_out << LL_ENDL;
- }
- else
- { // Phase out from full value
- phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) /
- (sMaxUpdateInterpolationTime - sPhaseOutUpdateInterpolationTime);
- //LL_INFOS() << "Starting motion phase out of " << (F32) phase_out << LL_ENDL;
- }
- phase_out = llclamp(phase_out, 0.0, 1.0);
-
- new_pos = new_pos * ((F32) phase_out);
- new_v = new_v * ((F32) phase_out);
- }
- }
- }
- }
-
- new_pos = new_pos + getPositionRegion();
- new_v = new_v + vel;
-
-
- // Clamp interpolated position to minimum underground and maximum region height
- LLVector3d new_pos_global = mRegionp->getPosGlobalFromRegion(new_pos);
- F32 min_height;
- if (isAvatar())
- { // Make a better guess about AVs not going underground
- min_height = LLWorld::getInstance()->resolveLandHeightGlobal(new_pos_global);
- min_height += (0.5f * getScale().mV[VZ]);
- }
- else
- { // This will put the object underground, but we can't tell if it will stop
- // at ground level or not
- min_height = LLWorld::getInstance()->getMinAllowedZ(this, new_pos_global);
- // Cap maximum height
- new_pos.mV[VZ] = llmin(LLWorld::getInstance()->getRegionMaxHeight(), new_pos.mV[VZ]);
- }
-
- new_pos.mV[VZ] = llmax(min_height, new_pos.mV[VZ]);
-
- // Check to see if it's going off the region
- LLVector3 temp(new_pos.mV[VX], new_pos.mV[VY], 0.f);
- if (temp.clamp(0.f, mRegionp->getWidth()))
- { // Going off this region, so see if we might end up on another region
- LLVector3d old_pos_global = mRegionp->getPosGlobalFromRegion(getPositionRegion());
- new_pos_global = mRegionp->getPosGlobalFromRegion(new_pos); // Re-fetch in case it got clipped above
-
- // Clip the positions to known regions
- LLVector3d clip_pos_global = LLWorld::getInstance()->clipToVisibleRegions(old_pos_global, new_pos_global);
- if (clip_pos_global != new_pos_global)
- {
- // Was clipped, so this means we hit a edge where there is no region to enter
- LLVector3 clip_pos = mRegionp->getPosRegionFromGlobal(clip_pos_global);
- LL_DEBUGS("Interpolate") << "Hit empty region edge, clipped predicted position to "
- << clip_pos
- << " from " << new_pos << LL_ENDL;
- new_pos = clip_pos;
-
- // Stop motion and get server update for bouncing on the edge
- new_v.clear();
- setAcceleration(LLVector3::zero);
- }
- else
- {
- // Check for how long we are crossing.
- // Note: theoretically we can find time from velocity, acceleration and
- // distance from border to new position, but it is not going to work
- // if 'phase_out' activates
- if (mRegionCrossExpire == 0)
- {
- // Workaround: we can't accurately figure out time when we cross border
- // so just write down time 'after the fact', it is far from optimal in
- // case of lags, but for lags sMaxUpdateInterpolationTime will kick in first
- LL_DEBUGS("Interpolate") << "Predicted region crossing, new position " << new_pos << LL_ENDL;
- mRegionCrossExpire = frame_time + sMaxRegionCrossingInterpolationTime;
- }
- else if (frame_time > mRegionCrossExpire)
- {
- // Predicting crossing over 1s, stop motion
- // Stop motion
- LL_DEBUGS("Interpolate") << "Predicting region crossing for too long, stopping at " << new_pos << LL_ENDL;
- new_v.clear();
- setAcceleration(LLVector3::zero);
- mRegionCrossExpire = 0;
- }
- }
- }
- else
- {
- mRegionCrossExpire = 0;
- }
-
- // Set new position and velocity
- setPositionRegion(new_pos);
- setVelocity(new_v);
-
- // for objects that are spinning but not translating, make sure to flag them as having moved
- setChanged(MOVED | SILHOUETTE);
- }
-
- // Update the last time we did anything
- mLastInterpUpdateSecs = frame_time;
+ // linear motion
+ // PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object
+ // updates represents the average velocity of the last timestep, rather than the final velocity.
+ // the time dilation above should guarantee that dt is never less than PHYSICS_TIMESTEP, theoretically
+ //
+ // *TODO: should also wrap linear accel/velocity in check
+ // to see if object is selected, instead of explicitly
+ // zeroing it out
+
+ F32 dt = dt_seconds;
+ F64Seconds time_since_last_update = frame_time - mLastMessageUpdateSecs;
+ if (time_since_last_update <= (F64Seconds)0.0 || dt <= 0.f)
+ {
+ return;
+ }
+
+ LLVector3 accel = getAcceleration();
+ LLVector3 vel = getVelocity();
+
+ if (sMaxUpdateInterpolationTime <= (F64Seconds)0.0)
+ { // Old code path ... unbounded, simple interpolation
+ if (!(accel.isExactlyZero() && vel.isExactlyZero()))
+ {
+ LLVector3 pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt;
+
+ // region local
+ setPositionRegion(pos + getPositionRegion());
+ setVelocity(vel + accel*dt);
+
+ // for objects that are spinning but not translating, make sure to flag them as having moved
+ setChanged(MOVED | SILHOUETTE);
+ }
+ }
+ else if (!accel.isExactlyZero() || !vel.isExactlyZero()) // object is moving
+ { // Object is moving, and hasn't been too long since we got an update from the server
+
+ // Calculate predicted position and velocity
+ LLVector3 new_pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt;
+ LLVector3 new_v = accel * dt;
+
+ if (time_since_last_update > sPhaseOutUpdateInterpolationTime &&
+ sPhaseOutUpdateInterpolationTime > (F64Seconds)0.0)
+ { // Haven't seen a viewer update in a while, check to see if the circuit is still active
+ if (mRegionp)
+ { // The simulator will NOT send updates if the object continues normally on the path
+ // predicted by the velocity and the acceleration (often gravity) sent to the viewer
+ // So check to see if the circuit is blocked, which means the sim is likely in a long lag
+ LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit( mRegionp->getHost() );
+ if (cdp)
+ {
+ // Find out how many seconds since last packet arrived on the circuit
+ F64Seconds time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime();
+
+ if (!cdp->isAlive() || // Circuit is dead or blocked
+ cdp->isBlocked() || // or doesn't seem to be getting any packets
+ (time_since_last_packet > sPhaseOutUpdateInterpolationTime))
+ {
+ // Start to reduce motion interpolation since we haven't seen a server update in a while
+ F64Seconds time_since_last_interpolation = frame_time - mLastInterpUpdateSecs;
+ F64 phase_out = 1.0;
+ if (time_since_last_update > sMaxUpdateInterpolationTime)
+ { // Past the time limit, so stop the object
+ phase_out = 0.0;
+ //LL_INFOS() << "Motion phase out to zero" << LL_ENDL;
+
+ // Kill angular motion as well. Note - not adding this due to paranoia
+ // about stopping rotation for llTargetOmega objects and not having it restart
+ // setAngularVelocity(LLVector3::zero);
+ }
+ else if (mLastInterpUpdateSecs - mLastMessageUpdateSecs > sPhaseOutUpdateInterpolationTime)
+ { // Last update was already phased out a bit
+ phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) /
+ (sMaxUpdateInterpolationTime - time_since_last_interpolation);
+ //LL_INFOS() << "Continuing motion phase out of " << (F32) phase_out << LL_ENDL;
+ }
+ else
+ { // Phase out from full value
+ phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) /
+ (sMaxUpdateInterpolationTime - sPhaseOutUpdateInterpolationTime);
+ //LL_INFOS() << "Starting motion phase out of " << (F32) phase_out << LL_ENDL;
+ }
+ phase_out = llclamp(phase_out, 0.0, 1.0);
+
+ new_pos = new_pos * ((F32) phase_out);
+ new_v = new_v * ((F32) phase_out);
+ }
+ }
+ }
+ }
+
+ new_pos = new_pos + getPositionRegion();
+ new_v = new_v + vel;
+
+
+ // Clamp interpolated position to minimum underground and maximum region height
+ LLVector3d new_pos_global = mRegionp->getPosGlobalFromRegion(new_pos);
+ F32 min_height;
+ if (isAvatar())
+ { // Make a better guess about AVs not going underground
+ min_height = LLWorld::getInstance()->resolveLandHeightGlobal(new_pos_global);
+ min_height += (0.5f * getScale().mV[VZ]);
+ }
+ else
+ { // This will put the object underground, but we can't tell if it will stop
+ // at ground level or not
+ min_height = LLWorld::getInstance()->getMinAllowedZ(this, new_pos_global);
+ // Cap maximum height
+ new_pos.mV[VZ] = llmin(LLWorld::getInstance()->getRegionMaxHeight(), new_pos.mV[VZ]);
+ }
+
+ new_pos.mV[VZ] = llmax(min_height, new_pos.mV[VZ]);
+
+ // Check to see if it's going off the region
+ LLVector3 temp(new_pos.mV[VX], new_pos.mV[VY], 0.f);
+ if (temp.clamp(0.f, mRegionp->getWidth()))
+ { // Going off this region, so see if we might end up on another region
+ LLVector3d old_pos_global = mRegionp->getPosGlobalFromRegion(getPositionRegion());
+ new_pos_global = mRegionp->getPosGlobalFromRegion(new_pos); // Re-fetch in case it got clipped above
+
+ // Clip the positions to known regions
+ LLVector3d clip_pos_global = LLWorld::getInstance()->clipToVisibleRegions(old_pos_global, new_pos_global);
+ if (clip_pos_global != new_pos_global)
+ {
+ // Was clipped, so this means we hit a edge where there is no region to enter
+ LLVector3 clip_pos = mRegionp->getPosRegionFromGlobal(clip_pos_global);
+ LL_DEBUGS("Interpolate") << "Hit empty region edge, clipped predicted position to "
+ << clip_pos
+ << " from " << new_pos << LL_ENDL;
+ new_pos = clip_pos;
+
+ // Stop motion and get server update for bouncing on the edge
+ new_v.clear();
+ setAcceleration(LLVector3::zero);
+ }
+ else
+ {
+ // Check for how long we are crossing.
+ // Note: theoretically we can find time from velocity, acceleration and
+ // distance from border to new position, but it is not going to work
+ // if 'phase_out' activates
+ if (mRegionCrossExpire == 0)
+ {
+ // Workaround: we can't accurately figure out time when we cross border
+ // so just write down time 'after the fact', it is far from optimal in
+ // case of lags, but for lags sMaxUpdateInterpolationTime will kick in first
+ LL_DEBUGS("Interpolate") << "Predicted region crossing, new position " << new_pos << LL_ENDL;
+ mRegionCrossExpire = frame_time + sMaxRegionCrossingInterpolationTime;
+ }
+ else if (frame_time > mRegionCrossExpire)
+ {
+ // Predicting crossing over 1s, stop motion
+ // Stop motion
+ LL_DEBUGS("Interpolate") << "Predicting region crossing for too long, stopping at " << new_pos << LL_ENDL;
+ new_v.clear();
+ setAcceleration(LLVector3::zero);
+ mRegionCrossExpire = 0;
+ }
+ }
+ }
+ else
+ {
+ mRegionCrossExpire = 0;
+ }
+
+ // Set new position and velocity
+ setPositionRegion(new_pos);
+ setVelocity(new_v);
+
+ // for objects that are spinning but not translating, make sure to flag them as having moved
+ setChanged(MOVED | SILHOUETTE);
+ }
+
+ // Update the last time we did anything
+ mLastInterpUpdateSecs = frame_time;
}
BOOL LLViewerObject::setData(const U8 *datap, const U32 data_size)
{
- delete [] mData;
+ delete [] mData;
- if (datap)
- {
- mData = new U8[data_size];
- if (!mData)
- {
- return FALSE;
- }
- memcpy(mData, datap, data_size); /* Flawfinder: ignore */
- }
- return TRUE;
+ if (datap)
+ {
+ mData = new U8[data_size];
+ if (!mData)
+ {
+ return FALSE;
+ }
+ memcpy(mData, datap, data_size); /* Flawfinder: ignore */
+ }
+ return TRUE;
}
// delete an item in the inventory, but don't tell the server. This is
@@ -2779,213 +2779,213 @@ BOOL LLViewerObject::setData(const U8 *datap, const U32 data_size)
// This will only delete the first item with an item_id in the list
void LLViewerObject::deleteInventoryItem(const LLUUID& item_id)
{
- if(mInventory)
- {
- LLInventoryObject::object_list_t::iterator it = mInventory->begin();
- LLInventoryObject::object_list_t::iterator end = mInventory->end();
- for( ; it != end; ++it )
- {
- if((*it)->getUUID() == item_id)
- {
- // This is safe only because we return immediatly.
- mInventory->erase(it); // will deref and delete it
- return;
- }
- }
- doInventoryCallback();
- }
+ if(mInventory)
+ {
+ LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::iterator end = mInventory->end();
+ for( ; it != end; ++it )
+ {
+ if((*it)->getUUID() == item_id)
+ {
+ // This is safe only because we return immediatly.
+ mInventory->erase(it); // will deref and delete it
+ return;
+ }
+ }
+ doInventoryCallback();
+ }
}
void LLViewerObject::doUpdateInventory(
- LLPointer<LLViewerInventoryItem>& item,
- U8 key,
- bool is_new)
-{
- LLViewerInventoryItem* old_item = NULL;
- if(TASK_INVENTORY_ITEM_KEY == key)
- {
- old_item = (LLViewerInventoryItem*)getInventoryObject(item->getUUID());
- }
- else if(TASK_INVENTORY_ASSET_KEY == key)
- {
- old_item = getInventoryItemByAsset(item->getAssetUUID());
- }
- LLUUID item_id;
- LLUUID new_owner;
- LLUUID new_group;
- BOOL group_owned = FALSE;
- if(old_item)
- {
- item_id = old_item->getUUID();
- new_owner = old_item->getPermissions().getOwner();
- new_group = old_item->getPermissions().getGroup();
- group_owned = old_item->getPermissions().isGroupOwned();
- old_item = NULL;
- }
- else
- {
- item_id = item->getUUID();
- }
- if(!is_new && mInventory)
- {
- // Attempt to update the local inventory. If we can get the
- // object perm, we have perfect visibility, so we want the
- // serial number to match. Otherwise, take our best guess and
- // make sure that the serial number does not match.
- deleteInventoryItem(item_id);
- LLPermissions perm(item->getPermissions());
- LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this);
- bool is_atomic = ((S32)LLAssetType::AT_OBJECT == item->getType()) ? false : true;
- if(obj_perm)
- {
- perm.setOwnerAndGroup(LLUUID::null, obj_perm->getOwner(), obj_perm->getGroup(), is_atomic);
- }
- else
- {
- if(group_owned)
- {
- perm.setOwnerAndGroup(LLUUID::null, new_owner, new_group, is_atomic);
- }
- else if(!new_owner.isNull())
- {
- // The object used to be in inventory, so we can
- // assume the owner and group will match what they are
- // there.
- perm.setOwnerAndGroup(LLUUID::null, new_owner, new_group, is_atomic);
- }
- // *FIX: can make an even better guess by using the mPermGroup flags
- else if(permYouOwner())
- {
- // best guess.
- perm.setOwnerAndGroup(LLUUID::null, gAgent.getID(), item->getPermissions().getGroup(), is_atomic);
- --mExpectedInventorySerialNum;
- }
- else
- {
- // dummy it up.
- perm.setOwnerAndGroup(LLUUID::null, LLUUID::null, LLUUID::null, is_atomic);
- --mExpectedInventorySerialNum;
- }
- }
- LLViewerInventoryItem* oldItem = item;
- LLViewerInventoryItem* new_item = new LLViewerInventoryItem(oldItem);
- new_item->setPermissions(perm);
- mInventory->push_front(new_item);
- doInventoryCallback();
- ++mExpectedInventorySerialNum;
- }
- else if (is_new)
- {
- ++mExpectedInventorySerialNum;
- }
+ LLPointer<LLViewerInventoryItem>& item,
+ U8 key,
+ bool is_new)
+{
+ LLViewerInventoryItem* old_item = NULL;
+ if(TASK_INVENTORY_ITEM_KEY == key)
+ {
+ old_item = (LLViewerInventoryItem*)getInventoryObject(item->getUUID());
+ }
+ else if(TASK_INVENTORY_ASSET_KEY == key)
+ {
+ old_item = getInventoryItemByAsset(item->getAssetUUID());
+ }
+ LLUUID item_id;
+ LLUUID new_owner;
+ LLUUID new_group;
+ BOOL group_owned = FALSE;
+ if(old_item)
+ {
+ item_id = old_item->getUUID();
+ new_owner = old_item->getPermissions().getOwner();
+ new_group = old_item->getPermissions().getGroup();
+ group_owned = old_item->getPermissions().isGroupOwned();
+ old_item = NULL;
+ }
+ else
+ {
+ item_id = item->getUUID();
+ }
+ if(!is_new && mInventory)
+ {
+ // Attempt to update the local inventory. If we can get the
+ // object perm, we have perfect visibility, so we want the
+ // serial number to match. Otherwise, take our best guess and
+ // make sure that the serial number does not match.
+ deleteInventoryItem(item_id);
+ LLPermissions perm(item->getPermissions());
+ LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this);
+ bool is_atomic = ((S32)LLAssetType::AT_OBJECT == item->getType()) ? false : true;
+ if(obj_perm)
+ {
+ perm.setOwnerAndGroup(LLUUID::null, obj_perm->getOwner(), obj_perm->getGroup(), is_atomic);
+ }
+ else
+ {
+ if(group_owned)
+ {
+ perm.setOwnerAndGroup(LLUUID::null, new_owner, new_group, is_atomic);
+ }
+ else if(!new_owner.isNull())
+ {
+ // The object used to be in inventory, so we can
+ // assume the owner and group will match what they are
+ // there.
+ perm.setOwnerAndGroup(LLUUID::null, new_owner, new_group, is_atomic);
+ }
+ // *FIX: can make an even better guess by using the mPermGroup flags
+ else if(permYouOwner())
+ {
+ // best guess.
+ perm.setOwnerAndGroup(LLUUID::null, gAgent.getID(), item->getPermissions().getGroup(), is_atomic);
+ --mExpectedInventorySerialNum;
+ }
+ else
+ {
+ // dummy it up.
+ perm.setOwnerAndGroup(LLUUID::null, LLUUID::null, LLUUID::null, is_atomic);
+ --mExpectedInventorySerialNum;
+ }
+ }
+ LLViewerInventoryItem* oldItem = item;
+ LLViewerInventoryItem* new_item = new LLViewerInventoryItem(oldItem);
+ new_item->setPermissions(perm);
+ mInventory->push_front(new_item);
+ doInventoryCallback();
+ ++mExpectedInventorySerialNum;
+ }
+ else if (is_new)
+ {
+ ++mExpectedInventorySerialNum;
+ }
}
// save a script, which involves removing the old one, and rezzing
// in the new one. This method should be called with the asset id
// of the new and old script AFTER the bytecode has been saved.
void LLViewerObject::saveScript(
- const LLViewerInventoryItem* item,
- BOOL active,
- bool is_new)
-{
- /*
- * XXXPAM Investigate not making this copy. Seems unecessary, but I'm unsure about the
- * interaction with doUpdateInventory() called below.
- */
- LL_DEBUGS() << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << LL_ENDL;
-
- LLPointer<LLViewerInventoryItem> task_item =
- new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(),
- item->getAssetUUID(), item->getType(),
- item->getInventoryType(),
- item->getName(), item->getDescription(),
- item->getSaleInfo(), item->getFlags(),
- item->getCreationDate());
- task_item->setTransactionID(item->getTransactionID());
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RezScript);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
- msg->nextBlockFast(_PREHASH_UpdateBlock);
- msg->addU32Fast(_PREHASH_ObjectLocalID, (mLocalID));
- U8 enabled = active;
- msg->addBOOLFast(_PREHASH_Enabled, enabled);
- msg->nextBlockFast(_PREHASH_InventoryBlock);
- task_item->packMessage(msg);
- msg->sendReliable(mRegionp->getHost());
-
- // do the internal logic
- doUpdateInventory(task_item, TASK_INVENTORY_ITEM_KEY, is_new);
+ const LLViewerInventoryItem* item,
+ BOOL active,
+ bool is_new)
+{
+ /*
+ * XXXPAM Investigate not making this copy. Seems unecessary, but I'm unsure about the
+ * interaction with doUpdateInventory() called below.
+ */
+ LL_DEBUGS() << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << LL_ENDL;
+
+ LLPointer<LLViewerInventoryItem> task_item =
+ new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(),
+ item->getAssetUUID(), item->getType(),
+ item->getInventoryType(),
+ item->getName(), item->getDescription(),
+ item->getSaleInfo(), item->getFlags(),
+ item->getCreationDate());
+ task_item->setTransactionID(item->getTransactionID());
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RezScript);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
+ msg->nextBlockFast(_PREHASH_UpdateBlock);
+ msg->addU32Fast(_PREHASH_ObjectLocalID, (mLocalID));
+ U8 enabled = active;
+ msg->addBOOLFast(_PREHASH_Enabled, enabled);
+ msg->nextBlockFast(_PREHASH_InventoryBlock);
+ task_item->packMessage(msg);
+ msg->sendReliable(mRegionp->getHost());
+
+ // do the internal logic
+ doUpdateInventory(task_item, TASK_INVENTORY_ITEM_KEY, is_new);
}
void LLViewerObject::moveInventory(const LLUUID& folder_id,
- const LLUUID& item_id)
-{
- LL_DEBUGS() << "LLViewerObject::moveInventory " << item_id << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MoveTaskInventory);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_FolderID, folder_id);
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addU32Fast(_PREHASH_LocalID, mLocalID);
- msg->addUUIDFast(_PREHASH_ItemID, item_id);
- msg->sendReliable(mRegionp->getHost());
-
- LLInventoryObject* inv_obj = getInventoryObject(item_id);
- if(inv_obj)
- {
- LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_obj;
- if(!item->getPermissions().allowCopyBy(gAgent.getID()))
- {
- deleteInventoryItem(item_id);
- ++mExpectedInventorySerialNum;
- }
- }
+ const LLUUID& item_id)
+{
+ LL_DEBUGS() << "LLViewerObject::moveInventory " << item_id << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_MoveTaskInventory);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_FolderID, folder_id);
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addU32Fast(_PREHASH_LocalID, mLocalID);
+ msg->addUUIDFast(_PREHASH_ItemID, item_id);
+ msg->sendReliable(mRegionp->getHost());
+
+ LLInventoryObject* inv_obj = getInventoryObject(item_id);
+ if(inv_obj)
+ {
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_obj;
+ if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ deleteInventoryItem(item_id);
+ ++mExpectedInventorySerialNum;
+ }
+ }
}
void LLViewerObject::dirtyInventory()
{
- // If there aren't any LLVOInventoryListeners, we won't be
- // able to update our mInventory when it comes back from the
- // simulator, so we should not clear the inventory either.
- if(mInventory && !mInventoryCallbacks.empty())
- {
- mInventory->clear(); // will deref and delete entries
- delete mInventory;
- mInventory = NULL;
- }
- mInventoryDirty = TRUE;
+ // If there aren't any LLVOInventoryListeners, we won't be
+ // able to update our mInventory when it comes back from the
+ // simulator, so we should not clear the inventory either.
+ if(mInventory && !mInventoryCallbacks.empty())
+ {
+ mInventory->clear(); // will deref and delete entries
+ delete mInventory;
+ mInventory = NULL;
+ }
+ mInventoryDirty = TRUE;
}
void LLViewerObject::registerInventoryListener(LLVOInventoryListener* listener, void* user_data)
{
- LLInventoryCallbackInfo* info = new LLInventoryCallbackInfo;
- info->mListener = listener;
- info->mInventoryData = user_data;
- mInventoryCallbacks.push_front(info);
+ LLInventoryCallbackInfo* info = new LLInventoryCallbackInfo;
+ info->mListener = listener;
+ info->mInventoryData = user_data;
+ mInventoryCallbacks.push_front(info);
}
void LLViewerObject::removeInventoryListener(LLVOInventoryListener* listener)
{
- if (listener == NULL)
- return;
- for (callback_list_t::iterator iter = mInventoryCallbacks.begin();
- iter != mInventoryCallbacks.end(); )
- {
- callback_list_t::iterator curiter = iter++;
- LLInventoryCallbackInfo* info = *curiter;
- if (info->mListener == listener)
- {
- delete info;
- mInventoryCallbacks.erase(curiter);
- break;
- }
- }
+ if (listener == NULL)
+ return;
+ for (callback_list_t::iterator iter = mInventoryCallbacks.begin();
+ iter != mInventoryCallbacks.end(); )
+ {
+ callback_list_t::iterator curiter = iter++;
+ LLInventoryCallbackInfo* info = *curiter;
+ if (info->mListener == listener)
+ {
+ delete info;
+ mInventoryCallbacks.erase(curiter);
+ break;
+ }
+ }
}
BOOL LLViewerObject::isInventoryPending()
@@ -2995,60 +2995,60 @@ BOOL LLViewerObject::isInventoryPending()
void LLViewerObject::clearInventoryListeners()
{
- for_each(mInventoryCallbacks.begin(), mInventoryCallbacks.end(), DeletePointer());
- mInventoryCallbacks.clear();
+ for_each(mInventoryCallbacks.begin(), mInventoryCallbacks.end(), DeletePointer());
+ mInventoryCallbacks.clear();
}
bool LLViewerObject::hasInventoryListeners()
{
- return !mInventoryCallbacks.empty();
+ return !mInventoryCallbacks.empty();
}
void LLViewerObject::requestInventory()
{
- if(mInventoryDirty && mInventory && !mInventoryCallbacks.empty())
- {
- mInventory->clear(); // will deref and delete entries
- delete mInventory;
- mInventory = NULL;
- }
-
- if(mInventory)
- {
- // inventory is either up to date or doesn't has a listener
- // if it is dirty, leave it this way in case we gain a listener
- doInventoryCallback();
- }
- else
- {
- // since we are going to request it now
- mInventoryDirty = FALSE;
-
- // Note: throws away duplicate requests
- fetchInventoryFromServer();
- }
+ if(mInventoryDirty && mInventory && !mInventoryCallbacks.empty())
+ {
+ mInventory->clear(); // will deref and delete entries
+ delete mInventory;
+ mInventory = NULL;
+ }
+
+ if(mInventory)
+ {
+ // inventory is either up to date or doesn't has a listener
+ // if it is dirty, leave it this way in case we gain a listener
+ doInventoryCallback();
+ }
+ else
+ {
+ // since we are going to request it now
+ mInventoryDirty = FALSE;
+
+ // Note: throws away duplicate requests
+ fetchInventoryFromServer();
+ }
}
void LLViewerObject::fetchInventoryFromServer()
{
- if (!isInventoryPending())
- {
- delete mInventory;
- mInventory = NULL;
-
- // Results in processTaskInv
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RequestTaskInventory);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addU32Fast(_PREHASH_LocalID, mLocalID);
- msg->sendReliable(mRegionp->getHost());
-
- // This will get reset by doInventoryCallback or processTaskInv
- mInvRequestState = INVENTORY_REQUEST_PENDING;
- }
+ if (!isInventoryPending())
+ {
+ delete mInventory;
+ mInventory = NULL;
+
+ // Results in processTaskInv
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RequestTaskInventory);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addU32Fast(_PREHASH_LocalID, mLocalID);
+ msg->sendReliable(mRegionp->getHost());
+
+ // This will get reset by doInventoryCallback or processTaskInv
+ mInvRequestState = INVENTORY_REQUEST_PENDING;
+ }
}
void LLViewerObject::fetchInventoryDelayed(const F64 &time_seconds)
@@ -3164,8 +3164,8 @@ void LLViewerObject::linkControlAvatar()
return;
}
mControlAvatar = LLControlAvatar::createControlAvatar(volp);
- LL_DEBUGS("AnimatedObjects") << volp->getID()
- << " created control av for "
+ LL_DEBUGS("AnimatedObjects") << volp->getID()
+ << " created control av for "
<< (S32) (1+volp->numChildren()) << " prims" << LL_ENDL;
}
LLControlAvatar *cav = getControlAvatar();
@@ -3215,26 +3215,26 @@ bool LLViewerObject::isAnimatedObject() const
struct LLFilenameAndTask
{
- LLUUID mTaskID;
- std::string mFilename;
+ LLUUID mTaskID;
+ std::string mFilename;
- // for sequencing in case of multiple updates
- S16 mSerial;
+ // for sequencing in case of multiple updates
+ S16 mSerial;
#ifdef _DEBUG
- static S32 sCount;
- LLFilenameAndTask()
- {
- ++sCount;
- LL_DEBUGS() << "Constructing LLFilenameAndTask: " << sCount << LL_ENDL;
- }
- ~LLFilenameAndTask()
- {
- --sCount;
- LL_DEBUGS() << "Destroying LLFilenameAndTask: " << sCount << LL_ENDL;
- }
+ static S32 sCount;
+ LLFilenameAndTask()
+ {
+ ++sCount;
+ LL_DEBUGS() << "Constructing LLFilenameAndTask: " << sCount << LL_ENDL;
+ }
+ ~LLFilenameAndTask()
+ {
+ --sCount;
+ LL_DEBUGS() << "Destroying LLFilenameAndTask: " << sCount << LL_ENDL;
+ }
private:
- LLFilenameAndTask(const LLFilenameAndTask& rhs);
- const LLFilenameAndTask& operator=(const LLFilenameAndTask& rhs) const;
+ LLFilenameAndTask(const LLFilenameAndTask& rhs);
+ const LLFilenameAndTask& operator=(const LLFilenameAndTask& rhs) const;
#endif
};
@@ -3287,7 +3287,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data)
LLFilenameAndTask* ft = new LLFilenameAndTask;
ft->mTaskID = task_id;
ft->mSerial = serial;
-
+
// We received version we expected or newer. Load it.
object->mInventorySerialNum = ft->mSerial;
object->mExpectedInventorySerialNum = ft->mSerial;
@@ -3343,154 +3343,154 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data)
void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtStat ext_status)
{
- LLFilenameAndTask* ft = (LLFilenameAndTask*)user_data;
- LLViewerObject* object = NULL;
-
- if (ft
- && (0 == error_code)
- && (object = gObjectList.findObject(ft->mTaskID))
- && ft->mSerial >= object->mInventorySerialNum)
- {
- object->mInventorySerialNum = ft->mSerial;
- LL_DEBUGS() << "Receiving inventory task file for serial " << object->mInventorySerialNum << " taskid: " << ft->mTaskID << LL_ENDL;
- if (ft->mSerial < object->mExpectedInventorySerialNum)
- {
- // User managed to change something while inventory was loading
- LL_DEBUGS() << "Processing file that is potentially out of date for task: " << ft->mTaskID << LL_ENDL;
- }
-
- if (object->loadTaskInvFile(ft->mFilename))
- {
-
- LLInventoryObject::object_list_t::iterator it = object->mInventory->begin();
- LLInventoryObject::object_list_t::iterator end = object->mInventory->end();
- std::list<LLUUID>& pending_lst = object->mPendingInventoryItemsIDs;
-
- for (; it != end && pending_lst.size(); ++it)
- {
- LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(it->get());
- if(item && item->getType() != LLAssetType::AT_CATEGORY)
- {
- std::list<LLUUID>::iterator id_it = std::find(pending_lst.begin(), pending_lst.begin(), item->getAssetUUID());
- if (id_it != pending_lst.end())
- {
- pending_lst.erase(id_it);
- }
- }
- }
- }
- else
- {
- // MAINT-2597 - crash when trying to edit a no-mod object
- // Somehow get an contents inventory response, but with an invalid stream (possibly 0 size?)
- // Stated repro was specific to no-mod objects so failing without user interaction should be safe.
- LL_WARNS() << "Trying to load invalid task inventory file. Ignoring file contents." << LL_ENDL;
- }
- }
- else
- {
- // This Occurs When two requests were made, and the first one
- // has already handled it.
- LL_DEBUGS() << "Problem loading task inventory. Return code: "
- << error_code << LL_ENDL;
- }
- delete ft;
+ LLFilenameAndTask* ft = (LLFilenameAndTask*)user_data;
+ LLViewerObject* object = NULL;
+
+ if (ft
+ && (0 == error_code)
+ && (object = gObjectList.findObject(ft->mTaskID))
+ && ft->mSerial >= object->mInventorySerialNum)
+ {
+ object->mInventorySerialNum = ft->mSerial;
+ LL_DEBUGS() << "Receiving inventory task file for serial " << object->mInventorySerialNum << " taskid: " << ft->mTaskID << LL_ENDL;
+ if (ft->mSerial < object->mExpectedInventorySerialNum)
+ {
+ // User managed to change something while inventory was loading
+ LL_DEBUGS() << "Processing file that is potentially out of date for task: " << ft->mTaskID << LL_ENDL;
+ }
+
+ if (object->loadTaskInvFile(ft->mFilename))
+ {
+
+ LLInventoryObject::object_list_t::iterator it = object->mInventory->begin();
+ LLInventoryObject::object_list_t::iterator end = object->mInventory->end();
+ std::list<LLUUID>& pending_lst = object->mPendingInventoryItemsIDs;
+
+ for (; it != end && pending_lst.size(); ++it)
+ {
+ LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(it->get());
+ if(item && item->getType() != LLAssetType::AT_CATEGORY)
+ {
+ std::list<LLUUID>::iterator id_it = std::find(pending_lst.begin(), pending_lst.begin(), item->getAssetUUID());
+ if (id_it != pending_lst.end())
+ {
+ pending_lst.erase(id_it);
+ }
+ }
+ }
+ }
+ else
+ {
+ // MAINT-2597 - crash when trying to edit a no-mod object
+ // Somehow get an contents inventory response, but with an invalid stream (possibly 0 size?)
+ // Stated repro was specific to no-mod objects so failing without user interaction should be safe.
+ LL_WARNS() << "Trying to load invalid task inventory file. Ignoring file contents." << LL_ENDL;
+ }
+ }
+ else
+ {
+ // This Occurs When two requests were made, and the first one
+ // has already handled it.
+ LL_DEBUGS() << "Problem loading task inventory. Return code: "
+ << error_code << LL_ENDL;
+ }
+ delete ft;
}
BOOL LLViewerObject::loadTaskInvFile(const std::string& filename)
{
- std::string filename_and_local_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, filename);
- llifstream ifs(filename_and_local_path.c_str());
- if(ifs.good())
- {
- U32 fail_count = 0;
- char buffer[MAX_STRING]; /* Flawfinder: ignore */
- // *NOTE: This buffer size is hard coded into scanf() below.
- char keyword[MAX_STRING]; /* Flawfinder: ignore */
- if(mInventory)
- {
- mInventory->clear(); // will deref and delete it
- }
- else
- {
- mInventory = new LLInventoryObject::object_list_t;
- }
- while(ifs.good())
- {
- ifs.getline(buffer, MAX_STRING);
- if (sscanf(buffer, " %254s", keyword) == EOF) /* Flawfinder: ignore */
- {
- // Blank file?
- LL_WARNS() << "Issue reading from file '"
- << filename << "'" << LL_ENDL;
- break;
- }
- else if(0 == strcmp("inv_item", keyword))
- {
- LLPointer<LLInventoryObject> inv = new LLViewerInventoryItem;
- inv->importLegacyStream(ifs);
- mInventory->push_front(inv);
- }
- else if(0 == strcmp("inv_object", keyword))
- {
- LLPointer<LLInventoryObject> inv = new LLInventoryObject;
- inv->importLegacyStream(ifs);
- inv->rename("Contents");
- mInventory->push_front(inv);
- }
- else if (fail_count >= MAX_INV_FILE_READ_FAILS)
- {
- LL_WARNS() << "Encountered too many unknowns while reading from file: '"
- << filename << "'" << LL_ENDL;
- break;
- }
- else
- {
- // Is there really a point to continue processing? We already failing to display full inventory
- fail_count++;
- LL_WARNS_ONCE() << "Unknown token while reading from inventory file. Token: '"
- << keyword << "'" << LL_ENDL;
- }
- }
- ifs.close();
- LLFile::remove(filename_and_local_path);
- }
- else
- {
- LL_WARNS() << "unable to load task inventory: " << filename_and_local_path
- << LL_ENDL;
- return FALSE;
- }
- doInventoryCallback();
-
- return TRUE;
+ std::string filename_and_local_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, filename);
+ llifstream ifs(filename_and_local_path.c_str());
+ if(ifs.good())
+ {
+ U32 fail_count = 0;
+ char buffer[MAX_STRING]; /* Flawfinder: ignore */
+ // *NOTE: This buffer size is hard coded into scanf() below.
+ char keyword[MAX_STRING]; /* Flawfinder: ignore */
+ if(mInventory)
+ {
+ mInventory->clear(); // will deref and delete it
+ }
+ else
+ {
+ mInventory = new LLInventoryObject::object_list_t;
+ }
+ while(ifs.good())
+ {
+ ifs.getline(buffer, MAX_STRING);
+ if (sscanf(buffer, " %254s", keyword) == EOF) /* Flawfinder: ignore */
+ {
+ // Blank file?
+ LL_WARNS() << "Issue reading from file '"
+ << filename << "'" << LL_ENDL;
+ break;
+ }
+ else if(0 == strcmp("inv_item", keyword))
+ {
+ LLPointer<LLInventoryObject> inv = new LLViewerInventoryItem;
+ inv->importLegacyStream(ifs);
+ mInventory->push_front(inv);
+ }
+ else if(0 == strcmp("inv_object", keyword))
+ {
+ LLPointer<LLInventoryObject> inv = new LLInventoryObject;
+ inv->importLegacyStream(ifs);
+ inv->rename("Contents");
+ mInventory->push_front(inv);
+ }
+ else if (fail_count >= MAX_INV_FILE_READ_FAILS)
+ {
+ LL_WARNS() << "Encountered too many unknowns while reading from file: '"
+ << filename << "'" << LL_ENDL;
+ break;
+ }
+ else
+ {
+ // Is there really a point to continue processing? We already failing to display full inventory
+ fail_count++;
+ LL_WARNS_ONCE() << "Unknown token while reading from inventory file. Token: '"
+ << keyword << "'" << LL_ENDL;
+ }
+ }
+ ifs.close();
+ LLFile::remove(filename_and_local_path);
+ }
+ else
+ {
+ LL_WARNS() << "unable to load task inventory: " << filename_and_local_path
+ << LL_ENDL;
+ return FALSE;
+ }
+ doInventoryCallback();
+
+ return TRUE;
}
void LLViewerObject::doInventoryCallback()
{
- for (callback_list_t::iterator iter = mInventoryCallbacks.begin();
- iter != mInventoryCallbacks.end(); )
- {
- callback_list_t::iterator curiter = iter++;
- LLInventoryCallbackInfo* info = *curiter;
- if (info->mListener != NULL)
- {
- info->mListener->inventoryChanged(this,
- mInventory,
- mInventorySerialNum,
- info->mInventoryData);
- }
- else
- {
- LL_INFOS() << "LLViewerObject::doInventoryCallback() deleting bad listener entry." << LL_ENDL;
- delete info;
- mInventoryCallbacks.erase(curiter);
- }
- }
-
- // release inventory loading state
- mInvRequestXFerId = 0;
- mInvRequestState = INVENTORY_REQUEST_STOPPED;
+ for (callback_list_t::iterator iter = mInventoryCallbacks.begin();
+ iter != mInventoryCallbacks.end(); )
+ {
+ callback_list_t::iterator curiter = iter++;
+ LLInventoryCallbackInfo* info = *curiter;
+ if (info->mListener != NULL)
+ {
+ info->mListener->inventoryChanged(this,
+ mInventory,
+ mInventorySerialNum,
+ info->mInventoryData);
+ }
+ else
+ {
+ LL_INFOS() << "LLViewerObject::doInventoryCallback() deleting bad listener entry." << LL_ENDL;
+ delete info;
+ mInventoryCallbacks.erase(curiter);
+ }
+ }
+
+ // release inventory loading state
+ mInvRequestXFerId = 0;
+ mInvRequestState = INVENTORY_REQUEST_STOPPED;
}
void LLViewerObject::removeInventory(const LLUUID& item_id)
@@ -3501,17 +3501,17 @@ void LLViewerObject::removeInventory(const LLUUID& item_id)
params["object"] = mID;
LLFloaterReg::hideInstance("item_properties", params);
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RemoveTaskInventory);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addU32Fast(_PREHASH_LocalID, mLocalID);
- msg->addUUIDFast(_PREHASH_ItemID, item_id);
- msg->sendReliable(mRegionp->getHost());
- deleteInventoryItem(item_id);
- ++mExpectedInventorySerialNum;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RemoveTaskInventory);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addU32Fast(_PREHASH_LocalID, mLocalID);
+ msg->addUUIDFast(_PREHASH_ItemID, item_id);
+ msg->sendReliable(mRegionp->getHost());
+ deleteInventoryItem(item_id);
+ ++mExpectedInventorySerialNum;
}
bool LLViewerObject::isAssetInInventory(LLViewerInventoryItem* item, LLAssetType::EType type)
@@ -3563,136 +3563,136 @@ void LLViewerObject::updateMaterialInventory(LLViewerInventoryItem* item, U8 key
}
void LLViewerObject::updateInventory(
- LLViewerInventoryItem* item,
- U8 key,
- bool is_new)
-{
- // This slices the object into what we're concerned about on the
- // viewer. The simulator will take the permissions and transfer
- // ownership.
- LLPointer<LLViewerInventoryItem> task_item =
- new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(),
- item->getAssetUUID(), item->getType(),
- item->getInventoryType(),
- item->getName(), item->getDescription(),
- item->getSaleInfo(),
- item->getFlags(),
- item->getCreationDate());
- task_item->setTransactionID(item->getTransactionID());
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_UpdateTaskInventory);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_UpdateData);
- msg->addU32Fast(_PREHASH_LocalID, mLocalID);
- msg->addU8Fast(_PREHASH_Key, key);
- msg->nextBlockFast(_PREHASH_InventoryData);
- task_item->packMessage(msg);
- msg->sendReliable(mRegionp->getHost());
-
- // do the internal logic
- doUpdateInventory(task_item, key, is_new);
+ LLViewerInventoryItem* item,
+ U8 key,
+ bool is_new)
+{
+ // This slices the object into what we're concerned about on the
+ // viewer. The simulator will take the permissions and transfer
+ // ownership.
+ LLPointer<LLViewerInventoryItem> task_item =
+ new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(),
+ item->getAssetUUID(), item->getType(),
+ item->getInventoryType(),
+ item->getName(), item->getDescription(),
+ item->getSaleInfo(),
+ item->getFlags(),
+ item->getCreationDate());
+ task_item->setTransactionID(item->getTransactionID());
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_UpdateTaskInventory);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_UpdateData);
+ msg->addU32Fast(_PREHASH_LocalID, mLocalID);
+ msg->addU8Fast(_PREHASH_Key, key);
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ task_item->packMessage(msg);
+ msg->sendReliable(mRegionp->getHost());
+
+ // do the internal logic
+ doUpdateInventory(task_item, key, is_new);
}
void LLViewerObject::updateInventoryLocal(LLInventoryItem* item, U8 key)
{
- LLPointer<LLViewerInventoryItem> task_item =
- new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(),
- item->getAssetUUID(), item->getType(),
- item->getInventoryType(),
- item->getName(), item->getDescription(),
- item->getSaleInfo(), item->getFlags(),
- item->getCreationDate());
+ LLPointer<LLViewerInventoryItem> task_item =
+ new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(),
+ item->getAssetUUID(), item->getType(),
+ item->getInventoryType(),
+ item->getName(), item->getDescription(),
+ item->getSaleInfo(), item->getFlags(),
+ item->getCreationDate());
- // do the internal logic
- const bool is_new = false;
- doUpdateInventory(task_item, key, is_new);
+ // do the internal logic
+ const bool is_new = false;
+ doUpdateInventory(task_item, key, is_new);
}
LLInventoryObject* LLViewerObject::getInventoryObject(const LLUUID& item_id)
{
- LLInventoryObject* rv = NULL;
- if(mInventory)
- {
- LLInventoryObject::object_list_t::iterator it = mInventory->begin();
- LLInventoryObject::object_list_t::iterator end = mInventory->end();
- for ( ; it != end; ++it)
- {
- if((*it)->getUUID() == item_id)
- {
- rv = *it;
- break;
- }
- }
- }
- return rv;
+ LLInventoryObject* rv = NULL;
+ if(mInventory)
+ {
+ LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::iterator end = mInventory->end();
+ for ( ; it != end; ++it)
+ {
+ if((*it)->getUUID() == item_id)
+ {
+ rv = *it;
+ break;
+ }
+ }
+ }
+ return rv;
}
LLInventoryItem* LLViewerObject::getInventoryItem(const LLUUID& item_id)
{
- LLInventoryObject* iobj = getInventoryObject(item_id);
- if (!iobj || iobj->getType() == LLAssetType::AT_CATEGORY)
- {
- return NULL;
- }
- LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(iobj);
- return item;
+ LLInventoryObject* iobj = getInventoryObject(item_id);
+ if (!iobj || iobj->getType() == LLAssetType::AT_CATEGORY)
+ {
+ return NULL;
+ }
+ LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(iobj);
+ return item;
}
void LLViewerObject::getInventoryContents(LLInventoryObject::object_list_t& objects)
{
- if(mInventory)
- {
- LLInventoryObject::object_list_t::iterator it = mInventory->begin();
- LLInventoryObject::object_list_t::iterator end = mInventory->end();
- for( ; it != end; ++it)
- {
- if ((*it)->getType() != LLAssetType::AT_CATEGORY)
- {
- objects.push_back(*it);
- }
- }
- }
+ if(mInventory)
+ {
+ LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::iterator end = mInventory->end();
+ for( ; it != end; ++it)
+ {
+ if ((*it)->getType() != LLAssetType::AT_CATEGORY)
+ {
+ objects.push_back(*it);
+ }
+ }
+ }
}
LLInventoryObject* LLViewerObject::getInventoryRoot()
{
- if (!mInventory || !mInventory->size())
- {
- return NULL;
- }
- return mInventory->back();
+ if (!mInventory || !mInventory->size())
+ {
+ return NULL;
+ }
+ return mInventory->back();
}
LLViewerInventoryItem* LLViewerObject::getInventoryItemByAsset(const LLUUID& asset_id)
{
- if (mInventoryDirty)
- LL_WARNS() << "Peforming inventory lookup for object " << mID << " that has dirty inventory!" << LL_ENDL;
-
- LLViewerInventoryItem* rv = NULL;
- if(mInventory)
- {
- LLViewerInventoryItem* item = NULL;
-
- LLInventoryObject::object_list_t::iterator it = mInventory->begin();
- LLInventoryObject::object_list_t::iterator end = mInventory->end();
- for( ; it != end; ++it)
- {
- LLInventoryObject* obj = *it;
- if(obj->getType() != LLAssetType::AT_CATEGORY)
- {
- // *FIX: gank-ass down cast!
- item = (LLViewerInventoryItem*)obj;
- if(item->getAssetUUID() == asset_id)
- {
- rv = item;
- break;
- }
- }
- }
- }
- return rv;
+ if (mInventoryDirty)
+ LL_WARNS() << "Peforming inventory lookup for object " << mID << " that has dirty inventory!" << LL_ENDL;
+
+ LLViewerInventoryItem* rv = NULL;
+ if(mInventory)
+ {
+ LLViewerInventoryItem* item = NULL;
+
+ LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::iterator end = mInventory->end();
+ for( ; it != end; ++it)
+ {
+ LLInventoryObject* obj = *it;
+ if(obj->getType() != LLAssetType::AT_CATEGORY)
+ {
+ // *FIX: gank-ass down cast!
+ item = (LLViewerInventoryItem*)obj;
+ if(item->getAssetUUID() == asset_id)
+ {
+ rv = item;
+ break;
+ }
+ }
+ }
+ }
+ return rv;
}
LLViewerInventoryItem* LLViewerObject::getInventoryItemByAsset(const LLUUID& asset_id, LLAssetType::EType type)
@@ -3734,70 +3734,70 @@ LLViewerInventoryItem* LLViewerObject::getInventoryItemByAsset(const LLUUID& ass
}
void LLViewerObject::updateViewerInventoryAsset(
- const LLViewerInventoryItem* item,
- const LLUUID& new_asset)
+ const LLViewerInventoryItem* item,
+ const LLUUID& new_asset)
{
- LLPointer<LLViewerInventoryItem> task_item =
- new LLViewerInventoryItem(item);
- task_item->setAssetUUID(new_asset);
+ LLPointer<LLViewerInventoryItem> task_item =
+ new LLViewerInventoryItem(item);
+ task_item->setAssetUUID(new_asset);
- // do the internal logic
- doUpdateInventory(task_item, TASK_INVENTORY_ITEM_KEY, false);
+ // do the internal logic
+ doUpdateInventory(task_item, TASK_INVENTORY_ITEM_KEY, false);
}
void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent)
{
- if (getVolume())
- { //volumes calculate pixel area and angle per face
- return;
- }
-
- LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
- LLVector3 pos_agent = getRenderPosition();
-
- F32 dx = viewer_pos_agent.mV[VX] - pos_agent.mV[VX];
- F32 dy = viewer_pos_agent.mV[VY] - pos_agent.mV[VY];
- F32 dz = viewer_pos_agent.mV[VZ] - pos_agent.mV[VZ];
-
- F32 max_scale = getMaxScale();
- F32 mid_scale = getMidScale();
- F32 min_scale = getMinScale();
-
- // IW: estimate - when close to large objects, computing range based on distance from center is no good
- // to try to get a min distance from face, subtract min_scale/2 from the range.
- // This means we'll load too much detail sometimes, but that's better than not enough
- // I don't think there's a better way to do this without calculating distance per-poly
- F32 range = sqrt(dx*dx + dy*dy + dz*dz) - min_scale/2;
-
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- if (range < 0.001f || isHUDAttachment()) // range == zero
- {
- mAppAngle = 180.f;
- mPixelArea = (F32)camera->getScreenPixelArea();
- }
- else
- {
- mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG;
-
- F32 pixels_per_meter = camera->getPixelMeterRatio() / range;
-
- mPixelArea = (pixels_per_meter * max_scale) * (pixels_per_meter * mid_scale);
- if (mPixelArea > camera->getScreenPixelArea())
- {
- mAppAngle = 180.f;
- mPixelArea = (F32)camera->getScreenPixelArea();
- }
- }
+ if (getVolume())
+ { //volumes calculate pixel area and angle per face
+ return;
+ }
+
+ LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
+ LLVector3 pos_agent = getRenderPosition();
+
+ F32 dx = viewer_pos_agent.mV[VX] - pos_agent.mV[VX];
+ F32 dy = viewer_pos_agent.mV[VY] - pos_agent.mV[VY];
+ F32 dz = viewer_pos_agent.mV[VZ] - pos_agent.mV[VZ];
+
+ F32 max_scale = getMaxScale();
+ F32 mid_scale = getMidScale();
+ F32 min_scale = getMinScale();
+
+ // IW: estimate - when close to large objects, computing range based on distance from center is no good
+ // to try to get a min distance from face, subtract min_scale/2 from the range.
+ // This means we'll load too much detail sometimes, but that's better than not enough
+ // I don't think there's a better way to do this without calculating distance per-poly
+ F32 range = sqrt(dx*dx + dy*dy + dz*dz) - min_scale/2;
+
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ if (range < 0.001f || isHUDAttachment()) // range == zero
+ {
+ mAppAngle = 180.f;
+ mPixelArea = (F32)camera->getScreenPixelArea();
+ }
+ else
+ {
+ mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG;
+
+ F32 pixels_per_meter = camera->getPixelMeterRatio() / range;
+
+ mPixelArea = (pixels_per_meter * max_scale) * (pixels_per_meter * mid_scale);
+ if (mPixelArea > camera->getScreenPixelArea())
+ {
+ mAppAngle = 180.f;
+ mPixelArea = (F32)camera->getScreenPixelArea();
+ }
+ }
}
BOOL LLViewerObject::updateLOD()
{
- return FALSE;
+ return FALSE;
}
BOOL LLViewerObject::updateGeometry(LLDrawable *drawable)
{
- return TRUE;
+ return TRUE;
}
void LLViewerObject::updateGL()
@@ -3807,51 +3807,51 @@ void LLViewerObject::updateGL()
void LLViewerObject::updateFaceSize(S32 idx)
{
-
+
}
LLDrawable* LLViewerObject::createDrawable(LLPipeline *pipeline)
{
- return NULL;
+ return NULL;
}
void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped)
{
- LLPrimitive::setScale(scale);
- if (mDrawable.notNull())
- {
- //encompass completely sheared objects by taking
- //the most extreme point possible (<1,1,0.5>)
- mDrawable->setRadius(LLVector3(1,1,0.5f).scaleVec(scale).magVec());
- updateDrawable(damped);
- }
-
- if( (LL_PCODE_VOLUME == getPCode()) && !isDead() )
- {
- if (permYouOwner() || (scale.magVecSquared() > (7.5f * 7.5f)) )
- {
- if (!mOnMap)
- {
- llassert_always(LLWorld::getInstance()->getRegionFromHandle(getRegion()->getHandle()));
-
- gObjectList.addToMap(this);
- mOnMap = TRUE;
- }
- }
- else
- {
- if (mOnMap)
- {
- gObjectList.removeFromMap(this);
- mOnMap = FALSE;
- }
- }
- }
+ LLPrimitive::setScale(scale);
+ if (mDrawable.notNull())
+ {
+ //encompass completely sheared objects by taking
+ //the most extreme point possible (<1,1,0.5>)
+ mDrawable->setRadius(LLVector3(1,1,0.5f).scaleVec(scale).magVec());
+ updateDrawable(damped);
+ }
+
+ if( (LL_PCODE_VOLUME == getPCode()) && !isDead() )
+ {
+ if (permYouOwner() || (scale.magVecSquared() > (7.5f * 7.5f)) )
+ {
+ if (!mOnMap)
+ {
+ llassert_always(LLWorld::getInstance()->getRegionFromHandle(getRegion()->getHandle()));
+
+ gObjectList.addToMap(this);
+ mOnMap = TRUE;
+ }
+ }
+ else
+ {
+ if (mOnMap)
+ {
+ gObjectList.removeFromMap(this);
+ mOnMap = FALSE;
+ }
+ }
+ }
}
void LLViewerObject::setObjectCostStale()
{
- mCostStale = true;
+ mCostStale = true;
// *NOTE: This is harmlessly redundant for Blinn-Phong material updates, as
// the root prim currently gets set stale anyway due to other property
// updates. But it is needed for GLTF material ID updates.
@@ -3861,96 +3861,96 @@ void LLViewerObject::setObjectCostStale()
void LLViewerObject::setObjectCost(F32 cost)
{
- mObjectCost = cost;
- mCostStale = false;
+ mObjectCost = cost;
+ mCostStale = false;
- if (isSelected())
- {
- gFloaterTools->dirty();
- }
+ if (isSelected())
+ {
+ gFloaterTools->dirty();
+ }
}
void LLViewerObject::setLinksetCost(F32 cost)
{
- mLinksetCost = cost;
- mCostStale = false;
+ mLinksetCost = cost;
+ mCostStale = false;
- BOOL needs_refresh = isSelected();
- child_list_t::iterator iter = mChildList.begin();
- while(iter != mChildList.end() && !needs_refresh)
- {
- LLViewerObject* child = *iter;
- needs_refresh = child->isSelected();
- iter++;
- }
+ BOOL needs_refresh = isSelected();
+ child_list_t::iterator iter = mChildList.begin();
+ while(iter != mChildList.end() && !needs_refresh)
+ {
+ LLViewerObject* child = *iter;
+ needs_refresh = child->isSelected();
+ iter++;
+ }
- if (needs_refresh)
- {
- gFloaterTools->dirty();
- }
+ if (needs_refresh)
+ {
+ gFloaterTools->dirty();
+ }
}
void LLViewerObject::setPhysicsCost(F32 cost)
{
- mPhysicsCost = cost;
- mCostStale = false;
+ mPhysicsCost = cost;
+ mCostStale = false;
- if (isSelected())
- {
- gFloaterTools->dirty();
- }
+ if (isSelected())
+ {
+ gFloaterTools->dirty();
+ }
}
void LLViewerObject::setLinksetPhysicsCost(F32 cost)
{
- mLinksetPhysicsCost = cost;
- mCostStale = false;
-
- if (isSelected())
- {
- gFloaterTools->dirty();
- }
+ mLinksetPhysicsCost = cost;
+ mCostStale = false;
+
+ if (isSelected())
+ {
+ gFloaterTools->dirty();
+ }
}
F32 LLViewerObject::getObjectCost()
{
- if (mCostStale)
- {
- gObjectList.updateObjectCost(this);
- }
-
- return mObjectCost;
+ if (mCostStale)
+ {
+ gObjectList.updateObjectCost(this);
+ }
+
+ return mObjectCost;
}
F32 LLViewerObject::getLinksetCost()
{
- if (mCostStale)
- {
- gObjectList.updateObjectCost(this);
- }
+ if (mCostStale)
+ {
+ gObjectList.updateObjectCost(this);
+ }
- return mLinksetCost;
+ return mLinksetCost;
}
F32 LLViewerObject::getPhysicsCost()
{
- if (mCostStale)
- {
- gObjectList.updateObjectCost(this);
- }
-
- return mPhysicsCost;
+ if (mCostStale)
+ {
+ gObjectList.updateObjectCost(this);
+ }
+
+ return mPhysicsCost;
}
F32 LLViewerObject::getLinksetPhysicsCost()
{
- if (mCostStale)
- {
- gObjectList.updateObjectCost(this);
- }
+ if (mCostStale)
+ {
+ gObjectList.updateObjectCost(this);
+ }
- return mLinksetPhysicsCost;
+ return mLinksetPhysicsCost;
}
F32 LLViewerObject::recursiveGetEstTrianglesMax() const
@@ -3971,7 +3971,7 @@ F32 LLViewerObject::recursiveGetEstTrianglesMax() const
S32 LLViewerObject::getAnimatedObjectMaxTris() const
{
S32 max_tris = 0;
- if (gSavedSettings.getBOOL("AnimatedObjectsIgnoreLimits"))
+ if (gSavedSettings.getBOOL("AnimatedObjectsIgnoreLimits"))
{
max_tris = S32_MAX;
}
@@ -4003,7 +4003,7 @@ F32 LLViewerObject::getEstTrianglesStreamingCost() const
// virtual
F32 LLViewerObject::getStreamingCost() const
{
- return 0.f;
+ return 0.f;
}
// virtual
@@ -4015,12 +4015,12 @@ bool LLViewerObject::getCostData(LLMeshCostData& costs) const
U32 LLViewerObject::getTriangleCount(S32* vcount) const
{
- return 0;
+ return 0;
}
U32 LLViewerObject::getHighLODTriangleCount()
{
- return 0;
+ return 0;
}
U32 LLViewerObject::recursiveGetTriangleCount(S32* vcount) const
@@ -4055,7 +4055,7 @@ F32 LLViewerObject::recursiveGetScaledSurfaceArea() const
{
if (volume->getVolume())
{
- const LLVector3& scale = volume->getScale();
+ const LLVector3& scale = volume->getScale();
area += volume->getVolume()->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
}
LLViewerObject::const_child_list_t children = volume->getChildren();
@@ -4078,68 +4078,68 @@ F32 LLViewerObject::recursiveGetScaledSurfaceArea() const
void LLViewerObject::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
{
- LLVector4a center;
- center.load3(getRenderPosition().mV);
- LLVector4a size;
- size.load3(getScale().mV);
- newMin.setSub(center, size);
- newMax.setAdd(center, size);
-
- mDrawable->setPositionGroup(center);
+ LLVector4a center;
+ center.load3(getRenderPosition().mV);
+ LLVector4a size;
+ size.load3(getScale().mV);
+ newMin.setSub(center, size);
+ newMax.setAdd(center, size);
+
+ mDrawable->setPositionGroup(center);
}
F32 LLViewerObject::getBinRadius()
{
- if (mDrawable.notNull())
- {
- const LLVector4a* ext = mDrawable->getSpatialExtents();
- LLVector4a diff;
- diff.setSub(ext[1], ext[0]);
- return diff.getLength3().getF32();
- }
-
- return getScale().magVec();
+ if (mDrawable.notNull())
+ {
+ const LLVector4a* ext = mDrawable->getSpatialExtents();
+ LLVector4a diff;
+ diff.setSub(ext[1], ext[0]);
+ return diff.getLength3().getF32();
+ }
+
+ return getScale().magVec();
}
F32 LLViewerObject::getMaxScale() const
{
- return llmax(getScale().mV[VX],getScale().mV[VY], getScale().mV[VZ]);
+ return llmax(getScale().mV[VX],getScale().mV[VY], getScale().mV[VZ]);
}
F32 LLViewerObject::getMinScale() const
{
- return llmin(getScale().mV[0],getScale().mV[1],getScale().mV[2]);
+ return llmin(getScale().mV[0],getScale().mV[1],getScale().mV[2]);
}
F32 LLViewerObject::getMidScale() const
{
- if (getScale().mV[VX] < getScale().mV[VY])
- {
- if (getScale().mV[VY] < getScale().mV[VZ])
- {
- return getScale().mV[VY];
- }
- else if (getScale().mV[VX] < getScale().mV[VZ])
- {
- return getScale().mV[VZ];
- }
- else
- {
- return getScale().mV[VX];
- }
- }
- else if (getScale().mV[VX] < getScale().mV[VZ])
- {
- return getScale().mV[VX];
- }
- else if (getScale().mV[VY] < getScale().mV[VZ])
- {
- return getScale().mV[VZ];
- }
- else
- {
- return getScale().mV[VY];
- }
+ if (getScale().mV[VX] < getScale().mV[VY])
+ {
+ if (getScale().mV[VY] < getScale().mV[VZ])
+ {
+ return getScale().mV[VY];
+ }
+ else if (getScale().mV[VX] < getScale().mV[VZ])
+ {
+ return getScale().mV[VZ];
+ }
+ else
+ {
+ return getScale().mV[VX];
+ }
+ }
+ else if (getScale().mV[VX] < getScale().mV[VZ])
+ {
+ return getScale().mV[VX];
+ }
+ else if (getScale().mV[VY] < getScale().mV[VZ])
+ {
+ return getScale().mV[VZ];
+ }
+ else
+ {
+ return getScale().mV[VY];
+ }
}
@@ -4149,68 +4149,68 @@ void LLViewerObject::updateTextures()
void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */)
{
- if (isDead() || !getVolume())
- {
- return;
- }
-
- S32 i;
- S32 tex_count = getNumTEs();
- for (i = 0; i < tex_count; i++)
- {
- getTEImage(i)->setBoostLevel(LLGLTexture::BOOST_SELECTED);
- }
-
- if (isSculpted() && !isMesh())
- {
- LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
- LLUUID sculpt_id = sculpt_params->getSculptTexture();
- LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED);
- }
-
- if (boost_children)
- {
- for (child_list_t::iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- child->boostTexturePriority();
- }
- }
+ if (isDead() || !getVolume())
+ {
+ return;
+ }
+
+ S32 i;
+ S32 tex_count = getNumTEs();
+ for (i = 0; i < tex_count; i++)
+ {
+ getTEImage(i)->setBoostLevel(LLGLTexture::BOOST_SELECTED);
+ }
+
+ if (isSculpted() && !isMesh())
+ {
+ LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+ LLUUID sculpt_id = sculpt_params->getSculptTexture();
+ LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED);
+ }
+
+ if (boost_children)
+ {
+ for (child_list_t::iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ child->boostTexturePriority();
+ }
+ }
}
void LLViewerObject::setLineWidthForWindowSize(S32 window_width)
{
- if (window_width < 700)
- {
- LLUI::setLineWidth(2.0f);
- }
- else if (window_width < 1100)
- {
- LLUI::setLineWidth(3.0f);
- }
- else if (window_width < 2000)
- {
- LLUI::setLineWidth(4.0f);
- }
- else
- {
- // _damn_, what a nice monitor!
- LLUI::setLineWidth(5.0f);
- }
+ if (window_width < 700)
+ {
+ LLUI::setLineWidth(2.0f);
+ }
+ else if (window_width < 1100)
+ {
+ LLUI::setLineWidth(3.0f);
+ }
+ else if (window_width < 2000)
+ {
+ LLUI::setLineWidth(4.0f);
+ }
+ else
+ {
+ // _damn_, what a nice monitor!
+ LLUI::setLineWidth(5.0f);
+ }
}
void LLViewerObject::increaseArrowLength()
{
/* ???
- if (mAxisArrowLength == 50)
- {
- mAxisArrowLength = 100;
- }
- else
- {
- mAxisArrowLength = 150;
- }
+ if (mAxisArrowLength == 50)
+ {
+ mAxisArrowLength = 100;
+ }
+ else
+ {
+ mAxisArrowLength = 150;
+ }
*/
}
@@ -4218,193 +4218,193 @@ void LLViewerObject::increaseArrowLength()
void LLViewerObject::decreaseArrowLength()
{
/* ???
- if (mAxisArrowLength == 150)
- {
- mAxisArrowLength = 100;
- }
- else
- {
- mAxisArrowLength = 50;
- }
+ if (mAxisArrowLength == 150)
+ {
+ mAxisArrowLength = 100;
+ }
+ else
+ {
+ mAxisArrowLength = 50;
+ }
*/
}
// Culled from newsim LLTask::addNVPair
void LLViewerObject::addNVPair(const std::string& data)
{
- // cout << "LLViewerObject::addNVPair() with ---" << data << "---" << endl;
- LLNameValue *nv = new LLNameValue(data.c_str());
-
-// char splat[MAX_STRING];
-// temp->printNameValue(splat);
-// LL_INFOS() << "addNVPair " << splat << LL_ENDL;
-
- name_value_map_t::iterator iter = mNameValuePairs.find(nv->mName);
- if (iter != mNameValuePairs.end())
- {
- LLNameValue* foundnv = iter->second;
- if (foundnv->mClass != NVC_READ_ONLY)
- {
- delete foundnv;
- mNameValuePairs.erase(iter);
- }
- else
- {
- delete nv;
-// LL_INFOS() << "Trying to write to Read Only NVPair " << temp->mName << " in addNVPair()" << LL_ENDL;
- return;
- }
- }
- mNameValuePairs[nv->mName] = nv;
+ // cout << "LLViewerObject::addNVPair() with ---" << data << "---" << endl;
+ LLNameValue *nv = new LLNameValue(data.c_str());
+
+// char splat[MAX_STRING];
+// temp->printNameValue(splat);
+// LL_INFOS() << "addNVPair " << splat << LL_ENDL;
+
+ name_value_map_t::iterator iter = mNameValuePairs.find(nv->mName);
+ if (iter != mNameValuePairs.end())
+ {
+ LLNameValue* foundnv = iter->second;
+ if (foundnv->mClass != NVC_READ_ONLY)
+ {
+ delete foundnv;
+ mNameValuePairs.erase(iter);
+ }
+ else
+ {
+ delete nv;
+// LL_INFOS() << "Trying to write to Read Only NVPair " << temp->mName << " in addNVPair()" << LL_ENDL;
+ return;
+ }
+ }
+ mNameValuePairs[nv->mName] = nv;
}
BOOL LLViewerObject::removeNVPair(const std::string& name)
{
- char* canonical_name = gNVNameTable.addString(name);
+ char* canonical_name = gNVNameTable.addString(name);
- LL_DEBUGS() << "LLViewerObject::removeNVPair(): " << name << LL_ENDL;
+ LL_DEBUGS() << "LLViewerObject::removeNVPair(): " << name << LL_ENDL;
- name_value_map_t::iterator iter = mNameValuePairs.find(canonical_name);
- if (iter != mNameValuePairs.end())
- {
- if( mRegionp )
- {
- LLNameValue* nv = iter->second;
+ name_value_map_t::iterator iter = mNameValuePairs.find(canonical_name);
+ if (iter != mNameValuePairs.end())
+ {
+ if( mRegionp )
+ {
+ LLNameValue* nv = iter->second;
/*
- std::string buffer = nv->printNameValue();
- gMessageSystem->newMessageFast(_PREHASH_RemoveNameValuePair);
- gMessageSystem->nextBlockFast(_PREHASH_TaskData);
- gMessageSystem->addUUIDFast(_PREHASH_ID, mID);
-
- gMessageSystem->nextBlockFast(_PREHASH_NameValueData);
- gMessageSystem->addStringFast(_PREHASH_NVPair, buffer);
-
- gMessageSystem->sendReliable( mRegionp->getHost() );
+ std::string buffer = nv->printNameValue();
+ gMessageSystem->newMessageFast(_PREHASH_RemoveNameValuePair);
+ gMessageSystem->nextBlockFast(_PREHASH_TaskData);
+ gMessageSystem->addUUIDFast(_PREHASH_ID, mID);
+
+ gMessageSystem->nextBlockFast(_PREHASH_NameValueData);
+ gMessageSystem->addStringFast(_PREHASH_NVPair, buffer);
+
+ gMessageSystem->sendReliable( mRegionp->getHost() );
*/
- // Remove the NV pair from the local list.
- delete nv;
- mNameValuePairs.erase(iter);
- return TRUE;
- }
- else
- {
- LL_DEBUGS() << "removeNVPair - No region for object" << LL_ENDL;
- }
- }
- return FALSE;
+ // Remove the NV pair from the local list.
+ delete nv;
+ mNameValuePairs.erase(iter);
+ return TRUE;
+ }
+ else
+ {
+ LL_DEBUGS() << "removeNVPair - No region for object" << LL_ENDL;
+ }
+ }
+ return FALSE;
}
LLNameValue *LLViewerObject::getNVPair(const std::string& name) const
{
- char *canonical_name;
+ char *canonical_name;
- canonical_name = gNVNameTable.addString(name);
+ canonical_name = gNVNameTable.addString(name);
- // If you access a map with a name that isn't in it, it will add the name and a null pointer.
- // So first check if the data is in the map.
- name_value_map_t::const_iterator iter = mNameValuePairs.find(canonical_name);
- if (iter != mNameValuePairs.end())
- {
- return iter->second;
- }
- else
- {
- return NULL;
- }
+ // If you access a map with a name that isn't in it, it will add the name and a null pointer.
+ // So first check if the data is in the map.
+ name_value_map_t::const_iterator iter = mNameValuePairs.find(canonical_name);
+ if (iter != mNameValuePairs.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ return NULL;
+ }
}
void LLViewerObject::updatePositionCaches() const
{
- // If region is removed from the list it is also deleted.
- if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
- {
- if (!isRoot())
- {
- mPositionRegion = ((LLViewerObject *)getParent())->getPositionRegion() + getPosition() * getParent()->getRotation();
- mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion);
- }
- else
- {
- mPositionRegion = getPosition();
- mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion);
- }
- }
+ // If region is removed from the list it is also deleted.
+ if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
+ {
+ if (!isRoot())
+ {
+ mPositionRegion = ((LLViewerObject *)getParent())->getPositionRegion() + getPosition() * getParent()->getRotation();
+ mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion);
+ }
+ else
+ {
+ mPositionRegion = getPosition();
+ mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion);
+ }
+ }
}
const LLVector3d LLViewerObject::getPositionGlobal() const
-{
- // If region is removed from the list it is also deleted.
- if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
- {
- LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion());
-
- if (isAttachment())
- {
- position_global = gAgent.getPosGlobalFromAgent(getRenderPosition());
- }
- return position_global;
- }
- else
- {
- LLVector3d position_global(getPosition());
- return position_global;
- }
+{
+ // If region is removed from the list it is also deleted.
+ if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
+ {
+ LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion());
+
+ if (isAttachment())
+ {
+ position_global = gAgent.getPosGlobalFromAgent(getRenderPosition());
+ }
+ return position_global;
+ }
+ else
+ {
+ LLVector3d position_global(getPosition());
+ return position_global;
+ }
}
const LLVector3 &LLViewerObject::getPositionAgent() const
{
- // If region is removed from the list it is also deleted.
- if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
- {
- if (mDrawable.notNull() && (!mDrawable->isRoot() && getParent()))
- {
- // Don't return cached position if you have a parent, recalc (until all dirtying is done correctly.
- LLVector3 position_region;
- position_region = ((LLViewerObject *)getParent())->getPositionRegion() + getPosition() * getParent()->getRotation();
- mPositionAgent = mRegionp->getPosAgentFromRegion(position_region);
- }
- else
- {
- mPositionAgent = mRegionp->getPosAgentFromRegion(getPosition());
- }
- }
- return mPositionAgent;
+ // If region is removed from the list it is also deleted.
+ if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
+ {
+ if (mDrawable.notNull() && (!mDrawable->isRoot() && getParent()))
+ {
+ // Don't return cached position if you have a parent, recalc (until all dirtying is done correctly.
+ LLVector3 position_region;
+ position_region = ((LLViewerObject *)getParent())->getPositionRegion() + getPosition() * getParent()->getRotation();
+ mPositionAgent = mRegionp->getPosAgentFromRegion(position_region);
+ }
+ else
+ {
+ mPositionAgent = mRegionp->getPosAgentFromRegion(getPosition());
+ }
+ }
+ return mPositionAgent;
}
const LLVector3 &LLViewerObject::getPositionRegion() const
{
- if (!isRoot())
- {
- LLViewerObject *parent = (LLViewerObject *)getParent();
- mPositionRegion = parent->getPositionRegion() + (getPosition() * parent->getRotation());
- }
- else
- {
- mPositionRegion = getPosition();
- }
+ if (!isRoot())
+ {
+ LLViewerObject *parent = (LLViewerObject *)getParent();
+ mPositionRegion = parent->getPositionRegion() + (getPosition() * parent->getRotation());
+ }
+ else
+ {
+ mPositionRegion = getPosition();
+ }
- return mPositionRegion;
+ return mPositionRegion;
}
const LLVector3 LLViewerObject::getPositionEdit() const
{
- if (isRootEdit())
- {
- return getPosition();
- }
- else
- {
- LLViewerObject *parent = (LLViewerObject *)getParent();
- LLVector3 position_edit = parent->getPositionEdit() + getPosition() * parent->getRotationEdit();
- return position_edit;
- }
+ if (isRootEdit())
+ {
+ return getPosition();
+ }
+ else
+ {
+ LLViewerObject *parent = (LLViewerObject *)getParent();
+ LLVector3 position_edit = parent->getPositionEdit() + getPosition() * parent->getRotationEdit();
+ return position_edit;
+ }
}
const LLVector3 LLViewerObject::getRenderPosition() const
{
- if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED))
- {
+ if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED))
+ {
LLControlAvatar *cav = getControlAvatar();
if (isRoot() && cav)
{
@@ -4417,448 +4417,448 @@ const LLVector3 LLViewerObject::getRenderPosition() const
return pos;
}
}
- LLVOAvatar* avatar = getAvatar();
- if ((avatar) && !getControlAvatar())
- {
- return avatar->getPositionAgent();
- }
- }
+ LLVOAvatar* avatar = getAvatar();
+ if ((avatar) && !getControlAvatar())
+ {
+ return avatar->getPositionAgent();
+ }
+ }
- if (mDrawable.isNull() || mDrawable->getGeneration() < 0)
- {
- return getPositionAgent();
- }
- else
- {
- return mDrawable->getPositionAgent();
- }
+ if (mDrawable.isNull() || mDrawable->getGeneration() < 0)
+ {
+ return getPositionAgent();
+ }
+ else
+ {
+ return mDrawable->getPositionAgent();
+ }
}
const LLVector3 LLViewerObject::getPivotPositionAgent() const
{
- return getRenderPosition();
+ return getRenderPosition();
}
const LLQuaternion LLViewerObject::getRenderRotation() const
{
- LLQuaternion ret;
- if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED) && !isAnimatedObject())
- {
- return ret;
- }
-
- if (mDrawable.isNull() || mDrawable->isStatic())
- {
- ret = getRotationEdit();
- }
- else
- {
- if (!mDrawable->isRoot())
- {
- ret = getRotation() * LLQuaternion(mDrawable->getParent()->getWorldMatrix());
- }
- else
- {
- ret = LLQuaternion(mDrawable->getWorldMatrix());
- }
- }
-
- return ret;
+ LLQuaternion ret;
+ if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED) && !isAnimatedObject())
+ {
+ return ret;
+ }
+
+ if (mDrawable.isNull() || mDrawable->isStatic())
+ {
+ ret = getRotationEdit();
+ }
+ else
+ {
+ if (!mDrawable->isRoot())
+ {
+ ret = getRotation() * LLQuaternion(mDrawable->getParent()->getWorldMatrix());
+ }
+ else
+ {
+ ret = LLQuaternion(mDrawable->getWorldMatrix());
+ }
+ }
+
+ return ret;
}
const LLMatrix4 LLViewerObject::getRenderMatrix() const
{
- return mDrawable->getWorldMatrix();
+ return mDrawable->getWorldMatrix();
}
const LLQuaternion LLViewerObject::getRotationRegion() const
{
- LLQuaternion global_rotation = getRotation();
- if (!((LLXform *)this)->isRoot())
- {
- global_rotation = global_rotation * getParent()->getRotation();
- }
- return global_rotation;
+ LLQuaternion global_rotation = getRotation();
+ if (!((LLXform *)this)->isRoot())
+ {
+ global_rotation = global_rotation * getParent()->getRotation();
+ }
+ return global_rotation;
}
const LLQuaternion LLViewerObject::getRotationEdit() const
{
- LLQuaternion global_rotation = getRotation();
- if (!((LLXform *)this)->isRootEdit())
- {
- global_rotation = global_rotation * getParent()->getRotation();
- }
- return global_rotation;
+ LLQuaternion global_rotation = getRotation();
+ if (!((LLXform *)this)->isRootEdit())
+ {
+ global_rotation = global_rotation * getParent()->getRotation();
+ }
+ return global_rotation;
}
void LLViewerObject::setPositionAbsoluteGlobal( const LLVector3d &pos_global, BOOL damped )
{
- if (isAttachment())
- {
- LLVector3 new_pos = mRegionp->getPosRegionFromGlobal(pos_global);
- if (isRootEdit())
- {
- new_pos -= mDrawable->mXform.getParent()->getWorldPosition();
- LLQuaternion world_rotation = mDrawable->mXform.getParent()->getWorldRotation();
- new_pos = new_pos * ~world_rotation;
- }
- else
- {
- LLViewerObject* parentp = (LLViewerObject*)getParent();
- new_pos -= parentp->getPositionAgent();
- new_pos = new_pos * ~parentp->getRotationRegion();
- }
- LLViewerObject::setPosition(new_pos);
-
- if (mParent && ((LLViewerObject*)mParent)->isAvatar())
- {
- // we have changed the position of an attachment, so we need to clamp it
- LLVOAvatar *avatar = (LLVOAvatar*)mParent;
-
- avatar->clampAttachmentPositions();
- }
- }
- else
- {
- if( isRoot() )
- {
- setPositionRegion(mRegionp->getPosRegionFromGlobal(pos_global));
- }
- else
- {
- // the relative position with the parent is not constant
- LLViewerObject* parent = (LLViewerObject *)getParent();
- //RN: this assumes we are only calling this function from the edit tools
- gPipeline.updateMoveNormalAsync(parent->mDrawable);
-
- LLVector3 pos_local = mRegionp->getPosRegionFromGlobal(pos_global) - parent->getPositionRegion();
- pos_local = pos_local * ~parent->getRotationRegion();
- LLViewerObject::setPosition( pos_local );
- }
- }
- //RN: assumes we always want to snap the object when calling this function
- gPipeline.updateMoveNormalAsync(mDrawable);
+ if (isAttachment())
+ {
+ LLVector3 new_pos = mRegionp->getPosRegionFromGlobal(pos_global);
+ if (isRootEdit())
+ {
+ new_pos -= mDrawable->mXform.getParent()->getWorldPosition();
+ LLQuaternion world_rotation = mDrawable->mXform.getParent()->getWorldRotation();
+ new_pos = new_pos * ~world_rotation;
+ }
+ else
+ {
+ LLViewerObject* parentp = (LLViewerObject*)getParent();
+ new_pos -= parentp->getPositionAgent();
+ new_pos = new_pos * ~parentp->getRotationRegion();
+ }
+ LLViewerObject::setPosition(new_pos);
+
+ if (mParent && ((LLViewerObject*)mParent)->isAvatar())
+ {
+ // we have changed the position of an attachment, so we need to clamp it
+ LLVOAvatar *avatar = (LLVOAvatar*)mParent;
+
+ avatar->clampAttachmentPositions();
+ }
+ }
+ else
+ {
+ if( isRoot() )
+ {
+ setPositionRegion(mRegionp->getPosRegionFromGlobal(pos_global));
+ }
+ else
+ {
+ // the relative position with the parent is not constant
+ LLViewerObject* parent = (LLViewerObject *)getParent();
+ //RN: this assumes we are only calling this function from the edit tools
+ gPipeline.updateMoveNormalAsync(parent->mDrawable);
+
+ LLVector3 pos_local = mRegionp->getPosRegionFromGlobal(pos_global) - parent->getPositionRegion();
+ pos_local = pos_local * ~parent->getRotationRegion();
+ LLViewerObject::setPosition( pos_local );
+ }
+ }
+ //RN: assumes we always want to snap the object when calling this function
+ gPipeline.updateMoveNormalAsync(mDrawable);
}
void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped)
{
- if (getPosition() != pos)
- {
- setChanged(TRANSLATED | SILHOUETTE);
- }
-
- LLXform::setPosition(pos);
- updateDrawable(damped);
- if (isRoot())
- {
- // position caches need to be up to date on root objects
- updatePositionCaches();
- }
+ if (getPosition() != pos)
+ {
+ setChanged(TRANSLATED | SILHOUETTE);
+ }
+
+ LLXform::setPosition(pos);
+ updateDrawable(damped);
+ if (isRoot())
+ {
+ // position caches need to be up to date on root objects
+ updatePositionCaches();
+ }
}
void LLViewerObject::setPositionGlobal(const LLVector3d &pos_global, BOOL damped)
{
- if (isAttachment())
- {
- if (isRootEdit())
- {
- LLVector3 newPos = mRegionp->getPosRegionFromGlobal(pos_global);
- newPos = newPos - mDrawable->mXform.getParent()->getWorldPosition();
-
- LLQuaternion invWorldRotation = mDrawable->mXform.getParent()->getWorldRotation();
- invWorldRotation.transQuat();
-
- newPos = newPos * invWorldRotation;
- LLViewerObject::setPosition(newPos);
- }
- else
- {
- // assumes parent is root editable (root of attachment)
- LLVector3 newPos = mRegionp->getPosRegionFromGlobal(pos_global);
- newPos = newPos - mDrawable->mXform.getParent()->getWorldPosition();
- LLVector3 delta_pos = newPos - getPosition();
-
- LLQuaternion invRotation = mDrawable->getRotation();
- invRotation.transQuat();
-
- delta_pos = delta_pos * invRotation;
-
- // *FIX: is this right? Shouldn't we be calling the
- // LLViewerObject version of setPosition?
- LLVector3 old_pos = mDrawable->mXform.getParent()->getPosition();
- mDrawable->mXform.getParent()->setPosition(old_pos + delta_pos);
- setChanged(TRANSLATED | SILHOUETTE);
- }
- if (mParent && ((LLViewerObject*)mParent)->isAvatar())
- {
- // we have changed the position of an attachment, so we need to clamp it
- LLVOAvatar *avatar = (LLVOAvatar*)mParent;
-
- avatar->clampAttachmentPositions();
- }
- }
- else
- {
- if (isRoot())
- {
- setPositionRegion(mRegionp->getPosRegionFromGlobal(pos_global));
- }
- else
- {
- // the relative position with the parent is constant, but the parent's position needs to be changed
- LLVector3d position_offset;
- position_offset.setVec(getPosition()*getParent()->getRotation());
- LLVector3d new_pos_global = pos_global - position_offset;
- ((LLViewerObject *)getParent())->setPositionGlobal(new_pos_global);
- }
- }
- updateDrawable(damped);
+ if (isAttachment())
+ {
+ if (isRootEdit())
+ {
+ LLVector3 newPos = mRegionp->getPosRegionFromGlobal(pos_global);
+ newPos = newPos - mDrawable->mXform.getParent()->getWorldPosition();
+
+ LLQuaternion invWorldRotation = mDrawable->mXform.getParent()->getWorldRotation();
+ invWorldRotation.transQuat();
+
+ newPos = newPos * invWorldRotation;
+ LLViewerObject::setPosition(newPos);
+ }
+ else
+ {
+ // assumes parent is root editable (root of attachment)
+ LLVector3 newPos = mRegionp->getPosRegionFromGlobal(pos_global);
+ newPos = newPos - mDrawable->mXform.getParent()->getWorldPosition();
+ LLVector3 delta_pos = newPos - getPosition();
+
+ LLQuaternion invRotation = mDrawable->getRotation();
+ invRotation.transQuat();
+
+ delta_pos = delta_pos * invRotation;
+
+ // *FIX: is this right? Shouldn't we be calling the
+ // LLViewerObject version of setPosition?
+ LLVector3 old_pos = mDrawable->mXform.getParent()->getPosition();
+ mDrawable->mXform.getParent()->setPosition(old_pos + delta_pos);
+ setChanged(TRANSLATED | SILHOUETTE);
+ }
+ if (mParent && ((LLViewerObject*)mParent)->isAvatar())
+ {
+ // we have changed the position of an attachment, so we need to clamp it
+ LLVOAvatar *avatar = (LLVOAvatar*)mParent;
+
+ avatar->clampAttachmentPositions();
+ }
+ }
+ else
+ {
+ if (isRoot())
+ {
+ setPositionRegion(mRegionp->getPosRegionFromGlobal(pos_global));
+ }
+ else
+ {
+ // the relative position with the parent is constant, but the parent's position needs to be changed
+ LLVector3d position_offset;
+ position_offset.setVec(getPosition()*getParent()->getRotation());
+ LLVector3d new_pos_global = pos_global - position_offset;
+ ((LLViewerObject *)getParent())->setPositionGlobal(new_pos_global);
+ }
+ }
+ updateDrawable(damped);
}
void LLViewerObject::setPositionParent(const LLVector3 &pos_parent, BOOL damped)
{
- // Set position relative to parent, if no parent, relative to region
- if (!isRoot())
- {
- LLViewerObject::setPosition(pos_parent, damped);
- //updateDrawable(damped);
- }
- else
- {
- setPositionRegion(pos_parent, damped);
- }
+ // Set position relative to parent, if no parent, relative to region
+ if (!isRoot())
+ {
+ LLViewerObject::setPosition(pos_parent, damped);
+ //updateDrawable(damped);
+ }
+ else
+ {
+ setPositionRegion(pos_parent, damped);
+ }
}
void LLViewerObject::setPositionRegion(const LLVector3 &pos_region, BOOL damped)
{
- if (!isRootEdit())
- {
- LLViewerObject* parent = (LLViewerObject*) getParent();
- LLViewerObject::setPosition((pos_region-parent->getPositionRegion())*~parent->getRotationRegion());
- }
- else
- {
- LLViewerObject::setPosition(pos_region);
- mPositionRegion = pos_region;
- mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion);
- }
+ if (!isRootEdit())
+ {
+ LLViewerObject* parent = (LLViewerObject*) getParent();
+ LLViewerObject::setPosition((pos_region-parent->getPositionRegion())*~parent->getRotationRegion());
+ }
+ else
+ {
+ LLViewerObject::setPosition(pos_region);
+ mPositionRegion = pos_region;
+ mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion);
+ }
}
void LLViewerObject::setPositionAgent(const LLVector3 &pos_agent, BOOL damped)
{
- LLVector3 pos_region = getRegion()->getPosRegionFromAgent(pos_agent);
- setPositionRegion(pos_region, damped);
+ LLVector3 pos_region = getRegion()->getPosRegionFromAgent(pos_agent);
+ setPositionRegion(pos_region, damped);
}
-// identical to setPositionRegion() except it checks for child-joints
+// identical to setPositionRegion() except it checks for child-joints
// and doesn't also move the joint-parent
// TODO -- implement similar intelligence for joint-parents toward
// their joint-children
void LLViewerObject::setPositionEdit(const LLVector3 &pos_edit, BOOL damped)
{
- if (!isRootEdit())
- {
- // the relative position with the parent is constant, but the parent's position needs to be changed
- LLVector3 position_offset = getPosition() * getParent()->getRotation();
+ if (!isRootEdit())
+ {
+ // the relative position with the parent is constant, but the parent's position needs to be changed
+ LLVector3 position_offset = getPosition() * getParent()->getRotation();
- ((LLViewerObject *)getParent())->setPositionEdit(pos_edit - position_offset);
- updateDrawable(damped);
- }
- else
- {
- LLViewerObject::setPosition(pos_edit, damped);
- mPositionRegion = pos_edit;
- mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion);
- }
+ ((LLViewerObject *)getParent())->setPositionEdit(pos_edit - position_offset);
+ updateDrawable(damped);
+ }
+ else
+ {
+ LLViewerObject::setPosition(pos_edit, damped);
+ mPositionRegion = pos_edit;
+ mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion);
+ }
}
LLViewerObject* LLViewerObject::getRootEdit() const
{
- const LLViewerObject* root = this;
- while (root->mParent
- && !((LLViewerObject*)root->mParent)->isAvatar())
- {
- root = (LLViewerObject*)root->mParent;
- }
- return (LLViewerObject*)root;
+ const LLViewerObject* root = this;
+ while (root->mParent
+ && !((LLViewerObject*)root->mParent)->isAvatar())
+ {
+ root = (LLViewerObject*)root->mParent;
+ }
+ return (LLViewerObject*)root;
}
BOOL LLViewerObject::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face,
- BOOL pick_transparent,
- BOOL pick_rigged,
+ S32 face,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
BOOL pick_unselectable,
- S32* face_hit,
- LLVector4a* intersection,
- LLVector2* tex_coord,
- LLVector4a* normal,
- LLVector4a* tangent)
+ S32* face_hit,
+ LLVector4a* intersection,
+ LLVector2* tex_coord,
+ LLVector4a* normal,
+ LLVector4a* tangent)
{
- return false;
+ return false;
}
BOOL LLViewerObject::lineSegmentBoundingBox(const LLVector4a& start, const LLVector4a& end)
{
- if (mDrawable.isNull() || mDrawable->isDead())
- {
- return FALSE;
- }
+ if (mDrawable.isNull() || mDrawable->isDead())
+ {
+ return FALSE;
+ }
- const LLVector4a* ext = mDrawable->getSpatialExtents();
+ const LLVector4a* ext = mDrawable->getSpatialExtents();
- //VECTORIZE THIS
- LLVector4a center;
- center.setAdd(ext[1], ext[0]);
- center.mul(0.5f);
- LLVector4a size;
- size.setSub(ext[1], ext[0]);
- size.mul(0.5f);
+ //VECTORIZE THIS
+ LLVector4a center;
+ center.setAdd(ext[1], ext[0]);
+ center.mul(0.5f);
+ LLVector4a size;
+ size.setSub(ext[1], ext[0]);
+ size.mul(0.5f);
- return LLLineSegmentBoxIntersect(start, end, center, size);
+ return LLLineSegmentBoxIntersect(start, end, center, size);
}
U8 LLViewerObject::getMediaType() const
{
- if (mMedia)
- {
- return mMedia->mMediaType;
- }
- else
- {
- return LLViewerObject::MEDIA_NONE;
- }
+ if (mMedia)
+ {
+ return mMedia->mMediaType;
+ }
+ else
+ {
+ return LLViewerObject::MEDIA_NONE;
+ }
}
void LLViewerObject::setMediaType(U8 media_type)
{
- if (!mMedia)
- {
- // TODO what if we don't have a media pointer?
- }
- else if (mMedia->mMediaType != media_type)
- {
- mMedia->mMediaType = media_type;
+ if (!mMedia)
+ {
+ // TODO what if we don't have a media pointer?
+ }
+ else if (mMedia->mMediaType != media_type)
+ {
+ mMedia->mMediaType = media_type;
- // TODO: update materials with new image
- }
+ // TODO: update materials with new image
+ }
}
std::string LLViewerObject::getMediaURL() const
{
- if (mMedia)
- {
- return mMedia->mMediaURL;
- }
- else
- {
- return std::string();
- }
+ if (mMedia)
+ {
+ return mMedia->mMediaURL;
+ }
+ else
+ {
+ return std::string();
+ }
}
void LLViewerObject::setMediaURL(const std::string& media_url)
{
- if (!mMedia)
- {
- mMedia = new LLViewerObjectMedia;
- mMedia->mMediaURL = media_url;
- mMedia->mPassedWhitelist = FALSE;
+ if (!mMedia)
+ {
+ mMedia = new LLViewerObjectMedia;
+ mMedia->mMediaURL = media_url;
+ mMedia->mPassedWhitelist = FALSE;
- // TODO: update materials with new image
- }
- else if (mMedia->mMediaURL != media_url)
- {
- mMedia->mMediaURL = media_url;
- mMedia->mPassedWhitelist = FALSE;
+ // TODO: update materials with new image
+ }
+ else if (mMedia->mMediaURL != media_url)
+ {
+ mMedia->mMediaURL = media_url;
+ mMedia->mPassedWhitelist = FALSE;
- // TODO: update materials with new image
- }
+ // TODO: update materials with new image
+ }
}
BOOL LLViewerObject::getMediaPassedWhitelist() const
{
- if (mMedia)
- {
- return mMedia->mPassedWhitelist;
- }
- else
- {
- return FALSE;
- }
+ if (mMedia)
+ {
+ return mMedia->mPassedWhitelist;
+ }
+ else
+ {
+ return FALSE;
+ }
}
void LLViewerObject::setMediaPassedWhitelist(BOOL passed)
{
- if (mMedia)
- {
- mMedia->mPassedWhitelist = passed;
- }
+ if (mMedia)
+ {
+ mMedia->mPassedWhitelist = passed;
+ }
}
BOOL LLViewerObject::setMaterial(const U8 material)
{
- BOOL res = LLPrimitive::setMaterial(material);
- if (res)
- {
- setChanged(TEXTURE);
- }
- return res;
+ BOOL res = LLPrimitive::setMaterial(material);
+ if (res)
+ {
+ setChanged(TEXTURE);
+ }
+ return res;
}
void LLViewerObject::setNumTEs(const U8 num_tes)
{
- U32 i;
- if (num_tes != getNumTEs())
- {
- if (num_tes)
- {
- LLPointer<LLViewerTexture> *new_images;
- new_images = new LLPointer<LLViewerTexture>[num_tes];
-
- LLPointer<LLViewerTexture> *new_normmaps;
- new_normmaps = new LLPointer<LLViewerTexture>[num_tes];
-
- LLPointer<LLViewerTexture> *new_specmaps;
- new_specmaps = new LLPointer<LLViewerTexture>[num_tes];
- for (i = 0; i < num_tes; i++)
- {
- if (i < getNumTEs())
- {
- new_images[i] = mTEImages[i];
- new_normmaps[i] = mTENormalMaps[i];
- new_specmaps[i] = mTESpecularMaps[i];
- }
- else if (getNumTEs())
- {
- new_images[i] = mTEImages[getNumTEs()-1];
- new_normmaps[i] = mTENormalMaps[getNumTEs()-1];
- new_specmaps[i] = mTESpecularMaps[getNumTEs()-1];
- }
- else
- {
- new_images[i] = NULL;
- new_normmaps[i] = NULL;
- new_specmaps[i] = NULL;
- }
- }
-
- deleteTEImages();
-
- mTEImages = new_images;
- mTENormalMaps = new_normmaps;
- mTESpecularMaps = new_specmaps;
- }
- else
- {
- deleteTEImages();
- }
+ U32 i;
+ if (num_tes != getNumTEs())
+ {
+ if (num_tes)
+ {
+ LLPointer<LLViewerTexture> *new_images;
+ new_images = new LLPointer<LLViewerTexture>[num_tes];
+
+ LLPointer<LLViewerTexture> *new_normmaps;
+ new_normmaps = new LLPointer<LLViewerTexture>[num_tes];
+
+ LLPointer<LLViewerTexture> *new_specmaps;
+ new_specmaps = new LLPointer<LLViewerTexture>[num_tes];
+ for (i = 0; i < num_tes; i++)
+ {
+ if (i < getNumTEs())
+ {
+ new_images[i] = mTEImages[i];
+ new_normmaps[i] = mTENormalMaps[i];
+ new_specmaps[i] = mTESpecularMaps[i];
+ }
+ else if (getNumTEs())
+ {
+ new_images[i] = mTEImages[getNumTEs()-1];
+ new_normmaps[i] = mTENormalMaps[getNumTEs()-1];
+ new_specmaps[i] = mTESpecularMaps[getNumTEs()-1];
+ }
+ else
+ {
+ new_images[i] = NULL;
+ new_normmaps[i] = NULL;
+ new_specmaps[i] = NULL;
+ }
+ }
+
+ deleteTEImages();
+
+ mTEImages = new_images;
+ mTENormalMaps = new_normmaps;
+ mTESpecularMaps = new_specmaps;
+ }
+ else
+ {
+ deleteTEImages();
+ }
S32 original_tes = getNumTEs();
- LLPrimitive::setNumTEs(num_tes);
- setChanged(TEXTURE);
+ LLPrimitive::setNumTEs(num_tes);
+ setChanged(TEXTURE);
// touch up GLTF materials
if (original_tes > 0)
@@ -4886,124 +4886,124 @@ void LLViewerObject::setNumTEs(const U8 num_tes)
}
}
- if (mDrawable.notNull())
- {
- gPipeline.markTextured(mDrawable);
- }
- }
+ if (mDrawable.notNull())
+ {
+ gPipeline.markTextured(mDrawable);
+ }
+ }
}
void LLViewerObject::sendMaterialUpdate() const
{
- LLViewerRegion* regionp = getRegion();
- if(!regionp) return;
- gMessageSystem->newMessageFast(_PREHASH_ObjectMaterial);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID );
- gMessageSystem->addU8Fast(_PREHASH_Material, getMaterial() );
- gMessageSystem->sendReliable( regionp->getHost() );
+ LLViewerRegion* regionp = getRegion();
+ if(!regionp) return;
+ gMessageSystem->newMessageFast(_PREHASH_ObjectMaterial);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID );
+ gMessageSystem->addU8Fast(_PREHASH_Material, getMaterial() );
+ gMessageSystem->sendReliable( regionp->getHost() );
}
//formerly send_object_shape(LLViewerObject *object)
void LLViewerObject::sendShapeUpdate()
{
- gMessageSystem->newMessageFast(_PREHASH_ObjectShape);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID );
+ gMessageSystem->newMessageFast(_PREHASH_ObjectShape);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID );
- LLVolumeMessage::packVolumeParams(&getVolume()->getParams(), gMessageSystem);
+ LLVolumeMessage::packVolumeParams(&getVolume()->getParams(), gMessageSystem);
- LLViewerRegion *regionp = getRegion();
- gMessageSystem->sendReliable( regionp->getHost() );
+ LLViewerRegion *regionp = getRegion();
+ gMessageSystem->sendReliable( regionp->getHost() );
}
void LLViewerObject::sendTEUpdate() const
{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ObjectImage);
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ObjectImage);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU32Fast(_PREHASH_ObjectLocalID, mLocalID );
- if (mMedia)
- {
- msg->addString("MediaURL", mMedia->mMediaURL);
- }
- else
- {
- msg->addString("MediaURL", NULL);
- }
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addU32Fast(_PREHASH_ObjectLocalID, mLocalID );
+ if (mMedia)
+ {
+ msg->addString("MediaURL", mMedia->mMediaURL);
+ }
+ else
+ {
+ msg->addString("MediaURL", NULL);
+ }
- // TODO send media type
+ // TODO send media type
- packTEMessage(msg);
+ packTEMessage(msg);
- LLViewerRegion *regionp = getRegion();
- msg->sendReliable( regionp->getHost() );
+ LLViewerRegion *regionp = getRegion();
+ msg->sendReliable( regionp->getHost() );
}
LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id)
{
- if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id))
- {
- return NULL;
- }
-
- LLViewerObject *root = getRootEdit();
- if (root && root->isAnimatedObject())
- {
- return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- }
-
- LLVOAvatar* avatar = getAvatar();
- if (avatar && !isHUDAttachment())
- {
- LLAvatarAppearanceDefines::EBakedTextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id);
- LLViewerTexture* bakedTexture = avatar->getBakedTexture(texIndex);
- if (bakedTexture == NULL || bakedTexture->isMissingAsset())
- {
- return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- }
- else
- {
- return bakedTexture;
- }
- }
- else
- {
- return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- }
+ if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id))
+ {
+ return NULL;
+ }
+
+ LLViewerObject *root = getRootEdit();
+ if (root && root->isAnimatedObject())
+ {
+ return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ }
+
+ LLVOAvatar* avatar = getAvatar();
+ if (avatar && !isHUDAttachment())
+ {
+ LLAvatarAppearanceDefines::EBakedTextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id);
+ LLViewerTexture* bakedTexture = avatar->getBakedTexture(texIndex);
+ if (bakedTexture == NULL || bakedTexture->isMissingAsset())
+ {
+ return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ }
+ else
+ {
+ return bakedTexture;
+ }
+ }
+ else
+ {
+ return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ }
}
void LLViewerObject::updateAvatarMeshVisibility(const LLUUID& id, const LLUUID& old_id)
{
- if (id == old_id)
- {
- return;
- }
+ if (id == old_id)
+ {
+ return;
+ }
- if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(old_id) && !LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id))
- {
- return;
- }
+ if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(old_id) && !LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id))
+ {
+ return;
+ }
- LLVOAvatar* avatar = getAvatar();
- if (avatar)
- {
- avatar->updateMeshVisibility();
- }
+ LLVOAvatar* avatar = getAvatar();
+ if (avatar)
+ {
+ avatar->updateMeshVisibility();
+ }
}
@@ -5028,14 +5028,14 @@ void LLViewerObject::setTE(const U8 te, const LLTextureEntry& texture_entry)
void LLViewerObject::updateTEMaterialTextures(U8 te)
{
- if (getTE(te)->getMaterialParams().notNull())
- {
- const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID();
- mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
-
- const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID();
- mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- }
+ if (getTE(te)->getMaterialParams().notNull())
+ {
+ const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID();
+ mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+
+ const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID();
+ mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ }
LLFetchedGLTFMaterial* mat = (LLFetchedGLTFMaterial*) getTE(te)->getGLTFRenderMaterial();
llassert(mat == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(getTE(te)->getGLTFRenderMaterial()) != nullptr);
@@ -5095,355 +5095,355 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)
void LLViewerObject::refreshBakeTexture()
{
- for (int face_index = 0; face_index < getNumTEs(); face_index++)
- {
- LLTextureEntry* tex_entry = getTE(face_index);
- if (tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID()))
- {
- const LLUUID& image_id = tex_entry->getID();
- LLViewerTexture* bakedTexture = getBakedTextureForMagicId(image_id);
- changeTEImage(face_index, bakedTexture);
- }
- }
+ for (int face_index = 0; face_index < getNumTEs(); face_index++)
+ {
+ LLTextureEntry* tex_entry = getTE(face_index);
+ if (tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID()))
+ {
+ const LLUUID& image_id = tex_entry->getID();
+ LLViewerTexture* bakedTexture = getBakedTextureForMagicId(image_id);
+ changeTEImage(face_index, bakedTexture);
+ }
+ }
}
void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep)
{
- if (mTEImages[te] != imagep)
- {
- LLUUID old_image_id = getTE(te) ? getTE(te)->getID() : LLUUID::null;
-
- LLPrimitive::setTETexture(te, imagep->getID());
+ if (mTEImages[te] != imagep)
+ {
+ LLUUID old_image_id = getTE(te) ? getTE(te)->getID() : LLUUID::null;
+
+ LLPrimitive::setTETexture(te, imagep->getID());
- LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID());
- mTEImages[te] = baked_texture ? baked_texture : imagep;
- updateAvatarMeshVisibility(imagep->getID(), old_image_id);
- setChanged(TEXTURE);
- if (mDrawable.notNull())
- {
- gPipeline.markTextured(mDrawable);
- }
- }
+ LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID());
+ mTEImages[te] = baked_texture ? baked_texture : imagep;
+ updateAvatarMeshVisibility(imagep->getID(), old_image_id);
+ setChanged(TEXTURE);
+ if (mDrawable.notNull())
+ {
+ gPipeline.markTextured(mDrawable);
+ }
+ }
}
S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image)
{
- LLUUID old_image_id = getTE(te)->getID();
- const LLUUID& uuid = image ? image->getID() : LLUUID::null;
- S32 retval = 0;
- if (uuid != getTE(te)->getID() ||
- uuid == LLUUID::null)
- {
- retval = LLPrimitive::setTETexture(te, uuid);
- LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid);
- mTEImages[te] = baked_texture ? baked_texture : image;
- updateAvatarMeshVisibility(uuid,old_image_id);
- setChanged(TEXTURE);
- if (mDrawable.notNull())
- {
- gPipeline.markTextured(mDrawable);
- }
- }
- return retval;
+ LLUUID old_image_id = getTE(te)->getID();
+ const LLUUID& uuid = image ? image->getID() : LLUUID::null;
+ S32 retval = 0;
+ if (uuid != getTE(te)->getID() ||
+ uuid == LLUUID::null)
+ {
+ retval = LLPrimitive::setTETexture(te, uuid);
+ LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid);
+ mTEImages[te] = baked_texture ? baked_texture : image;
+ updateAvatarMeshVisibility(uuid,old_image_id);
+ setChanged(TEXTURE);
+ if (mDrawable.notNull())
+ {
+ gPipeline.markTextured(mDrawable);
+ }
+ }
+ return retval;
}
S32 LLViewerObject::setTENormalMapCore(const U8 te, LLViewerTexture *image)
{
- S32 retval = TEM_CHANGE_TEXTURE;
- const LLUUID& uuid = image ? image->getID() : LLUUID::null;
- if (uuid != getTE(te)->getID() ||
- uuid == LLUUID::null)
- {
- LLTextureEntry* tep = getTE(te);
- LLMaterial* mat = NULL;
- if (tep)
- {
- mat = tep->getMaterialParams();
- }
-
- if (mat)
- {
- mat->setNormalID(uuid);
- }
- }
- changeTENormalMap(te,image);
- return retval;
+ S32 retval = TEM_CHANGE_TEXTURE;
+ const LLUUID& uuid = image ? image->getID() : LLUUID::null;
+ if (uuid != getTE(te)->getID() ||
+ uuid == LLUUID::null)
+ {
+ LLTextureEntry* tep = getTE(te);
+ LLMaterial* mat = NULL;
+ if (tep)
+ {
+ mat = tep->getMaterialParams();
+ }
+
+ if (mat)
+ {
+ mat->setNormalID(uuid);
+ }
+ }
+ changeTENormalMap(te,image);
+ return retval;
}
S32 LLViewerObject::setTESpecularMapCore(const U8 te, LLViewerTexture *image)
{
- S32 retval = TEM_CHANGE_TEXTURE;
- const LLUUID& uuid = image ? image->getID() : LLUUID::null;
- if (uuid != getTE(te)->getID() ||
- uuid == LLUUID::null)
- {
- LLTextureEntry* tep = getTE(te);
- LLMaterial* mat = NULL;
- if (tep)
- {
- mat = tep->getMaterialParams();
- }
-
- if (mat)
- {
- mat->setSpecularID(uuid);
- }
- }
- changeTESpecularMap(te, image);
- return retval;
+ S32 retval = TEM_CHANGE_TEXTURE;
+ const LLUUID& uuid = image ? image->getID() : LLUUID::null;
+ if (uuid != getTE(te)->getID() ||
+ uuid == LLUUID::null)
+ {
+ LLTextureEntry* tep = getTE(te);
+ LLMaterial* mat = NULL;
+ if (tep)
+ {
+ mat = tep->getMaterialParams();
+ }
+
+ if (mat)
+ {
+ mat->setSpecularID(uuid);
+ }
+ }
+ changeTESpecularMap(te, image);
+ return retval;
}
//virtual
-void LLViewerObject::changeTEImage(S32 index, LLViewerTexture* new_image)
+void LLViewerObject::changeTEImage(S32 index, LLViewerTexture* new_image)
{
- if(index < 0 || index >= getNumTEs())
- {
- return ;
- }
- mTEImages[index] = new_image ;
+ if(index < 0 || index >= getNumTEs())
+ {
+ return ;
+ }
+ mTEImages[index] = new_image ;
}
void LLViewerObject::changeTENormalMap(S32 index, LLViewerTexture* new_image)
{
- if(index < 0 || index >= getNumTEs())
- {
- return ;
- }
- mTENormalMaps[index] = new_image ;
- refreshMaterials();
+ if(index < 0 || index >= getNumTEs())
+ {
+ return ;
+ }
+ mTENormalMaps[index] = new_image ;
+ refreshMaterials();
}
void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image)
{
- if(index < 0 || index >= getNumTEs())
- {
- return ;
- }
- mTESpecularMaps[index] = new_image ;
- refreshMaterials();
+ if(index < 0 || index >= getNumTEs())
+ {
+ return ;
+ }
+ mTESpecularMaps[index] = new_image ;
+ refreshMaterials();
}
S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid)
{
- // Invalid host == get from the agent's sim
- LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(
- uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
- return setTETextureCore(te, image);
+ // Invalid host == get from the agent's sim
+ LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(
+ uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
+ return setTETextureCore(te, image);
}
S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid)
{
- LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
- uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
- return setTENormalMapCore(te, image);
+ LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
+ uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
+ return setTENormalMapCore(te, image);
}
S32 LLViewerObject::setTESpecularMap(const U8 te, const LLUUID& uuid)
{
- LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
- uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
- return setTESpecularMapCore(te, image);
+ LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
+ uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
+ return setTESpecularMapCore(te, image);
}
S32 LLViewerObject::setTEColor(const U8 te, const LLColor3& color)
{
- return setTEColor(te, LLColor4(color));
+ return setTEColor(te, LLColor4(color));
}
S32 LLViewerObject::setTEColor(const U8 te, const LLColor4& color)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (color != tep->getColor())
- {
- retval = LLPrimitive::setTEColor(te, color);
- if (mDrawable.notNull() && retval)
- {
- // These should only happen on updates which are not the initial update.
- dirtyMesh();
- }
- }
- return retval;
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ }
+ else if (color != tep->getColor())
+ {
+ retval = LLPrimitive::setTEColor(te, color);
+ if (mDrawable.notNull() && retval)
+ {
+ // These should only happen on updates which are not the initial update.
+ dirtyMesh();
+ }
+ }
+ return retval;
}
S32 LLViewerObject::setTEBumpmap(const U8 te, const U8 bump)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (bump != tep->getBumpmap())
- {
- retval = LLPrimitive::setTEBumpmap(te, bump);
- setChanged(TEXTURE);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markTextured(mDrawable);
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
- }
- }
- return retval;
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ }
+ else if (bump != tep->getBumpmap())
+ {
+ retval = LLPrimitive::setTEBumpmap(te, bump);
+ setChanged(TEXTURE);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markTextured(mDrawable);
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
+ }
+ }
+ return retval;
}
S32 LLViewerObject::setTETexGen(const U8 te, const U8 texgen)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (texgen != tep->getTexGen())
- {
- retval = LLPrimitive::setTETexGen(te, texgen);
- setChanged(TEXTURE);
- }
- return retval;
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ }
+ else if (texgen != tep->getTexGen())
+ {
+ retval = LLPrimitive::setTETexGen(te, texgen);
+ setChanged(TEXTURE);
+ }
+ return retval;
}
S32 LLViewerObject::setTEMediaTexGen(const U8 te, const U8 media)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (media != tep->getMediaTexGen())
- {
- retval = LLPrimitive::setTEMediaTexGen(te, media);
- setChanged(TEXTURE);
- }
- return retval;
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ }
+ else if (media != tep->getMediaTexGen())
+ {
+ retval = LLPrimitive::setTEMediaTexGen(te, media);
+ setChanged(TEXTURE);
+ }
+ return retval;
}
S32 LLViewerObject::setTEShiny(const U8 te, const U8 shiny)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (shiny != tep->getShiny())
- {
- retval = LLPrimitive::setTEShiny(te, shiny);
- setChanged(TEXTURE);
- }
- return retval;
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ }
+ else if (shiny != tep->getShiny())
+ {
+ retval = LLPrimitive::setTEShiny(te, shiny);
+ setChanged(TEXTURE);
+ }
+ return retval;
}
S32 LLViewerObject::setTEFullbright(const U8 te, const U8 fullbright)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (fullbright != tep->getFullbright())
- {
- retval = LLPrimitive::setTEFullbright(te, fullbright);
- setChanged(TEXTURE);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markTextured(mDrawable);
- }
- }
- return retval;
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ }
+ else if (fullbright != tep->getFullbright())
+ {
+ retval = LLPrimitive::setTEFullbright(te, fullbright);
+ setChanged(TEXTURE);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markTextured(mDrawable);
+ }
+ }
+ return retval;
}
S32 LLViewerObject::setTEMediaFlags(const U8 te, const U8 media_flags)
{
- // this might need work for media type
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (media_flags != tep->getMediaFlags())
- {
- retval = LLPrimitive::setTEMediaFlags(te, media_flags);
- setChanged(TEXTURE);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
- gPipeline.markTextured(mDrawable);
- }
- }
- return retval;
+ // this might need work for media type
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ }
+ else if (media_flags != tep->getMediaFlags())
+ {
+ retval = LLPrimitive::setTEMediaFlags(te, media_flags);
+ setChanged(TEXTURE);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ gPipeline.markTextured(mDrawable);
+ }
+ }
+ return retval;
}
S32 LLViewerObject::setTEGlow(const U8 te, const F32 glow)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (glow != tep->getGlow())
- {
- retval = LLPrimitive::setTEGlow(te, glow);
- setChanged(TEXTURE);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markTextured(mDrawable);
- }
- }
- return retval;
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ }
+ else if (glow != tep->getGlow())
+ {
+ retval = LLPrimitive::setTEGlow(te, glow);
+ setChanged(TEXTURE);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markTextured(mDrawable);
+ }
+ }
+ return retval;
}
S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS("Material") << "No texture entry for te " << (S32)te
- << ", object " << mID
- << ", material " << pMaterialID
- << LL_ENDL;
- }
- //else if (pMaterialID != tep->getMaterialID())
- {
- LL_DEBUGS("Material") << "Changing texture entry for te " << (S32)te
- << ", object " << mID
- << ", material " << pMaterialID
- << LL_ENDL;
- retval = LLPrimitive::setTEMaterialID(te, pMaterialID);
- refreshMaterials();
- }
- return retval;
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS("Material") << "No texture entry for te " << (S32)te
+ << ", object " << mID
+ << ", material " << pMaterialID
+ << LL_ENDL;
+ }
+ //else if (pMaterialID != tep->getMaterialID())
+ {
+ LL_DEBUGS("Material") << "Changing texture entry for te " << (S32)te
+ << ", object " << mID
+ << ", material " << pMaterialID
+ << LL_ENDL;
+ retval = LLPrimitive::setTEMaterialID(te, pMaterialID);
+ refreshMaterials();
+ }
+ return retval;
}
S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- return 0;
- }
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ return 0;
+ }
- retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams);
- LL_DEBUGS("Material") << "Changing material params for te " << (S32)te
- << ", object " << mID
- << " (" << retval << ")"
- << LL_ENDL;
- setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null);
- setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null);
+ retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams);
+ LL_DEBUGS("Material") << "Changing material params for te " << (S32)te
+ << ", object " << mID
+ << " (" << retval << ")"
+ << LL_ENDL;
+ setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null);
+ setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null);
- return retval;
+ return retval;
}
S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_mat)
@@ -5503,287 +5503,287 @@ S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_ma
void LLViewerObject::refreshMaterials()
{
- setChanged(TEXTURE);
- if (mDrawable.notNull())
- {
- gPipeline.markTextured(mDrawable);
- }
+ setChanged(TEXTURE);
+ if (mDrawable.notNull())
+ {
+ gPipeline.markTextured(mDrawable);
+ }
}
S32 LLViewerObject::setTEScale(const U8 te, const F32 s, const F32 t)
{
- S32 retval = 0;
- retval = LLPrimitive::setTEScale(te, s, t);
- setChanged(TEXTURE);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
- }
- return retval;
+ S32 retval = 0;
+ retval = LLPrimitive::setTEScale(te, s, t);
+ setChanged(TEXTURE);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ }
+ return retval;
}
S32 LLViewerObject::setTEScaleS(const U8 te, const F32 s)
{
- S32 retval = LLPrimitive::setTEScaleS(te, s);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
- }
+ S32 retval = LLPrimitive::setTEScaleS(te, s);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ }
- return retval;
+ return retval;
}
S32 LLViewerObject::setTEScaleT(const U8 te, const F32 t)
{
- S32 retval = LLPrimitive::setTEScaleT(te, t);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
- }
+ S32 retval = LLPrimitive::setTEScaleT(te, t);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ }
- return retval;
+ return retval;
}
S32 LLViewerObject::setTEOffset(const U8 te, const F32 s, const F32 t)
{
- S32 retval = LLPrimitive::setTEOffset(te, s, t);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
- }
- return retval;
+ S32 retval = LLPrimitive::setTEOffset(te, s, t);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ }
+ return retval;
}
S32 LLViewerObject::setTEOffsetS(const U8 te, const F32 s)
{
- S32 retval = LLPrimitive::setTEOffsetS(te, s);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
- }
+ S32 retval = LLPrimitive::setTEOffsetS(te, s);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ }
- return retval;
+ return retval;
}
S32 LLViewerObject::setTEOffsetT(const U8 te, const F32 t)
{
- S32 retval = LLPrimitive::setTEOffsetT(te, t);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
- }
+ S32 retval = LLPrimitive::setTEOffsetT(te, t);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ }
- return retval;
+ return retval;
}
S32 LLViewerObject::setTERotation(const U8 te, const F32 r)
{
- S32 retval = LLPrimitive::setTERotation(te, r);
- if (mDrawable.notNull() && retval)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ S32 retval = LLPrimitive::setTERotation(te, r);
+ if (mDrawable.notNull() && retval)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
shrinkWrap();
- }
- return retval;
+ }
+ return retval;
}
LLViewerTexture *LLViewerObject::getTEImage(const U8 face) const
{
-// llassert(mTEImages);
+// llassert(mTEImages);
- if (face < getNumTEs())
- {
- LLViewerTexture* image = mTEImages[face];
- if (image)
- {
- return image;
- }
- else
- {
- return (LLViewerTexture*)(LLViewerFetchedTexture::sDefaultImagep);
- }
- }
+ if (face < getNumTEs())
+ {
+ LLViewerTexture* image = mTEImages[face];
+ if (image)
+ {
+ return image;
+ }
+ else
+ {
+ return (LLViewerTexture*)(LLViewerFetchedTexture::sDefaultImagep);
+ }
+ }
- LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL;
+ LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL;
- return NULL;
+ return NULL;
}
bool LLViewerObject::isImageAlphaBlended(const U8 te) const
{
- LLViewerTexture* image = getTEImage(te);
- LLGLenum format = image ? image->getPrimaryFormat() : GL_RGB;
- switch (format)
- {
- case GL_RGBA:
- case GL_ALPHA:
- {
- return true;
- }
- break;
+ LLViewerTexture* image = getTEImage(te);
+ LLGLenum format = image ? image->getPrimaryFormat() : GL_RGB;
+ switch (format)
+ {
+ case GL_RGBA:
+ case GL_ALPHA:
+ {
+ return true;
+ }
+ break;
- case GL_RGB: break;
- default:
- {
- LL_WARNS() << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << LL_ENDL;
- }
- break;
- }
+ case GL_RGB: break;
+ default:
+ {
+ LL_WARNS() << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << LL_ENDL;
+ }
+ break;
+ }
- return false;
+ return false;
}
LLViewerTexture *LLViewerObject::getTENormalMap(const U8 face) const
{
- // llassert(mTEImages);
-
- if (face < getNumTEs())
- {
- LLViewerTexture* image = mTENormalMaps[face];
- if (image)
- {
- return image;
- }
- else
- {
- return (LLViewerTexture*)(LLViewerFetchedTexture::sDefaultImagep);
- }
- }
-
- LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL;
-
- return NULL;
+ // llassert(mTEImages);
+
+ if (face < getNumTEs())
+ {
+ LLViewerTexture* image = mTENormalMaps[face];
+ if (image)
+ {
+ return image;
+ }
+ else
+ {
+ return (LLViewerTexture*)(LLViewerFetchedTexture::sDefaultImagep);
+ }
+ }
+
+ LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL;
+
+ return NULL;
}
LLViewerTexture *LLViewerObject::getTESpecularMap(const U8 face) const
{
- // llassert(mTEImages);
-
- if (face < getNumTEs())
- {
- LLViewerTexture* image = mTESpecularMaps[face];
- if (image)
- {
- return image;
- }
- else
- {
- return (LLViewerTexture*)(LLViewerFetchedTexture::sDefaultImagep);
- }
- }
-
- LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL;
-
- return NULL;
+ // llassert(mTEImages);
+
+ if (face < getNumTEs())
+ {
+ LLViewerTexture* image = mTESpecularMaps[face];
+ if (image)
+ {
+ return image;
+ }
+ else
+ {
+ return (LLViewerTexture*)(LLViewerFetchedTexture::sDefaultImagep);
+ }
+ }
+
+ LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL;
+
+ return NULL;
}
void LLViewerObject::fitFaceTexture(const U8 face)
{
- LL_INFOS() << "fitFaceTexture not implemented" << LL_ENDL;
+ LL_INFOS() << "fitFaceTexture not implemented" << LL_ENDL;
}
LLBBox LLViewerObject::getBoundingBoxAgent() const
{
- LLVector3 position_agent;
- LLQuaternion rot;
- LLViewerObject* avatar_parent = NULL;
- LLViewerObject* root_edit = (LLViewerObject*)getRootEdit();
- if (root_edit)
- {
- avatar_parent = (LLViewerObject*)root_edit->getParent();
- }
-
- if (avatar_parent && avatar_parent->isAvatar() &&
- root_edit && root_edit->mDrawable.notNull() && root_edit->mDrawable->getXform()->getParent())
- {
- LLXform* parent_xform = root_edit->mDrawable->getXform()->getParent();
- position_agent = (getPositionEdit() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();
- rot = getRotationEdit() * parent_xform->getWorldRotation();
- }
- else
- {
- position_agent = getPositionAgent();
- rot = getRotationRegion();
- }
-
- return LLBBox( position_agent, rot, getScale() * -0.5f, getScale() * 0.5f );
+ LLVector3 position_agent;
+ LLQuaternion rot;
+ LLViewerObject* avatar_parent = NULL;
+ LLViewerObject* root_edit = (LLViewerObject*)getRootEdit();
+ if (root_edit)
+ {
+ avatar_parent = (LLViewerObject*)root_edit->getParent();
+ }
+
+ if (avatar_parent && avatar_parent->isAvatar() &&
+ root_edit && root_edit->mDrawable.notNull() && root_edit->mDrawable->getXform()->getParent())
+ {
+ LLXform* parent_xform = root_edit->mDrawable->getXform()->getParent();
+ position_agent = (getPositionEdit() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();
+ rot = getRotationEdit() * parent_xform->getWorldRotation();
+ }
+ else
+ {
+ position_agent = getPositionAgent();
+ rot = getRotationRegion();
+ }
+
+ return LLBBox( position_agent, rot, getScale() * -0.5f, getScale() * 0.5f );
}
U32 LLViewerObject::getNumVertices() const
{
- U32 num_vertices = 0;
- if (mDrawable.notNull())
- {
- S32 i, num_faces;
- num_faces = mDrawable->getNumFaces();
- for (i = 0; i < num_faces; i++)
- {
- LLFace * facep = mDrawable->getFace(i);
- if (facep)
- {
- num_vertices += facep->getGeomCount();
- }
- }
- }
- return num_vertices;
+ U32 num_vertices = 0;
+ if (mDrawable.notNull())
+ {
+ S32 i, num_faces;
+ num_faces = mDrawable->getNumFaces();
+ for (i = 0; i < num_faces; i++)
+ {
+ LLFace * facep = mDrawable->getFace(i);
+ if (facep)
+ {
+ num_vertices += facep->getGeomCount();
+ }
+ }
+ }
+ return num_vertices;
}
U32 LLViewerObject::getNumIndices() const
{
- U32 num_indices = 0;
- if (mDrawable.notNull())
- {
- S32 i, num_faces;
- num_faces = mDrawable->getNumFaces();
- for (i = 0; i < num_faces; i++)
- {
- LLFace * facep = mDrawable->getFace(i);
- if (facep)
- {
- num_indices += facep->getIndicesCount();
- }
- }
- }
- return num_indices;
+ U32 num_indices = 0;
+ if (mDrawable.notNull())
+ {
+ S32 i, num_faces;
+ num_faces = mDrawable->getNumFaces();
+ for (i = 0; i < num_faces; i++)
+ {
+ LLFace * facep = mDrawable->getFace(i);
+ if (facep)
+ {
+ num_indices += facep->getIndicesCount();
+ }
+ }
+ }
+ return num_indices;
}
// Find the number of instances of this object's inventory that are of the given type
S32 LLViewerObject::countInventoryContents(LLAssetType::EType type)
{
- S32 count = 0;
- if( mInventory )
- {
- LLInventoryObject::object_list_t::const_iterator it = mInventory->begin();
- LLInventoryObject::object_list_t::const_iterator end = mInventory->end();
- for( ; it != end ; ++it )
- {
- if( (*it)->getType() == type )
- {
- ++count;
- }
- }
- }
- return count;
+ S32 count = 0;
+ if( mInventory )
+ {
+ LLInventoryObject::object_list_t::const_iterator it = mInventory->begin();
+ LLInventoryObject::object_list_t::const_iterator end = mInventory->end();
+ for( ; it != end ; ++it )
+ {
+ if( (*it)->getType() == type )
+ {
+ ++count;
+ }
+ }
+ }
+ return count;
}
void LLViewerObject::setDebugText(const std::string &utf8text, const LLColor4& color)
{
- if (utf8text.empty() && !mText)
- {
- return;
- }
+ if (utf8text.empty() && !mText)
+ {
+ return;
+ }
- if (!mText)
- {
- initHudText();
- }
- mText->setColor(color);
- mText->setString(utf8text);
- mText->setZCompare(FALSE);
- mText->setDoFade(FALSE);
- updateText();
+ if (!mText)
+ {
+ initHudText();
+ }
+ mText->setColor(color);
+ mText->setString(utf8text);
+ mText->setZCompare(FALSE);
+ mText->setDoFade(FALSE);
+ updateText();
}
void LLViewerObject::appendDebugText(const std::string &utf8text)
@@ -5842,98 +5842,98 @@ void LLViewerObject::restoreHudText()
void LLViewerObject::setIcon(LLViewerTexture* icon_image)
{
- if (!mIcon)
- {
- mIcon = (LLHUDIcon *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_ICON);
- mIcon->setSourceObject(this);
- mIcon->setImage(icon_image);
- // *TODO: make this user configurable
- mIcon->setScale(0.03f);
- }
- else
- {
- mIcon->restartLifeTimer();
- }
+ if (!mIcon)
+ {
+ mIcon = (LLHUDIcon *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_ICON);
+ mIcon->setSourceObject(this);
+ mIcon->setImage(icon_image);
+ // *TODO: make this user configurable
+ mIcon->setScale(0.03f);
+ }
+ else
+ {
+ mIcon->restartLifeTimer();
+ }
}
void LLViewerObject::clearIcon()
{
- if (mIcon)
- {
- mIcon = NULL;
- }
+ if (mIcon)
+ {
+ mIcon = NULL;
+ }
}
-LLViewerObject* LLViewerObject::getSubParent()
-{
- return (LLViewerObject*) getParent();
+LLViewerObject* LLViewerObject::getSubParent()
+{
+ return (LLViewerObject*) getParent();
}
const LLViewerObject* LLViewerObject::getSubParent() const
{
- return (const LLViewerObject*) getParent();
+ return (const LLViewerObject*) getParent();
}
BOOL LLViewerObject::isOnMap()
{
- return mOnMap;
+ return mOnMap;
}
void LLViewerObject::updateText()
{
- if (!isDead())
- {
- if (mText.notNull())
- {
- LLVOAvatar* avatar = getAvatar();
- if (avatar)
- {
- mText->setHidden(avatar->isInMuteList());
- }
-
- LLVector3 up_offset(0,0,0);
- up_offset.mV[2] = getScale().mV[VZ]*0.6f;
-
- if (mDrawable.notNull())
- {
- mText->setPositionAgent(getRenderPosition() + up_offset);
- }
- else
- {
- mText->setPositionAgent(getPositionAgent() + up_offset);
- }
- }
- }
+ if (!isDead())
+ {
+ if (mText.notNull())
+ {
+ LLVOAvatar* avatar = getAvatar();
+ if (avatar)
+ {
+ mText->setHidden(avatar->isInMuteList());
+ }
+
+ LLVector3 up_offset(0,0,0);
+ up_offset.mV[2] = getScale().mV[VZ]*0.6f;
+
+ if (mDrawable.notNull())
+ {
+ mText->setPositionAgent(getRenderPosition() + up_offset);
+ }
+ else
+ {
+ mText->setPositionAgent(getPositionAgent() + up_offset);
+ }
+ }
+ }
}
bool LLViewerObject::isOwnerInMuteList(LLUUID id)
{
- LLUUID owner_id = id.isNull() ? mOwnerID : id;
- if (isAvatar() || owner_id.isNull())
- {
- return false;
- }
- bool muted = false;
- F64 now = LLFrameTimer::getTotalSeconds();
- if (now < mCachedMuteListUpdateTime)
- {
- muted = mCachedOwnerInMuteList;
- }
- else
- {
- muted = LLMuteList::getInstance()->isMuted(owner_id);
-
- const F64 SECONDS_BETWEEN_MUTE_UPDATES = 1;
- mCachedMuteListUpdateTime = now + SECONDS_BETWEEN_MUTE_UPDATES;
- mCachedOwnerInMuteList = muted;
- }
- return muted;
+ LLUUID owner_id = id.isNull() ? mOwnerID : id;
+ if (isAvatar() || owner_id.isNull())
+ {
+ return false;
+ }
+ bool muted = false;
+ F64 now = LLFrameTimer::getTotalSeconds();
+ if (now < mCachedMuteListUpdateTime)
+ {
+ muted = mCachedOwnerInMuteList;
+ }
+ else
+ {
+ muted = LLMuteList::getInstance()->isMuted(owner_id);
+
+ const F64 SECONDS_BETWEEN_MUTE_UPDATES = 1;
+ mCachedMuteListUpdateTime = now + SECONDS_BETWEEN_MUTE_UPDATES;
+ mCachedOwnerInMuteList = muted;
+ }
+ return muted;
}
LLVOAvatar* LLViewerObject::asAvatar()
{
- return NULL;
+ return NULL;
}
// If this object is directly or indirectly parented by an avatar,
@@ -5945,348 +5945,348 @@ LLVOAvatar* LLViewerObject::asAvatar()
// attached.
LLVOAvatar* LLViewerObject::getAvatarAncestor()
{
- LLViewerObject *pobj = (LLViewerObject*) getParent();
- while (pobj)
- {
- LLVOAvatar *av = pobj->asAvatar();
- if (av)
- {
- return av;
- }
- pobj = (LLViewerObject*) pobj->getParent();
- }
- return NULL;
+ LLViewerObject *pobj = (LLViewerObject*) getParent();
+ while (pobj)
+ {
+ LLVOAvatar *av = pobj->asAvatar();
+ if (av)
+ {
+ return av;
+ }
+ pobj = (LLViewerObject*) pobj->getParent();
+ }
+ return NULL;
}
BOOL LLViewerObject::isParticleSource() const
{
- return !mPartSourcep.isNull() && !mPartSourcep->isDead();
+ return !mPartSourcep.isNull() && !mPartSourcep->isDead();
}
void LLViewerObject::setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id)
{
- if (mPartSourcep)
- {
- deleteParticleSource();
- }
-
- LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::createPSS(this, particle_parameters);
- mPartSourcep = pss;
-
- if (mPartSourcep)
- {
- mPartSourcep->setOwnerUUID(owner_id);
-
- if (mPartSourcep->getImage()->getID() != mPartSourcep->mPartSysData.mPartImageID)
- {
- LLViewerTexture* image;
- if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null)
- {
- image = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.tga");
- }
- else
- {
- image = LLViewerTextureManager::getFetchedTexture(mPartSourcep->mPartSysData.mPartImageID);
- }
- mPartSourcep->setImage(image);
- }
- }
- LLViewerPartSim::getInstance()->addPartSource(pss);
+ if (mPartSourcep)
+ {
+ deleteParticleSource();
+ }
+
+ LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::createPSS(this, particle_parameters);
+ mPartSourcep = pss;
+
+ if (mPartSourcep)
+ {
+ mPartSourcep->setOwnerUUID(owner_id);
+
+ if (mPartSourcep->getImage()->getID() != mPartSourcep->mPartSysData.mPartImageID)
+ {
+ LLViewerTexture* image;
+ if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null)
+ {
+ image = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.tga");
+ }
+ else
+ {
+ image = LLViewerTextureManager::getFetchedTexture(mPartSourcep->mPartSysData.mPartImageID);
+ }
+ mPartSourcep->setImage(image);
+ }
+ }
+ LLViewerPartSim::getInstance()->addPartSource(pss);
}
void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& owner_id)
{
- if (!mPartSourcep.isNull() && mPartSourcep->isDead())
- {
- mPartSourcep = NULL;
- }
- if (mPartSourcep)
- {
- // If we've got one already, just update the existing source (or remove it)
- if (!LLViewerPartSourceScript::unpackPSS(this, mPartSourcep, block_num))
- {
- mPartSourcep->setDead();
- mPartSourcep = NULL;
- }
- }
- else
- {
- LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, block_num);
- //If the owner is muted, don't create the system
- if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return;
-
- // We need to be able to deal with a particle source that hasn't changed, but still got an update!
- if (pss)
- {
-// LL_INFOS() << "Making particle system with owner " << owner_id << LL_ENDL;
- pss->setOwnerUUID(owner_id);
- mPartSourcep = pss;
- LLViewerPartSim::getInstance()->addPartSource(pss);
- }
- }
- if (mPartSourcep)
- {
- if (mPartSourcep->getImage()->getID() != mPartSourcep->mPartSysData.mPartImageID)
- {
- LLViewerTexture* image;
- if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null)
- {
- image = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
- }
- else
- {
- image = LLViewerTextureManager::getFetchedTexture(mPartSourcep->mPartSysData.mPartImageID);
- }
- mPartSourcep->setImage(image);
- }
- }
+ if (!mPartSourcep.isNull() && mPartSourcep->isDead())
+ {
+ mPartSourcep = NULL;
+ }
+ if (mPartSourcep)
+ {
+ // If we've got one already, just update the existing source (or remove it)
+ if (!LLViewerPartSourceScript::unpackPSS(this, mPartSourcep, block_num))
+ {
+ mPartSourcep->setDead();
+ mPartSourcep = NULL;
+ }
+ }
+ else
+ {
+ LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, block_num);
+ //If the owner is muted, don't create the system
+ if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return;
+
+ // We need to be able to deal with a particle source that hasn't changed, but still got an update!
+ if (pss)
+ {
+// LL_INFOS() << "Making particle system with owner " << owner_id << LL_ENDL;
+ pss->setOwnerUUID(owner_id);
+ mPartSourcep = pss;
+ LLViewerPartSim::getInstance()->addPartSource(pss);
+ }
+ }
+ if (mPartSourcep)
+ {
+ if (mPartSourcep->getImage()->getID() != mPartSourcep->mPartSysData.mPartImageID)
+ {
+ LLViewerTexture* image;
+ if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null)
+ {
+ image = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
+ }
+ else
+ {
+ image = LLViewerTextureManager::getFetchedTexture(mPartSourcep->mPartSysData.mPartImageID);
+ }
+ mPartSourcep->setImage(image);
+ }
+ }
}
void LLViewerObject::unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id, bool legacy)
{
- if (!mPartSourcep.isNull() && mPartSourcep->isDead())
- {
- mPartSourcep = NULL;
- }
- if (mPartSourcep)
- {
- // If we've got one already, just update the existing source (or remove it)
- if (!LLViewerPartSourceScript::unpackPSS(this, mPartSourcep, dp, legacy))
- {
- mPartSourcep->setDead();
- mPartSourcep = NULL;
- }
- }
- else
- {
- LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, dp, legacy);
- //If the owner is muted, don't create the system
- if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return;
- // We need to be able to deal with a particle source that hasn't changed, but still got an update!
- if (pss)
- {
-// LL_INFOS() << "Making particle system with owner " << owner_id << LL_ENDL;
- pss->setOwnerUUID(owner_id);
- mPartSourcep = pss;
- LLViewerPartSim::getInstance()->addPartSource(pss);
- }
- }
- if (mPartSourcep)
- {
- if (mPartSourcep->getImage()->getID() != mPartSourcep->mPartSysData.mPartImageID)
- {
- LLViewerTexture* image;
- if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null)
- {
- image = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
- }
- else
- {
- image = LLViewerTextureManager::getFetchedTexture(mPartSourcep->mPartSysData.mPartImageID);
- }
- mPartSourcep->setImage(image);
- }
- }
+ if (!mPartSourcep.isNull() && mPartSourcep->isDead())
+ {
+ mPartSourcep = NULL;
+ }
+ if (mPartSourcep)
+ {
+ // If we've got one already, just update the existing source (or remove it)
+ if (!LLViewerPartSourceScript::unpackPSS(this, mPartSourcep, dp, legacy))
+ {
+ mPartSourcep->setDead();
+ mPartSourcep = NULL;
+ }
+ }
+ else
+ {
+ LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, dp, legacy);
+ //If the owner is muted, don't create the system
+ if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return;
+ // We need to be able to deal with a particle source that hasn't changed, but still got an update!
+ if (pss)
+ {
+// LL_INFOS() << "Making particle system with owner " << owner_id << LL_ENDL;
+ pss->setOwnerUUID(owner_id);
+ mPartSourcep = pss;
+ LLViewerPartSim::getInstance()->addPartSource(pss);
+ }
+ }
+ if (mPartSourcep)
+ {
+ if (mPartSourcep->getImage()->getID() != mPartSourcep->mPartSysData.mPartImageID)
+ {
+ LLViewerTexture* image;
+ if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null)
+ {
+ image = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
+ }
+ else
+ {
+ image = LLViewerTextureManager::getFetchedTexture(mPartSourcep->mPartSysData.mPartImageID);
+ }
+ mPartSourcep->setImage(image);
+ }
+ }
}
void LLViewerObject::deleteParticleSource()
{
- if (mPartSourcep.notNull())
- {
- mPartSourcep->setDead();
- mPartSourcep = NULL;
- }
+ if (mPartSourcep.notNull())
+ {
+ mPartSourcep->setDead();
+ mPartSourcep = NULL;
+ }
}
// virtual
void LLViewerObject::updateDrawable(BOOL force_damped)
{
- if (!isChanged(MOVED))
- { //most common case, having an empty if case here makes for better branch prediction
- }
- else if (mDrawable.notNull() &&
- !mDrawable->isState(LLDrawable::ON_MOVE_LIST))
- {
- BOOL damped_motion =
- !isChanged(SHIFTED) && // not shifted between regions this frame and...
- ( force_damped || // ...forced into damped motion by application logic or...
- ( !isSelected() && // ...not selected and...
- ( mDrawable->isRoot() || // ... is root or ...
- (getParent() && !((LLViewerObject*)getParent())->isSelected())// ... parent is not selected and ...
- ) &&
- getPCode() == LL_PCODE_VOLUME && // ...is a volume object and...
- getVelocity().isExactlyZero() && // ...is not moving physically and...
- mDrawable->getGeneration() != -1 // ...was not created this frame.
- )
- );
- gPipeline.markMoved(mDrawable, damped_motion);
- }
- clearChanged(SHIFTED);
+ if (!isChanged(MOVED))
+ { //most common case, having an empty if case here makes for better branch prediction
+ }
+ else if (mDrawable.notNull() &&
+ !mDrawable->isState(LLDrawable::ON_MOVE_LIST))
+ {
+ BOOL damped_motion =
+ !isChanged(SHIFTED) && // not shifted between regions this frame and...
+ ( force_damped || // ...forced into damped motion by application logic or...
+ ( !isSelected() && // ...not selected and...
+ ( mDrawable->isRoot() || // ... is root or ...
+ (getParent() && !((LLViewerObject*)getParent())->isSelected())// ... parent is not selected and ...
+ ) &&
+ getPCode() == LL_PCODE_VOLUME && // ...is a volume object and...
+ getVelocity().isExactlyZero() && // ...is not moving physically and...
+ mDrawable->getGeneration() != -1 // ...was not created this frame.
+ )
+ );
+ gPipeline.markMoved(mDrawable, damped_motion);
+ }
+ clearChanged(SHIFTED);
}
// virtual, overridden by LLVOVolume
F32 LLViewerObject::getVObjRadius() const
{
- return mDrawable.notNull() ? mDrawable->getRadius() : 0.f;
+ return mDrawable.notNull() ? mDrawable->getRadius() : 0.f;
}
void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain, const U8 flags)
{
- if (!gAudiop)
- {
- return;
- }
-
- if (audio_uuid.isNull())
- {
- if (!mAudioSourcep)
- {
- return;
- }
- if (mAudioSourcep->isLoop() && !mAudioSourcep->hasPendingPreloads())
- {
- // We don't clear the sound if it's a loop, it'll go away on its own.
- // At least, this appears to be how the scripts work.
- // The attached sound ID is set to NULL to avoid it playing back when the
- // object rezzes in on non-looping sounds.
- //LL_INFOS() << "Clearing attached sound " << mAudioSourcep->getCurrentData()->getID() << LL_ENDL;
- gAudiop->cleanupAudioSource(mAudioSourcep);
- mAudioSourcep = NULL;
- }
- else if (flags & LL_SOUND_FLAG_STOP)
- {
- // Just shut off the sound
- mAudioSourcep->stop();
- }
- return;
- }
- if (flags & LL_SOUND_FLAG_LOOP
- && mAudioSourcep && mAudioSourcep->isLoop() && mAudioSourcep->getCurrentData()
- && mAudioSourcep->getCurrentData()->getID() == audio_uuid)
- {
- //LL_INFOS() << "Already playing this sound on a loop, ignoring" << LL_ENDL;
- return;
- }
-
- // don't clean up before previous sound is done. Solves: SL-33486
- if ( mAudioSourcep && mAudioSourcep->isDone() )
- {
- gAudiop->cleanupAudioSource(mAudioSourcep);
- mAudioSourcep = NULL;
- }
-
- if (mAudioSourcep && mAudioSourcep->isMuted() &&
- mAudioSourcep->getCurrentData() && mAudioSourcep->getCurrentData()->getID() == audio_uuid)
- {
- //LL_INFOS() << "Already having this sound as muted sound, ignoring" << LL_ENDL;
- return;
- }
-
- getAudioSource(owner_id);
-
- if (mAudioSourcep)
- {
- BOOL queue = flags & LL_SOUND_FLAG_QUEUE;
- mAudioGain = gain;
- mAudioSourcep->setGain(gain);
- mAudioSourcep->setLoop(flags & LL_SOUND_FLAG_LOOP);
- mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER);
- mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE);
- mAudioSourcep->setQueueSounds(queue);
- if(!queue) // stop any current sound first to avoid "farts of doom" (SL-1541) -MG
- {
- mAudioSourcep->stop();
- }
-
- // Play this sound if region maturity permits
- if( gAgent.canAccessMaturityAtGlobal(this->getPositionGlobal()) )
- {
- //LL_INFOS() << "Playing attached sound " << audio_uuid << LL_ENDL;
- // recheck cutoff radius in case this update was an object-update with new value
- mAudioSourcep->checkCutOffRadius();
- mAudioSourcep->play(audio_uuid);
- }
- }
+ if (!gAudiop)
+ {
+ return;
+ }
+
+ if (audio_uuid.isNull())
+ {
+ if (!mAudioSourcep)
+ {
+ return;
+ }
+ if (mAudioSourcep->isLoop() && !mAudioSourcep->hasPendingPreloads())
+ {
+ // We don't clear the sound if it's a loop, it'll go away on its own.
+ // At least, this appears to be how the scripts work.
+ // The attached sound ID is set to NULL to avoid it playing back when the
+ // object rezzes in on non-looping sounds.
+ //LL_INFOS() << "Clearing attached sound " << mAudioSourcep->getCurrentData()->getID() << LL_ENDL;
+ gAudiop->cleanupAudioSource(mAudioSourcep);
+ mAudioSourcep = NULL;
+ }
+ else if (flags & LL_SOUND_FLAG_STOP)
+ {
+ // Just shut off the sound
+ mAudioSourcep->stop();
+ }
+ return;
+ }
+ if (flags & LL_SOUND_FLAG_LOOP
+ && mAudioSourcep && mAudioSourcep->isLoop() && mAudioSourcep->getCurrentData()
+ && mAudioSourcep->getCurrentData()->getID() == audio_uuid)
+ {
+ //LL_INFOS() << "Already playing this sound on a loop, ignoring" << LL_ENDL;
+ return;
+ }
+
+ // don't clean up before previous sound is done. Solves: SL-33486
+ if ( mAudioSourcep && mAudioSourcep->isDone() )
+ {
+ gAudiop->cleanupAudioSource(mAudioSourcep);
+ mAudioSourcep = NULL;
+ }
+
+ if (mAudioSourcep && mAudioSourcep->isMuted() &&
+ mAudioSourcep->getCurrentData() && mAudioSourcep->getCurrentData()->getID() == audio_uuid)
+ {
+ //LL_INFOS() << "Already having this sound as muted sound, ignoring" << LL_ENDL;
+ return;
+ }
+
+ getAudioSource(owner_id);
+
+ if (mAudioSourcep)
+ {
+ BOOL queue = flags & LL_SOUND_FLAG_QUEUE;
+ mAudioGain = gain;
+ mAudioSourcep->setGain(gain);
+ mAudioSourcep->setLoop(flags & LL_SOUND_FLAG_LOOP);
+ mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER);
+ mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE);
+ mAudioSourcep->setQueueSounds(queue);
+ if(!queue) // stop any current sound first to avoid "farts of doom" (SL-1541) -MG
+ {
+ mAudioSourcep->stop();
+ }
+
+ // Play this sound if region maturity permits
+ if( gAgent.canAccessMaturityAtGlobal(this->getPositionGlobal()) )
+ {
+ //LL_INFOS() << "Playing attached sound " << audio_uuid << LL_ENDL;
+ // recheck cutoff radius in case this update was an object-update with new value
+ mAudioSourcep->checkCutOffRadius();
+ mAudioSourcep->play(audio_uuid);
+ }
+ }
}
LLAudioSource *LLViewerObject::getAudioSource(const LLUUID& owner_id)
{
- if (!mAudioSourcep)
- {
- // Arbitrary low gain for a sound that's not playing.
- // This is used for sound preloads, for example.
- LLAudioSourceVO *asvop = new LLAudioSourceVO(mID, owner_id, 0.01f, this);
+ if (!mAudioSourcep)
+ {
+ // Arbitrary low gain for a sound that's not playing.
+ // This is used for sound preloads, for example.
+ LLAudioSourceVO *asvop = new LLAudioSourceVO(mID, owner_id, 0.01f, this);
- mAudioSourcep = asvop;
- if(gAudiop)
- {
- gAudiop->addAudioSource(asvop);
- }
- }
+ mAudioSourcep = asvop;
+ if(gAudiop)
+ {
+ gAudiop->addAudioSource(asvop);
+ }
+ }
- return mAudioSourcep;
+ return mAudioSourcep;
}
void LLViewerObject::adjustAudioGain(const F32 gain)
{
- if (mAudioSourcep)
- {
- mAudioGain = gain;
- mAudioSourcep->setGain(mAudioGain);
- }
+ if (mAudioSourcep)
+ {
+ mAudioGain = gain;
+ mAudioSourcep->setGain(mAudioGain);
+ }
}
//----------------------------------------------------------------------------
bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp)
{
- if (LLNetworkData::PARAMS_MESH == param_type)
- {
- param_type = LLNetworkData::PARAMS_SCULPT;
- }
- ExtraParameter* param = getExtraParameterEntryCreate(param_type);
- if (param)
- {
- param->data->unpack(*dp);
- param->in_use = TRUE;
- parameterChanged(param_type, param->data, TRUE, false);
- return true;
- }
- else
- {
- return false;
- }
+ if (LLNetworkData::PARAMS_MESH == param_type)
+ {
+ param_type = LLNetworkData::PARAMS_SCULPT;
+ }
+ ExtraParameter* param = getExtraParameterEntryCreate(param_type);
+ if (param)
+ {
+ param->data->unpack(*dp);
+ param->in_use = TRUE;
+ parameterChanged(param_type, param->data, TRUE, false);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 param_type)
{
- LLNetworkData* new_block = NULL;
- switch (param_type)
- {
- case LLNetworkData::PARAMS_FLEXIBLE:
- {
- new_block = new LLFlexibleObjectData();
- break;
- }
- case LLNetworkData::PARAMS_LIGHT:
- {
- new_block = new LLLightParams();
- break;
- }
- case LLNetworkData::PARAMS_SCULPT:
- {
- new_block = new LLSculptParams();
- break;
- }
- case LLNetworkData::PARAMS_LIGHT_IMAGE:
- {
- new_block = new LLLightImageParams();
- break;
- }
+ LLNetworkData* new_block = NULL;
+ switch (param_type)
+ {
+ case LLNetworkData::PARAMS_FLEXIBLE:
+ {
+ new_block = new LLFlexibleObjectData();
+ break;
+ }
+ case LLNetworkData::PARAMS_LIGHT:
+ {
+ new_block = new LLLightParams();
+ break;
+ }
+ case LLNetworkData::PARAMS_SCULPT:
+ {
+ new_block = new LLSculptParams();
+ break;
+ }
+ case LLNetworkData::PARAMS_LIGHT_IMAGE:
+ {
+ new_block = new LLLightImageParams();
+ break;
+ }
case LLNetworkData::PARAMS_EXTENDED_MESH:
{
- new_block = new LLExtendedMeshParams();
- break;
+ new_block = new LLExtendedMeshParams();
+ break;
}
case LLNetworkData::PARAMS_RENDER_MATERIAL:
{
@@ -6298,90 +6298,90 @@ LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 para
new_block = new LLReflectionProbeParams();
break;
}
- default:
- {
- LL_INFOS_ONCE() << "Unknown param type: " << param_type << LL_ENDL;
- break;
- }
- };
-
- if (new_block)
- {
- ExtraParameter* new_entry = new ExtraParameter;
- new_entry->data = new_block;
- new_entry->in_use = false; // not in use yet
+ default:
+ {
+ LL_INFOS_ONCE() << "Unknown param type: " << param_type << LL_ENDL;
+ break;
+ }
+ };
+
+ if (new_block)
+ {
+ ExtraParameter* new_entry = new ExtraParameter;
+ new_entry->data = new_block;
+ new_entry->in_use = false; // not in use yet
llassert(mExtraParameterList[param_type] == nullptr); // leak -- redundantly allocated parameter entry
- mExtraParameterList[param_type] = new_entry;
- return new_entry;
- }
- return NULL;
+ mExtraParameterList[param_type] = new_entry;
+ return new_entry;
+ }
+ return NULL;
}
LLViewerObject::ExtraParameter* LLViewerObject::getExtraParameterEntry(U16 param_type) const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VIEWER;
- std::unordered_map<U16, ExtraParameter*>::const_iterator itor = mExtraParameterList.find(param_type);
- if (itor != mExtraParameterList.end())
- {
- return itor->second;
- }
- return NULL;
+ std::unordered_map<U16, ExtraParameter*>::const_iterator itor = mExtraParameterList.find(param_type);
+ if (itor != mExtraParameterList.end())
+ {
+ return itor->second;
+ }
+ return NULL;
}
LLViewerObject::ExtraParameter* LLViewerObject::getExtraParameterEntryCreate(U16 param_type)
{
- ExtraParameter* param = getExtraParameterEntry(param_type);
- if (!param)
- {
- param = createNewParameterEntry(param_type);
- }
- return param;
+ ExtraParameter* param = getExtraParameterEntry(param_type);
+ if (!param)
+ {
+ param = createNewParameterEntry(param_type);
+ }
+ return param;
}
LLNetworkData* LLViewerObject::getParameterEntry(U16 param_type) const
{
- ExtraParameter* param = getExtraParameterEntry(param_type);
- if (param)
- {
- return param->data;
- }
- else
- {
- return NULL;
- }
+ ExtraParameter* param = getExtraParameterEntry(param_type);
+ if (param)
+ {
+ return param->data;
+ }
+ else
+ {
+ return NULL;
+ }
}
BOOL LLViewerObject::getParameterEntryInUse(U16 param_type) const
{
- ExtraParameter* param = getExtraParameterEntry(param_type);
- if (param)
- {
- return param->in_use;
- }
- else
- {
- return FALSE;
- }
+ ExtraParameter* param = getExtraParameterEntry(param_type);
+ if (param)
+ {
+ return param->in_use;
+ }
+ else
+ {
+ return FALSE;
+ }
}
bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin)
{
- ExtraParameter* param = getExtraParameterEntryCreate(param_type);
- if (param)
- {
- if (param->in_use && new_value == *(param->data))
- {
- return false;
- }
- param->in_use = true;
- param->data->copy(new_value);
- parameterChanged(param_type, param->data, TRUE, local_origin);
- return true;
- }
- else
- {
- return false;
- }
+ ExtraParameter* param = getExtraParameterEntryCreate(param_type);
+ if (param)
+ {
+ if (param->in_use && new_value == *(param->data))
+ {
+ return false;
+ }
+ param->in_use = true;
+ param->data->copy(new_value);
+ parameterChanged(param_type, param->data, TRUE, local_origin);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
// Assumed to be called locally
@@ -6389,65 +6389,65 @@ bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_
// Should always return true.
bool LLViewerObject::setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin)
{
- ExtraParameter* param = getExtraParameterEntryCreate(param_type);
- if (param && param->in_use != in_use)
- {
- param->in_use = in_use;
- parameterChanged(param_type, param->data, in_use, local_origin);
- return true;
- }
- return false;
+ ExtraParameter* param = getExtraParameterEntryCreate(param_type);
+ if (param && param->in_use != in_use)
+ {
+ param->in_use = in_use;
+ parameterChanged(param_type, param->data, in_use, local_origin);
+ return true;
+ }
+ return false;
}
void LLViewerObject::parameterChanged(U16 param_type, bool local_origin)
{
- ExtraParameter* param = getExtraParameterEntry(param_type);
- if (param)
- {
- parameterChanged(param_type, param->data, param->in_use, local_origin);
- }
+ ExtraParameter* param = getExtraParameterEntry(param_type);
+ if (param)
+ {
+ parameterChanged(param_type, param->data, param->in_use, local_origin);
+ }
}
void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin)
{
- if (local_origin)
- {
+ if (local_origin)
+ {
// *NOTE: Do not send the render material ID in this way as it will get
// out-of-sync with other sent client data.
// See LLViewerObject::setRenderMaterialID and LLGLTFMaterialList
llassert(param_type != LLNetworkData::PARAMS_RENDER_MATERIAL);
- LLViewerRegion* regionp = getRegion();
- if(!regionp) return;
-
- // Change happened on the viewer. Send the change up
- U8 tmp[MAX_OBJECT_PARAMS_SIZE];
- LLDataPackerBinaryBuffer dpb(tmp, MAX_OBJECT_PARAMS_SIZE);
- if (data->pack(dpb))
- {
- U32 datasize = (U32)dpb.getCurrentSize();
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ObjectExtraParams);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU32Fast(_PREHASH_ObjectLocalID, mLocalID );
-
- msg->addU16Fast(_PREHASH_ParamType, param_type);
- msg->addBOOLFast(_PREHASH_ParamInUse, in_use);
-
- msg->addU32Fast(_PREHASH_ParamSize, datasize);
- msg->addBinaryDataFast(_PREHASH_ParamData, tmp, datasize);
-
- msg->sendReliable( regionp->getHost() );
- }
- else
- {
- LL_WARNS() << "Failed to send object extra parameters: " << param_type << LL_ENDL;
- }
- }
+ LLViewerRegion* regionp = getRegion();
+ if(!regionp) return;
+
+ // Change happened on the viewer. Send the change up
+ U8 tmp[MAX_OBJECT_PARAMS_SIZE];
+ LLDataPackerBinaryBuffer dpb(tmp, MAX_OBJECT_PARAMS_SIZE);
+ if (data->pack(dpb))
+ {
+ U32 datasize = (U32)dpb.getCurrentSize();
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ObjectExtraParams);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addU32Fast(_PREHASH_ObjectLocalID, mLocalID );
+
+ msg->addU16Fast(_PREHASH_ParamType, param_type);
+ msg->addBOOLFast(_PREHASH_ParamInUse, in_use);
+
+ msg->addU32Fast(_PREHASH_ParamSize, datasize);
+ msg->addBinaryDataFast(_PREHASH_ParamData, tmp, datasize);
+
+ msg->sendReliable( regionp->getHost() );
+ }
+ else
+ {
+ LL_WARNS() << "Failed to send object extra parameters: " << param_type << LL_ENDL;
+ }
+ }
else
{
if (param_type == LLNetworkData::PARAMS_RENDER_MATERIAL)
@@ -6460,256 +6460,256 @@ void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, BOOL
void LLViewerObject::setDrawableState(U32 state, BOOL recursive)
{
- if (mDrawable)
- {
- mDrawable->setState(state);
- }
- if (recursive)
- {
- for (child_list_t::iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- child->setDrawableState(state, recursive);
- }
- }
+ if (mDrawable)
+ {
+ mDrawable->setState(state);
+ }
+ if (recursive)
+ {
+ for (child_list_t::iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ child->setDrawableState(state, recursive);
+ }
+ }
}
void LLViewerObject::clearDrawableState(U32 state, BOOL recursive)
{
- if (mDrawable)
- {
- mDrawable->clearState(state);
- }
- if (recursive)
- {
- for (child_list_t::iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- child->clearDrawableState(state, recursive);
- }
- }
+ if (mDrawable)
+ {
+ mDrawable->clearState(state);
+ }
+ if (recursive)
+ {
+ for (child_list_t::iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ child->clearDrawableState(state, recursive);
+ }
+ }
}
BOOL LLViewerObject::isDrawableState(U32 state, BOOL recursive) const
{
- BOOL matches = FALSE;
- if (mDrawable)
- {
- matches = mDrawable->isState(state);
- }
- if (recursive)
- {
- for (child_list_t::const_iterator iter = mChildList.begin();
- (iter != mChildList.end()) && matches; iter++)
- {
- LLViewerObject* child = *iter;
- matches &= child->isDrawableState(state, recursive);
- }
- }
+ BOOL matches = FALSE;
+ if (mDrawable)
+ {
+ matches = mDrawable->isState(state);
+ }
+ if (recursive)
+ {
+ for (child_list_t::const_iterator iter = mChildList.begin();
+ (iter != mChildList.end()) && matches; iter++)
+ {
+ LLViewerObject* child = *iter;
+ matches &= child->isDrawableState(state, recursive);
+ }
+ }
- return matches;
+ return matches;
}
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-// RN: these functions assume a 2-level hierarchy
+// RN: these functions assume a 2-level hierarchy
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Owned by anyone?
BOOL LLViewerObject::permAnyOwner() const
-{
- if (isRootEdit())
- {
- return flagObjectAnyOwner();
- }
- else
- {
- return ((LLViewerObject*)getParent())->permAnyOwner();
- }
-}
+{
+ if (isRootEdit())
+ {
+ return flagObjectAnyOwner();
+ }
+ else
+ {
+ return ((LLViewerObject*)getParent())->permAnyOwner();
+ }
+}
// Owned by this viewer?
BOOL LLViewerObject::permYouOwner() const
-{
- if (isRootEdit())
- {
+{
+ if (isRootEdit())
+ {
#ifdef HACKED_GODLIKE_VIEWER
- return TRUE;
+ return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLGridManager::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
- {
- return TRUE;
- }
+ {
+ return TRUE;
+ }
# endif
- return flagObjectYouOwner();
+ return flagObjectYouOwner();
#endif
- }
- else
- {
- return ((LLViewerObject*)getParent())->permYouOwner();
- }
+ }
+ else
+ {
+ return ((LLViewerObject*)getParent())->permYouOwner();
+ }
}
// Owned by a group?
-BOOL LLViewerObject::permGroupOwner() const
-{
- if (isRootEdit())
- {
- return flagObjectGroupOwned();
- }
- else
- {
- return ((LLViewerObject*)getParent())->permGroupOwner();
- }
+BOOL LLViewerObject::permGroupOwner() const
+{
+ if (isRootEdit())
+ {
+ return flagObjectGroupOwned();
+ }
+ else
+ {
+ return ((LLViewerObject*)getParent())->permGroupOwner();
+ }
}
// Can the owner edit
BOOL LLViewerObject::permOwnerModify() const
-{
- if (isRootEdit())
- {
+{
+ if (isRootEdit())
+ {
#ifdef HACKED_GODLIKE_VIEWER
- return TRUE;
+ return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLGridManager::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
- {
- return TRUE;
- }
+ {
+ return TRUE;
+ }
# endif
- return flagObjectOwnerModify();
+ return flagObjectOwnerModify();
#endif
- }
- else
- {
- return ((LLViewerObject*)getParent())->permOwnerModify();
- }
+ }
+ else
+ {
+ return ((LLViewerObject*)getParent())->permOwnerModify();
+ }
}
// Can edit
BOOL LLViewerObject::permModify() const
-{
- if (isRootEdit())
- {
+{
+ if (isRootEdit())
+ {
#ifdef HACKED_GODLIKE_VIEWER
- return TRUE;
+ return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLGridManager::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
- {
- return TRUE;
- }
+ {
+ return TRUE;
+ }
# endif
- return flagObjectModify();
+ return flagObjectModify();
#endif
- }
- else
- {
- return ((LLViewerObject*)getParent())->permModify();
- }
+ }
+ else
+ {
+ return ((LLViewerObject*)getParent())->permModify();
+ }
}
// Can copy
BOOL LLViewerObject::permCopy() const
-{
- if (isRootEdit())
- {
+{
+ if (isRootEdit())
+ {
#ifdef HACKED_GODLIKE_VIEWER
- return TRUE;
+ return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLGridManager::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
- {
- return TRUE;
- }
+ {
+ return TRUE;
+ }
# endif
- return flagObjectCopy();
+ return flagObjectCopy();
#endif
- }
- else
- {
- return ((LLViewerObject*)getParent())->permCopy();
- }
+ }
+ else
+ {
+ return ((LLViewerObject*)getParent())->permCopy();
+ }
}
// Can move
BOOL LLViewerObject::permMove() const
{
- if (isRootEdit())
- {
+ if (isRootEdit())
+ {
#ifdef HACKED_GODLIKE_VIEWER
- return TRUE;
+ return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLGridManager::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
- {
- return TRUE;
- }
+ {
+ return TRUE;
+ }
# endif
- return flagObjectMove();
+ return flagObjectMove();
#endif
- }
- else
- {
- return ((LLViewerObject*)getParent())->permMove();
- }
+ }
+ else
+ {
+ return ((LLViewerObject*)getParent())->permMove();
+ }
}
// Can be transferred
BOOL LLViewerObject::permTransfer() const
-{
- if (isRootEdit())
- {
+{
+ if (isRootEdit())
+ {
#ifdef HACKED_GODLIKE_VIEWER
- return TRUE;
+ return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLGridManager::getInstance()->isInProductionGrid()
+ if (!LLGridManager::getInstance()->isInProductionGrid()
&& (gAgent.getGodLevel() >= GOD_MAINTENANCE))
- {
- return TRUE;
- }
+ {
+ return TRUE;
+ }
# endif
- return flagObjectTransfer();
+ return flagObjectTransfer();
#endif
- }
- else
- {
- return ((LLViewerObject*)getParent())->permTransfer();
- }
+ }
+ else
+ {
+ return ((LLViewerObject*)getParent())->permTransfer();
+ }
}
// Can only open objects that you own, or that someone has
// given you modify rights to. JC
BOOL LLViewerObject::allowOpen() const
{
- return !flagInventoryEmpty() && (permYouOwner() || permModify());
+ return !flagInventoryEmpty() && (permYouOwner() || permModify());
}
LLViewerObject::LLInventoryCallbackInfo::~LLInventoryCallbackInfo()
{
- if (mListener)
- {
- mListener->clearVOInventoryListener();
- }
+ if (mListener)
+ {
+ mListener->clearVOInventoryListener();
+ }
}
void LLViewerObject::updateVolume(const LLVolumeParams& volume_params)
{
- if (setVolume(volume_params, 1)) // *FIX: magic number, ack!
- {
- // Transmit the update to the simulator
- sendShapeUpdate();
- markForUpdate();
- }
+ if (setVolume(volume_params, 1)) // *FIX: magic number, ack!
+ {
+ // Transmit the update to the simulator
+ sendShapeUpdate();
+ markForUpdate();
+ }
}
void LLViewerObject::recursiveMarkForUpdate()
@@ -6725,259 +6725,259 @@ void LLViewerObject::recursiveMarkForUpdate()
void LLViewerObject::markForUpdate()
{
- if (mDrawable.notNull())
- {
- gPipeline.markTextured(mDrawable);
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
- }
+ if (mDrawable.notNull())
+ {
+ gPipeline.markTextured(mDrawable);
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
+ }
}
bool LLViewerObject::isPermanentEnforced() const
{
- return flagObjectPermanent() && (mRegionp != gAgent.getRegion()) && !gAgent.isGodlike();
+ return flagObjectPermanent() && (mRegionp != gAgent.getRegion()) && !gAgent.isGodlike();
}
bool LLViewerObject::getIncludeInSearch() const
{
- return flagIncludeInSearch();
+ return flagIncludeInSearch();
}
void LLViewerObject::setIncludeInSearch(bool include_in_search)
{
- setFlags(FLAGS_INCLUDE_IN_SEARCH, include_in_search);
+ setFlags(FLAGS_INCLUDE_IN_SEARCH, include_in_search);
}
void LLViewerObject::setRegion(LLViewerRegion *regionp)
{
- if (!regionp)
- {
- LL_WARNS() << "viewer object set region to NULL" << LL_ENDL;
- }
- if(regionp != mRegionp)
- {
- if(mRegionp)
- {
- mRegionp->removeFromCreatedList(getLocalID());
- }
- if(regionp)
- {
- regionp->addToCreatedList(getLocalID());
- }
- }
-
- mLatestRecvPacketID = 0;
- mRegionp = regionp;
-
- for (child_list_t::iterator i = mChildList.begin(); i != mChildList.end(); ++i)
- {
- LLViewerObject* child = *i;
- child->setRegion(regionp);
- }
+ if (!regionp)
+ {
+ LL_WARNS() << "viewer object set region to NULL" << LL_ENDL;
+ }
+ if(regionp != mRegionp)
+ {
+ if(mRegionp)
+ {
+ mRegionp->removeFromCreatedList(getLocalID());
+ }
+ if(regionp)
+ {
+ regionp->addToCreatedList(getLocalID());
+ }
+ }
+
+ mLatestRecvPacketID = 0;
+ mRegionp = regionp;
+
+ for (child_list_t::iterator i = mChildList.begin(); i != mChildList.end(); ++i)
+ {
+ LLViewerObject* child = *i;
+ child->setRegion(regionp);
+ }
if (mControlAvatar)
{
mControlAvatar->setRegion(regionp);
}
- setChanged(MOVED | SILHOUETTE);
- updateDrawable(FALSE);
+ setChanged(MOVED | SILHOUETTE);
+ updateDrawable(FALSE);
}
// virtual
-void LLViewerObject::updateRegion(LLViewerRegion *regionp)
+void LLViewerObject::updateRegion(LLViewerRegion *regionp)
{
-// if (regionp)
-// {
-// F64 now = LLFrameTimer::getElapsedSeconds();
-// LL_INFOS() << "Updating to region " << regionp->getName()
-// << ", ms since last update message: " << (F32)((now - mLastMessageUpdateSecs) * 1000.0)
-// << ", ms since last interpolation: " << (F32)((now - mLastInterpUpdateSecs) * 1000.0)
-// << LL_ENDL;
-// }
+// if (regionp)
+// {
+// F64 now = LLFrameTimer::getElapsedSeconds();
+// LL_INFOS() << "Updating to region " << regionp->getName()
+// << ", ms since last update message: " << (F32)((now - mLastMessageUpdateSecs) * 1000.0)
+// << ", ms since last interpolation: " << (F32)((now - mLastInterpUpdateSecs) * 1000.0)
+// << LL_ENDL;
+// }
}
bool LLViewerObject::specialHoverCursor() const
{
- return flagUsePhysics()
- || flagHandleTouch()
- || (mClickAction != 0);
+ return flagUsePhysics()
+ || flagHandleTouch()
+ || (mClickAction != 0);
}
void LLViewerObject::updateFlags(BOOL physics_changed)
{
- LLViewerRegion* regionp = getRegion();
- if(!regionp) return;
- gMessageSystem->newMessage("ObjectFlagUpdate");
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, getLocalID() );
- gMessageSystem->addBOOLFast(_PREHASH_UsePhysics, flagUsePhysics() );
- gMessageSystem->addBOOL("IsTemporary", flagTemporaryOnRez() );
- gMessageSystem->addBOOL("IsPhantom", flagPhantom() );
-
- // stinson 02/28/2012 : This CastsShadows BOOL is no longer used in either the viewer or the simulator
- // The simulator code does not even unpack this value when the message is received.
- // This could be potentially hijacked in the future for another use should the urgent need arise.
- gMessageSystem->addBOOL("CastsShadows", FALSE );
-
- if (physics_changed)
- {
- gMessageSystem->nextBlock("ExtraPhysics");
- gMessageSystem->addU8("PhysicsShapeType", getPhysicsShapeType() );
- gMessageSystem->addF32("Density", getPhysicsDensity() );
- gMessageSystem->addF32("Friction", getPhysicsFriction() );
- gMessageSystem->addF32("Restitution", getPhysicsRestitution() );
- gMessageSystem->addF32("GravityMultiplier", getPhysicsGravity() );
- }
- gMessageSystem->sendReliable( regionp->getHost() );
+ LLViewerRegion* regionp = getRegion();
+ if(!regionp) return;
+ gMessageSystem->newMessage("ObjectFlagUpdate");
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, getLocalID() );
+ gMessageSystem->addBOOLFast(_PREHASH_UsePhysics, flagUsePhysics() );
+ gMessageSystem->addBOOL("IsTemporary", flagTemporaryOnRez() );
+ gMessageSystem->addBOOL("IsPhantom", flagPhantom() );
+
+ // stinson 02/28/2012 : This CastsShadows BOOL is no longer used in either the viewer or the simulator
+ // The simulator code does not even unpack this value when the message is received.
+ // This could be potentially hijacked in the future for another use should the urgent need arise.
+ gMessageSystem->addBOOL("CastsShadows", FALSE );
+
+ if (physics_changed)
+ {
+ gMessageSystem->nextBlock("ExtraPhysics");
+ gMessageSystem->addU8("PhysicsShapeType", getPhysicsShapeType() );
+ gMessageSystem->addF32("Density", getPhysicsDensity() );
+ gMessageSystem->addF32("Friction", getPhysicsFriction() );
+ gMessageSystem->addF32("Restitution", getPhysicsRestitution() );
+ gMessageSystem->addF32("GravityMultiplier", getPhysicsGravity() );
+ }
+ gMessageSystem->sendReliable( regionp->getHost() );
}
BOOL LLViewerObject::setFlags(U32 flags, BOOL state)
{
- BOOL setit = setFlagsWithoutUpdate(flags, state);
+ BOOL setit = setFlagsWithoutUpdate(flags, state);
- // BUG: Sometimes viewer physics and simulator physics get
- // out of sync. To fix this, always send update to simulator.
-// if (setit)
- {
- updateFlags();
- }
- return setit;
+ // BUG: Sometimes viewer physics and simulator physics get
+ // out of sync. To fix this, always send update to simulator.
+// if (setit)
+ {
+ updateFlags();
+ }
+ return setit;
}
BOOL LLViewerObject::setFlagsWithoutUpdate(U32 flags, BOOL state)
{
- BOOL setit = FALSE;
- if (state)
- {
- if ((mFlags & flags) != flags)
- {
- mFlags |= flags;
- setit = TRUE;
- }
- }
- else
- {
- if ((mFlags & flags) != 0)
- {
- mFlags &= ~flags;
- setit = TRUE;
- }
- }
- return setit;
+ BOOL setit = FALSE;
+ if (state)
+ {
+ if ((mFlags & flags) != flags)
+ {
+ mFlags |= flags;
+ setit = TRUE;
+ }
+ }
+ else
+ {
+ if ((mFlags & flags) != 0)
+ {
+ mFlags &= ~flags;
+ setit = TRUE;
+ }
+ }
+ return setit;
}
void LLViewerObject::setPhysicsShapeType(U8 type)
{
- mPhysicsShapeUnknown = false;
- if (type != mPhysicsShapeType)
- {
- mPhysicsShapeType = type;
- setObjectCostStale();
+ mPhysicsShapeUnknown = false;
+ if (type != mPhysicsShapeType)
+ {
+ mPhysicsShapeType = type;
+ setObjectCostStale();
}
}
void LLViewerObject::setPhysicsGravity(F32 gravity)
{
- mPhysicsGravity = gravity;
+ mPhysicsGravity = gravity;
}
void LLViewerObject::setPhysicsFriction(F32 friction)
{
- mPhysicsFriction = friction;
+ mPhysicsFriction = friction;
}
void LLViewerObject::setPhysicsDensity(F32 density)
{
- mPhysicsDensity = density;
+ mPhysicsDensity = density;
}
void LLViewerObject::setPhysicsRestitution(F32 restitution)
{
- mPhysicsRestitution = restitution;
+ mPhysicsRestitution = restitution;
}
U8 LLViewerObject::getPhysicsShapeType() const
-{
- if (mPhysicsShapeUnknown)
- {
- gObjectList.updatePhysicsFlags(this);
- }
+{
+ if (mPhysicsShapeUnknown)
+ {
+ gObjectList.updatePhysicsFlags(this);
+ }
- return mPhysicsShapeType;
+ return mPhysicsShapeType;
}
void LLViewerObject::applyAngularVelocity(F32 dt)
{
- //do target omega here
- mRotTime += dt;
- LLVector3 ang_vel = getAngularVelocity();
- F32 omega = ang_vel.magVecSquared();
- F32 angle = 0.0f;
- LLQuaternion dQ;
- if (omega > 0.00001f)
- {
- omega = sqrt(omega);
- angle = omega * dt;
-
- ang_vel *= 1.f/omega;
-
- // calculate the delta increment based on the object's angular velocity
- dQ.setQuat(angle, ang_vel);
-
- // accumulate the angular velocity rotations to re-apply in the case of an object update
- mAngularVelocityRot *= dQ;
-
- // Just apply the delta increment to the current rotation
- setRotation(getRotation()*dQ);
- setChanged(MOVED | SILHOUETTE);
- }
+ //do target omega here
+ mRotTime += dt;
+ LLVector3 ang_vel = getAngularVelocity();
+ F32 omega = ang_vel.magVecSquared();
+ F32 angle = 0.0f;
+ LLQuaternion dQ;
+ if (omega > 0.00001f)
+ {
+ omega = sqrt(omega);
+ angle = omega * dt;
+
+ ang_vel *= 1.f/omega;
+
+ // calculate the delta increment based on the object's angular velocity
+ dQ.setQuat(angle, ang_vel);
+
+ // accumulate the angular velocity rotations to re-apply in the case of an object update
+ mAngularVelocityRot *= dQ;
+
+ // Just apply the delta increment to the current rotation
+ setRotation(getRotation()*dQ);
+ setChanged(MOVED | SILHOUETTE);
+ }
}
void LLViewerObject::resetRotTime()
{
- mRotTime = 0.0f;
+ mRotTime = 0.0f;
}
void LLViewerObject::resetRot()
{
- resetRotTime();
+ resetRotTime();
- // Reset the accumulated angular velocity rotation
- mAngularVelocityRot.loadIdentity();
+ // Reset the accumulated angular velocity rotation
+ mAngularVelocityRot.loadIdentity();
}
U32 LLViewerObject::getPartitionType() const
-{
- return LLViewerRegion::PARTITION_NONE;
+{
+ return LLViewerRegion::PARTITION_NONE;
}
void LLViewerObject::dirtySpatialGroup() const
{
- if (mDrawable)
- {
- LLSpatialGroup* group = mDrawable->getSpatialGroup();
- if (group)
- {
- group->dirtyGeom();
- gPipeline.markRebuild(group);
- }
- }
+ if (mDrawable)
+ {
+ LLSpatialGroup* group = mDrawable->getSpatialGroup();
+ if (group)
+ {
+ group->dirtyGeom();
+ gPipeline.markRebuild(group);
+ }
+ }
}
void LLViewerObject::dirtyMesh()
{
- if (mDrawable)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- }
+ if (mDrawable)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ }
}
F32 LLAlphaObject::getPartSize(S32 idx)
{
- return 0.f;
+ return 0.f;
}
void LLAlphaObject::getBlendFunc(S32 face, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst)
@@ -6988,235 +6988,235 @@ void LLAlphaObject::getBlendFunc(S32 face, LLRender::eBlendFactor& src, LLRender
// virtual
void LLStaticViewerObject::updateDrawable(BOOL force_damped)
{
- // Force an immediate rebuild on any update
- if (mDrawable.notNull())
- {
- mDrawable->updateXform(TRUE);
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- }
- clearChanged(SHIFTED);
+ // Force an immediate rebuild on any update
+ if (mDrawable.notNull())
+ {
+ mDrawable->updateXform(TRUE);
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ clearChanged(SHIFTED);
}
void LLViewerObject::saveUnselectedChildrenPosition(std::vector<LLVector3>& positions)
{
- if(mChildList.empty() || !positions.empty())
- {
- return ;
- }
+ if(mChildList.empty() || !positions.empty())
+ {
+ return ;
+ }
- for (LLViewerObject::child_list_t::const_iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* childp = *iter;
- if (!childp->isSelected() && childp->mDrawable.notNull())
- {
- positions.push_back(childp->getPositionEdit());
- }
- }
+ for (LLViewerObject::child_list_t::const_iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* childp = *iter;
+ if (!childp->isSelected() && childp->mDrawable.notNull())
+ {
+ positions.push_back(childp->getPositionEdit());
+ }
+ }
- return ;
+ return ;
}
void LLViewerObject::saveUnselectedChildrenRotation(std::vector<LLQuaternion>& rotations)
{
- if(mChildList.empty())
- {
- return ;
- }
+ if(mChildList.empty())
+ {
+ return ;
+ }
- for (LLViewerObject::child_list_t::const_iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* childp = *iter;
- if (!childp->isSelected() && childp->mDrawable.notNull())
- {
- rotations.push_back(childp->getRotationEdit());
- }
- }
+ for (LLViewerObject::child_list_t::const_iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* childp = *iter;
+ if (!childp->isSelected() && childp->mDrawable.notNull())
+ {
+ rotations.push_back(childp->getRotationEdit());
+ }
+ }
- return ;
+ return ;
}
//counter-rotation
-void LLViewerObject::resetChildrenRotationAndPosition(const std::vector<LLQuaternion>& rotations,
- const std::vector<LLVector3>& positions)
-{
- if(mChildList.empty())
- {
- return ;
- }
-
- S32 index = 0 ;
- LLQuaternion inv_rotation = ~getRotationEdit() ;
- LLVector3 offset = getPositionEdit() ;
- for (LLViewerObject::child_list_t::const_iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* childp = *iter;
- if (!childp->isSelected() && childp->mDrawable.notNull())
- {
- if (childp->getPCode() != LL_PCODE_LEGACY_AVATAR)
- {
- childp->setRotation(rotations[index] * inv_rotation);
- childp->setPosition((positions[index] - offset) * inv_rotation);
- LLManip::rebuild(childp);
- }
- else //avatar
- {
- LLVector3 reset_pos = (positions[index] - offset) * inv_rotation ;
- LLQuaternion reset_rot = rotations[index] * inv_rotation ;
-
- ((LLVOAvatar*)childp)->mDrawable->mXform.setPosition(reset_pos);
- ((LLVOAvatar*)childp)->mDrawable->mXform.setRotation(reset_rot) ;
-
- ((LLVOAvatar*)childp)->mDrawable->getVObj()->setPosition(reset_pos, TRUE);
- ((LLVOAvatar*)childp)->mDrawable->getVObj()->setRotation(reset_rot, TRUE) ;
-
- LLManip::rebuild(childp);
- }
- index++;
- }
- }
-
- return ;
+void LLViewerObject::resetChildrenRotationAndPosition(const std::vector<LLQuaternion>& rotations,
+ const std::vector<LLVector3>& positions)
+{
+ if(mChildList.empty())
+ {
+ return ;
+ }
+
+ S32 index = 0 ;
+ LLQuaternion inv_rotation = ~getRotationEdit() ;
+ LLVector3 offset = getPositionEdit() ;
+ for (LLViewerObject::child_list_t::const_iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* childp = *iter;
+ if (!childp->isSelected() && childp->mDrawable.notNull())
+ {
+ if (childp->getPCode() != LL_PCODE_LEGACY_AVATAR)
+ {
+ childp->setRotation(rotations[index] * inv_rotation);
+ childp->setPosition((positions[index] - offset) * inv_rotation);
+ LLManip::rebuild(childp);
+ }
+ else //avatar
+ {
+ LLVector3 reset_pos = (positions[index] - offset) * inv_rotation ;
+ LLQuaternion reset_rot = rotations[index] * inv_rotation ;
+
+ ((LLVOAvatar*)childp)->mDrawable->mXform.setPosition(reset_pos);
+ ((LLVOAvatar*)childp)->mDrawable->mXform.setRotation(reset_rot) ;
+
+ ((LLVOAvatar*)childp)->mDrawable->getVObj()->setPosition(reset_pos, TRUE);
+ ((LLVOAvatar*)childp)->mDrawable->getVObj()->setRotation(reset_rot, TRUE) ;
+
+ LLManip::rebuild(childp);
+ }
+ index++;
+ }
+ }
+
+ return ;
}
//counter-translation
void LLViewerObject::resetChildrenPosition(const LLVector3& offset, BOOL simplified, BOOL skip_avatar_child)
{
- if(mChildList.empty())
- {
- return ;
- }
-
- LLVector3 child_offset;
- if(simplified) //translation only, rotation matrix does not change
- {
- child_offset = offset * ~getRotation();
- }
- else //rotation matrix might change too.
- {
- if (isAttachment() && mDrawable.notNull())
- {
- LLXform* attachment_point_xform = mDrawable->getXform()->getParent();
- LLQuaternion parent_rotation = getRotation() * attachment_point_xform->getWorldRotation();
- child_offset = offset * ~parent_rotation;
- }
- else
- {
- child_offset = offset * ~getRenderRotation();
- }
- }
-
- for (LLViewerObject::child_list_t::const_iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* childp = *iter;
-
- if (!childp->isSelected() && childp->mDrawable.notNull())
- {
- if (childp->getPCode() != LL_PCODE_LEGACY_AVATAR)
- {
- childp->setPosition(childp->getPosition() + child_offset);
- LLManip::rebuild(childp);
- }
- else //avatar
- {
- if(!skip_avatar_child)
- {
- LLVector3 reset_pos = ((LLVOAvatar*)childp)->mDrawable->mXform.getPosition() + child_offset ;
-
- ((LLVOAvatar*)childp)->mDrawable->mXform.setPosition(reset_pos);
- ((LLVOAvatar*)childp)->mDrawable->getVObj()->setPosition(reset_pos);
- LLManip::rebuild(childp);
- }
- }
- }
- }
-
- return ;
-}
-
-// virtual
-BOOL LLViewerObject::isTempAttachment() const
-{
- return (mID.notNull() && (mID == mAttachmentItemID));
+ if(mChildList.empty())
+ {
+ return ;
+ }
+
+ LLVector3 child_offset;
+ if(simplified) //translation only, rotation matrix does not change
+ {
+ child_offset = offset * ~getRotation();
+ }
+ else //rotation matrix might change too.
+ {
+ if (isAttachment() && mDrawable.notNull())
+ {
+ LLXform* attachment_point_xform = mDrawable->getXform()->getParent();
+ LLQuaternion parent_rotation = getRotation() * attachment_point_xform->getWorldRotation();
+ child_offset = offset * ~parent_rotation;
+ }
+ else
+ {
+ child_offset = offset * ~getRenderRotation();
+ }
+ }
+
+ for (LLViewerObject::child_list_t::const_iterator iter = mChildList.begin();
+ iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* childp = *iter;
+
+ if (!childp->isSelected() && childp->mDrawable.notNull())
+ {
+ if (childp->getPCode() != LL_PCODE_LEGACY_AVATAR)
+ {
+ childp->setPosition(childp->getPosition() + child_offset);
+ LLManip::rebuild(childp);
+ }
+ else //avatar
+ {
+ if(!skip_avatar_child)
+ {
+ LLVector3 reset_pos = ((LLVOAvatar*)childp)->mDrawable->mXform.getPosition() + child_offset ;
+
+ ((LLVOAvatar*)childp)->mDrawable->mXform.setPosition(reset_pos);
+ ((LLVOAvatar*)childp)->mDrawable->getVObj()->setPosition(reset_pos);
+ LLManip::rebuild(childp);
+ }
+ }
+ }
+ }
+
+ return ;
+}
+
+// virtual
+BOOL LLViewerObject::isTempAttachment() const
+{
+ return (mID.notNull() && (mID == mAttachmentItemID));
}
BOOL LLViewerObject::isHiglightedOrBeacon() const
{
- if (LLFloaterReg::instanceVisible("beacons") && (gPipeline.getRenderBeacons() || gPipeline.getRenderHighlights()))
- {
- BOOL has_media = (getMediaType() == LLViewerObject::MEDIA_SET);
- BOOL is_scripted = !isAvatar() && !getParent() && flagScripted();
- BOOL is_physical = !isAvatar() && flagUsePhysics();
-
- return (isParticleSource() && gPipeline.getRenderParticleBeacons())
- || (isAudioSource() && gPipeline.getRenderSoundBeacons())
- || (has_media && gPipeline.getRenderMOAPBeacons())
- || (is_scripted && gPipeline.getRenderScriptedBeacons())
- || (is_scripted && flagHandleTouch() && gPipeline.getRenderScriptedTouchBeacons())
- || (is_physical && gPipeline.getRenderPhysicalBeacons());
- }
- return FALSE;
+ if (LLFloaterReg::instanceVisible("beacons") && (gPipeline.getRenderBeacons() || gPipeline.getRenderHighlights()))
+ {
+ BOOL has_media = (getMediaType() == LLViewerObject::MEDIA_SET);
+ BOOL is_scripted = !isAvatar() && !getParent() && flagScripted();
+ BOOL is_physical = !isAvatar() && flagUsePhysics();
+
+ return (isParticleSource() && gPipeline.getRenderParticleBeacons())
+ || (isAudioSource() && gPipeline.getRenderSoundBeacons())
+ || (has_media && gPipeline.getRenderMOAPBeacons())
+ || (is_scripted && gPipeline.getRenderScriptedBeacons())
+ || (is_scripted && flagHandleTouch() && gPipeline.getRenderScriptedTouchBeacons())
+ || (is_physical && gPipeline.getRenderPhysicalBeacons());
+ }
+ return FALSE;
}
const LLUUID &LLViewerObject::getAttachmentItemID() const
{
- return mAttachmentItemID;
+ return mAttachmentItemID;
}
void LLViewerObject::setAttachmentItemID(const LLUUID &id)
{
- mAttachmentItemID = id;
+ mAttachmentItemID = id;
}
EObjectUpdateType LLViewerObject::getLastUpdateType() const
{
- return mLastUpdateType;
+ return mLastUpdateType;
}
void LLViewerObject::setLastUpdateType(EObjectUpdateType last_update_type)
{
- mLastUpdateType = last_update_type;
+ mLastUpdateType = last_update_type;
}
BOOL LLViewerObject::getLastUpdateCached() const
{
- return mLastUpdateCached;
+ return mLastUpdateCached;
}
void LLViewerObject::setLastUpdateCached(BOOL last_update_cached)
{
- mLastUpdateCached = last_update_cached;
+ mLastUpdateCached = last_update_cached;
}
const LLUUID &LLViewerObject::extractAttachmentItemID()
{
- LLUUID item_id = LLUUID::null;
- LLNameValue* item_id_nv = getNVPair("AttachItemID");
- if( item_id_nv )
- {
- const char* s = item_id_nv->getString();
- if( s )
- {
- item_id.set(s);
- }
- }
- setAttachmentItemID(item_id);
- return getAttachmentItemID();
+ LLUUID item_id = LLUUID::null;
+ LLNameValue* item_id_nv = getNVPair("AttachItemID");
+ if( item_id_nv )
+ {
+ const char* s = item_id_nv->getString();
+ if( s )
+ {
+ item_id.set(s);
+ }
+ }
+ setAttachmentItemID(item_id);
+ return getAttachmentItemID();
}
const std::string& LLViewerObject::getAttachmentItemName() const
{
- static std::string empty;
- LLInventoryItem *item = gInventory.getItem(getAttachmentItemID());
- if (isAttachment() && item)
- {
- return item->getName();
- }
- return empty;
+ static std::string empty;
+ LLInventoryItem *item = gInventory.getItem(getAttachmentItemID());
+ if (isAttachment() && item)
+ {
+ return item->getName();
+ }
+ return empty;
}
//virtual
@@ -7226,19 +7226,19 @@ LLVOAvatar* LLViewerObject::getAvatar() const
{
return getControlAvatar();
}
- if (isAttachment())
- {
- LLViewerObject* vobj = (LLViewerObject*) getParent();
+ if (isAttachment())
+ {
+ LLViewerObject* vobj = (LLViewerObject*) getParent();
- while (vobj && !vobj->asAvatar())
- {
- vobj = (LLViewerObject*) vobj->getParent();
- }
+ while (vobj && !vobj->asAvatar())
+ {
+ vobj = (LLViewerObject*) vobj->getParent();
+ }
- return (LLVOAvatar*) vobj;
- }
+ return (LLVOAvatar*) vobj;
+ }
- return NULL;
+ return NULL;
}
bool LLViewerObject::hasRenderMaterialParams() const
@@ -7318,12 +7318,12 @@ void LLViewerObject::setRenderMaterialID(S32 te_in, const LLUUID& id, bool updat
{
new_material = gGLTFMaterialList.getMaterial(id);
}
-
+
// update local state
for (S32 te = start_idx; te < end_idx; ++te)
{
LLTextureEntry* tep = getTE(te);
-
+
// If local_origin=false (i.e. it's from the server), we know the
// material has updated or been created, because extra params are
// checked for equality on unpacking. In that case, checking the
@@ -7332,7 +7332,7 @@ void LLViewerObject::setRenderMaterialID(S32 te_in, const LLUUID& id, bool updat
bool material_changed = !local_origin || !param_block || id != param_block->getMaterial(te);
if (update_server)
- {
+ {
// Clear most overrides so the render material better matches the material
// ID (preserve transforms). If overrides become passthrough, set the overrides
// to nullptr.
@@ -7343,7 +7343,7 @@ void LLViewerObject::setRenderMaterialID(S32 te_in, const LLUUID& id, bool updat
}
if (update_server || material_changed)
- {
+ {
tep->setGLTFRenderMaterial(nullptr);
}
@@ -7460,53 +7460,53 @@ void LLViewerObject::shrinkWrap()
class ObjectPhysicsProperties : public LLHTTPNode
{
public:
- virtual void post(
- ResponsePtr responder,
- const LLSD& context,
- const LLSD& input) const
- {
- LLSD object_data = input["body"]["ObjectData"];
- S32 num_entries = object_data.size();
-
- for ( S32 i = 0; i < num_entries; i++ )
- {
- LLSD& curr_object_data = object_data[i];
- U32 local_id = curr_object_data["LocalID"].asInteger();
-
- // Iterate through nodes at end, since it can be on both the regular AND hover list
- struct f : public LLSelectedNodeFunctor
- {
- U32 mID;
- f(const U32& id) : mID(id) {}
- virtual bool apply(LLSelectNode* node)
- {
- return (node->getObject() && node->getObject()->mLocalID == mID );
- }
- } func(local_id);
-
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func);
-
- if (node)
- {
- // The LLSD message builder doesn't know how to handle U8, so we need to send as S8 and cast
- U8 type = (U8)curr_object_data["PhysicsShapeType"].asInteger();
- F32 density = (F32)curr_object_data["Density"].asReal();
- F32 friction = (F32)curr_object_data["Friction"].asReal();
- F32 restitution = (F32)curr_object_data["Restitution"].asReal();
- F32 gravity = (F32)curr_object_data["GravityMultiplier"].asReal();
-
- node->getObject()->setPhysicsShapeType(type);
- node->getObject()->setPhysicsGravity(gravity);
- node->getObject()->setPhysicsFriction(friction);
- node->getObject()->setPhysicsDensity(density);
- node->getObject()->setPhysicsRestitution(restitution);
- }
- }
-
- dialog_refresh_all();
- };
+ virtual void post(
+ ResponsePtr responder,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LLSD object_data = input["body"]["ObjectData"];
+ S32 num_entries = object_data.size();
+
+ for ( S32 i = 0; i < num_entries; i++ )
+ {
+ LLSD& curr_object_data = object_data[i];
+ U32 local_id = curr_object_data["LocalID"].asInteger();
+
+ // Iterate through nodes at end, since it can be on both the regular AND hover list
+ struct f : public LLSelectedNodeFunctor
+ {
+ U32 mID;
+ f(const U32& id) : mID(id) {}
+ virtual bool apply(LLSelectNode* node)
+ {
+ return (node->getObject() && node->getObject()->mLocalID == mID );
+ }
+ } func(local_id);
+
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func);
+
+ if (node)
+ {
+ // The LLSD message builder doesn't know how to handle U8, so we need to send as S8 and cast
+ U8 type = (U8)curr_object_data["PhysicsShapeType"].asInteger();
+ F32 density = (F32)curr_object_data["Density"].asReal();
+ F32 friction = (F32)curr_object_data["Friction"].asReal();
+ F32 restitution = (F32)curr_object_data["Restitution"].asReal();
+ F32 gravity = (F32)curr_object_data["GravityMultiplier"].asReal();
+
+ node->getObject()->setPhysicsShapeType(type);
+ node->getObject()->setPhysicsGravity(gravity);
+ node->getObject()->setPhysicsFriction(friction);
+ node->getObject()->setPhysicsDensity(density);
+ node->getObject()->setPhysicsRestitution(restitution);
+ }
+ }
+
+ dialog_refresh_all();
+ };
};
LLHTTPRegistration<ObjectPhysicsProperties>
- gHTTPRegistrationObjectPhysicsProperties("/message/ObjectPhysicsProperties");
+ gHTTPRegistrationObjectPhysicsProperties("/message/ObjectPhysicsProperties");
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 80da7b2f73..fa2bbd0a15 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,7 +46,7 @@
#include "llrigginginfo.h"
#include "llreflectionmap.h"
-class LLAgent; // TODO: Get rid of this.
+class LLAgent; // TODO: Get rid of this.
class LLAudioSource;
class LLAudioSourceVO;
class LLColor4;
@@ -75,112 +75,112 @@ class LLMeshCostData;
typedef enum e_object_update_type
{
- OUT_FULL,
- OUT_TERSE_IMPROVED,
- OUT_FULL_COMPRESSED,
- OUT_FULL_CACHED,
- OUT_UNKNOWN,
+ OUT_FULL,
+ OUT_TERSE_IMPROVED,
+ OUT_FULL_COMPRESSED,
+ OUT_FULL_CACHED,
+ OUT_UNKNOWN,
} EObjectUpdateType;
// callback typedef for inventory
typedef void (*inventory_callback)(LLViewerObject*,
- LLInventoryObject::object_list_t*,
- S32 serial_num,
- void*);
+ LLInventoryObject::object_list_t*,
+ S32 serial_num,
+ void*);
// for exporting textured materials from SL
struct LLMaterialExportInfo
{
public:
- LLMaterialExportInfo(S32 mat_index, S32 texture_index, LLColor4 color) :
- mMaterialIndex(mat_index), mTextureIndex(texture_index), mColor(color) {};
+ LLMaterialExportInfo(S32 mat_index, S32 texture_index, LLColor4 color) :
+ mMaterialIndex(mat_index), mTextureIndex(texture_index), mColor(color) {};
- S32 mMaterialIndex;
- S32 mTextureIndex;
- LLColor4 mColor;
+ S32 mMaterialIndex;
+ S32 mTextureIndex;
+ LLColor4 mColor;
};
struct PotentialReturnableObject
{
- LLBBox box;
- LLViewerRegion* pRegion;
+ LLBBox box;
+ LLViewerRegion* pRegion;
};
//============================================================================
-class LLViewerObject
-: public LLPrimitive,
- public LLRefCount,
- public LLGLUpdate
+class LLViewerObject
+: public LLPrimitive,
+ public LLRefCount,
+ public LLGLUpdate
{
protected:
- virtual ~LLViewerObject(); // use unref()
+ virtual ~LLViewerObject(); // use unref()
- // TomY: Provide for a list of extra parameter structures, mapped by structure name
- struct ExtraParameter
- {
- BOOL in_use;
- LLNetworkData *data;
- };
- std::unordered_map<U16, ExtraParameter*> mExtraParameterList;
+ // TomY: Provide for a list of extra parameter structures, mapped by structure name
+ struct ExtraParameter
+ {
+ BOOL in_use;
+ LLNetworkData *data;
+ };
+ std::unordered_map<U16, ExtraParameter*> mExtraParameterList;
public:
- typedef std::list<LLPointer<LLViewerObject> > child_list_t;
- typedef std::list<LLPointer<LLViewerObject> > vobj_list_t;
+ typedef std::list<LLPointer<LLViewerObject> > child_list_t;
+ typedef std::list<LLPointer<LLViewerObject> > vobj_list_t;
- typedef const child_list_t const_child_list_t;
+ typedef const child_list_t const_child_list_t;
- LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global = FALSE);
+ LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global = FALSE);
- virtual void markDead(); // Mark this object as dead, and clean up its references
- BOOL isDead() const {return mDead;}
- BOOL isOrphaned() const { return mOrphaned; }
- BOOL isParticleSource() const;
+ virtual void markDead(); // Mark this object as dead, and clean up its references
+ BOOL isDead() const {return mDead;}
+ BOOL isOrphaned() const { return mOrphaned; }
+ BOOL isParticleSource() const;
- virtual LLVOAvatar* asAvatar();
+ virtual LLVOAvatar* asAvatar();
- LLVOAvatar* getAvatarAncestor();
+ LLVOAvatar* getAvatarAncestor();
- static void initVOClasses();
- static void cleanupVOClasses();
+ static void initVOClasses();
+ static void cleanupVOClasses();
- void addNVPair(const std::string& data);
- BOOL removeNVPair(const std::string& name);
- LLNameValue* getNVPair(const std::string& name) const; // null if no name value pair by that name
+ void addNVPair(const std::string& data);
+ BOOL removeNVPair(const std::string& name);
+ LLNameValue* getNVPair(const std::string& name) const; // null if no name value pair by that name
- // Object create and update functions
- virtual void idleUpdate(LLAgent &agent, const F64 &time);
+ // Object create and update functions
+ virtual void idleUpdate(LLAgent &agent, const F64 &time);
- // Types of media we can associate
- enum { MEDIA_NONE = 0, MEDIA_SET = 1 };
+ // Types of media we can associate
+ enum { MEDIA_NONE = 0, MEDIA_SET = 1 };
- // Return codes for processUpdateMessage
- enum {
- MEDIA_URL_REMOVED = 0x1,
- MEDIA_URL_ADDED = 0x2,
- MEDIA_URL_UPDATED = 0x4,
+ // Return codes for processUpdateMessage
+ enum {
+ MEDIA_URL_REMOVED = 0x1,
+ MEDIA_URL_ADDED = 0x2,
+ MEDIA_URL_UPDATED = 0x4,
MEDIA_FLAGS_CHANGED = 0x8,
INVALID_UPDATE = 0x80000000
};
- static U32 extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector3& pos, LLVector3& scale, LLQuaternion& rot);
- virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num,
- const EObjectUpdateType update_type,
- LLDataPacker *dp);
+ static U32 extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector3& pos, LLVector3& scale, LLQuaternion& rot);
+ virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
+ void **user_data,
+ U32 block_num,
+ const EObjectUpdateType update_type,
+ LLDataPacker *dp);
+
+ virtual BOOL isActive() const; // Whether this object needs to do an idleUpdate.
+ BOOL onActiveList() const {return mOnActiveList;}
+ void setOnActiveList(BOOL on_active) { mOnActiveList = on_active; }
- virtual BOOL isActive() const; // Whether this object needs to do an idleUpdate.
- BOOL onActiveList() const {return mOnActiveList;}
- void setOnActiveList(BOOL on_active) { mOnActiveList = on_active; }
+ virtual BOOL isAttachment() const { return FALSE; }
+ const std::string& getAttachmentItemName() const;
- virtual BOOL isAttachment() const { return FALSE; }
- const std::string& getAttachmentItemName() const;
+ virtual LLVOAvatar* getAvatar() const; //get the avatar this object is attached to, or NULL if object is not an attachment
- virtual LLVOAvatar* getAvatar() const; //get the avatar this object is attached to, or NULL if object is not an attachment
-
bool hasRenderMaterialParams() const;
void setHasRenderMaterialParams(bool has_params);
@@ -193,419 +193,419 @@ public:
void setRenderMaterialID(S32 te, const LLUUID& id, bool update_server = true, bool local_origin = true);
void setRenderMaterialIDs(const LLUUID& id);
- virtual BOOL isHUDAttachment() const { return FALSE; }
- virtual BOOL isTempAttachment() const;
+ virtual BOOL isHUDAttachment() const { return FALSE; }
+ virtual BOOL isTempAttachment() const;
+
+ virtual BOOL isHiglightedOrBeacon() const;
- virtual BOOL isHiglightedOrBeacon() const;
+ virtual void updateRadius() {};
+ virtual F32 getVObjRadius() const; // default implemenation is mDrawable->getRadius()
- virtual void updateRadius() {};
- virtual F32 getVObjRadius() const; // default implemenation is mDrawable->getRadius()
-
- // for jointed and other parent-relative hacks
- LLViewerObject* getSubParent();
- const LLViewerObject* getSubParent() const;
-
- // Object visiblility and GPW functions
- virtual void setPixelAreaAndAngle(LLAgent &agent); // Override to generate accurate apparent angle and area
+ // for jointed and other parent-relative hacks
+ LLViewerObject* getSubParent();
+ const LLViewerObject* getSubParent() const;
- virtual U32 getNumVertices() const;
- virtual U32 getNumIndices() const;
- S32 getNumFaces() const { return mNumFaces; }
+ // Object visiblility and GPW functions
+ virtual void setPixelAreaAndAngle(LLAgent &agent); // Override to generate accurate apparent angle and area
- // Graphical stuff for objects - maybe broken out into render class later?
- virtual void updateTextures();
+ virtual U32 getNumVertices() const;
+ virtual U32 getNumIndices() const;
+ S32 getNumFaces() const { return mNumFaces; }
+
+ // Graphical stuff for objects - maybe broken out into render class later?
+ virtual void updateTextures();
virtual void faceMappingChanged() {}
- virtual void boostTexturePriority(BOOL boost_children = TRUE); // When you just want to boost priority of this object
-
- virtual LLDrawable* createDrawable(LLPipeline *pipeline);
- virtual BOOL updateGeometry(LLDrawable *drawable);
- virtual void updateGL();
- virtual void updateFaceSize(S32 idx);
- virtual BOOL updateLOD();
- virtual BOOL setDrawableParent(LLDrawable* parentp);
- F32 getRotTime() { return mRotTime; }
+ virtual void boostTexturePriority(BOOL boost_children = TRUE); // When you just want to boost priority of this object
+
+ virtual LLDrawable* createDrawable(LLPipeline *pipeline);
+ virtual BOOL updateGeometry(LLDrawable *drawable);
+ virtual void updateGL();
+ virtual void updateFaceSize(S32 idx);
+ virtual BOOL updateLOD();
+ virtual BOOL setDrawableParent(LLDrawable* parentp);
+ F32 getRotTime() { return mRotTime; }
private:
- void resetRotTime();
- void setRenderMaterialIDs(const LLRenderMaterialParams* material_params, bool local_origin);
+ void resetRotTime();
+ void setRenderMaterialIDs(const LLRenderMaterialParams* material_params, bool local_origin);
void rebuildMaterial();
public:
- void resetRot();
- void applyAngularVelocity(F32 dt);
+ void resetRot();
+ void applyAngularVelocity(F32 dt);
- void setLineWidthForWindowSize(S32 window_width);
+ void setLineWidthForWindowSize(S32 window_width);
- static void increaseArrowLength(); // makes axis arrows for selections longer
- static void decreaseArrowLength(); // makes axis arrows for selections shorter
+ static void increaseArrowLength(); // makes axis arrows for selections longer
+ static void decreaseArrowLength(); // makes axis arrows for selections shorter
- // Accessor functions
- LLViewerRegion* getRegion() const { return mRegionp; }
+ // Accessor functions
+ LLViewerRegion* getRegion() const { return mRegionp; }
- BOOL isSelected() const { return mUserSelected; }
+ BOOL isSelected() const { return mUserSelected; }
// Check whole linkset
BOOL isAnySelected() const;
- virtual void setSelected(BOOL sel);
-
- const LLUUID &getID() const { return mID; }
- U32 getLocalID() const { return mLocalID; }
- U32 getCRC() const { return mTotalCRC; }
- S32 getListIndex() const { return mListIndex; }
- void setListIndex(S32 idx) { mListIndex = idx; }
-
- virtual BOOL isFlexible() const { return FALSE; }
- virtual BOOL isSculpted() const { return FALSE; }
- virtual BOOL isMesh() const { return FALSE; }
- virtual BOOL isRiggedMesh() const { return FALSE; }
- virtual BOOL hasLightTexture() const { return FALSE; }
+ virtual void setSelected(BOOL sel);
+
+ const LLUUID &getID() const { return mID; }
+ U32 getLocalID() const { return mLocalID; }
+ U32 getCRC() const { return mTotalCRC; }
+ S32 getListIndex() const { return mListIndex; }
+ void setListIndex(S32 idx) { mListIndex = idx; }
+
+ virtual BOOL isFlexible() const { return FALSE; }
+ virtual BOOL isSculpted() const { return FALSE; }
+ virtual BOOL isMesh() const { return FALSE; }
+ virtual BOOL isRiggedMesh() const { return FALSE; }
+ virtual BOOL hasLightTexture() const { return FALSE; }
virtual BOOL isReflectionProbe() const { return FALSE; }
- // This method returns true if the object is over land owned by
- // the agent, one of its groups, or it encroaches and
- // anti-encroachment is enabled
- bool isReturnable();
+ // This method returns true if the object is over land owned by
+ // the agent, one of its groups, or it encroaches and
+ // anti-encroachment is enabled
+ bool isReturnable();
- void buildReturnablesForChildrenVO( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion );
- void constructAndAddReturnable( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion );
+ void buildReturnablesForChildrenVO( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion );
+ void constructAndAddReturnable( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion );
- // This method returns true if the object crosses
- // any parcel bounds in the region.
- bool crossesParcelBounds();
+ // This method returns true if the object crosses
+ // any parcel bounds in the region.
+ bool crossesParcelBounds();
- /*
- // This method will scan through this object, and then query the
- // selection manager to see if the local agent probably has the
- // ability to modify the object. Since this calls into the
- // selection manager, you should avoid calling this method from
- // there.
- BOOL isProbablyModifiable() const;
- */
+ /*
+ // This method will scan through this object, and then query the
+ // selection manager to see if the local agent probably has the
+ // ability to modify the object. Since this calls into the
+ // selection manager, you should avoid calling this method from
+ // there.
+ BOOL isProbablyModifiable() const;
+ */
- virtual BOOL setParent(LLViewerObject* parent);
+ virtual BOOL setParent(LLViewerObject* parent);
virtual void onReparent(LLViewerObject *old_parent, LLViewerObject *new_parent);
virtual void afterReparent();
- virtual void addChild(LLViewerObject *childp);
- virtual void removeChild(LLViewerObject *childp);
- const_child_list_t& getChildren() const { return mChildList; }
- S32 numChildren() const { return mChildList.size(); }
- void addThisAndAllChildren(std::vector<LLViewerObject*>& objects);
- void addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects);
- BOOL isChild(LLViewerObject *childp) const;
- BOOL isSeat() const;
-
-
- //detect if given line segment (in agent space) intersects with this viewer object.
- //returns TRUE if intersection detected and returns information about intersection
- virtual BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face = -1, // which face to check, -1 = ALL_SIDES
- BOOL pick_transparent = FALSE,
- BOOL pick_rigged = FALSE,
+ virtual void addChild(LLViewerObject *childp);
+ virtual void removeChild(LLViewerObject *childp);
+ const_child_list_t& getChildren() const { return mChildList; }
+ S32 numChildren() const { return mChildList.size(); }
+ void addThisAndAllChildren(std::vector<LLViewerObject*>& objects);
+ void addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects);
+ BOOL isChild(LLViewerObject *childp) const;
+ BOOL isSeat() const;
+
+
+ //detect if given line segment (in agent space) intersects with this viewer object.
+ //returns TRUE if intersection detected and returns information about intersection
+ virtual BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
+ S32 face = -1, // which face to check, -1 = ALL_SIDES
+ BOOL pick_transparent = FALSE,
+ BOOL pick_rigged = FALSE,
BOOL pick_unselectable = TRUE,
- S32* face_hit = NULL, // which face was hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL // return the surface tangent at the intersection point
- );
-
- virtual BOOL lineSegmentBoundingBox(const LLVector4a& start, const LLVector4a& end);
-
- virtual const LLVector3d getPositionGlobal() const;
- virtual const LLVector3 &getPositionRegion() const;
- virtual const LLVector3 getPositionEdit() const;
- virtual const LLVector3 &getPositionAgent() const;
- virtual const LLVector3 getRenderPosition() const;
-
- virtual const LLVector3 getPivotPositionAgent() const; // Usually = to getPositionAgent, unless like flex objects it's not
-
- LLViewerObject* getRootEdit() const;
-
- const LLQuaternion getRotationRegion() const;
- const LLQuaternion getRotationEdit() const;
- const LLQuaternion getRenderRotation() const;
- virtual const LLMatrix4 getRenderMatrix() const;
-
- void setPosition(const LLVector3 &pos, BOOL damped = FALSE);
- void setPositionGlobal(const LLVector3d &position, BOOL damped = FALSE);
- void setPositionRegion(const LLVector3 &position, BOOL damped = FALSE);
- void setPositionEdit(const LLVector3 &position, BOOL damped = FALSE);
- void setPositionAgent(const LLVector3 &pos_agent, BOOL damped = FALSE);
- void setPositionParent(const LLVector3 &pos_parent, BOOL damped = FALSE);
- void setPositionAbsoluteGlobal( const LLVector3d &pos_global, BOOL damped = FALSE );
-
- virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const { return xform->getWorldMatrix(); }
-
- inline void setRotation(const F32 x, const F32 y, const F32 z, BOOL damped = FALSE);
- inline void setRotation(const LLQuaternion& quat, BOOL damped = FALSE);
-
- /*virtual*/ void setNumTEs(const U8 num_tes);
- /*virtual*/ void setTE(const U8 te, const LLTextureEntry &texture_entry);
+ S32* face_hit = NULL, // which face was hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL // return the surface tangent at the intersection point
+ );
+
+ virtual BOOL lineSegmentBoundingBox(const LLVector4a& start, const LLVector4a& end);
+
+ virtual const LLVector3d getPositionGlobal() const;
+ virtual const LLVector3 &getPositionRegion() const;
+ virtual const LLVector3 getPositionEdit() const;
+ virtual const LLVector3 &getPositionAgent() const;
+ virtual const LLVector3 getRenderPosition() const;
+
+ virtual const LLVector3 getPivotPositionAgent() const; // Usually = to getPositionAgent, unless like flex objects it's not
+
+ LLViewerObject* getRootEdit() const;
+
+ const LLQuaternion getRotationRegion() const;
+ const LLQuaternion getRotationEdit() const;
+ const LLQuaternion getRenderRotation() const;
+ virtual const LLMatrix4 getRenderMatrix() const;
+
+ void setPosition(const LLVector3 &pos, BOOL damped = FALSE);
+ void setPositionGlobal(const LLVector3d &position, BOOL damped = FALSE);
+ void setPositionRegion(const LLVector3 &position, BOOL damped = FALSE);
+ void setPositionEdit(const LLVector3 &position, BOOL damped = FALSE);
+ void setPositionAgent(const LLVector3 &pos_agent, BOOL damped = FALSE);
+ void setPositionParent(const LLVector3 &pos_parent, BOOL damped = FALSE);
+ void setPositionAbsoluteGlobal( const LLVector3d &pos_global, BOOL damped = FALSE );
+
+ virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const { return xform->getWorldMatrix(); }
+
+ inline void setRotation(const F32 x, const F32 y, const F32 z, BOOL damped = FALSE);
+ inline void setRotation(const LLQuaternion& quat, BOOL damped = FALSE);
+
+ /*virtual*/ void setNumTEs(const U8 num_tes);
+ /*virtual*/ void setTE(const U8 te, const LLTextureEntry &texture_entry);
void updateTEMaterialTextures(U8 te);
- /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid);
- /*virtual*/ S32 setTENormalMap(const U8 te, const LLUUID &uuid);
- /*virtual*/ S32 setTESpecularMap(const U8 te, const LLUUID &uuid);
- S32 setTETextureCore(const U8 te, LLViewerTexture *image);
- S32 setTENormalMapCore(const U8 te, LLViewerTexture *image);
- S32 setTESpecularMapCore(const U8 te, LLViewerTexture *image);
- /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color);
- /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color);
- /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t);
- /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s);
- /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t);
- /*virtual*/ S32 setTEOffset(const U8 te, const F32 s, const F32 t);
- /*virtual*/ S32 setTEOffsetS(const U8 te, const F32 s);
- /*virtual*/ S32 setTEOffsetT(const U8 te, const F32 t);
- /*virtual*/ S32 setTERotation(const U8 te, const F32 r);
- /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump );
- /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen );
- /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media ); // *FIXME: this confusingly acts upon a superset of setTETexGen's flags without absorbing its semantics
- /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny );
- /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright );
- /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags );
- /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow);
- /*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
- /*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams);
+ /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid);
+ /*virtual*/ S32 setTENormalMap(const U8 te, const LLUUID &uuid);
+ /*virtual*/ S32 setTESpecularMap(const U8 te, const LLUUID &uuid);
+ S32 setTETextureCore(const U8 te, LLViewerTexture *image);
+ S32 setTENormalMapCore(const U8 te, LLViewerTexture *image);
+ S32 setTESpecularMapCore(const U8 te, LLViewerTexture *image);
+ /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color);
+ /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color);
+ /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t);
+ /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s);
+ /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t);
+ /*virtual*/ S32 setTEOffset(const U8 te, const F32 s, const F32 t);
+ /*virtual*/ S32 setTEOffsetS(const U8 te, const F32 s);
+ /*virtual*/ S32 setTEOffsetT(const U8 te, const F32 t);
+ /*virtual*/ S32 setTERotation(const U8 te, const F32 r);
+ /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump );
+ /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen );
+ /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media ); // *FIXME: this confusingly acts upon a superset of setTETexGen's flags without absorbing its semantics
+ /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny );
+ /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright );
+ /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags );
+ /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow);
+ /*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
+ /*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams);
virtual S32 setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* mat);
- // Used by Materials update functions to properly kick off rebuilds
- // of VBs etc when materials updates require changes.
- //
- void refreshMaterials();
+ // Used by Materials update functions to properly kick off rebuilds
+ // of VBs etc when materials updates require changes.
+ //
+ void refreshMaterials();
+
+ /*virtual*/ BOOL setMaterial(const U8 material);
+ virtual void setTEImage(const U8 te, LLViewerTexture *imagep); // Not derived from LLPrimitive
+ virtual void changeTEImage(S32 index, LLViewerTexture* new_image) ;
+ virtual void changeTENormalMap(S32 index, LLViewerTexture* new_image) ;
+ virtual void changeTESpecularMap(S32 index, LLViewerTexture* new_image) ;
+ LLViewerTexture *getTEImage(const U8 te) const;
+ LLViewerTexture *getTENormalMap(const U8 te) const;
+ LLViewerTexture *getTESpecularMap(const U8 te) const;
- /*virtual*/ BOOL setMaterial(const U8 material);
- virtual void setTEImage(const U8 te, LLViewerTexture *imagep); // Not derived from LLPrimitive
- virtual void changeTEImage(S32 index, LLViewerTexture* new_image) ;
- virtual void changeTENormalMap(S32 index, LLViewerTexture* new_image) ;
- virtual void changeTESpecularMap(S32 index, LLViewerTexture* new_image) ;
- LLViewerTexture *getTEImage(const U8 te) const;
- LLViewerTexture *getTENormalMap(const U8 te) const;
- LLViewerTexture *getTESpecularMap(const U8 te) const;
+ bool isImageAlphaBlended(const U8 te) const;
- bool isImageAlphaBlended(const U8 te) const;
+ void fitFaceTexture(const U8 face);
+ void sendTEUpdate() const; // Sends packed representation of all texture entry information
- void fitFaceTexture(const U8 face);
- void sendTEUpdate() const; // Sends packed representation of all texture entry information
-
- virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE);
+ virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE);
S32 getAnimatedObjectMaxTris() const;
F32 recursiveGetEstTrianglesMax() const;
virtual F32 getEstTrianglesMax() const;
virtual F32 getEstTrianglesStreamingCost() const;
- virtual F32 getStreamingCost() const;
+ virtual F32 getStreamingCost() const;
virtual bool getCostData(LLMeshCostData& costs) const;
- virtual U32 getTriangleCount(S32* vcount = NULL) const;
- virtual U32 getHighLODTriangleCount();
+ virtual U32 getTriangleCount(S32* vcount = NULL) const;
+ virtual U32 getHighLODTriangleCount();
F32 recursiveGetScaledSurfaceArea() const;
U32 recursiveGetTriangleCount(S32* vcount = NULL) const;
- void setObjectCost(F32 cost);
- F32 getObjectCost();
-
- void setLinksetCost(F32 cost);
- F32 getLinksetCost();
-
- void setPhysicsCost(F32 cost);
- F32 getPhysicsCost();
-
- void setLinksetPhysicsCost(F32 cost);
- F32 getLinksetPhysicsCost();
-
- void sendShapeUpdate();
-
- U8 getAttachmentState() { return mAttachmentState; }
-
- F32 getAppAngle() const { return mAppAngle; }
- F32 getPixelArea() const { return mPixelArea; }
- void setPixelArea(F32 area) { mPixelArea = area; }
- F32 getMaxScale() const;
- F32 getMidScale() const;
- F32 getMinScale() const;
-
- // Owner id is this object's owner
- void setAttachedSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain, const U8 flags);
- void adjustAudioGain(const F32 gain);
- F32 getSoundCutOffRadius() const { return mSoundCutOffRadius; }
- void clearAttachedSound() { mAudioSourcep = NULL; }
-
- // Create if necessary
- LLAudioSource *getAudioSource(const LLUUID& owner_id);
- BOOL isAudioSource() const {return mAudioSourcep != NULL;}
-
- U8 getMediaType() const;
- void setMediaType(U8 media_type);
-
- std::string getMediaURL() const;
- void setMediaURL(const std::string& media_url);
-
- BOOL getMediaPassedWhitelist() const;
- void setMediaPassedWhitelist(BOOL passed);
-
- void sendMaterialUpdate() const;
-
- void setDebugText(const std::string &utf8text, const LLColor4& color = LLColor4::white);
- void appendDebugText(const std::string &utf8text);
- void initHudText();
- void restoreHudText();
- void setIcon(LLViewerTexture* icon_image);
- void clearIcon();
+ void setObjectCost(F32 cost);
+ F32 getObjectCost();
+
+ void setLinksetCost(F32 cost);
+ F32 getLinksetCost();
+
+ void setPhysicsCost(F32 cost);
+ F32 getPhysicsCost();
+
+ void setLinksetPhysicsCost(F32 cost);
+ F32 getLinksetPhysicsCost();
+
+ void sendShapeUpdate();
+
+ U8 getAttachmentState() { return mAttachmentState; }
+
+ F32 getAppAngle() const { return mAppAngle; }
+ F32 getPixelArea() const { return mPixelArea; }
+ void setPixelArea(F32 area) { mPixelArea = area; }
+ F32 getMaxScale() const;
+ F32 getMidScale() const;
+ F32 getMinScale() const;
+
+ // Owner id is this object's owner
+ void setAttachedSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain, const U8 flags);
+ void adjustAudioGain(const F32 gain);
+ F32 getSoundCutOffRadius() const { return mSoundCutOffRadius; }
+ void clearAttachedSound() { mAudioSourcep = NULL; }
+
+ // Create if necessary
+ LLAudioSource *getAudioSource(const LLUUID& owner_id);
+ BOOL isAudioSource() const {return mAudioSourcep != NULL;}
+
+ U8 getMediaType() const;
+ void setMediaType(U8 media_type);
+
+ std::string getMediaURL() const;
+ void setMediaURL(const std::string& media_url);
+
+ BOOL getMediaPassedWhitelist() const;
+ void setMediaPassedWhitelist(BOOL passed);
+
+ void sendMaterialUpdate() const;
+
+ void setDebugText(const std::string &utf8text, const LLColor4& color = LLColor4::white);
+ void appendDebugText(const std::string &utf8text);
+ void initHudText();
+ void restoreHudText();
+ void setIcon(LLViewerTexture* icon_image);
+ void clearIcon();
void recursiveMarkForUpdate();
- virtual void markForUpdate();
- void updateVolume(const LLVolumeParams& volume_params);
- virtual void updateSpatialExtents(LLVector4a& min, LLVector4a& max);
- virtual F32 getBinRadius();
-
- LLBBox getBoundingBoxAgent() const;
-
- void updatePositionCaches() const; // Update the global and region position caches from the object (and parent's) xform.
- void updateText(); // update text label position
- virtual void updateDrawable(BOOL force_damped); // force updates on static objects
-
- bool isOwnerInMuteList(LLUUID item_id = LLUUID());
-
- void setDrawableState(U32 state, BOOL recursive = TRUE);
- void clearDrawableState(U32 state, BOOL recursive = TRUE);
- BOOL isDrawableState(U32 state, BOOL recursive = TRUE) const;
-
- // Called when the drawable shifts
- virtual void onShift(const LLVector4a &shift_vector) { }
-
- //////////////////////////////////////
- //
- // Inventory methods
- //
-
- // This function is called when someone is interested in a viewer
- // object's inventory. The callback is called as soon as the
- // viewer object has the inventory stored locally.
- void registerInventoryListener(LLVOInventoryListener* listener, void* user_data);
- void removeInventoryListener(LLVOInventoryListener* listener);
- BOOL isInventoryPending();
- void clearInventoryListeners();
- bool hasInventoryListeners();
- void requestInventory();
- static void processTaskInv(LLMessageSystem* msg, void** user_data);
- void removeInventory(const LLUUID& item_id);
-
- // The updateInventory() call potentially calls into the selection
- // manager, so do no call updateInventory() from the selection
- // manager until we have better iterators.
- void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
- void updateInventoryLocal(LLInventoryItem* item, U8 key); // Update without messaging.
- void updateMaterialInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
- LLInventoryObject* getInventoryObject(const LLUUID& item_id);
- LLInventoryItem* getInventoryItem(const LLUUID& item_id);
-
- // Get content except for root category
- void getInventoryContents(LLInventoryObject::object_list_t& objects);
- LLInventoryObject* getInventoryRoot();
- LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id);
+ virtual void markForUpdate();
+ void updateVolume(const LLVolumeParams& volume_params);
+ virtual void updateSpatialExtents(LLVector4a& min, LLVector4a& max);
+ virtual F32 getBinRadius();
+
+ LLBBox getBoundingBoxAgent() const;
+
+ void updatePositionCaches() const; // Update the global and region position caches from the object (and parent's) xform.
+ void updateText(); // update text label position
+ virtual void updateDrawable(BOOL force_damped); // force updates on static objects
+
+ bool isOwnerInMuteList(LLUUID item_id = LLUUID());
+
+ void setDrawableState(U32 state, BOOL recursive = TRUE);
+ void clearDrawableState(U32 state, BOOL recursive = TRUE);
+ BOOL isDrawableState(U32 state, BOOL recursive = TRUE) const;
+
+ // Called when the drawable shifts
+ virtual void onShift(const LLVector4a &shift_vector) { }
+
+ //////////////////////////////////////
+ //
+ // Inventory methods
+ //
+
+ // This function is called when someone is interested in a viewer
+ // object's inventory. The callback is called as soon as the
+ // viewer object has the inventory stored locally.
+ void registerInventoryListener(LLVOInventoryListener* listener, void* user_data);
+ void removeInventoryListener(LLVOInventoryListener* listener);
+ BOOL isInventoryPending();
+ void clearInventoryListeners();
+ bool hasInventoryListeners();
+ void requestInventory();
+ static void processTaskInv(LLMessageSystem* msg, void** user_data);
+ void removeInventory(const LLUUID& item_id);
+
+ // The updateInventory() call potentially calls into the selection
+ // manager, so do no call updateInventory() from the selection
+ // manager until we have better iterators.
+ void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
+ void updateInventoryLocal(LLInventoryItem* item, U8 key); // Update without messaging.
+ void updateMaterialInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
+ LLInventoryObject* getInventoryObject(const LLUUID& item_id);
+ LLInventoryItem* getInventoryItem(const LLUUID& item_id);
+
+ // Get content except for root category
+ void getInventoryContents(LLInventoryObject::object_list_t& objects);
+ LLInventoryObject* getInventoryRoot();
+ LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id);
LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id, LLAssetType::EType type);
- S16 getInventorySerial() const { return mInventorySerialNum; }
-
- // These functions does viewer-side only object inventory modifications
- void updateViewerInventoryAsset(
- const LLViewerInventoryItem* item,
- const LLUUID& new_asset);
-
- // This function will make sure that we refresh the inventory.
- void dirtyInventory();
- BOOL isInventoryDirty() { return mInventoryDirty; }
-
- // save a script, which involves removing the old one, and rezzing
- // in the new one. This method should be called with the asset id
- // of the new and old script AFTER the bytecode has been saved.
- void saveScript(const LLViewerInventoryItem* item, BOOL active, bool is_new);
-
- // move an inventory item out of the task and into agent
- // inventory. This operation is based on messaging. No permissions
- // checks are made on the viewer - the server will double check.
- void moveInventory(const LLUUID& agent_folder, const LLUUID& item_id);
-
- // Find the number of instances of this object's inventory that are of the given type
- S32 countInventoryContents( LLAssetType::EType type );
-
- BOOL permAnyOwner() const;
- BOOL permYouOwner() const;
- BOOL permGroupOwner() const;
- BOOL permOwnerModify() const;
- BOOL permModify() const;
- BOOL permCopy() const;
- BOOL permMove() const;
- BOOL permTransfer() const;
- inline BOOL flagUsePhysics() const { return ((mFlags & FLAGS_USE_PHYSICS) != 0); }
- inline BOOL flagObjectAnyOwner() const { return ((mFlags & FLAGS_OBJECT_ANY_OWNER) != 0); }
- inline BOOL flagObjectYouOwner() const { return ((mFlags & FLAGS_OBJECT_YOU_OWNER) != 0); }
- inline BOOL flagObjectGroupOwned() const { return ((mFlags & FLAGS_OBJECT_GROUP_OWNED) != 0); }
- inline BOOL flagObjectOwnerModify() const { return ((mFlags & FLAGS_OBJECT_OWNER_MODIFY) != 0); }
- inline BOOL flagObjectModify() const { return ((mFlags & FLAGS_OBJECT_MODIFY) != 0); }
- inline BOOL flagObjectCopy() const { return ((mFlags & FLAGS_OBJECT_COPY) != 0); }
- inline BOOL flagObjectMove() const { return ((mFlags & FLAGS_OBJECT_MOVE) != 0); }
- inline BOOL flagObjectTransfer() const { return ((mFlags & FLAGS_OBJECT_TRANSFER) != 0); }
- inline BOOL flagObjectPermanent() const { return ((mFlags & FLAGS_AFFECTS_NAVMESH) != 0); }
- inline BOOL flagCharacter() const { return ((mFlags & FLAGS_CHARACTER) != 0); }
- inline BOOL flagVolumeDetect() const { return ((mFlags & FLAGS_VOLUME_DETECT) != 0); }
- inline BOOL flagIncludeInSearch() const { return ((mFlags & FLAGS_INCLUDE_IN_SEARCH) != 0); }
- inline BOOL flagScripted() const { return ((mFlags & FLAGS_SCRIPTED) != 0); }
- inline BOOL flagHandleTouch() const { return ((mFlags & FLAGS_HANDLE_TOUCH) != 0); }
- inline BOOL flagTakesMoney() const { return ((mFlags & FLAGS_TAKES_MONEY) != 0); }
- inline BOOL flagPhantom() const { return ((mFlags & FLAGS_PHANTOM) != 0); }
- inline BOOL flagInventoryEmpty() const { return ((mFlags & FLAGS_INVENTORY_EMPTY) != 0); }
- inline BOOL flagAllowInventoryAdd() const { return ((mFlags & FLAGS_ALLOW_INVENTORY_DROP) != 0); }
- inline BOOL flagTemporaryOnRez() const { return ((mFlags & FLAGS_TEMPORARY_ON_REZ) != 0); }
- inline BOOL flagAnimSource() const { return ((mFlags & FLAGS_ANIM_SOURCE) != 0); }
- inline BOOL flagCameraSource() const { return ((mFlags & FLAGS_CAMERA_SOURCE) != 0); }
- inline BOOL flagCameraDecoupled() const { return ((mFlags & FLAGS_CAMERA_DECOUPLED) != 0); }
-
- U8 getPhysicsShapeType() const;
- inline F32 getPhysicsGravity() const { return mPhysicsGravity; }
- inline F32 getPhysicsFriction() const { return mPhysicsFriction; }
- inline F32 getPhysicsDensity() const { return mPhysicsDensity; }
- inline F32 getPhysicsRestitution() const { return mPhysicsRestitution; }
-
- bool isPermanentEnforced() const;
-
- bool getIncludeInSearch() const;
- void setIncludeInSearch(bool include_in_search);
-
- // Does "open" object menu item apply?
- BOOL allowOpen() const;
-
- void setClickAction(U8 action) { mClickAction = action; }
- U8 getClickAction() const { return mClickAction; }
- bool specialHoverCursor() const; // does it have a special hover cursor?
-
- void setRegion(LLViewerRegion *regionp);
- virtual void updateRegion(LLViewerRegion *regionp);
-
- void updateFlags(BOOL physics_changed = FALSE);
- void loadFlags(U32 flags); //load flags from cache or from message
- BOOL setFlags(U32 flag, BOOL state);
- BOOL setFlagsWithoutUpdate(U32 flag, BOOL state);
- void setPhysicsShapeType(U8 type);
- void setPhysicsGravity(F32 gravity);
- void setPhysicsFriction(F32 friction);
- void setPhysicsDensity(F32 density);
- void setPhysicsRestitution(F32 restitution);
-
- virtual void dump() const;
- static U32 getNumZombieObjects() { return sNumZombieObjects; }
-
- void printNameValuePairs() const;
-
- virtual S32 getLOD() const { return 3; }
- virtual U32 getPartitionType() const;
- void dirtySpatialGroup() const;
- virtual void dirtyMesh();
-
- virtual LLNetworkData* getParameterEntry(U16 param_type) const;
- virtual bool setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin);
- virtual BOOL getParameterEntryInUse(U16 param_type) const;
- virtual bool setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin);
- // Called when a parameter is changed
- virtual void parameterChanged(U16 param_type, bool local_origin);
- virtual void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin);
-
+ S16 getInventorySerial() const { return mInventorySerialNum; }
+
+ // These functions does viewer-side only object inventory modifications
+ void updateViewerInventoryAsset(
+ const LLViewerInventoryItem* item,
+ const LLUUID& new_asset);
+
+ // This function will make sure that we refresh the inventory.
+ void dirtyInventory();
+ BOOL isInventoryDirty() { return mInventoryDirty; }
+
+ // save a script, which involves removing the old one, and rezzing
+ // in the new one. This method should be called with the asset id
+ // of the new and old script AFTER the bytecode has been saved.
+ void saveScript(const LLViewerInventoryItem* item, BOOL active, bool is_new);
+
+ // move an inventory item out of the task and into agent
+ // inventory. This operation is based on messaging. No permissions
+ // checks are made on the viewer - the server will double check.
+ void moveInventory(const LLUUID& agent_folder, const LLUUID& item_id);
+
+ // Find the number of instances of this object's inventory that are of the given type
+ S32 countInventoryContents( LLAssetType::EType type );
+
+ BOOL permAnyOwner() const;
+ BOOL permYouOwner() const;
+ BOOL permGroupOwner() const;
+ BOOL permOwnerModify() const;
+ BOOL permModify() const;
+ BOOL permCopy() const;
+ BOOL permMove() const;
+ BOOL permTransfer() const;
+ inline BOOL flagUsePhysics() const { return ((mFlags & FLAGS_USE_PHYSICS) != 0); }
+ inline BOOL flagObjectAnyOwner() const { return ((mFlags & FLAGS_OBJECT_ANY_OWNER) != 0); }
+ inline BOOL flagObjectYouOwner() const { return ((mFlags & FLAGS_OBJECT_YOU_OWNER) != 0); }
+ inline BOOL flagObjectGroupOwned() const { return ((mFlags & FLAGS_OBJECT_GROUP_OWNED) != 0); }
+ inline BOOL flagObjectOwnerModify() const { return ((mFlags & FLAGS_OBJECT_OWNER_MODIFY) != 0); }
+ inline BOOL flagObjectModify() const { return ((mFlags & FLAGS_OBJECT_MODIFY) != 0); }
+ inline BOOL flagObjectCopy() const { return ((mFlags & FLAGS_OBJECT_COPY) != 0); }
+ inline BOOL flagObjectMove() const { return ((mFlags & FLAGS_OBJECT_MOVE) != 0); }
+ inline BOOL flagObjectTransfer() const { return ((mFlags & FLAGS_OBJECT_TRANSFER) != 0); }
+ inline BOOL flagObjectPermanent() const { return ((mFlags & FLAGS_AFFECTS_NAVMESH) != 0); }
+ inline BOOL flagCharacter() const { return ((mFlags & FLAGS_CHARACTER) != 0); }
+ inline BOOL flagVolumeDetect() const { return ((mFlags & FLAGS_VOLUME_DETECT) != 0); }
+ inline BOOL flagIncludeInSearch() const { return ((mFlags & FLAGS_INCLUDE_IN_SEARCH) != 0); }
+ inline BOOL flagScripted() const { return ((mFlags & FLAGS_SCRIPTED) != 0); }
+ inline BOOL flagHandleTouch() const { return ((mFlags & FLAGS_HANDLE_TOUCH) != 0); }
+ inline BOOL flagTakesMoney() const { return ((mFlags & FLAGS_TAKES_MONEY) != 0); }
+ inline BOOL flagPhantom() const { return ((mFlags & FLAGS_PHANTOM) != 0); }
+ inline BOOL flagInventoryEmpty() const { return ((mFlags & FLAGS_INVENTORY_EMPTY) != 0); }
+ inline BOOL flagAllowInventoryAdd() const { return ((mFlags & FLAGS_ALLOW_INVENTORY_DROP) != 0); }
+ inline BOOL flagTemporaryOnRez() const { return ((mFlags & FLAGS_TEMPORARY_ON_REZ) != 0); }
+ inline BOOL flagAnimSource() const { return ((mFlags & FLAGS_ANIM_SOURCE) != 0); }
+ inline BOOL flagCameraSource() const { return ((mFlags & FLAGS_CAMERA_SOURCE) != 0); }
+ inline BOOL flagCameraDecoupled() const { return ((mFlags & FLAGS_CAMERA_DECOUPLED) != 0); }
+
+ U8 getPhysicsShapeType() const;
+ inline F32 getPhysicsGravity() const { return mPhysicsGravity; }
+ inline F32 getPhysicsFriction() const { return mPhysicsFriction; }
+ inline F32 getPhysicsDensity() const { return mPhysicsDensity; }
+ inline F32 getPhysicsRestitution() const { return mPhysicsRestitution; }
+
+ bool isPermanentEnforced() const;
+
+ bool getIncludeInSearch() const;
+ void setIncludeInSearch(bool include_in_search);
+
+ // Does "open" object menu item apply?
+ BOOL allowOpen() const;
+
+ void setClickAction(U8 action) { mClickAction = action; }
+ U8 getClickAction() const { return mClickAction; }
+ bool specialHoverCursor() const; // does it have a special hover cursor?
+
+ void setRegion(LLViewerRegion *regionp);
+ virtual void updateRegion(LLViewerRegion *regionp);
+
+ void updateFlags(BOOL physics_changed = FALSE);
+ void loadFlags(U32 flags); //load flags from cache or from message
+ BOOL setFlags(U32 flag, BOOL state);
+ BOOL setFlagsWithoutUpdate(U32 flag, BOOL state);
+ void setPhysicsShapeType(U8 type);
+ void setPhysicsGravity(F32 gravity);
+ void setPhysicsFriction(F32 friction);
+ void setPhysicsDensity(F32 density);
+ void setPhysicsRestitution(F32 restitution);
+
+ virtual void dump() const;
+ static U32 getNumZombieObjects() { return sNumZombieObjects; }
+
+ void printNameValuePairs() const;
+
+ virtual S32 getLOD() const { return 3; }
+ virtual U32 getPartitionType() const;
+ void dirtySpatialGroup() const;
+ virtual void dirtyMesh();
+
+ virtual LLNetworkData* getParameterEntry(U16 param_type) const;
+ virtual bool setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin);
+ virtual BOOL getParameterEntryInUse(U16 param_type) const;
+ virtual bool setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin);
+ // Called when a parameter is changed
+ virtual void parameterChanged(U16 param_type, bool local_origin);
+ virtual void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin);
+
bool isShrinkWrapped() const { return mShouldShrinkWrap; }
// Used to improve performance. If an object is likely to rebuild its vertex buffer often
@@ -614,137 +614,137 @@ public:
// so that nearby objects won't attempt to share a vertex buffer with this object.
void shrinkWrap();
- friend class LLViewerObjectList;
- friend class LLViewerMediaList;
+ friend class LLViewerObjectList;
+ friend class LLViewerMediaList;
public:
- LLViewerTexture* getBakedTextureForMagicId(const LLUUID& id);
- void updateAvatarMeshVisibility(const LLUUID& id, const LLUUID& old_id);
- void refreshBakeTexture();
+ LLViewerTexture* getBakedTextureForMagicId(const LLUUID& id);
+ void updateAvatarMeshVisibility(const LLUUID& id, const LLUUID& old_id);
+ void refreshBakeTexture();
public:
- static void unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name);
- static void unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name);
- static void unpackU32(LLDataPackerBinaryBuffer* dp, U32& value, std::string name);
- static void unpackU8(LLDataPackerBinaryBuffer* dp, U8& value, std::string name);
- static U32 unpackParentID(LLDataPackerBinaryBuffer* dp, U32& parent_id);
+ static void unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name);
+ static void unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name);
+ static void unpackU32(LLDataPackerBinaryBuffer* dp, U32& value, std::string name);
+ static void unpackU8(LLDataPackerBinaryBuffer* dp, U8& value, std::string name);
+ static U32 unpackParentID(LLDataPackerBinaryBuffer* dp, U32& parent_id);
public:
- //counter-translation
- void resetChildrenPosition(const LLVector3& offset, BOOL simplified = FALSE, BOOL skip_avatar_child = FALSE) ;
- //counter-rotation
- void resetChildrenRotationAndPosition(const std::vector<LLQuaternion>& rotations,
- const std::vector<LLVector3>& positions) ;
- void saveUnselectedChildrenRotation(std::vector<LLQuaternion>& rotations) ;
- void saveUnselectedChildrenPosition(std::vector<LLVector3>& positions) ;
- std::vector<LLVector3> mUnselectedChildrenPositions ;
+ //counter-translation
+ void resetChildrenPosition(const LLVector3& offset, BOOL simplified = FALSE, BOOL skip_avatar_child = FALSE) ;
+ //counter-rotation
+ void resetChildrenRotationAndPosition(const std::vector<LLQuaternion>& rotations,
+ const std::vector<LLVector3>& positions) ;
+ void saveUnselectedChildrenRotation(std::vector<LLQuaternion>& rotations) ;
+ void saveUnselectedChildrenPosition(std::vector<LLVector3>& positions) ;
+ std::vector<LLVector3> mUnselectedChildrenPositions ;
private:
void setObjectCostStale();
bool isAssetInInventory(LLViewerInventoryItem* item, LLAssetType::EType type);
- ExtraParameter* createNewParameterEntry(U16 param_type);
- ExtraParameter* getExtraParameterEntry(U16 param_type) const;
- ExtraParameter* getExtraParameterEntryCreate(U16 param_type);
- bool unpackParameterEntry(U16 param_type, LLDataPacker *dp);
+ ExtraParameter* createNewParameterEntry(U16 param_type);
+ ExtraParameter* getExtraParameterEntry(U16 param_type) const;
+ ExtraParameter* getExtraParameterEntryCreate(U16 param_type);
+ bool unpackParameterEntry(U16 param_type, LLDataPacker *dp);
// This function checks to see if the given media URL has changed its version
// and the update wasn't due to this agent's last action.
U32 checkMediaURL(const std::string &media_url);
-
- // Motion prediction between updates
- void interpolateLinearMotion(const F64SecondsImplicit & frame_time, const F32SecondsImplicit & dt);
- static void initObjectDataMap();
+ // Motion prediction between updates
+ void interpolateLinearMotion(const F64SecondsImplicit & frame_time, const F32SecondsImplicit & dt);
- // forms task inventory request if none are pending, marks request as pending
- void fetchInventoryFromServer();
+ static void initObjectDataMap();
- // forms task inventory request after some time passed, marks request as pending
- void fetchInventoryDelayed(const F64 &time_seconds);
- static void fetchInventoryDelayedCoro(const LLUUID task_inv, const F64 time_seconds);
+ // forms task inventory request if none are pending, marks request as pending
+ void fetchInventoryFromServer();
+
+ // forms task inventory request after some time passed, marks request as pending
+ void fetchInventoryDelayed(const F64 &time_seconds);
+ static void fetchInventoryDelayedCoro(const LLUUID task_inv, const F64 time_seconds);
public:
- //
- // Viewer-side only types - use the LL_PCODE_APP mask.
- //
- typedef enum e_vo_types
- {
- LL_VO_CLOUDS = LL_PCODE_APP | 0x20, // no longer used
- LL_VO_SURFACE_PATCH = LL_PCODE_APP | 0x30,
- LL_VO_WL_SKY = LL_PCODE_APP | 0x40,
- LL_VO_SQUARE_TORUS = LL_PCODE_APP | 0x50,
- LL_VO_SKY = LL_PCODE_APP | 0x60,
- LL_VO_VOID_WATER = LL_PCODE_APP | 0x70,
- LL_VO_WATER = LL_PCODE_APP | 0x80,
- LL_VO_PART_GROUP = LL_PCODE_APP | 0xa0,
- LL_VO_TRIANGLE_TORUS = LL_PCODE_APP | 0xb0,
- LL_VO_HUD_PART_GROUP = LL_PCODE_APP | 0xc0,
- } EVOType;
-
- typedef enum e_physics_shape_types
- {
- PHYSICS_SHAPE_PRIM = 0,
- PHYSICS_SHAPE_NONE,
- PHYSICS_SHAPE_CONVEX_HULL,
- } EPhysicsShapeType;
-
- LLUUID mID;
- LLUUID mOwnerID; //null if unknown
-
- // unique within region, not unique across regions
- // Local ID = 0 is not used
- U32 mLocalID;
-
- // Last total CRC received from sim, used for caching
- U32 mTotalCRC;
-
- // index into LLViewerObjectList::mActiveObjects or -1 if not in list
- S32 mListIndex;
-
- LLPointer<LLViewerTexture> *mTEImages;
- LLPointer<LLViewerTexture> *mTENormalMaps;
- LLPointer<LLViewerTexture> *mTESpecularMaps;
-
+ //
+ // Viewer-side only types - use the LL_PCODE_APP mask.
+ //
+ typedef enum e_vo_types
+ {
+ LL_VO_CLOUDS = LL_PCODE_APP | 0x20, // no longer used
+ LL_VO_SURFACE_PATCH = LL_PCODE_APP | 0x30,
+ LL_VO_WL_SKY = LL_PCODE_APP | 0x40,
+ LL_VO_SQUARE_TORUS = LL_PCODE_APP | 0x50,
+ LL_VO_SKY = LL_PCODE_APP | 0x60,
+ LL_VO_VOID_WATER = LL_PCODE_APP | 0x70,
+ LL_VO_WATER = LL_PCODE_APP | 0x80,
+ LL_VO_PART_GROUP = LL_PCODE_APP | 0xa0,
+ LL_VO_TRIANGLE_TORUS = LL_PCODE_APP | 0xb0,
+ LL_VO_HUD_PART_GROUP = LL_PCODE_APP | 0xc0,
+ } EVOType;
+
+ typedef enum e_physics_shape_types
+ {
+ PHYSICS_SHAPE_PRIM = 0,
+ PHYSICS_SHAPE_NONE,
+ PHYSICS_SHAPE_CONVEX_HULL,
+ } EPhysicsShapeType;
+
+ LLUUID mID;
+ LLUUID mOwnerID; //null if unknown
+
+ // unique within region, not unique across regions
+ // Local ID = 0 is not used
+ U32 mLocalID;
+
+ // Last total CRC received from sim, used for caching
+ U32 mTotalCRC;
+
+ // index into LLViewerObjectList::mActiveObjects or -1 if not in list
+ S32 mListIndex;
+
+ LLPointer<LLViewerTexture> *mTEImages;
+ LLPointer<LLViewerTexture> *mTENormalMaps;
+ LLPointer<LLViewerTexture> *mTESpecularMaps;
+
// true if user can select this object by clicking under any circumstances (even if pick_unselectable is true)
// can likely be factored out
- BOOL mbCanSelect;
+ BOOL mbCanSelect;
private:
- // Grabbed from UPDATE_FLAGS
- U32 mFlags;
+ // Grabbed from UPDATE_FLAGS
+ U32 mFlags;
- static std::map<std::string, U32> sObjectDataMap;
+ static std::map<std::string, U32> sObjectDataMap;
public:
- // Sent to sim in UPDATE_FLAGS, received in ObjectPhysicsProperties
- U8 mPhysicsShapeType;
- F32 mPhysicsGravity;
- F32 mPhysicsFriction;
- F32 mPhysicsDensity;
- F32 mPhysicsRestitution;
-
+ // Sent to sim in UPDATE_FLAGS, received in ObjectPhysicsProperties
+ U8 mPhysicsShapeType;
+ F32 mPhysicsGravity;
+ F32 mPhysicsFriction;
+ F32 mPhysicsDensity;
+ F32 mPhysicsRestitution;
+
- // Pipeline classes
- LLPointer<LLDrawable> mDrawable;
+ // Pipeline classes
+ LLPointer<LLDrawable> mDrawable;
- // Band-aid to select object after all creation initialization is done
- BOOL mCreateSelected;
+ // Band-aid to select object after all creation initialization is done
+ BOOL mCreateSelected;
- // Replace textures with web pages on this object while drawing
- BOOL mRenderMedia;
+ // Replace textures with web pages on this object while drawing
+ BOOL mRenderMedia;
bool mRiggedAttachedWarned;
- // In bits
- S32 mBestUpdatePrecision;
+ // In bits
+ S32 mBestUpdatePrecision;
- // TODO: Make all this stuff private. JC
- LLPointer<LLHUDText> mText;
- LLPointer<class LLHUDIcon> mIcon;
+ // TODO: Make all this stuff private. JC
+ LLPointer<LLHUDText> mText;
+ LLPointer<class LLHUDIcon> mIcon;
- std::string mHudText;
- LLColor4 mHudTextColor;
+ std::string mHudText;
+ LLColor4 mHudTextColor;
- static BOOL sUseSharedDrawables;
+ static BOOL sUseSharedDrawables;
public:
// Returns mControlAvatar for the edit root prim of this linkset
@@ -768,177 +768,177 @@ protected:
LLPointer<LLControlAvatar> mControlAvatar;
protected:
- // delete an item in the inventory, but don't tell the
- // server. This is used internally by remove, update, and
- // savescript.
- void deleteInventoryItem(const LLUUID& item_id);
-
- // do the update/caching logic. called by saveScript and
- // updateInventory.
- void doUpdateInventory(LLPointer<LLViewerInventoryItem>& item, U8 key, bool is_new);
-
- static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp, S32 flags = 0);
-
- BOOL setData(const U8 *datap, const U32 data_size);
-
- // Hide or show HUD, icon and particles
- void hideExtraDisplayItems( BOOL hidden );
-
- //////////////////////////
- //
- // inventory functionality
- //
-
- static void processTaskInvFile(void** user_data, S32 error_code, LLExtStat ext_status);
- BOOL loadTaskInvFile(const std::string& filename);
- void doInventoryCallback();
-
- BOOL isOnMap();
-
- void unpackParticleSource(const S32 block_num, const LLUUID& owner_id);
- void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id, bool legacy);
- void deleteParticleSource();
- void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id);
-
+ // delete an item in the inventory, but don't tell the
+ // server. This is used internally by remove, update, and
+ // savescript.
+ void deleteInventoryItem(const LLUUID& item_id);
+
+ // do the update/caching logic. called by saveScript and
+ // updateInventory.
+ void doUpdateInventory(LLPointer<LLViewerInventoryItem>& item, U8 key, bool is_new);
+
+ static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp, S32 flags = 0);
+
+ BOOL setData(const U8 *datap, const U32 data_size);
+
+ // Hide or show HUD, icon and particles
+ void hideExtraDisplayItems( BOOL hidden );
+
+ //////////////////////////
+ //
+ // inventory functionality
+ //
+
+ static void processTaskInvFile(void** user_data, S32 error_code, LLExtStat ext_status);
+ BOOL loadTaskInvFile(const std::string& filename);
+ void doInventoryCallback();
+
+ BOOL isOnMap();
+
+ void unpackParticleSource(const S32 block_num, const LLUUID& owner_id);
+ void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id, bool legacy);
+ void deleteParticleSource();
+ void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id);
+
private:
- void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string
- void deleteTEImages(); // correctly deletes list of images
-
+ void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string
+ void deleteTEImages(); // correctly deletes list of images
+
protected:
- typedef std::map<char *, LLNameValue *> name_value_map_t;
- name_value_map_t mNameValuePairs; // Any name-value pairs stored by script
-
- child_list_t mChildList;
-
- F64Seconds mLastInterpUpdateSecs; // Last update for purposes of interpolation
- F64Seconds mLastMessageUpdateSecs; // Last update from a message from the simulator
- TPACKETID mLatestRecvPacketID; // Latest time stamp on message from simulator
- F64SecondsImplicit mRegionCrossExpire; // frame time we detected region crossing in + wait time
-
- // extra data sent from the sim...currently only used for tree species info
- U8* mData;
-
- LLPointer<LLViewerPartSourceScript> mPartSourcep; // Particle source associated with this object.
- LLAudioSourceVO* mAudioSourcep;
- F32 mAudioGain;
- F32 mSoundCutOffRadius;
-
- F32 mAppAngle; // Apparent visual arc in degrees
- F32 mPixelArea; // Apparent area in pixels
-
- // IDs of of all items in the object's content which are added to the object's content,
- // but not updated on the server yet. After item was updated, its ID will be removed from this list.
- std::list<LLUUID> mPendingInventoryItemsIDs;
-
- // This is the object's inventory from the viewer's perspective.
- LLInventoryObject::object_list_t* mInventory;
- class LLInventoryCallbackInfo
- {
- public:
- ~LLInventoryCallbackInfo();
- LLVOInventoryListener* mListener;
- void* mInventoryData;
- };
- typedef std::list<LLInventoryCallbackInfo*> callback_list_t;
- callback_list_t mInventoryCallbacks;
- S16 mInventorySerialNum;
- S16 mExpectedInventorySerialNum;
-
- enum EInventoryRequestState
- {
- INVENTORY_REQUEST_STOPPED,
- INVENTORY_REQUEST_WAIT, // delay before requesting
- INVENTORY_REQUEST_PENDING, // just did fetchInventoryFromServer()
- INVENTORY_XFER // processed response from 'fetch', now doing an xfer
- };
- EInventoryRequestState mInvRequestState;
- U64 mInvRequestXFerId;
- BOOL mInventoryDirty;
-
- LLViewerRegion *mRegionp; // Region that this object belongs to.
- BOOL mDead;
- BOOL mOrphaned; // This is an orphaned child
- BOOL mUserSelected; // Cached user select information
- BOOL mOnActiveList;
- BOOL mOnMap; // On the map.
- BOOL mStatic; // Object doesn't move.
- S32 mSeatCount;
- S32 mNumFaces;
-
- F32 mRotTime; // Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega)
- LLQuaternion mAngularVelocityRot; // accumulated rotation from the angular velocity computations
- LLQuaternion mPreviousRotation;
-
- U8 mAttachmentState; // this encodes the attachment id in a somewhat complex way. 0 if not an attachment.
- LLViewerObjectMedia* mMedia; // NULL if no media associated
- U8 mClickAction;
- F32 mObjectCost; //resource cost of this object or -1 if unknown
- F32 mLinksetCost;
- F32 mPhysicsCost;
- F32 mLinksetPhysicsCost;
-
+ typedef std::map<char *, LLNameValue *> name_value_map_t;
+ name_value_map_t mNameValuePairs; // Any name-value pairs stored by script
+
+ child_list_t mChildList;
+
+ F64Seconds mLastInterpUpdateSecs; // Last update for purposes of interpolation
+ F64Seconds mLastMessageUpdateSecs; // Last update from a message from the simulator
+ TPACKETID mLatestRecvPacketID; // Latest time stamp on message from simulator
+ F64SecondsImplicit mRegionCrossExpire; // frame time we detected region crossing in + wait time
+
+ // extra data sent from the sim...currently only used for tree species info
+ U8* mData;
+
+ LLPointer<LLViewerPartSourceScript> mPartSourcep; // Particle source associated with this object.
+ LLAudioSourceVO* mAudioSourcep;
+ F32 mAudioGain;
+ F32 mSoundCutOffRadius;
+
+ F32 mAppAngle; // Apparent visual arc in degrees
+ F32 mPixelArea; // Apparent area in pixels
+
+ // IDs of of all items in the object's content which are added to the object's content,
+ // but not updated on the server yet. After item was updated, its ID will be removed from this list.
+ std::list<LLUUID> mPendingInventoryItemsIDs;
+
+ // This is the object's inventory from the viewer's perspective.
+ LLInventoryObject::object_list_t* mInventory;
+ class LLInventoryCallbackInfo
+ {
+ public:
+ ~LLInventoryCallbackInfo();
+ LLVOInventoryListener* mListener;
+ void* mInventoryData;
+ };
+ typedef std::list<LLInventoryCallbackInfo*> callback_list_t;
+ callback_list_t mInventoryCallbacks;
+ S16 mInventorySerialNum;
+ S16 mExpectedInventorySerialNum;
+
+ enum EInventoryRequestState
+ {
+ INVENTORY_REQUEST_STOPPED,
+ INVENTORY_REQUEST_WAIT, // delay before requesting
+ INVENTORY_REQUEST_PENDING, // just did fetchInventoryFromServer()
+ INVENTORY_XFER // processed response from 'fetch', now doing an xfer
+ };
+ EInventoryRequestState mInvRequestState;
+ U64 mInvRequestXFerId;
+ BOOL mInventoryDirty;
+
+ LLViewerRegion *mRegionp; // Region that this object belongs to.
+ BOOL mDead;
+ BOOL mOrphaned; // This is an orphaned child
+ BOOL mUserSelected; // Cached user select information
+ BOOL mOnActiveList;
+ BOOL mOnMap; // On the map.
+ BOOL mStatic; // Object doesn't move.
+ S32 mSeatCount;
+ S32 mNumFaces;
+
+ F32 mRotTime; // Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega)
+ LLQuaternion mAngularVelocityRot; // accumulated rotation from the angular velocity computations
+ LLQuaternion mPreviousRotation;
+
+ U8 mAttachmentState; // this encodes the attachment id in a somewhat complex way. 0 if not an attachment.
+ LLViewerObjectMedia* mMedia; // NULL if no media associated
+ U8 mClickAction;
+ F32 mObjectCost; //resource cost of this object or -1 if unknown
+ F32 mLinksetCost;
+ F32 mPhysicsCost;
+ F32 mLinksetPhysicsCost;
+
// If true, "shrink wrap" this volume in its spatial partition. See "shrinkWrap"
bool mShouldShrinkWrap = false;
- bool mCostStale;
- mutable bool mPhysicsShapeUnknown;
+ bool mCostStale;
+ mutable bool mPhysicsShapeUnknown;
- static U32 sNumZombieObjects; // Objects which are dead, but not deleted
+ static U32 sNumZombieObjects; // Objects which are dead, but not deleted
- static BOOL sMapDebug; // Map render mode
- static LLColor4 sEditSelectColor;
- static LLColor4 sNoEditSelectColor;
- static F32 sCurrentPulse;
- static BOOL sPulseEnabled;
+ static BOOL sMapDebug; // Map render mode
+ static LLColor4 sEditSelectColor;
+ static LLColor4 sNoEditSelectColor;
+ static F32 sCurrentPulse;
+ static BOOL sPulseEnabled;
- static S32 sAxisArrowLength;
+ static S32 sAxisArrowLength;
- // These two caches are only correct for non-parented objects right now!
- mutable LLVector3 mPositionRegion;
- mutable LLVector3 mPositionAgent;
+ // These two caches are only correct for non-parented objects right now!
+ mutable LLVector3 mPositionRegion;
+ mutable LLVector3 mPositionAgent;
- static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64Seconds) value; }
- static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64Seconds) value; }
- static void setMaxRegionCrossingInterpolationTime(F32 value) { sMaxRegionCrossingInterpolationTime = (F64Seconds) value; }
+ static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64Seconds) value; }
+ static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64Seconds) value; }
+ static void setMaxRegionCrossingInterpolationTime(F32 value) { sMaxRegionCrossingInterpolationTime = (F64Seconds) value; }
- static void setVelocityInterpolate(BOOL value) { sVelocityInterpolate = value; }
- static void setPingInterpolate(BOOL value) { sPingInterpolate = value; }
+ static void setVelocityInterpolate(BOOL value) { sVelocityInterpolate = value; }
+ static void setPingInterpolate(BOOL value) { sPingInterpolate = value; }
-private:
- static S32 sNumObjects;
+private:
+ static S32 sNumObjects;
- static F64Seconds sPhaseOutUpdateInterpolationTime; // For motion interpolation
- static F64Seconds sMaxUpdateInterpolationTime; // For motion interpolation
- static F64Seconds sMaxRegionCrossingInterpolationTime; // For motion interpolation
+ static F64Seconds sPhaseOutUpdateInterpolationTime; // For motion interpolation
+ static F64Seconds sMaxUpdateInterpolationTime; // For motion interpolation
+ static F64Seconds sMaxRegionCrossingInterpolationTime; // For motion interpolation
- static BOOL sVelocityInterpolate;
- static BOOL sPingInterpolate;
+ static BOOL sVelocityInterpolate;
+ static BOOL sPingInterpolate;
- bool mCachedOwnerInMuteList;
- F64 mCachedMuteListUpdateTime;
+ bool mCachedOwnerInMuteList;
+ F64 mCachedMuteListUpdateTime;
- //--------------------------------------------------------------------
- // For objects that are attachments
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // For objects that are attachments
+ //--------------------------------------------------------------------
public:
- const LLUUID &getAttachmentItemID() const;
- void setAttachmentItemID(const LLUUID &id);
- const LLUUID &extractAttachmentItemID(); // find&set the inventory item ID of the attached object
- EObjectUpdateType getLastUpdateType() const;
- void setLastUpdateType(EObjectUpdateType last_update_type);
- BOOL getLastUpdateCached() const;
- void setLastUpdateCached(BOOL last_update_cached);
+ const LLUUID &getAttachmentItemID() const;
+ void setAttachmentItemID(const LLUUID &id);
+ const LLUUID &extractAttachmentItemID(); // find&set the inventory item ID of the attached object
+ EObjectUpdateType getLastUpdateType() const;
+ void setLastUpdateType(EObjectUpdateType last_update_type);
+ BOOL getLastUpdateCached() const;
+ void setLastUpdateCached(BOOL last_update_cached);
virtual void updateRiggingInfo() {}
LLJointRiggingInfoTab mJointRiggingInfoTab;
private:
- LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory.
- EObjectUpdateType mLastUpdateType;
- BOOL mLastUpdateCached;
+ LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory.
+ EObjectUpdateType mLastUpdateType;
+ BOOL mLastUpdateCached;
public:
// reflection probe state
@@ -958,58 +958,58 @@ public:
inline void LLViewerObject::setRotation(const LLQuaternion& quat, BOOL damped)
{
- LLPrimitive::setRotation(quat);
- setChanged(ROTATED | SILHOUETTE);
- updateDrawable(damped);
+ LLPrimitive::setRotation(quat);
+ setChanged(ROTATED | SILHOUETTE);
+ updateDrawable(damped);
}
inline void LLViewerObject::setRotation(const F32 x, const F32 y, const F32 z, BOOL damped)
{
- LLPrimitive::setRotation(x, y, z);
- setChanged(ROTATED | SILHOUETTE);
- updateDrawable(damped);
+ LLPrimitive::setRotation(x, y, z);
+ setChanged(ROTATED | SILHOUETTE);
+ updateDrawable(damped);
}
class LLViewerObjectMedia
{
public:
- LLViewerObjectMedia() : mMediaURL(), mPassedWhitelist(FALSE), mMediaType(0) { }
+ LLViewerObjectMedia() : mMediaURL(), mPassedWhitelist(FALSE), mMediaType(0) { }
- std::string mMediaURL; // for web pages on surfaces, one per prim
- BOOL mPassedWhitelist; // user has OK'd display
- U8 mMediaType; // see LLTextureEntry::WEB_PAGE, etc.
+ std::string mMediaURL; // for web pages on surfaces, one per prim
+ BOOL mPassedWhitelist; // user has OK'd display
+ U8 mMediaType; // see LLTextureEntry::WEB_PAGE, etc.
};
// subclass of viewer object that can be added to particle partitions
class LLAlphaObject : public LLViewerObject
{
public:
- LLAlphaObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
- : LLViewerObject(id,pcode,regionp)
- { mDepth = 0.f; }
-
- virtual F32 getPartSize(S32 idx);
- virtual void getGeometry(S32 idx,
- LLStrider<LLVector4a>& verticesp,
- LLStrider<LLVector3>& normalsp,
- LLStrider<LLVector2>& texcoordsp,
- LLStrider<LLColor4U>& colorsp,
- LLStrider<LLColor4U>& emissivep,
- LLStrider<U16>& indicesp) = 0;
-
- virtual void getBlendFunc(S32 face, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst);
-
- F32 mDepth;
+ LLAlphaObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
+ : LLViewerObject(id,pcode,regionp)
+ { mDepth = 0.f; }
+
+ virtual F32 getPartSize(S32 idx);
+ virtual void getGeometry(S32 idx,
+ LLStrider<LLVector4a>& verticesp,
+ LLStrider<LLVector3>& normalsp,
+ LLStrider<LLVector2>& texcoordsp,
+ LLStrider<LLColor4U>& colorsp,
+ LLStrider<LLColor4U>& emissivep,
+ LLStrider<U16>& indicesp) = 0;
+
+ virtual void getBlendFunc(S32 face, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst);
+
+ F32 mDepth;
};
class LLStaticViewerObject : public LLViewerObject
{
public:
- LLStaticViewerObject(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp, BOOL is_global = FALSE)
- : LLViewerObject(id,pcode,regionp, is_global)
- { }
+ LLStaticViewerObject(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp, BOOL is_global = FALSE)
+ : LLViewerObject(id,pcode,regionp, is_global)
+ { }
- virtual void updateDrawable(BOOL force_damped);
+ virtual void updateDrawable(BOOL force_damped);
};
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index a53bd982d4..49bd5007c4 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerobjectlist.cpp
* @brief Implementation of LLViewerObjectList class.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,7 +31,7 @@
#include "message.h"
#include "llfasttimer.h"
#include "llrender.h"
-#include "llwindow.h" // decBusyCount()
+#include "llwindow.h" // decBusyCount()
#include "llviewercontrol.h"
#include "llface.h"
@@ -95,715 +95,715 @@ void dialog_refresh_all();
// Global lists of objects - should go away soon.
LLViewerObjectList gObjectList;
-extern LLPipeline gPipeline;
+extern LLPipeline gPipeline;
// Statics for object lookup tables.
-U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check.
-std::map<U64, U32> LLViewerObjectList::sIPAndPortToIndex;
-std::map<U64, LLUUID> LLViewerObjectList::sIndexAndLocalIDToUUID;
+U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check.
+std::map<U64, U32> LLViewerObjectList::sIPAndPortToIndex;
+std::map<U64, LLUUID> LLViewerObjectList::sIndexAndLocalIDToUUID;
LLViewerObjectList::LLViewerObjectList()
{
- mCurLazyUpdateIndex = 0;
- mCurBin = 0;
- mNumDeadObjects = 0;
- mNumOrphans = 0;
- mNumNewObjects = 0;
- mWasPaused = FALSE;
- mNumDeadObjectUpdates = 0;
- mNumUnknownUpdates = 0;
+ mCurLazyUpdateIndex = 0;
+ mCurBin = 0;
+ mNumDeadObjects = 0;
+ mNumOrphans = 0;
+ mNumNewObjects = 0;
+ mWasPaused = FALSE;
+ mNumDeadObjectUpdates = 0;
+ mNumUnknownUpdates = 0;
}
LLViewerObjectList::~LLViewerObjectList()
{
- destroy();
+ destroy();
}
void LLViewerObjectList::destroy()
{
- killAllObjects();
+ killAllObjects();
- resetObjectBeacons();
- mActiveObjects.clear();
- mDeadObjects.clear();
- mMapObjects.clear();
- mUUIDObjectMap.clear();
+ resetObjectBeacons();
+ mActiveObjects.clear();
+ mDeadObjects.clear();
+ mMapObjects.clear();
+ mUUIDObjectMap.clear();
}
void LLViewerObjectList::getUUIDFromLocal(LLUUID &id,
- const U32 local_id,
- const U32 ip,
- const U32 port)
+ const U32 local_id,
+ const U32 ip,
+ const U32 port)
{
- U64 ipport = (((U64)ip) << 32) | (U64)port;
+ U64 ipport = (((U64)ip) << 32) | (U64)port;
- U32 index = sIPAndPortToIndex[ipport];
+ U32 index = sIPAndPortToIndex[ipport];
- if (!index)
- {
- index = sSimulatorMachineIndex++;
- sIPAndPortToIndex[ipport] = index;
- }
+ if (!index)
+ {
+ index = sSimulatorMachineIndex++;
+ sIPAndPortToIndex[ipport] = index;
+ }
- U64 indexid = (((U64)index) << 32) | (U64)local_id;
+ U64 indexid = (((U64)index) << 32) | (U64)local_id;
- id = get_if_there(sIndexAndLocalIDToUUID, indexid, LLUUID::null);
+ id = get_if_there(sIndexAndLocalIDToUUID, indexid, LLUUID::null);
}
U64 LLViewerObjectList::getIndex(const U32 local_id,
- const U32 ip,
- const U32 port)
+ const U32 ip,
+ const U32 port)
{
- U64 ipport = (((U64)ip) << 32) | (U64)port;
+ U64 ipport = (((U64)ip) << 32) | (U64)port;
- U32 index = sIPAndPortToIndex[ipport];
+ U32 index = sIPAndPortToIndex[ipport];
- if (!index)
- {
- return 0;
- }
+ if (!index)
+ {
+ return 0;
+ }
- return (((U64)index) << 32) | (U64)local_id;
+ return (((U64)index) << 32) | (U64)local_id;
}
BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
-
- if(objectp && objectp->getRegion())
- {
- U32 local_id = objectp->mLocalID;
- U32 ip = objectp->getRegion()->getHost().getAddress();
- U32 port = objectp->getRegion()->getHost().getPort();
- U64 ipport = (((U64)ip) << 32) | (U64)port;
- U32 index = sIPAndPortToIndex[ipport];
-
- // LL_INFOS() << "Removing object from table, local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL;
-
- U64 indexid = (((U64)index) << 32) | (U64)local_id;
-
- std::map<U64, LLUUID>::iterator iter = sIndexAndLocalIDToUUID.find(indexid);
- if (iter == sIndexAndLocalIDToUUID.end())
- {
- return FALSE;
- }
-
- // Found existing entry
- if (iter->second == objectp->getID())
- { // Full UUIDs match, so remove the entry
- sIndexAndLocalIDToUUID.erase(iter);
- return TRUE;
- }
- // UUIDs did not match - this would zap a valid entry, so don't erase it
- //LL_INFOS() << "Tried to erase entry where id in table ("
- // << iter->second << ") did not match object " << object.getID() << LL_ENDL;
- }
-
- return FALSE ;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
+
+ if(objectp && objectp->getRegion())
+ {
+ U32 local_id = objectp->mLocalID;
+ U32 ip = objectp->getRegion()->getHost().getAddress();
+ U32 port = objectp->getRegion()->getHost().getPort();
+ U64 ipport = (((U64)ip) << 32) | (U64)port;
+ U32 index = sIPAndPortToIndex[ipport];
+
+ // LL_INFOS() << "Removing object from table, local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL;
+
+ U64 indexid = (((U64)index) << 32) | (U64)local_id;
+
+ std::map<U64, LLUUID>::iterator iter = sIndexAndLocalIDToUUID.find(indexid);
+ if (iter == sIndexAndLocalIDToUUID.end())
+ {
+ return FALSE;
+ }
+
+ // Found existing entry
+ if (iter->second == objectp->getID())
+ { // Full UUIDs match, so remove the entry
+ sIndexAndLocalIDToUUID.erase(iter);
+ return TRUE;
+ }
+ // UUIDs did not match - this would zap a valid entry, so don't erase it
+ //LL_INFOS() << "Tried to erase entry where id in table ("
+ // << iter->second << ") did not match object " << object.getID() << LL_ENDL;
+ }
+
+ return FALSE ;
}
void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id,
- const U32 local_id,
- const U32 ip,
- const U32 port)
+ const U32 local_id,
+ const U32 ip,
+ const U32 port)
{
- U64 ipport = (((U64)ip) << 32) | (U64)port;
+ U64 ipport = (((U64)ip) << 32) | (U64)port;
+
+ U32 index = sIPAndPortToIndex[ipport];
- U32 index = sIPAndPortToIndex[ipport];
+ if (!index)
+ {
+ index = sSimulatorMachineIndex++;
+ sIPAndPortToIndex[ipport] = index;
+ }
- if (!index)
- {
- index = sSimulatorMachineIndex++;
- sIPAndPortToIndex[ipport] = index;
- }
+ U64 indexid = (((U64)index) << 32) | (U64)local_id;
- U64 indexid = (((U64)index) << 32) | (U64)local_id;
+ sIndexAndLocalIDToUUID[indexid] = id;
- sIndexAndLocalIDToUUID[indexid] = id;
-
- //LL_INFOS() << "Adding object to table, full ID " << id
- // << ", local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL;
+ //LL_INFOS() << "Adding object to table, full ID " << id
+ // << ", local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL;
}
S32 gFullObjectUpdates = 0;
S32 gTerseObjectUpdates = 0;
-void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
- void** user_data,
- U32 i,
- const EObjectUpdateType update_type,
- LLDataPacker* dpp,
- bool just_created,
- bool from_cache)
+void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
+ void** user_data,
+ U32 i,
+ const EObjectUpdateType update_type,
+ LLDataPacker* dpp,
+ bool just_created,
+ bool from_cache)
{
- LLMessageSystem* msg = NULL;
-
- if(!from_cache)
- {
- msg = gMessageSystem;
- }
-
- // ignore returned flags
- LL_DEBUGS("ObjectUpdate") << "uuid " << objectp->mID << " calling processUpdateMessage "
+ LLMessageSystem* msg = NULL;
+
+ if(!from_cache)
+ {
+ msg = gMessageSystem;
+ }
+
+ // ignore returned flags
+ LL_DEBUGS("ObjectUpdate") << "uuid " << objectp->mID << " calling processUpdateMessage "
<< objectp << " just_created " << just_created << " from_cache " << from_cache << " msg " << msg << LL_ENDL;
dumpStack("ObjectUpdateStack");
-
- objectp->processUpdateMessage(msg, user_data, i, update_type, dpp);
-
- if (objectp->isDead())
- {
- // The update failed
- return;
- }
-
- updateActive(objectp);
-
- if (just_created)
- {
- gPipeline.addObject(objectp);
- }
-
- // Also sets the approx. pixel area
- objectp->setPixelAreaAndAngle(gAgent);
-
- // RN: this must be called after we have a drawable
- // (from gPipeline.addObject)
- // so that the drawable parent is set properly
- if(msg != NULL)
- {
- findOrphans(objectp, msg->getSenderIP(), msg->getSenderPort());
- }
- else
- {
- LLViewerRegion* regionp = objectp->getRegion();
- if(regionp != NULL)
- {
- findOrphans(objectp, regionp->getHost().getAddress(), regionp->getHost().getPort());
- }
- }
-
- // If we're just wandering around, don't create new objects selected.
- if (just_created
- && update_type != OUT_TERSE_IMPROVED
- && objectp->mCreateSelected)
- {
- if ( LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance() )
- {
- // LL_INFOS() << "DEBUG selecting " << objectp->mID << " "
- // << objectp->mLocalID << LL_ENDL;
- LLSelectMgr::getInstance()->selectObjectAndFamily(objectp);
- dialog_refresh_all();
- }
-
- objectp->mCreateSelected = false;
- gViewerWindow->getWindow()->decBusyCount();
- gViewerWindow->setCursor( UI_CURSOR_ARROW );
- }
+
+ objectp->processUpdateMessage(msg, user_data, i, update_type, dpp);
+
+ if (objectp->isDead())
+ {
+ // The update failed
+ return;
+ }
+
+ updateActive(objectp);
+
+ if (just_created)
+ {
+ gPipeline.addObject(objectp);
+ }
+
+ // Also sets the approx. pixel area
+ objectp->setPixelAreaAndAngle(gAgent);
+
+ // RN: this must be called after we have a drawable
+ // (from gPipeline.addObject)
+ // so that the drawable parent is set properly
+ if(msg != NULL)
+ {
+ findOrphans(objectp, msg->getSenderIP(), msg->getSenderPort());
+ }
+ else
+ {
+ LLViewerRegion* regionp = objectp->getRegion();
+ if(regionp != NULL)
+ {
+ findOrphans(objectp, regionp->getHost().getAddress(), regionp->getHost().getPort());
+ }
+ }
+
+ // If we're just wandering around, don't create new objects selected.
+ if (just_created
+ && update_type != OUT_TERSE_IMPROVED
+ && objectp->mCreateSelected)
+ {
+ if ( LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance() )
+ {
+ // LL_INFOS() << "DEBUG selecting " << objectp->mID << " "
+ // << objectp->mLocalID << LL_ENDL;
+ LLSelectMgr::getInstance()->selectObjectAndFamily(objectp);
+ dialog_refresh_all();
+ }
+
+ objectp->mCreateSelected = false;
+ gViewerWindow->getWindow()->decBusyCount();
+ gViewerWindow->setCursor( UI_CURSOR_ARROW );
+ }
}
static LLTrace::BlockTimerStatHandle FTM_PROCESS_OBJECTS("Process Objects");
LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry* entry, LLViewerRegion* regionp)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
-
- LLDataPacker *cached_dpp = entry->getDP();
-
- if (!cached_dpp || gNonInteractive)
- {
- return NULL; //nothing cached.
- }
-
- LLViewerObject *objectp;
- U32 local_id;
- LLPCode pcode = 0;
- LLUUID fullid;
- LLViewerStatsRecorder& recorder = LLViewerStatsRecorder::instance();
-
- // Cache Hit.
- record(LLStatViewer::OBJECT_CACHE_HIT_RATE, LLUnits::Ratio::fromValue(1));
-
- cached_dpp->reset();
- cached_dpp->unpackUUID(fullid, "ID");
- cached_dpp->unpackU32(local_id, "LocalID");
- cached_dpp->unpackU8(pcode, "PCode");
-
- objectp = findObject(fullid);
-
- if (objectp)
- {
- if(!objectp->isDead() && (objectp->mLocalID != entry->getLocalID() ||
- objectp->getRegion() != regionp))
- {
- removeFromLocalIDTable(objectp);
- setUUIDAndLocal(fullid, entry->getLocalID(),
- regionp->getHost().getAddress(),
- regionp->getHost().getPort());
-
- if (objectp->mLocalID != entry->getLocalID())
- { // Update local ID in object with the one sent from the region
- objectp->mLocalID = entry->getLocalID();
- }
-
- if (objectp->getRegion() != regionp)
- { // Object changed region, so update it
- objectp->updateRegion(regionp); // for LLVOAvatar
- }
- }
- else
- {
- //should fall through if already loaded because may need to update the object.
- //return objectp; //already loaded.
- }
- }
-
- bool justCreated = false;
- if (!objectp)
- {
- objectp = createObjectFromCache(pcode, regionp, fullid, entry->getLocalID());
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
+
+ LLDataPacker *cached_dpp = entry->getDP();
+
+ if (!cached_dpp || gNonInteractive)
+ {
+ return NULL; //nothing cached.
+ }
+
+ LLViewerObject *objectp;
+ U32 local_id;
+ LLPCode pcode = 0;
+ LLUUID fullid;
+ LLViewerStatsRecorder& recorder = LLViewerStatsRecorder::instance();
+
+ // Cache Hit.
+ record(LLStatViewer::OBJECT_CACHE_HIT_RATE, LLUnits::Ratio::fromValue(1));
+
+ cached_dpp->reset();
+ cached_dpp->unpackUUID(fullid, "ID");
+ cached_dpp->unpackU32(local_id, "LocalID");
+ cached_dpp->unpackU8(pcode, "PCode");
+
+ objectp = findObject(fullid);
+
+ if (objectp)
+ {
+ if(!objectp->isDead() && (objectp->mLocalID != entry->getLocalID() ||
+ objectp->getRegion() != regionp))
+ {
+ removeFromLocalIDTable(objectp);
+ setUUIDAndLocal(fullid, entry->getLocalID(),
+ regionp->getHost().getAddress(),
+ regionp->getHost().getPort());
+
+ if (objectp->mLocalID != entry->getLocalID())
+ { // Update local ID in object with the one sent from the region
+ objectp->mLocalID = entry->getLocalID();
+ }
+
+ if (objectp->getRegion() != regionp)
+ { // Object changed region, so update it
+ objectp->updateRegion(regionp); // for LLVOAvatar
+ }
+ }
+ else
+ {
+ //should fall through if already loaded because may need to update the object.
+ //return objectp; //already loaded.
+ }
+ }
+
+ bool justCreated = false;
+ if (!objectp)
+ {
+ objectp = createObjectFromCache(pcode, regionp, fullid, entry->getLocalID());
LL_DEBUGS("ObjectUpdate") << "uuid " << fullid << " created objectp " << objectp << LL_ENDL;
dumpStack("ObjectUpdateStack");
-
- if (!objectp)
- {
- LL_INFOS() << "createObject failure for object: " << fullid << LL_ENDL;
- recorder.objectUpdateFailure();
- return NULL;
- }
- justCreated = true;
- mNumNewObjects++;
- }
-
- if (objectp->isDead())
- {
- LL_WARNS() << "Dead object " << objectp->mID << " in UUID map 1!" << LL_ENDL;
- }
-
- processUpdateCore(objectp, NULL, 0, OUT_FULL_CACHED, cached_dpp, justCreated, true);
- objectp->loadFlags(entry->getUpdateFlags()); //just in case, reload update flags from cache.
-
- if(entry->getHitCount() > 0)
- {
- objectp->setLastUpdateType(OUT_FULL_CACHED);
- }
- else
- {
- objectp->setLastUpdateType(OUT_FULL_COMPRESSED); //newly cached
- objectp->setLastUpdateCached(TRUE);
- }
- LLVOAvatar::cullAvatarsByPixelArea();
-
- return objectp;
+
+ if (!objectp)
+ {
+ LL_INFOS() << "createObject failure for object: " << fullid << LL_ENDL;
+ recorder.objectUpdateFailure();
+ return NULL;
+ }
+ justCreated = true;
+ mNumNewObjects++;
+ }
+
+ if (objectp->isDead())
+ {
+ LL_WARNS() << "Dead object " << objectp->mID << " in UUID map 1!" << LL_ENDL;
+ }
+
+ processUpdateCore(objectp, NULL, 0, OUT_FULL_CACHED, cached_dpp, justCreated, true);
+ objectp->loadFlags(entry->getUpdateFlags()); //just in case, reload update flags from cache.
+
+ if(entry->getHitCount() > 0)
+ {
+ objectp->setLastUpdateType(OUT_FULL_CACHED);
+ }
+ else
+ {
+ objectp->setLastUpdateType(OUT_FULL_COMPRESSED); //newly cached
+ objectp->setLastUpdateCached(TRUE);
+ }
+ LLVOAvatar::cullAvatarsByPixelArea();
+
+ return objectp;
}
void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
- void **user_data,
- const EObjectUpdateType update_type,
- bool compressed)
+ void **user_data,
+ const EObjectUpdateType update_type,
+ bool compressed)
{
- LL_RECORD_BLOCK_TIME(FTM_PROCESS_OBJECTS);
-
- LLViewerObject *objectp;
- S32 num_objects;
- U32 local_id;
- LLPCode pcode = 0;
- LLUUID fullid;
- S32 i;
-
- // figure out which simulator these are from and get it's index
- // Coordinates in simulators are region-local
- // Until we get region-locality working on viewer we
- // have to transform to absolute coordinates.
- num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData);
-
- // I don't think this case is ever hit. TODO* Test this.
- if (!compressed && update_type != OUT_FULL)
- {
- //LL_INFOS() << "TEST: !cached && !compressed && update_type != OUT_FULL" << LL_ENDL;
- gTerseObjectUpdates += num_objects;
- /*
- S32 size;
- if (mesgsys->getReceiveCompressedSize())
- {
- size = mesgsys->getReceiveCompressedSize();
- }
- else
- {
- size = mesgsys->getReceiveSize();
- }
- LL_INFOS() << "Received terse " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << LL_ENDL;
- */
- }
- else
- {
- /*
- S32 size;
- if (mesgsys->getReceiveCompressedSize())
- {
- size = mesgsys->getReceiveCompressedSize();
- }
- else
- {
- size = mesgsys->getReceiveSize();
- }
-
- LL_INFOS() << "Received " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << LL_ENDL;
- */
- gFullObjectUpdates += num_objects;
- }
-
- U64 region_handle;
- mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
-
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
-
- if (!regionp)
- {
- LL_WARNS() << "Object update from unknown region! " << region_handle << LL_ENDL;
- return;
- }
-
- U8 compressed_dpbuffer[2048];
- LLDataPackerBinaryBuffer compressed_dp(compressed_dpbuffer, 2048);
- LLViewerStatsRecorder& recorder = LLViewerStatsRecorder::instance();
-
- for (i = 0; i < num_objects; i++)
- {
- BOOL justCreated = FALSE;
- bool update_cache = false; //update object cache if it is a full-update or terse update
-
- if (compressed)
- {
- compressed_dp.reset();
-
- S32 uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data);
- LL_DEBUGS("ObjectUpdate") << "got binary data from message to compressed_dpbuffer" << LL_ENDL;
- mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i, 2048);
- compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length);
-
- if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
- {
- U32 flags = 0;
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
-
- compressed_dp.unpackUUID(fullid, "ID");
- compressed_dp.unpackU32(local_id, "LocalID");
- compressed_dp.unpackU8(pcode, "PCode");
-
- if (pcode == 0)
- {
- // object creation will fail, LLViewerObject::createObject()
- LL_WARNS() << "Received object " << fullid
- << " with 0 PCode. Local id: " << local_id
- << " Flags: " << flags
- << " Region: " << regionp->getName()
- << " Region id: " << regionp->getRegionID() << LL_ENDL;
- recorder.objectUpdateFailure();
- continue;
- }
- else if ((flags & FLAGS_TEMPORARY_ON_REZ) == 0)
- {
- //send to object cache
- regionp->cacheFullUpdate(compressed_dp, flags);
- continue;
- }
- }
- else //OUT_TERSE_IMPROVED
- {
- update_cache = true;
- compressed_dp.unpackU32(local_id, "LocalID");
- getUUIDFromLocal(fullid,
- local_id,
- gMessageSystem->getSenderIP(),
- gMessageSystem->getSenderPort());
- if (fullid.isNull())
- {
- LL_DEBUGS() << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << ":" << gMessageSystem->getSenderPort() << LL_ENDL;
- mNumUnknownUpdates++;
- }
- }
- }
- else if (update_type != OUT_FULL) // !compressed, !OUT_FULL ==> OUT_FULL_CACHED only?
- {
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
-
- getUUIDFromLocal(fullid,
- local_id,
- gMessageSystem->getSenderIP(),
- gMessageSystem->getSenderPort());
- if (fullid.isNull())
- {
- // LL_WARNS() << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << LL_ENDL;
- mNumUnknownUpdates++;
- }
+ LL_RECORD_BLOCK_TIME(FTM_PROCESS_OBJECTS);
+
+ LLViewerObject *objectp;
+ S32 num_objects;
+ U32 local_id;
+ LLPCode pcode = 0;
+ LLUUID fullid;
+ S32 i;
+
+ // figure out which simulator these are from and get it's index
+ // Coordinates in simulators are region-local
+ // Until we get region-locality working on viewer we
+ // have to transform to absolute coordinates.
+ num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData);
+
+ // I don't think this case is ever hit. TODO* Test this.
+ if (!compressed && update_type != OUT_FULL)
+ {
+ //LL_INFOS() << "TEST: !cached && !compressed && update_type != OUT_FULL" << LL_ENDL;
+ gTerseObjectUpdates += num_objects;
+ /*
+ S32 size;
+ if (mesgsys->getReceiveCompressedSize())
+ {
+ size = mesgsys->getReceiveCompressedSize();
+ }
+ else
+ {
+ size = mesgsys->getReceiveSize();
+ }
+ LL_INFOS() << "Received terse " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << LL_ENDL;
+ */
+ }
+ else
+ {
+ /*
+ S32 size;
+ if (mesgsys->getReceiveCompressedSize())
+ {
+ size = mesgsys->getReceiveCompressedSize();
+ }
+ else
+ {
+ size = mesgsys->getReceiveSize();
+ }
+
+ LL_INFOS() << "Received " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << LL_ENDL;
+ */
+ gFullObjectUpdates += num_objects;
+ }
+
+ U64 region_handle;
+ mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
+
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
+
+ if (!regionp)
+ {
+ LL_WARNS() << "Object update from unknown region! " << region_handle << LL_ENDL;
+ return;
+ }
+
+ U8 compressed_dpbuffer[2048];
+ LLDataPackerBinaryBuffer compressed_dp(compressed_dpbuffer, 2048);
+ LLViewerStatsRecorder& recorder = LLViewerStatsRecorder::instance();
+
+ for (i = 0; i < num_objects; i++)
+ {
+ BOOL justCreated = FALSE;
+ bool update_cache = false; //update object cache if it is a full-update or terse update
+
+ if (compressed)
+ {
+ compressed_dp.reset();
+
+ S32 uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data);
+ LL_DEBUGS("ObjectUpdate") << "got binary data from message to compressed_dpbuffer" << LL_ENDL;
+ mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i, 2048);
+ compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length);
+
+ if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
+ {
+ U32 flags = 0;
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
+
+ compressed_dp.unpackUUID(fullid, "ID");
+ compressed_dp.unpackU32(local_id, "LocalID");
+ compressed_dp.unpackU8(pcode, "PCode");
+
+ if (pcode == 0)
+ {
+ // object creation will fail, LLViewerObject::createObject()
+ LL_WARNS() << "Received object " << fullid
+ << " with 0 PCode. Local id: " << local_id
+ << " Flags: " << flags
+ << " Region: " << regionp->getName()
+ << " Region id: " << regionp->getRegionID() << LL_ENDL;
+ recorder.objectUpdateFailure();
+ continue;
+ }
+ else if ((flags & FLAGS_TEMPORARY_ON_REZ) == 0)
+ {
+ //send to object cache
+ regionp->cacheFullUpdate(compressed_dp, flags);
+ continue;
+ }
+ }
+ else //OUT_TERSE_IMPROVED
+ {
+ update_cache = true;
+ compressed_dp.unpackU32(local_id, "LocalID");
+ getUUIDFromLocal(fullid,
+ local_id,
+ gMessageSystem->getSenderIP(),
+ gMessageSystem->getSenderPort());
+ if (fullid.isNull())
+ {
+ LL_DEBUGS() << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << ":" << gMessageSystem->getSenderPort() << LL_ENDL;
+ mNumUnknownUpdates++;
+ }
+ }
+ }
+ else if (update_type != OUT_FULL) // !compressed, !OUT_FULL ==> OUT_FULL_CACHED only?
+ {
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
+
+ getUUIDFromLocal(fullid,
+ local_id,
+ gMessageSystem->getSenderIP(),
+ gMessageSystem->getSenderPort());
+ if (fullid.isNull())
+ {
+ // LL_WARNS() << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << LL_ENDL;
+ mNumUnknownUpdates++;
+ }
else
{
LL_DEBUGS("ObjectUpdate") << "Non-full, non-compressed update, obj " << local_id << ", global ID " << fullid << " from " << mesgsys->getSender() << LL_ENDL;
}
- }
- else // OUT_FULL only?
- {
- update_cache = true;
- mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FullID, fullid, i);
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
- LL_DEBUGS("ObjectUpdate") << "Full Update, obj " << local_id << ", global ID " << fullid << " from " << mesgsys->getSender() << LL_ENDL;
- }
- objectp = findObject(fullid);
+ }
+ else // OUT_FULL only?
+ {
+ update_cache = true;
+ mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FullID, fullid, i);
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
+ LL_DEBUGS("ObjectUpdate") << "Full Update, obj " << local_id << ", global ID " << fullid << " from " << mesgsys->getSender() << LL_ENDL;
+ }
+ objectp = findObject(fullid);
if (compressed)
{
LL_DEBUGS("ObjectUpdate") << "uuid " << fullid << " received compressed data from message (earlier in function)" << LL_ENDL;
}
- LL_DEBUGS("ObjectUpdate") << "uuid " << fullid << " objectp " << objectp
+ LL_DEBUGS("ObjectUpdate") << "uuid " << fullid << " objectp " << objectp
<< " update_cache " << (S32) update_cache << " compressed " << compressed
<< " update_type " << update_type << LL_ENDL;
dumpStack("ObjectUpdateStack");
-
- if(update_cache)
- {
+
+ if(update_cache)
+ {
//update object cache if the object receives a full-update or terse update
- objectp = regionp->updateCacheEntry(local_id, objectp);
- }
-
- // This looks like it will break if the local_id of the object doesn't change
- // upon boundary crossing, but we check for region id matching later...
- // Reset object local id and region pointer if things have changed
- if (objectp &&
- ((objectp->mLocalID != local_id) ||
- (objectp->getRegion() != regionp)))
- {
- //if (objectp->getRegion())
- //{
- // LL_INFOS() << "Local ID change: Removing object from table, local ID " << objectp->mLocalID
- // << ", id from message " << local_id << ", from "
- // << LLHost(objectp->getRegion()->getHost().getAddress(), objectp->getRegion()->getHost().getPort())
- // << ", full id " << fullid
- // << ", objects id " << objectp->getID()
- // << ", regionp " << (U32) regionp << ", object region " << (U32) objectp->getRegion()
- // << LL_ENDL;
- //}
- removeFromLocalIDTable(objectp);
- setUUIDAndLocal(fullid,
- local_id,
- gMessageSystem->getSenderIP(),
- gMessageSystem->getSenderPort());
-
- if (objectp->mLocalID != local_id)
- { // Update local ID in object with the one sent from the region
- objectp->mLocalID = local_id;
- }
-
- if (objectp->getRegion() != regionp)
- { // Object changed region, so update it
- objectp->updateRegion(regionp); // for LLVOAvatar
- }
- }
-
- if (!objectp)
- {
- if (compressed)
- {
- if (update_type == OUT_TERSE_IMPROVED)
- {
- // LL_INFOS() << "terse update for an unknown object (compressed):" << fullid << LL_ENDL;
- recorder.objectUpdateFailure();
- continue;
- }
- }
- else
- {
- if (update_type != OUT_FULL)
- {
- //LL_INFOS() << "terse update for an unknown object:" << fullid << LL_ENDL;
- recorder.objectUpdateFailure();
- continue;
- }
-
- mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_PCode, pcode, i);
-
- }
+ objectp = regionp->updateCacheEntry(local_id, objectp);
+ }
+
+ // This looks like it will break if the local_id of the object doesn't change
+ // upon boundary crossing, but we check for region id matching later...
+ // Reset object local id and region pointer if things have changed
+ if (objectp &&
+ ((objectp->mLocalID != local_id) ||
+ (objectp->getRegion() != regionp)))
+ {
+ //if (objectp->getRegion())
+ //{
+ // LL_INFOS() << "Local ID change: Removing object from table, local ID " << objectp->mLocalID
+ // << ", id from message " << local_id << ", from "
+ // << LLHost(objectp->getRegion()->getHost().getAddress(), objectp->getRegion()->getHost().getPort())
+ // << ", full id " << fullid
+ // << ", objects id " << objectp->getID()
+ // << ", regionp " << (U32) regionp << ", object region " << (U32) objectp->getRegion()
+ // << LL_ENDL;
+ //}
+ removeFromLocalIDTable(objectp);
+ setUUIDAndLocal(fullid,
+ local_id,
+ gMessageSystem->getSenderIP(),
+ gMessageSystem->getSenderPort());
+
+ if (objectp->mLocalID != local_id)
+ { // Update local ID in object with the one sent from the region
+ objectp->mLocalID = local_id;
+ }
+
+ if (objectp->getRegion() != regionp)
+ { // Object changed region, so update it
+ objectp->updateRegion(regionp); // for LLVOAvatar
+ }
+ }
+
+ if (!objectp)
+ {
+ if (compressed)
+ {
+ if (update_type == OUT_TERSE_IMPROVED)
+ {
+ // LL_INFOS() << "terse update for an unknown object (compressed):" << fullid << LL_ENDL;
+ recorder.objectUpdateFailure();
+ continue;
+ }
+ }
+ else
+ {
+ if (update_type != OUT_FULL)
+ {
+ //LL_INFOS() << "terse update for an unknown object:" << fullid << LL_ENDL;
+ recorder.objectUpdateFailure();
+ continue;
+ }
+
+ mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_PCode, pcode, i);
+
+ }
#ifdef IGNORE_DEAD
- if (mDeadObjects.find(fullid) != mDeadObjects.end())
- {
- mNumDeadObjectUpdates++;
- //LL_INFOS() << "update for a dead object:" << fullid << LL_ENDL;
- recorder.objectUpdateFailure();
- continue;
- }
+ if (mDeadObjects.find(fullid) != mDeadObjects.end())
+ {
+ mNumDeadObjectUpdates++;
+ //LL_INFOS() << "update for a dead object:" << fullid << LL_ENDL;
+ recorder.objectUpdateFailure();
+ continue;
+ }
#endif
- objectp = createObject(pcode, regionp, fullid, local_id, gMessageSystem->getSender());
+ objectp = createObject(pcode, regionp, fullid, local_id, gMessageSystem->getSender());
LL_DEBUGS("ObjectUpdate") << "creating object " << fullid << " result " << objectp << LL_ENDL;
dumpStack("ObjectUpdateStack");
- if (!objectp)
- {
- LL_INFOS() << "createObject failure for object: " << fullid << LL_ENDL;
- recorder.objectUpdateFailure();
- continue;
- }
-
- justCreated = TRUE;
- mNumNewObjects++;
- }
-
- if (objectp->isDead())
- {
- LL_WARNS() << "Dead object " << objectp->mID << " in UUID map 1!" << LL_ENDL;
- }
-
- //bool bCached = false;
- if (compressed)
- {
- if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
- {
- objectp->mLocalID = local_id;
- }
- processUpdateCore(objectp, user_data, i, update_type, &compressed_dp, justCreated);
+ if (!objectp)
+ {
+ LL_INFOS() << "createObject failure for object: " << fullid << LL_ENDL;
+ recorder.objectUpdateFailure();
+ continue;
+ }
+
+ justCreated = TRUE;
+ mNumNewObjects++;
+ }
+
+ if (objectp->isDead())
+ {
+ LL_WARNS() << "Dead object " << objectp->mID << " in UUID map 1!" << LL_ENDL;
+ }
+
+ //bool bCached = false;
+ if (compressed)
+ {
+ if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
+ {
+ objectp->mLocalID = local_id;
+ }
+ processUpdateCore(objectp, user_data, i, update_type, &compressed_dp, justCreated);
#if 0
- if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
- {
- U32 flags = 0;
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
-
- if(!(flags & FLAGS_TEMPORARY_ON_REZ))
- {
- bCached = true;
- LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp, flags);
- recorder.cacheFullUpdate(result);
- }
- }
+ if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
+ {
+ U32 flags = 0;
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
+
+ if(!(flags & FLAGS_TEMPORARY_ON_REZ))
+ {
+ bCached = true;
+ LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp, flags);
+ recorder.cacheFullUpdate(result);
+ }
+ }
#endif
- }
- else
- {
- if (update_type == OUT_FULL)
- {
- objectp->mLocalID = local_id;
- }
- processUpdateCore(objectp, user_data, i, update_type, NULL, justCreated);
- }
- recorder.objectUpdateEvent(update_type);
- objectp->setLastUpdateType(update_type);
- }
-
- LLVOAvatar::cullAvatarsByPixelArea();
+ }
+ else
+ {
+ if (update_type == OUT_FULL)
+ {
+ objectp->mLocalID = local_id;
+ }
+ processUpdateCore(objectp, user_data, i, update_type, NULL, justCreated);
+ }
+ recorder.objectUpdateEvent(update_type);
+ objectp->setLastUpdateType(update_type);
+ }
+
+ LLVOAvatar::cullAvatarsByPixelArea();
}
void LLViewerObjectList::processCompressedObjectUpdate(LLMessageSystem *mesgsys,
- void **user_data,
- const EObjectUpdateType update_type)
+ void **user_data,
+ const EObjectUpdateType update_type)
{
- processObjectUpdate(mesgsys, user_data, update_type, true);
+ processObjectUpdate(mesgsys, user_data, update_type, true);
}
void LLViewerObjectList::processCachedObjectUpdate(LLMessageSystem *mesgsys,
- void **user_data,
- const EObjectUpdateType update_type)
+ void **user_data,
+ const EObjectUpdateType update_type)
{
- //processObjectUpdate(mesgsys, user_data, update_type, true, false);
-
- S32 num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData);
- gFullObjectUpdates += num_objects;
-
- U64 region_handle;
- mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
- if (!regionp)
- {
- LL_WARNS() << "Object update from unknown region! " << region_handle << LL_ENDL;
- return;
- }
-
- LLViewerStatsRecorder& recorder = LLViewerStatsRecorder::instance();
-
- for (S32 i = 0; i < num_objects; i++)
- {
- U32 id;
- U32 crc;
- U32 flags;
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, id, i);
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_CRC, crc, i);
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
+ //processObjectUpdate(mesgsys, user_data, update_type, true, false);
+
+ S32 num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData);
+ gFullObjectUpdates += num_objects;
+
+ U64 region_handle;
+ mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
+ if (!regionp)
+ {
+ LL_WARNS() << "Object update from unknown region! " << region_handle << LL_ENDL;
+ return;
+ }
+
+ LLViewerStatsRecorder& recorder = LLViewerStatsRecorder::instance();
+
+ for (S32 i = 0; i < num_objects; i++)
+ {
+ U32 id;
+ U32 crc;
+ U32 flags;
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, id, i);
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_CRC, crc, i);
+ mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
LL_DEBUGS("ObjectUpdate") << "got probe for id " << id << " crc " << crc << LL_ENDL;
dumpStack("ObjectUpdateStack");
- // Lookup data packer and add this id to cache miss lists if necessary.
- U8 cache_miss_type = LLViewerRegion::CACHE_MISS_TYPE_NONE;
+ // Lookup data packer and add this id to cache miss lists if necessary.
+ U8 cache_miss_type = LLViewerRegion::CACHE_MISS_TYPE_NONE;
if (regionp->probeCache(id, crc, flags, cache_miss_type))
- { // Cache Hit
+ { // Cache Hit
recorder.cacheHitEvent();
- }
+ }
else
- { // Cache Miss
+ { // Cache Miss
LL_DEBUGS("ObjectUpdate") << "cache miss for id " << id << " crc " << crc << " miss type " << (S32) cache_miss_type << LL_ENDL;
recorder.cacheMissEvent(cache_miss_type);
- }
- }
+ }
+ }
- return;
-}
+ return;
+}
void LLViewerObjectList::dirtyAllObjectInventory()
{
- for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
- {
- (*iter)->dirtyInventory();
- }
+ for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+ {
+ (*iter)->dirtyInventory();
+ }
}
void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
{
- S32 i;
- LLViewerObject *objectp;
-
- S32 num_updates, max_value;
- if (NUM_BINS - 1 == mCurBin)
- {
- // Remainder (mObjects.size() could have changed)
- num_updates = (S32) mObjects.size() - mCurLazyUpdateIndex;
- max_value = (S32) mObjects.size();
- }
- else
- {
- num_updates = ((S32) mObjects.size() / NUM_BINS) + 1;
- max_value = llmin((S32) mObjects.size(), mCurLazyUpdateIndex + num_updates);
- }
-
- // Iterate through some of the objects and lazy update their texture priorities
- for (i = mCurLazyUpdateIndex; i < max_value; i++)
- {
- objectp = mObjects[i];
- if (!objectp->isDead())
- {
- // Update distance & gpw
- objectp->setPixelAreaAndAngle(agent); // Also sets the approx. pixel area
- objectp->updateTextures(); // Update the image levels of textures for this object.
- }
- }
-
- mCurLazyUpdateIndex = max_value;
- if (mCurLazyUpdateIndex == mObjects.size())
- {
- // restart
- mCurLazyUpdateIndex = 0;
- mCurBin = 0; // keep in sync with index (mObjects.size() could have changed)
- }
- else
- {
- mCurBin = (mCurBin + 1) % NUM_BINS;
- }
+ S32 i;
+ LLViewerObject *objectp;
+
+ S32 num_updates, max_value;
+ if (NUM_BINS - 1 == mCurBin)
+ {
+ // Remainder (mObjects.size() could have changed)
+ num_updates = (S32) mObjects.size() - mCurLazyUpdateIndex;
+ max_value = (S32) mObjects.size();
+ }
+ else
+ {
+ num_updates = ((S32) mObjects.size() / NUM_BINS) + 1;
+ max_value = llmin((S32) mObjects.size(), mCurLazyUpdateIndex + num_updates);
+ }
+
+ // Iterate through some of the objects and lazy update their texture priorities
+ for (i = mCurLazyUpdateIndex; i < max_value; i++)
+ {
+ objectp = mObjects[i];
+ if (!objectp->isDead())
+ {
+ // Update distance & gpw
+ objectp->setPixelAreaAndAngle(agent); // Also sets the approx. pixel area
+ objectp->updateTextures(); // Update the image levels of textures for this object.
+ }
+ }
+
+ mCurLazyUpdateIndex = max_value;
+ if (mCurLazyUpdateIndex == mObjects.size())
+ {
+ // restart
+ mCurLazyUpdateIndex = 0;
+ mCurBin = 0; // keep in sync with index (mObjects.size() could have changed)
+ }
+ else
+ {
+ mCurBin = (mCurBin + 1) % NUM_BINS;
+ }
#if 0
- // Slam priorities for textures that we care about (hovered, selected, and focused)
- // Hovered
- // Assumes only one level deep of parenting
- LLSelectNode* nodep = LLSelectMgr::instance().getHoverNode();
+ // Slam priorities for textures that we care about (hovered, selected, and focused)
+ // Hovered
+ // Assumes only one level deep of parenting
+ LLSelectNode* nodep = LLSelectMgr::instance().getHoverNode();
if (nodep)
{
objectp = nodep->getObject();
@@ -813,236 +813,236 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
}
}
- // Focused
- objectp = gAgentCamera.getFocusObject();
- if (objectp)
- {
- objectp->boostTexturePriority();
- }
+ // Focused
+ objectp = gAgentCamera.getFocusObject();
+ if (objectp)
+ {
+ objectp->boostTexturePriority();
+ }
#endif
- // Selected
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* objectp)
- {
+ // Selected
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* objectp)
+ {
if (objectp)
{
objectp->boostTexturePriority();
}
- return true;
- }
- } func;
- LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func);
+ return true;
+ }
+ } func;
+ LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func);
- LLVOAvatar::cullAvatarsByPixelArea();
+ LLVOAvatar::cullAvatarsByPixelArea();
}
void LLViewerObjectList::update(LLAgent &agent)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
-
- // Update globals
- LLViewerObject::setVelocityInterpolate( gSavedSettings.getBOOL("VelocityInterpolate") );
- LLViewerObject::setPingInterpolate( gSavedSettings.getBOOL("PingInterpolate") );
-
- F32 interp_time = gSavedSettings.getF32("InterpolationTime");
- F32 phase_out_time = gSavedSettings.getF32("InterpolationPhaseOut");
- F32 region_interp_time = llclamp(gSavedSettings.getF32("RegionCrossingInterpolationTime"), 0.5f, 5.f);
- if (interp_time < 0.0 ||
- phase_out_time < 0.0 ||
- phase_out_time > interp_time)
- {
- LL_WARNS() << "Invalid values for InterpolationTime or InterpolationPhaseOut, resetting to defaults" << LL_ENDL;
- interp_time = 3.0f;
- phase_out_time = 1.0f;
- }
- LLViewerObject::setPhaseOutUpdateInterpolationTime( interp_time );
- LLViewerObject::setMaxUpdateInterpolationTime( phase_out_time );
- LLViewerObject::setMaxRegionCrossingInterpolationTime(region_interp_time);
-
- gAnimateTextures = gSavedSettings.getBOOL("AnimateTextures");
-
- // update global timer
- F32 last_time = gFrameTimeSeconds;
- U64Microseconds time = totalTime(); // this will become the new gFrameTime when the update is done
- // Time _can_ go backwards, for example if the user changes the system clock.
- // It doesn't cause any fatal problems (just some oddness with stats), so we shouldn't assert here.
-// llassert(time > gFrameTime);
- F64Seconds time_diff = time - gFrameTime;
- gFrameTime = time;
- F64Seconds time_since_start = gFrameTime - gStartTime;
- gFrameTimeSeconds = time_since_start;
-
- gFrameIntervalSeconds = gFrameTimeSeconds - last_time;
- if (gFrameIntervalSeconds < 0.f)
- {
- gFrameIntervalSeconds = 0.f;
- }
-
- //clear avatar LOD change counter
- LLVOAvatar::sNumLODChangesThisFrame = 0;
-
- const F64 frame_time = LLFrameTimer::getElapsedSeconds();
-
- LLViewerObject *objectp = NULL;
-
- // Make a copy of the list in case something in idleUpdate() messes with it
- static std::vector<LLViewerObject*> idle_list;
-
- U32 idle_count = 0;
-
- {
- for (std::vector<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();
- active_iter != mActiveObjects.end(); active_iter++)
- {
- objectp = *active_iter;
- if (objectp)
- {
- if (idle_count >= idle_list.size())
- {
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
+
+ // Update globals
+ LLViewerObject::setVelocityInterpolate( gSavedSettings.getBOOL("VelocityInterpolate") );
+ LLViewerObject::setPingInterpolate( gSavedSettings.getBOOL("PingInterpolate") );
+
+ F32 interp_time = gSavedSettings.getF32("InterpolationTime");
+ F32 phase_out_time = gSavedSettings.getF32("InterpolationPhaseOut");
+ F32 region_interp_time = llclamp(gSavedSettings.getF32("RegionCrossingInterpolationTime"), 0.5f, 5.f);
+ if (interp_time < 0.0 ||
+ phase_out_time < 0.0 ||
+ phase_out_time > interp_time)
+ {
+ LL_WARNS() << "Invalid values for InterpolationTime or InterpolationPhaseOut, resetting to defaults" << LL_ENDL;
+ interp_time = 3.0f;
+ phase_out_time = 1.0f;
+ }
+ LLViewerObject::setPhaseOutUpdateInterpolationTime( interp_time );
+ LLViewerObject::setMaxUpdateInterpolationTime( phase_out_time );
+ LLViewerObject::setMaxRegionCrossingInterpolationTime(region_interp_time);
+
+ gAnimateTextures = gSavedSettings.getBOOL("AnimateTextures");
+
+ // update global timer
+ F32 last_time = gFrameTimeSeconds;
+ U64Microseconds time = totalTime(); // this will become the new gFrameTime when the update is done
+ // Time _can_ go backwards, for example if the user changes the system clock.
+ // It doesn't cause any fatal problems (just some oddness with stats), so we shouldn't assert here.
+// llassert(time > gFrameTime);
+ F64Seconds time_diff = time - gFrameTime;
+ gFrameTime = time;
+ F64Seconds time_since_start = gFrameTime - gStartTime;
+ gFrameTimeSeconds = time_since_start;
+
+ gFrameIntervalSeconds = gFrameTimeSeconds - last_time;
+ if (gFrameIntervalSeconds < 0.f)
+ {
+ gFrameIntervalSeconds = 0.f;
+ }
+
+ //clear avatar LOD change counter
+ LLVOAvatar::sNumLODChangesThisFrame = 0;
+
+ const F64 frame_time = LLFrameTimer::getElapsedSeconds();
+
+ LLViewerObject *objectp = NULL;
+
+ // Make a copy of the list in case something in idleUpdate() messes with it
+ static std::vector<LLViewerObject*> idle_list;
+
+ U32 idle_count = 0;
+
+ {
+ for (std::vector<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();
+ active_iter != mActiveObjects.end(); active_iter++)
+ {
+ objectp = *active_iter;
+ if (objectp)
+ {
+ if (idle_count >= idle_list.size())
+ {
idle_list.push_back( objectp );
}
- else
- {
- idle_list[idle_count] = objectp;
- }
- ++idle_count;
- }
- else
- { // There shouldn't be any NULL pointers in the list, but they have caused
- // crashes before. This may be idleUpdate() messing with the list.
- LL_WARNS() << "LLViewerObjectList::update has a NULL objectp" << LL_ENDL;
- }
- }
- }
-
- std::vector<LLViewerObject*>::iterator idle_end = idle_list.begin()+idle_count;
-
- if (gSavedSettings.getBOOL("FreezeTime"))
- {
-
- for (std::vector<LLViewerObject*>::iterator iter = idle_list.begin();
- iter != idle_end; iter++)
- {
- objectp = *iter;
- if (objectp->isAvatar())
- {
- objectp->idleUpdate(agent, frame_time);
- }
- }
- }
- else
- {
- for (std::vector<LLViewerObject*>::iterator idle_iter = idle_list.begin();
- idle_iter != idle_end; idle_iter++)
- {
- objectp = *idle_iter;
- llassert(objectp->isActive());
+ else
+ {
+ idle_list[idle_count] = objectp;
+ }
+ ++idle_count;
+ }
+ else
+ { // There shouldn't be any NULL pointers in the list, but they have caused
+ // crashes before. This may be idleUpdate() messing with the list.
+ LL_WARNS() << "LLViewerObjectList::update has a NULL objectp" << LL_ENDL;
+ }
+ }
+ }
+
+ std::vector<LLViewerObject*>::iterator idle_end = idle_list.begin()+idle_count;
+
+ if (gSavedSettings.getBOOL("FreezeTime"))
+ {
+
+ for (std::vector<LLViewerObject*>::iterator iter = idle_list.begin();
+ iter != idle_end; iter++)
+ {
+ objectp = *iter;
+ if (objectp->isAvatar())
+ {
+ objectp->idleUpdate(agent, frame_time);
+ }
+ }
+ }
+ else
+ {
+ for (std::vector<LLViewerObject*>::iterator idle_iter = idle_list.begin();
+ idle_iter != idle_end; idle_iter++)
+ {
+ objectp = *idle_iter;
+ llassert(objectp->isActive());
objectp->idleUpdate(agent, frame_time);
- }
-
- //update flexible objects
- LLVolumeImplFlexible::updateClass();
-
- //update animated textures
- if (gAnimateTextures)
- {
- LLViewerTextureAnim::updateClass();
- }
- }
-
-
-
- fetchObjectCosts();
- fetchPhysicsFlags();
-
- // update max computed render cost
- LLVOVolume::updateRenderComplexity();
-
- // compute all sorts of time-based stats
- // don't factor frames that were paused into the stats
- if (! mWasPaused)
- {
- LLViewerStats::getInstance()->updateFrameStats(time_diff);
- }
-
- /*
- // Debugging code for viewing orphans, and orphaned parents
- LLUUID id;
- for (i = 0; i < mOrphanParents.size(); i++)
- {
- id = sIndexAndLocalIDToUUID[mOrphanParents[i]];
- LLViewerObject *objectp = findObject(id);
- if (objectp)
- {
- std::string id_str;
- objectp->mID.toString(id_str);
- std::string tmpstr = std::string("Par: ") + id_str;
- addDebugBeacon(objectp->getPositionAgent(),
- tmpstr,
- LLColor4(1.f,0.f,0.f,1.f),
- LLColor4(1.f,1.f,1.f,1.f));
- }
- }
-
- LLColor4 text_color;
- for (i = 0; i < mOrphanChildren.size(); i++)
- {
- OrphanInfo oi = mOrphanChildren[i];
- LLViewerObject *objectp = findObject(oi.mChildInfo);
- if (objectp)
- {
- std::string id_str;
- objectp->mID.toString(id_str);
- std::string tmpstr;
- if (objectp->getParent())
- {
- tmpstr = std::string("ChP: ") + id_str;
- text_color = LLColor4(0.f, 1.f, 0.f, 1.f);
- }
- else
- {
- tmpstr = std::string("ChNoP: ") + id_str;
- text_color = LLColor4(1.f, 0.f, 0.f, 1.f);
- }
- id = sIndexAndLocalIDToUUID[oi.mParentInfo];
- addDebugBeacon(objectp->getPositionAgent() + LLVector3(0.f, 0.f, -0.25f),
- tmpstr,
- LLColor4(0.25f,0.25f,0.25f,1.f),
- text_color);
- }
- i++;
- }
- */
-
- sample(LLStatViewer::NUM_OBJECTS, mObjects.size());
- sample(LLStatViewer::NUM_ACTIVE_OBJECTS, idle_count);
+ }
+
+ //update flexible objects
+ LLVolumeImplFlexible::updateClass();
+
+ //update animated textures
+ if (gAnimateTextures)
+ {
+ LLViewerTextureAnim::updateClass();
+ }
+ }
+
+
+
+ fetchObjectCosts();
+ fetchPhysicsFlags();
+
+ // update max computed render cost
+ LLVOVolume::updateRenderComplexity();
+
+ // compute all sorts of time-based stats
+ // don't factor frames that were paused into the stats
+ if (! mWasPaused)
+ {
+ LLViewerStats::getInstance()->updateFrameStats(time_diff);
+ }
+
+ /*
+ // Debugging code for viewing orphans, and orphaned parents
+ LLUUID id;
+ for (i = 0; i < mOrphanParents.size(); i++)
+ {
+ id = sIndexAndLocalIDToUUID[mOrphanParents[i]];
+ LLViewerObject *objectp = findObject(id);
+ if (objectp)
+ {
+ std::string id_str;
+ objectp->mID.toString(id_str);
+ std::string tmpstr = std::string("Par: ") + id_str;
+ addDebugBeacon(objectp->getPositionAgent(),
+ tmpstr,
+ LLColor4(1.f,0.f,0.f,1.f),
+ LLColor4(1.f,1.f,1.f,1.f));
+ }
+ }
+
+ LLColor4 text_color;
+ for (i = 0; i < mOrphanChildren.size(); i++)
+ {
+ OrphanInfo oi = mOrphanChildren[i];
+ LLViewerObject *objectp = findObject(oi.mChildInfo);
+ if (objectp)
+ {
+ std::string id_str;
+ objectp->mID.toString(id_str);
+ std::string tmpstr;
+ if (objectp->getParent())
+ {
+ tmpstr = std::string("ChP: ") + id_str;
+ text_color = LLColor4(0.f, 1.f, 0.f, 1.f);
+ }
+ else
+ {
+ tmpstr = std::string("ChNoP: ") + id_str;
+ text_color = LLColor4(1.f, 0.f, 0.f, 1.f);
+ }
+ id = sIndexAndLocalIDToUUID[oi.mParentInfo];
+ addDebugBeacon(objectp->getPositionAgent() + LLVector3(0.f, 0.f, -0.25f),
+ tmpstr,
+ LLColor4(0.25f,0.25f,0.25f,1.f),
+ text_color);
+ }
+ i++;
+ }
+ */
+
+ sample(LLStatViewer::NUM_OBJECTS, mObjects.size());
+ sample(LLStatViewer::NUM_ACTIVE_OBJECTS, idle_count);
}
void LLViewerObjectList::fetchObjectCosts()
{
- // issue http request for stale object physics costs
- if (!mStaleObjectCost.empty())
- {
- LLViewerRegion* regionp = gAgent.getRegion();
+ // issue http request for stale object physics costs
+ if (!mStaleObjectCost.empty())
+ {
+ LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- std::string url = regionp->getCapability("GetObjectCost");
+ if (regionp)
+ {
+ std::string url = regionp->getCapability("GetObjectCost");
- if (!url.empty())
- {
+ if (!url.empty())
+ {
LLCoros::instance().launch("LLViewerObjectList::fetchObjectCostsCoro",
boost::bind(&LLViewerObjectList::fetchObjectCostsCoro, this, url));
- }
- else
- {
- mStaleObjectCost.clear();
- mPendingObjectCost.clear();
- }
- }
- }
+ }
+ else
+ {
+ mStaleObjectCost.clear();
+ mPendingObjectCost.clear();
+ }
+ }
+ }
}
/*static*/
@@ -1068,7 +1068,7 @@ void LLViewerObjectList::fetchObjectCostsCoro(std::string url)
uuid_set_t diff;
std::set_difference(mStaleObjectCost.begin(), mStaleObjectCost.end(),
- mPendingObjectCost.begin(), mPendingObjectCost.end(),
+ mPendingObjectCost.begin(), mPendingObjectCost.end(),
std::inserter(diff, diff.begin()));
mStaleObjectCost.clear();
@@ -1147,27 +1147,27 @@ void LLViewerObjectList::fetchObjectCostsCoro(std::string url)
void LLViewerObjectList::fetchPhysicsFlags()
{
- // issue http request for stale object physics flags
- if (!mStalePhysicsFlags.empty())
- {
- LLViewerRegion* regionp = gAgent.getRegion();
+ // issue http request for stale object physics flags
+ if (!mStalePhysicsFlags.empty())
+ {
+ LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- std::string url = regionp->getCapability("GetObjectPhysicsData");
+ if (regionp)
+ {
+ std::string url = regionp->getCapability("GetObjectPhysicsData");
- if (!url.empty())
- {
+ if (!url.empty())
+ {
LLCoros::instance().launch("LLViewerObjectList::fetchPhisicsFlagsCoro",
boost::bind(&LLViewerObjectList::fetchPhisicsFlagsCoro, this, url));
- }
- else
- {
- mStalePhysicsFlags.clear();
- mPendingPhysicsFlags.clear();
- }
- }
- }
+ }
+ else
+ {
+ mStalePhysicsFlags.clear();
+ mPendingPhysicsFlags.clear();
+ }
+ }
+ }
}
/*static*/
@@ -1262,7 +1262,7 @@ void LLViewerObjectList::fetchPhisicsFlagsCoro(std::string url)
F32 restitution = data["Restitution"].asReal();
F32 gravityMult = data["GravityMultiplier"].asReal();
- gObjectList.updatePhysicsProperties(objectId, density,
+ gObjectList.updatePhysicsProperties(objectId, density,
friction, restitution, gravityMult);
}
}
@@ -1276,528 +1276,528 @@ void LLViewerObjectList::fetchPhisicsFlagsCoro(std::string url)
void LLViewerObjectList::clearDebugText()
{
- for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
- {
- (*iter)->restoreHudText();
- }
+ for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+ {
+ (*iter)->restoreHudText();
+ }
}
void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
-
- bool new_dead_object = true;
- if (mDeadObjects.find(objectp->mID) != mDeadObjects.end())
- {
- LL_INFOS() << "Object " << objectp->mID << " already on dead list!" << LL_ENDL;
- new_dead_object = false;
- }
- else
- {
- mDeadObjects.insert(objectp->mID);
- }
-
- // Cleanup any references we have to this object
- // Remove from object map so noone can look it up.
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
+
+ bool new_dead_object = true;
+ if (mDeadObjects.find(objectp->mID) != mDeadObjects.end())
+ {
+ LL_INFOS() << "Object " << objectp->mID << " already on dead list!" << LL_ENDL;
+ new_dead_object = false;
+ }
+ else
+ {
+ mDeadObjects.insert(objectp->mID);
+ }
+
+ // Cleanup any references we have to this object
+ // Remove from object map so noone can look it up.
LL_DEBUGS("ObjectUpdate") << " dereferencing id " << objectp->mID << LL_ENDL;
dumpStack("ObjectUpdateStack");
-
- mUUIDObjectMap.erase(objectp->mID);
-
- //if (objectp->getRegion())
- //{
- // LL_INFOS() << "cleanupReferences removing object from table, local ID " << objectp->mLocalID << ", ip "
- // << objectp->getRegion()->getHost().getAddress() << ":"
- // << objectp->getRegion()->getHost().getPort() << LL_ENDL;
- //}
-
- removeFromLocalIDTable(objectp);
-
- if (objectp->onActiveList())
- {
- //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << LL_ENDL;
- objectp->setOnActiveList(FALSE);
- removeFromActiveList(objectp);
- }
-
- if (objectp->isOnMap())
- {
- removeFromMap(objectp);
- }
-
- // Don't clean up mObject references, these will be cleaned up more efficiently later!
-
- if(new_dead_object)
- {
- mNumDeadObjects++;
- }
+
+ mUUIDObjectMap.erase(objectp->mID);
+
+ //if (objectp->getRegion())
+ //{
+ // LL_INFOS() << "cleanupReferences removing object from table, local ID " << objectp->mLocalID << ", ip "
+ // << objectp->getRegion()->getHost().getAddress() << ":"
+ // << objectp->getRegion()->getHost().getPort() << LL_ENDL;
+ //}
+
+ removeFromLocalIDTable(objectp);
+
+ if (objectp->onActiveList())
+ {
+ //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << LL_ENDL;
+ objectp->setOnActiveList(FALSE);
+ removeFromActiveList(objectp);
+ }
+
+ if (objectp->isOnMap())
+ {
+ removeFromMap(objectp);
+ }
+
+ // Don't clean up mObject references, these will be cleaned up more efficiently later!
+
+ if(new_dead_object)
+ {
+ mNumDeadObjects++;
+ }
}
BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
{
LL_PROFILE_ZONE_SCOPED;
- // Don't ever kill gAgentAvatarp, just force it to the agent's region
- // unless region is NULL which is assumed to mean you are logging out.
- if ((objectp == gAgentAvatarp) && gAgent.getRegion())
- {
- objectp->setRegion(gAgent.getRegion());
- return FALSE;
- }
-
- // When we're killing objects, all we do is mark them as dead.
- // We clean up the dead objects later.
-
- if (objectp)
- {
- // We are going to cleanup a lot of smart pointers to this object, they might be last,
- // and object being NULLed while inside it's own function won't be pretty
- // so create a pointer to make sure object will stay alive untill markDead() finishes
- LLPointer<LLViewerObject> sp(objectp);
- sp->markDead(); // does the right thing if object already dead
- return TRUE;
- }
-
- return FALSE;
+ // Don't ever kill gAgentAvatarp, just force it to the agent's region
+ // unless region is NULL which is assumed to mean you are logging out.
+ if ((objectp == gAgentAvatarp) && gAgent.getRegion())
+ {
+ objectp->setRegion(gAgent.getRegion());
+ return FALSE;
+ }
+
+ // When we're killing objects, all we do is mark them as dead.
+ // We clean up the dead objects later.
+
+ if (objectp)
+ {
+ // We are going to cleanup a lot of smart pointers to this object, they might be last,
+ // and object being NULLed while inside it's own function won't be pretty
+ // so create a pointer to make sure object will stay alive untill markDead() finishes
+ LLPointer<LLViewerObject> sp(objectp);
+ sp->markDead(); // does the right thing if object already dead
+ return TRUE;
+ }
+
+ return FALSE;
}
void LLViewerObjectList::killObjects(LLViewerRegion *regionp)
{
LL_PROFILE_ZONE_SCOPED;
- LLViewerObject *objectp;
-
-
- for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
- {
- objectp = *iter;
-
- if (objectp->mRegionp == regionp)
- {
- killObject(objectp);
- }
- }
-
- // Have to clean right away because the region is becoming invalid.
- cleanDeadObjects(FALSE);
+ LLViewerObject *objectp;
+
+
+ for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+ {
+ objectp = *iter;
+
+ if (objectp->mRegionp == regionp)
+ {
+ killObject(objectp);
+ }
+ }
+
+ // Have to clean right away because the region is becoming invalid.
+ cleanDeadObjects(FALSE);
}
void LLViewerObjectList::killAllObjects()
{
- // Used only on global destruction.
- LLViewerObject *objectp;
-
- for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
- {
- objectp = *iter;
- killObject(objectp);
- // Object must be dead, or it's the LLVOAvatarSelf which never dies.
- llassert((objectp == gAgentAvatarp) || objectp->isDead());
- }
-
- cleanDeadObjects(FALSE);
-
- if(!mObjects.empty())
- {
- LL_WARNS() << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.size() << LL_ENDL;
- mObjects.clear();
- }
-
- if (!mActiveObjects.empty())
- {
- LL_WARNS() << "Some objects still on active object list!" << LL_ENDL;
- mActiveObjects.clear();
- }
-
- if (!mMapObjects.empty())
- {
- LL_WARNS() << "Some objects still on map object list!" << LL_ENDL;
- mMapObjects.clear();
- }
+ // Used only on global destruction.
+ LLViewerObject *objectp;
+
+ for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+ {
+ objectp = *iter;
+ killObject(objectp);
+ // Object must be dead, or it's the LLVOAvatarSelf which never dies.
+ llassert((objectp == gAgentAvatarp) || objectp->isDead());
+ }
+
+ cleanDeadObjects(FALSE);
+
+ if(!mObjects.empty())
+ {
+ LL_WARNS() << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.size() << LL_ENDL;
+ mObjects.clear();
+ }
+
+ if (!mActiveObjects.empty())
+ {
+ LL_WARNS() << "Some objects still on active object list!" << LL_ENDL;
+ mActiveObjects.clear();
+ }
+
+ if (!mMapObjects.empty())
+ {
+ LL_WARNS() << "Some objects still on map object list!" << LL_ENDL;
+ mMapObjects.clear();
+ }
}
void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)
{
- if (!mNumDeadObjects)
- {
- // No dead objects, don't need to scan object list.
- return;
- }
+ if (!mNumDeadObjects)
+ {
+ // No dead objects, don't need to scan object list.
+ return;
+ }
LL_PROFILE_ZONE_SCOPED;
- S32 num_removed = 0;
- LLViewerObject *objectp;
-
- vobj_list_t::reverse_iterator target = mObjects.rbegin();
-
- vobj_list_t::iterator iter = mObjects.begin();
- for ( ; iter != mObjects.end(); )
- {
- // Scan for all of the dead objects and put them all on the end of the list with no ref count ops
- objectp = *iter;
- if (objectp == NULL)
- { //we caught up to the dead tail
- break;
- }
-
- if (objectp->isDead())
- {
- LLPointer<LLViewerObject>::swap(*iter, *target);
- *target = NULL;
- ++target;
- num_removed++;
-
- if (num_removed == mNumDeadObjects || iter->isNull())
- {
- // We've cleaned up all of the dead objects or caught up to the dead tail
- break;
- }
- }
- else
- {
- ++iter;
- }
- }
-
- llassert(num_removed == mNumDeadObjects);
-
- //erase as a block
- mObjects.erase(mObjects.begin()+(mObjects.size()-mNumDeadObjects), mObjects.end());
-
- // We've cleaned the global object list, now let's do some paranoia testing on objects
- // before blowing away the dead list.
- mDeadObjects.clear();
- mNumDeadObjects = 0;
+ S32 num_removed = 0;
+ LLViewerObject *objectp;
+
+ vobj_list_t::reverse_iterator target = mObjects.rbegin();
+
+ vobj_list_t::iterator iter = mObjects.begin();
+ for ( ; iter != mObjects.end(); )
+ {
+ // Scan for all of the dead objects and put them all on the end of the list with no ref count ops
+ objectp = *iter;
+ if (objectp == NULL)
+ { //we caught up to the dead tail
+ break;
+ }
+
+ if (objectp->isDead())
+ {
+ LLPointer<LLViewerObject>::swap(*iter, *target);
+ *target = NULL;
+ ++target;
+ num_removed++;
+
+ if (num_removed == mNumDeadObjects || iter->isNull())
+ {
+ // We've cleaned up all of the dead objects or caught up to the dead tail
+ break;
+ }
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+
+ llassert(num_removed == mNumDeadObjects);
+
+ //erase as a block
+ mObjects.erase(mObjects.begin()+(mObjects.size()-mNumDeadObjects), mObjects.end());
+
+ // We've cleaned the global object list, now let's do some paranoia testing on objects
+ // before blowing away the dead list.
+ mDeadObjects.clear();
+ mNumDeadObjects = 0;
}
void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp)
{
- S32 idx = objectp->getListIndex();
- if (idx != -1)
- { //remove by moving last element to this object's position
- llassert(mActiveObjects[idx] == objectp);
-
- objectp->setListIndex(-1);
-
- S32 last_index = mActiveObjects.size()-1;
-
- if (idx != last_index)
- {
- mActiveObjects[idx] = mActiveObjects[last_index];
- mActiveObjects[idx]->setListIndex(idx);
- }
-
- mActiveObjects.pop_back();
- }
+ S32 idx = objectp->getListIndex();
+ if (idx != -1)
+ { //remove by moving last element to this object's position
+ llassert(mActiveObjects[idx] == objectp);
+
+ objectp->setListIndex(-1);
+
+ S32 last_index = mActiveObjects.size()-1;
+
+ if (idx != last_index)
+ {
+ mActiveObjects[idx] = mActiveObjects[last_index];
+ mActiveObjects[idx]->setListIndex(idx);
+ }
+
+ mActiveObjects.pop_back();
+ }
}
void LLViewerObjectList::updateActive(LLViewerObject *objectp)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE;
-
- if (objectp->isDead())
- {
- return; // We don't update dead objects!
- }
-
- BOOL active = objectp->isActive();
- if (active != objectp->onActiveList())
- {
- if (active)
- {
- //LL_INFOS() << "Adding " << objectp->mID << " " << objectp->getPCodeString() << " to active list." << LL_ENDL;
- S32 idx = objectp->getListIndex();
- if (idx <= -1)
- {
- mActiveObjects.push_back(objectp);
- objectp->setListIndex(mActiveObjects.size()-1);
- objectp->setOnActiveList(TRUE);
- }
- else
- {
- llassert(idx < mActiveObjects.size());
- llassert(mActiveObjects[idx] == objectp);
-
- if (idx >= mActiveObjects.size() ||
- mActiveObjects[idx] != objectp)
- {
- LL_WARNS() << "Invalid object list index detected!" << LL_ENDL;
- }
- }
- }
- else
- {
- //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << LL_ENDL;
- removeFromActiveList(objectp);
- objectp->setOnActiveList(FALSE);
- }
- }
-
- //post condition: if object is active, it must be on the active list
- llassert(!active || std::find(mActiveObjects.begin(), mActiveObjects.end(), objectp) != mActiveObjects.end());
-
- //post condition: if object is not active, it must not be on the active list
- llassert(active || std::find(mActiveObjects.begin(), mActiveObjects.end(), objectp) == mActiveObjects.end());
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE;
+
+ if (objectp->isDead())
+ {
+ return; // We don't update dead objects!
+ }
+
+ BOOL active = objectp->isActive();
+ if (active != objectp->onActiveList())
+ {
+ if (active)
+ {
+ //LL_INFOS() << "Adding " << objectp->mID << " " << objectp->getPCodeString() << " to active list." << LL_ENDL;
+ S32 idx = objectp->getListIndex();
+ if (idx <= -1)
+ {
+ mActiveObjects.push_back(objectp);
+ objectp->setListIndex(mActiveObjects.size()-1);
+ objectp->setOnActiveList(TRUE);
+ }
+ else
+ {
+ llassert(idx < mActiveObjects.size());
+ llassert(mActiveObjects[idx] == objectp);
+
+ if (idx >= mActiveObjects.size() ||
+ mActiveObjects[idx] != objectp)
+ {
+ LL_WARNS() << "Invalid object list index detected!" << LL_ENDL;
+ }
+ }
+ }
+ else
+ {
+ //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << LL_ENDL;
+ removeFromActiveList(objectp);
+ objectp->setOnActiveList(FALSE);
+ }
+ }
+
+ //post condition: if object is active, it must be on the active list
+ llassert(!active || std::find(mActiveObjects.begin(), mActiveObjects.end(), objectp) != mActiveObjects.end());
+
+ //post condition: if object is not active, it must not be on the active list
+ llassert(active || std::find(mActiveObjects.begin(), mActiveObjects.end(), objectp) == mActiveObjects.end());
}
void LLViewerObjectList::updateObjectCost(LLViewerObject* object)
{
- if (!object->isRoot())
- { //always fetch cost for the parent when fetching cost for children
- mStaleObjectCost.insert(((LLViewerObject*)object->getParent())->getID());
- }
- mStaleObjectCost.insert(object->getID());
+ if (!object->isRoot())
+ { //always fetch cost for the parent when fetching cost for children
+ mStaleObjectCost.insert(((LLViewerObject*)object->getParent())->getID());
+ }
+ mStaleObjectCost.insert(object->getID());
}
void LLViewerObjectList::updateObjectCost(const LLUUID& object_id, F32 object_cost, F32 link_cost, F32 physics_cost, F32 link_physics_cost)
{
- LLViewerObject* object = findObject(object_id);
- if (object)
- {
- object->setObjectCost(object_cost);
- object->setLinksetCost(link_cost);
- object->setPhysicsCost(physics_cost);
- object->setLinksetPhysicsCost(link_physics_cost);
- }
+ LLViewerObject* object = findObject(object_id);
+ if (object)
+ {
+ object->setObjectCost(object_cost);
+ object->setLinksetCost(link_cost);
+ object->setPhysicsCost(physics_cost);
+ object->setLinksetPhysicsCost(link_physics_cost);
+ }
}
void LLViewerObjectList::onObjectCostFetchFailure(const LLUUID& object_id)
{
- //LL_WARNS() << "Failed to fetch object cost for object: " << object_id << LL_ENDL;
- mPendingObjectCost.erase(object_id);
+ //LL_WARNS() << "Failed to fetch object cost for object: " << object_id << LL_ENDL;
+ mPendingObjectCost.erase(object_id);
}
void LLViewerObjectList::updatePhysicsFlags(const LLViewerObject* object)
{
- mStalePhysicsFlags.insert(object->getID());
+ mStalePhysicsFlags.insert(object->getID());
}
void LLViewerObjectList::updatePhysicsShapeType(const LLUUID& object_id, S32 type)
{
- mPendingPhysicsFlags.erase(object_id);
- LLViewerObject* object = findObject(object_id);
- if (object)
- {
- object->setPhysicsShapeType(type);
- }
+ mPendingPhysicsFlags.erase(object_id);
+ LLViewerObject* object = findObject(object_id);
+ if (object)
+ {
+ object->setPhysicsShapeType(type);
+ }
}
-void LLViewerObjectList::updatePhysicsProperties(const LLUUID& object_id,
- F32 density,
- F32 friction,
- F32 restitution,
- F32 gravity_multiplier)
+void LLViewerObjectList::updatePhysicsProperties(const LLUUID& object_id,
+ F32 density,
+ F32 friction,
+ F32 restitution,
+ F32 gravity_multiplier)
{
- mPendingPhysicsFlags.erase(object_id);
-
- LLViewerObject* object = findObject(object_id);
- if (object)
- {
- object->setPhysicsDensity(density);
- object->setPhysicsFriction(friction);
- object->setPhysicsGravity(gravity_multiplier);
- object->setPhysicsRestitution(restitution);
- }
+ mPendingPhysicsFlags.erase(object_id);
+
+ LLViewerObject* object = findObject(object_id);
+ if (object)
+ {
+ object->setPhysicsDensity(density);
+ object->setPhysicsFriction(friction);
+ object->setPhysicsGravity(gravity_multiplier);
+ object->setPhysicsRestitution(restitution);
+ }
}
void LLViewerObjectList::onPhysicsFlagsFetchFailure(const LLUUID& object_id)
{
- //LL_WARNS() << "Failed to fetch physics flags for object: " << object_id << LL_ENDL;
- mPendingPhysicsFlags.erase(object_id);
+ //LL_WARNS() << "Failed to fetch physics flags for object: " << object_id << LL_ENDL;
+ mPendingPhysicsFlags.erase(object_id);
}
void LLViewerObjectList::shiftObjects(const LLVector3 &offset)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
- // This is called when we shift our origin when we cross region boundaries...
- // We need to update many object caches, I'll document this more as I dig through the code
- // cleaning things out...
-
- if (0 == offset.magVecSquared())
- {
- return;
- }
-
-
- LLViewerObject *objectp;
- for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
- {
- objectp = *iter;
- // There could be dead objects on the object list, so don't update stuff if the object is dead.
- if (!objectp->isDead())
- {
- objectp->updatePositionCaches();
-
- if (objectp->mDrawable.notNull() && !objectp->mDrawable->isDead())
- {
- gPipeline.markShift(objectp->mDrawable);
- }
- }
- }
-
- gPipeline.shiftObjects(offset);
-
- LLWorld::getInstance()->shiftRegions(offset);
+ // This is called when we shift our origin when we cross region boundaries...
+ // We need to update many object caches, I'll document this more as I dig through the code
+ // cleaning things out...
+
+ if (0 == offset.magVecSquared())
+ {
+ return;
+ }
+
+
+ LLViewerObject *objectp;
+ for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+ {
+ objectp = *iter;
+ // There could be dead objects on the object list, so don't update stuff if the object is dead.
+ if (!objectp->isDead())
+ {
+ objectp->updatePositionCaches();
+
+ if (objectp->mDrawable.notNull() && !objectp->mDrawable->isDead())
+ {
+ gPipeline.markShift(objectp->mDrawable);
+ }
+ }
+ }
+
+ gPipeline.shiftObjects(offset);
+
+ LLWorld::getInstance()->shiftRegions(offset);
}
void LLViewerObjectList::repartitionObjects()
{
- for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
- if (!objectp->isDead())
- {
- LLDrawable* drawable = objectp->mDrawable;
- if (drawable && !drawable->isDead())
- {
- drawable->updateBinRadius();
- drawable->updateSpatialExtents();
- drawable->movePartition();
- }
- }
- }
+ for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+ if (!objectp->isDead())
+ {
+ LLDrawable* drawable = objectp->mDrawable;
+ if (drawable && !drawable->isDead())
+ {
+ drawable->updateBinRadius();
+ drawable->updateSpatialExtents();
+ drawable->movePartition();
+ }
+ }
+ }
}
//debug code
-bool LLViewerObjectList::hasMapObjectInRegion(LLViewerRegion* regionp)
+bool LLViewerObjectList::hasMapObjectInRegion(LLViewerRegion* regionp)
{
- for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
+ for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
- if(objectp->isDead() || objectp->getRegion() == regionp)
- {
- return true ;
- }
- }
+ if(objectp->isDead() || objectp->getRegion() == regionp)
+ {
+ return true ;
+ }
+ }
- return false ;
+ return false ;
}
//make sure the region is cleaned up.
-void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp)
+void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp)
{
- std::set<LLViewerObject*> dead_object_list ;
- std::set<LLViewerObject*> region_object_list ;
- for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
-
- if(objectp->isDead())
- {
- dead_object_list.insert(objectp) ;
- }
- else if(objectp->getRegion() == regionp)
- {
- region_object_list.insert(objectp) ;
- }
- }
-
- if(dead_object_list.size() > 0)
- {
- LL_WARNS() << "There are " << dead_object_list.size() << " dead objects on the map!" << LL_ENDL ;
-
- for(std::set<LLViewerObject*>::iterator iter = dead_object_list.begin(); iter != dead_object_list.end(); ++iter)
- {
- cleanupReferences(*iter) ;
- }
- }
- if(region_object_list.size() > 0)
- {
- LL_WARNS() << "There are " << region_object_list.size() << " objects not removed from the deleted region!" << LL_ENDL ;
-
- for(std::set<LLViewerObject*>::iterator iter = region_object_list.begin(); iter != region_object_list.end(); ++iter)
- {
- (*iter)->markDead() ;
- }
- }
+ std::set<LLViewerObject*> dead_object_list ;
+ std::set<LLViewerObject*> region_object_list ;
+ for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+
+ if(objectp->isDead())
+ {
+ dead_object_list.insert(objectp) ;
+ }
+ else if(objectp->getRegion() == regionp)
+ {
+ region_object_list.insert(objectp) ;
+ }
+ }
+
+ if(dead_object_list.size() > 0)
+ {
+ LL_WARNS() << "There are " << dead_object_list.size() << " dead objects on the map!" << LL_ENDL ;
+
+ for(std::set<LLViewerObject*>::iterator iter = dead_object_list.begin(); iter != dead_object_list.end(); ++iter)
+ {
+ cleanupReferences(*iter) ;
+ }
+ }
+ if(region_object_list.size() > 0)
+ {
+ LL_WARNS() << "There are " << region_object_list.size() << " objects not removed from the deleted region!" << LL_ENDL ;
+
+ for(std::set<LLViewerObject*>::iterator iter = region_object_list.begin(); iter != region_object_list.end(); ++iter)
+ {
+ (*iter)->markDead() ;
+ }
+ }
}
void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
{
- LLColor4 above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" );
- LLColor4 below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" );
- LLColor4 you_own_above_water_color =
- LLUIColorTable::instance().getColor( "NetMapYouOwnAboveWater" );
- LLColor4 you_own_below_water_color =
- LLUIColorTable::instance().getColor( "NetMapYouOwnBelowWater" );
- LLColor4 group_own_above_water_color =
- LLUIColorTable::instance().getColor( "NetMapGroupOwnAboveWater" );
- LLColor4 group_own_below_water_color =
- LLUIColorTable::instance().getColor( "NetMapGroupOwnBelowWater" );
-
- F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius");
-
- for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
-
- if(objectp->isDead())//some dead objects somehow not cleaned.
- {
- continue ;
- }
-
- if (!objectp->getRegion() || objectp->isOrphaned() || objectp->isAttachment())
- {
- continue;
- }
- const LLVector3& scale = objectp->getScale();
- const LLVector3d pos = objectp->getPositionGlobal();
- const F64 water_height = F64( objectp->getRegion()->getWaterHeight() );
- // LLWorld::getInstance()->getWaterHeight();
-
- F32 approx_radius = (scale.mV[VX] + scale.mV[VY]) * 0.5f * 0.5f * 1.3f; // 1.3 is a fudge
-
- // Limit the size of megaprims so they don't blot out everything on the minimap.
- // Attempting to draw very large megaprims also causes client lag.
- // See DEV-17370 and DEV-29869/SNOW-79 for details.
- approx_radius = llmin(approx_radius, max_radius);
-
- LLColor4U color = above_water_color;
- if( objectp->permYouOwner() )
- {
- const F32 MIN_RADIUS_FOR_OWNED_OBJECTS = 2.f;
- if( approx_radius < MIN_RADIUS_FOR_OWNED_OBJECTS )
- {
- approx_radius = MIN_RADIUS_FOR_OWNED_OBJECTS;
- }
-
- if( pos.mdV[VZ] >= water_height )
- {
- if ( objectp->permGroupOwner() )
- {
- color = group_own_above_water_color;
- }
- else
- {
- color = you_own_above_water_color;
- }
- }
- else
- {
- if ( objectp->permGroupOwner() )
- {
- color = group_own_below_water_color;
- }
- else
- {
- color = you_own_below_water_color;
- }
- }
- }
- else
- if( pos.mdV[VZ] < water_height )
- {
- color = below_water_color;
- }
-
- netmap.renderScaledPointGlobal(
- pos,
- color,
- approx_radius );
- }
+ LLColor4 above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" );
+ LLColor4 below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" );
+ LLColor4 you_own_above_water_color =
+ LLUIColorTable::instance().getColor( "NetMapYouOwnAboveWater" );
+ LLColor4 you_own_below_water_color =
+ LLUIColorTable::instance().getColor( "NetMapYouOwnBelowWater" );
+ LLColor4 group_own_above_water_color =
+ LLUIColorTable::instance().getColor( "NetMapGroupOwnAboveWater" );
+ LLColor4 group_own_below_water_color =
+ LLUIColorTable::instance().getColor( "NetMapGroupOwnBelowWater" );
+
+ F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius");
+
+ for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+
+ if(objectp->isDead())//some dead objects somehow not cleaned.
+ {
+ continue ;
+ }
+
+ if (!objectp->getRegion() || objectp->isOrphaned() || objectp->isAttachment())
+ {
+ continue;
+ }
+ const LLVector3& scale = objectp->getScale();
+ const LLVector3d pos = objectp->getPositionGlobal();
+ const F64 water_height = F64( objectp->getRegion()->getWaterHeight() );
+ // LLWorld::getInstance()->getWaterHeight();
+
+ F32 approx_radius = (scale.mV[VX] + scale.mV[VY]) * 0.5f * 0.5f * 1.3f; // 1.3 is a fudge
+
+ // Limit the size of megaprims so they don't blot out everything on the minimap.
+ // Attempting to draw very large megaprims also causes client lag.
+ // See DEV-17370 and DEV-29869/SNOW-79 for details.
+ approx_radius = llmin(approx_radius, max_radius);
+
+ LLColor4U color = above_water_color;
+ if( objectp->permYouOwner() )
+ {
+ const F32 MIN_RADIUS_FOR_OWNED_OBJECTS = 2.f;
+ if( approx_radius < MIN_RADIUS_FOR_OWNED_OBJECTS )
+ {
+ approx_radius = MIN_RADIUS_FOR_OWNED_OBJECTS;
+ }
+
+ if( pos.mdV[VZ] >= water_height )
+ {
+ if ( objectp->permGroupOwner() )
+ {
+ color = group_own_above_water_color;
+ }
+ else
+ {
+ color = you_own_above_water_color;
+ }
+ }
+ else
+ {
+ if ( objectp->permGroupOwner() )
+ {
+ color = group_own_below_water_color;
+ }
+ else
+ {
+ color = you_own_below_water_color;
+ }
+ }
+ }
+ else
+ if( pos.mdV[VZ] < water_height )
+ {
+ color = below_water_color;
+ }
+
+ netmap.renderScaledPointGlobal(
+ pos,
+ color,
+ approx_radius );
+ }
}
void LLViewerObjectList::renderObjectBounds(const LLVector3 &center)
@@ -1807,342 +1807,342 @@ void LLViewerObjectList::renderObjectBounds(const LLVector3 &center)
extern BOOL gCubeSnapshot;
void LLViewerObjectList::addDebugBeacon(const LLVector3 &pos_agent,
- const std::string &string,
- const LLColor4 &color,
- const LLColor4 &text_color,
- S32 line_width)
+ const std::string &string,
+ const LLColor4 &color,
+ const LLColor4 &text_color,
+ S32 line_width)
{
llassert(!gCubeSnapshot);
- LLDebugBeacon beacon;
- beacon.mPositionAgent = pos_agent;
- beacon.mString = string;
- beacon.mColor = color;
- beacon.mTextColor = text_color;
- beacon.mLineWidth = line_width;
-
- mDebugBeacons.push_back(beacon);
+ LLDebugBeacon beacon;
+ beacon.mPositionAgent = pos_agent;
+ beacon.mString = string;
+ beacon.mColor = color;
+ beacon.mTextColor = text_color;
+ beacon.mLineWidth = line_width;
+
+ mDebugBeacons.push_back(beacon);
}
void LLViewerObjectList::resetObjectBeacons()
{
- mDebugBeacons.clear();
+ mDebugBeacons.clear();
}
LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp, S32 flags)
{
- LLUUID fullid;
- fullid.generate();
+ LLUUID fullid;
+ fullid.generate();
- LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp, flags);
- if (!objectp)
- {
-// LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << LL_ENDL;
- return NULL;
- }
+ LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp, flags);
+ if (!objectp)
+ {
+// LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << LL_ENDL;
+ return NULL;
+ }
- mUUIDObjectMap[fullid] = objectp;
+ mUUIDObjectMap[fullid] = objectp;
- mObjects.push_back(objectp);
+ mObjects.push_back(objectp);
- updateActive(objectp);
+ updateActive(objectp);
- return objectp;
+ return objectp;
}
LLViewerObject *LLViewerObjectList::createObjectFromCache(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id)
{
- llassert_always(uuid.notNull());
+ llassert_always(uuid.notNull());
LL_DEBUGS("ObjectUpdate") << "creating " << uuid << " local_id " << local_id << LL_ENDL;
dumpStack("ObjectUpdateStack");
-
- LLViewerObject *objectp = LLViewerObject::createObject(uuid, pcode, regionp);
- if (!objectp)
- {
-// LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << " id:" << fullid << LL_ENDL;
- return NULL;
- }
-
- objectp->mLocalID = local_id;
- mUUIDObjectMap[uuid] = objectp;
- setUUIDAndLocal(uuid,
- local_id,
- regionp->getHost().getAddress(),
- regionp->getHost().getPort());
- mObjects.push_back(objectp);
-
- updateActive(objectp);
-
- return objectp;
+
+ LLViewerObject *objectp = LLViewerObject::createObject(uuid, pcode, regionp);
+ if (!objectp)
+ {
+// LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << " id:" << fullid << LL_ENDL;
+ return NULL;
+ }
+
+ objectp->mLocalID = local_id;
+ mUUIDObjectMap[uuid] = objectp;
+ setUUIDAndLocal(uuid,
+ local_id,
+ regionp->getHost().getAddress(),
+ regionp->getHost().getPort());
+ mObjects.push_back(objectp);
+
+ updateActive(objectp);
+
+ return objectp;
}
LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRegion *regionp,
- const LLUUID &uuid, const U32 local_id, const LLHost &sender)
+ const LLUUID &uuid, const U32 local_id, const LLHost &sender)
{
- LLUUID fullid;
- if (uuid == LLUUID::null)
- {
- fullid.generate();
- }
- else
- {
- fullid = uuid;
- }
+ LLUUID fullid;
+ if (uuid == LLUUID::null)
+ {
+ fullid.generate();
+ }
+ else
+ {
+ fullid = uuid;
+ }
LL_DEBUGS("ObjectUpdate") << "createObject creating " << fullid << LL_ENDL;
dumpStack("ObjectUpdateStack");
- LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp);
- if (!objectp)
- {
-// LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << " id:" << fullid << LL_ENDL;
- return NULL;
- }
- if(regionp)
- {
- regionp->addToCreatedList(local_id);
- }
+ LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp);
+ if (!objectp)
+ {
+// LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << " id:" << fullid << LL_ENDL;
+ return NULL;
+ }
+ if(regionp)
+ {
+ regionp->addToCreatedList(local_id);
+ }
- mUUIDObjectMap[fullid] = objectp;
- setUUIDAndLocal(fullid,
- local_id,
- gMessageSystem->getSenderIP(),
- gMessageSystem->getSenderPort());
+ mUUIDObjectMap[fullid] = objectp;
+ setUUIDAndLocal(fullid,
+ local_id,
+ gMessageSystem->getSenderIP(),
+ gMessageSystem->getSenderPort());
- mObjects.push_back(objectp);
+ mObjects.push_back(objectp);
- updateActive(objectp);
+ updateActive(objectp);
- return objectp;
+ return objectp;
}
LLViewerObject *LLViewerObjectList::replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
{
- LLViewerObject *old_instance = findObject(id);
- if (old_instance)
- {
- //cleanupReferences(old_instance);
- old_instance->markDead();
-
- return createObject(pcode, regionp, id, old_instance->getLocalID(), LLHost());
- }
- return NULL;
+ LLViewerObject *old_instance = findObject(id);
+ if (old_instance)
+ {
+ //cleanupReferences(old_instance);
+ old_instance->markDead();
+
+ return createObject(pcode, regionp, id, old_instance->getLocalID(), LLHost());
+ }
+ return NULL;
}
S32 LLViewerObjectList::findReferences(LLDrawable *drawablep) const
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE;
-
- LLViewerObject *objectp;
- S32 num_refs = 0;
-
- for (vobj_list_t::const_iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
- {
- objectp = *iter;
- if (objectp->mDrawable.notNull())
- {
- num_refs += objectp->mDrawable->findReferences(drawablep);
- }
- }
- return num_refs;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE;
+
+ LLViewerObject *objectp;
+ S32 num_refs = 0;
+
+ for (vobj_list_t::const_iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+ {
+ objectp = *iter;
+ if (objectp->mDrawable.notNull())
+ {
+ num_refs += objectp->mDrawable->findReferences(drawablep);
+ }
+ }
+ return num_refs;
}
void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port)
{
- LL_DEBUGS("ORPHANS") << "Orphaning object " << childp->getID() << " with parent " << parent_id << LL_ENDL;
-
- // We're an orphan, flag things appropriately.
- childp->mOrphaned = TRUE;
- if (childp->mDrawable.notNull())
- {
- bool make_invisible = true;
- LLViewerObject *parentp = (LLViewerObject *)childp->getParent();
- if (parentp)
- {
- if (parentp->getRegion() != childp->getRegion())
- {
- // This is probably an object flying across a region boundary, the
- // object probably ISN'T being reparented, but just got an object
- // update out of order (child update before parent).
- make_invisible = false;
- //LL_INFOS() << "Don't make object handoffs invisible!" << LL_ENDL;
- }
- }
-
- if (make_invisible)
- {
- // Make sure that this object becomes invisible if it's an orphan
- childp->mDrawable->setState(LLDrawable::FORCE_INVISIBLE);
- }
- }
-
- // Unknown parent, add to orpaned child list
- U64 parent_info = getIndex(parent_id, ip, port);
-
- if (std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info) == mOrphanParents.end())
- {
- mOrphanParents.push_back(parent_info);
- }
-
- LLViewerObjectList::OrphanInfo oi(parent_info, childp->mID);
- if (std::find(mOrphanChildren.begin(), mOrphanChildren.end(), oi) == mOrphanChildren.end())
- {
- mOrphanChildren.push_back(oi);
- mNumOrphans++;
- }
+ LL_DEBUGS("ORPHANS") << "Orphaning object " << childp->getID() << " with parent " << parent_id << LL_ENDL;
+
+ // We're an orphan, flag things appropriately.
+ childp->mOrphaned = TRUE;
+ if (childp->mDrawable.notNull())
+ {
+ bool make_invisible = true;
+ LLViewerObject *parentp = (LLViewerObject *)childp->getParent();
+ if (parentp)
+ {
+ if (parentp->getRegion() != childp->getRegion())
+ {
+ // This is probably an object flying across a region boundary, the
+ // object probably ISN'T being reparented, but just got an object
+ // update out of order (child update before parent).
+ make_invisible = false;
+ //LL_INFOS() << "Don't make object handoffs invisible!" << LL_ENDL;
+ }
+ }
+
+ if (make_invisible)
+ {
+ // Make sure that this object becomes invisible if it's an orphan
+ childp->mDrawable->setState(LLDrawable::FORCE_INVISIBLE);
+ }
+ }
+
+ // Unknown parent, add to orpaned child list
+ U64 parent_info = getIndex(parent_id, ip, port);
+
+ if (std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info) == mOrphanParents.end())
+ {
+ mOrphanParents.push_back(parent_info);
+ }
+
+ LLViewerObjectList::OrphanInfo oi(parent_info, childp->mID);
+ if (std::find(mOrphanChildren.begin(), mOrphanChildren.end(), oi) == mOrphanChildren.end())
+ {
+ mOrphanChildren.push_back(oi);
+ mNumOrphans++;
+ }
}
void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
-
- if (objectp->isDead())
- {
- LL_WARNS() << "Trying to find orphans for dead obj " << objectp->mID
- << ":" << objectp->getPCodeString() << LL_ENDL;
- return;
- }
-
- //search object cache to get orphans
- if(objectp->getRegion())
- {
- objectp->getRegion()->findOrphans(objectp->getLocalID());
- }
-
- // See if we are a parent of an orphan.
- // Note: This code is fairly inefficient but it should happen very rarely.
- // It can be sped up if this is somehow a performance issue...
- if (mOrphanParents.empty())
- {
- // no known orphan parents
- return;
- }
- if (std::find(mOrphanParents.begin(), mOrphanParents.end(), getIndex(objectp->mLocalID, ip, port)) == mOrphanParents.end())
- {
- // did not find objectp in OrphanParent list
- return;
- }
-
- U64 parent_info = getIndex(objectp->mLocalID, ip, port);
- BOOL orphans_found = FALSE;
- // Iterate through the orphan list, and set parents of matching children.
-
- for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); )
- {
- if (iter->mParentInfo != parent_info)
- {
- ++iter;
- continue;
- }
- LLViewerObject *childp = findObject(iter->mChildInfo);
- if (childp)
- {
- if (childp == objectp)
- {
- LL_WARNS() << objectp->mID << " has self as parent, skipping!"
- << LL_ENDL;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
+
+ if (objectp->isDead())
+ {
+ LL_WARNS() << "Trying to find orphans for dead obj " << objectp->mID
+ << ":" << objectp->getPCodeString() << LL_ENDL;
+ return;
+ }
+
+ //search object cache to get orphans
+ if(objectp->getRegion())
+ {
+ objectp->getRegion()->findOrphans(objectp->getLocalID());
+ }
+
+ // See if we are a parent of an orphan.
+ // Note: This code is fairly inefficient but it should happen very rarely.
+ // It can be sped up if this is somehow a performance issue...
+ if (mOrphanParents.empty())
+ {
+ // no known orphan parents
+ return;
+ }
+ if (std::find(mOrphanParents.begin(), mOrphanParents.end(), getIndex(objectp->mLocalID, ip, port)) == mOrphanParents.end())
+ {
+ // did not find objectp in OrphanParent list
+ return;
+ }
+
+ U64 parent_info = getIndex(objectp->mLocalID, ip, port);
+ BOOL orphans_found = FALSE;
+ // Iterate through the orphan list, and set parents of matching children.
+
+ for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); )
+ {
+ if (iter->mParentInfo != parent_info)
+ {
+ ++iter;
+ continue;
+ }
+ LLViewerObject *childp = findObject(iter->mChildInfo);
+ if (childp)
+ {
+ if (childp == objectp)
+ {
+ LL_WARNS() << objectp->mID << " has self as parent, skipping!"
+ << LL_ENDL;
++iter;
- continue;
- }
+ continue;
+ }
- LL_DEBUGS("ORPHANS") << "Reunited parent " << objectp->mID
- << " with child " << childp->mID << LL_ENDL;
- LL_DEBUGS("ORPHANS") << "Glob: " << objectp->getPositionGlobal() << LL_ENDL;
- LL_DEBUGS("ORPHANS") << "Agent: " << objectp->getPositionAgent() << LL_ENDL;
+ LL_DEBUGS("ORPHANS") << "Reunited parent " << objectp->mID
+ << " with child " << childp->mID << LL_ENDL;
+ LL_DEBUGS("ORPHANS") << "Glob: " << objectp->getPositionGlobal() << LL_ENDL;
+ LL_DEBUGS("ORPHANS") << "Agent: " << objectp->getPositionAgent() << LL_ENDL;
#ifdef ORPHAN_SPAM
- addDebugBeacon(objectp->getPositionAgent(),"");
+ addDebugBeacon(objectp->getPositionAgent(),"");
#endif
- gPipeline.markMoved(objectp->mDrawable);
- objectp->setChanged(LLXform::MOVED | LLXform::SILHOUETTE);
-
- // Flag the object as no longer orphaned
- childp->mOrphaned = FALSE;
- if (childp->mDrawable.notNull())
- {
- // Make the drawable visible again and set the drawable parent
- childp->mDrawable->clearState(LLDrawable::FORCE_INVISIBLE);
- childp->setDrawableParent(objectp->mDrawable); // LLViewerObjectList::findOrphans()
- gPipeline.markRebuild( childp->mDrawable, LLDrawable::REBUILD_ALL);
- }
-
- // Make certain particles, icon and HUD aren't hidden
- childp->hideExtraDisplayItems( FALSE );
-
- objectp->addChild(childp);
- orphans_found = TRUE;
- ++iter;
- }
- else
- {
- LL_INFOS() << "Missing orphan child, removing from list" << LL_ENDL;
-
- iter = mOrphanChildren.erase(iter);
- }
- }
-
- // Remove orphan parent and children from lists now that they've been found
- {
- std::vector<U64>::iterator iter = std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info);
- if (iter != mOrphanParents.end())
- {
- mOrphanParents.erase(iter);
- }
- }
-
- for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); )
- {
- if (iter->mParentInfo == parent_info)
- {
- iter = mOrphanChildren.erase(iter);
- mNumOrphans--;
- }
- else
- {
- ++iter;
- }
- }
-
- if (orphans_found && objectp->isSelected())
- {
- LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->findNode(objectp);
- if (nodep && !nodep->mIndividualSelection)
- {
- // rebuild selection with orphans
- LLSelectMgr::getInstance()->deselectObjectAndFamily(objectp);
- LLSelectMgr::getInstance()->selectObjectAndFamily(objectp);
- }
- }
+ gPipeline.markMoved(objectp->mDrawable);
+ objectp->setChanged(LLXform::MOVED | LLXform::SILHOUETTE);
+
+ // Flag the object as no longer orphaned
+ childp->mOrphaned = FALSE;
+ if (childp->mDrawable.notNull())
+ {
+ // Make the drawable visible again and set the drawable parent
+ childp->mDrawable->clearState(LLDrawable::FORCE_INVISIBLE);
+ childp->setDrawableParent(objectp->mDrawable); // LLViewerObjectList::findOrphans()
+ gPipeline.markRebuild( childp->mDrawable, LLDrawable::REBUILD_ALL);
+ }
+
+ // Make certain particles, icon and HUD aren't hidden
+ childp->hideExtraDisplayItems( FALSE );
+
+ objectp->addChild(childp);
+ orphans_found = TRUE;
+ ++iter;
+ }
+ else
+ {
+ LL_INFOS() << "Missing orphan child, removing from list" << LL_ENDL;
+
+ iter = mOrphanChildren.erase(iter);
+ }
+ }
+
+ // Remove orphan parent and children from lists now that they've been found
+ {
+ std::vector<U64>::iterator iter = std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info);
+ if (iter != mOrphanParents.end())
+ {
+ mOrphanParents.erase(iter);
+ }
+ }
+
+ for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); )
+ {
+ if (iter->mParentInfo == parent_info)
+ {
+ iter = mOrphanChildren.erase(iter);
+ mNumOrphans--;
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+
+ if (orphans_found && objectp->isSelected())
+ {
+ LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->findNode(objectp);
+ if (nodep && !nodep->mIndividualSelection)
+ {
+ // rebuild selection with orphans
+ LLSelectMgr::getInstance()->deselectObjectAndFamily(objectp);
+ LLSelectMgr::getInstance()->selectObjectAndFamily(objectp);
+ }
+ }
}
////////////////////////////////////////////////////////////////////////////
LLViewerObjectList::OrphanInfo::OrphanInfo()
- : mParentInfo(0)
+ : mParentInfo(0)
{
}
LLViewerObjectList::OrphanInfo::OrphanInfo(const U64 parent_info, const LLUUID child_info)
- : mParentInfo(parent_info), mChildInfo(child_info)
+ : mParentInfo(parent_info), mChildInfo(child_info)
{
}
bool LLViewerObjectList::OrphanInfo::operator==(const OrphanInfo &rhs) const
{
- return (mParentInfo == rhs.mParentInfo) && (mChildInfo == rhs.mChildInfo);
+ return (mParentInfo == rhs.mParentInfo) && (mChildInfo == rhs.mChildInfo);
}
bool LLViewerObjectList::OrphanInfo::operator!=(const OrphanInfo &rhs) const
{
- return !operator==(rhs);
+ return !operator==(rhs);
}
LLDebugBeacon::~LLDebugBeacon()
{
- if (mHUDObject.notNull())
- {
- mHUDObject->markDead();
- }
+ if (mHUDObject.notNull())
+ {
+ mHUDObject->markDead();
+ }
}
diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h
index f2cba8c259..fcf4d7ff98 100644
--- a/indra/newview/llviewerobjectlist.h
+++ b/indra/newview/llviewerobjectlist.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerobjectlist.h
* @brief Description of LLViewerObjectList class.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,170 +57,170 @@ const U32 GL_NAME_INDEX_OFFSET = 10;
class LLViewerObjectList
{
public:
- LLViewerObjectList();
- ~LLViewerObjectList();
-
- void destroy();
-
- // For internal use only. Does NOT take a local id, takes an index into
- // an internal dynamic array.
- inline LLViewerObject *getObject(const S32 index);
-
- inline LLViewerObject *findObject(const LLUUID &id);
- LLViewerObject *createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp, S32 flags = 0); // Create a viewer-side object
- LLViewerObject *createObjectFromCache(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id);
- LLViewerObject *createObject(const LLPCode pcode, LLViewerRegion *regionp,
- const LLUUID &uuid, const U32 local_id, const LLHost &sender);
-
- LLViewerObject *replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); // TomY: hack to switch VO instances on the fly
-
- BOOL killObject(LLViewerObject *objectp);
- void killObjects(LLViewerRegion *regionp); // Kill all objects owned by a particular region.
- void killAllObjects();
-
- void cleanDeadObjects(const BOOL use_timer = TRUE); // Clean up the dead object list.
-
- // Simulator and viewer side object updates...
- void processUpdateCore(LLViewerObject* objectp, void** data, U32 block, const EObjectUpdateType update_type,
- LLDataPacker* dpp, bool justCreated, bool from_cache = false);
- LLViewerObject* processObjectUpdateFromCache(LLVOCacheEntry* entry, LLViewerRegion* regionp);
- void processObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type, bool compressed=false);
- void processCompressedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
- void processCachedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
- void updateApparentAngles(LLAgent &agent);
- void update(LLAgent &agent);
-
- void fetchObjectCosts();
- void fetchPhysicsFlags();
-
- void updateObjectCost(LLViewerObject* object);
- void updateObjectCost(const LLUUID& object_id, F32 object_cost, F32 link_cost, F32 physics_cost, F32 link_physics_cost);
- void onObjectCostFetchFailure(const LLUUID& object_id);
-
- void updatePhysicsFlags(const LLViewerObject* object);
- void onPhysicsFlagsFetchFailure(const LLUUID& object_id);
- void updatePhysicsShapeType(const LLUUID& object_id, S32 type);
- void updatePhysicsProperties(const LLUUID& object_id,
- F32 density,
- F32 friction,
- F32 restitution,
- F32 gravity_multiplier);
-
- void shiftObjects(const LLVector3 &offset);
- void repartitionObjects();
-
- bool hasMapObjectInRegion(LLViewerRegion* regionp) ;
- void clearAllMapObjectsInRegion(LLViewerRegion* regionp) ;
- void renderObjectsForMap(LLNetMap &netmap);
- void renderObjectBounds(const LLVector3 &center);
-
- void addDebugBeacon(const LLVector3 &pos_agent, const std::string &string,
- const LLColor4 &color=LLColor4(1.f, 0.f, 0.f, 0.5f),
- const LLColor4 &text_color=LLColor4(1.f, 1.f, 1.f, 1.f),
- S32 line_width = 1);
- void renderObjectBeacons();
- void resetObjectBeacons();
-
- void dirtyAllObjectInventory();
-
- void removeFromActiveList(LLViewerObject* objectp);
- void updateActive(LLViewerObject *objectp);
-
- void updateAvatarVisibility();
-
- inline S32 getNumObjects() { return (S32) mObjects.size(); }
- inline S32 getNumActiveObjects() { return (S32) mActiveObjects.size(); }
-
- void addToMap(LLViewerObject *objectp);
- void removeFromMap(LLViewerObject *objectp);
-
- void clearDebugText();
-
- ////////////////////////////////////////////
- //
- // Only accessed by markDead in LLViewerObject
- void cleanupReferences(LLViewerObject *objectp);
-
- S32 findReferences(LLDrawable *drawablep) const; // Find references to drawable in all objects, and return value.
-
- S32 getOrphanParentCount() const { return (S32) mOrphanParents.size(); }
- S32 getOrphanCount() const { return mNumOrphans; }
- void orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port);
- void findOrphans(LLViewerObject* objectp, U32 ip, U32 port);
+ LLViewerObjectList();
+ ~LLViewerObjectList();
+
+ void destroy();
+
+ // For internal use only. Does NOT take a local id, takes an index into
+ // an internal dynamic array.
+ inline LLViewerObject *getObject(const S32 index);
+
+ inline LLViewerObject *findObject(const LLUUID &id);
+ LLViewerObject *createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp, S32 flags = 0); // Create a viewer-side object
+ LLViewerObject *createObjectFromCache(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id);
+ LLViewerObject *createObject(const LLPCode pcode, LLViewerRegion *regionp,
+ const LLUUID &uuid, const U32 local_id, const LLHost &sender);
+
+ LLViewerObject *replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); // TomY: hack to switch VO instances on the fly
+
+ BOOL killObject(LLViewerObject *objectp);
+ void killObjects(LLViewerRegion *regionp); // Kill all objects owned by a particular region.
+ void killAllObjects();
+
+ void cleanDeadObjects(const BOOL use_timer = TRUE); // Clean up the dead object list.
+
+ // Simulator and viewer side object updates...
+ void processUpdateCore(LLViewerObject* objectp, void** data, U32 block, const EObjectUpdateType update_type,
+ LLDataPacker* dpp, bool justCreated, bool from_cache = false);
+ LLViewerObject* processObjectUpdateFromCache(LLVOCacheEntry* entry, LLViewerRegion* regionp);
+ void processObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type, bool compressed=false);
+ void processCompressedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
+ void processCachedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
+ void updateApparentAngles(LLAgent &agent);
+ void update(LLAgent &agent);
+
+ void fetchObjectCosts();
+ void fetchPhysicsFlags();
+
+ void updateObjectCost(LLViewerObject* object);
+ void updateObjectCost(const LLUUID& object_id, F32 object_cost, F32 link_cost, F32 physics_cost, F32 link_physics_cost);
+ void onObjectCostFetchFailure(const LLUUID& object_id);
+
+ void updatePhysicsFlags(const LLViewerObject* object);
+ void onPhysicsFlagsFetchFailure(const LLUUID& object_id);
+ void updatePhysicsShapeType(const LLUUID& object_id, S32 type);
+ void updatePhysicsProperties(const LLUUID& object_id,
+ F32 density,
+ F32 friction,
+ F32 restitution,
+ F32 gravity_multiplier);
+
+ void shiftObjects(const LLVector3 &offset);
+ void repartitionObjects();
+
+ bool hasMapObjectInRegion(LLViewerRegion* regionp) ;
+ void clearAllMapObjectsInRegion(LLViewerRegion* regionp) ;
+ void renderObjectsForMap(LLNetMap &netmap);
+ void renderObjectBounds(const LLVector3 &center);
+
+ void addDebugBeacon(const LLVector3 &pos_agent, const std::string &string,
+ const LLColor4 &color=LLColor4(1.f, 0.f, 0.f, 0.5f),
+ const LLColor4 &text_color=LLColor4(1.f, 1.f, 1.f, 1.f),
+ S32 line_width = 1);
+ void renderObjectBeacons();
+ void resetObjectBeacons();
+
+ void dirtyAllObjectInventory();
+
+ void removeFromActiveList(LLViewerObject* objectp);
+ void updateActive(LLViewerObject *objectp);
+
+ void updateAvatarVisibility();
+
+ inline S32 getNumObjects() { return (S32) mObjects.size(); }
+ inline S32 getNumActiveObjects() { return (S32) mActiveObjects.size(); }
+
+ void addToMap(LLViewerObject *objectp);
+ void removeFromMap(LLViewerObject *objectp);
+
+ void clearDebugText();
+
+ ////////////////////////////////////////////
+ //
+ // Only accessed by markDead in LLViewerObject
+ void cleanupReferences(LLViewerObject *objectp);
+
+ S32 findReferences(LLDrawable *drawablep) const; // Find references to drawable in all objects, and return value.
+
+ S32 getOrphanParentCount() const { return (S32) mOrphanParents.size(); }
+ S32 getOrphanCount() const { return mNumOrphans; }
+ void orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port);
+ void findOrphans(LLViewerObject* objectp, U32 ip, U32 port);
public:
- // Class for keeping track of orphaned objects
- class OrphanInfo
- {
- public:
- OrphanInfo();
- OrphanInfo(const U64 parent_info, const LLUUID child_info);
- bool operator==(const OrphanInfo &rhs) const;
- bool operator!=(const OrphanInfo &rhs) const;
- U64 mParentInfo;
- LLUUID mChildInfo;
- };
-
-
- U32 mCurBin; // Current bin we're working on...
-
- // Statistics data (see also LLViewerStats)
- S32 mNumNewObjects;
-
- // if we paused in the last frame
- // used to discount stats from this frame
- BOOL mWasPaused;
-
- static void getUUIDFromLocal(LLUUID &id,
- const U32 local_id,
- const U32 ip,
- const U32 port);
- static void setUUIDAndLocal(const LLUUID &id,
- const U32 local_id,
- const U32 ip,
- const U32 port); // Requires knowledge of message system info!
-
- static BOOL removeFromLocalIDTable(const LLViewerObject* objectp);
- // Used ONLY by the orphaned object code.
- static U64 getIndex(const U32 local_id, const U32 ip, const U32 port);
-
- S32 mNumUnknownUpdates;
- S32 mNumDeadObjectUpdates;
- S32 mNumDeadObjects;
+ // Class for keeping track of orphaned objects
+ class OrphanInfo
+ {
+ public:
+ OrphanInfo();
+ OrphanInfo(const U64 parent_info, const LLUUID child_info);
+ bool operator==(const OrphanInfo &rhs) const;
+ bool operator!=(const OrphanInfo &rhs) const;
+ U64 mParentInfo;
+ LLUUID mChildInfo;
+ };
+
+
+ U32 mCurBin; // Current bin we're working on...
+
+ // Statistics data (see also LLViewerStats)
+ S32 mNumNewObjects;
+
+ // if we paused in the last frame
+ // used to discount stats from this frame
+ BOOL mWasPaused;
+
+ static void getUUIDFromLocal(LLUUID &id,
+ const U32 local_id,
+ const U32 ip,
+ const U32 port);
+ static void setUUIDAndLocal(const LLUUID &id,
+ const U32 local_id,
+ const U32 ip,
+ const U32 port); // Requires knowledge of message system info!
+
+ static BOOL removeFromLocalIDTable(const LLViewerObject* objectp);
+ // Used ONLY by the orphaned object code.
+ static U64 getIndex(const U32 local_id, const U32 ip, const U32 port);
+
+ S32 mNumUnknownUpdates;
+ S32 mNumDeadObjectUpdates;
+ S32 mNumDeadObjects;
protected:
- std::vector<U64> mOrphanParents; // LocalID/ip,port of orphaned objects
- std::vector<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects
- S32 mNumOrphans;
+ std::vector<U64> mOrphanParents; // LocalID/ip,port of orphaned objects
+ std::vector<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects
+ S32 mNumOrphans;
- typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;
+ typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;
- vobj_list_t mObjects;
- std::vector<LLPointer<LLViewerObject> > mActiveObjects;
+ vobj_list_t mObjects;
+ std::vector<LLPointer<LLViewerObject> > mActiveObjects;
- vobj_list_t mMapObjects;
+ vobj_list_t mMapObjects;
uuid_set_t mDeadObjects;
- std::map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap;
+ std::map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap;
- //set of objects that need to update their cost
+ //set of objects that need to update their cost
uuid_set_t mStaleObjectCost;
uuid_set_t mPendingObjectCost;
- //set of objects that need to update their physics flags
+ //set of objects that need to update their physics flags
uuid_set_t mStalePhysicsFlags;
uuid_set_t mPendingPhysicsFlags;
- std::vector<LLDebugBeacon> mDebugBeacons;
+ std::vector<LLDebugBeacon> mDebugBeacons;
- S32 mCurLazyUpdateIndex;
+ S32 mCurLazyUpdateIndex;
- static U32 sSimulatorMachineIndex;
- static std::map<U64, U32> sIPAndPortToIndex;
+ static U32 sSimulatorMachineIndex;
+ static std::map<U64, U32> sIPAndPortToIndex;
- static std::map<U64, LLUUID> sIndexAndLocalIDToUUID;
+ static std::map<U64, LLUUID> sIndexAndLocalIDToUUID;
- friend class LLViewerObject;
+ friend class LLViewerObject;
private:
static void reportObjectCostFailure(LLSD &objectList);
@@ -235,14 +235,14 @@ private:
class LLDebugBeacon
{
public:
- ~LLDebugBeacon();
-
- LLVector3 mPositionAgent;
- std::string mString;
- LLColor4 mColor;
- LLColor4 mTextColor;
- S32 mLineWidth;
- LLPointer<class LLHUDObject> mHUDObject;
+ ~LLDebugBeacon();
+
+ LLVector3 mPositionAgent;
+ std::string mString;
+ LLColor4 mColor;
+ LLColor4 mTextColor;
+ S32 mLineWidth;
+ LLPointer<class LLHUDObject> mHUDObject;
};
@@ -253,45 +253,45 @@ extern LLViewerObjectList gObjectList;
// Inlines
/**
* Note:
- * it will return NULL for offline avatar_id
+ * it will return NULL for offline avatar_id
*/
inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id)
{
- std::map<LLUUID, LLPointer<LLViewerObject> >::iterator iter = mUUIDObjectMap.find(id);
- if(iter != mUUIDObjectMap.end())
- {
- return iter->second;
- }
- else
- {
- return NULL;
- }
+ std::map<LLUUID, LLPointer<LLViewerObject> >::iterator iter = mUUIDObjectMap.find(id);
+ if(iter != mUUIDObjectMap.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ return NULL;
+ }
}
inline LLViewerObject *LLViewerObjectList::getObject(const S32 index)
{
- LLViewerObject *objectp;
- objectp = mObjects[index];
- if (objectp->isDead())
- {
- //LL_WARNS() << "Dead object " << objectp->mID << " in getObject" << LL_ENDL;
- return NULL;
- }
- return objectp;
+ LLViewerObject *objectp;
+ objectp = mObjects[index];
+ if (objectp->isDead())
+ {
+ //LL_WARNS() << "Dead object " << objectp->mID << " in getObject" << LL_ENDL;
+ return NULL;
+ }
+ return objectp;
}
inline void LLViewerObjectList::addToMap(LLViewerObject *objectp)
{
- mMapObjects.push_back(objectp);
+ mMapObjects.push_back(objectp);
}
inline void LLViewerObjectList::removeFromMap(LLViewerObject *objectp)
{
- std::vector<LLPointer<LLViewerObject> >::iterator iter = std::find(mMapObjects.begin(), mMapObjects.end(), objectp);
- if (iter != mMapObjects.end())
- {
- mMapObjects.erase(iter);
- }
+ std::vector<LLPointer<LLViewerObject> >::iterator iter = std::find(mMapObjects.begin(), mMapObjects.end(), objectp);
+ if (iter != mMapObjects.end())
+ {
+ mMapObjects.erase(iter);
+ }
}
diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp
index 9d63241300..0431184a9d 100644
--- a/indra/newview/llvieweroctree.cpp
+++ b/indra/newview/llvieweroctree.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvieweroctree.cpp
* @brief LLViewerOctreeGroup class implementation and supporting functions
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,22 +41,22 @@ U32 LLViewerOctreeEntryData::sCurVisible = 10; //reserve the low numbers for spe
BOOL LLViewerOctreeDebug::sInDebug = FALSE;
static LLTrace::CountStatHandle<S32> sOcclusionQueries("occlusion_queries", "Number of occlusion queries executed"),
- sNumObjectsOccluded("occluded_objects", "Count of objects being occluded by a query"),
- sNumObjectsUnoccluded("unoccluded_objects", "Count of objects being unoccluded by a query");
+ sNumObjectsOccluded("occluded_objects", "Count of objects being occluded by a query"),
+ sNumObjectsUnoccluded("unoccluded_objects", "Count of objects being unoccluded by a query");
//-----------------------------------------------------------------------------------
//some global functions definitions
//-----------------------------------------------------------------------------------
typedef enum
{
- b000 = 0x00,
- b001 = 0x01,
- b010 = 0x02,
- b011 = 0x03,
- b100 = 0x04,
- b101 = 0x05,
- b110 = 0x06,
- b111 = 0x07,
+ b000 = 0x00,
+ b001 = 0x01,
+ b010 = 0x02,
+ b011 = 0x03,
+ b100 = 0x04,
+ b101 = 0x05,
+ b110 = 0x06,
+ b111 = 0x07,
} eLoveTheBits;
//contact Runitai Linden for a copy of the SL object used to write this table
@@ -64,74 +64,74 @@ typedef enum
//gives you a triangle fan index array
static U16 sOcclusionIndices[] =
{
- //000
- b111, b110, b010, b011, b001, b101, b100, b110,
- //001
- b011, b010, b000, b001, b101, b111, b110, b010,
- //010
- b101, b100, b110, b111, b011, b001, b000, b100,
- //011
- b001, b000, b100, b101, b111, b011, b010, b000,
- //100
- b110, b000, b010, b011, b111, b101, b100, b000,
- //101
- b010, b100, b000, b001, b011, b111, b110, b100,
- //110
- b100, b010, b110, b111, b101, b001, b000, b010,
- //111
- b000, b110, b100, b101, b001, b011, b010, b110,
+ //000
+ b111, b110, b010, b011, b001, b101, b100, b110,
+ //001
+ b011, b010, b000, b001, b101, b111, b110, b010,
+ //010
+ b101, b100, b110, b111, b011, b001, b000, b100,
+ //011
+ b001, b000, b100, b101, b111, b011, b010, b000,
+ //100
+ b110, b000, b010, b011, b111, b101, b100, b000,
+ //101
+ b010, b100, b000, b001, b011, b111, b110, b100,
+ //110
+ b100, b010, b110, b111, b101, b001, b000, b010,
+ //111
+ b000, b110, b100, b101, b001, b011, b010, b110,
};
U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center)
{
- LLVector4a origin;
- origin.load3(camera->getOrigin().mV);
+ LLVector4a origin;
+ origin.load3(camera->getOrigin().mV);
+
+ S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7;
- S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7;
-
- return cypher*8;
+ return cypher*8;
}
U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center)
{
- LLVector4a origin;
- origin.load3(camera->getOrigin().mV);
+ LLVector4a origin;
+ origin.load3(camera->getOrigin().mV);
- S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7;
-
- return (U8*) (sOcclusionIndices+cypher*8);
+ S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7;
+
+ return (U8*) (sOcclusionIndices+cypher*8);
}
//create a vertex buffer for efficiently rendering cubes
LLVertexBuffer* ll_create_cube_vb(U32 type_mask)
{
- LLVertexBuffer* ret = new LLVertexBuffer(type_mask);
+ LLVertexBuffer* ret = new LLVertexBuffer(type_mask);
- ret->allocateBuffer(8, 64);
+ ret->allocateBuffer(8, 64);
- LLStrider<LLVector3> pos;
- LLStrider<U16> idx;
+ LLStrider<LLVector3> pos;
+ LLStrider<U16> idx;
- ret->getVertexStrider(pos);
- ret->getIndexStrider(idx);
+ ret->getVertexStrider(pos);
+ ret->getIndexStrider(idx);
- pos[0] = LLVector3(-1,-1,-1);
- pos[1] = LLVector3(-1,-1, 1);
- pos[2] = LLVector3(-1, 1,-1);
- pos[3] = LLVector3(-1, 1, 1);
- pos[4] = LLVector3( 1,-1,-1);
- pos[5] = LLVector3( 1,-1, 1);
- pos[6] = LLVector3( 1, 1,-1);
- pos[7] = LLVector3( 1, 1, 1);
+ pos[0] = LLVector3(-1,-1,-1);
+ pos[1] = LLVector3(-1,-1, 1);
+ pos[2] = LLVector3(-1, 1,-1);
+ pos[3] = LLVector3(-1, 1, 1);
+ pos[4] = LLVector3( 1,-1,-1);
+ pos[5] = LLVector3( 1,-1, 1);
+ pos[6] = LLVector3( 1, 1,-1);
+ pos[7] = LLVector3( 1, 1, 1);
- for (U32 i = 0; i < 64; i++)
- {
- idx[i] = sOcclusionIndices[i];
- }
+ for (U32 i = 0; i < 64; i++)
+ {
+ idx[i] = sOcclusionIndices[i];
+ }
- ret->unmapBuffer();
+ ret->unmapBuffer();
- return ret;
+ return ret;
}
@@ -143,171 +143,171 @@ const F32 SG_OCCLUSION_FUDGE = 0.25f;
S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad)
{
- return AABBSphereIntersectR2(min, max, origin, rad*rad);
+ return AABBSphereIntersectR2(min, max, origin, rad*rad);
}
S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &r)
{
- F32 d = 0.f;
- F32 t;
-
- if ((min-origin).magVecSquared() < r &&
- (max-origin).magVecSquared() < r)
- {
- return 2;
- }
-
- for (U32 i = 0; i < 3; i++)
- {
- if (origin.mV[i] < min.mV[i])
- {
- t = min.mV[i] - origin.mV[i];
- d += t*t;
- }
- else if (origin.mV[i] > max.mV[i])
- {
- t = origin.mV[i] - max.mV[i];
- d += t*t;
- }
-
- if (d > r)
- {
- return 0;
- }
- }
-
- return 1;
+ F32 d = 0.f;
+ F32 t;
+
+ if ((min-origin).magVecSquared() < r &&
+ (max-origin).magVecSquared() < r)
+ {
+ return 2;
+ }
+
+ for (U32 i = 0; i < 3; i++)
+ {
+ if (origin.mV[i] < min.mV[i])
+ {
+ t = min.mV[i] - origin.mV[i];
+ d += t*t;
+ }
+ else if (origin.mV[i] > max.mV[i])
+ {
+ t = origin.mV[i] - max.mV[i];
+ d += t*t;
+ }
+
+ if (d > r)
+ {
+ return 0;
+ }
+ }
+
+ return 1;
}
S32 AABBSphereIntersect(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &rad)
{
- return AABBSphereIntersectR2(min, max, origin, rad*rad);
+ return AABBSphereIntersectR2(min, max, origin, rad*rad);
}
S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &r)
{
- F32 d = 0.f;
- F32 t;
-
- LLVector4a origina;
- origina.load3(origin.mV);
-
- LLVector4a v;
- v.setSub(min, origina);
-
- if (v.dot3(v) < r)
- {
- v.setSub(max, origina);
- if (v.dot3(v) < r)
- {
- return 2;
- }
- }
-
-
- for (U32 i = 0; i < 3; i++)
- {
- if (origin.mV[i] < min[i])
- {
- t = min[i] - origin.mV[i];
- d += t*t;
- }
- else if (origin.mV[i] > max[i])
- {
- t = origin.mV[i] - max[i];
- d += t*t;
- }
-
- if (d > r)
- {
- return 0;
- }
- }
-
- return 1;
+ F32 d = 0.f;
+ F32 t;
+
+ LLVector4a origina;
+ origina.load3(origin.mV);
+
+ LLVector4a v;
+ v.setSub(min, origina);
+
+ if (v.dot3(v) < r)
+ {
+ v.setSub(max, origina);
+ if (v.dot3(v) < r)
+ {
+ return 2;
+ }
+ }
+
+
+ for (U32 i = 0; i < 3; i++)
+ {
+ if (origin.mV[i] < min[i])
+ {
+ t = min[i] - origin.mV[i];
+ d += t*t;
+ }
+ else if (origin.mV[i] > max[i])
+ {
+ t = origin.mV[i] - max[i];
+ d += t*t;
+ }
+
+ if (d > r)
+ {
+ return 0;
+ }
+ }
+
+ return 1;
}
//-----------------------------------------------------------------------------------
//class LLViewerOctreeEntry definitions
//-----------------------------------------------------------------------------------
-LLViewerOctreeEntry::LLViewerOctreeEntry()
-: mGroup(NULL),
- mBinRadius(0.f),
- mBinIndex(-1),
- mVisible(0)
+LLViewerOctreeEntry::LLViewerOctreeEntry()
+: mGroup(NULL),
+ mBinRadius(0.f),
+ mBinIndex(-1),
+ mVisible(0)
{
- mPositionGroup.clear();
- mExtents[0].clear();
- mExtents[1].clear();
+ mPositionGroup.clear();
+ mExtents[0].clear();
+ mExtents[1].clear();
- for(S32 i = 0; i < NUM_DATA_TYPE; i++)
- {
- mData[i] = NULL;
- }
+ for(S32 i = 0; i < NUM_DATA_TYPE; i++)
+ {
+ mData[i] = NULL;
+ }
}
LLViewerOctreeEntry::~LLViewerOctreeEntry()
{
- llassert(!mGroup);
+ llassert(!mGroup);
}
void LLViewerOctreeEntry::addData(LLViewerOctreeEntryData* data)
{
- //llassert(mData[data->getDataType()] == NULL);
- llassert(data != NULL);
+ //llassert(mData[data->getDataType()] == NULL);
+ llassert(data != NULL);
- mData[data->getDataType()] = data;
+ mData[data->getDataType()] = data;
}
void LLViewerOctreeEntry::removeData(LLViewerOctreeEntryData* data)
{
- //llassert(data->getDataType() != LLVOCACHEENTRY); //can not remove VOCache entry
+ //llassert(data->getDataType() != LLVOCACHEENTRY); //can not remove VOCache entry
+
+ if(!mData[data->getDataType()])
+ {
+ return;
+ }
+ if(mData[data->getDataType()] != data)
+ {
+ return;
+ }
- if(!mData[data->getDataType()])
- {
- return;
- }
- if(mData[data->getDataType()] != data)
- {
- return;
- }
+ mData[data->getDataType()] = NULL;
- mData[data->getDataType()] = NULL;
-
- if(mGroup != NULL && !mData[LLDRAWABLE])
- {
- LLViewerOctreeGroup* group = mGroup;
- mGroup = NULL;
- group->removeFromGroup(data);
+ if(mGroup != NULL && !mData[LLDRAWABLE])
+ {
+ LLViewerOctreeGroup* group = mGroup;
+ mGroup = NULL;
+ group->removeFromGroup(data);
- llassert(mBinIndex == -1);
- }
+ llassert(mBinIndex == -1);
+ }
}
//called by group handleDestruction() ONLY when group is destroyed by octree.
void LLViewerOctreeEntry::nullGroup()
{
- mGroup = NULL;
+ mGroup = NULL;
}
void LLViewerOctreeEntry::setGroup(LLViewerOctreeGroup* group)
{
- if(mGroup == group)
- {
- return;
- }
+ if(mGroup == group)
+ {
+ return;
+ }
- if(mGroup)
- {
- LLViewerOctreeGroup* old_group = mGroup;
- mGroup = NULL;
- old_group->removeFromGroup(this);
+ if(mGroup)
+ {
+ LLViewerOctreeGroup* old_group = mGroup;
+ mGroup = NULL;
+ old_group->removeFromGroup(this);
- llassert(mBinIndex == -1);
- }
+ llassert(mBinIndex == -1);
+ }
- mGroup = group;
+ mGroup = group;
}
//-----------------------------------------------------------------------------------
@@ -315,138 +315,138 @@ void LLViewerOctreeEntry::setGroup(LLViewerOctreeGroup* group)
//-----------------------------------------------------------------------------------
LLViewerOctreeEntryData::~LLViewerOctreeEntryData()
{
- if(mEntry)
- {
- mEntry->removeData(this);
- }
+ if(mEntry)
+ {
+ mEntry->removeData(this);
+ }
}
LLViewerOctreeEntryData::LLViewerOctreeEntryData(LLViewerOctreeEntry::eEntryDataType_t data_type)
- : mDataType(data_type),
- mEntry(NULL)
+ : mDataType(data_type),
+ mEntry(NULL)
{
}
//virtual
void LLViewerOctreeEntryData::setOctreeEntry(LLViewerOctreeEntry* entry)
{
- llassert_always(mEntry.isNull());
+ llassert_always(mEntry.isNull());
- if(mEntry.notNull())
- {
- return;
- }
+ if(mEntry.notNull())
+ {
+ return;
+ }
- if(!entry)
- {
- mEntry = new LLViewerOctreeEntry();
- }
- else
- {
- mEntry = entry;
- }
- mEntry->addData(this);
+ if(!entry)
+ {
+ mEntry = new LLViewerOctreeEntry();
+ }
+ else
+ {
+ mEntry = entry;
+ }
+ mEntry->addData(this);
}
void LLViewerOctreeEntryData::removeOctreeEntry()
{
- if(mEntry)
- {
- mEntry->removeData(this);
- mEntry = NULL;
- }
+ if(mEntry)
+ {
+ mEntry->removeData(this);
+ mEntry = NULL;
+ }
}
void LLViewerOctreeEntryData::setSpatialExtents(const LLVector3& min, const LLVector3& max)
-{
- mEntry->mExtents[0].load3(min.mV);
- mEntry->mExtents[1].load3(max.mV);
+{
+ mEntry->mExtents[0].load3(min.mV);
+ mEntry->mExtents[1].load3(max.mV);
}
void LLViewerOctreeEntryData::setSpatialExtents(const LLVector4a& min, const LLVector4a& max)
-{
- mEntry->mExtents[0] = min;
- mEntry->mExtents[1] = max;
+{
+ mEntry->mExtents[0] = min;
+ mEntry->mExtents[1] = max;
}
void LLViewerOctreeEntryData::setPositionGroup(const LLVector4a& pos)
{
- mEntry->mPositionGroup = pos;
+ mEntry->mPositionGroup = pos;
}
-const LLVector4a* LLViewerOctreeEntryData::getSpatialExtents() const
+const LLVector4a* LLViewerOctreeEntryData::getSpatialExtents() const
{
- return mEntry->getSpatialExtents();
+ return mEntry->getSpatialExtents();
}
//virtual
void LLViewerOctreeEntryData::setGroup(LLViewerOctreeGroup* group)
{
- mEntry->setGroup(group);
+ mEntry->setGroup(group);
}
void LLViewerOctreeEntryData::shift(const LLVector4a &shift_vector)
{
- mEntry->mExtents[0].add(shift_vector);
- mEntry->mExtents[1].add(shift_vector);
- mEntry->mPositionGroup.add(shift_vector);
+ mEntry->mExtents[0].add(shift_vector);
+ mEntry->mExtents[1].add(shift_vector);
+ mEntry->mPositionGroup.add(shift_vector);
}
-LLViewerOctreeGroup* LLViewerOctreeEntryData::getGroup()const
+LLViewerOctreeGroup* LLViewerOctreeEntryData::getGroup()const
{
- return mEntry.notNull() ? mEntry->mGroup : NULL;
+ return mEntry.notNull() ? mEntry->mGroup : NULL;
}
-const LLVector4a& LLViewerOctreeEntryData::getPositionGroup() const
+const LLVector4a& LLViewerOctreeEntryData::getPositionGroup() const
{
- return mEntry->getPositionGroup();
-}
+ return mEntry->getPositionGroup();
+}
//virtual
bool LLViewerOctreeEntryData::isVisible() const
{
- if(mEntry)
- {
- return mEntry->mVisible == sCurVisible;
- }
- return false;
+ if(mEntry)
+ {
+ return mEntry->mVisible == sCurVisible;
+ }
+ return false;
}
//virtual
bool LLViewerOctreeEntryData::isRecentlyVisible() const
{
- if(!mEntry)
- {
- return false;
- }
+ if(!mEntry)
+ {
+ return false;
+ }
- if(isVisible())
- {
- return true;
- }
- if(getGroup() && getGroup()->isRecentlyVisible())
- {
- setVisible();
- return true;
- }
+ if(isVisible())
+ {
+ return true;
+ }
+ if(getGroup() && getGroup()->isRecentlyVisible())
+ {
+ setVisible();
+ return true;
+ }
- return false;
+ return false;
}
void LLViewerOctreeEntryData::setVisible() const
{
- if(mEntry)
- {
- mEntry->mVisible = sCurVisible;
- }
+ if(mEntry)
+ {
+ mEntry->mVisible = sCurVisible;
+ }
}
void LLViewerOctreeEntryData::resetVisible() const
{
- if(mEntry)
- {
- mEntry->mVisible = 0;
- }
+ if(mEntry)
+ {
+ mEntry->mVisible = 0;
+ }
}
//-----------------------------------------------------------------------------------
//class LLViewerOctreeGroup definitions
@@ -454,177 +454,177 @@ void LLViewerOctreeEntryData::resetVisible() const
LLViewerOctreeGroup::~LLViewerOctreeGroup()
{
- //empty here
+ //empty here
}
LLViewerOctreeGroup::LLViewerOctreeGroup(OctreeNode* node)
-: mOctreeNode(node),
- mAnyVisible(0),
- mState(CLEAN)
+: mOctreeNode(node),
+ mAnyVisible(0),
+ mState(CLEAN)
{
- LLVector4a tmp;
- tmp.splat(0.f);
- mExtents[0] = mExtents[1] = mObjectBounds[0] = mObjectBounds[1] =
- mObjectExtents[0] = mObjectExtents[1] = tmp;
-
- mBounds[0] = node->getCenter();
- mBounds[1] = node->getSize();
+ LLVector4a tmp;
+ tmp.splat(0.f);
+ mExtents[0] = mExtents[1] = mObjectBounds[0] = mObjectBounds[1] =
+ mObjectExtents[0] = mObjectExtents[1] = tmp;
- mOctreeNode->addListener(this);
+ mBounds[0] = node->getCenter();
+ mBounds[1] = node->getSize();
+
+ mOctreeNode->addListener(this);
}
-bool LLViewerOctreeGroup::hasElement(LLViewerOctreeEntryData* data)
-{
- if(!data->getEntry())
- {
- return false;
- }
- return std::find(getDataBegin(), getDataEnd(), data->getEntry()) != getDataEnd();
+bool LLViewerOctreeGroup::hasElement(LLViewerOctreeEntryData* data)
+{
+ if(!data->getEntry())
+ {
+ return false;
+ }
+ return std::find(getDataBegin(), getDataEnd(), data->getEntry()) != getDataEnd();
}
bool LLViewerOctreeGroup::removeFromGroup(LLViewerOctreeEntryData* data)
{
- return removeFromGroup(data->getEntry());
+ return removeFromGroup(data->getEntry());
}
bool LLViewerOctreeGroup::removeFromGroup(LLViewerOctreeEntry* entry)
{
- llassert(entry != NULL);
- llassert(!entry->getGroup());
-
- if(isDead()) //group is about to be destroyed, not need to double delete the entry.
- {
- entry->setBinIndex(-1);
- return true;
- }
+ llassert(entry != NULL);
+ llassert(!entry->getGroup());
+
+ if(isDead()) //group is about to be destroyed, not need to double delete the entry.
+ {
+ entry->setBinIndex(-1);
+ return true;
+ }
- unbound();
- setState(OBJECT_DIRTY);
+ unbound();
+ setState(OBJECT_DIRTY);
- if (mOctreeNode)
- {
- if (!mOctreeNode->remove(entry)) //this could cause *this* pointer to be destroyed, so no more function calls after this.
- {
- OCT_ERRS << "Could not remove LLVOCacheEntry from LLVOCacheOctreeGroup" << LL_ENDL;
- return false;
- }
- }
+ if (mOctreeNode)
+ {
+ if (!mOctreeNode->remove(entry)) //this could cause *this* pointer to be destroyed, so no more function calls after this.
+ {
+ OCT_ERRS << "Could not remove LLVOCacheEntry from LLVOCacheOctreeGroup" << LL_ENDL;
+ return false;
+ }
+ }
- return true;
+ return true;
}
-//virtual
+//virtual
void LLViewerOctreeGroup::unbound()
{
LL_PROFILE_ZONE_SCOPED;
- if (isDirty())
- {
- return;
- }
-
- setState(DIRTY);
-
- //all the parent nodes need to rebound this child
- if (mOctreeNode)
- {
- OctreeNode* parent = (OctreeNode*) mOctreeNode->getParent();
- while (parent != NULL)
- {
- LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) parent->getListener(0);
- if (!group || group->isDirty())
- {
- return;
- }
-
- group->setState(DIRTY);
- parent = (OctreeNode*) parent->getParent();
- }
- }
-}
-
-//virtual
+ if (isDirty())
+ {
+ return;
+ }
+
+ setState(DIRTY);
+
+ //all the parent nodes need to rebound this child
+ if (mOctreeNode)
+ {
+ OctreeNode* parent = (OctreeNode*) mOctreeNode->getParent();
+ while (parent != NULL)
+ {
+ LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) parent->getListener(0);
+ if (!group || group->isDirty())
+ {
+ return;
+ }
+
+ group->setState(DIRTY);
+ parent = (OctreeNode*) parent->getParent();
+ }
+ }
+}
+
+//virtual
void LLViewerOctreeGroup::rebound()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_OCTREE;
- if (!isDirty())
- {
- return;
- }
-
- if (mOctreeNode->getChildCount() == 1 && mOctreeNode->getElementCount() == 0)
- {
- LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0);
- group->rebound();
-
- //copy single child's bounding box
- mBounds[0] = group->mBounds[0];
- mBounds[1] = group->mBounds[1];
- mExtents[0] = group->mExtents[0];
- mExtents[1] = group->mExtents[1];
-
- group->setState(SKIP_FRUSTUM_CHECK);
- }
- else if (mOctreeNode->getChildCount() == 0)
- { //copy object bounding box if this is a leaf
- boundObjects(TRUE, mExtents[0], mExtents[1]);
- mBounds[0] = mObjectBounds[0];
- mBounds[1] = mObjectBounds[1];
- }
- else
- {
- LLVector4a& newMin = mExtents[0];
- LLVector4a& newMax = mExtents[1];
- LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0);
- group->clearState(SKIP_FRUSTUM_CHECK);
- group->rebound();
- //initialize to first child
- newMin = group->mExtents[0];
- newMax = group->mExtents[1];
-
- //first, rebound children
- for (U32 i = 1; i < mOctreeNode->getChildCount(); i++)
- {
- group = (LLViewerOctreeGroup*) mOctreeNode->getChild(i)->getListener(0);
- group->clearState(SKIP_FRUSTUM_CHECK);
- group->rebound();
- const LLVector4a& max = group->mExtents[1];
- const LLVector4a& min = group->mExtents[0];
-
- newMax.setMax(newMax, max);
- newMin.setMin(newMin, min);
- }
-
- boundObjects(FALSE, newMin, newMax);
-
- mBounds[0].setAdd(newMin, newMax);
- mBounds[0].mul(0.5f);
- mBounds[1].setSub(newMax, newMin);
- mBounds[1].mul(0.5f);
- }
-
- clearState(DIRTY);
-
- return;
-}
-
-//virtual
+ if (!isDirty())
+ {
+ return;
+ }
+
+ if (mOctreeNode->getChildCount() == 1 && mOctreeNode->getElementCount() == 0)
+ {
+ LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0);
+ group->rebound();
+
+ //copy single child's bounding box
+ mBounds[0] = group->mBounds[0];
+ mBounds[1] = group->mBounds[1];
+ mExtents[0] = group->mExtents[0];
+ mExtents[1] = group->mExtents[1];
+
+ group->setState(SKIP_FRUSTUM_CHECK);
+ }
+ else if (mOctreeNode->getChildCount() == 0)
+ { //copy object bounding box if this is a leaf
+ boundObjects(TRUE, mExtents[0], mExtents[1]);
+ mBounds[0] = mObjectBounds[0];
+ mBounds[1] = mObjectBounds[1];
+ }
+ else
+ {
+ LLVector4a& newMin = mExtents[0];
+ LLVector4a& newMax = mExtents[1];
+ LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0);
+ group->clearState(SKIP_FRUSTUM_CHECK);
+ group->rebound();
+ //initialize to first child
+ newMin = group->mExtents[0];
+ newMax = group->mExtents[1];
+
+ //first, rebound children
+ for (U32 i = 1; i < mOctreeNode->getChildCount(); i++)
+ {
+ group = (LLViewerOctreeGroup*) mOctreeNode->getChild(i)->getListener(0);
+ group->clearState(SKIP_FRUSTUM_CHECK);
+ group->rebound();
+ const LLVector4a& max = group->mExtents[1];
+ const LLVector4a& min = group->mExtents[0];
+
+ newMax.setMax(newMax, max);
+ newMin.setMin(newMin, min);
+ }
+
+ boundObjects(FALSE, newMin, newMax);
+
+ mBounds[0].setAdd(newMin, newMax);
+ mBounds[0].mul(0.5f);
+ mBounds[1].setSub(newMax, newMin);
+ mBounds[1].mul(0.5f);
+ }
+
+ clearState(DIRTY);
+
+ return;
+}
+
+//virtual
void LLViewerOctreeGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry* obj)
{
- obj->setGroup(this);
- unbound();
- setState(OBJECT_DIRTY);
+ obj->setGroup(this);
+ unbound();
+ setState(OBJECT_DIRTY);
}
-
-//virtual
+
+//virtual
void LLViewerOctreeGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* obj)
{
- unbound();
- setState(OBJECT_DIRTY);
+ unbound();
+ setState(OBJECT_DIRTY);
- obj->setGroup(NULL); //this could cause *this* pointer to be destroyed. So no more function calls after this.
+ obj->setGroup(NULL); //this could cause *this* pointer to be destroyed. So no more function calls after this.
}
-
-//virtual
+
+//virtual
void LLViewerOctreeGroup::handleDestruction(const TreeNode* node)
{
if (isDead())
@@ -632,158 +632,158 @@ void LLViewerOctreeGroup::handleDestruction(const TreeNode* node)
return;
}
setState(DEAD);
- for (OctreeNode::element_iter i = mOctreeNode->getDataBegin(); i != mOctreeNode->getDataEnd(); ++i)
- {
- LLViewerOctreeEntry* obj = *i;
- if (obj && obj->getGroup() == this)
- {
- obj->nullGroup();
- }
- }
- mOctreeNode = NULL;
-}
-
-//virtual
+ for (OctreeNode::element_iter i = mOctreeNode->getDataBegin(); i != mOctreeNode->getDataEnd(); ++i)
+ {
+ LLViewerOctreeEntry* obj = *i;
+ if (obj && obj->getGroup() == this)
+ {
+ obj->nullGroup();
+ }
+ }
+ mOctreeNode = NULL;
+}
+
+//virtual
void LLViewerOctreeGroup::handleStateChange(const TreeNode* node)
{
- //drop bounding box upon state change
- if (mOctreeNode != node)
- {
- mOctreeNode = (OctreeNode*) node;
- }
- unbound();
+ //drop bounding box upon state change
+ if (mOctreeNode != node)
+ {
+ mOctreeNode = (OctreeNode*) node;
+ }
+ unbound();
}
-
-//virtual
+
+//virtual
void LLViewerOctreeGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child)
{
- if (child->getListenerCount() == 0)
- {
- new LLViewerOctreeGroup(child);
- }
- else
- {
- OCT_ERRS << "LLViewerOctreeGroup redundancy detected." << LL_ENDL;
- }
-
- unbound();
-
- ((LLViewerOctreeGroup*)child->getListener(0))->unbound();
-}
-
-//virtual
+ if (child->getListenerCount() == 0)
+ {
+ new LLViewerOctreeGroup(child);
+ }
+ else
+ {
+ OCT_ERRS << "LLViewerOctreeGroup redundancy detected." << LL_ENDL;
+ }
+
+ unbound();
+
+ ((LLViewerOctreeGroup*)child->getListener(0))->unbound();
+}
+
+//virtual
void LLViewerOctreeGroup::handleChildRemoval(const OctreeNode* parent, const OctreeNode* child)
{
- unbound();
+ unbound();
}
LLViewerOctreeGroup* LLViewerOctreeGroup::getParent()
{
- if (isDead())
- {
- return NULL;
- }
+ if (isDead())
+ {
+ return NULL;
+ }
- if(!mOctreeNode)
- {
- return NULL;
- }
-
- OctreeNode* parent = mOctreeNode->getOctParent();
+ if(!mOctreeNode)
+ {
+ return NULL;
+ }
+
+ OctreeNode* parent = mOctreeNode->getOctParent();
- if (parent)
- {
- return (LLViewerOctreeGroup*) parent->getListener(0);
- }
+ if (parent)
+ {
+ return (LLViewerOctreeGroup*) parent->getListener(0);
+ }
- return NULL;
+ return NULL;
}
-//virtual
+//virtual
bool LLViewerOctreeGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut)
{
- const OctreeNode* node = mOctreeNode;
-
- if (node->isEmpty())
- { //don't do anything if there are no objects
- if (empty && mOctreeNode->getParent())
- { //only root is allowed to be empty
- OCT_ERRS << "Empty leaf found in octree." << LL_ENDL;
- }
- return false;
- }
-
- LLVector4a& newMin = mObjectExtents[0];
- LLVector4a& newMax = mObjectExtents[1];
-
- if (hasState(OBJECT_DIRTY))
- { //calculate new bounding box
- clearState(OBJECT_DIRTY);
-
- //initialize bounding box to first element
- OctreeNode::const_element_iter i = node->getDataBegin();
- LLViewerOctreeEntry* entry = *i;
- const LLVector4a* minMax = entry->getSpatialExtents();
-
- newMin = minMax[0];
- newMax = minMax[1];
-
- for (++i; i != node->getDataEnd(); ++i)
- {
- entry = *i;
- minMax = entry->getSpatialExtents();
-
- update_min_max(newMin, newMax, minMax[0]);
- update_min_max(newMin, newMax, minMax[1]);
- }
-
- mObjectBounds[0].setAdd(newMin, newMax);
- mObjectBounds[0].mul(0.5f);
- mObjectBounds[1].setSub(newMax, newMin);
- mObjectBounds[1].mul(0.5f);
- }
-
- if (empty)
- {
- minOut = newMin;
- maxOut = newMax;
- }
- else
- {
- minOut.setMin(minOut, newMin);
- maxOut.setMax(maxOut, newMax);
- }
-
- return TRUE;
-}
-
-//virtual
+ const OctreeNode* node = mOctreeNode;
+
+ if (node->isEmpty())
+ { //don't do anything if there are no objects
+ if (empty && mOctreeNode->getParent())
+ { //only root is allowed to be empty
+ OCT_ERRS << "Empty leaf found in octree." << LL_ENDL;
+ }
+ return false;
+ }
+
+ LLVector4a& newMin = mObjectExtents[0];
+ LLVector4a& newMax = mObjectExtents[1];
+
+ if (hasState(OBJECT_DIRTY))
+ { //calculate new bounding box
+ clearState(OBJECT_DIRTY);
+
+ //initialize bounding box to first element
+ OctreeNode::const_element_iter i = node->getDataBegin();
+ LLViewerOctreeEntry* entry = *i;
+ const LLVector4a* minMax = entry->getSpatialExtents();
+
+ newMin = minMax[0];
+ newMax = minMax[1];
+
+ for (++i; i != node->getDataEnd(); ++i)
+ {
+ entry = *i;
+ minMax = entry->getSpatialExtents();
+
+ update_min_max(newMin, newMax, minMax[0]);
+ update_min_max(newMin, newMax, minMax[1]);
+ }
+
+ mObjectBounds[0].setAdd(newMin, newMax);
+ mObjectBounds[0].mul(0.5f);
+ mObjectBounds[1].setSub(newMax, newMin);
+ mObjectBounds[1].mul(0.5f);
+ }
+
+ if (empty)
+ {
+ minOut = newMin;
+ maxOut = newMax;
+ }
+ else
+ {
+ minOut.setMin(minOut, newMin);
+ maxOut.setMax(maxOut, newMax);
+ }
+
+ return TRUE;
+}
+
+//virtual
BOOL LLViewerOctreeGroup::isVisible() const
{
- return mVisible[LLViewerCamera::sCurCameraID] >= LLViewerOctreeEntryData::getCurrentFrame() ? TRUE : FALSE;
+ return mVisible[LLViewerCamera::sCurCameraID] >= LLViewerOctreeEntryData::getCurrentFrame() ? TRUE : FALSE;
}
-//virtual
-BOOL LLViewerOctreeGroup::isRecentlyVisible() const
+//virtual
+BOOL LLViewerOctreeGroup::isRecentlyVisible() const
{
- return FALSE;
+ return FALSE;
}
void LLViewerOctreeGroup::setVisible()
{
- mVisible[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame();
-
- if(LLViewerCamera::sCurCameraID < LLViewerCamera::CAMERA_WATER0)
- {
- mAnyVisible = LLViewerOctreeEntryData::getCurrentFrame();
- }
+ mVisible[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame();
+
+ if(LLViewerCamera::sCurCameraID < LLViewerCamera::CAMERA_WATER0)
+ {
+ mAnyVisible = LLViewerOctreeEntryData::getCurrentFrame();
+ }
}
void LLViewerOctreeGroup::checkStates()
{
#if LL_OCTREE_PARANOIA_CHECK
- //LLOctreeStateCheck checker;
- //checker.traverse(mOctreeNode);
+ //LLOctreeStateCheck checker;
+ //checker.traverse(mOctreeNode);
#endif
}
@@ -799,7 +799,7 @@ static std::queue<GLuint> sFreeQueries;
U32 LLOcclusionCullingGroup::getNewOcclusionQueryObjectName()
{
LL_PROFILE_ZONE_SCOPED;
-
+
if (sFreeQueries.empty())
{
//seed 1024 query names into the free query pool
@@ -827,112 +827,112 @@ void LLOcclusionCullingGroup::releaseOcclusionQueryObjectName(GLuint name)
}
//=====================================
-// Occlusion State Set/Clear
+// Occlusion State Set/Clear
//=====================================
class LLSpatialSetOcclusionState : public OctreeTraveler
{
public:
- U32 mState;
- LLSpatialSetOcclusionState(U32 state) : mState(state) { }
- virtual void visit(const OctreeNode* branch)
- {
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)branch->getListener(0);
- if(group)
- {
- group->setOcclusionState(mState);
- }
- }
+ U32 mState;
+ LLSpatialSetOcclusionState(U32 state) : mState(state) { }
+ virtual void visit(const OctreeNode* branch)
+ {
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)branch->getListener(0);
+ if(group)
+ {
+ group->setOcclusionState(mState);
+ }
+ }
};
class LLSpatialSetOcclusionStateDiff : public LLSpatialSetOcclusionState
{
public:
- LLSpatialSetOcclusionStateDiff(U32 state) : LLSpatialSetOcclusionState(state) { }
-
- virtual void traverse(const OctreeNode* n)
- {
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*) n->getListener(0);
-
- if (group && !group->isOcclusionState(mState))
- {
- OctreeTraveler::traverse(n);
- }
- }
+ LLSpatialSetOcclusionStateDiff(U32 state) : LLSpatialSetOcclusionState(state) { }
+
+ virtual void traverse(const OctreeNode* n)
+ {
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*) n->getListener(0);
+
+ if (group && !group->isOcclusionState(mState))
+ {
+ OctreeTraveler::traverse(n);
+ }
+ }
};
-LLOcclusionCullingGroup::LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part) :
- LLViewerOctreeGroup(node),
- mSpatialPartition(part)
+LLOcclusionCullingGroup::LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part) :
+ LLViewerOctreeGroup(node),
+ mSpatialPartition(part)
{
- part->mLODSeed = (part->mLODSeed+1)%part->mLODPeriod;
- mLODHash = part->mLODSeed;
+ part->mLODSeed = (part->mLODSeed+1)%part->mLODPeriod;
+ mLODHash = part->mLODSeed;
- OctreeNode* oct_parent = node->getOctParent();
- LLOcclusionCullingGroup* parent = oct_parent ? (LLOcclusionCullingGroup*) oct_parent->getListener(0) : NULL;
+ OctreeNode* oct_parent = node->getOctParent();
+ LLOcclusionCullingGroup* parent = oct_parent ? (LLOcclusionCullingGroup*) oct_parent->getListener(0) : NULL;
- for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
- {
- mOcclusionQuery[i] = 0;
+ for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
+ {
+ mOcclusionQuery[i] = 0;
mOcclusionCheckCount[i] = 0;
- mOcclusionIssued[i] = 0;
- mOcclusionState[i] = parent ? SG_STATE_INHERIT_MASK & parent->mOcclusionState[i] : 0;
- mVisible[i] = 0;
- }
+ mOcclusionIssued[i] = 0;
+ mOcclusionState[i] = parent ? SG_STATE_INHERIT_MASK & parent->mOcclusionState[i] : 0;
+ mVisible[i] = 0;
+ }
}
LLOcclusionCullingGroup::~LLOcclusionCullingGroup()
{
- releaseOcclusionQueryObjectNames();
+ releaseOcclusionQueryObjectNames();
}
BOOL LLOcclusionCullingGroup::needsUpdate()
{
- return (LLDrawable::getCurrentFrame() % mSpatialPartition->mLODPeriod == mLODHash) ? TRUE : FALSE;
+ return (LLDrawable::getCurrentFrame() % mSpatialPartition->mLODPeriod == mLODHash) ? TRUE : FALSE;
}
BOOL LLOcclusionCullingGroup::isRecentlyVisible() const
{
- const S32 MIN_VIS_FRAME_RANGE = 2;
- return (LLDrawable::getCurrentFrame() - mVisible[LLViewerCamera::sCurCameraID]) < MIN_VIS_FRAME_RANGE ;
+ const S32 MIN_VIS_FRAME_RANGE = 2;
+ return (LLDrawable::getCurrentFrame() - mVisible[LLViewerCamera::sCurCameraID]) < MIN_VIS_FRAME_RANGE ;
}
BOOL LLOcclusionCullingGroup::isAnyRecentlyVisible() const
{
- const S32 MIN_VIS_FRAME_RANGE = 2;
- return (LLDrawable::getCurrentFrame() - mAnyVisible) < MIN_VIS_FRAME_RANGE ;
+ const S32 MIN_VIS_FRAME_RANGE = 2;
+ return (LLDrawable::getCurrentFrame() - mAnyVisible) < MIN_VIS_FRAME_RANGE ;
}
-//virtual
+//virtual
void LLOcclusionCullingGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child)
{
- if (child->getListenerCount() == 0)
- {
- new LLOcclusionCullingGroup(child, mSpatialPartition);
- }
- else
- {
- OCT_ERRS << "LLOcclusionCullingGroup redundancy detected." << LL_ENDL;
- }
+ if (child->getListenerCount() == 0)
+ {
+ new LLOcclusionCullingGroup(child, mSpatialPartition);
+ }
+ else
+ {
+ OCT_ERRS << "LLOcclusionCullingGroup redundancy detected." << LL_ENDL;
+ }
- unbound();
-
- ((LLViewerOctreeGroup*)child->getListener(0))->unbound();
+ unbound();
+
+ ((LLViewerOctreeGroup*)child->getListener(0))->unbound();
}
void LLOcclusionCullingGroup::releaseOcclusionQueryObjectNames()
{
- for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; ++i)
- {
- if (mOcclusionQuery[i])
- {
- releaseOcclusionQueryObjectName(mOcclusionQuery[i]);
- mOcclusionQuery[i] = 0;
- }
- }
+ for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; ++i)
+ {
+ if (mOcclusionQuery[i])
+ {
+ releaseOcclusionQueryObjectName(mOcclusionQuery[i]);
+ mOcclusionQuery[i] = 0;
+ }
+ }
}
-void LLOcclusionCullingGroup::setOcclusionState(U32 state, S32 mode /* = STATE_MODE_SINGLE */ )
+void LLOcclusionCullingGroup::setOcclusionState(U32 state, S32 mode /* = STATE_MODE_SINGLE */ )
{
switch (mode)
{
@@ -986,33 +986,33 @@ void LLOcclusionCullingGroup::setOcclusionState(U32 state, S32 mode /* = STATE_M
class LLSpatialClearOcclusionState : public OctreeTraveler
{
public:
- U32 mState;
-
- LLSpatialClearOcclusionState(U32 state) : mState(state) { }
- virtual void visit(const OctreeNode* branch)
- {
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)branch->getListener(0);
- if(group)
- {
- group->clearOcclusionState(mState);
- }
- }
+ U32 mState;
+
+ LLSpatialClearOcclusionState(U32 state) : mState(state) { }
+ virtual void visit(const OctreeNode* branch)
+ {
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)branch->getListener(0);
+ if(group)
+ {
+ group->clearOcclusionState(mState);
+ }
+ }
};
class LLSpatialClearOcclusionStateDiff : public LLSpatialClearOcclusionState
{
public:
- LLSpatialClearOcclusionStateDiff(U32 state) : LLSpatialClearOcclusionState(state) { }
-
- virtual void traverse(const OctreeNode* n)
- {
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*) n->getListener(0);
-
- if (group && group->isOcclusionState(mState))
- {
- OctreeTraveler::traverse(n);
- }
- }
+ LLSpatialClearOcclusionStateDiff(U32 state) : LLSpatialClearOcclusionState(state) { }
+
+ virtual void traverse(const OctreeNode* n)
+ {
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*) n->getListener(0);
+
+ if (group && group->isOcclusionState(mState))
+ {
+ OctreeTraveler::traverse(n);
+ }
+ }
};
void LLOcclusionCullingGroup::clearOcclusionState(U32 state, S32 mode /* = STATE_MODE_SINGLE */)
@@ -1058,50 +1058,50 @@ void LLOcclusionCullingGroup::clearOcclusionState(U32 state, S32 mode /* = STATE
BOOL LLOcclusionCullingGroup::earlyFail(LLCamera* camera, const LLVector4a* bounds)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_OCTREE;
- if (camera->getOrigin().isExactlyZero())
- {
- return FALSE;
- }
-
- const F32 vel = SG_OCCLUSION_FUDGE*2.f;
- LLVector4a fudge;
- fudge.splat(vel);
-
- const LLVector4a& c = bounds[0];
- LLVector4a r;
- r.setAdd(bounds[1], fudge);
-
- /*if (r.magVecSquared() > 1024.0*1024.0)
- {
- return TRUE;
- }*/
-
- LLVector4a e;
- e.load3(camera->getOrigin().mV);
-
- LLVector4a min;
- min.setSub(c,r);
- LLVector4a max;
- max.setAdd(c,r);
-
- S32 lt = e.lessThan(min).getGatheredBits() & 0x7;
- if (lt)
- {
- return FALSE;
- }
-
- S32 gt = e.greaterThan(max).getGatheredBits() & 0x7;
- if (gt)
- {
- return FALSE;
- }
-
- return TRUE;
+ if (camera->getOrigin().isExactlyZero())
+ {
+ return FALSE;
+ }
+
+ const F32 vel = SG_OCCLUSION_FUDGE*2.f;
+ LLVector4a fudge;
+ fudge.splat(vel);
+
+ const LLVector4a& c = bounds[0];
+ LLVector4a r;
+ r.setAdd(bounds[1], fudge);
+
+ /*if (r.magVecSquared() > 1024.0*1024.0)
+ {
+ return TRUE;
+ }*/
+
+ LLVector4a e;
+ e.load3(camera->getOrigin().mV);
+
+ LLVector4a min;
+ min.setSub(c,r);
+ LLVector4a max;
+ max.setAdd(c,r);
+
+ S32 lt = e.lessThan(min).getGatheredBits() & 0x7;
+ if (lt)
+ {
+ return FALSE;
+ }
+
+ S32 gt = e.greaterThan(max).getGatheredBits() & 0x7;
+ if (gt)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
}
U32 LLOcclusionCullingGroup::getLastOcclusionIssuedTime()
{
- return mOcclusionIssued[LLViewerCamera::sCurCameraID];
+ return mOcclusionIssued[LLViewerCamera::sCurCameraID];
}
void LLOcclusionCullingGroup::checkOcclusion()
@@ -1111,13 +1111,13 @@ void LLOcclusionCullingGroup::checkOcclusion()
LL_PROFILE_ZONE_SCOPED_CATEGORY_OCTREE;
LLOcclusionCullingGroup* parent = (LLOcclusionCullingGroup*)getParent();
if (parent && parent->isOcclusionState(LLOcclusionCullingGroup::OCCLUDED))
- { //if the parent has been marked as occluded, the child is implicitly occluded
+ { //if the parent has been marked as occluded, the child is implicitly occluded
clearOcclusionState(QUERY_PENDING | DISCARD_QUERY);
return;
}
if (mOcclusionQuery[LLViewerCamera::sCurCameraID] && isOcclusionState(QUERY_PENDING))
- {
+ {
if (isOcclusionState(DISCARD_QUERY))
{ // delete the query to avoid holding onto hundreds of pending queries
releaseOcclusionQueryObjectName(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
@@ -1138,7 +1138,7 @@ void LLOcclusionCullingGroup::checkOcclusion()
static LLCachedControl<S32> occlusion_timeout(gSavedSettings, "RenderOcclusionTimeout", 4);
if (available || mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > occlusion_timeout)
- {
+ {
mOcclusionCheckCount[LLViewerCamera::sCurCameraID] = 0;
GLuint query_result; // Will be # samples drawn, or a boolean depending on mHasOcclusionQuery2 (both are type GLuint)
{
@@ -1162,7 +1162,7 @@ void LLOcclusionCullingGroup::checkOcclusion()
}
}
else if (mSpatialPartition->isOcclusionEnabled() && isOcclusionState(LLOcclusionCullingGroup::OCCLUDED))
- { //check occlusion has been issued for occluded node that has not had a query issued
+ { //check occlusion has been issued for occluded node that has not had a query issued
assert_states_valid(this);
//clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF);
assert_states_valid(this);
@@ -1172,63 +1172,63 @@ void LLOcclusionCullingGroup::checkOcclusion()
void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* shift)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_OCTREE;
- if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1)
- {
- //move mBounds to the agent space if necessary
- LLVector4a bounds[2];
- bounds[0] = mBounds[0];
- bounds[1] = mBounds[1];
- if(shift != NULL)
- {
- bounds[0].add(*shift);
- }
-
- F32 OCCLUSION_FUDGE_Z = SG_OCCLUSION_FUDGE; //<-- #Solution #2
- if (LLPipeline::RENDER_TYPE_VOIDWATER == mSpatialPartition->mDrawableType)
- {
- OCCLUSION_FUDGE_Z = 1.;
- }
-
- if (earlyFail(camera, bounds))
- {
+ if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1)
+ {
+ //move mBounds to the agent space if necessary
+ LLVector4a bounds[2];
+ bounds[0] = mBounds[0];
+ bounds[1] = mBounds[1];
+ if(shift != NULL)
+ {
+ bounds[0].add(*shift);
+ }
+
+ F32 OCCLUSION_FUDGE_Z = SG_OCCLUSION_FUDGE; //<-- #Solution #2
+ if (LLPipeline::RENDER_TYPE_VOIDWATER == mSpatialPartition->mDrawableType)
+ {
+ OCCLUSION_FUDGE_Z = 1.;
+ }
+
+ if (earlyFail(camera, bounds))
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("doOcclusion - early fail");
- setOcclusionState(LLOcclusionCullingGroup::DISCARD_QUERY);
- assert_states_valid(this);
- clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF);
- assert_states_valid(this);
- }
- else
- {
- if (!isOcclusionState(QUERY_PENDING) || isOcclusionState(DISCARD_QUERY))
- {
- { //no query pending, or previous query to be discarded
+ setOcclusionState(LLOcclusionCullingGroup::DISCARD_QUERY);
+ assert_states_valid(this);
+ clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF);
+ assert_states_valid(this);
+ }
+ else
+ {
+ if (!isOcclusionState(QUERY_PENDING) || isOcclusionState(DISCARD_QUERY))
+ {
+ { //no query pending, or previous query to be discarded
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("doOcclusion - render");
- if (!mOcclusionQuery[LLViewerCamera::sCurCameraID])
- {
- mOcclusionQuery[LLViewerCamera::sCurCameraID] = getNewOcclusionQueryObjectName();
- }
-
- // Depth clamp all water to avoid it being culled as a result of being
- // behind the far clip plane, and in the case of edge water to avoid
- // it being culled while still visible.
- bool const use_depth_clamp = (mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_WATER ||
- mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_VOIDWATER);
-
- LLGLEnable clamp(use_depth_clamp ? GL_DEPTH_CLAMP : 0);
-
- U32 mode = gGLManager.mGLVersion >= 3.3f ? GL_ANY_SAMPLES_PASSED : GL_SAMPLES_PASSED;
-
+ if (!mOcclusionQuery[LLViewerCamera::sCurCameraID])
+ {
+ mOcclusionQuery[LLViewerCamera::sCurCameraID] = getNewOcclusionQueryObjectName();
+ }
+
+ // Depth clamp all water to avoid it being culled as a result of being
+ // behind the far clip plane, and in the case of edge water to avoid
+ // it being culled while still visible.
+ bool const use_depth_clamp = (mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_WATER ||
+ mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_VOIDWATER);
+
+ LLGLEnable clamp(use_depth_clamp ? GL_DEPTH_CLAMP : 0);
+
+ U32 mode = gGLManager.mGLVersion >= 3.3f ? GL_ANY_SAMPLES_PASSED : GL_SAMPLES_PASSED;
+
#if LL_TRACK_PENDING_OCCLUSION_QUERIES
- sPendingQueries.insert(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
+ sPendingQueries.insert(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
#endif
- add(sOcclusionQueries, 1);
+ add(sOcclusionQueries, 1);
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("doOcclusion - push");
-
- //store which frame this query was issued on
- mOcclusionIssued[LLViewerCamera::sCurCameraID] = gFrameCount;
+
+ //store which frame this query was issued on
+ mOcclusionIssued[LLViewerCamera::sCurCameraID] = gFrameCount;
{
LL_PROFILE_ZONE_NAMED("glBeginQuery");
@@ -1238,59 +1238,59 @@ void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* sh
mOcclusionQuery[LLViewerCamera::sCurCameraID] = getNewOcclusionQueryObjectName();
glBeginQuery(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]);
}
-
- LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
- llassert(shader);
- shader->uniform3fv(LLShaderMgr::BOX_CENTER, 1, bounds[0].getF32ptr());
- shader->uniform3f(LLShaderMgr::BOX_SIZE, bounds[1][0]+SG_OCCLUSION_FUDGE,
- bounds[1][1]+SG_OCCLUSION_FUDGE,
- bounds[1][2]+OCCLUSION_FUDGE_Z);
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ llassert(shader);
+
+ shader->uniform3fv(LLShaderMgr::BOX_CENTER, 1, bounds[0].getF32ptr());
+ shader->uniform3f(LLShaderMgr::BOX_SIZE, bounds[1][0]+SG_OCCLUSION_FUDGE,
+ bounds[1][1]+SG_OCCLUSION_FUDGE,
+ bounds[1][2]+OCCLUSION_FUDGE_Z);
- if (!use_depth_clamp && mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_VOIDWATER)
- {
+ if (!use_depth_clamp && mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_VOIDWATER)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("doOcclusion - draw water");
- LLGLSquashToFarClip squash;
- if (camera->getOrigin().isExactlyZero())
- { //origin is invalid, draw entire box
- gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0);
- gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8);
- }
- else
- {
- gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, bounds[0]));
- }
- }
- else
- {
+ LLGLSquashToFarClip squash;
+ if (camera->getOrigin().isExactlyZero())
+ { //origin is invalid, draw entire box
+ gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0);
+ gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8);
+ }
+ else
+ {
+ gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, bounds[0]));
+ }
+ }
+ else
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("doOcclusion - draw");
- if (camera->getOrigin().isExactlyZero())
- { //origin is invalid, draw entire box
- gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0);
- gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8);
- }
- else
- {
- gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, bounds[0]));
- }
- }
-
+ if (camera->getOrigin().isExactlyZero())
+ { //origin is invalid, draw entire box
+ gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0);
+ gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8);
+ }
+ else
+ {
+ gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, bounds[0]));
+ }
+ }
+
{
LL_PROFILE_ZONE_NAMED("glEndQuery");
glEndQuery(mode);
}
- }
- }
+ }
+ }
- {
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("doOcclusion - set state");
- setOcclusionState(LLOcclusionCullingGroup::QUERY_PENDING);
- clearOcclusionState(LLOcclusionCullingGroup::DISCARD_QUERY);
- }
- }
- }
- }
+ setOcclusionState(LLOcclusionCullingGroup::QUERY_PENDING);
+ clearOcclusionState(LLOcclusionCullingGroup::DISCARD_QUERY);
+ }
+ }
+ }
+ }
}
//-------------------------------------------------------------------------------------------
//end of occulsion culling functions and classes
@@ -1299,20 +1299,20 @@ void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* sh
//-----------------------------------------------------------------------------------
//class LLViewerOctreePartition definitions
//-----------------------------------------------------------------------------------
-LLViewerOctreePartition::LLViewerOctreePartition() :
- mRegionp(NULL),
- mOcclusionEnabled(TRUE),
- mDrawableType(0),
- mLODSeed(0),
- mLODPeriod(1)
+LLViewerOctreePartition::LLViewerOctreePartition() :
+ mRegionp(NULL),
+ mOcclusionEnabled(TRUE),
+ mDrawableType(0),
+ mLODSeed(0),
+ mLODPeriod(1)
{
- LLVector4a center, size;
- center.splat(0.f);
- size.splat(1.f);
+ LLVector4a center, size;
+ center.splat(0.f);
+ size.splat(1.f);
- mOctree = new OctreeRoot(center,size, NULL);
+ mOctree = new OctreeRoot(center,size, NULL);
}
-
+
LLViewerOctreePartition::~LLViewerOctreePartition()
{
cleanup();
@@ -1326,7 +1326,7 @@ void LLViewerOctreePartition::cleanup()
BOOL LLViewerOctreePartition::isOcclusionEnabled()
{
- return mOcclusionEnabled || LLPipeline::sUseOcclusion > 2;
+ return mOcclusionEnabled || LLPipeline::sUseOcclusion > 2;
}
@@ -1334,55 +1334,55 @@ BOOL LLViewerOctreePartition::isOcclusionEnabled()
//class LLViewerOctreeCull definitions
//-----------------------------------------------------------------------------------
-//virtual
+//virtual
bool LLViewerOctreeCull::earlyFail(LLViewerOctreeGroup* group)
-{
- return false;
+{
+ return false;
}
-
-//virtual
+
+//virtual
void LLViewerOctreeCull::traverse(const OctreeNode* n)
{
- LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) n->getListener(0);
-
- if (earlyFail(group))
- {
- return;
- }
-
- if (mRes == 2 ||
- (mRes && group->hasState(LLViewerOctreeGroup::SKIP_FRUSTUM_CHECK)))
- { //fully in, just add everything
- OctreeTraveler::traverse(n);
- }
- else
- {
- mRes = frustumCheck(group);
-
- if (mRes)
- { //at least partially in, run on down
- OctreeTraveler::traverse(n);
- }
-
- mRes = 0;
- }
-}
-
+ LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) n->getListener(0);
+
+ if (earlyFail(group))
+ {
+ return;
+ }
+
+ if (mRes == 2 ||
+ (mRes && group->hasState(LLViewerOctreeGroup::SKIP_FRUSTUM_CHECK)))
+ { //fully in, just add everything
+ OctreeTraveler::traverse(n);
+ }
+ else
+ {
+ mRes = frustumCheck(group);
+
+ if (mRes)
+ { //at least partially in, run on down
+ OctreeTraveler::traverse(n);
+ }
+
+ mRes = 0;
+ }
+}
+
//------------------------------------------
//agent space group culling
S32 LLViewerOctreeCull::AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group)
{
- return mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1]);
+ return mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1]);
}
S32 LLViewerOctreeCull::AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group)
{
- return AABBSphereIntersect(group->mExtents[0], group->mExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist);
+ return AABBSphereIntersect(group->mExtents[0], group->mExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist);
}
S32 LLViewerOctreeCull::AABBInFrustumGroupBounds(const LLViewerOctreeGroup* group)
{
- return mCamera->AABBInFrustum(group->mBounds[0], group->mBounds[1]);
+ return mCamera->AABBInFrustum(group->mBounds[0], group->mBounds[1]);
}
//------------------------------------------
@@ -1390,17 +1390,17 @@ S32 LLViewerOctreeCull::AABBInFrustumGroupBounds(const LLViewerOctreeGroup* grou
//agent space object set culling
S32 LLViewerOctreeCull::AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group)
{
- return mCamera->AABBInFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]);
+ return mCamera->AABBInFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]);
}
S32 LLViewerOctreeCull::AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group)
{
- return AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist);
+ return AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist);
}
S32 LLViewerOctreeCull::AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group)
{
- return mCamera->AABBInFrustum(group->mObjectBounds[0], group->mObjectBounds[1]);
+ return mCamera->AABBInFrustum(group->mObjectBounds[0], group->mObjectBounds[1]);
}
//------------------------------------------
@@ -1408,17 +1408,17 @@ S32 LLViewerOctreeCull::AABBInFrustumObjectBounds(const LLViewerOctreeGroup* gro
//local regional space group culling
S32 LLViewerOctreeCull::AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group)
{
- return mCamera->AABBInRegionFrustumNoFarClip(group->mBounds[0], group->mBounds[1]);
+ return mCamera->AABBInRegionFrustumNoFarClip(group->mBounds[0], group->mBounds[1]);
}
S32 LLViewerOctreeCull::AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group)
{
- return mCamera->AABBInRegionFrustum(group->mBounds[0], group->mBounds[1]);
+ return mCamera->AABBInRegionFrustum(group->mBounds[0], group->mBounds[1]);
}
S32 LLViewerOctreeCull::AABBRegionSphereIntersectGroupExtents(const LLViewerOctreeGroup* group, const LLVector3& shift)
{
- return AABBSphereIntersect(group->mExtents[0], group->mExtents[1], mCamera->getOrigin() - shift, mCamera->mFrustumCornerDist);
+ return AABBSphereIntersect(group->mExtents[0], group->mExtents[1], mCamera->getOrigin() - shift, mCamera->mFrustumCornerDist);
}
//------------------------------------------
@@ -1426,125 +1426,125 @@ S32 LLViewerOctreeCull::AABBRegionSphereIntersectGroupExtents(const LLViewerOctr
//local regional space object culling
S32 LLViewerOctreeCull::AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group)
{
- return mCamera->AABBInRegionFrustum(group->mObjectBounds[0], group->mObjectBounds[1]);
+ return mCamera->AABBInRegionFrustum(group->mObjectBounds[0], group->mObjectBounds[1]);
}
S32 LLViewerOctreeCull::AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group)
{
- return mCamera->AABBInRegionFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]);
+ return mCamera->AABBInRegionFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]);
}
S32 LLViewerOctreeCull::AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift)
{
- return AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin() - shift, mCamera->mFrustumCornerDist);
+ return AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin() - shift, mCamera->mFrustumCornerDist);
}
//------------------------------------------
//check if the objects projection large enough
bool LLViewerOctreeCull::checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius)
-{
- LLVector3 local_orig = mCamera->getOrigin() - shift;
- LLVector4a origin;
- origin.load3(local_orig.mV);
+{
+ LLVector3 local_orig = mCamera->getOrigin() - shift;
+ LLVector4a origin;
+ origin.load3(local_orig.mV);
- LLVector4a lookAt;
- lookAt.setSub(center, origin);
- F32 distance = lookAt.getLength3().getF32();
- if(distance <= near_radius)
- {
- return true; //always load close-by objects
- }
+ LLVector4a lookAt;
+ lookAt.setSub(center, origin);
+ F32 distance = lookAt.getLength3().getF32();
+ if(distance <= near_radius)
+ {
+ return true; //always load close-by objects
+ }
- // treat object as if it were near_radius meters closer than it actually was.
- // this allows us to get some temporal coherence on visibility...objects that can be reached quickly will tend to be visible
- distance -= near_radius;
+ // treat object as if it were near_radius meters closer than it actually was.
+ // this allows us to get some temporal coherence on visibility...objects that can be reached quickly will tend to be visible
+ distance -= near_radius;
- F32 squared_rad = size.dot3(size).getF32();
- return squared_rad / distance > pixel_threshold;
+ F32 squared_rad = size.dot3(size).getF32();
+ return squared_rad / distance > pixel_threshold;
}
-//virtual
+//virtual
bool LLViewerOctreeCull::checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group)
{
- if (branch->getElementCount() == 0) //no elements
- {
- return false;
- }
- else if (branch->getChildCount() == 0) //leaf state, already checked tightest bounding box
- {
- return true;
- }
- else if (mRes == 1 && !frustumCheckObjects(group)) //no objects in frustum
- {
- return false;
- }
-
- return true;
-}
-
-//virtual
+ if (branch->getElementCount() == 0) //no elements
+ {
+ return false;
+ }
+ else if (branch->getChildCount() == 0) //leaf state, already checked tightest bounding box
+ {
+ return true;
+ }
+ else if (mRes == 1 && !frustumCheckObjects(group)) //no objects in frustum
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//virtual
void LLViewerOctreeCull::preprocess(LLViewerOctreeGroup* group)
-{
+{
}
-
-//virtual
+
+//virtual
void LLViewerOctreeCull::processGroup(LLViewerOctreeGroup* group)
{
}
-
-//virtual
-void LLViewerOctreeCull::visit(const OctreeNode* branch)
-{
- LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) branch->getListener(0);
- preprocess(group);
-
- if (checkObjects(branch, group))
- {
- processGroup(group);
- }
+//virtual
+void LLViewerOctreeCull::visit(const OctreeNode* branch)
+{
+ LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) branch->getListener(0);
+
+ preprocess(group);
+
+ if (checkObjects(branch, group))
+ {
+ processGroup(group);
+ }
}
//--------------------------------------------------------------
//class LLViewerOctreeDebug
-//virtual
+//virtual
void LLViewerOctreeDebug::visit(const OctreeNode* branch)
{
#if 0
- LL_INFOS() << "Node: " << (U32)branch << " # Elements: " << branch->getElementCount() << " # Children: " << branch->getChildCount() << LL_ENDL;
- for (U32 i = 0; i < branch->getChildCount(); i++)
- {
- LL_INFOS() << "Child " << i << " : " << (U32)branch->getChild(i) << LL_ENDL;
- }
+ LL_INFOS() << "Node: " << (U32)branch << " # Elements: " << branch->getElementCount() << " # Children: " << branch->getChildCount() << LL_ENDL;
+ for (U32 i = 0; i < branch->getChildCount(); i++)
+ {
+ LL_INFOS() << "Child " << i << " : " << (U32)branch->getChild(i) << LL_ENDL;
+ }
#endif
- LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) branch->getListener(0);
- processGroup(group);
+ LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) branch->getListener(0);
+ processGroup(group);
}
-//virtual
+//virtual
void LLViewerOctreeDebug::processGroup(LLViewerOctreeGroup* group)
{
#if 0
- const LLVector4a* vec4 = group->getBounds();
- LLVector3 vec[2];
- vec[0].set(vec4[0].getF32ptr());
- vec[1].set(vec4[1].getF32ptr());
- LL_INFOS() << "Bounds: " << vec[0] << " : " << vec[1] << LL_ENDL;
-
- vec4 = group->getExtents();
- vec[0].set(vec4[0].getF32ptr());
- vec[1].set(vec4[1].getF32ptr());
- LL_INFOS() << "Extents: " << vec[0] << " : " << vec[1] << LL_ENDL;
-
- vec4 = group->getObjectBounds();
- vec[0].set(vec4[0].getF32ptr());
- vec[1].set(vec4[1].getF32ptr());
- LL_INFOS() << "ObjectBounds: " << vec[0] << " : " << vec[1] << LL_ENDL;
-
- vec4 = group->getObjectExtents();
- vec[0].set(vec4[0].getF32ptr());
- vec[1].set(vec4[1].getF32ptr());
- LL_INFOS() << "ObjectExtents: " << vec[0] << " : " << vec[1] << LL_ENDL;
+ const LLVector4a* vec4 = group->getBounds();
+ LLVector3 vec[2];
+ vec[0].set(vec4[0].getF32ptr());
+ vec[1].set(vec4[1].getF32ptr());
+ LL_INFOS() << "Bounds: " << vec[0] << " : " << vec[1] << LL_ENDL;
+
+ vec4 = group->getExtents();
+ vec[0].set(vec4[0].getF32ptr());
+ vec[1].set(vec4[1].getF32ptr());
+ LL_INFOS() << "Extents: " << vec[0] << " : " << vec[1] << LL_ENDL;
+
+ vec4 = group->getObjectBounds();
+ vec[0].set(vec4[0].getF32ptr());
+ vec[1].set(vec4[1].getF32ptr());
+ LL_INFOS() << "ObjectBounds: " << vec[0] << " : " << vec[1] << LL_ENDL;
+
+ vec4 = group->getObjectExtents();
+ vec[0].set(vec4[0].getF32ptr());
+ vec[1].set(vec4[1].getF32ptr());
+ LL_INFOS() << "ObjectExtents: " << vec[0] << " : " << vec[1] << LL_ENDL;
#endif
}
//--------------------------------------------------------------
diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h
index 353429d254..2a072056df 100644
--- a/indra/newview/llvieweroctree.h
+++ b/indra/newview/llvieweroctree.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvieweroctree.h
* @brief LLViewerObjectOctree.cpp header file, defining all supporting classes.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -74,52 +74,52 @@ S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVe
class LLViewerOctreeEntry : public LLRefCount
{
LL_ALIGN_NEW
- friend class LLViewerOctreeEntryData;
+ friend class LLViewerOctreeEntryData;
public:
- typedef enum
- {
- LLDRAWABLE = 0,
- LLVOCACHEENTRY,
- NUM_DATA_TYPE
- }eEntryDataType_t;
+ typedef enum
+ {
+ LLDRAWABLE = 0,
+ LLVOCACHEENTRY,
+ NUM_DATA_TYPE
+ }eEntryDataType_t;
protected:
- virtual ~LLViewerOctreeEntry();
+ virtual ~LLViewerOctreeEntry();
public:
- LLViewerOctreeEntry();
-
- void nullGroup(); //called by group handleDestruction() only
- void setGroup(LLViewerOctreeGroup* group);
- void removeData(LLViewerOctreeEntryData* data);
-
- LLViewerOctreeEntryData* getDrawable() const {return mData[LLDRAWABLE];}
- bool hasDrawable() const {return mData[LLDRAWABLE] != NULL;}
- LLViewerOctreeEntryData* getVOCacheEntry() const {return mData[LLVOCACHEENTRY];}
- bool hasVOCacheEntry() const {return mData[LLVOCACHEENTRY] != NULL;}
-
- const LLVector4a* getSpatialExtents() const {return mExtents;}
- const LLVector4a& getPositionGroup() const {return mPositionGroup;}
- LLViewerOctreeGroup* getGroup()const {return mGroup;}
-
- F32 getBinRadius() const {return mBinRadius;}
- S32 getBinIndex() const {return mBinIndex; }
- void setBinIndex(S32 index) const {mBinIndex = index; }
+ LLViewerOctreeEntry();
+
+ void nullGroup(); //called by group handleDestruction() only
+ void setGroup(LLViewerOctreeGroup* group);
+ void removeData(LLViewerOctreeEntryData* data);
+
+ LLViewerOctreeEntryData* getDrawable() const {return mData[LLDRAWABLE];}
+ bool hasDrawable() const {return mData[LLDRAWABLE] != NULL;}
+ LLViewerOctreeEntryData* getVOCacheEntry() const {return mData[LLVOCACHEENTRY];}
+ bool hasVOCacheEntry() const {return mData[LLVOCACHEENTRY] != NULL;}
+
+ const LLVector4a* getSpatialExtents() const {return mExtents;}
+ const LLVector4a& getPositionGroup() const {return mPositionGroup;}
+ LLViewerOctreeGroup* getGroup()const {return mGroup;}
+
+ F32 getBinRadius() const {return mBinRadius;}
+ S32 getBinIndex() const {return mBinIndex; }
+ void setBinIndex(S32 index) const {mBinIndex = index; }
private:
- void addData(LLViewerOctreeEntryData* data);
+ void addData(LLViewerOctreeEntryData* data);
private:
- LLViewerOctreeEntryData* mData[NUM_DATA_TYPE]; //do not use LLPointer here.
- LLViewerOctreeGroup* mGroup;
+ LLViewerOctreeEntryData* mData[NUM_DATA_TYPE]; //do not use LLPointer here.
+ LLViewerOctreeGroup* mGroup;
- //aligned members
- LL_ALIGN_16(LLVector4a mExtents[2]);
- LL_ALIGN_16(LLVector4a mPositionGroup);
- F32 mBinRadius;
- mutable S32 mBinIndex;
- mutable U32 mVisible;
+ //aligned members
+ LL_ALIGN_16(LLVector4a mExtents[2]);
+ LL_ALIGN_16(LLVector4a mPositionGroup);
+ F32 mBinRadius;
+ mutable S32 mBinIndex;
+ mutable U32 mVisible;
} ;//LL_ALIGN_POSTFIX(16);
@@ -128,144 +128,144 @@ private:
class LLViewerOctreeEntryData : public LLRefCount
{
protected:
- virtual ~LLViewerOctreeEntryData();
+ virtual ~LLViewerOctreeEntryData();
public:
- LLViewerOctreeEntryData(const LLViewerOctreeEntryData& rhs)
- {
- *this = rhs;
- }
- LLViewerOctreeEntryData(LLViewerOctreeEntry::eEntryDataType_t data_type);
-
- LLViewerOctreeEntry::eEntryDataType_t getDataType() const {return mDataType;}
- LLViewerOctreeEntry* getEntry() {return mEntry;}
-
- virtual void setOctreeEntry(LLViewerOctreeEntry* entry);
- void removeOctreeEntry();
-
- F32 getBinRadius() const {return mEntry->getBinRadius();}
- const LLVector4a* getSpatialExtents() const;
- LLViewerOctreeGroup* getGroup()const;
- const LLVector4a& getPositionGroup() const;
-
- void setBinRadius(F32 rad) {mEntry->mBinRadius = rad;}
- void setSpatialExtents(const LLVector3& min, const LLVector3& max);
- void setSpatialExtents(const LLVector4a& min, const LLVector4a& max);
- void setPositionGroup(const LLVector4a& pos);
-
- virtual void setGroup(LLViewerOctreeGroup* group);
- void shift(const LLVector4a &shift_vector);
-
- U32 getVisible() const {return mEntry ? mEntry->mVisible : 0;}
- void setVisible() const;
- void resetVisible() const;
- virtual bool isVisible() const;
- virtual bool isRecentlyVisible() const;
-
- static S32 getCurrentFrame() { return sCurVisible; }
+ LLViewerOctreeEntryData(const LLViewerOctreeEntryData& rhs)
+ {
+ *this = rhs;
+ }
+ LLViewerOctreeEntryData(LLViewerOctreeEntry::eEntryDataType_t data_type);
+
+ LLViewerOctreeEntry::eEntryDataType_t getDataType() const {return mDataType;}
+ LLViewerOctreeEntry* getEntry() {return mEntry;}
+
+ virtual void setOctreeEntry(LLViewerOctreeEntry* entry);
+ void removeOctreeEntry();
+
+ F32 getBinRadius() const {return mEntry->getBinRadius();}
+ const LLVector4a* getSpatialExtents() const;
+ LLViewerOctreeGroup* getGroup()const;
+ const LLVector4a& getPositionGroup() const;
+
+ void setBinRadius(F32 rad) {mEntry->mBinRadius = rad;}
+ void setSpatialExtents(const LLVector3& min, const LLVector3& max);
+ void setSpatialExtents(const LLVector4a& min, const LLVector4a& max);
+ void setPositionGroup(const LLVector4a& pos);
+
+ virtual void setGroup(LLViewerOctreeGroup* group);
+ void shift(const LLVector4a &shift_vector);
+
+ U32 getVisible() const {return mEntry ? mEntry->mVisible : 0;}
+ void setVisible() const;
+ void resetVisible() const;
+ virtual bool isVisible() const;
+ virtual bool isRecentlyVisible() const;
+
+ static S32 getCurrentFrame() { return sCurVisible; }
protected:
- LLVector4a& getGroupPosition() {return mEntry->mPositionGroup;}
- void initVisible(U32 visible) {mEntry->mVisible = visible;}
+ LLVector4a& getGroupPosition() {return mEntry->mPositionGroup;}
+ void initVisible(U32 visible) {mEntry->mVisible = visible;}
- static void incrementVisible() {sCurVisible++;}
+ static void incrementVisible() {sCurVisible++;}
protected:
- LLPointer<LLViewerOctreeEntry> mEntry;
- LLViewerOctreeEntry::eEntryDataType_t mDataType;
- static U32 sCurVisible; // Counter for what value of mVisible means currently visible
+ LLPointer<LLViewerOctreeEntry> mEntry;
+ LLViewerOctreeEntry::eEntryDataType_t mDataType;
+ static U32 sCurVisible; // Counter for what value of mVisible means currently visible
};//LL_ALIGN_POSTFIX(16);
//defines an octree group for an octree node, which contains multiple entries.
//LL_ALIGN_PREFIX(16)
class LLViewerOctreeGroup
-: public OctreeListener
+: public OctreeListener
{
LL_ALIGN_NEW
- friend class LLViewerOctreeCull;
+ friend class LLViewerOctreeCull;
protected:
- virtual ~LLViewerOctreeGroup();
-
-public:
- enum
- {
- CLEAN = 0x00000000,
- DIRTY = 0x00000001,
- OBJECT_DIRTY = 0x00000002,
- SKIP_FRUSTUM_CHECK = 0x00000004,
- DEAD = 0x00000008,
- INVALID_STATE = 0x00000010,
- };
+ virtual ~LLViewerOctreeGroup();
public:
- typedef OctreeNode::element_iter element_iter;
- typedef OctreeNode::element_list element_list;
-
- LLViewerOctreeGroup(OctreeNode* node);
- LLViewerOctreeGroup(const LLViewerOctreeGroup& rhs)
- {
- *this = rhs;
- }
-
- bool removeFromGroup(LLViewerOctreeEntryData* data);
- bool removeFromGroup(LLViewerOctreeEntry* entry);
-
- virtual void unbound();
- virtual void rebound();
-
- BOOL isDead() { return hasState(DEAD); }
-
- void setVisible();
- BOOL isVisible() const;
- virtual BOOL isRecentlyVisible() const;
- S32 getVisible(LLViewerCamera::eCameraID id) const {return mVisible[id];}
- S32 getAnyVisible() const {return mAnyVisible;}
- bool isEmpty() const { return mOctreeNode->isEmpty(); }
-
- U32 getState() {return mState; }
- bool isDirty() const {return mState & DIRTY;}
- bool hasState(U32 state) const {return mState & state;}
- void setState(U32 state) {mState |= state;}
- void clearState(U32 state) {mState &= ~state;}
-
- //LISTENER FUNCTIONS
- virtual void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* obj);
- virtual void handleRemoval(const TreeNode* node, LLViewerOctreeEntry* obj);
- virtual void handleDestruction(const TreeNode* node);
- virtual void handleStateChange(const TreeNode* node);
- virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
- virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child);
-
- OctreeNode* getOctreeNode() {return mOctreeNode;}
- LLViewerOctreeGroup* getParent();
-
- const LLVector4a* getBounds() const {return mBounds;}
- const LLVector4a* getExtents() const {return mExtents;}
- const LLVector4a* getObjectBounds() const {return mObjectBounds;}
- const LLVector4a* getObjectExtents() const {return mObjectExtents;}
-
- //octree wrappers to make code more readable
- element_iter getDataBegin() { return mOctreeNode->getDataBegin(); }
- element_iter getDataEnd() { return mOctreeNode->getDataEnd(); }
- U32 getElementCount() const { return mOctreeNode->getElementCount(); }
- bool hasElement(LLViewerOctreeEntryData* data);
-
+ enum
+ {
+ CLEAN = 0x00000000,
+ DIRTY = 0x00000001,
+ OBJECT_DIRTY = 0x00000002,
+ SKIP_FRUSTUM_CHECK = 0x00000004,
+ DEAD = 0x00000008,
+ INVALID_STATE = 0x00000010,
+ };
+
+public:
+ typedef OctreeNode::element_iter element_iter;
+ typedef OctreeNode::element_list element_list;
+
+ LLViewerOctreeGroup(OctreeNode* node);
+ LLViewerOctreeGroup(const LLViewerOctreeGroup& rhs)
+ {
+ *this = rhs;
+ }
+
+ bool removeFromGroup(LLViewerOctreeEntryData* data);
+ bool removeFromGroup(LLViewerOctreeEntry* entry);
+
+ virtual void unbound();
+ virtual void rebound();
+
+ BOOL isDead() { return hasState(DEAD); }
+
+ void setVisible();
+ BOOL isVisible() const;
+ virtual BOOL isRecentlyVisible() const;
+ S32 getVisible(LLViewerCamera::eCameraID id) const {return mVisible[id];}
+ S32 getAnyVisible() const {return mAnyVisible;}
+ bool isEmpty() const { return mOctreeNode->isEmpty(); }
+
+ U32 getState() {return mState; }
+ bool isDirty() const {return mState & DIRTY;}
+ bool hasState(U32 state) const {return mState & state;}
+ void setState(U32 state) {mState |= state;}
+ void clearState(U32 state) {mState &= ~state;}
+
+ //LISTENER FUNCTIONS
+ virtual void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* obj);
+ virtual void handleRemoval(const TreeNode* node, LLViewerOctreeEntry* obj);
+ virtual void handleDestruction(const TreeNode* node);
+ virtual void handleStateChange(const TreeNode* node);
+ virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
+ virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child);
+
+ OctreeNode* getOctreeNode() {return mOctreeNode;}
+ LLViewerOctreeGroup* getParent();
+
+ const LLVector4a* getBounds() const {return mBounds;}
+ const LLVector4a* getExtents() const {return mExtents;}
+ const LLVector4a* getObjectBounds() const {return mObjectBounds;}
+ const LLVector4a* getObjectExtents() const {return mObjectExtents;}
+
+ //octree wrappers to make code more readable
+ element_iter getDataBegin() { return mOctreeNode->getDataBegin(); }
+ element_iter getDataEnd() { return mOctreeNode->getDataEnd(); }
+ U32 getElementCount() const { return mOctreeNode->getElementCount(); }
+ bool hasElement(LLViewerOctreeEntryData* data);
+
protected:
- void checkStates();
+ void checkStates();
private:
- virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut);
+ virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut);
protected:
- U32 mState;
- OctreeNode* mOctreeNode;
+ U32 mState;
+ OctreeNode* mOctreeNode;
- LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects)
- LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node
- LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children
- LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node
+ LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects)
+ LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node
+ LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children
+ LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node
- S32 mAnyVisible; //latest visible to any camera
- S32 mVisible[LLViewerCamera::NUM_CAMERAS];
+ S32 mAnyVisible; //latest visible to any camera
+ S32 mVisible[LLViewerCamera::NUM_CAMERAS];
};//LL_ALIGN_POSTFIX(16);
@@ -274,152 +274,152 @@ protected:
class LLOcclusionCullingGroup : public LLViewerOctreeGroup
{
public:
- typedef enum
- {
- OCCLUDED = 0x00010000,
- QUERY_PENDING = 0x00020000,
- ACTIVE_OCCLUSION = 0x00040000,
- DISCARD_QUERY = 0x00080000,
- EARLY_FAIL = 0x00100000,
- } eOcclusionState;
-
- typedef enum
- {
- STATE_MODE_SINGLE = 0, //set one node
- STATE_MODE_BRANCH, //set entire branch
- STATE_MODE_DIFF, //set entire branch as long as current state is different
- STATE_MODE_ALL_CAMERAS, //used for occlusion state, set state for all cameras
- } eSetStateMode;
+ typedef enum
+ {
+ OCCLUDED = 0x00010000,
+ QUERY_PENDING = 0x00020000,
+ ACTIVE_OCCLUSION = 0x00040000,
+ DISCARD_QUERY = 0x00080000,
+ EARLY_FAIL = 0x00100000,
+ } eOcclusionState;
+
+ typedef enum
+ {
+ STATE_MODE_SINGLE = 0, //set one node
+ STATE_MODE_BRANCH, //set entire branch
+ STATE_MODE_DIFF, //set entire branch as long as current state is different
+ STATE_MODE_ALL_CAMERAS, //used for occlusion state, set state for all cameras
+ } eSetStateMode;
protected:
- virtual ~LLOcclusionCullingGroup();
+ virtual ~LLOcclusionCullingGroup();
public:
- LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part);
- LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLViewerOctreeGroup(rhs)
- {
- *this = rhs;
- }
+ LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part);
+ LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLViewerOctreeGroup(rhs)
+ {
+ *this = rhs;
+ }
- void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE);
- void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE);
- void checkOcclusion(); //read back last occlusion query (if any)
- void doOcclusion(LLCamera* camera, const LLVector4a* shift = NULL); //issue occlusion query
- BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; }
- U32 getOcclusionState() const { return mOcclusionState[LLViewerCamera::sCurCameraID];}
+ void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE);
+ void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE);
+ void checkOcclusion(); //read back last occlusion query (if any)
+ void doOcclusion(LLCamera* camera, const LLVector4a* shift = NULL); //issue occlusion query
+ BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; }
+ U32 getOcclusionState() const { return mOcclusionState[LLViewerCamera::sCurCameraID];}
- BOOL needsUpdate();
- U32 getLastOcclusionIssuedTime();
+ BOOL needsUpdate();
+ U32 getLastOcclusionIssuedTime();
- //virtual
- void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
+ //virtual
+ void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
- //virtual
- BOOL isRecentlyVisible() const;
- LLViewerOctreePartition* getSpatialPartition()const {return mSpatialPartition;}
- BOOL isAnyRecentlyVisible() const;
+ //virtual
+ BOOL isRecentlyVisible() const;
+ LLViewerOctreePartition* getSpatialPartition()const {return mSpatialPartition;}
+ BOOL isAnyRecentlyVisible() const;
- static U32 getNewOcclusionQueryObjectName();
- static void releaseOcclusionQueryObjectName(U32 name);
+ static U32 getNewOcclusionQueryObjectName();
+ static void releaseOcclusionQueryObjectName(U32 name);
protected:
- void releaseOcclusionQueryObjectNames();
+ void releaseOcclusionQueryObjectNames();
-private:
- BOOL earlyFail(LLCamera* camera, const LLVector4a* bounds);
+private:
+ BOOL earlyFail(LLCamera* camera, const LLVector4a* bounds);
protected:
- U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS];
- U32 mOcclusionIssued[LLViewerCamera::NUM_CAMERAS];
+ U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS];
+ U32 mOcclusionIssued[LLViewerCamera::NUM_CAMERAS];
- S32 mLODHash;
+ S32 mLODHash;
- LLViewerOctreePartition* mSpatialPartition;
- U32 mOcclusionQuery[LLViewerCamera::NUM_CAMERAS];
+ LLViewerOctreePartition* mSpatialPartition;
+ U32 mOcclusionQuery[LLViewerCamera::NUM_CAMERAS];
U32 mOcclusionCheckCount[LLViewerCamera::NUM_CAMERAS];
-public:
- static std::set<U32> sPendingQueries;
+public:
+ static std::set<U32> sPendingQueries;
};//LL_ALIGN_POSTFIX(16);
class LLViewerOctreePartition
{
public:
- LLViewerOctreePartition();
- virtual ~LLViewerOctreePartition();
+ LLViewerOctreePartition();
+ virtual ~LLViewerOctreePartition();
- // Cull on arbitrary frustum
- virtual S32 cull(LLCamera &camera, bool do_occlusion) = 0;
- BOOL isOcclusionEnabled();
+ // Cull on arbitrary frustum
+ virtual S32 cull(LLCamera &camera, bool do_occlusion) = 0;
+ BOOL isOcclusionEnabled();
protected:
// MUST call from destructor of any derived classes (SL-17276)
void cleanup();
-public:
- U32 mPartitionType;
- U32 mDrawableType;
- OctreeNode* mOctree;
- LLViewerRegion* mRegionp; // the region this partition belongs to.
- BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed
- U32 mLODSeed;
- U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed)
+public:
+ U32 mPartitionType;
+ U32 mDrawableType;
+ OctreeNode* mOctree;
+ LLViewerRegion* mRegionp; // the region this partition belongs to.
+ BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed
+ U32 mLODSeed;
+ U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed)
};
class LLViewerOctreeCull : public OctreeTraveler
{
public:
- LLViewerOctreeCull(LLCamera* camera)
- : mCamera(camera), mRes(0) { }
-
- virtual void traverse(const OctreeNode* n);
+ LLViewerOctreeCull(LLCamera* camera)
+ : mCamera(camera), mRes(0) { }
+
+ virtual void traverse(const OctreeNode* n);
protected:
- virtual bool earlyFail(LLViewerOctreeGroup* group);
-
- //agent space group cull
- S32 AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group);
- S32 AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group);
- S32 AABBInFrustumGroupBounds(const LLViewerOctreeGroup* group);
-
- //agent space object set cull
- S32 AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group);
- S32 AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group);
- S32 AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group);
-
- //local region space group cull
- S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group);
- S32 AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group);
- S32 AABBRegionSphereIntersectGroupExtents(const LLViewerOctreeGroup* group, const LLVector3& shift);
-
- //local region space object set cull
- S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group);
- S32 AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group);
- S32 AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift);
-
- virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0;
- virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0;
-
- bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius);
- virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group);
- virtual void preprocess(LLViewerOctreeGroup* group);
- virtual void processGroup(LLViewerOctreeGroup* group);
- virtual void visit(const OctreeNode* branch);
-
+ virtual bool earlyFail(LLViewerOctreeGroup* group);
+
+ //agent space group cull
+ S32 AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group);
+ S32 AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group);
+ S32 AABBInFrustumGroupBounds(const LLViewerOctreeGroup* group);
+
+ //agent space object set cull
+ S32 AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group);
+ S32 AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group);
+ S32 AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group);
+
+ //local region space group cull
+ S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group);
+ S32 AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group);
+ S32 AABBRegionSphereIntersectGroupExtents(const LLViewerOctreeGroup* group, const LLVector3& shift);
+
+ //local region space object set cull
+ S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group);
+ S32 AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group);
+ S32 AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift);
+
+ virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0;
+ virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0;
+
+ bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius);
+ virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group);
+ virtual void preprocess(LLViewerOctreeGroup* group);
+ virtual void processGroup(LLViewerOctreeGroup* group);
+ virtual void visit(const OctreeNode* branch);
+
protected:
- LLCamera *mCamera;
- S32 mRes;
+ LLCamera *mCamera;
+ S32 mRes;
};
//scan the octree, output the info of each node for debug use.
class LLViewerOctreeDebug : public OctreeTraveler
{
public:
- virtual void processGroup(LLViewerOctreeGroup* group);
- virtual void visit(const OctreeNode* branch);
+ virtual void processGroup(LLViewerOctreeGroup* group);
+ virtual void visit(const OctreeNode* branch);
public:
- static BOOL sInDebug;
+ static BOOL sInDebug;
};
#endif
diff --git a/indra/newview/llviewerparcelaskplay.cpp b/indra/newview/llviewerparcelaskplay.cpp
index aea06834b2..18257015ec 100644
--- a/indra/newview/llviewerparcelaskplay.cpp
+++ b/indra/newview/llviewerparcelaskplay.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -280,7 +280,7 @@ void LLViewerParcelAskPlay::saveSettings()
}
key = iter_region->first.asString();
write_llsd[key] = LLSD();
-
+
for (parcel_data_map_t::iterator iter_parcel = iter_region->second.begin();
iter_parcel != iter_region->second.end(); ++iter_parcel)
{
@@ -294,7 +294,7 @@ void LLViewerParcelAskPlay::saveSettings()
}
}
}
-
+
llofstream file;
file.open(getAskPlayFilename().c_str());
if (file.is_open())
diff --git a/indra/newview/llviewerparcelaskplay.h b/indra/newview/llviewerparcelaskplay.h
index 56faddae66..720daa2e5d 100644
--- a/indra/newview/llviewerparcelaskplay.h
+++ b/indra/newview/llviewerparcelaskplay.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp
index 83b05e6b4d..bc9c2c7128 100644
--- a/indra/newview/llviewerparcelmedia.cpp
+++ b/indra/newview/llviewerparcelmedia.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,9 +49,9 @@
LLViewerParcelMedia::LLViewerParcelMedia():
mMediaParcelLocalID(0)
{
- LLMessageSystem* msg = gMessageSystem;
- msg->setHandlerFunc("ParcelMediaCommandMessage", parcelMediaCommandMessageHandler );
- msg->setHandlerFunc("ParcelMediaUpdate", parcelMediaUpdateHandler );
+ LLMessageSystem* msg = gMessageSystem;
+ msg->setHandlerFunc("ParcelMediaCommandMessage", parcelMediaCommandMessageHandler );
+ msg->setHandlerFunc("ParcelMediaUpdate", parcelMediaUpdateHandler );
// LLViewerParcelMediaAutoPlay will regularly check and autoplay media,
// might be good idea to just integrate it into LLViewerParcelMedia
@@ -60,259 +60,259 @@ mMediaParcelLocalID(0)
LLViewerParcelMedia::~LLViewerParcelMedia()
{
- // This needs to be destroyed before global destructor time.
- mMediaImpl = NULL;
+ // This needs to be destroyed before global destructor time.
+ mMediaImpl = NULL;
}
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerParcelMedia::update(LLParcel* parcel)
{
- if (/*LLViewerMedia::hasMedia()*/ true)
- {
- // we have a player
- if (parcel)
- {
- if(!gAgent.getRegion())
- {
- mMediaRegionID = LLUUID() ;
- stop() ;
- LL_DEBUGS("Media") << "no agent region, bailing out." << LL_ENDL;
- return ;
- }
-
- // we're in a parcel
- S32 parcelid = parcel->getLocalID();
-
- LLUUID regionid = gAgent.getRegion()->getRegionID();
- bool location_changed = false;
- if (parcelid != mMediaParcelLocalID || regionid != mMediaRegionID)
- {
- LL_DEBUGS("Media") << "New parcel, parcel id = " << parcelid << ", region id = " << regionid << LL_ENDL;
- mMediaParcelLocalID = parcelid;
- mMediaRegionID = regionid;
- location_changed = true;
- }
-
- std::string mediaUrl = std::string ( parcel->getMediaURL () );
- std::string mediaCurrentUrl = std::string( parcel->getMediaCurrentURL());
-
- // if we have a current (link sharing) url, use it instead
- if (mediaCurrentUrl != "" && parcel->getMediaType() == HTTP_CONTENT_TEXT_HTML)
- {
- mediaUrl = mediaCurrentUrl;
- }
-
- LLStringUtil::trim(mediaUrl);
-
- // If no parcel media is playing, nothing left to do
- if(mMediaImpl.isNull())
-
- {
- // media will be autoplayed by LLViewerParcelMediaAutoPlay
- return;
- }
-
- // Media is playing...has something changed?
- else if (( mMediaImpl->getMediaURL() != mediaUrl )
- || ( mMediaImpl->getMediaTextureID() != parcel->getMediaID() )
- || ( mMediaImpl->getMimeType() != parcel->getMediaType() ))
- {
- // Only play if the media types are the same and parcel stays same.
- if(mMediaImpl->getMimeType() == parcel->getMediaType()
- && !location_changed)
- {
- play(parcel);
- }
-
- else
- {
- stop();
- }
- }
- }
- else
- {
- stop();
- }
- }
+ if (/*LLViewerMedia::hasMedia()*/ true)
+ {
+ // we have a player
+ if (parcel)
+ {
+ if(!gAgent.getRegion())
+ {
+ mMediaRegionID = LLUUID() ;
+ stop() ;
+ LL_DEBUGS("Media") << "no agent region, bailing out." << LL_ENDL;
+ return ;
+ }
+
+ // we're in a parcel
+ S32 parcelid = parcel->getLocalID();
+
+ LLUUID regionid = gAgent.getRegion()->getRegionID();
+ bool location_changed = false;
+ if (parcelid != mMediaParcelLocalID || regionid != mMediaRegionID)
+ {
+ LL_DEBUGS("Media") << "New parcel, parcel id = " << parcelid << ", region id = " << regionid << LL_ENDL;
+ mMediaParcelLocalID = parcelid;
+ mMediaRegionID = regionid;
+ location_changed = true;
+ }
+
+ std::string mediaUrl = std::string ( parcel->getMediaURL () );
+ std::string mediaCurrentUrl = std::string( parcel->getMediaCurrentURL());
+
+ // if we have a current (link sharing) url, use it instead
+ if (mediaCurrentUrl != "" && parcel->getMediaType() == HTTP_CONTENT_TEXT_HTML)
+ {
+ mediaUrl = mediaCurrentUrl;
+ }
+
+ LLStringUtil::trim(mediaUrl);
+
+ // If no parcel media is playing, nothing left to do
+ if(mMediaImpl.isNull())
+
+ {
+ // media will be autoplayed by LLViewerParcelMediaAutoPlay
+ return;
+ }
+
+ // Media is playing...has something changed?
+ else if (( mMediaImpl->getMediaURL() != mediaUrl )
+ || ( mMediaImpl->getMediaTextureID() != parcel->getMediaID() )
+ || ( mMediaImpl->getMimeType() != parcel->getMediaType() ))
+ {
+ // Only play if the media types are the same and parcel stays same.
+ if(mMediaImpl->getMimeType() == parcel->getMediaType()
+ && !location_changed)
+ {
+ play(parcel);
+ }
+
+ else
+ {
+ stop();
+ }
+ }
+ }
+ else
+ {
+ stop();
+ }
+ }
}
// static
void LLViewerParcelMedia::play(LLParcel* parcel)
{
- LL_DEBUGS() << "LLViewerParcelMedia::play" << LL_ENDL;
-
- if (!parcel) return;
-
- if (!gSavedSettings.getBOOL("AudioStreamingMedia"))
- return;
-
- std::string media_url = parcel->getMediaURL();
- std::string media_current_url = parcel->getMediaCurrentURL();
- std::string mime_type = parcel->getMediaType();
- LLUUID placeholder_texture_id = parcel->getMediaID();
- U8 media_auto_scale = parcel->getMediaAutoScale();
- U8 media_loop = parcel->getMediaLoop();
- S32 media_width = parcel->getMediaWidth();
- S32 media_height = parcel->getMediaHeight();
-
- if(mMediaImpl)
- {
- // If the url and mime type are the same, call play again
- if(mMediaImpl->getMediaURL() == media_url
- && mMediaImpl->getMimeType() == mime_type
- && mMediaImpl->getMediaTextureID() == placeholder_texture_id)
- {
- LL_DEBUGS("Media") << "playing with existing url " << media_url << LL_ENDL;
-
- mMediaImpl->play();
- }
- // Else if the texture id's are the same, navigate and rediscover type
- // MBW -- This causes other state from the previous parcel (texture size, autoscale, and looping) to get re-used incorrectly.
- // It's also not really necessary -- just creating a new instance is fine.
-// else if(mMediaImpl->getMediaTextureID() == placeholder_texture_id)
-// {
-// mMediaImpl->navigateTo(media_url, mime_type, true);
-// }
- else
- {
- // Since the texture id is different, we need to generate a new impl
-
- // Delete the old one first so they don't fight over the texture.
- mMediaImpl = NULL;
-
- // A new impl will be created below.
- }
- }
-
- // Don't ever try to play if the media type is set to "none/none"
- if(stricmp(mime_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0)
- {
- if(!mMediaImpl)
- {
- LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL;
-
- // There is no media impl, make a new one
- mMediaImpl = LLViewerMedia::getInstance()->newMediaImpl(
- placeholder_texture_id,
- media_width,
- media_height,
- media_auto_scale,
- media_loop);
- mMediaImpl->setIsParcelMedia(true);
- mMediaImpl->navigateTo(media_url, mime_type, true);
- }
-
- //LLFirstUse::useMedia();
-
- LLViewerParcelMediaAutoPlay::playStarted();
- }
+ LL_DEBUGS() << "LLViewerParcelMedia::play" << LL_ENDL;
+
+ if (!parcel) return;
+
+ if (!gSavedSettings.getBOOL("AudioStreamingMedia"))
+ return;
+
+ std::string media_url = parcel->getMediaURL();
+ std::string media_current_url = parcel->getMediaCurrentURL();
+ std::string mime_type = parcel->getMediaType();
+ LLUUID placeholder_texture_id = parcel->getMediaID();
+ U8 media_auto_scale = parcel->getMediaAutoScale();
+ U8 media_loop = parcel->getMediaLoop();
+ S32 media_width = parcel->getMediaWidth();
+ S32 media_height = parcel->getMediaHeight();
+
+ if(mMediaImpl)
+ {
+ // If the url and mime type are the same, call play again
+ if(mMediaImpl->getMediaURL() == media_url
+ && mMediaImpl->getMimeType() == mime_type
+ && mMediaImpl->getMediaTextureID() == placeholder_texture_id)
+ {
+ LL_DEBUGS("Media") << "playing with existing url " << media_url << LL_ENDL;
+
+ mMediaImpl->play();
+ }
+ // Else if the texture id's are the same, navigate and rediscover type
+ // MBW -- This causes other state from the previous parcel (texture size, autoscale, and looping) to get re-used incorrectly.
+ // It's also not really necessary -- just creating a new instance is fine.
+// else if(mMediaImpl->getMediaTextureID() == placeholder_texture_id)
+// {
+// mMediaImpl->navigateTo(media_url, mime_type, true);
+// }
+ else
+ {
+ // Since the texture id is different, we need to generate a new impl
+
+ // Delete the old one first so they don't fight over the texture.
+ mMediaImpl = NULL;
+
+ // A new impl will be created below.
+ }
+ }
+
+ // Don't ever try to play if the media type is set to "none/none"
+ if(stricmp(mime_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0)
+ {
+ if(!mMediaImpl)
+ {
+ LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL;
+
+ // There is no media impl, make a new one
+ mMediaImpl = LLViewerMedia::getInstance()->newMediaImpl(
+ placeholder_texture_id,
+ media_width,
+ media_height,
+ media_auto_scale,
+ media_loop);
+ mMediaImpl->setIsParcelMedia(true);
+ mMediaImpl->navigateTo(media_url, mime_type, true);
+ }
+
+ //LLFirstUse::useMedia();
+
+ LLViewerParcelMediaAutoPlay::playStarted();
+ }
}
// static
void LLViewerParcelMedia::stop()
{
- if(mMediaImpl.isNull())
- {
- return;
- }
-
- // We need to remove the media HUD if it is up.
- LLViewerMediaFocus::getInstance()->clearFocus();
-
- // This will unload & kill the media instance.
- mMediaImpl = NULL;
+ if(mMediaImpl.isNull())
+ {
+ return;
+ }
+
+ // We need to remove the media HUD if it is up.
+ LLViewerMediaFocus::getInstance()->clearFocus();
+
+ // This will unload & kill the media instance.
+ mMediaImpl = NULL;
}
// static
void LLViewerParcelMedia::pause()
{
- if(mMediaImpl.isNull())
- {
- return;
- }
- mMediaImpl->pause();
+ if(mMediaImpl.isNull())
+ {
+ return;
+ }
+ mMediaImpl->pause();
}
// static
void LLViewerParcelMedia::start()
{
- if(mMediaImpl.isNull())
- {
- return;
- }
- mMediaImpl->start();
+ if(mMediaImpl.isNull())
+ {
+ return;
+ }
+ mMediaImpl->start();
- //LLFirstUse::useMedia();
+ //LLFirstUse::useMedia();
- LLViewerParcelMediaAutoPlay::playStarted();
+ LLViewerParcelMediaAutoPlay::playStarted();
}
// static
void LLViewerParcelMedia::seek(F32 time)
{
- if(mMediaImpl.isNull())
- {
- return;
- }
- mMediaImpl->seek(time);
+ if(mMediaImpl.isNull())
+ {
+ return;
+ }
+ mMediaImpl->seek(time);
}
// static
void LLViewerParcelMedia::focus(bool focus)
{
- mMediaImpl->focus(focus);
+ mMediaImpl->focus(focus);
}
// static
LLPluginClassMediaOwner::EMediaStatus LLViewerParcelMedia::getStatus()
-{
- LLPluginClassMediaOwner::EMediaStatus result = LLPluginClassMediaOwner::MEDIA_NONE;
-
- if(mMediaImpl.notNull() && mMediaImpl->hasMedia())
- {
- result = mMediaImpl->getMediaPlugin()->getStatus();
- }
-
- return result;
+{
+ LLPluginClassMediaOwner::EMediaStatus result = LLPluginClassMediaOwner::MEDIA_NONE;
+
+ if(mMediaImpl.notNull() && mMediaImpl->hasMedia())
+ {
+ result = mMediaImpl->getMediaPlugin()->getStatus();
+ }
+
+ return result;
}
// static
std::string LLViewerParcelMedia::getMimeType()
{
- return mMediaImpl.notNull() ? mMediaImpl->getMimeType() : LLMIMETypes::getDefaultMimeType();
+ return mMediaImpl.notNull() ? mMediaImpl->getMimeType() : LLMIMETypes::getDefaultMimeType();
}
-//static
+//static
std::string LLViewerParcelMedia::getURL()
{
- std::string url;
- if(mMediaImpl.notNull())
- url = mMediaImpl->getMediaURL();
-
- if(stricmp(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaType().c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0)
- {
- if (url.empty())
- url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaCurrentURL();
-
- if (url.empty())
- url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaURL();
- }
-
- return url;
+ std::string url;
+ if(mMediaImpl.notNull())
+ url = mMediaImpl->getMediaURL();
+
+ if(stricmp(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaType().c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0)
+ {
+ if (url.empty())
+ url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaCurrentURL();
+
+ if (url.empty())
+ url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaURL();
+ }
+
+ return url;
}
-//static
+//static
std::string LLViewerParcelMedia::getName()
{
- if(mMediaImpl.notNull())
- return mMediaImpl->getName();
- return "";
+ if(mMediaImpl.notNull())
+ return mMediaImpl->getName();
+ return "";
}
viewer_media_t LLViewerParcelMedia::getParcelMedia()
{
- return mMediaImpl;
+ return mMediaImpl;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -324,66 +324,66 @@ void LLViewerParcelMedia::parcelMediaCommandMessageHandler(LLMessageSystem *msg,
void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg)
{
- // extract the agent id
- // LLUUID agent_id;
- // msg->getUUID( agent_id );
-
- U32 flags;
- U32 command;
- F32 time;
- msg->getU32( "CommandBlock", "Flags", flags );
- msg->getU32( "CommandBlock", "Command", command);
- msg->getF32( "CommandBlock", "Time", time );
-
- if (flags &( (1<<PARCEL_MEDIA_COMMAND_STOP)
- | (1<<PARCEL_MEDIA_COMMAND_PAUSE)
- | (1<<PARCEL_MEDIA_COMMAND_PLAY)
- | (1<<PARCEL_MEDIA_COMMAND_LOOP)
- | (1<<PARCEL_MEDIA_COMMAND_UNLOAD) ))
- {
- // stop
- if( command == PARCEL_MEDIA_COMMAND_STOP )
- {
- stop();
- }
- else
- // pause
- if( command == PARCEL_MEDIA_COMMAND_PAUSE )
- {
- pause();
- }
- else
- // play
- if(( command == PARCEL_MEDIA_COMMAND_PLAY ) ||
- ( command == PARCEL_MEDIA_COMMAND_LOOP ))
- {
- if (getStatus() == LLViewerMediaImpl::MEDIA_PAUSED)
- {
- start();
- }
- else
- {
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- play(parcel);
- }
- }
- else
- // unload
- if( command == PARCEL_MEDIA_COMMAND_UNLOAD )
- {
- stop();
- }
- }
-
- if (flags & (1<<PARCEL_MEDIA_COMMAND_TIME))
- {
- if(mMediaImpl.isNull())
- {
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- play(parcel);
- }
- seek(time);
- }
+ // extract the agent id
+ // LLUUID agent_id;
+ // msg->getUUID( agent_id );
+
+ U32 flags;
+ U32 command;
+ F32 time;
+ msg->getU32( "CommandBlock", "Flags", flags );
+ msg->getU32( "CommandBlock", "Command", command);
+ msg->getF32( "CommandBlock", "Time", time );
+
+ if (flags &( (1<<PARCEL_MEDIA_COMMAND_STOP)
+ | (1<<PARCEL_MEDIA_COMMAND_PAUSE)
+ | (1<<PARCEL_MEDIA_COMMAND_PLAY)
+ | (1<<PARCEL_MEDIA_COMMAND_LOOP)
+ | (1<<PARCEL_MEDIA_COMMAND_UNLOAD) ))
+ {
+ // stop
+ if( command == PARCEL_MEDIA_COMMAND_STOP )
+ {
+ stop();
+ }
+ else
+ // pause
+ if( command == PARCEL_MEDIA_COMMAND_PAUSE )
+ {
+ pause();
+ }
+ else
+ // play
+ if(( command == PARCEL_MEDIA_COMMAND_PLAY ) ||
+ ( command == PARCEL_MEDIA_COMMAND_LOOP ))
+ {
+ if (getStatus() == LLViewerMediaImpl::MEDIA_PAUSED)
+ {
+ start();
+ }
+ else
+ {
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ play(parcel);
+ }
+ }
+ else
+ // unload
+ if( command == PARCEL_MEDIA_COMMAND_UNLOAD )
+ {
+ stop();
+ }
+ }
+
+ if (flags & (1<<PARCEL_MEDIA_COMMAND_TIME))
+ {
+ if(mMediaImpl.isNull())
+ {
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ play(parcel);
+ }
+ seek(time);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -395,235 +395,235 @@ void LLViewerParcelMedia::parcelMediaUpdateHandler(LLMessageSystem *msg, void **
void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg)
{
- LLUUID media_id;
- std::string media_url;
- std::string media_type;
- S32 media_width = 0;
- S32 media_height = 0;
- U8 media_auto_scale = FALSE;
- U8 media_loop = FALSE;
-
- msg->getUUID( "DataBlock", "MediaID", media_id );
- char media_url_buffer[257];
- msg->getString( "DataBlock", "MediaURL", 255, media_url_buffer );
- media_url = media_url_buffer;
- msg->getU8("DataBlock", "MediaAutoScale", media_auto_scale);
-
- if (msg->has("DataBlockExtended")) // do we have the extended data?
- {
- char media_type_buffer[257];
- msg->getString("DataBlockExtended", "MediaType", 255, media_type_buffer);
- media_type = media_type_buffer;
- msg->getU8("DataBlockExtended", "MediaLoop", media_loop);
- msg->getS32("DataBlockExtended", "MediaWidth", media_width);
- msg->getS32("DataBlockExtended", "MediaHeight", media_height);
- }
-
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- BOOL same = FALSE;
- if (parcel)
- {
- same = ((parcel->getMediaURL() == media_url) &&
- (parcel->getMediaType() == media_type) &&
- (parcel->getMediaID() == media_id) &&
- (parcel->getMediaWidth() == media_width) &&
- (parcel->getMediaHeight() == media_height) &&
- (parcel->getMediaAutoScale() == media_auto_scale) &&
- (parcel->getMediaLoop() == media_loop));
-
- if (!same)
- {
- // temporarily store these new values in the parcel
- parcel->setMediaURL(media_url);
- parcel->setMediaType(media_type);
- parcel->setMediaID(media_id);
- parcel->setMediaWidth(media_width);
- parcel->setMediaHeight(media_height);
- parcel->setMediaAutoScale(media_auto_scale);
- parcel->setMediaLoop(media_loop);
-
- play(parcel);
- }
- }
+ LLUUID media_id;
+ std::string media_url;
+ std::string media_type;
+ S32 media_width = 0;
+ S32 media_height = 0;
+ U8 media_auto_scale = FALSE;
+ U8 media_loop = FALSE;
+
+ msg->getUUID( "DataBlock", "MediaID", media_id );
+ char media_url_buffer[257];
+ msg->getString( "DataBlock", "MediaURL", 255, media_url_buffer );
+ media_url = media_url_buffer;
+ msg->getU8("DataBlock", "MediaAutoScale", media_auto_scale);
+
+ if (msg->has("DataBlockExtended")) // do we have the extended data?
+ {
+ char media_type_buffer[257];
+ msg->getString("DataBlockExtended", "MediaType", 255, media_type_buffer);
+ media_type = media_type_buffer;
+ msg->getU8("DataBlockExtended", "MediaLoop", media_loop);
+ msg->getS32("DataBlockExtended", "MediaWidth", media_width);
+ msg->getS32("DataBlockExtended", "MediaHeight", media_height);
+ }
+
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ BOOL same = FALSE;
+ if (parcel)
+ {
+ same = ((parcel->getMediaURL() == media_url) &&
+ (parcel->getMediaType() == media_type) &&
+ (parcel->getMediaID() == media_id) &&
+ (parcel->getMediaWidth() == media_width) &&
+ (parcel->getMediaHeight() == media_height) &&
+ (parcel->getMediaAutoScale() == media_auto_scale) &&
+ (parcel->getMediaLoop() == media_loop));
+
+ if (!same)
+ {
+ // temporarily store these new values in the parcel
+ parcel->setMediaURL(media_url);
+ parcel->setMediaType(media_type);
+ parcel->setMediaID(media_id);
+ parcel->setMediaWidth(media_width);
+ parcel->setMediaHeight(media_height);
+ parcel->setMediaAutoScale(media_auto_scale);
+ parcel->setMediaLoop(media_loop);
+
+ play(parcel);
+ }
+ }
}
// Static
/////////////////////////////////////////////////////////////////////////////////////////
// *TODO: I can not find any active code where this method is called...
void LLViewerParcelMedia::sendMediaNavigateMessage(const std::string& url)
{
- std::string region_url = gAgent.getRegionCapability("ParcelNavigateMedia");
- if (!region_url.empty())
- {
- // send navigate event to sim for link sharing
- LLSD body;
- body["agent-id"] = gAgent.getID();
- body["local-id"] = LLViewerParcelMgr::getInstance()->getAgentParcel()->getLocalID();
- body["url"] = url;
+ std::string region_url = gAgent.getRegionCapability("ParcelNavigateMedia");
+ if (!region_url.empty())
+ {
+ // send navigate event to sim for link sharing
+ LLSD body;
+ body["agent-id"] = gAgent.getID();
+ body["local-id"] = LLViewerParcelMgr::getInstance()->getAgentParcel()->getLocalID();
+ body["url"] = url;
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(region_url, body,
"Media Navigation sent to sim.", "Media Navigation failed to send to sim.");
- }
- else
- {
- LL_WARNS() << "can't get ParcelNavigateMedia capability" << LL_ENDL;
- }
+ }
+ else
+ {
+ LL_WARNS() << "can't get ParcelNavigateMedia capability" << LL_ENDL;
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
// inherited from LLViewerMediaObserver
-// virtual
+// virtual
void LLViewerParcelMedia::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
{
- switch(event)
- {
- case MEDIA_EVENT_DEBUG_MESSAGE:
- {
- // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_DEBUG_MESSAGE " << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_CONTENT_UPDATED:
- {
- // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CONTENT_UPDATED " << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_TIME_DURATION_UPDATED:
- {
- // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_TIME_DURATION_UPDATED, time is " << self->getCurrentTime() << " of " << self->getDuration() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_SIZE_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_SIZE_CHANGED " << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_CURSOR_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CURSOR_CHANGED, new cursor is " << self->getCursorName() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_NAVIGATE_BEGIN:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_BEGIN " << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_NAVIGATE_COMPLETE:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_COMPLETE, result string is: " << self->getNavigateResultString() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_PROGRESS_UPDATED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PROGRESS_UPDATED, loading at " << self->getProgressPercent() << "%" << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_STATUS_TEXT_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_STATUS_TEXT_CHANGED, new status text is: " << self->getStatusText() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_LOCATION_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LOCATION_CHANGED, new uri is: " << self->getLocation() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_NAVIGATE_ERROR_PAGE:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_ERROR_PAGE" << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_CLICK_LINK_HREF:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is " << self->getClickURL() << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_PLUGIN_FAILED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED" << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED_LAUNCH" << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_NAME_CHANGED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAME_CHANGED" << LL_ENDL;
- };
- break;
-
- case MEDIA_EVENT_CLOSE_REQUEST:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL;
- }
- break;
-
- case MEDIA_EVENT_PICK_FILE_REQUEST:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PICK_FILE_REQUEST" << LL_ENDL;
- }
- break;
-
- case MEDIA_EVENT_FILE_DOWNLOAD:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_FILE_DOWNLOAD" << LL_ENDL;
- }
- break;
-
- case MEDIA_EVENT_GEOMETRY_CHANGE:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL;
- }
- break;
-
- case MEDIA_EVENT_AUTH_REQUEST:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_AUTH_REQUEST, url " << self->getAuthURL() << ", realm " << self->getAuthRealm() << LL_ENDL;
- }
- break;
-
- case MEDIA_EVENT_LINK_HOVERED:
- {
- LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LINK_HOVERED, hover text is: " << self->getHoverText() << LL_ENDL;
- };
- break;
- };
+ switch(event)
+ {
+ case MEDIA_EVENT_DEBUG_MESSAGE:
+ {
+ // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_DEBUG_MESSAGE " << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_CONTENT_UPDATED:
+ {
+ // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CONTENT_UPDATED " << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_TIME_DURATION_UPDATED:
+ {
+ // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_TIME_DURATION_UPDATED, time is " << self->getCurrentTime() << " of " << self->getDuration() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_SIZE_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_SIZE_CHANGED " << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_CURSOR_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CURSOR_CHANGED, new cursor is " << self->getCursorName() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_NAVIGATE_BEGIN:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_BEGIN " << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_NAVIGATE_COMPLETE:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_COMPLETE, result string is: " << self->getNavigateResultString() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_PROGRESS_UPDATED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PROGRESS_UPDATED, loading at " << self->getProgressPercent() << "%" << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_STATUS_TEXT_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_STATUS_TEXT_CHANGED, new status text is: " << self->getStatusText() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_LOCATION_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LOCATION_CHANGED, new uri is: " << self->getLocation() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_NAVIGATE_ERROR_PAGE:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_ERROR_PAGE" << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_CLICK_LINK_HREF:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is " << self->getClickURL() << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_PLUGIN_FAILED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED" << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED_LAUNCH" << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_NAME_CHANGED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAME_CHANGED" << LL_ENDL;
+ };
+ break;
+
+ case MEDIA_EVENT_CLOSE_REQUEST:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL;
+ }
+ break;
+
+ case MEDIA_EVENT_PICK_FILE_REQUEST:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PICK_FILE_REQUEST" << LL_ENDL;
+ }
+ break;
+
+ case MEDIA_EVENT_FILE_DOWNLOAD:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_FILE_DOWNLOAD" << LL_ENDL;
+ }
+ break;
+
+ case MEDIA_EVENT_GEOMETRY_CHANGE:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL;
+ }
+ break;
+
+ case MEDIA_EVENT_AUTH_REQUEST:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_AUTH_REQUEST, url " << self->getAuthURL() << ", realm " << self->getAuthRealm() << LL_ENDL;
+ }
+ break;
+
+ case MEDIA_EVENT_LINK_HOVERED:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LINK_HOVERED, hover text is: " << self->getHoverText() << LL_ENDL;
+ };
+ break;
+ };
}
// TODO: observer
/*
void LLViewerParcelMediaNavigationObserver::onNavigateComplete( const EventType& event_in )
{
- std::string url = event_in.getStringValue();
+ std::string url = event_in.getStringValue();
- if (mCurrentURL != url && ! mFromMessage)
- {
- LLViewerParcelMedia::sendMediaNavigateMessage(url);
- }
+ if (mCurrentURL != url && ! mFromMessage)
+ {
+ LLViewerParcelMedia::sendMediaNavigateMessage(url);
+ }
- mCurrentURL = url;
- mFromMessage = false;
+ mCurrentURL = url;
+ mFromMessage = false;
}
*/
diff --git a/indra/newview/llviewerparcelmedia.h b/indra/newview/llviewerparcelmedia.h
index 790b2b71fc..dadcf74b3e 100644
--- a/indra/newview/llviewerparcelmedia.h
+++ b/indra/newview/llviewerparcelmedia.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,61 +39,61 @@ class LLViewerParcelMediaNavigationObserver;
// do playback. It allows us to remove code from LLViewerParcelMgr.
class LLViewerParcelMedia : public LLViewerMediaObserver, public LLSingleton<LLViewerParcelMedia>
{
- LLSINGLETON(LLViewerParcelMedia);
- ~LLViewerParcelMedia();
- LOG_CLASS(LLViewerParcelMedia);
+ LLSINGLETON(LLViewerParcelMedia);
+ ~LLViewerParcelMedia();
+ LOG_CLASS(LLViewerParcelMedia);
public:
- void update(LLParcel* parcel);
- // called when the agent's parcel has a new URL, or the agent has
- // walked on to a new parcel with media
+ void update(LLParcel* parcel);
+ // called when the agent's parcel has a new URL, or the agent has
+ // walked on to a new parcel with media
- void play(LLParcel* parcel);
- // user clicked play button in media transport controls
+ void play(LLParcel* parcel);
+ // user clicked play button in media transport controls
- void stop();
- // user clicked stop button in media transport controls
+ void stop();
+ // user clicked stop button in media transport controls
- void pause();
- void start();
- // restart after pause - no need for all the setup
+ void pause();
+ void start();
+ // restart after pause - no need for all the setup
- void focus(bool focus);
+ void focus(bool focus);
- void seek(F32 time);
- // jump to timecode time
+ void seek(F32 time);
+ // jump to timecode time
- LLPluginClassMediaOwner::EMediaStatus getStatus();
- std::string getMimeType();
- std::string getURL();
- std::string getName();
- viewer_media_t getParcelMedia();
- bool hasParcelMedia() { return mMediaImpl.notNull(); }
+ LLPluginClassMediaOwner::EMediaStatus getStatus();
+ std::string getMimeType();
+ std::string getURL();
+ std::string getName();
+ viewer_media_t getParcelMedia();
+ bool hasParcelMedia() { return mMediaImpl.notNull(); }
- static void parcelMediaCommandMessageHandler( LLMessageSystem *msg, void ** );
- static void parcelMediaUpdateHandler( LLMessageSystem *msg, void ** );
- void sendMediaNavigateMessage(const std::string& url);
+ static void parcelMediaCommandMessageHandler( LLMessageSystem *msg, void ** );
+ static void parcelMediaUpdateHandler( LLMessageSystem *msg, void ** );
+ void sendMediaNavigateMessage(const std::string& url);
- // inherited from LLViewerMediaObserver
- virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override;
+ // inherited from LLViewerMediaObserver
+ virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override;
private:
- void processParcelMediaCommandMessage(LLMessageSystem *msg);
- void processParcelMediaUpdate(LLMessageSystem *msg);
+ void processParcelMediaCommandMessage(LLMessageSystem *msg);
+ void processParcelMediaUpdate(LLMessageSystem *msg);
- S32 mMediaParcelLocalID;
- LLUUID mMediaRegionID;
- // HACK: this will change with Media on a Prim
- viewer_media_t mMediaImpl;
+ S32 mMediaParcelLocalID;
+ LLUUID mMediaRegionID;
+ // HACK: this will change with Media on a Prim
+ viewer_media_t mMediaImpl;
};
class LLViewerParcelMediaNavigationObserver
{
public:
- std::string mCurrentURL;
- bool mFromMessage;
+ std::string mCurrentURL;
+ bool mFromMessage;
- // void onNavigateComplete( const EventType& event_in );
+ // void onNavigateComplete( const EventType& event_in );
};
diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp
index db8fcb4dc4..6e0db94985 100644
--- a/indra/newview/llviewerparcelmediaautoplay.cpp
+++ b/indra/newview/llviewerparcelmediaautoplay.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,11 +46,11 @@ const F32 AUTOPLAY_SIZE = 24*24; // how big the texture must be (pixel are
const F32 AUTOPLAY_SPEED = 0.1f; // how slow should the agent be moving to autoplay
LLViewerParcelMediaAutoPlay::LLViewerParcelMediaAutoPlay() :
- LLEventTimer(1),
-
- mLastParcelID(-1),
- mPlayed(FALSE),
- mTimeInParcel(0)
+ LLEventTimer(1),
+
+ mLastParcelID(-1),
+ mPlayed(FALSE),
+ mTimeInParcel(0)
{
}
@@ -62,101 +62,101 @@ void LLViewerParcelMediaAutoPlay::playStarted()
BOOL LLViewerParcelMediaAutoPlay::tick()
{
- LLParcel *this_parcel = NULL;
- LLViewerRegion *this_region = NULL;
- std::string this_media_url;
- std::string this_media_type;
- LLUUID this_media_texture_id;
- S32 this_parcel_id = 0;
- LLUUID this_region_id;
-
- this_region = gAgent.getRegion();
-
- if (this_region)
- {
- this_region_id = this_region->getRegionID();
- }
-
- this_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-
- if (this_parcel)
- {
- this_media_url = this_parcel->getMediaURL();
-
- this_media_type = this_parcel->getMediaType();
-
- this_media_texture_id = this_parcel->getMediaID();
-
- this_parcel_id = this_parcel->getLocalID();
- }
-
- if (this_parcel_id != mLastParcelID ||
- this_region_id != mLastRegionID)
- {
- // we've entered a new parcel
- mPlayed = FALSE; // we haven't autoplayed yet
- mTimeInParcel = 0; // reset our timer
- mLastParcelID = this_parcel_id;
- mLastRegionID = this_region_id;
- }
-
- mTimeInParcel += mPeriod; // increase mTimeInParcel by the amount of time between ticks
-
- if ((!mPlayed) && // if we've never played
- (mTimeInParcel > AUTOPLAY_TIME) && // and if we've been here for so many seconds
- (!this_media_url.empty()) && // and if the parcel has media
- (stricmp(this_media_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0) &&
- (!LLViewerParcelMedia::getInstance()->hasParcelMedia())) // and if the media is not already playing
- {
- if (this_media_texture_id.notNull()) // and if the media texture is good
- {
- LLViewerMediaTexture *image = LLViewerTextureManager::getMediaTexture(this_media_texture_id, FALSE) ;
-
- F32 image_size = 0;
-
- if (image)
- {
- image_size = image->getMaxVirtualSize() ;
- }
-
- if (gAgent.getVelocity().magVec() < AUTOPLAY_SPEED) // and if the agent is stopped (slow enough)
- {
- if (image_size > AUTOPLAY_SIZE) // and if the target texture is big enough on screen
- {
- if (this_parcel)
- {
- static LLCachedControl<S32> autoplay_mode(gSavedSettings, "ParcelMediaAutoPlayEnable");
-
- switch (autoplay_mode())
- {
- case 0:
- // Disabled
- break;
- case 1:
- // Play, default value for ParcelMediaAutoPlayEnable
- LLViewerParcelMedia::getInstance()->play(this_parcel);
- break;
- case 2:
- default:
- {
- // Ask
- LLViewerParcelAskPlay::getInstance()->askToPlay(this_region->getRegionID(),
- this_parcel->getLocalID(),
- this_parcel->getMediaURL(),
- onStartMediaResponse);
- break;
- }
- }
- }
-
- mPlayed = TRUE;
- }
- }
- }
- }
-
-
- return FALSE; // continue ticking forever please.
+ LLParcel *this_parcel = NULL;
+ LLViewerRegion *this_region = NULL;
+ std::string this_media_url;
+ std::string this_media_type;
+ LLUUID this_media_texture_id;
+ S32 this_parcel_id = 0;
+ LLUUID this_region_id;
+
+ this_region = gAgent.getRegion();
+
+ if (this_region)
+ {
+ this_region_id = this_region->getRegionID();
+ }
+
+ this_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+
+ if (this_parcel)
+ {
+ this_media_url = this_parcel->getMediaURL();
+
+ this_media_type = this_parcel->getMediaType();
+
+ this_media_texture_id = this_parcel->getMediaID();
+
+ this_parcel_id = this_parcel->getLocalID();
+ }
+
+ if (this_parcel_id != mLastParcelID ||
+ this_region_id != mLastRegionID)
+ {
+ // we've entered a new parcel
+ mPlayed = FALSE; // we haven't autoplayed yet
+ mTimeInParcel = 0; // reset our timer
+ mLastParcelID = this_parcel_id;
+ mLastRegionID = this_region_id;
+ }
+
+ mTimeInParcel += mPeriod; // increase mTimeInParcel by the amount of time between ticks
+
+ if ((!mPlayed) && // if we've never played
+ (mTimeInParcel > AUTOPLAY_TIME) && // and if we've been here for so many seconds
+ (!this_media_url.empty()) && // and if the parcel has media
+ (stricmp(this_media_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0) &&
+ (!LLViewerParcelMedia::getInstance()->hasParcelMedia())) // and if the media is not already playing
+ {
+ if (this_media_texture_id.notNull()) // and if the media texture is good
+ {
+ LLViewerMediaTexture *image = LLViewerTextureManager::getMediaTexture(this_media_texture_id, FALSE) ;
+
+ F32 image_size = 0;
+
+ if (image)
+ {
+ image_size = image->getMaxVirtualSize() ;
+ }
+
+ if (gAgent.getVelocity().magVec() < AUTOPLAY_SPEED) // and if the agent is stopped (slow enough)
+ {
+ if (image_size > AUTOPLAY_SIZE) // and if the target texture is big enough on screen
+ {
+ if (this_parcel)
+ {
+ static LLCachedControl<S32> autoplay_mode(gSavedSettings, "ParcelMediaAutoPlayEnable");
+
+ switch (autoplay_mode())
+ {
+ case 0:
+ // Disabled
+ break;
+ case 1:
+ // Play, default value for ParcelMediaAutoPlayEnable
+ LLViewerParcelMedia::getInstance()->play(this_parcel);
+ break;
+ case 2:
+ default:
+ {
+ // Ask
+ LLViewerParcelAskPlay::getInstance()->askToPlay(this_region->getRegionID(),
+ this_parcel->getLocalID(),
+ this_parcel->getMediaURL(),
+ onStartMediaResponse);
+ break;
+ }
+ }
+ }
+
+ mPlayed = TRUE;
+ }
+ }
+ }
+ }
+
+
+ return FALSE; // continue ticking forever please.
}
//static
diff --git a/indra/newview/llviewerparcelmediaautoplay.h b/indra/newview/llviewerparcelmediaautoplay.h
index e83085dee0..ee228e8425 100644
--- a/indra/newview/llviewerparcelmediaautoplay.h
+++ b/indra/newview/llviewerparcelmediaautoplay.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,20 +33,20 @@
// timer to automatically play media
class LLViewerParcelMediaAutoPlay : LLEventTimer, public LLSingleton<LLViewerParcelMediaAutoPlay>
{
- LLSINGLETON(LLViewerParcelMediaAutoPlay);
+ LLSINGLETON(LLViewerParcelMediaAutoPlay);
public:
- virtual BOOL tick() override;
- static void playStarted();
+ virtual BOOL tick() override;
+ static void playStarted();
private:
// for askToPlay
- static void onStartMediaResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play);
+ static void onStartMediaResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play);
private:
- S32 mLastParcelID;
- LLUUID mLastRegionID;
- BOOL mPlayed;
- F32 mTimeInParcel;
+ S32 mLastParcelID;
+ LLUUID mLastRegionID;
+ BOOL mPlayed;
+ F32 mTimeInParcel;
};
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 15accd0547..149595106d 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerparcelmgr.cpp
* @brief Viewer-side representation of owned land
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -99,320 +99,320 @@ bool callback_god_force_owner(const LLSD&, const LLSD&);
struct LLGodForceOwnerData
{
- LLUUID mOwnerID;
- S32 mLocalID;
- LLHost mHost;
-
- LLGodForceOwnerData(
- const LLUUID& owner_id,
- S32 local_parcel_id,
- const LLHost& host) :
- mOwnerID(owner_id),
- mLocalID(local_parcel_id),
- mHost(host) {}
+ LLUUID mOwnerID;
+ S32 mLocalID;
+ LLHost mHost;
+
+ LLGodForceOwnerData(
+ const LLUUID& owner_id,
+ S32 local_parcel_id,
+ const LLHost& host) :
+ mOwnerID(owner_id),
+ mLocalID(local_parcel_id),
+ mHost(host) {}
};
//
// Methods
//
LLViewerParcelMgr::LLViewerParcelMgr()
-: mSelected(FALSE),
- mRequestResult(0),
- mWestSouth(),
- mEastNorth(),
- mSelectedDwell(DWELL_NAN),
- mAgentParcelSequenceID(-1),
- mHoverRequestResult(0),
- mHoverWestSouth(),
- mHoverEastNorth(),
- mTeleportInProgressPosition(),
- mRenderCollision(FALSE),
- mRenderSelection(TRUE),
- mCollisionBanned(0),
- mCollisionTimer(),
- mMediaParcelId(0),
- mMediaRegionId(0)
-{
- mCurrentParcel = new LLParcel();
- mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
- mFloatingParcelSelection = new LLParcelSelection(mCurrentParcel);
-
- mAgentParcel = new LLParcel();
- mHoverParcel = new LLParcel();
- mCollisionParcel = new LLParcel();
-
- mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS );
- mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)];
- resetSegments(mHighlightSegments);
-
- mCollisionSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)];
- resetSegments(mCollisionSegments);
-
- // JC: Resolved a merge conflict here, eliminated
- // mBlockedImage->setAddressMode(LLTexUnit::TAM_WRAP);
- // because it is done in llviewertexturelist.cpp
- mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI);
- mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI);
-
- S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / PARCEL_OVERLAY_CHUNKS;
- sPackedOverlay = new U8[overlay_size];
-
- mAgentParcelOverlay = new U8[mParcelsPerEdge * mParcelsPerEdge];
- S32 i;
- for (i = 0; i < mParcelsPerEdge * mParcelsPerEdge; i++)
- {
- mAgentParcelOverlay[i] = 0;
- }
-
- mTeleportInProgress = TRUE; // the initial parcel update is treated like teleport
+: mSelected(FALSE),
+ mRequestResult(0),
+ mWestSouth(),
+ mEastNorth(),
+ mSelectedDwell(DWELL_NAN),
+ mAgentParcelSequenceID(-1),
+ mHoverRequestResult(0),
+ mHoverWestSouth(),
+ mHoverEastNorth(),
+ mTeleportInProgressPosition(),
+ mRenderCollision(FALSE),
+ mRenderSelection(TRUE),
+ mCollisionBanned(0),
+ mCollisionTimer(),
+ mMediaParcelId(0),
+ mMediaRegionId(0)
+{
+ mCurrentParcel = new LLParcel();
+ mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
+ mFloatingParcelSelection = new LLParcelSelection(mCurrentParcel);
+
+ mAgentParcel = new LLParcel();
+ mHoverParcel = new LLParcel();
+ mCollisionParcel = new LLParcel();
+
+ mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS );
+ mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)];
+ resetSegments(mHighlightSegments);
+
+ mCollisionSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)];
+ resetSegments(mCollisionSegments);
+
+ // JC: Resolved a merge conflict here, eliminated
+ // mBlockedImage->setAddressMode(LLTexUnit::TAM_WRAP);
+ // because it is done in llviewertexturelist.cpp
+ mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI);
+ mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI);
+
+ S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / PARCEL_OVERLAY_CHUNKS;
+ sPackedOverlay = new U8[overlay_size];
+
+ mAgentParcelOverlay = new U8[mParcelsPerEdge * mParcelsPerEdge];
+ S32 i;
+ for (i = 0; i < mParcelsPerEdge * mParcelsPerEdge; i++)
+ {
+ mAgentParcelOverlay[i] = 0;
+ }
+
+ mTeleportInProgress = TRUE; // the initial parcel update is treated like teleport
}
LLViewerParcelMgr::~LLViewerParcelMgr()
{
- mCurrentParcelSelection->setParcel(NULL);
- mCurrentParcelSelection = NULL;
+ mCurrentParcelSelection->setParcel(NULL);
+ mCurrentParcelSelection = NULL;
- mFloatingParcelSelection->setParcel(NULL);
- mFloatingParcelSelection = NULL;
+ mFloatingParcelSelection->setParcel(NULL);
+ mFloatingParcelSelection = NULL;
- delete mCurrentParcel;
- mCurrentParcel = NULL;
+ delete mCurrentParcel;
+ mCurrentParcel = NULL;
- delete mAgentParcel;
- mAgentParcel = NULL;
+ delete mAgentParcel;
+ mAgentParcel = NULL;
- delete mCollisionParcel;
- mCollisionParcel = NULL;
+ delete mCollisionParcel;
+ mCollisionParcel = NULL;
- delete mHoverParcel;
- mHoverParcel = NULL;
+ delete mHoverParcel;
+ mHoverParcel = NULL;
- delete[] mHighlightSegments;
- mHighlightSegments = NULL;
+ delete[] mHighlightSegments;
+ mHighlightSegments = NULL;
- delete[] mCollisionSegments;
- mCollisionSegments = NULL;
+ delete[] mCollisionSegments;
+ mCollisionSegments = NULL;
- delete[] sPackedOverlay;
- sPackedOverlay = NULL;
+ delete[] sPackedOverlay;
+ sPackedOverlay = NULL;
- delete[] mAgentParcelOverlay;
- mAgentParcelOverlay = NULL;
+ delete[] mAgentParcelOverlay;
+ mAgentParcelOverlay = NULL;
- sBlockedImage = NULL;
- sPassImage = NULL;
+ sBlockedImage = NULL;
+ sPassImage = NULL;
}
void LLViewerParcelMgr::dump()
{
- LL_INFOS() << "Parcel Manager Dump" << LL_ENDL;
- LL_INFOS() << "mSelected " << S32(mSelected) << LL_ENDL;
- LL_INFOS() << "Selected parcel: " << LL_ENDL;
- LL_INFOS() << mWestSouth << " to " << mEastNorth << LL_ENDL;
- mCurrentParcel->dump();
- LL_INFOS() << "banning " << mCurrentParcel->mBanList.size() << LL_ENDL;
-
- LLAccessEntry::map::const_iterator cit = mCurrentParcel->mBanList.begin();
- LLAccessEntry::map::const_iterator end = mCurrentParcel->mBanList.end();
- for ( ; cit != end; ++cit)
- {
- LL_INFOS() << "ban id " << (*cit).first << LL_ENDL;
- }
- LL_INFOS() << "Hover parcel:" << LL_ENDL;
- mHoverParcel->dump();
- LL_INFOS() << "Agent parcel:" << LL_ENDL;
- mAgentParcel->dump();
+ LL_INFOS() << "Parcel Manager Dump" << LL_ENDL;
+ LL_INFOS() << "mSelected " << S32(mSelected) << LL_ENDL;
+ LL_INFOS() << "Selected parcel: " << LL_ENDL;
+ LL_INFOS() << mWestSouth << " to " << mEastNorth << LL_ENDL;
+ mCurrentParcel->dump();
+ LL_INFOS() << "banning " << mCurrentParcel->mBanList.size() << LL_ENDL;
+
+ LLAccessEntry::map::const_iterator cit = mCurrentParcel->mBanList.begin();
+ LLAccessEntry::map::const_iterator end = mCurrentParcel->mBanList.end();
+ for ( ; cit != end; ++cit)
+ {
+ LL_INFOS() << "ban id " << (*cit).first << LL_ENDL;
+ }
+ LL_INFOS() << "Hover parcel:" << LL_ENDL;
+ mHoverParcel->dump();
+ LL_INFOS() << "Agent parcel:" << LL_ENDL;
+ mAgentParcel->dump();
}
LLViewerRegion* LLViewerParcelMgr::getSelectionRegion()
{
- return LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ return LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
}
void LLViewerParcelMgr::getDisplayInfo(S32* area_out, S32* claim_out,
- S32* rent_out,
- BOOL* for_sale_out,
- F32* dwell_out)
-{
- S32 area = 0;
- S32 price = 0;
- S32 rent = 0;
- BOOL for_sale = FALSE;
- F32 dwell = DWELL_NAN;
-
- if (mSelected)
- {
- if (mCurrentParcelSelection->mSelectedMultipleOwners)
- {
- area = mCurrentParcelSelection->getClaimableArea();
- }
- else
- {
- area = getSelectedArea();
- }
-
- if (mCurrentParcel->getForSale())
- {
- price = mCurrentParcel->getSalePrice();
- for_sale = TRUE;
- }
- else
- {
- price = area * mCurrentParcel->getClaimPricePerMeter();
- for_sale = FALSE;
- }
-
- rent = mCurrentParcel->getTotalRent();
-
- dwell = mSelectedDwell;
- }
-
- *area_out = area;
- *claim_out = price;
- *rent_out = rent;
- *for_sale_out = for_sale;
- *dwell_out = dwell;
+ S32* rent_out,
+ BOOL* for_sale_out,
+ F32* dwell_out)
+{
+ S32 area = 0;
+ S32 price = 0;
+ S32 rent = 0;
+ BOOL for_sale = FALSE;
+ F32 dwell = DWELL_NAN;
+
+ if (mSelected)
+ {
+ if (mCurrentParcelSelection->mSelectedMultipleOwners)
+ {
+ area = mCurrentParcelSelection->getClaimableArea();
+ }
+ else
+ {
+ area = getSelectedArea();
+ }
+
+ if (mCurrentParcel->getForSale())
+ {
+ price = mCurrentParcel->getSalePrice();
+ for_sale = TRUE;
+ }
+ else
+ {
+ price = area * mCurrentParcel->getClaimPricePerMeter();
+ for_sale = FALSE;
+ }
+
+ rent = mCurrentParcel->getTotalRent();
+
+ dwell = mSelectedDwell;
+ }
+
+ *area_out = area;
+ *claim_out = price;
+ *rent_out = rent;
+ *for_sale_out = for_sale;
+ *dwell_out = dwell;
}
S32 LLViewerParcelMgr::getSelectedArea() const
{
- S32 rv = 0;
- if(mSelected && mCurrentParcel && mCurrentParcelSelection->mWholeParcelSelected)
- {
- rv = mCurrentParcel->getArea();
- }
- else if(mSelected)
- {
- F64 width = mEastNorth.mdV[VX] - mWestSouth.mdV[VX];
- F64 height = mEastNorth.mdV[VY] - mWestSouth.mdV[VY];
- F32 area = (F32)(width * height);
- rv = ll_round(area);
- }
- return rv;
+ S32 rv = 0;
+ if(mSelected && mCurrentParcel && mCurrentParcelSelection->mWholeParcelSelected)
+ {
+ rv = mCurrentParcel->getArea();
+ }
+ else if(mSelected)
+ {
+ F64 width = mEastNorth.mdV[VX] - mWestSouth.mdV[VX];
+ F64 height = mEastNorth.mdV[VY] - mWestSouth.mdV[VY];
+ F32 area = (F32)(width * height);
+ rv = ll_round(area);
+ }
+ return rv;
}
void LLViewerParcelMgr::resetSegments(U8* segments)
{
- S32 i;
- S32 count = (mParcelsPerEdge+1)*(mParcelsPerEdge+1);
- for (i = 0; i < count; i++)
- {
- segments[i] = 0x0;
- }
+ S32 i;
+ S32 count = (mParcelsPerEdge+1)*(mParcelsPerEdge+1);
+ for (i = 0; i < count; i++)
+ {
+ segments[i] = 0x0;
+ }
}
void LLViewerParcelMgr::writeHighlightSegments(F32 west, F32 south, F32 east,
- F32 north)
-{
- S32 x, y;
- S32 min_x = ll_round( west / PARCEL_GRID_STEP_METERS );
- S32 max_x = ll_round( east / PARCEL_GRID_STEP_METERS );
- S32 min_y = ll_round( south / PARCEL_GRID_STEP_METERS );
- S32 max_y = ll_round( north / PARCEL_GRID_STEP_METERS );
-
- const S32 STRIDE = mParcelsPerEdge+1;
-
- // south edge
- y = min_y;
- for (x = min_x; x < max_x; x++)
- {
- // exclusive OR means that writing to this segment twice
- // will turn it off
- mHighlightSegments[x + y*STRIDE] ^= SOUTH_MASK;
- }
-
- // west edge
- x = min_x;
- for (y = min_y; y < max_y; y++)
- {
- mHighlightSegments[x + y*STRIDE] ^= WEST_MASK;
- }
-
- // north edge - draw the south border on the y+1'th cell,
- // which given C-style arrays, is item foo[max_y]
- y = max_y;
- for (x = min_x; x < max_x; x++)
- {
- mHighlightSegments[x + y*STRIDE] ^= SOUTH_MASK;
- }
-
- // east edge - draw west border on x+1'th cell
- x = max_x;
- for (y = min_y; y < max_y; y++)
- {
- mHighlightSegments[x + y*STRIDE] ^= WEST_MASK;
- }
+ F32 north)
+{
+ S32 x, y;
+ S32 min_x = ll_round( west / PARCEL_GRID_STEP_METERS );
+ S32 max_x = ll_round( east / PARCEL_GRID_STEP_METERS );
+ S32 min_y = ll_round( south / PARCEL_GRID_STEP_METERS );
+ S32 max_y = ll_round( north / PARCEL_GRID_STEP_METERS );
+
+ const S32 STRIDE = mParcelsPerEdge+1;
+
+ // south edge
+ y = min_y;
+ for (x = min_x; x < max_x; x++)
+ {
+ // exclusive OR means that writing to this segment twice
+ // will turn it off
+ mHighlightSegments[x + y*STRIDE] ^= SOUTH_MASK;
+ }
+
+ // west edge
+ x = min_x;
+ for (y = min_y; y < max_y; y++)
+ {
+ mHighlightSegments[x + y*STRIDE] ^= WEST_MASK;
+ }
+
+ // north edge - draw the south border on the y+1'th cell,
+ // which given C-style arrays, is item foo[max_y]
+ y = max_y;
+ for (x = min_x; x < max_x; x++)
+ {
+ mHighlightSegments[x + y*STRIDE] ^= SOUTH_MASK;
+ }
+
+ // east edge - draw west border on x+1'th cell
+ x = max_x;
+ for (y = min_y; y < max_y; y++)
+ {
+ mHighlightSegments[x + y*STRIDE] ^= WEST_MASK;
+ }
}
void LLViewerParcelMgr::writeSegmentsFromBitmap(U8* bitmap, U8* segments)
{
- S32 x;
- S32 y;
- const S32 IN_STRIDE = mParcelsPerEdge;
- const S32 OUT_STRIDE = mParcelsPerEdge+1;
+ S32 x;
+ S32 y;
+ const S32 IN_STRIDE = mParcelsPerEdge;
+ const S32 OUT_STRIDE = mParcelsPerEdge+1;
- for (y = 0; y < IN_STRIDE; y++)
- {
- x = 0;
- while( x < IN_STRIDE )
- {
- U8 byte = bitmap[ (x + y*IN_STRIDE) / 8 ];
+ for (y = 0; y < IN_STRIDE; y++)
+ {
+ x = 0;
+ while( x < IN_STRIDE )
+ {
+ U8 byte = bitmap[ (x + y*IN_STRIDE) / 8 ];
- S32 bit;
- for (bit = 0; bit < 8; bit++)
- {
- if (byte & (1 << bit) )
- {
- S32 out = x+y*OUT_STRIDE;
+ S32 bit;
+ for (bit = 0; bit < 8; bit++)
+ {
+ if (byte & (1 << bit) )
+ {
+ S32 out = x+y*OUT_STRIDE;
- // This and one above it
- segments[out] ^= SOUTH_MASK;
- segments[out+OUT_STRIDE] ^= SOUTH_MASK;
+ // This and one above it
+ segments[out] ^= SOUTH_MASK;
+ segments[out+OUT_STRIDE] ^= SOUTH_MASK;
- // This and one to the right
- segments[out] ^= WEST_MASK;
- segments[out+1] ^= WEST_MASK;
- }
- x++;
- }
- }
- }
+ // This and one to the right
+ segments[out] ^= WEST_MASK;
+ segments[out+1] ^= WEST_MASK;
+ }
+ x++;
+ }
+ }
+ }
}
void LLViewerParcelMgr::writeAgentParcelFromBitmap(U8* bitmap)
{
- S32 x;
- S32 y;
- const S32 IN_STRIDE = mParcelsPerEdge;
-
- for (y = 0; y < IN_STRIDE; y++)
- {
- x = 0;
- while( x < IN_STRIDE )
- {
- U8 byte = bitmap[ (x + y*IN_STRIDE) / 8 ];
-
- S32 bit;
- for (bit = 0; bit < 8; bit++)
- {
- if (byte & (1 << bit) )
- {
- mAgentParcelOverlay[x+y*IN_STRIDE] = 1;
- }
- else
- {
- mAgentParcelOverlay[x+y*IN_STRIDE] = 0;
- }
- x++;
- }
- }
- }
+ S32 x;
+ S32 y;
+ const S32 IN_STRIDE = mParcelsPerEdge;
+
+ for (y = 0; y < IN_STRIDE; y++)
+ {
+ x = 0;
+ while( x < IN_STRIDE )
+ {
+ U8 byte = bitmap[ (x + y*IN_STRIDE) / 8 ];
+
+ S32 bit;
+ for (bit = 0; bit < 8; bit++)
+ {
+ if (byte & (1 << bit) )
+ {
+ mAgentParcelOverlay[x+y*IN_STRIDE] = 1;
+ }
+ else
+ {
+ mAgentParcelOverlay[x+y*IN_STRIDE] = 0;
+ }
+ x++;
+ }
+ }
+ }
}
@@ -420,192 +420,192 @@ void LLViewerParcelMgr::writeAgentParcelFromBitmap(U8* bitmap)
// containing it and select that.
LLParcelSelectionHandle LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_global)
{
- LLVector3d southwest = pos_global;
- LLVector3d northeast = pos_global;
+ LLVector3d southwest = pos_global;
+ LLVector3d northeast = pos_global;
- southwest -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
- southwest.mdV[VX] = ll_round( southwest.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
- southwest.mdV[VY] = ll_round( southwest.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
+ southwest -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
+ southwest.mdV[VX] = ll_round( southwest.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
+ southwest.mdV[VY] = ll_round( southwest.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
- northeast += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
- northeast.mdV[VX] = ll_round( northeast.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
- northeast.mdV[VY] = ll_round( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
+ northeast += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
+ northeast.mdV[VX] = ll_round( northeast.mdV[VX], (F64)PARCEL_GRID_STEP_METERS );
+ northeast.mdV[VY] = ll_round( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
- // Snap to parcel
- return selectLand( southwest, northeast, TRUE );
+ // Snap to parcel
+ return selectLand( southwest, northeast, TRUE );
}
// Tries to select the parcel inside the rectangle
LLParcelSelectionHandle LLViewerParcelMgr::selectParcelInRectangle()
{
- return selectLand(mWestSouth, mEastNorth, TRUE);
+ return selectLand(mWestSouth, mEastNorth, TRUE);
}
void LLViewerParcelMgr::selectCollisionParcel()
{
- // BUG: Claim to be in the agent's region
- mWestSouth = gAgent.getRegion()->getOriginGlobal();
- mEastNorth = mWestSouth;
- mEastNorth += LLVector3d(PARCEL_GRID_STEP_METERS, PARCEL_GRID_STEP_METERS, 0.0);
+ // BUG: Claim to be in the agent's region
+ mWestSouth = gAgent.getRegion()->getOriginGlobal();
+ mEastNorth = mWestSouth;
+ mEastNorth += LLVector3d(PARCEL_GRID_STEP_METERS, PARCEL_GRID_STEP_METERS, 0.0);
- // BUG: must be in the sim you are in
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ParcelPropertiesRequestByID);
- msg->nextBlockFast(_PREHASH_AgentID);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_SequenceID, SELECTED_PARCEL_SEQ_ID );
- msg->addS32Fast(_PREHASH_LocalID, mCollisionParcel->getLocalID() );
- gAgent.sendReliableMessage();
+ // BUG: must be in the sim you are in
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ParcelPropertiesRequestByID);
+ msg->nextBlockFast(_PREHASH_AgentID);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_SequenceID, SELECTED_PARCEL_SEQ_ID );
+ msg->addS32Fast(_PREHASH_LocalID, mCollisionParcel->getLocalID() );
+ gAgent.sendReliableMessage();
- mRequestResult = PARCEL_RESULT_NO_DATA;
+ mRequestResult = PARCEL_RESULT_NO_DATA;
- // Hack: Copy some data over temporarily
- mCurrentParcel->setName( mCollisionParcel->getName() );
- mCurrentParcel->setDesc( mCollisionParcel->getDesc() );
- mCurrentParcel->setPassPrice(mCollisionParcel->getPassPrice());
- mCurrentParcel->setPassHours(mCollisionParcel->getPassHours());
+ // Hack: Copy some data over temporarily
+ mCurrentParcel->setName( mCollisionParcel->getName() );
+ mCurrentParcel->setDesc( mCollisionParcel->getDesc() );
+ mCurrentParcel->setPassPrice(mCollisionParcel->getPassPrice());
+ mCurrentParcel->setPassHours(mCollisionParcel->getPassHours());
- // clear the list of segments to prevent flashing
- resetSegments(mHighlightSegments);
+ // clear the list of segments to prevent flashing
+ resetSegments(mHighlightSegments);
- mFloatingParcelSelection->setParcel(mCurrentParcel);
- mCurrentParcelSelection->setParcel(NULL);
- mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
+ mFloatingParcelSelection->setParcel(mCurrentParcel);
+ mCurrentParcelSelection->setParcel(NULL);
+ mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
- mSelected = TRUE;
- mCurrentParcelSelection->mWholeParcelSelected = TRUE;
- notifyObservers();
- return;
+ mSelected = TRUE;
+ mCurrentParcelSelection->mWholeParcelSelected = TRUE;
+ notifyObservers();
+ return;
}
// snap_selection = auto-select the hit parcel, if there is exactly one
LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &corner2,
- BOOL snap_selection)
-{
- sanitize_corners( corner1, corner2, mWestSouth, mEastNorth );
-
- // ...x isn't more than one meter away
- F32 delta_x = getSelectionWidth();
- if (delta_x * delta_x <= 1.f * 1.f)
- {
- mSelected = FALSE;
- notifyObservers();
- return NULL;
- }
-
- // ...y isn't more than one meter away
- F32 delta_y = getSelectionHeight();
- if (delta_y * delta_y <= 1.f * 1.f)
- {
- mSelected = FALSE;
- notifyObservers();
- return NULL;
- }
-
- // Can't select across region boundary
- // We need to pull in the upper right corner by a little bit to allow
- // selection up to the x = 256 or y = 256 edge.
- LLVector3d east_north_region_check( mEastNorth );
- east_north_region_check.mdV[VX] -= 0.5;
- east_north_region_check.mdV[VY] -= 0.5;
-
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal(mWestSouth);
- LLViewerRegion *region_other = LLWorld::getInstance()->getRegionFromPosGlobal( east_north_region_check );
-
- if(!region)
- {
- // just in case they somehow selected no land.
- mSelected = FALSE;
- return NULL;
- }
-
- if (region != region_other)
- {
- LLNotificationsUtil::add("CantSelectLandFromMultipleRegions");
- mSelected = FALSE;
- notifyObservers();
- return NULL;
- }
-
- // Build region global copies of corners
- LLVector3 wsb_region = region->getPosRegionFromGlobal( mWestSouth );
- LLVector3 ent_region = region->getPosRegionFromGlobal( mEastNorth );
-
- // Send request message
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ParcelPropertiesRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_SequenceID, SELECTED_PARCEL_SEQ_ID );
- msg->addF32Fast(_PREHASH_West, wsb_region.mV[VX] );
- msg->addF32Fast(_PREHASH_South, wsb_region.mV[VY] );
- msg->addF32Fast(_PREHASH_East, ent_region.mV[VX] );
- msg->addF32Fast(_PREHASH_North, ent_region.mV[VY] );
- msg->addBOOL("SnapSelection", snap_selection);
- msg->sendReliable( region->getHost() );
-
- mRequestResult = PARCEL_RESULT_NO_DATA;
-
- mFloatingParcelSelection->setParcel(mCurrentParcel);
- mCurrentParcelSelection->setParcel(NULL);
- mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
-
- mSelected = TRUE;
- mCurrentParcelSelection->mWholeParcelSelected = snap_selection;
- notifyObservers();
- return mCurrentParcelSelection;
+ BOOL snap_selection)
+{
+ sanitize_corners( corner1, corner2, mWestSouth, mEastNorth );
+
+ // ...x isn't more than one meter away
+ F32 delta_x = getSelectionWidth();
+ if (delta_x * delta_x <= 1.f * 1.f)
+ {
+ mSelected = FALSE;
+ notifyObservers();
+ return NULL;
+ }
+
+ // ...y isn't more than one meter away
+ F32 delta_y = getSelectionHeight();
+ if (delta_y * delta_y <= 1.f * 1.f)
+ {
+ mSelected = FALSE;
+ notifyObservers();
+ return NULL;
+ }
+
+ // Can't select across region boundary
+ // We need to pull in the upper right corner by a little bit to allow
+ // selection up to the x = 256 or y = 256 edge.
+ LLVector3d east_north_region_check( mEastNorth );
+ east_north_region_check.mdV[VX] -= 0.5;
+ east_north_region_check.mdV[VY] -= 0.5;
+
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal(mWestSouth);
+ LLViewerRegion *region_other = LLWorld::getInstance()->getRegionFromPosGlobal( east_north_region_check );
+
+ if(!region)
+ {
+ // just in case they somehow selected no land.
+ mSelected = FALSE;
+ return NULL;
+ }
+
+ if (region != region_other)
+ {
+ LLNotificationsUtil::add("CantSelectLandFromMultipleRegions");
+ mSelected = FALSE;
+ notifyObservers();
+ return NULL;
+ }
+
+ // Build region global copies of corners
+ LLVector3 wsb_region = region->getPosRegionFromGlobal( mWestSouth );
+ LLVector3 ent_region = region->getPosRegionFromGlobal( mEastNorth );
+
+ // Send request message
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ParcelPropertiesRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_SequenceID, SELECTED_PARCEL_SEQ_ID );
+ msg->addF32Fast(_PREHASH_West, wsb_region.mV[VX] );
+ msg->addF32Fast(_PREHASH_South, wsb_region.mV[VY] );
+ msg->addF32Fast(_PREHASH_East, ent_region.mV[VX] );
+ msg->addF32Fast(_PREHASH_North, ent_region.mV[VY] );
+ msg->addBOOL("SnapSelection", snap_selection);
+ msg->sendReliable( region->getHost() );
+
+ mRequestResult = PARCEL_RESULT_NO_DATA;
+
+ mFloatingParcelSelection->setParcel(mCurrentParcel);
+ mCurrentParcelSelection->setParcel(NULL);
+ mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
+
+ mSelected = TRUE;
+ mCurrentParcelSelection->mWholeParcelSelected = snap_selection;
+ notifyObservers();
+ return mCurrentParcelSelection;
}
void LLViewerParcelMgr::deselectUnused()
{
- // no more outstanding references to this selection, other than our own
- if (mCurrentParcelSelection->getNumRefs() == 1 && mFloatingParcelSelection->getNumRefs() == 1)
- {
- deselectLand();
- }
+ // no more outstanding references to this selection, other than our own
+ if (mCurrentParcelSelection->getNumRefs() == 1 && mFloatingParcelSelection->getNumRefs() == 1)
+ {
+ deselectLand();
+ }
}
void LLViewerParcelMgr::deselectLand()
{
- if (mSelected)
- {
- mSelected = FALSE;
+ if (mSelected)
+ {
+ mSelected = FALSE;
- // Invalidate the selected parcel
- mCurrentParcel->setLocalID(-1);
- mCurrentParcel->mAccessList.clear();
- mCurrentParcel->mBanList.clear();
- //mCurrentParcel->mRenterList.reset();
+ // Invalidate the selected parcel
+ mCurrentParcel->setLocalID(-1);
+ mCurrentParcel->mAccessList.clear();
+ mCurrentParcel->mBanList.clear();
+ //mCurrentParcel->mRenterList.reset();
- mSelectedDwell = DWELL_NAN;
+ mSelectedDwell = DWELL_NAN;
- // invalidate parcel selection so that existing users of this selection can clean up
- mCurrentParcelSelection->setParcel(NULL);
- mFloatingParcelSelection->setParcel(NULL);
- // create new parcel selection
- mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
+ // invalidate parcel selection so that existing users of this selection can clean up
+ mCurrentParcelSelection->setParcel(NULL);
+ mFloatingParcelSelection->setParcel(NULL);
+ // create new parcel selection
+ mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
- notifyObservers(); // Notify observers *after* changing the parcel selection
- }
+ notifyObservers(); // Notify observers *after* changing the parcel selection
+ }
}
void LLViewerParcelMgr::addObserver(LLParcelObserver* observer)
{
- mObservers.push_back(observer);
+ mObservers.push_back(observer);
}
void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer)
{
- vector_replace_with_last(mObservers, observer);
+ vector_replace_with_last(mObservers, observer);
}
@@ -614,17 +614,17 @@ void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer)
// from the list.
void LLViewerParcelMgr::notifyObservers()
{
- std::vector<LLParcelObserver*> observers;
- S32 count = mObservers.size();
- S32 i;
- for(i = 0; i < count; ++i)
- {
- observers.push_back(mObservers.at(i));
- }
- for(i = 0; i < count; ++i)
- {
- observers.at(i)->changed();
- }
+ std::vector<LLParcelObserver*> observers;
+ S32 count = mObservers.size();
+ S32 i;
+ for(i = 0; i < count; ++i)
+ {
+ observers.push_back(mObservers.at(i));
+ }
+ for(i = 0; i < count; ++i)
+ {
+ observers.at(i)->changed();
+ }
}
@@ -633,23 +633,23 @@ void LLViewerParcelMgr::notifyObservers()
//
BOOL LLViewerParcelMgr::selectionEmpty() const
{
- return !mSelected;
+ return !mSelected;
}
LLParcelSelectionHandle LLViewerParcelMgr::getParcelSelection() const
{
- return mCurrentParcelSelection;
+ return mCurrentParcelSelection;
}
LLParcelSelectionHandle LLViewerParcelMgr::getFloatingParcelSelection() const
{
- return mFloatingParcelSelection;
+ return mFloatingParcelSelection;
}
LLParcel *LLViewerParcelMgr::getAgentParcel() const
{
- return mAgentParcel;
+ return mAgentParcel;
}
@@ -680,200 +680,200 @@ LLParcel * LLViewerParcelMgr::getAgentOrSelectedParcel() const
// Return whether the agent can build on the land they are on
bool LLViewerParcelMgr::allowAgentBuild() const
{
- if (mAgentParcel)
- {
- return (gAgent.isGodlike() ||
- (mAgentParcel->allowModifyBy(gAgent.getID(), gAgent.getGroupID())) ||
- (isParcelOwnedByAgent(mAgentParcel, GP_LAND_ALLOW_CREATE)));
- }
- else
- {
- return gAgent.isGodlike();
- }
+ if (mAgentParcel)
+ {
+ return (gAgent.isGodlike() ||
+ (mAgentParcel->allowModifyBy(gAgent.getID(), gAgent.getGroupID())) ||
+ (isParcelOwnedByAgent(mAgentParcel, GP_LAND_ALLOW_CREATE)));
+ }
+ else
+ {
+ return gAgent.isGodlike();
+ }
}
// Return whether anyone can build on the given parcel
bool LLViewerParcelMgr::allowAgentBuild(const LLParcel* parcel) const
{
- return parcel->getAllowModify();
+ return parcel->getAllowModify();
}
bool LLViewerParcelMgr::allowAgentVoice() const
{
- return allowAgentVoice(gAgent.getRegion(), mAgentParcel);
+ return allowAgentVoice(gAgent.getRegion(), mAgentParcel);
}
bool LLViewerParcelMgr::allowAgentVoice(const LLViewerRegion* region, const LLParcel* parcel) const
{
- return region && region->isVoiceEnabled()
- && parcel && parcel->getParcelFlagAllowVoice();
+ return region && region->isVoiceEnabled()
+ && parcel && parcel->getParcelFlagAllowVoice();
}
bool LLViewerParcelMgr::allowAgentFly(const LLViewerRegion* region, const LLParcel* parcel) const
{
- return region && !region->getBlockFly()
- && parcel && parcel->getAllowFly();
+ return region && !region->getBlockFly()
+ && parcel && parcel->getAllowFly();
}
// Can the agent be pushed around by LLPushObject?
bool LLViewerParcelMgr::allowAgentPush(const LLViewerRegion* region, const LLParcel* parcel) const
{
- return region && !region->getRestrictPushObject()
- && parcel && !parcel->getRestrictPushObject();
+ return region && !region->getRestrictPushObject()
+ && parcel && !parcel->getRestrictPushObject();
}
bool LLViewerParcelMgr::allowAgentScripts(const LLViewerRegion* region, const LLParcel* parcel) const
{
- // *NOTE: This code does not take into account group-owned parcels
- // and the flag to allow group-owned scripted objects to run.
- // This mirrors the traditional menu bar parcel icon code, but is not
- // technically correct.
- return region
- && !region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS)
- && !region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS)
- && parcel
- && parcel->getAllowOtherScripts();
+ // *NOTE: This code does not take into account group-owned parcels
+ // and the flag to allow group-owned scripted objects to run.
+ // This mirrors the traditional menu bar parcel icon code, but is not
+ // technically correct.
+ return region
+ && !region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS)
+ && !region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS)
+ && parcel
+ && parcel->getAllowOtherScripts();
}
bool LLViewerParcelMgr::allowAgentDamage(const LLViewerRegion* region, const LLParcel* parcel) const
{
- return (region && region->getAllowDamage())
- || (parcel && parcel->getAllowDamage());
+ return (region && region->getAllowDamage())
+ || (parcel && parcel->getAllowDamage());
}
BOOL LLViewerParcelMgr::isOwnedAt(const LLVector3d& pos_global) const
{
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global );
- if (!region) return FALSE;
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global );
+ if (!region) return FALSE;
- LLViewerParcelOverlay* overlay = region->getParcelOverlay();
- if (!overlay) return FALSE;
+ LLViewerParcelOverlay* overlay = region->getParcelOverlay();
+ if (!overlay) return FALSE;
- LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global );
+ LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global );
- return overlay->isOwned( pos_region );
+ return overlay->isOwned( pos_region );
}
BOOL LLViewerParcelMgr::isOwnedSelfAt(const LLVector3d& pos_global) const
{
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global );
- if (!region) return FALSE;
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global );
+ if (!region) return FALSE;
- LLViewerParcelOverlay* overlay = region->getParcelOverlay();
- if (!overlay) return FALSE;
+ LLViewerParcelOverlay* overlay = region->getParcelOverlay();
+ if (!overlay) return FALSE;
- LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global );
+ LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global );
- return overlay->isOwnedSelf( pos_region );
+ return overlay->isOwnedSelf( pos_region );
}
BOOL LLViewerParcelMgr::isOwnedOtherAt(const LLVector3d& pos_global) const
{
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global );
- if (!region) return FALSE;
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global );
+ if (!region) return FALSE;
- LLViewerParcelOverlay* overlay = region->getParcelOverlay();
- if (!overlay) return FALSE;
+ LLViewerParcelOverlay* overlay = region->getParcelOverlay();
+ if (!overlay) return FALSE;
- LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global );
+ LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global );
- return overlay->isOwnedOther( pos_region );
+ return overlay->isOwnedOther( pos_region );
}
BOOL LLViewerParcelMgr::isSoundLocal(const LLVector3d& pos_global) const
{
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global );
- if (!region) return FALSE;
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global );
+ if (!region) return FALSE;
- LLViewerParcelOverlay* overlay = region->getParcelOverlay();
- if (!overlay) return FALSE;
+ LLViewerParcelOverlay* overlay = region->getParcelOverlay();
+ if (!overlay) return FALSE;
- LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global );
+ LLVector3 pos_region = region->getPosRegionFromGlobal( pos_global );
- return overlay->isSoundLocal( pos_region );
+ return overlay->isSoundLocal( pos_region );
}
BOOL LLViewerParcelMgr::canHearSound(const LLVector3d &pos_global) const
{
- BOOL in_agent_parcel = inAgentParcel(pos_global);
-
- if (in_agent_parcel)
- {
- // In same parcel as the agent
- return TRUE;
- }
- else
- {
- if (LLViewerParcelMgr::getInstance()->getAgentParcel()->getSoundLocal())
- {
- // Not in same parcel, and agent parcel only has local sound
- return FALSE;
- }
- else if (LLViewerParcelMgr::getInstance()->isSoundLocal(pos_global))
- {
- // Not in same parcel, and target parcel only has local sound
- return FALSE;
- }
- else
- {
- // Not in same parcel, but neither are local sound
- return TRUE;
- }
- }
+ BOOL in_agent_parcel = inAgentParcel(pos_global);
+
+ if (in_agent_parcel)
+ {
+ // In same parcel as the agent
+ return TRUE;
+ }
+ else
+ {
+ if (LLViewerParcelMgr::getInstance()->getAgentParcel()->getSoundLocal())
+ {
+ // Not in same parcel, and agent parcel only has local sound
+ return FALSE;
+ }
+ else if (LLViewerParcelMgr::getInstance()->isSoundLocal(pos_global))
+ {
+ // Not in same parcel, and target parcel only has local sound
+ return FALSE;
+ }
+ else
+ {
+ // Not in same parcel, but neither are local sound
+ return TRUE;
+ }
+ }
}
BOOL LLViewerParcelMgr::inAgentParcel(const LLVector3d &pos_global) const
{
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(pos_global);
- LLViewerRegion* agent_region = gAgent.getRegion();
- if (!region || !agent_region)
- return FALSE;
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(pos_global);
+ LLViewerRegion* agent_region = gAgent.getRegion();
+ if (!region || !agent_region)
+ return FALSE;
- if (region != agent_region)
- {
- // Can't be in the agent parcel if you're not in the same region.
- return FALSE;
- }
+ if (region != agent_region)
+ {
+ // Can't be in the agent parcel if you're not in the same region.
+ return FALSE;
+ }
- LLVector3 pos_region = agent_region->getPosRegionFromGlobal(pos_global);
- S32 row = S32(pos_region.mV[VY] / PARCEL_GRID_STEP_METERS);
- S32 column = S32(pos_region.mV[VX] / PARCEL_GRID_STEP_METERS);
+ LLVector3 pos_region = agent_region->getPosRegionFromGlobal(pos_global);
+ S32 row = S32(pos_region.mV[VY] / PARCEL_GRID_STEP_METERS);
+ S32 column = S32(pos_region.mV[VX] / PARCEL_GRID_STEP_METERS);
- if (mAgentParcelOverlay[row*mParcelsPerEdge + column])
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ if (mAgentParcelOverlay[row*mParcelsPerEdge + column])
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
// Returns NULL when there is no valid data.
LLParcel* LLViewerParcelMgr::getHoverParcel() const
{
- if (mHoverRequestResult == PARCEL_RESULT_SUCCESS)
- {
- return mHoverParcel;
- }
- else
- {
- return NULL;
- }
+ if (mHoverRequestResult == PARCEL_RESULT_SUCCESS)
+ {
+ return mHoverParcel;
+ }
+ else
+ {
+ return NULL;
+ }
}
// Returns NULL when there is no valid data.
LLParcel* LLViewerParcelMgr::getCollisionParcel() const
{
- if (mRenderCollision)
- {
- return mCollisionParcel;
- }
- else
- {
- return NULL;
- }
+ if (mRenderCollision)
+ {
+ return mCollisionParcel;
+ }
+ else
+ {
+ return NULL;
+ }
}
//
@@ -882,15 +882,15 @@ LLParcel* LLViewerParcelMgr::getCollisionParcel() const
void LLViewerParcelMgr::render()
{
- if (mSelected && mRenderSelection && gSavedSettings.getBOOL("RenderParcelSelection") && !gDisconnected)
- {
- // Rendering is done in agent-coordinates, so need to supply
- // an appropriate offset to the render code.
- LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(mWestSouth);
- if (!regionp) return;
+ if (mSelected && mRenderSelection && gSavedSettings.getBOOL("RenderParcelSelection") && !gDisconnected)
+ {
+ // Rendering is done in agent-coordinates, so need to supply
+ // an appropriate offset to the render code.
+ LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(mWestSouth);
+ if (!regionp) return;
- renderHighlightSegments(mHighlightSegments, regionp);
- }
+ renderHighlightSegments(mHighlightSegments, regionp);
+ }
}
@@ -898,384 +898,384 @@ void LLViewerParcelMgr::renderParcelCollision()
{
static LLCachedControl<S32> ban_lines_mode(gSavedSettings , "ShowBanLines" , PARCEL_BAN_LINES_ON_COLLISION);
- // check for expiration
+ // check for expiration
F32 expiration = (ban_lines_mode == PARCEL_BAN_LINES_ON_PROXIMITY)
? PARCEL_COLLISION_DRAW_SECS_ON_PROXIMITY
: PARCEL_BAN_LINES_DRAW_SECS_ON_COLLISION;
- if (mCollisionTimer.getElapsedTimeF32() > expiration)
- {
- mRenderCollision = false;
- }
+ if (mCollisionTimer.getElapsedTimeF32() > expiration)
+ {
+ mRenderCollision = false;
+ }
- if (mRenderCollision && ban_lines_mode != PARCEL_BAN_LINES_HIDE)
- {
- LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- BOOL use_pass = mCollisionParcel->getParcelFlag(PF_USE_PASS_LIST);
- renderCollisionSegments(mCollisionSegments, use_pass, regionp);
- }
- }
+ if (mRenderCollision && ban_lines_mode != PARCEL_BAN_LINES_HIDE)
+ {
+ LLViewerRegion* regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ BOOL use_pass = mCollisionParcel->getParcelFlag(PF_USE_PASS_LIST);
+ renderCollisionSegments(mCollisionSegments, use_pass, regionp);
+ }
+ }
}
void LLViewerParcelMgr::sendParcelAccessListRequest(U32 flags)
{
- if (!mSelected)
- {
- return;
- }
-
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region) return;
-
- LLMessageSystem *msg = gMessageSystem;
-
-
- if (flags & AL_BAN)
- {
- mCurrentParcel->mBanList.clear();
- }
- if (flags & AL_ACCESS)
- {
- mCurrentParcel->mAccessList.clear();
- }
- if (flags & AL_ALLOW_EXPERIENCE)
- {
- mCurrentParcel->clearExperienceKeysByType(EXPERIENCE_KEY_TYPE_ALLOWED);
- }
- if (flags & AL_BLOCK_EXPERIENCE)
- {
- mCurrentParcel->clearExperienceKeysByType(EXPERIENCE_KEY_TYPE_BLOCKED);
- }
-
- // Only the headers differ
- msg->newMessageFast(_PREHASH_ParcelAccessListRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Data);
- msg->addS32Fast(_PREHASH_SequenceID, 0);
- msg->addU32Fast(_PREHASH_Flags, flags);
- msg->addS32("LocalID", mCurrentParcel->getLocalID() );
- msg->sendReliable( region->getHost() );
+ if (!mSelected)
+ {
+ return;
+ }
+
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ if (!region) return;
+
+ LLMessageSystem *msg = gMessageSystem;
+
+
+ if (flags & AL_BAN)
+ {
+ mCurrentParcel->mBanList.clear();
+ }
+ if (flags & AL_ACCESS)
+ {
+ mCurrentParcel->mAccessList.clear();
+ }
+ if (flags & AL_ALLOW_EXPERIENCE)
+ {
+ mCurrentParcel->clearExperienceKeysByType(EXPERIENCE_KEY_TYPE_ALLOWED);
+ }
+ if (flags & AL_BLOCK_EXPERIENCE)
+ {
+ mCurrentParcel->clearExperienceKeysByType(EXPERIENCE_KEY_TYPE_BLOCKED);
+ }
+
+ // Only the headers differ
+ msg->newMessageFast(_PREHASH_ParcelAccessListRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_Data);
+ msg->addS32Fast(_PREHASH_SequenceID, 0);
+ msg->addU32Fast(_PREHASH_Flags, flags);
+ msg->addS32("LocalID", mCurrentParcel->getLocalID() );
+ msg->sendReliable( region->getHost() );
}
void LLViewerParcelMgr::sendParcelDwellRequest()
{
- if (!mSelected)
- {
- return;
- }
+ if (!mSelected)
+ {
+ return;
+ }
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region) return;
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ if (!region) return;
- LLMessageSystem *msg = gMessageSystem;
+ LLMessageSystem *msg = gMessageSystem;
- // Only the headers differ
- msg->newMessage("ParcelDwellRequest");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addS32("LocalID", mCurrentParcel->getLocalID());
- msg->addUUID("ParcelID", LLUUID::null); // filled in on simulator
- msg->sendReliable( region->getHost() );
+ // Only the headers differ
+ msg->newMessage("ParcelDwellRequest");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addS32("LocalID", mCurrentParcel->getLocalID());
+ msg->addUUID("ParcelID", LLUUID::null); // filled in on simulator
+ msg->sendReliable( region->getHost() );
}
void LLViewerParcelMgr::sendParcelGodForceOwner(const LLUUID& owner_id)
{
- if (!mSelected)
- {
- LLNotificationsUtil::add("CannotSetLandOwnerNothingSelected");
- return;
- }
-
- LL_INFOS("ParcelMgr") << "Claiming " << mWestSouth << " to " << mEastNorth << LL_ENDL;
-
- // BUG: Only works for the region containing mWestSouthBottom
- LLVector3d east_north_region_check( mEastNorth );
- east_north_region_check.mdV[VX] -= 0.5;
- east_north_region_check.mdV[VY] -= 0.5;
-
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region)
- {
- // TODO: Add a force owner version of this alert.
- LLNotificationsUtil::add("CannotContentifyNoRegion");
- return;
- }
-
- // BUG: Make work for cross-region selections
- LLViewerRegion *region2 = LLWorld::getInstance()->getRegionFromPosGlobal( east_north_region_check );
- if (region != region2)
- {
- LLNotificationsUtil::add("CannotSetLandOwnerMultipleRegions");
- return;
- }
-
- LL_INFOS("ParcelMgr") << "Region " << region->getOriginGlobal() << LL_ENDL;
-
- LLSD payload;
- payload["owner_id"] = owner_id;
- payload["parcel_local_id"] = mCurrentParcel->getLocalID();
- payload["region_host"] = region->getHost().getIPandPort();
- LLNotification::Params params("ForceOwnerAuctionWarning");
- params.payload(payload).functor.function(callback_god_force_owner);
-
- if(mCurrentParcel->getAuctionID())
- {
- LLNotifications::instance().add(params);
- }
- else
- {
- LLNotifications::instance().forceResponse(params, 0);
- }
+ if (!mSelected)
+ {
+ LLNotificationsUtil::add("CannotSetLandOwnerNothingSelected");
+ return;
+ }
+
+ LL_INFOS("ParcelMgr") << "Claiming " << mWestSouth << " to " << mEastNorth << LL_ENDL;
+
+ // BUG: Only works for the region containing mWestSouthBottom
+ LLVector3d east_north_region_check( mEastNorth );
+ east_north_region_check.mdV[VX] -= 0.5;
+ east_north_region_check.mdV[VY] -= 0.5;
+
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ if (!region)
+ {
+ // TODO: Add a force owner version of this alert.
+ LLNotificationsUtil::add("CannotContentifyNoRegion");
+ return;
+ }
+
+ // BUG: Make work for cross-region selections
+ LLViewerRegion *region2 = LLWorld::getInstance()->getRegionFromPosGlobal( east_north_region_check );
+ if (region != region2)
+ {
+ LLNotificationsUtil::add("CannotSetLandOwnerMultipleRegions");
+ return;
+ }
+
+ LL_INFOS("ParcelMgr") << "Region " << region->getOriginGlobal() << LL_ENDL;
+
+ LLSD payload;
+ payload["owner_id"] = owner_id;
+ payload["parcel_local_id"] = mCurrentParcel->getLocalID();
+ payload["region_host"] = region->getHost().getIPandPort();
+ LLNotification::Params params("ForceOwnerAuctionWarning");
+ params.payload(payload).functor.function(callback_god_force_owner);
+
+ if(mCurrentParcel->getAuctionID())
+ {
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
}
bool callback_god_force_owner(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if(0 == option)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ParcelGodForceOwner");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addUUID("OwnerID", notification["payload"]["owner_id"].asUUID());
- msg->addS32( "LocalID", notification["payload"]["parcel_local_id"].asInteger());
- msg->sendReliable(LLHost(notification["payload"]["region_host"].asString()));
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if(0 == option)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ParcelGodForceOwner");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addUUID("OwnerID", notification["payload"]["owner_id"].asUUID());
+ msg->addS32( "LocalID", notification["payload"]["parcel_local_id"].asInteger());
+ msg->sendReliable(LLHost(notification["payload"]["region_host"].asString()));
+ }
+ return false;
}
void LLViewerParcelMgr::sendParcelGodForceToContent()
{
- if (!mSelected)
- {
- LLNotificationsUtil::add("CannotContentifyNothingSelected");
- return;
- }
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region)
- {
- LLNotificationsUtil::add("CannotContentifyNoRegion");
- return;
- }
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ParcelGodMarkAsContent");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("ParcelData");
- msg->addS32("LocalID", mCurrentParcel->getLocalID());
- msg->sendReliable(region->getHost());
+ if (!mSelected)
+ {
+ LLNotificationsUtil::add("CannotContentifyNothingSelected");
+ return;
+ }
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ if (!region)
+ {
+ LLNotificationsUtil::add("CannotContentifyNoRegion");
+ return;
+ }
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ParcelGodMarkAsContent");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("ParcelData");
+ msg->addS32("LocalID", mCurrentParcel->getLocalID());
+ msg->sendReliable(region->getHost());
}
void LLViewerParcelMgr::sendParcelRelease()
{
- if (!mSelected)
- {
+ if (!mSelected)
+ {
LLNotificationsUtil::add("CannotReleaseLandNothingSelected");
- return;
- }
-
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region)
- {
- LLNotificationsUtil::add("CannotReleaseLandNoRegion");
- return;
- }
-
- //U32 flags = PR_NONE;
- //if (god_force) flags |= PR_GOD_FORCE;
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ParcelRelease");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID() );
- msg->nextBlock("Data");
- msg->addS32("LocalID", mCurrentParcel->getLocalID() );
- //msg->addU32("Flags", flags);
- msg->sendReliable( region->getHost() );
-
- // Blitz selection, since the parcel might be non-rectangular, and
- // we won't have appropriate parcel information.
- deselectLand();
+ return;
+ }
+
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ if (!region)
+ {
+ LLNotificationsUtil::add("CannotReleaseLandNoRegion");
+ return;
+ }
+
+ //U32 flags = PR_NONE;
+ //if (god_force) flags |= PR_GOD_FORCE;
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ParcelRelease");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID() );
+ msg->nextBlock("Data");
+ msg->addS32("LocalID", mCurrentParcel->getLocalID() );
+ //msg->addU32("Flags", flags);
+ msg->sendReliable( region->getHost() );
+
+ // Blitz selection, since the parcel might be non-rectangular, and
+ // we won't have appropriate parcel information.
+ deselectLand();
}
class LLViewerParcelMgr::ParcelBuyInfo
{
public:
- LLUUID mAgent;
- LLUUID mSession;
- LLUUID mGroup;
- BOOL mIsGroupOwned;
- BOOL mRemoveContribution;
- BOOL mIsClaim;
- LLHost mHost;
-
- // for parcel buys
- S32 mParcelID;
- S32 mPrice;
- S32 mArea;
-
- // for land claims
- F32 mWest;
- F32 mSouth;
- F32 mEast;
- F32 mNorth;
+ LLUUID mAgent;
+ LLUUID mSession;
+ LLUUID mGroup;
+ BOOL mIsGroupOwned;
+ BOOL mRemoveContribution;
+ BOOL mIsClaim;
+ LLHost mHost;
+
+ // for parcel buys
+ S32 mParcelID;
+ S32 mPrice;
+ S32 mArea;
+
+ // for land claims
+ F32 mWest;
+ F32 mSouth;
+ F32 mEast;
+ F32 mNorth;
};
LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy(
- const LLUUID& agent_id,
- const LLUUID& session_id,
- const LLUUID& group_id,
- BOOL is_group_owned,
- BOOL is_claim,
- BOOL remove_contribution)
-{
- if (!mSelected || !mCurrentParcel)
- {
- LLNotificationsUtil::add("CannotBuyLandNothingSelected");
- return NULL;
- }
-
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region)
- {
- LLNotificationsUtil::add("CannotBuyLandNoRegion");
- return NULL;
- }
-
- if (is_claim)
- {
- LL_INFOS("ParcelMgr") << "Claiming " << mWestSouth << " to " << mEastNorth << LL_ENDL;
- LL_INFOS("ParcelMgr") << "Region " << region->getOriginGlobal() << LL_ENDL;
-
- // BUG: Only works for the region containing mWestSouthBottom
- LLVector3d east_north_region_check( mEastNorth );
- east_north_region_check.mdV[VX] -= 0.5;
- east_north_region_check.mdV[VY] -= 0.5;
-
- LLViewerRegion *region2 = LLWorld::getInstance()->getRegionFromPosGlobal( east_north_region_check );
-
- if (region != region2)
- {
- LLNotificationsUtil::add("CantBuyLandAcrossMultipleRegions");
- return NULL;
- }
- }
-
-
- ParcelBuyInfo* info = new ParcelBuyInfo;
-
- info->mAgent = agent_id;
- info->mSession = session_id;
- info->mGroup = group_id;
- info->mIsGroupOwned = is_group_owned;
- info->mIsClaim = is_claim;
- info->mRemoveContribution = remove_contribution;
- info->mHost = region->getHost();
- info->mPrice = mCurrentParcel->getSalePrice();
- info->mArea = mCurrentParcel->getArea();
-
- if (!is_claim)
- {
- info->mParcelID = mCurrentParcel->getLocalID();
- }
- else
- {
- // BUG: Make work for cross-region selections
- LLVector3 west_south_bottom_region = region->getPosRegionFromGlobal( mWestSouth );
- LLVector3 east_north_top_region = region->getPosRegionFromGlobal( mEastNorth );
-
- info->mWest = west_south_bottom_region.mV[VX];
- info->mSouth = west_south_bottom_region.mV[VY];
- info->mEast = east_north_top_region.mV[VX];
- info->mNorth = east_north_top_region.mV[VY];
- }
-
- return info;
+ const LLUUID& agent_id,
+ const LLUUID& session_id,
+ const LLUUID& group_id,
+ BOOL is_group_owned,
+ BOOL is_claim,
+ BOOL remove_contribution)
+{
+ if (!mSelected || !mCurrentParcel)
+ {
+ LLNotificationsUtil::add("CannotBuyLandNothingSelected");
+ return NULL;
+ }
+
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ if (!region)
+ {
+ LLNotificationsUtil::add("CannotBuyLandNoRegion");
+ return NULL;
+ }
+
+ if (is_claim)
+ {
+ LL_INFOS("ParcelMgr") << "Claiming " << mWestSouth << " to " << mEastNorth << LL_ENDL;
+ LL_INFOS("ParcelMgr") << "Region " << region->getOriginGlobal() << LL_ENDL;
+
+ // BUG: Only works for the region containing mWestSouthBottom
+ LLVector3d east_north_region_check( mEastNorth );
+ east_north_region_check.mdV[VX] -= 0.5;
+ east_north_region_check.mdV[VY] -= 0.5;
+
+ LLViewerRegion *region2 = LLWorld::getInstance()->getRegionFromPosGlobal( east_north_region_check );
+
+ if (region != region2)
+ {
+ LLNotificationsUtil::add("CantBuyLandAcrossMultipleRegions");
+ return NULL;
+ }
+ }
+
+
+ ParcelBuyInfo* info = new ParcelBuyInfo;
+
+ info->mAgent = agent_id;
+ info->mSession = session_id;
+ info->mGroup = group_id;
+ info->mIsGroupOwned = is_group_owned;
+ info->mIsClaim = is_claim;
+ info->mRemoveContribution = remove_contribution;
+ info->mHost = region->getHost();
+ info->mPrice = mCurrentParcel->getSalePrice();
+ info->mArea = mCurrentParcel->getArea();
+
+ if (!is_claim)
+ {
+ info->mParcelID = mCurrentParcel->getLocalID();
+ }
+ else
+ {
+ // BUG: Make work for cross-region selections
+ LLVector3 west_south_bottom_region = region->getPosRegionFromGlobal( mWestSouth );
+ LLVector3 east_north_top_region = region->getPosRegionFromGlobal( mEastNorth );
+
+ info->mWest = west_south_bottom_region.mV[VX];
+ info->mSouth = west_south_bottom_region.mV[VY];
+ info->mEast = east_north_top_region.mV[VX];
+ info->mNorth = east_north_top_region.mV[VY];
+ }
+
+ return info;
}
void LLViewerParcelMgr::sendParcelBuy(ParcelBuyInfo* info)
{
- // send the message
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage(info->mIsClaim ? "ParcelClaim" : "ParcelBuy");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", info->mAgent);
- msg->addUUID("SessionID", info->mSession);
- msg->nextBlock("Data");
- msg->addUUID("GroupID", info->mGroup);
- msg->addBOOL("IsGroupOwned", info->mIsGroupOwned);
- if (!info->mIsClaim)
- {
- msg->addBOOL("RemoveContribution", info->mRemoveContribution);
- msg->addS32("LocalID", info->mParcelID);
- }
- msg->addBOOL("Final", TRUE); // don't allow escrow buys
- if (info->mIsClaim)
- {
- msg->nextBlock("ParcelData");
- msg->addF32("West", info->mWest);
- msg->addF32("South", info->mSouth);
- msg->addF32("East", info->mEast);
- msg->addF32("North", info->mNorth);
- }
- else // ParcelBuy
- {
- msg->nextBlock("ParcelData");
- msg->addS32("Price",info->mPrice);
- msg->addS32("Area",info->mArea);
- }
- msg->sendReliable(info->mHost);
+ // send the message
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage(info->mIsClaim ? "ParcelClaim" : "ParcelBuy");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", info->mAgent);
+ msg->addUUID("SessionID", info->mSession);
+ msg->nextBlock("Data");
+ msg->addUUID("GroupID", info->mGroup);
+ msg->addBOOL("IsGroupOwned", info->mIsGroupOwned);
+ if (!info->mIsClaim)
+ {
+ msg->addBOOL("RemoveContribution", info->mRemoveContribution);
+ msg->addS32("LocalID", info->mParcelID);
+ }
+ msg->addBOOL("Final", TRUE); // don't allow escrow buys
+ if (info->mIsClaim)
+ {
+ msg->nextBlock("ParcelData");
+ msg->addF32("West", info->mWest);
+ msg->addF32("South", info->mSouth);
+ msg->addF32("East", info->mEast);
+ msg->addF32("North", info->mNorth);
+ }
+ else // ParcelBuy
+ {
+ msg->nextBlock("ParcelData");
+ msg->addS32("Price",info->mPrice);
+ msg->addS32("Area",info->mArea);
+ }
+ msg->sendReliable(info->mHost);
}
void LLViewerParcelMgr::deleteParcelBuy(ParcelBuyInfo* *info)
{
- // Must be here because ParcelBuyInfo is local to this .cpp file
- delete *info;
- *info = NULL;
+ // Must be here because ParcelBuyInfo is local to this .cpp file
+ delete *info;
+ *info = NULL;
}
void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id)
{
- if (!mSelected || !mCurrentParcel)
- {
- LLNotificationsUtil::add("CannotDeedLandNothingSelected");
- return;
- }
- if(group_id.isNull())
- {
- LLNotificationsUtil::add("CannotDeedLandNoGroup");
- return;
- }
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region)
- {
- LLNotificationsUtil::add("CannotDeedLandNoRegion");
- return;
- }
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ParcelDeedToGroup");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID() );
- msg->nextBlock("Data");
- msg->addUUID("GroupID", group_id );
- msg->addS32("LocalID", mCurrentParcel->getLocalID() );
- //msg->addU32("JoinNeighbors", join);
- msg->sendReliable( region->getHost() );
+ if (!mSelected || !mCurrentParcel)
+ {
+ LLNotificationsUtil::add("CannotDeedLandNothingSelected");
+ return;
+ }
+ if(group_id.isNull())
+ {
+ LLNotificationsUtil::add("CannotDeedLandNoGroup");
+ return;
+ }
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ if (!region)
+ {
+ LLNotificationsUtil::add("CannotDeedLandNoRegion");
+ return;
+ }
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ParcelDeedToGroup");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID() );
+ msg->nextBlock("Data");
+ msg->addUUID("GroupID", group_id );
+ msg->addS32("LocalID", mCurrentParcel->getLocalID() );
+ //msg->addU32("JoinNeighbors", join);
+ msg->sendReliable( region->getHost() );
}
@@ -1286,39 +1286,39 @@ void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id)
// region global x,y, but it's easier to take it out for now.
void LLViewerParcelMgr::makeLandmarkAtSelection()
{
- // Don't create for parcels you don't own
- if (gAgent.getID() != mCurrentParcel->getOwnerID())
- {
- return;
- }
+ // Don't create for parcels you don't own
+ if (gAgent.getID() != mCurrentParcel->getOwnerID())
+ {
+ return;
+ }
- LLVector3d global_center(mWestSouth);
- global_center += mEastNorth;
- global_center *= 0.5f;
+ LLVector3d global_center(mWestSouth);
+ global_center += mEastNorth;
+ global_center *= 0.5f;
- LLViewerRegion* region;
- region = LLWorld::getInstance()->getRegionFromPosGlobal(global_center);
+ LLViewerRegion* region;
+ region = LLWorld::getInstance()->getRegionFromPosGlobal(global_center);
- LLVector3 west_south_bottom_region = region->getPosRegionFromGlobal( mWestSouth );
- LLVector3 east_north_top_region = region->getPosRegionFromGlobal( mEastNorth );
+ LLVector3 west_south_bottom_region = region->getPosRegionFromGlobal( mWestSouth );
+ LLVector3 east_north_top_region = region->getPosRegionFromGlobal( mEastNorth );
- std::string name("My Land");
- std::string buffer;
- S32 pos_x = (S32)floor((west_south_bottom_region.mV[VX] + east_north_top_region.mV[VX]) / 2.0f);
- S32 pos_y = (S32)floor((west_south_bottom_region.mV[VY] + east_north_top_region.mV[VY]) / 2.0f);
- buffer = llformat("%s in %s (%d, %d)",
- name.c_str(),
- region->getName().c_str(),
- pos_x, pos_y);
- name.assign(buffer);
+ std::string name("My Land");
+ std::string buffer;
+ S32 pos_x = (S32)floor((west_south_bottom_region.mV[VX] + east_north_top_region.mV[VX]) / 2.0f);
+ S32 pos_y = (S32)floor((west_south_bottom_region.mV[VY] + east_north_top_region.mV[VY]) / 2.0f);
+ buffer = llformat("%s in %s (%d, %d)",
+ name.c_str(),
+ region->getName().c_str(),
+ pos_x, pos_y);
+ name.assign(buffer);
- create_landmark(name, "Claimed land", global_center);
+ create_landmark(name, "Claimed land", global_center);
}
*/
const std::string& LLViewerParcelMgr::getAgentParcelName() const
{
- return mAgentParcel->getName();
+ return mAgentParcel->getName();
}
@@ -1331,240 +1331,240 @@ const S32 LLViewerParcelMgr::getAgentParcelId() const
void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_agent_region)
{
- if(!parcel)
+ if(!parcel)
return;
- LLViewerRegion *region = use_agent_region ? gAgent.getRegion() : LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region)
+ LLViewerRegion *region = use_agent_region ? gAgent.getRegion() : LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ if (!region)
return;
- LLSD body;
- std::string url = region->getCapability("ParcelPropertiesUpdate");
- if (!url.empty())
- {
- // request new properties update from simulator
- U32 message_flags = 0x01;
- body["flags"] = ll_sd_from_U32(message_flags);
- parcel->packMessage(body);
- LL_INFOS("ParcelMgr") << "Sending parcel properties update via capability to: "
- << url << LL_ENDL;
+ LLSD body;
+ std::string url = region->getCapability("ParcelPropertiesUpdate");
+ if (!url.empty())
+ {
+ // request new properties update from simulator
+ U32 message_flags = 0x01;
+ body["flags"] = ll_sd_from_U32(message_flags);
+ parcel->packMessage(body);
+ LL_INFOS("ParcelMgr") << "Sending parcel properties update via capability to: "
+ << url << LL_ENDL;
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body,
"Parcel Properties sent to sim.", "Parcel Properties failed to send to sim.");
- }
- else
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ParcelPropertiesUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() );
+ }
+ else
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ParcelPropertiesUpdate);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() );
- U32 message_flags = 0x01;
- msg->addU32("Flags", message_flags);
+ U32 message_flags = 0x01;
+ msg->addU32("Flags", message_flags);
- parcel->packMessage(msg);
+ parcel->packMessage(msg);
- msg->sendReliable( region->getHost() );
- }
+ msg->sendReliable( region->getHost() );
+ }
}
void LLViewerParcelMgr::setHoverParcel(const LLVector3d& pos)
{
- static U32 last_west, last_south;
- static LLUUID last_region;
-
- // only request parcel info if position has changed outside of the
- // last parcel grid step
- const U32 west_parcel_step = (U32) floor( pos.mdV[VX] / PARCEL_GRID_STEP_METERS );
- const U32 south_parcel_step = (U32) floor( pos.mdV[VY] / PARCEL_GRID_STEP_METERS );
-
- if ((west_parcel_step == last_west) && (south_parcel_step == last_south))
- {
- // We are staying in same segment
- return;
- }
-
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos );
- if (!region)
- {
- return;
- }
-
- LLUUID region_id = region->getRegionID();
- LLVector3 pos_in_region = region->getPosRegionFromGlobal(pos);
-
- bool request_properties = false;
- if (region_id != last_region)
- {
- request_properties = true;
- }
- else
- {
- // Check if new position is in same parcel.
- // This check is not ideal, since it checks by way of straight lines.
- // So sometimes (small parcel in the middle of large one) it can
- // decide that parcel actually changed, but it still allows to
- // reduce amount of requests significantly
-
- S32 west_parcel_local = (S32)(pos_in_region.mV[VX] / PARCEL_GRID_STEP_METERS);
- S32 south_parcel_local = (S32)(pos_in_region.mV[VY] / PARCEL_GRID_STEP_METERS);
-
- LLViewerParcelOverlay* overlay = region->getParcelOverlay();
- if (!overlay)
- {
- request_properties = true;
- }
- while (!request_properties && west_parcel_step < last_west)
- {
- S32 segment_shift = last_west - west_parcel_step;
- request_properties = overlay->parcelLineFlags(south_parcel_local, west_parcel_local + segment_shift) & PARCEL_WEST_LINE;
- last_west--;
- }
- while (!request_properties && south_parcel_step < last_south)
- {
- S32 segment_shift = last_south - south_parcel_step;
- request_properties = overlay->parcelLineFlags(south_parcel_local + segment_shift, west_parcel_local) & PARCEL_SOUTH_LINE;
- last_south--;
- }
- // Note: could have just swapped values, reused first two 'while' and set last_south, last_west separately,
- // but this looks to be easier to understand/straightforward/less bulky
- while (!request_properties && west_parcel_step > last_west)
- {
- S32 segment_shift = west_parcel_step - last_west;
- request_properties = overlay->parcelLineFlags(south_parcel_local, west_parcel_local - segment_shift + 1) & PARCEL_WEST_LINE;
- last_west++;
- }
- while (!request_properties && south_parcel_step > last_south)
- {
- S32 segment_shift = south_parcel_step - last_south;
- request_properties = overlay->parcelLineFlags(south_parcel_local - segment_shift + 1, west_parcel_local) & PARCEL_SOUTH_LINE;
- last_south++;
- }
-
- // if (!request_properties) last_south and last_west will be equal to new values
- }
-
- if (request_properties)
- {
- last_west = west_parcel_step;
- last_south = south_parcel_step;
- last_region = region_id;
-
- LL_DEBUGS("ParcelMgr") << "Requesting parcel properties on hover, for " << pos << LL_ENDL;
-
-
- // Send a rectangle around the point.
- // This means the parcel sent back is at least a rectangle around the point,
- // which is more efficient for public land. Fewer requests are sent. JC
- F32 west = PARCEL_GRID_STEP_METERS * floor(pos_in_region.mV[VX] / PARCEL_GRID_STEP_METERS);
- F32 south = PARCEL_GRID_STEP_METERS * floor(pos_in_region.mV[VY] / PARCEL_GRID_STEP_METERS);
-
- F32 east = west + PARCEL_GRID_STEP_METERS;
- F32 north = south + PARCEL_GRID_STEP_METERS;
-
- // Send request message
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ParcelPropertiesRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_SequenceID, HOVERED_PARCEL_SEQ_ID);
- msg->addF32Fast(_PREHASH_West, west);
- msg->addF32Fast(_PREHASH_South, south);
- msg->addF32Fast(_PREHASH_East, east);
- msg->addF32Fast(_PREHASH_North, north);
- msg->addBOOL("SnapSelection", FALSE);
- msg->sendReliable(region->getHost());
-
- mHoverRequestResult = PARCEL_RESULT_NO_DATA;
- }
+ static U32 last_west, last_south;
+ static LLUUID last_region;
+
+ // only request parcel info if position has changed outside of the
+ // last parcel grid step
+ const U32 west_parcel_step = (U32) floor( pos.mdV[VX] / PARCEL_GRID_STEP_METERS );
+ const U32 south_parcel_step = (U32) floor( pos.mdV[VY] / PARCEL_GRID_STEP_METERS );
+
+ if ((west_parcel_step == last_west) && (south_parcel_step == last_south))
+ {
+ // We are staying in same segment
+ return;
+ }
+
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos );
+ if (!region)
+ {
+ return;
+ }
+
+ LLUUID region_id = region->getRegionID();
+ LLVector3 pos_in_region = region->getPosRegionFromGlobal(pos);
+
+ bool request_properties = false;
+ if (region_id != last_region)
+ {
+ request_properties = true;
+ }
+ else
+ {
+ // Check if new position is in same parcel.
+ // This check is not ideal, since it checks by way of straight lines.
+ // So sometimes (small parcel in the middle of large one) it can
+ // decide that parcel actually changed, but it still allows to
+ // reduce amount of requests significantly
+
+ S32 west_parcel_local = (S32)(pos_in_region.mV[VX] / PARCEL_GRID_STEP_METERS);
+ S32 south_parcel_local = (S32)(pos_in_region.mV[VY] / PARCEL_GRID_STEP_METERS);
+
+ LLViewerParcelOverlay* overlay = region->getParcelOverlay();
+ if (!overlay)
+ {
+ request_properties = true;
+ }
+ while (!request_properties && west_parcel_step < last_west)
+ {
+ S32 segment_shift = last_west - west_parcel_step;
+ request_properties = overlay->parcelLineFlags(south_parcel_local, west_parcel_local + segment_shift) & PARCEL_WEST_LINE;
+ last_west--;
+ }
+ while (!request_properties && south_parcel_step < last_south)
+ {
+ S32 segment_shift = last_south - south_parcel_step;
+ request_properties = overlay->parcelLineFlags(south_parcel_local + segment_shift, west_parcel_local) & PARCEL_SOUTH_LINE;
+ last_south--;
+ }
+ // Note: could have just swapped values, reused first two 'while' and set last_south, last_west separately,
+ // but this looks to be easier to understand/straightforward/less bulky
+ while (!request_properties && west_parcel_step > last_west)
+ {
+ S32 segment_shift = west_parcel_step - last_west;
+ request_properties = overlay->parcelLineFlags(south_parcel_local, west_parcel_local - segment_shift + 1) & PARCEL_WEST_LINE;
+ last_west++;
+ }
+ while (!request_properties && south_parcel_step > last_south)
+ {
+ S32 segment_shift = south_parcel_step - last_south;
+ request_properties = overlay->parcelLineFlags(south_parcel_local - segment_shift + 1, west_parcel_local) & PARCEL_SOUTH_LINE;
+ last_south++;
+ }
+
+ // if (!request_properties) last_south and last_west will be equal to new values
+ }
+
+ if (request_properties)
+ {
+ last_west = west_parcel_step;
+ last_south = south_parcel_step;
+ last_region = region_id;
+
+ LL_DEBUGS("ParcelMgr") << "Requesting parcel properties on hover, for " << pos << LL_ENDL;
+
+
+ // Send a rectangle around the point.
+ // This means the parcel sent back is at least a rectangle around the point,
+ // which is more efficient for public land. Fewer requests are sent. JC
+ F32 west = PARCEL_GRID_STEP_METERS * floor(pos_in_region.mV[VX] / PARCEL_GRID_STEP_METERS);
+ F32 south = PARCEL_GRID_STEP_METERS * floor(pos_in_region.mV[VY] / PARCEL_GRID_STEP_METERS);
+
+ F32 east = west + PARCEL_GRID_STEP_METERS;
+ F32 north = south + PARCEL_GRID_STEP_METERS;
+
+ // Send request message
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ParcelPropertiesRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_SequenceID, HOVERED_PARCEL_SEQ_ID);
+ msg->addF32Fast(_PREHASH_West, west);
+ msg->addF32Fast(_PREHASH_South, south);
+ msg->addF32Fast(_PREHASH_East, east);
+ msg->addF32Fast(_PREHASH_North, north);
+ msg->addBOOL("SnapSelection", FALSE);
+ msg->sendReliable(region->getHost());
+
+ mHoverRequestResult = PARCEL_RESULT_NO_DATA;
+ }
}
// static
void LLViewerParcelMgr::processParcelOverlay(LLMessageSystem *msg, void **user)
{
- // Extract the packed overlay information
- S32 packed_overlay_size = msg->getSizeFast(_PREHASH_ParcelData, _PREHASH_Data);
-
- if (packed_overlay_size <= 0)
- {
- LL_WARNS() << "Overlay size " << packed_overlay_size << LL_ENDL;
- return;
- }
-
- S32 parcels_per_edge = LLViewerParcelMgr::getInstance()->mParcelsPerEdge;
- S32 expected_size = parcels_per_edge * parcels_per_edge / PARCEL_OVERLAY_CHUNKS;
- if (packed_overlay_size != expected_size)
- {
- LL_WARNS() << "Got parcel overlay size " << packed_overlay_size
- << " expecting " << expected_size << LL_ENDL;
- return;
- }
-
- S32 sequence_id;
- msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_SequenceID, sequence_id);
- msg->getBinaryDataFast(
- _PREHASH_ParcelData,
- _PREHASH_Data,
- sPackedOverlay,
- expected_size);
-
- LLHost host = msg->getSender();
- LLViewerRegion *region = LLWorld::getInstance()->getRegion(host);
- if (region)
- {
- region->mParcelOverlay->uncompressLandOverlay( sequence_id, sPackedOverlay );
- }
+ // Extract the packed overlay information
+ S32 packed_overlay_size = msg->getSizeFast(_PREHASH_ParcelData, _PREHASH_Data);
+
+ if (packed_overlay_size <= 0)
+ {
+ LL_WARNS() << "Overlay size " << packed_overlay_size << LL_ENDL;
+ return;
+ }
+
+ S32 parcels_per_edge = LLViewerParcelMgr::getInstance()->mParcelsPerEdge;
+ S32 expected_size = parcels_per_edge * parcels_per_edge / PARCEL_OVERLAY_CHUNKS;
+ if (packed_overlay_size != expected_size)
+ {
+ LL_WARNS() << "Got parcel overlay size " << packed_overlay_size
+ << " expecting " << expected_size << LL_ENDL;
+ return;
+ }
+
+ S32 sequence_id;
+ msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_SequenceID, sequence_id);
+ msg->getBinaryDataFast(
+ _PREHASH_ParcelData,
+ _PREHASH_Data,
+ sPackedOverlay,
+ expected_size);
+
+ LLHost host = msg->getSender();
+ LLViewerRegion *region = LLWorld::getInstance()->getRegion(host);
+ if (region)
+ {
+ region->mParcelOverlay->uncompressLandOverlay( sequence_id, sPackedOverlay );
+ }
}
// static
void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **user)
{
- S32 request_result;
- S32 sequence_id;
- BOOL snap_selection = FALSE;
- S32 self_count = 0;
- S32 other_count = 0;
- S32 public_count = 0;
- S32 local_id;
- LLUUID owner_id;
- BOOL is_group_owned;
+ S32 request_result;
+ S32 sequence_id;
+ BOOL snap_selection = FALSE;
+ S32 self_count = 0;
+ S32 other_count = 0;
+ S32 public_count = 0;
+ S32 local_id;
+ LLUUID owner_id;
+ BOOL is_group_owned;
U32 auction_id = 0;
- S32 claim_price_per_meter = 0;
- S32 rent_price_per_meter = 0;
- S32 claim_date = 0;
- LLVector3 aabb_min;
- LLVector3 aabb_max;
- S32 area = 0;
- S32 sw_max_prims = 0;
- S32 sw_total_prims = 0;
- //LLUUID buyer_id;
+ S32 claim_price_per_meter = 0;
+ S32 rent_price_per_meter = 0;
+ S32 claim_date = 0;
+ LLVector3 aabb_min;
+ LLVector3 aabb_max;
+ S32 area = 0;
+ S32 sw_max_prims = 0;
+ S32 sw_total_prims = 0;
+ //LLUUID buyer_id;
U8 status = 0;
- S32 max_prims = 0;
- S32 total_prims = 0;
- S32 owner_prims = 0;
- S32 group_prims = 0;
- S32 other_prims = 0;
- S32 selected_prims = 0;
- F32 parcel_prim_bonus = 1.f;
- BOOL region_push_override = false;
- BOOL region_deny_anonymous_override = false;
- BOOL region_deny_identified_override = false; // Deprecated
- BOOL region_deny_transacted_override = false; // Deprecated
- BOOL region_deny_age_unverified_override = false;
+ S32 max_prims = 0;
+ S32 total_prims = 0;
+ S32 owner_prims = 0;
+ S32 group_prims = 0;
+ S32 other_prims = 0;
+ S32 selected_prims = 0;
+ F32 parcel_prim_bonus = 1.f;
+ BOOL region_push_override = false;
+ BOOL region_deny_anonymous_override = false;
+ BOOL region_deny_identified_override = false; // Deprecated
+ BOOL region_deny_transacted_override = false; // Deprecated
+ BOOL region_deny_age_unverified_override = false;
BOOL region_allow_access_override = true;
BOOL region_allow_environment_override = true;
S32 parcel_environment_version = 0;
- BOOL agent_parcel_update = false; // updating previous(existing) agent parcel
+ BOOL agent_parcel_update = false; // updating previous(existing) agent parcel
U32 extended_flags = 0; //obscure MOAP
- S32 other_clean_time = 0;
+ S32 other_clean_time = 0;
LLViewerParcelMgr& parcel_mgr = LLViewerParcelMgr::instance();
@@ -1628,7 +1628,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
msg->getVector3Fast(_PREHASH_ParcelData, _PREHASH_AABBMin, aabb_min);
msg->getVector3Fast(_PREHASH_ParcelData, _PREHASH_AABBMax, aabb_max);
msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_Area, area);
- //msg->getUUIDFast( _PREHASH_ParcelData, _PREHASH_BuyerID, buyer_id);
+ //msg->getUUIDFast( _PREHASH_ParcelData, _PREHASH_BuyerID, buyer_id);
msg->getU8("ParcelData", "Status", status);
msg->getS32("ParcelData", "SimWideMaxPrims", sw_max_prims);
msg->getS32("ParcelData", "SimWideTotalPrims", sw_total_prims);
@@ -1665,13 +1665,13 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
msg->getBOOLFast(_PREHASH_ParcelEnvironmentBlock, _PREHASH_RegionAllowEnvironmentOverride, region_allow_environment_override);
}
- msg->getS32("ParcelData", "OtherCleanTime", other_clean_time );
+ msg->getS32("ParcelData", "OtherCleanTime", other_clean_time );
- LL_DEBUGS("ParcelMgr") << "Processing parcel " << local_id << " update, target(sequence): " << sequence_id << LL_ENDL;
+ LL_DEBUGS("ParcelMgr") << "Processing parcel " << local_id << " update, target(sequence): " << sequence_id << LL_ENDL;
- // Actually extract the data.
- if (parcel)
- {
+ // Actually extract the data.
+ if (parcel)
+ {
if (local_id == parcel_mgr.mAgentParcel->getLocalID())
{
// Parcels in different regions can have same ids.
@@ -1687,66 +1687,66 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
S32 cur_parcel_environment_version = parcel->getParcelEnvironmentVersion();
bool environment_changed = (cur_parcel_environment_version != parcel_environment_version);
- parcel->init(owner_id,
- FALSE, FALSE, FALSE,
- claim_date, claim_price_per_meter, rent_price_per_meter,
- area, other_prims, parcel_prim_bonus, is_group_owned);
- parcel->setLocalID(local_id);
- parcel->setAABBMin(aabb_min);
- parcel->setAABBMax(aabb_max);
-
- parcel->setAuctionID(auction_id);
- parcel->setOwnershipStatus((LLParcel::EOwnershipStatus)status);
-
- parcel->setSimWideMaxPrimCapacity(sw_max_prims);
- parcel->setSimWidePrimCount(sw_total_prims);
- parcel->setMaxPrimCapacity(max_prims);
- parcel->setOwnerPrimCount(owner_prims);
- parcel->setGroupPrimCount(group_prims);
- parcel->setOtherPrimCount(other_prims);
- parcel->setSelectedPrimCount(selected_prims);
- parcel->setParcelPrimBonus(parcel_prim_bonus);
-
- parcel->setCleanOtherTime(other_clean_time);
- parcel->setRegionPushOverride(region_push_override);
- parcel->setRegionDenyAnonymousOverride(region_deny_anonymous_override);
- parcel->setRegionDenyAgeUnverifiedOverride(region_deny_age_unverified_override);
+ parcel->init(owner_id,
+ FALSE, FALSE, FALSE,
+ claim_date, claim_price_per_meter, rent_price_per_meter,
+ area, other_prims, parcel_prim_bonus, is_group_owned);
+ parcel->setLocalID(local_id);
+ parcel->setAABBMin(aabb_min);
+ parcel->setAABBMax(aabb_max);
+
+ parcel->setAuctionID(auction_id);
+ parcel->setOwnershipStatus((LLParcel::EOwnershipStatus)status);
+
+ parcel->setSimWideMaxPrimCapacity(sw_max_prims);
+ parcel->setSimWidePrimCount(sw_total_prims);
+ parcel->setMaxPrimCapacity(max_prims);
+ parcel->setOwnerPrimCount(owner_prims);
+ parcel->setGroupPrimCount(group_prims);
+ parcel->setOtherPrimCount(other_prims);
+ parcel->setSelectedPrimCount(selected_prims);
+ parcel->setParcelPrimBonus(parcel_prim_bonus);
+
+ parcel->setCleanOtherTime(other_clean_time);
+ parcel->setRegionPushOverride(region_push_override);
+ parcel->setRegionDenyAnonymousOverride(region_deny_anonymous_override);
+ parcel->setRegionDenyAgeUnverifiedOverride(region_deny_age_unverified_override);
parcel->setRegionAllowAccessOverride(region_allow_access_override);
parcel->setParcelEnvironmentVersion(cur_parcel_environment_version);
parcel->setRegionAllowEnvironmentOverride(region_allow_environment_override);
parcel->setObscureMOAP((bool)extended_flags);
- parcel->unpackMessage(msg);
-
- if (parcel == parcel_mgr.mAgentParcel)
- {
- // new agent parcel
- S32 bitmap_size = parcel_mgr.mParcelsPerEdge
- * parcel_mgr.mParcelsPerEdge
- / 8;
- U8* bitmap = new U8[ bitmap_size ];
- msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
-
- parcel_mgr.writeAgentParcelFromBitmap(bitmap);
- delete[] bitmap;
-
- // Let interesting parties know about agent parcel change.
- LLViewerParcelMgr* instance = LLViewerParcelMgr::getInstance();
-
- if (instance->mTeleportInProgress)
- {
- instance->mTeleportInProgress = FALSE;
- if(instance->mTeleportInProgressPosition.isNull())
- {
- //initial update
- instance->mTeleportFinishedSignal(gAgent.getPositionGlobal(), false);
- }
- else
- {
- instance->mTeleportFinishedSignal(instance->mTeleportInProgressPosition, false);
- }
- }
+ parcel->unpackMessage(msg);
+
+ if (parcel == parcel_mgr.mAgentParcel)
+ {
+ // new agent parcel
+ S32 bitmap_size = parcel_mgr.mParcelsPerEdge
+ * parcel_mgr.mParcelsPerEdge
+ / 8;
+ U8* bitmap = new U8[ bitmap_size ];
+ msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
+
+ parcel_mgr.writeAgentParcelFromBitmap(bitmap);
+ delete[] bitmap;
+
+ // Let interesting parties know about agent parcel change.
+ LLViewerParcelMgr* instance = LLViewerParcelMgr::getInstance();
+
+ if (instance->mTeleportInProgress)
+ {
+ instance->mTeleportInProgress = FALSE;
+ if(instance->mTeleportInProgressPosition.isNull())
+ {
+ //initial update
+ instance->mTeleportFinishedSignal(gAgent.getPositionGlobal(), false);
+ }
+ else
+ {
+ instance->mTeleportFinishedSignal(instance->mTeleportInProgressPosition, false);
+ }
+ }
parcel->setParcelEnvironmentVersion(parcel_environment_version);
LL_DEBUGS("ENVIRONMENT") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL;
@@ -1765,155 +1765,155 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
LLEnvironment::instance().requestParcel(local_id);
}
}
- }
-
- // Handle updating selections, if necessary.
- if (sequence_id == SELECTED_PARCEL_SEQ_ID)
- {
- // Update selected counts
- parcel_mgr.mCurrentParcelSelection->mSelectedSelfCount = self_count;
- parcel_mgr.mCurrentParcelSelection->mSelectedOtherCount = other_count;
- parcel_mgr.mCurrentParcelSelection->mSelectedPublicCount = public_count;
-
- parcel_mgr.mCurrentParcelSelection->mSelectedMultipleOwners =
- (request_result == PARCEL_RESULT_MULTIPLE);
-
- // Select the whole parcel
- LLViewerRegion* region = LLWorld::getInstance()->getRegion( msg->getSender() );
- if (region)
- {
- if (!snap_selection)
- {
- // don't muck with the westsouth and eastnorth.
- // just highlight it
- LLVector3 west_south = region->getPosRegionFromGlobal(parcel_mgr.mWestSouth);
- LLVector3 east_north = region->getPosRegionFromGlobal(parcel_mgr.mEastNorth);
-
- parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
- parcel_mgr.writeHighlightSegments(
- west_south.mV[VX],
- west_south.mV[VY],
- east_north.mV[VX],
- east_north.mV[VY] );
- parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = FALSE;
- }
- else if (0 == local_id)
- {
- // this is public land, just highlight the selection
- parcel_mgr.mWestSouth = region->getPosGlobalFromRegion( aabb_min );
- parcel_mgr.mEastNorth = region->getPosGlobalFromRegion( aabb_max );
-
- parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
- parcel_mgr.writeHighlightSegments(
- aabb_min.mV[VX],
- aabb_min.mV[VY],
- aabb_max.mV[VX],
- aabb_max.mV[VY] );
- parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE;
- }
- else
- {
- parcel_mgr.mWestSouth = region->getPosGlobalFromRegion( aabb_min );
- parcel_mgr.mEastNorth = region->getPosGlobalFromRegion( aabb_max );
-
- // Owned land, highlight the boundaries
- S32 bitmap_size = parcel_mgr.mParcelsPerEdge
- * parcel_mgr.mParcelsPerEdge
- / 8;
- U8* bitmap = new U8[ bitmap_size ];
- msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
-
- parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
- parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mHighlightSegments );
-
- delete[] bitmap;
- bitmap = NULL;
-
- parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE;
- }
-
- // Request access list information for this land
- parcel_mgr.sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_ALLOW_EXPERIENCE | AL_BLOCK_EXPERIENCE);
-
- // Request dwell for this land, if it's not public land.
- parcel_mgr.mSelectedDwell = DWELL_NAN;
- if (0 != local_id)
- {
- parcel_mgr.sendParcelDwellRequest();
- }
-
- parcel_mgr.mSelected = TRUE;
- parcel_mgr.notifyObservers();
- }
- }
- else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID ||
- sequence_id == COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID ||
- sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
- {
- // We're about to collide with this parcel
+ }
+
+ // Handle updating selections, if necessary.
+ if (sequence_id == SELECTED_PARCEL_SEQ_ID)
+ {
+ // Update selected counts
+ parcel_mgr.mCurrentParcelSelection->mSelectedSelfCount = self_count;
+ parcel_mgr.mCurrentParcelSelection->mSelectedOtherCount = other_count;
+ parcel_mgr.mCurrentParcelSelection->mSelectedPublicCount = public_count;
+
+ parcel_mgr.mCurrentParcelSelection->mSelectedMultipleOwners =
+ (request_result == PARCEL_RESULT_MULTIPLE);
+
+ // Select the whole parcel
+ LLViewerRegion* region = LLWorld::getInstance()->getRegion( msg->getSender() );
+ if (region)
+ {
+ if (!snap_selection)
+ {
+ // don't muck with the westsouth and eastnorth.
+ // just highlight it
+ LLVector3 west_south = region->getPosRegionFromGlobal(parcel_mgr.mWestSouth);
+ LLVector3 east_north = region->getPosRegionFromGlobal(parcel_mgr.mEastNorth);
+
+ parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
+ parcel_mgr.writeHighlightSegments(
+ west_south.mV[VX],
+ west_south.mV[VY],
+ east_north.mV[VX],
+ east_north.mV[VY] );
+ parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = FALSE;
+ }
+ else if (0 == local_id)
+ {
+ // this is public land, just highlight the selection
+ parcel_mgr.mWestSouth = region->getPosGlobalFromRegion( aabb_min );
+ parcel_mgr.mEastNorth = region->getPosGlobalFromRegion( aabb_max );
+
+ parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
+ parcel_mgr.writeHighlightSegments(
+ aabb_min.mV[VX],
+ aabb_min.mV[VY],
+ aabb_max.mV[VX],
+ aabb_max.mV[VY] );
+ parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE;
+ }
+ else
+ {
+ parcel_mgr.mWestSouth = region->getPosGlobalFromRegion( aabb_min );
+ parcel_mgr.mEastNorth = region->getPosGlobalFromRegion( aabb_max );
+
+ // Owned land, highlight the boundaries
+ S32 bitmap_size = parcel_mgr.mParcelsPerEdge
+ * parcel_mgr.mParcelsPerEdge
+ / 8;
+ U8* bitmap = new U8[ bitmap_size ];
+ msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
+
+ parcel_mgr.resetSegments(parcel_mgr.mHighlightSegments);
+ parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mHighlightSegments );
+
+ delete[] bitmap;
+ bitmap = NULL;
+
+ parcel_mgr.mCurrentParcelSelection->mWholeParcelSelected = TRUE;
+ }
+
+ // Request access list information for this land
+ parcel_mgr.sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_ALLOW_EXPERIENCE | AL_BLOCK_EXPERIENCE);
+
+ // Request dwell for this land, if it's not public land.
+ parcel_mgr.mSelectedDwell = DWELL_NAN;
+ if (0 != local_id)
+ {
+ parcel_mgr.sendParcelDwellRequest();
+ }
+
+ parcel_mgr.mSelected = TRUE;
+ parcel_mgr.notifyObservers();
+ }
+ }
+ else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID ||
+ sequence_id == COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID ||
+ sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
+ {
+ // We're about to collide with this parcel
static LLCachedControl<S32> ban_lines_mode(gSavedSettings , "ShowBanLines" , PARCEL_BAN_LINES_ON_COLLISION);
if (ban_lines_mode == PARCEL_BAN_LINES_ON_PROXIMITY)
{
parcel_mgr.resetCollisionTimer();
}
- // Differentiate this parcel if we are banned from it.
- if (sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
- {
- parcel_mgr.mCollisionBanned = BA_BANNED;
- }
- else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID)
- {
- parcel_mgr.mCollisionBanned = BA_NOT_IN_GROUP;
- }
- else
- {
- parcel_mgr.mCollisionBanned = BA_NOT_ON_LIST;
-
- }
-
- S32 bitmap_size = parcel_mgr.mParcelsPerEdge
- * parcel_mgr.mParcelsPerEdge
- / 8;
- U8* bitmap = new U8[ bitmap_size ];
- msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
-
- parcel_mgr.resetSegments(parcel_mgr.mCollisionSegments);
- parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mCollisionSegments );
-
- delete[] bitmap;
- bitmap = NULL;
-
- }
- else if (sequence_id == HOVERED_PARCEL_SEQ_ID)
- {
- LLViewerRegion *region = LLWorld::getInstance()->getRegion( msg->getSender() );
- if (region)
- {
- parcel_mgr.mHoverWestSouth = region->getPosGlobalFromRegion( aabb_min );
- parcel_mgr.mHoverEastNorth = region->getPosGlobalFromRegion( aabb_max );
- }
- else
- {
- parcel_mgr.mHoverWestSouth.clearVec();
- parcel_mgr.mHoverEastNorth.clearVec();
- }
- }
- else
- {
+ // Differentiate this parcel if we are banned from it.
+ if (sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
+ {
+ parcel_mgr.mCollisionBanned = BA_BANNED;
+ }
+ else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID)
+ {
+ parcel_mgr.mCollisionBanned = BA_NOT_IN_GROUP;
+ }
+ else
+ {
+ parcel_mgr.mCollisionBanned = BA_NOT_ON_LIST;
+
+ }
+
+ S32 bitmap_size = parcel_mgr.mParcelsPerEdge
+ * parcel_mgr.mParcelsPerEdge
+ / 8;
+ U8* bitmap = new U8[ bitmap_size ];
+ msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size);
+
+ parcel_mgr.resetSegments(parcel_mgr.mCollisionSegments);
+ parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mCollisionSegments );
+
+ delete[] bitmap;
+ bitmap = NULL;
+
+ }
+ else if (sequence_id == HOVERED_PARCEL_SEQ_ID)
+ {
+ LLViewerRegion *region = LLWorld::getInstance()->getRegion( msg->getSender() );
+ if (region)
+ {
+ parcel_mgr.mHoverWestSouth = region->getPosGlobalFromRegion( aabb_min );
+ parcel_mgr.mHoverEastNorth = region->getPosGlobalFromRegion( aabb_max );
+ }
+ else
+ {
+ parcel_mgr.mHoverWestSouth.clearVec();
+ parcel_mgr.mHoverEastNorth.clearVec();
+ }
+ }
+ else
+ {
if (gNonInteractive)
{
return;
}
-
+
// Check for video
LLViewerParcelMedia::getInstance()->update(parcel);
- // Then check for music
- if (gAudiop)
- {
- if (parcel)
- {
+ // Then check for music
+ if (gAudiop)
+ {
+ if (parcel)
+ {
// Only update stream if parcel changed (recreated) or music is playing (enabled)
static LLCachedControl<bool> already_playing(gSavedSettings, "MediaTentativeAutoPlay", true);
if (!agent_parcel_update || already_playing)
@@ -1952,15 +1952,15 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
}
}
- }
- else
- {
- // Public land has no music
- LLViewerParcelAskPlay::getInstance()->cancelNotification();
- LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
- }
- }//if gAudiop
- };
+ }
+ else
+ {
+ // Public land has no music
+ LLViewerParcelAskPlay::getInstance()->cancelNotification();
+ LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
+ }
+ }//if gAudiop
+ };
}
//static
@@ -1979,14 +1979,14 @@ void LLViewerParcelMgr::onStartMusicResponse(const LLUUID &region_id, const S32
void LLViewerParcelMgr::optionallyStartMusic(const std::string &music_url, const S32 &local_id, const LLUUID &region_id, bool switched_parcel)
{
- static LLCachedControl<bool> streaming_music(gSavedSettings, "AudioStreamingMusic", true);
- if (streaming_music)
- {
- static LLCachedControl<S32> autoplay_mode(gSavedSettings, "ParcelMediaAutoPlayEnable", 1);
- static LLCachedControl<bool> tentative_autoplay(gSavedSettings, "MediaTentativeAutoPlay", true);
- // only play music when you enter a new parcel if the UI control for this
- // was not *explicitly* stopped by the user. (part of SL-4878)
- LLPanelNearByMedia* nearby_media_panel = gStatusBar ? gStatusBar->getNearbyMediaPanel() : NULL;
+ static LLCachedControl<bool> streaming_music(gSavedSettings, "AudioStreamingMusic", true);
+ if (streaming_music)
+ {
+ static LLCachedControl<S32> autoplay_mode(gSavedSettings, "ParcelMediaAutoPlayEnable", 1);
+ static LLCachedControl<bool> tentative_autoplay(gSavedSettings, "MediaTentativeAutoPlay", true);
+ // only play music when you enter a new parcel if the UI control for this
+ // was not *explicitly* stopped by the user. (part of SL-4878)
+ LLPanelNearByMedia* nearby_media_panel = gStatusBar ? gStatusBar->getNearbyMediaPanel() : NULL;
LLViewerAudio* viewer_audio = LLViewerAudio::getInstance();
// ask mode //todo constants
@@ -2025,639 +2025,639 @@ void LLViewerParcelMgr::optionallyStartMusic(const std::string &music_url, const
|| (!nearby_media_panel
&& autoplay_mode == 1
&& tentative_autoplay))
- {
- LL_INFOS("ParcelMgr") << "Starting parcel music " << music_url << LL_ENDL;
- viewer_audio->startInternetStreamWithAutoFade(music_url);
- }
- // autoplay off
- else if(switched_parcel || music_url != viewer_audio->getNextStreamURI())
- {
- viewer_audio->startInternetStreamWithAutoFade(LLStringUtil::null);
- }
- }
+ {
+ LL_INFOS("ParcelMgr") << "Starting parcel music " << music_url << LL_ENDL;
+ viewer_audio->startInternetStreamWithAutoFade(music_url);
+ }
+ // autoplay off
+ else if(switched_parcel || music_url != viewer_audio->getNextStreamURI())
+ {
+ viewer_audio->startInternetStreamWithAutoFade(LLStringUtil::null);
+ }
+ }
}
// static
void LLViewerParcelMgr::processParcelAccessListReply(LLMessageSystem *msg, void **user)
{
- LLUUID agent_id;
- S32 sequence_id = 0;
- U32 message_flags = 0x0;
- S32 parcel_id = -1;
-
- msg->getUUIDFast(_PREHASH_Data, _PREHASH_AgentID, agent_id);
- msg->getS32Fast( _PREHASH_Data, _PREHASH_SequenceID, sequence_id ); //ignored
- msg->getU32Fast( _PREHASH_Data, _PREHASH_Flags, message_flags);
- msg->getS32Fast( _PREHASH_Data, _PREHASH_LocalID, parcel_id);
-
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->mCurrentParcel;
- if (!parcel) return;
-
- if (parcel_id != parcel->getLocalID())
- {
- LL_WARNS_ONCE("ParcelMgr") << "processParcelAccessListReply for parcel " << parcel_id
- << " which isn't the selected parcel " << parcel->getLocalID()<< LL_ENDL;
- return;
- }
-
- if (message_flags & AL_ACCESS)
- {
- parcel->unpackAccessEntries(msg, &(parcel->mAccessList) );
- }
- else if (message_flags & AL_BAN)
- {
- parcel->unpackAccessEntries(msg, &(parcel->mBanList) );
- }
- else if (message_flags & AL_ALLOW_EXPERIENCE)
- {
- parcel->unpackExperienceEntries(msg, EXPERIENCE_KEY_TYPE_ALLOWED);
- }
- else if (message_flags & AL_BLOCK_EXPERIENCE)
- {
- parcel->unpackExperienceEntries(msg, EXPERIENCE_KEY_TYPE_BLOCKED);
- }
- /*else if (message_flags & AL_RENTER)
- {
- parcel->unpackAccessEntries(msg, &(parcel->mRenterList) );
- }*/
-
- LLViewerParcelMgr::getInstance()->notifyObservers();
+ LLUUID agent_id;
+ S32 sequence_id = 0;
+ U32 message_flags = 0x0;
+ S32 parcel_id = -1;
+
+ msg->getUUIDFast(_PREHASH_Data, _PREHASH_AgentID, agent_id);
+ msg->getS32Fast( _PREHASH_Data, _PREHASH_SequenceID, sequence_id ); //ignored
+ msg->getU32Fast( _PREHASH_Data, _PREHASH_Flags, message_flags);
+ msg->getS32Fast( _PREHASH_Data, _PREHASH_LocalID, parcel_id);
+
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->mCurrentParcel;
+ if (!parcel) return;
+
+ if (parcel_id != parcel->getLocalID())
+ {
+ LL_WARNS_ONCE("ParcelMgr") << "processParcelAccessListReply for parcel " << parcel_id
+ << " which isn't the selected parcel " << parcel->getLocalID()<< LL_ENDL;
+ return;
+ }
+
+ if (message_flags & AL_ACCESS)
+ {
+ parcel->unpackAccessEntries(msg, &(parcel->mAccessList) );
+ }
+ else if (message_flags & AL_BAN)
+ {
+ parcel->unpackAccessEntries(msg, &(parcel->mBanList) );
+ }
+ else if (message_flags & AL_ALLOW_EXPERIENCE)
+ {
+ parcel->unpackExperienceEntries(msg, EXPERIENCE_KEY_TYPE_ALLOWED);
+ }
+ else if (message_flags & AL_BLOCK_EXPERIENCE)
+ {
+ parcel->unpackExperienceEntries(msg, EXPERIENCE_KEY_TYPE_BLOCKED);
+ }
+ /*else if (message_flags & AL_RENTER)
+ {
+ parcel->unpackAccessEntries(msg, &(parcel->mRenterList) );
+ }*/
+
+ LLViewerParcelMgr::getInstance()->notifyObservers();
}
// static
void LLViewerParcelMgr::processParcelDwellReply(LLMessageSystem* msg, void**)
{
- LLUUID agent_id;
- msg->getUUID("AgentData", "AgentID", agent_id);
+ LLUUID agent_id;
+ msg->getUUID("AgentData", "AgentID", agent_id);
- S32 local_id;
- msg->getS32("Data", "LocalID", local_id);
+ S32 local_id;
+ msg->getS32("Data", "LocalID", local_id);
- LLUUID parcel_id;
- msg->getUUID("Data", "ParcelID", parcel_id);
+ LLUUID parcel_id;
+ msg->getUUID("Data", "ParcelID", parcel_id);
- F32 dwell;
- msg->getF32("Data", "Dwell", dwell);
+ F32 dwell;
+ msg->getF32("Data", "Dwell", dwell);
- if (local_id == LLViewerParcelMgr::getInstance()->mCurrentParcel->getLocalID())
- {
- LLViewerParcelMgr::getInstance()->mSelectedDwell = dwell;
- LLViewerParcelMgr::getInstance()->notifyObservers();
- }
+ if (local_id == LLViewerParcelMgr::getInstance()->mCurrentParcel->getLocalID())
+ {
+ LLViewerParcelMgr::getInstance()->mSelectedDwell = dwell;
+ LLViewerParcelMgr::getInstance()->notifyObservers();
+ }
}
void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which)
{
- if (!mSelected)
- {
- return;
- }
+ if (!mSelected)
+ {
+ return;
+ }
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
- if (!region) return;
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
+ if (!region) return;
- LLParcel* parcel = mCurrentParcel;
- if (!parcel) return;
+ LLParcel* parcel = mCurrentParcel;
+ if (!parcel) return;
- if (which & AL_ACCESS)
- {
- sendParcelAccessListUpdate(AL_ACCESS, parcel->mAccessList, region, parcel->getLocalID());
- }
+ if (which & AL_ACCESS)
+ {
+ sendParcelAccessListUpdate(AL_ACCESS, parcel->mAccessList, region, parcel->getLocalID());
+ }
- if (which & AL_BAN)
- {
- sendParcelAccessListUpdate(AL_BAN, parcel->mBanList, region, parcel->getLocalID());
- }
+ if (which & AL_BAN)
+ {
+ sendParcelAccessListUpdate(AL_BAN, parcel->mBanList, region, parcel->getLocalID());
+ }
- if(which & AL_ALLOW_EXPERIENCE)
- {
- sendParcelAccessListUpdate(AL_ALLOW_EXPERIENCE, parcel->getExperienceKeysByType(EXPERIENCE_KEY_TYPE_ALLOWED), region, parcel->getLocalID());
- }
- if(which & AL_BLOCK_EXPERIENCE)
- {
- sendParcelAccessListUpdate(AL_BLOCK_EXPERIENCE, parcel->getExperienceKeysByType(EXPERIENCE_KEY_TYPE_BLOCKED), region, parcel->getLocalID());
- }
+ if(which & AL_ALLOW_EXPERIENCE)
+ {
+ sendParcelAccessListUpdate(AL_ALLOW_EXPERIENCE, parcel->getExperienceKeysByType(EXPERIENCE_KEY_TYPE_ALLOWED), region, parcel->getLocalID());
+ }
+ if(which & AL_BLOCK_EXPERIENCE)
+ {
+ sendParcelAccessListUpdate(AL_BLOCK_EXPERIENCE, parcel->getExperienceKeysByType(EXPERIENCE_KEY_TYPE_BLOCKED), region, parcel->getLocalID());
+ }
}
void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 flags, const LLAccessEntry::map& entries, LLViewerRegion* region, S32 parcel_local_id)
{
- S32 count = entries.size();
- S32 num_sections = (S32) ceil(count/PARCEL_MAX_ENTRIES_PER_PACKET);
- S32 sequence_id = 1;
- BOOL start_message = TRUE;
- BOOL initial = TRUE;
-
- LLUUID transactionUUID;
- transactionUUID.generate();
-
-
- LLMessageSystem* msg = gMessageSystem;
-
- LLAccessEntry::map::const_iterator cit = entries.begin();
- LLAccessEntry::map::const_iterator end = entries.end();
- while ( (cit != end) || initial )
- {
- if (start_message)
- {
- msg->newMessageFast(_PREHASH_ParcelAccessListUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
- msg->nextBlockFast(_PREHASH_Data);
- msg->addU32Fast(_PREHASH_Flags, flags);
- msg->addS32(_PREHASH_LocalID, parcel_local_id);
- msg->addUUIDFast(_PREHASH_TransactionID, transactionUUID);
- msg->addS32Fast(_PREHASH_SequenceID, sequence_id);
- msg->addS32Fast(_PREHASH_Sections, num_sections);
- start_message = FALSE;
-
- if (initial && (cit == end))
- {
- // pack an empty block if there will be no data
- msg->nextBlockFast(_PREHASH_List);
- msg->addUUIDFast(_PREHASH_ID, LLUUID::null );
- msg->addS32Fast(_PREHASH_Time, 0 );
- msg->addU32Fast(_PREHASH_Flags, 0 );
- }
-
- initial = FALSE;
- sequence_id++;
-
- }
-
- while ( (cit != end) && (msg->getCurrentSendTotal() < MTUBYTES))
- {
- const LLAccessEntry& entry = (*cit).second;
-
- msg->nextBlockFast(_PREHASH_List);
- msg->addUUIDFast(_PREHASH_ID, entry.mID );
- msg->addS32Fast(_PREHASH_Time, entry.mTime );
- msg->addU32Fast(_PREHASH_Flags, entry.mFlags );
- ++cit;
- }
-
- start_message = TRUE;
- msg->sendReliable( region->getHost() );
- }
+ S32 count = entries.size();
+ S32 num_sections = (S32) ceil(count/PARCEL_MAX_ENTRIES_PER_PACKET);
+ S32 sequence_id = 1;
+ BOOL start_message = TRUE;
+ BOOL initial = TRUE;
+
+ LLUUID transactionUUID;
+ transactionUUID.generate();
+
+
+ LLMessageSystem* msg = gMessageSystem;
+
+ LLAccessEntry::map::const_iterator cit = entries.begin();
+ LLAccessEntry::map::const_iterator end = entries.end();
+ while ( (cit != end) || initial )
+ {
+ if (start_message)
+ {
+ msg->newMessageFast(_PREHASH_ParcelAccessListUpdate);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+ msg->nextBlockFast(_PREHASH_Data);
+ msg->addU32Fast(_PREHASH_Flags, flags);
+ msg->addS32(_PREHASH_LocalID, parcel_local_id);
+ msg->addUUIDFast(_PREHASH_TransactionID, transactionUUID);
+ msg->addS32Fast(_PREHASH_SequenceID, sequence_id);
+ msg->addS32Fast(_PREHASH_Sections, num_sections);
+ start_message = FALSE;
+
+ if (initial && (cit == end))
+ {
+ // pack an empty block if there will be no data
+ msg->nextBlockFast(_PREHASH_List);
+ msg->addUUIDFast(_PREHASH_ID, LLUUID::null );
+ msg->addS32Fast(_PREHASH_Time, 0 );
+ msg->addU32Fast(_PREHASH_Flags, 0 );
+ }
+
+ initial = FALSE;
+ sequence_id++;
+
+ }
+
+ while ( (cit != end) && (msg->getCurrentSendTotal() < MTUBYTES))
+ {
+ const LLAccessEntry& entry = (*cit).second;
+
+ msg->nextBlockFast(_PREHASH_List);
+ msg->addUUIDFast(_PREHASH_ID, entry.mID );
+ msg->addS32Fast(_PREHASH_Time, entry.mTime );
+ msg->addU32Fast(_PREHASH_Flags, entry.mFlags );
+ ++cit;
+ }
+
+ start_message = TRUE;
+ msg->sendReliable( region->getHost() );
+ }
}
void LLViewerParcelMgr::deedLandToGroup()
{
- std::string group_name;
- gCacheName->getGroupName(mCurrentParcel->getGroupID(), group_name);
- LLSD args;
- args["AREA"] = llformat("%d", mCurrentParcel->getArea());
- args["GROUP_NAME"] = group_name;
- if(mCurrentParcel->getContributeWithDeed())
- {
- args["NAME"] = LLSLURL("agent", mCurrentParcel->getOwnerID(), "completename").getSLURLString();
- LLNotificationsUtil::add("DeedLandToGroupWithContribution",args, LLSD(), deedAlertCB);
- }
- else
- {
- LLNotificationsUtil::add("DeedLandToGroup",args, LLSD(), deedAlertCB);
- }
+ std::string group_name;
+ gCacheName->getGroupName(mCurrentParcel->getGroupID(), group_name);
+ LLSD args;
+ args["AREA"] = llformat("%d", mCurrentParcel->getArea());
+ args["GROUP_NAME"] = group_name;
+ if(mCurrentParcel->getContributeWithDeed())
+ {
+ args["NAME"] = LLSLURL("agent", mCurrentParcel->getOwnerID(), "completename").getSLURLString();
+ LLNotificationsUtil::add("DeedLandToGroupWithContribution",args, LLSD(), deedAlertCB);
+ }
+ else
+ {
+ LLNotificationsUtil::add("DeedLandToGroup",args, LLSD(), deedAlertCB);
+ }
}
// static
bool LLViewerParcelMgr::deedAlertCB(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
- LLUUID group_id;
- if(parcel)
- {
- group_id = parcel->getGroupID();
- }
- LLViewerParcelMgr::getInstance()->sendParcelDeed(group_id);
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+ LLUUID group_id;
+ if(parcel)
+ {
+ group_id = parcel->getGroupID();
+ }
+ LLViewerParcelMgr::getInstance()->sendParcelDeed(group_id);
+ }
+ return false;
}
void LLViewerParcelMgr::startReleaseLand()
{
- if (!mSelected)
- {
- LLNotificationsUtil::add("CannotReleaseLandNothingSelected");
- return;
- }
-
- if (mRequestResult == PARCEL_RESULT_NO_DATA)
- {
- LLNotificationsUtil::add("CannotReleaseLandWatingForServer");
- return;
- }
-
- if (mRequestResult == PARCEL_RESULT_MULTIPLE)
- {
- LLNotificationsUtil::add("CannotReleaseLandSelected");
- return;
- }
-
- if (!isParcelOwnedByAgent(mCurrentParcel, GP_LAND_RELEASE)
- && !(gAgent.canManageEstate()))
- {
- LLNotificationsUtil::add("CannotReleaseLandDontOwn");
- return;
- }
-
- LLVector3d parcel_center = (mWestSouth + mEastNorth) / 2.0;
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center);
- if (!region)
- {
- LLNotificationsUtil::add("CannotReleaseLandRegionNotFound");
- return;
- }
+ if (!mSelected)
+ {
+ LLNotificationsUtil::add("CannotReleaseLandNothingSelected");
+ return;
+ }
+
+ if (mRequestResult == PARCEL_RESULT_NO_DATA)
+ {
+ LLNotificationsUtil::add("CannotReleaseLandWatingForServer");
+ return;
+ }
+
+ if (mRequestResult == PARCEL_RESULT_MULTIPLE)
+ {
+ LLNotificationsUtil::add("CannotReleaseLandSelected");
+ return;
+ }
+
+ if (!isParcelOwnedByAgent(mCurrentParcel, GP_LAND_RELEASE)
+ && !(gAgent.canManageEstate()))
+ {
+ LLNotificationsUtil::add("CannotReleaseLandDontOwn");
+ return;
+ }
+
+ LLVector3d parcel_center = (mWestSouth + mEastNorth) / 2.0;
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center);
+ if (!region)
+ {
+ LLNotificationsUtil::add("CannotReleaseLandRegionNotFound");
+ return;
+ }
/*
- if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)
- && !gAgent.isGodlike())
- {
- LLSD args;
- args["REGION"] = region->getName();
- LLNotificationsUtil::add("CannotReleaseLandNoTransfer", args);
- return;
- }
+ if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)
+ && !gAgent.isGodlike())
+ {
+ LLSD args;
+ args["REGION"] = region->getName();
+ LLNotificationsUtil::add("CannotReleaseLandNoTransfer", args);
+ return;
+ }
*/
- if (!mCurrentParcelSelection->mWholeParcelSelected)
- {
- LLNotificationsUtil::add("CannotReleaseLandPartialSelection");
- return;
- }
+ if (!mCurrentParcelSelection->mWholeParcelSelected)
+ {
+ LLNotificationsUtil::add("CannotReleaseLandPartialSelection");
+ return;
+ }
- // Compute claim price
- LLSD args;
- args["AREA"] = llformat("%d",mCurrentParcel->getArea());
- LLNotificationsUtil::add("ReleaseLandWarning", args, LLSD(), releaseAlertCB);
+ // Compute claim price
+ LLSD args;
+ args["AREA"] = llformat("%d",mCurrentParcel->getArea());
+ LLNotificationsUtil::add("ReleaseLandWarning", args, LLSD(), releaseAlertCB);
}
bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const
{
- if (!parcel)
- {
- return false;
- }
-
- if (mSelected && parcel == mCurrentParcel)
- {
- if (mRequestResult == PARCEL_RESULT_NO_DATA)
- {
- return false;
- }
- }
-
- const LLUUID& parcelOwner = parcel->getOwnerID();
- const LLUUID& authorizeBuyer = parcel->getAuthorizedBuyerID();
-
- if (parcel->isPublic())
- {
- return true; // change this if want to make it gods only
- }
-
- LLVector3 parcel_coord = parcel->getCenterpoint();
- LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosAgent(parcel_coord);
- if (regionp)
- {
- U8 sim_access = regionp->getSimAccess();
- const LLAgentAccess& agent_access = gAgent.getAgentAccess();
- // if the region is PG, we're happy already, so do nothing
- // but if we're set to avoid either mature or adult, get us outta here
- if ((sim_access == SIM_ACCESS_MATURE) &&
- !agent_access.canAccessMature())
- {
- return false;
- }
- else if ((sim_access == SIM_ACCESS_ADULT) &&
- !agent_access.canAccessAdult())
- {
- return false;
- }
- }
-
- bool isForSale = parcel->getForSale()
- && ((parcel->getSalePrice() > 0) || (authorizeBuyer.notNull()));
-
- bool isEmpowered
- = forGroup ? gAgent.hasPowerInActiveGroup(GP_LAND_DEED) == TRUE : true;
-
- bool isOwner
- = parcelOwner == (forGroup ? gAgent.getGroupID() : gAgent.getID());
-
- bool isAuthorized
- = (authorizeBuyer.isNull()
- || (gAgent.getID() == authorizeBuyer)
- || (gAgent.hasPowerInGroup(authorizeBuyer,GP_LAND_DEED)
- && gAgent.hasPowerInGroup(authorizeBuyer,GP_LAND_SET_SALE_INFO)));
-
- return isForSale && !isOwner && isAuthorized && isEmpowered;
+ if (!parcel)
+ {
+ return false;
+ }
+
+ if (mSelected && parcel == mCurrentParcel)
+ {
+ if (mRequestResult == PARCEL_RESULT_NO_DATA)
+ {
+ return false;
+ }
+ }
+
+ const LLUUID& parcelOwner = parcel->getOwnerID();
+ const LLUUID& authorizeBuyer = parcel->getAuthorizedBuyerID();
+
+ if (parcel->isPublic())
+ {
+ return true; // change this if want to make it gods only
+ }
+
+ LLVector3 parcel_coord = parcel->getCenterpoint();
+ LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosAgent(parcel_coord);
+ if (regionp)
+ {
+ U8 sim_access = regionp->getSimAccess();
+ const LLAgentAccess& agent_access = gAgent.getAgentAccess();
+ // if the region is PG, we're happy already, so do nothing
+ // but if we're set to avoid either mature or adult, get us outta here
+ if ((sim_access == SIM_ACCESS_MATURE) &&
+ !agent_access.canAccessMature())
+ {
+ return false;
+ }
+ else if ((sim_access == SIM_ACCESS_ADULT) &&
+ !agent_access.canAccessAdult())
+ {
+ return false;
+ }
+ }
+
+ bool isForSale = parcel->getForSale()
+ && ((parcel->getSalePrice() > 0) || (authorizeBuyer.notNull()));
+
+ bool isEmpowered
+ = forGroup ? gAgent.hasPowerInActiveGroup(GP_LAND_DEED) == TRUE : true;
+
+ bool isOwner
+ = parcelOwner == (forGroup ? gAgent.getGroupID() : gAgent.getID());
+
+ bool isAuthorized
+ = (authorizeBuyer.isNull()
+ || (gAgent.getID() == authorizeBuyer)
+ || (gAgent.hasPowerInGroup(authorizeBuyer,GP_LAND_DEED)
+ && gAgent.hasPowerInGroup(authorizeBuyer,GP_LAND_SET_SALE_INFO)));
+
+ return isForSale && !isOwner && isAuthorized && isEmpowered;
}
void LLViewerParcelMgr::startBuyLand(BOOL is_for_group)
{
- LLFloaterBuyLand::buyLand(getSelectionRegion(), mCurrentParcelSelection, is_for_group == TRUE);
+ LLFloaterBuyLand::buyLand(getSelectionRegion(), mCurrentParcelSelection, is_for_group == TRUE);
}
void LLViewerParcelMgr::startSellLand()
{
- LLFloaterSellLand::sellLand(getSelectionRegion(), mCurrentParcelSelection);
+ LLFloaterSellLand::sellLand(getSelectionRegion(), mCurrentParcelSelection);
}
void LLViewerParcelMgr::startDivideLand()
{
- if (!mSelected)
- {
- LLNotificationsUtil::add("CannotDivideLandNothingSelected");
- return;
- }
+ if (!mSelected)
+ {
+ LLNotificationsUtil::add("CannotDivideLandNothingSelected");
+ return;
+ }
- if (mCurrentParcelSelection->mWholeParcelSelected)
- {
- LLNotificationsUtil::add("CannotDivideLandPartialSelection");
- return;
- }
+ if (mCurrentParcelSelection->mWholeParcelSelected)
+ {
+ LLNotificationsUtil::add("CannotDivideLandPartialSelection");
+ return;
+ }
- LLSD payload;
- payload["west_south_border"] = ll_sd_from_vector3d(mWestSouth);
- payload["east_north_border"] = ll_sd_from_vector3d(mEastNorth);
+ LLSD payload;
+ payload["west_south_border"] = ll_sd_from_vector3d(mWestSouth);
+ payload["east_north_border"] = ll_sd_from_vector3d(mEastNorth);
- LLNotificationsUtil::add("LandDivideWarning", LLSD(), payload, callbackDivideLand);
+ LLNotificationsUtil::add("LandDivideWarning", LLSD(), payload, callbackDivideLand);
}
// static
bool LLViewerParcelMgr::callbackDivideLand(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLVector3d west_south_d = ll_vector3d_from_sd(notification["payload"]["west_south_border"]);
- LLVector3d east_north_d = ll_vector3d_from_sd(notification["payload"]["east_north_border"]);
- LLVector3d parcel_center = (west_south_d + east_north_d) / 2.0;
-
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center);
- if (!region)
- {
- LLNotificationsUtil::add("CannotDivideLandNoRegion");
- return false;
- }
-
- if (0 == option)
- {
- LLVector3 west_south = region->getPosRegionFromGlobal(west_south_d);
- LLVector3 east_north = region->getPosRegionFromGlobal(east_north_d);
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ParcelDivide");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("ParcelData");
- msg->addF32("West", west_south.mV[VX]);
- msg->addF32("South", west_south.mV[VY]);
- msg->addF32("East", east_north.mV[VX]);
- msg->addF32("North", east_north.mV[VY]);
- msg->sendReliable(region->getHost());
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLVector3d west_south_d = ll_vector3d_from_sd(notification["payload"]["west_south_border"]);
+ LLVector3d east_north_d = ll_vector3d_from_sd(notification["payload"]["east_north_border"]);
+ LLVector3d parcel_center = (west_south_d + east_north_d) / 2.0;
+
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center);
+ if (!region)
+ {
+ LLNotificationsUtil::add("CannotDivideLandNoRegion");
+ return false;
+ }
+
+ if (0 == option)
+ {
+ LLVector3 west_south = region->getPosRegionFromGlobal(west_south_d);
+ LLVector3 east_north = region->getPosRegionFromGlobal(east_north_d);
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ParcelDivide");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("ParcelData");
+ msg->addF32("West", west_south.mV[VX]);
+ msg->addF32("South", west_south.mV[VY]);
+ msg->addF32("East", east_north.mV[VX]);
+ msg->addF32("North", east_north.mV[VY]);
+ msg->sendReliable(region->getHost());
+ }
+ return false;
}
void LLViewerParcelMgr::startJoinLand()
{
- if (!mSelected)
- {
- LLNotificationsUtil::add("CannotJoinLandNothingSelected");
- return;
- }
+ if (!mSelected)
+ {
+ LLNotificationsUtil::add("CannotJoinLandNothingSelected");
+ return;
+ }
- if (mCurrentParcelSelection->mWholeParcelSelected)
- {
- LLNotificationsUtil::add("CannotJoinLandEntireParcelSelected");
- return;
- }
+ if (mCurrentParcelSelection->mWholeParcelSelected)
+ {
+ LLNotificationsUtil::add("CannotJoinLandEntireParcelSelected");
+ return;
+ }
- if (!mCurrentParcelSelection->mSelectedMultipleOwners)
- {
- LLNotificationsUtil::add("CannotJoinLandSelection");
- return;
- }
+ if (!mCurrentParcelSelection->mSelectedMultipleOwners)
+ {
+ LLNotificationsUtil::add("CannotJoinLandSelection");
+ return;
+ }
- LLSD payload;
- payload["west_south_border"] = ll_sd_from_vector3d(mWestSouth);
- payload["east_north_border"] = ll_sd_from_vector3d(mEastNorth);
+ LLSD payload;
+ payload["west_south_border"] = ll_sd_from_vector3d(mWestSouth);
+ payload["east_north_border"] = ll_sd_from_vector3d(mEastNorth);
- LLNotificationsUtil::add("JoinLandWarning", LLSD(), payload, callbackJoinLand);
+ LLNotificationsUtil::add("JoinLandWarning", LLSD(), payload, callbackJoinLand);
}
// static
bool LLViewerParcelMgr::callbackJoinLand(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLVector3d west_south_d = ll_vector3d_from_sd(notification["payload"]["west_south_border"]);
- LLVector3d east_north_d = ll_vector3d_from_sd(notification["payload"]["east_north_border"]);
- LLVector3d parcel_center = (west_south_d + east_north_d) / 2.0;
-
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center);
- if (!region)
- {
- LLNotificationsUtil::add("CannotJoinLandNoRegion");
- return false;
- }
-
- if (0 == option)
- {
- LLVector3 west_south = region->getPosRegionFromGlobal(west_south_d);
- LLVector3 east_north = region->getPosRegionFromGlobal(east_north_d);
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ParcelJoin");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("ParcelData");
- msg->addF32("West", west_south.mV[VX]);
- msg->addF32("South", west_south.mV[VY]);
- msg->addF32("East", east_north.mV[VX]);
- msg->addF32("North", east_north.mV[VY]);
- msg->sendReliable(region->getHost());
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ LLVector3d west_south_d = ll_vector3d_from_sd(notification["payload"]["west_south_border"]);
+ LLVector3d east_north_d = ll_vector3d_from_sd(notification["payload"]["east_north_border"]);
+ LLVector3d parcel_center = (west_south_d + east_north_d) / 2.0;
+
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center);
+ if (!region)
+ {
+ LLNotificationsUtil::add("CannotJoinLandNoRegion");
+ return false;
+ }
+
+ if (0 == option)
+ {
+ LLVector3 west_south = region->getPosRegionFromGlobal(west_south_d);
+ LLVector3 east_north = region->getPosRegionFromGlobal(east_north_d);
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ParcelJoin");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("ParcelData");
+ msg->addF32("West", west_south.mV[VX]);
+ msg->addF32("South", west_south.mV[VY]);
+ msg->addF32("East", east_north.mV[VX]);
+ msg->addF32("North", east_north.mV[VY]);
+ msg->sendReliable(region->getHost());
+ }
+ return false;
}
void LLViewerParcelMgr::startDeedLandToGroup()
{
- if (!mSelected || !mCurrentParcel)
- {
- LLNotificationsUtil::add("CannotDeedLandNothingSelected");
- return;
- }
-
- if (mRequestResult == PARCEL_RESULT_NO_DATA)
- {
- LLNotificationsUtil::add("CannotDeedLandWaitingForServer");
- return;
- }
-
- if (mRequestResult == PARCEL_RESULT_MULTIPLE)
- {
- LLNotificationsUtil::add("CannotDeedLandMultipleSelected");
- return;
- }
-
- LLVector3d parcel_center = (mWestSouth + mEastNorth) / 2.0;
- LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center);
- if (!region)
- {
- LLNotificationsUtil::add("CannotDeedLandNoRegion");
- return;
- }
-
- /*
- if(!gAgent.isGodlike())
- {
- if(region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)
- && (mCurrentParcel->getOwnerID() != region->getOwner()))
- {
- LLSD args;
- args["REGION"] = region->getName();
- LLNotificationsUtil::add("CannotDeedLandNoTransfer", args);
- return;
- }
- }
- */
-
- deedLandToGroup();
+ if (!mSelected || !mCurrentParcel)
+ {
+ LLNotificationsUtil::add("CannotDeedLandNothingSelected");
+ return;
+ }
+
+ if (mRequestResult == PARCEL_RESULT_NO_DATA)
+ {
+ LLNotificationsUtil::add("CannotDeedLandWaitingForServer");
+ return;
+ }
+
+ if (mRequestResult == PARCEL_RESULT_MULTIPLE)
+ {
+ LLNotificationsUtil::add("CannotDeedLandMultipleSelected");
+ return;
+ }
+
+ LLVector3d parcel_center = (mWestSouth + mEastNorth) / 2.0;
+ LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center);
+ if (!region)
+ {
+ LLNotificationsUtil::add("CannotDeedLandNoRegion");
+ return;
+ }
+
+ /*
+ if(!gAgent.isGodlike())
+ {
+ if(region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)
+ && (mCurrentParcel->getOwnerID() != region->getOwner()))
+ {
+ LLSD args;
+ args["REGION"] = region->getName();
+ LLNotificationsUtil::add("CannotDeedLandNoTransfer", args);
+ return;
+ }
+ }
+ */
+
+ deedLandToGroup();
}
void LLViewerParcelMgr::reclaimParcel()
{
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
- LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if(parcel && parcel->getOwnerID().notNull()
- && (parcel->getOwnerID() != gAgent.getID())
- && regionp && (regionp->getOwner() == gAgent.getID()))
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ParcelReclaim");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addS32("LocalID", parcel->getLocalID());
- msg->sendReliable(regionp->getHost());
- }
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+ LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if(parcel && parcel->getOwnerID().notNull()
+ && (parcel->getOwnerID() != gAgent.getID())
+ && regionp && (regionp->getOwner() == gAgent.getID()))
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("ParcelReclaim");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addS32("LocalID", parcel->getLocalID());
+ msg->sendReliable(regionp->getHost());
+ }
}
// static
bool LLViewerParcelMgr::releaseAlertCB(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- // Send the release message, not a force
- LLViewerParcelMgr::getInstance()->sendParcelRelease();
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ // Send the release message, not a force
+ LLViewerParcelMgr::getInstance()->sendParcelRelease();
+ }
+ return false;
}
void LLViewerParcelMgr::buyPass()
{
- LLParcel* parcel = getParcelSelection()->getParcel();
- if (!parcel) return;
+ LLParcel* parcel = getParcelSelection()->getParcel();
+ if (!parcel) return;
- LLViewerRegion* region = getSelectionRegion();
- if (!region) return;
+ LLViewerRegion* region = getSelectionRegion();
+ if (!region) return;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ParcelBuyPass);
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() );
- msg->sendReliable( region->getHost() );
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ParcelBuyPass);
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() );
+ msg->sendReliable( region->getHost() );
}
//Tells whether we are allowed to buy a pass or not
-BOOL LLViewerParcelMgr::isCollisionBanned()
-{
- if ((mCollisionBanned == BA_ALLOWED) || (mCollisionBanned == BA_NOT_ON_LIST) || (mCollisionBanned == BA_NOT_IN_GROUP))
- return FALSE;
- else
- return TRUE;
+BOOL LLViewerParcelMgr::isCollisionBanned()
+{
+ if ((mCollisionBanned == BA_ALLOWED) || (mCollisionBanned == BA_NOT_ON_LIST) || (mCollisionBanned == BA_NOT_IN_GROUP))
+ return FALSE;
+ else
+ return TRUE;
}
// This implementation should mirror LLSimParcelMgr::isParcelOwnedBy
// static
BOOL LLViewerParcelMgr::isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power)
{
- if (!parcelp)
- {
- return FALSE;
- }
+ if (!parcelp)
+ {
+ return FALSE;
+ }
- // Gods can always assume ownership.
- if (gAgent.isGodlike())
- {
- return TRUE;
- }
+ // Gods can always assume ownership.
+ if (gAgent.isGodlike())
+ {
+ return TRUE;
+ }
- // The owner of a parcel automatically gets all powersr.
- if (parcelp->getOwnerID() == gAgent.getID())
- {
- return TRUE;
- }
+ // The owner of a parcel automatically gets all powersr.
+ if (parcelp->getOwnerID() == gAgent.getID())
+ {
+ return TRUE;
+ }
- // Only gods can assume 'ownership' of public land.
- if (parcelp->isPublic())
- {
- return FALSE;
- }
+ // Only gods can assume 'ownership' of public land.
+ if (parcelp->isPublic())
+ {
+ return FALSE;
+ }
- // Return whether or not the agent has group_proxy_power powers in the
- // parcel's group.
- return gAgent.hasPowerInGroup(parcelp->getOwnerID(), group_proxy_power);
+ // Return whether or not the agent has group_proxy_power powers in the
+ // parcel's group.
+ return gAgent.hasPowerInGroup(parcelp->getOwnerID(), group_proxy_power);
}
// This implementation should mirror llSimParcelMgr::isParcelModifiableBy
// static
BOOL LLViewerParcelMgr::isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power)
{
- // If the agent can assume ownership, it is probably modifiable.
- BOOL rv = FALSE;
- if (parcelp)
- {
- // *NOTE: This should only work for leased parcels, but group owned
- // parcels cannot be OS_LEASED yet. Phoenix 2003-12-15.
- rv = isParcelOwnedByAgent(parcelp, group_proxy_power);
-
- // ... except for the case that the parcel is not OS_LEASED for agent-owned parcels.
- if( (gAgent.getID() == parcelp->getOwnerID())
- && !gAgent.isGodlike()
- && (parcelp->getOwnershipStatus() != LLParcel::OS_LEASED) )
- {
- rv = FALSE;
- }
- }
- return rv;
+ // If the agent can assume ownership, it is probably modifiable.
+ BOOL rv = FALSE;
+ if (parcelp)
+ {
+ // *NOTE: This should only work for leased parcels, but group owned
+ // parcels cannot be OS_LEASED yet. Phoenix 2003-12-15.
+ rv = isParcelOwnedByAgent(parcelp, group_proxy_power);
+
+ // ... except for the case that the parcel is not OS_LEASED for agent-owned parcels.
+ if( (gAgent.getID() == parcelp->getOwnerID())
+ && !gAgent.isGodlike()
+ && (parcelp->getOwnershipStatus() != LLParcel::OS_LEASED) )
+ {
+ rv = FALSE;
+ }
+ }
+ return rv;
}
void sanitize_corners(const LLVector3d &corner1,
- const LLVector3d &corner2,
- LLVector3d &west_south_bottom,
- LLVector3d &east_north_top)
+ const LLVector3d &corner2,
+ LLVector3d &west_south_bottom,
+ LLVector3d &east_north_top)
{
- west_south_bottom.mdV[VX] = llmin( corner1.mdV[VX], corner2.mdV[VX] );
- west_south_bottom.mdV[VY] = llmin( corner1.mdV[VY], corner2.mdV[VY] );
- west_south_bottom.mdV[VZ] = llmin( corner1.mdV[VZ], corner2.mdV[VZ] );
+ west_south_bottom.mdV[VX] = llmin( corner1.mdV[VX], corner2.mdV[VX] );
+ west_south_bottom.mdV[VY] = llmin( corner1.mdV[VY], corner2.mdV[VY] );
+ west_south_bottom.mdV[VZ] = llmin( corner1.mdV[VZ], corner2.mdV[VZ] );
- east_north_top.mdV[VX] = llmax( corner1.mdV[VX], corner2.mdV[VX] );
- east_north_top.mdV[VY] = llmax( corner1.mdV[VY], corner2.mdV[VY] );
- east_north_top.mdV[VZ] = llmax( corner1.mdV[VZ], corner2.mdV[VZ] );
+ east_north_top.mdV[VX] = llmax( corner1.mdV[VX], corner2.mdV[VX] );
+ east_north_top.mdV[VY] = llmax( corner1.mdV[VY], corner2.mdV[VY] );
+ east_north_top.mdV[VZ] = llmax( corner1.mdV[VZ], corner2.mdV[VZ] );
}
@@ -2667,12 +2667,12 @@ void LLViewerParcelMgr::cleanupGlobals()
LLViewerTexture* LLViewerParcelMgr::getBlockedImage() const
{
- return sBlockedImage;
+ return sBlockedImage;
}
LLViewerTexture* LLViewerParcelMgr::getPassImage() const
{
- return sPassImage;
+ return sPassImage;
}
/*
@@ -2685,12 +2685,12 @@ LLViewerTexture* LLViewerParcelMgr::getPassImage() const
*/
boost::signals2::connection LLViewerParcelMgr::setTeleportFinishedCallback(teleport_finished_callback_t cb)
{
- return mTeleportFinishedSignal.connect(cb);
+ return mTeleportFinishedSignal.connect(cb);
}
boost::signals2::connection LLViewerParcelMgr::setTeleportFailedCallback(teleport_failed_callback_t cb)
{
- return mTeleportFailedSignal.connect(cb);
+ return mTeleportFailedSignal.connect(cb);
}
/* Ok, we're notified that teleport has been finished.
@@ -2699,26 +2699,26 @@ boost::signals2::connection LLViewerParcelMgr::setTeleportFailedCallback(telepor
*/
void LLViewerParcelMgr::onTeleportFinished(bool local, const LLVector3d& new_pos)
{
- // Treat only teleports within the same parcel as local (EXT-3139).
- if (local && LLViewerParcelMgr::getInstance()->inAgentParcel(new_pos))
- {
- // Local teleport. We already have the agent parcel data.
- // Emit the signal immediately.
- getInstance()->mTeleportFinishedSignal(new_pos, local);
- }
- else
- {
- // Non-local teleport (inter-region or between different parcels of the same region).
- // The agent parcel data has not been updated yet.
- // Let's wait for the update and then emit the signal.
- mTeleportInProgressPosition = new_pos;
- mTeleportInProgress = TRUE;
- }
+ // Treat only teleports within the same parcel as local (EXT-3139).
+ if (local && LLViewerParcelMgr::getInstance()->inAgentParcel(new_pos))
+ {
+ // Local teleport. We already have the agent parcel data.
+ // Emit the signal immediately.
+ getInstance()->mTeleportFinishedSignal(new_pos, local);
+ }
+ else
+ {
+ // Non-local teleport (inter-region or between different parcels of the same region).
+ // The agent parcel data has not been updated yet.
+ // Let's wait for the update and then emit the signal.
+ mTeleportInProgressPosition = new_pos;
+ mTeleportInProgress = TRUE;
+ }
}
void LLViewerParcelMgr::onTeleportFailed()
{
- mTeleportFailedSignal();
+ mTeleportFailedSignal();
}
bool LLViewerParcelMgr::getTeleportInProgress()
diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h
index 56dacd3efd..0394004b38 100644
--- a/indra/newview/llviewerparcelmgr.h
+++ b/indra/newview/llviewerparcelmgr.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerparcelmgr.h
* @brief Viewer-side representation of owned land
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,23 +42,23 @@ class LLParcel;
class LLViewerTexture;
class LLViewerRegion;
-const F32 DWELL_NAN = -1.0f; // A dwell having this value will be displayed as Loading...
+const F32 DWELL_NAN = -1.0f; // A dwell having this value will be displayed as Loading...
// Constants for sendLandOwner
//const U32 NO_NEIGHBOR_JOIN = 0x0;
-//const U32 ALL_NEIGHBOR_JOIN = U32( NORTH_MASK
-// | SOUTH_MASK
-// | EAST_MASK
-// | WEST_MASK);
+//const U32 ALL_NEIGHBOR_JOIN = U32( NORTH_MASK
+// | SOUTH_MASK
+// | EAST_MASK
+// | WEST_MASK);
// Specify the type of land transfer taking place
//enum ELandTransferType
//{
-// LTT_RELEASE_LAND = 0x1,
-// LTT_CLAIM_LAND = 0x2,
-// LTT_BUY_LAND = 0x4,
-// LTT_DEED_LAND = 0x8,
-// LTT_FOR_GROUP = 0x16
+// LTT_RELEASE_LAND = 0x1,
+// LTT_CLAIM_LAND = 0x2,
+// LTT_BUY_LAND = 0x4,
+// LTT_DEED_LAND = 0x8,
+// LTT_FOR_GROUP = 0x16
//};
// Base class for people who want to "observe" changes in the viewer
@@ -69,317 +69,317 @@ const F32 DWELL_NAN = -1.0f; // A dwell having this value will be displayed as L
class LLParcelObserver
{
public:
- virtual ~LLParcelObserver() {};
- virtual void changed() = 0;
+ virtual ~LLParcelObserver() {};
+ virtual void changed() = 0;
};
class LLViewerParcelMgr : public LLSingleton<LLViewerParcelMgr>
{
- LLSINGLETON(LLViewerParcelMgr);
- ~LLViewerParcelMgr();
+ LLSINGLETON(LLViewerParcelMgr);
+ ~LLViewerParcelMgr();
public:
- typedef boost::function<void (const LLVector3d&, const bool& local)> teleport_finished_callback_t;
- typedef boost::signals2::signal<void (const LLVector3d&, const bool&)> teleport_finished_signal_t;
- typedef boost::function<void()> teleport_failed_callback_t;
- typedef boost::signals2::signal<void()> teleport_failed_signal_t;
+ typedef boost::function<void (const LLVector3d&, const bool& local)> teleport_finished_callback_t;
+ typedef boost::signals2::signal<void (const LLVector3d&, const bool&)> teleport_finished_signal_t;
+ typedef boost::function<void()> teleport_failed_callback_t;
+ typedef boost::signals2::signal<void()> teleport_failed_signal_t;
- static void cleanupGlobals();
+ static void cleanupGlobals();
- BOOL selectionEmpty() const;
- F32 getSelectionWidth() const { return F32(mEastNorth.mdV[VX] - mWestSouth.mdV[VX]); }
- F32 getSelectionHeight() const { return F32(mEastNorth.mdV[VY] - mWestSouth.mdV[VY]); }
- BOOL getSelection(LLVector3d &min, LLVector3d &max) { min = mWestSouth; max = mEastNorth; return !selectionEmpty();}
- LLViewerRegion* getSelectionRegion();
- F32 getDwelling() const { return mSelectedDwell;}
+ BOOL selectionEmpty() const;
+ F32 getSelectionWidth() const { return F32(mEastNorth.mdV[VX] - mWestSouth.mdV[VX]); }
+ F32 getSelectionHeight() const { return F32(mEastNorth.mdV[VY] - mWestSouth.mdV[VY]); }
+ BOOL getSelection(LLVector3d &min, LLVector3d &max) { min = mWestSouth; max = mEastNorth; return !selectionEmpty();}
+ LLViewerRegion* getSelectionRegion();
+ F32 getDwelling() const { return mSelectedDwell;}
- void getDisplayInfo(S32* area, S32* claim, S32* rent, BOOL* for_sale, F32* dwell);
+ void getDisplayInfo(S32* area, S32* claim, S32* rent, BOOL* for_sale, F32* dwell);
- // Returns selected area
- S32 getSelectedArea() const;
+ // Returns selected area
+ S32 getSelectedArea() const;
- void resetSegments(U8* segments);
+ void resetSegments(U8* segments);
- // write a rectangle's worth of line segments into the highlight array
- void writeHighlightSegments(F32 west, F32 south, F32 east, F32 north);
+ // write a rectangle's worth of line segments into the highlight array
+ void writeHighlightSegments(F32 west, F32 south, F32 east, F32 north);
- // Write highlight segments from a packed bitmap of the appropriate
- // parcel.
- void writeSegmentsFromBitmap(U8* bitmap, U8* segments);
+ // Write highlight segments from a packed bitmap of the appropriate
+ // parcel.
+ void writeSegmentsFromBitmap(U8* bitmap, U8* segments);
- void writeAgentParcelFromBitmap(U8* bitmap);
+ void writeAgentParcelFromBitmap(U8* bitmap);
- // Select the collision parcel
- void selectCollisionParcel();
+ // Select the collision parcel
+ void selectCollisionParcel();
- // Select the parcel at a specific point
- LLParcelSelectionHandle selectParcelAt(const LLVector3d& pos_global);
+ // Select the parcel at a specific point
+ LLParcelSelectionHandle selectParcelAt(const LLVector3d& pos_global);
- // Take the current rectangle select, and select the parcel contained
- // within it.
- LLParcelSelectionHandle selectParcelInRectangle();
+ // Take the current rectangle select, and select the parcel contained
+ // within it.
+ LLParcelSelectionHandle selectParcelInRectangle();
- // Select a piece of land
- LLParcelSelectionHandle selectLand(const LLVector3d &corner1, const LLVector3d &corner2,
- BOOL snap_to_parcel);
+ // Select a piece of land
+ LLParcelSelectionHandle selectLand(const LLVector3d &corner1, const LLVector3d &corner2,
+ BOOL snap_to_parcel);
- // Clear the selection, and stop drawing the highlight.
- void deselectLand();
- void deselectUnused();
+ // Clear the selection, and stop drawing the highlight.
+ void deselectLand();
+ void deselectUnused();
- void addObserver(LLParcelObserver* observer);
- void removeObserver(LLParcelObserver* observer);
- void notifyObservers();
+ void addObserver(LLParcelObserver* observer);
+ void removeObserver(LLParcelObserver* observer);
+ void notifyObservers();
- void setSelectionVisible(BOOL visible) { mRenderSelection = visible; }
+ void setSelectionVisible(BOOL visible) { mRenderSelection = visible; }
- BOOL isOwnedAt(const LLVector3d& pos_global) const;
- BOOL isOwnedSelfAt(const LLVector3d& pos_global) const;
- BOOL isOwnedOtherAt(const LLVector3d& pos_global) const;
- BOOL isSoundLocal(const LLVector3d &pos_global) const;
+ BOOL isOwnedAt(const LLVector3d& pos_global) const;
+ BOOL isOwnedSelfAt(const LLVector3d& pos_global) const;
+ BOOL isOwnedOtherAt(const LLVector3d& pos_global) const;
+ BOOL isSoundLocal(const LLVector3d &pos_global) const;
- BOOL canHearSound(const LLVector3d &pos_global) const;
+ BOOL canHearSound(const LLVector3d &pos_global) const;
- // Returns a reference counted pointer to current parcel selection.
- // Selection does not change to reflect new selections made by user
- // Use this when implementing a task UI that refers to a specific
- // selection.
- LLParcelSelectionHandle getParcelSelection() const;
+ // Returns a reference counted pointer to current parcel selection.
+ // Selection does not change to reflect new selections made by user
+ // Use this when implementing a task UI that refers to a specific
+ // selection.
+ LLParcelSelectionHandle getParcelSelection() const;
- // Returns a reference counted pointer to current parcel selection.
- // Pointer tracks whatever the user has currently selected.
- // Use this when implementing an inspector UI.
- // http://en.wikipedia.org/wiki/Inspector_window
- LLParcelSelectionHandle getFloatingParcelSelection() const;
+ // Returns a reference counted pointer to current parcel selection.
+ // Pointer tracks whatever the user has currently selected.
+ // Use this when implementing an inspector UI.
+ // http://en.wikipedia.org/wiki/Inspector_window
+ LLParcelSelectionHandle getFloatingParcelSelection() const;
- //LLParcel *getParcelSelection() const;
- LLParcel *getAgentParcel() const;
+ //LLParcel *getParcelSelection() const;
+ LLParcel *getAgentParcel() const;
LLParcel *getAgentOrSelectedParcel() const;
- BOOL inAgentParcel(const LLVector3d &pos_global) const;
-
- // Returns a pointer only when it has valid data.
- LLParcel* getHoverParcel() const;
-
- LLParcel* getCollisionParcel() const;
-
- // Can this agent build on the parcel he is on?
- // Used for parcel property icons in nav bar.
- bool allowAgentBuild() const;
- bool allowAgentBuild(const LLParcel* parcel) const;
-
- // Can this agent speak on the parcel he is on?
- // Used for parcel property icons in nav bar.
- bool allowAgentVoice() const;
- bool allowAgentVoice(const LLViewerRegion* region, const LLParcel* parcel) const;
-
- // Can this agent start flying on this parcel?
- // Used for parcel property icons in nav bar.
- bool allowAgentFly(const LLViewerRegion* region, const LLParcel* parcel) const;
-
- // Can this agent be pushed by llPushObject() on this parcel?
- // Used for parcel property icons in nav bar.
- bool allowAgentPush(const LLViewerRegion* region, const LLParcel* parcel) const;
-
- // Can scripts written by non-parcel-owners run on the agent's current
- // parcel? Used for parcel property icons in nav bar.
- bool allowAgentScripts(const LLViewerRegion* region, const LLParcel* parcel) const;
-
- // Can the agent be damaged here?
- // Used for parcel property icons in nav bar.
- bool allowAgentDamage(const LLViewerRegion* region, const LLParcel* parcel) const;
-
- F32 getHoverParcelWidth() const
- { return F32(mHoverEastNorth.mdV[VX] - mHoverWestSouth.mdV[VX]); }
-
- F32 getHoverParcelHeight() const
- { return F32(mHoverEastNorth.mdV[VY] - mHoverWestSouth.mdV[VY]); }
-
- // UTILITIES
- void render();
- void renderParcelCollision();
-
- void renderRect( const LLVector3d &west_south_bottom,
- const LLVector3d &east_north_top );
- void renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 height, U8 direction, LLViewerRegion* regionp);
- void renderHighlightSegments(const U8* segments, LLViewerRegion* regionp);
- void renderCollisionSegments(U8* segments, BOOL use_pass, LLViewerRegion* regionp);
+ BOOL inAgentParcel(const LLVector3d &pos_global) const;
+
+ // Returns a pointer only when it has valid data.
+ LLParcel* getHoverParcel() const;
+
+ LLParcel* getCollisionParcel() const;
+
+ // Can this agent build on the parcel he is on?
+ // Used for parcel property icons in nav bar.
+ bool allowAgentBuild() const;
+ bool allowAgentBuild(const LLParcel* parcel) const;
+
+ // Can this agent speak on the parcel he is on?
+ // Used for parcel property icons in nav bar.
+ bool allowAgentVoice() const;
+ bool allowAgentVoice(const LLViewerRegion* region, const LLParcel* parcel) const;
+
+ // Can this agent start flying on this parcel?
+ // Used for parcel property icons in nav bar.
+ bool allowAgentFly(const LLViewerRegion* region, const LLParcel* parcel) const;
+
+ // Can this agent be pushed by llPushObject() on this parcel?
+ // Used for parcel property icons in nav bar.
+ bool allowAgentPush(const LLViewerRegion* region, const LLParcel* parcel) const;
+
+ // Can scripts written by non-parcel-owners run on the agent's current
+ // parcel? Used for parcel property icons in nav bar.
+ bool allowAgentScripts(const LLViewerRegion* region, const LLParcel* parcel) const;
+
+ // Can the agent be damaged here?
+ // Used for parcel property icons in nav bar.
+ bool allowAgentDamage(const LLViewerRegion* region, const LLParcel* parcel) const;
+
+ F32 getHoverParcelWidth() const
+ { return F32(mHoverEastNorth.mdV[VX] - mHoverWestSouth.mdV[VX]); }
+
+ F32 getHoverParcelHeight() const
+ { return F32(mHoverEastNorth.mdV[VY] - mHoverWestSouth.mdV[VY]); }
+
+ // UTILITIES
+ void render();
+ void renderParcelCollision();
+
+ void renderRect( const LLVector3d &west_south_bottom,
+ const LLVector3d &east_north_top );
+ void renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 height, U8 direction, LLViewerRegion* regionp);
+ void renderHighlightSegments(const U8* segments, LLViewerRegion* regionp);
+ void renderCollisionSegments(U8* segments, BOOL use_pass, LLViewerRegion* regionp);
static S32 PARCEL_BAN_LINES_HIDE;
static S32 PARCEL_BAN_LINES_ON_COLLISION;
static S32 PARCEL_BAN_LINES_ON_PROXIMITY;
- void resetCollisionTimer(); // Ban lines visibility timer
-
- void sendParcelGodForceOwner(const LLUUID& owner_id);
-
- // make the selected parcel a content parcel.
- void sendParcelGodForceToContent();
-
- // Pack information about this parcel and send it to the region
- // containing the southwest corner of the selection.
- // If want_reply_to_update, simulator will send back a ParcelProperties
- // message.
- void sendParcelPropertiesUpdate(LLParcel* parcel, bool use_agent_region = false);
-
- // Takes an Access List flag, like AL_ACCESS or AL_BAN
- void sendParcelAccessListUpdate(U32 which);
-
- // Takes an Access List flag, like AL_ACCESS or AL_BAN
- void sendParcelAccessListRequest(U32 flags);
-
- // Dwell is not part of the usual parcel update information because the
- // simulator doesn't actually know the per-parcel dwell. Ack! We have
- // to get it out of the database.
- void sendParcelDwellRequest();
-
- // If the point is outside the current hover parcel, request more data
- void setHoverParcel(const LLVector3d& pos_global);
-
- bool canAgentBuyParcel(LLParcel*, bool forGroup) const;
-
-// void startClaimLand(BOOL is_for_group = FALSE);
- void startBuyLand(BOOL is_for_group = FALSE);
- void startSellLand();
- void startReleaseLand();
- void startDivideLand();
- void startJoinLand();
- void startDeedLandToGroup();
- void reclaimParcel();
-
- void buyPass();
-
- // Buying Land
-
- class ParcelBuyInfo;
- ParcelBuyInfo* setupParcelBuy(const LLUUID& agent_id,
- const LLUUID& session_id,
- const LLUUID& group_id,
- BOOL is_group_owned,
- BOOL is_claim,
- BOOL remove_contribution);
- // callers responsibility to call deleteParcelBuy() on return value
- void sendParcelBuy(ParcelBuyInfo*);
- void deleteParcelBuy(ParcelBuyInfo* *info);
-
- void sendParcelDeed(const LLUUID& group_id);
-
- // Send the ParcelRelease message
- void sendParcelRelease();
-
- // accessors for mAgentParcel
- const std::string& getAgentParcelName() const;
+ void resetCollisionTimer(); // Ban lines visibility timer
+
+ void sendParcelGodForceOwner(const LLUUID& owner_id);
+
+ // make the selected parcel a content parcel.
+ void sendParcelGodForceToContent();
+
+ // Pack information about this parcel and send it to the region
+ // containing the southwest corner of the selection.
+ // If want_reply_to_update, simulator will send back a ParcelProperties
+ // message.
+ void sendParcelPropertiesUpdate(LLParcel* parcel, bool use_agent_region = false);
+
+ // Takes an Access List flag, like AL_ACCESS or AL_BAN
+ void sendParcelAccessListUpdate(U32 which);
+
+ // Takes an Access List flag, like AL_ACCESS or AL_BAN
+ void sendParcelAccessListRequest(U32 flags);
+
+ // Dwell is not part of the usual parcel update information because the
+ // simulator doesn't actually know the per-parcel dwell. Ack! We have
+ // to get it out of the database.
+ void sendParcelDwellRequest();
+
+ // If the point is outside the current hover parcel, request more data
+ void setHoverParcel(const LLVector3d& pos_global);
+
+ bool canAgentBuyParcel(LLParcel*, bool forGroup) const;
+
+// void startClaimLand(BOOL is_for_group = FALSE);
+ void startBuyLand(BOOL is_for_group = FALSE);
+ void startSellLand();
+ void startReleaseLand();
+ void startDivideLand();
+ void startJoinLand();
+ void startDeedLandToGroup();
+ void reclaimParcel();
+
+ void buyPass();
+
+ // Buying Land
+
+ class ParcelBuyInfo;
+ ParcelBuyInfo* setupParcelBuy(const LLUUID& agent_id,
+ const LLUUID& session_id,
+ const LLUUID& group_id,
+ BOOL is_group_owned,
+ BOOL is_claim,
+ BOOL remove_contribution);
+ // callers responsibility to call deleteParcelBuy() on return value
+ void sendParcelBuy(ParcelBuyInfo*);
+ void deleteParcelBuy(ParcelBuyInfo* *info);
+
+ void sendParcelDeed(const LLUUID& group_id);
+
+ // Send the ParcelRelease message
+ void sendParcelRelease();
+
+ // accessors for mAgentParcel
+ const std::string& getAgentParcelName() const;
const S32 getAgentParcelId() const;
- // Create a landmark at the "appropriate" location for the
- // currently selected parcel.
- // *NOTE: Taken out 2005-03-21. Phoenix.
- //void makeLandmarkAtSelection();
+ // Create a landmark at the "appropriate" location for the
+ // currently selected parcel.
+ // *NOTE: Taken out 2005-03-21. Phoenix.
+ //void makeLandmarkAtSelection();
- static void onStartMusicResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play);
- static void optionallyStartMusic(const std::string &music_url, const S32 &local_id, const LLUUID &region_id, bool switched_parcel);
+ static void onStartMusicResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play);
+ static void optionallyStartMusic(const std::string &music_url, const S32 &local_id, const LLUUID &region_id, bool switched_parcel);
- static void processParcelOverlay(LLMessageSystem *msg, void **user_data);
- static void processParcelProperties(LLMessageSystem *msg, void **user_data);
- static void processParcelAccessListReply(LLMessageSystem *msg, void **user);
- static void processParcelDwellReply(LLMessageSystem *msg, void **user);
+ static void processParcelOverlay(LLMessageSystem *msg, void **user_data);
+ static void processParcelProperties(LLMessageSystem *msg, void **user_data);
+ static void processParcelAccessListReply(LLMessageSystem *msg, void **user);
+ static void processParcelDwellReply(LLMessageSystem *msg, void **user);
- void dump();
+ void dump();
- // Whether or not the collision border around the parcel is there because
- // the agent is banned or not in the allowed group
- BOOL isCollisionBanned();
+ // Whether or not the collision border around the parcel is there because
+ // the agent is banned or not in the allowed group
+ BOOL isCollisionBanned();
- boost::signals2::connection setTeleportFinishedCallback(teleport_finished_callback_t cb);
- boost::signals2::connection setTeleportFailedCallback(teleport_failed_callback_t cb);
- void onTeleportFinished(bool local, const LLVector3d& new_pos);
- void onTeleportFailed();
- bool getTeleportInProgress();
+ boost::signals2::connection setTeleportFinishedCallback(teleport_finished_callback_t cb);
+ boost::signals2::connection setTeleportFailedCallback(teleport_failed_callback_t cb);
+ void onTeleportFinished(bool local, const LLVector3d& new_pos);
+ void onTeleportFailed();
+ bool getTeleportInProgress();
- static BOOL isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power);
- static BOOL isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power);
+ static BOOL isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power);
+ static BOOL isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power);
private:
- static void sendParcelAccessListUpdate(U32 flags, const std::map<LLUUID, class LLAccessEntry>& entries, LLViewerRegion* region, S32 parcel_local_id);
- static void sendParcelExperienceUpdate( const U32 flags, uuid_vec_t experience_ids, LLViewerRegion* region, S32 parcel_local_id );
- static bool releaseAlertCB(const LLSD& notification, const LLSD& response);
+ static void sendParcelAccessListUpdate(U32 flags, const std::map<LLUUID, class LLAccessEntry>& entries, LLViewerRegion* region, S32 parcel_local_id);
+ static void sendParcelExperienceUpdate( const U32 flags, uuid_vec_t experience_ids, LLViewerRegion* region, S32 parcel_local_id );
+ static bool releaseAlertCB(const LLSD& notification, const LLSD& response);
- // If the user is claiming land and the current selection
- // borders a piece of land the user already owns, ask if he
- // wants to join this land to the other piece.
- //void askJoinIfNecessary(ELandTransferType land_transfer_type);
- //static void joinAlertCB(S32 option, void* data);
+ // If the user is claiming land and the current selection
+ // borders a piece of land the user already owns, ask if he
+ // wants to join this land to the other piece.
+ //void askJoinIfNecessary(ELandTransferType land_transfer_type);
+ //static void joinAlertCB(S32 option, void* data);
- //void buyAskMoney(ELandTransferType land_transfer_type);
+ //void buyAskMoney(ELandTransferType land_transfer_type);
- // move land from current owner to it's group.
- void deedLandToGroup();
+ // move land from current owner to it's group.
+ void deedLandToGroup();
- static bool deedAlertCB(const LLSD& notification, const LLSD& response);
+ static bool deedAlertCB(const LLSD& notification, const LLSD& response);
- static bool callbackDivideLand(const LLSD& notification, const LLSD& response);
- static bool callbackJoinLand(const LLSD& notification, const LLSD& response);
+ static bool callbackDivideLand(const LLSD& notification, const LLSD& response);
+ static bool callbackJoinLand(const LLSD& notification, const LLSD& response);
- //void finishClaim(BOOL user_to_user_sale, U32 join);
- LLViewerTexture* getBlockedImage() const;
- LLViewerTexture* getPassImage() const;
+ //void finishClaim(BOOL user_to_user_sale, U32 join);
+ LLViewerTexture* getBlockedImage() const;
+ LLViewerTexture* getPassImage() const;
private:
- BOOL mSelected;
-
- LLParcel* mCurrentParcel; // selected parcel info
- LLParcelSelectionHandle mCurrentParcelSelection;
- LLParcelSelectionHandle mFloatingParcelSelection;
- S32 mRequestResult; // result of last parcel request
- LLVector3d mWestSouth;
- LLVector3d mEastNorth;
- F32 mSelectedDwell;
-
- LLParcel *mAgentParcel; // info for parcel agent is in
- S32 mAgentParcelSequenceID; // incrementing counter to suppress out of order updates
-
- LLParcel* mHoverParcel;
- S32 mHoverRequestResult;
- LLVector3d mHoverWestSouth;
- LLVector3d mHoverEastNorth;
-
- std::vector<LLParcelObserver*> mObservers;
-
- BOOL mTeleportInProgress;
- LLVector3d mTeleportInProgressPosition;
- teleport_finished_signal_t mTeleportFinishedSignal;
- teleport_failed_signal_t mTeleportFailedSignal;
-
- // Array of pieces of parcel edges to potentially draw
- // Has (parcels_per_edge + 1) * (parcels_per_edge + 1) elements so
- // we can represent edges of the grid.
- // WEST_MASK = draw west edge
- // SOUTH_MASK = draw south edge
- S32 mParcelsPerEdge;
- U8* mHighlightSegments;
- U8* mAgentParcelOverlay;
-
- // Raw data buffer for unpacking parcel overlay chunks
- // Size = parcels_per_edge * parcels_per_edge / parcel_overlay_chunks
- static U8* sPackedOverlay;
-
- // Watch for pending collisions with a parcel you can't access.
- // If it's coming, draw the parcel's boundaries.
- LLParcel* mCollisionParcel;
- U8* mCollisionSegments;
- bool mRenderCollision;
- BOOL mRenderSelection;
- S32 mCollisionBanned;
- LLFrameTimer mCollisionTimer;
- LLViewerTexture* mBlockedImage;
- LLViewerTexture* mPassImage;
-
- // Media
- S32 mMediaParcelId;
- U64 mMediaRegionId;
+ BOOL mSelected;
+
+ LLParcel* mCurrentParcel; // selected parcel info
+ LLParcelSelectionHandle mCurrentParcelSelection;
+ LLParcelSelectionHandle mFloatingParcelSelection;
+ S32 mRequestResult; // result of last parcel request
+ LLVector3d mWestSouth;
+ LLVector3d mEastNorth;
+ F32 mSelectedDwell;
+
+ LLParcel *mAgentParcel; // info for parcel agent is in
+ S32 mAgentParcelSequenceID; // incrementing counter to suppress out of order updates
+
+ LLParcel* mHoverParcel;
+ S32 mHoverRequestResult;
+ LLVector3d mHoverWestSouth;
+ LLVector3d mHoverEastNorth;
+
+ std::vector<LLParcelObserver*> mObservers;
+
+ BOOL mTeleportInProgress;
+ LLVector3d mTeleportInProgressPosition;
+ teleport_finished_signal_t mTeleportFinishedSignal;
+ teleport_failed_signal_t mTeleportFailedSignal;
+
+ // Array of pieces of parcel edges to potentially draw
+ // Has (parcels_per_edge + 1) * (parcels_per_edge + 1) elements so
+ // we can represent edges of the grid.
+ // WEST_MASK = draw west edge
+ // SOUTH_MASK = draw south edge
+ S32 mParcelsPerEdge;
+ U8* mHighlightSegments;
+ U8* mAgentParcelOverlay;
+
+ // Raw data buffer for unpacking parcel overlay chunks
+ // Size = parcels_per_edge * parcels_per_edge / parcel_overlay_chunks
+ static U8* sPackedOverlay;
+
+ // Watch for pending collisions with a parcel you can't access.
+ // If it's coming, draw the parcel's boundaries.
+ LLParcel* mCollisionParcel;
+ U8* mCollisionSegments;
+ bool mRenderCollision;
+ BOOL mRenderSelection;
+ S32 mCollisionBanned;
+ LLFrameTimer mCollisionTimer;
+ LLViewerTexture* mBlockedImage;
+ LLViewerTexture* mPassImage;
+
+ // Media
+ S32 mMediaParcelId;
+ U64 mMediaRegionId;
};
void sanitize_corners(const LLVector3d &corner1, const LLVector3d &corner2,
- LLVector3d &west_south_bottom, LLVector3d &east_north_top);
+ LLVector3d &west_south_bottom, LLVector3d &east_north_top);
#endif
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index 785c84c38d..6eb6bd8424 100755
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerparceloverlay.cpp
* @brief LLViewerParcelOverlay class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,64 +53,64 @@
const U8 OVERLAY_IMG_COMPONENTS = 4;
LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters)
-: mRegion( region ),
- mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ),
- mDirty( FALSE ),
- mTimeSinceLastUpdate(),
- mOverlayTextureIdx(-1),
- mVertexCount(0),
- mVertexArray(NULL),
- mColorArray(NULL)
-// mTexCoordArray(NULL),
+: mRegion( region ),
+ mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ),
+ mDirty( FALSE ),
+ mTimeSinceLastUpdate(),
+ mOverlayTextureIdx(-1),
+ mVertexCount(0),
+ mVertexArray(NULL),
+ mColorArray(NULL)
+// mTexCoordArray(NULL),
{
- // Create a texture to hold color information.
- // 4 components
- // Use mipmaps = FALSE, clamped, NEAREST filter, for sharp edges
- mImageRaw = new LLImageRaw(mParcelGridsPerEdge, mParcelGridsPerEdge, OVERLAY_IMG_COMPONENTS);
- mTexture = LLViewerTextureManager::getLocalTexture(mImageRaw.get(), FALSE);
- mTexture->setAddressMode(LLTexUnit::TAM_CLAMP);
- mTexture->setFilteringOption(LLTexUnit::TFO_POINT);
-
- //
- // Initialize the GL texture with empty data.
- //
- // Create the base texture.
- U8 *raw = mImageRaw->getData();
- const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS;
- for (S32 i = 0; i < COUNT; i++)
- {
- raw[i] = 0;
- }
- //mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge);
-
- // Create storage for ownership information from simulator
- // and initialize it.
- mOwnership = new U8[ mParcelGridsPerEdge * mParcelGridsPerEdge ];
- for (S32 i = 0; i < mParcelGridsPerEdge * mParcelGridsPerEdge; i++)
- {
- mOwnership[i] = PARCEL_PUBLIC;
- }
-
- gPipeline.markGLRebuild(this);
+ // Create a texture to hold color information.
+ // 4 components
+ // Use mipmaps = FALSE, clamped, NEAREST filter, for sharp edges
+ mImageRaw = new LLImageRaw(mParcelGridsPerEdge, mParcelGridsPerEdge, OVERLAY_IMG_COMPONENTS);
+ mTexture = LLViewerTextureManager::getLocalTexture(mImageRaw.get(), FALSE);
+ mTexture->setAddressMode(LLTexUnit::TAM_CLAMP);
+ mTexture->setFilteringOption(LLTexUnit::TFO_POINT);
+
+ //
+ // Initialize the GL texture with empty data.
+ //
+ // Create the base texture.
+ U8 *raw = mImageRaw->getData();
+ const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS;
+ for (S32 i = 0; i < COUNT; i++)
+ {
+ raw[i] = 0;
+ }
+ //mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge);
+
+ // Create storage for ownership information from simulator
+ // and initialize it.
+ mOwnership = new U8[ mParcelGridsPerEdge * mParcelGridsPerEdge ];
+ for (S32 i = 0; i < mParcelGridsPerEdge * mParcelGridsPerEdge; i++)
+ {
+ mOwnership[i] = PARCEL_PUBLIC;
+ }
+
+ gPipeline.markGLRebuild(this);
}
LLViewerParcelOverlay::~LLViewerParcelOverlay()
{
- delete[] mOwnership;
- mOwnership = NULL;
+ delete[] mOwnership;
+ mOwnership = NULL;
- delete[] mVertexArray;
- mVertexArray = NULL;
+ delete[] mVertexArray;
+ mVertexArray = NULL;
- delete[] mColorArray;
- mColorArray = NULL;
+ delete[] mColorArray;
+ mColorArray = NULL;
// JC No textures.
-// delete mTexCoordArray;
-// mTexCoordArray = NULL;
+// delete mTexCoordArray;
+// mTexCoordArray = NULL;
- mImageRaw = NULL;
+ mImageRaw = NULL;
}
//---------------------------------------------------------------------------
@@ -118,160 +118,160 @@ LLViewerParcelOverlay::~LLViewerParcelOverlay()
//---------------------------------------------------------------------------
BOOL LLViewerParcelOverlay::isOwned(const LLVector3& pos) const
{
- S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
- S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
- return (PARCEL_PUBLIC != ownership(row, column));
+ S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
+ S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
+ return (PARCEL_PUBLIC != ownership(row, column));
}
BOOL LLViewerParcelOverlay::isOwnedSelf(const LLVector3& pos) const
{
- S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
- S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
- return (PARCEL_SELF == ownership(row, column));
+ S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
+ S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
+ return (PARCEL_SELF == ownership(row, column));
}
BOOL LLViewerParcelOverlay::isOwnedGroup(const LLVector3& pos) const
{
- S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
- S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
- return (PARCEL_GROUP == ownership(row, column));
+ S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
+ S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
+ return (PARCEL_GROUP == ownership(row, column));
}
BOOL LLViewerParcelOverlay::isOwnedOther(const LLVector3& pos) const
{
- S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
- S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
- U8 overlay = ownership(row, column);
- return (PARCEL_OWNED == overlay || PARCEL_FOR_SALE == overlay);
+ S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
+ S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
+ U8 overlay = ownership(row, column);
+ return (PARCEL_OWNED == overlay || PARCEL_FOR_SALE == overlay);
}
bool LLViewerParcelOverlay::encroachesOwned(const std::vector<LLBBox>& boxes) const
{
- // boxes are expected to already be axis aligned
- for (U32 i = 0; i < boxes.size(); ++i)
- {
- LLVector3 min = boxes[i].getMinAgent();
- LLVector3 max = boxes[i].getMaxAgent();
-
- S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
-
- for (S32 row = top; row <= bottom; row++)
- {
- for (S32 column = left; column <= right; column++)
- {
- U8 type = ownership(row, column);
- if ((PARCEL_SELF == type)
- || (PARCEL_GROUP == type))
- {
- return true;
- }
- }
- }
- }
- return false;
+ // boxes are expected to already be axis aligned
+ for (U32 i = 0; i < boxes.size(); ++i)
+ {
+ LLVector3 min = boxes[i].getMinAgent();
+ LLVector3 max = boxes[i].getMaxAgent();
+
+ S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+
+ for (S32 row = top; row <= bottom; row++)
+ {
+ for (S32 column = left; column <= right; column++)
+ {
+ U8 type = ownership(row, column);
+ if ((PARCEL_SELF == type)
+ || (PARCEL_GROUP == type))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
bool LLViewerParcelOverlay::encroachesOnUnowned(const std::vector<LLBBox>& boxes) const
{
- // boxes are expected to already be axis aligned
- for (U32 i = 0; i < boxes.size(); ++i)
- {
- LLVector3 min = boxes[i].getMinAgent();
- LLVector3 max = boxes[i].getMaxAgent();
-
- S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
-
- for (S32 row = top; row <= bottom; row++)
- {
- for (S32 column = left; column <= right; column++)
- {
- U8 type = ownership(row, column);
- if ((PARCEL_SELF != type))
- {
- return true;
- }
- }
- }
- }
- return false;
+ // boxes are expected to already be axis aligned
+ for (U32 i = 0; i < boxes.size(); ++i)
+ {
+ LLVector3 min = boxes[i].getMinAgent();
+ LLVector3 max = boxes[i].getMaxAgent();
+
+ S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+
+ for (S32 row = top; row <= bottom; row++)
+ {
+ for (S32 column = left; column <= right; column++)
+ {
+ U8 type = ownership(row, column);
+ if ((PARCEL_SELF != type))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
bool LLViewerParcelOverlay::encroachesOnNearbyParcel(const std::vector<LLBBox>& boxes) const
{
- // boxes are expected to already be axis aligned
- for (U32 i = 0; i < boxes.size(); ++i)
- {
- LLVector3 min = boxes[i].getMinAgent();
- LLVector3 max = boxes[i].getMaxAgent();
-
- // If an object crosses region borders it crosses a parcel
- if ( min.mV[VX] < 0
- || min.mV[VY] < 0
- || max.mV[VX] > REGION_WIDTH_METERS
- || max.mV[VY] > REGION_WIDTH_METERS)
- {
- return true;
- }
-
- S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 bottom = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 top = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
-
- const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge;
-
- for (S32 row = bottom; row <= top; row++)
- {
- for (S32 col = left; col <= right; col++)
- {
- // This is not the rightmost column
- if (col < GRIDS_PER_EDGE-1)
- {
- U8 east_overlay = mOwnership[row*GRIDS_PER_EDGE+col+1];
- // If the column to the east of the current one marks
- // the other parcel's west edge and the box extends
- // to the west it crosses the parcel border.
- if ((east_overlay & PARCEL_WEST_LINE) && col < right)
- {
- return true;
- }
- }
-
- // This is not the topmost column
- if (row < GRIDS_PER_EDGE-1)
- {
- U8 north_overlay = mOwnership[(row+1)*GRIDS_PER_EDGE+col];
- // If the row to the north of the current one marks
- // the other parcel's south edge and the box extends
- // to the south it crosses the parcel border.
- if ((north_overlay & PARCEL_SOUTH_LINE) && row < top)
- {
- return true;
- }
- }
- }
- }
- }
- return false;
+ // boxes are expected to already be axis aligned
+ for (U32 i = 0; i < boxes.size(); ++i)
+ {
+ LLVector3 min = boxes[i].getMinAgent();
+ LLVector3 max = boxes[i].getMaxAgent();
+
+ // If an object crosses region borders it crosses a parcel
+ if ( min.mV[VX] < 0
+ || min.mV[VY] < 0
+ || max.mV[VX] > REGION_WIDTH_METERS
+ || max.mV[VY] > REGION_WIDTH_METERS)
+ {
+ return true;
+ }
+
+ S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 bottom = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 top = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+
+ const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge;
+
+ for (S32 row = bottom; row <= top; row++)
+ {
+ for (S32 col = left; col <= right; col++)
+ {
+ // This is not the rightmost column
+ if (col < GRIDS_PER_EDGE-1)
+ {
+ U8 east_overlay = mOwnership[row*GRIDS_PER_EDGE+col+1];
+ // If the column to the east of the current one marks
+ // the other parcel's west edge and the box extends
+ // to the west it crosses the parcel border.
+ if ((east_overlay & PARCEL_WEST_LINE) && col < right)
+ {
+ return true;
+ }
+ }
+
+ // This is not the topmost column
+ if (row < GRIDS_PER_EDGE-1)
+ {
+ U8 north_overlay = mOwnership[(row+1)*GRIDS_PER_EDGE+col];
+ // If the row to the north of the current one marks
+ // the other parcel's south edge and the box extends
+ // to the south it crosses the parcel border.
+ if ((north_overlay & PARCEL_SOUTH_LINE) && row < top)
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
}
BOOL LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const
{
- S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
- S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
+ S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
+ S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
return parcelFlags(row, column, PARCEL_SOUND_LOCAL);
}
U8 LLViewerParcelOverlay::ownership( const LLVector3& pos) const
{
- S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
- S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
- return ownership(row, column);
+ S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
+ S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
+ return ownership(row, column);
}
U8 LLViewerParcelOverlay::parcelLineFlags(const LLVector3& pos) const
@@ -300,18 +300,18 @@ U8 LLViewerParcelOverlay::parcelFlags(S32 row, S32 col, U8 flags) const
F32 LLViewerParcelOverlay::getOwnedRatio() const
{
- S32 size = mParcelGridsPerEdge * mParcelGridsPerEdge;
- S32 total = 0;
+ S32 size = mParcelGridsPerEdge * mParcelGridsPerEdge;
+ S32 total = 0;
- for (S32 i = 0; i < size; i++)
- {
- if ((mOwnership[i] & PARCEL_COLOR_MASK) != PARCEL_PUBLIC)
- {
- total++;
- }
- }
+ for (S32 i = 0; i < size; i++)
+ {
+ if ((mOwnership[i] & PARCEL_COLOR_MASK) != PARCEL_PUBLIC)
+ {
+ total++;
+ }
+ }
- return (F32)total / (F32)size;
+ return (F32)total / (F32)size;
}
@@ -326,704 +326,704 @@ F32 LLViewerParcelOverlay::getOwnedRatio() const
// Self = index 3
// Make sure the texture colors match the ownership data.
-// Note: Assumes that the ownership array and
+// Note: Assumes that the ownership array and
void LLViewerParcelOverlay::updateOverlayTexture()
{
- if (mOverlayTextureIdx < 0 && mDirty)
- {
- mOverlayTextureIdx = 0;
- }
- if (mOverlayTextureIdx < 0)
- {
- return;
- }
- const LLColor4U avail = LLUIColorTable::instance().getColor("PropertyColorAvail").get();
- const LLColor4U owned = LLUIColorTable::instance().getColor("PropertyColorOther").get();
- const LLColor4U group = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
- const LLColor4U self = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
- const LLColor4U for_sale = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
- const LLColor4U auction = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
-
- // Create the base texture.
- U8 *raw = mImageRaw->getData();
- const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge;
- S32 max = mOverlayTextureIdx + mParcelGridsPerEdge;
- if (max > COUNT) max = COUNT;
- S32 pixel_index = mOverlayTextureIdx*OVERLAY_IMG_COMPONENTS;
- S32 i;
- for (i = mOverlayTextureIdx; i < max; i++)
- {
- U8 ownership = mOwnership[i];
-
- F32 r,g,b,a;
-
- // Color stored in low three bits
- switch( ownership & 0x7 )
- {
- case PARCEL_PUBLIC:
- r = avail.mV[VRED];
- g = avail.mV[VGREEN];
- b = avail.mV[VBLUE];
- a = avail.mV[VALPHA];
- break;
- case PARCEL_OWNED:
- r = owned.mV[VRED];
- g = owned.mV[VGREEN];
- b = owned.mV[VBLUE];
- a = owned.mV[VALPHA];
- break;
- case PARCEL_GROUP:
- r = group.mV[VRED];
- g = group.mV[VGREEN];
- b = group.mV[VBLUE];
- a = group.mV[VALPHA];
- break;
- case PARCEL_SELF:
- r = self.mV[VRED];
- g = self.mV[VGREEN];
- b = self.mV[VBLUE];
- a = self.mV[VALPHA];
- break;
- case PARCEL_FOR_SALE:
- r = for_sale.mV[VRED];
- g = for_sale.mV[VGREEN];
- b = for_sale.mV[VBLUE];
- a = for_sale.mV[VALPHA];
- break;
- case PARCEL_AUCTION:
- r = auction.mV[VRED];
- g = auction.mV[VGREEN];
- b = auction.mV[VBLUE];
- a = auction.mV[VALPHA];
- break;
- default:
- r = self.mV[VRED];
- g = self.mV[VGREEN];
- b = self.mV[VBLUE];
- a = self.mV[VALPHA];
- break;
- }
-
- raw[pixel_index + 0] = (U8)r;
- raw[pixel_index + 1] = (U8)g;
- raw[pixel_index + 2] = (U8)b;
- raw[pixel_index + 3] = (U8)a;
-
- pixel_index += OVERLAY_IMG_COMPONENTS;
- }
-
- // Copy data into GL texture from raw data
- if (i >= COUNT)
- {
- if (!mTexture->hasGLTexture())
- {
- mTexture->createGLTexture(0, mImageRaw);
- }
- mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge);
- mOverlayTextureIdx = -1;
- }
- else
- {
- mOverlayTextureIdx = i;
- }
+ if (mOverlayTextureIdx < 0 && mDirty)
+ {
+ mOverlayTextureIdx = 0;
+ }
+ if (mOverlayTextureIdx < 0)
+ {
+ return;
+ }
+ const LLColor4U avail = LLUIColorTable::instance().getColor("PropertyColorAvail").get();
+ const LLColor4U owned = LLUIColorTable::instance().getColor("PropertyColorOther").get();
+ const LLColor4U group = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
+ const LLColor4U self = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
+ const LLColor4U for_sale = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
+ const LLColor4U auction = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
+
+ // Create the base texture.
+ U8 *raw = mImageRaw->getData();
+ const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge;
+ S32 max = mOverlayTextureIdx + mParcelGridsPerEdge;
+ if (max > COUNT) max = COUNT;
+ S32 pixel_index = mOverlayTextureIdx*OVERLAY_IMG_COMPONENTS;
+ S32 i;
+ for (i = mOverlayTextureIdx; i < max; i++)
+ {
+ U8 ownership = mOwnership[i];
+
+ F32 r,g,b,a;
+
+ // Color stored in low three bits
+ switch( ownership & 0x7 )
+ {
+ case PARCEL_PUBLIC:
+ r = avail.mV[VRED];
+ g = avail.mV[VGREEN];
+ b = avail.mV[VBLUE];
+ a = avail.mV[VALPHA];
+ break;
+ case PARCEL_OWNED:
+ r = owned.mV[VRED];
+ g = owned.mV[VGREEN];
+ b = owned.mV[VBLUE];
+ a = owned.mV[VALPHA];
+ break;
+ case PARCEL_GROUP:
+ r = group.mV[VRED];
+ g = group.mV[VGREEN];
+ b = group.mV[VBLUE];
+ a = group.mV[VALPHA];
+ break;
+ case PARCEL_SELF:
+ r = self.mV[VRED];
+ g = self.mV[VGREEN];
+ b = self.mV[VBLUE];
+ a = self.mV[VALPHA];
+ break;
+ case PARCEL_FOR_SALE:
+ r = for_sale.mV[VRED];
+ g = for_sale.mV[VGREEN];
+ b = for_sale.mV[VBLUE];
+ a = for_sale.mV[VALPHA];
+ break;
+ case PARCEL_AUCTION:
+ r = auction.mV[VRED];
+ g = auction.mV[VGREEN];
+ b = auction.mV[VBLUE];
+ a = auction.mV[VALPHA];
+ break;
+ default:
+ r = self.mV[VRED];
+ g = self.mV[VGREEN];
+ b = self.mV[VBLUE];
+ a = self.mV[VALPHA];
+ break;
+ }
+
+ raw[pixel_index + 0] = (U8)r;
+ raw[pixel_index + 1] = (U8)g;
+ raw[pixel_index + 2] = (U8)b;
+ raw[pixel_index + 3] = (U8)a;
+
+ pixel_index += OVERLAY_IMG_COMPONENTS;
+ }
+
+ // Copy data into GL texture from raw data
+ if (i >= COUNT)
+ {
+ if (!mTexture->hasGLTexture())
+ {
+ mTexture->createGLTexture(0, mImageRaw);
+ }
+ mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge);
+ mOverlayTextureIdx = -1;
+ }
+ else
+ {
+ mOverlayTextureIdx = i;
+ }
}
void LLViewerParcelOverlay::uncompressLandOverlay(S32 chunk, U8 *packed_overlay)
{
- // Unpack the message data into the ownership array
- S32 size = mParcelGridsPerEdge * mParcelGridsPerEdge;
- S32 chunk_size = size / PARCEL_OVERLAY_CHUNKS;
+ // Unpack the message data into the ownership array
+ S32 size = mParcelGridsPerEdge * mParcelGridsPerEdge;
+ S32 chunk_size = size / PARCEL_OVERLAY_CHUNKS;
- memcpy(mOwnership + chunk*chunk_size, packed_overlay, chunk_size); /*Flawfinder: ignore*/
+ memcpy(mOwnership + chunk*chunk_size, packed_overlay, chunk_size); /*Flawfinder: ignore*/
- // Force property lines and overlay texture to update
- setDirty();
+ // Force property lines and overlay texture to update
+ setDirty();
}
void LLViewerParcelOverlay::updatePropertyLines()
{
- if (!gSavedSettings.getBOOL("ShowPropertyLines"))
- return;
-
- S32 row, col;
-
- const LLColor4U self_coloru = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
- const LLColor4U other_coloru = LLUIColorTable::instance().getColor("PropertyColorOther").get();
- const LLColor4U group_coloru = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
- const LLColor4U for_sale_coloru = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
- const LLColor4U auction_coloru = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
-
- // Build into dynamic arrays, then copy into static arrays.
- std::vector<LLVector3> new_vertex_array;
- new_vertex_array.reserve(256);
- std::vector<LLColor4U> new_color_array;
- new_color_array.reserve(256);
- std::vector<LLVector2> new_coord_array;
- new_coord_array.reserve(256);
-
- U8 overlay = 0;
- BOOL add_edge = FALSE;
- const F32 GRID_STEP = PARCEL_GRID_STEP_METERS;
- const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge;
-
- for (row = 0; row < GRIDS_PER_EDGE; row++)
- {
- for (col = 0; col < GRIDS_PER_EDGE; col++)
- {
- overlay = mOwnership[row*GRIDS_PER_EDGE+col];
-
- F32 left = col*GRID_STEP;
- F32 right = left+GRID_STEP;
-
- F32 bottom = row*GRID_STEP;
- F32 top = bottom+GRID_STEP;
-
- // West edge
- if (overlay & PARCEL_WEST_LINE)
- {
- switch(overlay & PARCEL_COLOR_MASK)
- {
- case PARCEL_SELF:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, WEST, self_coloru);
- break;
- case PARCEL_GROUP:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, WEST, group_coloru);
- break;
- case PARCEL_OWNED:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, WEST, other_coloru);
- break;
- case PARCEL_FOR_SALE:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, WEST, for_sale_coloru);
- break;
- case PARCEL_AUCTION:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, WEST, auction_coloru);
- break;
- default:
- break;
- }
- }
-
- // East edge
- if (col < GRIDS_PER_EDGE-1)
- {
- U8 east_overlay = mOwnership[row*GRIDS_PER_EDGE+col+1];
- add_edge = east_overlay & PARCEL_WEST_LINE;
- }
- else
- {
- add_edge = TRUE;
- }
-
- if (add_edge)
- {
- switch(overlay & PARCEL_COLOR_MASK)
- {
- case PARCEL_SELF:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- right, bottom, EAST, self_coloru);
- break;
- case PARCEL_GROUP:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- right, bottom, EAST, group_coloru);
- break;
- case PARCEL_OWNED:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- right, bottom, EAST, other_coloru);
- break;
- case PARCEL_FOR_SALE:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- right, bottom, EAST, for_sale_coloru);
- break;
- case PARCEL_AUCTION:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- right, bottom, EAST, auction_coloru);
- break;
- default:
- break;
- }
- }
-
- // South edge
- if (overlay & PARCEL_SOUTH_LINE)
- {
- switch(overlay & PARCEL_COLOR_MASK)
- {
- case PARCEL_SELF:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, SOUTH, self_coloru);
- break;
- case PARCEL_GROUP:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, SOUTH, group_coloru);
- break;
- case PARCEL_OWNED:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, SOUTH, other_coloru);
- break;
- case PARCEL_FOR_SALE:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, SOUTH, for_sale_coloru);
- break;
- case PARCEL_AUCTION:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, bottom, SOUTH, auction_coloru);
- break;
- default:
- break;
- }
- }
-
-
- // North edge
- if (row < GRIDS_PER_EDGE-1)
- {
- U8 north_overlay = mOwnership[(row+1)*GRIDS_PER_EDGE+col];
- add_edge = north_overlay & PARCEL_SOUTH_LINE;
- }
- else
- {
- add_edge = TRUE;
- }
-
- if (add_edge)
- {
- switch(overlay & PARCEL_COLOR_MASK)
- {
- case PARCEL_SELF:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, top, NORTH, self_coloru);
- break;
- case PARCEL_GROUP:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, top, NORTH, group_coloru);
- break;
- case PARCEL_OWNED:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, top, NORTH, other_coloru);
- break;
- case PARCEL_FOR_SALE:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, top, NORTH, for_sale_coloru);
- break;
- case PARCEL_AUCTION:
- addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
- left, top, NORTH, auction_coloru);
- break;
- default:
- break;
- }
- }
- }
- }
-
- // Now copy into static arrays for faster rendering.
- // Attempt to recycle old arrays if possible to avoid memory
- // shuffling.
- S32 new_vertex_count = new_vertex_array.size();
-
- if (!(mVertexArray && mColorArray && new_vertex_count == mVertexCount))
- {
- // ...need new arrays
- delete[] mVertexArray;
- mVertexArray = NULL;
- delete[] mColorArray;
- mColorArray = NULL;
-
- mVertexCount = new_vertex_count;
-
- if (new_vertex_count > 0)
- {
- mVertexArray = new F32[3 * mVertexCount];
- mColorArray = new U8 [4 * mVertexCount];
- }
- }
-
- // Copy the new data into the arrays
- S32 i;
- F32* vertex = mVertexArray;
- for (i = 0; i < mVertexCount; i++)
- {
- const LLVector3& point = new_vertex_array.at(i);
- *vertex = point.mV[VX];
- vertex++;
- *vertex = point.mV[VY];
- vertex++;
- *vertex = point.mV[VZ];
- vertex++;
- }
-
- U8* colorp = mColorArray;
- for (i = 0; i < mVertexCount; i++)
- {
- const LLColor4U& color = new_color_array.at(i);
- *colorp = color.mV[VRED];
- colorp++;
- *colorp = color.mV[VGREEN];
- colorp++;
- *colorp = color.mV[VBLUE];
- colorp++;
- *colorp = color.mV[VALPHA];
- colorp++;
- }
-
- // Everything's clean now
- mDirty = FALSE;
+ if (!gSavedSettings.getBOOL("ShowPropertyLines"))
+ return;
+
+ S32 row, col;
+
+ const LLColor4U self_coloru = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
+ const LLColor4U other_coloru = LLUIColorTable::instance().getColor("PropertyColorOther").get();
+ const LLColor4U group_coloru = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
+ const LLColor4U for_sale_coloru = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
+ const LLColor4U auction_coloru = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
+
+ // Build into dynamic arrays, then copy into static arrays.
+ std::vector<LLVector3> new_vertex_array;
+ new_vertex_array.reserve(256);
+ std::vector<LLColor4U> new_color_array;
+ new_color_array.reserve(256);
+ std::vector<LLVector2> new_coord_array;
+ new_coord_array.reserve(256);
+
+ U8 overlay = 0;
+ BOOL add_edge = FALSE;
+ const F32 GRID_STEP = PARCEL_GRID_STEP_METERS;
+ const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge;
+
+ for (row = 0; row < GRIDS_PER_EDGE; row++)
+ {
+ for (col = 0; col < GRIDS_PER_EDGE; col++)
+ {
+ overlay = mOwnership[row*GRIDS_PER_EDGE+col];
+
+ F32 left = col*GRID_STEP;
+ F32 right = left+GRID_STEP;
+
+ F32 bottom = row*GRID_STEP;
+ F32 top = bottom+GRID_STEP;
+
+ // West edge
+ if (overlay & PARCEL_WEST_LINE)
+ {
+ switch(overlay & PARCEL_COLOR_MASK)
+ {
+ case PARCEL_SELF:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, WEST, self_coloru);
+ break;
+ case PARCEL_GROUP:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, WEST, group_coloru);
+ break;
+ case PARCEL_OWNED:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, WEST, other_coloru);
+ break;
+ case PARCEL_FOR_SALE:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, WEST, for_sale_coloru);
+ break;
+ case PARCEL_AUCTION:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, WEST, auction_coloru);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // East edge
+ if (col < GRIDS_PER_EDGE-1)
+ {
+ U8 east_overlay = mOwnership[row*GRIDS_PER_EDGE+col+1];
+ add_edge = east_overlay & PARCEL_WEST_LINE;
+ }
+ else
+ {
+ add_edge = TRUE;
+ }
+
+ if (add_edge)
+ {
+ switch(overlay & PARCEL_COLOR_MASK)
+ {
+ case PARCEL_SELF:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ right, bottom, EAST, self_coloru);
+ break;
+ case PARCEL_GROUP:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ right, bottom, EAST, group_coloru);
+ break;
+ case PARCEL_OWNED:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ right, bottom, EAST, other_coloru);
+ break;
+ case PARCEL_FOR_SALE:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ right, bottom, EAST, for_sale_coloru);
+ break;
+ case PARCEL_AUCTION:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ right, bottom, EAST, auction_coloru);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // South edge
+ if (overlay & PARCEL_SOUTH_LINE)
+ {
+ switch(overlay & PARCEL_COLOR_MASK)
+ {
+ case PARCEL_SELF:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, SOUTH, self_coloru);
+ break;
+ case PARCEL_GROUP:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, SOUTH, group_coloru);
+ break;
+ case PARCEL_OWNED:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, SOUTH, other_coloru);
+ break;
+ case PARCEL_FOR_SALE:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, SOUTH, for_sale_coloru);
+ break;
+ case PARCEL_AUCTION:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, bottom, SOUTH, auction_coloru);
+ break;
+ default:
+ break;
+ }
+ }
+
+
+ // North edge
+ if (row < GRIDS_PER_EDGE-1)
+ {
+ U8 north_overlay = mOwnership[(row+1)*GRIDS_PER_EDGE+col];
+ add_edge = north_overlay & PARCEL_SOUTH_LINE;
+ }
+ else
+ {
+ add_edge = TRUE;
+ }
+
+ if (add_edge)
+ {
+ switch(overlay & PARCEL_COLOR_MASK)
+ {
+ case PARCEL_SELF:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, top, NORTH, self_coloru);
+ break;
+ case PARCEL_GROUP:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, top, NORTH, group_coloru);
+ break;
+ case PARCEL_OWNED:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, top, NORTH, other_coloru);
+ break;
+ case PARCEL_FOR_SALE:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, top, NORTH, for_sale_coloru);
+ break;
+ case PARCEL_AUCTION:
+ addPropertyLine(new_vertex_array, new_color_array, new_coord_array,
+ left, top, NORTH, auction_coloru);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ // Now copy into static arrays for faster rendering.
+ // Attempt to recycle old arrays if possible to avoid memory
+ // shuffling.
+ S32 new_vertex_count = new_vertex_array.size();
+
+ if (!(mVertexArray && mColorArray && new_vertex_count == mVertexCount))
+ {
+ // ...need new arrays
+ delete[] mVertexArray;
+ mVertexArray = NULL;
+ delete[] mColorArray;
+ mColorArray = NULL;
+
+ mVertexCount = new_vertex_count;
+
+ if (new_vertex_count > 0)
+ {
+ mVertexArray = new F32[3 * mVertexCount];
+ mColorArray = new U8 [4 * mVertexCount];
+ }
+ }
+
+ // Copy the new data into the arrays
+ S32 i;
+ F32* vertex = mVertexArray;
+ for (i = 0; i < mVertexCount; i++)
+ {
+ const LLVector3& point = new_vertex_array.at(i);
+ *vertex = point.mV[VX];
+ vertex++;
+ *vertex = point.mV[VY];
+ vertex++;
+ *vertex = point.mV[VZ];
+ vertex++;
+ }
+
+ U8* colorp = mColorArray;
+ for (i = 0; i < mVertexCount; i++)
+ {
+ const LLColor4U& color = new_color_array.at(i);
+ *colorp = color.mV[VRED];
+ colorp++;
+ *colorp = color.mV[VGREEN];
+ colorp++;
+ *colorp = color.mV[VBLUE];
+ colorp++;
+ *colorp = color.mV[VALPHA];
+ colorp++;
+ }
+
+ // Everything's clean now
+ mDirty = FALSE;
}
void LLViewerParcelOverlay::addPropertyLine(
- std::vector<LLVector3>& vertex_array,
- std::vector<LLColor4U>& color_array,
- std::vector<LLVector2>& coord_array,
- const F32 start_x, const F32 start_y,
- const U32 edge,
- const LLColor4U& color)
+ std::vector<LLVector3>& vertex_array,
+ std::vector<LLColor4U>& color_array,
+ std::vector<LLVector2>& coord_array,
+ const F32 start_x, const F32 start_y,
+ const U32 edge,
+ const LLColor4U& color)
{
- LLColor4U underwater( color );
- underwater.mV[VALPHA] /= 2;
-
- vertex_array.reserve(16);
- color_array.reserve(16);
- coord_array.reserve(16);
-
- LLSurface& land = mRegion->getLand();
-
- F32 dx;
- F32 dy;
- F32 tick_dx;
- F32 tick_dy;
- //const F32 LINE_WIDTH = 0.125f;
- const F32 LINE_WIDTH = 0.0625f;
-
- switch(edge)
- {
- case WEST:
- dx = 0.f;
- dy = 1.f;
- tick_dx = LINE_WIDTH;
- tick_dy = 0.f;
- break;
-
- case EAST:
- dx = 0.f;
- dy = 1.f;
- tick_dx = -LINE_WIDTH;
- tick_dy = 0.f;
- break;
-
- case NORTH:
- dx = 1.f;
- dy = 0.f;
- tick_dx = 0.f;
- tick_dy = -LINE_WIDTH;
- break;
+ LLColor4U underwater( color );
+ underwater.mV[VALPHA] /= 2;
- case SOUTH:
- dx = 1.f;
- dy = 0.f;
- tick_dx = 0.f;
- tick_dy = LINE_WIDTH;
- break;
+ vertex_array.reserve(16);
+ color_array.reserve(16);
+ coord_array.reserve(16);
- default:
- LL_ERRS() << "Invalid edge in addPropertyLine" << LL_ENDL;
- return;
- }
+ LLSurface& land = mRegion->getLand();
+
+ F32 dx;
+ F32 dy;
+ F32 tick_dx;
+ F32 tick_dy;
+ //const F32 LINE_WIDTH = 0.125f;
+ const F32 LINE_WIDTH = 0.0625f;
+
+ switch(edge)
+ {
+ case WEST:
+ dx = 0.f;
+ dy = 1.f;
+ tick_dx = LINE_WIDTH;
+ tick_dy = 0.f;
+ break;
+
+ case EAST:
+ dx = 0.f;
+ dy = 1.f;
+ tick_dx = -LINE_WIDTH;
+ tick_dy = 0.f;
+ break;
+
+ case NORTH:
+ dx = 1.f;
+ dy = 0.f;
+ tick_dx = 0.f;
+ tick_dy = -LINE_WIDTH;
+ break;
+
+ case SOUTH:
+ dx = 1.f;
+ dy = 0.f;
+ tick_dx = 0.f;
+ tick_dy = LINE_WIDTH;
+ break;
+
+ default:
+ LL_ERRS() << "Invalid edge in addPropertyLine" << LL_ENDL;
+ return;
+ }
- F32 outside_x = start_x;
- F32 outside_y = start_y;
- F32 outside_z = 0.f;
- F32 inside_x = start_x + tick_dx;
- F32 inside_y = start_y + tick_dy;
- F32 inside_z = 0.f;
+ F32 outside_x = start_x;
+ F32 outside_y = start_y;
+ F32 outside_z = 0.f;
+ F32 inside_x = start_x + tick_dx;
+ F32 inside_y = start_y + tick_dy;
+ F32 inside_z = 0.f;
- // First part, only one vertex
- outside_z = land.resolveHeightRegion( outside_x, outside_y );
+ // First part, only one vertex
+ outside_z = land.resolveHeightRegion( outside_x, outside_y );
- if (outside_z > 20.f) color_array.push_back( color );
- else color_array.push_back( underwater );
+ if (outside_z > 20.f) color_array.push_back( color );
+ else color_array.push_back( underwater );
- vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
- coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
+ vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
+ coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
- inside_x += dx * LINE_WIDTH;
- inside_y += dy * LINE_WIDTH;
+ inside_x += dx * LINE_WIDTH;
+ inside_y += dy * LINE_WIDTH;
- outside_x += dx * LINE_WIDTH;
- outside_y += dy * LINE_WIDTH;
+ outside_x += dx * LINE_WIDTH;
+ outside_y += dy * LINE_WIDTH;
- // Then the "actual edge"
- inside_z = land.resolveHeightRegion( inside_x, inside_y );
- outside_z = land.resolveHeightRegion( outside_x, outside_y );
+ // Then the "actual edge"
+ inside_z = land.resolveHeightRegion( inside_x, inside_y );
+ outside_z = land.resolveHeightRegion( outside_x, outside_y );
- if (inside_z > 20.f) color_array.push_back( color );
- else color_array.push_back( underwater );
+ if (inside_z > 20.f) color_array.push_back( color );
+ else color_array.push_back( underwater );
- if (outside_z > 20.f) color_array.push_back( color );
- else color_array.push_back( underwater );
+ if (outside_z > 20.f) color_array.push_back( color );
+ else color_array.push_back( underwater );
- vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) );
- vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
+ vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) );
+ vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
- coord_array.push_back( LLVector2(outside_x - start_x, 1.f) );
- coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
+ coord_array.push_back( LLVector2(outside_x - start_x, 1.f) );
+ coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
- inside_x += dx * (dx - LINE_WIDTH);
- inside_y += dy * (dy - LINE_WIDTH);
+ inside_x += dx * (dx - LINE_WIDTH);
+ inside_y += dy * (dy - LINE_WIDTH);
- outside_x += dx * (dx - LINE_WIDTH);
- outside_y += dy * (dy - LINE_WIDTH);
+ outside_x += dx * (dx - LINE_WIDTH);
+ outside_y += dy * (dy - LINE_WIDTH);
- // Middle part, full width
- S32 i;
- const S32 GRID_STEP = S32( PARCEL_GRID_STEP_METERS );
- for (i = 1; i < GRID_STEP; i++)
- {
- inside_z = land.resolveHeightRegion( inside_x, inside_y );
- outside_z = land.resolveHeightRegion( outside_x, outside_y );
+ // Middle part, full width
+ S32 i;
+ const S32 GRID_STEP = S32( PARCEL_GRID_STEP_METERS );
+ for (i = 1; i < GRID_STEP; i++)
+ {
+ inside_z = land.resolveHeightRegion( inside_x, inside_y );
+ outside_z = land.resolveHeightRegion( outside_x, outside_y );
- if (inside_z > 20.f) color_array.push_back( color );
- else color_array.push_back( underwater );
+ if (inside_z > 20.f) color_array.push_back( color );
+ else color_array.push_back( underwater );
- if (outside_z > 20.f) color_array.push_back( color );
- else color_array.push_back( underwater );
+ if (outside_z > 20.f) color_array.push_back( color );
+ else color_array.push_back( underwater );
- vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) );
- vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
+ vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) );
+ vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
- coord_array.push_back( LLVector2(outside_x - start_x, 1.f) );
- coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
+ coord_array.push_back( LLVector2(outside_x - start_x, 1.f) );
+ coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
- inside_x += dx;
- inside_y += dy;
+ inside_x += dx;
+ inside_y += dy;
- outside_x += dx;
- outside_y += dy;
- }
+ outside_x += dx;
+ outside_y += dy;
+ }
- // Extra buffer for edge
- inside_x -= dx * LINE_WIDTH;
- inside_y -= dy * LINE_WIDTH;
+ // Extra buffer for edge
+ inside_x -= dx * LINE_WIDTH;
+ inside_y -= dy * LINE_WIDTH;
- outside_x -= dx * LINE_WIDTH;
- outside_y -= dy * LINE_WIDTH;
+ outside_x -= dx * LINE_WIDTH;
+ outside_y -= dy * LINE_WIDTH;
- inside_z = land.resolveHeightRegion( inside_x, inside_y );
- outside_z = land.resolveHeightRegion( outside_x, outside_y );
+ inside_z = land.resolveHeightRegion( inside_x, inside_y );
+ outside_z = land.resolveHeightRegion( outside_x, outside_y );
- if (inside_z > 20.f) color_array.push_back( color );
- else color_array.push_back( underwater );
+ if (inside_z > 20.f) color_array.push_back( color );
+ else color_array.push_back( underwater );
- if (outside_z > 20.f) color_array.push_back( color );
- else color_array.push_back( underwater );
+ if (outside_z > 20.f) color_array.push_back( color );
+ else color_array.push_back( underwater );
- vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) );
- vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
+ vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) );
+ vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
- coord_array.push_back( LLVector2(outside_x - start_x, 1.f) );
- coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
+ coord_array.push_back( LLVector2(outside_x - start_x, 1.f) );
+ coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
- inside_x += dx * LINE_WIDTH;
- inside_y += dy * LINE_WIDTH;
+ inside_x += dx * LINE_WIDTH;
+ inside_y += dy * LINE_WIDTH;
- outside_x += dx * LINE_WIDTH;
- outside_y += dy * LINE_WIDTH;
+ outside_x += dx * LINE_WIDTH;
+ outside_y += dy * LINE_WIDTH;
- // Last edge is not drawn to the edge
- outside_z = land.resolveHeightRegion( outside_x, outside_y );
+ // Last edge is not drawn to the edge
+ outside_z = land.resolveHeightRegion( outside_x, outside_y );
- if (outside_z > 20.f) color_array.push_back( color );
- else color_array.push_back( underwater );
+ if (outside_z > 20.f) color_array.push_back( color );
+ else color_array.push_back( underwater );
- vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
- coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
+ vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
+ coord_array.push_back( LLVector2(outside_x - start_x, 0.f) );
}
void LLViewerParcelOverlay::setDirty()
{
- mDirty = TRUE;
+ mDirty = TRUE;
}
void LLViewerParcelOverlay::updateGL()
{
- LL_PROFILE_ZONE_SCOPED
- updateOverlayTexture();
+ LL_PROFILE_ZONE_SCOPED
+ updateOverlayTexture();
}
void LLViewerParcelOverlay::idleUpdate(bool force_update)
{
- if (gGLManager.mIsDisabled)
- {
- return;
- }
- if (mOverlayTextureIdx >= 0 && (!(mDirty && force_update)))
- {
- // We are in the middle of updating the overlay texture
- gPipeline.markGLRebuild(this);
- return;
- }
- // Only if we're dirty and it's been a while since the last update.
- if (mDirty)
- {
- if (force_update || mTimeSinceLastUpdate.getElapsedTimeF32() > 4.0f)
- {
- updateOverlayTexture();
- updatePropertyLines();
- mTimeSinceLastUpdate.reset();
- }
- }
+ if (gGLManager.mIsDisabled)
+ {
+ return;
+ }
+ if (mOverlayTextureIdx >= 0 && (!(mDirty && force_update)))
+ {
+ // We are in the middle of updating the overlay texture
+ gPipeline.markGLRebuild(this);
+ return;
+ }
+ // Only if we're dirty and it's been a while since the last update.
+ if (mDirty)
+ {
+ if (force_update || mTimeSinceLastUpdate.getElapsedTimeF32() > 4.0f)
+ {
+ updateOverlayTexture();
+ updatePropertyLines();
+ mTimeSinceLastUpdate.reset();
+ }
+ }
}
-S32 LLViewerParcelOverlay::renderPropertyLines ()
+S32 LLViewerParcelOverlay::renderPropertyLines ()
{
- if (!gSavedSettings.getBOOL("ShowPropertyLines"))
- {
- return 0;
- }
- if (!mVertexArray || !mColorArray)
- {
- return 0;
- }
+ if (!gSavedSettings.getBOOL("ShowPropertyLines"))
+ {
+ return 0;
+ }
+ if (!mVertexArray || !mColorArray)
+ {
+ return 0;
+ }
- LLSurface& land = mRegion->getLand();
+ LLSurface& land = mRegion->getLand();
- LLGLSUIDefault gls_ui; // called from pipeline
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest mDepthTest(GL_TRUE);
+ LLGLSUIDefault gls_ui; // called from pipeline
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest mDepthTest(GL_TRUE);
- // Find camera height off the ground (not from zero)
- F32 ground_height_at_camera = land.resolveHeightGlobal( gAgentCamera.getCameraPositionGlobal() );
- F32 camera_z = LLViewerCamera::getInstance()->getOrigin().mV[VZ];
- F32 camera_height = camera_z - ground_height_at_camera;
+ // Find camera height off the ground (not from zero)
+ F32 ground_height_at_camera = land.resolveHeightGlobal( gAgentCamera.getCameraPositionGlobal() );
+ F32 camera_z = LLViewerCamera::getInstance()->getOrigin().mV[VZ];
+ F32 camera_height = camera_z - ground_height_at_camera;
- camera_height = llclamp(camera_height, 0.f, 100.f);
+ camera_height = llclamp(camera_height, 0.f, 100.f);
- // Pull lines toward camera by 1 cm per meter off the ground.
- const LLVector3& CAMERA_AT = LLViewerCamera::getInstance()->getAtAxis();
- F32 pull_toward_camera_scale = 0.01f * camera_height;
- LLVector3 pull_toward_camera = CAMERA_AT;
- pull_toward_camera *= -pull_toward_camera_scale;
+ // Pull lines toward camera by 1 cm per meter off the ground.
+ const LLVector3& CAMERA_AT = LLViewerCamera::getInstance()->getAtAxis();
+ F32 pull_toward_camera_scale = 0.01f * camera_height;
+ LLVector3 pull_toward_camera = CAMERA_AT;
+ pull_toward_camera *= -pull_toward_camera_scale;
- // Always fudge a little vertically.
- pull_toward_camera.mV[VZ] += 0.01f;
+ // Always fudge a little vertically.
+ pull_toward_camera.mV[VZ] += 0.01f;
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
- // Move to appropriate region coords
- LLVector3 origin = mRegion->getOriginAgent();
- gGL.translatef( origin.mV[VX], origin.mV[VY], origin.mV[VZ] );
-
- gGL.translatef(pull_toward_camera.mV[VX], pull_toward_camera.mV[VY],
- pull_toward_camera.mV[VZ]);
-
- // Include +1 because vertices are fenceposts.
- // *2 because it's a quad strip
- const S32 GRID_STEP = S32( PARCEL_GRID_STEP_METERS );
- const S32 vertex_per_edge = 3 + 2 * (GRID_STEP-1) + 3;
-
- // Stomp the camera into two dimensions
- LLVector3 camera_region = mRegion->getPosRegionFromGlobal( gAgentCamera.getCameraPositionGlobal() );
-
- // Set up a cull plane 2 * PARCEL_GRID_STEP_METERS behind
- // the camera. The cull plane normal is the camera's at axis.
- LLVector3 cull_plane_point = LLViewerCamera::getInstance()->getAtAxis();
- cull_plane_point *= -2.f * PARCEL_GRID_STEP_METERS;
- cull_plane_point += camera_region;
-
- LLVector3 vertex;
-
- const S32 BYTES_PER_COLOR = 4;
- const S32 FLOATS_PER_VERTEX = 3;
- //const S32 FLOATS_PER_TEX_COORD = 2;
- S32 i, j;
- S32 drawn = 0;
- F32* vertexp;
- U8* colorp;
- bool render_hidden = LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build");
-
- const F32 PROPERTY_LINE_CLIP_DIST_SQUARED = 256.f * 256.f;
-
- for (i = 0; i < mVertexCount; i += vertex_per_edge)
- {
- colorp = mColorArray + BYTES_PER_COLOR * i;
- vertexp = mVertexArray + FLOATS_PER_VERTEX * i;
-
- vertex.mV[VX] = *(vertexp);
- vertex.mV[VY] = *(vertexp+1);
- vertex.mV[VZ] = *(vertexp+2);
-
- if (dist_vec_squared2D(vertex, camera_region) > PROPERTY_LINE_CLIP_DIST_SQUARED)
- {
- continue;
- }
-
- // Destroy vertex, transform to plane-local.
- vertex -= cull_plane_point;
-
- // negative dot product means it is in back of the plane
- if ( vertex * CAMERA_AT < 0.f )
- {
- continue;
- }
-
- gGL.begin(LLRender::TRIANGLE_STRIP);
-
- for (j = 0; j < vertex_per_edge; j++)
- {
- gGL.color4ubv(colorp);
- gGL.vertex3fv(vertexp);
-
- colorp += BYTES_PER_COLOR;
- vertexp += FLOATS_PER_VERTEX;
- }
-
- drawn += vertex_per_edge;
-
- gGL.end();
-
- if (render_hidden)
- {
- LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
-
- colorp = mColorArray + BYTES_PER_COLOR * i;
- vertexp = mVertexArray + FLOATS_PER_VERTEX * i;
-
- gGL.begin(LLRender::TRIANGLE_STRIP);
-
- for (j = 0; j < vertex_per_edge; j++)
- {
- U8 color[4];
- color[0] = colorp[0];
- color[1] = colorp[1];
- color[2] = colorp[2];
- color[3] = colorp[3]/4;
-
- gGL.color4ubv(color);
- gGL.vertex3fv(vertexp);
-
- colorp += BYTES_PER_COLOR;
- vertexp += FLOATS_PER_VERTEX;
- }
-
- drawn += vertex_per_edge;
-
- gGL.end();
- }
-
- }
+ // Move to appropriate region coords
+ LLVector3 origin = mRegion->getOriginAgent();
+ gGL.translatef( origin.mV[VX], origin.mV[VY], origin.mV[VZ] );
+
+ gGL.translatef(pull_toward_camera.mV[VX], pull_toward_camera.mV[VY],
+ pull_toward_camera.mV[VZ]);
+
+ // Include +1 because vertices are fenceposts.
+ // *2 because it's a quad strip
+ const S32 GRID_STEP = S32( PARCEL_GRID_STEP_METERS );
+ const S32 vertex_per_edge = 3 + 2 * (GRID_STEP-1) + 3;
+
+ // Stomp the camera into two dimensions
+ LLVector3 camera_region = mRegion->getPosRegionFromGlobal( gAgentCamera.getCameraPositionGlobal() );
+
+ // Set up a cull plane 2 * PARCEL_GRID_STEP_METERS behind
+ // the camera. The cull plane normal is the camera's at axis.
+ LLVector3 cull_plane_point = LLViewerCamera::getInstance()->getAtAxis();
+ cull_plane_point *= -2.f * PARCEL_GRID_STEP_METERS;
+ cull_plane_point += camera_region;
+
+ LLVector3 vertex;
+
+ const S32 BYTES_PER_COLOR = 4;
+ const S32 FLOATS_PER_VERTEX = 3;
+ //const S32 FLOATS_PER_TEX_COORD = 2;
+ S32 i, j;
+ S32 drawn = 0;
+ F32* vertexp;
+ U8* colorp;
+ bool render_hidden = LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build");
+
+ const F32 PROPERTY_LINE_CLIP_DIST_SQUARED = 256.f * 256.f;
+
+ for (i = 0; i < mVertexCount; i += vertex_per_edge)
+ {
+ colorp = mColorArray + BYTES_PER_COLOR * i;
+ vertexp = mVertexArray + FLOATS_PER_VERTEX * i;
+
+ vertex.mV[VX] = *(vertexp);
+ vertex.mV[VY] = *(vertexp+1);
+ vertex.mV[VZ] = *(vertexp+2);
+
+ if (dist_vec_squared2D(vertex, camera_region) > PROPERTY_LINE_CLIP_DIST_SQUARED)
+ {
+ continue;
+ }
+
+ // Destroy vertex, transform to plane-local.
+ vertex -= cull_plane_point;
+
+ // negative dot product means it is in back of the plane
+ if ( vertex * CAMERA_AT < 0.f )
+ {
+ continue;
+ }
+
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+
+ for (j = 0; j < vertex_per_edge; j++)
+ {
+ gGL.color4ubv(colorp);
+ gGL.vertex3fv(vertexp);
+
+ colorp += BYTES_PER_COLOR;
+ vertexp += FLOATS_PER_VERTEX;
+ }
+
+ drawn += vertex_per_edge;
+
+ gGL.end();
+
+ if (render_hidden)
+ {
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
+
+ colorp = mColorArray + BYTES_PER_COLOR * i;
+ vertexp = mVertexArray + FLOATS_PER_VERTEX * i;
+
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+
+ for (j = 0; j < vertex_per_edge; j++)
+ {
+ U8 color[4];
+ color[0] = colorp[0];
+ color[1] = colorp[1];
+ color[2] = colorp[2];
+ color[3] = colorp[3]/4;
+
+ gGL.color4ubv(color);
+ gGL.vertex3fv(vertexp);
+
+ colorp += BYTES_PER_COLOR;
+ vertexp += FLOATS_PER_VERTEX;
+ }
+
+ drawn += vertex_per_edge;
+
+ gGL.end();
+ }
+
+ }
gGL.popMatrix();
- return drawn;
+ return drawn;
}
// Draw half of a single cell (no fill) in a grid drawn from left to right and from bottom to top
diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h
index c466cc3b6b..92aa70e4dd 100644
--- a/indra/newview/llviewerparceloverlay.h
+++ b/indra/newview/llviewerparceloverlay.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerparceloverlay.h
* @brief LLViewerParcelOverlay class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,86 +44,86 @@ class LLVector2;
class LLViewerParcelOverlay : public LLGLUpdate
{
public:
- LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters);
- ~LLViewerParcelOverlay();
-
- // ACCESS
- LLViewerTexture* getTexture() const { return mTexture; }
-
- BOOL isOwned(const LLVector3& pos) const;
- BOOL isOwnedSelf(const LLVector3& pos) const;
- BOOL isOwnedGroup(const LLVector3& pos) const;
- BOOL isOwnedOther(const LLVector3& pos) const;
-
- // "encroaches" means the prim hangs over the parcel, but its center
- // might be in another parcel. for now, we simply test axis aligned
- // bounding boxes which isn't perfect, but is close
- bool encroachesOwned(const std::vector<LLBBox>& boxes) const;
- bool encroachesOnUnowned(const std::vector<LLBBox>& boxes) const;
- bool encroachesOnNearbyParcel(const std::vector<LLBBox>& boxes) const;
-
- BOOL isSoundLocal(const LLVector3& pos) const;
-
- BOOL isBuildCameraAllowed(const LLVector3& pos) const;
- F32 getOwnedRatio() const;
-
- // Returns the number of vertices drawn
- S32 renderPropertyLines();
- void renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32* parcel_outline_color);
-
- U8 ownership( const LLVector3& pos) const;
- U8 parcelLineFlags( const LLVector3& pos) const;
- U8 parcelLineFlags(S32 row, S32 col) const;
-
- // MANIPULATE
- void uncompressLandOverlay(S32 chunk, U8 *compressed_overlay);
-
- // Indicate property lines and overlay texture need to be rebuilt.
- void setDirty();
-
- void idleUpdate(bool update_now = false);
- void updateGL();
-
+ LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters);
+ ~LLViewerParcelOverlay();
+
+ // ACCESS
+ LLViewerTexture* getTexture() const { return mTexture; }
+
+ BOOL isOwned(const LLVector3& pos) const;
+ BOOL isOwnedSelf(const LLVector3& pos) const;
+ BOOL isOwnedGroup(const LLVector3& pos) const;
+ BOOL isOwnedOther(const LLVector3& pos) const;
+
+ // "encroaches" means the prim hangs over the parcel, but its center
+ // might be in another parcel. for now, we simply test axis aligned
+ // bounding boxes which isn't perfect, but is close
+ bool encroachesOwned(const std::vector<LLBBox>& boxes) const;
+ bool encroachesOnUnowned(const std::vector<LLBBox>& boxes) const;
+ bool encroachesOnNearbyParcel(const std::vector<LLBBox>& boxes) const;
+
+ BOOL isSoundLocal(const LLVector3& pos) const;
+
+ BOOL isBuildCameraAllowed(const LLVector3& pos) const;
+ F32 getOwnedRatio() const;
+
+ // Returns the number of vertices drawn
+ S32 renderPropertyLines();
+ void renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32* parcel_outline_color);
+
+ U8 ownership( const LLVector3& pos) const;
+ U8 parcelLineFlags( const LLVector3& pos) const;
+ U8 parcelLineFlags(S32 row, S32 col) const;
+
+ // MANIPULATE
+ void uncompressLandOverlay(S32 chunk, U8 *compressed_overlay);
+
+ // Indicate property lines and overlay texture need to be rebuilt.
+ void setDirty();
+
+ void idleUpdate(bool update_now = false);
+ void updateGL();
+
private:
- // This is in parcel rows and columns, not grid rows and columns
- // Stored in bottom three bits.
- U8 ownership(S32 row, S32 col) const
- { return parcelFlags(row, col, (U8)0x7); }
-
- U8 parcelFlags(S32 row, S32 col, U8 flags) const;
-
- void addPropertyLine(std::vector<LLVector3>& vertex_array,
- std::vector<LLColor4U>& color_array,
- std::vector<LLVector2>& coord_array,
- const F32 start_x, const F32 start_y,
- const U32 edge,
- const LLColor4U& color);
-
- void updateOverlayTexture();
- void updatePropertyLines();
-
+ // This is in parcel rows and columns, not grid rows and columns
+ // Stored in bottom three bits.
+ U8 ownership(S32 row, S32 col) const
+ { return parcelFlags(row, col, (U8)0x7); }
+
+ U8 parcelFlags(S32 row, S32 col, U8 flags) const;
+
+ void addPropertyLine(std::vector<LLVector3>& vertex_array,
+ std::vector<LLColor4U>& color_array,
+ std::vector<LLVector2>& coord_array,
+ const F32 start_x, const F32 start_y,
+ const U32 edge,
+ const LLColor4U& color);
+
+ void updateOverlayTexture();
+ void updatePropertyLines();
+
private:
- // Back pointer to the region that owns this structure.
- LLViewerRegion* mRegion;
-
- S32 mParcelGridsPerEdge;
-
- LLPointer<LLViewerTexture> mTexture;
- LLPointer<LLImageRaw> mImageRaw;
-
- // Size: mParcelGridsPerEdge * mParcelGridsPerEdge
- // Each value is 0-3, PARCEL_AVAIL to PARCEL_SELF in the two low bits
- // and other flags in the upper bits.
- U8 *mOwnership;
-
- // Update propery lines and overlay texture
- BOOL mDirty;
- LLFrameTimer mTimeSinceLastUpdate;
- S32 mOverlayTextureIdx;
-
- S32 mVertexCount;
- F32* mVertexArray;
- U8* mColorArray;
+ // Back pointer to the region that owns this structure.
+ LLViewerRegion* mRegion;
+
+ S32 mParcelGridsPerEdge;
+
+ LLPointer<LLViewerTexture> mTexture;
+ LLPointer<LLImageRaw> mImageRaw;
+
+ // Size: mParcelGridsPerEdge * mParcelGridsPerEdge
+ // Each value is 0-3, PARCEL_AVAIL to PARCEL_SELF in the two low bits
+ // and other flags in the upper bits.
+ U8 *mOwnership;
+
+ // Update propery lines and overlay texture
+ BOOL mDirty;
+ LLFrameTimer mTimeSinceLastUpdate;
+ S32 mOverlayTextureIdx;
+
+ S32 mVertexCount;
+ F32* mVertexArray;
+ U8* mColorArray;
};
#endif
diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp
index 0f20076b04..b5505a42c4 100644
--- a/indra/newview/llviewerpartsim.cpp
+++ b/indra/newview/llviewerpartsim.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerpartsim.cpp
* @brief LLViewerPart class implementation
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,62 +67,62 @@ U32 LLViewerPart::sNextPartID = 1;
F32 calc_desired_size(LLViewerCamera* camera, LLVector3 pos, LLVector2 scale)
{
- F32 desired_size = (pos - camera->getOrigin()).magVec();
- desired_size /= 4;
- return llclamp(desired_size, scale.magVec()*0.5f, PART_SIM_BOX_SIDE*2);
+ F32 desired_size = (pos - camera->getOrigin()).magVec();
+ desired_size /= 4;
+ return llclamp(desired_size, scale.magVec()*0.5f, PART_SIM_BOX_SIDE*2);
}
LLViewerPart::LLViewerPart() :
- mPartID(0),
- mLastUpdateTime(0.f),
- mSkipOffset(0.f),
- mVPCallback(NULL),
- mImagep(NULL)
+ mPartID(0),
+ mLastUpdateTime(0.f),
+ mSkipOffset(0.f),
+ mVPCallback(NULL),
+ mImagep(NULL)
{
- mPartSourcep = NULL;
- mParent = NULL;
- mChild = NULL;
- ++LLViewerPartSim::sParticleCount2 ;
+ mPartSourcep = NULL;
+ mParent = NULL;
+ mChild = NULL;
+ ++LLViewerPartSim::sParticleCount2 ;
}
LLViewerPart::~LLViewerPart()
{
- if (mPartSourcep.notNull() && mPartSourcep->mLastPart == this)
- {
- mPartSourcep->mLastPart = NULL;
- }
-
- //patch up holes in the ribbon
- if (mParent)
- {
- llassert(mParent->mChild == this);
- mParent->mChild = mChild;
- }
-
- if (mChild)
- {
- llassert (mChild->mParent == this);
- mChild->mParent = mParent;
- }
-
- mPartSourcep = NULL;
-
- --LLViewerPartSim::sParticleCount2 ;
+ if (mPartSourcep.notNull() && mPartSourcep->mLastPart == this)
+ {
+ mPartSourcep->mLastPart = NULL;
+ }
+
+ //patch up holes in the ribbon
+ if (mParent)
+ {
+ llassert(mParent->mChild == this);
+ mParent->mChild = mChild;
+ }
+
+ if (mChild)
+ {
+ llassert (mChild->mParent == this);
+ mChild->mParent = mParent;
+ }
+
+ mPartSourcep = NULL;
+
+ --LLViewerPartSim::sParticleCount2 ;
}
void LLViewerPart::init(LLPointer<LLViewerPartSource> sourcep, LLViewerTexture *imagep, LLVPCallback cb)
{
- mPartID = LLViewerPart::sNextPartID;
- LLViewerPart::sNextPartID++;
- mFlags = 0x00f;
- mLastUpdateTime = 0.f;
- mMaxAge = 10.f;
- mSkipOffset = 0.0f;
+ mPartID = LLViewerPart::sNextPartID;
+ LLViewerPart::sNextPartID++;
+ mFlags = 0x00f;
+ mLastUpdateTime = 0.f;
+ mMaxAge = 10.f;
+ mSkipOffset = 0.0f;
- mVPCallback = cb;
- mPartSourcep = sourcep;
+ mVPCallback = cb;
+ mPartSourcep = sourcep;
- mImagep = imagep;
+ mImagep = imagep;
}
@@ -136,333 +136,333 @@ void LLViewerPart::init(LLPointer<LLViewerPartSource> sourcep, LLViewerTexture *
LLViewerPartGroup::LLViewerPartGroup(const LLVector3 &center_agent, const F32 box_side, bool hud)
: mHud(hud)
{
- mVOPartGroupp = NULL;
- mUniformParticles = TRUE;
-
- mRegionp = LLWorld::getInstance()->getRegionFromPosAgent(center_agent);
- llassert_always(center_agent.isFinite());
-
- if (!mRegionp)
- {
- //LL_WARNS() << "No region at position, using agent region!" << LL_ENDL;
- mRegionp = gAgent.getRegion();
- }
- mCenterAgent = center_agent;
- mBoxRadius = F_SQRT3*box_side*0.5f;
-
- if (mHud)
- {
- mVOPartGroupp = (LLVOPartGroup *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_HUD_PART_GROUP, getRegion());
- }
- else
- {
- mVOPartGroupp = (LLVOPartGroup *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_PART_GROUP, getRegion());
- }
- mVOPartGroupp->setViewerPartGroup(this);
- mVOPartGroupp->setPositionAgent(getCenterAgent());
-
- mBoxSide = box_side;
-
- F32 scale = box_side * 0.5f;
-
- mVOPartGroupp->setScale(LLVector3(scale,scale,scale));
-
- //gPipeline.addObject(mVOPartGroupp);
- gPipeline.createObject(mVOPartGroupp);
-
- LLSpatialGroup* group = mVOPartGroupp->mDrawable->getSpatialGroup();
-
- if (group != NULL)
- {
- LLVector3 center(group->getOctreeNode()->getCenter().getF32ptr());
- LLVector3 size(group->getOctreeNode()->getSize().getF32ptr());
- size += LLVector3(0.01f, 0.01f, 0.01f);
- mMinObjPos = center - size;
- mMaxObjPos = center + size;
- }
- else
- {
- // Not sure what else to set the obj bounds to when the drawable has no spatial group.
- LLVector3 extents(mBoxRadius, mBoxRadius, mBoxRadius);
- mMinObjPos = center_agent - extents;
- mMaxObjPos = center_agent + extents;
- }
-
- mSkippedTime = 0.f;
-
- static U32 id_seed = 0;
- mID = ++id_seed;
+ mVOPartGroupp = NULL;
+ mUniformParticles = TRUE;
+
+ mRegionp = LLWorld::getInstance()->getRegionFromPosAgent(center_agent);
+ llassert_always(center_agent.isFinite());
+
+ if (!mRegionp)
+ {
+ //LL_WARNS() << "No region at position, using agent region!" << LL_ENDL;
+ mRegionp = gAgent.getRegion();
+ }
+ mCenterAgent = center_agent;
+ mBoxRadius = F_SQRT3*box_side*0.5f;
+
+ if (mHud)
+ {
+ mVOPartGroupp = (LLVOPartGroup *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_HUD_PART_GROUP, getRegion());
+ }
+ else
+ {
+ mVOPartGroupp = (LLVOPartGroup *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_PART_GROUP, getRegion());
+ }
+ mVOPartGroupp->setViewerPartGroup(this);
+ mVOPartGroupp->setPositionAgent(getCenterAgent());
+
+ mBoxSide = box_side;
+
+ F32 scale = box_side * 0.5f;
+
+ mVOPartGroupp->setScale(LLVector3(scale,scale,scale));
+
+ //gPipeline.addObject(mVOPartGroupp);
+ gPipeline.createObject(mVOPartGroupp);
+
+ LLSpatialGroup* group = mVOPartGroupp->mDrawable->getSpatialGroup();
+
+ if (group != NULL)
+ {
+ LLVector3 center(group->getOctreeNode()->getCenter().getF32ptr());
+ LLVector3 size(group->getOctreeNode()->getSize().getF32ptr());
+ size += LLVector3(0.01f, 0.01f, 0.01f);
+ mMinObjPos = center - size;
+ mMaxObjPos = center + size;
+ }
+ else
+ {
+ // Not sure what else to set the obj bounds to when the drawable has no spatial group.
+ LLVector3 extents(mBoxRadius, mBoxRadius, mBoxRadius);
+ mMinObjPos = center_agent - extents;
+ mMaxObjPos = center_agent + extents;
+ }
+
+ mSkippedTime = 0.f;
+
+ static U32 id_seed = 0;
+ mID = ++id_seed;
}
LLViewerPartGroup::~LLViewerPartGroup()
{
- cleanup();
-
- S32 count = (S32) mParticles.size();
- for(S32 i = 0 ; i < count ; i++)
- {
- delete mParticles[i] ;
- }
- mParticles.clear();
-
- LLViewerPartSim::decPartCount(count);
+ cleanup();
+
+ S32 count = (S32) mParticles.size();
+ for(S32 i = 0 ; i < count ; i++)
+ {
+ delete mParticles[i] ;
+ }
+ mParticles.clear();
+
+ LLViewerPartSim::decPartCount(count);
}
void LLViewerPartGroup::cleanup()
{
- if (mVOPartGroupp)
- {
- if (!mVOPartGroupp->isDead())
- {
- gObjectList.killObject(mVOPartGroupp);
- }
- mVOPartGroupp = NULL;
- }
+ if (mVOPartGroupp)
+ {
+ if (!mVOPartGroupp->isDead())
+ {
+ gObjectList.killObject(mVOPartGroupp);
+ }
+ mVOPartGroupp = NULL;
+ }
}
BOOL LLViewerPartGroup::posInGroup(const LLVector3 &pos, const F32 desired_size)
{
- if ((pos.mV[VX] < mMinObjPos.mV[VX])
- || (pos.mV[VY] < mMinObjPos.mV[VY])
- || (pos.mV[VZ] < mMinObjPos.mV[VZ]))
- {
- return FALSE;
- }
-
- if ((pos.mV[VX] > mMaxObjPos.mV[VX])
- || (pos.mV[VY] > mMaxObjPos.mV[VY])
- || (pos.mV[VZ] > mMaxObjPos.mV[VZ]))
- {
- return FALSE;
- }
-
- if (desired_size > 0 &&
- (desired_size < mBoxRadius*0.5f ||
- desired_size > mBoxRadius*2.f))
- {
- return FALSE;
- }
-
- return TRUE;
+ if ((pos.mV[VX] < mMinObjPos.mV[VX])
+ || (pos.mV[VY] < mMinObjPos.mV[VY])
+ || (pos.mV[VZ] < mMinObjPos.mV[VZ]))
+ {
+ return FALSE;
+ }
+
+ if ((pos.mV[VX] > mMaxObjPos.mV[VX])
+ || (pos.mV[VY] > mMaxObjPos.mV[VY])
+ || (pos.mV[VZ] > mMaxObjPos.mV[VZ]))
+ {
+ return FALSE;
+ }
+
+ if (desired_size > 0 &&
+ (desired_size < mBoxRadius*0.5f ||
+ desired_size > mBoxRadius*2.f))
+ {
+ return FALSE;
+ }
+
+ return TRUE;
}
BOOL LLViewerPartGroup::addPart(LLViewerPart* part, F32 desired_size)
{
- if (part->mFlags & LLPartData::LL_PART_HUD && !mHud)
- {
- return FALSE;
- }
-
- BOOL uniform_part = part->mScale.mV[0] == part->mScale.mV[1] &&
- !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK);
-
- if (!posInGroup(part->mPosAgent, desired_size) ||
- (mUniformParticles && !uniform_part) ||
- (!mUniformParticles && uniform_part))
- {
- return FALSE;
- }
-
- gPipeline.markRebuild(mVOPartGroupp->mDrawable, LLDrawable::REBUILD_ALL);
-
- mParticles.push_back(part);
- part->mSkipOffset=mSkippedTime;
- LLViewerPartSim::incPartCount(1);
- return TRUE;
+ if (part->mFlags & LLPartData::LL_PART_HUD && !mHud)
+ {
+ return FALSE;
+ }
+
+ BOOL uniform_part = part->mScale.mV[0] == part->mScale.mV[1] &&
+ !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK);
+
+ if (!posInGroup(part->mPosAgent, desired_size) ||
+ (mUniformParticles && !uniform_part) ||
+ (!mUniformParticles && uniform_part))
+ {
+ return FALSE;
+ }
+
+ gPipeline.markRebuild(mVOPartGroupp->mDrawable, LLDrawable::REBUILD_ALL);
+
+ mParticles.push_back(part);
+ part->mSkipOffset=mSkippedTime;
+ LLViewerPartSim::incPartCount(1);
+ return TRUE;
}
void LLViewerPartGroup::updateParticles(const F32 lastdt)
{
- F32 dt;
-
- LLVector3 gravity(0.f, 0.f, GRAVITY);
-
- LLViewerPartSim::checkParticleCount(mParticles.size());
-
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- LLViewerRegion *regionp = getRegion();
- S32 end = (S32) mParticles.size();
- for (S32 i = 0 ; i < (S32)mParticles.size();)
- {
- LLVector3 a(0.f, 0.f, 0.f);
- LLViewerPart* part = mParticles[i] ;
-
- dt = lastdt + mSkippedTime - part->mSkipOffset;
- part->mSkipOffset = 0.f;
-
- // Update current time
- const F32 cur_time = part->mLastUpdateTime + dt;
- const F32 frac = cur_time / part->mMaxAge;
-
- // "Drift" the object based on the source object
- if (part->mFlags & LLPartData::LL_PART_FOLLOW_SRC_MASK)
- {
- part->mPosAgent = part->mPartSourcep->mPosAgent;
- part->mPosAgent += part->mPosOffset;
- }
-
- // Do a custom callback if we have one...
- if (part->mVPCallback)
- {
- (*part->mVPCallback)(*part, dt);
- }
-
- if (part->mFlags & LLPartData::LL_PART_WIND_MASK)
- {
- part->mVelocity *= 1.f - 0.1f*dt;
- part->mVelocity += 0.1f*dt*regionp->mWind.getVelocity(regionp->getPosRegionFromAgent(part->mPosAgent));
- }
-
- // Now do interpolation towards a target
- if (part->mFlags & LLPartData::LL_PART_TARGET_POS_MASK)
- {
- F32 remaining = part->mMaxAge - part->mLastUpdateTime;
- F32 step = dt / remaining;
-
- step = llclamp(step, 0.f, 0.1f);
- step *= 5.f;
- // we want a velocity that will result in reaching the target in the
- // Interpolate towards the target.
- LLVector3 delta_pos = part->mPartSourcep->mTargetPosAgent - part->mPosAgent;
-
- delta_pos /= remaining;
-
- part->mVelocity *= (1.f - step);
- part->mVelocity += step*delta_pos;
- }
-
-
- if (part->mFlags & LLPartData::LL_PART_TARGET_LINEAR_MASK)
- {
- LLVector3 delta_pos = part->mPartSourcep->mTargetPosAgent - part->mPartSourcep->mPosAgent;
- part->mPosAgent = part->mPartSourcep->mPosAgent;
- part->mPosAgent += frac*delta_pos;
- part->mVelocity = delta_pos;
- }
- else
- {
- // Do velocity interpolation
- part->mPosAgent += dt*part->mVelocity;
- part->mPosAgent += 0.5f*dt*dt*part->mAccel;
- part->mVelocity += part->mAccel*dt;
- }
-
- // Do a bounce test
- if (part->mFlags & LLPartData::LL_PART_BOUNCE_MASK)
- {
- // Need to do point vs. plane check...
- // For now, just check relative to object height...
- F32 dz = part->mPosAgent.mV[VZ] - part->mPartSourcep->mPosAgent.mV[VZ];
- if (dz < 0)
- {
- part->mPosAgent.mV[VZ] += -2.f*dz;
- part->mVelocity.mV[VZ] *= -0.75f;
- }
- }
-
-
- // Reset the offset from the source position
- if (part->mFlags & LLPartData::LL_PART_FOLLOW_SRC_MASK)
- {
- part->mPosOffset = part->mPosAgent;
- part->mPosOffset -= part->mPartSourcep->mPosAgent;
- }
-
- // Do color interpolation
- if (part->mFlags & LLPartData::LL_PART_INTERP_COLOR_MASK)
- {
- part->mColor.setVec(part->mStartColor);
- // note: LLColor4's v%k means multiply-alpha-only,
- // LLColor4's v*k means multiply-rgb-only
- part->mColor *= 1.f - frac; // rgb*k
- part->mColor %= 1.f - frac; // alpha*k
- part->mColor += frac%(frac*part->mEndColor); // rgb,alpha
- }
-
- // Do scale interpolation
- if (part->mFlags & LLPartData::LL_PART_INTERP_SCALE_MASK)
- {
- part->mScale.setVec(part->mStartScale);
- part->mScale *= 1.f - frac;
- part->mScale += frac*part->mEndScale;
- }
-
- // Do glow interpolation
- part->mGlow.mV[3] = (U8) ll_round(lerp(part->mStartGlow, part->mEndGlow, frac)*255.f);
-
- // Set the last update time to now.
- part->mLastUpdateTime = cur_time;
-
-
- // Kill dead particles (either flagged dead, or too old)
- if ((part->mLastUpdateTime > part->mMaxAge) || (LLViewerPart::LL_PART_DEAD_MASK == part->mFlags))
- {
- mParticles[i] = mParticles.back() ;
- mParticles.pop_back() ;
- delete part ;
- }
- else
- {
- F32 desired_size = calc_desired_size(camera, part->mPosAgent, part->mScale);
- if (!posInGroup(part->mPosAgent, desired_size))
- {
- // Transfer particles between groups
- LLViewerPartSim::getInstance()->put(part) ;
- mParticles[i] = mParticles.back() ;
- mParticles.pop_back() ;
- }
- else
- {
- i++ ;
- }
- }
- }
-
- S32 removed = end - (S32)mParticles.size();
- if (removed > 0)
- {
- // we removed one or more particles, so flag this group for update
- if (mVOPartGroupp.notNull())
- {
- gPipeline.markRebuild(mVOPartGroupp->mDrawable, LLDrawable::REBUILD_ALL);
- }
- LLViewerPartSim::decPartCount(removed);
- }
-
- // Kill the viewer object if this particle group is empty
- if (mParticles.empty())
- {
- gObjectList.killObject(mVOPartGroupp);
- mVOPartGroupp = NULL;
- }
-
- LLViewerPartSim::checkParticleCount() ;
+ F32 dt;
+
+ LLVector3 gravity(0.f, 0.f, GRAVITY);
+
+ LLViewerPartSim::checkParticleCount(mParticles.size());
+
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ LLViewerRegion *regionp = getRegion();
+ S32 end = (S32) mParticles.size();
+ for (S32 i = 0 ; i < (S32)mParticles.size();)
+ {
+ LLVector3 a(0.f, 0.f, 0.f);
+ LLViewerPart* part = mParticles[i] ;
+
+ dt = lastdt + mSkippedTime - part->mSkipOffset;
+ part->mSkipOffset = 0.f;
+
+ // Update current time
+ const F32 cur_time = part->mLastUpdateTime + dt;
+ const F32 frac = cur_time / part->mMaxAge;
+
+ // "Drift" the object based on the source object
+ if (part->mFlags & LLPartData::LL_PART_FOLLOW_SRC_MASK)
+ {
+ part->mPosAgent = part->mPartSourcep->mPosAgent;
+ part->mPosAgent += part->mPosOffset;
+ }
+
+ // Do a custom callback if we have one...
+ if (part->mVPCallback)
+ {
+ (*part->mVPCallback)(*part, dt);
+ }
+
+ if (part->mFlags & LLPartData::LL_PART_WIND_MASK)
+ {
+ part->mVelocity *= 1.f - 0.1f*dt;
+ part->mVelocity += 0.1f*dt*regionp->mWind.getVelocity(regionp->getPosRegionFromAgent(part->mPosAgent));
+ }
+
+ // Now do interpolation towards a target
+ if (part->mFlags & LLPartData::LL_PART_TARGET_POS_MASK)
+ {
+ F32 remaining = part->mMaxAge - part->mLastUpdateTime;
+ F32 step = dt / remaining;
+
+ step = llclamp(step, 0.f, 0.1f);
+ step *= 5.f;
+ // we want a velocity that will result in reaching the target in the
+ // Interpolate towards the target.
+ LLVector3 delta_pos = part->mPartSourcep->mTargetPosAgent - part->mPosAgent;
+
+ delta_pos /= remaining;
+
+ part->mVelocity *= (1.f - step);
+ part->mVelocity += step*delta_pos;
+ }
+
+
+ if (part->mFlags & LLPartData::LL_PART_TARGET_LINEAR_MASK)
+ {
+ LLVector3 delta_pos = part->mPartSourcep->mTargetPosAgent - part->mPartSourcep->mPosAgent;
+ part->mPosAgent = part->mPartSourcep->mPosAgent;
+ part->mPosAgent += frac*delta_pos;
+ part->mVelocity = delta_pos;
+ }
+ else
+ {
+ // Do velocity interpolation
+ part->mPosAgent += dt*part->mVelocity;
+ part->mPosAgent += 0.5f*dt*dt*part->mAccel;
+ part->mVelocity += part->mAccel*dt;
+ }
+
+ // Do a bounce test
+ if (part->mFlags & LLPartData::LL_PART_BOUNCE_MASK)
+ {
+ // Need to do point vs. plane check...
+ // For now, just check relative to object height...
+ F32 dz = part->mPosAgent.mV[VZ] - part->mPartSourcep->mPosAgent.mV[VZ];
+ if (dz < 0)
+ {
+ part->mPosAgent.mV[VZ] += -2.f*dz;
+ part->mVelocity.mV[VZ] *= -0.75f;
+ }
+ }
+
+
+ // Reset the offset from the source position
+ if (part->mFlags & LLPartData::LL_PART_FOLLOW_SRC_MASK)
+ {
+ part->mPosOffset = part->mPosAgent;
+ part->mPosOffset -= part->mPartSourcep->mPosAgent;
+ }
+
+ // Do color interpolation
+ if (part->mFlags & LLPartData::LL_PART_INTERP_COLOR_MASK)
+ {
+ part->mColor.setVec(part->mStartColor);
+ // note: LLColor4's v%k means multiply-alpha-only,
+ // LLColor4's v*k means multiply-rgb-only
+ part->mColor *= 1.f - frac; // rgb*k
+ part->mColor %= 1.f - frac; // alpha*k
+ part->mColor += frac%(frac*part->mEndColor); // rgb,alpha
+ }
+
+ // Do scale interpolation
+ if (part->mFlags & LLPartData::LL_PART_INTERP_SCALE_MASK)
+ {
+ part->mScale.setVec(part->mStartScale);
+ part->mScale *= 1.f - frac;
+ part->mScale += frac*part->mEndScale;
+ }
+
+ // Do glow interpolation
+ part->mGlow.mV[3] = (U8) ll_round(lerp(part->mStartGlow, part->mEndGlow, frac)*255.f);
+
+ // Set the last update time to now.
+ part->mLastUpdateTime = cur_time;
+
+
+ // Kill dead particles (either flagged dead, or too old)
+ if ((part->mLastUpdateTime > part->mMaxAge) || (LLViewerPart::LL_PART_DEAD_MASK == part->mFlags))
+ {
+ mParticles[i] = mParticles.back() ;
+ mParticles.pop_back() ;
+ delete part ;
+ }
+ else
+ {
+ F32 desired_size = calc_desired_size(camera, part->mPosAgent, part->mScale);
+ if (!posInGroup(part->mPosAgent, desired_size))
+ {
+ // Transfer particles between groups
+ LLViewerPartSim::getInstance()->put(part) ;
+ mParticles[i] = mParticles.back() ;
+ mParticles.pop_back() ;
+ }
+ else
+ {
+ i++ ;
+ }
+ }
+ }
+
+ S32 removed = end - (S32)mParticles.size();
+ if (removed > 0)
+ {
+ // we removed one or more particles, so flag this group for update
+ if (mVOPartGroupp.notNull())
+ {
+ gPipeline.markRebuild(mVOPartGroupp->mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ LLViewerPartSim::decPartCount(removed);
+ }
+
+ // Kill the viewer object if this particle group is empty
+ if (mParticles.empty())
+ {
+ gObjectList.killObject(mVOPartGroupp);
+ mVOPartGroupp = NULL;
+ }
+
+ LLViewerPartSim::checkParticleCount() ;
}
void LLViewerPartGroup::shift(const LLVector3 &offset)
{
- mCenterAgent += offset;
- mMinObjPos += offset;
- mMaxObjPos += offset;
-
- for (S32 i = 0 ; i < (S32)mParticles.size(); i++)
- {
- mParticles[i]->mPosAgent += offset;
- }
+ mCenterAgent += offset;
+ mMinObjPos += offset;
+ mMaxObjPos += offset;
+
+ for (S32 i = 0 ; i < (S32)mParticles.size(); i++)
+ {
+ mParticles[i]->mPosAgent += offset;
+ }
}
void LLViewerPartGroup::removeParticlesByID(const U32 source_id)
{
- for (S32 i = 0; i < (S32)mParticles.size(); i++)
- {
- if(mParticles[i]->mPartSourcep->getID() == source_id)
- {
- mParticles[i]->mFlags = LLViewerPart::LL_PART_DEAD_MASK;
- }
- }
+ for (S32 i = 0; i < (S32)mParticles.size(); i++)
+ {
+ if(mParticles[i]->mPartSourcep->getID() == source_id)
+ {
+ mParticles[i]->mFlags = LLViewerPart::LL_PART_DEAD_MASK;
+ }
+ }
}
//////////////////////////////////
@@ -474,423 +474,423 @@ void LLViewerPartGroup::removeParticlesByID(const U32 source_id)
//static
void LLViewerPartSim::checkParticleCount(U32 size)
{
- if(LLViewerPartSim::sParticleCount2 != LLViewerPartSim::sParticleCount)
- {
- LL_ERRS() << "sParticleCount: " << LLViewerPartSim::sParticleCount << " ; sParticleCount2: " << LLViewerPartSim::sParticleCount2 << LL_ENDL ;
- }
-
- if(size > (U32)LLViewerPartSim::sParticleCount2)
- {
- LL_ERRS() << "curren particle size: " << LLViewerPartSim::sParticleCount2 << " array size: " << size << LL_ENDL ;
- }
+ if(LLViewerPartSim::sParticleCount2 != LLViewerPartSim::sParticleCount)
+ {
+ LL_ERRS() << "sParticleCount: " << LLViewerPartSim::sParticleCount << " ; sParticleCount2: " << LLViewerPartSim::sParticleCount2 << LL_ENDL ;
+ }
+
+ if(size > (U32)LLViewerPartSim::sParticleCount2)
+ {
+ LL_ERRS() << "curren particle size: " << LLViewerPartSim::sParticleCount2 << " array size: " << size << LL_ENDL ;
+ }
}
LLViewerPartSim::LLViewerPartSim()
{
- sMaxParticleCount = llmin(gSavedSettings.getS32("RenderMaxPartCount"), LL_MAX_PARTICLE_COUNT);
- static U32 id_seed = 0;
- mID = ++id_seed;
+ sMaxParticleCount = llmin(gSavedSettings.getS32("RenderMaxPartCount"), LL_MAX_PARTICLE_COUNT);
+ static U32 id_seed = 0;
+ mID = ++id_seed;
}
//enable/disable particle system
void LLViewerPartSim::enable(bool enabled)
{
- if(!enabled && sMaxParticleCount > 0)
- {
- sMaxParticleCount = 0; //disable
- }
- else if(enabled && sMaxParticleCount < 1)
- {
- sMaxParticleCount = llmin(gSavedSettings.getS32("RenderMaxPartCount"), LL_MAX_PARTICLE_COUNT);
- }
-
- return;
+ if(!enabled && sMaxParticleCount > 0)
+ {
+ sMaxParticleCount = 0; //disable
+ }
+ else if(enabled && sMaxParticleCount < 1)
+ {
+ sMaxParticleCount = llmin(gSavedSettings.getS32("RenderMaxPartCount"), LL_MAX_PARTICLE_COUNT);
+ }
+
+ return;
}
void LLViewerPartSim::destroyClass()
{
- S32 i;
- S32 count;
-
- // Kill all of the groups (and particles)
- count = (S32) mViewerPartGroups.size();
- for (i = 0; i < count; i++)
- {
- delete mViewerPartGroups[i];
- }
- mViewerPartGroups.clear();
-
- // Kill all of the sources
- mViewerPartSources.clear();
+ S32 i;
+ S32 count;
+
+ // Kill all of the groups (and particles)
+ count = (S32) mViewerPartGroups.size();
+ for (i = 0; i < count; i++)
+ {
+ delete mViewerPartGroups[i];
+ }
+ mViewerPartGroups.clear();
+
+ // Kill all of the sources
+ mViewerPartSources.clear();
}
//static
BOOL LLViewerPartSim::shouldAddPart()
{
- if (sParticleCount >= MAX_PART_COUNT)
- {
- return FALSE;
- }
-
- if (sParticleCount > PART_THROTTLE_THRESHOLD*sMaxParticleCount)
- {
- F32 frac = (F32)sParticleCount/(F32)sMaxParticleCount;
- frac -= PART_THROTTLE_THRESHOLD;
- frac *= PART_THROTTLE_RESCALE;
- if (ll_frand() < frac)
- {
- // Skip...
- return FALSE;
- }
- }
-
- // Check frame rate, and don't add more if the viewer is really slow
- const F32 MIN_FRAME_RATE_FOR_NEW_PARTICLES = 4.f;
- if (gFPSClamped < MIN_FRAME_RATE_FOR_NEW_PARTICLES)
- {
- return FALSE;
- }
-
- return TRUE;
+ if (sParticleCount >= MAX_PART_COUNT)
+ {
+ return FALSE;
+ }
+
+ if (sParticleCount > PART_THROTTLE_THRESHOLD*sMaxParticleCount)
+ {
+ F32 frac = (F32)sParticleCount/(F32)sMaxParticleCount;
+ frac -= PART_THROTTLE_THRESHOLD;
+ frac *= PART_THROTTLE_RESCALE;
+ if (ll_frand() < frac)
+ {
+ // Skip...
+ return FALSE;
+ }
+ }
+
+ // Check frame rate, and don't add more if the viewer is really slow
+ const F32 MIN_FRAME_RATE_FOR_NEW_PARTICLES = 4.f;
+ if (gFPSClamped < MIN_FRAME_RATE_FOR_NEW_PARTICLES)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
}
void LLViewerPartSim::addPart(LLViewerPart* part)
{
- if (sParticleCount < MAX_PART_COUNT)
- {
- put(part);
- }
- else
- {
- //delete the particle if can not add it in
- delete part ;
- part = NULL ;
- }
+ if (sParticleCount < MAX_PART_COUNT)
+ {
+ put(part);
+ }
+ else
+ {
+ //delete the particle if can not add it in
+ delete part ;
+ part = NULL ;
+ }
}
LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part)
{
- const F32 MAX_MAG = 1000000.f*1000000.f; // 1 million
- LLViewerPartGroup *return_group = NULL ;
- if (part->mPosAgent.magVecSquared() > MAX_MAG || !part->mPosAgent.isFinite())
- {
+ const F32 MAX_MAG = 1000000.f*1000000.f; // 1 million
+ LLViewerPartGroup *return_group = NULL ;
+ if (part->mPosAgent.magVecSquared() > MAX_MAG || !part->mPosAgent.isFinite())
+ {
#if 0 && !LL_RELEASE_FOR_DOWNLOAD
- LL_WARNS() << "LLViewerPartSim::put Part out of range!" << LL_ENDL;
- LL_WARNS() << part->mPosAgent << LL_ENDL;
+ LL_WARNS() << "LLViewerPartSim::put Part out of range!" << LL_ENDL;
+ LL_WARNS() << part->mPosAgent << LL_ENDL;
#endif
- }
- else
- {
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- F32 desired_size = calc_desired_size(camera, part->mPosAgent, part->mScale);
-
- S32 count = (S32) mViewerPartGroups.size();
- for (S32 i = 0; i < count; i++)
- {
- if (mViewerPartGroups[i]->addPart(part, desired_size))
- {
- // We found a spatial group that we fit into, add us and exit
- return_group = mViewerPartGroups[i];
- break ;
- }
- }
-
- // Hmm, we didn't fit in any of the existing spatial groups
- // Create a new one...
- if(!return_group)
- {
- llassert_always(part->mPosAgent.isFinite());
- LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size, part->mFlags & LLPartData::LL_PART_HUD);
- groupp->mUniformParticles = (part->mScale.mV[0] == part->mScale.mV[1] &&
- !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK));
- if (!groupp->addPart(part))
- {
- LL_WARNS() << "LLViewerPartSim::put - Particle didn't go into its box!" << LL_ENDL;
- LL_INFOS() << groupp->getCenterAgent() << LL_ENDL;
- LL_INFOS() << part->mPosAgent << LL_ENDL;
- mViewerPartGroups.pop_back() ;
- delete groupp;
- groupp = NULL ;
- }
- return_group = groupp;
- }
- }
-
- if(!return_group) //failed to insert the particle
- {
- delete part ;
- part = NULL ;
- }
-
- return return_group ;
+ }
+ else
+ {
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ F32 desired_size = calc_desired_size(camera, part->mPosAgent, part->mScale);
+
+ S32 count = (S32) mViewerPartGroups.size();
+ for (S32 i = 0; i < count; i++)
+ {
+ if (mViewerPartGroups[i]->addPart(part, desired_size))
+ {
+ // We found a spatial group that we fit into, add us and exit
+ return_group = mViewerPartGroups[i];
+ break ;
+ }
+ }
+
+ // Hmm, we didn't fit in any of the existing spatial groups
+ // Create a new one...
+ if(!return_group)
+ {
+ llassert_always(part->mPosAgent.isFinite());
+ LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size, part->mFlags & LLPartData::LL_PART_HUD);
+ groupp->mUniformParticles = (part->mScale.mV[0] == part->mScale.mV[1] &&
+ !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK));
+ if (!groupp->addPart(part))
+ {
+ LL_WARNS() << "LLViewerPartSim::put - Particle didn't go into its box!" << LL_ENDL;
+ LL_INFOS() << groupp->getCenterAgent() << LL_ENDL;
+ LL_INFOS() << part->mPosAgent << LL_ENDL;
+ mViewerPartGroups.pop_back() ;
+ delete groupp;
+ groupp = NULL ;
+ }
+ return_group = groupp;
+ }
+ }
+
+ if(!return_group) //failed to insert the particle
+ {
+ delete part ;
+ part = NULL ;
+ }
+
+ return return_group ;
}
LLViewerPartGroup *LLViewerPartSim::createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size, bool hud)
{
- //find a box that has a center position divisible by PART_SIM_BOX_SIDE that encompasses
- //pos_agent
- LLViewerPartGroup *groupp = new LLViewerPartGroup(pos_agent, desired_size, hud);
- mViewerPartGroups.push_back(groupp);
- return groupp;
+ //find a box that has a center position divisible by PART_SIM_BOX_SIDE that encompasses
+ //pos_agent
+ LLViewerPartGroup *groupp = new LLViewerPartGroup(pos_agent, desired_size, hud);
+ mViewerPartGroups.push_back(groupp);
+ return groupp;
}
void LLViewerPartSim::shift(const LLVector3 &offset)
{
- S32 i;
- S32 count;
-
- count = (S32) mViewerPartSources.size();
- for (i = 0; i < count; i++)
- {
- mViewerPartSources[i]->mPosAgent += offset;
- mViewerPartSources[i]->mTargetPosAgent += offset;
- mViewerPartSources[i]->mLastUpdatePosAgent += offset;
- }
-
- count = (S32) mViewerPartGroups.size();
- for (i = 0; i < count; i++)
- {
- mViewerPartGroups[i]->shift(offset);
- }
+ S32 i;
+ S32 count;
+
+ count = (S32) mViewerPartSources.size();
+ for (i = 0; i < count; i++)
+ {
+ mViewerPartSources[i]->mPosAgent += offset;
+ mViewerPartSources[i]->mTargetPosAgent += offset;
+ mViewerPartSources[i]->mLastUpdatePosAgent += offset;
+ }
+
+ count = (S32) mViewerPartGroups.size();
+ for (i = 0; i < count; i++)
+ {
+ mViewerPartGroups[i]->shift(offset);
+ }
}
static LLTrace::BlockTimerStatHandle FTM_SIMULATE_PARTICLES("Simulate Particles");
void LLViewerPartSim::updateSimulation()
{
- static LLFrameTimer update_timer;
-
- const F32 dt = llmin(update_timer.getElapsedTimeAndResetF32(), 0.1f);
-
- if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
- {
- return;
- }
-
- LL_RECORD_BLOCK_TIME(FTM_SIMULATE_PARTICLES);
-
- // Start at a random particle system so the same
- // particle system doesn't always get first pick at the
- // particles. Theoretically we'd want to do this in distance
- // order or something, but sorting particle sources will be a big
- // pain.
- S32 i;
- S32 count = (S32) mViewerPartSources.size();
- S32 start = (S32)ll_frand((F32)count);
- S32 dir = 1;
- S32 deldir = 0;
- if (ll_frand() > 0.5f)
- {
- dir = -1;
- deldir = -1;
- }
-
- S32 num_updates = 0;
- for (i = start; num_updates < count;)
- {
- if (i >= count)
- {
- i = 0;
- }
- if (i < 0)
- {
- i = count - 1;
- }
-
- if (!mViewerPartSources[i]->isDead())
- {
- BOOL upd = TRUE;
- LLViewerObject* vobj = mViewerPartSources[i]->mSourceObjectp;
-
- if (vobj && vobj->isAvatar() && ((LLVOAvatar*)vobj)->isInMuteList())
- {
- upd = FALSE;
- }
-
- if(vobj && vobj->isOwnerInMuteList(mViewerPartSources[i]->getOwnerUUID()))
- {
- upd = FALSE;
- }
-
- if (upd && vobj && (vobj->getPCode() == LL_PCODE_VOLUME))
- {
- if(vobj->getAvatar() && vobj->getAvatar()->isTooComplex() && vobj->getAvatar()->isTooSlow())
- {
- upd = FALSE;
- }
-
- LLVOVolume* vvo = (LLVOVolume *)vobj;
- if (!LLPipeline::sRenderAttachedParticles && vvo && vvo->isAttachment())
- {
- upd = FALSE;
- }
- }
-
- if (upd)
- {
- mViewerPartSources[i]->update(dt);
- }
- }
-
- if (mViewerPartSources[i]->isDead())
- {
- mViewerPartSources.erase(mViewerPartSources.begin() + i);
- count--;
- i+=deldir;
- }
- else
- {
- i += dir;
- }
- num_updates++;
- }
-
- count = (S32) mViewerPartGroups.size();
- for (i = 0; i < count; i++)
- {
- LLViewerObject* vobj = mViewerPartGroups[i]->mVOPartGroupp;
-
- S32 visirate = 1;
- if (vobj && !vobj->isDead() && vobj->mDrawable && !vobj->mDrawable->isDead())
- {
- LLSpatialGroup* group = vobj->mDrawable->getSpatialGroup();
- if (group && !group->isVisible()) // && !group->isState(LLSpatialGroup::OBJECT_DIRTY))
- {
- visirate = 8;
- }
- }
-
- if ((LLDrawable::getCurrentFrame()+mViewerPartGroups[i]->mID)%visirate == 0)
- {
- if (vobj && !vobj->isDead())
- {
- gPipeline.markRebuild(vobj->mDrawable, LLDrawable::REBUILD_ALL);
- }
- mViewerPartGroups[i]->updateParticles(dt * visirate);
- mViewerPartGroups[i]->mSkippedTime=0.0f;
- if (!mViewerPartGroups[i]->getCount())
- {
- delete mViewerPartGroups[i];
- mViewerPartGroups.erase(mViewerPartGroups.begin() + i);
- i--;
- count--;
- }
- }
- else
- {
- mViewerPartGroups[i]->mSkippedTime+=dt;
- }
-
- }
- if (LLDrawable::getCurrentFrame()%16==0)
- {
- if (sParticleCount > sMaxParticleCount * 0.875f
- && sParticleAdaptiveRate < 2.0f)
- {
- sParticleAdaptiveRate *= PART_ADAPT_RATE_MULT;
- }
- else
- {
- if (sParticleCount < sMaxParticleCount * 0.5f
- && sParticleAdaptiveRate > 0.03125f)
- {
- sParticleAdaptiveRate *= PART_ADAPT_RATE_MULT_RECIP;
- }
- }
- }
-
- updatePartBurstRate() ;
-
- //LL_INFOS() << "Particles: " << sParticleCount << " Adaptive Rate: " << sParticleAdaptiveRate << LL_ENDL;
+ static LLFrameTimer update_timer;
+
+ const F32 dt = llmin(update_timer.getElapsedTimeAndResetF32(), 0.1f);
+
+ if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
+ {
+ return;
+ }
+
+ LL_RECORD_BLOCK_TIME(FTM_SIMULATE_PARTICLES);
+
+ // Start at a random particle system so the same
+ // particle system doesn't always get first pick at the
+ // particles. Theoretically we'd want to do this in distance
+ // order or something, but sorting particle sources will be a big
+ // pain.
+ S32 i;
+ S32 count = (S32) mViewerPartSources.size();
+ S32 start = (S32)ll_frand((F32)count);
+ S32 dir = 1;
+ S32 deldir = 0;
+ if (ll_frand() > 0.5f)
+ {
+ dir = -1;
+ deldir = -1;
+ }
+
+ S32 num_updates = 0;
+ for (i = start; num_updates < count;)
+ {
+ if (i >= count)
+ {
+ i = 0;
+ }
+ if (i < 0)
+ {
+ i = count - 1;
+ }
+
+ if (!mViewerPartSources[i]->isDead())
+ {
+ BOOL upd = TRUE;
+ LLViewerObject* vobj = mViewerPartSources[i]->mSourceObjectp;
+
+ if (vobj && vobj->isAvatar() && ((LLVOAvatar*)vobj)->isInMuteList())
+ {
+ upd = FALSE;
+ }
+
+ if(vobj && vobj->isOwnerInMuteList(mViewerPartSources[i]->getOwnerUUID()))
+ {
+ upd = FALSE;
+ }
+
+ if (upd && vobj && (vobj->getPCode() == LL_PCODE_VOLUME))
+ {
+ if(vobj->getAvatar() && vobj->getAvatar()->isTooComplex() && vobj->getAvatar()->isTooSlow())
+ {
+ upd = FALSE;
+ }
+
+ LLVOVolume* vvo = (LLVOVolume *)vobj;
+ if (!LLPipeline::sRenderAttachedParticles && vvo && vvo->isAttachment())
+ {
+ upd = FALSE;
+ }
+ }
+
+ if (upd)
+ {
+ mViewerPartSources[i]->update(dt);
+ }
+ }
+
+ if (mViewerPartSources[i]->isDead())
+ {
+ mViewerPartSources.erase(mViewerPartSources.begin() + i);
+ count--;
+ i+=deldir;
+ }
+ else
+ {
+ i += dir;
+ }
+ num_updates++;
+ }
+
+ count = (S32) mViewerPartGroups.size();
+ for (i = 0; i < count; i++)
+ {
+ LLViewerObject* vobj = mViewerPartGroups[i]->mVOPartGroupp;
+
+ S32 visirate = 1;
+ if (vobj && !vobj->isDead() && vobj->mDrawable && !vobj->mDrawable->isDead())
+ {
+ LLSpatialGroup* group = vobj->mDrawable->getSpatialGroup();
+ if (group && !group->isVisible()) // && !group->isState(LLSpatialGroup::OBJECT_DIRTY))
+ {
+ visirate = 8;
+ }
+ }
+
+ if ((LLDrawable::getCurrentFrame()+mViewerPartGroups[i]->mID)%visirate == 0)
+ {
+ if (vobj && !vobj->isDead())
+ {
+ gPipeline.markRebuild(vobj->mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ mViewerPartGroups[i]->updateParticles(dt * visirate);
+ mViewerPartGroups[i]->mSkippedTime=0.0f;
+ if (!mViewerPartGroups[i]->getCount())
+ {
+ delete mViewerPartGroups[i];
+ mViewerPartGroups.erase(mViewerPartGroups.begin() + i);
+ i--;
+ count--;
+ }
+ }
+ else
+ {
+ mViewerPartGroups[i]->mSkippedTime+=dt;
+ }
+
+ }
+ if (LLDrawable::getCurrentFrame()%16==0)
+ {
+ if (sParticleCount > sMaxParticleCount * 0.875f
+ && sParticleAdaptiveRate < 2.0f)
+ {
+ sParticleAdaptiveRate *= PART_ADAPT_RATE_MULT;
+ }
+ else
+ {
+ if (sParticleCount < sMaxParticleCount * 0.5f
+ && sParticleAdaptiveRate > 0.03125f)
+ {
+ sParticleAdaptiveRate *= PART_ADAPT_RATE_MULT_RECIP;
+ }
+ }
+ }
+
+ updatePartBurstRate() ;
+
+ //LL_INFOS() << "Particles: " << sParticleCount << " Adaptive Rate: " << sParticleAdaptiveRate << LL_ENDL;
}
void LLViewerPartSim::updatePartBurstRate()
{
- if (!(LLDrawable::getCurrentFrame() & 0xf))
- {
- if (sParticleCount >= MAX_PART_COUNT) //set rate to zero
- {
- sParticleBurstRate = 0.0f ;
- }
- else if(sParticleCount > 0)
- {
- if(sParticleBurstRate > 0.0000001f)
- {
- F32 total_particles = sParticleCount / sParticleBurstRate ; //estimated
- F32 new_rate = llclamp(0.9f * sMaxParticleCount / total_particles, 0.0f, 1.0f) ;
- F32 delta_rate_threshold = llmin(0.1f * llmax(new_rate, sParticleBurstRate), 0.1f) ;
- F32 delta_rate = llclamp(new_rate - sParticleBurstRate, -1.0f * delta_rate_threshold, delta_rate_threshold) ;
-
- sParticleBurstRate = llclamp(sParticleBurstRate + 0.5f * delta_rate, 0.0f, 1.0f) ;
- }
- else
- {
- sParticleBurstRate += 0.0000001f ;
- }
- }
- else
- {
- sParticleBurstRate += 0.00125f ;
- }
- }
+ if (!(LLDrawable::getCurrentFrame() & 0xf))
+ {
+ if (sParticleCount >= MAX_PART_COUNT) //set rate to zero
+ {
+ sParticleBurstRate = 0.0f ;
+ }
+ else if(sParticleCount > 0)
+ {
+ if(sParticleBurstRate > 0.0000001f)
+ {
+ F32 total_particles = sParticleCount / sParticleBurstRate ; //estimated
+ F32 new_rate = llclamp(0.9f * sMaxParticleCount / total_particles, 0.0f, 1.0f) ;
+ F32 delta_rate_threshold = llmin(0.1f * llmax(new_rate, sParticleBurstRate), 0.1f) ;
+ F32 delta_rate = llclamp(new_rate - sParticleBurstRate, -1.0f * delta_rate_threshold, delta_rate_threshold) ;
+
+ sParticleBurstRate = llclamp(sParticleBurstRate + 0.5f * delta_rate, 0.0f, 1.0f) ;
+ }
+ else
+ {
+ sParticleBurstRate += 0.0000001f ;
+ }
+ }
+ else
+ {
+ sParticleBurstRate += 0.00125f ;
+ }
+ }
}
void LLViewerPartSim::addPartSource(LLPointer<LLViewerPartSource> sourcep)
{
- if (!sourcep)
- {
- LL_WARNS() << "Null part source!" << LL_ENDL;
- return;
- }
- sourcep->setStart() ;
- mViewerPartSources.push_back(sourcep);
+ if (!sourcep)
+ {
+ LL_WARNS() << "Null part source!" << LL_ENDL;
+ return;
+ }
+ sourcep->setStart() ;
+ mViewerPartSources.push_back(sourcep);
}
void LLViewerPartSim::removeLastCreatedSource()
{
- mViewerPartSources.pop_back();
+ mViewerPartSources.pop_back();
}
void LLViewerPartSim::cleanupRegion(LLViewerRegion *regionp)
{
- for (group_list_t::iterator i = mViewerPartGroups.begin(); i != mViewerPartGroups.end(); )
- {
- group_list_t::iterator iter = i++;
-
- if ((*iter)->getRegion() == regionp)
- {
- delete *iter;
- i = mViewerPartGroups.erase(iter);
- }
- }
+ for (group_list_t::iterator i = mViewerPartGroups.begin(); i != mViewerPartGroups.end(); )
+ {
+ group_list_t::iterator iter = i++;
+
+ if ((*iter)->getRegion() == regionp)
+ {
+ delete *iter;
+ i = mViewerPartGroups.erase(iter);
+ }
+ }
}
void LLViewerPartSim::clearParticlesByID(const U32 system_id)
{
- for (group_list_t::iterator g = mViewerPartGroups.begin(); g != mViewerPartGroups.end(); ++g)
- {
- (*g)->removeParticlesByID(system_id);
- }
- for (source_list_t::iterator i = mViewerPartSources.begin(); i != mViewerPartSources.end(); ++i)
- {
- if ((*i)->getID() == system_id)
- {
- (*i)->setDead();
- break;
- }
- }
-
+ for (group_list_t::iterator g = mViewerPartGroups.begin(); g != mViewerPartGroups.end(); ++g)
+ {
+ (*g)->removeParticlesByID(system_id);
+ }
+ for (source_list_t::iterator i = mViewerPartSources.begin(); i != mViewerPartSources.end(); ++i)
+ {
+ if ((*i)->getID() == system_id)
+ {
+ (*i)->setDead();
+ break;
+ }
+ }
+
}
void LLViewerPartSim::clearParticlesByOwnerID(const LLUUID& task_id)
{
- for (source_list_t::iterator iter = mViewerPartSources.begin(); iter != mViewerPartSources.end(); ++iter)
- {
- if ((*iter)->getOwnerUUID() == task_id)
- {
- clearParticlesByID((*iter)->getID());
- }
- }
+ for (source_list_t::iterator iter = mViewerPartSources.begin(); iter != mViewerPartSources.end(); ++iter)
+ {
+ if ((*iter)->getOwnerUUID() == task_id)
+ {
+ clearParticlesByID((*iter)->getID());
+ }
+ }
}
diff --git a/indra/newview/llviewerpartsim.h b/indra/newview/llviewerpartsim.h
index ab1cd715ab..4de962ac4f 100644
--- a/indra/newview/llviewerpartsim.h
+++ b/indra/newview/llviewerpartsim.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerpartsim.h
* @brief LLViewerPart class header file
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,37 +50,37 @@ typedef void (*LLVPCallback)(LLViewerPart &part, const F32 dt);
class LLViewerPart : public LLPartData
{
public:
- ~LLViewerPart();
+ ~LLViewerPart();
public:
- LLViewerPart();
+ LLViewerPart();
- void init(LLPointer<LLViewerPartSource> sourcep, LLViewerTexture *imagep, LLVPCallback cb);
+ void init(LLPointer<LLViewerPartSource> sourcep, LLViewerTexture *imagep, LLVPCallback cb);
- U32 mPartID; // Particle ID used primarily for moving between groups
- F32 mLastUpdateTime; // Last time the particle was updated
- F32 mSkipOffset; // Offset against current group mSkippedTime
+ U32 mPartID; // Particle ID used primarily for moving between groups
+ F32 mLastUpdateTime; // Last time the particle was updated
+ F32 mSkipOffset; // Offset against current group mSkippedTime
- LLVPCallback mVPCallback; // Callback function for more complicated behaviors
- LLPointer<LLViewerPartSource> mPartSourcep; // Particle source used for this object
+ LLVPCallback mVPCallback; // Callback function for more complicated behaviors
+ LLPointer<LLViewerPartSource> mPartSourcep; // Particle source used for this object
- LLViewerPart* mParent; // particle to connect to if this is part of a particle ribbon
- LLViewerPart* mChild; // child particle for clean reference destruction
+ LLViewerPart* mParent; // particle to connect to if this is part of a particle ribbon
+ LLViewerPart* mChild; // child particle for clean reference destruction
- // Current particle state (possibly used for rendering)
- LLPointer<LLViewerTexture> mImagep;
- LLVector3 mPosAgent;
- LLVector3 mVelocity;
- LLVector3 mAccel;
- LLVector3 mAxis;
- LLColor4 mColor;
- LLVector2 mScale;
- F32 mStartGlow;
- F32 mEndGlow;
- LLColor4U mGlow;
+ // Current particle state (possibly used for rendering)
+ LLPointer<LLViewerTexture> mImagep;
+ LLVector3 mPosAgent;
+ LLVector3 mVelocity;
+ LLVector3 mAccel;
+ LLVector3 mAxis;
+ LLColor4 mColor;
+ LLVector2 mScale;
+ F32 mStartGlow;
+ F32 mEndGlow;
+ LLColor4U mGlow;
- static U32 sNextPartID;
+ static U32 sNextPartID;
};
@@ -88,128 +88,128 @@ public:
class LLViewerPartGroup
{
public:
- LLViewerPartGroup(const LLVector3 &center,
- const F32 box_radius,
- bool hud);
- virtual ~LLViewerPartGroup();
+ LLViewerPartGroup(const LLVector3 &center,
+ const F32 box_radius,
+ bool hud);
+ virtual ~LLViewerPartGroup();
- void cleanup();
+ void cleanup();
- BOOL addPart(LLViewerPart* part, const F32 desired_size = -1.f);
-
- void updateParticles(const F32 lastdt);
+ BOOL addPart(LLViewerPart* part, const F32 desired_size = -1.f);
- BOOL posInGroup(const LLVector3 &pos, const F32 desired_size = -1.f);
+ void updateParticles(const F32 lastdt);
- void shift(const LLVector3 &offset);
+ BOOL posInGroup(const LLVector3 &pos, const F32 desired_size = -1.f);
- F32 getBoxRadius() { return mBoxRadius; }
- F32 getBoxSide() { return mBoxSide; }
+ void shift(const LLVector3 &offset);
- typedef std::vector<LLViewerPart*> part_list_t;
- part_list_t mParticles;
+ F32 getBoxRadius() { return mBoxRadius; }
+ F32 getBoxSide() { return mBoxSide; }
- const LLVector3 &getCenterAgent() const { return mCenterAgent; }
- S32 getCount() const { return (S32) mParticles.size(); }
- LLViewerRegion *getRegion() const { return mRegionp; }
+ typedef std::vector<LLViewerPart*> part_list_t;
+ part_list_t mParticles;
- void removeParticlesByID(const U32 source_id);
-
- LLPointer<LLVOPartGroup> mVOPartGroupp;
+ const LLVector3 &getCenterAgent() const { return mCenterAgent; }
+ S32 getCount() const { return (S32) mParticles.size(); }
+ LLViewerRegion *getRegion() const { return mRegionp; }
- BOOL mUniformParticles;
- U32 mID;
+ void removeParticlesByID(const U32 source_id);
- F32 mSkippedTime;
- bool mHud;
+ LLPointer<LLVOPartGroup> mVOPartGroupp;
+
+ BOOL mUniformParticles;
+ U32 mID;
+
+ F32 mSkippedTime;
+ bool mHud;
protected:
- LLVector3 mCenterAgent;
- F32 mBoxRadius;
- F32 mBoxSide;
- LLVector3 mMinObjPos;
- LLVector3 mMaxObjPos;
+ LLVector3 mCenterAgent;
+ F32 mBoxRadius;
+ F32 mBoxSide;
+ LLVector3 mMinObjPos;
+ LLVector3 mMaxObjPos;
- LLViewerRegion *mRegionp;
+ LLViewerRegion *mRegionp;
};
class LLViewerPartSim : public LLSingleton<LLViewerPartSim>
{
- LLSINGLETON(LLViewerPartSim);
+ LLSINGLETON(LLViewerPartSim);
public:
- void destroyClass();
+ void destroyClass();
+
+ typedef std::vector<LLViewerPartGroup *> group_list_t;
+ typedef std::vector<LLPointer<LLViewerPartSource> > source_list_t;
- typedef std::vector<LLViewerPartGroup *> group_list_t;
- typedef std::vector<LLPointer<LLViewerPartSource> > source_list_t;
+ void enable(bool enabled);
- void enable(bool enabled);
+ void shift(const LLVector3 &offset);
- void shift(const LLVector3 &offset);
+ void updateSimulation();
- void updateSimulation();
+ void addPartSource(LLPointer<LLViewerPartSource> sourcep);
- void addPartSource(LLPointer<LLViewerPartSource> sourcep);
+ void cleanupRegion(LLViewerRegion *regionp);
- void cleanupRegion(LLViewerRegion *regionp);
+ static BOOL shouldAddPart(); // Just decides whether this particle should be added or not (for particle count capping)
+ F32 maxRate() // Return maximum particle generation rate
+ {
+ if (sParticleCount >= MAX_PART_COUNT)
+ {
+ return 1.f;
+ }
+ if (sParticleCount > PART_THROTTLE_THRESHOLD*sMaxParticleCount)
+ {
+ return (((F32)sParticleCount/(F32)sMaxParticleCount)-PART_THROTTLE_THRESHOLD)*PART_THROTTLE_RESCALE;
+ }
+ return 0.f;
+ }
+ F32 getRefRate() { return sParticleAdaptiveRate; }
+ F32 getBurstRate() {return sParticleBurstRate; }
+ void addPart(LLViewerPart* part);
+ void updatePartBurstRate() ;
+ void clearParticlesByID(const U32 system_id);
+ void clearParticlesByOwnerID(const LLUUID& task_id);
+ void removeLastCreatedSource();
- static BOOL shouldAddPart(); // Just decides whether this particle should be added or not (for particle count capping)
- F32 maxRate() // Return maximum particle generation rate
- {
- if (sParticleCount >= MAX_PART_COUNT)
- {
- return 1.f;
- }
- if (sParticleCount > PART_THROTTLE_THRESHOLD*sMaxParticleCount)
- {
- return (((F32)sParticleCount/(F32)sMaxParticleCount)-PART_THROTTLE_THRESHOLD)*PART_THROTTLE_RESCALE;
- }
- return 0.f;
- }
- F32 getRefRate() { return sParticleAdaptiveRate; }
- F32 getBurstRate() {return sParticleBurstRate; }
- void addPart(LLViewerPart* part);
- void updatePartBurstRate() ;
- void clearParticlesByID(const U32 system_id);
- void clearParticlesByOwnerID(const LLUUID& task_id);
- void removeLastCreatedSource();
+ const source_list_t* getParticleSystemList() const { return &mViewerPartSources; }
- const source_list_t* getParticleSystemList() const { return &mViewerPartSources; }
+ friend class LLViewerPartGroup;
- friend class LLViewerPartGroup;
+ BOOL aboveParticleLimit() const { return sParticleCount > sMaxParticleCount; }
- BOOL aboveParticleLimit() const { return sParticleCount > sMaxParticleCount; }
+ static void setMaxPartCount(const S32 max_parts) { sMaxParticleCount = max_parts; }
+ static S32 getMaxPartCount() { return sMaxParticleCount; }
+ static void incPartCount(const S32 count) { sParticleCount += count; }
+ static void decPartCount(const S32 count) { sParticleCount -= count; }
- static void setMaxPartCount(const S32 max_parts) { sMaxParticleCount = max_parts; }
- static S32 getMaxPartCount() { return sMaxParticleCount; }
- static void incPartCount(const S32 count) { sParticleCount += count; }
- static void decPartCount(const S32 count) { sParticleCount -= count; }
-
- U32 mID;
+ U32 mID;
protected:
- LLViewerPartGroup *createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size, bool hud);
- LLViewerPartGroup *put(LLViewerPart* part);
+ LLViewerPartGroup *createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size, bool hud);
+ LLViewerPartGroup *put(LLViewerPart* part);
- group_list_t mViewerPartGroups;
- source_list_t mViewerPartSources;
- LLFrameTimer mSimulationTimer;
+ group_list_t mViewerPartGroups;
+ source_list_t mViewerPartSources;
+ LLFrameTimer mSimulationTimer;
- static S32 sMaxParticleCount;
- static S32 sParticleCount;
- static F32 sParticleAdaptiveRate;
- static F32 sParticleBurstRate;
+ static S32 sMaxParticleCount;
+ static S32 sParticleCount;
+ static F32 sParticleAdaptiveRate;
+ static F32 sParticleBurstRate;
- static const S32 MAX_PART_COUNT;
- static const F32 PART_THROTTLE_THRESHOLD;
- static const F32 PART_THROTTLE_RESCALE;
- static const F32 PART_ADAPT_RATE_MULT;
- static const F32 PART_ADAPT_RATE_MULT_RECIP;
+ static const S32 MAX_PART_COUNT;
+ static const F32 PART_THROTTLE_THRESHOLD;
+ static const F32 PART_THROTTLE_RESCALE;
+ static const F32 PART_ADAPT_RATE_MULT;
+ static const F32 PART_ADAPT_RATE_MULT_RECIP;
//debug use only
public:
- static S32 sParticleCount2;
+ static S32 sParticleCount2;
- static void checkParticleCount(U32 size = 0) ;
+ static void checkParticleCount(U32 size = 0) ;
};
#endif // LL_LLVIEWERPARTSIM_H
diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp
index 1751ee1ebb..f803b000db 100644
--- a/indra/newview/llviewerpartsource.cpp
+++ b/indra/newview/llviewerpartsource.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerpartsource.cpp
* @brief LLViewerPartSource class implementation
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,42 +43,42 @@
static LLVOAvatar* find_avatar(const LLUUID& id)
{
- LLViewerObject *obj = gObjectList.findObject(id);
- while (obj && obj->isAttachment())
- {
- obj = (LLViewerObject *)obj->getParent();
- }
+ LLViewerObject *obj = gObjectList.findObject(id);
+ while (obj && obj->isAttachment())
+ {
+ obj = (LLViewerObject *)obj->getParent();
+ }
- if (obj && obj->isAvatar())
- {
- return (LLVOAvatar*)obj;
- }
- else
- {
- return NULL;
- }
+ if (obj && obj->isAvatar())
+ {
+ return (LLVOAvatar*)obj;
+ }
+ else
+ {
+ return NULL;
+ }
}
LLViewerPartSource::LLViewerPartSource(const U32 type) :
- mType(type),
- mOwnerUUID(LLUUID::null),
- mPartFlags(0)
+ mType(type),
+ mOwnerUUID(LLUUID::null),
+ mPartFlags(0)
{
- mLastUpdateTime = 0.f;
- mLastPartTime = 0.f;
- mIsDead = FALSE;
- mIsSuspended = FALSE;
- static U32 id_seed = 0;
- mID = ++id_seed;
+ mLastUpdateTime = 0.f;
+ mLastPartTime = 0.f;
+ mIsDead = FALSE;
+ mIsSuspended = FALSE;
+ static U32 id_seed = 0;
+ mID = ++id_seed;
- mLastPart = NULL;
+ mLastPart = NULL;
- mDelay = 0 ;
+ mDelay = 0 ;
}
void LLViewerPartSource::setDead()
{
- mIsDead = TRUE;
+ mIsDead = TRUE;
}
@@ -86,492 +86,492 @@ void LLViewerPartSource::updatePart(LLViewerPart &part, const F32 dt)
{
}
-void LLViewerPartSource::update(const F32 dt)
+void LLViewerPartSource::update(const F32 dt)
{
- LL_ERRS() << "Creating default part source!" << LL_ENDL;
+ LL_ERRS() << "Creating default part source!" << LL_ENDL;
}
LLUUID LLViewerPartSource::getImageUUID() const
{
- LLViewerTexture* imagep = mImagep;
- if(imagep)
- {
- return imagep->getID();
- }
- return LLUUID::null;
+ LLViewerTexture* imagep = mImagep;
+ if(imagep)
+ {
+ return imagep->getID();
+ }
+ return LLUUID::null;
}
void LLViewerPartSource::setStart()
{
- //cancel delaying to start a new added particle source, because some particle source just emits for a short time.
- //however, canceling this might cause overall particle emmitting fluctuate for a while because the new added source jumps to
- //the current particle emmitting settings instantly. -->bao
- mDelay = 0 ; //99
+ //cancel delaying to start a new added particle source, because some particle source just emits for a short time.
+ //however, canceling this might cause overall particle emmitting fluctuate for a while because the new added source jumps to
+ //the current particle emmitting settings instantly. -->bao
+ mDelay = 0 ; //99
}
LLViewerPartSourceScript::LLViewerPartSourceScript(LLViewerObject *source_objp) :
- LLViewerPartSource(LL_PART_SOURCE_SCRIPT)
+ LLViewerPartSource(LL_PART_SOURCE_SCRIPT)
{
- llassert(source_objp);
- mSourceObjectp = source_objp;
- mPosAgent = mSourceObjectp->getPositionAgent();
- mImagep = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
-
- mImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
+ llassert(source_objp);
+ mSourceObjectp = source_objp;
+ mPosAgent = mSourceObjectp->getPositionAgent();
+ mImagep = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
+
+ mImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
}
void LLViewerPartSourceScript::setDead()
{
- mIsDead = TRUE;
- mSourceObjectp = NULL;
- mTargetObjectp = NULL;
+ mIsDead = TRUE;
+ mSourceObjectp = NULL;
+ mTargetObjectp = NULL;
}
void LLViewerPartSourceScript::update(const F32 dt)
{
- if( mIsSuspended )
- return;
-
- if (mOwnerAvatarp.isNull() && mOwnerUUID != LLUUID::null)
- {
- mOwnerAvatarp = find_avatar(mOwnerUUID);
- }
- if (mOwnerAvatarp.notNull() && LLVOAvatar::AOA_NORMAL != mOwnerAvatarp->getOverallAppearance())
- {
- return;
- }
-
- F32 old_update_time = mLastUpdateTime;
- mLastUpdateTime += dt;
-
- F32 ref_rate_travelspeed = llmin(LLViewerPartSim::getInstance()->getRefRate(), 1.f);
-
- F32 dt_update = mLastUpdateTime - mLastPartTime;
-
- // Update this for objects which have the follow flag set...
- if (!mSourceObjectp.isNull())
- {
- if (mSourceObjectp->isDead())
- {
- mSourceObjectp = NULL;
- }
- else if (mSourceObjectp->mDrawable.notNull())
- {
- mPosAgent = mSourceObjectp->getRenderPosition();
- }
- }
-
- if (mTargetObjectp.isNull()
- && mPartSysData.mTargetUUID.notNull())
- {
- //
- // Hmm, missing object, let's see if we can find it...
- //
-
- LLViewerObject *target_objp = gObjectList.findObject(mPartSysData.mTargetUUID);
- setTargetObject(target_objp);
- }
-
- if (!mTargetObjectp.isNull())
- {
- if (mTargetObjectp->isDead())
- {
- mTargetObjectp = NULL;
- }
- else if (mTargetObjectp->mDrawable.notNull())
- {
- mTargetPosAgent = mTargetObjectp->getRenderPosition();
- }
- }
-
- if (!mTargetObjectp)
- {
- mTargetPosAgent = mPosAgent;
- }
-
- if (mPartSysData.mMaxAge && ((mPartSysData.mStartAge + mLastUpdateTime + dt_update) > mPartSysData.mMaxAge))
- {
- // Kill particle source because it has outlived its max age...
- setDead();
- return;
- }
-
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PARTICLES))
- {
- if (mSourceObjectp.notNull())
- {
- std::ostringstream ostr;
- ostr << mPartSysData;
- mSourceObjectp->setDebugText(ostr.str());
- }
- }
-
- BOOL first_run = FALSE;
- if (old_update_time <= 0.f)
- {
- first_run = TRUE;
- }
-
- F32 max_time = llmax(1.f, 10.f*mPartSysData.mBurstRate);
- dt_update = llmin(max_time, dt_update);
- while ((dt_update > mPartSysData.mBurstRate) || first_run)
- {
- first_run = FALSE;
-
- // Update the rotation of the particle source by the angular velocity
- // First check to see if there is still an angular velocity.
- F32 angular_velocity_mag = mPartSysData.mAngularVelocity.magVec();
- if (angular_velocity_mag != 0.0f)
- {
- F32 av_angle = dt * angular_velocity_mag;
- LLQuaternion dquat(av_angle, mPartSysData.mAngularVelocity);
- mRotation *= dquat;
- }
- else
- {
- // No angular velocity. Reset our rotation.
- mRotation.setQuat(0, 0, 0);
- }
-
- if (LLViewerPartSim::getInstance()->aboveParticleLimit())
- {
- // Don't bother doing any more updates if we're above the particle limit,
- // just give up.
- mLastPartTime = mLastUpdateTime;
+ if( mIsSuspended )
+ return;
+
+ if (mOwnerAvatarp.isNull() && mOwnerUUID != LLUUID::null)
+ {
+ mOwnerAvatarp = find_avatar(mOwnerUUID);
+ }
+ if (mOwnerAvatarp.notNull() && LLVOAvatar::AOA_NORMAL != mOwnerAvatarp->getOverallAppearance())
+ {
+ return;
+ }
+
+ F32 old_update_time = mLastUpdateTime;
+ mLastUpdateTime += dt;
+
+ F32 ref_rate_travelspeed = llmin(LLViewerPartSim::getInstance()->getRefRate(), 1.f);
+
+ F32 dt_update = mLastUpdateTime - mLastPartTime;
+
+ // Update this for objects which have the follow flag set...
+ if (!mSourceObjectp.isNull())
+ {
+ if (mSourceObjectp->isDead())
+ {
+ mSourceObjectp = NULL;
+ }
+ else if (mSourceObjectp->mDrawable.notNull())
+ {
+ mPosAgent = mSourceObjectp->getRenderPosition();
+ }
+ }
+
+ if (mTargetObjectp.isNull()
+ && mPartSysData.mTargetUUID.notNull())
+ {
+ //
+ // Hmm, missing object, let's see if we can find it...
+ //
+
+ LLViewerObject *target_objp = gObjectList.findObject(mPartSysData.mTargetUUID);
+ setTargetObject(target_objp);
+ }
+
+ if (!mTargetObjectp.isNull())
+ {
+ if (mTargetObjectp->isDead())
+ {
+ mTargetObjectp = NULL;
+ }
+ else if (mTargetObjectp->mDrawable.notNull())
+ {
+ mTargetPosAgent = mTargetObjectp->getRenderPosition();
+ }
+ }
+
+ if (!mTargetObjectp)
+ {
+ mTargetPosAgent = mPosAgent;
+ }
+
+ if (mPartSysData.mMaxAge && ((mPartSysData.mStartAge + mLastUpdateTime + dt_update) > mPartSysData.mMaxAge))
+ {
+ // Kill particle source because it has outlived its max age...
+ setDead();
+ return;
+ }
+
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PARTICLES))
+ {
+ if (mSourceObjectp.notNull())
+ {
+ std::ostringstream ostr;
+ ostr << mPartSysData;
+ mSourceObjectp->setDebugText(ostr.str());
+ }
+ }
+
+ BOOL first_run = FALSE;
+ if (old_update_time <= 0.f)
+ {
+ first_run = TRUE;
+ }
+
+ F32 max_time = llmax(1.f, 10.f*mPartSysData.mBurstRate);
+ dt_update = llmin(max_time, dt_update);
+ while ((dt_update > mPartSysData.mBurstRate) || first_run)
+ {
+ first_run = FALSE;
+
+ // Update the rotation of the particle source by the angular velocity
+ // First check to see if there is still an angular velocity.
+ F32 angular_velocity_mag = mPartSysData.mAngularVelocity.magVec();
+ if (angular_velocity_mag != 0.0f)
+ {
+ F32 av_angle = dt * angular_velocity_mag;
+ LLQuaternion dquat(av_angle, mPartSysData.mAngularVelocity);
+ mRotation *= dquat;
+ }
+ else
+ {
+ // No angular velocity. Reset our rotation.
+ mRotation.setQuat(0, 0, 0);
+ }
+
+ if (LLViewerPartSim::getInstance()->aboveParticleLimit())
+ {
+ // Don't bother doing any more updates if we're above the particle limit,
+ // just give up.
+ mLastPartTime = mLastUpdateTime;
break;
- }
-
- // find the greatest length that the shortest side of a system
- // particle is expected to have
- F32 max_short_side =
- llmax(
- llmax(llmin(mPartSysData.mPartData.mStartScale[0],
- mPartSysData.mPartData.mStartScale[1]),
- llmin(mPartSysData.mPartData.mEndScale[0],
- mPartSysData.mPartData.mEndScale[1])),
- llmin((mPartSysData.mPartData.mStartScale[0]
- + mPartSysData.mPartData.mEndScale[0])/2,
- (mPartSysData.mPartData.mStartScale[1]
- + mPartSysData.mPartData.mEndScale[1])/2));
-
- F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
-
- // Maximum distance at which spawned particles will be viewable
- F32 max_dist = max_short_side * pixel_meter_ratio;
-
- if (max_dist < 0.25f)
- {
- // < 1 pixel wide at a distance of >=25cm. Particles
- // this tiny are useless and mostly spawned by buggy
- // sources
- mLastPartTime = mLastUpdateTime;
- break;
- }
-
- // Distance from camera
- F32 dist = (mPosAgent - LLViewerCamera::getInstance()->getOrigin()).magVec();
-
- // Particle size vs distance vs maxage throttling
-
- F32 limited_rate=0.f;
- if (dist - max_dist > 0.f)
- {
- if((dist - max_dist) * ref_rate_travelspeed > mPartSysData.mPartData.mMaxAge - 0.2f )
- {
- // You need to travel faster than 1 divided by reference rate m/s directly towards these particles to see them at least 0.2s
- mLastPartTime = mLastUpdateTime;
- break;
- }
- limited_rate = ((dist - max_dist) * ref_rate_travelspeed) / mPartSysData.mPartData.mMaxAge;
- }
-
- if(mDelay)
- {
- limited_rate = llmax(limited_rate, 0.01f * mDelay--) ;
- }
-
- S32 i;
- for (i = 0; i < mPartSysData.mBurstPartCount; i++)
- {
- if (ll_frand() < llmax(1.0f - LLViewerPartSim::getInstance()->getBurstRate(), limited_rate))
- {
- // Limit particle generation
- continue;
- }
-
- LLViewerPart* part = new LLViewerPart();
-
- part->init(this, mImagep, NULL);
- part->mFlags = mPartSysData.mPartData.mFlags;
- if (!mSourceObjectp.isNull() && mSourceObjectp->isHUDAttachment())
- {
- part->mFlags |= LLPartData::LL_PART_HUD;
- }
-
- if (part->mFlags & LLPartData::LL_PART_RIBBON_MASK && mLastPart)
- { //set previous particle's parent to this particle to chain ribbon together
- mLastPart->mParent = part;
- part->mChild = mLastPart;
- part->mAxis = LLVector3(0,0,1);
-
- if (mSourceObjectp.notNull())
- {
- LLQuaternion rot = mSourceObjectp->getRenderRotation();
- part->mAxis *= rot;
- }
- }
-
- mLastPart = part;
-
- part->mMaxAge = mPartSysData.mPartData.mMaxAge;
- part->mStartColor = mPartSysData.mPartData.mStartColor;
- part->mEndColor = mPartSysData.mPartData.mEndColor;
- part->mColor = part->mStartColor;
-
- part->mStartScale = mPartSysData.mPartData.mStartScale;
- part->mEndScale = mPartSysData.mPartData.mEndScale;
- part->mScale = part->mStartScale;
-
- part->mAccel = mPartSysData.mPartAccel;
-
- part->mBlendFuncDest = mPartSysData.mPartData.mBlendFuncDest;
- part->mBlendFuncSource = mPartSysData.mPartData.mBlendFuncSource;
-
- part->mStartGlow = mPartSysData.mPartData.mStartGlow;
- part->mEndGlow = mPartSysData.mPartData.mEndGlow;
- part->mGlow = LLColor4U(0, 0, 0, (U8) ll_round(part->mStartGlow*255.f));
-
- if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_DROP)
- {
- part->mPosAgent = mPosAgent;
- part->mVelocity.setVec(0.f, 0.f, 0.f);
- }
- else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_EXPLODE)
- {
- part->mPosAgent = mPosAgent;
- LLVector3 part_dir_vector;
-
- F32 mvs;
- do
- {
- part_dir_vector.mV[VX] = ll_frand(2.f) - 1.f;
- part_dir_vector.mV[VY] = ll_frand(2.f) - 1.f;
- part_dir_vector.mV[VZ] = ll_frand(2.f) - 1.f;
- mvs = part_dir_vector.magVecSquared();
- }
- while ((mvs > 1.f) || (mvs < 0.01f));
-
- part_dir_vector.normVec();
- part->mPosAgent += mPartSysData.mBurstRadius*part_dir_vector;
- part->mVelocity = part_dir_vector;
- F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin);
- part->mVelocity *= speed;
- }
- else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE
- || mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE)
- {
- part->mPosAgent = mPosAgent;
-
- // original implemenetation for part_dir_vector was just:
- LLVector3 part_dir_vector(0.0, 0.0, 1.0);
- // params from the script...
- // outer = outer cone angle
- // inner = inner cone angle
- // between outer and inner there will be particles
- F32 innerAngle = mPartSysData.mInnerAngle;
- F32 outerAngle = mPartSysData.mOuterAngle;
-
- // generate a random angle within the given space...
- F32 angle = innerAngle + ll_frand(outerAngle - innerAngle);
- // split which side it will go on randomly...
- if (ll_frand() < 0.5)
- {
- angle = -angle;
- }
- // Both patterns rotate around the x-axis first:
- part_dir_vector.rotVec(angle, 1.0, 0.0, 0.0);
-
- // If this is a cone pattern, rotate again to create the cone.
- if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE)
- {
- part_dir_vector.rotVec(ll_frand(4*F_PI), 0.0, 0.0, 1.0);
- }
-
- // Only apply this rotation if using the deprecated angles.
- if (! (mPartSysData.mFlags & LLPartSysData::LL_PART_USE_NEW_ANGLE))
- {
- // Deprecated...
- part_dir_vector.rotVec(outerAngle, 1.0, 0.0, 0.0);
- }
-
- if (mSourceObjectp)
- {
- part_dir_vector = part_dir_vector * mSourceObjectp->getRenderRotation();
- }
-
- part_dir_vector = part_dir_vector * mRotation;
-
- part->mPosAgent += mPartSysData.mBurstRadius*part_dir_vector;
-
- part->mVelocity = part_dir_vector;
-
- F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin);
- part->mVelocity *= speed;
- }
- else
- {
- part->mPosAgent = mPosAgent;
- part->mVelocity.setVec(0.f, 0.f, 0.f);
- //LL_WARNS() << "Unknown source pattern " << (S32)mPartSysData.mPattern << LL_ENDL;
- }
-
- if (part->mFlags & LLPartData::LL_PART_FOLLOW_SRC_MASK || // SVC-193, VWR-717
- part->mFlags & LLPartData::LL_PART_TARGET_LINEAR_MASK)
- {
- mPartSysData.mBurstRadius = 0;
- }
-
- LLViewerPartSim::getInstance()->addPart(part);
- }
-
- mLastPartTime = mLastUpdateTime;
- dt_update -= mPartSysData.mBurstRate;
- }
+ }
+
+ // find the greatest length that the shortest side of a system
+ // particle is expected to have
+ F32 max_short_side =
+ llmax(
+ llmax(llmin(mPartSysData.mPartData.mStartScale[0],
+ mPartSysData.mPartData.mStartScale[1]),
+ llmin(mPartSysData.mPartData.mEndScale[0],
+ mPartSysData.mPartData.mEndScale[1])),
+ llmin((mPartSysData.mPartData.mStartScale[0]
+ + mPartSysData.mPartData.mEndScale[0])/2,
+ (mPartSysData.mPartData.mStartScale[1]
+ + mPartSysData.mPartData.mEndScale[1])/2));
+
+ F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
+
+ // Maximum distance at which spawned particles will be viewable
+ F32 max_dist = max_short_side * pixel_meter_ratio;
+
+ if (max_dist < 0.25f)
+ {
+ // < 1 pixel wide at a distance of >=25cm. Particles
+ // this tiny are useless and mostly spawned by buggy
+ // sources
+ mLastPartTime = mLastUpdateTime;
+ break;
+ }
+
+ // Distance from camera
+ F32 dist = (mPosAgent - LLViewerCamera::getInstance()->getOrigin()).magVec();
+
+ // Particle size vs distance vs maxage throttling
+
+ F32 limited_rate=0.f;
+ if (dist - max_dist > 0.f)
+ {
+ if((dist - max_dist) * ref_rate_travelspeed > mPartSysData.mPartData.mMaxAge - 0.2f )
+ {
+ // You need to travel faster than 1 divided by reference rate m/s directly towards these particles to see them at least 0.2s
+ mLastPartTime = mLastUpdateTime;
+ break;
+ }
+ limited_rate = ((dist - max_dist) * ref_rate_travelspeed) / mPartSysData.mPartData.mMaxAge;
+ }
+
+ if(mDelay)
+ {
+ limited_rate = llmax(limited_rate, 0.01f * mDelay--) ;
+ }
+
+ S32 i;
+ for (i = 0; i < mPartSysData.mBurstPartCount; i++)
+ {
+ if (ll_frand() < llmax(1.0f - LLViewerPartSim::getInstance()->getBurstRate(), limited_rate))
+ {
+ // Limit particle generation
+ continue;
+ }
+
+ LLViewerPart* part = new LLViewerPart();
+
+ part->init(this, mImagep, NULL);
+ part->mFlags = mPartSysData.mPartData.mFlags;
+ if (!mSourceObjectp.isNull() && mSourceObjectp->isHUDAttachment())
+ {
+ part->mFlags |= LLPartData::LL_PART_HUD;
+ }
+
+ if (part->mFlags & LLPartData::LL_PART_RIBBON_MASK && mLastPart)
+ { //set previous particle's parent to this particle to chain ribbon together
+ mLastPart->mParent = part;
+ part->mChild = mLastPart;
+ part->mAxis = LLVector3(0,0,1);
+
+ if (mSourceObjectp.notNull())
+ {
+ LLQuaternion rot = mSourceObjectp->getRenderRotation();
+ part->mAxis *= rot;
+ }
+ }
+
+ mLastPart = part;
+
+ part->mMaxAge = mPartSysData.mPartData.mMaxAge;
+ part->mStartColor = mPartSysData.mPartData.mStartColor;
+ part->mEndColor = mPartSysData.mPartData.mEndColor;
+ part->mColor = part->mStartColor;
+
+ part->mStartScale = mPartSysData.mPartData.mStartScale;
+ part->mEndScale = mPartSysData.mPartData.mEndScale;
+ part->mScale = part->mStartScale;
+
+ part->mAccel = mPartSysData.mPartAccel;
+
+ part->mBlendFuncDest = mPartSysData.mPartData.mBlendFuncDest;
+ part->mBlendFuncSource = mPartSysData.mPartData.mBlendFuncSource;
+
+ part->mStartGlow = mPartSysData.mPartData.mStartGlow;
+ part->mEndGlow = mPartSysData.mPartData.mEndGlow;
+ part->mGlow = LLColor4U(0, 0, 0, (U8) ll_round(part->mStartGlow*255.f));
+
+ if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_DROP)
+ {
+ part->mPosAgent = mPosAgent;
+ part->mVelocity.setVec(0.f, 0.f, 0.f);
+ }
+ else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_EXPLODE)
+ {
+ part->mPosAgent = mPosAgent;
+ LLVector3 part_dir_vector;
+
+ F32 mvs;
+ do
+ {
+ part_dir_vector.mV[VX] = ll_frand(2.f) - 1.f;
+ part_dir_vector.mV[VY] = ll_frand(2.f) - 1.f;
+ part_dir_vector.mV[VZ] = ll_frand(2.f) - 1.f;
+ mvs = part_dir_vector.magVecSquared();
+ }
+ while ((mvs > 1.f) || (mvs < 0.01f));
+
+ part_dir_vector.normVec();
+ part->mPosAgent += mPartSysData.mBurstRadius*part_dir_vector;
+ part->mVelocity = part_dir_vector;
+ F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin);
+ part->mVelocity *= speed;
+ }
+ else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE
+ || mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE)
+ {
+ part->mPosAgent = mPosAgent;
+
+ // original implemenetation for part_dir_vector was just:
+ LLVector3 part_dir_vector(0.0, 0.0, 1.0);
+ // params from the script...
+ // outer = outer cone angle
+ // inner = inner cone angle
+ // between outer and inner there will be particles
+ F32 innerAngle = mPartSysData.mInnerAngle;
+ F32 outerAngle = mPartSysData.mOuterAngle;
+
+ // generate a random angle within the given space...
+ F32 angle = innerAngle + ll_frand(outerAngle - innerAngle);
+ // split which side it will go on randomly...
+ if (ll_frand() < 0.5)
+ {
+ angle = -angle;
+ }
+ // Both patterns rotate around the x-axis first:
+ part_dir_vector.rotVec(angle, 1.0, 0.0, 0.0);
+
+ // If this is a cone pattern, rotate again to create the cone.
+ if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE)
+ {
+ part_dir_vector.rotVec(ll_frand(4*F_PI), 0.0, 0.0, 1.0);
+ }
+
+ // Only apply this rotation if using the deprecated angles.
+ if (! (mPartSysData.mFlags & LLPartSysData::LL_PART_USE_NEW_ANGLE))
+ {
+ // Deprecated...
+ part_dir_vector.rotVec(outerAngle, 1.0, 0.0, 0.0);
+ }
+
+ if (mSourceObjectp)
+ {
+ part_dir_vector = part_dir_vector * mSourceObjectp->getRenderRotation();
+ }
+
+ part_dir_vector = part_dir_vector * mRotation;
+
+ part->mPosAgent += mPartSysData.mBurstRadius*part_dir_vector;
+
+ part->mVelocity = part_dir_vector;
+
+ F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin);
+ part->mVelocity *= speed;
+ }
+ else
+ {
+ part->mPosAgent = mPosAgent;
+ part->mVelocity.setVec(0.f, 0.f, 0.f);
+ //LL_WARNS() << "Unknown source pattern " << (S32)mPartSysData.mPattern << LL_ENDL;
+ }
+
+ if (part->mFlags & LLPartData::LL_PART_FOLLOW_SRC_MASK || // SVC-193, VWR-717
+ part->mFlags & LLPartData::LL_PART_TARGET_LINEAR_MASK)
+ {
+ mPartSysData.mBurstRadius = 0;
+ }
+
+ LLViewerPartSim::getInstance()->addPart(part);
+ }
+
+ mLastPartTime = mLastUpdateTime;
+ dt_update -= mPartSysData.mBurstRate;
+ }
}
// static
LLPointer<LLViewerPartSourceScript> LLViewerPartSourceScript::unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, const S32 block_num)
{
- if (!pssp)
- {
- if (LLPartSysData::isNullPS(block_num))
- {
- return NULL;
- }
- LLPointer<LLViewerPartSourceScript> new_pssp = new LLViewerPartSourceScript(source_objp);
- if (!new_pssp->mPartSysData.unpackBlock(block_num))
- {
- return NULL;
- }
- if (new_pssp->mPartSysData.mTargetUUID.notNull())
- {
- LLViewerObject *target_objp = gObjectList.findObject(new_pssp->mPartSysData.mTargetUUID);
- new_pssp->setTargetObject(target_objp);
- }
- return new_pssp;
- }
- else
- {
- if (LLPartSysData::isNullPS(block_num))
- {
- return NULL;
- }
-
- F32 prev_max_age = pssp->mPartSysData.mMaxAge;
- F32 prev_start_age = pssp->mPartSysData.mStartAge;
- if (!pssp->mPartSysData.unpackBlock(block_num))
- {
- return NULL;
- }
- else if (pssp->mPartSysData.mMaxAge
- && (prev_max_age != pssp->mPartSysData.mMaxAge || prev_start_age != pssp->mPartSysData.mStartAge))
- {
- // reusing existing pss, so reset time to allow particles to start again
- pssp->mLastUpdateTime = 0.f;
- pssp->mLastPartTime = 0.f;
- }
-
- if (pssp->mPartSysData.mTargetUUID.notNull())
- {
- LLViewerObject *target_objp = gObjectList.findObject(pssp->mPartSysData.mTargetUUID);
- pssp->setTargetObject(target_objp);
- }
- return pssp;
- }
+ if (!pssp)
+ {
+ if (LLPartSysData::isNullPS(block_num))
+ {
+ return NULL;
+ }
+ LLPointer<LLViewerPartSourceScript> new_pssp = new LLViewerPartSourceScript(source_objp);
+ if (!new_pssp->mPartSysData.unpackBlock(block_num))
+ {
+ return NULL;
+ }
+ if (new_pssp->mPartSysData.mTargetUUID.notNull())
+ {
+ LLViewerObject *target_objp = gObjectList.findObject(new_pssp->mPartSysData.mTargetUUID);
+ new_pssp->setTargetObject(target_objp);
+ }
+ return new_pssp;
+ }
+ else
+ {
+ if (LLPartSysData::isNullPS(block_num))
+ {
+ return NULL;
+ }
+
+ F32 prev_max_age = pssp->mPartSysData.mMaxAge;
+ F32 prev_start_age = pssp->mPartSysData.mStartAge;
+ if (!pssp->mPartSysData.unpackBlock(block_num))
+ {
+ return NULL;
+ }
+ else if (pssp->mPartSysData.mMaxAge
+ && (prev_max_age != pssp->mPartSysData.mMaxAge || prev_start_age != pssp->mPartSysData.mStartAge))
+ {
+ // reusing existing pss, so reset time to allow particles to start again
+ pssp->mLastUpdateTime = 0.f;
+ pssp->mLastPartTime = 0.f;
+ }
+
+ if (pssp->mPartSysData.mTargetUUID.notNull())
+ {
+ LLViewerObject *target_objp = gObjectList.findObject(pssp->mPartSysData.mTargetUUID);
+ pssp->setTargetObject(target_objp);
+ }
+ return pssp;
+ }
}
LLPointer<LLViewerPartSourceScript> LLViewerPartSourceScript::unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, LLDataPacker &dp, bool legacy)
{
- if (!pssp)
- {
- LLPointer<LLViewerPartSourceScript> new_pssp = new LLViewerPartSourceScript(source_objp);
- if (legacy)
- {
- if (!new_pssp->mPartSysData.unpackLegacy(dp))
- {
- return NULL;
- }
- }
- else
- {
- if (!new_pssp->mPartSysData.unpack(dp))
- {
- return NULL;
- }
- }
-
- if (new_pssp->mPartSysData.mTargetUUID.notNull())
- {
- LLViewerObject *target_objp = gObjectList.findObject(new_pssp->mPartSysData.mTargetUUID);
- new_pssp->setTargetObject(target_objp);
- }
-
- return new_pssp;
- }
- else
- {
- if (legacy)
- {
- if (!pssp->mPartSysData.unpackLegacy(dp))
- {
- return NULL;
- }
- }
- else
- {
- if (!pssp->mPartSysData.unpack(dp))
- {
- return NULL;
- }
- }
-
- if (pssp->mPartSysData.mTargetUUID.notNull())
- {
- LLViewerObject *target_objp = gObjectList.findObject(pssp->mPartSysData.mTargetUUID);
- pssp->setTargetObject(target_objp);
- }
- return pssp;
- }
+ if (!pssp)
+ {
+ LLPointer<LLViewerPartSourceScript> new_pssp = new LLViewerPartSourceScript(source_objp);
+ if (legacy)
+ {
+ if (!new_pssp->mPartSysData.unpackLegacy(dp))
+ {
+ return NULL;
+ }
+ }
+ else
+ {
+ if (!new_pssp->mPartSysData.unpack(dp))
+ {
+ return NULL;
+ }
+ }
+
+ if (new_pssp->mPartSysData.mTargetUUID.notNull())
+ {
+ LLViewerObject *target_objp = gObjectList.findObject(new_pssp->mPartSysData.mTargetUUID);
+ new_pssp->setTargetObject(target_objp);
+ }
+
+ return new_pssp;
+ }
+ else
+ {
+ if (legacy)
+ {
+ if (!pssp->mPartSysData.unpackLegacy(dp))
+ {
+ return NULL;
+ }
+ }
+ else
+ {
+ if (!pssp->mPartSysData.unpack(dp))
+ {
+ return NULL;
+ }
+ }
+
+ if (pssp->mPartSysData.mTargetUUID.notNull())
+ {
+ LLViewerObject *target_objp = gObjectList.findObject(pssp->mPartSysData.mTargetUUID);
+ pssp->setTargetObject(target_objp);
+ }
+ return pssp;
+ }
}
/* static */
LLPointer<LLViewerPartSourceScript> LLViewerPartSourceScript::createPSS(LLViewerObject *source_objp, const LLPartSysData& particle_parameters)
{
- LLPointer<LLViewerPartSourceScript> new_pssp = new LLViewerPartSourceScript(source_objp);
+ LLPointer<LLViewerPartSourceScript> new_pssp = new LLViewerPartSourceScript(source_objp);
- new_pssp->mPartSysData = particle_parameters;
+ new_pssp->mPartSysData = particle_parameters;
- if (new_pssp->mPartSysData.mTargetUUID.notNull())
- {
- LLViewerObject *target_objp = gObjectList.findObject(new_pssp->mPartSysData.mTargetUUID);
- new_pssp->setTargetObject(target_objp);
- }
- return new_pssp;
+ if (new_pssp->mPartSysData.mTargetUUID.notNull())
+ {
+ LLViewerObject *target_objp = gObjectList.findObject(new_pssp->mPartSysData.mTargetUUID);
+ new_pssp->setTargetObject(target_objp);
+ }
+ return new_pssp;
}
void LLViewerPartSourceScript::setImage(LLViewerTexture *imagep)
{
- mImagep = imagep;
+ mImagep = imagep;
}
void LLViewerPartSourceScript::setTargetObject(LLViewerObject *objp)
{
- mTargetObjectp = objp;
+ mTargetObjectp = objp;
}
@@ -579,100 +579,100 @@ void LLViewerPartSourceScript::setTargetObject(LLViewerObject *objp)
LLViewerPartSourceSpiral::LLViewerPartSourceSpiral(const LLVector3 &pos) :
- LLViewerPartSource(LL_PART_SOURCE_CHAT)
+ LLViewerPartSource(LL_PART_SOURCE_CHAT)
{
- mPosAgent = pos;
+ mPosAgent = pos;
}
void LLViewerPartSourceSpiral::setDead()
{
- mIsDead = TRUE;
- mSourceObjectp = NULL;
+ mIsDead = TRUE;
+ mSourceObjectp = NULL;
}
void LLViewerPartSourceSpiral::updatePart(LLViewerPart &part, const F32 dt)
{
- F32 frac = part.mLastUpdateTime/part.mMaxAge;
+ F32 frac = part.mLastUpdateTime/part.mMaxAge;
- LLVector3 center_pos;
- LLPointer<LLViewerPartSource>& ps = part.mPartSourcep;
- LLViewerPartSourceSpiral *pss = (LLViewerPartSourceSpiral *)ps.get();
- if (!pss->mSourceObjectp.isNull() && !pss->mSourceObjectp->mDrawable.isNull())
- {
- part.mPosAgent = pss->mSourceObjectp->getRenderPosition();
- }
- else
- {
- part.mPosAgent = pss->mPosAgent;
- }
- F32 x = sin(F_TWO_PI*frac + part.mParameter);
- F32 y = cos(F_TWO_PI*frac + part.mParameter);
+ LLVector3 center_pos;
+ LLPointer<LLViewerPartSource>& ps = part.mPartSourcep;
+ LLViewerPartSourceSpiral *pss = (LLViewerPartSourceSpiral *)ps.get();
+ if (!pss->mSourceObjectp.isNull() && !pss->mSourceObjectp->mDrawable.isNull())
+ {
+ part.mPosAgent = pss->mSourceObjectp->getRenderPosition();
+ }
+ else
+ {
+ part.mPosAgent = pss->mPosAgent;
+ }
+ F32 x = sin(F_TWO_PI*frac + part.mParameter);
+ F32 y = cos(F_TWO_PI*frac + part.mParameter);
- part.mPosAgent.mV[VX] += x;
- part.mPosAgent.mV[VY] += y;
- part.mPosAgent.mV[VZ] += -0.5f + frac;
+ part.mPosAgent.mV[VX] += x;
+ part.mPosAgent.mV[VY] += y;
+ part.mPosAgent.mV[VZ] += -0.5f + frac;
}
void LLViewerPartSourceSpiral::update(const F32 dt)
{
- if (!mImagep)
- {
- mImagep = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
- }
-
- const F32 RATE = 0.025f;
-
- mLastUpdateTime += dt;
-
- F32 dt_update = mLastUpdateTime - mLastPartTime;
- F32 max_time = llmax(1.f, 10.f*RATE);
- dt_update = llmin(max_time, dt_update);
-
- if (dt_update > RATE)
- {
- mLastPartTime = mLastUpdateTime;
- if (!LLViewerPartSim::getInstance()->shouldAddPart())
- {
- // Particle simulation says we have too many particles, skip all this
- return;
- }
-
- if (!mSourceObjectp.isNull() && !mSourceObjectp->mDrawable.isNull())
- {
- mPosAgent = mSourceObjectp->getRenderPosition();
- }
- LLViewerPart* part = new LLViewerPart();
- part->init(this, mImagep, updatePart);
- part->mStartColor = mColor;
- part->mEndColor = mColor;
- part->mEndColor.mV[3] = 0.f;
- part->mPosAgent = mPosAgent;
- part->mMaxAge = 1.f;
- part->mFlags = LLViewerPart::LL_PART_INTERP_COLOR_MASK;
- part->mLastUpdateTime = 0.f;
- part->mScale.mV[0] = 0.25f;
- part->mScale.mV[1] = 0.25f;
- part->mParameter = ll_frand(F_TWO_PI);
- part->mBlendFuncDest = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
- part->mBlendFuncSource = LLRender::BF_SOURCE_ALPHA;
- part->mStartGlow = 0.f;
- part->mEndGlow = 0.f;
- part->mGlow = LLColor4U(0, 0, 0, 0);
-
- LLViewerPartSim::getInstance()->addPart(part);
- }
+ if (!mImagep)
+ {
+ mImagep = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
+ }
+
+ const F32 RATE = 0.025f;
+
+ mLastUpdateTime += dt;
+
+ F32 dt_update = mLastUpdateTime - mLastPartTime;
+ F32 max_time = llmax(1.f, 10.f*RATE);
+ dt_update = llmin(max_time, dt_update);
+
+ if (dt_update > RATE)
+ {
+ mLastPartTime = mLastUpdateTime;
+ if (!LLViewerPartSim::getInstance()->shouldAddPart())
+ {
+ // Particle simulation says we have too many particles, skip all this
+ return;
+ }
+
+ if (!mSourceObjectp.isNull() && !mSourceObjectp->mDrawable.isNull())
+ {
+ mPosAgent = mSourceObjectp->getRenderPosition();
+ }
+ LLViewerPart* part = new LLViewerPart();
+ part->init(this, mImagep, updatePart);
+ part->mStartColor = mColor;
+ part->mEndColor = mColor;
+ part->mEndColor.mV[3] = 0.f;
+ part->mPosAgent = mPosAgent;
+ part->mMaxAge = 1.f;
+ part->mFlags = LLViewerPart::LL_PART_INTERP_COLOR_MASK;
+ part->mLastUpdateTime = 0.f;
+ part->mScale.mV[0] = 0.25f;
+ part->mScale.mV[1] = 0.25f;
+ part->mParameter = ll_frand(F_TWO_PI);
+ part->mBlendFuncDest = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
+ part->mBlendFuncSource = LLRender::BF_SOURCE_ALPHA;
+ part->mStartGlow = 0.f;
+ part->mEndGlow = 0.f;
+ part->mGlow = LLColor4U(0, 0, 0, 0);
+
+ LLViewerPartSim::getInstance()->addPart(part);
+ }
}
void LLViewerPartSourceSpiral::setSourceObject(LLViewerObject *objp)
{
- mSourceObjectp = objp;
+ mSourceObjectp = objp;
}
void LLViewerPartSourceSpiral::setColor(const LLColor4 &color)
{
- mColor = color;
+ mColor = color;
}
@@ -680,7 +680,7 @@ void LLViewerPartSourceSpiral::setColor(const LLColor4 &color)
LLViewerPartSourceBeam::LLViewerPartSourceBeam() :
- LLViewerPartSource(LL_PART_SOURCE_BEAM)
+ LLViewerPartSource(LL_PART_SOURCE_BEAM)
{
}
@@ -690,257 +690,257 @@ LLViewerPartSourceBeam::~LLViewerPartSourceBeam()
void LLViewerPartSourceBeam::setDead()
{
- mIsDead = TRUE;
- mSourceObjectp = NULL;
- mTargetObjectp = NULL;
+ mIsDead = TRUE;
+ mSourceObjectp = NULL;
+ mTargetObjectp = NULL;
}
void LLViewerPartSourceBeam::setColor(const LLColor4 &color)
{
- mColor = color;
+ mColor = color;
}
void LLViewerPartSourceBeam::updatePart(LLViewerPart &part, const F32 dt)
{
- F32 frac = part.mLastUpdateTime/part.mMaxAge;
-
- LLViewerPartSource *ps = (LLViewerPartSource*)part.mPartSourcep;
- LLViewerPartSourceBeam *psb = (LLViewerPartSourceBeam *)ps;
- if (psb->mSourceObjectp.isNull())
- {
- part.mFlags = LLPartData::LL_PART_DEAD_MASK;
- return;
- }
-
- LLVector3 source_pos_agent;
- LLVector3 target_pos_agent;
- if (!psb->mSourceObjectp.isNull() && !psb->mSourceObjectp->mDrawable.isNull())
- {
- if (psb->mSourceObjectp->isAvatar())
- {
- LLViewerObject *objp = psb->mSourceObjectp;
- LLVOAvatar *avp = (LLVOAvatar *)objp;
- source_pos_agent = avp->mWristLeftp->getWorldPosition();
- }
- else
- {
- source_pos_agent = psb->mSourceObjectp->getRenderPosition();
- }
- }
- if (!psb->mTargetObjectp.isNull() && !psb->mTargetObjectp->mDrawable.isNull())
- {
- target_pos_agent = psb->mTargetObjectp->getRenderPosition();
- }
-
- part.mPosAgent = (1.f - frac) * source_pos_agent;
- if (psb->mTargetObjectp.isNull())
- {
- part.mPosAgent += frac * (gAgent.getPosAgentFromGlobal(psb->mLKGTargetPosGlobal));
- }
- else
- {
- part.mPosAgent += frac * target_pos_agent;
- }
+ F32 frac = part.mLastUpdateTime/part.mMaxAge;
+
+ LLViewerPartSource *ps = (LLViewerPartSource*)part.mPartSourcep;
+ LLViewerPartSourceBeam *psb = (LLViewerPartSourceBeam *)ps;
+ if (psb->mSourceObjectp.isNull())
+ {
+ part.mFlags = LLPartData::LL_PART_DEAD_MASK;
+ return;
+ }
+
+ LLVector3 source_pos_agent;
+ LLVector3 target_pos_agent;
+ if (!psb->mSourceObjectp.isNull() && !psb->mSourceObjectp->mDrawable.isNull())
+ {
+ if (psb->mSourceObjectp->isAvatar())
+ {
+ LLViewerObject *objp = psb->mSourceObjectp;
+ LLVOAvatar *avp = (LLVOAvatar *)objp;
+ source_pos_agent = avp->mWristLeftp->getWorldPosition();
+ }
+ else
+ {
+ source_pos_agent = psb->mSourceObjectp->getRenderPosition();
+ }
+ }
+ if (!psb->mTargetObjectp.isNull() && !psb->mTargetObjectp->mDrawable.isNull())
+ {
+ target_pos_agent = psb->mTargetObjectp->getRenderPosition();
+ }
+
+ part.mPosAgent = (1.f - frac) * source_pos_agent;
+ if (psb->mTargetObjectp.isNull())
+ {
+ part.mPosAgent += frac * (gAgent.getPosAgentFromGlobal(psb->mLKGTargetPosGlobal));
+ }
+ else
+ {
+ part.mPosAgent += frac * target_pos_agent;
+ }
}
void LLViewerPartSourceBeam::update(const F32 dt)
{
- const F32 RATE = 0.025f;
-
- mLastUpdateTime += dt;
-
- if (!mSourceObjectp.isNull() && !mSourceObjectp->mDrawable.isNull())
- {
- if (mSourceObjectp->isAvatar())
- {
- LLViewerObject *objp = mSourceObjectp;
- LLVOAvatar *avp = (LLVOAvatar *)objp;
- mPosAgent = avp->mWristLeftp->getWorldPosition();
- }
- else
- {
- mPosAgent = mSourceObjectp->getRenderPosition();
- }
- }
-
- if (!mTargetObjectp.isNull() && !mTargetObjectp->mDrawable.isNull())
- {
- mTargetPosAgent = mTargetObjectp->getRenderPosition();
- }
- else if (!mLKGTargetPosGlobal.isExactlyZero())
- {
- mTargetPosAgent = gAgent.getPosAgentFromGlobal(mLKGTargetPosGlobal);
- }
-
- F32 dt_update = mLastUpdateTime - mLastPartTime;
- F32 max_time = llmax(1.f, 10.f*RATE);
- dt_update = llmin(max_time, dt_update);
-
- if (dt_update > RATE)
- {
- mLastPartTime = mLastUpdateTime;
- if (!LLViewerPartSim::getInstance()->shouldAddPart())
- {
- // Particle simulation says we have too many particles, skip all this
- return;
- }
-
- if (!mImagep)
- {
- mImagep = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
- }
-
- LLViewerPart* part = new LLViewerPart();
- part->init(this, mImagep, updatePart);
-
- part->mFlags = LLPartData::LL_PART_INTERP_COLOR_MASK |
- LLPartData::LL_PART_INTERP_SCALE_MASK |
- LLPartData::LL_PART_TARGET_POS_MASK |
- LLPartData::LL_PART_FOLLOW_VELOCITY_MASK;
- part->mMaxAge = 0.5f;
- part->mStartColor = mColor;
- part->mEndColor = part->mStartColor;
- part->mEndColor.mV[3] = 0.4f;
- part->mColor = part->mStartColor;
-
- part->mStartScale = LLVector2(0.1f, 0.1f);
- part->mEndScale = LLVector2(0.1f, 0.1f);
- part->mScale = part->mStartScale;
-
- part->mPosAgent = mPosAgent;
- part->mVelocity = mTargetPosAgent - mPosAgent;
-
- part->mBlendFuncDest = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
- part->mBlendFuncSource = LLRender::BF_SOURCE_ALPHA;
- part->mStartGlow = 0.f;
- part->mEndGlow = 0.f;
- part->mGlow = LLColor4U(0, 0, 0, 0);
-
- LLViewerPartSim::getInstance()->addPart(part);
- }
+ const F32 RATE = 0.025f;
+
+ mLastUpdateTime += dt;
+
+ if (!mSourceObjectp.isNull() && !mSourceObjectp->mDrawable.isNull())
+ {
+ if (mSourceObjectp->isAvatar())
+ {
+ LLViewerObject *objp = mSourceObjectp;
+ LLVOAvatar *avp = (LLVOAvatar *)objp;
+ mPosAgent = avp->mWristLeftp->getWorldPosition();
+ }
+ else
+ {
+ mPosAgent = mSourceObjectp->getRenderPosition();
+ }
+ }
+
+ if (!mTargetObjectp.isNull() && !mTargetObjectp->mDrawable.isNull())
+ {
+ mTargetPosAgent = mTargetObjectp->getRenderPosition();
+ }
+ else if (!mLKGTargetPosGlobal.isExactlyZero())
+ {
+ mTargetPosAgent = gAgent.getPosAgentFromGlobal(mLKGTargetPosGlobal);
+ }
+
+ F32 dt_update = mLastUpdateTime - mLastPartTime;
+ F32 max_time = llmax(1.f, 10.f*RATE);
+ dt_update = llmin(max_time, dt_update);
+
+ if (dt_update > RATE)
+ {
+ mLastPartTime = mLastUpdateTime;
+ if (!LLViewerPartSim::getInstance()->shouldAddPart())
+ {
+ // Particle simulation says we have too many particles, skip all this
+ return;
+ }
+
+ if (!mImagep)
+ {
+ mImagep = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
+ }
+
+ LLViewerPart* part = new LLViewerPart();
+ part->init(this, mImagep, updatePart);
+
+ part->mFlags = LLPartData::LL_PART_INTERP_COLOR_MASK |
+ LLPartData::LL_PART_INTERP_SCALE_MASK |
+ LLPartData::LL_PART_TARGET_POS_MASK |
+ LLPartData::LL_PART_FOLLOW_VELOCITY_MASK;
+ part->mMaxAge = 0.5f;
+ part->mStartColor = mColor;
+ part->mEndColor = part->mStartColor;
+ part->mEndColor.mV[3] = 0.4f;
+ part->mColor = part->mStartColor;
+
+ part->mStartScale = LLVector2(0.1f, 0.1f);
+ part->mEndScale = LLVector2(0.1f, 0.1f);
+ part->mScale = part->mStartScale;
+
+ part->mPosAgent = mPosAgent;
+ part->mVelocity = mTargetPosAgent - mPosAgent;
+
+ part->mBlendFuncDest = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
+ part->mBlendFuncSource = LLRender::BF_SOURCE_ALPHA;
+ part->mStartGlow = 0.f;
+ part->mEndGlow = 0.f;
+ part->mGlow = LLColor4U(0, 0, 0, 0);
+
+ LLViewerPartSim::getInstance()->addPart(part);
+ }
}
void LLViewerPartSourceBeam::setSourceObject(LLViewerObject* objp)
{
- mSourceObjectp = objp;
+ mSourceObjectp = objp;
}
void LLViewerPartSourceBeam::setTargetObject(LLViewerObject* objp)
{
- mTargetObjectp = objp;
+ mTargetObjectp = objp;
}
LLViewerPartSourceChat::LLViewerPartSourceChat(const LLVector3 &pos) :
- LLViewerPartSource(LL_PART_SOURCE_SPIRAL)
+ LLViewerPartSource(LL_PART_SOURCE_SPIRAL)
{
- mPosAgent = pos;
+ mPosAgent = pos;
}
void LLViewerPartSourceChat::setDead()
{
- mIsDead = TRUE;
- mSourceObjectp = NULL;
+ mIsDead = TRUE;
+ mSourceObjectp = NULL;
}
void LLViewerPartSourceChat::updatePart(LLViewerPart &part, const F32 dt)
{
- F32 frac = part.mLastUpdateTime/part.mMaxAge;
+ F32 frac = part.mLastUpdateTime/part.mMaxAge;
- LLVector3 center_pos;
- LLViewerPartSource *ps = (LLViewerPartSource*)part.mPartSourcep;
- LLViewerPartSourceChat *pss = (LLViewerPartSourceChat *)ps;
- if (!pss->mSourceObjectp.isNull() && !pss->mSourceObjectp->mDrawable.isNull())
- {
- part.mPosAgent = pss->mSourceObjectp->getRenderPosition();
- }
- else
- {
- part.mPosAgent = pss->mPosAgent;
- }
- F32 x = sin(F_TWO_PI*frac + part.mParameter);
- F32 y = cos(F_TWO_PI*frac + part.mParameter);
+ LLVector3 center_pos;
+ LLViewerPartSource *ps = (LLViewerPartSource*)part.mPartSourcep;
+ LLViewerPartSourceChat *pss = (LLViewerPartSourceChat *)ps;
+ if (!pss->mSourceObjectp.isNull() && !pss->mSourceObjectp->mDrawable.isNull())
+ {
+ part.mPosAgent = pss->mSourceObjectp->getRenderPosition();
+ }
+ else
+ {
+ part.mPosAgent = pss->mPosAgent;
+ }
+ F32 x = sin(F_TWO_PI*frac + part.mParameter);
+ F32 y = cos(F_TWO_PI*frac + part.mParameter);
- part.mPosAgent.mV[VX] += x;
- part.mPosAgent.mV[VY] += y;
- part.mPosAgent.mV[VZ] += -0.5f + frac;
+ part.mPosAgent.mV[VX] += x;
+ part.mPosAgent.mV[VY] += y;
+ part.mPosAgent.mV[VZ] += -0.5f + frac;
}
void LLViewerPartSourceChat::update(const F32 dt)
{
- if (!mImagep)
- {
- mImagep = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
- }
-
-
- const F32 RATE = 0.025f;
-
- mLastUpdateTime += dt;
-
- if (mLastUpdateTime > 2.f)
- {
- // Kill particle source because it has outlived its max age...
- setDead();
- return;
- }
-
- F32 dt_update = mLastUpdateTime - mLastPartTime;
-
- // Clamp us to generating at most one second's worth of particles on a frame.
- F32 max_time = llmax(1.f, 10.f*RATE);
- dt_update = llmin(max_time, dt_update);
-
- if (dt_update > RATE)
- {
- mLastPartTime = mLastUpdateTime;
- if (!LLViewerPartSim::getInstance()->shouldAddPart())
- {
- // Particle simulation says we have too many particles, skip all this
- return;
- }
-
- if (!mSourceObjectp.isNull() && !mSourceObjectp->mDrawable.isNull())
- {
- mPosAgent = mSourceObjectp->getRenderPosition();
- }
- LLViewerPart* part = new LLViewerPart();
- part->init(this, mImagep, updatePart);
- part->mStartColor = mColor;
- part->mEndColor = mColor;
- part->mEndColor.mV[3] = 0.f;
- part->mPosAgent = mPosAgent;
- part->mMaxAge = 1.f;
- part->mFlags = LLViewerPart::LL_PART_INTERP_COLOR_MASK;
- part->mLastUpdateTime = 0.f;
- part->mScale.mV[0] = 0.25f;
- part->mScale.mV[1] = 0.25f;
- part->mParameter = ll_frand(F_TWO_PI);
- part->mBlendFuncDest = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
- part->mBlendFuncSource = LLRender::BF_SOURCE_ALPHA;
- part->mStartGlow = 0.f;
- part->mEndGlow = 0.f;
- part->mGlow = LLColor4U(0, 0, 0, 0);
-
-
- LLViewerPartSim::getInstance()->addPart(part);
- }
+ if (!mImagep)
+ {
+ mImagep = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c");
+ }
+
+
+ const F32 RATE = 0.025f;
+
+ mLastUpdateTime += dt;
+
+ if (mLastUpdateTime > 2.f)
+ {
+ // Kill particle source because it has outlived its max age...
+ setDead();
+ return;
+ }
+
+ F32 dt_update = mLastUpdateTime - mLastPartTime;
+
+ // Clamp us to generating at most one second's worth of particles on a frame.
+ F32 max_time = llmax(1.f, 10.f*RATE);
+ dt_update = llmin(max_time, dt_update);
+
+ if (dt_update > RATE)
+ {
+ mLastPartTime = mLastUpdateTime;
+ if (!LLViewerPartSim::getInstance()->shouldAddPart())
+ {
+ // Particle simulation says we have too many particles, skip all this
+ return;
+ }
+
+ if (!mSourceObjectp.isNull() && !mSourceObjectp->mDrawable.isNull())
+ {
+ mPosAgent = mSourceObjectp->getRenderPosition();
+ }
+ LLViewerPart* part = new LLViewerPart();
+ part->init(this, mImagep, updatePart);
+ part->mStartColor = mColor;
+ part->mEndColor = mColor;
+ part->mEndColor.mV[3] = 0.f;
+ part->mPosAgent = mPosAgent;
+ part->mMaxAge = 1.f;
+ part->mFlags = LLViewerPart::LL_PART_INTERP_COLOR_MASK;
+ part->mLastUpdateTime = 0.f;
+ part->mScale.mV[0] = 0.25f;
+ part->mScale.mV[1] = 0.25f;
+ part->mParameter = ll_frand(F_TWO_PI);
+ part->mBlendFuncDest = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
+ part->mBlendFuncSource = LLRender::BF_SOURCE_ALPHA;
+ part->mStartGlow = 0.f;
+ part->mEndGlow = 0.f;
+ part->mGlow = LLColor4U(0, 0, 0, 0);
+
+
+ LLViewerPartSim::getInstance()->addPart(part);
+ }
}
void LLViewerPartSourceChat::setSourceObject(LLViewerObject *objp)
{
- mSourceObjectp = objp;
+ mSourceObjectp = objp;
}
void LLViewerPartSourceChat::setColor(const LLColor4 &color)
{
- mColor = color;
+ mColor = color;
}
diff --git a/indra/newview/llviewerpartsource.h b/indra/newview/llviewerpartsource.h
index 504229e81f..1f4304d421 100644
--- a/indra/newview/llviewerpartsource.h
+++ b/indra/newview/llviewerpartsource.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerpartsource.h
* @brief LLViewerPartSource class header file
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,50 +47,50 @@ class LLVOAvatar;
class LLViewerPartSource : public LLRefCount
{
public:
- enum
- {
- LL_PART_SOURCE_NULL,
- LL_PART_SOURCE_SCRIPT,
- LL_PART_SOURCE_SPIRAL,
- LL_PART_SOURCE_BEAM,
- LL_PART_SOURCE_CHAT
- };
-
- LLViewerPartSource(const U32 type);
-
- virtual void update(const F32 dt); // Return FALSE if this source is dead...
-
- virtual void setDead();
- BOOL isDead() const { return mIsDead; }
- void setSuspended( BOOL state ) { mIsSuspended = state; }
- BOOL isSuspended() const { return mIsSuspended; }
- U32 getType() const { return mType; }
- static void updatePart(LLViewerPart &part, const F32 dt);
- void setOwnerUUID(const LLUUID& owner_id) { mOwnerUUID = owner_id; }
- LLUUID getOwnerUUID() const { return mOwnerUUID; }
- U32 getID() const { return mID; }
- LLUUID getImageUUID() const;
- void setStart() ;
-
- LLVector3 mPosAgent; // Location of the particle source
- LLVector3 mTargetPosAgent; // Location of the target position
- LLVector3 mLastUpdatePosAgent;
- LLPointer<LLViewerObject> mSourceObjectp;
- U32 mID;
- LLViewerPart* mLastPart; //last particle emitted (for making particle ribbons)
+ enum
+ {
+ LL_PART_SOURCE_NULL,
+ LL_PART_SOURCE_SCRIPT,
+ LL_PART_SOURCE_SPIRAL,
+ LL_PART_SOURCE_BEAM,
+ LL_PART_SOURCE_CHAT
+ };
+
+ LLViewerPartSource(const U32 type);
+
+ virtual void update(const F32 dt); // Return FALSE if this source is dead...
+
+ virtual void setDead();
+ BOOL isDead() const { return mIsDead; }
+ void setSuspended( BOOL state ) { mIsSuspended = state; }
+ BOOL isSuspended() const { return mIsSuspended; }
+ U32 getType() const { return mType; }
+ static void updatePart(LLViewerPart &part, const F32 dt);
+ void setOwnerUUID(const LLUUID& owner_id) { mOwnerUUID = owner_id; }
+ LLUUID getOwnerUUID() const { return mOwnerUUID; }
+ U32 getID() const { return mID; }
+ LLUUID getImageUUID() const;
+ void setStart() ;
+
+ LLVector3 mPosAgent; // Location of the particle source
+ LLVector3 mTargetPosAgent; // Location of the target position
+ LLVector3 mLastUpdatePosAgent;
+ LLPointer<LLViewerObject> mSourceObjectp;
+ U32 mID;
+ LLViewerPart* mLastPart; //last particle emitted (for making particle ribbons)
protected:
- U32 mType;
- BOOL mIsDead;
- BOOL mIsSuspended;
- F32 mLastUpdateTime;
- F32 mLastPartTime;
- LLUUID mOwnerUUID;
- LLPointer<LLVOAvatar> mOwnerAvatarp;
- LLPointer<LLViewerTexture> mImagep;
- // Particle information
- U32 mPartFlags; // Flags for the particle
- U32 mDelay ; //delay to start particles
+ U32 mType;
+ BOOL mIsDead;
+ BOOL mIsSuspended;
+ F32 mLastUpdateTime;
+ F32 mLastPartTime;
+ LLUUID mOwnerUUID;
+ LLPointer<LLVOAvatar> mOwnerAvatarp;
+ LLPointer<LLViewerTexture> mImagep;
+ // Particle information
+ U32 mPartFlags; // Flags for the particle
+ U32 mDelay ; //delay to start particles
};
@@ -107,27 +107,27 @@ protected:
class LLViewerPartSourceScript : public LLViewerPartSource
{
public:
- LLViewerPartSourceScript(LLViewerObject *source_objp);
- /*virtual*/ void update(const F32 dt);
+ LLViewerPartSourceScript(LLViewerObject *source_objp);
+ /*virtual*/ void update(const F32 dt);
- /*virtual*/ void setDead();
+ /*virtual*/ void setDead();
- BOOL updateFromMesg();
+ BOOL updateFromMesg();
- // Returns a new particle source to attach to an object...
- static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, const S32 block_num);
- static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, LLDataPacker &dp, bool legacy);
- static LLPointer<LLViewerPartSourceScript> createPSS(LLViewerObject *source_objp, const LLPartSysData& particle_parameters);
+ // Returns a new particle source to attach to an object...
+ static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, const S32 block_num);
+ static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, LLDataPacker &dp, bool legacy);
+ static LLPointer<LLViewerPartSourceScript> createPSS(LLViewerObject *source_objp, const LLPartSysData& particle_parameters);
- LLViewerTexture *getImage() const { return mImagep; }
- void setImage(LLViewerTexture *imagep);
- LLPartSysData mPartSysData;
+ LLViewerTexture *getImage() const { return mImagep; }
+ void setImage(LLViewerTexture *imagep);
+ LLPartSysData mPartSysData;
- void setTargetObject(LLViewerObject *objp);
+ void setTargetObject(LLViewerObject *objp);
protected:
- LLQuaternion mRotation; // Current rotation for particle source
- LLPointer<LLViewerObject> mTargetObjectp; // Target object for the particle source
+ LLQuaternion mRotation; // Current rotation for particle source
+ LLPointer<LLViewerObject> mTargetObjectp; // Target object for the particle source
};
@@ -139,19 +139,19 @@ protected:
class LLViewerPartSourceSpiral : public LLViewerPartSource
{
public:
- LLViewerPartSourceSpiral(const LLVector3 &pos);
+ LLViewerPartSourceSpiral(const LLVector3 &pos);
- /*virtual*/ void setDead();
+ /*virtual*/ void setDead();
- /*virtual*/ void update(const F32 dt);
+ /*virtual*/ void update(const F32 dt);
- void setSourceObject(LLViewerObject *objp);
- void setColor(const LLColor4 &color);
+ void setSourceObject(LLViewerObject *objp);
+ void setColor(const LLColor4 &color);
- static void updatePart(LLViewerPart &part, const F32 dt);
- LLColor4 mColor;
+ static void updatePart(LLViewerPart &part, const F32 dt);
+ LLColor4 mColor;
protected:
- LLVector3d mLKGSourcePosGlobal;
+ LLVector3d mLKGSourcePosGlobal;
};
@@ -163,24 +163,24 @@ protected:
class LLViewerPartSourceBeam : public LLViewerPartSource
{
public:
- LLViewerPartSourceBeam();
+ LLViewerPartSourceBeam();
- /*virtual*/ void setDead();
+ /*virtual*/ void setDead();
- /*virtual*/ void update(const F32 dt);
+ /*virtual*/ void update(const F32 dt);
- void setSourceObject(LLViewerObject *objp);
- void setTargetObject(LLViewerObject *objp);
- void setSourcePosGlobal(const LLVector3d &pos_global);
- void setTargetPosGlobal(const LLVector3d &pos_global);
- void setColor(const LLColor4 &color);
+ void setSourceObject(LLViewerObject *objp);
+ void setTargetObject(LLViewerObject *objp);
+ void setSourcePosGlobal(const LLVector3d &pos_global);
+ void setTargetPosGlobal(const LLVector3d &pos_global);
+ void setColor(const LLColor4 &color);
- static void updatePart(LLViewerPart &part, const F32 dt);
- LLPointer<LLViewerObject> mTargetObjectp;
- LLVector3d mLKGTargetPosGlobal;
- LLColor4 mColor;
+ static void updatePart(LLViewerPart &part, const F32 dt);
+ LLPointer<LLViewerObject> mTargetObjectp;
+ LLVector3d mLKGTargetPosGlobal;
+ LLColor4 mColor;
protected:
- ~LLViewerPartSourceBeam();
+ ~LLViewerPartSourceBeam();
};
@@ -193,18 +193,18 @@ protected:
class LLViewerPartSourceChat : public LLViewerPartSource
{
public:
- LLViewerPartSourceChat(const LLVector3 &pos);
+ LLViewerPartSourceChat(const LLVector3 &pos);
- /*virtual*/ void setDead();
+ /*virtual*/ void setDead();
- /*virtual*/ void update(const F32 dt);
+ /*virtual*/ void update(const F32 dt);
- void setSourceObject(LLViewerObject *objp);
- void setColor(const LLColor4 &color);
- static void updatePart(LLViewerPart &part, const F32 dt);
- LLColor4 mColor;
+ void setSourceObject(LLViewerObject *objp);
+ void setColor(const LLColor4 &color);
+ static void updatePart(LLViewerPart &part, const F32 dt);
+ LLColor4 mColor;
protected:
- LLVector3d mLKGSourcePosGlobal;
+ LLVector3d mLKGSourcePosGlobal;
};
diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h
index e378c2448a..8398cd8a54 100644
--- a/indra/newview/llviewerprecompiledheaders.h
+++ b/indra/newview/llviewerprecompiledheaders.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewerprecompiledheaders.h
* @brief precompiled headers for newview project
* @author James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index eba7189a82..a9efe072f8 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerregion.cpp
* @brief Implementation of the LLViewerRegion class.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010-2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,7 +31,7 @@
// linden libraries
#include "indra_constants.h"
#include "llaisapi.h"
-#include "llavatarnamecache.h" // name lookup cap url
+#include "llavatarnamecache.h" // name lookup cap url
#include "llfloaterreg.h"
#include "llmath.h"
#include "llregionflags.h"
@@ -86,11 +86,11 @@
#include <boost/regex.hpp>
#ifdef LL_WINDOWS
- #pragma warning(disable:4355)
+ #pragma warning(disable:4355)
#endif
-// When we receive a base grant of capabilities that has a different number of
-// capabilities than the original base grant received for the region, print
+// When we receive a base grant of capabilities that has a different number of
+// capabilities than the original base grant received for the region, print
// out the two lists of capabilities for analysis.
//#define DEBUG_CAPS_GRANTS
@@ -144,25 +144,25 @@ public:
{
return false;
}
-
+
// build a secondlife://{PLACE} SLurl from this SLapp
std::string url = "secondlife://";
if (!grid.empty())
{
url += grid + "/secondlife/";
}
- boost::regex name_rx("[A-Za-z0-9()_%]+");
- boost::regex coord_rx("[0-9]+");
+ boost::regex name_rx("[A-Za-z0-9()_%]+");
+ boost::regex coord_rx("[0-9]+");
for (int i = 0; i < num_params; i++)
{
if (i > 0)
{
url += "/";
}
- if (!boost::regex_match(params[i].asString(), i > 0 ? coord_rx : name_rx))
- {
- return false;
- }
+ if (!boost::regex_match(params[i].asString(), i > 0 ? coord_rx : name_rx))
+ {
+ return false;
+ }
url += params[i].asString();
}
@@ -171,15 +171,15 @@ public:
LLURLDispatcher::dispatch(url, LLCommandHandler::NAV_TYPE_CLICKED, web, true);
return true;
}
-
+
};
LLRegionHandler gRegionHandler;
-class LLViewerRegionImpl
+class LLViewerRegionImpl
{
public:
- LLViewerRegionImpl(LLViewerRegion * region, LLHost const & host):
+ LLViewerRegionImpl(LLViewerRegion * region, LLHost const & host):
mHost(host),
mCompositionp(NULL),
mEventPoll(NULL),
@@ -190,62 +190,62 @@ public:
mLastCameraOrigin(),
mVOCachePartition(NULL),
mLandp(NULL)
- {}
+ {}
- static void buildCapabilityNames(LLSD& capabilityNames);
+ static void buildCapabilityNames(LLSD& capabilityNames);
- // The surfaces and other layers
- LLSurface* mLandp;
+ // The surfaces and other layers
+ LLSurface* mLandp;
- // Region geometry data
- LLVector3d mOriginGlobal; // Location of southwest corner of region (meters)
- LLVector3d mCenterGlobal; // Location of center in world space (meters)
- LLHost mHost;
+ // Region geometry data
+ LLVector3d mOriginGlobal; // Location of southwest corner of region (meters)
+ LLVector3d mCenterGlobal; // Location of center in world space (meters)
+ LLHost mHost;
- // The unique ID for this region.
- LLUUID mRegionID;
+ // The unique ID for this region.
+ LLUUID mRegionID;
- // region/estate owner - usually null.
- LLUUID mOwnerID;
+ // region/estate owner - usually null.
+ LLUUID mOwnerID;
- // Network statistics for the region's circuit...
- LLTimer mLastNetUpdate;
+ // Network statistics for the region's circuit...
+ LLTimer mLastNetUpdate;
- // Misc
- LLVLComposition *mCompositionp; // Composition layer for the surface
+ // Misc
+ LLVLComposition *mCompositionp; // Composition layer for the surface
- LLVOCacheEntry::vocache_entry_map_t mCacheMap; //all cached entries
- LLVOCacheEntry::vocache_entry_set_t mActiveSet; //all active entries;
- LLVOCacheEntry::vocache_entry_set_t mWaitingSet; //entries waiting for LLDrawable to be generated.
- std::set< LLPointer<LLViewerOctreeGroup> > mVisibleGroups; //visible groupa
- LLVOCachePartition* mVOCachePartition;
- LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //must-be-created visible entries wait for objects creation.
- LLVOCacheEntry::vocache_entry_priority_list_t mWaitingList; //transient list storing sorted visible entries waiting for object creation.
- std::set<U32> mNonCacheableCreatedList; //list of local ids of all non-cacheable objects
+ LLVOCacheEntry::vocache_entry_map_t mCacheMap; //all cached entries
+ LLVOCacheEntry::vocache_entry_set_t mActiveSet; //all active entries;
+ LLVOCacheEntry::vocache_entry_set_t mWaitingSet; //entries waiting for LLDrawable to be generated.
+ std::set< LLPointer<LLViewerOctreeGroup> > mVisibleGroups; //visible groupa
+ LLVOCachePartition* mVOCachePartition;
+ LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //must-be-created visible entries wait for objects creation.
+ LLVOCacheEntry::vocache_entry_priority_list_t mWaitingList; //transient list storing sorted visible entries waiting for object creation.
+ std::set<U32> mNonCacheableCreatedList; //list of local ids of all non-cacheable objects
LLVOCacheEntry::vocache_gltf_overrides_map_t mGLTFOverridesLLSD; // for materials
- // time?
- // LRU info?
+ // time?
+ // LRU info?
- // Cache ID is unique per-region, across renames, moving locations,
- // etc.
- LLUUID mCacheID;
+ // Cache ID is unique per-region, across renames, moving locations,
+ // etc.
+ LLUUID mCacheID;
- CapabilityMap mCapabilities;
- CapabilityMap mSecondCapabilitiesTracker;
+ CapabilityMap mCapabilities;
+ CapabilityMap mSecondCapabilitiesTracker;
- LLEventPoll* mEventPoll;
+ LLEventPoll* mEventPoll;
- S32 mSeedCapMaxAttempts;
- S32 mSeedCapAttempts;
+ S32 mSeedCapMaxAttempts;
+ S32 mSeedCapAttempts;
- S32 mHttpResponderID;
+ S32 mHttpResponderID;
- //spatial partitions for objects in this region
- std::vector<LLViewerOctreePartition*> mObjectPartition;
+ //spatial partitions for objects in this region
+ std::vector<LLViewerOctreePartition*> mObjectPartition;
- LLVector3 mLastCameraOrigin;
- U32 mLastCameraUpdate;
+ LLVector3 mLastCameraOrigin;
+ U32 mLastCameraUpdate;
static void requestBaseCapabilitiesCoro(U64 regionHandle);
static void requestBaseCapabilitiesCompleteCoro(U64 regionHandle);
@@ -255,7 +255,7 @@ public:
void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("BaseCapabilitiesRequest", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
@@ -284,7 +284,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
return; // this error condition is not recoverable.
}
LLViewerRegionImpl* impl = regionp->getRegionImplNC();
- LL_DEBUGS("AppInit", "Capabilities") << "requesting seed caps for handle " << regionHandle
+ LL_DEBUGS("AppInit", "Capabilities") << "requesting seed caps for handle " << regionHandle
<< " name " << regionp->getName() << LL_ENDL;
std::string url = regionp->getCapability("Seed");
@@ -310,12 +310,12 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
LLSD capabilityNames = LLSD::emptyArray();
impl->buildCapabilityNames(capabilityNames);
- LL_INFOS("AppInit", "Capabilities") << "Requesting seed from " << url
+ LL_INFOS("AppInit", "Capabilities") << "Requesting seed from " << url
<< " region name " << regionp->getName()
<< " region id " << regionp->getRegionID()
<< " handle " << regionp->getHandle()
<< " (attempt #" << impl->mSeedCapAttempts + 1 << ")" << LL_ENDL;
- LL_DEBUGS("AppInit", "Capabilities") << "Capabilities requested: " << capabilityNames << LL_ENDL;
+ LL_DEBUGS("AppInit", "Capabilities") << "Capabilities requested: " << capabilityNames << LL_ENDL;
regionp = NULL;
impl = NULL;
@@ -389,12 +389,12 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
log_capabilities(mCapabilities);
#endif
- LL_DEBUGS("AppInit", "Capabilities", "Teleport") << "received caps for handle " << regionHandle
- << " region name " << regionp->getName() << LL_ENDL;
+ LL_DEBUGS("AppInit", "Capabilities", "Teleport") << "received caps for handle " << regionHandle
+ << " region name " << regionp->getName() << LL_ENDL;
regionp->setCapabilitiesReceived(true);
break;
- }
+ }
while (true);
if (regionp && regionp->isCapabilityAvailable("ServerReleaseNotes") &&
@@ -535,7 +535,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle)
LL_DEBUGS("CrossingCaps") << "Sim sent multiple base cap grants with matching sizes." << LL_ENDL;
}
impl->mSecondCapabilitiesTracker.clear();
- }
+ }
while (false);
}
@@ -555,7 +555,7 @@ void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 region
if (attemptNumber > MAX_CAP_REQUEST_ATTEMPTS)
{
- LL_WARNS("AppInit", "SimulatorFeatures") << "Retries count exceeded attempting to get Simulator feature from "
+ LL_WARNS("AppInit", "SimulatorFeatures") << "Retries count exceeded attempting to get Simulator feature from "
<< url << LL_ENDL;
break;
}
@@ -583,7 +583,7 @@ void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 region
if (!status)
{
LL_WARNS("AppInit", "SimulatorFeatures") << "HttpStatus error retrying" << LL_ENDL;
- continue;
+ continue;
}
if (LLApp::isExiting() || gDisconnected)
@@ -617,217 +617,217 @@ void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 region
}
LLViewerRegion::LLViewerRegion(const U64 &handle,
- const LLHost &host,
- const U32 grids_per_region_edge,
- const U32 grids_per_patch_edge,
- const F32 region_width_meters)
-: mImpl(new LLViewerRegionImpl(this, host)),
- mHandle(handle),
- mTimeDilation(1.0f),
- mName(""),
- mZoning(""),
- mIsEstateManager(FALSE),
- mRegionFlags( REGION_FLAGS_DEFAULT ),
- mRegionProtocols( 0 ),
- mSimAccess( SIM_ACCESS_MIN ),
- mBillableFactor(1.0),
- mMaxTasks(DEFAULT_MAX_REGION_WIDE_PRIM_COUNT),
- mCentralBakeVersion(1),
- mClassID(0),
- mCPURatio(0),
- mColoName("unknown"),
- mProductSKU("unknown"),
- mProductName("unknown"),
- mViewerAssetUrl(""),
- mCacheLoaded(FALSE),
- mCacheDirty(FALSE),
- mReleaseNotesRequested(FALSE),
- mCapabilitiesState(CAPABILITIES_STATE_INIT),
- mSimulatorFeaturesReceived(false),
- mBitsReceived(0.f),
- mPacketsReceived(0.f),
- mDead(FALSE),
- mLastVisitedEntry(NULL),
- mInvisibilityCheckHistory(-1),
- mPaused(FALSE),
- mRegionCacheHitCount(0),
- mRegionCacheMissCount(0),
+ const LLHost &host,
+ const U32 grids_per_region_edge,
+ const U32 grids_per_patch_edge,
+ const F32 region_width_meters)
+: mImpl(new LLViewerRegionImpl(this, host)),
+ mHandle(handle),
+ mTimeDilation(1.0f),
+ mName(""),
+ mZoning(""),
+ mIsEstateManager(FALSE),
+ mRegionFlags( REGION_FLAGS_DEFAULT ),
+ mRegionProtocols( 0 ),
+ mSimAccess( SIM_ACCESS_MIN ),
+ mBillableFactor(1.0),
+ mMaxTasks(DEFAULT_MAX_REGION_WIDE_PRIM_COUNT),
+ mCentralBakeVersion(1),
+ mClassID(0),
+ mCPURatio(0),
+ mColoName("unknown"),
+ mProductSKU("unknown"),
+ mProductName("unknown"),
+ mViewerAssetUrl(""),
+ mCacheLoaded(FALSE),
+ mCacheDirty(FALSE),
+ mReleaseNotesRequested(FALSE),
+ mCapabilitiesState(CAPABILITIES_STATE_INIT),
+ mSimulatorFeaturesReceived(false),
+ mBitsReceived(0.f),
+ mPacketsReceived(0.f),
+ mDead(FALSE),
+ mLastVisitedEntry(NULL),
+ mInvisibilityCheckHistory(-1),
+ mPaused(FALSE),
+ mRegionCacheHitCount(0),
+ mRegionCacheMissCount(0),
mInterestListMode(IL_MODE_DEFAULT)
{
- mWidth = region_width_meters;
- mImpl->mOriginGlobal = from_region_handle(handle);
- updateRenderMatrix();
+ mWidth = region_width_meters;
+ mImpl->mOriginGlobal = from_region_handle(handle);
+ updateRenderMatrix();
- mImpl->mLandp = new LLSurface('l', NULL);
+ mImpl->mLandp = new LLSurface('l', NULL);
- // Create the composition layer for the surface
- mImpl->mCompositionp =
- new LLVLComposition(mImpl->mLandp,
- grids_per_region_edge,
- region_width_meters / grids_per_region_edge);
- mImpl->mCompositionp->setSurface(mImpl->mLandp);
+ // Create the composition layer for the surface
+ mImpl->mCompositionp =
+ new LLVLComposition(mImpl->mLandp,
+ grids_per_region_edge,
+ region_width_meters / grids_per_region_edge);
+ mImpl->mCompositionp->setSurface(mImpl->mLandp);
- // Create the surfaces
- mImpl->mLandp->setRegion(this);
- mImpl->mLandp->create(grids_per_region_edge,
- grids_per_patch_edge,
- mImpl->mOriginGlobal,
- mWidth);
+ // Create the surfaces
+ mImpl->mLandp->setRegion(this);
+ mImpl->mLandp->create(grids_per_region_edge,
+ grids_per_patch_edge,
+ mImpl->mOriginGlobal,
+ mWidth);
- mParcelOverlay = new LLViewerParcelOverlay(this, region_width_meters);
+ mParcelOverlay = new LLViewerParcelOverlay(this, region_width_meters);
- setOriginGlobal(from_region_handle(handle));
- calculateCenterGlobal();
+ setOriginGlobal(from_region_handle(handle));
+ calculateCenterGlobal();
- // Create the object lists
- initStats();
+ // Create the object lists
+ initStats();
- //create object partitions
- //MUST MATCH declaration of eObjectPartitions
- mImpl->mObjectPartition.push_back(new LLHUDPartition(this)); //PARTITION_HUD
- mImpl->mObjectPartition.push_back(new LLTerrainPartition(this)); //PARTITION_TERRAIN
- mImpl->mObjectPartition.push_back(new LLVoidWaterPartition(this)); //PARTITION_VOIDWATER
- mImpl->mObjectPartition.push_back(new LLWaterPartition(this)); //PARTITION_WATER
- mImpl->mObjectPartition.push_back(new LLTreePartition(this)); //PARTITION_TREE
- mImpl->mObjectPartition.push_back(new LLParticlePartition(this)); //PARTITION_PARTICLE
- mImpl->mObjectPartition.push_back(new LLGrassPartition(this)); //PARTITION_GRASS
- mImpl->mObjectPartition.push_back(new LLVolumePartition(this)); //PARTITION_VOLUME
- mImpl->mObjectPartition.push_back(new LLBridgePartition(this)); //PARTITION_BRIDGE
- mImpl->mObjectPartition.push_back(new LLAvatarPartition(this)); //PARTITION_AVATAR
- mImpl->mObjectPartition.push_back(new LLControlAVPartition(this)); //PARTITION_CONTROL_AV
- mImpl->mObjectPartition.push_back(new LLHUDParticlePartition(this));//PARTITION_HUD_PARTICLE
- mImpl->mObjectPartition.push_back(new LLVOCachePartition(this)); //PARTITION_VO_CACHE
- mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE
- mImpl->mVOCachePartition = getVOCachePartition();
+ //create object partitions
+ //MUST MATCH declaration of eObjectPartitions
+ mImpl->mObjectPartition.push_back(new LLHUDPartition(this)); //PARTITION_HUD
+ mImpl->mObjectPartition.push_back(new LLTerrainPartition(this)); //PARTITION_TERRAIN
+ mImpl->mObjectPartition.push_back(new LLVoidWaterPartition(this)); //PARTITION_VOIDWATER
+ mImpl->mObjectPartition.push_back(new LLWaterPartition(this)); //PARTITION_WATER
+ mImpl->mObjectPartition.push_back(new LLTreePartition(this)); //PARTITION_TREE
+ mImpl->mObjectPartition.push_back(new LLParticlePartition(this)); //PARTITION_PARTICLE
+ mImpl->mObjectPartition.push_back(new LLGrassPartition(this)); //PARTITION_GRASS
+ mImpl->mObjectPartition.push_back(new LLVolumePartition(this)); //PARTITION_VOLUME
+ mImpl->mObjectPartition.push_back(new LLBridgePartition(this)); //PARTITION_BRIDGE
+ mImpl->mObjectPartition.push_back(new LLAvatarPartition(this)); //PARTITION_AVATAR
+ mImpl->mObjectPartition.push_back(new LLControlAVPartition(this)); //PARTITION_CONTROL_AV
+ mImpl->mObjectPartition.push_back(new LLHUDParticlePartition(this));//PARTITION_HUD_PARTICLE
+ mImpl->mObjectPartition.push_back(new LLVOCachePartition(this)); //PARTITION_VO_CACHE
+ mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE
+ mImpl->mVOCachePartition = getVOCachePartition();
- setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::scanNewRegion, _1));
+ setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::scanNewRegion, _1));
}
void LLViewerRegion::initStats()
{
- mImpl->mLastNetUpdate.reset();
- mPacketsIn = 0;
- mBitsIn = (U32Bits)0;
- mLastBitsIn = (U32Bits)0;
- mLastPacketsIn = 0;
- mPacketsOut = 0;
- mLastPacketsOut = 0;
- mPacketsLost = 0;
- mLastPacketsLost = 0;
- mPingDelay = (U32Seconds)0;
- mAlive = false; // can become false if circuit disconnects
+ mImpl->mLastNetUpdate.reset();
+ mPacketsIn = 0;
+ mBitsIn = (U32Bits)0;
+ mLastBitsIn = (U32Bits)0;
+ mLastPacketsIn = 0;
+ mPacketsOut = 0;
+ mLastPacketsOut = 0;
+ mPacketsLost = 0;
+ mLastPacketsLost = 0;
+ mPingDelay = (U32Seconds)0;
+ mAlive = false; // can become false if circuit disconnects
}
static LLTrace::BlockTimerStatHandle FTM_CLEANUP_REGION_OBJECTS("Cleanup Region Objects");
static LLTrace::BlockTimerStatHandle FTM_SAVE_REGION_CACHE("Save Region Cache");
-LLViewerRegion::~LLViewerRegion()
+LLViewerRegion::~LLViewerRegion()
{
LL_PROFILE_ZONE_SCOPED;
- mDead = TRUE;
- mImpl->mActiveSet.clear();
- mImpl->mVisibleEntries.clear();
- mImpl->mVisibleGroups.clear();
- mImpl->mWaitingSet.clear();
-
- gVLManager.cleanupData(this);
- // Can't do this on destruction, because the neighbor pointers might be invalid.
- // This should be reference counted...
- disconnectAllNeighbors();
- LLViewerPartSim::getInstance()->cleanupRegion(this);
+ mDead = TRUE;
+ mImpl->mActiveSet.clear();
+ mImpl->mVisibleEntries.clear();
+ mImpl->mVisibleGroups.clear();
+ mImpl->mWaitingSet.clear();
+
+ gVLManager.cleanupData(this);
+ // Can't do this on destruction, because the neighbor pointers might be invalid.
+ // This should be reference counted...
+ disconnectAllNeighbors();
+ LLViewerPartSim::getInstance()->cleanupRegion(this);
{
LL_RECORD_BLOCK_TIME(FTM_CLEANUP_REGION_OBJECTS);
gObjectList.killObjects(this);
}
- delete mImpl->mCompositionp;
- delete mParcelOverlay;
- delete mImpl->mLandp;
- delete mImpl->mEventPoll;
+ delete mImpl->mCompositionp;
+ delete mParcelOverlay;
+ delete mImpl->mLandp;
+ delete mImpl->mEventPoll;
#if 0
- LLHTTPSender::clearSender(mImpl->mHost);
-#endif
- std::for_each(mImpl->mObjectPartition.begin(), mImpl->mObjectPartition.end(), DeletePointer());
+ LLHTTPSender::clearSender(mImpl->mHost);
+#endif
+ std::for_each(mImpl->mObjectPartition.begin(), mImpl->mObjectPartition.end(), DeletePointer());
{
LL_RECORD_BLOCK_TIME(FTM_SAVE_REGION_CACHE);
saveObjectCache();
}
- delete mImpl;
- mImpl = NULL;
+ delete mImpl;
+ mImpl = NULL;
}
-/*virtual*/
-const LLHost& LLViewerRegion::getHost() const
-{
- return mImpl->mHost;
+/*virtual*/
+const LLHost& LLViewerRegion::getHost() const
+{
+ return mImpl->mHost;
}
LLSurface & LLViewerRegion::getLand() const
{
- return *mImpl->mLandp;
+ return *mImpl->mLandp;
}
const LLUUID& LLViewerRegion::getRegionID() const
{
- return mImpl->mRegionID;
+ return mImpl->mRegionID;
}
void LLViewerRegion::setRegionID(const LLUUID& region_id)
{
- mImpl->mRegionID = region_id;
+ mImpl->mRegionID = region_id;
}
void LLViewerRegion::loadObjectCache()
{
- if (mCacheLoaded)
- {
- return;
- }
+ if (mCacheLoaded)
+ {
+ return;
+ }
- // Presume success. If it fails, we don't want to try again.
- mCacheLoaded = TRUE;
+ // Presume success. If it fails, we don't want to try again.
+ mCacheLoaded = TRUE;
- if(LLVOCache::instanceExists())
- {
+ if(LLVOCache::instanceExists())
+ {
LLVOCache & vocache = LLVOCache::instance();
- vocache.readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap);
+ vocache.readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap);
vocache.readGenericExtrasFromCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesLLSD);
- if (mImpl->mCacheMap.empty())
- {
- mCacheDirty = TRUE;
- }
- }
+ if (mImpl->mCacheMap.empty())
+ {
+ mCacheDirty = TRUE;
+ }
+ }
}
void LLViewerRegion::saveObjectCache()
{
- if (!mCacheLoaded)
- {
- return;
- }
+ if (!mCacheLoaded)
+ {
+ return;
+ }
- if (mImpl->mCacheMap.empty())
- {
- return;
- }
+ if (mImpl->mCacheMap.empty())
+ {
+ return;
+ }
- if(LLVOCache::instanceExists())
- {
- const F32 start_time_threshold = 600.0f; //seconds
- bool removal_enabled = sVOCacheCullingEnabled && (mRegionTimer.getElapsedTimeF32() > start_time_threshold); //allow to remove invalid objects from object cache file.
+ if(LLVOCache::instanceExists())
+ {
+ const F32 start_time_threshold = 600.0f; //seconds
+ bool removal_enabled = sVOCacheCullingEnabled && (mRegionTimer.getElapsedTimeF32() > start_time_threshold); //allow to remove invalid objects from object cache file.
LLVOCache & instance = LLVOCache::instance();
instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled);
instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesLLSD, mCacheDirty, removal_enabled);
- mCacheDirty = FALSE;
- }
+ mCacheDirty = FALSE;
+ }
if (LLAppViewer::instance()->isQuitting())
{
@@ -844,253 +844,253 @@ void LLViewerRegion::saveObjectCache()
void LLViewerRegion::sendMessage()
{
- gMessageSystem->sendMessage(mImpl->mHost);
+ gMessageSystem->sendMessage(mImpl->mHost);
}
void LLViewerRegion::sendReliableMessage()
{
- gMessageSystem->sendReliable(mImpl->mHost);
+ gMessageSystem->sendReliable(mImpl->mHost);
}
void LLViewerRegion::setWaterHeight(F32 water_level)
{
- mImpl->mLandp->setWaterHeight(water_level);
+ mImpl->mLandp->setWaterHeight(water_level);
}
F32 LLViewerRegion::getWaterHeight() const
{
- return mImpl->mLandp->getWaterHeight();
+ return mImpl->mLandp->getWaterHeight();
}
BOOL LLViewerRegion::isVoiceEnabled() const
{
- return getRegionFlag(REGION_FLAGS_ALLOW_VOICE);
+ return getRegionFlag(REGION_FLAGS_ALLOW_VOICE);
}
void LLViewerRegion::setRegionFlags(U64 flags)
{
- mRegionFlags = flags;
+ mRegionFlags = flags;
}
-void LLViewerRegion::setOriginGlobal(const LLVector3d &origin_global)
-{
- mImpl->mOriginGlobal = origin_global;
- updateRenderMatrix();
- mImpl->mLandp->setOriginGlobal(origin_global);
- mWind.setOriginGlobal(origin_global);
- calculateCenterGlobal();
+void LLViewerRegion::setOriginGlobal(const LLVector3d &origin_global)
+{
+ mImpl->mOriginGlobal = origin_global;
+ updateRenderMatrix();
+ mImpl->mLandp->setOriginGlobal(origin_global);
+ mWind.setOriginGlobal(origin_global);
+ calculateCenterGlobal();
}
void LLViewerRegion::updateRenderMatrix()
{
- mRenderMatrix.setTranslation(getOriginAgent());
+ mRenderMatrix.setTranslation(getOriginAgent());
}
void LLViewerRegion::setTimeDilation(F32 time_dilation)
{
- mTimeDilation = time_dilation;
+ mTimeDilation = time_dilation;
}
const LLVector3d & LLViewerRegion::getOriginGlobal() const
{
- return mImpl->mOriginGlobal;
+ return mImpl->mOriginGlobal;
}
LLVector3 LLViewerRegion::getOriginAgent() const
{
- return gAgent.getPosAgentFromGlobal(mImpl->mOriginGlobal);
+ return gAgent.getPosAgentFromGlobal(mImpl->mOriginGlobal);
}
const LLVector3d & LLViewerRegion::getCenterGlobal() const
{
- return mImpl->mCenterGlobal;
+ return mImpl->mCenterGlobal;
}
LLVector3 LLViewerRegion::getCenterAgent() const
{
- return gAgent.getPosAgentFromGlobal(mImpl->mCenterGlobal);
+ return gAgent.getPosAgentFromGlobal(mImpl->mCenterGlobal);
}
void LLViewerRegion::setOwner(const LLUUID& owner_id)
{
- mImpl->mOwnerID = owner_id;
+ mImpl->mOwnerID = owner_id;
}
const LLUUID& LLViewerRegion::getOwner() const
{
- return mImpl->mOwnerID;
+ return mImpl->mOwnerID;
}
-void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone)
+void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone)
{
- std::string::size_type pipe_pos = name_zone.find('|');
- S32 length = name_zone.size();
- if (pipe_pos != std::string::npos)
- {
- mName = name_zone.substr(0, pipe_pos);
- mZoning = name_zone.substr(pipe_pos+1, length-(pipe_pos+1));
- }
- else
- {
- mName = name_zone;
- mZoning = "";
- }
+ std::string::size_type pipe_pos = name_zone.find('|');
+ S32 length = name_zone.size();
+ if (pipe_pos != std::string::npos)
+ {
+ mName = name_zone.substr(0, pipe_pos);
+ mZoning = name_zone.substr(pipe_pos+1, length-(pipe_pos+1));
+ }
+ else
+ {
+ mName = name_zone;
+ mZoning = "";
+ }
- LLStringUtil::stripNonprintable(mName);
- LLStringUtil::stripNonprintable(mZoning);
+ LLStringUtil::stripNonprintable(mName);
+ LLStringUtil::stripNonprintable(mZoning);
}
BOOL LLViewerRegion::canManageEstate() const
{
- return gAgent.isGodlike()
- || isEstateManager()
- || gAgent.getID() == getOwner();
+ return gAgent.isGodlike()
+ || isEstateManager()
+ || gAgent.getID() == getOwner();
}
const std::string LLViewerRegion::getSimAccessString() const
{
- return accessToString(mSimAccess);
+ return accessToString(mSimAccess);
}
std::string LLViewerRegion::getLocalizedSimProductName() const
{
- std::string localized_spn;
- return LLTrans::findString(localized_spn, mProductName) ? localized_spn : mProductName;
+ std::string localized_spn;
+ return LLTrans::findString(localized_spn, mProductName) ? localized_spn : mProductName;
}
// static
std::string LLViewerRegion::regionFlagsToString(U64 flags)
{
- std::string result;
+ std::string result;
- if (flags & REGION_FLAGS_SANDBOX)
- {
- result += "Sandbox";
- }
+ if (flags & REGION_FLAGS_SANDBOX)
+ {
+ result += "Sandbox";
+ }
- if (flags & REGION_FLAGS_ALLOW_DAMAGE)
- {
- result += " Not Safe";
- }
+ if (flags & REGION_FLAGS_ALLOW_DAMAGE)
+ {
+ result += " Not Safe";
+ }
- return result;
+ return result;
}
// static
std::string LLViewerRegion::accessToString(U8 sim_access)
{
- switch(sim_access)
- {
- case SIM_ACCESS_PG:
- return LLTrans::getString("SIM_ACCESS_PG");
+ switch(sim_access)
+ {
+ case SIM_ACCESS_PG:
+ return LLTrans::getString("SIM_ACCESS_PG");
- case SIM_ACCESS_MATURE:
- return LLTrans::getString("SIM_ACCESS_MATURE");
+ case SIM_ACCESS_MATURE:
+ return LLTrans::getString("SIM_ACCESS_MATURE");
- case SIM_ACCESS_ADULT:
- return LLTrans::getString("SIM_ACCESS_ADULT");
+ case SIM_ACCESS_ADULT:
+ return LLTrans::getString("SIM_ACCESS_ADULT");
- case SIM_ACCESS_DOWN:
- return LLTrans::getString("SIM_ACCESS_DOWN");
+ case SIM_ACCESS_DOWN:
+ return LLTrans::getString("SIM_ACCESS_DOWN");
- case SIM_ACCESS_MIN:
- default:
- return LLTrans::getString("SIM_ACCESS_MIN");
- }
+ case SIM_ACCESS_MIN:
+ default:
+ return LLTrans::getString("SIM_ACCESS_MIN");
+ }
}
// static
std::string LLViewerRegion::getAccessIcon(U8 sim_access)
{
- switch(sim_access)
- {
- case SIM_ACCESS_MATURE:
- return "Parcel_M_Dark";
+ switch(sim_access)
+ {
+ case SIM_ACCESS_MATURE:
+ return "Parcel_M_Dark";
- case SIM_ACCESS_ADULT:
- return "Parcel_R_Light";
+ case SIM_ACCESS_ADULT:
+ return "Parcel_R_Light";
- case SIM_ACCESS_PG:
- return "Parcel_PG_Light";
+ case SIM_ACCESS_PG:
+ return "Parcel_PG_Light";
- case SIM_ACCESS_MIN:
- default:
- return "";
- }
+ case SIM_ACCESS_MIN:
+ default:
+ return "";
+ }
}
// static
std::string LLViewerRegion::accessToShortString(U8 sim_access)
{
- switch(sim_access) /* Flawfinder: ignore */
- {
- case SIM_ACCESS_PG:
- return "PG";
+ switch(sim_access) /* Flawfinder: ignore */
+ {
+ case SIM_ACCESS_PG:
+ return "PG";
- case SIM_ACCESS_MATURE:
- return "M";
+ case SIM_ACCESS_MATURE:
+ return "M";
- case SIM_ACCESS_ADULT:
- return "A";
+ case SIM_ACCESS_ADULT:
+ return "A";
- case SIM_ACCESS_MIN:
- default:
- return "U";
- }
+ case SIM_ACCESS_MIN:
+ default:
+ return "U";
+ }
}
// static
U8 LLViewerRegion::shortStringToAccess(const std::string &sim_access)
{
- U8 accessValue;
+ U8 accessValue;
- if (LLStringUtil::compareStrings(sim_access, "PG") == 0)
- {
- accessValue = SIM_ACCESS_PG;
- }
- else if (LLStringUtil::compareStrings(sim_access, "M") == 0)
- {
- accessValue = SIM_ACCESS_MATURE;
- }
- else if (LLStringUtil::compareStrings(sim_access, "A") == 0)
- {
- accessValue = SIM_ACCESS_ADULT;
- }
- else
- {
- accessValue = SIM_ACCESS_MIN;
- }
+ if (LLStringUtil::compareStrings(sim_access, "PG") == 0)
+ {
+ accessValue = SIM_ACCESS_PG;
+ }
+ else if (LLStringUtil::compareStrings(sim_access, "M") == 0)
+ {
+ accessValue = SIM_ACCESS_MATURE;
+ }
+ else if (LLStringUtil::compareStrings(sim_access, "A") == 0)
+ {
+ accessValue = SIM_ACCESS_ADULT;
+ }
+ else
+ {
+ accessValue = SIM_ACCESS_MIN;
+ }
- return accessValue;
+ return accessValue;
}
// static
void LLViewerRegion::processRegionInfo(LLMessageSystem* msg, void**)
{
- // send it to 'observers'
- // *TODO: switch the floaters to using LLRegionInfoModel
- LL_INFOS() << "Processing region info" << LL_ENDL;
- LLRegionInfoModel::instance().update(msg);
- LLFloaterGodTools::processRegionInfo(msg);
- LLFloaterRegionInfo::processRegionInfo(msg);
+ // send it to 'observers'
+ // *TODO: switch the floaters to using LLRegionInfoModel
+ LL_INFOS() << "Processing region info" << LL_ENDL;
+ LLRegionInfoModel::instance().update(msg);
+ LLFloaterGodTools::processRegionInfo(msg);
+ LLFloaterRegionInfo::processRegionInfo(msg);
}
void LLViewerRegion::setCacheID(const LLUUID& id)
{
- mImpl->mCacheID = id;
+ mImpl->mCacheID = id;
}
S32 LLViewerRegion::renderPropertyLines()
{
- if (mParcelOverlay)
- {
- return mParcelOverlay->renderPropertyLines();
- }
- else
- {
- return 0;
- }
+ if (mParcelOverlay)
+ {
+ return mParcelOverlay->renderPropertyLines();
+ }
+ else
+ {
+ return 0;
+ }
}
void LLViewerRegion::renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32 *parcel_outline_color)
@@ -1105,168 +1105,168 @@ void LLViewerRegion::renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, co
// This gets called when the height field changes.
void LLViewerRegion::dirtyHeights()
{
- // Property lines need to be reconstructed when the land changes.
- if (mParcelOverlay)
- {
- mParcelOverlay->setDirty();
- }
+ // Property lines need to be reconstructed when the land changes.
+ if (mParcelOverlay)
+ {
+ mParcelOverlay->setDirty();
+ }
}
//physically delete the cache entry
void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering)
-{
- if(!entry || !entry->isValid())
- {
- return;
- }
-
- if(for_rendering && !entry->isState(LLVOCacheEntry::ACTIVE))
- {
- addNewObject(entry); //force to add to rendering pipeline
- }
-
- //remove from active list and waiting list
- if(entry->isState(LLVOCacheEntry::ACTIVE))
- {
- mImpl->mActiveSet.erase(entry);
- }
- else
- {
- if(entry->isState(LLVOCacheEntry::WAITING))
- {
- mImpl->mWaitingSet.erase(entry);
- }
-
- //remove from mVOCachePartition
- removeFromVOCacheTree(entry);
- }
-
- //remove from the forced visible list
- mImpl->mVisibleEntries.erase(entry);
-
- //disconnect from parent if it is a child
- if(entry->getParentID() > 0)
- {
- LLVOCacheEntry* parent = getCacheEntry(entry->getParentID());
- if(parent)
- {
- parent->removeChild(entry);
- }
- }
- else if(entry->getNumOfChildren() > 0)//remove children from cache if has any
- {
- LLVOCacheEntry* child = entry->getChild();
- while(child != NULL)
- {
- killCacheEntry(child, for_rendering);
- child = entry->getChild();
- }
- }
-
- //will remove it from the object cache, real deletion
- entry->setState(LLVOCacheEntry::INACTIVE);
- entry->removeOctreeEntry();
- entry->setValid(FALSE);
-
- // TODO kill extras/material overrides cache too
-}
-
-//physically delete the cache entry
-void LLViewerRegion::killCacheEntry(U32 local_id)
-{
- killCacheEntry(getCacheEntry(local_id));
+{
+ if(!entry || !entry->isValid())
+ {
+ return;
+ }
+
+ if(for_rendering && !entry->isState(LLVOCacheEntry::ACTIVE))
+ {
+ addNewObject(entry); //force to add to rendering pipeline
+ }
+
+ //remove from active list and waiting list
+ if(entry->isState(LLVOCacheEntry::ACTIVE))
+ {
+ mImpl->mActiveSet.erase(entry);
+ }
+ else
+ {
+ if(entry->isState(LLVOCacheEntry::WAITING))
+ {
+ mImpl->mWaitingSet.erase(entry);
+ }
+
+ //remove from mVOCachePartition
+ removeFromVOCacheTree(entry);
+ }
+
+ //remove from the forced visible list
+ mImpl->mVisibleEntries.erase(entry);
+
+ //disconnect from parent if it is a child
+ if(entry->getParentID() > 0)
+ {
+ LLVOCacheEntry* parent = getCacheEntry(entry->getParentID());
+ if(parent)
+ {
+ parent->removeChild(entry);
+ }
+ }
+ else if(entry->getNumOfChildren() > 0)//remove children from cache if has any
+ {
+ LLVOCacheEntry* child = entry->getChild();
+ while(child != NULL)
+ {
+ killCacheEntry(child, for_rendering);
+ child = entry->getChild();
+ }
+ }
+
+ //will remove it from the object cache, real deletion
+ entry->setState(LLVOCacheEntry::INACTIVE);
+ entry->removeOctreeEntry();
+ entry->setValid(FALSE);
+
+ // TODO kill extras/material overrides cache too
+}
+
+//physically delete the cache entry
+void LLViewerRegion::killCacheEntry(U32 local_id)
+{
+ killCacheEntry(getCacheEntry(local_id));
}
U32 LLViewerRegion::getNumOfActiveCachedObjects() const
{
- return mImpl->mActiveSet.size();
+ return mImpl->mActiveSet.size();
}
void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry)
{
- if(!entry || mDead)
- {
- return;
- }
- if(entry->isState(LLVOCacheEntry::ACTIVE))
- {
- return; //already inserted.
- }
+ if(!entry || mDead)
+ {
+ return;
+ }
+ if(entry->isState(LLVOCacheEntry::ACTIVE))
+ {
+ return; //already inserted.
+ }
- if(entry->isState(LLVOCacheEntry::WAITING))
- {
- mImpl->mWaitingSet.erase(entry);
- }
+ if(entry->isState(LLVOCacheEntry::WAITING))
+ {
+ mImpl->mWaitingSet.erase(entry);
+ }
- entry->setState(LLVOCacheEntry::ACTIVE);
- entry->setVisible();
+ entry->setState(LLVOCacheEntry::ACTIVE);
+ entry->setVisible();
- llassert(entry->getEntry()->hasDrawable());
- mImpl->mActiveSet.insert(entry);
+ llassert(entry->getEntry()->hasDrawable());
+ mImpl->mActiveSet.insert(entry);
}
void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep)
{
- if(mDead || !entry || !entry->isValid())
- {
- return;
- }
- if(!entry->isState(LLVOCacheEntry::ACTIVE))
- {
- return; //not an active entry.
- }
-
- //shift to the local regional space from agent space
- if(drawablep != NULL && drawablep->getVObj().notNull())
- {
- const LLVector3& pos = drawablep->getVObj()->getPositionRegion();
- LLVector4a shift;
- shift.load3(pos.mV);
- shift.sub(entry->getPositionGroup());
- entry->shift(shift);
- }
-
- if(entry->getParentID() > 0) //is a child
- {
- LLVOCacheEntry* parent = getCacheEntry(entry->getParentID());
- if(parent)
- {
- parent->addChild(entry);
- }
- else //parent not in cache.
- {
- //this happens only when parent is not cacheable.
- mOrphanMap[entry->getParentID()].push_back(entry->getLocalID());
- }
- }
- else //insert to vo cache tree.
- {
- entry->updateParentBoundingInfo();
- entry->saveBoundingSphere();
- addToVOCacheTree(entry);
- }
-
- mImpl->mVisibleEntries.erase(entry);
- mImpl->mActiveSet.erase(entry);
- mImpl->mWaitingSet.erase(entry);
- entry->setState(LLVOCacheEntry::INACTIVE);
+ if(mDead || !entry || !entry->isValid())
+ {
+ return;
+ }
+ if(!entry->isState(LLVOCacheEntry::ACTIVE))
+ {
+ return; //not an active entry.
+ }
+
+ //shift to the local regional space from agent space
+ if(drawablep != NULL && drawablep->getVObj().notNull())
+ {
+ const LLVector3& pos = drawablep->getVObj()->getPositionRegion();
+ LLVector4a shift;
+ shift.load3(pos.mV);
+ shift.sub(entry->getPositionGroup());
+ entry->shift(shift);
+ }
+
+ if(entry->getParentID() > 0) //is a child
+ {
+ LLVOCacheEntry* parent = getCacheEntry(entry->getParentID());
+ if(parent)
+ {
+ parent->addChild(entry);
+ }
+ else //parent not in cache.
+ {
+ //this happens only when parent is not cacheable.
+ mOrphanMap[entry->getParentID()].push_back(entry->getLocalID());
+ }
+ }
+ else //insert to vo cache tree.
+ {
+ entry->updateParentBoundingInfo();
+ entry->saveBoundingSphere();
+ addToVOCacheTree(entry);
+ }
+
+ mImpl->mVisibleEntries.erase(entry);
+ mImpl->mActiveSet.erase(entry);
+ mImpl->mWaitingSet.erase(entry);
+ entry->setState(LLVOCacheEntry::INACTIVE);
}
bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group)
{
- if(mDead || group->isEmpty())
- {
- return false;
- }
-
- mImpl->mVisibleGroups.insert(group);
+ if(mDead || group->isEmpty())
+ {
+ return false;
+ }
+
+ mImpl->mVisibleGroups.insert(group);
- return true;
+ return true;
}
U32 LLViewerRegion::getNumOfVisibleGroups() const
{
- return mImpl ? mImpl->mVisibleGroups.size() : 0;
+ return mImpl ? mImpl->mVisibleGroups.size() : 0;
}
void LLViewerRegion::updateReflectionProbes()
@@ -1311,350 +1311,350 @@ void LLViewerRegion::updateReflectionProbes()
void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry)
{
- if(!sVOCacheCullingEnabled)
- {
- return;
- }
+ if(!sVOCacheCullingEnabled)
+ {
+ return;
+ }
- if(mDead || !entry || !entry->getEntry() || !entry->isValid())
- {
- return;
- }
- if(entry->getParentID() > 0)
- {
- return; //no child prim in cache octree.
- }
+ if(mDead || !entry || !entry->getEntry() || !entry->isValid())
+ {
+ return;
+ }
+ if(entry->getParentID() > 0)
+ {
+ return; //no child prim in cache octree.
+ }
- if(entry->hasState(LLVOCacheEntry::IN_VO_TREE))
- {
- return; //already in the tree.
- }
+ if(entry->hasState(LLVOCacheEntry::IN_VO_TREE))
+ {
+ return; //already in the tree.
+ }
- llassert_always(!entry->getGroup()); //not in octree.
- llassert(!entry->getEntry()->hasDrawable()); //not have drawables
+ llassert_always(!entry->getGroup()); //not in octree.
+ llassert(!entry->getEntry()->hasDrawable()); //not have drawables
- if(mImpl->mVOCachePartition->addEntry(entry->getEntry()))
- {
- entry->setState(LLVOCacheEntry::IN_VO_TREE);
- }
+ if(mImpl->mVOCachePartition->addEntry(entry->getEntry()))
+ {
+ entry->setState(LLVOCacheEntry::IN_VO_TREE);
+ }
}
void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry)
{
- if(mDead || !entry || !entry->getEntry())
- {
- return;
- }
-
- if(!entry->hasState(LLVOCacheEntry::IN_VO_TREE))
- {
- return; //not in the tree.
- }
- entry->clearState(LLVOCacheEntry::IN_VO_TREE);
+ if(mDead || !entry || !entry->getEntry())
+ {
+ return;
+ }
- mImpl->mVOCachePartition->removeEntry(entry->getEntry());
+ if(!entry->hasState(LLVOCacheEntry::IN_VO_TREE))
+ {
+ return; //not in the tree.
+ }
+ entry->clearState(LLVOCacheEntry::IN_VO_TREE);
+
+ mImpl->mVOCachePartition->removeEntry(entry->getEntry());
}
//add child objects as visible entries
void LLViewerRegion::addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCacheEntry* child)
{
- if(mDead)
- {
- return;
- }
-
- if(parent && (!parent->isValid() || !parent->isState(LLVOCacheEntry::ACTIVE)))
- {
- return; //parent must be valid and in rendering pipeline
- }
-
- if(child && (!child->getEntry() || !child->isValid() || !child->isState(LLVOCacheEntry::INACTIVE)))
- {
- return; //child must be valid and not in the rendering pipeline
- }
-
- if(child)
- {
- child->setState(LLVOCacheEntry::IN_QUEUE);
- mImpl->mVisibleEntries.insert(child);
- }
- else if(parent && parent->getNumOfChildren() > 0) //add all children
- {
- child = parent->getChild();
- while(child != NULL)
- {
- addVisibleChildCacheEntry(NULL, child);
- child = parent->getChild();
- }
- }
+ if(mDead)
+ {
+ return;
+ }
+
+ if(parent && (!parent->isValid() || !parent->isState(LLVOCacheEntry::ACTIVE)))
+ {
+ return; //parent must be valid and in rendering pipeline
+ }
+
+ if(child && (!child->getEntry() || !child->isValid() || !child->isState(LLVOCacheEntry::INACTIVE)))
+ {
+ return; //child must be valid and not in the rendering pipeline
+ }
+
+ if(child)
+ {
+ child->setState(LLVOCacheEntry::IN_QUEUE);
+ mImpl->mVisibleEntries.insert(child);
+ }
+ else if(parent && parent->getNumOfChildren() > 0) //add all children
+ {
+ child = parent->getChild();
+ while(child != NULL)
+ {
+ addVisibleChildCacheEntry(NULL, child);
+ child = parent->getChild();
+ }
+ }
}
void LLViewerRegion::updateVisibleEntries(F32 max_time)
{
- if(mDead)
- {
- return;
- }
-
- if(mImpl->mVisibleGroups.empty() && mImpl->mVisibleEntries.empty())
- {
- return;
- }
-
- if(!sNewObjectCreationThrottle)
- {
- return;
- }
-
- const F32 LARGE_SCENE_CONTRIBUTION = 1000.f; //a large number to force to load the object.
- const LLVector3 camera_origin = LLViewerCamera::getInstance()->getOrigin();
- const U32 cur_frame = LLViewerOctreeEntryData::getCurrentFrame();
- bool needs_update = ((cur_frame - mImpl->mLastCameraUpdate) > 5) && ((camera_origin - mImpl->mLastCameraOrigin).lengthSquared() > 10.f);
- U32 last_update = mImpl->mLastCameraUpdate;
- LLVector4a local_origin;
- local_origin.load3((camera_origin - getOriginAgent()).mV);
-
- //process visible entries
- for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();)
- {
- LLVOCacheEntry* vo_entry = *iter;
-
- if(vo_entry->isValid() && vo_entry->getState() < LLVOCacheEntry::WAITING)
- {
- //set a large number to force to load this object.
- vo_entry->setSceneContribution(LARGE_SCENE_CONTRIBUTION);
-
- mImpl->mWaitingList.insert(vo_entry);
- ++iter;
- }
- else
- {
- LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter;
- ++next_iter;
- mImpl->mVisibleEntries.erase(iter);
- iter = next_iter;
- }
- }
-
- //
- //process visible groups
- //
- //object projected area threshold
- F32 projection_threshold = LLVOCacheEntry::getSquaredPixelThreshold(mImpl->mVOCachePartition->isFrontCull());
- F32 dist_threshold = mImpl->mVOCachePartition->isFrontCull() ? gAgentCamera.mDrawDistance : LLVOCacheEntry::sRearFarRadius;
-
- std::set< LLPointer<LLViewerOctreeGroup> >::iterator group_iter = mImpl->mVisibleGroups.begin();
- for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter)
- {
- LLPointer<LLViewerOctreeGroup> group = *group_iter;
- if(group->getNumRefs() < 3 || //group to be deleted
- !group->getOctreeNode() || group->isEmpty()) //group empty
- {
- continue;
- }
-
- for (LLViewerOctreeGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
- {
- if((*i)->hasVOCacheEntry())
- {
- LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)(*i)->getVOCacheEntry();
-
- if(vo_entry->getParentID() > 0) //is a child
- {
- //child visibility depends on its parent.
- continue;
- }
- if(!vo_entry->isValid())
- {
- continue; //skip invalid entry.
- }
-
- vo_entry->calcSceneContribution(local_origin, needs_update, last_update, dist_threshold);
- if(vo_entry->getSceneContribution() > projection_threshold)
- {
- mImpl->mWaitingList.insert(vo_entry);
- }
- }
- }
- }
-
- if(needs_update)
- {
- mImpl->mLastCameraOrigin = camera_origin;
- mImpl->mLastCameraUpdate = cur_frame;
- }
-
- return;
+ if(mDead)
+ {
+ return;
+ }
+
+ if(mImpl->mVisibleGroups.empty() && mImpl->mVisibleEntries.empty())
+ {
+ return;
+ }
+
+ if(!sNewObjectCreationThrottle)
+ {
+ return;
+ }
+
+ const F32 LARGE_SCENE_CONTRIBUTION = 1000.f; //a large number to force to load the object.
+ const LLVector3 camera_origin = LLViewerCamera::getInstance()->getOrigin();
+ const U32 cur_frame = LLViewerOctreeEntryData::getCurrentFrame();
+ bool needs_update = ((cur_frame - mImpl->mLastCameraUpdate) > 5) && ((camera_origin - mImpl->mLastCameraOrigin).lengthSquared() > 10.f);
+ U32 last_update = mImpl->mLastCameraUpdate;
+ LLVector4a local_origin;
+ local_origin.load3((camera_origin - getOriginAgent()).mV);
+
+ //process visible entries
+ for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();)
+ {
+ LLVOCacheEntry* vo_entry = *iter;
+
+ if(vo_entry->isValid() && vo_entry->getState() < LLVOCacheEntry::WAITING)
+ {
+ //set a large number to force to load this object.
+ vo_entry->setSceneContribution(LARGE_SCENE_CONTRIBUTION);
+
+ mImpl->mWaitingList.insert(vo_entry);
+ ++iter;
+ }
+ else
+ {
+ LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter;
+ ++next_iter;
+ mImpl->mVisibleEntries.erase(iter);
+ iter = next_iter;
+ }
+ }
+
+ //
+ //process visible groups
+ //
+ //object projected area threshold
+ F32 projection_threshold = LLVOCacheEntry::getSquaredPixelThreshold(mImpl->mVOCachePartition->isFrontCull());
+ F32 dist_threshold = mImpl->mVOCachePartition->isFrontCull() ? gAgentCamera.mDrawDistance : LLVOCacheEntry::sRearFarRadius;
+
+ std::set< LLPointer<LLViewerOctreeGroup> >::iterator group_iter = mImpl->mVisibleGroups.begin();
+ for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter)
+ {
+ LLPointer<LLViewerOctreeGroup> group = *group_iter;
+ if(group->getNumRefs() < 3 || //group to be deleted
+ !group->getOctreeNode() || group->isEmpty()) //group empty
+ {
+ continue;
+ }
+
+ for (LLViewerOctreeGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+ {
+ if((*i)->hasVOCacheEntry())
+ {
+ LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)(*i)->getVOCacheEntry();
+
+ if(vo_entry->getParentID() > 0) //is a child
+ {
+ //child visibility depends on its parent.
+ continue;
+ }
+ if(!vo_entry->isValid())
+ {
+ continue; //skip invalid entry.
+ }
+
+ vo_entry->calcSceneContribution(local_origin, needs_update, last_update, dist_threshold);
+ if(vo_entry->getSceneContribution() > projection_threshold)
+ {
+ mImpl->mWaitingList.insert(vo_entry);
+ }
+ }
+ }
+ }
+
+ if(needs_update)
+ {
+ mImpl->mLastCameraOrigin = camera_origin;
+ mImpl->mLastCameraUpdate = cur_frame;
+ }
+
+ return;
}
void LLViewerRegion::createVisibleObjects(F32 max_time)
{
- if(mDead)
- {
- return;
- }
- if(mImpl->mWaitingList.empty())
- {
- mImpl->mVOCachePartition->setCullHistory(FALSE);
- return;
- }
-
- S32 throttle = sNewObjectCreationThrottle;
- BOOL has_new_obj = FALSE;
- LLTimer update_timer;
- for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin();
- iter != mImpl->mWaitingList.end(); ++iter)
- {
- LLVOCacheEntry* vo_entry = *iter;
-
- if(vo_entry->getState() < LLVOCacheEntry::WAITING)
- {
- addNewObject(vo_entry);
- has_new_obj = TRUE;
- if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time)
- {
- break;
- }
- }
- }
-
- mImpl->mVOCachePartition->setCullHistory(has_new_obj);
-
- return;
+ if(mDead)
+ {
+ return;
+ }
+ if(mImpl->mWaitingList.empty())
+ {
+ mImpl->mVOCachePartition->setCullHistory(FALSE);
+ return;
+ }
+
+ S32 throttle = sNewObjectCreationThrottle;
+ BOOL has_new_obj = FALSE;
+ LLTimer update_timer;
+ for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin();
+ iter != mImpl->mWaitingList.end(); ++iter)
+ {
+ LLVOCacheEntry* vo_entry = *iter;
+
+ if(vo_entry->getState() < LLVOCacheEntry::WAITING)
+ {
+ addNewObject(vo_entry);
+ has_new_obj = TRUE;
+ if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time)
+ {
+ break;
+ }
+ }
+ }
+
+ mImpl->mVOCachePartition->setCullHistory(has_new_obj);
+
+ return;
}
void LLViewerRegion::clearCachedVisibleObjects()
{
- mImpl->mWaitingList.clear();
- mImpl->mVisibleGroups.clear();
-
- //reset all occluders
- mImpl->mVOCachePartition->resetOccluders();
- mPaused = TRUE;
-
- //clean visible entries
- for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();)
- {
- LLVOCacheEntry* entry = *iter;
- LLVOCacheEntry* parent = getCacheEntry(entry->getParentID());
-
- if(!entry->getParentID() || parent) //no child or parent is cache-able
- {
- if(parent) //has a cache-able parent
- {
- parent->addChild(entry);
- }
-
- LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter;
- ++next_iter;
- mImpl->mVisibleEntries.erase(iter);
- iter = next_iter;
- }
- else //parent is not cache-able, leave it.
- {
- ++iter;
- }
- }
-
- //remove all visible entries.
- mLastVisitedEntry = NULL;
- std::vector<LLDrawable*> delete_list;
- for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin();
- iter != mImpl->mActiveSet.end(); ++iter)
- {
+ mImpl->mWaitingList.clear();
+ mImpl->mVisibleGroups.clear();
+
+ //reset all occluders
+ mImpl->mVOCachePartition->resetOccluders();
+ mPaused = TRUE;
+
+ //clean visible entries
+ for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();)
+ {
+ LLVOCacheEntry* entry = *iter;
+ LLVOCacheEntry* parent = getCacheEntry(entry->getParentID());
+
+ if(!entry->getParentID() || parent) //no child or parent is cache-able
+ {
+ if(parent) //has a cache-able parent
+ {
+ parent->addChild(entry);
+ }
+
+ LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter;
+ ++next_iter;
+ mImpl->mVisibleEntries.erase(iter);
+ iter = next_iter;
+ }
+ else //parent is not cache-able, leave it.
+ {
+ ++iter;
+ }
+ }
+
+ //remove all visible entries.
+ mLastVisitedEntry = NULL;
+ std::vector<LLDrawable*> delete_list;
+ for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin();
+ iter != mImpl->mActiveSet.end(); ++iter)
+ {
LLVOCacheEntry* vo_entry = *iter;
if (!vo_entry || !vo_entry->getEntry())
{
continue;
}
LLDrawable* drawablep = (LLDrawable*)vo_entry->getEntry()->getDrawable();
-
- if(drawablep && !drawablep->getParent())
- {
- delete_list.push_back(drawablep);
- }
- }
- if(!delete_list.empty())
- {
- for(S32 i = 0; i < delete_list.size(); i++)
- {
- gObjectList.killObject(delete_list[i]->getVObj());
- }
- delete_list.clear();
- }
+ if(drawablep && !drawablep->getParent())
+ {
+ delete_list.push_back(drawablep);
+ }
+ }
+
+ if(!delete_list.empty())
+ {
+ for(S32 i = 0; i < delete_list.size(); i++)
+ {
+ gObjectList.killObject(delete_list[i]->getVObj());
+ }
+ delete_list.clear();
+ }
- return;
+ return;
}
//perform some necessary but very light updates.
//to replace the function idleUpdate(...) in case there is no enough time.
void LLViewerRegion::lightIdleUpdate()
{
- if(!sVOCacheCullingEnabled)
- {
- return;
- }
- if(mImpl->mCacheMap.empty())
- {
- return;
- }
+ if(!sVOCacheCullingEnabled)
+ {
+ return;
+ }
+ if(mImpl->mCacheMap.empty())
+ {
+ return;
+ }
- //reset all occluders
- mImpl->mVOCachePartition->resetOccluders();
+ //reset all occluders
+ mImpl->mVOCachePartition->resetOccluders();
}
void LLViewerRegion::idleUpdate(F32 max_update_time)
-{
+{
LL_PROFILE_ZONE_SCOPED;
- LLTimer update_timer;
- F32 max_time;
+ LLTimer update_timer;
+ F32 max_time;
+
+ mLastUpdate = LLViewerOctreeEntryData::getCurrentFrame();
- mLastUpdate = LLViewerOctreeEntryData::getCurrentFrame();
+ mImpl->mLandp->idleUpdate(max_update_time);
- mImpl->mLandp->idleUpdate(max_update_time);
-
- if (mParcelOverlay)
- {
- // Hopefully not a significant time sink...
- mParcelOverlay->idleUpdate();
- }
+ if (mParcelOverlay)
+ {
+ // Hopefully not a significant time sink...
+ mParcelOverlay->idleUpdate();
+ }
- if(!sVOCacheCullingEnabled)
- {
- return;
- }
- if(mImpl->mCacheMap.empty())
- {
- return;
- }
- if(mPaused)
- {
- mPaused = FALSE; //unpause.
- }
+ if(!sVOCacheCullingEnabled)
+ {
+ return;
+ }
+ if(mImpl->mCacheMap.empty())
+ {
+ return;
+ }
+ if(mPaused)
+ {
+ mPaused = FALSE; //unpause.
+ }
- LLViewerCamera::eCameraID old_camera_id = LLViewerCamera::sCurCameraID;
- LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+ LLViewerCamera::eCameraID old_camera_id = LLViewerCamera::sCurCameraID;
+ LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
- //reset all occluders
- mImpl->mVOCachePartition->resetOccluders();
+ //reset all occluders
+ mImpl->mVOCachePartition->resetOccluders();
- max_time = max_update_time - update_timer.getElapsedTimeF32();
+ max_time = max_update_time - update_timer.getElapsedTimeF32();
- //kill invisible objects
- killInvisibleObjects(max_time * 0.4f);
- max_time = max_update_time - update_timer.getElapsedTimeF32();
+ //kill invisible objects
+ killInvisibleObjects(max_time * 0.4f);
+ max_time = max_update_time - update_timer.getElapsedTimeF32();
- updateVisibleEntries(max_time);
- max_time = max_update_time - update_timer.getElapsedTimeF32();
+ updateVisibleEntries(max_time);
+ max_time = max_update_time - update_timer.getElapsedTimeF32();
- createVisibleObjects(max_time);
+ createVisibleObjects(max_time);
- mImpl->mWaitingList.clear();
- mImpl->mVisibleGroups.clear();
+ mImpl->mWaitingList.clear();
+ mImpl->mVisibleGroups.clear();
- LLViewerCamera::sCurCameraID = old_camera_id;
- return;
+ LLViewerCamera::sCurCameraID = old_camera_id;
+ return;
}
// static
@@ -1670,381 +1670,381 @@ void LLViewerRegion::idleCleanup(F32 max_update_time)
//update the throttling number for new object creation
void LLViewerRegion::calcNewObjectCreationThrottle()
{
- static LLCachedControl<S32> new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle");
- static LLCachedControl<F32> throttle_delay_time(gSavedSettings,"NewObjectCreationThrottleDelayTime");
- static LLFrameTimer timer;
-
- //
- //sNewObjectCreationThrottle =
- //-2: throttle is disabled because either the screen is showing progress view, or immediate after the screen is not black
- //-1: throttle is disabled by the debug setting
- //0: no new object creation is allowed
- //>0: valid throttling number
- //
-
- if(gViewerWindow->getProgressView()->getVisible() && throttle_delay_time > 0.f)
- {
- sNewObjectCreationThrottle = -2; //cancel the throttling
- timer.reset();
- }
- else if(sNewObjectCreationThrottle < -1) //just recoved from the login/teleport screen
- {
- if(timer.getElapsedTimeF32() > throttle_delay_time) //wait for throttle_delay_time to reset the throttle
- {
- sNewObjectCreationThrottle = new_object_creation_throttle; //reset
- if(sNewObjectCreationThrottle < -1)
- {
- sNewObjectCreationThrottle = -1;
- }
- }
- }
-
- //update some LLVOCacheEntry debug setting factors.
- LLVOCacheEntry::updateDebugSettings();
+ static LLCachedControl<S32> new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle");
+ static LLCachedControl<F32> throttle_delay_time(gSavedSettings,"NewObjectCreationThrottleDelayTime");
+ static LLFrameTimer timer;
+
+ //
+ //sNewObjectCreationThrottle =
+ //-2: throttle is disabled because either the screen is showing progress view, or immediate after the screen is not black
+ //-1: throttle is disabled by the debug setting
+ //0: no new object creation is allowed
+ //>0: valid throttling number
+ //
+
+ if(gViewerWindow->getProgressView()->getVisible() && throttle_delay_time > 0.f)
+ {
+ sNewObjectCreationThrottle = -2; //cancel the throttling
+ timer.reset();
+ }
+ else if(sNewObjectCreationThrottle < -1) //just recoved from the login/teleport screen
+ {
+ if(timer.getElapsedTimeF32() > throttle_delay_time) //wait for throttle_delay_time to reset the throttle
+ {
+ sNewObjectCreationThrottle = new_object_creation_throttle; //reset
+ if(sNewObjectCreationThrottle < -1)
+ {
+ sNewObjectCreationThrottle = -1;
+ }
+ }
+ }
+
+ //update some LLVOCacheEntry debug setting factors.
+ LLVOCacheEntry::updateDebugSettings();
}
BOOL LLViewerRegion::isViewerCameraStatic()
{
- return sLastCameraUpdated < LLViewerOctreeEntryData::getCurrentFrame();
+ return sLastCameraUpdated < LLViewerOctreeEntryData::getCurrentFrame();
}
void LLViewerRegion::killInvisibleObjects(F32 max_time)
{
#if 1 // TODO: kill this. This is ill-conceived, objects that aren't in the camera frustum should not be deleted from memory.
// because of this, every time you turn around the simulator sends a swarm of full object update messages from cache
- // probe misses and objects have to be reloaded from scratch. From some reason, disabling this causes holes to
+ // probe misses and objects have to be reloaded from scratch. From some reason, disabling this causes holes to
// appear in the scene when flying back and forth between regions
- if(!sVOCacheCullingEnabled)
- {
- return;
- }
- if(mImpl->mActiveSet.empty())
- {
- return;
- }
- if(sNewObjectCreationThrottle < 0)
- {
- return;
- }
-
- LLTimer update_timer;
- LLVector4a camera_origin;
- camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
- LLVector4a local_origin;
- local_origin.load3((LLViewerCamera::getInstance()->getOrigin() - getOriginAgent()).mV);
- F32 back_threshold = LLVOCacheEntry::sRearFarRadius;
-
- size_t max_update = 64;
- if(!mInvisibilityCheckHistory && isViewerCameraStatic())
- {
- //history is clean, reduce number of checking
- max_update /= 2;
- }
-
- std::vector<LLDrawable*> delete_list;
- S32 update_counter = llmin(max_update, mImpl->mActiveSet.size());
- LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry);
-
- for(; update_counter > 0; --update_counter, ++iter)
- {
- if(iter == mImpl->mActiveSet.end())
- {
- iter = mImpl->mActiveSet.begin();
- }
- if((*iter)->getParentID() > 0)
- {
- continue; //skip child objects, they are removed with their parent.
- }
-
- LLVOCacheEntry* vo_entry = *iter;
- if(!vo_entry->isAnyVisible(camera_origin, local_origin, back_threshold) && vo_entry->mLastCameraUpdated < sLastCameraUpdated)
- {
- killObject(vo_entry, delete_list);
- }
-
- if(max_time < update_timer.getElapsedTimeF32()) //time out
- {
- break;
- }
- }
-
- if(iter == mImpl->mActiveSet.end())
- {
- mLastVisitedEntry = NULL;
- }
- else
- {
- mLastVisitedEntry = *iter;
- }
-
- mInvisibilityCheckHistory <<= 1;
- if(!delete_list.empty())
- {
- mInvisibilityCheckHistory |= 1;
- S32 count = delete_list.size();
- for(S32 i = 0; i < count; i++)
- {
- gObjectList.killObject(delete_list[i]->getVObj());
- }
- delete_list.clear();
- }
-
- return;
+ if(!sVOCacheCullingEnabled)
+ {
+ return;
+ }
+ if(mImpl->mActiveSet.empty())
+ {
+ return;
+ }
+ if(sNewObjectCreationThrottle < 0)
+ {
+ return;
+ }
+
+ LLTimer update_timer;
+ LLVector4a camera_origin;
+ camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
+ LLVector4a local_origin;
+ local_origin.load3((LLViewerCamera::getInstance()->getOrigin() - getOriginAgent()).mV);
+ F32 back_threshold = LLVOCacheEntry::sRearFarRadius;
+
+ size_t max_update = 64;
+ if(!mInvisibilityCheckHistory && isViewerCameraStatic())
+ {
+ //history is clean, reduce number of checking
+ max_update /= 2;
+ }
+
+ std::vector<LLDrawable*> delete_list;
+ S32 update_counter = llmin(max_update, mImpl->mActiveSet.size());
+ LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry);
+
+ for(; update_counter > 0; --update_counter, ++iter)
+ {
+ if(iter == mImpl->mActiveSet.end())
+ {
+ iter = mImpl->mActiveSet.begin();
+ }
+ if((*iter)->getParentID() > 0)
+ {
+ continue; //skip child objects, they are removed with their parent.
+ }
+
+ LLVOCacheEntry* vo_entry = *iter;
+ if(!vo_entry->isAnyVisible(camera_origin, local_origin, back_threshold) && vo_entry->mLastCameraUpdated < sLastCameraUpdated)
+ {
+ killObject(vo_entry, delete_list);
+ }
+
+ if(max_time < update_timer.getElapsedTimeF32()) //time out
+ {
+ break;
+ }
+ }
+
+ if(iter == mImpl->mActiveSet.end())
+ {
+ mLastVisitedEntry = NULL;
+ }
+ else
+ {
+ mLastVisitedEntry = *iter;
+ }
+
+ mInvisibilityCheckHistory <<= 1;
+ if(!delete_list.empty())
+ {
+ mInvisibilityCheckHistory |= 1;
+ S32 count = delete_list.size();
+ for(S32 i = 0; i < count; i++)
+ {
+ gObjectList.killObject(delete_list[i]->getVObj());
+ }
+ delete_list.clear();
+ }
+
+ return;
#endif
}
void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list)
{
- //kill the object.
- LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable();
- llassert(drawablep);
- llassert(drawablep->getRegion() == this);
-
- if(drawablep && !drawablep->getParent())
- {
- LLViewerObject* v_obj = drawablep->getVObj();
- if (v_obj->isSelected()
- || (v_obj->flagAnimSource() && isAgentAvatarValid() && gAgentAvatarp->hasMotionFromSource(v_obj->getID())))
- {
- // do not remove objects user is interacting with
- ((LLViewerOctreeEntryData*)drawablep)->setVisible();
- return;
- }
- LLViewerObject::const_child_list_t& child_list = v_obj->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- if(child->mDrawable)
- {
- if( !child->mDrawable->getEntry()
- || !child->mDrawable->getEntry()->hasVOCacheEntry()
- || child->isSelected()
- || (child->flagAnimSource() && isAgentAvatarValid() && gAgentAvatarp->hasMotionFromSource(child->getID())))
- {
- //do not remove parent if any of its children non-cacheable, animating or selected
- //especially for the case that an avatar sits on a cache-able object
- ((LLViewerOctreeEntryData*)drawablep)->setVisible();
- return;
- }
-
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)child->mDrawable->getGroup();
- if(group && group->isAnyRecentlyVisible())
- {
- //set the parent visible if any of its children visible.
- ((LLViewerOctreeEntryData*)drawablep)->setVisible();
- return;
- }
- }
- }
- delete_list.push_back(drawablep);
- }
+ //kill the object.
+ LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable();
+ llassert(drawablep);
+ llassert(drawablep->getRegion() == this);
+
+ if(drawablep && !drawablep->getParent())
+ {
+ LLViewerObject* v_obj = drawablep->getVObj();
+ if (v_obj->isSelected()
+ || (v_obj->flagAnimSource() && isAgentAvatarValid() && gAgentAvatarp->hasMotionFromSource(v_obj->getID())))
+ {
+ // do not remove objects user is interacting with
+ ((LLViewerOctreeEntryData*)drawablep)->setVisible();
+ return;
+ }
+ LLViewerObject::const_child_list_t& child_list = v_obj->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ if(child->mDrawable)
+ {
+ if( !child->mDrawable->getEntry()
+ || !child->mDrawable->getEntry()->hasVOCacheEntry()
+ || child->isSelected()
+ || (child->flagAnimSource() && isAgentAvatarValid() && gAgentAvatarp->hasMotionFromSource(child->getID())))
+ {
+ //do not remove parent if any of its children non-cacheable, animating or selected
+ //especially for the case that an avatar sits on a cache-able object
+ ((LLViewerOctreeEntryData*)drawablep)->setVisible();
+ return;
+ }
+
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)child->mDrawable->getGroup();
+ if(group && group->isAnyRecentlyVisible())
+ {
+ //set the parent visible if any of its children visible.
+ ((LLViewerOctreeEntryData*)drawablep)->setVisible();
+ return;
+ }
+ }
+ }
+ delete_list.push_back(drawablep);
+ }
}
LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry)
{
- if(!entry || !entry->getEntry())
- {
- if(entry)
- {
- mImpl->mVisibleEntries.erase(entry);
- entry->setState(LLVOCacheEntry::INACTIVE);
- }
- return NULL;
- }
-
- LLViewerObject* obj = NULL;
- if(!entry->getEntry()->hasDrawable()) //not added to the rendering pipeline yet
- {
- //add the object
- obj = gObjectList.processObjectUpdateFromCache(entry, this);
- if(obj)
- {
- if(!entry->isState(LLVOCacheEntry::ACTIVE))
- {
- mImpl->mWaitingSet.insert(entry);
- entry->setState(LLVOCacheEntry::WAITING);
- }
- }
- }
- else
- {
- LLViewerRegion* old_regionp = ((LLDrawable*)entry->getEntry()->getDrawable())->getRegion();
- if(old_regionp != this)
- {
- //this object exists in two regions at the same time;
- //this case can be safely ignored here because
- //server should soon send update message to remove one region for this object.
-
- LL_WARNS() << "Entry: " << entry->getLocalID() << " exists in two regions at the same time." << LL_ENDL;
- return NULL;
- }
-
- LL_WARNS() << "Entry: " << entry->getLocalID() << " in rendering pipeline but not set to be active." << LL_ENDL;
-
- //should not hit here any more, but does not hurt either, just put it back to active list
- addActiveCacheEntry(entry);
- }
-
- return obj;
+ if(!entry || !entry->getEntry())
+ {
+ if(entry)
+ {
+ mImpl->mVisibleEntries.erase(entry);
+ entry->setState(LLVOCacheEntry::INACTIVE);
+ }
+ return NULL;
+ }
+
+ LLViewerObject* obj = NULL;
+ if(!entry->getEntry()->hasDrawable()) //not added to the rendering pipeline yet
+ {
+ //add the object
+ obj = gObjectList.processObjectUpdateFromCache(entry, this);
+ if(obj)
+ {
+ if(!entry->isState(LLVOCacheEntry::ACTIVE))
+ {
+ mImpl->mWaitingSet.insert(entry);
+ entry->setState(LLVOCacheEntry::WAITING);
+ }
+ }
+ }
+ else
+ {
+ LLViewerRegion* old_regionp = ((LLDrawable*)entry->getEntry()->getDrawable())->getRegion();
+ if(old_regionp != this)
+ {
+ //this object exists in two regions at the same time;
+ //this case can be safely ignored here because
+ //server should soon send update message to remove one region for this object.
+
+ LL_WARNS() << "Entry: " << entry->getLocalID() << " exists in two regions at the same time." << LL_ENDL;
+ return NULL;
+ }
+
+ LL_WARNS() << "Entry: " << entry->getLocalID() << " in rendering pipeline but not set to be active." << LL_ENDL;
+
+ //should not hit here any more, but does not hurt either, just put it back to active list
+ addActiveCacheEntry(entry);
+ }
+
+ return obj;
}
//update object cache if the object receives a full-update or terse update
//update_type == EObjectUpdateType::OUT_TERSE_IMPROVED or EObjectUpdateType::OUT_FULL
LLViewerObject* LLViewerRegion::updateCacheEntry(U32 local_id, LLViewerObject* objectp)
{
- LLVOCacheEntry* entry = getCacheEntry(local_id);
- if (!entry)
- {
- return objectp; //not in the cache, do nothing.
- }
- if(!objectp) //object not created
- {
- //create a new object from cache.
- objectp = addNewObject(entry);
- }
+ LLVOCacheEntry* entry = getCacheEntry(local_id);
+ if (!entry)
+ {
+ return objectp; //not in the cache, do nothing.
+ }
+ if(!objectp) //object not created
+ {
+ //create a new object from cache.
+ objectp = addNewObject(entry);
+ }
//remove from cache.
killCacheEntry(entry, true);
- return objectp;
+ return objectp;
}
// As above, but forcibly do the update.
void LLViewerRegion::forceUpdate()
{
- mImpl->mLandp->idleUpdate(0.f);
+ mImpl->mLandp->idleUpdate(0.f);
- if (mParcelOverlay)
- {
- mParcelOverlay->idleUpdate(true);
- }
+ if (mParcelOverlay)
+ {
+ mParcelOverlay->idleUpdate(true);
+ }
}
void LLViewerRegion::connectNeighbor(LLViewerRegion *neighborp, U32 direction)
{
- mImpl->mLandp->connectNeighbor(neighborp->mImpl->mLandp, direction);
+ mImpl->mLandp->connectNeighbor(neighborp->mImpl->mLandp, direction);
}
void LLViewerRegion::disconnectAllNeighbors()
{
- mImpl->mLandp->disconnectAllNeighbors();
+ mImpl->mLandp->disconnectAllNeighbors();
}
LLVLComposition * LLViewerRegion::getComposition() const
{
- return mImpl->mCompositionp;
+ return mImpl->mCompositionp;
}
F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const
{
- if (x >= 256)
- {
- if (y >= 256)
- {
- LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 256.f, 0.f);
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center);
- if (regionp)
- {
- // OK, we need to do some hackery here - different simulators no longer use
- // the same composition values, necessarily.
- // If we're attempting to blend, then we want to make the fractional part of
- // this region match the fractional of the adjacent. For now, just minimize
- // the delta.
- F32 our_comp = getComposition()->getValueScaled(255, 255);
- F32 adj_comp = regionp->getComposition()->getValueScaled(x - 256.f, y - 256.f);
- while (llabs(our_comp - adj_comp) >= 1.f)
- {
- if (our_comp > adj_comp)
- {
- adj_comp += 1.f;
- }
- else
- {
- adj_comp -= 1.f;
- }
- }
- return adj_comp;
- }
- }
- else
- {
- LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 0, 0.f);
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center);
- if (regionp)
- {
- // OK, we need to do some hackery here - different simulators no longer use
- // the same composition values, necessarily.
- // If we're attempting to blend, then we want to make the fractional part of
- // this region match the fractional of the adjacent. For now, just minimize
- // the delta.
- F32 our_comp = getComposition()->getValueScaled(255.f, (F32)y);
- F32 adj_comp = regionp->getComposition()->getValueScaled(x - 256.f, (F32)y);
- while (llabs(our_comp - adj_comp) >= 1.f)
- {
- if (our_comp > adj_comp)
- {
- adj_comp += 1.f;
- }
- else
- {
- adj_comp -= 1.f;
- }
- }
- return adj_comp;
- }
- }
- }
- else if (y >= 256)
- {
- LLVector3d center = getCenterGlobal() + LLVector3d(0.f, 256.f, 0.f);
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center);
- if (regionp)
- {
- // OK, we need to do some hackery here - different simulators no longer use
- // the same composition values, necessarily.
- // If we're attempting to blend, then we want to make the fractional part of
- // this region match the fractional of the adjacent. For now, just minimize
- // the delta.
- F32 our_comp = getComposition()->getValueScaled((F32)x, 255.f);
- F32 adj_comp = regionp->getComposition()->getValueScaled((F32)x, y - 256.f);
- while (llabs(our_comp - adj_comp) >= 1.f)
- {
- if (our_comp > adj_comp)
- {
- adj_comp += 1.f;
- }
- else
- {
- adj_comp -= 1.f;
- }
- }
- return adj_comp;
- }
- }
-
- return getComposition()->getValueScaled((F32)x, (F32)y);
-}
-
-void LLViewerRegion::calculateCenterGlobal()
-{
- mImpl->mCenterGlobal = mImpl->mOriginGlobal;
- mImpl->mCenterGlobal.mdV[VX] += 0.5 * mWidth;
- mImpl->mCenterGlobal.mdV[VY] += 0.5 * mWidth;
- mImpl->mCenterGlobal.mdV[VZ] = 0.5 * mImpl->mLandp->getMinZ() + mImpl->mLandp->getMaxZ();
+ if (x >= 256)
+ {
+ if (y >= 256)
+ {
+ LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 256.f, 0.f);
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center);
+ if (regionp)
+ {
+ // OK, we need to do some hackery here - different simulators no longer use
+ // the same composition values, necessarily.
+ // If we're attempting to blend, then we want to make the fractional part of
+ // this region match the fractional of the adjacent. For now, just minimize
+ // the delta.
+ F32 our_comp = getComposition()->getValueScaled(255, 255);
+ F32 adj_comp = regionp->getComposition()->getValueScaled(x - 256.f, y - 256.f);
+ while (llabs(our_comp - adj_comp) >= 1.f)
+ {
+ if (our_comp > adj_comp)
+ {
+ adj_comp += 1.f;
+ }
+ else
+ {
+ adj_comp -= 1.f;
+ }
+ }
+ return adj_comp;
+ }
+ }
+ else
+ {
+ LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 0, 0.f);
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center);
+ if (regionp)
+ {
+ // OK, we need to do some hackery here - different simulators no longer use
+ // the same composition values, necessarily.
+ // If we're attempting to blend, then we want to make the fractional part of
+ // this region match the fractional of the adjacent. For now, just minimize
+ // the delta.
+ F32 our_comp = getComposition()->getValueScaled(255.f, (F32)y);
+ F32 adj_comp = regionp->getComposition()->getValueScaled(x - 256.f, (F32)y);
+ while (llabs(our_comp - adj_comp) >= 1.f)
+ {
+ if (our_comp > adj_comp)
+ {
+ adj_comp += 1.f;
+ }
+ else
+ {
+ adj_comp -= 1.f;
+ }
+ }
+ return adj_comp;
+ }
+ }
+ }
+ else if (y >= 256)
+ {
+ LLVector3d center = getCenterGlobal() + LLVector3d(0.f, 256.f, 0.f);
+ LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center);
+ if (regionp)
+ {
+ // OK, we need to do some hackery here - different simulators no longer use
+ // the same composition values, necessarily.
+ // If we're attempting to blend, then we want to make the fractional part of
+ // this region match the fractional of the adjacent. For now, just minimize
+ // the delta.
+ F32 our_comp = getComposition()->getValueScaled((F32)x, 255.f);
+ F32 adj_comp = regionp->getComposition()->getValueScaled((F32)x, y - 256.f);
+ while (llabs(our_comp - adj_comp) >= 1.f)
+ {
+ if (our_comp > adj_comp)
+ {
+ adj_comp += 1.f;
+ }
+ else
+ {
+ adj_comp -= 1.f;
+ }
+ }
+ return adj_comp;
+ }
+ }
+
+ return getComposition()->getValueScaled((F32)x, (F32)y);
+}
+
+void LLViewerRegion::calculateCenterGlobal()
+{
+ mImpl->mCenterGlobal = mImpl->mOriginGlobal;
+ mImpl->mCenterGlobal.mdV[VX] += 0.5 * mWidth;
+ mImpl->mCenterGlobal.mdV[VY] += 0.5 * mWidth;
+ mImpl->mCenterGlobal.mdV[VZ] = 0.5 * mImpl->mLandp->getMinZ() + mImpl->mLandp->getMaxZ();
}
void LLViewerRegion::calculateCameraDistance()
{
- mCameraDistanceSquared = (F32)(gAgentCamera.getCameraPositionGlobal() - getCenterGlobal()).magVecSquared();
+ mCameraDistanceSquared = (F32)(gAgentCamera.getCameraPositionGlobal() - getCenterGlobal()).magVecSquared();
}
std::ostream& operator<<(std::ostream &s, const LLViewerRegion &region)
{
- s << "{ ";
- s << region.mImpl->mHost;
- s << " mOriginGlobal = " << region.getOriginGlobal()<< "\n";
+ s << "{ ";
+ s << region.mImpl->mHost;
+ s << " mOriginGlobal = " << region.getOriginGlobal()<< "\n";
std::string name(region.getName()), zone(region.getZoning());
if (! name.empty())
{
@@ -2054,8 +2054,8 @@ std::ostream& operator<<(std::ostream &s, const LLViewerRegion &region)
{
s << " mZoning = " << zone << '\n';
}
- s << "}";
- return s;
+ s << "}";
+ return s;
}
@@ -2063,143 +2063,143 @@ std::ostream& operator<<(std::ostream &s, const LLViewerRegion &region)
void LLViewerRegion::updateNetStats()
{
- F32 dt = mImpl->mLastNetUpdate.getElapsedTimeAndResetF32();
+ F32 dt = mImpl->mLastNetUpdate.getElapsedTimeAndResetF32();
- LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mImpl->mHost);
- if (!cdp)
- {
- mAlive = false;
- return;
- }
+ LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mImpl->mHost);
+ if (!cdp)
+ {
+ mAlive = false;
+ return;
+ }
- mAlive = true;
- mDeltaTime = dt;
+ mAlive = true;
+ mDeltaTime = dt;
- mLastPacketsIn = mPacketsIn;
- mLastBitsIn = mBitsIn;
- mLastPacketsOut = mPacketsOut;
- mLastPacketsLost = mPacketsLost;
+ mLastPacketsIn = mPacketsIn;
+ mLastBitsIn = mBitsIn;
+ mLastPacketsOut = mPacketsOut;
+ mLastPacketsLost = mPacketsLost;
- mPacketsIn = cdp->getPacketsIn();
- mBitsIn = 8 * cdp->getBytesIn();
- mPacketsOut = cdp->getPacketsOut();
- mPacketsLost = cdp->getPacketsLost();
- mPingDelay = cdp->getPingDelay();
+ mPacketsIn = cdp->getPacketsIn();
+ mBitsIn = 8 * cdp->getBytesIn();
+ mPacketsOut = cdp->getPacketsOut();
+ mPacketsLost = cdp->getPacketsLost();
+ mPingDelay = cdp->getPingDelay();
- mBitsReceived += mBitsIn - mLastBitsIn;
- mPacketsReceived += mPacketsIn - mLastPacketsIn;
+ mBitsReceived += mBitsIn - mLastBitsIn;
+ mPacketsReceived += mPacketsIn - mLastPacketsIn;
}
U32 LLViewerRegion::getPacketsLost() const
{
- LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mImpl->mHost);
- if (!cdp)
- {
- LL_INFOS() << "LLViewerRegion::getPacketsLost couldn't find circuit for " << mImpl->mHost << LL_ENDL;
- return 0;
- }
- else
- {
- return cdp->getPacketsLost();
- }
+ LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mImpl->mHost);
+ if (!cdp)
+ {
+ LL_INFOS() << "LLViewerRegion::getPacketsLost couldn't find circuit for " << mImpl->mHost << LL_ENDL;
+ return 0;
+ }
+ else
+ {
+ return cdp->getPacketsLost();
+ }
}
S32 LLViewerRegion::getHttpResponderID() const
{
- return mImpl->mHttpResponderID;
+ return mImpl->mHttpResponderID;
}
BOOL LLViewerRegion::pointInRegionGlobal(const LLVector3d &point_global) const
{
- LLVector3 pos_region = getPosRegionFromGlobal(point_global);
-
- if (pos_region.mV[VX] < 0)
- {
- return FALSE;
- }
- if (pos_region.mV[VX] >= mWidth)
- {
- return FALSE;
- }
- if (pos_region.mV[VY] < 0)
- {
- return FALSE;
- }
- if (pos_region.mV[VY] >= mWidth)
- {
- return FALSE;
- }
- return TRUE;
+ LLVector3 pos_region = getPosRegionFromGlobal(point_global);
+
+ if (pos_region.mV[VX] < 0)
+ {
+ return FALSE;
+ }
+ if (pos_region.mV[VX] >= mWidth)
+ {
+ return FALSE;
+ }
+ if (pos_region.mV[VY] < 0)
+ {
+ return FALSE;
+ }
+ if (pos_region.mV[VY] >= mWidth)
+ {
+ return FALSE;
+ }
+ return TRUE;
}
LLVector3 LLViewerRegion::getPosRegionFromGlobal(const LLVector3d &point_global) const
{
- LLVector3 pos_region;
- pos_region.setVec(point_global - mImpl->mOriginGlobal);
- return pos_region;
+ LLVector3 pos_region;
+ pos_region.setVec(point_global - mImpl->mOriginGlobal);
+ return pos_region;
}
LLVector3d LLViewerRegion::getPosGlobalFromRegion(const LLVector3 &pos_region) const
{
- LLVector3d pos_region_d;
- pos_region_d.setVec(pos_region);
- return pos_region_d + mImpl->mOriginGlobal;
+ LLVector3d pos_region_d;
+ pos_region_d.setVec(pos_region);
+ return pos_region_d + mImpl->mOriginGlobal;
}
LLVector3 LLViewerRegion::getPosAgentFromRegion(const LLVector3 &pos_region) const
{
- LLVector3d pos_global = getPosGlobalFromRegion(pos_region);
+ LLVector3d pos_global = getPosGlobalFromRegion(pos_region);
- return gAgent.getPosAgentFromGlobal(pos_global);
+ return gAgent.getPosAgentFromGlobal(pos_global);
}
LLVector3 LLViewerRegion::getPosRegionFromAgent(const LLVector3 &pos_agent) const
{
- return pos_agent - getOriginAgent();
+ return pos_agent - getOriginAgent();
}
F32 LLViewerRegion::getLandHeightRegion(const LLVector3& region_pos)
{
- return mImpl->mLandp->resolveHeightRegion( region_pos );
+ return mImpl->mLandp->resolveHeightRegion( region_pos );
}
bool LLViewerRegion::isAlive()
{
- return mAlive;
+ return mAlive;
}
BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos)
{
- if (mParcelOverlay)
- {
- return mParcelOverlay->isOwnedSelf(pos);
- } else {
- return FALSE;
- }
+ if (mParcelOverlay)
+ {
+ return mParcelOverlay->isOwnedSelf(pos);
+ } else {
+ return FALSE;
+ }
}
// Owned by a group you belong to? (officer or member)
BOOL LLViewerRegion::isOwnedGroup(const LLVector3& pos)
{
- if (mParcelOverlay)
- {
- return mParcelOverlay->isOwnedGroup(pos);
- } else {
- return FALSE;
- }
+ if (mParcelOverlay)
+ {
+ return mParcelOverlay->isOwnedGroup(pos);
+ } else {
+ return FALSE;
+ }
}
// the new TCP coarse location handler node
class CoarseLocationUpdate : public LLHTTPNode
{
public:
- virtual void post(
- ResponsePtr responder,
- const LLSD& context,
- const LLSD& input) const
- {
- LLHost host(input["sender"].asString());
+ virtual void post(
+ ResponsePtr responder,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ LLHost host(input["sender"].asString());
LLWorld *world_inst = LLWorld::getInstance(); // Not a singleton!
if (!world_inst)
@@ -2207,151 +2207,151 @@ public:
return;
}
- LLViewerRegion* region = world_inst->getRegion(host);
- if( !region )
- {
- return;
- }
-
- S32 target_index = input["body"]["Index"][0]["Prey"].asInteger();
- S32 you_index = input["body"]["Index"][0]["You" ].asInteger();
-
- std::vector<U32>* avatar_locs = &region->mMapAvatars;
- std::vector<LLUUID>* avatar_ids = &region->mMapAvatarIDs;
- avatar_locs->clear();
- avatar_ids->clear();
-
- //LL_INFOS() << "coarse locations agent[0] " << input["body"]["AgentData"][0]["AgentID"].asUUID() << LL_ENDL;
- //LL_INFOS() << "my agent id = " << gAgent.getID() << LL_ENDL;
- //LL_INFOS() << ll_pretty_print_sd(input) << LL_ENDL;
-
- LLSD
- locs = input["body"]["Location"],
- agents = input["body"]["AgentData"];
- LLSD::array_iterator
- locs_it = locs.beginArray(),
- agents_it = agents.beginArray();
- BOOL has_agent_data = input["body"].has("AgentData");
-
- for(int i=0;
- locs_it != locs.endArray();
- i++, locs_it++)
- {
- U8
- x = locs_it->get("X").asInteger(),
- y = locs_it->get("Y").asInteger(),
- z = locs_it->get("Z").asInteger();
- // treat the target specially for the map, and don't add you or the target
- if(i == target_index)
- {
- LLVector3d global_pos(region->getOriginGlobal());
- global_pos.mdV[VX] += (F64)x;
- global_pos.mdV[VY] += (F64)y;
- global_pos.mdV[VZ] += (F64)z * 4.0;
- LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
- }
- else if( i != you_index)
- {
- U32 pos = 0x0;
- pos |= x;
- pos <<= 8;
- pos |= y;
- pos <<= 8;
- pos |= z;
- avatar_locs->push_back(pos);
- //LL_INFOS() << "next pos: " << x << "," << y << "," << z << ": " << pos << LL_ENDL;
- if(has_agent_data) // for backwards compatibility with old message format
- {
- LLUUID agent_id(agents_it->get("AgentID").asUUID());
- //LL_INFOS() << "next agent: " << agent_id.asString() << LL_ENDL;
- avatar_ids->push_back(agent_id);
- }
- }
- if (has_agent_data)
- {
- agents_it++;
- }
- }
- }
+ LLViewerRegion* region = world_inst->getRegion(host);
+ if( !region )
+ {
+ return;
+ }
+
+ S32 target_index = input["body"]["Index"][0]["Prey"].asInteger();
+ S32 you_index = input["body"]["Index"][0]["You" ].asInteger();
+
+ std::vector<U32>* avatar_locs = &region->mMapAvatars;
+ std::vector<LLUUID>* avatar_ids = &region->mMapAvatarIDs;
+ avatar_locs->clear();
+ avatar_ids->clear();
+
+ //LL_INFOS() << "coarse locations agent[0] " << input["body"]["AgentData"][0]["AgentID"].asUUID() << LL_ENDL;
+ //LL_INFOS() << "my agent id = " << gAgent.getID() << LL_ENDL;
+ //LL_INFOS() << ll_pretty_print_sd(input) << LL_ENDL;
+
+ LLSD
+ locs = input["body"]["Location"],
+ agents = input["body"]["AgentData"];
+ LLSD::array_iterator
+ locs_it = locs.beginArray(),
+ agents_it = agents.beginArray();
+ BOOL has_agent_data = input["body"].has("AgentData");
+
+ for(int i=0;
+ locs_it != locs.endArray();
+ i++, locs_it++)
+ {
+ U8
+ x = locs_it->get("X").asInteger(),
+ y = locs_it->get("Y").asInteger(),
+ z = locs_it->get("Z").asInteger();
+ // treat the target specially for the map, and don't add you or the target
+ if(i == target_index)
+ {
+ LLVector3d global_pos(region->getOriginGlobal());
+ global_pos.mdV[VX] += (F64)x;
+ global_pos.mdV[VY] += (F64)y;
+ global_pos.mdV[VZ] += (F64)z * 4.0;
+ LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
+ }
+ else if( i != you_index)
+ {
+ U32 pos = 0x0;
+ pos |= x;
+ pos <<= 8;
+ pos |= y;
+ pos <<= 8;
+ pos |= z;
+ avatar_locs->push_back(pos);
+ //LL_INFOS() << "next pos: " << x << "," << y << "," << z << ": " << pos << LL_ENDL;
+ if(has_agent_data) // for backwards compatibility with old message format
+ {
+ LLUUID agent_id(agents_it->get("AgentID").asUUID());
+ //LL_INFOS() << "next agent: " << agent_id.asString() << LL_ENDL;
+ avatar_ids->push_back(agent_id);
+ }
+ }
+ if (has_agent_data)
+ {
+ agents_it++;
+ }
+ }
+ }
};
// build the coarse location HTTP node under the "/message" URL
LLHTTPRegistration<CoarseLocationUpdate>
gHTTPRegistrationCoarseLocationUpdate(
- "/message/CoarseLocationUpdate");
+ "/message/CoarseLocationUpdate");
// the deprecated coarse location handler
void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg)
{
- //LL_INFOS() << "CoarseLocationUpdate" << LL_ENDL;
- mMapAvatars.clear();
- mMapAvatarIDs.clear(); // only matters in a rare case but it's good to be safe.
-
- U8 x_pos = 0;
- U8 y_pos = 0;
- U8 z_pos = 0;
-
- U32 pos = 0x0;
-
- S16 agent_index;
- S16 target_index;
- msg->getS16Fast(_PREHASH_Index, _PREHASH_You, agent_index);
- msg->getS16Fast(_PREHASH_Index, _PREHASH_Prey, target_index);
-
- BOOL has_agent_data = msg->has(_PREHASH_AgentData);
- S32 count = msg->getNumberOfBlocksFast(_PREHASH_Location);
- for(S32 i = 0; i < count; i++)
- {
- msg->getU8Fast(_PREHASH_Location, _PREHASH_X, x_pos, i);
- msg->getU8Fast(_PREHASH_Location, _PREHASH_Y, y_pos, i);
- msg->getU8Fast(_PREHASH_Location, _PREHASH_Z, z_pos, i);
- LLUUID agent_id = LLUUID::null;
- if(has_agent_data)
- {
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id, i);
- }
-
- //LL_INFOS() << " object X: " << (S32)x_pos << " Y: " << (S32)y_pos
- // << " Z: " << (S32)(z_pos * 4)
- // << LL_ENDL;
-
- // treat the target specially for the map
- if(i == target_index)
- {
- LLVector3d global_pos(mImpl->mOriginGlobal);
- global_pos.mdV[VX] += (F64)(x_pos);
- global_pos.mdV[VY] += (F64)(y_pos);
- global_pos.mdV[VZ] += (F64)(z_pos) * 4.0;
- LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
- }
-
- //don't add you
- if( i != agent_index)
- {
- pos = 0x0;
- pos |= x_pos;
- pos <<= 8;
- pos |= y_pos;
- pos <<= 8;
- pos |= z_pos;
- mMapAvatars.push_back(pos);
- if(has_agent_data)
- {
- mMapAvatarIDs.push_back(agent_id);
- }
- }
- }
+ //LL_INFOS() << "CoarseLocationUpdate" << LL_ENDL;
+ mMapAvatars.clear();
+ mMapAvatarIDs.clear(); // only matters in a rare case but it's good to be safe.
+
+ U8 x_pos = 0;
+ U8 y_pos = 0;
+ U8 z_pos = 0;
+
+ U32 pos = 0x0;
+
+ S16 agent_index;
+ S16 target_index;
+ msg->getS16Fast(_PREHASH_Index, _PREHASH_You, agent_index);
+ msg->getS16Fast(_PREHASH_Index, _PREHASH_Prey, target_index);
+
+ BOOL has_agent_data = msg->has(_PREHASH_AgentData);
+ S32 count = msg->getNumberOfBlocksFast(_PREHASH_Location);
+ for(S32 i = 0; i < count; i++)
+ {
+ msg->getU8Fast(_PREHASH_Location, _PREHASH_X, x_pos, i);
+ msg->getU8Fast(_PREHASH_Location, _PREHASH_Y, y_pos, i);
+ msg->getU8Fast(_PREHASH_Location, _PREHASH_Z, z_pos, i);
+ LLUUID agent_id = LLUUID::null;
+ if(has_agent_data)
+ {
+ msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id, i);
+ }
+
+ //LL_INFOS() << " object X: " << (S32)x_pos << " Y: " << (S32)y_pos
+ // << " Z: " << (S32)(z_pos * 4)
+ // << LL_ENDL;
+
+ // treat the target specially for the map
+ if(i == target_index)
+ {
+ LLVector3d global_pos(mImpl->mOriginGlobal);
+ global_pos.mdV[VX] += (F64)(x_pos);
+ global_pos.mdV[VY] += (F64)(y_pos);
+ global_pos.mdV[VZ] += (F64)(z_pos) * 4.0;
+ LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
+ }
+
+ //don't add you
+ if( i != agent_index)
+ {
+ pos = 0x0;
+ pos |= x_pos;
+ pos <<= 8;
+ pos |= y_pos;
+ pos <<= 8;
+ pos |= z_pos;
+ mMapAvatars.push_back(pos);
+ if(has_agent_data)
+ {
+ mMapAvatarIDs.push_back(agent_id);
+ }
+ }
+ }
}
void LLViewerRegion::getInfo(LLSD& info)
{
- info["Region"]["Host"] = getHost().getIPandPort();
- info["Region"]["Name"] = getName();
- U32 x, y;
- from_region_handle(getHandle(), &x, &y);
- info["Region"]["Handle"]["x"] = (LLSD::Integer)x;
- info["Region"]["Handle"]["y"] = (LLSD::Integer)y;
+ info["Region"]["Host"] = getHost().getIPandPort();
+ info["Region"]["Name"] = getName();
+ U32 x, y;
+ from_region_handle(getHandle(), &x, &y);
+ info["Region"]["Handle"]["x"] = (LLSD::Integer)x;
+ info["Region"]["Handle"]["y"] = (LLSD::Integer)y;
}
void LLViewerRegion::requestSimulatorFeatures()
@@ -2370,7 +2370,7 @@ void LLViewerRegion::requestSimulatorFeatures()
// launch() acts like a suspend()
// Make sure we are still good to do
LLCoros::checkStop();
-
+
LL_INFOS("AppInit", "SimulatorFeatures") << "Launching " << coroname << " requesting simulator features from " << url << " for region " << getRegionID() << LL_ENDL;
}
else
@@ -2381,292 +2381,292 @@ void LLViewerRegion::requestSimulatorFeatures()
boost::signals2::connection LLViewerRegion::setSimulatorFeaturesReceivedCallback(const caps_received_signal_t::slot_type& cb)
{
- return mSimulatorFeaturesReceivedSignal.connect(cb);
+ return mSimulatorFeaturesReceivedSignal.connect(cb);
}
void LLViewerRegion::setSimulatorFeaturesReceived(bool received)
{
- mSimulatorFeaturesReceived = received;
- if (received)
- {
- mSimulatorFeaturesReceivedSignal(getRegionID(), this);
- mSimulatorFeaturesReceivedSignal.disconnect_all_slots();
- }
+ mSimulatorFeaturesReceived = received;
+ if (received)
+ {
+ mSimulatorFeaturesReceivedSignal(getRegionID(), this);
+ mSimulatorFeaturesReceivedSignal.disconnect_all_slots();
+ }
}
bool LLViewerRegion::simulatorFeaturesReceived() const
{
- return mSimulatorFeaturesReceived;
+ return mSimulatorFeaturesReceived;
}
void LLViewerRegion::getSimulatorFeatures(LLSD& sim_features) const
{
- sim_features = mSimulatorFeatures;
+ sim_features = mSimulatorFeatures;
}
void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
{
- std::stringstream str;
-
- LLSDSerialize::toPrettyXML(sim_features, str);
- LL_INFOS() << "region " << getName() << " " << str.str() << LL_ENDL;
- mSimulatorFeatures = sim_features;
+ std::stringstream str;
+
+ LLSDSerialize::toPrettyXML(sim_features, str);
+ LL_INFOS() << "region " << getName() << " " << str.str() << LL_ENDL;
+ mSimulatorFeatures = sim_features;
+
+ setSimulatorFeaturesReceived(true);
- setSimulatorFeaturesReceived(true);
-
}
//this is called when the parent is not cacheable.
//move all orphan children out of cache and insert to rendering octree.
void LLViewerRegion::findOrphans(U32 parent_id)
{
- orphan_list_t::iterator iter = mOrphanMap.find(parent_id);
- if(iter != mOrphanMap.end())
- {
- std::vector<U32>* children = &mOrphanMap[parent_id];
- for(S32 i = 0; i < children->size(); i++)
- {
- //parent is visible, so is the child.
- addVisibleChildCacheEntry(NULL, getCacheEntry((*children)[i]));
- }
- children->clear();
- mOrphanMap.erase(parent_id);
- }
+ orphan_list_t::iterator iter = mOrphanMap.find(parent_id);
+ if(iter != mOrphanMap.end())
+ {
+ std::vector<U32>* children = &mOrphanMap[parent_id];
+ for(S32 i = 0; i < children->size(); i++)
+ {
+ //parent is visible, so is the child.
+ addVisibleChildCacheEntry(NULL, getCacheEntry((*children)[i]));
+ }
+ children->clear();
+ mOrphanMap.erase(parent_id);
+ }
}
void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry)
{
- if(!sVOCacheCullingEnabled)
- {
- gObjectList.processObjectUpdateFromCache(entry, this);
- return;
- }
- if(!entry || !entry->isValid())
- {
- return;
- }
-
- if(!entry->getEntry())
- {
- entry->setOctreeEntry(NULL);
- }
-
- if(entry->getEntry()->hasDrawable()) //already in the rendering pipeline
- {
- LLViewerRegion* old_regionp = ((LLDrawable*)entry->getEntry()->getDrawable())->getRegion();
- if(old_regionp != this && old_regionp)
- {
- LLViewerObject* obj = ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj();
- if(obj)
- {
- //remove from old region
- old_regionp->killCacheEntry(obj->getLocalID());
-
- //change region
- obj->setRegion(this);
- }
- }
-
- addActiveCacheEntry(entry);
-
- //set parent id
- U32 parent_id = 0;
+ if(!sVOCacheCullingEnabled)
+ {
+ gObjectList.processObjectUpdateFromCache(entry, this);
+ return;
+ }
+ if(!entry || !entry->isValid())
+ {
+ return;
+ }
+
+ if(!entry->getEntry())
+ {
+ entry->setOctreeEntry(NULL);
+ }
+
+ if(entry->getEntry()->hasDrawable()) //already in the rendering pipeline
+ {
+ LLViewerRegion* old_regionp = ((LLDrawable*)entry->getEntry()->getDrawable())->getRegion();
+ if(old_regionp != this && old_regionp)
+ {
+ LLViewerObject* obj = ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj();
+ if(obj)
+ {
+ //remove from old region
+ old_regionp->killCacheEntry(obj->getLocalID());
+
+ //change region
+ obj->setRegion(this);
+ }
+ }
+
+ addActiveCacheEntry(entry);
+
+ //set parent id
+ U32 parent_id = 0;
if (entry->getDP()) // NULL if nothing cached
{
LLViewerObject::unpackParentID(entry->getDP(), parent_id);
}
- if(parent_id != entry->getParentID())
- {
- entry->setParentID(parent_id);
- }
-
- //update the object
- gObjectList.processObjectUpdateFromCache(entry, this);
- return; //done
- }
-
- //must not be active.
- llassert_always(!entry->isState(LLVOCacheEntry::ACTIVE));
- removeFromVOCacheTree(entry); //remove from cache octree if it is in.
-
- LLVector3 pos;
- LLVector3 scale;
- LLQuaternion rot;
-
- //decode spatial info and parent info
- U32 parent_id = entry->getDP() ? LLViewerObject::extractSpatialExtents(entry->getDP(), pos, scale, rot) : entry->getParentID();
-
- U32 old_parent_id = entry->getParentID();
- bool same_old_parent = false;
- if(parent_id != old_parent_id) //parent changed.
- {
- if(old_parent_id > 0) //has an old parent, disconnect it
- {
- LLVOCacheEntry* old_parent = getCacheEntry(old_parent_id);
- if(old_parent)
- {
- old_parent->removeChild(entry);
- if(!old_parent->isState(LLVOCacheEntry::INACTIVE))
- {
- mImpl->mVisibleEntries.erase(entry);
- entry->setState(LLVOCacheEntry::INACTIVE);
- }
- }
- }
- entry->setParentID(parent_id);
- }
- else
- {
- same_old_parent = true;
- }
-
- if(parent_id > 0) //has a new parent
- {
- //1, find the parent in cache
- LLVOCacheEntry* parent = getCacheEntry(parent_id);
-
- //2, parent is not in the cache, put into the orphan list.
- if(!parent)
- {
- if(!same_old_parent)
- {
- //check if parent is non-cacheable and already created
- if(isNonCacheableObjectCreated(parent_id))
- {
- //parent is visible, so is the child.
- addVisibleChildCacheEntry(NULL, entry);
- }
- else
- {
- entry->setBoundingInfo(pos, scale);
- mOrphanMap[parent_id].push_back(entry->getLocalID());
- }
- }
- else
- {
- entry->setBoundingInfo(pos, scale);
- }
- }
- else //parent in cache.
- {
- if(!parent->isState(LLVOCacheEntry::INACTIVE))
- {
- //parent is visible, so is the child.
- addVisibleChildCacheEntry(parent, entry);
- }
- else
- {
- entry->setBoundingInfo(pos, scale);
- parent->addChild(entry);
-
- if(parent->getGroup()) //re-insert parent to vo-cache tree because its bounding info changed.
- {
- removeFromVOCacheTree(parent);
- addToVOCacheTree(parent);
- }
- }
- }
-
- return;
- }
-
- //
- //no parent
- //
- entry->setBoundingInfo(pos, scale);
-
- if(!parent_id) //a potential parent
- {
- //find all children and update their bounding info
- orphan_list_t::iterator iter = mOrphanMap.find(entry->getLocalID());
- if(iter != mOrphanMap.end())
- {
- std::vector<U32>* orphans = &mOrphanMap[entry->getLocalID()];
- S32 size = orphans->size();
- for(S32 i = 0; i < size; i++)
- {
- LLVOCacheEntry* child = getCacheEntry((*orphans)[i]);
- if(child)
- {
- entry->addChild(child);
- }
- }
- orphans->clear();
- mOrphanMap.erase(entry->getLocalID());
- }
- }
-
- if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE))
- {
- addToVOCacheTree(entry);
- }
- return ;
+ if(parent_id != entry->getParentID())
+ {
+ entry->setParentID(parent_id);
+ }
+
+ //update the object
+ gObjectList.processObjectUpdateFromCache(entry, this);
+ return; //done
+ }
+
+ //must not be active.
+ llassert_always(!entry->isState(LLVOCacheEntry::ACTIVE));
+ removeFromVOCacheTree(entry); //remove from cache octree if it is in.
+
+ LLVector3 pos;
+ LLVector3 scale;
+ LLQuaternion rot;
+
+ //decode spatial info and parent info
+ U32 parent_id = entry->getDP() ? LLViewerObject::extractSpatialExtents(entry->getDP(), pos, scale, rot) : entry->getParentID();
+
+ U32 old_parent_id = entry->getParentID();
+ bool same_old_parent = false;
+ if(parent_id != old_parent_id) //parent changed.
+ {
+ if(old_parent_id > 0) //has an old parent, disconnect it
+ {
+ LLVOCacheEntry* old_parent = getCacheEntry(old_parent_id);
+ if(old_parent)
+ {
+ old_parent->removeChild(entry);
+ if(!old_parent->isState(LLVOCacheEntry::INACTIVE))
+ {
+ mImpl->mVisibleEntries.erase(entry);
+ entry->setState(LLVOCacheEntry::INACTIVE);
+ }
+ }
+ }
+ entry->setParentID(parent_id);
+ }
+ else
+ {
+ same_old_parent = true;
+ }
+
+ if(parent_id > 0) //has a new parent
+ {
+ //1, find the parent in cache
+ LLVOCacheEntry* parent = getCacheEntry(parent_id);
+
+ //2, parent is not in the cache, put into the orphan list.
+ if(!parent)
+ {
+ if(!same_old_parent)
+ {
+ //check if parent is non-cacheable and already created
+ if(isNonCacheableObjectCreated(parent_id))
+ {
+ //parent is visible, so is the child.
+ addVisibleChildCacheEntry(NULL, entry);
+ }
+ else
+ {
+ entry->setBoundingInfo(pos, scale);
+ mOrphanMap[parent_id].push_back(entry->getLocalID());
+ }
+ }
+ else
+ {
+ entry->setBoundingInfo(pos, scale);
+ }
+ }
+ else //parent in cache.
+ {
+ if(!parent->isState(LLVOCacheEntry::INACTIVE))
+ {
+ //parent is visible, so is the child.
+ addVisibleChildCacheEntry(parent, entry);
+ }
+ else
+ {
+ entry->setBoundingInfo(pos, scale);
+ parent->addChild(entry);
+
+ if(parent->getGroup()) //re-insert parent to vo-cache tree because its bounding info changed.
+ {
+ removeFromVOCacheTree(parent);
+ addToVOCacheTree(parent);
+ }
+ }
+ }
+
+ return;
+ }
+
+ //
+ //no parent
+ //
+ entry->setBoundingInfo(pos, scale);
+
+ if(!parent_id) //a potential parent
+ {
+ //find all children and update their bounding info
+ orphan_list_t::iterator iter = mOrphanMap.find(entry->getLocalID());
+ if(iter != mOrphanMap.end())
+ {
+ std::vector<U32>* orphans = &mOrphanMap[entry->getLocalID()];
+ S32 size = orphans->size();
+ for(S32 i = 0; i < size; i++)
+ {
+ LLVOCacheEntry* child = getCacheEntry((*orphans)[i]);
+ if(child)
+ {
+ entry->addChild(child);
+ }
+ }
+ orphans->clear();
+ mOrphanMap.erase(entry->getLocalID());
+ }
+ }
+
+ if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE))
+ {
+ addToVOCacheTree(entry);
+ }
+ return ;
}
LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags)
{
- eCacheUpdateResult result;
- U32 crc;
- U32 local_id;
+ eCacheUpdateResult result;
+ U32 crc;
+ U32 local_id;
- LLViewerObject::unpackU32(&dp, local_id, "LocalID");
- LLViewerObject::unpackU32(&dp, crc, "CRC");
+ LLViewerObject::unpackU32(&dp, local_id, "LocalID");
+ LLViewerObject::unpackU32(&dp, crc, "CRC");
- LLVOCacheEntry* entry = getCacheEntry(local_id, false);
+ LLVOCacheEntry* entry = getCacheEntry(local_id, false);
- if (entry)
- {
- entry->setValid();
+ if (entry)
+ {
+ entry->setValid();
- // we've seen this object before
- if (entry->getCRC() == crc)
- {
+ // we've seen this object before
+ if (entry->getCRC() == crc)
+ {
LL_DEBUGS("AnimatedObjects") << " got dupe for local_id " << local_id << LL_ENDL;
dumpStack("AnimatedObjectsStack");
- // Record a hit
- entry->recordDupe();
- result = CACHE_UPDATE_DUPE;
- }
- else //CRC changed
- {
+ // Record a hit
+ entry->recordDupe();
+ result = CACHE_UPDATE_DUPE;
+ }
+ else //CRC changed
+ {
LL_DEBUGS("AnimatedObjects") << " got update for local_id " << local_id << LL_ENDL;
dumpStack("AnimatedObjectsStack");
- // Update the cache entry
- entry->updateEntry(crc, dp);
+ // Update the cache entry
+ entry->updateEntry(crc, dp);
- decodeBoundingInfo(entry);
+ decodeBoundingInfo(entry);
- result = CACHE_UPDATE_CHANGED;
- }
- }
- else
- {
+ result = CACHE_UPDATE_CHANGED;
+ }
+ }
+ else
+ {
LL_DEBUGS("AnimatedObjects") << " got first notification for local_id " << local_id << LL_ENDL;
dumpStack("AnimatedObjectsStack");
- // we haven't seen this object before
- // Create new entry and add to map
- result = CACHE_UPDATE_ADDED;
- entry = new LLVOCacheEntry(local_id, crc, dp);
- record(LLStatViewer::OBJECT_CACHE_HIT_RATE, LLUnits::Ratio::fromValue(0));
-
- mImpl->mCacheMap[local_id] = entry;
-
- decodeBoundingInfo(entry);
- }
- entry->setUpdateFlags(flags);
-
- return result;
- }
+ // we haven't seen this object before
+ // Create new entry and add to map
+ result = CACHE_UPDATE_ADDED;
+ entry = new LLVOCacheEntry(local_id, crc, dp);
+ record(LLStatViewer::OBJECT_CACHE_HIT_RATE, LLUnits::Ratio::fromValue(0));
+
+ mImpl->mCacheMap[local_id] = entry;
+
+ decodeBoundingInfo(entry);
+ }
+ entry->setUpdateFlags(flags);
+
+ return result;
+ }
LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp, U32 flags)
{
- eCacheUpdateResult result = cacheFullUpdate(dp, flags);
+ eCacheUpdateResult result = cacheFullUpdate(dp, flags);
- return result;
+ return result;
}
void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data)
@@ -2677,529 +2677,529 @@ void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry
LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id)
{
- if(!sVOCacheCullingEnabled)
- {
- return NULL;
- }
+ if(!sVOCacheCullingEnabled)
+ {
+ return NULL;
+ }
+
+ LLVOCacheEntry* entry = getCacheEntry(local_id);
+ removeFromVOCacheTree(entry);
- LLVOCacheEntry* entry = getCacheEntry(local_id);
- removeFromVOCacheTree(entry);
-
- return entry;
+ return entry;
}
LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id, bool valid)
{
- LLVOCacheEntry::vocache_entry_map_t::iterator iter = mImpl->mCacheMap.find(local_id);
- if(iter != mImpl->mCacheMap.end())
- {
- if(!valid || iter->second->isValid())
- {
- return iter->second;
- }
- }
- return NULL;
+ LLVOCacheEntry::vocache_entry_map_t::iterator iter = mImpl->mCacheMap.find(local_id);
+ if(iter != mImpl->mCacheMap.end())
+ {
+ if(!valid || iter->second->isValid())
+ {
+ return iter->second;
+ }
+ }
+ return NULL;
}
void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType cache_miss_type)
{
- mRegionCacheMissCount++;
+ mRegionCacheMissCount++;
mCacheMissList.push_back(CacheMissItem(id, cache_miss_type));
}
//check if a non-cacheable object is already created.
bool LLViewerRegion::isNonCacheableObjectCreated(U32 local_id)
{
- if(mImpl && local_id > 0 && mImpl->mNonCacheableCreatedList.find(local_id) != mImpl->mNonCacheableCreatedList.end())
- {
- return true;
- }
- return false;
+ if(mImpl && local_id > 0 && mImpl->mNonCacheableCreatedList.find(local_id) != mImpl->mNonCacheableCreatedList.end())
+ {
+ return true;
+ }
+ return false;
}
-
+
void LLViewerRegion::removeFromCreatedList(U32 local_id)
-{
- if(mImpl && local_id > 0)
- {
- std::set<U32>::iterator iter = mImpl->mNonCacheableCreatedList.find(local_id);
- if(iter != mImpl->mNonCacheableCreatedList.end())
- {
- mImpl->mNonCacheableCreatedList.erase(iter);
- }
- }
- }
+{
+ if(mImpl && local_id > 0)
+ {
+ std::set<U32>::iterator iter = mImpl->mNonCacheableCreatedList.find(local_id);
+ if(iter != mImpl->mNonCacheableCreatedList.end())
+ {
+ mImpl->mNonCacheableCreatedList.erase(iter);
+ }
+ }
+ }
void LLViewerRegion::addToCreatedList(U32 local_id)
{
- if(mImpl && local_id > 0)
- {
- mImpl->mNonCacheableCreatedList.insert(local_id);
- }
+ if(mImpl && local_id > 0)
+ {
+ mImpl->mNonCacheableCreatedList.insert(local_id);
+ }
}
// Get data packer for this object, if we have cached data
// AND the CRC matches. JC
bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type)
{
- //llassert(mCacheLoaded); This assert failes often, changing to early-out -- davep, 2010/10/18
+ //llassert(mCacheLoaded); This assert failes often, changing to early-out -- davep, 2010/10/18
- LLVOCacheEntry* entry = getCacheEntry(local_id, false);
+ LLVOCacheEntry* entry = getCacheEntry(local_id, false);
- if (entry)
- {
- // we've seen this object before
- if (entry->getCRC() == crc)
- {
- // Record a hit
- mRegionCacheHitCount++;
- entry->recordHit();
+ if (entry)
+ {
+ // we've seen this object before
+ if (entry->getCRC() == crc)
+ {
+ // Record a hit
+ mRegionCacheHitCount++;
+ entry->recordHit();
cache_miss_type = CACHE_MISS_TYPE_NONE;
- entry->setUpdateFlags(flags);
-
- if(entry->isState(LLVOCacheEntry::ACTIVE))
- {
- ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj()->loadFlags(flags);
- return true;
- }
-
- if(entry->isValid())
- {
- return true; //already probed
- }
-
- entry->setValid();
- decodeBoundingInfo(entry);
+ entry->setUpdateFlags(flags);
+
+ if(entry->isState(LLVOCacheEntry::ACTIVE))
+ {
+ ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj()->loadFlags(flags);
+ return true;
+ }
+
+ if(entry->isValid())
+ {
+ return true; //already probed
+ }
+
+ entry->setValid();
+ decodeBoundingInfo(entry);
//loadCacheMiscExtras(local_id, entry, crc);
- return true;
- }
- else
- {
- // LL_INFOS() << "CRC miss for " << local_id << LL_ENDL;
+ return true;
+ }
+ else
+ {
+ // LL_INFOS() << "CRC miss for " << local_id << LL_ENDL;
- addCacheMiss(local_id, CACHE_MISS_TYPE_CRC);
+ addCacheMiss(local_id, CACHE_MISS_TYPE_CRC);
cache_miss_type = CACHE_MISS_TYPE_CRC;
- }
- }
- else
- { // Total miss, don't have the object in cache
- // LL_INFOS() << "Cache miss for " << local_id << LL_ENDL;
+ }
+ }
+ else
+ { // Total miss, don't have the object in cache
+ // LL_INFOS() << "Cache miss for " << local_id << LL_ENDL;
addCacheMiss(local_id, CACHE_MISS_TYPE_TOTAL);
cache_miss_type = CACHE_MISS_TYPE_TOTAL;
- }
+ }
- return false;
+ return false;
}
void LLViewerRegion::addCacheMissFull(const U32 local_id)
{
- addCacheMiss(local_id, CACHE_MISS_TYPE_TOTAL);
+ addCacheMiss(local_id, CACHE_MISS_TYPE_TOTAL);
}
void LLViewerRegion::requestCacheMisses()
{
- if (!mCacheMissList.size())
- {
- return;
- }
-
- LLMessageSystem* msg = gMessageSystem;
- BOOL start_new_message = TRUE;
- S32 blocks = 0;
-
- //send requests for all cache-missed objects
- for (CacheMissItem::cache_miss_list_t::iterator iter = mCacheMissList.begin(); iter != mCacheMissList.end(); ++iter)
- {
- if (start_new_message)
- {
- msg->newMessageFast(_PREHASH_RequestMultipleObjects);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- start_new_message = FALSE;
- }
-
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU8Fast(_PREHASH_CacheMissType, (*iter).mType);
- msg->addU32Fast(_PREHASH_ID, (*iter).mID);
+ if (!mCacheMissList.size())
+ {
+ return;
+ }
+
+ LLMessageSystem* msg = gMessageSystem;
+ BOOL start_new_message = TRUE;
+ S32 blocks = 0;
+
+ //send requests for all cache-missed objects
+ for (CacheMissItem::cache_miss_list_t::iterator iter = mCacheMissList.begin(); iter != mCacheMissList.end(); ++iter)
+ {
+ if (start_new_message)
+ {
+ msg->newMessageFast(_PREHASH_RequestMultipleObjects);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ start_new_message = FALSE;
+ }
+
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addU8Fast(_PREHASH_CacheMissType, (*iter).mType);
+ msg->addU32Fast(_PREHASH_ID, (*iter).mID);
LL_DEBUGS("AnimatedObjects") << "Requesting cache missed object " << (*iter).mID << LL_ENDL;
-
- blocks++;
- if (blocks >= 255)
- {
- sendReliableMessage();
- start_new_message = TRUE;
- blocks = 0;
- }
- }
+ blocks++;
- // finish any pending message
- if (!start_new_message)
- {
- sendReliableMessage();
- }
+ if (blocks >= 255)
+ {
+ sendReliableMessage();
+ start_new_message = TRUE;
+ blocks = 0;
+ }
+ }
- mCacheDirty = TRUE ;
- // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL;
- LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size());
+ // finish any pending message
+ if (!start_new_message)
+ {
+ sendReliableMessage();
+ }
+
+ mCacheDirty = TRUE ;
+ // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL;
+ LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size());
- mCacheMissList.clear();
+ mCacheMissList.clear();
}
void LLViewerRegion::dumpCache()
{
- const S32 BINS = 4;
- S32 hit_bin[BINS];
- S32 change_bin[BINS];
+ const S32 BINS = 4;
+ S32 hit_bin[BINS];
+ S32 change_bin[BINS];
- S32 i;
- for (i = 0; i < BINS; ++i)
- {
- hit_bin[i] = 0;
- change_bin[i] = 0;
- }
+ S32 i;
+ for (i = 0; i < BINS; ++i)
+ {
+ hit_bin[i] = 0;
+ change_bin[i] = 0;
+ }
- LLVOCacheEntry *entry;
- for(LLVOCacheEntry::vocache_entry_map_t::iterator iter = mImpl->mCacheMap.begin(); iter != mImpl->mCacheMap.end(); ++iter)
- {
- entry = iter->second ;
+ LLVOCacheEntry *entry;
+ for(LLVOCacheEntry::vocache_entry_map_t::iterator iter = mImpl->mCacheMap.begin(); iter != mImpl->mCacheMap.end(); ++iter)
+ {
+ entry = iter->second ;
- S32 hits = entry->getHitCount();
- S32 changes = entry->getCRCChangeCount();
+ S32 hits = entry->getHitCount();
+ S32 changes = entry->getCRCChangeCount();
- hits = llclamp(hits, 0, BINS-1);
- changes = llclamp(changes, 0, BINS-1);
+ hits = llclamp(hits, 0, BINS-1);
+ changes = llclamp(changes, 0, BINS-1);
- hit_bin[hits]++;
- change_bin[changes]++;
- }
+ hit_bin[hits]++;
+ change_bin[changes]++;
+ }
- LL_INFOS() << "Count " << mImpl->mCacheMap.size() << LL_ENDL;
- for (i = 0; i < BINS; i++)
- {
- LL_INFOS() << "Hits " << i << " " << hit_bin[i] << LL_ENDL;
- }
- for (i = 0; i < BINS; i++)
- {
- LL_INFOS() << "Changes " << i << " " << change_bin[i] << LL_ENDL;
- }
- // TODO - add overrides cache too
+ LL_INFOS() << "Count " << mImpl->mCacheMap.size() << LL_ENDL;
+ for (i = 0; i < BINS; i++)
+ {
+ LL_INFOS() << "Hits " << i << " " << hit_bin[i] << LL_ENDL;
+ }
+ for (i = 0; i < BINS; i++)
+ {
+ LL_INFOS() << "Changes " << i << " " << change_bin[i] << LL_ENDL;
+ }
+ // TODO - add overrides cache too
}
void LLViewerRegion::unpackRegionHandshake()
{
- LLMessageSystem *msg = gMessageSystem;
-
- U64 region_flags = 0;
- U64 region_protocols = 0;
- U8 sim_access;
- std::string sim_name;
- LLUUID sim_owner;
- BOOL is_estate_manager;
- F32 water_height;
- F32 billable_factor;
- LLUUID cache_id;
-
- msg->getU8 ("RegionInfo", "SimAccess", sim_access);
- msg->getString ("RegionInfo", "SimName", sim_name);
- msg->getUUID ("RegionInfo", "SimOwner", sim_owner);
- msg->getBOOL ("RegionInfo", "IsEstateManager", is_estate_manager);
- msg->getF32 ("RegionInfo", "WaterHeight", water_height);
- msg->getF32 ("RegionInfo", "BillableFactor", billable_factor);
- msg->getUUID ("RegionInfo", "CacheID", cache_id );
-
- if (msg->has(_PREHASH_RegionInfo4))
- {
- msg->getU64Fast(_PREHASH_RegionInfo4, _PREHASH_RegionFlagsExtended, region_flags);
- msg->getU64Fast(_PREHASH_RegionInfo4, _PREHASH_RegionProtocols, region_protocols);
- }
- else
- {
- U32 flags = 0;
- msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags);
- region_flags = flags;
- }
-
- setRegionFlags(region_flags);
- setRegionProtocols(region_protocols);
- setSimAccess(sim_access);
- setRegionNameAndZone(sim_name);
- setOwner(sim_owner);
- setIsEstateManager(is_estate_manager);
- setWaterHeight(water_height);
- setBillableFactor(billable_factor);
- setCacheID(cache_id);
-
- LLUUID region_id;
- msg->getUUID("RegionInfo2", "RegionID", region_id);
- setRegionID(region_id);
-
- // Retrieve the CR-53 (Homestead/Land SKU) information
- S32 classID = 0;
- S32 cpuRatio = 0;
- std::string coloName;
- std::string productSKU;
- std::string productName;
-
- // the only reasonable way to decide if we actually have any data is to
- // check to see if any of these fields have positive sizes
- if (msg->getSize("RegionInfo3", "ColoName") > 0 ||
- msg->getSize("RegionInfo3", "ProductSKU") > 0 ||
- msg->getSize("RegionInfo3", "ProductName") > 0)
- {
- msg->getS32 ("RegionInfo3", "CPUClassID", classID);
- msg->getS32 ("RegionInfo3", "CPURatio", cpuRatio);
- msg->getString ("RegionInfo3", "ColoName", coloName);
- msg->getString ("RegionInfo3", "ProductSKU", productSKU);
- msg->getString ("RegionInfo3", "ProductName", productName);
-
- mClassID = classID;
- mCPURatio = cpuRatio;
- mColoName = coloName;
- mProductSKU = productSKU;
- mProductName = productName;
- }
-
- mCentralBakeVersion = region_protocols & 1; // was (S32)gSavedSettings.getBOOL("UseServerTextureBaking");
- LLVLComposition *compp = getComposition();
- if (compp)
- {
- LLUUID tmp_id;
-
- bool changed = false;
-
- // Get the 4 textures for land
- msg->getUUID("RegionInfo", "TerrainDetail0", tmp_id);
- changed |= (tmp_id != compp->getDetailTextureID(0));
- compp->setDetailTextureID(0, tmp_id);
-
- msg->getUUID("RegionInfo", "TerrainDetail1", tmp_id);
- changed |= (tmp_id != compp->getDetailTextureID(1));
- compp->setDetailTextureID(1, tmp_id);
-
- msg->getUUID("RegionInfo", "TerrainDetail2", tmp_id);
- changed |= (tmp_id != compp->getDetailTextureID(2));
- compp->setDetailTextureID(2, tmp_id);
-
- msg->getUUID("RegionInfo", "TerrainDetail3", tmp_id);
- changed |= (tmp_id != compp->getDetailTextureID(3));
- compp->setDetailTextureID(3, tmp_id);
-
- // Get the start altitude and range values for land textures
- F32 tmp_f32;
- msg->getF32("RegionInfo", "TerrainStartHeight00", tmp_f32);
- changed |= (tmp_f32 != compp->getStartHeight(0));
- compp->setStartHeight(0, tmp_f32);
-
- msg->getF32("RegionInfo", "TerrainStartHeight01", tmp_f32);
- changed |= (tmp_f32 != compp->getStartHeight(1));
- compp->setStartHeight(1, tmp_f32);
-
- msg->getF32("RegionInfo", "TerrainStartHeight10", tmp_f32);
- changed |= (tmp_f32 != compp->getStartHeight(2));
- compp->setStartHeight(2, tmp_f32);
-
- msg->getF32("RegionInfo", "TerrainStartHeight11", tmp_f32);
- changed |= (tmp_f32 != compp->getStartHeight(3));
- compp->setStartHeight(3, tmp_f32);
-
-
- msg->getF32("RegionInfo", "TerrainHeightRange00", tmp_f32);
- changed |= (tmp_f32 != compp->getHeightRange(0));
- compp->setHeightRange(0, tmp_f32);
-
- msg->getF32("RegionInfo", "TerrainHeightRange01", tmp_f32);
- changed |= (tmp_f32 != compp->getHeightRange(1));
- compp->setHeightRange(1, tmp_f32);
-
- msg->getF32("RegionInfo", "TerrainHeightRange10", tmp_f32);
- changed |= (tmp_f32 != compp->getHeightRange(2));
- compp->setHeightRange(2, tmp_f32);
-
- msg->getF32("RegionInfo", "TerrainHeightRange11", tmp_f32);
- changed |= (tmp_f32 != compp->getHeightRange(3));
- compp->setHeightRange(3, tmp_f32);
-
- // If this is an UPDATE (params already ready, we need to regenerate
- // all of our terrain stuff, by
- if (compp->getParamsReady())
- {
- // Update if the land changed
- if (changed)
- {
- getLand().dirtyAllPatches();
- }
- }
- else
- {
- compp->setParamsReady();
- }
- }
-
-
- // Now that we have the name, we can load the cache file
- // off disk.
- loadObjectCache();
-
- // After loading cache, signal that simulator can start
- // sending data.
- // TODO: Send all upstream viewer->sim handshake info here.
- LLHost host = msg->getSender();
- msg->newMessage("RegionHandshakeReply");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("RegionInfo");
-
- U32 flags = 0;
- flags |= REGION_HANDSHAKE_SUPPORTS_SELF_APPEARANCE;
-
- if(sVOCacheCullingEnabled)
- {
- flags |= 0x00000001; //set the bit 0 to be 1 to ask sim to send all cacheable objects.
- }
- if(mImpl->mCacheMap.empty())
- {
- flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes.
- }
- msg->addU32("Flags", flags );
- msg->sendReliable(host);
-
- mRegionTimer.reset(); //reset region timer.
+ LLMessageSystem *msg = gMessageSystem;
+
+ U64 region_flags = 0;
+ U64 region_protocols = 0;
+ U8 sim_access;
+ std::string sim_name;
+ LLUUID sim_owner;
+ BOOL is_estate_manager;
+ F32 water_height;
+ F32 billable_factor;
+ LLUUID cache_id;
+
+ msg->getU8 ("RegionInfo", "SimAccess", sim_access);
+ msg->getString ("RegionInfo", "SimName", sim_name);
+ msg->getUUID ("RegionInfo", "SimOwner", sim_owner);
+ msg->getBOOL ("RegionInfo", "IsEstateManager", is_estate_manager);
+ msg->getF32 ("RegionInfo", "WaterHeight", water_height);
+ msg->getF32 ("RegionInfo", "BillableFactor", billable_factor);
+ msg->getUUID ("RegionInfo", "CacheID", cache_id );
+
+ if (msg->has(_PREHASH_RegionInfo4))
+ {
+ msg->getU64Fast(_PREHASH_RegionInfo4, _PREHASH_RegionFlagsExtended, region_flags);
+ msg->getU64Fast(_PREHASH_RegionInfo4, _PREHASH_RegionProtocols, region_protocols);
+ }
+ else
+ {
+ U32 flags = 0;
+ msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags);
+ region_flags = flags;
+ }
+
+ setRegionFlags(region_flags);
+ setRegionProtocols(region_protocols);
+ setSimAccess(sim_access);
+ setRegionNameAndZone(sim_name);
+ setOwner(sim_owner);
+ setIsEstateManager(is_estate_manager);
+ setWaterHeight(water_height);
+ setBillableFactor(billable_factor);
+ setCacheID(cache_id);
+
+ LLUUID region_id;
+ msg->getUUID("RegionInfo2", "RegionID", region_id);
+ setRegionID(region_id);
+
+ // Retrieve the CR-53 (Homestead/Land SKU) information
+ S32 classID = 0;
+ S32 cpuRatio = 0;
+ std::string coloName;
+ std::string productSKU;
+ std::string productName;
+
+ // the only reasonable way to decide if we actually have any data is to
+ // check to see if any of these fields have positive sizes
+ if (msg->getSize("RegionInfo3", "ColoName") > 0 ||
+ msg->getSize("RegionInfo3", "ProductSKU") > 0 ||
+ msg->getSize("RegionInfo3", "ProductName") > 0)
+ {
+ msg->getS32 ("RegionInfo3", "CPUClassID", classID);
+ msg->getS32 ("RegionInfo3", "CPURatio", cpuRatio);
+ msg->getString ("RegionInfo3", "ColoName", coloName);
+ msg->getString ("RegionInfo3", "ProductSKU", productSKU);
+ msg->getString ("RegionInfo3", "ProductName", productName);
+
+ mClassID = classID;
+ mCPURatio = cpuRatio;
+ mColoName = coloName;
+ mProductSKU = productSKU;
+ mProductName = productName;
+ }
+
+ mCentralBakeVersion = region_protocols & 1; // was (S32)gSavedSettings.getBOOL("UseServerTextureBaking");
+ LLVLComposition *compp = getComposition();
+ if (compp)
+ {
+ LLUUID tmp_id;
+
+ bool changed = false;
+
+ // Get the 4 textures for land
+ msg->getUUID("RegionInfo", "TerrainDetail0", tmp_id);
+ changed |= (tmp_id != compp->getDetailTextureID(0));
+ compp->setDetailTextureID(0, tmp_id);
+
+ msg->getUUID("RegionInfo", "TerrainDetail1", tmp_id);
+ changed |= (tmp_id != compp->getDetailTextureID(1));
+ compp->setDetailTextureID(1, tmp_id);
+
+ msg->getUUID("RegionInfo", "TerrainDetail2", tmp_id);
+ changed |= (tmp_id != compp->getDetailTextureID(2));
+ compp->setDetailTextureID(2, tmp_id);
+
+ msg->getUUID("RegionInfo", "TerrainDetail3", tmp_id);
+ changed |= (tmp_id != compp->getDetailTextureID(3));
+ compp->setDetailTextureID(3, tmp_id);
+
+ // Get the start altitude and range values for land textures
+ F32 tmp_f32;
+ msg->getF32("RegionInfo", "TerrainStartHeight00", tmp_f32);
+ changed |= (tmp_f32 != compp->getStartHeight(0));
+ compp->setStartHeight(0, tmp_f32);
+
+ msg->getF32("RegionInfo", "TerrainStartHeight01", tmp_f32);
+ changed |= (tmp_f32 != compp->getStartHeight(1));
+ compp->setStartHeight(1, tmp_f32);
+
+ msg->getF32("RegionInfo", "TerrainStartHeight10", tmp_f32);
+ changed |= (tmp_f32 != compp->getStartHeight(2));
+ compp->setStartHeight(2, tmp_f32);
+
+ msg->getF32("RegionInfo", "TerrainStartHeight11", tmp_f32);
+ changed |= (tmp_f32 != compp->getStartHeight(3));
+ compp->setStartHeight(3, tmp_f32);
+
+
+ msg->getF32("RegionInfo", "TerrainHeightRange00", tmp_f32);
+ changed |= (tmp_f32 != compp->getHeightRange(0));
+ compp->setHeightRange(0, tmp_f32);
+
+ msg->getF32("RegionInfo", "TerrainHeightRange01", tmp_f32);
+ changed |= (tmp_f32 != compp->getHeightRange(1));
+ compp->setHeightRange(1, tmp_f32);
+
+ msg->getF32("RegionInfo", "TerrainHeightRange10", tmp_f32);
+ changed |= (tmp_f32 != compp->getHeightRange(2));
+ compp->setHeightRange(2, tmp_f32);
+
+ msg->getF32("RegionInfo", "TerrainHeightRange11", tmp_f32);
+ changed |= (tmp_f32 != compp->getHeightRange(3));
+ compp->setHeightRange(3, tmp_f32);
+
+ // If this is an UPDATE (params already ready, we need to regenerate
+ // all of our terrain stuff, by
+ if (compp->getParamsReady())
+ {
+ // Update if the land changed
+ if (changed)
+ {
+ getLand().dirtyAllPatches();
+ }
+ }
+ else
+ {
+ compp->setParamsReady();
+ }
+ }
+
+
+ // Now that we have the name, we can load the cache file
+ // off disk.
+ loadObjectCache();
+
+ // After loading cache, signal that simulator can start
+ // sending data.
+ // TODO: Send all upstream viewer->sim handshake info here.
+ LLHost host = msg->getSender();
+ msg->newMessage("RegionHandshakeReply");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("RegionInfo");
+
+ U32 flags = 0;
+ flags |= REGION_HANDSHAKE_SUPPORTS_SELF_APPEARANCE;
+
+ if(sVOCacheCullingEnabled)
+ {
+ flags |= 0x00000001; //set the bit 0 to be 1 to ask sim to send all cacheable objects.
+ }
+ if(mImpl->mCacheMap.empty())
+ {
+ flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes.
+ }
+ msg->addU32("Flags", flags );
+ msg->sendReliable(host);
+
+ mRegionTimer.reset(); //reset region timer.
}
// static
void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
{
- capabilityNames.append("AbuseCategories");
- capabilityNames.append("AcceptFriendship");
- capabilityNames.append("AcceptGroupInvite"); // ReadOfflineMsgs recieved messages only!!!
- capabilityNames.append("AgentPreferences");
+ capabilityNames.append("AbuseCategories");
+ capabilityNames.append("AcceptFriendship");
+ capabilityNames.append("AcceptGroupInvite"); // ReadOfflineMsgs recieved messages only!!!
+ capabilityNames.append("AgentPreferences");
capabilityNames.append("AgentProfile");
- capabilityNames.append("AgentState");
- capabilityNames.append("AttachmentResources");
- capabilityNames.append("AvatarPickerSearch");
- capabilityNames.append("AvatarRenderInfo");
- capabilityNames.append("CharacterProperties");
- capabilityNames.append("ChatSessionRequest");
- capabilityNames.append("CopyInventoryFromNotecard");
- capabilityNames.append("CreateInventoryCategory");
- capabilityNames.append("DeclineFriendship");
- capabilityNames.append("DeclineGroupInvite"); // ReadOfflineMsgs recieved messages only!!!
- capabilityNames.append("DispatchRegionInfo");
- capabilityNames.append("DirectDelivery");
- capabilityNames.append("EnvironmentSettings");
- capabilityNames.append("EstateAccess");
- capabilityNames.append("EstateChangeInfo");
- capabilityNames.append("EventQueueGet");
+ capabilityNames.append("AgentState");
+ capabilityNames.append("AttachmentResources");
+ capabilityNames.append("AvatarPickerSearch");
+ capabilityNames.append("AvatarRenderInfo");
+ capabilityNames.append("CharacterProperties");
+ capabilityNames.append("ChatSessionRequest");
+ capabilityNames.append("CopyInventoryFromNotecard");
+ capabilityNames.append("CreateInventoryCategory");
+ capabilityNames.append("DeclineFriendship");
+ capabilityNames.append("DeclineGroupInvite"); // ReadOfflineMsgs recieved messages only!!!
+ capabilityNames.append("DispatchRegionInfo");
+ capabilityNames.append("DirectDelivery");
+ capabilityNames.append("EnvironmentSettings");
+ capabilityNames.append("EstateAccess");
+ capabilityNames.append("EstateChangeInfo");
+ capabilityNames.append("EventQueueGet");
capabilityNames.append("ExtEnvironment");
- capabilityNames.append("FetchLib2");
- capabilityNames.append("FetchLibDescendents2");
- capabilityNames.append("FetchInventory2");
- capabilityNames.append("FetchInventoryDescendents2");
- capabilityNames.append("IncrementCOFVersion");
- AISAPI::getCapNames(capabilityNames);
+ capabilityNames.append("FetchLib2");
+ capabilityNames.append("FetchLibDescendents2");
+ capabilityNames.append("FetchInventory2");
+ capabilityNames.append("FetchInventoryDescendents2");
+ capabilityNames.append("IncrementCOFVersion");
+ AISAPI::getCapNames(capabilityNames);
- capabilityNames.append("InterestList");
+ capabilityNames.append("InterestList");
capabilityNames.append("InventoryThumbnailUpload");
- capabilityNames.append("GetDisplayNames");
- capabilityNames.append("GetExperiences");
- capabilityNames.append("AgentExperiences");
- capabilityNames.append("FindExperienceByName");
- capabilityNames.append("GetExperienceInfo");
- capabilityNames.append("GetAdminExperiences");
- capabilityNames.append("GetCreatorExperiences");
- capabilityNames.append("ExperiencePreferences");
- capabilityNames.append("GroupExperiences");
- capabilityNames.append("UpdateExperience");
- capabilityNames.append("IsExperienceAdmin");
- capabilityNames.append("IsExperienceContributor");
- capabilityNames.append("RegionExperiences");
+ capabilityNames.append("GetDisplayNames");
+ capabilityNames.append("GetExperiences");
+ capabilityNames.append("AgentExperiences");
+ capabilityNames.append("FindExperienceByName");
+ capabilityNames.append("GetExperienceInfo");
+ capabilityNames.append("GetAdminExperiences");
+ capabilityNames.append("GetCreatorExperiences");
+ capabilityNames.append("ExperiencePreferences");
+ capabilityNames.append("GroupExperiences");
+ capabilityNames.append("UpdateExperience");
+ capabilityNames.append("IsExperienceAdmin");
+ capabilityNames.append("IsExperienceContributor");
+ capabilityNames.append("RegionExperiences");
capabilityNames.append("ExperienceQuery");
- capabilityNames.append("GetMetadata");
- capabilityNames.append("GetObjectCost");
- capabilityNames.append("GetObjectPhysicsData");
- capabilityNames.append("GroupAPIv1");
- capabilityNames.append("GroupMemberData");
- capabilityNames.append("GroupProposalBallot");
- capabilityNames.append("HomeLocation");
- capabilityNames.append("LandResources");
- capabilityNames.append("LSLSyntax");
- capabilityNames.append("MapLayer");
- capabilityNames.append("MapLayerGod");
- capabilityNames.append("MeshUploadFlag");
- capabilityNames.append("ModifyMaterialParams");
- capabilityNames.append("NavMeshGenerationStatus");
- capabilityNames.append("NewFileAgentInventory");
- capabilityNames.append("ObjectAnimation");
- capabilityNames.append("ObjectMedia");
- capabilityNames.append("ObjectMediaNavigate");
- capabilityNames.append("ObjectNavMeshProperties");
- capabilityNames.append("ParcelPropertiesUpdate");
- capabilityNames.append("ParcelVoiceInfoRequest");
- capabilityNames.append("ProductInfoRequest");
- capabilityNames.append("ProvisionVoiceAccountRequest");
- capabilityNames.append("ReadOfflineMsgs"); // Requires to respond reliably: AcceptFriendship, AcceptGroupInvite, DeclineFriendship, DeclineGroupInvite
- capabilityNames.append("RegionObjects");
- capabilityNames.append("RemoteParcelRequest");
- capabilityNames.append("RenderMaterials");
- capabilityNames.append("RequestTextureDownload");
- capabilityNames.append("ResourceCostSelected");
- capabilityNames.append("RetrieveNavMeshSrc");
- capabilityNames.append("SearchStatRequest");
- capabilityNames.append("SearchStatTracking");
- capabilityNames.append("SendPostcard");
- capabilityNames.append("SendUserReport");
- capabilityNames.append("SendUserReportWithScreenshot");
- capabilityNames.append("ServerReleaseNotes");
- capabilityNames.append("SetDisplayName");
- capabilityNames.append("SimConsoleAsync");
- capabilityNames.append("SimulatorFeatures");
- capabilityNames.append("StartGroupProposal");
- capabilityNames.append("TerrainNavMeshProperties");
- capabilityNames.append("TextureStats");
- capabilityNames.append("UntrustedSimulatorMessage");
- capabilityNames.append("UpdateAgentInformation");
- capabilityNames.append("UpdateAgentLanguage");
- capabilityNames.append("UpdateAvatarAppearance");
- capabilityNames.append("UpdateGestureAgentInventory");
- capabilityNames.append("UpdateGestureTaskInventory");
- capabilityNames.append("UpdateNotecardAgentInventory");
- capabilityNames.append("UpdateNotecardTaskInventory");
- capabilityNames.append("UpdateScriptAgent");
- capabilityNames.append("UpdateScriptTask");
+ capabilityNames.append("GetMetadata");
+ capabilityNames.append("GetObjectCost");
+ capabilityNames.append("GetObjectPhysicsData");
+ capabilityNames.append("GroupAPIv1");
+ capabilityNames.append("GroupMemberData");
+ capabilityNames.append("GroupProposalBallot");
+ capabilityNames.append("HomeLocation");
+ capabilityNames.append("LandResources");
+ capabilityNames.append("LSLSyntax");
+ capabilityNames.append("MapLayer");
+ capabilityNames.append("MapLayerGod");
+ capabilityNames.append("MeshUploadFlag");
+ capabilityNames.append("ModifyMaterialParams");
+ capabilityNames.append("NavMeshGenerationStatus");
+ capabilityNames.append("NewFileAgentInventory");
+ capabilityNames.append("ObjectAnimation");
+ capabilityNames.append("ObjectMedia");
+ capabilityNames.append("ObjectMediaNavigate");
+ capabilityNames.append("ObjectNavMeshProperties");
+ capabilityNames.append("ParcelPropertiesUpdate");
+ capabilityNames.append("ParcelVoiceInfoRequest");
+ capabilityNames.append("ProductInfoRequest");
+ capabilityNames.append("ProvisionVoiceAccountRequest");
+ capabilityNames.append("ReadOfflineMsgs"); // Requires to respond reliably: AcceptFriendship, AcceptGroupInvite, DeclineFriendship, DeclineGroupInvite
+ capabilityNames.append("RegionObjects");
+ capabilityNames.append("RemoteParcelRequest");
+ capabilityNames.append("RenderMaterials");
+ capabilityNames.append("RequestTextureDownload");
+ capabilityNames.append("ResourceCostSelected");
+ capabilityNames.append("RetrieveNavMeshSrc");
+ capabilityNames.append("SearchStatRequest");
+ capabilityNames.append("SearchStatTracking");
+ capabilityNames.append("SendPostcard");
+ capabilityNames.append("SendUserReport");
+ capabilityNames.append("SendUserReportWithScreenshot");
+ capabilityNames.append("ServerReleaseNotes");
+ capabilityNames.append("SetDisplayName");
+ capabilityNames.append("SimConsoleAsync");
+ capabilityNames.append("SimulatorFeatures");
+ capabilityNames.append("StartGroupProposal");
+ capabilityNames.append("TerrainNavMeshProperties");
+ capabilityNames.append("TextureStats");
+ capabilityNames.append("UntrustedSimulatorMessage");
+ capabilityNames.append("UpdateAgentInformation");
+ capabilityNames.append("UpdateAgentLanguage");
+ capabilityNames.append("UpdateAvatarAppearance");
+ capabilityNames.append("UpdateGestureAgentInventory");
+ capabilityNames.append("UpdateGestureTaskInventory");
+ capabilityNames.append("UpdateNotecardAgentInventory");
+ capabilityNames.append("UpdateNotecardTaskInventory");
+ capabilityNames.append("UpdateScriptAgent");
+ capabilityNames.append("UpdateScriptTask");
capabilityNames.append("UpdateSettingsAgentInventory");
capabilityNames.append("UpdateSettingsTaskInventory");
capabilityNames.append("UploadAgentProfileImage");
capabilityNames.append("UpdateMaterialAgentInventory");
capabilityNames.append("UpdateMaterialTaskInventory");
- capabilityNames.append("UploadBakedTexture");
+ capabilityNames.append("UploadBakedTexture");
capabilityNames.append("UserInfo");
- capabilityNames.append("ViewerAsset");
- capabilityNames.append("ViewerBenefits");
- capabilityNames.append("ViewerMetrics");
- capabilityNames.append("ViewerStartAuction");
- capabilityNames.append("ViewerStats");
+ capabilityNames.append("ViewerAsset");
+ capabilityNames.append("ViewerBenefits");
+ capabilityNames.append("ViewerMetrics");
+ capabilityNames.append("ViewerStartAuction");
+ capabilityNames.append("ViewerStats");
- // Please add new capabilities alphabetically to reduce
- // merge conflicts.
+ // Please add new capabilities alphabetically to reduce
+ // merge conflicts.
}
void LLViewerRegion::setSeedCapability(const std::string& url)
{
- if (getCapability("Seed") == url)
- {
- setCapabilityDebug("Seed", url);
- LL_WARNS("CrossingCaps") << "Received duplicate seed capability for " << getRegionID() << ", posting to seed " <<
- url << LL_ENDL;
+ if (getCapability("Seed") == url)
+ {
+ setCapabilityDebug("Seed", url);
+ LL_WARNS("CrossingCaps") << "Received duplicate seed capability for " << getRegionID() << ", posting to seed " <<
+ url << LL_ENDL;
- //Instead of just returning we build up a second set of seed caps and compare them
- //to the "original" seed cap received and determine why there is problem!
+ //Instead of just returning we build up a second set of seed caps and compare them
+ //to the "original" seed cap received and determine why there is problem!
std::string coroname =
LLCoros::instance().launch("LLEnvironmentRequest::requestBaseCapabilitiesCompleteCoro",
boost::bind(&LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro, getHandle()));
@@ -3209,14 +3209,14 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
// Make sure we are still good to do
LLCoros::checkStop();
- return;
+ return;
}
-
- delete mImpl->mEventPoll;
- mImpl->mEventPoll = NULL;
-
- mImpl->mCapabilities.clear();
- setCapability("Seed", url);
+
+ delete mImpl->mEventPoll;
+ mImpl->mEventPoll = NULL;
+
+ mImpl->mCapabilities.clear();
+ setCapability("Seed", url);
std::string coroname =
LLCoros::instance().launch("LLViewerRegionImpl::requestBaseCapabilitiesCoro",
@@ -3232,69 +3232,69 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
S32 LLViewerRegion::getNumSeedCapRetries()
{
- return mImpl->mSeedCapAttempts;
+ return mImpl->mSeedCapAttempts;
}
void LLViewerRegion::setCapability(const std::string& name, const std::string& url)
{
- if(name == "EventQueueGet")
- {
- delete mImpl->mEventPoll;
- mImpl->mEventPoll = NULL;
- mImpl->mEventPoll = new LLEventPoll(url, getHost());
- }
- else if(name == "UntrustedSimulatorMessage")
- {
+ if(name == "EventQueueGet")
+ {
+ delete mImpl->mEventPoll;
+ mImpl->mEventPoll = NULL;
+ mImpl->mEventPoll = new LLEventPoll(url, getHost());
+ }
+ else if(name == "UntrustedSimulatorMessage")
+ {
mImpl->mHost.setUntrustedSimulatorCap(url);
- }
- else if (name == "SimulatorFeatures")
- {
+ }
+ else if (name == "SimulatorFeatures")
+ {
mImpl->mCapabilities["SimulatorFeatures"] = url;
requestSimulatorFeatures();
- }
- else
- {
- mImpl->mCapabilities[name] = url;
- if(name == "ViewerAsset")
- {
- /*==============================================================*/
- // The following inserted lines are a hack for testing MAINT-7081,
- // which is why the indentation and formatting are left ugly.
- const char* VIEWERASSET = getenv("VIEWERASSET");
- if (VIEWERASSET)
- {
- mImpl->mCapabilities[name] = VIEWERASSET;
- mViewerAssetUrl = VIEWERASSET;
- }
- else
- /*==============================================================*/
- mViewerAssetUrl = url;
- }
- }
+ }
+ else
+ {
+ mImpl->mCapabilities[name] = url;
+ if(name == "ViewerAsset")
+ {
+ /*==============================================================*/
+ // The following inserted lines are a hack for testing MAINT-7081,
+ // which is why the indentation and formatting are left ugly.
+ const char* VIEWERASSET = getenv("VIEWERASSET");
+ if (VIEWERASSET)
+ {
+ mImpl->mCapabilities[name] = VIEWERASSET;
+ mViewerAssetUrl = VIEWERASSET;
+ }
+ else
+ /*==============================================================*/
+ mViewerAssetUrl = url;
+ }
+ }
}
void LLViewerRegion::setCapabilityDebug(const std::string& name, const std::string& url)
{
- // Continue to not add certain caps, as we do in setCapability. This is so they match up when we check them later.
- if ( ! ( name == "EventQueueGet" || name == "UntrustedSimulatorMessage" || name == "SimulatorFeatures" ) )
- {
- mImpl->mSecondCapabilitiesTracker[name] = url;
- if(name == "ViewerAsset")
- {
- /*==============================================================*/
- // The following inserted lines are a hack for testing MAINT-7081,
- // which is why the indentation and formatting are left ugly.
- const char* VIEWERASSET = getenv("VIEWERASSET");
- if (VIEWERASSET)
- {
- mImpl->mSecondCapabilitiesTracker[name] = VIEWERASSET;
- mViewerAssetUrl = VIEWERASSET;
- }
- else
- /*==============================================================*/
- mViewerAssetUrl = url;
- }
- }
+ // Continue to not add certain caps, as we do in setCapability. This is so they match up when we check them later.
+ if ( ! ( name == "EventQueueGet" || name == "UntrustedSimulatorMessage" || name == "SimulatorFeatures" ) )
+ {
+ mImpl->mSecondCapabilitiesTracker[name] = url;
+ if(name == "ViewerAsset")
+ {
+ /*==============================================================*/
+ // The following inserted lines are a hack for testing MAINT-7081,
+ // which is why the indentation and formatting are left ugly.
+ const char* VIEWERASSET = getenv("VIEWERASSET");
+ if (VIEWERASSET)
+ {
+ mImpl->mSecondCapabilitiesTracker[name] = VIEWERASSET;
+ mViewerAssetUrl = VIEWERASSET;
+ }
+ else
+ /*==============================================================*/
+ mViewerAssetUrl = url;
+ }
+ }
}
std::string LLViewerRegion::getCapabilityDebug(const std::string& name) const
@@ -3311,44 +3311,44 @@ std::string LLViewerRegion::getCapabilityDebug(const std::string& name) const
bool LLViewerRegion::isSpecialCapabilityName(const std::string &name)
{
- return name == "EventQueueGet" || name == "UntrustedSimulatorMessage";
+ return name == "EventQueueGet" || name == "UntrustedSimulatorMessage";
}
std::string LLViewerRegion::getCapability(const std::string& name) const
{
- if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia")))
- {
- LL_WARNS() << "getCapability called before caps received for " << name << LL_ENDL;
- }
-
- CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name);
- if(iter == mImpl->mCapabilities.end())
- {
- return "";
- }
+ if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia")))
+ {
+ LL_WARNS() << "getCapability called before caps received for " << name << LL_ENDL;
+ }
- return iter->second;
+ CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name);
+ if(iter == mImpl->mCapabilities.end())
+ {
+ return "";
+ }
+
+ return iter->second;
}
bool LLViewerRegion::isCapabilityAvailable(const std::string& name) const
{
- if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia")))
- {
- LL_WARNS() << "isCapabilityAvailable called before caps received for " << name << LL_ENDL;
- }
-
- CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name);
- if(iter == mImpl->mCapabilities.end())
- {
- return false;
- }
+ if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia")))
+ {
+ LL_WARNS() << "isCapabilityAvailable called before caps received for " << name << LL_ENDL;
+ }
+
+ CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name);
+ if(iter == mImpl->mCapabilities.end())
+ {
+ return false;
+ }
- return true;
+ return true;
}
bool LLViewerRegion::capabilitiesReceived() const
{
- return mCapabilitiesState == CAPABILITIES_STATE_RECEIVED;
+ return mCapabilitiesState == CAPABILITIES_STATE_RECEIVED;
}
bool LLViewerRegion::capabilitiesError() const
@@ -3358,22 +3358,22 @@ bool LLViewerRegion::capabilitiesError() const
void LLViewerRegion::setCapabilitiesReceived(bool received)
{
- mCapabilitiesState = received ? CAPABILITIES_STATE_RECEIVED : CAPABILITIES_STATE_INIT;
+ mCapabilitiesState = received ? CAPABILITIES_STATE_RECEIVED : CAPABILITIES_STATE_INIT;
- // Tell interested parties that we've received capabilities,
- // so that they can safely use getCapability().
- if (received)
- {
- mCapabilitiesReceivedSignal(getRegionID(), this);
+ // Tell interested parties that we've received capabilities,
+ // so that they can safely use getCapability().
+ if (received)
+ {
+ mCapabilitiesReceivedSignal(getRegionID(), this);
- LLFloaterPermsDefault::sendInitialPerms();
+ LLFloaterPermsDefault::sendInitialPerms();
- // This is a single-shot signal. Forget callbacks to save resources.
- mCapabilitiesReceivedSignal.disconnect_all_slots();
+ // This is a single-shot signal. Forget callbacks to save resources.
+ mCapabilitiesReceivedSignal.disconnect_all_slots();
- // Set the region to the desired interest list mode
+ // Set the region to the desired interest list mode
setInterestListMode(gAgent.getInterestListMode());
- }
+ }
}
void LLViewerRegion::setCapabilitiesError()
@@ -3383,12 +3383,12 @@ void LLViewerRegion::setCapabilitiesError()
boost::signals2::connection LLViewerRegion::setCapabilitiesReceivedCallback(const caps_received_signal_t::slot_type& cb)
{
- return mCapabilitiesReceivedSignal.connect(cb);
+ return mCapabilitiesReceivedSignal.connect(cb);
}
void LLViewerRegion::logActiveCapabilities() const
{
- log_capabilities(mImpl->mCapabilities);
+ log_capabilities(mImpl->mCapabilities);
}
@@ -3399,7 +3399,7 @@ bool LLViewerRegion::requestPostCapability(const std::string &capName, LLSD &pos
if (url.empty())
{
LL_WARNS("Region") << "Could not retrieve region " << getRegionID()
- << " POST capability \"" << capName << "\"" << LL_ENDL;
+ << " POST capability \"" << capName << "\"" << LL_ENDL;
return false;
}
@@ -3446,14 +3446,14 @@ void LLViewerRegion::setInterestListMode(const std::string &new_mode)
{
mInterestListMode = new_mode;
- if (mInterestListMode != std::string(IL_MODE_DEFAULT) && mInterestListMode != std::string(IL_MODE_360))
- {
- LL_WARNS("360Capture") << "Region " << getRegionID() << " setInterestListMode() invalid interest list mode: "
- << mInterestListMode << ", setting to default" << LL_ENDL;
+ if (mInterestListMode != std::string(IL_MODE_DEFAULT) && mInterestListMode != std::string(IL_MODE_360))
+ {
+ LL_WARNS("360Capture") << "Region " << getRegionID() << " setInterestListMode() invalid interest list mode: "
+ << mInterestListMode << ", setting to default" << LL_ENDL;
mInterestListMode = IL_MODE_DEFAULT;
- }
+ }
- LLSD body;
+ LLSD body;
body["mode"] = mInterestListMode;
if (requestPostCapability("InterestList", body,
[](const LLSD &response) {
@@ -3467,99 +3467,99 @@ void LLViewerRegion::setInterestListMode(const std::string &new_mode)
}
else
{
- LL_WARNS("360Capture") << "Region " << getRegionID()
- << " Unable to post an InterestList capability request with payload: \n"
+ LL_WARNS("360Capture") << "Region " << getRegionID()
+ << " Unable to post an InterestList capability request with payload: \n"
<< ll_pretty_print_sd(body) << LL_ENDL;
}
}
else
{
LL_DEBUGS("360Capture") << "Region " << getRegionID() << "No change, skipping Interest List mode POST to "
- << new_mode << " mode" << LL_ENDL;
+ << new_mode << " mode" << LL_ENDL;
}
}
void LLViewerRegion::resetInterestList()
{
- if (requestDelCapability("InterestList", [](const LLSD &response) {
- LL_DEBUGS("360Capture") << "InterestList capability DEL responded: \n" << ll_pretty_print_sd(response) << LL_ENDL;
- }))
- {
- LL_DEBUGS("360Capture") << "Region " << getRegionID() << " Successfully reset InterestList capability" << LL_ENDL;
- }
- else
- {
- LL_WARNS("360Capture") << "Region " << getRegionID() << " Unable to DEL InterestList capability request" << LL_ENDL;
- }
+ if (requestDelCapability("InterestList", [](const LLSD &response) {
+ LL_DEBUGS("360Capture") << "InterestList capability DEL responded: \n" << ll_pretty_print_sd(response) << LL_ENDL;
+ }))
+ {
+ LL_DEBUGS("360Capture") << "Region " << getRegionID() << " Successfully reset InterestList capability" << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("360Capture") << "Region " << getRegionID() << " Unable to DEL InterestList capability request" << LL_ENDL;
+ }
}
LLSpatialPartition *LLViewerRegion::getSpatialPartition(U32 type)
{
- if (type < mImpl->mObjectPartition.size() && type < PARTITION_VO_CACHE)
- {
- return (LLSpatialPartition*)mImpl->mObjectPartition[type];
- }
- return NULL;
+ if (type < mImpl->mObjectPartition.size() && type < PARTITION_VO_CACHE)
+ {
+ return (LLSpatialPartition*)mImpl->mObjectPartition[type];
+ }
+ return NULL;
}
LLVOCachePartition* LLViewerRegion::getVOCachePartition()
{
- if(PARTITION_VO_CACHE < mImpl->mObjectPartition.size())
- {
- return (LLVOCachePartition*)mImpl->mObjectPartition[PARTITION_VO_CACHE];
- }
- return NULL;
+ if(PARTITION_VO_CACHE < mImpl->mObjectPartition.size())
+ {
+ return (LLVOCachePartition*)mImpl->mObjectPartition[PARTITION_VO_CACHE];
+ }
+ return NULL;
}
// the viewer can not yet distinquish between normal- and estate-owned objects
// so we collapse these two bits and enable the UI if either are set
const U64 ALLOW_RETURN_ENCROACHING_OBJECT = REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT
- | REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT;
+ | REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT;
bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const
{
- return (mParcelOverlay != NULL)
- && (mParcelOverlay->isOwnedSelf(pos)
- || mParcelOverlay->isOwnedGroup(pos)
- || (getRegionFlag(ALLOW_RETURN_ENCROACHING_OBJECT)
- && mParcelOverlay->encroachesOwned(boxes)) );
+ return (mParcelOverlay != NULL)
+ && (mParcelOverlay->isOwnedSelf(pos)
+ || mParcelOverlay->isOwnedGroup(pos)
+ || (getRegionFlag(ALLOW_RETURN_ENCROACHING_OBJECT)
+ && mParcelOverlay->encroachesOwned(boxes)) );
}
bool LLViewerRegion::childrenObjectReturnable( const std::vector<LLBBox>& boxes ) const
{
- bool result = false;
- result = ( mParcelOverlay && mParcelOverlay->encroachesOnUnowned( boxes ) ) ? 1 : 0;
- return result;
+ bool result = false;
+ result = ( mParcelOverlay && mParcelOverlay->encroachesOnUnowned( boxes ) ) ? 1 : 0;
+ return result;
}
bool LLViewerRegion::objectsCrossParcel(const std::vector<LLBBox>& boxes) const
{
- return mParcelOverlay && mParcelOverlay->encroachesOnNearbyParcel(boxes);
+ return mParcelOverlay && mParcelOverlay->encroachesOnNearbyParcel(boxes);
}
void LLViewerRegion::getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions )
{
- mImpl->mLandp->getNeighboringRegions( uniqueRegions );
+ mImpl->mLandp->getNeighboringRegions( uniqueRegions );
}
void LLViewerRegion::getNeighboringRegionsStatus( std::vector<S32>& regions )
{
- mImpl->mLandp->getNeighboringRegionsStatus( regions );
+ mImpl->mLandp->getNeighboringRegionsStatus( regions );
}
void LLViewerRegion::showReleaseNotes()
{
- std::string url = this->getCapability("ServerReleaseNotes");
+ std::string url = this->getCapability("ServerReleaseNotes");
- if (url.empty()) {
- // HACK haven't received the capability yet, we'll wait until
- // it arives.
- mReleaseNotesRequested = TRUE;
- return;
- }
+ if (url.empty()) {
+ // HACK haven't received the capability yet, we'll wait until
+ // it arives.
+ mReleaseNotesRequested = TRUE;
+ return;
+ }
- LLWeb::loadURL(url);
- mReleaseNotesRequested = FALSE;
+ LLWeb::loadURL(url);
+ mReleaseNotesRequested = FALSE;
}
std::string LLViewerRegion::getDescription() const
@@ -3569,98 +3569,98 @@ std::string LLViewerRegion::getDescription() const
bool LLViewerRegion::meshUploadEnabled() const
{
- return (mSimulatorFeatures.has("MeshUploadEnabled") &&
- mSimulatorFeatures["MeshUploadEnabled"].asBoolean());
+ return (mSimulatorFeatures.has("MeshUploadEnabled") &&
+ mSimulatorFeatures["MeshUploadEnabled"].asBoolean());
}
bool LLViewerRegion::bakesOnMeshEnabled() const
{
- return (mSimulatorFeatures.has("BakesOnMeshEnabled") &&
- mSimulatorFeatures["BakesOnMeshEnabled"].asBoolean());
+ return (mSimulatorFeatures.has("BakesOnMeshEnabled") &&
+ mSimulatorFeatures["BakesOnMeshEnabled"].asBoolean());
}
bool LLViewerRegion::meshRezEnabled() const
{
- return (mSimulatorFeatures.has("MeshRezEnabled") &&
- mSimulatorFeatures["MeshRezEnabled"].asBoolean());
+ return (mSimulatorFeatures.has("MeshRezEnabled") &&
+ mSimulatorFeatures["MeshRezEnabled"].asBoolean());
}
bool LLViewerRegion::dynamicPathfindingEnabled() const
{
- return ( mSimulatorFeatures.has("DynamicPathfindingEnabled") &&
- mSimulatorFeatures["DynamicPathfindingEnabled"].asBoolean());
+ return ( mSimulatorFeatures.has("DynamicPathfindingEnabled") &&
+ mSimulatorFeatures["DynamicPathfindingEnabled"].asBoolean());
}
bool LLViewerRegion::avatarHoverHeightEnabled() const
{
- return ( mSimulatorFeatures.has("AvatarHoverHeightEnabled") &&
- mSimulatorFeatures["AvatarHoverHeightEnabled"].asBoolean());
+ return ( mSimulatorFeatures.has("AvatarHoverHeightEnabled") &&
+ mSimulatorFeatures["AvatarHoverHeightEnabled"].asBoolean());
}
/* Static Functions */
void log_capabilities(const CapabilityMap &capmap)
{
- S32 count = 0;
- CapabilityMap::const_iterator iter;
- for (iter = capmap.begin(); iter != capmap.end(); ++iter, ++count)
- {
- if (!iter->second.empty())
- {
- LL_INFOS() << "log_capabilities: " << iter->first << " URL is " << iter->second << LL_ENDL;
- }
- }
- LL_INFOS() << "log_capabilities: Dumped " << count << " entries." << LL_ENDL;
+ S32 count = 0;
+ CapabilityMap::const_iterator iter;
+ for (iter = capmap.begin(); iter != capmap.end(); ++iter, ++count)
+ {
+ if (!iter->second.empty())
+ {
+ LL_INFOS() << "log_capabilities: " << iter->first << " URL is " << iter->second << LL_ENDL;
+ }
+ }
+ LL_INFOS() << "log_capabilities: Dumped " << count << " entries." << LL_ENDL;
}
void LLViewerRegion::resetMaterialsCapThrottle()
{
- F32 requests_per_sec = 1.0f; // original default;
- if ( mSimulatorFeatures.has("RenderMaterialsCapability")
- && mSimulatorFeatures["RenderMaterialsCapability"].isReal() )
- {
- requests_per_sec = mSimulatorFeatures["RenderMaterialsCapability"].asReal();
- if ( requests_per_sec == 0.0f )
- {
- requests_per_sec = 1.0f;
- LL_WARNS("Materials")
- << "region '" << getName()
- << "' returned zero for RenderMaterialsCapability; using default "
- << requests_per_sec << " per second"
- << LL_ENDL;
- }
- LL_DEBUGS("Materials") << "region '" << getName()
- << "' RenderMaterialsCapability " << requests_per_sec
- << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("Materials")
- << "region '" << getName()
- << "' did not return RenderMaterialsCapability, using default "
- << requests_per_sec << " per second"
- << LL_ENDL;
- }
-
- mMaterialsCapThrottleTimer.resetWithExpiry( 1.0f / requests_per_sec );
+ F32 requests_per_sec = 1.0f; // original default;
+ if ( mSimulatorFeatures.has("RenderMaterialsCapability")
+ && mSimulatorFeatures["RenderMaterialsCapability"].isReal() )
+ {
+ requests_per_sec = mSimulatorFeatures["RenderMaterialsCapability"].asReal();
+ if ( requests_per_sec == 0.0f )
+ {
+ requests_per_sec = 1.0f;
+ LL_WARNS("Materials")
+ << "region '" << getName()
+ << "' returned zero for RenderMaterialsCapability; using default "
+ << requests_per_sec << " per second"
+ << LL_ENDL;
+ }
+ LL_DEBUGS("Materials") << "region '" << getName()
+ << "' RenderMaterialsCapability " << requests_per_sec
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("Materials")
+ << "region '" << getName()
+ << "' did not return RenderMaterialsCapability, using default "
+ << requests_per_sec << " per second"
+ << LL_ENDL;
+ }
+
+ mMaterialsCapThrottleTimer.resetWithExpiry( 1.0f / requests_per_sec );
}
U32 LLViewerRegion::getMaxMaterialsPerTransaction() const
{
- U32 max_entries = 50; // original hard coded default
- if ( mSimulatorFeatures.has( "MaxMaterialsPerTransaction" )
- && mSimulatorFeatures[ "MaxMaterialsPerTransaction" ].isInteger())
- {
- max_entries = mSimulatorFeatures[ "MaxMaterialsPerTransaction" ].asInteger();
- }
- return max_entries;
+ U32 max_entries = 50; // original hard coded default
+ if ( mSimulatorFeatures.has( "MaxMaterialsPerTransaction" )
+ && mSimulatorFeatures[ "MaxMaterialsPerTransaction" ].isInteger())
+ {
+ max_entries = mSimulatorFeatures[ "MaxMaterialsPerTransaction" ].asInteger();
+ }
+ return max_entries;
}
std::string LLViewerRegion::getSimHostName()
{
- if (mSimulatorFeaturesReceived)
- {
- return mSimulatorFeatures.has("HostName") ? mSimulatorFeatures["HostName"].asString() : getHost().getHostName();
- }
- return std::string("...");
+ if (mSimulatorFeaturesReceived)
+ {
+ return mSimulatorFeatures.has("HostName") ? mSimulatorFeatures["HostName"].asString() : getHost().getHostName();
+ }
+ return std::string("...");
}
void LLViewerRegion::applyCacheMiscExtras(LLViewerObject* obj)
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 622490c881..08eda19b16 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerregion.h
* @brief Description of the LLViewerRegion class.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,14 +40,14 @@
#include "lluuid.h"
#include "llweb.h"
#include "llcapabilityprovider.h"
-#include "m4math.h" // LLMatrix4
+#include "m4math.h" // LLMatrix4
#include "llframetimer.h"
#include "llreflectionmap.h"
// Surface id's
#define LAND 1
#define WATER 2
-const U32 MAX_OBJECT_CACHE_ENTRIES = 50000;
+const U32 MAX_OBJECT_CACHE_ENTRIES = 50000;
// Region handshake flags
const U32 REGION_HANDSHAKE_SUPPORTS_SELF_APPEARANCE = 1U << 2;
@@ -77,211 +77,211 @@ class LLVOCachePartition;
class LLViewerRegion: public LLCapabilityProvider // implements this interface
{
public:
- //MUST MATCH THE ORDER OF DECLARATION IN CONSTRUCTOR
- typedef enum
- {
- PARTITION_HUD=0,
- PARTITION_TERRAIN,
- PARTITION_VOIDWATER,
- PARTITION_WATER,
- PARTITION_TREE,
- PARTITION_PARTICLE,
- PARTITION_GRASS,
- PARTITION_VOLUME,
- PARTITION_BRIDGE,
- PARTITION_AVATAR,
- PARTITION_CONTROL_AV, // Animesh
- PARTITION_HUD_PARTICLE,
- PARTITION_VO_CACHE,
- PARTITION_NONE,
- NUM_PARTITIONS
- } eObjectPartitions;
-
- typedef boost::signals2::signal<void(const LLUUID& region_id, LLViewerRegion* regionp)> caps_received_signal_t;
-
- LLViewerRegion(const U64 &handle,
- const LLHost &host,
- const U32 surface_grid_width,
- const U32 patch_grid_width,
- const F32 region_width_meters);
- ~LLViewerRegion();
-
- // Call this after you have the region name and handle.
- void loadObjectCache();
- void saveObjectCache();
-
- void sendMessage(); // Send the current message to this region's simulator
- void sendReliableMessage(); // Send the current message to this region's simulator
-
- void setOriginGlobal(const LLVector3d &origin);
- //void setAgentOffset(const LLVector3d &offset);
- void updateRenderMatrix();
-
- void setAllowDamage(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DAMAGE, b); }
- void setAllowLandmark(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_LANDMARK, b); }
- void setAllowSetHome(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_SET_HOME, b); }
- void setResetHomeOnTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_RESET_HOME_ON_TELEPORT, b); }
- void setSunFixed(BOOL b) { setRegionFlag(REGION_FLAGS_SUN_FIXED, b); }
- //void setBlockFly(BOOL b) { setRegionFlag(REGION_FLAGS_BLOCK_FLY, b); } Never used
- void setAllowDirectTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, b); }
-
-
- inline BOOL getAllowDamage() const;
- inline BOOL getAllowLandmark() const;
- inline BOOL getAllowSetHome() const;
- inline BOOL getResetHomeOnTeleport() const;
- inline BOOL getSunFixed() const;
- inline BOOL getBlockFly() const;
- inline BOOL getAllowDirectTeleport() const;
- inline BOOL isPrelude() const;
- inline BOOL getAllowTerraform() const;
- inline BOOL getRestrictPushObject() const;
+ //MUST MATCH THE ORDER OF DECLARATION IN CONSTRUCTOR
+ typedef enum
+ {
+ PARTITION_HUD=0,
+ PARTITION_TERRAIN,
+ PARTITION_VOIDWATER,
+ PARTITION_WATER,
+ PARTITION_TREE,
+ PARTITION_PARTICLE,
+ PARTITION_GRASS,
+ PARTITION_VOLUME,
+ PARTITION_BRIDGE,
+ PARTITION_AVATAR,
+ PARTITION_CONTROL_AV, // Animesh
+ PARTITION_HUD_PARTICLE,
+ PARTITION_VO_CACHE,
+ PARTITION_NONE,
+ NUM_PARTITIONS
+ } eObjectPartitions;
+
+ typedef boost::signals2::signal<void(const LLUUID& region_id, LLViewerRegion* regionp)> caps_received_signal_t;
+
+ LLViewerRegion(const U64 &handle,
+ const LLHost &host,
+ const U32 surface_grid_width,
+ const U32 patch_grid_width,
+ const F32 region_width_meters);
+ ~LLViewerRegion();
+
+ // Call this after you have the region name and handle.
+ void loadObjectCache();
+ void saveObjectCache();
+
+ void sendMessage(); // Send the current message to this region's simulator
+ void sendReliableMessage(); // Send the current message to this region's simulator
+
+ void setOriginGlobal(const LLVector3d &origin);
+ //void setAgentOffset(const LLVector3d &offset);
+ void updateRenderMatrix();
+
+ void setAllowDamage(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DAMAGE, b); }
+ void setAllowLandmark(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_LANDMARK, b); }
+ void setAllowSetHome(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_SET_HOME, b); }
+ void setResetHomeOnTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_RESET_HOME_ON_TELEPORT, b); }
+ void setSunFixed(BOOL b) { setRegionFlag(REGION_FLAGS_SUN_FIXED, b); }
+ //void setBlockFly(BOOL b) { setRegionFlag(REGION_FLAGS_BLOCK_FLY, b); } Never used
+ void setAllowDirectTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, b); }
+
+
+ inline BOOL getAllowDamage() const;
+ inline BOOL getAllowLandmark() const;
+ inline BOOL getAllowSetHome() const;
+ inline BOOL getResetHomeOnTeleport() const;
+ inline BOOL getSunFixed() const;
+ inline BOOL getBlockFly() const;
+ inline BOOL getAllowDirectTeleport() const;
+ inline BOOL isPrelude() const;
+ inline BOOL getAllowTerraform() const;
+ inline BOOL getRestrictPushObject() const;
inline BOOL getAllowEnvironmentOverride() const;
- inline BOOL getReleaseNotesRequested() const;
+ inline BOOL getReleaseNotesRequested() const;
- bool isAlive(); // can become false if circuit disconnects
+ bool isAlive(); // can become false if circuit disconnects
- void setWaterHeight(F32 water_level);
- F32 getWaterHeight() const;
+ void setWaterHeight(F32 water_level);
+ F32 getWaterHeight() const;
- BOOL isVoiceEnabled() const;
+ BOOL isVoiceEnabled() const;
- void setBillableFactor(F32 billable_factor) { mBillableFactor = billable_factor; }
- F32 getBillableFactor() const { return mBillableFactor; }
+ void setBillableFactor(F32 billable_factor) { mBillableFactor = billable_factor; }
+ F32 getBillableFactor() const { return mBillableFactor; }
- // Maximum number of primitives allowed, regardless of object
- // bonus factor.
- U32 getMaxTasks() const { return mMaxTasks; }
- void setMaxTasks(U32 max_tasks) { mMaxTasks = max_tasks; }
+ // Maximum number of primitives allowed, regardless of object
+ // bonus factor.
+ U32 getMaxTasks() const { return mMaxTasks; }
+ void setMaxTasks(U32 max_tasks) { mMaxTasks = max_tasks; }
- // Draw lines in the dirt showing ownership. Return number of
- // vertices drawn.
- S32 renderPropertyLines();
+ // Draw lines in the dirt showing ownership. Return number of
+ // vertices drawn.
+ S32 renderPropertyLines();
void renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32* parcel_outline_color);
- // Call this whenever you change the height data in the region.
- // (Automatically called by LLSurfacePatch's update routine)
- void dirtyHeights();
+ // Call this whenever you change the height data in the region.
+ // (Automatically called by LLSurfacePatch's update routine)
+ void dirtyHeights();
+
+ LLViewerParcelOverlay *getParcelOverlay() const
+ { return mParcelOverlay; }
+
+ inline void setRegionFlag(U64 flag, BOOL on);
+ inline BOOL getRegionFlag(U64 flag) const;
+ void setRegionFlags(U64 flags);
+ U64 getRegionFlags() const { return mRegionFlags; }
+
+ inline void setRegionProtocol(U64 protocol, BOOL on);
+ BOOL getRegionProtocol(U64 protocol) const;
+ void setRegionProtocols(U64 protocols) { mRegionProtocols = protocols; }
+ U64 getRegionProtocols() const { return mRegionProtocols; }
- LLViewerParcelOverlay *getParcelOverlay() const
- { return mParcelOverlay; }
+ void setTimeDilation(F32 time_dilation);
+ F32 getTimeDilation() const { return mTimeDilation; }
- inline void setRegionFlag(U64 flag, BOOL on);
- inline BOOL getRegionFlag(U64 flag) const;
- void setRegionFlags(U64 flags);
- U64 getRegionFlags() const { return mRegionFlags; }
+ // Origin height is at zero.
+ const LLVector3d &getOriginGlobal() const;
+ LLVector3 getOriginAgent() const;
- inline void setRegionProtocol(U64 protocol, BOOL on);
- BOOL getRegionProtocol(U64 protocol) const;
- void setRegionProtocols(U64 protocols) { mRegionProtocols = protocols; }
- U64 getRegionProtocols() const { return mRegionProtocols; }
+ // Center is at the height of the water table.
+ const LLVector3d &getCenterGlobal() const;
+ LLVector3 getCenterAgent() const;
- void setTimeDilation(F32 time_dilation);
- F32 getTimeDilation() const { return mTimeDilation; }
+ void setRegionNameAndZone(const std::string& name_and_zone);
+ const std::string& getName() const { return mName; }
+ const std::string& getZoning() const { return mZoning; }
- // Origin height is at zero.
- const LLVector3d &getOriginGlobal() const;
- LLVector3 getOriginAgent() const;
+ void setOwner(const LLUUID& owner_id);
+ const LLUUID& getOwner() const;
- // Center is at the height of the water table.
- const LLVector3d &getCenterGlobal() const;
- LLVector3 getCenterAgent() const;
+ // Is the current agent on the estate manager list for this region?
+ void setIsEstateManager(BOOL b) { mIsEstateManager = b; }
+ BOOL isEstateManager() const { return mIsEstateManager; }
+ BOOL canManageEstate() const;
- void setRegionNameAndZone(const std::string& name_and_zone);
- const std::string& getName() const { return mName; }
- const std::string& getZoning() const { return mZoning; }
+ void setSimAccess(U8 sim_access) { mSimAccess = sim_access; }
+ U8 getSimAccess() const { return mSimAccess; }
+ const std::string getSimAccessString() const;
- void setOwner(const LLUUID& owner_id);
- const LLUUID& getOwner() const;
+ // Homestead-related getters; there are no setters as nobody should be
+ // setting them other than the individual message handler which is a member
+ S32 getSimClassID() const { return mClassID; }
+ S32 getSimCPURatio() const { return mCPURatio; }
+ const std::string& getSimColoName() const { return mColoName; }
+ const std::string& getSimProductSKU() const { return mProductSKU; }
+ std::string getLocalizedSimProductName() const;
- // Is the current agent on the estate manager list for this region?
- void setIsEstateManager(BOOL b) { mIsEstateManager = b; }
- BOOL isEstateManager() const { return mIsEstateManager; }
- BOOL canManageEstate() const;
+ // Returns "Sandbox", "Expensive", etc.
+ static std::string regionFlagsToString(U64 flags);
- void setSimAccess(U8 sim_access) { mSimAccess = sim_access; }
- U8 getSimAccess() const { return mSimAccess; }
- const std::string getSimAccessString() const;
-
- // Homestead-related getters; there are no setters as nobody should be
- // setting them other than the individual message handler which is a member
- S32 getSimClassID() const { return mClassID; }
- S32 getSimCPURatio() const { return mCPURatio; }
- const std::string& getSimColoName() const { return mColoName; }
- const std::string& getSimProductSKU() const { return mProductSKU; }
- std::string getLocalizedSimProductName() const;
+ // Returns translated version of "Mature", "PG", "Adult", etc.
+ static std::string accessToString(U8 sim_access);
- // Returns "Sandbox", "Expensive", etc.
- static std::string regionFlagsToString(U64 flags);
+ // Returns "M", "PG", "A" etc.
+ static std::string accessToShortString(U8 sim_access);
+ static U8 shortStringToAccess(const std::string &sim_access);
- // Returns translated version of "Mature", "PG", "Adult", etc.
- static std::string accessToString(U8 sim_access);
+ // Return access icon name
+ static std::string getAccessIcon(U8 sim_access);
- // Returns "M", "PG", "A" etc.
- static std::string accessToShortString(U8 sim_access);
- static U8 shortStringToAccess(const std::string &sim_access);
+ // helper function which just makes sure all interested parties
+ // can process the message.
+ static void processRegionInfo(LLMessageSystem* msg, void**);
- // Return access icon name
- static std::string getAccessIcon(U8 sim_access);
-
- // helper function which just makes sure all interested parties
- // can process the message.
- static void processRegionInfo(LLMessageSystem* msg, void**);
+ //check if the viewer camera is static
+ static BOOL isViewerCameraStatic();
+ static void calcNewObjectCreationThrottle();
- //check if the viewer camera is static
- static BOOL isViewerCameraStatic();
- static void calcNewObjectCreationThrottle();
+ void setCacheID(const LLUUID& id);
- void setCacheID(const LLUUID& id);
+ F32 getWidth() const { return mWidth; }
- F32 getWidth() const { return mWidth; }
+ // regions are expensive to release, this function gradually releases cache from memory
+ static void idleCleanup(F32 max_update_time);
- // regions are expensive to release, this function gradually releases cache from memory
- static void idleCleanup(F32 max_update_time);
+ void idleUpdate(F32 max_update_time);
+ void lightIdleUpdate();
+ bool addVisibleGroup(LLViewerOctreeGroup* group);
+ void addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCacheEntry* child);
+ void addActiveCacheEntry(LLVOCacheEntry* entry);
+ void removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep);
+ void killCacheEntry(U32 local_id); //physically delete the cache entry
- void idleUpdate(F32 max_update_time);
- void lightIdleUpdate();
- bool addVisibleGroup(LLViewerOctreeGroup* group);
- void addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCacheEntry* child);
- void addActiveCacheEntry(LLVOCacheEntry* entry);
- void removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep);
- void killCacheEntry(U32 local_id); //physically delete the cache entry
+ // Like idleUpdate, but forces everything to complete regardless of
+ // how long it takes.
+ void forceUpdate();
- // Like idleUpdate, but forces everything to complete regardless of
- // how long it takes.
- void forceUpdate();
+ void connectNeighbor(LLViewerRegion *neighborp, U32 direction);
- void connectNeighbor(LLViewerRegion *neighborp, U32 direction);
+ void updateNetStats();
- void updateNetStats();
+ U32 getPacketsLost() const;
- U32 getPacketsLost() const;
+ S32 getHttpResponderID() const;
- S32 getHttpResponderID() const;
-
- // Get/set named capability URLs for this region.
- void setSeedCapability(const std::string& url);
- S32 getNumSeedCapRetries();
- void setCapability(const std::string& name, const std::string& url);
- void setCapabilityDebug(const std::string& name, const std::string& url);
- bool isCapabilityAvailable(const std::string& name) const;
- // implements LLCapabilityProvider
+ // Get/set named capability URLs for this region.
+ void setSeedCapability(const std::string& url);
+ S32 getNumSeedCapRetries();
+ void setCapability(const std::string& name, const std::string& url);
+ void setCapabilityDebug(const std::string& name, const std::string& url);
+ bool isCapabilityAvailable(const std::string& name) const;
+ // implements LLCapabilityProvider
virtual std::string getCapability(const std::string& name) const;
std::string getCapabilityDebug(const std::string& name) const;
- // has region received its final (not seed) capability list?
- bool capabilitiesReceived() const;
+ // has region received its final (not seed) capability list?
+ bool capabilitiesReceived() const;
bool capabilitiesError() const;
- void setCapabilitiesReceived(bool received);
- void setCapabilitiesError();
- boost::signals2::connection setCapabilitiesReceivedCallback(const caps_received_signal_t::slot_type& cb);
+ void setCapabilitiesReceived(bool received);
+ void setCapabilitiesError();
+ boost::signals2::connection setCapabilitiesReceivedCallback(const caps_received_signal_t::slot_type& cb);
- static bool isSpecialCapabilityName(const std::string &name);
- void logActiveCapabilities() const;
+ static bool isSpecialCapabilityName(const std::string &name);
+ void logActiveCapabilities() const;
- // Utilities to post and get via
+ // Utilities to post and get via
// HTTP using the agent's policy settings and headers.
typedef LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t httpCallback_t;
bool requestPostCapability(const std::string &capName,
@@ -292,278 +292,278 @@ public:
bool requestDelCapability(const std::string &capName, httpCallback_t cbSuccess = NULL, httpCallback_t cbFailure = NULL);
/// implements LLCapabilityProvider
- /*virtual*/ const LLHost& getHost() const;
- const U64 &getHandle() const { return mHandle; }
+ /*virtual*/ const LLHost& getHost() const;
+ const U64 &getHandle() const { return mHandle; }
- LLSurface &getLand() const;
+ LLSurface &getLand() const;
- // set and get the region id
- const LLUUID& getRegionID() const;
- void setRegionID(const LLUUID& region_id);
+ // set and get the region id
+ const LLUUID& getRegionID() const;
+ void setRegionID(const LLUUID& region_id);
- BOOL pointInRegionGlobal(const LLVector3d &point_global) const;
- LLVector3 getPosRegionFromGlobal(const LLVector3d &point_global) const;
- LLVector3 getPosRegionFromAgent(const LLVector3 &agent_pos) const;
- LLVector3 getPosAgentFromRegion(const LLVector3 &region_pos) const;
- LLVector3d getPosGlobalFromRegion(const LLVector3 &offset) const;
+ BOOL pointInRegionGlobal(const LLVector3d &point_global) const;
+ LLVector3 getPosRegionFromGlobal(const LLVector3d &point_global) const;
+ LLVector3 getPosRegionFromAgent(const LLVector3 &agent_pos) const;
+ LLVector3 getPosAgentFromRegion(const LLVector3 &region_pos) const;
+ LLVector3d getPosGlobalFromRegion(const LLVector3 &offset) const;
- LLVLComposition *getComposition() const;
- F32 getCompositionXY(const S32 x, const S32 y) const;
+ LLVLComposition *getComposition() const;
+ F32 getCompositionXY(const S32 x, const S32 y) const;
- BOOL isOwnedSelf(const LLVector3& pos);
+ BOOL isOwnedSelf(const LLVector3& pos);
- // Owned by a group you belong to? (officer OR member)
- BOOL isOwnedGroup(const LLVector3& pos);
+ // Owned by a group you belong to? (officer OR member)
+ BOOL isOwnedGroup(const LLVector3& pos);
- // deal with map object updates in the world.
- void updateCoarseLocations(LLMessageSystem* msg);
+ // deal with map object updates in the world.
+ void updateCoarseLocations(LLMessageSystem* msg);
- F32 getLandHeightRegion(const LLVector3& region_pos);
+ F32 getLandHeightRegion(const LLVector3& region_pos);
- U8 getCentralBakeVersion() { return mCentralBakeVersion; }
+ U8 getCentralBakeVersion() { return mCentralBakeVersion; }
- void getInfo(LLSD& info);
-
- bool meshRezEnabled() const;
- bool meshUploadEnabled() const;
+ void getInfo(LLSD& info);
- bool bakesOnMeshEnabled() const;
+ bool meshRezEnabled() const;
+ bool meshUploadEnabled() const;
- // has region received its simulator features list? Requires an additional query after caps received.
+ bool bakesOnMeshEnabled() const;
+
+ // has region received its simulator features list? Requires an additional query after caps received.
void requestSimulatorFeatures();
- void setSimulatorFeaturesReceived(bool);
- bool simulatorFeaturesReceived() const;
- boost::signals2::connection setSimulatorFeaturesReceivedCallback(const caps_received_signal_t::slot_type& cb);
-
- void getSimulatorFeatures(LLSD& info) const;
- void setSimulatorFeatures(const LLSD& info);
-
-
- bool dynamicPathfindingEnabled() const;
-
- bool avatarHoverHeightEnabled() const;
-
- typedef enum
- {
- CACHE_MISS_TYPE_TOTAL = 0, // total cache miss - object not in cache
- CACHE_MISS_TYPE_CRC, // object in cache, but CRC doesn't match
- CACHE_MISS_TYPE_NONE // not a miss: cache hit
- } eCacheMissType;
-
- typedef enum
- {
- CACHE_UPDATE_DUPE = 0,
- CACHE_UPDATE_CHANGED,
- CACHE_UPDATE_ADDED,
- CACHE_UPDATE_REPLACED
- } eCacheUpdateResult;
-
- // handle a full update message
- eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags);
- eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp, U32 flags);
+ void setSimulatorFeaturesReceived(bool);
+ bool simulatorFeaturesReceived() const;
+ boost::signals2::connection setSimulatorFeaturesReceivedCallback(const caps_received_signal_t::slot_type& cb);
+
+ void getSimulatorFeatures(LLSD& info) const;
+ void setSimulatorFeatures(const LLSD& info);
+
+
+ bool dynamicPathfindingEnabled() const;
+
+ bool avatarHoverHeightEnabled() const;
+
+ typedef enum
+ {
+ CACHE_MISS_TYPE_TOTAL = 0, // total cache miss - object not in cache
+ CACHE_MISS_TYPE_CRC, // object in cache, but CRC doesn't match
+ CACHE_MISS_TYPE_NONE // not a miss: cache hit
+ } eCacheMissType;
+
+ typedef enum
+ {
+ CACHE_UPDATE_DUPE = 0,
+ CACHE_UPDATE_CHANGED,
+ CACHE_UPDATE_ADDED,
+ CACHE_UPDATE_REPLACED
+ } eCacheUpdateResult;
+
+ // handle a full update message
+ eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags);
+ eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp, U32 flags);
void cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data);
- LLVOCacheEntry* getCacheEntryForOctree(U32 local_id);
- LLVOCacheEntry* getCacheEntry(U32 local_id, bool valid = true);
- bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type);
- U64 getRegionCacheHitCount() { return mRegionCacheHitCount; }
- U64 getRegionCacheMissCount() { return mRegionCacheMissCount; }
- void requestCacheMisses();
- void addCacheMissFull(const U32 local_id);
- //update object cache if the object receives a full-update or terse update
- LLViewerObject* updateCacheEntry(U32 local_id, LLViewerObject* objectp);
- void findOrphans(U32 parent_id);
- void clearCachedVisibleObjects();
- void dumpCache();
-
- void unpackRegionHandshake();
-
- void calculateCenterGlobal();
- void calculateCameraDistance();
-
- friend std::ostream& operator<<(std::ostream &s, const LLViewerRegion &region);
+ LLVOCacheEntry* getCacheEntryForOctree(U32 local_id);
+ LLVOCacheEntry* getCacheEntry(U32 local_id, bool valid = true);
+ bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type);
+ U64 getRegionCacheHitCount() { return mRegionCacheHitCount; }
+ U64 getRegionCacheMissCount() { return mRegionCacheMissCount; }
+ void requestCacheMisses();
+ void addCacheMissFull(const U32 local_id);
+ //update object cache if the object receives a full-update or terse update
+ LLViewerObject* updateCacheEntry(U32 local_id, LLViewerObject* objectp);
+ void findOrphans(U32 parent_id);
+ void clearCachedVisibleObjects();
+ void dumpCache();
+
+ void unpackRegionHandshake();
+
+ void calculateCenterGlobal();
+ void calculateCameraDistance();
+
+ friend std::ostream& operator<<(std::ostream &s, const LLViewerRegion &region);
/// implements LLCapabilityProvider
virtual std::string getDescription() const;
std::string getViewerAssetUrl() const { return mViewerAssetUrl; }
- U32 getNumOfVisibleGroups() const;
- U32 getNumOfActiveCachedObjects() const;
- LLSpatialPartition* getSpatialPartition(U32 type);
- LLVOCachePartition* getVOCachePartition();
+ U32 getNumOfVisibleGroups() const;
+ U32 getNumOfActiveCachedObjects() const;
+ LLSpatialPartition* getSpatialPartition(U32 type);
+ LLVOCachePartition* getVOCachePartition();
- bool objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const;
- bool childrenObjectReturnable( const std::vector<LLBBox>& boxes ) const;
- bool objectsCrossParcel(const std::vector<LLBBox>& boxes) const;
+ bool objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const;
+ bool childrenObjectReturnable( const std::vector<LLBBox>& boxes ) const;
+ bool objectsCrossParcel(const std::vector<LLBBox>& boxes) const;
- void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions );
- void getNeighboringRegionsStatus( std::vector<S32>& regions );
- const LLViewerRegionImpl * getRegionImpl() const { return mImpl; }
- LLViewerRegionImpl * getRegionImplNC() { return mImpl; }
+ void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions );
+ void getNeighboringRegionsStatus( std::vector<S32>& regions );
+ const LLViewerRegionImpl * getRegionImpl() const { return mImpl; }
+ LLViewerRegionImpl * getRegionImplNC() { return mImpl; }
- // implements the materials capability throttle
- bool materialsCapThrottled() const { return !mMaterialsCapThrottleTimer.hasExpired(); }
- void resetMaterialsCapThrottle();
-
- U32 getMaxMaterialsPerTransaction() const;
+ // implements the materials capability throttle
+ bool materialsCapThrottled() const { return !mMaterialsCapThrottleTimer.hasExpired(); }
+ void resetMaterialsCapThrottle();
- void removeFromCreatedList(U32 local_id);
- void addToCreatedList(U32 local_id);
+ U32 getMaxMaterialsPerTransaction() const;
- BOOL isPaused() const {return mPaused;}
- S32 getLastUpdate() const {return mLastUpdate;}
+ void removeFromCreatedList(U32 local_id);
+ void addToCreatedList(U32 local_id);
- std::string getSimHostName();
+ BOOL isPaused() const {return mPaused;}
+ S32 getLastUpdate() const {return mLastUpdate;}
- static BOOL isNewObjectCreationThrottleDisabled() {return sNewObjectCreationThrottle < 0;}
+ std::string getSimHostName();
+
+ static BOOL isNewObjectCreationThrottleDisabled() {return sNewObjectCreationThrottle < 0;}
// rebuild reflection probe list
void updateReflectionProbes();
private:
- void addToVOCacheTree(LLVOCacheEntry* entry);
- LLViewerObject* addNewObject(LLVOCacheEntry* entry);
- void killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list); //adds entry into list if it is safe to move into cache
- void removeFromVOCacheTree(LLVOCacheEntry* entry);
- void killCacheEntry(LLVOCacheEntry* entry, bool for_rendering = false); //physically delete the cache entry
- void killInvisibleObjects(F32 max_time);
- void createVisibleObjects(F32 max_time);
- void updateVisibleEntries(F32 max_time); //update visible entries
-
- void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type);
- void decodeBoundingInfo(LLVOCacheEntry* entry);
- bool isNonCacheableObjectCreated(U32 local_id);
+ void addToVOCacheTree(LLVOCacheEntry* entry);
+ LLViewerObject* addNewObject(LLVOCacheEntry* entry);
+ void killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list); //adds entry into list if it is safe to move into cache
+ void removeFromVOCacheTree(LLVOCacheEntry* entry);
+ void killCacheEntry(LLVOCacheEntry* entry, bool for_rendering = false); //physically delete the cache entry
+ void killInvisibleObjects(F32 max_time);
+ void createVisibleObjects(F32 max_time);
+ void updateVisibleEntries(F32 max_time); //update visible entries
+
+ void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type);
+ void decodeBoundingInfo(LLVOCacheEntry* entry);
+ bool isNonCacheableObjectCreated(U32 local_id);
public:
void applyCacheMiscExtras(LLViewerObject* obj);
- struct CompareDistance
- {
- bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs)
- {
- return lhs->mCameraDistanceSquared < rhs->mCameraDistanceSquared;
- }
- };
+ struct CompareDistance
+ {
+ bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs)
+ {
+ return lhs->mCameraDistanceSquared < rhs->mCameraDistanceSquared;
+ }
+ };
- void showReleaseNotes();
+ void showReleaseNotes();
protected:
- void disconnectAllNeighbors();
- void initStats();
+ void disconnectAllNeighbors();
+ void initStats();
public:
- LLWind mWind;
- LLViewerParcelOverlay *mParcelOverlay;
-
- F32Bits mBitsReceived;
- F32 mPacketsReceived;
-
- LLMatrix4 mRenderMatrix;
-
- // These arrays are maintained in parallel. Ideally they'd be combined into a
- // single array of an aggrigate data type but for compatibility with the old
- // messaging system in which the previous message only sends and parses the
- // positions stored in the first array so they're maintained separately until
- // we stop supporting the old CoarseLocationUpdate message.
- std::vector<U32> mMapAvatars;
- std::vector<LLUUID> mMapAvatarIDs;
-
- static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not.
- static S32 sLastCameraUpdated;
-
- LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; };
- LLFrameTimer & getRenderInfoReportTimer() { return mRenderInfoReportTimer; };
-
- struct CompareRegionByLastUpdate
- {
- bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs) const
- {
- S32 lpa = lhs->getLastUpdate();
- S32 rpa = rhs->getLastUpdate();
-
- //small mLastUpdate first
- if(lpa < rpa)
- {
- return true;
- }
- else if(lpa > rpa)
- {
- return false;
- }
- else
- {
- return lhs < rhs;
- }
- }
- };
- typedef std::set<LLViewerRegion*, CompareRegionByLastUpdate> region_priority_list_t;
-
- void setInterestListMode(const std::string & new_mode);
+ LLWind mWind;
+ LLViewerParcelOverlay *mParcelOverlay;
+
+ F32Bits mBitsReceived;
+ F32 mPacketsReceived;
+
+ LLMatrix4 mRenderMatrix;
+
+ // These arrays are maintained in parallel. Ideally they'd be combined into a
+ // single array of an aggrigate data type but for compatibility with the old
+ // messaging system in which the previous message only sends and parses the
+ // positions stored in the first array so they're maintained separately until
+ // we stop supporting the old CoarseLocationUpdate message.
+ std::vector<U32> mMapAvatars;
+ std::vector<LLUUID> mMapAvatarIDs;
+
+ static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not.
+ static S32 sLastCameraUpdated;
+
+ LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; };
+ LLFrameTimer & getRenderInfoReportTimer() { return mRenderInfoReportTimer; };
+
+ struct CompareRegionByLastUpdate
+ {
+ bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs) const
+ {
+ S32 lpa = lhs->getLastUpdate();
+ S32 rpa = rhs->getLastUpdate();
+
+ //small mLastUpdate first
+ if(lpa < rpa)
+ {
+ return true;
+ }
+ else if(lpa > rpa)
+ {
+ return false;
+ }
+ else
+ {
+ return lhs < rhs;
+ }
+ }
+ };
+ typedef std::set<LLViewerRegion*, CompareRegionByLastUpdate> region_priority_list_t;
+
+ void setInterestListMode(const std::string & new_mode);
const std::string & getInterestListMode() const { return mInterestListMode; }
- void resetInterestList();
+ void resetInterestList();
- static const std::string IL_MODE_DEFAULT;
+ static const std::string IL_MODE_DEFAULT;
static const std::string IL_MODE_360;
private:
- static S32 sNewObjectCreationThrottle;
- LLViewerRegionImpl * mImpl;
- LLFrameTimer mRegionTimer;
-
- F32 mWidth; // Width of region on a side (meters)
- U64 mHandle;
- F32 mTimeDilation; // time dilation of physics simulation on simulator
- S32 mLastUpdate; //last time called idleUpdate()
-
- // simulator name
- std::string mName;
- std::string mZoning;
-
- // Is this agent on the estate managers list for this region?
- BOOL mIsEstateManager;
-
- U32 mPacketsIn;
- U32Bits mBitsIn,
- mLastBitsIn;
- U32 mLastPacketsIn;
- U32 mPacketsOut;
- U32 mLastPacketsOut;
- S32 mPacketsLost;
- S32 mLastPacketsLost;
- U32Milliseconds mPingDelay;
- F32 mDeltaTime; // Time since last measurement of lastPackets, Bits, etc
-
- U64 mRegionFlags; // includes damage flags
- U64 mRegionProtocols; // protocols supported by this region
- U8 mSimAccess;
- F32 mBillableFactor;
- U32 mMaxTasks; // max prim count
- F32 mCameraDistanceSquared; // updated once per frame
- U8 mCentralBakeVersion;
-
- LLVOCacheEntry* mLastVisitedEntry;
- U32 mInvisibilityCheckHistory;
-
- // Information for Homestead / CR-53
- S32 mClassID;
- S32 mCPURatio;
-
- std::string mColoName;
- std::string mProductSKU;
- std::string mProductName;
- std::string mViewerAssetUrl ;
-
- // Maps local ids to cache entries.
- // Regions can have order 10,000 objects, so assume
- // a structure of size 2^14 = 16,000
- BOOL mCacheLoaded;
- BOOL mCacheDirty;
- BOOL mAlive; // can become false if circuit disconnects
- BOOL mSimulatorFeaturesReceived;
- BOOL mReleaseNotesRequested;
- BOOL mDead; //if true, this region is in the process of deleting.
- BOOL mPaused; //pause processing the objects in the region
+ static S32 sNewObjectCreationThrottle;
+ LLViewerRegionImpl * mImpl;
+ LLFrameTimer mRegionTimer;
+
+ F32 mWidth; // Width of region on a side (meters)
+ U64 mHandle;
+ F32 mTimeDilation; // time dilation of physics simulation on simulator
+ S32 mLastUpdate; //last time called idleUpdate()
+
+ // simulator name
+ std::string mName;
+ std::string mZoning;
+
+ // Is this agent on the estate managers list for this region?
+ BOOL mIsEstateManager;
+
+ U32 mPacketsIn;
+ U32Bits mBitsIn,
+ mLastBitsIn;
+ U32 mLastPacketsIn;
+ U32 mPacketsOut;
+ U32 mLastPacketsOut;
+ S32 mPacketsLost;
+ S32 mLastPacketsLost;
+ U32Milliseconds mPingDelay;
+ F32 mDeltaTime; // Time since last measurement of lastPackets, Bits, etc
+
+ U64 mRegionFlags; // includes damage flags
+ U64 mRegionProtocols; // protocols supported by this region
+ U8 mSimAccess;
+ F32 mBillableFactor;
+ U32 mMaxTasks; // max prim count
+ F32 mCameraDistanceSquared; // updated once per frame
+ U8 mCentralBakeVersion;
+
+ LLVOCacheEntry* mLastVisitedEntry;
+ U32 mInvisibilityCheckHistory;
+
+ // Information for Homestead / CR-53
+ S32 mClassID;
+ S32 mCPURatio;
+
+ std::string mColoName;
+ std::string mProductSKU;
+ std::string mProductName;
+ std::string mViewerAssetUrl ;
+
+ // Maps local ids to cache entries.
+ // Regions can have order 10,000 objects, so assume
+ // a structure of size 2^14 = 16,000
+ BOOL mCacheLoaded;
+ BOOL mCacheDirty;
+ BOOL mAlive; // can become false if circuit disconnects
+ BOOL mSimulatorFeaturesReceived;
+ BOOL mReleaseNotesRequested;
+ BOOL mDead; //if true, this region is in the process of deleting.
+ BOOL mPaused; //pause processing the objects in the region
typedef enum
{
@@ -572,39 +572,39 @@ public:
CAPABILITIES_STATE_RECEIVED
} eCababilitiesState;
- eCababilitiesState mCapabilitiesState;
+ eCababilitiesState mCapabilitiesState;
- typedef std::map<U32, std::vector<U32> > orphan_list_t;
- orphan_list_t mOrphanMap;
+ typedef std::map<U32, std::vector<U32> > orphan_list_t;
+ orphan_list_t mOrphanMap;
- class CacheMissItem
- {
- public:
+ class CacheMissItem
+ {
+ public:
CacheMissItem(U32 id, LLViewerRegion::eCacheMissType miss_type) : mID(id), mType(miss_type) {}
- U32 mID; //local object id
- LLViewerRegion::eCacheMissType mType; // cache miss type
+ U32 mID; //local object id
+ LLViewerRegion::eCacheMissType mType; // cache miss type
- typedef std::list<CacheMissItem> cache_miss_list_t;
- };
- CacheMissItem::cache_miss_list_t mCacheMissList;
- U64 mRegionCacheHitCount;
- U64 mRegionCacheMissCount;
+ typedef std::list<CacheMissItem> cache_miss_list_t;
+ };
+ CacheMissItem::cache_miss_list_t mCacheMissList;
+ U64 mRegionCacheHitCount;
+ U64 mRegionCacheMissCount;
- caps_received_signal_t mCapabilitiesReceivedSignal;
- caps_received_signal_t mSimulatorFeaturesReceivedSignal;
+ caps_received_signal_t mCapabilitiesReceivedSignal;
+ caps_received_signal_t mSimulatorFeaturesReceivedSignal;
- LLSD mSimulatorFeatures;
+ LLSD mSimulatorFeatures;
- typedef std::map<U32, LLPointer<LLVOCacheEntry> > vocache_entry_map_t;
+ typedef std::map<U32, LLPointer<LLVOCacheEntry> > vocache_entry_map_t;
static vocache_entry_map_t sRegionCacheCleanup;
- // the materials capability throttle
- LLFrameTimer mMaterialsCapThrottleTimer;
- LLFrameTimer mRenderInfoRequestTimer;
- LLFrameTimer mRenderInfoReportTimer;
+ // the materials capability throttle
+ LLFrameTimer mMaterialsCapThrottleTimer;
+ LLFrameTimer mRenderInfoRequestTimer;
+ LLFrameTimer mRenderInfoReportTimer;
- // how the server interest list works
+ // how the server interest list works
std::string mInterestListMode;
// list of reflection maps being managed by this llviewer region
@@ -614,86 +614,86 @@ public:
inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const
{
- return ((mRegionProtocols & protocol) != 0);
+ return ((mRegionProtocols & protocol) != 0);
}
inline void LLViewerRegion::setRegionProtocol(U64 protocol, BOOL on)
{
- if (on)
- {
- mRegionProtocols |= protocol;
- }
- else
- {
- mRegionProtocols &= ~protocol;
- }
+ if (on)
+ {
+ mRegionProtocols |= protocol;
+ }
+ else
+ {
+ mRegionProtocols &= ~protocol;
+ }
}
inline BOOL LLViewerRegion::getRegionFlag(U64 flag) const
{
- return ((mRegionFlags & flag) != 0);
+ return ((mRegionFlags & flag) != 0);
}
inline void LLViewerRegion::setRegionFlag(U64 flag, BOOL on)
{
- if (on)
- {
- mRegionFlags |= flag;
- }
- else
- {
- mRegionFlags &= ~flag;
- }
+ if (on)
+ {
+ mRegionFlags |= flag;
+ }
+ else
+ {
+ mRegionFlags &= ~flag;
+ }
}
inline BOOL LLViewerRegion::getAllowDamage() const
{
- return ((mRegionFlags & REGION_FLAGS_ALLOW_DAMAGE) !=0);
+ return ((mRegionFlags & REGION_FLAGS_ALLOW_DAMAGE) !=0);
}
inline BOOL LLViewerRegion::getAllowLandmark() const
{
- return ((mRegionFlags & REGION_FLAGS_ALLOW_LANDMARK) !=0);
+ return ((mRegionFlags & REGION_FLAGS_ALLOW_LANDMARK) !=0);
}
inline BOOL LLViewerRegion::getAllowSetHome() const
{
- return ((mRegionFlags & REGION_FLAGS_ALLOW_SET_HOME) != 0);
+ return ((mRegionFlags & REGION_FLAGS_ALLOW_SET_HOME) != 0);
}
inline BOOL LLViewerRegion::getResetHomeOnTeleport() const
{
- return ((mRegionFlags & REGION_FLAGS_RESET_HOME_ON_TELEPORT) !=0);
+ return ((mRegionFlags & REGION_FLAGS_RESET_HOME_ON_TELEPORT) !=0);
}
inline BOOL LLViewerRegion::getSunFixed() const
{
- return ((mRegionFlags & REGION_FLAGS_SUN_FIXED) !=0);
+ return ((mRegionFlags & REGION_FLAGS_SUN_FIXED) !=0);
}
inline BOOL LLViewerRegion::getBlockFly() const
{
- return ((mRegionFlags & REGION_FLAGS_BLOCK_FLY) !=0);
+ return ((mRegionFlags & REGION_FLAGS_BLOCK_FLY) !=0);
}
inline BOOL LLViewerRegion::getAllowDirectTeleport() const
{
- return ((mRegionFlags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT) !=0);
+ return ((mRegionFlags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT) !=0);
}
inline BOOL LLViewerRegion::isPrelude() const
{
- return is_prelude( mRegionFlags );
+ return is_prelude( mRegionFlags );
}
inline BOOL LLViewerRegion::getAllowTerraform() const
{
- return ((mRegionFlags & REGION_FLAGS_BLOCK_TERRAFORM) == 0);
+ return ((mRegionFlags & REGION_FLAGS_BLOCK_TERRAFORM) == 0);
}
inline BOOL LLViewerRegion::getRestrictPushObject() const
{
- return ((mRegionFlags & REGION_FLAGS_RESTRICT_PUSHOBJECT) != 0);
+ return ((mRegionFlags & REGION_FLAGS_RESTRICT_PUSHOBJECT) != 0);
}
inline BOOL LLViewerRegion::getAllowEnvironmentOverride() const
@@ -703,7 +703,7 @@ inline BOOL LLViewerRegion::getAllowEnvironmentOverride() const
inline BOOL LLViewerRegion::getReleaseNotesRequested() const
{
- return mReleaseNotesRequested;
+ return mReleaseNotesRequested;
}
#endif
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 2bab50300b..d1969a5675 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewershadermgr.cpp
* @brief Viewer shader manager implementation.
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -64,152 +64,152 @@ using std::pair;
using std::make_pair;
using std::string;
-BOOL LLViewerShaderMgr::sInitialized = FALSE;
-bool LLViewerShaderMgr::sSkipReload = false;
+BOOL LLViewerShaderMgr::sInitialized = FALSE;
+bool LLViewerShaderMgr::sSkipReload = false;
-LLVector4 gShinyOrigin;
+LLVector4 gShinyOrigin;
//utility shaders
-LLGLSLShader gOcclusionProgram;
+LLGLSLShader gOcclusionProgram;
LLGLSLShader gSkinnedOcclusionProgram;
-LLGLSLShader gOcclusionCubeProgram;
-LLGLSLShader gGlowCombineProgram;
-LLGLSLShader gReflectionMipProgram;
+LLGLSLShader gOcclusionCubeProgram;
+LLGLSLShader gGlowCombineProgram;
+LLGLSLShader gReflectionMipProgram;
LLGLSLShader gGaussianProgram;
-LLGLSLShader gRadianceGenProgram;
-LLGLSLShader gIrradianceGenProgram;
-LLGLSLShader gGlowCombineFXAAProgram;
-LLGLSLShader gTwoTextureCompareProgram;
-LLGLSLShader gOneTextureFilterProgram;
-LLGLSLShader gDebugProgram;
+LLGLSLShader gRadianceGenProgram;
+LLGLSLShader gIrradianceGenProgram;
+LLGLSLShader gGlowCombineFXAAProgram;
+LLGLSLShader gTwoTextureCompareProgram;
+LLGLSLShader gOneTextureFilterProgram;
+LLGLSLShader gDebugProgram;
LLGLSLShader gSkinnedDebugProgram;
-LLGLSLShader gClipProgram;
-LLGLSLShader gAlphaMaskProgram;
-LLGLSLShader gBenchmarkProgram;
+LLGLSLShader gClipProgram;
+LLGLSLShader gAlphaMaskProgram;
+LLGLSLShader gBenchmarkProgram;
LLGLSLShader gReflectionProbeDisplayProgram;
LLGLSLShader gCopyProgram;
LLGLSLShader gCopyDepthProgram;
//object shaders
-LLGLSLShader gObjectPreviewProgram;
+LLGLSLShader gObjectPreviewProgram;
LLGLSLShader gSkinnedObjectPreviewProgram;
LLGLSLShader gPhysicsPreviewProgram;
-LLGLSLShader gObjectFullbrightAlphaMaskProgram;
+LLGLSLShader gObjectFullbrightAlphaMaskProgram;
LLGLSLShader gSkinnedObjectFullbrightAlphaMaskProgram;
-LLGLSLShader gObjectBumpProgram;
+LLGLSLShader gObjectBumpProgram;
LLGLSLShader gSkinnedObjectBumpProgram;
-LLGLSLShader gObjectAlphaMaskNoColorProgram;
+LLGLSLShader gObjectAlphaMaskNoColorProgram;
//environment shaders
-LLGLSLShader gWaterProgram;
+LLGLSLShader gWaterProgram;
LLGLSLShader gWaterEdgeProgram;
-LLGLSLShader gUnderWaterProgram;
+LLGLSLShader gUnderWaterProgram;
//interface shaders
-LLGLSLShader gHighlightProgram;
+LLGLSLShader gHighlightProgram;
LLGLSLShader gSkinnedHighlightProgram;
-LLGLSLShader gHighlightNormalProgram;
-LLGLSLShader gHighlightSpecularProgram;
+LLGLSLShader gHighlightNormalProgram;
+LLGLSLShader gHighlightSpecularProgram;
-LLGLSLShader gDeferredHighlightProgram;
+LLGLSLShader gDeferredHighlightProgram;
-LLGLSLShader gPathfindingProgram;
-LLGLSLShader gPathfindingNoNormalsProgram;
+LLGLSLShader gPathfindingProgram;
+LLGLSLShader gPathfindingNoNormalsProgram;
//avatar shader handles
-LLGLSLShader gAvatarProgram;
-LLGLSLShader gAvatarEyeballProgram;
-LLGLSLShader gImpostorProgram;
+LLGLSLShader gAvatarProgram;
+LLGLSLShader gAvatarEyeballProgram;
+LLGLSLShader gImpostorProgram;
// Effects Shaders
-LLGLSLShader gGlowProgram;
-LLGLSLShader gGlowExtractProgram;
-LLGLSLShader gPostScreenSpaceReflectionProgram;
+LLGLSLShader gGlowProgram;
+LLGLSLShader gGlowExtractProgram;
+LLGLSLShader gPostScreenSpaceReflectionProgram;
// Deferred rendering shaders
-LLGLSLShader gDeferredImpostorProgram;
-LLGLSLShader gDeferredDiffuseProgram;
-LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
+LLGLSLShader gDeferredImpostorProgram;
+LLGLSLShader gDeferredDiffuseProgram;
+LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
LLGLSLShader gDeferredSkinnedDiffuseAlphaMaskProgram;
-LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
-LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
-LLGLSLShader gDeferredSkinnedDiffuseProgram;
-LLGLSLShader gDeferredSkinnedBumpProgram;
-LLGLSLShader gDeferredBumpProgram;
-LLGLSLShader gDeferredTerrainProgram;
-LLGLSLShader gDeferredTreeProgram;
-LLGLSLShader gDeferredTreeShadowProgram;
+LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
+LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
+LLGLSLShader gDeferredSkinnedDiffuseProgram;
+LLGLSLShader gDeferredSkinnedBumpProgram;
+LLGLSLShader gDeferredBumpProgram;
+LLGLSLShader gDeferredTerrainProgram;
+LLGLSLShader gDeferredTreeProgram;
+LLGLSLShader gDeferredTreeShadowProgram;
LLGLSLShader gDeferredSkinnedTreeShadowProgram;
-LLGLSLShader gDeferredAvatarProgram;
-LLGLSLShader gDeferredAvatarAlphaProgram;
-LLGLSLShader gDeferredLightProgram;
-LLGLSLShader gDeferredMultiLightProgram[16];
-LLGLSLShader gDeferredSpotLightProgram;
-LLGLSLShader gDeferredMultiSpotLightProgram;
-LLGLSLShader gDeferredSunProgram;
+LLGLSLShader gDeferredAvatarProgram;
+LLGLSLShader gDeferredAvatarAlphaProgram;
+LLGLSLShader gDeferredLightProgram;
+LLGLSLShader gDeferredMultiLightProgram[16];
+LLGLSLShader gDeferredSpotLightProgram;
+LLGLSLShader gDeferredMultiSpotLightProgram;
+LLGLSLShader gDeferredSunProgram;
LLGLSLShader gHazeProgram;
LLGLSLShader gHazeWaterProgram;
-LLGLSLShader gDeferredBlurLightProgram;
-LLGLSLShader gDeferredSoftenProgram;
-LLGLSLShader gDeferredShadowProgram;
+LLGLSLShader gDeferredBlurLightProgram;
+LLGLSLShader gDeferredSoftenProgram;
+LLGLSLShader gDeferredShadowProgram;
LLGLSLShader gDeferredSkinnedShadowProgram;
-LLGLSLShader gDeferredShadowCubeProgram;
-LLGLSLShader gDeferredShadowAlphaMaskProgram;
+LLGLSLShader gDeferredShadowCubeProgram;
+LLGLSLShader gDeferredShadowAlphaMaskProgram;
LLGLSLShader gDeferredSkinnedShadowAlphaMaskProgram;
-LLGLSLShader gDeferredShadowGLTFAlphaMaskProgram;
-LLGLSLShader gDeferredSkinnedShadowGLTFAlphaMaskProgram;
+LLGLSLShader gDeferredShadowGLTFAlphaMaskProgram;
+LLGLSLShader gDeferredSkinnedShadowGLTFAlphaMaskProgram;
LLGLSLShader gDeferredShadowGLTFAlphaBlendProgram;
LLGLSLShader gDeferredSkinnedShadowGLTFAlphaBlendProgram;
-LLGLSLShader gDeferredShadowFullbrightAlphaMaskProgram;
+LLGLSLShader gDeferredShadowFullbrightAlphaMaskProgram;
LLGLSLShader gDeferredSkinnedShadowFullbrightAlphaMaskProgram;
-LLGLSLShader gDeferredAvatarShadowProgram;
-LLGLSLShader gDeferredAvatarAlphaShadowProgram;
-LLGLSLShader gDeferredAvatarAlphaMaskShadowProgram;
-LLGLSLShader gDeferredAlphaProgram;
-LLGLSLShader gHUDAlphaProgram;
+LLGLSLShader gDeferredAvatarShadowProgram;
+LLGLSLShader gDeferredAvatarAlphaShadowProgram;
+LLGLSLShader gDeferredAvatarAlphaMaskShadowProgram;
+LLGLSLShader gDeferredAlphaProgram;
+LLGLSLShader gHUDAlphaProgram;
LLGLSLShader gDeferredSkinnedAlphaProgram;
-LLGLSLShader gDeferredAlphaImpostorProgram;
+LLGLSLShader gDeferredAlphaImpostorProgram;
LLGLSLShader gDeferredSkinnedAlphaImpostorProgram;
-LLGLSLShader gDeferredAvatarEyesProgram;
-LLGLSLShader gDeferredFullbrightProgram;
+LLGLSLShader gDeferredAvatarEyesProgram;
+LLGLSLShader gDeferredFullbrightProgram;
LLGLSLShader gHUDFullbrightProgram;
-LLGLSLShader gDeferredFullbrightAlphaMaskProgram;
-LLGLSLShader gHUDFullbrightAlphaMaskProgram;
-LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram;
-LLGLSLShader gHUDFullbrightAlphaMaskAlphaProgram;
-LLGLSLShader gDeferredEmissiveProgram;
+LLGLSLShader gDeferredFullbrightAlphaMaskProgram;
+LLGLSLShader gHUDFullbrightAlphaMaskProgram;
+LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram;
+LLGLSLShader gHUDFullbrightAlphaMaskAlphaProgram;
+LLGLSLShader gDeferredEmissiveProgram;
LLGLSLShader gDeferredSkinnedEmissiveProgram;
-LLGLSLShader gDeferredPostProgram;
-LLGLSLShader gDeferredCoFProgram;
-LLGLSLShader gDeferredDoFCombineProgram;
-LLGLSLShader gDeferredPostGammaCorrectProgram;
+LLGLSLShader gDeferredPostProgram;
+LLGLSLShader gDeferredCoFProgram;
+LLGLSLShader gDeferredDoFCombineProgram;
+LLGLSLShader gDeferredPostGammaCorrectProgram;
LLGLSLShader gNoPostGammaCorrectProgram;
LLGLSLShader gLegacyPostGammaCorrectProgram;
-LLGLSLShader gExposureProgram;
-LLGLSLShader gLuminanceProgram;
-LLGLSLShader gFXAAProgram;
-LLGLSLShader gDeferredPostNoDoFProgram;
-LLGLSLShader gDeferredWLSkyProgram;
-LLGLSLShader gDeferredWLCloudProgram;
-LLGLSLShader gDeferredWLSunProgram;
-LLGLSLShader gDeferredWLMoonProgram;
-LLGLSLShader gDeferredStarProgram;
-LLGLSLShader gDeferredFullbrightShinyProgram;
+LLGLSLShader gExposureProgram;
+LLGLSLShader gLuminanceProgram;
+LLGLSLShader gFXAAProgram;
+LLGLSLShader gDeferredPostNoDoFProgram;
+LLGLSLShader gDeferredWLSkyProgram;
+LLGLSLShader gDeferredWLCloudProgram;
+LLGLSLShader gDeferredWLSunProgram;
+LLGLSLShader gDeferredWLMoonProgram;
+LLGLSLShader gDeferredStarProgram;
+LLGLSLShader gDeferredFullbrightShinyProgram;
LLGLSLShader gHUDFullbrightShinyProgram;
LLGLSLShader gDeferredSkinnedFullbrightShinyProgram;
-LLGLSLShader gDeferredSkinnedFullbrightProgram;
+LLGLSLShader gDeferredSkinnedFullbrightProgram;
LLGLSLShader gDeferredSkinnedFullbrightAlphaMaskProgram;
LLGLSLShader gDeferredSkinnedFullbrightAlphaMaskAlphaProgram;
-LLGLSLShader gNormalMapGenProgram;
+LLGLSLShader gNormalMapGenProgram;
LLGLSLShader gDeferredGenBrdfLutProgram;
LLGLSLShader gDeferredBufferVisualProgram;
// Deferred materials shaders
-LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2];
-LLGLSLShader gHUDPBROpaqueProgram;
+LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2];
+LLGLSLShader gHUDPBROpaqueProgram;
LLGLSLShader gPBRGlowProgram;
LLGLSLShader gPBRGlowSkinnedProgram;
-LLGLSLShader gDeferredPBROpaqueProgram;
+LLGLSLShader gDeferredPBROpaqueProgram;
LLGLSLShader gDeferredSkinnedPBROpaqueProgram;
LLGLSLShader gHUDPBRAlphaProgram;
LLGLSLShader gDeferredPBRAlphaProgram;
@@ -232,48 +232,48 @@ bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader)
}
LLViewerShaderMgr::LLViewerShaderMgr() :
- mShaderLevel(SHADER_COUNT, 0),
- mMaxAvatarShaderLevel(0)
-{
+ mShaderLevel(SHADER_COUNT, 0),
+ mMaxAvatarShaderLevel(0)
+{
//ONLY shaders that need WL Param management should be added here
- mShaderList.push_back(&gAvatarProgram);
- mShaderList.push_back(&gWaterProgram);
- mShaderList.push_back(&gWaterEdgeProgram);
- mShaderList.push_back(&gAvatarEyeballProgram);
- mShaderList.push_back(&gImpostorProgram);
- mShaderList.push_back(&gObjectBumpProgram);
+ mShaderList.push_back(&gAvatarProgram);
+ mShaderList.push_back(&gWaterProgram);
+ mShaderList.push_back(&gWaterEdgeProgram);
+ mShaderList.push_back(&gAvatarEyeballProgram);
+ mShaderList.push_back(&gImpostorProgram);
+ mShaderList.push_back(&gObjectBumpProgram);
mShaderList.push_back(&gSkinnedObjectBumpProgram);
- mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram);
+ mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightAlphaMaskProgram);
- mShaderList.push_back(&gObjectAlphaMaskNoColorProgram);
- mShaderList.push_back(&gUnderWaterProgram);
- mShaderList.push_back(&gDeferredSunProgram);
+ mShaderList.push_back(&gObjectAlphaMaskNoColorProgram);
+ mShaderList.push_back(&gUnderWaterProgram);
+ mShaderList.push_back(&gDeferredSunProgram);
mShaderList.push_back(&gHazeProgram);
mShaderList.push_back(&gHazeWaterProgram);
- mShaderList.push_back(&gDeferredSoftenProgram);
- mShaderList.push_back(&gDeferredAlphaProgram);
+ mShaderList.push_back(&gDeferredSoftenProgram);
+ mShaderList.push_back(&gDeferredAlphaProgram);
mShaderList.push_back(&gHUDAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaProgram);
- mShaderList.push_back(&gDeferredAlphaImpostorProgram);
+ mShaderList.push_back(&gDeferredAlphaImpostorProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaImpostorProgram);
- mShaderList.push_back(&gDeferredFullbrightProgram);
+ mShaderList.push_back(&gDeferredFullbrightProgram);
mShaderList.push_back(&gHUDFullbrightProgram);
- mShaderList.push_back(&gDeferredFullbrightAlphaMaskProgram);
+ mShaderList.push_back(&gDeferredFullbrightAlphaMaskProgram);
mShaderList.push_back(&gHUDFullbrightAlphaMaskProgram);
mShaderList.push_back(&gDeferredFullbrightAlphaMaskAlphaProgram);
mShaderList.push_back(&gHUDFullbrightAlphaMaskAlphaProgram);
- mShaderList.push_back(&gDeferredFullbrightShinyProgram);
+ mShaderList.push_back(&gDeferredFullbrightShinyProgram);
mShaderList.push_back(&gHUDFullbrightShinyProgram);
mShaderList.push_back(&gDeferredSkinnedFullbrightShinyProgram);
- mShaderList.push_back(&gDeferredSkinnedFullbrightProgram);
+ mShaderList.push_back(&gDeferredSkinnedFullbrightProgram);
mShaderList.push_back(&gDeferredSkinnedFullbrightAlphaMaskProgram);
mShaderList.push_back(&gDeferredSkinnedFullbrightAlphaMaskAlphaProgram);
- mShaderList.push_back(&gDeferredEmissiveProgram);
+ mShaderList.push_back(&gDeferredEmissiveProgram);
mShaderList.push_back(&gDeferredSkinnedEmissiveProgram);
- mShaderList.push_back(&gDeferredAvatarEyesProgram);
+ mShaderList.push_back(&gDeferredAvatarEyesProgram);
mShaderList.push_back(&gDeferredAvatarAlphaProgram);
- mShaderList.push_back(&gDeferredWLSkyProgram);
- mShaderList.push_back(&gDeferredWLCloudProgram);
+ mShaderList.push_back(&gDeferredWLSkyProgram);
+ mShaderList.push_back(&gDeferredWLCloudProgram);
mShaderList.push_back(&gDeferredWLMoonProgram);
mShaderList.push_back(&gDeferredWLSunProgram);
mShaderList.push_back(&gDeferredPBRAlphaProgram);
@@ -287,46 +287,46 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
LLViewerShaderMgr::~LLViewerShaderMgr()
{
- mShaderLevel.clear();
- mShaderList.clear();
+ mShaderLevel.clear();
+ mShaderList.clear();
}
// static
LLViewerShaderMgr * LLViewerShaderMgr::instance()
{
- if(NULL == sInstance)
- {
- sInstance = new LLViewerShaderMgr();
- }
+ if(NULL == sInstance)
+ {
+ sInstance = new LLViewerShaderMgr();
+ }
- return static_cast<LLViewerShaderMgr*>(sInstance);
+ return static_cast<LLViewerShaderMgr*>(sInstance);
}
// static
void LLViewerShaderMgr::releaseInstance()
{
- if (sInstance != NULL)
- {
- delete sInstance;
- sInstance = NULL;
- }
+ if (sInstance != NULL)
+ {
+ delete sInstance;
+ sInstance = NULL;
+ }
}
void LLViewerShaderMgr::initAttribsAndUniforms(void)
{
- if (mReservedAttribs.empty())
- {
- LLShaderMgr::initAttribsAndUniforms();
- }
+ if (mReservedAttribs.empty())
+ {
+ LLShaderMgr::initAttribsAndUniforms();
+ }
}
-
+
//============================================================================
// Set Levels
S32 LLViewerShaderMgr::getShaderLevel(S32 type)
{
- return mShaderLevel[type];
+ return mShaderLevel[type];
}
//============================================================================
@@ -337,7 +337,7 @@ void LLViewerShaderMgr::setShaders()
LL_PROFILE_ZONE_SCOPED;
//setShaders might be called redundantly by gSavedSettings, so return on reentrance
static bool reentrance = false;
-
+
if (!gPipeline.mInitialized || !sInitialized || reentrance || sSkipReload)
{
return;
@@ -350,25 +350,25 @@ void LLViewerShaderMgr::setShaders()
return;
}
- {
- static LLCachedControl<bool> shader_cache_enabled(gSavedSettings, "RenderShaderCacheEnabled", true);
- static LLUUID old_cache_version;
- static LLUUID current_cache_version;
- if (current_cache_version.isNull())
- {
- HBXXH128 hash_obj;
- hash_obj.update(LLVersionInfo::instance().getVersion());
- current_cache_version = hash_obj.digest();
+ {
+ static LLCachedControl<bool> shader_cache_enabled(gSavedSettings, "RenderShaderCacheEnabled", true);
+ static LLUUID old_cache_version;
+ static LLUUID current_cache_version;
+ if (current_cache_version.isNull())
+ {
+ HBXXH128 hash_obj;
+ hash_obj.update(LLVersionInfo::instance().getVersion());
+ current_cache_version = hash_obj.digest();
- old_cache_version = LLUUID(gSavedSettings.getString("RenderShaderCacheVersion"));
- gSavedSettings.setString("RenderShaderCacheVersion", current_cache_version.asString());
- }
+ old_cache_version = LLUUID(gSavedSettings.getString("RenderShaderCacheVersion"));
+ gSavedSettings.setString("RenderShaderCacheVersion", current_cache_version.asString());
+ }
- initShaderCache(shader_cache_enabled, old_cache_version, current_cache_version);
- }
+ initShaderCache(shader_cache_enabled, old_cache_version, current_cache_version);
+ }
static LLCachedControl<U32> max_texture_index(gSavedSettings, "RenderMaxTextureIndex", 16);
-
+
// when using indexed texture rendering, leave some texture units available for shadow and reflection maps
LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits-12, (S32) max_texture_index), 1);
@@ -377,14 +377,14 @@ void LLViewerShaderMgr::setShaders()
// Make sure the compiled shader map is cleared before we recompile shaders.
mVertexShaderObjects.clear();
mFragmentShaderObjects.clear();
-
+
initAttribsAndUniforms();
gPipeline.releaseGLBuffers();
- unloadShaders();
+ unloadShaders();
+
+ LLPipeline::sRenderGlow = gSavedSettings.getBOOL("RenderGlow");
- LLPipeline::sRenderGlow = gSavedSettings.getBOOL("RenderGlow");
-
if (gViewerWindow)
{
gViewerWindow->setCursor(UI_CURSOR_WAIT);
@@ -404,7 +404,7 @@ void LLViewerShaderMgr::setShaders()
llassert((gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 10));
-
+
S32 light_class = 3;
S32 interface_class = 2;
S32 env_class = 2;
@@ -443,7 +443,7 @@ void LLViewerShaderMgr::setShaders()
loadBasicShaders();
LLError::setDefaultLevel(lvl);
LL_ERRS() << "Unable to load basic shader " << shader_name << ", verify graphics driver installed and current." << LL_ENDL;
- reentrance = false; // For hygiene only, re-try probably helps nothing
+ reentrance = false; // For hygiene only, re-try probably helps nothing
return;
}
@@ -499,7 +499,7 @@ void LLViewerShaderMgr::setShaders()
{ //hardware skinning is enabled and rigged attachment shaders loaded correctly
// cloth is a class3 shader
S32 avatar_class = 1;
-
+
// Set the actual level
mShaderLevel[SHADER_AVATAR] = avatar_class;
@@ -516,7 +516,7 @@ void LLViewerShaderMgr::setShaders()
loaded = loaded && loadShadersDeferred();
llassert(loaded);
- persistShaderCacheMetadata();
+ persistShaderCacheMetadata();
if (gViewerWindow)
{
@@ -529,76 +529,76 @@ void LLViewerShaderMgr::setShaders()
void LLViewerShaderMgr::unloadShaders()
{
- while (!LLGLSLShader::sInstances.empty())
- {
- LLGLSLShader* shader = *(LLGLSLShader::sInstances.begin());
- shader->unload();
- }
-
- mShaderLevel[SHADER_LIGHTING] = 0;
- mShaderLevel[SHADER_OBJECT] = 0;
- mShaderLevel[SHADER_AVATAR] = 0;
- mShaderLevel[SHADER_ENVIRONMENT] = 0;
- mShaderLevel[SHADER_WATER] = 0;
- mShaderLevel[SHADER_INTERFACE] = 0;
- mShaderLevel[SHADER_EFFECT] = 0;
- mShaderLevel[SHADER_WINDLIGHT] = 0;
-
- gPipeline.mShadersLoaded = false;
+ while (!LLGLSLShader::sInstances.empty())
+ {
+ LLGLSLShader* shader = *(LLGLSLShader::sInstances.begin());
+ shader->unload();
+ }
+
+ mShaderLevel[SHADER_LIGHTING] = 0;
+ mShaderLevel[SHADER_OBJECT] = 0;
+ mShaderLevel[SHADER_AVATAR] = 0;
+ mShaderLevel[SHADER_ENVIRONMENT] = 0;
+ mShaderLevel[SHADER_WATER] = 0;
+ mShaderLevel[SHADER_INTERFACE] = 0;
+ mShaderLevel[SHADER_EFFECT] = 0;
+ mShaderLevel[SHADER_WINDLIGHT] = 0;
+
+ gPipeline.mShadersLoaded = false;
}
std::string LLViewerShaderMgr::loadBasicShaders()
{
- // Load basic dependency shaders first
- // All of these have to load for any shaders to function
-
- S32 sum_lights_class = 3;
+ // Load basic dependency shaders first
+ // All of these have to load for any shaders to function
+
+ S32 sum_lights_class = 3;
#if LL_DARWIN
- // Work around driver crashes on older Macs when using deferred rendering
- // NORSPEC-59
- //
- if (gGLManager.mIsMobileGF)
- sum_lights_class = 3;
+ // Work around driver crashes on older Macs when using deferred rendering
+ // NORSPEC-59
+ //
+ if (gGLManager.mIsMobileGF)
+ sum_lights_class = 3;
#endif
- // Use the feature table to mask out the max light level to use. Also make sure it's at least 1.
- S32 max_light_class = gSavedSettings.getS32("RenderShaderLightingMaxLevel");
- sum_lights_class = llclamp(sum_lights_class, 1, max_light_class);
-
- // Load the Basic Vertex Shaders at the appropriate level.
- // (in order of shader function call depth for reference purposes, deepest level first)
-
- vector< pair<string, S32> > shaders;
- shaders.push_back( make_pair( "windlight/atmosphericsVarsV.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
- shaders.push_back( make_pair( "windlight/atmosphericsHelpersV.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
- shaders.push_back( make_pair( "lighting/lightFuncV.glsl", mShaderLevel[SHADER_LIGHTING] ) );
- shaders.push_back( make_pair( "lighting/sumLightsV.glsl", sum_lights_class ) );
- shaders.push_back( make_pair( "lighting/lightV.glsl", mShaderLevel[SHADER_LIGHTING] ) );
- shaders.push_back( make_pair( "lighting/lightFuncSpecularV.glsl", mShaderLevel[SHADER_LIGHTING] ) );
- shaders.push_back( make_pair( "lighting/sumLightsSpecularV.glsl", sum_lights_class ) );
- shaders.push_back( make_pair( "lighting/lightSpecularV.glsl", mShaderLevel[SHADER_LIGHTING] ) );
+ // Use the feature table to mask out the max light level to use. Also make sure it's at least 1.
+ S32 max_light_class = gSavedSettings.getS32("RenderShaderLightingMaxLevel");
+ sum_lights_class = llclamp(sum_lights_class, 1, max_light_class);
+
+ // Load the Basic Vertex Shaders at the appropriate level.
+ // (in order of shader function call depth for reference purposes, deepest level first)
+
+ vector< pair<string, S32> > shaders;
+ shaders.push_back( make_pair( "windlight/atmosphericsVarsV.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
+ shaders.push_back( make_pair( "windlight/atmosphericsHelpersV.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
+ shaders.push_back( make_pair( "lighting/lightFuncV.glsl", mShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/sumLightsV.glsl", sum_lights_class ) );
+ shaders.push_back( make_pair( "lighting/lightV.glsl", mShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/lightFuncSpecularV.glsl", mShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/sumLightsSpecularV.glsl", sum_lights_class ) );
+ shaders.push_back( make_pair( "lighting/lightSpecularV.glsl", mShaderLevel[SHADER_LIGHTING] ) );
shaders.push_back( make_pair( "windlight/atmosphericsFuncs.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
- shaders.push_back( make_pair( "windlight/atmosphericsV.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
+ shaders.push_back( make_pair( "windlight/atmosphericsV.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
shaders.push_back( make_pair( "environment/srgbF.glsl", 1 ) );
- shaders.push_back( make_pair( "avatar/avatarSkinV.glsl", 1 ) );
- shaders.push_back( make_pair( "avatar/objectSkinV.glsl", 1 ) );
+ shaders.push_back( make_pair( "avatar/avatarSkinV.glsl", 1 ) );
+ shaders.push_back( make_pair( "avatar/objectSkinV.glsl", 1 ) );
shaders.push_back( make_pair( "deferred/textureUtilV.glsl", 1 ) );
- if (gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)
- {
- shaders.push_back( make_pair( "objects/indexedTextureV.glsl", 1 ) );
- }
- shaders.push_back( make_pair( "objects/nonindexedTextureV.glsl", 1 ) );
+ if (gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)
+ {
+ shaders.push_back( make_pair( "objects/indexedTextureV.glsl", 1 ) );
+ }
+ shaders.push_back( make_pair( "objects/nonindexedTextureV.glsl", 1 ) );
- std::map<std::string, std::string> attribs;
- attribs["MAX_JOINTS_PER_MESH_OBJECT"] =
- std::to_string(LLSkinningUtil::getMaxJointCount());
+ std::map<std::string, std::string> attribs;
+ attribs["MAX_JOINTS_PER_MESH_OBJECT"] =
+ std::to_string(LLSkinningUtil::getMaxJointCount());
BOOL ssr = gSavedSettings.getBOOL("RenderScreenSpaceReflections");
- bool has_reflection_probes = gSavedSettings.getBOOL("RenderReflectionsEnabled") && gGLManager.mGLVersion > 3.99f;
+ bool has_reflection_probes = gSavedSettings.getBOOL("RenderReflectionsEnabled") && gGLManager.mGLVersion > 3.99f;
- S32 probe_level = llclamp(gSavedSettings.getS32("RenderReflectionProbeLevel"), 0, 3);
+ S32 probe_level = llclamp(gSavedSettings.getS32("RenderReflectionProbeLevel"), 0, 3);
S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail");
@@ -617,99 +617,99 @@ std::string LLViewerShaderMgr::loadBasicShaders()
attribs["SSR"] = "1";
}
- if (has_reflection_probes)
- {
+ if (has_reflection_probes)
+ {
attribs["REFMAP_LEVEL"] = std::to_string(probe_level);
- attribs["REF_SAMPLE_COUNT"] = "32";
- }
-
- LLGLSLShader::sGlobalDefines = attribs;
-
- // We no longer have to bind the shaders to global glhandles, they are automatically added to a map now.
- for (U32 i = 0; i < shaders.size(); i++)
- {
- // Note usage of GL_VERTEX_SHADER
- if (loadShaderFile(shaders[i].first, shaders[i].second, GL_VERTEX_SHADER, &attribs) == 0)
- {
- LL_WARNS("Shader") << "Failed to load vertex shader " << shaders[i].first << LL_ENDL;
- return shaders[i].first;
- }
- }
-
- // Load the Basic Fragment Shaders at the appropriate level.
- // (in order of shader function call depth for reference purposes, deepest level first)
-
- shaders.clear();
- S32 ch = 1;
-
- if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
- { //use indexed texture rendering for GLSL >= 1.30
- ch = llmax(LLGLSLShader::sIndexedTextureChannels, 1);
- }
-
-
- std::vector<S32> index_channels;
- index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsHelpersF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/gammaF.glsl", mShaderLevel[SHADER_WINDLIGHT]) );
+ attribs["REF_SAMPLE_COUNT"] = "32";
+ }
+
+ LLGLSLShader::sGlobalDefines = attribs;
+
+ // We no longer have to bind the shaders to global glhandles, they are automatically added to a map now.
+ for (U32 i = 0; i < shaders.size(); i++)
+ {
+ // Note usage of GL_VERTEX_SHADER
+ if (loadShaderFile(shaders[i].first, shaders[i].second, GL_VERTEX_SHADER, &attribs) == 0)
+ {
+ LL_WARNS("Shader") << "Failed to load vertex shader " << shaders[i].first << LL_ENDL;
+ return shaders[i].first;
+ }
+ }
+
+ // Load the Basic Fragment Shaders at the appropriate level.
+ // (in order of shader function call depth for reference purposes, deepest level first)
+
+ shaders.clear();
+ S32 ch = 1;
+
+ if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
+ { //use indexed texture rendering for GLSL >= 1.30
+ ch = llmax(LLGLSLShader::sIndexedTextureChannels, 1);
+ }
+
+
+ std::vector<S32> index_channels;
+ index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsHelpersF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/gammaF.glsl", mShaderLevel[SHADER_WINDLIGHT]) );
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsFuncs.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mShaderLevel[SHADER_WATER] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "environment/encodeNormF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "environment/srgbF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/deferredUtil.glsl", 1) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/shadowUtil.glsl", 1) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/aoUtil.glsl", 1) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mShaderLevel[SHADER_WATER] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "environment/encodeNormF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "environment/srgbF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/deferredUtil.glsl", 1) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/shadowUtil.glsl", 1) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/aoUtil.glsl", 1) );
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/reflectionProbeF.glsl", has_reflection_probes ? 3 : 2) );
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/screenSpaceReflUtil.glsl", ssr ? 3 : 1) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightAlphaMaskNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
- index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
- index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
-
- for (U32 i = 0; i < shaders.size(); i++)
- {
- // Note usage of GL_FRAGMENT_SHADER
- if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER, &attribs, index_channels[i]) == 0)
- {
- LL_WARNS("Shader") << "Failed to load fragment shader " << shaders[i].first << LL_ENDL;
- return shaders[i].first;
- }
- }
-
- return std::string();
+ index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightAlphaMaskNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightAlphaMaskF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
+
+ for (U32 i = 0; i < shaders.size(); i++)
+ {
+ // Note usage of GL_FRAGMENT_SHADER
+ if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER, &attribs, index_channels[i]) == 0)
+ {
+ LL_WARNS("Shader") << "Failed to load fragment shader " << shaders[i].first << LL_ENDL;
+ return shaders[i].first;
+ }
+ }
+
+ return std::string();
}
BOOL LLViewerShaderMgr::loadShadersWater()
{
LL_PROFILE_ZONE_SCOPED;
- BOOL success = TRUE;
- BOOL terrainWaterSuccess = TRUE;
-
+ BOOL success = TRUE;
+ BOOL terrainWaterSuccess = TRUE;
+
bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 &&
gSavedSettings.getS32("RenderShadowDetail") > 0;
- if (mShaderLevel[SHADER_WATER] == 0)
- {
- gWaterProgram.unload();
- gWaterEdgeProgram.unload();
- gUnderWaterProgram.unload();
- return TRUE;
- }
-
- if (success)
- {
- // load water shader
- gWaterProgram.mName = "Water Shader";
- gWaterProgram.mFeatures.calculatesAtmospherics = true;
+ if (mShaderLevel[SHADER_WATER] == 0)
+ {
+ gWaterProgram.unload();
+ gWaterEdgeProgram.unload();
+ gUnderWaterProgram.unload();
+ return TRUE;
+ }
+
+ if (success)
+ {
+ // load water shader
+ gWaterProgram.mName = "Water Shader";
+ gWaterProgram.mFeatures.calculatesAtmospherics = true;
gWaterProgram.mFeatures.hasAtmospherics = true;
- gWaterProgram.mFeatures.hasGamma = true;
- gWaterProgram.mFeatures.hasSrgb = true;
+ gWaterProgram.mFeatures.hasGamma = true;
+ gWaterProgram.mFeatures.hasSrgb = true;
gWaterProgram.mFeatures.hasReflectionProbes = true;
gWaterProgram.mFeatures.hasShadows = use_sun_shadow;
- gWaterProgram.mShaderFiles.clear();
- gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER));
- gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER));
+ gWaterProgram.mShaderFiles.clear();
+ gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER));
+ gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER));
gWaterProgram.clearPermutations();
if (LLPipeline::sRenderTransparentWater)
{
@@ -721,27 +721,27 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gWaterProgram.addPermutation("HAS_SUN_SHADOW", "1");
}
- gWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
- gWaterProgram.mShaderLevel = mShaderLevel[SHADER_WATER];
- success = gWaterProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- // load water shader
- gWaterEdgeProgram.mName = "Water Edge Shader";
- gWaterEdgeProgram.mFeatures.calculatesAtmospherics = true;
+ gWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ gWaterProgram.mShaderLevel = mShaderLevel[SHADER_WATER];
+ success = gWaterProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ // load water shader
+ gWaterEdgeProgram.mName = "Water Edge Shader";
+ gWaterEdgeProgram.mFeatures.calculatesAtmospherics = true;
gWaterEdgeProgram.mFeatures.hasAtmospherics = true;
- gWaterEdgeProgram.mFeatures.hasGamma = true;
- gWaterEdgeProgram.mFeatures.hasSrgb = true;
+ gWaterEdgeProgram.mFeatures.hasGamma = true;
+ gWaterEdgeProgram.mFeatures.hasSrgb = true;
gWaterEdgeProgram.mFeatures.hasReflectionProbes = true;
gWaterEdgeProgram.mFeatures.hasShadows = use_sun_shadow;
- gWaterEdgeProgram.mShaderFiles.clear();
- gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER));
- gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER));
+ gWaterEdgeProgram.mShaderFiles.clear();
+ gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER));
+ gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER));
gWaterEdgeProgram.clearPermutations();
- gWaterEdgeProgram.addPermutation("WATER_EDGE", "1");
+ gWaterEdgeProgram.addPermutation("WATER_EDGE", "1");
if (LLPipeline::sRenderTransparentWater)
{
gWaterEdgeProgram.addPermutation("TRANSPARENT_WATER", "1");
@@ -751,54 +751,54 @@ BOOL LLViewerShaderMgr::loadShadersWater()
{
gWaterEdgeProgram.addPermutation("HAS_SUN_SHADOW", "1");
}
- gWaterEdgeProgram.mShaderGroup = LLGLSLShader::SG_WATER;
- gWaterEdgeProgram.mShaderLevel = mShaderLevel[SHADER_WATER];
- success = gWaterEdgeProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- //load under water vertex shader
- gUnderWaterProgram.mName = "Underwater Shader";
- gUnderWaterProgram.mFeatures.calculatesAtmospherics = true;
- gUnderWaterProgram.mFeatures.hasAtmospherics = true;
- gUnderWaterProgram.mShaderFiles.clear();
- gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER));
- gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/underWaterF.glsl", GL_FRAGMENT_SHADER));
- gUnderWaterProgram.mShaderLevel = mShaderLevel[SHADER_WATER];
- gUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ gWaterEdgeProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ gWaterEdgeProgram.mShaderLevel = mShaderLevel[SHADER_WATER];
+ success = gWaterEdgeProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ //load under water vertex shader
+ gUnderWaterProgram.mName = "Underwater Shader";
+ gUnderWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gUnderWaterProgram.mFeatures.hasAtmospherics = true;
+ gUnderWaterProgram.mShaderFiles.clear();
+ gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER));
+ gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/underWaterF.glsl", GL_FRAGMENT_SHADER));
+ gUnderWaterProgram.mShaderLevel = mShaderLevel[SHADER_WATER];
+ gUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gUnderWaterProgram.clearPermutations();
if (LLPipeline::sRenderTransparentWater)
{
gUnderWaterProgram.addPermutation("TRANSPARENT_WATER", "1");
}
- success = gUnderWaterProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- /// Keep track of water shader levels
- if (gWaterProgram.mShaderLevel != mShaderLevel[SHADER_WATER]
- || gUnderWaterProgram.mShaderLevel != mShaderLevel[SHADER_WATER])
- {
- mShaderLevel[SHADER_WATER] = llmin(gWaterProgram.mShaderLevel, gUnderWaterProgram.mShaderLevel);
- }
-
- if (!success)
- {
- mShaderLevel[SHADER_WATER] = 0;
- return FALSE;
- }
-
- // if we failed to load the terrain water shaders and we need them (using class2 water),
- // then drop down to class1 water.
- if (mShaderLevel[SHADER_WATER] > 1 && !terrainWaterSuccess)
- {
- mShaderLevel[SHADER_WATER]--;
- return loadShadersWater();
- }
-
- LLWorld::getInstance()->updateWaterObjects();
+ success = gUnderWaterProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ /// Keep track of water shader levels
+ if (gWaterProgram.mShaderLevel != mShaderLevel[SHADER_WATER]
+ || gUnderWaterProgram.mShaderLevel != mShaderLevel[SHADER_WATER])
+ {
+ mShaderLevel[SHADER_WATER] = llmin(gWaterProgram.mShaderLevel, gUnderWaterProgram.mShaderLevel);
+ }
+
+ if (!success)
+ {
+ mShaderLevel[SHADER_WATER] = 0;
+ return FALSE;
+ }
+
+ // if we failed to load the terrain water shaders and we need them (using class2 water),
+ // then drop down to class1 water.
+ if (mShaderLevel[SHADER_WATER] > 1 && !terrainWaterSuccess)
+ {
+ mShaderLevel[SHADER_WATER]--;
+ return loadShadersWater();
+ }
+
+ LLWorld::getInstance()->updateWaterObjects();
return TRUE;
}
@@ -806,144 +806,144 @@ BOOL LLViewerShaderMgr::loadShadersWater()
BOOL LLViewerShaderMgr::loadShadersEffects()
{
LL_PROFILE_ZONE_SCOPED;
- BOOL success = TRUE;
-
- if (mShaderLevel[SHADER_EFFECT] == 0)
- {
- gGlowProgram.unload();
- gGlowExtractProgram.unload();
- return TRUE;
- }
-
- if (success)
- {
- gGlowProgram.mName = "Glow Shader (Post)";
- gGlowProgram.mShaderFiles.clear();
- gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowV.glsl", GL_VERTEX_SHADER));
- gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowF.glsl", GL_FRAGMENT_SHADER));
- gGlowProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT];
- success = gGlowProgram.createShader(NULL, NULL);
- if (!success)
- {
- LLPipeline::sRenderGlow = FALSE;
- }
- }
-
- if (success)
- {
+ BOOL success = TRUE;
+
+ if (mShaderLevel[SHADER_EFFECT] == 0)
+ {
+ gGlowProgram.unload();
+ gGlowExtractProgram.unload();
+ return TRUE;
+ }
+
+ if (success)
+ {
+ gGlowProgram.mName = "Glow Shader (Post)";
+ gGlowProgram.mShaderFiles.clear();
+ gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowV.glsl", GL_VERTEX_SHADER));
+ gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowF.glsl", GL_FRAGMENT_SHADER));
+ gGlowProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT];
+ success = gGlowProgram.createShader(NULL, NULL);
+ if (!success)
+ {
+ LLPipeline::sRenderGlow = FALSE;
+ }
+ }
+
+ if (success)
+ {
const bool use_glow_noise = gSavedSettings.getBOOL("RenderGlowNoise");
const std::string glow_noise_label = use_glow_noise ? " (+Noise)" : "";
- gGlowExtractProgram.mName = llformat("Glow Extract Shader (Post)%s", glow_noise_label.c_str());
- gGlowExtractProgram.mShaderFiles.clear();
- gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractV.glsl", GL_VERTEX_SHADER));
- gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractF.glsl", GL_FRAGMENT_SHADER));
- gGlowExtractProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT];
+ gGlowExtractProgram.mName = llformat("Glow Extract Shader (Post)%s", glow_noise_label.c_str());
+ gGlowExtractProgram.mShaderFiles.clear();
+ gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractV.glsl", GL_VERTEX_SHADER));
+ gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractF.glsl", GL_FRAGMENT_SHADER));
+ gGlowExtractProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT];
if (use_glow_noise)
{
gGlowExtractProgram.addPermutation("HAS_NOISE", "1");
}
- success = gGlowExtractProgram.createShader(NULL, NULL);
- if (!success)
- {
- LLPipeline::sRenderGlow = FALSE;
- }
- }
-
- return success;
+ success = gGlowExtractProgram.createShader(NULL, NULL);
+ if (!success)
+ {
+ LLPipeline::sRenderGlow = FALSE;
+ }
+ }
+
+ return success;
}
BOOL LLViewerShaderMgr::loadShadersDeferred()
{
LL_PROFILE_ZONE_SCOPED;
- bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 &&
+ bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 &&
gSavedSettings.getS32("RenderShadowDetail") > 0;
- if (mShaderLevel[SHADER_DEFERRED] == 0)
- {
- gDeferredTreeProgram.unload();
- gDeferredTreeShadowProgram.unload();
+ if (mShaderLevel[SHADER_DEFERRED] == 0)
+ {
+ gDeferredTreeProgram.unload();
+ gDeferredTreeShadowProgram.unload();
gDeferredSkinnedTreeShadowProgram.unload();
- gDeferredDiffuseProgram.unload();
+ gDeferredDiffuseProgram.unload();
gDeferredSkinnedDiffuseProgram.unload();
- gDeferredDiffuseAlphaMaskProgram.unload();
+ gDeferredDiffuseAlphaMaskProgram.unload();
gDeferredSkinnedDiffuseAlphaMaskProgram.unload();
- gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
- gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
- gDeferredBumpProgram.unload();
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
+ gDeferredBumpProgram.unload();
gDeferredSkinnedBumpProgram.unload();
- gDeferredImpostorProgram.unload();
- gDeferredTerrainProgram.unload();
- gDeferredLightProgram.unload();
- for (U32 i = 0; i < LL_DEFERRED_MULTI_LIGHT_COUNT; ++i)
- {
- gDeferredMultiLightProgram[i].unload();
- }
- gDeferredSpotLightProgram.unload();
- gDeferredMultiSpotLightProgram.unload();
- gDeferredSunProgram.unload();
- gDeferredBlurLightProgram.unload();
- gDeferredSoftenProgram.unload();
- gDeferredShadowProgram.unload();
+ gDeferredImpostorProgram.unload();
+ gDeferredTerrainProgram.unload();
+ gDeferredLightProgram.unload();
+ for (U32 i = 0; i < LL_DEFERRED_MULTI_LIGHT_COUNT; ++i)
+ {
+ gDeferredMultiLightProgram[i].unload();
+ }
+ gDeferredSpotLightProgram.unload();
+ gDeferredMultiSpotLightProgram.unload();
+ gDeferredSunProgram.unload();
+ gDeferredBlurLightProgram.unload();
+ gDeferredSoftenProgram.unload();
+ gDeferredShadowProgram.unload();
gDeferredSkinnedShadowProgram.unload();
- gDeferredShadowCubeProgram.unload();
+ gDeferredShadowCubeProgram.unload();
gDeferredShadowAlphaMaskProgram.unload();
gDeferredSkinnedShadowAlphaMaskProgram.unload();
gDeferredShadowGLTFAlphaMaskProgram.unload();
gDeferredSkinnedShadowGLTFAlphaMaskProgram.unload();
gDeferredShadowFullbrightAlphaMaskProgram.unload();
gDeferredSkinnedShadowFullbrightAlphaMaskProgram.unload();
- gDeferredAvatarShadowProgram.unload();
+ gDeferredAvatarShadowProgram.unload();
gDeferredAvatarAlphaShadowProgram.unload();
gDeferredAvatarAlphaMaskShadowProgram.unload();
- gDeferredAvatarProgram.unload();
- gDeferredAvatarAlphaProgram.unload();
- gDeferredAlphaProgram.unload();
+ gDeferredAvatarProgram.unload();
+ gDeferredAvatarAlphaProgram.unload();
+ gDeferredAlphaProgram.unload();
gHUDAlphaProgram.unload();
gDeferredSkinnedAlphaProgram.unload();
- gDeferredFullbrightProgram.unload();
+ gDeferredFullbrightProgram.unload();
gHUDFullbrightProgram.unload();
- gDeferredFullbrightAlphaMaskProgram.unload();
+ gDeferredFullbrightAlphaMaskProgram.unload();
gHUDFullbrightAlphaMaskProgram.unload();
gDeferredFullbrightAlphaMaskAlphaProgram.unload();
gHUDFullbrightAlphaMaskAlphaProgram.unload();
- gDeferredEmissiveProgram.unload();
+ gDeferredEmissiveProgram.unload();
gDeferredSkinnedEmissiveProgram.unload();
- gDeferredAvatarEyesProgram.unload();
- gDeferredPostProgram.unload();
- gDeferredCoFProgram.unload();
- gDeferredDoFCombineProgram.unload();
+ gDeferredAvatarEyesProgram.unload();
+ gDeferredPostProgram.unload();
+ gDeferredCoFProgram.unload();
+ gDeferredDoFCombineProgram.unload();
gExposureProgram.unload();
gLuminanceProgram.unload();
- gDeferredPostGammaCorrectProgram.unload();
+ gDeferredPostGammaCorrectProgram.unload();
gNoPostGammaCorrectProgram.unload();
gLegacyPostGammaCorrectProgram.unload();
- gFXAAProgram.unload();
- gDeferredWLSkyProgram.unload();
- gDeferredWLCloudProgram.unload();
+ gFXAAProgram.unload();
+ gDeferredWLSkyProgram.unload();
+ gDeferredWLCloudProgram.unload();
gDeferredWLSunProgram.unload();
gDeferredWLMoonProgram.unload();
- gDeferredStarProgram.unload();
- gDeferredFullbrightShinyProgram.unload();
+ gDeferredStarProgram.unload();
+ gDeferredFullbrightShinyProgram.unload();
gHUDFullbrightShinyProgram.unload();
gDeferredSkinnedFullbrightShinyProgram.unload();
- gDeferredSkinnedFullbrightProgram.unload();
+ gDeferredSkinnedFullbrightProgram.unload();
gDeferredSkinnedFullbrightAlphaMaskProgram.unload();
gDeferredSkinnedFullbrightAlphaMaskAlphaProgram.unload();
gDeferredHighlightProgram.unload();
-
- gNormalMapGenProgram.unload();
+
+ gNormalMapGenProgram.unload();
gDeferredGenBrdfLutProgram.unload();
- gDeferredBufferVisualProgram.unload();
+ gDeferredBufferVisualProgram.unload();
- for (U32 i = 0; i < LLMaterial::SHADER_COUNT*2; ++i)
- {
- gDeferredMaterialProgram[i].unload();
- }
+ for (U32 i = 0; i < LLMaterial::SHADER_COUNT*2; ++i)
+ {
+ gDeferredMaterialProgram[i].unload();
+ }
gHUDPBROpaqueProgram.unload();
gPBRGlowProgram.unload();
@@ -952,123 +952,123 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredPBRAlphaProgram.unload();
gDeferredSkinnedPBRAlphaProgram.unload();
- return TRUE;
- }
+ return TRUE;
+ }
- BOOL success = TRUE;
+ BOOL success = TRUE;
if (success)
- {
- gDeferredHighlightProgram.mName = "Deferred Highlight Shader";
- gDeferredHighlightProgram.mShaderFiles.clear();
- gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER));
- gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER));
- gDeferredHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gDeferredHighlightProgram.createShader(NULL, NULL);
- }
+ {
+ gDeferredHighlightProgram.mName = "Deferred Highlight Shader";
+ gDeferredHighlightProgram.mShaderFiles.clear();
+ gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER));
+ gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gDeferredHighlightProgram.createShader(NULL, NULL);
+ }
- if (success)
- {
- gDeferredDiffuseProgram.mName = "Deferred Diffuse Shader";
+ if (success)
+ {
+ gDeferredDiffuseProgram.mName = "Deferred Diffuse Shader";
gDeferredDiffuseProgram.mFeatures.encodesNormal = true;
gDeferredDiffuseProgram.mFeatures.hasSrgb = true;
- gDeferredDiffuseProgram.mShaderFiles.clear();
- gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER));
- gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER));
- gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
- gDeferredDiffuseProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredDiffuseProgram.mShaderFiles.clear();
+ gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER));
+ gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+ gDeferredDiffuseProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredDiffuseProgram, gDeferredSkinnedDiffuseProgram);
- success = success && gDeferredDiffuseProgram.createShader(NULL, NULL);
- }
+ success = success && gDeferredDiffuseProgram.createShader(NULL, NULL);
+ }
- if (success)
- {
- gDeferredDiffuseAlphaMaskProgram.mName = "Deferred Diffuse Alpha Mask Shader";
+ if (success)
+ {
+ gDeferredDiffuseAlphaMaskProgram.mName = "Deferred Diffuse Alpha Mask Shader";
gDeferredDiffuseAlphaMaskProgram.mFeatures.encodesNormal = true;
- gDeferredDiffuseAlphaMaskProgram.mShaderFiles.clear();
- gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER));
- gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskIndexedF.glsl", GL_FRAGMENT_SHADER));
- gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
- gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredDiffuseAlphaMaskProgram.mShaderFiles.clear();
+ gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER));
+ gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskIndexedF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+ gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredDiffuseAlphaMaskProgram, gDeferredSkinnedDiffuseAlphaMaskProgram);
- success = success && gDeferredDiffuseAlphaMaskProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gDeferredNonIndexedDiffuseAlphaMaskProgram.mName = "Deferred Diffuse Non-Indexed Alpha Mask Shader";
- gDeferredNonIndexedDiffuseAlphaMaskProgram.mFeatures.encodesNormal = true;
- gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.clear();
- gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER));
- gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
- gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(NULL, NULL);
+ success = success && gDeferredDiffuseAlphaMaskProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mName = "Deferred Diffuse Non-Indexed Alpha Mask Shader";
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mFeatures.encodesNormal = true;
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.clear();
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER));
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(NULL, NULL);
llassert(success);
- }
-
- if (success)
- {
- gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mName = "Deferred Diffuse Non-Indexed Alpha Mask No Color Shader";
- gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mFeatures.encodesNormal = true;
- gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.clear();
- gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER));
- gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER));
- gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredBumpProgram.mName = "Deferred Bump Shader";
- gDeferredBumpProgram.mFeatures.encodesNormal = true;
- gDeferredBumpProgram.mShaderFiles.clear();
- gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpV.glsl", GL_VERTEX_SHADER));
- gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpF.glsl", GL_FRAGMENT_SHADER));
- gDeferredBumpProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ }
+
+ if (success)
+ {
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mName = "Deferred Diffuse Non-Indexed Alpha Mask No Color Shader";
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mFeatures.encodesNormal = true;
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.clear();
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER));
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredBumpProgram.mName = "Deferred Bump Shader";
+ gDeferredBumpProgram.mFeatures.encodesNormal = true;
+ gDeferredBumpProgram.mShaderFiles.clear();
+ gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpV.glsl", GL_VERTEX_SHADER));
+ gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredBumpProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredBumpProgram, gDeferredSkinnedBumpProgram);
- success = success && gDeferredBumpProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- gDeferredMaterialProgram[1].mFeatures.hasLighting = false;
- gDeferredMaterialProgram[5].mFeatures.hasLighting = false;
- gDeferredMaterialProgram[9].mFeatures.hasLighting = false;
- gDeferredMaterialProgram[13].mFeatures.hasLighting = false;
- gDeferredMaterialProgram[1+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
- gDeferredMaterialProgram[5+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
- gDeferredMaterialProgram[9+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
- gDeferredMaterialProgram[13+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
-
- for (U32 i = 0; i < LLMaterial::SHADER_COUNT*2; ++i)
- {
- if (success)
- {
+ success = success && gDeferredBumpProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ gDeferredMaterialProgram[1].mFeatures.hasLighting = false;
+ gDeferredMaterialProgram[5].mFeatures.hasLighting = false;
+ gDeferredMaterialProgram[9].mFeatures.hasLighting = false;
+ gDeferredMaterialProgram[13].mFeatures.hasLighting = false;
+ gDeferredMaterialProgram[1+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
+ gDeferredMaterialProgram[5+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
+ gDeferredMaterialProgram[9+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
+ gDeferredMaterialProgram[13+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = false;
+
+ for (U32 i = 0; i < LLMaterial::SHADER_COUNT*2; ++i)
+ {
+ if (success)
+ {
mShaderList.push_back(&gDeferredMaterialProgram[i]);
- gDeferredMaterialProgram[i].mName = llformat("Deferred Material Shader %d", i);
-
- U32 alpha_mode = i & 0x3;
+ gDeferredMaterialProgram[i].mName = llformat("Deferred Material Shader %d", i);
+
+ U32 alpha_mode = i & 0x3;
- gDeferredMaterialProgram[i].mShaderFiles.clear();
- gDeferredMaterialProgram[i].mShaderFiles.push_back(make_pair("deferred/materialV.glsl", GL_VERTEX_SHADER));
- gDeferredMaterialProgram[i].mShaderFiles.push_back(make_pair("deferred/materialF.glsl", GL_FRAGMENT_SHADER));
- gDeferredMaterialProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredMaterialProgram[i].mShaderFiles.clear();
+ gDeferredMaterialProgram[i].mShaderFiles.push_back(make_pair("deferred/materialV.glsl", GL_VERTEX_SHADER));
+ gDeferredMaterialProgram[i].mShaderFiles.push_back(make_pair("deferred/materialF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredMaterialProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- gDeferredMaterialProgram[i].clearPermutations();
+ gDeferredMaterialProgram[i].clearPermutations();
- bool has_normal_map = (i & 0x8) > 0;
- bool has_specular_map = (i & 0x4) > 0;
+ bool has_normal_map = (i & 0x8) > 0;
+ bool has_specular_map = (i & 0x4) > 0;
- if (has_normal_map)
- {
- gDeferredMaterialProgram[i].addPermutation("HAS_NORMAL_MAP", "1");
- }
+ if (has_normal_map)
+ {
+ gDeferredMaterialProgram[i].addPermutation("HAS_NORMAL_MAP", "1");
+ }
- if (has_specular_map)
- {
- gDeferredMaterialProgram[i].addPermutation("HAS_SPECULAR_MAP", "1");
- }
+ if (has_specular_map)
+ {
+ gDeferredMaterialProgram[i].addPermutation("HAS_SPECULAR_MAP", "1");
+ }
gDeferredMaterialProgram[i].addPermutation("DIFFUSE_ALPHA_MODE", llformat("%d", alpha_mode));
@@ -1104,17 +1104,17 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
success = gDeferredMaterialProgram[i].createShader(NULL, NULL);
llassert(success);
- }
- }
+ }
+ }
- gDeferredMaterialProgram[1].mFeatures.hasLighting = true;
- gDeferredMaterialProgram[5].mFeatures.hasLighting = true;
- gDeferredMaterialProgram[9].mFeatures.hasLighting = true;
- gDeferredMaterialProgram[13].mFeatures.hasLighting = true;
- gDeferredMaterialProgram[1+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
- gDeferredMaterialProgram[5+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
- gDeferredMaterialProgram[9+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
- gDeferredMaterialProgram[13+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
+ gDeferredMaterialProgram[1].mFeatures.hasLighting = true;
+ gDeferredMaterialProgram[5].mFeatures.hasLighting = true;
+ gDeferredMaterialProgram[9].mFeatures.hasLighting = true;
+ gDeferredMaterialProgram[13].mFeatures.hasLighting = true;
+ gDeferredMaterialProgram[1+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
+ gDeferredMaterialProgram[5+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
+ gDeferredMaterialProgram[9+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
+ gDeferredMaterialProgram[13+LLMaterial::SHADER_COUNT].mFeatures.hasLighting = true;
if (success)
{
@@ -1127,7 +1127,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredPBROpaqueProgram.mShaderFiles.push_back(make_pair("deferred/pbropaqueF.glsl", GL_FRAGMENT_SHADER));
gDeferredPBROpaqueProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredPBROpaqueProgram.clearPermutations();
-
+
success = make_rigged_variant(gDeferredPBROpaqueProgram, gDeferredSkinnedPBROpaqueProgram);
if (success)
{
@@ -1165,17 +1165,17 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gHUDPBROpaqueProgram.addPermutation("IS_HUD", "1");
success = gHUDPBROpaqueProgram.createShader(NULL, NULL);
-
+
llassert(success);
}
-
- if (success)
- {
+
+ if (success)
+ {
LLGLSLShader* shader = &gDeferredPBRAlphaProgram;
shader->mName = "Deferred PBR Alpha Shader";
-
+
shader->mFeatures.calculatesLighting = false;
shader->mFeatures.hasLighting = false;
shader->mFeatures.isAlphaLighting = true;
@@ -1229,7 +1229,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
shader->mName = "HUD PBR Alpha Shader";
shader->mFeatures.hasSrgb = true;
-
+
shader->mShaderFiles.clear();
shader->mShaderFiles.push_back(make_pair("deferred/pbralphaV.glsl", GL_VERTEX_SHADER));
shader->mShaderFiles.push_back(make_pair("deferred/pbralphaF.glsl", GL_FRAGMENT_SHADER));
@@ -1242,29 +1242,29 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
success = shader->createShader(NULL, NULL);
llassert(success);
}
-
- if (success)
- {
- gDeferredTreeProgram.mName = "Deferred Tree Shader";
- gDeferredTreeProgram.mShaderFiles.clear();
+
+ if (success)
+ {
+ gDeferredTreeProgram.mName = "Deferred Tree Shader";
+ gDeferredTreeProgram.mShaderFiles.clear();
gDeferredTreeProgram.mFeatures.encodesNormal = true;
- gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeV.glsl", GL_VERTEX_SHADER));
- gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeF.glsl", GL_FRAGMENT_SHADER));
- gDeferredTreeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredTreeProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gDeferredTreeShadowProgram.mName = "Deferred Tree Shadow Shader";
- gDeferredTreeShadowProgram.mShaderFiles.clear();
- gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowV.glsl", GL_VERTEX_SHADER));
- gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowF.glsl", GL_FRAGMENT_SHADER));
- gDeferredTreeShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeV.glsl", GL_VERTEX_SHADER));
+ gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredTreeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredTreeProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gDeferredTreeShadowProgram.mName = "Deferred Tree Shadow Shader";
+ gDeferredTreeShadowProgram.mShaderFiles.clear();
+ gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowV.glsl", GL_VERTEX_SHADER));
+ gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredTreeShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredTreeShadowProgram.mRiggedVariant = &gDeferredSkinnedTreeShadowProgram;
- success = gDeferredTreeShadowProgram.createShader(NULL, NULL);
+ success = gDeferredTreeShadowProgram.createShader(NULL, NULL);
llassert(success);
- }
+ }
if (success)
{
@@ -1278,98 +1278,98 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
- if (success)
- {
- gDeferredImpostorProgram.mName = "Deferred Impostor Shader";
- gDeferredImpostorProgram.mFeatures.hasSrgb = true;
- gDeferredImpostorProgram.mFeatures.encodesNormal = true;
- //gDeferredImpostorProgram.mFeatures.isDeferred = true;
- gDeferredImpostorProgram.mShaderFiles.clear();
- gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorV.glsl", GL_VERTEX_SHADER));
+ if (success)
+ {
+ gDeferredImpostorProgram.mName = "Deferred Impostor Shader";
+ gDeferredImpostorProgram.mFeatures.hasSrgb = true;
+ gDeferredImpostorProgram.mFeatures.encodesNormal = true;
+ //gDeferredImpostorProgram.mFeatures.isDeferred = true;
+ gDeferredImpostorProgram.mShaderFiles.clear();
+ gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorV.glsl", GL_VERTEX_SHADER));
gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorF.glsl", GL_FRAGMENT_SHADER));
gDeferredImpostorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = gDeferredImpostorProgram.createShader(NULL, NULL);
llassert(success);
- }
+ }
- if (success)
- {
- gDeferredLightProgram.mName = "Deferred Light Shader";
- gDeferredLightProgram.mFeatures.isDeferred = true;
- gDeferredLightProgram.mFeatures.hasShadows = true;
+ if (success)
+ {
+ gDeferredLightProgram.mName = "Deferred Light Shader";
+ gDeferredLightProgram.mFeatures.isDeferred = true;
+ gDeferredLightProgram.mFeatures.hasShadows = true;
gDeferredLightProgram.mFeatures.hasSrgb = true;
- gDeferredLightProgram.mShaderFiles.clear();
- gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER));
- gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightF.glsl", GL_FRAGMENT_SHADER));
- gDeferredLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredLightProgram.mShaderFiles.clear();
+ gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER));
+ gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredLightProgram.clearPermutations();
- success = gDeferredLightProgram.createShader(NULL, NULL);
+ success = gDeferredLightProgram.createShader(NULL, NULL);
llassert(success);
- }
-
- for (U32 i = 0; i < LL_DEFERRED_MULTI_LIGHT_COUNT; i++)
- {
- if (success)
- {
- gDeferredMultiLightProgram[i].mName = llformat("Deferred MultiLight Shader %d", i);
- gDeferredMultiLightProgram[i].mFeatures.isDeferred = true;
- gDeferredMultiLightProgram[i].mFeatures.hasShadows = true;
+ }
+
+ for (U32 i = 0; i < LL_DEFERRED_MULTI_LIGHT_COUNT; i++)
+ {
+ if (success)
+ {
+ gDeferredMultiLightProgram[i].mName = llformat("Deferred MultiLight Shader %d", i);
+ gDeferredMultiLightProgram[i].mFeatures.isDeferred = true;
+ gDeferredMultiLightProgram[i].mFeatures.hasShadows = true;
gDeferredMultiLightProgram[i].mFeatures.hasSrgb = true;
gDeferredMultiLightProgram[i].clearPermutations();
- gDeferredMultiLightProgram[i].mShaderFiles.clear();
- gDeferredMultiLightProgram[i].mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER));
- gDeferredMultiLightProgram[i].mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER));
- gDeferredMultiLightProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- gDeferredMultiLightProgram[i].addPermutation("LIGHT_COUNT", llformat("%d", i+1));
+ gDeferredMultiLightProgram[i].mShaderFiles.clear();
+ gDeferredMultiLightProgram[i].mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER));
+ gDeferredMultiLightProgram[i].mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredMultiLightProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredMultiLightProgram[i].addPermutation("LIGHT_COUNT", llformat("%d", i+1));
- success = gDeferredMultiLightProgram[i].createShader(NULL, NULL);
+ success = gDeferredMultiLightProgram[i].createShader(NULL, NULL);
llassert(success);
- }
- }
+ }
+ }
- if (success)
- {
- gDeferredSpotLightProgram.mName = "Deferred SpotLight Shader";
- gDeferredSpotLightProgram.mShaderFiles.clear();
- gDeferredSpotLightProgram.mFeatures.hasSrgb = true;
- gDeferredSpotLightProgram.mFeatures.isDeferred = true;
- gDeferredSpotLightProgram.mFeatures.hasShadows = true;
+ if (success)
+ {
+ gDeferredSpotLightProgram.mName = "Deferred SpotLight Shader";
+ gDeferredSpotLightProgram.mShaderFiles.clear();
+ gDeferredSpotLightProgram.mFeatures.hasSrgb = true;
+ gDeferredSpotLightProgram.mFeatures.isDeferred = true;
+ gDeferredSpotLightProgram.mFeatures.hasShadows = true;
gDeferredSpotLightProgram.clearPermutations();
- gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER));
- gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER));
- gDeferredSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER));
+ gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredSpotLightProgram.createShader(NULL, NULL);
+ success = gDeferredSpotLightProgram.createShader(NULL, NULL);
llassert(success);
- }
+ }
- if (success)
- {
- gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader";
- gDeferredMultiSpotLightProgram.mFeatures.hasSrgb = true;
- gDeferredMultiSpotLightProgram.mFeatures.isDeferred = true;
- gDeferredMultiSpotLightProgram.mFeatures.hasShadows = true;
+ if (success)
+ {
+ gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader";
+ gDeferredMultiSpotLightProgram.mFeatures.hasSrgb = true;
+ gDeferredMultiSpotLightProgram.mFeatures.isDeferred = true;
+ gDeferredMultiSpotLightProgram.mFeatures.hasShadows = true;
gDeferredMultiSpotLightProgram.clearPermutations();
gDeferredMultiSpotLightProgram.addPermutation("MULTI_SPOTLIGHT", "1");
- gDeferredMultiSpotLightProgram.mShaderFiles.clear();
- gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER));
- gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER));
- gDeferredMultiSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredMultiSpotLightProgram.mShaderFiles.clear();
+ gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER));
+ gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredMultiSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL);
+ success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL);
llassert(success);
- }
+ }
- if (success)
- {
- std::string fragment;
- std::string vertex = "deferred/sunLightV.glsl";
+ if (success)
+ {
+ std::string fragment;
+ std::string vertex = "deferred/sunLightV.glsl";
bool use_ao = gSavedSettings.getBOOL("RenderDeferredSSAO");
@@ -1392,30 +1392,30 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSunProgram.mFeatures.hasAmbientOcclusion = use_ao;
gDeferredSunProgram.mShaderFiles.clear();
- gDeferredSunProgram.mShaderFiles.push_back(make_pair(vertex, GL_VERTEX_SHADER));
- gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER));
- gDeferredSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredSunProgram.mShaderFiles.push_back(make_pair(vertex, GL_VERTEX_SHADER));
+ gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER));
+ gDeferredSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = gDeferredSunProgram.createShader(NULL, NULL);
llassert(success);
- }
+ }
- if (success)
- {
- gDeferredBlurLightProgram.mName = "Deferred Blur Light Shader";
- gDeferredBlurLightProgram.mFeatures.isDeferred = true;
+ if (success)
+ {
+ gDeferredBlurLightProgram.mName = "Deferred Blur Light Shader";
+ gDeferredBlurLightProgram.mFeatures.isDeferred = true;
- gDeferredBlurLightProgram.mShaderFiles.clear();
- gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightV.glsl", GL_VERTEX_SHADER));
- gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER));
- gDeferredBlurLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredBlurLightProgram.mShaderFiles.clear();
+ gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightV.glsl", GL_VERTEX_SHADER));
+ gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredBlurLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredBlurLightProgram.createShader(NULL, NULL);
+ success = gDeferredBlurLightProgram.createShader(NULL, NULL);
llassert(success);
- }
+ }
- if (success)
- {
+ if (success)
+ {
for (int i = 0; i < 3 && success; ++i)
{
LLGLSLShader* shader = nullptr;
@@ -1489,9 +1489,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
- LLGLSLShader* shaders[] = {
- &gDeferredAlphaImpostorProgram,
- &gDeferredSkinnedAlphaImpostorProgram
+ LLGLSLShader* shaders[] = {
+ &gDeferredAlphaImpostorProgram,
+ &gDeferredSkinnedAlphaImpostorProgram
};
for (int i = 0; i < 2 && success; ++i)
@@ -1547,41 +1547,41 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
}
}
- if (success)
- {
- gDeferredAvatarEyesProgram.mName = "Deferred Avatar Eyes Shader";
- gDeferredAvatarEyesProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredAvatarEyesProgram.mFeatures.hasGamma = true;
- gDeferredAvatarEyesProgram.mFeatures.hasAtmospherics = true;
- gDeferredAvatarEyesProgram.mFeatures.disableTextureIndex = true;
- gDeferredAvatarEyesProgram.mFeatures.hasSrgb = true;
- gDeferredAvatarEyesProgram.mFeatures.encodesNormal = true;
- gDeferredAvatarEyesProgram.mFeatures.hasShadows = true;
-
- gDeferredAvatarEyesProgram.mShaderFiles.clear();
- gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/avatarEyesV.glsl", GL_VERTEX_SHADER));
- gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER));
- gDeferredAvatarEyesProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarEyesProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredFullbrightProgram.mName = "Deferred Fullbright Shader";
- gDeferredFullbrightProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredFullbrightProgram.mFeatures.hasGamma = true;
- gDeferredFullbrightProgram.mFeatures.hasAtmospherics = true;
- gDeferredFullbrightProgram.mFeatures.hasSrgb = true;
- gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
- gDeferredFullbrightProgram.mShaderFiles.clear();
- gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER));
- gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER));
- gDeferredFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ if (success)
+ {
+ gDeferredAvatarEyesProgram.mName = "Deferred Avatar Eyes Shader";
+ gDeferredAvatarEyesProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredAvatarEyesProgram.mFeatures.hasGamma = true;
+ gDeferredAvatarEyesProgram.mFeatures.hasAtmospherics = true;
+ gDeferredAvatarEyesProgram.mFeatures.disableTextureIndex = true;
+ gDeferredAvatarEyesProgram.mFeatures.hasSrgb = true;
+ gDeferredAvatarEyesProgram.mFeatures.encodesNormal = true;
+ gDeferredAvatarEyesProgram.mFeatures.hasShadows = true;
+
+ gDeferredAvatarEyesProgram.mShaderFiles.clear();
+ gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/avatarEyesV.glsl", GL_VERTEX_SHADER));
+ gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredAvatarEyesProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredAvatarEyesProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredFullbrightProgram.mName = "Deferred Fullbright Shader";
+ gDeferredFullbrightProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredFullbrightProgram.mFeatures.hasGamma = true;
+ gDeferredFullbrightProgram.mFeatures.hasAtmospherics = true;
+ gDeferredFullbrightProgram.mFeatures.hasSrgb = true;
+ gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+ gDeferredFullbrightProgram.mShaderFiles.clear();
+ gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER));
+ gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredFullbrightProgram, gDeferredSkinnedFullbrightProgram);
- success = gDeferredFullbrightProgram.createShader(NULL, NULL);
- llassert(success);
- }
+ success = gDeferredFullbrightProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
if (success)
{
@@ -1601,24 +1601,24 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
- if (success)
- {
- gDeferredFullbrightAlphaMaskProgram.mName = "Deferred Fullbright Alpha Masking Shader";
- gDeferredFullbrightAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredFullbrightAlphaMaskProgram.mFeatures.hasGamma = true;
- gDeferredFullbrightAlphaMaskProgram.mFeatures.hasAtmospherics = true;
- gDeferredFullbrightAlphaMaskProgram.mFeatures.hasSrgb = true;
- gDeferredFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
- gDeferredFullbrightAlphaMaskProgram.mShaderFiles.clear();
- gDeferredFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER));
- gDeferredFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER));
+ if (success)
+ {
+ gDeferredFullbrightAlphaMaskProgram.mName = "Deferred Fullbright Alpha Masking Shader";
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.hasGamma = true;
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.hasAtmospherics = true;
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.hasSrgb = true;
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+ gDeferredFullbrightAlphaMaskProgram.mShaderFiles.clear();
+ gDeferredFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER));
+ gDeferredFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER));
gDeferredFullbrightAlphaMaskProgram.clearPermutations();
- gDeferredFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK","1");
- gDeferredFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK","1");
+ gDeferredFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredFullbrightAlphaMaskProgram, gDeferredSkinnedFullbrightAlphaMaskProgram);
- success = success && gDeferredFullbrightAlphaMaskProgram.createShader(NULL, NULL);
- llassert(success);
- }
+ success = success && gDeferredFullbrightAlphaMaskProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
if (success)
{
@@ -1681,23 +1681,23 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
- if (success)
- {
- gDeferredFullbrightShinyProgram.mName = "Deferred FullbrightShiny Shader";
- gDeferredFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredFullbrightShinyProgram.mFeatures.hasAtmospherics = true;
- gDeferredFullbrightShinyProgram.mFeatures.hasGamma = true;
- gDeferredFullbrightShinyProgram.mFeatures.hasSrgb = true;
- gDeferredFullbrightShinyProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
- gDeferredFullbrightShinyProgram.mShaderFiles.clear();
- gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyV.glsl", GL_VERTEX_SHADER));
- gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER));
- gDeferredFullbrightShinyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ if (success)
+ {
+ gDeferredFullbrightShinyProgram.mName = "Deferred FullbrightShiny Shader";
+ gDeferredFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredFullbrightShinyProgram.mFeatures.hasAtmospherics = true;
+ gDeferredFullbrightShinyProgram.mFeatures.hasGamma = true;
+ gDeferredFullbrightShinyProgram.mFeatures.hasSrgb = true;
+ gDeferredFullbrightShinyProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+ gDeferredFullbrightShinyProgram.mShaderFiles.clear();
+ gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyV.glsl", GL_VERTEX_SHADER));
+ gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredFullbrightShinyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredFullbrightShinyProgram.mFeatures.hasReflectionProbes = true;
success = make_rigged_variant(gDeferredFullbrightShinyProgram, gDeferredSkinnedFullbrightShinyProgram);
- success = success && gDeferredFullbrightShinyProgram.createShader(NULL, NULL);
- llassert(success);
- }
+ success = success && gDeferredFullbrightShinyProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
if (success)
{
@@ -1718,54 +1718,54 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
- if (success)
- {
- gDeferredEmissiveProgram.mName = "Deferred Emissive Shader";
- gDeferredEmissiveProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredEmissiveProgram.mFeatures.hasGamma = true;
- gDeferredEmissiveProgram.mFeatures.hasAtmospherics = true;
- gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
- gDeferredEmissiveProgram.mShaderFiles.clear();
- gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER));
- gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER));
- gDeferredEmissiveProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ if (success)
+ {
+ gDeferredEmissiveProgram.mName = "Deferred Emissive Shader";
+ gDeferredEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredEmissiveProgram.mFeatures.hasGamma = true;
+ gDeferredEmissiveProgram.mFeatures.hasAtmospherics = true;
+ gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+ gDeferredEmissiveProgram.mShaderFiles.clear();
+ gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER));
+ gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredEmissiveProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredEmissiveProgram, gDeferredSkinnedEmissiveProgram);
- success = success && gDeferredEmissiveProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredSoftenProgram.mName = "Deferred Soften Shader";
- gDeferredSoftenProgram.mShaderFiles.clear();
- gDeferredSoftenProgram.mFeatures.hasSrgb = true;
- gDeferredSoftenProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredSoftenProgram.mFeatures.hasAtmospherics = true;
- gDeferredSoftenProgram.mFeatures.hasGamma = true;
- gDeferredSoftenProgram.mFeatures.isDeferred = true;
- gDeferredSoftenProgram.mFeatures.hasShadows = use_sun_shadow;
+ success = success && gDeferredEmissiveProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredSoftenProgram.mName = "Deferred Soften Shader";
+ gDeferredSoftenProgram.mShaderFiles.clear();
+ gDeferredSoftenProgram.mFeatures.hasSrgb = true;
+ gDeferredSoftenProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredSoftenProgram.mFeatures.hasAtmospherics = true;
+ gDeferredSoftenProgram.mFeatures.hasGamma = true;
+ gDeferredSoftenProgram.mFeatures.isDeferred = true;
+ gDeferredSoftenProgram.mFeatures.hasShadows = use_sun_shadow;
gDeferredSoftenProgram.mFeatures.hasReflectionProbes = mShaderLevel[SHADER_DEFERRED] > 2;
gDeferredSoftenProgram.clearPermutations();
- gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER));
- gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER));
+ gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER));
- gDeferredSoftenProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredSoftenProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
if (use_sun_shadow)
{
gDeferredSoftenProgram.addPermutation("HAS_SUN_SHADOW", "1");
}
- if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
- { //if using SSAO, take screen space light map into account as if shadows are enabled
- gDeferredSoftenProgram.mShaderLevel = llmax(gDeferredSoftenProgram.mShaderLevel, 2);
+ if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
+ { //if using SSAO, take screen space light map into account as if shadows are enabled
+ gDeferredSoftenProgram.mShaderLevel = llmax(gDeferredSoftenProgram.mShaderLevel, 2);
gDeferredSoftenProgram.addPermutation("HAS_SSAO", "1");
- }
-
- success = gDeferredSoftenProgram.createShader(NULL, NULL);
- llassert(success);
- }
+ }
+
+ success = gDeferredSoftenProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
if (success)
{
@@ -1814,17 +1814,17 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
}
- if (success)
- {
- gDeferredShadowProgram.mName = "Deferred Shadow Shader";
- gDeferredShadowProgram.mShaderFiles.clear();
- gDeferredShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowV.glsl", GL_VERTEX_SHADER));
- gDeferredShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER));
- gDeferredShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- gDeferredShadowProgram.mRiggedVariant = &gDeferredSkinnedShadowProgram;
- success = gDeferredShadowProgram.createShader(NULL, NULL);
- llassert(success);
- }
+ if (success)
+ {
+ gDeferredShadowProgram.mName = "Deferred Shadow Shader";
+ gDeferredShadowProgram.mShaderFiles.clear();
+ gDeferredShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowV.glsl", GL_VERTEX_SHADER));
+ gDeferredShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredShadowProgram.mRiggedVariant = &gDeferredSkinnedShadowProgram;
+ success = gDeferredShadowProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
if (success)
{
@@ -1841,52 +1841,52 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
- if (success)
- {
- gDeferredShadowCubeProgram.mName = "Deferred Shadow Cube Shader";
- gDeferredShadowCubeProgram.mFeatures.isDeferred = true;
- gDeferredShadowCubeProgram.mFeatures.hasShadows = true;
- gDeferredShadowCubeProgram.mShaderFiles.clear();
- gDeferredShadowCubeProgram.mShaderFiles.push_back(make_pair("deferred/shadowCubeV.glsl", GL_VERTEX_SHADER));
- gDeferredShadowCubeProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER));
- // gDeferredShadowCubeProgram.addPermutation("DEPTH_CLAMP", "1");
- gDeferredShadowCubeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredShadowCubeProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredShadowFullbrightAlphaMaskProgram.mName = "Deferred Shadow Fullbright Alpha Mask Shader";
- gDeferredShadowFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
-
- gDeferredShadowFullbrightAlphaMaskProgram.mShaderFiles.clear();
- gDeferredShadowFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER));
- gDeferredShadowFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
+ if (success)
+ {
+ gDeferredShadowCubeProgram.mName = "Deferred Shadow Cube Shader";
+ gDeferredShadowCubeProgram.mFeatures.isDeferred = true;
+ gDeferredShadowCubeProgram.mFeatures.hasShadows = true;
+ gDeferredShadowCubeProgram.mShaderFiles.clear();
+ gDeferredShadowCubeProgram.mShaderFiles.push_back(make_pair("deferred/shadowCubeV.glsl", GL_VERTEX_SHADER));
+ gDeferredShadowCubeProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER));
+ // gDeferredShadowCubeProgram.addPermutation("DEPTH_CLAMP", "1");
+ gDeferredShadowCubeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredShadowCubeProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredShadowFullbrightAlphaMaskProgram.mName = "Deferred Shadow Fullbright Alpha Mask Shader";
+ gDeferredShadowFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+
+ gDeferredShadowFullbrightAlphaMaskProgram.mShaderFiles.clear();
+ gDeferredShadowFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER));
+ gDeferredShadowFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
gDeferredShadowFullbrightAlphaMaskProgram.clearPermutations();
- gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("DEPTH_CLAMP", "1");
+ gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("DEPTH_CLAMP", "1");
gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("IS_FULLBRIGHT", "1");
- gDeferredShadowFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredShadowFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredShadowFullbrightAlphaMaskProgram, gDeferredSkinnedShadowFullbrightAlphaMaskProgram);
success = success && gDeferredShadowFullbrightAlphaMaskProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredShadowAlphaMaskProgram.mName = "Deferred Shadow Alpha Mask Shader";
- gDeferredShadowAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
-
- gDeferredShadowAlphaMaskProgram.mShaderFiles.clear();
- gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER));
- gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
- gDeferredShadowAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredShadowAlphaMaskProgram.mName = "Deferred Shadow Alpha Mask Shader";
+ gDeferredShadowAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+
+ gDeferredShadowAlphaMaskProgram.mShaderFiles.clear();
+ gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER));
+ gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredShadowAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = make_rigged_variant(gDeferredShadowAlphaMaskProgram, gDeferredSkinnedShadowAlphaMaskProgram);
success = success && gDeferredShadowAlphaMaskProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
+ llassert(success);
+ }
+
if (success)
{
@@ -1914,113 +1914,113 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
- if (success)
- {
- gDeferredAvatarShadowProgram.mName = "Deferred Avatar Shadow Shader";
- gDeferredAvatarShadowProgram.mFeatures.hasSkinning = true;
-
- gDeferredAvatarShadowProgram.mShaderFiles.clear();
- gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER));
- gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER));
- gDeferredAvatarShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarShadowProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredAvatarAlphaShadowProgram.mName = "Deferred Avatar Alpha Shadow Shader";
- gDeferredAvatarAlphaShadowProgram.mFeatures.hasSkinning = true;
- gDeferredAvatarAlphaShadowProgram.mShaderFiles.clear();
- gDeferredAvatarAlphaShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaShadowV.glsl", GL_VERTEX_SHADER));
- gDeferredAvatarAlphaShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaShadowF.glsl", GL_FRAGMENT_SHADER));
- gDeferredAvatarAlphaShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarAlphaShadowProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gDeferredAvatarShadowProgram.mName = "Deferred Avatar Shadow Shader";
+ gDeferredAvatarShadowProgram.mFeatures.hasSkinning = true;
+
+ gDeferredAvatarShadowProgram.mShaderFiles.clear();
+ gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER));
+ gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredAvatarShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredAvatarShadowProgram.createShader(NULL, NULL);
llassert(success);
- }
- if (success)
- {
- gDeferredAvatarAlphaMaskShadowProgram.mName = "Deferred Avatar Alpha Mask Shadow Shader";
- gDeferredAvatarAlphaMaskShadowProgram.mFeatures.hasSkinning = true;
- gDeferredAvatarAlphaMaskShadowProgram.mShaderFiles.clear();
- gDeferredAvatarAlphaMaskShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaShadowV.glsl", GL_VERTEX_SHADER));
- gDeferredAvatarAlphaMaskShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaMaskShadowF.glsl", GL_FRAGMENT_SHADER));
- gDeferredAvatarAlphaMaskShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarAlphaMaskShadowProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gDeferredAvatarAlphaShadowProgram.mName = "Deferred Avatar Alpha Shadow Shader";
+ gDeferredAvatarAlphaShadowProgram.mFeatures.hasSkinning = true;
+ gDeferredAvatarAlphaShadowProgram.mShaderFiles.clear();
+ gDeferredAvatarAlphaShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaShadowV.glsl", GL_VERTEX_SHADER));
+ gDeferredAvatarAlphaShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaShadowF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredAvatarAlphaShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredAvatarAlphaShadowProgram.createShader(NULL, NULL);
llassert(success);
- }
-
- if (success)
- {
- gDeferredTerrainProgram.mName = "Deferred Terrain Shader";
- gDeferredTerrainProgram.mFeatures.encodesNormal = true;
- gDeferredTerrainProgram.mFeatures.hasSrgb = true;
- gDeferredTerrainProgram.mFeatures.calculatesLighting = false;
- gDeferredTerrainProgram.mFeatures.hasLighting = false;
- gDeferredTerrainProgram.mFeatures.isAlphaLighting = true;
- gDeferredTerrainProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
- gDeferredTerrainProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredTerrainProgram.mFeatures.hasAtmospherics = true;
- gDeferredTerrainProgram.mFeatures.hasGamma = true;
-
- gDeferredTerrainProgram.mShaderFiles.clear();
- gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER));
- gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER));
- gDeferredTerrainProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ }
+ if (success)
+ {
+ gDeferredAvatarAlphaMaskShadowProgram.mName = "Deferred Avatar Alpha Mask Shadow Shader";
+ gDeferredAvatarAlphaMaskShadowProgram.mFeatures.hasSkinning = true;
+ gDeferredAvatarAlphaMaskShadowProgram.mShaderFiles.clear();
+ gDeferredAvatarAlphaMaskShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaShadowV.glsl", GL_VERTEX_SHADER));
+ gDeferredAvatarAlphaMaskShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaMaskShadowF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredAvatarAlphaMaskShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredAvatarAlphaMaskShadowProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredTerrainProgram.mName = "Deferred Terrain Shader";
+ gDeferredTerrainProgram.mFeatures.encodesNormal = true;
+ gDeferredTerrainProgram.mFeatures.hasSrgb = true;
+ gDeferredTerrainProgram.mFeatures.calculatesLighting = false;
+ gDeferredTerrainProgram.mFeatures.hasLighting = false;
+ gDeferredTerrainProgram.mFeatures.isAlphaLighting = true;
+ gDeferredTerrainProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
+ gDeferredTerrainProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredTerrainProgram.mFeatures.hasAtmospherics = true;
+ gDeferredTerrainProgram.mFeatures.hasGamma = true;
+
+ gDeferredTerrainProgram.mShaderFiles.clear();
+ gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER));
+ gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredTerrainProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
success = gDeferredTerrainProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredAvatarProgram.mName = "Deferred Avatar Shader";
- gDeferredAvatarProgram.mFeatures.hasSkinning = true;
- gDeferredAvatarProgram.mFeatures.encodesNormal = true;
- gDeferredAvatarProgram.mShaderFiles.clear();
- gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER));
- gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER));
- gDeferredAvatarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredAvatarAlphaProgram.mName = "Deferred Avatar Alpha Shader";
- gDeferredAvatarAlphaProgram.mFeatures.hasSkinning = true;
- gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = false;
- gDeferredAvatarAlphaProgram.mFeatures.hasLighting = false;
- gDeferredAvatarAlphaProgram.mFeatures.isAlphaLighting = true;
- gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true;
- gDeferredAvatarAlphaProgram.mFeatures.hasSrgb = true;
- gDeferredAvatarAlphaProgram.mFeatures.encodesNormal = true;
- gDeferredAvatarAlphaProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredAvatarAlphaProgram.mFeatures.hasAtmospherics = true;
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredAvatarProgram.mName = "Deferred Avatar Shader";
+ gDeferredAvatarProgram.mFeatures.hasSkinning = true;
+ gDeferredAvatarProgram.mFeatures.encodesNormal = true;
+ gDeferredAvatarProgram.mShaderFiles.clear();
+ gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER));
+ gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredAvatarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredAvatarProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredAvatarAlphaProgram.mName = "Deferred Avatar Alpha Shader";
+ gDeferredAvatarAlphaProgram.mFeatures.hasSkinning = true;
+ gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = false;
+ gDeferredAvatarAlphaProgram.mFeatures.hasLighting = false;
+ gDeferredAvatarAlphaProgram.mFeatures.isAlphaLighting = true;
+ gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true;
+ gDeferredAvatarAlphaProgram.mFeatures.hasSrgb = true;
+ gDeferredAvatarAlphaProgram.mFeatures.encodesNormal = true;
+ gDeferredAvatarAlphaProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredAvatarAlphaProgram.mFeatures.hasAtmospherics = true;
gDeferredAvatarAlphaProgram.mFeatures.hasGamma = true;
gDeferredAvatarAlphaProgram.mFeatures.isDeferred = true;
- gDeferredAvatarAlphaProgram.mFeatures.hasShadows = true;
+ gDeferredAvatarAlphaProgram.mFeatures.hasShadows = true;
gDeferredAvatarAlphaProgram.mFeatures.hasReflectionProbes = true;
- gDeferredAvatarAlphaProgram.mShaderFiles.clear();
+ gDeferredAvatarAlphaProgram.mShaderFiles.clear();
gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER));
gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER));
- gDeferredAvatarAlphaProgram.clearPermutations();
- gDeferredAvatarAlphaProgram.addPermutation("USE_DIFFUSE_TEX", "1");
- gDeferredAvatarAlphaProgram.addPermutation("IS_AVATAR_SKIN", "1");
- if (use_sun_shadow)
- {
- gDeferredAvatarAlphaProgram.addPermutation("HAS_SUN_SHADOW", "1");
- }
+ gDeferredAvatarAlphaProgram.clearPermutations();
+ gDeferredAvatarAlphaProgram.addPermutation("USE_DIFFUSE_TEX", "1");
+ gDeferredAvatarAlphaProgram.addPermutation("IS_AVATAR_SKIN", "1");
+ if (use_sun_shadow)
+ {
+ gDeferredAvatarAlphaProgram.addPermutation("HAS_SUN_SHADOW", "1");
+ }
- gDeferredAvatarAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredAvatarAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarAlphaProgram.createShader(NULL, NULL);
- llassert(success);
+ success = gDeferredAvatarAlphaProgram.createShader(NULL, NULL);
+ llassert(success);
- gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true;
- gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true;
- }
+ gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true;
+ gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true;
+ }
if (success)
{
@@ -2048,20 +2048,20 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
- if (success)
- {
- gDeferredPostGammaCorrectProgram.mName = "Deferred Gamma Correction Post Process";
- gDeferredPostGammaCorrectProgram.mFeatures.hasSrgb = true;
- gDeferredPostGammaCorrectProgram.mFeatures.isDeferred = true;
- gDeferredPostGammaCorrectProgram.mShaderFiles.clear();
+ if (success)
+ {
+ gDeferredPostGammaCorrectProgram.mName = "Deferred Gamma Correction Post Process";
+ gDeferredPostGammaCorrectProgram.mFeatures.hasSrgb = true;
+ gDeferredPostGammaCorrectProgram.mFeatures.isDeferred = true;
+ gDeferredPostGammaCorrectProgram.mShaderFiles.clear();
gDeferredPostGammaCorrectProgram.clearPermutations();
gDeferredPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
- gDeferredPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER));
+ gDeferredPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER));
gDeferredPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredPostGammaCorrectProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
+ success = gDeferredPostGammaCorrectProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
if (success)
{
gNoPostGammaCorrectProgram.mName = "No Post Gamma Correction Post Process";
@@ -2093,105 +2093,105 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
}
- if (success && gGLManager.mGLVersion > 3.9f)
- {
- gFXAAProgram.mName = "FXAA Shader";
- gFXAAProgram.mFeatures.isDeferred = true;
- gFXAAProgram.mShaderFiles.clear();
- gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER));
- gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER));
- gFXAAProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gFXAAProgram.createShader(NULL, NULL);
- llassert(success);
- }
+ if (success && gGLManager.mGLVersion > 3.9f)
+ {
+ gFXAAProgram.mName = "FXAA Shader";
+ gFXAAProgram.mFeatures.isDeferred = true;
+ gFXAAProgram.mShaderFiles.clear();
+ gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER));
+ gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER));
+ gFXAAProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gFXAAProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
- if (success)
- {
- gDeferredPostProgram.mName = "Deferred Post Shader";
+ if (success)
+ {
+ gDeferredPostProgram.mName = "Deferred Post Shader";
gDeferredPostProgram.mFeatures.isDeferred = true;
- gDeferredPostProgram.mShaderFiles.clear();
- gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
- gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredF.glsl", GL_FRAGMENT_SHADER));
- gDeferredPostProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredPostProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredCoFProgram.mName = "Deferred CoF Shader";
- gDeferredCoFProgram.mShaderFiles.clear();
- gDeferredCoFProgram.mFeatures.isDeferred = true;
- gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
- gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/cofF.glsl", GL_FRAGMENT_SHADER));
- gDeferredCoFProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredCoFProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredDoFCombineProgram.mName = "Deferred DoFCombine Shader";
- gDeferredDoFCombineProgram.mFeatures.isDeferred = true;
- gDeferredDoFCombineProgram.mShaderFiles.clear();
- gDeferredDoFCombineProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
- gDeferredDoFCombineProgram.mShaderFiles.push_back(make_pair("deferred/dofCombineF.glsl", GL_FRAGMENT_SHADER));
- gDeferredDoFCombineProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredDoFCombineProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredPostNoDoFProgram.mName = "Deferred Post NoDoF Shader";
- gDeferredPostNoDoFProgram.mFeatures.isDeferred = true;
- gDeferredPostNoDoFProgram.mShaderFiles.clear();
- gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
- gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoDoFF.glsl", GL_FRAGMENT_SHADER));
- gDeferredPostNoDoFProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredPostNoDoFProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredWLSkyProgram.mName = "Deferred Windlight Sky Shader";
- gDeferredWLSkyProgram.mShaderFiles.clear();
- gDeferredWLSkyProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredWLSkyProgram.mFeatures.hasAtmospherics = true;
- gDeferredWLSkyProgram.mFeatures.hasGamma = true;
- gDeferredWLSkyProgram.mFeatures.hasSrgb = true;
-
- gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER));
- gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER));
- gDeferredWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
-
- success = gDeferredWLSkyProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
- gDeferredWLCloudProgram.mName = "Deferred Windlight Cloud Program";
- gDeferredWLCloudProgram.mShaderFiles.clear();
- gDeferredWLCloudProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredWLCloudProgram.mFeatures.hasAtmospherics = true;
+ gDeferredPostProgram.mShaderFiles.clear();
+ gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
+ gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredPostProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredPostProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredCoFProgram.mName = "Deferred CoF Shader";
+ gDeferredCoFProgram.mShaderFiles.clear();
+ gDeferredCoFProgram.mFeatures.isDeferred = true;
+ gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
+ gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/cofF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredCoFProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredCoFProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredDoFCombineProgram.mName = "Deferred DoFCombine Shader";
+ gDeferredDoFCombineProgram.mFeatures.isDeferred = true;
+ gDeferredDoFCombineProgram.mShaderFiles.clear();
+ gDeferredDoFCombineProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
+ gDeferredDoFCombineProgram.mShaderFiles.push_back(make_pair("deferred/dofCombineF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredDoFCombineProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredDoFCombineProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredPostNoDoFProgram.mName = "Deferred Post NoDoF Shader";
+ gDeferredPostNoDoFProgram.mFeatures.isDeferred = true;
+ gDeferredPostNoDoFProgram.mShaderFiles.clear();
+ gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
+ gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoDoFF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredPostNoDoFProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredPostNoDoFProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredWLSkyProgram.mName = "Deferred Windlight Sky Shader";
+ gDeferredWLSkyProgram.mShaderFiles.clear();
+ gDeferredWLSkyProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredWLSkyProgram.mFeatures.hasAtmospherics = true;
+ gDeferredWLSkyProgram.mFeatures.hasGamma = true;
+ gDeferredWLSkyProgram.mFeatures.hasSrgb = true;
+
+ gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER));
+ gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+
+ success = gDeferredWLSkyProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gDeferredWLCloudProgram.mName = "Deferred Windlight Cloud Program";
+ gDeferredWLCloudProgram.mShaderFiles.clear();
+ gDeferredWLCloudProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredWLCloudProgram.mFeatures.hasAtmospherics = true;
gDeferredWLCloudProgram.mFeatures.hasGamma = true;
gDeferredWLCloudProgram.mFeatures.hasSrgb = true;
-
- gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsV.glsl", GL_VERTEX_SHADER));
- gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER));
- gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+
+ gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsV.glsl", GL_VERTEX_SHADER));
+ gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
gDeferredWLCloudProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113
- success = gDeferredWLCloudProgram.createShader(NULL, NULL);
- llassert(success);
- }
+ success = gDeferredWLCloudProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
- if (success)
- {
- gDeferredWLSunProgram.mName = "Deferred Windlight Sun Program";
+ if (success)
+ {
+ gDeferredWLSunProgram.mName = "Deferred Windlight Sun Program";
gDeferredWLSunProgram.mFeatures.calculatesAtmospherics = true;
gDeferredWLSunProgram.mFeatures.hasAtmospherics = true;
gDeferredWLSunProgram.mFeatures.hasGamma = true;
@@ -2216,40 +2216,40 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLMoonProgram.mFeatures.hasAtmospherics = true;
gDeferredWLMoonProgram.mFeatures.hasSrgb = true;
gDeferredWLMoonProgram.mFeatures.disableTextureIndex = true;
-
+
gDeferredWLMoonProgram.mShaderFiles.clear();
gDeferredWLMoonProgram.mShaderFiles.push_back(make_pair("deferred/moonV.glsl", GL_VERTEX_SHADER));
gDeferredWLMoonProgram.mShaderFiles.push_back(make_pair("deferred/moonF.glsl", GL_FRAGMENT_SHADER));
gDeferredWLMoonProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY;
gDeferredWLMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113
- success = gDeferredWLMoonProgram.createShader(NULL, NULL);
+ success = gDeferredWLMoonProgram.createShader(NULL, NULL);
llassert(success);
- }
-
- if (success)
- {
- gDeferredStarProgram.mName = "Deferred Star Program";
- gDeferredStarProgram.mShaderFiles.clear();
- gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsV.glsl", GL_VERTEX_SHADER));
- gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsF.glsl", GL_FRAGMENT_SHADER));
- gDeferredStarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- gDeferredStarProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+ }
+
+ if (success)
+ {
+ gDeferredStarProgram.mName = "Deferred Star Program";
+ gDeferredStarProgram.mShaderFiles.clear();
+ gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsV.glsl", GL_VERTEX_SHADER));
+ gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredStarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gDeferredStarProgram.mShaderGroup = LLGLSLShader::SG_SKY;
gDeferredStarProgram.addConstant( LLGLSLShader::SHADER_CONST_STAR_DEPTH ); // SL-14113
- success = gDeferredStarProgram.createShader(NULL, NULL);
+ success = gDeferredStarProgram.createShader(NULL, NULL);
llassert(success);
- }
+ }
- if (success)
- {
- gNormalMapGenProgram.mName = "Normal Map Generation Program";
- gNormalMapGenProgram.mShaderFiles.clear();
- gNormalMapGenProgram.mShaderFiles.push_back(make_pair("deferred/normgenV.glsl", GL_VERTEX_SHADER));
- gNormalMapGenProgram.mShaderFiles.push_back(make_pair("deferred/normgenF.glsl", GL_FRAGMENT_SHADER));
- gNormalMapGenProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- gNormalMapGenProgram.mShaderGroup = LLGLSLShader::SG_SKY;
- success = gNormalMapGenProgram.createShader(NULL, NULL);
- }
+ if (success)
+ {
+ gNormalMapGenProgram.mName = "Normal Map Generation Program";
+ gNormalMapGenProgram.mShaderFiles.clear();
+ gNormalMapGenProgram.mShaderFiles.push_back(make_pair("deferred/normgenV.glsl", GL_VERTEX_SHADER));
+ gNormalMapGenProgram.mShaderFiles.push_back(make_pair("deferred/normgenF.glsl", GL_FRAGMENT_SHADER));
+ gNormalMapGenProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gNormalMapGenProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+ success = gNormalMapGenProgram.createShader(NULL, NULL);
+ }
if (success)
{
@@ -2261,7 +2261,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
success = gDeferredGenBrdfLutProgram.createShader(NULL, NULL);
}
- if (success) {
+ if (success) {
gPostScreenSpaceReflectionProgram.mName = "Screen Space Reflection Post";
gPostScreenSpaceReflectionProgram.mShaderFiles.clear();
gPostScreenSpaceReflectionProgram.mShaderFiles.push_back(make_pair("deferred/screenSpaceReflPostV.glsl", GL_VERTEX_SHADER));
@@ -2270,24 +2270,24 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gPostScreenSpaceReflectionProgram.mFeatures.isDeferred = true;
gPostScreenSpaceReflectionProgram.mShaderLevel = 3;
success = gPostScreenSpaceReflectionProgram.createShader(NULL, NULL);
- }
-
- if (success) {
- gDeferredBufferVisualProgram.mName = "Deferred Buffer Visualization Shader";
- gDeferredBufferVisualProgram.mShaderFiles.clear();
- gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
- gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredVisualizeBuffers.glsl", GL_FRAGMENT_SHADER));
- gDeferredBufferVisualProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- success = gDeferredBufferVisualProgram.createShader(NULL, NULL);
- }
-
- return success;
+ }
+
+ if (success) {
+ gDeferredBufferVisualProgram.mName = "Deferred Buffer Visualization Shader";
+ gDeferredBufferVisualProgram.mShaderFiles.clear();
+ gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
+ gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredVisualizeBuffers.glsl", GL_FRAGMENT_SHADER));
+ gDeferredBufferVisualProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredBufferVisualProgram.createShader(NULL, NULL);
+ }
+
+ return success;
}
BOOL LLViewerShaderMgr::loadShadersObject()
{
LL_PROFILE_ZONE_SCOPED;
- BOOL success = TRUE;
+ BOOL success = TRUE;
if (success)
{
@@ -2312,66 +2312,66 @@ BOOL LLViewerShaderMgr::loadShadersObject()
}
}
- if (success)
- {
- gObjectAlphaMaskNoColorProgram.mName = "No color alpha mask Shader";
- gObjectAlphaMaskNoColorProgram.mFeatures.calculatesLighting = true;
- gObjectAlphaMaskNoColorProgram.mFeatures.calculatesAtmospherics = true;
- gObjectAlphaMaskNoColorProgram.mFeatures.hasGamma = true;
- gObjectAlphaMaskNoColorProgram.mFeatures.hasAtmospherics = true;
- gObjectAlphaMaskNoColorProgram.mFeatures.hasLighting = true;
- gObjectAlphaMaskNoColorProgram.mFeatures.disableTextureIndex = true;
- gObjectAlphaMaskNoColorProgram.mFeatures.hasAlphaMask = true;
- gObjectAlphaMaskNoColorProgram.mShaderFiles.clear();
- gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER));
- gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER));
- gObjectAlphaMaskNoColorProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT];
- success = gObjectAlphaMaskNoColorProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gImpostorProgram.mName = "Impostor Shader";
- gImpostorProgram.mFeatures.disableTextureIndex = true;
- gImpostorProgram.mFeatures.hasSrgb = true;
- gImpostorProgram.mShaderFiles.clear();
- gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorV.glsl", GL_VERTEX_SHADER));
- gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorF.glsl", GL_FRAGMENT_SHADER));
- gImpostorProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT];
- success = gImpostorProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gObjectPreviewProgram.mName = "Object Preview Shader";
- gObjectPreviewProgram.mFeatures.disableTextureIndex = true;
- gObjectPreviewProgram.mShaderFiles.clear();
- gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewV.glsl", GL_VERTEX_SHADER));
- gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewF.glsl", GL_FRAGMENT_SHADER));
- gObjectPreviewProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT];
+ if (success)
+ {
+ gObjectAlphaMaskNoColorProgram.mName = "No color alpha mask Shader";
+ gObjectAlphaMaskNoColorProgram.mFeatures.calculatesLighting = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasGamma = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasAtmospherics = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasLighting = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.disableTextureIndex = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasAlphaMask = true;
+ gObjectAlphaMaskNoColorProgram.mShaderFiles.clear();
+ gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER));
+ gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER));
+ gObjectAlphaMaskNoColorProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT];
+ success = gObjectAlphaMaskNoColorProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gImpostorProgram.mName = "Impostor Shader";
+ gImpostorProgram.mFeatures.disableTextureIndex = true;
+ gImpostorProgram.mFeatures.hasSrgb = true;
+ gImpostorProgram.mShaderFiles.clear();
+ gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorV.glsl", GL_VERTEX_SHADER));
+ gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorF.glsl", GL_FRAGMENT_SHADER));
+ gImpostorProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT];
+ success = gImpostorProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectPreviewProgram.mName = "Object Preview Shader";
+ gObjectPreviewProgram.mFeatures.disableTextureIndex = true;
+ gObjectPreviewProgram.mShaderFiles.clear();
+ gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewV.glsl", GL_VERTEX_SHADER));
+ gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewF.glsl", GL_FRAGMENT_SHADER));
+ gObjectPreviewProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT];
success = make_rigged_variant(gObjectPreviewProgram, gSkinnedObjectPreviewProgram);
- success = gObjectPreviewProgram.createShader(NULL, NULL);
- gObjectPreviewProgram.mFeatures.hasLighting = true;
+ success = gObjectPreviewProgram.createShader(NULL, NULL);
+ gObjectPreviewProgram.mFeatures.hasLighting = true;
gSkinnedObjectPreviewProgram.mFeatures.hasLighting = true;
- }
-
- if (success)
- {
- gPhysicsPreviewProgram.mName = "Preview Physics Shader";
- gPhysicsPreviewProgram.mFeatures.calculatesLighting = false;
- gPhysicsPreviewProgram.mFeatures.calculatesAtmospherics = false;
- gPhysicsPreviewProgram.mFeatures.hasGamma = false;
- gPhysicsPreviewProgram.mFeatures.hasAtmospherics = false;
- gPhysicsPreviewProgram.mFeatures.hasLighting = false;
- gPhysicsPreviewProgram.mFeatures.mIndexedTextureChannels = 0;
- gPhysicsPreviewProgram.mFeatures.disableTextureIndex = true;
- gPhysicsPreviewProgram.mShaderFiles.clear();
- gPhysicsPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewPhysicsV.glsl", GL_VERTEX_SHADER));
- gPhysicsPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewPhysicsF.glsl", GL_FRAGMENT_SHADER));
- gPhysicsPreviewProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT];
- success = gPhysicsPreviewProgram.createShader(NULL, NULL);
- gPhysicsPreviewProgram.mFeatures.hasLighting = false;
- }
+ }
+
+ if (success)
+ {
+ gPhysicsPreviewProgram.mName = "Preview Physics Shader";
+ gPhysicsPreviewProgram.mFeatures.calculatesLighting = false;
+ gPhysicsPreviewProgram.mFeatures.calculatesAtmospherics = false;
+ gPhysicsPreviewProgram.mFeatures.hasGamma = false;
+ gPhysicsPreviewProgram.mFeatures.hasAtmospherics = false;
+ gPhysicsPreviewProgram.mFeatures.hasLighting = false;
+ gPhysicsPreviewProgram.mFeatures.mIndexedTextureChannels = 0;
+ gPhysicsPreviewProgram.mFeatures.disableTextureIndex = true;
+ gPhysicsPreviewProgram.mShaderFiles.clear();
+ gPhysicsPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewPhysicsV.glsl", GL_VERTEX_SHADER));
+ gPhysicsPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewPhysicsF.glsl", GL_FRAGMENT_SHADER));
+ gPhysicsPreviewProgram.mShaderLevel = mShaderLevel[SHADER_OBJECT];
+ success = gPhysicsPreviewProgram.createShader(NULL, NULL);
+ gPhysicsPreviewProgram.mFeatures.hasLighting = false;
+ }
if (!success)
{
@@ -2379,234 +2379,234 @@ BOOL LLViewerShaderMgr::loadShadersObject()
return FALSE;
}
- return TRUE;
+ return TRUE;
}
BOOL LLViewerShaderMgr::loadShadersAvatar()
{
LL_PROFILE_ZONE_SCOPED;
#if 1 // DEPRECATED -- forward rendering is deprecated
- BOOL success = TRUE;
-
- if (mShaderLevel[SHADER_AVATAR] == 0)
- {
- gAvatarProgram.unload();
- gAvatarEyeballProgram.unload();
- return TRUE;
- }
-
- if (success)
- {
- gAvatarProgram.mName = "Avatar Shader";
- gAvatarProgram.mFeatures.hasSkinning = true;
- gAvatarProgram.mFeatures.calculatesAtmospherics = true;
- gAvatarProgram.mFeatures.calculatesLighting = true;
- gAvatarProgram.mFeatures.hasGamma = true;
- gAvatarProgram.mFeatures.hasAtmospherics = true;
- gAvatarProgram.mFeatures.hasLighting = true;
- gAvatarProgram.mFeatures.hasAlphaMask = true;
- gAvatarProgram.mFeatures.disableTextureIndex = true;
- gAvatarProgram.mShaderFiles.clear();
- gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER));
- gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER));
- gAvatarProgram.mShaderLevel = mShaderLevel[SHADER_AVATAR];
- success = gAvatarProgram.createShader(NULL, NULL);
-
- /// Keep track of avatar levels
- if (gAvatarProgram.mShaderLevel != mShaderLevel[SHADER_AVATAR])
- {
- mMaxAvatarShaderLevel = mShaderLevel[SHADER_AVATAR] = gAvatarProgram.mShaderLevel;
- }
- }
-
- if (success)
- {
- gAvatarEyeballProgram.mName = "Avatar Eyeball Program";
- gAvatarEyeballProgram.mFeatures.calculatesLighting = true;
- gAvatarEyeballProgram.mFeatures.isSpecular = true;
- gAvatarEyeballProgram.mFeatures.calculatesAtmospherics = true;
- gAvatarEyeballProgram.mFeatures.hasGamma = true;
- gAvatarEyeballProgram.mFeatures.hasAtmospherics = true;
- gAvatarEyeballProgram.mFeatures.hasLighting = true;
- gAvatarEyeballProgram.mFeatures.hasAlphaMask = true;
- gAvatarEyeballProgram.mFeatures.disableTextureIndex = true;
- gAvatarEyeballProgram.mShaderFiles.clear();
- gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballV.glsl", GL_VERTEX_SHADER));
- gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballF.glsl", GL_FRAGMENT_SHADER));
- gAvatarEyeballProgram.mShaderLevel = mShaderLevel[SHADER_AVATAR];
- success = gAvatarEyeballProgram.createShader(NULL, NULL);
- }
-
- if( !success )
- {
- mShaderLevel[SHADER_AVATAR] = 0;
- mMaxAvatarShaderLevel = 0;
- return FALSE;
- }
+ BOOL success = TRUE;
+
+ if (mShaderLevel[SHADER_AVATAR] == 0)
+ {
+ gAvatarProgram.unload();
+ gAvatarEyeballProgram.unload();
+ return TRUE;
+ }
+
+ if (success)
+ {
+ gAvatarProgram.mName = "Avatar Shader";
+ gAvatarProgram.mFeatures.hasSkinning = true;
+ gAvatarProgram.mFeatures.calculatesAtmospherics = true;
+ gAvatarProgram.mFeatures.calculatesLighting = true;
+ gAvatarProgram.mFeatures.hasGamma = true;
+ gAvatarProgram.mFeatures.hasAtmospherics = true;
+ gAvatarProgram.mFeatures.hasLighting = true;
+ gAvatarProgram.mFeatures.hasAlphaMask = true;
+ gAvatarProgram.mFeatures.disableTextureIndex = true;
+ gAvatarProgram.mShaderFiles.clear();
+ gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER));
+ gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER));
+ gAvatarProgram.mShaderLevel = mShaderLevel[SHADER_AVATAR];
+ success = gAvatarProgram.createShader(NULL, NULL);
+
+ /// Keep track of avatar levels
+ if (gAvatarProgram.mShaderLevel != mShaderLevel[SHADER_AVATAR])
+ {
+ mMaxAvatarShaderLevel = mShaderLevel[SHADER_AVATAR] = gAvatarProgram.mShaderLevel;
+ }
+ }
+
+ if (success)
+ {
+ gAvatarEyeballProgram.mName = "Avatar Eyeball Program";
+ gAvatarEyeballProgram.mFeatures.calculatesLighting = true;
+ gAvatarEyeballProgram.mFeatures.isSpecular = true;
+ gAvatarEyeballProgram.mFeatures.calculatesAtmospherics = true;
+ gAvatarEyeballProgram.mFeatures.hasGamma = true;
+ gAvatarEyeballProgram.mFeatures.hasAtmospherics = true;
+ gAvatarEyeballProgram.mFeatures.hasLighting = true;
+ gAvatarEyeballProgram.mFeatures.hasAlphaMask = true;
+ gAvatarEyeballProgram.mFeatures.disableTextureIndex = true;
+ gAvatarEyeballProgram.mShaderFiles.clear();
+ gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballV.glsl", GL_VERTEX_SHADER));
+ gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballF.glsl", GL_FRAGMENT_SHADER));
+ gAvatarEyeballProgram.mShaderLevel = mShaderLevel[SHADER_AVATAR];
+ success = gAvatarEyeballProgram.createShader(NULL, NULL);
+ }
+
+ if( !success )
+ {
+ mShaderLevel[SHADER_AVATAR] = 0;
+ mMaxAvatarShaderLevel = 0;
+ return FALSE;
+ }
#endif
- return TRUE;
+ return TRUE;
}
BOOL LLViewerShaderMgr::loadShadersInterface()
{
LL_PROFILE_ZONE_SCOPED;
- BOOL success = TRUE;
-
- if (success)
- {
- gHighlightProgram.mName = "Highlight Shader";
- gHighlightProgram.mShaderFiles.clear();
- gHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER));
- gHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER));
- gHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ BOOL success = TRUE;
+
+ if (success)
+ {
+ gHighlightProgram.mName = "Highlight Shader";
+ gHighlightProgram.mShaderFiles.clear();
+ gHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER));
+ gHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER));
+ gHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
success = make_rigged_variant(gHighlightProgram, gSkinnedHighlightProgram);
- success = success && gHighlightProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gHighlightNormalProgram.mName = "Highlight Normals Shader";
- gHighlightNormalProgram.mShaderFiles.clear();
- gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightNormV.glsl", GL_VERTEX_SHADER));
- gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER));
- gHighlightNormalProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gHighlightNormalProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gHighlightSpecularProgram.mName = "Highlight Spec Shader";
- gHighlightSpecularProgram.mShaderFiles.clear();
- gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightSpecV.glsl", GL_VERTEX_SHADER));
- gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER));
- gHighlightSpecularProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gHighlightSpecularProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gUIProgram.mName = "UI Shader";
- gUIProgram.mShaderFiles.clear();
- gUIProgram.mShaderFiles.push_back(make_pair("interface/uiV.glsl", GL_VERTEX_SHADER));
- gUIProgram.mShaderFiles.push_back(make_pair("interface/uiF.glsl", GL_FRAGMENT_SHADER));
- gUIProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gUIProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gPathfindingProgram.mName = "Pathfinding Shader";
- gPathfindingProgram.mShaderFiles.clear();
- gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingV.glsl", GL_VERTEX_SHADER));
- gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER));
- gPathfindingProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gPathfindingProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gPathfindingNoNormalsProgram.mName = "PathfindingNoNormals Shader";
- gPathfindingNoNormalsProgram.mShaderFiles.clear();
- gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingNoNormalV.glsl", GL_VERTEX_SHADER));
- gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER));
- gPathfindingNoNormalsProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gPathfindingNoNormalsProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gGlowCombineProgram.mName = "Glow Combine Shader";
- gGlowCombineProgram.mShaderFiles.clear();
- gGlowCombineProgram.mShaderFiles.push_back(make_pair("interface/glowcombineV.glsl", GL_VERTEX_SHADER));
- gGlowCombineProgram.mShaderFiles.push_back(make_pair("interface/glowcombineF.glsl", GL_FRAGMENT_SHADER));
- gGlowCombineProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gGlowCombineProgram.createShader(NULL, NULL);
- if (success)
- {
- gGlowCombineProgram.bind();
- gGlowCombineProgram.uniform1i(sGlowMap, 0);
- gGlowCombineProgram.uniform1i(sScreenMap, 1);
- gGlowCombineProgram.unbind();
- }
- }
-
- if (success)
- {
- gGlowCombineFXAAProgram.mName = "Glow CombineFXAA Shader";
- gGlowCombineFXAAProgram.mShaderFiles.clear();
- gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAV.glsl", GL_VERTEX_SHADER));
- gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAF.glsl", GL_FRAGMENT_SHADER));
- gGlowCombineFXAAProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gGlowCombineFXAAProgram.createShader(NULL, NULL);
- if (success)
- {
- gGlowCombineFXAAProgram.bind();
- gGlowCombineFXAAProgram.uniform1i(sGlowMap, 0);
- gGlowCombineFXAAProgram.uniform1i(sScreenMap, 1);
- gGlowCombineFXAAProgram.unbind();
- }
- }
+ success = success && gHighlightProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gHighlightNormalProgram.mName = "Highlight Normals Shader";
+ gHighlightNormalProgram.mShaderFiles.clear();
+ gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightNormV.glsl", GL_VERTEX_SHADER));
+ gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER));
+ gHighlightNormalProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gHighlightNormalProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gHighlightSpecularProgram.mName = "Highlight Spec Shader";
+ gHighlightSpecularProgram.mShaderFiles.clear();
+ gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightSpecV.glsl", GL_VERTEX_SHADER));
+ gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER));
+ gHighlightSpecularProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gHighlightSpecularProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gUIProgram.mName = "UI Shader";
+ gUIProgram.mShaderFiles.clear();
+ gUIProgram.mShaderFiles.push_back(make_pair("interface/uiV.glsl", GL_VERTEX_SHADER));
+ gUIProgram.mShaderFiles.push_back(make_pair("interface/uiF.glsl", GL_FRAGMENT_SHADER));
+ gUIProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gUIProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gPathfindingProgram.mName = "Pathfinding Shader";
+ gPathfindingProgram.mShaderFiles.clear();
+ gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingV.glsl", GL_VERTEX_SHADER));
+ gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER));
+ gPathfindingProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gPathfindingProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gPathfindingNoNormalsProgram.mName = "PathfindingNoNormals Shader";
+ gPathfindingNoNormalsProgram.mShaderFiles.clear();
+ gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingNoNormalV.glsl", GL_VERTEX_SHADER));
+ gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER));
+ gPathfindingNoNormalsProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gPathfindingNoNormalsProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gGlowCombineProgram.mName = "Glow Combine Shader";
+ gGlowCombineProgram.mShaderFiles.clear();
+ gGlowCombineProgram.mShaderFiles.push_back(make_pair("interface/glowcombineV.glsl", GL_VERTEX_SHADER));
+ gGlowCombineProgram.mShaderFiles.push_back(make_pair("interface/glowcombineF.glsl", GL_FRAGMENT_SHADER));
+ gGlowCombineProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gGlowCombineProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gGlowCombineProgram.bind();
+ gGlowCombineProgram.uniform1i(sGlowMap, 0);
+ gGlowCombineProgram.uniform1i(sScreenMap, 1);
+ gGlowCombineProgram.unbind();
+ }
+ }
+
+ if (success)
+ {
+ gGlowCombineFXAAProgram.mName = "Glow CombineFXAA Shader";
+ gGlowCombineFXAAProgram.mShaderFiles.clear();
+ gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAV.glsl", GL_VERTEX_SHADER));
+ gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAF.glsl", GL_FRAGMENT_SHADER));
+ gGlowCombineFXAAProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gGlowCombineFXAAProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gGlowCombineFXAAProgram.bind();
+ gGlowCombineFXAAProgram.uniform1i(sGlowMap, 0);
+ gGlowCombineFXAAProgram.uniform1i(sScreenMap, 1);
+ gGlowCombineFXAAProgram.unbind();
+ }
+ }
#ifdef LL_WINDOWS
- if (success)
- {
- gTwoTextureCompareProgram.mName = "Two Texture Compare Shader";
- gTwoTextureCompareProgram.mShaderFiles.clear();
- gTwoTextureCompareProgram.mShaderFiles.push_back(make_pair("interface/twotexturecompareV.glsl", GL_VERTEX_SHADER));
- gTwoTextureCompareProgram.mShaderFiles.push_back(make_pair("interface/twotexturecompareF.glsl", GL_FRAGMENT_SHADER));
- gTwoTextureCompareProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gTwoTextureCompareProgram.createShader(NULL, NULL);
- if (success)
- {
- gTwoTextureCompareProgram.bind();
- gTwoTextureCompareProgram.uniform1i(sTex0, 0);
- gTwoTextureCompareProgram.uniform1i(sTex1, 1);
- gTwoTextureCompareProgram.uniform1i(sDitherTex, 2);
- }
- }
-
- if (success)
- {
- gOneTextureFilterProgram.mName = "One Texture Filter Shader";
- gOneTextureFilterProgram.mShaderFiles.clear();
- gOneTextureFilterProgram.mShaderFiles.push_back(make_pair("interface/onetexturefilterV.glsl", GL_VERTEX_SHADER));
- gOneTextureFilterProgram.mShaderFiles.push_back(make_pair("interface/onetexturefilterF.glsl", GL_FRAGMENT_SHADER));
- gOneTextureFilterProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gOneTextureFilterProgram.createShader(NULL, NULL);
- if (success)
- {
- gOneTextureFilterProgram.bind();
- gOneTextureFilterProgram.uniform1i(sTex0, 0);
- }
- }
+ if (success)
+ {
+ gTwoTextureCompareProgram.mName = "Two Texture Compare Shader";
+ gTwoTextureCompareProgram.mShaderFiles.clear();
+ gTwoTextureCompareProgram.mShaderFiles.push_back(make_pair("interface/twotexturecompareV.glsl", GL_VERTEX_SHADER));
+ gTwoTextureCompareProgram.mShaderFiles.push_back(make_pair("interface/twotexturecompareF.glsl", GL_FRAGMENT_SHADER));
+ gTwoTextureCompareProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gTwoTextureCompareProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gTwoTextureCompareProgram.bind();
+ gTwoTextureCompareProgram.uniform1i(sTex0, 0);
+ gTwoTextureCompareProgram.uniform1i(sTex1, 1);
+ gTwoTextureCompareProgram.uniform1i(sDitherTex, 2);
+ }
+ }
+
+ if (success)
+ {
+ gOneTextureFilterProgram.mName = "One Texture Filter Shader";
+ gOneTextureFilterProgram.mShaderFiles.clear();
+ gOneTextureFilterProgram.mShaderFiles.push_back(make_pair("interface/onetexturefilterV.glsl", GL_VERTEX_SHADER));
+ gOneTextureFilterProgram.mShaderFiles.push_back(make_pair("interface/onetexturefilterF.glsl", GL_FRAGMENT_SHADER));
+ gOneTextureFilterProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gOneTextureFilterProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gOneTextureFilterProgram.bind();
+ gOneTextureFilterProgram.uniform1i(sTex0, 0);
+ }
+ }
#endif
- if (success)
- {
- gSolidColorProgram.mName = "Solid Color Shader";
- gSolidColorProgram.mShaderFiles.clear();
- gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorV.glsl", GL_VERTEX_SHADER));
- gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorF.glsl", GL_FRAGMENT_SHADER));
- gSolidColorProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gSolidColorProgram.createShader(NULL, NULL);
- if (success)
- {
- gSolidColorProgram.bind();
- gSolidColorProgram.uniform1i(sTex0, 0);
- gSolidColorProgram.unbind();
- }
- }
-
- if (success)
- {
- gOcclusionProgram.mName = "Occlusion Shader";
- gOcclusionProgram.mShaderFiles.clear();
- gOcclusionProgram.mShaderFiles.push_back(make_pair("interface/occlusionV.glsl", GL_VERTEX_SHADER));
- gOcclusionProgram.mShaderFiles.push_back(make_pair("interface/occlusionF.glsl", GL_FRAGMENT_SHADER));
- gOcclusionProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ if (success)
+ {
+ gSolidColorProgram.mName = "Solid Color Shader";
+ gSolidColorProgram.mShaderFiles.clear();
+ gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorV.glsl", GL_VERTEX_SHADER));
+ gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorF.glsl", GL_FRAGMENT_SHADER));
+ gSolidColorProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gSolidColorProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gSolidColorProgram.bind();
+ gSolidColorProgram.uniform1i(sTex0, 0);
+ gSolidColorProgram.unbind();
+ }
+ }
+
+ if (success)
+ {
+ gOcclusionProgram.mName = "Occlusion Shader";
+ gOcclusionProgram.mShaderFiles.clear();
+ gOcclusionProgram.mShaderFiles.push_back(make_pair("interface/occlusionV.glsl", GL_VERTEX_SHADER));
+ gOcclusionProgram.mShaderFiles.push_back(make_pair("interface/occlusionF.glsl", GL_FRAGMENT_SHADER));
+ gOcclusionProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
gOcclusionProgram.mRiggedVariant = &gSkinnedOcclusionProgram;
- success = gOcclusionProgram.createShader(NULL, NULL);
- }
+ success = gOcclusionProgram.createShader(NULL, NULL);
+ }
if (success)
{
@@ -2619,47 +2619,47 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
success = gSkinnedOcclusionProgram.createShader(NULL, NULL);
}
- if (success)
- {
- gOcclusionCubeProgram.mName = "Occlusion Cube Shader";
- gOcclusionCubeProgram.mShaderFiles.clear();
- gOcclusionCubeProgram.mShaderFiles.push_back(make_pair("interface/occlusionCubeV.glsl", GL_VERTEX_SHADER));
- gOcclusionCubeProgram.mShaderFiles.push_back(make_pair("interface/occlusionF.glsl", GL_FRAGMENT_SHADER));
- gOcclusionCubeProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gOcclusionCubeProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gDebugProgram.mName = "Debug Shader";
- gDebugProgram.mShaderFiles.clear();
- gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugV.glsl", GL_VERTEX_SHADER));
- gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugF.glsl", GL_FRAGMENT_SHADER));
+ if (success)
+ {
+ gOcclusionCubeProgram.mName = "Occlusion Cube Shader";
+ gOcclusionCubeProgram.mShaderFiles.clear();
+ gOcclusionCubeProgram.mShaderFiles.push_back(make_pair("interface/occlusionCubeV.glsl", GL_VERTEX_SHADER));
+ gOcclusionCubeProgram.mShaderFiles.push_back(make_pair("interface/occlusionF.glsl", GL_FRAGMENT_SHADER));
+ gOcclusionCubeProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gOcclusionCubeProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gDebugProgram.mName = "Debug Shader";
+ gDebugProgram.mShaderFiles.clear();
+ gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugV.glsl", GL_VERTEX_SHADER));
+ gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugF.glsl", GL_FRAGMENT_SHADER));
gDebugProgram.mRiggedVariant = &gSkinnedDebugProgram;
- gDebugProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ gDebugProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
success = make_rigged_variant(gDebugProgram, gSkinnedDebugProgram);
- success = success && gDebugProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gClipProgram.mName = "Clip Shader";
- gClipProgram.mShaderFiles.clear();
- gClipProgram.mShaderFiles.push_back(make_pair("interface/clipV.glsl", GL_VERTEX_SHADER));
- gClipProgram.mShaderFiles.push_back(make_pair("interface/clipF.glsl", GL_FRAGMENT_SHADER));
- gClipProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gClipProgram.createShader(NULL, NULL);
- }
-
- if (success)
- {
- gBenchmarkProgram.mName = "Benchmark Shader";
- gBenchmarkProgram.mShaderFiles.clear();
- gBenchmarkProgram.mShaderFiles.push_back(make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER));
- gBenchmarkProgram.mShaderFiles.push_back(make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER));
- gBenchmarkProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gBenchmarkProgram.createShader(NULL, NULL);
- }
+ success = success && gDebugProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gClipProgram.mName = "Clip Shader";
+ gClipProgram.mShaderFiles.clear();
+ gClipProgram.mShaderFiles.push_back(make_pair("interface/clipV.glsl", GL_VERTEX_SHADER));
+ gClipProgram.mShaderFiles.push_back(make_pair("interface/clipF.glsl", GL_FRAGMENT_SHADER));
+ gClipProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gClipProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gBenchmarkProgram.mName = "Benchmark Shader";
+ gBenchmarkProgram.mShaderFiles.clear();
+ gBenchmarkProgram.mShaderFiles.push_back(make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER));
+ gBenchmarkProgram.mShaderFiles.push_back(make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER));
+ gBenchmarkProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gBenchmarkProgram.createShader(NULL, NULL);
+ }
if (success)
{
@@ -2698,16 +2698,16 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
gCopyDepthProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
success = gCopyDepthProgram.createShader(NULL, NULL);
}
-
- if (success)
- {
- gAlphaMaskProgram.mName = "Alpha Mask Shader";
- gAlphaMaskProgram.mShaderFiles.clear();
- gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskV.glsl", GL_VERTEX_SHADER));
- gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskF.glsl", GL_FRAGMENT_SHADER));
- gAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- success = gAlphaMaskProgram.createShader(NULL, NULL);
- }
+
+ if (success)
+ {
+ gAlphaMaskProgram.mName = "Alpha Mask Shader";
+ gAlphaMaskProgram.mShaderFiles.clear();
+ gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskV.glsl", GL_VERTEX_SHADER));
+ gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskF.glsl", GL_FRAGMENT_SHADER));
+ gAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ success = gAlphaMaskProgram.createShader(NULL, NULL);
+ }
if (success)
{
@@ -2757,19 +2757,19 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
success = gIrradianceGenProgram.createShader(NULL, NULL);
}
- if( !success )
- {
- mShaderLevel[SHADER_INTERFACE] = 0;
- return FALSE;
- }
-
- return TRUE;
+ if( !success )
+ {
+ mShaderLevel[SHADER_INTERFACE] = 0;
+ return FALSE;
+ }
+
+ return TRUE;
}
std::string LLViewerShaderMgr::getShaderDirPrefix(void)
{
- return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/class");
+ return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/class");
}
void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader * shader)
@@ -2779,11 +2779,11 @@ void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader * shader)
LLViewerShaderMgr::shader_iter LLViewerShaderMgr::beginShaders() const
{
- return mShaderList.begin();
+ return mShaderList.begin();
}
LLViewerShaderMgr::shader_iter LLViewerShaderMgr::endShaders() const
{
- return mShaderList.end();
+ return mShaderList.end();
}
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 04da7e48ae..a6a70236cc 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewershadermgr.h
* @brief Viewer Shader Manager
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,237 +35,237 @@
class LLViewerShaderMgr: public LLShaderMgr
{
public:
- static BOOL sInitialized;
- static bool sSkipReload;
+ static BOOL sInitialized;
+ static bool sSkipReload;
- LLViewerShaderMgr();
- /* virtual */ ~LLViewerShaderMgr();
+ LLViewerShaderMgr();
+ /* virtual */ ~LLViewerShaderMgr();
- // singleton pattern implementation
- static LLViewerShaderMgr * instance();
- static void releaseInstance();
+ // singleton pattern implementation
+ static LLViewerShaderMgr * instance();
+ static void releaseInstance();
- void initAttribsAndUniforms(void);
- void setShaders();
- void unloadShaders();
+ void initAttribsAndUniforms(void);
+ void setShaders();
+ void unloadShaders();
S32 getShaderLevel(S32 type);
// loadBasicShaders in case of a failure returns
// name of a file error happened at, otherwise
// returns an empty string
std::string loadBasicShaders();
- BOOL loadShadersEffects();
- BOOL loadShadersDeferred();
- BOOL loadShadersObject();
- BOOL loadShadersAvatar();
- BOOL loadShadersWater();
- BOOL loadShadersInterface();
-
- std::vector<S32> mShaderLevel;
- S32 mMaxAvatarShaderLevel;
-
- enum EShaderClass
- {
- SHADER_LIGHTING,
- SHADER_OBJECT,
- SHADER_AVATAR,
- SHADER_ENVIRONMENT,
- SHADER_INTERFACE,
- SHADER_EFFECT,
- SHADER_WINDLIGHT,
- SHADER_WATER,
- SHADER_DEFERRED,
- SHADER_COUNT
- };
-
- // simple model of forward iterator
- // http://www.sgi.com/tech/stl/ForwardIterator.html
- class shader_iter
- {
- private:
- friend bool operator == (shader_iter const & a, shader_iter const & b);
- friend bool operator != (shader_iter const & a, shader_iter const & b);
-
- typedef std::vector<LLGLSLShader *>::const_iterator base_iter_t;
- public:
- shader_iter()
- {
- }
-
- shader_iter(base_iter_t iter) : mIter(iter)
- {
- }
-
- LLGLSLShader & operator * () const
- {
- return **mIter;
- }
-
- LLGLSLShader * operator -> () const
- {
- return *mIter;
- }
-
- shader_iter & operator++ ()
- {
- ++mIter;
- return *this;
- }
-
- shader_iter operator++ (int)
- {
- return mIter++;
- }
-
- private:
- base_iter_t mIter;
- };
-
- shader_iter beginShaders() const;
- shader_iter endShaders() const;
-
- /* virtual */ std::string getShaderDirPrefix(void);
-
- /* virtual */ void updateShaderUniforms(LLGLSLShader * shader);
+ BOOL loadShadersEffects();
+ BOOL loadShadersDeferred();
+ BOOL loadShadersObject();
+ BOOL loadShadersAvatar();
+ BOOL loadShadersWater();
+ BOOL loadShadersInterface();
+
+ std::vector<S32> mShaderLevel;
+ S32 mMaxAvatarShaderLevel;
+
+ enum EShaderClass
+ {
+ SHADER_LIGHTING,
+ SHADER_OBJECT,
+ SHADER_AVATAR,
+ SHADER_ENVIRONMENT,
+ SHADER_INTERFACE,
+ SHADER_EFFECT,
+ SHADER_WINDLIGHT,
+ SHADER_WATER,
+ SHADER_DEFERRED,
+ SHADER_COUNT
+ };
+
+ // simple model of forward iterator
+ // http://www.sgi.com/tech/stl/ForwardIterator.html
+ class shader_iter
+ {
+ private:
+ friend bool operator == (shader_iter const & a, shader_iter const & b);
+ friend bool operator != (shader_iter const & a, shader_iter const & b);
+
+ typedef std::vector<LLGLSLShader *>::const_iterator base_iter_t;
+ public:
+ shader_iter()
+ {
+ }
+
+ shader_iter(base_iter_t iter) : mIter(iter)
+ {
+ }
+
+ LLGLSLShader & operator * () const
+ {
+ return **mIter;
+ }
+
+ LLGLSLShader * operator -> () const
+ {
+ return *mIter;
+ }
+
+ shader_iter & operator++ ()
+ {
+ ++mIter;
+ return *this;
+ }
+
+ shader_iter operator++ (int)
+ {
+ return mIter++;
+ }
+
+ private:
+ base_iter_t mIter;
+ };
+
+ shader_iter beginShaders() const;
+ shader_iter endShaders() const;
+
+ /* virtual */ std::string getShaderDirPrefix(void);
+
+ /* virtual */ void updateShaderUniforms(LLGLSLShader * shader);
private:
- // the list of shaders we need to propagate parameters to.
- std::vector<LLGLSLShader *> mShaderList;
+ // the list of shaders we need to propagate parameters to.
+ std::vector<LLGLSLShader *> mShaderList;
}; //LLViewerShaderMgr
inline bool operator == (LLViewerShaderMgr::shader_iter const & a, LLViewerShaderMgr::shader_iter const & b)
{
- return a.mIter == b.mIter;
+ return a.mIter == b.mIter;
}
inline bool operator != (LLViewerShaderMgr::shader_iter const & a, LLViewerShaderMgr::shader_iter const & b)
{
- return a.mIter != b.mIter;
+ return a.mIter != b.mIter;
}
-extern LLVector4 gShinyOrigin;
+extern LLVector4 gShinyOrigin;
//utility shaders
-extern LLGLSLShader gOcclusionProgram;
-extern LLGLSLShader gOcclusionCubeProgram;
-extern LLGLSLShader gGlowCombineProgram;
-extern LLGLSLShader gReflectionMipProgram;
+extern LLGLSLShader gOcclusionProgram;
+extern LLGLSLShader gOcclusionCubeProgram;
+extern LLGLSLShader gGlowCombineProgram;
+extern LLGLSLShader gReflectionMipProgram;
extern LLGLSLShader gGaussianProgram;
extern LLGLSLShader gRadianceGenProgram;
extern LLGLSLShader gIrradianceGenProgram;
-extern LLGLSLShader gGlowCombineFXAAProgram;
-extern LLGLSLShader gDebugProgram;
-extern LLGLSLShader gClipProgram;
-extern LLGLSLShader gBenchmarkProgram;
+extern LLGLSLShader gGlowCombineFXAAProgram;
+extern LLGLSLShader gDebugProgram;
+extern LLGLSLShader gClipProgram;
+extern LLGLSLShader gBenchmarkProgram;
extern LLGLSLShader gReflectionProbeDisplayProgram;
extern LLGLSLShader gCopyProgram;
extern LLGLSLShader gCopyDepthProgram;
//output tex0[tc0] - tex1[tc1]
-extern LLGLSLShader gTwoTextureCompareProgram;
+extern LLGLSLShader gTwoTextureCompareProgram;
//discard some fragments based on user-set color tolerance
-extern LLGLSLShader gOneTextureFilterProgram;
-
+extern LLGLSLShader gOneTextureFilterProgram;
+
//object shaders
-extern LLGLSLShader gObjectPreviewProgram;
+extern LLGLSLShader gObjectPreviewProgram;
extern LLGLSLShader gPhysicsPreviewProgram;
extern LLGLSLShader gSkinnedObjectFullbrightAlphaMaskProgram;
-extern LLGLSLShader gObjectBumpProgram;
+extern LLGLSLShader gObjectBumpProgram;
extern LLGLSLShader gSkinnedObjectBumpProgram;
-extern LLGLSLShader gObjectAlphaMaskNoColorProgram;
+extern LLGLSLShader gObjectAlphaMaskNoColorProgram;
//environment shaders
-extern LLGLSLShader gWaterProgram;
-extern LLGLSLShader gWaterEdgeProgram;
-extern LLGLSLShader gUnderWaterProgram;
-extern LLGLSLShader gGlowProgram;
-extern LLGLSLShader gGlowExtractProgram;
+extern LLGLSLShader gWaterProgram;
+extern LLGLSLShader gWaterEdgeProgram;
+extern LLGLSLShader gUnderWaterProgram;
+extern LLGLSLShader gGlowProgram;
+extern LLGLSLShader gGlowExtractProgram;
//interface shaders
-extern LLGLSLShader gHighlightProgram;
-extern LLGLSLShader gHighlightNormalProgram;
-extern LLGLSLShader gHighlightSpecularProgram;
+extern LLGLSLShader gHighlightProgram;
+extern LLGLSLShader gHighlightNormalProgram;
+extern LLGLSLShader gHighlightSpecularProgram;
-extern LLGLSLShader gDeferredHighlightProgram;
+extern LLGLSLShader gDeferredHighlightProgram;
-extern LLGLSLShader gPathfindingProgram;
-extern LLGLSLShader gPathfindingNoNormalsProgram;
+extern LLGLSLShader gPathfindingProgram;
+extern LLGLSLShader gPathfindingNoNormalsProgram;
// avatar shader handles
-extern LLGLSLShader gAvatarProgram;
-extern LLGLSLShader gAvatarEyeballProgram;
-extern LLGLSLShader gImpostorProgram;
+extern LLGLSLShader gAvatarProgram;
+extern LLGLSLShader gAvatarEyeballProgram;
+extern LLGLSLShader gImpostorProgram;
// Post Process Shaders
extern LLGLSLShader gPostScreenSpaceReflectionProgram;
// Deferred rendering shaders
-extern LLGLSLShader gDeferredImpostorProgram;
-extern LLGLSLShader gDeferredDiffuseProgram;
-extern LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
-extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
-extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
-extern LLGLSLShader gDeferredNonIndexedDiffuseProgram;
-extern LLGLSLShader gDeferredBumpProgram;
-extern LLGLSLShader gDeferredTerrainProgram;
-extern LLGLSLShader gDeferredTreeProgram;
-extern LLGLSLShader gDeferredTreeShadowProgram;
-extern LLGLSLShader gDeferredLightProgram;
-extern LLGLSLShader gDeferredMultiLightProgram[LL_DEFERRED_MULTI_LIGHT_COUNT];
-extern LLGLSLShader gDeferredSpotLightProgram;
-extern LLGLSLShader gDeferredMultiSpotLightProgram;
-extern LLGLSLShader gDeferredSunProgram;
+extern LLGLSLShader gDeferredImpostorProgram;
+extern LLGLSLShader gDeferredDiffuseProgram;
+extern LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
+extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
+extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
+extern LLGLSLShader gDeferredNonIndexedDiffuseProgram;
+extern LLGLSLShader gDeferredBumpProgram;
+extern LLGLSLShader gDeferredTerrainProgram;
+extern LLGLSLShader gDeferredTreeProgram;
+extern LLGLSLShader gDeferredTreeShadowProgram;
+extern LLGLSLShader gDeferredLightProgram;
+extern LLGLSLShader gDeferredMultiLightProgram[LL_DEFERRED_MULTI_LIGHT_COUNT];
+extern LLGLSLShader gDeferredSpotLightProgram;
+extern LLGLSLShader gDeferredMultiSpotLightProgram;
+extern LLGLSLShader gDeferredSunProgram;
extern LLGLSLShader gHazeProgram;
extern LLGLSLShader gHazeWaterProgram;
-extern LLGLSLShader gDeferredBlurLightProgram;
-extern LLGLSLShader gDeferredAvatarProgram;
-extern LLGLSLShader gDeferredSoftenProgram;
-extern LLGLSLShader gDeferredShadowProgram;
-extern LLGLSLShader gDeferredShadowCubeProgram;
-extern LLGLSLShader gDeferredShadowAlphaMaskProgram;
+extern LLGLSLShader gDeferredBlurLightProgram;
+extern LLGLSLShader gDeferredAvatarProgram;
+extern LLGLSLShader gDeferredSoftenProgram;
+extern LLGLSLShader gDeferredShadowProgram;
+extern LLGLSLShader gDeferredShadowCubeProgram;
+extern LLGLSLShader gDeferredShadowAlphaMaskProgram;
extern LLGLSLShader gDeferredShadowGLTFAlphaMaskProgram;
extern LLGLSLShader gDeferredShadowGLTFAlphaBlendProgram;
-extern LLGLSLShader gDeferredShadowFullbrightAlphaMaskProgram;
-extern LLGLSLShader gDeferredPostProgram;
-extern LLGLSLShader gDeferredCoFProgram;
-extern LLGLSLShader gDeferredDoFCombineProgram;
-extern LLGLSLShader gFXAAProgram;
-extern LLGLSLShader gDeferredPostNoDoFProgram;
-extern LLGLSLShader gDeferredPostGammaCorrectProgram;
+extern LLGLSLShader gDeferredShadowFullbrightAlphaMaskProgram;
+extern LLGLSLShader gDeferredPostProgram;
+extern LLGLSLShader gDeferredCoFProgram;
+extern LLGLSLShader gDeferredDoFCombineProgram;
+extern LLGLSLShader gFXAAProgram;
+extern LLGLSLShader gDeferredPostNoDoFProgram;
+extern LLGLSLShader gDeferredPostGammaCorrectProgram;
extern LLGLSLShader gNoPostGammaCorrectProgram;
extern LLGLSLShader gLegacyPostGammaCorrectProgram;
-extern LLGLSLShader gExposureProgram;
-extern LLGLSLShader gLuminanceProgram;
-extern LLGLSLShader gDeferredAvatarShadowProgram;
-extern LLGLSLShader gDeferredAvatarAlphaShadowProgram;
-extern LLGLSLShader gDeferredAvatarAlphaMaskShadowProgram;
-extern LLGLSLShader gDeferredAlphaProgram;
-extern LLGLSLShader gHUDAlphaProgram;
-extern LLGLSLShader gDeferredAlphaImpostorProgram;
-extern LLGLSLShader gDeferredFullbrightProgram;
-extern LLGLSLShader gHUDFullbrightProgram;
-extern LLGLSLShader gDeferredFullbrightAlphaMaskProgram;
-extern LLGLSLShader gHUDFullbrightAlphaMaskProgram;
-extern LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram;
-extern LLGLSLShader gHUDFullbrightAlphaMaskAlphaProgram;
-extern LLGLSLShader gDeferredEmissiveProgram;
-extern LLGLSLShader gDeferredAvatarEyesProgram;
-extern LLGLSLShader gDeferredAvatarAlphaProgram;
-extern LLGLSLShader gDeferredWLSkyProgram;
-extern LLGLSLShader gDeferredWLCloudProgram;
-extern LLGLSLShader gDeferredWLSunProgram;
-extern LLGLSLShader gDeferredWLMoonProgram;
-extern LLGLSLShader gDeferredStarProgram;
-extern LLGLSLShader gDeferredFullbrightShinyProgram;
+extern LLGLSLShader gExposureProgram;
+extern LLGLSLShader gLuminanceProgram;
+extern LLGLSLShader gDeferredAvatarShadowProgram;
+extern LLGLSLShader gDeferredAvatarAlphaShadowProgram;
+extern LLGLSLShader gDeferredAvatarAlphaMaskShadowProgram;
+extern LLGLSLShader gDeferredAlphaProgram;
+extern LLGLSLShader gHUDAlphaProgram;
+extern LLGLSLShader gDeferredAlphaImpostorProgram;
+extern LLGLSLShader gDeferredFullbrightProgram;
+extern LLGLSLShader gHUDFullbrightProgram;
+extern LLGLSLShader gDeferredFullbrightAlphaMaskProgram;
+extern LLGLSLShader gHUDFullbrightAlphaMaskProgram;
+extern LLGLSLShader gDeferredFullbrightAlphaMaskAlphaProgram;
+extern LLGLSLShader gHUDFullbrightAlphaMaskAlphaProgram;
+extern LLGLSLShader gDeferredEmissiveProgram;
+extern LLGLSLShader gDeferredAvatarEyesProgram;
+extern LLGLSLShader gDeferredAvatarAlphaProgram;
+extern LLGLSLShader gDeferredWLSkyProgram;
+extern LLGLSLShader gDeferredWLCloudProgram;
+extern LLGLSLShader gDeferredWLSunProgram;
+extern LLGLSLShader gDeferredWLMoonProgram;
+extern LLGLSLShader gDeferredStarProgram;
+extern LLGLSLShader gDeferredFullbrightShinyProgram;
extern LLGLSLShader gHUDFullbrightShinyProgram;
-extern LLGLSLShader gNormalMapGenProgram;
+extern LLGLSLShader gNormalMapGenProgram;
extern LLGLSLShader gDeferredGenBrdfLutProgram;
-extern LLGLSLShader gDeferredBufferVisualProgram;
+extern LLGLSLShader gDeferredBufferVisualProgram;
// Deferred materials shaders
-extern LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2];
+extern LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2];
extern LLGLSLShader gHUDPBROpaqueProgram;
extern LLGLSLShader gPBRGlowProgram;
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 6ac94fe4c4..62b4c390d0 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerstats.cpp
* @brief LLViewerStats class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,10 +36,10 @@
#include "llappviewer.h"
-#include "pipeline.h"
-#include "lltexturefetch.h"
-#include "llviewerobjectlist.h"
-#include "llviewertexturelist.h"
+#include "pipeline.h"
+#include "lltexturefetch.h"
+#include "llviewerobjectlist.h"
+#include "llviewertexturelist.h"
#include "lltexlayer.h"
#include "lltexlayerparams.h"
#include "llsurface.h"
@@ -117,143 +117,143 @@
namespace LLStatViewer
{
-LLTrace::CountStatHandle<> FPS("FPS", "Frames rendered"),
- PACKETS_IN("Packets In", "Packets received"),
- PACKETS_LOST("packetsloststat", "Packets lost"),
- PACKETS_OUT("packetsoutstat", "Packets sent"),
- TEXTURE_PACKETS("texturepacketsstat", "Texture data packets received"),
- CHAT_COUNT("chatcount", "Chat messages sent"),
- IM_COUNT("imcount", "IMs sent"),
- OBJECT_CREATE("objectcreate", "Number of objects created"),
- OBJECT_REZ("objectrez", "Object rez count"),
- LOGIN_TIMEOUTS("logintimeouts", "Number of login attempts that timed out"),
- LSL_SAVES("lslsaves", "Number of times user has saved a script"),
- ANIMATION_UPLOADS("animationuploads", "Animations uploaded"),
- FLY("fly", "Fly count"),
- TELEPORT("teleport", "Teleport count"),
- DELETE_OBJECT("deleteobject", "Objects deleted"),
- SNAPSHOT("snapshot", "Snapshots taken"),
- UPLOAD_SOUND("uploadsound", "Sounds uploaded"),
- UPLOAD_TEXTURE("uploadtexture", "Textures uploaded"),
- EDIT_TEXTURE("edittexture", "Changes to textures on objects"),
- KILLED("killed", "Number of times killed"),
- FRAMETIME_DOUBLED("frametimedoubled", "Ratio of frames 2x longer than previous"),
- TEX_BAKES("texbakes", "Number of times avatar textures have been baked"),
- TEX_REBAKES("texrebakes", "Number of times avatar textures have been forced to rebake"),
- NUM_NEW_OBJECTS("numnewobjectsstat", "Number of objects in scene that were not previously in cache");
-
-LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> >
- TRIANGLES_DRAWN("trianglesdrawnstat");
+LLTrace::CountStatHandle<> FPS("FPS", "Frames rendered"),
+ PACKETS_IN("Packets In", "Packets received"),
+ PACKETS_LOST("packetsloststat", "Packets lost"),
+ PACKETS_OUT("packetsoutstat", "Packets sent"),
+ TEXTURE_PACKETS("texturepacketsstat", "Texture data packets received"),
+ CHAT_COUNT("chatcount", "Chat messages sent"),
+ IM_COUNT("imcount", "IMs sent"),
+ OBJECT_CREATE("objectcreate", "Number of objects created"),
+ OBJECT_REZ("objectrez", "Object rez count"),
+ LOGIN_TIMEOUTS("logintimeouts", "Number of login attempts that timed out"),
+ LSL_SAVES("lslsaves", "Number of times user has saved a script"),
+ ANIMATION_UPLOADS("animationuploads", "Animations uploaded"),
+ FLY("fly", "Fly count"),
+ TELEPORT("teleport", "Teleport count"),
+ DELETE_OBJECT("deleteobject", "Objects deleted"),
+ SNAPSHOT("snapshot", "Snapshots taken"),
+ UPLOAD_SOUND("uploadsound", "Sounds uploaded"),
+ UPLOAD_TEXTURE("uploadtexture", "Textures uploaded"),
+ EDIT_TEXTURE("edittexture", "Changes to textures on objects"),
+ KILLED("killed", "Number of times killed"),
+ FRAMETIME_DOUBLED("frametimedoubled", "Ratio of frames 2x longer than previous"),
+ TEX_BAKES("texbakes", "Number of times avatar textures have been baked"),
+ TEX_REBAKES("texrebakes", "Number of times avatar textures have been forced to rebake"),
+ NUM_NEW_OBJECTS("numnewobjectsstat", "Number of objects in scene that were not previously in cache");
+
+LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> >
+ TRIANGLES_DRAWN("trianglesdrawnstat");
LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Kilotriangles> >
- TRIANGLES_DRAWN_PER_FRAME("trianglesdrawnperframestat");
-
-LLTrace::CountStatHandle<F64Kilobytes >
- ACTIVE_MESSAGE_DATA_RECEIVED("activemessagedatareceived", "Message system data received on all active regions"),
- LAYERS_NETWORK_DATA_RECEIVED("layersdatareceived", "Network data received for layer data (terrain)"),
- OBJECT_NETWORK_DATA_RECEIVED("objectdatareceived", "Network data received for objects"),
- ASSET_UDP_DATA_RECEIVED("assetudpdatareceived", "Network data received for assets (animations, sounds) over UDP message system"),
- TEXTURE_NETWORK_DATA_RECEIVED("texturedatareceived", "Network data received for textures"),
- MESSAGE_SYSTEM_DATA_IN("messagedatain", "Incoming message system network data"),
- MESSAGE_SYSTEM_DATA_OUT("messagedataout", "Outgoing message system network data");
-
-LLTrace::CountStatHandle<F64Seconds >
- SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"),
- SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime", "Seconds with physics FPS below 20"),
- LOSS_5_PERCENT_TIME("loss5percenttime", "Seconds with packet loss > 5%");
-
-SimMeasurement<> SIM_TIME_DILATION("simtimedilation", "Simulator time scale", LL_SIM_STAT_TIME_DILATION),
- SIM_FPS("simfps", "Simulator framerate", LL_SIM_STAT_FPS),
- SIM_PHYSICS_FPS("simphysicsfps", "Simulator physics framerate", LL_SIM_STAT_PHYSFPS),
- SIM_AGENT_UPS("simagentups", "", LL_SIM_STAT_AGENTUPS),
- SIM_SCRIPT_EPS("simscripteps", "", LL_SIM_STAT_SCRIPT_EPS),
- SIM_SKIPPED_SILHOUETTE("simsimskippedsilhouettesteps", "", LL_SIM_STAT_SKIPPEDAISILSTEPS_PS),
- SIM_MAIN_AGENTS("simmainagents", "Number of avatars in current region", LL_SIM_STAT_NUMAGENTMAIN),
- SIM_CHILD_AGENTS("simchildagents", "Number of avatars in neighboring regions", LL_SIM_STAT_NUMAGENTCHILD),
- SIM_OBJECTS("simobjects", "", LL_SIM_STAT_NUMTASKS),
- SIM_ACTIVE_OBJECTS("simactiveobjects", "Number of scripted and/or moving objects", LL_SIM_STAT_NUMTASKSACTIVE),
- SIM_ACTIVE_SCRIPTS("simactivescripts", "Number of scripted objects", LL_SIM_STAT_NUMSCRIPTSACTIVE),
- SIM_IN_PACKETS_PER_SEC("siminpps", "", LL_SIM_STAT_INPPS),
- SIM_OUT_PACKETS_PER_SEC("simoutpps", "", LL_SIM_STAT_OUTPPS),
- SIM_PENDING_DOWNLOADS("simpendingdownloads", "", LL_SIM_STAT_PENDING_DOWNLOADS),
- SIM_PENDING_UPLOADS("simpendinguploads", "", LL_SIM_STAT_PENDING_UPLOADS),
- SIM_PENDING_LOCAL_UPLOADS("simpendinglocaluploads", "", LL_SIM_STAT_PENDING_LOCAL_UPLOADS),
- SIM_PHYSICS_PINNED_TASKS("physicspinnedtasks", "", LL_SIM_STAT_PHYSICS_PINNED_TASKS),
- SIM_PHYSICS_LOD_TASKS("physicslodtasks", "", LL_SIM_STAT_PHYSICS_LOD_TASKS);
-
-SimMeasurement<LLUnit<F64, LLUnits::Percent> >
- SIM_PERCENTAGE_SCRIPTS_RUN("simpctscriptsrun", "", LL_SIM_STAT_PCTSCRIPTSRUN),
- SIM_SKIPPED_CHARACTERS_PERCENTAGE("simsimpctsteppedcharacters", "", LL_SIM_STAT_PCTSTEPPEDCHARACTERS);
-
-LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"),
- NUM_IMAGES("numimagesstat"),
- NUM_RAW_IMAGES("numrawimagesstat"),
- NUM_MATERIALS("nummaterials"),
- NUM_OBJECTS("numobjectsstat"),
- NUM_ACTIVE_OBJECTS("numactiveobjectsstat"),
- ENABLE_VBO("enablevbo", "Vertex Buffers Enabled"),
- VISIBLE_AVATARS("visibleavatars", "Visible Avatars"),
- SHADER_OBJECTS("shaderobjects", "Object Shaders"),
- DRAW_DISTANCE("drawdistance", "Draw Distance"),
- WINDOW_WIDTH("windowwidth", "Window width"),
- WINDOW_HEIGHT("windowheight", "Window height");
-
-LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> >
- PACKETS_LOST_PERCENT("packetslostpercentstat");
-
-static LLTrace::SampleStatHandle<bool>
- CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled");
+ TRIANGLES_DRAWN_PER_FRAME("trianglesdrawnperframestat");
+
+LLTrace::CountStatHandle<F64Kilobytes >
+ ACTIVE_MESSAGE_DATA_RECEIVED("activemessagedatareceived", "Message system data received on all active regions"),
+ LAYERS_NETWORK_DATA_RECEIVED("layersdatareceived", "Network data received for layer data (terrain)"),
+ OBJECT_NETWORK_DATA_RECEIVED("objectdatareceived", "Network data received for objects"),
+ ASSET_UDP_DATA_RECEIVED("assetudpdatareceived", "Network data received for assets (animations, sounds) over UDP message system"),
+ TEXTURE_NETWORK_DATA_RECEIVED("texturedatareceived", "Network data received for textures"),
+ MESSAGE_SYSTEM_DATA_IN("messagedatain", "Incoming message system network data"),
+ MESSAGE_SYSTEM_DATA_OUT("messagedataout", "Outgoing message system network data");
+
+LLTrace::CountStatHandle<F64Seconds >
+ SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"),
+ SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime", "Seconds with physics FPS below 20"),
+ LOSS_5_PERCENT_TIME("loss5percenttime", "Seconds with packet loss > 5%");
+
+SimMeasurement<> SIM_TIME_DILATION("simtimedilation", "Simulator time scale", LL_SIM_STAT_TIME_DILATION),
+ SIM_FPS("simfps", "Simulator framerate", LL_SIM_STAT_FPS),
+ SIM_PHYSICS_FPS("simphysicsfps", "Simulator physics framerate", LL_SIM_STAT_PHYSFPS),
+ SIM_AGENT_UPS("simagentups", "", LL_SIM_STAT_AGENTUPS),
+ SIM_SCRIPT_EPS("simscripteps", "", LL_SIM_STAT_SCRIPT_EPS),
+ SIM_SKIPPED_SILHOUETTE("simsimskippedsilhouettesteps", "", LL_SIM_STAT_SKIPPEDAISILSTEPS_PS),
+ SIM_MAIN_AGENTS("simmainagents", "Number of avatars in current region", LL_SIM_STAT_NUMAGENTMAIN),
+ SIM_CHILD_AGENTS("simchildagents", "Number of avatars in neighboring regions", LL_SIM_STAT_NUMAGENTCHILD),
+ SIM_OBJECTS("simobjects", "", LL_SIM_STAT_NUMTASKS),
+ SIM_ACTIVE_OBJECTS("simactiveobjects", "Number of scripted and/or moving objects", LL_SIM_STAT_NUMTASKSACTIVE),
+ SIM_ACTIVE_SCRIPTS("simactivescripts", "Number of scripted objects", LL_SIM_STAT_NUMSCRIPTSACTIVE),
+ SIM_IN_PACKETS_PER_SEC("siminpps", "", LL_SIM_STAT_INPPS),
+ SIM_OUT_PACKETS_PER_SEC("simoutpps", "", LL_SIM_STAT_OUTPPS),
+ SIM_PENDING_DOWNLOADS("simpendingdownloads", "", LL_SIM_STAT_PENDING_DOWNLOADS),
+ SIM_PENDING_UPLOADS("simpendinguploads", "", LL_SIM_STAT_PENDING_UPLOADS),
+ SIM_PENDING_LOCAL_UPLOADS("simpendinglocaluploads", "", LL_SIM_STAT_PENDING_LOCAL_UPLOADS),
+ SIM_PHYSICS_PINNED_TASKS("physicspinnedtasks", "", LL_SIM_STAT_PHYSICS_PINNED_TASKS),
+ SIM_PHYSICS_LOD_TASKS("physicslodtasks", "", LL_SIM_STAT_PHYSICS_LOD_TASKS);
+
+SimMeasurement<LLUnit<F64, LLUnits::Percent> >
+ SIM_PERCENTAGE_SCRIPTS_RUN("simpctscriptsrun", "", LL_SIM_STAT_PCTSCRIPTSRUN),
+ SIM_SKIPPED_CHARACTERS_PERCENTAGE("simsimpctsteppedcharacters", "", LL_SIM_STAT_PCTSTEPPEDCHARACTERS);
+
+LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"),
+ NUM_IMAGES("numimagesstat"),
+ NUM_RAW_IMAGES("numrawimagesstat"),
+ NUM_MATERIALS("nummaterials"),
+ NUM_OBJECTS("numobjectsstat"),
+ NUM_ACTIVE_OBJECTS("numactiveobjectsstat"),
+ ENABLE_VBO("enablevbo", "Vertex Buffers Enabled"),
+ VISIBLE_AVATARS("visibleavatars", "Visible Avatars"),
+ SHADER_OBJECTS("shaderobjects", "Object Shaders"),
+ DRAW_DISTANCE("drawdistance", "Draw Distance"),
+ WINDOW_WIDTH("windowwidth", "Window width"),
+ WINDOW_HEIGHT("windowheight", "Window height");
+
+LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> >
+ PACKETS_LOST_PERCENT("packetslostpercentstat");
+
+static LLTrace::SampleStatHandle<bool>
+ CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled");
LLTrace::SampleStatHandle<F64Megabytes > FORMATTED_MEM("formattedmemstat");
-LLTrace::SampleStatHandle<F64Kilobytes > DELTA_BANDWIDTH("deltabandwidth", "Increase/Decrease in bandwidth based on packet loss"),
- MAX_BANDWIDTH("maxbandwidth", "Max bandwidth setting");
-
-
-SimMeasurement<F64Milliseconds > SIM_FRAME_TIME("simframemsec", "", LL_SIM_STAT_FRAMEMS),
- SIM_NET_TIME("simnetmsec", "", LL_SIM_STAT_NETMS),
- SIM_OTHER_TIME("simsimothermsec", "", LL_SIM_STAT_SIMOTHERMS),
- SIM_PHYSICS_TIME("simsimphysicsmsec", "", LL_SIM_STAT_SIMPHYSICSMS),
- SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec", "", LL_SIM_STAT_SIMPHYSICSSTEPMS),
- SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec", "", LL_SIM_STAT_SIMPHYSICSSHAPEMS),
- SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec", "", LL_SIM_STAT_SIMPHYSICSOTHERMS),
- SIM_AI_TIME("simsimaistepmsec", "", LL_SIM_STAT_SIMAISTEPTIMEMS),
- SIM_AGENTS_TIME("simagentmsec", "", LL_SIM_STAT_AGENTMS),
- SIM_IMAGES_TIME("simimagesmsec", "", LL_SIM_STAT_IMAGESMS),
- SIM_SCRIPTS_TIME("simscriptmsec", "", LL_SIM_STAT_SCRIPTMS),
- SIM_SPARE_TIME("simsparemsec", "", LL_SIM_STAT_SIMSPARETIME),
- SIM_SLEEP_TIME("simsleepmsec", "", LL_SIM_STAT_SIMSLEEPTIME),
- SIM_PUMP_IO_TIME("simpumpiomsec", "", LL_SIM_STAT_IOPUMPTIME);
-
-SimMeasurement<F64Kilobytes > SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_SIM_STAT_TOTAL_UNACKED_BYTES);
-SimMeasurement<F64Megabytes > SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY);
-
-LLTrace::SampleStatHandle<F64Milliseconds > FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"),
- FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"),
- FRAMETIME("frametime", "Measured frame time"),
- SIM_PING("simpingstat");
+LLTrace::SampleStatHandle<F64Kilobytes > DELTA_BANDWIDTH("deltabandwidth", "Increase/Decrease in bandwidth based on packet loss"),
+ MAX_BANDWIDTH("maxbandwidth", "Max bandwidth setting");
+
+
+SimMeasurement<F64Milliseconds > SIM_FRAME_TIME("simframemsec", "", LL_SIM_STAT_FRAMEMS),
+ SIM_NET_TIME("simnetmsec", "", LL_SIM_STAT_NETMS),
+ SIM_OTHER_TIME("simsimothermsec", "", LL_SIM_STAT_SIMOTHERMS),
+ SIM_PHYSICS_TIME("simsimphysicsmsec", "", LL_SIM_STAT_SIMPHYSICSMS),
+ SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec", "", LL_SIM_STAT_SIMPHYSICSSTEPMS),
+ SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec", "", LL_SIM_STAT_SIMPHYSICSSHAPEMS),
+ SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec", "", LL_SIM_STAT_SIMPHYSICSOTHERMS),
+ SIM_AI_TIME("simsimaistepmsec", "", LL_SIM_STAT_SIMAISTEPTIMEMS),
+ SIM_AGENTS_TIME("simagentmsec", "", LL_SIM_STAT_AGENTMS),
+ SIM_IMAGES_TIME("simimagesmsec", "", LL_SIM_STAT_IMAGESMS),
+ SIM_SCRIPTS_TIME("simscriptmsec", "", LL_SIM_STAT_SCRIPTMS),
+ SIM_SPARE_TIME("simsparemsec", "", LL_SIM_STAT_SIMSPARETIME),
+ SIM_SLEEP_TIME("simsleepmsec", "", LL_SIM_STAT_SIMSLEEPTIME),
+ SIM_PUMP_IO_TIME("simpumpiomsec", "", LL_SIM_STAT_IOPUMPTIME);
+
+SimMeasurement<F64Kilobytes > SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_SIM_STAT_TOTAL_UNACKED_BYTES);
+SimMeasurement<F64Megabytes > SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY);
+
+LLTrace::SampleStatHandle<F64Milliseconds > FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"),
+ FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"),
+ FRAMETIME("frametime", "Measured frame time"),
+ SIM_PING("simpingstat");
LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Meters> > AGENT_POSITION_SNAP("agentpositionsnap", "agent position corrections");
-LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load");
-
-LLTrace::EventStatHandle<F64Milliseconds > REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"),
- FRAME_STACKTIME("framestacktime", "FRAME_SECS"),
- UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"),
- NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"),
- IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"),
- REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"),
- RENDER_STACKTIME("renderstacktime", "RENDER_SECS");
-
-LLTrace::EventStatHandle<F64Seconds > AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearance"),
- TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"),
- MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"),
- FPS_10_TIME("fps10time", "Seconds below 10 FPS"),
- FPS_8_TIME("fps8time", "Seconds below 8 FPS"),
- FPS_2_TIME("fps2time", "Seconds below 2 FPS");
+LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load");
+
+LLTrace::EventStatHandle<F64Milliseconds > REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"),
+ FRAME_STACKTIME("framestacktime", "FRAME_SECS"),
+ UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"),
+ NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"),
+ IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"),
+ REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"),
+ RENDER_STACKTIME("renderstacktime", "RENDER_SECS");
+
+LLTrace::EventStatHandle<F64Seconds > AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearance"),
+ TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"),
+ MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"),
+ FPS_10_TIME("fps10time", "Seconds below 10 FPS"),
+ FPS_8_TIME("fps8time", "Seconds below 8 FPS"),
+ FPS_2_TIME("fps2time", "Seconds below 2 FPS");
LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > OBJECT_CACHE_HIT_RATE("object_cache_hits");
-LLTrace::EventStatHandle<F64Seconds > TEXTURE_FETCH_TIME("texture_fetch_time");
+LLTrace::EventStatHandle<F64Seconds > TEXTURE_FETCH_TIME("texture_fetch_time");
LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > SCENERY_FRAME_PCT("scenery_frame_pct");
LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > AVATAR_FRAME_PCT("avatar_frame_pct");
@@ -263,10 +263,10 @@ LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > SWAP_FRAME_PCT("swap_
LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > IDLE_FRAME_PCT("idle_frame_pct");
}
-LLViewerStats::LLViewerStats()
-: mLastTimeDiff(0.0)
+LLViewerStats::LLViewerStats()
+: mLastTimeDiff(0.0)
{
- getRecording().start();
+ getRecording().start();
}
LLViewerStats::~LLViewerStats()
@@ -274,100 +274,100 @@ LLViewerStats::~LLViewerStats()
void LLViewerStats::resetStats()
{
- getRecording().reset();
+ getRecording().reset();
}
void LLViewerStats::updateFrameStats(const F64Seconds time_diff)
{
- if (getRecording().getLastValue(LLStatViewer::PACKETS_LOST_PERCENT) > F32Percent(5.0))
- {
- add(LLStatViewer::LOSS_5_PERCENT_TIME, time_diff);
- }
-
- F32 sim_fps = getRecording().getLastValue(LLStatViewer::SIM_FPS);
- if (0.f < sim_fps && sim_fps < 20.f)
- {
- add(LLStatViewer::SIM_20_FPS_TIME, time_diff);
- }
-
- F32 sim_physics_fps = getRecording().getLastValue(LLStatViewer::SIM_PHYSICS_FPS);
-
- if (0.f < sim_physics_fps && sim_physics_fps < 20.f)
- {
- add(LLStatViewer::SIM_PHYSICS_20_FPS_TIME, time_diff);
- }
-
- if (time_diff >= (F64Seconds)0.5)
- {
- record(LLStatViewer::FPS_2_TIME, time_diff);
- }
- if (time_diff >= (F64Seconds)0.125)
- {
- record(LLStatViewer::FPS_8_TIME, time_diff);
- }
- if (time_diff >= (F64Seconds)0.1)
- {
- record(LLStatViewer::FPS_10_TIME, time_diff);
- }
-
- if (gFrameCount && mLastTimeDiff > (F64Seconds)0.0)
- {
- // new "stutter" meter
- add(LLStatViewer::FRAMETIME_DOUBLED, time_diff >= 2.0 * mLastTimeDiff ? 1 : 0);
-
- sample(LLStatViewer::FRAMETIME, time_diff);
-
- // old stats that were never really used
- F64Seconds jit = (F64Seconds) std::fabs((mLastTimeDiff - time_diff));
- sample(LLStatViewer::FRAMETIME_JITTER, jit);
-
- F32Seconds average_frametime = gRenderStartTime.getElapsedTimeF32() / (F32)gFrameCount;
- sample(LLStatViewer::FRAMETIME_SLEW, F64Milliseconds (average_frametime - time_diff));
-
- F32 max_bandwidth = gViewerThrottle.getMaxBandwidth();
- F32 delta_bandwidth = gViewerThrottle.getCurrentBandwidth() - max_bandwidth;
- sample(LLStatViewer::DELTA_BANDWIDTH, F64Bits(delta_bandwidth));
- sample(LLStatViewer::MAX_BANDWIDTH, F64Bits(max_bandwidth));
- }
-
- mLastTimeDiff = time_diff;
+ if (getRecording().getLastValue(LLStatViewer::PACKETS_LOST_PERCENT) > F32Percent(5.0))
+ {
+ add(LLStatViewer::LOSS_5_PERCENT_TIME, time_diff);
+ }
+
+ F32 sim_fps = getRecording().getLastValue(LLStatViewer::SIM_FPS);
+ if (0.f < sim_fps && sim_fps < 20.f)
+ {
+ add(LLStatViewer::SIM_20_FPS_TIME, time_diff);
+ }
+
+ F32 sim_physics_fps = getRecording().getLastValue(LLStatViewer::SIM_PHYSICS_FPS);
+
+ if (0.f < sim_physics_fps && sim_physics_fps < 20.f)
+ {
+ add(LLStatViewer::SIM_PHYSICS_20_FPS_TIME, time_diff);
+ }
+
+ if (time_diff >= (F64Seconds)0.5)
+ {
+ record(LLStatViewer::FPS_2_TIME, time_diff);
+ }
+ if (time_diff >= (F64Seconds)0.125)
+ {
+ record(LLStatViewer::FPS_8_TIME, time_diff);
+ }
+ if (time_diff >= (F64Seconds)0.1)
+ {
+ record(LLStatViewer::FPS_10_TIME, time_diff);
+ }
+
+ if (gFrameCount && mLastTimeDiff > (F64Seconds)0.0)
+ {
+ // new "stutter" meter
+ add(LLStatViewer::FRAMETIME_DOUBLED, time_diff >= 2.0 * mLastTimeDiff ? 1 : 0);
+
+ sample(LLStatViewer::FRAMETIME, time_diff);
+
+ // old stats that were never really used
+ F64Seconds jit = (F64Seconds) std::fabs((mLastTimeDiff - time_diff));
+ sample(LLStatViewer::FRAMETIME_JITTER, jit);
+
+ F32Seconds average_frametime = gRenderStartTime.getElapsedTimeF32() / (F32)gFrameCount;
+ sample(LLStatViewer::FRAMETIME_SLEW, F64Milliseconds (average_frametime - time_diff));
+
+ F32 max_bandwidth = gViewerThrottle.getMaxBandwidth();
+ F32 delta_bandwidth = gViewerThrottle.getCurrentBandwidth() - max_bandwidth;
+ sample(LLStatViewer::DELTA_BANDWIDTH, F64Bits(delta_bandwidth));
+ sample(LLStatViewer::MAX_BANDWIDTH, F64Bits(max_bandwidth));
+ }
+
+ mLastTimeDiff = time_diff;
}
void LLViewerStats::addToMessage(LLSD &body)
{
- LLSD &misc = body["misc"];
-
- misc["Version"] = TRUE;
- //TODO RN: get last value, not mean
- misc["Vertex Buffers Enabled"] = getRecording().getMean(LLStatViewer::ENABLE_VBO);
-
- body["AgentPositionSnaps"] = getRecording().getSum(LLStatViewer::AGENT_POSITION_SNAP).value(); //mAgentPositionSnaps.asLLSD();
- LL_INFOS() << "STAT: AgentPositionSnaps: Mean = " << getRecording().getMean(LLStatViewer::AGENT_POSITION_SNAP).value() << "; StdDev = " << getRecording().getStandardDeviation(LLStatViewer::AGENT_POSITION_SNAP).value()
- << "; Count = " << getRecording().getSampleCount(LLStatViewer::AGENT_POSITION_SNAP) << LL_ENDL;
+ LLSD &misc = body["misc"];
+
+ misc["Version"] = TRUE;
+ //TODO RN: get last value, not mean
+ misc["Vertex Buffers Enabled"] = getRecording().getMean(LLStatViewer::ENABLE_VBO);
+
+ body["AgentPositionSnaps"] = getRecording().getSum(LLStatViewer::AGENT_POSITION_SNAP).value(); //mAgentPositionSnaps.asLLSD();
+ LL_INFOS() << "STAT: AgentPositionSnaps: Mean = " << getRecording().getMean(LLStatViewer::AGENT_POSITION_SNAP).value() << "; StdDev = " << getRecording().getStandardDeviation(LLStatViewer::AGENT_POSITION_SNAP).value()
+ << "; Count = " << getRecording().getSampleCount(LLStatViewer::AGENT_POSITION_SNAP) << LL_ENDL;
}
// *NOTE:Mani The following methods used to exist in viewer.cpp
// Moving them here, but not merging them into LLViewerStats yet.
-U32 gTotalLandIn = 0,
- gTotalLandOut = 0,
- gTotalWaterIn = 0,
- gTotalWaterOut = 0;
-
-F32 gAveLandCompression = 0.f,
- gAveWaterCompression = 0.f,
- gBestLandCompression = 1.f,
- gBestWaterCompression = 1.f,
- gWorstLandCompression = 0.f,
- gWorstWaterCompression = 0.f;
-
-U32Bytes gTotalWorldData,
- gTotalObjectData,
- gTotalTextureData;
-U32 gSimPingCount = 0;
-U32Bits gObjectData;
-F32Milliseconds gAvgSimPing(0.f);
+U32 gTotalLandIn = 0,
+ gTotalLandOut = 0,
+ gTotalWaterIn = 0,
+ gTotalWaterOut = 0;
+
+F32 gAveLandCompression = 0.f,
+ gAveWaterCompression = 0.f,
+ gBestLandCompression = 1.f,
+ gBestWaterCompression = 1.f,
+ gWorstLandCompression = 0.f,
+ gWorstWaterCompression = 0.f;
+
+U32Bytes gTotalWorldData,
+ gTotalObjectData,
+ gTotalTextureData;
+U32 gSimPingCount = 0;
+U32Bits gObjectData;
+F32Milliseconds gAvgSimPing(0.f);
// rely on default initialization
-U32Bytes gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY];
+U32Bytes gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY];
extern U32 gVisCompared;
extern U32 gVisTested;
@@ -376,88 +376,88 @@ void update_statistics()
{
LL_PROFILE_ZONE_SCOPED;
- gTotalWorldData += gVLManager.getTotalBytes();
- gTotalObjectData += gObjectData;
-
- // make sure we have a valid time delta for this frame
- if (gFrameIntervalSeconds > 0.f)
- {
- if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
- {
- record(LLStatViewer::MOUSELOOK_TIME, gFrameIntervalSeconds);
- }
- else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
- {
- record(LLStatViewer::AVATAR_EDIT_TIME, gFrameIntervalSeconds);
- }
- else if (LLFloaterReg::instanceVisible("build"))
- {
- record(LLStatViewer::TOOLBOX_TIME, gFrameIntervalSeconds);
- }
- }
-
- LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording();
-
- record(LLStatViewer::TRIANGLES_DRAWN_PER_FRAME, last_frame_recording.getSum(LLStatViewer::TRIANGLES_DRAWN));
-
- sample(LLStatViewer::ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable"));
- sample(LLStatViewer::DRAW_DISTANCE, (F64)gSavedSettings.getF32("RenderFarClip"));
- sample(LLStatViewer::CHAT_BUBBLES, gSavedSettings.getBOOL("UseChatBubbles"));
-
- typedef LLTrace::StatType<LLTrace::TimeBlockAccumulator>::instance_tracker_t stat_type_t;
-
- record(LLStatViewer::FRAME_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Frame")));
-
- if (gAgent.getRegion() && isAgentAvatarValid())
- {
- LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());
- if (cdp)
- {
- sample(LLStatViewer::SIM_PING, F64Milliseconds(cdp->getPingDelay()));
- gAvgSimPing = ((gAvgSimPing * gSimPingCount) + cdp->getPingDelay()) / (gSimPingCount + 1);
- gSimPingCount++;
- }
- else
- {
- sample(LLStatViewer::SIM_PING, U32Seconds(10));
- }
- }
-
- if (LLViewerStats::instance().getRecording().getSum(LLStatViewer::FPS))
- {
- sample(LLStatViewer::FPS_SAMPLE, LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::FPS));
- }
- add(LLStatViewer::FPS, 1);
-
- F64Bits layer_bits = gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits();
- add(LLStatViewer::LAYERS_NETWORK_DATA_RECEIVED, layer_bits);
- add(LLStatViewer::OBJECT_NETWORK_DATA_RECEIVED, gObjectData);
- add(LLStatViewer::ASSET_UDP_DATA_RECEIVED, F64Bits(gTransferManager.getTransferBitsIn(LLTCT_ASSET)));
- gTransferManager.resetTransferBitsIn(LLTCT_ASSET);
-
- sample(LLStatViewer::VISIBLE_AVATARS, LLVOAvatar::sNumVisibleAvatars);
+ gTotalWorldData += gVLManager.getTotalBytes();
+ gTotalObjectData += gObjectData;
+
+ // make sure we have a valid time delta for this frame
+ if (gFrameIntervalSeconds > 0.f)
+ {
+ if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
+ {
+ record(LLStatViewer::MOUSELOOK_TIME, gFrameIntervalSeconds);
+ }
+ else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
+ {
+ record(LLStatViewer::AVATAR_EDIT_TIME, gFrameIntervalSeconds);
+ }
+ else if (LLFloaterReg::instanceVisible("build"))
+ {
+ record(LLStatViewer::TOOLBOX_TIME, gFrameIntervalSeconds);
+ }
+ }
+
+ LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording();
+
+ record(LLStatViewer::TRIANGLES_DRAWN_PER_FRAME, last_frame_recording.getSum(LLStatViewer::TRIANGLES_DRAWN));
+
+ sample(LLStatViewer::ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable"));
+ sample(LLStatViewer::DRAW_DISTANCE, (F64)gSavedSettings.getF32("RenderFarClip"));
+ sample(LLStatViewer::CHAT_BUBBLES, gSavedSettings.getBOOL("UseChatBubbles"));
+
+ typedef LLTrace::StatType<LLTrace::TimeBlockAccumulator>::instance_tracker_t stat_type_t;
+
+ record(LLStatViewer::FRAME_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Frame")));
+
+ if (gAgent.getRegion() && isAgentAvatarValid())
+ {
+ LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());
+ if (cdp)
+ {
+ sample(LLStatViewer::SIM_PING, F64Milliseconds(cdp->getPingDelay()));
+ gAvgSimPing = ((gAvgSimPing * gSimPingCount) + cdp->getPingDelay()) / (gSimPingCount + 1);
+ gSimPingCount++;
+ }
+ else
+ {
+ sample(LLStatViewer::SIM_PING, U32Seconds(10));
+ }
+ }
+
+ if (LLViewerStats::instance().getRecording().getSum(LLStatViewer::FPS))
+ {
+ sample(LLStatViewer::FPS_SAMPLE, LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::FPS));
+ }
+ add(LLStatViewer::FPS, 1);
+
+ F64Bits layer_bits = gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits();
+ add(LLStatViewer::LAYERS_NETWORK_DATA_RECEIVED, layer_bits);
+ add(LLStatViewer::OBJECT_NETWORK_DATA_RECEIVED, gObjectData);
+ add(LLStatViewer::ASSET_UDP_DATA_RECEIVED, F64Bits(gTransferManager.getTransferBitsIn(LLTCT_ASSET)));
+ gTransferManager.resetTransferBitsIn(LLTCT_ASSET);
+
+ sample(LLStatViewer::VISIBLE_AVATARS, LLVOAvatar::sNumVisibleAvatars);
LLWorld *world = LLWorld::getInstance(); // not LLSingleton
if (world)
{
world->updateNetStats();
world->requestCacheMisses();
}
-
- // Reset all of these values.
- gVLManager.resetBitCounts();
- gObjectData = (U32Bytes)0;
-// gDecodedBits = 0;
-
- // Only update texture stats periodically so that they are less noisy
- {
- static const F32 texture_stats_freq = 10.f;
- static LLFrameTimer texture_stats_timer;
- if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq)
- {
- gTotalTextureData = LLViewerStats::instance().getRecording().getSum(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED);
- texture_stats_timer.reset();
- }
- }
+
+ // Reset all of these values.
+ gVLManager.resetBitCounts();
+ gObjectData = (U32Bytes)0;
+// gDecodedBits = 0;
+
+ // Only update texture stats periodically so that they are less noisy
+ {
+ static const F32 texture_stats_freq = 10.f;
+ static LLFrameTimer texture_stats_timer;
+ if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq)
+ {
+ gTotalTextureData = LLViewerStats::instance().getRecording().getSum(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED);
+ texture_stats_timer.reset();
+ }
+ }
if (LLFloaterReg::instanceVisible("scene_load_stats"))
{
@@ -476,7 +476,7 @@ void update_statistics()
// auto tot_avatar_render_time_raw = tot_avatar_time_raw - tot_av_idle_time_raw;
// the time spent this frame on the "display()" call. Treated as "tot time rendering"
auto tot_render_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_DISPLAY);
- // sleep time is basically forced sleep when window out of focus
+ // sleep time is basically forced sleep when window out of focus
auto tot_sleep_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_SLEEP);
// time spent on UI
auto tot_ui_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_UI);
@@ -554,172 +554,172 @@ void update_statistics()
*/
void send_viewer_stats(bool include_preferences)
{
- // IW 9/23/02 I elected not to move this into LLViewerStats
- // because it depends on too many viewer.cpp globals.
- // Someday we may want to merge all our stats into a central place
- // but that day is not today.
-
- // Only send stats if the agent is connected to a region.
- if (!gAgent.getRegion())
- {
- return;
- }
-
- LLSD body;
- std::string url = gAgent.getRegion()->getCapability("ViewerStats");
-
- if (url.empty()) {
- LL_WARNS() << "Could not get ViewerStats capability" << LL_ENDL;
- return;
- }
-
- LLViewerStats::instance().getRecording().pause();
-
- LLSD &agent = body["agent"];
-
- time_t ltime;
- time(&ltime);
- F32 run_time = F32(LLFrameTimer::getElapsedSeconds());
-
- agent["start_time"] = S32(ltime - S32(run_time));
-
- // The first stat set must have a 0 run time if it doesn't actually
- // contain useful data in terms of FPS, etc. We use half the
- // SEND_STATS_PERIOD seconds as the point at which these statistics become
- // valid. Data warehouse uses a 0 value here to easily discard these
- // records with non-useful FPS values etc.
- if (run_time < (SEND_STATS_PERIOD / 2))
- {
- agent["run_time"] = 0.0f;
- }
- else
- {
- agent["run_time"] = run_time;
- }
-
- // send fps only for time app spends in foreground
- agent["fps"] = (F32)gForegroundFrameCount / gForegroundTime.getElapsedTimeF32();
- agent["version"] = LLVersionInfo::instance().getChannelAndVersion();
- std::string language = LLUI::getLanguage();
- agent["language"] = language;
-
- agent["sim_fps"] = ((F32) gFrameCount - gSimFrames) /
- (F32) (gRenderStartTime.getElapsedTimeF32() - gSimLastTime);
-
- gSimLastTime = gRenderStartTime.getElapsedTimeF32();
- gSimFrames = (F32) gFrameCount;
-
- agent["agents_in_view"] = LLVOAvatar::sNumVisibleAvatars;
- agent["ping"] = gAvgSimPing.value();
- agent["meters_traveled"] = gAgent.getDistanceTraveled();
- agent["regions_visited"] = gAgent.getRegionsVisited();
- agent["mem_use"] = LLMemory::getCurrentRSS() / 1024.0;
- agent["translation"] = LLTranslate::instance().asLLSD();
-
- LLSD &system = body["system"];
-
- system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB().value();
- system["os"] = LLOSInfo::instance().getOSStringSimple();
- system["cpu"] = gSysCPU.getCPUString();
+ // IW 9/23/02 I elected not to move this into LLViewerStats
+ // because it depends on too many viewer.cpp globals.
+ // Someday we may want to merge all our stats into a central place
+ // but that day is not today.
+
+ // Only send stats if the agent is connected to a region.
+ if (!gAgent.getRegion())
+ {
+ return;
+ }
+
+ LLSD body;
+ std::string url = gAgent.getRegion()->getCapability("ViewerStats");
+
+ if (url.empty()) {
+ LL_WARNS() << "Could not get ViewerStats capability" << LL_ENDL;
+ return;
+ }
+
+ LLViewerStats::instance().getRecording().pause();
+
+ LLSD &agent = body["agent"];
+
+ time_t ltime;
+ time(&ltime);
+ F32 run_time = F32(LLFrameTimer::getElapsedSeconds());
+
+ agent["start_time"] = S32(ltime - S32(run_time));
+
+ // The first stat set must have a 0 run time if it doesn't actually
+ // contain useful data in terms of FPS, etc. We use half the
+ // SEND_STATS_PERIOD seconds as the point at which these statistics become
+ // valid. Data warehouse uses a 0 value here to easily discard these
+ // records with non-useful FPS values etc.
+ if (run_time < (SEND_STATS_PERIOD / 2))
+ {
+ agent["run_time"] = 0.0f;
+ }
+ else
+ {
+ agent["run_time"] = run_time;
+ }
+
+ // send fps only for time app spends in foreground
+ agent["fps"] = (F32)gForegroundFrameCount / gForegroundTime.getElapsedTimeF32();
+ agent["version"] = LLVersionInfo::instance().getChannelAndVersion();
+ std::string language = LLUI::getLanguage();
+ agent["language"] = language;
+
+ agent["sim_fps"] = ((F32) gFrameCount - gSimFrames) /
+ (F32) (gRenderStartTime.getElapsedTimeF32() - gSimLastTime);
+
+ gSimLastTime = gRenderStartTime.getElapsedTimeF32();
+ gSimFrames = (F32) gFrameCount;
+
+ agent["agents_in_view"] = LLVOAvatar::sNumVisibleAvatars;
+ agent["ping"] = gAvgSimPing.value();
+ agent["meters_traveled"] = gAgent.getDistanceTraveled();
+ agent["regions_visited"] = gAgent.getRegionsVisited();
+ agent["mem_use"] = LLMemory::getCurrentRSS() / 1024.0;
+ agent["translation"] = LLTranslate::instance().asLLSD();
+
+ LLSD &system = body["system"];
+
+ system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB().value();
+ system["os"] = LLOSInfo::instance().getOSStringSimple();
+ system["cpu"] = gSysCPU.getCPUString();
system["cpu_sse"] = gSysCPU.getSSEVersions();
- system["address_size"] = ADDRESS_SIZE;
- system["os_bitness"] = LLOSInfo::instance().getOSBitness();
- system["hardware_concurrency"] = (LLSD::Integer) std::thread::hardware_concurrency();
- unsigned char MACAddress[MAC_ADDRESS_BYTES];
- LLUUID::getNodeID(MACAddress);
- std::string macAddressString = llformat("%02x-%02x-%02x-%02x-%02x-%02x",
- MACAddress[0],MACAddress[1],MACAddress[2],
- MACAddress[3],MACAddress[4],MACAddress[5]);
- system["mac_address"] = macAddressString;
- system["serial_number"] = LLAppViewer::instance()->getSerialNumber();
- std::string gpu_desc = llformat(
- "%-6s Class %d ",
- gGLManager.mGLVendorShort.substr(0,6).c_str(),
- (S32)LLFeatureManager::getInstance()->getGPUClass())
- + gGLManager.getRawGLString();
-
- system["gpu"] = gpu_desc;
- system["gpu_class"] = (S32)LLFeatureManager::getInstance()->getGPUClass();
+ system["address_size"] = ADDRESS_SIZE;
+ system["os_bitness"] = LLOSInfo::instance().getOSBitness();
+ system["hardware_concurrency"] = (LLSD::Integer) std::thread::hardware_concurrency();
+ unsigned char MACAddress[MAC_ADDRESS_BYTES];
+ LLUUID::getNodeID(MACAddress);
+ std::string macAddressString = llformat("%02x-%02x-%02x-%02x-%02x-%02x",
+ MACAddress[0],MACAddress[1],MACAddress[2],
+ MACAddress[3],MACAddress[4],MACAddress[5]);
+ system["mac_address"] = macAddressString;
+ system["serial_number"] = LLAppViewer::instance()->getSerialNumber();
+ std::string gpu_desc = llformat(
+ "%-6s Class %d ",
+ gGLManager.mGLVendorShort.substr(0,6).c_str(),
+ (S32)LLFeatureManager::getInstance()->getGPUClass())
+ + gGLManager.getRawGLString();
+
+ system["gpu"] = gpu_desc;
+ system["gpu_class"] = (S32)LLFeatureManager::getInstance()->getGPUClass();
system["gpu_memory_bandwidth"] = LLFeatureManager::getInstance()->getGPUMemoryBandwidth();
- system["gpu_vendor"] = gGLManager.mGLVendorShort;
- system["gpu_version"] = gGLManager.mDriverVersionVendorString;
- system["opengl_version"] = gGLManager.mGLVersionString;
-
- gGLManager.asLLSD(system["gl"]);
-
-
- S32 shader_level = 0;
- if (LLPipeline::sRenderDeferred)
- {
- if (LLPipeline::RenderShadowDetail > 0)
- {
- shader_level = 5;
- }
- else if (LLPipeline::RenderDeferredSSAO)
- {
- shader_level = 4;
- }
- else
- {
- shader_level = 3;
- }
- }
- else
- {
- shader_level = 2;
- }
-
-
-
- system["shader_level"] = shader_level;
-
- LLSD &download = body["downloads"];
-
- download["world_kbytes"] = F64Kilobytes(gTotalWorldData).value();
- download["object_kbytes"] = F64Kilobytes(gTotalObjectData).value();
- download["texture_kbytes"] = F64Kilobytes(gTotalTextureData).value();
- download["mesh_kbytes"] = LLMeshRepository::sBytesReceived/1024.0;
-
- LLSD &in = body["stats"]["net"]["in"];
-
- in["kbytes"] = gMessageSystem->mTotalBytesIn / 1024.0;
- in["packets"] = (S32) gMessageSystem->mPacketsIn;
- in["compressed_packets"] = (S32) gMessageSystem->mCompressedPacketsIn;
- in["savings"] = (gMessageSystem->mUncompressedBytesIn -
- gMessageSystem->mCompressedBytesIn) / 1024.0;
-
- LLSD &out = body["stats"]["net"]["out"];
-
- out["kbytes"] = gMessageSystem->mTotalBytesOut / 1024.0;
- out["packets"] = (S32) gMessageSystem->mPacketsOut;
- out["compressed_packets"] = (S32) gMessageSystem->mCompressedPacketsOut;
- out["savings"] = (gMessageSystem->mUncompressedBytesOut -
- gMessageSystem->mCompressedBytesOut) / 1024.0;
-
- LLSD &fail = body["stats"]["failures"];
-
- fail["send_packet"] = (S32) gMessageSystem->mSendPacketFailureCount;
- fail["dropped"] = (S32) gMessageSystem->mDroppedPackets;
- fail["resent"] = (S32) gMessageSystem->mResentPackets;
- fail["failed_resends"] = (S32) gMessageSystem->mFailedResendPackets;
- fail["off_circuit"] = (S32) gMessageSystem->mOffCircuitPackets;
- fail["invalid"] = (S32) gMessageSystem->mInvalidOnCircuitPackets;
- fail["missing_updater"] = (S32) LLAppViewer::instance()->isUpdaterMissing();
-
- LLSD &inventory = body["inventory"];
- inventory["usable"] = gInventory.isInventoryUsable();
- LLSD& validation_info = inventory["validation_info"];
- gInventory.mValidationInfo->asLLSD(validation_info);
-
- body["ui"] = LLUIUsage::instance().asLLSD();
-
- body["stats"]["voice"] = LLVoiceVivoxStats::getInstance()->read();
-
- // Misc stats, two strings and two ints
- // These are not expecticed to persist across multiple releases
- // Comment any changes with your name and the expected release revision
- // If the current revision is recent, ping the previous author before overriding
- LLSD &misc = body["stats"]["misc"];
+ system["gpu_vendor"] = gGLManager.mGLVendorShort;
+ system["gpu_version"] = gGLManager.mDriverVersionVendorString;
+ system["opengl_version"] = gGLManager.mGLVersionString;
+
+ gGLManager.asLLSD(system["gl"]);
+
+
+ S32 shader_level = 0;
+ if (LLPipeline::sRenderDeferred)
+ {
+ if (LLPipeline::RenderShadowDetail > 0)
+ {
+ shader_level = 5;
+ }
+ else if (LLPipeline::RenderDeferredSSAO)
+ {
+ shader_level = 4;
+ }
+ else
+ {
+ shader_level = 3;
+ }
+ }
+ else
+ {
+ shader_level = 2;
+ }
+
+
+
+ system["shader_level"] = shader_level;
+
+ LLSD &download = body["downloads"];
+
+ download["world_kbytes"] = F64Kilobytes(gTotalWorldData).value();
+ download["object_kbytes"] = F64Kilobytes(gTotalObjectData).value();
+ download["texture_kbytes"] = F64Kilobytes(gTotalTextureData).value();
+ download["mesh_kbytes"] = LLMeshRepository::sBytesReceived/1024.0;
+
+ LLSD &in = body["stats"]["net"]["in"];
+
+ in["kbytes"] = gMessageSystem->mTotalBytesIn / 1024.0;
+ in["packets"] = (S32) gMessageSystem->mPacketsIn;
+ in["compressed_packets"] = (S32) gMessageSystem->mCompressedPacketsIn;
+ in["savings"] = (gMessageSystem->mUncompressedBytesIn -
+ gMessageSystem->mCompressedBytesIn) / 1024.0;
+
+ LLSD &out = body["stats"]["net"]["out"];
+
+ out["kbytes"] = gMessageSystem->mTotalBytesOut / 1024.0;
+ out["packets"] = (S32) gMessageSystem->mPacketsOut;
+ out["compressed_packets"] = (S32) gMessageSystem->mCompressedPacketsOut;
+ out["savings"] = (gMessageSystem->mUncompressedBytesOut -
+ gMessageSystem->mCompressedBytesOut) / 1024.0;
+
+ LLSD &fail = body["stats"]["failures"];
+
+ fail["send_packet"] = (S32) gMessageSystem->mSendPacketFailureCount;
+ fail["dropped"] = (S32) gMessageSystem->mDroppedPackets;
+ fail["resent"] = (S32) gMessageSystem->mResentPackets;
+ fail["failed_resends"] = (S32) gMessageSystem->mFailedResendPackets;
+ fail["off_circuit"] = (S32) gMessageSystem->mOffCircuitPackets;
+ fail["invalid"] = (S32) gMessageSystem->mInvalidOnCircuitPackets;
+ fail["missing_updater"] = (S32) LLAppViewer::instance()->isUpdaterMissing();
+
+ LLSD &inventory = body["inventory"];
+ inventory["usable"] = gInventory.isInventoryUsable();
+ LLSD& validation_info = inventory["validation_info"];
+ gInventory.mValidationInfo->asLLSD(validation_info);
+
+ body["ui"] = LLUIUsage::instance().asLLSD();
+
+ body["stats"]["voice"] = LLVoiceVivoxStats::getInstance()->read();
+
+ // Misc stats, two strings and two ints
+ // These are not expecticed to persist across multiple releases
+ // Comment any changes with your name and the expected release revision
+ // If the current revision is recent, ping the previous author before overriding
+ LLSD &misc = body["stats"]["misc"];
#ifdef LL_WINDOWS
// Probe for Vulkan capability (Dave Houlton 05/2020)
@@ -810,75 +810,75 @@ void send_viewer_stats(bool include_preferences)
misc["int_2"] = LLSD::Integer(0);
LL_INFOS() << "Misc Stats: int_1: " << misc["int_1"] << " int_2: " << misc["int_2"] << LL_ENDL;
- LL_INFOS() << "Misc Stats: string_1: " << misc["string_1"] << " string_2: " << misc["string_2"] << LL_ENDL;
+ LL_INFOS() << "Misc Stats: string_1: " << misc["string_1"] << " string_2: " << misc["string_2"] << LL_ENDL;
- body["DisplayNamesEnabled"] = gSavedSettings.getBOOL("UseDisplayNames");
- body["DisplayNamesShowUsername"] = gSavedSettings.getBOOL("NameTagShowUsernames");
+ body["DisplayNamesEnabled"] = gSavedSettings.getBOOL("UseDisplayNames");
+ body["DisplayNamesShowUsername"] = gSavedSettings.getBOOL("NameTagShowUsernames");
- // Preferences
- if (include_preferences)
- {
- bool diffs_only = true; // only log preferences that differ from default
- body["preferences"]["settings"] = gSavedSettings.asLLSD(diffs_only);
- body["preferences"]["settings_per_account"] = gSavedPerAccountSettings.asLLSD(diffs_only);
- }
+ // Preferences
+ if (include_preferences)
+ {
+ bool diffs_only = true; // only log preferences that differ from default
+ body["preferences"]["settings"] = gSavedSettings.asLLSD(diffs_only);
+ body["preferences"]["settings_per_account"] = gSavedPerAccountSettings.asLLSD(diffs_only);
+ }
- body["MinimalSkin"] = false;
+ body["MinimalSkin"] = false;
- LL_INFOS("LogViewerStatsPacket") << "Sending viewer statistics: " << body << LL_ENDL;
- LL_DEBUGS("LogViewerStatsPacket");
- std::string filename("viewer_stats_packet.xml");
- llofstream of(filename.c_str());
- LLSDSerialize::toPrettyXML(body,of);
- LL_ENDL;
+ LL_INFOS("LogViewerStatsPacket") << "Sending viewer statistics: " << body << LL_ENDL;
+ LL_DEBUGS("LogViewerStatsPacket");
+ std::string filename("viewer_stats_packet.xml");
+ llofstream of(filename.c_str());
+ LLSDSerialize::toPrettyXML(body,of);
+ LL_ENDL;
- // The session ID token must never appear in logs
- body["session_id"] = gAgentSessionID;
+ // The session ID token must never appear in logs
+ body["session_id"] = gAgentSessionID;
- LLViewerStats::getInstance()->addToMessage(body);
+ LLViewerStats::getInstance()->addToMessage(body);
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body,
"Statistics posted to sim", "Failed to post statistics to sim");
- LLViewerStats::instance().getRecording().resume();
+ LLViewerStats::instance().getRecording().resume();
}
LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name)
{
- phase_map_t::iterator iter = mPhaseMap.find(phase_name);
- if (iter == mPhaseMap.end())
- {
- LLTimer timer;
- mPhaseMap[phase_name] = timer;
- }
- LLTimer& timer = mPhaseMap[phase_name];
- return timer;
+ phase_map_t::iterator iter = mPhaseMap.find(phase_name);
+ if (iter == mPhaseMap.end())
+ {
+ LLTimer timer;
+ mPhaseMap[phase_name] = timer;
+ }
+ LLTimer& timer = mPhaseMap[phase_name];
+ return timer;
}
void LLViewerStats::PhaseMap::startPhase(const std::string& phase_name)
{
- LLTimer& timer = getPhaseTimer(phase_name);
- timer.start();
- //LL_DEBUGS("Avatar") << "startPhase " << phase_name << LL_ENDL;
+ LLTimer& timer = getPhaseTimer(phase_name);
+ timer.start();
+ //LL_DEBUGS("Avatar") << "startPhase " << phase_name << LL_ENDL;
}
void LLViewerStats::PhaseMap::clearPhases()
{
- //LL_DEBUGS("Avatar") << "clearPhases" << LL_ENDL;
+ //LL_DEBUGS("Avatar") << "clearPhases" << LL_ENDL;
- mPhaseMap.clear();
+ mPhaseMap.clear();
}
LLSD LLViewerStats::PhaseMap::asLLSD()
{
- LLSD result;
- for (phase_map_t::iterator iter = mPhaseMap.begin(); iter != mPhaseMap.end(); ++iter)
- {
- const std::string& phase_name = iter->first;
- result[phase_name]["completed"] = LLSD::Integer(!(iter->second.getStarted()));
- result[phase_name]["elapsed"] = iter->second.getElapsedTimeF32();
- }
- return result;
+ LLSD result;
+ for (phase_map_t::iterator iter = mPhaseMap.begin(); iter != mPhaseMap.end(); ++iter)
+ {
+ const std::string& phase_name = iter->first;
+ result[phase_name]["completed"] = LLSD::Integer(!(iter->second.getStarted()));
+ result[phase_name]["elapsed"] = iter->second.getElapsedTimeF32();
+ }
+ return result;
}
// static initializer
@@ -891,52 +891,52 @@ LLViewerStats::PhaseMap::PhaseMap()
void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name)
{
- phase_map_t::iterator iter = mPhaseMap.find(phase_name);
- if (iter != mPhaseMap.end())
- {
- if (iter->second.getStarted())
- {
- // Going from started to stopped state - record stats.
- iter->second.stop();
- }
- }
+ phase_map_t::iterator iter = mPhaseMap.find(phase_name);
+ if (iter != mPhaseMap.end())
+ {
+ if (iter->second.getStarted())
+ {
+ // Going from started to stopped state - record stats.
+ iter->second.stop();
+ }
+ }
}
// static
LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name)
{
- phase_stats_t::iterator it = sStats.find(phase_name);
- if (it == sStats.end())
- {
- LLViewerStats::StatsAccumulator new_stats;
- sStats[phase_name] = new_stats;
- }
- return sStats[phase_name];
+ phase_stats_t::iterator it = sStats.find(phase_name);
+ if (it == sStats.end())
+ {
+ LLViewerStats::StatsAccumulator new_stats;
+ sStats[phase_name] = new_stats;
+ }
+ return sStats[phase_name];
}
// static
void LLViewerStats::PhaseMap::recordPhaseStat(const std::string& phase_name, F32 value)
{
- LLViewerStats::StatsAccumulator& stats = getPhaseStats(phase_name);
- stats.push(value);
+ LLViewerStats::StatsAccumulator& stats = getPhaseStats(phase_name);
+ stats.push(value);
}
bool LLViewerStats::PhaseMap::getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed)
{
- phase_map_t::iterator iter = mPhaseMap.find(phase_name);
- bool found = false;
- if (iter != mPhaseMap.end())
- {
- found = true;
- elapsed = iter->second.getElapsedTimeF32();
- completed = !iter->second.getStarted();
- //LL_DEBUGS("Avatar") << " phase_name " << phase_name << " elapsed " << elapsed << " completed " << completed << " timer addr " << (S32)(&iter->second) << LL_ENDL;
- }
- else
- {
- //LL_DEBUGS("Avatar") << " phase_name " << phase_name << " NOT FOUND" << LL_ENDL;
- }
-
- return found;
+ phase_map_t::iterator iter = mPhaseMap.find(phase_name);
+ bool found = false;
+ if (iter != mPhaseMap.end())
+ {
+ found = true;
+ elapsed = iter->second.getElapsedTimeF32();
+ completed = !iter->second.getStarted();
+ //LL_DEBUGS("Avatar") << " phase_name " << phase_name << " elapsed " << elapsed << " completed " << completed << " timer addr " << (S32)(&iter->second) << LL_ENDL;
+ }
+ else
+ {
+ //LL_DEBUGS("Avatar") << " phase_name " << phase_name << " NOT FOUND" << LL_ENDL;
+ }
+
+ return found;
}
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index 4f0f4f8813..a857af53cc 100644
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerim_peningtats.h
* @brief LLViewerStats class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,47 +34,47 @@
enum ESimStatID
{
- LL_SIM_STAT_TIME_DILATION = 0,
- LL_SIM_STAT_FPS = 1,
- LL_SIM_STAT_PHYSFPS = 2,
- LL_SIM_STAT_AGENTUPS = 3,
- LL_SIM_STAT_FRAMEMS = 4,
- LL_SIM_STAT_NETMS = 5,
- LL_SIM_STAT_SIMOTHERMS = 6,
- LL_SIM_STAT_SIMPHYSICSMS = 7,
- LL_SIM_STAT_AGENTMS = 8,
- LL_SIM_STAT_IMAGESMS = 9,
- LL_SIM_STAT_SCRIPTMS = 10,
- LL_SIM_STAT_NUMTASKS = 11,
- LL_SIM_STAT_NUMTASKSACTIVE = 12,
- LL_SIM_STAT_NUMAGENTMAIN = 13,
- LL_SIM_STAT_NUMAGENTCHILD = 14,
- LL_SIM_STAT_NUMSCRIPTSACTIVE = 15,
- LL_SIM_STAT_LSLIPS = 16,
- LL_SIM_STAT_INPPS = 17,
- LL_SIM_STAT_OUTPPS = 18,
- LL_SIM_STAT_PENDING_DOWNLOADS = 19,
- LL_SIM_STAT_PENDING_UPLOADS = 20,
- LL_SIM_STAT_VIRTUAL_SIZE_KB = 21,
- LL_SIM_STAT_RESIDENT_SIZE_KB = 22,
- LL_SIM_STAT_PENDING_LOCAL_UPLOADS = 23,
- LL_SIM_STAT_TOTAL_UNACKED_BYTES = 24,
- LL_SIM_STAT_PHYSICS_PINNED_TASKS = 25,
- LL_SIM_STAT_PHYSICS_LOD_TASKS = 26,
- LL_SIM_STAT_SIMPHYSICSSTEPMS = 27,
- LL_SIM_STAT_SIMPHYSICSSHAPEMS = 28,
- LL_SIM_STAT_SIMPHYSICSOTHERMS = 29,
- LL_SIM_STAT_SIMPHYSICSMEMORY = 30,
- LL_SIM_STAT_SCRIPT_EPS = 31,
- LL_SIM_STAT_SIMSPARETIME = 32,
- LL_SIM_STAT_SIMSLEEPTIME = 33,
- LL_SIM_STAT_IOPUMPTIME = 34,
- LL_SIM_STAT_PCTSCRIPTSRUN = 35,
- LL_SIM_STAT_REGION_IDLE = 36, // dataserver only
- LL_SIM_STAT_REGION_IDLE_POSSIBLE = 37, // dataserver only
- LL_SIM_STAT_SIMAISTEPTIMEMS = 38,
- LL_SIM_STAT_SKIPPEDAISILSTEPS_PS = 39,
- LL_SIM_STAT_PCTSTEPPEDCHARACTERS = 40
+ LL_SIM_STAT_TIME_DILATION = 0,
+ LL_SIM_STAT_FPS = 1,
+ LL_SIM_STAT_PHYSFPS = 2,
+ LL_SIM_STAT_AGENTUPS = 3,
+ LL_SIM_STAT_FRAMEMS = 4,
+ LL_SIM_STAT_NETMS = 5,
+ LL_SIM_STAT_SIMOTHERMS = 6,
+ LL_SIM_STAT_SIMPHYSICSMS = 7,
+ LL_SIM_STAT_AGENTMS = 8,
+ LL_SIM_STAT_IMAGESMS = 9,
+ LL_SIM_STAT_SCRIPTMS = 10,
+ LL_SIM_STAT_NUMTASKS = 11,
+ LL_SIM_STAT_NUMTASKSACTIVE = 12,
+ LL_SIM_STAT_NUMAGENTMAIN = 13,
+ LL_SIM_STAT_NUMAGENTCHILD = 14,
+ LL_SIM_STAT_NUMSCRIPTSACTIVE = 15,
+ LL_SIM_STAT_LSLIPS = 16,
+ LL_SIM_STAT_INPPS = 17,
+ LL_SIM_STAT_OUTPPS = 18,
+ LL_SIM_STAT_PENDING_DOWNLOADS = 19,
+ LL_SIM_STAT_PENDING_UPLOADS = 20,
+ LL_SIM_STAT_VIRTUAL_SIZE_KB = 21,
+ LL_SIM_STAT_RESIDENT_SIZE_KB = 22,
+ LL_SIM_STAT_PENDING_LOCAL_UPLOADS = 23,
+ LL_SIM_STAT_TOTAL_UNACKED_BYTES = 24,
+ LL_SIM_STAT_PHYSICS_PINNED_TASKS = 25,
+ LL_SIM_STAT_PHYSICS_LOD_TASKS = 26,
+ LL_SIM_STAT_SIMPHYSICSSTEPMS = 27,
+ LL_SIM_STAT_SIMPHYSICSSHAPEMS = 28,
+ LL_SIM_STAT_SIMPHYSICSOTHERMS = 29,
+ LL_SIM_STAT_SIMPHYSICSMEMORY = 30,
+ LL_SIM_STAT_SCRIPT_EPS = 31,
+ LL_SIM_STAT_SIMSPARETIME = 32,
+ LL_SIM_STAT_SIMSLEEPTIME = 33,
+ LL_SIM_STAT_IOPUMPTIME = 34,
+ LL_SIM_STAT_PCTSCRIPTSRUN = 35,
+ LL_SIM_STAT_REGION_IDLE = 36, // dataserver only
+ LL_SIM_STAT_REGION_IDLE_POSSIBLE = 37, // dataserver only
+ LL_SIM_STAT_SIMAISTEPTIMEMS = 38,
+ LL_SIM_STAT_SKIPPEDAISILSTEPS_PS = 39,
+ LL_SIM_STAT_PCTSTEPPEDCHARACTERS = 40
};
namespace LLStatViewer
@@ -82,161 +82,161 @@ namespace LLStatViewer
struct SimMeasurementSampler : public LLInstanceTracker<SimMeasurementSampler, ESimStatID>
{
- SimMeasurementSampler(ESimStatID id)
- : LLInstanceTracker<SimMeasurementSampler, ESimStatID>(id)
- {}
- virtual ~SimMeasurementSampler() {}
+ SimMeasurementSampler(ESimStatID id)
+ : LLInstanceTracker<SimMeasurementSampler, ESimStatID>(id)
+ {}
+ virtual ~SimMeasurementSampler() {}
- virtual void sample(F64 value) = 0;
+ virtual void sample(F64 value) = 0;
};
template<typename T = F64>
struct SimMeasurement : public LLTrace::SampleStatHandle<T>, public SimMeasurementSampler
{
- typedef SimMeasurement<T> self_t;
+ typedef SimMeasurement<T> self_t;
- SimMeasurement(const char* name, const char* description, ESimStatID stat_id)
- : LLTrace::SampleStatHandle<T>(name, description),
- SimMeasurementSampler(stat_id)
- {}
+ SimMeasurement(const char* name, const char* description, ESimStatID stat_id)
+ : LLTrace::SampleStatHandle<T>(name, description),
+ SimMeasurementSampler(stat_id)
+ {}
- using SimMeasurementSampler::getInstance;
+ using SimMeasurementSampler::getInstance;
- //friend void sample(self_t& measurement, T value)
- //{
- // LLTrace::sample(static_cast<LLTrace::SampleStatHandle<T>& >(measurement), value);
- //}
+ //friend void sample(self_t& measurement, T value)
+ //{
+ // LLTrace::sample(static_cast<LLTrace::SampleStatHandle<T>& >(measurement), value);
+ //}
- /*virtual*/ void sample(F64 value)
- {
- LLTrace::sample(static_cast<LLTrace::SampleStatHandle<T>& >(*this), value);
- //LLStatViewer::sample(*this, value);
- }
+ /*virtual*/ void sample(F64 value)
+ {
+ LLTrace::sample(static_cast<LLTrace::SampleStatHandle<T>& >(*this), value);
+ //LLStatViewer::sample(*this, value);
+ }
};
-extern LLTrace::CountStatHandle<> FPS,
- PACKETS_IN,
- PACKETS_LOST,
- PACKETS_OUT,
- TEXTURE_PACKETS,
- CHAT_COUNT,
- IM_COUNT,
- OBJECT_CREATE,
- OBJECT_REZ,
- LOGIN_TIMEOUTS,
- LSL_SAVES,
- ANIMATION_UPLOADS,
- FLY,
- TELEPORT,
- DELETE_OBJECT,
- SNAPSHOT,
- UPLOAD_SOUND,
- UPLOAD_TEXTURE,
- EDIT_TEXTURE,
- KILLED,
- FRAMETIME_DOUBLED,
- TEX_BAKES,
- TEX_REBAKES,
- NUM_NEW_OBJECTS;
+extern LLTrace::CountStatHandle<> FPS,
+ PACKETS_IN,
+ PACKETS_LOST,
+ PACKETS_OUT,
+ TEXTURE_PACKETS,
+ CHAT_COUNT,
+ IM_COUNT,
+ OBJECT_CREATE,
+ OBJECT_REZ,
+ LOGIN_TIMEOUTS,
+ LSL_SAVES,
+ ANIMATION_UPLOADS,
+ FLY,
+ TELEPORT,
+ DELETE_OBJECT,
+ SNAPSHOT,
+ UPLOAD_SOUND,
+ UPLOAD_TEXTURE,
+ EDIT_TEXTURE,
+ KILLED,
+ FRAMETIME_DOUBLED,
+ TEX_BAKES,
+ TEX_REBAKES,
+ NUM_NEW_OBJECTS;
extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > TRIANGLES_DRAWN;
-extern LLTrace::CountStatHandle<F64Kilobytes > ACTIVE_MESSAGE_DATA_RECEIVED,
- LAYERS_NETWORK_DATA_RECEIVED,
- OBJECT_NETWORK_DATA_RECEIVED,
- ASSET_UDP_DATA_RECEIVED,
- TEXTURE_NETWORK_DATA_RECEIVED,
- MESSAGE_SYSTEM_DATA_IN,
- MESSAGE_SYSTEM_DATA_OUT;
-
-extern LLTrace::CountStatHandle<F64Seconds > SIM_20_FPS_TIME,
- SIM_PHYSICS_20_FPS_TIME,
- LOSS_5_PERCENT_TIME;
-
-extern SimMeasurement<> SIM_TIME_DILATION,
- SIM_FPS,
- SIM_PHYSICS_FPS,
- SIM_AGENT_UPS,
- SIM_SCRIPT_EPS,
- SIM_SKIPPED_SILHOUETTE,
- SIM_MAIN_AGENTS,
- SIM_CHILD_AGENTS,
- SIM_OBJECTS,
- SIM_ACTIVE_OBJECTS,
- SIM_ACTIVE_SCRIPTS,
- SIM_IN_PACKETS_PER_SEC,
- SIM_OUT_PACKETS_PER_SEC,
- SIM_PENDING_DOWNLOADS,
- SIM_PENDING_UPLOADS,
- SIM_PENDING_LOCAL_UPLOADS,
- SIM_PHYSICS_PINNED_TASKS,
- SIM_PHYSICS_LOD_TASKS;
-
-extern SimMeasurement<LLUnit<F64, LLUnits::Percent> > SIM_PERCENTAGE_SCRIPTS_RUN,
- SIM_SKIPPED_CHARACTERS_PERCENTAGE;
-
-extern LLTrace::SampleStatHandle<> FPS_SAMPLE,
- NUM_IMAGES,
- NUM_RAW_IMAGES,
- NUM_OBJECTS,
- NUM_MATERIALS,
- NUM_ACTIVE_OBJECTS,
- ENABLE_VBO,
- LIGHTING_DETAIL,
- VISIBLE_AVATARS,
- SHADER_OBJECTS,
- DRAW_DISTANCE,
- WINDOW_WIDTH,
- WINDOW_HEIGHT;
+extern LLTrace::CountStatHandle<F64Kilobytes > ACTIVE_MESSAGE_DATA_RECEIVED,
+ LAYERS_NETWORK_DATA_RECEIVED,
+ OBJECT_NETWORK_DATA_RECEIVED,
+ ASSET_UDP_DATA_RECEIVED,
+ TEXTURE_NETWORK_DATA_RECEIVED,
+ MESSAGE_SYSTEM_DATA_IN,
+ MESSAGE_SYSTEM_DATA_OUT;
+
+extern LLTrace::CountStatHandle<F64Seconds > SIM_20_FPS_TIME,
+ SIM_PHYSICS_20_FPS_TIME,
+ LOSS_5_PERCENT_TIME;
+
+extern SimMeasurement<> SIM_TIME_DILATION,
+ SIM_FPS,
+ SIM_PHYSICS_FPS,
+ SIM_AGENT_UPS,
+ SIM_SCRIPT_EPS,
+ SIM_SKIPPED_SILHOUETTE,
+ SIM_MAIN_AGENTS,
+ SIM_CHILD_AGENTS,
+ SIM_OBJECTS,
+ SIM_ACTIVE_OBJECTS,
+ SIM_ACTIVE_SCRIPTS,
+ SIM_IN_PACKETS_PER_SEC,
+ SIM_OUT_PACKETS_PER_SEC,
+ SIM_PENDING_DOWNLOADS,
+ SIM_PENDING_UPLOADS,
+ SIM_PENDING_LOCAL_UPLOADS,
+ SIM_PHYSICS_PINNED_TASKS,
+ SIM_PHYSICS_LOD_TASKS;
+
+extern SimMeasurement<LLUnit<F64, LLUnits::Percent> > SIM_PERCENTAGE_SCRIPTS_RUN,
+ SIM_SKIPPED_CHARACTERS_PERCENTAGE;
+
+extern LLTrace::SampleStatHandle<> FPS_SAMPLE,
+ NUM_IMAGES,
+ NUM_RAW_IMAGES,
+ NUM_OBJECTS,
+ NUM_MATERIALS,
+ NUM_ACTIVE_OBJECTS,
+ ENABLE_VBO,
+ LIGHTING_DETAIL,
+ VISIBLE_AVATARS,
+ SHADER_OBJECTS,
+ DRAW_DISTANCE,
+ WINDOW_WIDTH,
+ WINDOW_HEIGHT;
extern LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > PACKETS_LOST_PERCENT;
extern LLTrace::SampleStatHandle<F64Megabytes > FORMATTED_MEM;
-extern LLTrace::SampleStatHandle<F64Kilobytes > DELTA_BANDWIDTH,
- MAX_BANDWIDTH;
-extern SimMeasurement<F64Milliseconds > SIM_FRAME_TIME,
- SIM_NET_TIME,
- SIM_OTHER_TIME,
- SIM_PHYSICS_TIME,
- SIM_PHYSICS_STEP_TIME,
- SIM_PHYSICS_SHAPE_UPDATE_TIME,
- SIM_PHYSICS_OTHER_TIME,
- SIM_AI_TIME,
- SIM_AGENTS_TIME,
- SIM_IMAGES_TIME,
- SIM_SCRIPTS_TIME,
- SIM_SPARE_TIME,
- SIM_SLEEP_TIME,
- SIM_PUMP_IO_TIME;
-
-extern SimMeasurement<F64Kilobytes > SIM_UNACKED_BYTES;
-extern SimMeasurement<F64Megabytes > SIM_PHYSICS_MEM;
-
-
-extern LLTrace::SampleStatHandle<F64Milliseconds > FRAMETIME_JITTER,
- FRAMETIME_SLEW,
- SIM_PING;
+extern LLTrace::SampleStatHandle<F64Kilobytes > DELTA_BANDWIDTH,
+ MAX_BANDWIDTH;
+extern SimMeasurement<F64Milliseconds > SIM_FRAME_TIME,
+ SIM_NET_TIME,
+ SIM_OTHER_TIME,
+ SIM_PHYSICS_TIME,
+ SIM_PHYSICS_STEP_TIME,
+ SIM_PHYSICS_SHAPE_UPDATE_TIME,
+ SIM_PHYSICS_OTHER_TIME,
+ SIM_AI_TIME,
+ SIM_AGENTS_TIME,
+ SIM_IMAGES_TIME,
+ SIM_SCRIPTS_TIME,
+ SIM_SPARE_TIME,
+ SIM_SLEEP_TIME,
+ SIM_PUMP_IO_TIME;
+
+extern SimMeasurement<F64Kilobytes > SIM_UNACKED_BYTES;
+extern SimMeasurement<F64Megabytes > SIM_PHYSICS_MEM;
+
+
+extern LLTrace::SampleStatHandle<F64Milliseconds > FRAMETIME_JITTER,
+ FRAMETIME_SLEW,
+ SIM_PING;
extern LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Meters> > AGENT_POSITION_SNAP;
-extern LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY;
+extern LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY;
-extern LLTrace::EventStatHandle<F64Milliseconds > REGION_CROSSING_TIME,
- FRAME_STACKTIME,
- UPDATE_STACKTIME,
- NETWORK_STACKTIME,
- IMAGE_STACKTIME,
- REBUILD_STACKTIME,
- RENDER_STACKTIME;
+extern LLTrace::EventStatHandle<F64Milliseconds > REGION_CROSSING_TIME,
+ FRAME_STACKTIME,
+ UPDATE_STACKTIME,
+ NETWORK_STACKTIME,
+ IMAGE_STACKTIME,
+ REBUILD_STACKTIME,
+ RENDER_STACKTIME;
-extern LLTrace::EventStatHandle<F64Seconds > AVATAR_EDIT_TIME,
- TOOLBOX_TIME,
- MOUSELOOK_TIME,
- FPS_10_TIME,
- FPS_8_TIME,
- FPS_2_TIME;
+extern LLTrace::EventStatHandle<F64Seconds > AVATAR_EDIT_TIME,
+ TOOLBOX_TIME,
+ MOUSELOOK_TIME,
+ FPS_10_TIME,
+ FPS_8_TIME,
+ FPS_2_TIME;
extern LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > OBJECT_CACHE_HIT_RATE;
@@ -244,48 +244,48 @@ extern LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > OBJECT_CACHE_HIT
class LLViewerStats : public LLSingleton<LLViewerStats>
{
- LLSINGLETON(LLViewerStats);
- ~LLViewerStats();
+ LLSINGLETON(LLViewerStats);
+ ~LLViewerStats();
public:
- void resetStats();
+ void resetStats();
+
+ void updateFrameStats(const F64Seconds time_diff);
- void updateFrameStats(const F64Seconds time_diff);
-
- void addToMessage(LLSD &body);
+ void addToMessage(LLSD &body);
typedef LLStatsAccumulator StatsAccumulator;
// Phase tracking (originally put in for avatar rezzing), tracking
- // progress of active/completed phases for activities like outfit changing.
- typedef std::map<std::string,LLTimer> phase_map_t;
- typedef std::map<std::string,StatsAccumulator> phase_stats_t;
- class PhaseMap
- {
- private:
- phase_map_t mPhaseMap;
- static phase_stats_t sStats;
- public:
- PhaseMap();
- LLTimer& getPhaseTimer(const std::string& phase_name);
- bool getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed);
- void startPhase(const std::string& phase_name);
- void stopPhase(const std::string& phase_name);
- void clearPhases();
- LLSD asLLSD();
- static StatsAccumulator& getPhaseStats(const std::string& phase_name);
- static void recordPhaseStat(const std::string& phase_name, F32 value);
- phase_map_t::iterator begin() { return mPhaseMap.begin(); }
- phase_map_t::iterator end() { return mPhaseMap.end(); }
- };
-
- LLTrace::Recording& getRecording() { return mRecording; }
- const LLTrace::Recording& getRecording() const { return mRecording; }
+ // progress of active/completed phases for activities like outfit changing.
+ typedef std::map<std::string,LLTimer> phase_map_t;
+ typedef std::map<std::string,StatsAccumulator> phase_stats_t;
+ class PhaseMap
+ {
+ private:
+ phase_map_t mPhaseMap;
+ static phase_stats_t sStats;
+ public:
+ PhaseMap();
+ LLTimer& getPhaseTimer(const std::string& phase_name);
+ bool getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed);
+ void startPhase(const std::string& phase_name);
+ void stopPhase(const std::string& phase_name);
+ void clearPhases();
+ LLSD asLLSD();
+ static StatsAccumulator& getPhaseStats(const std::string& phase_name);
+ static void recordPhaseStat(const std::string& phase_name, F32 value);
+ phase_map_t::iterator begin() { return mPhaseMap.begin(); }
+ phase_map_t::iterator end() { return mPhaseMap.end(); }
+ };
+
+ LLTrace::Recording& getRecording() { return mRecording; }
+ const LLTrace::Recording& getRecording() const { return mRecording; }
private:
- LLTrace::Recording mRecording;
+ LLTrace::Recording mRecording;
- F64Seconds mLastTimeDiff; // used for time stat updates
+ F64Seconds mLastTimeDiff; // used for time stat updates
};
static const F32 SEND_STATS_PERIOD = 300.0f;
@@ -295,7 +295,7 @@ void update_statistics();
void send_viewer_stats(bool include_preferences);
void update_texture_time();
-extern U32Bytes gTotalTextureData;
+extern U32Bytes gTotalTextureData;
extern U32Bytes gTotalObjectData;
extern U32Bytes gTotalTextureBytesPerBoostLevel[] ;
#endif // LL_LLVIEWERSTATS_H
diff --git a/indra/newview/llviewerstatsrecorder.cpp b/indra/newview/llviewerstatsrecorder.cpp
index 6372679a07..88edb96fbb 100644
--- a/indra/newview/llviewerstatsrecorder.cpp
+++ b/indra/newview/llviewerstatsrecorder.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,47 +38,47 @@ extern LLControlGroup gSavedSettings;
LLViewerStatsRecorder* LLViewerStatsRecorder::sInstance = NULL;
LLViewerStatsRecorder::LLViewerStatsRecorder() :
- mStatsFile(NULL),
- mTimer(),
- mFileOpenTime(0.0),
- mLastSnapshotTime(0.0),
+ mStatsFile(NULL),
+ mTimer(),
+ mFileOpenTime(0.0),
+ mLastSnapshotTime(0.0),
mEnableStatsRecording(false),
mEnableStatsLogging(false),
mInterval(0.2),
mMaxDuration(300.f),
mSkipSaveIfZeros(false)
{
- if (NULL != sInstance)
- {
- LL_ERRS() << "Attempted to create multiple instances of LLViewerStatsRecorder!" << LL_ENDL;
- }
- sInstance = this;
- clearStats();
+ if (NULL != sInstance)
+ {
+ LL_ERRS() << "Attempted to create multiple instances of LLViewerStatsRecorder!" << LL_ENDL;
+ }
+ sInstance = this;
+ clearStats();
}
LLViewerStatsRecorder::~LLViewerStatsRecorder()
{
- if (mStatsFile)
- {
+ if (mStatsFile)
+ {
writeToLog(0.f); // Save last data
closeStatsFile();
- }
+ }
}
void LLViewerStatsRecorder::clearStats()
{
- mObjectCacheHitCount = 0;
- mObjectCacheMissFullCount = 0;
- mObjectCacheMissCrcCount = 0;
- mObjectFullUpdates = 0;
- mObjectTerseUpdates = 0;
- mObjectCacheMissRequests = 0;
- mObjectCacheUpdateDupes = 0;
- mObjectCacheUpdateChanges = 0;
- mObjectCacheUpdateAdds = 0;
- mObjectCacheUpdateReplacements = 0;
- mObjectUpdateFailures = 0;
- mTextureFetchCount = 0;
+ mObjectCacheHitCount = 0;
+ mObjectCacheMissFullCount = 0;
+ mObjectCacheMissCrcCount = 0;
+ mObjectFullUpdates = 0;
+ mObjectTerseUpdates = 0;
+ mObjectCacheMissRequests = 0;
+ mObjectCacheUpdateDupes = 0;
+ mObjectCacheUpdateChanges = 0;
+ mObjectCacheUpdateAdds = 0;
+ mObjectCacheUpdateReplacements = 0;
+ mObjectUpdateFailures = 0;
+ mTextureFetchCount = 0;
mMeshLoadedCount = 0;
mObjectKills = 0;
}
@@ -88,12 +88,12 @@ void LLViewerStatsRecorder::enableObjectStatsRecording(bool enable, bool logging
{
mEnableStatsRecording = enable;
- // if logging is stopping, close the file
+ // if logging is stopping, close the file
if (mStatsFile && !logging)
- {
+ {
writeToLog(0.f); // Save last data
closeStatsFile();
- }
+ }
mEnableStatsLogging = logging;
}
@@ -101,184 +101,184 @@ void LLViewerStatsRecorder::enableObjectStatsRecording(bool enable, bool logging
void LLViewerStatsRecorder::recordCacheMissEvent(U8 cache_miss_type)
{
- if (LLViewerRegion::CACHE_MISS_TYPE_TOTAL == cache_miss_type)
- {
- mObjectCacheMissFullCount++;
- }
- else
- {
- mObjectCacheMissCrcCount++;
- }
+ if (LLViewerRegion::CACHE_MISS_TYPE_TOTAL == cache_miss_type)
+ {
+ mObjectCacheMissFullCount++;
+ }
+ else
+ {
+ mObjectCacheMissCrcCount++;
+ }
}
void LLViewerStatsRecorder::recordObjectUpdateEvent(const EObjectUpdateType update_type)
{
switch (update_type)
- {
- case OUT_FULL:
- case OUT_FULL_COMPRESSED:
+ {
+ case OUT_FULL:
+ case OUT_FULL_COMPRESSED:
mObjectFullUpdates++;
- break;
- case OUT_TERSE_IMPROVED:
- mObjectTerseUpdates++;
- break;
- default:
- LL_WARNS() << "Unknown update_type" << LL_ENDL;
- break;
- };
+ break;
+ case OUT_TERSE_IMPROVED:
+ mObjectTerseUpdates++;
+ break;
+ default:
+ LL_WARNS() << "Unknown update_type" << LL_ENDL;
+ break;
+ };
}
void LLViewerStatsRecorder::recordCacheFullUpdate(LLViewerRegion::eCacheUpdateResult update_result)
{
switch (update_result)
- {
- case LLViewerRegion::CACHE_UPDATE_DUPE:
- mObjectCacheUpdateDupes++;
- break;
- case LLViewerRegion::CACHE_UPDATE_CHANGED:
- mObjectCacheUpdateChanges++;
- break;
- case LLViewerRegion::CACHE_UPDATE_ADDED:
- mObjectCacheUpdateAdds++;
- break;
- case LLViewerRegion::CACHE_UPDATE_REPLACED:
- mObjectCacheUpdateReplacements++;
- break;
- default:
+ {
+ case LLViewerRegion::CACHE_UPDATE_DUPE:
+ mObjectCacheUpdateDupes++;
+ break;
+ case LLViewerRegion::CACHE_UPDATE_CHANGED:
+ mObjectCacheUpdateChanges++;
+ break;
+ case LLViewerRegion::CACHE_UPDATE_ADDED:
+ mObjectCacheUpdateAdds++;
+ break;
+ case LLViewerRegion::CACHE_UPDATE_REPLACED:
+ mObjectCacheUpdateReplacements++;
+ break;
+ default:
LL_WARNS() << "Unknown update_result type " << (S32) update_result << LL_ENDL;
- break;
- };
+ break;
+ };
}
void LLViewerStatsRecorder::writeToLog( F32 interval )
{
if (!mEnableStatsLogging || !mEnableStatsRecording)
- {
- return;
- }
+ {
+ return;
+ }
- size_t data_size = 0;
- F64 delta_time = LLFrameTimer::getTotalSeconds() - mLastSnapshotTime;
+ size_t data_size = 0;
+ F64 delta_time = LLFrameTimer::getTotalSeconds() - mLastSnapshotTime;
if (delta_time < interval)
return;
- if (mSkipSaveIfZeros)
- {
+ if (mSkipSaveIfZeros)
+ {
S32 total_events = mObjectCacheHitCount + mObjectCacheMissCrcCount + mObjectCacheMissFullCount + mObjectFullUpdates +
mObjectTerseUpdates + mObjectCacheMissRequests + mObjectCacheUpdateDupes +
mObjectCacheUpdateChanges + mObjectCacheUpdateAdds + mObjectCacheUpdateReplacements + mObjectUpdateFailures;
- if (total_events == 0)
- {
+ if (total_events == 0)
+ {
LL_DEBUGS("ILXZeroData") << "ILX: not saving zero data" << LL_ENDL;
return;
}
- }
+ }
- mLastSnapshotTime = LLFrameTimer::getTotalSeconds();
+ mLastSnapshotTime = LLFrameTimer::getTotalSeconds();
LL_DEBUGS("ILX") << "ILX: "
- << mObjectCacheHitCount << " hits, "
- << mObjectCacheMissFullCount << " full misses, "
- << mObjectCacheMissCrcCount << " crc misses, "
- << mObjectFullUpdates << " full updates, "
- << mObjectTerseUpdates << " terse updates, "
- << mObjectCacheMissRequests << " cache miss requests, "
- << mObjectCacheUpdateDupes << " cache update dupes, "
- << mObjectCacheUpdateChanges << " cache update changes, "
- << mObjectCacheUpdateAdds << " cache update adds, "
- << mObjectCacheUpdateReplacements << " cache update replacements,"
- << mObjectUpdateFailures << " update failures,"
- << mTextureFetchCount << " texture fetches, "
- << mMeshLoadedCount << " mesh loads, "
+ << mObjectCacheHitCount << " hits, "
+ << mObjectCacheMissFullCount << " full misses, "
+ << mObjectCacheMissCrcCount << " crc misses, "
+ << mObjectFullUpdates << " full updates, "
+ << mObjectTerseUpdates << " terse updates, "
+ << mObjectCacheMissRequests << " cache miss requests, "
+ << mObjectCacheUpdateDupes << " cache update dupes, "
+ << mObjectCacheUpdateChanges << " cache update changes, "
+ << mObjectCacheUpdateAdds << " cache update adds, "
+ << mObjectCacheUpdateReplacements << " cache update replacements,"
+ << mObjectUpdateFailures << " update failures,"
+ << mTextureFetchCount << " texture fetches, "
+ << mMeshLoadedCount << " mesh loads, "
<< mObjectKills << " object kills"
- << LL_ENDL;
-
- if (mStatsFile == NULL)
- {
- // Refresh settings
+ << LL_ENDL;
+
+ if (mStatsFile == NULL)
+ {
+ // Refresh settings
mInterval = gSavedSettings.getF32("StatsReportFileInterval");
mSkipSaveIfZeros = gSavedSettings.getBOOL("StatsReportSkipZeroDataSaves");
- mMaxDuration = gSavedSettings.getF32("StatsReportMaxDuration");
+ mMaxDuration = gSavedSettings.getF32("StatsReportMaxDuration");
- // Open the data file
+ // Open the data file
makeStatsFileName();
mStatsFile = LLFile::fopen(mStatsFileName, "wb");
- if (mStatsFile)
- {
+ if (mStatsFile)
+ {
LL_INFOS("ILX") << "ILX: Writing update information to " << mStatsFileName << LL_ENDL;
mFileOpenTime = LLFrameTimer::getTotalSeconds();
// Write column headers
- std::ostringstream col_headers;
- col_headers << "Time (sec),"
- << "Regions,"
- << "Active Cached Objects,"
- << "Cache Hits,"
- << "Cache Full Misses,"
- << "Cache Crc Misses,"
- << "Full Updates,"
- << "Terse Updates,"
- << "Cache Miss Requests," // Normally results in a Full Update from simulator
- << "Cache Update Dupes,"
- << "Cache Update Changes,"
- << "Cache Update Adds,"
- << "Cache Update Replacements,"
- << "Update Failures,"
- << "Texture Count,"
+ std::ostringstream col_headers;
+ col_headers << "Time (sec),"
+ << "Regions,"
+ << "Active Cached Objects,"
+ << "Cache Hits,"
+ << "Cache Full Misses,"
+ << "Cache Crc Misses,"
+ << "Full Updates,"
+ << "Terse Updates,"
+ << "Cache Miss Requests," // Normally results in a Full Update from simulator
+ << "Cache Update Dupes,"
+ << "Cache Update Changes,"
+ << "Cache Update Adds,"
+ << "Cache Update Replacements,"
+ << "Update Failures,"
+ << "Texture Count,"
<< "Mesh Load Count,"
<< "Object Kills"
<< "\n";
- data_size = col_headers.str().size();
- if (fwrite(col_headers.str().c_str(), 1, data_size, mStatsFile ) != data_size)
- {
- LL_WARNS() << "failed to write full headers to " << mStatsFileName << LL_ENDL;
- // Close the file and turn off stats logging
+ data_size = col_headers.str().size();
+ if (fwrite(col_headers.str().c_str(), 1, data_size, mStatsFile ) != data_size)
+ {
+ LL_WARNS() << "failed to write full headers to " << mStatsFileName << LL_ENDL;
+ // Close the file and turn off stats logging
closeStatsFile();
- return;
- }
- }
- else
- { // Failed to open file
- LL_WARNS() << "Couldn't open " << mStatsFileName << " for logging, turning off stats recording." << LL_ENDL;
+ return;
+ }
+ }
+ else
+ { // Failed to open file
+ LL_WARNS() << "Couldn't open " << mStatsFileName << " for logging, turning off stats recording." << LL_ENDL;
mEnableStatsLogging = false;
- return;
- }
- }
-
- std::ostringstream stats_data;
-
- stats_data << getTimeSinceStart()
- << "," << LLWorld::getInstance()->getRegionList().size()
- << "," << LLWorld::getInstance()->getNumOfActiveCachedObjects()
- << "," << mObjectCacheHitCount
- << "," << mObjectCacheMissFullCount
- << "," << mObjectCacheMissCrcCount
- << "," << mObjectFullUpdates
- << "," << mObjectTerseUpdates
- << "," << mObjectCacheMissRequests
- << "," << mObjectCacheUpdateDupes
- << "," << mObjectCacheUpdateChanges
- << "," << mObjectCacheUpdateAdds
- << "," << mObjectCacheUpdateReplacements
- << "," << mObjectUpdateFailures
- << "," << mTextureFetchCount
- << "," << mMeshLoadedCount
- << "," << mObjectKills
- << "\n";
-
- data_size = stats_data.str().size();
- if ( data_size != fwrite(stats_data.str().c_str(), 1, data_size, mStatsFile ))
- {
- LL_WARNS() << "Unable to write complete column data to " << mStatsFileName << LL_ENDL;
+ return;
+ }
+ }
+
+ std::ostringstream stats_data;
+
+ stats_data << getTimeSinceStart()
+ << "," << LLWorld::getInstance()->getRegionList().size()
+ << "," << LLWorld::getInstance()->getNumOfActiveCachedObjects()
+ << "," << mObjectCacheHitCount
+ << "," << mObjectCacheMissFullCount
+ << "," << mObjectCacheMissCrcCount
+ << "," << mObjectFullUpdates
+ << "," << mObjectTerseUpdates
+ << "," << mObjectCacheMissRequests
+ << "," << mObjectCacheUpdateDupes
+ << "," << mObjectCacheUpdateChanges
+ << "," << mObjectCacheUpdateAdds
+ << "," << mObjectCacheUpdateReplacements
+ << "," << mObjectUpdateFailures
+ << "," << mTextureFetchCount
+ << "," << mMeshLoadedCount
+ << "," << mObjectKills
+ << "\n";
+
+ data_size = stats_data.str().size();
+ if ( data_size != fwrite(stats_data.str().c_str(), 1, data_size, mStatsFile ))
+ {
+ LL_WARNS() << "Unable to write complete column data to " << mStatsFileName << LL_ENDL;
closeStatsFile();
}
- clearStats();
+ clearStats();
- if (getTimeSinceStart() >= mMaxDuration)
+ if (getTimeSinceStart() >= mMaxDuration)
{ // If file recording has been running for too long, stop it.
closeStatsFile();
}
@@ -286,12 +286,12 @@ void LLViewerStatsRecorder::writeToLog( F32 interval )
void LLViewerStatsRecorder::closeStatsFile()
{
- if (mStatsFile)
- {
+ if (mStatsFile)
+ {
LL_INFOS("ILX") << "ILX: Stopped writing update information to " << mStatsFileName << " after " << getTimeSinceStart()
<< " seconds." << LL_ENDL;
LLFile::close(mStatsFile);
- mStatsFile = NULL;
+ mStatsFile = NULL;
}
mEnableStatsLogging = false;
}
@@ -315,7 +315,7 @@ void LLViewerStatsRecorder::makeStatsFileName()
F32 LLViewerStatsRecorder::getTimeSinceStart()
{
- return (F32) (LLFrameTimer::getTotalSeconds() - mFileOpenTime);
+ return (F32) (LLFrameTimer::getTotalSeconds() - mFileOpenTime);
}
diff --git a/indra/newview/llviewerstatsrecorder.h b/indra/newview/llviewerstatsrecorder.h
index b9fe02e54d..ecc321c0a8 100644
--- a/indra/newview/llviewerstatsrecorder.h
+++ b/indra/newview/llviewerstatsrecorder.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,36 +40,36 @@ class LLViewerObject;
class LLViewerStatsRecorder : public LLSingleton<LLViewerStatsRecorder>
{
- LLSINGLETON(LLViewerStatsRecorder);
- LOG_CLASS(LLViewerStatsRecorder);
- ~LLViewerStatsRecorder();
+ LLSINGLETON(LLViewerStatsRecorder);
+ LOG_CLASS(LLViewerStatsRecorder);
+ ~LLViewerStatsRecorder();
public:
- // Enable/disable stats recording. This is broken down into two
- // flags so we can record stats without writing them to the log
- // file. This is useful to analyzing updates for scene loading.
+ // Enable/disable stats recording. This is broken down into two
+ // flags so we can record stats without writing them to the log
+ // file. This is useful to analyzing updates for scene loading.
void enableObjectStatsRecording(bool enable, bool logging = false);
- bool isEnabled() const { return mEnableStatsRecording; }
- bool isLogging() const { return mEnableStatsLogging; }
+ bool isEnabled() const { return mEnableStatsRecording; }
+ bool isLogging() const { return mEnableStatsLogging; }
- void objectUpdateFailure()
+ void objectUpdateFailure()
{
if (mEnableStatsRecording)
{
mObjectUpdateFailures++;
}
- }
+ }
- void cacheMissEvent(U8 cache_miss_type)
- {
+ void cacheMissEvent(U8 cache_miss_type)
+ {
if (mEnableStatsRecording)
{
recordCacheMissEvent(cache_miss_type);
}
}
- void cacheHitEvent()
+ void cacheHitEvent()
{
if (mEnableStatsRecording)
{
@@ -79,98 +79,98 @@ class LLViewerStatsRecorder : public LLSingleton<LLViewerStatsRecorder>
void objectUpdateEvent(const EObjectUpdateType update_type)
{
- if (mEnableStatsRecording)
- {
- recordObjectUpdateEvent(update_type);
- }
- }
+ if (mEnableStatsRecording)
+ {
+ recordObjectUpdateEvent(update_type);
+ }
+ }
- void cacheFullUpdate(LLViewerRegion::eCacheUpdateResult update_result)
+ void cacheFullUpdate(LLViewerRegion::eCacheUpdateResult update_result)
+ {
+ if (mEnableStatsRecording)
+ {
+ recordCacheFullUpdate(update_result);
+ }
+ }
+
+ void requestCacheMissesEvent(S32 count)
{
- if (mEnableStatsRecording)
- {
- recordCacheFullUpdate(update_result);
- }
- }
-
- void requestCacheMissesEvent(S32 count)
- {
if (mEnableStatsRecording)
{
mObjectCacheMissRequests += count;
}
- }
+ }
- void textureFetch()
- {
+ void textureFetch()
+ {
if (mEnableStatsRecording)
{
mTextureFetchCount += 1;
}
- }
+ }
- void meshLoaded()
- {
- if (mEnableStatsRecording)
- {
+ void meshLoaded()
+ {
+ if (mEnableStatsRecording)
+ {
mMeshLoadedCount += 1;
- }
- }
+ }
+ }
- void recordObjectKills(S32 num_objects)
- {
- if (mEnableStatsRecording)
+ void recordObjectKills(S32 num_objects)
+ {
+ if (mEnableStatsRecording)
{
mObjectKills += num_objects;
}
- }
+ }
- void idle()
- {
+ void idle()
+ {
writeToLog(mInterval);
- }
+ }
- F32 getTimeSinceStart();
+ F32 getTimeSinceStart();
private:
- void recordCacheMissEvent(U8 cache_miss_type);
- void recordObjectUpdateEvent(const EObjectUpdateType update_type);
- void recordCacheFullUpdate(LLViewerRegion::eCacheUpdateResult update_result);
- void writeToLog(F32 interval);
+ void recordCacheMissEvent(U8 cache_miss_type);
+ void recordObjectUpdateEvent(const EObjectUpdateType update_type);
+ void recordCacheFullUpdate(LLViewerRegion::eCacheUpdateResult update_result);
+ void writeToLog(F32 interval);
void closeStatsFile();
- void makeStatsFileName();
+ void makeStatsFileName();
- static LLViewerStatsRecorder* sInstance;
+ static LLViewerStatsRecorder* sInstance;
- LLFILE * mStatsFile; // File to write data into
+ LLFILE * mStatsFile; // File to write data into
std::string mStatsFileName;
- LLFrameTimer mTimer;
- F64 mFileOpenTime;
- F64 mLastSnapshotTime;
- F32 mInterval; // Interval between data log writes
- F32 mMaxDuration; // Time limit on file
-
- bool mEnableStatsRecording; // Set to true to enable recording stats data
- bool mEnableStatsLogging; // Set true to write stats to log file
- bool mSkipSaveIfZeros; // Set true to skip saving stats if all values are zero
-
- S32 mObjectCacheHitCount;
- S32 mObjectCacheMissFullCount;
- S32 mObjectCacheMissCrcCount;
- S32 mObjectFullUpdates;
- S32 mObjectTerseUpdates;
- S32 mObjectCacheMissRequests;
- S32 mObjectCacheUpdateDupes;
- S32 mObjectCacheUpdateChanges;
- S32 mObjectCacheUpdateAdds;
- S32 mObjectCacheUpdateReplacements;
- S32 mObjectUpdateFailures;
- S32 mTextureFetchCount;
+ LLFrameTimer mTimer;
+ F64 mFileOpenTime;
+ F64 mLastSnapshotTime;
+ F32 mInterval; // Interval between data log writes
+ F32 mMaxDuration; // Time limit on file
+
+ bool mEnableStatsRecording; // Set to true to enable recording stats data
+ bool mEnableStatsLogging; // Set true to write stats to log file
+ bool mSkipSaveIfZeros; // Set true to skip saving stats if all values are zero
+
+ S32 mObjectCacheHitCount;
+ S32 mObjectCacheMissFullCount;
+ S32 mObjectCacheMissCrcCount;
+ S32 mObjectFullUpdates;
+ S32 mObjectTerseUpdates;
+ S32 mObjectCacheMissRequests;
+ S32 mObjectCacheUpdateDupes;
+ S32 mObjectCacheUpdateChanges;
+ S32 mObjectCacheUpdateAdds;
+ S32 mObjectCacheUpdateReplacements;
+ S32 mObjectUpdateFailures;
+ S32 mTextureFetchCount;
S32 mMeshLoadedCount;
- S32 mObjectKills;
+ S32 mObjectKills;
- void clearStats();
+ void clearStats();
};
#endif // LLVIEWERSTATSRECORDER_H
diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp
index 4c2fbcf837..fa7ba852be 100644
--- a/indra/newview/llviewertexlayer.cpp
+++ b/indra/newview/llviewertexlayer.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewertexlayer.cpp
* @brief Viewer texture layer. Used for avatars.
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,205 +48,205 @@ extern std::string self_av_string();
// static
S32 LLViewerTexLayerSetBuffer::sGLByteCount = 0;
-LLViewerTexLayerSetBuffer::LLViewerTexLayerSetBuffer(LLTexLayerSet* const owner,
- S32 width, S32 height) :
- // ORDER_LAST => must render these after the hints are created.
- LLTexLayerSetBuffer(owner),
+LLViewerTexLayerSetBuffer::LLViewerTexLayerSetBuffer(LLTexLayerSet* const owner,
+ S32 width, S32 height) :
+ // ORDER_LAST => must render these after the hints are created.
+ LLTexLayerSetBuffer(owner),
LLViewerDynamicTexture(width, height, 4, LLViewerDynamicTexture::ORDER_LAST, FALSE),
- mNeedsUpdate(TRUE),
- mNumLowresUpdates(0)
+ mNeedsUpdate(TRUE),
+ mNumLowresUpdates(0)
{
- mGLTexturep->setNeedsAlphaAndPickMask(FALSE);
+ mGLTexturep->setNeedsAlphaAndPickMask(FALSE);
- LLViewerTexLayerSetBuffer::sGLByteCount += getSize();
- mNeedsUpdateTimer.start();
+ LLViewerTexLayerSetBuffer::sGLByteCount += getSize();
+ mNeedsUpdateTimer.start();
}
LLViewerTexLayerSetBuffer::~LLViewerTexLayerSetBuffer()
{
- LLViewerTexLayerSetBuffer::sGLByteCount -= getSize();
- destroyGLTexture();
- for( S32 order = 0; order < ORDER_COUNT; order++ )
- {
- LLViewerDynamicTexture::sInstances[order].erase(this); // will fail in all but one case.
- }
+ LLViewerTexLayerSetBuffer::sGLByteCount -= getSize();
+ destroyGLTexture();
+ for( S32 order = 0; order < ORDER_COUNT; order++ )
+ {
+ LLViewerDynamicTexture::sInstances[order].erase(this); // will fail in all but one case.
+ }
}
-//virtual
-S8 LLViewerTexLayerSetBuffer::getType() const
+//virtual
+S8 LLViewerTexLayerSetBuffer::getType() const
{
- return LLViewerDynamicTexture::LL_TEX_LAYER_SET_BUFFER ;
+ return LLViewerDynamicTexture::LL_TEX_LAYER_SET_BUFFER ;
}
-//virtual
-void LLViewerTexLayerSetBuffer::restoreGLTexture()
-{
- LLViewerDynamicTexture::restoreGLTexture() ;
+//virtual
+void LLViewerTexLayerSetBuffer::restoreGLTexture()
+{
+ LLViewerDynamicTexture::restoreGLTexture() ;
}
-//virtual
-void LLViewerTexLayerSetBuffer::destroyGLTexture()
+//virtual
+void LLViewerTexLayerSetBuffer::destroyGLTexture()
{
- LLViewerDynamicTexture::destroyGLTexture() ;
+ LLViewerDynamicTexture::destroyGLTexture() ;
}
// static
void LLViewerTexLayerSetBuffer::dumpTotalByteCount()
{
- LL_INFOS() << "Composite System GL Buffers: " << (LLViewerTexLayerSetBuffer::sGLByteCount/1024) << "KB" << LL_ENDL;
+ LL_INFOS() << "Composite System GL Buffers: " << (LLViewerTexLayerSetBuffer::sGLByteCount/1024) << "KB" << LL_ENDL;
}
void LLViewerTexLayerSetBuffer::requestUpdate()
{
- restartUpdateTimer();
- mNeedsUpdate = TRUE;
- mNumLowresUpdates = 0;
+ restartUpdateTimer();
+ mNeedsUpdate = TRUE;
+ mNumLowresUpdates = 0;
}
void LLViewerTexLayerSetBuffer::restartUpdateTimer()
{
- mNeedsUpdateTimer.reset();
- mNeedsUpdateTimer.start();
+ mNeedsUpdateTimer.reset();
+ mNeedsUpdateTimer.start();
}
// virtual
BOOL LLViewerTexLayerSetBuffer::needsRender()
{
- llassert(mTexLayerSet->getAvatarAppearance() == gAgentAvatarp);
- if (!isAgentAvatarValid()) return FALSE;
-
- const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
-
- // Don't render if we don't want to (or aren't ready to) update.
- if (!update_now)
- {
- return FALSE;
- }
-
- // Don't render if we're animating our appearance.
- if (gAgentAvatarp->getIsAppearanceAnimating())
- {
- return FALSE;
- }
-
- // Don't render if we are trying to create a skirt texture but aren't wearing a skirt.
- if (gAgentAvatarp->getBakedTE(getViewerTexLayerSet()) == LLAvatarAppearanceDefines::TEX_SKIRT_BAKED &&
- !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
- {
- return FALSE;
- }
-
- // Render if we have at least minimal level of detail for each local texture.
- return getViewerTexLayerSet()->isLocalTextureDataAvailable();
+ llassert(mTexLayerSet->getAvatarAppearance() == gAgentAvatarp);
+ if (!isAgentAvatarValid()) return FALSE;
+
+ const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
+
+ // Don't render if we don't want to (or aren't ready to) update.
+ if (!update_now)
+ {
+ return FALSE;
+ }
+
+ // Don't render if we're animating our appearance.
+ if (gAgentAvatarp->getIsAppearanceAnimating())
+ {
+ return FALSE;
+ }
+
+ // Don't render if we are trying to create a skirt texture but aren't wearing a skirt.
+ if (gAgentAvatarp->getBakedTE(getViewerTexLayerSet()) == LLAvatarAppearanceDefines::TEX_SKIRT_BAKED &&
+ !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
+ {
+ return FALSE;
+ }
+
+ // Render if we have at least minimal level of detail for each local texture.
+ return getViewerTexLayerSet()->isLocalTextureDataAvailable();
}
// virtual
void LLViewerTexLayerSetBuffer::preRenderTexLayerSet()
{
- LLTexLayerSetBuffer::preRenderTexLayerSet();
-
- // keep depth buffer, we don't need to clear it
- LLViewerDynamicTexture::preRender(FALSE);
+ LLTexLayerSetBuffer::preRenderTexLayerSet();
+
+ // keep depth buffer, we don't need to clear it
+ LLViewerDynamicTexture::preRender(FALSE);
}
// virtual
void LLViewerTexLayerSetBuffer::postRenderTexLayerSet(BOOL success)
{
- LLTexLayerSetBuffer::postRenderTexLayerSet(success);
- LLViewerDynamicTexture::postRender(success);
+ LLTexLayerSetBuffer::postRenderTexLayerSet(success);
+ LLViewerDynamicTexture::postRender(success);
}
// virtual
void LLViewerTexLayerSetBuffer::midRenderTexLayerSet(BOOL success)
{
- const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
- if (update_now)
- {
- doUpdate();
- }
-
- // *TODO: Old logic does not check success before setGLTextureCreated
- // we have valid texture data now
- mGLTexturep->setGLTextureCreated(true);
+ const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
+ if (update_now)
+ {
+ doUpdate();
+ }
+
+ // *TODO: Old logic does not check success before setGLTextureCreated
+ // we have valid texture data now
+ mGLTexturep->setGLTextureCreated(true);
}
BOOL LLViewerTexLayerSetBuffer::isInitialized(void) const
{
- return mGLTexturep.notNull() && mGLTexturep->isGLTextureCreated();
+ return mGLTexturep.notNull() && mGLTexturep->isGLTextureCreated();
}
BOOL LLViewerTexLayerSetBuffer::isReadyToUpdate() const
{
- // If we requested an update and have the final LOD ready, then update.
- if (getViewerTexLayerSet()->isLocalTextureDataFinal()) return TRUE;
-
- // If we haven't done an update yet, then just do one now regardless of state of textures.
- if (mNumLowresUpdates == 0) return TRUE;
-
- // Update if we've hit a timeout. Unlike for uploads, we can make this timeout fairly small
- // since render unnecessarily doesn't cost much.
- const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedLocalTextureUpdateTimeout");
- if (texture_timeout != 0)
- {
- // If we hit our timeout and have textures available at even lower resolution, then update.
- const BOOL is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= texture_timeout;
- const BOOL has_lower_lod = getViewerTexLayerSet()->isLocalTextureDataAvailable();
- if (has_lower_lod && is_update_textures_timeout) return TRUE;
- }
-
- return FALSE;
+ // If we requested an update and have the final LOD ready, then update.
+ if (getViewerTexLayerSet()->isLocalTextureDataFinal()) return TRUE;
+
+ // If we haven't done an update yet, then just do one now regardless of state of textures.
+ if (mNumLowresUpdates == 0) return TRUE;
+
+ // Update if we've hit a timeout. Unlike for uploads, we can make this timeout fairly small
+ // since render unnecessarily doesn't cost much.
+ const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedLocalTextureUpdateTimeout");
+ if (texture_timeout != 0)
+ {
+ // If we hit our timeout and have textures available at even lower resolution, then update.
+ const BOOL is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= texture_timeout;
+ const BOOL has_lower_lod = getViewerTexLayerSet()->isLocalTextureDataAvailable();
+ if (has_lower_lod && is_update_textures_timeout) return TRUE;
+ }
+
+ return FALSE;
}
BOOL LLViewerTexLayerSetBuffer::requestUpdateImmediate()
{
- mNeedsUpdate = TRUE;
- BOOL result = FALSE;
+ mNeedsUpdate = TRUE;
+ BOOL result = FALSE;
- if (needsRender())
- {
- preRender(FALSE);
- result = render();
- postRender(result);
- }
+ if (needsRender())
+ {
+ preRender(FALSE);
+ result = render();
+ postRender(result);
+ }
- return result;
+ return result;
}
// Mostly bookkeeping; don't need to actually "do" anything since
// render() will actually do the update.
void LLViewerTexLayerSetBuffer::doUpdate()
{
- LLViewerTexLayerSet* layer_set = getViewerTexLayerSet();
- const BOOL highest_lod = layer_set->isLocalTextureDataFinal();
- if (highest_lod)
- {
- mNeedsUpdate = FALSE;
- }
- else
- {
- mNumLowresUpdates++;
- }
-
- restartUpdateTimer();
-
- // need to switch to using this layerset if this is the first update
- // after getting the lowest LOD
- layer_set->getAvatar()->updateMeshTextures();
-
- // Print out notification that we updated this texture.
- if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
- {
- const BOOL highest_lod = layer_set->isLocalTextureDataFinal();
- const std::string lod_str = highest_lod ? "HighRes" : "LowRes";
- LLSD args;
- args["EXISTENCE"] = llformat("%d",(U32)layer_set->getAvatar()->debugGetExistenceTimeElapsedF32());
- args["TIME"] = llformat("%d",(U32)mNeedsUpdateTimer.getElapsedTimeF32());
- args["BODYREGION"] = layer_set->getBodyRegionName();
- args["RESOLUTION"] = lod_str;
- LLNotificationsUtil::add("AvatarRezSelfBakedTextureUpdateNotification",args);
- LL_DEBUGS("Avatar") << self_av_string() << "Locally updating [ name: " << layer_set->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUpdateTimer.getElapsedTimeF32() << " ]" << LL_ENDL;
- }
+ LLViewerTexLayerSet* layer_set = getViewerTexLayerSet();
+ const BOOL highest_lod = layer_set->isLocalTextureDataFinal();
+ if (highest_lod)
+ {
+ mNeedsUpdate = FALSE;
+ }
+ else
+ {
+ mNumLowresUpdates++;
+ }
+
+ restartUpdateTimer();
+
+ // need to switch to using this layerset if this is the first update
+ // after getting the lowest LOD
+ layer_set->getAvatar()->updateMeshTextures();
+
+ // Print out notification that we updated this texture.
+ if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
+ {
+ const BOOL highest_lod = layer_set->isLocalTextureDataFinal();
+ const std::string lod_str = highest_lod ? "HighRes" : "LowRes";
+ LLSD args;
+ args["EXISTENCE"] = llformat("%d",(U32)layer_set->getAvatar()->debugGetExistenceTimeElapsedF32());
+ args["TIME"] = llformat("%d",(U32)mNeedsUpdateTimer.getElapsedTimeF32());
+ args["BODYREGION"] = layer_set->getBodyRegionName();
+ args["RESOLUTION"] = lod_str;
+ LLNotificationsUtil::add("AvatarRezSelfBakedTextureUpdateNotification",args);
+ LL_DEBUGS("Avatar") << self_av_string() << "Locally updating [ name: " << layer_set->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUpdateTimer.getElapsedTimeF32() << " ]" << LL_ENDL;
+ }
}
//-----------------------------------------------------------------------------
@@ -255,8 +255,8 @@ void LLViewerTexLayerSetBuffer::doUpdate()
//-----------------------------------------------------------------------------
LLViewerTexLayerSet::LLViewerTexLayerSet(LLAvatarAppearance* const appearance) :
- LLTexLayerSet(appearance),
- mUpdatesEnabled( FALSE )
+ LLTexLayerSet(appearance),
+ mUpdatesEnabled( FALSE )
{
}
@@ -268,86 +268,86 @@ LLViewerTexLayerSet::~LLViewerTexLayerSet()
// Returns TRUE if at least one packet of data has been received for each of the textures that this layerset depends on.
BOOL LLViewerTexLayerSet::isLocalTextureDataAvailable() const
{
- if (!mAvatarAppearance->isSelf()) return FALSE;
- return getAvatar()->isLocalTextureDataAvailable(this);
+ if (!mAvatarAppearance->isSelf()) return FALSE;
+ return getAvatar()->isLocalTextureDataAvailable(this);
}
// Returns TRUE if all of the data for the textures that this layerset depends on have arrived.
BOOL LLViewerTexLayerSet::isLocalTextureDataFinal() const
{
- if (!mAvatarAppearance->isSelf()) return FALSE;
- return getAvatar()->isLocalTextureDataFinal(this);
+ if (!mAvatarAppearance->isSelf()) return FALSE;
+ return getAvatar()->isLocalTextureDataFinal(this);
}
// virtual
void LLViewerTexLayerSet::requestUpdate()
{
- if( mUpdatesEnabled )
- {
- createComposite();
- getViewerComposite()->requestUpdate();
- }
+ if( mUpdatesEnabled )
+ {
+ createComposite();
+ getViewerComposite()->requestUpdate();
+ }
}
void LLViewerTexLayerSet::updateComposite()
{
- createComposite();
- getViewerComposite()->requestUpdateImmediate();
+ createComposite();
+ getViewerComposite()->requestUpdateImmediate();
}
// virtual
void LLViewerTexLayerSet::createComposite()
{
- if(!mComposite)
- {
- S32 width = mInfo->getWidth();
- S32 height = mInfo->getHeight();
- // Composite other avatars at reduced resolution
- if( !mAvatarAppearance->isSelf() )
- {
- LL_ERRS() << "composites should not be created for non-self avatars!" << LL_ENDL;
- }
- mComposite = new LLViewerTexLayerSetBuffer( this, width, height );
- }
+ if(!mComposite)
+ {
+ S32 width = mInfo->getWidth();
+ S32 height = mInfo->getHeight();
+ // Composite other avatars at reduced resolution
+ if( !mAvatarAppearance->isSelf() )
+ {
+ LL_ERRS() << "composites should not be created for non-self avatars!" << LL_ENDL;
+ }
+ mComposite = new LLViewerTexLayerSetBuffer( this, width, height );
+ }
}
void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b )
{
- mUpdatesEnabled = b;
+ mUpdatesEnabled = b;
}
LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar()
{
- return dynamic_cast<LLVOAvatarSelf*> (mAvatarAppearance);
+ return dynamic_cast<LLVOAvatarSelf*> (mAvatarAppearance);
}
const LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() const
{
- return dynamic_cast<const LLVOAvatarSelf*> (mAvatarAppearance);
+ return dynamic_cast<const LLVOAvatarSelf*> (mAvatarAppearance);
}
LLViewerTexLayerSetBuffer* LLViewerTexLayerSet::getViewerComposite()
{
- return dynamic_cast<LLViewerTexLayerSetBuffer*> (getComposite());
+ return dynamic_cast<LLViewerTexLayerSetBuffer*> (getComposite());
}
const LLViewerTexLayerSetBuffer* LLViewerTexLayerSet::getViewerComposite() const
{
- return dynamic_cast<const LLViewerTexLayerSetBuffer*> (getComposite());
+ return dynamic_cast<const LLViewerTexLayerSetBuffer*> (getComposite());
}
const std::string LLViewerTexLayerSetBuffer::dumpTextureInfo() const
{
- if (!isAgentAvatarValid()) return "";
+ if (!isAgentAvatarValid()) return "";
- const BOOL is_high_res = TRUE;
- const U32 num_low_res = 0;
- const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(getViewerTexLayerSet());
+ const BOOL is_high_res = TRUE;
+ const U32 num_low_res = 0;
+ const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(getViewerTexLayerSet());
- std::string text = llformat("[HiRes:%d LoRes:%d] %s",
- is_high_res, num_low_res,
- local_texture_info.c_str());
- return text;
+ std::string text = llformat("[HiRes:%d LoRes:%d] %s",
+ is_high_res, num_low_res,
+ local_texture_info.c_str());
+ return text;
}
diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h
index dec7f0ddfc..0ced450299 100644
--- a/indra/newview/llviewertexlayer.h
+++ b/indra/newview/llviewertexlayer.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewertexlayer.h
* @brief Viewer Texture layer classes. Used for avatars.
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,24 +43,24 @@ class LLViewerTexLayerSetBuffer;
class LLViewerTexLayerSet : public LLTexLayerSet
{
public:
- LLViewerTexLayerSet(LLAvatarAppearance* const appearance);
- virtual ~LLViewerTexLayerSet();
-
- /*virtual*/void requestUpdate();
- BOOL isLocalTextureDataAvailable() const;
- BOOL isLocalTextureDataFinal() const;
- void updateComposite();
- /*virtual*/void createComposite();
- void setUpdatesEnabled(BOOL b);
- BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
-
- LLVOAvatarSelf* getAvatar();
- const LLVOAvatarSelf* getAvatar() const;
- LLViewerTexLayerSetBuffer* getViewerComposite();
- const LLViewerTexLayerSetBuffer* getViewerComposite() const;
+ LLViewerTexLayerSet(LLAvatarAppearance* const appearance);
+ virtual ~LLViewerTexLayerSet();
+
+ /*virtual*/void requestUpdate();
+ BOOL isLocalTextureDataAvailable() const;
+ BOOL isLocalTextureDataFinal() const;
+ void updateComposite();
+ /*virtual*/void createComposite();
+ void setUpdatesEnabled(BOOL b);
+ BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
+
+ LLVOAvatarSelf* getAvatar();
+ const LLVOAvatarSelf* getAvatar() const;
+ LLViewerTexLayerSetBuffer* getViewerComposite();
+ const LLViewerTexLayerSetBuffer* getViewerComposite() const;
private:
- BOOL mUpdatesEnabled;
+ BOOL mUpdatesEnabled;
};
@@ -71,62 +71,62 @@ private:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLViewerTexLayerSetBuffer : public LLTexLayerSetBuffer, public LLViewerDynamicTexture
{
- LOG_CLASS(LLViewerTexLayerSetBuffer);
+ LOG_CLASS(LLViewerTexLayerSetBuffer);
public:
- LLViewerTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
- virtual ~LLViewerTexLayerSetBuffer();
+ LLViewerTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
+ virtual ~LLViewerTexLayerSetBuffer();
public:
- /*virtual*/ S8 getType() const;
- BOOL isInitialized(void) const;
- static void dumpTotalByteCount();
- const std::string dumpTextureInfo() const;
- virtual void restoreGLTexture();
- virtual void destroyGLTexture();
+ /*virtual*/ S8 getType() const;
+ BOOL isInitialized(void) const;
+ static void dumpTotalByteCount();
+ const std::string dumpTextureInfo() const;
+ virtual void restoreGLTexture();
+ virtual void destroyGLTexture();
private:
- LLViewerTexLayerSet* getViewerTexLayerSet()
- { return dynamic_cast<LLViewerTexLayerSet*> (mTexLayerSet); }
- const LLViewerTexLayerSet* getViewerTexLayerSet() const
- { return dynamic_cast<const LLViewerTexLayerSet*> (mTexLayerSet); }
- static S32 sGLByteCount;
-
- //--------------------------------------------------------------------
- // Tex Layer Render
- //--------------------------------------------------------------------
- virtual void preRenderTexLayerSet();
- virtual void midRenderTexLayerSet(BOOL success);
- virtual void postRenderTexLayerSet(BOOL success);
- virtual S32 getCompositeOriginX() const { return getOriginX(); }
- virtual S32 getCompositeOriginY() const { return getOriginY(); }
- virtual S32 getCompositeWidth() const { return getFullWidth(); }
- virtual S32 getCompositeHeight() const { return getFullHeight(); }
-
- //--------------------------------------------------------------------
- // Dynamic Texture Interface
- //--------------------------------------------------------------------
+ LLViewerTexLayerSet* getViewerTexLayerSet()
+ { return dynamic_cast<LLViewerTexLayerSet*> (mTexLayerSet); }
+ const LLViewerTexLayerSet* getViewerTexLayerSet() const
+ { return dynamic_cast<const LLViewerTexLayerSet*> (mTexLayerSet); }
+ static S32 sGLByteCount;
+
+ //--------------------------------------------------------------------
+ // Tex Layer Render
+ //--------------------------------------------------------------------
+ virtual void preRenderTexLayerSet();
+ virtual void midRenderTexLayerSet(BOOL success);
+ virtual void postRenderTexLayerSet(BOOL success);
+ virtual S32 getCompositeOriginX() const { return getOriginX(); }
+ virtual S32 getCompositeOriginY() const { return getOriginY(); }
+ virtual S32 getCompositeWidth() const { return getFullWidth(); }
+ virtual S32 getCompositeHeight() const { return getFullHeight(); }
+
+ //--------------------------------------------------------------------
+ // Dynamic Texture Interface
+ //--------------------------------------------------------------------
public:
- /*virtual*/ BOOL needsRender();
+ /*virtual*/ BOOL needsRender();
protected:
- // Pass these along for tex layer rendering.
- virtual void preRender(BOOL clear_depth) { preRenderTexLayerSet(); }
- virtual void postRender(BOOL success) { postRenderTexLayerSet(success); }
- virtual BOOL render() { return renderTexLayerSet(mBoundTarget); }
-
- //--------------------------------------------------------------------
- // Updates
- //--------------------------------------------------------------------
+ // Pass these along for tex layer rendering.
+ virtual void preRender(BOOL clear_depth) { preRenderTexLayerSet(); }
+ virtual void postRender(BOOL success) { postRenderTexLayerSet(success); }
+ virtual BOOL render() { return renderTexLayerSet(mBoundTarget); }
+
+ //--------------------------------------------------------------------
+ // Updates
+ //--------------------------------------------------------------------
public:
- void requestUpdate();
- BOOL requestUpdateImmediate();
+ void requestUpdate();
+ BOOL requestUpdateImmediate();
protected:
- BOOL isReadyToUpdate() const;
- void doUpdate();
- void restartUpdateTimer();
+ BOOL isReadyToUpdate() const;
+ void doUpdate();
+ void restartUpdateTimer();
private:
- BOOL mNeedsUpdate; // Whether we need to locally update our baked textures
- U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures
- LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed.
+ BOOL mNeedsUpdate; // Whether we need to locally update our baked textures
+ U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures
+ LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed.
};
#endif // LL_VIEWER_TEXLAYER_H
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index fa6b6dc156..bb025fbcd2 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewertexteditor.cpp
* @brief Text editor widget to let users enter a multi-line document.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -73,89 +73,89 @@ class LLEmbeddedLandmarkCopied: public LLInventoryCallback
{
public:
- LLEmbeddedLandmarkCopied(){}
- void fire(const LLUUID& inv_item)
- {
- showInfo(inv_item);
- }
- static void showInfo(const LLUUID& landmark_inv_id)
- {
- LLSD key;
- key["type"] = "landmark";
- key["id"] = landmark_inv_id;
- LLFloaterSidePanelContainer::showPanel("places", key);
- }
- static void processForeignLandmark(LLLandmark* landmark,
- const LLUUID& object_id, const LLUUID& notecard_inventory_id,
- LLPointer<LLInventoryItem> item_ptr)
- {
- LLVector3d global_pos;
- landmark->getGlobalPos(global_pos);
- LLViewerInventoryItem* agent_landmark =
- LLLandmarkActions::findLandmarkForGlobalPos(global_pos);
-
- if (agent_landmark)
- {
- showInfo(agent_landmark->getUUID());
- }
- else
- {
- if (item_ptr.isNull())
- {
- // check to prevent a crash. See EXT-8459.
- LL_WARNS() << "Passed handle contains a dead inventory item. Most likely notecard has been closed and embedded item was destroyed." << LL_ENDL;
- }
- else
- {
- LLInventoryItem* item = item_ptr.get();
- LLPointer<LLEmbeddedLandmarkCopied> cb = new LLEmbeddedLandmarkCopied();
- copy_inventory_from_notecard(get_folder_by_itemtype(item),
- object_id,
- notecard_inventory_id,
- item,
- gInventoryCallbacks.registerCB(cb));
- }
- }
- }
+ LLEmbeddedLandmarkCopied(){}
+ void fire(const LLUUID& inv_item)
+ {
+ showInfo(inv_item);
+ }
+ static void showInfo(const LLUUID& landmark_inv_id)
+ {
+ LLSD key;
+ key["type"] = "landmark";
+ key["id"] = landmark_inv_id;
+ LLFloaterSidePanelContainer::showPanel("places", key);
+ }
+ static void processForeignLandmark(LLLandmark* landmark,
+ const LLUUID& object_id, const LLUUID& notecard_inventory_id,
+ LLPointer<LLInventoryItem> item_ptr)
+ {
+ LLVector3d global_pos;
+ landmark->getGlobalPos(global_pos);
+ LLViewerInventoryItem* agent_landmark =
+ LLLandmarkActions::findLandmarkForGlobalPos(global_pos);
+
+ if (agent_landmark)
+ {
+ showInfo(agent_landmark->getUUID());
+ }
+ else
+ {
+ if (item_ptr.isNull())
+ {
+ // check to prevent a crash. See EXT-8459.
+ LL_WARNS() << "Passed handle contains a dead inventory item. Most likely notecard has been closed and embedded item was destroyed." << LL_ENDL;
+ }
+ else
+ {
+ LLInventoryItem* item = item_ptr.get();
+ LLPointer<LLEmbeddedLandmarkCopied> cb = new LLEmbeddedLandmarkCopied();
+ copy_inventory_from_notecard(get_folder_by_itemtype(item),
+ object_id,
+ notecard_inventory_id,
+ item,
+ gInventoryCallbacks.registerCB(cb));
+ }
+ }
+ }
};
///----------------------------------------------------------------------------
/// Class LLEmbeddedNotecardOpener
///----------------------------------------------------------------------------
class LLEmbeddedNotecardOpener : public LLInventoryCallback
{
- LLViewerTextEditor* mTextEditor;
+ LLViewerTextEditor* mTextEditor;
public:
- LLEmbeddedNotecardOpener()
- : mTextEditor(NULL)
- {
- }
-
- void setEditor(LLViewerTextEditor* e) {mTextEditor = e;}
-
- // override
- void fire(const LLUUID& inv_item)
- {
- if(!mTextEditor)
- {
- // The parent text editor may have vanished by now.
+ LLEmbeddedNotecardOpener()
+ : mTextEditor(NULL)
+ {
+ }
+
+ void setEditor(LLViewerTextEditor* e) {mTextEditor = e;}
+
+ // override
+ void fire(const LLUUID& inv_item)
+ {
+ if(!mTextEditor)
+ {
+ // The parent text editor may have vanished by now.
// In that case just quit.
- return;
- }
-
- LLInventoryItem* item = gInventory.getItem(inv_item);
- if(!item)
- {
- LL_WARNS() << "Item add reported, but not found in inventory!: " << inv_item << LL_ENDL;
- }
- else
- {
- if(!gSavedSettings.getBOOL("ShowNewInventory"))
- {
- LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
- }
- }
- }
+ return;
+ }
+
+ LLInventoryItem* item = gInventory.getItem(inv_item);
+ if(!item)
+ {
+ LL_WARNS() << "Item add reported, but not found in inventory!: " << inv_item << LL_ENDL;
+ }
+ else
+ {
+ if(!gSavedSettings.getBOOL("ShowNewInventory"))
+ {
+ LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+ }
+ }
+ }
};
//
@@ -167,118 +167,118 @@ const S32 EMBEDDED_ITEM_LABEL_PADDING = 2;
class LLEmbeddedItemSegment : public LLTextSegment
{
public:
- LLEmbeddedItemSegment(S32 pos, LLUIImagePtr image, LLPointer<LLInventoryItem> inv_item, LLTextEditor& editor)
- : LLTextSegment(pos, pos + 1),
- mImage(image),
- mLabel(utf8str_to_wstring(inv_item->getName())),
- mItem(inv_item),
- mEditor(editor)
- {
-
- mStyle = new LLStyle(LLStyle::Params().font(LLFontGL::getFontSansSerif()));
- mToolTip = inv_item->getName() + '\n' + inv_item->getDescription();
- }
-
- /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
- {
- if (num_chars == 0)
- {
- width = 0;
- height = 0;
- }
- else
- {
- width = EMBEDDED_ITEM_LABEL_PADDING + mImage->getWidth() + mStyle->getFont()->getWidthF32(mLabel.c_str());
- height = llmax(mImage->getHeight(), mStyle->getFont()->getLineHeight());
- }
- return false;
- }
-
- /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const
- {
- // always draw at beginning of line
- if (line_offset == 0)
- {
- return 1;
- }
- else
- {
- S32 width, height;
- getDimensions(mStart, 1, width, height);
- if (width > num_pixels)
- {
- return 0;
- }
- else
- {
- return 1;
- }
- }
- }
- /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
- {
- LLRectf image_rect = draw_rect;
- image_rect.mRight = image_rect.mLeft + mImage->getWidth();
- image_rect.mTop = image_rect.mBottom + mImage->getHeight();
- mImage->draw(LLRect(image_rect.mLeft, image_rect.mTop, image_rect.mRight, image_rect.mBottom));
-
- LLColor4 color;
- if (mEditor.getReadOnly())
- {
- color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor");
- }
- else
- {
- color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor");
- }
-
- F32 right_x;
- mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x);
- return right_x;
- }
-
- /*virtual*/ bool canEdit() const { return false; }
-
-
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask)
- {
- LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
- return TRUE;
- }
- virtual BOOL handleToolTip(S32 x, S32 y, MASK mask )
- {
- if (mItem->getThumbnailUUID().notNull())
- {
+ LLEmbeddedItemSegment(S32 pos, LLUIImagePtr image, LLPointer<LLInventoryItem> inv_item, LLTextEditor& editor)
+ : LLTextSegment(pos, pos + 1),
+ mImage(image),
+ mLabel(utf8str_to_wstring(inv_item->getName())),
+ mItem(inv_item),
+ mEditor(editor)
+ {
+
+ mStyle = new LLStyle(LLStyle::Params().font(LLFontGL::getFontSansSerif()));
+ mToolTip = inv_item->getName() + '\n' + inv_item->getDescription();
+ }
+
+ /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
+ {
+ if (num_chars == 0)
+ {
+ width = 0;
+ height = 0;
+ }
+ else
+ {
+ width = EMBEDDED_ITEM_LABEL_PADDING + mImage->getWidth() + mStyle->getFont()->getWidthF32(mLabel.c_str());
+ height = llmax(mImage->getHeight(), mStyle->getFont()->getLineHeight());
+ }
+ return false;
+ }
+
+ /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const
+ {
+ // always draw at beginning of line
+ if (line_offset == 0)
+ {
+ return 1;
+ }
+ else
+ {
+ S32 width, height;
+ getDimensions(mStart, 1, width, height);
+ if (width > num_pixels)
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+ /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
+ {
+ LLRectf image_rect = draw_rect;
+ image_rect.mRight = image_rect.mLeft + mImage->getWidth();
+ image_rect.mTop = image_rect.mBottom + mImage->getHeight();
+ mImage->draw(LLRect(image_rect.mLeft, image_rect.mTop, image_rect.mRight, image_rect.mBottom));
+
+ LLColor4 color;
+ if (mEditor.getReadOnly())
+ {
+ color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor");
+ }
+ else
+ {
+ color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor");
+ }
+
+ F32 right_x;
+ mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x);
+ return right_x;
+ }
+
+ /*virtual*/ bool canEdit() const { return false; }
+
+
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask)
+ {
+ LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
+ return TRUE;
+ }
+ virtual BOOL handleToolTip(S32 x, S32 y, MASK mask )
+ {
+ if (mItem->getThumbnailUUID().notNull())
+ {
LLSD params;
params["inv_type"] = mItem->getInventoryType();
params["thumbnail_id"] = mItem->getThumbnailUUID();
params["asset_id"] = mItem->getAssetUUID();
-
- LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(mToolTip)
- .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1))
- .create_params(params));
- return TRUE;
- }
+ LLToolTipMgr::instance().show(LLToolTip::Params()
+ .message(mToolTip)
+ .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1))
+ .create_params(params));
- if (!mToolTip.empty())
- {
- LLToolTipMgr::instance().show(mToolTip);
- return TRUE;
- }
- return FALSE;
- }
+ return TRUE;
+ }
- /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; }
+ if (!mToolTip.empty())
+ {
+ LLToolTipMgr::instance().show(mToolTip);
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; }
private:
- LLUIImagePtr mImage;
- LLWString mLabel;
- LLStyleSP mStyle;
- std::string mToolTip;
- LLPointer<LLInventoryItem> mItem;
- LLTextEditor& mEditor;
+ LLUIImagePtr mImage;
+ LLWString mLabel;
+ LLStyleSP mStyle;
+ std::string mToolTip;
+ LLPointer<LLInventoryItem> mItem;
+ LLTextEditor& mEditor;
};
@@ -298,47 +298,47 @@ private:
class LLEmbeddedItems
{
public:
- LLEmbeddedItems(const LLViewerTextEditor* editor);
- ~LLEmbeddedItems();
- void clear();
+ LLEmbeddedItems(const LLViewerTextEditor* editor);
+ ~LLEmbeddedItems();
+ void clear();
+
+ // return true if there are no embedded items.
+ bool empty();
+
+ BOOL insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new);
+ BOOL removeEmbeddedItem( llwchar ext_char );
- // return true if there are no embedded items.
- bool empty();
-
- BOOL insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new);
- BOOL removeEmbeddedItem( llwchar ext_char );
+ BOOL hasEmbeddedItem(llwchar ext_char); // returns TRUE if /this/ editor has an entry for this item
+ LLUIImagePtr getItemImage(llwchar ext_char) const;
- BOOL hasEmbeddedItem(llwchar ext_char); // returns TRUE if /this/ editor has an entry for this item
- LLUIImagePtr getItemImage(llwchar ext_char) const;
+ void getEmbeddedItemList( std::vector<LLPointer<LLInventoryItem> >& items );
+ void addItems(const std::vector<LLPointer<LLInventoryItem> >& items);
- void getEmbeddedItemList( std::vector<LLPointer<LLInventoryItem> >& items );
- void addItems(const std::vector<LLPointer<LLInventoryItem> >& items);
+ llwchar getEmbeddedCharFromIndex(S32 index);
- llwchar getEmbeddedCharFromIndex(S32 index);
+ void removeUnusedChars();
+ void copyUsedCharsToIndexed();
+ S32 getIndexFromEmbeddedChar(llwchar wch);
- void removeUnusedChars();
- void copyUsedCharsToIndexed();
- S32 getIndexFromEmbeddedChar(llwchar wch);
+ void markSaved();
- void markSaved();
-
- static LLPointer<LLInventoryItem> getEmbeddedItemPtr(llwchar ext_char); // returns pointer to item from static list
- static BOOL getEmbeddedItemSaved(llwchar ext_char); // returns whether item from static list is saved
+ static LLPointer<LLInventoryItem> getEmbeddedItemPtr(llwchar ext_char); // returns pointer to item from static list
+ static BOOL getEmbeddedItemSaved(llwchar ext_char); // returns whether item from static list is saved
private:
- struct embedded_info_t
- {
- LLPointer<LLInventoryItem> mItemPtr;
- BOOL mSaved;
- };
- typedef std::map<llwchar, embedded_info_t > item_map_t;
- static item_map_t sEntries;
- static std::stack<llwchar> sFreeEntries;
-
- std::set<llwchar> mEmbeddedUsedChars; // list of used llwchars
- std::vector<llwchar> mEmbeddedIndexedChars; // index -> wchar for 0x80 + index format
- const LLViewerTextEditor* mEditor;
+ struct embedded_info_t
+ {
+ LLPointer<LLInventoryItem> mItemPtr;
+ BOOL mSaved;
+ };
+ typedef std::map<llwchar, embedded_info_t > item_map_t;
+ static item_map_t sEntries;
+ static std::stack<llwchar> sFreeEntries;
+
+ std::set<llwchar> mEmbeddedUsedChars; // list of used llwchars
+ std::vector<llwchar> mEmbeddedIndexedChars; // index -> wchar for 0x80 + index format
+ const LLViewerTextEditor* mEditor;
};
//statics
@@ -346,268 +346,268 @@ LLEmbeddedItems::item_map_t LLEmbeddedItems::sEntries;
std::stack<llwchar> LLEmbeddedItems::sFreeEntries;
LLEmbeddedItems::LLEmbeddedItems(const LLViewerTextEditor* editor)
- : mEditor(editor)
+ : mEditor(editor)
{
}
LLEmbeddedItems::~LLEmbeddedItems()
{
- clear();
+ clear();
}
void LLEmbeddedItems::clear()
{
- // Remove entries for this editor from static list
- for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin();
- iter != mEmbeddedUsedChars.end();)
- {
- std::set<llwchar>::iterator nextiter = iter++;
- removeEmbeddedItem(*nextiter);
- }
- mEmbeddedUsedChars.clear();
- mEmbeddedIndexedChars.clear();
+ // Remove entries for this editor from static list
+ for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin();
+ iter != mEmbeddedUsedChars.end();)
+ {
+ std::set<llwchar>::iterator nextiter = iter++;
+ removeEmbeddedItem(*nextiter);
+ }
+ mEmbeddedUsedChars.clear();
+ mEmbeddedIndexedChars.clear();
}
bool LLEmbeddedItems::empty()
{
- removeUnusedChars();
- return mEmbeddedUsedChars.empty();
+ removeUnusedChars();
+ return mEmbeddedUsedChars.empty();
}
// Inserts a new unique entry
BOOL LLEmbeddedItems::insertEmbeddedItem( LLInventoryItem* item, llwchar* ext_char, bool is_new)
{
- // Now insert a new one
- llwchar wc_emb;
- if (!sFreeEntries.empty())
- {
- wc_emb = sFreeEntries.top();
- sFreeEntries.pop();
- }
- else if (sEntries.empty())
- {
- wc_emb = LLTextEditor::FIRST_EMBEDDED_CHAR;
- }
- else
- {
- item_map_t::iterator last = sEntries.end();
- --last;
- wc_emb = last->first;
- if (wc_emb >= LLTextEditor::LAST_EMBEDDED_CHAR)
- {
- return FALSE;
- }
- ++wc_emb;
- }
-
- sEntries[wc_emb].mItemPtr = item;
- sEntries[wc_emb].mSaved = is_new ? FALSE : TRUE;
- *ext_char = wc_emb;
- mEmbeddedUsedChars.insert(wc_emb);
- return TRUE;
+ // Now insert a new one
+ llwchar wc_emb;
+ if (!sFreeEntries.empty())
+ {
+ wc_emb = sFreeEntries.top();
+ sFreeEntries.pop();
+ }
+ else if (sEntries.empty())
+ {
+ wc_emb = LLTextEditor::FIRST_EMBEDDED_CHAR;
+ }
+ else
+ {
+ item_map_t::iterator last = sEntries.end();
+ --last;
+ wc_emb = last->first;
+ if (wc_emb >= LLTextEditor::LAST_EMBEDDED_CHAR)
+ {
+ return FALSE;
+ }
+ ++wc_emb;
+ }
+
+ sEntries[wc_emb].mItemPtr = item;
+ sEntries[wc_emb].mSaved = is_new ? FALSE : TRUE;
+ *ext_char = wc_emb;
+ mEmbeddedUsedChars.insert(wc_emb);
+ return TRUE;
}
// Removes an entry (all entries are unique)
BOOL LLEmbeddedItems::removeEmbeddedItem( llwchar ext_char )
{
- mEmbeddedUsedChars.erase(ext_char);
- item_map_t::iterator iter = sEntries.find(ext_char);
- if (iter != sEntries.end())
- {
- sEntries.erase(ext_char);
- sFreeEntries.push(ext_char);
- return TRUE;
- }
- return FALSE;
+ mEmbeddedUsedChars.erase(ext_char);
+ item_map_t::iterator iter = sEntries.find(ext_char);
+ if (iter != sEntries.end())
+ {
+ sEntries.erase(ext_char);
+ sFreeEntries.push(ext_char);
+ return TRUE;
+ }
+ return FALSE;
}
-
+
// static
LLPointer<LLInventoryItem> LLEmbeddedItems::getEmbeddedItemPtr(llwchar ext_char)
{
- if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR )
- {
- item_map_t::iterator iter = sEntries.find(ext_char);
- if (iter != sEntries.end())
- {
- return iter->second.mItemPtr;
- }
- }
- return NULL;
+ if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR )
+ {
+ item_map_t::iterator iter = sEntries.find(ext_char);
+ if (iter != sEntries.end())
+ {
+ return iter->second.mItemPtr;
+ }
+ }
+ return NULL;
}
// static
BOOL LLEmbeddedItems::getEmbeddedItemSaved(llwchar ext_char)
{
- if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR )
- {
- item_map_t::iterator iter = sEntries.find(ext_char);
- if (iter != sEntries.end())
- {
- return iter->second.mSaved;
- }
- }
- return FALSE;
+ if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR )
+ {
+ item_map_t::iterator iter = sEntries.find(ext_char);
+ if (iter != sEntries.end())
+ {
+ return iter->second.mSaved;
+ }
+ }
+ return FALSE;
}
-llwchar LLEmbeddedItems::getEmbeddedCharFromIndex(S32 index)
+llwchar LLEmbeddedItems::getEmbeddedCharFromIndex(S32 index)
{
- if (index >= (S32)mEmbeddedIndexedChars.size())
- {
- LL_WARNS() << "No item for embedded char " << index << " using LL_UNKNOWN_CHAR" << LL_ENDL;
- return LL_UNKNOWN_CHAR;
- }
- return mEmbeddedIndexedChars[index];
+ if (index >= (S32)mEmbeddedIndexedChars.size())
+ {
+ LL_WARNS() << "No item for embedded char " << index << " using LL_UNKNOWN_CHAR" << LL_ENDL;
+ return LL_UNKNOWN_CHAR;
+ }
+ return mEmbeddedIndexedChars[index];
}
void LLEmbeddedItems::removeUnusedChars()
{
- std::set<llwchar> used = mEmbeddedUsedChars;
- const LLWString& wtext = mEditor->getWText();
- for (S32 i=0; i<(S32)wtext.size(); i++)
- {
- llwchar wc = wtext[i];
- if( wc >= LLTextEditor::FIRST_EMBEDDED_CHAR && wc <= LLTextEditor::LAST_EMBEDDED_CHAR )
- {
- used.erase(wc);
- }
- }
- // Remove chars not actually used
- for (std::set<llwchar>::iterator iter = used.begin();
- iter != used.end(); ++iter)
- {
- removeEmbeddedItem(*iter);
- }
+ std::set<llwchar> used = mEmbeddedUsedChars;
+ const LLWString& wtext = mEditor->getWText();
+ for (S32 i=0; i<(S32)wtext.size(); i++)
+ {
+ llwchar wc = wtext[i];
+ if( wc >= LLTextEditor::FIRST_EMBEDDED_CHAR && wc <= LLTextEditor::LAST_EMBEDDED_CHAR )
+ {
+ used.erase(wc);
+ }
+ }
+ // Remove chars not actually used
+ for (std::set<llwchar>::iterator iter = used.begin();
+ iter != used.end(); ++iter)
+ {
+ removeEmbeddedItem(*iter);
+ }
}
void LLEmbeddedItems::copyUsedCharsToIndexed()
{
- // Prune unused items
- removeUnusedChars();
-
- // Copy all used llwchars to mEmbeddedIndexedChars
- mEmbeddedIndexedChars.clear();
- for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin();
- iter != mEmbeddedUsedChars.end(); ++iter)
- {
- mEmbeddedIndexedChars.push_back(*iter);
- }
+ // Prune unused items
+ removeUnusedChars();
+
+ // Copy all used llwchars to mEmbeddedIndexedChars
+ mEmbeddedIndexedChars.clear();
+ for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin();
+ iter != mEmbeddedUsedChars.end(); ++iter)
+ {
+ mEmbeddedIndexedChars.push_back(*iter);
+ }
}
S32 LLEmbeddedItems::getIndexFromEmbeddedChar(llwchar wch)
{
- S32 idx = 0;
- for (std::vector<llwchar>::iterator iter = mEmbeddedIndexedChars.begin();
- iter != mEmbeddedIndexedChars.end(); ++iter)
- {
- if (wch == *iter)
- break;
- ++idx;
- }
- if (idx < (S32)mEmbeddedIndexedChars.size())
- {
- return idx;
- }
- else
- {
- LL_WARNS() << "Embedded char " << wch << " not found, using 0" << LL_ENDL;
- return 0;
- }
+ S32 idx = 0;
+ for (std::vector<llwchar>::iterator iter = mEmbeddedIndexedChars.begin();
+ iter != mEmbeddedIndexedChars.end(); ++iter)
+ {
+ if (wch == *iter)
+ break;
+ ++idx;
+ }
+ if (idx < (S32)mEmbeddedIndexedChars.size())
+ {
+ return idx;
+ }
+ else
+ {
+ LL_WARNS() << "Embedded char " << wch << " not found, using 0" << LL_ENDL;
+ return 0;
+ }
}
BOOL LLEmbeddedItems::hasEmbeddedItem(llwchar ext_char)
{
- std::set<llwchar>::iterator iter = mEmbeddedUsedChars.find(ext_char);
- if (iter != mEmbeddedUsedChars.end())
- {
- return TRUE;
- }
- return FALSE;
+ std::set<llwchar>::iterator iter = mEmbeddedUsedChars.find(ext_char);
+ if (iter != mEmbeddedUsedChars.end())
+ {
+ return TRUE;
+ }
+ return FALSE;
}
LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const
{
- LLInventoryItem* item = getEmbeddedItemPtr(ext_char);
- if (item)
- {
- const char* img_name = "";
- switch( item->getType() )
- {
- case LLAssetType::AT_TEXTURE:
- if(item->getInventoryType() == LLInventoryType::IT_SNAPSHOT)
- {
- img_name = "Inv_Snapshot";
- }
- else
- {
- img_name = "Inv_Texture";
- }
-
- break;
- case LLAssetType::AT_SOUND: img_name = "Inv_Sound"; break;
- case LLAssetType::AT_CLOTHING: img_name = "Inv_Clothing"; break;
- case LLAssetType::AT_OBJECT:
- img_name = LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags() ?
- "Inv_Object_Multi" : "Inv_Object";
- break;
- case LLAssetType::AT_CALLINGCARD: img_name = "Inv_CallingCard"; break;
- case LLAssetType::AT_LANDMARK: img_name = "Inv_Landmark"; break;
- case LLAssetType::AT_NOTECARD: img_name = "Inv_Notecard"; break;
- case LLAssetType::AT_LSL_TEXT: img_name = "Inv_Script"; break;
- case LLAssetType::AT_BODYPART: img_name = "Inv_Skin"; break;
- case LLAssetType::AT_ANIMATION: img_name = "Inv_Animation"; break;
- case LLAssetType::AT_GESTURE: img_name = "Inv_Gesture"; break;
- case LLAssetType::AT_MESH: img_name = "Inv_Mesh"; break;
+ LLInventoryItem* item = getEmbeddedItemPtr(ext_char);
+ if (item)
+ {
+ const char* img_name = "";
+ switch( item->getType() )
+ {
+ case LLAssetType::AT_TEXTURE:
+ if(item->getInventoryType() == LLInventoryType::IT_SNAPSHOT)
+ {
+ img_name = "Inv_Snapshot";
+ }
+ else
+ {
+ img_name = "Inv_Texture";
+ }
+
+ break;
+ case LLAssetType::AT_SOUND: img_name = "Inv_Sound"; break;
+ case LLAssetType::AT_CLOTHING: img_name = "Inv_Clothing"; break;
+ case LLAssetType::AT_OBJECT:
+ img_name = LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags() ?
+ "Inv_Object_Multi" : "Inv_Object";
+ break;
+ case LLAssetType::AT_CALLINGCARD: img_name = "Inv_CallingCard"; break;
+ case LLAssetType::AT_LANDMARK: img_name = "Inv_Landmark"; break;
+ case LLAssetType::AT_NOTECARD: img_name = "Inv_Notecard"; break;
+ case LLAssetType::AT_LSL_TEXT: img_name = "Inv_Script"; break;
+ case LLAssetType::AT_BODYPART: img_name = "Inv_Skin"; break;
+ case LLAssetType::AT_ANIMATION: img_name = "Inv_Animation"; break;
+ case LLAssetType::AT_GESTURE: img_name = "Inv_Gesture"; break;
+ case LLAssetType::AT_MESH: img_name = "Inv_Mesh"; break;
case LLAssetType::AT_SETTINGS: img_name = "Inv_Settings"; break;
case LLAssetType::AT_MATERIAL: img_name = "Inv_Material"; break;
- default: img_name = "Inv_Invalid"; break; // use the Inv_Invalid icon for undefined object types (see MAINT-3981)
+ default: img_name = "Inv_Invalid"; break; // use the Inv_Invalid icon for undefined object types (see MAINT-3981)
- }
+ }
- return LLUI::getUIImage(img_name);
- }
- return LLUIImagePtr();
+ return LLUI::getUIImage(img_name);
+ }
+ return LLUIImagePtr();
}
void LLEmbeddedItems::addItems(const std::vector<LLPointer<LLInventoryItem> >& items)
{
- for (std::vector<LLPointer<LLInventoryItem> >::const_iterator iter = items.begin();
- iter != items.end(); ++iter)
- {
- LLInventoryItem* item = *iter;
- if (item)
- {
- llwchar wc;
- if (!insertEmbeddedItem( item, &wc, false ))
- {
- break;
- }
- mEmbeddedIndexedChars.push_back(wc);
- }
- }
+ for (std::vector<LLPointer<LLInventoryItem> >::const_iterator iter = items.begin();
+ iter != items.end(); ++iter)
+ {
+ LLInventoryItem* item = *iter;
+ if (item)
+ {
+ llwchar wc;
+ if (!insertEmbeddedItem( item, &wc, false ))
+ {
+ break;
+ }
+ mEmbeddedIndexedChars.push_back(wc);
+ }
+ }
}
void LLEmbeddedItems::getEmbeddedItemList( std::vector<LLPointer<LLInventoryItem> >& items )
{
- for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin(); iter != mEmbeddedUsedChars.end(); ++iter)
- {
- llwchar wc = *iter;
- LLPointer<LLInventoryItem> item = getEmbeddedItemPtr(wc);
- if (item)
- {
- items.push_back(item);
- }
- }
+ for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin(); iter != mEmbeddedUsedChars.end(); ++iter)
+ {
+ llwchar wc = *iter;
+ LLPointer<LLInventoryItem> item = getEmbeddedItemPtr(wc);
+ if (item)
+ {
+ items.push_back(item);
+ }
+ }
}
void LLEmbeddedItems::markSaved()
{
- for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin(); iter != mEmbeddedUsedChars.end(); ++iter)
- {
- llwchar wc = *iter;
- sEntries[wc].mSaved = TRUE;
- }
+ for (std::set<llwchar>::iterator iter = mEmbeddedUsedChars.begin(); iter != mEmbeddedUsedChars.end(); ++iter)
+ {
+ llwchar wc = *iter;
+ sEntries[wc].mSaved = TRUE;
+ }
}
///////////////////////////////////////////////////////////////////
@@ -615,63 +615,63 @@ void LLEmbeddedItems::markSaved()
class LLViewerTextEditor::TextCmdInsertEmbeddedItem : public LLTextBase::TextCmd
{
public:
- TextCmdInsertEmbeddedItem( S32 pos, LLInventoryItem* item )
- : TextCmd(pos, FALSE),
- mExtCharValue(0)
- {
- mItem = item;
- }
-
- virtual BOOL execute( LLTextBase* editor, S32* delta )
- {
- LLViewerTextEditor* viewer_editor = (LLViewerTextEditor*)editor;
- // Take this opportunity to remove any unused embedded items from this editor
- viewer_editor->mEmbeddedItemList->removeUnusedChars();
- if(viewer_editor->mEmbeddedItemList->insertEmbeddedItem( mItem, &mExtCharValue, true ) )
- {
- LLWString ws;
- ws.assign(1, mExtCharValue);
- *delta = insert(editor, getPosition(), ws );
- return (*delta != 0);
- }
- return FALSE;
- }
-
- virtual S32 undo( LLTextBase* editor )
- {
- remove(editor, getPosition(), 1);
- return getPosition();
- }
-
- virtual S32 redo( LLTextBase* editor )
- {
- LLWString ws;
- ws += mExtCharValue;
- insert(editor, getPosition(), ws );
- return getPosition() + 1;
- }
- virtual BOOL hasExtCharValue( llwchar value ) const
- {
- return (value == mExtCharValue);
- }
+ TextCmdInsertEmbeddedItem( S32 pos, LLInventoryItem* item )
+ : TextCmd(pos, FALSE),
+ mExtCharValue(0)
+ {
+ mItem = item;
+ }
+
+ virtual BOOL execute( LLTextBase* editor, S32* delta )
+ {
+ LLViewerTextEditor* viewer_editor = (LLViewerTextEditor*)editor;
+ // Take this opportunity to remove any unused embedded items from this editor
+ viewer_editor->mEmbeddedItemList->removeUnusedChars();
+ if(viewer_editor->mEmbeddedItemList->insertEmbeddedItem( mItem, &mExtCharValue, true ) )
+ {
+ LLWString ws;
+ ws.assign(1, mExtCharValue);
+ *delta = insert(editor, getPosition(), ws );
+ return (*delta != 0);
+ }
+ return FALSE;
+ }
+
+ virtual S32 undo( LLTextBase* editor )
+ {
+ remove(editor, getPosition(), 1);
+ return getPosition();
+ }
+
+ virtual S32 redo( LLTextBase* editor )
+ {
+ LLWString ws;
+ ws += mExtCharValue;
+ insert(editor, getPosition(), ws );
+ return getPosition() + 1;
+ }
+ virtual BOOL hasExtCharValue( llwchar value ) const
+ {
+ return (value == mExtCharValue);
+ }
private:
- LLPointer<LLInventoryItem> mItem;
- llwchar mExtCharValue;
+ LLPointer<LLInventoryItem> mItem;
+ llwchar mExtCharValue;
};
struct LLNotecardCopyInfo
{
- LLNotecardCopyInfo(LLViewerTextEditor *ed, LLInventoryItem *item)
- : mTextEd(ed)
- {
- mItem = item;
- }
-
- LLViewerTextEditor* mTextEd;
- // need to make this be a copy (not a * here) because it isn't stable.
- // I wish we had passed LLPointers all the way down, but we didn't
- LLPointer<LLInventoryItem> mItem;
+ LLNotecardCopyInfo(LLViewerTextEditor *ed, LLInventoryItem *item)
+ : mTextEd(ed)
+ {
+ mItem = item;
+ }
+
+ LLViewerTextEditor* mTextEd;
+ // need to make this be a copy (not a * here) because it isn't stable.
+ // I wish we had passed LLPointers all the way down, but we didn't
+ LLPointer<LLInventoryItem> mItem;
};
//----------------------------------------------------------------------------
@@ -680,375 +680,375 @@ struct LLNotecardCopyInfo
// Member functions
//
LLViewerTextEditor::LLViewerTextEditor(const LLViewerTextEditor::Params& p)
-: LLTextEditor(p),
- mDragItemChar(0),
- mDragItemSaved(FALSE),
- mInventoryCallback(new LLEmbeddedNotecardOpener)
+: LLTextEditor(p),
+ mDragItemChar(0),
+ mDragItemSaved(FALSE),
+ mInventoryCallback(new LLEmbeddedNotecardOpener)
{
- mEmbeddedItemList = new LLEmbeddedItems(this);
- mInventoryCallback->setEditor(this);
+ mEmbeddedItemList = new LLEmbeddedItems(this);
+ mInventoryCallback->setEditor(this);
}
LLViewerTextEditor::~LLViewerTextEditor()
{
- delete mEmbeddedItemList;
-
-
- // The inventory callback may still be in use by gInventoryCallbackManager...
- // so set its reference to this to null.
- mInventoryCallback->setEditor(NULL);
+ delete mEmbeddedItemList;
+
+
+ // The inventory callback may still be in use by gInventoryCallbackManager...
+ // so set its reference to this to null.
+ mInventoryCallback->setEditor(NULL);
}
///////////////////////////////////////////////////////////////////
// virtual
void LLViewerTextEditor::makePristine()
{
- mEmbeddedItemList->markSaved();
- LLTextEditor::makePristine();
+ mEmbeddedItemList->markSaved();
+ LLTextEditor::makePristine();
}
void LLViewerTextEditor::onVisibilityChange( BOOL new_visibility )
{
- LLUICtrl::onVisibilityChange(new_visibility);
+ LLUICtrl::onVisibilityChange(new_visibility);
}
BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
-
- // Let scrollbar have first dibs
- handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL;
-
- if( !handled)
- {
- if( allowsEmbeddedItems() )
- {
- setCursorAtLocalPos( x, y, FALSE );
- llwchar wc = 0;
- if (mCursorPos < getLength())
- {
- wc = getWText()[mCursorPos];
- }
- LLPointer<LLInventoryItem> item_at_pos = LLEmbeddedItems::getEmbeddedItemPtr(wc);
- if (item_at_pos)
- {
- mDragItem = item_at_pos;
- mDragItemChar = wc;
- mDragItemSaved = LLEmbeddedItems::getEmbeddedItemSaved(wc);
- gFocusMgr.setMouseCapture( this );
- mMouseDownX = x;
- mMouseDownY = y;
- S32 screen_x;
- S32 screen_y;
- localPointToScreen(x, y, &screen_x, &screen_y );
- LLToolDragAndDrop::getInstance()->setDragStart( screen_x, screen_y );
-
- if (hasTabStop())
- {
- setFocus( TRUE );
- }
-
- handled = TRUE;
- }
- else
- {
- mDragItem = NULL;
- }
- }
-
- if (!handled)
- {
- handled = LLTextEditor::handleMouseDown(x, y, mask);
- }
- }
-
- return handled;
+ BOOL handled = FALSE;
+
+ // Let scrollbar have first dibs
+ handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL;
+
+ if( !handled)
+ {
+ if( allowsEmbeddedItems() )
+ {
+ setCursorAtLocalPos( x, y, FALSE );
+ llwchar wc = 0;
+ if (mCursorPos < getLength())
+ {
+ wc = getWText()[mCursorPos];
+ }
+ LLPointer<LLInventoryItem> item_at_pos = LLEmbeddedItems::getEmbeddedItemPtr(wc);
+ if (item_at_pos)
+ {
+ mDragItem = item_at_pos;
+ mDragItemChar = wc;
+ mDragItemSaved = LLEmbeddedItems::getEmbeddedItemSaved(wc);
+ gFocusMgr.setMouseCapture( this );
+ mMouseDownX = x;
+ mMouseDownY = y;
+ S32 screen_x;
+ S32 screen_y;
+ localPointToScreen(x, y, &screen_x, &screen_y );
+ LLToolDragAndDrop::getInstance()->setDragStart( screen_x, screen_y );
+
+ if (hasTabStop())
+ {
+ setFocus( TRUE );
+ }
+
+ handled = TRUE;
+ }
+ else
+ {
+ mDragItem = NULL;
+ }
+ }
+
+ if (!handled)
+ {
+ handled = LLTextEditor::handleMouseDown(x, y, mask);
+ }
+ }
+
+ return handled;
}
BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLTextEditor::handleHover(x, y, mask);
-
- if(hasMouseCapture() && mDragItem)
- {
- S32 screen_x;
- S32 screen_y;
- localPointToScreen(x, y, &screen_x, &screen_y );
-
- mScroller->autoScroll(x, y);
-
- if( LLToolDragAndDrop::getInstance()->isOverThreshold( screen_x, screen_y ) )
- {
- LLToolDragAndDrop::getInstance()->beginDrag(
- LLViewerAssetType::lookupDragAndDropType( mDragItem->getType() ),
- mDragItem->getUUID(),
- LLToolDragAndDrop::SOURCE_NOTECARD,
- mPreviewID, mObjectID);
- return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask );
- }
- getWindow()->setCursor(UI_CURSOR_HAND);
- handled = TRUE;
- }
-
- return handled;
+ BOOL handled = LLTextEditor::handleHover(x, y, mask);
+
+ if(hasMouseCapture() && mDragItem)
+ {
+ S32 screen_x;
+ S32 screen_y;
+ localPointToScreen(x, y, &screen_x, &screen_y );
+
+ mScroller->autoScroll(x, y);
+
+ if( LLToolDragAndDrop::getInstance()->isOverThreshold( screen_x, screen_y ) )
+ {
+ LLToolDragAndDrop::getInstance()->beginDrag(
+ LLViewerAssetType::lookupDragAndDropType( mDragItem->getType() ),
+ mDragItem->getUUID(),
+ LLToolDragAndDrop::SOURCE_NOTECARD,
+ mPreviewID, mObjectID);
+ return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask );
+ }
+ getWindow()->setCursor(UI_CURSOR_HAND);
+ handled = TRUE;
+ }
+
+ return handled;
}
BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
-
- if( hasMouseCapture() )
- {
- if (mDragItem)
- {
- // mouse down was on an item
- S32 dx = x - mMouseDownX;
- S32 dy = y - mMouseDownY;
- if (-2 < dx && dx < 2 && -2 < dy && dy < 2)
- {
- if(mDragItemSaved)
- {
- openEmbeddedItem(mDragItem, mDragItemChar);
- }
- else
- {
- showUnsavedAlertDialog(mDragItem);
- }
- }
- }
- mDragItem = NULL;
- }
-
- handled = LLTextEditor::handleMouseUp(x,y,mask);
-
- return handled;
+ BOOL handled = FALSE;
+
+ if( hasMouseCapture() )
+ {
+ if (mDragItem)
+ {
+ // mouse down was on an item
+ S32 dx = x - mMouseDownX;
+ S32 dy = y - mMouseDownY;
+ if (-2 < dx && dx < 2 && -2 < dy && dy < 2)
+ {
+ if(mDragItemSaved)
+ {
+ openEmbeddedItem(mDragItem, mDragItemChar);
+ }
+ else
+ {
+ showUnsavedAlertDialog(mDragItem);
+ }
+ }
+ }
+ mDragItem = NULL;
+ }
+
+ handled = LLTextEditor::handleMouseUp(x,y,mask);
+
+ return handled;
}
BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
-
- // let scrollbar have first dibs
- handled = LLView::childrenHandleDoubleClick(x, y, mask) != NULL;
-
- if( !handled)
- {
- if( allowsEmbeddedItems() )
- {
- S32 doc_index = getDocIndexFromLocalCoord(x, y, FALSE);
- llwchar doc_char = getWText()[doc_index];
- if (mEmbeddedItemList->hasEmbeddedItem(doc_char))
- {
- if( openEmbeddedItemAtPos( doc_index ))
- {
- deselect();
- setFocus( FALSE );
- return TRUE;
- }
- }
- }
- handled = LLTextEditor::handleDoubleClick(x, y, mask);
- }
- return handled;
+ BOOL handled = FALSE;
+
+ // let scrollbar have first dibs
+ handled = LLView::childrenHandleDoubleClick(x, y, mask) != NULL;
+
+ if( !handled)
+ {
+ if( allowsEmbeddedItems() )
+ {
+ S32 doc_index = getDocIndexFromLocalCoord(x, y, FALSE);
+ llwchar doc_char = getWText()[doc_index];
+ if (mEmbeddedItemList->hasEmbeddedItem(doc_char))
+ {
+ if( openEmbeddedItemAtPos( doc_index ))
+ {
+ deselect();
+ setFocus( FALSE );
+ return TRUE;
+ }
+ }
+ }
+ handled = LLTextEditor::handleDoubleClick(x, y, mask);
+ }
+ return handled;
}
// virtual
BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg)
+ BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
+ EAcceptance *accept,
+ std::string& tooltip_msg)
{
- BOOL handled = FALSE;
-
- LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
- if (LLToolDragAndDrop::SOURCE_NOTECARD == source)
- {
- // We currently do not handle dragging items from one notecard to another
- // since items in a notecard must be in Inventory to be verified. See DEV-2891.
- return FALSE;
- }
-
- if (getEnabled() && acceptsTextInput())
- {
- bool supported = false;
- switch( cargo_type )
- {
- case DAD_SETTINGS:
- {
- supported = LLEnvironment::instance().isExtendedEnvironmentEnabled();
- if (!supported && tooltip_msg.empty())
- {
- tooltip_msg.assign(LLTrans::getString("TooltipNotecardNotAllowedTypeDrop"));
- }
- break;
- }
- case DAD_CALLINGCARD:
- case DAD_TEXTURE:
- case DAD_SOUND:
- case DAD_LANDMARK:
- case DAD_SCRIPT:
- case DAD_CLOTHING:
- case DAD_OBJECT:
- case DAD_NOTECARD:
- case DAD_BODYPART:
- case DAD_ANIMATION:
- case DAD_GESTURE:
- case DAD_MESH:
+ BOOL handled = FALSE;
+
+ LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
+ if (LLToolDragAndDrop::SOURCE_NOTECARD == source)
+ {
+ // We currently do not handle dragging items from one notecard to another
+ // since items in a notecard must be in Inventory to be verified. See DEV-2891.
+ return FALSE;
+ }
+
+ if (getEnabled() && acceptsTextInput())
+ {
+ bool supported = false;
+ switch( cargo_type )
+ {
+ case DAD_SETTINGS:
+ {
+ supported = LLEnvironment::instance().isExtendedEnvironmentEnabled();
+ if (!supported && tooltip_msg.empty())
+ {
+ tooltip_msg.assign(LLTrans::getString("TooltipNotecardNotAllowedTypeDrop"));
+ }
+ break;
+ }
+ case DAD_CALLINGCARD:
+ case DAD_TEXTURE:
+ case DAD_SOUND:
+ case DAD_LANDMARK:
+ case DAD_SCRIPT:
+ case DAD_CLOTHING:
+ case DAD_OBJECT:
+ case DAD_NOTECARD:
+ case DAD_BODYPART:
+ case DAD_ANIMATION:
+ case DAD_GESTURE:
+ case DAD_MESH:
case DAD_MATERIAL:
- {
- supported = true;
- break;
- }
-
- default:
- supported = false;
- break;
- }
-
- LLInventoryItem *item = (LLInventoryItem *)cargo_data;
- if (item && allowsEmbeddedItems() && supported)
- {
- U32 mask_next = item->getPermissions().getMaskNextOwner();
- if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
- {
- if( drop )
- {
- deselect();
- S32 old_cursor = mCursorPos;
- setCursorAtLocalPos( x, y, TRUE );
- S32 insert_pos = mCursorPos;
- setCursorPos(old_cursor);
- BOOL inserted = insertEmbeddedItem( insert_pos, item );
- if( inserted && (old_cursor > mCursorPos) )
- {
- setCursorPos(mCursorPos + 1);
- }
-
- needsReflow();
- }
- *accept = ACCEPT_YES_COPY_MULTI;
- }
- else
- {
- *accept = ACCEPT_NO;
- if (tooltip_msg.empty())
- {
- tooltip_msg.assign(LLTrans::getString("TooltipNotecardOwnerRestrictedDrop"));
- }
- }
- }
- else
- {
- *accept = ACCEPT_NO;
- }
- }
- else
- {
- // Not enabled
- *accept = ACCEPT_NO;
- }
-
- handled = TRUE;
- LL_DEBUGS("UserInput") << "dragAndDrop handled by LLViewerTextEditor " << getName() << LL_ENDL;
-
- return handled;
+ {
+ supported = true;
+ break;
+ }
+
+ default:
+ supported = false;
+ break;
+ }
+
+ LLInventoryItem *item = (LLInventoryItem *)cargo_data;
+ if (item && allowsEmbeddedItems() && supported)
+ {
+ U32 mask_next = item->getPermissions().getMaskNextOwner();
+ if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
+ {
+ if( drop )
+ {
+ deselect();
+ S32 old_cursor = mCursorPos;
+ setCursorAtLocalPos( x, y, TRUE );
+ S32 insert_pos = mCursorPos;
+ setCursorPos(old_cursor);
+ BOOL inserted = insertEmbeddedItem( insert_pos, item );
+ if( inserted && (old_cursor > mCursorPos) )
+ {
+ setCursorPos(mCursorPos + 1);
+ }
+
+ needsReflow();
+ }
+ *accept = ACCEPT_YES_COPY_MULTI;
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ if (tooltip_msg.empty())
+ {
+ tooltip_msg.assign(LLTrans::getString("TooltipNotecardOwnerRestrictedDrop"));
+ }
+ }
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ }
+ }
+ else
+ {
+ // Not enabled
+ *accept = ACCEPT_NO;
+ }
+
+ handled = TRUE;
+ LL_DEBUGS("UserInput") << "dragAndDrop handled by LLViewerTextEditor " << getName() << LL_ENDL;
+
+ return handled;
}
void LLViewerTextEditor::setASCIIEmbeddedText(const std::string& instr)
{
- LLWString wtext;
- const U8* buffer = (U8*)(instr.c_str());
- while (*buffer)
- {
- llwchar wch;
- U8 c = *buffer++;
- if (c >= 0x80)
- {
- S32 index = (S32)(c - 0x80);
- wch = mEmbeddedItemList->getEmbeddedCharFromIndex(index);
- }
- else
- {
- wch = (llwchar)c;
- }
- wtext.push_back(wch);
- }
- setWText(wtext);
+ LLWString wtext;
+ const U8* buffer = (U8*)(instr.c_str());
+ while (*buffer)
+ {
+ llwchar wch;
+ U8 c = *buffer++;
+ if (c >= 0x80)
+ {
+ S32 index = (S32)(c - 0x80);
+ wch = mEmbeddedItemList->getEmbeddedCharFromIndex(index);
+ }
+ else
+ {
+ wch = (llwchar)c;
+ }
+ wtext.push_back(wch);
+ }
+ setWText(wtext);
}
void LLViewerTextEditor::setEmbeddedText(const std::string& instr)
{
- LLWString wtext = utf8str_to_wstring(instr);
- for (S32 i=0; i<(S32)wtext.size(); i++)
- {
- llwchar wch = wtext[i];
- if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )
- {
- S32 index = wch - FIRST_EMBEDDED_CHAR;
- wtext[i] = mEmbeddedItemList->getEmbeddedCharFromIndex(index);
- }
- }
- setWText(wtext);
+ LLWString wtext = utf8str_to_wstring(instr);
+ for (S32 i=0; i<(S32)wtext.size(); i++)
+ {
+ llwchar wch = wtext[i];
+ if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )
+ {
+ S32 index = wch - FIRST_EMBEDDED_CHAR;
+ wtext[i] = mEmbeddedItemList->getEmbeddedCharFromIndex(index);
+ }
+ }
+ setWText(wtext);
}
std::string LLViewerTextEditor::getEmbeddedText()
{
#if 1
- // New version (Version 2)
- mEmbeddedItemList->copyUsedCharsToIndexed();
- LLWString outtextw;
- for (S32 i=0; i<(S32)getWText().size(); i++)
- {
- llwchar wch = getWText()[i];
- if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )
- {
- S32 index = mEmbeddedItemList->getIndexFromEmbeddedChar(wch);
- wch = FIRST_EMBEDDED_CHAR + index;
- }
- outtextw.push_back(wch);
- }
- std::string outtext = wstring_to_utf8str(outtextw);
- return outtext;
+ // New version (Version 2)
+ mEmbeddedItemList->copyUsedCharsToIndexed();
+ LLWString outtextw;
+ for (S32 i=0; i<(S32)getWText().size(); i++)
+ {
+ llwchar wch = getWText()[i];
+ if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )
+ {
+ S32 index = mEmbeddedItemList->getIndexFromEmbeddedChar(wch);
+ wch = FIRST_EMBEDDED_CHAR + index;
+ }
+ outtextw.push_back(wch);
+ }
+ std::string outtext = wstring_to_utf8str(outtextw);
+ return outtext;
#else
- // Old version (Version 1)
- mEmbeddedItemList->copyUsedCharsToIndexed();
- std::string outtext;
- for (S32 i=0; i<(S32)mWText.size(); i++)
- {
- llwchar wch = mWText[i];
- if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )
- {
- S32 index = mEmbeddedItemList->getIndexFromEmbeddedChar(wch);
- wch = 0x80 | index % 128;
- }
- else if (wch >= 0x80)
- {
- wch = LL_UNKNOWN_CHAR;
- }
- outtext.push_back((U8)wch);
- }
- return outtext;
+ // Old version (Version 1)
+ mEmbeddedItemList->copyUsedCharsToIndexed();
+ std::string outtext;
+ for (S32 i=0; i<(S32)mWText.size(); i++)
+ {
+ llwchar wch = mWText[i];
+ if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )
+ {
+ S32 index = mEmbeddedItemList->getIndexFromEmbeddedChar(wch);
+ wch = 0x80 | index % 128;
+ }
+ else if (wch >= 0x80)
+ {
+ wch = LL_UNKNOWN_CHAR;
+ }
+ outtext.push_back((U8)wch);
+ }
+ return outtext;
#endif
}
std::string LLViewerTextEditor::appendTime(bool prepend_newline)
{
- time_t utc_time;
- utc_time = time_corrected();
- std::string timeStr ="[["+ LLTrans::getString("TimeHour")+"]:["
- +LLTrans::getString("TimeMin")+"]] ";
+ time_t utc_time;
+ utc_time = time_corrected();
+ std::string timeStr ="[["+ LLTrans::getString("TimeHour")+"]:["
+ +LLTrans::getString("TimeMin")+"]] ";
- LLSD substitution;
+ LLSD substitution;
- substitution["datetime"] = (S32) utc_time;
- LLStringUtil::format (timeStr, substitution);
- appendText(timeStr, prepend_newline, LLStyle::Params().color(LLColor4::grey));
- blockUndo();
+ substitution["datetime"] = (S32) utc_time;
+ LLStringUtil::format (timeStr, substitution);
+ appendText(timeStr, prepend_newline, LLStyle::Params().color(LLColor4::grey));
+ blockUndo();
- return timeStr;
+ return timeStr;
}
//----------------------------------------------------------------------------
@@ -1056,186 +1056,186 @@ std::string LLViewerTextEditor::appendTime(bool prepend_newline)
llwchar LLViewerTextEditor::pasteEmbeddedItem(llwchar ext_char)
{
- if (mEmbeddedItemList->hasEmbeddedItem(ext_char))
- {
- return ext_char; // already exists in my list
- }
- LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItemPtr(ext_char);
- if (item)
- {
- // Add item to my list and return new llwchar associated with it
- llwchar new_wc;
- if (mEmbeddedItemList->insertEmbeddedItem( item, &new_wc, true ))
- {
- return new_wc;
- }
- }
- return LL_UNKNOWN_CHAR; // item not found or list full
+ if (mEmbeddedItemList->hasEmbeddedItem(ext_char))
+ {
+ return ext_char; // already exists in my list
+ }
+ LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItemPtr(ext_char);
+ if (item)
+ {
+ // Add item to my list and return new llwchar associated with it
+ llwchar new_wc;
+ if (mEmbeddedItemList->insertEmbeddedItem( item, &new_wc, true ))
+ {
+ return new_wc;
+ }
+ }
+ return LL_UNKNOWN_CHAR; // item not found or list full
}
void LLViewerTextEditor::onValueChange(S32 start, S32 end)
{
- updateSegments();
- updateLinkSegments();
- findEmbeddedItemSegments(start, end);
+ updateSegments();
+ updateLinkSegments();
+ findEmbeddedItemSegments(start, end);
}
void LLViewerTextEditor::findEmbeddedItemSegments(S32 start, S32 end)
{
- LLWString text = getWText();
-
- // Start with i just after the first embedded item
- for(S32 idx = start; idx < end; idx++ )
- {
- llwchar embedded_char = text[idx];
- if( embedded_char >= FIRST_EMBEDDED_CHAR
- && embedded_char <= LAST_EMBEDDED_CHAR
- && mEmbeddedItemList->hasEmbeddedItem(embedded_char) )
- {
- LLInventoryItem* itemp = mEmbeddedItemList->getEmbeddedItemPtr(embedded_char);
- LLUIImagePtr image = mEmbeddedItemList->getItemImage(embedded_char);
- insertSegment(new LLEmbeddedItemSegment(idx, image, itemp, *this));
- }
- }
+ LLWString text = getWText();
+
+ // Start with i just after the first embedded item
+ for(S32 idx = start; idx < end; idx++ )
+ {
+ llwchar embedded_char = text[idx];
+ if( embedded_char >= FIRST_EMBEDDED_CHAR
+ && embedded_char <= LAST_EMBEDDED_CHAR
+ && mEmbeddedItemList->hasEmbeddedItem(embedded_char) )
+ {
+ LLInventoryItem* itemp = mEmbeddedItemList->getEmbeddedItemPtr(embedded_char);
+ LLUIImagePtr image = mEmbeddedItemList->getItemImage(embedded_char);
+ insertSegment(new LLEmbeddedItemSegment(idx, image, itemp, *this));
+ }
+ }
}
BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos)
{
- if( pos < getLength())
- {
- llwchar wc = getWText()[pos];
- LLPointer<LLInventoryItem> item = LLEmbeddedItems::getEmbeddedItemPtr( wc );
- if( item )
- {
- BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( wc );
- if (saved)
- {
- return openEmbeddedItem(item, wc);
- }
- else
- {
- showUnsavedAlertDialog(item);
- }
- }
- }
- return FALSE;
+ if( pos < getLength())
+ {
+ llwchar wc = getWText()[pos];
+ LLPointer<LLInventoryItem> item = LLEmbeddedItems::getEmbeddedItemPtr( wc );
+ if( item )
+ {
+ BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( wc );
+ if (saved)
+ {
+ return openEmbeddedItem(item, wc);
+ }
+ else
+ {
+ showUnsavedAlertDialog(item);
+ }
+ }
+ }
+ return FALSE;
}
BOOL LLViewerTextEditor::openEmbeddedItem(LLPointer<LLInventoryItem> item, llwchar wc)
{
- switch( item->getType() )
- {
- case LLAssetType::AT_TEXTURE:
- openEmbeddedTexture( item, wc );
- return TRUE;
-
- case LLAssetType::AT_SOUND:
- openEmbeddedSound( item, wc );
- return TRUE;
-
- case LLAssetType::AT_LANDMARK:
- openEmbeddedLandmark( item, wc );
- return TRUE;
-
- case LLAssetType::AT_CALLINGCARD:
- openEmbeddedCallingcard( item, wc );
- return TRUE;
- case LLAssetType::AT_SETTINGS:
- openEmbeddedSetting(item, wc);
- return TRUE;
+ switch( item->getType() )
+ {
+ case LLAssetType::AT_TEXTURE:
+ openEmbeddedTexture( item, wc );
+ return TRUE;
+
+ case LLAssetType::AT_SOUND:
+ openEmbeddedSound( item, wc );
+ return TRUE;
+
+ case LLAssetType::AT_LANDMARK:
+ openEmbeddedLandmark( item, wc );
+ return TRUE;
+
+ case LLAssetType::AT_CALLINGCARD:
+ openEmbeddedCallingcard( item, wc );
+ return TRUE;
+ case LLAssetType::AT_SETTINGS:
+ openEmbeddedSetting(item, wc);
+ return TRUE;
case LLAssetType::AT_MATERIAL:
openEmbeddedGLTFMaterial(item, wc);
return TRUE;
- case LLAssetType::AT_NOTECARD:
- case LLAssetType::AT_LSL_TEXT:
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_OBJECT:
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_ANIMATION:
- case LLAssetType::AT_GESTURE:
- showCopyToInvDialog( item, wc );
- return TRUE;
- default:
- return FALSE;
- }
+ case LLAssetType::AT_NOTECARD:
+ case LLAssetType::AT_LSL_TEXT:
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_OBJECT:
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_ANIMATION:
+ case LLAssetType::AT_GESTURE:
+ showCopyToInvDialog( item, wc );
+ return TRUE;
+ default:
+ return FALSE;
+ }
}
void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item, llwchar wc )
{
- // *NOTE: Just for embedded Texture , we should use getAssetUUID(),
- // not getUUID(), because LLPreviewTexture pass in AssetUUID into
- // LLPreview constructor ItemUUID parameter.
- if (!item)
- return;
- LLPreviewTexture* preview = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item->getAssetUUID()), TAKE_FOCUS_YES);
- if (preview)
- {
- preview->setAuxItem( item );
- preview->setNotecardInfo(mNotecardInventoryID, mObjectID);
- if (preview->hasString("Title"))
- {
- LLStringUtil::format_map_t args;
- args["[NAME]"] = item->getName();
- LLUIString title = preview->getString("Title", args);
- preview->setTitle(title.getString());
- }
- preview->getChild<LLUICtrl>("desc")->setValue(item->getDescription());
- }
+ // *NOTE: Just for embedded Texture , we should use getAssetUUID(),
+ // not getUUID(), because LLPreviewTexture pass in AssetUUID into
+ // LLPreview constructor ItemUUID parameter.
+ if (!item)
+ return;
+ LLPreviewTexture* preview = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item->getAssetUUID()), TAKE_FOCUS_YES);
+ if (preview)
+ {
+ preview->setAuxItem( item );
+ preview->setNotecardInfo(mNotecardInventoryID, mObjectID);
+ if (preview->hasString("Title"))
+ {
+ LLStringUtil::format_map_t args;
+ args["[NAME]"] = item->getName();
+ LLUIString title = preview->getString("Title", args);
+ preview->setTitle(title.getString());
+ }
+ preview->getChild<LLUICtrl>("desc")->setValue(item->getDescription());
+ }
}
void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item, llwchar wc )
{
- // Play sound locally
- LLVector3d lpos_global = gAgent.getPositionGlobal();
- const F32 SOUND_GAIN = 1.0f;
- if(gAudiop)
- {
- gAudiop->triggerSound(item->getAssetUUID(), gAgentID, SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, lpos_global);
- }
- showCopyToInvDialog( item, wc );
+ // Play sound locally
+ LLVector3d lpos_global = gAgent.getPositionGlobal();
+ const F32 SOUND_GAIN = 1.0f;
+ if(gAudiop)
+ {
+ gAudiop->triggerSound(item->getAssetUUID(), gAgentID, SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, lpos_global);
+ }
+ showCopyToInvDialog( item, wc );
}
void LLViewerTextEditor::openEmbeddedLandmark( LLPointer<LLInventoryItem> item_ptr, llwchar wc )
{
- if (item_ptr.isNull())
- return;
-
- LLLandmark* landmark = gLandmarkList.getAsset(item_ptr->getAssetUUID(),
- boost::bind(&LLEmbeddedLandmarkCopied::processForeignLandmark, _1, mObjectID, mNotecardInventoryID, item_ptr));
- if (landmark)
- {
- LLEmbeddedLandmarkCopied::processForeignLandmark(landmark, mObjectID,
- mNotecardInventoryID, item_ptr);
- }
+ if (item_ptr.isNull())
+ return;
+
+ LLLandmark* landmark = gLandmarkList.getAsset(item_ptr->getAssetUUID(),
+ boost::bind(&LLEmbeddedLandmarkCopied::processForeignLandmark, _1, mObjectID, mNotecardInventoryID, item_ptr));
+ if (landmark)
+ {
+ LLEmbeddedLandmarkCopied::processForeignLandmark(landmark, mObjectID,
+ mNotecardInventoryID, item_ptr);
+ }
}
void LLViewerTextEditor::openEmbeddedCallingcard( LLInventoryItem* item, llwchar wc )
{
- if (item && !item->getDescription().empty())
- {
- LLAvatarActions::showProfile(LLUUID(item->getDescription()));
- }
- else if (item && !item->getCreatorUUID().isNull())
- {
- LLAvatarActions::showProfile(item->getCreatorUUID());
- }
+ if (item && !item->getDescription().empty())
+ {
+ LLAvatarActions::showProfile(LLUUID(item->getDescription()));
+ }
+ else if (item && !item->getCreatorUUID().isNull())
+ {
+ LLAvatarActions::showProfile(item->getCreatorUUID());
+ }
}
void LLViewerTextEditor::openEmbeddedSetting(LLInventoryItem* item, llwchar wc)
{
- if (LLEnvironment::instance().isInventoryEnabled())
- {
- showCopyToInvDialog(item, wc);
- }
- else
- {
- LLNotificationsUtil::add("NoEnvironmentSettings");
- }
+ if (LLEnvironment::instance().isInventoryEnabled())
+ {
+ showCopyToInvDialog(item, wc);
+ }
+ else
+ {
+ LLNotificationsUtil::add("NoEnvironmentSettings");
+ }
}
void LLViewerTextEditor::openEmbeddedGLTFMaterial(LLInventoryItem* item, llwchar wc)
@@ -1260,50 +1260,50 @@ void LLViewerTextEditor::openEmbeddedGLTFMaterial(LLInventoryItem* item, llwchar
void LLViewerTextEditor::showUnsavedAlertDialog( LLInventoryItem* item )
{
- LLSD payload;
- payload["item_id"] = item->getUUID();
- payload["notecard_id"] = mNotecardInventoryID;
- LLNotificationsUtil::add( "ConfirmNotecardSave", LLSD(), payload, LLViewerTextEditor::onNotecardDialog);
+ LLSD payload;
+ payload["item_id"] = item->getUUID();
+ payload["notecard_id"] = mNotecardInventoryID;
+ LLNotificationsUtil::add( "ConfirmNotecardSave", LLSD(), payload, LLViewerTextEditor::onNotecardDialog);
}
// static
bool LLViewerTextEditor::onNotecardDialog(const LLSD& notification, const LLSD& response )
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if( option == 0 )
- {
- LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", notification["payload"]["notecard_id"]);;
- if (preview)
- {
- preview->saveItem();
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if( option == 0 )
+ {
+ LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", notification["payload"]["notecard_id"]);;
+ if (preview)
+ {
+ preview->saveItem();
+ }
+ }
+ return false;
}
void LLViewerTextEditor::showCopyToInvDialog( LLInventoryItem* item, llwchar wc )
{
- LLSD payload;
- LLUUID item_id = item->getUUID();
- payload["item_id"] = item_id;
- payload["item_wc"] = LLSD::Integer(wc);
- LLNotificationsUtil::add( "ConfirmItemCopy", LLSD(), payload,
- boost::bind(&LLViewerTextEditor::onCopyToInvDialog, this, _1, _2));
+ LLSD payload;
+ LLUUID item_id = item->getUUID();
+ payload["item_id"] = item_id;
+ payload["item_wc"] = LLSD::Integer(wc);
+ LLNotificationsUtil::add( "ConfirmItemCopy", LLSD(), payload,
+ boost::bind(&LLViewerTextEditor::onCopyToInvDialog, this, _1, _2));
}
bool LLViewerTextEditor::onCopyToInvDialog(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if( 0 == option )
- {
- llwchar wc = llwchar(notification["payload"]["item_wc"].asInteger());
- LLInventoryItem* itemp = LLEmbeddedItems::getEmbeddedItemPtr(wc);
- if (itemp)
- copyInventory(itemp);
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if( 0 == option )
+ {
+ llwchar wc = llwchar(notification["payload"]["item_wc"].asInteger());
+ LLInventoryItem* itemp = LLEmbeddedItems::getEmbeddedItemPtr(wc);
+ if (itemp)
+ copyInventory(itemp);
+ }
+ return false;
}
@@ -1311,73 +1311,73 @@ bool LLViewerTextEditor::onCopyToInvDialog(const LLSD& notification, const LLSD&
// Returns change in number of characters in mWText
S32 LLViewerTextEditor::insertEmbeddedItem( S32 pos, LLInventoryItem* item )
{
- return execute( new TextCmdInsertEmbeddedItem( pos, item ) );
+ return execute( new TextCmdInsertEmbeddedItem( pos, item ) );
}
bool LLViewerTextEditor::importStream(std::istream& str)
{
- LLNotecard nc(LLNotecard::MAX_SIZE);
- bool success = nc.importStream(str);
- if (success)
- {
- mEmbeddedItemList->clear();
- const std::vector<LLPointer<LLInventoryItem> >& items = nc.getItems();
- mEmbeddedItemList->addItems(items);
- // Actually set the text
- if (allowsEmbeddedItems())
- {
- if (nc.getVersion() == 1)
- setASCIIEmbeddedText( nc.getText() );
- else
- setEmbeddedText( nc.getText() );
- }
- else
- {
- setText( nc.getText() );
- }
- }
- return success;
+ LLNotecard nc(LLNotecard::MAX_SIZE);
+ bool success = nc.importStream(str);
+ if (success)
+ {
+ mEmbeddedItemList->clear();
+ const std::vector<LLPointer<LLInventoryItem> >& items = nc.getItems();
+ mEmbeddedItemList->addItems(items);
+ // Actually set the text
+ if (allowsEmbeddedItems())
+ {
+ if (nc.getVersion() == 1)
+ setASCIIEmbeddedText( nc.getText() );
+ else
+ setEmbeddedText( nc.getText() );
+ }
+ else
+ {
+ setText( nc.getText() );
+ }
+ }
+ return success;
}
void LLViewerTextEditor::copyInventory(const LLInventoryItem* item, U32 callback_id)
{
- copy_inventory_from_notecard(LLUUID::null, // Don't specify a destination -- let the sim do that
- mObjectID,
- mNotecardInventoryID,
- item,
- callback_id);
+ copy_inventory_from_notecard(LLUUID::null, // Don't specify a destination -- let the sim do that
+ mObjectID,
+ mNotecardInventoryID,
+ item,
+ callback_id);
}
bool LLViewerTextEditor::hasEmbeddedInventory()
{
- return ! mEmbeddedItemList->empty();
+ return ! mEmbeddedItemList->empty();
}
////////////////////////////////////////////////////////////////////////////
BOOL LLViewerTextEditor::importBuffer( const char* buffer, S32 length )
{
- LLMemoryStream str((U8*)buffer, length);
- return importStream(str);
+ LLMemoryStream str((U8*)buffer, length);
+ return importStream(str);
}
BOOL LLViewerTextEditor::exportBuffer( std::string& buffer )
{
- LLNotecard nc(LLNotecard::MAX_SIZE);
-
- // Get the embedded text and update the item list to just be the used items
- nc.setText(getEmbeddedText());
-
- // Now get the used items and copy the list to the notecard
- std::vector<LLPointer<LLInventoryItem> > embedded_items;
- mEmbeddedItemList->getEmbeddedItemList(embedded_items);
- nc.setItems(embedded_items);
-
- std::stringstream out_stream;
- nc.exportStream(out_stream);
-
- buffer = out_stream.str();
-
- return TRUE;
+ LLNotecard nc(LLNotecard::MAX_SIZE);
+
+ // Get the embedded text and update the item list to just be the used items
+ nc.setText(getEmbeddedText());
+
+ // Now get the used items and copy the list to the notecard
+ std::vector<LLPointer<LLInventoryItem> > embedded_items;
+ mEmbeddedItemList->getEmbeddedItemList(embedded_items);
+ nc.setItems(embedded_items);
+
+ std::stringstream out_stream;
+ nc.exportStream(out_stream);
+
+ buffer = out_stream.str();
+
+ return TRUE;
}
diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h
index 6170d476b8..c3967d3a1c 100644
--- a/indra/newview/llviewertexteditor.h
+++ b/indra/newview/llviewertexteditor.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewertexteditor.h
* @brief Text editor widget to let users enter a multi-line document//
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,103 +35,103 @@
class LLViewerTextEditor : public LLTextEditor
{
public:
- struct Params : public LLInitParam::Block<Params, LLTextEditor::Params>
- {};
+ struct Params : public LLInitParam::Block<Params, LLTextEditor::Params>
+ {};
protected:
- LLViewerTextEditor(const Params&);
- friend class LLUICtrlFactory;
+ LLViewerTextEditor(const Params&);
+ friend class LLUICtrlFactory;
public:
- virtual ~LLViewerTextEditor();
-
- virtual void makePristine();
-
- /*virtual*/ void onVisibilityChange( BOOL new_visibility );
-
- // mousehandler overrides
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask );
-
- virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type,
- void *cargo_data, EAcceptance *accept, std::string& tooltip_msg);
-
- const class LLInventoryItem* getDragItem() const { return mDragItem; }
- virtual BOOL importBuffer(const char* buffer, S32 length);
- virtual bool importStream(std::istream& str);
- virtual BOOL exportBuffer(std::string& buffer);
- virtual void onValueChange(S32 start, S32 end);
-
- void setNotecardInfo(const LLUUID& notecard_item_id, const LLUUID& object_id, const LLUUID& preview_id)
- {
- mNotecardInventoryID = notecard_item_id;
- mObjectID = object_id;
- mPreviewID = preview_id;
- }
- void setNotecardObjectID(const LLUUID& object_id){ mObjectID = object_id;}
-
- void setASCIIEmbeddedText(const std::string& instr);
- void setEmbeddedText(const std::string& instr);
- std::string getEmbeddedText();
-
- // Appends Second Life time, small font, grey.
- // If this starts a line, you need to prepend a newline.
- std::string appendTime(bool prepend_newline);
-
- void copyInventory(const LLInventoryItem* item, U32 callback_id = 0);
-
- // returns true if there is embedded inventory.
- // *HACK: This is only useful because the notecard verifier may
- // change the asset if there is embedded inventory. This mechanism
- // should be changed to get a different asset id from the verifier
- // rather than checking if a re-load is necessary. Phoenix 2007-02-27
- bool hasEmbeddedInventory();
+ virtual ~LLViewerTextEditor();
+
+ virtual void makePristine();
+
+ /*virtual*/ void onVisibilityChange( BOOL new_visibility );
+
+ // mousehandler overrides
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask );
+
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
+ BOOL drop, EDragAndDropType cargo_type,
+ void *cargo_data, EAcceptance *accept, std::string& tooltip_msg);
+
+ const class LLInventoryItem* getDragItem() const { return mDragItem; }
+ virtual BOOL importBuffer(const char* buffer, S32 length);
+ virtual bool importStream(std::istream& str);
+ virtual BOOL exportBuffer(std::string& buffer);
+ virtual void onValueChange(S32 start, S32 end);
+
+ void setNotecardInfo(const LLUUID& notecard_item_id, const LLUUID& object_id, const LLUUID& preview_id)
+ {
+ mNotecardInventoryID = notecard_item_id;
+ mObjectID = object_id;
+ mPreviewID = preview_id;
+ }
+ void setNotecardObjectID(const LLUUID& object_id){ mObjectID = object_id;}
+
+ void setASCIIEmbeddedText(const std::string& instr);
+ void setEmbeddedText(const std::string& instr);
+ std::string getEmbeddedText();
+
+ // Appends Second Life time, small font, grey.
+ // If this starts a line, you need to prepend a newline.
+ std::string appendTime(bool prepend_newline);
+
+ void copyInventory(const LLInventoryItem* item, U32 callback_id = 0);
+
+ // returns true if there is embedded inventory.
+ // *HACK: This is only useful because the notecard verifier may
+ // change the asset if there is embedded inventory. This mechanism
+ // should be changed to get a different asset id from the verifier
+ // rather than checking if a re-load is necessary. Phoenix 2007-02-27
+ bool hasEmbeddedInventory();
private:
- // Embedded object operations
- void findEmbeddedItemSegments(S32 start, S32 end);
- virtual llwchar pasteEmbeddedItem(llwchar ext_char);
-
- BOOL openEmbeddedItemAtPos( S32 pos );
- BOOL openEmbeddedItem(LLPointer<LLInventoryItem> item, llwchar wc);
-
- S32 insertEmbeddedItem(S32 pos, LLInventoryItem* item);
-
- // *NOTE: most of openEmbeddedXXX methods except openEmbeddedLandmark take pointer to LLInventoryItem.
- // Be sure they don't bind it to callback function to avoid situation when it gets invalid when
- // callback is trigged after text editor is closed. See EXT-8459.
- void openEmbeddedTexture( LLInventoryItem* item, llwchar wc );
- void openEmbeddedSound( LLInventoryItem* item, llwchar wc );
- void openEmbeddedLandmark( LLPointer<LLInventoryItem> item_ptr, llwchar wc );
- void openEmbeddedCallingcard( LLInventoryItem* item, llwchar wc);
- void openEmbeddedSetting(LLInventoryItem* item, llwchar wc);
- void openEmbeddedGLTFMaterial(LLInventoryItem* item, llwchar wc);
- void showCopyToInvDialog( LLInventoryItem* item, llwchar wc );
- void showUnsavedAlertDialog( LLInventoryItem* item );
-
- bool onCopyToInvDialog(const LLSD& notification, const LLSD& response );
- static bool onNotecardDialog(const LLSD& notification, const LLSD& response );
-
- LLPointer<LLInventoryItem> mDragItem;
- LLTextSegment* mDragSegment;
- llwchar mDragItemChar;
- BOOL mDragItemSaved;
- class LLEmbeddedItems* mEmbeddedItemList;
-
- LLUUID mObjectID;
- LLUUID mNotecardInventoryID;
- LLUUID mPreviewID;
-
- LLPointer<class LLEmbeddedNotecardOpener> mInventoryCallback;
-
- //
- // Inner classes
- //
-
- class TextCmdInsertEmbeddedItem;
+ // Embedded object operations
+ void findEmbeddedItemSegments(S32 start, S32 end);
+ virtual llwchar pasteEmbeddedItem(llwchar ext_char);
+
+ BOOL openEmbeddedItemAtPos( S32 pos );
+ BOOL openEmbeddedItem(LLPointer<LLInventoryItem> item, llwchar wc);
+
+ S32 insertEmbeddedItem(S32 pos, LLInventoryItem* item);
+
+ // *NOTE: most of openEmbeddedXXX methods except openEmbeddedLandmark take pointer to LLInventoryItem.
+ // Be sure they don't bind it to callback function to avoid situation when it gets invalid when
+ // callback is trigged after text editor is closed. See EXT-8459.
+ void openEmbeddedTexture( LLInventoryItem* item, llwchar wc );
+ void openEmbeddedSound( LLInventoryItem* item, llwchar wc );
+ void openEmbeddedLandmark( LLPointer<LLInventoryItem> item_ptr, llwchar wc );
+ void openEmbeddedCallingcard( LLInventoryItem* item, llwchar wc);
+ void openEmbeddedSetting(LLInventoryItem* item, llwchar wc);
+ void openEmbeddedGLTFMaterial(LLInventoryItem* item, llwchar wc);
+ void showCopyToInvDialog( LLInventoryItem* item, llwchar wc );
+ void showUnsavedAlertDialog( LLInventoryItem* item );
+
+ bool onCopyToInvDialog(const LLSD& notification, const LLSD& response );
+ static bool onNotecardDialog(const LLSD& notification, const LLSD& response );
+
+ LLPointer<LLInventoryItem> mDragItem;
+ LLTextSegment* mDragSegment;
+ llwchar mDragItemChar;
+ BOOL mDragItemSaved;
+ class LLEmbeddedItems* mEmbeddedItemList;
+
+ LLUUID mObjectID;
+ LLUUID mNotecardInventoryID;
+ LLUUID mPreviewID;
+
+ LLPointer<class LLEmbeddedNotecardOpener> mInventoryCallback;
+
+ //
+ // Inner classes
+ //
+
+ class TextCmdInsertEmbeddedItem;
};
#endif // LL_VIEWERTEXTEDITOR_H
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 04ef441a69..506ffce1ce 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewertexture.cpp
* @brief Object which handles a received image (and associated texture(s))
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -115,24 +115,24 @@ const U32 DESIRED_NORMAL_TEXTURE_SIZE = (U32)LLViewerFetchedTexture::MAX_IMAGE_S
//----------------------------------------------------------------------------------------------
LLLoadedCallbackEntry::LLLoadedCallbackEntry(loaded_callback_func cb,
- S32 discard_level,
- BOOL need_imageraw, // Needs image raw for the callback
- void* userdata,
- LLLoadedCallbackEntry::source_callback_list_t* src_callback_list,
- LLViewerFetchedTexture* target,
- BOOL pause)
- : mCallback(cb),
- mLastUsedDiscard(MAX_DISCARD_LEVEL+1),
- mDesiredDiscard(discard_level),
- mNeedsImageRaw(need_imageraw),
- mUserData(userdata),
- mSourceCallbackList(src_callback_list),
- mPaused(pause)
-{
- if(mSourceCallbackList)
- {
+ S32 discard_level,
+ BOOL need_imageraw, // Needs image raw for the callback
+ void* userdata,
+ LLLoadedCallbackEntry::source_callback_list_t* src_callback_list,
+ LLViewerFetchedTexture* target,
+ BOOL pause)
+ : mCallback(cb),
+ mLastUsedDiscard(MAX_DISCARD_LEVEL+1),
+ mDesiredDiscard(discard_level),
+ mNeedsImageRaw(need_imageraw),
+ mUserData(userdata),
+ mSourceCallbackList(src_callback_list),
+ mPaused(pause)
+{
+ if(mSourceCallbackList)
+ {
mSourceCallbackList->insert(LLTextureKey(target->getID(), (ETexListType)target->getTextureListType()));
- }
+ }
}
LLLoadedCallbackEntry::~LLLoadedCallbackEntry()
@@ -141,34 +141,34 @@ LLLoadedCallbackEntry::~LLLoadedCallbackEntry()
void LLLoadedCallbackEntry::removeTexture(LLViewerFetchedTexture* tex)
{
- if(mSourceCallbackList)
- {
- mSourceCallbackList->erase(LLTextureKey(tex->getID(), (ETexListType)tex->getTextureListType()));
- }
+ if(mSourceCallbackList)
+ {
+ mSourceCallbackList->erase(LLTextureKey(tex->getID(), (ETexListType)tex->getTextureListType()));
+ }
}
-//static
+//static
void LLLoadedCallbackEntry::cleanUpCallbackList(LLLoadedCallbackEntry::source_callback_list_t* callback_list)
{
- //clear texture callbacks.
- if(callback_list && !callback_list->empty())
- {
- for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = callback_list->begin();
- iter != callback_list->end(); ++iter)
- {
- LLViewerFetchedTexture* tex = gTextureList.findImage(*iter);
- if(tex)
- {
- tex->deleteCallbackEntry(callback_list);
- }
- }
- callback_list->clear();
- }
+ //clear texture callbacks.
+ if(callback_list && !callback_list->empty())
+ {
+ for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = callback_list->begin();
+ iter != callback_list->end(); ++iter)
+ {
+ LLViewerFetchedTexture* tex = gTextureList.findImage(*iter);
+ if(tex)
+ {
+ tex->deleteCallbackEntry(callback_list);
+ }
+ }
+ callback_list->clear();
+ }
}
LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &media_id, BOOL usemipmaps, LLImageGL* gl_image)
{
- return new LLViewerMediaTexture(media_id, usemipmaps, gl_image);
+ return new LLViewerMediaTexture(media_id, usemipmaps, gl_image);
}
void LLViewerTextureManager::findFetchedTextures(const LLUUID& id, std::vector<LLViewerFetchedTexture*> &output)
@@ -209,78 +209,78 @@ LLViewerFetchedTexture* LLViewerTextureManager::findFetchedTexture(const LLUUID&
LLViewerMediaTexture* LLViewerTextureManager::findMediaTexture(const LLUUID &media_id)
{
- return LLViewerMediaTexture::findMediaTexture(media_id);
+ return LLViewerMediaTexture::findMediaTexture(media_id);
}
-LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id, BOOL usemipmaps, LLImageGL* gl_image)
+LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id, BOOL usemipmaps, LLImageGL* gl_image)
{
- LLViewerMediaTexture* tex = LLViewerMediaTexture::findMediaTexture(id);
- if(!tex)
- {
- tex = LLViewerTextureManager::createMediaTexture(id, usemipmaps, gl_image);
- }
+ LLViewerMediaTexture* tex = LLViewerMediaTexture::findMediaTexture(id);
+ if(!tex)
+ {
+ tex = LLViewerTextureManager::createMediaTexture(id, usemipmaps, gl_image);
+ }
- tex->initVirtualSize();
+ tex->initVirtualSize();
- return tex;
+ return tex;
}
LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLTexture* tex, BOOL report_error)
{
- if(!tex)
- {
- return NULL;
- }
+ if(!tex)
+ {
+ return NULL;
+ }
- S8 type = tex->getType();
- if(type == LLViewerTexture::FETCHED_TEXTURE || type == LLViewerTexture::LOD_TEXTURE)
- {
- return static_cast<LLViewerFetchedTexture*>(tex);
- }
+ S8 type = tex->getType();
+ if(type == LLViewerTexture::FETCHED_TEXTURE || type == LLViewerTexture::LOD_TEXTURE)
+ {
+ return static_cast<LLViewerFetchedTexture*>(tex);
+ }
- if(report_error)
- {
- LL_ERRS() << "not a fetched texture type: " << type << LL_ENDL;
- }
+ if(report_error)
+ {
+ LL_ERRS() << "not a fetched texture type: " << type << LL_ENDL;
+ }
- return NULL;
+ return NULL;
}
LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(BOOL usemipmaps, BOOL generate_gl_tex)
{
- LLPointer<LLViewerTexture> tex = new LLViewerTexture(usemipmaps);
- if(generate_gl_tex)
- {
- tex->generateGLTexture();
- tex->setCategory(LLGLTexture::LOCAL);
- }
- return tex;
+ LLPointer<LLViewerTexture> tex = new LLViewerTexture(usemipmaps);
+ if(generate_gl_tex)
+ {
+ tex->generateGLTexture();
+ tex->setCategory(LLGLTexture::LOCAL);
+ }
+ return tex;
}
-LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLUUID& id, BOOL usemipmaps, BOOL generate_gl_tex)
+LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLUUID& id, BOOL usemipmaps, BOOL generate_gl_tex)
{
- LLPointer<LLViewerTexture> tex = new LLViewerTexture(id, usemipmaps);
- if(generate_gl_tex)
- {
- tex->generateGLTexture();
- tex->setCategory(LLGLTexture::LOCAL);
- }
- return tex;
+ LLPointer<LLViewerTexture> tex = new LLViewerTexture(id, usemipmaps);
+ if(generate_gl_tex)
+ {
+ tex->generateGLTexture();
+ tex->setCategory(LLGLTexture::LOCAL);
+ }
+ return tex;
}
-LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps)
+LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps)
{
- LLPointer<LLViewerTexture> tex = new LLViewerTexture(raw, usemipmaps);
- tex->setCategory(LLGLTexture::LOCAL);
- return tex;
+ LLPointer<LLViewerTexture> tex = new LLViewerTexture(raw, usemipmaps);
+ tex->setCategory(LLGLTexture::LOCAL);
+ return tex;
}
-LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex)
+LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex)
{
- LLPointer<LLViewerTexture> tex = new LLViewerTexture(width, height, components, usemipmaps);
- if(generate_gl_tex)
- {
- tex->generateGLTexture();
- tex->setCategory(LLGLTexture::LOCAL);
- }
- return tex;
+ LLPointer<LLViewerTexture> tex = new LLViewerTexture(width, height, components, usemipmaps);
+ if(generate_gl_tex)
+ {
+ tex->generateGLTexture();
+ tex->setCategory(LLGLTexture::LOCAL);
+ }
+ return tex;
}
LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLImageRaw* raw, FTType type, bool usemipmaps)
@@ -291,170 +291,170 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLImageR
}
LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(
- const LLUUID &image_id,
- FTType f_type,
- BOOL usemipmaps,
- LLViewerTexture::EBoostLevel boost_priority,
- S8 texture_type,
- LLGLint internal_format,
- LLGLenum primary_format,
- LLHost request_from_host)
-{
- return gTextureList.getImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host);
-}
-
+ const LLUUID &image_id,
+ FTType f_type,
+ BOOL usemipmaps,
+ LLViewerTexture::EBoostLevel boost_priority,
+ S8 texture_type,
+ LLGLint internal_format,
+ LLGLenum primary_format,
+ LLHost request_from_host)
+{
+ return gTextureList.getImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host);
+}
+
LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile(
- const std::string& filename,
- FTType f_type,
- BOOL usemipmaps,
- LLViewerTexture::EBoostLevel boost_priority,
- S8 texture_type,
- LLGLint internal_format,
- LLGLenum primary_format,
- const LLUUID& force_id)
+ const std::string& filename,
+ FTType f_type,
+ BOOL usemipmaps,
+ LLViewerTexture::EBoostLevel boost_priority,
+ S8 texture_type,
+ LLGLint internal_format,
+ LLGLenum primary_format,
+ const LLUUID& force_id)
{
- return gTextureList.getImageFromFile(filename, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id);
+ return gTextureList.getImageFromFile(filename, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id);
}
-//static
+//static
LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string& url,
- FTType f_type,
- BOOL usemipmaps,
- LLViewerTexture::EBoostLevel boost_priority,
- S8 texture_type,
- LLGLint internal_format,
- LLGLenum primary_format,
- const LLUUID& force_id
- )
+ FTType f_type,
+ BOOL usemipmaps,
+ LLViewerTexture::EBoostLevel boost_priority,
+ S8 texture_type,
+ LLGLint internal_format,
+ LLGLenum primary_format,
+ const LLUUID& force_id
+ )
{
- return gTextureList.getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id);
+ return gTextureList.getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id);
}
-LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host)
+LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host)
{
- return gTextureList.getImageFromHost(image_id, f_type, host);
+ return gTextureList.getImageFromHost(image_id, f_type, host);
}
// Create a bridge to the viewer texture manager.
class LLViewerTextureManagerBridge : public LLTextureManagerBridge
{
- /*virtual*/ LLPointer<LLGLTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE)
- {
- return LLViewerTextureManager::getLocalTexture(usemipmaps, generate_gl_tex);
- }
+ /*virtual*/ LLPointer<LLGLTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE)
+ {
+ return LLViewerTextureManager::getLocalTexture(usemipmaps, generate_gl_tex);
+ }
- /*virtual*/ LLPointer<LLGLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE)
- {
- return LLViewerTextureManager::getLocalTexture(width, height, components, usemipmaps, generate_gl_tex);
- }
+ /*virtual*/ LLPointer<LLGLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE)
+ {
+ return LLViewerTextureManager::getLocalTexture(width, height, components, usemipmaps, generate_gl_tex);
+ }
- /*virtual*/ LLGLTexture* getFetchedTexture(const LLUUID &image_id)
- {
- return LLViewerTextureManager::getFetchedTexture(image_id);
- }
+ /*virtual*/ LLGLTexture* getFetchedTexture(const LLUUID &image_id)
+ {
+ return LLViewerTextureManager::getFetchedTexture(image_id);
+ }
};
void LLViewerTextureManager::init()
{
- {
- LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,3);
- raw->clear(0x77, 0x77, 0x77, 0xFF);
- LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE);
- }
+ {
+ LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,3);
+ raw->clear(0x77, 0x77, 0x77, 0xFF);
+ LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE);
+ }
- const S32 dim = 128;
- LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3);
- U8* data = image_raw->getData();
-
- memset(data, 0, dim * dim * 3);
- LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE);
+ const S32 dim = 128;
+ LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3);
+ U8* data = image_raw->getData();
+
+ memset(data, 0, dim * dim * 3);
+ LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE);
#if 1
- LLPointer<LLViewerFetchedTexture> imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT);
- LLViewerFetchedTexture::sDefaultImagep = imagep;
-
- for (S32 i = 0; i<dim; i++)
- {
- for (S32 j = 0; j<dim; j++)
- {
+ LLPointer<LLViewerFetchedTexture> imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT);
+ LLViewerFetchedTexture::sDefaultImagep = imagep;
+
+ for (S32 i = 0; i<dim; i++)
+ {
+ for (S32 j = 0; j<dim; j++)
+ {
#if 0
- const S32 border = 2;
- if (i<border || j<border || i>=(dim-border) || j>=(dim-border))
- {
- *data++ = 0xff;
- *data++ = 0xff;
- *data++ = 0xff;
- }
- else
+ const S32 border = 2;
+ if (i<border || j<border || i>=(dim-border) || j>=(dim-border))
+ {
+ *data++ = 0xff;
+ *data++ = 0xff;
+ *data++ = 0xff;
+ }
+ else
#endif
- {
- *data++ = 0x7f;
- *data++ = 0x7f;
- *data++ = 0x7f;
- }
- }
- }
- imagep->createGLTexture(0, image_raw);
- //cache the raw image
- imagep->setCachedRawImage(0, image_raw);
- image_raw = NULL;
+ {
+ *data++ = 0x7f;
+ *data++ = 0x7f;
+ *data++ = 0x7f;
+ }
+ }
+ }
+ imagep->createGLTexture(0, image_raw);
+ //cache the raw image
+ imagep->setCachedRawImage(0, image_raw);
+ image_raw = NULL;
#else
- LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
+ LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
#endif
- LLViewerFetchedTexture::sDefaultImagep->dontDiscard();
- LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER);
-
- image_raw = new LLImageRaw(32,32,3);
- data = image_raw->getData();
-
- for (S32 i = 0; i < (32*32*3); i+=3)
- {
- S32 x = (i % (32*3)) / (3*16);
- S32 y = i / (32*3*16);
- U8 color = ((x + y) % 2) * 255;
- data[i] = color;
- data[i+1] = color;
- data[i+2] = color;
- }
-
- LLViewerTexture::sCheckerBoardImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE);
-
- LLViewerTexture::initClass();
-
- // Create a texture manager bridge.
- gTextureManagerBridgep = new LLViewerTextureManagerBridge;
-
- if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName))
- {
- sTesterp = new LLTexturePipelineTester();
- if (!sTesterp->isValid())
- {
- delete sTesterp;
- sTesterp = NULL;
- }
- }
+ LLViewerFetchedTexture::sDefaultImagep->dontDiscard();
+ LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER);
+
+ image_raw = new LLImageRaw(32,32,3);
+ data = image_raw->getData();
+
+ for (S32 i = 0; i < (32*32*3); i+=3)
+ {
+ S32 x = (i % (32*3)) / (3*16);
+ S32 y = i / (32*3*16);
+ U8 color = ((x + y) % 2) * 255;
+ data[i] = color;
+ data[i+1] = color;
+ data[i+2] = color;
+ }
+
+ LLViewerTexture::sCheckerBoardImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE);
+
+ LLViewerTexture::initClass();
+
+ // Create a texture manager bridge.
+ gTextureManagerBridgep = new LLViewerTextureManagerBridge;
+
+ if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName))
+ {
+ sTesterp = new LLTexturePipelineTester();
+ if (!sTesterp->isValid())
+ {
+ delete sTesterp;
+ sTesterp = NULL;
+ }
+ }
}
void LLViewerTextureManager::cleanup()
{
- stop_glerror();
+ stop_glerror();
- delete gTextureManagerBridgep;
- LLImageGL::sDefaultGLTexture = NULL;
- LLViewerTexture::sNullImagep = NULL;
- LLViewerTexture::sBlackImagep = NULL;
- LLViewerTexture::sCheckerBoardImagep = NULL;
- LLViewerFetchedTexture::sDefaultImagep = NULL;
- LLViewerFetchedTexture::sSmokeImagep = NULL;
- LLViewerFetchedTexture::sMissingAssetImagep = NULL;
- LLTexUnit::sWhiteTexture = 0;
- LLViewerFetchedTexture::sWhiteImagep = NULL;
-
- LLViewerFetchedTexture::sFlatNormalImagep = NULL;
- LLViewerFetchedTexture::sDefaultIrradiancePBRp = NULL;
+ delete gTextureManagerBridgep;
+ LLImageGL::sDefaultGLTexture = NULL;
+ LLViewerTexture::sNullImagep = NULL;
+ LLViewerTexture::sBlackImagep = NULL;
+ LLViewerTexture::sCheckerBoardImagep = NULL;
+ LLViewerFetchedTexture::sDefaultImagep = NULL;
+ LLViewerFetchedTexture::sSmokeImagep = NULL;
+ LLViewerFetchedTexture::sMissingAssetImagep = NULL;
+ LLTexUnit::sWhiteTexture = 0;
+ LLViewerFetchedTexture::sWhiteImagep = NULL;
- LLViewerMediaTexture::cleanUpClass();
+ LLViewerFetchedTexture::sFlatNormalImagep = NULL;
+ LLViewerFetchedTexture::sDefaultIrradiancePBRp = NULL;
+
+ LLViewerMediaTexture::cleanUpClass();
}
//----------------------------------------------------------------------------------------------
@@ -464,7 +464,7 @@ void LLViewerTextureManager::cleanup()
// static
void LLViewerTexture::initClass()
{
- LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture();
+ LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture();
}
// tuning params
@@ -473,7 +473,7 @@ const F32 GPU_MEMORY_CHECK_WAIT_TIME = 1.0f;
F32 texmem_lower_bound_scale = 0.85f;
F32 texmem_middle_bound_scale = 0.925f;
-//static
+//static
bool LLViewerTexture::isMemoryForTextureLow()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
@@ -498,7 +498,7 @@ void LLViewerTexture::getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &p
static S32Megabytes gpu_res = S32Megabytes(S32_MAX);
static S32Megabytes physical_res = S32Megabytes(S32_MAX);
-
+
if (timer.getElapsedTimeF32() < GPU_MEMORY_CHECK_WAIT_TIME) //call this once per second.
{
gpu = gpu_res;
@@ -509,7 +509,7 @@ void LLViewerTexture::getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &p
{
gpu_res = (S32Megabytes)gViewerWindow->getWindow()->getAvailableVRAMMegabytes();
-
+
//check main memory, only works for windows and macos.
LLMemory::updateMemoryInfo();
physical_res = LLMemory::getAvailableMemKB();
@@ -523,25 +523,25 @@ void LLViewerTexture::getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &p
void LLViewerTexture::updateClass()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- sCurrentTime = gFrameTimeSeconds;
+ sCurrentTime = gFrameTimeSeconds;
- LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
- if (tester)
- {
- tester->update();
- }
+ LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
+ if (tester)
+ {
+ tester->update();
+ }
- LLViewerMediaTexture::updateClass();
+ LLViewerMediaTexture::updateClass();
static LLCachedControl<U32> max_vram_budget(gSavedSettings, "RenderMaxVRAMBudget", 0);
- F64 texture_bytes_alloc = LLImageGL::getTextureBytesAllocated() / 1024.0 / 512.0;
- F64 vertex_bytes_alloc = LLVertexBuffer::getBytesAllocated() / 1024.0 / 512.0;
+ F64 texture_bytes_alloc = LLImageGL::getTextureBytesAllocated() / 1024.0 / 512.0;
+ F64 vertex_bytes_alloc = LLVertexBuffer::getBytesAllocated() / 1024.0 / 512.0;
- // get an estimate of how much video memory we're using
+ // get an estimate of how much video memory we're using
// NOTE: our metrics miss about half the vram we use, so this biases high but turns out to typically be within 5% of the real number
- F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc);
-
+ F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc);
+
F32 budget = max_vram_budget == 0 ? gGLManager.mVRAM : max_vram_budget;
// try to leave half a GB for everyone else, but keep at least 768MB for ourselves
@@ -563,75 +563,75 @@ void LLViewerTexture::updateClass()
const U32 LLViewerTexture::sCurrentFileVersion = 1;
LLViewerTexture::LLViewerTexture(BOOL usemipmaps) :
- LLGLTexture(usemipmaps)
+ LLGLTexture(usemipmaps)
{
- init(true);
+ init(true);
- mID.generate();
- sImageCount++;
+ mID.generate();
+ sImageCount++;
}
LLViewerTexture::LLViewerTexture(const LLUUID& id, BOOL usemipmaps) :
- LLGLTexture(usemipmaps),
- mID(id)
+ LLGLTexture(usemipmaps),
+ mID(id)
{
- init(true);
-
- sImageCount++;
+ init(true);
+
+ sImageCount++;
}
LLViewerTexture::LLViewerTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) :
- LLGLTexture(width, height, components, usemipmaps)
+ LLGLTexture(width, height, components, usemipmaps)
{
- init(true);
+ init(true);
- mID.generate();
- sImageCount++;
+ mID.generate();
+ sImageCount++;
}
LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) :
- LLGLTexture(raw, usemipmaps)
+ LLGLTexture(raw, usemipmaps)
{
- init(true);
-
- mID.generate();
- sImageCount++;
+ init(true);
+
+ mID.generate();
+ sImageCount++;
}
LLViewerTexture::~LLViewerTexture()
{
- // LL_DEBUGS("Avatar") << mID << LL_ENDL;
- cleanup();
- sImageCount--;
+ // LL_DEBUGS("Avatar") << mID << LL_ENDL;
+ cleanup();
+ sImageCount--;
}
// virtual
void LLViewerTexture::init(bool firstinit)
{
- mMaxVirtualSize = 0.f;
- mMaxVirtualSizeResetInterval = 1;
- mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval;
- mParcelMedia = NULL;
-
- memset(&mNumVolumes, 0, sizeof(U32)* LLRender::NUM_VOLUME_TEXTURE_CHANNELS);
- mFaceList[LLRender::DIFFUSE_MAP].clear();
- mFaceList[LLRender::NORMAL_MAP].clear();
- mFaceList[LLRender::SPECULAR_MAP].clear();
- mNumFaces[LLRender::DIFFUSE_MAP] =
- mNumFaces[LLRender::NORMAL_MAP] =
- mNumFaces[LLRender::SPECULAR_MAP] = 0;
-
- mVolumeList[LLRender::LIGHT_TEX].clear();
- mVolumeList[LLRender::SCULPT_TEX].clear();
-
- mMainQueue = LL::WorkQueue::getInstance("mainloop");
- mImageQueue = LL::WorkQueue::getInstance("LLImageGL");
-}
-
-//virtual
+ mMaxVirtualSize = 0.f;
+ mMaxVirtualSizeResetInterval = 1;
+ mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval;
+ mParcelMedia = NULL;
+
+ memset(&mNumVolumes, 0, sizeof(U32)* LLRender::NUM_VOLUME_TEXTURE_CHANNELS);
+ mFaceList[LLRender::DIFFUSE_MAP].clear();
+ mFaceList[LLRender::NORMAL_MAP].clear();
+ mFaceList[LLRender::SPECULAR_MAP].clear();
+ mNumFaces[LLRender::DIFFUSE_MAP] =
+ mNumFaces[LLRender::NORMAL_MAP] =
+ mNumFaces[LLRender::SPECULAR_MAP] = 0;
+
+ mVolumeList[LLRender::LIGHT_TEX].clear();
+ mVolumeList[LLRender::SCULPT_TEX].clear();
+
+ mMainQueue = LL::WorkQueue::getInstance("mainloop");
+ mImageQueue = LL::WorkQueue::getInstance("LLImageGL");
+}
+
+//virtual
S8 LLViewerTexture::getType() const
{
- return LLViewerTexture::LOCAL_TEXTURE;
+ return LLViewerTexture::LOCAL_TEXTURE;
}
void LLViewerTexture::cleanup()
@@ -641,37 +641,37 @@ void LLViewerTexture::cleanup()
LLAppViewer::getTextureFetch()->updateRequestPriority(mID, 0.f);
}
- mFaceList[LLRender::DIFFUSE_MAP].clear();
- mFaceList[LLRender::NORMAL_MAP].clear();
- mFaceList[LLRender::SPECULAR_MAP].clear();
- mVolumeList[LLRender::LIGHT_TEX].clear();
- mVolumeList[LLRender::SCULPT_TEX].clear();
+ mFaceList[LLRender::DIFFUSE_MAP].clear();
+ mFaceList[LLRender::NORMAL_MAP].clear();
+ mFaceList[LLRender::SPECULAR_MAP].clear();
+ mVolumeList[LLRender::LIGHT_TEX].clear();
+ mVolumeList[LLRender::SCULPT_TEX].clear();
}
// virtual
void LLViewerTexture::dump()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- LLGLTexture::dump();
+ LLGLTexture::dump();
- LL_INFOS() << "LLViewerTexture"
- << " mID " << mID
- << LL_ENDL;
+ LL_INFOS() << "LLViewerTexture"
+ << " mID " << mID
+ << LL_ENDL;
}
void LLViewerTexture::setBoostLevel(S32 level)
{
- if(mBoostLevel != level)
- {
- mBoostLevel = level;
- if(mBoostLevel != LLViewerTexture::BOOST_NONE &&
- mBoostLevel != LLViewerTexture::BOOST_SELECTED &&
- mBoostLevel != LLViewerTexture::BOOST_ICON &&
+ if(mBoostLevel != level)
+ {
+ mBoostLevel = level;
+ if(mBoostLevel != LLViewerTexture::BOOST_NONE &&
+ mBoostLevel != LLViewerTexture::BOOST_SELECTED &&
+ mBoostLevel != LLViewerTexture::BOOST_ICON &&
mBoostLevel != LLViewerTexture::BOOST_THUMBNAIL)
- {
- setNoDelete();
- }
- }
+ {
+ setNoDelete();
+ }
+ }
// strongly encourage anything boosted to load at full res
if (mBoostLevel >= LLViewerTexture::BOOST_HIGH)
@@ -682,159 +682,159 @@ void LLViewerTexture::setBoostLevel(S32 level)
bool LLViewerTexture::isActiveFetching()
{
- return false;
+ return false;
}
bool LLViewerTexture::bindDebugImage(const S32 stage)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (stage < 0) return false;
+ if (stage < 0) return false;
- bool res = true;
- if (LLViewerTexture::sCheckerBoardImagep.notNull() && (this != LLViewerTexture::sCheckerBoardImagep.get()))
- {
- res = gGL.getTexUnit(stage)->bind(LLViewerTexture::sCheckerBoardImagep);
- }
+ bool res = true;
+ if (LLViewerTexture::sCheckerBoardImagep.notNull() && (this != LLViewerTexture::sCheckerBoardImagep.get()))
+ {
+ res = gGL.getTexUnit(stage)->bind(LLViewerTexture::sCheckerBoardImagep);
+ }
- if(!res)
- {
- return bindDefaultImage(stage);
- }
+ if(!res)
+ {
+ return bindDefaultImage(stage);
+ }
- return res;
+ return res;
}
-bool LLViewerTexture::bindDefaultImage(S32 stage)
+bool LLViewerTexture::bindDefaultImage(S32 stage)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (stage < 0) return false;
+ if (stage < 0) return false;
- bool res = true;
- if (LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get()))
- {
- // use default if we've got it
- res = gGL.getTexUnit(stage)->bind(LLViewerFetchedTexture::sDefaultImagep);
- }
- if (!res && LLViewerTexture::sNullImagep.notNull() && (this != LLViewerTexture::sNullImagep))
- {
- res = gGL.getTexUnit(stage)->bind(LLViewerTexture::sNullImagep);
- }
- if (!res)
- {
- LL_WARNS() << "LLViewerTexture::bindDefaultImage failed." << LL_ENDL;
- }
- stop_glerror();
+ bool res = true;
+ if (LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get()))
+ {
+ // use default if we've got it
+ res = gGL.getTexUnit(stage)->bind(LLViewerFetchedTexture::sDefaultImagep);
+ }
+ if (!res && LLViewerTexture::sNullImagep.notNull() && (this != LLViewerTexture::sNullImagep))
+ {
+ res = gGL.getTexUnit(stage)->bind(LLViewerTexture::sNullImagep);
+ }
+ if (!res)
+ {
+ LL_WARNS() << "LLViewerTexture::bindDefaultImage failed." << LL_ENDL;
+ }
+ stop_glerror();
- //check if there is cached raw image and switch to it if possible
- switchToCachedImage();
+ //check if there is cached raw image and switch to it if possible
+ switchToCachedImage();
- LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
- if (tester)
- {
- tester->updateGrayTextureBinding();
- }
- return res;
+ LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
+ if (tester)
+ {
+ tester->updateGrayTextureBinding();
+ }
+ return res;
}
-//virtual
-BOOL LLViewerTexture::isMissingAsset()const
-{
- return FALSE;
+//virtual
+BOOL LLViewerTexture::isMissingAsset()const
+{
+ return FALSE;
}
-//virtual
-void LLViewerTexture::forceImmediateUpdate()
+//virtual
+void LLViewerTexture::forceImmediateUpdate()
{
}
-void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) const
+void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(needs_gltexture)
- {
- mNeedsGLTexture = TRUE;
- }
+ if(needs_gltexture)
+ {
+ mNeedsGLTexture = TRUE;
+ }
virtual_size = llmin(virtual_size, LLViewerFetchedTexture::sMaxVirtualSize);
- if (virtual_size > mMaxVirtualSize)
- {
- mMaxVirtualSize = virtual_size;
- }
+ if (virtual_size > mMaxVirtualSize)
+ {
+ mMaxVirtualSize = virtual_size;
+ }
}
void LLViewerTexture::resetTextureStats()
{
- mMaxVirtualSize = 0.0f;
- mMaxVirtualSizeResetCounter = 0;
+ mMaxVirtualSize = 0.0f;
+ mMaxVirtualSizeResetCounter = 0;
}
-//virtual
+//virtual
F32 LLViewerTexture::getMaxVirtualSize()
{
- return mMaxVirtualSize;
+ return mMaxVirtualSize;
}
-//virtual
+//virtual
void LLViewerTexture::setKnownDrawSize(S32 width, S32 height)
{
- //nothing here.
+ //nothing here.
}
//virtual
-void LLViewerTexture::addFace(U32 ch, LLFace* facep)
+void LLViewerTexture::addFace(U32 ch, LLFace* facep)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
- if(mNumFaces[ch] >= mFaceList[ch].size())
- {
- mFaceList[ch].resize(2 * mNumFaces[ch] + 1);
- }
- mFaceList[ch][mNumFaces[ch]] = facep;
- facep->setIndexInTex(ch, mNumFaces[ch]);
- mNumFaces[ch]++;
- mLastFaceListUpdateTimer.reset();
+ if(mNumFaces[ch] >= mFaceList[ch].size())
+ {
+ mFaceList[ch].resize(2 * mNumFaces[ch] + 1);
+ }
+ mFaceList[ch][mNumFaces[ch]] = facep;
+ facep->setIndexInTex(ch, mNumFaces[ch]);
+ mNumFaces[ch]++;
+ mLastFaceListUpdateTimer.reset();
}
//virtual
-void LLViewerTexture::removeFace(U32 ch, LLFace* facep)
+void LLViewerTexture::removeFace(U32 ch, LLFace* facep)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
-
- if(mNumFaces[ch] > 1)
- {
- S32 index = facep->getIndexInTex(ch);
- llassert(index < mFaceList[ch].size());
- llassert(index < mNumFaces[ch]);
- mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]];
- mFaceList[ch][index]->setIndexInTex(ch, index);
- }
- else
- {
- mFaceList[ch].clear();
- mNumFaces[ch] = 0;
- }
- mLastFaceListUpdateTimer.reset();
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+
+ if(mNumFaces[ch] > 1)
+ {
+ S32 index = facep->getIndexInTex(ch);
+ llassert(index < mFaceList[ch].size());
+ llassert(index < mNumFaces[ch]);
+ mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]];
+ mFaceList[ch][index]->setIndexInTex(ch, index);
+ }
+ else
+ {
+ mFaceList[ch].clear();
+ mNumFaces[ch] = 0;
+ }
+ mLastFaceListUpdateTimer.reset();
}
S32 LLViewerTexture::getTotalNumFaces() const
{
- S32 ret = 0;
+ S32 ret = 0;
- for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
- {
- ret += mNumFaces[i];
- }
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
+ {
+ ret += mNumFaces[i];
+ }
- return ret;
+ return ret;
}
S32 LLViewerTexture::getNumFaces(U32 ch) const
{
- llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
- return mNumFaces[ch];
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+ return mNumFaces[ch];
}
@@ -842,117 +842,117 @@ S32 LLViewerTexture::getNumFaces(U32 ch) const
void LLViewerTexture::addVolume(U32 ch, LLVOVolume* volumep)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (mNumVolumes[ch] >= mVolumeList[ch].size())
- {
- mVolumeList[ch].resize(2 * mNumVolumes[ch] + 1);
- }
- mVolumeList[ch][mNumVolumes[ch]] = volumep;
- volumep->setIndexInTex(ch, mNumVolumes[ch]);
- mNumVolumes[ch]++;
- mLastVolumeListUpdateTimer.reset();
+ if (mNumVolumes[ch] >= mVolumeList[ch].size())
+ {
+ mVolumeList[ch].resize(2 * mNumVolumes[ch] + 1);
+ }
+ mVolumeList[ch][mNumVolumes[ch]] = volumep;
+ volumep->setIndexInTex(ch, mNumVolumes[ch]);
+ mNumVolumes[ch]++;
+ mLastVolumeListUpdateTimer.reset();
}
//virtual
void LLViewerTexture::removeVolume(U32 ch, LLVOVolume* volumep)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (mNumVolumes[ch] > 1)
- {
- S32 index = volumep->getIndexInTex(ch);
- llassert(index < mVolumeList[ch].size());
- llassert(index < mNumVolumes[ch]);
- mVolumeList[ch][index] = mVolumeList[ch][--mNumVolumes[ch]];
- mVolumeList[ch][index]->setIndexInTex(ch, index);
- }
- else
- {
- mVolumeList[ch].clear();
- mNumVolumes[ch] = 0;
- }
- mLastVolumeListUpdateTimer.reset();
+ if (mNumVolumes[ch] > 1)
+ {
+ S32 index = volumep->getIndexInTex(ch);
+ llassert(index < mVolumeList[ch].size());
+ llassert(index < mNumVolumes[ch]);
+ mVolumeList[ch][index] = mVolumeList[ch][--mNumVolumes[ch]];
+ mVolumeList[ch][index]->setIndexInTex(ch, index);
+ }
+ else
+ {
+ mVolumeList[ch].clear();
+ mNumVolumes[ch] = 0;
+ }
+ mLastVolumeListUpdateTimer.reset();
}
S32 LLViewerTexture::getNumVolumes(U32 ch) const
{
- return mNumVolumes[ch];
+ return mNumVolumes[ch];
}
void LLViewerTexture::reorganizeFaceList()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- static const F32 MAX_WAIT_TIME = 20.f; // seconds
- static const U32 MAX_EXTRA_BUFFER_SIZE = 4;
+ static const F32 MAX_WAIT_TIME = 20.f; // seconds
+ static const U32 MAX_EXTRA_BUFFER_SIZE = 4;
+
+ if(mLastFaceListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
+ {
+ return;
+ }
- if(mLastFaceListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
- {
- return;
- }
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
+ {
+ if(mNumFaces[i] + MAX_EXTRA_BUFFER_SIZE > mFaceList[i].size())
+ {
+ return;
+ }
- for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
- {
- if(mNumFaces[i] + MAX_EXTRA_BUFFER_SIZE > mFaceList[i].size())
- {
- return;
- }
+ mFaceList[i].erase(mFaceList[i].begin() + mNumFaces[i], mFaceList[i].end());
+ }
- mFaceList[i].erase(mFaceList[i].begin() + mNumFaces[i], mFaceList[i].end());
- }
-
- mLastFaceListUpdateTimer.reset();
+ mLastFaceListUpdateTimer.reset();
}
void LLViewerTexture::reorganizeVolumeList()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- static const F32 MAX_WAIT_TIME = 20.f; // seconds
- static const U32 MAX_EXTRA_BUFFER_SIZE = 4;
+ static const F32 MAX_WAIT_TIME = 20.f; // seconds
+ static const U32 MAX_EXTRA_BUFFER_SIZE = 4;
- for (U32 i = 0; i < LLRender::NUM_VOLUME_TEXTURE_CHANNELS; ++i)
- {
- if (mNumVolumes[i] + MAX_EXTRA_BUFFER_SIZE > mVolumeList[i].size())
- {
- return;
- }
- }
+ for (U32 i = 0; i < LLRender::NUM_VOLUME_TEXTURE_CHANNELS; ++i)
+ {
+ if (mNumVolumes[i] + MAX_EXTRA_BUFFER_SIZE > mVolumeList[i].size())
+ {
+ return;
+ }
+ }
- if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
- {
- return;
- }
+ if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
+ {
+ return;
+ }
- mLastVolumeListUpdateTimer.reset();
- for (U32 i = 0; i < LLRender::NUM_VOLUME_TEXTURE_CHANNELS; ++i)
- {
- mVolumeList[i].erase(mVolumeList[i].begin() + mNumVolumes[i], mVolumeList[i].end());
- }
+ mLastVolumeListUpdateTimer.reset();
+ for (U32 i = 0; i < LLRender::NUM_VOLUME_TEXTURE_CHANNELS; ++i)
+ {
+ mVolumeList[i].erase(mVolumeList[i].begin() + mNumVolumes[i], mVolumeList[i].end());
+ }
}
//virtual
void LLViewerTexture::switchToCachedImage()
{
- //nothing here.
+ //nothing here.
}
//virtual
void LLViewerTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw)
{
- //nothing here.
+ //nothing here.
}
BOOL LLViewerTexture::isLargeImage()
{
- return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize;
+ return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize;
}
-//virtual
+//virtual
void LLViewerTexture::updateBindStatsForTester()
{
- LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
- if (tester)
- {
- tester->updateTextureBindingStats(this);
- }
+ LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
+ if (tester)
+ {
+ tester->updateTextureBindingStats(this);
+ }
}
//----------------------------------------------------------------------------------------------
@@ -961,30 +961,30 @@ void LLViewerTexture::updateBindStatsForTester()
const std::string& fttype_to_string(const FTType& fttype)
{
- static const std::string ftt_unknown("FTT_UNKNOWN");
- static const std::string ftt_default("FTT_DEFAULT");
- static const std::string ftt_server_bake("FTT_SERVER_BAKE");
- static const std::string ftt_host_bake("FTT_HOST_BAKE");
- static const std::string ftt_map_tile("FTT_MAP_TILE");
- static const std::string ftt_local_file("FTT_LOCAL_FILE");
- static const std::string ftt_error("FTT_ERROR");
- switch(fttype)
- {
- case FTT_UNKNOWN: return ftt_unknown; break;
- case FTT_DEFAULT: return ftt_default; break;
- case FTT_SERVER_BAKE: return ftt_server_bake; break;
- case FTT_HOST_BAKE: return ftt_host_bake; break;
- case FTT_MAP_TILE: return ftt_map_tile; break;
- case FTT_LOCAL_FILE: return ftt_local_file; break;
- }
- return ftt_error;
+ static const std::string ftt_unknown("FTT_UNKNOWN");
+ static const std::string ftt_default("FTT_DEFAULT");
+ static const std::string ftt_server_bake("FTT_SERVER_BAKE");
+ static const std::string ftt_host_bake("FTT_HOST_BAKE");
+ static const std::string ftt_map_tile("FTT_MAP_TILE");
+ static const std::string ftt_local_file("FTT_LOCAL_FILE");
+ static const std::string ftt_error("FTT_ERROR");
+ switch(fttype)
+ {
+ case FTT_UNKNOWN: return ftt_unknown; break;
+ case FTT_DEFAULT: return ftt_default; break;
+ case FTT_SERVER_BAKE: return ftt_server_bake; break;
+ case FTT_HOST_BAKE: return ftt_host_bake; break;
+ case FTT_MAP_TILE: return ftt_map_tile; break;
+ case FTT_LOCAL_FILE: return ftt_local_file; break;
+ }
+ return ftt_error;
}
//----------------------------------------------------------------------------------------------
//start of LLViewerFetchedTexture
//----------------------------------------------------------------------------------------------
-//static
+//static
LLViewerFetchedTexture* LLViewerFetchedTexture::getSmokeImage()
{
if (sSmokeImagep.isNull())
@@ -998,186 +998,186 @@ LLViewerFetchedTexture* LLViewerFetchedTexture::getSmokeImage()
}
LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host, BOOL usemipmaps)
- : LLViewerTexture(id, usemipmaps),
- mTargetHost(host)
-{
- init(TRUE);
- mFTType = f_type;
- if (mFTType == FTT_HOST_BAKE)
- {
- LL_WARNS() << "Unsupported fetch type " << mFTType << LL_ENDL;
- }
- generateGLTexture();
-}
-
+ : LLViewerTexture(id, usemipmaps),
+ mTargetHost(host)
+{
+ init(TRUE);
+ mFTType = f_type;
+ if (mFTType == FTT_HOST_BAKE)
+ {
+ LL_WARNS() << "Unsupported fetch type " << mFTType << LL_ENDL;
+ }
+ generateGLTexture();
+}
+
LLViewerFetchedTexture::LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps)
- : LLViewerTexture(raw, usemipmaps)
+ : LLViewerTexture(raw, usemipmaps)
{
- init(TRUE);
- mFTType = f_type;
+ init(TRUE);
+ mFTType = f_type;
}
-
+
LLViewerFetchedTexture::LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps)
- : LLViewerTexture(id, usemipmaps),
- mUrl(url)
+ : LLViewerTexture(id, usemipmaps),
+ mUrl(url)
{
- init(TRUE);
- mFTType = f_type;
- generateGLTexture();
+ init(TRUE);
+ mFTType = f_type;
+ generateGLTexture();
}
void LLViewerFetchedTexture::init(bool firstinit)
{
- mOrigWidth = 0;
- mOrigHeight = 0;
- mHasAux = FALSE;
- mNeedsAux = FALSE;
- mRequestedDiscardLevel = -1;
- mRequestedDownloadPriority = 0.f;
- mFullyLoaded = FALSE;
- mCanUseHTTP = true;
- mDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
- mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
-
- mDecodingAux = FALSE;
-
- mKnownDrawWidth = 0;
- mKnownDrawHeight = 0;
- mKnownDrawSizeChanged = FALSE;
-
- if (firstinit)
- {
- mInImageList = 0;
- }
-
- // Only set mIsMissingAsset true when we know for certain that the database
- // does not contain this image.
- mIsMissingAsset = FALSE;
-
- mLoadedCallbackDesiredDiscardLevel = S8_MAX;
- mPauseLoadedCallBacks = FALSE;
-
- mNeedsCreateTexture = false;
-
- mIsRawImageValid = FALSE;
- mRawDiscardLevel = INVALID_DISCARD_LEVEL;
- mMinDiscardLevel = 0;
-
- mHasFetcher = FALSE;
- mIsFetching = FALSE;
- mFetchState = 0;
- mFetchPriority = 0;
- mDownloadProgress = 0.f;
- mFetchDeltaTime = 999999.f;
- mRequestDeltaTime = 0.f;
- mForSculpt = FALSE;
- mIsFetched = FALSE;
- mInFastCacheList = FALSE;
-
- mCachedRawImage = NULL;
- mCachedRawDiscardLevel = -1;
- mCachedRawImageReady = FALSE;
-
- mSavedRawImage = NULL;
- mForceToSaveRawImage = FALSE;
- mSaveRawImage = FALSE;
- mSavedRawDiscardLevel = -1;
- mDesiredSavedRawDiscardLevel = -1;
- mLastReferencedSavedRawImageTime = 0.0f;
- mKeptSavedRawImageTime = 0.f;
- mLastCallBackActiveTime = 0.f;
- mForceCallbackFetch = FALSE;
- mInDebug = FALSE;
- mUnremovable = FALSE;
-
- mFTType = FTT_UNKNOWN;
+ mOrigWidth = 0;
+ mOrigHeight = 0;
+ mHasAux = FALSE;
+ mNeedsAux = FALSE;
+ mRequestedDiscardLevel = -1;
+ mRequestedDownloadPriority = 0.f;
+ mFullyLoaded = FALSE;
+ mCanUseHTTP = true;
+ mDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
+ mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
+
+ mDecodingAux = FALSE;
+
+ mKnownDrawWidth = 0;
+ mKnownDrawHeight = 0;
+ mKnownDrawSizeChanged = FALSE;
+
+ if (firstinit)
+ {
+ mInImageList = 0;
+ }
+
+ // Only set mIsMissingAsset true when we know for certain that the database
+ // does not contain this image.
+ mIsMissingAsset = FALSE;
+
+ mLoadedCallbackDesiredDiscardLevel = S8_MAX;
+ mPauseLoadedCallBacks = FALSE;
+
+ mNeedsCreateTexture = false;
+
+ mIsRawImageValid = FALSE;
+ mRawDiscardLevel = INVALID_DISCARD_LEVEL;
+ mMinDiscardLevel = 0;
+
+ mHasFetcher = FALSE;
+ mIsFetching = FALSE;
+ mFetchState = 0;
+ mFetchPriority = 0;
+ mDownloadProgress = 0.f;
+ mFetchDeltaTime = 999999.f;
+ mRequestDeltaTime = 0.f;
+ mForSculpt = FALSE;
+ mIsFetched = FALSE;
+ mInFastCacheList = FALSE;
+
+ mCachedRawImage = NULL;
+ mCachedRawDiscardLevel = -1;
+ mCachedRawImageReady = FALSE;
+
+ mSavedRawImage = NULL;
+ mForceToSaveRawImage = FALSE;
+ mSaveRawImage = FALSE;
+ mSavedRawDiscardLevel = -1;
+ mDesiredSavedRawDiscardLevel = -1;
+ mLastReferencedSavedRawImageTime = 0.0f;
+ mKeptSavedRawImageTime = 0.f;
+ mLastCallBackActiveTime = 0.f;
+ mForceCallbackFetch = FALSE;
+ mInDebug = FALSE;
+ mUnremovable = FALSE;
+
+ mFTType = FTT_UNKNOWN;
}
LLViewerFetchedTexture::~LLViewerFetchedTexture()
{
assert_main_thread();
- //*NOTE getTextureFetch can return NULL when Viewer is shutting down.
- // This is due to LLWearableList is singleton and is destroyed after
- // LLAppViewer::cleanup() was called. (see ticket EXT-177)
- if (mHasFetcher && LLAppViewer::getTextureFetch())
- {
- LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
- }
- cleanup();
+ //*NOTE getTextureFetch can return NULL when Viewer is shutting down.
+ // This is due to LLWearableList is singleton and is destroyed after
+ // LLAppViewer::cleanup() was called. (see ticket EXT-177)
+ if (mHasFetcher && LLAppViewer::getTextureFetch())
+ {
+ LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
+ }
+ cleanup();
}
-//virtual
+//virtual
S8 LLViewerFetchedTexture::getType() const
{
- return LLViewerTexture::FETCHED_TEXTURE;
+ return LLViewerTexture::FETCHED_TEXTURE;
}
FTType LLViewerFetchedTexture::getFTType() const
{
- return mFTType;
+ return mFTType;
}
void LLViewerFetchedTexture::cleanup()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
- iter != mLoadedCallbackList.end(); )
- {
- LLLoadedCallbackEntry *entryp = *iter++;
- // We never finished loading the image. Indicate failure.
- // Note: this allows mLoadedCallbackUserData to be cleaned up.
- entryp->mCallback( FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData );
- entryp->removeTexture(this);
- delete entryp;
- }
- mLoadedCallbackList.clear();
- mNeedsAux = FALSE;
-
- // Clean up image data
- destroyRawImage();
- mCachedRawImage = NULL;
- mCachedRawDiscardLevel = -1;
- mCachedRawImageReady = FALSE;
- mSavedRawImage = NULL;
- mSavedRawDiscardLevel = -1;
+ for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+ iter != mLoadedCallbackList.end(); )
+ {
+ LLLoadedCallbackEntry *entryp = *iter++;
+ // We never finished loading the image. Indicate failure.
+ // Note: this allows mLoadedCallbackUserData to be cleaned up.
+ entryp->mCallback( FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData );
+ entryp->removeTexture(this);
+ delete entryp;
+ }
+ mLoadedCallbackList.clear();
+ mNeedsAux = FALSE;
+
+ // Clean up image data
+ destroyRawImage();
+ mCachedRawImage = NULL;
+ mCachedRawDiscardLevel = -1;
+ mCachedRawImageReady = FALSE;
+ mSavedRawImage = NULL;
+ mSavedRawDiscardLevel = -1;
}
//access the fast cache
void LLViewerFetchedTexture::loadFromFastCache()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(!mInFastCacheList)
- {
- return; //no need to access the fast cache.
- }
- mInFastCacheList = FALSE;
+ if(!mInFastCacheList)
+ {
+ return; //no need to access the fast cache.
+ }
+ mInFastCacheList = FALSE;
add(LLTextureFetch::sCacheAttempt, 1.0);
LLTimer fastCacheTimer;
- mRawImage = LLAppViewer::getTextureCache()->readFromFastCache(getID(), mRawDiscardLevel);
- if(mRawImage.notNull())
- {
+ mRawImage = LLAppViewer::getTextureCache()->readFromFastCache(getID(), mRawDiscardLevel);
+ if(mRawImage.notNull())
+ {
F32 cachReadTime = fastCacheTimer.getElapsedTimeF32();
add(LLTextureFetch::sCacheHit, 1.0);
record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(1));
sample(LLTextureFetch::sCacheReadLatency, cachReadTime);
- mFullWidth = mRawImage->getWidth() << mRawDiscardLevel;
- mFullHeight = mRawImage->getHeight() << mRawDiscardLevel;
- setTexelsPerImage();
-
- if(mFullWidth > MAX_IMAGE_SIZE || mFullHeight > MAX_IMAGE_SIZE)
- {
- //discard all oversized textures.
- destroyRawImage();
- LL_WARNS() << "oversized, setting as missing" << LL_ENDL;
- setIsMissingAsset();
- mRawDiscardLevel = INVALID_DISCARD_LEVEL;
- }
- else
- {
+ mFullWidth = mRawImage->getWidth() << mRawDiscardLevel;
+ mFullHeight = mRawImage->getHeight() << mRawDiscardLevel;
+ setTexelsPerImage();
+
+ if(mFullWidth > MAX_IMAGE_SIZE || mFullHeight > MAX_IMAGE_SIZE)
+ {
+ //discard all oversized textures.
+ destroyRawImage();
+ LL_WARNS() << "oversized, setting as missing" << LL_ENDL;
+ setIsMissingAsset();
+ mRawDiscardLevel = INVALID_DISCARD_LEVEL;
+ }
+ else
+ {
if (mBoostLevel == LLGLTexture::BOOST_ICON)
{
// Shouldn't do anything usefull since texures in fast cache are 16x16,
@@ -1202,11 +1202,11 @@ void LLViewerFetchedTexture::loadFromFastCache()
}
}
- mRequestedDiscardLevel = mDesiredDiscardLevel + 1;
- mIsRawImageValid = TRUE;
- addToCreateTexture();
- }
- }
+ mRequestedDiscardLevel = mDesiredDiscardLevel + 1;
+ mIsRawImageValid = TRUE;
+ addToCreateTexture();
+ }
+ }
else
{
record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(0));
@@ -1215,197 +1215,197 @@ void LLViewerFetchedTexture::loadFromFastCache()
void LLViewerFetchedTexture::setForSculpt()
{
- static const S32 MAX_INTERVAL = 8; //frames
+ static const S32 MAX_INTERVAL = 8; //frames
- mForSculpt = TRUE;
- if(isForSculptOnly() && hasGLTexture() && !getBoundRecently())
- {
- destroyGLTexture(); //sculpt image does not need gl texture.
- mTextureState = ACTIVE;
- }
- checkCachedRawSculptImage();
- setMaxVirtualSizeResetInterval(MAX_INTERVAL);
+ mForSculpt = TRUE;
+ if(isForSculptOnly() && hasGLTexture() && !getBoundRecently())
+ {
+ destroyGLTexture(); //sculpt image does not need gl texture.
+ mTextureState = ACTIVE;
+ }
+ checkCachedRawSculptImage();
+ setMaxVirtualSizeResetInterval(MAX_INTERVAL);
}
BOOL LLViewerFetchedTexture::isForSculptOnly() const
{
- return mForSculpt && !mNeedsGLTexture;
+ return mForSculpt && !mNeedsGLTexture;
}
-BOOL LLViewerFetchedTexture::isDeleted()
-{
- return mTextureState == DELETED;
+BOOL LLViewerFetchedTexture::isDeleted()
+{
+ return mTextureState == DELETED;
}
-BOOL LLViewerFetchedTexture::isInactive()
-{
- return mTextureState == INACTIVE;
+BOOL LLViewerFetchedTexture::isInactive()
+{
+ return mTextureState == INACTIVE;
}
-BOOL LLViewerFetchedTexture::isDeletionCandidate()
-{
- return mTextureState == DELETION_CANDIDATE;
+BOOL LLViewerFetchedTexture::isDeletionCandidate()
+{
+ return mTextureState == DELETION_CANDIDATE;
}
-void LLViewerFetchedTexture::setDeletionCandidate()
-{
- if(mGLTexturep.notNull() && mGLTexturep->getTexName() && (mTextureState == INACTIVE))
- {
- mTextureState = DELETION_CANDIDATE;
- }
+void LLViewerFetchedTexture::setDeletionCandidate()
+{
+ if(mGLTexturep.notNull() && mGLTexturep->getTexName() && (mTextureState == INACTIVE))
+ {
+ mTextureState = DELETION_CANDIDATE;
+ }
}
//set the texture inactive
void LLViewerFetchedTexture::setInactive()
{
- if(mTextureState == ACTIVE && mGLTexturep.notNull() && mGLTexturep->getTexName() && !mGLTexturep->getBoundRecently())
- {
- mTextureState = INACTIVE;
- }
+ if(mTextureState == ACTIVE && mGLTexturep.notNull() && mGLTexturep->getTexName() && !mGLTexturep->getBoundRecently())
+ {
+ mTextureState = INACTIVE;
+ }
}
BOOL LLViewerFetchedTexture::isFullyLoaded() const
{
- // Unfortunately, the boolean "mFullyLoaded" is never updated correctly so we use that logic
- // to check if the texture is there and completely downloaded
- return (mFullWidth != 0) && (mFullHeight != 0) && !mIsFetching && !mHasFetcher;
+ // Unfortunately, the boolean "mFullyLoaded" is never updated correctly so we use that logic
+ // to check if the texture is there and completely downloaded
+ return (mFullWidth != 0) && (mFullHeight != 0) && !mIsFetching && !mHasFetcher;
}
// virtual
void LLViewerFetchedTexture::dump()
{
- LLViewerTexture::dump();
-
- LL_INFOS() << "Dump : " << mID
- << ", mIsMissingAsset = " << (S32)mIsMissingAsset
- << ", mFullWidth = " << (S32)mFullWidth
- << ", mFullHeight = " << (S32)mFullHeight
- << ", mOrigWidth = " << (S32)mOrigWidth
- << ", mOrigHeight = " << (S32)mOrigHeight
- << LL_ENDL;
- LL_INFOS() << " : "
- << " mFullyLoaded = " << (S32)mFullyLoaded
- << ", mFetchState = " << (S32)mFetchState
- << ", mFetchPriority = " << (S32)mFetchPriority
- << ", mDownloadProgress = " << (F32)mDownloadProgress
- << LL_ENDL;
- LL_INFOS() << " : "
- << " mHasFetcher = " << (S32)mHasFetcher
- << ", mIsFetching = " << (S32)mIsFetching
- << ", mIsFetched = " << (S32)mIsFetched
- << ", mBoostLevel = " << (S32)mBoostLevel
- << LL_ENDL;
+ LLViewerTexture::dump();
+
+ LL_INFOS() << "Dump : " << mID
+ << ", mIsMissingAsset = " << (S32)mIsMissingAsset
+ << ", mFullWidth = " << (S32)mFullWidth
+ << ", mFullHeight = " << (S32)mFullHeight
+ << ", mOrigWidth = " << (S32)mOrigWidth
+ << ", mOrigHeight = " << (S32)mOrigHeight
+ << LL_ENDL;
+ LL_INFOS() << " : "
+ << " mFullyLoaded = " << (S32)mFullyLoaded
+ << ", mFetchState = " << (S32)mFetchState
+ << ", mFetchPriority = " << (S32)mFetchPriority
+ << ", mDownloadProgress = " << (F32)mDownloadProgress
+ << LL_ENDL;
+ LL_INFOS() << " : "
+ << " mHasFetcher = " << (S32)mHasFetcher
+ << ", mIsFetching = " << (S32)mIsFetching
+ << ", mIsFetched = " << (S32)mIsFetched
+ << ", mBoostLevel = " << (S32)mBoostLevel
+ << LL_ENDL;
}
///////////////////////////////////////////////////////////////////////////////
// ONLY called from LLViewerFetchedTextureList
-void LLViewerFetchedTexture::destroyTexture()
+void LLViewerFetchedTexture::destroyTexture()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (mNeedsCreateTexture)//return if in the process of generating a new texture.
- {
- return;
- }
+ if (mNeedsCreateTexture)//return if in the process of generating a new texture.
+ {
+ return;
+ }
- //LL_DEBUGS("Avatar") << mID << LL_ENDL;
- destroyGLTexture();
- mFullyLoaded = FALSE;
+ //LL_DEBUGS("Avatar") << mID << LL_ENDL;
+ destroyGLTexture();
+ mFullyLoaded = FALSE;
}
void LLViewerFetchedTexture::addToCreateTexture()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- bool force_update = false;
- if (getComponents() != mRawImage->getComponents())
- {
- // We've changed the number of components, so we need to move any
- // objects using this pool to a different pool.
- mComponents = mRawImage->getComponents();
- mGLTexturep->setComponents(mComponents);
- force_update = true;
-
- for (U32 j = 0; j < LLRender::NUM_TEXTURE_CHANNELS; ++j)
- {
- llassert(mNumFaces[j] <= mFaceList[j].size());
-
- for(U32 i = 0; i < mNumFaces[j]; i++)
- {
- mFaceList[j][i]->dirtyTexture();
- }
- }
-
- //discard the cached raw image and the saved raw image
- mCachedRawImageReady = FALSE;
- mCachedRawDiscardLevel = -1;
- mCachedRawImage = NULL;
- mSavedRawDiscardLevel = -1;
- mSavedRawImage = NULL;
- }
-
- if(isForSculptOnly())
- {
- //just update some variables, not to create a real GL texture.
- createGLTexture(mRawDiscardLevel, mRawImage, 0, FALSE);
- mNeedsCreateTexture = false;
- destroyRawImage();
- }
- else if(!force_update && getDiscardLevel() > -1 && getDiscardLevel() <= mRawDiscardLevel)
- {
- mNeedsCreateTexture = false;
- destroyRawImage();
- }
- else
- {
+ bool force_update = false;
+ if (getComponents() != mRawImage->getComponents())
+ {
+ // We've changed the number of components, so we need to move any
+ // objects using this pool to a different pool.
+ mComponents = mRawImage->getComponents();
+ mGLTexturep->setComponents(mComponents);
+ force_update = true;
+
+ for (U32 j = 0; j < LLRender::NUM_TEXTURE_CHANNELS; ++j)
+ {
+ llassert(mNumFaces[j] <= mFaceList[j].size());
+
+ for(U32 i = 0; i < mNumFaces[j]; i++)
+ {
+ mFaceList[j][i]->dirtyTexture();
+ }
+ }
+
+ //discard the cached raw image and the saved raw image
+ mCachedRawImageReady = FALSE;
+ mCachedRawDiscardLevel = -1;
+ mCachedRawImage = NULL;
+ mSavedRawDiscardLevel = -1;
+ mSavedRawImage = NULL;
+ }
+
+ if(isForSculptOnly())
+ {
+ //just update some variables, not to create a real GL texture.
+ createGLTexture(mRawDiscardLevel, mRawImage, 0, FALSE);
+ mNeedsCreateTexture = false;
+ destroyRawImage();
+ }
+ else if(!force_update && getDiscardLevel() > -1 && getDiscardLevel() <= mRawDiscardLevel)
+ {
+ mNeedsCreateTexture = false;
+ destroyRawImage();
+ }
+ else
+ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
#if 1
- //
- //if mRequestedDiscardLevel > mDesiredDiscardLevel, we assume the required image res keep going up,
- //so do not scale down the over qualified image.
- //Note: scaling down image is expensensive. Do it only when very necessary.
- //
- if(mRequestedDiscardLevel <= mDesiredDiscardLevel && !mForceToSaveRawImage)
- {
- S32 w = mFullWidth >> mRawDiscardLevel;
- S32 h = mFullHeight >> mRawDiscardLevel;
-
- //if big image, do not load extra data
- //scale it down to size >= LLViewerTexture::sMinLargeImageSize
- if(w * h > LLViewerTexture::sMinLargeImageSize)
- {
- S32 d_level = llmin(mRequestedDiscardLevel, (S32)mDesiredDiscardLevel) - mRawDiscardLevel;
-
- if(d_level > 0)
- {
- S32 i = 0;
- while((d_level > 0) && ((w >> i) * (h >> i) > LLViewerTexture::sMinLargeImageSize))
- {
- i++;
- d_level--;
- }
- if(i > 0)
- {
- mRawDiscardLevel += i;
- if(mRawDiscardLevel >= getDiscardLevel() && getDiscardLevel() > 0)
- {
- mNeedsCreateTexture = false;
- destroyRawImage();
- return;
- }
-
- {
- //make a duplicate in case somebody else is using this raw image
- mRawImage = mRawImage->scaled(w >> i, h >> i);
- }
- }
- }
- }
- }
+ //
+ //if mRequestedDiscardLevel > mDesiredDiscardLevel, we assume the required image res keep going up,
+ //so do not scale down the over qualified image.
+ //Note: scaling down image is expensensive. Do it only when very necessary.
+ //
+ if(mRequestedDiscardLevel <= mDesiredDiscardLevel && !mForceToSaveRawImage)
+ {
+ S32 w = mFullWidth >> mRawDiscardLevel;
+ S32 h = mFullHeight >> mRawDiscardLevel;
+
+ //if big image, do not load extra data
+ //scale it down to size >= LLViewerTexture::sMinLargeImageSize
+ if(w * h > LLViewerTexture::sMinLargeImageSize)
+ {
+ S32 d_level = llmin(mRequestedDiscardLevel, (S32)mDesiredDiscardLevel) - mRawDiscardLevel;
+
+ if(d_level > 0)
+ {
+ S32 i = 0;
+ while((d_level > 0) && ((w >> i) * (h >> i) > LLViewerTexture::sMinLargeImageSize))
+ {
+ i++;
+ d_level--;
+ }
+ if(i > 0)
+ {
+ mRawDiscardLevel += i;
+ if(mRawDiscardLevel >= getDiscardLevel() && getDiscardLevel() > 0)
+ {
+ mNeedsCreateTexture = false;
+ destroyRawImage();
+ return;
+ }
+
+ {
+ //make a duplicate in case somebody else is using this raw image
+ mRawImage = mRawImage->scaled(w >> i, h >> i);
+ }
+ }
+ }
+ }
+ }
#endif
scheduleCreateTexture();
- }
- return;
+ }
+ return;
}
// ONLY called from LLViewerTextureList
@@ -1433,10 +1433,10 @@ BOOL LLViewerFetchedTexture::preCreateTexture(S32 usename/*= 0*/)
destroyRawImage();
return FALSE;
}
- // LL_INFOS() << llformat("IMAGE Creating (%d) [%d x %d] Bytes: %d ",
- // mRawDiscardLevel,
- // mRawImage->getWidth(), mRawImage->getHeight(),mRawImage->getDataSize())
- // << mID.getString() << LL_ENDL;
+ // LL_INFOS() << llformat("IMAGE Creating (%d) [%d x %d] Bytes: %d ",
+ // mRawDiscardLevel,
+ // mRawImage->getWidth(), mRawImage->getHeight(),mRawImage->getDataSize())
+ // << mID.getString() << LL_ENDL;
BOOL res = TRUE;
// store original size only for locally-sourced images
@@ -1532,9 +1532,9 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
return FALSE;
}
- BOOL res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel);
-
- return res;
+ BOOL res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel);
+
+ return res;
}
void LLViewerFetchedTexture::postCreateTexture()
@@ -1640,15 +1640,15 @@ void LLViewerFetchedTexture::scheduleCreateTexture()
void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(mKnownDrawWidth < width || mKnownDrawHeight < height)
- {
- mKnownDrawWidth = llmax(mKnownDrawWidth, width);
- mKnownDrawHeight = llmax(mKnownDrawHeight, height);
+ if(mKnownDrawWidth < width || mKnownDrawHeight < height)
+ {
+ mKnownDrawWidth = llmax(mKnownDrawWidth, width);
+ mKnownDrawHeight = llmax(mKnownDrawHeight, height);
- mKnownDrawSizeChanged = TRUE;
- mFullyLoaded = FALSE;
- }
- addTextureStats((F32)(mKnownDrawWidth * mKnownDrawHeight));
+ mKnownDrawSizeChanged = TRUE;
+ mFullyLoaded = FALSE;
+ }
+ addTextureStats((F32)(mKnownDrawWidth * mKnownDrawHeight));
}
void LLViewerFetchedTexture::setDebugText(const std::string& text)
@@ -1676,25 +1676,25 @@ void LLViewerFetchedTexture::setDebugText(const std::string& text)
void LLViewerFetchedTexture::processTextureStats()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(mFullyLoaded)
- {
- if(mDesiredDiscardLevel > mMinDesiredDiscardLevel)//need to load more
- {
- mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel);
- mFullyLoaded = FALSE;
- }
+ if(mFullyLoaded)
+ {
+ if(mDesiredDiscardLevel > mMinDesiredDiscardLevel)//need to load more
+ {
+ mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel);
+ mFullyLoaded = FALSE;
+ }
//setDebugText("fully loaded");
- }
- else
- {
- updateVirtualSize();
-
- static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes", false);
-
- if (textures_fullres)
- {
- mDesiredDiscardLevel = 0;
- }
+ }
+ else
+ {
+ updateVirtualSize();
+
+ static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes", false);
+
+ if (textures_fullres)
+ {
+ mDesiredDiscardLevel = 0;
+ }
else if (mDontDiscard && (mBoostLevel == LLGLTexture::BOOST_ICON || mBoostLevel == LLGLTexture::BOOST_THUMBNAIL))
{
if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT)
@@ -1706,96 +1706,96 @@ void LLViewerFetchedTexture::processTextureStats()
mDesiredDiscardLevel = 0;
}
}
- else if(!mFullWidth || !mFullHeight)
- {
- mDesiredDiscardLevel = llmin(getMaxDiscardLevel(), (S32)mLoadedCallbackDesiredDiscardLevel);
- }
- else
- {
- U32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
- if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight)
- {
- if (mFullWidth > desired_size || mFullHeight > desired_size)
- {
- mDesiredDiscardLevel = 1;
- }
- else
- {
- mDesiredDiscardLevel = 0;
- }
- }
- else if(mKnownDrawSizeChanged)//known draw size is set
- {
- mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2,
- log((F32)mFullHeight / mKnownDrawHeight) / log_2);
- mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel());
- mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel);
- }
- mKnownDrawSizeChanged = FALSE;
-
- if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel))
- {
- mFullyLoaded = TRUE;
- }
- }
- }
-
- if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) //force to refetch the texture.
- {
- mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel);
- if(getDiscardLevel() < 0 || getDiscardLevel() > mDesiredDiscardLevel)
- {
- mFullyLoaded = FALSE;
- }
- }
+ else if(!mFullWidth || !mFullHeight)
+ {
+ mDesiredDiscardLevel = llmin(getMaxDiscardLevel(), (S32)mLoadedCallbackDesiredDiscardLevel);
+ }
+ else
+ {
+ U32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
+ if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight)
+ {
+ if (mFullWidth > desired_size || mFullHeight > desired_size)
+ {
+ mDesiredDiscardLevel = 1;
+ }
+ else
+ {
+ mDesiredDiscardLevel = 0;
+ }
+ }
+ else if(mKnownDrawSizeChanged)//known draw size is set
+ {
+ mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2,
+ log((F32)mFullHeight / mKnownDrawHeight) / log_2);
+ mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel());
+ mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel);
+ }
+ mKnownDrawSizeChanged = FALSE;
+
+ if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel))
+ {
+ mFullyLoaded = TRUE;
+ }
+ }
+ }
+
+ if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) //force to refetch the texture.
+ {
+ mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel);
+ if(getDiscardLevel() < 0 || getDiscardLevel() > mDesiredDiscardLevel)
+ {
+ mFullyLoaded = FALSE;
+ }
+ }
}
//============================================================================
-void LLViewerFetchedTexture::updateVirtualSize()
-{
+void LLViewerFetchedTexture::updateVirtualSize()
+{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- reorganizeFaceList();
- reorganizeVolumeList();
+ reorganizeFaceList();
+ reorganizeVolumeList();
}
S32 LLViewerFetchedTexture::getCurrentDiscardLevelForFetching()
{
- S32 current_discard = getDiscardLevel();
- if(mForceToSaveRawImage)
- {
- if(mSavedRawDiscardLevel < 0 || current_discard < 0)
- {
- current_discard = -1;
- }
- else
- {
- current_discard = llmax(current_discard, mSavedRawDiscardLevel);
- }
- }
+ S32 current_discard = getDiscardLevel();
+ if(mForceToSaveRawImage)
+ {
+ if(mSavedRawDiscardLevel < 0 || current_discard < 0)
+ {
+ current_discard = -1;
+ }
+ else
+ {
+ current_discard = llmax(current_discard, mSavedRawDiscardLevel);
+ }
+ }
- return current_discard;
+ return current_discard;
}
bool LLViewerFetchedTexture::setDebugFetching(S32 debug_level)
{
- if(debug_level < 0)
- {
- mInDebug = FALSE;
- return false;
- }
- mInDebug = TRUE;
+ if(debug_level < 0)
+ {
+ mInDebug = FALSE;
+ return false;
+ }
+ mInDebug = TRUE;
- mDesiredDiscardLevel = debug_level;
+ mDesiredDiscardLevel = debug_level;
- return true;
+ return true;
}
bool LLViewerFetchedTexture::isActiveFetching()
{
- static LLCachedControl<bool> monitor_enabled(gSavedSettings,"DebugShowTextureInfo");
+ static LLCachedControl<bool> monitor_enabled(gSavedSettings,"DebugShowTextureInfo");
- return mFetchState > 7 && mFetchState < 10 && monitor_enabled; //in state of WAIT_HTTP_REQ or DECODE_IMAGE.
+ return mFetchState > 7 && mFetchState < 10 && monitor_enabled; //in state of WAIT_HTTP_REQ or DECODE_IMAGE.
}
void LLViewerFetchedTexture::setBoostLevel(S32 level)
@@ -1811,121 +1811,121 @@ void LLViewerFetchedTexture::setBoostLevel(S32 level)
bool LLViewerFetchedTexture::updateFetch()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- static LLCachedControl<bool> textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled", false);
-
- if(textures_decode_disabled) // don't fetch the surface textures in wireframe mode
- {
- return false;
- }
-
- mFetchState = 0;
- mFetchPriority = 0;
- mFetchDeltaTime = 999999.f;
- mRequestDeltaTime = 999999.f;
+ static LLCachedControl<bool> textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled", false);
+
+ if(textures_decode_disabled) // don't fetch the surface textures in wireframe mode
+ {
+ return false;
+ }
+
+ mFetchState = 0;
+ mFetchPriority = 0;
+ mFetchDeltaTime = 999999.f;
+ mRequestDeltaTime = 999999.f;
#ifndef LL_RELEASE_FOR_DOWNLOAD
- if (mID == LLAppViewer::getTextureFetch()->mDebugID)
- {
- LLAppViewer::getTextureFetch()->mDebugCount++; // for setting breakpoints
- }
+ if (mID == LLAppViewer::getTextureFetch()->mDebugID)
+ {
+ LLAppViewer::getTextureFetch()->mDebugCount++; // for setting breakpoints
+ }
#endif
- if (mNeedsCreateTexture)
- {
+ if (mNeedsCreateTexture)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - needs create");
- // We may be fetching still (e.g. waiting on write)
- // but don't check until we've processed the raw data we have
- return false;
- }
- if (mIsMissingAsset)
- {
+ // We may be fetching still (e.g. waiting on write)
+ // but don't check until we've processed the raw data we have
+ return false;
+ }
+ if (mIsMissingAsset)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - missing asset");
- llassert(!mHasFetcher);
- return false; // skip
- }
- if (!mLoadedCallbackList.empty() && mRawImage.notNull())
- {
+ llassert(!mHasFetcher);
+ return false; // skip
+ }
+ if (!mLoadedCallbackList.empty() && mRawImage.notNull())
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - callback pending");
- return false; // process any raw image data in callbacks before replacing
- }
- if(mInFastCacheList)
- {
+ return false; // process any raw image data in callbacks before replacing
+ }
+ if(mInFastCacheList)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - in fast cache");
- return false;
- }
+ return false;
+ }
if (mGLTexturep.isNull())
{ // fix for crash inside getCurrentDiscardLevelForFetching (shouldn't happen but appears to be happening)
llassert(false);
return false;
}
-
- S32 current_discard = getCurrentDiscardLevelForFetching();
- S32 desired_discard = getDesiredDiscardLevel();
- F32 decode_priority = mMaxVirtualSize;
- if (mIsFetching)
- {
+ S32 current_discard = getCurrentDiscardLevelForFetching();
+ S32 desired_discard = getDesiredDiscardLevel();
+ F32 decode_priority = mMaxVirtualSize;
+
+ if (mIsFetching)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - is fetching");
- // Sets mRawDiscardLevel, mRawImage, mAuxRawImage
- S32 fetch_discard = current_discard;
-
- if (mRawImage.notNull()) sRawCount--;
- if (mAuxRawImage.notNull()) sAuxCount--;
- // keep in mind that fetcher still might need raw image, don't modify original
- bool finished = LLAppViewer::getTextureFetch()->getRequestFinished(getID(), fetch_discard, mRawImage, mAuxRawImage,
- mLastHttpGetStatus);
- if (mRawImage.notNull()) sRawCount++;
- if (mAuxRawImage.notNull())
- {
- mHasAux = TRUE;
- sAuxCount++;
- }
- if (finished)
- {
- mIsFetching = FALSE;
+ // Sets mRawDiscardLevel, mRawImage, mAuxRawImage
+ S32 fetch_discard = current_discard;
+
+ if (mRawImage.notNull()) sRawCount--;
+ if (mAuxRawImage.notNull()) sAuxCount--;
+ // keep in mind that fetcher still might need raw image, don't modify original
+ bool finished = LLAppViewer::getTextureFetch()->getRequestFinished(getID(), fetch_discard, mRawImage, mAuxRawImage,
+ mLastHttpGetStatus);
+ if (mRawImage.notNull()) sRawCount++;
+ if (mAuxRawImage.notNull())
+ {
+ mHasAux = TRUE;
+ sAuxCount++;
+ }
+ if (finished)
+ {
+ mIsFetching = FALSE;
mLastFetchState = -1;
- mLastPacketTimer.reset();
- }
- else
- {
- mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority,
- mFetchPriority, mFetchDeltaTime, mRequestDeltaTime, mCanUseHTTP);
- }
-
- // We may have data ready regardless of whether or not we are finished (e.g. waiting on write)
- if (mRawImage.notNull())
- {
+ mLastPacketTimer.reset();
+ }
+ else
+ {
+ mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority,
+ mFetchPriority, mFetchDeltaTime, mRequestDeltaTime, mCanUseHTTP);
+ }
+
+ // We may have data ready regardless of whether or not we are finished (e.g. waiting on write)
+ if (mRawImage.notNull())
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - has raw image");
- LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
- if (tester)
- {
- mIsFetched = TRUE;
- tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID));
- }
- mRawDiscardLevel = fetch_discard;
- if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) &&
- (current_discard < 0 || mRawDiscardLevel < current_discard))
- {
+ LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
+ if (tester)
+ {
+ mIsFetched = TRUE;
+ tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID));
+ }
+ mRawDiscardLevel = fetch_discard;
+ if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) &&
+ (current_discard < 0 || mRawDiscardLevel < current_discard))
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - data good");
- mFullWidth = mRawImage->getWidth() << mRawDiscardLevel;
- mFullHeight = mRawImage->getHeight() << mRawDiscardLevel;
- setTexelsPerImage();
-
- if(mFullWidth > MAX_IMAGE_SIZE || mFullHeight > MAX_IMAGE_SIZE)
- {
- //discard all oversized textures.
- destroyRawImage();
- LL_WARNS() << "oversize, setting as missing" << LL_ENDL;
- setIsMissingAsset();
- mRawDiscardLevel = INVALID_DISCARD_LEVEL;
- mIsFetching = FALSE;
- mLastPacketTimer.reset();
- }
- else
- {
- mIsRawImageValid = TRUE;
- addToCreateTexture();
- }
+ mFullWidth = mRawImage->getWidth() << mRawDiscardLevel;
+ mFullHeight = mRawImage->getHeight() << mRawDiscardLevel;
+ setTexelsPerImage();
+
+ if(mFullWidth > MAX_IMAGE_SIZE || mFullHeight > MAX_IMAGE_SIZE)
+ {
+ //discard all oversized textures.
+ destroyRawImage();
+ LL_WARNS() << "oversize, setting as missing" << LL_ENDL;
+ setIsMissingAsset();
+ mRawDiscardLevel = INVALID_DISCARD_LEVEL;
+ mIsFetching = FALSE;
+ mLastPacketTimer.reset();
+ }
+ else
+ {
+ mIsRawImageValid = TRUE;
+ addToCreateTexture();
+ }
if (mBoostLevel == LLGLTexture::BOOST_ICON)
{
@@ -1951,802 +1951,802 @@ bool LLViewerFetchedTexture::updateFetch()
}
}
- return TRUE;
- }
- else
- {
+ return TRUE;
+ }
+ else
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - data not needed");
- // Data is ready but we don't need it
- // (received it already while fetcher was writing to disk)
- destroyRawImage();
- return false; // done
- }
- }
-
- if (!mIsFetching)
- {
- if ((decode_priority > 0) && (mRawDiscardLevel < 0 || mRawDiscardLevel == INVALID_DISCARD_LEVEL))
- {
- // We finished but received no data
- if (getDiscardLevel() < 0)
- {
- if (getFTType() != FTT_MAP_TILE)
- {
- LL_WARNS() << mID
- << " Fetch failure, setting as missing, decode_priority " << decode_priority
- << " mRawDiscardLevel " << mRawDiscardLevel
- << " current_discard " << current_discard
- << " stats " << mLastHttpGetStatus.toHex()
- << LL_ENDL;
- }
- setIsMissingAsset();
- desired_discard = -1;
- }
- else
- {
- //LL_WARNS() << mID << ": Setting min discard to " << current_discard << LL_ENDL;
- if(current_discard >= 0)
- {
- mMinDiscardLevel = current_discard;
- //desired_discard = current_discard;
- }
- else
- {
- S32 dis_level = getDiscardLevel();
- mMinDiscardLevel = dis_level;
- //desired_discard = dis_level;
- }
- }
- destroyRawImage();
- }
- else if (mRawImage.notNull())
- {
- // We have data, but our fetch failed to return raw data
- // *TODO: FIgure out why this is happening and fix it
- destroyRawImage();
- }
- }
- else
- {
- static const F32 MAX_HOLD_TIME = 5.0f; //seconds to wait before canceling fecthing if decode_priority is 0.f.
- if(decode_priority > 0.0f || mStopFetchingTimer.getElapsedTimeF32() > MAX_HOLD_TIME)
- {
- mStopFetchingTimer.reset();
- LLAppViewer::getTextureFetch()->updateRequestPriority(mID, decode_priority);
- }
- }
- }
+ // Data is ready but we don't need it
+ // (received it already while fetcher was writing to disk)
+ destroyRawImage();
+ return false; // done
+ }
+ }
+
+ if (!mIsFetching)
+ {
+ if ((decode_priority > 0) && (mRawDiscardLevel < 0 || mRawDiscardLevel == INVALID_DISCARD_LEVEL))
+ {
+ // We finished but received no data
+ if (getDiscardLevel() < 0)
+ {
+ if (getFTType() != FTT_MAP_TILE)
+ {
+ LL_WARNS() << mID
+ << " Fetch failure, setting as missing, decode_priority " << decode_priority
+ << " mRawDiscardLevel " << mRawDiscardLevel
+ << " current_discard " << current_discard
+ << " stats " << mLastHttpGetStatus.toHex()
+ << LL_ENDL;
+ }
+ setIsMissingAsset();
+ desired_discard = -1;
+ }
+ else
+ {
+ //LL_WARNS() << mID << ": Setting min discard to " << current_discard << LL_ENDL;
+ if(current_discard >= 0)
+ {
+ mMinDiscardLevel = current_discard;
+ //desired_discard = current_discard;
+ }
+ else
+ {
+ S32 dis_level = getDiscardLevel();
+ mMinDiscardLevel = dis_level;
+ //desired_discard = dis_level;
+ }
+ }
+ destroyRawImage();
+ }
+ else if (mRawImage.notNull())
+ {
+ // We have data, but our fetch failed to return raw data
+ // *TODO: FIgure out why this is happening and fix it
+ destroyRawImage();
+ }
+ }
+ else
+ {
+ static const F32 MAX_HOLD_TIME = 5.0f; //seconds to wait before canceling fecthing if decode_priority is 0.f.
+ if(decode_priority > 0.0f || mStopFetchingTimer.getElapsedTimeF32() > MAX_HOLD_TIME)
+ {
+ mStopFetchingTimer.reset();
+ LLAppViewer::getTextureFetch()->updateRequestPriority(mID, decode_priority);
+ }
+ }
+ }
desired_discard = llmin(desired_discard, getMaxDiscardLevel());
- bool make_request = true;
- if (decode_priority <= 0)
- {
+ bool make_request = true;
+ if (decode_priority <= 0)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - priority <= 0");
- make_request = false;
- }
- else if(mDesiredDiscardLevel > getMaxDiscardLevel())
- {
+ make_request = false;
+ }
+ else if(mDesiredDiscardLevel > getMaxDiscardLevel())
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - desired > max");
- make_request = false;
- }
- else if (mNeedsCreateTexture || mIsMissingAsset)
- {
+ make_request = false;
+ }
+ else if (mNeedsCreateTexture || mIsMissingAsset)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - create or missing");
- make_request = false;
- }
- else if (current_discard >= 0 && current_discard <= mMinDiscardLevel)
- {
+ make_request = false;
+ }
+ else if (current_discard >= 0 && current_discard <= mMinDiscardLevel)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - current < min");
- make_request = false;
- }
- else if(mCachedRawImage.notNull() // can be empty
- && mCachedRawImageReady
- && (current_discard < 0 || current_discard > mCachedRawDiscardLevel))
- {
- make_request = false;
- switchToCachedImage(); //use the cached raw data first
- }
-
- if (make_request)
- {
- if (mIsFetching)
- {
+ make_request = false;
+ }
+ else if(mCachedRawImage.notNull() // can be empty
+ && mCachedRawImageReady
+ && (current_discard < 0 || current_discard > mCachedRawDiscardLevel))
+ {
+ make_request = false;
+ switchToCachedImage(); //use the cached raw data first
+ }
+
+ if (make_request)
+ {
+ if (mIsFetching)
+ {
// already requested a higher resolution mip
- if (mRequestedDiscardLevel <= desired_discard)
- {
+ if (mRequestedDiscardLevel <= desired_discard)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - requested < desired");
- make_request = false;
- }
- }
- else
- {
+ make_request = false;
+ }
+ }
+ else
+ {
// already at a higher resolution mip, don't discard
- if (current_discard >= 0 && current_discard <= desired_discard)
- {
+ if (current_discard >= 0 && current_discard <= desired_discard)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - current <= desired");
- make_request = false;
- }
- }
- }
-
- if (make_request)
- {
+ make_request = false;
+ }
+ }
+ }
+
+ if (make_request)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - make request");
- S32 w=0, h=0, c=0;
- if (getDiscardLevel() >= 0)
- {
- w = mGLTexturep->getWidth(0);
- h = mGLTexturep->getHeight(0);
- c = mComponents;
- }
-
- const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
- if (override_tex_discard_level != 0)
- {
- desired_discard = override_tex_discard_level;
- }
-
- // bypass texturefetch directly by pulling from LLTextureCache
- S32 fetch_request_discard = -1;
+ S32 w=0, h=0, c=0;
+ if (getDiscardLevel() >= 0)
+ {
+ w = mGLTexturep->getWidth(0);
+ h = mGLTexturep->getHeight(0);
+ c = mComponents;
+ }
+
+ const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
+ if (override_tex_discard_level != 0)
+ {
+ desired_discard = override_tex_discard_level;
+ }
+
+ // bypass texturefetch directly by pulling from LLTextureCache
+ S32 fetch_request_discard = -1;
fetch_request_discard = LLAppViewer::getTextureFetch()->createRequest(mFTType, mUrl, getID(), getTargetHost(), decode_priority,
- w, h, c, desired_discard, needsAux(), mCanUseHTTP);
-
- if (fetch_request_discard >= 0)
- {
+ w, h, c, desired_discard, needsAux(), mCanUseHTTP);
+
+ if (fetch_request_discard >= 0)
+ {
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - request created");
- mHasFetcher = TRUE;
- mIsFetching = TRUE;
+ mHasFetcher = TRUE;
+ mIsFetching = TRUE;
// in some cases createRequest can modify discard, as an example
// bake textures are always at discard 0
mRequestedDiscardLevel = llmin(desired_discard, fetch_request_discard);
- mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority,
- mFetchPriority, mFetchDeltaTime, mRequestDeltaTime, mCanUseHTTP);
- }
+ mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority,
+ mFetchPriority, mFetchDeltaTime, mRequestDeltaTime, mCanUseHTTP);
+ }
// If createRequest() failed, that means one of two things:
// 1. We're finishing up a request for this UUID, so we
// should wait for it to complete
// 2. We've failed a request for this UUID, so there is
// no need to create another request
- }
- else if (mHasFetcher && !mIsFetching)
- {
- // Only delete requests that haven't received any network data
- // for a while. Note - this is the normal mechanism for
- // deleting requests, not just a place to handle timeouts.
- const F32 FETCH_IDLE_TIME = 0.1f;
- if (mLastPacketTimer.getElapsedTimeF32() > FETCH_IDLE_TIME)
- {
- LL_DEBUGS("Texture") << "exceeded idle time " << FETCH_IDLE_TIME << ", deleting request: " << getID() << LL_ENDL;
- LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
- mHasFetcher = FALSE;
- }
- }
-
- return mIsFetching ? true : false;
+ }
+ else if (mHasFetcher && !mIsFetching)
+ {
+ // Only delete requests that haven't received any network data
+ // for a while. Note - this is the normal mechanism for
+ // deleting requests, not just a place to handle timeouts.
+ const F32 FETCH_IDLE_TIME = 0.1f;
+ if (mLastPacketTimer.getElapsedTimeF32() > FETCH_IDLE_TIME)
+ {
+ LL_DEBUGS("Texture") << "exceeded idle time " << FETCH_IDLE_TIME << ", deleting request: " << getID() << LL_ENDL;
+ LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
+ mHasFetcher = FALSE;
+ }
+ }
+
+ return mIsFetching ? true : false;
}
void LLViewerFetchedTexture::clearFetchedResults()
{
- if(mNeedsCreateTexture || mIsFetching)
- {
- return;
- }
-
- cleanup();
- destroyGLTexture();
+ if(mNeedsCreateTexture || mIsFetching)
+ {
+ return;
+ }
- if(getDiscardLevel() >= 0) //sculpty texture, force to invalidate
- {
- mGLTexturep->forceToInvalidateGLTexture();
- }
+ cleanup();
+ destroyGLTexture();
+
+ if(getDiscardLevel() >= 0) //sculpty texture, force to invalidate
+ {
+ mGLTexturep->forceToInvalidateGLTexture();
+ }
}
void LLViewerFetchedTexture::forceToDeleteRequest()
{
- if (mHasFetcher)
- {
- mHasFetcher = FALSE;
- mIsFetching = FALSE;
- }
-
- resetTextureStats();
+ if (mHasFetcher)
+ {
+ mHasFetcher = FALSE;
+ mIsFetching = FALSE;
+ }
+
+ resetTextureStats();
- mDesiredDiscardLevel = getMaxDiscardLevel() + 1;
+ mDesiredDiscardLevel = getMaxDiscardLevel() + 1;
}
void LLViewerFetchedTexture::setIsMissingAsset(BOOL is_missing)
{
- if (is_missing == mIsMissingAsset)
- {
- return;
- }
- if (is_missing)
- {
- if (mUrl.empty())
- {
- LL_WARNS() << mID << ": Marking image as missing" << LL_ENDL;
- }
- else
- {
- // This may or may not be an error - it is normal to have no
- // map tile on an empty region, but bad if we're failing on a
- // server bake texture.
- if (getFTType() != FTT_MAP_TILE)
- {
- LL_WARNS() << mUrl << ": Marking image as missing" << LL_ENDL;
- }
- }
- if (mHasFetcher)
- {
- LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
- mHasFetcher = FALSE;
- mIsFetching = FALSE;
- mLastPacketTimer.reset();
- mFetchState = 0;
- mFetchPriority = 0;
- }
- }
- else
- {
- LL_INFOS() << mID << ": un-flagging missing asset" << LL_ENDL;
- }
- mIsMissingAsset = is_missing;
+ if (is_missing == mIsMissingAsset)
+ {
+ return;
+ }
+ if (is_missing)
+ {
+ if (mUrl.empty())
+ {
+ LL_WARNS() << mID << ": Marking image as missing" << LL_ENDL;
+ }
+ else
+ {
+ // This may or may not be an error - it is normal to have no
+ // map tile on an empty region, but bad if we're failing on a
+ // server bake texture.
+ if (getFTType() != FTT_MAP_TILE)
+ {
+ LL_WARNS() << mUrl << ": Marking image as missing" << LL_ENDL;
+ }
+ }
+ if (mHasFetcher)
+ {
+ LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
+ mHasFetcher = FALSE;
+ mIsFetching = FALSE;
+ mLastPacketTimer.reset();
+ mFetchState = 0;
+ mFetchPriority = 0;
+ }
+ }
+ else
+ {
+ LL_INFOS() << mID << ": un-flagging missing asset" << LL_ENDL;
+ }
+ mIsMissingAsset = is_missing;
}
void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_callback,
- S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* userdata,
- LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause)
-{
- //
- // Don't do ANYTHING here, just add it to the global callback list
- //
- if (mLoadedCallbackList.empty())
- {
- // Put in list to call this->doLoadedCallbacks() periodically
- gTextureList.mCallbackList.insert(this);
- mLoadedCallbackDesiredDiscardLevel = (S8)discard_level;
- }
- else
- {
- mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level);
- }
-
- if(mPauseLoadedCallBacks)
- {
- if(!pause)
- {
- unpauseLoadedCallbacks(src_callback_list);
- }
- }
- else if(pause)
- {
- pauseLoadedCallbacks(src_callback_list);
- }
-
- LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, this, pause);
- mLoadedCallbackList.push_back(entryp);
-
- mNeedsAux |= needs_aux;
- if(keep_imageraw)
- {
- mSaveRawImage = TRUE;
- }
- if (mNeedsAux && mAuxRawImage.isNull() && getDiscardLevel() >= 0)
- {
- if(mHasAux)
- {
- //trigger a refetch
- forceToRefetchTexture();
- }
- else
- {
- // We need aux data, but we've already loaded the image, and it didn't have any
- LL_WARNS() << "No aux data available for callback for image:" << getID() << LL_ENDL;
- }
- }
- mLastCallBackActiveTime = sCurrentTime ;
+ S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* userdata,
+ LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause)
+{
+ //
+ // Don't do ANYTHING here, just add it to the global callback list
+ //
+ if (mLoadedCallbackList.empty())
+ {
+ // Put in list to call this->doLoadedCallbacks() periodically
+ gTextureList.mCallbackList.insert(this);
+ mLoadedCallbackDesiredDiscardLevel = (S8)discard_level;
+ }
+ else
+ {
+ mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level);
+ }
+
+ if(mPauseLoadedCallBacks)
+ {
+ if(!pause)
+ {
+ unpauseLoadedCallbacks(src_callback_list);
+ }
+ }
+ else if(pause)
+ {
+ pauseLoadedCallbacks(src_callback_list);
+ }
+
+ LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, this, pause);
+ mLoadedCallbackList.push_back(entryp);
+
+ mNeedsAux |= needs_aux;
+ if(keep_imageraw)
+ {
+ mSaveRawImage = TRUE;
+ }
+ if (mNeedsAux && mAuxRawImage.isNull() && getDiscardLevel() >= 0)
+ {
+ if(mHasAux)
+ {
+ //trigger a refetch
+ forceToRefetchTexture();
+ }
+ else
+ {
+ // We need aux data, but we've already loaded the image, and it didn't have any
+ LL_WARNS() << "No aux data available for callback for image:" << getID() << LL_ENDL;
+ }
+ }
+ mLastCallBackActiveTime = sCurrentTime ;
mLastReferencedSavedRawImageTime = sCurrentTime;
}
void LLViewerFetchedTexture::clearCallbackEntryList()
{
- if(mLoadedCallbackList.empty())
- {
- return;
- }
-
- for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
- iter != mLoadedCallbackList.end(); )
- {
- LLLoadedCallbackEntry *entryp = *iter;
-
- // We never finished loading the image. Indicate failure.
- // Note: this allows mLoadedCallbackUserData to be cleaned up.
- entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData);
- iter = mLoadedCallbackList.erase(iter);
- delete entryp;
- }
- gTextureList.mCallbackList.erase(this);
-
- mLoadedCallbackDesiredDiscardLevel = S8_MAX;
- if(needsToSaveRawImage())
- {
- destroySavedRawImage();
- }
-
- return;
+ if(mLoadedCallbackList.empty())
+ {
+ return;
+ }
+
+ for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+ iter != mLoadedCallbackList.end(); )
+ {
+ LLLoadedCallbackEntry *entryp = *iter;
+
+ // We never finished loading the image. Indicate failure.
+ // Note: this allows mLoadedCallbackUserData to be cleaned up.
+ entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData);
+ iter = mLoadedCallbackList.erase(iter);
+ delete entryp;
+ }
+ gTextureList.mCallbackList.erase(this);
+
+ mLoadedCallbackDesiredDiscardLevel = S8_MAX;
+ if(needsToSaveRawImage())
+ {
+ destroySavedRawImage();
+ }
+
+ return;
}
void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::source_callback_list_t* callback_list)
{
- if(mLoadedCallbackList.empty() || !callback_list)
- {
- return;
- }
-
- S32 desired_discard = S8_MAX;
- S32 desired_raw_discard = INVALID_DISCARD_LEVEL;
- for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
- iter != mLoadedCallbackList.end(); )
- {
- LLLoadedCallbackEntry *entryp = *iter;
- if(entryp->mSourceCallbackList == callback_list)
- {
- // We never finished loading the image. Indicate failure.
- // Note: this allows mLoadedCallbackUserData to be cleaned up.
- entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData);
- iter = mLoadedCallbackList.erase(iter);
- delete entryp;
- }
- else
- {
- ++iter;
-
- desired_discard = llmin(desired_discard, entryp->mDesiredDiscard);
- if(entryp->mNeedsImageRaw)
- {
- desired_raw_discard = llmin(desired_raw_discard, entryp->mDesiredDiscard);
- }
- }
- }
-
- mLoadedCallbackDesiredDiscardLevel = desired_discard;
- if (mLoadedCallbackList.empty())
- {
- // If we have no callbacks, take us off of the image callback list.
- gTextureList.mCallbackList.erase(this);
-
- if(needsToSaveRawImage())
- {
- destroySavedRawImage();
- }
- }
- else if(needsToSaveRawImage() && mBoostLevel != LLGLTexture::BOOST_PREVIEW)
- {
- if(desired_raw_discard != INVALID_DISCARD_LEVEL)
- {
- mDesiredSavedRawDiscardLevel = desired_raw_discard;
- }
- else
- {
- destroySavedRawImage();
- }
- }
+ if(mLoadedCallbackList.empty() || !callback_list)
+ {
+ return;
+ }
+
+ S32 desired_discard = S8_MAX;
+ S32 desired_raw_discard = INVALID_DISCARD_LEVEL;
+ for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+ iter != mLoadedCallbackList.end(); )
+ {
+ LLLoadedCallbackEntry *entryp = *iter;
+ if(entryp->mSourceCallbackList == callback_list)
+ {
+ // We never finished loading the image. Indicate failure.
+ // Note: this allows mLoadedCallbackUserData to be cleaned up.
+ entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData);
+ iter = mLoadedCallbackList.erase(iter);
+ delete entryp;
+ }
+ else
+ {
+ ++iter;
+
+ desired_discard = llmin(desired_discard, entryp->mDesiredDiscard);
+ if(entryp->mNeedsImageRaw)
+ {
+ desired_raw_discard = llmin(desired_raw_discard, entryp->mDesiredDiscard);
+ }
+ }
+ }
+
+ mLoadedCallbackDesiredDiscardLevel = desired_discard;
+ if (mLoadedCallbackList.empty())
+ {
+ // If we have no callbacks, take us off of the image callback list.
+ gTextureList.mCallbackList.erase(this);
+
+ if(needsToSaveRawImage())
+ {
+ destroySavedRawImage();
+ }
+ }
+ else if(needsToSaveRawImage() && mBoostLevel != LLGLTexture::BOOST_PREVIEW)
+ {
+ if(desired_raw_discard != INVALID_DISCARD_LEVEL)
+ {
+ mDesiredSavedRawDiscardLevel = desired_raw_discard;
+ }
+ else
+ {
+ destroySavedRawImage();
+ }
+ }
}
void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list)
{
- if(!callback_list)
-{
- mPauseLoadedCallBacks = FALSE;
- return;
- }
-
- BOOL need_raw = FALSE;
- for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
- iter != mLoadedCallbackList.end(); )
- {
- LLLoadedCallbackEntry *entryp = *iter++;
- if(entryp->mSourceCallbackList == callback_list)
- {
- entryp->mPaused = FALSE;
- if(entryp->mNeedsImageRaw)
- {
- need_raw = TRUE;
- }
- }
- }
- mPauseLoadedCallBacks = FALSE ;
- mLastCallBackActiveTime = sCurrentTime ;
- mForceCallbackFetch = TRUE;
- if(need_raw)
- {
- mSaveRawImage = TRUE;
- }
+ if(!callback_list)
+{
+ mPauseLoadedCallBacks = FALSE;
+ return;
+ }
+
+ BOOL need_raw = FALSE;
+ for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+ iter != mLoadedCallbackList.end(); )
+ {
+ LLLoadedCallbackEntry *entryp = *iter++;
+ if(entryp->mSourceCallbackList == callback_list)
+ {
+ entryp->mPaused = FALSE;
+ if(entryp->mNeedsImageRaw)
+ {
+ need_raw = TRUE;
+ }
+ }
+ }
+ mPauseLoadedCallBacks = FALSE ;
+ mLastCallBackActiveTime = sCurrentTime ;
+ mForceCallbackFetch = TRUE;
+ if(need_raw)
+ {
+ mSaveRawImage = TRUE;
+ }
}
void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list)
{
- if(!callback_list)
+ if(!callback_list)
{
- return;
- }
+ return;
+ }
- bool paused = true;
+ bool paused = true;
- for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
- iter != mLoadedCallbackList.end(); )
- {
- LLLoadedCallbackEntry *entryp = *iter++;
- if(entryp->mSourceCallbackList == callback_list)
- {
- entryp->mPaused = TRUE;
- }
- else if(!entryp->mPaused)
- {
- paused = false;
- }
- }
+ for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+ iter != mLoadedCallbackList.end(); )
+ {
+ LLLoadedCallbackEntry *entryp = *iter++;
+ if(entryp->mSourceCallbackList == callback_list)
+ {
+ entryp->mPaused = TRUE;
+ }
+ else if(!entryp->mPaused)
+ {
+ paused = false;
+ }
+ }
- if(paused)
- {
- mPauseLoadedCallBacks = TRUE;//when set, loaded callback is paused.
- resetTextureStats();
- mSaveRawImage = FALSE;
- }
+ if(paused)
+ {
+ mPauseLoadedCallBacks = TRUE;//when set, loaded callback is paused.
+ resetTextureStats();
+ mSaveRawImage = FALSE;
+ }
}
bool LLViewerFetchedTexture::doLoadedCallbacks()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- static const F32 MAX_INACTIVE_TIME = 900.f ; //seconds
- static const F32 MAX_IDLE_WAIT_TIME = 5.f ; //seconds
-
- if (mNeedsCreateTexture)
- {
- return false;
- }
- if(mPauseLoadedCallBacks)
- {
- destroyRawImage();
- return false; //paused
- }
- if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME && !mIsFetching)
- {
- if (mFTType == FTT_SERVER_BAKE)
- {
- //output some debug info
- LL_INFOS() << "baked texture: " << mID << "clears all call backs due to inactivity." << LL_ENDL;
- LL_INFOS() << mUrl << LL_ENDL;
- LL_INFOS() << "current discard: " << getDiscardLevel() << " current discard for fetch: " << getCurrentDiscardLevelForFetching() <<
- " Desired discard: " << getDesiredDiscardLevel() << "decode Pri: " << mMaxVirtualSize << LL_ENDL;
- }
-
- clearCallbackEntryList() ; //remove all callbacks.
- return false ;
- }
-
- bool res = false;
-
- if (isMissingAsset())
- {
- if (mFTType == FTT_SERVER_BAKE)
- {
- //output some debug info
- LL_INFOS() << "baked texture: " << mID << "is missing." << LL_ENDL;
- LL_INFOS() << mUrl << LL_ENDL;
- }
-
- for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
- iter != mLoadedCallbackList.end(); )
- {
- LLLoadedCallbackEntry *entryp = *iter++;
- // We never finished loading the image. Indicate failure.
- // Note: this allows mLoadedCallbackUserData to be cleaned up.
- entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData);
- delete entryp;
- }
- mLoadedCallbackList.clear();
-
- // Remove ourself from the global list of textures with callbacks
- gTextureList.mCallbackList.erase(this);
- return false;
- }
-
- S32 gl_discard = getDiscardLevel();
-
- // If we don't have a legit GL image, set it to be lower than the worst discard level
- if (gl_discard == -1)
- {
- gl_discard = MAX_DISCARD_LEVEL + 1;
- }
-
- //
- // Determine the quality levels of textures that we can provide to callbacks
- // and whether we need to do decompression/readback to get it
- //
- S32 current_raw_discard = MAX_DISCARD_LEVEL + 1; // We can always do a readback to get a raw discard
- S32 best_raw_discard = gl_discard; // Current GL quality level
- S32 current_aux_discard = MAX_DISCARD_LEVEL + 1;
- S32 best_aux_discard = MAX_DISCARD_LEVEL + 1;
-
- if (mIsRawImageValid)
- {
- // If we have an existing raw image, we have a baseline for the raw and auxiliary quality levels.
- best_raw_discard = llmin(best_raw_discard, mRawDiscardLevel);
- best_aux_discard = llmin(best_aux_discard, mRawDiscardLevel); // We always decode the aux when we decode the base raw
- current_aux_discard = llmin(current_aux_discard, best_aux_discard);
- }
- else
- {
- // We have no data at all, we need to get it
- // Do this by forcing the best aux discard to be 0.
- best_aux_discard = 0;
- }
-
-
- //
- // See if any of the callbacks would actually run using the data that we can provide,
- // and also determine if we need to perform any readbacks or decodes.
- //
- bool run_gl_callbacks = false;
- bool run_raw_callbacks = false;
- bool need_readback = false;
-
- for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
- iter != mLoadedCallbackList.end(); )
- {
- LLLoadedCallbackEntry *entryp = *iter++;
-
- if (entryp->mNeedsImageRaw)
- {
- if (mNeedsAux)
- {
- //
- // Need raw and auxiliary channels
- //
- if (entryp->mLastUsedDiscard > current_aux_discard)
- {
- // We have useful data, run the callbacks
- run_raw_callbacks = true;
- }
- }
- else
- {
- if (entryp->mLastUsedDiscard > current_raw_discard)
- {
- // We have useful data, just run the callbacks
- run_raw_callbacks = true;
- }
- else if (entryp->mLastUsedDiscard > best_raw_discard)
- {
- // We can readback data, and then run the callbacks
- need_readback = true;
- run_raw_callbacks = true;
- }
- }
- }
- else
- {
- // Needs just GL
- if (entryp->mLastUsedDiscard > gl_discard)
- {
- // We have enough data, run this callback requiring GL data
- run_gl_callbacks = true;
- }
- }
- }
-
- //
- // Do a readback if required, OR start off a texture decode
- //
- if (need_readback && (getMaxDiscardLevel() > gl_discard))
- {
- // Do a readback to get the GL data into the raw image
- // We have GL data.
-
- destroyRawImage();
- reloadRawImage(mLoadedCallbackDesiredDiscardLevel);
- llassert(mRawImage.notNull());
- llassert(!mNeedsAux || mAuxRawImage.notNull());
- }
-
- //
- // Run raw/auxiliary data callbacks
- //
- if (run_raw_callbacks && mIsRawImageValid && (mRawDiscardLevel <= getMaxDiscardLevel()))
- {
- // Do callbacks which require raw image data.
- //LL_INFOS() << "doLoadedCallbacks raw for " << getID() << LL_ENDL;
-
- // Call each party interested in the raw data.
- for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
- iter != mLoadedCallbackList.end(); )
- {
- callback_list_t::iterator curiter = iter++;
- LLLoadedCallbackEntry *entryp = *curiter;
- if (entryp->mNeedsImageRaw && (entryp->mLastUsedDiscard > mRawDiscardLevel))
- {
- // If we've loaded all the data there is to load or we've loaded enough
- // to satisfy the interested party, then this is the last time that
- // we're going to call them.
-
- mLastCallBackActiveTime = sCurrentTime;
- if(mNeedsAux && mAuxRawImage.isNull())
- {
- LL_WARNS() << "Raw Image with no Aux Data for callback" << LL_ENDL;
- }
- BOOL final = mRawDiscardLevel <= entryp->mDesiredDiscard ? TRUE : FALSE;
- //LL_INFOS() << "Running callback for " << getID() << LL_ENDL;
- //LL_INFOS() << mRawImage->getWidth() << "x" << mRawImage->getHeight() << LL_ENDL;
- entryp->mLastUsedDiscard = mRawDiscardLevel;
- entryp->mCallback(TRUE, this, mRawImage, mAuxRawImage, mRawDiscardLevel, final, entryp->mUserData);
- if (final)
- {
- iter = mLoadedCallbackList.erase(curiter);
- delete entryp;
- }
- res = true;
- }
- }
- }
-
- //
- // Run GL callbacks
- //
- if (run_gl_callbacks && (gl_discard <= getMaxDiscardLevel()))
- {
- //LL_INFOS() << "doLoadedCallbacks GL for " << getID() << LL_ENDL;
-
- // Call the callbacks interested in GL data.
- for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
- iter != mLoadedCallbackList.end(); )
- {
- callback_list_t::iterator curiter = iter++;
- LLLoadedCallbackEntry *entryp = *curiter;
- if (!entryp->mNeedsImageRaw && (entryp->mLastUsedDiscard > gl_discard))
- {
- mLastCallBackActiveTime = sCurrentTime;
- BOOL final = gl_discard <= entryp->mDesiredDiscard ? TRUE : FALSE;
- entryp->mLastUsedDiscard = gl_discard;
- entryp->mCallback(TRUE, this, NULL, NULL, gl_discard, final, entryp->mUserData);
- if (final)
- {
- iter = mLoadedCallbackList.erase(curiter);
- delete entryp;
- }
- res = true;
- }
- }
- }
-
- // Done with any raw image data at this point (will be re-created if we still have callbacks)
- destroyRawImage();
-
- //
- // If we have no callbacks, take us off of the image callback list.
- //
- if (mLoadedCallbackList.empty())
- {
- gTextureList.mCallbackList.erase(this);
- }
- else if(!res && mForceCallbackFetch && sCurrentTime - mLastCallBackActiveTime > MAX_IDLE_WAIT_TIME && !mIsFetching)
- {
- //wait for long enough but no fetching request issued, force one.
- forceToRefetchTexture(mLoadedCallbackDesiredDiscardLevel, 5.f);
- mForceCallbackFetch = FALSE; //fire once.
- }
-
- return res;
+ static const F32 MAX_INACTIVE_TIME = 900.f ; //seconds
+ static const F32 MAX_IDLE_WAIT_TIME = 5.f ; //seconds
+
+ if (mNeedsCreateTexture)
+ {
+ return false;
+ }
+ if(mPauseLoadedCallBacks)
+ {
+ destroyRawImage();
+ return false; //paused
+ }
+ if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME && !mIsFetching)
+ {
+ if (mFTType == FTT_SERVER_BAKE)
+ {
+ //output some debug info
+ LL_INFOS() << "baked texture: " << mID << "clears all call backs due to inactivity." << LL_ENDL;
+ LL_INFOS() << mUrl << LL_ENDL;
+ LL_INFOS() << "current discard: " << getDiscardLevel() << " current discard for fetch: " << getCurrentDiscardLevelForFetching() <<
+ " Desired discard: " << getDesiredDiscardLevel() << "decode Pri: " << mMaxVirtualSize << LL_ENDL;
+ }
+
+ clearCallbackEntryList() ; //remove all callbacks.
+ return false ;
+ }
+
+ bool res = false;
+
+ if (isMissingAsset())
+ {
+ if (mFTType == FTT_SERVER_BAKE)
+ {
+ //output some debug info
+ LL_INFOS() << "baked texture: " << mID << "is missing." << LL_ENDL;
+ LL_INFOS() << mUrl << LL_ENDL;
+ }
+
+ for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+ iter != mLoadedCallbackList.end(); )
+ {
+ LLLoadedCallbackEntry *entryp = *iter++;
+ // We never finished loading the image. Indicate failure.
+ // Note: this allows mLoadedCallbackUserData to be cleaned up.
+ entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData);
+ delete entryp;
+ }
+ mLoadedCallbackList.clear();
+
+ // Remove ourself from the global list of textures with callbacks
+ gTextureList.mCallbackList.erase(this);
+ return false;
+ }
+
+ S32 gl_discard = getDiscardLevel();
+
+ // If we don't have a legit GL image, set it to be lower than the worst discard level
+ if (gl_discard == -1)
+ {
+ gl_discard = MAX_DISCARD_LEVEL + 1;
+ }
+
+ //
+ // Determine the quality levels of textures that we can provide to callbacks
+ // and whether we need to do decompression/readback to get it
+ //
+ S32 current_raw_discard = MAX_DISCARD_LEVEL + 1; // We can always do a readback to get a raw discard
+ S32 best_raw_discard = gl_discard; // Current GL quality level
+ S32 current_aux_discard = MAX_DISCARD_LEVEL + 1;
+ S32 best_aux_discard = MAX_DISCARD_LEVEL + 1;
+
+ if (mIsRawImageValid)
+ {
+ // If we have an existing raw image, we have a baseline for the raw and auxiliary quality levels.
+ best_raw_discard = llmin(best_raw_discard, mRawDiscardLevel);
+ best_aux_discard = llmin(best_aux_discard, mRawDiscardLevel); // We always decode the aux when we decode the base raw
+ current_aux_discard = llmin(current_aux_discard, best_aux_discard);
+ }
+ else
+ {
+ // We have no data at all, we need to get it
+ // Do this by forcing the best aux discard to be 0.
+ best_aux_discard = 0;
+ }
+
+
+ //
+ // See if any of the callbacks would actually run using the data that we can provide,
+ // and also determine if we need to perform any readbacks or decodes.
+ //
+ bool run_gl_callbacks = false;
+ bool run_raw_callbacks = false;
+ bool need_readback = false;
+
+ for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+ iter != mLoadedCallbackList.end(); )
+ {
+ LLLoadedCallbackEntry *entryp = *iter++;
+
+ if (entryp->mNeedsImageRaw)
+ {
+ if (mNeedsAux)
+ {
+ //
+ // Need raw and auxiliary channels
+ //
+ if (entryp->mLastUsedDiscard > current_aux_discard)
+ {
+ // We have useful data, run the callbacks
+ run_raw_callbacks = true;
+ }
+ }
+ else
+ {
+ if (entryp->mLastUsedDiscard > current_raw_discard)
+ {
+ // We have useful data, just run the callbacks
+ run_raw_callbacks = true;
+ }
+ else if (entryp->mLastUsedDiscard > best_raw_discard)
+ {
+ // We can readback data, and then run the callbacks
+ need_readback = true;
+ run_raw_callbacks = true;
+ }
+ }
+ }
+ else
+ {
+ // Needs just GL
+ if (entryp->mLastUsedDiscard > gl_discard)
+ {
+ // We have enough data, run this callback requiring GL data
+ run_gl_callbacks = true;
+ }
+ }
+ }
+
+ //
+ // Do a readback if required, OR start off a texture decode
+ //
+ if (need_readback && (getMaxDiscardLevel() > gl_discard))
+ {
+ // Do a readback to get the GL data into the raw image
+ // We have GL data.
+
+ destroyRawImage();
+ reloadRawImage(mLoadedCallbackDesiredDiscardLevel);
+ llassert(mRawImage.notNull());
+ llassert(!mNeedsAux || mAuxRawImage.notNull());
+ }
+
+ //
+ // Run raw/auxiliary data callbacks
+ //
+ if (run_raw_callbacks && mIsRawImageValid && (mRawDiscardLevel <= getMaxDiscardLevel()))
+ {
+ // Do callbacks which require raw image data.
+ //LL_INFOS() << "doLoadedCallbacks raw for " << getID() << LL_ENDL;
+
+ // Call each party interested in the raw data.
+ for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+ iter != mLoadedCallbackList.end(); )
+ {
+ callback_list_t::iterator curiter = iter++;
+ LLLoadedCallbackEntry *entryp = *curiter;
+ if (entryp->mNeedsImageRaw && (entryp->mLastUsedDiscard > mRawDiscardLevel))
+ {
+ // If we've loaded all the data there is to load or we've loaded enough
+ // to satisfy the interested party, then this is the last time that
+ // we're going to call them.
+
+ mLastCallBackActiveTime = sCurrentTime;
+ if(mNeedsAux && mAuxRawImage.isNull())
+ {
+ LL_WARNS() << "Raw Image with no Aux Data for callback" << LL_ENDL;
+ }
+ BOOL final = mRawDiscardLevel <= entryp->mDesiredDiscard ? TRUE : FALSE;
+ //LL_INFOS() << "Running callback for " << getID() << LL_ENDL;
+ //LL_INFOS() << mRawImage->getWidth() << "x" << mRawImage->getHeight() << LL_ENDL;
+ entryp->mLastUsedDiscard = mRawDiscardLevel;
+ entryp->mCallback(TRUE, this, mRawImage, mAuxRawImage, mRawDiscardLevel, final, entryp->mUserData);
+ if (final)
+ {
+ iter = mLoadedCallbackList.erase(curiter);
+ delete entryp;
+ }
+ res = true;
+ }
+ }
+ }
+
+ //
+ // Run GL callbacks
+ //
+ if (run_gl_callbacks && (gl_discard <= getMaxDiscardLevel()))
+ {
+ //LL_INFOS() << "doLoadedCallbacks GL for " << getID() << LL_ENDL;
+
+ // Call the callbacks interested in GL data.
+ for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+ iter != mLoadedCallbackList.end(); )
+ {
+ callback_list_t::iterator curiter = iter++;
+ LLLoadedCallbackEntry *entryp = *curiter;
+ if (!entryp->mNeedsImageRaw && (entryp->mLastUsedDiscard > gl_discard))
+ {
+ mLastCallBackActiveTime = sCurrentTime;
+ BOOL final = gl_discard <= entryp->mDesiredDiscard ? TRUE : FALSE;
+ entryp->mLastUsedDiscard = gl_discard;
+ entryp->mCallback(TRUE, this, NULL, NULL, gl_discard, final, entryp->mUserData);
+ if (final)
+ {
+ iter = mLoadedCallbackList.erase(curiter);
+ delete entryp;
+ }
+ res = true;
+ }
+ }
+ }
+
+ // Done with any raw image data at this point (will be re-created if we still have callbacks)
+ destroyRawImage();
+
+ //
+ // If we have no callbacks, take us off of the image callback list.
+ //
+ if (mLoadedCallbackList.empty())
+ {
+ gTextureList.mCallbackList.erase(this);
+ }
+ else if(!res && mForceCallbackFetch && sCurrentTime - mLastCallBackActiveTime > MAX_IDLE_WAIT_TIME && !mIsFetching)
+ {
+ //wait for long enough but no fetching request issued, force one.
+ forceToRefetchTexture(mLoadedCallbackDesiredDiscardLevel, 5.f);
+ mForceCallbackFetch = FALSE; //fire once.
+ }
+
+ return res;
}
//virtual
void LLViewerFetchedTexture::forceImmediateUpdate()
{
- //only immediately update a deleted texture which is now being re-used.
- if(!isDeleted())
- {
- return;
- }
- //if already called forceImmediateUpdate()
- if(mInImageList && mMaxVirtualSize == LLViewerFetchedTexture::sMaxVirtualSize)
- {
- return;
- }
+ //only immediately update a deleted texture which is now being re-used.
+ if(!isDeleted())
+ {
+ return;
+ }
+ //if already called forceImmediateUpdate()
+ if(mInImageList && mMaxVirtualSize == LLViewerFetchedTexture::sMaxVirtualSize)
+ {
+ return;
+ }
- gTextureList.forceImmediateUpdate(this);
- return;
+ gTextureList.forceImmediateUpdate(this);
+ return;
}
LLImageRaw* LLViewerFetchedTexture::reloadRawImage(S8 discard_level)
{
- llassert(mGLTexturep.notNull());
- llassert(discard_level >= 0);
- llassert(mComponents > 0);
+ llassert(mGLTexturep.notNull());
+ llassert(discard_level >= 0);
+ llassert(mComponents > 0);
- if (mRawImage.notNull())
- {
- //mRawImage is in use by somebody else, do not delete it.
- return NULL;
- }
+ if (mRawImage.notNull())
+ {
+ //mRawImage is in use by somebody else, do not delete it.
+ return NULL;
+ }
- if(mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= discard_level)
- {
- if (mSavedRawDiscardLevel != discard_level
+ if(mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= discard_level)
+ {
+ if (mSavedRawDiscardLevel != discard_level
&& mBoostLevel != BOOST_ICON
&& mBoostLevel != BOOST_THUMBNAIL)
- {
- mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents());
- mRawImage->copy(getSavedRawImage());
- }
- else
- {
- mRawImage = getSavedRawImage();
- }
- mRawDiscardLevel = discard_level;
- }
- else
- {
- //force to fetch raw image again if cached raw image is not good enough.
- if(mCachedRawDiscardLevel > discard_level)
- {
- mRawImage = mCachedRawImage;
- mRawDiscardLevel = mCachedRawDiscardLevel;
- }
- else //cached raw image is good enough, copy it.
- {
- if(mCachedRawDiscardLevel != discard_level)
- {
- mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents());
- mRawImage->copy(mCachedRawImage);
- }
- else
- {
- mRawImage = mCachedRawImage;
- }
- mRawDiscardLevel = discard_level;
- }
- }
- mIsRawImageValid = TRUE;
- sRawCount++;
-
- return mRawImage;
+ {
+ mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents());
+ mRawImage->copy(getSavedRawImage());
+ }
+ else
+ {
+ mRawImage = getSavedRawImage();
+ }
+ mRawDiscardLevel = discard_level;
+ }
+ else
+ {
+ //force to fetch raw image again if cached raw image is not good enough.
+ if(mCachedRawDiscardLevel > discard_level)
+ {
+ mRawImage = mCachedRawImage;
+ mRawDiscardLevel = mCachedRawDiscardLevel;
+ }
+ else //cached raw image is good enough, copy it.
+ {
+ if(mCachedRawDiscardLevel != discard_level)
+ {
+ mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents());
+ mRawImage->copy(mCachedRawImage);
+ }
+ else
+ {
+ mRawImage = mCachedRawImage;
+ }
+ mRawDiscardLevel = discard_level;
+ }
+ }
+ mIsRawImageValid = TRUE;
+ sRawCount++;
+
+ return mRawImage;
}
bool LLViewerFetchedTexture::needsToSaveRawImage()
{
- return mForceToSaveRawImage || mSaveRawImage;
+ return mForceToSaveRawImage || mSaveRawImage;
}
void LLViewerFetchedTexture::destroyRawImage()
-{
+{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (mAuxRawImage.notNull() && !needsToSaveRawImage())
- {
- sAuxCount--;
- mAuxRawImage = NULL;
- }
-
- if (mRawImage.notNull())
- {
- sRawCount--;
-
- if(mIsRawImageValid)
- {
- if(needsToSaveRawImage())
- {
- saveRawImage();
- }
- setCachedRawImage();
- }
-
- mRawImage = NULL;
-
- mIsRawImageValid = FALSE;
- mRawDiscardLevel = INVALID_DISCARD_LEVEL;
- }
+ if (mAuxRawImage.notNull() && !needsToSaveRawImage())
+ {
+ sAuxCount--;
+ mAuxRawImage = NULL;
+ }
+
+ if (mRawImage.notNull())
+ {
+ sRawCount--;
+
+ if(mIsRawImageValid)
+ {
+ if(needsToSaveRawImage())
+ {
+ saveRawImage();
+ }
+ setCachedRawImage();
+ }
+
+ mRawImage = NULL;
+
+ mIsRawImageValid = FALSE;
+ mRawDiscardLevel = INVALID_DISCARD_LEVEL;
+ }
}
//use the mCachedRawImage to (re)generate the gl texture.
@@ -2754,32 +2754,32 @@ void LLViewerFetchedTexture::destroyRawImage()
void LLViewerFetchedTexture::switchToCachedImage()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(mCachedRawImage.notNull() &&
+ if(mCachedRawImage.notNull() &&
!mNeedsCreateTexture) // <--- texture creation is pending, don't step on it
- {
- mRawImage = mCachedRawImage;
-
- if (getComponents() != mRawImage->getComponents())
- {
- // We've changed the number of components, so we need to move any
- // objects using this pool to a different pool.
- mComponents = mRawImage->getComponents();
- mGLTexturep->setComponents(mComponents);
- gTextureList.dirtyImage(this);
- }
-
- mIsRawImageValid = TRUE;
- mRawDiscardLevel = mCachedRawDiscardLevel;
+ {
+ mRawImage = mCachedRawImage;
+
+ if (getComponents() != mRawImage->getComponents())
+ {
+ // We've changed the number of components, so we need to move any
+ // objects using this pool to a different pool.
+ mComponents = mRawImage->getComponents();
+ mGLTexturep->setComponents(mComponents);
+ gTextureList.dirtyImage(this);
+ }
+
+ mIsRawImageValid = TRUE;
+ mRawDiscardLevel = mCachedRawDiscardLevel;
scheduleCreateTexture();
- }
+ }
}
//cache the imageraw forcefully.
-//virtual
-void LLViewerFetchedTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw)
+//virtual
+void LLViewerFetchedTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw)
{
- if(imageraw != mRawImage.get())
+ if(imageraw != mRawImage.get())
{
if (mBoostLevel == LLGLTexture::BOOST_ICON)
{
@@ -2813,96 +2813,96 @@ void LLViewerFetchedTexture::setCachedRawImage(S32 discard_level, LLImageRaw* im
{
mCachedRawImage = imageraw;
}
- mCachedRawDiscardLevel = discard_level;
- mCachedRawImageReady = TRUE;
- }
+ mCachedRawDiscardLevel = discard_level;
+ mCachedRawImageReady = TRUE;
+ }
}
void LLViewerFetchedTexture::setCachedRawImage()
-{
+{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(mRawImage == mCachedRawImage)
- {
- return;
- }
- if(!mIsRawImageValid)
- {
- return;
- }
-
- if(mCachedRawImageReady)
- {
- return;
- }
-
- if(mCachedRawDiscardLevel < 0 || mCachedRawDiscardLevel > mRawDiscardLevel)
- {
- S32 i = 0;
- S32 w = mRawImage->getWidth();
- S32 h = mRawImage->getHeight();
-
- S32 max_size = MAX_CACHED_RAW_IMAGE_AREA;
- if(LLGLTexture::BOOST_TERRAIN == mBoostLevel)
- {
- max_size = MAX_CACHED_RAW_TERRAIN_IMAGE_AREA;
- }
- if(mForSculpt)
- {
- max_size = MAX_CACHED_RAW_SCULPT_IMAGE_AREA;
- mCachedRawImageReady = !mRawDiscardLevel;
- }
- else
- {
- mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size));
- }
-
- while(((w >> i) * (h >> i)) > max_size)
- {
- ++i;
- }
-
- if(i)
- {
- if(!(w >> i) || !(h >> i))
- {
- --i;
- }
-
- {
- //make a duplicate in case somebody else is using this raw image
- mRawImage = mRawImage->scaled(w >> i, h >> i);
- }
- }
- mCachedRawImage = mRawImage;
- mRawDiscardLevel += i;
- mCachedRawDiscardLevel = mRawDiscardLevel;
- }
+ if(mRawImage == mCachedRawImage)
+ {
+ return;
+ }
+ if(!mIsRawImageValid)
+ {
+ return;
+ }
+
+ if(mCachedRawImageReady)
+ {
+ return;
+ }
+
+ if(mCachedRawDiscardLevel < 0 || mCachedRawDiscardLevel > mRawDiscardLevel)
+ {
+ S32 i = 0;
+ S32 w = mRawImage->getWidth();
+ S32 h = mRawImage->getHeight();
+
+ S32 max_size = MAX_CACHED_RAW_IMAGE_AREA;
+ if(LLGLTexture::BOOST_TERRAIN == mBoostLevel)
+ {
+ max_size = MAX_CACHED_RAW_TERRAIN_IMAGE_AREA;
+ }
+ if(mForSculpt)
+ {
+ max_size = MAX_CACHED_RAW_SCULPT_IMAGE_AREA;
+ mCachedRawImageReady = !mRawDiscardLevel;
+ }
+ else
+ {
+ mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size));
+ }
+
+ while(((w >> i) * (h >> i)) > max_size)
+ {
+ ++i;
+ }
+
+ if(i)
+ {
+ if(!(w >> i) || !(h >> i))
+ {
+ --i;
+ }
+
+ {
+ //make a duplicate in case somebody else is using this raw image
+ mRawImage = mRawImage->scaled(w >> i, h >> i);
+ }
+ }
+ mCachedRawImage = mRawImage;
+ mRawDiscardLevel += i;
+ mCachedRawDiscardLevel = mRawDiscardLevel;
+ }
}
void LLViewerFetchedTexture::checkCachedRawSculptImage()
{
- if(mCachedRawImageReady && mCachedRawDiscardLevel > 0)
- {
- if(getDiscardLevel() != 0)
- {
- mCachedRawImageReady = FALSE;
- }
- else if(isForSculptOnly())
- {
- resetTextureStats(); //do not update this image any more.
- }
- }
+ if(mCachedRawImageReady && mCachedRawDiscardLevel > 0)
+ {
+ if(getDiscardLevel() != 0)
+ {
+ mCachedRawImageReady = FALSE;
+ }
+ else if(isForSculptOnly())
+ {
+ resetTextureStats(); //do not update this image any more.
+ }
+ }
}
-void LLViewerFetchedTexture::saveRawImage()
+void LLViewerFetchedTexture::saveRawImage()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(mRawImage.isNull() || mRawImage == mSavedRawImage || (mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= mRawDiscardLevel))
- {
- return;
- }
+ if(mRawImage.isNull() || mRawImage == mSavedRawImage || (mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= mRawDiscardLevel))
+ {
+ return;
+ }
- mSavedRawDiscardLevel = mRawDiscardLevel;
+ mSavedRawDiscardLevel = mRawDiscardLevel;
if (mBoostLevel == LLGLTexture::BOOST_ICON)
{
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENSIONS;
@@ -2936,102 +2936,102 @@ void LLViewerFetchedTexture::saveRawImage()
mSavedRawImage = new LLImageRaw(mRawImage->getData(), mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents());
}
- if(mForceToSaveRawImage && mSavedRawDiscardLevel <= mDesiredSavedRawDiscardLevel)
- {
- mForceToSaveRawImage = FALSE;
- }
+ if(mForceToSaveRawImage && mSavedRawDiscardLevel <= mDesiredSavedRawDiscardLevel)
+ {
+ mForceToSaveRawImage = FALSE;
+ }
- mLastReferencedSavedRawImageTime = sCurrentTime;
+ mLastReferencedSavedRawImageTime = sCurrentTime;
}
-//force to refetch the texture to the discard level
+//force to refetch the texture to the discard level
void LLViewerFetchedTexture::forceToRefetchTexture(S32 desired_discard, F32 kept_time)
{
- if(mForceToSaveRawImage)
- {
- desired_discard = llmin(desired_discard, mDesiredSavedRawDiscardLevel);
- kept_time = llmax(kept_time, mKeptSavedRawImageTime);
- }
-
- //trigger a new fetch.
- mForceToSaveRawImage = TRUE ;
- mDesiredSavedRawDiscardLevel = desired_discard ;
- mKeptSavedRawImageTime = kept_time ;
- mLastReferencedSavedRawImageTime = sCurrentTime ;
- mSavedRawImage = NULL ;
- mSavedRawDiscardLevel = -1 ;
-}
-
-void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, F32 kept_time)
-{
- mKeptSavedRawImageTime = kept_time;
- mLastReferencedSavedRawImageTime = sCurrentTime;
-
- if(mSavedRawDiscardLevel > -1 && mSavedRawDiscardLevel <= desired_discard)
- {
- return; //raw imge is ready.
- }
-
- if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard)
- {
- mForceToSaveRawImage = TRUE;
- mDesiredSavedRawDiscardLevel = desired_discard;
-
- //copy from the cached raw image if exists.
- if(mCachedRawImage.notNull() && mRawImage.isNull() )
- {
- mRawImage = mCachedRawImage;
- mRawDiscardLevel = mCachedRawDiscardLevel;
-
- saveRawImage();
-
- mRawImage = NULL;
- mRawDiscardLevel = INVALID_DISCARD_LEVEL;
- }
- }
+ if(mForceToSaveRawImage)
+ {
+ desired_discard = llmin(desired_discard, mDesiredSavedRawDiscardLevel);
+ kept_time = llmax(kept_time, mKeptSavedRawImageTime);
+ }
+
+ //trigger a new fetch.
+ mForceToSaveRawImage = TRUE ;
+ mDesiredSavedRawDiscardLevel = desired_discard ;
+ mKeptSavedRawImageTime = kept_time ;
+ mLastReferencedSavedRawImageTime = sCurrentTime ;
+ mSavedRawImage = NULL ;
+ mSavedRawDiscardLevel = -1 ;
+}
+
+void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, F32 kept_time)
+{
+ mKeptSavedRawImageTime = kept_time;
+ mLastReferencedSavedRawImageTime = sCurrentTime;
+
+ if(mSavedRawDiscardLevel > -1 && mSavedRawDiscardLevel <= desired_discard)
+ {
+ return; //raw imge is ready.
+ }
+
+ if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard)
+ {
+ mForceToSaveRawImage = TRUE;
+ mDesiredSavedRawDiscardLevel = desired_discard;
+
+ //copy from the cached raw image if exists.
+ if(mCachedRawImage.notNull() && mRawImage.isNull() )
+ {
+ mRawImage = mCachedRawImage;
+ mRawDiscardLevel = mCachedRawDiscardLevel;
+
+ saveRawImage();
+
+ mRawImage = NULL;
+ mRawDiscardLevel = INVALID_DISCARD_LEVEL;
+ }
+ }
}
void LLViewerFetchedTexture::destroySavedRawImage()
{
- if(mLastReferencedSavedRawImageTime < mKeptSavedRawImageTime)
- {
- return; //keep the saved raw image.
- }
+ if(mLastReferencedSavedRawImageTime < mKeptSavedRawImageTime)
+ {
+ return; //keep the saved raw image.
+ }
+
+ mForceToSaveRawImage = FALSE;
+ mSaveRawImage = FALSE;
+
+ clearCallbackEntryList();
- mForceToSaveRawImage = FALSE;
- mSaveRawImage = FALSE;
+ mSavedRawImage = NULL ;
+ mForceToSaveRawImage = FALSE ;
+ mSaveRawImage = FALSE ;
+ mSavedRawDiscardLevel = -1 ;
+ mDesiredSavedRawDiscardLevel = -1 ;
+ mLastReferencedSavedRawImageTime = 0.0f ;
+ mKeptSavedRawImageTime = 0.f ;
- clearCallbackEntryList();
-
- mSavedRawImage = NULL ;
- mForceToSaveRawImage = FALSE ;
- mSaveRawImage = FALSE ;
- mSavedRawDiscardLevel = -1 ;
- mDesiredSavedRawDiscardLevel = -1 ;
- mLastReferencedSavedRawImageTime = 0.0f ;
- mKeptSavedRawImageTime = 0.f ;
-
- if(mAuxRawImage.notNull())
- {
- sAuxCount--;
- mAuxRawImage = NULL;
- }
+ if(mAuxRawImage.notNull())
+ {
+ sAuxCount--;
+ mAuxRawImage = NULL;
+ }
}
-LLImageRaw* LLViewerFetchedTexture::getSavedRawImage()
+LLImageRaw* LLViewerFetchedTexture::getSavedRawImage()
{
- mLastReferencedSavedRawImageTime = sCurrentTime;
+ mLastReferencedSavedRawImageTime = sCurrentTime;
- return mSavedRawImage;
+ return mSavedRawImage;
}
-
+
BOOL LLViewerFetchedTexture::hasSavedRawImage() const
{
- return mSavedRawImage.notNull();
+ return mSavedRawImage.notNull();
}
-
+
F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const
-{
- return sCurrentTime - mLastReferencedSavedRawImageTime;
+{
+ return sCurrentTime - mLastReferencedSavedRawImageTime;
}
//----------------------------------------------------------------------------------------------
@@ -3042,33 +3042,33 @@ F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const
//start of LLViewerLODTexture
//----------------------------------------------------------------------------------------------
LLViewerLODTexture::LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host, BOOL usemipmaps)
- : LLViewerFetchedTexture(id, f_type, host, usemipmaps)
+ : LLViewerFetchedTexture(id, f_type, host, usemipmaps)
{
- init(TRUE);
+ init(TRUE);
}
LLViewerLODTexture::LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps)
- : LLViewerFetchedTexture(url, f_type, id, usemipmaps)
+ : LLViewerFetchedTexture(url, f_type, id, usemipmaps)
{
- init(TRUE);
+ init(TRUE);
}
void LLViewerLODTexture::init(bool firstinit)
{
- mTexelsPerImage = 64.f*64.f;
- mDiscardVirtualSize = 0.f;
- mCalculatedDiscardLevel = -1.f;
+ mTexelsPerImage = 64.f*64.f;
+ mDiscardVirtualSize = 0.f;
+ mCalculatedDiscardLevel = -1.f;
}
-//virtual
+//virtual
S8 LLViewerLODTexture::getType() const
{
- return LLViewerTexture::LOD_TEXTURE;
+ return LLViewerTexture::LOD_TEXTURE;
}
bool LLViewerLODTexture::isUpdateFrozen()
{
- return LLViewerTexture::sFreezeImageUpdates;
+ return LLViewerTexture::sFreezeImageUpdates;
}
// This is gauranteed to get called periodically for every texture
@@ -3076,30 +3076,30 @@ bool LLViewerLODTexture::isUpdateFrozen()
void LLViewerLODTexture::processTextureStats()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- updateVirtualSize();
-
- static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes", false);
-
- if (textures_fullres)
- {
- mDesiredDiscardLevel = 0;
- }
- // Generate the request priority and render priority
- else if (mDontDiscard || !mUseMipMaps)
- {
- mDesiredDiscardLevel = 0;
- if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT)
- mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
- }
- else if (mBoostLevel < LLGLTexture::BOOST_HIGH && mMaxVirtualSize <= 10.f)
- {
- // If the image has not been significantly visible in a while, we don't want it
- mDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel, (S8)(MAX_DISCARD_LEVEL + 1));
- }
- else if (!mFullWidth || !mFullHeight)
- {
- mDesiredDiscardLevel = getMaxDiscardLevel();
- }
+ updateVirtualSize();
+
+ static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes", false);
+
+ if (textures_fullres)
+ {
+ mDesiredDiscardLevel = 0;
+ }
+ // Generate the request priority and render priority
+ else if (mDontDiscard || !mUseMipMaps)
+ {
+ mDesiredDiscardLevel = 0;
+ if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT)
+ mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
+ }
+ else if (mBoostLevel < LLGLTexture::BOOST_HIGH && mMaxVirtualSize <= 10.f)
+ {
+ // If the image has not been significantly visible in a while, we don't want it
+ mDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel, (S8)(MAX_DISCARD_LEVEL + 1));
+ }
+ else if (!mFullWidth || !mFullHeight)
+ {
+ mDesiredDiscardLevel = getMaxDiscardLevel();
+ }
else
{
//static const F64 log_2 = log(2.0);
@@ -3156,7 +3156,7 @@ void LLViewerLODTexture::processTextureStats()
//
S32 current_discard = getDiscardLevel();
- if (mBoostLevel < LLGLTexture::BOOST_AVATAR_BAKED &&
+ if (mBoostLevel < LLGLTexture::BOOST_AVATAR_BAKED &&
current_discard >= 0)
{
if (current_discard < (mDesiredDiscardLevel-1) && !mForceToSaveRawImage)
@@ -3165,19 +3165,19 @@ void LLViewerLODTexture::processTextureStats()
}
}
- if (isUpdateFrozen() // we are out of memory and nearing max allowed bias
- && mBoostLevel < LLGLTexture::BOOST_SCULPTED
- && mDesiredDiscardLevel < current_discard)
- {
- // stop requesting more
- mDesiredDiscardLevel = current_discard;
- }
- }
+ if (isUpdateFrozen() // we are out of memory and nearing max allowed bias
+ && mBoostLevel < LLGLTexture::BOOST_SCULPTED
+ && mDesiredDiscardLevel < current_discard)
+ {
+ // stop requesting more
+ mDesiredDiscardLevel = current_discard;
+ }
+ }
- if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0)
- {
- mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel);
- }
+ if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0)
+ {
+ mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel);
+ }
// decay max virtual size over time
mMaxVirtualSize *= 0.8f;
@@ -3192,19 +3192,19 @@ void LLViewerLODTexture::processTextureStats()
bool LLViewerLODTexture::scaleDown()
{
- if(hasGLTexture() && mCachedRawDiscardLevel > getDiscardLevel())
- {
- switchToCachedImage();
+ if(hasGLTexture() && mCachedRawDiscardLevel > getDiscardLevel())
+ {
+ switchToCachedImage();
- LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
- if (tester)
- {
- tester->setStablizingTime();
- }
+ LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
+ if (tester)
+ {
+ tester->setStablizingTime();
+ }
- return true;
- }
- return false;
+ return true;
+ }
+ return false;
}
//----------------------------------------------------------------------------------------------
//end of LLViewerLODTexture
@@ -3217,182 +3217,182 @@ bool LLViewerLODTexture::scaleDown()
void LLViewerMediaTexture::updateClass()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- static const F32 MAX_INACTIVE_TIME = 30.f;
+ static const F32 MAX_INACTIVE_TIME = 30.f;
#if 0
- //force to play media.
- gSavedSettings.setBOOL("AudioStreamingMedia", true);
+ //force to play media.
+ gSavedSettings.setBOOL("AudioStreamingMedia", true);
#endif
- for(media_map_t::iterator iter = sMediaMap.begin(); iter != sMediaMap.end(); )
- {
- LLViewerMediaTexture* mediap = iter->second;
-
- if(mediap->getNumRefs() == 1) //one reference by sMediaMap
- {
- //
- //Note: delay some time to delete the media textures to stop endlessly creating and immediately removing media texture.
- //
- if(mediap->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME)
- {
- media_map_t::iterator cur = iter++;
- sMediaMap.erase(cur);
- continue;
- }
- }
- ++iter;
- }
-}
-
-//static
-void LLViewerMediaTexture::removeMediaImplFromTexture(const LLUUID& media_id)
-{
- LLViewerMediaTexture* media_tex = findMediaTexture(media_id);
- if(media_tex)
- {
- media_tex->invalidateMediaImpl();
- }
+ for(media_map_t::iterator iter = sMediaMap.begin(); iter != sMediaMap.end(); )
+ {
+ LLViewerMediaTexture* mediap = iter->second;
+
+ if(mediap->getNumRefs() == 1) //one reference by sMediaMap
+ {
+ //
+ //Note: delay some time to delete the media textures to stop endlessly creating and immediately removing media texture.
+ //
+ if(mediap->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME)
+ {
+ media_map_t::iterator cur = iter++;
+ sMediaMap.erase(cur);
+ continue;
+ }
+ }
+ ++iter;
+ }
+}
+
+//static
+void LLViewerMediaTexture::removeMediaImplFromTexture(const LLUUID& media_id)
+{
+ LLViewerMediaTexture* media_tex = findMediaTexture(media_id);
+ if(media_tex)
+ {
+ media_tex->invalidateMediaImpl();
+ }
}
//static
void LLViewerMediaTexture::cleanUpClass()
{
- sMediaMap.clear();
+ sMediaMap.clear();
}
//static
LLViewerMediaTexture* LLViewerMediaTexture::findMediaTexture(const LLUUID& media_id)
{
- media_map_t::iterator iter = sMediaMap.find(media_id);
- if(iter == sMediaMap.end())
- {
- return NULL;
- }
+ media_map_t::iterator iter = sMediaMap.find(media_id);
+ if(iter == sMediaMap.end())
+ {
+ return NULL;
+ }
- LLViewerMediaTexture* media_tex = iter->second;
- media_tex->setMediaImpl();
- media_tex->getLastReferencedTimer()->reset();
+ LLViewerMediaTexture* media_tex = iter->second;
+ media_tex->setMediaImpl();
+ media_tex->getLastReferencedTimer()->reset();
- return media_tex;
+ return media_tex;
}
-LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LLImageGL* gl_image)
- : LLViewerTexture(id, usemipmaps),
- mMediaImplp(NULL),
- mUpdateVirtualSizeTime(0)
+LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LLImageGL* gl_image)
+ : LLViewerTexture(id, usemipmaps),
+ mMediaImplp(NULL),
+ mUpdateVirtualSizeTime(0)
{
- sMediaMap.insert(std::make_pair(id, this));
+ sMediaMap.insert(std::make_pair(id, this));
- mGLTexturep = gl_image;
+ mGLTexturep = gl_image;
- if(mGLTexturep.isNull())
- {
- generateGLTexture();
- }
+ if(mGLTexturep.isNull())
+ {
+ generateGLTexture();
+ }
- mGLTexturep->setAllowCompression(false);
+ mGLTexturep->setAllowCompression(false);
- mGLTexturep->setNeedsAlphaAndPickMask(FALSE);
+ mGLTexturep->setNeedsAlphaAndPickMask(FALSE);
- mIsPlaying = FALSE;
+ mIsPlaying = FALSE;
- setMediaImpl();
+ setMediaImpl();
- setCategory(LLGLTexture::MEDIA);
-
- LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
- if(tex) //this media is a parcel media for tex.
- {
- tex->setParcelMedia(this);
- }
+ setCategory(LLGLTexture::MEDIA);
+
+ LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
+ if(tex) //this media is a parcel media for tex.
+ {
+ tex->setParcelMedia(this);
+ }
}
-//virtual
-LLViewerMediaTexture::~LLViewerMediaTexture()
-{
- LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
- if(tex) //this media is a parcel media for tex.
- {
- tex->setParcelMedia(NULL);
- }
+//virtual
+LLViewerMediaTexture::~LLViewerMediaTexture()
+{
+ LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
+ if(tex) //this media is a parcel media for tex.
+ {
+ tex->setParcelMedia(NULL);
+ }
}
void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */)
{
- llassert(mGLTexturep.notNull());
+ llassert(mGLTexturep.notNull());
- mUseMipMaps = usemipmaps;
- getLastReferencedTimer()->reset();
- mGLTexturep->setUseMipMaps(mUseMipMaps);
- mGLTexturep->setNeedsAlphaAndPickMask(FALSE);
+ mUseMipMaps = usemipmaps;
+ getLastReferencedTimer()->reset();
+ mGLTexturep->setUseMipMaps(mUseMipMaps);
+ mGLTexturep->setNeedsAlphaAndPickMask(FALSE);
}
-void LLViewerMediaTexture::setUseMipMaps(BOOL mipmap)
+void LLViewerMediaTexture::setUseMipMaps(BOOL mipmap)
{
- mUseMipMaps = mipmap;
+ mUseMipMaps = mipmap;
- if(mGLTexturep.notNull())
- {
- mGLTexturep->setUseMipMaps(mipmap);
- }
+ if(mGLTexturep.notNull())
+ {
+ mGLTexturep->setUseMipMaps(mipmap);
+ }
}
-//virtual
+//virtual
S8 LLViewerMediaTexture::getType() const
{
- return LLViewerTexture::MEDIA_TEXTURE;
+ return LLViewerTexture::MEDIA_TEXTURE;
}
-void LLViewerMediaTexture::invalidateMediaImpl()
+void LLViewerMediaTexture::invalidateMediaImpl()
{
- mMediaImplp = NULL;
+ mMediaImplp = NULL;
}
void LLViewerMediaTexture::setMediaImpl()
{
- if(!mMediaImplp)
- {
- mMediaImplp = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mID);
- }
+ if(!mMediaImplp)
+ {
+ mMediaImplp = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mID);
+ }
}
//return true if all faces to reference to this media texture are found
-//Note: mMediaFaceList is valid only for the current instant
+//Note: mMediaFaceList is valid only for the current instant
// because it does not check the face validity after the current frame.
BOOL LLViewerMediaTexture::findFaces()
-{
- mMediaFaceList.clear();
-
- BOOL ret = TRUE;
-
- LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
- if(tex) //this media is a parcel media for tex.
- {
- for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
- {
- const ll_face_list_t* face_list = tex->getFaceList(ch);
- U32 end = tex->getNumFaces(ch);
- for(U32 i = 0; i < end; i++)
- {
- if ((*face_list)[i]->isMediaAllowed())
- {
- mMediaFaceList.push_back((*face_list)[i]);
- }
- }
- }
- }
-
- if(!mMediaImplp)
- {
- return TRUE;
- }
-
- //for media on a face.
- const std::list< LLVOVolume* >* obj_list = mMediaImplp->getObjectList();
- std::list< LLVOVolume* >::const_iterator iter = obj_list->begin();
- for(; iter != obj_list->end(); ++iter)
- {
- LLVOVolume* obj = *iter;
+{
+ mMediaFaceList.clear();
+
+ BOOL ret = TRUE;
+
+ LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
+ if(tex) //this media is a parcel media for tex.
+ {
+ for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
+ {
+ const ll_face_list_t* face_list = tex->getFaceList(ch);
+ U32 end = tex->getNumFaces(ch);
+ for(U32 i = 0; i < end; i++)
+ {
+ if ((*face_list)[i]->isMediaAllowed())
+ {
+ mMediaFaceList.push_back((*face_list)[i]);
+ }
+ }
+ }
+ }
+
+ if(!mMediaImplp)
+ {
+ return TRUE;
+ }
+
+ //for media on a face.
+ const std::list< LLVOVolume* >* obj_list = mMediaImplp->getObjectList();
+ std::list< LLVOVolume* >::const_iterator iter = obj_list->begin();
+ for(; iter != obj_list->end(); ++iter)
+ {
+ LLVOVolume* obj = *iter;
if (obj->isDead())
{
// Isn't supposed to happen, objects are supposed to detach
@@ -3410,343 +3410,343 @@ BOOL LLViewerMediaTexture::findFaces()
continue;
}
- S32 face_id = -1;
- S32 num_faces = obj->mDrawable->getNumFaces();
- while((face_id = obj->getFaceIndexWithMediaImpl(mMediaImplp, face_id)) > -1 && face_id < num_faces)
- {
- LLFace* facep = obj->mDrawable->getFace(face_id);
- if(facep)
- {
- mMediaFaceList.push_back(facep);
- }
- else
- {
- ret = FALSE;
- }
- }
- }
-
- return ret;
+ S32 face_id = -1;
+ S32 num_faces = obj->mDrawable->getNumFaces();
+ while((face_id = obj->getFaceIndexWithMediaImpl(mMediaImplp, face_id)) > -1 && face_id < num_faces)
+ {
+ LLFace* facep = obj->mDrawable->getFace(face_id);
+ if(facep)
+ {
+ mMediaFaceList.push_back(facep);
+ }
+ else
+ {
+ ret = FALSE;
+ }
+ }
+ }
+
+ return ret;
}
void LLViewerMediaTexture::initVirtualSize()
{
- if(mIsPlaying)
- {
- return;
- }
-
- findFaces();
- for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter)
- {
- addTextureStats((*iter)->getVirtualSize());
- }
-}
-
-void LLViewerMediaTexture::addMediaToFace(LLFace* facep)
-{
- if(facep)
- {
- facep->setHasMedia(true);
- }
- if(!mIsPlaying)
- {
- return; //no need to add the face because the media is not in playing.
- }
-
- switchTexture(LLRender::DIFFUSE_MAP, facep);
-}
-
-void LLViewerMediaTexture::removeMediaFromFace(LLFace* facep)
-{
- if(!facep)
- {
- return;
- }
- facep->setHasMedia(false);
-
- if(!mIsPlaying)
- {
- return; //no need to remove the face because the media is not in playing.
- }
-
- mIsPlaying = FALSE; //set to remove the media from the face.
- switchTexture(LLRender::DIFFUSE_MAP, facep);
- mIsPlaying = TRUE; //set the flag back.
-
- if(getTotalNumFaces() < 1) //no face referencing to this media
- {
- stopPlaying();
- }
-}
-
-//virtual
-void LLViewerMediaTexture::addFace(U32 ch, LLFace* facep)
-{
- LLViewerTexture::addFace(ch, facep);
-
- const LLTextureEntry* te = facep->getTextureEntry();
- if(te && te->getID().notNull())
- {
- LLViewerTexture* tex = gTextureList.findImage(te->getID(), TEX_LIST_STANDARD);
- if(tex)
- {
- mTextureList.push_back(tex);//increase the reference number by one for tex to avoid deleting it.
- return;
- }
- }
-
- //check if it is a parcel media
- if(facep->getTexture() && facep->getTexture() != this && facep->getTexture()->getID() == mID)
- {
- mTextureList.push_back(facep->getTexture()); //a parcel media.
- return;
- }
-
- if(te && te->getID().notNull()) //should have a texture
- {
+ if(mIsPlaying)
+ {
+ return;
+ }
+
+ findFaces();
+ for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter)
+ {
+ addTextureStats((*iter)->getVirtualSize());
+ }
+}
+
+void LLViewerMediaTexture::addMediaToFace(LLFace* facep)
+{
+ if(facep)
+ {
+ facep->setHasMedia(true);
+ }
+ if(!mIsPlaying)
+ {
+ return; //no need to add the face because the media is not in playing.
+ }
+
+ switchTexture(LLRender::DIFFUSE_MAP, facep);
+}
+
+void LLViewerMediaTexture::removeMediaFromFace(LLFace* facep)
+{
+ if(!facep)
+ {
+ return;
+ }
+ facep->setHasMedia(false);
+
+ if(!mIsPlaying)
+ {
+ return; //no need to remove the face because the media is not in playing.
+ }
+
+ mIsPlaying = FALSE; //set to remove the media from the face.
+ switchTexture(LLRender::DIFFUSE_MAP, facep);
+ mIsPlaying = TRUE; //set the flag back.
+
+ if(getTotalNumFaces() < 1) //no face referencing to this media
+ {
+ stopPlaying();
+ }
+}
+
+//virtual
+void LLViewerMediaTexture::addFace(U32 ch, LLFace* facep)
+{
+ LLViewerTexture::addFace(ch, facep);
+
+ const LLTextureEntry* te = facep->getTextureEntry();
+ if(te && te->getID().notNull())
+ {
+ LLViewerTexture* tex = gTextureList.findImage(te->getID(), TEX_LIST_STANDARD);
+ if(tex)
+ {
+ mTextureList.push_back(tex);//increase the reference number by one for tex to avoid deleting it.
+ return;
+ }
+ }
+
+ //check if it is a parcel media
+ if(facep->getTexture() && facep->getTexture() != this && facep->getTexture()->getID() == mID)
+ {
+ mTextureList.push_back(facep->getTexture()); //a parcel media.
+ return;
+ }
+
+ if(te && te->getID().notNull()) //should have a texture
+ {
LL_WARNS_ONCE() << "The face's texture " << te->getID() << " is not valid. Face must have a valid texture before media texture." << LL_ENDL;
// This might break the object, but it likely isn't a 'recoverable' situation.
LLViewerFetchedTexture* tex = LLViewerTextureManager::getFetchedTexture(te->getID());
mTextureList.push_back(tex);
- }
-}
-
-//virtual
-void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep)
-{
- LLViewerTexture::removeFace(ch, facep);
-
- const LLTextureEntry* te = facep->getTextureEntry();
- if(te && te->getID().notNull())
- {
- LLViewerTexture* tex = gTextureList.findImage(te->getID(), TEX_LIST_STANDARD);
- if(tex)
- {
- for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin();
- iter != mTextureList.end(); ++iter)
- {
- if(*iter == tex)
- {
- mTextureList.erase(iter); //decrease the reference number for tex by one.
- return;
- }
- }
-
- std::vector<const LLTextureEntry*> te_list;
-
- for (U32 ch = 0; ch < 3; ++ch)
- {
- //
- //we have some trouble here: the texture of the face is changed.
- //we need to find the former texture, and remove it from the list to avoid memory leaking.
-
- llassert(mNumFaces[ch] <= mFaceList[ch].size());
-
- for(U32 j = 0; j < mNumFaces[ch]; j++)
- {
- te_list.push_back(mFaceList[ch][j]->getTextureEntry());//all textures are in use.
- }
- }
-
- if (te_list.empty())
- {
- mTextureList.clear();
- return;
- }
-
- S32 end = te_list.size();
-
- for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin();
- iter != mTextureList.end(); ++iter)
- {
- S32 i = 0;
-
- for(i = 0; i < end; i++)
- {
- if(te_list[i] && te_list[i]->getID() == (*iter)->getID())//the texture is in use.
- {
- te_list[i] = NULL;
- break;
- }
- }
- if(i == end) //no hit for this texture, remove it.
- {
- mTextureList.erase(iter); //decrease the reference number for tex by one.
- return;
- }
- }
- }
- }
-
- //check if it is a parcel media
- for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin();
- iter != mTextureList.end(); ++iter)
- {
- if((*iter)->getID() == mID)
- {
- mTextureList.erase(iter); //decrease the reference number for tex by one.
- return;
- }
- }
-
- if(te && te->getID().notNull()) //should have a texture but none found
- {
- LL_ERRS() << "mTextureList texture reference number is corrupted. Texture id: " << te->getID() << " List size: " << (U32)mTextureList.size() << LL_ENDL;
- }
+ }
+}
+
+//virtual
+void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep)
+{
+ LLViewerTexture::removeFace(ch, facep);
+
+ const LLTextureEntry* te = facep->getTextureEntry();
+ if(te && te->getID().notNull())
+ {
+ LLViewerTexture* tex = gTextureList.findImage(te->getID(), TEX_LIST_STANDARD);
+ if(tex)
+ {
+ for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin();
+ iter != mTextureList.end(); ++iter)
+ {
+ if(*iter == tex)
+ {
+ mTextureList.erase(iter); //decrease the reference number for tex by one.
+ return;
+ }
+ }
+
+ std::vector<const LLTextureEntry*> te_list;
+
+ for (U32 ch = 0; ch < 3; ++ch)
+ {
+ //
+ //we have some trouble here: the texture of the face is changed.
+ //we need to find the former texture, and remove it from the list to avoid memory leaking.
+
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+
+ for(U32 j = 0; j < mNumFaces[ch]; j++)
+ {
+ te_list.push_back(mFaceList[ch][j]->getTextureEntry());//all textures are in use.
+ }
+ }
+
+ if (te_list.empty())
+ {
+ mTextureList.clear();
+ return;
+ }
+
+ S32 end = te_list.size();
+
+ for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin();
+ iter != mTextureList.end(); ++iter)
+ {
+ S32 i = 0;
+
+ for(i = 0; i < end; i++)
+ {
+ if(te_list[i] && te_list[i]->getID() == (*iter)->getID())//the texture is in use.
+ {
+ te_list[i] = NULL;
+ break;
+ }
+ }
+ if(i == end) //no hit for this texture, remove it.
+ {
+ mTextureList.erase(iter); //decrease the reference number for tex by one.
+ return;
+ }
+ }
+ }
+ }
+
+ //check if it is a parcel media
+ for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin();
+ iter != mTextureList.end(); ++iter)
+ {
+ if((*iter)->getID() == mID)
+ {
+ mTextureList.erase(iter); //decrease the reference number for tex by one.
+ return;
+ }
+ }
+
+ if(te && te->getID().notNull()) //should have a texture but none found
+ {
+ LL_ERRS() << "mTextureList texture reference number is corrupted. Texture id: " << te->getID() << " List size: " << (U32)mTextureList.size() << LL_ENDL;
+ }
}
void LLViewerMediaTexture::stopPlaying()
{
- // Don't stop the media impl playing here -- this breaks non-inworld media (login screen, search, and media browser).
-// if(mMediaImplp)
-// {
-// mMediaImplp->stop();
-// }
- mIsPlaying = FALSE;
+ // Don't stop the media impl playing here -- this breaks non-inworld media (login screen, search, and media browser).
+// if(mMediaImplp)
+// {
+// mMediaImplp->stop();
+// }
+ mIsPlaying = FALSE;
}
void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep)
{
- if(facep)
- {
- //check if another media is playing on this face.
- if(facep->getTexture() && facep->getTexture() != this
- && facep->getTexture()->getType() == LLViewerTexture::MEDIA_TEXTURE)
- {
- if(mID == facep->getTexture()->getID()) //this is a parcel media
- {
- return; //let the prim media win.
- }
- }
-
- if(mIsPlaying) //old textures switch to the media texture
- {
- facep->switchTexture(ch, this);
- }
- else //switch to old textures.
- {
- const LLTextureEntry* te = facep->getTextureEntry();
- if(te)
- {
- LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), TEX_LIST_STANDARD) : NULL;
- if(!tex && te->getID() != mID)//try parcel media.
- {
- tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
- }
- if(!tex)
- {
- tex = LLViewerFetchedTexture::sDefaultImagep;
- }
- facep->switchTexture(ch, tex);
- }
- }
- }
-}
-
-void LLViewerMediaTexture::setPlaying(BOOL playing)
-{
- if(!mMediaImplp)
- {
- return;
- }
- if(!playing && !mIsPlaying)
- {
- return; //media is already off
- }
-
- if(playing == mIsPlaying && !mMediaImplp->isUpdated())
- {
- return; //nothing has changed since last time.
- }
-
- mIsPlaying = playing;
- if(mIsPlaying) //is about to play this media
- {
- if(findFaces())
- {
- //about to update all faces.
- mMediaImplp->setUpdated(FALSE);
- }
-
- if(mMediaFaceList.empty())//no face pointing to this media
- {
- stopPlaying();
- return;
- }
-
- for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter)
- {
- switchTexture(LLRender::DIFFUSE_MAP, *iter);
- }
- }
- else //stop playing this media
- {
- U32 ch = LLRender::DIFFUSE_MAP;
-
- llassert(mNumFaces[ch] <= mFaceList[ch].size());
- for(U32 i = mNumFaces[ch]; i; i--)
- {
- switchTexture(ch, mFaceList[ch][i - 1]); //current face could be removed in this function.
- }
- }
- return;
-}
-
-//virtual
-F32 LLViewerMediaTexture::getMaxVirtualSize()
-{
- if(LLFrameTimer::getFrameCount() == mUpdateVirtualSizeTime)
- {
- return mMaxVirtualSize;
- }
- mUpdateVirtualSizeTime = LLFrameTimer::getFrameCount();
-
- if(!mMaxVirtualSizeResetCounter)
- {
- addTextureStats(0.f, FALSE);//reset
- }
-
- if(mIsPlaying) //media is playing
- {
- for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
- {
- llassert(mNumFaces[ch] <= mFaceList[ch].size());
- for(U32 i = 0; i < mNumFaces[ch]; i++)
- {
- LLFace* facep = mFaceList[ch][i];
- if(facep->getDrawable()->isRecentlyVisible())
- {
- addTextureStats(facep->getVirtualSize());
- }
- }
- }
- }
- else //media is not in playing
- {
- findFaces();
-
- if(!mMediaFaceList.empty())
- {
- for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter)
- {
- LLFace* facep = *iter;
- if(facep->getDrawable()->isRecentlyVisible())
- {
- addTextureStats(facep->getVirtualSize());
- }
- }
- }
- }
-
- if(mMaxVirtualSizeResetCounter > 0)
- {
- mMaxVirtualSizeResetCounter--;
- }
- reorganizeFaceList();
- reorganizeVolumeList();
-
- return mMaxVirtualSize;
+ if(facep)
+ {
+ //check if another media is playing on this face.
+ if(facep->getTexture() && facep->getTexture() != this
+ && facep->getTexture()->getType() == LLViewerTexture::MEDIA_TEXTURE)
+ {
+ if(mID == facep->getTexture()->getID()) //this is a parcel media
+ {
+ return; //let the prim media win.
+ }
+ }
+
+ if(mIsPlaying) //old textures switch to the media texture
+ {
+ facep->switchTexture(ch, this);
+ }
+ else //switch to old textures.
+ {
+ const LLTextureEntry* te = facep->getTextureEntry();
+ if(te)
+ {
+ LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), TEX_LIST_STANDARD) : NULL;
+ if(!tex && te->getID() != mID)//try parcel media.
+ {
+ tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
+ }
+ if(!tex)
+ {
+ tex = LLViewerFetchedTexture::sDefaultImagep;
+ }
+ facep->switchTexture(ch, tex);
+ }
+ }
+ }
+}
+
+void LLViewerMediaTexture::setPlaying(BOOL playing)
+{
+ if(!mMediaImplp)
+ {
+ return;
+ }
+ if(!playing && !mIsPlaying)
+ {
+ return; //media is already off
+ }
+
+ if(playing == mIsPlaying && !mMediaImplp->isUpdated())
+ {
+ return; //nothing has changed since last time.
+ }
+
+ mIsPlaying = playing;
+ if(mIsPlaying) //is about to play this media
+ {
+ if(findFaces())
+ {
+ //about to update all faces.
+ mMediaImplp->setUpdated(FALSE);
+ }
+
+ if(mMediaFaceList.empty())//no face pointing to this media
+ {
+ stopPlaying();
+ return;
+ }
+
+ for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter)
+ {
+ switchTexture(LLRender::DIFFUSE_MAP, *iter);
+ }
+ }
+ else //stop playing this media
+ {
+ U32 ch = LLRender::DIFFUSE_MAP;
+
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+ for(U32 i = mNumFaces[ch]; i; i--)
+ {
+ switchTexture(ch, mFaceList[ch][i - 1]); //current face could be removed in this function.
+ }
+ }
+ return;
+}
+
+//virtual
+F32 LLViewerMediaTexture::getMaxVirtualSize()
+{
+ if(LLFrameTimer::getFrameCount() == mUpdateVirtualSizeTime)
+ {
+ return mMaxVirtualSize;
+ }
+ mUpdateVirtualSizeTime = LLFrameTimer::getFrameCount();
+
+ if(!mMaxVirtualSizeResetCounter)
+ {
+ addTextureStats(0.f, FALSE);//reset
+ }
+
+ if(mIsPlaying) //media is playing
+ {
+ for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
+ {
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+ for(U32 i = 0; i < mNumFaces[ch]; i++)
+ {
+ LLFace* facep = mFaceList[ch][i];
+ if(facep->getDrawable()->isRecentlyVisible())
+ {
+ addTextureStats(facep->getVirtualSize());
+ }
+ }
+ }
+ }
+ else //media is not in playing
+ {
+ findFaces();
+
+ if(!mMediaFaceList.empty())
+ {
+ for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter)
+ {
+ LLFace* facep = *iter;
+ if(facep->getDrawable()->isRecentlyVisible())
+ {
+ addTextureStats(facep->getVirtualSize());
+ }
+ }
+ }
+ }
+
+ if(mMaxVirtualSizeResetCounter > 0)
+ {
+ mMaxVirtualSizeResetCounter--;
+ }
+ reorganizeFaceList();
+ reorganizeVolumeList();
+
+ return mMaxVirtualSize;
}
//----------------------------------------------------------------------------------------------
//end of LLViewerMediaTexture
@@ -3755,391 +3755,391 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
//----------------------------------------------------------------------------------------------
//start of LLTexturePipelineTester
//----------------------------------------------------------------------------------------------
-LLTexturePipelineTester::LLTexturePipelineTester() : LLMetricPerformanceTesterWithSession(sTesterName)
-{
- addMetric("TotalBytesLoaded");
- addMetric("TotalBytesLoadedFromCache");
- addMetric("TotalBytesLoadedForLargeImage");
- addMetric("TotalBytesLoadedForSculpties");
- addMetric("StartFetchingTime");
- addMetric("TotalGrayTime");
- addMetric("TotalStablizingTime");
- addMetric("StartTimeLoadingSculpties");
- addMetric("EndTimeLoadingSculpties");
-
- addMetric("Time");
- addMetric("TotalBytesBound");
- addMetric("TotalBytesBoundForLargeImage");
- addMetric("PercentageBytesBound");
-
- mTotalBytesLoaded = (S32Bytes)0;
- mTotalBytesLoadedFromCache = (S32Bytes)0;
- mTotalBytesLoadedForLargeImage = (S32Bytes)0;
- mTotalBytesLoadedForSculpties = (S32Bytes)0;
-
- reset();
+LLTexturePipelineTester::LLTexturePipelineTester() : LLMetricPerformanceTesterWithSession(sTesterName)
+{
+ addMetric("TotalBytesLoaded");
+ addMetric("TotalBytesLoadedFromCache");
+ addMetric("TotalBytesLoadedForLargeImage");
+ addMetric("TotalBytesLoadedForSculpties");
+ addMetric("StartFetchingTime");
+ addMetric("TotalGrayTime");
+ addMetric("TotalStablizingTime");
+ addMetric("StartTimeLoadingSculpties");
+ addMetric("EndTimeLoadingSculpties");
+
+ addMetric("Time");
+ addMetric("TotalBytesBound");
+ addMetric("TotalBytesBoundForLargeImage");
+ addMetric("PercentageBytesBound");
+
+ mTotalBytesLoaded = (S32Bytes)0;
+ mTotalBytesLoadedFromCache = (S32Bytes)0;
+ mTotalBytesLoadedForLargeImage = (S32Bytes)0;
+ mTotalBytesLoadedForSculpties = (S32Bytes)0;
+
+ reset();
}
LLTexturePipelineTester::~LLTexturePipelineTester()
{
- LLViewerTextureManager::sTesterp = NULL;
+ LLViewerTextureManager::sTesterp = NULL;
}
void LLTexturePipelineTester::update()
{
- mLastTotalBytesUsed = mTotalBytesUsed;
- mLastTotalBytesUsedForLargeImage = mTotalBytesUsedForLargeImage;
- mTotalBytesUsed = (S32Bytes)0;
- mTotalBytesUsedForLargeImage = (S32Bytes)0;
-
- if(LLAppViewer::getTextureFetch()->getNumRequests() > 0) //fetching list is not empty
- {
- if(mPause)
- {
- //start a new fetching session
- reset();
- mStartFetchingTime = LLImageGL::sLastFrameTime;
- mPause = FALSE;
- }
-
- //update total gray time
- if(mUsingDefaultTexture)
- {
- mUsingDefaultTexture = FALSE;
- mTotalGrayTime = LLImageGL::sLastFrameTime - mStartFetchingTime;
- }
-
- //update the stablizing timer.
- updateStablizingTime();
-
- outputTestResults();
- }
- else if(!mPause)
- {
- //stop the current fetching session
- mPause = TRUE;
- outputTestResults();
- reset();
- }
-}
-
-void LLTexturePipelineTester::reset()
-{
- mPause = TRUE;
-
- mUsingDefaultTexture = FALSE;
- mStartStablizingTime = 0.0f;
- mEndStablizingTime = 0.0f;
-
- mTotalBytesUsed = (S32Bytes)0;
- mTotalBytesUsedForLargeImage = (S32Bytes)0;
- mLastTotalBytesUsed = (S32Bytes)0;
- mLastTotalBytesUsedForLargeImage = (S32Bytes)0;
-
- mStartFetchingTime = 0.0f;
-
- mTotalGrayTime = 0.0f;
- mTotalStablizingTime = 0.0f;
-
- mStartTimeLoadingSculpties = 1.0f;
- mEndTimeLoadingSculpties = 0.0f;
-}
-
-//virtual
-void LLTexturePipelineTester::outputTestRecord(LLSD *sd)
-{
- std::string currentLabel = getCurrentLabelName();
- (*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded.value();
- (*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache.value();
- (*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage.value();
- (*sd)[currentLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties.value();
-
- (*sd)[currentLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime;
- (*sd)[currentLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime;
- (*sd)[currentLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime;
-
- (*sd)[currentLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties;
- (*sd)[currentLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties;
-
- (*sd)[currentLabel]["Time"] = LLImageGL::sLastFrameTime;
- (*sd)[currentLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed.value();
- (*sd)[currentLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage.value();
- (*sd)[currentLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded);
-}
-
-void LLTexturePipelineTester::updateTextureBindingStats(const LLViewerTexture* imagep)
-{
- U32Bytes mem_size = imagep->getTextureMemory();
- mTotalBytesUsed += mem_size;
-
- if(MIN_LARGE_IMAGE_AREA <= (U32)(mem_size.value() / (U32)imagep->getComponents()))
- {
- mTotalBytesUsedForLargeImage += mem_size;
- }
-}
-
-void LLTexturePipelineTester::updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, BOOL from_cache)
-{
- U32Bytes data_size = (U32Bytes)raw_imagep->getDataSize();
- mTotalBytesLoaded += data_size;
-
- if(from_cache)
- {
- mTotalBytesLoadedFromCache += data_size;
- }
-
- if(MIN_LARGE_IMAGE_AREA <= (U32)(data_size.value() / (U32)raw_imagep->getComponents()))
- {
- mTotalBytesLoadedForLargeImage += data_size;
- }
-
- if(imagep->forSculpt())
- {
- mTotalBytesLoadedForSculpties += data_size;
-
- if(mStartTimeLoadingSculpties > mEndTimeLoadingSculpties)
- {
- mStartTimeLoadingSculpties = LLImageGL::sLastFrameTime;
- }
- mEndTimeLoadingSculpties = LLImageGL::sLastFrameTime;
- }
+ mLastTotalBytesUsed = mTotalBytesUsed;
+ mLastTotalBytesUsedForLargeImage = mTotalBytesUsedForLargeImage;
+ mTotalBytesUsed = (S32Bytes)0;
+ mTotalBytesUsedForLargeImage = (S32Bytes)0;
+
+ if(LLAppViewer::getTextureFetch()->getNumRequests() > 0) //fetching list is not empty
+ {
+ if(mPause)
+ {
+ //start a new fetching session
+ reset();
+ mStartFetchingTime = LLImageGL::sLastFrameTime;
+ mPause = FALSE;
+ }
+
+ //update total gray time
+ if(mUsingDefaultTexture)
+ {
+ mUsingDefaultTexture = FALSE;
+ mTotalGrayTime = LLImageGL::sLastFrameTime - mStartFetchingTime;
+ }
+
+ //update the stablizing timer.
+ updateStablizingTime();
+
+ outputTestResults();
+ }
+ else if(!mPause)
+ {
+ //stop the current fetching session
+ mPause = TRUE;
+ outputTestResults();
+ reset();
+ }
+}
+
+void LLTexturePipelineTester::reset()
+{
+ mPause = TRUE;
+
+ mUsingDefaultTexture = FALSE;
+ mStartStablizingTime = 0.0f;
+ mEndStablizingTime = 0.0f;
+
+ mTotalBytesUsed = (S32Bytes)0;
+ mTotalBytesUsedForLargeImage = (S32Bytes)0;
+ mLastTotalBytesUsed = (S32Bytes)0;
+ mLastTotalBytesUsedForLargeImage = (S32Bytes)0;
+
+ mStartFetchingTime = 0.0f;
+
+ mTotalGrayTime = 0.0f;
+ mTotalStablizingTime = 0.0f;
+
+ mStartTimeLoadingSculpties = 1.0f;
+ mEndTimeLoadingSculpties = 0.0f;
+}
+
+//virtual
+void LLTexturePipelineTester::outputTestRecord(LLSD *sd)
+{
+ std::string currentLabel = getCurrentLabelName();
+ (*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded.value();
+ (*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache.value();
+ (*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage.value();
+ (*sd)[currentLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties.value();
+
+ (*sd)[currentLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime;
+ (*sd)[currentLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime;
+ (*sd)[currentLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime;
+
+ (*sd)[currentLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties;
+ (*sd)[currentLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties;
+
+ (*sd)[currentLabel]["Time"] = LLImageGL::sLastFrameTime;
+ (*sd)[currentLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed.value();
+ (*sd)[currentLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage.value();
+ (*sd)[currentLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded);
+}
+
+void LLTexturePipelineTester::updateTextureBindingStats(const LLViewerTexture* imagep)
+{
+ U32Bytes mem_size = imagep->getTextureMemory();
+ mTotalBytesUsed += mem_size;
+
+ if(MIN_LARGE_IMAGE_AREA <= (U32)(mem_size.value() / (U32)imagep->getComponents()))
+ {
+ mTotalBytesUsedForLargeImage += mem_size;
+ }
+}
+
+void LLTexturePipelineTester::updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, BOOL from_cache)
+{
+ U32Bytes data_size = (U32Bytes)raw_imagep->getDataSize();
+ mTotalBytesLoaded += data_size;
+
+ if(from_cache)
+ {
+ mTotalBytesLoadedFromCache += data_size;
+ }
+
+ if(MIN_LARGE_IMAGE_AREA <= (U32)(data_size.value() / (U32)raw_imagep->getComponents()))
+ {
+ mTotalBytesLoadedForLargeImage += data_size;
+ }
+
+ if(imagep->forSculpt())
+ {
+ mTotalBytesLoadedForSculpties += data_size;
+
+ if(mStartTimeLoadingSculpties > mEndTimeLoadingSculpties)
+ {
+ mStartTimeLoadingSculpties = LLImageGL::sLastFrameTime;
+ }
+ mEndTimeLoadingSculpties = LLImageGL::sLastFrameTime;
+ }
}
void LLTexturePipelineTester::updateGrayTextureBinding()
{
- mUsingDefaultTexture = TRUE;
+ mUsingDefaultTexture = TRUE;
}
void LLTexturePipelineTester::setStablizingTime()
{
- if(mStartStablizingTime <= mStartFetchingTime)
- {
- mStartStablizingTime = LLImageGL::sLastFrameTime;
- }
- mEndStablizingTime = LLImageGL::sLastFrameTime;
+ if(mStartStablizingTime <= mStartFetchingTime)
+ {
+ mStartStablizingTime = LLImageGL::sLastFrameTime;
+ }
+ mEndStablizingTime = LLImageGL::sLastFrameTime;
}
void LLTexturePipelineTester::updateStablizingTime()
{
- if(mStartStablizingTime > mStartFetchingTime)
- {
- F32 t = mEndStablizingTime - mStartStablizingTime;
-
- if(t > F_ALMOST_ZERO && (t - mTotalStablizingTime) < F_ALMOST_ZERO)
- {
- //already stablized
- mTotalStablizingTime = LLImageGL::sLastFrameTime - mStartStablizingTime;
-
- //cancel the timer
- mStartStablizingTime = 0.f;
- mEndStablizingTime = 0.f;
- }
- else
- {
- mTotalStablizingTime = t;
- }
- }
- mTotalStablizingTime = 0.f;
-}
-
-//virtual
-void LLTexturePipelineTester::compareTestSessions(llofstream* os)
-{
- LLTexturePipelineTester::LLTextureTestSession* base_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mBaseSessionp);
- LLTexturePipelineTester::LLTextureTestSession* current_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mCurrentSessionp);
- if(!base_sessionp || !current_sessionp)
- {
- LL_ERRS() << "type of test session does not match!" << LL_ENDL;
- }
-
- //compare and output the comparison
- *os << llformat("%s\n", getTesterName().c_str());
- *os << llformat("AggregateResults\n");
-
- compareTestResults(os, "TotalGrayTime", base_sessionp->mTotalGrayTime, current_sessionp->mTotalGrayTime);
- compareTestResults(os, "TotalStablizingTime", base_sessionp->mTotalStablizingTime, current_sessionp->mTotalStablizingTime);
- compareTestResults(os, "StartTimeLoadingSculpties", base_sessionp->mStartTimeLoadingSculpties, current_sessionp->mStartTimeLoadingSculpties);
- compareTestResults(os, "TotalTimeLoadingSculpties", base_sessionp->mTotalTimeLoadingSculpties, current_sessionp->mTotalTimeLoadingSculpties);
-
- compareTestResults(os, "TotalBytesLoaded", base_sessionp->mTotalBytesLoaded, current_sessionp->mTotalBytesLoaded);
- compareTestResults(os, "TotalBytesLoadedFromCache", base_sessionp->mTotalBytesLoadedFromCache, current_sessionp->mTotalBytesLoadedFromCache);
- compareTestResults(os, "TotalBytesLoadedForLargeImage", base_sessionp->mTotalBytesLoadedForLargeImage, current_sessionp->mTotalBytesLoadedForLargeImage);
- compareTestResults(os, "TotalBytesLoadedForSculpties", base_sessionp->mTotalBytesLoadedForSculpties, current_sessionp->mTotalBytesLoadedForSculpties);
-
- *os << llformat("InstantResults\n");
- S32 size = llmin(base_sessionp->mInstantPerformanceListCounter, current_sessionp->mInstantPerformanceListCounter);
- for(S32 i = 0; i < size; i++)
- {
- *os << llformat("Time(B-T)-%.4f-%.4f\n", base_sessionp->mInstantPerformanceList[i].mTime, current_sessionp->mInstantPerformanceList[i].mTime);
-
- compareTestResults(os, "AverageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond,
- current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond);
-
- compareTestResults(os, "AverageBytesUsedForLargeImagePerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond,
- current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond);
-
- compareTestResults(os, "AveragePercentageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond,
- current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond);
- }
-
- if(size < base_sessionp->mInstantPerformanceListCounter)
- {
- for(S32 i = size; i < base_sessionp->mInstantPerformanceListCounter; i++)
- {
- *os << llformat("Time(B-T)-%.4f- \n", base_sessionp->mInstantPerformanceList[i].mTime);
-
- *os << llformat(", AverageBytesUsedPerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond);
- *os << llformat(", AverageBytesUsedForLargeImagePerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond);
- *os << llformat(", AveragePercentageBytesUsedPerSecond, %.4f, N/A \n", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond);
- }
- }
- else if(size < current_sessionp->mInstantPerformanceListCounter)
- {
- for(S32 i = size; i < current_sessionp->mInstantPerformanceListCounter; i++)
- {
- *os << llformat("Time(B-T)- -%.4f\n", current_sessionp->mInstantPerformanceList[i].mTime);
-
- *os << llformat(", AverageBytesUsedPerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond);
- *os << llformat(", AverageBytesUsedForLargeImagePerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond);
- *os << llformat(", AveragePercentageBytesUsedPerSecond, N/A, %.4f\n", current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond);
- }
- }
-}
-
-//virtual
+ if(mStartStablizingTime > mStartFetchingTime)
+ {
+ F32 t = mEndStablizingTime - mStartStablizingTime;
+
+ if(t > F_ALMOST_ZERO && (t - mTotalStablizingTime) < F_ALMOST_ZERO)
+ {
+ //already stablized
+ mTotalStablizingTime = LLImageGL::sLastFrameTime - mStartStablizingTime;
+
+ //cancel the timer
+ mStartStablizingTime = 0.f;
+ mEndStablizingTime = 0.f;
+ }
+ else
+ {
+ mTotalStablizingTime = t;
+ }
+ }
+ mTotalStablizingTime = 0.f;
+}
+
+//virtual
+void LLTexturePipelineTester::compareTestSessions(llofstream* os)
+{
+ LLTexturePipelineTester::LLTextureTestSession* base_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mBaseSessionp);
+ LLTexturePipelineTester::LLTextureTestSession* current_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mCurrentSessionp);
+ if(!base_sessionp || !current_sessionp)
+ {
+ LL_ERRS() << "type of test session does not match!" << LL_ENDL;
+ }
+
+ //compare and output the comparison
+ *os << llformat("%s\n", getTesterName().c_str());
+ *os << llformat("AggregateResults\n");
+
+ compareTestResults(os, "TotalGrayTime", base_sessionp->mTotalGrayTime, current_sessionp->mTotalGrayTime);
+ compareTestResults(os, "TotalStablizingTime", base_sessionp->mTotalStablizingTime, current_sessionp->mTotalStablizingTime);
+ compareTestResults(os, "StartTimeLoadingSculpties", base_sessionp->mStartTimeLoadingSculpties, current_sessionp->mStartTimeLoadingSculpties);
+ compareTestResults(os, "TotalTimeLoadingSculpties", base_sessionp->mTotalTimeLoadingSculpties, current_sessionp->mTotalTimeLoadingSculpties);
+
+ compareTestResults(os, "TotalBytesLoaded", base_sessionp->mTotalBytesLoaded, current_sessionp->mTotalBytesLoaded);
+ compareTestResults(os, "TotalBytesLoadedFromCache", base_sessionp->mTotalBytesLoadedFromCache, current_sessionp->mTotalBytesLoadedFromCache);
+ compareTestResults(os, "TotalBytesLoadedForLargeImage", base_sessionp->mTotalBytesLoadedForLargeImage, current_sessionp->mTotalBytesLoadedForLargeImage);
+ compareTestResults(os, "TotalBytesLoadedForSculpties", base_sessionp->mTotalBytesLoadedForSculpties, current_sessionp->mTotalBytesLoadedForSculpties);
+
+ *os << llformat("InstantResults\n");
+ S32 size = llmin(base_sessionp->mInstantPerformanceListCounter, current_sessionp->mInstantPerformanceListCounter);
+ for(S32 i = 0; i < size; i++)
+ {
+ *os << llformat("Time(B-T)-%.4f-%.4f\n", base_sessionp->mInstantPerformanceList[i].mTime, current_sessionp->mInstantPerformanceList[i].mTime);
+
+ compareTestResults(os, "AverageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond,
+ current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond);
+
+ compareTestResults(os, "AverageBytesUsedForLargeImagePerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond,
+ current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond);
+
+ compareTestResults(os, "AveragePercentageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond,
+ current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond);
+ }
+
+ if(size < base_sessionp->mInstantPerformanceListCounter)
+ {
+ for(S32 i = size; i < base_sessionp->mInstantPerformanceListCounter; i++)
+ {
+ *os << llformat("Time(B-T)-%.4f- \n", base_sessionp->mInstantPerformanceList[i].mTime);
+
+ *os << llformat(", AverageBytesUsedPerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond);
+ *os << llformat(", AverageBytesUsedForLargeImagePerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond);
+ *os << llformat(", AveragePercentageBytesUsedPerSecond, %.4f, N/A \n", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond);
+ }
+ }
+ else if(size < current_sessionp->mInstantPerformanceListCounter)
+ {
+ for(S32 i = size; i < current_sessionp->mInstantPerformanceListCounter; i++)
+ {
+ *os << llformat("Time(B-T)- -%.4f\n", current_sessionp->mInstantPerformanceList[i].mTime);
+
+ *os << llformat(", AverageBytesUsedPerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond);
+ *os << llformat(", AverageBytesUsedForLargeImagePerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond);
+ *os << llformat(", AveragePercentageBytesUsedPerSecond, N/A, %.4f\n", current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond);
+ }
+ }
+}
+
+//virtual
LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::loadTestSession(LLSD* log)
{
- LLTexturePipelineTester::LLTextureTestSession* sessionp = new LLTexturePipelineTester::LLTextureTestSession();
- if(!sessionp)
- {
- return NULL;
- }
-
- F32 total_gray_time = 0.f;
- F32 total_stablizing_time = 0.f;
- F32 total_loading_sculpties_time = 0.f;
-
- F32 start_fetching_time = -1.f;
- F32 start_fetching_sculpties_time = 0.f;
-
- F32 last_time = 0.0f;
- S32 frame_count = 0;
-
- sessionp->mInstantPerformanceListCounter = 0;
- sessionp->mInstantPerformanceList.resize(128);
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f;
-
- //load a session
- std::string currentLabel = getCurrentLabelName();
- BOOL in_log = (*log).has(currentLabel);
- while (in_log)
- {
- LLSD::String label = currentLabel;
-
- if(sessionp->mInstantPerformanceListCounter >= (S32)sessionp->mInstantPerformanceList.size())
- {
- sessionp->mInstantPerformanceList.resize(sessionp->mInstantPerformanceListCounter + 128);
- }
-
- //time
- F32 start_time = (*log)[label]["StartFetchingTime"].asReal();
- F32 cur_time = (*log)[label]["Time"].asReal();
- if(start_time - start_fetching_time > F_ALMOST_ZERO) //fetching has paused for a while
- {
- sessionp->mTotalGrayTime += total_gray_time;
- sessionp->mTotalStablizingTime += total_stablizing_time;
-
- sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time;
- sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time;
-
- start_fetching_time = start_time;
- total_gray_time = 0.f;
- total_stablizing_time = 0.f;
- total_loading_sculpties_time = 0.f;
- }
- else
- {
- total_gray_time = (*log)[label]["TotalGrayTime"].asReal();
- total_stablizing_time = (*log)[label]["TotalStablizingTime"].asReal();
-
- total_loading_sculpties_time = (*log)[label]["EndTimeLoadingSculpties"].asReal() - (*log)[label]["StartTimeLoadingSculpties"].asReal();
- if(start_fetching_sculpties_time < 0.f && total_loading_sculpties_time > 0.f)
- {
- start_fetching_sculpties_time = (*log)[label]["StartTimeLoadingSculpties"].asReal();
- }
- }
-
- //total loaded bytes
- sessionp->mTotalBytesLoaded = (*log)[label]["TotalBytesLoaded"].asInteger();
- sessionp->mTotalBytesLoadedFromCache = (*log)[label]["TotalBytesLoadedFromCache"].asInteger();
- sessionp->mTotalBytesLoadedForLargeImage = (*log)[label]["TotalBytesLoadedForLargeImage"].asInteger();
- sessionp->mTotalBytesLoadedForSculpties = (*log)[label]["TotalBytesLoadedForSculpties"].asInteger();
-
- //instant metrics
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond +=
- (*log)[label]["TotalBytesBound"].asInteger();
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond +=
- (*log)[label]["TotalBytesBoundForLargeImage"].asInteger();
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond +=
- (*log)[label]["PercentageBytesBound"].asReal();
- frame_count++;
- if(cur_time - last_time >= 1.0f)
- {
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond /= frame_count;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond /= frame_count;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond /= frame_count;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = last_time;
-
- frame_count = 0;
- last_time = cur_time;
- sessionp->mInstantPerformanceListCounter++;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f;
- sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f;
- }
- // Next label
- incrementCurrentCount();
- currentLabel = getCurrentLabelName();
- in_log = (*log).has(currentLabel);
- }
-
- sessionp->mTotalGrayTime += total_gray_time;
- sessionp->mTotalStablizingTime += total_stablizing_time;
-
- if(sessionp->mStartTimeLoadingSculpties < 0.f)
- {
- sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time;
- }
- sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time;
-
- return sessionp;
-}
-
-LLTexturePipelineTester::LLTextureTestSession::LLTextureTestSession()
-{
- reset();
-}
-LLTexturePipelineTester::LLTextureTestSession::~LLTextureTestSession()
-{
-}
-void LLTexturePipelineTester::LLTextureTestSession::reset()
-{
- mTotalGrayTime = 0.0f;
- mTotalStablizingTime = 0.0f;
-
- mStartTimeLoadingSculpties = 0.0f;
- mTotalTimeLoadingSculpties = 0.0f;
-
- mTotalBytesLoaded = 0;
- mTotalBytesLoadedFromCache = 0;
- mTotalBytesLoadedForLargeImage = 0;
- mTotalBytesLoadedForSculpties = 0;
-
- mInstantPerformanceListCounter = 0;
+ LLTexturePipelineTester::LLTextureTestSession* sessionp = new LLTexturePipelineTester::LLTextureTestSession();
+ if(!sessionp)
+ {
+ return NULL;
+ }
+
+ F32 total_gray_time = 0.f;
+ F32 total_stablizing_time = 0.f;
+ F32 total_loading_sculpties_time = 0.f;
+
+ F32 start_fetching_time = -1.f;
+ F32 start_fetching_sculpties_time = 0.f;
+
+ F32 last_time = 0.0f;
+ S32 frame_count = 0;
+
+ sessionp->mInstantPerformanceListCounter = 0;
+ sessionp->mInstantPerformanceList.resize(128);
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f;
+
+ //load a session
+ std::string currentLabel = getCurrentLabelName();
+ BOOL in_log = (*log).has(currentLabel);
+ while (in_log)
+ {
+ LLSD::String label = currentLabel;
+
+ if(sessionp->mInstantPerformanceListCounter >= (S32)sessionp->mInstantPerformanceList.size())
+ {
+ sessionp->mInstantPerformanceList.resize(sessionp->mInstantPerformanceListCounter + 128);
+ }
+
+ //time
+ F32 start_time = (*log)[label]["StartFetchingTime"].asReal();
+ F32 cur_time = (*log)[label]["Time"].asReal();
+ if(start_time - start_fetching_time > F_ALMOST_ZERO) //fetching has paused for a while
+ {
+ sessionp->mTotalGrayTime += total_gray_time;
+ sessionp->mTotalStablizingTime += total_stablizing_time;
+
+ sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time;
+ sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time;
+
+ start_fetching_time = start_time;
+ total_gray_time = 0.f;
+ total_stablizing_time = 0.f;
+ total_loading_sculpties_time = 0.f;
+ }
+ else
+ {
+ total_gray_time = (*log)[label]["TotalGrayTime"].asReal();
+ total_stablizing_time = (*log)[label]["TotalStablizingTime"].asReal();
+
+ total_loading_sculpties_time = (*log)[label]["EndTimeLoadingSculpties"].asReal() - (*log)[label]["StartTimeLoadingSculpties"].asReal();
+ if(start_fetching_sculpties_time < 0.f && total_loading_sculpties_time > 0.f)
+ {
+ start_fetching_sculpties_time = (*log)[label]["StartTimeLoadingSculpties"].asReal();
+ }
+ }
+
+ //total loaded bytes
+ sessionp->mTotalBytesLoaded = (*log)[label]["TotalBytesLoaded"].asInteger();
+ sessionp->mTotalBytesLoadedFromCache = (*log)[label]["TotalBytesLoadedFromCache"].asInteger();
+ sessionp->mTotalBytesLoadedForLargeImage = (*log)[label]["TotalBytesLoadedForLargeImage"].asInteger();
+ sessionp->mTotalBytesLoadedForSculpties = (*log)[label]["TotalBytesLoadedForSculpties"].asInteger();
+
+ //instant metrics
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond +=
+ (*log)[label]["TotalBytesBound"].asInteger();
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond +=
+ (*log)[label]["TotalBytesBoundForLargeImage"].asInteger();
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond +=
+ (*log)[label]["PercentageBytesBound"].asReal();
+ frame_count++;
+ if(cur_time - last_time >= 1.0f)
+ {
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond /= frame_count;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond /= frame_count;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond /= frame_count;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = last_time;
+
+ frame_count = 0;
+ last_time = cur_time;
+ sessionp->mInstantPerformanceListCounter++;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f;
+ sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f;
+ }
+ // Next label
+ incrementCurrentCount();
+ currentLabel = getCurrentLabelName();
+ in_log = (*log).has(currentLabel);
+ }
+
+ sessionp->mTotalGrayTime += total_gray_time;
+ sessionp->mTotalStablizingTime += total_stablizing_time;
+
+ if(sessionp->mStartTimeLoadingSculpties < 0.f)
+ {
+ sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time;
+ }
+ sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time;
+
+ return sessionp;
+}
+
+LLTexturePipelineTester::LLTextureTestSession::LLTextureTestSession()
+{
+ reset();
+}
+LLTexturePipelineTester::LLTextureTestSession::~LLTextureTestSession()
+{
+}
+void LLTexturePipelineTester::LLTextureTestSession::reset()
+{
+ mTotalGrayTime = 0.0f;
+ mTotalStablizingTime = 0.0f;
+
+ mStartTimeLoadingSculpties = 0.0f;
+ mTotalTimeLoadingSculpties = 0.0f;
+
+ mTotalBytesLoaded = 0;
+ mTotalBytesLoadedFromCache = 0;
+ mTotalBytesLoadedForLargeImage = 0;
+ mTotalBytesLoadedForSculpties = 0;
+
+ mInstantPerformanceListCounter = 0;
}
//----------------------------------------------------------------------------------------------
//end of LLTexturePipelineTester
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 35fb0a2237..8c44f6e6c0 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -1,30 +1,30 @@
-/**
+/**
* @file llviewertexture.h
* @brief Object for managing images and their textures
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-#ifndef LL_LLVIEWERTEXTURE_H
+#ifndef LL_LLVIEWERTEXTURE_H
#define LL_LLVIEWERTEXTURE_H
#include "llatomic.h"
@@ -54,7 +54,7 @@ class LLViewerMediaTexture ;
class LLTexturePipelineTester ;
-typedef void (*loaded_callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata );
+typedef void (*loaded_callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata );
class LLFileSystem;
class LLMessageSystem;
@@ -68,26 +68,26 @@ public:
typedef std::set< LLTextureKey > source_callback_list_t;
public:
- LLLoadedCallbackEntry(loaded_callback_func cb,
- S32 discard_level,
- BOOL need_imageraw, // Needs image raw for the callback
- void* userdata,
- source_callback_list_t* src_callback_list,
- LLViewerFetchedTexture* target,
- BOOL pause);
- ~LLLoadedCallbackEntry();
- void removeTexture(LLViewerFetchedTexture* tex) ;
-
- loaded_callback_func mCallback;
- S32 mLastUsedDiscard;
- S32 mDesiredDiscard;
- BOOL mNeedsImageRaw;
- BOOL mPaused;
- void* mUserData;
- source_callback_list_t* mSourceCallbackList;
-
+ LLLoadedCallbackEntry(loaded_callback_func cb,
+ S32 discard_level,
+ BOOL need_imageraw, // Needs image raw for the callback
+ void* userdata,
+ source_callback_list_t* src_callback_list,
+ LLViewerFetchedTexture* target,
+ BOOL pause);
+ ~LLLoadedCallbackEntry();
+ void removeTexture(LLViewerFetchedTexture* tex) ;
+
+ loaded_callback_func mCallback;
+ S32 mLastUsedDiscard;
+ S32 mDesiredDiscard;
+ BOOL mNeedsImageRaw;
+ BOOL mPaused;
+ void* mUserData;
+ source_callback_list_t* mSourceCallbackList;
+
public:
- static void cleanUpCallbackList(LLLoadedCallbackEntry::source_callback_list_t* callback_list) ;
+ static void cleanUpCallbackList(LLLoadedCallbackEntry::source_callback_list_t* callback_list) ;
};
class LLTextureBar;
@@ -95,163 +95,163 @@ class LLTextureBar;
class LLViewerTexture : public LLGLTexture
{
public:
- enum
- {
- LOCAL_TEXTURE,
- MEDIA_TEXTURE,
- DYNAMIC_TEXTURE,
- FETCHED_TEXTURE,
- LOD_TEXTURE,
- ATLAS_TEXTURE,
- INVALID_TEXTURE_TYPE
- };
+ enum
+ {
+ LOCAL_TEXTURE,
+ MEDIA_TEXTURE,
+ DYNAMIC_TEXTURE,
+ FETCHED_TEXTURE,
+ LOD_TEXTURE,
+ ATLAS_TEXTURE,
+ INVALID_TEXTURE_TYPE
+ };
- typedef std::vector<class LLFace*> ll_face_list_t;
- typedef std::vector<LLVOVolume*> ll_volume_list_t;
+ typedef std::vector<class LLFace*> ll_face_list_t;
+ typedef std::vector<LLVOVolume*> ll_volume_list_t;
protected:
- virtual ~LLViewerTexture();
- LOG_CLASS(LLViewerTexture);
-
-public:
- static void initClass();
- static void updateClass();
-
- LLViewerTexture(BOOL usemipmaps = TRUE);
- LLViewerTexture(const LLUUID& id, BOOL usemipmaps) ;
- LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) ;
- LLViewerTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) ;
-
- virtual S8 getType() const;
- virtual BOOL isMissingAsset() const ;
- virtual void dump(); // debug info to LL_INFOS()
-
+ virtual ~LLViewerTexture();
+ LOG_CLASS(LLViewerTexture);
+
+public:
+ static void initClass();
+ static void updateClass();
+
+ LLViewerTexture(BOOL usemipmaps = TRUE);
+ LLViewerTexture(const LLUUID& id, BOOL usemipmaps) ;
+ LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) ;
+ LLViewerTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) ;
+
+ virtual S8 getType() const;
+ virtual BOOL isMissingAsset() const ;
+ virtual void dump(); // debug info to LL_INFOS()
+
virtual bool isViewerMediaTexture() const { return false; }
- /*virtual*/ bool bindDefaultImage(const S32 stage = 0) ;
- /*virtual*/ bool bindDebugImage(const S32 stage = 0) ;
- /*virtual*/ void forceImmediateUpdate() ;
- /*virtual*/ bool isActiveFetching();
-
- /*virtual*/ const LLUUID& getID() const { return mID; }
- virtual void setBoostLevel(S32 level);
- S32 getBoostLevel() { return mBoostLevel; }
- void setTextureListType(S32 tex_type) { mTextureListType = tex_type; }
- S32 getTextureListType() { return mTextureListType; }
-
- void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const;
- void resetTextureStats();
- void setMaxVirtualSizeResetInterval(S32 interval)const {mMaxVirtualSizeResetInterval = interval;}
- void resetMaxVirtualSizeResetCounter()const {mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval;}
- S32 getMaxVirtualSizeResetCounter() const { return mMaxVirtualSizeResetCounter; }
-
- virtual F32 getMaxVirtualSize() ;
-
- LLFrameTimer* getLastReferencedTimer() {return &mLastReferencedTimer ;}
-
- S32 getFullWidth() const { return mFullWidth; }
- S32 getFullHeight() const { return mFullHeight; }
- /*virtual*/ void setKnownDrawSize(S32 width, S32 height);
-
- virtual void addFace(U32 channel, LLFace* facep) ;
- virtual void removeFace(U32 channel, LLFace* facep) ;
- S32 getTotalNumFaces() const;
- S32 getNumFaces(U32 ch) const;
- const ll_face_list_t* getFaceList(U32 channel) const {llassert(channel < LLRender::NUM_TEXTURE_CHANNELS); return &mFaceList[channel];}
-
- virtual void addVolume(U32 channel, LLVOVolume* volumep);
- virtual void removeVolume(U32 channel, LLVOVolume* volumep);
- S32 getNumVolumes(U32 channel) const;
- const ll_volume_list_t* getVolumeList(U32 channel) const { return &mVolumeList[channel]; }
-
-
- virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ;
- BOOL isLargeImage() ;
-
- void setParcelMedia(LLViewerMediaTexture* media) {mParcelMedia = media;}
- BOOL hasParcelMedia() const { return mParcelMedia != NULL;}
- LLViewerMediaTexture* getParcelMedia() const { return mParcelMedia;}
-
- /*virtual*/ void updateBindStatsForTester() ;
+ /*virtual*/ bool bindDefaultImage(const S32 stage = 0) ;
+ /*virtual*/ bool bindDebugImage(const S32 stage = 0) ;
+ /*virtual*/ void forceImmediateUpdate() ;
+ /*virtual*/ bool isActiveFetching();
+
+ /*virtual*/ const LLUUID& getID() const { return mID; }
+ virtual void setBoostLevel(S32 level);
+ S32 getBoostLevel() { return mBoostLevel; }
+ void setTextureListType(S32 tex_type) { mTextureListType = tex_type; }
+ S32 getTextureListType() { return mTextureListType; }
+
+ void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const;
+ void resetTextureStats();
+ void setMaxVirtualSizeResetInterval(S32 interval)const {mMaxVirtualSizeResetInterval = interval;}
+ void resetMaxVirtualSizeResetCounter()const {mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval;}
+ S32 getMaxVirtualSizeResetCounter() const { return mMaxVirtualSizeResetCounter; }
+
+ virtual F32 getMaxVirtualSize() ;
+
+ LLFrameTimer* getLastReferencedTimer() {return &mLastReferencedTimer ;}
+
+ S32 getFullWidth() const { return mFullWidth; }
+ S32 getFullHeight() const { return mFullHeight; }
+ /*virtual*/ void setKnownDrawSize(S32 width, S32 height);
+
+ virtual void addFace(U32 channel, LLFace* facep) ;
+ virtual void removeFace(U32 channel, LLFace* facep) ;
+ S32 getTotalNumFaces() const;
+ S32 getNumFaces(U32 ch) const;
+ const ll_face_list_t* getFaceList(U32 channel) const {llassert(channel < LLRender::NUM_TEXTURE_CHANNELS); return &mFaceList[channel];}
+
+ virtual void addVolume(U32 channel, LLVOVolume* volumep);
+ virtual void removeVolume(U32 channel, LLVOVolume* volumep);
+ S32 getNumVolumes(U32 channel) const;
+ const ll_volume_list_t* getVolumeList(U32 channel) const { return &mVolumeList[channel]; }
+
+
+ virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ;
+ BOOL isLargeImage() ;
+
+ void setParcelMedia(LLViewerMediaTexture* media) {mParcelMedia = media;}
+ BOOL hasParcelMedia() const { return mParcelMedia != NULL;}
+ LLViewerMediaTexture* getParcelMedia() const { return mParcelMedia;}
+
+ /*virtual*/ void updateBindStatsForTester() ;
protected:
- void cleanup() ;
- void init(bool firstinit) ;
- void reorganizeFaceList() ;
- void reorganizeVolumeList();
+ void cleanup() ;
+ void init(bool firstinit) ;
+ void reorganizeFaceList() ;
+ void reorganizeVolumeList();
private:
- friend class LLBumpImageList;
- friend class LLUIImageList;
+ friend class LLBumpImageList;
+ friend class LLUIImageList;
- virtual void switchToCachedImage();
-
- static void getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &physical);
+ virtual void switchToCachedImage();
+
+ static void getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &physical);
public:
static bool isMemoryForTextureLow();
protected:
friend class LLViewerTextureList;
- LLUUID mID;
- S32 mTextureListType; // along with mID identifies where to search for this texture in TextureList
+ LLUUID mID;
+ S32 mTextureListType; // along with mID identifies where to search for this texture in TextureList
- mutable F32 mMaxVirtualSize = 0.f; // The largest virtual size of the image, in pixels - how much data to we need?
- mutable S32 mMaxVirtualSizeResetCounter;
- mutable S32 mMaxVirtualSizeResetInterval;
- LLFrameTimer mLastReferencedTimer;
+ mutable F32 mMaxVirtualSize = 0.f; // The largest virtual size of the image, in pixels - how much data to we need?
+ mutable S32 mMaxVirtualSizeResetCounter;
+ mutable S32 mMaxVirtualSizeResetInterval;
+ LLFrameTimer mLastReferencedTimer;
- ll_face_list_t mFaceList[LLRender::NUM_TEXTURE_CHANNELS]; //reverse pointer pointing to the faces using this image as texture
- U32 mNumFaces[LLRender::NUM_TEXTURE_CHANNELS];
- LLFrameTimer mLastFaceListUpdateTimer ;
+ ll_face_list_t mFaceList[LLRender::NUM_TEXTURE_CHANNELS]; //reverse pointer pointing to the faces using this image as texture
+ U32 mNumFaces[LLRender::NUM_TEXTURE_CHANNELS];
+ LLFrameTimer mLastFaceListUpdateTimer ;
- ll_volume_list_t mVolumeList[LLRender::NUM_VOLUME_TEXTURE_CHANNELS];
- U32 mNumVolumes[LLRender::NUM_VOLUME_TEXTURE_CHANNELS];
- LLFrameTimer mLastVolumeListUpdateTimer;
+ ll_volume_list_t mVolumeList[LLRender::NUM_VOLUME_TEXTURE_CHANNELS];
+ U32 mNumVolumes[LLRender::NUM_VOLUME_TEXTURE_CHANNELS];
+ LLFrameTimer mLastVolumeListUpdateTimer;
- //do not use LLPointer here.
- LLViewerMediaTexture* mParcelMedia ;
+ //do not use LLPointer here.
+ LLViewerMediaTexture* mParcelMedia ;
- LL::WorkQueue::weak_t mMainQueue;
- LL::WorkQueue::weak_t mImageQueue;
+ LL::WorkQueue::weak_t mMainQueue;
+ LL::WorkQueue::weak_t mImageQueue;
public:
- static const U32 sCurrentFileVersion;
- static S32 sImageCount;
- static S32 sRawCount;
- static S32 sAuxCount;
- static LLFrameTimer sEvaluationTimer;
- static F32 sDesiredDiscardBias;
- static F32 sDesiredDiscardScale;
- static S32 sMaxSculptRez ;
- static U32 sMinLargeImageSize ;
- static U32 sMaxSmallImageSize ;
- static bool sFreezeImageUpdates;
- static F32 sCurrentTime ;
-
- enum EDebugTexels
- {
- DEBUG_TEXELS_OFF,
- DEBUG_TEXELS_CURRENT,
- DEBUG_TEXELS_DESIRED,
- DEBUG_TEXELS_FULL
- };
-
- static EDebugTexels sDebugTexelsMode;
-
- static LLPointer<LLViewerTexture> sNullImagep; // Null texture for non-textured objects.
- static LLPointer<LLViewerTexture> sBlackImagep; // Texture to show NOTHING (pure black)
- static LLPointer<LLViewerTexture> sCheckerBoardImagep; // Texture to show NOTHING (pure black)
+ static const U32 sCurrentFileVersion;
+ static S32 sImageCount;
+ static S32 sRawCount;
+ static S32 sAuxCount;
+ static LLFrameTimer sEvaluationTimer;
+ static F32 sDesiredDiscardBias;
+ static F32 sDesiredDiscardScale;
+ static S32 sMaxSculptRez ;
+ static U32 sMinLargeImageSize ;
+ static U32 sMaxSmallImageSize ;
+ static bool sFreezeImageUpdates;
+ static F32 sCurrentTime ;
+
+ enum EDebugTexels
+ {
+ DEBUG_TEXELS_OFF,
+ DEBUG_TEXELS_CURRENT,
+ DEBUG_TEXELS_DESIRED,
+ DEBUG_TEXELS_FULL
+ };
+
+ static EDebugTexels sDebugTexelsMode;
+
+ static LLPointer<LLViewerTexture> sNullImagep; // Null texture for non-textured objects.
+ static LLPointer<LLViewerTexture> sBlackImagep; // Texture to show NOTHING (pure black)
+ static LLPointer<LLViewerTexture> sCheckerBoardImagep; // Texture to show NOTHING (pure black)
};
enum FTType
{
- FTT_UNKNOWN = -1,
- FTT_DEFAULT = 0, // standard texture fetched by id.
- FTT_SERVER_BAKE, // texture produced by appearance service and fetched from there.
- FTT_HOST_BAKE, // old-style baked texture uploaded by viewer and fetched from avatar's host.
- FTT_MAP_TILE, // tiles are fetched from map server directly.
- FTT_LOCAL_FILE // fetch directly from a local file.
+ FTT_UNKNOWN = -1,
+ FTT_DEFAULT = 0, // standard texture fetched by id.
+ FTT_SERVER_BAKE, // texture produced by appearance service and fetched from there.
+ FTT_HOST_BAKE, // old-style baked texture uploaded by viewer and fetched from avatar's host.
+ FTT_MAP_TILE, // tiles are fetched from map server directly.
+ FTT_LOCAL_FILE // fetch directly from a local file.
};
const std::string& fttype_to_string(const FTType& fttype);
@@ -263,269 +263,269 @@ const std::string& fttype_to_string(const FTType& fttype);
//
class LLViewerFetchedTexture : public LLViewerTexture
{
- friend class LLTextureBar; // debug info only
- friend class LLTextureView; // debug info only
+ friend class LLTextureBar; // debug info only
+ friend class LLTextureView; // debug info only
protected:
- /*virtual*/ ~LLViewerFetchedTexture();
+ /*virtual*/ ~LLViewerFetchedTexture();
public:
- LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE);
- LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps);
- LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
+ LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE);
+ LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps);
+ LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
public:
-
- struct Compare
- {
- // lhs < rhs
- bool operator()(const LLPointer<LLViewerFetchedTexture> &lhs, const LLPointer<LLViewerFetchedTexture> &rhs) const
- {
- const LLViewerFetchedTexture* lhsp = (const LLViewerFetchedTexture*)lhs;
- const LLViewerFetchedTexture* rhsp = (const LLViewerFetchedTexture*)rhs;
-
- // greater priority is "less"
- const F32 lpriority = lhsp->mMaxVirtualSize;
- const F32 rpriority = rhsp->mMaxVirtualSize;
- if (lpriority > rpriority) // higher priority
- return true;
- if (lpriority < rpriority)
- return false;
- return lhsp < rhsp;
- }
- };
+
+ struct Compare
+ {
+ // lhs < rhs
+ bool operator()(const LLPointer<LLViewerFetchedTexture> &lhs, const LLPointer<LLViewerFetchedTexture> &rhs) const
+ {
+ const LLViewerFetchedTexture* lhsp = (const LLViewerFetchedTexture*)lhs;
+ const LLViewerFetchedTexture* rhsp = (const LLViewerFetchedTexture*)rhs;
+
+ // greater priority is "less"
+ const F32 lpriority = lhsp->mMaxVirtualSize;
+ const F32 rpriority = rhsp->mMaxVirtualSize;
+ if (lpriority > rpriority) // higher priority
+ return true;
+ if (lpriority < rpriority)
+ return false;
+ return lhsp < rhsp;
+ }
+ };
public:
- /*virtual*/ S8 getType() const override;
- FTType getFTType() const;
- /*virtual*/ void forceImmediateUpdate() override;
- /*virtual*/ void dump() override;
-
- // Set callbacks to get called when the image gets updated with higher
- // resolution versions.
- void setLoadedCallback(loaded_callback_func cb,
- S32 discard_level, BOOL keep_imageraw, BOOL needs_aux,
- void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause = FALSE);
- bool hasCallbacks() { return mLoadedCallbackList.empty() ? false : true; }
- void pauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list);
- void unpauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list);
- bool doLoadedCallbacks();
- void deleteCallbackEntry(const LLLoadedCallbackEntry::source_callback_list_t* callback_list);
- void clearCallbackEntryList() ;
-
- void addToCreateTexture();
+ /*virtual*/ S8 getType() const override;
+ FTType getFTType() const;
+ /*virtual*/ void forceImmediateUpdate() override;
+ /*virtual*/ void dump() override;
+
+ // Set callbacks to get called when the image gets updated with higher
+ // resolution versions.
+ void setLoadedCallback(loaded_callback_func cb,
+ S32 discard_level, BOOL keep_imageraw, BOOL needs_aux,
+ void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause = FALSE);
+ bool hasCallbacks() { return mLoadedCallbackList.empty() ? false : true; }
+ void pauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list);
+ void unpauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list);
+ bool doLoadedCallbacks();
+ void deleteCallbackEntry(const LLLoadedCallbackEntry::source_callback_list_t* callback_list);
+ void clearCallbackEntryList() ;
+
+ void addToCreateTexture();
//call to determine if createTexture is necessary
BOOL preCreateTexture(S32 usename = 0);
- // ONLY call from LLViewerTextureList or ImageGL background thread
- BOOL createTexture(S32 usename = 0);
+ // ONLY call from LLViewerTextureList or ImageGL background thread
+ BOOL createTexture(S32 usename = 0);
void postCreateTexture();
void scheduleCreateTexture();
- void destroyTexture() ;
+ void destroyTexture() ;
- virtual void processTextureStats() ;
+ virtual void processTextureStats() ;
- BOOL needsAux() const { return mNeedsAux; }
+ BOOL needsAux() const { return mNeedsAux; }
- // Host we think might have this image, used for baked av textures.
- void setTargetHost(LLHost host) { mTargetHost = host; }
- LLHost getTargetHost() const { return mTargetHost; }
-
- void updateVirtualSize() ;
+ // Host we think might have this image, used for baked av textures.
+ void setTargetHost(LLHost host) { mTargetHost = host; }
+ LLHost getTargetHost() const { return mTargetHost; }
- S32 getDesiredDiscardLevel() { return mDesiredDiscardLevel; }
- void setMinDiscardLevel(S32 discard) { mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel,(S8)discard); }
+ void updateVirtualSize() ;
+
+ S32 getDesiredDiscardLevel() { return mDesiredDiscardLevel; }
+ void setMinDiscardLevel(S32 discard) { mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel,(S8)discard); }
void setBoostLevel(S32 level) override;
- bool updateFetch();
- bool setDebugFetching(S32 debug_level);
- bool isInDebug() const { return mInDebug; }
+ bool updateFetch();
+ bool setDebugFetching(S32 debug_level);
+ bool isInDebug() const { return mInDebug; }
+
+ void setUnremovable(BOOL value) { mUnremovable = value; }
+ bool isUnremovable() const { return mUnremovable; }
- void setUnremovable(BOOL value) { mUnremovable = value; }
- bool isUnremovable() const { return mUnremovable; }
-
- void clearFetchedResults(); //clear all fetched results, for debug use.
+ void clearFetchedResults(); //clear all fetched results, for debug use.
- // Override the computation of discard levels if we know the exact output
- // size of the image. Used for UI textures to not decode, even if we have
- // more data.
- /*virtual*/ void setKnownDrawSize(S32 width, S32 height) override;
+ // Override the computation of discard levels if we know the exact output
+ // size of the image. Used for UI textures to not decode, even if we have
+ // more data.
+ /*virtual*/ void setKnownDrawSize(S32 width, S32 height) override;
// Set the debug text of all Viewer Objects associated with this texture
// to the specified text
void setDebugText(const std::string& text);
- void setIsMissingAsset(BOOL is_missing = true);
- /*virtual*/ BOOL isMissingAsset() const override { return mIsMissingAsset; }
-
- // returns dimensions of original image for local files (before power of two scaling)
- // and returns 0 for all asset system images
- S32 getOriginalWidth() { return mOrigWidth; }
- S32 getOriginalHeight() { return mOrigHeight; }
-
- BOOL isInImageList() const {return mInImageList ;}
- void setInImageList(BOOL flag) {mInImageList = flag ;}
-
- LLFrameTimer* getLastPacketTimer() {return &mLastPacketTimer;}
-
- U32 getFetchPriority() const { return mFetchPriority ;}
- F32 getDownloadProgress() const {return mDownloadProgress ;}
-
- LLImageRaw* reloadRawImage(S8 discard_level) ;
- void destroyRawImage();
- bool needsToSaveRawImage();
-
- const std::string& getUrl() const {return mUrl;}
- //---------------
- BOOL isDeleted() ;
- BOOL isInactive() ;
- BOOL isDeletionCandidate();
- void setDeletionCandidate() ;
- void setInactive() ;
- BOOL getUseDiscard() const { return mUseMipMaps && !mDontDiscard; }
- //---------------
-
- void setForSculpt();
- BOOL forSculpt() const {return mForSculpt;}
- BOOL isForSculptOnly() const;
-
- //raw image management
- void checkCachedRawSculptImage() ;
- LLImageRaw* getRawImage()const { return mRawImage ;}
- S32 getRawImageLevel() const {return mRawDiscardLevel;}
- LLImageRaw* getCachedRawImage() const { return mCachedRawImage ;}
- S32 getCachedRawImageLevel() const {return mCachedRawDiscardLevel;}
- BOOL isCachedRawImageReady() const {return mCachedRawImageReady ;}
- BOOL isRawImageValid()const { return mIsRawImageValid ; }
- void forceToSaveRawImage(S32 desired_discard = 0, F32 kept_time = 0.f) ;
- void forceToRefetchTexture(S32 desired_discard = 0, F32 kept_time = 60.f);
- /*virtual*/ void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) override;
- void destroySavedRawImage() ;
- LLImageRaw* getSavedRawImage() ;
- BOOL hasSavedRawImage() const ;
- F32 getElapsedLastReferencedSavedRawImageTime() const ;
- BOOL isFullyLoaded() const;
-
- BOOL hasFetcher() const { return mHasFetcher;}
- bool isFetching() const { return mIsFetching;}
- void setCanUseHTTP(bool can_use_http) {mCanUseHTTP = can_use_http;}
-
- void forceToDeleteRequest();
- void loadFromFastCache();
- void setInFastCacheList(bool in_list) { mInFastCacheList = in_list; }
- bool isInFastCacheList() { return mInFastCacheList; }
-
- /*virtual*/bool isActiveFetching() override; //is actively in fetching by the fetching pipeline.
+ void setIsMissingAsset(BOOL is_missing = true);
+ /*virtual*/ BOOL isMissingAsset() const override { return mIsMissingAsset; }
+
+ // returns dimensions of original image for local files (before power of two scaling)
+ // and returns 0 for all asset system images
+ S32 getOriginalWidth() { return mOrigWidth; }
+ S32 getOriginalHeight() { return mOrigHeight; }
+
+ BOOL isInImageList() const {return mInImageList ;}
+ void setInImageList(BOOL flag) {mInImageList = flag ;}
+
+ LLFrameTimer* getLastPacketTimer() {return &mLastPacketTimer;}
+
+ U32 getFetchPriority() const { return mFetchPriority ;}
+ F32 getDownloadProgress() const {return mDownloadProgress ;}
+
+ LLImageRaw* reloadRawImage(S8 discard_level) ;
+ void destroyRawImage();
+ bool needsToSaveRawImage();
+
+ const std::string& getUrl() const {return mUrl;}
+ //---------------
+ BOOL isDeleted() ;
+ BOOL isInactive() ;
+ BOOL isDeletionCandidate();
+ void setDeletionCandidate() ;
+ void setInactive() ;
+ BOOL getUseDiscard() const { return mUseMipMaps && !mDontDiscard; }
+ //---------------
+
+ void setForSculpt();
+ BOOL forSculpt() const {return mForSculpt;}
+ BOOL isForSculptOnly() const;
+
+ //raw image management
+ void checkCachedRawSculptImage() ;
+ LLImageRaw* getRawImage()const { return mRawImage ;}
+ S32 getRawImageLevel() const {return mRawDiscardLevel;}
+ LLImageRaw* getCachedRawImage() const { return mCachedRawImage ;}
+ S32 getCachedRawImageLevel() const {return mCachedRawDiscardLevel;}
+ BOOL isCachedRawImageReady() const {return mCachedRawImageReady ;}
+ BOOL isRawImageValid()const { return mIsRawImageValid ; }
+ void forceToSaveRawImage(S32 desired_discard = 0, F32 kept_time = 0.f) ;
+ void forceToRefetchTexture(S32 desired_discard = 0, F32 kept_time = 60.f);
+ /*virtual*/ void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) override;
+ void destroySavedRawImage() ;
+ LLImageRaw* getSavedRawImage() ;
+ BOOL hasSavedRawImage() const ;
+ F32 getElapsedLastReferencedSavedRawImageTime() const ;
+ BOOL isFullyLoaded() const;
+
+ BOOL hasFetcher() const { return mHasFetcher;}
+ bool isFetching() const { return mIsFetching;}
+ void setCanUseHTTP(bool can_use_http) {mCanUseHTTP = can_use_http;}
+
+ void forceToDeleteRequest();
+ void loadFromFastCache();
+ void setInFastCacheList(bool in_list) { mInFastCacheList = in_list; }
+ bool isInFastCacheList() { return mInFastCacheList; }
+
+ /*virtual*/bool isActiveFetching() override; //is actively in fetching by the fetching pipeline.
protected:
- /*virtual*/ void switchToCachedImage() override;
- S32 getCurrentDiscardLevelForFetching() ;
+ /*virtual*/ void switchToCachedImage() override;
+ S32 getCurrentDiscardLevelForFetching() ;
private:
- void init(bool firstinit) ;
- void cleanup() ;
+ void init(bool firstinit) ;
+ void cleanup() ;
- void saveRawImage() ;
- void setCachedRawImage() ;
+ void saveRawImage() ;
+ void setCachedRawImage() ;
- //for atlas
- void resetFaceAtlas() ;
- void invalidateAtlas(BOOL rebuild_geom) ;
- BOOL insertToAtlas() ;
+ //for atlas
+ void resetFaceAtlas() ;
+ void invalidateAtlas(BOOL rebuild_geom) ;
+ BOOL insertToAtlas() ;
private:
- BOOL mFullyLoaded;
- BOOL mInDebug;
- BOOL mUnremovable;
- BOOL mInFastCacheList;
- BOOL mForceCallbackFetch;
-
-protected:
- std::string mLocalFileName;
-
- S32 mOrigWidth;
- S32 mOrigHeight;
-
- // Override the computation of discard levels if we know the exact output size of the image.
- // Used for UI textures to not decode, even if we have more data.
- S32 mKnownDrawWidth;
- S32 mKnownDrawHeight;
- BOOL mKnownDrawSizeChanged ;
- std::string mUrl;
-
- S32 mRequestedDiscardLevel;
- F32 mRequestedDownloadPriority;
- S32 mFetchState;
+ BOOL mFullyLoaded;
+ BOOL mInDebug;
+ BOOL mUnremovable;
+ BOOL mInFastCacheList;
+ BOOL mForceCallbackFetch;
+
+protected:
+ std::string mLocalFileName;
+
+ S32 mOrigWidth;
+ S32 mOrigHeight;
+
+ // Override the computation of discard levels if we know the exact output size of the image.
+ // Used for UI textures to not decode, even if we have more data.
+ S32 mKnownDrawWidth;
+ S32 mKnownDrawHeight;
+ BOOL mKnownDrawSizeChanged ;
+ std::string mUrl;
+
+ S32 mRequestedDiscardLevel;
+ F32 mRequestedDownloadPriority;
+ S32 mFetchState;
S32 mLastFetchState = -1; // DEBUG
- U32 mFetchPriority;
- F32 mDownloadProgress;
- F32 mFetchDeltaTime;
- F32 mRequestDeltaTime;
- S32 mMinDiscardLevel;
- S8 mDesiredDiscardLevel; // The discard level we'd LIKE to have - if we have it and there's space
- S8 mMinDesiredDiscardLevel; // The minimum discard level we'd like to have
-
- S8 mNeedsAux; // We need to decode the auxiliary channels
- S8 mHasAux; // We have aux channels
- S8 mDecodingAux; // Are we decoding high components
- S8 mIsRawImageValid;
- S8 mHasFetcher; // We've made a fecth request
- S8 mIsFetching; // Fetch request is active
- bool mCanUseHTTP; //This texture can be fetched through http if true.
- LLCore::HttpStatus mLastHttpGetStatus; // Result of the most recently completed http request for this texture.
-
- FTType mFTType; // What category of image is this - map tile, server bake, etc?
- mutable S8 mIsMissingAsset; // True if we know that there is no image asset with this image id in the database.
-
- typedef std::list<LLLoadedCallbackEntry*> callback_list_t;
- S8 mLoadedCallbackDesiredDiscardLevel;
- BOOL mPauseLoadedCallBacks;
- callback_list_t mLoadedCallbackList;
- F32 mLastCallBackActiveTime;
-
- LLPointer<LLImageRaw> mRawImage;
- S32 mRawDiscardLevel = -1;
-
- // Used ONLY for cloth meshes right now. Make SURE you know what you're
- // doing if you use it for anything else! - djs
- LLPointer<LLImageRaw> mAuxRawImage;
-
- //keep a copy of mRawImage for some special purposes
- //when mForceToSaveRawImage is set.
- BOOL mForceToSaveRawImage ;
- BOOL mSaveRawImage;
- LLPointer<LLImageRaw> mSavedRawImage;
- S32 mSavedRawDiscardLevel;
- S32 mDesiredSavedRawDiscardLevel;
- F32 mLastReferencedSavedRawImageTime ;
- F32 mKeptSavedRawImageTime ;
-
- //a small version of the copy of the raw image (<= 64 * 64)
- LLPointer<LLImageRaw> mCachedRawImage;
- S32 mCachedRawDiscardLevel;
- BOOL mCachedRawImageReady; //the rez of the mCachedRawImage reaches the upper limit.
-
- LLHost mTargetHost; // if invalid, just request from agent's simulator
-
- // Timers
- LLFrameTimer mLastPacketTimer; // Time since last packet.
- LLFrameTimer mStopFetchingTimer; // Time since mDecodePriority == 0.f.
-
- BOOL mInImageList; // TRUE if image is in list (in which case don't reset priority!)
- // This needs to be atomic, since it is written both in the main thread
- // and in the GL image worker thread... HB
- LLAtomicBool mNeedsCreateTexture;
-
- BOOL mForSculpt ; //a flag if the texture is used as sculpt data.
- BOOL mIsFetched ; //is loaded from remote or from cache, not generated locally.
+ U32 mFetchPriority;
+ F32 mDownloadProgress;
+ F32 mFetchDeltaTime;
+ F32 mRequestDeltaTime;
+ S32 mMinDiscardLevel;
+ S8 mDesiredDiscardLevel; // The discard level we'd LIKE to have - if we have it and there's space
+ S8 mMinDesiredDiscardLevel; // The minimum discard level we'd like to have
+
+ S8 mNeedsAux; // We need to decode the auxiliary channels
+ S8 mHasAux; // We have aux channels
+ S8 mDecodingAux; // Are we decoding high components
+ S8 mIsRawImageValid;
+ S8 mHasFetcher; // We've made a fecth request
+ S8 mIsFetching; // Fetch request is active
+ bool mCanUseHTTP; //This texture can be fetched through http if true.
+ LLCore::HttpStatus mLastHttpGetStatus; // Result of the most recently completed http request for this texture.
+
+ FTType mFTType; // What category of image is this - map tile, server bake, etc?
+ mutable S8 mIsMissingAsset; // True if we know that there is no image asset with this image id in the database.
+
+ typedef std::list<LLLoadedCallbackEntry*> callback_list_t;
+ S8 mLoadedCallbackDesiredDiscardLevel;
+ BOOL mPauseLoadedCallBacks;
+ callback_list_t mLoadedCallbackList;
+ F32 mLastCallBackActiveTime;
+
+ LLPointer<LLImageRaw> mRawImage;
+ S32 mRawDiscardLevel = -1;
+
+ // Used ONLY for cloth meshes right now. Make SURE you know what you're
+ // doing if you use it for anything else! - djs
+ LLPointer<LLImageRaw> mAuxRawImage;
+
+ //keep a copy of mRawImage for some special purposes
+ //when mForceToSaveRawImage is set.
+ BOOL mForceToSaveRawImage ;
+ BOOL mSaveRawImage;
+ LLPointer<LLImageRaw> mSavedRawImage;
+ S32 mSavedRawDiscardLevel;
+ S32 mDesiredSavedRawDiscardLevel;
+ F32 mLastReferencedSavedRawImageTime ;
+ F32 mKeptSavedRawImageTime ;
+
+ //a small version of the copy of the raw image (<= 64 * 64)
+ LLPointer<LLImageRaw> mCachedRawImage;
+ S32 mCachedRawDiscardLevel;
+ BOOL mCachedRawImageReady; //the rez of the mCachedRawImage reaches the upper limit.
+
+ LLHost mTargetHost; // if invalid, just request from agent's simulator
+
+ // Timers
+ LLFrameTimer mLastPacketTimer; // Time since last packet.
+ LLFrameTimer mStopFetchingTimer; // Time since mDecodePriority == 0.f.
+
+ BOOL mInImageList; // TRUE if image is in list (in which case don't reset priority!)
+ // This needs to be atomic, since it is written both in the main thread
+ // and in the GL image worker thread... HB
+ LLAtomicBool mNeedsCreateTexture;
+
+ BOOL mForSculpt ; //a flag if the texture is used as sculpt data.
+ BOOL mIsFetched ; //is loaded from remote or from cache, not generated locally.
public:
static F32 sMaxVirtualSize; //maximum possible value of mMaxVirtualSize
- static LLPointer<LLViewerFetchedTexture> sMissingAssetImagep; // Texture to show for an image asset that is not in the database
- static LLPointer<LLViewerFetchedTexture> sWhiteImagep; // Texture to show NOTHING (whiteness)
- static LLPointer<LLViewerFetchedTexture> sDefaultImagep; // "Default" texture for error cases, the only case of fetched texture which is generated in local.
- static LLPointer<LLViewerFetchedTexture> sFlatNormalImagep; // Flat normal map denoting no bumpiness on a surface
- static LLPointer<LLViewerFetchedTexture> sDefaultIrradiancePBRp; // PBR: irradiance
+ static LLPointer<LLViewerFetchedTexture> sMissingAssetImagep; // Texture to show for an image asset that is not in the database
+ static LLPointer<LLViewerFetchedTexture> sWhiteImagep; // Texture to show NOTHING (whiteness)
+ static LLPointer<LLViewerFetchedTexture> sDefaultImagep; // "Default" texture for error cases, the only case of fetched texture which is generated in local.
+ static LLPointer<LLViewerFetchedTexture> sFlatNormalImagep; // Flat normal map denoting no bumpiness on a surface
+ static LLPointer<LLViewerFetchedTexture> sDefaultIrradiancePBRp; // PBR: irradiance
// not sure why, but something is iffy about the loading of this particular texture, use the accessor instead of accessing directly
static LLPointer<LLViewerFetchedTexture> sSmokeImagep; // Old "Default" translucent texture
@@ -539,24 +539,24 @@ public:
class LLViewerLODTexture : public LLViewerFetchedTexture
{
protected:
- /*virtual*/ ~LLViewerLODTexture(){}
+ /*virtual*/ ~LLViewerLODTexture(){}
public:
- LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE);
- LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
+ LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE);
+ LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
- /*virtual*/ S8 getType() const;
- // Process image stats to determine priority/quality requirements.
- /*virtual*/ void processTextureStats();
- bool isUpdateFrozen() ;
+ /*virtual*/ S8 getType() const;
+ // Process image stats to determine priority/quality requirements.
+ /*virtual*/ void processTextureStats();
+ bool isUpdateFrozen() ;
private:
- void init(bool firstinit) ;
- bool scaleDown() ;
+ void init(bool firstinit) ;
+ bool scaleDown() ;
private:
- F32 mDiscardVirtualSize; // Virtual size used to calculate desired discard
- F32 mCalculatedDiscardLevel; // Last calculated discard level
+ F32 mDiscardVirtualSize; // Virtual size used to calculate desired discard
+ F32 mCalculatedDiscardLevel; // Last calculated discard level
};
//
@@ -566,135 +566,135 @@ private:
class LLViewerMediaTexture : public LLViewerTexture
{
protected:
- /*virtual*/ ~LLViewerMediaTexture() ;
+ /*virtual*/ ~LLViewerMediaTexture() ;
public:
- LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ;
+ LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ;
- /*virtual*/ S8 getType() const;
- void reinit(BOOL usemipmaps = TRUE);
+ /*virtual*/ S8 getType() const;
+ void reinit(BOOL usemipmaps = TRUE);
- BOOL getUseMipMaps() {return mUseMipMaps ; }
- void setUseMipMaps(BOOL mipmap) ;
-
- void setPlaying(BOOL playing) ;
- BOOL isPlaying() const {return mIsPlaying;}
- void setMediaImpl() ;
+ BOOL getUseMipMaps() {return mUseMipMaps ; }
+ void setUseMipMaps(BOOL mipmap) ;
+
+ void setPlaying(BOOL playing) ;
+ BOOL isPlaying() const {return mIsPlaying;}
+ void setMediaImpl() ;
virtual bool isViewerMediaTexture() const { return true; }
- void initVirtualSize() ;
- void invalidateMediaImpl() ;
+ void initVirtualSize() ;
+ void invalidateMediaImpl() ;
- void addMediaToFace(LLFace* facep) ;
- void removeMediaFromFace(LLFace* facep) ;
+ void addMediaToFace(LLFace* facep) ;
+ void removeMediaFromFace(LLFace* facep) ;
- /*virtual*/ void addFace(U32 ch, LLFace* facep) ;
- /*virtual*/ void removeFace(U32 ch, LLFace* facep) ;
+ /*virtual*/ void addFace(U32 ch, LLFace* facep) ;
+ /*virtual*/ void removeFace(U32 ch, LLFace* facep) ;
- /*virtual*/ F32 getMaxVirtualSize() ;
+ /*virtual*/ F32 getMaxVirtualSize() ;
private:
- void switchTexture(U32 ch, LLFace* facep) ;
- BOOL findFaces() ;
- void stopPlaying() ;
+ void switchTexture(U32 ch, LLFace* facep) ;
+ BOOL findFaces() ;
+ void stopPlaying() ;
private:
- //
- //an instant list, recording all faces referencing or can reference to this media texture.
- //NOTE: it is NOT thread safe.
- //
- std::list< LLFace* > mMediaFaceList ;
+ //
+ //an instant list, recording all faces referencing or can reference to this media texture.
+ //NOTE: it is NOT thread safe.
+ //
+ std::list< LLFace* > mMediaFaceList ;
- //an instant list keeping all textures which are replaced by the current media texture,
- //is only used to avoid the removal of those textures from memory.
- std::list< LLPointer<LLViewerTexture> > mTextureList ;
+ //an instant list keeping all textures which are replaced by the current media texture,
+ //is only used to avoid the removal of those textures from memory.
+ std::list< LLPointer<LLViewerTexture> > mTextureList ;
- LLViewerMediaImpl* mMediaImplp ;
- BOOL mIsPlaying ;
- U32 mUpdateVirtualSizeTime ;
+ LLViewerMediaImpl* mMediaImplp ;
+ BOOL mIsPlaying ;
+ U32 mUpdateVirtualSizeTime ;
public:
- static void updateClass() ;
- static void cleanUpClass() ;
+ static void updateClass() ;
+ static void cleanUpClass() ;
- static LLViewerMediaTexture* findMediaTexture(const LLUUID& media_id) ;
- static void removeMediaImplFromTexture(const LLUUID& media_id) ;
+ static LLViewerMediaTexture* findMediaTexture(const LLUUID& media_id) ;
+ static void removeMediaImplFromTexture(const LLUUID& media_id) ;
private:
- typedef std::map< LLUUID, LLPointer<LLViewerMediaTexture> > media_map_t ;
- static media_map_t sMediaMap ;
+ typedef std::map< LLUUID, LLPointer<LLViewerMediaTexture> > media_map_t ;
+ static media_map_t sMediaMap ;
};
//just an interface class, do not create instance from this class.
class LLViewerTextureManager
{
private:
- //make the constructor private to preclude creating instances from this class.
- LLViewerTextureManager(){}
+ //make the constructor private to preclude creating instances from this class.
+ LLViewerTextureManager(){}
public:
//texture pipeline tester
- static LLTexturePipelineTester* sTesterp ;
-
- //returns NULL if tex is not a LLViewerFetchedTexture nor derived from LLViewerFetchedTexture.
- static LLViewerFetchedTexture* staticCastToFetchedTexture(LLTexture* tex, BOOL report_error = FALSE) ;
-
- //
- //"find-texture" just check if the texture exists, if yes, return it, otherwise return null.
- //
- static void findFetchedTextures(const LLUUID& id, std::vector<LLViewerFetchedTexture*> &output);
- static void findTextures(const LLUUID& id, std::vector<LLViewerTexture*> &output);
- static LLViewerFetchedTexture* findFetchedTexture(const LLUUID& id, S32 tex_type);
- static LLViewerMediaTexture* findMediaTexture(const LLUUID& id) ;
-
- static LLViewerMediaTexture* createMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ;
-
- //
- //"get-texture" will create a new texture if the texture does not exist.
- //
- static LLViewerMediaTexture* getMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ;
-
- static LLPointer<LLViewerTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE);
- static LLPointer<LLViewerTexture> getLocalTexture(const LLUUID& id, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) ;
- static LLPointer<LLViewerTexture> getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps) ;
- static LLPointer<LLViewerTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) ;
+ static LLTexturePipelineTester* sTesterp ;
+
+ //returns NULL if tex is not a LLViewerFetchedTexture nor derived from LLViewerFetchedTexture.
+ static LLViewerFetchedTexture* staticCastToFetchedTexture(LLTexture* tex, BOOL report_error = FALSE) ;
+
+ //
+ //"find-texture" just check if the texture exists, if yes, return it, otherwise return null.
+ //
+ static void findFetchedTextures(const LLUUID& id, std::vector<LLViewerFetchedTexture*> &output);
+ static void findTextures(const LLUUID& id, std::vector<LLViewerTexture*> &output);
+ static LLViewerFetchedTexture* findFetchedTexture(const LLUUID& id, S32 tex_type);
+ static LLViewerMediaTexture* findMediaTexture(const LLUUID& id) ;
+
+ static LLViewerMediaTexture* createMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ;
+
+ //
+ //"get-texture" will create a new texture if the texture does not exist.
+ //
+ static LLViewerMediaTexture* getMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ;
+
+ static LLPointer<LLViewerTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE);
+ static LLPointer<LLViewerTexture> getLocalTexture(const LLUUID& id, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) ;
+ static LLPointer<LLViewerTexture> getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps) ;
+ static LLPointer<LLViewerTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) ;
static LLViewerFetchedTexture* getFetchedTexture(const LLImageRaw* raw, FTType type, bool usemipmaps);
- static LLViewerFetchedTexture* getFetchedTexture(const LLUUID &image_id,
- FTType f_type = FTT_DEFAULT,
- BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
- S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
- LLGLint internal_format = 0,
- LLGLenum primary_format = 0,
- LLHost request_from_host = LLHost()
- );
-
- static LLViewerFetchedTexture* getFetchedTextureFromFile(const std::string& filename,
- FTType f_type = FTT_LOCAL_FILE,
- BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
- S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
- LLGLint internal_format = 0,
- LLGLenum primary_format = 0,
- const LLUUID& force_id = LLUUID::null
- );
-
- static LLViewerFetchedTexture* getFetchedTextureFromUrl(const std::string& url,
- FTType f_type,
- BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
- S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
- LLGLint internal_format = 0,
- LLGLenum primary_format = 0,
- const LLUUID& force_id = LLUUID::null
- );
-
- static LLViewerFetchedTexture* getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host) ;
-
- static void init() ;
- static void cleanup() ;
+ static LLViewerFetchedTexture* getFetchedTexture(const LLUUID &image_id,
+ FTType f_type = FTT_DEFAULT,
+ BOOL usemipmap = TRUE,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
+ S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
+ LLGLint internal_format = 0,
+ LLGLenum primary_format = 0,
+ LLHost request_from_host = LLHost()
+ );
+
+ static LLViewerFetchedTexture* getFetchedTextureFromFile(const std::string& filename,
+ FTType f_type = FTT_LOCAL_FILE,
+ BOOL usemipmap = TRUE,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
+ S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
+ LLGLint internal_format = 0,
+ LLGLenum primary_format = 0,
+ const LLUUID& force_id = LLUUID::null
+ );
+
+ static LLViewerFetchedTexture* getFetchedTextureFromUrl(const std::string& url,
+ FTType f_type,
+ BOOL usemipmap = TRUE,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
+ S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
+ LLGLint internal_format = 0,
+ LLGLenum primary_format = 0,
+ const LLUUID& force_id = LLUUID::null
+ );
+
+ static LLViewerFetchedTexture* getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host) ;
+
+ static void init() ;
+ static void cleanup() ;
};
//
//this class is used for test/debug only
@@ -703,91 +703,91 @@ public:
//
class LLTexturePipelineTester : public LLMetricPerformanceTesterWithSession
{
- enum
- {
- MIN_LARGE_IMAGE_AREA = 262144 //512 * 512
- };
+ enum
+ {
+ MIN_LARGE_IMAGE_AREA = 262144 //512 * 512
+ };
public:
- LLTexturePipelineTester() ;
- ~LLTexturePipelineTester() ;
+ LLTexturePipelineTester() ;
+ ~LLTexturePipelineTester() ;
- void update();
- void updateTextureBindingStats(const LLViewerTexture* imagep) ;
- void updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, BOOL from_cache) ;
- void updateGrayTextureBinding() ;
- void setStablizingTime() ;
+ void update();
+ void updateTextureBindingStats(const LLViewerTexture* imagep) ;
+ void updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, BOOL from_cache) ;
+ void updateGrayTextureBinding() ;
+ void setStablizingTime() ;
private:
- void reset() ;
- void updateStablizingTime() ;
+ void reset() ;
+ void updateStablizingTime() ;
- /*virtual*/ void outputTestRecord(LLSD* sd) ;
+ /*virtual*/ void outputTestRecord(LLSD* sd) ;
private:
- BOOL mPause ;
+ BOOL mPause ;
private:
- BOOL mUsingDefaultTexture; //if set, some textures are still gray.
-
- U32Bytes mTotalBytesUsed ; //total bytes of textures bound/used for the current frame.
- U32Bytes mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256.
- U32Bytes mLastTotalBytesUsed ; //total bytes of textures bound/used for the previous frame.
- U32Bytes mLastTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the previous frame for images larger than 256 * 256.
-
- //
- //data size
- //
- U32Bytes mTotalBytesLoaded ; //total bytes fetched by texture pipeline
- U32Bytes mTotalBytesLoadedFromCache ; //total bytes fetched by texture pipeline from local cache
- U32Bytes mTotalBytesLoadedForLargeImage ; //total bytes fetched by texture pipeline for images larger than 256 * 256.
- U32Bytes mTotalBytesLoadedForSculpties ; //total bytes fetched by texture pipeline for sculpties
-
- //
- //time
- //NOTE: the error tolerances of the following timers is one frame time.
- //
- F32 mStartFetchingTime ;
- F32 mTotalGrayTime ; //total loading time when no gray textures.
- F32 mTotalStablizingTime ; //total stablizing time when texture memory overflows
- F32 mStartTimeLoadingSculpties ; //the start moment of loading sculpty images.
- F32 mEndTimeLoadingSculpties ; //the end moment of loading sculpty images.
- F32 mStartStablizingTime ;
- F32 mEndStablizingTime ;
+ BOOL mUsingDefaultTexture; //if set, some textures are still gray.
+
+ U32Bytes mTotalBytesUsed ; //total bytes of textures bound/used for the current frame.
+ U32Bytes mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256.
+ U32Bytes mLastTotalBytesUsed ; //total bytes of textures bound/used for the previous frame.
+ U32Bytes mLastTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the previous frame for images larger than 256 * 256.
+
+ //
+ //data size
+ //
+ U32Bytes mTotalBytesLoaded ; //total bytes fetched by texture pipeline
+ U32Bytes mTotalBytesLoadedFromCache ; //total bytes fetched by texture pipeline from local cache
+ U32Bytes mTotalBytesLoadedForLargeImage ; //total bytes fetched by texture pipeline for images larger than 256 * 256.
+ U32Bytes mTotalBytesLoadedForSculpties ; //total bytes fetched by texture pipeline for sculpties
+
+ //
+ //time
+ //NOTE: the error tolerances of the following timers is one frame time.
+ //
+ F32 mStartFetchingTime ;
+ F32 mTotalGrayTime ; //total loading time when no gray textures.
+ F32 mTotalStablizingTime ; //total stablizing time when texture memory overflows
+ F32 mStartTimeLoadingSculpties ; //the start moment of loading sculpty images.
+ F32 mEndTimeLoadingSculpties ; //the end moment of loading sculpty images.
+ F32 mStartStablizingTime ;
+ F32 mEndStablizingTime ;
private:
- //
- //The following members are used for performance analyzing
- //
- class LLTextureTestSession : public LLTestSession
- {
- public:
- LLTextureTestSession() ;
- /*virtual*/ ~LLTextureTestSession() ;
-
- void reset() ;
-
- F32 mTotalGrayTime ;
- F32 mTotalStablizingTime ;
- F32 mStartTimeLoadingSculpties ;
- F32 mTotalTimeLoadingSculpties ;
-
- S32 mTotalBytesLoaded ;
- S32 mTotalBytesLoadedFromCache ;
- S32 mTotalBytesLoadedForLargeImage ;
- S32 mTotalBytesLoadedForSculpties ;
-
- typedef struct _texture_instant_preformance_t
- {
- S32 mAverageBytesUsedPerSecond ;
- S32 mAverageBytesUsedForLargeImagePerSecond ;
- F32 mAveragePercentageBytesUsedPerSecond ;
- F32 mTime ;
- }texture_instant_preformance_t ;
- std::vector<texture_instant_preformance_t> mInstantPerformanceList ;
- S32 mInstantPerformanceListCounter ;
- };
-
- /*virtual*/ LLMetricPerformanceTesterWithSession::LLTestSession* loadTestSession(LLSD* log) ;
- /*virtual*/ void compareTestSessions(llofstream* os) ;
+ //
+ //The following members are used for performance analyzing
+ //
+ class LLTextureTestSession : public LLTestSession
+ {
+ public:
+ LLTextureTestSession() ;
+ /*virtual*/ ~LLTextureTestSession() ;
+
+ void reset() ;
+
+ F32 mTotalGrayTime ;
+ F32 mTotalStablizingTime ;
+ F32 mStartTimeLoadingSculpties ;
+ F32 mTotalTimeLoadingSculpties ;
+
+ S32 mTotalBytesLoaded ;
+ S32 mTotalBytesLoadedFromCache ;
+ S32 mTotalBytesLoadedForLargeImage ;
+ S32 mTotalBytesLoadedForSculpties ;
+
+ typedef struct _texture_instant_preformance_t
+ {
+ S32 mAverageBytesUsedPerSecond ;
+ S32 mAverageBytesUsedForLargeImagePerSecond ;
+ F32 mAveragePercentageBytesUsedPerSecond ;
+ F32 mTime ;
+ }texture_instant_preformance_t ;
+ std::vector<texture_instant_preformance_t> mInstantPerformanceList ;
+ S32 mInstantPerformanceListCounter ;
+ };
+
+ /*virtual*/ LLMetricPerformanceTesterWithSession::LLTestSession* loadTestSession(LLSD* log) ;
+ /*virtual*/ void compareTestSessions(llofstream* os) ;
};
#endif
diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp
index 9603811066..9342eb2865 100644
--- a/indra/newview/llviewertextureanim.cpp
+++ b/indra/newview/llviewertextureanim.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewertextureanim.cpp
* @brief LLViewerTextureAnim class implementation
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,203 +36,203 @@ std::vector<LLViewerTextureAnim*> LLViewerTextureAnim::sInstanceList;
LLViewerTextureAnim::LLViewerTextureAnim(LLVOVolume* vobj) : LLTextureAnim()
{
- mVObj = vobj;
- mLastFrame = -1.f; // Force an update initially
- mLastTime = 0.f;
- mOffS = mOffT = 0;
- mScaleS = mScaleT = 1;
- mRot = 0;
-
- mInstanceIndex = sInstanceList.size();
- sInstanceList.push_back(this);
+ mVObj = vobj;
+ mLastFrame = -1.f; // Force an update initially
+ mLastTime = 0.f;
+ mOffS = mOffT = 0;
+ mScaleS = mScaleT = 1;
+ mRot = 0;
+
+ mInstanceIndex = sInstanceList.size();
+ sInstanceList.push_back(this);
}
LLViewerTextureAnim::~LLViewerTextureAnim()
{
- S32 end_idx = sInstanceList.size()-1;
-
- if (end_idx != mInstanceIndex)
- {
- sInstanceList[mInstanceIndex] = sInstanceList[end_idx];
- sInstanceList[mInstanceIndex]->mInstanceIndex = mInstanceIndex;
- }
-
- sInstanceList.pop_back();
+ S32 end_idx = sInstanceList.size()-1;
+
+ if (end_idx != mInstanceIndex)
+ {
+ sInstanceList[mInstanceIndex] = sInstanceList[end_idx];
+ sInstanceList[mInstanceIndex]->mInstanceIndex = mInstanceIndex;
+ }
+
+ sInstanceList.pop_back();
}
void LLViewerTextureAnim::reset()
{
- LLTextureAnim::reset();
- mTimer.reset();
+ LLTextureAnim::reset();
+ mTimer.reset();
}
-//static
+//static
void LLViewerTextureAnim::updateClass()
{
- for (std::vector<LLViewerTextureAnim*>::iterator iter = sInstanceList.begin(); iter != sInstanceList.end(); ++iter)
- {
- (*iter)->mVObj->animateTextures();
- }
+ for (std::vector<LLViewerTextureAnim*>::iterator iter = sInstanceList.begin(); iter != sInstanceList.end(); ++iter)
+ {
+ (*iter)->mVObj->animateTextures();
+ }
}
S32 LLViewerTextureAnim::animateTextures(F32 &off_s, F32 &off_t,
- F32 &scale_s, F32 &scale_t,
- F32 &rot)
+ F32 &scale_s, F32 &scale_t,
+ F32 &rot)
{
- S32 result = 0;
- if (!(mMode & ON))
- {
- mLastTime = 0.f;
- mLastFrame = -1.f;
- return result;
- }
-
-
- F32 num_frames = 1.0;
- F32 full_length = 1.0;
-
- if (mLength)
- {
- num_frames = mLength;
- }
- else
- {
- num_frames = llmax(1.f, (F32)(mSizeX * mSizeY));
- }
-
- if (mMode & PING_PONG)
- {
- if (mMode & SMOOTH)
- {
- full_length = 2.f*num_frames;
- }
- else if (mMode & LOOP)
- {
- full_length = 2.f*num_frames - 2.f;
- full_length = llmax(1.f, full_length);
- }
- else
- {
- full_length = 2.f*num_frames - 1.f;
- full_length = llmax(1.f, full_length);
- }
- }
- else
- {
- full_length = num_frames;
- }
-
-
- F32 frame_counter;
- if (mMode & SMOOTH)
- {
- frame_counter = mTimer.getElapsedTimeAndResetF32() * mRate + (F32)mLastTime;
- }
- else
- {
- frame_counter = mTimer.getElapsedTimeF32() * mRate;
- }
- mLastTime = frame_counter;
-
- if (mMode & LOOP)
- {
- frame_counter = fmod(frame_counter, full_length);
- }
- else
- {
- frame_counter = llmin(full_length - 1.f, frame_counter);
- }
-
- if (!(mMode & SMOOTH))
- {
- frame_counter = (F32)llfloor(frame_counter + 0.01f);
- // account for 0.01, we shouldn't step over full length
- frame_counter = llmin(full_length - 1.f, frame_counter);
- }
-
- if (mMode & PING_PONG)
- {
- if (frame_counter >= num_frames)
- {
- if (mMode & SMOOTH)
- {
- frame_counter = num_frames - (frame_counter - num_frames);
- }
- else
- {
- frame_counter = (num_frames - 1.99f) - (frame_counter - num_frames);
- }
- }
- }
-
- if (mMode & REVERSE)
- {
- if (mMode & SMOOTH)
- {
- frame_counter = num_frames - frame_counter;
- }
- else
- {
- frame_counter = (num_frames - 0.99f) - frame_counter;
- }
- }
-
- frame_counter += mStart;
-
- if (!(mMode & SMOOTH))
- {
- frame_counter = (F32)ll_round(frame_counter);
- }
-
- //
- // Now that we've calculated the frame time, do an update.
- // Will we correctly update stuff if the texture anim has
- // changed, but not the frame counter?
- //
- if (mLastFrame != frame_counter)
- {
- mLastFrame = frame_counter;
- if (mMode & ROTATE)
- {
- result |= ROTATE;
- mRot = rot = frame_counter;
- }
- else if (mMode & SCALE)
- {
- result |= SCALE;
- mScaleS = scale_s = frame_counter;
- mScaleT = scale_t = frame_counter;
- }
- else
- {
- result |= TRANSLATE;
- F32 x_frame;
- S32 y_frame;
- F32 x_pos;
- F32 y_pos;
-
- if ( (mSizeX)
- &&(mSizeY))
- {
- result |= SCALE;
- mScaleS = scale_s = 1.f/mSizeX;
- mScaleT = scale_t = 1.f/mSizeY;
- x_frame = fmod(frame_counter, mSizeX);
- y_frame = (S32)(frame_counter / mSizeX);
- x_pos = x_frame * scale_s;
- y_pos = y_frame * scale_t;
- mOffS = off_s = (-0.5f + 0.5f*scale_s)+ x_pos;
- mOffT = off_t = (0.5f - 0.5f*scale_t) - y_pos;
- }
- else
- {
- mScaleS = scale_s = 1.f;
- mScaleT = scale_t = 1.f;
- x_pos = frame_counter * scale_s;
- mOffS = off_s = (-0.5f + 0.5f*scale_s)+ x_pos;
- mOffT = off_t = 0.f;
- }
- }
- }
- return result;
+ S32 result = 0;
+ if (!(mMode & ON))
+ {
+ mLastTime = 0.f;
+ mLastFrame = -1.f;
+ return result;
+ }
+
+
+ F32 num_frames = 1.0;
+ F32 full_length = 1.0;
+
+ if (mLength)
+ {
+ num_frames = mLength;
+ }
+ else
+ {
+ num_frames = llmax(1.f, (F32)(mSizeX * mSizeY));
+ }
+
+ if (mMode & PING_PONG)
+ {
+ if (mMode & SMOOTH)
+ {
+ full_length = 2.f*num_frames;
+ }
+ else if (mMode & LOOP)
+ {
+ full_length = 2.f*num_frames - 2.f;
+ full_length = llmax(1.f, full_length);
+ }
+ else
+ {
+ full_length = 2.f*num_frames - 1.f;
+ full_length = llmax(1.f, full_length);
+ }
+ }
+ else
+ {
+ full_length = num_frames;
+ }
+
+
+ F32 frame_counter;
+ if (mMode & SMOOTH)
+ {
+ frame_counter = mTimer.getElapsedTimeAndResetF32() * mRate + (F32)mLastTime;
+ }
+ else
+ {
+ frame_counter = mTimer.getElapsedTimeF32() * mRate;
+ }
+ mLastTime = frame_counter;
+
+ if (mMode & LOOP)
+ {
+ frame_counter = fmod(frame_counter, full_length);
+ }
+ else
+ {
+ frame_counter = llmin(full_length - 1.f, frame_counter);
+ }
+
+ if (!(mMode & SMOOTH))
+ {
+ frame_counter = (F32)llfloor(frame_counter + 0.01f);
+ // account for 0.01, we shouldn't step over full length
+ frame_counter = llmin(full_length - 1.f, frame_counter);
+ }
+
+ if (mMode & PING_PONG)
+ {
+ if (frame_counter >= num_frames)
+ {
+ if (mMode & SMOOTH)
+ {
+ frame_counter = num_frames - (frame_counter - num_frames);
+ }
+ else
+ {
+ frame_counter = (num_frames - 1.99f) - (frame_counter - num_frames);
+ }
+ }
+ }
+
+ if (mMode & REVERSE)
+ {
+ if (mMode & SMOOTH)
+ {
+ frame_counter = num_frames - frame_counter;
+ }
+ else
+ {
+ frame_counter = (num_frames - 0.99f) - frame_counter;
+ }
+ }
+
+ frame_counter += mStart;
+
+ if (!(mMode & SMOOTH))
+ {
+ frame_counter = (F32)ll_round(frame_counter);
+ }
+
+ //
+ // Now that we've calculated the frame time, do an update.
+ // Will we correctly update stuff if the texture anim has
+ // changed, but not the frame counter?
+ //
+ if (mLastFrame != frame_counter)
+ {
+ mLastFrame = frame_counter;
+ if (mMode & ROTATE)
+ {
+ result |= ROTATE;
+ mRot = rot = frame_counter;
+ }
+ else if (mMode & SCALE)
+ {
+ result |= SCALE;
+ mScaleS = scale_s = frame_counter;
+ mScaleT = scale_t = frame_counter;
+ }
+ else
+ {
+ result |= TRANSLATE;
+ F32 x_frame;
+ S32 y_frame;
+ F32 x_pos;
+ F32 y_pos;
+
+ if ( (mSizeX)
+ &&(mSizeY))
+ {
+ result |= SCALE;
+ mScaleS = scale_s = 1.f/mSizeX;
+ mScaleT = scale_t = 1.f/mSizeY;
+ x_frame = fmod(frame_counter, mSizeX);
+ y_frame = (S32)(frame_counter / mSizeX);
+ x_pos = x_frame * scale_s;
+ y_pos = y_frame * scale_t;
+ mOffS = off_s = (-0.5f + 0.5f*scale_s)+ x_pos;
+ mOffT = off_t = (0.5f - 0.5f*scale_t) - y_pos;
+ }
+ else
+ {
+ mScaleS = scale_s = 1.f;
+ mScaleT = scale_t = 1.f;
+ x_pos = frame_counter * scale_s;
+ mOffS = off_s = (-0.5f + 0.5f*scale_s)+ x_pos;
+ mOffT = off_t = 0.f;
+ }
+ }
+ }
+ return result;
}
diff --git a/indra/newview/llviewertextureanim.h b/indra/newview/llviewertextureanim.h
index abbfabceb9..8a830d3f35 100644
--- a/indra/newview/llviewertextureanim.h
+++ b/indra/newview/llviewertextureanim.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewertextureanim.h
* @brief LLViewerTextureAnim class header file
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,33 +35,33 @@ class LLVOVolume;
class LLViewerTextureAnim : public LLTextureAnim
{
private:
- static std::vector<LLViewerTextureAnim*> sInstanceList;
- S32 mInstanceIndex;
+ static std::vector<LLViewerTextureAnim*> sInstanceList;
+ S32 mInstanceIndex;
public:
- static void updateClass();
+ static void updateClass();
- LLViewerTextureAnim(LLVOVolume* vobj);
- virtual ~LLViewerTextureAnim();
+ LLViewerTextureAnim(LLVOVolume* vobj);
+ virtual ~LLViewerTextureAnim();
- /*virtual*/ void reset();
+ /*virtual*/ void reset();
- S32 animateTextures(F32 &off_s, F32 &off_t, F32 &scale_s, F32 &scale_t, F32 &rotate);
- enum
- {
- TRANSLATE = 0x01 // Result code JUST for animateTextures
- };
+ S32 animateTextures(F32 &off_s, F32 &off_t, F32 &scale_s, F32 &scale_t, F32 &rotate);
+ enum
+ {
+ TRANSLATE = 0x01 // Result code JUST for animateTextures
+ };
- F32 mOffS;
- F32 mOffT;
- F32 mScaleS;
- F32 mScaleT;
- F32 mRot;
+ F32 mOffS;
+ F32 mOffT;
+ F32 mScaleS;
+ F32 mScaleT;
+ F32 mRot;
protected:
- LLVOVolume* mVObj;
- LLFrameTimer mTimer;
- F64 mLastTime;
- F32 mLastFrame;
+ LLVOVolume* mVObj;
+ LLFrameTimer mTimer;
+ F64 mLastTime;
+ F32 mLastFrame;
};
#endif
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 8731be6e97..e96495d169 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewertexturelist.cpp
* @brief Object for managing the list of images within a region
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -90,36 +90,36 @@ LLTextureKey::LLTextureKey(LLUUID id, ETexListType tex_type)
///////////////////////////////////////////////////////////////////////////////
-LLViewerTextureList::LLViewerTextureList()
- : mForceResetTextureStats(FALSE),
- mInitialized(FALSE)
+LLViewerTextureList::LLViewerTextureList()
+ : mForceResetTextureStats(FALSE),
+ mInitialized(FALSE)
{
}
void LLViewerTextureList::init()
-{
- mInitialized = TRUE ;
- sNumImages = 0;
- doPreloadImages();
+{
+ mInitialized = TRUE ;
+ sNumImages = 0;
+ doPreloadImages();
}
void LLViewerTextureList::doPreloadImages()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL;
-
- llassert_always(mInitialized) ;
- llassert_always(mImageList.empty()) ;
- llassert_always(mUUIDMap.empty()) ;
-
- // Set the "missing asset" image
- LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", FTT_LOCAL_FILE, MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI);
-
- // Set the "white" image
- LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", FTT_LOCAL_FILE, MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI);
- LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
- LLUIImageList* image_list = LLUIImageList::getInstance();
+ LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL;
+
+ llassert_always(mInitialized) ;
+ llassert_always(mImageList.empty()) ;
+ llassert_always(mUUIDMap.empty()) ;
+
+ // Set the "missing asset" image
+ LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", FTT_LOCAL_FILE, MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI);
+
+ // Set the "white" image
+ LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", FTT_LOCAL_FILE, MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI);
+ LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
+ LLUIImageList* image_list = LLUIImageList::getInstance();
// Set the default flat normal map
// BLANK_OBJECT_NORMAL has a version on dataserver, but it has compression artifacts
@@ -133,65 +133,65 @@ void LLViewerTextureList::doPreloadImages()
0,
BLANK_OBJECT_NORMAL);
- // PBR: irradiance
- LLViewerFetchedTexture::sDefaultIrradiancePBRp = LLViewerTextureManager::getFetchedTextureFromFile("default_irradiance.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
-
- image_list->initFromFile();
-
- // turn off clamping and bilinear filtering for uv picking images
- //LLViewerFetchedTexture* uv_test = preloadUIImage("uv_test1.tga", LLUUID::null, FALSE);
- //uv_test->setClamp(FALSE, FALSE);
- //uv_test->setMipFilterNearest(TRUE, TRUE);
- //uv_test = preloadUIImage("uv_test2.tga", LLUUID::null, FALSE);
- //uv_test->setClamp(FALSE, FALSE);
- //uv_test->setMipFilterNearest(TRUE, TRUE);
-
- LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
- if (image)
- {
- image->setAddressMode(LLTexUnit::TAM_WRAP);
- mImagePreloads.insert(image);
- }
- image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
- if (image)
- {
- image->setAddressMode(LLTexUnit::TAM_WRAP);
- mImagePreloads.insert(image);
- }
- image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
- if (image)
- {
- image->setAddressMode(LLTexUnit::TAM_WRAP);
- mImagePreloads.insert(image);
- }
- image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
- 0, 0, IMG_TRANSPARENT);
- if (image)
- {
- image->setAddressMode(LLTexUnit::TAM_WRAP);
- mImagePreloads.insert(image);
- }
- image = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
- GL_ALPHA8, GL_ALPHA, IMG_ALPHA_GRAD);
- if (image)
- {
- image->setAddressMode(LLTexUnit::TAM_CLAMP);
- mImagePreloads.insert(image);
- }
- image = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
- GL_ALPHA8, GL_ALPHA, IMG_ALPHA_GRAD_2D);
- if (image)
- {
- image->setAddressMode(LLTexUnit::TAM_CLAMP);
- mImagePreloads.insert(image);
- }
-
- LLPointer<LLImageRaw> img_blak_square_tex(new LLImageRaw(2, 2, 3));
- memset(img_blak_square_tex->getData(), 0, img_blak_square_tex->getDataSize());
- LLPointer<LLViewerFetchedTexture> img_blak_square(new LLViewerFetchedTexture(img_blak_square_tex, FTT_DEFAULT, FALSE));
- gBlackSquareID = img_blak_square->getID();
- img_blak_square->setUnremovable(TRUE);
- addImage(img_blak_square, TEX_LIST_STANDARD);
+ // PBR: irradiance
+ LLViewerFetchedTexture::sDefaultIrradiancePBRp = LLViewerTextureManager::getFetchedTextureFromFile("default_irradiance.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
+
+ image_list->initFromFile();
+
+ // turn off clamping and bilinear filtering for uv picking images
+ //LLViewerFetchedTexture* uv_test = preloadUIImage("uv_test1.tga", LLUUID::null, FALSE);
+ //uv_test->setClamp(FALSE, FALSE);
+ //uv_test->setMipFilterNearest(TRUE, TRUE);
+ //uv_test = preloadUIImage("uv_test2.tga", LLUUID::null, FALSE);
+ //uv_test->setClamp(FALSE, FALSE);
+ //uv_test->setMipFilterNearest(TRUE, TRUE);
+
+ LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
+ if (image)
+ {
+ image->setAddressMode(LLTexUnit::TAM_WRAP);
+ mImagePreloads.insert(image);
+ }
+ image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
+ if (image)
+ {
+ image->setAddressMode(LLTexUnit::TAM_WRAP);
+ mImagePreloads.insert(image);
+ }
+ image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
+ if (image)
+ {
+ image->setAddressMode(LLTexUnit::TAM_WRAP);
+ mImagePreloads.insert(image);
+ }
+ image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
+ 0, 0, IMG_TRANSPARENT);
+ if (image)
+ {
+ image->setAddressMode(LLTexUnit::TAM_WRAP);
+ mImagePreloads.insert(image);
+ }
+ image = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
+ GL_ALPHA8, GL_ALPHA, IMG_ALPHA_GRAD);
+ if (image)
+ {
+ image->setAddressMode(LLTexUnit::TAM_CLAMP);
+ mImagePreloads.insert(image);
+ }
+ image = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
+ GL_ALPHA8, GL_ALPHA, IMG_ALPHA_GRAD_2D);
+ if (image)
+ {
+ image->setAddressMode(LLTexUnit::TAM_CLAMP);
+ mImagePreloads.insert(image);
+ }
+
+ LLPointer<LLImageRaw> img_blak_square_tex(new LLImageRaw(2, 2, 3));
+ memset(img_blak_square_tex->getData(), 0, img_blak_square_tex->getDataSize());
+ LLPointer<LLViewerFetchedTexture> img_blak_square(new LLViewerFetchedTexture(img_blak_square_tex, FTT_DEFAULT, FALSE));
+ gBlackSquareID = img_blak_square->getID();
+ img_blak_square->setUnremovable(TRUE);
+ addImage(img_blak_square, TEX_LIST_STANDARD);
}
static std::string get_texture_list_name()
@@ -236,20 +236,20 @@ void LLViewerTextureList::doPrefetchImages()
LLStandardBumpmap::addstandard();
- if (LLAppViewer::instance()->getPurgeCache())
- {
- // cache was purged, no point
- return;
- }
-
- // Pre-fetch textures from last logout
- LLSD imagelist;
- std::string filename = get_texture_list_name();
- llifstream file;
- file.open(filename.c_str());
- if (file.is_open())
- {
- if ( ! LLSDSerialize::fromXML(imagelist, file) )
+ if (LLAppViewer::instance()->getPurgeCache())
+ {
+ // cache was purged, no point
+ return;
+ }
+
+ // Pre-fetch textures from last logout
+ LLSD imagelist;
+ std::string filename = get_texture_list_name();
+ llifstream file;
+ file.open(filename.c_str());
+ if (file.is_open())
+ {
+ if ( ! LLSDSerialize::fromXML(imagelist, file) )
{
file.close();
LL_WARNS() << "XML parse error reading texture list '" << filename << "'" << LL_ENDL;
@@ -258,26 +258,26 @@ void LLViewerTextureList::doPrefetchImages()
return;
}
file.close();
- }
+ }
S32 texture_count = 0;
- for (LLSD::array_iterator iter = imagelist.beginArray();
- iter != imagelist.endArray(); ++iter)
- {
- LLSD imagesd = *iter;
- LLUUID uuid = imagesd["uuid"];
- S32 pixel_area = imagesd["area"];
- S32 texture_type = imagesd["type"];
-
- if(LLViewerTexture::FETCHED_TEXTURE == texture_type || LLViewerTexture::LOD_TEXTURE == texture_type)
- {
- LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, texture_type);
- if (image)
- {
+ for (LLSD::array_iterator iter = imagelist.beginArray();
+ iter != imagelist.endArray(); ++iter)
+ {
+ LLSD imagesd = *iter;
+ LLUUID uuid = imagesd["uuid"];
+ S32 pixel_area = imagesd["area"];
+ S32 texture_type = imagesd["type"];
+
+ if(LLViewerTexture::FETCHED_TEXTURE == texture_type || LLViewerTexture::LOD_TEXTURE == texture_type)
+ {
+ LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, texture_type);
+ if (image)
+ {
texture_count += 1;
- image->addTextureStats((F32)pixel_area);
- }
- }
- }
+ image->addTextureStats((F32)pixel_area);
+ }
+ }
+ }
LL_DEBUGS() << "fetched " << texture_count << " images from " << filename << LL_ENDL;
}
@@ -290,111 +290,111 @@ LLViewerTextureList::~LLViewerTextureList()
void LLViewerTextureList::shutdown()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- // clear out preloads
- mImagePreloads.clear();
-
- // Write out list of currently loaded textures for precaching on startup
- typedef std::set<std::pair<S32,LLViewerFetchedTexture*> > image_area_list_t;
- image_area_list_t image_area_list;
- for (image_priority_list_t::iterator iter = mImageList.begin();
- iter != mImageList.end(); ++iter)
- {
- LLViewerFetchedTexture* image = *iter;
- if (!image->hasGLTexture() ||
- !image->getUseDiscard() ||
- image->needsAux() ||
- !image->getTargetHost().isInvalid() ||
- !image->getUrl().empty()
- )
- {
- continue; // avoid UI, baked, and other special images
- }
- if(!image->getBoundRecently())
- {
- continue ;
- }
- S32 desired = image->getDesiredDiscardLevel();
- if (desired >= 0 && desired < MAX_DISCARD_LEVEL)
- {
- S32 pixel_area = image->getWidth(desired) * image->getHeight(desired);
- image_area_list.insert(std::make_pair(pixel_area, image));
- }
- }
-
- LLSD imagelist;
- const S32 max_count = 1000;
- S32 count = 0;
- S32 image_type ;
- for (image_area_list_t::reverse_iterator riter = image_area_list.rbegin();
- riter != image_area_list.rend(); ++riter)
- {
- LLViewerFetchedTexture* image = riter->second;
- image_type = (S32)image->getType() ;
- imagelist[count]["area"] = riter->first;
- imagelist[count]["uuid"] = image->getID();
- imagelist[count]["type"] = image_type;
- if (++count >= max_count)
- break;
- }
-
- if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "").empty())
- {
- std::string filename = get_texture_list_name();
- llofstream file;
- file.open(filename.c_str());
+ // clear out preloads
+ mImagePreloads.clear();
+
+ // Write out list of currently loaded textures for precaching on startup
+ typedef std::set<std::pair<S32,LLViewerFetchedTexture*> > image_area_list_t;
+ image_area_list_t image_area_list;
+ for (image_priority_list_t::iterator iter = mImageList.begin();
+ iter != mImageList.end(); ++iter)
+ {
+ LLViewerFetchedTexture* image = *iter;
+ if (!image->hasGLTexture() ||
+ !image->getUseDiscard() ||
+ image->needsAux() ||
+ !image->getTargetHost().isInvalid() ||
+ !image->getUrl().empty()
+ )
+ {
+ continue; // avoid UI, baked, and other special images
+ }
+ if(!image->getBoundRecently())
+ {
+ continue ;
+ }
+ S32 desired = image->getDesiredDiscardLevel();
+ if (desired >= 0 && desired < MAX_DISCARD_LEVEL)
+ {
+ S32 pixel_area = image->getWidth(desired) * image->getHeight(desired);
+ image_area_list.insert(std::make_pair(pixel_area, image));
+ }
+ }
+
+ LLSD imagelist;
+ const S32 max_count = 1000;
+ S32 count = 0;
+ S32 image_type ;
+ for (image_area_list_t::reverse_iterator riter = image_area_list.rbegin();
+ riter != image_area_list.rend(); ++riter)
+ {
+ LLViewerFetchedTexture* image = riter->second;
+ image_type = (S32)image->getType() ;
+ imagelist[count]["area"] = riter->first;
+ imagelist[count]["uuid"] = image->getID();
+ imagelist[count]["type"] = image_type;
+ if (++count >= max_count)
+ break;
+ }
+
+ if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "").empty())
+ {
+ std::string filename = get_texture_list_name();
+ llofstream file;
+ file.open(filename.c_str());
LL_DEBUGS() << "saving " << imagelist.size() << " image list entries" << LL_ENDL;
- LLSDSerialize::toPrettyXML(imagelist, file);
- }
-
- //
- // Clean up "loaded" callbacks.
- //
- mCallbackList.clear();
-
- // Flush all of the references
- mLoadingStreamList.clear();
- mCreateTextureList.clear();
- mFastCacheList.clear();
-
- mUUIDMap.clear();
-
- mImageList.clear();
-
- mInitialized = FALSE ; //prevent loading textures again.
+ LLSDSerialize::toPrettyXML(imagelist, file);
+ }
+
+ //
+ // Clean up "loaded" callbacks.
+ //
+ mCallbackList.clear();
+
+ // Flush all of the references
+ mLoadingStreamList.clear();
+ mCreateTextureList.clear();
+ mFastCacheList.clear();
+
+ mUUIDMap.clear();
+
+ mImageList.clear();
+
+ mInitialized = FALSE ; //prevent loading textures again.
}
void LLViewerTextureList::dump()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- LL_INFOS() << "LLViewerTextureList::dump()" << LL_ENDL;
- for (image_priority_list_t::iterator it = mImageList.begin(); it != mImageList.end(); ++it)
- {
- LLViewerFetchedTexture* image = *it;
-
- LL_INFOS() << "priority " << image->getMaxVirtualSize()
- << " boost " << image->getBoostLevel()
- << " size " << image->getWidth() << "x" << image->getHeight()
- << " discard " << image->getDiscardLevel()
- << " desired " << image->getDesiredDiscardLevel()
- << " http://asset.siva.lindenlab.com/" << image->getID() << ".texture"
- << LL_ENDL;
- }
+ LL_INFOS() << "LLViewerTextureList::dump()" << LL_ENDL;
+ for (image_priority_list_t::iterator it = mImageList.begin(); it != mImageList.end(); ++it)
+ {
+ LLViewerFetchedTexture* image = *it;
+
+ LL_INFOS() << "priority " << image->getMaxVirtualSize()
+ << " boost " << image->getBoostLevel()
+ << " size " << image->getWidth() << "x" << image->getHeight()
+ << " discard " << image->getDiscardLevel()
+ << " desired " << image->getDesiredDiscardLevel()
+ << " http://asset.siva.lindenlab.com/" << image->getID() << ".texture"
+ << LL_ENDL;
+ }
}
void LLViewerTextureList::destroyGL(BOOL save_state)
{
- LLImageGL::destroyGL(save_state);
+ LLImageGL::destroyGL(save_state);
}
void LLViewerTextureList::restoreGL()
{
- llassert_always(mInitialized) ;
- LLImageGL::restoreGL();
+ llassert_always(mInitialized) ;
+ LLImageGL::restoreGL();
}
/* Vertical tab container button image IDs
Seem to not decode when running app in debug.
-
+
const LLUUID BAD_IMG_ONE("1097dcb3-aef9-8152-f471-431d840ea89e");
const LLUUID BAD_IMG_TWO("bea77041-5835-1661-f298-47e2d32b7a70");
*/
@@ -402,242 +402,242 @@ void LLViewerTextureList::restoreGL()
///////////////////////////////////////////////////////////////////////////////
LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& filename,
- FTType f_type,
- BOOL usemipmaps,
- LLViewerTexture::EBoostLevel boost_priority,
- S8 texture_type,
- LLGLint internal_format,
- LLGLenum primary_format,
- const LLUUID& force_id)
+ FTType f_type,
+ BOOL usemipmaps,
+ LLViewerTexture::EBoostLevel boost_priority,
+ S8 texture_type,
+ LLGLint internal_format,
+ LLGLenum primary_format,
+ const LLUUID& force_id)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(!mInitialized)
- {
- return NULL ;
- }
-
- std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename);
- if (full_path.empty())
- {
- LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL;
- LLViewerTexture::EBoostLevel priority = LLGLTexture::BOOST_UI;
- return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, priority);
- }
-
- std::string url = "file://" + full_path;
-
- return getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id);
+ if(!mInitialized)
+ {
+ return NULL ;
+ }
+
+ std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename);
+ if (full_path.empty())
+ {
+ LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL;
+ LLViewerTexture::EBoostLevel priority = LLGLTexture::BOOST_UI;
+ return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, priority);
+ }
+
+ std::string url = "file://" + full_path;
+
+ return getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id);
}
LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& url,
- FTType f_type,
- BOOL usemipmaps,
- LLViewerTexture::EBoostLevel boost_priority,
- S8 texture_type,
- LLGLint internal_format,
- LLGLenum primary_format,
- const LLUUID& force_id)
+ FTType f_type,
+ BOOL usemipmaps,
+ LLViewerTexture::EBoostLevel boost_priority,
+ S8 texture_type,
+ LLGLint internal_format,
+ LLGLenum primary_format,
+ const LLUUID& force_id)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(!mInitialized)
- {
- return NULL ;
- }
-
- // generate UUID based on hash of filename
- LLUUID new_id;
- if (force_id.notNull())
- {
- new_id = force_id;
- }
- else
- {
- new_id.generate(url);
- }
-
- LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id, get_element_type(boost_priority));
-
- if (!imagep.isNull())
- {
- LLViewerFetchedTexture *texture = imagep.get();
- if (texture->getUrl().empty())
- {
- LL_WARNS() << "Requested texture " << new_id << " already exists but does not have a URL" << LL_ENDL;
- }
- else if (texture->getUrl() != url)
- {
- // This is not an error as long as the images really match -
- // e.g. could be two avatars wearing the same outfit.
- LL_DEBUGS("Avatar") << "Requested texture " << new_id
- << " already exists with a different url, requested: " << url
- << " current: " << texture->getUrl() << LL_ENDL;
- }
-
- }
- if (imagep.isNull())
- {
- switch(texture_type)
- {
- case LLViewerTexture::FETCHED_TEXTURE:
- imagep = new LLViewerFetchedTexture(url, f_type, new_id, usemipmaps);
- break ;
- case LLViewerTexture::LOD_TEXTURE:
- imagep = new LLViewerLODTexture(url, f_type, new_id, usemipmaps);
- break ;
- default:
- LL_ERRS() << "Invalid texture type " << texture_type << LL_ENDL ;
- }
-
- if (internal_format && primary_format)
- {
- imagep->setExplicitFormat(internal_format, primary_format);
- }
-
- addImage(imagep, get_element_type(boost_priority));
-
- if (boost_priority != 0)
- {
- if (boost_priority == LLViewerFetchedTexture::BOOST_UI)
- {
- imagep->dontDiscard();
- }
- if (boost_priority == LLViewerFetchedTexture::BOOST_ICON
+ if(!mInitialized)
+ {
+ return NULL ;
+ }
+
+ // generate UUID based on hash of filename
+ LLUUID new_id;
+ if (force_id.notNull())
+ {
+ new_id = force_id;
+ }
+ else
+ {
+ new_id.generate(url);
+ }
+
+ LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id, get_element_type(boost_priority));
+
+ if (!imagep.isNull())
+ {
+ LLViewerFetchedTexture *texture = imagep.get();
+ if (texture->getUrl().empty())
+ {
+ LL_WARNS() << "Requested texture " << new_id << " already exists but does not have a URL" << LL_ENDL;
+ }
+ else if (texture->getUrl() != url)
+ {
+ // This is not an error as long as the images really match -
+ // e.g. could be two avatars wearing the same outfit.
+ LL_DEBUGS("Avatar") << "Requested texture " << new_id
+ << " already exists with a different url, requested: " << url
+ << " current: " << texture->getUrl() << LL_ENDL;
+ }
+
+ }
+ if (imagep.isNull())
+ {
+ switch(texture_type)
+ {
+ case LLViewerTexture::FETCHED_TEXTURE:
+ imagep = new LLViewerFetchedTexture(url, f_type, new_id, usemipmaps);
+ break ;
+ case LLViewerTexture::LOD_TEXTURE:
+ imagep = new LLViewerLODTexture(url, f_type, new_id, usemipmaps);
+ break ;
+ default:
+ LL_ERRS() << "Invalid texture type " << texture_type << LL_ENDL ;
+ }
+
+ if (internal_format && primary_format)
+ {
+ imagep->setExplicitFormat(internal_format, primary_format);
+ }
+
+ addImage(imagep, get_element_type(boost_priority));
+
+ if (boost_priority != 0)
+ {
+ if (boost_priority == LLViewerFetchedTexture::BOOST_UI)
+ {
+ imagep->dontDiscard();
+ }
+ if (boost_priority == LLViewerFetchedTexture::BOOST_ICON
|| boost_priority == LLViewerFetchedTexture::BOOST_THUMBNAIL)
- {
- // Agent and group Icons are downloadable content, nothing manages
- // icon deletion yet, so they should not persist
- imagep->dontDiscard();
- imagep->forceActive();
- }
- imagep->setBoostLevel(boost_priority);
- }
- }
-
- imagep->setGLTextureCreated(true);
-
- return imagep;
+ {
+ // Agent and group Icons are downloadable content, nothing manages
+ // icon deletion yet, so they should not persist
+ imagep->dontDiscard();
+ imagep->forceActive();
+ }
+ imagep->setBoostLevel(boost_priority);
+ }
+ }
+
+ imagep->setGLTextureCreated(true);
+
+ return imagep;
}
LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id,
- FTType f_type,
- BOOL usemipmaps,
- LLViewerTexture::EBoostLevel boost_priority,
- S8 texture_type,
- LLGLint internal_format,
- LLGLenum primary_format,
- LLHost request_from_host)
+ FTType f_type,
+ BOOL usemipmaps,
+ LLViewerTexture::EBoostLevel boost_priority,
+ S8 texture_type,
+ LLGLint internal_format,
+ LLGLenum primary_format,
+ LLHost request_from_host)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(!mInitialized)
- {
- return NULL ;
- }
-
- // Return the image with ID image_id
- // If the image is not found, creates new image and
- // enqueues a request for transmission
-
- if (image_id.isNull())
- {
- return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI));
- }
-
- LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id, get_element_type(boost_priority));
- if (!imagep.isNull())
- {
- LLViewerFetchedTexture *texture = imagep.get();
- if (request_from_host.isOk() &&
- !texture->getTargetHost().isOk())
- {
- LL_WARNS() << "Requested texture " << image_id << " already exists but does not have a host" << LL_ENDL;
- }
- else if (request_from_host.isOk() &&
- texture->getTargetHost().isOk() &&
- request_from_host != texture->getTargetHost())
- {
- LL_WARNS() << "Requested texture " << image_id << " already exists with a different target host, requested: "
- << request_from_host << " current: " << texture->getTargetHost() << LL_ENDL;
- }
- if (f_type != FTT_DEFAULT && imagep->getFTType() != f_type)
- {
- LL_WARNS() << "FTType mismatch: requested " << f_type << " image has " << imagep->getFTType() << LL_ENDL;
- }
-
- }
- if (imagep.isNull())
- {
- imagep = createImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ;
- }
-
- imagep->setGLTextureCreated(true);
-
- return imagep;
+ if(!mInitialized)
+ {
+ return NULL ;
+ }
+
+ // Return the image with ID image_id
+ // If the image is not found, creates new image and
+ // enqueues a request for transmission
+
+ if (image_id.isNull())
+ {
+ return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI));
+ }
+
+ LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id, get_element_type(boost_priority));
+ if (!imagep.isNull())
+ {
+ LLViewerFetchedTexture *texture = imagep.get();
+ if (request_from_host.isOk() &&
+ !texture->getTargetHost().isOk())
+ {
+ LL_WARNS() << "Requested texture " << image_id << " already exists but does not have a host" << LL_ENDL;
+ }
+ else if (request_from_host.isOk() &&
+ texture->getTargetHost().isOk() &&
+ request_from_host != texture->getTargetHost())
+ {
+ LL_WARNS() << "Requested texture " << image_id << " already exists with a different target host, requested: "
+ << request_from_host << " current: " << texture->getTargetHost() << LL_ENDL;
+ }
+ if (f_type != FTT_DEFAULT && imagep->getFTType() != f_type)
+ {
+ LL_WARNS() << "FTType mismatch: requested " << f_type << " image has " << imagep->getFTType() << LL_ENDL;
+ }
+
+ }
+ if (imagep.isNull())
+ {
+ imagep = createImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ;
+ }
+
+ imagep->setGLTextureCreated(true);
+
+ return imagep;
}
//when this function is called, there is no such texture in the gTextureList with image_id.
LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id,
- FTType f_type,
- BOOL usemipmaps,
- LLViewerTexture::EBoostLevel boost_priority,
- S8 texture_type,
- LLGLint internal_format,
- LLGLenum primary_format,
- LLHost request_from_host)
+ FTType f_type,
+ BOOL usemipmaps,
+ LLViewerTexture::EBoostLevel boost_priority,
+ S8 texture_type,
+ LLGLint internal_format,
+ LLGLenum primary_format,
+ LLHost request_from_host)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- static LLCachedControl<bool> fast_cache_fetching_enabled(gSavedSettings, "FastCacheFetchEnabled", true);
-
- LLPointer<LLViewerFetchedTexture> imagep ;
- switch(texture_type)
- {
- case LLViewerTexture::FETCHED_TEXTURE:
- imagep = new LLViewerFetchedTexture(image_id, f_type, request_from_host, usemipmaps);
- break ;
- case LLViewerTexture::LOD_TEXTURE:
- imagep = new LLViewerLODTexture(image_id, f_type, request_from_host, usemipmaps);
- break ;
- default:
- LL_ERRS() << "Invalid texture type " << texture_type << LL_ENDL ;
- }
-
- if (internal_format && primary_format)
- {
- imagep->setExplicitFormat(internal_format, primary_format);
- }
-
- addImage(imagep, get_element_type(boost_priority));
-
- if (boost_priority != 0)
- {
- if (boost_priority == LLViewerFetchedTexture::BOOST_UI)
- {
- imagep->dontDiscard();
- }
- if (boost_priority == LLViewerFetchedTexture::BOOST_ICON
+ static LLCachedControl<bool> fast_cache_fetching_enabled(gSavedSettings, "FastCacheFetchEnabled", true);
+
+ LLPointer<LLViewerFetchedTexture> imagep ;
+ switch(texture_type)
+ {
+ case LLViewerTexture::FETCHED_TEXTURE:
+ imagep = new LLViewerFetchedTexture(image_id, f_type, request_from_host, usemipmaps);
+ break ;
+ case LLViewerTexture::LOD_TEXTURE:
+ imagep = new LLViewerLODTexture(image_id, f_type, request_from_host, usemipmaps);
+ break ;
+ default:
+ LL_ERRS() << "Invalid texture type " << texture_type << LL_ENDL ;
+ }
+
+ if (internal_format && primary_format)
+ {
+ imagep->setExplicitFormat(internal_format, primary_format);
+ }
+
+ addImage(imagep, get_element_type(boost_priority));
+
+ if (boost_priority != 0)
+ {
+ if (boost_priority == LLViewerFetchedTexture::BOOST_UI)
+ {
+ imagep->dontDiscard();
+ }
+ if (boost_priority == LLViewerFetchedTexture::BOOST_ICON
|| boost_priority == LLViewerFetchedTexture::BOOST_THUMBNAIL)
- {
- // Agent and group Icons are downloadable content, nothing manages
- // icon deletion yet, so they should not persist.
- imagep->dontDiscard();
- imagep->forceActive();
- }
- imagep->setBoostLevel(boost_priority);
- }
- else
- {
- //by default, the texture can not be removed from memory even if it is not used.
- //here turn this off
- //if this texture should be set to NO_DELETE, call setNoDelete() afterwards.
- imagep->forceActive() ;
- }
-
- if(fast_cache_fetching_enabled)
- {
- mFastCacheList.insert(imagep);
- imagep->setInFastCacheList(true);
- }
- return imagep ;
+ {
+ // Agent and group Icons are downloadable content, nothing manages
+ // icon deletion yet, so they should not persist.
+ imagep->dontDiscard();
+ imagep->forceActive();
+ }
+ imagep->setBoostLevel(boost_priority);
+ }
+ else
+ {
+ //by default, the texture can not be removed from memory even if it is not used.
+ //here turn this off
+ //if this texture should be set to NO_DELETE, call setNoDelete() afterwards.
+ imagep->forceActive() ;
+ }
+
+ if(fast_cache_fetching_enabled)
+ {
+ mFastCacheList.insert(imagep);
+ imagep->setInFastCacheList(true);
+ }
+ return imagep ;
}
void LLViewerTextureList::findTexturesByID(const LLUUID &image_id, std::vector<LLViewerFetchedTexture*> &output)
@@ -669,111 +669,111 @@ LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id, E
void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- assert_main_thread();
- llassert_always(mInitialized) ;
- llassert(image);
- if (image->isInImageList())
- { // Flag is already set?
- LL_WARNS() << "LLViewerTextureList::addImageToList - image " << image->getID() << " already in list" << LL_ENDL;
- }
- else
- {
- if((mImageList.insert(image)).second != true)
- {
- LL_WARNS() << "Error happens when insert image " << image->getID() << " into mImageList!" << LL_ENDL ;
- }
- image->setInImageList(TRUE) ;
+ assert_main_thread();
+ llassert_always(mInitialized) ;
+ llassert(image);
+ if (image->isInImageList())
+ { // Flag is already set?
+ LL_WARNS() << "LLViewerTextureList::addImageToList - image " << image->getID() << " already in list" << LL_ENDL;
+ }
+ else
+ {
+ if((mImageList.insert(image)).second != true)
+ {
+ LL_WARNS() << "Error happens when insert image " << image->getID() << " into mImageList!" << LL_ENDL ;
+ }
+ image->setInImageList(TRUE) ;
}
}
void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- assert_main_thread();
- llassert_always(mInitialized) ;
- llassert(image);
-
- S32 count = 0;
- if (image->isInImageList())
- {
- count = mImageList.erase(image) ;
- if(count != 1)
- {
- LL_INFOS() << "Image " << image->getID()
- << " had mInImageList set but mImageList.erase() returned " << count
- << LL_ENDL;
- }
- }
- else
- { // Something is wrong, image is expected in list or callers should check first
- LL_INFOS() << "Calling removeImageFromList() for " << image->getID()
- << " but doesn't have mInImageList set"
- << " ref count is " << image->getNumRefs()
- << LL_ENDL;
- uuid_map_t::iterator iter = mUUIDMap.find(LLTextureKey(image->getID(), (ETexListType)image->getTextureListType()));
- if(iter == mUUIDMap.end())
- {
- LL_INFOS() << "Image " << image->getID() << " is also not in mUUIDMap!" << LL_ENDL ;
- }
- else if (iter->second != image)
- {
- LL_INFOS() << "Image " << image->getID() << " was in mUUIDMap but with different pointer" << LL_ENDL ;
- }
- else
- {
- LL_INFOS() << "Image " << image->getID() << " was in mUUIDMap with same pointer" << LL_ENDL ;
- }
- count = mImageList.erase(image) ;
+ assert_main_thread();
+ llassert_always(mInitialized) ;
+ llassert(image);
+
+ S32 count = 0;
+ if (image->isInImageList())
+ {
+ count = mImageList.erase(image) ;
+ if(count != 1)
+ {
+ LL_INFOS() << "Image " << image->getID()
+ << " had mInImageList set but mImageList.erase() returned " << count
+ << LL_ENDL;
+ }
+ }
+ else
+ { // Something is wrong, image is expected in list or callers should check first
+ LL_INFOS() << "Calling removeImageFromList() for " << image->getID()
+ << " but doesn't have mInImageList set"
+ << " ref count is " << image->getNumRefs()
+ << LL_ENDL;
+ uuid_map_t::iterator iter = mUUIDMap.find(LLTextureKey(image->getID(), (ETexListType)image->getTextureListType()));
+ if(iter == mUUIDMap.end())
+ {
+ LL_INFOS() << "Image " << image->getID() << " is also not in mUUIDMap!" << LL_ENDL ;
+ }
+ else if (iter->second != image)
+ {
+ LL_INFOS() << "Image " << image->getID() << " was in mUUIDMap but with different pointer" << LL_ENDL ;
+ }
+ else
+ {
+ LL_INFOS() << "Image " << image->getID() << " was in mUUIDMap with same pointer" << LL_ENDL ;
+ }
+ count = mImageList.erase(image) ;
llassert(count != 0);
- if(count != 0)
- { // it was in the list already?
- LL_WARNS() << "Image " << image->getID()
- << " had mInImageList false but mImageList.erase() returned " << count
- << LL_ENDL;
- }
- }
-
- image->setInImageList(FALSE) ;
+ if(count != 0)
+ { // it was in the list already?
+ LL_WARNS() << "Image " << image->getID()
+ << " had mInImageList false but mImageList.erase() returned " << count
+ << LL_ENDL;
+ }
+ }
+
+ image->setInImageList(FALSE) ;
}
void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, ETexListType tex_type)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (!new_image)
- {
- return;
- }
- //llassert(new_image);
- LLUUID image_id = new_image->getID();
- LLTextureKey key(image_id, tex_type);
-
- LLViewerFetchedTexture *image = findImage(key);
- if (image)
- {
- LL_INFOS() << "Image with ID " << image_id << " already in list" << LL_ENDL;
- }
- sNumImages++;
-
- addImageToList(new_image);
- mUUIDMap[key] = new_image;
- new_image->setTextureListType(tex_type);
+ if (!new_image)
+ {
+ return;
+ }
+ //llassert(new_image);
+ LLUUID image_id = new_image->getID();
+ LLTextureKey key(image_id, tex_type);
+
+ LLViewerFetchedTexture *image = findImage(key);
+ if (image)
+ {
+ LL_INFOS() << "Image with ID " << image_id << " already in list" << LL_ENDL;
+ }
+ sNumImages++;
+
+ addImageToList(new_image);
+ mUUIDMap[key] = new_image;
+ new_image->setTextureListType(tex_type);
}
void LLViewerTextureList::deleteImage(LLViewerFetchedTexture *image)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if( image)
- {
- if (image->hasCallbacks())
- {
- mCallbackList.erase(image);
- }
- LLTextureKey key(image->getID(), (ETexListType)image->getTextureListType());
- llverify(mUUIDMap.erase(key) == 1);
- sNumImages--;
- removeImageFromList(image);
- }
+ if( image)
+ {
+ if (image->hasCallbacks())
+ {
+ mCallbackList.erase(image);
+ }
+ LLTextureKey key(image->getID(), (ETexListType)image->getTextureListType());
+ llverify(mUUIDMap.erase(key) == 1);
+ sNumImages--;
+ removeImageFromList(image);
+ }
}
///////////////////////////////////////////////////////////////////////////////
@@ -783,7 +783,7 @@ void LLViewerTextureList::deleteImage(LLViewerFetchedTexture *image)
void LLViewerTextureList::dirtyImage(LLViewerFetchedTexture *image)
{
- mDirtyTextureList.insert(image);
+ mDirtyTextureList.insert(image);
}
////////////////////////////////////////////////////////////////////////////
@@ -791,86 +791,86 @@ void LLViewerTextureList::dirtyImage(LLViewerFetchedTexture *image)
void LLViewerTextureList::updateImages(F32 max_time)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- static BOOL cleared = FALSE;
- if(gTeleportDisplay)
- {
- if(!cleared)
- {
- clearFetchingRequests();
- gPipeline.clearRebuildGroups();
- cleared = TRUE;
- }
- return;
- }
- cleared = FALSE;
-
- LLAppViewer::getTextureFetch()->setTextureBandwidth(LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED).value());
-
- {
- using namespace LLStatViewer;
- sample(NUM_IMAGES, sNumImages);
- sample(NUM_RAW_IMAGES, LLImageRaw::sRawImageCount);
- sample(FORMATTED_MEM, F64Bytes(LLImageFormatted::sGlobalFormattedMemory));
- }
+ static BOOL cleared = FALSE;
+ if(gTeleportDisplay)
+ {
+ if(!cleared)
+ {
+ clearFetchingRequests();
+ gPipeline.clearRebuildGroups();
+ cleared = TRUE;
+ }
+ return;
+ }
+ cleared = FALSE;
+
+ LLAppViewer::getTextureFetch()->setTextureBandwidth(LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED).value());
+
+ {
+ using namespace LLStatViewer;
+ sample(NUM_IMAGES, sNumImages);
+ sample(NUM_RAW_IMAGES, LLImageRaw::sRawImageCount);
+ sample(FORMATTED_MEM, F64Bytes(LLImageFormatted::sGlobalFormattedMemory));
+ }
// make sure each call below gets at least its "fair share" of time
F32 min_time = max_time * 0.33f;
F32 remaining_time = max_time;
- //loading from fast cache
- remaining_time -= updateImagesLoadingFastCache(remaining_time);
+ //loading from fast cache
+ remaining_time -= updateImagesLoadingFastCache(remaining_time);
remaining_time = llmax(remaining_time, min_time);
//dispatch to texture fetch threads
- remaining_time -= updateImagesFetchTextures(remaining_time);
+ remaining_time -= updateImagesFetchTextures(remaining_time);
remaining_time = llmax(remaining_time, min_time);
//handle results from decode threads
- updateImagesCreateTextures(remaining_time);
-
- if (!mDirtyTextureList.empty())
- {
- gPipeline.dirtyPoolObjectTextures(mDirtyTextureList);
- mDirtyTextureList.clear();
- }
-
- bool didone = false;
- for (image_list_t::iterator iter = mCallbackList.begin();
- iter != mCallbackList.end(); )
- {
- //trigger loaded callbacks on local textures immediately
- LLViewerFetchedTexture* image = *iter++;
- if (!image->getUrl().empty())
- {
- // Do stuff to handle callbacks, update priorities, etc.
- didone = image->doLoadedCallbacks();
- }
- else if (!didone)
- {
- // Do stuff to handle callbacks, update priorities, etc.
- didone = image->doLoadedCallbacks();
- }
- }
-
- updateImagesUpdateStats();
+ updateImagesCreateTextures(remaining_time);
+
+ if (!mDirtyTextureList.empty())
+ {
+ gPipeline.dirtyPoolObjectTextures(mDirtyTextureList);
+ mDirtyTextureList.clear();
+ }
+
+ bool didone = false;
+ for (image_list_t::iterator iter = mCallbackList.begin();
+ iter != mCallbackList.end(); )
+ {
+ //trigger loaded callbacks on local textures immediately
+ LLViewerFetchedTexture* image = *iter++;
+ if (!image->getUrl().empty())
+ {
+ // Do stuff to handle callbacks, update priorities, etc.
+ didone = image->doLoadedCallbacks();
+ }
+ else if (!didone)
+ {
+ // Do stuff to handle callbacks, update priorities, etc.
+ didone = image->doLoadedCallbacks();
+ }
+ }
+
+ updateImagesUpdateStats();
}
void LLViewerTextureList::clearFetchingRequests()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)
- {
- return;
- }
-
- LLAppViewer::getTextureFetch()->deleteAllRequests();
-
- for (image_priority_list_t::iterator iter = mImageList.begin();
- iter != mImageList.end(); ++iter)
- {
- LLViewerFetchedTexture* imagep = *iter;
- imagep->forceToDeleteRequest() ;
- }
+ if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)
+ {
+ return;
+ }
+
+ LLAppViewer::getTextureFetch()->deleteAllRequests();
+
+ for (image_priority_list_t::iterator iter = mImageList.begin();
+ iter != mImageList.end(); ++iter)
+ {
+ LLViewerFetchedTexture* imagep = *iter;
+ imagep->forceToDeleteRequest() ;
+ }
}
static void touch_texture(LLViewerFetchedTexture* tex, F32 vsize)
@@ -929,7 +929,7 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
}
#endif
// if a GLTF material is present, ignore that face
- // as far as this texture stats go, but update the GLTF material
+ // as far as this texture stats go, but update the GLTF material
// stats
LLFetchedGLTFMaterial* mat = te ? (LLFetchedGLTFMaterial*)te->getGLTFRenderMaterial() : nullptr;
llassert(mat == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(te->getGLTFRenderMaterial()) != nullptr);
@@ -965,7 +965,7 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
{
// Remove the unused image from the image list
deleteImage(imagep);
- imagep = NULL; // should destroy the image
+ imagep = NULL; // should destroy the image
}
return;
}
@@ -1020,91 +1020,91 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
void LLViewerTextureList::setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(!tex->setDebugFetching(debug_level))
- {
- return;
- }
+ if(!tex->setDebugFetching(debug_level))
+ {
+ return;
+ }
- const F32 DEBUG_PRIORITY = 100000.f;
- removeImageFromList(tex);
+ const F32 DEBUG_PRIORITY = 100000.f;
+ removeImageFromList(tex);
tex->mMaxVirtualSize = DEBUG_PRIORITY;
- addImageToList(tex);
+ addImageToList(tex);
}
F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (gGLManager.mIsDisabled) return 0.0f;
-
- //
- // Create GL textures for all textures that need them (images which have been
- // decoded, but haven't been pushed into GL).
- //
-
- LLTimer create_timer;
- image_list_t::iterator enditer = mCreateTextureList.begin();
- for (image_list_t::iterator iter = mCreateTextureList.begin();
- iter != mCreateTextureList.end();)
- {
- image_list_t::iterator curiter = iter++;
- enditer = iter;
- LLViewerFetchedTexture *imagep = *curiter;
- imagep->createTexture();
+ if (gGLManager.mIsDisabled) return 0.0f;
+
+ //
+ // Create GL textures for all textures that need them (images which have been
+ // decoded, but haven't been pushed into GL).
+ //
+
+ LLTimer create_timer;
+ image_list_t::iterator enditer = mCreateTextureList.begin();
+ for (image_list_t::iterator iter = mCreateTextureList.begin();
+ iter != mCreateTextureList.end();)
+ {
+ image_list_t::iterator curiter = iter++;
+ enditer = iter;
+ LLViewerFetchedTexture *imagep = *curiter;
+ imagep->createTexture();
imagep->postCreateTexture();
if (create_timer.getElapsedTimeF32() > max_time)
{
break;
}
- }
- mCreateTextureList.erase(mCreateTextureList.begin(), enditer);
- return create_timer.getElapsedTimeF32();
+ }
+ mCreateTextureList.erase(mCreateTextureList.begin(), enditer);
+ return create_timer.getElapsedTimeF32();
}
F32 LLViewerTextureList::updateImagesLoadingFastCache(F32 max_time)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (gGLManager.mIsDisabled) return 0.0f;
- if(mFastCacheList.empty())
- {
- return 0.f;
- }
-
- //
- // loading texture raw data from the fast cache directly.
- //
-
- LLTimer timer;
- image_list_t::iterator enditer = mFastCacheList.begin();
- for (image_list_t::iterator iter = mFastCacheList.begin();
- iter != mFastCacheList.end();)
- {
- image_list_t::iterator curiter = iter++;
- enditer = iter;
- LLViewerFetchedTexture *imagep = *curiter;
- imagep->loadFromFastCache();
- }
- mFastCacheList.erase(mFastCacheList.begin(), enditer);
- return timer.getElapsedTimeF32();
+ if (gGLManager.mIsDisabled) return 0.0f;
+ if(mFastCacheList.empty())
+ {
+ return 0.f;
+ }
+
+ //
+ // loading texture raw data from the fast cache directly.
+ //
+
+ LLTimer timer;
+ image_list_t::iterator enditer = mFastCacheList.begin();
+ for (image_list_t::iterator iter = mFastCacheList.begin();
+ iter != mFastCacheList.end();)
+ {
+ image_list_t::iterator curiter = iter++;
+ enditer = iter;
+ LLViewerFetchedTexture *imagep = *curiter;
+ imagep->loadFromFastCache();
+ }
+ mFastCacheList.erase(mFastCacheList.begin(), enditer);
+ return timer.getElapsedTimeF32();
}
void LLViewerTextureList::forceImmediateUpdate(LLViewerFetchedTexture* imagep)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(!imagep)
- {
- return ;
- }
- if(imagep->isInImageList())
- {
- removeImageFromList(imagep);
- }
-
- imagep->processTextureStats();
+ if(!imagep)
+ {
+ return ;
+ }
+ if(imagep->isInImageList())
+ {
+ removeImageFromList(imagep);
+ }
+
+ imagep->processTextureStats();
imagep->sMaxVirtualSize = LLViewerFetchedTexture::sMaxVirtualSize;
- addImageToList(imagep);
-
- return ;
+ addImageToList(imagep);
+
+ return ;
}
F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
@@ -1120,7 +1120,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
//update MIN_UPDATE_COUNT or 5% of other textures, whichever is greater
update_count = llmax((U32) MIN_UPDATE_COUNT, (U32) mUUIDMap.size()/20);
update_count = llmin(update_count, (U32) mUUIDMap.size());
-
+
{
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vtluift - copy");
@@ -1133,7 +1133,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
{
iter = mUUIDMap.begin();
}
-
+
if (iter->second->getGLTexture())
{
entries.push_back(iter->second);
@@ -1168,68 +1168,68 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
mLastUpdateKey = LLTextureKey(last_imagep->getID(), (ETexListType)last_imagep->getTextureListType());
}
- return timer.getElapsedTimeF32();
+ return timer.getElapsedTimeF32();
}
void LLViewerTextureList::updateImagesUpdateStats()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (mForceResetTextureStats)
- {
- for (image_priority_list_t::iterator iter = mImageList.begin();
- iter != mImageList.end(); )
- {
- LLViewerFetchedTexture* imagep = *iter++;
- imagep->resetTextureStats();
- }
- mForceResetTextureStats = FALSE;
- }
+ if (mForceResetTextureStats)
+ {
+ for (image_priority_list_t::iterator iter = mImageList.begin();
+ iter != mImageList.end(); )
+ {
+ LLViewerFetchedTexture* imagep = *iter++;
+ imagep->resetTextureStats();
+ }
+ mForceResetTextureStats = FALSE;
+ }
}
void LLViewerTextureList::decodeAllImages(F32 max_time)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- LLTimer timer;
-
- //loading from fast cache
- updateImagesLoadingFastCache(max_time);
-
- // Update texture stats and priorities
- std::vector<LLPointer<LLViewerFetchedTexture> > image_list;
- for (image_priority_list_t::iterator iter = mImageList.begin();
- iter != mImageList.end(); )
- {
- LLViewerFetchedTexture* imagep = *iter++;
- image_list.push_back(imagep);
- imagep->setInImageList(FALSE) ;
- }
-
- llassert_always(image_list.size() == mImageList.size()) ;
- mImageList.clear();
- for (std::vector<LLPointer<LLViewerFetchedTexture> >::iterator iter = image_list.begin();
- iter != image_list.end(); ++iter)
- {
- LLViewerFetchedTexture* imagep = *iter;
- imagep->processTextureStats();
- addImageToList(imagep);
- }
- image_list.clear();
-
- // Update fetch (decode)
- for (image_priority_list_t::iterator iter = mImageList.begin();
- iter != mImageList.end(); )
- {
- LLViewerFetchedTexture* imagep = *iter++;
- imagep->updateFetch();
- }
+ LLTimer timer;
+
+ //loading from fast cache
+ updateImagesLoadingFastCache(max_time);
+
+ // Update texture stats and priorities
+ std::vector<LLPointer<LLViewerFetchedTexture> > image_list;
+ for (image_priority_list_t::iterator iter = mImageList.begin();
+ iter != mImageList.end(); )
+ {
+ LLViewerFetchedTexture* imagep = *iter++;
+ image_list.push_back(imagep);
+ imagep->setInImageList(FALSE) ;
+ }
+
+ llassert_always(image_list.size() == mImageList.size()) ;
+ mImageList.clear();
+ for (std::vector<LLPointer<LLViewerFetchedTexture> >::iterator iter = image_list.begin();
+ iter != image_list.end(); ++iter)
+ {
+ LLViewerFetchedTexture* imagep = *iter;
+ imagep->processTextureStats();
+ addImageToList(imagep);
+ }
+ image_list.clear();
+
+ // Update fetch (decode)
+ for (image_priority_list_t::iterator iter = mImageList.begin();
+ iter != mImageList.end(); )
+ {
+ LLViewerFetchedTexture* imagep = *iter++;
+ imagep->updateFetch();
+ }
std::shared_ptr<LL::WorkQueue> main_queue = LLImageGLThread::sEnabledTextures ? LL::WorkQueue::getInstance("mainloop") : NULL;
- // Run threads
- S32 fetch_pending = 0;
- while (1)
- {
- LLAppViewer::instance()->getTextureCache()->update(1); // unpauses the texture cache thread
- LLAppViewer::instance()->getImageDecodeThread()->update(1); // unpauses the image thread
- fetch_pending = LLAppViewer::instance()->getTextureFetch()->update(1); // unpauses the texture fetch thread
+ // Run threads
+ S32 fetch_pending = 0;
+ while (1)
+ {
+ LLAppViewer::instance()->getTextureCache()->update(1); // unpauses the texture cache thread
+ LLAppViewer::instance()->getImageDecodeThread()->update(1); // unpauses the image thread
+ fetch_pending = LLAppViewer::instance()->getTextureFetch()->update(1); // unpauses the texture fetch thread
if (LLImageGLThread::sEnabledTextures)
{
@@ -1237,26 +1237,26 @@ void LLViewerTextureList::decodeAllImages(F32 max_time)
fetch_pending += main_queue->size();
}
- if (fetch_pending == 0 || timer.getElapsedTimeF32() > max_time)
- {
- break;
- }
- }
- // Update fetch again
- for (image_priority_list_t::iterator iter = mImageList.begin();
- iter != mImageList.end(); )
- {
- LLViewerFetchedTexture* imagep = *iter++;
- imagep->updateFetch();
- }
- max_time -= timer.getElapsedTimeF32();
- max_time = llmax(max_time, .001f);
- F32 create_time = updateImagesCreateTextures(max_time);
-
- LL_DEBUGS("ViewerImages") << "decodeAllImages() took " << timer.getElapsedTimeF32() << " seconds. "
- << " fetch_pending " << fetch_pending
- << " create_time " << create_time
- << LL_ENDL;
+ if (fetch_pending == 0 || timer.getElapsedTimeF32() > max_time)
+ {
+ break;
+ }
+ }
+ // Update fetch again
+ for (image_priority_list_t::iterator iter = mImageList.begin();
+ iter != mImageList.end(); )
+ {
+ LLViewerFetchedTexture* imagep = *iter++;
+ imagep->updateFetch();
+ }
+ max_time -= timer.getElapsedTimeF32();
+ max_time = llmax(max_time, .001f);
+ F32 create_time = updateImagesCreateTextures(max_time);
+
+ LL_DEBUGS("ViewerImages") << "decodeAllImages() took " << timer.getElapsedTimeF32() << " seconds. "
+ << " fetch_pending " << fetch_pending
+ << " create_time " << create_time
+ << LL_ENDL;
}
bool LLViewerTextureList::createUploadFile(LLPointer<LLImageRaw> raw_image,
@@ -1300,38 +1300,38 @@ bool LLViewerTextureList::createUploadFile(LLPointer<LLImageRaw> raw_image,
}
BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
- const std::string& out_filename,
- const U8 codec,
- const S32 max_image_dimentions,
- const S32 min_image_dimentions,
- bool force_square)
-{
+ const std::string& out_filename,
+ const U8 codec,
+ const S32 max_image_dimentions,
+ const S32 min_image_dimentions,
+ bool force_square)
+{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- // Load the image
- LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
- if (image.isNull())
- {
- LL_WARNS() << "Couldn't open the image to be uploaded." << LL_ENDL;
- return FALSE;
- }
- if (!image->load(filename))
- {
- image->setLastError("Couldn't load the image to be uploaded.");
- return FALSE;
- }
- // Decompress or expand it in a raw image structure
- LLPointer<LLImageRaw> raw_image = new LLImageRaw;
- if (!image->decode(raw_image, 0.0f))
- {
- image->setLastError("Couldn't decode the image to be uploaded.");
- return FALSE;
- }
- // Check the image constraints
- if ((image->getComponents() != 3) && (image->getComponents() != 4))
- {
- image->setLastError("Image files with less than 3 or more than 4 components are not supported.");
- return FALSE;
- }
+ // Load the image
+ LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
+ if (image.isNull())
+ {
+ LL_WARNS() << "Couldn't open the image to be uploaded." << LL_ENDL;
+ return FALSE;
+ }
+ if (!image->load(filename))
+ {
+ image->setLastError("Couldn't load the image to be uploaded.");
+ return FALSE;
+ }
+ // Decompress or expand it in a raw image structure
+ LLPointer<LLImageRaw> raw_image = new LLImageRaw;
+ if (!image->decode(raw_image, 0.0f))
+ {
+ image->setLastError("Couldn't decode the image to be uploaded.");
+ return FALSE;
+ }
+ // Check the image constraints
+ if ((image->getComponents() != 3) && (image->getComponents() != 4))
+ {
+ image->setLastError("Image files with less than 3 or more than 4 components are not supported.");
+ return FALSE;
+ }
if (image->getWidth() < min_image_dimentions || image->getHeight() < min_image_dimentions)
{
std::string reason = llformat("Images below %d x %d pixels are not allowed. Actual size: %d x %dpx",
@@ -1342,35 +1342,35 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
image->setLastError(reason);
return FALSE;
}
- // Convert to j2c (JPEG2000) and save the file locally
- LLPointer<LLImageJ2C> compressedImage = convertToUploadFile(raw_image, max_image_dimentions, force_square);
- if (compressedImage.isNull())
- {
- image->setLastError("Couldn't convert the image to jpeg2000.");
- LL_INFOS() << "Couldn't convert to j2c, file : " << filename << LL_ENDL;
- return FALSE;
- }
- if (!compressedImage->save(out_filename))
- {
- image->setLastError("Couldn't create the jpeg2000 image for upload.");
- LL_INFOS() << "Couldn't create output file : " << out_filename << LL_ENDL;
- return FALSE;
- }
- // Test to see if the encode and save worked
- LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
- if (!integrity_test->loadAndValidate( out_filename ))
- {
- image->setLastError("The created jpeg2000 image is corrupt.");
- LL_INFOS() << "Image file : " << out_filename << " is corrupt" << LL_ENDL;
- return FALSE;
- }
- return TRUE;
+ // Convert to j2c (JPEG2000) and save the file locally
+ LLPointer<LLImageJ2C> compressedImage = convertToUploadFile(raw_image, max_image_dimentions, force_square);
+ if (compressedImage.isNull())
+ {
+ image->setLastError("Couldn't convert the image to jpeg2000.");
+ LL_INFOS() << "Couldn't convert to j2c, file : " << filename << LL_ENDL;
+ return FALSE;
+ }
+ if (!compressedImage->save(out_filename))
+ {
+ image->setLastError("Couldn't create the jpeg2000 image for upload.");
+ LL_INFOS() << "Couldn't create output file : " << out_filename << LL_ENDL;
+ return FALSE;
+ }
+ // Test to see if the encode and save worked
+ LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
+ if (!integrity_test->loadAndValidate( out_filename ))
+ {
+ image->setLastError("The created jpeg2000 image is corrupt.");
+ LL_INFOS() << "Image file : " << out_filename << " is corrupt" << LL_ENDL;
+ return FALSE;
+ }
+ return TRUE;
}
// note: modifies the argument raw_image!!!!
LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImageRaw> raw_image, const S32 max_image_dimentions, bool force_square, bool force_lossless)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
if (force_square)
{
S32 biggest_side = llmax(raw_image->getWidth(), raw_image->getHeight());
@@ -1382,36 +1382,36 @@ LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImage
{
raw_image->biasedScaleToPowerOfTwo(max_image_dimentions);
}
- LLPointer<LLImageJ2C> compressedImage = new LLImageJ2C();
-
+ LLPointer<LLImageJ2C> compressedImage = new LLImageJ2C();
+
if (force_lossless ||
(gSavedSettings.getBOOL("LosslessJ2CUpload") &&
(raw_image->getWidth() * raw_image->getHeight() <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF)))
{
compressedImage->setReversible(TRUE);
}
-
-
- if (gSavedSettings.getBOOL("Jpeg2000AdvancedCompression"))
- {
- // This test option will create jpeg2000 images with precincts for each level, RPCL ordering
- // and PLT markers. The block size is also optionally modifiable.
- // Note: the images hence created are compatible with older versions of the viewer.
- // Read the blocks and precincts size settings
- S32 block_size = gSavedSettings.getS32("Jpeg2000BlocksSize");
- S32 precinct_size = gSavedSettings.getS32("Jpeg2000PrecinctsSize");
- LL_INFOS() << "Advanced JPEG2000 Compression: precinct = " << precinct_size << ", block = " << block_size << LL_ENDL;
- compressedImage->initEncode(*raw_image, block_size, precinct_size, 0);
- }
-
- if (!compressedImage->encode(raw_image, 0.0f))
- {
- LL_INFOS() << "convertToUploadFile : encode returns with error!!" << LL_ENDL;
- // Clear up the pointer so we don't leak that one
- compressedImage = NULL;
- }
-
- return compressedImage;
+
+
+ if (gSavedSettings.getBOOL("Jpeg2000AdvancedCompression"))
+ {
+ // This test option will create jpeg2000 images with precincts for each level, RPCL ordering
+ // and PLT markers. The block size is also optionally modifiable.
+ // Note: the images hence created are compatible with older versions of the viewer.
+ // Read the blocks and precincts size settings
+ S32 block_size = gSavedSettings.getS32("Jpeg2000BlocksSize");
+ S32 precinct_size = gSavedSettings.getS32("Jpeg2000PrecinctsSize");
+ LL_INFOS() << "Advanced JPEG2000 Compression: precinct = " << precinct_size << ", block = " << block_size << LL_ENDL;
+ compressedImage->initEncode(*raw_image, block_size, precinct_size, 0);
+ }
+
+ if (!compressedImage->encode(raw_image, 0.0f))
+ {
+ LL_INFOS() << "convertToUploadFile : encode returns with error!!" << LL_ENDL;
+ // Clear up the pointer so we don't leak that one
+ compressedImage = NULL;
+ }
+
+ return compressedImage;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1421,15 +1421,15 @@ LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImage
void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **user_data)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- LLUUID image_id;
- msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, image_id);
-
- LLViewerFetchedTexture* image = gTextureList.findImage( image_id, TEX_LIST_STANDARD);
- if( image )
- {
- LL_WARNS() << "Image not in db" << LL_ENDL;
- image->setIsMissingAsset();
- }
+ LLUUID image_id;
+ msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, image_id);
+
+ LLViewerFetchedTexture* image = gTextureList.findImage( image_id, TEX_LIST_STANDARD);
+ if( image )
+ {
+ LL_WARNS() << "Image not in db" << LL_ENDL;
+ image->setIsMissingAsset();
+ }
image = gTextureList.findImage(image_id, TEX_LIST_SCALE);
if (image)
@@ -1447,307 +1447,307 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **
// guaranteed.
void LLUIImageList::cleanUp()
{
- mUIImages.clear();
- mUITextureList.clear() ;
+ mUIImages.clear();
+ mUITextureList.clear() ;
}
LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id, S32 priority)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- // use id as image name
- std::string image_name = image_id.asString();
-
- // look for existing image
- uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name);
- if (found_it != mUIImages.end())
- {
- return found_it->second;
- }
-
- const BOOL use_mips = FALSE;
- const LLRect scale_rect = LLRect::null;
- const LLRect clip_rect = LLRect::null;
- return loadUIImageByID(image_id, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority);
+ // use id as image name
+ std::string image_name = image_id.asString();
+
+ // look for existing image
+ uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name);
+ if (found_it != mUIImages.end())
+ {
+ return found_it->second;
+ }
+
+ const BOOL use_mips = FALSE;
+ const LLRect scale_rect = LLRect::null;
+ const LLRect clip_rect = LLRect::null;
+ return loadUIImageByID(image_id, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority);
}
LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priority)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- // look for existing image
- uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name);
- if (found_it != mUIImages.end())
- {
- return found_it->second;
- }
-
- const BOOL use_mips = FALSE;
- const LLRect scale_rect = LLRect::null;
- const LLRect clip_rect = LLRect::null;
- return loadUIImageByName(image_name, image_name, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority);
+ // look for existing image
+ uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name);
+ if (found_it != mUIImages.end())
+ {
+ return found_it->second;
+ }
+
+ const BOOL use_mips = FALSE;
+ const LLRect scale_rect = LLRect::null;
+ const LLRect clip_rect = LLRect::null;
+ return loadUIImageByName(image_name, image_name, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority);
}
LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename,
- BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority,
- LLUIImage::EScaleStyle scale_style)
+ BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority,
+ LLUIImage::EScaleStyle scale_style)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (boost_priority == LLGLTexture::BOOST_NONE)
- {
- boost_priority = LLGLTexture::BOOST_UI;
- }
- LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, FTT_LOCAL_FILE, MIPMAP_NO, boost_priority);
- return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect, scale_style);
+ if (boost_priority == LLGLTexture::BOOST_NONE)
+ {
+ boost_priority = LLGLTexture::BOOST_UI;
+ }
+ LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, FTT_LOCAL_FILE, MIPMAP_NO, boost_priority);
+ return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect, scale_style);
}
LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id,
- BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority,
- LLUIImage::EScaleStyle scale_style)
+ BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority,
+ LLUIImage::EScaleStyle scale_style)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (boost_priority == LLGLTexture::BOOST_NONE)
- {
- boost_priority = LLGLTexture::BOOST_UI;
- }
- LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, MIPMAP_NO, boost_priority);
- return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect, scale_style);
+ if (boost_priority == LLGLTexture::BOOST_NONE)
+ {
+ boost_priority = LLGLTexture::BOOST_UI;
+ }
+ LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, MIPMAP_NO, boost_priority);
+ return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect, scale_style);
}
LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect,
- LLUIImage::EScaleStyle scale_style)
+ LLUIImage::EScaleStyle scale_style)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if (!imagep) return NULL;
+ if (!imagep) return NULL;
- imagep->setAddressMode(LLTexUnit::TAM_CLAMP);
+ imagep->setAddressMode(LLTexUnit::TAM_CLAMP);
- //don't compress UI images
- imagep->getGLTexture()->setAllowCompression(false);
+ //don't compress UI images
+ imagep->getGLTexture()->setAllowCompression(false);
- LLUIImagePtr new_imagep = new LLUIImage(name, imagep);
- new_imagep->setScaleStyle(scale_style);
+ LLUIImagePtr new_imagep = new LLUIImage(name, imagep);
+ new_imagep->setScaleStyle(scale_style);
- if (imagep->getBoostLevel() != LLGLTexture::BOOST_ICON
+ if (imagep->getBoostLevel() != LLGLTexture::BOOST_ICON
&& imagep->getBoostLevel() != LLGLTexture::BOOST_THUMBNAIL
- && imagep->getBoostLevel() != LLGLTexture::BOOST_PREVIEW)
- {
- // Don't add downloadable content into this list
- // all UI images are non-deletable and list does not support deletion
- imagep->setNoDelete();
- mUIImages.insert(std::make_pair(name, new_imagep));
- mUITextureList.push_back(imagep);
- }
-
- //Note:
- //Some other textures such as ICON also through this flow to be fetched.
- //But only UI textures need to set this callback.
- if(imagep->getBoostLevel() == LLGLTexture::BOOST_UI)
- {
- LLUIImageLoadData* datap = new LLUIImageLoadData;
- datap->mImageName = name;
- datap->mImageScaleRegion = scale_rect;
- datap->mImageClipRegion = clip_rect;
-
- imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL);
- }
- return new_imagep;
+ && imagep->getBoostLevel() != LLGLTexture::BOOST_PREVIEW)
+ {
+ // Don't add downloadable content into this list
+ // all UI images are non-deletable and list does not support deletion
+ imagep->setNoDelete();
+ mUIImages.insert(std::make_pair(name, new_imagep));
+ mUITextureList.push_back(imagep);
+ }
+
+ //Note:
+ //Some other textures such as ICON also through this flow to be fetched.
+ //But only UI textures need to set this callback.
+ if(imagep->getBoostLevel() == LLGLTexture::BOOST_UI)
+ {
+ LLUIImageLoadData* datap = new LLUIImageLoadData;
+ datap->mImageName = name;
+ datap->mImageScaleRegion = scale_rect;
+ datap->mImageClipRegion = clip_rect;
+
+ imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL);
+ }
+ return new_imagep;
}
LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle scale_style)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- // look for existing image
- uuid_ui_image_map_t::iterator found_it = mUIImages.find(name);
- if (found_it != mUIImages.end())
- {
- // image already loaded!
- LL_ERRS() << "UI Image " << name << " already loaded." << LL_ENDL;
- }
-
- return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect, LLGLTexture::BOOST_UI, scale_style);
+ // look for existing image
+ uuid_ui_image_map_t::iterator found_it = mUIImages.find(name);
+ if (found_it != mUIImages.end())
+ {
+ // image already loaded!
+ LL_ERRS() << "UI Image " << name << " already loaded." << LL_ENDL;
+ }
+
+ return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect, LLGLTexture::BOOST_UI, scale_style);
}
-//static
+//static
void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* user_data )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- if(!success || !user_data)
- {
- return;
- }
-
- LLUIImageLoadData* image_datap = (LLUIImageLoadData*)user_data;
- std::string ui_image_name = image_datap->mImageName;
- LLRect scale_rect = image_datap->mImageScaleRegion;
- LLRect clip_rect = image_datap->mImageClipRegion;
- if (final)
- {
- delete image_datap;
- }
-
- LLUIImageList* instance = getInstance();
-
- uuid_ui_image_map_t::iterator found_it = instance->mUIImages.find(ui_image_name);
- if (found_it != instance->mUIImages.end())
- {
- LLUIImagePtr imagep = found_it->second;
-
- // for images grabbed from local files, apply clipping rectangle to restore original dimensions
- // from power-of-2 gl image
- if (success && imagep.notNull() && src_vi && (src_vi->getUrl().compare(0, 7, "file://")==0))
- {
- F32 full_width = (F32)src_vi->getFullWidth();
- F32 full_height = (F32)src_vi->getFullHeight();
- F32 clip_x = (F32)src_vi->getOriginalWidth() / full_width;
- F32 clip_y = (F32)src_vi->getOriginalHeight() / full_height;
- if (clip_rect != LLRect::null)
- {
- imagep->setClipRegion(LLRectf(llclamp((F32)clip_rect.mLeft / full_width, 0.f, 1.f),
- llclamp((F32)clip_rect.mTop / full_height, 0.f, 1.f),
- llclamp((F32)clip_rect.mRight / full_width, 0.f, 1.f),
- llclamp((F32)clip_rect.mBottom / full_height, 0.f, 1.f)));
- }
- else
- {
- imagep->setClipRegion(LLRectf(0.f, clip_y, clip_x, 0.f));
- }
- if (scale_rect != LLRect::null)
- {
- imagep->setScaleRegion(
- LLRectf(llclamp((F32)scale_rect.mLeft / (F32)imagep->getWidth(), 0.f, 1.f),
- llclamp((F32)scale_rect.mTop / (F32)imagep->getHeight(), 0.f, 1.f),
- llclamp((F32)scale_rect.mRight / (F32)imagep->getWidth(), 0.f, 1.f),
- llclamp((F32)scale_rect.mBottom / (F32)imagep->getHeight(), 0.f, 1.f)));
- }
-
- imagep->onImageLoaded();
- }
- }
+ if(!success || !user_data)
+ {
+ return;
+ }
+
+ LLUIImageLoadData* image_datap = (LLUIImageLoadData*)user_data;
+ std::string ui_image_name = image_datap->mImageName;
+ LLRect scale_rect = image_datap->mImageScaleRegion;
+ LLRect clip_rect = image_datap->mImageClipRegion;
+ if (final)
+ {
+ delete image_datap;
+ }
+
+ LLUIImageList* instance = getInstance();
+
+ uuid_ui_image_map_t::iterator found_it = instance->mUIImages.find(ui_image_name);
+ if (found_it != instance->mUIImages.end())
+ {
+ LLUIImagePtr imagep = found_it->second;
+
+ // for images grabbed from local files, apply clipping rectangle to restore original dimensions
+ // from power-of-2 gl image
+ if (success && imagep.notNull() && src_vi && (src_vi->getUrl().compare(0, 7, "file://")==0))
+ {
+ F32 full_width = (F32)src_vi->getFullWidth();
+ F32 full_height = (F32)src_vi->getFullHeight();
+ F32 clip_x = (F32)src_vi->getOriginalWidth() / full_width;
+ F32 clip_y = (F32)src_vi->getOriginalHeight() / full_height;
+ if (clip_rect != LLRect::null)
+ {
+ imagep->setClipRegion(LLRectf(llclamp((F32)clip_rect.mLeft / full_width, 0.f, 1.f),
+ llclamp((F32)clip_rect.mTop / full_height, 0.f, 1.f),
+ llclamp((F32)clip_rect.mRight / full_width, 0.f, 1.f),
+ llclamp((F32)clip_rect.mBottom / full_height, 0.f, 1.f)));
+ }
+ else
+ {
+ imagep->setClipRegion(LLRectf(0.f, clip_y, clip_x, 0.f));
+ }
+ if (scale_rect != LLRect::null)
+ {
+ imagep->setScaleRegion(
+ LLRectf(llclamp((F32)scale_rect.mLeft / (F32)imagep->getWidth(), 0.f, 1.f),
+ llclamp((F32)scale_rect.mTop / (F32)imagep->getHeight(), 0.f, 1.f),
+ llclamp((F32)scale_rect.mRight / (F32)imagep->getWidth(), 0.f, 1.f),
+ llclamp((F32)scale_rect.mBottom / (F32)imagep->getHeight(), 0.f, 1.f)));
+ }
+
+ imagep->onImageLoaded();
+ }
+ }
}
namespace LLInitParam
{
- template<>
- struct TypeValues<LLUIImage::EScaleStyle> : public TypeValuesHelper<LLUIImage::EScaleStyle>
- {
- static void declareValues()
- {
- declare("scale_inner", LLUIImage::SCALE_INNER);
- declare("scale_outer", LLUIImage::SCALE_OUTER);
- }
- };
+ template<>
+ struct TypeValues<LLUIImage::EScaleStyle> : public TypeValuesHelper<LLUIImage::EScaleStyle>
+ {
+ static void declareValues()
+ {
+ declare("scale_inner", LLUIImage::SCALE_INNER);
+ declare("scale_outer", LLUIImage::SCALE_OUTER);
+ }
+ };
}
struct UIImageDeclaration : public LLInitParam::Block<UIImageDeclaration>
{
- Mandatory<std::string> name;
- Optional<std::string> file_name;
- Optional<bool> preload;
- Optional<LLRect> scale;
- Optional<LLRect> clip;
- Optional<bool> use_mips;
- Optional<LLUIImage::EScaleStyle> scale_type;
-
- UIImageDeclaration()
- : name("name"),
- file_name("file_name"),
- preload("preload", false),
- scale("scale"),
- clip("clip"),
- use_mips("use_mips", false),
- scale_type("scale_type", LLUIImage::SCALE_INNER)
- {}
+ Mandatory<std::string> name;
+ Optional<std::string> file_name;
+ Optional<bool> preload;
+ Optional<LLRect> scale;
+ Optional<LLRect> clip;
+ Optional<bool> use_mips;
+ Optional<LLUIImage::EScaleStyle> scale_type;
+
+ UIImageDeclaration()
+ : name("name"),
+ file_name("file_name"),
+ preload("preload", false),
+ scale("scale"),
+ clip("clip"),
+ use_mips("use_mips", false),
+ scale_type("scale_type", LLUIImage::SCALE_INNER)
+ {}
};
struct UIImageDeclarations : public LLInitParam::Block<UIImageDeclarations>
{
- Mandatory<S32> version;
- Multiple<UIImageDeclaration> textures;
+ Mandatory<S32> version;
+ Multiple<UIImageDeclaration> textures;
- UIImageDeclarations()
- : version("version"),
- textures("texture")
- {}
+ UIImageDeclarations()
+ : version("version"),
+ textures("texture")
+ {}
};
bool LLUIImageList::initFromFile()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- // Look for textures.xml in all the right places. Pass
- // constraint=LLDir::ALL_SKINS because we want to overlay textures.xml
- // from all the skins directories.
- std::vector<std::string> textures_paths =
- gDirUtilp->findSkinnedFilenames(LLDir::TEXTURES, "textures.xml", LLDir::ALL_SKINS);
- std::vector<std::string>::const_iterator pi(textures_paths.begin()), pend(textures_paths.end());
- if (pi == pend)
- {
- LL_WARNS() << "No textures.xml found in skins directories" << LL_ENDL;
- return false;
- }
-
- // The first (most generic) file gets special validations
- LLXMLNodePtr root;
- if (!LLXMLNode::parseFile(*pi, root, NULL))
- {
- LL_WARNS() << "Unable to parse UI image list file " << *pi << LL_ENDL;
- return false;
- }
- if (!root->hasAttribute("version"))
- {
- LL_WARNS() << "No valid version number in UI image list file " << *pi << LL_ENDL;
- return false;
- }
-
- UIImageDeclarations images;
- LLXUIParser parser;
- parser.readXUI(root, images, *pi);
-
- // add components defined in the rest of the skin paths
- while (++pi != pend)
- {
- LLXMLNodePtr update_root;
- if (LLXMLNode::parseFile(*pi, update_root, NULL))
- {
- parser.readXUI(update_root, images, *pi);
- }
- }
-
- if (!images.validateBlock()) return false;
-
- std::map<std::string, UIImageDeclaration> merged_declarations;
- for (LLInitParam::ParamIterator<UIImageDeclaration>::const_iterator image_it = images.textures.begin();
- image_it != images.textures.end();
- ++image_it)
- {
- merged_declarations[image_it->name].overwriteFrom(*image_it);
- }
-
- enum e_decode_pass
- {
- PASS_DECODE_NOW,
- PASS_DECODE_LATER,
- NUM_PASSES
- };
-
- for (S32 cur_pass = PASS_DECODE_NOW; cur_pass < NUM_PASSES; cur_pass++)
- {
- for (std::map<std::string, UIImageDeclaration>::const_iterator image_it = merged_declarations.begin();
- image_it != merged_declarations.end();
- ++image_it)
- {
- const UIImageDeclaration& image = image_it->second;
- std::string file_name = image.file_name.isProvided() ? image.file_name() : image.name();
-
- // load high priority textures on first pass (to kick off decode)
- enum e_decode_pass decode_pass = image.preload ? PASS_DECODE_NOW : PASS_DECODE_LATER;
- if (decode_pass != cur_pass)
- {
- continue;
- }
- preloadUIImage(image.name, file_name, image.use_mips, image.scale, image.clip, image.scale_type);
- }
-
- if (!gSavedSettings.getBOOL("NoPreload"))
- {
+ // Look for textures.xml in all the right places. Pass
+ // constraint=LLDir::ALL_SKINS because we want to overlay textures.xml
+ // from all the skins directories.
+ std::vector<std::string> textures_paths =
+ gDirUtilp->findSkinnedFilenames(LLDir::TEXTURES, "textures.xml", LLDir::ALL_SKINS);
+ std::vector<std::string>::const_iterator pi(textures_paths.begin()), pend(textures_paths.end());
+ if (pi == pend)
+ {
+ LL_WARNS() << "No textures.xml found in skins directories" << LL_ENDL;
+ return false;
+ }
+
+ // The first (most generic) file gets special validations
+ LLXMLNodePtr root;
+ if (!LLXMLNode::parseFile(*pi, root, NULL))
+ {
+ LL_WARNS() << "Unable to parse UI image list file " << *pi << LL_ENDL;
+ return false;
+ }
+ if (!root->hasAttribute("version"))
+ {
+ LL_WARNS() << "No valid version number in UI image list file " << *pi << LL_ENDL;
+ return false;
+ }
+
+ UIImageDeclarations images;
+ LLXUIParser parser;
+ parser.readXUI(root, images, *pi);
+
+ // add components defined in the rest of the skin paths
+ while (++pi != pend)
+ {
+ LLXMLNodePtr update_root;
+ if (LLXMLNode::parseFile(*pi, update_root, NULL))
+ {
+ parser.readXUI(update_root, images, *pi);
+ }
+ }
+
+ if (!images.validateBlock()) return false;
+
+ std::map<std::string, UIImageDeclaration> merged_declarations;
+ for (LLInitParam::ParamIterator<UIImageDeclaration>::const_iterator image_it = images.textures.begin();
+ image_it != images.textures.end();
+ ++image_it)
+ {
+ merged_declarations[image_it->name].overwriteFrom(*image_it);
+ }
+
+ enum e_decode_pass
+ {
+ PASS_DECODE_NOW,
+ PASS_DECODE_LATER,
+ NUM_PASSES
+ };
+
+ for (S32 cur_pass = PASS_DECODE_NOW; cur_pass < NUM_PASSES; cur_pass++)
+ {
+ for (std::map<std::string, UIImageDeclaration>::const_iterator image_it = merged_declarations.begin();
+ image_it != merged_declarations.end();
+ ++image_it)
+ {
+ const UIImageDeclaration& image = image_it->second;
+ std::string file_name = image.file_name.isProvided() ? image.file_name() : image.name();
+
+ // load high priority textures on first pass (to kick off decode)
+ enum e_decode_pass decode_pass = image.preload ? PASS_DECODE_NOW : PASS_DECODE_LATER;
+ if (decode_pass != cur_pass)
+ {
+ continue;
+ }
+ preloadUIImage(image.name, file_name, image.use_mips, image.scale, image.clip, image.scale_type);
+ }
+
+ if (!gSavedSettings.getBOOL("NoPreload"))
+ {
if (cur_pass == PASS_DECODE_NOW)
{
// init fetching and decoding of preloaded images
@@ -1758,9 +1758,9 @@ bool LLUIImageList::initFromFile()
// decodeAllImages needs two passes to refresh stats and priorities on second pass
gTextureList.decodeAllImages(1.f);
}
- }
- }
- return true;
+ }
+ }
+ return true;
}
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index 10a2cfa32a..db68ed396b 100644
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -1,30 +1,30 @@
-/**
+/**
* @file llviewertexturelist.h
* @brief Object for managing the list of images within a region
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-#ifndef LL_LLVIEWERTEXTURELIST_H
+#ifndef LL_LLVIEWERTEXTURELIST_H
#define LL_LLVIEWERTEXTURELIST_H
#include "lluuid.h"
@@ -51,13 +51,13 @@ class LLImageJ2C;
class LLMessageSystem;
class LLTextureView;
-typedef void (*LLImageCallback)(BOOL success,
- LLViewerFetchedTexture *src_vi,
- LLImageRaw* src,
- LLImageRaw* src_aux,
- S32 discard_level,
- BOOL final,
- void* userdata);
+typedef void (*LLImageCallback)(BOOL success,
+ LLViewerFetchedTexture *src_vi,
+ LLImageRaw* src,
+ LLImageRaw* src_aux,
+ S32 discard_level,
+ BOOL final,
+ void* userdata);
enum ETexListType
{
@@ -87,10 +87,10 @@ struct LLTextureKey
class LLViewerTextureList
{
- friend class LLTextureView;
- friend class LLViewerTextureManager;
- friend class LLLocalBitmap;
-
+ friend class LLTextureView;
+ friend class LLViewerTextureManager;
+ friend class LLLocalBitmap;
+
public:
static bool createUploadFile(LLPointer<LLImageRaw> raw_image,
const std::string& out_filename,
@@ -102,48 +102,48 @@ public:
const S32 max_image_dimentions = LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT,
const S32 min_image_dimentions = 0,
bool force_square = false);
- static LLPointer<LLImageJ2C> convertToUploadFile(LLPointer<LLImageRaw> raw_image,
+ static LLPointer<LLImageJ2C> convertToUploadFile(LLPointer<LLImageRaw> raw_image,
const S32 max_image_dimentions = LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT,
bool force_square = false,
bool force_lossless = false);
- static void processImageNotInDatabase( LLMessageSystem *msg, void **user_data );
+ static void processImageNotInDatabase( LLMessageSystem *msg, void **user_data );
public:
- LLViewerTextureList();
- ~LLViewerTextureList();
+ LLViewerTextureList();
+ ~LLViewerTextureList();
- void init();
- void shutdown();
- void dump();
- void destroyGL(BOOL save_state = TRUE);
- void restoreGL();
- BOOL isInitialized() const {return mInitialized;}
+ void init();
+ void shutdown();
+ void dump();
+ void destroyGL(BOOL save_state = TRUE);
+ void restoreGL();
+ BOOL isInitialized() const {return mInitialized;}
- void findTexturesByID(const LLUUID &image_id, std::vector<LLViewerFetchedTexture*> &output);
- LLViewerFetchedTexture *findImage(const LLUUID &image_id, ETexListType tex_type);
- LLViewerFetchedTexture *findImage(const LLTextureKey &search_key);
+ void findTexturesByID(const LLUUID &image_id, std::vector<LLViewerFetchedTexture*> &output);
+ LLViewerFetchedTexture *findImage(const LLUUID &image_id, ETexListType tex_type);
+ LLViewerFetchedTexture *findImage(const LLTextureKey &search_key);
- void dirtyImage(LLViewerFetchedTexture *image);
-
- // Using image stats, determine what images are necessary, and perform image updates.
- void updateImages(F32 max_time);
- void forceImmediateUpdate(LLViewerFetchedTexture* imagep) ;
+ void dirtyImage(LLViewerFetchedTexture *image);
- // Decode and create textures for all images currently in list.
- void decodeAllImages(F32 max_decode_time);
+ // Using image stats, determine what images are necessary, and perform image updates.
+ void updateImages(F32 max_time);
+ void forceImmediateUpdate(LLViewerFetchedTexture* imagep) ;
- void handleIRCallback(void **data, const S32 number);
+ // Decode and create textures for all images currently in list.
+ void decodeAllImages(F32 max_decode_time);
- S32 getNumImages() { return mImageList.size(); }
+ void handleIRCallback(void **data, const S32 number);
- // Local UI images
+ S32 getNumImages() { return mImageList.size(); }
+
+ // Local UI images
// Local UI images
- void doPreloadImages();
+ void doPreloadImages();
// Network images. Needs caps and cache to work
- void doPrefetchImages();
+ void doPrefetchImages();
- void clearFetchingRequests();
- void setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level);
+ void clearFetchingRequests();
+ void setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level);
private:
// do some book keeping on the specified texture
@@ -151,137 +151,137 @@ private:
// - updates desired discard level
// - cleans up textures that haven't been referenced in awhile
void updateImageDecodePriority(LLViewerFetchedTexture* imagep);
- F32 updateImagesCreateTextures(F32 max_time);
- F32 updateImagesFetchTextures(F32 max_time);
- void updateImagesUpdateStats();
- F32 updateImagesLoadingFastCache(F32 max_time);
-
- void addImage(LLViewerFetchedTexture *image, ETexListType tex_type);
- void deleteImage(LLViewerFetchedTexture *image);
-
- void addImageToList(LLViewerFetchedTexture *image);
- void removeImageFromList(LLViewerFetchedTexture *image);
-
- LLViewerFetchedTexture * getImage(const LLUUID &image_id,
- FTType f_type = FTT_DEFAULT,
- BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
- S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
- LLGLint internal_format = 0,
- LLGLenum primary_format = 0,
- LLHost request_from_host = LLHost()
- );
-
- LLViewerFetchedTexture * getImageFromFile(const std::string& filename,
- FTType f_type = FTT_LOCAL_FILE,
- BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
- S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
- LLGLint internal_format = 0,
- LLGLenum primary_format = 0,
- const LLUUID& force_id = LLUUID::null
- );
-
- LLViewerFetchedTexture* getImageFromUrl(const std::string& url,
- FTType f_type,
- BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
- S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
- LLGLint internal_format = 0,
- LLGLenum primary_format = 0,
- const LLUUID& force_id = LLUUID::null
- );
-
- LLViewerFetchedTexture* createImage(const LLUUID &image_id,
- FTType f_type,
- BOOL usemipmap = TRUE,
- LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
- S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
- LLGLint internal_format = 0,
- LLGLenum primary_format = 0,
- LLHost request_from_host = LLHost()
- );
-
- // Request image from a specific host, used for baked avatar textures.
- // Implemented in header in case someone changes default params above. JC
- LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, FTType f_type, LLHost host)
- { return getImage(image_id, f_type, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); }
+ F32 updateImagesCreateTextures(F32 max_time);
+ F32 updateImagesFetchTextures(F32 max_time);
+ void updateImagesUpdateStats();
+ F32 updateImagesLoadingFastCache(F32 max_time);
+
+ void addImage(LLViewerFetchedTexture *image, ETexListType tex_type);
+ void deleteImage(LLViewerFetchedTexture *image);
+
+ void addImageToList(LLViewerFetchedTexture *image);
+ void removeImageFromList(LLViewerFetchedTexture *image);
+
+ LLViewerFetchedTexture * getImage(const LLUUID &image_id,
+ FTType f_type = FTT_DEFAULT,
+ BOOL usemipmap = TRUE,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
+ S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
+ LLGLint internal_format = 0,
+ LLGLenum primary_format = 0,
+ LLHost request_from_host = LLHost()
+ );
+
+ LLViewerFetchedTexture * getImageFromFile(const std::string& filename,
+ FTType f_type = FTT_LOCAL_FILE,
+ BOOL usemipmap = TRUE,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
+ S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
+ LLGLint internal_format = 0,
+ LLGLenum primary_format = 0,
+ const LLUUID& force_id = LLUUID::null
+ );
+
+ LLViewerFetchedTexture* getImageFromUrl(const std::string& url,
+ FTType f_type,
+ BOOL usemipmap = TRUE,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
+ S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
+ LLGLint internal_format = 0,
+ LLGLenum primary_format = 0,
+ const LLUUID& force_id = LLUUID::null
+ );
+
+ LLViewerFetchedTexture* createImage(const LLUUID &image_id,
+ FTType f_type,
+ BOOL usemipmap = TRUE,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
+ S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
+ LLGLint internal_format = 0,
+ LLGLenum primary_format = 0,
+ LLHost request_from_host = LLHost()
+ );
+
+ // Request image from a specific host, used for baked avatar textures.
+ // Implemented in header in case someone changes default params above. JC
+ LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, FTType f_type, LLHost host)
+ { return getImage(image_id, f_type, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); }
public:
- typedef std::set<LLPointer<LLViewerFetchedTexture> > image_list_t;
- image_list_t mLoadingStreamList;
- image_list_t mCreateTextureList;
- image_list_t mCallbackList;
- image_list_t mFastCacheList;
-
- // Note: just raw pointers because they are never referenced, just compared against
- std::set<LLViewerFetchedTexture*> mDirtyTextureList;
-
- BOOL mForceResetTextureStats;
-
+ typedef std::set<LLPointer<LLViewerFetchedTexture> > image_list_t;
+ image_list_t mLoadingStreamList;
+ image_list_t mCreateTextureList;
+ image_list_t mCallbackList;
+ image_list_t mFastCacheList;
+
+ // Note: just raw pointers because they are never referenced, just compared against
+ std::set<LLViewerFetchedTexture*> mDirtyTextureList;
+
+ BOOL mForceResetTextureStats;
+
private:
typedef std::map< LLTextureKey, LLPointer<LLViewerFetchedTexture> > uuid_map_t;
uuid_map_t mUUIDMap;
LLTextureKey mLastUpdateKey;
-
+
typedef std::set < LLPointer<LLViewerFetchedTexture> > image_priority_list_t;
- image_priority_list_t mImageList;
+ image_priority_list_t mImageList;
- // simply holds on to LLViewerFetchedTexture references to stop them from being purged too soon
- std::set<LLPointer<LLViewerFetchedTexture> > mImagePreloads;
+ // simply holds on to LLViewerFetchedTexture references to stop them from being purged too soon
+ std::set<LLPointer<LLViewerFetchedTexture> > mImagePreloads;
+
+ BOOL mInitialized ;
+ LLFrameTimer mForceDecodeTimer;
- BOOL mInitialized ;
- LLFrameTimer mForceDecodeTimer;
-
private:
- static S32 sNumImages;
- static void (*sUUIDCallback)(void**, const LLUUID &);
+ static S32 sNumImages;
+ static void (*sUUIDCallback)(void**, const LLUUID &);
LOG_CLASS(LLViewerTextureList);
};
class LLUIImageList : public LLImageProviderInterface, public LLSingleton<LLUIImageList>
{
- LLSINGLETON_EMPTY_CTOR(LLUIImageList);
+ LLSINGLETON_EMPTY_CTOR(LLUIImageList);
public:
- // LLImageProviderInterface
- /*virtual*/ LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) override;
- /*virtual*/ LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) override;
- void cleanUp() override;
+ // LLImageProviderInterface
+ /*virtual*/ LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) override;
+ /*virtual*/ LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) override;
+ void cleanUp() override;
+
+ bool initFromFile();
- bool initFromFile();
+ LLPointer<LLUIImage> preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle stype);
- LLPointer<LLUIImage> preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle stype);
-
- static void onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata );
+ static void onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata );
private:
- LLPointer<LLUIImage> loadUIImageByName(const std::string& name, const std::string& filename,
- BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null,
- const LLRect& clip_rect = LLRect::null,
- LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI,
- LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER);
- LLPointer<LLUIImage> loadUIImageByID(const LLUUID& id,
- BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null,
- const LLRect& clip_rect = LLRect::null,
- LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI,
- LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER);
-
- LLPointer<LLUIImage> loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER);
-
-
- struct LLUIImageLoadData
- {
- std::string mImageName;
- LLRect mImageScaleRegion;
- LLRect mImageClipRegion;
- };
-
- typedef std::map< std::string, LLPointer<LLUIImage> > uuid_ui_image_map_t;
- uuid_ui_image_map_t mUIImages;
-
- //
- //keep a copy of UI textures to prevent them to be deleted.
- //mGLTexturep of each UI texture equals to some LLUIImage.mImage.
- std::list< LLPointer<LLViewerFetchedTexture> > mUITextureList ;
+ LLPointer<LLUIImage> loadUIImageByName(const std::string& name, const std::string& filename,
+ BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null,
+ const LLRect& clip_rect = LLRect::null,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI,
+ LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER);
+ LLPointer<LLUIImage> loadUIImageByID(const LLUUID& id,
+ BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null,
+ const LLRect& clip_rect = LLRect::null,
+ LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI,
+ LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER);
+
+ LLPointer<LLUIImage> loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER);
+
+
+ struct LLUIImageLoadData
+ {
+ std::string mImageName;
+ LLRect mImageScaleRegion;
+ LLRect mImageClipRegion;
+ };
+
+ typedef std::map< std::string, LLPointer<LLUIImage> > uuid_ui_image_map_t;
+ uuid_ui_image_map_t mUIImages;
+
+ //
+ //keep a copy of UI textures to prevent them to be deleted.
+ //mGLTexturep of each UI texture equals to some LLUIImage.mImage.
+ std::list< LLPointer<LLViewerFetchedTexture> > mUITextureList ;
};
const BOOL GLTEXTURE_TRUE = TRUE;
diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp
index 20390a316a..8482bc603b 100644
--- a/indra/newview/llviewerthrottle.cpp
+++ b/indra/newview/llviewerthrottle.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerthrottle.cpp
* @brief LLViewerThrottle class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,14 +56,14 @@ LLViewerThrottle gViewerThrottle;
// static
const std:: string LLViewerThrottle::sNames[TC_EOF] = {
- "Resend",
- "Land",
- "Wind",
- "Cloud",
- "Task",
- "Texture",
- "Asset"
- };
+ "Resend",
+ "Land",
+ "Wind",
+ "Cloud",
+ "Task",
+ "Texture",
+ "Asset"
+ };
// Bandwidth settings for different bit rates, they're interpolated/extrapolated.
@@ -75,260 +75,260 @@ const F32 BW_PRESET_1000[TC_EOF] = { 100, 100, 20, 20, 310, 310, 140 };
LLViewerThrottleGroup::LLViewerThrottleGroup()
{
- S32 i;
- for (i = 0; i < TC_EOF; i++)
- {
- mThrottles[i] = 0.f;
- }
- mThrottleTotal = 0.f;
+ S32 i;
+ for (i = 0; i < TC_EOF; i++)
+ {
+ mThrottles[i] = 0.f;
+ }
+ mThrottleTotal = 0.f;
}
LLViewerThrottleGroup::LLViewerThrottleGroup(const F32 settings[TC_EOF])
{
- mThrottleTotal = 0.f;
- S32 i;
- for (i = 0; i < TC_EOF; i++)
- {
- mThrottles[i] = settings[i];
- mThrottleTotal += settings[i];
- }
+ mThrottleTotal = 0.f;
+ S32 i;
+ for (i = 0; i < TC_EOF; i++)
+ {
+ mThrottles[i] = settings[i];
+ mThrottleTotal += settings[i];
+ }
}
LLViewerThrottleGroup LLViewerThrottleGroup::operator*(const F32 frac) const
{
- LLViewerThrottleGroup res;
- res.mThrottleTotal = 0.f;
+ LLViewerThrottleGroup res;
+ res.mThrottleTotal = 0.f;
- S32 i;
- for (i = 0; i < TC_EOF; i++)
- {
- res.mThrottles[i] = mThrottles[i] * frac;
- res.mThrottleTotal += res.mThrottles[i];
- }
+ S32 i;
+ for (i = 0; i < TC_EOF; i++)
+ {
+ res.mThrottles[i] = mThrottles[i] * frac;
+ res.mThrottleTotal += res.mThrottles[i];
+ }
- return res;
+ return res;
}
LLViewerThrottleGroup LLViewerThrottleGroup::operator+(const LLViewerThrottleGroup &b) const
{
- LLViewerThrottleGroup res;
- res.mThrottleTotal = 0.f;
+ LLViewerThrottleGroup res;
+ res.mThrottleTotal = 0.f;
- S32 i;
- for (i = 0; i < TC_EOF; i++)
- {
- res.mThrottles[i] = mThrottles[i] + b.mThrottles[i];
- res.mThrottleTotal += res.mThrottles[i];
- }
+ S32 i;
+ for (i = 0; i < TC_EOF; i++)
+ {
+ res.mThrottles[i] = mThrottles[i] + b.mThrottles[i];
+ res.mThrottleTotal += res.mThrottles[i];
+ }
- return res;
+ return res;
}
LLViewerThrottleGroup LLViewerThrottleGroup::operator-(const LLViewerThrottleGroup &b) const
{
- LLViewerThrottleGroup res;
- res.mThrottleTotal = 0.f;
+ LLViewerThrottleGroup res;
+ res.mThrottleTotal = 0.f;
- S32 i;
- for (i = 0; i < TC_EOF; i++)
- {
- res.mThrottles[i] = mThrottles[i] - b.mThrottles[i];
- res.mThrottleTotal += res.mThrottles[i];
- }
+ S32 i;
+ for (i = 0; i < TC_EOF; i++)
+ {
+ res.mThrottles[i] = mThrottles[i] - b.mThrottles[i];
+ res.mThrottleTotal += res.mThrottles[i];
+ }
- return res;
+ return res;
}
void LLViewerThrottleGroup::sendToSim() const
{
- LL_INFOS() << "Sending throttle settings, total BW " << mThrottleTotal << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessageFast(_PREHASH_AgentThrottle);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addU32Fast(_PREHASH_CircuitCode, msg->mOurCircuitCode);
-
- msg->nextBlockFast(_PREHASH_Throttle);
- msg->addU32Fast(_PREHASH_GenCounter, 0);
-
- // Pack up the throttle data
- U8 tmp[64];
- LLDataPackerBinaryBuffer dp(tmp, MAX_THROTTLE_SIZE);
- S32 i;
- for (i = 0; i < TC_EOF; i++)
- {
- //sim wants BPS, not KBPS
- dp.packF32(mThrottles[i] * 1024.0f, "Throttle");
- }
- S32 len = dp.getCurrentSize();
- msg->addBinaryDataFast(_PREHASH_Throttles, tmp, len);
-
- gAgent.sendReliableMessage();
+ LL_INFOS() << "Sending throttle settings, total BW " << mThrottleTotal << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_AgentThrottle);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addU32Fast(_PREHASH_CircuitCode, msg->mOurCircuitCode);
+
+ msg->nextBlockFast(_PREHASH_Throttle);
+ msg->addU32Fast(_PREHASH_GenCounter, 0);
+
+ // Pack up the throttle data
+ U8 tmp[64];
+ LLDataPackerBinaryBuffer dp(tmp, MAX_THROTTLE_SIZE);
+ S32 i;
+ for (i = 0; i < TC_EOF; i++)
+ {
+ //sim wants BPS, not KBPS
+ dp.packF32(mThrottles[i] * 1024.0f, "Throttle");
+ }
+ S32 len = dp.getCurrentSize();
+ msg->addBinaryDataFast(_PREHASH_Throttles, tmp, len);
+
+ gAgent.sendReliableMessage();
}
void LLViewerThrottleGroup::dump()
{
- S32 i;
- for (i = 0; i < TC_EOF; i++)
- {
- LL_DEBUGS("Throttle") << LLViewerThrottle::sNames[i] << ": " << mThrottles[i] << LL_ENDL;
- }
- LL_DEBUGS("Throttle") << "Total: " << mThrottleTotal << LL_ENDL;
+ S32 i;
+ for (i = 0; i < TC_EOF; i++)
+ {
+ LL_DEBUGS("Throttle") << LLViewerThrottle::sNames[i] << ": " << mThrottles[i] << LL_ENDL;
+ }
+ LL_DEBUGS("Throttle") << "Total: " << mThrottleTotal << LL_ENDL;
}
class LLBPSListener : public LLSimpleListener
{
public:
- virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
- {
- gViewerThrottle.setMaxBandwidth((F32) event->getValue().asReal()*1024);
- return true;
- }
+ virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
+ {
+ gViewerThrottle.setMaxBandwidth((F32) event->getValue().asReal()*1024);
+ return true;
+ }
};
LLViewerThrottle::LLViewerThrottle() :
- mMaxBandwidth(0.f),
- mCurrentBandwidth(0.f),
- mThrottleFrac(1.f)
+ mMaxBandwidth(0.f),
+ mCurrentBandwidth(0.f),
+ mThrottleFrac(1.f)
{
- // Need to be pushed on in bandwidth order
- mPresets.push_back(LLViewerThrottleGroup(BW_PRESET_50));
- mPresets.push_back(LLViewerThrottleGroup(BW_PRESET_300));
- mPresets.push_back(LLViewerThrottleGroup(BW_PRESET_500));
- mPresets.push_back(LLViewerThrottleGroup(BW_PRESET_1000));
+ // Need to be pushed on in bandwidth order
+ mPresets.push_back(LLViewerThrottleGroup(BW_PRESET_50));
+ mPresets.push_back(LLViewerThrottleGroup(BW_PRESET_300));
+ mPresets.push_back(LLViewerThrottleGroup(BW_PRESET_500));
+ mPresets.push_back(LLViewerThrottleGroup(BW_PRESET_1000));
}
void LLViewerThrottle::setMaxBandwidth(F32 kbits_per_second, BOOL from_event)
{
- if (!from_event)
- {
- gSavedSettings.setF32("ThrottleBandwidthKBPS", kbits_per_second);
- }
- gViewerThrottle.load();
-
- if (gAgent.getRegion())
- {
- gViewerThrottle.sendToSim();
- }
+ if (!from_event)
+ {
+ gSavedSettings.setF32("ThrottleBandwidthKBPS", kbits_per_second);
+ }
+ gViewerThrottle.load();
+
+ if (gAgent.getRegion())
+ {
+ gViewerThrottle.sendToSim();
+ }
}
void LLViewerThrottle::load()
{
- mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS")*1024;
- resetDynamicThrottle();
- mCurrent.dump();
+ mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS")*1024;
+ resetDynamicThrottle();
+ mCurrent.dump();
}
void LLViewerThrottle::save() const
{
- gSavedSettings.setF32("ThrottleBandwidthKBPS", mMaxBandwidth/1024);
+ gSavedSettings.setF32("ThrottleBandwidthKBPS", mMaxBandwidth/1024);
}
void LLViewerThrottle::sendToSim() const
{
- mCurrent.sendToSim();
+ mCurrent.sendToSim();
}
LLViewerThrottleGroup LLViewerThrottle::getThrottleGroup(const F32 bandwidth_kbps)
{
- //Clamp the bandwidth users can set.
- F32 set_bandwidth = llclamp(bandwidth_kbps, MIN_BANDWIDTH, MAX_BANDWIDTH);
-
- S32 count = mPresets.size();
-
- S32 i;
- for (i = 0; i < count; i++)
- {
- if (mPresets[i].getTotal() > set_bandwidth)
- {
- break;
- }
- }
-
- if (i == 0)
- {
- // We return the minimum if it's less than the minimum
- return mPresets[0];
- }
- else if (i == count)
- {
- // Higher than the highest preset, we extrapolate out based on the
- // last two presets. This allows us to keep certain throttle channels from
- // growing in bandwidth
- F32 delta_bw = set_bandwidth - mPresets[count-1].getTotal();
- LLViewerThrottleGroup delta_throttle = mPresets[count - 1] - mPresets[count - 2];
- F32 delta_total = delta_throttle.getTotal();
- F32 delta_frac = delta_bw / delta_total;
- delta_throttle = delta_throttle * delta_frac;
- return mPresets[count-1] + delta_throttle;
- }
- else
- {
- // In between two presets, just interpolate
- F32 delta_bw = set_bandwidth - mPresets[i - 1].getTotal();
- LLViewerThrottleGroup delta_throttle = mPresets[i] - mPresets[i - 1];
- F32 delta_total = delta_throttle.getTotal();
- F32 delta_frac = delta_bw / delta_total;
- delta_throttle = delta_throttle * delta_frac;
- return mPresets[i - 1] + delta_throttle;
- }
+ //Clamp the bandwidth users can set.
+ F32 set_bandwidth = llclamp(bandwidth_kbps, MIN_BANDWIDTH, MAX_BANDWIDTH);
+
+ S32 count = mPresets.size();
+
+ S32 i;
+ for (i = 0; i < count; i++)
+ {
+ if (mPresets[i].getTotal() > set_bandwidth)
+ {
+ break;
+ }
+ }
+
+ if (i == 0)
+ {
+ // We return the minimum if it's less than the minimum
+ return mPresets[0];
+ }
+ else if (i == count)
+ {
+ // Higher than the highest preset, we extrapolate out based on the
+ // last two presets. This allows us to keep certain throttle channels from
+ // growing in bandwidth
+ F32 delta_bw = set_bandwidth - mPresets[count-1].getTotal();
+ LLViewerThrottleGroup delta_throttle = mPresets[count - 1] - mPresets[count - 2];
+ F32 delta_total = delta_throttle.getTotal();
+ F32 delta_frac = delta_bw / delta_total;
+ delta_throttle = delta_throttle * delta_frac;
+ return mPresets[count-1] + delta_throttle;
+ }
+ else
+ {
+ // In between two presets, just interpolate
+ F32 delta_bw = set_bandwidth - mPresets[i - 1].getTotal();
+ LLViewerThrottleGroup delta_throttle = mPresets[i] - mPresets[i - 1];
+ F32 delta_total = delta_throttle.getTotal();
+ F32 delta_frac = delta_bw / delta_total;
+ delta_throttle = delta_throttle * delta_frac;
+ return mPresets[i - 1] + delta_throttle;
+ }
}
// static
void LLViewerThrottle::resetDynamicThrottle()
{
- mThrottleFrac = MAX_FRACTIONAL;
+ mThrottleFrac = MAX_FRACTIONAL;
- mCurrentBandwidth = mMaxBandwidth*MAX_FRACTIONAL;
- mCurrent = getThrottleGroup(mCurrentBandwidth / 1024.0f);
+ mCurrentBandwidth = mMaxBandwidth*MAX_FRACTIONAL;
+ mCurrent = getThrottleGroup(mCurrentBandwidth / 1024.0f);
}
void LLViewerThrottle::updateDynamicThrottle()
{
- if (mUpdateTimer.getElapsedTimeF32() < DYNAMIC_UPDATE_DURATION)
- {
- return;
- }
- mUpdateTimer.reset();
-
- LLUnit<F32, LLUnits::Percent> mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT);
- if (mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD)
- {
- if (mThrottleFrac <= MIN_FRACTIONAL || mCurrentBandwidth / 1024.0f <= MIN_BANDWIDTH)
- {
- return;
- }
- mThrottleFrac -= STEP_FRACTIONAL;
- mThrottleFrac = llmax(MIN_FRACTIONAL, mThrottleFrac);
- mCurrentBandwidth = mMaxBandwidth * mThrottleFrac;
- mCurrent = getThrottleGroup(mCurrentBandwidth / 1024.0f);
- mCurrent.sendToSim();
- LL_INFOS() << "Tightening network throttle to " << mCurrentBandwidth << LL_ENDL;
- }
- else if (mean_packets_lost <= EASE_THROTTLE_THRESHOLD)
- {
- if (mThrottleFrac >= MAX_FRACTIONAL || mCurrentBandwidth / 1024.0f >= MAX_BANDWIDTH)
- {
- return;
- }
- mThrottleFrac += STEP_FRACTIONAL;
- mThrottleFrac = llmin(MAX_FRACTIONAL, mThrottleFrac);
- mCurrentBandwidth = mMaxBandwidth * mThrottleFrac;
- mCurrent = getThrottleGroup(mCurrentBandwidth/1024.0f);
- mCurrent.sendToSim();
- LL_INFOS() << "Easing network throttle to " << mCurrentBandwidth << LL_ENDL;
- }
+ if (mUpdateTimer.getElapsedTimeF32() < DYNAMIC_UPDATE_DURATION)
+ {
+ return;
+ }
+ mUpdateTimer.reset();
+
+ LLUnit<F32, LLUnits::Percent> mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT);
+ if (mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD)
+ {
+ if (mThrottleFrac <= MIN_FRACTIONAL || mCurrentBandwidth / 1024.0f <= MIN_BANDWIDTH)
+ {
+ return;
+ }
+ mThrottleFrac -= STEP_FRACTIONAL;
+ mThrottleFrac = llmax(MIN_FRACTIONAL, mThrottleFrac);
+ mCurrentBandwidth = mMaxBandwidth * mThrottleFrac;
+ mCurrent = getThrottleGroup(mCurrentBandwidth / 1024.0f);
+ mCurrent.sendToSim();
+ LL_INFOS() << "Tightening network throttle to " << mCurrentBandwidth << LL_ENDL;
+ }
+ else if (mean_packets_lost <= EASE_THROTTLE_THRESHOLD)
+ {
+ if (mThrottleFrac >= MAX_FRACTIONAL || mCurrentBandwidth / 1024.0f >= MAX_BANDWIDTH)
+ {
+ return;
+ }
+ mThrottleFrac += STEP_FRACTIONAL;
+ mThrottleFrac = llmin(MAX_FRACTIONAL, mThrottleFrac);
+ mCurrentBandwidth = mMaxBandwidth * mThrottleFrac;
+ mCurrent = getThrottleGroup(mCurrentBandwidth/1024.0f);
+ mCurrent.sendToSim();
+ LL_INFOS() << "Easing network throttle to " << mCurrentBandwidth << LL_ENDL;
+ }
}
diff --git a/indra/newview/llviewerthrottle.h b/indra/newview/llviewerthrottle.h
index fe54b06662..5a690139e9 100644
--- a/indra/newview/llviewerthrottle.h
+++ b/indra/newview/llviewerthrottle.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerthrottle.h
* @brief LLViewerThrottle class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,54 +35,54 @@
class LLViewerThrottleGroup
{
- LLViewerThrottleGroup();
- LLViewerThrottleGroup(const F32 settings[TC_EOF]);
+ LLViewerThrottleGroup();
+ LLViewerThrottleGroup(const F32 settings[TC_EOF]);
- LLViewerThrottleGroup operator*(const F32 frac) const;
- LLViewerThrottleGroup operator+(const LLViewerThrottleGroup &b) const;
- LLViewerThrottleGroup operator-(const LLViewerThrottleGroup &b) const;
+ LLViewerThrottleGroup operator*(const F32 frac) const;
+ LLViewerThrottleGroup operator+(const LLViewerThrottleGroup &b) const;
+ LLViewerThrottleGroup operator-(const LLViewerThrottleGroup &b) const;
- F32 getTotal() { return mThrottleTotal; }
- void sendToSim() const;
+ F32 getTotal() { return mThrottleTotal; }
+ void sendToSim() const;
- void dump();
+ void dump();
- friend class LLViewerThrottle;
+ friend class LLViewerThrottle;
protected:
- F32 mThrottles[TC_EOF];
- F32 mThrottleTotal;
+ F32 mThrottles[TC_EOF];
+ F32 mThrottleTotal;
};
class LLViewerThrottle
{
public:
- LLViewerThrottle();
+ LLViewerThrottle();
- void setMaxBandwidth(F32 kbits_per_second, BOOL from_event = FALSE);
+ void setMaxBandwidth(F32 kbits_per_second, BOOL from_event = FALSE);
- void load();
- void save() const;
- void sendToSim() const;
+ void load();
+ void save() const;
+ void sendToSim() const;
- F32 getMaxBandwidth()const { return mMaxBandwidth; }
- F32 getCurrentBandwidth() const { return mCurrentBandwidth; }
+ F32 getMaxBandwidth()const { return mMaxBandwidth; }
+ F32 getCurrentBandwidth() const { return mCurrentBandwidth; }
- void updateDynamicThrottle();
- void resetDynamicThrottle();
+ void updateDynamicThrottle();
+ void resetDynamicThrottle();
- LLViewerThrottleGroup getThrottleGroup(const F32 bandwidth_kbps);
+ LLViewerThrottleGroup getThrottleGroup(const F32 bandwidth_kbps);
- static const std::string sNames[TC_EOF];
+ static const std::string sNames[TC_EOF];
protected:
- F32 mMaxBandwidth;
- F32 mCurrentBandwidth;
+ F32 mMaxBandwidth;
+ F32 mCurrentBandwidth;
+
+ LLViewerThrottleGroup mCurrent;
- LLViewerThrottleGroup mCurrent;
+ std::vector<LLViewerThrottleGroup> mPresets;
- std::vector<LLViewerThrottleGroup> mPresets;
-
- LLFrameTimer mUpdateTimer;
- F32 mThrottleFrac;
+ LLFrameTimer mUpdateTimer;
+ F32 mThrottleFrac;
};
extern LLViewerThrottle gViewerThrottle;
diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp
index bc21b5bf84..bf87d52d19 100644
--- a/indra/newview/llviewerwearable.cpp
+++ b/indra/newview/llviewerwearable.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerwearable.cpp
* @brief LLViewerWearable class implementation
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,45 +47,45 @@ using namespace LLAvatarAppearanceDefines;
class LLOverrideBakedTextureUpdate
{
public:
- LLOverrideBakedTextureUpdate(bool temp_state)
- {
- U32 num_bakes = (U32) LLAvatarAppearanceDefines::BAKED_NUM_INDICES;
- for( U32 index = 0; index < num_bakes; ++index )
- {
- composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index);
- }
- gAgentAvatarp->setCompositeUpdatesEnabled(temp_state);
- }
-
- ~LLOverrideBakedTextureUpdate()
- {
- U32 num_bakes = (U32)LLAvatarAppearanceDefines::BAKED_NUM_INDICES;
- for( U32 index = 0; index < num_bakes; ++index )
- {
- gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]);
- }
- }
+ LLOverrideBakedTextureUpdate(bool temp_state)
+ {
+ U32 num_bakes = (U32) LLAvatarAppearanceDefines::BAKED_NUM_INDICES;
+ for( U32 index = 0; index < num_bakes; ++index )
+ {
+ composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index);
+ }
+ gAgentAvatarp->setCompositeUpdatesEnabled(temp_state);
+ }
+
+ ~LLOverrideBakedTextureUpdate()
+ {
+ U32 num_bakes = (U32)LLAvatarAppearanceDefines::BAKED_NUM_INDICES;
+ for( U32 index = 0; index < num_bakes; ++index )
+ {
+ gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]);
+ }
+ }
private:
- bool composite_enabled[LLAvatarAppearanceDefines::BAKED_NUM_INDICES];
+ bool composite_enabled[LLAvatarAppearanceDefines::BAKED_NUM_INDICES];
};
// Private local functions
static std::string asset_id_to_filename(const LLUUID &asset_id, const ELLPath dir_spec);
LLViewerWearable::LLViewerWearable(const LLTransactionID& transaction_id) :
- LLWearable(),
- mVolatile(FALSE)
+ LLWearable(),
+ mVolatile(FALSE)
{
- mTransactionID = transaction_id;
- mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
+ mTransactionID = transaction_id;
+ mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
}
LLViewerWearable::LLViewerWearable(const LLAssetID& asset_id) :
- LLWearable(),
- mVolatile(FALSE)
+ LLWearable(),
+ mVolatile(FALSE)
{
- mAssetID = asset_id;
- mTransactionID.setNull();
+ mAssetID = asset_id;
+ mTransactionID.setNull();
}
// virtual
@@ -96,43 +96,43 @@ LLViewerWearable::~LLViewerWearable()
// virtual
LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_stream, LLAvatarAppearance* avatarp )
{
- // suppress texlayerset updates while wearables are being imported. Layersets will be updated
- // when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed.
- LLOverrideBakedTextureUpdate stop_bakes(false);
-
- LLWearable::EImportResult result = LLWearable::importStream(input_stream, avatarp);
- if (LLWearable::FAILURE == result) return result;
- if (LLWearable::BAD_HEADER == result)
- {
- // Shouldn't really log the asset id for security reasons, but
- // we need it in this case.
- LL_WARNS() << "Bad Wearable asset header: " << mAssetID << LL_ENDL;
- return result;
- }
-
- LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN );
- LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN );
-
- te_map_t::const_iterator iter = mTEMap.begin();
- te_map_t::const_iterator end = mTEMap.end();
- for (; iter != end; ++iter)
- {
- S32 te = iter->first;
- LLLocalTextureObject* lto = iter->second;
- LLUUID textureid = LLUUID::null;
- if (lto)
- {
- textureid = lto->getID();
- }
-
- LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid );
- if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime"))
- {
- image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL);
- }
- }
-
- return result;
+ // suppress texlayerset updates while wearables are being imported. Layersets will be updated
+ // when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed.
+ LLOverrideBakedTextureUpdate stop_bakes(false);
+
+ LLWearable::EImportResult result = LLWearable::importStream(input_stream, avatarp);
+ if (LLWearable::FAILURE == result) return result;
+ if (LLWearable::BAD_HEADER == result)
+ {
+ // Shouldn't really log the asset id for security reasons, but
+ // we need it in this case.
+ LL_WARNS() << "Bad Wearable asset header: " << mAssetID << LL_ENDL;
+ return result;
+ }
+
+ LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN );
+ LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN );
+
+ te_map_t::const_iterator iter = mTEMap.begin();
+ te_map_t::const_iterator end = mTEMap.end();
+ for (; iter != end; ++iter)
+ {
+ S32 te = iter->first;
+ LLLocalTextureObject* lto = iter->second;
+ LLUUID textureid = LLUUID::null;
+ if (lto)
+ {
+ textureid = lto->getID();
+ }
+
+ LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid );
+ if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime"))
+ {
+ image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL);
+ }
+ }
+
+ return result;
}
@@ -141,174 +141,174 @@ LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_st
// since this wearable was created.
BOOL LLViewerWearable::isOldVersion() const
{
- if (!isAgentAvatarValid()) return FALSE;
-
- if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion )
- {
- LL_WARNS() << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << LL_ENDL;
- llassert(0);
- }
-
- if( LLWearable::sCurrentDefinitionVersion != mDefinitionVersion )
- {
- return TRUE;
- }
-
- S32 param_count = 0;
- for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
- param;
- param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
- {
- if( (param->getWearableType() == mType) && (param->isTweakable() ) )
- {
- param_count++;
- if( !is_in_map(mVisualParamIndexMap, param->getID() ) )
- {
- return TRUE;
- }
- }
- }
- if( param_count != mVisualParamIndexMap.size() )
- {
- return TRUE;
- }
-
-
- S32 te_count = 0;
- for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
- {
- if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
- {
- te_count++;
- if( !is_in_map(mTEMap, te ) )
- {
- return TRUE;
- }
- }
- }
- if( te_count != mTEMap.size() )
- {
- return TRUE;
- }
-
- return FALSE;
+ if (!isAgentAvatarValid()) return FALSE;
+
+ if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion )
+ {
+ LL_WARNS() << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << LL_ENDL;
+ llassert(0);
+ }
+
+ if( LLWearable::sCurrentDefinitionVersion != mDefinitionVersion )
+ {
+ return TRUE;
+ }
+
+ S32 param_count = 0;
+ for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
+ param;
+ param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
+ {
+ if( (param->getWearableType() == mType) && (param->isTweakable() ) )
+ {
+ param_count++;
+ if( !is_in_map(mVisualParamIndexMap, param->getID() ) )
+ {
+ return TRUE;
+ }
+ }
+ }
+ if( param_count != mVisualParamIndexMap.size() )
+ {
+ return TRUE;
+ }
+
+
+ S32 te_count = 0;
+ for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
+ {
+ if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
+ {
+ te_count++;
+ if( !is_in_map(mTEMap, te ) )
+ {
+ return TRUE;
+ }
+ }
+ }
+ if( te_count != mTEMap.size() )
+ {
+ return TRUE;
+ }
+
+ return FALSE;
}
// Avatar parameter and texture definitions can change over time.
// * If parameters or textures have been REMOVED since the wearable was created,
// they're just ignored, so we consider the wearable clean even though isOldVersion()
-// will return true.
+// will return true.
// * If parameters or textures have been ADDED since the wearable was created,
// they are taken to have default values, so we consider the wearable clean
// only if those values are the same as the defaults.
BOOL LLViewerWearable::isDirty() const
{
- if (!isAgentAvatarValid()) return FALSE;
-
- for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
- param;
- param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
- {
- if( (param->getWearableType() == mType)
- && (param->isTweakable() )
- && !param->getCrossWearable())
- {
- F32 current_weight = getVisualParamWeight(param->getID());
- current_weight = llclamp( current_weight, param->getMinWeight(), param->getMaxWeight() );
- F32 saved_weight = get_if_there(mSavedVisualParamMap, param->getID(), param->getDefaultWeight());
- saved_weight = llclamp( saved_weight, param->getMinWeight(), param->getMaxWeight() );
-
- U8 a = F32_to_U8( saved_weight, param->getMinWeight(), param->getMaxWeight() );
- U8 b = F32_to_U8( current_weight, param->getMinWeight(), param->getMaxWeight() );
- if( a != b )
- {
- return TRUE;
- }
- }
- }
-
- for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
- {
- if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
- {
- te_map_t::const_iterator current_iter = mTEMap.find(te);
- if(current_iter != mTEMap.end())
- {
- const LLUUID& current_image_id = current_iter->second->getID();
- te_map_t::const_iterator saved_iter = mSavedTEMap.find(te);
- if(saved_iter != mSavedTEMap.end())
- {
- const LLUUID& saved_image_id = saved_iter->second->getID();
- if (saved_image_id != current_image_id)
- {
- // saved vs current images are different, wearable is dirty
- return TRUE;
- }
- }
- else
- {
- // image found in current image list but not saved image list
- return TRUE;
- }
- }
- }
- }
-
- return FALSE;
+ if (!isAgentAvatarValid()) return FALSE;
+
+ for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
+ param;
+ param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
+ {
+ if( (param->getWearableType() == mType)
+ && (param->isTweakable() )
+ && !param->getCrossWearable())
+ {
+ F32 current_weight = getVisualParamWeight(param->getID());
+ current_weight = llclamp( current_weight, param->getMinWeight(), param->getMaxWeight() );
+ F32 saved_weight = get_if_there(mSavedVisualParamMap, param->getID(), param->getDefaultWeight());
+ saved_weight = llclamp( saved_weight, param->getMinWeight(), param->getMaxWeight() );
+
+ U8 a = F32_to_U8( saved_weight, param->getMinWeight(), param->getMaxWeight() );
+ U8 b = F32_to_U8( current_weight, param->getMinWeight(), param->getMaxWeight() );
+ if( a != b )
+ {
+ return TRUE;
+ }
+ }
+ }
+
+ for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
+ {
+ if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
+ {
+ te_map_t::const_iterator current_iter = mTEMap.find(te);
+ if(current_iter != mTEMap.end())
+ {
+ const LLUUID& current_image_id = current_iter->second->getID();
+ te_map_t::const_iterator saved_iter = mSavedTEMap.find(te);
+ if(saved_iter != mSavedTEMap.end())
+ {
+ const LLUUID& saved_image_id = saved_iter->second->getID();
+ if (saved_image_id != current_image_id)
+ {
+ // saved vs current images are different, wearable is dirty
+ return TRUE;
+ }
+ }
+ else
+ {
+ // image found in current image list but not saved image list
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return FALSE;
}
void LLViewerWearable::setParamsToDefaults()
{
- if (!isAgentAvatarValid()) return;
-
- for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
- {
- if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->isTweakable() ) )
- {
- setVisualParamWeight(param->getID(),param->getDefaultWeight());
- }
- }
+ if (!isAgentAvatarValid()) return;
+
+ for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
+ {
+ if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->isTweakable() ) )
+ {
+ setVisualParamWeight(param->getID(),param->getDefaultWeight());
+ }
+ }
}
void LLViewerWearable::setTexturesToDefaults()
{
- for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
- {
- if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
- {
- LLUUID id = getDefaultTextureImageID((ETextureIndex) te);
- LLViewerFetchedTexture * image = LLViewerTextureManager::getFetchedTexture( id );
- if( mTEMap.find(te) == mTEMap.end() )
- {
- mTEMap[te] = new LLLocalTextureObject(image, id);
- createLayers(te, gAgentAvatarp);
- }
- else
- {
- // Local Texture Object already created, just set image and UUID
- LLLocalTextureObject *lto = mTEMap[te];
- lto->setID(id);
- lto->setImage(image);
- }
- }
- }
+ for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
+ {
+ if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
+ {
+ LLUUID id = getDefaultTextureImageID((ETextureIndex) te);
+ LLViewerFetchedTexture * image = LLViewerTextureManager::getFetchedTexture( id );
+ if( mTEMap.find(te) == mTEMap.end() )
+ {
+ mTEMap[te] = new LLLocalTextureObject(image, id);
+ createLayers(te, gAgentAvatarp);
+ }
+ else
+ {
+ // Local Texture Object already created, just set image and UUID
+ LLLocalTextureObject *lto = mTEMap[te];
+ lto->setID(id);
+ lto->setImage(image);
+ }
+ }
+ }
}
// virtual
LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) const
{
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture(index);
- const std::string &default_image_name = texture_dict ? texture_dict->mDefaultImageName : "";
- if (default_image_name == "")
- {
- return IMG_DEFAULT_AVATAR;
- }
- else
- {
- return LLUUID(gSavedSettings.getString(default_image_name));
- }
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture(index);
+ const std::string &default_image_name = texture_dict ? texture_dict->mDefaultImageName : "";
+ if (default_image_name == "")
+ {
+ return IMG_DEFAULT_AVATAR;
+ }
+ else
+ {
+ return LLUUID(gSavedSettings.getString(default_image_name));
+ }
}
@@ -316,212 +316,212 @@ LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) const
//virtual
void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp)
{
- LLVOAvatarSelf* viewer_avatar = dynamic_cast<LLVOAvatarSelf*>(avatarp);
-
- if (!avatarp || !viewer_avatar) return;
-
- if (!viewer_avatar->isValid()) return;
-
- ESex old_sex = avatarp->getSex();
-
- LLWearable::writeToAvatar(avatarp);
-
-
- // Pull texture entries
- for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
- {
- if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
- {
- te_map_t::const_iterator iter = mTEMap.find(te);
- LLUUID image_id;
- if(iter != mTEMap.end())
- {
- image_id = iter->second->getID();
- }
- else
- {
- image_id = getDefaultTextureImageID((ETextureIndex) te);
- }
- LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE );
- // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this.
- viewer_avatar->setLocalTextureTE(te, image, 0);
- }
- }
-
- ESex new_sex = avatarp->getSex();
- if( old_sex != new_sex )
- {
- viewer_avatar->updateSexDependentLayerSets();
- }
+ LLVOAvatarSelf* viewer_avatar = dynamic_cast<LLVOAvatarSelf*>(avatarp);
+
+ if (!avatarp || !viewer_avatar) return;
+
+ if (!viewer_avatar->isValid()) return;
+
+ ESex old_sex = avatarp->getSex();
+
+ LLWearable::writeToAvatar(avatarp);
+
+
+ // Pull texture entries
+ for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
+ {
+ if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
+ {
+ te_map_t::const_iterator iter = mTEMap.find(te);
+ LLUUID image_id;
+ if(iter != mTEMap.end())
+ {
+ image_id = iter->second->getID();
+ }
+ else
+ {
+ image_id = getDefaultTextureImageID((ETextureIndex) te);
+ }
+ LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE );
+ // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this.
+ viewer_avatar->setLocalTextureTE(te, image, 0);
+ }
+ }
+
+ ESex new_sex = avatarp->getSex();
+ if( old_sex != new_sex )
+ {
+ viewer_avatar->updateSexDependentLayerSets();
+ }
}
// Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values.
-// static
+// static
void LLViewerWearable::removeFromAvatar( LLWearableType::EType type)
{
- if (!isAgentAvatarValid()) return;
-
- // You can't just remove body parts.
- if( (type == LLWearableType::WT_SHAPE) ||
- (type == LLWearableType::WT_SKIN) ||
- (type == LLWearableType::WT_HAIR) ||
- (type == LLWearableType::WT_EYES) )
- {
- return;
- }
-
- // Pull params
- for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
- {
- if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->isTweakable() ) )
- {
- S32 param_id = param->getID();
- gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight());
- }
- }
-
- if(gAgentCamera.cameraCustomizeAvatar())
- {
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
- }
-
- gAgentAvatarp->updateVisualParams();
- gAgentAvatarp->wearableUpdated(type);
+ if (!isAgentAvatarValid()) return;
+
+ // You can't just remove body parts.
+ if( (type == LLWearableType::WT_SHAPE) ||
+ (type == LLWearableType::WT_SKIN) ||
+ (type == LLWearableType::WT_HAIR) ||
+ (type == LLWearableType::WT_EYES) )
+ {
+ return;
+ }
+
+ // Pull params
+ for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
+ {
+ if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->isTweakable() ) )
+ {
+ S32 param_id = param->getID();
+ gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight());
+ }
+ }
+
+ if(gAgentCamera.cameraCustomizeAvatar())
+ {
+ LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
+ }
+
+ gAgentAvatarp->updateVisualParams();
+ gAgentAvatarp->wearableUpdated(type);
}
// Does not copy mAssetID.
// Definition version is current: removes obsolete enties and creates default values for new ones.
void LLViewerWearable::copyDataFrom(const LLViewerWearable* src)
{
- if (!isAgentAvatarValid()) return;
-
- mDefinitionVersion = LLWearable::sCurrentDefinitionVersion;
-
- mName = src->mName;
- mDescription = src->mDescription;
- mPermissions = src->mPermissions;
- mSaleInfo = src->mSaleInfo;
-
- setType(src->mType, gAgentAvatarp);
-
- mSavedVisualParamMap.clear();
- // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed)
- for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
- param;
- param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
- {
- if( (param->getWearableType() == mType) )
- {
- S32 id = param->getID();
- F32 weight = src->getVisualParamWeight(id);
- mSavedVisualParamMap[id] = weight;
- }
- }
-
- destroyTextures();
- // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
- for (S32 te = 0; te < TEX_NUM_INDICES; te++)
- {
- if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
- {
- te_map_t::const_iterator iter = src->mTEMap.find(te);
- LLUUID image_id;
- LLViewerFetchedTexture *image = NULL;
- if(iter != src->mTEMap.end())
- {
- image = dynamic_cast<LLViewerFetchedTexture*> (src->getLocalTextureObject(te)->getImage());
- image_id = src->getLocalTextureObject(te)->getID();
- mTEMap[te] = new LLLocalTextureObject(image, image_id);
- mSavedTEMap[te] = new LLLocalTextureObject(image, image_id);
- mTEMap[te]->setBakedReady(src->getLocalTextureObject(te)->getBakedReady());
- mTEMap[te]->setDiscard(src->getLocalTextureObject(te)->getDiscard());
- }
- else
- {
- image_id = getDefaultTextureImageID((ETextureIndex) te);
- image = LLViewerTextureManager::getFetchedTexture( image_id );
- mTEMap[te] = new LLLocalTextureObject(image, image_id);
- mSavedTEMap[te] = new LLLocalTextureObject(image, image_id);
- }
- createLayers(te, gAgentAvatarp);
- }
- }
-
- // Probably reduntant, but ensure that the newly created wearable is not dirty by setting current value of params in new wearable
- // to be the same as the saved values (which were loaded from src at param->cloneParam(this))
- revertValuesWithoutUpdate();
+ if (!isAgentAvatarValid()) return;
+
+ mDefinitionVersion = LLWearable::sCurrentDefinitionVersion;
+
+ mName = src->mName;
+ mDescription = src->mDescription;
+ mPermissions = src->mPermissions;
+ mSaleInfo = src->mSaleInfo;
+
+ setType(src->mType, gAgentAvatarp);
+
+ mSavedVisualParamMap.clear();
+ // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed)
+ for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
+ param;
+ param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
+ {
+ if( (param->getWearableType() == mType) )
+ {
+ S32 id = param->getID();
+ F32 weight = src->getVisualParamWeight(id);
+ mSavedVisualParamMap[id] = weight;
+ }
+ }
+
+ destroyTextures();
+ // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
+ for (S32 te = 0; te < TEX_NUM_INDICES; te++)
+ {
+ if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
+ {
+ te_map_t::const_iterator iter = src->mTEMap.find(te);
+ LLUUID image_id;
+ LLViewerFetchedTexture *image = NULL;
+ if(iter != src->mTEMap.end())
+ {
+ image = dynamic_cast<LLViewerFetchedTexture*> (src->getLocalTextureObject(te)->getImage());
+ image_id = src->getLocalTextureObject(te)->getID();
+ mTEMap[te] = new LLLocalTextureObject(image, image_id);
+ mSavedTEMap[te] = new LLLocalTextureObject(image, image_id);
+ mTEMap[te]->setBakedReady(src->getLocalTextureObject(te)->getBakedReady());
+ mTEMap[te]->setDiscard(src->getLocalTextureObject(te)->getDiscard());
+ }
+ else
+ {
+ image_id = getDefaultTextureImageID((ETextureIndex) te);
+ image = LLViewerTextureManager::getFetchedTexture( image_id );
+ mTEMap[te] = new LLLocalTextureObject(image, image_id);
+ mSavedTEMap[te] = new LLLocalTextureObject(image, image_id);
+ }
+ createLayers(te, gAgentAvatarp);
+ }
+ }
+
+ // Probably reduntant, but ensure that the newly created wearable is not dirty by setting current value of params in new wearable
+ // to be the same as the saved values (which were loaded from src at param->cloneParam(this))
+ revertValuesWithoutUpdate();
}
void LLViewerWearable::setItemID(const LLUUID& item_id)
{
- mItemID = item_id;
+ mItemID = item_id;
}
void LLViewerWearable::revertValues()
{
- LLWearable::revertValues();
+ LLWearable::revertValues();
- LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::findPanel("appearance"));
- if( panel )
- {
- panel->updateScrollingPanelList();
- }
+ LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::findPanel("appearance"));
+ if( panel )
+ {
+ panel->updateScrollingPanelList();
+ }
}
void LLViewerWearable::revertValuesWithoutUpdate()
{
- LLWearable::revertValues();
+ LLWearable::revertValues();
}
void LLViewerWearable::saveValues()
{
- LLWearable::saveValues();
+ LLWearable::saveValues();
- LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::findPanel("appearance"));
- if( panel )
- {
- panel->updateScrollingPanelList();
- }
+ LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::findPanel("appearance"));
+ if( panel )
+ {
+ panel->updateScrollingPanelList();
+ }
}
// virtual
void LLViewerWearable::setUpdated() const
-{
- gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID());
+{
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID());
}
void LLViewerWearable::refreshName()
{
- LLUUID item_id = getItemID();
- LLInventoryItem* item = gInventory.getItem(item_id);
- if( item )
- {
- mName = item->getName();
- }
+ LLUUID item_id = getItemID();
+ LLInventoryItem* item = gInventory.getItem(item_id);
+ if( item )
+ {
+ mName = item->getName();
+ }
}
struct LLWearableSaveData
{
- LLWearableType::EType mType;
+ LLWearableType::EType mType;
};
void LLViewerWearable::saveNewAsset() const
{
-// LL_INFOS() << "LLViewerWearable::saveNewAsset() type: " << getTypeName() << LL_ENDL;
- //LL_INFOS() << *this << LL_ENDL;
-
- const std::string filename = asset_id_to_filename(mAssetID, LL_PATH_CACHE);
- if(! exportFile(filename))
- {
- std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str());
- LL_WARNS() << buffer << LL_ENDL;
-
- LLSD args;
- args["NAME"] = mName;
- LLNotificationsUtil::add("CannotSaveWearableOutOfSpace", args);
- return;
- }
+// LL_INFOS() << "LLViewerWearable::saveNewAsset() type: " << getTypeName() << LL_ENDL;
+ //LL_INFOS() << *this << LL_ENDL;
+
+ const std::string filename = asset_id_to_filename(mAssetID, LL_PATH_CACHE);
+ if(! exportFile(filename))
+ {
+ std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str());
+ LL_WARNS() << buffer << LL_ENDL;
+
+ LLSD args;
+ args["NAME"] = mName;
+ LLNotificationsUtil::add("CannotSaveWearableOutOfSpace", args);
+ return;
+ }
if (gSavedSettings.getBOOL("LogWearableAssetSave"))
{
@@ -529,95 +529,95 @@ void LLViewerWearable::saveNewAsset() const
exportFile(log_filename);
}
- // save it out to database
- if( gAssetStorage )
- {
- /*
- std::string url = gAgent.getRegion()->getCapability("NewAgentInventory");
- if (!url.empty())
- {
- LL_INFOS() << "Update Agent Inventory via capability" << LL_ENDL;
- LLSD body;
- body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetToFolderType(getAssetType()));
- body["asset_type"] = LLAssetType::lookup(getAssetType());
- body["inventory_type"] = LLInventoryType::lookup(LLInventoryType::IT_WEARABLE);
- body["name"] = getName();
- body["description"] = getDescription();
- LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, filename));
- }
- else
- {
- }
- */
- LLWearableSaveData* data = new LLWearableSaveData;
- data->mType = mType;
- gAssetStorage->storeAssetData(filename, mTransactionID, getAssetType(),
+ // save it out to database
+ if( gAssetStorage )
+ {
+ /*
+ std::string url = gAgent.getRegion()->getCapability("NewAgentInventory");
+ if (!url.empty())
+ {
+ LL_INFOS() << "Update Agent Inventory via capability" << LL_ENDL;
+ LLSD body;
+ body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetToFolderType(getAssetType()));
+ body["asset_type"] = LLAssetType::lookup(getAssetType());
+ body["inventory_type"] = LLInventoryType::lookup(LLInventoryType::IT_WEARABLE);
+ body["name"] = getName();
+ body["description"] = getDescription();
+ LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, filename));
+ }
+ else
+ {
+ }
+ */
+ LLWearableSaveData* data = new LLWearableSaveData;
+ data->mType = mType;
+ gAssetStorage->storeAssetData(filename, mTransactionID, getAssetType(),
&LLViewerWearable::onSaveNewAssetComplete,
(void*)data);
- }
+ }
}
// static
void LLViewerWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
- LLWearableSaveData* data = (LLWearableSaveData*)userdata;
- const std::string& type_name = LLWearableType::getInstance()->getTypeName(data->mType);
- if(0 == status)
- {
- // Success
- LL_INFOS() << "Saved wearable " << type_name << LL_ENDL;
- }
- else
- {
- std::string buffer = llformat("Unable to save %s to central asset store.", type_name.c_str());
- LL_WARNS() << buffer << " Status: " << status << LL_ENDL;
- LLSD args;
- args["NAME"] = type_name;
- LLNotificationsUtil::add("CannotSaveToAssetStore", args);
- }
-
- // Delete temp file
- const std::string src_filename = asset_id_to_filename(new_asset_id, LL_PATH_CACHE);
- LLFile::remove(src_filename);
-
- // delete the context data
- delete data;
+ LLWearableSaveData* data = (LLWearableSaveData*)userdata;
+ const std::string& type_name = LLWearableType::getInstance()->getTypeName(data->mType);
+ if(0 == status)
+ {
+ // Success
+ LL_INFOS() << "Saved wearable " << type_name << LL_ENDL;
+ }
+ else
+ {
+ std::string buffer = llformat("Unable to save %s to central asset store.", type_name.c_str());
+ LL_WARNS() << buffer << " Status: " << status << LL_ENDL;
+ LLSD args;
+ args["NAME"] = type_name;
+ LLNotificationsUtil::add("CannotSaveToAssetStore", args);
+ }
+
+ // Delete temp file
+ const std::string src_filename = asset_id_to_filename(new_asset_id, LL_PATH_CACHE);
+ LLFile::remove(src_filename);
+
+ // delete the context data
+ delete data;
}
std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w)
{
- s << "wearable " << LLWearableType::getInstance()->getTypeName(w.mType) << "\n";
- s << " Name: " << w.mName << "\n";
- s << " Desc: " << w.mDescription << "\n";
- //w.mPermissions
- //w.mSaleInfo
-
- s << " Params:" << "\n";
- for (LLWearable::visual_param_index_map_t::const_iterator iter = w.mVisualParamIndexMap.begin();
- iter != w.mVisualParamIndexMap.end(); ++iter)
- {
- S32 param_id = iter->first;
- LLVisualParam *wearable_param = iter->second;
- F32 param_weight = wearable_param->getWeight();
- s << " " << param_id << " " << param_weight << "\n";
- }
-
- s << " Textures:" << "\n";
- for (LLViewerWearable::te_map_t::const_iterator iter = w.mTEMap.begin();
- iter != w.mTEMap.end(); ++iter)
- {
- S32 te = iter->first;
- const LLUUID& image_id = iter->second->getID();
- s << " " << te << " " << image_id << "\n";
- }
- return s;
+ s << "wearable " << LLWearableType::getInstance()->getTypeName(w.mType) << "\n";
+ s << " Name: " << w.mName << "\n";
+ s << " Desc: " << w.mDescription << "\n";
+ //w.mPermissions
+ //w.mSaleInfo
+
+ s << " Params:" << "\n";
+ for (LLWearable::visual_param_index_map_t::const_iterator iter = w.mVisualParamIndexMap.begin();
+ iter != w.mVisualParamIndexMap.end(); ++iter)
+ {
+ S32 param_id = iter->first;
+ LLVisualParam *wearable_param = iter->second;
+ F32 param_weight = wearable_param->getWeight();
+ s << " " << param_id << " " << param_weight << "\n";
+ }
+
+ s << " Textures:" << "\n";
+ for (LLViewerWearable::te_map_t::const_iterator iter = w.mTEMap.begin();
+ iter != w.mTEMap.end(); ++iter)
+ {
+ S32 te = iter->first;
+ const LLUUID& image_id = iter->second->getID();
+ s << " " << te << " " << image_id << "\n";
+ }
+ return s;
}
std::string asset_id_to_filename(const LLUUID &asset_id, const ELLPath dir_spec)
{
- std::string asset_id_string;
- asset_id.toString(asset_id_string);
- std::string filename = gDirUtilp->getExpandedFilename(dir_spec,asset_id_string) + ".wbl";
- return filename;
+ std::string asset_id_string;
+ asset_id.toString(asset_id_string);
+ std::string filename = gDirUtilp->getExpandedFilename(dir_spec,asset_id_string) + ".wbl";
+ return filename;
}
diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h
index 24b1323b2b..15feab0a57 100644
--- a/indra/newview/llviewerwearable.h
+++ b/indra/newview/llviewerwearable.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerwearable.h
* @brief LLViewerWearable class header file
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,72 +35,72 @@ class LLVOAvatar;
class LLViewerWearable : public LLWearable
{
- friend class LLWearableList;
+ friend class LLWearableList;
- //--------------------------------------------------------------------
- // Constructors and destructors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Constructors and destructors
+ //--------------------------------------------------------------------
private:
- // Private constructors used by LLViewerWearableList
- LLViewerWearable(const LLTransactionID& transactionID);
- LLViewerWearable(const LLAssetID& assetID);
+ // Private constructors used by LLViewerWearableList
+ LLViewerWearable(const LLTransactionID& transactionID);
+ LLViewerWearable(const LLAssetID& assetID);
public:
- virtual ~LLViewerWearable();
+ virtual ~LLViewerWearable();
- //--------------------------------------------------------------------
- // Accessors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Accessors
+ //--------------------------------------------------------------------
public:
- const LLUUID& getItemID() const { return mItemID; }
- const LLAssetID& getAssetID() const { return mAssetID; }
- const LLTransactionID& getTransactionID() const { return mTransactionID; }
- void setItemID(const LLUUID& item_id);
+ const LLUUID& getItemID() const { return mItemID; }
+ const LLAssetID& getAssetID() const { return mAssetID; }
+ const LLTransactionID& getTransactionID() const { return mTransactionID; }
+ void setItemID(const LLUUID& item_id);
public:
- BOOL isDirty() const;
- BOOL isOldVersion() const;
+ BOOL isDirty() const;
+ BOOL isOldVersion() const;
+
+ /*virtual*/ void writeToAvatar(LLAvatarAppearance *avatarp);
+ void removeFromAvatar() { LLViewerWearable::removeFromAvatar( mType); }
+ static void removeFromAvatar( LLWearableType::EType type);
- /*virtual*/ void writeToAvatar(LLAvatarAppearance *avatarp);
- void removeFromAvatar() { LLViewerWearable::removeFromAvatar( mType); }
- static void removeFromAvatar( LLWearableType::EType type);
+ /*virtual*/ EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp );
- /*virtual*/ EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp );
-
- void setParamsToDefaults();
- void setTexturesToDefaults();
- void setVolatile(BOOL is_volatile) { mVolatile = is_volatile; } // TRUE when doing preview renders, some updates will be suppressed.
- BOOL getVolatile() { return mVolatile; }
+ void setParamsToDefaults();
+ void setTexturesToDefaults();
+ void setVolatile(BOOL is_volatile) { mVolatile = is_volatile; } // TRUE when doing preview renders, some updates will be suppressed.
+ BOOL getVolatile() { return mVolatile; }
- /*virtual*/ LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const;
+ /*virtual*/ LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const;
- void saveNewAsset() const;
- static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status );
+ void saveNewAsset() const;
+ static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status );
- void copyDataFrom(const LLViewerWearable* src);
+ void copyDataFrom(const LLViewerWearable* src);
- friend std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w);
+ friend std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w);
- /*virtual*/ void revertValues();
- /*virtual*/ void saveValues();
+ /*virtual*/ void revertValues();
+ /*virtual*/ void saveValues();
- void revertValuesWithoutUpdate();
+ void revertValuesWithoutUpdate();
- // Something happened that requires the wearable's label to be updated (e.g. worn/unworn).
- /*virtual*/void setUpdated() const;
+ // Something happened that requires the wearable's label to be updated (e.g. worn/unworn).
+ /*virtual*/void setUpdated() const;
- // the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem,
- // not the wearable asset itself.
- void refreshName();
+ // the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem,
+ // not the wearable asset itself.
+ void refreshName();
protected:
- LLAssetID mAssetID;
- LLTransactionID mTransactionID;
+ LLAssetID mAssetID;
+ LLTransactionID mTransactionID;
- BOOL mVolatile; // True when rendering preview images. Can suppress some updates.
+ BOOL mVolatile; // True when rendering preview images. Can suppress some updates.
- LLUUID mItemID; // ID of the inventory item in the agent's inventory
+ LLUUID mItemID; // ID of the inventory item in the agent's inventory
};
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 37e64dfc17..ce144f67c7 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerwindow.cpp
* @brief Implementation of the LLViewerWindow class.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -62,7 +62,7 @@
//
// linden library includes
-#include "llaudioengine.h" // mute on minimize
+#include "llaudioengine.h" // mute on minimize
#include "llchatentry.h"
#include "indra_constants.h"
#include "llassetstorage.h"
@@ -166,7 +166,7 @@
#include "lltoolselectland.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
-#include "llurldispatcher.h" // SLURL from other app instance
+#include "llurldispatcher.h" // SLURL from other app instance
#include "llversioninfo.h"
#include "llvieweraudio.h"
#include "llviewercamera.h"
@@ -231,29 +231,29 @@ extern BOOL gResizeScreenTexture;
extern BOOL gCubeSnapshot;
extern BOOL gSnapshotNoPost;
-LLViewerWindow *gViewerWindow = NULL;
+LLViewerWindow *gViewerWindow = NULL;
-LLFrameTimer gAwayTimer;
-LLFrameTimer gAwayTriggerTimer;
+LLFrameTimer gAwayTimer;
+LLFrameTimer gAwayTriggerTimer;
-BOOL gShowOverlayTitle = FALSE;
+BOOL gShowOverlayTitle = FALSE;
LLViewerObject* gDebugRaycastObject = NULL;
LLVOPartGroup* gDebugRaycastParticle = NULL;
LLVector4a gDebugRaycastIntersection;
-LLVector4a gDebugRaycastParticleIntersection;
+LLVector4a gDebugRaycastParticleIntersection;
LLVector2 gDebugRaycastTexCoord;
LLVector4a gDebugRaycastNormal;
LLVector4a gDebugRaycastTangent;
-S32 gDebugRaycastFaceHit;
-LLVector4a gDebugRaycastStart;
-LLVector4a gDebugRaycastEnd;
+S32 gDebugRaycastFaceHit;
+LLVector4a gDebugRaycastStart;
+LLVector4a gDebugRaycastEnd;
// HUD display lines in lower right
-BOOL gDisplayWindInfo = FALSE;
-BOOL gDisplayCameraPos = FALSE;
-BOOL gDisplayFOV = FALSE;
-BOOL gDisplayBadge = FALSE;
+BOOL gDisplayWindInfo = FALSE;
+BOOL gDisplayCameraPos = FALSE;
+BOOL gDisplayFOV = FALSE;
+BOOL gDisplayBadge = FALSE;
static const U8 NO_FACE = 255;
BOOL gQuietSnapshot = FALSE;
@@ -267,8 +267,8 @@ static const F32 MIN_DISPLAY_SCALE = 0.75f;
static const char KEY_MOUSELOOK = 'M';
-static LLCachedControl<std::string> sSnapshotBaseName(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseName", "Snapshot"));
-static LLCachedControl<std::string> sSnapshotDir(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseDir", ""));
+static LLCachedControl<std::string> sSnapshotBaseName(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseName", "Snapshot"));
+static LLCachedControl<std::string> sSnapshotDir(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseDir", ""));
LLTrace::SampleStatHandle<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity");
@@ -276,40 +276,40 @@ LLTrace::SampleStatHandle<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity")
class RecordToChatConsoleRecorder : public LLError::Recorder
{
public:
- virtual void recordMessage(LLError::ELevel level,
- const std::string& message)
- {
- //FIXME: this is NOT thread safe, and will do bad things when a warning is issued from a non-UI thread
-
- // only log warnings to chat console
- //if (level == LLError::LEVEL_WARN)
- //{
- //LLFloaterChat* chat_floater = LLFloaterReg::findTypedInstance<LLFloaterChat>("chat");
- //if (chat_floater && gSavedSettings.getBOOL("WarningsAsChat"))
- //{
- // LLChat chat;
- // chat.mText = message;
- // chat.mSourceType = CHAT_SOURCE_SYSTEM;
-
- // chat_floater->addChat(chat, FALSE, FALSE);
- //}
- //}
- }
+ virtual void recordMessage(LLError::ELevel level,
+ const std::string& message)
+ {
+ //FIXME: this is NOT thread safe, and will do bad things when a warning is issued from a non-UI thread
+
+ // only log warnings to chat console
+ //if (level == LLError::LEVEL_WARN)
+ //{
+ //LLFloaterChat* chat_floater = LLFloaterReg::findTypedInstance<LLFloaterChat>("chat");
+ //if (chat_floater && gSavedSettings.getBOOL("WarningsAsChat"))
+ //{
+ // LLChat chat;
+ // chat.mText = message;
+ // chat.mSourceType = CHAT_SOURCE_SYSTEM;
+
+ // chat_floater->addChat(chat, FALSE, FALSE);
+ //}
+ //}
+ }
};
class RecordToChatConsole : public LLSingleton<RecordToChatConsole>
{
- LLSINGLETON(RecordToChatConsole);
+ LLSINGLETON(RecordToChatConsole);
public:
- void startRecorder() { LLError::addRecorder(mRecorder); }
- void stopRecorder() { LLError::removeRecorder(mRecorder); }
+ void startRecorder() { LLError::addRecorder(mRecorder); }
+ void stopRecorder() { LLError::removeRecorder(mRecorder); }
private:
- LLError::RecorderPtr mRecorder;
+ LLError::RecorderPtr mRecorder;
};
RecordToChatConsole::RecordToChatConsole():
- mRecorder(new RecordToChatConsoleRecorder())
+ mRecorder(new RecordToChatConsoleRecorder())
{
mRecorder->showTags(false);
mRecorder->showLocation(false);
@@ -419,214 +419,214 @@ static LLTrace::BlockTimerStatHandle FTM_DISPLAY_DEBUG_TEXT("Display Debug Text"
class LLDebugText
{
private:
- struct Line
- {
- Line(const std::string& in_text, S32 in_x, S32 in_y) : text(in_text), x(in_x), y(in_y) {}
- std::string text;
- S32 x,y;
- };
-
- LLViewerWindow *mWindow;
-
- typedef std::vector<Line> line_list_t;
- line_list_t mLineList;
- LLColor4 mTextColor;
-
- LLColor4 mBackColor;
- LLRect mBackRectCamera1;
- LLRect mBackRectCamera2;
-
- void addText(S32 x, S32 y, const std::string &text)
- {
- mLineList.push_back(Line(text, x, y));
- }
-
- void clearText() { mLineList.clear(); }
-
+ struct Line
+ {
+ Line(const std::string& in_text, S32 in_x, S32 in_y) : text(in_text), x(in_x), y(in_y) {}
+ std::string text;
+ S32 x,y;
+ };
+
+ LLViewerWindow *mWindow;
+
+ typedef std::vector<Line> line_list_t;
+ line_list_t mLineList;
+ LLColor4 mTextColor;
+
+ LLColor4 mBackColor;
+ LLRect mBackRectCamera1;
+ LLRect mBackRectCamera2;
+
+ void addText(S32 x, S32 y, const std::string &text)
+ {
+ mLineList.push_back(Line(text, x, y));
+ }
+
+ void clearText() { mLineList.clear(); }
+
public:
- LLDebugText(LLViewerWindow* window) : mWindow(window) {}
-
- void update()
- {
- if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
- {
- clearText();
- return;
- }
-
- static LLCachedControl<bool> log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic", false) ;
-
- std::string wind_vel_text;
- std::string wind_vector_text;
- std::string rwind_vel_text;
- std::string rwind_vector_text;
- std::string audio_text;
-
- static const std::string beacon_particle = LLTrans::getString("BeaconParticle");
- static const std::string beacon_physical = LLTrans::getString("BeaconPhysical");
- static const std::string beacon_scripted = LLTrans::getString("BeaconScripted");
- static const std::string beacon_scripted_touch = LLTrans::getString("BeaconScriptedTouch");
- static const std::string beacon_sound = LLTrans::getString("BeaconSound");
- static const std::string beacon_media = LLTrans::getString("BeaconMedia");
- static const std::string beacon_sun = LLTrans::getString("BeaconSun");
- static const std::string beacon_moon = LLTrans::getString("BeaconMoon");
- static const std::string particle_hiding = LLTrans::getString("ParticleHiding");
-
- // Draw the statistics in a light gray
- // and in a thin font
- mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f );
-
- // Draw stuff growing up from right lower corner of screen
- S32 x_right = mWindow->getWorldViewWidthScaled();
- S32 xpos = x_right - 400;
- xpos = llmax(xpos, 0);
- S32 ypos = 64;
- const S32 y_inc = 20;
-
- // Camera matrix text is hard to see again a white background
- // Add a dark background underneath the matrices for readability (contrast)
- mBackRectCamera1.mLeft = xpos;
- mBackRectCamera1.mRight = x_right;
- mBackRectCamera1.mTop = -1;
- mBackRectCamera1.mBottom = -1;
- mBackRectCamera2 = mBackRectCamera1;
-
- mBackColor = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" );
-
- clearText();
-
- if (gSavedSettings.getBOOL("DebugShowTime"))
- {
- F32 time = gFrameTimeSeconds;
- S32 hours = (S32)(time / (60*60));
- S32 mins = (S32)((time - hours*(60*60)) / 60);
- S32 secs = (S32)((time - hours*(60*60) - mins*60));
- addText(xpos, ypos, llformat("Time: %d:%02d:%02d", hours,mins,secs)); ypos += y_inc;
- }
-
- if (gSavedSettings.getBOOL("DebugShowMemory"))
- {
- addText(xpos, ypos,
- STRINGIZE("Memory: " << (LLMemory::getCurrentRSS() / 1024) << " (KB)"));
- ypos += y_inc;
- }
-
- if (gDisplayCameraPos)
- {
- std::string camera_view_text;
- std::string camera_center_text;
- std::string agent_view_text;
- std::string agent_left_text;
- std::string agent_center_text;
- std::string agent_root_center_text;
-
- LLVector3d tvector; // Temporary vector to hold data for printing.
-
- // Update camera center, camera view, wind info every other frame
- tvector = gAgent.getPositionGlobal();
- agent_center_text = llformat("AgentCenter %f %f %f",
- (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
-
- if (isAgentAvatarValid())
- {
- tvector = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition());
- agent_root_center_text = llformat("AgentRootCenter %f %f %f",
- (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
- }
- else
- {
- agent_root_center_text = "---";
- }
-
-
- tvector = LLVector4(gAgent.getFrameAgent().getAtAxis());
- agent_view_text = llformat("AgentAtAxis %f %f %f",
- (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
-
- tvector = LLVector4(gAgent.getFrameAgent().getLeftAxis());
- agent_left_text = llformat("AgentLeftAxis %f %f %f",
- (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
-
- tvector = gAgentCamera.getCameraPositionGlobal();
- camera_center_text = llformat("CameraCenter %f %f %f",
- (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
-
- tvector = LLVector4(LLViewerCamera::getInstance()->getAtAxis());
- camera_view_text = llformat("CameraAtAxis %f %f %f",
- (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
-
- addText(xpos, ypos, agent_center_text); ypos += y_inc;
- addText(xpos, ypos, agent_root_center_text); ypos += y_inc;
- addText(xpos, ypos, agent_view_text); ypos += y_inc;
- addText(xpos, ypos, agent_left_text); ypos += y_inc;
- addText(xpos, ypos, camera_center_text); ypos += y_inc;
- addText(xpos, ypos, camera_view_text); ypos += y_inc;
- }
-
- if (gDisplayWindInfo)
- {
- wind_vel_text = llformat("Wind velocity %.2f m/s", gWindVec.magVec());
- wind_vector_text = llformat("Wind vector %.2f %.2f %.2f", gWindVec.mV[0], gWindVec.mV[1], gWindVec.mV[2]);
- rwind_vel_text = llformat("RWind vel %.2f m/s", gRelativeWindVec.magVec());
- rwind_vector_text = llformat("RWind vec %.2f %.2f %.2f", gRelativeWindVec.mV[0], gRelativeWindVec.mV[1], gRelativeWindVec.mV[2]);
-
- addText(xpos, ypos, wind_vel_text); ypos += y_inc;
- addText(xpos, ypos, wind_vector_text); ypos += y_inc;
- addText(xpos, ypos, rwind_vel_text); ypos += y_inc;
- addText(xpos, ypos, rwind_vector_text); ypos += y_inc;
- }
- if (gDisplayWindInfo)
- {
- audio_text = llformat("Audio for wind: %d", gAudiop ? gAudiop->isWindEnabled() : -1);
- addText(xpos, ypos, audio_text); ypos += y_inc;
- }
- if (gDisplayFOV)
- {
- addText(xpos, ypos, llformat("FOV: %2.1f deg", RAD_TO_DEG * LLViewerCamera::getInstance()->getView()));
- ypos += y_inc;
- }
- if (gDisplayBadge)
- {
- addText(xpos, ypos+(y_inc/2), llformat("Hippos!", RAD_TO_DEG * LLViewerCamera::getInstance()->getView()));
- ypos += y_inc * 2;
- }
-
- /*if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- addText(xpos + 200, ypos, llformat("Flycam"));
- ypos += y_inc;
- }*/
-
- if (gSavedSettings.getBOOL("DebugShowRenderInfo"))
- {
- LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording();
-
- //show streaming cost/triangle count of known prims in current region OR selection
- {
- F32 cost = 0.f;
- S32 count = 0;
- S32 vcount = 0;
- S32 object_count = 0;
- S32 total_bytes = 0;
- S32 visible_bytes = 0;
-
- const char* label = "Region";
- if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 0)
- { //region
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
- for (U32 i = 0; i < gObjectList.getNumObjects(); ++i)
- {
- LLViewerObject* object = gObjectList.getObject(i);
- if (object &&
- object->getRegion() == region &&
- object->getVolume())
- {
- object_count++;
- S32 bytes = 0;
- S32 visible = 0;
- cost += object->getStreamingCost();
+ LLDebugText(LLViewerWindow* window) : mWindow(window) {}
+
+ void update()
+ {
+ if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
+ clearText();
+ return;
+ }
+
+ static LLCachedControl<bool> log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic", false) ;
+
+ std::string wind_vel_text;
+ std::string wind_vector_text;
+ std::string rwind_vel_text;
+ std::string rwind_vector_text;
+ std::string audio_text;
+
+ static const std::string beacon_particle = LLTrans::getString("BeaconParticle");
+ static const std::string beacon_physical = LLTrans::getString("BeaconPhysical");
+ static const std::string beacon_scripted = LLTrans::getString("BeaconScripted");
+ static const std::string beacon_scripted_touch = LLTrans::getString("BeaconScriptedTouch");
+ static const std::string beacon_sound = LLTrans::getString("BeaconSound");
+ static const std::string beacon_media = LLTrans::getString("BeaconMedia");
+ static const std::string beacon_sun = LLTrans::getString("BeaconSun");
+ static const std::string beacon_moon = LLTrans::getString("BeaconMoon");
+ static const std::string particle_hiding = LLTrans::getString("ParticleHiding");
+
+ // Draw the statistics in a light gray
+ // and in a thin font
+ mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f );
+
+ // Draw stuff growing up from right lower corner of screen
+ S32 x_right = mWindow->getWorldViewWidthScaled();
+ S32 xpos = x_right - 400;
+ xpos = llmax(xpos, 0);
+ S32 ypos = 64;
+ const S32 y_inc = 20;
+
+ // Camera matrix text is hard to see again a white background
+ // Add a dark background underneath the matrices for readability (contrast)
+ mBackRectCamera1.mLeft = xpos;
+ mBackRectCamera1.mRight = x_right;
+ mBackRectCamera1.mTop = -1;
+ mBackRectCamera1.mBottom = -1;
+ mBackRectCamera2 = mBackRectCamera1;
+
+ mBackColor = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" );
+
+ clearText();
+
+ if (gSavedSettings.getBOOL("DebugShowTime"))
+ {
+ F32 time = gFrameTimeSeconds;
+ S32 hours = (S32)(time / (60*60));
+ S32 mins = (S32)((time - hours*(60*60)) / 60);
+ S32 secs = (S32)((time - hours*(60*60) - mins*60));
+ addText(xpos, ypos, llformat("Time: %d:%02d:%02d", hours,mins,secs)); ypos += y_inc;
+ }
+
+ if (gSavedSettings.getBOOL("DebugShowMemory"))
+ {
+ addText(xpos, ypos,
+ STRINGIZE("Memory: " << (LLMemory::getCurrentRSS() / 1024) << " (KB)"));
+ ypos += y_inc;
+ }
+
+ if (gDisplayCameraPos)
+ {
+ std::string camera_view_text;
+ std::string camera_center_text;
+ std::string agent_view_text;
+ std::string agent_left_text;
+ std::string agent_center_text;
+ std::string agent_root_center_text;
+
+ LLVector3d tvector; // Temporary vector to hold data for printing.
+
+ // Update camera center, camera view, wind info every other frame
+ tvector = gAgent.getPositionGlobal();
+ agent_center_text = llformat("AgentCenter %f %f %f",
+ (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
+
+ if (isAgentAvatarValid())
+ {
+ tvector = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition());
+ agent_root_center_text = llformat("AgentRootCenter %f %f %f",
+ (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
+ }
+ else
+ {
+ agent_root_center_text = "---";
+ }
+
+
+ tvector = LLVector4(gAgent.getFrameAgent().getAtAxis());
+ agent_view_text = llformat("AgentAtAxis %f %f %f",
+ (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
+
+ tvector = LLVector4(gAgent.getFrameAgent().getLeftAxis());
+ agent_left_text = llformat("AgentLeftAxis %f %f %f",
+ (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
+
+ tvector = gAgentCamera.getCameraPositionGlobal();
+ camera_center_text = llformat("CameraCenter %f %f %f",
+ (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
+
+ tvector = LLVector4(LLViewerCamera::getInstance()->getAtAxis());
+ camera_view_text = llformat("CameraAtAxis %f %f %f",
+ (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
+
+ addText(xpos, ypos, agent_center_text); ypos += y_inc;
+ addText(xpos, ypos, agent_root_center_text); ypos += y_inc;
+ addText(xpos, ypos, agent_view_text); ypos += y_inc;
+ addText(xpos, ypos, agent_left_text); ypos += y_inc;
+ addText(xpos, ypos, camera_center_text); ypos += y_inc;
+ addText(xpos, ypos, camera_view_text); ypos += y_inc;
+ }
+
+ if (gDisplayWindInfo)
+ {
+ wind_vel_text = llformat("Wind velocity %.2f m/s", gWindVec.magVec());
+ wind_vector_text = llformat("Wind vector %.2f %.2f %.2f", gWindVec.mV[0], gWindVec.mV[1], gWindVec.mV[2]);
+ rwind_vel_text = llformat("RWind vel %.2f m/s", gRelativeWindVec.magVec());
+ rwind_vector_text = llformat("RWind vec %.2f %.2f %.2f", gRelativeWindVec.mV[0], gRelativeWindVec.mV[1], gRelativeWindVec.mV[2]);
+
+ addText(xpos, ypos, wind_vel_text); ypos += y_inc;
+ addText(xpos, ypos, wind_vector_text); ypos += y_inc;
+ addText(xpos, ypos, rwind_vel_text); ypos += y_inc;
+ addText(xpos, ypos, rwind_vector_text); ypos += y_inc;
+ }
+ if (gDisplayWindInfo)
+ {
+ audio_text = llformat("Audio for wind: %d", gAudiop ? gAudiop->isWindEnabled() : -1);
+ addText(xpos, ypos, audio_text); ypos += y_inc;
+ }
+ if (gDisplayFOV)
+ {
+ addText(xpos, ypos, llformat("FOV: %2.1f deg", RAD_TO_DEG * LLViewerCamera::getInstance()->getView()));
+ ypos += y_inc;
+ }
+ if (gDisplayBadge)
+ {
+ addText(xpos, ypos+(y_inc/2), llformat("Hippos!", RAD_TO_DEG * LLViewerCamera::getInstance()->getView()));
+ ypos += y_inc * 2;
+ }
+
+ /*if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ addText(xpos + 200, ypos, llformat("Flycam"));
+ ypos += y_inc;
+ }*/
+
+ if (gSavedSettings.getBOOL("DebugShowRenderInfo"))
+ {
+ LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording();
+
+ //show streaming cost/triangle count of known prims in current region OR selection
+ {
+ F32 cost = 0.f;
+ S32 count = 0;
+ S32 vcount = 0;
+ S32 object_count = 0;
+ S32 total_bytes = 0;
+ S32 visible_bytes = 0;
+
+ const char* label = "Region";
+ if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 0)
+ { //region
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ for (U32 i = 0; i < gObjectList.getNumObjects(); ++i)
+ {
+ LLViewerObject* object = gObjectList.getObject(i);
+ if (object &&
+ object->getRegion() == region &&
+ object->getVolume())
+ {
+ object_count++;
+ S32 bytes = 0;
+ S32 visible = 0;
+ cost += object->getStreamingCost();
LLMeshCostData costs;
if (object->getCostData(costs))
{
@@ -634,96 +634,96 @@ public:
visible = costs.getSizeByLOD(object->getLOD());
}
- S32 vt = 0;
- count += object->getTriangleCount(&vt);
- vcount += vt;
- total_bytes += bytes;
- visible_bytes += visible;
- }
- }
- }
- }
- else
- {
- label = "Selection";
- cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectStreamingCost(&total_bytes, &visible_bytes);
- count = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectTriangleCount(&vcount);
- object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
- }
-
- addText(xpos,ypos, llformat("%s streaming cost: %.1f", label, cost));
- ypos += y_inc;
-
- addText(xpos, ypos, llformat(" %.3f KTris, %.3f KVerts, %.1f/%.1f KB, %d objects",
- count/1000.f, vcount/1000.f, visible_bytes/1024.f, total_bytes/1024.f, object_count));
- ypos += y_inc;
-
- }
-
- addText(xpos, ypos, llformat("%d Texture Binds", LLImageGL::sBindCount));
- ypos += y_inc;
-
- addText(xpos, ypos, llformat("%d Unique Textures", LLImageGL::sUniqueCount));
- ypos += y_inc;
-
- addText(xpos, ypos, llformat("%d Render Calls", (U32)last_frame_recording.getSampleCount(LLPipeline::sStatBatchSize)));
+ S32 vt = 0;
+ count += object->getTriangleCount(&vt);
+ vcount += vt;
+ total_bytes += bytes;
+ visible_bytes += visible;
+ }
+ }
+ }
+ }
+ else
+ {
+ label = "Selection";
+ cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectStreamingCost(&total_bytes, &visible_bytes);
+ count = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectTriangleCount(&vcount);
+ object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
+ }
+
+ addText(xpos,ypos, llformat("%s streaming cost: %.1f", label, cost));
+ ypos += y_inc;
+
+ addText(xpos, ypos, llformat(" %.3f KTris, %.3f KVerts, %.1f/%.1f KB, %d objects",
+ count/1000.f, vcount/1000.f, visible_bytes/1024.f, total_bytes/1024.f, object_count));
+ ypos += y_inc;
+
+ }
+
+ addText(xpos, ypos, llformat("%d Texture Binds", LLImageGL::sBindCount));
ypos += y_inc;
- addText(xpos, ypos, llformat("%d/%d Objects Active", gObjectList.getNumActiveObjects(), gObjectList.getNumObjects()));
- ypos += y_inc;
+ addText(xpos, ypos, llformat("%d Unique Textures", LLImageGL::sUniqueCount));
+ ypos += y_inc;
+
+ addText(xpos, ypos, llformat("%d Render Calls", (U32)last_frame_recording.getSampleCount(LLPipeline::sStatBatchSize)));
+ ypos += y_inc;
- addText(xpos, ypos, llformat("%d Matrix Ops", gPipeline.mMatrixOpCount));
- ypos += y_inc;
+ addText(xpos, ypos, llformat("%d/%d Objects Active", gObjectList.getNumActiveObjects(), gObjectList.getNumObjects()));
+ ypos += y_inc;
+
+ addText(xpos, ypos, llformat("%d Matrix Ops", gPipeline.mMatrixOpCount));
+ ypos += y_inc;
- addText(xpos, ypos, llformat("%d Texture Matrix Ops", gPipeline.mTextureMatrixOps));
- ypos += y_inc;
+ addText(xpos, ypos, llformat("%d Texture Matrix Ops", gPipeline.mTextureMatrixOps));
+ ypos += y_inc;
- gPipeline.mTextureMatrixOps = 0;
- gPipeline.mMatrixOpCount = 0;
+ gPipeline.mTextureMatrixOps = 0;
+ gPipeline.mMatrixOpCount = 0;
- if (last_frame_recording.getSampleCount(LLPipeline::sStatBatchSize) > 0)
- {
+ if (last_frame_recording.getSampleCount(LLPipeline::sStatBatchSize) > 0)
+ {
addText(xpos, ypos, llformat("Batch min/max/mean: %d/%d/%d", (U32)last_frame_recording.getMin(LLPipeline::sStatBatchSize), (U32)last_frame_recording.getMax(LLPipeline::sStatBatchSize), (U32)last_frame_recording.getMean(LLPipeline::sStatBatchSize)));
- }
+ }
+ ypos += y_inc;
+
+ addText(xpos, ypos, llformat("UI Verts/Calls: %d/%d", LLRender::sUIVerts, LLRender::sUICalls));
+ LLRender::sUICalls = LLRender::sUIVerts = 0;
+ ypos += y_inc;
+
+ addText(xpos,ypos, llformat("%d/%d Nodes visible", gPipeline.mNumVisibleNodes, LLSpatialGroup::sNodeCount));
+
ypos += y_inc;
- addText(xpos, ypos, llformat("UI Verts/Calls: %d/%d", LLRender::sUIVerts, LLRender::sUICalls));
- LLRender::sUICalls = LLRender::sUIVerts = 0;
- ypos += y_inc;
+ if (!LLOcclusionCullingGroup::sPendingQueries.empty())
+ {
+ addText(xpos,ypos, llformat("%d Queries pending", LLOcclusionCullingGroup::sPendingQueries.size()));
+ ypos += y_inc;
+ }
+
- addText(xpos,ypos, llformat("%d/%d Nodes visible", gPipeline.mNumVisibleNodes, LLSpatialGroup::sNodeCount));
-
- ypos += y_inc;
+ addText(xpos,ypos, llformat("%d Avatars visible", LLVOAvatar::sNumVisibleAvatars));
- if (!LLOcclusionCullingGroup::sPendingQueries.empty())
- {
- addText(xpos,ypos, llformat("%d Queries pending", LLOcclusionCullingGroup::sPendingQueries.size()));
- ypos += y_inc;
- }
+ ypos += y_inc;
+ addText(xpos,ypos, llformat("%d Lights visible", LLPipeline::sVisibleLightCount));
- addText(xpos,ypos, llformat("%d Avatars visible", LLVOAvatar::sNumVisibleAvatars));
-
- ypos += y_inc;
+ ypos += y_inc;
- addText(xpos,ypos, llformat("%d Lights visible", LLPipeline::sVisibleLightCount));
-
- ypos += y_inc;
+ if (gMeshRepo.meshRezEnabled())
+ {
+ addText(xpos, ypos, llformat("%.3f MB Mesh Data Received", LLMeshRepository::sBytesReceived/(1024.f*1024.f)));
- if (gMeshRepo.meshRezEnabled())
- {
- addText(xpos, ypos, llformat("%.3f MB Mesh Data Received", LLMeshRepository::sBytesReceived/(1024.f*1024.f)));
-
- ypos += y_inc;
-
- addText(xpos, ypos, llformat("%d/%d Mesh HTTP Requests/Retries", LLMeshRepository::sHTTPRequestCount,
- LLMeshRepository::sHTTPRetryCount));
- ypos += y_inc;
+ ypos += y_inc;
- addText(xpos, ypos, llformat("%d/%d Mesh LOD Pending/Processing", LLMeshRepository::sLODPending, LLMeshRepository::sLODProcessing));
- ypos += y_inc;
+ addText(xpos, ypos, llformat("%d/%d Mesh HTTP Requests/Retries", LLMeshRepository::sHTTPRequestCount,
+ LLMeshRepository::sHTTPRetryCount));
+ ypos += y_inc;
- addText(xpos, ypos, llformat("%.3f/%.3f MB Mesh Cache Read/Write ", LLMeshRepository::sCacheBytesRead/(1024.f*1024.f), LLMeshRepository::sCacheBytesWritten/(1024.f*1024.f)));
+ addText(xpos, ypos, llformat("%d/%d Mesh LOD Pending/Processing", LLMeshRepository::sLODPending, LLMeshRepository::sLODProcessing));
+ ypos += y_inc;
+
+ addText(xpos, ypos, llformat("%.3f/%.3f MB Mesh Cache Read/Write ", LLMeshRepository::sCacheBytesRead/(1024.f*1024.f), LLMeshRepository::sCacheBytesWritten/(1024.f*1024.f)));
ypos += y_inc;
addText(xpos, ypos, llformat("%.3f/%.3f MB Mesh Skins/Decompositions Memory", LLMeshRepository::sCacheBytesSkins / (1024.f*1024.f), LLMeshRepository::sCacheBytesDecomps / (1024.f*1024.f)));
@@ -731,72 +731,72 @@ public:
addText(xpos, ypos, llformat("%.3f MB Mesh Headers Memory", LLMeshRepository::sCacheBytesHeaders / (1024.f*1024.f)));
- ypos += y_inc;
- }
+ ypos += y_inc;
+ }
gPipeline.mNumVisibleNodes = LLPipeline::sVisibleLightCount = 0;
- }
- if (gSavedSettings.getBOOL("DebugShowAvatarRenderInfo"))
- {
- std::map<std::string, LLVOAvatar*> sorted_avs;
-
- std::vector<LLCharacter*>::iterator sort_iter = LLCharacter::sInstances.begin();
- while (sort_iter != LLCharacter::sInstances.end())
- {
- LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*sort_iter);
- if (avatar &&
- !avatar->isDead()) // Not dead yet
- {
- // Stuff into a sorted map so the display is ordered
- sorted_avs[avatar->getFullname()] = avatar;
- }
- sort_iter++;
- }
-
- std::string trunc_name;
- std::map<std::string, LLVOAvatar*>::reverse_iterator av_iter = sorted_avs.rbegin(); // Put "A" at the top
- while (av_iter != sorted_avs.rend())
- {
- LLVOAvatar* avatar = av_iter->second;
-
- avatar->calculateUpdateRenderComplexity(); // Make sure the numbers are up-to-date
-
- trunc_name = utf8str_truncate(avatar->getFullname(), 16);
- addText(xpos, ypos, llformat("%s : %s, complexity %d, area %.2f",
- trunc_name.c_str(),
+ }
+ if (gSavedSettings.getBOOL("DebugShowAvatarRenderInfo"))
+ {
+ std::map<std::string, LLVOAvatar*> sorted_avs;
+
+ std::vector<LLCharacter*>::iterator sort_iter = LLCharacter::sInstances.begin();
+ while (sort_iter != LLCharacter::sInstances.end())
+ {
+ LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*sort_iter);
+ if (avatar &&
+ !avatar->isDead()) // Not dead yet
+ {
+ // Stuff into a sorted map so the display is ordered
+ sorted_avs[avatar->getFullname()] = avatar;
+ }
+ sort_iter++;
+ }
+
+ std::string trunc_name;
+ std::map<std::string, LLVOAvatar*>::reverse_iterator av_iter = sorted_avs.rbegin(); // Put "A" at the top
+ while (av_iter != sorted_avs.rend())
+ {
+ LLVOAvatar* avatar = av_iter->second;
+
+ avatar->calculateUpdateRenderComplexity(); // Make sure the numbers are up-to-date
+
+ trunc_name = utf8str_truncate(avatar->getFullname(), 16);
+ addText(xpos, ypos, llformat("%s : %s, complexity %d, area %.2f",
+ trunc_name.c_str(),
LLVOAvatar::rezStatusToString(avatar->getRezzedStatus()).c_str(),
- avatar->getVisualComplexity(),
- avatar->getAttachmentSurfaceArea()));
- ypos += y_inc;
- av_iter++;
- }
- }
- if (gSavedSettings.getBOOL("DebugShowRenderMatrices"))
- {
- char camera_lines[8][32];
- memset(camera_lines, ' ', sizeof(camera_lines));
-
- // Projection last column is always <0,0,-1.0001,0>
- // Projection last row is always <0,0,-0.2>
- mBackRectCamera1.mBottom = ypos - y_inc + 2;
- MATRIX_ROW_N32_TO_STR(gGLProjection, 12,camera_lines[7]); addText(xpos, ypos, std::string(camera_lines[7])); ypos += y_inc;
- MATRIX_ROW_N32_TO_STR(gGLProjection, 8,camera_lines[6]); addText(xpos, ypos, std::string(camera_lines[6])); ypos += y_inc;
- MATRIX_ROW_N32_TO_STR(gGLProjection, 4,camera_lines[5]); addText(xpos, ypos, std::string(camera_lines[5])); ypos += y_inc; mBackRectCamera1.mTop = ypos + 2;
- MATRIX_ROW_N32_TO_STR(gGLProjection, 0,camera_lines[4]); addText(xpos, ypos, std::string(camera_lines[4])); ypos += y_inc; mBackRectCamera2.mBottom = ypos + 2;
-
- addText(xpos, ypos, "Projection Matrix");
- ypos += y_inc;
-
- // View last column is always <0,0,0,1>
- MATRIX_ROW_F32_TO_STR(gGLModelView, 12,camera_lines[3]); addText(xpos, ypos, std::string(camera_lines[3])); ypos += y_inc;
- MATRIX_ROW_N32_TO_STR(gGLModelView, 8,camera_lines[2]); addText(xpos, ypos, std::string(camera_lines[2])); ypos += y_inc;
- MATRIX_ROW_N32_TO_STR(gGLModelView, 4,camera_lines[1]); addText(xpos, ypos, std::string(camera_lines[1])); ypos += y_inc; mBackRectCamera2.mTop = ypos + 2;
- MATRIX_ROW_N32_TO_STR(gGLModelView, 0,camera_lines[0]); addText(xpos, ypos, std::string(camera_lines[0])); ypos += y_inc;
-
- addText(xpos, ypos, "View Matrix");
- ypos += y_inc;
- }
- // disable use of glReadPixels which messes up nVidia nSight graphics debugging
+ avatar->getVisualComplexity(),
+ avatar->getAttachmentSurfaceArea()));
+ ypos += y_inc;
+ av_iter++;
+ }
+ }
+ if (gSavedSettings.getBOOL("DebugShowRenderMatrices"))
+ {
+ char camera_lines[8][32];
+ memset(camera_lines, ' ', sizeof(camera_lines));
+
+ // Projection last column is always <0,0,-1.0001,0>
+ // Projection last row is always <0,0,-0.2>
+ mBackRectCamera1.mBottom = ypos - y_inc + 2;
+ MATRIX_ROW_N32_TO_STR(gGLProjection, 12,camera_lines[7]); addText(xpos, ypos, std::string(camera_lines[7])); ypos += y_inc;
+ MATRIX_ROW_N32_TO_STR(gGLProjection, 8,camera_lines[6]); addText(xpos, ypos, std::string(camera_lines[6])); ypos += y_inc;
+ MATRIX_ROW_N32_TO_STR(gGLProjection, 4,camera_lines[5]); addText(xpos, ypos, std::string(camera_lines[5])); ypos += y_inc; mBackRectCamera1.mTop = ypos + 2;
+ MATRIX_ROW_N32_TO_STR(gGLProjection, 0,camera_lines[4]); addText(xpos, ypos, std::string(camera_lines[4])); ypos += y_inc; mBackRectCamera2.mBottom = ypos + 2;
+
+ addText(xpos, ypos, "Projection Matrix");
+ ypos += y_inc;
+
+ // View last column is always <0,0,0,1>
+ MATRIX_ROW_F32_TO_STR(gGLModelView, 12,camera_lines[3]); addText(xpos, ypos, std::string(camera_lines[3])); ypos += y_inc;
+ MATRIX_ROW_N32_TO_STR(gGLModelView, 8,camera_lines[2]); addText(xpos, ypos, std::string(camera_lines[2])); ypos += y_inc;
+ MATRIX_ROW_N32_TO_STR(gGLModelView, 4,camera_lines[1]); addText(xpos, ypos, std::string(camera_lines[1])); ypos += y_inc; mBackRectCamera2.mTop = ypos + 2;
+ MATRIX_ROW_N32_TO_STR(gGLModelView, 0,camera_lines[0]); addText(xpos, ypos, std::string(camera_lines[0])); ypos += y_inc;
+
+ addText(xpos, ypos, "View Matrix");
+ ypos += y_inc;
+ }
+ // disable use of glReadPixels which messes up nVidia nSight graphics debugging
if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport)
{
U8 color[4];
@@ -805,165 +805,165 @@ public:
// Convert x,y to raw pixel coords
S32 x_raw = llround(coord.mX * gViewerWindow->getWindowWidthRaw() / (F32) gViewerWindow->getWindowWidthScaled());
S32 y_raw = llround(coord.mY * gViewerWindow->getWindowHeightRaw() / (F32) gViewerWindow->getWindowHeightScaled());
-
+
glReadPixels(x_raw, y_raw, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
addText(xpos, ypos, llformat("Pixel <%1d, %1d> R:%1d G:%1d B:%1d A:%1d", x_raw, y_raw, color[0], color[1], color[2], color[3]));
ypos += y_inc;
}
// only display these messages if we are actually rendering beacons at this moment
- if (LLPipeline::getRenderBeacons() && LLFloaterReg::instanceVisible("beacons"))
- {
- if (LLPipeline::getRenderMOAPBeacons())
- {
- addText(xpos, ypos, "Viewing media beacons (white)");
- ypos += y_inc;
- }
-
- if (LLPipeline::toggleRenderTypeControlNegated(LLPipeline::RENDER_TYPE_PARTICLES))
- {
- addText(xpos, ypos, particle_hiding);
- ypos += y_inc;
- }
-
- if (LLPipeline::getRenderParticleBeacons())
- {
- addText(xpos, ypos, "Viewing particle beacons (blue)");
- ypos += y_inc;
- }
-
- if (LLPipeline::getRenderSoundBeacons())
- {
- addText(xpos, ypos, "Viewing sound beacons (yellow)");
- ypos += y_inc;
- }
-
- if (LLPipeline::getRenderScriptedBeacons())
- {
- addText(xpos, ypos, beacon_scripted);
- ypos += y_inc;
- }
- else
- if (LLPipeline::getRenderScriptedTouchBeacons())
- {
- addText(xpos, ypos, beacon_scripted_touch);
- ypos += y_inc;
- }
-
- if (LLPipeline::getRenderPhysicalBeacons())
- {
- addText(xpos, ypos, "Viewing physical object beacons (green)");
- ypos += y_inc;
- }
- }
-
- static LLUICachedControl<bool> show_sun_beacon("sunbeacon", false);
- static LLUICachedControl<bool> show_moon_beacon("moonbeacon", false);
-
- if (show_sun_beacon)
- {
- addText(xpos, ypos, beacon_sun);
- ypos += y_inc;
- }
- if (show_moon_beacon)
- {
- addText(xpos, ypos, beacon_moon);
- ypos += y_inc;
- }
-
- if(log_texture_traffic)
- {
- U32 old_y = ypos ;
- for(S32 i = LLViewerTexture::BOOST_NONE; i < LLViewerTexture::MAX_GL_IMAGE_CATEGORY; i++)
- {
- if(gTotalTextureBytesPerBoostLevel[i] > (S32Bytes)0)
- {
- addText(xpos, ypos, llformat("Boost_Level %d: %.3f MB", i, F32Megabytes(gTotalTextureBytesPerBoostLevel[i]).value()));
- ypos += y_inc;
- }
- }
- if(ypos != old_y)
- {
- addText(xpos, ypos, "Network traffic for textures:");
- ypos += y_inc;
- }
- }
-
- if (gSavedSettings.getBOOL("DebugShowTextureInfo"))
- {
- LLViewerObject* objectp = NULL ;
-
- LLSelectNode* nodep = LLSelectMgr::instance().getHoverNode();
- if (nodep)
- {
- objectp = nodep->getObject();
- }
-
- if (objectp && !objectp->isDead())
- {
- S32 num_faces = objectp->mDrawable->getNumFaces() ;
- std::set<LLViewerFetchedTexture*> tex_list;
-
- for(S32 i = 0 ; i < num_faces; i++)
- {
- LLFace* facep = objectp->mDrawable->getFace(i) ;
- if(facep)
- {
- LLViewerFetchedTexture* tex = dynamic_cast<LLViewerFetchedTexture*>(facep->getTexture()) ;
- if(tex)
- {
- if(tex_list.find(tex) != tex_list.end())
- {
- continue ; //already displayed.
- }
- tex_list.insert(tex);
-
- std::string uuid_str;
- tex->getID().toString(uuid_str);
- uuid_str = uuid_str.substr(0,7);
-
- addText(xpos, ypos, llformat("ID: %s v_size: %.3f", uuid_str.c_str(), tex->getMaxVirtualSize()));
- ypos += y_inc;
-
- addText(xpos, ypos, llformat("discard level: %d desired level: %d Missing: %s", tex->getDiscardLevel(),
- tex->getDesiredDiscardLevel(), tex->isMissingAsset() ? "Y" : "N"));
- ypos += y_inc;
- }
- }
- }
- }
- }
- }
-
- void draw()
- {
- LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT);
-
- // Camera matrix text is hard to see again a white background
- // Add a dark background underneath the matrices for readability (contrast)
- if (mBackRectCamera1.mTop >= 0)
- {
- mBackColor.setAlpha( 0.75f );
- gl_rect_2d(mBackRectCamera1, mBackColor, true);
-
- mBackColor.setAlpha( 0.66f );
- gl_rect_2d(mBackRectCamera2, mBackColor, true);
- }
-
- for (line_list_t::iterator iter = mLineList.begin();
- iter != mLineList.end(); ++iter)
- {
- const Line& line = *iter;
- LLFontGL::getFontMonospace()->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor,
- LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
- }
- }
+ if (LLPipeline::getRenderBeacons() && LLFloaterReg::instanceVisible("beacons"))
+ {
+ if (LLPipeline::getRenderMOAPBeacons())
+ {
+ addText(xpos, ypos, "Viewing media beacons (white)");
+ ypos += y_inc;
+ }
+
+ if (LLPipeline::toggleRenderTypeControlNegated(LLPipeline::RENDER_TYPE_PARTICLES))
+ {
+ addText(xpos, ypos, particle_hiding);
+ ypos += y_inc;
+ }
+
+ if (LLPipeline::getRenderParticleBeacons())
+ {
+ addText(xpos, ypos, "Viewing particle beacons (blue)");
+ ypos += y_inc;
+ }
+
+ if (LLPipeline::getRenderSoundBeacons())
+ {
+ addText(xpos, ypos, "Viewing sound beacons (yellow)");
+ ypos += y_inc;
+ }
+
+ if (LLPipeline::getRenderScriptedBeacons())
+ {
+ addText(xpos, ypos, beacon_scripted);
+ ypos += y_inc;
+ }
+ else
+ if (LLPipeline::getRenderScriptedTouchBeacons())
+ {
+ addText(xpos, ypos, beacon_scripted_touch);
+ ypos += y_inc;
+ }
+
+ if (LLPipeline::getRenderPhysicalBeacons())
+ {
+ addText(xpos, ypos, "Viewing physical object beacons (green)");
+ ypos += y_inc;
+ }
+ }
+
+ static LLUICachedControl<bool> show_sun_beacon("sunbeacon", false);
+ static LLUICachedControl<bool> show_moon_beacon("moonbeacon", false);
+
+ if (show_sun_beacon)
+ {
+ addText(xpos, ypos, beacon_sun);
+ ypos += y_inc;
+ }
+ if (show_moon_beacon)
+ {
+ addText(xpos, ypos, beacon_moon);
+ ypos += y_inc;
+ }
+
+ if(log_texture_traffic)
+ {
+ U32 old_y = ypos ;
+ for(S32 i = LLViewerTexture::BOOST_NONE; i < LLViewerTexture::MAX_GL_IMAGE_CATEGORY; i++)
+ {
+ if(gTotalTextureBytesPerBoostLevel[i] > (S32Bytes)0)
+ {
+ addText(xpos, ypos, llformat("Boost_Level %d: %.3f MB", i, F32Megabytes(gTotalTextureBytesPerBoostLevel[i]).value()));
+ ypos += y_inc;
+ }
+ }
+ if(ypos != old_y)
+ {
+ addText(xpos, ypos, "Network traffic for textures:");
+ ypos += y_inc;
+ }
+ }
+
+ if (gSavedSettings.getBOOL("DebugShowTextureInfo"))
+ {
+ LLViewerObject* objectp = NULL ;
+
+ LLSelectNode* nodep = LLSelectMgr::instance().getHoverNode();
+ if (nodep)
+ {
+ objectp = nodep->getObject();
+ }
+
+ if (objectp && !objectp->isDead())
+ {
+ S32 num_faces = objectp->mDrawable->getNumFaces() ;
+ std::set<LLViewerFetchedTexture*> tex_list;
+
+ for(S32 i = 0 ; i < num_faces; i++)
+ {
+ LLFace* facep = objectp->mDrawable->getFace(i) ;
+ if(facep)
+ {
+ LLViewerFetchedTexture* tex = dynamic_cast<LLViewerFetchedTexture*>(facep->getTexture()) ;
+ if(tex)
+ {
+ if(tex_list.find(tex) != tex_list.end())
+ {
+ continue ; //already displayed.
+ }
+ tex_list.insert(tex);
+
+ std::string uuid_str;
+ tex->getID().toString(uuid_str);
+ uuid_str = uuid_str.substr(0,7);
+
+ addText(xpos, ypos, llformat("ID: %s v_size: %.3f", uuid_str.c_str(), tex->getMaxVirtualSize()));
+ ypos += y_inc;
+
+ addText(xpos, ypos, llformat("discard level: %d desired level: %d Missing: %s", tex->getDiscardLevel(),
+ tex->getDesiredDiscardLevel(), tex->isMissingAsset() ? "Y" : "N"));
+ ypos += y_inc;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void draw()
+ {
+ LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT);
+
+ // Camera matrix text is hard to see again a white background
+ // Add a dark background underneath the matrices for readability (contrast)
+ if (mBackRectCamera1.mTop >= 0)
+ {
+ mBackColor.setAlpha( 0.75f );
+ gl_rect_2d(mBackRectCamera1, mBackColor, true);
+
+ mBackColor.setAlpha( 0.66f );
+ gl_rect_2d(mBackRectCamera2, mBackColor, true);
+ }
+
+ for (line_list_t::iterator iter = mLineList.begin();
+ iter != mLineList.end(); ++iter)
+ {
+ const Line& line = *iter;
+ LLFontGL::getFontMonospace()->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor,
+ LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
+ }
+ }
};
void LLViewerWindow::updateDebugText()
{
- mDebugText->update();
+ mDebugText->update();
}
////////////////////////////////////////////////////////////////////////////
@@ -972,16 +972,16 @@ void LLViewerWindow::updateDebugText()
//
LLViewerWindow::Params::Params()
-: title("title"),
- name("name"),
- x("x"),
- y("y"),
- width("width"),
- height("height"),
- min_width("min_width"),
- min_height("min_height"),
- fullscreen("fullscreen", false),
- ignore_pixel_depth("ignore_pixel_depth", false)
+: title("title"),
+ name("name"),
+ x("x"),
+ y("y"),
+ width("width"),
+ height("height"),
+ min_width("min_width"),
+ min_height("min_height"),
+ fullscreen("fullscreen", false),
+ ignore_pixel_depth("ignore_pixel_depth", false)
{}
@@ -998,167 +998,167 @@ void LLViewerWindow::handlePieMenu(S32 x, S32 y, MASK mask)
BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down, bool& is_toolmgr_action)
{
- const char* buttonname = "";
- const char* buttonstatestr = "";
- S32 x = pos.mX;
- S32 y = pos.mY;
- x = ll_round((F32)x / mDisplayScale.mV[VX]);
- y = ll_round((F32)y / mDisplayScale.mV[VY]);
+ const char* buttonname = "";
+ const char* buttonstatestr = "";
+ S32 x = pos.mX;
+ S32 y = pos.mY;
+ x = ll_round((F32)x / mDisplayScale.mV[VX]);
+ y = ll_round((F32)y / mDisplayScale.mV[VY]);
- // Handle non-consuming global keybindings, like voice
+ // Handle non-consuming global keybindings, like voice
gViewerInput.handleGlobalBindsMouse(clicktype, mask, down);
- // only send mouse clicks to UI if UI is visible
- if(gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
- {
-
- if (down)
- {
- buttonstatestr = "down" ;
- }
- else
- {
- buttonstatestr = "up" ;
- }
-
- switch (clicktype)
- {
- case CLICK_LEFT:
- mLeftMouseDown = down;
- buttonname = "Left";
- break;
- case CLICK_RIGHT:
- mRightMouseDown = down;
- buttonname = "Right";
- break;
- case CLICK_MIDDLE:
- mMiddleMouseDown = down;
- buttonname = "Middle";
- break;
- case CLICK_DOUBLELEFT:
- mLeftMouseDown = down;
- buttonname = "Left Double Click";
- break;
- case CLICK_BUTTON4:
- buttonname = "Button 4";
- break;
- case CLICK_BUTTON5:
- buttonname = "Button 5";
- break;
- default:
- break; // COUNT and NONE
- }
-
- LLView::sMouseHandlerMessage.clear();
-
- if (gMenuBarView)
- {
- // stop ALT-key access to menu
- gMenuBarView->resetMenuTrigger();
- }
-
- if (gDebugClicks)
- {
- LL_INFOS() << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << LL_ENDL;
- }
-
- // Make sure we get a corresponding mouseup event, even if the mouse leaves the window
- if (down)
- mWindow->captureMouse();
- else
- mWindow->releaseMouse();
-
- // Indicate mouse was active
- LLUI::getInstance()->resetMouseIdleTimer();
-
- // Don't let the user move the mouse out of the window until mouse up.
- if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
- {
- mWindow->setMouseClipping(down);
- }
-
- LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
- if( mouse_captor )
- {
- S32 local_x;
- S32 local_y;
- mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
- if (LLView::sDebugMouseHandling)
- {
- LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << LL_ENDL;
- }
-
- BOOL r = mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down);
- if (r) {
-
- LL_DEBUGS() << "LLViewerWindow::handleAnyMouseClick viewer with mousecaptor calling updatemouseeventinfo - local_x|global x "<< local_x << " " << x << "local/global y " << local_y << " " << y << LL_ENDL;
-
- LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y);
- LLViewerEventRecorder::instance().logMouseEvent(std::string(buttonstatestr),std::string(buttonname));
-
- }
- else if (down && clicktype == CLICK_RIGHT)
- {
- handlePieMenu(x, y, mask);
- r = TRUE;
- }
- return r;
- }
-
- // Mark the click as handled and return if we aren't within the root view to avoid spurious bugs
- if( !mRootView->pointInView(x, y) )
- {
- return TRUE;
- }
- // Give the UI views a chance to process the click
-
- BOOL r= mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) ;
- if (r)
- {
-
- LL_DEBUGS() << "LLViewerWindow::handleAnyMouseClick calling updatemouseeventinfo - global x "<< " " << x << "global y " << y << "buttonstate: " << buttonstatestr << " buttonname " << buttonname << LL_ENDL;
-
- LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y);
-
- // Clear local coords - this was a click on root window so these are not needed
- // By not including them, this allows the test skeleton generation tool to be smarter when generating code
- // the code generator can be smarter because when local coords are present it can try the xui path with local coords
- // and fallback to global coordinates only if needed.
- // The drawback to this approach is sometimes a valid xui path will appear to work fine, but NOT interact with the UI element
- // (VITA support not implemented yet or not visible to VITA due to widget further up xui path not being visible to VITA)
- // For this reason it's best to provide hints where possible here by leaving out local coordinates
- LLViewerEventRecorder::instance().setMouseLocalCoords(-1,-1);
- LLViewerEventRecorder::instance().logMouseEvent(buttonstatestr,buttonname);
-
- if (LLView::sDebugMouseHandling)
- {
- LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " " << LLViewerEventRecorder::instance().get_xui() << LL_ENDL;
- }
- return TRUE;
- } else if (LLView::sDebugMouseHandling)
- {
- LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " not handled by view" << LL_ENDL;
- }
- }
-
- // Do not allow tool manager to handle mouseclicks if we have disconnected
- if(!gDisconnected && LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) )
- {
- LLViewerEventRecorder::instance().clear_xui();
+ // only send mouse clicks to UI if UI is visible
+ if(gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
+
+ if (down)
+ {
+ buttonstatestr = "down" ;
+ }
+ else
+ {
+ buttonstatestr = "up" ;
+ }
+
+ switch (clicktype)
+ {
+ case CLICK_LEFT:
+ mLeftMouseDown = down;
+ buttonname = "Left";
+ break;
+ case CLICK_RIGHT:
+ mRightMouseDown = down;
+ buttonname = "Right";
+ break;
+ case CLICK_MIDDLE:
+ mMiddleMouseDown = down;
+ buttonname = "Middle";
+ break;
+ case CLICK_DOUBLELEFT:
+ mLeftMouseDown = down;
+ buttonname = "Left Double Click";
+ break;
+ case CLICK_BUTTON4:
+ buttonname = "Button 4";
+ break;
+ case CLICK_BUTTON5:
+ buttonname = "Button 5";
+ break;
+ default:
+ break; // COUNT and NONE
+ }
+
+ LLView::sMouseHandlerMessage.clear();
+
+ if (gMenuBarView)
+ {
+ // stop ALT-key access to menu
+ gMenuBarView->resetMenuTrigger();
+ }
+
+ if (gDebugClicks)
+ {
+ LL_INFOS() << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << LL_ENDL;
+ }
+
+ // Make sure we get a corresponding mouseup event, even if the mouse leaves the window
+ if (down)
+ mWindow->captureMouse();
+ else
+ mWindow->releaseMouse();
+
+ // Indicate mouse was active
+ LLUI::getInstance()->resetMouseIdleTimer();
+
+ // Don't let the user move the mouse out of the window until mouse up.
+ if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
+ {
+ mWindow->setMouseClipping(down);
+ }
+
+ LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
+ if( mouse_captor )
+ {
+ S32 local_x;
+ S32 local_y;
+ mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
+ if (LLView::sDebugMouseHandling)
+ {
+ LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << LL_ENDL;
+ }
+
+ BOOL r = mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down);
+ if (r) {
+
+ LL_DEBUGS() << "LLViewerWindow::handleAnyMouseClick viewer with mousecaptor calling updatemouseeventinfo - local_x|global x "<< local_x << " " << x << "local/global y " << local_y << " " << y << LL_ENDL;
+
+ LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y);
+ LLViewerEventRecorder::instance().logMouseEvent(std::string(buttonstatestr),std::string(buttonname));
+
+ }
+ else if (down && clicktype == CLICK_RIGHT)
+ {
+ handlePieMenu(x, y, mask);
+ r = TRUE;
+ }
+ return r;
+ }
+
+ // Mark the click as handled and return if we aren't within the root view to avoid spurious bugs
+ if( !mRootView->pointInView(x, y) )
+ {
+ return TRUE;
+ }
+ // Give the UI views a chance to process the click
+
+ BOOL r= mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) ;
+ if (r)
+ {
+
+ LL_DEBUGS() << "LLViewerWindow::handleAnyMouseClick calling updatemouseeventinfo - global x "<< " " << x << "global y " << y << "buttonstate: " << buttonstatestr << " buttonname " << buttonname << LL_ENDL;
+
+ LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y);
+
+ // Clear local coords - this was a click on root window so these are not needed
+ // By not including them, this allows the test skeleton generation tool to be smarter when generating code
+ // the code generator can be smarter because when local coords are present it can try the xui path with local coords
+ // and fallback to global coordinates only if needed.
+ // The drawback to this approach is sometimes a valid xui path will appear to work fine, but NOT interact with the UI element
+ // (VITA support not implemented yet or not visible to VITA due to widget further up xui path not being visible to VITA)
+ // For this reason it's best to provide hints where possible here by leaving out local coordinates
+ LLViewerEventRecorder::instance().setMouseLocalCoords(-1,-1);
+ LLViewerEventRecorder::instance().logMouseEvent(buttonstatestr,buttonname);
+
+ if (LLView::sDebugMouseHandling)
+ {
+ LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " " << LLViewerEventRecorder::instance().get_xui() << LL_ENDL;
+ }
+ return TRUE;
+ } else if (LLView::sDebugMouseHandling)
+ {
+ LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " not handled by view" << LL_ENDL;
+ }
+ }
+
+ // Do not allow tool manager to handle mouseclicks if we have disconnected
+ if(!gDisconnected && LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) )
+ {
+ LLViewerEventRecorder::instance().clear_xui();
is_toolmgr_action = true;
- return TRUE;
- }
+ return TRUE;
+ }
- if (down && clicktype == CLICK_RIGHT)
- {
- handlePieMenu(x, y, mask);
- return TRUE;
- }
+ if (down && clicktype == CLICK_RIGHT)
+ {
+ handlePieMenu(x, y, mask);
+ return TRUE;
+ }
- // If we got this far on a down-click, it wasn't handled.
- // Up-clicks, though, are always handled as far as the OS is concerned.
- BOOL default_rtn = !down;
- return default_rtn;
+ // If we got this far on a down-click, it wasn't handled.
+ // Up-clicks, though, are always handled as far as the OS is concerned.
+ BOOL default_rtn = !down;
+ return default_rtn;
}
BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
@@ -1171,7 +1171,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
else
{
mMouseDownTimer.reset();
- }
+ }
BOOL down = TRUE;
//handleMouse() loops back to LLViewerWindow::handleAnyMouseClick
return gViewerInput.handleMouse(window, pos, mask, CLICK_LEFT, down);
@@ -1179,14 +1179,14 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask)
{
- // try handling as a double-click first, then a single-click if that
- // wasn't handled.
- BOOL down = TRUE;
- if (gViewerInput.handleMouse(window, pos, mask, CLICK_DOUBLELEFT, down))
- {
- return TRUE;
- }
- return handleMouseDown(window, pos, mask);
+ // try handling as a double-click first, then a single-click if that
+ // wasn't handled.
+ BOOL down = TRUE;
+ if (gViewerInput.handleMouse(window, pos, mask, CLICK_DOUBLELEFT, down))
+ {
+ return TRUE;
+ }
+ return handleMouseDown(window, pos, mask);
}
BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
@@ -1200,177 +1200,177 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
}
BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
{
- BOOL down = TRUE;
- return gViewerInput.handleMouse(window, pos, mask, CLICK_RIGHT, down);
+ BOOL down = TRUE;
+ return gViewerInput.handleMouse(window, pos, mask, CLICK_RIGHT, down);
}
BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
- BOOL down = FALSE;
- return gViewerInput.handleMouse(window, pos, mask, CLICK_RIGHT, down);
+ BOOL down = FALSE;
+ return gViewerInput.handleMouse(window, pos, mask, CLICK_RIGHT, down);
}
BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
{
- BOOL down = TRUE;
- gViewerInput.handleMouse(window, pos, mask, CLICK_MIDDLE, down);
-
- // Always handled as far as the OS is concerned.
- return TRUE;
+ BOOL down = TRUE;
+ gViewerInput.handleMouse(window, pos, mask, CLICK_MIDDLE, down);
+
+ // Always handled as far as the OS is concerned.
+ return TRUE;
}
LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data)
{
- LLWindowCallbacks::DragNDropResult result = LLWindowCallbacks::DND_NONE;
-
- const bool prim_media_dnd_enabled = gSavedSettings.getBOOL("PrimMediaDragNDrop");
- const bool slurl_dnd_enabled = gSavedSettings.getBOOL("SLURLDragNDrop");
-
- if ( prim_media_dnd_enabled || slurl_dnd_enabled )
- {
- switch(action)
- {
- // Much of the handling for these two cases is the same.
- case LLWindowCallbacks::DNDA_TRACK:
- case LLWindowCallbacks::DNDA_DROPPED:
- case LLWindowCallbacks::DNDA_START_TRACKING:
- {
- bool drop = (LLWindowCallbacks::DNDA_DROPPED == action);
-
- if (slurl_dnd_enabled)
- {
- LLSLURL dropped_slurl(data);
- if(dropped_slurl.isSpatial())
- {
- if (drop)
- {
- LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), LLCommandHandler::NAV_TYPE_CLICKED, NULL, true );
- return LLWindowCallbacks::DND_MOVE;
- }
- return LLWindowCallbacks::DND_COPY;
- }
- }
-
- if (prim_media_dnd_enabled)
- {
- LLPickInfo pick_info = pickImmediate( pos.mX, pos.mY,
- TRUE /* pick_transparent */,
+ LLWindowCallbacks::DragNDropResult result = LLWindowCallbacks::DND_NONE;
+
+ const bool prim_media_dnd_enabled = gSavedSettings.getBOOL("PrimMediaDragNDrop");
+ const bool slurl_dnd_enabled = gSavedSettings.getBOOL("SLURLDragNDrop");
+
+ if ( prim_media_dnd_enabled || slurl_dnd_enabled )
+ {
+ switch(action)
+ {
+ // Much of the handling for these two cases is the same.
+ case LLWindowCallbacks::DNDA_TRACK:
+ case LLWindowCallbacks::DNDA_DROPPED:
+ case LLWindowCallbacks::DNDA_START_TRACKING:
+ {
+ bool drop = (LLWindowCallbacks::DNDA_DROPPED == action);
+
+ if (slurl_dnd_enabled)
+ {
+ LLSLURL dropped_slurl(data);
+ if(dropped_slurl.isSpatial())
+ {
+ if (drop)
+ {
+ LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), LLCommandHandler::NAV_TYPE_CLICKED, NULL, true );
+ return LLWindowCallbacks::DND_MOVE;
+ }
+ return LLWindowCallbacks::DND_COPY;
+ }
+ }
+
+ if (prim_media_dnd_enabled)
+ {
+ LLPickInfo pick_info = pickImmediate( pos.mX, pos.mY,
+ TRUE /* pick_transparent */,
FALSE /* pick_rigged */);
- S32 object_face = pick_info.mObjectFace;
- std::string url = data;
-
- LL_DEBUGS() << "Object: picked at " << pos.mX << ", " << pos.mY << " - face = " << object_face << " - URL = " << url << LL_ENDL;
-
- LLVOVolume *obj = dynamic_cast<LLVOVolume*>(static_cast<LLViewerObject*>(pick_info.getObject()));
-
- if (obj && !obj->getRegion()->getCapability("ObjectMedia").empty())
- {
- LLTextureEntry *te = obj->getTE(object_face);
-
- // can modify URL if we can modify the object or we have navigate permissions
- bool allow_modify_url = obj->permModify() || obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT );
-
- if (te && allow_modify_url )
- {
- if (drop)
- {
- // object does NOT have media already
- if ( ! te->hasMedia() )
- {
- // we are allowed to modify the object
- if ( obj->permModify() )
- {
- // Create new media entry
- LLSD media_data;
- // XXX Should we really do Home URL too?
- media_data[LLMediaEntry::HOME_URL_KEY] = url;
- media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
- media_data[LLMediaEntry::AUTO_PLAY_KEY] = true;
- obj->syncMediaData(object_face, media_data, true, true);
- // XXX This shouldn't be necessary, should it ?!?
- if (obj->getMediaImpl(object_face))
- obj->getMediaImpl(object_face)->navigateReload();
- obj->sendMediaDataUpdate();
-
- result = LLWindowCallbacks::DND_COPY;
- }
- }
- else
- // object HAS media already
- {
- // URL passes the whitelist
- if (te->getMediaData()->checkCandidateUrl( url ) )
- {
- // just navigate to the URL
- if (obj->getMediaImpl(object_face))
- {
- obj->getMediaImpl(object_face)->navigateTo(url);
- }
- else
- {
- // This is very strange. Navigation should
- // happen via the Impl, but we don't have one.
- // This sends it to the server, which /should/
- // trigger us getting it. Hopefully.
- LLSD media_data;
- media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
- obj->syncMediaData(object_face, media_data, true, true);
- obj->sendMediaDataUpdate();
- }
- result = LLWindowCallbacks::DND_LINK;
-
- }
- }
- LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
- mDragHoveredObject = NULL;
-
- }
- else
- {
- // Check the whitelist, if there's media (otherwise just show it)
- if (te->getMediaData() == NULL || te->getMediaData()->checkCandidateUrl(url))
- {
- if ( obj != mDragHoveredObject)
- {
- // Highlight the dragged object
- LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
- mDragHoveredObject = obj;
- LLSelectMgr::getInstance()->highlightObjectOnly(mDragHoveredObject);
- }
- result = (! te->hasMedia()) ? LLWindowCallbacks::DND_COPY : LLWindowCallbacks::DND_LINK;
-
- }
- }
- }
- }
- }
- }
- break;
-
- case LLWindowCallbacks::DNDA_STOP_TRACKING:
- // The cleanup case below will make sure things are unhilighted if necessary.
- break;
- }
-
- if (prim_media_dnd_enabled &&
- result == LLWindowCallbacks::DND_NONE && !mDragHoveredObject.isNull())
- {
- LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
- mDragHoveredObject = NULL;
- }
- }
-
- return result;
+ S32 object_face = pick_info.mObjectFace;
+ std::string url = data;
+
+ LL_DEBUGS() << "Object: picked at " << pos.mX << ", " << pos.mY << " - face = " << object_face << " - URL = " << url << LL_ENDL;
+
+ LLVOVolume *obj = dynamic_cast<LLVOVolume*>(static_cast<LLViewerObject*>(pick_info.getObject()));
+
+ if (obj && !obj->getRegion()->getCapability("ObjectMedia").empty())
+ {
+ LLTextureEntry *te = obj->getTE(object_face);
+
+ // can modify URL if we can modify the object or we have navigate permissions
+ bool allow_modify_url = obj->permModify() || obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT );
+
+ if (te && allow_modify_url )
+ {
+ if (drop)
+ {
+ // object does NOT have media already
+ if ( ! te->hasMedia() )
+ {
+ // we are allowed to modify the object
+ if ( obj->permModify() )
+ {
+ // Create new media entry
+ LLSD media_data;
+ // XXX Should we really do Home URL too?
+ media_data[LLMediaEntry::HOME_URL_KEY] = url;
+ media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
+ media_data[LLMediaEntry::AUTO_PLAY_KEY] = true;
+ obj->syncMediaData(object_face, media_data, true, true);
+ // XXX This shouldn't be necessary, should it ?!?
+ if (obj->getMediaImpl(object_face))
+ obj->getMediaImpl(object_face)->navigateReload();
+ obj->sendMediaDataUpdate();
+
+ result = LLWindowCallbacks::DND_COPY;
+ }
+ }
+ else
+ // object HAS media already
+ {
+ // URL passes the whitelist
+ if (te->getMediaData()->checkCandidateUrl( url ) )
+ {
+ // just navigate to the URL
+ if (obj->getMediaImpl(object_face))
+ {
+ obj->getMediaImpl(object_face)->navigateTo(url);
+ }
+ else
+ {
+ // This is very strange. Navigation should
+ // happen via the Impl, but we don't have one.
+ // This sends it to the server, which /should/
+ // trigger us getting it. Hopefully.
+ LLSD media_data;
+ media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
+ obj->syncMediaData(object_face, media_data, true, true);
+ obj->sendMediaDataUpdate();
+ }
+ result = LLWindowCallbacks::DND_LINK;
+
+ }
+ }
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
+ mDragHoveredObject = NULL;
+
+ }
+ else
+ {
+ // Check the whitelist, if there's media (otherwise just show it)
+ if (te->getMediaData() == NULL || te->getMediaData()->checkCandidateUrl(url))
+ {
+ if ( obj != mDragHoveredObject)
+ {
+ // Highlight the dragged object
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
+ mDragHoveredObject = obj;
+ LLSelectMgr::getInstance()->highlightObjectOnly(mDragHoveredObject);
+ }
+ result = (! te->hasMedia()) ? LLWindowCallbacks::DND_COPY : LLWindowCallbacks::DND_LINK;
+
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case LLWindowCallbacks::DNDA_STOP_TRACKING:
+ // The cleanup case below will make sure things are unhilighted if necessary.
+ break;
+ }
+
+ if (prim_media_dnd_enabled &&
+ result == LLWindowCallbacks::DND_NONE && !mDragHoveredObject.isNull())
+ {
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
+ mDragHoveredObject = NULL;
+ }
+ }
+
+ return result;
}
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
- BOOL down = FALSE;
- gViewerInput.handleMouse(window, pos, mask, CLICK_MIDDLE, down);
-
- // Always handled as far as the OS is concerned.
- return TRUE;
+ BOOL down = FALSE;
+ gViewerInput.handleMouse(window, pos, mask, CLICK_MIDDLE, down);
+
+ // Always handled as far as the OS is concerned.
+ return TRUE;
}
BOOL LLViewerWindow::handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down)
@@ -1404,32 +1404,32 @@ BOOL LLViewerWindow::handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK ma
// WARNING: this is potentially called multiple times per frame
void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask)
{
- S32 x = pos.mX;
- S32 y = pos.mY;
+ S32 x = pos.mX;
+ S32 y = pos.mY;
- x = ll_round((F32)x / mDisplayScale.mV[VX]);
- y = ll_round((F32)y / mDisplayScale.mV[VY]);
+ x = ll_round((F32)x / mDisplayScale.mV[VX]);
+ y = ll_round((F32)y / mDisplayScale.mV[VY]);
- mMouseInWindow = TRUE;
+ mMouseInWindow = TRUE;
- // Save mouse point for access during idle() and display()
+ // Save mouse point for access during idle() and display()
- LLCoordGL mouse_point(x, y);
+ LLCoordGL mouse_point(x, y);
- if (mouse_point != mCurrentMousePoint)
- {
- LLUI::getInstance()->resetMouseIdleTimer();
- }
+ if (mouse_point != mCurrentMousePoint)
+ {
+ LLUI::getInstance()->resetMouseIdleTimer();
+ }
- saveLastMouse(mouse_point);
+ saveLastMouse(mouse_point);
- mWindow->showCursorFromMouseMove();
+ mWindow->showCursorFromMouseMove();
- if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME
- && !gDisconnected)
- {
- gAgent.clearAFK();
- }
+ if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME
+ && !gDisconnected)
+ {
+ gAgent.clearAFK();
+ }
}
void LLViewerWindow::handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask)
@@ -1450,114 +1450,114 @@ void LLViewerWindow::handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK m
void LLViewerWindow::handleMouseLeave(LLWindow *window)
{
- // Note: we won't get this if we have captured the mouse.
- llassert( gFocusMgr.getMouseCapture() == NULL );
- mMouseInWindow = FALSE;
- LLToolTipMgr::instance().blockToolTips();
+ // Note: we won't get this if we have captured the mouse.
+ llassert( gFocusMgr.getMouseCapture() == NULL );
+ mMouseInWindow = FALSE;
+ LLToolTipMgr::instance().blockToolTips();
}
BOOL LLViewerWindow::handleCloseRequest(LLWindow *window)
{
- // User has indicated they want to close, but we may need to ask
- // about modified documents.
- LLAppViewer::instance()->userQuit();
- // Don't quit immediately
- return FALSE;
+ // User has indicated they want to close, but we may need to ask
+ // about modified documents.
+ LLAppViewer::instance()->userQuit();
+ // Don't quit immediately
+ return FALSE;
}
void LLViewerWindow::handleQuit(LLWindow *window)
{
- if (gNonInteractive)
- {
- LLAppViewer::instance()->requestQuit();
- }
- else
- {
- LL_INFOS() << "Window forced quit" << LL_ENDL;
- LLAppViewer::instance()->forceQuit();
- }
+ if (gNonInteractive)
+ {
+ LLAppViewer::instance()->requestQuit();
+ }
+ else
+ {
+ LL_INFOS() << "Window forced quit" << LL_ENDL;
+ LLAppViewer::instance()->forceQuit();
+ }
}
void LLViewerWindow::handleResize(LLWindow *window, S32 width, S32 height)
{
- reshape(width, height);
- mResDirty = true;
+ reshape(width, height);
+ mResDirty = true;
}
// The top-level window has gained focus (e.g. via ALT-TAB)
void LLViewerWindow::handleFocus(LLWindow *window)
{
- gFocusMgr.setAppHasFocus(TRUE);
- LLModalDialog::onAppFocusGained();
+ gFocusMgr.setAppHasFocus(TRUE);
+ LLModalDialog::onAppFocusGained();
- gAgent.onAppFocusGained();
- LLToolMgr::getInstance()->onAppFocusGained();
+ gAgent.onAppFocusGained();
+ LLToolMgr::getInstance()->onAppFocusGained();
- // See if we're coming in with modifier keys held down
- if (gKeyboard)
- {
- gKeyboard->resetMaskKeys();
- }
+ // See if we're coming in with modifier keys held down
+ if (gKeyboard)
+ {
+ gKeyboard->resetMaskKeys();
+ }
- // resume foreground running timer
- // since we artifically limit framerate when not frontmost
- gForegroundTime.unpause();
+ // resume foreground running timer
+ // since we artifically limit framerate when not frontmost
+ gForegroundTime.unpause();
}
// The top-level window has lost focus (e.g. via ALT-TAB)
void LLViewerWindow::handleFocusLost(LLWindow *window)
{
- gFocusMgr.setAppHasFocus(FALSE);
- //LLModalDialog::onAppFocusLost();
- LLToolMgr::getInstance()->onAppFocusLost();
- gFocusMgr.setMouseCapture( NULL );
+ gFocusMgr.setAppHasFocus(FALSE);
+ //LLModalDialog::onAppFocusLost();
+ LLToolMgr::getInstance()->onAppFocusLost();
+ gFocusMgr.setMouseCapture( NULL );
- if (gMenuBarView)
- {
- // stop ALT-key access to menu
- gMenuBarView->resetMenuTrigger();
- }
+ if (gMenuBarView)
+ {
+ // stop ALT-key access to menu
+ gMenuBarView->resetMenuTrigger();
+ }
- // restore mouse cursor
- showCursor();
- getWindow()->setMouseClipping(FALSE);
+ // restore mouse cursor
+ showCursor();
+ getWindow()->setMouseClipping(FALSE);
- // If losing focus while keys are down, handle them as
+ // If losing focus while keys are down, handle them as
// an 'up' to correctly release states, then reset states
- if (gKeyboard)
- {
+ if (gKeyboard)
+ {
gKeyboard->resetKeyDownAndHandle();
- gKeyboard->resetKeys();
- }
+ gKeyboard->resetKeys();
+ }
- // pause timer that tracks total foreground running time
- gForegroundTime.pause();
+ // pause timer that tracks total foreground running time
+ gForegroundTime.pause();
}
BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
{
- // Handle non-consuming global keybindings, like voice
+ // Handle non-consuming global keybindings, like voice
// Never affects event processing.
gViewerInput.handleGlobalBindsKeyDown(key, mask);
- if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
- {
- gAgent.clearAFK();
- }
-
- // *NOTE: We want to interpret KEY_RETURN later when it arrives as
- // a Unicode char, not as a keydown. Otherwise when client frame
- // rate is really low, hitting return sends your chat text before
- // it's all entered/processed.
- if (key == KEY_RETURN && mask == MASK_NONE)
- {
+ if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
+ {
+ gAgent.clearAFK();
+ }
+
+ // *NOTE: We want to interpret KEY_RETURN later when it arrives as
+ // a Unicode char, not as a keydown. Otherwise when client frame
+ // rate is really low, hitting return sends your chat text before
+ // it's all entered/processed.
+ if (key == KEY_RETURN && mask == MASK_NONE)
+ {
// RIDER: although, at times some of the controlls (in particular the CEF viewer
// would like to know about the KEYDOWN for an enter key... so ask and pass it along.
LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
if (keyboard_focus && !keyboard_focus->wantsReturnKey())
- return FALSE;
- }
+ return FALSE;
+ }
// remaps, handles ignored cases and returns back to viewer window.
return gViewerInput.handleKey(key, mask, repeated);
@@ -1565,25 +1565,25 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask)
{
- // Handle non-consuming global keybindings, like voice
+ // Handle non-consuming global keybindings, like voice
// Never affects event processing.
gViewerInput.handleGlobalBindsKeyUp(key, mask);
- // Let the inspect tool code check for ALT key to set LLToolSelectRect active instead LLToolCamera
- LLToolCompInspect * tool_inspectp = LLToolCompInspect::getInstance();
- if (LLToolMgr::getInstance()->getCurrentTool() == tool_inspectp)
- {
- tool_inspectp->keyUp(key, mask);
- }
+ // Let the inspect tool code check for ALT key to set LLToolSelectRect active instead LLToolCamera
+ LLToolCompInspect * tool_inspectp = LLToolCompInspect::getInstance();
+ if (LLToolMgr::getInstance()->getCurrentTool() == tool_inspectp)
+ {
+ tool_inspectp->keyUp(key, mask);
+ }
- return gViewerInput.handleKeyUp(key, mask);
+ return gViewerInput.handleKeyUp(key, mask);
}
void LLViewerWindow::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level)
{
- LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true);
- gViewerInput.scanKey(key, key_down, key_up, key_level);
- return; // Be clear this function returns nothing
+ LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true);
+ gViewerInput.scanKey(key, key_down, key_up, key_level);
+ return; // Be clear this function returns nothing
}
@@ -1591,45 +1591,45 @@ void LLViewerWindow::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key
BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
{
- if (activated)
- {
- mActive = true;
- send_agent_resume();
- gAgent.clearAFK();
-
- // Unmute audio
- audio_update_volume();
- }
- else
- {
- mActive = false;
-
- // if the user has chosen to go Away automatically after some time, then go Away when minimizing
- if (gSavedSettings.getS32("AFKTimeout"))
- {
- gAgent.setAFK();
- }
-
- // SL-53351: Make sure we're not in mouselook when minimised, to prevent control issues
- if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
- {
- gAgentCamera.changeCameraToDefault();
- }
-
- send_agent_pause();
-
- // Mute audio
- audio_update_volume();
- }
- return TRUE;
+ if (activated)
+ {
+ mActive = true;
+ send_agent_resume();
+ gAgent.clearAFK();
+
+ // Unmute audio
+ audio_update_volume();
+ }
+ else
+ {
+ mActive = false;
+
+ // if the user has chosen to go Away automatically after some time, then go Away when minimizing
+ if (gSavedSettings.getS32("AFKTimeout"))
+ {
+ gAgent.setAFK();
+ }
+
+ // SL-53351: Make sure we're not in mouselook when minimised, to prevent control issues
+ if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
+ {
+ gAgentCamera.changeCameraToDefault();
+ }
+
+ send_agent_pause();
+
+ // Mute audio
+ audio_update_volume();
+ }
+ return TRUE;
}
BOOL LLViewerWindow::handleActivateApp(LLWindow *window, BOOL activating)
{
- //if (!activating) gAgentCamera.changeCameraToDefault();
+ //if (!activating) gAgentCamera.changeCameraToDefault();
- LLViewerJoystick::getInstance()->setNeedsReset(true);
- return FALSE;
+ LLViewerJoystick::getInstance()->setNeedsReset(true);
+ return FALSE;
}
@@ -1640,108 +1640,108 @@ void LLViewerWindow::handleMenuSelect(LLWindow *window, S32 menu_item)
BOOL LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height)
{
- // *TODO: Enable similar information output for other platforms? DK 2011-02-18
+ // *TODO: Enable similar information output for other platforms? DK 2011-02-18
#if LL_WINDOWS
- if (gHeadlessClient)
- {
- HWND window_handle = (HWND)window->getPlatformWindow();
- PAINTSTRUCT ps;
- HDC hdc;
-
- RECT wnd_rect;
- wnd_rect.left = 0;
- wnd_rect.top = 0;
- wnd_rect.bottom = 200;
- wnd_rect.right = 500;
-
- hdc = BeginPaint(window_handle, &ps);
- //SetBKColor(hdc, RGB(255, 255, 255));
- FillRect(hdc, &wnd_rect, CreateSolidBrush(RGB(255, 255, 255)));
-
- std::string temp_str;
- LLTrace::Recording& recording = LLViewerStats::instance().getRecording();
- temp_str = llformat( "FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", /* Flawfinder: ignore */
- recording.getPerSec(LLStatViewer::FPS), //mFPSStat.getMeanPerSec(),
- recording.getLastValue(LLStatViewer::SIM_PHYSICS_FPS),
- recording.getLastValue(LLStatViewer::SIM_TIME_DILATION));
- S32 len = temp_str.length();
- TextOutA(hdc, 0, 0, temp_str.c_str(), len);
-
-
- LLVector3d pos_global = gAgent.getPositionGlobal();
- temp_str = llformat( "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]);
- len = temp_str.length();
- TextOutA(hdc, 0, 25, temp_str.c_str(), len);
-
- TextOutA(hdc, 0, 50, "Set \"HeadlessClient FALSE\" in settings.ini file to reenable", 61);
- EndPaint(window_handle, &ps);
- return TRUE;
- }
+ if (gHeadlessClient)
+ {
+ HWND window_handle = (HWND)window->getPlatformWindow();
+ PAINTSTRUCT ps;
+ HDC hdc;
+
+ RECT wnd_rect;
+ wnd_rect.left = 0;
+ wnd_rect.top = 0;
+ wnd_rect.bottom = 200;
+ wnd_rect.right = 500;
+
+ hdc = BeginPaint(window_handle, &ps);
+ //SetBKColor(hdc, RGB(255, 255, 255));
+ FillRect(hdc, &wnd_rect, CreateSolidBrush(RGB(255, 255, 255)));
+
+ std::string temp_str;
+ LLTrace::Recording& recording = LLViewerStats::instance().getRecording();
+ temp_str = llformat( "FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", /* Flawfinder: ignore */
+ recording.getPerSec(LLStatViewer::FPS), //mFPSStat.getMeanPerSec(),
+ recording.getLastValue(LLStatViewer::SIM_PHYSICS_FPS),
+ recording.getLastValue(LLStatViewer::SIM_TIME_DILATION));
+ S32 len = temp_str.length();
+ TextOutA(hdc, 0, 0, temp_str.c_str(), len);
+
+
+ LLVector3d pos_global = gAgent.getPositionGlobal();
+ temp_str = llformat( "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]);
+ len = temp_str.length();
+ TextOutA(hdc, 0, 25, temp_str.c_str(), len);
+
+ TextOutA(hdc, 0, 50, "Set \"HeadlessClient FALSE\" in settings.ini file to reenable", 61);
+ EndPaint(window_handle, &ps);
+ return TRUE;
+ }
#endif
- return FALSE;
+ return FALSE;
}
void LLViewerWindow::handleScrollWheel(LLWindow *window, S32 clicks)
{
- handleScrollWheel( clicks );
+ handleScrollWheel( clicks );
}
void LLViewerWindow::handleScrollHWheel(LLWindow *window, S32 clicks)
{
- handleScrollHWheel(clicks);
+ handleScrollHWheel(clicks);
}
void LLViewerWindow::handleWindowBlock(LLWindow *window)
{
- send_agent_pause();
+ send_agent_pause();
}
void LLViewerWindow::handleWindowUnblock(LLWindow *window)
{
- send_agent_resume();
+ send_agent_resume();
}
void LLViewerWindow::handleDataCopy(LLWindow *window, S32 data_type, void *data)
{
- const S32 SLURL_MESSAGE_TYPE = 0;
- switch (data_type)
- {
- case SLURL_MESSAGE_TYPE:
- // received URL
- std::string url = (const char*)data;
- LLMediaCtrl* web = NULL;
- const bool trusted_browser = false;
- // don't treat slapps coming from external browsers as "clicks" as this would bypass throttling
- if (LLURLDispatcher::dispatch(url, LLCommandHandler::NAV_TYPE_EXTERNAL, web, trusted_browser))
- {
- // bring window to foreground, as it has just been "launched" from a URL
- mWindow->bringToFront();
- }
- break;
- }
+ const S32 SLURL_MESSAGE_TYPE = 0;
+ switch (data_type)
+ {
+ case SLURL_MESSAGE_TYPE:
+ // received URL
+ std::string url = (const char*)data;
+ LLMediaCtrl* web = NULL;
+ const bool trusted_browser = false;
+ // don't treat slapps coming from external browsers as "clicks" as this would bypass throttling
+ if (LLURLDispatcher::dispatch(url, LLCommandHandler::NAV_TYPE_EXTERNAL, web, trusted_browser))
+ {
+ // bring window to foreground, as it has just been "launched" from a URL
+ mWindow->bringToFront();
+ }
+ break;
+ }
}
BOOL LLViewerWindow::handleTimerEvent(LLWindow *window)
{
//TODO: just call this every frame from gatherInput instead of using a convoluted 30fps timer callback
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- LLViewerJoystick::getInstance()->updateStatus();
- return TRUE;
- }
- return FALSE;
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ LLViewerJoystick::getInstance()->updateStatus();
+ return TRUE;
+ }
+ return FALSE;
}
BOOL LLViewerWindow::handleDeviceChange(LLWindow *window)
{
- // give a chance to use a joystick after startup (hot-plugging)
- if (!LLViewerJoystick::getInstance()->isJoystickInitialized() )
- {
- LLViewerJoystick::getInstance()->init(true);
- return TRUE;
- }
- return FALSE;
+ // give a chance to use a joystick after startup (hot-plugging)
+ if (!LLViewerJoystick::getInstance()->isJoystickInitialized() )
+ {
+ LLViewerJoystick::getInstance()->init(true);
+ return TRUE;
+ }
+ return FALSE;
}
BOOL LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height)
@@ -1761,157 +1761,157 @@ BOOL LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32
BOOL LLViewerWindow::handleWindowDidChangeScreen(LLWindow *window)
{
- LLCoordScreen window_rect;
- mWindow->getSize(&window_rect);
- reshape(window_rect.mX, window_rect.mY);
- return TRUE;
+ LLCoordScreen window_rect;
+ mWindow->getSize(&window_rect);
+ reshape(window_rect.mX, window_rect.mY);
+ return TRUE;
}
void LLViewerWindow::handlePingWatchdog(LLWindow *window, const char * msg)
{
- LLAppViewer::instance()->pingMainloopTimeout(msg);
+ LLAppViewer::instance()->pingMainloopTimeout(msg);
}
void LLViewerWindow::handleResumeWatchdog(LLWindow *window)
{
- LLAppViewer::instance()->resumeMainloopTimeout();
+ LLAppViewer::instance()->resumeMainloopTimeout();
}
void LLViewerWindow::handlePauseWatchdog(LLWindow *window)
{
- LLAppViewer::instance()->pauseMainloopTimeout();
+ LLAppViewer::instance()->pauseMainloopTimeout();
}
//virtual
std::string LLViewerWindow::translateString(const char* tag)
{
- return LLTrans::getString( std::string(tag) );
+ return LLTrans::getString( std::string(tag) );
}
//virtual
std::string LLViewerWindow::translateString(const char* tag,
- const std::map<std::string, std::string>& args)
-{
- // LLTrans uses a special subclass of std::string for format maps,
- // but we must use std::map<> in these callbacks, otherwise we create
- // a dependency between LLWindow and LLFormatMapString. So copy the data.
- LLStringUtil::format_map_t args_copy;
- std::map<std::string,std::string>::const_iterator it = args.begin();
- for ( ; it != args.end(); ++it)
- {
- args_copy[it->first] = it->second;
- }
- return LLTrans::getString( std::string(tag), args_copy);
+ const std::map<std::string, std::string>& args)
+{
+ // LLTrans uses a special subclass of std::string for format maps,
+ // but we must use std::map<> in these callbacks, otherwise we create
+ // a dependency between LLWindow and LLFormatMapString. So copy the data.
+ LLStringUtil::format_map_t args_copy;
+ std::map<std::string,std::string>::const_iterator it = args.begin();
+ for ( ; it != args.end(); ++it)
+ {
+ args_copy[it->first] = it->second;
+ }
+ return LLTrans::getString( std::string(tag), args_copy);
}
//
// Classes
//
LLViewerWindow::LLViewerWindow(const Params& p)
-: mWindow(NULL),
- mActive(true),
- mUIVisible(true),
- mWindowRectRaw(0, p.height, p.width, 0),
- mWindowRectScaled(0, p.height, p.width, 0),
- mWorldViewRectRaw(0, p.height, p.width, 0),
- mLeftMouseDown(FALSE),
- mMiddleMouseDown(FALSE),
- mRightMouseDown(FALSE),
- mMouseInWindow( FALSE ),
+: mWindow(NULL),
+ mActive(true),
+ mUIVisible(true),
+ mWindowRectRaw(0, p.height, p.width, 0),
+ mWindowRectScaled(0, p.height, p.width, 0),
+ mWorldViewRectRaw(0, p.height, p.width, 0),
+ mLeftMouseDown(FALSE),
+ mMiddleMouseDown(FALSE),
+ mRightMouseDown(FALSE),
+ mMouseInWindow( FALSE ),
mAllowMouseDragging(TRUE),
mMouseDownTimer(),
- mLastMask( MASK_NONE ),
- mToolStored( NULL ),
- mHideCursorPermanent( FALSE ),
- mCursorHidden(FALSE),
- mIgnoreActivate( FALSE ),
- mResDirty(false),
- mStatesDirty(false),
- mCurrResolutionIndex(0),
- mProgressView(NULL)
-{
- // gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
- // pass its value right now. Instead, pass it a nullary function that
- // will, when we later need it, return the value of gKeyboard.
- // boost::lambda::var() constructs such a functor on the fly.
- mWindowListener.reset(new LLWindowListener(this, boost::lambda::var(gKeyboard)));
- mViewerWindowListener.reset(new LLViewerWindowListener(this));
-
- mSystemChannel.reset(new LLNotificationChannel("System", "Visible", LLNotificationFilters::includeEverything));
- mCommunicationChannel.reset(new LLCommunicationChannel("Communication", "Visible"));
- mAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alerts", "alert"));
- mModalAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alertmodal", "alertmodal"));
-
- bool ignore = gSavedSettings.getBOOL("IgnoreAllNotifications");
- LLNotifications::instance().setIgnoreAllNotifications(ignore);
- if (ignore)
- {
- LL_INFOS() << "NOTE: ALL NOTIFICATIONS THAT OCCUR WILL GET ADDED TO IGNORE LIST FOR LATER RUNS." << LL_ENDL;
- }
-
-
- /*
- LLWindowCallbacks* callbacks,
- const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
- BOOL fullscreen,
- BOOL clearBg,
- BOOL disable_vsync,
- BOOL ignore_pixel_depth,
- U32 fsaa_samples)
- */
- // create window
+ mLastMask( MASK_NONE ),
+ mToolStored( NULL ),
+ mHideCursorPermanent( FALSE ),
+ mCursorHidden(FALSE),
+ mIgnoreActivate( FALSE ),
+ mResDirty(false),
+ mStatesDirty(false),
+ mCurrResolutionIndex(0),
+ mProgressView(NULL)
+{
+ // gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
+ // pass its value right now. Instead, pass it a nullary function that
+ // will, when we later need it, return the value of gKeyboard.
+ // boost::lambda::var() constructs such a functor on the fly.
+ mWindowListener.reset(new LLWindowListener(this, boost::lambda::var(gKeyboard)));
+ mViewerWindowListener.reset(new LLViewerWindowListener(this));
+
+ mSystemChannel.reset(new LLNotificationChannel("System", "Visible", LLNotificationFilters::includeEverything));
+ mCommunicationChannel.reset(new LLCommunicationChannel("Communication", "Visible"));
+ mAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alerts", "alert"));
+ mModalAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alertmodal", "alertmodal"));
+
+ bool ignore = gSavedSettings.getBOOL("IgnoreAllNotifications");
+ LLNotifications::instance().setIgnoreAllNotifications(ignore);
+ if (ignore)
+ {
+ LL_INFOS() << "NOTE: ALL NOTIFICATIONS THAT OCCUR WILL GET ADDED TO IGNORE LIST FOR LATER RUNS." << LL_ENDL;
+ }
+
+
+ /*
+ LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
+ BOOL fullscreen,
+ BOOL clearBg,
+ BOOL disable_vsync,
+ BOOL ignore_pixel_depth,
+ U32 fsaa_samples)
+ */
+ // create window
U32 max_core_count = gSavedSettings.getU32("EmulateCoreCount");
U32 max_vram = gSavedSettings.getU32("RenderMaxVRAMBudget");
F32 max_gl_version = gSavedSettings.getF32("RenderMaxOpenGLVersion");
-
- mWindow = LLWindowManager::createWindow(this,
- p.title, p.name, p.x, p.y, p.width, p.height, 0,
- p.fullscreen,
- gHeadlessClient,
- gSavedSettings.getBOOL("RenderVSyncEnable"),
- !gHeadlessClient,
- p.ignore_pixel_depth,
- 0,
+
+ mWindow = LLWindowManager::createWindow(this,
+ p.title, p.name, p.x, p.y, p.width, p.height, 0,
+ p.fullscreen,
+ gHeadlessClient,
+ gSavedSettings.getBOOL("RenderVSyncEnable"),
+ !gHeadlessClient,
+ p.ignore_pixel_depth,
+ 0,
max_core_count,
max_vram,
max_gl_version); //don't use window level anti-aliasing
- if (NULL == mWindow)
- {
- LLSplashScreen::update(LLTrans::getString("StartupRequireDriverUpdate"));
-
- LL_WARNS("Window") << "Failed to create window, to be shutting Down, be sure your graphics driver is updated." << LL_ENDL ;
+ if (NULL == mWindow)
+ {
+ LLSplashScreen::update(LLTrans::getString("StartupRequireDriverUpdate"));
+
+ LL_WARNS("Window") << "Failed to create window, to be shutting Down, be sure your graphics driver is updated." << LL_ENDL ;
- ms_sleep(5000) ; //wait for 5 seconds.
+ ms_sleep(5000) ; //wait for 5 seconds.
- LLSplashScreen::update(LLTrans::getString("ShuttingDown"));
+ LLSplashScreen::update(LLTrans::getString("ShuttingDown"));
#if LL_LINUX
- LL_WARNS() << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt for further information."
- << LL_ENDL;
+ LL_WARNS() << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt for further information."
+ << LL_ENDL;
#else
- LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings"
- << LL_ENDL;
+ LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings"
+ << LL_ENDL;
#endif
LLAppViewer::instance()->fastQuit(1);
- }
+ }
else if (!LLViewerShaderMgr::sInitialized)
{
//immediately initialize shaders
LLViewerShaderMgr::sInitialized = TRUE;
LLViewerShaderMgr::instance()->setShaders();
}
-
- if (!LLAppViewer::instance()->restoreErrorTrap())
- {
+
+ if (!LLAppViewer::instance()->restoreErrorTrap())
+ {
// this always happens, so downgrading it to INFO
- LL_INFOS("Window") << " Someone took over my signal/exception handler (post createWindow; normal)" << LL_ENDL;
- }
+ LL_INFOS("Window") << " Someone took over my signal/exception handler (post createWindow; normal)" << LL_ENDL;
+ }
- const bool do_not_enforce = false;
- mWindow->setMinSize(p.min_width, p.min_height, do_not_enforce); // root view not set
- LLCoordScreen scr;
+ const bool do_not_enforce = false;
+ mWindow->setMinSize(p.min_width, p.min_height, do_not_enforce); // root view not set
+ LLCoordScreen scr;
mWindow->getSize(&scr);
// Reset UI scale factor on first run if OS's display scaling is not 100%
@@ -1924,90 +1924,90 @@ LLViewerWindow::LLViewerWindow(const Params& p)
gSavedSettings.setBOOL("ResetUIScaleOnFirstRun", FALSE);
}
- // Get the real window rect the window was created with (since there are various OS-dependent reasons why
- // the size of a window or fullscreen context may have been adjusted slightly...)
- F32 ui_scale_factor = llclamp(gSavedSettings.getF32("UIScaleFactor") * mWindow->getSystemUISize(), MIN_UI_SCALE, MAX_UI_SCALE);
-
- mDisplayScale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f));
- mDisplayScale *= ui_scale_factor;
- LLUI::setScaleFactor(mDisplayScale);
-
- {
- LLCoordWindow size;
- mWindow->getSize(&size);
- mWindowRectRaw.set(0, size.mY, size.mX, 0);
- mWindowRectScaled.set(0, ll_round((F32)size.mY / mDisplayScale.mV[VY]), ll_round((F32)size.mX / mDisplayScale.mV[VX]), 0);
- }
-
- LLFontManager::initClass();
- // Init font system, load default fonts and generate basic glyphs
- // currently it takes aprox. 0.5 sec and we would load these fonts anyway
- // before login screen.
- LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
- mDisplayScale.mV[VX],
- mDisplayScale.mV[VY],
- gDirUtilp->getAppRODataDir());
-
- //
- // We want to set this stuff up BEFORE we initialize the pipeline, so we can turn off
- // stuff like AGP if we think that it'll crash the viewer.
- //
- LL_DEBUGS("Window") << "Loading feature tables." << LL_ENDL;
-
- // Initialize OpenGL Renderer
- LLVertexBuffer::initClass(mWindow);
- LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ;
- if (!gGL.init(true))
+ // Get the real window rect the window was created with (since there are various OS-dependent reasons why
+ // the size of a window or fullscreen context may have been adjusted slightly...)
+ F32 ui_scale_factor = llclamp(gSavedSettings.getF32("UIScaleFactor") * mWindow->getSystemUISize(), MIN_UI_SCALE, MAX_UI_SCALE);
+
+ mDisplayScale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f));
+ mDisplayScale *= ui_scale_factor;
+ LLUI::setScaleFactor(mDisplayScale);
+
+ {
+ LLCoordWindow size;
+ mWindow->getSize(&size);
+ mWindowRectRaw.set(0, size.mY, size.mX, 0);
+ mWindowRectScaled.set(0, ll_round((F32)size.mY / mDisplayScale.mV[VY]), ll_round((F32)size.mX / mDisplayScale.mV[VX]), 0);
+ }
+
+ LLFontManager::initClass();
+ // Init font system, load default fonts and generate basic glyphs
+ // currently it takes aprox. 0.5 sec and we would load these fonts anyway
+ // before login screen.
+ LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
+ mDisplayScale.mV[VX],
+ mDisplayScale.mV[VY],
+ gDirUtilp->getAppRODataDir());
+
+ //
+ // We want to set this stuff up BEFORE we initialize the pipeline, so we can turn off
+ // stuff like AGP if we think that it'll crash the viewer.
+ //
+ LL_DEBUGS("Window") << "Loading feature tables." << LL_ENDL;
+
+ // Initialize OpenGL Renderer
+ LLVertexBuffer::initClass(mWindow);
+ LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ;
+ if (!gGL.init(true))
{
LLError::LLUserWarningMsg::show(LLTrans::getString("MBVideoDrvErr"));
LL_ERRS() << "gGL not initialized" << LL_ENDL;
}
- if (LLFeatureManager::getInstance()->isSafe()
- || (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion())
- || (gSavedSettings.getString("LastGPUString") != LLFeatureManager::getInstance()->getGPUString())
- || (gSavedSettings.getBOOL("ProbeHardwareOnStartup")))
- {
- LLFeatureManager::getInstance()->applyRecommendedSettings();
- gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE);
- }
-
- // If we crashed while initializng GL stuff last time, disable certain features
- if (gSavedSettings.getBOOL("RenderInitError"))
- {
- mInitAlert = "DisplaySettingsNoShaders";
- LLFeatureManager::getInstance()->setGraphicsLevel(0, false);
- gSavedSettings.setU32("RenderQualityPerformance", 0);
- }
-
- // Init the image list. Must happen after GL is initialized and before the images that
- // LLViewerWindow needs are requested, as well as before LLViewerMedia starts updating images.
+ if (LLFeatureManager::getInstance()->isSafe()
+ || (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion())
+ || (gSavedSettings.getString("LastGPUString") != LLFeatureManager::getInstance()->getGPUString())
+ || (gSavedSettings.getBOOL("ProbeHardwareOnStartup")))
+ {
+ LLFeatureManager::getInstance()->applyRecommendedSettings();
+ gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE);
+ }
+
+ // If we crashed while initializng GL stuff last time, disable certain features
+ if (gSavedSettings.getBOOL("RenderInitError"))
+ {
+ mInitAlert = "DisplaySettingsNoShaders";
+ LLFeatureManager::getInstance()->setGraphicsLevel(0, false);
+ gSavedSettings.setU32("RenderQualityPerformance", 0);
+ }
+
+ // Init the image list. Must happen after GL is initialized and before the images that
+ // LLViewerWindow needs are requested, as well as before LLViewerMedia starts updating images.
LLImageGL::initClass(mWindow, LLViewerTexture::MAX_GL_IMAGE_CATEGORY, false, gSavedSettings.getBOOL("RenderGLMultiThreadedTextures"), gSavedSettings.getBOOL("RenderGLMultiThreadedMedia"));
- gTextureList.init();
- LLViewerTextureManager::init() ;
- gBumpImageList.init();
-
+ gTextureList.init();
+ LLViewerTextureManager::init() ;
+ gBumpImageList.init();
+
// Create container for all sub-views
- LLView::Params rvp;
- rvp.name("root");
- rvp.rect(mWindowRectScaled);
- rvp.mouse_opaque(false);
- rvp.follows.flags(FOLLOWS_NONE);
- mRootView = LLUICtrlFactory::create<LLRootView>(rvp);
- LLUI::getInstance()->setRootView(mRootView);
+ LLView::Params rvp;
+ rvp.name("root");
+ rvp.rect(mWindowRectScaled);
+ rvp.mouse_opaque(false);
+ rvp.follows.flags(FOLLOWS_NONE);
+ mRootView = LLUICtrlFactory::create<LLRootView>(rvp);
+ LLUI::getInstance()->setRootView(mRootView);
- // Make avatar head look forward at start
- mCurrentMousePoint.mX = getWindowWidthScaled() / 2;
- mCurrentMousePoint.mY = getWindowHeightScaled() / 2;
+ // Make avatar head look forward at start
+ mCurrentMousePoint.mX = getWindowWidthScaled() / 2;
+ mCurrentMousePoint.mY = getWindowHeightScaled() / 2;
- gShowOverlayTitle = gSavedSettings.getBOOL("ShowOverlayTitle");
- mOverlayTitle = gSavedSettings.getString("OverlayTitle");
- // Can't have spaces in settings.ini strings, so use underscores instead and convert them.
- LLStringUtil::replaceChar(mOverlayTitle, '_', ' ');
+ gShowOverlayTitle = gSavedSettings.getBOOL("ShowOverlayTitle");
+ mOverlayTitle = gSavedSettings.getString("OverlayTitle");
+ // Can't have spaces in settings.ini strings, so use underscores instead and convert them.
+ LLStringUtil::replaceChar(mOverlayTitle, '_', ' ');
- mDebugText = new LLDebugText(this);
+ mDebugText = new LLDebugText(this);
- mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale);
+ mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale);
}
std::string LLViewerWindow::getLastSnapshotDir()
@@ -2017,8 +2017,8 @@ std::string LLViewerWindow::getLastSnapshotDir()
void LLViewerWindow::initGLDefaults()
{
- // RN: Need this for translation and stretch manip.
- gBox.prerender();
+ // RN: Need this for translation and stretch manip.
+ gBox.prerender();
}
struct MainPanel : public LLPanel
@@ -2027,550 +2027,550 @@ struct MainPanel : public LLPanel
void LLViewerWindow::initBase()
{
- S32 height = getWindowHeightScaled();
- S32 width = getWindowWidthScaled();
+ S32 height = getWindowHeightScaled();
+ S32 width = getWindowWidthScaled();
- LLRect full_window(0, height, width, 0);
+ LLRect full_window(0, height, width, 0);
- ////////////////////
- //
- // Set the gamma
- //
+ ////////////////////
+ //
+ // Set the gamma
+ //
- F32 gamma = gSavedSettings.getF32("RenderGamma");
- if (gamma != 0.0f)
- {
- getWindow()->setGamma(gamma);
- }
+ F32 gamma = gSavedSettings.getF32("RenderGamma");
+ if (gamma != 0.0f)
+ {
+ getWindow()->setGamma(gamma);
+ }
- // Create global views
+ // Create global views
- // Login screen and main_view.xml need edit menus for preferences and browser
- LL_DEBUGS("AppInit") << "initializing edit menu" << LL_ENDL;
- initialize_edit_menu();
+ // Login screen and main_view.xml need edit menus for preferences and browser
+ LL_DEBUGS("AppInit") << "initializing edit menu" << LL_ENDL;
+ initialize_edit_menu();
LLFontGL::loadCommonFonts();
- // Create the floater view at the start so that other views can add children to it.
- // (But wait to add it as a child of the root view so that it will be in front of the
- // other views.)
- MainPanel* main_view = new MainPanel();
- if (!main_view->buildFromFile("main_view.xml"))
- {
- LL_ERRS() << "Failed to initialize viewer: Viewer couldn't process file main_view.xml, "
- << "if this problem happens again, please validate your installation." << LL_ENDL;
- }
- main_view->setShape(full_window);
- getRootView()->addChild(main_view);
-
- // placeholder widget that controls where "world" is rendered
- mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle();
- mPopupView = main_view->getChild<LLPopupView>("popup_holder");
- mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle();
- mLoginPanelHolder = main_view->getChild<LLView>("login_panel_holder")->getHandle();
-
- // Create the toolbar view
- // Get a pointer to the toolbar view holder
- LLPanel* panel_holder = main_view->getChild<LLPanel>("toolbar_view_holder");
- // Load the toolbar view from file
- gToolBarView = LLUICtrlFactory::getInstance()->createFromFile<LLToolBarView>("panel_toolbar_view.xml", panel_holder, LLDefaultChildRegistry::instance());
- if (!gToolBarView)
- {
- LL_ERRS() << "Failed to initialize viewer: Viewer couldn't process file panel_toolbar_view.xml, "
- << "if this problem happens again, please validate your installation." << LL_ENDL;
- }
- gToolBarView->setShape(panel_holder->getLocalRect());
- // Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI())
- gToolBarView->setVisible(FALSE);
-
- // Constrain floaters to inside the menu and status bar regions.
- gFloaterView = main_view->getChild<LLFloaterView>("Floater View");
- for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; ++i)
- {
- LLToolBar * toolbarp = gToolBarView->getToolbar((LLToolBarEnums::EToolBarLocation)i);
- if (toolbarp)
- {
- toolbarp->getCenterLayoutPanel()->setReshapeCallback(boost::bind(&LLFloaterView::setToolbarRect, gFloaterView, _1, _2));
- }
- }
- gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle());
- gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View");
-
- // Console
- llassert( !gConsole );
- LLConsole::Params cp;
- cp.name("console");
- cp.max_lines(gSavedSettings.getS32("ConsoleBufferSize"));
- cp.rect(getChatConsoleRect());
- cp.persist_time(gSavedSettings.getF32("ChatPersistTime"));
- cp.font_size_index(gSavedSettings.getS32("ChatFontSize"));
- cp.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM);
- gConsole = LLUICtrlFactory::create<LLConsole>(cp);
- getRootView()->addChild(gConsole);
-
- // optionally forward warnings to chat console/chat floater
- // for qa runs and dev builds
+ // Create the floater view at the start so that other views can add children to it.
+ // (But wait to add it as a child of the root view so that it will be in front of the
+ // other views.)
+ MainPanel* main_view = new MainPanel();
+ if (!main_view->buildFromFile("main_view.xml"))
+ {
+ LL_ERRS() << "Failed to initialize viewer: Viewer couldn't process file main_view.xml, "
+ << "if this problem happens again, please validate your installation." << LL_ENDL;
+ }
+ main_view->setShape(full_window);
+ getRootView()->addChild(main_view);
+
+ // placeholder widget that controls where "world" is rendered
+ mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle();
+ mPopupView = main_view->getChild<LLPopupView>("popup_holder");
+ mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle();
+ mLoginPanelHolder = main_view->getChild<LLView>("login_panel_holder")->getHandle();
+
+ // Create the toolbar view
+ // Get a pointer to the toolbar view holder
+ LLPanel* panel_holder = main_view->getChild<LLPanel>("toolbar_view_holder");
+ // Load the toolbar view from file
+ gToolBarView = LLUICtrlFactory::getInstance()->createFromFile<LLToolBarView>("panel_toolbar_view.xml", panel_holder, LLDefaultChildRegistry::instance());
+ if (!gToolBarView)
+ {
+ LL_ERRS() << "Failed to initialize viewer: Viewer couldn't process file panel_toolbar_view.xml, "
+ << "if this problem happens again, please validate your installation." << LL_ENDL;
+ }
+ gToolBarView->setShape(panel_holder->getLocalRect());
+ // Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI())
+ gToolBarView->setVisible(FALSE);
+
+ // Constrain floaters to inside the menu and status bar regions.
+ gFloaterView = main_view->getChild<LLFloaterView>("Floater View");
+ for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; ++i)
+ {
+ LLToolBar * toolbarp = gToolBarView->getToolbar((LLToolBarEnums::EToolBarLocation)i);
+ if (toolbarp)
+ {
+ toolbarp->getCenterLayoutPanel()->setReshapeCallback(boost::bind(&LLFloaterView::setToolbarRect, gFloaterView, _1, _2));
+ }
+ }
+ gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle());
+ gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View");
+
+ // Console
+ llassert( !gConsole );
+ LLConsole::Params cp;
+ cp.name("console");
+ cp.max_lines(gSavedSettings.getS32("ConsoleBufferSize"));
+ cp.rect(getChatConsoleRect());
+ cp.persist_time(gSavedSettings.getF32("ChatPersistTime"));
+ cp.font_size_index(gSavedSettings.getS32("ChatFontSize"));
+ cp.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM);
+ gConsole = LLUICtrlFactory::create<LLConsole>(cp);
+ getRootView()->addChild(gConsole);
+
+ // optionally forward warnings to chat console/chat floater
+ // for qa runs and dev builds
#if !LL_RELEASE_FOR_DOWNLOAD
- RecordToChatConsole::getInstance()->startRecorder();
+ RecordToChatConsole::getInstance()->startRecorder();
#else
- if(gSavedSettings.getBOOL("QAMode"))
- {
- RecordToChatConsole::getInstance()->startRecorder();
- }
+ if(gSavedSettings.getBOOL("QAMode"))
+ {
+ RecordToChatConsole::getInstance()->startRecorder();
+ }
#endif
- gDebugView = getRootView()->getChild<LLDebugView>("DebugView");
- gDebugView->init();
- gToolTipView = getRootView()->getChild<LLToolTipView>("tooltip view");
+ gDebugView = getRootView()->getChild<LLDebugView>("DebugView");
+ gDebugView->init();
+ gToolTipView = getRootView()->getChild<LLToolTipView>("tooltip view");
- // Initialize do not disturb response message when logged in
- LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLFloaterPreference::initDoNotDisturbResponse));
+ // Initialize do not disturb response message when logged in
+ LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLFloaterPreference::initDoNotDisturbResponse));
- // Add the progress bar view (startup view), which overrides everything
- mProgressView = getRootView()->findChild<LLProgressView>("progress_view");
- setShowProgress(FALSE);
- setProgressCancelButtonVisible(FALSE);
+ // Add the progress bar view (startup view), which overrides everything
+ mProgressView = getRootView()->findChild<LLProgressView>("progress_view");
+ setShowProgress(FALSE);
+ setProgressCancelButtonVisible(FALSE);
- gMenuHolder = getRootView()->getChild<LLViewerMenuHolderGL>("Menu Holder");
- LLMenuGL::sMenuContainer = gMenuHolder;
+ gMenuHolder = getRootView()->getChild<LLViewerMenuHolderGL>("Menu Holder");
+ LLMenuGL::sMenuContainer = gMenuHolder;
}
void LLViewerWindow::initWorldUI()
{
- if (gNonInteractive)
- {
- gIMMgr = LLIMMgr::getInstance();
- LLNavigationBar::getInstance();
- gFloaterView->pushVisibleAll(FALSE);
- return;
- }
-
- S32 height = mRootView->getRect().getHeight();
- S32 width = mRootView->getRect().getWidth();
- LLRect full_window(0, height, width, 0);
-
-
- gIMMgr = LLIMMgr::getInstance();
-
- //getRootView()->sendChildToFront(gFloaterView);
- //getRootView()->sendChildToFront(gSnapshotFloaterView);
-
- if (!gNonInteractive)
- {
- LLPanel* chiclet_container = getRootView()->getChild<LLPanel>("chiclet_container");
- LLChicletBar* chiclet_bar = LLChicletBar::getInstance();
- chiclet_bar->setShape(chiclet_container->getLocalRect());
- chiclet_bar->setFollowsAll();
- chiclet_container->addChild(chiclet_bar);
- chiclet_container->setVisible(TRUE);
- }
-
- LLRect morph_view_rect = full_window;
- morph_view_rect.stretch( -STATUS_BAR_HEIGHT );
- morph_view_rect.mTop = full_window.mTop - 32;
- LLMorphView::Params mvp;
- mvp.name("MorphView");
- mvp.rect(morph_view_rect);
- mvp.visible(false);
- gMorphView = LLUICtrlFactory::create<LLMorphView>(mvp);
- getRootView()->addChild(gMorphView);
-
- LLWorldMapView::initClass();
-
- // Force gFloaterWorldMap to initialize
- LLFloaterReg::getInstance("world_map");
-
- // Force gFloaterTools to initialize
- LLFloaterReg::getInstance("build");
-
- // Status bar
- LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container");
- gStatusBar = new LLStatusBar(status_bar_container->getLocalRect());
- gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_RIGHT);
- gStatusBar->setShape(status_bar_container->getLocalRect());
- // sync bg color with menu bar
- gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() );
+ if (gNonInteractive)
+ {
+ gIMMgr = LLIMMgr::getInstance();
+ LLNavigationBar::getInstance();
+ gFloaterView->pushVisibleAll(FALSE);
+ return;
+ }
+
+ S32 height = mRootView->getRect().getHeight();
+ S32 width = mRootView->getRect().getWidth();
+ LLRect full_window(0, height, width, 0);
+
+
+ gIMMgr = LLIMMgr::getInstance();
+
+ //getRootView()->sendChildToFront(gFloaterView);
+ //getRootView()->sendChildToFront(gSnapshotFloaterView);
+
+ if (!gNonInteractive)
+ {
+ LLPanel* chiclet_container = getRootView()->getChild<LLPanel>("chiclet_container");
+ LLChicletBar* chiclet_bar = LLChicletBar::getInstance();
+ chiclet_bar->setShape(chiclet_container->getLocalRect());
+ chiclet_bar->setFollowsAll();
+ chiclet_container->addChild(chiclet_bar);
+ chiclet_container->setVisible(TRUE);
+ }
+
+ LLRect morph_view_rect = full_window;
+ morph_view_rect.stretch( -STATUS_BAR_HEIGHT );
+ morph_view_rect.mTop = full_window.mTop - 32;
+ LLMorphView::Params mvp;
+ mvp.name("MorphView");
+ mvp.rect(morph_view_rect);
+ mvp.visible(false);
+ gMorphView = LLUICtrlFactory::create<LLMorphView>(mvp);
+ getRootView()->addChild(gMorphView);
+
+ LLWorldMapView::initClass();
+
+ // Force gFloaterWorldMap to initialize
+ LLFloaterReg::getInstance("world_map");
+
+ // Force gFloaterTools to initialize
+ LLFloaterReg::getInstance("build");
+
+ // Status bar
+ LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container");
+ gStatusBar = new LLStatusBar(status_bar_container->getLocalRect());
+ gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_RIGHT);
+ gStatusBar->setShape(status_bar_container->getLocalRect());
+ // sync bg color with menu bar
+ gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() );
// add InBack so that gStatusBar won't be drawn over menu
status_bar_container->addChildInBack(gStatusBar, 2/*tab order, after menu*/);
status_bar_container->setVisible(TRUE);
- // Navigation bar
- LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container");
+ // Navigation bar
+ LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container");
- LLNavigationBar* navbar = LLNavigationBar::getInstance();
- navbar->setShape(nav_bar_container->getLocalRect());
- navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get());
- nav_bar_container->addChild(navbar);
- nav_bar_container->setVisible(TRUE);
+ LLNavigationBar* navbar = LLNavigationBar::getInstance();
+ navbar->setShape(nav_bar_container->getLocalRect());
+ navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get());
+ nav_bar_container->addChild(navbar);
+ nav_bar_container->setVisible(TRUE);
- if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
- {
- navbar->setVisible(FALSE);
- }
+ if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
+ {
+ navbar->setVisible(FALSE);
+ }
else
{
reshapeStatusBarContainer();
}
- // Top Info bar
- LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container");
- LLPanelTopInfoBar* topinfo_bar = LLPanelTopInfoBar::getInstance();
-
- topinfo_bar->setShape(topinfo_bar_container->getLocalRect());
-
- topinfo_bar_container->addChild(topinfo_bar);
- topinfo_bar_container->setVisible(TRUE);
-
- if (!gSavedSettings.getBOOL("ShowMiniLocationPanel"))
- {
- topinfo_bar->setVisible(FALSE);
- }
-
- if ( gHUDView == NULL )
- {
- LLRect hud_rect = full_window;
- hud_rect.mBottom += 50;
- if (gMenuBarView && gMenuBarView->isInVisibleChain())
- {
- hud_rect.mTop -= gMenuBarView->getRect().getHeight();
- }
- gHUDView = new LLHUDView(hud_rect);
- getRootView()->addChild(gHUDView);
- getRootView()->sendChildToBack(gHUDView);
- }
-
- LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container");
-
- LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance();
- panel_ssf_container->addChild(panel_stand_stop_flying);
-
- LLPanelHideBeacon* panel_hide_beacon = LLPanelHideBeacon::getInstance();
- panel_ssf_container->addChild(panel_hide_beacon);
-
- panel_ssf_container->setVisible(TRUE);
-
- LLMenuOptionPathfindingRebakeNavmesh::getInstance()->initialize();
-
- // Load and make the toolbars visible
- // Note: we need to load the toolbars only *after* the user is logged in and IW
- if (gToolBarView)
- {
- gToolBarView->loadToolbars();
- gToolBarView->setVisible(TRUE);
- }
-
- if (!gNonInteractive)
- {
- LLMediaCtrl* destinations = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
- if (destinations)
- {
- destinations->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
- std::string url = gSavedSettings.getString("DestinationGuideURL");
- url = LLWeb::expandURLSubstitutions(url, LLSD());
- destinations->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
- }
- LLMediaCtrl* avatar_picker = LLFloaterReg::getInstance("avatar")->findChild<LLMediaCtrl>("avatar_picker_contents");
- if (avatar_picker)
- {
- avatar_picker->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
- std::string url = gSavedSettings.getString("AvatarPickerURL");
- url = LLWeb::expandURLSubstitutions(url, LLSD());
- avatar_picker->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
- }
- }
+ // Top Info bar
+ LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container");
+ LLPanelTopInfoBar* topinfo_bar = LLPanelTopInfoBar::getInstance();
+
+ topinfo_bar->setShape(topinfo_bar_container->getLocalRect());
+
+ topinfo_bar_container->addChild(topinfo_bar);
+ topinfo_bar_container->setVisible(TRUE);
+
+ if (!gSavedSettings.getBOOL("ShowMiniLocationPanel"))
+ {
+ topinfo_bar->setVisible(FALSE);
+ }
+
+ if ( gHUDView == NULL )
+ {
+ LLRect hud_rect = full_window;
+ hud_rect.mBottom += 50;
+ if (gMenuBarView && gMenuBarView->isInVisibleChain())
+ {
+ hud_rect.mTop -= gMenuBarView->getRect().getHeight();
+ }
+ gHUDView = new LLHUDView(hud_rect);
+ getRootView()->addChild(gHUDView);
+ getRootView()->sendChildToBack(gHUDView);
+ }
+
+ LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container");
+
+ LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance();
+ panel_ssf_container->addChild(panel_stand_stop_flying);
+
+ LLPanelHideBeacon* panel_hide_beacon = LLPanelHideBeacon::getInstance();
+ panel_ssf_container->addChild(panel_hide_beacon);
+
+ panel_ssf_container->setVisible(TRUE);
+
+ LLMenuOptionPathfindingRebakeNavmesh::getInstance()->initialize();
+
+ // Load and make the toolbars visible
+ // Note: we need to load the toolbars only *after* the user is logged in and IW
+ if (gToolBarView)
+ {
+ gToolBarView->loadToolbars();
+ gToolBarView->setVisible(TRUE);
+ }
+
+ if (!gNonInteractive)
+ {
+ LLMediaCtrl* destinations = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
+ if (destinations)
+ {
+ destinations->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
+ std::string url = gSavedSettings.getString("DestinationGuideURL");
+ url = LLWeb::expandURLSubstitutions(url, LLSD());
+ destinations->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
+ }
+ LLMediaCtrl* avatar_picker = LLFloaterReg::getInstance("avatar")->findChild<LLMediaCtrl>("avatar_picker_contents");
+ if (avatar_picker)
+ {
+ avatar_picker->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
+ std::string url = gSavedSettings.getString("AvatarPickerURL");
+ url = LLWeb::expandURLSubstitutions(url, LLSD());
+ avatar_picker->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
+ }
+ }
}
// Destroy the UI
void LLViewerWindow::shutdownViews()
{
- // clean up warning logger
- RecordToChatConsole::getInstance()->stopRecorder();
- LL_INFOS() << "Warning logger is cleaned." << LL_ENDL ;
-
- gFocusMgr.unlockFocus();
- gFocusMgr.setMouseCapture(NULL);
- gFocusMgr.setKeyboardFocus(NULL);
- gFocusMgr.setTopCtrl(NULL);
- if (mWindow)
- {
- mWindow->allowLanguageTextInput(NULL, FALSE);
- }
-
- delete mDebugText;
- mDebugText = NULL;
-
- LL_INFOS() << "DebugText deleted." << LL_ENDL ;
-
- // Cleanup global views
- if (gMorphView)
- {
- gMorphView->setVisible(FALSE);
- }
- LL_INFOS() << "Global views cleaned." << LL_ENDL ;
-
- LLNotificationsUI::LLToast::cleanupToasts();
- LL_INFOS() << "Leftover toast cleaned up." << LL_ENDL;
-
- // DEV-40930: Clear sModalStack. Otherwise, any LLModalDialog left open
- // will crump with LL_ERRS.
- LLModalDialog::shutdownModals();
- LL_INFOS() << "LLModalDialog shut down." << LL_ENDL;
-
- // destroy the nav bar, not currently part of gViewerWindow
- // *TODO: Make LLNavigationBar part of gViewerWindow
- LLNavigationBar::deleteSingleton();
- LL_INFOS() << "LLNavigationBar destroyed." << LL_ENDL ;
-
- // destroy menus after instantiating navbar above, as it needs
- // access to gMenuHolder
- cleanup_menus();
- LL_INFOS() << "menus destroyed." << LL_ENDL ;
-
- view_listener_t::cleanup();
- LL_INFOS() << "view listeners destroyed." << LL_ENDL ;
-
- // Clean up pointers that are going to be invalid. (todo: check sMenuContainer)
- mProgressView = NULL;
- mPopupView = NULL;
-
- // Delete all child views.
- delete mRootView;
- mRootView = NULL;
- LL_INFOS() << "RootView deleted." << LL_ENDL ;
-
- LLMenuOptionPathfindingRebakeNavmesh::getInstance()->quit();
-
- // Automatically deleted as children of mRootView. Fix the globals.
- gStatusBar = NULL;
- gIMMgr = NULL;
- gToolTipView = NULL;
-
- gToolBarView = NULL;
- gFloaterView = NULL;
- gMorphView = NULL;
-
- gHUDView = NULL;
+ // clean up warning logger
+ RecordToChatConsole::getInstance()->stopRecorder();
+ LL_INFOS() << "Warning logger is cleaned." << LL_ENDL ;
+
+ gFocusMgr.unlockFocus();
+ gFocusMgr.setMouseCapture(NULL);
+ gFocusMgr.setKeyboardFocus(NULL);
+ gFocusMgr.setTopCtrl(NULL);
+ if (mWindow)
+ {
+ mWindow->allowLanguageTextInput(NULL, FALSE);
+ }
+
+ delete mDebugText;
+ mDebugText = NULL;
+
+ LL_INFOS() << "DebugText deleted." << LL_ENDL ;
+
+ // Cleanup global views
+ if (gMorphView)
+ {
+ gMorphView->setVisible(FALSE);
+ }
+ LL_INFOS() << "Global views cleaned." << LL_ENDL ;
+
+ LLNotificationsUI::LLToast::cleanupToasts();
+ LL_INFOS() << "Leftover toast cleaned up." << LL_ENDL;
+
+ // DEV-40930: Clear sModalStack. Otherwise, any LLModalDialog left open
+ // will crump with LL_ERRS.
+ LLModalDialog::shutdownModals();
+ LL_INFOS() << "LLModalDialog shut down." << LL_ENDL;
+
+ // destroy the nav bar, not currently part of gViewerWindow
+ // *TODO: Make LLNavigationBar part of gViewerWindow
+ LLNavigationBar::deleteSingleton();
+ LL_INFOS() << "LLNavigationBar destroyed." << LL_ENDL ;
+
+ // destroy menus after instantiating navbar above, as it needs
+ // access to gMenuHolder
+ cleanup_menus();
+ LL_INFOS() << "menus destroyed." << LL_ENDL ;
+
+ view_listener_t::cleanup();
+ LL_INFOS() << "view listeners destroyed." << LL_ENDL ;
+
+ // Clean up pointers that are going to be invalid. (todo: check sMenuContainer)
+ mProgressView = NULL;
+ mPopupView = NULL;
+
+ // Delete all child views.
+ delete mRootView;
+ mRootView = NULL;
+ LL_INFOS() << "RootView deleted." << LL_ENDL ;
+
+ LLMenuOptionPathfindingRebakeNavmesh::getInstance()->quit();
+
+ // Automatically deleted as children of mRootView. Fix the globals.
+ gStatusBar = NULL;
+ gIMMgr = NULL;
+ gToolTipView = NULL;
+
+ gToolBarView = NULL;
+ gFloaterView = NULL;
+ gMorphView = NULL;
+
+ gHUDView = NULL;
}
void LLViewerWindow::shutdownGL()
{
- //--------------------------------------------------------
- // Shutdown GL cleanly. Order is very important here.
- //--------------------------------------------------------
- LLFontGL::destroyDefaultFonts();
- SUBSYSTEM_CLEANUP(LLFontManager);
- stop_glerror();
+ //--------------------------------------------------------
+ // Shutdown GL cleanly. Order is very important here.
+ //--------------------------------------------------------
+ LLFontGL::destroyDefaultFonts();
+ SUBSYSTEM_CLEANUP(LLFontManager);
+ stop_glerror();
- gSky.cleanup();
- stop_glerror();
+ gSky.cleanup();
+ stop_glerror();
+
+ LL_INFOS() << "Cleaning up pipeline" << LL_ENDL;
+ gPipeline.cleanup();
+ stop_glerror();
- LL_INFOS() << "Cleaning up pipeline" << LL_ENDL;
- gPipeline.cleanup();
- stop_glerror();
+ //MUST clean up pipeline before cleaning up wearables
+ LL_INFOS() << "Cleaning up wearables" << LL_ENDL;
+ LLWearableList::instance().cleanup() ;
- //MUST clean up pipeline before cleaning up wearables
- LL_INFOS() << "Cleaning up wearables" << LL_ENDL;
- LLWearableList::instance().cleanup() ;
+ gTextureList.shutdown();
+ stop_glerror();
- gTextureList.shutdown();
- stop_glerror();
+ gBumpImageList.shutdown();
+ stop_glerror();
- gBumpImageList.shutdown();
- stop_glerror();
+ LLWorldMapView::cleanupTextures();
- LLWorldMapView::cleanupTextures();
+ LLViewerTextureManager::cleanup() ;
+ SUBSYSTEM_CLEANUP(LLImageGL) ;
- LLViewerTextureManager::cleanup() ;
- SUBSYSTEM_CLEANUP(LLImageGL) ;
-
- LL_INFOS() << "All textures and llimagegl images are destroyed!" << LL_ENDL ;
+ LL_INFOS() << "All textures and llimagegl images are destroyed!" << LL_ENDL ;
- LL_INFOS() << "Cleaning up select manager" << LL_ENDL;
- LLSelectMgr::getInstance()->cleanup();
+ LL_INFOS() << "Cleaning up select manager" << LL_ENDL;
+ LLSelectMgr::getInstance()->cleanup();
- LL_INFOS() << "Stopping GL during shutdown" << LL_ENDL;
- stopGL(FALSE);
- stop_glerror();
+ LL_INFOS() << "Stopping GL during shutdown" << LL_ENDL;
+ stopGL(FALSE);
+ stop_glerror();
- gGL.shutdown();
+ gGL.shutdown();
- SUBSYSTEM_CLEANUP(LLVertexBuffer);
+ SUBSYSTEM_CLEANUP(LLVertexBuffer);
- LL_INFOS() << "LLVertexBuffer cleaned." << LL_ENDL ;
+ LL_INFOS() << "LLVertexBuffer cleaned." << LL_ENDL ;
}
// shutdownViews() and shutdownGL() need to be called first
LLViewerWindow::~LLViewerWindow()
{
- LL_INFOS() << "Destroying Window" << LL_ENDL;
- destroyWindow();
+ LL_INFOS() << "Destroying Window" << LL_ENDL;
+ destroyWindow();
- delete mDebugText;
- mDebugText = NULL;
+ delete mDebugText;
+ mDebugText = NULL;
- if (LLViewerShaderMgr::sInitialized)
- {
- LLViewerShaderMgr::releaseInstance();
- LLViewerShaderMgr::sInitialized = FALSE;
- }
+ if (LLViewerShaderMgr::sInitialized)
+ {
+ LLViewerShaderMgr::releaseInstance();
+ LLViewerShaderMgr::sInitialized = FALSE;
+ }
}
void LLViewerWindow::setCursor( ECursorType c )
{
- mWindow->setCursor( c );
+ mWindow->setCursor( c );
}
void LLViewerWindow::showCursor()
{
- mWindow->showCursor();
-
- mCursorHidden = FALSE;
+ mWindow->showCursor();
+
+ mCursorHidden = FALSE;
}
void LLViewerWindow::hideCursor()
{
- // And hide the cursor
- mWindow->hideCursor();
+ // And hide the cursor
+ mWindow->hideCursor();
- mCursorHidden = TRUE;
+ mCursorHidden = TRUE;
}
void LLViewerWindow::sendShapeToSim()
{
- LLMessageSystem* msg = gMessageSystem;
- if(!msg) return;
- msg->newMessageFast(_PREHASH_AgentHeightWidth);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addU32Fast(_PREHASH_CircuitCode, gMessageSystem->mOurCircuitCode);
- msg->nextBlockFast(_PREHASH_HeightWidthBlock);
- msg->addU32Fast(_PREHASH_GenCounter, 0);
- U16 height16 = (U16) mWorldViewRectRaw.getHeight();
- U16 width16 = (U16) mWorldViewRectRaw.getWidth();
- msg->addU16Fast(_PREHASH_Height, height16);
- msg->addU16Fast(_PREHASH_Width, width16);
- gAgent.sendReliableMessage();
+ LLMessageSystem* msg = gMessageSystem;
+ if(!msg) return;
+ msg->newMessageFast(_PREHASH_AgentHeightWidth);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addU32Fast(_PREHASH_CircuitCode, gMessageSystem->mOurCircuitCode);
+ msg->nextBlockFast(_PREHASH_HeightWidthBlock);
+ msg->addU32Fast(_PREHASH_GenCounter, 0);
+ U16 height16 = (U16) mWorldViewRectRaw.getHeight();
+ U16 width16 = (U16) mWorldViewRectRaw.getWidth();
+ msg->addU16Fast(_PREHASH_Height, height16);
+ msg->addU16Fast(_PREHASH_Width, width16);
+ gAgent.sendReliableMessage();
}
// Must be called after window is created to set up agent
// camera variables and UI variables.
void LLViewerWindow::reshape(S32 width, S32 height)
{
- // Destroying the window at quit time generates spurious
- // reshape messages. We don't care about these, and we
- // don't want to send messages because the message system
- // may have been destructed.
- if (!LLApp::isExiting())
- {
- gWindowResized = TRUE;
+ // Destroying the window at quit time generates spurious
+ // reshape messages. We don't care about these, and we
+ // don't want to send messages because the message system
+ // may have been destructed.
+ if (!LLApp::isExiting())
+ {
+ gWindowResized = TRUE;
- // update our window rectangle
- mWindowRectRaw.mRight = mWindowRectRaw.mLeft + width;
- mWindowRectRaw.mTop = mWindowRectRaw.mBottom + height;
+ // update our window rectangle
+ mWindowRectRaw.mRight = mWindowRectRaw.mLeft + width;
+ mWindowRectRaw.mTop = mWindowRectRaw.mBottom + height;
- //glViewport(0, 0, width, height );
+ //glViewport(0, 0, width, height );
LLViewerCamera * camera = LLViewerCamera::getInstance(); // simpleton, might not exist
- if (height > 0 && camera)
- {
+ if (height > 0 && camera)
+ {
camera->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
camera->setAspect( getWorldViewAspectRatio() );
- }
+ }
- calcDisplayScale();
-
- BOOL display_scale_changed = mDisplayScale != LLUI::getScaleFactor();
- LLUI::setScaleFactor(mDisplayScale);
+ calcDisplayScale();
- // update our window rectangle
- mWindowRectScaled.mRight = mWindowRectScaled.mLeft + ll_round((F32)width / mDisplayScale.mV[VX]);
- mWindowRectScaled.mTop = mWindowRectScaled.mBottom + ll_round((F32)height / mDisplayScale.mV[VY]);
+ BOOL display_scale_changed = mDisplayScale != LLUI::getScaleFactor();
+ LLUI::setScaleFactor(mDisplayScale);
- setup2DViewport();
+ // update our window rectangle
+ mWindowRectScaled.mRight = mWindowRectScaled.mLeft + ll_round((F32)width / mDisplayScale.mV[VX]);
+ mWindowRectScaled.mTop = mWindowRectScaled.mBottom + ll_round((F32)height / mDisplayScale.mV[VY]);
- // Inform lower views of the change
- // round up when converting coordinates to make sure there are no gaps at edge of window
- LLView::sForceReshape = display_scale_changed;
- mRootView->reshape(llceil((F32)width / mDisplayScale.mV[VX]), llceil((F32)height / mDisplayScale.mV[VY]));
+ setup2DViewport();
+
+ // Inform lower views of the change
+ // round up when converting coordinates to make sure there are no gaps at edge of window
+ LLView::sForceReshape = display_scale_changed;
+ mRootView->reshape(llceil((F32)width / mDisplayScale.mV[VX]), llceil((F32)height / mDisplayScale.mV[VY]));
if (display_scale_changed)
{
// Needs only a 'scale change' update, everything else gets handled by LLLayoutStack::updateClass()
LLPanelLogin::reshapePanel();
}
- LLView::sForceReshape = FALSE;
+ LLView::sForceReshape = FALSE;
- // clear font width caches
- if (display_scale_changed)
- {
- LLHUDObject::reshapeAll();
- }
+ // clear font width caches
+ if (display_scale_changed)
+ {
+ LLHUDObject::reshapeAll();
+ }
- sendShapeToSim();
+ sendShapeToSim();
- // store new settings for the mode we are in, regardless
- BOOL maximized = mWindow->getMaximized();
- gSavedSettings.setBOOL("WindowMaximized", maximized);
+ // store new settings for the mode we are in, regardless
+ BOOL maximized = mWindow->getMaximized();
+ gSavedSettings.setBOOL("WindowMaximized", maximized);
- if (!maximized)
- {
- U32 min_window_width=gSavedSettings.getU32("MinWindowWidth");
- U32 min_window_height=gSavedSettings.getU32("MinWindowHeight");
- // tell the OS specific window code about min window size
- mWindow->setMinSize(min_window_width, min_window_height);
+ if (!maximized)
+ {
+ U32 min_window_width=gSavedSettings.getU32("MinWindowWidth");
+ U32 min_window_height=gSavedSettings.getU32("MinWindowHeight");
+ // tell the OS specific window code about min window size
+ mWindow->setMinSize(min_window_width, min_window_height);
- LLCoordScreen window_rect;
- if (!gNonInteractive && mWindow->getSize(&window_rect))
- {
- // Only save size if not maximized
- gSavedSettings.setU32("WindowWidth", window_rect.mX);
- gSavedSettings.setU32("WindowHeight", window_rect.mY);
- }
- }
+ LLCoordScreen window_rect;
+ if (!gNonInteractive && mWindow->getSize(&window_rect))
+ {
+ // Only save size if not maximized
+ gSavedSettings.setU32("WindowWidth", window_rect.mX);
+ gSavedSettings.setU32("WindowHeight", window_rect.mY);
+ }
+ }
- sample(LLStatViewer::WINDOW_WIDTH, width);
- sample(LLStatViewer::WINDOW_HEIGHT, height);
+ sample(LLStatViewer::WINDOW_WIDTH, width);
+ sample(LLStatViewer::WINDOW_HEIGHT, height);
- LLLayoutStack::updateClass();
- }
+ LLLayoutStack::updateClass();
+ }
}
// Hide normal UI when a logon fails
void LLViewerWindow::setNormalControlsVisible( BOOL visible )
{
- if(LLChicletBar::instanceExists())
- {
- LLChicletBar::getInstance()->setVisible(visible);
- LLChicletBar::getInstance()->setEnabled(visible);
- }
-
- if ( gMenuBarView )
- {
- gMenuBarView->setVisible( visible );
- gMenuBarView->setEnabled( visible );
-
- // ...and set the menu color appropriately.
- setMenuBackgroundColor(gAgent.getGodLevel() > GOD_NOT,
- LLGridManager::getInstance()->isInProductionGrid());
- }
-
- if ( gStatusBar )
- {
- gStatusBar->setVisible( visible );
- gStatusBar->setEnabled( visible );
- }
-
- LLNavigationBar* navbarp = LLUI::getInstance()->getRootView()->findChild<LLNavigationBar>("navigation_bar");
- if (navbarp)
- {
- // when it's time to show navigation bar we need to ensure that the user wants to see it
- // i.e. ShowNavbarNavigationPanel option is true
- navbarp->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") );
- }
+ if(LLChicletBar::instanceExists())
+ {
+ LLChicletBar::getInstance()->setVisible(visible);
+ LLChicletBar::getInstance()->setEnabled(visible);
+ }
+
+ if ( gMenuBarView )
+ {
+ gMenuBarView->setVisible( visible );
+ gMenuBarView->setEnabled( visible );
+
+ // ...and set the menu color appropriately.
+ setMenuBackgroundColor(gAgent.getGodLevel() > GOD_NOT,
+ LLGridManager::getInstance()->isInProductionGrid());
+ }
+
+ if ( gStatusBar )
+ {
+ gStatusBar->setVisible( visible );
+ gStatusBar->setEnabled( visible );
+ }
+
+ LLNavigationBar* navbarp = LLUI::getInstance()->getRootView()->findChild<LLNavigationBar>("navigation_bar");
+ if (navbarp)
+ {
+ // when it's time to show navigation bar we need to ensure that the user wants to see it
+ // i.e. ShowNavbarNavigationPanel option is true
+ navbarp->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") );
+ }
}
void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
@@ -2578,17 +2578,17 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
LLSD args;
LLColor4 new_bg_color;
- // god more important than project, proj more important than grid
- if ( god_mode )
+ // god more important than project, proj more important than grid
+ if ( god_mode )
{
- if ( LLGridManager::getInstance()->isInProductionGrid() )
- {
- new_bg_color = LLUIColorTable::instance().getColor( "MenuBarGodBgColor" );
- }
- else
- {
- new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionGodBgColor" );
- }
+ if ( LLGridManager::getInstance()->isInProductionGrid() )
+ {
+ new_bg_color = LLUIColorTable::instance().getColor( "MenuBarGodBgColor" );
+ }
+ else
+ {
+ new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionGodBgColor" );
+ }
}
else
{
@@ -2601,24 +2601,24 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
case LLVersionInfo::PROJECT_VIEWER:
new_bg_color = LLUIColorTable::instance().getColor( "MenuBarProjectBgColor" );
break;
-
+
case LLVersionInfo::BETA_VIEWER:
new_bg_color = LLUIColorTable::instance().getColor( "MenuBarBetaBgColor" );
break;
-
+
case LLVersionInfo::RELEASE_VIEWER:
if(!LLGridManager::getInstance()->isInProductionGrid())
{
new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
}
- else
+ else
{
new_bg_color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
}
break;
}
}
-
+
if(gMenuBarView)
{
gMenuBarView->setBackgroundColor( new_bg_color );
@@ -2633,144 +2633,144 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
void LLViewerWindow::drawDebugText()
{
gUIProgram.bind();
- gGL.color4f(1,1,1,1);
- gGL.pushMatrix();
- gGL.pushUIMatrix();
- {
- // scale view by UI global scale factor and aspect ratio correction factor
- gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
- mDebugText->draw();
- }
- gGL.popUIMatrix();
- gGL.popMatrix();
+ gGL.color4f(1,1,1,1);
+ gGL.pushMatrix();
+ gGL.pushUIMatrix();
+ {
+ // scale view by UI global scale factor and aspect ratio correction factor
+ gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
+ mDebugText->draw();
+ }
+ gGL.popUIMatrix();
+ gGL.popMatrix();
- gGL.flush();
- gUIProgram.unbind();
+ gGL.flush();
+ gUIProgram.unbind();
}
void LLViewerWindow::draw()
{
-
+
//#if LL_DEBUG
- LLView::sIsDrawing = TRUE;
+ LLView::sIsDrawing = TRUE;
//#endif
- stop_glerror();
-
- LLUI::setLineWidth(1.f);
-
- LLUI::setLineWidth(1.f);
- // Reset any left-over transforms
- gGL.matrixMode(LLRender::MM_MODELVIEW);
-
- gGL.loadIdentity();
-
- //S32 screen_x, screen_y;
-
- if (!gSavedSettings.getBOOL("RenderUIBuffer"))
- {
- LLView::sDirtyRect = getWindowRectScaled();
- }
-
- // HACK for timecode debugging
- if (gSavedSettings.getBOOL("DisplayTimecode"))
- {
- // draw timecode block
- std::string text;
-
- gGL.loadIdentity();
-
- microsecondsToTimecodeString(gFrameTime,text);
- const LLFontGL* font = LLFontGL::getFontSansSerif();
- font->renderUTF8(text, 0,
- ll_round((getWindowWidthScaled()/2)-100.f),
- ll_round((getWindowHeightScaled()-60.f)),
- LLColor4( 1.f, 1.f, 1.f, 1.f ),
- LLFontGL::LEFT, LLFontGL::TOP);
- }
-
- // Draw all nested UI views.
- // No translation needed, this view is glued to 0,0
-
- gUIProgram.bind();
+ stop_glerror();
+
+ LLUI::setLineWidth(1.f);
+
+ LLUI::setLineWidth(1.f);
+ // Reset any left-over transforms
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+
+ gGL.loadIdentity();
+
+ //S32 screen_x, screen_y;
+
+ if (!gSavedSettings.getBOOL("RenderUIBuffer"))
+ {
+ LLView::sDirtyRect = getWindowRectScaled();
+ }
+
+ // HACK for timecode debugging
+ if (gSavedSettings.getBOOL("DisplayTimecode"))
+ {
+ // draw timecode block
+ std::string text;
+
+ gGL.loadIdentity();
+
+ microsecondsToTimecodeString(gFrameTime,text);
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
+ font->renderUTF8(text, 0,
+ ll_round((getWindowWidthScaled()/2)-100.f),
+ ll_round((getWindowHeightScaled()-60.f)),
+ LLColor4( 1.f, 1.f, 1.f, 1.f ),
+ LLFontGL::LEFT, LLFontGL::TOP);
+ }
+
+ // Draw all nested UI views.
+ // No translation needed, this view is glued to 0,0
+
+ gUIProgram.bind();
gGL.color4f(1, 1, 1, 1);
- gGL.pushMatrix();
- LLUI::pushMatrix();
- {
-
- // scale view by UI global scale factor and aspect ratio correction factor
- gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
-
- LLVector2 old_scale_factor = LLUI::getScaleFactor();
- // apply camera zoom transform (for high res screenshots)
- F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
- S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();
- if (zoom_factor > 1.f)
- {
- //decompose subregion number to x and y values
- int pos_y = sub_region / llceil(zoom_factor);
- int pos_x = sub_region - (pos_y*llceil(zoom_factor));
- // offset for this tile
- gGL.translatef((F32)getWindowWidthScaled() * -(F32)pos_x,
- (F32)getWindowHeightScaled() * -(F32)pos_y,
- 0.f);
- gGL.scalef(zoom_factor, zoom_factor, 1.f);
- LLUI::getScaleFactor() *= zoom_factor;
- }
-
- // Draw tool specific overlay on world
- LLToolMgr::getInstance()->getCurrentTool()->draw();
-
- if( gAgentCamera.cameraMouselook() || LLFloaterCamera::inFreeCameraMode() )
- {
- drawMouselookInstructions();
- stop_glerror();
- }
-
- // Draw all nested UI views.
- // No translation needed, this view is glued to 0,0
- mRootView->draw();
-
- if (LLView::sDebugRects)
- {
- gToolTipView->drawStickyRect();
- }
-
- // Draw optional on-top-of-everyone view
- LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
- if (top_ctrl && top_ctrl->getVisible())
- {
- S32 screen_x, screen_y;
- top_ctrl->localPointToScreen(0, 0, &screen_x, &screen_y);
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- LLUI::pushMatrix();
- LLUI::translate( (F32) screen_x, (F32) screen_y);
- top_ctrl->draw();
- LLUI::popMatrix();
- }
-
-
- if( gShowOverlayTitle && !mOverlayTitle.empty() )
- {
- // Used for special titles such as "Second Life - Special E3 2003 Beta"
- const S32 DIST_FROM_TOP = 20;
- LLFontGL::getFontSansSerifBig()->renderUTF8(
- mOverlayTitle, 0,
- ll_round( getWindowWidthScaled() * 0.5f),
- getWindowHeightScaled() - DIST_FROM_TOP,
- LLColor4(1, 1, 1, 0.4f),
- LLFontGL::HCENTER, LLFontGL::TOP);
- }
-
- LLUI::setScaleFactor(old_scale_factor);
- }
- LLUI::popMatrix();
- gGL.popMatrix();
-
- gUIProgram.unbind();
-
- LLView::sIsDrawing = FALSE;
+ gGL.pushMatrix();
+ LLUI::pushMatrix();
+ {
+
+ // scale view by UI global scale factor and aspect ratio correction factor
+ gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
+
+ LLVector2 old_scale_factor = LLUI::getScaleFactor();
+ // apply camera zoom transform (for high res screenshots)
+ F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
+ S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();
+ if (zoom_factor > 1.f)
+ {
+ //decompose subregion number to x and y values
+ int pos_y = sub_region / llceil(zoom_factor);
+ int pos_x = sub_region - (pos_y*llceil(zoom_factor));
+ // offset for this tile
+ gGL.translatef((F32)getWindowWidthScaled() * -(F32)pos_x,
+ (F32)getWindowHeightScaled() * -(F32)pos_y,
+ 0.f);
+ gGL.scalef(zoom_factor, zoom_factor, 1.f);
+ LLUI::getScaleFactor() *= zoom_factor;
+ }
+
+ // Draw tool specific overlay on world
+ LLToolMgr::getInstance()->getCurrentTool()->draw();
+
+ if( gAgentCamera.cameraMouselook() || LLFloaterCamera::inFreeCameraMode() )
+ {
+ drawMouselookInstructions();
+ stop_glerror();
+ }
+
+ // Draw all nested UI views.
+ // No translation needed, this view is glued to 0,0
+ mRootView->draw();
+
+ if (LLView::sDebugRects)
+ {
+ gToolTipView->drawStickyRect();
+ }
+
+ // Draw optional on-top-of-everyone view
+ LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
+ if (top_ctrl && top_ctrl->getVisible())
+ {
+ S32 screen_x, screen_y;
+ top_ctrl->localPointToScreen(0, 0, &screen_x, &screen_y);
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ LLUI::pushMatrix();
+ LLUI::translate( (F32) screen_x, (F32) screen_y);
+ top_ctrl->draw();
+ LLUI::popMatrix();
+ }
+
+
+ if( gShowOverlayTitle && !mOverlayTitle.empty() )
+ {
+ // Used for special titles such as "Second Life - Special E3 2003 Beta"
+ const S32 DIST_FROM_TOP = 20;
+ LLFontGL::getFontSansSerifBig()->renderUTF8(
+ mOverlayTitle, 0,
+ ll_round( getWindowWidthScaled() * 0.5f),
+ getWindowHeightScaled() - DIST_FROM_TOP,
+ LLColor4(1, 1, 1, 0.4f),
+ LLFontGL::HCENTER, LLFontGL::TOP);
+ }
+
+ LLUI::setScaleFactor(old_scale_factor);
+ }
+ LLUI::popMatrix();
+ gGL.popMatrix();
+
+ gUIProgram.unbind();
+
+ LLView::sIsDrawing = FALSE;
}
// Takes a single keyup event, usually when UI is visible
@@ -2786,45 +2786,45 @@ BOOL LLViewerWindow::handleKeyUp(KEY key, MASK mask)
LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
if (keyboard_focus
- && !(mask & (MASK_CONTROL | MASK_ALT))
- && !gFocusMgr.getKeystrokesOnly())
- {
- // We have keyboard focus, and it's not an accelerator
+ && !(mask & (MASK_CONTROL | MASK_ALT))
+ && !gFocusMgr.getKeystrokesOnly())
+ {
+ // We have keyboard focus, and it's not an accelerator
if (keyboard_focus && keyboard_focus->wantsKeyUpKeyDown())
{
return keyboard_focus->handleKeyUp(key, mask, FALSE);
}
else if (key < 0x80)
- {
- // Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first.
- return (gFocusMgr.getKeyboardFocus() != NULL);
- }
- }
-
- if (keyboard_focus)
- {
- if (keyboard_focus->handleKeyUp(key, mask, FALSE))
- {
- LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned true" << LL_ENDL;
- LLViewerEventRecorder::instance().logKeyEvent(key, mask);
- return TRUE;
- }
- else {
- LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned FALSE" << LL_ENDL;
- }
- }
-
- // don't pass keys on to world when something in ui has focus
- return gFocusMgr.childHasKeyboardFocus(mRootView)
- || LLMenuGL::getKeyboardMode()
- || (gMenuBarView && gMenuBarView->getHighlightedItem() && gMenuBarView->getHighlightedItem()->isActive());
+ {
+ // Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first.
+ return (gFocusMgr.getKeyboardFocus() != NULL);
+ }
+ }
+
+ if (keyboard_focus)
+ {
+ if (keyboard_focus->handleKeyUp(key, mask, FALSE))
+ {
+ LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned true" << LL_ENDL;
+ LLViewerEventRecorder::instance().logKeyEvent(key, mask);
+ return TRUE;
+ }
+ else {
+ LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned FALSE" << LL_ENDL;
+ }
+ }
+
+ // don't pass keys on to world when something in ui has focus
+ return gFocusMgr.childHasKeyboardFocus(mRootView)
+ || LLMenuGL::getKeyboardMode()
+ || (gMenuBarView && gMenuBarView->getHighlightedItem() && gMenuBarView->getHighlightedItem()->isActive());
}
// Takes a single keydown event, usually when UI is visible
BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
{
- // hide tooltips on keypress
- LLToolTipMgr::instance().blockToolTips();
+ // hide tooltips on keypress
+ LLToolTipMgr::instance().blockToolTips();
// Menus get handled on key down instead of key up
// so keybindings have to be recorded before that
@@ -2836,7 +2836,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
}
LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
-
+
if (keyboard_focus
&& !gFocusMgr.getKeystrokesOnly())
{
@@ -2909,279 +2909,279 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
}
}
- // let menus handle navigation keys for navigation
- if ((gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE))
- ||(gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))
- ||(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE)))
- {
- LL_DEBUGS() << "LLviewerWindow::handleKey handle nav keys for nav" << LL_ENDL;
- LLViewerEventRecorder::instance().logKeyEvent(key,mask);
- return TRUE;
- }
-
-
- // give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus
- // as long as focus isn't locked
- if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked())
- {
- // Check the current floater's menu first, if it has one.
- if (gFocusMgr.keyboardFocusHasAccelerators()
- && keyboard_focus
- && keyboard_focus->handleKey(key,mask,FALSE))
- {
- LLViewerEventRecorder::instance().logKeyEvent(key,mask);
- return TRUE;
- }
-
- if (gAgent.isInitialized()
- && (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE || gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL)
- && gMenuBarView
- && gMenuBarView->handleAcceleratorKey(key, mask))
- {
- LLViewerEventRecorder::instance().logKeyEvent(key, mask);
- return TRUE;
- }
-
- if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))
- {
- LLViewerEventRecorder::instance().logKeyEvent(key,mask);
- return TRUE;
- }
- }
-
- // give floaters first chance to handle TAB key
- // so frontmost floater gets focus
- // if nothing has focus, go to first or last UI element as appropriate
+ // let menus handle navigation keys for navigation
+ if ((gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE))
+ ||(gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))
+ ||(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE)))
+ {
+ LL_DEBUGS() << "LLviewerWindow::handleKey handle nav keys for nav" << LL_ENDL;
+ LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+ return TRUE;
+ }
+
+
+ // give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus
+ // as long as focus isn't locked
+ if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked())
+ {
+ // Check the current floater's menu first, if it has one.
+ if (gFocusMgr.keyboardFocusHasAccelerators()
+ && keyboard_focus
+ && keyboard_focus->handleKey(key,mask,FALSE))
+ {
+ LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+ return TRUE;
+ }
+
+ if (gAgent.isInitialized()
+ && (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE || gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL)
+ && gMenuBarView
+ && gMenuBarView->handleAcceleratorKey(key, mask))
+ {
+ LLViewerEventRecorder::instance().logKeyEvent(key, mask);
+ return TRUE;
+ }
+
+ if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))
+ {
+ LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+ return TRUE;
+ }
+ }
+
+ // give floaters first chance to handle TAB key
+ // so frontmost floater gets focus
+ // if nothing has focus, go to first or last UI element as appropriate
if (key == KEY_TAB && (mask & MASK_CONTROL || keyboard_focus == NULL))
- {
- LL_WARNS() << "LLviewerWindow::handleKey give floaters first chance at tab key " << LL_ENDL;
- if (gMenuHolder) gMenuHolder->hideMenus();
-
- // if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode
- gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0);
-
- // do CTRL-TAB and CTRL-SHIFT-TAB logic
- if (mask & MASK_SHIFT)
- {
- mRootView->focusPrevRoot();
- }
- else
- {
- mRootView->focusNextRoot();
- }
- LLViewerEventRecorder::instance().logKeyEvent(key,mask);
- return TRUE;
- }
- // hidden edit menu for cut/copy/paste
- if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask))
- {
- LLViewerEventRecorder::instance().logKeyEvent(key,mask);
- return TRUE;
- }
-
- LLFloater* focused_floaterp = gFloaterView->getFocusedFloater();
- std::string focusedFloaterName = (focused_floaterp ? focused_floaterp->getInstanceName() : "");
-
- if( keyboard_focus )
- {
- if ((focusedFloaterName == "nearby_chat") || (focusedFloaterName == "im_container") || (focusedFloaterName == "impanel"))
- {
- if (gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))
- {
- // let Control-Up and Control-Down through for chat line history,
- if (!(key == KEY_UP && mask == MASK_CONTROL)
- && !(key == KEY_DOWN && mask == MASK_CONTROL)
- && !(key == KEY_UP && mask == MASK_ALT)
- && !(key == KEY_DOWN && mask == MASK_ALT))
- {
- switch(key)
- {
- case KEY_LEFT:
- case KEY_RIGHT:
- case KEY_UP:
- case KEY_DOWN:
- case KEY_PAGE_UP:
- case KEY_PAGE_DOWN:
- case KEY_HOME:
- case KEY_END:
- // when chatbar is empty or ArrowKeysAlwaysMove set,
- // pass arrow keys on to avatar...
- return FALSE;
- default:
- break;
- }
- }
- }
- }
-
- if (keyboard_focus->handleKey(key, mask, FALSE))
- {
-
- LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned true" << LL_ENDL;
- LLViewerEventRecorder::instance().logKeyEvent(key,mask);
- return TRUE;
- } else {
- LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned FALSE" << LL_ENDL;
- }
- }
-
- if( LLToolMgr::getInstance()->getCurrentTool()->handleKey(key, mask) )
- {
- LL_DEBUGS() << "LLviewerWindow::handleKey toolbar handling?" << LL_ENDL;
- LLViewerEventRecorder::instance().logKeyEvent(key,mask);
- return TRUE;
- }
-
- // Try for a new-format gesture
- if (LLGestureMgr::instance().triggerGesture(key, mask))
- {
- LL_DEBUGS() << "LLviewerWindow::handleKey new gesture feature" << LL_ENDL;
- LLViewerEventRecorder::instance().logKeyEvent(key,mask);
- return TRUE;
- }
-
- // See if this is a gesture trigger. If so, eat the key and
- // don't pass it down to the menus.
- if (gGestureList.trigger(key, mask))
- {
- LL_DEBUGS() << "LLviewerWindow::handleKey check gesture trigger" << LL_ENDL;
- LLViewerEventRecorder::instance().logKeyEvent(key,mask);
- return TRUE;
- }
-
- // If "Pressing letter keys starts local chat" option is selected, we are not in mouselook,
- // no view has keyboard focus, this is a printable character key (and no modifier key is
- // pressed except shift), then give focus to nearby chat (STORM-560)
- if ( LLStartUp::getStartupState() >= STATE_STARTED &&
- gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() &&
- !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) )
- {
- // Initialize nearby chat if it's missing
- LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
- if (!nearby_chat)
- {
- LLSD name("im_container");
- LLFloaterReg::toggleInstanceOrBringToFront(name);
- }
-
- LLChatEntry* chat_editor = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->getChatBox();
- if (chat_editor)
- {
- // passing NULL here, character will be added later when it is handled by character handler.
- nearby_chat->startChat(NULL);
- return TRUE;
- }
- }
-
- // give menus a chance to handle unmodified accelerator keys
- if (gAgent.isInitialized()
- && (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE || gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL)
- && gMenuBarView
- && gMenuBarView->handleAcceleratorKey(key, mask))
- {
- LLViewerEventRecorder::instance().logKeyEvent(key, mask);
- return TRUE;
- }
-
- if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))
- {
- return TRUE;
- }
-
- // don't pass keys on to world when something in ui has focus
- return gFocusMgr.childHasKeyboardFocus(mRootView)
- || LLMenuGL::getKeyboardMode()
- || (gMenuBarView && gMenuBarView->getHighlightedItem() && gMenuBarView->getHighlightedItem()->isActive());
+ {
+ LL_WARNS() << "LLviewerWindow::handleKey give floaters first chance at tab key " << LL_ENDL;
+ if (gMenuHolder) gMenuHolder->hideMenus();
+
+ // if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode
+ gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0);
+
+ // do CTRL-TAB and CTRL-SHIFT-TAB logic
+ if (mask & MASK_SHIFT)
+ {
+ mRootView->focusPrevRoot();
+ }
+ else
+ {
+ mRootView->focusNextRoot();
+ }
+ LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+ return TRUE;
+ }
+ // hidden edit menu for cut/copy/paste
+ if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask))
+ {
+ LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+ return TRUE;
+ }
+
+ LLFloater* focused_floaterp = gFloaterView->getFocusedFloater();
+ std::string focusedFloaterName = (focused_floaterp ? focused_floaterp->getInstanceName() : "");
+
+ if( keyboard_focus )
+ {
+ if ((focusedFloaterName == "nearby_chat") || (focusedFloaterName == "im_container") || (focusedFloaterName == "impanel"))
+ {
+ if (gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))
+ {
+ // let Control-Up and Control-Down through for chat line history,
+ if (!(key == KEY_UP && mask == MASK_CONTROL)
+ && !(key == KEY_DOWN && mask == MASK_CONTROL)
+ && !(key == KEY_UP && mask == MASK_ALT)
+ && !(key == KEY_DOWN && mask == MASK_ALT))
+ {
+ switch(key)
+ {
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_PAGE_UP:
+ case KEY_PAGE_DOWN:
+ case KEY_HOME:
+ case KEY_END:
+ // when chatbar is empty or ArrowKeysAlwaysMove set,
+ // pass arrow keys on to avatar...
+ return FALSE;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ if (keyboard_focus->handleKey(key, mask, FALSE))
+ {
+
+ LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned true" << LL_ENDL;
+ LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+ return TRUE;
+ } else {
+ LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned FALSE" << LL_ENDL;
+ }
+ }
+
+ if( LLToolMgr::getInstance()->getCurrentTool()->handleKey(key, mask) )
+ {
+ LL_DEBUGS() << "LLviewerWindow::handleKey toolbar handling?" << LL_ENDL;
+ LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+ return TRUE;
+ }
+
+ // Try for a new-format gesture
+ if (LLGestureMgr::instance().triggerGesture(key, mask))
+ {
+ LL_DEBUGS() << "LLviewerWindow::handleKey new gesture feature" << LL_ENDL;
+ LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+ return TRUE;
+ }
+
+ // See if this is a gesture trigger. If so, eat the key and
+ // don't pass it down to the menus.
+ if (gGestureList.trigger(key, mask))
+ {
+ LL_DEBUGS() << "LLviewerWindow::handleKey check gesture trigger" << LL_ENDL;
+ LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+ return TRUE;
+ }
+
+ // If "Pressing letter keys starts local chat" option is selected, we are not in mouselook,
+ // no view has keyboard focus, this is a printable character key (and no modifier key is
+ // pressed except shift), then give focus to nearby chat (STORM-560)
+ if ( LLStartUp::getStartupState() >= STATE_STARTED &&
+ gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() &&
+ !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) )
+ {
+ // Initialize nearby chat if it's missing
+ LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ if (!nearby_chat)
+ {
+ LLSD name("im_container");
+ LLFloaterReg::toggleInstanceOrBringToFront(name);
+ }
+
+ LLChatEntry* chat_editor = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->getChatBox();
+ if (chat_editor)
+ {
+ // passing NULL here, character will be added later when it is handled by character handler.
+ nearby_chat->startChat(NULL);
+ return TRUE;
+ }
+ }
+
+ // give menus a chance to handle unmodified accelerator keys
+ if (gAgent.isInitialized()
+ && (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE || gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL)
+ && gMenuBarView
+ && gMenuBarView->handleAcceleratorKey(key, mask))
+ {
+ LLViewerEventRecorder::instance().logKeyEvent(key, mask);
+ return TRUE;
+ }
+
+ if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))
+ {
+ return TRUE;
+ }
+
+ // don't pass keys on to world when something in ui has focus
+ return gFocusMgr.childHasKeyboardFocus(mRootView)
+ || LLMenuGL::getKeyboardMode()
+ || (gMenuBarView && gMenuBarView->getHighlightedItem() && gMenuBarView->getHighlightedItem()->isActive());
}
BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask)
{
- // HACK: We delay processing of return keys until they arrive as a Unicode char,
- // so that if you're typing chat text at low frame rate, we don't send the chat
- // until all keystrokes have been entered. JC
- // HACK: Numeric keypad <enter> on Mac is Unicode 3
- // HACK: Control-M on Windows is Unicode 13
- if ((uni_char == 13 && mask != MASK_CONTROL)
- || (uni_char == 3 && mask == MASK_NONE) )
- {
- if (mask != MASK_ALT)
- {
- // remaps, handles ignored cases and returns back to viewer window.
- return gViewerInput.handleKey(KEY_RETURN, mask, gKeyboard->getKeyRepeated(KEY_RETURN));
- }
- }
-
- // let menus handle navigation (jump) keys
- if (gMenuBarView && gMenuBarView->handleUnicodeChar(uni_char, TRUE))
- {
- return TRUE;
- }
-
- // Traverses up the hierarchy
- LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
- if( keyboard_focus )
- {
- if (keyboard_focus->handleUnicodeChar(uni_char, FALSE))
- {
- return TRUE;
- }
+ // HACK: We delay processing of return keys until they arrive as a Unicode char,
+ // so that if you're typing chat text at low frame rate, we don't send the chat
+ // until all keystrokes have been entered. JC
+ // HACK: Numeric keypad <enter> on Mac is Unicode 3
+ // HACK: Control-M on Windows is Unicode 13
+ if ((uni_char == 13 && mask != MASK_CONTROL)
+ || (uni_char == 3 && mask == MASK_NONE) )
+ {
+ if (mask != MASK_ALT)
+ {
+ // remaps, handles ignored cases and returns back to viewer window.
+ return gViewerInput.handleKey(KEY_RETURN, mask, gKeyboard->getKeyRepeated(KEY_RETURN));
+ }
+ }
+ // let menus handle navigation (jump) keys
+ if (gMenuBarView && gMenuBarView->handleUnicodeChar(uni_char, TRUE))
+ {
return TRUE;
- }
+ }
+
+ // Traverses up the hierarchy
+ LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
+ if( keyboard_focus )
+ {
+ if (keyboard_focus->handleUnicodeChar(uni_char, FALSE))
+ {
+ return TRUE;
+ }
- return FALSE;
+ return TRUE;
+ }
+
+ return FALSE;
}
void LLViewerWindow::handleScrollWheel(S32 clicks)
{
- LLUI::getInstance()->resetMouseIdleTimer();
-
- LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
- if( mouse_captor )
- {
- S32 local_x;
- S32 local_y;
- mouse_captor->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y );
- mouse_captor->handleScrollWheel(local_x, local_y, clicks);
- if (LLView::sDebugMouseHandling)
- {
- LL_INFOS() << "Scroll Wheel handled by captor " << mouse_captor->getName() << LL_ENDL;
- }
- return;
- }
-
- LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
- if (top_ctrl)
- {
- S32 local_x;
- S32 local_y;
- top_ctrl->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y );
- if (top_ctrl->handleScrollWheel(local_x, local_y, clicks)) return;
- }
-
- if (mRootView->handleScrollWheel(mCurrentMousePoint.mX, mCurrentMousePoint.mY, clicks) )
- {
- if (LLView::sDebugMouseHandling)
- {
- LL_INFOS() << "Scroll Wheel" << LLView::sMouseHandlerMessage << LL_ENDL;
- }
- return;
- }
- else if (LLView::sDebugMouseHandling)
- {
- LL_INFOS() << "Scroll Wheel not handled by view" << LL_ENDL;
- }
-
- // Zoom the camera in and out behavior
-
- if(top_ctrl == 0
- && getWorldViewRectScaled().pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY)
- && gAgentCamera.isInitialized())
- gAgentCamera.handleScrollWheel(clicks);
-
- return;
+ LLUI::getInstance()->resetMouseIdleTimer();
+
+ LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
+ if( mouse_captor )
+ {
+ S32 local_x;
+ S32 local_y;
+ mouse_captor->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y );
+ mouse_captor->handleScrollWheel(local_x, local_y, clicks);
+ if (LLView::sDebugMouseHandling)
+ {
+ LL_INFOS() << "Scroll Wheel handled by captor " << mouse_captor->getName() << LL_ENDL;
+ }
+ return;
+ }
+
+ LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
+ if (top_ctrl)
+ {
+ S32 local_x;
+ S32 local_y;
+ top_ctrl->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y );
+ if (top_ctrl->handleScrollWheel(local_x, local_y, clicks)) return;
+ }
+
+ if (mRootView->handleScrollWheel(mCurrentMousePoint.mX, mCurrentMousePoint.mY, clicks) )
+ {
+ if (LLView::sDebugMouseHandling)
+ {
+ LL_INFOS() << "Scroll Wheel" << LLView::sMouseHandlerMessage << LL_ENDL;
+ }
+ return;
+ }
+ else if (LLView::sDebugMouseHandling)
+ {
+ LL_INFOS() << "Scroll Wheel not handled by view" << LL_ENDL;
+ }
+
+ // Zoom the camera in and out behavior
+
+ if(top_ctrl == 0
+ && getWorldViewRectScaled().pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY)
+ && gAgentCamera.isInitialized())
+ gAgentCamera.handleScrollWheel(clicks);
+
+ return;
}
void LLViewerWindow::handleScrollHWheel(S32 clicks)
@@ -3190,7 +3190,7 @@ void LLViewerWindow::handleScrollHWheel(S32 clicks)
{
return;
}
-
+
LLUI::getInstance()->resetMouseIdleTimer();
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
@@ -3234,42 +3234,42 @@ void LLViewerWindow::handleScrollHWheel(S32 clicks)
void LLViewerWindow::addPopup(LLView* popup)
{
- if (mPopupView)
- {
- mPopupView->addPopup(popup);
- }
+ if (mPopupView)
+ {
+ mPopupView->addPopup(popup);
+ }
}
void LLViewerWindow::removePopup(LLView* popup)
{
- if (mPopupView)
- {
- mPopupView->removePopup(popup);
- }
+ if (mPopupView)
+ {
+ mPopupView->removePopup(popup);
+ }
}
void LLViewerWindow::clearPopups()
{
- if (mPopupView)
- {
- mPopupView->clearPopups();
- }
+ if (mPopupView)
+ {
+ mPopupView->clearPopups();
+ }
}
void LLViewerWindow::moveCursorToCenter()
{
- if (! gSavedSettings.getBOOL("DisableMouseWarp"))
- {
- S32 x = getWorldViewWidthScaled() / 2;
- S32 y = getWorldViewHeightScaled() / 2;
-
- LLUI::getInstance()->setMousePositionScreen(x, y);
-
- //on a forced move, all deltas get zeroed out to prevent jumping
- mCurrentMousePoint.set(x,y);
- mLastMousePoint.set(x,y);
- mCurrentMouseDelta.set(0,0);
- }
+ if (! gSavedSettings.getBOOL("DisableMouseWarp"))
+ {
+ S32 x = getWorldViewWidthScaled() / 2;
+ S32 y = getWorldViewHeightScaled() / 2;
+
+ LLUI::getInstance()->setMousePositionScreen(x, y);
+
+ //on a forced move, all deltas get zeroed out to prevent jumping
+ mCurrentMousePoint.set(x,y);
+ mLastMousePoint.set(x,y);
+ mCurrentMouseDelta.set(0,0);
+ }
}
@@ -3280,32 +3280,32 @@ void LLViewerWindow::moveCursorToCenter()
void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params)
{
- if (viewp)
- {
- if (!params.styled_message.empty())
- {
- params.styled_message.add().text("\n---------\n");
- }
- LLView::root_to_view_iterator_t end_tooltip_it = viewp->endRootToView();
- // NOTE: we skip "root" since it is assumed
- for (LLView::root_to_view_iterator_t tooltip_it = ++viewp->beginRootToView();
- tooltip_it != end_tooltip_it;
- ++tooltip_it)
- {
- LLView* viewp = *tooltip_it;
-
- params.styled_message.add().text(viewp->getName());
-
- LLPanel* panelp = dynamic_cast<LLPanel*>(viewp);
- if (panelp && !panelp->getXMLFilename().empty())
- {
- params.styled_message.add()
- .text("(" + panelp->getXMLFilename() + ")")
- .style.color(LLColor4(0.7f, 0.7f, 1.f, 1.f));
- }
- params.styled_message.add().text("/");
- }
- }
+ if (viewp)
+ {
+ if (!params.styled_message.empty())
+ {
+ params.styled_message.add().text("\n---------\n");
+ }
+ LLView::root_to_view_iterator_t end_tooltip_it = viewp->endRootToView();
+ // NOTE: we skip "root" since it is assumed
+ for (LLView::root_to_view_iterator_t tooltip_it = ++viewp->beginRootToView();
+ tooltip_it != end_tooltip_it;
+ ++tooltip_it)
+ {
+ LLView* viewp = *tooltip_it;
+
+ params.styled_message.add().text(viewp->getName());
+
+ LLPanel* panelp = dynamic_cast<LLPanel*>(viewp);
+ if (panelp && !panelp->getXMLFilename().empty())
+ {
+ params.styled_message.add()
+ .text("(" + panelp->getXMLFilename() + ")")
+ .style.color(LLColor4(0.7f, 0.7f, 1.f, 1.f));
+ }
+ params.styled_message.add().text("/");
+ }
+ }
}
static LLTrace::BlockTimerStatHandle ftm("Update UI");
@@ -3314,920 +3314,920 @@ static LLTrace::BlockTimerStatHandle ftm("Update UI");
// event processing.
void LLViewerWindow::updateUI()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(ftm);
-
- static std::string last_handle_msg;
-
- if (gLoggedInTime.getStarted())
- {
- if (gLoggedInTime.getElapsedTimeF32() > gSavedSettings.getF32("DestinationGuideHintTimeout"))
- {
- LLFirstUse::notUsingDestinationGuide();
- }
- if (gLoggedInTime.getElapsedTimeF32() > gSavedSettings.getF32("SidePanelHintTimeout"))
- {
- LLFirstUse::notUsingSidePanel();
- }
- }
-
- LLConsole::updateClass();
-
- // animate layout stacks so we have up to date rect for world view
- LLLayoutStack::updateClass();
-
- // use full window for world view when not rendering UI
- bool world_view_uses_full_window = gAgentCamera.cameraMouselook() || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
- updateWorldViewRect(world_view_uses_full_window);
-
- LLView::sMouseHandlerMessage.clear();
-
- S32 x = mCurrentMousePoint.mX;
- S32 y = mCurrentMousePoint.mY;
-
- MASK mask = gKeyboard->currentMask(TRUE);
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST))
- {
- gDebugRaycastFaceHit = -1;
- gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, FALSE,
- &gDebugRaycastFaceHit,
- &gDebugRaycastIntersection,
- &gDebugRaycastTexCoord,
- &gDebugRaycastNormal,
- &gDebugRaycastTangent,
- &gDebugRaycastStart,
- &gDebugRaycastEnd);
-
- gDebugRaycastParticle = gPipeline.lineSegmentIntersectParticle(gDebugRaycastStart, gDebugRaycastEnd, &gDebugRaycastParticleIntersection, NULL);
- }
-
- updateMouseDelta();
- updateKeyboardFocus();
-
- BOOL handled = FALSE;
-
- LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
- LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
- LLView* captor_view = dynamic_cast<LLView*>(mouse_captor);
-
- //FIXME: only include captor and captor's ancestors if mouse is truly over them --RN
-
- //build set of views containing mouse cursor by traversing UI hierarchy and testing
- //screen rect against mouse cursor
- view_handle_set_t mouse_hover_set;
-
- // constraint mouse enter events to children of mouse captor
- LLView* root_view = captor_view;
-
- // if mouse captor doesn't exist or isn't a LLView
- // then allow mouse enter events on entire UI hierarchy
- if (!root_view)
- {
- root_view = mRootView;
- }
-
- static LLCachedControl<bool> dump_menu_holder(gSavedSettings, "DumpMenuHolderSize", false);
- if (dump_menu_holder)
- {
- static bool init = false;
- static LLFrameTimer child_count_timer;
- static std::vector <std::string> child_vec;
- if (!init)
- {
- child_count_timer.resetWithExpiry(5.f);
- init = true;
- }
- if (child_count_timer.hasExpired())
- {
- LL_INFOS() << "gMenuHolder child count: " << gMenuHolder->getChildCount() << LL_ENDL;
- std::vector<std::string> local_child_vec;
- LLView::child_list_t child_list = *gMenuHolder->getChildList();
- for (auto child : child_list)
- {
- local_child_vec.emplace_back(child->getName());
- }
- if (!local_child_vec.empty() && local_child_vec != child_vec)
- {
- std::vector<std::string> out_vec;
- std::sort(local_child_vec.begin(), local_child_vec.end());
- std::sort(child_vec.begin(), child_vec.end());
- std::set_difference(child_vec.begin(), child_vec.end(), local_child_vec.begin(), local_child_vec.end(), std::inserter(out_vec, out_vec.begin()));
- if (!out_vec.empty())
- {
- LL_INFOS() << "gMenuHolder removal diff size: '"<<out_vec.size() <<"' begin_child_diff";
- for (auto str : out_vec)
- {
- LL_CONT << " : " << str;
- }
- LL_CONT << " : end_child_diff" << LL_ENDL;
- }
-
- out_vec.clear();
- std::set_difference(local_child_vec.begin(), local_child_vec.end(), child_vec.begin(), child_vec.end(), std::inserter(out_vec, out_vec.begin()));
- if (!out_vec.empty())
- {
- LL_INFOS() << "gMenuHolder addition diff size: '" << out_vec.size() << "' begin_child_diff";
- for (auto str : out_vec)
- {
- LL_CONT << " : " << str;
- }
- LL_CONT << " : end_child_diff" << LL_ENDL;
- }
- child_vec.swap(local_child_vec);
- }
- child_count_timer.resetWithExpiry(5.f);
- }
- }
-
- // only update mouse hover set when UI is visible (since we shouldn't send hover events to invisible UI
- if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
- {
- // include all ancestors of captor_view as automatically having mouse
- if (captor_view)
- {
- LLView* captor_parent_view = captor_view->getParent();
- while(captor_parent_view)
- {
- mouse_hover_set.insert(captor_parent_view->getHandle());
- captor_parent_view = captor_parent_view->getParent();
- }
- }
-
- // aggregate visible views that contain mouse cursor in display order
- LLPopupView::popup_list_t popups = mPopupView->getCurrentPopups();
-
- for(LLPopupView::popup_list_t::iterator popup_it = popups.begin(); popup_it != popups.end(); ++popup_it)
- {
- LLView* popup = popup_it->get();
- if (popup && popup->calcScreenBoundingRect().pointInRect(x, y))
- {
- // iterator over contents of top_ctrl, and throw into mouse_hover_set
- for (LLView::tree_iterator_t it = popup->beginTreeDFS();
- it != popup->endTreeDFS();
- ++it)
- {
- LLView* viewp = *it;
- if (viewp->getVisible()
- && viewp->calcScreenBoundingRect().pointInRect(x, y))
- {
- // we have a view that contains the mouse, add it to the set
- mouse_hover_set.insert(viewp->getHandle());
- }
- else
- {
- // skip this view and all of its children
- it.skipDescendants();
- }
- }
- }
- }
-
- // while the top_ctrl contains the mouse cursor, only it and its descendants will receive onMouseEnter events
- if (top_ctrl && top_ctrl->calcScreenBoundingRect().pointInRect(x, y))
- {
- // iterator over contents of top_ctrl, and throw into mouse_hover_set
- for (LLView::tree_iterator_t it = top_ctrl->beginTreeDFS();
- it != top_ctrl->endTreeDFS();
- ++it)
- {
- LLView* viewp = *it;
- if (viewp->getVisible()
- && viewp->calcScreenBoundingRect().pointInRect(x, y))
- {
- // we have a view that contains the mouse, add it to the set
- mouse_hover_set.insert(viewp->getHandle());
- }
- else
- {
- // skip this view and all of its children
- it.skipDescendants();
- }
- }
- }
- else
- {
- // walk UI tree in depth-first order
- for (LLView::tree_iterator_t it = root_view->beginTreeDFS();
- it != root_view->endTreeDFS();
- ++it)
- {
- LLView* viewp = *it;
- // calculating the screen rect involves traversing the parent, so this is less than optimal
- if (viewp->getVisible()
- && viewp->calcScreenBoundingRect().pointInRect(x, y))
- {
-
- // if this view is mouse opaque, nothing behind it should be in mouse_hover_set
- if (viewp->getMouseOpaque())
- {
- // constrain further iteration to children of this widget
- it = viewp->beginTreeDFS();
- }
-
- // we have a view that contains the mouse, add it to the set
- mouse_hover_set.insert(viewp->getHandle());
- }
- else
- {
- // skip this view and all of its children
- it.skipDescendants();
- }
- }
- }
- }
-
- typedef std::vector<LLHandle<LLView> > view_handle_list_t;
-
- // call onMouseEnter() on all views which contain the mouse cursor but did not before
- view_handle_list_t mouse_enter_views;
- std::set_difference(mouse_hover_set.begin(), mouse_hover_set.end(),
- mMouseHoverViews.begin(), mMouseHoverViews.end(),
- std::back_inserter(mouse_enter_views));
- for (view_handle_list_t::iterator it = mouse_enter_views.begin();
- it != mouse_enter_views.end();
- ++it)
- {
- LLView* viewp = it->get();
- if (viewp)
- {
- LLRect view_screen_rect = viewp->calcScreenRect();
- viewp->onMouseEnter(x - view_screen_rect.mLeft, y - view_screen_rect.mBottom, mask);
- }
- }
-
- // call onMouseLeave() on all views which no longer contain the mouse cursor
- view_handle_list_t mouse_leave_views;
- std::set_difference(mMouseHoverViews.begin(), mMouseHoverViews.end(),
- mouse_hover_set.begin(), mouse_hover_set.end(),
- std::back_inserter(mouse_leave_views));
- for (view_handle_list_t::iterator it = mouse_leave_views.begin();
- it != mouse_leave_views.end();
- ++it)
- {
- LLView* viewp = it->get();
- if (viewp)
- {
- LLRect view_screen_rect = viewp->calcScreenRect();
- viewp->onMouseLeave(x - view_screen_rect.mLeft, y - view_screen_rect.mBottom, mask);
- }
- }
-
- // store resulting hover set for next frame
- swap(mMouseHoverViews, mouse_hover_set);
-
- // only handle hover events when UI is enabled
- if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
- {
-
- if( mouse_captor )
- {
- // Pass hover events to object capturing mouse events.
- S32 local_x;
- S32 local_y;
- mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
- handled = mouse_captor->handleHover(local_x, local_y, mask);
- if (LLView::sDebugMouseHandling)
- {
- LL_INFOS() << "Hover handled by captor " << mouse_captor->getName() << LL_ENDL;
- }
-
- if( !handled )
- {
- LL_DEBUGS("UserInput") << "hover not handled by mouse captor" << LL_ENDL;
- }
- }
- else
- {
- if (top_ctrl)
- {
- S32 local_x, local_y;
- top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
- handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask);
- }
-
- if ( !handled )
- {
- // x and y are from last time mouse was in window
- // mMouseInWindow tracks *actual* mouse location
- if (mMouseInWindow && mRootView->handleHover(x, y, mask) )
- {
- if (LLView::sDebugMouseHandling && LLView::sMouseHandlerMessage != last_handle_msg)
- {
- last_handle_msg = LLView::sMouseHandlerMessage;
- LL_INFOS() << "Hover" << LLView::sMouseHandlerMessage << LL_ENDL;
- }
- handled = TRUE;
- }
- else if (LLView::sDebugMouseHandling)
- {
- if (last_handle_msg != LLStringUtil::null)
- {
- last_handle_msg.clear();
- LL_INFOS() << "Hover not handled by view" << LL_ENDL;
- }
- }
- }
-
- if (!handled)
- {
- LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
-
- if(mMouseInWindow && tool)
- {
- handled = tool->handleHover(x, y, mask);
- }
- }
- }
-
- // Show a new tool tip (or update one that is already shown)
- BOOL tool_tip_handled = FALSE;
- std::string tool_tip_msg;
- if( handled
- && !mWindow->isCursorHidden())
- {
- LLRect screen_sticky_rect = mRootView->getLocalRect();
- S32 local_x, local_y;
-
- static LLCachedControl<bool> debug_show_xui_names(gSavedSettings, "DebugShowXUINames", 0);
- if (debug_show_xui_names)
- {
- LLToolTip::Params params;
-
- LLView* tooltip_view = mRootView;
- LLView::tree_iterator_t end_it = mRootView->endTreeDFS();
- for (LLView::tree_iterator_t it = mRootView->beginTreeDFS(); it != end_it; ++it)
- {
- LLView* viewp = *it;
- LLRect screen_rect;
- viewp->localRectToScreen(viewp->getLocalRect(), &screen_rect);
- if (!(viewp->getVisible()
- && screen_rect.pointInRect(x, y)))
- {
- it.skipDescendants();
- }
- // only report xui names for LLUICtrls,
- // and blacklist the various containers we don't care about
- else if (dynamic_cast<LLUICtrl*>(viewp)
- && viewp != gMenuHolder
- && viewp != gFloaterView
- && viewp != gConsole)
- {
- if (dynamic_cast<LLFloater*>(viewp))
- {
- // constrain search to descendants of this (frontmost) floater
- // by resetting iterator
- it = viewp->beginTreeDFS();
- }
-
- // if we are in a new part of the tree (not a descendent of current tooltip_view)
- // then push the results for tooltip_view and start with a new potential view
- // NOTE: this emulates visiting only the leaf nodes that meet our criteria
- if (!viewp->hasAncestor(tooltip_view))
- {
- append_xui_tooltip(tooltip_view, params);
- screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
- }
- tooltip_view = viewp;
- }
- }
-
- append_xui_tooltip(tooltip_view, params);
- params.styled_message.add().text("\n");
-
- screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
-
- params.sticky_rect = screen_sticky_rect;
- params.max_width = 400;
-
- LLToolTipMgr::instance().show(params);
- }
- // if there is a mouse captor, nothing else gets a tooltip
- else if (mouse_captor)
- {
- mouse_captor->screenPointToLocal(x, y, &local_x, &local_y);
- tool_tip_handled = mouse_captor->handleToolTip(local_x, local_y, mask);
- }
- else
- {
- // next is top_ctrl
- if (!tool_tip_handled && top_ctrl)
- {
- top_ctrl->screenPointToLocal(x, y, &local_x, &local_y);
- tool_tip_handled = top_ctrl->handleToolTip(local_x, local_y, mask );
- }
-
- if (!tool_tip_handled)
- {
- local_x = x; local_y = y;
- tool_tip_handled = mRootView->handleToolTip(local_x, local_y, mask );
- }
-
- LLTool* current_tool = LLToolMgr::getInstance()->getCurrentTool();
- if (!tool_tip_handled && current_tool)
- {
- current_tool->screenPointToLocal(x, y, &local_x, &local_y);
- tool_tip_handled = current_tool->handleToolTip(local_x, local_y, mask );
- }
- }
- }
- }
- else
- { // just have tools handle hover when UI is turned off
- LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
-
- if(mMouseInWindow && tool)
- {
- handled = tool->handleHover(x, y, mask);
- }
- }
-
- updateLayout();
-
- mLastMousePoint = mCurrentMousePoint;
-
- // cleanup unused selections when no modal dialogs are open
- if (LLModalDialog::activeCount() == 0)
- {
- LLViewerParcelMgr::getInstance()->deselectUnused();
- }
-
- if (LLModalDialog::activeCount() == 0)
- {
- LLSelectMgr::getInstance()->deselectUnused();
- }
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(ftm);
+
+ static std::string last_handle_msg;
+
+ if (gLoggedInTime.getStarted())
+ {
+ if (gLoggedInTime.getElapsedTimeF32() > gSavedSettings.getF32("DestinationGuideHintTimeout"))
+ {
+ LLFirstUse::notUsingDestinationGuide();
+ }
+ if (gLoggedInTime.getElapsedTimeF32() > gSavedSettings.getF32("SidePanelHintTimeout"))
+ {
+ LLFirstUse::notUsingSidePanel();
+ }
+ }
+
+ LLConsole::updateClass();
+
+ // animate layout stacks so we have up to date rect for world view
+ LLLayoutStack::updateClass();
+
+ // use full window for world view when not rendering UI
+ bool world_view_uses_full_window = gAgentCamera.cameraMouselook() || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
+ updateWorldViewRect(world_view_uses_full_window);
+
+ LLView::sMouseHandlerMessage.clear();
+
+ S32 x = mCurrentMousePoint.mX;
+ S32 y = mCurrentMousePoint.mY;
+
+ MASK mask = gKeyboard->currentMask(TRUE);
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST))
+ {
+ gDebugRaycastFaceHit = -1;
+ gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, FALSE,
+ &gDebugRaycastFaceHit,
+ &gDebugRaycastIntersection,
+ &gDebugRaycastTexCoord,
+ &gDebugRaycastNormal,
+ &gDebugRaycastTangent,
+ &gDebugRaycastStart,
+ &gDebugRaycastEnd);
+
+ gDebugRaycastParticle = gPipeline.lineSegmentIntersectParticle(gDebugRaycastStart, gDebugRaycastEnd, &gDebugRaycastParticleIntersection, NULL);
+ }
+
+ updateMouseDelta();
+ updateKeyboardFocus();
+
+ BOOL handled = FALSE;
+
+ LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
+ LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
+ LLView* captor_view = dynamic_cast<LLView*>(mouse_captor);
+
+ //FIXME: only include captor and captor's ancestors if mouse is truly over them --RN
+
+ //build set of views containing mouse cursor by traversing UI hierarchy and testing
+ //screen rect against mouse cursor
+ view_handle_set_t mouse_hover_set;
+
+ // constraint mouse enter events to children of mouse captor
+ LLView* root_view = captor_view;
+
+ // if mouse captor doesn't exist or isn't a LLView
+ // then allow mouse enter events on entire UI hierarchy
+ if (!root_view)
+ {
+ root_view = mRootView;
+ }
+
+ static LLCachedControl<bool> dump_menu_holder(gSavedSettings, "DumpMenuHolderSize", false);
+ if (dump_menu_holder)
+ {
+ static bool init = false;
+ static LLFrameTimer child_count_timer;
+ static std::vector <std::string> child_vec;
+ if (!init)
+ {
+ child_count_timer.resetWithExpiry(5.f);
+ init = true;
+ }
+ if (child_count_timer.hasExpired())
+ {
+ LL_INFOS() << "gMenuHolder child count: " << gMenuHolder->getChildCount() << LL_ENDL;
+ std::vector<std::string> local_child_vec;
+ LLView::child_list_t child_list = *gMenuHolder->getChildList();
+ for (auto child : child_list)
+ {
+ local_child_vec.emplace_back(child->getName());
+ }
+ if (!local_child_vec.empty() && local_child_vec != child_vec)
+ {
+ std::vector<std::string> out_vec;
+ std::sort(local_child_vec.begin(), local_child_vec.end());
+ std::sort(child_vec.begin(), child_vec.end());
+ std::set_difference(child_vec.begin(), child_vec.end(), local_child_vec.begin(), local_child_vec.end(), std::inserter(out_vec, out_vec.begin()));
+ if (!out_vec.empty())
+ {
+ LL_INFOS() << "gMenuHolder removal diff size: '"<<out_vec.size() <<"' begin_child_diff";
+ for (auto str : out_vec)
+ {
+ LL_CONT << " : " << str;
+ }
+ LL_CONT << " : end_child_diff" << LL_ENDL;
+ }
+
+ out_vec.clear();
+ std::set_difference(local_child_vec.begin(), local_child_vec.end(), child_vec.begin(), child_vec.end(), std::inserter(out_vec, out_vec.begin()));
+ if (!out_vec.empty())
+ {
+ LL_INFOS() << "gMenuHolder addition diff size: '" << out_vec.size() << "' begin_child_diff";
+ for (auto str : out_vec)
+ {
+ LL_CONT << " : " << str;
+ }
+ LL_CONT << " : end_child_diff" << LL_ENDL;
+ }
+ child_vec.swap(local_child_vec);
+ }
+ child_count_timer.resetWithExpiry(5.f);
+ }
+ }
+
+ // only update mouse hover set when UI is visible (since we shouldn't send hover events to invisible UI
+ if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
+ // include all ancestors of captor_view as automatically having mouse
+ if (captor_view)
+ {
+ LLView* captor_parent_view = captor_view->getParent();
+ while(captor_parent_view)
+ {
+ mouse_hover_set.insert(captor_parent_view->getHandle());
+ captor_parent_view = captor_parent_view->getParent();
+ }
+ }
+
+ // aggregate visible views that contain mouse cursor in display order
+ LLPopupView::popup_list_t popups = mPopupView->getCurrentPopups();
+
+ for(LLPopupView::popup_list_t::iterator popup_it = popups.begin(); popup_it != popups.end(); ++popup_it)
+ {
+ LLView* popup = popup_it->get();
+ if (popup && popup->calcScreenBoundingRect().pointInRect(x, y))
+ {
+ // iterator over contents of top_ctrl, and throw into mouse_hover_set
+ for (LLView::tree_iterator_t it = popup->beginTreeDFS();
+ it != popup->endTreeDFS();
+ ++it)
+ {
+ LLView* viewp = *it;
+ if (viewp->getVisible()
+ && viewp->calcScreenBoundingRect().pointInRect(x, y))
+ {
+ // we have a view that contains the mouse, add it to the set
+ mouse_hover_set.insert(viewp->getHandle());
+ }
+ else
+ {
+ // skip this view and all of its children
+ it.skipDescendants();
+ }
+ }
+ }
+ }
+
+ // while the top_ctrl contains the mouse cursor, only it and its descendants will receive onMouseEnter events
+ if (top_ctrl && top_ctrl->calcScreenBoundingRect().pointInRect(x, y))
+ {
+ // iterator over contents of top_ctrl, and throw into mouse_hover_set
+ for (LLView::tree_iterator_t it = top_ctrl->beginTreeDFS();
+ it != top_ctrl->endTreeDFS();
+ ++it)
+ {
+ LLView* viewp = *it;
+ if (viewp->getVisible()
+ && viewp->calcScreenBoundingRect().pointInRect(x, y))
+ {
+ // we have a view that contains the mouse, add it to the set
+ mouse_hover_set.insert(viewp->getHandle());
+ }
+ else
+ {
+ // skip this view and all of its children
+ it.skipDescendants();
+ }
+ }
+ }
+ else
+ {
+ // walk UI tree in depth-first order
+ for (LLView::tree_iterator_t it = root_view->beginTreeDFS();
+ it != root_view->endTreeDFS();
+ ++it)
+ {
+ LLView* viewp = *it;
+ // calculating the screen rect involves traversing the parent, so this is less than optimal
+ if (viewp->getVisible()
+ && viewp->calcScreenBoundingRect().pointInRect(x, y))
+ {
+
+ // if this view is mouse opaque, nothing behind it should be in mouse_hover_set
+ if (viewp->getMouseOpaque())
+ {
+ // constrain further iteration to children of this widget
+ it = viewp->beginTreeDFS();
+ }
+
+ // we have a view that contains the mouse, add it to the set
+ mouse_hover_set.insert(viewp->getHandle());
+ }
+ else
+ {
+ // skip this view and all of its children
+ it.skipDescendants();
+ }
+ }
+ }
+ }
+
+ typedef std::vector<LLHandle<LLView> > view_handle_list_t;
+
+ // call onMouseEnter() on all views which contain the mouse cursor but did not before
+ view_handle_list_t mouse_enter_views;
+ std::set_difference(mouse_hover_set.begin(), mouse_hover_set.end(),
+ mMouseHoverViews.begin(), mMouseHoverViews.end(),
+ std::back_inserter(mouse_enter_views));
+ for (view_handle_list_t::iterator it = mouse_enter_views.begin();
+ it != mouse_enter_views.end();
+ ++it)
+ {
+ LLView* viewp = it->get();
+ if (viewp)
+ {
+ LLRect view_screen_rect = viewp->calcScreenRect();
+ viewp->onMouseEnter(x - view_screen_rect.mLeft, y - view_screen_rect.mBottom, mask);
+ }
+ }
+
+ // call onMouseLeave() on all views which no longer contain the mouse cursor
+ view_handle_list_t mouse_leave_views;
+ std::set_difference(mMouseHoverViews.begin(), mMouseHoverViews.end(),
+ mouse_hover_set.begin(), mouse_hover_set.end(),
+ std::back_inserter(mouse_leave_views));
+ for (view_handle_list_t::iterator it = mouse_leave_views.begin();
+ it != mouse_leave_views.end();
+ ++it)
+ {
+ LLView* viewp = it->get();
+ if (viewp)
+ {
+ LLRect view_screen_rect = viewp->calcScreenRect();
+ viewp->onMouseLeave(x - view_screen_rect.mLeft, y - view_screen_rect.mBottom, mask);
+ }
+ }
+
+ // store resulting hover set for next frame
+ swap(mMouseHoverViews, mouse_hover_set);
+
+ // only handle hover events when UI is enabled
+ if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
+
+ if( mouse_captor )
+ {
+ // Pass hover events to object capturing mouse events.
+ S32 local_x;
+ S32 local_y;
+ mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
+ handled = mouse_captor->handleHover(local_x, local_y, mask);
+ if (LLView::sDebugMouseHandling)
+ {
+ LL_INFOS() << "Hover handled by captor " << mouse_captor->getName() << LL_ENDL;
+ }
+
+ if( !handled )
+ {
+ LL_DEBUGS("UserInput") << "hover not handled by mouse captor" << LL_ENDL;
+ }
+ }
+ else
+ {
+ if (top_ctrl)
+ {
+ S32 local_x, local_y;
+ top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
+ handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask);
+ }
+
+ if ( !handled )
+ {
+ // x and y are from last time mouse was in window
+ // mMouseInWindow tracks *actual* mouse location
+ if (mMouseInWindow && mRootView->handleHover(x, y, mask) )
+ {
+ if (LLView::sDebugMouseHandling && LLView::sMouseHandlerMessage != last_handle_msg)
+ {
+ last_handle_msg = LLView::sMouseHandlerMessage;
+ LL_INFOS() << "Hover" << LLView::sMouseHandlerMessage << LL_ENDL;
+ }
+ handled = TRUE;
+ }
+ else if (LLView::sDebugMouseHandling)
+ {
+ if (last_handle_msg != LLStringUtil::null)
+ {
+ last_handle_msg.clear();
+ LL_INFOS() << "Hover not handled by view" << LL_ENDL;
+ }
+ }
+ }
+
+ if (!handled)
+ {
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
+
+ if(mMouseInWindow && tool)
+ {
+ handled = tool->handleHover(x, y, mask);
+ }
+ }
+ }
+
+ // Show a new tool tip (or update one that is already shown)
+ BOOL tool_tip_handled = FALSE;
+ std::string tool_tip_msg;
+ if( handled
+ && !mWindow->isCursorHidden())
+ {
+ LLRect screen_sticky_rect = mRootView->getLocalRect();
+ S32 local_x, local_y;
+
+ static LLCachedControl<bool> debug_show_xui_names(gSavedSettings, "DebugShowXUINames", 0);
+ if (debug_show_xui_names)
+ {
+ LLToolTip::Params params;
+
+ LLView* tooltip_view = mRootView;
+ LLView::tree_iterator_t end_it = mRootView->endTreeDFS();
+ for (LLView::tree_iterator_t it = mRootView->beginTreeDFS(); it != end_it; ++it)
+ {
+ LLView* viewp = *it;
+ LLRect screen_rect;
+ viewp->localRectToScreen(viewp->getLocalRect(), &screen_rect);
+ if (!(viewp->getVisible()
+ && screen_rect.pointInRect(x, y)))
+ {
+ it.skipDescendants();
+ }
+ // only report xui names for LLUICtrls,
+ // and blacklist the various containers we don't care about
+ else if (dynamic_cast<LLUICtrl*>(viewp)
+ && viewp != gMenuHolder
+ && viewp != gFloaterView
+ && viewp != gConsole)
+ {
+ if (dynamic_cast<LLFloater*>(viewp))
+ {
+ // constrain search to descendants of this (frontmost) floater
+ // by resetting iterator
+ it = viewp->beginTreeDFS();
+ }
+
+ // if we are in a new part of the tree (not a descendent of current tooltip_view)
+ // then push the results for tooltip_view and start with a new potential view
+ // NOTE: this emulates visiting only the leaf nodes that meet our criteria
+ if (!viewp->hasAncestor(tooltip_view))
+ {
+ append_xui_tooltip(tooltip_view, params);
+ screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
+ }
+ tooltip_view = viewp;
+ }
+ }
+
+ append_xui_tooltip(tooltip_view, params);
+ params.styled_message.add().text("\n");
+
+ screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
+
+ params.sticky_rect = screen_sticky_rect;
+ params.max_width = 400;
+
+ LLToolTipMgr::instance().show(params);
+ }
+ // if there is a mouse captor, nothing else gets a tooltip
+ else if (mouse_captor)
+ {
+ mouse_captor->screenPointToLocal(x, y, &local_x, &local_y);
+ tool_tip_handled = mouse_captor->handleToolTip(local_x, local_y, mask);
+ }
+ else
+ {
+ // next is top_ctrl
+ if (!tool_tip_handled && top_ctrl)
+ {
+ top_ctrl->screenPointToLocal(x, y, &local_x, &local_y);
+ tool_tip_handled = top_ctrl->handleToolTip(local_x, local_y, mask );
+ }
+
+ if (!tool_tip_handled)
+ {
+ local_x = x; local_y = y;
+ tool_tip_handled = mRootView->handleToolTip(local_x, local_y, mask );
+ }
+
+ LLTool* current_tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (!tool_tip_handled && current_tool)
+ {
+ current_tool->screenPointToLocal(x, y, &local_x, &local_y);
+ tool_tip_handled = current_tool->handleToolTip(local_x, local_y, mask );
+ }
+ }
+ }
+ }
+ else
+ { // just have tools handle hover when UI is turned off
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
+
+ if(mMouseInWindow && tool)
+ {
+ handled = tool->handleHover(x, y, mask);
+ }
+ }
+
+ updateLayout();
+
+ mLastMousePoint = mCurrentMousePoint;
+
+ // cleanup unused selections when no modal dialogs are open
+ if (LLModalDialog::activeCount() == 0)
+ {
+ LLViewerParcelMgr::getInstance()->deselectUnused();
+ }
+
+ if (LLModalDialog::activeCount() == 0)
+ {
+ LLSelectMgr::getInstance()->deselectUnused();
+ }
}
void LLViewerWindow::updateLayout()
{
- LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
- if (gFloaterTools != NULL
- && tool != NULL
- && tool != gToolNull
- && tool != LLToolCompInspect::getInstance()
- && tool != LLToolDragAndDrop::getInstance()
- && !gSavedSettings.getBOOL("FreezeTime"))
- {
- // Suppress the toolbox view if our source tool was the pie tool,
- // and we've overridden to something else.
- bool suppress_toolbox =
- (LLToolMgr::getInstance()->getBaseTool() == LLToolPie::getInstance()) &&
- (LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance());
-
- LLMouseHandler *captor = gFocusMgr.getMouseCapture();
- // With the null, inspect, or drag and drop tool, don't muck
- // with visibility.
-
- if (gFloaterTools->isMinimized()
- || (tool != LLToolPie::getInstance() // not default tool
- && tool != LLToolCompGun::getInstance() // not coming out of mouselook
- && !suppress_toolbox // not override in third person
- && LLToolMgr::getInstance()->getCurrentToolset()->isShowFloaterTools()
- && (!captor || dynamic_cast<LLView*>(captor) != NULL))) // not dragging
- {
- // Force floater tools to be visible (unless minimized)
- if (!gFloaterTools->getVisible())
- {
- gFloaterTools->openFloater();
- }
- // Update the location of the blue box tool popup
- LLCoordGL select_center_screen;
- MASK mask = gKeyboard->currentMask(TRUE);
- gFloaterTools->updatePopup( select_center_screen, mask );
- }
- else
- {
- gFloaterTools->setVisible(FALSE);
- }
- //gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible());
- }
-
- // Always update console
- if(gConsole)
- {
- LLRect console_rect = getChatConsoleRect();
- gConsole->reshape(console_rect.getWidth(), console_rect.getHeight());
- gConsole->setRect(console_rect);
- }
+ LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (gFloaterTools != NULL
+ && tool != NULL
+ && tool != gToolNull
+ && tool != LLToolCompInspect::getInstance()
+ && tool != LLToolDragAndDrop::getInstance()
+ && !gSavedSettings.getBOOL("FreezeTime"))
+ {
+ // Suppress the toolbox view if our source tool was the pie tool,
+ // and we've overridden to something else.
+ bool suppress_toolbox =
+ (LLToolMgr::getInstance()->getBaseTool() == LLToolPie::getInstance()) &&
+ (LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance());
+
+ LLMouseHandler *captor = gFocusMgr.getMouseCapture();
+ // With the null, inspect, or drag and drop tool, don't muck
+ // with visibility.
+
+ if (gFloaterTools->isMinimized()
+ || (tool != LLToolPie::getInstance() // not default tool
+ && tool != LLToolCompGun::getInstance() // not coming out of mouselook
+ && !suppress_toolbox // not override in third person
+ && LLToolMgr::getInstance()->getCurrentToolset()->isShowFloaterTools()
+ && (!captor || dynamic_cast<LLView*>(captor) != NULL))) // not dragging
+ {
+ // Force floater tools to be visible (unless minimized)
+ if (!gFloaterTools->getVisible())
+ {
+ gFloaterTools->openFloater();
+ }
+ // Update the location of the blue box tool popup
+ LLCoordGL select_center_screen;
+ MASK mask = gKeyboard->currentMask(TRUE);
+ gFloaterTools->updatePopup( select_center_screen, mask );
+ }
+ else
+ {
+ gFloaterTools->setVisible(FALSE);
+ }
+ //gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible());
+ }
+
+ // Always update console
+ if(gConsole)
+ {
+ LLRect console_rect = getChatConsoleRect();
+ gConsole->reshape(console_rect.getWidth(), console_rect.getHeight());
+ gConsole->setRect(console_rect);
+ }
}
void LLViewerWindow::updateMouseDelta()
{
#if LL_WINDOWS
- LLCoordCommon delta;
+ LLCoordCommon delta;
mWindow->getCursorDelta(&delta);
S32 dx = delta.mX;
S32 dy = delta.mY;
#else
- S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::getScaleFactor().mV[VX]);
- S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::getScaleFactor().mV[VY]);
+ S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::getScaleFactor().mV[VX]);
+ S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::getScaleFactor().mV[VY]);
#endif
- //RN: fix for asynchronous notification of mouse leaving window not working
- LLCoordWindow mouse_pos;
- mWindow->getCursorPosition(&mouse_pos);
- if (mouse_pos.mX < 0 ||
- mouse_pos.mY < 0 ||
- mouse_pos.mX > mWindowRectRaw.getWidth() ||
- mouse_pos.mY > mWindowRectRaw.getHeight())
- {
- mMouseInWindow = FALSE;
- }
- else
- {
- mMouseInWindow = TRUE;
- }
-
- LLVector2 mouse_vel;
-
- if (gSavedSettings.getBOOL("MouseSmooth"))
- {
- static F32 fdx = 0.f;
- static F32 fdy = 0.f;
-
- F32 amount = 16.f;
- fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds.value()*amount,1.f);
- fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds.value()*amount,1.f);
-
- mCurrentMouseDelta.set(ll_round(fdx), ll_round(fdy));
- mouse_vel.setVec(fdx,fdy);
- }
- else
- {
- mCurrentMouseDelta.set(dx, dy);
- mouse_vel.setVec((F32) dx, (F32) dy);
- }
-
- sample(sMouseVelocityStat, mouse_vel.magVec());
+ //RN: fix for asynchronous notification of mouse leaving window not working
+ LLCoordWindow mouse_pos;
+ mWindow->getCursorPosition(&mouse_pos);
+ if (mouse_pos.mX < 0 ||
+ mouse_pos.mY < 0 ||
+ mouse_pos.mX > mWindowRectRaw.getWidth() ||
+ mouse_pos.mY > mWindowRectRaw.getHeight())
+ {
+ mMouseInWindow = FALSE;
+ }
+ else
+ {
+ mMouseInWindow = TRUE;
+ }
+
+ LLVector2 mouse_vel;
+
+ if (gSavedSettings.getBOOL("MouseSmooth"))
+ {
+ static F32 fdx = 0.f;
+ static F32 fdy = 0.f;
+
+ F32 amount = 16.f;
+ fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds.value()*amount,1.f);
+ fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds.value()*amount,1.f);
+
+ mCurrentMouseDelta.set(ll_round(fdx), ll_round(fdy));
+ mouse_vel.setVec(fdx,fdy);
+ }
+ else
+ {
+ mCurrentMouseDelta.set(dx, dy);
+ mouse_vel.setVec((F32) dx, (F32) dy);
+ }
+
+ sample(sMouseVelocityStat, mouse_vel.magVec());
}
void LLViewerWindow::updateKeyboardFocus()
{
- if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
- {
- gFocusMgr.setKeyboardFocus(NULL);
- }
-
- // clean up current focus
- LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- if (cur_focus)
- {
- if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain())
- {
+ if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+
+ // clean up current focus
+ LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
+ if (cur_focus)
+ {
+ if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain())
+ {
// don't release focus, just reassign so that if being given
// to a sibling won't call onFocusLost on all the ancestors
- // gFocusMgr.releaseFocusIfNeeded(cur_focus);
-
- LLUICtrl* parent = cur_focus->getParentUICtrl();
- const LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
- bool new_focus_found = false;
- while(parent)
- {
- if (parent->isCtrl()
- && (parent->hasTabStop() || parent == focus_root)
- && !parent->getIsChrome()
- && parent->isInVisibleChain()
- && parent->isInEnabledChain())
- {
- if (!parent->focusFirstItem())
- {
- parent->setFocus(TRUE);
- }
- new_focus_found = true;
- break;
- }
- parent = parent->getParentUICtrl();
- }
-
- // if we didn't find a better place to put focus, just release it
- // hasFocus() will return true if and only if we didn't touch focus since we
- // are only moving focus higher in the hierarchy
- if (!new_focus_found)
- {
- cur_focus->setFocus(FALSE);
- }
- }
- else if (cur_focus->isFocusRoot())
- {
- // focus roots keep trying to delegate focus to their first valid descendant
- // this assumes that focus roots are not valid focus holders on their own
- cur_focus->focusFirstItem();
- }
- }
-
- // last ditch force of edit menu to selection manager
- if (LLEditMenuHandler::gEditMenuHandler == NULL && LLSelectMgr::getInstance()->getSelection()->getObjectCount())
- {
- LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
- }
-
- if (gFloaterView->getCycleMode())
- {
- // sync all floaters with their focus state
- gFloaterView->highlightFocusedFloater();
- gSnapshotFloaterView->highlightFocusedFloater();
- MASK mask = gKeyboard->currentMask(TRUE);
- if ((mask & MASK_CONTROL) == 0)
- {
- // control key no longer held down, finish cycle mode
- gFloaterView->setCycleMode(FALSE);
-
- gFloaterView->syncFloaterTabOrder();
- }
- else
- {
- // user holding down CTRL, don't update tab order of floaters
- }
- }
- else
- {
- // update focused floater
- gFloaterView->highlightFocusedFloater();
- gSnapshotFloaterView->highlightFocusedFloater();
- // make sure floater visible order is in sync with tab order
- gFloaterView->syncFloaterTabOrder();
- }
+ // gFocusMgr.releaseFocusIfNeeded(cur_focus);
+
+ LLUICtrl* parent = cur_focus->getParentUICtrl();
+ const LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
+ bool new_focus_found = false;
+ while(parent)
+ {
+ if (parent->isCtrl()
+ && (parent->hasTabStop() || parent == focus_root)
+ && !parent->getIsChrome()
+ && parent->isInVisibleChain()
+ && parent->isInEnabledChain())
+ {
+ if (!parent->focusFirstItem())
+ {
+ parent->setFocus(TRUE);
+ }
+ new_focus_found = true;
+ break;
+ }
+ parent = parent->getParentUICtrl();
+ }
+
+ // if we didn't find a better place to put focus, just release it
+ // hasFocus() will return true if and only if we didn't touch focus since we
+ // are only moving focus higher in the hierarchy
+ if (!new_focus_found)
+ {
+ cur_focus->setFocus(FALSE);
+ }
+ }
+ else if (cur_focus->isFocusRoot())
+ {
+ // focus roots keep trying to delegate focus to their first valid descendant
+ // this assumes that focus roots are not valid focus holders on their own
+ cur_focus->focusFirstItem();
+ }
+ }
+
+ // last ditch force of edit menu to selection manager
+ if (LLEditMenuHandler::gEditMenuHandler == NULL && LLSelectMgr::getInstance()->getSelection()->getObjectCount())
+ {
+ LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance();
+ }
+
+ if (gFloaterView->getCycleMode())
+ {
+ // sync all floaters with their focus state
+ gFloaterView->highlightFocusedFloater();
+ gSnapshotFloaterView->highlightFocusedFloater();
+ MASK mask = gKeyboard->currentMask(TRUE);
+ if ((mask & MASK_CONTROL) == 0)
+ {
+ // control key no longer held down, finish cycle mode
+ gFloaterView->setCycleMode(FALSE);
+
+ gFloaterView->syncFloaterTabOrder();
+ }
+ else
+ {
+ // user holding down CTRL, don't update tab order of floaters
+ }
+ }
+ else
+ {
+ // update focused floater
+ gFloaterView->highlightFocusedFloater();
+ gSnapshotFloaterView->highlightFocusedFloater();
+ // make sure floater visible order is in sync with tab order
+ gFloaterView->syncFloaterTabOrder();
+ }
}
static LLTrace::BlockTimerStatHandle FTM_UPDATE_WORLD_VIEW("Update World View");
void LLViewerWindow::updateWorldViewRect(bool use_full_window)
{
- LL_RECORD_BLOCK_TIME(FTM_UPDATE_WORLD_VIEW);
-
- // start off using whole window to render world
- LLRect new_world_rect = mWindowRectRaw;
+ LL_RECORD_BLOCK_TIME(FTM_UPDATE_WORLD_VIEW);
- if (use_full_window == false && mWorldViewPlaceholder.get())
- {
- new_world_rect = mWorldViewPlaceholder.get()->calcScreenRect();
- // clamp to at least a 1x1 rect so we don't try to allocate zero width gl buffers
- new_world_rect.mTop = llmax(new_world_rect.mTop, new_world_rect.mBottom + 1);
- new_world_rect.mRight = llmax(new_world_rect.mRight, new_world_rect.mLeft + 1);
+ // start off using whole window to render world
+ LLRect new_world_rect = mWindowRectRaw;
- new_world_rect.mLeft = ll_round((F32)new_world_rect.mLeft * mDisplayScale.mV[VX]);
- new_world_rect.mRight = ll_round((F32)new_world_rect.mRight * mDisplayScale.mV[VX]);
- new_world_rect.mBottom = ll_round((F32)new_world_rect.mBottom * mDisplayScale.mV[VY]);
- new_world_rect.mTop = ll_round((F32)new_world_rect.mTop * mDisplayScale.mV[VY]);
- }
+ if (use_full_window == false && mWorldViewPlaceholder.get())
+ {
+ new_world_rect = mWorldViewPlaceholder.get()->calcScreenRect();
+ // clamp to at least a 1x1 rect so we don't try to allocate zero width gl buffers
+ new_world_rect.mTop = llmax(new_world_rect.mTop, new_world_rect.mBottom + 1);
+ new_world_rect.mRight = llmax(new_world_rect.mRight, new_world_rect.mLeft + 1);
+
+ new_world_rect.mLeft = ll_round((F32)new_world_rect.mLeft * mDisplayScale.mV[VX]);
+ new_world_rect.mRight = ll_round((F32)new_world_rect.mRight * mDisplayScale.mV[VX]);
+ new_world_rect.mBottom = ll_round((F32)new_world_rect.mBottom * mDisplayScale.mV[VY]);
+ new_world_rect.mTop = ll_round((F32)new_world_rect.mTop * mDisplayScale.mV[VY]);
+ }
- if (mWorldViewRectRaw != new_world_rect)
- {
- mWorldViewRectRaw = new_world_rect;
- gResizeScreenTexture = TRUE;
- LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
- LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
+ if (mWorldViewRectRaw != new_world_rect)
+ {
+ mWorldViewRectRaw = new_world_rect;
+ gResizeScreenTexture = TRUE;
+ LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
+ LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
- LLRect old_world_rect_scaled = mWorldViewRectScaled;
- mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale);
+ LLRect old_world_rect_scaled = mWorldViewRectScaled;
+ mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale);
- // sending a signal with a new WorldView rect
- mOnWorldViewRectUpdated(old_world_rect_scaled, mWorldViewRectScaled);
- }
+ // sending a signal with a new WorldView rect
+ mOnWorldViewRectUpdated(old_world_rect_scaled, mWorldViewRectScaled);
+ }
}
void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
{
- // Store last mouse location.
- // If mouse leaves window, pretend last point was on edge of window
-
- if (point.mX < 0)
- {
- mCurrentMousePoint.mX = 0;
- }
- else if (point.mX > getWindowWidthScaled())
- {
- mCurrentMousePoint.mX = getWindowWidthScaled();
- }
- else
- {
- mCurrentMousePoint.mX = point.mX;
- }
-
- if (point.mY < 0)
- {
- mCurrentMousePoint.mY = 0;
- }
- else if (point.mY > getWindowHeightScaled() )
- {
- mCurrentMousePoint.mY = getWindowHeightScaled();
- }
- else
- {
- mCurrentMousePoint.mY = point.mY;
- }
+ // Store last mouse location.
+ // If mouse leaves window, pretend last point was on edge of window
+
+ if (point.mX < 0)
+ {
+ mCurrentMousePoint.mX = 0;
+ }
+ else if (point.mX > getWindowWidthScaled())
+ {
+ mCurrentMousePoint.mX = getWindowWidthScaled();
+ }
+ else
+ {
+ mCurrentMousePoint.mX = point.mX;
+ }
+
+ if (point.mY < 0)
+ {
+ mCurrentMousePoint.mY = 0;
+ }
+ else if (point.mY > getWindowHeightScaled() )
+ {
+ mCurrentMousePoint.mY = getWindowHeightScaled();
+ }
+ else
+ {
+ mCurrentMousePoint.mY = point.mY;
+ }
}
// Draws the selection outlines for the currently selected objects
// Must be called after displayObjects is called, which sets the mGLName parameter
// NOTE: This function gets called 3 times:
-// render_ui_3d: FALSE, FALSE, TRUE
-// render_hud_elements: FALSE, FALSE, FALSE
+// render_ui_3d: FALSE, FALSE, TRUE
+// render_hud_elements: FALSE, FALSE, FALSE
void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud )
{
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
-
- if (!for_hud && !for_gl_pick)
- {
- // Call this once and only once
- LLSelectMgr::getInstance()->updateSilhouettes();
- }
-
- // Draw fence around land selections
- if (for_gl_pick)
- {
- if (pick_parcel_walls)
- {
- LLViewerParcelMgr::getInstance()->renderParcelCollision();
- }
- }
- else if (( for_hud && selection->getSelectType() == SELECT_TYPE_HUD) ||
- (!for_hud && selection->getSelectType() != SELECT_TYPE_HUD))
- {
- LLSelectMgr::getInstance()->renderSilhouettes(for_hud);
-
- stop_glerror();
-
- // setup HUD render
- if (selection->getSelectType() == SELECT_TYPE_HUD && LLSelectMgr::getInstance()->getSelection()->getObjectCount())
- {
- LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
-
- // set up transform to encompass bounding box of HUD
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadIdentity();
- F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
- gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.loadIdentity();
- gGL.loadMatrix(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
- gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
- }
-
- // Render light for editing
- if (LLSelectMgr::sRenderLightRadius && LLToolMgr::getInstance()->inEdit())
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLEnable gls_blend(GL_BLEND);
- LLGLEnable gls_cull(GL_CULL_FACE);
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- if (selection->getSelectType() == SELECT_TYPE_HUD)
- {
- F32 zoom = gAgentCamera.mHUDCurZoom;
- gGL.scalef(zoom, zoom, zoom);
- }
-
- struct f : public LLSelectedObjectFunctor
- {
- virtual bool apply(LLViewerObject* object)
- {
- LLDrawable* drawable = object->mDrawable;
- if (drawable && drawable->isLight())
- {
- LLVOVolume* vovolume = drawable->getVOVolume();
- gGL.pushMatrix();
-
- LLVector3 center = drawable->getPositionAgent();
- gGL.translatef(center[0], center[1], center[2]);
- F32 scale = vovolume->getLightRadius();
- gGL.scalef(scale, scale, scale);
-
- LLColor4 color(vovolume->getLightSRGBColor(), .5f);
- gGL.color4fv(color.mV);
-
- //F32 pixel_area = 100000.f;
- // Render Outside
- gSphere.render();
-
- // Render Inside
- glCullFace(GL_FRONT);
- gSphere.render();
- glCullFace(GL_BACK);
-
- gGL.popMatrix();
- }
- return true;
- }
- } func;
- LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func);
-
- gGL.popMatrix();
- }
-
- // NOTE: The average position for the axis arrows of the selected objects should
- // not be recalculated at this time. If they are, then group rotations will break.
-
- // Draw arrows at average center of all selected objects
- LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
- if (tool)
- {
- if(tool->isAlwaysRendered())
- {
- tool->render();
- }
- else
- {
- if( !LLSelectMgr::getInstance()->getSelection()->isEmpty() )
- {
- bool all_selected_objects_move;
- bool all_selected_objects_modify;
- // Note: This might be costly to do on each frame and when a lot of objects are selected
- // we might be better off with some kind of memory for selection and/or states, consider
- // optimizing, perhaps even some kind of selection generation at level of LLSelectMgr to
- // make whole viewer benefit.
- LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(all_selected_objects_move, all_selected_objects_modify);
-
- BOOL draw_handles = TRUE;
-
- if (tool == LLToolCompTranslate::getInstance() && !all_selected_objects_move && !LLSelectMgr::getInstance()->isMovableAvatarSelected())
- {
- draw_handles = FALSE;
- }
-
- if (tool == LLToolCompRotate::getInstance() && !all_selected_objects_move && !LLSelectMgr::getInstance()->isMovableAvatarSelected())
- {
- draw_handles = FALSE;
- }
-
- if ( !all_selected_objects_modify && tool == LLToolCompScale::getInstance() )
- {
- draw_handles = FALSE;
- }
-
- if( draw_handles )
- {
- tool->render();
- }
- }
- }
- if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount())
- {
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
- stop_glerror();
- }
- }
- }
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+
+ if (!for_hud && !for_gl_pick)
+ {
+ // Call this once and only once
+ LLSelectMgr::getInstance()->updateSilhouettes();
+ }
+
+ // Draw fence around land selections
+ if (for_gl_pick)
+ {
+ if (pick_parcel_walls)
+ {
+ LLViewerParcelMgr::getInstance()->renderParcelCollision();
+ }
+ }
+ else if (( for_hud && selection->getSelectType() == SELECT_TYPE_HUD) ||
+ (!for_hud && selection->getSelectType() != SELECT_TYPE_HUD))
+ {
+ LLSelectMgr::getInstance()->renderSilhouettes(for_hud);
+
+ stop_glerror();
+
+ // setup HUD render
+ if (selection->getSelectType() == SELECT_TYPE_HUD && LLSelectMgr::getInstance()->getSelection()->getObjectCount())
+ {
+ LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
+
+ // set up transform to encompass bounding box of HUD
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
+ gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.loadMatrix(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
+ gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
+ }
+
+ // Render light for editing
+ if (LLSelectMgr::sRenderLightRadius && LLToolMgr::getInstance()->inEdit())
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLEnable gls_blend(GL_BLEND);
+ LLGLEnable gls_cull(GL_CULL_FACE);
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ if (selection->getSelectType() == SELECT_TYPE_HUD)
+ {
+ F32 zoom = gAgentCamera.mHUDCurZoom;
+ gGL.scalef(zoom, zoom, zoom);
+ }
+
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* object)
+ {
+ LLDrawable* drawable = object->mDrawable;
+ if (drawable && drawable->isLight())
+ {
+ LLVOVolume* vovolume = drawable->getVOVolume();
+ gGL.pushMatrix();
+
+ LLVector3 center = drawable->getPositionAgent();
+ gGL.translatef(center[0], center[1], center[2]);
+ F32 scale = vovolume->getLightRadius();
+ gGL.scalef(scale, scale, scale);
+
+ LLColor4 color(vovolume->getLightSRGBColor(), .5f);
+ gGL.color4fv(color.mV);
+
+ //F32 pixel_area = 100000.f;
+ // Render Outside
+ gSphere.render();
+
+ // Render Inside
+ glCullFace(GL_FRONT);
+ gSphere.render();
+ glCullFace(GL_BACK);
+
+ gGL.popMatrix();
+ }
+ return true;
+ }
+ } func;
+ LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func);
+
+ gGL.popMatrix();
+ }
+
+ // NOTE: The average position for the axis arrows of the selected objects should
+ // not be recalculated at this time. If they are, then group rotations will break.
+
+ // Draw arrows at average center of all selected objects
+ LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (tool)
+ {
+ if(tool->isAlwaysRendered())
+ {
+ tool->render();
+ }
+ else
+ {
+ if( !LLSelectMgr::getInstance()->getSelection()->isEmpty() )
+ {
+ bool all_selected_objects_move;
+ bool all_selected_objects_modify;
+ // Note: This might be costly to do on each frame and when a lot of objects are selected
+ // we might be better off with some kind of memory for selection and/or states, consider
+ // optimizing, perhaps even some kind of selection generation at level of LLSelectMgr to
+ // make whole viewer benefit.
+ LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(all_selected_objects_move, all_selected_objects_modify);
+
+ BOOL draw_handles = TRUE;
+
+ if (tool == LLToolCompTranslate::getInstance() && !all_selected_objects_move && !LLSelectMgr::getInstance()->isMovableAvatarSelected())
+ {
+ draw_handles = FALSE;
+ }
+
+ if (tool == LLToolCompRotate::getInstance() && !all_selected_objects_move && !LLSelectMgr::getInstance()->isMovableAvatarSelected())
+ {
+ draw_handles = FALSE;
+ }
+
+ if ( !all_selected_objects_modify && tool == LLToolCompScale::getInstance() )
+ {
+ draw_handles = FALSE;
+ }
+
+ if( draw_handles )
+ {
+ tool->render();
+ }
+ }
+ }
+ if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount())
+ {
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+ stop_glerror();
+ }
+ }
+ }
}
// Return a point near the clicked object representative of the place the object was clicked.
LLVector3d LLViewerWindow::clickPointInWorldGlobal(S32 x, S32 y_from_bot, LLViewerObject* clicked_object) const
{
- // create a normalized vector pointing from the camera center into the
- // world at the location of the mouse click
- LLVector3 mouse_direction_global = mouseDirectionGlobal( x, y_from_bot );
+ // create a normalized vector pointing from the camera center into the
+ // world at the location of the mouse click
+ LLVector3 mouse_direction_global = mouseDirectionGlobal( x, y_from_bot );
- LLVector3d relative_object = clicked_object->getPositionGlobal() - gAgentCamera.getCameraPositionGlobal();
+ LLVector3d relative_object = clicked_object->getPositionGlobal() - gAgentCamera.getCameraPositionGlobal();
- // make mouse vector as long as object vector, so it touchs a point near
- // where the user clicked on the object
- mouse_direction_global *= (F32) relative_object.magVec();
+ // make mouse vector as long as object vector, so it touchs a point near
+ // where the user clicked on the object
+ mouse_direction_global *= (F32) relative_object.magVec();
- LLVector3d new_pos;
- new_pos.setVec(mouse_direction_global);
- // transform mouse vector back to world coords
- new_pos += gAgentCamera.getCameraPositionGlobal();
+ LLVector3d new_pos;
+ new_pos.setVec(mouse_direction_global);
+ // transform mouse vector back to world coords
+ new_pos += gAgentCamera.getCameraPositionGlobal();
- return new_pos;
+ return new_pos;
}
BOOL LLViewerWindow::clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewerObject *objectp, LLVector3d &point_global) const
{
- BOOL intersect = FALSE;
+ BOOL intersect = FALSE;
-// U8 shape = objectp->mPrimitiveCode & LL_PCODE_BASE_MASK;
- if (!intersect)
- {
- point_global = clickPointInWorldGlobal(x, y, objectp);
- LL_INFOS() << "approx intersection at " << (objectp->getPositionGlobal() - point_global) << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "good intersection at " << (objectp->getPositionGlobal() - point_global) << LL_ENDL;
- }
+// U8 shape = objectp->mPrimitiveCode & LL_PCODE_BASE_MASK;
+ if (!intersect)
+ {
+ point_global = clickPointInWorldGlobal(x, y, objectp);
+ LL_INFOS() << "approx intersection at " << (objectp->getPositionGlobal() - point_global) << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "good intersection at " << (objectp->getPositionGlobal() - point_global) << LL_ENDL;
+ }
- return intersect;
+ return intersect;
}
void LLViewerWindow::pickAsync( S32 x,
- S32 y_from_bot,
- MASK mask,
- void (*callback)(const LLPickInfo& info),
- BOOL pick_transparent,
- BOOL pick_rigged,
- BOOL pick_unselectable,
+ S32 y_from_bot,
+ MASK mask,
+ void (*callback)(const LLPickInfo& info),
+ BOOL pick_transparent,
+ BOOL pick_rigged,
+ BOOL pick_unselectable,
BOOL pick_reflection_probes)
{
- // "Show Debug Alpha" means no object actually transparent
+ // "Show Debug Alpha" means no object actually transparent
BOOL in_build_mode = LLFloaterReg::instanceVisible("build");
if (LLDrawPoolAlpha::sShowDebugAlpha
|| (in_build_mode && gSavedSettings.getBOOL("SelectInvisibleObjects")))
@@ -4235,585 +4235,585 @@ void LLViewerWindow::pickAsync( S32 x,
pick_transparent = TRUE;
}
- LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, pick_rigged, FALSE, pick_reflection_probes, pick_unselectable, TRUE, callback);
- schedulePick(pick_info);
+ LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, pick_rigged, FALSE, pick_reflection_probes, pick_unselectable, TRUE, callback);
+ schedulePick(pick_info);
}
void LLViewerWindow::schedulePick(LLPickInfo& pick_info)
{
- if (mPicks.size() >= 1024 || mWindow->getMinimized())
- { //something went wrong, picks are being scheduled but not processed
-
- if (pick_info.mPickCallback)
- {
- pick_info.mPickCallback(pick_info);
- }
-
- return;
- }
- mPicks.push_back(pick_info);
-
- // delay further event processing until we receive results of pick
- // only do this for async picks so that handleMouseUp won't be called
- // until the pick triggered in handleMouseDown has been processed, for example
- mWindow->delayInputProcessing();
+ if (mPicks.size() >= 1024 || mWindow->getMinimized())
+ { //something went wrong, picks are being scheduled but not processed
+
+ if (pick_info.mPickCallback)
+ {
+ pick_info.mPickCallback(pick_info);
+ }
+
+ return;
+ }
+ mPicks.push_back(pick_info);
+
+ // delay further event processing until we receive results of pick
+ // only do this for async picks so that handleMouseUp won't be called
+ // until the pick triggered in handleMouseDown has been processed, for example
+ mWindow->delayInputProcessing();
}
void LLViewerWindow::performPick()
{
- if (!mPicks.empty())
- {
- std::vector<LLPickInfo>::iterator pick_it;
- for (pick_it = mPicks.begin(); pick_it != mPicks.end(); ++pick_it)
- {
- pick_it->fetchResults();
- }
+ if (!mPicks.empty())
+ {
+ std::vector<LLPickInfo>::iterator pick_it;
+ for (pick_it = mPicks.begin(); pick_it != mPicks.end(); ++pick_it)
+ {
+ pick_it->fetchResults();
+ }
- mLastPick = mPicks.back();
- mPicks.clear();
- }
+ mLastPick = mPicks.back();
+ mPicks.clear();
+ }
}
void LLViewerWindow::returnEmptyPicks()
{
- std::vector<LLPickInfo>::iterator pick_it;
- for (pick_it = mPicks.begin(); pick_it != mPicks.end(); ++pick_it)
- {
- mLastPick = *pick_it;
- // just trigger callback with empty results
- if (pick_it->mPickCallback)
- {
- pick_it->mPickCallback(*pick_it);
- }
- }
- mPicks.clear();
+ std::vector<LLPickInfo>::iterator pick_it;
+ for (pick_it = mPicks.begin(); pick_it != mPicks.end(); ++pick_it)
+ {
+ mLastPick = *pick_it;
+ // just trigger callback with empty results
+ if (pick_it->mPickCallback)
+ {
+ pick_it->mPickCallback(*pick_it);
+ }
+ }
+ mPicks.clear();
}
// Performs the GL object/land pick.
LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_particle, BOOL pick_unselectable, BOOL pick_reflection_probe)
{
- BOOL in_build_mode = LLFloaterReg::instanceVisible("build");
- if ((in_build_mode && gSavedSettings.getBOOL("SelectInvisibleObjects")) || LLDrawPoolAlpha::sShowDebugAlpha)
- {
- // build mode allows interaction with all transparent objects
- // "Show Debug Alpha" means no object actually transparent
- pick_transparent = TRUE;
- }
-
- // shortcut queueing in mPicks and just update mLastPick in place
- MASK key_mask = gKeyboard->currentMask(TRUE);
- mLastPick = LLPickInfo(LLCoordGL(x, y_from_bot), key_mask, pick_transparent, pick_rigged, pick_particle, pick_reflection_probe, TRUE, FALSE, NULL);
- mLastPick.fetchResults();
+ BOOL in_build_mode = LLFloaterReg::instanceVisible("build");
+ if ((in_build_mode && gSavedSettings.getBOOL("SelectInvisibleObjects")) || LLDrawPoolAlpha::sShowDebugAlpha)
+ {
+ // build mode allows interaction with all transparent objects
+ // "Show Debug Alpha" means no object actually transparent
+ pick_transparent = TRUE;
+ }
+
+ // shortcut queueing in mPicks and just update mLastPick in place
+ MASK key_mask = gKeyboard->currentMask(TRUE);
+ mLastPick = LLPickInfo(LLCoordGL(x, y_from_bot), key_mask, pick_transparent, pick_rigged, pick_particle, pick_reflection_probe, TRUE, FALSE, NULL);
+ mLastPick.fetchResults();
- return mLastPick;
+ return mLastPick;
}
LLHUDIcon* LLViewerWindow::cursorIntersectIcon(S32 mouse_x, S32 mouse_y, F32 depth,
- LLVector4a* intersection)
+ LLVector4a* intersection)
{
- S32 x = mouse_x;
- S32 y = mouse_y;
+ S32 x = mouse_x;
+ S32 y = mouse_y;
+
+ if ((mouse_x == -1) && (mouse_y == -1)) // use current mouse position
+ {
+ x = getCurrentMouseX();
+ y = getCurrentMouseY();
+ }
- if ((mouse_x == -1) && (mouse_y == -1)) // use current mouse position
- {
- x = getCurrentMouseX();
- y = getCurrentMouseY();
- }
+ // world coordinates of mouse
+ // VECTORIZE THIS
+ LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y);
+ LLVector3 mouse_point_global = LLViewerCamera::getInstance()->getOrigin();
+ LLVector3 mouse_world_start = mouse_point_global;
+ LLVector3 mouse_world_end = mouse_point_global + mouse_direction_global * depth;
- // world coordinates of mouse
- // VECTORIZE THIS
- LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y);
- LLVector3 mouse_point_global = LLViewerCamera::getInstance()->getOrigin();
- LLVector3 mouse_world_start = mouse_point_global;
- LLVector3 mouse_world_end = mouse_point_global + mouse_direction_global * depth;
+ LLVector4a start, end;
+ start.load3(mouse_world_start.mV);
+ end.load3(mouse_world_end.mV);
- LLVector4a start, end;
- start.load3(mouse_world_start.mV);
- end.load3(mouse_world_end.mV);
-
- return LLHUDIcon::lineSegmentIntersectAll(start, end, intersection);
+ return LLHUDIcon::lineSegmentIntersectAll(start, end, intersection);
}
LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 depth,
- LLViewerObject *this_object,
- S32 this_face,
- BOOL pick_transparent,
- BOOL pick_rigged,
+ LLViewerObject *this_object,
+ S32 this_face,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
BOOL pick_unselectable,
BOOL pick_reflection_probe,
- S32* face_hit,
- LLVector4a *intersection,
- LLVector2 *uv,
- LLVector4a *normal,
- LLVector4a *tangent,
- LLVector4a* start,
- LLVector4a* end)
-{
- S32 x = mouse_x;
- S32 y = mouse_y;
-
- if ((mouse_x == -1) && (mouse_y == -1)) // use current mouse position
- {
- x = getCurrentMouseX();
- y = getCurrentMouseY();
- }
-
- // HUD coordinates of mouse
- LLVector3 mouse_point_hud = mousePointHUD(x, y);
- LLVector3 mouse_hud_start = mouse_point_hud - LLVector3(depth, 0, 0);
- LLVector3 mouse_hud_end = mouse_point_hud + LLVector3(depth, 0, 0);
-
- // world coordinates of mouse
- LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y);
- LLVector3 mouse_point_global = LLViewerCamera::getInstance()->getOrigin();
-
- //get near clip plane
- LLVector3 n = LLViewerCamera::getInstance()->getAtAxis();
- LLVector3 p = mouse_point_global + n * LLViewerCamera::getInstance()->getNear();
-
- //project mouse point onto plane
- LLVector3 pos;
- line_plane(mouse_point_global, mouse_direction_global, p, n, pos);
- mouse_point_global = pos;
-
- LLVector3 mouse_world_start = mouse_point_global;
- LLVector3 mouse_world_end = mouse_point_global + mouse_direction_global * depth;
-
- if (!LLViewerJoystick::getInstance()->getOverrideCamera())
- { //always set raycast intersection to mouse_world_end unless
- //flycam is on (for DoF effect)
- gDebugRaycastIntersection.load3(mouse_world_end.mV);
- }
-
- LLVector4a mw_start;
- mw_start.load3(mouse_world_start.mV);
- LLVector4a mw_end;
- mw_end.load3(mouse_world_end.mV);
-
- LLVector4a mh_start;
- mh_start.load3(mouse_hud_start.mV);
- LLVector4a mh_end;
- mh_end.load3(mouse_hud_end.mV);
-
- if (start)
- {
- *start = mw_start;
- }
-
- if (end)
- {
- *end = mw_end;
- }
-
- LLViewerObject* found = NULL;
-
- if (this_object) // check only this object
- {
- if (this_object->isHUDAttachment()) // is a HUD object?
- {
- if (this_object->lineSegmentIntersect(mh_start, mh_end, this_face, pick_transparent, pick_rigged, pick_unselectable,
- face_hit, intersection, uv, normal, tangent))
- {
- found = this_object;
- }
- }
- else // is a world object
- {
+ S32* face_hit,
+ LLVector4a *intersection,
+ LLVector2 *uv,
+ LLVector4a *normal,
+ LLVector4a *tangent,
+ LLVector4a* start,
+ LLVector4a* end)
+{
+ S32 x = mouse_x;
+ S32 y = mouse_y;
+
+ if ((mouse_x == -1) && (mouse_y == -1)) // use current mouse position
+ {
+ x = getCurrentMouseX();
+ y = getCurrentMouseY();
+ }
+
+ // HUD coordinates of mouse
+ LLVector3 mouse_point_hud = mousePointHUD(x, y);
+ LLVector3 mouse_hud_start = mouse_point_hud - LLVector3(depth, 0, 0);
+ LLVector3 mouse_hud_end = mouse_point_hud + LLVector3(depth, 0, 0);
+
+ // world coordinates of mouse
+ LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y);
+ LLVector3 mouse_point_global = LLViewerCamera::getInstance()->getOrigin();
+
+ //get near clip plane
+ LLVector3 n = LLViewerCamera::getInstance()->getAtAxis();
+ LLVector3 p = mouse_point_global + n * LLViewerCamera::getInstance()->getNear();
+
+ //project mouse point onto plane
+ LLVector3 pos;
+ line_plane(mouse_point_global, mouse_direction_global, p, n, pos);
+ mouse_point_global = pos;
+
+ LLVector3 mouse_world_start = mouse_point_global;
+ LLVector3 mouse_world_end = mouse_point_global + mouse_direction_global * depth;
+
+ if (!LLViewerJoystick::getInstance()->getOverrideCamera())
+ { //always set raycast intersection to mouse_world_end unless
+ //flycam is on (for DoF effect)
+ gDebugRaycastIntersection.load3(mouse_world_end.mV);
+ }
+
+ LLVector4a mw_start;
+ mw_start.load3(mouse_world_start.mV);
+ LLVector4a mw_end;
+ mw_end.load3(mouse_world_end.mV);
+
+ LLVector4a mh_start;
+ mh_start.load3(mouse_hud_start.mV);
+ LLVector4a mh_end;
+ mh_end.load3(mouse_hud_end.mV);
+
+ if (start)
+ {
+ *start = mw_start;
+ }
+
+ if (end)
+ {
+ *end = mw_end;
+ }
+
+ LLViewerObject* found = NULL;
+
+ if (this_object) // check only this object
+ {
+ if (this_object->isHUDAttachment()) // is a HUD object?
+ {
+ if (this_object->lineSegmentIntersect(mh_start, mh_end, this_face, pick_transparent, pick_rigged, pick_unselectable,
+ face_hit, intersection, uv, normal, tangent))
+ {
+ found = this_object;
+ }
+ }
+ else // is a world object
+ {
if ((pick_reflection_probe || !this_object->isReflectionProbe())
&& this_object->lineSegmentIntersect(mw_start, mw_end, this_face, pick_transparent, pick_rigged, pick_unselectable,
- face_hit, intersection, uv, normal, tangent))
- {
- found = this_object;
- }
- }
- }
- else // check ALL objects
- {
- found = gPipeline.lineSegmentIntersectInHUD(mh_start, mh_end, pick_transparent,
- face_hit, intersection, uv, normal, tangent);
-
- if (!found) // if not found in HUD, look in world:
- {
- found = gPipeline.lineSegmentIntersectInWorld(mw_start, mw_end, pick_transparent, pick_rigged, pick_unselectable, pick_reflection_probe,
- face_hit, intersection, uv, normal, tangent);
- if (found && !pick_transparent)
- {
- gDebugRaycastIntersection = *intersection;
- }
- }
- }
-
- return found;
+ face_hit, intersection, uv, normal, tangent))
+ {
+ found = this_object;
+ }
+ }
+ }
+ else // check ALL objects
+ {
+ found = gPipeline.lineSegmentIntersectInHUD(mh_start, mh_end, pick_transparent,
+ face_hit, intersection, uv, normal, tangent);
+
+ if (!found) // if not found in HUD, look in world:
+ {
+ found = gPipeline.lineSegmentIntersectInWorld(mw_start, mw_end, pick_transparent, pick_rigged, pick_unselectable, pick_reflection_probe,
+ face_hit, intersection, uv, normal, tangent);
+ if (found && !pick_transparent)
+ {
+ gDebugRaycastIntersection = *intersection;
+ }
+ }
+ }
+
+ return found;
}
// Returns unit vector relative to camera
// indicating direction of point on screen x,y
LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
{
- // find vertical field of view
- F32 fov = LLViewerCamera::getInstance()->getView();
+ // find vertical field of view
+ F32 fov = LLViewerCamera::getInstance()->getView();
- // find world view center in scaled ui coordinates
- F32 center_x = getWorldViewRectScaled().getCenterX();
- F32 center_y = getWorldViewRectScaled().getCenterY();
+ // find world view center in scaled ui coordinates
+ F32 center_x = getWorldViewRectScaled().getCenterX();
+ F32 center_y = getWorldViewRectScaled().getCenterY();
- // calculate pixel distance to screen
- F32 distance = ((F32)getWorldViewHeightScaled() * 0.5f) / (tan(fov / 2.f));
+ // calculate pixel distance to screen
+ F32 distance = ((F32)getWorldViewHeightScaled() * 0.5f) / (tan(fov / 2.f));
- // calculate click point relative to middle of screen
- F32 click_x = x - center_x;
- F32 click_y = y - center_y;
+ // calculate click point relative to middle of screen
+ F32 click_x = x - center_x;
+ F32 click_y = y - center_y;
- // compute mouse vector
- LLVector3 mouse_vector = distance * LLViewerCamera::getInstance()->getAtAxis()
- - click_x * LLViewerCamera::getInstance()->getLeftAxis()
- + click_y * LLViewerCamera::getInstance()->getUpAxis();
+ // compute mouse vector
+ LLVector3 mouse_vector = distance * LLViewerCamera::getInstance()->getAtAxis()
+ - click_x * LLViewerCamera::getInstance()->getLeftAxis()
+ + click_y * LLViewerCamera::getInstance()->getUpAxis();
- mouse_vector.normVec();
+ mouse_vector.normVec();
- return mouse_vector;
+ return mouse_vector;
}
LLVector3 LLViewerWindow::mousePointHUD(const S32 x, const S32 y) const
{
- // find screen resolution
- S32 height = getWorldViewHeightScaled();
+ // find screen resolution
+ S32 height = getWorldViewHeightScaled();
- // find world view center
- F32 center_x = getWorldViewRectScaled().getCenterX();
- F32 center_y = getWorldViewRectScaled().getCenterY();
+ // find world view center
+ F32 center_x = getWorldViewRectScaled().getCenterX();
+ F32 center_y = getWorldViewRectScaled().getCenterY();
- // remap with uniform scale (1/height) so that top is -0.5, bottom is +0.5
- F32 hud_x = -((F32)x - center_x) / height;
- F32 hud_y = ((F32)y - center_y) / height;
+ // remap with uniform scale (1/height) so that top is -0.5, bottom is +0.5
+ F32 hud_x = -((F32)x - center_x) / height;
+ F32 hud_y = ((F32)y - center_y) / height;
- return LLVector3(0.f, hud_x/gAgentCamera.mHUDCurZoom, hud_y/gAgentCamera.mHUDCurZoom);
+ return LLVector3(0.f, hud_x/gAgentCamera.mHUDCurZoom, hud_y/gAgentCamera.mHUDCurZoom);
}
// Returns unit vector relative to camera in camera space
// indicating direction of point on screen x,y
LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const
{
- // find vertical field of view
- F32 fov_height = LLViewerCamera::getInstance()->getView();
- F32 fov_width = fov_height * LLViewerCamera::getInstance()->getAspect();
+ // find vertical field of view
+ F32 fov_height = LLViewerCamera::getInstance()->getView();
+ F32 fov_width = fov_height * LLViewerCamera::getInstance()->getAspect();
- // find screen resolution
- S32 height = getWorldViewHeightScaled();
- S32 width = getWorldViewWidthScaled();
+ // find screen resolution
+ S32 height = getWorldViewHeightScaled();
+ S32 width = getWorldViewWidthScaled();
- // find world view center
- F32 center_x = getWorldViewRectScaled().getCenterX();
- F32 center_y = getWorldViewRectScaled().getCenterY();
+ // find world view center
+ F32 center_x = getWorldViewRectScaled().getCenterX();
+ F32 center_y = getWorldViewRectScaled().getCenterY();
- // calculate click point relative to middle of screen
- F32 click_x = (((F32)x - center_x) / (F32)width) * fov_width * -1.f;
- F32 click_y = (((F32)y - center_y) / (F32)height) * fov_height;
+ // calculate click point relative to middle of screen
+ F32 click_x = (((F32)x - center_x) / (F32)width) * fov_width * -1.f;
+ F32 click_y = (((F32)y - center_y) / (F32)height) * fov_height;
- // compute mouse vector
- LLVector3 mouse_vector = LLVector3(0.f, 0.f, -1.f);
- LLQuaternion mouse_rotate;
- mouse_rotate.setQuat(click_y, click_x, 0.f);
+ // compute mouse vector
+ LLVector3 mouse_vector = LLVector3(0.f, 0.f, -1.f);
+ LLQuaternion mouse_rotate;
+ mouse_rotate.setQuat(click_y, click_x, 0.f);
- mouse_vector = mouse_vector * mouse_rotate;
- // project to z = -1 plane;
- mouse_vector = mouse_vector * (-1.f / mouse_vector.mV[VZ]);
+ mouse_vector = mouse_vector * mouse_rotate;
+ // project to z = -1 plane;
+ mouse_vector = mouse_vector * (-1.f / mouse_vector.mV[VZ]);
- return mouse_vector;
+ return mouse_vector;
}
-BOOL LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, const S32 y,
- const LLVector3d &plane_point_global,
- const LLVector3 &plane_normal_global)
+BOOL LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, const S32 y,
+ const LLVector3d &plane_point_global,
+ const LLVector3 &plane_normal_global)
{
- LLVector3d mouse_direction_global_d;
+ LLVector3d mouse_direction_global_d;
- mouse_direction_global_d.setVec(mouseDirectionGlobal(x,y));
- LLVector3d plane_normal_global_d;
- plane_normal_global_d.setVec(plane_normal_global);
- F64 plane_mouse_dot = (plane_normal_global_d * mouse_direction_global_d);
- LLVector3d plane_origin_camera_rel = plane_point_global - gAgentCamera.getCameraPositionGlobal();
- F64 mouse_look_at_scale = (plane_normal_global_d * plane_origin_camera_rel)
- / plane_mouse_dot;
- if (llabs(plane_mouse_dot) < 0.00001)
- {
- // if mouse is parallel to plane, return closest point on line through plane origin
- // that is parallel to camera plane by scaling mouse direction vector
- // by distance to plane origin, modulated by deviation of mouse direction from plane origin
- LLVector3d plane_origin_dir = plane_origin_camera_rel;
- plane_origin_dir.normVec();
-
- mouse_look_at_scale = plane_origin_camera_rel.magVec() / (plane_origin_dir * mouse_direction_global_d);
- }
+ mouse_direction_global_d.setVec(mouseDirectionGlobal(x,y));
+ LLVector3d plane_normal_global_d;
+ plane_normal_global_d.setVec(plane_normal_global);
+ F64 plane_mouse_dot = (plane_normal_global_d * mouse_direction_global_d);
+ LLVector3d plane_origin_camera_rel = plane_point_global - gAgentCamera.getCameraPositionGlobal();
+ F64 mouse_look_at_scale = (plane_normal_global_d * plane_origin_camera_rel)
+ / plane_mouse_dot;
+ if (llabs(plane_mouse_dot) < 0.00001)
+ {
+ // if mouse is parallel to plane, return closest point on line through plane origin
+ // that is parallel to camera plane by scaling mouse direction vector
+ // by distance to plane origin, modulated by deviation of mouse direction from plane origin
+ LLVector3d plane_origin_dir = plane_origin_camera_rel;
+ plane_origin_dir.normVec();
+
+ mouse_look_at_scale = plane_origin_camera_rel.magVec() / (plane_origin_dir * mouse_direction_global_d);
+ }
- point = gAgentCamera.getCameraPositionGlobal() + mouse_look_at_scale * mouse_direction_global_d;
+ point = gAgentCamera.getCameraPositionGlobal() + mouse_look_at_scale * mouse_direction_global_d;
- return mouse_look_at_scale > 0.0;
+ return mouse_look_at_scale > 0.0;
}
// Returns global position
BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_position_global, BOOL ignore_distance)
{
- LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y);
- F32 mouse_dir_scale;
- BOOL hit_land = FALSE;
- LLViewerRegion *regionp;
- F32 land_z;
- const F32 FIRST_PASS_STEP = 1.0f; // meters
- const F32 SECOND_PASS_STEP = 0.1f; // meters
- const F32 draw_distance = ignore_distance ? MAX_FAR_CLIP : gAgentCamera.mDrawDistance;
- LLVector3d camera_pos_global;
-
- camera_pos_global = gAgentCamera.getCameraPositionGlobal();
- LLVector3d probe_point_global;
- LLVector3 probe_point_region;
-
- // walk forwards to find the point
- for (mouse_dir_scale = FIRST_PASS_STEP; mouse_dir_scale < draw_distance; mouse_dir_scale += FIRST_PASS_STEP)
- {
- LLVector3d mouse_direction_global_d;
- mouse_direction_global_d.setVec(mouse_direction_global * mouse_dir_scale);
- probe_point_global = camera_pos_global + mouse_direction_global_d;
-
- regionp = LLWorld::getInstance()->resolveRegionGlobal(probe_point_region, probe_point_global);
-
- if (!regionp)
- {
- // ...we're outside the world somehow
- continue;
- }
-
- S32 i = (S32) (probe_point_region.mV[VX]/regionp->getLand().getMetersPerGrid());
- S32 j = (S32) (probe_point_region.mV[VY]/regionp->getLand().getMetersPerGrid());
- S32 grids_per_edge = (S32) regionp->getLand().mGridsPerEdge;
- if ((i >= grids_per_edge) || (j >= grids_per_edge))
- {
- //LL_INFOS() << "LLViewerWindow::mousePointOnLand probe_point is out of region" << LL_ENDL;
- continue;
- }
-
- land_z = regionp->getLand().resolveHeightRegion(probe_point_region);
-
- //LL_INFOS() << "mousePointOnLand initial z " << land_z << LL_ENDL;
-
- if (probe_point_region.mV[VZ] < land_z)
- {
- // ...just went under land
-
- // cout << "under land at " << probe_point << " scale " << mouse_vec_scale << endl;
-
- hit_land = TRUE;
- break;
- }
- }
-
-
- if (hit_land)
- {
- // Don't go more than one step beyond where we stopped above.
- // This can't just be "mouse_vec_scale" because floating point error
- // will stop the loop before the last increment.... X - 1.0 + 0.1 + 0.1 + ... + 0.1 != X
- F32 stop_mouse_dir_scale = mouse_dir_scale + FIRST_PASS_STEP;
-
- // take a step backwards, then walk forwards again to refine position
- for ( mouse_dir_scale -= FIRST_PASS_STEP; mouse_dir_scale <= stop_mouse_dir_scale; mouse_dir_scale += SECOND_PASS_STEP)
- {
- LLVector3d mouse_direction_global_d;
- mouse_direction_global_d.setVec(mouse_direction_global * mouse_dir_scale);
- probe_point_global = camera_pos_global + mouse_direction_global_d;
-
- regionp = LLWorld::getInstance()->resolveRegionGlobal(probe_point_region, probe_point_global);
-
- if (!regionp)
- {
- // ...we're outside the world somehow
- continue;
- }
-
- /*
- i = (S32) (local_probe_point.mV[VX]/regionp->getLand().getMetersPerGrid());
- j = (S32) (local_probe_point.mV[VY]/regionp->getLand().getMetersPerGrid());
- if ((i >= regionp->getLand().mGridsPerEdge) || (j >= regionp->getLand().mGridsPerEdge))
- {
- // LL_INFOS() << "LLViewerWindow::mousePointOnLand probe_point is out of region" << LL_ENDL;
- continue;
- }
- land_z = regionp->getLand().mSurfaceZ[ i + j * (regionp->getLand().mGridsPerEdge) ];
- */
-
- land_z = regionp->getLand().resolveHeightRegion(probe_point_region);
-
- //LL_INFOS() << "mousePointOnLand refine z " << land_z << LL_ENDL;
-
- if (probe_point_region.mV[VZ] < land_z)
- {
- // ...just went under land again
-
- *land_position_global = probe_point_global;
- return TRUE;
- }
- }
- }
-
- return FALSE;
+ LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y);
+ F32 mouse_dir_scale;
+ BOOL hit_land = FALSE;
+ LLViewerRegion *regionp;
+ F32 land_z;
+ const F32 FIRST_PASS_STEP = 1.0f; // meters
+ const F32 SECOND_PASS_STEP = 0.1f; // meters
+ const F32 draw_distance = ignore_distance ? MAX_FAR_CLIP : gAgentCamera.mDrawDistance;
+ LLVector3d camera_pos_global;
+
+ camera_pos_global = gAgentCamera.getCameraPositionGlobal();
+ LLVector3d probe_point_global;
+ LLVector3 probe_point_region;
+
+ // walk forwards to find the point
+ for (mouse_dir_scale = FIRST_PASS_STEP; mouse_dir_scale < draw_distance; mouse_dir_scale += FIRST_PASS_STEP)
+ {
+ LLVector3d mouse_direction_global_d;
+ mouse_direction_global_d.setVec(mouse_direction_global * mouse_dir_scale);
+ probe_point_global = camera_pos_global + mouse_direction_global_d;
+
+ regionp = LLWorld::getInstance()->resolveRegionGlobal(probe_point_region, probe_point_global);
+
+ if (!regionp)
+ {
+ // ...we're outside the world somehow
+ continue;
+ }
+
+ S32 i = (S32) (probe_point_region.mV[VX]/regionp->getLand().getMetersPerGrid());
+ S32 j = (S32) (probe_point_region.mV[VY]/regionp->getLand().getMetersPerGrid());
+ S32 grids_per_edge = (S32) regionp->getLand().mGridsPerEdge;
+ if ((i >= grids_per_edge) || (j >= grids_per_edge))
+ {
+ //LL_INFOS() << "LLViewerWindow::mousePointOnLand probe_point is out of region" << LL_ENDL;
+ continue;
+ }
+
+ land_z = regionp->getLand().resolveHeightRegion(probe_point_region);
+
+ //LL_INFOS() << "mousePointOnLand initial z " << land_z << LL_ENDL;
+
+ if (probe_point_region.mV[VZ] < land_z)
+ {
+ // ...just went under land
+
+ // cout << "under land at " << probe_point << " scale " << mouse_vec_scale << endl;
+
+ hit_land = TRUE;
+ break;
+ }
+ }
+
+
+ if (hit_land)
+ {
+ // Don't go more than one step beyond where we stopped above.
+ // This can't just be "mouse_vec_scale" because floating point error
+ // will stop the loop before the last increment.... X - 1.0 + 0.1 + 0.1 + ... + 0.1 != X
+ F32 stop_mouse_dir_scale = mouse_dir_scale + FIRST_PASS_STEP;
+
+ // take a step backwards, then walk forwards again to refine position
+ for ( mouse_dir_scale -= FIRST_PASS_STEP; mouse_dir_scale <= stop_mouse_dir_scale; mouse_dir_scale += SECOND_PASS_STEP)
+ {
+ LLVector3d mouse_direction_global_d;
+ mouse_direction_global_d.setVec(mouse_direction_global * mouse_dir_scale);
+ probe_point_global = camera_pos_global + mouse_direction_global_d;
+
+ regionp = LLWorld::getInstance()->resolveRegionGlobal(probe_point_region, probe_point_global);
+
+ if (!regionp)
+ {
+ // ...we're outside the world somehow
+ continue;
+ }
+
+ /*
+ i = (S32) (local_probe_point.mV[VX]/regionp->getLand().getMetersPerGrid());
+ j = (S32) (local_probe_point.mV[VY]/regionp->getLand().getMetersPerGrid());
+ if ((i >= regionp->getLand().mGridsPerEdge) || (j >= regionp->getLand().mGridsPerEdge))
+ {
+ // LL_INFOS() << "LLViewerWindow::mousePointOnLand probe_point is out of region" << LL_ENDL;
+ continue;
+ }
+ land_z = regionp->getLand().mSurfaceZ[ i + j * (regionp->getLand().mGridsPerEdge) ];
+ */
+
+ land_z = regionp->getLand().resolveHeightRegion(probe_point_region);
+
+ //LL_INFOS() << "mousePointOnLand refine z " << land_z << LL_ENDL;
+
+ if (probe_point_region.mV[VZ] < land_z)
+ {
+ // ...just went under land again
+
+ *land_position_global = probe_point_global;
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
}
// Saves an image to the harddrive as "SnapshotX" where X >= 1.
void LLViewerWindow::saveImageNumbered(LLImageFormatted *image, BOOL force_picker, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb)
{
- if (!image)
- {
- LL_WARNS() << "No image to save" << LL_ENDL;
- return;
- }
- std::string extension("." + image->getExtension());
- LLImageFormatted* formatted_image = image;
- // Get a base file location if needed.
- if (force_picker || !isSnapshotLocSet())
- {
- std::string proposed_name(sSnapshotBaseName);
-
- // getSaveFile will append an appropriate extension to the proposed name, based on the ESaveFilter constant passed in.
- LLFilePicker::ESaveFilter pick_type;
-
- if (extension == ".j2c")
- pick_type = LLFilePicker::FFSAVE_J2C;
- else if (extension == ".bmp")
- pick_type = LLFilePicker::FFSAVE_BMP;
- else if (extension == ".jpg")
- pick_type = LLFilePicker::FFSAVE_JPEG;
- else if (extension == ".png")
- pick_type = LLFilePicker::FFSAVE_PNG;
- else if (extension == ".tga")
- pick_type = LLFilePicker::FFSAVE_TGA;
- else
- pick_type = LLFilePicker::FFSAVE_ALL;
-
- LLFilePickerReplyThread::startPicker(boost::bind(&LLViewerWindow::onDirectorySelected, this, _1, formatted_image, success_cb, failure_cb), pick_type, proposed_name,
- boost::bind(&LLViewerWindow::onSelectionFailure, this, failure_cb));
- }
- else
- {
- saveImageLocal(formatted_image, success_cb, failure_cb);
- }
+ if (!image)
+ {
+ LL_WARNS() << "No image to save" << LL_ENDL;
+ return;
+ }
+ std::string extension("." + image->getExtension());
+ LLImageFormatted* formatted_image = image;
+ // Get a base file location if needed.
+ if (force_picker || !isSnapshotLocSet())
+ {
+ std::string proposed_name(sSnapshotBaseName);
+
+ // getSaveFile will append an appropriate extension to the proposed name, based on the ESaveFilter constant passed in.
+ LLFilePicker::ESaveFilter pick_type;
+
+ if (extension == ".j2c")
+ pick_type = LLFilePicker::FFSAVE_J2C;
+ else if (extension == ".bmp")
+ pick_type = LLFilePicker::FFSAVE_BMP;
+ else if (extension == ".jpg")
+ pick_type = LLFilePicker::FFSAVE_JPEG;
+ else if (extension == ".png")
+ pick_type = LLFilePicker::FFSAVE_PNG;
+ else if (extension == ".tga")
+ pick_type = LLFilePicker::FFSAVE_TGA;
+ else
+ pick_type = LLFilePicker::FFSAVE_ALL;
+
+ LLFilePickerReplyThread::startPicker(boost::bind(&LLViewerWindow::onDirectorySelected, this, _1, formatted_image, success_cb, failure_cb), pick_type, proposed_name,
+ boost::bind(&LLViewerWindow::onSelectionFailure, this, failure_cb));
+ }
+ else
+ {
+ saveImageLocal(formatted_image, success_cb, failure_cb);
+ }
}
void LLViewerWindow::onDirectorySelected(const std::vector<std::string>& filenames, LLImageFormatted *image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb)
{
- // Copy the directory + file name
- std::string filepath = filenames[0];
+ // Copy the directory + file name
+ std::string filepath = filenames[0];
- gSavedPerAccountSettings.setString("SnapshotBaseName", gDirUtilp->getBaseFileName(filepath, true));
- gSavedPerAccountSettings.setString("SnapshotBaseDir", gDirUtilp->getDirName(filepath));
- saveImageLocal(image, success_cb, failure_cb);
+ gSavedPerAccountSettings.setString("SnapshotBaseName", gDirUtilp->getBaseFileName(filepath, true));
+ gSavedPerAccountSettings.setString("SnapshotBaseDir", gDirUtilp->getDirName(filepath));
+ saveImageLocal(image, success_cb, failure_cb);
}
void LLViewerWindow::onSelectionFailure(const snapshot_saved_signal_t::slot_type& failure_cb)
{
- failure_cb();
+ failure_cb();
}
void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb)
{
- std::string lastSnapshotDir = LLViewerWindow::getLastSnapshotDir();
- if (lastSnapshotDir.empty())
- {
- failure_cb();
- return;
- }
+ std::string lastSnapshotDir = LLViewerWindow::getLastSnapshotDir();
+ if (lastSnapshotDir.empty())
+ {
+ failure_cb();
+ return;
+ }
// Check if there is enough free space to save snapshot
#ifdef LL_WINDOWS
- boost::filesystem::path b_path(utf8str_to_utf16str(lastSnapshotDir));
+ boost::filesystem::path b_path(utf8str_to_utf16str(lastSnapshotDir));
#else
- boost::filesystem::path b_path(lastSnapshotDir);
+ boost::filesystem::path b_path(lastSnapshotDir);
#endif
- if (!boost::filesystem::is_directory(b_path))
- {
- LLSD args;
- args["PATH"] = lastSnapshotDir;
- LLNotificationsUtil::add("SnapshotToLocalDirNotExist", args);
- resetSnapshotLoc();
- failure_cb();
- return;
- }
- boost::filesystem::space_info b_space = boost::filesystem::space(b_path);
- if (b_space.free < image->getDataSize())
- {
- LLSD args;
- args["PATH"] = lastSnapshotDir;
-
- std::string needM_bytes_string;
- LLResMgr::getInstance()->getIntegerString(needM_bytes_string, (image->getDataSize()) >> 10);
- args["NEED_MEMORY"] = needM_bytes_string;
-
- std::string freeM_bytes_string;
- LLResMgr::getInstance()->getIntegerString(freeM_bytes_string, (b_space.free) >> 10);
- args["FREE_MEMORY"] = freeM_bytes_string;
-
- LLNotificationsUtil::add("SnapshotToComputerFailed", args);
-
- failure_cb();
- }
-
- // Look for an unused file name
- BOOL is_snapshot_name_loc_set = isSnapshotLocSet();
- std::string filepath;
- S32 i = 1;
- S32 err = 0;
- std::string extension("." + image->getExtension());
- do
- {
- filepath = sSnapshotDir;
- filepath += gDirUtilp->getDirDelimiter();
- filepath += sSnapshotBaseName;
-
- if (is_snapshot_name_loc_set)
- {
- filepath += llformat("_%.3d",i);
- }
-
- filepath += extension;
-
- llstat stat_info;
- err = LLFile::stat( filepath, &stat_info );
- i++;
- }
- while( -1 != err // Search until the file is not found (i.e., stat() gives an error).
- && is_snapshot_name_loc_set); // Or stop if we are rewriting.
-
- LL_INFOS() << "Saving snapshot to " << filepath << LL_ENDL;
- if (image->save(filepath))
- {
- playSnapshotAnimAndSound();
- success_cb();
- }
- else
- {
- failure_cb();
- }
+ if (!boost::filesystem::is_directory(b_path))
+ {
+ LLSD args;
+ args["PATH"] = lastSnapshotDir;
+ LLNotificationsUtil::add("SnapshotToLocalDirNotExist", args);
+ resetSnapshotLoc();
+ failure_cb();
+ return;
+ }
+ boost::filesystem::space_info b_space = boost::filesystem::space(b_path);
+ if (b_space.free < image->getDataSize())
+ {
+ LLSD args;
+ args["PATH"] = lastSnapshotDir;
+
+ std::string needM_bytes_string;
+ LLResMgr::getInstance()->getIntegerString(needM_bytes_string, (image->getDataSize()) >> 10);
+ args["NEED_MEMORY"] = needM_bytes_string;
+
+ std::string freeM_bytes_string;
+ LLResMgr::getInstance()->getIntegerString(freeM_bytes_string, (b_space.free) >> 10);
+ args["FREE_MEMORY"] = freeM_bytes_string;
+
+ LLNotificationsUtil::add("SnapshotToComputerFailed", args);
+
+ failure_cb();
+ }
+
+ // Look for an unused file name
+ BOOL is_snapshot_name_loc_set = isSnapshotLocSet();
+ std::string filepath;
+ S32 i = 1;
+ S32 err = 0;
+ std::string extension("." + image->getExtension());
+ do
+ {
+ filepath = sSnapshotDir;
+ filepath += gDirUtilp->getDirDelimiter();
+ filepath += sSnapshotBaseName;
+
+ if (is_snapshot_name_loc_set)
+ {
+ filepath += llformat("_%.3d",i);
+ }
+
+ filepath += extension;
+
+ llstat stat_info;
+ err = LLFile::stat( filepath, &stat_info );
+ i++;
+ }
+ while( -1 != err // Search until the file is not found (i.e., stat() gives an error).
+ && is_snapshot_name_loc_set); // Or stop if we are rewriting.
+
+ LL_INFOS() << "Saving snapshot to " << filepath << LL_ENDL;
+ if (image->save(filepath))
+ {
+ playSnapshotAnimAndSound();
+ success_cb();
+ }
+ else
+ {
+ failure_cb();
+ }
}
void LLViewerWindow::resetSnapshotLoc()
{
- gSavedPerAccountSettings.setString("SnapshotBaseDir", std::string());
+ gSavedPerAccountSettings.setString("SnapshotBaseDir", std::string());
}
// static
void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
{
- LLCoordWindow size;
- LLCoordWindow new_size(new_width, new_height);
- gViewerWindow->getWindow()->getSize(&size);
- if ( size != new_size )
- {
- gViewerWindow->getWindow()->setSize(new_size);
- }
+ LLCoordWindow size;
+ LLCoordWindow new_size(new_width, new_height);
+ gViewerWindow->getWindow()->getSize(&size);
+ if ( size != new_size )
+ {
+ gViewerWindow->getWindow()->setSize(new_size);
+ }
}
BOOL LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type, LLSnapshotModel::ESnapshotFormat format)
@@ -4861,347 +4861,347 @@ BOOL LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width,
void LLViewerWindow::playSnapshotAnimAndSound()
{
- if (gSavedSettings.getBOOL("QuietSnapshotsToDisk"))
- {
- return;
- }
- gAgent.sendAnimationRequest(ANIM_AGENT_SNAPSHOT, ANIM_REQUEST_START);
- send_sound_trigger(LLUUID(gSavedSettings.getString("UISndSnapshot")), 1.0f);
+ if (gSavedSettings.getBOOL("QuietSnapshotsToDisk"))
+ {
+ return;
+ }
+ gAgent.sendAnimationRequest(ANIM_AGENT_SNAPSHOT, ANIM_REQUEST_START);
+ send_sound_trigger(LLUUID(gSavedSettings.getString("UISndSnapshot")), 1.0f);
}
BOOL LLViewerWindow::isSnapshotLocSet() const
{
- std::string snapshot_dir = sSnapshotDir;
- return !snapshot_dir.empty();
+ std::string snapshot_dir = sSnapshotDir;
+ return !snapshot_dir.empty();
}
void LLViewerWindow::resetSnapshotLoc() const
{
- gSavedPerAccountSettings.setString("SnapshotBaseDir", std::string());
+ gSavedPerAccountSettings.setString("SnapshotBaseDir", std::string());
}
BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type)
{
- return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, show_hud, do_rebuild, no_post, type);
+ return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, show_hud, do_rebuild, no_post, type);
}
// Saves the image from the screen to a raw image
// Since the required size might be bigger than the available screen, this method rerenders the scene in parts (called subimages) and copy
// the results over to the final raw image.
-BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height,
+BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height,
BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type, S32 max_size)
{
- if (!raw)
- {
- return FALSE;
- }
- //check if there is enough memory for the snapshot image
- if(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K
- {
- if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3))
- {
- LL_WARNS() << "No enough memory to take the snapshot with size (w : h): " << image_width << " : " << image_height << LL_ENDL ;
- return FALSE ; //there is no enough memory for taking this snapshot.
- }
- }
-
- // PRE SNAPSHOT
- gSnapshotNoPost = no_post;
- gDisplaySwapBuffers = FALSE;
-
+ if (!raw)
+ {
+ return FALSE;
+ }
+ //check if there is enough memory for the snapshot image
+ if(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K
+ {
+ if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3))
+ {
+ LL_WARNS() << "No enough memory to take the snapshot with size (w : h): " << image_width << " : " << image_height << LL_ENDL ;
+ return FALSE ; //there is no enough memory for taking this snapshot.
+ }
+ }
+
+ // PRE SNAPSHOT
+ gSnapshotNoPost = no_post;
+ gDisplaySwapBuffers = FALSE;
+
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT);
- setCursor(UI_CURSOR_WAIT);
+ setCursor(UI_CURSOR_WAIT);
- // Hide all the UI widgets first and draw a frame
- BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? TRUE : FALSE;
+ // Hide all the UI widgets first and draw a frame
+ BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? TRUE : FALSE;
- if ( prev_draw_ui != show_ui)
- {
- LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
- }
+ if ( prev_draw_ui != show_ui)
+ {
+ LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
+ }
BOOL hide_hud = !show_hud && LLPipeline::sShowHUDAttachments;
- if (hide_hud)
- {
- LLPipeline::sShowHUDAttachments = FALSE;
- }
-
- // if not showing ui, use full window to render world view
- updateWorldViewRect(!show_ui);
-
- // Copy screen to a buffer
- // crop sides or top and bottom, if taking a snapshot of different aspect ratio
- // from window
- LLRect window_rect = show_ui ? getWindowRectRaw() : getWorldViewRectRaw();
-
- S32 snapshot_width = window_rect.getWidth();
- S32 snapshot_height = window_rect.getHeight();
- // SNAPSHOT
- S32 window_width = snapshot_width;
- S32 window_height = snapshot_height;
-
- // Note: Scaling of the UI is currently *not* supported so we limit the output size if UI is requested
- if (show_ui)
- {
- // If the user wants the UI, limit the output size to the available screen size
- image_width = llmin(image_width, window_width);
- image_height = llmin(image_height, window_height);
- }
-
- S32 original_width = 0;
- S32 original_height = 0;
- bool reset_deferred = false;
-
- LLRenderTarget scratch_space;
-
- F32 scale_factor = 1.0f ;
- if (!keep_window_aspect || (image_width > window_width) || (image_height > window_height))
- {
- if ((image_width <= gGLManager.mGLMaxTextureSize && image_height <= gGLManager.mGLMaxTextureSize) &&
- (image_width > window_width || image_height > window_height) && LLPipeline::sRenderDeferred && !show_ui)
- {
- U32 color_fmt = type == LLSnapshotModel::SNAPSHOT_TYPE_DEPTH ? GL_DEPTH_COMPONENT : GL_RGBA;
- if (scratch_space.allocate(image_width, image_height, color_fmt, true))
- {
- original_width = gPipeline.mRT->deferredScreen.getWidth();
- original_height = gPipeline.mRT->deferredScreen.getHeight();
-
- if (gPipeline.allocateScreenBuffer(image_width, image_height))
- {
- window_width = image_width;
- window_height = image_height;
- snapshot_width = image_width;
- snapshot_height = image_height;
- reset_deferred = true;
- mWorldViewRectRaw.set(0, image_height, image_width, 0);
- LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
- LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
- scratch_space.bindTarget();
- }
- else
- {
- scratch_space.release();
- gPipeline.allocateScreenBuffer(original_width, original_height);
- }
- }
- }
-
- if (!reset_deferred)
- {
- // if image cropping or need to enlarge the scene, compute a scale_factor
- F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ;
- snapshot_width = (S32)(ratio * image_width) ;
- snapshot_height = (S32)(ratio * image_height) ;
- scale_factor = llmax(1.0f, 1.0f / ratio) ;
- }
- }
-
- if (show_ui && scale_factor > 1.f)
- {
- // Note: we should never get there...
- LL_WARNS() << "over scaling UI not supported." << LL_ENDL;
- }
-
- S32 buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f);
- S32 buffer_y_offset = llfloor(((window_height - snapshot_height) * scale_factor) / 2.f);
-
- S32 image_buffer_x = llfloor(snapshot_width * scale_factor) ;
- S32 image_buffer_y = llfloor(snapshot_height * scale_factor) ;
-
- if ((image_buffer_x > max_size) || (image_buffer_y > max_size)) // boundary check to avoid memory overflow
- {
- scale_factor *= llmin((F32)max_size / image_buffer_x, (F32)max_size / image_buffer_y) ;
- image_buffer_x = llfloor(snapshot_width * scale_factor) ;
- image_buffer_y = llfloor(snapshot_height * scale_factor) ;
- }
- if ((image_buffer_x > 0) && (image_buffer_y > 0))
- {
- raw->resize(image_buffer_x, image_buffer_y, 3);
- }
- else
- {
- return FALSE ;
- }
- if (raw->isBufferInvalid())
- {
- return FALSE ;
- }
-
- BOOL high_res = scale_factor >= 2.f; // Font scaling is slow, only do so if rez is much higher
- if (high_res && show_ui)
- {
- // Note: we should never get there...
- LL_WARNS() << "High res UI snapshot not supported. " << LL_ENDL;
- /*send_agent_pause();
- //rescale fonts
- initFonts(scale_factor);
- LLHUDObject::reshapeAll();*/
- }
-
- S32 output_buffer_offset_y = 0;
-
- F32 depth_conversion_factor_1 = (LLViewerCamera::getInstance()->getFar() + LLViewerCamera::getInstance()->getNear()) / (2.f * LLViewerCamera::getInstance()->getFar() * LLViewerCamera::getInstance()->getNear());
- F32 depth_conversion_factor_2 = (LLViewerCamera::getInstance()->getFar() - LLViewerCamera::getInstance()->getNear()) / (2.f * LLViewerCamera::getInstance()->getFar() * LLViewerCamera::getInstance()->getNear());
-
- // Subimages are in fact partial rendering of the final view. This happens when the final view is bigger than the screen.
- // In most common cases, scale_factor is 1 and there's no more than 1 iteration on x and y
- for (int subimage_y = 0; subimage_y < scale_factor; ++subimage_y)
- {
- S32 subimage_y_offset = llclamp(buffer_y_offset - (subimage_y * window_height), 0, window_height);;
- // handle fractional columns
- U32 read_height = llmax(0, (window_height - subimage_y_offset) -
- llmax(0, (window_height * (subimage_y + 1)) - (buffer_y_offset + raw->getHeight())));
-
- S32 output_buffer_offset_x = 0;
- for (int subimage_x = 0; subimage_x < scale_factor; ++subimage_x)
- {
- gDisplaySwapBuffers = FALSE;
- gDepthDirty = TRUE;
-
- S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width);
- // handle fractional rows
- U32 read_width = llmax(0, (window_width - subimage_x_offset) -
- llmax(0, (window_width * (subimage_x + 1)) - (buffer_x_offset + raw->getWidth())));
-
- // Skip rendering and sampling altogether if either width or height is degenerated to 0 (common in cropping cases)
- if (read_width && read_height)
- {
- const U32 subfield = subimage_x+(subimage_y*llceil(scale_factor));
- display(do_rebuild, scale_factor, subfield, TRUE);
-
- if (!LLPipeline::sRenderDeferred)
- {
- // Required for showing the GUI in snapshots and performing bloom composite overlay
- // Call even if show_ui is FALSE
- render_ui(scale_factor, subfield);
- swap();
- }
-
- for (U32 out_y = 0; out_y < read_height ; out_y++)
- {
- S32 output_buffer_offset = (
- (out_y * (raw->getWidth())) // ...plus iterated y...
- + (window_width * subimage_x) // ...plus subimage start in x...
- + (raw->getWidth() * window_height * subimage_y) // ...plus subimage start in y...
- - output_buffer_offset_x // ...minus buffer padding x...
- - (output_buffer_offset_y * (raw->getWidth())) // ...minus buffer padding y...
- ) * raw->getComponents();
-
- // Ping the watchdog thread every 100 lines to keep us alive (arbitrary number, feel free to change)
- if (out_y % 100 == 0)
- {
- LLAppViewer::instance()->pingMainloopTimeout("LLViewerWindow::rawSnapshot");
- }
- // disable use of glReadPixels when doing nVidia nSight graphics debugging
- if (!LLRender::sNsightDebugSupport)
- {
- if (type == LLSnapshotModel::SNAPSHOT_TYPE_COLOR)
- {
- glReadPixels(
- subimage_x_offset, out_y + subimage_y_offset,
- read_width, 1,
- GL_RGB, GL_UNSIGNED_BYTE,
- raw->getData() + output_buffer_offset
- );
- }
- else // LLSnapshotModel::SNAPSHOT_TYPE_DEPTH
- {
- LLPointer<LLImageRaw> depth_line_buffer = new LLImageRaw(read_width, 1, sizeof(GL_FLOAT)); // need to store floating point values
- glReadPixels(
- subimage_x_offset, out_y + subimage_y_offset,
- read_width, 1,
- GL_DEPTH_COMPONENT, GL_FLOAT,
- depth_line_buffer->getData()// current output pixel is beginning of buffer...
- );
-
- for (S32 i = 0; i < (S32)read_width; i++)
- {
- F32 depth_float = *(F32*)(depth_line_buffer->getData() + (i * sizeof(F32)));
-
- F32 linear_depth_float = 1.f / (depth_conversion_factor_1 - (depth_float * depth_conversion_factor_2));
- U8 depth_byte = F32_to_U8(linear_depth_float, LLViewerCamera::getInstance()->getNear(), LLViewerCamera::getInstance()->getFar());
- // write converted scanline out to result image
- for (S32 j = 0; j < raw->getComponents(); j++)
- {
- *(raw->getData() + output_buffer_offset + (i * raw->getComponents()) + j) = depth_byte;
- }
- }
- }
- }
- }
- }
- output_buffer_offset_x += subimage_x_offset;
- stop_glerror();
- }
- output_buffer_offset_y += subimage_y_offset;
- }
-
- gDisplaySwapBuffers = FALSE;
- gSnapshotNoPost = FALSE;
- gDepthDirty = TRUE;
-
- // POST SNAPSHOT
- if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
- {
- LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
- }
-
- if (hide_hud)
- {
- LLPipeline::sShowHUDAttachments = TRUE;
- }
-
- /*if (high_res)
- {
- initFonts(1.f);
- LLHUDObject::reshapeAll();
- }*/
-
- // Pre-pad image to number of pixels such that the line length is a multiple of 4 bytes (for BMP encoding)
- // Note: this formula depends on the number of components being 3. Not obvious, but it's correct.
- image_width += (image_width * 3) % 4;
-
- BOOL ret = TRUE ;
- // Resize image
- if(llabs(image_width - image_buffer_x) > 4 || llabs(image_height - image_buffer_y) > 4)
- {
- ret = raw->scale( image_width, image_height );
- }
- else if(image_width != image_buffer_x || image_height != image_buffer_y)
- {
- ret = raw->scale( image_width, image_height, FALSE );
- }
-
-
- setCursor(UI_CURSOR_ARROW);
-
- if (do_rebuild)
- {
- // If we had to do a rebuild, that means that the lists of drawables to be rendered
- // was empty before we started.
- // Need to reset these, otherwise we call state sort on it again when render gets called the next time
- // and we stand a good chance of crashing on rebuild because the render drawable arrays have multiple copies of
- // objects on them.
- gPipeline.resetDrawOrders();
- }
-
- if (reset_deferred)
- {
- mWorldViewRectRaw = window_rect;
- LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
- LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
- scratch_space.flush();
- scratch_space.release();
- gPipeline.allocateScreenBuffer(original_width, original_height);
-
- }
-
- if (high_res)
- {
- send_agent_resume();
- }
-
- return ret;
+ if (hide_hud)
+ {
+ LLPipeline::sShowHUDAttachments = FALSE;
+ }
+
+ // if not showing ui, use full window to render world view
+ updateWorldViewRect(!show_ui);
+
+ // Copy screen to a buffer
+ // crop sides or top and bottom, if taking a snapshot of different aspect ratio
+ // from window
+ LLRect window_rect = show_ui ? getWindowRectRaw() : getWorldViewRectRaw();
+
+ S32 snapshot_width = window_rect.getWidth();
+ S32 snapshot_height = window_rect.getHeight();
+ // SNAPSHOT
+ S32 window_width = snapshot_width;
+ S32 window_height = snapshot_height;
+
+ // Note: Scaling of the UI is currently *not* supported so we limit the output size if UI is requested
+ if (show_ui)
+ {
+ // If the user wants the UI, limit the output size to the available screen size
+ image_width = llmin(image_width, window_width);
+ image_height = llmin(image_height, window_height);
+ }
+
+ S32 original_width = 0;
+ S32 original_height = 0;
+ bool reset_deferred = false;
+
+ LLRenderTarget scratch_space;
+
+ F32 scale_factor = 1.0f ;
+ if (!keep_window_aspect || (image_width > window_width) || (image_height > window_height))
+ {
+ if ((image_width <= gGLManager.mGLMaxTextureSize && image_height <= gGLManager.mGLMaxTextureSize) &&
+ (image_width > window_width || image_height > window_height) && LLPipeline::sRenderDeferred && !show_ui)
+ {
+ U32 color_fmt = type == LLSnapshotModel::SNAPSHOT_TYPE_DEPTH ? GL_DEPTH_COMPONENT : GL_RGBA;
+ if (scratch_space.allocate(image_width, image_height, color_fmt, true))
+ {
+ original_width = gPipeline.mRT->deferredScreen.getWidth();
+ original_height = gPipeline.mRT->deferredScreen.getHeight();
+
+ if (gPipeline.allocateScreenBuffer(image_width, image_height))
+ {
+ window_width = image_width;
+ window_height = image_height;
+ snapshot_width = image_width;
+ snapshot_height = image_height;
+ reset_deferred = true;
+ mWorldViewRectRaw.set(0, image_height, image_width, 0);
+ LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
+ LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
+ scratch_space.bindTarget();
+ }
+ else
+ {
+ scratch_space.release();
+ gPipeline.allocateScreenBuffer(original_width, original_height);
+ }
+ }
+ }
+
+ if (!reset_deferred)
+ {
+ // if image cropping or need to enlarge the scene, compute a scale_factor
+ F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ;
+ snapshot_width = (S32)(ratio * image_width) ;
+ snapshot_height = (S32)(ratio * image_height) ;
+ scale_factor = llmax(1.0f, 1.0f / ratio) ;
+ }
+ }
+
+ if (show_ui && scale_factor > 1.f)
+ {
+ // Note: we should never get there...
+ LL_WARNS() << "over scaling UI not supported." << LL_ENDL;
+ }
+
+ S32 buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f);
+ S32 buffer_y_offset = llfloor(((window_height - snapshot_height) * scale_factor) / 2.f);
+
+ S32 image_buffer_x = llfloor(snapshot_width * scale_factor) ;
+ S32 image_buffer_y = llfloor(snapshot_height * scale_factor) ;
+
+ if ((image_buffer_x > max_size) || (image_buffer_y > max_size)) // boundary check to avoid memory overflow
+ {
+ scale_factor *= llmin((F32)max_size / image_buffer_x, (F32)max_size / image_buffer_y) ;
+ image_buffer_x = llfloor(snapshot_width * scale_factor) ;
+ image_buffer_y = llfloor(snapshot_height * scale_factor) ;
+ }
+ if ((image_buffer_x > 0) && (image_buffer_y > 0))
+ {
+ raw->resize(image_buffer_x, image_buffer_y, 3);
+ }
+ else
+ {
+ return FALSE ;
+ }
+ if (raw->isBufferInvalid())
+ {
+ return FALSE ;
+ }
+
+ BOOL high_res = scale_factor >= 2.f; // Font scaling is slow, only do so if rez is much higher
+ if (high_res && show_ui)
+ {
+ // Note: we should never get there...
+ LL_WARNS() << "High res UI snapshot not supported. " << LL_ENDL;
+ /*send_agent_pause();
+ //rescale fonts
+ initFonts(scale_factor);
+ LLHUDObject::reshapeAll();*/
+ }
+
+ S32 output_buffer_offset_y = 0;
+
+ F32 depth_conversion_factor_1 = (LLViewerCamera::getInstance()->getFar() + LLViewerCamera::getInstance()->getNear()) / (2.f * LLViewerCamera::getInstance()->getFar() * LLViewerCamera::getInstance()->getNear());
+ F32 depth_conversion_factor_2 = (LLViewerCamera::getInstance()->getFar() - LLViewerCamera::getInstance()->getNear()) / (2.f * LLViewerCamera::getInstance()->getFar() * LLViewerCamera::getInstance()->getNear());
+
+ // Subimages are in fact partial rendering of the final view. This happens when the final view is bigger than the screen.
+ // In most common cases, scale_factor is 1 and there's no more than 1 iteration on x and y
+ for (int subimage_y = 0; subimage_y < scale_factor; ++subimage_y)
+ {
+ S32 subimage_y_offset = llclamp(buffer_y_offset - (subimage_y * window_height), 0, window_height);;
+ // handle fractional columns
+ U32 read_height = llmax(0, (window_height - subimage_y_offset) -
+ llmax(0, (window_height * (subimage_y + 1)) - (buffer_y_offset + raw->getHeight())));
+
+ S32 output_buffer_offset_x = 0;
+ for (int subimage_x = 0; subimage_x < scale_factor; ++subimage_x)
+ {
+ gDisplaySwapBuffers = FALSE;
+ gDepthDirty = TRUE;
+
+ S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width);
+ // handle fractional rows
+ U32 read_width = llmax(0, (window_width - subimage_x_offset) -
+ llmax(0, (window_width * (subimage_x + 1)) - (buffer_x_offset + raw->getWidth())));
+
+ // Skip rendering and sampling altogether if either width or height is degenerated to 0 (common in cropping cases)
+ if (read_width && read_height)
+ {
+ const U32 subfield = subimage_x+(subimage_y*llceil(scale_factor));
+ display(do_rebuild, scale_factor, subfield, TRUE);
+
+ if (!LLPipeline::sRenderDeferred)
+ {
+ // Required for showing the GUI in snapshots and performing bloom composite overlay
+ // Call even if show_ui is FALSE
+ render_ui(scale_factor, subfield);
+ swap();
+ }
+
+ for (U32 out_y = 0; out_y < read_height ; out_y++)
+ {
+ S32 output_buffer_offset = (
+ (out_y * (raw->getWidth())) // ...plus iterated y...
+ + (window_width * subimage_x) // ...plus subimage start in x...
+ + (raw->getWidth() * window_height * subimage_y) // ...plus subimage start in y...
+ - output_buffer_offset_x // ...minus buffer padding x...
+ - (output_buffer_offset_y * (raw->getWidth())) // ...minus buffer padding y...
+ ) * raw->getComponents();
+
+ // Ping the watchdog thread every 100 lines to keep us alive (arbitrary number, feel free to change)
+ if (out_y % 100 == 0)
+ {
+ LLAppViewer::instance()->pingMainloopTimeout("LLViewerWindow::rawSnapshot");
+ }
+ // disable use of glReadPixels when doing nVidia nSight graphics debugging
+ if (!LLRender::sNsightDebugSupport)
+ {
+ if (type == LLSnapshotModel::SNAPSHOT_TYPE_COLOR)
+ {
+ glReadPixels(
+ subimage_x_offset, out_y + subimage_y_offset,
+ read_width, 1,
+ GL_RGB, GL_UNSIGNED_BYTE,
+ raw->getData() + output_buffer_offset
+ );
+ }
+ else // LLSnapshotModel::SNAPSHOT_TYPE_DEPTH
+ {
+ LLPointer<LLImageRaw> depth_line_buffer = new LLImageRaw(read_width, 1, sizeof(GL_FLOAT)); // need to store floating point values
+ glReadPixels(
+ subimage_x_offset, out_y + subimage_y_offset,
+ read_width, 1,
+ GL_DEPTH_COMPONENT, GL_FLOAT,
+ depth_line_buffer->getData()// current output pixel is beginning of buffer...
+ );
+
+ for (S32 i = 0; i < (S32)read_width; i++)
+ {
+ F32 depth_float = *(F32*)(depth_line_buffer->getData() + (i * sizeof(F32)));
+
+ F32 linear_depth_float = 1.f / (depth_conversion_factor_1 - (depth_float * depth_conversion_factor_2));
+ U8 depth_byte = F32_to_U8(linear_depth_float, LLViewerCamera::getInstance()->getNear(), LLViewerCamera::getInstance()->getFar());
+ // write converted scanline out to result image
+ for (S32 j = 0; j < raw->getComponents(); j++)
+ {
+ *(raw->getData() + output_buffer_offset + (i * raw->getComponents()) + j) = depth_byte;
+ }
+ }
+ }
+ }
+ }
+ }
+ output_buffer_offset_x += subimage_x_offset;
+ stop_glerror();
+ }
+ output_buffer_offset_y += subimage_y_offset;
+ }
+
+ gDisplaySwapBuffers = FALSE;
+ gSnapshotNoPost = FALSE;
+ gDepthDirty = TRUE;
+
+ // POST SNAPSHOT
+ if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
+ LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
+ }
+
+ if (hide_hud)
+ {
+ LLPipeline::sShowHUDAttachments = TRUE;
+ }
+
+ /*if (high_res)
+ {
+ initFonts(1.f);
+ LLHUDObject::reshapeAll();
+ }*/
+
+ // Pre-pad image to number of pixels such that the line length is a multiple of 4 bytes (for BMP encoding)
+ // Note: this formula depends on the number of components being 3. Not obvious, but it's correct.
+ image_width += (image_width * 3) % 4;
+
+ BOOL ret = TRUE ;
+ // Resize image
+ if(llabs(image_width - image_buffer_x) > 4 || llabs(image_height - image_buffer_y) > 4)
+ {
+ ret = raw->scale( image_width, image_height );
+ }
+ else if(image_width != image_buffer_x || image_height != image_buffer_y)
+ {
+ ret = raw->scale( image_width, image_height, FALSE );
+ }
+
+
+ setCursor(UI_CURSOR_ARROW);
+
+ if (do_rebuild)
+ {
+ // If we had to do a rebuild, that means that the lists of drawables to be rendered
+ // was empty before we started.
+ // Need to reset these, otherwise we call state sort on it again when render gets called the next time
+ // and we stand a good chance of crashing on rebuild because the render drawable arrays have multiple copies of
+ // objects on them.
+ gPipeline.resetDrawOrders();
+ }
+
+ if (reset_deferred)
+ {
+ mWorldViewRectRaw = window_rect;
+ LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
+ LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
+ scratch_space.flush();
+ scratch_space.release();
+ gPipeline.allocateScreenBuffer(original_width, original_height);
+
+ }
+
+ if (high_res)
+ {
+ send_agent_resume();
+ }
+
+ return ret;
}
BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_height, const int num_render_passes)
@@ -5219,10 +5219,10 @@ BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_
}
BOOL hide_hud = LLPipeline::sShowHUDAttachments;
- if (hide_hud)
- {
- LLPipeline::sShowHUDAttachments = FALSE;
- }
+ if (hide_hud)
+ {
+ LLPipeline::sShowHUDAttachments = FALSE;
+ }
LLRect window_rect = getWorldViewRectRaw();
@@ -5247,8 +5247,8 @@ BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_
}
// we render the scene more than once since this helps
- // greatly with the objects not being drawn in the
- // snapshot when they are drawn in the scene. This is
+ // greatly with the objects not being drawn in the
+ // snapshot when they are drawn in the scene. This is
// evident when you set this value via the debug setting
// called 360CaptureNumRenderPasses to 1. The theory is
// that the missing objects are caused by the sUseOcclusion
@@ -5293,10 +5293,10 @@ BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_
}
}
- if (hide_hud)
- {
- LLPipeline::sShowHUDAttachments = TRUE;
- }
+ if (hide_hud)
+ {
+ LLPipeline::sShowHUDAttachments = TRUE;
+ }
setCursor(UI_CURSOR_ARROW);
@@ -5318,7 +5318,7 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
LL_PROFILE_GPU_ZONE("cubeSnapshot");
llassert(LLPipeline::sRenderDeferred);
llassert(!gCubeSnapshot); //assert a snapshot isn't already in progress
-
+
U32 res = gPipeline.mRT->deferredScreen.getWidth();
//llassert(res <= gPipeline.mRT->deferredScreen.getWidth());
@@ -5330,7 +5330,7 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
// set new parameters specific to the 360 requirements
LLPipeline::sUseOcclusion = 0;
LLViewerCamera* camera = LLViewerCamera::getInstance();
-
+
LLViewerCamera saved_camera = LLViewerCamera::instance();
glh::matrix4f saved_proj = get_current_projection();
glh::matrix4f saved_mod = get_current_modelview();
@@ -5343,7 +5343,7 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
camera->setNear(near_clip);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT);
-
+
U32 dynamic_render_types[] = {
LLPipeline::RENDER_TYPE_AVATAR,
LLPipeline::RENDER_TYPE_CONTROL_AV,
@@ -5352,7 +5352,7 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
constexpr U32 dynamic_render_type_count = sizeof(dynamic_render_types) / sizeof(U32);
bool prev_dynamic_render_type[dynamic_render_type_count];
-
+
if (!dynamic_render)
{
for (int i = 0; i < dynamic_render_type_count; ++i)
@@ -5370,12 +5370,12 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
{
LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
}
-
+
BOOL hide_hud = LLPipeline::sShowHUDAttachments;
- if (hide_hud)
- {
- LLPipeline::sShowHUDAttachments = FALSE;
- }
+ if (hide_hud)
+ {
+ LLPipeline::sShowHUDAttachments = FALSE;
+ }
LLRect window_rect = getWorldViewRectRaw();
mWorldViewRectRaw.set(0, res, res, 0);
@@ -5441,14 +5441,14 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
}
}
- if (hide_hud)
- {
- LLPipeline::sShowHUDAttachments = TRUE;
- }
+ if (hide_hud)
+ {
+ LLPipeline::sShowHUDAttachments = TRUE;
+ }
gPipeline.resetDrawOrders();
mWorldViewRectRaw = window_rect;
-
+
// restore original view/camera/avatar settings settings
*camera = saved_camera;
set_current_modelview(saved_mod);
@@ -5462,138 +5462,138 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
void LLViewerWindow::destroyWindow()
{
- if (mWindow)
- {
- LLWindowManager::destroyWindow(mWindow);
- }
- mWindow = NULL;
+ if (mWindow)
+ {
+ LLWindowManager::destroyWindow(mWindow);
+ }
+ mWindow = NULL;
}
void LLViewerWindow::drawMouselookInstructions()
{
- // Draw instructions for mouselook ("Press ESC to return to World View" partially transparent at the bottom of the screen.)
- const std::string instructions = LLTrans::getString("LeaveMouselook");
- const LLFontGL* font = LLFontGL::getFont(LLFontDescriptor("SansSerif", "Large", LLFontGL::BOLD));
-
- //to be on top of Bottom bar when it is opened
- const S32 INSTRUCTIONS_PAD = 50;
+ // Draw instructions for mouselook ("Press ESC to return to World View" partially transparent at the bottom of the screen.)
+ const std::string instructions = LLTrans::getString("LeaveMouselook");
+ const LLFontGL* font = LLFontGL::getFont(LLFontDescriptor("SansSerif", "Large", LLFontGL::BOLD));
- font->renderUTF8(
- instructions, 0,
- getWorldViewRectScaled().getCenterX(),
- getWorldViewRectScaled().mBottom + INSTRUCTIONS_PAD,
- LLColor4( 1.0f, 1.0f, 1.0f, 0.5f ),
- LLFontGL::HCENTER, LLFontGL::TOP,
- LLFontGL::NORMAL,LLFontGL::DROP_SHADOW);
+ //to be on top of Bottom bar when it is opened
+ const S32 INSTRUCTIONS_PAD = 50;
+
+ font->renderUTF8(
+ instructions, 0,
+ getWorldViewRectScaled().getCenterX(),
+ getWorldViewRectScaled().mBottom + INSTRUCTIONS_PAD,
+ LLColor4( 1.0f, 1.0f, 1.0f, 0.5f ),
+ LLFontGL::HCENTER, LLFontGL::TOP,
+ LLFontGL::NORMAL,LLFontGL::DROP_SHADOW);
}
void* LLViewerWindow::getPlatformWindow() const
{
- return mWindow->getPlatformWindow();
+ return mWindow->getPlatformWindow();
}
-void* LLViewerWindow::getMediaWindow() const
+void* LLViewerWindow::getMediaWindow() const
{
- return mWindow->getMediaWindow();
+ return mWindow->getMediaWindow();
}
-void LLViewerWindow::focusClient() const
+void LLViewerWindow::focusClient() const
{
- return mWindow->focusClient();
+ return mWindow->focusClient();
}
-LLRootView* LLViewerWindow::getRootView() const
+LLRootView* LLViewerWindow::getRootView() const
{
- return mRootView;
+ return mRootView;
}
LLRect LLViewerWindow::getWorldViewRectScaled() const
{
- return mWorldViewRectScaled;
+ return mWorldViewRectScaled;
}
S32 LLViewerWindow::getWorldViewHeightScaled() const
{
- return mWorldViewRectScaled.getHeight();
+ return mWorldViewRectScaled.getHeight();
}
S32 LLViewerWindow::getWorldViewWidthScaled() const
{
- return mWorldViewRectScaled.getWidth();
+ return mWorldViewRectScaled.getWidth();
}
S32 LLViewerWindow::getWorldViewHeightRaw() const
{
- return mWorldViewRectRaw.getHeight();
+ return mWorldViewRectRaw.getHeight();
}
S32 LLViewerWindow::getWorldViewWidthRaw() const
{
- return mWorldViewRectRaw.getWidth();
+ return mWorldViewRectRaw.getWidth();
}
-S32 LLViewerWindow::getWindowHeightScaled() const
-{
- return mWindowRectScaled.getHeight();
+S32 LLViewerWindow::getWindowHeightScaled() const
+{
+ return mWindowRectScaled.getHeight();
}
-S32 LLViewerWindow::getWindowWidthScaled() const
-{
- return mWindowRectScaled.getWidth();
+S32 LLViewerWindow::getWindowWidthScaled() const
+{
+ return mWindowRectScaled.getWidth();
}
-S32 LLViewerWindow::getWindowHeightRaw() const
-{
- return mWindowRectRaw.getHeight();
+S32 LLViewerWindow::getWindowHeightRaw() const
+{
+ return mWindowRectRaw.getHeight();
}
-S32 LLViewerWindow::getWindowWidthRaw() const
-{
- return mWindowRectRaw.getWidth();
+S32 LLViewerWindow::getWindowWidthRaw() const
+{
+ return mWindowRectRaw.getWidth();
}
void LLViewerWindow::setup2DRender()
{
- // setup ortho camera
- gl_state_for_2d(mWindowRectRaw.getWidth(), mWindowRectRaw.getHeight());
- setup2DViewport();
+ // setup ortho camera
+ gl_state_for_2d(mWindowRectRaw.getWidth(), mWindowRectRaw.getHeight());
+ setup2DViewport();
}
void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset)
{
- gGLViewport[0] = mWindowRectRaw.mLeft + x_offset;
- gGLViewport[1] = mWindowRectRaw.mBottom + y_offset;
- gGLViewport[2] = mWindowRectRaw.getWidth();
- gGLViewport[3] = mWindowRectRaw.getHeight();
- glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+ gGLViewport[0] = mWindowRectRaw.mLeft + x_offset;
+ gGLViewport[1] = mWindowRectRaw.mBottom + y_offset;
+ gGLViewport[2] = mWindowRectRaw.getWidth();
+ gGLViewport[3] = mWindowRectRaw.getHeight();
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
}
void LLViewerWindow::setup3DRender()
{
- // setup perspective camera
- LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRectRaw.mLeft, mWorldViewRectRaw.mBottom, mWorldViewRectRaw.getWidth(), mWorldViewRectRaw.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f);
- setup3DViewport();
+ // setup perspective camera
+ LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRectRaw.mLeft, mWorldViewRectRaw.mBottom, mWorldViewRectRaw.getWidth(), mWorldViewRectRaw.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f);
+ setup3DViewport();
}
void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_UI
- gGLViewport[0] = mWorldViewRectRaw.mLeft + x_offset;
- gGLViewport[1] = mWorldViewRectRaw.mBottom + y_offset;
- gGLViewport[2] = mWorldViewRectRaw.getWidth();
- gGLViewport[3] = mWorldViewRectRaw.getHeight();
- glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_UI
+ gGLViewport[0] = mWorldViewRectRaw.mLeft + x_offset;
+ gGLViewport[1] = mWorldViewRectRaw.mBottom + y_offset;
+ gGLViewport[2] = mWorldViewRectRaw.getWidth();
+ gGLViewport[3] = mWorldViewRectRaw.getHeight();
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
}
void LLViewerWindow::revealIntroPanel()
{
- if (mProgressView)
- {
- mProgressView->revealIntroPanel();
- }
+ if (mProgressView)
+ {
+ mProgressView->revealIntroPanel();
+ }
}
void LLViewerWindow::initTextures(S32 location_id)
@@ -5606,417 +5606,417 @@ void LLViewerWindow::initTextures(S32 location_id)
void LLViewerWindow::setShowProgress(const BOOL show)
{
- if (mProgressView)
- {
- mProgressView->setVisible(show);
- }
+ if (mProgressView)
+ {
+ mProgressView->setVisible(show);
+ }
}
void LLViewerWindow::setStartupComplete()
{
- if (mProgressView)
- {
- mProgressView->setStartupComplete();
- }
+ if (mProgressView)
+ {
+ mProgressView->setStartupComplete();
+ }
}
BOOL LLViewerWindow::getShowProgress() const
{
- return (mProgressView && mProgressView->getVisible());
+ return (mProgressView && mProgressView->getVisible());
}
void LLViewerWindow::setProgressString(const std::string& string)
{
- if (mProgressView)
- {
- mProgressView->setText(string);
- }
+ if (mProgressView)
+ {
+ mProgressView->setText(string);
+ }
}
void LLViewerWindow::setProgressMessage(const std::string& msg)
{
- if(mProgressView)
- {
- mProgressView->setMessage(msg);
- }
+ if(mProgressView)
+ {
+ mProgressView->setMessage(msg);
+ }
}
void LLViewerWindow::setProgressPercent(const F32 percent)
{
- if (mProgressView)
- {
- mProgressView->setPercent(percent);
- }
+ if (mProgressView)
+ {
+ mProgressView->setPercent(percent);
+ }
}
void LLViewerWindow::setProgressCancelButtonVisible( BOOL b, const std::string& label )
{
- if (mProgressView)
- {
- mProgressView->setCancelButtonVisible( b, label );
- }
+ if (mProgressView)
+ {
+ mProgressView->setCancelButtonVisible( b, label );
+ }
}
LLProgressView *LLViewerWindow::getProgressView() const
{
- return mProgressView;
+ return mProgressView;
}
void LLViewerWindow::dumpState()
{
- LL_INFOS() << "LLViewerWindow Active " << S32(mActive) << LL_ENDL;
- LL_INFOS() << "mWindow visible " << S32(mWindow->getVisible())
- << " minimized " << S32(mWindow->getMinimized())
- << LL_ENDL;
+ LL_INFOS() << "LLViewerWindow Active " << S32(mActive) << LL_ENDL;
+ LL_INFOS() << "mWindow visible " << S32(mWindow->getVisible())
+ << " minimized " << S32(mWindow->getMinimized())
+ << LL_ENDL;
}
void LLViewerWindow::stopGL(BOOL save_state)
{
- //Note: --bao
- //if not necessary, do not change the order of the function calls in this function.
- //if change something, make sure it will not break anything.
- //especially be careful to put anything behind gTextureList.destroyGL(save_state);
- if (!gGLManager.mIsDisabled)
- {
- LL_INFOS() << "Shutting down GL..." << LL_ENDL;
-
- // Pause texture decode threads (will get unpaused during main loop)
- LLAppViewer::getTextureCache()->pause();
- LLAppViewer::getTextureFetch()->pause();
-
- gSky.destroyGL();
- stop_glerror();
-
- LLManipTranslate::destroyGL() ;
- stop_glerror();
-
- gBumpImageList.destroyGL();
- stop_glerror();
-
- LLFontGL::destroyAllGL();
- stop_glerror();
-
- LLVOAvatar::destroyGL();
- stop_glerror();
-
- LLVOPartGroup::destroyGL();
-
- LLViewerDynamicTexture::destroyGL();
- stop_glerror();
-
- if (gPipeline.isInit())
- {
- gPipeline.destroyGL();
- }
-
- gBox.cleanupGL();
-
- if(gPostProcess)
- {
- gPostProcess->invalidate();
- }
-
- gTextureList.destroyGL(save_state);
- stop_glerror();
-
- gGLManager.mIsDisabled = TRUE;
- stop_glerror();
-
- //unload shader's
- while (LLGLSLShader::sInstances.size())
- {
- LLGLSLShader* shader = *(LLGLSLShader::sInstances.begin());
- shader->unload();
- }
- }
+ //Note: --bao
+ //if not necessary, do not change the order of the function calls in this function.
+ //if change something, make sure it will not break anything.
+ //especially be careful to put anything behind gTextureList.destroyGL(save_state);
+ if (!gGLManager.mIsDisabled)
+ {
+ LL_INFOS() << "Shutting down GL..." << LL_ENDL;
+
+ // Pause texture decode threads (will get unpaused during main loop)
+ LLAppViewer::getTextureCache()->pause();
+ LLAppViewer::getTextureFetch()->pause();
+
+ gSky.destroyGL();
+ stop_glerror();
+
+ LLManipTranslate::destroyGL() ;
+ stop_glerror();
+
+ gBumpImageList.destroyGL();
+ stop_glerror();
+
+ LLFontGL::destroyAllGL();
+ stop_glerror();
+
+ LLVOAvatar::destroyGL();
+ stop_glerror();
+
+ LLVOPartGroup::destroyGL();
+
+ LLViewerDynamicTexture::destroyGL();
+ stop_glerror();
+
+ if (gPipeline.isInit())
+ {
+ gPipeline.destroyGL();
+ }
+
+ gBox.cleanupGL();
+
+ if(gPostProcess)
+ {
+ gPostProcess->invalidate();
+ }
+
+ gTextureList.destroyGL(save_state);
+ stop_glerror();
+
+ gGLManager.mIsDisabled = TRUE;
+ stop_glerror();
+
+ //unload shader's
+ while (LLGLSLShader::sInstances.size())
+ {
+ LLGLSLShader* shader = *(LLGLSLShader::sInstances.begin());
+ shader->unload();
+ }
+ }
}
void LLViewerWindow::restoreGL(const std::string& progress_message)
{
- //Note: --bao
- //if not necessary, do not change the order of the function calls in this function.
- //if change something, make sure it will not break anything.
- //especially, be careful to put something before gTextureList.restoreGL();
- if (gGLManager.mIsDisabled)
- {
- LL_INFOS() << "Restoring GL..." << LL_ENDL;
- gGLManager.mIsDisabled = FALSE;
-
- initGLDefaults();
- LLGLState::restoreGL();
-
- gTextureList.restoreGL();
-
- // for future support of non-square pixels, and fonts that are properly stretched
- //LLFontGL::destroyDefaultFonts();
- initFonts();
-
- gSky.restoreGL();
- gPipeline.restoreGL();
- LLManipTranslate::restoreGL();
-
- gBumpImageList.restoreGL();
- LLViewerDynamicTexture::restoreGL();
- LLVOAvatar::restoreGL();
- LLVOPartGroup::restoreGL();
-
- gResizeScreenTexture = TRUE;
- gWindowResized = TRUE;
-
- if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance())
- {
- LLVisualParamHint::requestHintUpdates();
- }
-
- if (!progress_message.empty())
- {
- gRestoreGLTimer.reset();
- gRestoreGL = TRUE;
- setShowProgress(TRUE);
- setProgressString(progress_message);
- }
- LL_INFOS() << "...Restoring GL done" << LL_ENDL;
- if(!LLAppViewer::instance()->restoreErrorTrap())
- {
- LL_WARNS() << " Someone took over my signal/exception handler (post restoreGL)!" << LL_ENDL;
- }
-
- }
+ //Note: --bao
+ //if not necessary, do not change the order of the function calls in this function.
+ //if change something, make sure it will not break anything.
+ //especially, be careful to put something before gTextureList.restoreGL();
+ if (gGLManager.mIsDisabled)
+ {
+ LL_INFOS() << "Restoring GL..." << LL_ENDL;
+ gGLManager.mIsDisabled = FALSE;
+
+ initGLDefaults();
+ LLGLState::restoreGL();
+
+ gTextureList.restoreGL();
+
+ // for future support of non-square pixels, and fonts that are properly stretched
+ //LLFontGL::destroyDefaultFonts();
+ initFonts();
+
+ gSky.restoreGL();
+ gPipeline.restoreGL();
+ LLManipTranslate::restoreGL();
+
+ gBumpImageList.restoreGL();
+ LLViewerDynamicTexture::restoreGL();
+ LLVOAvatar::restoreGL();
+ LLVOPartGroup::restoreGL();
+
+ gResizeScreenTexture = TRUE;
+ gWindowResized = TRUE;
+
+ if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance())
+ {
+ LLVisualParamHint::requestHintUpdates();
+ }
+
+ if (!progress_message.empty())
+ {
+ gRestoreGLTimer.reset();
+ gRestoreGL = TRUE;
+ setShowProgress(TRUE);
+ setProgressString(progress_message);
+ }
+ LL_INFOS() << "...Restoring GL done" << LL_ENDL;
+ if(!LLAppViewer::instance()->restoreErrorTrap())
+ {
+ LL_WARNS() << " Someone took over my signal/exception handler (post restoreGL)!" << LL_ENDL;
+ }
+
+ }
}
void LLViewerWindow::initFonts(F32 zoom_factor)
{
- LLFontGL::destroyAllGL();
- // Initialize with possibly different zoom factor
+ LLFontGL::destroyAllGL();
+ // Initialize with possibly different zoom factor
- LLFontManager::initClass();
+ LLFontManager::initClass();
- LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
- mDisplayScale.mV[VX] * zoom_factor,
- mDisplayScale.mV[VY] * zoom_factor,
- gDirUtilp->getAppRODataDir());
+ LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
+ mDisplayScale.mV[VX] * zoom_factor,
+ mDisplayScale.mV[VY] * zoom_factor,
+ gDirUtilp->getAppRODataDir());
}
void LLViewerWindow::requestResolutionUpdate()
{
- mResDirty = true;
+ mResDirty = true;
}
static LLTrace::BlockTimerStatHandle FTM_WINDOW_CHECK_SETTINGS("Window Settings");
void LLViewerWindow::checkSettings()
{
- LL_RECORD_BLOCK_TIME(FTM_WINDOW_CHECK_SETTINGS);
- if (mStatesDirty)
- {
- gGL.refreshState();
- LLViewerShaderMgr::instance()->setShaders();
- mStatesDirty = false;
- }
-
- // We want to update the resolution AFTER the states getting refreshed not before.
- if (mResDirty)
- {
- reshape(getWindowWidthRaw(), getWindowHeightRaw());
- mResDirty = false;
- }
+ LL_RECORD_BLOCK_TIME(FTM_WINDOW_CHECK_SETTINGS);
+ if (mStatesDirty)
+ {
+ gGL.refreshState();
+ LLViewerShaderMgr::instance()->setShaders();
+ mStatesDirty = false;
+ }
+
+ // We want to update the resolution AFTER the states getting refreshed not before.
+ if (mResDirty)
+ {
+ reshape(getWindowWidthRaw(), getWindowHeightRaw());
+ mResDirty = false;
+ }
}
void LLViewerWindow::restartDisplay(BOOL show_progress_bar)
{
- LL_INFOS() << "Restaring GL" << LL_ENDL;
- stopGL();
- if (show_progress_bar)
- {
- restoreGL(LLTrans::getString("ProgressChangingResolution"));
- }
- else
- {
- restoreGL();
- }
+ LL_INFOS() << "Restaring GL" << LL_ENDL;
+ stopGL();
+ if (show_progress_bar)
+ {
+ restoreGL(LLTrans::getString("ProgressChangingResolution"));
+ }
+ else
+ {
+ restoreGL();
+ }
}
BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync, BOOL show_progress_bar)
{
- //BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
+ //BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
- //gResizeScreenTexture = TRUE;
+ //gResizeScreenTexture = TRUE;
- //U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
- //U32 old_fsaa = mWindow->getFSAASamples();
+ //U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
+ //U32 old_fsaa = mWindow->getFSAASamples();
- // if not maximized, use the request size
- if (!mWindow->getMaximized())
- {
- mWindow->setSize(size);
- }
+ // if not maximized, use the request size
+ if (!mWindow->getMaximized())
+ {
+ mWindow->setSize(size);
+ }
- //if (fsaa == old_fsaa)
- {
- return TRUE;
- }
+ //if (fsaa == old_fsaa)
+ {
+ return TRUE;
+ }
/*
- // Close floaters that don't handle settings change
- LLFloaterReg::hideInstance("snapshot");
-
- BOOL result_first_try = FALSE;
- BOOL result_second_try = FALSE;
-
- LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
- send_agent_pause();
- LL_INFOS() << "Stopping GL during changeDisplaySettings" << LL_ENDL;
- stopGL();
- mIgnoreActivate = TRUE;
- LLCoordScreen old_size;
- LLCoordScreen old_pos;
- mWindow->getSize(&old_size);
-
- //mWindow->setFSAASamples(fsaa);
-
- result_first_try = mWindow->switchContext(false, size, disable_vsync);
- if (!result_first_try)
- {
- // try to switch back
- //mWindow->setFSAASamples(old_fsaa);
- result_second_try = mWindow->switchContext(false, old_size, disable_vsync);
-
- if (!result_second_try)
- {
- // we are stuck...try once again with a minimal resolution?
- send_agent_resume();
- mIgnoreActivate = FALSE;
- return FALSE;
- }
- }
- send_agent_resume();
-
- LL_INFOS() << "Restoring GL during resolution change" << LL_ENDL;
- if (show_progress_bar)
- {
- restoreGL(LLTrans::getString("ProgressChangingResolution"));
- }
- else
- {
- restoreGL();
- }
-
- if (!result_first_try)
- {
- LLSD args;
- args["RESX"] = llformat("%d",size.mX);
- args["RESY"] = llformat("%d",size.mY);
- LLNotificationsUtil::add("ResolutionSwitchFail", args);
- size = old_size; // for reshape below
- }
-
- BOOL success = result_first_try || result_second_try;
-
- if (success)
- {
- // maximize window if was maximized, else reposition
- if (was_maximized)
- {
- mWindow->maximize();
- }
- else
- {
- S32 windowX = gSavedSettings.getS32("WindowX");
- S32 windowY = gSavedSettings.getS32("WindowY");
-
- mWindow->setPosition(LLCoordScreen ( windowX, windowY ) );
- }
- }
-
- mIgnoreActivate = FALSE;
- gFocusMgr.setKeyboardFocus(keyboard_focus);
-
- return success;
-
- */
-}
-
-F32 LLViewerWindow::getWorldViewAspectRatio() const
-{
- F32 world_aspect = (F32)mWorldViewRectRaw.getWidth() / (F32)mWorldViewRectRaw.getHeight();
- return world_aspect;
+ // Close floaters that don't handle settings change
+ LLFloaterReg::hideInstance("snapshot");
+
+ BOOL result_first_try = FALSE;
+ BOOL result_second_try = FALSE;
+
+ LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
+ send_agent_pause();
+ LL_INFOS() << "Stopping GL during changeDisplaySettings" << LL_ENDL;
+ stopGL();
+ mIgnoreActivate = TRUE;
+ LLCoordScreen old_size;
+ LLCoordScreen old_pos;
+ mWindow->getSize(&old_size);
+
+ //mWindow->setFSAASamples(fsaa);
+
+ result_first_try = mWindow->switchContext(false, size, disable_vsync);
+ if (!result_first_try)
+ {
+ // try to switch back
+ //mWindow->setFSAASamples(old_fsaa);
+ result_second_try = mWindow->switchContext(false, old_size, disable_vsync);
+
+ if (!result_second_try)
+ {
+ // we are stuck...try once again with a minimal resolution?
+ send_agent_resume();
+ mIgnoreActivate = FALSE;
+ return FALSE;
+ }
+ }
+ send_agent_resume();
+
+ LL_INFOS() << "Restoring GL during resolution change" << LL_ENDL;
+ if (show_progress_bar)
+ {
+ restoreGL(LLTrans::getString("ProgressChangingResolution"));
+ }
+ else
+ {
+ restoreGL();
+ }
+
+ if (!result_first_try)
+ {
+ LLSD args;
+ args["RESX"] = llformat("%d",size.mX);
+ args["RESY"] = llformat("%d",size.mY);
+ LLNotificationsUtil::add("ResolutionSwitchFail", args);
+ size = old_size; // for reshape below
+ }
+
+ BOOL success = result_first_try || result_second_try;
+
+ if (success)
+ {
+ // maximize window if was maximized, else reposition
+ if (was_maximized)
+ {
+ mWindow->maximize();
+ }
+ else
+ {
+ S32 windowX = gSavedSettings.getS32("WindowX");
+ S32 windowY = gSavedSettings.getS32("WindowY");
+
+ mWindow->setPosition(LLCoordScreen ( windowX, windowY ) );
+ }
+ }
+
+ mIgnoreActivate = FALSE;
+ gFocusMgr.setKeyboardFocus(keyboard_focus);
+
+ return success;
+
+ */
+}
+
+F32 LLViewerWindow::getWorldViewAspectRatio() const
+{
+ F32 world_aspect = (F32)mWorldViewRectRaw.getWidth() / (F32)mWorldViewRectRaw.getHeight();
+ return world_aspect;
}
void LLViewerWindow::calcDisplayScale()
{
- F32 ui_scale_factor = llclamp(gSavedSettings.getF32("UIScaleFactor") * mWindow->getSystemUISize(), MIN_UI_SCALE, MAX_UI_SCALE);
- LLVector2 display_scale;
- display_scale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f));
- display_scale *= ui_scale_factor;
+ F32 ui_scale_factor = llclamp(gSavedSettings.getF32("UIScaleFactor") * mWindow->getSystemUISize(), MIN_UI_SCALE, MAX_UI_SCALE);
+ LLVector2 display_scale;
+ display_scale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f));
+ display_scale *= ui_scale_factor;
- // limit minimum display scale
- if (display_scale.mV[VX] < MIN_DISPLAY_SCALE || display_scale.mV[VY] < MIN_DISPLAY_SCALE)
- {
- display_scale *= MIN_DISPLAY_SCALE / llmin(display_scale.mV[VX], display_scale.mV[VY]);
- }
-
- if (display_scale != mDisplayScale)
- {
- LL_INFOS() << "Setting display scale to " << display_scale << " for ui scale: " << ui_scale_factor << LL_ENDL;
+ // limit minimum display scale
+ if (display_scale.mV[VX] < MIN_DISPLAY_SCALE || display_scale.mV[VY] < MIN_DISPLAY_SCALE)
+ {
+ display_scale *= MIN_DISPLAY_SCALE / llmin(display_scale.mV[VX], display_scale.mV[VY]);
+ }
- mDisplayScale = display_scale;
- // Init default fonts
- initFonts();
- }
+ if (display_scale != mDisplayScale)
+ {
+ LL_INFOS() << "Setting display scale to " << display_scale << " for ui scale: " << ui_scale_factor << LL_ENDL;
+
+ mDisplayScale = display_scale;
+ // Init default fonts
+ initFonts();
+ }
}
//static
-LLRect LLViewerWindow::calcScaledRect(const LLRect & rect, const LLVector2& display_scale)
+LLRect LLViewerWindow::calcScaledRect(const LLRect & rect, const LLVector2& display_scale)
{
- LLRect res = rect;
- res.mLeft = ll_round((F32)res.mLeft / display_scale.mV[VX]);
- res.mRight = ll_round((F32)res.mRight / display_scale.mV[VX]);
- res.mBottom = ll_round((F32)res.mBottom / display_scale.mV[VY]);
- res.mTop = ll_round((F32)res.mTop / display_scale.mV[VY]);
+ LLRect res = rect;
+ res.mLeft = ll_round((F32)res.mLeft / display_scale.mV[VX]);
+ res.mRight = ll_round((F32)res.mRight / display_scale.mV[VX]);
+ res.mBottom = ll_round((F32)res.mBottom / display_scale.mV[VY]);
+ res.mTop = ll_round((F32)res.mTop / display_scale.mV[VY]);
- return res;
+ return res;
}
S32 LLViewerWindow::getChatConsoleBottomPad()
{
- S32 offset = 0;
+ S32 offset = 0;
- if(gToolBarView)
- offset += gToolBarView->getBottomToolbar()->getRect().getHeight();
+ if(gToolBarView)
+ offset += gToolBarView->getBottomToolbar()->getRect().getHeight();
- return offset;
+ return offset;
}
LLRect LLViewerWindow::getChatConsoleRect()
{
- LLRect full_window(0, getWindowHeightScaled(), getWindowWidthScaled(), 0);
- LLRect console_rect = full_window;
+ LLRect full_window(0, getWindowHeightScaled(), getWindowWidthScaled(), 0);
+ LLRect console_rect = full_window;
- const S32 CONSOLE_PADDING_TOP = 24;
- const S32 CONSOLE_PADDING_LEFT = 24;
- const S32 CONSOLE_PADDING_RIGHT = 10;
+ const S32 CONSOLE_PADDING_TOP = 24;
+ const S32 CONSOLE_PADDING_LEFT = 24;
+ const S32 CONSOLE_PADDING_RIGHT = 10;
- console_rect.mTop -= CONSOLE_PADDING_TOP;
- console_rect.mBottom += getChatConsoleBottomPad();
+ console_rect.mTop -= CONSOLE_PADDING_TOP;
+ console_rect.mBottom += getChatConsoleBottomPad();
- console_rect.mLeft += CONSOLE_PADDING_LEFT;
+ console_rect.mLeft += CONSOLE_PADDING_LEFT;
- static const BOOL CHAT_FULL_WIDTH = gSavedSettings.getBOOL("ChatFullWidth");
+ static const BOOL CHAT_FULL_WIDTH = gSavedSettings.getBOOL("ChatFullWidth");
- if (CHAT_FULL_WIDTH)
- {
- console_rect.mRight -= CONSOLE_PADDING_RIGHT;
- }
- else
- {
- // Make console rect somewhat narrow so having inventory open is
- // less of a problem.
- console_rect.mRight = console_rect.mLeft + 2 * getWindowWidthScaled() / 3;
- }
+ if (CHAT_FULL_WIDTH)
+ {
+ console_rect.mRight -= CONSOLE_PADDING_RIGHT;
+ }
+ else
+ {
+ // Make console rect somewhat narrow so having inventory open is
+ // less of a problem.
+ console_rect.mRight = console_rect.mLeft + 2 * getWindowWidthScaled() / 3;
+ }
- return console_rect;
+ return console_rect;
}
void LLViewerWindow::reshapeStatusBarContainer()
@@ -6044,31 +6044,31 @@ void LLViewerWindow::reshapeStatusBarContainer()
void LLViewerWindow::setUIVisibility(bool visible)
{
- mUIVisible = visible;
+ mUIVisible = visible;
- if (!visible)
- {
- gAgentCamera.changeCameraToThirdPerson(FALSE);
- gFloaterView->hideAllFloaters();
- }
- else
- {
- gFloaterView->showHiddenFloaters();
- }
+ if (!visible)
+ {
+ gAgentCamera.changeCameraToThirdPerson(FALSE);
+ gFloaterView->hideAllFloaters();
+ }
+ else
+ {
+ gFloaterView->showHiddenFloaters();
+ }
- if (gToolBarView)
- {
- gToolBarView->setToolBarsVisible(visible);
- }
+ if (gToolBarView)
+ {
+ gToolBarView->setToolBarsVisible(visible);
+ }
- LLNavigationBar::getInstance()->setVisible(visible ? gSavedSettings.getBOOL("ShowNavbarNavigationPanel") : FALSE);
- LLPanelTopInfoBar::getInstance()->setVisible(visible? gSavedSettings.getBOOL("ShowMiniLocationPanel") : FALSE);
- mRootView->getChildView("status_bar_container")->setVisible(visible);
+ LLNavigationBar::getInstance()->setVisible(visible ? gSavedSettings.getBOOL("ShowNavbarNavigationPanel") : FALSE);
+ LLPanelTopInfoBar::getInstance()->setVisible(visible? gSavedSettings.getBOOL("ShowMiniLocationPanel") : FALSE);
+ mRootView->getChildView("status_bar_container")->setVisible(visible);
}
bool LLViewerWindow::getUIVisibility()
{
- return mUIVisible;
+ return mUIVisible;
}
////////////////////////////////////////////////////////////////////////////
@@ -6076,22 +6076,22 @@ bool LLViewerWindow::getUIVisibility()
// LLPickInfo
//
LLPickInfo::LLPickInfo()
- : mKeyMask(MASK_NONE),
- mPickCallback(NULL),
- mPickType(PICK_INVALID),
- mWantSurfaceInfo(FALSE),
- mObjectFace(-1),
- mUVCoords(-1.f, -1.f),
- mSTCoords(-1.f, -1.f),
- mXYCoords(-1, -1),
- mIntersection(),
- mNormal(),
- mTangent(),
- mBinormal(),
- mHUDIcon(NULL),
- mPickTransparent(FALSE),
- mPickRigged(FALSE),
- mPickParticle(FALSE)
+ : mKeyMask(MASK_NONE),
+ mPickCallback(NULL),
+ mPickType(PICK_INVALID),
+ mWantSurfaceInfo(FALSE),
+ mObjectFace(-1),
+ mUVCoords(-1.f, -1.f),
+ mSTCoords(-1.f, -1.f),
+ mXYCoords(-1, -1),
+ mIntersection(),
+ mNormal(),
+ mTangent(),
+ mBinormal(),
+ mHUDIcon(NULL),
+ mPickTransparent(FALSE),
+ mPickRigged(FALSE),
+ mPickParticle(FALSE)
{
}
@@ -6121,234 +6121,234 @@ LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos,
mPickRigged(pick_rigged),
mPickParticle(pick_particle),
mPickReflectionProbe(pick_reflection_probe),
- mPickUnselectable(pick_unselectable)
+ mPickUnselectable(pick_unselectable)
{
}
void LLPickInfo::fetchResults()
{
- S32 face_hit = -1;
- LLVector4a intersection, normal;
- LLVector4a tangent;
-
- LLVector2 uv;
-
- LLHUDIcon* hit_icon = gViewerWindow->cursorIntersectIcon(mMousePt.mX, mMousePt.mY, 512.f, &intersection);
-
- LLVector4a origin;
- origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
- F32 icon_dist = 0.f;
- LLVector4a start;
- LLVector4a end;
- LLVector4a particle_end;
-
- if (hit_icon)
- {
- LLVector4a delta;
- delta.setSub(intersection, origin);
- icon_dist = delta.getLength3().getF32();
- }
-
- LLViewerObject* hit_object = gViewerWindow->cursorIntersect(mMousePt.mX, mMousePt.mY, 512.f,
- NULL, -1, mPickTransparent, mPickRigged, mPickUnselectable, mPickReflectionProbe, &face_hit,
- &intersection, &uv, &normal, &tangent, &start, &end);
-
- mPickPt = mMousePt;
-
- U32 te_offset = face_hit > -1 ? face_hit : 0;
-
- if (mPickParticle)
- { //get the end point of line segement to use for particle raycast
- if (hit_object)
- {
- particle_end = intersection;
- }
- else
- {
- particle_end = end;
- }
- }
-
- LLViewerObject* objectp = hit_object;
-
-
- LLVector4a delta;
- delta.setSub(origin, intersection);
-
- if (hit_icon &&
- (!objectp ||
- icon_dist < delta.getLength3().getF32()))
- {
- // was this name referring to a hud icon?
- mHUDIcon = hit_icon;
- mPickType = PICK_ICON;
- mPosGlobal = mHUDIcon->getPositionGlobal();
-
- }
- else if (objectp)
- {
- if( objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH )
- {
- // Hit land
- mPickType = PICK_LAND;
- mObjectID.setNull(); // land has no id
-
- // put global position into land_pos
- LLVector3d land_pos;
- if (!gViewerWindow->mousePointOnLandGlobal(mPickPt.mX, mPickPt.mY, &land_pos, mPickUnselectable))
- {
- // The selected point is beyond the draw distance or is otherwise
- // not selectable. Return before calling mPickCallback().
- return;
- }
-
- // Fudge the land focus a little bit above ground.
- mPosGlobal = land_pos + LLVector3d::z_axis * 0.1f;
- }
- else
- {
- if(isFlora(objectp))
- {
- mPickType = PICK_FLORA;
- }
- else
- {
- mPickType = PICK_OBJECT;
- }
-
- LLVector3 v_intersection(intersection.getF32ptr());
-
- mObjectOffset = gAgentCamera.calcFocusOffset(objectp, v_intersection, mPickPt.mX, mPickPt.mY);
- mObjectID = objectp->mID;
- mObjectFace = (te_offset == NO_FACE) ? -1 : (S32)te_offset;
-
-
-
- mPosGlobal = gAgent.getPosGlobalFromAgent(v_intersection);
-
- if (mWantSurfaceInfo)
- {
- getSurfaceInfo();
- }
- }
- }
-
- if (mPickParticle)
- { //search for closest particle to click origin out to intersection point
- S32 part_face = -1;
-
- LLVOPartGroup* group = gPipeline.lineSegmentIntersectParticle(start, particle_end, NULL, &part_face);
- if (group)
- {
- mParticleOwnerID = group->getPartOwner(part_face);
- mParticleSourceID = group->getPartSource(part_face);
- }
- }
-
- if (mPickCallback)
- {
- mPickCallback(*this);
- }
+ S32 face_hit = -1;
+ LLVector4a intersection, normal;
+ LLVector4a tangent;
+
+ LLVector2 uv;
+
+ LLHUDIcon* hit_icon = gViewerWindow->cursorIntersectIcon(mMousePt.mX, mMousePt.mY, 512.f, &intersection);
+
+ LLVector4a origin;
+ origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
+ F32 icon_dist = 0.f;
+ LLVector4a start;
+ LLVector4a end;
+ LLVector4a particle_end;
+
+ if (hit_icon)
+ {
+ LLVector4a delta;
+ delta.setSub(intersection, origin);
+ icon_dist = delta.getLength3().getF32();
+ }
+
+ LLViewerObject* hit_object = gViewerWindow->cursorIntersect(mMousePt.mX, mMousePt.mY, 512.f,
+ NULL, -1, mPickTransparent, mPickRigged, mPickUnselectable, mPickReflectionProbe, &face_hit,
+ &intersection, &uv, &normal, &tangent, &start, &end);
+
+ mPickPt = mMousePt;
+
+ U32 te_offset = face_hit > -1 ? face_hit : 0;
+
+ if (mPickParticle)
+ { //get the end point of line segement to use for particle raycast
+ if (hit_object)
+ {
+ particle_end = intersection;
+ }
+ else
+ {
+ particle_end = end;
+ }
+ }
+
+ LLViewerObject* objectp = hit_object;
+
+
+ LLVector4a delta;
+ delta.setSub(origin, intersection);
+
+ if (hit_icon &&
+ (!objectp ||
+ icon_dist < delta.getLength3().getF32()))
+ {
+ // was this name referring to a hud icon?
+ mHUDIcon = hit_icon;
+ mPickType = PICK_ICON;
+ mPosGlobal = mHUDIcon->getPositionGlobal();
+
+ }
+ else if (objectp)
+ {
+ if( objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH )
+ {
+ // Hit land
+ mPickType = PICK_LAND;
+ mObjectID.setNull(); // land has no id
+
+ // put global position into land_pos
+ LLVector3d land_pos;
+ if (!gViewerWindow->mousePointOnLandGlobal(mPickPt.mX, mPickPt.mY, &land_pos, mPickUnselectable))
+ {
+ // The selected point is beyond the draw distance or is otherwise
+ // not selectable. Return before calling mPickCallback().
+ return;
+ }
+
+ // Fudge the land focus a little bit above ground.
+ mPosGlobal = land_pos + LLVector3d::z_axis * 0.1f;
+ }
+ else
+ {
+ if(isFlora(objectp))
+ {
+ mPickType = PICK_FLORA;
+ }
+ else
+ {
+ mPickType = PICK_OBJECT;
+ }
+
+ LLVector3 v_intersection(intersection.getF32ptr());
+
+ mObjectOffset = gAgentCamera.calcFocusOffset(objectp, v_intersection, mPickPt.mX, mPickPt.mY);
+ mObjectID = objectp->mID;
+ mObjectFace = (te_offset == NO_FACE) ? -1 : (S32)te_offset;
+
+
+
+ mPosGlobal = gAgent.getPosGlobalFromAgent(v_intersection);
+
+ if (mWantSurfaceInfo)
+ {
+ getSurfaceInfo();
+ }
+ }
+ }
+
+ if (mPickParticle)
+ { //search for closest particle to click origin out to intersection point
+ S32 part_face = -1;
+
+ LLVOPartGroup* group = gPipeline.lineSegmentIntersectParticle(start, particle_end, NULL, &part_face);
+ if (group)
+ {
+ mParticleOwnerID = group->getPartOwner(part_face);
+ mParticleSourceID = group->getPartSource(part_face);
+ }
+ }
+
+ if (mPickCallback)
+ {
+ mPickCallback(*this);
+ }
}
LLPointer<LLViewerObject> LLPickInfo::getObject() const
{
- return gObjectList.findObject( mObjectID );
+ return gObjectList.findObject( mObjectID );
}
void LLPickInfo::updateXYCoords()
{
- if (mObjectFace > -1)
- {
- const LLTextureEntry* tep = getObject()->getTE(mObjectFace);
- LLPointer<LLViewerTexture> imagep = LLViewerTextureManager::getFetchedTexture(tep->getID());
- if(mUVCoords.mV[VX] >= 0.f && mUVCoords.mV[VY] >= 0.f && imagep.notNull())
- {
- mXYCoords.mX = ll_round(mUVCoords.mV[VX] * (F32)imagep->getWidth());
- mXYCoords.mY = ll_round((1.f - mUVCoords.mV[VY]) * (F32)imagep->getHeight());
- }
- }
+ if (mObjectFace > -1)
+ {
+ const LLTextureEntry* tep = getObject()->getTE(mObjectFace);
+ LLPointer<LLViewerTexture> imagep = LLViewerTextureManager::getFetchedTexture(tep->getID());
+ if(mUVCoords.mV[VX] >= 0.f && mUVCoords.mV[VY] >= 0.f && imagep.notNull())
+ {
+ mXYCoords.mX = ll_round(mUVCoords.mV[VX] * (F32)imagep->getWidth());
+ mXYCoords.mY = ll_round((1.f - mUVCoords.mV[VY]) * (F32)imagep->getHeight());
+ }
+ }
}
void LLPickInfo::getSurfaceInfo()
{
- // set values to uninitialized - this is what we return if no intersection is found
- mObjectFace = -1;
- mUVCoords = LLVector2(-1, -1);
- mSTCoords = LLVector2(-1, -1);
- mXYCoords = LLCoordScreen(-1, -1);
- mIntersection = LLVector3(0,0,0);
- mNormal = LLVector3(0,0,0);
- mBinormal = LLVector3(0,0,0);
- mTangent = LLVector4(0,0,0,0);
-
- LLVector4a tangent;
- LLVector4a intersection;
- LLVector4a normal;
-
- tangent.clear();
- normal.clear();
- intersection.clear();
-
- LLViewerObject* objectp = getObject();
-
- if (objectp)
- {
- if (gViewerWindow->cursorIntersect(ll_round((F32)mMousePt.mX), ll_round((F32)mMousePt.mY), 1024.f,
- objectp, -1, mPickTransparent, mPickRigged, mPickUnselectable, mPickReflectionProbe,
- &mObjectFace,
- &intersection,
- &mSTCoords,
- &normal,
- &tangent))
- {
- // if we succeeded with the intersect above, compute the texture coordinates:
-
- if (objectp->mDrawable.notNull() && mObjectFace > -1)
- {
- LLFace* facep = objectp->mDrawable->getFace(mObjectFace);
- if (facep)
- {
- mUVCoords = facep->surfaceToTexture(mSTCoords, intersection, normal);
- }
- }
-
- mIntersection.set(intersection.getF32ptr());
- mNormal.set(normal.getF32ptr());
- mTangent.set(tangent.getF32ptr());
-
- //extrapoloate binormal from normal and tangent
-
- LLVector4a binormal;
- binormal.setCross3(normal, tangent);
- binormal.mul(tangent.getF32ptr()[3]);
-
- mBinormal.set(binormal.getF32ptr());
-
- mBinormal.normalize();
- mNormal.normalize();
- mTangent.normalize();
-
- // and XY coords:
- updateXYCoords();
-
- }
- }
-}
-
-//static
+ // set values to uninitialized - this is what we return if no intersection is found
+ mObjectFace = -1;
+ mUVCoords = LLVector2(-1, -1);
+ mSTCoords = LLVector2(-1, -1);
+ mXYCoords = LLCoordScreen(-1, -1);
+ mIntersection = LLVector3(0,0,0);
+ mNormal = LLVector3(0,0,0);
+ mBinormal = LLVector3(0,0,0);
+ mTangent = LLVector4(0,0,0,0);
+
+ LLVector4a tangent;
+ LLVector4a intersection;
+ LLVector4a normal;
+
+ tangent.clear();
+ normal.clear();
+ intersection.clear();
+
+ LLViewerObject* objectp = getObject();
+
+ if (objectp)
+ {
+ if (gViewerWindow->cursorIntersect(ll_round((F32)mMousePt.mX), ll_round((F32)mMousePt.mY), 1024.f,
+ objectp, -1, mPickTransparent, mPickRigged, mPickUnselectable, mPickReflectionProbe,
+ &mObjectFace,
+ &intersection,
+ &mSTCoords,
+ &normal,
+ &tangent))
+ {
+ // if we succeeded with the intersect above, compute the texture coordinates:
+
+ if (objectp->mDrawable.notNull() && mObjectFace > -1)
+ {
+ LLFace* facep = objectp->mDrawable->getFace(mObjectFace);
+ if (facep)
+ {
+ mUVCoords = facep->surfaceToTexture(mSTCoords, intersection, normal);
+ }
+ }
+
+ mIntersection.set(intersection.getF32ptr());
+ mNormal.set(normal.getF32ptr());
+ mTangent.set(tangent.getF32ptr());
+
+ //extrapoloate binormal from normal and tangent
+
+ LLVector4a binormal;
+ binormal.setCross3(normal, tangent);
+ binormal.mul(tangent.getF32ptr()[3]);
+
+ mBinormal.set(binormal.getF32ptr());
+
+ mBinormal.normalize();
+ mNormal.normalize();
+ mTangent.normalize();
+
+ // and XY coords:
+ updateXYCoords();
+
+ }
+ }
+}
+
+//static
bool LLPickInfo::isFlora(LLViewerObject* object)
{
- if (!object) return false;
+ if (!object) return false;
- LLPCode pcode = object->getPCode();
+ LLPCode pcode = object->getPCode();
- if( (LL_PCODE_LEGACY_GRASS == pcode)
- || (LL_PCODE_LEGACY_TREE == pcode)
- || (LL_PCODE_TREE_NEW == pcode))
- {
- return true;
- }
- return false;
+ if( (LL_PCODE_LEGACY_GRASS == pcode)
+ || (LL_PCODE_LEGACY_TREE == pcode)
+ || (LL_PCODE_TREE_NEW == pcode))
+ {
+ return true;
+ }
+ return false;
}
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 346073b8a1..d2a337649e 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewerwindow.h
* @brief Description of the LLViewerWindow class.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -77,67 +77,67 @@ class LLCubeMapArray;
class LLPickInfo
{
public:
- typedef enum
- {
- PICK_OBJECT,
- PICK_FLORA,
- PICK_LAND,
- PICK_ICON,
- PICK_PARCEL_WALL,
- PICK_INVALID
- } EPickType;
+ typedef enum
+ {
+ PICK_OBJECT,
+ PICK_FLORA,
+ PICK_LAND,
+ PICK_ICON,
+ PICK_PARCEL_WALL,
+ PICK_INVALID
+ } EPickType;
public:
- LLPickInfo();
- LLPickInfo(const LLCoordGL& mouse_pos,
- MASK keyboard_mask,
- BOOL pick_transparent,
- BOOL pick_rigged,
- BOOL pick_particle,
+ LLPickInfo();
+ LLPickInfo(const LLCoordGL& mouse_pos,
+ MASK keyboard_mask,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
+ BOOL pick_particle,
BOOL pick_reflection_probe,
- BOOL pick_surface_info,
- BOOL pick_unselectable,
- void (*pick_callback)(const LLPickInfo& pick_info));
+ BOOL pick_surface_info,
+ BOOL pick_unselectable,
+ void (*pick_callback)(const LLPickInfo& pick_info));
- void fetchResults();
- LLPointer<LLViewerObject> getObject() const;
- LLUUID getObjectID() const { return mObjectID; }
- bool isValid() const { return mPickType != PICK_INVALID; }
+ void fetchResults();
+ LLPointer<LLViewerObject> getObject() const;
+ LLUUID getObjectID() const { return mObjectID; }
+ bool isValid() const { return mPickType != PICK_INVALID; }
- static bool isFlora(LLViewerObject* object);
+ static bool isFlora(LLViewerObject* object);
public:
- LLCoordGL mMousePt;
- MASK mKeyMask;
- void (*mPickCallback)(const LLPickInfo& pick_info);
-
- EPickType mPickType;
- LLCoordGL mPickPt;
- LLVector3d mPosGlobal;
- LLVector3 mObjectOffset;
- LLUUID mObjectID;
- LLUUID mParticleOwnerID;
- LLUUID mParticleSourceID;
- S32 mObjectFace;
- LLHUDIcon* mHUDIcon;
- LLVector3 mIntersection;
- LLVector2 mUVCoords;
- LLVector2 mSTCoords;
- LLCoordScreen mXYCoords;
- LLVector3 mNormal;
- LLVector4 mTangent;
- LLVector3 mBinormal;
- BOOL mPickTransparent;
- BOOL mPickRigged;
- BOOL mPickParticle;
- BOOL mPickUnselectable;
+ LLCoordGL mMousePt;
+ MASK mKeyMask;
+ void (*mPickCallback)(const LLPickInfo& pick_info);
+
+ EPickType mPickType;
+ LLCoordGL mPickPt;
+ LLVector3d mPosGlobal;
+ LLVector3 mObjectOffset;
+ LLUUID mObjectID;
+ LLUUID mParticleOwnerID;
+ LLUUID mParticleSourceID;
+ S32 mObjectFace;
+ LLHUDIcon* mHUDIcon;
+ LLVector3 mIntersection;
+ LLVector2 mUVCoords;
+ LLVector2 mSTCoords;
+ LLCoordScreen mXYCoords;
+ LLVector3 mNormal;
+ LLVector4 mTangent;
+ LLVector3 mBinormal;
+ BOOL mPickTransparent;
+ BOOL mPickRigged;
+ BOOL mPickParticle;
+ BOOL mPickUnselectable;
BOOL mPickReflectionProbe = FALSE;
- void getSurfaceInfo();
+ void getSurfaceInfo();
private:
- void updateXYCoords();
+ void updateXYCoords();
- BOOL mWantSurfaceInfo; // do we populate mUVCoord, mNormal, mBinormal?
+ BOOL mWantSurfaceInfo; // do we populate mUVCoord, mNormal, mBinormal?
};
@@ -146,228 +146,228 @@ static const U32 MAX_SNAPSHOT_IMAGE_SIZE = 7680; // max snapshot image size 7680
class LLViewerWindow : public LLWindowCallbacks
{
public:
- //
- // CREATORS
- //
- struct Params : public LLInitParam::Block<Params>
- {
- Mandatory<std::string> title,
- name;
- Mandatory<S32> x,
- y,
- width,
- height,
- min_width,
- min_height;
- Optional<bool> fullscreen,
- ignore_pixel_depth,
- first_run;
-
- Params();
- };
-
- LLViewerWindow(const Params& p);
- virtual ~LLViewerWindow();
-
- void shutdownViews();
- void shutdownGL();
-
- void initGLDefaults();
- void initBase();
- void adjustRectanglesForFirstUse(const LLRect& window);
- void adjustControlRectanglesForFirstUse(const LLRect& window);
- void initWorldUI();
- void setUIVisibility(bool);
- bool getUIVisibility();
- void handlePieMenu(S32 x, S32 y, MASK mask);
+ //
+ // CREATORS
+ //
+ struct Params : public LLInitParam::Block<Params>
+ {
+ Mandatory<std::string> title,
+ name;
+ Mandatory<S32> x,
+ y,
+ width,
+ height,
+ min_width,
+ min_height;
+ Optional<bool> fullscreen,
+ ignore_pixel_depth,
+ first_run;
+
+ Params();
+ };
+
+ LLViewerWindow(const Params& p);
+ virtual ~LLViewerWindow();
+
+ void shutdownViews();
+ void shutdownGL();
+
+ void initGLDefaults();
+ void initBase();
+ void adjustRectanglesForFirstUse(const LLRect& window);
+ void adjustControlRectanglesForFirstUse(const LLRect& window);
+ void initWorldUI();
+ void setUIVisibility(bool);
+ bool getUIVisibility();
+ void handlePieMenu(S32 x, S32 y, MASK mask);
void reshapeStatusBarContainer();
- BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down, bool &is_toolmgr_action);
-
- //
- // LLWindowCallback interface implementation
- //
- /*virtual*/ BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated);
- /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask);
- /*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
- /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended
- /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
- /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- /*virtual*/ BOOL handleCloseRequest(LLWindow *window);
- /*virtual*/ void handleQuit(LLWindow *window);
- /*virtual*/ BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
- /*virtual*/ BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- /*virtual*/ BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
- /*virtual*/ BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- /*virtual*/ BOOL handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button);
- /*virtual*/ BOOL handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button);
- BOOL handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down);
- /*virtual*/ LLWindowCallbacks::DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data);
- void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
+ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down, bool &is_toolmgr_action);
+
+ //
+ // LLWindowCallback interface implementation
+ //
+ /*virtual*/ BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated);
+ /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask);
+ /*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
+ /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended
+ /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
+ /*virtual*/ BOOL handleCloseRequest(LLWindow *window);
+ /*virtual*/ void handleQuit(LLWindow *window);
+ /*virtual*/ BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
+ /*virtual*/ BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
+ /*virtual*/ BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
+ /*virtual*/ BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
+ /*virtual*/ BOOL handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button);
+ /*virtual*/ BOOL handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button);
+ BOOL handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down);
+ /*virtual*/ LLWindowCallbacks::DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data);
+ void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
void handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask);
- /*virtual*/ void handleMouseLeave(LLWindow *window);
- /*virtual*/ void handleResize(LLWindow *window, S32 x, S32 y);
- /*virtual*/ void handleFocus(LLWindow *window);
- /*virtual*/ void handleFocusLost(LLWindow *window);
- /*virtual*/ BOOL handleActivate(LLWindow *window, BOOL activated);
- /*virtual*/ BOOL handleActivateApp(LLWindow *window, BOOL activating);
- /*virtual*/ void handleMenuSelect(LLWindow *window, S32 menu_item);
- /*virtual*/ BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height);
- /*virtual*/ void handleScrollWheel(LLWindow *window, S32 clicks);
- /*virtual*/ void handleScrollHWheel(LLWindow *window, S32 clicks);
- /*virtual*/ BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask);
- /*virtual*/ void handleWindowBlock(LLWindow *window);
- /*virtual*/ void handleWindowUnblock(LLWindow *window);
- /*virtual*/ void handleDataCopy(LLWindow *window, S32 data_type, void *data);
- /*virtual*/ BOOL handleTimerEvent(LLWindow *window);
- /*virtual*/ BOOL handleDeviceChange(LLWindow *window);
- /*virtual*/ BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
- /*virtual*/ BOOL handleWindowDidChangeScreen(LLWindow *window);
-
- /*virtual*/ void handlePingWatchdog(LLWindow *window, const char * msg);
- /*virtual*/ void handlePauseWatchdog(LLWindow *window);
- /*virtual*/ void handleResumeWatchdog(LLWindow *window);
- /*virtual*/ std::string translateString(const char* tag);
- /*virtual*/ std::string translateString(const char* tag,
- const std::map<std::string, std::string>& args);
-
- // signal on update of WorldView rect
- typedef boost::function<void (LLRect old_world_rect, LLRect new_world_rect)> world_rect_callback_t;
- typedef boost::signals2::signal<void (LLRect old_world_rect, LLRect new_world_rect)> world_rect_signal_t;
- world_rect_signal_t mOnWorldViewRectUpdated;
- boost::signals2::connection setOnWorldViewRectUpdated(world_rect_callback_t cb) { return mOnWorldViewRectUpdated.connect(cb); }
-
- //
- // ACCESSORS
- //
- LLRootView* getRootView() const;
-
- // 3D world area in scaled pixels (via UI scale), use for most UI computations
- LLRect getWorldViewRectScaled() const;
- S32 getWorldViewHeightScaled() const;
- S32 getWorldViewWidthScaled() const;
-
- // 3D world area, in raw unscaled pixels
- LLRect getWorldViewRectRaw() const { return mWorldViewRectRaw; }
- S32 getWorldViewHeightRaw() const;
- S32 getWorldViewWidthRaw() const;
-
- // Window in scaled pixels (via UI scale), use for most UI computations
- LLRect getWindowRectScaled() const { return mWindowRectScaled; }
- S32 getWindowHeightScaled() const;
- S32 getWindowWidthScaled() const;
-
- // Window in raw pixels as seen on screen.
- LLRect getWindowRectRaw() const { return mWindowRectRaw; }
- S32 getWindowHeightRaw() const;
- S32 getWindowWidthRaw() const;
-
- LLWindow* getWindow() const { return mWindow; }
- void* getPlatformWindow() const;
- void* getMediaWindow() const;
- void focusClient() const;
-
- LLCoordGL getLastMouse() const { return mLastMousePoint; }
- S32 getLastMouseX() const { return mLastMousePoint.mX; }
- S32 getLastMouseY() const { return mLastMousePoint.mY; }
- LLCoordGL getCurrentMouse() const { return mCurrentMousePoint; }
- S32 getCurrentMouseX() const { return mCurrentMousePoint.mX; }
- S32 getCurrentMouseY() const { return mCurrentMousePoint.mY; }
- S32 getCurrentMouseDX() const { return mCurrentMouseDelta.mX; }
- S32 getCurrentMouseDY() const { return mCurrentMouseDelta.mY; }
- LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; }
- static LLTrace::SampleStatHandle<>* getMouseVelocityStat() { return &sMouseVelocityStat; }
- BOOL getLeftMouseDown() const { return mLeftMouseDown; }
- BOOL getMiddleMouseDown() const { return mMiddleMouseDown; }
- BOOL getRightMouseDown() const { return mRightMouseDown; }
-
- const LLPickInfo& getLastPick() const { return mLastPick; }
-
- void setup2DViewport(S32 x_offset = 0, S32 y_offset = 0);
- void setup3DViewport(S32 x_offset = 0, S32 y_offset = 0);
- void setup3DRender();
- void setup2DRender();
-
- LLVector3 mouseDirectionGlobal(const S32 x, const S32 y) const;
- LLVector3 mouseDirectionCamera(const S32 x, const S32 y) const;
- LLVector3 mousePointHUD(const S32 x, const S32 y) const;
-
-
- // Is window of our application frontmost?
- BOOL getActive() const { return mActive; }
-
- const std::string& getInitAlert() { return mInitAlert; }
-
- //
- // MANIPULATORS
- //
- void saveLastMouse(const LLCoordGL &point);
-
- void setCursor( ECursorType c );
- void showCursor();
- void hideCursor();
- BOOL getCursorHidden() { return mCursorHidden; }
- void moveCursorToCenter(); // move to center of window
-
- void initTextures(S32 location_id);
- void setShowProgress(const BOOL show);
- BOOL getShowProgress() const;
- void setProgressString(const std::string& string);
- void setProgressPercent(const F32 percent);
- void setProgressMessage(const std::string& msg);
- void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null );
- LLProgressView *getProgressView() const;
- void revealIntroPanel();
- void setStartupComplete();
-
- void updateObjectUnderCursor();
-
- void updateUI(); // Once per frame, update UI based on mouse position, calls following update* functions
- void updateLayout();
- void updateMouseDelta();
- void updateKeyboardFocus();
-
- void updateWorldViewRect(bool use_full_window=false);
- LLView* getToolBarHolder() { return mToolBarHolder.get(); }
- LLView* getHintHolder() { return mHintHolder.get(); }
- LLView* getLoginPanelHolder() { return mLoginPanelHolder.get(); }
- BOOL handleKey(KEY key, MASK mask);
- BOOL handleKeyUp(KEY key, MASK mask);
- void handleScrollWheel (S32 clicks);
- void handleScrollHWheel (S32 clicks);
-
- // add and remove views from "popup" layer
- void addPopup(LLView* popup);
- void removePopup(LLView* popup);
- void clearPopups();
-
- // Hide normal UI when a logon fails, re-show everything when logon is attempted again
- void setNormalControlsVisible( BOOL visible );
- void setMenuBackgroundColor(bool god_mode = false, bool dev_grid = false);
-
- void reshape(S32 width, S32 height);
- void sendShapeToSim();
-
- void draw();
- void updateDebugText();
- void drawDebugText();
-
- static void loadUserImage(void **cb_data, const LLUUID &uuid);
-
- static void movieSize(S32 new_width, S32 new_height);
-
- // snapshot functionality.
- // perhaps some of this should move to llfloatershapshot? -MG
-
- BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::ESnapshotFormat format = LLSnapshotModel::SNAPSHOT_FORMAT_BMP);
- BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE,
- BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, BOOL no_post = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE);
-
- BOOL simpleSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, const int num_render_passes);
-
-
-
+ /*virtual*/ void handleMouseLeave(LLWindow *window);
+ /*virtual*/ void handleResize(LLWindow *window, S32 x, S32 y);
+ /*virtual*/ void handleFocus(LLWindow *window);
+ /*virtual*/ void handleFocusLost(LLWindow *window);
+ /*virtual*/ BOOL handleActivate(LLWindow *window, BOOL activated);
+ /*virtual*/ BOOL handleActivateApp(LLWindow *window, BOOL activating);
+ /*virtual*/ void handleMenuSelect(LLWindow *window, S32 menu_item);
+ /*virtual*/ BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height);
+ /*virtual*/ void handleScrollWheel(LLWindow *window, S32 clicks);
+ /*virtual*/ void handleScrollHWheel(LLWindow *window, S32 clicks);
+ /*virtual*/ BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask);
+ /*virtual*/ void handleWindowBlock(LLWindow *window);
+ /*virtual*/ void handleWindowUnblock(LLWindow *window);
+ /*virtual*/ void handleDataCopy(LLWindow *window, S32 data_type, void *data);
+ /*virtual*/ BOOL handleTimerEvent(LLWindow *window);
+ /*virtual*/ BOOL handleDeviceChange(LLWindow *window);
+ /*virtual*/ BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
+ /*virtual*/ BOOL handleWindowDidChangeScreen(LLWindow *window);
+
+ /*virtual*/ void handlePingWatchdog(LLWindow *window, const char * msg);
+ /*virtual*/ void handlePauseWatchdog(LLWindow *window);
+ /*virtual*/ void handleResumeWatchdog(LLWindow *window);
+ /*virtual*/ std::string translateString(const char* tag);
+ /*virtual*/ std::string translateString(const char* tag,
+ const std::map<std::string, std::string>& args);
+
+ // signal on update of WorldView rect
+ typedef boost::function<void (LLRect old_world_rect, LLRect new_world_rect)> world_rect_callback_t;
+ typedef boost::signals2::signal<void (LLRect old_world_rect, LLRect new_world_rect)> world_rect_signal_t;
+ world_rect_signal_t mOnWorldViewRectUpdated;
+ boost::signals2::connection setOnWorldViewRectUpdated(world_rect_callback_t cb) { return mOnWorldViewRectUpdated.connect(cb); }
+
+ //
+ // ACCESSORS
+ //
+ LLRootView* getRootView() const;
+
+ // 3D world area in scaled pixels (via UI scale), use for most UI computations
+ LLRect getWorldViewRectScaled() const;
+ S32 getWorldViewHeightScaled() const;
+ S32 getWorldViewWidthScaled() const;
+
+ // 3D world area, in raw unscaled pixels
+ LLRect getWorldViewRectRaw() const { return mWorldViewRectRaw; }
+ S32 getWorldViewHeightRaw() const;
+ S32 getWorldViewWidthRaw() const;
+
+ // Window in scaled pixels (via UI scale), use for most UI computations
+ LLRect getWindowRectScaled() const { return mWindowRectScaled; }
+ S32 getWindowHeightScaled() const;
+ S32 getWindowWidthScaled() const;
+
+ // Window in raw pixels as seen on screen.
+ LLRect getWindowRectRaw() const { return mWindowRectRaw; }
+ S32 getWindowHeightRaw() const;
+ S32 getWindowWidthRaw() const;
+
+ LLWindow* getWindow() const { return mWindow; }
+ void* getPlatformWindow() const;
+ void* getMediaWindow() const;
+ void focusClient() const;
+
+ LLCoordGL getLastMouse() const { return mLastMousePoint; }
+ S32 getLastMouseX() const { return mLastMousePoint.mX; }
+ S32 getLastMouseY() const { return mLastMousePoint.mY; }
+ LLCoordGL getCurrentMouse() const { return mCurrentMousePoint; }
+ S32 getCurrentMouseX() const { return mCurrentMousePoint.mX; }
+ S32 getCurrentMouseY() const { return mCurrentMousePoint.mY; }
+ S32 getCurrentMouseDX() const { return mCurrentMouseDelta.mX; }
+ S32 getCurrentMouseDY() const { return mCurrentMouseDelta.mY; }
+ LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; }
+ static LLTrace::SampleStatHandle<>* getMouseVelocityStat() { return &sMouseVelocityStat; }
+ BOOL getLeftMouseDown() const { return mLeftMouseDown; }
+ BOOL getMiddleMouseDown() const { return mMiddleMouseDown; }
+ BOOL getRightMouseDown() const { return mRightMouseDown; }
+
+ const LLPickInfo& getLastPick() const { return mLastPick; }
+
+ void setup2DViewport(S32 x_offset = 0, S32 y_offset = 0);
+ void setup3DViewport(S32 x_offset = 0, S32 y_offset = 0);
+ void setup3DRender();
+ void setup2DRender();
+
+ LLVector3 mouseDirectionGlobal(const S32 x, const S32 y) const;
+ LLVector3 mouseDirectionCamera(const S32 x, const S32 y) const;
+ LLVector3 mousePointHUD(const S32 x, const S32 y) const;
+
+
+ // Is window of our application frontmost?
+ BOOL getActive() const { return mActive; }
+
+ const std::string& getInitAlert() { return mInitAlert; }
+
+ //
+ // MANIPULATORS
+ //
+ void saveLastMouse(const LLCoordGL &point);
+
+ void setCursor( ECursorType c );
+ void showCursor();
+ void hideCursor();
+ BOOL getCursorHidden() { return mCursorHidden; }
+ void moveCursorToCenter(); // move to center of window
+
+ void initTextures(S32 location_id);
+ void setShowProgress(const BOOL show);
+ BOOL getShowProgress() const;
+ void setProgressString(const std::string& string);
+ void setProgressPercent(const F32 percent);
+ void setProgressMessage(const std::string& msg);
+ void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null );
+ LLProgressView *getProgressView() const;
+ void revealIntroPanel();
+ void setStartupComplete();
+
+ void updateObjectUnderCursor();
+
+ void updateUI(); // Once per frame, update UI based on mouse position, calls following update* functions
+ void updateLayout();
+ void updateMouseDelta();
+ void updateKeyboardFocus();
+
+ void updateWorldViewRect(bool use_full_window=false);
+ LLView* getToolBarHolder() { return mToolBarHolder.get(); }
+ LLView* getHintHolder() { return mHintHolder.get(); }
+ LLView* getLoginPanelHolder() { return mLoginPanelHolder.get(); }
+ BOOL handleKey(KEY key, MASK mask);
+ BOOL handleKeyUp(KEY key, MASK mask);
+ void handleScrollWheel (S32 clicks);
+ void handleScrollHWheel (S32 clicks);
+
+ // add and remove views from "popup" layer
+ void addPopup(LLView* popup);
+ void removePopup(LLView* popup);
+ void clearPopups();
+
+ // Hide normal UI when a logon fails, re-show everything when logon is attempted again
+ void setNormalControlsVisible( BOOL visible );
+ void setMenuBackgroundColor(bool god_mode = false, bool dev_grid = false);
+
+ void reshape(S32 width, S32 height);
+ void sendShapeToSim();
+
+ void draw();
+ void updateDebugText();
+ void drawDebugText();
+
+ static void loadUserImage(void **cb_data, const LLUUID &uuid);
+
+ static void movieSize(S32 new_width, S32 new_height);
+
+ // snapshot functionality.
+ // perhaps some of this should move to llfloatershapshot? -MG
+
+ BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::ESnapshotFormat format = LLSnapshotModel::SNAPSHOT_FORMAT_BMP);
+ BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE,
+ BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, BOOL no_post = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE);
+
+ BOOL simpleSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, const int num_render_passes);
+
+
+
// take a cubemap snapshot
// origin - vantage point to take the snapshot from
// cubearray - cubemap array for storing the results
@@ -376,200 +376,200 @@ public:
// near_clip - near clip setting to use
BOOL cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubearray, S32 index, S32 face, F32 near_clip, bool render_avatars);
-
+
// special implementation of simpleSnapshot for reflection maps
- BOOL reflectionSnapshot(LLImageRaw* raw, S32 image_width, S32 image_height, const int num_render_passes);
-
- BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type);
- BOOL isSnapshotLocSet() const;
- void resetSnapshotLoc() const;
-
- typedef boost::signals2::signal<void(void)> snapshot_saved_signal_t;
-
- void saveImageNumbered(LLImageFormatted *image, BOOL force_picker, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
- void onDirectorySelected(const std::vector<std::string>& filenames, LLImageFormatted *image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
- void saveImageLocal(LLImageFormatted *image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
- void onSelectionFailure(const snapshot_saved_signal_t::slot_type& failure_cb);
-
- // Reset the directory where snapshots are saved.
- // Client will open directory picker on next snapshot save.
- void resetSnapshotLoc();
-
- void playSnapshotAnimAndSound();
-
- // draws selection boxes around selected objects, must call displayObjects first
- void renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud );
- void performPick();
- void returnEmptyPicks();
-
- void pickAsync( S32 x,
- S32 y_from_bot,
- MASK mask,
- void (*callback)(const LLPickInfo& pick_info),
- BOOL pick_transparent = FALSE,
- BOOL pick_rigged = FALSE,
- BOOL pick_unselectable = FALSE,
+ BOOL reflectionSnapshot(LLImageRaw* raw, S32 image_width, S32 image_height, const int num_render_passes);
+
+ BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type);
+ BOOL isSnapshotLocSet() const;
+ void resetSnapshotLoc() const;
+
+ typedef boost::signals2::signal<void(void)> snapshot_saved_signal_t;
+
+ void saveImageNumbered(LLImageFormatted *image, BOOL force_picker, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
+ void onDirectorySelected(const std::vector<std::string>& filenames, LLImageFormatted *image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
+ void saveImageLocal(LLImageFormatted *image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb);
+ void onSelectionFailure(const snapshot_saved_signal_t::slot_type& failure_cb);
+
+ // Reset the directory where snapshots are saved.
+ // Client will open directory picker on next snapshot save.
+ void resetSnapshotLoc();
+
+ void playSnapshotAnimAndSound();
+
+ // draws selection boxes around selected objects, must call displayObjects first
+ void renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud );
+ void performPick();
+ void returnEmptyPicks();
+
+ void pickAsync( S32 x,
+ S32 y_from_bot,
+ MASK mask,
+ void (*callback)(const LLPickInfo& pick_info),
+ BOOL pick_transparent = FALSE,
+ BOOL pick_rigged = FALSE,
+ BOOL pick_unselectable = FALSE,
BOOL pick_reflection_probes = FALSE);
- LLPickInfo pickImmediate(S32 x, S32 y, BOOL pick_transparent, BOOL pick_rigged = FALSE, BOOL pick_particle = FALSE, BOOL pick_unselectable = TRUE, BOOL pick_reflection_probe = FALSE);
- LLHUDIcon* cursorIntersectIcon(S32 mouse_x, S32 mouse_y, F32 depth,
- LLVector4a* intersection);
-
- LLViewerObject* cursorIntersect(S32 mouse_x = -1, S32 mouse_y = -1, F32 depth = 512.f,
- LLViewerObject *this_object = NULL,
- S32 this_face = -1,
- BOOL pick_transparent = FALSE,
- BOOL pick_rigged = FALSE,
+ LLPickInfo pickImmediate(S32 x, S32 y, BOOL pick_transparent, BOOL pick_rigged = FALSE, BOOL pick_particle = FALSE, BOOL pick_unselectable = TRUE, BOOL pick_reflection_probe = FALSE);
+ LLHUDIcon* cursorIntersectIcon(S32 mouse_x, S32 mouse_y, F32 depth,
+ LLVector4a* intersection);
+
+ LLViewerObject* cursorIntersect(S32 mouse_x = -1, S32 mouse_y = -1, F32 depth = 512.f,
+ LLViewerObject *this_object = NULL,
+ S32 this_face = -1,
+ BOOL pick_transparent = FALSE,
+ BOOL pick_rigged = FALSE,
BOOL pick_unselectable = TRUE,
BOOL pick_reflection_probe = TRUE,
- S32* face_hit = NULL,
- LLVector4a *intersection = NULL,
- LLVector2 *uv = NULL,
- LLVector4a *normal = NULL,
- LLVector4a *tangent = NULL,
- LLVector4a* start = NULL,
- LLVector4a* end = NULL);
-
-
- // Returns a pointer to the last object hit
- //LLViewerObject *getObject();
- //LLViewerObject *lastNonFloraObjectHit();
-
- //const LLVector3d& getObjectOffset();
- //const LLVector3d& lastNonFloraObjectHitOffset();
-
- // mousePointOnLand() returns true if found point
- BOOL mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_pos_global, BOOL ignore_distance = FALSE);
- BOOL mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, const S32 y, const LLVector3d &plane_point, const LLVector3 &plane_normal);
- LLVector3d clickPointInWorldGlobal(const S32 x, const S32 y_from_bot, LLViewerObject* clicked_object) const;
- BOOL clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewerObject *objectp, LLVector3d &point_global) const;
-
- // Prints window implementation details
- void dumpState();
-
- // handle shutting down GL and bringing it back up
- void requestResolutionUpdate();
- void checkSettings();
- void restartDisplay(BOOL show_progress_bar);
- BOOL changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync, BOOL show_progress_bar);
- BOOL getIgnoreDestroyWindow() { return mIgnoreActivate; }
- F32 getWorldViewAspectRatio() const;
- const LLVector2& getDisplayScale() const { return mDisplayScale; }
- void calcDisplayScale();
- static LLRect calcScaledRect(const LLRect & rect, const LLVector2& display_scale);
-
- static std::string getLastSnapshotDir();
+ S32* face_hit = NULL,
+ LLVector4a *intersection = NULL,
+ LLVector2 *uv = NULL,
+ LLVector4a *normal = NULL,
+ LLVector4a *tangent = NULL,
+ LLVector4a* start = NULL,
+ LLVector4a* end = NULL);
+
+
+ // Returns a pointer to the last object hit
+ //LLViewerObject *getObject();
+ //LLViewerObject *lastNonFloraObjectHit();
+
+ //const LLVector3d& getObjectOffset();
+ //const LLVector3d& lastNonFloraObjectHitOffset();
+
+ // mousePointOnLand() returns true if found point
+ BOOL mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_pos_global, BOOL ignore_distance = FALSE);
+ BOOL mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, const S32 y, const LLVector3d &plane_point, const LLVector3 &plane_normal);
+ LLVector3d clickPointInWorldGlobal(const S32 x, const S32 y_from_bot, LLViewerObject* clicked_object) const;
+ BOOL clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewerObject *objectp, LLVector3d &point_global) const;
+
+ // Prints window implementation details
+ void dumpState();
+
+ // handle shutting down GL and bringing it back up
+ void requestResolutionUpdate();
+ void checkSettings();
+ void restartDisplay(BOOL show_progress_bar);
+ BOOL changeDisplaySettings(LLCoordScreen size, BOOL enable_vsync, BOOL show_progress_bar);
+ BOOL getIgnoreDestroyWindow() { return mIgnoreActivate; }
+ F32 getWorldViewAspectRatio() const;
+ const LLVector2& getDisplayScale() const { return mDisplayScale; }
+ void calcDisplayScale();
+ static LLRect calcScaledRect(const LLRect & rect, const LLVector2& display_scale);
+
+ static std::string getLastSnapshotDir();
private:
- bool shouldShowToolTipFor(LLMouseHandler *mh);
-
- void switchToolByMask(MASK mask);
- void destroyWindow();
- void drawMouselookInstructions();
- void stopGL(BOOL save_state = TRUE);
- void restoreGL(const std::string& progress_message = LLStringUtil::null);
- void initFonts(F32 zoom_factor = 1.f);
- void schedulePick(LLPickInfo& pick_info);
- S32 getChatConsoleBottomPad(); // Vertical padding for child console rect, varied by bottom clutter
- LLRect getChatConsoleRect(); // Get optimal cosole rect.
+ bool shouldShowToolTipFor(LLMouseHandler *mh);
+
+ void switchToolByMask(MASK mask);
+ void destroyWindow();
+ void drawMouselookInstructions();
+ void stopGL(BOOL save_state = TRUE);
+ void restoreGL(const std::string& progress_message = LLStringUtil::null);
+ void initFonts(F32 zoom_factor = 1.f);
+ void schedulePick(LLPickInfo& pick_info);
+ S32 getChatConsoleBottomPad(); // Vertical padding for child console rect, varied by bottom clutter
+ LLRect getChatConsoleRect(); // Get optimal cosole rect.
private:
- LLWindow* mWindow; // graphical window object
- bool mActive;
- bool mUIVisible;
-
- LLNotificationChannelPtr mSystemChannel;
- LLNotificationChannelPtr mCommunicationChannel;
- LLNotificationChannelPtr mAlertsChannel;
- LLNotificationChannelPtr mModalAlertsChannel;
-
- LLRect mWindowRectRaw; // whole window, including UI
- LLRect mWindowRectScaled; // whole window, scaled by UI size
- LLRect mWorldViewRectRaw; // area of screen for 3D world
- LLRect mWorldViewRectScaled; // area of screen for 3D world scaled by UI size
- LLRootView* mRootView; // a view of size mWindowRectRaw, containing all child views
- LLVector2 mDisplayScale;
-
- LLCoordGL mCurrentMousePoint; // last mouse position in GL coords
- LLCoordGL mLastMousePoint; // Mouse point at last frame.
- LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame
- BOOL mLeftMouseDown;
- BOOL mMiddleMouseDown;
- BOOL mRightMouseDown;
-
- LLProgressView *mProgressView;
-
- LLFrameTimer mToolTipFadeTimer;
- LLPanel* mToolTip;
- std::string mLastToolTipMessage;
- LLRect mToolTipStickyRect; // Once a tool tip is shown, it will stay visible until the mouse leaves this rect.
-
- BOOL mMouseInWindow; // True if the mouse is over our window or if we have captured the mouse.
- BOOL mFocusCycleMode;
+ LLWindow* mWindow; // graphical window object
+ bool mActive;
+ bool mUIVisible;
+
+ LLNotificationChannelPtr mSystemChannel;
+ LLNotificationChannelPtr mCommunicationChannel;
+ LLNotificationChannelPtr mAlertsChannel;
+ LLNotificationChannelPtr mModalAlertsChannel;
+
+ LLRect mWindowRectRaw; // whole window, including UI
+ LLRect mWindowRectScaled; // whole window, scaled by UI size
+ LLRect mWorldViewRectRaw; // area of screen for 3D world
+ LLRect mWorldViewRectScaled; // area of screen for 3D world scaled by UI size
+ LLRootView* mRootView; // a view of size mWindowRectRaw, containing all child views
+ LLVector2 mDisplayScale;
+
+ LLCoordGL mCurrentMousePoint; // last mouse position in GL coords
+ LLCoordGL mLastMousePoint; // Mouse point at last frame.
+ LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame
+ BOOL mLeftMouseDown;
+ BOOL mMiddleMouseDown;
+ BOOL mRightMouseDown;
+
+ LLProgressView *mProgressView;
+
+ LLFrameTimer mToolTipFadeTimer;
+ LLPanel* mToolTip;
+ std::string mLastToolTipMessage;
+ LLRect mToolTipStickyRect; // Once a tool tip is shown, it will stay visible until the mouse leaves this rect.
+
+ BOOL mMouseInWindow; // True if the mouse is over our window or if we have captured the mouse.
+ BOOL mFocusCycleMode;
BOOL mAllowMouseDragging;
LLFrameTimer mMouseDownTimer;
- typedef std::set<LLHandle<LLView> > view_handle_set_t;
- view_handle_set_t mMouseHoverViews;
-
- // Variables used for tool override switching based on modifier keys. JC
- MASK mLastMask; // used to detect changes in modifier mask
- LLTool* mToolStored; // the tool we're overriding
- BOOL mHideCursorPermanent; // true during drags, mouselook
- BOOL mCursorHidden;
- LLPickInfo mLastPick;
- std::vector<LLPickInfo> mPicks;
- LLRect mPickScreenRegion; // area of frame buffer for rendering pick frames (generally follows mouse to avoid going offscreen)
- LLTimer mPickTimer; // timer for scheduling n picks per second
-
- std::string mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta"
-
- BOOL mIgnoreActivate;
-
- std::string mInitAlert; // Window / GL initialization requires an alert
-
- LLHandle<LLView> mWorldViewPlaceholder; // widget that spans the portion of screen dedicated to rendering the 3d world
- LLHandle<LLView> mToolBarHolder; // container for toolbars
- LLHandle<LLView> mHintHolder; // container for hints
- LLHandle<LLView> mLoginPanelHolder; // container for login panel
- LLPopupView* mPopupView; // container for transient popups
-
- class LLDebugText* mDebugText; // Internal class for debug text
-
- bool mResDirty;
- bool mStatesDirty;
- U32 mCurrResolutionIndex;
-
- std::unique_ptr<LLWindowListener> mWindowListener;
- std::unique_ptr<LLViewerWindowListener> mViewerWindowListener;
-
- // Object temporarily hovered over while dragging
- LLPointer<LLViewerObject> mDragHoveredObject;
-
- static LLTrace::SampleStatHandle<> sMouseVelocityStat;
+ typedef std::set<LLHandle<LLView> > view_handle_set_t;
+ view_handle_set_t mMouseHoverViews;
+
+ // Variables used for tool override switching based on modifier keys. JC
+ MASK mLastMask; // used to detect changes in modifier mask
+ LLTool* mToolStored; // the tool we're overriding
+ BOOL mHideCursorPermanent; // true during drags, mouselook
+ BOOL mCursorHidden;
+ LLPickInfo mLastPick;
+ std::vector<LLPickInfo> mPicks;
+ LLRect mPickScreenRegion; // area of frame buffer for rendering pick frames (generally follows mouse to avoid going offscreen)
+ LLTimer mPickTimer; // timer for scheduling n picks per second
+
+ std::string mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta"
+
+ BOOL mIgnoreActivate;
+
+ std::string mInitAlert; // Window / GL initialization requires an alert
+
+ LLHandle<LLView> mWorldViewPlaceholder; // widget that spans the portion of screen dedicated to rendering the 3d world
+ LLHandle<LLView> mToolBarHolder; // container for toolbars
+ LLHandle<LLView> mHintHolder; // container for hints
+ LLHandle<LLView> mLoginPanelHolder; // container for login panel
+ LLPopupView* mPopupView; // container for transient popups
+
+ class LLDebugText* mDebugText; // Internal class for debug text
+
+ bool mResDirty;
+ bool mStatesDirty;
+ U32 mCurrResolutionIndex;
+
+ std::unique_ptr<LLWindowListener> mWindowListener;
+ std::unique_ptr<LLViewerWindowListener> mViewerWindowListener;
+
+ // Object temporarily hovered over while dragging
+ LLPointer<LLViewerObject> mDragHoveredObject;
+
+ static LLTrace::SampleStatHandle<> sMouseVelocityStat;
};
//
// Globals
//
-extern LLViewerWindow* gViewerWindow;
+extern LLViewerWindow* gViewerWindow;
-extern LLFrameTimer gAwayTimer; // tracks time before setting the avatar away state to true
-extern LLFrameTimer gAwayTriggerTimer; // how long the avatar has been away
+extern LLFrameTimer gAwayTimer; // tracks time before setting the avatar away state to true
+extern LLFrameTimer gAwayTriggerTimer; // how long the avatar has been away
extern LLViewerObject* gDebugRaycastObject;
extern LLVector4a gDebugRaycastIntersection;
-extern LLVOPartGroup* gDebugRaycastParticle;
-extern LLVector4a gDebugRaycastParticleIntersection;
+extern LLVOPartGroup* gDebugRaycastParticle;
+extern LLVector4a gDebugRaycastParticleIntersection;
extern LLVector2 gDebugRaycastTexCoord;
extern LLVector4a gDebugRaycastNormal;
extern LLVector4a gDebugRaycastTangent;
-extern S32 gDebugRaycastFaceHit;
-extern LLVector4a gDebugRaycastStart;
-extern LLVector4a gDebugRaycastEnd;
-
-extern BOOL gDisplayCameraPos;
-extern BOOL gDisplayWindInfo;
-extern BOOL gDisplayFOV;
-extern BOOL gDisplayBadge;
+extern S32 gDebugRaycastFaceHit;
+extern LLVector4a gDebugRaycastStart;
+extern LLVector4a gDebugRaycastEnd;
+
+extern BOOL gDisplayCameraPos;
+extern BOOL gDisplayWindInfo;
+extern BOOL gDisplayFOV;
+extern BOOL gDisplayBadge;
#endif
diff --git a/indra/newview/llviewerwindowlistener.cpp b/indra/newview/llviewerwindowlistener.cpp
index acf25b9792..da7e18af5c 100644
--- a/indra/newview/llviewerwindowlistener.cpp
+++ b/indra/newview/llviewerwindowlistener.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-06-30
* @brief Implementation for llviewerwindowlistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -96,7 +96,7 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
{
LL_ERRS("LLViewerWindowListener") << "LLViewerWindowListener::saveSnapshot(): "
<< "unrecognized type " << event["type"] << LL_ENDL;
- return;
+ return;
}
type = found->second;
}
@@ -106,8 +106,8 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
void LLViewerWindowListener::requestReshape(LLSD const & event_data) const
{
- if(event_data.has("w") && event_data.has("h"))
- {
- mViewerWindow->reshape(event_data["w"].asInteger(), event_data["h"].asInteger());
- }
+ if(event_data.has("w") && event_data.has("h"))
+ {
+ mViewerWindow->reshape(event_data["w"].asInteger(), event_data["h"].asInteger());
+ }
}
diff --git a/indra/newview/llviewerwindowlistener.h b/indra/newview/llviewerwindowlistener.h
index d627aad266..e1805e971f 100644
--- a/indra/newview/llviewerwindowlistener.h
+++ b/indra/newview/llviewerwindowlistener.h
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-06-30
* @brief Event API for subset of LLViewerWindow methods
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp
index 001fab7755..c3334866a5 100644
--- a/indra/newview/llvlcomposition.cpp
+++ b/indra/newview/llvlcomposition.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvlcomposition.cpp
* @brief Viewer-side representation of a composition layer...
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,42 +43,42 @@
F32 bilinear(const F32 v00, const F32 v01, const F32 v10, const F32 v11, const F32 x_frac, const F32 y_frac)
{
- // Not sure if this is the right math...
- // Take weighted average of all four points (bilinear interpolation)
- F32 result;
-
- const F32 inv_x_frac = 1.f - x_frac;
- const F32 inv_y_frac = 1.f - y_frac;
- result = inv_x_frac*inv_y_frac*v00
- + x_frac*inv_y_frac*v10
- + inv_x_frac*y_frac*v01
- + x_frac*y_frac*v11;
-
- return result;
+ // Not sure if this is the right math...
+ // Take weighted average of all four points (bilinear interpolation)
+ F32 result;
+
+ const F32 inv_x_frac = 1.f - x_frac;
+ const F32 inv_y_frac = 1.f - y_frac;
+ result = inv_x_frac*inv_y_frac*v00
+ + x_frac*inv_y_frac*v10
+ + inv_x_frac*y_frac*v01
+ + x_frac*y_frac*v11;
+
+ return result;
}
LLVLComposition::LLVLComposition(LLSurface *surfacep, const U32 width, const F32 scale) :
- LLViewerLayer(width, scale),
- mParamsReady(FALSE)
+ LLViewerLayer(width, scale),
+ mParamsReady(FALSE)
{
- mSurfacep = surfacep;
-
- // Load Terrain Textures - Original ones
- setDetailTextureID(0, TERRAIN_DIRT_DETAIL);
- setDetailTextureID(1, TERRAIN_GRASS_DETAIL);
- setDetailTextureID(2, TERRAIN_MOUNTAIN_DETAIL);
- setDetailTextureID(3, TERRAIN_ROCK_DETAIL);
-
- // Initialize the texture matrix to defaults.
- for (S32 i = 0; i < CORNER_COUNT; ++i)
- {
- mStartHeight[i] = gSavedSettings.getF32("TerrainColorStartHeight");
- mHeightRange[i] = gSavedSettings.getF32("TerrainColorHeightRange");
- }
- mTexScaleX = 16.f;
- mTexScaleY = 16.f;
- mTexturesLoaded = FALSE;
+ mSurfacep = surfacep;
+
+ // Load Terrain Textures - Original ones
+ setDetailTextureID(0, TERRAIN_DIRT_DETAIL);
+ setDetailTextureID(1, TERRAIN_GRASS_DETAIL);
+ setDetailTextureID(2, TERRAIN_MOUNTAIN_DETAIL);
+ setDetailTextureID(3, TERRAIN_ROCK_DETAIL);
+
+ // Initialize the texture matrix to defaults.
+ for (S32 i = 0; i < CORNER_COUNT; ++i)
+ {
+ mStartHeight[i] = gSavedSettings.getF32("TerrainColorStartHeight");
+ mHeightRange[i] = gSavedSettings.getF32("TerrainColorHeightRange");
+ }
+ mTexScaleX = 16.f;
+ mTexScaleY = 16.f;
+ mTexturesLoaded = FALSE;
}
@@ -89,124 +89,124 @@ LLVLComposition::~LLVLComposition()
void LLVLComposition::setSurface(LLSurface *surfacep)
{
- mSurfacep = surfacep;
+ mSurfacep = surfacep;
}
void LLVLComposition::setDetailTextureID(S32 corner, const LLUUID& id)
{
- if(id.isNull())
- {
- return;
- }
- // This is terrain texture, but we are not setting it as BOOST_TERRAIN
- // since we will be manipulating it later as needed.
- mDetailTextures[corner] = LLViewerTextureManager::getFetchedTexture(id);
- mDetailTextures[corner]->setNoDelete() ;
- mRawImages[corner] = NULL;
+ if(id.isNull())
+ {
+ return;
+ }
+ // This is terrain texture, but we are not setting it as BOOST_TERRAIN
+ // since we will be manipulating it later as needed.
+ mDetailTextures[corner] = LLViewerTextureManager::getFetchedTexture(id);
+ mDetailTextures[corner]->setNoDelete() ;
+ mRawImages[corner] = NULL;
}
BOOL LLVLComposition::generateHeights(const F32 x, const F32 y,
- const F32 width, const F32 height)
+ const F32 width, const F32 height)
{
- if (!mParamsReady)
- {
- // All the parameters haven't been set yet (we haven't gotten the message from the sim)
- return FALSE;
- }
-
- llassert(mSurfacep);
-
- if (!mSurfacep || !mSurfacep->getRegion())
- {
- // We don't always have the region yet here....
- return FALSE;
- }
-
- S32 x_begin, y_begin, x_end, y_end;
-
- x_begin = ll_round( x * mScaleInv );
- y_begin = ll_round( y * mScaleInv );
- x_end = ll_round( (x + width) * mScaleInv );
- y_end = ll_round( (y + width) * mScaleInv );
-
- if (x_end > mWidth)
- {
- x_end = mWidth;
- }
- if (y_end > mWidth)
- {
- y_end = mWidth;
- }
-
- LLVector3d origin_global = from_region_handle(mSurfacep->getRegion()->getHandle());
-
- // For perlin noise generation...
- const F32 slope_squared = 1.5f*1.5f;
- const F32 xyScale = 4.9215f; //0.93284f;
- const F32 zScale = 4; //0.92165f;
- const F32 z_offset = 0.f;
- const F32 noise_magnitude = 2.f; // Degree to which noise modulates composition layer (versus
- // simple height)
-
- // Heights map into textures as 0-1 = first, 1-2 = second, etc.
- // So we need to compress heights into this range.
- const S32 NUM_TEXTURES = 4;
-
- const F32 xyScaleInv = (1.f / xyScale);
- const F32 zScaleInv = (1.f / zScale);
-
- const F32 inv_width = 1.f/mWidth;
-
- // OK, for now, just have the composition value equal the height at the point.
- for (S32 j = y_begin; j < y_end; j++)
- {
- for (S32 i = x_begin; i < x_end; i++)
- {
-
- F32 vec[3];
- F32 vec1[3];
- F32 twiddle;
-
- // Bilinearly interpolate the start height and height range of the textures
- F32 start_height = bilinear(mStartHeight[SOUTHWEST],
- mStartHeight[SOUTHEAST],
- mStartHeight[NORTHWEST],
- mStartHeight[NORTHEAST],
- i*inv_width, j*inv_width); // These will be bilinearly interpolated
- F32 height_range = bilinear(mHeightRange[SOUTHWEST],
- mHeightRange[SOUTHEAST],
- mHeightRange[NORTHWEST],
- mHeightRange[NORTHEAST],
- i*inv_width, j*inv_width); // These will be bilinearly interpolated
-
- LLVector3 location(i*mScale, j*mScale, 0.f);
-
- F32 height = mSurfacep->resolveHeightRegion(location) + z_offset;
-
- // Step 0: Measure the exact height at this texel
- vec[0] = (F32)(origin_global.mdV[VX]+location.mV[VX])*xyScaleInv; // Adjust to non-integer lattice
- vec[1] = (F32)(origin_global.mdV[VY]+location.mV[VY])*xyScaleInv;
- vec[2] = height*zScaleInv;
- //
- // Choose material value by adding to the exact height a random value
- //
- vec1[0] = vec[0]*(0.2222222222f);
- vec1[1] = vec[1]*(0.2222222222f);
- vec1[2] = vec[2]*(0.2222222222f);
- twiddle = noise2(vec1)*6.5f; // Low freq component for large divisions
-
- twiddle += turbulence2(vec, 2)*slope_squared; // High frequency component
- twiddle *= noise_magnitude;
-
- F32 scaled_noisy_height = (height + twiddle - start_height) * F32(NUM_TEXTURES) / height_range;
-
- scaled_noisy_height = llmax(0.f, scaled_noisy_height);
- scaled_noisy_height = llmin(3.f, scaled_noisy_height);
- *(mDatap + i + j*mWidth) = scaled_noisy_height;
- }
- }
- return TRUE;
+ if (!mParamsReady)
+ {
+ // All the parameters haven't been set yet (we haven't gotten the message from the sim)
+ return FALSE;
+ }
+
+ llassert(mSurfacep);
+
+ if (!mSurfacep || !mSurfacep->getRegion())
+ {
+ // We don't always have the region yet here....
+ return FALSE;
+ }
+
+ S32 x_begin, y_begin, x_end, y_end;
+
+ x_begin = ll_round( x * mScaleInv );
+ y_begin = ll_round( y * mScaleInv );
+ x_end = ll_round( (x + width) * mScaleInv );
+ y_end = ll_round( (y + width) * mScaleInv );
+
+ if (x_end > mWidth)
+ {
+ x_end = mWidth;
+ }
+ if (y_end > mWidth)
+ {
+ y_end = mWidth;
+ }
+
+ LLVector3d origin_global = from_region_handle(mSurfacep->getRegion()->getHandle());
+
+ // For perlin noise generation...
+ const F32 slope_squared = 1.5f*1.5f;
+ const F32 xyScale = 4.9215f; //0.93284f;
+ const F32 zScale = 4; //0.92165f;
+ const F32 z_offset = 0.f;
+ const F32 noise_magnitude = 2.f; // Degree to which noise modulates composition layer (versus
+ // simple height)
+
+ // Heights map into textures as 0-1 = first, 1-2 = second, etc.
+ // So we need to compress heights into this range.
+ const S32 NUM_TEXTURES = 4;
+
+ const F32 xyScaleInv = (1.f / xyScale);
+ const F32 zScaleInv = (1.f / zScale);
+
+ const F32 inv_width = 1.f/mWidth;
+
+ // OK, for now, just have the composition value equal the height at the point.
+ for (S32 j = y_begin; j < y_end; j++)
+ {
+ for (S32 i = x_begin; i < x_end; i++)
+ {
+
+ F32 vec[3];
+ F32 vec1[3];
+ F32 twiddle;
+
+ // Bilinearly interpolate the start height and height range of the textures
+ F32 start_height = bilinear(mStartHeight[SOUTHWEST],
+ mStartHeight[SOUTHEAST],
+ mStartHeight[NORTHWEST],
+ mStartHeight[NORTHEAST],
+ i*inv_width, j*inv_width); // These will be bilinearly interpolated
+ F32 height_range = bilinear(mHeightRange[SOUTHWEST],
+ mHeightRange[SOUTHEAST],
+ mHeightRange[NORTHWEST],
+ mHeightRange[NORTHEAST],
+ i*inv_width, j*inv_width); // These will be bilinearly interpolated
+
+ LLVector3 location(i*mScale, j*mScale, 0.f);
+
+ F32 height = mSurfacep->resolveHeightRegion(location) + z_offset;
+
+ // Step 0: Measure the exact height at this texel
+ vec[0] = (F32)(origin_global.mdV[VX]+location.mV[VX])*xyScaleInv; // Adjust to non-integer lattice
+ vec[1] = (F32)(origin_global.mdV[VY]+location.mV[VY])*xyScaleInv;
+ vec[2] = height*zScaleInv;
+ //
+ // Choose material value by adding to the exact height a random value
+ //
+ vec1[0] = vec[0]*(0.2222222222f);
+ vec1[1] = vec[1]*(0.2222222222f);
+ vec1[2] = vec[2]*(0.2222222222f);
+ twiddle = noise2(vec1)*6.5f; // Low freq component for large divisions
+
+ twiddle += turbulence2(vec, 2)*slope_squared; // High frequency component
+ twiddle *= noise_magnitude;
+
+ F32 scaled_noisy_height = (height + twiddle - start_height) * F32(NUM_TEXTURES) / height_range;
+
+ scaled_noisy_height = llmax(0.f, scaled_noisy_height);
+ scaled_noisy_height = llmin(3.f, scaled_noisy_height);
+ *(mDatap + i + j*mWidth) = scaled_noisy_height;
+ }
+ }
+ return TRUE;
}
static const U32 BASE_SIZE = 128;
@@ -214,287 +214,287 @@ static const U32 BASE_SIZE = 128;
BOOL LLVLComposition::generateComposition()
{
- if (!mParamsReady)
- {
- // All the parameters haven't been set yet (we haven't gotten the message from the sim)
- return FALSE;
- }
-
- for (S32 i = 0; i < 4; i++)
- {
- if (mDetailTextures[i]->getDiscardLevel() < 0)
- {
- mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); // in case we are at low detail
- mDetailTextures[i]->addTextureStats(BASE_SIZE*BASE_SIZE);
- return FALSE;
- }
- if ((mDetailTextures[i]->getDiscardLevel() != 0 &&
- (mDetailTextures[i]->getWidth() < BASE_SIZE ||
- mDetailTextures[i]->getHeight() < BASE_SIZE)))
- {
- S32 width = mDetailTextures[i]->getFullWidth();
- S32 height = mDetailTextures[i]->getFullHeight();
- S32 min_dim = llmin(width, height);
- S32 ddiscard = 0;
- while (min_dim > BASE_SIZE && ddiscard < MAX_DISCARD_LEVEL)
- {
- ddiscard++;
- min_dim /= 2;
- }
- mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); // in case we are at low detail
- mDetailTextures[i]->setMinDiscardLevel(ddiscard);
- mDetailTextures[i]->addTextureStats(BASE_SIZE*BASE_SIZE); // priority
- return FALSE;
- }
- }
-
- return TRUE;
+ if (!mParamsReady)
+ {
+ // All the parameters haven't been set yet (we haven't gotten the message from the sim)
+ return FALSE;
+ }
+
+ for (S32 i = 0; i < 4; i++)
+ {
+ if (mDetailTextures[i]->getDiscardLevel() < 0)
+ {
+ mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); // in case we are at low detail
+ mDetailTextures[i]->addTextureStats(BASE_SIZE*BASE_SIZE);
+ return FALSE;
+ }
+ if ((mDetailTextures[i]->getDiscardLevel() != 0 &&
+ (mDetailTextures[i]->getWidth() < BASE_SIZE ||
+ mDetailTextures[i]->getHeight() < BASE_SIZE)))
+ {
+ S32 width = mDetailTextures[i]->getFullWidth();
+ S32 height = mDetailTextures[i]->getFullHeight();
+ S32 min_dim = llmin(width, height);
+ S32 ddiscard = 0;
+ while (min_dim > BASE_SIZE && ddiscard < MAX_DISCARD_LEVEL)
+ {
+ ddiscard++;
+ min_dim /= 2;
+ }
+ mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); // in case we are at low detail
+ mDetailTextures[i]->setMinDiscardLevel(ddiscard);
+ mDetailTextures[i]->addTextureStats(BASE_SIZE*BASE_SIZE); // priority
+ return FALSE;
+ }
+ }
+
+ return TRUE;
}
BOOL LLVLComposition::generateTexture(const F32 x, const F32 y,
- const F32 width, const F32 height)
+ const F32 width, const F32 height)
{
- LL_PROFILE_ZONE_SCOPED
- llassert(mSurfacep);
- llassert(x >= 0.f);
- llassert(y >= 0.f);
-
- LLTimer gen_timer;
-
- ///////////////////////////
- //
- // Generate raw data arrays for surface textures
- //
- //
-
- // These have already been validated by generateComposition.
- U8* st_data[4];
- S32 st_data_size[4]; // for debugging
-
- for (S32 i = 0; i < 4; i++)
- {
- if (mRawImages[i].isNull())
- {
- // Read back a raw image for this discard level, if it exists
- S32 min_dim = llmin(mDetailTextures[i]->getFullWidth(), mDetailTextures[i]->getFullHeight());
- S32 ddiscard = 0;
- while (min_dim > BASE_SIZE && ddiscard < MAX_DISCARD_LEVEL)
- {
- ddiscard++;
- min_dim /= 2;
- }
-
- BOOL delete_raw = (mDetailTextures[i]->reloadRawImage(ddiscard) != NULL) ;
- if(mDetailTextures[i]->getRawImageLevel() != ddiscard)//raw iamge is not ready, will enter here again later.
- {
+ LL_PROFILE_ZONE_SCOPED
+ llassert(mSurfacep);
+ llassert(x >= 0.f);
+ llassert(y >= 0.f);
+
+ LLTimer gen_timer;
+
+ ///////////////////////////
+ //
+ // Generate raw data arrays for surface textures
+ //
+ //
+
+ // These have already been validated by generateComposition.
+ U8* st_data[4];
+ S32 st_data_size[4]; // for debugging
+
+ for (S32 i = 0; i < 4; i++)
+ {
+ if (mRawImages[i].isNull())
+ {
+ // Read back a raw image for this discard level, if it exists
+ S32 min_dim = llmin(mDetailTextures[i]->getFullWidth(), mDetailTextures[i]->getFullHeight());
+ S32 ddiscard = 0;
+ while (min_dim > BASE_SIZE && ddiscard < MAX_DISCARD_LEVEL)
+ {
+ ddiscard++;
+ min_dim /= 2;
+ }
+
+ BOOL delete_raw = (mDetailTextures[i]->reloadRawImage(ddiscard) != NULL) ;
+ if(mDetailTextures[i]->getRawImageLevel() != ddiscard)//raw iamge is not ready, will enter here again later.
+ {
if (mDetailTextures[i]->getFetchPriority() <= 0.0f && !mDetailTextures[i]->hasSavedRawImage())
{
mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_MAP);
mDetailTextures[i]->forceToRefetchTexture(ddiscard);
}
- if(delete_raw)
- {
- mDetailTextures[i]->destroyRawImage() ;
- }
- LL_DEBUGS("Terrain") << "cached raw data for terrain detail texture is not ready yet: " << mDetailTextures[i]->getID() << " Discard: " << ddiscard << LL_ENDL;
- return FALSE;
- }
-
- mRawImages[i] = mDetailTextures[i]->getRawImage() ;
- if(delete_raw)
- {
- mDetailTextures[i]->destroyRawImage() ;
- }
- if (mDetailTextures[i]->getWidth(ddiscard) != BASE_SIZE ||
- mDetailTextures[i]->getHeight(ddiscard) != BASE_SIZE ||
- mDetailTextures[i]->getComponents() != 3)
- {
- LLPointer<LLImageRaw> newraw = new LLImageRaw(BASE_SIZE, BASE_SIZE, 3);
- newraw->composite(mRawImages[i]);
- mRawImages[i] = newraw; // deletes old
- }
- }
- st_data[i] = mRawImages[i]->getData();
- st_data_size[i] = mRawImages[i]->getDataSize();
- }
-
- ///////////////////////////////////////
- //
- // Generate and clamp x/y bounding box.
- //
- //
-
- S32 x_begin, y_begin, x_end, y_end;
- x_begin = (S32)(x * mScaleInv);
- y_begin = (S32)(y * mScaleInv);
- x_end = ll_round( (x + width) * mScaleInv );
- y_end = ll_round( (y + width) * mScaleInv );
-
- if (x_end > mWidth)
- {
- LL_WARNS("Terrain") << "x end > width" << LL_ENDL;
- x_end = mWidth;
- }
- if (y_end > mWidth)
- {
- LL_WARNS("Terrain") << "y end > width" << LL_ENDL;
- y_end = mWidth;
- }
-
-
- ///////////////////////////////////////////
- //
- // Generate target texture information, stride ratios.
- //
- //
-
- LLViewerTexture *texturep;
- U32 tex_width, tex_height, tex_comps;
- U32 tex_stride;
- F32 tex_x_scalef, tex_y_scalef;
- S32 tex_x_begin, tex_y_begin, tex_x_end, tex_y_end;
- F32 tex_x_ratiof, tex_y_ratiof;
-
- texturep = mSurfacep->getSTexture();
- tex_width = texturep->getWidth();
- tex_height = texturep->getHeight();
- tex_comps = texturep->getComponents();
- tex_stride = tex_width * tex_comps;
-
- U32 st_comps = 3;
- U32 st_width = BASE_SIZE;
- U32 st_height = BASE_SIZE;
-
- if (tex_comps != st_comps)
- {
- LL_WARNS("Terrain") << "Base texture comps != input texture comps" << LL_ENDL;
- return FALSE;
- }
-
- tex_x_scalef = (F32)tex_width / (F32)mWidth;
- tex_y_scalef = (F32)tex_height / (F32)mWidth;
- tex_x_begin = (S32)((F32)x_begin * tex_x_scalef);
- tex_y_begin = (S32)((F32)y_begin * tex_y_scalef);
- tex_x_end = (S32)((F32)x_end * tex_x_scalef);
- tex_y_end = (S32)((F32)y_end * tex_y_scalef);
-
- tex_x_ratiof = (F32)mWidth*mScale / (F32)tex_width;
- tex_y_ratiof = (F32)mWidth*mScale / (F32)tex_height;
-
- LLPointer<LLImageRaw> raw = new LLImageRaw(tex_width, tex_height, tex_comps);
- U8 *rawp = raw->getData();
-
- F32 st_x_stride, st_y_stride;
- st_x_stride = ((F32)st_width / (F32)mTexScaleX)*((F32)mWidth / (F32)tex_width);
- st_y_stride = ((F32)st_height / (F32)mTexScaleY)*((F32)mWidth / (F32)tex_height);
-
- llassert(st_x_stride > 0.f);
- llassert(st_y_stride > 0.f);
- ////////////////////////////////
- //
- // Iterate through the target texture, striding through the
- // subtextures and interpolating appropriately.
- //
- //
-
- F32 sti, stj;
- S32 st_offset;
- sti = (tex_x_begin * st_x_stride) - st_width*(llfloor((tex_x_begin * st_x_stride)/st_width));
- stj = (tex_y_begin * st_y_stride) - st_height*(llfloor((tex_y_begin * st_y_stride)/st_height));
-
- st_offset = (llfloor(stj * st_width) + llfloor(sti)) * st_comps;
- for (S32 j = tex_y_begin; j < tex_y_end; j++)
- {
- U32 offset = j * tex_stride + tex_x_begin * tex_comps;
- sti = (tex_x_begin * st_x_stride) - st_width*((U32)(tex_x_begin * st_x_stride)/st_width);
- for (S32 i = tex_x_begin; i < tex_x_end; i++)
- {
- S32 tex0, tex1;
- F32 composition = getValueScaled(i*tex_x_ratiof, j*tex_y_ratiof);
-
- tex0 = llfloor( composition );
- tex0 = llclamp(tex0, 0, 3);
- composition -= tex0;
- tex1 = tex0 + 1;
- tex1 = llclamp(tex1, 0, 3);
-
- st_offset = (lltrunc(sti) + lltrunc(stj)*st_width) * st_comps;
- for (U32 k = 0; k < tex_comps; k++)
- {
- // Linearly interpolate based on composition.
- if (st_offset >= st_data_size[tex0] || st_offset >= st_data_size[tex1])
- {
- // SJB: This shouldn't be happening, but does... Rounding error?
- //LL_WARNS() << "offset 0 [" << tex0 << "] =" << st_offset << " >= size=" << st_data_size[tex0] << LL_ENDL;
- //LL_WARNS() << "offset 1 [" << tex1 << "] =" << st_offset << " >= size=" << st_data_size[tex1] << LL_ENDL;
- }
- else
- {
- F32 a = *(st_data[tex0] + st_offset);
- F32 b = *(st_data[tex1] + st_offset);
- rawp[ offset ] = (U8)lltrunc( a + composition * (b - a) );
- }
- offset++;
- st_offset++;
- }
-
- sti += st_x_stride;
- if (sti >= st_width)
- {
- sti -= st_width;
- }
- }
-
- stj += st_y_stride;
- if (stj >= st_height)
- {
- stj -= st_height;
- }
- }
-
- if (!texturep->hasGLTexture())
- {
- texturep->createGLTexture(0, raw);
- }
- texturep->setSubImage(raw, tex_x_begin, tex_y_begin, tex_x_end - tex_x_begin, tex_y_end - tex_y_begin);
-
- for (S32 i = 0; i < 4; i++)
- {
- // Un-boost detatil textures (will get re-boosted if rendering in high detail)
- mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_NONE);
- mDetailTextures[i]->setMinDiscardLevel(MAX_DISCARD_LEVEL + 1);
- }
-
- return TRUE;
+ if(delete_raw)
+ {
+ mDetailTextures[i]->destroyRawImage() ;
+ }
+ LL_DEBUGS("Terrain") << "cached raw data for terrain detail texture is not ready yet: " << mDetailTextures[i]->getID() << " Discard: " << ddiscard << LL_ENDL;
+ return FALSE;
+ }
+
+ mRawImages[i] = mDetailTextures[i]->getRawImage() ;
+ if(delete_raw)
+ {
+ mDetailTextures[i]->destroyRawImage() ;
+ }
+ if (mDetailTextures[i]->getWidth(ddiscard) != BASE_SIZE ||
+ mDetailTextures[i]->getHeight(ddiscard) != BASE_SIZE ||
+ mDetailTextures[i]->getComponents() != 3)
+ {
+ LLPointer<LLImageRaw> newraw = new LLImageRaw(BASE_SIZE, BASE_SIZE, 3);
+ newraw->composite(mRawImages[i]);
+ mRawImages[i] = newraw; // deletes old
+ }
+ }
+ st_data[i] = mRawImages[i]->getData();
+ st_data_size[i] = mRawImages[i]->getDataSize();
+ }
+
+ ///////////////////////////////////////
+ //
+ // Generate and clamp x/y bounding box.
+ //
+ //
+
+ S32 x_begin, y_begin, x_end, y_end;
+ x_begin = (S32)(x * mScaleInv);
+ y_begin = (S32)(y * mScaleInv);
+ x_end = ll_round( (x + width) * mScaleInv );
+ y_end = ll_round( (y + width) * mScaleInv );
+
+ if (x_end > mWidth)
+ {
+ LL_WARNS("Terrain") << "x end > width" << LL_ENDL;
+ x_end = mWidth;
+ }
+ if (y_end > mWidth)
+ {
+ LL_WARNS("Terrain") << "y end > width" << LL_ENDL;
+ y_end = mWidth;
+ }
+
+
+ ///////////////////////////////////////////
+ //
+ // Generate target texture information, stride ratios.
+ //
+ //
+
+ LLViewerTexture *texturep;
+ U32 tex_width, tex_height, tex_comps;
+ U32 tex_stride;
+ F32 tex_x_scalef, tex_y_scalef;
+ S32 tex_x_begin, tex_y_begin, tex_x_end, tex_y_end;
+ F32 tex_x_ratiof, tex_y_ratiof;
+
+ texturep = mSurfacep->getSTexture();
+ tex_width = texturep->getWidth();
+ tex_height = texturep->getHeight();
+ tex_comps = texturep->getComponents();
+ tex_stride = tex_width * tex_comps;
+
+ U32 st_comps = 3;
+ U32 st_width = BASE_SIZE;
+ U32 st_height = BASE_SIZE;
+
+ if (tex_comps != st_comps)
+ {
+ LL_WARNS("Terrain") << "Base texture comps != input texture comps" << LL_ENDL;
+ return FALSE;
+ }
+
+ tex_x_scalef = (F32)tex_width / (F32)mWidth;
+ tex_y_scalef = (F32)tex_height / (F32)mWidth;
+ tex_x_begin = (S32)((F32)x_begin * tex_x_scalef);
+ tex_y_begin = (S32)((F32)y_begin * tex_y_scalef);
+ tex_x_end = (S32)((F32)x_end * tex_x_scalef);
+ tex_y_end = (S32)((F32)y_end * tex_y_scalef);
+
+ tex_x_ratiof = (F32)mWidth*mScale / (F32)tex_width;
+ tex_y_ratiof = (F32)mWidth*mScale / (F32)tex_height;
+
+ LLPointer<LLImageRaw> raw = new LLImageRaw(tex_width, tex_height, tex_comps);
+ U8 *rawp = raw->getData();
+
+ F32 st_x_stride, st_y_stride;
+ st_x_stride = ((F32)st_width / (F32)mTexScaleX)*((F32)mWidth / (F32)tex_width);
+ st_y_stride = ((F32)st_height / (F32)mTexScaleY)*((F32)mWidth / (F32)tex_height);
+
+ llassert(st_x_stride > 0.f);
+ llassert(st_y_stride > 0.f);
+ ////////////////////////////////
+ //
+ // Iterate through the target texture, striding through the
+ // subtextures and interpolating appropriately.
+ //
+ //
+
+ F32 sti, stj;
+ S32 st_offset;
+ sti = (tex_x_begin * st_x_stride) - st_width*(llfloor((tex_x_begin * st_x_stride)/st_width));
+ stj = (tex_y_begin * st_y_stride) - st_height*(llfloor((tex_y_begin * st_y_stride)/st_height));
+
+ st_offset = (llfloor(stj * st_width) + llfloor(sti)) * st_comps;
+ for (S32 j = tex_y_begin; j < tex_y_end; j++)
+ {
+ U32 offset = j * tex_stride + tex_x_begin * tex_comps;
+ sti = (tex_x_begin * st_x_stride) - st_width*((U32)(tex_x_begin * st_x_stride)/st_width);
+ for (S32 i = tex_x_begin; i < tex_x_end; i++)
+ {
+ S32 tex0, tex1;
+ F32 composition = getValueScaled(i*tex_x_ratiof, j*tex_y_ratiof);
+
+ tex0 = llfloor( composition );
+ tex0 = llclamp(tex0, 0, 3);
+ composition -= tex0;
+ tex1 = tex0 + 1;
+ tex1 = llclamp(tex1, 0, 3);
+
+ st_offset = (lltrunc(sti) + lltrunc(stj)*st_width) * st_comps;
+ for (U32 k = 0; k < tex_comps; k++)
+ {
+ // Linearly interpolate based on composition.
+ if (st_offset >= st_data_size[tex0] || st_offset >= st_data_size[tex1])
+ {
+ // SJB: This shouldn't be happening, but does... Rounding error?
+ //LL_WARNS() << "offset 0 [" << tex0 << "] =" << st_offset << " >= size=" << st_data_size[tex0] << LL_ENDL;
+ //LL_WARNS() << "offset 1 [" << tex1 << "] =" << st_offset << " >= size=" << st_data_size[tex1] << LL_ENDL;
+ }
+ else
+ {
+ F32 a = *(st_data[tex0] + st_offset);
+ F32 b = *(st_data[tex1] + st_offset);
+ rawp[ offset ] = (U8)lltrunc( a + composition * (b - a) );
+ }
+ offset++;
+ st_offset++;
+ }
+
+ sti += st_x_stride;
+ if (sti >= st_width)
+ {
+ sti -= st_width;
+ }
+ }
+
+ stj += st_y_stride;
+ if (stj >= st_height)
+ {
+ stj -= st_height;
+ }
+ }
+
+ if (!texturep->hasGLTexture())
+ {
+ texturep->createGLTexture(0, raw);
+ }
+ texturep->setSubImage(raw, tex_x_begin, tex_y_begin, tex_x_end - tex_x_begin, tex_y_end - tex_y_begin);
+
+ for (S32 i = 0; i < 4; i++)
+ {
+ // Un-boost detatil textures (will get re-boosted if rendering in high detail)
+ mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_NONE);
+ mDetailTextures[i]->setMinDiscardLevel(MAX_DISCARD_LEVEL + 1);
+ }
+
+ return TRUE;
}
LLUUID LLVLComposition::getDetailTextureID(S32 corner)
{
- return mDetailTextures[corner]->getID();
+ return mDetailTextures[corner]->getID();
}
LLViewerFetchedTexture* LLVLComposition::getDetailTexture(S32 corner)
{
- return mDetailTextures[corner];
+ return mDetailTextures[corner];
}
F32 LLVLComposition::getStartHeight(S32 corner)
{
- return mStartHeight[corner];
+ return mStartHeight[corner];
}
void LLVLComposition::setStartHeight(S32 corner, const F32 start_height)
{
- mStartHeight[corner] = start_height;
+ mStartHeight[corner] = start_height;
}
F32 LLVLComposition::getHeightRange(S32 corner)
{
- return mHeightRange[corner];
+ return mHeightRange[corner];
}
void LLVLComposition::setHeightRange(S32 corner, const F32 range)
{
- mHeightRange[corner] = range;
+ mHeightRange[corner] = range;
}
diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h
index 2dd04ac5a5..cbea18b062 100644
--- a/indra/newview/llvlcomposition.h
+++ b/indra/newview/llvlcomposition.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvlcomposition.h
* @brief Viewer-side representation of a composition layer...
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,52 +35,52 @@ class LLSurface;
class LLVLComposition : public LLViewerLayer
{
public:
- LLVLComposition(LLSurface *surfacep, const U32 width, const F32 scale);
- /*virtual*/ ~LLVLComposition();
+ LLVLComposition(LLSurface *surfacep, const U32 width, const F32 scale);
+ /*virtual*/ ~LLVLComposition();
- void setSurface(LLSurface *surfacep);
+ void setSurface(LLSurface *surfacep);
- // Viewer side hack to generate composition values
- BOOL generateHeights(const F32 x, const F32 y, const F32 width, const F32 height);
- BOOL generateComposition();
- // Generate texture from composition values.
- BOOL generateTexture(const F32 x, const F32 y, const F32 width, const F32 height);
+ // Viewer side hack to generate composition values
+ BOOL generateHeights(const F32 x, const F32 y, const F32 width, const F32 height);
+ BOOL generateComposition();
+ // Generate texture from composition values.
+ BOOL generateTexture(const F32 x, const F32 y, const F32 width, const F32 height);
- // Use these as indeces ito the get/setters below that use 'corner'
- enum ECorner
- {
- SOUTHWEST = 0,
- SOUTHEAST = 1,
- NORTHWEST = 2,
- NORTHEAST = 3,
- CORNER_COUNT = 4
- };
- LLUUID getDetailTextureID(S32 corner);
- LLViewerFetchedTexture* getDetailTexture(S32 corner);
- F32 getStartHeight(S32 corner);
- F32 getHeightRange(S32 corner);
+ // Use these as indeces ito the get/setters below that use 'corner'
+ enum ECorner
+ {
+ SOUTHWEST = 0,
+ SOUTHEAST = 1,
+ NORTHWEST = 2,
+ NORTHEAST = 3,
+ CORNER_COUNT = 4
+ };
+ LLUUID getDetailTextureID(S32 corner);
+ LLViewerFetchedTexture* getDetailTexture(S32 corner);
+ F32 getStartHeight(S32 corner);
+ F32 getHeightRange(S32 corner);
- void setDetailTextureID(S32 corner, const LLUUID& id);
- void setStartHeight(S32 corner, F32 start_height);
- void setHeightRange(S32 corner, F32 range);
+ void setDetailTextureID(S32 corner, const LLUUID& id);
+ void setStartHeight(S32 corner, F32 start_height);
+ void setHeightRange(S32 corner, F32 range);
- friend class LLVOSurfacePatch;
- friend class LLDrawPoolTerrain;
- void setParamsReady() { mParamsReady = TRUE; }
- BOOL getParamsReady() const { return mParamsReady; }
+ friend class LLVOSurfacePatch;
+ friend class LLDrawPoolTerrain;
+ void setParamsReady() { mParamsReady = TRUE; }
+ BOOL getParamsReady() const { return mParamsReady; }
protected:
- BOOL mParamsReady;
- LLSurface *mSurfacep;
- BOOL mTexturesLoaded;
+ BOOL mParamsReady;
+ LLSurface *mSurfacep;
+ BOOL mTexturesLoaded;
- LLPointer<LLViewerFetchedTexture> mDetailTextures[CORNER_COUNT];
- LLPointer<LLImageRaw> mRawImages[CORNER_COUNT];
+ LLPointer<LLViewerFetchedTexture> mDetailTextures[CORNER_COUNT];
+ LLPointer<LLImageRaw> mRawImages[CORNER_COUNT];
- F32 mStartHeight[CORNER_COUNT];
- F32 mHeightRange[CORNER_COUNT];
+ F32 mStartHeight[CORNER_COUNT];
+ F32 mHeightRange[CORNER_COUNT];
- F32 mTexScaleX;
- F32 mTexScaleY;
+ F32 mTexScaleX;
+ F32 mTexScaleY;
};
#endif //LL_LLVLCOMPOSITION_H
diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp
index 895ceed880..901516f832 100644
--- a/indra/newview/llvlmanager.cpp
+++ b/indra/newview/llvlmanager.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvlmanager.cpp
* @brief LLVLManager class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,133 +36,133 @@
#include "llsurface.h"
#include "llbitpack.h"
-const char LAND_LAYER_CODE = 'L';
-const char WIND_LAYER_CODE = '7';
-const char CLOUD_LAYER_CODE = '8';
+const char LAND_LAYER_CODE = 'L';
+const char WIND_LAYER_CODE = '7';
+const char CLOUD_LAYER_CODE = '8';
LLVLManager gVLManager;
LLVLManager::~LLVLManager()
{
- S32 i;
- for (i = 0; i < mPacketData.size(); i++)
- {
- delete mPacketData[i];
- }
- mPacketData.clear();
+ S32 i;
+ for (i = 0; i < mPacketData.size(); i++)
+ {
+ delete mPacketData[i];
+ }
+ mPacketData.clear();
}
void LLVLManager::addLayerData(LLVLData *vl_datap, const S32Bytes mesg_size)
{
- if (LAND_LAYER_CODE == vl_datap->mType)
- {
- mLandBits += mesg_size;
- }
- else if (WIND_LAYER_CODE == vl_datap->mType)
- {
- mWindBits += mesg_size;
- }
- else if (CLOUD_LAYER_CODE == vl_datap->mType)
- {
- mCloudBits += mesg_size;
- }
- else
- {
- LL_ERRS() << "Unknown layer type!" << (S32)vl_datap->mType << LL_ENDL;
- }
-
- mPacketData.push_back(vl_datap);
+ if (LAND_LAYER_CODE == vl_datap->mType)
+ {
+ mLandBits += mesg_size;
+ }
+ else if (WIND_LAYER_CODE == vl_datap->mType)
+ {
+ mWindBits += mesg_size;
+ }
+ else if (CLOUD_LAYER_CODE == vl_datap->mType)
+ {
+ mCloudBits += mesg_size;
+ }
+ else
+ {
+ LL_ERRS() << "Unknown layer type!" << (S32)vl_datap->mType << LL_ENDL;
+ }
+
+ mPacketData.push_back(vl_datap);
}
void LLVLManager::unpackData(const S32 num_packets)
{
- static LLFrameTimer decode_timer;
-
- S32 i;
- for (i = 0; i < mPacketData.size(); i++)
- {
- LLVLData *datap = mPacketData[i];
-
- LLBitPack bit_pack(datap->mData, datap->mSize);
- LLGroupHeader goph;
-
- decode_patch_group_header(bit_pack, &goph);
- if (LAND_LAYER_CODE == datap->mType)
- {
- datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, FALSE);
- }
- else if (WIND_LAYER_CODE == datap->mType)
- {
- datap->mRegionp->mWind.decompress(bit_pack, &goph);
-
- }
- else if (CLOUD_LAYER_CODE == datap->mType)
- {
-
- }
- }
-
- for (i = 0; i < mPacketData.size(); i++)
- {
- delete mPacketData[i];
- }
- mPacketData.clear();
+ static LLFrameTimer decode_timer;
+
+ S32 i;
+ for (i = 0; i < mPacketData.size(); i++)
+ {
+ LLVLData *datap = mPacketData[i];
+
+ LLBitPack bit_pack(datap->mData, datap->mSize);
+ LLGroupHeader goph;
+
+ decode_patch_group_header(bit_pack, &goph);
+ if (LAND_LAYER_CODE == datap->mType)
+ {
+ datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, FALSE);
+ }
+ else if (WIND_LAYER_CODE == datap->mType)
+ {
+ datap->mRegionp->mWind.decompress(bit_pack, &goph);
+
+ }
+ else if (CLOUD_LAYER_CODE == datap->mType)
+ {
+
+ }
+ }
+
+ for (i = 0; i < mPacketData.size(); i++)
+ {
+ delete mPacketData[i];
+ }
+ mPacketData.clear();
}
void LLVLManager::resetBitCounts()
{
- mLandBits = mWindBits = mCloudBits = (S32Bits)0;
+ mLandBits = mWindBits = mCloudBits = (S32Bits)0;
}
U32Bits LLVLManager::getLandBits() const
{
- return mLandBits;
+ return mLandBits;
}
U32Bits LLVLManager::getWindBits() const
{
- return mWindBits;
+ return mWindBits;
}
U32Bits LLVLManager::getCloudBits() const
{
- return mCloudBits;
+ return mCloudBits;
}
S32Bytes LLVLManager::getTotalBytes() const
{
- return mLandBits + mWindBits + mCloudBits;
+ return mLandBits + mWindBits + mCloudBits;
}
void LLVLManager::cleanupData(LLViewerRegion *regionp)
{
- S32 cur = 0;
- while (cur < mPacketData.size())
- {
- if (mPacketData[cur]->mRegionp == regionp)
- {
- delete mPacketData[cur];
- mPacketData.erase(mPacketData.begin() + cur);
- }
- else
- {
- cur++;
- }
- }
+ S32 cur = 0;
+ while (cur < mPacketData.size())
+ {
+ if (mPacketData[cur]->mRegionp == regionp)
+ {
+ delete mPacketData[cur];
+ mPacketData.erase(mPacketData.begin() + cur);
+ }
+ else
+ {
+ cur++;
+ }
+ }
}
LLVLData::LLVLData(LLViewerRegion *regionp, const S8 type, U8 *data, const S32 size)
{
- mType = type;
- mData = data;
- mRegionp = regionp;
- mSize = size;
+ mType = type;
+ mData = data;
+ mRegionp = regionp;
+ mSize = size;
}
LLVLData::~LLVLData()
{
- delete [] mData;
- mData = NULL;
- mRegionp = NULL;
+ delete [] mData;
+ mData = NULL;
+ mRegionp = NULL;
}
diff --git a/indra/newview/llvlmanager.h b/indra/newview/llvlmanager.h
index 5e7fadc522..2b2535d226 100644
--- a/indra/newview/llvlmanager.h
+++ b/indra/newview/llvlmanager.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvlmanager.h
* @brief LLVLManager class definition
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,40 +37,40 @@ class LLViewerRegion;
class LLVLManager
{
public:
- ~LLVLManager();
+ ~LLVLManager();
- void addLayerData(LLVLData *vl_datap, const S32Bytes mesg_size);
+ void addLayerData(LLVLData *vl_datap, const S32Bytes mesg_size);
- void unpackData(const S32 num_packets = 10);
+ void unpackData(const S32 num_packets = 10);
- S32Bytes getTotalBytes() const;
+ S32Bytes getTotalBytes() const;
- U32Bits getLandBits() const;
- U32Bits getWindBits() const;
- U32Bits getCloudBits() const;
+ U32Bits getLandBits() const;
+ U32Bits getWindBits() const;
+ U32Bits getCloudBits() const;
- void resetBitCounts();
+ void resetBitCounts();
- void cleanupData(LLViewerRegion *regionp);
+ void cleanupData(LLViewerRegion *regionp);
protected:
- std::vector<LLVLData *> mPacketData;
- U32Bits mLandBits;
- U32Bits mWindBits;
- U32Bits mCloudBits;
+ std::vector<LLVLData *> mPacketData;
+ U32Bits mLandBits;
+ U32Bits mWindBits;
+ U32Bits mCloudBits;
};
class LLVLData
{
public:
- LLVLData(LLViewerRegion *regionp,
- const S8 type, U8 *data, const S32 size);
- ~LLVLData();
-
- S8 mType;
- U8 *mData;
- S32 mSize;
- LLViewerRegion *mRegionp;
+ LLVLData(LLViewerRegion *regionp,
+ const S8 type, U8 *data, const S32 size);
+ ~LLVLData();
+
+ S8 mType;
+ U8 *mData;
+ S32 mSize;
+ LLViewerRegion *mRegionp;
};
extern LLVLManager gVLManager;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 8ecfa3eed1..71dcd03d04 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,7 +49,7 @@
#include "llexperiencecache.h"
#include "llphysicsmotion.h"
#include "llviewercontrol.h"
-#include "llcallingcard.h" // IDEVO for LLAvatarTracker
+#include "llcallingcard.h" // IDEVO for LLAvatarTracker
#include "lldrawpoolavatar.h"
#include "lldriverparam.h"
#include "llpolyskeletaldistortion.h"
@@ -60,7 +60,7 @@
#include "llhudeffecttrail.h"
#include "llhudmanager.h"
#include "llhudnametag.h"
-#include "llhudtext.h" // for mText/mDebugText
+#include "llhudtext.h" // for mText/mDebugText
#include "llimview.h"
#include "llinitparam.h"
#include "llkeyframefallmotion.h"
@@ -141,30 +141,30 @@ using namespace LLAvatarAppearanceDefines;
// Global constants
//-----------------------------------------------------------------------------
const LLUUID ANIM_AGENT_BODY_NOISE = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise"
-const LLUUID ANIM_AGENT_BREATHE_ROT = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8"); //"breathe_rot"
-const LLUUID ANIM_AGENT_EDITING = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb"); //"editing"
-const LLUUID ANIM_AGENT_EYE = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea"); //"eye"
+const LLUUID ANIM_AGENT_BREATHE_ROT = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8"); //"breathe_rot"
+const LLUUID ANIM_AGENT_EDITING = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb"); //"editing"
+const LLUUID ANIM_AGENT_EYE = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea"); //"eye"
const LLUUID ANIM_AGENT_FLY_ADJUST = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e"); //"fly_adjust"
-const LLUUID ANIM_AGENT_HAND_MOTION = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578"); //"hand_motion"
+const LLUUID ANIM_AGENT_HAND_MOTION = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578"); //"hand_motion"
const LLUUID ANIM_AGENT_HEAD_ROT = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d"); //"head_rot"
const LLUUID ANIM_AGENT_PELVIS_FIX = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b"); //"pelvis_fix"
const LLUUID ANIM_AGENT_TARGET = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55"); //"target"
-const LLUUID ANIM_AGENT_WALK_ADJUST = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d"); //"walk_adjust"
+const LLUUID ANIM_AGENT_WALK_ADJUST = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d"); //"walk_adjust"
const LLUUID ANIM_AGENT_PHYSICS_MOTION = LLUUID("7360e029-3cb8-ebc4-863e-212df440d987"); //"physics_motion"
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
-const F32 DELTA_TIME_MIN = 0.01f; // we clamp measured delta_time to this
-const F32 DELTA_TIME_MAX = 0.2f; // range to insure stability of computations.
+const F32 DELTA_TIME_MIN = 0.01f; // we clamp measured delta_time to this
+const F32 DELTA_TIME_MAX = 0.2f; // range to insure stability of computations.
-const F32 PELVIS_LAG_FLYING = 0.22f;// pelvis follow half life while flying
-const F32 PELVIS_LAG_WALKING = 0.4f; // ...while walking
+const F32 PELVIS_LAG_FLYING = 0.22f;// pelvis follow half life while flying
+const F32 PELVIS_LAG_WALKING = 0.4f; // ...while walking
const F32 PELVIS_LAG_MOUSELOOK = 0.15f;
const F32 MOUSELOOK_PELVIS_FOLLOW_FACTOR = 0.5f;
-const F32 TORSO_NOISE_AMOUNT = 1.0f; // Amount of deviation from up-axis, in degrees
-const F32 TORSO_NOISE_SPEED = 0.2f; // Time scale factor on torso noise.
+const F32 TORSO_NOISE_AMOUNT = 1.0f; // Amount of deviation from up-axis, in degrees
+const F32 TORSO_NOISE_SPEED = 0.2f; // Time scale factor on torso noise.
const F32 BREATHE_ROT_MOTION_STRENGTH = 0.05f;
@@ -211,9 +211,9 @@ const S32 MIN_NONTUNED_AVS = 5;
enum ERenderName
{
- RENDER_NAME_NEVER,
- RENDER_NAME_ALWAYS,
- RENDER_NAME_FADE
+ RENDER_NAME_NEVER,
+ RENDER_NAME_ALWAYS,
+ RENDER_NAME_FADE
};
#define JELLYDOLLS_SHOULD_IMPOSTOR
@@ -224,12 +224,12 @@ enum ERenderName
struct LLTextureMaskData
{
- LLTextureMaskData( const LLUUID& id ) :
- mAvatarID(id),
- mLastDiscardLevel(S32_MAX)
- {}
- LLUUID mAvatarID;
- S32 mLastDiscardLevel;
+ LLTextureMaskData( const LLUUID& id ) :
+ mAvatarID(id),
+ mLastDiscardLevel(S32_MAX)
+ {}
+ LLUUID mAvatarID;
+ S32 mLastDiscardLevel;
};
/*********************************************************************************
@@ -241,22 +241,22 @@ struct LLTextureMaskData
struct LLAppearanceMessageContents: public LLRefCount
{
- LLAppearanceMessageContents():
- mAppearanceVersion(-1),
- mParamAppearanceVersion(-1),
- mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN)
- {
- }
- LLTEContents mTEContents;
- S32 mAppearanceVersion;
- S32 mParamAppearanceVersion;
- S32 mCOFVersion;
- // For future use:
- //U32 appearance_flags = 0;
- std::vector<F32> mParamWeights;
- std::vector<LLVisualParam*> mParams;
- LLVector3 mHoverOffset;
- bool mHoverOffsetWasSet;
+ LLAppearanceMessageContents():
+ mAppearanceVersion(-1),
+ mParamAppearanceVersion(-1),
+ mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN)
+ {
+ }
+ LLTEContents mTEContents;
+ S32 mAppearanceVersion;
+ S32 mParamAppearanceVersion;
+ S32 mCOFVersion;
+ // For future use:
+ //U32 appearance_flags = 0;
+ std::vector<F32> mParamWeights;
+ std::vector<LLVisualParam*> mParams;
+ LLVector3 mHoverOffset;
+ bool mHoverOffsetWasSet;
};
@@ -264,317 +264,317 @@ struct LLAppearanceMessageContents: public LLRefCount
// class LLBodyNoiseMotion
//-----------------------------------------------------------------------------
class LLBodyNoiseMotion :
- public LLMotion
+ public LLMotion
{
public:
- // Constructor
- LLBodyNoiseMotion(const LLUUID &id)
- : LLMotion(id)
- {
- mName = "body_noise";
- mTorsoState = new LLJointState;
- }
+ // Constructor
+ LLBodyNoiseMotion(const LLUUID &id)
+ : LLMotion(id)
+ {
+ mName = "body_noise";
+ mTorsoState = new LLJointState;
+ }
- // Destructor
- virtual ~LLBodyNoiseMotion() { }
+ // Destructor
+ virtual ~LLBodyNoiseMotion() { }
public:
- //-------------------------------------------------------------------------
- // functions to support MotionController and MotionRegistry
- //-------------------------------------------------------------------------
- // static constructor
- // all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLBodyNoiseMotion(id); }
+ //-------------------------------------------------------------------------
+ // functions to support MotionController and MotionRegistry
+ //-------------------------------------------------------------------------
+ // static constructor
+ // all subclasses must implement such a function and register it
+ static LLMotion *create(const LLUUID &id) { return new LLBodyNoiseMotion(id); }
public:
- //-------------------------------------------------------------------------
- // animation callbacks to be implemented by subclasses
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ // animation callbacks to be implemented by subclasses
+ //-------------------------------------------------------------------------
- // motions must specify whether or not they loop
- virtual BOOL getLoop() { return TRUE; }
+ // motions must specify whether or not they loop
+ virtual BOOL getLoop() { return TRUE; }
- // motions must report their total duration
- virtual F32 getDuration() { return 0.0; }
+ // motions must report their total duration
+ virtual F32 getDuration() { return 0.0; }
- // motions must report their "ease in" duration
- virtual F32 getEaseInDuration() { return 0.0; }
+ // motions must report their "ease in" duration
+ virtual F32 getEaseInDuration() { return 0.0; }
- // motions must report their "ease out" duration.
- virtual F32 getEaseOutDuration() { return 0.0; }
+ // motions must report their "ease out" duration.
+ virtual F32 getEaseOutDuration() { return 0.0; }
- // motions must report their priority
- virtual LLJoint::JointPriority getPriority() { return LLJoint::HIGH_PRIORITY; }
+ // motions must report their priority
+ virtual LLJoint::JointPriority getPriority() { return LLJoint::HIGH_PRIORITY; }
- virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
+ virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
- // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
- virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_BODY_NOISE; }
+ // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
+ virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_BODY_NOISE; }
- // run-time (post constructor) initialization,
- // called after parameters have been set
- // must return true to indicate success and be available for activation
- virtual LLMotionInitStatus onInitialize(LLCharacter *character)
- {
- if( !mTorsoState->setJoint( character->getJoint("mTorso") ))
- {
- return STATUS_FAILURE;
- }
+ // run-time (post constructor) initialization,
+ // called after parameters have been set
+ // must return true to indicate success and be available for activation
+ virtual LLMotionInitStatus onInitialize(LLCharacter *character)
+ {
+ if( !mTorsoState->setJoint( character->getJoint("mTorso") ))
+ {
+ return STATUS_FAILURE;
+ }
- mTorsoState->setUsage(LLJointState::ROT);
+ mTorsoState->setUsage(LLJointState::ROT);
- addJointState( mTorsoState );
- return STATUS_SUCCESS;
- }
+ addJointState( mTorsoState );
+ return STATUS_SUCCESS;
+ }
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate() { return TRUE; }
+ // called when a motion is activated
+ // must return TRUE to indicate success, or else
+ // it will be deactivated
+ virtual BOOL onActivate() { return TRUE; }
- // called per time step
- // must return TRUE while it is active, and
- // must return FALSE when the motion is completed.
- virtual BOOL onUpdate(F32 time, U8* joint_mask)
- {
+ // called per time step
+ // must return TRUE while it is active, and
+ // must return FALSE when the motion is completed.
+ virtual BOOL onUpdate(F32 time, U8* joint_mask)
+ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- F32 nx[2];
- nx[0]=time*TORSO_NOISE_SPEED;
- nx[1]=0.0f;
- F32 ny[2];
- ny[0]=0.0f;
- ny[1]=time*TORSO_NOISE_SPEED;
- F32 noiseX = noise2(nx);
- F32 noiseY = noise2(ny);
-
- F32 rx = TORSO_NOISE_AMOUNT * DEG_TO_RAD * noiseX / 0.42f;
- F32 ry = TORSO_NOISE_AMOUNT * DEG_TO_RAD * noiseY / 0.42f;
- LLQuaternion tQn;
- tQn.setQuat( rx, ry, 0.0f );
- mTorsoState->setRotation( tQn );
-
- return TRUE;
- }
-
- // called when a motion is deactivated
- virtual void onDeactivate() {}
+ F32 nx[2];
+ nx[0]=time*TORSO_NOISE_SPEED;
+ nx[1]=0.0f;
+ F32 ny[2];
+ ny[0]=0.0f;
+ ny[1]=time*TORSO_NOISE_SPEED;
+ F32 noiseX = noise2(nx);
+ F32 noiseY = noise2(ny);
+
+ F32 rx = TORSO_NOISE_AMOUNT * DEG_TO_RAD * noiseX / 0.42f;
+ F32 ry = TORSO_NOISE_AMOUNT * DEG_TO_RAD * noiseY / 0.42f;
+ LLQuaternion tQn;
+ tQn.setQuat( rx, ry, 0.0f );
+ mTorsoState->setRotation( tQn );
+
+ return TRUE;
+ }
+
+ // called when a motion is deactivated
+ virtual void onDeactivate() {}
private:
- //-------------------------------------------------------------------------
- // joint states to be animated
- //-------------------------------------------------------------------------
- LLPointer<LLJointState> mTorsoState;
+ //-------------------------------------------------------------------------
+ // joint states to be animated
+ //-------------------------------------------------------------------------
+ LLPointer<LLJointState> mTorsoState;
};
//-----------------------------------------------------------------------------
// class LLBreatheMotionRot
//-----------------------------------------------------------------------------
class LLBreatheMotionRot :
- public LLMotion
+ public LLMotion
{
public:
- // Constructor
- LLBreatheMotionRot(const LLUUID &id) :
- LLMotion(id),
- mBreatheRate(1.f),
- mCharacter(NULL)
- {
- mName = "breathe_rot";
- mChestState = new LLJointState;
- }
-
- // Destructor
- virtual ~LLBreatheMotionRot() {}
+ // Constructor
+ LLBreatheMotionRot(const LLUUID &id) :
+ LLMotion(id),
+ mBreatheRate(1.f),
+ mCharacter(NULL)
+ {
+ mName = "breathe_rot";
+ mChestState = new LLJointState;
+ }
+
+ // Destructor
+ virtual ~LLBreatheMotionRot() {}
public:
- //-------------------------------------------------------------------------
- // functions to support MotionController and MotionRegistry
- //-------------------------------------------------------------------------
- // static constructor
- // all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLBreatheMotionRot(id); }
+ //-------------------------------------------------------------------------
+ // functions to support MotionController and MotionRegistry
+ //-------------------------------------------------------------------------
+ // static constructor
+ // all subclasses must implement such a function and register it
+ static LLMotion *create(const LLUUID &id) { return new LLBreatheMotionRot(id); }
public:
- //-------------------------------------------------------------------------
- // animation callbacks to be implemented by subclasses
- //-------------------------------------------------------------------------
-
- // motions must specify whether or not they loop
- virtual BOOL getLoop() { return TRUE; }
-
- // motions must report their total duration
- virtual F32 getDuration() { return 0.0; }
-
- // motions must report their "ease in" duration
- virtual F32 getEaseInDuration() { return 0.0; }
-
- // motions must report their "ease out" duration.
- virtual F32 getEaseOutDuration() { return 0.0; }
-
- // motions must report their priority
- virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
-
- virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
-
- // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
- virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_BREATHE; }
-
- // run-time (post constructor) initialization,
- // called after parameters have been set
- // must return true to indicate success and be available for activation
- virtual LLMotionInitStatus onInitialize(LLCharacter *character)
- {
- mCharacter = character;
- BOOL success = true;
-
- if ( !mChestState->setJoint( character->getJoint( "mChest" ) ) )
- {
- success = false;
- }
-
- if ( success )
- {
- mChestState->setUsage(LLJointState::ROT);
- addJointState( mChestState );
- }
-
- if ( success )
- {
- return STATUS_SUCCESS;
- }
- else
- {
- return STATUS_FAILURE;
- }
- }
-
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate() { return TRUE; }
-
- // called per time step
- // must return TRUE while it is active, and
- // must return FALSE when the motion is completed.
- virtual BOOL onUpdate(F32 time, U8* joint_mask)
- {
+ //-------------------------------------------------------------------------
+ // animation callbacks to be implemented by subclasses
+ //-------------------------------------------------------------------------
+
+ // motions must specify whether or not they loop
+ virtual BOOL getLoop() { return TRUE; }
+
+ // motions must report their total duration
+ virtual F32 getDuration() { return 0.0; }
+
+ // motions must report their "ease in" duration
+ virtual F32 getEaseInDuration() { return 0.0; }
+
+ // motions must report their "ease out" duration.
+ virtual F32 getEaseOutDuration() { return 0.0; }
+
+ // motions must report their priority
+ virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
+
+ virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
+
+ // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
+ virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_BREATHE; }
+
+ // run-time (post constructor) initialization,
+ // called after parameters have been set
+ // must return true to indicate success and be available for activation
+ virtual LLMotionInitStatus onInitialize(LLCharacter *character)
+ {
+ mCharacter = character;
+ BOOL success = true;
+
+ if ( !mChestState->setJoint( character->getJoint( "mChest" ) ) )
+ {
+ success = false;
+ }
+
+ if ( success )
+ {
+ mChestState->setUsage(LLJointState::ROT);
+ addJointState( mChestState );
+ }
+
+ if ( success )
+ {
+ return STATUS_SUCCESS;
+ }
+ else
+ {
+ return STATUS_FAILURE;
+ }
+ }
+
+ // called when a motion is activated
+ // must return TRUE to indicate success, or else
+ // it will be deactivated
+ virtual BOOL onActivate() { return TRUE; }
+
+ // called per time step
+ // must return TRUE while it is active, and
+ // must return FALSE when the motion is completed.
+ virtual BOOL onUpdate(F32 time, U8* joint_mask)
+ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- mBreatheRate = 1.f;
+ mBreatheRate = 1.f;
- F32 breathe_amt = (sinf(mBreatheRate * time) * BREATHE_ROT_MOTION_STRENGTH);
+ F32 breathe_amt = (sinf(mBreatheRate * time) * BREATHE_ROT_MOTION_STRENGTH);
- mChestState->setRotation(LLQuaternion(breathe_amt, LLVector3(0.f, 1.f, 0.f)));
+ mChestState->setRotation(LLQuaternion(breathe_amt, LLVector3(0.f, 1.f, 0.f)));
- return TRUE;
- }
+ return TRUE;
+ }
- // called when a motion is deactivated
- virtual void onDeactivate() {}
+ // called when a motion is deactivated
+ virtual void onDeactivate() {}
private:
- //-------------------------------------------------------------------------
- // joint states to be animated
- //-------------------------------------------------------------------------
- LLPointer<LLJointState> mChestState;
- F32 mBreatheRate;
- LLCharacter* mCharacter;
+ //-------------------------------------------------------------------------
+ // joint states to be animated
+ //-------------------------------------------------------------------------
+ LLPointer<LLJointState> mChestState;
+ F32 mBreatheRate;
+ LLCharacter* mCharacter;
};
//-----------------------------------------------------------------------------
// class LLPelvisFixMotion
//-----------------------------------------------------------------------------
class LLPelvisFixMotion :
- public LLMotion
+ public LLMotion
{
public:
- // Constructor
- LLPelvisFixMotion(const LLUUID &id)
- : LLMotion(id), mCharacter(NULL)
- {
- mName = "pelvis_fix";
+ // Constructor
+ LLPelvisFixMotion(const LLUUID &id)
+ : LLMotion(id), mCharacter(NULL)
+ {
+ mName = "pelvis_fix";
- mPelvisState = new LLJointState;
- }
+ mPelvisState = new LLJointState;
+ }
- // Destructor
- virtual ~LLPelvisFixMotion() { }
+ // Destructor
+ virtual ~LLPelvisFixMotion() { }
public:
- //-------------------------------------------------------------------------
- // functions to support MotionController and MotionRegistry
- //-------------------------------------------------------------------------
- // static constructor
- // all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID& id) { return new LLPelvisFixMotion(id); }
+ //-------------------------------------------------------------------------
+ // functions to support MotionController and MotionRegistry
+ //-------------------------------------------------------------------------
+ // static constructor
+ // all subclasses must implement such a function and register it
+ static LLMotion *create(const LLUUID& id) { return new LLPelvisFixMotion(id); }
public:
- //-------------------------------------------------------------------------
- // animation callbacks to be implemented by subclasses
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ // animation callbacks to be implemented by subclasses
+ //-------------------------------------------------------------------------
- // motions must specify whether or not they loop
- virtual BOOL getLoop() { return TRUE; }
+ // motions must specify whether or not they loop
+ virtual BOOL getLoop() { return TRUE; }
- // motions must report their total duration
- virtual F32 getDuration() { return 0.0; }
+ // motions must report their total duration
+ virtual F32 getDuration() { return 0.0; }
- // motions must report their "ease in" duration
- virtual F32 getEaseInDuration() { return 0.5f; }
+ // motions must report their "ease in" duration
+ virtual F32 getEaseInDuration() { return 0.5f; }
- // motions must report their "ease out" duration.
- virtual F32 getEaseOutDuration() { return 0.5f; }
+ // motions must report their "ease out" duration.
+ virtual F32 getEaseOutDuration() { return 0.5f; }
- // motions must report their priority
- virtual LLJoint::JointPriority getPriority() { return LLJoint::LOW_PRIORITY; }
+ // motions must report their priority
+ virtual LLJoint::JointPriority getPriority() { return LLJoint::LOW_PRIORITY; }
- virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
+ virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
- // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
- virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_PELVIS_FIX; }
+ // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
+ virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_PELVIS_FIX; }
- // run-time (post constructor) initialization,
- // called after parameters have been set
- // must return true to indicate success and be available for activation
- virtual LLMotionInitStatus onInitialize(LLCharacter *character)
- {
- mCharacter = character;
+ // run-time (post constructor) initialization,
+ // called after parameters have been set
+ // must return true to indicate success and be available for activation
+ virtual LLMotionInitStatus onInitialize(LLCharacter *character)
+ {
+ mCharacter = character;
- if (!mPelvisState->setJoint( character->getJoint("mPelvis")))
- {
- return STATUS_FAILURE;
- }
+ if (!mPelvisState->setJoint( character->getJoint("mPelvis")))
+ {
+ return STATUS_FAILURE;
+ }
- mPelvisState->setUsage(LLJointState::POS);
+ mPelvisState->setUsage(LLJointState::POS);
- addJointState( mPelvisState );
- return STATUS_SUCCESS;
- }
+ addJointState( mPelvisState );
+ return STATUS_SUCCESS;
+ }
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate() { return TRUE; }
+ // called when a motion is activated
+ // must return TRUE to indicate success, or else
+ // it will be deactivated
+ virtual BOOL onActivate() { return TRUE; }
- // called per time step
- // must return TRUE while it is active, and
- // must return FALSE when the motion is completed.
- virtual BOOL onUpdate(F32 time, U8* joint_mask)
- {
+ // called per time step
+ // must return TRUE while it is active, and
+ // must return FALSE when the motion is completed.
+ virtual BOOL onUpdate(F32 time, U8* joint_mask)
+ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- mPelvisState->setPosition(LLVector3::zero);
+ mPelvisState->setPosition(LLVector3::zero);
- return TRUE;
- }
+ return TRUE;
+ }
- // called when a motion is deactivated
- virtual void onDeactivate() {}
+ // called when a motion is deactivated
+ virtual void onDeactivate() {}
private:
- //-------------------------------------------------------------------------
- // joint states to be animated
- //-------------------------------------------------------------------------
- LLPointer<LLJointState> mPelvisState;
- LLCharacter* mCharacter;
+ //-------------------------------------------------------------------------
+ // joint states to be animated
+ //-------------------------------------------------------------------------
+ LLPointer<LLJointState> mPelvisState;
+ LLCharacter* mCharacter;
};
/**
@@ -590,19 +590,19 @@ private:
U32 LLVOAvatar::sMaxNonImpostors = 12; // Set from RenderAvatarMaxNonImpostors
bool LLVOAvatar::sLimitNonImpostors = false; // True unless RenderAvatarMaxNonImpostors is 0 (unlimited)
F32 LLVOAvatar::sRenderDistance = 256.f;
-S32 LLVOAvatar::sNumVisibleAvatars = 0;
-S32 LLVOAvatar::sNumLODChangesThisFrame = 0;
+S32 LLVOAvatar::sNumVisibleAvatars = 0;
+S32 LLVOAvatar::sNumLODChangesThisFrame = 0;
const LLUUID LLVOAvatar::sStepSoundOnLand("e8af4a28-aa83-4310-a7c4-c047e15ea0df");
const LLUUID LLVOAvatar::sStepSounds[LL_MCODE_END] =
{
- SND_STONE_RUBBER,
- SND_METAL_RUBBER,
- SND_GLASS_RUBBER,
- SND_WOOD_RUBBER,
- SND_FLESH_RUBBER,
- SND_RUBBER_PLASTIC,
- SND_RUBBER_RUBBER
+ SND_STONE_RUBBER,
+ SND_METAL_RUBBER,
+ SND_GLASS_RUBBER,
+ SND_WOOD_RUBBER,
+ SND_FLESH_RUBBER,
+ SND_RUBBER_PLASTIC,
+ SND_RUBBER_RUBBER
};
S32 LLVOAvatar::sRenderName = RENDER_NAME_ALWAYS;
@@ -632,138 +632,138 @@ static F32 calc_bouncy_animation(F32 x);
// LLVOAvatar()
//-----------------------------------------------------------------------------
LLVOAvatar::LLVOAvatar(const LLUUID& id,
- const LLPCode pcode,
- LLViewerRegion* regionp) :
- LLAvatarAppearance(&gAgentWearables),
- LLViewerObject(id, pcode, regionp),
- mSpecialRenderMode(0),
- mAttachmentSurfaceArea(0.f),
- mAttachmentVisibleTriangleCount(0),
- mAttachmentEstTriangleCount(0.f),
- mReportedVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN),
- mTurning(FALSE),
- mLastSkeletonSerialNum( 0 ),
- mIsSitting(FALSE),
- mTimeVisible(),
- mTyping(FALSE),
- mMeshValid(FALSE),
- mVisible(FALSE),
- mLastImpostorUpdateFrameTime(0.f),
- mLastImpostorUpdateReason(0),
- mWindFreq(0.f),
- mRipplePhase( 0.f ),
- mBelowWater(FALSE),
- mLastAppearanceBlendTime(0.f),
- mAppearanceAnimating(FALSE),
+ const LLPCode pcode,
+ LLViewerRegion* regionp) :
+ LLAvatarAppearance(&gAgentWearables),
+ LLViewerObject(id, pcode, regionp),
+ mSpecialRenderMode(0),
+ mAttachmentSurfaceArea(0.f),
+ mAttachmentVisibleTriangleCount(0),
+ mAttachmentEstTriangleCount(0.f),
+ mReportedVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN),
+ mTurning(FALSE),
+ mLastSkeletonSerialNum( 0 ),
+ mIsSitting(FALSE),
+ mTimeVisible(),
+ mTyping(FALSE),
+ mMeshValid(FALSE),
+ mVisible(FALSE),
+ mLastImpostorUpdateFrameTime(0.f),
+ mLastImpostorUpdateReason(0),
+ mWindFreq(0.f),
+ mRipplePhase( 0.f ),
+ mBelowWater(FALSE),
+ mLastAppearanceBlendTime(0.f),
+ mAppearanceAnimating(FALSE),
mNameIsSet(false),
- mTitle(),
- mNameAway(false),
- mNameDoNotDisturb(false),
- mNameMute(false),
- mNameAppearance(false),
- mNameFriend(false),
- mNameAlpha(0.f),
- mRenderGroupTitles(sRenderGroupTitles),
- mNameCloud(false),
- mFirstTEMessageReceived( FALSE ),
- mFirstAppearanceMessageReceived( FALSE ),
- mCulled( FALSE ),
- mVisibilityRank(0),
- mNeedsSkin(FALSE),
- mLastSkinTime(0.f),
- mUpdatePeriod(1),
- mOverallAppearance(AOA_INVISIBLE),
- mVisualComplexityStale(true),
- mVisuallyMuteSetting(AV_RENDER_NORMALLY),
- mMutedAVColor(LLColor4::white /* used for "uninitialize" */),
- mFirstFullyVisible(TRUE),
- mFirstUseDelaySeconds(FIRST_APPEARANCE_CLOUD_MIN_DELAY),
- mFullyLoaded(FALSE),
- mPreviousFullyLoaded(FALSE),
- mFullyLoadedInitialized(FALSE),
- mVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN),
- mLoadedCallbacksPaused(FALSE),
- mLoadedCallbackTextures(0),
- mRenderUnloadedAvatar(LLCachedControl<bool>(gSavedSettings, "RenderUnloadedAvatar", false)),
- mLastRezzedStatus(-1),
- mIsEditingAppearance(FALSE),
- mUseLocalAppearance(FALSE),
- mLastUpdateRequestCOFVersion(-1),
- mLastUpdateReceivedCOFVersion(-1),
- mCachedMuteListUpdateTime(0),
- mCachedInMuteList(false),
+ mTitle(),
+ mNameAway(false),
+ mNameDoNotDisturb(false),
+ mNameMute(false),
+ mNameAppearance(false),
+ mNameFriend(false),
+ mNameAlpha(0.f),
+ mRenderGroupTitles(sRenderGroupTitles),
+ mNameCloud(false),
+ mFirstTEMessageReceived( FALSE ),
+ mFirstAppearanceMessageReceived( FALSE ),
+ mCulled( FALSE ),
+ mVisibilityRank(0),
+ mNeedsSkin(FALSE),
+ mLastSkinTime(0.f),
+ mUpdatePeriod(1),
+ mOverallAppearance(AOA_INVISIBLE),
+ mVisualComplexityStale(true),
+ mVisuallyMuteSetting(AV_RENDER_NORMALLY),
+ mMutedAVColor(LLColor4::white /* used for "uninitialize" */),
+ mFirstFullyVisible(TRUE),
+ mFirstUseDelaySeconds(FIRST_APPEARANCE_CLOUD_MIN_DELAY),
+ mFullyLoaded(FALSE),
+ mPreviousFullyLoaded(FALSE),
+ mFullyLoadedInitialized(FALSE),
+ mVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN),
+ mLoadedCallbacksPaused(FALSE),
+ mLoadedCallbackTextures(0),
+ mRenderUnloadedAvatar(LLCachedControl<bool>(gSavedSettings, "RenderUnloadedAvatar", false)),
+ mLastRezzedStatus(-1),
+ mIsEditingAppearance(FALSE),
+ mUseLocalAppearance(FALSE),
+ mLastUpdateRequestCOFVersion(-1),
+ mLastUpdateReceivedCOFVersion(-1),
+ mCachedMuteListUpdateTime(0),
+ mCachedInMuteList(false),
mIsControlAvatar(false),
mIsUIAvatar(false),
mEnableDefaultMotions(true)
{
- LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL;
+ LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL;
- //VTResume(); // VTune
- setHoverOffset(LLVector3(0.0, 0.0, 0.0));
+ //VTResume(); // VTune
+ setHoverOffset(LLVector3(0.0, 0.0, 0.0));
- // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline
- const BOOL needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job
- mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim );
+ // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline
+ const BOOL needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job
+ mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim );
- LL_DEBUGS("Avatar","Message") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL;
- mPelvisp = NULL;
+ LL_DEBUGS("Avatar","Message") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL;
+ mPelvisp = NULL;
- mDirtyMesh = 2; // Dirty geometry, need to regenerate.
- mMeshTexturesDirty = FALSE;
- mHeadp = NULL;
+ mDirtyMesh = 2; // Dirty geometry, need to regenerate.
+ mMeshTexturesDirty = FALSE;
+ mHeadp = NULL;
- // set up animation variables
- mSpeed = 0.f;
- setAnimationData("Speed", &mSpeed);
+ // set up animation variables
+ mSpeed = 0.f;
+ setAnimationData("Speed", &mSpeed);
- mNeedsImpostorUpdate = TRUE;
- mLastImpostorUpdateReason = 0;
- mNeedsAnimUpdate = TRUE;
+ mNeedsImpostorUpdate = TRUE;
+ mLastImpostorUpdateReason = 0;
+ mNeedsAnimUpdate = TRUE;
- mNeedsExtentUpdate = true;
+ mNeedsExtentUpdate = true;
- mImpostorDistance = 0;
- mImpostorPixelArea = 0;
+ mImpostorDistance = 0;
+ mImpostorPixelArea = 0;
- setNumTEs(TEX_NUM_INDICES);
+ setNumTEs(TEX_NUM_INDICES);
- mbCanSelect = TRUE;
+ mbCanSelect = TRUE;
- mSignaledAnimations.clear();
- mPlayingAnimations.clear();
+ mSignaledAnimations.clear();
+ mPlayingAnimations.clear();
- mWasOnGroundLeft = FALSE;
- mWasOnGroundRight = FALSE;
+ mWasOnGroundLeft = FALSE;
+ mWasOnGroundRight = FALSE;
- mTimeLast = 0.0f;
- mSpeedAccum = 0.0f;
+ mTimeLast = 0.0f;
+ mSpeedAccum = 0.0f;
- mRippleTimeLast = 0.f;
+ mRippleTimeLast = 0.f;
- mInAir = FALSE;
+ mInAir = FALSE;
- mStepOnLand = TRUE;
- mStepMaterial = 0;
+ mStepOnLand = TRUE;
+ mStepMaterial = 0;
- mLipSyncActive = false;
- mOohMorph = NULL;
- mAahMorph = NULL;
+ mLipSyncActive = false;
+ mOohMorph = NULL;
+ mAahMorph = NULL;
- mCurrentGesticulationLevel = 0;
+ mCurrentGesticulationLevel = 0;
mFirstAppearanceMessageTimer.reset();
- mRuthTimer.reset();
- mRuthDebugTimer.reset();
- mDebugExistenceTimer.reset();
- mLastAppearanceMessageTimer.reset();
+ mRuthTimer.reset();
+ mRuthDebugTimer.reset();
+ mDebugExistenceTimer.reset();
+ mLastAppearanceMessageTimer.reset();
- if(LLSceneMonitor::getInstance()->isEnabled())
- {
- LLSceneMonitor::getInstance()->freezeAvatar((LLCharacter*)this);
- }
+ if(LLSceneMonitor::getInstance()->isEnabled())
+ {
+ LLSceneMonitor::getInstance()->freezeAvatar((LLCharacter*)this);
+ }
- mVisuallyMuteSetting = LLVOAvatar::VisualMuteSettings(LLRenderMuteList::getInstance()->getSavedVisualMuteSetting(getID()));
+ mVisuallyMuteSetting = LLVOAvatar::VisualMuteSettings(LLRenderMuteList::getInstance()->getSavedVisualMuteSetting(getID()));
}
std::string LLVOAvatar::avString() const
@@ -774,8 +774,8 @@ std::string LLVOAvatar::avString() const
}
else
{
- std::string viz_string = LLVOAvatar::rezStatusToString(getRezzedStatus());
- return " Avatar '" + getFullname() + "' " + viz_string + " ";
+ std::string viz_string = LLVOAvatar::rezStatusToString(getRezzedStatus());
+ return " Avatar '" + getFullname() + "' " + viz_string + " ";
}
}
@@ -788,22 +788,22 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c
return;
}
- LL_INFOS("Avatar") << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32()
- << "sec ]"
- << avString()
- << "RuthTimer " << (U32)mRuthDebugTimer.getElapsedTimeF32()
- << " Notification " << notification_name
- << " : " << comment
- << LL_ENDL;
+ LL_INFOS("Avatar") << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32()
+ << "sec ]"
+ << avString()
+ << "RuthTimer " << (U32)mRuthDebugTimer.getElapsedTimeF32()
+ << " Notification " << notification_name
+ << " : " << comment
+ << LL_ENDL;
- if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
- {
- LLSD args;
- args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
- args["TIME"] = llformat("%d",(U32)mRuthDebugTimer.getElapsedTimeF32());
- args["NAME"] = getFullname();
- LLNotificationsUtil::add(notification_name,args);
- }
+ if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
+ {
+ LLSD args;
+ args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32());
+ args["TIME"] = llformat("%d",(U32)mRuthDebugTimer.getElapsedTimeF32());
+ args["NAME"] = getFullname();
+ LLNotificationsUtil::add(notification_name,args);
+ }
}
//------------------------------------------------------------------------
@@ -811,14 +811,14 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c
//------------------------------------------------------------------------
LLVOAvatar::~LLVOAvatar()
{
- if (!mFullyLoaded)
- {
- debugAvatarRezTime("AvatarRezLeftCloudNotification","left after ruth seconds as cloud");
- }
- else
- {
- debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding");
- }
+ if (!mFullyLoaded)
+ {
+ debugAvatarRezTime("AvatarRezLeftCloudNotification","left after ruth seconds as cloud");
+ }
+ else
+ {
+ debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding");
+ }
if(mTuned)
{
@@ -828,306 +828,306 @@ LLVOAvatar::~LLVOAvatar()
sAVsIgnoringARTLimit.erase(std::remove(sAVsIgnoringARTLimit.begin(), sAVsIgnoringARTLimit.end(), mID), sAVsIgnoringARTLimit.end());
- logPendingPhases();
-
- LL_DEBUGS("Avatar") << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << LL_ENDL;
+ logPendingPhases();
+
+ LL_DEBUGS("Avatar") << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << LL_ENDL;
+
+ std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer());
+ mAttachmentPoints.clear();
- std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer());
- mAttachmentPoints.clear();
+ mDead = TRUE;
- mDead = TRUE;
-
- mAnimationSources.clear();
- LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ;
+ mAnimationSources.clear();
+ LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ;
- getPhases().clearPhases();
-
- LL_DEBUGS() << "LLVOAvatar Destructor end" << LL_ENDL;
+ getPhases().clearPhases();
+
+ LL_DEBUGS() << "LLVOAvatar Destructor end" << LL_ENDL;
}
void LLVOAvatar::markDead()
{
- if (mNameText)
- {
- mNameText->markDead();
- mNameText = NULL;
- sNumVisibleChatBubbles--;
- }
- mVoiceVisualizer->markDead();
- LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ;
- LLViewerObject::markDead();
+ if (mNameText)
+ {
+ mNameText->markDead();
+ mNameText = NULL;
+ sNumVisibleChatBubbles--;
+ }
+ mVoiceVisualizer->markDead();
+ LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ;
+ LLViewerObject::markDead();
}
BOOL LLVOAvatar::isFullyBaked()
{
- if (mIsDummy) return TRUE;
- if (getNumTEs() == 0) return FALSE;
+ if (mIsDummy) return TRUE;
+ if (getNumTEs() == 0) return FALSE;
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- if (!isTextureDefined(mBakedTextureDatas[i].mTextureIndex)
- && ((i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT))
- && (i != BAKED_LEFT_ARM) && (i != BAKED_LEFT_LEG) && (i != BAKED_AUX1) && (i != BAKED_AUX2) && (i != BAKED_AUX3))
- {
- return FALSE;
- }
- }
- return TRUE;
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ if (!isTextureDefined(mBakedTextureDatas[i].mTextureIndex)
+ && ((i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT))
+ && (i != BAKED_LEFT_ARM) && (i != BAKED_LEFT_LEG) && (i != BAKED_AUX1) && (i != BAKED_AUX2) && (i != BAKED_AUX3))
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
BOOL LLVOAvatar::isFullyTextured() const
{
- for (S32 i = 0; i < mMeshLOD.size(); i++)
- {
- LLAvatarJoint* joint = mMeshLOD[i];
- if (i==MESH_ID_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT))
- {
- continue; // don't care about skirt textures if we're not wearing one.
- }
- if (!joint)
- {
- continue; // nonexistent LOD OK.
- }
- avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin();
- if (meshIter != joint->mMeshParts.end())
- {
- LLAvatarJointMesh *mesh = (*meshIter);
- if (!mesh)
- {
- continue; // nonexistent mesh OK
- }
- if (mesh->hasGLTexture())
- {
- continue; // Mesh exists and has a baked texture.
- }
- if (mesh->hasComposite())
- {
- continue; // Mesh exists and has a composite texture.
- }
- // Fail
- return FALSE;
- }
- }
- return TRUE;
+ for (S32 i = 0; i < mMeshLOD.size(); i++)
+ {
+ LLAvatarJoint* joint = mMeshLOD[i];
+ if (i==MESH_ID_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT))
+ {
+ continue; // don't care about skirt textures if we're not wearing one.
+ }
+ if (!joint)
+ {
+ continue; // nonexistent LOD OK.
+ }
+ avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin();
+ if (meshIter != joint->mMeshParts.end())
+ {
+ LLAvatarJointMesh *mesh = (*meshIter);
+ if (!mesh)
+ {
+ continue; // nonexistent mesh OK
+ }
+ if (mesh->hasGLTexture())
+ {
+ continue; // Mesh exists and has a baked texture.
+ }
+ if (mesh->hasComposite())
+ {
+ continue; // Mesh exists and has a composite texture.
+ }
+ // Fail
+ return FALSE;
+ }
+ }
+ return TRUE;
}
BOOL LLVOAvatar::hasGray() const
{
- return !getIsCloud() && !isFullyTextured();
+ return !getIsCloud() && !isFullyTextured();
}
S32 LLVOAvatar::getRezzedStatus() const
{
- if (getIsCloud()) return 0;
- bool textured = isFullyTextured();
- if (textured && allBakedTexturesCompletelyDownloaded()) return 3;
- if (textured) return 2;
- llassert(hasGray());
- return 1; // gray
+ if (getIsCloud()) return 0;
+ bool textured = isFullyTextured();
+ if (textured && allBakedTexturesCompletelyDownloaded()) return 3;
+ if (textured) return 2;
+ llassert(hasGray());
+ return 1; // gray
}
void LLVOAvatar::deleteLayerSetCaches(bool clearAll)
{
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- if (mBakedTextureDatas[i].mTexLayerSet)
- {
- // ! BACKWARDS COMPATIBILITY !
- // Can be removed after hair baking is mandatory on the grid
- if ((i != BAKED_HAIR || isSelf()) && !clearAll)
- {
- mBakedTextureDatas[i].mTexLayerSet->deleteCaches();
- }
- }
- if (mBakedTextureDatas[i].mMaskTexName)
- {
- LLImageGL::deleteTextures(1, (GLuint*)&(mBakedTextureDatas[i].mMaskTexName));
- mBakedTextureDatas[i].mMaskTexName = 0 ;
- }
- }
-}
-
-// static
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ if (mBakedTextureDatas[i].mTexLayerSet)
+ {
+ // ! BACKWARDS COMPATIBILITY !
+ // Can be removed after hair baking is mandatory on the grid
+ if ((i != BAKED_HAIR || isSelf()) && !clearAll)
+ {
+ mBakedTextureDatas[i].mTexLayerSet->deleteCaches();
+ }
+ }
+ if (mBakedTextureDatas[i].mMaskTexName)
+ {
+ LLImageGL::deleteTextures(1, (GLuint*)&(mBakedTextureDatas[i].mMaskTexName));
+ mBakedTextureDatas[i].mMaskTexName = 0 ;
+ }
+ }
+}
+
+// static
BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars)
{
- BOOL res = TRUE;
- grey_avatars = 0;
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- LLVOAvatar* inst = (LLVOAvatar*) *iter;
- if( inst->isDead() )
- {
- continue;
- }
- else if( !inst->isFullyBaked() )
- {
- res = FALSE;
- if (inst->mHasGrey)
- {
- ++grey_avatars;
- }
- }
- }
- return res;
+ BOOL res = TRUE;
+ grey_avatars = 0;
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ LLVOAvatar* inst = (LLVOAvatar*) *iter;
+ if( inst->isDead() )
+ {
+ continue;
+ }
+ else if( !inst->isFullyBaked() )
+ {
+ res = FALSE;
+ if (inst->mHasGrey)
+ {
+ ++grey_avatars;
+ }
+ }
+ }
+ return res;
}
// static
void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts)
{
- counts.clear();
- counts.resize(4);
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- LLVOAvatar* inst = (LLVOAvatar*) *iter;
- if (inst)
- {
- S32 rez_status = inst->getRezzedStatus();
- counts[rez_status]++;
- }
- }
+ counts.clear();
+ counts.resize(4);
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ LLVOAvatar* inst = (LLVOAvatar*) *iter;
+ if (inst)
+ {
+ S32 rez_status = inst->getRezzedStatus();
+ counts[rez_status]++;
+ }
+ }
}
// static
std::string LLVOAvatar::rezStatusToString(S32 rez_status)
{
- if (rez_status==0) return "cloud";
- if (rez_status==1) return "gray";
- if (rez_status==2) return "downloading";
- if (rez_status==3) return "full";
- return "unknown";
+ if (rez_status==0) return "cloud";
+ if (rez_status==1) return "gray";
+ if (rez_status==2) return "downloading";
+ if (rez_status==3) return "full";
+ return "unknown";
}
// static
void LLVOAvatar::dumpBakedStatus()
{
- LLVector3d camera_pos_global = gAgentCamera.getCameraPositionGlobal();
-
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- LLVOAvatar* inst = (LLVOAvatar*) *iter;
- LL_INFOS() << "Avatar ";
-
- LLNameValue* firstname = inst->getNVPair("FirstName");
- LLNameValue* lastname = inst->getNVPair("LastName");
-
- if( firstname )
- {
- LL_CONT << firstname->getString();
- }
- if( lastname )
- {
- LL_CONT << " " << lastname->getString();
- }
-
- LL_CONT << " " << inst->mID;
-
- if( inst->isDead() )
- {
- LL_CONT << " DEAD ("<< inst->getNumRefs() << " refs)";
- }
-
- if( inst->isSelf() )
- {
- LL_CONT << " (self)";
- }
-
-
- F64 dist_to_camera = (inst->getPositionGlobal() - camera_pos_global).length();
- LL_CONT << " " << dist_to_camera << "m ";
-
- LL_CONT << " " << inst->mPixelArea << " pixels";
-
- if( inst->isVisible() )
- {
- LL_CONT << " (visible)";
- }
- else
- {
- LL_CONT << " (not visible)";
- }
-
- if( inst->isFullyBaked() )
- {
- LL_CONT << " Baked";
- }
- else
- {
- LL_CONT << " Unbaked (";
-
- for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator iter = LLAvatarAppearance::getDictionary()->getBakedTextures().begin();
- iter != LLAvatarAppearance::getDictionary()->getBakedTextures().end();
- ++iter)
- {
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = iter->second;
- const ETextureIndex index = baked_dict->mTextureIndex;
- if (!inst->isTextureDefined(index))
- {
- LL_CONT << " " << (LLAvatarAppearance::getDictionary()->getTexture(index) ? LLAvatarAppearance::getDictionary()->getTexture(index)->mName : "");
- }
- }
- LL_CONT << " ) " << inst->getUnbakedPixelAreaRank();
- if( inst->isCulled() )
- {
- LL_CONT << " culled";
- }
- }
- LL_CONT << LL_ENDL;
- }
+ LLVector3d camera_pos_global = gAgentCamera.getCameraPositionGlobal();
+
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ LLVOAvatar* inst = (LLVOAvatar*) *iter;
+ LL_INFOS() << "Avatar ";
+
+ LLNameValue* firstname = inst->getNVPair("FirstName");
+ LLNameValue* lastname = inst->getNVPair("LastName");
+
+ if( firstname )
+ {
+ LL_CONT << firstname->getString();
+ }
+ if( lastname )
+ {
+ LL_CONT << " " << lastname->getString();
+ }
+
+ LL_CONT << " " << inst->mID;
+
+ if( inst->isDead() )
+ {
+ LL_CONT << " DEAD ("<< inst->getNumRefs() << " refs)";
+ }
+
+ if( inst->isSelf() )
+ {
+ LL_CONT << " (self)";
+ }
+
+
+ F64 dist_to_camera = (inst->getPositionGlobal() - camera_pos_global).length();
+ LL_CONT << " " << dist_to_camera << "m ";
+
+ LL_CONT << " " << inst->mPixelArea << " pixels";
+
+ if( inst->isVisible() )
+ {
+ LL_CONT << " (visible)";
+ }
+ else
+ {
+ LL_CONT << " (not visible)";
+ }
+
+ if( inst->isFullyBaked() )
+ {
+ LL_CONT << " Baked";
+ }
+ else
+ {
+ LL_CONT << " Unbaked (";
+
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator iter = LLAvatarAppearance::getDictionary()->getBakedTextures().begin();
+ iter != LLAvatarAppearance::getDictionary()->getBakedTextures().end();
+ ++iter)
+ {
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = iter->second;
+ const ETextureIndex index = baked_dict->mTextureIndex;
+ if (!inst->isTextureDefined(index))
+ {
+ LL_CONT << " " << (LLAvatarAppearance::getDictionary()->getTexture(index) ? LLAvatarAppearance::getDictionary()->getTexture(index)->mName : "");
+ }
+ }
+ LL_CONT << " ) " << inst->getUnbakedPixelAreaRank();
+ if( inst->isCulled() )
+ {
+ LL_CONT << " culled";
+ }
+ }
+ LL_CONT << LL_ENDL;
+ }
}
//static
void LLVOAvatar::restoreGL()
{
- if (!isAgentAvatarValid()) return;
+ if (!isAgentAvatarValid()) return;
- gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
- for (U32 i = 0; i < gAgentAvatarp->mBakedTextureDatas.size(); i++)
- {
- gAgentAvatarp->invalidateComposite(gAgentAvatarp->getTexLayerSet(i));
- }
- gAgentAvatarp->updateMeshTextures();
+ gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
+ for (U32 i = 0; i < gAgentAvatarp->mBakedTextureDatas.size(); i++)
+ {
+ gAgentAvatarp->invalidateComposite(gAgentAvatarp->getTexLayerSet(i));
+ }
+ gAgentAvatarp->updateMeshTextures();
}
//static
void LLVOAvatar::destroyGL()
{
- deleteCachedImages();
+ deleteCachedImages();
- resetImpostors();
+ resetImpostors();
}
//static
void LLVOAvatar::resetImpostors()
{
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- LLVOAvatar* avatar = (LLVOAvatar*) *iter;
- avatar->mImpostor.release();
- avatar->mNeedsImpostorUpdate = TRUE;
- avatar->mLastImpostorUpdateReason = 1;
- }
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ LLVOAvatar* avatar = (LLVOAvatar*) *iter;
+ avatar->mImpostor.release();
+ avatar->mNeedsImpostorUpdate = TRUE;
+ avatar->mLastImpostorUpdateReason = 1;
+ }
}
// static
void LLVOAvatar::deleteCachedImages(bool clearAll)
-{
- if (LLViewerTexLayerSet::sHasCaches)
- {
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- LLVOAvatar* inst = (LLVOAvatar*) *iter;
- inst->deleteLayerSetCaches(clearAll);
- }
- LLViewerTexLayerSet::sHasCaches = FALSE;
- }
- LLVOAvatarSelf::deleteScratchTextures();
- LLTexLayerStaticImageList::getInstance()->deleteCachedImages();
+{
+ if (LLViewerTexLayerSet::sHasCaches)
+ {
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ LLVOAvatar* inst = (LLVOAvatar*) *iter;
+ inst->deleteLayerSetCaches(clearAll);
+ }
+ LLViewerTexLayerSet::sHasCaches = FALSE;
+ }
+ LLVOAvatarSelf::deleteScratchTextures();
+ LLTexLayerStaticImageList::getInstance()->deleteCachedImages();
}
@@ -1136,23 +1136,23 @@ void LLVOAvatar::deleteCachedImages(bool clearAll)
// LLVOAvatar::initClass()
//------------------------------------------------------------------------
void LLVOAvatar::initClass()
-{
- gAnimLibrary.animStateSetString(ANIM_AGENT_BODY_NOISE,"body_noise");
- gAnimLibrary.animStateSetString(ANIM_AGENT_BREATHE_ROT,"breathe_rot");
- gAnimLibrary.animStateSetString(ANIM_AGENT_PHYSICS_MOTION,"physics_motion");
- gAnimLibrary.animStateSetString(ANIM_AGENT_EDITING,"editing");
- gAnimLibrary.animStateSetString(ANIM_AGENT_EYE,"eye");
- gAnimLibrary.animStateSetString(ANIM_AGENT_FLY_ADJUST,"fly_adjust");
- gAnimLibrary.animStateSetString(ANIM_AGENT_HAND_MOTION,"hand_motion");
- gAnimLibrary.animStateSetString(ANIM_AGENT_HEAD_ROT,"head_rot");
- gAnimLibrary.animStateSetString(ANIM_AGENT_PELVIS_FIX,"pelvis_fix");
- gAnimLibrary.animStateSetString(ANIM_AGENT_TARGET,"target");
- gAnimLibrary.animStateSetString(ANIM_AGENT_WALK_ADJUST,"walk_adjust");
+{
+ gAnimLibrary.animStateSetString(ANIM_AGENT_BODY_NOISE,"body_noise");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_BREATHE_ROT,"breathe_rot");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_PHYSICS_MOTION,"physics_motion");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_EDITING,"editing");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_EYE,"eye");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_FLY_ADJUST,"fly_adjust");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_HAND_MOTION,"hand_motion");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_HEAD_ROT,"head_rot");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_PELVIS_FIX,"pelvis_fix");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_TARGET,"target");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_WALK_ADJUST,"walk_adjust");
// Where should this be set initially?
LLJoint::setDebugJointNames(gSavedSettings.getString("DebugAvatarJoints"));
- LLControlAvatar::sRegionChangedSlot = gAgent.addRegionChangedCallback(&LLControlAvatar::onRegionChanged);
+ LLControlAvatar::sRegionChangedSlot = gAgent.addRegionChangedCallback(&LLControlAvatar::onRegionChanged);
sCloudTexture = LLViewerTextureManager::getFetchedTextureFromFile("cloud-particle.j2c");
}
@@ -1165,74 +1165,74 @@ void LLVOAvatar::cleanupClass()
// virtual
void LLVOAvatar::initInstance()
{
- //-------------------------------------------------------------------------
- // register motions
- //-------------------------------------------------------------------------
- if (LLCharacter::sInstances.size() == 1)
- {
- registerMotion( ANIM_AGENT_DO_NOT_DISTURB, LLNullMotion::create );
- registerMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create );
- registerMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_ANGER, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_BORED, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_CRY, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_DISDAIN, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_EMBARRASSED, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_FROWN, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_KISS, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_LAUGH, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_OPEN_MOUTH, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_REPULSED, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_SAD, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_SHRUG, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_SMILE, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_SURPRISE, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_TONGUE_OUT, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create );
- registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create );
- registerMotion( ANIM_AGENT_FEMALE_RUN_NEW, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_FEMALE_WALK_NEW, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_RUN_NEW, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create );
- registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create );
- registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create );
- registerMotion( ANIM_AGENT_STAND_3, LLKeyframeStandMotion::create );
- registerMotion( ANIM_AGENT_STAND_4, LLKeyframeStandMotion::create );
- registerMotion( ANIM_AGENT_STANDUP, LLKeyframeFallMotion::create );
- registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_WALK_NEW, LLKeyframeWalkMotion::create );
-
- // motions without a start/stop bit
- registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create );
- registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create );
- registerMotion( ANIM_AGENT_PHYSICS_MOTION, LLPhysicsMotionController::create );
- registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create );
- registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create );
- registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create );
- registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create );
- registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create );
- registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create );
- registerMotion( ANIM_AGENT_PELVIS_FIX, LLPelvisFixMotion::create );
- registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create );
- registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create );
- registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create );
- }
-
- LLAvatarAppearance::initInstance();
-
- // preload specific motions here
- createMotion( ANIM_AGENT_CUSTOMIZE);
- createMotion( ANIM_AGENT_CUSTOMIZE_DONE);
-
- //VTPause(); // VTune
-
- mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) );
+ //-------------------------------------------------------------------------
+ // register motions
+ //-------------------------------------------------------------------------
+ if (LLCharacter::sInstances.size() == 1)
+ {
+ registerMotion( ANIM_AGENT_DO_NOT_DISTURB, LLNullMotion::create );
+ registerMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create );
+ registerMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_ANGER, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_BORED, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_CRY, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_DISDAIN, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_EMBARRASSED, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_FROWN, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_KISS, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_LAUGH, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_OPEN_MOUTH, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_REPULSED, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_SAD, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_SHRUG, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_SMILE, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_SURPRISE, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_TONGUE_OUT, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create );
+ registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create );
+ registerMotion( ANIM_AGENT_FEMALE_RUN_NEW, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_FEMALE_WALK_NEW, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_RUN_NEW, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create );
+ registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create );
+ registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create );
+ registerMotion( ANIM_AGENT_STAND_3, LLKeyframeStandMotion::create );
+ registerMotion( ANIM_AGENT_STAND_4, LLKeyframeStandMotion::create );
+ registerMotion( ANIM_AGENT_STANDUP, LLKeyframeFallMotion::create );
+ registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_WALK_NEW, LLKeyframeWalkMotion::create );
+
+ // motions without a start/stop bit
+ registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create );
+ registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create );
+ registerMotion( ANIM_AGENT_PHYSICS_MOTION, LLPhysicsMotionController::create );
+ registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create );
+ registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create );
+ registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create );
+ registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create );
+ registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create );
+ registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create );
+ registerMotion( ANIM_AGENT_PELVIS_FIX, LLPelvisFixMotion::create );
+ registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create );
+ registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create );
+ registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create );
+ }
+
+ LLAvatarAppearance::initInstance();
+
+ // preload specific motions here
+ createMotion( ANIM_AGENT_CUSTOMIZE);
+ createMotion( ANIM_AGENT_CUSTOMIZE_DONE);
+
+ //VTPause(); // VTune
+
+ mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) );
mInitFlags |= 1<<1;
}
@@ -1240,65 +1240,65 @@ void LLVOAvatar::initInstance()
// virtual
LLAvatarJoint* LLVOAvatar::createAvatarJoint()
{
- return new LLViewerJoint();
+ return new LLViewerJoint();
}
// virtual
LLAvatarJoint* LLVOAvatar::createAvatarJoint(S32 joint_num)
{
- return new LLViewerJoint(joint_num);
+ return new LLViewerJoint(joint_num);
}
// virtual
LLAvatarJointMesh* LLVOAvatar::createAvatarJointMesh()
{
- return new LLViewerJointMesh();
+ return new LLViewerJointMesh();
}
// virtual
LLTexLayerSet* LLVOAvatar::createTexLayerSet()
{
- return new LLViewerTexLayerSet(this);
+ return new LLViewerTexLayerSet(this);
}
const LLVector3 LLVOAvatar::getRenderPosition() const
{
- if (mDrawable.isNull() || mDrawable->getGeneration() < 0)
- {
- return getPositionAgent();
- }
- else if (isRoot())
- {
- F32 fixup;
- if ( hasPelvisFixup( fixup) )
- {
- //Apply a pelvis fixup (as defined by the avs skin)
- LLVector3 pos = mDrawable->getPositionAgent();
- pos[VZ] += fixup;
- return pos;
- }
- else
- {
- return mDrawable->getPositionAgent();
- }
- }
- else
- {
- return getPosition() * mDrawable->getParent()->getRenderMatrix();
- }
+ if (mDrawable.isNull() || mDrawable->getGeneration() < 0)
+ {
+ return getPositionAgent();
+ }
+ else if (isRoot())
+ {
+ F32 fixup;
+ if ( hasPelvisFixup( fixup) )
+ {
+ //Apply a pelvis fixup (as defined by the avs skin)
+ LLVector3 pos = mDrawable->getPositionAgent();
+ pos[VZ] += fixup;
+ return pos;
+ }
+ else
+ {
+ return mDrawable->getPositionAgent();
+ }
+ }
+ else
+ {
+ return getPosition() * mDrawable->getParent()->getRenderMatrix();
+ }
}
void LLVOAvatar::updateDrawable(BOOL force_damped)
{
- clearChanged(SHIFTED);
+ clearChanged(SHIFTED);
}
void LLVOAvatar::onShift(const LLVector4a& shift_vector)
{
- const LLVector3& shift = reinterpret_cast<const LLVector3&>(shift_vector);
- mLastAnimExtents[0] += shift;
- mLastAnimExtents[1] += shift;
+ const LLVector3& shift = reinterpret_cast<const LLVector3&>(shift_vector);
+ mLastAnimExtents[0] += shift;
+ mLastAnimExtents[1] += shift;
}
void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
@@ -1313,37 +1313,37 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
calculateSpatialExtents(newMin,newMax);
mLastAnimExtents[0].set(newMin.getF32ptr());
mLastAnimExtents[1].set(newMax.getF32ptr());
- mLastAnimBasePos = mPelvisp->getWorldPosition();
+ mLastAnimBasePos = mPelvisp->getWorldPosition();
mNeedsExtentUpdate = false;
}
- else
- {
- LLVector3 new_base_pos = mPelvisp->getWorldPosition();
- LLVector3 shift = new_base_pos-mLastAnimBasePos;
- mLastAnimExtents[0] += shift;
- mLastAnimExtents[1] += shift;
- mLastAnimBasePos = new_base_pos;
-
- }
-
- if (isImpostor() && !needsImpostorUpdate())
- {
- LLVector3 delta = getRenderPosition() -
- ((LLVector3(mDrawable->getPositionGroup().getF32ptr())-mImpostorOffset));
-
- newMin.load3( (mLastAnimExtents[0] + delta).mV);
- newMax.load3( (mLastAnimExtents[1] + delta).mV);
- }
- else
- {
+ else
+ {
+ LLVector3 new_base_pos = mPelvisp->getWorldPosition();
+ LLVector3 shift = new_base_pos-mLastAnimBasePos;
+ mLastAnimExtents[0] += shift;
+ mLastAnimExtents[1] += shift;
+ mLastAnimBasePos = new_base_pos;
+
+ }
+
+ if (isImpostor() && !needsImpostorUpdate())
+ {
+ LLVector3 delta = getRenderPosition() -
+ ((LLVector3(mDrawable->getPositionGroup().getF32ptr())-mImpostorOffset));
+
+ newMin.load3( (mLastAnimExtents[0] + delta).mV);
+ newMax.load3( (mLastAnimExtents[1] + delta).mV);
+ }
+ else
+ {
newMin.load3(mLastAnimExtents[0].mV);
newMax.load3(mLastAnimExtents[1].mV);
- LLVector4a pos_group;
- pos_group.setAdd(newMin,newMax);
- pos_group.mul(0.5f);
- mImpostorOffset = LLVector3(pos_group.getF32ptr())-getRenderPosition();
- mDrawable->setPositionGroup(pos_group);
- }
+ LLVector4a pos_group;
+ pos_group.setAdd(newMin,newMax);
+ pos_group.mul(0.5f);
+ mImpostorOffset = LLVector3(pos_group.getF32ptr())-getRenderPosition();
+ mDrawable->setPositionGroup(pos_group);
+ }
}
@@ -1414,8 +1414,8 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
if (box_detail >= 2)
{
float max_attachment_span = get_default_max_prim_scale() * 5.0f;
-
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)
{
@@ -1434,7 +1434,7 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
const LLVOVolume *vol = dynamic_cast<const LLVOVolume*>(attached_object);
if (vol && vol->isAnimatedObject())
{
- // Animated objects already have a bounding box in their control av, use that.
+ // Animated objects already have a bounding box in their control av, use that.
// Could lag by a frame if there's no guarantee on order of processing for avatars.
LLControlAvatar *cav = vol->getControlAvatar();
if (cav)
@@ -1464,10 +1464,10 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
LLVector4a max_span(max_attachment_span);
S32 lt = distance.lessThan(max_span).getGatheredBits() & 0x7;
-
+
// Only add the prim to spatial extents calculations if it isn't a megaprim.
- // max_attachment_span calculated at the start of the function
- // (currently 5 times our max prim size)
+ // max_attachment_span calculated at the start of the function
+ // (currently 5 times our max prim size)
if (lt == 0x7)
{
update_min_max(newMin,newMax,ext[0]);
@@ -1521,10 +1521,10 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
LLVector4a center, size;
center.setAdd(newMin, newMax);
center.mul(0.5f);
-
+
size.setSub(newMax,newMin);
size.mul(0.5f);
-
+
mPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance());
}
@@ -1537,24 +1537,24 @@ void render_sphere_and_line(const LLVector3& begin_pos, const LLVector3& end_pos
gGL.diffuseColor3f(visible_color[0], visible_color[1], visible_color[2]);
gGL.begin(LLRender::LINES);
- gGL.vertex3fv(begin_pos.mV);
+ gGL.vertex3fv(begin_pos.mV);
gGL.vertex3fv(end_pos.mV);
gGL.end();
-
+
// Draw sphere representing joint pos
gGL.pushMatrix();
gGL.scalef(sphere_scale, sphere_scale, sphere_scale);
gSphere.renderGGL();
gGL.popMatrix();
-
+
LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER);
// Occluded bone portions
gGL.diffuseColor3f(occ_color[0], occ_color[1], occ_color[2]);
gGL.begin(LLRender::LINES);
- gGL.vertex3fv(begin_pos.mV);
+ gGL.vertex3fv(begin_pos.mV);
gGL.vertex3fv(end_pos.mV);
gGL.end();
@@ -1570,18 +1570,18 @@ void render_sphere_and_line(const LLVector3& begin_pos, const LLVector3& end_pos
//-----------------------------------------------------------------------------
void LLVOAvatar::renderCollisionVolumes()
{
- std::ostringstream ostr;
+ std::ostringstream ostr;
- for (S32 i = 0; i < mNumCollisionVolumes; i++)
- {
- ostr << mCollisionVolumes[i].getName() << ", ";
+ for (S32 i = 0; i < mNumCollisionVolumes; i++)
+ {
+ ostr << mCollisionVolumes[i].getName() << ", ";
LLAvatarJointCollisionVolume& collision_volume = mCollisionVolumes[i];
- collision_volume.updateWorldMatrix();
+ collision_volume.updateWorldMatrix();
- gGL.pushMatrix();
- gGL.multMatrix( &collision_volume.getXform()->getWorldMatrix().mMatrix[0][0] );
+ gGL.pushMatrix();
+ gGL.multMatrix( &collision_volume.getXform()->getWorldMatrix().mMatrix[0][0] );
LLVector3 begin_pos(0,0,0);
LLVector3 end_pos(collision_volume.getEnd());
@@ -1593,7 +1593,7 @@ void LLVOAvatar::renderCollisionVolumes()
static LLVector3 RED(1.0f, 0.0f, 0.0f);
static LLVector3 PASTEL_RED(1.0f, 0.5f, 0.5f);
static LLVector3 WHITE(1.0f, 1.0f, 1.0f);
-
+
LLVector3 cv_color_occluded;
LLVector3 cv_color_visible;
@@ -1615,20 +1615,20 @@ void LLVOAvatar::renderCollisionVolumes()
gGL.popMatrix();
}
-
- if (mNameText.notNull())
- {
- LLVector4a unused;
-
- mNameText->lineSegmentIntersect(unused, unused, unused, TRUE);
- }
+
+ if (mNameText.notNull())
+ {
+ LLVector4a unused;
+
+ mNameText->lineSegmentIntersect(unused, unused, unused, TRUE);
+ }
}
void LLVOAvatar::renderBones(const std::string &selected_joint)
{
LLGLEnable blend(GL_BLEND);
- avatar_joint_list_t::iterator iter = mSkeleton.begin();
+ avatar_joint_list_t::iterator iter = mSkeleton.begin();
avatar_joint_list_t::iterator end = mSkeleton.end();
// For selected joints
@@ -1643,18 +1643,18 @@ void LLVOAvatar::renderBones(const std::string &selected_joint)
// For bones not otherwise colored
static LLVector3 OTHER_COLOR_OCCLUDED(0.0f, 1.0f, 0.0f);
static LLVector3 OTHER_COLOR_VISIBLE(0.5f, 0.5f, 0.5f);
-
+
static F32 SPHERE_SCALEF = 0.001f;
- for (; iter != end; ++iter)
- {
- LLJoint* jointp = *iter;
- if (!jointp)
- {
- continue;
- }
+ for (; iter != end; ++iter)
+ {
+ LLJoint* jointp = *iter;
+ if (!jointp)
+ {
+ continue;
+ }
- jointp->updateWorldMatrix();
+ jointp->updateWorldMatrix();
LLVector3 occ_color, visible_color;
@@ -1692,267 +1692,267 @@ void LLVOAvatar::renderBones(const std::string &selected_joint)
LLVector3 begin_pos(0,0,0);
LLVector3 end_pos(jointp->getEnd());
-
- gGL.pushMatrix();
- gGL.multMatrix( &jointp->getXform()->getWorldMatrix().mMatrix[0][0] );
+
+ gGL.pushMatrix();
+ gGL.multMatrix( &jointp->getXform()->getWorldMatrix().mMatrix[0][0] );
render_sphere_and_line(begin_pos, end_pos, sphere_scale, occ_color, visible_color);
-
- gGL.popMatrix();
- }
+
+ gGL.popMatrix();
+ }
}
void LLVOAvatar::renderJoints()
{
- std::ostringstream ostr;
- std::ostringstream nullstr;
+ std::ostringstream ostr;
+ std::ostringstream nullstr;
+
+ for (joint_map_t::iterator iter = mJointMap.begin(); iter != mJointMap.end(); ++iter)
+ {
+ LLJoint* jointp = iter->second;
+ if (!jointp)
+ {
+ nullstr << iter->first << " is NULL" << std::endl;
+ continue;
+ }
- for (joint_map_t::iterator iter = mJointMap.begin(); iter != mJointMap.end(); ++iter)
- {
- LLJoint* jointp = iter->second;
- if (!jointp)
- {
- nullstr << iter->first << " is NULL" << std::endl;
- continue;
- }
+ ostr << jointp->getName() << ", ";
- ostr << jointp->getName() << ", ";
+ jointp->updateWorldMatrix();
- jointp->updateWorldMatrix();
-
- gGL.pushMatrix();
- gGL.multMatrix( &jointp->getXform()->getWorldMatrix().mMatrix[0][0] );
+ gGL.pushMatrix();
+ gGL.multMatrix( &jointp->getXform()->getWorldMatrix().mMatrix[0][0] );
- gGL.diffuseColor3f( 1.f, 0.f, 1.f );
-
- gGL.begin(LLRender::LINES);
-
- LLVector3 v[] =
- {
- LLVector3(1,0,0),
- LLVector3(-1,0,0),
- LLVector3(0,1,0),
- LLVector3(0,-1,0),
+ gGL.diffuseColor3f( 1.f, 0.f, 1.f );
- LLVector3(0,0,-1),
- LLVector3(0,0,1),
- };
+ gGL.begin(LLRender::LINES);
- //sides
- gGL.vertex3fv(v[0].mV);
- gGL.vertex3fv(v[2].mV);
+ LLVector3 v[] =
+ {
+ LLVector3(1,0,0),
+ LLVector3(-1,0,0),
+ LLVector3(0,1,0),
+ LLVector3(0,-1,0),
+
+ LLVector3(0,0,-1),
+ LLVector3(0,0,1),
+ };
- gGL.vertex3fv(v[0].mV);
- gGL.vertex3fv(v[3].mV);
+ //sides
+ gGL.vertex3fv(v[0].mV);
+ gGL.vertex3fv(v[2].mV);
- gGL.vertex3fv(v[1].mV);
- gGL.vertex3fv(v[2].mV);
+ gGL.vertex3fv(v[0].mV);
+ gGL.vertex3fv(v[3].mV);
- gGL.vertex3fv(v[1].mV);
- gGL.vertex3fv(v[3].mV);
+ gGL.vertex3fv(v[1].mV);
+ gGL.vertex3fv(v[2].mV);
+ gGL.vertex3fv(v[1].mV);
+ gGL.vertex3fv(v[3].mV);
- //top
- gGL.vertex3fv(v[0].mV);
- gGL.vertex3fv(v[4].mV);
- gGL.vertex3fv(v[1].mV);
- gGL.vertex3fv(v[4].mV);
+ //top
+ gGL.vertex3fv(v[0].mV);
+ gGL.vertex3fv(v[4].mV);
- gGL.vertex3fv(v[2].mV);
- gGL.vertex3fv(v[4].mV);
+ gGL.vertex3fv(v[1].mV);
+ gGL.vertex3fv(v[4].mV);
- gGL.vertex3fv(v[3].mV);
- gGL.vertex3fv(v[4].mV);
+ gGL.vertex3fv(v[2].mV);
+ gGL.vertex3fv(v[4].mV);
+ gGL.vertex3fv(v[3].mV);
+ gGL.vertex3fv(v[4].mV);
- //bottom
- gGL.vertex3fv(v[0].mV);
- gGL.vertex3fv(v[5].mV);
- gGL.vertex3fv(v[1].mV);
- gGL.vertex3fv(v[5].mV);
+ //bottom
+ gGL.vertex3fv(v[0].mV);
+ gGL.vertex3fv(v[5].mV);
- gGL.vertex3fv(v[2].mV);
- gGL.vertex3fv(v[5].mV);
+ gGL.vertex3fv(v[1].mV);
+ gGL.vertex3fv(v[5].mV);
- gGL.vertex3fv(v[3].mV);
- gGL.vertex3fv(v[5].mV);
+ gGL.vertex3fv(v[2].mV);
+ gGL.vertex3fv(v[5].mV);
- gGL.end();
+ gGL.vertex3fv(v[3].mV);
+ gGL.vertex3fv(v[5].mV);
- gGL.popMatrix();
- }
+ gGL.end();
- mDebugText.clear();
- addDebugText(ostr.str());
- addDebugText(nullstr.str());
+ gGL.popMatrix();
+ }
+
+ mDebugText.clear();
+ addDebugText(ostr.str());
+ addDebugText(nullstr.str());
}
BOOL LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face,
- BOOL pick_transparent,
- BOOL pick_rigged,
+ S32 face,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
BOOL pick_unselectable,
- S32* face_hit,
- LLVector4a* intersection,
- LLVector2* tex_coord,
- LLVector4a* normal,
- LLVector4a* tangent)
+ S32* face_hit,
+ LLVector4a* intersection,
+ LLVector2* tex_coord,
+ LLVector4a* normal,
+ LLVector4a* tangent)
{
- if ((isSelf() && !gAgent.needsRenderAvatar()) || !LLPipeline::sPickAvatar)
- {
- return FALSE;
- }
+ if ((isSelf() && !gAgent.needsRenderAvatar()) || !LLPipeline::sPickAvatar)
+ {
+ return FALSE;
+ }
if (isControlAvatar())
{
return FALSE;
}
-
- if (lineSegmentBoundingBox(start, end))
- {
- for (S32 i = 0; i < mNumCollisionVolumes; ++i)
- {
- mCollisionVolumes[i].updateWorldMatrix();
-
- glh::matrix4f mat((F32*) mCollisionVolumes[i].getXform()->getWorldMatrix().mMatrix);
- glh::matrix4f inverse = mat.inverse();
- glh::matrix4f norm_mat = inverse.transpose();
-
- glh::vec3f p1(start.getF32ptr());
- glh::vec3f p2(end.getF32ptr());
-
- inverse.mult_matrix_vec(p1);
- inverse.mult_matrix_vec(p2);
-
- LLVector3 position;
- LLVector3 norm;
-
- if (linesegment_sphere(LLVector3(p1.v), LLVector3(p2.v), LLVector3(0,0,0), 1.f, position, norm))
- {
- glh::vec3f res_pos(position.mV);
- mat.mult_matrix_vec(res_pos);
-
- norm.normalize();
- glh::vec3f res_norm(norm.mV);
- norm_mat.mult_matrix_dir(res_norm);
-
- if (intersection)
- {
- intersection->load3(res_pos.v);
- }
-
- if (normal)
- {
- normal->load3(res_norm.v);
- }
-
- return TRUE;
- }
- }
-
- if (isSelf())
- {
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
-
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject* attached_object = attachment_iter->get();
-
- if (attached_object && !attached_object->isDead() && attachment->getValid())
- {
- LLDrawable* drawable = attached_object->mDrawable;
- if (drawable->isState(LLDrawable::RIGGED))
- { //regenerate octree for rigged attachment
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_RIGGED);
- }
- }
- }
- }
- }
- }
-
-
-
- LLVector4a position;
- if (mNameText.notNull() && mNameText->lineSegmentIntersect(start, end, position))
- {
- if (intersection)
- {
- *intersection = position;
- }
-
- return TRUE;
- }
-
- return FALSE;
+
+ if (lineSegmentBoundingBox(start, end))
+ {
+ for (S32 i = 0; i < mNumCollisionVolumes; ++i)
+ {
+ mCollisionVolumes[i].updateWorldMatrix();
+
+ glh::matrix4f mat((F32*) mCollisionVolumes[i].getXform()->getWorldMatrix().mMatrix);
+ glh::matrix4f inverse = mat.inverse();
+ glh::matrix4f norm_mat = inverse.transpose();
+
+ glh::vec3f p1(start.getF32ptr());
+ glh::vec3f p2(end.getF32ptr());
+
+ inverse.mult_matrix_vec(p1);
+ inverse.mult_matrix_vec(p2);
+
+ LLVector3 position;
+ LLVector3 norm;
+
+ if (linesegment_sphere(LLVector3(p1.v), LLVector3(p2.v), LLVector3(0,0,0), 1.f, position, norm))
+ {
+ glh::vec3f res_pos(position.mV);
+ mat.mult_matrix_vec(res_pos);
+
+ norm.normalize();
+ glh::vec3f res_norm(norm.mV);
+ norm_mat.mult_matrix_dir(res_norm);
+
+ if (intersection)
+ {
+ intersection->load3(res_pos.v);
+ }
+
+ if (normal)
+ {
+ normal->load3(res_norm.v);
+ }
+
+ return TRUE;
+ }
+ }
+
+ if (isSelf())
+ {
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject* attached_object = attachment_iter->get();
+
+ if (attached_object && !attached_object->isDead() && attachment->getValid())
+ {
+ LLDrawable* drawable = attached_object->mDrawable;
+ if (drawable->isState(LLDrawable::RIGGED))
+ { //regenerate octree for rigged attachment
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_RIGGED);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+
+ LLVector4a position;
+ if (mNameText.notNull() && mNameText->lineSegmentIntersect(start, end, position))
+ {
+ if (intersection)
+ {
+ *intersection = position;
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
}
// virtual
LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector4a& start, const LLVector4a& end,
- S32 face,
- BOOL pick_transparent,
- BOOL pick_rigged,
+ S32 face,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
BOOL pick_unselectable,
- S32* face_hit,
- LLVector4a* intersection,
- LLVector2* tex_coord,
- LLVector4a* normal,
- LLVector4a* tangent)
-{
- if (isSelf() && !gAgent.needsRenderAvatar())
- {
- return NULL;
- }
-
- LLViewerObject* hit = NULL;
-
- if (lineSegmentBoundingBox(start, end))
- {
- LLVector4a local_end = end;
- LLVector4a local_intersection;
-
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
-
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject* attached_object = attachment_iter->get();
-
- if (attached_object->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, pick_unselectable, face_hit, &local_intersection, tex_coord, normal, tangent))
- {
- local_end = local_intersection;
- if (intersection)
- {
- *intersection = local_intersection;
- }
-
- hit = attached_object;
- }
- }
- }
- }
-
- return hit;
+ S32* face_hit,
+ LLVector4a* intersection,
+ LLVector2* tex_coord,
+ LLVector4a* normal,
+ LLVector4a* tangent)
+{
+ if (isSelf() && !gAgent.needsRenderAvatar())
+ {
+ return NULL;
+ }
+
+ LLViewerObject* hit = NULL;
+
+ if (lineSegmentBoundingBox(start, end))
+ {
+ LLVector4a local_end = end;
+ LLVector4a local_intersection;
+
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject* attached_object = attachment_iter->get();
+
+ if (attached_object->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, pick_unselectable, face_hit, &local_intersection, tex_coord, normal, tangent))
+ {
+ local_end = local_intersection;
+ if (intersection)
+ {
+ *intersection = local_intersection;
+ }
+
+ hit = attached_object;
+ }
+ }
+ }
+ }
+
+ return hit;
}
LLVOAvatar* LLVOAvatar::asAvatar()
{
- return this;
+ return this;
}
//-----------------------------------------------------------------------------
@@ -1960,21 +1960,21 @@ LLVOAvatar* LLVOAvatar::asAvatar()
//-----------------------------------------------------------------------------
void LLVOAvatar::startDefaultMotions()
{
- //-------------------------------------------------------------------------
- // start default motions
- //-------------------------------------------------------------------------
- startMotion( ANIM_AGENT_HEAD_ROT );
- startMotion( ANIM_AGENT_EYE );
- startMotion( ANIM_AGENT_BODY_NOISE );
- startMotion( ANIM_AGENT_BREATHE_ROT );
- startMotion( ANIM_AGENT_PHYSICS_MOTION );
- startMotion( ANIM_AGENT_HAND_MOTION );
- startMotion( ANIM_AGENT_PELVIS_FIX );
+ //-------------------------------------------------------------------------
+ // start default motions
+ //-------------------------------------------------------------------------
+ startMotion( ANIM_AGENT_HEAD_ROT );
+ startMotion( ANIM_AGENT_EYE );
+ startMotion( ANIM_AGENT_BODY_NOISE );
+ startMotion( ANIM_AGENT_BREATHE_ROT );
+ startMotion( ANIM_AGENT_PHYSICS_MOTION );
+ startMotion( ANIM_AGENT_HAND_MOTION );
+ startMotion( ANIM_AGENT_PELVIS_FIX );
- //-------------------------------------------------------------------------
- // restart any currently active motions
- //-------------------------------------------------------------------------
- processAnimationStateChanges();
+ //-------------------------------------------------------------------------
+ // restart any currently active motions
+ //-------------------------------------------------------------------------
+ processAnimationStateChanges();
}
//-----------------------------------------------------------------------------
@@ -1984,51 +1984,51 @@ void LLVOAvatar::startDefaultMotions()
// virtual
void LLVOAvatar::buildCharacter()
{
- LLAvatarAppearance::buildCharacter();
+ LLAvatarAppearance::buildCharacter();
- // Not done building yet; more to do.
- mIsBuilt = FALSE;
+ // Not done building yet; more to do.
+ mIsBuilt = FALSE;
- //-------------------------------------------------------------------------
- // set head offset from pelvis
- //-------------------------------------------------------------------------
- updateHeadOffset();
+ //-------------------------------------------------------------------------
+ // set head offset from pelvis
+ //-------------------------------------------------------------------------
+ updateHeadOffset();
- //-------------------------------------------------------------------------
- // initialize lip sync morph pointers
- //-------------------------------------------------------------------------
- mOohMorph = getVisualParam( "Lipsync_Ooh" );
- mAahMorph = getVisualParam( "Lipsync_Aah" );
+ //-------------------------------------------------------------------------
+ // initialize lip sync morph pointers
+ //-------------------------------------------------------------------------
+ mOohMorph = getVisualParam( "Lipsync_Ooh" );
+ mAahMorph = getVisualParam( "Lipsync_Aah" );
- // If we don't have the Ooh morph, use the Kiss morph
- if (!mOohMorph)
- {
- LL_WARNS() << "Missing 'Ooh' morph for lipsync, using fallback." << LL_ENDL;
- mOohMorph = getVisualParam( "Express_Kiss" );
- }
+ // If we don't have the Ooh morph, use the Kiss morph
+ if (!mOohMorph)
+ {
+ LL_WARNS() << "Missing 'Ooh' morph for lipsync, using fallback." << LL_ENDL;
+ mOohMorph = getVisualParam( "Express_Kiss" );
+ }
- // If we don't have the Aah morph, use the Open Mouth morph
- if (!mAahMorph)
- {
- LL_WARNS() << "Missing 'Aah' morph for lipsync, using fallback." << LL_ENDL;
- mAahMorph = getVisualParam( "Express_Open_Mouth" );
- }
+ // If we don't have the Aah morph, use the Open Mouth morph
+ if (!mAahMorph)
+ {
+ LL_WARNS() << "Missing 'Aah' morph for lipsync, using fallback." << LL_ENDL;
+ mAahMorph = getVisualParam( "Express_Open_Mouth" );
+ }
// Currently disabled for control avatars (animated objects), enabled for all others.
if (mEnableDefaultMotions)
{
- startDefaultMotions();
+ startDefaultMotions();
}
- //-------------------------------------------------------------------------
- // restart any currently active motions
- //-------------------------------------------------------------------------
- processAnimationStateChanges();
+ //-------------------------------------------------------------------------
+ // restart any currently active motions
+ //-------------------------------------------------------------------------
+ processAnimationStateChanges();
- mIsBuilt = TRUE;
- stop_glerror();
+ mIsBuilt = TRUE;
+ stop_glerror();
- mMeshValid = TRUE;
+ mMeshValid = TRUE;
}
//-----------------------------------------------------------------------------
@@ -2036,30 +2036,30 @@ void LLVOAvatar::buildCharacter()
//-----------------------------------------------------------------------------
void LLVOAvatar::resetVisualParams()
{
- // Skeletal params
- {
- LLAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter;
- for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin();
- iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end();
- ++iter)
- {
- LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)*iter;
- LLPolySkeletalDistortion *param = dynamic_cast<LLPolySkeletalDistortion*>(getVisualParam(info->getID()));
+ // Skeletal params
+ {
+ LLAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter;
+ for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin();
+ iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end();
+ ++iter)
+ {
+ LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)*iter;
+ LLPolySkeletalDistortion *param = dynamic_cast<LLPolySkeletalDistortion*>(getVisualParam(info->getID()));
*param = LLPolySkeletalDistortion(this);
llassert(param);
- if (!param->setInfo(info))
- {
- llassert(false);
- }
- }
- }
-
- // Driver parameters
- for (LLAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin();
- iter != sAvatarXmlInfo->mDriverInfoList.end();
- ++iter)
- {
- LLDriverParamInfo *info = *iter;
+ if (!param->setInfo(info))
+ {
+ llassert(false);
+ }
+ }
+ }
+
+ // Driver parameters
+ for (LLAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin();
+ iter != sAvatarXmlInfo->mDriverInfoList.end();
+ ++iter)
+ {
+ LLDriverParamInfo *info = *iter;
LLDriverParam *param = dynamic_cast<LLDriverParam*>(getVisualParam(info->getID()));
LLDriverParam::entry_list_t driven_list = param->getDrivenList();
*param = LLDriverParam(this);
@@ -2067,41 +2067,41 @@ void LLVOAvatar::resetVisualParams()
if (!param->setInfo(info))
{
llassert(false);
- }
+ }
param->setDrivenList(driven_list);
- }
+ }
}
void LLVOAvatar::applyDefaultParams()
{
- // These are params from avs with newly created copies of shape,
- // skin, hair, eyes, plus gender set as noted. Run arche_tool.py
- // to get params from some other xml appearance dump.
- std::map<S32, U8> male_params = {
- {1,33}, {2,61}, {4,85}, {5,23}, {6,58}, {7,127}, {8,63}, {10,85}, {11,63}, {12,42}, {13,0}, {14,85}, {15,63}, {16,36}, {17,85}, {18,95}, {19,153}, {20,63}, {21,34}, {22,0}, {23,63}, {24,109}, {25,88}, {27,132}, {31,63}, {33,136}, {34,81}, {35,85}, {36,103}, {37,136}, {38,127}, {80,255}, {93,203}, {98,0}, {99,0}, {105,127}, {108,0}, {110,0}, {111,127}, {112,0}, {113,0}, {114,127}, {115,0}, {116,0}, {117,0}, {119,127}, {130,114}, {131,127}, {132,99}, {133,63}, {134,127}, {135,140}, {136,127}, {137,127}, {140,0}, {141,0}, {142,0}, {143,191}, {150,0}, {155,104}, {157,0}, {162,0}, {163,0}, {165,0}, {166,0}, {167,0}, {168,0}, {169,0}, {177,0}, {181,145}, {182,216}, {183,133}, {184,0}, {185,127}, {192,0}, {193,127}, {196,170}, {198,0}, {503,0}, {505,127}, {506,127}, {507,109}, {508,85}, {513,127}, {514,127}, {515,63}, {517,85}, {518,42}, {603,100}, {604,216}, {605,214}, {606,204}, {607,204}, {608,204}, {609,51}, {616,25}, {617,89}, {619,76}, {624,204}, {625,0}, {629,127}, {637,0}, {638,0}, {646,144}, {647,85}, {649,127}, {650,132}, {652,127}, {653,85}, {654,0}, {656,127}, {659,127}, {662,127}, {663,127}, {664,127}, {665,127}, {674,59}, {675,127}, {676,85}, {678,127}, {682,127}, {683,106}, {684,47}, {685,79}, {690,127}, {692,127}, {693,204}, {700,63}, {701,0}, {702,0}, {703,0}, {704,0}, {705,127}, {706,127}, {707,0}, {708,0}, {709,0}, {710,0}, {711,127}, {712,0}, {713,159}, {714,0}, {715,0}, {750,178}, {752,127}, {753,36}, {754,85}, {755,131}, {756,127}, {757,127}, {758,127}, {759,153}, {760,95}, {762,0}, {763,140}, {764,74}, {765,27}, {769,127}, {773,127}, {775,0}, {779,214}, {780,204}, {781,198}, {785,0}, {789,0}, {795,63}, {796,30}, {799,127}, {800,226}, {801,255}, {802,198}, {803,255}, {804,255}, {805,255}, {806,255}, {807,255}, {808,255}, {812,255}, {813,255}, {814,255}, {815,204}, {816,0}, {817,255}, {818,255}, {819,255}, {820,255}, {821,255}, {822,255}, {823,255}, {824,255}, {825,255}, {826,255}, {827,255}, {828,0}, {829,255}, {830,255}, {834,255}, {835,255}, {836,255}, {840,0}, {841,127}, {842,127}, {844,255}, {848,25}, {858,100}, {859,255}, {860,255}, {861,255}, {862,255}, {863,84}, {868,0}, {869,0}, {877,0}, {879,51}, {880,132}, {921,255}, {922,255}, {923,255}, {10000,0}, {10001,0}, {10002,25}, {10003,0}, {10004,25}, {10005,23}, {10006,51}, {10007,0}, {10008,25}, {10009,23}, {10010,51}, {10011,0}, {10012,0}, {10013,25}, {10014,0}, {10015,25}, {10016,23}, {10017,51}, {10018,0}, {10019,0}, {10020,25}, {10021,0}, {10022,25}, {10023,23}, {10024,51}, {10025,0}, {10026,25}, {10027,23}, {10028,51}, {10029,0}, {10030,25}, {10031,23}, {10032,51}, {11000,1}, {11001,127}
- };
- std::map<S32, U8> female_params = {
- {1,33}, {2,61}, {4,85}, {5,23}, {6,58}, {7,127}, {8,63}, {10,85}, {11,63}, {12,42}, {13,0}, {14,85}, {15,63}, {16,36}, {17,85}, {18,95}, {19,153}, {20,63}, {21,34}, {22,0}, {23,63}, {24,109}, {25,88}, {27,132}, {31,63}, {33,136}, {34,81}, {35,85}, {36,103}, {37,136}, {38,127}, {80,0}, {93,203}, {98,0}, {99,0}, {105,127}, {108,0}, {110,0}, {111,127}, {112,0}, {113,0}, {114,127}, {115,0}, {116,0}, {117,0}, {119,127}, {130,114}, {131,127}, {132,99}, {133,63}, {134,127}, {135,140}, {136,127}, {137,127}, {140,0}, {141,0}, {142,0}, {143,191}, {150,0}, {155,104}, {157,0}, {162,0}, {163,0}, {165,0}, {166,0}, {167,0}, {168,0}, {169,0}, {177,0}, {181,145}, {182,216}, {183,133}, {184,0}, {185,127}, {192,0}, {193,127}, {196,170}, {198,0}, {503,0}, {505,127}, {506,127}, {507,109}, {508,85}, {513,127}, {514,127}, {515,63}, {517,85}, {518,42}, {603,100}, {604,216}, {605,214}, {606,204}, {607,204}, {608,204}, {609,51}, {616,25}, {617,89}, {619,76}, {624,204}, {625,0}, {629,127}, {637,0}, {638,0}, {646,144}, {647,85}, {649,127}, {650,132}, {652,127}, {653,85}, {654,0}, {656,127}, {659,127}, {662,127}, {663,127}, {664,127}, {665,127}, {674,59}, {675,127}, {676,85}, {678,127}, {682,127}, {683,106}, {684,47}, {685,79}, {690,127}, {692,127}, {693,204}, {700,63}, {701,0}, {702,0}, {703,0}, {704,0}, {705,127}, {706,127}, {707,0}, {708,0}, {709,0}, {710,0}, {711,127}, {712,0}, {713,159}, {714,0}, {715,0}, {750,178}, {752,127}, {753,36}, {754,85}, {755,131}, {756,127}, {757,127}, {758,127}, {759,153}, {760,95}, {762,0}, {763,140}, {764,74}, {765,27}, {769,127}, {773,127}, {775,0}, {779,214}, {780,204}, {781,198}, {785,0}, {789,0}, {795,63}, {796,30}, {799,127}, {800,226}, {801,255}, {802,198}, {803,255}, {804,255}, {805,255}, {806,255}, {807,255}, {808,255}, {812,255}, {813,255}, {814,255}, {815,204}, {816,0}, {817,255}, {818,255}, {819,255}, {820,255}, {821,255}, {822,255}, {823,255}, {824,255}, {825,255}, {826,255}, {827,255}, {828,0}, {829,255}, {830,255}, {834,255}, {835,255}, {836,255}, {840,0}, {841,127}, {842,127}, {844,255}, {848,25}, {858,100}, {859,255}, {860,255}, {861,255}, {862,255}, {863,84}, {868,0}, {869,0}, {877,0}, {879,51}, {880,132}, {921,255}, {922,255}, {923,255}, {10000,0}, {10001,0}, {10002,25}, {10003,0}, {10004,25}, {10005,23}, {10006,51}, {10007,0}, {10008,25}, {10009,23}, {10010,51}, {10011,0}, {10012,0}, {10013,25}, {10014,0}, {10015,25}, {10016,23}, {10017,51}, {10018,0}, {10019,0}, {10020,25}, {10021,0}, {10022,25}, {10023,23}, {10024,51}, {10025,0}, {10026,25}, {10027,23}, {10028,51}, {10029,0}, {10030,25}, {10031,23}, {10032,51}, {11000,1}, {11001,127}
- };
- std::map<S32, U8> *params = NULL;
- if (getSex() == SEX_MALE)
- params = &male_params;
- else
- params = &female_params;
-
- for( auto it = params->begin(); it != params->end(); ++it)
- {
- LLVisualParam* param = getVisualParam(it->first);
- if( !param )
- {
- // invalid id
- break;
- }
-
- U8 value = it->second;
- F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight());
- param->setWeight(newWeight);
- }
+ // These are params from avs with newly created copies of shape,
+ // skin, hair, eyes, plus gender set as noted. Run arche_tool.py
+ // to get params from some other xml appearance dump.
+ std::map<S32, U8> male_params = {
+ {1,33}, {2,61}, {4,85}, {5,23}, {6,58}, {7,127}, {8,63}, {10,85}, {11,63}, {12,42}, {13,0}, {14,85}, {15,63}, {16,36}, {17,85}, {18,95}, {19,153}, {20,63}, {21,34}, {22,0}, {23,63}, {24,109}, {25,88}, {27,132}, {31,63}, {33,136}, {34,81}, {35,85}, {36,103}, {37,136}, {38,127}, {80,255}, {93,203}, {98,0}, {99,0}, {105,127}, {108,0}, {110,0}, {111,127}, {112,0}, {113,0}, {114,127}, {115,0}, {116,0}, {117,0}, {119,127}, {130,114}, {131,127}, {132,99}, {133,63}, {134,127}, {135,140}, {136,127}, {137,127}, {140,0}, {141,0}, {142,0}, {143,191}, {150,0}, {155,104}, {157,0}, {162,0}, {163,0}, {165,0}, {166,0}, {167,0}, {168,0}, {169,0}, {177,0}, {181,145}, {182,216}, {183,133}, {184,0}, {185,127}, {192,0}, {193,127}, {196,170}, {198,0}, {503,0}, {505,127}, {506,127}, {507,109}, {508,85}, {513,127}, {514,127}, {515,63}, {517,85}, {518,42}, {603,100}, {604,216}, {605,214}, {606,204}, {607,204}, {608,204}, {609,51}, {616,25}, {617,89}, {619,76}, {624,204}, {625,0}, {629,127}, {637,0}, {638,0}, {646,144}, {647,85}, {649,127}, {650,132}, {652,127}, {653,85}, {654,0}, {656,127}, {659,127}, {662,127}, {663,127}, {664,127}, {665,127}, {674,59}, {675,127}, {676,85}, {678,127}, {682,127}, {683,106}, {684,47}, {685,79}, {690,127}, {692,127}, {693,204}, {700,63}, {701,0}, {702,0}, {703,0}, {704,0}, {705,127}, {706,127}, {707,0}, {708,0}, {709,0}, {710,0}, {711,127}, {712,0}, {713,159}, {714,0}, {715,0}, {750,178}, {752,127}, {753,36}, {754,85}, {755,131}, {756,127}, {757,127}, {758,127}, {759,153}, {760,95}, {762,0}, {763,140}, {764,74}, {765,27}, {769,127}, {773,127}, {775,0}, {779,214}, {780,204}, {781,198}, {785,0}, {789,0}, {795,63}, {796,30}, {799,127}, {800,226}, {801,255}, {802,198}, {803,255}, {804,255}, {805,255}, {806,255}, {807,255}, {808,255}, {812,255}, {813,255}, {814,255}, {815,204}, {816,0}, {817,255}, {818,255}, {819,255}, {820,255}, {821,255}, {822,255}, {823,255}, {824,255}, {825,255}, {826,255}, {827,255}, {828,0}, {829,255}, {830,255}, {834,255}, {835,255}, {836,255}, {840,0}, {841,127}, {842,127}, {844,255}, {848,25}, {858,100}, {859,255}, {860,255}, {861,255}, {862,255}, {863,84}, {868,0}, {869,0}, {877,0}, {879,51}, {880,132}, {921,255}, {922,255}, {923,255}, {10000,0}, {10001,0}, {10002,25}, {10003,0}, {10004,25}, {10005,23}, {10006,51}, {10007,0}, {10008,25}, {10009,23}, {10010,51}, {10011,0}, {10012,0}, {10013,25}, {10014,0}, {10015,25}, {10016,23}, {10017,51}, {10018,0}, {10019,0}, {10020,25}, {10021,0}, {10022,25}, {10023,23}, {10024,51}, {10025,0}, {10026,25}, {10027,23}, {10028,51}, {10029,0}, {10030,25}, {10031,23}, {10032,51}, {11000,1}, {11001,127}
+ };
+ std::map<S32, U8> female_params = {
+ {1,33}, {2,61}, {4,85}, {5,23}, {6,58}, {7,127}, {8,63}, {10,85}, {11,63}, {12,42}, {13,0}, {14,85}, {15,63}, {16,36}, {17,85}, {18,95}, {19,153}, {20,63}, {21,34}, {22,0}, {23,63}, {24,109}, {25,88}, {27,132}, {31,63}, {33,136}, {34,81}, {35,85}, {36,103}, {37,136}, {38,127}, {80,0}, {93,203}, {98,0}, {99,0}, {105,127}, {108,0}, {110,0}, {111,127}, {112,0}, {113,0}, {114,127}, {115,0}, {116,0}, {117,0}, {119,127}, {130,114}, {131,127}, {132,99}, {133,63}, {134,127}, {135,140}, {136,127}, {137,127}, {140,0}, {141,0}, {142,0}, {143,191}, {150,0}, {155,104}, {157,0}, {162,0}, {163,0}, {165,0}, {166,0}, {167,0}, {168,0}, {169,0}, {177,0}, {181,145}, {182,216}, {183,133}, {184,0}, {185,127}, {192,0}, {193,127}, {196,170}, {198,0}, {503,0}, {505,127}, {506,127}, {507,109}, {508,85}, {513,127}, {514,127}, {515,63}, {517,85}, {518,42}, {603,100}, {604,216}, {605,214}, {606,204}, {607,204}, {608,204}, {609,51}, {616,25}, {617,89}, {619,76}, {624,204}, {625,0}, {629,127}, {637,0}, {638,0}, {646,144}, {647,85}, {649,127}, {650,132}, {652,127}, {653,85}, {654,0}, {656,127}, {659,127}, {662,127}, {663,127}, {664,127}, {665,127}, {674,59}, {675,127}, {676,85}, {678,127}, {682,127}, {683,106}, {684,47}, {685,79}, {690,127}, {692,127}, {693,204}, {700,63}, {701,0}, {702,0}, {703,0}, {704,0}, {705,127}, {706,127}, {707,0}, {708,0}, {709,0}, {710,0}, {711,127}, {712,0}, {713,159}, {714,0}, {715,0}, {750,178}, {752,127}, {753,36}, {754,85}, {755,131}, {756,127}, {757,127}, {758,127}, {759,153}, {760,95}, {762,0}, {763,140}, {764,74}, {765,27}, {769,127}, {773,127}, {775,0}, {779,214}, {780,204}, {781,198}, {785,0}, {789,0}, {795,63}, {796,30}, {799,127}, {800,226}, {801,255}, {802,198}, {803,255}, {804,255}, {805,255}, {806,255}, {807,255}, {808,255}, {812,255}, {813,255}, {814,255}, {815,204}, {816,0}, {817,255}, {818,255}, {819,255}, {820,255}, {821,255}, {822,255}, {823,255}, {824,255}, {825,255}, {826,255}, {827,255}, {828,0}, {829,255}, {830,255}, {834,255}, {835,255}, {836,255}, {840,0}, {841,127}, {842,127}, {844,255}, {848,25}, {858,100}, {859,255}, {860,255}, {861,255}, {862,255}, {863,84}, {868,0}, {869,0}, {877,0}, {879,51}, {880,132}, {921,255}, {922,255}, {923,255}, {10000,0}, {10001,0}, {10002,25}, {10003,0}, {10004,25}, {10005,23}, {10006,51}, {10007,0}, {10008,25}, {10009,23}, {10010,51}, {10011,0}, {10012,0}, {10013,25}, {10014,0}, {10015,25}, {10016,23}, {10017,51}, {10018,0}, {10019,0}, {10020,25}, {10021,0}, {10022,25}, {10023,23}, {10024,51}, {10025,0}, {10026,25}, {10027,23}, {10028,51}, {10029,0}, {10030,25}, {10031,23}, {10032,51}, {11000,1}, {11001,127}
+ };
+ std::map<S32, U8> *params = NULL;
+ if (getSex() == SEX_MALE)
+ params = &male_params;
+ else
+ params = &female_params;
+
+ for( auto it = params->begin(); it != params->end(); ++it)
+ {
+ LLVisualParam* param = getVisualParam(it->first);
+ if( !param )
+ {
+ // invalid id
+ break;
+ }
+
+ U8 value = it->second;
+ F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight());
+ param->setWeight(newWeight);
+ }
}
//-----------------------------------------------------------------------------
@@ -2127,10 +2127,10 @@ void LLVOAvatar::resetSkeleton(bool reset_animations)
// just to get the right scale for the collision volumes, because
// this will be used in setting the mJointScales for the
// LLPolySkeletalDistortions of which the CVs are children.
- if( !buildSkeleton(sAvatarSkeletonInfo) )
+ if( !buildSkeleton(sAvatarSkeletonInfo) )
{
LL_ERRS() << "Error resetting skeleton" << LL_ENDL;
- }
+ }
// Reset some params to default state, without propagating changes downstream.
resetVisualParams();
@@ -2138,10 +2138,10 @@ void LLVOAvatar::resetSkeleton(bool reset_animations)
// Now we have to reset the skeleton again, because its state
// got clobbered by the resetVisualParams() calls
// above.
- if( !buildSkeleton(sAvatarSkeletonInfo) )
+ if( !buildSkeleton(sAvatarSkeletonInfo) )
{
LL_ERRS() << "Error resetting skeleton" << LL_ENDL;
- }
+ }
// Reset attachment points
// BuildSkeleton only does bones and CVs but we still need to reinit huds
@@ -2150,7 +2150,7 @@ void LLVOAvatar::resetSkeleton(bool reset_animations)
initAttachmentPoints(ignore_hud_joints);
// Fix up collision volumes
- for (LLVisualParam *param = getFirstVisualParam();
+ for (LLVisualParam *param = getFirstVisualParam();
param;
param = getNextVisualParam())
{
@@ -2166,30 +2166,30 @@ void LLVOAvatar::resetSkeleton(bool reset_animations)
}
// Reset tweakable params to preserved state
- if (getOverallAppearance() == AOA_NORMAL)
- {
- if (mLastProcessedAppearance)
- {
- bool slam_params = true;
- applyParsedAppearanceMessage(*mLastProcessedAppearance, slam_params);
- }
- }
- else
- {
- // Stripped down approximation of
- // applyParsedAppearanceMessage, but with alternative default
- // (jellydoll) params
- setCompositeUpdatesEnabled( FALSE );
- gPipeline.markGLRebuild(this);
- applyDefaultParams();
- setCompositeUpdatesEnabled( TRUE );
- updateMeshTextures();
- updateMeshVisibility();
- }
+ if (getOverallAppearance() == AOA_NORMAL)
+ {
+ if (mLastProcessedAppearance)
+ {
+ bool slam_params = true;
+ applyParsedAppearanceMessage(*mLastProcessedAppearance, slam_params);
+ }
+ }
+ else
+ {
+ // Stripped down approximation of
+ // applyParsedAppearanceMessage, but with alternative default
+ // (jellydoll) params
+ setCompositeUpdatesEnabled( FALSE );
+ gPipeline.markGLRebuild(this);
+ applyDefaultParams();
+ setCompositeUpdatesEnabled( TRUE );
+ updateMeshTextures();
+ updateMeshVisibility();
+ }
updateVisualParams();
// Restore attachment pos overrides
- updateAttachmentOverrides();
+ updateAttachmentOverrides();
// Animations
if (reset_animations)
@@ -2207,7 +2207,7 @@ void LLVOAvatar::resetSkeleton(bool reset_animations)
resetAnimations();
}
}
-
+
LL_DEBUGS("Avatar") << avString() << " reset ends" << LL_ENDL;
}
@@ -2216,49 +2216,49 @@ void LLVOAvatar::resetSkeleton(bool reset_animations)
//-----------------------------------------------------------------------------
void LLVOAvatar::releaseMeshData()
{
- if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || isUIAvatar())
- {
- return;
- }
-
- // cleanup mesh data
- for (avatar_joint_list_t::iterator iter = mMeshLOD.begin();
- iter != mMeshLOD.end();
- ++iter)
- {
- LLAvatarJoint* joint = (*iter);
- joint->setValid(FALSE, TRUE);
- }
-
- //cleanup data
- if (mDrawable.notNull())
- {
- LLFace* facep = mDrawable->getFace(0);
- if (facep)
- {
- facep->setSize(0, 0);
- for(S32 i = mNumInitFaces ; i < mDrawable->getNumFaces(); i++)
- {
- facep = mDrawable->getFace(i);
- if (facep)
- {
- facep->setSize(0, 0);
- }
- }
- }
- }
-
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (!attachment->getIsHUDAttachment())
- {
- attachment->setAttachmentVisibility(FALSE);
- }
- }
- mMeshValid = FALSE;
+ if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || isUIAvatar())
+ {
+ return;
+ }
+
+ // cleanup mesh data
+ for (avatar_joint_list_t::iterator iter = mMeshLOD.begin();
+ iter != mMeshLOD.end();
+ ++iter)
+ {
+ LLAvatarJoint* joint = (*iter);
+ joint->setValid(FALSE, TRUE);
+ }
+
+ //cleanup data
+ if (mDrawable.notNull())
+ {
+ LLFace* facep = mDrawable->getFace(0);
+ if (facep)
+ {
+ facep->setSize(0, 0);
+ for(S32 i = mNumInitFaces ; i < mDrawable->getNumFaces(); i++)
+ {
+ facep = mDrawable->getFace(i);
+ if (facep)
+ {
+ facep->setSize(0, 0);
+ }
+ }
+ }
+ }
+
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (!attachment->getIsHUDAttachment())
+ {
+ attachment->setAttachmentVisibility(FALSE);
+ }
+ }
+ mMeshValid = FALSE;
}
//-----------------------------------------------------------------------------
@@ -2267,29 +2267,29 @@ void LLVOAvatar::releaseMeshData()
// virtual
void LLVOAvatar::restoreMeshData()
{
- llassert(!isSelf());
+ llassert(!isSelf());
if (mDrawable.isNull())
{
return;
}
-
- //LL_INFOS() << "Restoring" << LL_ENDL;
- mMeshValid = TRUE;
- updateJointLODs();
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (!attachment->getIsHUDAttachment())
- {
- attachment->setAttachmentVisibility(TRUE);
- }
- }
+ //LL_INFOS() << "Restoring" << LL_ENDL;
+ mMeshValid = TRUE;
+ updateJointLODs();
+
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (!attachment->getIsHUDAttachment())
+ {
+ attachment->setAttachmentVisibility(TRUE);
+ }
+ }
- // force mesh update as LOD might not have changed to trigger this
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
+ // force mesh update as LOD might not have changed to trigger this
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
}
//-----------------------------------------------------------------------------
@@ -2297,149 +2297,149 @@ void LLVOAvatar::restoreMeshData()
//-----------------------------------------------------------------------------
void LLVOAvatar::updateMeshData()
{
- if (mDrawable.notNull())
- {
- stop_glerror();
-
- S32 f_num = 0 ;
- const U32 VERTEX_NUMBER_THRESHOLD = 128 ;//small number of this means each part of an avatar has its own vertex buffer.
- const S32 num_parts = mMeshLOD.size();
-
- // this order is determined by number of LODS
- // if a mesh earlier in this list changed LODs while a later mesh doesn't,
- // the later mesh's index offset will be inaccurate
- for(S32 part_index = 0 ; part_index < num_parts ;)
- {
- S32 j = part_index ;
- U32 last_v_num = 0, num_vertices = 0 ;
- U32 last_i_num = 0, num_indices = 0 ;
-
- while(part_index < num_parts && num_vertices < VERTEX_NUMBER_THRESHOLD)
- {
- last_v_num = num_vertices ;
- last_i_num = num_indices ;
-
- LLViewerJoint* part_mesh = getViewerJoint(part_index++);
- if (part_mesh)
- {
- part_mesh->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea);
- }
- }
- if(num_vertices < 1)//skip empty meshes
- {
- continue ;
- }
- if(last_v_num > 0)//put the last inserted part into next vertex buffer.
- {
- num_vertices = last_v_num ;
- num_indices = last_i_num ;
- part_index-- ;
- }
-
- LLFace* facep = NULL;
- if(f_num < mDrawable->getNumFaces())
- {
- facep = mDrawable->getFace(f_num);
- }
- else
- {
- facep = mDrawable->getFace(0);
- if (facep)
- {
- facep = mDrawable->addFace(facep->getPool(), facep->getTexture()) ;
- }
- }
- if (!facep) continue;
-
- // resize immediately
- facep->setSize(num_vertices, num_indices);
-
- bool terse_update = false;
-
- facep->setGeomIndex(0);
- facep->setIndicesIndex(0);
-
- LLVertexBuffer* buff = facep->getVertexBuffer();
- if(!facep->getVertexBuffer())
- {
+ if (mDrawable.notNull())
+ {
+ stop_glerror();
+
+ S32 f_num = 0 ;
+ const U32 VERTEX_NUMBER_THRESHOLD = 128 ;//small number of this means each part of an avatar has its own vertex buffer.
+ const S32 num_parts = mMeshLOD.size();
+
+ // this order is determined by number of LODS
+ // if a mesh earlier in this list changed LODs while a later mesh doesn't,
+ // the later mesh's index offset will be inaccurate
+ for(S32 part_index = 0 ; part_index < num_parts ;)
+ {
+ S32 j = part_index ;
+ U32 last_v_num = 0, num_vertices = 0 ;
+ U32 last_i_num = 0, num_indices = 0 ;
+
+ while(part_index < num_parts && num_vertices < VERTEX_NUMBER_THRESHOLD)
+ {
+ last_v_num = num_vertices ;
+ last_i_num = num_indices ;
+
+ LLViewerJoint* part_mesh = getViewerJoint(part_index++);
+ if (part_mesh)
+ {
+ part_mesh->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea);
+ }
+ }
+ if(num_vertices < 1)//skip empty meshes
+ {
+ continue ;
+ }
+ if(last_v_num > 0)//put the last inserted part into next vertex buffer.
+ {
+ num_vertices = last_v_num ;
+ num_indices = last_i_num ;
+ part_index-- ;
+ }
+
+ LLFace* facep = NULL;
+ if(f_num < mDrawable->getNumFaces())
+ {
+ facep = mDrawable->getFace(f_num);
+ }
+ else
+ {
+ facep = mDrawable->getFace(0);
+ if (facep)
+ {
+ facep = mDrawable->addFace(facep->getPool(), facep->getTexture()) ;
+ }
+ }
+ if (!facep) continue;
+
+ // resize immediately
+ facep->setSize(num_vertices, num_indices);
+
+ bool terse_update = false;
+
+ facep->setGeomIndex(0);
+ facep->setIndicesIndex(0);
+
+ LLVertexBuffer* buff = facep->getVertexBuffer();
+ if(!facep->getVertexBuffer())
+ {
buff = new LLVertexBuffer(LLDrawPoolAvatar::VERTEX_DATA_MASK);
- if (!buff->allocateBuffer(num_vertices, num_indices))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer for Mesh to "
- << num_vertices << " vertices and "
- << num_indices << " indices" << LL_ENDL;
- // Attempt to create a dummy triangle (one vertex, 3 indices, all 0)
- facep->setSize(1, 3);
- buff->allocateBuffer(1, 3);
- memset((U8*) buff->getMappedData(), 0, buff->getSize());
- memset((U8*) buff->getMappedIndices(), 0, buff->getIndicesSize());
- }
- facep->setVertexBuffer(buff);
- }
- else
- {
- if (buff->getNumIndices() == num_indices &&
- buff->getNumVerts() == num_vertices)
- {
- terse_update = true;
- }
- else
- {
+ if (!buff->allocateBuffer(num_vertices, num_indices))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer for Mesh to "
+ << num_vertices << " vertices and "
+ << num_indices << " indices" << LL_ENDL;
+ // Attempt to create a dummy triangle (one vertex, 3 indices, all 0)
+ facep->setSize(1, 3);
+ buff->allocateBuffer(1, 3);
+ memset((U8*) buff->getMappedData(), 0, buff->getSize());
+ memset((U8*) buff->getMappedIndices(), 0, buff->getIndicesSize());
+ }
+ facep->setVertexBuffer(buff);
+ }
+ else
+ {
+ if (buff->getNumIndices() == num_indices &&
+ buff->getNumVerts() == num_vertices)
+ {
+ terse_update = true;
+ }
+ else
+ {
buff = new LLVertexBuffer(buff->getTypeMask());
if (!buff->allocateBuffer(num_vertices, num_indices))
{
- LL_WARNS() << "Failed to allocate vertex buffer for Mesh, Substituting" << LL_ENDL;
- // Attempt to create a dummy triangle (one vertex, 3 indices, all 0)
- facep->setSize(1, 3);
- buff->allocateBuffer(1, 3);
- memset((U8*) buff->getMappedData(), 0, buff->getSize());
- memset((U8*) buff->getMappedIndices(), 0, buff->getIndicesSize());
- }
- }
- }
-
-
- // This is a hack! Avatars have their own pool, so we are detecting
- // the case of more than one avatar in the pool (thus > 0 instead of >= 0)
- if (facep->getGeomIndex() > 0)
- {
- LL_ERRS() << "non-zero geom index: " << facep->getGeomIndex() << " in LLVOAvatar::restoreMeshData" << LL_ENDL;
- }
-
- if (num_vertices == buff->getNumVerts() && num_indices == buff->getNumIndices())
- {
- for(S32 k = j ; k < part_index ; k++)
- {
- bool rigid = false;
- if (k == MESH_ID_EYEBALL_LEFT ||
- k == MESH_ID_EYEBALL_RIGHT)
- {
- //eyeballs can't have terse updates since they're never rendered with
- //the hardware skinning shader
- rigid = true;
- }
-
- LLViewerJoint* mesh = getViewerJoint(k);
- if (mesh)
- {
- mesh->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update && !rigid);
- }
- }
- }
-
- stop_glerror();
- buff->unmapBuffer();
-
- if(!f_num)
- {
- f_num += mNumInitFaces ;
- }
- else
- {
- f_num++ ;
- }
- }
- }
+ LL_WARNS() << "Failed to allocate vertex buffer for Mesh, Substituting" << LL_ENDL;
+ // Attempt to create a dummy triangle (one vertex, 3 indices, all 0)
+ facep->setSize(1, 3);
+ buff->allocateBuffer(1, 3);
+ memset((U8*) buff->getMappedData(), 0, buff->getSize());
+ memset((U8*) buff->getMappedIndices(), 0, buff->getIndicesSize());
+ }
+ }
+ }
+
+
+ // This is a hack! Avatars have their own pool, so we are detecting
+ // the case of more than one avatar in the pool (thus > 0 instead of >= 0)
+ if (facep->getGeomIndex() > 0)
+ {
+ LL_ERRS() << "non-zero geom index: " << facep->getGeomIndex() << " in LLVOAvatar::restoreMeshData" << LL_ENDL;
+ }
+
+ if (num_vertices == buff->getNumVerts() && num_indices == buff->getNumIndices())
+ {
+ for(S32 k = j ; k < part_index ; k++)
+ {
+ bool rigid = false;
+ if (k == MESH_ID_EYEBALL_LEFT ||
+ k == MESH_ID_EYEBALL_RIGHT)
+ {
+ //eyeballs can't have terse updates since they're never rendered with
+ //the hardware skinning shader
+ rigid = true;
+ }
+
+ LLViewerJoint* mesh = getViewerJoint(k);
+ if (mesh)
+ {
+ mesh->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update && !rigid);
+ }
+ }
+ }
+
+ stop_glerror();
+ buff->unmapBuffer();
+
+ if(!f_num)
+ {
+ f_num += mNumInitFaces ;
+ }
+ else
+ {
+ f_num++ ;
+ }
+ }
+ }
}
//------------------------------------------------------------------------
@@ -2448,78 +2448,78 @@ void LLVOAvatar::updateMeshData()
// LLVOAvatar::processUpdateMessage()
//------------------------------------------------------------------------
U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num, const EObjectUpdateType update_type,
- LLDataPacker *dp)
+ void **user_data,
+ U32 block_num, const EObjectUpdateType update_type,
+ LLDataPacker *dp)
{
- const BOOL has_name = !getNVPair("FirstName");
+ const BOOL has_name = !getNVPair("FirstName");
- // Do base class updates...
- U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
+ // Do base class updates...
+ U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
- // Print out arrival information once we have name of avatar.
+ // Print out arrival information once we have name of avatar.
if (has_name && getNVPair("FirstName"))
{
mDebugExistenceTimer.reset();
debugAvatarRezTime("AvatarRezArrivedNotification","avatar arrived");
}
- if(retval & LLViewerObject::INVALID_UPDATE)
- {
- if (isSelf())
- {
- //tell sim to cancel this update
- gAgent.teleportViaLocation(gAgent.getPositionGlobal());
- }
- }
+ if(retval & LLViewerObject::INVALID_UPDATE)
+ {
+ if (isSelf())
+ {
+ //tell sim to cancel this update
+ gAgent.teleportViaLocation(gAgent.getPositionGlobal());
+ }
+ }
- return retval;
+ return retval;
}
LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUUID& uuid)
{
- LLViewerFetchedTexture *result = NULL;
-
- if (uuid == IMG_DEFAULT_AVATAR ||
- uuid == IMG_DEFAULT ||
- uuid == IMG_INVISIBLE)
- {
- // Should already exist, don't need to find it on sim or baked-texture host.
- result = gTextureList.findImage(uuid, TEX_LIST_STANDARD);
- }
- if (!result)
- {
- const std::string url = getImageURL(te,uuid);
-
- if (url.empty())
- {
- LL_WARNS() << "unable to determine URL for te " << te << " uuid " << uuid << LL_ENDL;
- return NULL;
- }
- LL_DEBUGS("Avatar") << avString() << "get server-bake image from URL " << url << LL_ENDL;
- result = LLViewerTextureManager::getFetchedTextureFromUrl(
- url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid);
- if (result->isMissingAsset())
- {
- result->setIsMissingAsset(false);
- }
-
- }
- return result;
+ LLViewerFetchedTexture *result = NULL;
+
+ if (uuid == IMG_DEFAULT_AVATAR ||
+ uuid == IMG_DEFAULT ||
+ uuid == IMG_INVISIBLE)
+ {
+ // Should already exist, don't need to find it on sim or baked-texture host.
+ result = gTextureList.findImage(uuid, TEX_LIST_STANDARD);
+ }
+ if (!result)
+ {
+ const std::string url = getImageURL(te,uuid);
+
+ if (url.empty())
+ {
+ LL_WARNS() << "unable to determine URL for te " << te << " uuid " << uuid << LL_ENDL;
+ return NULL;
+ }
+ LL_DEBUGS("Avatar") << avString() << "get server-bake image from URL " << url << LL_ENDL;
+ result = LLViewerTextureManager::getFetchedTextureFromUrl(
+ url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid);
+ if (result->isMissingAsset())
+ {
+ result->setIsMissingAsset(false);
+ }
+
+ }
+ return result;
}
// virtual
S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid)
{
- if (!isIndexBakedTexture((ETextureIndex)te))
- {
- // Sim still sends some uuids for non-baked slots sometimes - ignore.
- return LLViewerObject::setTETexture(te, LLUUID::null);
- }
+ if (!isIndexBakedTexture((ETextureIndex)te))
+ {
+ // Sim still sends some uuids for non-baked slots sometimes - ignore.
+ return LLViewerObject::setTETexture(te, LLUUID::null);
+ }
- LLViewerFetchedTexture *image = getBakedTextureImage(te,uuid);
- llassert(image);
- return setTETextureCore(te, image);
+ LLViewerFetchedTexture *image = getBakedTextureImage(te,uuid);
+ llassert(image);
+ return setTETextureCore(te, image);
}
//------------------------------------------------------------------------
@@ -2527,26 +2527,26 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid)
//------------------------------------------------------------------------
void LLVOAvatar::dumpAnimationState()
{
- LL_INFOS() << "==============================================" << LL_ENDL;
- for (LLVOAvatar::AnimIterator it = mSignaledAnimations.begin(); it != mSignaledAnimations.end(); ++it)
- {
- LLUUID id = it->first;
- std::string playtag = "";
- if (mPlayingAnimations.find(id) != mPlayingAnimations.end())
- {
- playtag = "*";
- }
- LL_INFOS() << gAnimLibrary.animationName(id) << playtag << LL_ENDL;
- }
- for (LLVOAvatar::AnimIterator it = mPlayingAnimations.begin(); it != mPlayingAnimations.end(); ++it)
- {
- LLUUID id = it->first;
- bool is_signaled = mSignaledAnimations.find(id) != mSignaledAnimations.end();
- if (!is_signaled)
- {
- LL_INFOS() << gAnimLibrary.animationName(id) << "!S" << LL_ENDL;
- }
- }
+ LL_INFOS() << "==============================================" << LL_ENDL;
+ for (LLVOAvatar::AnimIterator it = mSignaledAnimations.begin(); it != mSignaledAnimations.end(); ++it)
+ {
+ LLUUID id = it->first;
+ std::string playtag = "";
+ if (mPlayingAnimations.find(id) != mPlayingAnimations.end())
+ {
+ playtag = "*";
+ }
+ LL_INFOS() << gAnimLibrary.animationName(id) << playtag << LL_ENDL;
+ }
+ for (LLVOAvatar::AnimIterator it = mPlayingAnimations.begin(); it != mPlayingAnimations.end(); ++it)
+ {
+ LLUUID id = it->first;
+ bool is_signaled = mSignaledAnimations.find(id) != mSignaledAnimations.end();
+ if (!is_signaled)
+ {
+ LL_INFOS() << gAnimLibrary.animationName(id) << "!S" << LL_ENDL;
+ }
+ }
}
//------------------------------------------------------------------------
@@ -2556,118 +2556,118 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- if (isDead())
- {
- LL_INFOS() << "Warning! Idle on dead avatar" << LL_ENDL;
- return;
- }
+ if (isDead())
+ {
+ LL_INFOS() << "Warning! Idle on dead avatar" << LL_ENDL;
+ return;
+ }
// record time and refresh "tooSlow" status
updateTooSlow();
- static LLCachedControl<bool> disable_all_render_types(gSavedSettings, "DisableAllRenderTypes");
- if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR))
- && !disable_all_render_types && !isSelf())
- {
+ static LLCachedControl<bool> disable_all_render_types(gSavedSettings, "DisableAllRenderTypes");
+ if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR))
+ && !disable_all_render_types && !isSelf())
+ {
if (!mIsControlAvatar)
{
idleUpdateNameTag(idleCalcNameTagPosition(mLastRootPos));
}
- return;
- }
+ return;
+ }
// Update should be happening max once per frame.
- if ((mLastAnimExtents[0]==LLVector3())||
- (mLastAnimExtents[1])==LLVector3())
- {
- mNeedsExtentUpdate = true;
- }
- else
- {
- const S32 upd_freq = 4; // force update every upd_freq frames.
- mNeedsExtentUpdate = ((LLDrawable::getCurrentFrame()+mID.mData[0])%upd_freq==0);
- }
-
+ if ((mLastAnimExtents[0]==LLVector3())||
+ (mLastAnimExtents[1])==LLVector3())
+ {
+ mNeedsExtentUpdate = true;
+ }
+ else
+ {
+ const S32 upd_freq = 4; // force update every upd_freq frames.
+ mNeedsExtentUpdate = ((LLDrawable::getCurrentFrame()+mID.mData[0])%upd_freq==0);
+ }
+
LLScopedContextString str("avatar_idle_update " + getFullname());
-
- checkTextureLoading() ;
-
- // force immediate pixel area update on avatars using last frames data (before drawable or camera updates)
- setPixelAreaAndAngle(gAgent);
-
- // force asynchronous drawable update
- if(mDrawable.notNull())
- {
- if (isSitting() && getParent())
- {
- LLViewerObject *root_object = (LLViewerObject*)getRoot();
- LLDrawable* drawablep = root_object->mDrawable;
- // if this object hasn't already been updated by another avatar...
- if (drawablep) // && !drawablep->isState(LLDrawable::EARLY_MOVE))
- {
- if (root_object->isSelected())
- {
- gPipeline.updateMoveNormalAsync(drawablep);
- }
- else
- {
- gPipeline.updateMoveDampedAsync(drawablep);
- }
- }
- }
- else
- {
- gPipeline.updateMoveDampedAsync(mDrawable);
- }
- }
-
- //--------------------------------------------------------------------
- // set alpha flag depending on state
- //--------------------------------------------------------------------
-
- if (isSelf())
- {
- LLViewerObject::idleUpdate(agent, time);
-
- // trigger fidget anims
- if (isAnyAnimationSignaled(AGENT_STAND_ANIMS, NUM_AGENT_STAND_ANIMS))
- {
- agent.fidget();
- }
- }
- else
- {
- // Should override the idleUpdate stuff and leave out the angular update part.
- LLQuaternion rotation = getRotation();
- LLViewerObject::idleUpdate(agent, time);
- setRotation(rotation);
- }
-
- // attach objects that were waiting for a drawable
- lazyAttach();
-
- // animate the character
- // store off last frame's root position to be consistent with camera position
- mLastRootPos = mRoot->getWorldPosition();
- BOOL detailed_update = updateCharacter(agent);
-
- static LLUICachedControl<bool> visualizers_in_calls("ShowVoiceVisualizersInCalls", false);
- bool voice_enabled = (visualizers_in_calls || LLVoiceClient::getInstance()->inProximalChannel()) &&
- LLVoiceClient::getInstance()->getVoiceEnabled(mID);
+
+ checkTextureLoading() ;
+
+ // force immediate pixel area update on avatars using last frames data (before drawable or camera updates)
+ setPixelAreaAndAngle(gAgent);
+
+ // force asynchronous drawable update
+ if(mDrawable.notNull())
+ {
+ if (isSitting() && getParent())
+ {
+ LLViewerObject *root_object = (LLViewerObject*)getRoot();
+ LLDrawable* drawablep = root_object->mDrawable;
+ // if this object hasn't already been updated by another avatar...
+ if (drawablep) // && !drawablep->isState(LLDrawable::EARLY_MOVE))
+ {
+ if (root_object->isSelected())
+ {
+ gPipeline.updateMoveNormalAsync(drawablep);
+ }
+ else
+ {
+ gPipeline.updateMoveDampedAsync(drawablep);
+ }
+ }
+ }
+ else
+ {
+ gPipeline.updateMoveDampedAsync(mDrawable);
+ }
+ }
+
+ //--------------------------------------------------------------------
+ // set alpha flag depending on state
+ //--------------------------------------------------------------------
+
+ if (isSelf())
+ {
+ LLViewerObject::idleUpdate(agent, time);
+
+ // trigger fidget anims
+ if (isAnyAnimationSignaled(AGENT_STAND_ANIMS, NUM_AGENT_STAND_ANIMS))
+ {
+ agent.fidget();
+ }
+ }
+ else
+ {
+ // Should override the idleUpdate stuff and leave out the angular update part.
+ LLQuaternion rotation = getRotation();
+ LLViewerObject::idleUpdate(agent, time);
+ setRotation(rotation);
+ }
+
+ // attach objects that were waiting for a drawable
+ lazyAttach();
+
+ // animate the character
+ // store off last frame's root position to be consistent with camera position
+ mLastRootPos = mRoot->getWorldPosition();
+ BOOL detailed_update = updateCharacter(agent);
+
+ static LLUICachedControl<bool> visualizers_in_calls("ShowVoiceVisualizersInCalls", false);
+ bool voice_enabled = (visualizers_in_calls || LLVoiceClient::getInstance()->inProximalChannel()) &&
+ LLVoiceClient::getInstance()->getVoiceEnabled(mID);
LLVector3 hud_name_pos = idleCalcNameTagPosition(mLastRootPos);
- idleUpdateVoiceVisualizer(voice_enabled, hud_name_pos);
- idleUpdateMisc( detailed_update );
- idleUpdateAppearanceAnimation();
- if (detailed_update)
- {
- idleUpdateLipSync( voice_enabled );
- idleUpdateLoadingEffect();
- idleUpdateBelowWater(); // wind effect uses this
- idleUpdateWindEffect();
- }
-
- idleUpdateNameTag(hud_name_pos);
+ idleUpdateVoiceVisualizer(voice_enabled, hud_name_pos);
+ idleUpdateMisc( detailed_update );
+ idleUpdateAppearanceAnimation();
+ if (detailed_update)
+ {
+ idleUpdateLipSync( voice_enabled );
+ idleUpdateLoadingEffect();
+ idleUpdateBelowWater(); // wind effect uses this
+ idleUpdateWindEffect();
+ }
+
+ idleUpdateNameTag(hud_name_pos);
// Complexity has stale mechanics, but updates still can be very rapid
// so spread avatar complexity calculations over frames to lesen load from
@@ -2698,7 +2698,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
if ((LLFrameTimer::getFrameCount() + mID.mData[0]) % compl_upd_freq == 0)
{
- // DEPRECATED
+ // DEPRECATED
// replace with LLPipeline::profileAvatar?
// Avatar profile takes ~ 0.5ms while idleUpdateRenderComplexity takes ~5ms
// (both are unacceptably costly)
@@ -2709,96 +2709,96 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled, const LLVector3 &position)
{
- bool render_visualizer = voice_enabled;
-
- // Don't render the user's own voice visualizer when in mouselook, or when opening the mic is disabled.
- if(isSelf())
- {
+ bool render_visualizer = voice_enabled;
+
+ // Don't render the user's own voice visualizer when in mouselook, or when opening the mic is disabled.
+ if(isSelf())
+ {
static LLCachedControl<bool> voice_disable_mic(gSavedSettings, "VoiceDisableMic");
- if(gAgentCamera.cameraMouselook() || voice_disable_mic)
- {
- render_visualizer = false;
- }
- }
-
- mVoiceVisualizer->setVoiceEnabled(render_visualizer);
-
- if ( voice_enabled )
- {
- //----------------------------------------------------------------
- // Only do gesture triggering for your own avatar, and only when you're in a proximal channel.
- //----------------------------------------------------------------
- if( isSelf() )
- {
- //----------------------------------------------------------------------------------------
- // The following takes the voice signal and uses that to trigger gesticulations.
- //----------------------------------------------------------------------------------------
- int lastGesticulationLevel = mCurrentGesticulationLevel;
- mCurrentGesticulationLevel = mVoiceVisualizer->getCurrentGesticulationLevel();
-
- //---------------------------------------------------------------------------------------------------
- // If "current gesticulation level" changes, we catch this, and trigger the new gesture
- //---------------------------------------------------------------------------------------------------
- if ( lastGesticulationLevel != mCurrentGesticulationLevel )
- {
- if ( mCurrentGesticulationLevel != VOICE_GESTICULATION_LEVEL_OFF )
- {
- std::string gestureString = "unInitialized";
- if ( mCurrentGesticulationLevel == 0 ) { gestureString = "/voicelevel1"; }
- else if ( mCurrentGesticulationLevel == 1 ) { gestureString = "/voicelevel2"; }
- else if ( mCurrentGesticulationLevel == 2 ) { gestureString = "/voicelevel3"; }
- else { LL_INFOS() << "oops - CurrentGesticulationLevel can be only 0, 1, or 2" << LL_ENDL; }
-
- // this is the call that Karl S. created for triggering gestures from within the code.
- LLGestureMgr::instance().triggerAndReviseString( gestureString );
- }
- }
-
- } //if( isSelf() )
-
- //-----------------------------------------------------------------------------------------------------------------
- // If the avatar is speaking, then the voice amplitude signal is passed to the voice visualizer.
- // Also, here we trigger voice visualizer start and stop speaking, so it can animate the voice symbol.
- //
- // Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been
- // "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking.
- //-----------------------------------------------------------------------------------------------------------------
- if (LLVoiceClient::getInstance()->getIsSpeaking( mID ))
- {
- if (!mVoiceVisualizer->getCurrentlySpeaking())
- {
- mVoiceVisualizer->setStartSpeaking();
-
- //printf( "gAwayTimer.reset();\n" );
- }
-
- mVoiceVisualizer->setSpeakingAmplitude( LLVoiceClient::getInstance()->getCurrentPower( mID ) );
-
- if( isSelf() )
- {
- gAgent.clearAFK();
- }
- }
- else
- {
- if ( mVoiceVisualizer->getCurrentlySpeaking() )
- {
- mVoiceVisualizer->setStopSpeaking();
-
- if ( mLipSyncActive )
- {
- if( mOohMorph ) mOohMorph->setWeight(mOohMorph->getMinWeight());
- if( mAahMorph ) mAahMorph->setWeight(mAahMorph->getMinWeight());
-
- mLipSyncActive = false;
- LLCharacter::updateVisualParams();
- dirtyMesh();
- }
- }
- }
+ if(gAgentCamera.cameraMouselook() || voice_disable_mic)
+ {
+ render_visualizer = false;
+ }
+ }
+
+ mVoiceVisualizer->setVoiceEnabled(render_visualizer);
+
+ if ( voice_enabled )
+ {
+ //----------------------------------------------------------------
+ // Only do gesture triggering for your own avatar, and only when you're in a proximal channel.
+ //----------------------------------------------------------------
+ if( isSelf() )
+ {
+ //----------------------------------------------------------------------------------------
+ // The following takes the voice signal and uses that to trigger gesticulations.
+ //----------------------------------------------------------------------------------------
+ int lastGesticulationLevel = mCurrentGesticulationLevel;
+ mCurrentGesticulationLevel = mVoiceVisualizer->getCurrentGesticulationLevel();
+
+ //---------------------------------------------------------------------------------------------------
+ // If "current gesticulation level" changes, we catch this, and trigger the new gesture
+ //---------------------------------------------------------------------------------------------------
+ if ( lastGesticulationLevel != mCurrentGesticulationLevel )
+ {
+ if ( mCurrentGesticulationLevel != VOICE_GESTICULATION_LEVEL_OFF )
+ {
+ std::string gestureString = "unInitialized";
+ if ( mCurrentGesticulationLevel == 0 ) { gestureString = "/voicelevel1"; }
+ else if ( mCurrentGesticulationLevel == 1 ) { gestureString = "/voicelevel2"; }
+ else if ( mCurrentGesticulationLevel == 2 ) { gestureString = "/voicelevel3"; }
+ else { LL_INFOS() << "oops - CurrentGesticulationLevel can be only 0, 1, or 2" << LL_ENDL; }
+
+ // this is the call that Karl S. created for triggering gestures from within the code.
+ LLGestureMgr::instance().triggerAndReviseString( gestureString );
+ }
+ }
+
+ } //if( isSelf() )
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // If the avatar is speaking, then the voice amplitude signal is passed to the voice visualizer.
+ // Also, here we trigger voice visualizer start and stop speaking, so it can animate the voice symbol.
+ //
+ // Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been
+ // "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking.
+ //-----------------------------------------------------------------------------------------------------------------
+ if (LLVoiceClient::getInstance()->getIsSpeaking( mID ))
+ {
+ if (!mVoiceVisualizer->getCurrentlySpeaking())
+ {
+ mVoiceVisualizer->setStartSpeaking();
+
+ //printf( "gAwayTimer.reset();\n" );
+ }
+
+ mVoiceVisualizer->setSpeakingAmplitude( LLVoiceClient::getInstance()->getCurrentPower( mID ) );
+
+ if( isSelf() )
+ {
+ gAgent.clearAFK();
+ }
+ }
+ else
+ {
+ if ( mVoiceVisualizer->getCurrentlySpeaking() )
+ {
+ mVoiceVisualizer->setStopSpeaking();
+
+ if ( mLipSyncActive )
+ {
+ if( mOohMorph ) mOohMorph->setWeight(mOohMorph->getMinWeight());
+ if( mAahMorph ) mAahMorph->setWeight(mAahMorph->getMinWeight());
+
+ mLipSyncActive = false;
+ LLCharacter::updateVisualParams();
+ dirtyMesh();
+ }
+ }
+ }
mVoiceVisualizer->setPositionAgent(position);
- }//if ( voiceEnabled )
-}
+ }//if ( voiceEnabled )
+}
static void override_bbox(LLDrawable* drawable, LLVector4a* extents)
{
@@ -2811,31 +2811,31 @@ static void override_bbox(LLDrawable* drawable, LLVector4a* extents)
void LLVOAvatar::idleUpdateMisc(bool detailed_update)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- if (LLVOAvatar::sJointDebug)
- {
- LL_INFOS() << getFullname() << ": joint touches: " << LLJoint::sNumTouches << " updates: " << LLJoint::sNumUpdates << LL_ENDL;
- }
+ if (LLVOAvatar::sJointDebug)
+ {
+ LL_INFOS() << getFullname() << ": joint touches: " << LLJoint::sNumTouches << " updates: " << LLJoint::sNumUpdates << LL_ENDL;
+ }
- LLJoint::sNumUpdates = 0;
- LLJoint::sNumTouches = 0;
+ LLJoint::sNumUpdates = 0;
+ LLJoint::sNumTouches = 0;
- BOOL visible = isVisible() || mNeedsAnimUpdate;
+ BOOL visible = isVisible() || mNeedsAnimUpdate;
- // update attachments positions
- if (detailed_update)
- {
+ // update attachments positions
+ if (detailed_update)
+ {
U32 draw_order = 0;
S32 attachment_selected = LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment();
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
-
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
LLViewerObject* attached_object = attachment_iter->get();
if (!attached_object
|| attached_object->isDead()
@@ -2846,9 +2846,9 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
}
LLSpatialBridge* bridge = attached_object->mDrawable->getSpatialBridge();
-
- if (visible || !(bridge && bridge->getRadius() < 2.0))
- {
+
+ if (visible || !(bridge && bridge->getRadius() < 2.0))
+ {
//override rigged attachments' octree spatial extents with this avatar's bounding box
bool rigged = false;
if (bridge)
@@ -2902,839 +2902,839 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
}
}
- attached_object->updateText();
- }
- }
- }
- }
-
- mNeedsAnimUpdate = FALSE;
-
- if (isImpostor() && !mNeedsImpostorUpdate)
- {
- LL_ALIGN_16(LLVector4a ext[2]);
- F32 distance;
- LLVector3 angle;
-
- getImpostorValues(ext, angle, distance);
-
- for (U32 i = 0; i < 3 && !mNeedsImpostorUpdate; i++)
- {
- F32 cur_angle = angle.mV[i];
- F32 old_angle = mImpostorAngle.mV[i];
- F32 angle_diff = fabsf(cur_angle-old_angle);
-
- if (angle_diff > F_PI/512.f*distance*mUpdatePeriod)
- {
- mNeedsImpostorUpdate = TRUE;
- mLastImpostorUpdateReason = 2;
- }
- }
-
- if (detailed_update && !mNeedsImpostorUpdate)
- { //update impostor if view angle, distance, or bounding box change
- //significantly
-
- F32 dist_diff = fabsf(distance-mImpostorDistance);
- if (dist_diff/mImpostorDistance > 0.1f)
- {
- mNeedsImpostorUpdate = TRUE;
- mLastImpostorUpdateReason = 3;
- }
- else
- {
- ext[0].load3(mLastAnimExtents[0].mV);
+ attached_object->updateText();
+ }
+ }
+ }
+ }
+
+ mNeedsAnimUpdate = FALSE;
+
+ if (isImpostor() && !mNeedsImpostorUpdate)
+ {
+ LL_ALIGN_16(LLVector4a ext[2]);
+ F32 distance;
+ LLVector3 angle;
+
+ getImpostorValues(ext, angle, distance);
+
+ for (U32 i = 0; i < 3 && !mNeedsImpostorUpdate; i++)
+ {
+ F32 cur_angle = angle.mV[i];
+ F32 old_angle = mImpostorAngle.mV[i];
+ F32 angle_diff = fabsf(cur_angle-old_angle);
+
+ if (angle_diff > F_PI/512.f*distance*mUpdatePeriod)
+ {
+ mNeedsImpostorUpdate = TRUE;
+ mLastImpostorUpdateReason = 2;
+ }
+ }
+
+ if (detailed_update && !mNeedsImpostorUpdate)
+ { //update impostor if view angle, distance, or bounding box change
+ //significantly
+
+ F32 dist_diff = fabsf(distance-mImpostorDistance);
+ if (dist_diff/mImpostorDistance > 0.1f)
+ {
+ mNeedsImpostorUpdate = TRUE;
+ mLastImpostorUpdateReason = 3;
+ }
+ else
+ {
+ ext[0].load3(mLastAnimExtents[0].mV);
ext[1].load3(mLastAnimExtents[1].mV);
// Expensive. Just call this once per frame, in updateSpatialExtents();
//calculateSpatialExtents(ext[0], ext[1]);
- LLVector4a diff;
- diff.setSub(ext[1], mImpostorExtents[1]);
- if (diff.getLength3().getF32() > 0.05f)
- {
- mNeedsImpostorUpdate = TRUE;
- mLastImpostorUpdateReason = 4;
- }
- else
- {
- diff.setSub(ext[0], mImpostorExtents[0]);
- if (diff.getLength3().getF32() > 0.05f)
- {
- mNeedsImpostorUpdate = TRUE;
- mLastImpostorUpdateReason = 5;
- }
- }
- }
- }
- }
+ LLVector4a diff;
+ diff.setSub(ext[1], mImpostorExtents[1]);
+ if (diff.getLength3().getF32() > 0.05f)
+ {
+ mNeedsImpostorUpdate = TRUE;
+ mLastImpostorUpdateReason = 4;
+ }
+ else
+ {
+ diff.setSub(ext[0], mImpostorExtents[0]);
+ if (diff.getLength3().getF32() > 0.05f)
+ {
+ mNeedsImpostorUpdate = TRUE;
+ mLastImpostorUpdateReason = 5;
+ }
+ }
+ }
+ }
+ }
if (mDrawable.notNull())
{
- mDrawable->movePartition();
-
- //force a move if sitting on an active object
- if (getParent() && ((LLViewerObject*) getParent())->mDrawable->isActive())
- {
- gPipeline.markMoved(mDrawable, TRUE);
- }
+ mDrawable->movePartition();
+
+ //force a move if sitting on an active object
+ if (getParent() && ((LLViewerObject*) getParent())->mDrawable->isActive())
+ {
+ gPipeline.markMoved(mDrawable, TRUE);
+ }
}
}
void LLVOAvatar::idleUpdateAppearanceAnimation()
{
- // update morphing params
- if (mAppearanceAnimating)
- {
- ESex avatar_sex = getSex();
- F32 appearance_anim_time = mAppearanceMorphTimer.getElapsedTimeF32();
- if (appearance_anim_time >= APPEARANCE_MORPH_TIME)
- {
- mAppearanceAnimating = FALSE;
- for (LLVisualParam *param = getFirstVisualParam();
- param;
- param = getNextVisualParam())
- {
- if (param->isTweakable())
- {
- param->stopAnimating();
- }
- }
- updateVisualParams();
- }
- else
- {
- F32 morph_amt = calcMorphAmount();
- LLVisualParam *param;
-
- if (!isSelf())
- {
- // animate only top level params for non-self avatars
- for (param = getFirstVisualParam();
- param;
- param = getNextVisualParam())
- {
- if (param->isTweakable())
- {
- param->animate(morph_amt);
- }
- }
- }
-
- // apply all params
- for (param = getFirstVisualParam();
- param;
- param = getNextVisualParam())
- {
- param->apply(avatar_sex);
- }
-
- mLastAppearanceBlendTime = appearance_anim_time;
- }
- dirtyMesh();
- }
+ // update morphing params
+ if (mAppearanceAnimating)
+ {
+ ESex avatar_sex = getSex();
+ F32 appearance_anim_time = mAppearanceMorphTimer.getElapsedTimeF32();
+ if (appearance_anim_time >= APPEARANCE_MORPH_TIME)
+ {
+ mAppearanceAnimating = FALSE;
+ for (LLVisualParam *param = getFirstVisualParam();
+ param;
+ param = getNextVisualParam())
+ {
+ if (param->isTweakable())
+ {
+ param->stopAnimating();
+ }
+ }
+ updateVisualParams();
+ }
+ else
+ {
+ F32 morph_amt = calcMorphAmount();
+ LLVisualParam *param;
+
+ if (!isSelf())
+ {
+ // animate only top level params for non-self avatars
+ for (param = getFirstVisualParam();
+ param;
+ param = getNextVisualParam())
+ {
+ if (param->isTweakable())
+ {
+ param->animate(morph_amt);
+ }
+ }
+ }
+
+ // apply all params
+ for (param = getFirstVisualParam();
+ param;
+ param = getNextVisualParam())
+ {
+ param->apply(avatar_sex);
+ }
+
+ mLastAppearanceBlendTime = appearance_anim_time;
+ }
+ dirtyMesh();
+ }
}
F32 LLVOAvatar::calcMorphAmount()
{
- F32 appearance_anim_time = mAppearanceMorphTimer.getElapsedTimeF32();
- F32 blend_frac = calc_bouncy_animation(appearance_anim_time / APPEARANCE_MORPH_TIME);
- F32 last_blend_frac = calc_bouncy_animation(mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME);
+ F32 appearance_anim_time = mAppearanceMorphTimer.getElapsedTimeF32();
+ F32 blend_frac = calc_bouncy_animation(appearance_anim_time / APPEARANCE_MORPH_TIME);
+ F32 last_blend_frac = calc_bouncy_animation(mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME);
- F32 morph_amt;
- if (last_blend_frac == 1.f)
- {
- morph_amt = 1.f;
- }
- else
- {
- morph_amt = (blend_frac - last_blend_frac) / (1.f - last_blend_frac);
- }
+ F32 morph_amt;
+ if (last_blend_frac == 1.f)
+ {
+ morph_amt = 1.f;
+ }
+ else
+ {
+ morph_amt = (blend_frac - last_blend_frac) / (1.f - last_blend_frac);
+ }
- return morph_amt;
+ return morph_amt;
}
void LLVOAvatar::idleUpdateLipSync(bool voice_enabled)
{
- // Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
+ // Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
if ( voice_enabled
&& mLastRezzedStatus > 0 // no point updating lip-sync for clouds
&& (LLVoiceClient::getInstance()->lipSyncEnabled())
&& LLVoiceClient::getInstance()->getIsSpeaking( mID ) )
- {
- F32 ooh_morph_amount = 0.0f;
- F32 aah_morph_amount = 0.0f;
+ {
+ F32 ooh_morph_amount = 0.0f;
+ F32 aah_morph_amount = 0.0f;
- mVoiceVisualizer->lipSyncOohAah( ooh_morph_amount, aah_morph_amount );
+ mVoiceVisualizer->lipSyncOohAah( ooh_morph_amount, aah_morph_amount );
- if( mOohMorph )
- {
- F32 ooh_weight = mOohMorph->getMinWeight()
- + ooh_morph_amount * (mOohMorph->getMaxWeight() - mOohMorph->getMinWeight());
+ if( mOohMorph )
+ {
+ F32 ooh_weight = mOohMorph->getMinWeight()
+ + ooh_morph_amount * (mOohMorph->getMaxWeight() - mOohMorph->getMinWeight());
- mOohMorph->setWeight( ooh_weight);
- }
+ mOohMorph->setWeight( ooh_weight);
+ }
- if( mAahMorph )
- {
- F32 aah_weight = mAahMorph->getMinWeight()
- + aah_morph_amount * (mAahMorph->getMaxWeight() - mAahMorph->getMinWeight());
+ if( mAahMorph )
+ {
+ F32 aah_weight = mAahMorph->getMinWeight()
+ + aah_morph_amount * (mAahMorph->getMaxWeight() - mAahMorph->getMinWeight());
- mAahMorph->setWeight( aah_weight);
- }
+ mAahMorph->setWeight( aah_weight);
+ }
- mLipSyncActive = true;
- LLCharacter::updateVisualParams();
- dirtyMesh();
- }
+ mLipSyncActive = true;
+ LLCharacter::updateVisualParams();
+ dirtyMesh();
+ }
}
void LLVOAvatar::idleUpdateLoadingEffect()
{
- // update visibility when avatar is partially loaded
- if (updateIsFullyLoaded()) // changed?
- {
- if (isFullyLoaded())
- {
- if (mFirstFullyVisible)
- {
- mFirstFullyVisible = FALSE;
- if (isSelf())
- {
- LL_INFOS("Avatar") << avString() << "self isFullyLoaded, mFirstFullyVisible" << LL_ENDL;
- LLAppearanceMgr::instance().onFirstFullyVisible();
- }
- else
- {
- LL_INFOS("Avatar") << avString() << "other isFullyLoaded, mFirstFullyVisible" << LL_ENDL;
- }
- }
-
- deleteParticleSource();
- updateLOD();
- }
- else
- {
- LLPartSysData particle_parameters;
-
- // fancy particle cloud designed by Brent
- particle_parameters.mPartData.mMaxAge = 4.f;
- particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
- particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
- particle_parameters.mPartData.mStartScale.mV[VY] = 1.0f;
- particle_parameters.mPartData.mEndScale.mV[VX] = 0.02f;
- particle_parameters.mPartData.mEndScale.mV[VY] = 0.02f;
- particle_parameters.mPartData.mStartColor = LLColor4(1, 1, 1, 0.5f);
- particle_parameters.mPartData.mEndColor = LLColor4(1, 1, 1, 0.0f);
- particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
- particle_parameters.mPartImageID = sCloudTexture->getID();
- particle_parameters.mMaxAge = 0.f;
- particle_parameters.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE;
- particle_parameters.mInnerAngle = F_PI;
- particle_parameters.mOuterAngle = 0.f;
- particle_parameters.mBurstRate = 0.02f;
- particle_parameters.mBurstRadius = 0.0f;
- particle_parameters.mBurstPartCount = 1;
- particle_parameters.mBurstSpeedMin = 0.1f;
- particle_parameters.mBurstSpeedMax = 1.f;
- particle_parameters.mPartData.mFlags = ( LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK |
- LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK |
- LLPartData::LL_PART_TARGET_POS_MASK );
-
- // do not generate particles for dummy or overly-complex avatars
- if (!mIsDummy && !isTooComplex() && !isTooSlow())
- {
- setParticleSource(particle_parameters, getID());
- }
- }
- }
-}
+ // update visibility when avatar is partially loaded
+ if (updateIsFullyLoaded()) // changed?
+ {
+ if (isFullyLoaded())
+ {
+ if (mFirstFullyVisible)
+ {
+ mFirstFullyVisible = FALSE;
+ if (isSelf())
+ {
+ LL_INFOS("Avatar") << avString() << "self isFullyLoaded, mFirstFullyVisible" << LL_ENDL;
+ LLAppearanceMgr::instance().onFirstFullyVisible();
+ }
+ else
+ {
+ LL_INFOS("Avatar") << avString() << "other isFullyLoaded, mFirstFullyVisible" << LL_ENDL;
+ }
+ }
+
+ deleteParticleSource();
+ updateLOD();
+ }
+ else
+ {
+ LLPartSysData particle_parameters;
+
+ // fancy particle cloud designed by Brent
+ particle_parameters.mPartData.mMaxAge = 4.f;
+ particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
+ particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
+ particle_parameters.mPartData.mStartScale.mV[VY] = 1.0f;
+ particle_parameters.mPartData.mEndScale.mV[VX] = 0.02f;
+ particle_parameters.mPartData.mEndScale.mV[VY] = 0.02f;
+ particle_parameters.mPartData.mStartColor = LLColor4(1, 1, 1, 0.5f);
+ particle_parameters.mPartData.mEndColor = LLColor4(1, 1, 1, 0.0f);
+ particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
+ particle_parameters.mPartImageID = sCloudTexture->getID();
+ particle_parameters.mMaxAge = 0.f;
+ particle_parameters.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE;
+ particle_parameters.mInnerAngle = F_PI;
+ particle_parameters.mOuterAngle = 0.f;
+ particle_parameters.mBurstRate = 0.02f;
+ particle_parameters.mBurstRadius = 0.0f;
+ particle_parameters.mBurstPartCount = 1;
+ particle_parameters.mBurstSpeedMin = 0.1f;
+ particle_parameters.mBurstSpeedMax = 1.f;
+ particle_parameters.mPartData.mFlags = ( LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK |
+ LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK |
+ LLPartData::LL_PART_TARGET_POS_MASK );
+
+ // do not generate particles for dummy or overly-complex avatars
+ if (!mIsDummy && !isTooComplex() && !isTooSlow())
+ {
+ setParticleSource(particle_parameters, getID());
+ }
+ }
+ }
+}
void LLVOAvatar::idleUpdateWindEffect()
{
- // update wind effect
- if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH))
- {
- F32 hover_strength = 0.f;
- F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast;
- mRippleTimeLast = mRippleTimer.getElapsedTimeF32();
- LLVector3 velocity = getVelocity();
- F32 speed = velocity.length();
- //RN: velocity varies too much frame to frame for this to work
- mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLSmoothInterpolation::getInterpolant(0.02f));
- mLastVel = velocity;
- LLVector4 wind;
- wind.setVec(getRegion()->mWind.getVelocityNoisy(getPositionAgent(), 4.f) - velocity);
-
- if (mInAir)
- {
- hover_strength = HOVER_EFFECT_STRENGTH * llmax(0.f, HOVER_EFFECT_MAX_SPEED - speed);
- }
-
- if (mBelowWater)
- {
- // TODO: make cloth flow more gracefully when underwater
- hover_strength += UNDERWATER_EFFECT_STRENGTH;
- }
-
- wind.mV[VZ] += hover_strength;
- wind.normalize();
-
- wind.mV[VW] = llmin(0.025f + (speed * 0.015f) + hover_strength, 0.5f);
- F32 interp;
- if (wind.mV[VW] > mWindVec.mV[VW])
- {
- interp = LLSmoothInterpolation::getInterpolant(0.2f);
- }
- else
- {
- interp = LLSmoothInterpolation::getInterpolant(0.4f);
- }
- mWindVec = lerp(mWindVec, wind, interp);
-
- F32 wind_freq = hover_strength + llclamp(8.f + (speed * 0.7f) + (noise1(mRipplePhase) * 4.f), 8.f, 25.f);
- mWindFreq = lerp(mWindFreq, wind_freq, interp);
-
- if (mBelowWater)
- {
- mWindFreq *= UNDERWATER_FREQUENCY_DAMP;
- }
-
- mRipplePhase += (time_delta * mWindFreq);
- if (mRipplePhase > F_TWO_PI)
- {
- mRipplePhase = fmodf(mRipplePhase, F_TWO_PI);
- }
- }
+ // update wind effect
+ if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH))
+ {
+ F32 hover_strength = 0.f;
+ F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast;
+ mRippleTimeLast = mRippleTimer.getElapsedTimeF32();
+ LLVector3 velocity = getVelocity();
+ F32 speed = velocity.length();
+ //RN: velocity varies too much frame to frame for this to work
+ mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLSmoothInterpolation::getInterpolant(0.02f));
+ mLastVel = velocity;
+ LLVector4 wind;
+ wind.setVec(getRegion()->mWind.getVelocityNoisy(getPositionAgent(), 4.f) - velocity);
+
+ if (mInAir)
+ {
+ hover_strength = HOVER_EFFECT_STRENGTH * llmax(0.f, HOVER_EFFECT_MAX_SPEED - speed);
+ }
+
+ if (mBelowWater)
+ {
+ // TODO: make cloth flow more gracefully when underwater
+ hover_strength += UNDERWATER_EFFECT_STRENGTH;
+ }
+
+ wind.mV[VZ] += hover_strength;
+ wind.normalize();
+
+ wind.mV[VW] = llmin(0.025f + (speed * 0.015f) + hover_strength, 0.5f);
+ F32 interp;
+ if (wind.mV[VW] > mWindVec.mV[VW])
+ {
+ interp = LLSmoothInterpolation::getInterpolant(0.2f);
+ }
+ else
+ {
+ interp = LLSmoothInterpolation::getInterpolant(0.4f);
+ }
+ mWindVec = lerp(mWindVec, wind, interp);
+
+ F32 wind_freq = hover_strength + llclamp(8.f + (speed * 0.7f) + (noise1(mRipplePhase) * 4.f), 8.f, 25.f);
+ mWindFreq = lerp(mWindFreq, wind_freq, interp);
+
+ if (mBelowWater)
+ {
+ mWindFreq *= UNDERWATER_FREQUENCY_DAMP;
+ }
+
+ mRipplePhase += (time_delta * mWindFreq);
+ if (mRipplePhase > F_TWO_PI)
+ {
+ mRipplePhase = fmodf(mRipplePhase, F_TWO_PI);
+ }
+ }
}
void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- // update chat bubble
- //--------------------------------------------------------------------
- // draw text label over character's head
- //--------------------------------------------------------------------
- if (mChatTimer.getElapsedTimeF32() > BUBBLE_CHAT_TIME)
- {
- mChats.clear();
- }
-
- const F32 time_visible = mTimeVisible.getElapsedTimeF32();
+ // update chat bubble
+ //--------------------------------------------------------------------
+ // draw text label over character's head
+ //--------------------------------------------------------------------
+ if (mChatTimer.getElapsedTimeF32() > BUBBLE_CHAT_TIME)
+ {
+ mChats.clear();
+ }
+
+ const F32 time_visible = mTimeVisible.getElapsedTimeF32();
static LLCachedControl<F32> NAME_SHOW_TIME(gSavedSettings, "RenderNameShowTime"); // seconds
static LLCachedControl<F32> FADE_DURATION(gSavedSettings, "RenderNameFadeDuration"); // seconds
static LLCachedControl<bool> use_chat_bubbles(gSavedSettings, "UseChatBubbles");
- bool visible_chat = use_chat_bubbles && (mChats.size() || mTyping);
- bool render_name = visible_chat ||
- (((sRenderName == RENDER_NAME_ALWAYS) ||
- (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME)));
- // If it's your own avatar, don't draw in mouselook, and don't
- // draw if we're specifically hiding our own name.
- if (isSelf())
- {
+ bool visible_chat = use_chat_bubbles && (mChats.size() || mTyping);
+ bool render_name = visible_chat ||
+ (((sRenderName == RENDER_NAME_ALWAYS) ||
+ (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME)));
+ // If it's your own avatar, don't draw in mouselook, and don't
+ // draw if we're specifically hiding our own name.
+ if (isSelf())
+ {
static LLCachedControl<bool> render_name_show_self(gSavedSettings, "RenderNameShowSelf");
static LLCachedControl<S32> name_tag_mode(gSavedSettings, "AvatarNameTagMode");
- render_name = render_name
- && !gAgentCamera.cameraMouselook()
- && (visible_chat || (render_name_show_self && name_tag_mode));
- }
-
- if ( !render_name )
- {
- if (mNameText)
- {
- // ...clean up old name tag
- mNameText->markDead();
- mNameText = NULL;
- sNumVisibleChatBubbles--;
- }
- return;
- }
-
- bool new_name = FALSE;
- if (visible_chat != mVisibleChat)
- {
- mVisibleChat = visible_chat;
- new_name = TRUE;
- }
-
- if (sRenderGroupTitles != mRenderGroupTitles)
- {
- mRenderGroupTitles = sRenderGroupTitles;
- new_name = TRUE;
- }
-
- // First Calculate Alpha
- // If alpha > 0, create mNameText if necessary, otherwise delete it
- F32 alpha = 0.f;
- if (mAppAngle > 5.f)
- {
- const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION;
- if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME)
- {
- alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION;
- }
- else
- {
- // ...not fading, full alpha
- alpha = 1.f;
- }
- }
- else if (mAppAngle > 2.f)
- {
- // far away is faded out also
- alpha = (mAppAngle-2.f)/3.f;
- }
-
- if (alpha <= 0.f)
- {
- if (mNameText)
- {
- mNameText->markDead();
- mNameText = NULL;
- sNumVisibleChatBubbles--;
- }
- return;
- }
-
- if (!mNameText)
- {
- mNameText = static_cast<LLHUDNameTag*>( LLHUDObject::addHUDObject(
- LLHUDObject::LL_HUD_NAME_TAG) );
- //mNameText->setMass(10.f);
- mNameText->setSourceObject(this);
- mNameText->setVertAlignment(LLHUDNameTag::ALIGN_VERT_TOP);
- mNameText->setVisibleOffScreen(TRUE);
- mNameText->setMaxLines(11);
- mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f);
- sNumVisibleChatBubbles++;
- new_name = TRUE;
- }
-
+ render_name = render_name
+ && !gAgentCamera.cameraMouselook()
+ && (visible_chat || (render_name_show_self && name_tag_mode));
+ }
+
+ if ( !render_name )
+ {
+ if (mNameText)
+ {
+ // ...clean up old name tag
+ mNameText->markDead();
+ mNameText = NULL;
+ sNumVisibleChatBubbles--;
+ }
+ return;
+ }
+
+ bool new_name = FALSE;
+ if (visible_chat != mVisibleChat)
+ {
+ mVisibleChat = visible_chat;
+ new_name = TRUE;
+ }
+
+ if (sRenderGroupTitles != mRenderGroupTitles)
+ {
+ mRenderGroupTitles = sRenderGroupTitles;
+ new_name = TRUE;
+ }
+
+ // First Calculate Alpha
+ // If alpha > 0, create mNameText if necessary, otherwise delete it
+ F32 alpha = 0.f;
+ if (mAppAngle > 5.f)
+ {
+ const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION;
+ if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME)
+ {
+ alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION;
+ }
+ else
+ {
+ // ...not fading, full alpha
+ alpha = 1.f;
+ }
+ }
+ else if (mAppAngle > 2.f)
+ {
+ // far away is faded out also
+ alpha = (mAppAngle-2.f)/3.f;
+ }
+
+ if (alpha <= 0.f)
+ {
+ if (mNameText)
+ {
+ mNameText->markDead();
+ mNameText = NULL;
+ sNumVisibleChatBubbles--;
+ }
+ return;
+ }
+
+ if (!mNameText)
+ {
+ mNameText = static_cast<LLHUDNameTag*>( LLHUDObject::addHUDObject(
+ LLHUDObject::LL_HUD_NAME_TAG) );
+ //mNameText->setMass(10.f);
+ mNameText->setSourceObject(this);
+ mNameText->setVertAlignment(LLHUDNameTag::ALIGN_VERT_TOP);
+ mNameText->setVisibleOffScreen(TRUE);
+ mNameText->setMaxLines(11);
+ mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f);
+ sNumVisibleChatBubbles++;
+ new_name = TRUE;
+ }
+
mNameText->setPositionAgent(root_pos_last);
- idleUpdateNameTagText(new_name);
- idleUpdateNameTagAlpha(new_name, alpha);
+ idleUpdateNameTagText(new_name);
+ idleUpdateNameTagAlpha(new_name, alpha);
}
void LLVOAvatar::idleUpdateNameTagText(bool new_name)
{
- LLNameValue *title = getNVPair("Title");
- LLNameValue* firstname = getNVPair("FirstName");
- LLNameValue* lastname = getNVPair("LastName");
-
- // Avatars must have a first and last name
- if (!firstname || !lastname) return;
-
- bool is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end();
- bool is_do_not_disturb = mSignaledAnimations.find(ANIM_AGENT_DO_NOT_DISTURB) != mSignaledAnimations.end();
- bool is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end();
- bool is_muted;
- if (isSelf())
- {
- is_muted = false;
- }
- else
- {
- is_muted = isInMuteList();
- }
- bool is_friend = LLAvatarTracker::instance().isBuddy(getID());
- bool is_cloud = getIsCloud();
-
- if (is_appearance != mNameAppearance)
- {
- if (is_appearance)
- {
- debugAvatarRezTime("AvatarRezEnteredAppearanceNotification","entered appearance mode");
- }
- else
- {
- debugAvatarRezTime("AvatarRezLeftAppearanceNotification","left appearance mode");
- }
- }
-
- // Rebuild name tag if state change detected
- if (!mNameIsSet
- || new_name
- || (!title && !mTitle.empty())
- || (title && mTitle != title->getString())
- || is_away != mNameAway
- || is_do_not_disturb != mNameDoNotDisturb
- || is_muted != mNameMute
- || is_appearance != mNameAppearance
- || is_friend != mNameFriend
- || is_cloud != mNameCloud)
- {
- LLColor4 name_tag_color = getNameTagColor(is_friend);
-
- clearNameTag();
-
- if (is_away || is_muted || is_do_not_disturb || is_appearance)
- {
- std::string line;
- if (is_away)
- {
- line += LLTrans::getString("AvatarAway");
- line += ", ";
- }
- if (is_do_not_disturb)
- {
- line += LLTrans::getString("AvatarDoNotDisturb");
- line += ", ";
- }
- if (is_muted)
- {
- line += LLTrans::getString("AvatarMuted");
- line += ", ";
- }
- if (is_appearance)
- {
- line += LLTrans::getString("AvatarEditingAppearance");
- line += ", ";
- }
- if (is_cloud)
- {
- line += LLTrans::getString("LoadingData");
- line += ", ";
- }
- // trim last ", "
- line.resize( line.length() - 2 );
- addNameTagLine(line, name_tag_color, LLFontGL::NORMAL,
- LLFontGL::getFontSansSerifSmall());
- }
-
- if (sRenderGroupTitles
- && title && title->getString() && title->getString()[0] != '\0')
- {
- std::string title_str = title->getString();
- LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR);
- addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL,
- LLFontGL::getFontSansSerifSmall(), true);
- }
-
- static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames", true);
- static LLUICachedControl<bool> show_usernames("NameTagShowUsernames", true);
-
- if (LLAvatarName::useDisplayNames())
- {
- LLAvatarName av_name;
- if (!LLAvatarNameCache::get(getID(), &av_name))
- {
- // Force a rebuild at next idle
- // Note: do not connect a callback on idle().
- clearNameTag();
- }
-
- // Might be blank if name not available yet, that's OK
- if (show_display_names)
- {
- addNameTagLine(av_name.getDisplayName(), name_tag_color, LLFontGL::NORMAL,
- LLFontGL::getFontSansSerif(), true);
- }
- // Suppress SLID display if display name matches exactly (ugh)
- if (show_usernames && !av_name.isDisplayNameDefault())
- {
- // *HACK: Desaturate the color
- LLColor4 username_color = name_tag_color * 0.83f;
- addNameTagLine(av_name.getUserName(), username_color, LLFontGL::NORMAL,
- LLFontGL::getFontSansSerifSmall(), true);
- }
- }
- else
- {
- const LLFontGL* font = LLFontGL::getFontSansSerif();
- std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() );
- addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font, true);
- }
-
- mNameAway = is_away;
- mNameDoNotDisturb = is_do_not_disturb;
- mNameMute = is_muted;
- mNameAppearance = is_appearance;
- mNameFriend = is_friend;
- mNameCloud = is_cloud;
- mTitle = title ? title->getString() : "";
- LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR);
- new_name = TRUE;
- }
-
- if (mVisibleChat)
- {
- mNameText->setFont(LLFontGL::getFontSansSerif());
- mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT);
- mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f);
-
- std::deque<LLChat>::iterator chat_iter = mChats.begin();
- mNameText->clearString();
-
- LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" );
- LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f);
- LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f);
- if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES)
- {
- ++chat_iter;
- }
-
- for(; chat_iter != mChats.end(); ++chat_iter)
- {
- F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f);
- LLFontGL::StyleFlags style;
- switch(chat_iter->mChatType)
- {
- case CHAT_TYPE_WHISPER:
- style = LLFontGL::ITALIC;
- break;
- case CHAT_TYPE_SHOUT:
- style = LLFontGL::BOLD;
- break;
- default:
- style = LLFontGL::NORMAL;
- break;
- }
- if (chat_fade_amt < 1.f)
- {
- F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f);
- mNameText->addLine(chat_iter->mText, lerp(new_chat, normal_chat, u), style);
- }
- else if (chat_fade_amt < 2.f)
- {
- F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f);
- mNameText->addLine(chat_iter->mText, lerp(normal_chat, old_chat, u), style);
- }
- else if (chat_fade_amt < 3.f)
- {
- // *NOTE: only remove lines down to minimum number
- mNameText->addLine(chat_iter->mText, old_chat, style);
- }
- }
- mNameText->setVisibleOffScreen(TRUE);
-
- if (mTyping)
- {
- S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1;
- switch(dot_count)
- {
- case 1:
- mNameText->addLine(".", new_chat);
- break;
- case 2:
- mNameText->addLine("..", new_chat);
- break;
- case 3:
- mNameText->addLine("...", new_chat);
- break;
- }
-
- }
- }
- else
- {
- // ...not using chat bubbles, just names
- mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_CENTER);
- mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f);
- mNameText->setVisibleOffScreen(FALSE);
- }
+ LLNameValue *title = getNVPair("Title");
+ LLNameValue* firstname = getNVPair("FirstName");
+ LLNameValue* lastname = getNVPair("LastName");
+
+ // Avatars must have a first and last name
+ if (!firstname || !lastname) return;
+
+ bool is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end();
+ bool is_do_not_disturb = mSignaledAnimations.find(ANIM_AGENT_DO_NOT_DISTURB) != mSignaledAnimations.end();
+ bool is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end();
+ bool is_muted;
+ if (isSelf())
+ {
+ is_muted = false;
+ }
+ else
+ {
+ is_muted = isInMuteList();
+ }
+ bool is_friend = LLAvatarTracker::instance().isBuddy(getID());
+ bool is_cloud = getIsCloud();
+
+ if (is_appearance != mNameAppearance)
+ {
+ if (is_appearance)
+ {
+ debugAvatarRezTime("AvatarRezEnteredAppearanceNotification","entered appearance mode");
+ }
+ else
+ {
+ debugAvatarRezTime("AvatarRezLeftAppearanceNotification","left appearance mode");
+ }
+ }
+
+ // Rebuild name tag if state change detected
+ if (!mNameIsSet
+ || new_name
+ || (!title && !mTitle.empty())
+ || (title && mTitle != title->getString())
+ || is_away != mNameAway
+ || is_do_not_disturb != mNameDoNotDisturb
+ || is_muted != mNameMute
+ || is_appearance != mNameAppearance
+ || is_friend != mNameFriend
+ || is_cloud != mNameCloud)
+ {
+ LLColor4 name_tag_color = getNameTagColor(is_friend);
+
+ clearNameTag();
+
+ if (is_away || is_muted || is_do_not_disturb || is_appearance)
+ {
+ std::string line;
+ if (is_away)
+ {
+ line += LLTrans::getString("AvatarAway");
+ line += ", ";
+ }
+ if (is_do_not_disturb)
+ {
+ line += LLTrans::getString("AvatarDoNotDisturb");
+ line += ", ";
+ }
+ if (is_muted)
+ {
+ line += LLTrans::getString("AvatarMuted");
+ line += ", ";
+ }
+ if (is_appearance)
+ {
+ line += LLTrans::getString("AvatarEditingAppearance");
+ line += ", ";
+ }
+ if (is_cloud)
+ {
+ line += LLTrans::getString("LoadingData");
+ line += ", ";
+ }
+ // trim last ", "
+ line.resize( line.length() - 2 );
+ addNameTagLine(line, name_tag_color, LLFontGL::NORMAL,
+ LLFontGL::getFontSansSerifSmall());
+ }
+
+ if (sRenderGroupTitles
+ && title && title->getString() && title->getString()[0] != '\0')
+ {
+ std::string title_str = title->getString();
+ LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR);
+ addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL,
+ LLFontGL::getFontSansSerifSmall(), true);
+ }
+
+ static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames", true);
+ static LLUICachedControl<bool> show_usernames("NameTagShowUsernames", true);
+
+ if (LLAvatarName::useDisplayNames())
+ {
+ LLAvatarName av_name;
+ if (!LLAvatarNameCache::get(getID(), &av_name))
+ {
+ // Force a rebuild at next idle
+ // Note: do not connect a callback on idle().
+ clearNameTag();
+ }
+
+ // Might be blank if name not available yet, that's OK
+ if (show_display_names)
+ {
+ addNameTagLine(av_name.getDisplayName(), name_tag_color, LLFontGL::NORMAL,
+ LLFontGL::getFontSansSerif(), true);
+ }
+ // Suppress SLID display if display name matches exactly (ugh)
+ if (show_usernames && !av_name.isDisplayNameDefault())
+ {
+ // *HACK: Desaturate the color
+ LLColor4 username_color = name_tag_color * 0.83f;
+ addNameTagLine(av_name.getUserName(), username_color, LLFontGL::NORMAL,
+ LLFontGL::getFontSansSerifSmall(), true);
+ }
+ }
+ else
+ {
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
+ std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() );
+ addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font, true);
+ }
+
+ mNameAway = is_away;
+ mNameDoNotDisturb = is_do_not_disturb;
+ mNameMute = is_muted;
+ mNameAppearance = is_appearance;
+ mNameFriend = is_friend;
+ mNameCloud = is_cloud;
+ mTitle = title ? title->getString() : "";
+ LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR);
+ new_name = TRUE;
+ }
+
+ if (mVisibleChat)
+ {
+ mNameText->setFont(LLFontGL::getFontSansSerif());
+ mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT);
+ mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f);
+
+ std::deque<LLChat>::iterator chat_iter = mChats.begin();
+ mNameText->clearString();
+
+ LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" );
+ LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f);
+ LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f);
+ if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES)
+ {
+ ++chat_iter;
+ }
+
+ for(; chat_iter != mChats.end(); ++chat_iter)
+ {
+ F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f);
+ LLFontGL::StyleFlags style;
+ switch(chat_iter->mChatType)
+ {
+ case CHAT_TYPE_WHISPER:
+ style = LLFontGL::ITALIC;
+ break;
+ case CHAT_TYPE_SHOUT:
+ style = LLFontGL::BOLD;
+ break;
+ default:
+ style = LLFontGL::NORMAL;
+ break;
+ }
+ if (chat_fade_amt < 1.f)
+ {
+ F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f);
+ mNameText->addLine(chat_iter->mText, lerp(new_chat, normal_chat, u), style);
+ }
+ else if (chat_fade_amt < 2.f)
+ {
+ F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f);
+ mNameText->addLine(chat_iter->mText, lerp(normal_chat, old_chat, u), style);
+ }
+ else if (chat_fade_amt < 3.f)
+ {
+ // *NOTE: only remove lines down to minimum number
+ mNameText->addLine(chat_iter->mText, old_chat, style);
+ }
+ }
+ mNameText->setVisibleOffScreen(TRUE);
+
+ if (mTyping)
+ {
+ S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1;
+ switch(dot_count)
+ {
+ case 1:
+ mNameText->addLine(".", new_chat);
+ break;
+ case 2:
+ mNameText->addLine("..", new_chat);
+ break;
+ case 3:
+ mNameText->addLine("...", new_chat);
+ break;
+ }
+
+ }
+ }
+ else
+ {
+ // ...not using chat bubbles, just names
+ mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_CENTER);
+ mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f);
+ mNameText->setVisibleOffScreen(FALSE);
+ }
}
void LLVOAvatar::addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font, const bool use_ellipses)
{
// extra width (NAMETAG_MAX_WIDTH) is for names only, not for chat
- llassert(mNameText);
- if (mVisibleChat)
- {
- mNameText->addLabel(line, LLHUDNameTag::NAMETAG_MAX_WIDTH);
- }
- else
- {
- mNameText->addLine(line, color, (LLFontGL::StyleFlags)style, font, use_ellipses, LLHUDNameTag::NAMETAG_MAX_WIDTH);
- }
+ llassert(mNameText);
+ if (mVisibleChat)
+ {
+ mNameText->addLabel(line, LLHUDNameTag::NAMETAG_MAX_WIDTH);
+ }
+ else
+ {
+ mNameText->addLine(line, color, (LLFontGL::StyleFlags)style, font, use_ellipses, LLHUDNameTag::NAMETAG_MAX_WIDTH);
+ }
mNameIsSet |= !line.empty();
}
void LLVOAvatar::clearNameTag()
{
mNameIsSet = false;
- if (mNameText)
- {
- mNameText->setLabel("");
- mNameText->setString("");
- }
- mTimeVisible.reset();
+ if (mNameText)
+ {
+ mNameText->setLabel("");
+ mNameText->setString("");
+ }
+ mTimeVisible.reset();
}
//static
void LLVOAvatar::invalidateNameTag(const LLUUID& agent_id)
{
- LLViewerObject* obj = gObjectList.findObject(agent_id);
- if (!obj) return;
+ LLViewerObject* obj = gObjectList.findObject(agent_id);
+ if (!obj) return;
- LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(obj);
- if (!avatar) return;
+ LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(obj);
+ if (!avatar) return;
- avatar->clearNameTag();
+ avatar->clearNameTag();
}
//static
void LLVOAvatar::invalidateNameTags()
{
- std::vector<LLCharacter*>::iterator it = LLCharacter::sInstances.begin();
- for ( ; it != LLCharacter::sInstances.end(); ++it)
- {
- LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*it);
- if (!avatar) continue;
- if (avatar->isDead()) continue;
+ std::vector<LLCharacter*>::iterator it = LLCharacter::sInstances.begin();
+ for ( ; it != LLCharacter::sInstances.end(); ++it)
+ {
+ LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*it);
+ if (!avatar) continue;
+ if (avatar->isDead()) continue;
- avatar->clearNameTag();
- }
+ avatar->clearNameTag();
+ }
}
// Compute name tag position during idle update
LLVector3 LLVOAvatar::idleCalcNameTagPosition(const LLVector3 &root_pos_last)
{
- LLQuaternion root_rot = mRoot->getWorldRotation();
- LLQuaternion inv_root_rot = ~root_rot;
- LLVector3 pixel_right_vec;
- LLVector3 pixel_up_vec;
- LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec);
- LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin();
- camera_to_av.normalize();
- LLVector3 local_camera_at = camera_to_av * inv_root_rot;
- LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis();
- local_camera_up.normalize();
- local_camera_up = local_camera_up * inv_root_rot;
-
- // position is based on head position, does not require mAvatarOffset here. - Nyx
- LLVector3 avatar_ellipsoid(mBodySize.mV[VX] * 0.4f,
- mBodySize.mV[VY] * 0.4f,
- mBodySize.mV[VZ] * NAMETAG_VERT_OFFSET_WEIGHT);
-
- local_camera_up.scaleVec(avatar_ellipsoid);
- local_camera_at.scaleVec(avatar_ellipsoid);
-
- LLVector3 head_offset = (mHeadp->getLastWorldPosition() - mRoot->getLastWorldPosition()) * inv_root_rot;
-
- if (dist_vec(head_offset, mTargetRootToHeadOffset) > NAMETAG_UPDATE_THRESHOLD)
- {
- mTargetRootToHeadOffset = head_offset;
- }
-
- mCurRootToHeadOffset = lerp(mCurRootToHeadOffset, mTargetRootToHeadOffset, LLSmoothInterpolation::getInterpolant(0.2f));
-
- LLVector3 name_position = mRoot->getLastWorldPosition() + (mCurRootToHeadOffset * root_rot);
- name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av));
- name_position += pixel_up_vec * NAMETAG_VERTICAL_SCREEN_OFFSET;
-
- const F32 water_height = getRegion()->getWaterHeight();
- static const F32 WATER_HEIGHT_DELTA = 0.25f;
- if (name_position[VZ] < water_height + WATER_HEIGHT_DELTA)
- {
- if (LLViewerCamera::getInstance()->getOrigin()[VZ] >= water_height)
- {
- name_position[VZ] = water_height;
- }
- else if (mNameText) // both camera and HUD are below watermark
- {
- F32 name_world_height = mNameText->getWorldHeight();
- F32 max_z_position = water_height - name_world_height;
- if (name_position[VZ] > max_z_position)
- {
- name_position[VZ] = max_z_position;
- }
- }
- }
-
- return name_position;
+ LLQuaternion root_rot = mRoot->getWorldRotation();
+ LLQuaternion inv_root_rot = ~root_rot;
+ LLVector3 pixel_right_vec;
+ LLVector3 pixel_up_vec;
+ LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec);
+ LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin();
+ camera_to_av.normalize();
+ LLVector3 local_camera_at = camera_to_av * inv_root_rot;
+ LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis();
+ local_camera_up.normalize();
+ local_camera_up = local_camera_up * inv_root_rot;
+
+ // position is based on head position, does not require mAvatarOffset here. - Nyx
+ LLVector3 avatar_ellipsoid(mBodySize.mV[VX] * 0.4f,
+ mBodySize.mV[VY] * 0.4f,
+ mBodySize.mV[VZ] * NAMETAG_VERT_OFFSET_WEIGHT);
+
+ local_camera_up.scaleVec(avatar_ellipsoid);
+ local_camera_at.scaleVec(avatar_ellipsoid);
+
+ LLVector3 head_offset = (mHeadp->getLastWorldPosition() - mRoot->getLastWorldPosition()) * inv_root_rot;
+
+ if (dist_vec(head_offset, mTargetRootToHeadOffset) > NAMETAG_UPDATE_THRESHOLD)
+ {
+ mTargetRootToHeadOffset = head_offset;
+ }
+
+ mCurRootToHeadOffset = lerp(mCurRootToHeadOffset, mTargetRootToHeadOffset, LLSmoothInterpolation::getInterpolant(0.2f));
+
+ LLVector3 name_position = mRoot->getLastWorldPosition() + (mCurRootToHeadOffset * root_rot);
+ name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av));
+ name_position += pixel_up_vec * NAMETAG_VERTICAL_SCREEN_OFFSET;
+
+ const F32 water_height = getRegion()->getWaterHeight();
+ static const F32 WATER_HEIGHT_DELTA = 0.25f;
+ if (name_position[VZ] < water_height + WATER_HEIGHT_DELTA)
+ {
+ if (LLViewerCamera::getInstance()->getOrigin()[VZ] >= water_height)
+ {
+ name_position[VZ] = water_height;
+ }
+ else if (mNameText) // both camera and HUD are below watermark
+ {
+ F32 name_world_height = mNameText->getWorldHeight();
+ F32 max_z_position = water_height - name_world_height;
+ if (name_position[VZ] > max_z_position)
+ {
+ name_position[VZ] = max_z_position;
+ }
+ }
+ }
+
+ return name_position;
}
void LLVOAvatar::idleUpdateNameTagAlpha(bool new_name, F32 alpha)
{
- llassert(mNameText);
+ llassert(mNameText);
- if (new_name
- || alpha != mNameAlpha)
- {
- mNameText->setAlpha(alpha);
- mNameAlpha = alpha;
- }
+ if (new_name
+ || alpha != mNameAlpha)
+ {
+ mNameText->setAlpha(alpha);
+ mNameAlpha = alpha;
+ }
}
LLColor4 LLVOAvatar::getNameTagColor(bool is_friend)
{
- static LLUICachedControl<bool> show_friends("NameTagShowFriends", false);
- const char* color_name;
- if (show_friends && is_friend)
- {
- color_name = "NameTagFriend";
- }
- else if (LLAvatarName::useDisplayNames())
- {
- // ...color based on whether username "matches" a computed display name
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(getID(), &av_name) && av_name.isDisplayNameDefault())
- {
- color_name = "NameTagMatch";
- }
- else
- {
- color_name = "NameTagMismatch";
- }
- }
- else
- {
- // ...not using display names
- color_name = "NameTagLegacy";
- }
- return LLUIColorTable::getInstance()->getColor( color_name );
+ static LLUICachedControl<bool> show_friends("NameTagShowFriends", false);
+ const char* color_name;
+ if (show_friends && is_friend)
+ {
+ color_name = "NameTagFriend";
+ }
+ else if (LLAvatarName::useDisplayNames())
+ {
+ // ...color based on whether username "matches" a computed display name
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(getID(), &av_name) && av_name.isDisplayNameDefault())
+ {
+ color_name = "NameTagMatch";
+ }
+ else
+ {
+ color_name = "NameTagMismatch";
+ }
+ }
+ else
+ {
+ // ...not using display names
+ color_name = "NameTagLegacy";
+ }
+ return LLUIColorTable::getInstance()->getColor( color_name );
}
void LLVOAvatar::idleUpdateBelowWater()
{
- F32 avatar_height = (F32)(getPositionGlobal().mdV[VZ]);
+ F32 avatar_height = (F32)(getPositionGlobal().mdV[VZ]);
- F32 water_height;
- water_height = getRegion()->getWaterHeight();
+ F32 water_height;
+ water_height = getRegion()->getWaterHeight();
- mBelowWater = avatar_height < water_height;
+ mBelowWater = avatar_height < water_height;
}
void LLVOAvatar::slamPosition()
{
- gAgent.setPositionAgent(getPositionAgent());
- // SL-315
- mRoot->setWorldPosition(getPositionAgent()); // teleport
- setChanged(TRANSLATED);
- if (mDrawable.notNull())
- {
- gPipeline.updateMoveNormalAsync(mDrawable);
- }
- mRoot->updateWorldMatrixChildren();
+ gAgent.setPositionAgent(getPositionAgent());
+ // SL-315
+ mRoot->setWorldPosition(getPositionAgent()); // teleport
+ setChanged(TRANSLATED);
+ if (mDrawable.notNull())
+ {
+ gPipeline.updateMoveNormalAsync(mDrawable);
+ }
+ mRoot->updateWorldMatrixChildren();
}
bool LLVOAvatar::isVisuallyMuted()
{
- bool muted = false;
-
- // Priority order (highest priority first)
- // * own avatar is never visually muted
- // * if on the "always draw normally" list, draw them normally
- // * if on the "always visually mute" list, mute them
- // * check against the render cost and attachment limits
- if (!isSelf())
- {
- if (mVisuallyMuteSetting == AV_ALWAYS_RENDER)
- {
- muted = false;
- }
- else if (mVisuallyMuteSetting == AV_DO_NOT_RENDER)
- {
+ bool muted = false;
+
+ // Priority order (highest priority first)
+ // * own avatar is never visually muted
+ // * if on the "always draw normally" list, draw them normally
+ // * if on the "always visually mute" list, mute them
+ // * check against the render cost and attachment limits
+ if (!isSelf())
+ {
+ if (mVisuallyMuteSetting == AV_ALWAYS_RENDER)
+ {
+ muted = false;
+ }
+ else if (mVisuallyMuteSetting == AV_DO_NOT_RENDER)
+ {
#ifdef JELLYDOLLS_SHOULD_IMPOSTOR
- muted = true;
- // Always want to see this AV as an impostor
+ muted = true;
+ // Always want to see this AV as an impostor
#else
- muted = false;
+ muted = false;
#endif
- }
+ }
else if (isInMuteList())
{
muted = true;
@@ -3743,89 +3743,89 @@ bool LLVOAvatar::isVisuallyMuted()
{
muted = isTooSlow();
}
- else
- {
- muted = isTooComplex() || isTooSlow();
- }
- }
+ else
+ {
+ muted = isTooComplex() || isTooSlow();
+ }
+ }
- return muted;
+ return muted;
}
bool LLVOAvatar::isInMuteList() const
{
- bool muted = false;
- F64 now = LLFrameTimer::getTotalSeconds();
- if (now < mCachedMuteListUpdateTime)
- {
- muted = mCachedInMuteList;
- }
- else
- {
- muted = LLMuteList::getInstance()->isMuted(getID());
+ bool muted = false;
+ F64 now = LLFrameTimer::getTotalSeconds();
+ if (now < mCachedMuteListUpdateTime)
+ {
+ muted = mCachedInMuteList;
+ }
+ else
+ {
+ muted = LLMuteList::getInstance()->isMuted(getID());
- const F64 SECONDS_BETWEEN_MUTE_UPDATES = 1;
- mCachedMuteListUpdateTime = now + SECONDS_BETWEEN_MUTE_UPDATES;
- mCachedInMuteList = muted;
- }
- return muted;
+ const F64 SECONDS_BETWEEN_MUTE_UPDATES = 1;
+ mCachedMuteListUpdateTime = now + SECONDS_BETWEEN_MUTE_UPDATES;
+ mCachedInMuteList = muted;
+ }
+ return muted;
}
void LLVOAvatar::updateAppearanceMessageDebugText()
{
- S32 central_bake_version = -1;
- if (getRegion())
- {
- central_bake_version = getRegion()->getCentralBakeVersion();
- }
- bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded();
- bool all_local_downloaded = allLocalTexturesCompletelyDownloaded();
- std::string debug_line = llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d",
- isSelf() ? (all_local_downloaded ? "L" : "l") : "-",
- all_baked_downloaded ? "B" : "b",
- mUseLocalAppearance, mIsEditingAppearance,
- 1, central_bake_version);
- std::string origin_string = bakedTextureOriginInfo();
- debug_line += " [" + origin_string + "]";
- S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion();
- S32 last_request_cof_version = mLastUpdateRequestCOFVersion;
- S32 last_received_cof_version = mLastUpdateReceivedCOFVersion;
- if (isSelf())
- {
- debug_line += llformat(" - cof: %d req: %d rcv:%d",
- curr_cof_version, last_request_cof_version, last_received_cof_version);
- static LLCachedControl<bool> debug_force_failure(gSavedSettings, "DebugForceAppearanceRequestFailure");
- if (debug_force_failure)
- {
- debug_line += " FORCING ERRS";
- }
- }
- else
- {
- debug_line += llformat(" - cof rcv:%d", last_received_cof_version);
- }
- debug_line += llformat(" bsz-z: %.3f", mBodySize[2]);
+ S32 central_bake_version = -1;
+ if (getRegion())
+ {
+ central_bake_version = getRegion()->getCentralBakeVersion();
+ }
+ bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded();
+ bool all_local_downloaded = allLocalTexturesCompletelyDownloaded();
+ std::string debug_line = llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d",
+ isSelf() ? (all_local_downloaded ? "L" : "l") : "-",
+ all_baked_downloaded ? "B" : "b",
+ mUseLocalAppearance, mIsEditingAppearance,
+ 1, central_bake_version);
+ std::string origin_string = bakedTextureOriginInfo();
+ debug_line += " [" + origin_string + "]";
+ S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion();
+ S32 last_request_cof_version = mLastUpdateRequestCOFVersion;
+ S32 last_received_cof_version = mLastUpdateReceivedCOFVersion;
+ if (isSelf())
+ {
+ debug_line += llformat(" - cof: %d req: %d rcv:%d",
+ curr_cof_version, last_request_cof_version, last_received_cof_version);
+ static LLCachedControl<bool> debug_force_failure(gSavedSettings, "DebugForceAppearanceRequestFailure");
+ if (debug_force_failure)
+ {
+ debug_line += " FORCING ERRS";
+ }
+ }
+ else
+ {
+ debug_line += llformat(" - cof rcv:%d", last_received_cof_version);
+ }
+ debug_line += llformat(" bsz-z: %.3f", mBodySize[2]);
if (mAvatarOffset[2] != 0.0f)
{
debug_line += llformat("avofs-z: %.3f", mAvatarOffset[2]);
}
- bool hover_enabled = getRegion() && getRegion()->avatarHoverHeightEnabled();
- debug_line += hover_enabled ? " H" : " h";
- const LLVector3& hover_offset = getHoverOffset();
- if (hover_offset[2] != 0.0)
- {
- debug_line += llformat(" hov_z: %.3f", hover_offset[2]);
- debug_line += llformat(" %s", (isSitting() ? "S" : "T"));
- debug_line += llformat("%s", (isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED) ? "G" : "-"));
- }
- if (mInAir)
- {
- debug_line += " A";
-
- }
+ bool hover_enabled = getRegion() && getRegion()->avatarHoverHeightEnabled();
+ debug_line += hover_enabled ? " H" : " h";
+ const LLVector3& hover_offset = getHoverOffset();
+ if (hover_offset[2] != 0.0)
+ {
+ debug_line += llformat(" hov_z: %.3f", hover_offset[2]);
+ debug_line += llformat(" %s", (isSitting() ? "S" : "T"));
+ debug_line += llformat("%s", (isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED) ? "G" : "-"));
+ }
+ if (mInAir)
+ {
+ debug_line += " A";
+
+ }
LLVector3 ankle_right_pos_agent = mFootRightp->getWorldPosition();
- LLVector3 normal;
+ LLVector3 normal;
LLVector3 ankle_right_ground_agent = ankle_right_pos_agent;
resolveHeightAgent(ankle_right_pos_agent, ankle_right_ground_agent, normal);
F32 rightElev = llmax(-0.2f, ankle_right_pos_agent.mV[VZ] - ankle_right_ground_agent.mV[VZ]);
@@ -3835,40 +3835,40 @@ void LLVOAvatar::updateAppearanceMessageDebugText()
LLVector3 pelvis_pos = mPelvisp->getPosition();
debug_line += llformat(" rp %.3f pp %.3f", root_pos[2], pelvis_pos[2]);
- const LLVector3& scale = getScale();
- debug_line += llformat(" scale-z %.3f", scale[2]);
- S32 is_visible = (S32) isVisible();
- S32 is_m_visible = (S32) mVisible;
- debug_line += llformat(" v %d/%d", is_visible, is_m_visible);
-
- AvatarOverallAppearance aoa = getOverallAppearance();
- if (aoa == AOA_NORMAL)
- {
- debug_line += " N";
- }
- else if (aoa == AOA_JELLYDOLL)
- {
- debug_line += " J";
- }
- else
- {
- debug_line += " I";
- }
-
- if (mMeshValid)
- {
- debug_line += "m";
- }
- else
- {
- debug_line += "-";
- }
- if (isImpostor())
- {
- debug_line += " Imp" + llformat("%d[%d]:%.1f", mUpdatePeriod, mLastImpostorUpdateReason, ((F32)(gFrameTimeSeconds-mLastImpostorUpdateFrameTime)));
- }
-
- addDebugText(debug_line);
+ const LLVector3& scale = getScale();
+ debug_line += llformat(" scale-z %.3f", scale[2]);
+ S32 is_visible = (S32) isVisible();
+ S32 is_m_visible = (S32) mVisible;
+ debug_line += llformat(" v %d/%d", is_visible, is_m_visible);
+
+ AvatarOverallAppearance aoa = getOverallAppearance();
+ if (aoa == AOA_NORMAL)
+ {
+ debug_line += " N";
+ }
+ else if (aoa == AOA_JELLYDOLL)
+ {
+ debug_line += " J";
+ }
+ else
+ {
+ debug_line += " I";
+ }
+
+ if (mMeshValid)
+ {
+ debug_line += "m";
+ }
+ else
+ {
+ debug_line += "-";
+ }
+ if (isImpostor())
+ {
+ debug_line += " Imp" + llformat("%d[%d]:%.1f", mUpdatePeriod, mLastImpostorUpdateReason, ((F32)(gFrameTimeSeconds-mLastImpostorUpdateFrameTime)));
+ }
+
+ addDebugText(debug_line);
}
LLViewerInventoryItem* getObjectInventoryItem(LLViewerObject *vobj, LLUUID asset_id)
@@ -3879,8 +3879,8 @@ LLViewerInventoryItem* getObjectInventoryItem(LLViewerObject *vobj, LLUUID asset
{
if (vobj->getInventorySerial()<=0)
{
- vobj->requestInventory();
- }
+ vobj->requestInventory();
+ }
item = vobj->getInventoryItemByAsset(asset_id);
}
return item;
@@ -3898,23 +3898,23 @@ LLViewerInventoryItem* recursiveGetObjectInventoryItem(LLViewerObject *vobj, LLU
LLViewerObject *childp = *it;
item = getObjectInventoryItem(childp, asset_id);
if (item)
- {
+ {
break;
}
}
- }
+ }
return item;
}
void LLVOAvatar::updateAnimationDebugText()
{
- for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin();
- iter != mMotionController.getActiveMotions().end(); ++iter)
- {
- LLMotion* motionp = *iter;
- if (motionp->getMinPixelArea() < getPixelArea())
- {
- std::string output;
+ for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin();
+ iter != mMotionController.getActiveMotions().end(); ++iter)
+ {
+ LLMotion* motionp = *iter;
+ if (motionp->getMinPixelArea() < getPixelArea())
+ {
+ std::string output;
std::string motion_name = motionp->getName();
if (motion_name.empty())
{
@@ -3931,107 +3931,107 @@ void LLVOAvatar::updateAnimationDebugText()
}
}
if (motion_name.empty())
- {
- std::string name;
- if (gAgent.isGodlikeWithoutAdminMenuFakery() || isSelf())
- {
- name = motionp->getID().asString();
- LLVOAvatar::AnimSourceIterator anim_it = mAnimationSources.begin();
- for (; anim_it != mAnimationSources.end(); ++anim_it)
- {
- if (anim_it->second == motionp->getID())
- {
- LLViewerObject* object = gObjectList.findObject(anim_it->first);
- if (!object)
- {
- break;
- }
- if (object->isAvatar())
- {
- if (mMotionController.mIsSelf)
- {
- // Searching inventory by asset id is really long
- // so just mark as inventory
- // Also item is likely to be named by LLPreviewAnim
- name += "(inventory)";
- }
- }
- else
- {
- LLViewerInventoryItem* item = NULL;
- if (!object->isInventoryDirty())
- {
- item = object->getInventoryItemByAsset(motionp->getID());
- }
- if (item)
- {
- name = item->getName();
- }
- else if (object->isAttachment())
- {
- name += "(att:" + getAttachmentItemName() + ")";
- }
- else
- {
- // in-world object, name or content unknown
- name += "(in-world)";
- }
- }
- break;
- }
- }
- }
- else
- {
- name = LLUUID::null.asString();
- }
- motion_name = name;
- }
- std::string motion_tag = "";
- if (mPlayingAnimations.find(motionp->getID()) != mPlayingAnimations.end())
- {
- motion_tag = "*";
- }
- output = llformat("%s%s - %d",
- motion_name.c_str(),
- motion_tag.c_str(),
- (U32)motionp->getPriority());
- addDebugText(output);
- }
- }
+ {
+ std::string name;
+ if (gAgent.isGodlikeWithoutAdminMenuFakery() || isSelf())
+ {
+ name = motionp->getID().asString();
+ LLVOAvatar::AnimSourceIterator anim_it = mAnimationSources.begin();
+ for (; anim_it != mAnimationSources.end(); ++anim_it)
+ {
+ if (anim_it->second == motionp->getID())
+ {
+ LLViewerObject* object = gObjectList.findObject(anim_it->first);
+ if (!object)
+ {
+ break;
+ }
+ if (object->isAvatar())
+ {
+ if (mMotionController.mIsSelf)
+ {
+ // Searching inventory by asset id is really long
+ // so just mark as inventory
+ // Also item is likely to be named by LLPreviewAnim
+ name += "(inventory)";
+ }
+ }
+ else
+ {
+ LLViewerInventoryItem* item = NULL;
+ if (!object->isInventoryDirty())
+ {
+ item = object->getInventoryItemByAsset(motionp->getID());
+ }
+ if (item)
+ {
+ name = item->getName();
+ }
+ else if (object->isAttachment())
+ {
+ name += "(att:" + getAttachmentItemName() + ")";
+ }
+ else
+ {
+ // in-world object, name or content unknown
+ name += "(in-world)";
+ }
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ name = LLUUID::null.asString();
+ }
+ motion_name = name;
+ }
+ std::string motion_tag = "";
+ if (mPlayingAnimations.find(motionp->getID()) != mPlayingAnimations.end())
+ {
+ motion_tag = "*";
+ }
+ output = llformat("%s%s - %d",
+ motion_name.c_str(),
+ motion_tag.c_str(),
+ (U32)motionp->getPriority());
+ addDebugText(output);
+ }
+ }
}
void LLVOAvatar::updateDebugText()
{
// Leave mDebugText uncleared here, in case a derived class has added some state first
- if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
- {
+ if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
+ {
updateAppearanceMessageDebugText();
- }
+ }
- if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked"))
- {
- if (!mBakedTextureDebugText.empty())
- addDebugText(mBakedTextureDebugText);
- }
+ if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked"))
+ {
+ if (!mBakedTextureDebugText.empty())
+ addDebugText(mBakedTextureDebugText);
+ }
// Develop -> Avatar -> Animation Info
- if (LLVOAvatar::sShowAnimationDebug)
- {
+ if (LLVOAvatar::sShowAnimationDebug)
+ {
updateAnimationDebugText();
- }
+ }
- if (!mDebugText.size() && mText.notNull())
- {
- mText->markDead();
- mText = NULL;
- }
- else if (mDebugText.size())
- {
- setDebugText(mDebugText);
- }
- mDebugText.clear();
+ if (!mDebugText.size() && mText.notNull())
+ {
+ mText->markDead();
+ mText = NULL;
+ }
+ else if (mDebugText.size())
+ {
+ setDebugText(mDebugText);
+ }
+ mDebugText.clear();
}
//------------------------------------------------------------------------
@@ -4045,82 +4045,82 @@ void LLVOAvatar::updateFootstepSounds()
{
return;
}
-
- //-------------------------------------------------------------------------
- // Find the ground under each foot, these are used for a variety
- // of things that follow
- //-------------------------------------------------------------------------
- LLVector3 ankle_left_pos_agent = mFootLeftp->getWorldPosition();
- LLVector3 ankle_right_pos_agent = mFootRightp->getWorldPosition();
- LLVector3 ankle_left_ground_agent = ankle_left_pos_agent;
- LLVector3 ankle_right_ground_agent = ankle_right_pos_agent;
+ //-------------------------------------------------------------------------
+ // Find the ground under each foot, these are used for a variety
+ // of things that follow
+ //-------------------------------------------------------------------------
+ LLVector3 ankle_left_pos_agent = mFootLeftp->getWorldPosition();
+ LLVector3 ankle_right_pos_agent = mFootRightp->getWorldPosition();
+
+ LLVector3 ankle_left_ground_agent = ankle_left_pos_agent;
+ LLVector3 ankle_right_ground_agent = ankle_right_pos_agent;
LLVector3 normal;
- resolveHeightAgent(ankle_left_pos_agent, ankle_left_ground_agent, normal);
- resolveHeightAgent(ankle_right_pos_agent, ankle_right_ground_agent, normal);
-
- F32 leftElev = llmax(-0.2f, ankle_left_pos_agent.mV[VZ] - ankle_left_ground_agent.mV[VZ]);
- F32 rightElev = llmax(-0.2f, ankle_right_pos_agent.mV[VZ] - ankle_right_ground_agent.mV[VZ]);
-
- if (!isSitting())
- {
- //-------------------------------------------------------------------------
- // Figure out which foot is on ground
- //-------------------------------------------------------------------------
- if (!mInAir)
- {
- if ((leftElev < 0.0f) || (rightElev < 0.0f))
- {
- ankle_left_pos_agent = mFootLeftp->getWorldPosition();
- ankle_right_pos_agent = mFootRightp->getWorldPosition();
- leftElev = ankle_left_pos_agent.mV[VZ] - ankle_left_ground_agent.mV[VZ];
- rightElev = ankle_right_pos_agent.mV[VZ] - ankle_right_ground_agent.mV[VZ];
- }
- }
- }
-
- const LLUUID AGENT_FOOTSTEP_ANIMS[] = {ANIM_AGENT_WALK, ANIM_AGENT_RUN, ANIM_AGENT_LAND};
- const S32 NUM_AGENT_FOOTSTEP_ANIMS = LL_ARRAY_SIZE(AGENT_FOOTSTEP_ANIMS);
-
- if ( gAudiop && isAnyAnimationSignaled(AGENT_FOOTSTEP_ANIMS, NUM_AGENT_FOOTSTEP_ANIMS) )
- {
- BOOL playSound = FALSE;
- LLVector3 foot_pos_agent;
-
- BOOL onGroundLeft = (leftElev <= 0.05f);
- BOOL onGroundRight = (rightElev <= 0.05f);
-
- // did left foot hit the ground?
- if ( onGroundLeft && !mWasOnGroundLeft )
- {
- foot_pos_agent = ankle_left_pos_agent;
- playSound = TRUE;
- }
-
- // did right foot hit the ground?
- if ( onGroundRight && !mWasOnGroundRight )
- {
- foot_pos_agent = ankle_right_pos_agent;
- playSound = TRUE;
- }
-
- mWasOnGroundLeft = onGroundLeft;
- mWasOnGroundRight = onGroundRight;
-
- if ( playSound )
- {
- const F32 STEP_VOLUME = 0.1f;
- const LLUUID& step_sound_id = getStepSound();
-
- LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent);
-
- if (LLViewerParcelMgr::getInstance()->canHearSound(foot_pos_global)
- && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds))
- {
- gAudiop->triggerSound(step_sound_id, getID(), STEP_VOLUME, LLAudioEngine::AUDIO_TYPE_AMBIENT, foot_pos_global);
- }
- }
- }
+ resolveHeightAgent(ankle_left_pos_agent, ankle_left_ground_agent, normal);
+ resolveHeightAgent(ankle_right_pos_agent, ankle_right_ground_agent, normal);
+
+ F32 leftElev = llmax(-0.2f, ankle_left_pos_agent.mV[VZ] - ankle_left_ground_agent.mV[VZ]);
+ F32 rightElev = llmax(-0.2f, ankle_right_pos_agent.mV[VZ] - ankle_right_ground_agent.mV[VZ]);
+
+ if (!isSitting())
+ {
+ //-------------------------------------------------------------------------
+ // Figure out which foot is on ground
+ //-------------------------------------------------------------------------
+ if (!mInAir)
+ {
+ if ((leftElev < 0.0f) || (rightElev < 0.0f))
+ {
+ ankle_left_pos_agent = mFootLeftp->getWorldPosition();
+ ankle_right_pos_agent = mFootRightp->getWorldPosition();
+ leftElev = ankle_left_pos_agent.mV[VZ] - ankle_left_ground_agent.mV[VZ];
+ rightElev = ankle_right_pos_agent.mV[VZ] - ankle_right_ground_agent.mV[VZ];
+ }
+ }
+ }
+
+ const LLUUID AGENT_FOOTSTEP_ANIMS[] = {ANIM_AGENT_WALK, ANIM_AGENT_RUN, ANIM_AGENT_LAND};
+ const S32 NUM_AGENT_FOOTSTEP_ANIMS = LL_ARRAY_SIZE(AGENT_FOOTSTEP_ANIMS);
+
+ if ( gAudiop && isAnyAnimationSignaled(AGENT_FOOTSTEP_ANIMS, NUM_AGENT_FOOTSTEP_ANIMS) )
+ {
+ BOOL playSound = FALSE;
+ LLVector3 foot_pos_agent;
+
+ BOOL onGroundLeft = (leftElev <= 0.05f);
+ BOOL onGroundRight = (rightElev <= 0.05f);
+
+ // did left foot hit the ground?
+ if ( onGroundLeft && !mWasOnGroundLeft )
+ {
+ foot_pos_agent = ankle_left_pos_agent;
+ playSound = TRUE;
+ }
+
+ // did right foot hit the ground?
+ if ( onGroundRight && !mWasOnGroundRight )
+ {
+ foot_pos_agent = ankle_right_pos_agent;
+ playSound = TRUE;
+ }
+
+ mWasOnGroundLeft = onGroundLeft;
+ mWasOnGroundRight = onGroundRight;
+
+ if ( playSound )
+ {
+ const F32 STEP_VOLUME = 0.1f;
+ const LLUUID& step_sound_id = getStepSound();
+
+ LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent);
+
+ if (LLViewerParcelMgr::getInstance()->canHearSound(foot_pos_global)
+ && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds))
+ {
+ gAudiop->triggerSound(step_sound_id, getID(), STEP_VOLUME, LLAudioEngine::AUDIO_TYPE_AMBIENT, foot_pos_global);
+ }
+ }
+ }
}
//------------------------------------------------------------------------
@@ -4137,57 +4137,57 @@ void LLVOAvatar::updateFootstepSounds()
// ------------------------------------------------------------------------
void LLVOAvatar::computeUpdatePeriod()
{
- bool visually_muted = isVisuallyMuted();
- if (mDrawable.notNull()
- && isVisible()
+ bool visually_muted = isVisuallyMuted();
+ if (mDrawable.notNull()
+ && isVisible()
&& (!isSelf() || visually_muted)
&& !isUIAvatar()
&& (sLimitNonImpostors || visually_muted)
&& !mNeedsAnimUpdate)
- {
- const LLVector4a* ext = mDrawable->getSpatialExtents();
- LLVector4a size;
- size.setSub(ext[1],ext[0]);
- F32 mag = size.getLength3().getF32()*0.5f;
-
- const S32 UPDATE_RATE_SLOW = 64;
- const S32 UPDATE_RATE_MED = 48;
- const S32 UPDATE_RATE_FAST = 32;
-
- if (visually_muted)
- { // visually muted avatars update at lowest rate
- mUpdatePeriod = UPDATE_RATE_SLOW;
- }
- else if (! shouldImpostor()
- || mDrawable->mDistanceWRTCamera < 1.f + mag)
- { // first 25% of max visible avatars are not impostored
- // also, don't impostor avatars whose bounding box may be penetrating the
- // impostor camera near clip plane
- mUpdatePeriod = 1;
- }
- else if ( shouldImpostor(4.0) )
- { //background avatars are REALLY slow updating impostors
- mUpdatePeriod = UPDATE_RATE_SLOW;
- }
- else if (mLastRezzedStatus <= 0)
- {
- // Don't update cloud avatars too often
- mUpdatePeriod = UPDATE_RATE_SLOW;
- }
- else if ( shouldImpostor(3.0) )
- { //back 25% of max visible avatars are slow updating impostors
- mUpdatePeriod = UPDATE_RATE_MED;
- }
- else
- {
- //nearby avatars, update the impostors more frequently.
- mUpdatePeriod = UPDATE_RATE_FAST;
- }
- }
- else
- {
- mUpdatePeriod = 1;
- }
+ {
+ const LLVector4a* ext = mDrawable->getSpatialExtents();
+ LLVector4a size;
+ size.setSub(ext[1],ext[0]);
+ F32 mag = size.getLength3().getF32()*0.5f;
+
+ const S32 UPDATE_RATE_SLOW = 64;
+ const S32 UPDATE_RATE_MED = 48;
+ const S32 UPDATE_RATE_FAST = 32;
+
+ if (visually_muted)
+ { // visually muted avatars update at lowest rate
+ mUpdatePeriod = UPDATE_RATE_SLOW;
+ }
+ else if (! shouldImpostor()
+ || mDrawable->mDistanceWRTCamera < 1.f + mag)
+ { // first 25% of max visible avatars are not impostored
+ // also, don't impostor avatars whose bounding box may be penetrating the
+ // impostor camera near clip plane
+ mUpdatePeriod = 1;
+ }
+ else if ( shouldImpostor(4.0) )
+ { //background avatars are REALLY slow updating impostors
+ mUpdatePeriod = UPDATE_RATE_SLOW;
+ }
+ else if (mLastRezzedStatus <= 0)
+ {
+ // Don't update cloud avatars too often
+ mUpdatePeriod = UPDATE_RATE_SLOW;
+ }
+ else if ( shouldImpostor(3.0) )
+ { //back 25% of max visible avatars are slow updating impostors
+ mUpdatePeriod = UPDATE_RATE_MED;
+ }
+ else
+ {
+ //nearby avatars, update the impostors more frequently.
+ mUpdatePeriod = UPDATE_RATE_FAST;
+ }
+ }
+ else
+ {
+ mUpdatePeriod = 1;
+ }
}
//------------------------------------------------------------------------
@@ -4200,97 +4200,97 @@ void LLVOAvatar::computeUpdatePeriod()
//------------------------------------------------------------------------
void LLVOAvatar::updateOrientation(LLAgent& agent, F32 speed, F32 delta_time)
{
- LLQuaternion iQ;
- LLVector3 upDir( 0.0f, 0.0f, 1.0f );
-
- // Compute a forward direction vector derived from the primitive rotation
- // and the velocity vector. When walking or jumping, don't let body deviate
- // more than 90 from the view, if necessary, flip the velocity vector.
-
- LLVector3 primDir;
- if (isSelf())
- {
- primDir = agent.getAtAxis() - projected_vec(agent.getAtAxis(), agent.getReferenceUpVector());
- primDir.normalize();
- }
- else
- {
- primDir = getRotation().getMatrix3().getFwdRow();
- }
- LLVector3 velDir = getVelocity();
- velDir.normalize();
- if ( mSignaledAnimations.find(ANIM_AGENT_WALK) != mSignaledAnimations.end())
- {
- F32 vpD = velDir * primDir;
- if (vpD < -0.5f)
- {
- velDir *= -1.0f;
- }
- }
- LLVector3 fwdDir = lerp(primDir, velDir, clamp_rescale(speed, 0.5f, 2.0f, 0.0f, 1.0f));
- if (isSelf() && gAgentCamera.cameraMouselook())
- {
- // make sure fwdDir stays in same general direction as primdir
- if (gAgent.getFlying())
- {
- fwdDir = LLViewerCamera::getInstance()->getAtAxis();
- }
- else
- {
- LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis();
- LLVector3 up_vector = gAgent.getReferenceUpVector();
- at_axis -= up_vector * (at_axis * up_vector);
- at_axis.normalize();
-
- F32 dot = fwdDir * at_axis;
- if (dot < 0.f)
- {
- fwdDir -= 2.f * at_axis * dot;
- fwdDir.normalize();
- }
- }
- }
-
- LLQuaternion root_rotation = mRoot->getWorldMatrix().quaternion();
- F32 root_roll, root_pitch, root_yaw;
- root_rotation.getEulerAngles(&root_roll, &root_pitch, &root_yaw);
-
- // When moving very slow, the pelvis is allowed to deviate from the
+ LLQuaternion iQ;
+ LLVector3 upDir( 0.0f, 0.0f, 1.0f );
+
+ // Compute a forward direction vector derived from the primitive rotation
+ // and the velocity vector. When walking or jumping, don't let body deviate
+ // more than 90 from the view, if necessary, flip the velocity vector.
+
+ LLVector3 primDir;
+ if (isSelf())
+ {
+ primDir = agent.getAtAxis() - projected_vec(agent.getAtAxis(), agent.getReferenceUpVector());
+ primDir.normalize();
+ }
+ else
+ {
+ primDir = getRotation().getMatrix3().getFwdRow();
+ }
+ LLVector3 velDir = getVelocity();
+ velDir.normalize();
+ if ( mSignaledAnimations.find(ANIM_AGENT_WALK) != mSignaledAnimations.end())
+ {
+ F32 vpD = velDir * primDir;
+ if (vpD < -0.5f)
+ {
+ velDir *= -1.0f;
+ }
+ }
+ LLVector3 fwdDir = lerp(primDir, velDir, clamp_rescale(speed, 0.5f, 2.0f, 0.0f, 1.0f));
+ if (isSelf() && gAgentCamera.cameraMouselook())
+ {
+ // make sure fwdDir stays in same general direction as primdir
+ if (gAgent.getFlying())
+ {
+ fwdDir = LLViewerCamera::getInstance()->getAtAxis();
+ }
+ else
+ {
+ LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis();
+ LLVector3 up_vector = gAgent.getReferenceUpVector();
+ at_axis -= up_vector * (at_axis * up_vector);
+ at_axis.normalize();
+
+ F32 dot = fwdDir * at_axis;
+ if (dot < 0.f)
+ {
+ fwdDir -= 2.f * at_axis * dot;
+ fwdDir.normalize();
+ }
+ }
+ }
+
+ LLQuaternion root_rotation = mRoot->getWorldMatrix().quaternion();
+ F32 root_roll, root_pitch, root_yaw;
+ root_rotation.getEulerAngles(&root_roll, &root_pitch, &root_yaw);
+
+ // When moving very slow, the pelvis is allowed to deviate from the
// forward direction to allow it to hold its position while the torso
- // and head turn. Once in motion, it must conform however.
- BOOL self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook();
-
- LLVector3 pelvisDir( mRoot->getWorldMatrix().getFwdRow4().mV );
-
- static LLCachedControl<F32> s_pelvis_rot_threshold_slow(gSavedSettings, "AvatarRotateThresholdSlow", 60.0);
- static LLCachedControl<F32> s_pelvis_rot_threshold_fast(gSavedSettings, "AvatarRotateThresholdFast", 2.0);
-
- F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, s_pelvis_rot_threshold_slow, s_pelvis_rot_threshold_fast);
-
- if (self_in_mouselook)
- {
- pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR;
- }
- pelvis_rot_threshold *= DEG_TO_RAD;
-
- F32 angle = angle_between( pelvisDir, fwdDir );
-
- // The avatar's root is allowed to have a yaw that deviates widely
- // from the forward direction, but if roll or pitch are off even
- // a little bit we need to correct the rotation.
- if(root_roll < 1.f * DEG_TO_RAD
- && root_pitch < 5.f * DEG_TO_RAD)
- {
- // smaller correction vector means pelvis follows prim direction more closely
- if (!mTurning && angle > pelvis_rot_threshold*0.75f)
- {
- mTurning = TRUE;
- }
-
- // use tighter threshold when turning
- if (mTurning)
- {
- pelvis_rot_threshold *= 0.4f;
+ // and head turn. Once in motion, it must conform however.
+ BOOL self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook();
+
+ LLVector3 pelvisDir( mRoot->getWorldMatrix().getFwdRow4().mV );
+
+ static LLCachedControl<F32> s_pelvis_rot_threshold_slow(gSavedSettings, "AvatarRotateThresholdSlow", 60.0);
+ static LLCachedControl<F32> s_pelvis_rot_threshold_fast(gSavedSettings, "AvatarRotateThresholdFast", 2.0);
+
+ F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, s_pelvis_rot_threshold_slow, s_pelvis_rot_threshold_fast);
+
+ if (self_in_mouselook)
+ {
+ pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR;
+ }
+ pelvis_rot_threshold *= DEG_TO_RAD;
+
+ F32 angle = angle_between( pelvisDir, fwdDir );
+
+ // The avatar's root is allowed to have a yaw that deviates widely
+ // from the forward direction, but if roll or pitch are off even
+ // a little bit we need to correct the rotation.
+ if(root_roll < 1.f * DEG_TO_RAD
+ && root_pitch < 5.f * DEG_TO_RAD)
+ {
+ // smaller correction vector means pelvis follows prim direction more closely
+ if (!mTurning && angle > pelvis_rot_threshold*0.75f)
+ {
+ mTurning = TRUE;
+ }
+
+ // use tighter threshold when turning
+ if (mTurning)
+ {
+ pelvis_rot_threshold *= 0.4f;
// account for fps, assume that above value is for ~60fps
constexpr F32 default_frame_sec = 0.016f;
F32 prev_frame_sec = LLFrameTimer::getFrameDeltaTimeF32();
@@ -4300,62 +4300,62 @@ void LLVOAvatar::updateOrientation(LLAgent& agent, F32 speed, F32 delta_time)
// shorter frame means shorter turn.
pelvis_rot_threshold *= prev_frame_sec/default_frame_sec;
}
- }
-
- // am I done turning?
- if (angle < pelvis_rot_threshold)
- {
- mTurning = FALSE;
- }
-
- LLVector3 correction_vector = (pelvisDir - fwdDir) * clamp_rescale(angle, pelvis_rot_threshold*0.75f, pelvis_rot_threshold, 1.0f, 0.0f);
- fwdDir += correction_vector;
- }
- else
- {
- mTurning = FALSE;
- }
-
- // Now compute the full world space rotation for the whole body (wQv)
- LLVector3 leftDir = upDir % fwdDir;
- leftDir.normalize();
- fwdDir = leftDir % upDir;
- LLQuaternion wQv( fwdDir, leftDir, upDir );
-
- if (isSelf() && mTurning)
- {
- if ((fwdDir % pelvisDir) * upDir > 0.f)
- {
- gAgent.setControlFlags(AGENT_CONTROL_TURN_RIGHT);
- }
- else
- {
- gAgent.setControlFlags(AGENT_CONTROL_TURN_LEFT);
- }
- }
-
- // Set the root rotation, but do so incrementally so that it
- // lags in time by some fixed amount.
- //F32 u = LLSmoothInterpolation::getInterpolant(PELVIS_LAG);
- F32 pelvis_lag_time = 0.f;
- if (self_in_mouselook)
- {
- pelvis_lag_time = PELVIS_LAG_MOUSELOOK;
- }
- else if (mInAir)
- {
- pelvis_lag_time = PELVIS_LAG_FLYING;
- // increase pelvis lag time when moving slowly
- pelvis_lag_time *= clamp_rescale(mSpeedAccum, 0.f, 15.f, 3.f, 1.f);
- }
- else
- {
- pelvis_lag_time = PELVIS_LAG_WALKING;
- }
-
- F32 u = llclamp((delta_time / pelvis_lag_time), 0.0f, 1.0f);
-
- mRoot->setWorldRotation( slerp(u, mRoot->getWorldRotation(), wQv) );
+ }
+
+ // am I done turning?
+ if (angle < pelvis_rot_threshold)
+ {
+ mTurning = FALSE;
+ }
+
+ LLVector3 correction_vector = (pelvisDir - fwdDir) * clamp_rescale(angle, pelvis_rot_threshold*0.75f, pelvis_rot_threshold, 1.0f, 0.0f);
+ fwdDir += correction_vector;
+ }
+ else
+ {
+ mTurning = FALSE;
+ }
+
+ // Now compute the full world space rotation for the whole body (wQv)
+ LLVector3 leftDir = upDir % fwdDir;
+ leftDir.normalize();
+ fwdDir = leftDir % upDir;
+ LLQuaternion wQv( fwdDir, leftDir, upDir );
+
+ if (isSelf() && mTurning)
+ {
+ if ((fwdDir % pelvisDir) * upDir > 0.f)
+ {
+ gAgent.setControlFlags(AGENT_CONTROL_TURN_RIGHT);
+ }
+ else
+ {
+ gAgent.setControlFlags(AGENT_CONTROL_TURN_LEFT);
+ }
+ }
+
+ // Set the root rotation, but do so incrementally so that it
+ // lags in time by some fixed amount.
+ //F32 u = LLSmoothInterpolation::getInterpolant(PELVIS_LAG);
+ F32 pelvis_lag_time = 0.f;
+ if (self_in_mouselook)
+ {
+ pelvis_lag_time = PELVIS_LAG_MOUSELOOK;
+ }
+ else if (mInAir)
+ {
+ pelvis_lag_time = PELVIS_LAG_FLYING;
+ // increase pelvis lag time when moving slowly
+ pelvis_lag_time *= clamp_rescale(mSpeedAccum, 0.f, 15.f, 3.f, 1.f);
+ }
+ else
+ {
+ pelvis_lag_time = PELVIS_LAG_WALKING;
+ }
+
+ F32 u = llclamp((delta_time / pelvis_lag_time), 0.0f, 1.0f);
+
+ mRoot->setWorldRotation( slerp(u, mRoot->getWorldRotation(), wQv) );
}
//------------------------------------------------------------------------
@@ -4368,91 +4368,91 @@ void LLVOAvatar::updateOrientation(LLAgent& agent, F32 speed, F32 delta_time)
// ------------------------------------------------------------------------
void LLVOAvatar::updateTimeStep()
{
- if (!isSelf() && !isUIAvatar()) // ie, non-self avatars, and animated objects will be affected.
- {
+ if (!isSelf() && !isUIAvatar()) // ie, non-self avatars, and animated objects will be affected.
+ {
// Note that sInstances counts animated objects and
// standard avatars in the same bucket. Is this desirable?
- F32 time_quantum = clamp_rescale((F32)sInstances.size(), 10.f, 35.f, 0.f, 0.25f);
- F32 pixel_area_scale = clamp_rescale(mPixelArea, 100, 5000, 1.f, 0.f);
- F32 time_step = time_quantum * pixel_area_scale;
+ F32 time_quantum = clamp_rescale((F32)sInstances.size(), 10.f, 35.f, 0.f, 0.25f);
+ F32 pixel_area_scale = clamp_rescale(mPixelArea, 100, 5000, 1.f, 0.f);
+ F32 time_step = time_quantum * pixel_area_scale;
// Extrema:
// If number of avs is 10 or less, time_step is unmodified (flagged with 0.0).
// If area of av is 5000 or greater, time_step is unmodified (flagged with 0.0).
// If number of avs is 35 or greater, and area of av is 100 or less,
// time_step takes the maximum possible value of 0.25.
// Other situations will give values within the (0, 0.25) range.
- if (time_step != 0.f)
- {
- // disable walk motion servo controller as it doesn't work with motion timesteps
- stopMotion(ANIM_AGENT_WALK_ADJUST);
- removeAnimationData("Walk Speed");
- }
+ if (time_step != 0.f)
+ {
+ // disable walk motion servo controller as it doesn't work with motion timesteps
+ stopMotion(ANIM_AGENT_WALK_ADJUST);
+ removeAnimationData("Walk Speed");
+ }
// See SL-763 - playback with altered time step does not
// appear to work correctly, odd behavior for distant avatars.
// As of 11-2017, LLMotionController::updateMotions() will
// ignore the value here. Need to re-enable if it's every
// fixed.
- mMotionController.setTimeStep(time_step);
- }
-}
-
-void LLVOAvatar::updateRootPositionAndRotation(LLAgent& agent, F32 speed, bool was_sit_ground_constrained)
-{
- if (!(isSitting() && getParent()))
- {
- // This case includes all configurations except sitting on an
- // object, so does include ground sit.
-
- //--------------------------------------------------------------------
- // get timing info
- // handle initial condition case
- //--------------------------------------------------------------------
- F32 animation_time = mAnimTimer.getElapsedTimeF32();
- if (mTimeLast == 0.0f)
- {
- mTimeLast = animation_time;
-
- // Initially put the pelvis at slaved position/mRotation
- // SL-315
- mRoot->setWorldPosition( getPositionAgent() ); // first frame
- mRoot->setWorldRotation( getRotation() );
- }
-
- //--------------------------------------------------------------------
- // dont' let dT get larger than 1/5th of a second
- //--------------------------------------------------------------------
- F32 delta_time = animation_time - mTimeLast;
-
- delta_time = llclamp( delta_time, DELTA_TIME_MIN, DELTA_TIME_MAX );
- mTimeLast = animation_time;
-
- mSpeedAccum = (mSpeedAccum * 0.95f) + (speed * 0.05f);
-
- //--------------------------------------------------------------------
- // compute the position of the avatar's root
- //--------------------------------------------------------------------
- LLVector3d root_pos;
- LLVector3d ground_under_pelvis;
-
- if (isSelf())
- {
- gAgent.setPositionAgent(getRenderPosition());
- }
-
- root_pos = gAgent.getPosGlobalFromAgent(getRenderPosition());
- root_pos.mdV[VZ] += getVisualParamWeight(AVATAR_HOVER);
+ mMotionController.setTimeStep(time_step);
+ }
+}
+
+void LLVOAvatar::updateRootPositionAndRotation(LLAgent& agent, F32 speed, bool was_sit_ground_constrained)
+{
+ if (!(isSitting() && getParent()))
+ {
+ // This case includes all configurations except sitting on an
+ // object, so does include ground sit.
+
+ //--------------------------------------------------------------------
+ // get timing info
+ // handle initial condition case
+ //--------------------------------------------------------------------
+ F32 animation_time = mAnimTimer.getElapsedTimeF32();
+ if (mTimeLast == 0.0f)
+ {
+ mTimeLast = animation_time;
+
+ // Initially put the pelvis at slaved position/mRotation
+ // SL-315
+ mRoot->setWorldPosition( getPositionAgent() ); // first frame
+ mRoot->setWorldRotation( getRotation() );
+ }
+
+ //--------------------------------------------------------------------
+ // dont' let dT get larger than 1/5th of a second
+ //--------------------------------------------------------------------
+ F32 delta_time = animation_time - mTimeLast;
+
+ delta_time = llclamp( delta_time, DELTA_TIME_MIN, DELTA_TIME_MAX );
+ mTimeLast = animation_time;
+
+ mSpeedAccum = (mSpeedAccum * 0.95f) + (speed * 0.05f);
+
+ //--------------------------------------------------------------------
+ // compute the position of the avatar's root
+ //--------------------------------------------------------------------
+ LLVector3d root_pos;
+ LLVector3d ground_under_pelvis;
+
+ if (isSelf())
+ {
+ gAgent.setPositionAgent(getRenderPosition());
+ }
+
+ root_pos = gAgent.getPosGlobalFromAgent(getRenderPosition());
+ root_pos.mdV[VZ] += getVisualParamWeight(AVATAR_HOVER);
LLVector3 normal;
- resolveHeightGlobal(root_pos, ground_under_pelvis, normal);
- F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]);
- BOOL in_air = ((!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) ||
- foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE);
+ resolveHeightGlobal(root_pos, ground_under_pelvis, normal);
+ F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]);
+ BOOL in_air = ((!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) ||
+ foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE);
- if (in_air && !mInAir)
- {
- mTimeInAir.reset();
- }
- mInAir = in_air;
+ if (in_air && !mInAir)
+ {
+ mTimeInAir.reset();
+ }
+ mInAir = in_air;
// SL-402: with the ability to animate the position of joints
// that affect the body size calculation, computed body size
@@ -4460,40 +4460,40 @@ void LLVOAvatar::updateRootPositionAndRotation(LLAgent& agent, F32 speed, bool w
// it frequently.
// SL-427: this appears to be too frequent, moving to only do on animation state change.
//computeBodySize();
-
- // correct for the fact that the pelvis is not necessarily the center
- // of the agent's physical representation
- root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot;
- if (!isSitting() && !was_sit_ground_constrained)
- {
- root_pos += LLVector3d(getHoverOffset());
- if (getOverallAppearance() == AOA_JELLYDOLL)
- {
- F32 offz = -0.5 * (getScale()[VZ] - mBodySize.mV[VZ]);
- root_pos[2] += offz;
- // if (!isSelf() && !isControlAvatar())
- // {
- // LL_DEBUGS("Avatar") << "av " << getFullname()
- // << " frame " << LLFrameTimer::getFrameCount()
- // << " root adjust offz " << offz
- // << " scalez " << getScale()[VZ]
- // << " bsz " << mBodySize.mV[VZ]
- // << LL_ENDL;
- // }
- }
- }
- // if (!isSelf() && !isControlAvatar())
- // {
- // LL_DEBUGS("Avatar") << "av " << getFullname() << " aoa " << (S32) getOverallAppearance()
- // << " frame " << LLFrameTimer::getFrameCount()
- // << " scalez " << getScale()[VZ]
- // << " bsz " << mBodySize.mV[VZ]
- // << " root pos " << root_pos[2]
- // << " curr rootz " << mRoot->getPosition()[2]
- // << " pp-z " << mPelvisp->getPosition()[2]
- // << " renderpos " << getRenderPosition()
- // << LL_ENDL;
- // }
+
+ // correct for the fact that the pelvis is not necessarily the center
+ // of the agent's physical representation
+ root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot;
+ if (!isSitting() && !was_sit_ground_constrained)
+ {
+ root_pos += LLVector3d(getHoverOffset());
+ if (getOverallAppearance() == AOA_JELLYDOLL)
+ {
+ F32 offz = -0.5 * (getScale()[VZ] - mBodySize.mV[VZ]);
+ root_pos[2] += offz;
+ // if (!isSelf() && !isControlAvatar())
+ // {
+ // LL_DEBUGS("Avatar") << "av " << getFullname()
+ // << " frame " << LLFrameTimer::getFrameCount()
+ // << " root adjust offz " << offz
+ // << " scalez " << getScale()[VZ]
+ // << " bsz " << mBodySize.mV[VZ]
+ // << LL_ENDL;
+ // }
+ }
+ }
+ // if (!isSelf() && !isControlAvatar())
+ // {
+ // LL_DEBUGS("Avatar") << "av " << getFullname() << " aoa " << (S32) getOverallAppearance()
+ // << " frame " << LLFrameTimer::getFrameCount()
+ // << " scalez " << getScale()[VZ]
+ // << " bsz " << mBodySize.mV[VZ]
+ // << " root pos " << root_pos[2]
+ // << " curr rootz " << mRoot->getPosition()[2]
+ // << " pp-z " << mPelvisp->getPosition()[2]
+ // << " renderpos " << getRenderPosition()
+ // << LL_ENDL;
+ // }
LLControlAvatar *cav = dynamic_cast<LLControlAvatar*>(this);
if (cav)
@@ -4504,73 +4504,73 @@ void LLVOAvatar::updateRootPositionAndRotation(LLAgent& agent, F32 speed, bool w
else
{
LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos);
- // if (!isSelf() && !isControlAvatar())
- // {
- // LL_DEBUGS("Avatar") << "av " << getFullname()
- // << " frame " << LLFrameTimer::getFrameCount()
- // << " newPosition " << newPosition
- // << " renderpos " << getRenderPosition()
- // << LL_ENDL;
- // }
+ // if (!isSelf() && !isControlAvatar())
+ // {
+ // LL_DEBUGS("Avatar") << "av " << getFullname()
+ // << " frame " << LLFrameTimer::getFrameCount()
+ // << " newPosition " << newPosition
+ // << " renderpos " << getRenderPosition()
+ // << LL_ENDL;
+ // }
if (newPosition != mRoot->getXform()->getWorldPosition())
- {
+ {
mRoot->touch();
// SL-315
- mRoot->setWorldPosition( newPosition ); // regular update
+ mRoot->setWorldPosition( newPosition ); // regular update
}
}
- //--------------------------------------------------------------------
- // Propagate viewer object rotation to root of avatar
- //--------------------------------------------------------------------
- if (!isControlAvatar() && !isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS))
- {
+ //--------------------------------------------------------------------
+ // Propagate viewer object rotation to root of avatar
+ //--------------------------------------------------------------------
+ if (!isControlAvatar() && !isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS))
+ {
// Rotation fixups for avatars in motion.
// Skip for animated objects.
updateOrientation(agent, speed, delta_time);
- }
- }
- else if (mDrawable.notNull())
- {
+ }
+ }
+ else if (mDrawable.notNull())
+ {
// Sitting on an object - mRoot is slaved to mDrawable orientation.
- LLVector3 pos = mDrawable->getPosition();
- pos += getHoverOffset() * mDrawable->getRotation();
- // SL-315
- mRoot->setPosition(pos);
- mRoot->setRotation(mDrawable->getRotation());
- }
+ LLVector3 pos = mDrawable->getPosition();
+ pos += getHoverOffset() * mDrawable->getRotation();
+ // SL-315
+ mRoot->setPosition(pos);
+ mRoot->setRotation(mDrawable->getRotation());
+ }
}
//------------------------------------------------------------------------
// LLVOAvatar::computeNeedsUpdate()
-//
+//
// Most of the logic here is to figure out when to periodically update impostors.
// Non-impostors have mUpdatePeriod == 1 and will need update every frame.
//------------------------------------------------------------------------
bool LLVOAvatar::computeNeedsUpdate()
{
- const F32 MAX_IMPOSTOR_INTERVAL = 4.0f;
- computeUpdatePeriod();
+ const F32 MAX_IMPOSTOR_INTERVAL = 4.0f;
+ computeUpdatePeriod();
- bool needs_update_by_frame_count = ((LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0);
+ bool needs_update_by_frame_count = ((LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0);
bool needs_update_by_max_time = ((gFrameTimeSeconds-mLastImpostorUpdateFrameTime)> MAX_IMPOSTOR_INTERVAL);
- bool needs_update = needs_update_by_frame_count || needs_update_by_max_time;
-
- if (needs_update && !isSelf())
- {
- if (needs_update_by_max_time)
- {
- mNeedsImpostorUpdate = TRUE;
- mLastImpostorUpdateReason = 11;
- }
- else
- {
- //mNeedsImpostorUpdate = TRUE;
- //mLastImpostorUpdateReason = 10;
- }
- }
- return needs_update;
+ bool needs_update = needs_update_by_frame_count || needs_update_by_max_time;
+
+ if (needs_update && !isSelf())
+ {
+ if (needs_update_by_max_time)
+ {
+ mNeedsImpostorUpdate = TRUE;
+ mLastImpostorUpdateReason = 11;
+ }
+ else
+ {
+ //mNeedsImpostorUpdate = TRUE;
+ //mLastImpostorUpdateReason = 10;
+ }
+ }
+ return needs_update;
}
// updateCharacter()
@@ -4596,153 +4596,153 @@ bool LLVOAvatar::computeNeedsUpdate()
//
//------------------------------------------------------------------------
bool LLVOAvatar::updateCharacter(LLAgent &agent)
-{
- updateDebugText();
-
- if (!mIsBuilt)
- {
- return FALSE;
- }
-
- BOOL visible = isVisible();
+{
+ updateDebugText();
+
+ if (!mIsBuilt)
+ {
+ return FALSE;
+ }
+
+ BOOL visible = isVisible();
bool is_control_avatar = isControlAvatar(); // capture state to simplify tracing
- bool is_attachment = false;
+ bool is_attachment = false;
- if (is_control_avatar)
- {
+ if (is_control_avatar)
+ {
LLControlAvatar *cav = dynamic_cast<LLControlAvatar*>(this);
- is_attachment = cav && cav->mRootVolp && cav->mRootVolp->isAttachment(); // For attached animated objects
- }
+ is_attachment = cav && cav->mRootVolp && cav->mRootVolp->isAttachment(); // For attached animated objects
+ }
LLScopedContextString str("updateCharacter " + getFullname() + " is_control_avatar "
- + boost::lexical_cast<std::string>(is_control_avatar)
+ + boost::lexical_cast<std::string>(is_control_avatar)
+ " is_attachment " + boost::lexical_cast<std::string>(is_attachment));
- // For fading out the names above heads, only let the timer
- // run if we're visible.
- if (mDrawable.notNull() && !visible)
- {
- mTimeVisible.reset();
- }
+ // For fading out the names above heads, only let the timer
+ // run if we're visible.
+ if (mDrawable.notNull() && !visible)
+ {
+ mTimeVisible.reset();
+ }
- //--------------------------------------------------------------------
- // The rest should only be done occasionally for far away avatars.
+ //--------------------------------------------------------------------
+ // The rest should only be done occasionally for far away avatars.
// Set mUpdatePeriod and visible based on distance and other criteria,
- // and flag for impostor update if needed.
- //--------------------------------------------------------------------
- bool needs_update = computeNeedsUpdate();
-
- //--------------------------------------------------------------------
- // Early out if does not need update and not self
- // don't early out for your own avatar, as we rely on your animations playing reliably
- // for example, the "turn around" animation when entering customize avatar needs to trigger
- // even when your avatar is offscreen
- //--------------------------------------------------------------------
- if (!needs_update && !isSelf())
- {
- updateMotions(LLCharacter::HIDDEN_UPDATE);
- return FALSE;
- }
-
- //--------------------------------------------------------------------
- // Handle transitions between regular rendering, jellydoll, or invisible.
- // Can trigger skeleton reset or animation changes
- //--------------------------------------------------------------------
- updateOverallAppearance();
-
- //--------------------------------------------------------------------
- // change animation time quanta based on avatar render load
- //--------------------------------------------------------------------
+ // and flag for impostor update if needed.
+ //--------------------------------------------------------------------
+ bool needs_update = computeNeedsUpdate();
+
+ //--------------------------------------------------------------------
+ // Early out if does not need update and not self
+ // don't early out for your own avatar, as we rely on your animations playing reliably
+ // for example, the "turn around" animation when entering customize avatar needs to trigger
+ // even when your avatar is offscreen
+ //--------------------------------------------------------------------
+ if (!needs_update && !isSelf())
+ {
+ updateMotions(LLCharacter::HIDDEN_UPDATE);
+ return FALSE;
+ }
+
+ //--------------------------------------------------------------------
+ // Handle transitions between regular rendering, jellydoll, or invisible.
+ // Can trigger skeleton reset or animation changes
+ //--------------------------------------------------------------------
+ updateOverallAppearance();
+
+ //--------------------------------------------------------------------
+ // change animation time quanta based on avatar render load
+ //--------------------------------------------------------------------
// SL-763 the time step quantization does not currently work.
//updateTimeStep();
-
- //--------------------------------------------------------------------
+
+ //--------------------------------------------------------------------
// Update sitting state based on parent and active animation info.
- //--------------------------------------------------------------------
- if (getParent() && !isSitting())
- {
- sitOnObject((LLViewerObject*)getParent());
- }
- else if (!getParent() && isSitting() && !isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED))
- {
+ //--------------------------------------------------------------------
+ if (getParent() && !isSitting())
+ {
+ sitOnObject((LLViewerObject*)getParent());
+ }
+ else if (!getParent() && isSitting() && !isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED))
+ {
// If we are starting up, motion might be loading
LLMotion *motionp = mMotionController.findMotion(ANIM_AGENT_SIT_GROUND_CONSTRAINED);
if (!motionp || !mMotionController.isMotionLoading(motionp))
{
getOffObject();
}
- }
-
- //--------------------------------------------------------------------
- // create local variables in world coords for region position values
- //--------------------------------------------------------------------
- LLVector3 xyVel = getVelocity();
- xyVel.mV[VZ] = 0.0f;
- F32 speed = xyVel.length();
- // remembering the value here prevents a display glitch if the
- // animation gets toggled during this update.
- bool was_sit_ground_constrained = isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED);
+ }
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // create local variables in world coords for region position values
+ //--------------------------------------------------------------------
+ LLVector3 xyVel = getVelocity();
+ xyVel.mV[VZ] = 0.0f;
+ F32 speed = xyVel.length();
+ // remembering the value here prevents a display glitch if the
+ // animation gets toggled during this update.
+ bool was_sit_ground_constrained = isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED);
+
+ //--------------------------------------------------------------------
// This does a bunch of state updating, including figuring out
// whether av is in the air, setting mRoot position and rotation
// In some cases, calls updateOrientation() for a lot of the
// work
// --------------------------------------------------------------------
updateRootPositionAndRotation(agent, speed, was_sit_ground_constrained);
-
- //-------------------------------------------------------------------------
- // Update character motions
- //-------------------------------------------------------------------------
- // store data relevant to motions
- mSpeed = speed;
-
- // update animations
- if (!visible)
- {
- updateMotions(LLCharacter::HIDDEN_UPDATE);
- }
- else if (mSpecialRenderMode == 1) // Animation Preview
- {
- updateMotions(LLCharacter::FORCE_UPDATE);
- }
- else
- {
- // Might be better to do HIDDEN_UPDATE if cloud
- updateMotions(LLCharacter::NORMAL_UPDATE);
- }
-
- // Special handling for sitting on ground.
- if (!getParent() && (isSitting() || was_sit_ground_constrained))
- {
-
- F32 off_z = LLVector3d(getHoverOffset()).mdV[VZ];
- if (off_z != 0.0)
- {
- LLVector3 pos = mRoot->getWorldPosition();
- pos.mV[VZ] += off_z;
- mRoot->touch();
- // SL-315
- mRoot->setWorldPosition(pos);
- }
- }
-
- // update head position
- updateHeadOffset();
-
- // Generate footstep sounds when feet hit the ground
+
+ //-------------------------------------------------------------------------
+ // Update character motions
+ //-------------------------------------------------------------------------
+ // store data relevant to motions
+ mSpeed = speed;
+
+ // update animations
+ if (!visible)
+ {
+ updateMotions(LLCharacter::HIDDEN_UPDATE);
+ }
+ else if (mSpecialRenderMode == 1) // Animation Preview
+ {
+ updateMotions(LLCharacter::FORCE_UPDATE);
+ }
+ else
+ {
+ // Might be better to do HIDDEN_UPDATE if cloud
+ updateMotions(LLCharacter::NORMAL_UPDATE);
+ }
+
+ // Special handling for sitting on ground.
+ if (!getParent() && (isSitting() || was_sit_ground_constrained))
+ {
+
+ F32 off_z = LLVector3d(getHoverOffset()).mdV[VZ];
+ if (off_z != 0.0)
+ {
+ LLVector3 pos = mRoot->getWorldPosition();
+ pos.mV[VZ] += off_z;
+ mRoot->touch();
+ // SL-315
+ mRoot->setWorldPosition(pos);
+ }
+ }
+
+ // update head position
+ updateHeadOffset();
+
+ // Generate footstep sounds when feet hit the ground
updateFootstepSounds();
- // Update child joints as needed.
- mRoot->updateWorldMatrixChildren();
+ // Update child joints as needed.
+ mRoot->updateWorldMatrixChildren();
if (visible)
{
- // System avatar mesh vertices need to be reskinned.
- mNeedsSkin = TRUE;
+ // System avatar mesh vertices need to be reskinned.
+ mNeedsSkin = TRUE;
}
- return visible;
+ return visible;
}
//-----------------------------------------------------------------------------
@@ -4750,246 +4750,246 @@ bool LLVOAvatar::updateCharacter(LLAgent &agent)
//-----------------------------------------------------------------------------
void LLVOAvatar::updateHeadOffset()
{
- // since we only care about Z, just grab one of the eyes
- LLVector3 midEyePt = mEyeLeftp->getWorldPosition();
- midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot->getWorldPosition();
- midEyePt.mV[VZ] = llmax(-mPelvisToFoot + LLViewerCamera::getInstance()->getNear(), midEyePt.mV[VZ]);
-
- if (mDrawable.notNull())
- {
- midEyePt = midEyePt * ~mDrawable->getWorldRotation();
- }
- if (isSitting())
- {
- mHeadOffset = midEyePt;
- }
- else
- {
- F32 u = llmax(0.f, HEAD_MOVEMENT_AVG_TIME - (1.f / gFPSClamped));
- mHeadOffset = lerp(midEyePt, mHeadOffset, u);
- }
+ // since we only care about Z, just grab one of the eyes
+ LLVector3 midEyePt = mEyeLeftp->getWorldPosition();
+ midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot->getWorldPosition();
+ midEyePt.mV[VZ] = llmax(-mPelvisToFoot + LLViewerCamera::getInstance()->getNear(), midEyePt.mV[VZ]);
+
+ if (mDrawable.notNull())
+ {
+ midEyePt = midEyePt * ~mDrawable->getWorldRotation();
+ }
+ if (isSitting())
+ {
+ mHeadOffset = midEyePt;
+ }
+ else
+ {
+ F32 u = llmax(0.f, HEAD_MOVEMENT_AVG_TIME - (1.f / gFPSClamped));
+ mHeadOffset = lerp(midEyePt, mHeadOffset, u);
+ }
}
void LLVOAvatar::debugBodySize() const
{
- LLVector3 pelvis_scale = mPelvisp->getScale();
+ LLVector3 pelvis_scale = mPelvisp->getScale();
- // some of the joints have not been cached
- LLVector3 skull = mSkullp->getPosition();
+ // some of the joints have not been cached
+ LLVector3 skull = mSkullp->getPosition();
LL_DEBUGS("Avatar") << "skull pos " << skull << LL_ENDL;
- //LLVector3 skull_scale = mSkullp->getScale();
+ //LLVector3 skull_scale = mSkullp->getScale();
- LLVector3 neck = mNeckp->getPosition();
- LLVector3 neck_scale = mNeckp->getScale();
+ LLVector3 neck = mNeckp->getPosition();
+ LLVector3 neck_scale = mNeckp->getScale();
LL_DEBUGS("Avatar") << "neck pos " << neck << " neck_scale " << neck_scale << LL_ENDL;
- LLVector3 chest = mChestp->getPosition();
- LLVector3 chest_scale = mChestp->getScale();
+ LLVector3 chest = mChestp->getPosition();
+ LLVector3 chest_scale = mChestp->getScale();
LL_DEBUGS("Avatar") << "chest pos " << chest << " chest_scale " << chest_scale << LL_ENDL;
- // the rest of the joints have been cached
- LLVector3 head = mHeadp->getPosition();
- LLVector3 head_scale = mHeadp->getScale();
+ // the rest of the joints have been cached
+ LLVector3 head = mHeadp->getPosition();
+ LLVector3 head_scale = mHeadp->getScale();
LL_DEBUGS("Avatar") << "head pos " << head << " head_scale " << head_scale << LL_ENDL;
- LLVector3 torso = mTorsop->getPosition();
- LLVector3 torso_scale = mTorsop->getScale();
+ LLVector3 torso = mTorsop->getPosition();
+ LLVector3 torso_scale = mTorsop->getScale();
LL_DEBUGS("Avatar") << "torso pos " << torso << " torso_scale " << torso_scale << LL_ENDL;
- LLVector3 hip = mHipLeftp->getPosition();
- LLVector3 hip_scale = mHipLeftp->getScale();
+ LLVector3 hip = mHipLeftp->getPosition();
+ LLVector3 hip_scale = mHipLeftp->getScale();
LL_DEBUGS("Avatar") << "hip pos " << hip << " hip_scale " << hip_scale << LL_ENDL;
- LLVector3 knee = mKneeLeftp->getPosition();
- LLVector3 knee_scale = mKneeLeftp->getScale();
+ LLVector3 knee = mKneeLeftp->getPosition();
+ LLVector3 knee_scale = mKneeLeftp->getScale();
LL_DEBUGS("Avatar") << "knee pos " << knee << " knee_scale " << knee_scale << LL_ENDL;
- LLVector3 ankle = mAnkleLeftp->getPosition();
- LLVector3 ankle_scale = mAnkleLeftp->getScale();
+ LLVector3 ankle = mAnkleLeftp->getPosition();
+ LLVector3 ankle_scale = mAnkleLeftp->getScale();
LL_DEBUGS("Avatar") << "ankle pos " << ankle << " ankle_scale " << ankle_scale << LL_ENDL;
- LLVector3 foot = mFootLeftp->getPosition();
+ LLVector3 foot = mFootLeftp->getPosition();
LL_DEBUGS("Avatar") << "foot pos " << foot << LL_ENDL;
- F32 new_offset = (const_cast<LLVOAvatar*>(this))->getVisualParamWeight(AVATAR_HOVER);
+ F32 new_offset = (const_cast<LLVOAvatar*>(this))->getVisualParamWeight(AVATAR_HOVER);
LL_DEBUGS("Avatar") << "new_offset " << new_offset << LL_ENDL;
- F32 new_pelvis_to_foot = hip.mV[VZ] * pelvis_scale.mV[VZ] -
+ F32 new_pelvis_to_foot = hip.mV[VZ] * pelvis_scale.mV[VZ] -
knee.mV[VZ] * hip_scale.mV[VZ] -
ankle.mV[VZ] * knee_scale.mV[VZ] -
foot.mV[VZ] * ankle_scale.mV[VZ];
LL_DEBUGS("Avatar") << "new_pelvis_to_foot " << new_pelvis_to_foot << LL_ENDL;
- LLVector3 new_body_size;
- new_body_size.mV[VZ] = new_pelvis_to_foot +
- // the sqrt(2) correction below is an approximate
- // correction to get to the top of the head
- F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) +
- head.mV[VZ] * neck_scale.mV[VZ] +
- neck.mV[VZ] * chest_scale.mV[VZ] +
- chest.mV[VZ] * torso_scale.mV[VZ] +
- torso.mV[VZ] * pelvis_scale.mV[VZ];
+ LLVector3 new_body_size;
+ new_body_size.mV[VZ] = new_pelvis_to_foot +
+ // the sqrt(2) correction below is an approximate
+ // correction to get to the top of the head
+ F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) +
+ head.mV[VZ] * neck_scale.mV[VZ] +
+ neck.mV[VZ] * chest_scale.mV[VZ] +
+ chest.mV[VZ] * torso_scale.mV[VZ] +
+ torso.mV[VZ] * pelvis_scale.mV[VZ];
- // TODO -- measure the real depth and width
- new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH;
- new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH;
+ // TODO -- measure the real depth and width
+ new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH;
+ new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH;
LL_DEBUGS("Avatar") << "new_body_size " << new_body_size << LL_ENDL;
}
-
+
//------------------------------------------------------------------------
// postPelvisSetRecalc
//------------------------------------------------------------------------
void LLVOAvatar::postPelvisSetRecalc()
-{
- mRoot->updateWorldMatrixChildren();
- computeBodySize();
- dirtyMesh(2);
+{
+ mRoot->updateWorldMatrixChildren();
+ computeBodySize();
+ dirtyMesh(2);
}
//------------------------------------------------------------------------
// updateVisibility()
//------------------------------------------------------------------------
void LLVOAvatar::updateVisibility()
{
- BOOL visible = FALSE;
-
- if (mIsDummy)
- {
- visible = FALSE;
- }
- else if (mDrawable.isNull())
- {
- visible = FALSE;
- }
- else
- {
- if (!mDrawable->getSpatialGroup() || mDrawable->getSpatialGroup()->isVisible())
- {
- visible = TRUE;
- }
- else
- {
- visible = FALSE;
- }
-
- if(isSelf())
- {
- if (!gAgentWearables.areWearablesLoaded())
- {
- visible = FALSE;
- }
- }
- else if( !mFirstAppearanceMessageReceived )
- {
- visible = FALSE;
- }
-
- if (sDebugInvisible)
- {
- LLNameValue* firstname = getNVPair("FirstName");
- if (firstname)
- {
- LL_DEBUGS("Avatar") << avString() << " updating visibility" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "Avatar " << this << " updating visiblity" << LL_ENDL;
- }
-
- if (visible)
- {
- LL_INFOS() << "Visible" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "Not visible" << LL_ENDL;
- }
-
- /*if (avatar_in_frustum)
- {
- LL_INFOS() << "Avatar in frustum" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "Avatar not in frustum" << LL_ENDL;
- }*/
-
- /*if (LLViewerCamera::getInstance()->sphereInFrustum(sel_pos_agent, 2.0f))
- {
- LL_INFOS() << "Sel pos visible" << LL_ENDL;
- }
- if (LLViewerCamera::getInstance()->sphereInFrustum(wrist_right_pos_agent, 0.2f))
- {
- LL_INFOS() << "Wrist pos visible" << LL_ENDL;
- }
- if (LLViewerCamera::getInstance()->sphereInFrustum(getPositionAgent(), getMaxScale()*2.f))
- {
- LL_INFOS() << "Agent visible" << LL_ENDL;
- }*/
- LL_INFOS() << "PA: " << getPositionAgent() << LL_ENDL;
- /*LL_INFOS() << "SPA: " << sel_pos_agent << LL_ENDL;
- LL_INFOS() << "WPA: " << wrist_right_pos_agent << LL_ENDL;*/
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
-
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- if (LLViewerObject *attached_object = attachment_iter->get())
- {
- if(attached_object->mDrawable->isVisible())
- {
- LL_INFOS() << attachment->getName() << " visible" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << attachment->getName() << " not visible at " << mDrawable->getWorldPosition() << " and radius " << mDrawable->getRadius() << LL_ENDL;
- }
- }
- }
- }
- }
- }
-
- if (!visible && mVisible)
- {
- mMeshInvisibleTime.reset();
- }
-
- if (visible)
- {
- if (!mMeshValid)
- {
- restoreMeshData();
- }
- }
- else
- {
- if (mMeshValid &&
+ BOOL visible = FALSE;
+
+ if (mIsDummy)
+ {
+ visible = FALSE;
+ }
+ else if (mDrawable.isNull())
+ {
+ visible = FALSE;
+ }
+ else
+ {
+ if (!mDrawable->getSpatialGroup() || mDrawable->getSpatialGroup()->isVisible())
+ {
+ visible = TRUE;
+ }
+ else
+ {
+ visible = FALSE;
+ }
+
+ if(isSelf())
+ {
+ if (!gAgentWearables.areWearablesLoaded())
+ {
+ visible = FALSE;
+ }
+ }
+ else if( !mFirstAppearanceMessageReceived )
+ {
+ visible = FALSE;
+ }
+
+ if (sDebugInvisible)
+ {
+ LLNameValue* firstname = getNVPair("FirstName");
+ if (firstname)
+ {
+ LL_DEBUGS("Avatar") << avString() << " updating visibility" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "Avatar " << this << " updating visiblity" << LL_ENDL;
+ }
+
+ if (visible)
+ {
+ LL_INFOS() << "Visible" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "Not visible" << LL_ENDL;
+ }
+
+ /*if (avatar_in_frustum)
+ {
+ LL_INFOS() << "Avatar in frustum" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "Avatar not in frustum" << LL_ENDL;
+ }*/
+
+ /*if (LLViewerCamera::getInstance()->sphereInFrustum(sel_pos_agent, 2.0f))
+ {
+ LL_INFOS() << "Sel pos visible" << LL_ENDL;
+ }
+ if (LLViewerCamera::getInstance()->sphereInFrustum(wrist_right_pos_agent, 0.2f))
+ {
+ LL_INFOS() << "Wrist pos visible" << LL_ENDL;
+ }
+ if (LLViewerCamera::getInstance()->sphereInFrustum(getPositionAgent(), getMaxScale()*2.f))
+ {
+ LL_INFOS() << "Agent visible" << LL_ENDL;
+ }*/
+ LL_INFOS() << "PA: " << getPositionAgent() << LL_ENDL;
+ /*LL_INFOS() << "SPA: " << sel_pos_agent << LL_ENDL;
+ LL_INFOS() << "WPA: " << wrist_right_pos_agent << LL_ENDL;*/
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ if (LLViewerObject *attached_object = attachment_iter->get())
+ {
+ if(attached_object->mDrawable->isVisible())
+ {
+ LL_INFOS() << attachment->getName() << " visible" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << attachment->getName() << " not visible at " << mDrawable->getWorldPosition() << " and radius " << mDrawable->getRadius() << LL_ENDL;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (!visible && mVisible)
+ {
+ mMeshInvisibleTime.reset();
+ }
+
+ if (visible)
+ {
+ if (!mMeshValid)
+ {
+ restoreMeshData();
+ }
+ }
+ else
+ {
+ if (mMeshValid &&
(isControlAvatar() || mMeshInvisibleTime.getElapsedTimeF32() > TIME_BEFORE_MESH_CLEANUP))
- {
- releaseMeshData();
- }
- }
+ {
+ releaseMeshData();
+ }
+ }
if ( visible != mVisible )
{
LL_DEBUGS("AvatarRender") << "visible was " << mVisible << " now " << visible << LL_ENDL;
}
- mVisible = visible;
+ mVisible = visible;
}
// private
bool LLVOAvatar::shouldAlphaMask()
{
- const bool should_alpha_mask = !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
- && !LLDrawPoolAvatar::sSkipTransparent;
+ const bool should_alpha_mask = !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
+ && !LLDrawPoolAvatar::sSkipTransparent;
- return should_alpha_mask;
+ return should_alpha_mask;
}
@@ -5000,237 +5000,237 @@ U32 LLVOAvatar::renderSkinned()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- U32 num_indices = 0;
+ U32 num_indices = 0;
- if (!mIsBuilt)
- {
- return num_indices;
- }
+ if (!mIsBuilt)
+ {
+ return num_indices;
+ }
if (mDrawable.isNull())
{
- return num_indices;
- }
-
- LLFace* face = mDrawable->getFace(0);
-
- bool needs_rebuild = !face || !face->getVertexBuffer() || mDrawable->isState(LLDrawable::REBUILD_GEOMETRY);
-
- if (needs_rebuild || mDirtyMesh)
- { //LOD changed or new mesh created, allocate new vertex buffer if needed
- if (needs_rebuild || mDirtyMesh >= 2 || mVisibilityRank <= 4)
- {
- updateMeshData();
- mDirtyMesh = 0;
- mNeedsSkin = TRUE;
- mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY);
- }
- }
-
- if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) <= 0)
- {
- if (mNeedsSkin)
- {
- //generate animated mesh
- LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY);
- LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY);
- LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT);
- LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH);
- LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD);
- LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR);
-
- if(upper_mesh)
- {
- upper_mesh->updateJointGeometry();
- }
- if (lower_mesh)
- {
- lower_mesh->updateJointGeometry();
- }
-
- if( isWearingWearableType( LLWearableType::WT_SKIRT ) )
- {
- if(skirt_mesh)
- {
- skirt_mesh->updateJointGeometry();
- }
- }
-
- if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender)
- {
- if(eyelash_mesh)
- {
- eyelash_mesh->updateJointGeometry();
- }
- if(head_mesh)
- {
- head_mesh->updateJointGeometry();
- }
- if(hair_mesh)
- {
- hair_mesh->updateJointGeometry();
- }
- }
- mNeedsSkin = FALSE;
- mLastSkinTime = gFrameTimeSeconds;
-
- LLFace * face = mDrawable->getFace(0);
- if (face)
- {
- LLVertexBuffer* vb = face->getVertexBuffer();
- if (vb)
- {
- vb->unmapBuffer();
- }
- }
- }
- }
- else
- {
- mNeedsSkin = FALSE;
- }
-
- if (sDebugInvisible)
- {
- LLNameValue* firstname = getNVPair("FirstName");
- if (firstname)
- {
- LL_DEBUGS("Avatar") << avString() << " in render" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "Avatar " << this << " in render" << LL_ENDL;
- }
- if (!mIsBuilt)
- {
- LL_INFOS() << "Not built!" << LL_ENDL;
- }
- else if (!gAgent.needsRenderAvatar())
- {
- LL_INFOS() << "Doesn't need avatar render!" << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "Rendering!" << LL_ENDL;
- }
- }
-
- if (!mIsBuilt)
- {
- return num_indices;
- }
-
- if (isSelf() && !gAgent.needsRenderAvatar())
- {
- return num_indices;
- }
-
- //--------------------------------------------------------------------
- // render all geometry attached to the skeleton
- //--------------------------------------------------------------------
-
- BOOL first_pass = TRUE;
- if (!LLDrawPoolAvatar::sSkipOpaque)
- {
- if (isUIAvatar() && mIsDummy)
- {
- LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR);
- if (hair_mesh)
- {
- num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
- }
- first_pass = FALSE;
- }
- if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender)
- {
-
- if (isTextureVisible(TEX_HEAD_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
- {
- LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD);
- if (head_mesh)
- {
- num_indices += head_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
- }
- first_pass = FALSE;
- }
- }
- if (isTextureVisible(TEX_UPPER_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
- {
- LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY);
- if (upper_mesh)
- {
- num_indices += upper_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
- }
- first_pass = FALSE;
- }
-
- if (isTextureVisible(TEX_LOWER_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
- {
- LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY);
- if (lower_mesh)
- {
- num_indices += lower_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
- }
- first_pass = FALSE;
- }
- }
-
- if (!LLDrawPoolAvatar::sSkipTransparent || LLPipeline::sImpostorRender)
- {
- LLGLState blend(GL_BLEND, !mIsDummy);
- num_indices += renderTransparent(first_pass);
- }
-
- return num_indices;
+ return num_indices;
+ }
+
+ LLFace* face = mDrawable->getFace(0);
+
+ bool needs_rebuild = !face || !face->getVertexBuffer() || mDrawable->isState(LLDrawable::REBUILD_GEOMETRY);
+
+ if (needs_rebuild || mDirtyMesh)
+ { //LOD changed or new mesh created, allocate new vertex buffer if needed
+ if (needs_rebuild || mDirtyMesh >= 2 || mVisibilityRank <= 4)
+ {
+ updateMeshData();
+ mDirtyMesh = 0;
+ mNeedsSkin = TRUE;
+ mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY);
+ }
+ }
+
+ if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) <= 0)
+ {
+ if (mNeedsSkin)
+ {
+ //generate animated mesh
+ LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY);
+ LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY);
+ LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT);
+ LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH);
+ LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD);
+ LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR);
+
+ if(upper_mesh)
+ {
+ upper_mesh->updateJointGeometry();
+ }
+ if (lower_mesh)
+ {
+ lower_mesh->updateJointGeometry();
+ }
+
+ if( isWearingWearableType( LLWearableType::WT_SKIRT ) )
+ {
+ if(skirt_mesh)
+ {
+ skirt_mesh->updateJointGeometry();
+ }
+ }
+
+ if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender)
+ {
+ if(eyelash_mesh)
+ {
+ eyelash_mesh->updateJointGeometry();
+ }
+ if(head_mesh)
+ {
+ head_mesh->updateJointGeometry();
+ }
+ if(hair_mesh)
+ {
+ hair_mesh->updateJointGeometry();
+ }
+ }
+ mNeedsSkin = FALSE;
+ mLastSkinTime = gFrameTimeSeconds;
+
+ LLFace * face = mDrawable->getFace(0);
+ if (face)
+ {
+ LLVertexBuffer* vb = face->getVertexBuffer();
+ if (vb)
+ {
+ vb->unmapBuffer();
+ }
+ }
+ }
+ }
+ else
+ {
+ mNeedsSkin = FALSE;
+ }
+
+ if (sDebugInvisible)
+ {
+ LLNameValue* firstname = getNVPair("FirstName");
+ if (firstname)
+ {
+ LL_DEBUGS("Avatar") << avString() << " in render" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "Avatar " << this << " in render" << LL_ENDL;
+ }
+ if (!mIsBuilt)
+ {
+ LL_INFOS() << "Not built!" << LL_ENDL;
+ }
+ else if (!gAgent.needsRenderAvatar())
+ {
+ LL_INFOS() << "Doesn't need avatar render!" << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "Rendering!" << LL_ENDL;
+ }
+ }
+
+ if (!mIsBuilt)
+ {
+ return num_indices;
+ }
+
+ if (isSelf() && !gAgent.needsRenderAvatar())
+ {
+ return num_indices;
+ }
+
+ //--------------------------------------------------------------------
+ // render all geometry attached to the skeleton
+ //--------------------------------------------------------------------
+
+ BOOL first_pass = TRUE;
+ if (!LLDrawPoolAvatar::sSkipOpaque)
+ {
+ if (isUIAvatar() && mIsDummy)
+ {
+ LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR);
+ if (hair_mesh)
+ {
+ num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
+ }
+ first_pass = FALSE;
+ }
+ if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender)
+ {
+
+ if (isTextureVisible(TEX_HEAD_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
+ {
+ LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD);
+ if (head_mesh)
+ {
+ num_indices += head_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
+ }
+ first_pass = FALSE;
+ }
+ }
+ if (isTextureVisible(TEX_UPPER_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
+ {
+ LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY);
+ if (upper_mesh)
+ {
+ num_indices += upper_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
+ }
+ first_pass = FALSE;
+ }
+
+ if (isTextureVisible(TEX_LOWER_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
+ {
+ LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY);
+ if (lower_mesh)
+ {
+ num_indices += lower_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
+ }
+ first_pass = FALSE;
+ }
+ }
+
+ if (!LLDrawPoolAvatar::sSkipTransparent || LLPipeline::sImpostorRender)
+ {
+ LLGLState blend(GL_BLEND, !mIsDummy);
+ num_indices += renderTransparent(first_pass);
+ }
+
+ return num_indices;
}
U32 LLVOAvatar::renderTransparent(BOOL first_pass)
{
- U32 num_indices = 0;
- if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (isUIAvatar() || isTextureVisible(TEX_SKIRT_BAKED)) )
- {
+ U32 num_indices = 0;
+ if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (isUIAvatar() || isTextureVisible(TEX_SKIRT_BAKED)) )
+ {
gGL.flush();
- LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT);
- if (skirt_mesh)
- {
- num_indices += skirt_mesh->render(mAdjustedPixelArea, FALSE);
- }
- first_pass = FALSE;
+ LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT);
+ if (skirt_mesh)
+ {
+ num_indices += skirt_mesh->render(mAdjustedPixelArea, FALSE);
+ }
+ first_pass = FALSE;
gGL.flush();
- }
+ }
- if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender)
- {
- if (LLPipeline::sImpostorRender)
- {
+ if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender)
+ {
+ if (LLPipeline::sImpostorRender)
+ {
gGL.flush();
- }
-
- if (isTextureVisible(TEX_HEAD_BAKED))
- {
- LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH);
- if (eyelash_mesh)
- {
- num_indices += eyelash_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
- }
- first_pass = FALSE;
- }
- if (isTextureVisible(TEX_HAIR_BAKED) && (getOverallAppearance() != AOA_JELLYDOLL))
- {
- LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR);
- if (hair_mesh)
- {
- num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
- }
- first_pass = FALSE;
- }
- if (LLPipeline::sImpostorRender)
- {
+ }
+
+ if (isTextureVisible(TEX_HEAD_BAKED))
+ {
+ LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH);
+ if (eyelash_mesh)
+ {
+ num_indices += eyelash_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
+ }
+ first_pass = FALSE;
+ }
+ if (isTextureVisible(TEX_HAIR_BAKED) && (getOverallAppearance() != AOA_JELLYDOLL))
+ {
+ LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR);
+ if (hair_mesh)
+ {
+ num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
+ }
+ first_pass = FALSE;
+ }
+ if (LLPipeline::sImpostorRender)
+ {
gGL.flush();
- }
- }
-
- return num_indices;
+ }
+ }
+
+ return num_indices;
}
//-----------------------------------------------------------------------------
@@ -5238,402 +5238,402 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass)
//-----------------------------------------------------------------------------
U32 LLVOAvatar::renderRigid()
{
- U32 num_indices = 0;
+ U32 num_indices = 0;
- if (!mIsBuilt)
- {
- return 0;
- }
+ if (!mIsBuilt)
+ {
+ return 0;
+ }
- if (isSelf() && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead()))
- {
- return 0;
- }
+ if (isSelf() && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead()))
+ {
+ return 0;
+ }
- bool should_alpha_mask = shouldAlphaMask();
- LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
+ bool should_alpha_mask = shouldAlphaMask();
+ LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
- if (isTextureVisible(TEX_EYES_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
- {
- LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT);
- LLViewerJoint* eyeball_right = getViewerJoint(MESH_ID_EYEBALL_RIGHT);
- if (eyeball_left)
- {
- num_indices += eyeball_left->render(mAdjustedPixelArea, TRUE, mIsDummy);
- }
- if(eyeball_right)
- {
- num_indices += eyeball_right->render(mAdjustedPixelArea, TRUE, mIsDummy);
- }
- }
+ if (isTextureVisible(TEX_EYES_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
+ {
+ LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT);
+ LLViewerJoint* eyeball_right = getViewerJoint(MESH_ID_EYEBALL_RIGHT);
+ if (eyeball_left)
+ {
+ num_indices += eyeball_left->render(mAdjustedPixelArea, TRUE, mIsDummy);
+ }
+ if(eyeball_right)
+ {
+ num_indices += eyeball_right->render(mAdjustedPixelArea, TRUE, mIsDummy);
+ }
+ }
- return num_indices;
+ return num_indices;
}
U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel)
{
- if (!mImpostor.isComplete())
- {
- return 0;
- }
-
- LLVector3 pos(getRenderPosition()+mImpostorOffset);
- LLVector3 at = (pos - LLViewerCamera::getInstance()->getOrigin());
- at.normalize();
- LLVector3 left = LLViewerCamera::getInstance()->getUpAxis() % at;
- LLVector3 up = at%left;
-
- left *= mImpostorDim.mV[0];
- up *= mImpostorDim.mV[1];
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_IMPOSTORS))
- {
- LLGLEnable blend(GL_BLEND);
- gGL.setSceneBlendType(LLRender::BT_ADD);
- gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
-
- // gGL.begin(LLRender::QUADS);
- // gGL.vertex3fv((pos+left-up).mV);
- // gGL.vertex3fv((pos-left-up).mV);
- // gGL.vertex3fv((pos-left+up).mV);
- // gGL.vertex3fv((pos+left+up).mV);
- // gGL.end();
-
-
- gGL.begin(LLRender::LINES);
- gGL.color4f(1.f,1.f,1.f,1.f);
- F32 thickness = llmax(F32(5.0f-5.0f*(gFrameTimeSeconds-mLastImpostorUpdateFrameTime)),1.0f);
- glLineWidth(thickness);
- gGL.vertex3fv((pos+left-up).mV);
- gGL.vertex3fv((pos-left-up).mV);
- gGL.vertex3fv((pos-left-up).mV);
- gGL.vertex3fv((pos-left+up).mV);
- gGL.vertex3fv((pos-left+up).mV);
- gGL.vertex3fv((pos+left+up).mV);
- gGL.vertex3fv((pos+left+up).mV);
- gGL.vertex3fv((pos+left-up).mV);
- gGL.end();
- gGL.flush();
- }
- {
- gGL.flush();
-
- gGL.color4ubv(color.mV);
- gGL.getTexUnit(diffuse_channel)->bind(&mImpostor);
- gGL.begin(LLRender::QUADS);
- gGL.texCoord2f(0,0);
- gGL.vertex3fv((pos+left-up).mV);
- gGL.texCoord2f(1,0);
- gGL.vertex3fv((pos-left-up).mV);
- gGL.texCoord2f(1,1);
- gGL.vertex3fv((pos-left+up).mV);
- gGL.texCoord2f(0,1);
- gGL.vertex3fv((pos+left+up).mV);
- gGL.end();
- gGL.flush();
- }
-
- return 6;
+ if (!mImpostor.isComplete())
+ {
+ return 0;
+ }
+
+ LLVector3 pos(getRenderPosition()+mImpostorOffset);
+ LLVector3 at = (pos - LLViewerCamera::getInstance()->getOrigin());
+ at.normalize();
+ LLVector3 left = LLViewerCamera::getInstance()->getUpAxis() % at;
+ LLVector3 up = at%left;
+
+ left *= mImpostorDim.mV[0];
+ up *= mImpostorDim.mV[1];
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_IMPOSTORS))
+ {
+ LLGLEnable blend(GL_BLEND);
+ gGL.setSceneBlendType(LLRender::BT_ADD);
+ gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
+
+ // gGL.begin(LLRender::QUADS);
+ // gGL.vertex3fv((pos+left-up).mV);
+ // gGL.vertex3fv((pos-left-up).mV);
+ // gGL.vertex3fv((pos-left+up).mV);
+ // gGL.vertex3fv((pos+left+up).mV);
+ // gGL.end();
+
+
+ gGL.begin(LLRender::LINES);
+ gGL.color4f(1.f,1.f,1.f,1.f);
+ F32 thickness = llmax(F32(5.0f-5.0f*(gFrameTimeSeconds-mLastImpostorUpdateFrameTime)),1.0f);
+ glLineWidth(thickness);
+ gGL.vertex3fv((pos+left-up).mV);
+ gGL.vertex3fv((pos-left-up).mV);
+ gGL.vertex3fv((pos-left-up).mV);
+ gGL.vertex3fv((pos-left+up).mV);
+ gGL.vertex3fv((pos-left+up).mV);
+ gGL.vertex3fv((pos+left+up).mV);
+ gGL.vertex3fv((pos+left+up).mV);
+ gGL.vertex3fv((pos+left-up).mV);
+ gGL.end();
+ gGL.flush();
+ }
+ {
+ gGL.flush();
+
+ gGL.color4ubv(color.mV);
+ gGL.getTexUnit(diffuse_channel)->bind(&mImpostor);
+ gGL.begin(LLRender::QUADS);
+ gGL.texCoord2f(0,0);
+ gGL.vertex3fv((pos+left-up).mV);
+ gGL.texCoord2f(1,0);
+ gGL.vertex3fv((pos-left-up).mV);
+ gGL.texCoord2f(1,1);
+ gGL.vertex3fv((pos-left+up).mV);
+ gGL.texCoord2f(0,1);
+ gGL.vertex3fv((pos+left+up).mV);
+ gGL.end();
+ gGL.flush();
+ }
+
+ return 6;
}
bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const
{
- for (std::set<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
- if (imagep && imagep->getDiscardLevel()!=0)
- {
- return false;
- }
- }
- return true;
+ for (std::set<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
+ if (imagep && imagep->getDiscardLevel()!=0)
+ {
+ return false;
+ }
+ }
+ return true;
}
bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() const
{
- std::set<LLUUID> local_ids;
- collectLocalTextureUUIDs(local_ids);
- return allTexturesCompletelyDownloaded(local_ids);
+ std::set<LLUUID> local_ids;
+ collectLocalTextureUUIDs(local_ids);
+ return allTexturesCompletelyDownloaded(local_ids);
}
bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() const
{
- std::set<LLUUID> baked_ids;
- collectBakedTextureUUIDs(baked_ids);
- return allTexturesCompletelyDownloaded(baked_ids);
+ std::set<LLUUID> baked_ids;
+ collectBakedTextureUUIDs(baked_ids);
+ return allTexturesCompletelyDownloaded(baked_ids);
}
std::string LLVOAvatar::bakedTextureOriginInfo()
{
- std::string result;
-
- std::set<LLUUID> baked_ids;
- collectBakedTextureUUIDs(baked_ids);
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- ETextureIndex texture_index = mBakedTextureDatas[i].mTextureIndex;
- LLViewerFetchedTexture *imagep =
- LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE);
- if (!imagep ||
- imagep->getID() == IMG_DEFAULT ||
- imagep->getID() == IMG_DEFAULT_AVATAR)
-
- {
- result += "-";
- }
- else
- {
- bool has_url = false, has_host = false;
- if (!imagep->getUrl().empty())
- {
- has_url = true;
- }
- if (imagep->getTargetHost().isOk())
- {
- has_host = true;
- }
- S32 discard = imagep->getDiscardLevel();
- if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url
- else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim
- else if (has_host && has_url) result += discard ? "x" : "X"; // both origins?
- else if (!has_host && !has_url) result += discard ? "n" : "N"; // no origin?
- if (discard != 0)
- {
- result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel());
- }
- }
-
- }
- return result;
+ std::string result;
+
+ std::set<LLUUID> baked_ids;
+ collectBakedTextureUUIDs(baked_ids);
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ ETextureIndex texture_index = mBakedTextureDatas[i].mTextureIndex;
+ LLViewerFetchedTexture *imagep =
+ LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE);
+ if (!imagep ||
+ imagep->getID() == IMG_DEFAULT ||
+ imagep->getID() == IMG_DEFAULT_AVATAR)
+
+ {
+ result += "-";
+ }
+ else
+ {
+ bool has_url = false, has_host = false;
+ if (!imagep->getUrl().empty())
+ {
+ has_url = true;
+ }
+ if (imagep->getTargetHost().isOk())
+ {
+ has_host = true;
+ }
+ S32 discard = imagep->getDiscardLevel();
+ if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url
+ else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim
+ else if (has_host && has_url) result += discard ? "x" : "X"; // both origins?
+ else if (!has_host && !has_url) result += discard ? "n" : "N"; // no origin?
+ if (discard != 0)
+ {
+ result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel());
+ }
+ }
+
+ }
+ return result;
}
S32Bytes LLVOAvatar::totalTextureMemForUUIDS(std::set<LLUUID>& ids)
{
- S32Bytes result(0);
- for (std::set<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
- if (imagep)
- {
- result += imagep->getTextureMemory();
- }
- }
- return result;
-}
-
+ S32Bytes result(0);
+ for (std::set<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
+ if (imagep)
+ {
+ result += imagep->getTextureMemory();
+ }
+ }
+ return result;
+}
+
void LLVOAvatar::collectLocalTextureUUIDs(std::set<LLUUID>& ids) const
{
- for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++)
- {
- LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex)texture_index);
- U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
-
- LLViewerFetchedTexture *imagep = NULL;
- for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++)
- {
- imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE);
- if (imagep)
- {
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)texture_index);
- if (texture_dict && texture_dict->mIsLocalTexture)
- {
- ids.insert(imagep->getID());
- }
- }
- }
- }
- ids.erase(IMG_DEFAULT);
- ids.erase(IMG_DEFAULT_AVATAR);
- ids.erase(IMG_INVISIBLE);
+ for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++)
+ {
+ LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex)texture_index);
+ U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
+
+ LLViewerFetchedTexture *imagep = NULL;
+ for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++)
+ {
+ imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE);
+ if (imagep)
+ {
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)texture_index);
+ if (texture_dict && texture_dict->mIsLocalTexture)
+ {
+ ids.insert(imagep->getID());
+ }
+ }
+ }
+ }
+ ids.erase(IMG_DEFAULT);
+ ids.erase(IMG_DEFAULT_AVATAR);
+ ids.erase(IMG_INVISIBLE);
}
void LLVOAvatar::collectBakedTextureUUIDs(std::set<LLUUID>& ids) const
{
- for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++)
- {
- LLViewerFetchedTexture *imagep = NULL;
- if (isIndexBakedTexture((ETextureIndex) texture_index))
- {
- imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE);
- if (imagep)
- {
- ids.insert(imagep->getID());
- }
- }
- }
- ids.erase(IMG_DEFAULT);
- ids.erase(IMG_DEFAULT_AVATAR);
- ids.erase(IMG_INVISIBLE);
+ for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++)
+ {
+ LLViewerFetchedTexture *imagep = NULL;
+ if (isIndexBakedTexture((ETextureIndex) texture_index))
+ {
+ imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE);
+ if (imagep)
+ {
+ ids.insert(imagep->getID());
+ }
+ }
+ }
+ ids.erase(IMG_DEFAULT);
+ ids.erase(IMG_DEFAULT_AVATAR);
+ ids.erase(IMG_INVISIBLE);
}
void LLVOAvatar::collectTextureUUIDs(std::set<LLUUID>& ids)
{
- collectLocalTextureUUIDs(ids);
- collectBakedTextureUUIDs(ids);
+ collectLocalTextureUUIDs(ids);
+ collectBakedTextureUUIDs(ids);
}
void LLVOAvatar::releaseOldTextures()
{
- S32Bytes current_texture_mem;
-
- // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE"
- std::set<LLUUID> baked_texture_ids;
- collectBakedTextureUUIDs(baked_texture_ids);
- S32Bytes new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids);
-
- std::set<LLUUID> local_texture_ids;
- collectLocalTextureUUIDs(local_texture_ids);
- //S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids);
-
- std::set<LLUUID> new_texture_ids;
- new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end());
- new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end());
- S32Bytes new_total_mem = totalTextureMemForUUIDS(new_texture_ids);
-
- //S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs);
- //LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << LL_ENDL;
- if (!isSelf() && new_total_mem > new_baked_mem)
- {
- LL_WARNS() << "extra local textures stored for non-self av" << LL_ENDL;
- }
- for (std::set<LLUUID>::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it)
- {
- if (new_texture_ids.find(*it) == new_texture_ids.end())
- {
- LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
- if (imagep)
- {
- current_texture_mem += imagep->getTextureMemory();
- if (imagep->getTextureState() == LLGLTexture::NO_DELETE)
- {
- // This will allow the texture to be deleted if not in use.
- imagep->forceActive();
-
- // This resets the clock to texture being flagged
- // as unused, preventing the texture from being
- // deleted immediately. If other avatars or
- // objects are using it, it can still be flagged
- // no-delete by them.
- imagep->forceUpdateBindStats();
- }
- }
- }
- }
- mTextureIDs = new_texture_ids;
+ S32Bytes current_texture_mem;
+
+ // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE"
+ std::set<LLUUID> baked_texture_ids;
+ collectBakedTextureUUIDs(baked_texture_ids);
+ S32Bytes new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids);
+
+ std::set<LLUUID> local_texture_ids;
+ collectLocalTextureUUIDs(local_texture_ids);
+ //S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids);
+
+ std::set<LLUUID> new_texture_ids;
+ new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end());
+ new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end());
+ S32Bytes new_total_mem = totalTextureMemForUUIDS(new_texture_ids);
+
+ //S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs);
+ //LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << LL_ENDL;
+ if (!isSelf() && new_total_mem > new_baked_mem)
+ {
+ LL_WARNS() << "extra local textures stored for non-self av" << LL_ENDL;
+ }
+ for (std::set<LLUUID>::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it)
+ {
+ if (new_texture_ids.find(*it) == new_texture_ids.end())
+ {
+ LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
+ if (imagep)
+ {
+ current_texture_mem += imagep->getTextureMemory();
+ if (imagep->getTextureState() == LLGLTexture::NO_DELETE)
+ {
+ // This will allow the texture to be deleted if not in use.
+ imagep->forceActive();
+
+ // This resets the clock to texture being flagged
+ // as unused, preventing the texture from being
+ // deleted immediately. If other avatars or
+ // objects are using it, it can still be flagged
+ // no-delete by them.
+ imagep->forceUpdateBindStats();
+ }
+ }
+ }
+ }
+ mTextureIDs = new_texture_ids;
}
void LLVOAvatar::updateTextures()
{
- releaseOldTextures();
-
- BOOL render_avatar = TRUE;
-
- if (mIsDummy)
- {
- return;
- }
-
- if( isSelf() )
- {
- render_avatar = TRUE;
- }
- else
- {
- if(!isVisible())
- {
- return ;//do not update for invisible avatar.
- }
-
- render_avatar = !mCulled; //visible and not culled.
- }
-
- std::vector<BOOL> layer_baked;
- // GL NOT ACTIVE HERE - *TODO
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- layer_baked.push_back(isTextureDefined(mBakedTextureDatas[i].mTextureIndex));
- // bind the texture so that they'll be decoded slightly
- // inefficient, we can short-circuit this if we have to
- if (render_avatar && !gGLManager.mIsDisabled)
- {
- if (layer_baked[i] && !mBakedTextureDatas[i].mIsLoaded)
- {
- gGL.getTexUnit(0)->bind(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ));
- }
- }
- }
-
- mMaxPixelArea = 0.f;
- mMinPixelArea = 99999999.f;
- mHasGrey = FALSE; // debug
- for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++)
- {
- LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex)texture_index);
- U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
- const LLTextureEntry *te = getTE(texture_index);
-
- // getTE can return 0.
- // Not sure yet why it does, but of course it crashes when te->mScale? gets used.
- // Put safeguard in place so this corner case get better handling and does not result in a crash.
- F32 texel_area_ratio = 1.0f;
- if( te )
- {
- texel_area_ratio = fabs(te->mScaleS * te->mScaleT);
- }
- else
- {
- LL_WARNS() << "getTE( " << texture_index << " ) returned 0" <<LL_ENDL;
- }
-
- LLViewerFetchedTexture *imagep = NULL;
- for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++)
- {
- imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE);
- if (imagep)
- {
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)texture_index);
- const EBakedTextureIndex baked_index = texture_dict ? texture_dict->mBakedTextureIndex : EBakedTextureIndex::BAKED_NUM_INDICES;
- if (texture_dict && texture_dict->mIsLocalTexture)
- {
- addLocalTextureStats((ETextureIndex)texture_index, imagep, texel_area_ratio, render_avatar, mBakedTextureDatas[baked_index].mIsUsed);
- }
- }
- }
- if (isIndexBakedTexture((ETextureIndex) texture_index) && render_avatar)
- {
- const S32 boost_level = getAvatarBakedBoostLevel();
- imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE);
- addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level );
- }
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
- {
- setDebugText(llformat("%4.0f:%4.0f", (F32) sqrt(mMinPixelArea),(F32) sqrt(mMaxPixelArea)));
- }
+ releaseOldTextures();
+
+ BOOL render_avatar = TRUE;
+
+ if (mIsDummy)
+ {
+ return;
+ }
+
+ if( isSelf() )
+ {
+ render_avatar = TRUE;
+ }
+ else
+ {
+ if(!isVisible())
+ {
+ return ;//do not update for invisible avatar.
+ }
+
+ render_avatar = !mCulled; //visible and not culled.
+ }
+
+ std::vector<BOOL> layer_baked;
+ // GL NOT ACTIVE HERE - *TODO
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ layer_baked.push_back(isTextureDefined(mBakedTextureDatas[i].mTextureIndex));
+ // bind the texture so that they'll be decoded slightly
+ // inefficient, we can short-circuit this if we have to
+ if (render_avatar && !gGLManager.mIsDisabled)
+ {
+ if (layer_baked[i] && !mBakedTextureDatas[i].mIsLoaded)
+ {
+ gGL.getTexUnit(0)->bind(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ));
+ }
+ }
+ }
+
+ mMaxPixelArea = 0.f;
+ mMinPixelArea = 99999999.f;
+ mHasGrey = FALSE; // debug
+ for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++)
+ {
+ LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex)texture_index);
+ U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
+ const LLTextureEntry *te = getTE(texture_index);
+
+ // getTE can return 0.
+ // Not sure yet why it does, but of course it crashes when te->mScale? gets used.
+ // Put safeguard in place so this corner case get better handling and does not result in a crash.
+ F32 texel_area_ratio = 1.0f;
+ if( te )
+ {
+ texel_area_ratio = fabs(te->mScaleS * te->mScaleT);
+ }
+ else
+ {
+ LL_WARNS() << "getTE( " << texture_index << " ) returned 0" <<LL_ENDL;
+ }
+
+ LLViewerFetchedTexture *imagep = NULL;
+ for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++)
+ {
+ imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE);
+ if (imagep)
+ {
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)texture_index);
+ const EBakedTextureIndex baked_index = texture_dict ? texture_dict->mBakedTextureIndex : EBakedTextureIndex::BAKED_NUM_INDICES;
+ if (texture_dict && texture_dict->mIsLocalTexture)
+ {
+ addLocalTextureStats((ETextureIndex)texture_index, imagep, texel_area_ratio, render_avatar, mBakedTextureDatas[baked_index].mIsUsed);
+ }
+ }
+ }
+ if (isIndexBakedTexture((ETextureIndex) texture_index) && render_avatar)
+ {
+ const S32 boost_level = getAvatarBakedBoostLevel();
+ imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE);
+ addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level );
+ }
+ }
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
+ {
+ setDebugText(llformat("%4.0f:%4.0f", (F32) sqrt(mMinPixelArea),(F32) sqrt(mMaxPixelArea)));
+ }
}
void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerFetchedTexture* imagep,
- F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked)
+ F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked)
{
- // No local texture stats for non-self avatars
- return;
+ // No local texture stats for non-self avatars
+ return;
}
-const S32 MAX_TEXTURE_UPDATE_INTERVAL = 64 ; //need to call updateTextures() at least every 32 frames.
+const S32 MAX_TEXTURE_UPDATE_INTERVAL = 64 ; //need to call updateTextures() at least every 32 frames.
const S32 MAX_TEXTURE_VIRTUAL_SIZE_RESET_INTERVAL = S32_MAX ; //frames
void LLVOAvatar::checkTextureLoading()
{
- static const F32 MAX_INVISIBLE_WAITING_TIME = 15.f ; //seconds
+ static const F32 MAX_INVISIBLE_WAITING_TIME = 15.f ; //seconds
- BOOL pause = !isVisible() ;
- if(!pause)
- {
- mInvisibleTimer.reset() ;
- }
- if(mLoadedCallbacksPaused == pause)
- {
+ BOOL pause = !isVisible() ;
+ if(!pause)
+ {
+ mInvisibleTimer.reset() ;
+ }
+ if(mLoadedCallbacksPaused == pause)
+ {
if (!pause && mFirstFullyVisible && mLoadedCallbackTextures < mCallbackTextureList.size())
{
// We still need to update 'loaded' textures count to decide on 'cloud' visibility
@@ -5649,120 +5649,120 @@ void LLVOAvatar::checkTextureLoading()
}
}
}
- return ;
- }
-
- if(mCallbackTextureList.empty()) //when is self or no callbacks. Note: this list for self is always empty.
- {
- mLoadedCallbacksPaused = pause ;
- mLoadedCallbackTextures = 0;
- return ; //nothing to check.
- }
-
- if(pause && mInvisibleTimer.getElapsedTimeF32() < MAX_INVISIBLE_WAITING_TIME)
- {
- return ; //have not been invisible for enough time.
- }
-
- mLoadedCallbackTextures = pause ? mCallbackTextureList.size() : 0;
-
- for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin();
- iter != mCallbackTextureList.end(); ++iter)
- {
- LLViewerFetchedTexture* tex = gTextureList.findImage(*iter) ;
- if(tex)
- {
- if(pause)//pause texture fetching.
- {
- tex->pauseLoadedCallbacks(&mCallbackTextureList) ;
-
- //set to terminate texture fetching after MAX_TEXTURE_UPDATE_INTERVAL frames.
- tex->setMaxVirtualSizeResetInterval(MAX_TEXTURE_UPDATE_INTERVAL);
- tex->resetMaxVirtualSizeResetCounter() ;
- }
- else//unpause
- {
- static const F32 START_AREA = 100.f ;
-
- tex->unpauseLoadedCallbacks(&mCallbackTextureList) ;
- tex->addTextureStats(START_AREA); //jump start the fetching again
-
- // technically shouldn't need to account for missing, but callback might not have happened yet
- if (tex->getDiscardLevel() >= 0 || tex->isMissingAsset())
- {
- mLoadedCallbackTextures++; // consider it loaded (we have at least some data)
- }
- }
- }
- }
-
- if(!pause)
- {
- updateTextures() ; //refresh texture stats.
- }
- mLoadedCallbacksPaused = pause ;
- return ;
+ return ;
+ }
+
+ if(mCallbackTextureList.empty()) //when is self or no callbacks. Note: this list for self is always empty.
+ {
+ mLoadedCallbacksPaused = pause ;
+ mLoadedCallbackTextures = 0;
+ return ; //nothing to check.
+ }
+
+ if(pause && mInvisibleTimer.getElapsedTimeF32() < MAX_INVISIBLE_WAITING_TIME)
+ {
+ return ; //have not been invisible for enough time.
+ }
+
+ mLoadedCallbackTextures = pause ? mCallbackTextureList.size() : 0;
+
+ for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin();
+ iter != mCallbackTextureList.end(); ++iter)
+ {
+ LLViewerFetchedTexture* tex = gTextureList.findImage(*iter) ;
+ if(tex)
+ {
+ if(pause)//pause texture fetching.
+ {
+ tex->pauseLoadedCallbacks(&mCallbackTextureList) ;
+
+ //set to terminate texture fetching after MAX_TEXTURE_UPDATE_INTERVAL frames.
+ tex->setMaxVirtualSizeResetInterval(MAX_TEXTURE_UPDATE_INTERVAL);
+ tex->resetMaxVirtualSizeResetCounter() ;
+ }
+ else//unpause
+ {
+ static const F32 START_AREA = 100.f ;
+
+ tex->unpauseLoadedCallbacks(&mCallbackTextureList) ;
+ tex->addTextureStats(START_AREA); //jump start the fetching again
+
+ // technically shouldn't need to account for missing, but callback might not have happened yet
+ if (tex->getDiscardLevel() >= 0 || tex->isMissingAsset())
+ {
+ mLoadedCallbackTextures++; // consider it loaded (we have at least some data)
+ }
+ }
+ }
+ }
+
+ if(!pause)
+ {
+ updateTextures() ; //refresh texture stats.
+ }
+ mLoadedCallbacksPaused = pause ;
+ return ;
}
const F32 SELF_ADDITIONAL_PRI = 0.75f ;
void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level)
{
- //Note:
- //if this function is not called for the last MAX_TEXTURE_VIRTUAL_SIZE_RESET_INTERVAL frames,
- //the texture pipeline will stop fetching this texture.
+ //Note:
+ //if this function is not called for the last MAX_TEXTURE_VIRTUAL_SIZE_RESET_INTERVAL frames,
+ //the texture pipeline will stop fetching this texture.
- imagep->resetTextureStats();
- imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTUAL_SIZE_RESET_INTERVAL);
- imagep->resetMaxVirtualSizeResetCounter() ;
+ imagep->resetTextureStats();
+ imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTUAL_SIZE_RESET_INTERVAL);
+ imagep->resetMaxVirtualSizeResetCounter() ;
- mMaxPixelArea = llmax(pixel_area, mMaxPixelArea);
- mMinPixelArea = llmin(pixel_area, mMinPixelArea);
- imagep->addTextureStats(pixel_area / texel_area_ratio);
- imagep->setBoostLevel(boost_level);
+ mMaxPixelArea = llmax(pixel_area, mMaxPixelArea);
+ mMinPixelArea = llmin(pixel_area, mMinPixelArea);
+ imagep->addTextureStats(pixel_area / texel_area_ratio);
+ imagep->setBoostLevel(boost_level);
}
-//virtual
+//virtual
void LLVOAvatar::setImage(const U8 te, LLViewerTexture *imagep, const U32 index)
{
- setTEImage(te, imagep);
+ setTEImage(te, imagep);
}
-//virtual
+//virtual
LLViewerTexture* LLVOAvatar::getImage(const U8 te, const U32 index) const
{
- return getTEImage(te);
+ return getTEImage(te);
}
-//virtual
+//virtual
const LLTextureEntry* LLVOAvatar::getTexEntry(const U8 te_num) const
{
- return getTE(te_num);
+ return getTE(te_num);
}
-//virtual
+//virtual
void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te)
{
- setTE(index, te);
+ setTE(index, te);
}
const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid)
{
- llassert(isIndexBakedTexture(ETextureIndex(te)));
- std::string url = "";
- const std::string& appearance_service_url = LLAppearanceMgr::instance().getAppearanceServiceURL();
- if (appearance_service_url.empty())
- {
- // Probably a server-side issue if we get here:
- LL_WARNS() << "AgentAppearanceServiceURL not set - Baked texture requests will fail" << LL_ENDL;
- return url;
- }
-
- const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)te);
- if (texture_entry != NULL)
- {
- url = appearance_service_url + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString();
- //LL_INFOS() << "baked texture url: " << url << LL_ENDL;
- }
- return url;
+ llassert(isIndexBakedTexture(ETextureIndex(te)));
+ std::string url = "";
+ const std::string& appearance_service_url = LLAppearanceMgr::instance().getAppearanceServiceURL();
+ if (appearance_service_url.empty())
+ {
+ // Probably a server-side issue if we get here:
+ LL_WARNS() << "AgentAppearanceServiceURL not set - Baked texture requests will fail" << LL_ENDL;
+ return url;
+ }
+
+ const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)te);
+ if (texture_entry != NULL)
+ {
+ url = appearance_service_url + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString();
+ //LL_INFOS() << "baked texture url: " << url << LL_ENDL;
+ }
+ return url;
}
//-----------------------------------------------------------------------------
@@ -5771,47 +5771,47 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid)
void LLVOAvatar::resolveHeightAgent(const LLVector3 &in_pos_agent, LLVector3 &out_pos_agent, LLVector3 &out_norm)
{
- LLVector3d in_pos_global, out_pos_global;
+ LLVector3d in_pos_global, out_pos_global;
- in_pos_global = gAgent.getPosGlobalFromAgent(in_pos_agent);
- resolveHeightGlobal(in_pos_global, out_pos_global, out_norm);
- out_pos_agent = gAgent.getPosAgentFromGlobal(out_pos_global);
+ in_pos_global = gAgent.getPosGlobalFromAgent(in_pos_agent);
+ resolveHeightGlobal(in_pos_global, out_pos_global, out_norm);
+ out_pos_agent = gAgent.getPosAgentFromGlobal(out_pos_global);
}
void LLVOAvatar::resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm)
{
- LLViewerObject *obj;
- LLWorld::getInstance()->resolveStepHeightGlobal(this, start_pt, end_pt, out_pos, out_norm, &obj);
+ LLViewerObject *obj;
+ LLWorld::getInstance()->resolveStepHeightGlobal(this, start_pt, end_pt, out_pos, out_norm, &obj);
}
void LLVOAvatar::resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm)
{
- LLVector3d zVec(0.0f, 0.0f, 0.5f);
- LLVector3d p0 = inPos + zVec;
- LLVector3d p1 = inPos - zVec;
- LLViewerObject *obj;
- LLWorld::getInstance()->resolveStepHeightGlobal(this, p0, p1, outPos, outNorm, &obj);
- if (!obj)
- {
- mStepOnLand = TRUE;
- mStepMaterial = 0;
- mStepObjectVelocity.setVec(0.0f, 0.0f, 0.0f);
- }
- else
- {
- mStepOnLand = FALSE;
- mStepMaterial = obj->getMaterial();
+ LLVector3d zVec(0.0f, 0.0f, 0.5f);
+ LLVector3d p0 = inPos + zVec;
+ LLVector3d p1 = inPos - zVec;
+ LLViewerObject *obj;
+ LLWorld::getInstance()->resolveStepHeightGlobal(this, p0, p1, outPos, outNorm, &obj);
+ if (!obj)
+ {
+ mStepOnLand = TRUE;
+ mStepMaterial = 0;
+ mStepObjectVelocity.setVec(0.0f, 0.0f, 0.0f);
+ }
+ else
+ {
+ mStepOnLand = FALSE;
+ mStepMaterial = obj->getMaterial();
- // We want the primitive velocity, not our velocity... (which actually subtracts the
- // step object velocity)
- LLVector3 angularVelocity = obj->getAngularVelocity();
- LLVector3 relativePos = gAgent.getPosAgentFromGlobal(outPos) - obj->getPositionAgent();
+ // We want the primitive velocity, not our velocity... (which actually subtracts the
+ // step object velocity)
+ LLVector3 angularVelocity = obj->getAngularVelocity();
+ LLVector3 relativePos = gAgent.getPosAgentFromGlobal(outPos) - obj->getPositionAgent();
- LLVector3 linearComponent = angularVelocity % relativePos;
-// LL_INFOS() << "Linear Component of Rotation Velocity " << linearComponent << LL_ENDL;
- mStepObjectVelocity = obj->getVelocity() + linearComponent;
- }
+ LLVector3 linearComponent = angularVelocity % relativePos;
+// LL_INFOS() << "Linear Component of Rotation Velocity " << linearComponent << LL_ENDL;
+ mStepObjectVelocity = obj->getVelocity() + linearComponent;
+ }
}
@@ -5820,12 +5820,12 @@ void LLVOAvatar::resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos
//-----------------------------------------------------------------------------
const LLUUID& LLVOAvatar::getStepSound() const
{
- if ( mStepOnLand )
- {
- return sStepSoundOnLand;
- }
+ if ( mStepOnLand )
+ {
+ return sStepSoundOnLand;
+ }
- return sStepSounds[mStepMaterial];
+ return sStepSounds[mStepMaterial];
}
@@ -5834,106 +5834,106 @@ const LLUUID& LLVOAvatar::getStepSound() const
//-----------------------------------------------------------------------------
void LLVOAvatar::processAnimationStateChanges()
{
- if ( isAnyAnimationSignaled(AGENT_WALK_ANIMS, NUM_AGENT_WALK_ANIMS) )
- {
- startMotion(ANIM_AGENT_WALK_ADJUST);
- stopMotion(ANIM_AGENT_FLY_ADJUST);
- }
- else if (mInAir && !isSitting())
- {
- stopMotion(ANIM_AGENT_WALK_ADJUST);
+ if ( isAnyAnimationSignaled(AGENT_WALK_ANIMS, NUM_AGENT_WALK_ANIMS) )
+ {
+ startMotion(ANIM_AGENT_WALK_ADJUST);
+ stopMotion(ANIM_AGENT_FLY_ADJUST);
+ }
+ else if (mInAir && !isSitting())
+ {
+ stopMotion(ANIM_AGENT_WALK_ADJUST);
if (mEnableDefaultMotions)
{
- startMotion(ANIM_AGENT_FLY_ADJUST);
- }
- }
- else
- {
- stopMotion(ANIM_AGENT_WALK_ADJUST);
- stopMotion(ANIM_AGENT_FLY_ADJUST);
- }
-
- if ( isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
- {
+ startMotion(ANIM_AGENT_FLY_ADJUST);
+ }
+ }
+ else
+ {
+ stopMotion(ANIM_AGENT_WALK_ADJUST);
+ stopMotion(ANIM_AGENT_FLY_ADJUST);
+ }
+
+ if ( isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
+ {
if (mEnableDefaultMotions)
{
- startMotion(ANIM_AGENT_TARGET);
+ startMotion(ANIM_AGENT_TARGET);
}
- stopMotion(ANIM_AGENT_BODY_NOISE);
- }
- else
- {
- stopMotion(ANIM_AGENT_TARGET);
+ stopMotion(ANIM_AGENT_BODY_NOISE);
+ }
+ else
+ {
+ stopMotion(ANIM_AGENT_TARGET);
if (mEnableDefaultMotions)
{
- startMotion(ANIM_AGENT_BODY_NOISE);
- }
- }
-
- // clear all current animations
- AnimIterator anim_it;
- for (anim_it = mPlayingAnimations.begin(); anim_it != mPlayingAnimations.end();)
- {
- AnimIterator found_anim = mSignaledAnimations.find(anim_it->first);
-
- // playing, but not signaled, so stop
- if (found_anim == mSignaledAnimations.end())
- {
- processSingleAnimationStateChange(anim_it->first, FALSE);
- mPlayingAnimations.erase(anim_it++);
- continue;
- }
-
- ++anim_it;
- }
-
- // if jellydolled, shelve all playing animations
- if (getOverallAppearance() != AOA_NORMAL)
- {
- mPlayingAnimations.clear();
- }
-
- // start up all new anims
- if (getOverallAppearance() == AOA_NORMAL)
- {
- for (anim_it = mSignaledAnimations.begin(); anim_it != mSignaledAnimations.end();)
- {
- AnimIterator found_anim = mPlayingAnimations.find(anim_it->first);
-
- // signaled but not playing, or different sequence id, start motion
- if (found_anim == mPlayingAnimations.end() || found_anim->second != anim_it->second)
- {
- if (processSingleAnimationStateChange(anim_it->first, TRUE))
- {
- mPlayingAnimations[anim_it->first] = anim_it->second;
- ++anim_it;
- continue;
- }
- }
-
- ++anim_it;
- }
- }
-
- // clear source information for animations which have been stopped
- if (isSelf())
- {
- AnimSourceIterator source_it = mAnimationSources.begin();
-
- for (source_it = mAnimationSources.begin(); source_it != mAnimationSources.end();)
- {
- if (mSignaledAnimations.find(source_it->second) == mSignaledAnimations.end())
- {
- mAnimationSources.erase(source_it++);
- }
- else
- {
- ++source_it;
- }
- }
- }
-
- stop_glerror();
+ startMotion(ANIM_AGENT_BODY_NOISE);
+ }
+ }
+
+ // clear all current animations
+ AnimIterator anim_it;
+ for (anim_it = mPlayingAnimations.begin(); anim_it != mPlayingAnimations.end();)
+ {
+ AnimIterator found_anim = mSignaledAnimations.find(anim_it->first);
+
+ // playing, but not signaled, so stop
+ if (found_anim == mSignaledAnimations.end())
+ {
+ processSingleAnimationStateChange(anim_it->first, FALSE);
+ mPlayingAnimations.erase(anim_it++);
+ continue;
+ }
+
+ ++anim_it;
+ }
+
+ // if jellydolled, shelve all playing animations
+ if (getOverallAppearance() != AOA_NORMAL)
+ {
+ mPlayingAnimations.clear();
+ }
+
+ // start up all new anims
+ if (getOverallAppearance() == AOA_NORMAL)
+ {
+ for (anim_it = mSignaledAnimations.begin(); anim_it != mSignaledAnimations.end();)
+ {
+ AnimIterator found_anim = mPlayingAnimations.find(anim_it->first);
+
+ // signaled but not playing, or different sequence id, start motion
+ if (found_anim == mPlayingAnimations.end() || found_anim->second != anim_it->second)
+ {
+ if (processSingleAnimationStateChange(anim_it->first, TRUE))
+ {
+ mPlayingAnimations[anim_it->first] = anim_it->second;
+ ++anim_it;
+ continue;
+ }
+ }
+
+ ++anim_it;
+ }
+ }
+
+ // clear source information for animations which have been stopped
+ if (isSelf())
+ {
+ AnimSourceIterator source_it = mAnimationSources.begin();
+
+ for (source_it = mAnimationSources.begin(); source_it != mAnimationSources.end();)
+ {
+ if (mSignaledAnimations.find(source_it->second) == mSignaledAnimations.end())
+ {
+ mAnimationSources.erase(source_it++);
+ }
+ else
+ {
+ ++source_it;
+ }
+ }
+ }
+
+ stop_glerror();
}
@@ -5947,66 +5947,66 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL
// cause constant jiggling of the body or camera. Possible
// compromise is to do it on animation changes:
computeBodySize();
-
- BOOL result = FALSE;
-
- if ( start ) // start animation
- {
- if (anim_id == ANIM_AGENT_TYPE)
- {
- if (gAudiop)
- {
- LLVector3d char_pos_global = gAgent.getPosGlobalFromAgent(getCharacterPosition());
- if (LLViewerParcelMgr::getInstance()->canHearSound(char_pos_global)
- && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds))
- {
- // RN: uncomment this to play on typing sound at fixed volume once sound engine is fixed
- // to support both spatialized and non-spatialized instances of the same sound
- //if (isSelf())
- //{
- // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
- //}
- //else
- {
+
+ BOOL result = FALSE;
+
+ if ( start ) // start animation
+ {
+ if (anim_id == ANIM_AGENT_TYPE)
+ {
+ if (gAudiop)
+ {
+ LLVector3d char_pos_global = gAgent.getPosGlobalFromAgent(getCharacterPosition());
+ if (LLViewerParcelMgr::getInstance()->canHearSound(char_pos_global)
+ && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds))
+ {
+ // RN: uncomment this to play on typing sound at fixed volume once sound engine is fixed
+ // to support both spatialized and non-spatialized instances of the same sound
+ //if (isSelf())
+ //{
+ // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
+ //}
+ //else
+ {
static LLCachedControl<std::string> ui_snd_string(gSavedSettings, "UISndTyping");
- LLUUID sound_id = LLUUID(ui_snd_string);
- gAudiop->triggerSound(sound_id, getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_SFX, char_pos_global);
- }
- }
- }
- }
- else if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED)
- {
- sitDown(TRUE);
- }
-
-
- if (startMotion(anim_id))
- {
- result = TRUE;
- }
- else
- {
- LL_WARNS("Motion") << "Failed to start motion!" << LL_ENDL;
- }
- }
- else //stop animation
- {
- if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED)
- {
- sitDown(FALSE);
- }
- if ((anim_id == ANIM_AGENT_DO_NOT_DISTURB) && gAgent.isDoNotDisturb())
- {
- // re-assert DND tag animation
- gAgent.sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, ANIM_REQUEST_START);
- return result;
- }
- stopMotion(anim_id);
- result = TRUE;
- }
-
- return result;
+ LLUUID sound_id = LLUUID(ui_snd_string);
+ gAudiop->triggerSound(sound_id, getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_SFX, char_pos_global);
+ }
+ }
+ }
+ }
+ else if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED)
+ {
+ sitDown(TRUE);
+ }
+
+
+ if (startMotion(anim_id))
+ {
+ result = TRUE;
+ }
+ else
+ {
+ LL_WARNS("Motion") << "Failed to start motion!" << LL_ENDL;
+ }
+ }
+ else //stop animation
+ {
+ if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED)
+ {
+ sitDown(FALSE);
+ }
+ if ((anim_id == ANIM_AGENT_DO_NOT_DISTURB) && gAgent.isDoNotDisturb())
+ {
+ // re-assert DND tag animation
+ gAgent.sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, ANIM_REQUEST_START);
+ return result;
+ }
+ stopMotion(anim_id);
+ result = TRUE;
+ }
+
+ return result;
}
//-----------------------------------------------------------------------------
@@ -6014,14 +6014,14 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const
{
- for (S32 i = 0; i < num_anims; i++)
- {
- if(mSignaledAnimations.find(anim_array[i]) != mSignaledAnimations.end())
- {
- return TRUE;
- }
- }
- return FALSE;
+ for (S32 i = 0; i < num_anims; i++)
+ {
+ if(mSignaledAnimations.find(anim_array[i]) != mSignaledAnimations.end())
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -6029,8 +6029,8 @@ BOOL LLVOAvatar::isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_
//-----------------------------------------------------------------------------
void LLVOAvatar::resetAnimations()
{
- LLKeyframeMotion::flushKeyframeCache();
- flushAllMotions();
+ LLKeyframeMotion::flushKeyframeCache();
+ flushAllMotions();
}
// Override selectively based on avatar sex and whether we're using new
@@ -6038,52 +6038,52 @@ void LLVOAvatar::resetAnimations()
LLUUID LLVOAvatar::remapMotionID(const LLUUID& id)
{
static LLCachedControl<bool> use_new_walk_run(gSavedSettings, "UseNewWalkRun");
- LLUUID result = id;
-
- // start special case female walk for female avatars
- if (getSex() == SEX_FEMALE)
- {
- if (id == ANIM_AGENT_WALK)
- {
- if (use_new_walk_run)
- result = ANIM_AGENT_FEMALE_WALK_NEW;
- else
- result = ANIM_AGENT_FEMALE_WALK;
- }
- else if (id == ANIM_AGENT_RUN)
- {
- // There is no old female run animation, so only override
- // in one case.
- if (use_new_walk_run)
- result = ANIM_AGENT_FEMALE_RUN_NEW;
- }
- else if (id == ANIM_AGENT_SIT)
- {
- result = ANIM_AGENT_SIT_FEMALE;
- }
- }
- else
- {
- // Male avatar.
- if (id == ANIM_AGENT_WALK)
- {
- if (use_new_walk_run)
- result = ANIM_AGENT_WALK_NEW;
- }
- else if (id == ANIM_AGENT_RUN)
- {
- if (use_new_walk_run)
- result = ANIM_AGENT_RUN_NEW;
- }
- // keeps in sync with setSex() related code (viewer controls sit's sex)
- else if (id == ANIM_AGENT_SIT_FEMALE)
- {
- result = ANIM_AGENT_SIT;
- }
-
- }
-
- return result;
+ LLUUID result = id;
+
+ // start special case female walk for female avatars
+ if (getSex() == SEX_FEMALE)
+ {
+ if (id == ANIM_AGENT_WALK)
+ {
+ if (use_new_walk_run)
+ result = ANIM_AGENT_FEMALE_WALK_NEW;
+ else
+ result = ANIM_AGENT_FEMALE_WALK;
+ }
+ else if (id == ANIM_AGENT_RUN)
+ {
+ // There is no old female run animation, so only override
+ // in one case.
+ if (use_new_walk_run)
+ result = ANIM_AGENT_FEMALE_RUN_NEW;
+ }
+ else if (id == ANIM_AGENT_SIT)
+ {
+ result = ANIM_AGENT_SIT_FEMALE;
+ }
+ }
+ else
+ {
+ // Male avatar.
+ if (id == ANIM_AGENT_WALK)
+ {
+ if (use_new_walk_run)
+ result = ANIM_AGENT_WALK_NEW;
+ }
+ else if (id == ANIM_AGENT_RUN)
+ {
+ if (use_new_walk_run)
+ result = ANIM_AGENT_RUN_NEW;
+ }
+ // keeps in sync with setSex() related code (viewer controls sit's sex)
+ else if (id == ANIM_AGENT_SIT_FEMALE)
+ {
+ result = ANIM_AGENT_SIT;
+ }
+
+ }
+
+ return result;
}
@@ -6094,21 +6094,21 @@ LLUUID LLVOAvatar::remapMotionID(const LLUUID& id)
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
{
- LL_DEBUGS("Motion") << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL;
+ LL_DEBUGS("Motion") << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL;
- LLUUID remap_id = remapMotionID(id);
+ LLUUID remap_id = remapMotionID(id);
- if (remap_id != id)
- {
- LL_DEBUGS("Motion") << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << LL_ENDL;
- }
+ if (remap_id != id)
+ {
+ LL_DEBUGS("Motion") << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << LL_ENDL;
+ }
- if (isSelf() && remap_id == ANIM_AGENT_AWAY)
- {
- gAgent.setAFK();
- }
+ if (isSelf() && remap_id == ANIM_AGENT_AWAY)
+ {
+ gAgent.setAFK();
+ }
- return LLCharacter::startMotion(remap_id, time_offset);
+ return LLCharacter::startMotion(remap_id, time_offset);
}
//-----------------------------------------------------------------------------
@@ -6116,21 +6116,21 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
{
- LL_DEBUGS("Motion") << "Motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL;
+ LL_DEBUGS("Motion") << "Motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL;
- LLUUID remap_id = remapMotionID(id);
-
- if (remap_id != id)
- {
- LL_DEBUGS("Motion") << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << LL_ENDL;
- }
+ LLUUID remap_id = remapMotionID(id);
- if (isSelf())
- {
- gAgent.onAnimStop(remap_id);
- }
+ if (remap_id != id)
+ {
+ LL_DEBUGS("Motion") << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << LL_ENDL;
+ }
- return LLCharacter::stopMotion(remap_id, stop_immediate);
+ if (isSelf())
+ {
+ gAgent.onAnimStop(remap_id);
+ }
+
+ return LLCharacter::stopMotion(remap_id, stop_immediate);
}
//-----------------------------------------------------------------------------
@@ -6139,7 +6139,7 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
// virtual
bool LLVOAvatar::hasMotionFromSource(const LLUUID& source_id)
{
- return false;
+ return false;
}
//-----------------------------------------------------------------------------
@@ -6155,8 +6155,8 @@ void LLVOAvatar::stopMotionFromSource(const LLUUID& source_id)
//-----------------------------------------------------------------------------
void LLVOAvatar::addDebugText(const std::string& text)
{
- mDebugText.append(1, '\n');
- mDebugText.append(text);
+ mDebugText.append(1, '\n');
+ mDebugText.append(text);
}
//-----------------------------------------------------------------------------
@@ -6164,7 +6164,7 @@ void LLVOAvatar::addDebugText(const std::string& text)
//-----------------------------------------------------------------------------
const LLUUID& LLVOAvatar::getID() const
{
- return mID;
+ return mID;
}
//-----------------------------------------------------------------------------
@@ -6173,33 +6173,33 @@ const LLUUID& LLVOAvatar::getID() const
// RN: avatar joints are multi-rooted to include screen-based attachments
LLJoint *LLVOAvatar::getJoint( const std::string &name )
{
- joint_map_t::iterator iter = mJointMap.find(name);
-
- LLJoint* jointp = NULL;
-
- if (iter == mJointMap.end() || iter->second == NULL)
- { //search for joint and cache found joint in lookup table
- if (mJointAliasMap.empty())
- {
- getJointAliases();
- }
- joint_alias_map_t::const_iterator alias_iter = mJointAliasMap.find(name);
- std::string canonical_name;
- if (alias_iter != mJointAliasMap.end())
- {
- canonical_name = alias_iter->second;
- }
- else
- {
- canonical_name = name;
- }
- jointp = mRoot->findJoint(canonical_name);
- mJointMap[name] = jointp;
- }
- else
- { //return cached pointer
- jointp = iter->second;
- }
+ joint_map_t::iterator iter = mJointMap.find(name);
+
+ LLJoint* jointp = NULL;
+
+ if (iter == mJointMap.end() || iter->second == NULL)
+ { //search for joint and cache found joint in lookup table
+ if (mJointAliasMap.empty())
+ {
+ getJointAliases();
+ }
+ joint_alias_map_t::const_iterator alias_iter = mJointAliasMap.find(name);
+ std::string canonical_name;
+ if (alias_iter != mJointAliasMap.end())
+ {
+ canonical_name = alias_iter->second;
+ }
+ else
+ {
+ canonical_name = name;
+ }
+ jointp = mRoot->findJoint(canonical_name);
+ mJointMap[name] = jointp;
+ }
+ else
+ { //return cached pointer
+ jointp = iter->second;
+ }
#ifndef LL_RELEASE_FOR_DOWNLOAD
if (jointp && jointp->getName()!="mScreen" && jointp->getName()!="mRoot")
@@ -6207,7 +6207,7 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name )
llassert(getJoint(jointp->getJointNum())==jointp);
}
#endif
- return jointp;
+ return jointp;
}
LLJoint *LLVOAvatar::getJoint( S32 joint_num )
@@ -6235,8 +6235,8 @@ LLJoint *LLVOAvatar::getJoint( S32 joint_num )
}
}
}
-
- llassert(!pJoint || pJoint->getJointNum() == joint_num);
+
+ llassert(!pJoint || pJoint->getJointNum() == joint_num);
return pJoint;
}
@@ -6249,31 +6249,31 @@ LLJoint *LLVOAvatar::getJoint( S32 joint_num )
// static
bool LLVOAvatar::getRiggedMeshID(LLViewerObject* pVO, LLUUID& mesh_id)
{
- mesh_id.setNull();
-
- //If a VO has a skin that we'll reset the joint positions to their default
- if ( pVO && pVO->mDrawable )
- {
- LLVOVolume* pVObj = pVO->mDrawable->getVOVolume();
- if ( pVObj )
- {
- const LLMeshSkinInfo* pSkinData = pVObj->getSkinInfo();
- if (pSkinData
- && pSkinData->mJointNames.size() > JOINT_COUNT_REQUIRED_FOR_FULLRIG // full rig
- && pSkinData->mAlternateBindMatrix.size() > 0 )
- {
- mesh_id = pSkinData->mMeshID;
- return true;
- }
- }
- }
- return false;
+ mesh_id.setNull();
+
+ //If a VO has a skin that we'll reset the joint positions to their default
+ if ( pVO && pVO->mDrawable )
+ {
+ LLVOVolume* pVObj = pVO->mDrawable->getVOVolume();
+ if ( pVObj )
+ {
+ const LLMeshSkinInfo* pSkinData = pVObj->getSkinInfo();
+ if (pSkinData
+ && pSkinData->mJointNames.size() > JOINT_COUNT_REQUIRED_FOR_FULLRIG // full rig
+ && pSkinData->mAlternateBindMatrix.size() > 0 )
+ {
+ mesh_id = pSkinData->mMeshID;
+ return true;
+ }
+ }
+ }
+ return false;
}
bool LLVOAvatar::jointIsRiggedTo(const LLJoint *joint) const
{
if (joint)
- {
+ {
const LLJointRiggingInfoTab& tab = mJointRiggingInfoTab;
S32 joint_num = joint->getJointNum();
if (joint_num < tab.size() && tab[joint_num].isRiggedTo())
@@ -6289,25 +6289,25 @@ void LLVOAvatar::clearAttachmentOverrides()
LLScopedContextString str("clearAttachmentOverrides " + getFullname());
for (S32 i=0; i<LL_CHARACTER_MAX_ANIMATED_JOINTS; i++)
- {
+ {
LLJoint *pJoint = getJoint(i);
if (pJoint)
{
- pJoint->clearAttachmentPosOverrides();
- pJoint->clearAttachmentScaleOverrides();
+ pJoint->clearAttachmentPosOverrides();
+ pJoint->clearAttachmentScaleOverrides();
}
- }
+ }
if (mPelvisFixups.count()>0)
{
mPelvisFixups.clear();
LLJoint* pJointPelvis = getJoint("mPelvis");
if (pJointPelvis)
- {
- pJointPelvis->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) );
+ {
+ pJointPelvis->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) );
}
- postPelvisSetRecalc();
- }
+ postPelvisSetRecalc();
+ }
mActiveOverrideMeshes.clear();
onActiveOverrideMeshesChanged();
@@ -6322,32 +6322,32 @@ void LLVOAvatar::rebuildAttachmentOverrides()
LL_DEBUGS("AnimatedObjects") << "rebuilding" << LL_ENDL;
dumpStack("AnimatedObjectsStack");
-
+
clearAttachmentOverrides();
// Handle the case that we're resetting the skeleton of an animated object.
LLControlAvatar *control_av = dynamic_cast<LLControlAvatar*>(this);
if (control_av)
- {
+ {
LLVOVolume *volp = control_av->mRootVolp;
if (volp)
{
- LL_DEBUGS("Avatar") << volp->getID() << " adding attachment overrides for root vol, prim count "
+ LL_DEBUGS("Avatar") << volp->getID() << " adding attachment overrides for root vol, prim count "
<< (S32) (1+volp->numChildren()) << LL_ENDL;
addAttachmentOverridesForObject(volp);
}
}
// Attached objects
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment *attachment_pt = (*iter).second;
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment *attachment_pt = (*iter).second;
if (attachment_pt)
{
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator at_it = attachment_pt->mAttachedObjects.begin();
- at_it != attachment_pt->mAttachedObjects.end(); ++at_it)
+ at_it != attachment_pt->mAttachedObjects.end(); ++at_it)
{
LLViewerObject *vo = at_it->get();
// Attached animated objects affect joints in their control
@@ -6375,7 +6375,7 @@ void LLVOAvatar::updateAttachmentOverrides()
dumpStack("AnimatedObjectsStack");
std::set<LLUUID> meshes_seen;
-
+
// Handle the case that we're updating the skeleton of an animated object.
LLControlAvatar *control_av = dynamic_cast<LLControlAvatar*>(this);
if (control_av)
@@ -6383,22 +6383,22 @@ void LLVOAvatar::updateAttachmentOverrides()
LLVOVolume *volp = control_av->mRootVolp;
if (volp)
{
- LL_DEBUGS("Avatar") << volp->getID() << " adding attachment overrides for root vol, prim count "
+ LL_DEBUGS("Avatar") << volp->getID() << " adding attachment overrides for root vol, prim count "
<< (S32) (1+volp->numChildren()) << LL_ENDL;
addAttachmentOverridesForObject(volp, &meshes_seen);
}
}
// Attached objects
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment *attachment_pt = (*iter).second;
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment *attachment_pt = (*iter).second;
if (attachment_pt)
{
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator at_it = attachment_pt->mAttachedObjects.begin();
- at_it != attachment_pt->mAttachedObjects.end(); ++at_it)
+ at_it != attachment_pt->mAttachedObjects.end(); ++at_it)
{
LLViewerObject *vo = at_it->get();
// Attached animated objects affect joints in their control
@@ -6412,8 +6412,8 @@ void LLVOAvatar::updateAttachmentOverrides()
}
// Remove meshes that are no longer present on the skeleton
- // have to work with a copy because removeAttachmentOverrides() will change mActiveOverrideMeshes.
- std::set<LLUUID> active_override_meshes = mActiveOverrideMeshes;
+ // have to work with a copy because removeAttachmentOverrides() will change mActiveOverrideMeshes.
+ std::set<LLUUID> active_override_meshes = mActiveOverrideMeshes;
for (std::set<LLUUID>::iterator it = active_override_meshes.begin(); it != active_override_meshes.end(); ++it)
{
if (meshes_seen.find(*it) == meshes_seen.end())
@@ -6496,63 +6496,63 @@ void LLVOAvatar::notifyAttachmentMeshLoaded()
void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LLUUID>* meshes_seen, bool recursive)
{
if (vo->getAvatar() != this && vo->getAvatarAncestor() != this)
- {
- LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL;
+ {
+ LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL;
return;
- }
+ }
LLScopedContextString str("addAttachmentOverridesForObject " + getFullname());
- if (getOverallAppearance() != AOA_NORMAL)
- {
- return;
- }
-
+ if (getOverallAppearance() != AOA_NORMAL)
+ {
+ return;
+ }
+
LL_DEBUGS("AnimatedObjects") << "adding" << LL_ENDL;
dumpStack("AnimatedObjectsStack");
-
- // Process all children
+
+ // Process all children
if (recursive)
{
- LLViewerObject::const_child_list_t& children = vo->getChildren();
- for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
- it != children.end(); ++it)
- {
- LLViewerObject *childp = *it;
+ LLViewerObject::const_child_list_t& children = vo->getChildren();
+ for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
+ it != children.end(); ++it)
+ {
+ LLViewerObject *childp = *it;
addAttachmentOverridesForObject(childp, meshes_seen, true);
}
- }
+ }
- LLVOVolume *vobj = dynamic_cast<LLVOVolume*>(vo);
- bool pelvisGotSet = false;
+ LLVOVolume *vobj = dynamic_cast<LLVOVolume*>(vo);
+ bool pelvisGotSet = false;
- if (!vobj)
- {
- return;
- }
+ if (!vobj)
+ {
+ return;
+ }
- LLViewerObject *root_object = (LLViewerObject*)vobj->getRoot();
+ LLViewerObject *root_object = (LLViewerObject*)vobj->getRoot();
LL_DEBUGS("AnimatedObjects") << "trying to add attachment overrides for root object " << root_object->getID() << " prim is " << vobj << LL_ENDL;
- if (vobj->isMesh() &&
- ((vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded()) || !gMeshRepo.meshRezEnabled()))
- {
+ if (vobj->isMesh() &&
+ ((vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded()) || !gMeshRepo.meshRezEnabled()))
+ {
LL_DEBUGS("AnimatedObjects") << "failed to add attachment overrides for root object " << root_object->getID() << " mesh asset not loaded" << LL_ENDL;
- return;
- }
- const LLMeshSkinInfo* pSkinData = vobj->getSkinInfo();
+ return;
+ }
+ const LLMeshSkinInfo* pSkinData = vobj->getSkinInfo();
- if ( vobj && vobj->isMesh() && pSkinData )
- {
- const int bindCnt = pSkinData->mAlternateBindMatrix.size();
+ if ( vobj && vobj->isMesh() && pSkinData )
+ {
+ const int bindCnt = pSkinData->mAlternateBindMatrix.size();
const int jointCnt = pSkinData->mJointNames.size();
if ((bindCnt > 0) && (bindCnt != jointCnt))
{
LL_WARNS_ONCE() << "invalid mesh, bindCnt " << bindCnt << "!= jointCnt " << jointCnt << ", joint overrides will be ignored." << LL_ENDL;
}
- if ((bindCnt > 0) && (bindCnt == jointCnt))
- {
- const F32 pelvisZOffset = pSkinData->mPelvisOffset;
- const LLUUID& mesh_id = pSkinData->mMeshID;
+ if ((bindCnt > 0) && (bindCnt == jointCnt))
+ {
+ const F32 pelvisZOffset = pSkinData->mPelvisOffset;
+ const LLUUID& mesh_id = pSkinData->mMeshID;
if (meshes_seen)
{
@@ -6561,38 +6561,38 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL
bool mesh_overrides_loaded = (mActiveOverrideMeshes.find(mesh_id) != mActiveOverrideMeshes.end());
if (mesh_overrides_loaded)
{
- LL_DEBUGS("AnimatedObjects") << "skipping add attachment overrides for " << mesh_id
+ LL_DEBUGS("AnimatedObjects") << "skipping add attachment overrides for " << mesh_id
<< " to root object " << root_object->getID()
<< ", already loaded"
<< LL_ENDL;
}
else
{
- LL_DEBUGS("AnimatedObjects") << "adding attachment overrides for " << mesh_id
+ LL_DEBUGS("AnimatedObjects") << "adding attachment overrides for " << mesh_id
<< " to root object " << root_object->getID() << LL_ENDL;
}
- bool fullRig = (jointCnt>=JOINT_COUNT_REQUIRED_FOR_FULLRIG) ? true : false;
- if ( fullRig && !mesh_overrides_loaded )
- {
- for ( int i=0; i<jointCnt; ++i )
- {
- std::string lookingForJoint = pSkinData->mJointNames[i].c_str();
- LLJoint* pJoint = getJoint( lookingForJoint );
- if (pJoint)
- {
- const LLVector3& jointPos = LLVector3(pSkinData->mAlternateBindMatrix[i].getTranslation());
+ bool fullRig = (jointCnt>=JOINT_COUNT_REQUIRED_FOR_FULLRIG) ? true : false;
+ if ( fullRig && !mesh_overrides_loaded )
+ {
+ for ( int i=0; i<jointCnt; ++i )
+ {
+ std::string lookingForJoint = pSkinData->mJointNames[i].c_str();
+ LLJoint* pJoint = getJoint( lookingForJoint );
+ if (pJoint)
+ {
+ const LLVector3& jointPos = LLVector3(pSkinData->mAlternateBindMatrix[i].getTranslation());
if (pJoint->aboveJointPosThreshold(jointPos))
{
bool override_changed;
pJoint->addAttachmentPosOverride( jointPos, mesh_id, avString(), override_changed );
-
+
if (override_changed)
{
//If joint is a pelvis then handle old/new pelvis to foot values
if ( lookingForJoint == "mPelvis" )
- {
- pelvisGotSet = true;
- }
+ {
+ pelvisGotSet = true;
+ }
}
if (pSkinData->mLockScaleIfJointPosition)
{
@@ -6601,36 +6601,36 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL
pJoint->addAttachmentScaleOverride(pJoint->getDefaultScale(), mesh_id, avString());
}
}
- }
- }
- if (pelvisZOffset != 0.0F)
- {
+ }
+ }
+ if (pelvisZOffset != 0.0F)
+ {
F32 pelvis_fixup_before;
bool has_fixup_before = hasPelvisFixup(pelvis_fixup_before);
- addPelvisFixup( pelvisZOffset, mesh_id );
- F32 pelvis_fixup_after;
+ addPelvisFixup( pelvisZOffset, mesh_id );
+ F32 pelvis_fixup_after;
hasPelvisFixup(pelvis_fixup_after); // Don't have to check bool here because we just added it...
if (!has_fixup_before || (pelvis_fixup_before != pelvis_fixup_after))
{
- pelvisGotSet = true;
+ pelvisGotSet = true;
}
-
- }
+
+ }
mActiveOverrideMeshes.insert(mesh_id);
onActiveOverrideMeshesChanged();
- }
- }
- }
+ }
+ }
+ }
else
{
LL_DEBUGS("AnimatedObjects") << "failed to add attachment overrides for root object " << root_object->getID() << " not mesh or no pSkinData" << LL_ENDL;
}
-
- //Rebuild body data if we altered joints/pelvis
- if ( pelvisGotSet )
- {
- postPelvisSetRecalc();
- }
+
+ //Rebuild body data if we altered joints/pelvis
+ if ( pelvisGotSet )
+ {
+ postPelvisSetRecalc();
+ }
}
//-----------------------------------------------------------------------------
@@ -6643,26 +6643,26 @@ void LLVOAvatar::getAttachmentOverrideNames(std::set<std::string>& pos_names, st
LLUUID mesh_id;
// Bones
- for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin();
+ for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin();
iter != mSkeleton.end(); ++iter)
- {
- const LLJoint* pJoint = (*iter);
- if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id))
- {
+ {
+ const LLJoint* pJoint = (*iter);
+ if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id))
+ {
pos_names.insert(pJoint->getName());
- }
- if (pJoint && pJoint->hasAttachmentScaleOverride(scale,mesh_id))
- {
+ }
+ if (pJoint && pJoint->hasAttachmentScaleOverride(scale,mesh_id))
+ {
scale_names.insert(pJoint->getName());
- }
- }
+ }
+ }
// Attachment points
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- const LLViewerJointAttachment *attachment_pt = (*iter).second;
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ const LLViewerJointAttachment *attachment_pt = (*iter).second;
if (attachment_pt && attachment_pt->hasAttachmentPosOverride(pos,mesh_id))
{
pos_names.insert(attachment_pt->getName());
@@ -6710,28 +6710,28 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const
S32 count = 0;
// Bones
- for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin();
+ for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin();
iter != mSkeleton.end(); ++iter)
- {
- const LLJoint* pJoint = (*iter);
- if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id))
- {
- pJoint->showAttachmentPosOverrides(getFullname());
+ {
+ const LLJoint* pJoint = (*iter);
+ if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id))
+ {
+ pJoint->showAttachmentPosOverrides(getFullname());
count++;
- }
- if (pJoint && pJoint->hasAttachmentScaleOverride(scale,mesh_id))
- {
- pJoint->showAttachmentScaleOverrides(getFullname());
+ }
+ if (pJoint && pJoint->hasAttachmentScaleOverride(scale,mesh_id))
+ {
+ pJoint->showAttachmentScaleOverrides(getFullname());
count++;
}
- }
+ }
// Attachment points
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- const LLViewerJointAttachment *attachment_pt = (*iter).second;
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ const LLViewerJointAttachment *attachment_pt = (*iter).second;
if (attachment_pt && attachment_pt->hasAttachmentPosOverride(pos,mesh_id))
{
attachment_pt->showAttachmentPosOverrides(getFullname());
@@ -6752,53 +6752,53 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const
void LLVOAvatar::removeAttachmentOverridesForObject(LLViewerObject *vo)
{
if (vo->getAvatar() != this && vo->getAvatarAncestor() != this)
- {
- LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL;
+ {
+ LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL;
return;
- }
-
- // Process all children
- LLViewerObject::const_child_list_t& children = vo->getChildren();
- for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
- it != children.end(); ++it)
- {
- LLViewerObject *childp = *it;
- removeAttachmentOverridesForObject(childp);
- }
-
- // Process self.
- LLUUID mesh_id;
- if (getRiggedMeshID(vo,mesh_id))
- {
- removeAttachmentOverridesForObject(mesh_id);
- }
+ }
+
+ // Process all children
+ LLViewerObject::const_child_list_t& children = vo->getChildren();
+ for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
+ it != children.end(); ++it)
+ {
+ LLViewerObject *childp = *it;
+ removeAttachmentOverridesForObject(childp);
+ }
+
+ // Process self.
+ LLUUID mesh_id;
+ if (getRiggedMeshID(vo,mesh_id))
+ {
+ removeAttachmentOverridesForObject(mesh_id);
+ }
}
//-----------------------------------------------------------------------------
// removeAttachmentOverridesForObject
//-----------------------------------------------------------------------------
void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id)
-{
- LLJoint* pJointPelvis = getJoint("mPelvis");
+{
+ LLJoint* pJointPelvis = getJoint("mPelvis");
const std::string av_string = avString();
for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++)
- {
+ {
LLJoint *pJoint = getJoint(joint_num);
- if ( pJoint )
- {
+ if ( pJoint )
+ {
bool dummy; // unused
- pJoint->removeAttachmentPosOverride(mesh_id, av_string, dummy);
- pJoint->removeAttachmentScaleOverride(mesh_id, av_string);
- }
- if ( pJoint && pJoint == pJointPelvis)
- {
- removePelvisFixup( mesh_id );
- // SL-315
- pJoint->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) );
- }
- }
-
- postPelvisSetRecalc();
+ pJoint->removeAttachmentPosOverride(mesh_id, av_string, dummy);
+ pJoint->removeAttachmentScaleOverride(mesh_id, av_string);
+ }
+ if ( pJoint && pJoint == pJointPelvis)
+ {
+ removePelvisFixup( mesh_id );
+ // SL-315
+ pJoint->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) );
+ }
+ }
+
+ postPelvisSetRecalc();
mActiveOverrideMeshes.erase(mesh_id);
onActiveOverrideMeshesChanged();
@@ -6808,14 +6808,14 @@ void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id)
//-----------------------------------------------------------------------------
LLVector3 LLVOAvatar::getCharacterPosition()
{
- if (mDrawable.notNull())
- {
- return mDrawable->getPositionAgent();
- }
- else
- {
- return getPositionAgent();
- }
+ if (mDrawable.notNull())
+ {
+ return mDrawable->getPositionAgent();
+ }
+ else
+ {
+ return getPositionAgent();
+ }
}
@@ -6824,7 +6824,7 @@ LLVector3 LLVOAvatar::getCharacterPosition()
//-----------------------------------------------------------------------------
LLQuaternion LLVOAvatar::getCharacterRotation()
{
- return getRotation();
+ return getRotation();
}
@@ -6833,7 +6833,7 @@ LLQuaternion LLVOAvatar::getCharacterRotation()
//-----------------------------------------------------------------------------
LLVector3 LLVOAvatar::getCharacterVelocity()
{
- return getVelocity() - mStepObjectVelocity;
+ return getVelocity() - mStepObjectVelocity;
}
@@ -6842,7 +6842,7 @@ LLVector3 LLVOAvatar::getCharacterVelocity()
//-----------------------------------------------------------------------------
LLVector3 LLVOAvatar::getCharacterAngularVelocity()
{
- return getAngularVelocity();
+ return getAngularVelocity();
}
//-----------------------------------------------------------------------------
@@ -6850,22 +6850,22 @@ LLVector3 LLVOAvatar::getCharacterAngularVelocity()
//-----------------------------------------------------------------------------
void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_agent, LLVector3 &outNorm)
{
- LLVector3d z_vec(0.0f, 0.0f, 1.0f);
- LLVector3d p0_global, p1_global;
+ LLVector3d z_vec(0.0f, 0.0f, 1.0f);
+ LLVector3d p0_global, p1_global;
+
+ if (isUIAvatar())
+ {
+ outNorm.setVec(z_vec);
+ out_pos_agent = in_pos_agent;
+ return;
+ }
- if (isUIAvatar())
- {
- outNorm.setVec(z_vec);
- out_pos_agent = in_pos_agent;
- return;
- }
-
- p0_global = gAgent.getPosGlobalFromAgent(in_pos_agent) + z_vec;
- p1_global = gAgent.getPosGlobalFromAgent(in_pos_agent) - z_vec;
- LLViewerObject *obj;
- LLVector3d out_pos_global;
- LLWorld::getInstance()->resolveStepHeightGlobal(this, p0_global, p1_global, out_pos_global, outNorm, &obj);
- out_pos_agent = gAgent.getPosAgentFromGlobal(out_pos_global);
+ p0_global = gAgent.getPosGlobalFromAgent(in_pos_agent) + z_vec;
+ p1_global = gAgent.getPosGlobalFromAgent(in_pos_agent) - z_vec;
+ LLViewerObject *obj;
+ LLVector3d out_pos_global;
+ LLWorld::getInstance()->resolveStepHeightGlobal(this, p0_global, p1_global, out_pos_global, outNorm, &obj);
+ out_pos_agent = gAgent.getPosAgentFromGlobal(out_pos_global);
}
//-----------------------------------------------------------------------------
@@ -6873,7 +6873,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age
//-----------------------------------------------------------------------------
F32 LLVOAvatar::getTimeDilation()
{
- return mRegionp ? mRegionp->getTimeDilation() : 1.f;
+ return mRegionp ? mRegionp->getTimeDilation() : 1.f;
}
@@ -6882,11 +6882,11 @@ F32 LLVOAvatar::getTimeDilation()
//-----------------------------------------------------------------------------
F32 LLVOAvatar::getPixelArea() const
{
- if (isUIAvatar())
- {
- return 100000.f;
- }
- return mPixelArea;
+ if (isUIAvatar())
+ {
+ return 100000.f;
+ }
+ return mPixelArea;
}
@@ -6894,17 +6894,17 @@ F32 LLVOAvatar::getPixelArea() const
//-----------------------------------------------------------------------------
// LLVOAvatar::getPosGlobalFromAgent()
//-----------------------------------------------------------------------------
-LLVector3d LLVOAvatar::getPosGlobalFromAgent(const LLVector3 &position)
+LLVector3d LLVOAvatar::getPosGlobalFromAgent(const LLVector3 &position)
{
- return gAgent.getPosGlobalFromAgent(position);
+ return gAgent.getPosGlobalFromAgent(position);
}
//-----------------------------------------------------------------------------
// getPosAgentFromGlobal()
//-----------------------------------------------------------------------------
-LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position)
+LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position)
{
- return gAgent.getPosAgentFromGlobal(position);
+ return gAgent.getPosAgentFromGlobal(position);
}
@@ -6914,7 +6914,7 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position)
// virtual
void LLVOAvatar::requestStopMotion( LLMotion* motion )
{
- // Only agent avatars should handle the stop motion notifications.
+ // Only agent avatars should handle the stop motion notifications.
}
//-----------------------------------------------------------------------------
@@ -6923,31 +6923,31 @@ void LLVOAvatar::requestStopMotion( LLMotion* motion )
//virtual
BOOL LLVOAvatar::loadSkeletonNode ()
{
- if (!LLAvatarAppearance::loadSkeletonNode())
- {
- return FALSE;
- }
-
+ if (!LLAvatarAppearance::loadSkeletonNode())
+ {
+ return FALSE;
+ }
+
bool ignore_hud_joints = false;
initAttachmentPoints(ignore_hud_joints);
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
-// initAttachmentPoints(): creates attachment points if needed, sets state based on avatar_lad.xml.
+// initAttachmentPoints(): creates attachment points if needed, sets state based on avatar_lad.xml.
//-----------------------------------------------------------------------------
void LLVOAvatar::initAttachmentPoints(bool ignore_hud_joints)
{
LLAvatarXmlInfo::attachment_info_list_t::iterator iter;
for (iter = sAvatarXmlInfo->mAttachmentInfoList.begin();
- iter != sAvatarXmlInfo->mAttachmentInfoList.end();
+ iter != sAvatarXmlInfo->mAttachmentInfoList.end();
++iter)
{
LLAvatarXmlInfo::LLAvatarAttachmentInfo *info = *iter;
if (info->mIsHUDAttachment && (!isSelf() || ignore_hud_joints))
{
- //don't process hud joint for other avatars.
+ //don't process hud joint for other avatars.
continue;
}
@@ -6984,7 +6984,7 @@ void LLVOAvatar::initAttachmentPoints(bool ignore_hud_joints)
attachment->setOriginalPosition(info->mPosition);
attachment->setDefaultPosition(info->mPosition);
}
-
+
if (info->mHasRotation)
{
LLQuaternion rotation;
@@ -7016,7 +7016,7 @@ void LLVOAvatar::initAttachmentPoints(bool ignore_hud_joints)
if (newly_created)
{
mAttachmentPoints[attachmentID] = attachment;
-
+
// now add attachment joint
parent_joint->addChild(attachment);
}
@@ -7028,45 +7028,45 @@ void LLVOAvatar::initAttachmentPoints(bool ignore_hud_joints)
//-----------------------------------------------------------------------------
void LLVOAvatar::updateVisualParams()
{
- ESex avatar_sex = (getVisualParamWeight("male") > 0.5f) ? SEX_MALE : SEX_FEMALE;
- if (getSex() != avatar_sex)
- {
- if (mIsSitting && findMotion(avatar_sex == SEX_MALE ? ANIM_AGENT_SIT_FEMALE : ANIM_AGENT_SIT) != NULL)
- {
- // In some cases of gender change server changes sit motion with motion message,
- // but in case of some avatars (legacy?) there is no update from server side,
- // likely because server doesn't know about difference between motions
- // (female and male sit ids are same server side, so it is likely unaware that it
- // need to send update)
- // Make sure motion is up to date
- stopMotion(ANIM_AGENT_SIT);
- setSex(avatar_sex);
- startMotion(ANIM_AGENT_SIT);
- }
- else
- {
- setSex(avatar_sex);
- }
- }
-
- LLCharacter::updateVisualParams();
-
- if (mLastSkeletonSerialNum != mSkeletonSerialNum)
- {
- computeBodySize();
- mLastSkeletonSerialNum = mSkeletonSerialNum;
- mRoot->updateWorldMatrixChildren();
- }
-
- dirtyMesh();
- updateHeadOffset();
+ ESex avatar_sex = (getVisualParamWeight("male") > 0.5f) ? SEX_MALE : SEX_FEMALE;
+ if (getSex() != avatar_sex)
+ {
+ if (mIsSitting && findMotion(avatar_sex == SEX_MALE ? ANIM_AGENT_SIT_FEMALE : ANIM_AGENT_SIT) != NULL)
+ {
+ // In some cases of gender change server changes sit motion with motion message,
+ // but in case of some avatars (legacy?) there is no update from server side,
+ // likely because server doesn't know about difference between motions
+ // (female and male sit ids are same server side, so it is likely unaware that it
+ // need to send update)
+ // Make sure motion is up to date
+ stopMotion(ANIM_AGENT_SIT);
+ setSex(avatar_sex);
+ startMotion(ANIM_AGENT_SIT);
+ }
+ else
+ {
+ setSex(avatar_sex);
+ }
+ }
+
+ LLCharacter::updateVisualParams();
+
+ if (mLastSkeletonSerialNum != mSkeletonSerialNum)
+ {
+ computeBodySize();
+ mLastSkeletonSerialNum = mSkeletonSerialNum;
+ mRoot->updateWorldMatrixChildren();
+ }
+
+ dirtyMesh();
+ updateHeadOffset();
}
//-----------------------------------------------------------------------------
// isActive()
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::isActive() const
{
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -7074,39 +7074,39 @@ BOOL LLVOAvatar::isActive() const
//-----------------------------------------------------------------------------
void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent)
{
- if (mDrawable.isNull())
- {
- return;
- }
+ if (mDrawable.isNull())
+ {
+ return;
+ }
- const LLVector4a* ext = mDrawable->getSpatialExtents();
- LLVector4a center;
- center.setAdd(ext[1], ext[0]);
- center.mul(0.5f);
- LLVector4a size;
- size.setSub(ext[1], ext[0]);
- size.mul(0.5f);
+ const LLVector4a* ext = mDrawable->getSpatialExtents();
+ LLVector4a center;
+ center.setAdd(ext[1], ext[0]);
+ center.mul(0.5f);
+ LLVector4a size;
+ size.setSub(ext[1], ext[0]);
+ size.mul(0.5f);
- mImpostorPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance());
+ mImpostorPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance());
mPixelArea = mImpostorPixelArea;
- F32 range = mDrawable->mDistanceWRTCamera;
+ F32 range = mDrawable->mDistanceWRTCamera;
- if (range < 0.001f) // range == zero
- {
- mAppAngle = 180.f;
- }
- else
- {
- F32 radius = size.getLength3().getF32();
- mAppAngle = (F32) atan2( radius, range) * RAD_TO_DEG;
- }
+ if (range < 0.001f) // range == zero
+ {
+ mAppAngle = 180.f;
+ }
+ else
+ {
+ F32 radius = size.getLength3().getF32();
+ mAppAngle = (F32) atan2( radius, range) * RAD_TO_DEG;
+ }
- // We always want to look good to ourselves
- if( isSelf() )
- {
- mPixelArea = llmax( mPixelArea, F32(getTexImageSize() / 16) );
- }
+ // We always want to look good to ourselves
+ if( isSelf() )
+ {
+ mPixelArea = llmax( mPixelArea, F32(getTexImageSize() / 16) );
+ }
}
//-----------------------------------------------------------------------------
@@ -7114,48 +7114,48 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent)
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::updateJointLODs()
{
- const F32 MAX_PIXEL_AREA = 100000000.f;
- F32 lod_factor = (sLODFactor * AVATAR_LOD_TWEAK_RANGE + (1.f - AVATAR_LOD_TWEAK_RANGE));
- F32 avatar_num_min_factor = clamp_rescale(sLODFactor, 0.f, 1.f, 0.25f, 0.6f);
- F32 avatar_num_factor = clamp_rescale((F32)sNumVisibleAvatars, 8, 25, 1.f, avatar_num_min_factor);
- F32 area_scale = 0.16f;
-
- if (isSelf())
- {
- if(gAgentCamera.cameraCustomizeAvatar() || gAgentCamera.cameraMouselook())
- {
- mAdjustedPixelArea = MAX_PIXEL_AREA;
- }
- else
- {
- mAdjustedPixelArea = mPixelArea*area_scale;
- }
- }
- else if (mIsDummy)
- {
- mAdjustedPixelArea = MAX_PIXEL_AREA;
- }
- else
- {
- // reported avatar pixel area is dependent on avatar render load, based on number of visible avatars
- mAdjustedPixelArea = (F32)mPixelArea * area_scale * lod_factor * lod_factor * avatar_num_factor * avatar_num_factor;
- }
-
- // now select meshes to render based on adjusted pixel area
- LLViewerJoint* root = dynamic_cast<LLViewerJoint*>(mRoot);
- BOOL res = FALSE;
- if (root)
- {
- res = root->updateLOD(mAdjustedPixelArea, TRUE);
- }
- if (res)
- {
- sNumLODChangesThisFrame++;
- dirtyMesh(2);
- return TRUE;
- }
-
- return FALSE;
+ const F32 MAX_PIXEL_AREA = 100000000.f;
+ F32 lod_factor = (sLODFactor * AVATAR_LOD_TWEAK_RANGE + (1.f - AVATAR_LOD_TWEAK_RANGE));
+ F32 avatar_num_min_factor = clamp_rescale(sLODFactor, 0.f, 1.f, 0.25f, 0.6f);
+ F32 avatar_num_factor = clamp_rescale((F32)sNumVisibleAvatars, 8, 25, 1.f, avatar_num_min_factor);
+ F32 area_scale = 0.16f;
+
+ if (isSelf())
+ {
+ if(gAgentCamera.cameraCustomizeAvatar() || gAgentCamera.cameraMouselook())
+ {
+ mAdjustedPixelArea = MAX_PIXEL_AREA;
+ }
+ else
+ {
+ mAdjustedPixelArea = mPixelArea*area_scale;
+ }
+ }
+ else if (mIsDummy)
+ {
+ mAdjustedPixelArea = MAX_PIXEL_AREA;
+ }
+ else
+ {
+ // reported avatar pixel area is dependent on avatar render load, based on number of visible avatars
+ mAdjustedPixelArea = (F32)mPixelArea * area_scale * lod_factor * lod_factor * avatar_num_factor * avatar_num_factor;
+ }
+
+ // now select meshes to render based on adjusted pixel area
+ LLViewerJoint* root = dynamic_cast<LLViewerJoint*>(mRoot);
+ BOOL res = FALSE;
+ if (root)
+ {
+ res = root->updateLOD(mAdjustedPixelArea, TRUE);
+ }
+ if (res)
+ {
+ sNumLODChangesThisFrame++;
+ dirtyMesh(2);
+ return TRUE;
+ }
+
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -7163,32 +7163,32 @@ BOOL LLVOAvatar::updateJointLODs()
//-----------------------------------------------------------------------------
LLDrawable *LLVOAvatar::createDrawable(LLPipeline *pipeline)
{
- pipeline->allocDrawable(this);
- mDrawable->setLit(FALSE);
+ pipeline->allocDrawable(this);
+ mDrawable->setLit(FALSE);
+
+ LLDrawPoolAvatar *poolp = (LLDrawPoolAvatar*)gPipeline.getPool(mIsControlAvatar ? LLDrawPool::POOL_CONTROL_AV : LLDrawPool::POOL_AVATAR);
- LLDrawPoolAvatar *poolp = (LLDrawPoolAvatar*)gPipeline.getPool(mIsControlAvatar ? LLDrawPool::POOL_CONTROL_AV : LLDrawPool::POOL_AVATAR);
+ // Only a single face (one per avatar)
+ //this face will be splitted into several if its vertex buffer is too long.
+ mDrawable->setState(LLDrawable::ACTIVE);
+ mDrawable->addFace(poolp, NULL);
+ mDrawable->setRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR);
- // Only a single face (one per avatar)
- //this face will be splitted into several if its vertex buffer is too long.
- mDrawable->setState(LLDrawable::ACTIVE);
- mDrawable->addFace(poolp, NULL);
- mDrawable->setRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR);
-
- mNumInitFaces = mDrawable->getNumFaces() ;
+ mNumInitFaces = mDrawable->getNumFaces() ;
- dirtyMesh(2);
- return mDrawable;
+ dirtyMesh(2);
+ return mDrawable;
}
void LLVOAvatar::updateGL()
{
- if (mMeshTexturesDirty)
- {
- LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- updateMeshTextures();
- mMeshTexturesDirty = FALSE;
- }
+ if (mMeshTexturesDirty)
+ {
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
+ updateMeshTextures();
+ mMeshTexturesDirty = FALSE;
+ }
}
//-----------------------------------------------------------------------------
@@ -7197,22 +7197,22 @@ void LLVOAvatar::updateGL()
BOOL LLVOAvatar::updateGeometry(LLDrawable *drawable)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR)))
- {
- return TRUE;
- }
-
- if (!mMeshValid)
- {
- return TRUE;
- }
+ if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR)))
+ {
+ return TRUE;
+ }
- if (!drawable)
- {
- LL_ERRS() << "LLVOAvatar::updateGeometry() called with NULL drawable" << LL_ENDL;
- }
+ if (!mMeshValid)
+ {
+ return TRUE;
+ }
+
+ if (!drawable)
+ {
+ LL_ERRS() << "LLVOAvatar::updateGeometry() called with NULL drawable" << LL_ENDL;
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -7220,9 +7220,9 @@ BOOL LLVOAvatar::updateGeometry(LLDrawable *drawable)
//-----------------------------------------------------------------------------
void LLVOAvatar::updateSexDependentLayerSets()
{
- invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet);
- invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet);
- invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet);
+ invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet);
+ invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet);
+ invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet);
}
//-----------------------------------------------------------------------------
@@ -7230,19 +7230,19 @@ void LLVOAvatar::updateSexDependentLayerSets()
//-----------------------------------------------------------------------------
void LLVOAvatar::dirtyMesh()
{
- dirtyMesh(1);
+ dirtyMesh(1);
}
void LLVOAvatar::dirtyMesh(S32 priority)
{
- mDirtyMesh = llmax(mDirtyMesh, priority);
+ mDirtyMesh = llmax(mDirtyMesh, priority);
}
//-----------------------------------------------------------------------------
// getViewerJoint()
//-----------------------------------------------------------------------------
-LLViewerJoint* LLVOAvatar::getViewerJoint(S32 idx)
+LLViewerJoint* LLVOAvatar::getViewerJoint(S32 idx)
{
- return dynamic_cast<LLViewerJoint*>(mMeshLOD[idx]);
+ return dynamic_cast<LLViewerJoint*>(mMeshLOD[idx]);
}
//-----------------------------------------------------------------------------
@@ -7258,111 +7258,111 @@ void LLVOAvatar::hideHair()
//-----------------------------------------------------------------------------
void LLVOAvatar::hideSkirt()
{
- mMeshLOD[MESH_ID_SKIRT]->setVisible(FALSE, TRUE);
+ mMeshLOD[MESH_ID_SKIRT]->setVisible(FALSE, TRUE);
}
BOOL LLVOAvatar::setParent(LLViewerObject* parent)
{
- BOOL ret ;
- if (parent == NULL)
- {
- getOffObject();
- ret = LLViewerObject::setParent(parent);
- if (isSelf())
- {
- gAgentCamera.resetCamera();
- }
- }
- else
- {
- ret = LLViewerObject::setParent(parent);
- if(ret)
- {
- sitOnObject(parent);
- }
- }
- return ret ;
+ BOOL ret ;
+ if (parent == NULL)
+ {
+ getOffObject();
+ ret = LLViewerObject::setParent(parent);
+ if (isSelf())
+ {
+ gAgentCamera.resetCamera();
+ }
+ }
+ else
+ {
+ ret = LLViewerObject::setParent(parent);
+ if(ret)
+ {
+ sitOnObject(parent);
+ }
+ }
+ return ret ;
}
void LLVOAvatar::addChild(LLViewerObject *childp)
{
- childp->extractAttachmentItemID(); // find the inventory item this object is associated with.
- if (isSelf())
- {
- const LLUUID& item_id = childp->getAttachmentItemID();
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_DEBUGS("Avatar") << "ATT attachment child added " << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
-
- }
-
- LLViewerObject::addChild(childp);
- if (childp->mDrawable)
- {
- if (!attachObject(childp))
- {
- LL_WARNS() << "ATT addChild() failed for "
- << childp->getID()
- << " item " << childp->getAttachmentItemID()
- << LL_ENDL;
- // MAINT-3312 backout
- // mPendingAttachment.push_back(childp);
- }
- }
- else
- {
- mPendingAttachment.push_back(childp);
- }
+ childp->extractAttachmentItemID(); // find the inventory item this object is associated with.
+ if (isSelf())
+ {
+ const LLUUID& item_id = childp->getAttachmentItemID();
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << "ATT attachment child added " << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
+
+ }
+
+ LLViewerObject::addChild(childp);
+ if (childp->mDrawable)
+ {
+ if (!attachObject(childp))
+ {
+ LL_WARNS() << "ATT addChild() failed for "
+ << childp->getID()
+ << " item " << childp->getAttachmentItemID()
+ << LL_ENDL;
+ // MAINT-3312 backout
+ // mPendingAttachment.push_back(childp);
+ }
+ }
+ else
+ {
+ mPendingAttachment.push_back(childp);
+ }
}
void LLVOAvatar::removeChild(LLViewerObject *childp)
{
- LLViewerObject::removeChild(childp);
- if (!detachObject(childp))
- {
- LL_WARNS() << "Calling detach on non-attached object " << LL_ENDL;
- }
+ LLViewerObject::removeChild(childp);
+ if (!detachObject(childp))
+ {
+ LL_WARNS() << "Calling detach on non-attached object " << LL_ENDL;
+ }
}
LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* viewer_object)
{
- S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getAttachmentState());
-
- // This should never happen unless the server didn't process the attachment point
- // correctly, but putting this check in here to be safe.
- if (attachmentID & ATTACHMENT_ADD)
- {
- LL_WARNS() << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << LL_ENDL;
- attachmentID &= ~ATTACHMENT_ADD;
- }
-
- LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
-
- if (!attachment)
- {
- LL_WARNS() << "Object attachment point invalid: " << attachmentID
- << " trying to use 1 (chest)"
- << LL_ENDL;
-
- attachment = get_if_there(mAttachmentPoints, 1, (LLViewerJointAttachment*)NULL); // Arbitrary using 1 (chest)
- if (attachment)
- {
- LL_WARNS() << "Object attachment point invalid: " << attachmentID
- << " on object " << viewer_object->getID()
- << " attachment item " << viewer_object->getAttachmentItemID()
- << " falling back to 1 (chest)"
- << LL_ENDL;
- }
- else
- {
- LL_WARNS() << "Object attachment point invalid: " << attachmentID
- << " on object " << viewer_object->getID()
- << " attachment item " << viewer_object->getAttachmentItemID()
- << "Unable to use fallback attachment point 1 (chest)"
- << LL_ENDL;
- }
- }
-
- return attachment;
+ S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getAttachmentState());
+
+ // This should never happen unless the server didn't process the attachment point
+ // correctly, but putting this check in here to be safe.
+ if (attachmentID & ATTACHMENT_ADD)
+ {
+ LL_WARNS() << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << LL_ENDL;
+ attachmentID &= ~ATTACHMENT_ADD;
+ }
+
+ LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
+
+ if (!attachment)
+ {
+ LL_WARNS() << "Object attachment point invalid: " << attachmentID
+ << " trying to use 1 (chest)"
+ << LL_ENDL;
+
+ attachment = get_if_there(mAttachmentPoints, 1, (LLViewerJointAttachment*)NULL); // Arbitrary using 1 (chest)
+ if (attachment)
+ {
+ LL_WARNS() << "Object attachment point invalid: " << attachmentID
+ << " on object " << viewer_object->getID()
+ << " attachment item " << viewer_object->getAttachmentItemID()
+ << " falling back to 1 (chest)"
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "Object attachment point invalid: " << attachmentID
+ << " on object " << viewer_object->getID()
+ << " attachment item " << viewer_object->getAttachmentItemID()
+ << "Unable to use fallback attachment point 1 (chest)"
+ << LL_ENDL;
+ }
+ }
+
+ return attachment;
}
//-----------------------------------------------------------------------------
@@ -7370,54 +7370,54 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi
//-----------------------------------------------------------------------------
const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_object)
{
- if (isSelf())
- {
- const LLUUID& item_id = viewer_object->getAttachmentItemID();
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_DEBUGS("Avatar") << "ATT attaching object "
- << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
- }
- LLViewerJointAttachment* attachment = getTargetAttachmentPoint(viewer_object);
-
- if (!attachment || !attachment->addObject(viewer_object))
- {
- const LLUUID& item_id = viewer_object->getAttachmentItemID();
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_WARNS("Avatar") << "ATT attach failed "
- << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
- return 0;
- }
+ if (isSelf())
+ {
+ const LLUUID& item_id = viewer_object->getAttachmentItemID();
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << "ATT attaching object "
+ << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
+ }
+ LLViewerJointAttachment* attachment = getTargetAttachmentPoint(viewer_object);
+
+ if (!attachment || !attachment->addObject(viewer_object))
+ {
+ const LLUUID& item_id = viewer_object->getAttachmentItemID();
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_WARNS("Avatar") << "ATT attach failed "
+ << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
+ return 0;
+ }
if (!viewer_object->isAnimatedObject())
{
updateAttachmentOverrides();
}
- updateVisualComplexity();
+ updateVisualComplexity();
- if (viewer_object->isSelected())
- {
- LLSelectMgr::getInstance()->updateSelectionCenter();
- LLSelectMgr::getInstance()->updatePointAt();
- }
+ if (viewer_object->isSelected())
+ {
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ LLSelectMgr::getInstance()->updatePointAt();
+ }
- viewer_object->refreshBakeTexture();
+ viewer_object->refreshBakeTexture();
- LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
- if (objectp)
- {
- objectp->refreshBakeTexture();
- }
- }
+ LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+ if (objectp)
+ {
+ objectp->refreshBakeTexture();
+ }
+ }
- updateMeshVisibility();
+ updateMeshVisibility();
- return attachment;
+ return attachment;
}
//-----------------------------------------------------------------------------
@@ -7425,15 +7425,15 @@ const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_o
//-----------------------------------------------------------------------------
U32 LLVOAvatar::getNumAttachments() const
{
- U32 num_attachments = 0;
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- const LLViewerJointAttachment *attachment_pt = (*iter).second;
- num_attachments += attachment_pt->getNumObjects();
- }
- return num_attachments;
+ U32 num_attachments = 0;
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ const LLViewerJointAttachment *attachment_pt = (*iter).second;
+ num_attachments += attachment_pt->getNumObjects();
+ }
+ return num_attachments;
}
//-----------------------------------------------------------------------------
@@ -7441,7 +7441,7 @@ U32 LLVOAvatar::getNumAttachments() const
//-----------------------------------------------------------------------------
S32 LLVOAvatar::getMaxAttachments() const
{
- return LLAgentBenefitsMgr::current().getAttachmentLimit();
+ return LLAgentBenefitsMgr::current().getAttachmentLimit();
}
//-----------------------------------------------------------------------------
@@ -7450,7 +7450,7 @@ S32 LLVOAvatar::getMaxAttachments() const
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::canAttachMoreObjects(U32 n) const
{
- return (getNumAttachments() + n) <= getMaxAttachments();
+ return (getNumAttachments() + n) <= getMaxAttachments();
}
//-----------------------------------------------------------------------------
@@ -7458,15 +7458,15 @@ BOOL LLVOAvatar::canAttachMoreObjects(U32 n) const
//-----------------------------------------------------------------------------
U32 LLVOAvatar::getNumAnimatedObjectAttachments() const
{
- U32 num_attachments = 0;
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- const LLViewerJointAttachment *attachment_pt = (*iter).second;
- num_attachments += attachment_pt->getNumAnimatedObjects();
- }
- return num_attachments;
+ U32 num_attachments = 0;
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ const LLViewerJointAttachment *attachment_pt = (*iter).second;
+ num_attachments += attachment_pt->getNumAnimatedObjects();
+ }
+ return num_attachments;
}
//-----------------------------------------------------------------------------
@@ -7475,7 +7475,7 @@ U32 LLVOAvatar::getNumAnimatedObjectAttachments() const
//-----------------------------------------------------------------------------
S32 LLVOAvatar::getMaxAnimatedObjectAttachments() const
{
- return LLAgentBenefitsMgr::current().getAnimatedObjectLimit();
+ return LLAgentBenefitsMgr::current().getAnimatedObjectLimit();
}
//-----------------------------------------------------------------------------
@@ -7484,7 +7484,7 @@ S32 LLVOAvatar::getMaxAnimatedObjectAttachments() const
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::canAttachMoreAnimatedObjects(U32 n) const
{
- return (getNumAnimatedObjectAttachments() + n) <= getMaxAnimatedObjectAttachments();
+ return (getNumAnimatedObjectAttachments() + n) <= getMaxAnimatedObjectAttachments();
}
//-----------------------------------------------------------------------------
@@ -7492,101 +7492,101 @@ BOOL LLVOAvatar::canAttachMoreAnimatedObjects(U32 n) const
//-----------------------------------------------------------------------------
void LLVOAvatar::lazyAttach()
{
- std::vector<LLPointer<LLViewerObject> > still_pending;
-
- for (U32 i = 0; i < mPendingAttachment.size(); i++)
- {
- LLPointer<LLViewerObject> cur_attachment = mPendingAttachment[i];
- // Object might have died while we were waiting for drawable
- if (!cur_attachment->isDead())
- {
- if (cur_attachment->mDrawable)
- {
- if (isSelf())
- {
- const LLUUID& item_id = cur_attachment->getAttachmentItemID();
- LLViewerInventoryItem *item = gInventory.getItem(item_id);
- LL_DEBUGS("Avatar") << "ATT attaching object "
- << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
- }
- if (!attachObject(cur_attachment))
- { // Drop it
- LL_WARNS() << "attachObject() failed for "
- << cur_attachment->getID()
- << " item " << cur_attachment->getAttachmentItemID()
- << LL_ENDL;
- // MAINT-3312 backout
- //still_pending.push_back(cur_attachment);
- }
- }
- else
- {
- still_pending.push_back(cur_attachment);
- }
- }
- }
-
- mPendingAttachment = still_pending;
+ std::vector<LLPointer<LLViewerObject> > still_pending;
+
+ for (U32 i = 0; i < mPendingAttachment.size(); i++)
+ {
+ LLPointer<LLViewerObject> cur_attachment = mPendingAttachment[i];
+ // Object might have died while we were waiting for drawable
+ if (!cur_attachment->isDead())
+ {
+ if (cur_attachment->mDrawable)
+ {
+ if (isSelf())
+ {
+ const LLUUID& item_id = cur_attachment->getAttachmentItemID();
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << "ATT attaching object "
+ << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
+ }
+ if (!attachObject(cur_attachment))
+ { // Drop it
+ LL_WARNS() << "attachObject() failed for "
+ << cur_attachment->getID()
+ << " item " << cur_attachment->getAttachmentItemID()
+ << LL_ENDL;
+ // MAINT-3312 backout
+ //still_pending.push_back(cur_attachment);
+ }
+ }
+ else
+ {
+ still_pending.push_back(cur_attachment);
+ }
+ }
+ }
+
+ mPendingAttachment = still_pending;
}
void LLVOAvatar::resetHUDAttachments()
{
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment->getIsHUDAttachment())
- {
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- const LLViewerObject* attached_object = attachment_iter->get();
- if (attached_object && attached_object->mDrawable.notNull())
- {
- gPipeline.markMoved(attached_object->mDrawable);
- }
- }
- }
- }
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment->getIsHUDAttachment())
+ {
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ const LLViewerObject* attached_object = attachment_iter->get();
+ if (attached_object && attached_object->mDrawable.notNull())
+ {
+ gPipeline.markMoved(attached_object->mDrawable);
+ }
+ }
+ }
+ }
}
void LLVOAvatar::rebuildRiggedAttachments( void )
{
- for ( attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter )
- {
- LLViewerJointAttachment* pAttachment = iter->second;
- LLViewerJointAttachment::attachedobjs_vec_t::iterator attachmentIterEnd = pAttachment->mAttachedObjects.end();
-
- for ( LLViewerJointAttachment::attachedobjs_vec_t::iterator attachmentIter = pAttachment->mAttachedObjects.begin();
- attachmentIter != attachmentIterEnd; ++attachmentIter)
- {
- const LLViewerObject* pAttachedObject = *attachmentIter;
- if ( pAttachment && pAttachedObject->mDrawable.notNull() )
- {
- gPipeline.markRebuild(pAttachedObject->mDrawable);
- }
- }
- }
+ for ( attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter )
+ {
+ LLViewerJointAttachment* pAttachment = iter->second;
+ LLViewerJointAttachment::attachedobjs_vec_t::iterator attachmentIterEnd = pAttachment->mAttachedObjects.end();
+
+ for ( LLViewerJointAttachment::attachedobjs_vec_t::iterator attachmentIter = pAttachment->mAttachedObjects.begin();
+ attachmentIter != attachmentIterEnd; ++attachmentIter)
+ {
+ const LLViewerObject* pAttachedObject = *attachmentIter;
+ if ( pAttachment && pAttachedObject->mDrawable.notNull() )
+ {
+ gPipeline.markRebuild(pAttachedObject->mDrawable);
+ }
+ }
+ }
}
//-----------------------------------------------------------------------------
// cleanupAttachedMesh()
//-----------------------------------------------------------------------------
void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO )
{
- LLUUID mesh_id;
- if (getRiggedMeshID(pVO, mesh_id))
- {
+ LLUUID mesh_id;
+ if (getRiggedMeshID(pVO, mesh_id))
+ {
// FIXME this seems like an odd place for this code.
- if ( gAgentCamera.cameraCustomizeAvatar() )
- {
- gAgent.unpauseAnimation();
- //Still want to refocus on head bone
- gAgentCamera.changeCameraToCustomizeAvatar();
- }
- }
+ if ( gAgentCamera.cameraCustomizeAvatar() )
+ {
+ gAgent.unpauseAnimation();
+ //Still want to refocus on head bone
+ gAgentCamera.changeCameraToCustomizeAvatar();
+ }
+ }
}
bool LLVOAvatar::hasPendingAttachedMeshes()
@@ -7673,51 +7673,51 @@ bool LLVOAvatar::hasPendingAttachedMeshes()
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
{
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
-
- if (attachment->isObjectAttached(viewer_object))
- {
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+
+ if (attachment->isObjectAttached(viewer_object))
+ {
updateVisualComplexity();
bool is_animated_object = viewer_object->isAnimatedObject();
- cleanupAttachedMesh(viewer_object);
+ cleanupAttachedMesh(viewer_object);
- attachment->removeObject(viewer_object);
+ attachment->removeObject(viewer_object);
if (!is_animated_object)
{
updateAttachmentOverrides();
}
- viewer_object->refreshBakeTexture();
-
- LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter1 = child_list.begin();
- iter1 != child_list.end(); ++iter1)
- {
- LLViewerObject* objectp = *iter1;
- if (objectp)
+ viewer_object->refreshBakeTexture();
+
+ LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter1 = child_list.begin();
+ iter1 != child_list.end(); ++iter1)
+ {
+ LLViewerObject* objectp = *iter1;
+ if (objectp)
{
- objectp->refreshBakeTexture();
- }
+ objectp->refreshBakeTexture();
+ }
}
- updateMeshVisibility();
+ updateMeshVisibility();
- LL_DEBUGS() << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << LL_ENDL;
- return TRUE;
- }
- }
+ LL_DEBUGS() << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << LL_ENDL;
+ return TRUE;
+ }
+ }
- std::vector<LLPointer<LLViewerObject> >::iterator iter = std::find(mPendingAttachment.begin(), mPendingAttachment.end(), viewer_object);
- if (iter != mPendingAttachment.end())
- {
- mPendingAttachment.erase(iter);
- return TRUE;
- }
-
- return FALSE;
+ std::vector<LLPointer<LLViewerObject> >::iterator iter = std::find(mPendingAttachment.begin(), mPendingAttachment.end(), viewer_object);
+ if (iter != mPendingAttachment.end())
+ {
+ mPendingAttachment.erase(iter);
+ return TRUE;
+ }
+
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -7725,12 +7725,12 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
//-----------------------------------------------------------------------------
void LLVOAvatar::sitDown(BOOL bSitting)
{
- mIsSitting = bSitting;
- if (isSelf())
- {
- // Update Movement Controls according to own Sitting mode
- LLFloaterMove::setSittingMode(bSitting);
- }
+ mIsSitting = bSitting;
+ if (isSelf())
+ {
+ // Update Movement Controls according to own Sitting mode
+ LLFloaterMove::setSittingMode(bSitting);
+ }
}
//-----------------------------------------------------------------------------
@@ -7738,22 +7738,22 @@ void LLVOAvatar::sitDown(BOOL bSitting)
//-----------------------------------------------------------------------------
void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
{
- if (isSelf())
- {
- // Might be first sit
- //LLFirstUse::useSit();
-
- gAgent.setFlying(FALSE);
- gAgentCamera.setThirdPersonHeadOffset(LLVector3::zero);
- //interpolate to new camera position
- gAgentCamera.startCameraAnimation();
- // make sure we are not trying to autopilot
- gAgent.stopAutoPilot();
- gAgentCamera.setupSitCamera();
- if (gAgentCamera.getForceMouselook())
- {
- gAgentCamera.changeCameraToMouselook();
- }
+ if (isSelf())
+ {
+ // Might be first sit
+ //LLFirstUse::useSit();
+
+ gAgent.setFlying(FALSE);
+ gAgentCamera.setThirdPersonHeadOffset(LLVector3::zero);
+ //interpolate to new camera position
+ gAgentCamera.startCameraAnimation();
+ // make sure we are not trying to autopilot
+ gAgent.stopAutoPilot();
+ gAgentCamera.setupSitCamera();
+ if (gAgentCamera.getForceMouselook())
+ {
+ gAgentCamera.changeCameraToMouselook();
+ }
if (gAgentCamera.getFocusOnAvatar() && LLToolMgr::getInstance()->inEdit())
{
@@ -7767,33 +7767,33 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
}
}
}
- }
+ }
+
+ if (mDrawable.isNull())
+ {
+ return;
+ }
+ LLQuaternion inv_obj_rot = ~sit_object->getRenderRotation();
+ LLVector3 obj_pos = sit_object->getRenderPosition();
- if (mDrawable.isNull())
- {
- return;
- }
- LLQuaternion inv_obj_rot = ~sit_object->getRenderRotation();
- LLVector3 obj_pos = sit_object->getRenderPosition();
+ LLVector3 rel_pos = getRenderPosition() - obj_pos;
+ rel_pos.rotVec(inv_obj_rot);
- LLVector3 rel_pos = getRenderPosition() - obj_pos;
- rel_pos.rotVec(inv_obj_rot);
+ mDrawable->mXform.setPosition(rel_pos);
+ mDrawable->mXform.setRotation(mDrawable->getWorldRotation() * inv_obj_rot);
- mDrawable->mXform.setPosition(rel_pos);
- mDrawable->mXform.setRotation(mDrawable->getWorldRotation() * inv_obj_rot);
+ gPipeline.markMoved(mDrawable, TRUE);
+ // Notice that removing sitDown() from here causes avatars sitting on
+ // objects to be not rendered for new arrivals. See EXT-6835 and EXT-1655.
+ sitDown(TRUE);
+ mRoot->getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject
+ // SL-315
+ mRoot->setPosition(getPosition());
+ mRoot->updateWorldMatrixChildren();
- gPipeline.markMoved(mDrawable, TRUE);
- // Notice that removing sitDown() from here causes avatars sitting on
- // objects to be not rendered for new arrivals. See EXT-6835 and EXT-1655.
- sitDown(TRUE);
- mRoot->getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject
- // SL-315
- mRoot->setPosition(getPosition());
- mRoot->updateWorldMatrixChildren();
+ stopMotion(ANIM_AGENT_BODY_NOISE);
- stopMotion(ANIM_AGENT_BODY_NOISE);
-
- gAgentCamera.setInitSitRot(gAgent.getFrameAgent().getQuaternion());
+ gAgentCamera.setInitSitRot(gAgent.getFrameAgent().getQuaternion());
}
//-----------------------------------------------------------------------------
@@ -7801,168 +7801,168 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
//-----------------------------------------------------------------------------
void LLVOAvatar::getOffObject()
{
- if (mDrawable.isNull())
- {
- return;
- }
-
- LLViewerObject* sit_object = (LLViewerObject*)getParent();
-
- if (sit_object)
- {
- stopMotionFromSource(sit_object->getID());
- LLFollowCamMgr::getInstance()->setCameraActive(sit_object->getID(), FALSE);
-
- LLViewerObject::const_child_list_t& child_list = sit_object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* child_objectp = *iter;
-
- stopMotionFromSource(child_objectp->getID());
- LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), FALSE);
- }
- }
-
- // assumes that transform will not be updated with drawable still having a parent
- // or that drawable had no parent from the start
- LLVector3 cur_position_world = mDrawable->getWorldPosition();
- LLQuaternion cur_rotation_world = mDrawable->getWorldRotation();
-
- if (mLastRootPos.length() >= MAX_STANDOFF_FROM_ORIGIN
- && (cur_position_world.length() < MAX_STANDOFF_FROM_ORIGIN
- || dist_vec(cur_position_world, mLastRootPos) > MAX_STANDOFF_DISTANCE_CHANGE))
- {
- // Most likely drawable got updated too early or some updates were missed - we got relative position to non-existing parent
- // restore coordinates from cache
- cur_position_world = mLastRootPos;
- }
-
- // set *local* position based on last *world* position, since we're unparenting the avatar
- mDrawable->mXform.setPosition(cur_position_world);
- mDrawable->mXform.setRotation(cur_rotation_world);
-
- gPipeline.markMoved(mDrawable, TRUE);
-
- sitDown(FALSE);
-
- mRoot->getXform()->setParent(NULL); // LLVOAvatar::getOffObject
- // SL-315
- mRoot->setPosition(cur_position_world);
- mRoot->setRotation(cur_rotation_world);
- mRoot->getXform()->update();
+ if (mDrawable.isNull())
+ {
+ return;
+ }
+
+ LLViewerObject* sit_object = (LLViewerObject*)getParent();
+
+ if (sit_object)
+ {
+ stopMotionFromSource(sit_object->getID());
+ LLFollowCamMgr::getInstance()->setCameraActive(sit_object->getID(), FALSE);
+
+ LLViewerObject::const_child_list_t& child_list = sit_object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* child_objectp = *iter;
+
+ stopMotionFromSource(child_objectp->getID());
+ LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), FALSE);
+ }
+ }
+
+ // assumes that transform will not be updated with drawable still having a parent
+ // or that drawable had no parent from the start
+ LLVector3 cur_position_world = mDrawable->getWorldPosition();
+ LLQuaternion cur_rotation_world = mDrawable->getWorldRotation();
+
+ if (mLastRootPos.length() >= MAX_STANDOFF_FROM_ORIGIN
+ && (cur_position_world.length() < MAX_STANDOFF_FROM_ORIGIN
+ || dist_vec(cur_position_world, mLastRootPos) > MAX_STANDOFF_DISTANCE_CHANGE))
+ {
+ // Most likely drawable got updated too early or some updates were missed - we got relative position to non-existing parent
+ // restore coordinates from cache
+ cur_position_world = mLastRootPos;
+ }
+
+ // set *local* position based on last *world* position, since we're unparenting the avatar
+ mDrawable->mXform.setPosition(cur_position_world);
+ mDrawable->mXform.setRotation(cur_rotation_world);
+
+ gPipeline.markMoved(mDrawable, TRUE);
+
+ sitDown(FALSE);
+
+ mRoot->getXform()->setParent(NULL); // LLVOAvatar::getOffObject
+ // SL-315
+ mRoot->setPosition(cur_position_world);
+ mRoot->setRotation(cur_rotation_world);
+ mRoot->getXform()->update();
if (mEnableDefaultMotions)
{
- startMotion(ANIM_AGENT_BODY_NOISE);
+ startMotion(ANIM_AGENT_BODY_NOISE);
}
- if (isSelf())
- {
- LLQuaternion av_rot = gAgent.getFrameAgent().getQuaternion();
- LLQuaternion obj_rot = sit_object ? sit_object->getRenderRotation() : LLQuaternion::DEFAULT;
- av_rot = av_rot * obj_rot;
- LLVector3 at_axis = LLVector3::x_axis;
- at_axis = at_axis * av_rot;
- at_axis.mV[VZ] = 0.f;
- at_axis.normalize();
- gAgent.resetAxes(at_axis);
- gAgentCamera.setThirdPersonHeadOffset(LLVector3(0.f, 0.f, 1.f));
- gAgentCamera.setSitCamera(LLUUID::null);
- }
+ if (isSelf())
+ {
+ LLQuaternion av_rot = gAgent.getFrameAgent().getQuaternion();
+ LLQuaternion obj_rot = sit_object ? sit_object->getRenderRotation() : LLQuaternion::DEFAULT;
+ av_rot = av_rot * obj_rot;
+ LLVector3 at_axis = LLVector3::x_axis;
+ at_axis = at_axis * av_rot;
+ at_axis.mV[VZ] = 0.f;
+ at_axis.normalize();
+ gAgent.resetAxes(at_axis);
+ gAgentCamera.setThirdPersonHeadOffset(LLVector3(0.f, 0.f, 1.f));
+ gAgentCamera.setSitCamera(LLUUID::null);
+ }
}
//-----------------------------------------------------------------------------
// findAvatarFromAttachment()
//-----------------------------------------------------------------------------
-// static
+// static
LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj )
{
- if( obj->isAttachment() )
- {
- do
- {
- obj = (LLViewerObject*) obj->getParent();
- }
- while( obj && !obj->isAvatar() );
+ if( obj->isAttachment() )
+ {
+ do
+ {
+ obj = (LLViewerObject*) obj->getParent();
+ }
+ while( obj && !obj->isAvatar() );
- if( obj && !obj->isDead() )
- {
- return (LLVOAvatar*)obj;
- }
- }
- return NULL;
+ if( obj && !obj->isDead() )
+ {
+ return (LLVOAvatar*)obj;
+ }
+ }
+ return NULL;
}
S32 LLVOAvatar::getAttachmentCount()
{
- S32 count = mAttachmentPoints.size();
- return count;
+ S32 count = mAttachmentPoints.size();
+ return count;
}
BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const
{
- if (mIsDummy) return TRUE;
-
- if (isSelf())
- {
- return LLAvatarAppearance::isWearingWearableType(type);
- }
-
- switch(type)
- {
- case LLWearableType::WT_SHAPE:
- case LLWearableType::WT_SKIN:
- case LLWearableType::WT_HAIR:
- case LLWearableType::WT_EYES:
- return TRUE; // everyone has all bodyparts
- default:
- break; // Do nothing
- }
-
- for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
- tex_iter != LLAvatarAppearance::getDictionary()->getTextures().end();
- ++tex_iter)
- {
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second;
- if (texture_dict->mWearableType == type)
- {
- // Thus, you must check to see if the corresponding baked texture is defined.
- // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing
- // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that
- // gets baked into a texture that always exists (upper or lower).
- if (texture_dict->mIsUsedByBakedTexture)
- {
- const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- return isTextureDefined(LLAvatarAppearance::getDictionary()->getBakedTexture(baked_index)->mTextureIndex);
- }
- return FALSE;
- }
- }
- return FALSE;
-}
-
-LLViewerObject * LLVOAvatar::findAttachmentByID( const LLUUID & target_id ) const
-{
- for(attachment_map_t::const_iterator attachment_points_iter = mAttachmentPoints.begin();
- attachment_points_iter != gAgentAvatarp->mAttachmentPoints.end();
- ++attachment_points_iter)
- {
- LLViewerJointAttachment* attachment = attachment_points_iter->second;
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject *attached_object = attachment_iter->get();
- if (attached_object &&
- attached_object->getID() == target_id)
- {
- return attached_object;
- }
- }
- }
-
- return NULL;
+ if (mIsDummy) return TRUE;
+
+ if (isSelf())
+ {
+ return LLAvatarAppearance::isWearingWearableType(type);
+ }
+
+ switch(type)
+ {
+ case LLWearableType::WT_SHAPE:
+ case LLWearableType::WT_SKIN:
+ case LLWearableType::WT_HAIR:
+ case LLWearableType::WT_EYES:
+ return TRUE; // everyone has all bodyparts
+ default:
+ break; // Do nothing
+ }
+
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
+ tex_iter != LLAvatarAppearance::getDictionary()->getTextures().end();
+ ++tex_iter)
+ {
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second;
+ if (texture_dict->mWearableType == type)
+ {
+ // Thus, you must check to see if the corresponding baked texture is defined.
+ // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing
+ // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that
+ // gets baked into a texture that always exists (upper or lower).
+ if (texture_dict->mIsUsedByBakedTexture)
+ {
+ const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+ return isTextureDefined(LLAvatarAppearance::getDictionary()->getBakedTexture(baked_index)->mTextureIndex);
+ }
+ return FALSE;
+ }
+ }
+ return FALSE;
+}
+
+LLViewerObject * LLVOAvatar::findAttachmentByID( const LLUUID & target_id ) const
+{
+ for(attachment_map_t::const_iterator attachment_points_iter = mAttachmentPoints.begin();
+ attachment_points_iter != gAgentAvatarp->mAttachmentPoints.end();
+ ++attachment_points_iter)
+ {
+ LLViewerJointAttachment* attachment = attachment_points_iter->second;
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject *attached_object = attachment_iter->get();
+ if (attached_object &&
+ attached_object->getID() == target_id)
+ {
+ return attached_object;
+ }
+ }
+ }
+
+ return NULL;
}
// virtual
@@ -7977,40 +7977,40 @@ void LLVOAvatar::invalidateAll()
// virtual
void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color)
{
- if (global_color == mTexSkinColor)
- {
- invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet);
- invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet);
- invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet);
- }
- else if (global_color == mTexHairColor)
- {
- invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet);
- invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet);
-
- // ! BACKWARDS COMPATIBILITY !
- // Fix for dealing with avatars from viewers that don't bake hair.
- if (!isTextureDefined(mBakedTextureDatas[BAKED_HAIR].mTextureIndex))
- {
- LLColor4 color = mTexHairColor->getColor();
- avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin();
- avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end();
- for (; iter != end; ++iter)
- {
- LLAvatarJointMesh* mesh = (*iter);
- if (mesh)
- {
- mesh->setColor( color );
- }
- }
- }
- }
- else if (global_color == mTexEyeColor)
- {
- // LL_INFOS() << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << LL_ENDL;
- invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet);
- }
- updateMeshTextures();
+ if (global_color == mTexSkinColor)
+ {
+ invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet);
+ invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet);
+ invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet);
+ }
+ else if (global_color == mTexHairColor)
+ {
+ invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet);
+ invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet);
+
+ // ! BACKWARDS COMPATIBILITY !
+ // Fix for dealing with avatars from viewers that don't bake hair.
+ if (!isTextureDefined(mBakedTextureDatas[BAKED_HAIR].mTextureIndex))
+ {
+ LLColor4 color = mTexHairColor->getColor();
+ avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin();
+ avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end();
+ for (; iter != end; ++iter)
+ {
+ LLAvatarJointMesh* mesh = (*iter);
+ if (mesh)
+ {
+ mesh->setColor( color );
+ }
+ }
+ }
+ }
+ else if (global_color == mTexEyeColor)
+ {
+ // LL_INFOS() << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << LL_ENDL;
+ invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet);
+ }
+ updateMeshTextures();
}
// virtual
@@ -8019,12 +8019,12 @@ bool LLVOAvatar::shouldRenderRigged() const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- if (getOverallAppearance() == AOA_NORMAL)
- {
- return true;
- }
- // TBD - render for AOA_JELLYDOLL?
- return false;
+ if (getOverallAppearance() == AOA_NORMAL)
+ {
+ return true;
+ }
+ // TBD - render for AOA_JELLYDOLL?
+ return false;
}
// FIXME: We have an mVisible member, set in updateVisibility(), but this
@@ -8035,207 +8035,207 @@ bool LLVOAvatar::shouldRenderRigged() const
// Maybe better naming could make this clearer?
BOOL LLVOAvatar::isVisible() const
{
- return mDrawable.notNull()
- && (!mOrphaned || isSelf())
- && (mDrawable->isVisible() || mIsDummy);
+ return mDrawable.notNull()
+ && (!mOrphaned || isSelf())
+ && (mDrawable->isVisible() || mIsDummy);
}
// Determine if we have enough avatar data to render
bool LLVOAvatar::getIsCloud() const
{
- if (mIsDummy)
- {
- return false;
- }
+ if (mIsDummy)
+ {
+ return false;
+ }
- return ( ((const_cast<LLVOAvatar*>(this))->visualParamWeightsAreDefault())// Do we have a shape?
- || ( !isTextureDefined(TEX_LOWER_BAKED)
- || !isTextureDefined(TEX_UPPER_BAKED)
- || !isTextureDefined(TEX_HEAD_BAKED)
- )
- );
+ return ( ((const_cast<LLVOAvatar*>(this))->visualParamWeightsAreDefault())// Do we have a shape?
+ || ( !isTextureDefined(TEX_LOWER_BAKED)
+ || !isTextureDefined(TEX_UPPER_BAKED)
+ || !isTextureDefined(TEX_HEAD_BAKED)
+ )
+ );
}
void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status)
{
- // State machine for rezzed status. Statuses are -1 on startup, 0
- // = cloud, 1 = gray, 2 = downloading, 3 = full.
- // Purpose is to collect time data for each it takes avatar to reach
- // various loading landmarks: gray, textured (partial), textured fully.
-
- if (rez_status != mLastRezzedStatus)
- {
- LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL;
-
- if (mLastRezzedStatus == -1 && rez_status != -1)
- {
- // First time initialization, start all timers.
- for (S32 i = 1; i < 4; i++)
- {
- startPhase("load_" + LLVOAvatar::rezStatusToString(i));
- startPhase("first_load_" + LLVOAvatar::rezStatusToString(i));
- }
- }
- if (rez_status < mLastRezzedStatus)
- {
- // load level has decreased. start phase timers for higher load levels.
- for (S32 i = rez_status+1; i <= mLastRezzedStatus; i++)
- {
- startPhase("load_" + LLVOAvatar::rezStatusToString(i));
- }
- }
- else if (rez_status > mLastRezzedStatus)
- {
- // load level has increased. stop phase timers for lower and equal load levels.
- for (S32 i = llmax(mLastRezzedStatus+1,1); i <= rez_status; i++)
- {
- stopPhase("load_" + LLVOAvatar::rezStatusToString(i));
- stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false);
- }
- if (rez_status == 3)
- {
- // "fully loaded", mark any pending appearance change complete.
- selfStopPhase("update_appearance_from_cof");
- selfStopPhase("wear_inventory_category", false);
- selfStopPhase("process_initial_wearables_update", false);
+ // State machine for rezzed status. Statuses are -1 on startup, 0
+ // = cloud, 1 = gray, 2 = downloading, 3 = full.
+ // Purpose is to collect time data for each it takes avatar to reach
+ // various loading landmarks: gray, textured (partial), textured fully.
+
+ if (rez_status != mLastRezzedStatus)
+ {
+ LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL;
+
+ if (mLastRezzedStatus == -1 && rez_status != -1)
+ {
+ // First time initialization, start all timers.
+ for (S32 i = 1; i < 4; i++)
+ {
+ startPhase("load_" + LLVOAvatar::rezStatusToString(i));
+ startPhase("first_load_" + LLVOAvatar::rezStatusToString(i));
+ }
+ }
+ if (rez_status < mLastRezzedStatus)
+ {
+ // load level has decreased. start phase timers for higher load levels.
+ for (S32 i = rez_status+1; i <= mLastRezzedStatus; i++)
+ {
+ startPhase("load_" + LLVOAvatar::rezStatusToString(i));
+ }
+ }
+ else if (rez_status > mLastRezzedStatus)
+ {
+ // load level has increased. stop phase timers for lower and equal load levels.
+ for (S32 i = llmax(mLastRezzedStatus+1,1); i <= rez_status; i++)
+ {
+ stopPhase("load_" + LLVOAvatar::rezStatusToString(i));
+ stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false);
+ }
+ if (rez_status == 3)
+ {
+ // "fully loaded", mark any pending appearance change complete.
+ selfStopPhase("update_appearance_from_cof");
+ selfStopPhase("wear_inventory_category", false);
+ selfStopPhase("process_initial_wearables_update", false);
updateVisualComplexity();
- }
- }
- mLastRezzedStatus = rez_status;
- }
+ }
+ }
+ mLastRezzedStatus = rez_status;
+ }
}
void LLVOAvatar::clearPhases()
{
- getPhases().clearPhases();
+ getPhases().clearPhases();
}
void LLVOAvatar::startPhase(const std::string& phase_name)
{
- F32 elapsed = 0.0;
- bool completed = false;
- bool found = getPhases().getPhaseValues(phase_name, elapsed, completed);
- //LL_DEBUGS("Avatar") << avString() << " phase state " << phase_name
- // << " found " << found << " elapsed " << elapsed << " completed " << completed << LL_ENDL;
- if (found)
- {
- if (!completed)
- {
- LL_DEBUGS("Avatar") << avString() << "no-op, start when started already for " << phase_name << LL_ENDL;
- return;
- }
- }
- LL_DEBUGS("Avatar") << "started phase " << phase_name << LL_ENDL;
- getPhases().startPhase(phase_name);
+ F32 elapsed = 0.0;
+ bool completed = false;
+ bool found = getPhases().getPhaseValues(phase_name, elapsed, completed);
+ //LL_DEBUGS("Avatar") << avString() << " phase state " << phase_name
+ // << " found " << found << " elapsed " << elapsed << " completed " << completed << LL_ENDL;
+ if (found)
+ {
+ if (!completed)
+ {
+ LL_DEBUGS("Avatar") << avString() << "no-op, start when started already for " << phase_name << LL_ENDL;
+ return;
+ }
+ }
+ LL_DEBUGS("Avatar") << "started phase " << phase_name << LL_ENDL;
+ getPhases().startPhase(phase_name);
}
void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check)
{
- F32 elapsed = 0.0;
- bool completed = false;
- if (getPhases().getPhaseValues(phase_name, elapsed, completed))
- {
- if (!completed)
- {
- getPhases().stopPhase(phase_name);
- completed = true;
- logMetricsTimerRecord(phase_name, elapsed, completed);
- LL_DEBUGS("Avatar") << avString() << "stopped phase " << phase_name << " elapsed " << elapsed << LL_ENDL;
- }
- else
- {
- if (err_check)
- {
- LL_DEBUGS("Avatar") << "no-op, stop when stopped already for " << phase_name << LL_ENDL;
- }
- }
- }
- else
- {
- if (err_check)
- {
- LL_DEBUGS("Avatar") << "no-op, stop when not started for " << phase_name << LL_ENDL;
- }
- }
+ F32 elapsed = 0.0;
+ bool completed = false;
+ if (getPhases().getPhaseValues(phase_name, elapsed, completed))
+ {
+ if (!completed)
+ {
+ getPhases().stopPhase(phase_name);
+ completed = true;
+ logMetricsTimerRecord(phase_name, elapsed, completed);
+ LL_DEBUGS("Avatar") << avString() << "stopped phase " << phase_name << " elapsed " << elapsed << LL_ENDL;
+ }
+ else
+ {
+ if (err_check)
+ {
+ LL_DEBUGS("Avatar") << "no-op, stop when stopped already for " << phase_name << LL_ENDL;
+ }
+ }
+ }
+ else
+ {
+ if (err_check)
+ {
+ LL_DEBUGS("Avatar") << "no-op, stop when not started for " << phase_name << LL_ENDL;
+ }
+ }
}
void LLVOAvatar::logPendingPhases()
{
- if (!isAgentAvatarValid())
- {
- return;
- }
-
- for (LLViewerStats::phase_map_t::iterator it = getPhases().begin();
- it != getPhases().end();
- ++it)
- {
- const std::string& phase_name = it->first;
- F32 elapsed;
- bool completed;
- if (getPhases().getPhaseValues(phase_name, elapsed, completed))
- {
- if (!completed)
- {
- logMetricsTimerRecord(phase_name, elapsed, completed);
- }
- }
- }
+ if (!isAgentAvatarValid())
+ {
+ return;
+ }
+
+ for (LLViewerStats::phase_map_t::iterator it = getPhases().begin();
+ it != getPhases().end();
+ ++it)
+ {
+ const std::string& phase_name = it->first;
+ F32 elapsed;
+ bool completed;
+ if (getPhases().getPhaseValues(phase_name, elapsed, completed))
+ {
+ if (!completed)
+ {
+ logMetricsTimerRecord(phase_name, elapsed, completed);
+ }
+ }
+ }
}
//static
void LLVOAvatar::logPendingPhasesAllAvatars()
{
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- LLVOAvatar* inst = (LLVOAvatar*) *iter;
- if( inst->isDead() )
- {
- continue;
- }
- inst->logPendingPhases();
- }
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ LLVOAvatar* inst = (LLVOAvatar*) *iter;
+ if( inst->isDead() )
+ {
+ continue;
+ }
+ inst->logPendingPhases();
+ }
}
void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed)
{
- if (!isAgentAvatarValid())
- {
- return;
- }
-
- LLSD record;
- record["timer_name"] = phase_name;
- record["avatar_id"] = getID();
- record["elapsed"] = elapsed;
- record["completed"] = completed;
- U32 grid_x(0), grid_y(0);
- if (getRegion() && LLWorld::instance().isRegionListed(getRegion()))
- {
- record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion());
- grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y);
- }
- record["grid_x"] = LLSD::Integer(grid_x);
- record["grid_y"] = LLSD::Integer(grid_y);
- record["is_using_server_bakes"] = true;
- record["is_self"] = isSelf();
-
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->addMetricsTimerRecord(record);
- }
+ if (!isAgentAvatarValid())
+ {
+ return;
+ }
+
+ LLSD record;
+ record["timer_name"] = phase_name;
+ record["avatar_id"] = getID();
+ record["elapsed"] = elapsed;
+ record["completed"] = completed;
+ U32 grid_x(0), grid_y(0);
+ if (getRegion() && LLWorld::instance().isRegionListed(getRegion()))
+ {
+ record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion());
+ grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y);
+ }
+ record["grid_x"] = LLSD::Integer(grid_x);
+ record["grid_y"] = LLSD::Integer(grid_y);
+ record["is_using_server_bakes"] = true;
+ record["is_self"] = isSelf();
+
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->addMetricsTimerRecord(record);
+ }
}
// call periodically to keep isFullyLoaded up to date.
// returns true if the value has changed.
BOOL LLVOAvatar::updateIsFullyLoaded()
{
- S32 rez_status = getRezzedStatus();
- bool loading = getIsCloud();
- if (mFirstFullyVisible && !mIsControlAvatar)
- {
+ S32 rez_status = getRezzedStatus();
+ bool loading = getIsCloud();
+ if (mFirstFullyVisible && !mIsControlAvatar)
+ {
loading = ((rez_status < 2)
// Wait at least 60s for unfinished textures to finish on first load,
// don't wait forever, it might fail. Even if it will eventually load by
@@ -8246,56 +8246,56 @@ BOOL LLVOAvatar::updateIsFullyLoaded()
|| (rez_status < 3 && !isFullyBaked())
|| hasPendingAttachedMeshes()
);
- }
- updateRezzedStatusTimers(rez_status);
- updateRuthTimer(loading);
- return processFullyLoadedChange(loading);
+ }
+ updateRezzedStatusTimers(rez_status);
+ updateRuthTimer(loading);
+ return processFullyLoadedChange(loading);
}
void LLVOAvatar::updateRuthTimer(bool loading)
{
- if (isSelf() || !loading)
- {
- return;
- }
-
- if (mPreviousFullyLoaded)
- {
- mRuthTimer.reset();
- debugAvatarRezTime("AvatarRezCloudNotification","became cloud");
- }
-
- const F32 LOADING_TIMEOUT__SECONDS = 120.f;
- if (mRuthTimer.getElapsedTimeF32() > LOADING_TIMEOUT__SECONDS)
- {
- LL_DEBUGS("Avatar") << avString()
- << "Ruth Timer timeout: Missing texture data for '" << getFullname() << "' "
- << "( Params loaded : " << !visualParamWeightsAreDefault() << " ) "
- << "( Lower : " << isTextureDefined(TEX_LOWER_BAKED) << " ) "
- << "( Upper : " << isTextureDefined(TEX_UPPER_BAKED) << " ) "
- << "( Head : " << isTextureDefined(TEX_HEAD_BAKED) << " )."
- << LL_ENDL;
-
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarTexturesRequest(getID());
- mRuthTimer.reset();
- }
+ if (isSelf() || !loading)
+ {
+ return;
+ }
+
+ if (mPreviousFullyLoaded)
+ {
+ mRuthTimer.reset();
+ debugAvatarRezTime("AvatarRezCloudNotification","became cloud");
+ }
+
+ const F32 LOADING_TIMEOUT__SECONDS = 120.f;
+ if (mRuthTimer.getElapsedTimeF32() > LOADING_TIMEOUT__SECONDS)
+ {
+ LL_DEBUGS("Avatar") << avString()
+ << "Ruth Timer timeout: Missing texture data for '" << getFullname() << "' "
+ << "( Params loaded : " << !visualParamWeightsAreDefault() << " ) "
+ << "( Lower : " << isTextureDefined(TEX_LOWER_BAKED) << " ) "
+ << "( Upper : " << isTextureDefined(TEX_UPPER_BAKED) << " ) "
+ << "( Head : " << isTextureDefined(TEX_HEAD_BAKED) << " )."
+ << LL_ENDL;
+
+ LLAvatarPropertiesProcessor::getInstance()->sendAvatarTexturesRequest(getID());
+ mRuthTimer.reset();
+ }
}
BOOL LLVOAvatar::processFullyLoadedChange(bool loading)
{
- // We wait a little bit before giving the 'all clear', to let things to
- // settle down (models to snap into place, textures to get first packets).
+ // We wait a little bit before giving the 'all clear', to let things to
+ // settle down (models to snap into place, textures to get first packets).
// And if viewer isn't aware of some parts yet, this gives them a chance
// to arrive.
- const F32 LOADED_DELAY = 1.f;
+ const F32 LOADED_DELAY = 1.f;
if (loading)
{
mFullyLoadedTimer.reset();
}
- if (mFirstFullyVisible)
- {
+ if (mFirstFullyVisible)
+ {
if (!isSelf() && loading)
{
// Note that textures can causes 60s delay on thier own
@@ -8312,31 +8312,31 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading)
mFirstUseDelaySeconds *= 1.25;
}
}
- mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > mFirstUseDelaySeconds);
- }
- else
- {
- mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > LOADED_DELAY);
- }
-
- if (!mPreviousFullyLoaded && !loading && mFullyLoaded)
- {
- debugAvatarRezTime("AvatarRezNotification","fully loaded");
- }
-
- // did our loading state "change" from last call?
- // FIXME runway - why are we updating every 30 calls even if nothing has changed?
- // This causes updateLOD() to run every 30 frames, among other things.
- const S32 UPDATE_RATE = 30;
- BOOL changed =
- ((mFullyLoaded != mPreviousFullyLoaded) || // if the value is different from the previous call
- (!mFullyLoadedInitialized) || // if we've never been called before
- (mFullyLoadedFrameCounter % UPDATE_RATE == 0)); // every now and then issue a change
- BOOL fully_loaded_changed = (mFullyLoaded != mPreviousFullyLoaded);
-
- mPreviousFullyLoaded = mFullyLoaded;
- mFullyLoadedInitialized = TRUE;
- mFullyLoadedFrameCounter++;
+ mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > mFirstUseDelaySeconds);
+ }
+ else
+ {
+ mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > LOADED_DELAY);
+ }
+
+ if (!mPreviousFullyLoaded && !loading && mFullyLoaded)
+ {
+ debugAvatarRezTime("AvatarRezNotification","fully loaded");
+ }
+
+ // did our loading state "change" from last call?
+ // FIXME runway - why are we updating every 30 calls even if nothing has changed?
+ // This causes updateLOD() to run every 30 frames, among other things.
+ const S32 UPDATE_RATE = 30;
+ BOOL changed =
+ ((mFullyLoaded != mPreviousFullyLoaded) || // if the value is different from the previous call
+ (!mFullyLoadedInitialized) || // if we've never been called before
+ (mFullyLoadedFrameCounter % UPDATE_RATE == 0)); // every now and then issue a change
+ BOOL fully_loaded_changed = (mFullyLoaded != mPreviousFullyLoaded);
+
+ mPreviousFullyLoaded = mFullyLoaded;
+ mFullyLoadedInitialized = TRUE;
+ mFullyLoadedFrameCounter++;
if (changed && isSelf())
{
@@ -8344,45 +8344,45 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading)
LLAvatarRenderNotifier::getInstance()->updateNotificationState();
}
- if (fully_loaded_changed && !isSelf() && mFullyLoaded && isImpostor())
- {
- // Fix for jellydoll initially invisible
- mNeedsImpostorUpdate = TRUE;
- mLastImpostorUpdateReason = 6;
- }
- return changed;
+ if (fully_loaded_changed && !isSelf() && mFullyLoaded && isImpostor())
+ {
+ // Fix for jellydoll initially invisible
+ mNeedsImpostorUpdate = TRUE;
+ mLastImpostorUpdateReason = 6;
+ }
+ return changed;
}
BOOL LLVOAvatar::isFullyLoaded() const
{
- return (mRenderUnloadedAvatar || mFullyLoaded);
+ return (mRenderUnloadedAvatar || mFullyLoaded);
}
bool LLVOAvatar::isTooComplex() const
{
- bool too_complex;
+ bool too_complex;
static LLCachedControl<bool> always_render_friends(gSavedSettings, "AlwaysRenderFriends");
- bool render_friend = (LLAvatarTracker::instance().isBuddy(getID()) && always_render_friends);
-
- if (isSelf() || render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER)
- {
- too_complex = false;
- }
- else
- {
- // Determine if visually muted or not
- static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0U);
- static LLCachedControl<F32> max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 1000.0f);
- // If the user has chosen unlimited max complexity, we also disregard max attachment area
+ bool render_friend = (LLAvatarTracker::instance().isBuddy(getID()) && always_render_friends);
+
+ if (isSelf() || render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER)
+ {
+ too_complex = false;
+ }
+ else
+ {
+ // Determine if visually muted or not
+ static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0U);
+ static LLCachedControl<F32> max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 1000.0f);
+ // If the user has chosen unlimited max complexity, we also disregard max attachment area
// so that unlimited will completely disable the overly complex impostor rendering
// yes, this leaves them vulnerable to griefing objects... their choice
too_complex = ( max_render_cost > 0
&& (mVisualComplexity > max_render_cost
|| (max_attachment_area > 0.0f && mAttachmentSurfaceArea > max_attachment_area)
));
- }
+ }
- return too_complex;
+ return too_complex;
}
bool LLVOAvatar::isTooSlow() const
@@ -8407,13 +8407,13 @@ void LLVOAvatar::updateTooSlow()
// mTooSlow - Is the avatar flagged as being slow (includes shadow time)
// mTooSlowWithoutShadows - Is the avatar flagged as being slow even with shadows removed.
-
+
// get max render time in ms
F32 max_art_ms = (F32) (LLPerfStats::renderAvatarMaxART_ns / 1000000.0);
- bool autotune = LLPerfStats::tunables.userAutoTuneEnabled && !mIsControlAvatar && !isSelf();
+ bool autotune = LLPerfStats::tunables.userAutoTuneEnabled && !mIsControlAvatar && !isSelf();
- bool ignore_tune = false;
+ bool ignore_tune = false;
if (autotune && sAVsIgnoringARTLimit.size() > 0)
{
auto it = std::find(sAVsIgnoringARTLimit.begin(), sAVsIgnoringARTLimit.end(), mID);
@@ -8424,18 +8424,18 @@ void LLVOAvatar::updateTooSlow()
}
}
- bool exceeds_max_ART =
- ((LLPerfStats::renderAvatarMaxART_ns > 0) &&
+ bool exceeds_max_ART =
+ ((LLPerfStats::renderAvatarMaxART_ns > 0) &&
(mGPURenderTime >= max_art_ms)); // NOTE: don't use getGPURenderTime accessor here to avoid "isTooSlow" feedback loop
if (exceeds_max_ART && !ignore_tune)
{
mTooSlow = true;
-
+
if(!mTooSlowWithoutShadows) // if we were not previously above the full impostor cap
{
- bool render_friend_or_exception = ( alwaysRenderFriends && LLAvatarTracker::instance().isBuddy( id ) ) ||
- ( getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER );
+ bool render_friend_or_exception = ( alwaysRenderFriends && LLAvatarTracker::instance().isBuddy( id ) ) ||
+ ( getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER );
if( (!isSelf() || allowSelfImpostor) && !render_friend_or_exception )
{
// Note: slow rendering Friends still get their shadows zapped.
@@ -8448,10 +8448,10 @@ void LLVOAvatar::updateTooSlow()
mTooSlow = false;
mTooSlowWithoutShadows = false;
- if (ignore_tune)
- {
+ if (ignore_tune)
+ {
return;
- }
+ }
}
if(mTooSlow && !mTuned)
{
@@ -8470,26 +8470,26 @@ void LLVOAvatar::updateTooSlow()
//-----------------------------------------------------------------------------
LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const
{
- return mMotionController.findMotion(id);
+ return mMotionController.findMotion(id);
}
// This is a semi-deprecated debugging tool - meshes will not show as
// colorized if using deferred rendering.
void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color)
{
- if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked"))
- {
- avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
- avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
- for (; iter != end; ++iter)
- {
- LLAvatarJointMesh* mesh = (*iter);
- if (mesh)
- {
- mesh->setColor(color);
- }
- }
- }
+ if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked"))
+ {
+ avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
+ avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
+ for (; iter != end; ++iter)
+ {
+ LLAvatarJointMesh* mesh = (*iter);
+ if (mesh)
+ {
+ mesh->setColor(color);
+ }
+ }
+ }
}
@@ -8499,109 +8499,109 @@ void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color)
//-----------------------------------------------------------------------------
void LLVOAvatar::updateMeshVisibility()
{
- bool bake_flag[BAKED_NUM_INDICES];
- memset(bake_flag, 0, BAKED_NUM_INDICES*sizeof(bool));
-
- if (getOverallAppearance() == AOA_NORMAL)
- {
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment)
- {
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject *objectp = attachment_iter->get();
- if (objectp)
- {
- for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++)
- {
- LLTextureEntry* tex_entry = objectp->getTE(face_index);
- bake_flag[BAKED_HEAD] |= (tex_entry->getID() == IMG_USE_BAKED_HEAD);
- bake_flag[BAKED_EYES] |= (tex_entry->getID() == IMG_USE_BAKED_EYES);
- bake_flag[BAKED_HAIR] |= (tex_entry->getID() == IMG_USE_BAKED_HAIR);
- bake_flag[BAKED_LOWER] |= (tex_entry->getID() == IMG_USE_BAKED_LOWER);
- bake_flag[BAKED_UPPER] |= (tex_entry->getID() == IMG_USE_BAKED_UPPER);
- bake_flag[BAKED_SKIRT] |= (tex_entry->getID() == IMG_USE_BAKED_SKIRT);
- bake_flag[BAKED_LEFT_ARM] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTARM);
- bake_flag[BAKED_LEFT_LEG] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTLEG);
- bake_flag[BAKED_AUX1] |= (tex_entry->getID() == IMG_USE_BAKED_AUX1);
- bake_flag[BAKED_AUX2] |= (tex_entry->getID() == IMG_USE_BAKED_AUX2);
- bake_flag[BAKED_AUX3] |= (tex_entry->getID() == IMG_USE_BAKED_AUX3);
- }
- }
-
- LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter1 = child_list.begin();
- iter1 != child_list.end(); ++iter1)
- {
- LLViewerObject* objectchild = *iter1;
- if (objectchild)
- {
- for (int face_index = 0; face_index < objectchild->getNumTEs(); face_index++)
- {
- LLTextureEntry* tex_entry = objectchild->getTE(face_index);
- bake_flag[BAKED_HEAD] |= (tex_entry->getID() == IMG_USE_BAKED_HEAD);
- bake_flag[BAKED_EYES] |= (tex_entry->getID() == IMG_USE_BAKED_EYES);
- bake_flag[BAKED_HAIR] |= (tex_entry->getID() == IMG_USE_BAKED_HAIR);
- bake_flag[BAKED_LOWER] |= (tex_entry->getID() == IMG_USE_BAKED_LOWER);
- bake_flag[BAKED_UPPER] |= (tex_entry->getID() == IMG_USE_BAKED_UPPER);
- bake_flag[BAKED_SKIRT] |= (tex_entry->getID() == IMG_USE_BAKED_SKIRT);
- bake_flag[BAKED_LEFT_ARM] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTARM);
- bake_flag[BAKED_LEFT_LEG] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTLEG);
- bake_flag[BAKED_AUX1] |= (tex_entry->getID() == IMG_USE_BAKED_AUX1);
- bake_flag[BAKED_AUX2] |= (tex_entry->getID() == IMG_USE_BAKED_AUX2);
- bake_flag[BAKED_AUX3] |= (tex_entry->getID() == IMG_USE_BAKED_AUX3);
- }
- }
- }
- }
- }
- }
- }
-
- //LL_INFOS() << "head " << bake_flag[BAKED_HEAD] << "eyes " << bake_flag[BAKED_EYES] << "hair " << bake_flag[BAKED_HAIR] << "lower " << bake_flag[BAKED_LOWER] << "upper " << bake_flag[BAKED_UPPER] << "skirt " << bake_flag[BAKED_SKIRT] << LL_ENDL;
-
- for (S32 i = 0; i < mMeshLOD.size(); i++)
- {
- LLAvatarJoint* joint = mMeshLOD[i];
- if (i == MESH_ID_HAIR)
- {
- joint->setVisible(!bake_flag[BAKED_HAIR], TRUE);
- }
- else if (i == MESH_ID_HEAD)
- {
- joint->setVisible(!bake_flag[BAKED_HEAD], TRUE);
- }
- else if (i == MESH_ID_SKIRT)
- {
- joint->setVisible(!bake_flag[BAKED_SKIRT], TRUE);
- }
- else if (i == MESH_ID_UPPER_BODY)
- {
- joint->setVisible(!bake_flag[BAKED_UPPER], TRUE);
- }
- else if (i == MESH_ID_LOWER_BODY)
- {
- joint->setVisible(!bake_flag[BAKED_LOWER], TRUE);
- }
- else if (i == MESH_ID_EYEBALL_LEFT)
- {
- joint->setVisible(!bake_flag[BAKED_EYES], TRUE);
- }
- else if (i == MESH_ID_EYEBALL_RIGHT)
- {
- joint->setVisible(!bake_flag[BAKED_EYES], TRUE);
- }
- else if (i == MESH_ID_EYELASH)
- {
- joint->setVisible(!bake_flag[BAKED_HEAD], TRUE);
- }
- }
+ bool bake_flag[BAKED_NUM_INDICES];
+ memset(bake_flag, 0, BAKED_NUM_INDICES*sizeof(bool));
+
+ if (getOverallAppearance() == AOA_NORMAL)
+ {
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment)
+ {
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject *objectp = attachment_iter->get();
+ if (objectp)
+ {
+ for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++)
+ {
+ LLTextureEntry* tex_entry = objectp->getTE(face_index);
+ bake_flag[BAKED_HEAD] |= (tex_entry->getID() == IMG_USE_BAKED_HEAD);
+ bake_flag[BAKED_EYES] |= (tex_entry->getID() == IMG_USE_BAKED_EYES);
+ bake_flag[BAKED_HAIR] |= (tex_entry->getID() == IMG_USE_BAKED_HAIR);
+ bake_flag[BAKED_LOWER] |= (tex_entry->getID() == IMG_USE_BAKED_LOWER);
+ bake_flag[BAKED_UPPER] |= (tex_entry->getID() == IMG_USE_BAKED_UPPER);
+ bake_flag[BAKED_SKIRT] |= (tex_entry->getID() == IMG_USE_BAKED_SKIRT);
+ bake_flag[BAKED_LEFT_ARM] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTARM);
+ bake_flag[BAKED_LEFT_LEG] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTLEG);
+ bake_flag[BAKED_AUX1] |= (tex_entry->getID() == IMG_USE_BAKED_AUX1);
+ bake_flag[BAKED_AUX2] |= (tex_entry->getID() == IMG_USE_BAKED_AUX2);
+ bake_flag[BAKED_AUX3] |= (tex_entry->getID() == IMG_USE_BAKED_AUX3);
+ }
+ }
+
+ LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter1 = child_list.begin();
+ iter1 != child_list.end(); ++iter1)
+ {
+ LLViewerObject* objectchild = *iter1;
+ if (objectchild)
+ {
+ for (int face_index = 0; face_index < objectchild->getNumTEs(); face_index++)
+ {
+ LLTextureEntry* tex_entry = objectchild->getTE(face_index);
+ bake_flag[BAKED_HEAD] |= (tex_entry->getID() == IMG_USE_BAKED_HEAD);
+ bake_flag[BAKED_EYES] |= (tex_entry->getID() == IMG_USE_BAKED_EYES);
+ bake_flag[BAKED_HAIR] |= (tex_entry->getID() == IMG_USE_BAKED_HAIR);
+ bake_flag[BAKED_LOWER] |= (tex_entry->getID() == IMG_USE_BAKED_LOWER);
+ bake_flag[BAKED_UPPER] |= (tex_entry->getID() == IMG_USE_BAKED_UPPER);
+ bake_flag[BAKED_SKIRT] |= (tex_entry->getID() == IMG_USE_BAKED_SKIRT);
+ bake_flag[BAKED_LEFT_ARM] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTARM);
+ bake_flag[BAKED_LEFT_LEG] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTLEG);
+ bake_flag[BAKED_AUX1] |= (tex_entry->getID() == IMG_USE_BAKED_AUX1);
+ bake_flag[BAKED_AUX2] |= (tex_entry->getID() == IMG_USE_BAKED_AUX2);
+ bake_flag[BAKED_AUX3] |= (tex_entry->getID() == IMG_USE_BAKED_AUX3);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //LL_INFOS() << "head " << bake_flag[BAKED_HEAD] << "eyes " << bake_flag[BAKED_EYES] << "hair " << bake_flag[BAKED_HAIR] << "lower " << bake_flag[BAKED_LOWER] << "upper " << bake_flag[BAKED_UPPER] << "skirt " << bake_flag[BAKED_SKIRT] << LL_ENDL;
+
+ for (S32 i = 0; i < mMeshLOD.size(); i++)
+ {
+ LLAvatarJoint* joint = mMeshLOD[i];
+ if (i == MESH_ID_HAIR)
+ {
+ joint->setVisible(!bake_flag[BAKED_HAIR], TRUE);
+ }
+ else if (i == MESH_ID_HEAD)
+ {
+ joint->setVisible(!bake_flag[BAKED_HEAD], TRUE);
+ }
+ else if (i == MESH_ID_SKIRT)
+ {
+ joint->setVisible(!bake_flag[BAKED_SKIRT], TRUE);
+ }
+ else if (i == MESH_ID_UPPER_BODY)
+ {
+ joint->setVisible(!bake_flag[BAKED_UPPER], TRUE);
+ }
+ else if (i == MESH_ID_LOWER_BODY)
+ {
+ joint->setVisible(!bake_flag[BAKED_LOWER], TRUE);
+ }
+ else if (i == MESH_ID_EYEBALL_LEFT)
+ {
+ joint->setVisible(!bake_flag[BAKED_EYES], TRUE);
+ }
+ else if (i == MESH_ID_EYEBALL_RIGHT)
+ {
+ joint->setVisible(!bake_flag[BAKED_EYES], TRUE);
+ }
+ else if (i == MESH_ID_EYELASH)
+ {
+ joint->setVisible(!bake_flag[BAKED_HEAD], TRUE);
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -8611,256 +8611,256 @@ void LLVOAvatar::updateMeshVisibility()
// virtual
void LLVOAvatar::updateMeshTextures()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
- static S32 update_counter = 0;
- mBakedTextureDebugText.clear();
-
- // if user has never specified a texture, assign the default
- for (U32 i=0; i < getNumTEs(); i++)
- {
- const LLViewerTexture* te_image = getImage(i, 0);
- if(!te_image || te_image->getID().isNull() || (te_image->getID() == IMG_DEFAULT))
- {
- // IMG_DEFAULT_AVATAR = a special texture that's never rendered.
- const LLUUID& image_id = (i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR);
- setImage(i, LLViewerTextureManager::getFetchedTexture(image_id), 0);
- }
- }
-
- const BOOL other_culled = !isSelf() && mCulled;
- LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ;
- BOOL paused = FALSE;
- if(!isSelf())
- {
- src_callback_list = &mCallbackTextureList ;
- paused = !isVisible();
- }
-
- std::vector<BOOL> is_layer_baked;
- is_layer_baked.resize(mBakedTextureDatas.size(), false);
-
- std::vector<BOOL> use_lkg_baked_layer; // lkg = "last known good"
- use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false);
-
- mBakedTextureDebugText += llformat("%06d\n",update_counter++);
- mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n";
- for (U32 i=0; i < mBakedTextureDatas.size(); i++)
- {
- is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex);
- LLViewerTexLayerSet* layerset = NULL;
- bool layerset_invalid = false;
- if (!other_culled)
- {
- // When an avatar is changing clothes and not in Appearance mode,
- // use the last-known good baked texture until it finishes the first
- // render of the new layerset.
- layerset = getTexLayerSet(i);
- layerset_invalid = layerset && ( !layerset->getViewerComposite()->isInitialized()
- || !layerset->isLocalTextureDataAvailable() );
- use_lkg_baked_layer[i] = (!is_layer_baked[i]
- && (mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR)
- && layerset_invalid);
- if (use_lkg_baked_layer[i])
- {
- layerset->setUpdatesEnabled(TRUE);
- }
- }
- else
- {
- use_lkg_baked_layer[i] = (!is_layer_baked[i]
- && mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR);
- }
-
- std::string last_id_string;
- if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT_AVATAR)
- last_id_string = "A";
- else if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT)
- last_id_string = "D";
- else if (mBakedTextureDatas[i].mLastTextureID == IMG_INVISIBLE)
- last_id_string = "I";
- else
- last_id_string = "*";
- bool is_ltda = layerset
- && layerset->getViewerComposite()->isInitialized()
- && layerset->isLocalTextureDataAvailable();
- mBakedTextureDebugText += llformat("%4d %4s %4d %4d %4d %4d %4s\n",
- i,
- (layerset?"*":"0"),
- layerset_invalid,
- is_ltda,
- is_layer_baked[i],
- use_lkg_baked_layer[i],
- last_id_string.c_str());
- }
-
- for (U32 i=0; i < mBakedTextureDatas.size(); i++)
- {
- debugColorizeSubMeshes(i, LLColor4::white);
-
- LLViewerTexLayerSet* layerset = getTexLayerSet(i);
- if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() )
- {
- // use last known good layer (no new one)
- LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID);
- mBakedTextureDatas[i].mIsUsed = TRUE;
-
- debugColorizeSubMeshes(i,LLColor4::red);
-
- avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
- avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
- for (; iter != end; ++iter)
- {
- LLAvatarJointMesh* mesh = (*iter);
- if (mesh)
- {
- mesh->setTexture( baked_img );
- }
- }
- }
- else if (!isUsingLocalAppearance() && is_layer_baked[i])
- {
- // use new layer
- LLViewerFetchedTexture* baked_img =
- LLViewerTextureManager::staticCastToFetchedTexture(
- getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ;
- if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureID )
- {
- // Even though the file may not be finished loading,
- // we'll consider it loaded and use it (rather than
- // doing compositing).
- useBakedTexture( baked_img->getID() );
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
+ static S32 update_counter = 0;
+ mBakedTextureDebugText.clear();
+
+ // if user has never specified a texture, assign the default
+ for (U32 i=0; i < getNumTEs(); i++)
+ {
+ const LLViewerTexture* te_image = getImage(i, 0);
+ if(!te_image || te_image->getID().isNull() || (te_image->getID() == IMG_DEFAULT))
+ {
+ // IMG_DEFAULT_AVATAR = a special texture that's never rendered.
+ const LLUUID& image_id = (i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR);
+ setImage(i, LLViewerTextureManager::getFetchedTexture(image_id), 0);
+ }
+ }
+
+ const BOOL other_culled = !isSelf() && mCulled;
+ LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ;
+ BOOL paused = FALSE;
+ if(!isSelf())
+ {
+ src_callback_list = &mCallbackTextureList ;
+ paused = !isVisible();
+ }
+
+ std::vector<BOOL> is_layer_baked;
+ is_layer_baked.resize(mBakedTextureDatas.size(), false);
+
+ std::vector<BOOL> use_lkg_baked_layer; // lkg = "last known good"
+ use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false);
+
+ mBakedTextureDebugText += llformat("%06d\n",update_counter++);
+ mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n";
+ for (U32 i=0; i < mBakedTextureDatas.size(); i++)
+ {
+ is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex);
+ LLViewerTexLayerSet* layerset = NULL;
+ bool layerset_invalid = false;
+ if (!other_culled)
+ {
+ // When an avatar is changing clothes and not in Appearance mode,
+ // use the last-known good baked texture until it finishes the first
+ // render of the new layerset.
+ layerset = getTexLayerSet(i);
+ layerset_invalid = layerset && ( !layerset->getViewerComposite()->isInitialized()
+ || !layerset->isLocalTextureDataAvailable() );
+ use_lkg_baked_layer[i] = (!is_layer_baked[i]
+ && (mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR)
+ && layerset_invalid);
+ if (use_lkg_baked_layer[i])
+ {
+ layerset->setUpdatesEnabled(TRUE);
+ }
+ }
+ else
+ {
+ use_lkg_baked_layer[i] = (!is_layer_baked[i]
+ && mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR);
+ }
+
+ std::string last_id_string;
+ if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT_AVATAR)
+ last_id_string = "A";
+ else if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT)
+ last_id_string = "D";
+ else if (mBakedTextureDatas[i].mLastTextureID == IMG_INVISIBLE)
+ last_id_string = "I";
+ else
+ last_id_string = "*";
+ bool is_ltda = layerset
+ && layerset->getViewerComposite()->isInitialized()
+ && layerset->isLocalTextureDataAvailable();
+ mBakedTextureDebugText += llformat("%4d %4s %4d %4d %4d %4d %4s\n",
+ i,
+ (layerset?"*":"0"),
+ layerset_invalid,
+ is_ltda,
+ is_layer_baked[i],
+ use_lkg_baked_layer[i],
+ last_id_string.c_str());
+ }
+
+ for (U32 i=0; i < mBakedTextureDatas.size(); i++)
+ {
+ debugColorizeSubMeshes(i, LLColor4::white);
+
+ LLViewerTexLayerSet* layerset = getTexLayerSet(i);
+ if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() )
+ {
+ // use last known good layer (no new one)
+ LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID);
+ mBakedTextureDatas[i].mIsUsed = TRUE;
+
+ debugColorizeSubMeshes(i,LLColor4::red);
+
+ avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
+ avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
+ for (; iter != end; ++iter)
+ {
+ LLAvatarJointMesh* mesh = (*iter);
+ if (mesh)
+ {
+ mesh->setTexture( baked_img );
+ }
+ }
+ }
+ else if (!isUsingLocalAppearance() && is_layer_baked[i])
+ {
+ // use new layer
+ LLViewerFetchedTexture* baked_img =
+ LLViewerTextureManager::staticCastToFetchedTexture(
+ getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ;
+ if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureID )
+ {
+ // Even though the file may not be finished loading,
+ // we'll consider it loaded and use it (rather than
+ // doing compositing).
+ useBakedTexture( baked_img->getID() );
mLoadedCallbacksPaused |= !isVisible();
checkTextureLoading();
- }
- else
- {
- mBakedTextureDatas[i].mIsLoaded = FALSE;
- if ( (baked_img->getID() != IMG_INVISIBLE) &&
- ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) )
- {
- baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ),
- src_callback_list, paused);
- }
- baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ),
- src_callback_list, paused );
- if (baked_img->getDiscardLevel() < 0 && !paused)
- {
- // mLoadedCallbackTextures will be updated by checkTextureLoading() below
- mLastTexCallbackAddedTime.reset();
- }
-
- // this could add paused texture callbacks
- mLoadedCallbacksPaused |= paused;
- checkTextureLoading();
- }
- }
- else if (layerset && isUsingLocalAppearance())
- {
- debugColorizeSubMeshes(i,LLColor4::yellow );
-
- layerset->createComposite();
- layerset->setUpdatesEnabled( TRUE );
- mBakedTextureDatas[i].mIsUsed = FALSE;
-
- avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
- avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
- for (; iter != end; ++iter)
- {
- LLAvatarJointMesh* mesh = (*iter);
- if (mesh)
- {
- mesh->setLayerSet( layerset );
- }
- }
- }
- else
- {
- debugColorizeSubMeshes(i,LLColor4::blue);
- }
- }
-
- // set texture and color of hair manually if we are not using a baked image.
- // This can happen while loading hair for yourself, or for clients that did not
- // bake a hair texture. Still needed for yourself after 1.22 is depricated.
- if (!is_layer_baked[BAKED_HAIR])
- {
- const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1);
- LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 );
- avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin();
- avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end();
- for (; iter != end; ++iter)
- {
- LLAvatarJointMesh* mesh = (*iter);
- if (mesh)
- {
- mesh->setColor( color );
- mesh->setTexture( hair_img );
- }
- }
- }
-
-
- for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter =
- LLAvatarAppearance::getDictionary()->getBakedTextures().begin();
- baked_iter != LLAvatarAppearance::getDictionary()->getBakedTextures().end();
- ++baked_iter)
- {
- const EBakedTextureIndex baked_index = baked_iter->first;
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
-
- for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
- local_tex_iter != baked_dict->mLocalTextures.end();
- ++local_tex_iter)
- {
- const ETextureIndex texture_index = *local_tex_iter;
- const BOOL is_baked_ready = (is_layer_baked[baked_index] && mBakedTextureDatas[baked_index].mIsLoaded) || other_culled;
- if (isSelf())
- {
- setBakedReady(texture_index, is_baked_ready);
- }
- }
- }
-
- // removeMissingBakedTextures() will call back into this rountine if something is removed, and can blow up the stack
- static bool call_remove_missing = true;
- if (call_remove_missing)
- {
- call_remove_missing = false;
- removeMissingBakedTextures(); // May call back into this function if anything is removed
- call_remove_missing = true;
- }
-
- //refresh bakes on any attached objects
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
-
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- LLViewerObject* attached_object = attachment_iter->get();
- if (attached_object && !attached_object->isDead())
- {
- attached_object->refreshBakeTexture();
-
- LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); ++iter)
- {
- LLViewerObject* objectp = *iter;
- if (objectp && !objectp->isDead())
- {
- objectp->refreshBakeTexture();
- }
- }
- }
- }
- }
-
-
+ }
+ else
+ {
+ mBakedTextureDatas[i].mIsLoaded = FALSE;
+ if ( (baked_img->getID() != IMG_INVISIBLE) &&
+ ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) )
+ {
+ baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ),
+ src_callback_list, paused);
+ }
+ baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ),
+ src_callback_list, paused );
+ if (baked_img->getDiscardLevel() < 0 && !paused)
+ {
+ // mLoadedCallbackTextures will be updated by checkTextureLoading() below
+ mLastTexCallbackAddedTime.reset();
+ }
+
+ // this could add paused texture callbacks
+ mLoadedCallbacksPaused |= paused;
+ checkTextureLoading();
+ }
+ }
+ else if (layerset && isUsingLocalAppearance())
+ {
+ debugColorizeSubMeshes(i,LLColor4::yellow );
+
+ layerset->createComposite();
+ layerset->setUpdatesEnabled( TRUE );
+ mBakedTextureDatas[i].mIsUsed = FALSE;
+
+ avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
+ avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
+ for (; iter != end; ++iter)
+ {
+ LLAvatarJointMesh* mesh = (*iter);
+ if (mesh)
+ {
+ mesh->setLayerSet( layerset );
+ }
+ }
+ }
+ else
+ {
+ debugColorizeSubMeshes(i,LLColor4::blue);
+ }
+ }
+
+ // set texture and color of hair manually if we are not using a baked image.
+ // This can happen while loading hair for yourself, or for clients that did not
+ // bake a hair texture. Still needed for yourself after 1.22 is depricated.
+ if (!is_layer_baked[BAKED_HAIR])
+ {
+ const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1);
+ LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 );
+ avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin();
+ avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end();
+ for (; iter != end; ++iter)
+ {
+ LLAvatarJointMesh* mesh = (*iter);
+ if (mesh)
+ {
+ mesh->setColor( color );
+ mesh->setTexture( hair_img );
+ }
+ }
+ }
+
+
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter =
+ LLAvatarAppearance::getDictionary()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearance::getDictionary()->getBakedTextures().end();
+ ++baked_iter)
+ {
+ const EBakedTextureIndex baked_index = baked_iter->first;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
+
+ for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
+ local_tex_iter != baked_dict->mLocalTextures.end();
+ ++local_tex_iter)
+ {
+ const ETextureIndex texture_index = *local_tex_iter;
+ const BOOL is_baked_ready = (is_layer_baked[baked_index] && mBakedTextureDatas[baked_index].mIsLoaded) || other_culled;
+ if (isSelf())
+ {
+ setBakedReady(texture_index, is_baked_ready);
+ }
+ }
+ }
+
+ // removeMissingBakedTextures() will call back into this rountine if something is removed, and can blow up the stack
+ static bool call_remove_missing = true;
+ if (call_remove_missing)
+ {
+ call_remove_missing = false;
+ removeMissingBakedTextures(); // May call back into this function if anything is removed
+ call_remove_missing = true;
+ }
+
+ //refresh bakes on any attached objects
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject* attached_object = attachment_iter->get();
+ if (attached_object && !attached_object->isDead())
+ {
+ attached_object->refreshBakeTexture();
+
+ LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* objectp = *iter;
+ if (objectp && !objectp->isDead())
+ {
+ objectp->refreshBakeTexture();
+ }
+ }
+ }
+ }
+ }
+
+
}
@@ -8870,92 +8870,92 @@ void LLVOAvatar::updateMeshTextures()
//-----------------------------------------------------------------------------
void LLVOAvatar::setLocalTexture( ETextureIndex type, LLViewerTexture* in_tex, BOOL baked_version_ready, U32 index )
{
- // invalid for anyone but self
- llassert(0);
+ // invalid for anyone but self
+ llassert(0);
}
-//virtual
+//virtual
void LLVOAvatar::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index)
{
- // invalid for anyone but self
- llassert(0);
+ // invalid for anyone but self
+ llassert(0);
}
void LLVOAvatar::addChat(const LLChat& chat)
{
- std::deque<LLChat>::iterator chat_iter;
+ std::deque<LLChat>::iterator chat_iter;
- mChats.push_back(chat);
+ mChats.push_back(chat);
- S32 chat_length = 0;
- for( chat_iter = mChats.begin(); chat_iter != mChats.end(); ++chat_iter)
- {
- chat_length += chat_iter->mText.size();
- }
+ S32 chat_length = 0;
+ for( chat_iter = mChats.begin(); chat_iter != mChats.end(); ++chat_iter)
+ {
+ chat_length += chat_iter->mText.size();
+ }
- // remove any excess chat
- chat_iter = mChats.begin();
- while ((chat_length > MAX_BUBBLE_CHAT_LENGTH || mChats.size() > MAX_BUBBLE_CHAT_UTTERANCES) && chat_iter != mChats.end())
- {
- chat_length -= chat_iter->mText.size();
- mChats.pop_front();
- chat_iter = mChats.begin();
- }
+ // remove any excess chat
+ chat_iter = mChats.begin();
+ while ((chat_length > MAX_BUBBLE_CHAT_LENGTH || mChats.size() > MAX_BUBBLE_CHAT_UTTERANCES) && chat_iter != mChats.end())
+ {
+ chat_length -= chat_iter->mText.size();
+ mChats.pop_front();
+ chat_iter = mChats.begin();
+ }
- mChatTimer.reset();
+ mChatTimer.reset();
}
void LLVOAvatar::clearChat()
{
- mChats.clear();
+ mChats.clear();
}
void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index)
{
- if (index >= BAKED_NUM_INDICES)
- {
- LL_WARNS() << "invalid baked texture index passed to applyMorphMask" << LL_ENDL;
- return;
- }
+ if (index >= BAKED_NUM_INDICES)
+ {
+ LL_WARNS() << "invalid baked texture index passed to applyMorphMask" << LL_ENDL;
+ return;
+ }
- for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin();
- iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter)
- {
- const LLMaskedMorph* maskedMorph = (*iter);
- LLPolyMorphTarget* morph_target = dynamic_cast<LLPolyMorphTarget*>(maskedMorph->mMorphTarget);
- if (morph_target)
- {
- morph_target->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert);
- }
- }
+ for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin();
+ iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter)
+ {
+ const LLMaskedMorph* maskedMorph = (*iter);
+ LLPolyMorphTarget* morph_target = dynamic_cast<LLPolyMorphTarget*>(maskedMorph->mMorphTarget);
+ if (morph_target)
+ {
+ morph_target->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert);
+ }
+ }
}
// returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise
BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index)
{
- if (index >= BAKED_NUM_INDICES)
- {
- return FALSE;
- }
+ if (index >= BAKED_NUM_INDICES)
+ {
+ return FALSE;
+ }
- if (!mBakedTextureDatas[index].mMaskedMorphs.empty())
- {
- if (isSelf())
- {
- LLViewerTexLayerSet *layer_set = getTexLayerSet(index);
- if (layer_set)
- {
- return !layer_set->isMorphValid();
- }
- }
- else
- {
- return FALSE;
- }
- }
+ if (!mBakedTextureDatas[index].mMaskedMorphs.empty())
+ {
+ if (isSelf())
+ {
+ LLViewerTexLayerSet *layer_set = getTexLayerSet(index);
+ if (layer_set)
+ {
+ return !layer_set->isMorphValid();
+ }
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
- return FALSE;
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -8967,66 +8967,66 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIn
//-----------------------------------------------------------------------------
void LLVOAvatar::releaseComponentTextures()
{
- // ! BACKWARDS COMPATIBILITY !
- // Detect if the baked hair texture actually wasn't sent, and if so set to default
- if (isTextureDefined(TEX_HAIR_BAKED) && getImage(TEX_HAIR_BAKED,0)->getID() == getImage(TEX_SKIRT_BAKED,0)->getID())
- {
- if (getImage(TEX_HAIR_BAKED,0)->getID() != IMG_INVISIBLE)
- {
- // Regression case of messaging system. Expected 21 textures, received 20. last texture is not valid so set to default
- setTETexture(TEX_HAIR_BAKED, IMG_DEFAULT_AVATAR);
- }
- }
-
- for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
- {
- const LLAvatarAppearanceDictionary::BakedEntry * bakedDicEntry = LLAvatarAppearance::getDictionary()->getBakedTexture((EBakedTextureIndex)baked_index);
- // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID
- if (!isTextureDefined(bakedDicEntry->mTextureIndex)
- && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ))
- {
- continue;
- }
-
- for (U8 texture = 0; texture < bakedDicEntry->mLocalTextures.size(); texture++)
- {
- const U8 te = (ETextureIndex)bakedDicEntry->mLocalTextures[texture];
- setTETexture(te, IMG_DEFAULT_AVATAR);
- }
- }
+ // ! BACKWARDS COMPATIBILITY !
+ // Detect if the baked hair texture actually wasn't sent, and if so set to default
+ if (isTextureDefined(TEX_HAIR_BAKED) && getImage(TEX_HAIR_BAKED,0)->getID() == getImage(TEX_SKIRT_BAKED,0)->getID())
+ {
+ if (getImage(TEX_HAIR_BAKED,0)->getID() != IMG_INVISIBLE)
+ {
+ // Regression case of messaging system. Expected 21 textures, received 20. last texture is not valid so set to default
+ setTETexture(TEX_HAIR_BAKED, IMG_DEFAULT_AVATAR);
+ }
+ }
+
+ for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
+ {
+ const LLAvatarAppearanceDictionary::BakedEntry * bakedDicEntry = LLAvatarAppearance::getDictionary()->getBakedTexture((EBakedTextureIndex)baked_index);
+ // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID
+ if (!isTextureDefined(bakedDicEntry->mTextureIndex)
+ && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ))
+ {
+ continue;
+ }
+
+ for (U8 texture = 0; texture < bakedDicEntry->mLocalTextures.size(); texture++)
+ {
+ const U8 te = (ETextureIndex)bakedDicEntry->mLocalTextures[texture];
+ setTETexture(te, IMG_DEFAULT_AVATAR);
+ }
+ }
}
void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const
-{
- LL_DEBUGS("Avatar") << avString() << (isSelf() ? "Self: " : "Other: ") << context << LL_ENDL;
- for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
- iter != LLAvatarAppearance::getDictionary()->getTextures().end();
- ++iter)
- {
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
- // TODO: MULTI-WEARABLE: handle multiple textures for self
- const LLViewerTexture* te_image = getImage(iter->first,0);
- if( !te_image )
- {
- LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": null ptr" << LL_ENDL;
- }
- else if( te_image->getID().isNull() )
- {
- LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": null UUID" << LL_ENDL;
- }
- else if( te_image->getID() == IMG_DEFAULT )
- {
- LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": IMG_DEFAULT" << LL_ENDL;
- }
- else if( te_image->getID() == IMG_DEFAULT_AVATAR )
- {
- LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": IMG_DEFAULT_AVATAR" << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": " << te_image->getID() << LL_ENDL;
- }
- }
+{
+ LL_DEBUGS("Avatar") << avString() << (isSelf() ? "Self: " : "Other: ") << context << LL_ENDL;
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
+ iter != LLAvatarAppearance::getDictionary()->getTextures().end();
+ ++iter)
+ {
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
+ // TODO: MULTI-WEARABLE: handle multiple textures for self
+ const LLViewerTexture* te_image = getImage(iter->first,0);
+ if( !te_image )
+ {
+ LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": null ptr" << LL_ENDL;
+ }
+ else if( te_image->getID().isNull() )
+ {
+ LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": null UUID" << LL_ENDL;
+ }
+ else if( te_image->getID() == IMG_DEFAULT )
+ {
+ LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": IMG_DEFAULT" << LL_ENDL;
+ }
+ else if( te_image->getID() == IMG_DEFAULT_AVATAR )
+ {
+ LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": IMG_DEFAULT_AVATAR" << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("Avatar") << avString() << " " << texture_dict->mName << ": " << te_image->getID() << LL_ENDL;
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -9034,74 +9034,74 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const
//-----------------------------------------------------------------------------
void LLVOAvatar::clampAttachmentPositions()
{
- if (isDead())
- {
- return;
- }
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment)
- {
- attachment->clampObjectPosition();
- }
- }
+ if (isDead())
+ {
+ return;
+ }
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment)
+ {
+ attachment->clampObjectPosition();
+ }
+ }
}
BOOL LLVOAvatar::hasHUDAttachment() const
{
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment->getIsHUDAttachment() && attachment->getNumObjects() > 0)
- {
- return TRUE;
- }
- }
- return FALSE;
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment->getIsHUDAttachment() && attachment->getNumObjects() > 0)
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
LLBBox LLVOAvatar::getHUDBBox() const
{
- LLBBox bbox;
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment->getIsHUDAttachment())
- {
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
- const LLViewerObject* attached_object = attachment_iter->get();
- if (attached_object == NULL)
- {
- LL_WARNS() << "HUD attached object is NULL!" << LL_ENDL;
- continue;
- }
- // initialize bounding box to contain identity orientation and center point for attached object
- bbox.addPointLocal(attached_object->getPosition());
- // add rotated bounding box for attached object
- bbox.addBBoxAgent(attached_object->getBoundingBoxAgent());
- LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end();
- ++iter)
- {
- const LLViewerObject* child_objectp = *iter;
- bbox.addBBoxAgent(child_objectp->getBoundingBoxAgent());
- }
- }
- }
- }
-
- return bbox;
+ LLBBox bbox;
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment->getIsHUDAttachment())
+ {
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ const LLViewerObject* attached_object = attachment_iter->get();
+ if (attached_object == NULL)
+ {
+ LL_WARNS() << "HUD attached object is NULL!" << LL_ENDL;
+ continue;
+ }
+ // initialize bounding box to contain identity orientation and center point for attached object
+ bbox.addPointLocal(attached_object->getPosition());
+ // add rotated bounding box for attached object
+ bbox.addBBoxAgent(attached_object->getBoundingBoxAgent());
+ LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end();
+ ++iter)
+ {
+ const LLViewerObject* child_objectp = *iter;
+ bbox.addBBoxAgent(child_objectp->getBoundingBoxAgent());
+ }
+ }
+ }
+ }
+
+ return bbox;
}
//-----------------------------------------------------------------------------
@@ -9109,53 +9109,53 @@ LLBBox LLVOAvatar::getHUDBBox() const
//-----------------------------------------------------------------------------
void LLVOAvatar::onFirstTEMessageReceived()
{
- LL_DEBUGS("Avatar") << avString() << LL_ENDL;
- if( !mFirstTEMessageReceived )
- {
- mFirstTEMessageReceived = TRUE;
-
- LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ;
- BOOL paused = FALSE ;
- if(!isSelf())
- {
- src_callback_list = &mCallbackTextureList ;
- paused = !isVisible();
- }
-
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- const BOOL layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex);
-
- // Use any baked textures that we have even if they haven't downloaded yet.
- // (That is, don't do a transition from unbaked to baked.)
- if (layer_baked)
- {
- LLViewerFetchedTexture* image = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ;
- mBakedTextureDatas[i].mLastTextureID = image->getID();
- // If we have more than one texture for the other baked layers, we'll want to call this for them too.
- if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) )
- {
- image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ),
- src_callback_list, paused);
- }
- LL_DEBUGS("Avatar") << avString() << "layer_baked, setting onInitialBakedTextureLoaded as callback" << LL_ENDL;
- image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ),
- src_callback_list, paused );
- if (image->getDiscardLevel() < 0 && !paused)
- {
- mLastTexCallbackAddedTime.reset();
- }
+ LL_DEBUGS("Avatar") << avString() << LL_ENDL;
+ if( !mFirstTEMessageReceived )
+ {
+ mFirstTEMessageReceived = TRUE;
+
+ LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ;
+ BOOL paused = FALSE ;
+ if(!isSelf())
+ {
+ src_callback_list = &mCallbackTextureList ;
+ paused = !isVisible();
+ }
+
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ const BOOL layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex);
+
+ // Use any baked textures that we have even if they haven't downloaded yet.
+ // (That is, don't do a transition from unbaked to baked.)
+ if (layer_baked)
+ {
+ LLViewerFetchedTexture* image = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ;
+ mBakedTextureDatas[i].mLastTextureID = image->getID();
+ // If we have more than one texture for the other baked layers, we'll want to call this for them too.
+ if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) )
+ {
+ image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ),
+ src_callback_list, paused);
+ }
+ LL_DEBUGS("Avatar") << avString() << "layer_baked, setting onInitialBakedTextureLoaded as callback" << LL_ENDL;
+ image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ),
+ src_callback_list, paused );
+ if (image->getDiscardLevel() < 0 && !paused)
+ {
+ mLastTexCallbackAddedTime.reset();
+ }
// this could add paused texture callbacks
- mLoadedCallbacksPaused |= paused;
- }
- }
+ mLoadedCallbacksPaused |= paused;
+ }
+ }
mMeshTexturesDirty = TRUE;
- gPipeline.markGLRebuild(this);
+ gPipeline.markGLRebuild(this);
mFirstAppearanceMessageTimer.reset();
mFullyLoadedTimer.reset();
- }
+ }
}
//-----------------------------------------------------------------------------
@@ -9163,240 +9163,240 @@ void LLVOAvatar::onFirstTEMessageReceived()
//-----------------------------------------------------------------------------
bool LLVOAvatar::visualParamWeightsAreDefault()
{
- bool rtn = true;
-
- bool is_wearing_skirt = isWearingWearableType(LLWearableType::WT_SKIRT);
- for (LLVisualParam *param = getFirstVisualParam();
- param;
- param = getNextVisualParam())
- {
- if (param->isTweakable())
- {
- LLViewerVisualParam* vparam = dynamic_cast<LLViewerVisualParam*>(param);
- llassert(vparam);
- bool is_skirt_param = vparam &&
- LLWearableType::WT_SKIRT == vparam->getWearableType();
- if (param->getWeight() != param->getDefaultWeight() &&
- // we have to not care whether skirt weights are default, if we're not actually wearing a skirt
- (is_wearing_skirt || !is_skirt_param))
- {
- //LL_INFOS() << "param '" << param->getName() << "'=" << param->getWeight() << " which differs from default=" << param->getDefaultWeight() << LL_ENDL;
- rtn = false;
- break;
- }
- }
- }
-
- //LL_INFOS() << "params are default ? " << int(rtn) << LL_ENDL;
-
- return rtn;
+ bool rtn = true;
+
+ bool is_wearing_skirt = isWearingWearableType(LLWearableType::WT_SKIRT);
+ for (LLVisualParam *param = getFirstVisualParam();
+ param;
+ param = getNextVisualParam())
+ {
+ if (param->isTweakable())
+ {
+ LLViewerVisualParam* vparam = dynamic_cast<LLViewerVisualParam*>(param);
+ llassert(vparam);
+ bool is_skirt_param = vparam &&
+ LLWearableType::WT_SKIRT == vparam->getWearableType();
+ if (param->getWeight() != param->getDefaultWeight() &&
+ // we have to not care whether skirt weights are default, if we're not actually wearing a skirt
+ (is_wearing_skirt || !is_skirt_param))
+ {
+ //LL_INFOS() << "param '" << param->getName() << "'=" << param->getWeight() << " which differs from default=" << param->getDefaultWeight() << LL_ENDL;
+ rtn = false;
+ break;
+ }
+ }
+ }
+
+ //LL_INFOS() << "params are default ? " << int(rtn) << LL_ENDL;
+
+ return rtn;
}
void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value)
{
- std::string type_string = "unknown";
- if (dynamic_cast<LLTexLayerParamAlpha*>(viewer_param))
- type_string = "param_alpha";
- if (dynamic_cast<LLTexLayerParamColor*>(viewer_param))
- type_string = "param_color";
- if (dynamic_cast<LLDriverParam*>(viewer_param))
- type_string = "param_driver";
- if (dynamic_cast<LLPolyMorphTarget*>(viewer_param))
- type_string = "param_morph";
- if (dynamic_cast<LLPolySkeletalDistortion*>(viewer_param))
- type_string = "param_skeleton";
- S32 wtype = -1;
- LLViewerVisualParam *vparam = dynamic_cast<LLViewerVisualParam*>(viewer_param);
- if (vparam)
- {
- wtype = vparam->getWearableType();
- }
- S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight());
- apr_file_printf(file, "\t\t<param id=\"%d\" name=\"%s\" display=\"%s\" value=\"%.3f\" u8=\"%d\" type=\"%s\" wearable=\"%s\" group=\"%d\"/>\n",
- viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getDisplayName().c_str(), value, u8_value, type_string.c_str(),
- LLWearableType::getInstance()->getTypeName(LLWearableType::EType(wtype)).c_str(),
- viewer_param->getGroup());
- }
-
+ std::string type_string = "unknown";
+ if (dynamic_cast<LLTexLayerParamAlpha*>(viewer_param))
+ type_string = "param_alpha";
+ if (dynamic_cast<LLTexLayerParamColor*>(viewer_param))
+ type_string = "param_color";
+ if (dynamic_cast<LLDriverParam*>(viewer_param))
+ type_string = "param_driver";
+ if (dynamic_cast<LLPolyMorphTarget*>(viewer_param))
+ type_string = "param_morph";
+ if (dynamic_cast<LLPolySkeletalDistortion*>(viewer_param))
+ type_string = "param_skeleton";
+ S32 wtype = -1;
+ LLViewerVisualParam *vparam = dynamic_cast<LLViewerVisualParam*>(viewer_param);
+ if (vparam)
+ {
+ wtype = vparam->getWearableType();
+ }
+ S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight());
+ apr_file_printf(file, "\t\t<param id=\"%d\" name=\"%s\" display=\"%s\" value=\"%.3f\" u8=\"%d\" type=\"%s\" wearable=\"%s\" group=\"%d\"/>\n",
+ viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getDisplayName().c_str(), value, u8_value, type_string.c_str(),
+ LLWearableType::getInstance()->getTypeName(LLWearableType::EType(wtype)).c_str(),
+ viewer_param->getGroup());
+ }
+
void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix,
- const LLAppearanceMessageContents& contents)
-{
- std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml");
- const std::vector<F32>& params_for_dump = contents.mParamWeights;
- const LLTEContents& tec = contents.mTEContents;
-
- LLAPRFile outfile;
- std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
- outfile.open(fullpath, LL_APR_WB );
- apr_file_t* file = outfile.getFileHandle();
- if (!file)
- {
- return;
- }
- else
- {
- LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << LL_ENDL;
- }
-
- apr_file_printf(file, "<header>\n");
- apr_file_printf(file, "\t\t<cof_version %i />\n", contents.mCOFVersion);
- apr_file_printf(file, "\t\t<appearance_version %i />\n", contents.mAppearanceVersion);
- apr_file_printf(file, "</header>\n");
-
- apr_file_printf(file, "\n<params>\n");
- LLVisualParam* param = getFirstVisualParam();
- for (S32 i = 0; i < params_for_dump.size(); i++)
- {
- while( param && ((param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) &&
- (param->getGroup() != VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE)) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
- {
- param = getNextVisualParam();
- }
- LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
- F32 value = params_for_dump[i];
- dump_visual_param(file, viewer_param, value);
- param = getNextVisualParam();
- }
- apr_file_printf(file, "</params>\n");
-
- apr_file_printf(file, "\n<textures>\n");
- for (U32 i = 0; i < tec.face_count; i++)
- {
- std::string uuid_str;
- ((LLUUID*)tec.image_data)[i].toString(uuid_str);
- apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", i, uuid_str.c_str());
- }
- apr_file_printf(file, "</textures>\n");
+ const LLAppearanceMessageContents& contents)
+{
+ std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml");
+ const std::vector<F32>& params_for_dump = contents.mParamWeights;
+ const LLTEContents& tec = contents.mTEContents;
+
+ LLAPRFile outfile;
+ std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
+ outfile.open(fullpath, LL_APR_WB );
+ apr_file_t* file = outfile.getFileHandle();
+ if (!file)
+ {
+ return;
+ }
+ else
+ {
+ LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << LL_ENDL;
+ }
+
+ apr_file_printf(file, "<header>\n");
+ apr_file_printf(file, "\t\t<cof_version %i />\n", contents.mCOFVersion);
+ apr_file_printf(file, "\t\t<appearance_version %i />\n", contents.mAppearanceVersion);
+ apr_file_printf(file, "</header>\n");
+
+ apr_file_printf(file, "\n<params>\n");
+ LLVisualParam* param = getFirstVisualParam();
+ for (S32 i = 0; i < params_for_dump.size(); i++)
+ {
+ while( param && ((param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) &&
+ (param->getGroup() != VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE)) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
+ {
+ param = getNextVisualParam();
+ }
+ LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
+ F32 value = params_for_dump[i];
+ dump_visual_param(file, viewer_param, value);
+ param = getNextVisualParam();
+ }
+ apr_file_printf(file, "</params>\n");
+
+ apr_file_printf(file, "\n<textures>\n");
+ for (U32 i = 0; i < tec.face_count; i++)
+ {
+ std::string uuid_str;
+ ((LLUUID*)tec.image_data)[i].toString(uuid_str);
+ apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", i, uuid_str.c_str());
+ }
+ apr_file_printf(file, "</textures>\n");
}
void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents)
{
- parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, contents.mTEContents);
-
- // Parse the AppearanceData field, if any.
- if (mesgsys->has(_PREHASH_AppearanceData))
- {
- U8 av_u8;
- mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, av_u8, 0);
- contents.mAppearanceVersion = av_u8;
- //LL_DEBUGS("Avatar") << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << LL_ENDL;
- mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0);
- // For future use:
- //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0);
- }
-
- // Parse the AppearanceData field, if any.
- contents.mHoverOffsetWasSet = false;
- if (mesgsys->has(_PREHASH_AppearanceHover))
- {
- LLVector3 hover;
- mesgsys->getVector3Fast(_PREHASH_AppearanceHover, _PREHASH_HoverHeight, hover);
- //LL_DEBUGS("Avatar") << avString() << " hover received " << hover.mV[ VX ] << "," << hover.mV[ VY ] << "," << hover.mV[ VZ ] << LL_ENDL;
- contents.mHoverOffset = hover;
- contents.mHoverOffsetWasSet = true;
- }
-
- // Parse visual params, if any.
- S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam);
+ parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, contents.mTEContents);
+
+ // Parse the AppearanceData field, if any.
+ if (mesgsys->has(_PREHASH_AppearanceData))
+ {
+ U8 av_u8;
+ mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, av_u8, 0);
+ contents.mAppearanceVersion = av_u8;
+ //LL_DEBUGS("Avatar") << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << LL_ENDL;
+ mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0);
+ // For future use:
+ //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0);
+ }
+
+ // Parse the AppearanceData field, if any.
+ contents.mHoverOffsetWasSet = false;
+ if (mesgsys->has(_PREHASH_AppearanceHover))
+ {
+ LLVector3 hover;
+ mesgsys->getVector3Fast(_PREHASH_AppearanceHover, _PREHASH_HoverHeight, hover);
+ //LL_DEBUGS("Avatar") << avString() << " hover received " << hover.mV[ VX ] << "," << hover.mV[ VY ] << "," << hover.mV[ VZ ] << LL_ENDL;
+ contents.mHoverOffset = hover;
+ contents.mHoverOffsetWasSet = true;
+ }
+
+ // Parse visual params, if any.
+ S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam);
static LLCachedControl<bool> block_some_avatars(gSavedSettings, "BlockSomeAvatarAppearanceVisualParams");
- bool drop_visual_params_debug = block_some_avatars && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing
- if( num_blocks > 1 && !drop_visual_params_debug)
- {
- //LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL;
-
- LLVisualParam* param = getFirstVisualParam();
- llassert(param); // if this ever fires, we should do the same as when num_blocks<=1
- if (!param)
- {
- LL_WARNS() << "No visual params!" << LL_ENDL;
- }
- else
- {
- for( S32 i = 0; i < num_blocks; i++ )
- {
- while( param && ((param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) &&
- (param->getGroup() != VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE)) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
- {
- param = getNextVisualParam();
- }
-
- if( !param )
- {
- // more visual params supplied than expected - just process what we know about
- break;
- }
-
- U8 value;
- mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i);
- F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight());
- contents.mParamWeights.push_back(newWeight);
- contents.mParams.push_back(param);
-
- param = getNextVisualParam();
- }
- }
-
- const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE) +
- getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
- if (num_blocks != expected_tweakable_count)
- {
- LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << LL_ENDL;
- }
- }
- else
- {
- if (drop_visual_params_debug)
- {
- LL_INFOS() << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("Avatar") << "AvatarAppearance msg received without any parameters, object: " << getID() << LL_ENDL;
- }
- }
-
- LLVisualParam* appearance_version_param = getVisualParam(11000);
- if (appearance_version_param)
- {
- std::vector<LLVisualParam*>::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param);
- if (it != contents.mParams.end())
- {
- S32 index = it - contents.mParams.begin();
- contents.mParamAppearanceVersion = ll_round(contents.mParamWeights[index]);
- //LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << LL_ENDL;
- }
- }
+ bool drop_visual_params_debug = block_some_avatars && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing
+ if( num_blocks > 1 && !drop_visual_params_debug)
+ {
+ //LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL;
+
+ LLVisualParam* param = getFirstVisualParam();
+ llassert(param); // if this ever fires, we should do the same as when num_blocks<=1
+ if (!param)
+ {
+ LL_WARNS() << "No visual params!" << LL_ENDL;
+ }
+ else
+ {
+ for( S32 i = 0; i < num_blocks; i++ )
+ {
+ while( param && ((param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) &&
+ (param->getGroup() != VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE)) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
+ {
+ param = getNextVisualParam();
+ }
+
+ if( !param )
+ {
+ // more visual params supplied than expected - just process what we know about
+ break;
+ }
+
+ U8 value;
+ mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i);
+ F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight());
+ contents.mParamWeights.push_back(newWeight);
+ contents.mParams.push_back(param);
+
+ param = getNextVisualParam();
+ }
+ }
+
+ const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE) +
+ getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
+ if (num_blocks != expected_tweakable_count)
+ {
+ LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << LL_ENDL;
+ }
+ }
+ else
+ {
+ if (drop_visual_params_debug)
+ {
+ LL_INFOS() << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("Avatar") << "AvatarAppearance msg received without any parameters, object: " << getID() << LL_ENDL;
+ }
+ }
+
+ LLVisualParam* appearance_version_param = getVisualParam(11000);
+ if (appearance_version_param)
+ {
+ std::vector<LLVisualParam*>::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param);
+ if (it != contents.mParams.end())
+ {
+ S32 index = it - contents.mParams.begin();
+ contents.mParamAppearanceVersion = ll_round(contents.mParamWeights[index]);
+ //LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << LL_ENDL;
+ }
+ }
}
bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32& appearance_version)
{
- appearance_version = -1;
-
- if ((contents.mAppearanceVersion) >= 0 &&
- (contents.mParamAppearanceVersion >= 0) &&
- (contents.mAppearanceVersion != contents.mParamAppearanceVersion))
- {
- LL_WARNS() << "inconsistent appearance_version settings - field: " <<
- contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << LL_ENDL;
- return false;
- }
- if (contents.mParamAppearanceVersion >= 0) // use visual param if available.
- {
- appearance_version = contents.mParamAppearanceVersion;
- }
- else if (contents.mAppearanceVersion > 0)
- {
- appearance_version = contents.mAppearanceVersion;
- }
- else // still not set, go with 1.
- {
- appearance_version = 1;
- }
- //LL_DEBUGS("Avatar") << "appearance version info - field " << contents.mAppearanceVersion
- // << " param: " << contents.mParamAppearanceVersion
- // << " final: " << appearance_version << LL_ENDL;
- return true;
+ appearance_version = -1;
+
+ if ((contents.mAppearanceVersion) >= 0 &&
+ (contents.mParamAppearanceVersion >= 0) &&
+ (contents.mAppearanceVersion != contents.mParamAppearanceVersion))
+ {
+ LL_WARNS() << "inconsistent appearance_version settings - field: " <<
+ contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << LL_ENDL;
+ return false;
+ }
+ if (contents.mParamAppearanceVersion >= 0) // use visual param if available.
+ {
+ appearance_version = contents.mParamAppearanceVersion;
+ }
+ else if (contents.mAppearanceVersion > 0)
+ {
+ appearance_version = contents.mAppearanceVersion;
+ }
+ else // still not set, go with 1.
+ {
+ appearance_version = 1;
+ }
+ //LL_DEBUGS("Avatar") << "appearance version info - field " << contents.mAppearanceVersion
+ // << " param: " << contents.mParamAppearanceVersion
+ // << " final: " << appearance_version << LL_ENDL;
+ return true;
}
//-----------------------------------------------------------------------------
@@ -9404,46 +9404,46 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32
//-----------------------------------------------------------------------------
void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
{
- LL_DEBUGS("Avatar") << "starts" << LL_ENDL;
+ LL_DEBUGS("Avatar") << "starts" << LL_ENDL;
static LLCachedControl<bool> enable_verbose_dumps(gSavedSettings, "DebugAvatarAppearanceMessage");
static LLCachedControl<bool> block_avatar_appearance_messages(gSavedSettings, "BlockAvatarAppearanceMessages");
- std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_";
- if (block_avatar_appearance_messages)
- {
- LL_WARNS() << "Blocking AvatarAppearance message" << LL_ENDL;
- return;
- }
-
- mLastAppearanceMessageTimer.reset();
-
- LLPointer<LLAppearanceMessageContents> contents(new LLAppearanceMessageContents);
- parseAppearanceMessage(mesgsys, *contents);
- if (enable_verbose_dumps)
- {
- dumpAppearanceMsgParams(dump_prefix + "appearance_msg", *contents);
- }
-
- S32 appearance_version;
- if (!resolve_appearance_version(*contents, appearance_version))
- {
- LL_WARNS() << "bad appearance version info, discarding" << LL_ENDL;
- return;
- }
- llassert(appearance_version > 0);
- if (appearance_version > 1)
- {
- LL_WARNS() << "unsupported appearance version " << appearance_version << ", discarding appearance message" << LL_ENDL;
- return;
- }
+ std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_";
+ if (block_avatar_appearance_messages)
+ {
+ LL_WARNS() << "Blocking AvatarAppearance message" << LL_ENDL;
+ return;
+ }
+
+ mLastAppearanceMessageTimer.reset();
+
+ LLPointer<LLAppearanceMessageContents> contents(new LLAppearanceMessageContents);
+ parseAppearanceMessage(mesgsys, *contents);
+ if (enable_verbose_dumps)
+ {
+ dumpAppearanceMsgParams(dump_prefix + "appearance_msg", *contents);
+ }
+
+ S32 appearance_version;
+ if (!resolve_appearance_version(*contents, appearance_version))
+ {
+ LL_WARNS() << "bad appearance version info, discarding" << LL_ENDL;
+ return;
+ }
+ llassert(appearance_version > 0);
+ if (appearance_version > 1)
+ {
+ LL_WARNS() << "unsupported appearance version " << appearance_version << ", discarding appearance message" << LL_ENDL;
+ return;
+ }
S32 thisAppearanceVersion(contents->mCOFVersion);
if (isSelf())
- { // In the past this was considered to be the canonical COF version,
- // that is no longer the case. The canonical version is maintained
+ { // In the past this was considered to be the canonical COF version,
+ // that is no longer the case. The canonical version is maintained
// by the AIS code and should match the COF version there. Even so,
- // we must prevent rolling this one backwards backwards or processing
+ // we must prevent rolling this one backwards backwards or processing
// stale versions.
S32 aisCOFVersion(LLAppearanceMgr::instance().getCOFVersion());
@@ -9467,23 +9467,23 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
}
- // SUNSHINE CLEANUP - is this case OK now?
- S32 num_params = contents->mParamWeights.size();
- if (num_params <= 1)
- {
- // In this case, we have no reliable basis for knowing
- // appearance version, which may cause us to look for baked
- // textures in the wrong place and flag them as missing
- // assets.
- LL_DEBUGS("Avatar") << "ignoring appearance message due to lack of params" << LL_ENDL;
- return;
- }
+ // SUNSHINE CLEANUP - is this case OK now?
+ S32 num_params = contents->mParamWeights.size();
+ if (num_params <= 1)
+ {
+ // In this case, we have no reliable basis for knowing
+ // appearance version, which may cause us to look for baked
+ // textures in the wrong place and flag them as missing
+ // assets.
+ LL_DEBUGS("Avatar") << "ignoring appearance message due to lack of params" << LL_ENDL;
+ return;
+ }
- // No backsies zone - if we get here, the message should be valid and usable, will be processed.
- // Note:
- // RequestAgentUpdateAppearanceResponder::onRequestRequested()
- // assumes that cof version is only updated with server-bake
- // appearance messages.
+ // No backsies zone - if we get here, the message should be valid and usable, will be processed.
+ // Note:
+ // RequestAgentUpdateAppearanceResponder::onRequestRequested()
+ // assumes that cof version is only updated with server-bake
+ // appearance messages.
if (isSelf())
{
LL_INFOS("Avatar") << "Processing appearance message version " << thisAppearanceVersion << LL_ENDL;
@@ -9495,202 +9495,202 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
// Note:
// locally the COF is maintained via LLInventoryModel::accountForUpdate
- // which is called from various places. This should match the simhost's
+ // which is called from various places. This should match the simhost's
// idea of what the COF version is. AIS however maintains its own version
- // of the COF that should be considered canonical.
+ // of the COF that should be considered canonical.
mLastUpdateReceivedCOFVersion = thisAppearanceVersion;
mLastProcessedAppearance = contents;
bool slam_params = false;
- applyParsedAppearanceMessage(*contents, slam_params);
- if (getOverallAppearance() != AOA_NORMAL)
- {
- resetSkeleton(false);
- }
+ applyParsedAppearanceMessage(*contents, slam_params);
+ if (getOverallAppearance() != AOA_NORMAL)
+ {
+ resetSkeleton(false);
+ }
}
void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& contents, bool slam_params)
{
- S32 num_params = contents.mParamWeights.size();
- ESex old_sex = getSex();
+ S32 num_params = contents.mParamWeights.size();
+ ESex old_sex = getSex();
if (applyParsedTEMessage(contents.mTEContents) > 0 && isChanged(TEXTURE))
{
updateVisualComplexity();
}
- // prevent the overwriting of valid baked textures with invalid baked textures
- for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++)
- {
- if (!isTextureDefined(mBakedTextureDatas[baked_index].mTextureIndex)
- && mBakedTextureDatas[baked_index].mLastTextureID != IMG_DEFAULT
- && baked_index != BAKED_SKIRT && baked_index != BAKED_LEFT_ARM && baked_index != BAKED_LEFT_LEG && baked_index != BAKED_AUX1 && baked_index != BAKED_AUX2 && baked_index != BAKED_AUX3)
- {
- LL_DEBUGS("Avatar") << avString() << " baked_index " << (S32) baked_index << " using mLastTextureID " << mBakedTextureDatas[baked_index].mLastTextureID << LL_ENDL;
- setTEImage(mBakedTextureDatas[baked_index].mTextureIndex,
- LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
- }
- else
- {
- LL_DEBUGS("Avatar") << avString() << " baked_index " << (S32) baked_index << " using texture id "
- << getTE(mBakedTextureDatas[baked_index].mTextureIndex)->getID() << LL_ENDL;
- }
- }
-
- // runway - was
- // if (!is_first_appearance_message )
- // which means it would be called on second appearance message - probably wrong.
- BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived;
- mFirstAppearanceMessageReceived = TRUE;
-
- //LL_DEBUGS("Avatar") << avString() << "processAvatarAppearance start " << mID
+ // prevent the overwriting of valid baked textures with invalid baked textures
+ for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++)
+ {
+ if (!isTextureDefined(mBakedTextureDatas[baked_index].mTextureIndex)
+ && mBakedTextureDatas[baked_index].mLastTextureID != IMG_DEFAULT
+ && baked_index != BAKED_SKIRT && baked_index != BAKED_LEFT_ARM && baked_index != BAKED_LEFT_LEG && baked_index != BAKED_AUX1 && baked_index != BAKED_AUX2 && baked_index != BAKED_AUX3)
+ {
+ LL_DEBUGS("Avatar") << avString() << " baked_index " << (S32) baked_index << " using mLastTextureID " << mBakedTextureDatas[baked_index].mLastTextureID << LL_ENDL;
+ setTEImage(mBakedTextureDatas[baked_index].mTextureIndex,
+ LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
+ }
+ else
+ {
+ LL_DEBUGS("Avatar") << avString() << " baked_index " << (S32) baked_index << " using texture id "
+ << getTE(mBakedTextureDatas[baked_index].mTextureIndex)->getID() << LL_ENDL;
+ }
+ }
+
+ // runway - was
+ // if (!is_first_appearance_message )
+ // which means it would be called on second appearance message - probably wrong.
+ BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived;
+ mFirstAppearanceMessageReceived = TRUE;
+
+ //LL_DEBUGS("Avatar") << avString() << "processAvatarAppearance start " << mID
// << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL;
- if (is_first_appearance_message )
- {
- onFirstTEMessageReceived();
- }
-
- setCompositeUpdatesEnabled( FALSE );
- gPipeline.markGLRebuild(this);
-
- // Apply visual params
- if( num_params > 1)
- {
- //LL_DEBUGS("Avatar") << avString() << " handle visual params, num_params " << num_params << LL_ENDL;
- BOOL params_changed = FALSE;
- BOOL interp_params = FALSE;
- S32 params_changed_count = 0;
-
- for( S32 i = 0; i < num_params; i++ )
- {
- LLVisualParam* param = contents.mParams[i];
- F32 newWeight = contents.mParamWeights[i];
-
- if (slam_params || is_first_appearance_message || (param->getWeight() != newWeight))
- {
- params_changed = TRUE;
- params_changed_count++;
-
- if(is_first_appearance_message || slam_params)
- {
- //LL_DEBUGS("Avatar") << "param slam " << i << " " << newWeight << LL_ENDL;
- param->setWeight(newWeight);
- }
- else
- {
- interp_params = TRUE;
- param->setAnimationTarget(newWeight);
- }
- }
- }
- const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE) +
- getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
- if (num_params != expected_tweakable_count)
- {
- LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << LL_ENDL;
- }
-
- LL_DEBUGS("Avatar") << "Changed " << params_changed_count << " params" << LL_ENDL;
- if (params_changed)
- {
- if (interp_params)
- {
- startAppearanceAnimation();
- }
- updateVisualParams();
-
- ESex new_sex = getSex();
- if( old_sex != new_sex )
- {
- updateSexDependentLayerSets();
- }
- }
-
- llassert( getSex() == ((getVisualParamWeight( "male" ) > 0.5f) ? SEX_MALE : SEX_FEMALE) );
- }
- else
- {
- // AvatarAppearance message arrived without visual params
- LL_DEBUGS("Avatar") << avString() << "no visual params" << LL_ENDL;
-
- const F32 LOADING_TIMEOUT_SECONDS = 60.f;
- // this isn't really a problem if we already have a non-default shape
- if (visualParamWeightsAreDefault() && mRuthTimer.getElapsedTimeF32() > LOADING_TIMEOUT_SECONDS)
- {
- // re-request appearance, hoping that it comes back with a shape next time
- LL_INFOS() << "Re-requesting AvatarAppearance for object: " << getID() << LL_ENDL;
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarTexturesRequest(getID());
- mRuthTimer.reset();
- }
- else
- {
- LL_INFOS() << "That's okay, we already have a non-default shape for object: " << getID() << LL_ENDL;
- // we don't really care.
- }
- }
-
- if (contents.mHoverOffsetWasSet && !isSelf())
- {
- // Got an update for some other avatar
- // Ignore updates for self, because we have a more authoritative value in the preferences.
- setHoverOffset(contents.mHoverOffset);
- LL_DEBUGS("Avatar") << avString() << "setting hover to " << contents.mHoverOffset[2] << LL_ENDL;
- }
-
- if (!contents.mHoverOffsetWasSet && !isSelf())
- {
- // If we don't get a value at all, we are presumably in a
- // region that does not support hover height.
- LL_WARNS() << avString() << "zeroing hover because not defined in appearance message" << LL_ENDL;
- setHoverOffset(LLVector3(0.0, 0.0, 0.0));
- }
-
- setCompositeUpdatesEnabled( TRUE );
-
- // If all of the avatars are completely baked, release the global image caches to conserve memory.
- LLVOAvatar::cullAvatarsByPixelArea();
-
- if (isSelf())
- {
- mUseLocalAppearance = false;
- }
-
- updateMeshTextures();
- updateMeshVisibility();
+ if (is_first_appearance_message )
+ {
+ onFirstTEMessageReceived();
+ }
+
+ setCompositeUpdatesEnabled( FALSE );
+ gPipeline.markGLRebuild(this);
+
+ // Apply visual params
+ if( num_params > 1)
+ {
+ //LL_DEBUGS("Avatar") << avString() << " handle visual params, num_params " << num_params << LL_ENDL;
+ BOOL params_changed = FALSE;
+ BOOL interp_params = FALSE;
+ S32 params_changed_count = 0;
+
+ for( S32 i = 0; i < num_params; i++ )
+ {
+ LLVisualParam* param = contents.mParams[i];
+ F32 newWeight = contents.mParamWeights[i];
+
+ if (slam_params || is_first_appearance_message || (param->getWeight() != newWeight))
+ {
+ params_changed = TRUE;
+ params_changed_count++;
+
+ if(is_first_appearance_message || slam_params)
+ {
+ //LL_DEBUGS("Avatar") << "param slam " << i << " " << newWeight << LL_ENDL;
+ param->setWeight(newWeight);
+ }
+ else
+ {
+ interp_params = TRUE;
+ param->setAnimationTarget(newWeight);
+ }
+ }
+ }
+ const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE) +
+ getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
+ if (num_params != expected_tweakable_count)
+ {
+ LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << LL_ENDL;
+ }
+
+ LL_DEBUGS("Avatar") << "Changed " << params_changed_count << " params" << LL_ENDL;
+ if (params_changed)
+ {
+ if (interp_params)
+ {
+ startAppearanceAnimation();
+ }
+ updateVisualParams();
+
+ ESex new_sex = getSex();
+ if( old_sex != new_sex )
+ {
+ updateSexDependentLayerSets();
+ }
+ }
+
+ llassert( getSex() == ((getVisualParamWeight( "male" ) > 0.5f) ? SEX_MALE : SEX_FEMALE) );
+ }
+ else
+ {
+ // AvatarAppearance message arrived without visual params
+ LL_DEBUGS("Avatar") << avString() << "no visual params" << LL_ENDL;
+
+ const F32 LOADING_TIMEOUT_SECONDS = 60.f;
+ // this isn't really a problem if we already have a non-default shape
+ if (visualParamWeightsAreDefault() && mRuthTimer.getElapsedTimeF32() > LOADING_TIMEOUT_SECONDS)
+ {
+ // re-request appearance, hoping that it comes back with a shape next time
+ LL_INFOS() << "Re-requesting AvatarAppearance for object: " << getID() << LL_ENDL;
+ LLAvatarPropertiesProcessor::getInstance()->sendAvatarTexturesRequest(getID());
+ mRuthTimer.reset();
+ }
+ else
+ {
+ LL_INFOS() << "That's okay, we already have a non-default shape for object: " << getID() << LL_ENDL;
+ // we don't really care.
+ }
+ }
+
+ if (contents.mHoverOffsetWasSet && !isSelf())
+ {
+ // Got an update for some other avatar
+ // Ignore updates for self, because we have a more authoritative value in the preferences.
+ setHoverOffset(contents.mHoverOffset);
+ LL_DEBUGS("Avatar") << avString() << "setting hover to " << contents.mHoverOffset[2] << LL_ENDL;
+ }
+
+ if (!contents.mHoverOffsetWasSet && !isSelf())
+ {
+ // If we don't get a value at all, we are presumably in a
+ // region that does not support hover height.
+ LL_WARNS() << avString() << "zeroing hover because not defined in appearance message" << LL_ENDL;
+ setHoverOffset(LLVector3(0.0, 0.0, 0.0));
+ }
+
+ setCompositeUpdatesEnabled( TRUE );
+
+ // If all of the avatars are completely baked, release the global image caches to conserve memory.
+ LLVOAvatar::cullAvatarsByPixelArea();
+
+ if (isSelf())
+ {
+ mUseLocalAppearance = false;
+ }
+
+ updateMeshTextures();
+ updateMeshVisibility();
}
LLViewerTexture* LLVOAvatar::getBakedTexture(const U8 te)
{
- if (te < 0 || te >= BAKED_NUM_INDICES)
- {
- return NULL;
- }
+ if (te < 0 || te >= BAKED_NUM_INDICES)
+ {
+ return NULL;
+ }
+
+ BOOL is_layer_baked = isTextureDefined(mBakedTextureDatas[te].mTextureIndex);
+
+ LLViewerTexLayerSet* layerset = NULL;
+ layerset = getTexLayerSet(te);
- BOOL is_layer_baked = isTextureDefined(mBakedTextureDatas[te].mTextureIndex);
-
- LLViewerTexLayerSet* layerset = NULL;
- layerset = getTexLayerSet(te);
-
- if (!isEditingAppearance() && is_layer_baked)
- {
- LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage(mBakedTextureDatas[te].mTextureIndex, 0), TRUE);
- return baked_img;
- }
- else if (layerset && isEditingAppearance())
- {
- layerset->createComposite();
- layerset->setUpdatesEnabled(TRUE);
+ if (!isEditingAppearance() && is_layer_baked)
+ {
+ LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage(mBakedTextureDatas[te].mTextureIndex, 0), TRUE);
+ return baked_img;
+ }
+ else if (layerset && isEditingAppearance())
+ {
+ layerset->createComposite();
+ layerset->setUpdatesEnabled(TRUE);
- return layerset->getViewerComposite();
- }
+ return layerset->getViewerComposite();
+ }
+
+ return NULL;
- return NULL;
-
}
const LLVOAvatar::MatrixPaletteCache& LLVOAvatar::updateSkinInfoMatrixPalette(const LLMeshSkinInfo* skin)
@@ -9744,262 +9744,262 @@ const LLVOAvatar::MatrixPaletteCache& LLVOAvatar::updateSkinInfoMatrixPalette(co
// static
void LLVOAvatar::getAnimLabels( std::vector<std::string>* labels )
{
- S32 i;
- labels->reserve(gUserAnimStatesCount);
- for( i = 0; i < gUserAnimStatesCount; i++ )
- {
- labels->push_back( LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName ) );
- }
+ S32 i;
+ labels->reserve(gUserAnimStatesCount);
+ for( i = 0; i < gUserAnimStatesCount; i++ )
+ {
+ labels->push_back( LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName ) );
+ }
- // Special case to trigger away (AFK) state
- labels->push_back( "Away From Keyboard" );
+ // Special case to trigger away (AFK) state
+ labels->push_back( "Away From Keyboard" );
}
-// static
+// static
void LLVOAvatar::getAnimNames( std::vector<std::string>* names )
{
- S32 i;
+ S32 i;
- names->reserve(gUserAnimStatesCount);
- for( i = 0; i < gUserAnimStatesCount; i++ )
- {
- names->push_back( std::string(gUserAnimStates[i].mName) );
- }
+ names->reserve(gUserAnimStatesCount);
+ for( i = 0; i < gUserAnimStatesCount; i++ )
+ {
+ names->push_back( std::string(gUserAnimStates[i].mName) );
+ }
- // Special case to trigger away (AFK) state
- names->push_back( "enter_away_from_keyboard_state" );
+ // Special case to trigger away (AFK) state
+ names->push_back( "enter_away_from_keyboard_state" );
}
// static
void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata )
{
- if (!userdata) return;
-
- //LL_INFOS() << "onBakedTextureMasksLoaded: " << src_vi->getID() << LL_ENDL;
- const LLUUID id = src_vi->getID();
-
- LLTextureMaskData* maskData = (LLTextureMaskData*) userdata;
- LLVOAvatar* self = (LLVOAvatar*) gObjectList.findObject( maskData->mAvatarID );
-
- // if discard level is 2 less than last discard level we processed, or we hit 0,
- // then generate morph masks
- if(self && success && (discard_level < maskData->mLastDiscardLevel - 2 || discard_level == 0))
- {
- if(aux_src && aux_src->getComponents() == 1)
- {
- if (!aux_src->getData())
- {
- LL_ERRS() << "No auxiliary source (morph mask) data for image id " << id << LL_ENDL;
- return;
- }
-
- U32 gl_name;
- LLImageGL::generateTextures(1, &gl_name );
- stop_glerror();
-
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name);
- stop_glerror();
-
- LLImageGL::setManualImage(
- GL_TEXTURE_2D, 0, GL_ALPHA8,
- aux_src->getWidth(), aux_src->getHeight(),
- GL_ALPHA, GL_UNSIGNED_BYTE, aux_src->getData());
- stop_glerror();
-
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
-
- /* if( id == head_baked->getID() )
- if (self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
- //LL_INFOS() << "onBakedTextureMasksLoaded for head " << id << " discard = " << discard_level << LL_ENDL;
- self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1);
- maskData->mLastDiscardLevel = discard_level; */
- BOOL found_texture_id = false;
- for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
- iter != LLAvatarAppearance::getDictionary()->getTextures().end();
- ++iter)
- {
-
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
- if (texture_dict->mIsUsedByBakedTexture)
- {
- const ETextureIndex texture_index = iter->first;
- const LLViewerTexture *baked_img = self->getImage(texture_index, 0);
- if (baked_img && id == baked_img->getID())
- {
- const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- self->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1, baked_index);
- maskData->mLastDiscardLevel = discard_level;
- if (self->mBakedTextureDatas[baked_index].mMaskTexName)
- {
- LLImageGL::deleteTextures(1, &(self->mBakedTextureDatas[baked_index].mMaskTexName));
- }
- self->mBakedTextureDatas[baked_index].mMaskTexName = gl_name;
- found_texture_id = true;
- break;
- }
- }
- }
- if (!found_texture_id)
- {
- LL_INFOS() << "unexpected image id: " << id << LL_ENDL;
- }
- self->dirtyMesh();
- }
- else
- {
- // this can happen when someone uses an old baked texture possibly provided by
+ if (!userdata) return;
+
+ //LL_INFOS() << "onBakedTextureMasksLoaded: " << src_vi->getID() << LL_ENDL;
+ const LLUUID id = src_vi->getID();
+
+ LLTextureMaskData* maskData = (LLTextureMaskData*) userdata;
+ LLVOAvatar* self = (LLVOAvatar*) gObjectList.findObject( maskData->mAvatarID );
+
+ // if discard level is 2 less than last discard level we processed, or we hit 0,
+ // then generate morph masks
+ if(self && success && (discard_level < maskData->mLastDiscardLevel - 2 || discard_level == 0))
+ {
+ if(aux_src && aux_src->getComponents() == 1)
+ {
+ if (!aux_src->getData())
+ {
+ LL_ERRS() << "No auxiliary source (morph mask) data for image id " << id << LL_ENDL;
+ return;
+ }
+
+ U32 gl_name;
+ LLImageGL::generateTextures(1, &gl_name );
+ stop_glerror();
+
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name);
+ stop_glerror();
+
+ LLImageGL::setManualImage(
+ GL_TEXTURE_2D, 0, GL_ALPHA8,
+ aux_src->getWidth(), aux_src->getHeight(),
+ GL_ALPHA, GL_UNSIGNED_BYTE, aux_src->getData());
+ stop_glerror();
+
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
+
+ /* if( id == head_baked->getID() )
+ if (self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
+ //LL_INFOS() << "onBakedTextureMasksLoaded for head " << id << " discard = " << discard_level << LL_ENDL;
+ self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1);
+ maskData->mLastDiscardLevel = discard_level; */
+ BOOL found_texture_id = false;
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
+ iter != LLAvatarAppearance::getDictionary()->getTextures().end();
+ ++iter)
+ {
+
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
+ if (texture_dict->mIsUsedByBakedTexture)
+ {
+ const ETextureIndex texture_index = iter->first;
+ const LLViewerTexture *baked_img = self->getImage(texture_index, 0);
+ if (baked_img && id == baked_img->getID())
+ {
+ const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+ self->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1, baked_index);
+ maskData->mLastDiscardLevel = discard_level;
+ if (self->mBakedTextureDatas[baked_index].mMaskTexName)
+ {
+ LLImageGL::deleteTextures(1, &(self->mBakedTextureDatas[baked_index].mMaskTexName));
+ }
+ self->mBakedTextureDatas[baked_index].mMaskTexName = gl_name;
+ found_texture_id = true;
+ break;
+ }
+ }
+ }
+ if (!found_texture_id)
+ {
+ LL_INFOS() << "unexpected image id: " << id << LL_ENDL;
+ }
+ self->dirtyMesh();
+ }
+ else
+ {
+ // this can happen when someone uses an old baked texture possibly provided by
// viewer-side baked texture caching
- LL_WARNS() << "Masks loaded callback but NO aux source, id " << id << LL_ENDL;
- }
- }
+ LL_WARNS() << "Masks loaded callback but NO aux source, id " << id << LL_ENDL;
+ }
+ }
- if (final || !success)
- {
- delete maskData;
- }
+ if (final || !success)
+ {
+ delete maskData;
+ }
}
// static
void LLVOAvatar::onInitialBakedTextureLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata )
{
- LLUUID *avatar_idp = (LLUUID *)userdata;
- LLVOAvatar *selfp = (LLVOAvatar *)gObjectList.findObject(*avatar_idp);
+ LLUUID *avatar_idp = (LLUUID *)userdata;
+ LLVOAvatar *selfp = (LLVOAvatar *)gObjectList.findObject(*avatar_idp);
- if (selfp)
- {
- //LL_DEBUGS("Avatar") << selfp->avString() << "discard_level " << discard_level << " success " << success << " final " << final << LL_ENDL;
- }
+ if (selfp)
+ {
+ //LL_DEBUGS("Avatar") << selfp->avString() << "discard_level " << discard_level << " success " << success << " final " << final << LL_ENDL;
+ }
- if (!success && selfp)
- {
- selfp->removeMissingBakedTextures();
- }
- if (final || !success )
- {
- delete avatar_idp;
- }
+ if (!success && selfp)
+ {
+ selfp->removeMissingBakedTextures();
+ }
+ if (final || !success )
+ {
+ delete avatar_idp;
+ }
}
// Static
void LLVOAvatar::onBakedTextureLoaded(BOOL success,
- LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src,
- S32 discard_level, BOOL final, void* userdata)
+ LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src,
+ S32 discard_level, BOOL final, void* userdata)
{
- //LL_DEBUGS("Avatar") << "onBakedTextureLoaded: " << src_vi->getID() << LL_ENDL;
+ //LL_DEBUGS("Avatar") << "onBakedTextureLoaded: " << src_vi->getID() << LL_ENDL;
- LLUUID id = src_vi->getID();
- LLUUID *avatar_idp = (LLUUID *)userdata;
- LLVOAvatar *selfp = (LLVOAvatar *)gObjectList.findObject(*avatar_idp);
- if (selfp)
- {
- //LL_DEBUGS("Avatar") << selfp->avString() << "discard_level " << discard_level << " success " << success << " final " << final << " id " << src_vi->getID() << LL_ENDL;
- }
+ LLUUID id = src_vi->getID();
+ LLUUID *avatar_idp = (LLUUID *)userdata;
+ LLVOAvatar *selfp = (LLVOAvatar *)gObjectList.findObject(*avatar_idp);
+ if (selfp)
+ {
+ //LL_DEBUGS("Avatar") << selfp->avString() << "discard_level " << discard_level << " success " << success << " final " << final << " id " << src_vi->getID() << LL_ENDL;
+ }
- if (selfp && !success)
- {
- selfp->removeMissingBakedTextures();
- }
+ if (selfp && !success)
+ {
+ selfp->removeMissingBakedTextures();
+ }
- if( final || !success )
- {
- delete avatar_idp;
- }
+ if( final || !success )
+ {
+ delete avatar_idp;
+ }
- if( selfp && success && final )
- {
- selfp->useBakedTexture( id );
- }
+ if( selfp && success && final )
+ {
+ selfp->useBakedTexture( id );
+ }
}
// Called when baked texture is loaded and also when we start up with a baked texture
void LLVOAvatar::useBakedTexture( const LLUUID& id )
{
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- LLViewerTexture* image_baked = getImage( mBakedTextureDatas[i].mTextureIndex, 0 );
- if (id == image_baked->getID())
- {
- //LL_DEBUGS("Avatar") << avString() << " i " << i << " id " << id << LL_ENDL;
- mBakedTextureDatas[i].mIsLoaded = true;
- mBakedTextureDatas[i].mLastTextureID = id;
- mBakedTextureDatas[i].mIsUsed = true;
-
- if (isUsingLocalAppearance())
- {
- LL_INFOS() << "not changing to baked texture while isUsingLocalAppearance" << LL_ENDL;
- }
- else
- {
- debugColorizeSubMeshes(i,LLColor4::green);
-
- avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
- avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
- for (; iter != end; ++iter)
- {
- LLAvatarJointMesh* mesh = (*iter);
- if (mesh)
- {
- mesh->setTexture( image_baked );
- }
- }
- }
-
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict =
- LLAvatarAppearance::getDictionary()->getBakedTexture((EBakedTextureIndex)i);
- for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
- local_tex_iter != baked_dict->mLocalTextures.end();
- ++local_tex_iter)
- {
- if (isSelf()) setBakedReady(*local_tex_iter, TRUE);
- }
-
- // ! BACKWARDS COMPATIBILITY !
- // Workaround for viewing avatars from old viewers that haven't baked hair textures.
- // This is paired with similar code in updateMeshTextures that sets hair mesh color.
- if (i == BAKED_HAIR)
- {
- avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
- avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
- for (; iter != end; ++iter)
- {
- LLAvatarJointMesh* mesh = (*iter);
- if (mesh)
- {
- mesh->setColor( LLColor4::white );
- }
- }
- }
- }
- }
-
- dirtyMesh();
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ LLViewerTexture* image_baked = getImage( mBakedTextureDatas[i].mTextureIndex, 0 );
+ if (id == image_baked->getID())
+ {
+ //LL_DEBUGS("Avatar") << avString() << " i " << i << " id " << id << LL_ENDL;
+ mBakedTextureDatas[i].mIsLoaded = true;
+ mBakedTextureDatas[i].mLastTextureID = id;
+ mBakedTextureDatas[i].mIsUsed = true;
+
+ if (isUsingLocalAppearance())
+ {
+ LL_INFOS() << "not changing to baked texture while isUsingLocalAppearance" << LL_ENDL;
+ }
+ else
+ {
+ debugColorizeSubMeshes(i,LLColor4::green);
+
+ avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
+ avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
+ for (; iter != end; ++iter)
+ {
+ LLAvatarJointMesh* mesh = (*iter);
+ if (mesh)
+ {
+ mesh->setTexture( image_baked );
+ }
+ }
+ }
+
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict =
+ LLAvatarAppearance::getDictionary()->getBakedTexture((EBakedTextureIndex)i);
+ for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
+ local_tex_iter != baked_dict->mLocalTextures.end();
+ ++local_tex_iter)
+ {
+ if (isSelf()) setBakedReady(*local_tex_iter, TRUE);
+ }
+
+ // ! BACKWARDS COMPATIBILITY !
+ // Workaround for viewing avatars from old viewers that haven't baked hair textures.
+ // This is paired with similar code in updateMeshTextures that sets hair mesh color.
+ if (i == BAKED_HAIR)
+ {
+ avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
+ avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
+ for (; iter != end; ++iter)
+ {
+ LLAvatarJointMesh* mesh = (*iter);
+ if (mesh)
+ {
+ mesh->setColor( LLColor4::white );
+ }
+ }
+ }
+ }
+ }
+
+ dirtyMesh();
}
std::string get_sequential_numbered_file_name(const std::string& prefix,
- const std::string& suffix)
-{
- typedef std::map<std::string,S32> file_num_type;
- static file_num_type file_nums;
- file_num_type::iterator it = file_nums.find(prefix);
- S32 num = 0;
- if (it != file_nums.end())
- {
- num = it->second;
- }
- file_nums[prefix] = num+1;
- std::string outfilename = prefix + " " + llformat("%04d",num) + ".xml";
- std::replace(outfilename.begin(),outfilename.end(),' ','_');
- return outfilename;
+ const std::string& suffix)
+{
+ typedef std::map<std::string,S32> file_num_type;
+ static file_num_type file_nums;
+ file_num_type::iterator it = file_nums.find(prefix);
+ S32 num = 0;
+ if (it != file_nums.end())
+ {
+ num = it->second;
+ }
+ file_nums[prefix] = num+1;
+ std::string outfilename = prefix + " " + llformat("%04d",num) + ".xml";
+ std::replace(outfilename.begin(),outfilename.end(),' ','_');
+ return outfilename;
}
void dump_sequential_xml(const std::string outprefix, const LLSD& content)
{
- std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml");
- std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
- llofstream ofs(fullpath.c_str(), std::ios_base::out);
- ofs << LLSDOStreamer<LLSDXMLFormatter>(content, LLSDFormatter::OPTIONS_PRETTY);
- LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL;
+ std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml");
+ std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
+ llofstream ofs(fullpath.c_str(), std::ios_base::out);
+ ofs << LLSDOStreamer<LLSDXMLFormatter>(content, LLSDFormatter::OPTIONS_PRETTY);
+ LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL;
}
void LLVOAvatar::getSortedJointNames(S32 joint_type, std::vector<std::string>& result) const
@@ -10009,9 +10009,9 @@ void LLVOAvatar::getSortedJointNames(S32 joint_type, std::vector<std::string>& r
{
avatar_joint_list_t::const_iterator iter = mSkeleton.begin();
avatar_joint_list_t::const_iterator end = mSkeleton.end();
- for (; iter != end; ++iter)
- {
- LLJoint* pJoint = (*iter);
+ for (; iter != end; ++iter)
+ {
+ LLJoint* pJoint = (*iter);
result.push_back(pJoint->getName());
}
}
@@ -10025,11 +10025,11 @@ void LLVOAvatar::getSortedJointNames(S32 joint_type, std::vector<std::string>& r
}
else if (joint_type==2)
{
- for (LLVOAvatar::attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end(); ++iter)
- {
- LLViewerJointAttachment* pJoint = iter->second;
- if (!pJoint) continue;
+ for (LLVOAvatar::attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end(); ++iter)
+ {
+ LLViewerJointAttachment* pJoint = iter->second;
+ if (!pJoint) continue;
result.push_back(pJoint->getName());
}
}
@@ -10038,96 +10038,96 @@ void LLVOAvatar::getSortedJointNames(S32 joint_type, std::vector<std::string>& r
void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_wearables )
{
- std::string outprefix(prefix);
- if (outprefix.empty())
- {
- outprefix = getFullname() + (isSelf()?"_s":"_o");
- }
- if (outprefix.empty())
- {
- outprefix = std::string("new_archetype");
- }
- std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml");
-
- LLAPRFile outfile;
+ std::string outprefix(prefix);
+ if (outprefix.empty())
+ {
+ outprefix = getFullname() + (isSelf()?"_s":"_o");
+ }
+ if (outprefix.empty())
+ {
+ outprefix = std::string("new_archetype");
+ }
+ std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml");
+
+ LLAPRFile outfile;
LLWearableType *wr_inst = LLWearableType::getInstance();
- std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
- if (APR_SUCCESS == outfile.open(fullpath, LL_APR_WB ))
- {
- apr_file_t* file = outfile.getFileHandle();
- LL_INFOS() << "xmlfile write handle obtained : " << fullpath << LL_ENDL;
-
- apr_file_printf( file, "<?xml version=\"1.0\" encoding=\"US-ASCII\" standalone=\"yes\"?>\n" );
- apr_file_printf( file, "<linden_genepool version=\"1.0\">\n" );
- apr_file_printf( file, "\n\t<archetype name=\"???\">\n" );
-
- bool agent_is_godlike = gAgent.isGodlikeWithoutAdminMenuFakery();
-
- if (group_by_wearables)
- {
- for (S32 type = LLWearableType::WT_SHAPE; type < LLWearableType::WT_COUNT; type++)
- {
- const std::string& wearable_name = wr_inst->getTypeName((LLWearableType::EType)type);
- apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
-
- for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam())
- {
- LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
- if( (viewer_param->getWearableType() == type) &&
- (viewer_param->isTweakable() ) )
- {
- dump_visual_param(file, viewer_param, viewer_param->getWeight());
- }
- }
-
- for (U8 te = 0; te < TEX_NUM_INDICES; te++)
- {
- if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex)te) == type)
- {
- // MULTIPLE_WEARABLES: extend to multiple wearables?
- LLViewerTexture* te_image = getImage((ETextureIndex)te, 0);
- if( te_image )
- {
- std::string uuid_str = LLUUID().asString();
- if (agent_is_godlike)
- {
- te_image->getID().toString(uuid_str);
- }
- apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str());
- }
- }
- }
- }
- }
- else
- {
- // Just dump all params sequentially.
- for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam())
- {
- LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
- dump_visual_param(file, viewer_param, viewer_param->getWeight());
- }
-
- for (U8 te = 0; te < TEX_NUM_INDICES; te++)
- {
- // MULTIPLE_WEARABLES: extend to multiple wearables?
- LLViewerTexture* te_image = getImage((ETextureIndex)te, 0);
- if( te_image )
- {
- std::string uuid_str = LLUUID().asString();
- if (agent_is_godlike)
- {
- te_image->getID().toString(uuid_str);
- }
- apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str());
- }
- }
- }
+ std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
+ if (APR_SUCCESS == outfile.open(fullpath, LL_APR_WB ))
+ {
+ apr_file_t* file = outfile.getFileHandle();
+ LL_INFOS() << "xmlfile write handle obtained : " << fullpath << LL_ENDL;
+
+ apr_file_printf( file, "<?xml version=\"1.0\" encoding=\"US-ASCII\" standalone=\"yes\"?>\n" );
+ apr_file_printf( file, "<linden_genepool version=\"1.0\">\n" );
+ apr_file_printf( file, "\n\t<archetype name=\"???\">\n" );
+
+ bool agent_is_godlike = gAgent.isGodlikeWithoutAdminMenuFakery();
+
+ if (group_by_wearables)
+ {
+ for (S32 type = LLWearableType::WT_SHAPE; type < LLWearableType::WT_COUNT; type++)
+ {
+ const std::string& wearable_name = wr_inst->getTypeName((LLWearableType::EType)type);
+ apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
+
+ for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam())
+ {
+ LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
+ if( (viewer_param->getWearableType() == type) &&
+ (viewer_param->isTweakable() ) )
+ {
+ dump_visual_param(file, viewer_param, viewer_param->getWeight());
+ }
+ }
+
+ for (U8 te = 0; te < TEX_NUM_INDICES; te++)
+ {
+ if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex)te) == type)
+ {
+ // MULTIPLE_WEARABLES: extend to multiple wearables?
+ LLViewerTexture* te_image = getImage((ETextureIndex)te, 0);
+ if( te_image )
+ {
+ std::string uuid_str = LLUUID().asString();
+ if (agent_is_godlike)
+ {
+ te_image->getID().toString(uuid_str);
+ }
+ apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str());
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // Just dump all params sequentially.
+ for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam())
+ {
+ LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
+ dump_visual_param(file, viewer_param, viewer_param->getWeight());
+ }
+
+ for (U8 te = 0; te < TEX_NUM_INDICES; te++)
+ {
+ // MULTIPLE_WEARABLES: extend to multiple wearables?
+ LLViewerTexture* te_image = getImage((ETextureIndex)te, 0);
+ if( te_image )
+ {
+ std::string uuid_str = LLUUID().asString();
+ if (agent_is_godlike)
+ {
+ te_image->getID().toString(uuid_str);
+ }
+ apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str());
+ }
+ }
+ }
// Root joint
const LLVector3& pos = mRoot->getPosition();
const LLVector3& scale = mRoot->getScale();
- apr_file_printf( file, "\t\t<root name=\"%s\" position=\"%f %f %f\" scale=\"%f %f %f\"/>\n",
+ apr_file_printf( file, "\t\t<root name=\"%s\" position=\"%f %f %f\" scale=\"%f %f %f\"/>\n",
mRoot->getName().c_str(), pos[0], pos[1], pos[2], scale[0], scale[1], scale[2]);
// Bones
@@ -10143,10 +10143,10 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
name_iter != bone_names.end(); ++name_iter)
{
LLJoint *pJoint = getJoint(*name_iter);
- const LLVector3& pos = pJoint->getPosition();
- const LLVector3& scale = pJoint->getScale();
- apr_file_printf( file, "\t\t<bone name=\"%s\" position=\"%f %f %f\" scale=\"%f %f %f\"/>\n",
- pJoint->getName().c_str(), pos[0], pos[1], pos[2], scale[0], scale[1], scale[2]);
+ const LLVector3& pos = pJoint->getPosition();
+ const LLVector3& scale = pJoint->getScale();
+ apr_file_printf( file, "\t\t<bone name=\"%s\" position=\"%f %f %f\" scale=\"%f %f %f\"/>\n",
+ pJoint->getName().c_str(), pos[0], pos[1], pos[2], scale[0], scale[1], scale[2]);
}
// Collision volumes
@@ -10154,10 +10154,10 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
name_iter != cv_names.end(); ++name_iter)
{
LLJoint *pJoint = getJoint(*name_iter);
- const LLVector3& pos = pJoint->getPosition();
- const LLVector3& scale = pJoint->getScale();
- apr_file_printf( file, "\t\t<collision_volume name=\"%s\" position=\"%f %f %f\" scale=\"%f %f %f\"/>\n",
- pJoint->getName().c_str(), pos[0], pos[1], pos[2], scale[0], scale[1], scale[2]);
+ const LLVector3& pos = pJoint->getPosition();
+ const LLVector3& scale = pJoint->getScale();
+ apr_file_printf( file, "\t\t<collision_volume name=\"%s\" position=\"%f %f %f\" scale=\"%f %f %f\"/>\n",
+ pJoint->getName().c_str(), pos[0], pos[1], pos[2], scale[0], scale[1], scale[2]);
}
// Attachment joints
@@ -10165,63 +10165,63 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
name_iter != attach_names.end(); ++name_iter)
{
LLJoint *pJoint = getJoint(*name_iter);
- if (!pJoint) continue;
- const LLVector3& pos = pJoint->getPosition();
- const LLVector3& scale = pJoint->getScale();
- apr_file_printf( file, "\t\t<attachment_point name=\"%s\" position=\"%f %f %f\" scale=\"%f %f %f\"/>\n",
- pJoint->getName().c_str(), pos[0], pos[1], pos[2], scale[0], scale[1], scale[2]);
+ if (!pJoint) continue;
+ const LLVector3& pos = pJoint->getPosition();
+ const LLVector3& scale = pJoint->getScale();
+ apr_file_printf( file, "\t\t<attachment_point name=\"%s\" position=\"%f %f %f\" scale=\"%f %f %f\"/>\n",
+ pJoint->getName().c_str(), pos[0], pos[1], pos[2], scale[0], scale[1], scale[2]);
}
-
+
// Joint pos overrides
for (std::vector<std::string>::iterator name_iter = all_names.begin();
name_iter != all_names.end(); ++name_iter)
{
LLJoint *pJoint = getJoint(*name_iter);
-
- LLVector3 pos;
- LLUUID mesh_id;
- if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id))
- {
+ LLVector3 pos;
+ LLUUID mesh_id;
+
+ if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id))
+ {
S32 num_pos_overrides;
std::set<LLVector3> distinct_pos_overrides;
pJoint->getAllAttachmentPosOverrides(num_pos_overrides, distinct_pos_overrides);
- apr_file_printf( file, "\t\t<joint_offset name=\"%s\" position=\"%f %f %f\" mesh_id=\"%s\" count=\"%d\" distinct=\"%d\"/>\n",
- pJoint->getName().c_str(), pos[0], pos[1], pos[2], mesh_id.asString().c_str(),
+ apr_file_printf( file, "\t\t<joint_offset name=\"%s\" position=\"%f %f %f\" mesh_id=\"%s\" count=\"%d\" distinct=\"%d\"/>\n",
+ pJoint->getName().c_str(), pos[0], pos[1], pos[2], mesh_id.asString().c_str(),
num_pos_overrides, (S32) distinct_pos_overrides.size());
- }
- }
+ }
+ }
// Joint scale overrides
for (std::vector<std::string>::iterator name_iter = all_names.begin();
name_iter != all_names.end(); ++name_iter)
{
LLJoint *pJoint = getJoint(*name_iter);
-
- LLVector3 scale;
- LLUUID mesh_id;
- if (pJoint && pJoint->hasAttachmentScaleOverride(scale,mesh_id))
- {
+ LLVector3 scale;
+ LLUUID mesh_id;
+
+ if (pJoint && pJoint->hasAttachmentScaleOverride(scale,mesh_id))
+ {
S32 num_scale_overrides;
std::set<LLVector3> distinct_scale_overrides;
pJoint->getAllAttachmentPosOverrides(num_scale_overrides, distinct_scale_overrides);
- apr_file_printf( file, "\t\t<joint_scale name=\"%s\" scale=\"%f %f %f\" mesh_id=\"%s\" count=\"%d\" distinct=\"%d\"/>\n",
- pJoint->getName().c_str(), scale[0], scale[1], scale[2], mesh_id.asString().c_str(),
+ apr_file_printf( file, "\t\t<joint_scale name=\"%s\" scale=\"%f %f %f\" mesh_id=\"%s\" count=\"%d\" distinct=\"%d\"/>\n",
+ pJoint->getName().c_str(), scale[0], scale[1], scale[2], mesh_id.asString().c_str(),
num_scale_overrides, (S32) distinct_scale_overrides.size());
- }
- }
- F32 pelvis_fixup;
- LLUUID mesh_id;
- if (hasPelvisFixup(pelvis_fixup, mesh_id))
- {
- apr_file_printf( file, "\t\t<pelvis_fixup z=\"%f\" mesh_id=\"%s\"/>\n",
- pelvis_fixup, mesh_id.asString().c_str());
- }
+ }
+ }
+ F32 pelvis_fixup;
+ LLUUID mesh_id;
+ if (hasPelvisFixup(pelvis_fixup, mesh_id))
+ {
+ apr_file_printf( file, "\t\t<pelvis_fixup z=\"%f\" mesh_id=\"%s\"/>\n",
+ pelvis_fixup, mesh_id.asString().c_str());
+ }
LLVector3 rp = getRootJoint()->getWorldPosition();
LLVector4a rpv;
rpv.load3(rp.mV);
-
+
for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++)
{
LLJoint *joint = getJoint(joint_num);
@@ -10237,7 +10237,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
LLVector4a rrp[2];
rrp[0].setSub(new_extents[0],rpv);
rrp[1].setSub(new_extents[1],rpv);
- apr_file_printf( file, "\t\t<joint_rig_info num=\"%d\" name=\"%s\" min=\"%f %f %f\" max=\"%f %f %f\" tmin=\"%f %f %f\" tmax=\"%f %f %f\"/>\n",
+ apr_file_printf( file, "\t\t<joint_rig_info num=\"%d\" name=\"%s\" min=\"%f %f %f\" max=\"%f %f %f\" tmin=\"%f %f %f\" tmax=\"%f %f %f\"/>\n",
joint_num,
joint->getName().c_str(),
rig_info.getRiggedExtents()[0][0],
@@ -10256,134 +10256,134 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
}
}
- bool ultra_verbose = false;
- if (isSelf() && ultra_verbose)
- {
- // show the cloned params inside the wearables as well.
- gAgentAvatarp->dumpWearableInfo(outfile);
- }
+ bool ultra_verbose = false;
+ if (isSelf() && ultra_verbose)
+ {
+ // show the cloned params inside the wearables as well.
+ gAgentAvatarp->dumpWearableInfo(outfile);
+ }
- apr_file_printf( file, "\t</archetype>\n" );
- apr_file_printf( file, "\n</linden_genepool>\n" );
+ apr_file_printf( file, "\t</archetype>\n" );
+ apr_file_printf( file, "\n</linden_genepool>\n" );
- LLSD args;
- args["PATH"] = fullpath;
- LLNotificationsUtil::add("AppearanceToXMLSaved", args);
- }
- else
- {
- LLNotificationsUtil::add("AppearanceToXMLFailed");
- }
- // File will close when handle goes out of scope
+ LLSD args;
+ args["PATH"] = fullpath;
+ LLNotificationsUtil::add("AppearanceToXMLSaved", args);
+ }
+ else
+ {
+ LLNotificationsUtil::add("AppearanceToXMLFailed");
+ }
+ // File will close when handle goes out of scope
}
void LLVOAvatar::setVisibilityRank(U32 rank)
{
- if (mDrawable.isNull() || mDrawable->isDead())
- {
- // do nothing
- return;
- }
- mVisibilityRank = rank;
+ if (mDrawable.isNull() || mDrawable->isDead())
+ {
+ // do nothing
+ return;
+ }
+ mVisibilityRank = rank;
}
// Assumes LLVOAvatar::sInstances has already been sorted.
S32 LLVOAvatar::getUnbakedPixelAreaRank()
{
- S32 rank = 1;
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- LLVOAvatar* inst = (LLVOAvatar*) *iter;
- if (inst == this)
- {
- return rank;
- }
- else if (!inst->isDead() && !inst->isFullyBaked())
- {
- rank++;
- }
- }
-
- llassert(0);
- return 0;
+ S32 rank = 1;
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ LLVOAvatar* inst = (LLVOAvatar*) *iter;
+ if (inst == this)
+ {
+ return rank;
+ }
+ else if (!inst->isDead() && !inst->isFullyBaked())
+ {
+ rank++;
+ }
+ }
+
+ llassert(0);
+ return 0;
}
struct CompareScreenAreaGreater
{
- BOOL operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs)
- {
- return lhs->getPixelArea() > rhs->getPixelArea();
- }
+ BOOL operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs)
+ {
+ return lhs->getPixelArea() > rhs->getPixelArea();
+ }
};
// static
void LLVOAvatar::cullAvatarsByPixelArea()
{
- std::sort(LLCharacter::sInstances.begin(), LLCharacter::sInstances.end(), CompareScreenAreaGreater());
-
- // Update the avatars that have changed status
- U32 rank = 2; //1 is reserved for self.
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- LLVOAvatar* inst = (LLVOAvatar*) *iter;
- BOOL culled;
- if (inst->isSelf() || inst->isFullyBaked())
- {
- culled = FALSE;
- }
- else
- {
- culled = TRUE;
- }
-
- if (inst->mCulled != culled)
- {
- inst->mCulled = culled;
- LL_DEBUGS() << "avatar " << inst->getID() << (culled ? " start culled" : " start not culled" ) << LL_ENDL;
- inst->updateMeshTextures();
- }
-
- if (inst->isSelf())
- {
- inst->setVisibilityRank(1);
- }
- else if (inst->mDrawable.notNull() && inst->mDrawable->isVisible())
- {
- inst->setVisibilityRank(rank++);
- }
- }
-
- // runway - this doesn't really detect gray/grey state.
- S32 grey_avatars = 0;
- if (!LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars))
- {
- if (gFrameTimeSeconds != sUnbakedUpdateTime) // only update once per frame
- {
- sUnbakedUpdateTime = gFrameTimeSeconds;
- sUnbakedTime += gFrameIntervalSeconds.value();
- }
- if (grey_avatars > 0)
- {
- if (gFrameTimeSeconds != sGreyUpdateTime) // only update once per frame
- {
- sGreyUpdateTime = gFrameTimeSeconds;
- sGreyTime += gFrameIntervalSeconds.value();
- }
- }
- }
+ std::sort(LLCharacter::sInstances.begin(), LLCharacter::sInstances.end(), CompareScreenAreaGreater());
+
+ // Update the avatars that have changed status
+ U32 rank = 2; //1 is reserved for self.
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ LLVOAvatar* inst = (LLVOAvatar*) *iter;
+ BOOL culled;
+ if (inst->isSelf() || inst->isFullyBaked())
+ {
+ culled = FALSE;
+ }
+ else
+ {
+ culled = TRUE;
+ }
+
+ if (inst->mCulled != culled)
+ {
+ inst->mCulled = culled;
+ LL_DEBUGS() << "avatar " << inst->getID() << (culled ? " start culled" : " start not culled" ) << LL_ENDL;
+ inst->updateMeshTextures();
+ }
+
+ if (inst->isSelf())
+ {
+ inst->setVisibilityRank(1);
+ }
+ else if (inst->mDrawable.notNull() && inst->mDrawable->isVisible())
+ {
+ inst->setVisibilityRank(rank++);
+ }
+ }
+
+ // runway - this doesn't really detect gray/grey state.
+ S32 grey_avatars = 0;
+ if (!LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars))
+ {
+ if (gFrameTimeSeconds != sUnbakedUpdateTime) // only update once per frame
+ {
+ sUnbakedUpdateTime = gFrameTimeSeconds;
+ sUnbakedTime += gFrameIntervalSeconds.value();
+ }
+ if (grey_avatars > 0)
+ {
+ if (gFrameTimeSeconds != sGreyUpdateTime) // only update once per frame
+ {
+ sGreyUpdateTime = gFrameTimeSeconds;
+ sGreyTime += gFrameIntervalSeconds.value();
+ }
+ }
+ }
}
void LLVOAvatar::startAppearanceAnimation()
{
- if(!mAppearanceAnimating)
- {
- mAppearanceAnimating = TRUE;
- mAppearanceMorphTimer.reset();
- mLastAppearanceBlendTime = 0.f;
- }
+ if(!mAppearanceAnimating)
+ {
+ mAppearanceAnimating = TRUE;
+ mAppearanceMorphTimer.reset();
+ mLastAppearanceBlendTime = 0.f;
+ }
}
// virtual
@@ -10394,35 +10394,35 @@ void LLVOAvatar::removeMissingBakedTextures()
//virtual
void LLVOAvatar::updateRegion(LLViewerRegion *regionp)
{
- LLViewerObject::updateRegion(regionp);
+ LLViewerObject::updateRegion(regionp);
}
// virtual
std::string LLVOAvatar::getFullname() const
{
- std::string name;
+ std::string name;
- LLNameValue* first = getNVPair("FirstName");
- LLNameValue* last = getNVPair("LastName");
- if (first && last)
- {
- name = LLCacheName::buildFullName( first->getString(), last->getString() );
- }
+ LLNameValue* first = getNVPair("FirstName");
+ LLNameValue* last = getNVPair("LastName");
+ if (first && last)
+ {
+ name = LLCacheName::buildFullName( first->getString(), last->getString() );
+ }
- return name;
+ return name;
}
LLHost LLVOAvatar::getObjectHost() const
{
- LLViewerRegion* region = getRegion();
- if (region && !isDead())
- {
- return region->getHost();
- }
- else
- {
- return LLHost();
- }
+ LLViewerRegion* region = getRegion();
+ if (region && !isDead())
+ {
+ return region->getHost();
+ }
+ else
+ {
+ return LLHost();
+ }
}
BOOL LLVOAvatar::updateLOD()
@@ -10431,36 +10431,36 @@ BOOL LLVOAvatar::updateLOD()
{
return FALSE;
}
-
- if (!LLPipeline::sImpostorRender && isImpostor() && 0 != mDrawable->getNumFaces() && mDrawable->getFace(0)->hasGeometry())
- {
- return TRUE;
- }
- BOOL res = updateJointLODs();
+ if (!LLPipeline::sImpostorRender && isImpostor() && 0 != mDrawable->getNumFaces() && mDrawable->getFace(0)->hasGeometry())
+ {
+ return TRUE;
+ }
+
+ BOOL res = updateJointLODs();
- LLFace* facep = mDrawable->getFace(0);
- if (!facep || !facep->getVertexBuffer())
- {
- dirtyMesh(2);
- }
+ LLFace* facep = mDrawable->getFace(0);
+ if (!facep || !facep->getVertexBuffer())
+ {
+ dirtyMesh(2);
+ }
- if (mDirtyMesh >= 2 || mDrawable->isState(LLDrawable::REBUILD_GEOMETRY))
- { //LOD changed or new mesh created, allocate new vertex buffer if needed
- updateMeshData();
- mDirtyMesh = 0;
- mNeedsSkin = TRUE;
- mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY);
- }
- updateVisibility();
+ if (mDirtyMesh >= 2 || mDrawable->isState(LLDrawable::REBUILD_GEOMETRY))
+ { //LOD changed or new mesh created, allocate new vertex buffer if needed
+ updateMeshData();
+ mDirtyMesh = 0;
+ mNeedsSkin = TRUE;
+ mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY);
+ }
+ updateVisibility();
- return res;
+ return res;
}
void LLVOAvatar::updateLODRiggedAttachments()
{
- updateLOD();
- rebuildRiggedAttachments();
+ updateLOD();
+ rebuildRiggedAttachments();
}
void showRigInfoTabExtents(LLVOAvatar *avatar, LLJointRiggingInfoTab& tab, S32& count_rigged, S32& count_box)
@@ -10474,7 +10474,7 @@ void showRigInfoTabExtents(LLVOAvatar *avatar, LLJointRiggingInfoTab& tab, S32&
{
count_rigged++;
LLJoint *joint = avatar->getJoint(i);
- LL_DEBUGS("RigSpam") << "joint " << i << " name " << joint->getName() << " box "
+ LL_DEBUGS("RigSpam") << "joint " << i << " name " << joint->getName() << " box "
<< tab[i].getRiggedExtents()[0] << ", " << tab[i].getRiggedExtents()[1] << LL_ENDL;
if ((!tab[i].getRiggedExtents()[0].equals3(zero_vec)) ||
(!tab[i].getRiggedExtents()[1].equals3(zero_vec)))
@@ -10488,15 +10488,15 @@ void showRigInfoTabExtents(LLVOAvatar *avatar, LLJointRiggingInfoTab& tab, S32&
void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- for ( LLVOAvatar::attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter )
- {
- LLViewerJointAttachment* attachment = iter->second;
- LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_end = attachment->mAttachedObjects.end();
-
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_iter = attachment->mAttachedObjects.begin();
- attach_iter != attach_end; ++attach_iter)
- {
- LLViewerObject* attached_object = attach_iter->get();
+ for ( LLVOAvatar::attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter )
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_end = attachment->mAttachedObjects.end();
+
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_iter = attachment->mAttachedObjects.begin();
+ attach_iter != attach_end; ++attach_iter)
+ {
+ LLViewerObject* attached_object = attach_iter->get();
LLVOVolume *volume = dynamic_cast<LLVOVolume*>(attached_object);
if (volume)
{
@@ -10554,31 +10554,31 @@ void LLVOAvatar::updateRiggingInfo()
std::vector<LLVOVolume*> volumes;
- getAssociatedVolumes(volumes);
-
- std::map<LLUUID,S32> curr_rigging_info_key;
- {
- // Get current rigging info key
- for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it)
- {
- LLVOVolume *vol = *it;
- if (vol->isMesh() && vol->getVolume())
- {
- const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID();
- S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD);
- curr_rigging_info_key[mesh_id] = max_lod;
- }
- }
-
- // Check for key change, which indicates some change in volume composition or LOD.
- if (curr_rigging_info_key == mLastRiggingInfoKey)
- {
- return;
- }
- }
-
- // Something changed. Update.
- mLastRiggingInfoKey = curr_rigging_info_key;
+ getAssociatedVolumes(volumes);
+
+ std::map<LLUUID,S32> curr_rigging_info_key;
+ {
+ // Get current rigging info key
+ for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it)
+ {
+ LLVOVolume *vol = *it;
+ if (vol->isMesh() && vol->getVolume())
+ {
+ const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID();
+ S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD);
+ curr_rigging_info_key[mesh_id] = max_lod;
+ }
+ }
+
+ // Check for key change, which indicates some change in volume composition or LOD.
+ if (curr_rigging_info_key == mLastRiggingInfoKey)
+ {
+ return;
+ }
+ }
+
+ // Something changed. Update.
+ mLastRiggingInfoKey = curr_rigging_info_key;
mJointRiggingInfoTab.clear();
for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it)
{
@@ -10601,112 +10601,112 @@ void LLVOAvatar::onActiveOverrideMeshesChanged()
}
U32 LLVOAvatar::getPartitionType() const
-{
- // Avatars merely exist as drawables in the bridge partition
- return mIsControlAvatar ? LLViewerRegion::PARTITION_CONTROL_AV : LLViewerRegion::PARTITION_AVATAR;
+{
+ // Avatars merely exist as drawables in the bridge partition
+ return mIsControlAvatar ? LLViewerRegion::PARTITION_CONTROL_AV : LLViewerRegion::PARTITION_AVATAR;
}
//static
void LLVOAvatar::updateImpostors()
{
- LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+ LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
std::vector<LLCharacter*> instances_copy = LLCharacter::sInstances;
- for (std::vector<LLCharacter*>::iterator iter = instances_copy.begin();
- iter != instances_copy.end(); ++iter)
- {
- LLVOAvatar* avatar = (LLVOAvatar*) *iter;
- if (!avatar->isDead()
- && avatar->isVisible()
- && avatar->isImpostor()
- && avatar->needsImpostorUpdate())
- {
+ for (std::vector<LLCharacter*>::iterator iter = instances_copy.begin();
+ iter != instances_copy.end(); ++iter)
+ {
+ LLVOAvatar* avatar = (LLVOAvatar*) *iter;
+ if (!avatar->isDead()
+ && avatar->isVisible()
+ && avatar->isImpostor()
+ && avatar->needsImpostorUpdate())
+ {
avatar->calcMutedAVColor();
- gPipeline.generateImpostor(avatar);
- }
- }
+ gPipeline.generateImpostor(avatar);
+ }
+ }
- LLCharacter::sAllowInstancesChange = TRUE;
+ LLCharacter::sAllowInstancesChange = TRUE;
}
// virtual
BOOL LLVOAvatar::isImpostor()
{
- return isVisuallyMuted() || (sLimitNonImpostors && (mUpdatePeriod > 1));
+ return isVisuallyMuted() || (sLimitNonImpostors && (mUpdatePeriod > 1));
}
BOOL LLVOAvatar::shouldImpostor(const F32 rank_factor)
{
- if (isSelf())
- {
- return false;
- }
- if (isVisuallyMuted())
- {
- return true;
- }
- return sLimitNonImpostors && (mVisibilityRank > sMaxNonImpostors * rank_factor);
+ if (isSelf())
+ {
+ return false;
+ }
+ if (isVisuallyMuted())
+ {
+ return true;
+ }
+ return sLimitNonImpostors && (mVisibilityRank > sMaxNonImpostors * rank_factor);
}
BOOL LLVOAvatar::needsImpostorUpdate() const
{
- return mNeedsImpostorUpdate;
+ return mNeedsImpostorUpdate;
}
const LLVector3& LLVOAvatar::getImpostorOffset() const
{
- return mImpostorOffset;
+ return mImpostorOffset;
}
const LLVector2& LLVOAvatar::getImpostorDim() const
{
- return mImpostorDim;
+ return mImpostorDim;
}
void LLVOAvatar::setImpostorDim(const LLVector2& dim)
{
- mImpostorDim = dim;
+ mImpostorDim = dim;
}
void LLVOAvatar::cacheImpostorValues()
{
- getImpostorValues(mImpostorExtents, mImpostorAngle, mImpostorDistance);
+ getImpostorValues(mImpostorExtents, mImpostorAngle, mImpostorDistance);
}
void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& distance) const
{
- const LLVector4a* ext = mDrawable->getSpatialExtents();
- extents[0] = ext[0];
- extents[1] = ext[1];
+ const LLVector4a* ext = mDrawable->getSpatialExtents();
+ extents[0] = ext[0];
+ extents[1] = ext[1];
- LLVector3 at = LLViewerCamera::getInstance()->getOrigin()-(getRenderPosition()+mImpostorOffset);
- distance = at.normalize();
- F32 da = 1.f - (at*LLViewerCamera::getInstance()->getAtAxis());
- angle.mV[0] = LLViewerCamera::getInstance()->getYaw()*da;
- angle.mV[1] = LLViewerCamera::getInstance()->getPitch()*da;
- angle.mV[2] = da;
+ LLVector3 at = LLViewerCamera::getInstance()->getOrigin()-(getRenderPosition()+mImpostorOffset);
+ distance = at.normalize();
+ F32 da = 1.f - (at*LLViewerCamera::getInstance()->getAtAxis());
+ angle.mV[0] = LLViewerCamera::getInstance()->getYaw()*da;
+ angle.mV[1] = LLViewerCamera::getInstance()->getPitch()*da;
+ angle.mV[2] = da;
}
// static
const U32 LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER = 66; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors
- * slider in panel_preferences_graphics1.xml */
+ * slider in panel_preferences_graphics1.xml */
// static
void LLVOAvatar::updateImpostorRendering(U32 newMaxNonImpostorsValue)
{
- U32 oldmax = sMaxNonImpostors;
- bool oldflg = sLimitNonImpostors;
-
- if (NON_IMPOSTORS_MAX_SLIDER <= newMaxNonImpostorsValue)
- {
- sMaxNonImpostors = 0;
- }
- else
- {
- sMaxNonImpostors = newMaxNonImpostorsValue;
- }
- // the sLimitNonImpostors flag depends on whether or not sMaxNonImpostors is set to the no-limit value (0)
- sLimitNonImpostors = (0 != sMaxNonImpostors);
+ U32 oldmax = sMaxNonImpostors;
+ bool oldflg = sLimitNonImpostors;
+
+ if (NON_IMPOSTORS_MAX_SLIDER <= newMaxNonImpostorsValue)
+ {
+ sMaxNonImpostors = 0;
+ }
+ else
+ {
+ sMaxNonImpostors = newMaxNonImpostorsValue;
+ }
+ // the sLimitNonImpostors flag depends on whether or not sMaxNonImpostors is set to the no-limit value (0)
+ sLimitNonImpostors = (0 != sMaxNonImpostors);
if ( oldflg != sLimitNonImpostors )
{
LL_DEBUGS("AvatarRender")
@@ -10732,9 +10732,9 @@ void LLVOAvatar::idleUpdateRenderComplexity()
}
// Render Complexity
- calculateUpdateRenderComplexity(); // Update mVisualComplexity if needed
+ calculateUpdateRenderComplexity(); // Update mVisualComplexity if needed
- bool autotune = LLPerfStats::tunables.userAutoTuneEnabled && !mIsControlAvatar && !isSelf();
+ bool autotune = LLPerfStats::tunables.userAutoTuneEnabled && !mIsControlAvatar && !isSelf();
if (autotune && !isDead())
{
static LLCachedControl<F32> render_far_clip(gSavedSettings, "RenderFarClip", 64);
@@ -10767,7 +10767,7 @@ void LLVOAvatar::updateNearbyAvatarCount()
{
static LLFrameTimer agent_update_timer;
- if (agent_update_timer.getElapsedTimeF32() > 1.0f)
+ if (agent_update_timer.getElapsedTimeF32() > 1.0f)
{
S32 avs_nearby = 0;
static LLCachedControl<F32> render_far_clip(gSavedSettings, "RenderFarClip", 64);
@@ -10795,90 +10795,90 @@ void LLVOAvatar::updateNearbyAvatarCount()
void LLVOAvatar::idleUpdateDebugInfo()
{
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO))
- {
- std::string info_line;
- F32 red_level;
- F32 green_level;
- LLColor4 info_color;
- LLFontGL::StyleFlags info_style;
-
- if ( !mText )
- {
- initHudText();
- mText->setFadeDistance(20.0, 5.0); // limit clutter in large crowds
- }
- else
- {
- mText->clearString(); // clear debug text
- }
-
- /*
- * NOTE: the logic for whether or not each of the values below
- * controls muting MUST match that in the isVisuallyMuted and isTooComplex methods.
- */
-
- static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0);
- info_line = llformat("%d Complexity", mVisualComplexity);
-
- if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this
- {
- green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f);
- red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f);
- info_color.set(red_level, green_level, 0.0, 1.0);
- info_style = ( mVisualComplexity > max_render_cost
- ? LLFontGL::BOLD : LLFontGL::NORMAL );
- }
- else
- {
- info_color.set(LLColor4::grey);
- info_style = LLFontGL::NORMAL;
- }
- mText->addLine(info_line, info_color, info_style);
-
- // Visual rank
- info_line = llformat("%d rank", mVisibilityRank);
- // Use grey for imposters, white for normal rendering or no impostors
- info_color.set(isImpostor() ? LLColor4::grey : (isControlAvatar() ? LLColor4::yellow : LLColor4::white));
- info_style = LLFontGL::NORMAL;
- mText->addLine(info_line, info_color, info_style);
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO))
+ {
+ std::string info_line;
+ F32 red_level;
+ F32 green_level;
+ LLColor4 info_color;
+ LLFontGL::StyleFlags info_style;
+
+ if ( !mText )
+ {
+ initHudText();
+ mText->setFadeDistance(20.0, 5.0); // limit clutter in large crowds
+ }
+ else
+ {
+ mText->clearString(); // clear debug text
+ }
+
+ /*
+ * NOTE: the logic for whether or not each of the values below
+ * controls muting MUST match that in the isVisuallyMuted and isTooComplex methods.
+ */
+
+ static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0);
+ info_line = llformat("%d Complexity", mVisualComplexity);
+
+ if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this
+ {
+ green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f);
+ red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f);
+ info_color.set(red_level, green_level, 0.0, 1.0);
+ info_style = ( mVisualComplexity > max_render_cost
+ ? LLFontGL::BOLD : LLFontGL::NORMAL );
+ }
+ else
+ {
+ info_color.set(LLColor4::grey);
+ info_style = LLFontGL::NORMAL;
+ }
+ mText->addLine(info_line, info_color, info_style);
+
+ // Visual rank
+ info_line = llformat("%d rank", mVisibilityRank);
+ // Use grey for imposters, white for normal rendering or no impostors
+ info_color.set(isImpostor() ? LLColor4::grey : (isControlAvatar() ? LLColor4::yellow : LLColor4::white));
+ info_style = LLFontGL::NORMAL;
+ mText->addLine(info_line, info_color, info_style);
// Triangle count
- mText->addLine(std::string("VisTris ") + LLStringOps::getReadableNumber(mAttachmentVisibleTriangleCount),
+ mText->addLine(std::string("VisTris ") + LLStringOps::getReadableNumber(mAttachmentVisibleTriangleCount),
info_color, info_style);
- mText->addLine(std::string("EstMaxTris ") + LLStringOps::getReadableNumber(mAttachmentEstTriangleCount),
+ mText->addLine(std::string("EstMaxTris ") + LLStringOps::getReadableNumber(mAttachmentEstTriangleCount),
info_color, info_style);
- // Attachment Surface Area
- static LLCachedControl<F32> max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 1000.0f);
- info_line = llformat("%.0f m^2", mAttachmentSurfaceArea);
+ // Attachment Surface Area
+ static LLCachedControl<F32> max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 1000.0f);
+ info_line = llformat("%.0f m^2", mAttachmentSurfaceArea);
- if (max_render_cost != 0 && max_attachment_area != 0) // zero means don't care, so don't bother coloring based on this
- {
- green_level = 1.f-llclamp((mAttachmentSurfaceArea-max_attachment_area)/max_attachment_area, 0.f, 1.f);
- red_level = llmin(mAttachmentSurfaceArea/max_attachment_area, 1.f);
- info_color.set(red_level, green_level, 0.0, 1.0);
- info_style = ( mAttachmentSurfaceArea > max_attachment_area
- ? LLFontGL::BOLD : LLFontGL::NORMAL );
+ if (max_render_cost != 0 && max_attachment_area != 0) // zero means don't care, so don't bother coloring based on this
+ {
+ green_level = 1.f-llclamp((mAttachmentSurfaceArea-max_attachment_area)/max_attachment_area, 0.f, 1.f);
+ red_level = llmin(mAttachmentSurfaceArea/max_attachment_area, 1.f);
+ info_color.set(red_level, green_level, 0.0, 1.0);
+ info_style = ( mAttachmentSurfaceArea > max_attachment_area
+ ? LLFontGL::BOLD : LLFontGL::NORMAL );
- }
- else
- {
- info_color.set(LLColor4::grey);
- info_style = LLFontGL::NORMAL;
- }
+ }
+ else
+ {
+ info_color.set(LLColor4::grey);
+ info_style = LLFontGL::NORMAL;
+ }
- mText->addLine(info_line, info_color, info_style);
+ mText->addLine(info_line, info_color, info_style);
- updateText(); // corrects position
- }
+ updateText(); // corrects position
+ }
}
void LLVOAvatar::updateVisualComplexity()
{
- LL_DEBUGS("AvatarRender") << "avatar " << getID() << " appearance changed" << LL_ENDL;
- // Set the cache time to in the past so it's updated ASAP
- mVisualComplexityStale = true;
+ LL_DEBUGS("AvatarRender") << "avatar " << getID() << " appearance changed" << LL_ENDL;
+ // Set the cache time to in the past so it's updated ASAP
+ mVisualComplexityStale = true;
}
@@ -11045,7 +11045,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
* the official viewer for consideration.
*****************************************************************/
if (mVisualComplexityStale)
- {
+ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
static const U32 COMPLEXITY_BODY_PART_COST = 200;
@@ -11056,18 +11056,18 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
// Diagnostic list of all textures on our avatar
static std::unordered_set<const LLViewerTexture*> all_textures;
- U32 cost = VISUAL_COMPLEXITY_UNKNOWN;
- LLVOVolume::texture_cost_t textures;
- hud_complexity_list_t hud_complexity_list;
+ U32 cost = VISUAL_COMPLEXITY_UNKNOWN;
+ LLVOVolume::texture_cost_t textures;
+ hud_complexity_list_t hud_complexity_list;
object_complexity_list_t object_complexity_list;
- for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
- {
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict
- = LLAvatarAppearance::getDictionary()->getBakedTexture((EBakedTextureIndex)baked_index);
- ETextureIndex tex_index = baked_dict->mTextureIndex;
- if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT)))
- {
+ for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
+ {
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict
+ = LLAvatarAppearance::getDictionary()->getBakedTexture((EBakedTextureIndex)baked_index);
+ ETextureIndex tex_index = baked_dict->mTextureIndex;
+ if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT)))
+ {
// Same as isTextureVisible(), but doesn't account for isSelf to ensure identical numbers for all avatars
if (isIndexLocalTexture(tex_index))
{
@@ -11085,14 +11085,14 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
cost += COMPLEXITY_BODY_PART_COST;
}
}
- }
- }
+ }
+ }
LL_DEBUGS("ARCdetail") << "Avatar body parts complexity: " << cost << LL_ENDL;
mAttachmentVisibleTriangleCount = 0;
mAttachmentEstTriangleCount = 0.f;
mAttachmentSurfaceArea = 0.f;
-
+
// A standalone animated object needs to be accounted for
// using its associated volume. Attached animated objects
// will be covered by the subsequent loop over attachments.
@@ -11108,20 +11108,20 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
}
// Account for complexity of all attachments.
- for (attachment_map_t::const_iterator attachment_point = mAttachmentPoints.begin();
- attachment_point != mAttachmentPoints.end();
- ++attachment_point)
- {
- LLViewerJointAttachment* attachment = attachment_point->second;
- for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
- attachment_iter != attachment->mAttachedObjects.end();
- ++attachment_iter)
- {
+ for (attachment_map_t::const_iterator attachment_point = mAttachmentPoints.begin();
+ attachment_point != mAttachmentPoints.end();
+ ++attachment_point)
+ {
+ LLViewerJointAttachment* attachment = attachment_point->second;
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
LLViewerObject* attached_object = attachment_iter->get();
accountRenderComplexityForObject(attached_object, max_attachment_complexity,
textures, cost, hud_complexity_list, object_complexity_list);
- }
- }
+ }
+ }
if ( cost != mVisualComplexity )
{
@@ -11137,8 +11137,8 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
<< " reported " << mReportedVisualComplexity
<< LL_ENDL;
}
- mVisualComplexity = cost;
- mVisualComplexityStale = false;
+ mVisualComplexity = cost;
+ mVisualComplexityStale = false;
static LLCachedControl<U32> show_my_complexity_changes(gSavedSettings, "ShowMyComplexityChanges", 20);
@@ -11152,7 +11152,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
}
//schedule an update to ART next frame if needed
- if (LLPerfStats::tunables.userAutoTuneEnabled &&
+ if (LLPerfStats::tunables.userAutoTuneEnabled &&
LLPerfStats::tunables.userFPSTuningStrategy != LLPerfStats::TUNE_SCENE_ONLY &&
!isVisuallyMuted())
{
@@ -11172,7 +11172,7 @@ void LLVOAvatar::setVisualMuteSettings(VisualMuteSettings set)
{
mVisuallyMuteSetting = set;
mNeedsImpostorUpdate = TRUE;
- mLastImpostorUpdateReason = 7;
+ mLastImpostorUpdateReason = 7;
LLRenderMuteList::getInstance()->saveVisualMuteSetting(getID(), S32(set));
}
@@ -11180,51 +11180,51 @@ void LLVOAvatar::setVisualMuteSettings(VisualMuteSettings set)
void LLVOAvatar::setOverallAppearanceNormal()
{
- if (isControlAvatar())
- return;
+ if (isControlAvatar())
+ return;
LLVector3 pelvis_pos = getJoint("mPelvis")->getPosition();
- resetSkeleton(false);
+ resetSkeleton(false);
getJoint("mPelvis")->setPosition(pelvis_pos);
- for (auto it = mJellyAnims.begin(); it != mJellyAnims.end(); ++it)
- {
- bool is_playing = (mPlayingAnimations.find(*it) != mPlayingAnimations.end());
- LL_DEBUGS("Avatar") << "jelly anim " << *it << " " << is_playing << LL_ENDL;
- if (!is_playing)
- {
- // Anim was not requested for this av by sim, but may be playing locally
- stopMotion(*it);
- }
- }
- mJellyAnims.clear();
+ for (auto it = mJellyAnims.begin(); it != mJellyAnims.end(); ++it)
+ {
+ bool is_playing = (mPlayingAnimations.find(*it) != mPlayingAnimations.end());
+ LL_DEBUGS("Avatar") << "jelly anim " << *it << " " << is_playing << LL_ENDL;
+ if (!is_playing)
+ {
+ // Anim was not requested for this av by sim, but may be playing locally
+ stopMotion(*it);
+ }
+ }
+ mJellyAnims.clear();
- processAnimationStateChanges();
+ processAnimationStateChanges();
}
void LLVOAvatar::setOverallAppearanceJellyDoll()
{
- if (isControlAvatar())
- return;
-
- // stop current animations
- {
- for ( LLVOAvatar::AnimIterator anim_it= mPlayingAnimations.begin();
- anim_it != mPlayingAnimations.end();
- ++anim_it)
- {
- {
- stopMotion(anim_it->first, TRUE);
- }
- }
- }
- processAnimationStateChanges();
-
- // Start any needed anims for jellydoll
- updateOverallAppearanceAnimations();
-
+ if (isControlAvatar())
+ return;
+
+ // stop current animations
+ {
+ for ( LLVOAvatar::AnimIterator anim_it= mPlayingAnimations.begin();
+ anim_it != mPlayingAnimations.end();
+ ++anim_it)
+ {
+ {
+ stopMotion(anim_it->first, TRUE);
+ }
+ }
+ }
+ processAnimationStateChanges();
+
+ // Start any needed anims for jellydoll
+ updateOverallAppearanceAnimations();
+
LLVector3 pelvis_pos = getJoint("mPelvis")->getPosition();
- resetSkeleton(false);
+ resetSkeleton(false);
getJoint("mPelvis")->setPosition(pelvis_pos);
}
@@ -11235,114 +11235,114 @@ void LLVOAvatar::setOverallAppearanceInvisible()
void LLVOAvatar::updateOverallAppearance()
{
- AvatarOverallAppearance new_overall = getOverallAppearance();
- if (new_overall != mOverallAppearance)
- {
- switch (new_overall)
- {
- case AOA_NORMAL:
- setOverallAppearanceNormal();
- break;
- case AOA_JELLYDOLL:
- setOverallAppearanceJellyDoll();
- break;
- case AOA_INVISIBLE:
- setOverallAppearanceInvisible();
- break;
- }
- mOverallAppearance = new_overall;
- if (!isSelf())
- {
- mNeedsImpostorUpdate = TRUE;
- mLastImpostorUpdateReason = 8;
- }
- updateMeshVisibility();
- }
-
- // This needs to be done even if overall appearance has not
- // changed, since sit/stand status can be different.
- updateOverallAppearanceAnimations();
+ AvatarOverallAppearance new_overall = getOverallAppearance();
+ if (new_overall != mOverallAppearance)
+ {
+ switch (new_overall)
+ {
+ case AOA_NORMAL:
+ setOverallAppearanceNormal();
+ break;
+ case AOA_JELLYDOLL:
+ setOverallAppearanceJellyDoll();
+ break;
+ case AOA_INVISIBLE:
+ setOverallAppearanceInvisible();
+ break;
+ }
+ mOverallAppearance = new_overall;
+ if (!isSelf())
+ {
+ mNeedsImpostorUpdate = TRUE;
+ mLastImpostorUpdateReason = 8;
+ }
+ updateMeshVisibility();
+ }
+
+ // This needs to be done even if overall appearance has not
+ // changed, since sit/stand status can be different.
+ updateOverallAppearanceAnimations();
}
void LLVOAvatar::updateOverallAppearanceAnimations()
{
- if (isControlAvatar())
- return;
-
- if (getOverallAppearance() == AOA_JELLYDOLL)
- {
- LLUUID motion_id;
- if (isSitting() && getParent()) // sitting on object
- {
- motion_id = ANIM_AGENT_SIT_FEMALE;
- }
- else if (isSitting()) // sitting on ground
- {
- motion_id = ANIM_AGENT_SIT_GROUND_CONSTRAINED;
- }
- else // standing
- {
- motion_id = ANIM_AGENT_STAND;
- }
- if (mJellyAnims.find(motion_id) == mJellyAnims.end())
- {
- for (auto it = mJellyAnims.begin(); it != mJellyAnims.end(); ++it)
- {
- bool is_playing = (mPlayingAnimations.find(*it) != mPlayingAnimations.end());
- LL_DEBUGS("Avatar") << "jelly anim " << *it << " " << is_playing << LL_ENDL;
- if (!is_playing)
- {
- // Anim was not requested for this av by sim, but may be playing locally
- stopMotion(*it, TRUE);
- }
- }
- mJellyAnims.clear();
-
- startMotion(motion_id);
- mJellyAnims.insert(motion_id);
-
- processAnimationStateChanges();
- }
- }
+ if (isControlAvatar())
+ return;
+
+ if (getOverallAppearance() == AOA_JELLYDOLL)
+ {
+ LLUUID motion_id;
+ if (isSitting() && getParent()) // sitting on object
+ {
+ motion_id = ANIM_AGENT_SIT_FEMALE;
+ }
+ else if (isSitting()) // sitting on ground
+ {
+ motion_id = ANIM_AGENT_SIT_GROUND_CONSTRAINED;
+ }
+ else // standing
+ {
+ motion_id = ANIM_AGENT_STAND;
+ }
+ if (mJellyAnims.find(motion_id) == mJellyAnims.end())
+ {
+ for (auto it = mJellyAnims.begin(); it != mJellyAnims.end(); ++it)
+ {
+ bool is_playing = (mPlayingAnimations.find(*it) != mPlayingAnimations.end());
+ LL_DEBUGS("Avatar") << "jelly anim " << *it << " " << is_playing << LL_ENDL;
+ if (!is_playing)
+ {
+ // Anim was not requested for this av by sim, but may be playing locally
+ stopMotion(*it, TRUE);
+ }
+ }
+ mJellyAnims.clear();
+
+ startMotion(motion_id);
+ mJellyAnims.insert(motion_id);
+
+ processAnimationStateChanges();
+ }
+ }
}
// Based on isVisuallyMuted(), but has 3 possible results.
LLVOAvatar::AvatarOverallAppearance LLVOAvatar::getOverallAppearance() const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- AvatarOverallAppearance result = AOA_NORMAL;
-
- // Priority order (highest priority first)
- // * own avatar is always drawn normally
- // * if on the "always draw normally" list, draw them normally
- // * if on the "always visually mute" list, show as jellydoll
- // * if explicitly muted (blocked), show as invisible
- // * check against the render cost and attachment limits - if too complex, show as jellydoll
- if (isSelf())
- {
- result = AOA_NORMAL;
- }
- else // !isSelf()
- {
- if (isInMuteList())
- {
- result = AOA_INVISIBLE;
- }
- else if (mVisuallyMuteSetting == AV_ALWAYS_RENDER)
- {
- result = AOA_NORMAL;
- }
- else if (mVisuallyMuteSetting == AV_DO_NOT_RENDER)
- { // Always want to see this AV as an impostor
- result = AOA_JELLYDOLL;
- }
- else if (isTooComplex() || isTooSlow())
- {
- result = AOA_JELLYDOLL;
- }
- }
-
- return result;
+ AvatarOverallAppearance result = AOA_NORMAL;
+
+ // Priority order (highest priority first)
+ // * own avatar is always drawn normally
+ // * if on the "always draw normally" list, draw them normally
+ // * if on the "always visually mute" list, show as jellydoll
+ // * if explicitly muted (blocked), show as invisible
+ // * check against the render cost and attachment limits - if too complex, show as jellydoll
+ if (isSelf())
+ {
+ result = AOA_NORMAL;
+ }
+ else // !isSelf()
+ {
+ if (isInMuteList())
+ {
+ result = AOA_INVISIBLE;
+ }
+ else if (mVisuallyMuteSetting == AV_ALWAYS_RENDER)
+ {
+ result = AOA_NORMAL;
+ }
+ else if (mVisuallyMuteSetting == AV_DO_NOT_RENDER)
+ { // Always want to see this AV as an impostor
+ result = AOA_JELLYDOLL;
+ }
+ else if (isTooComplex() || isTooSlow())
+ {
+ result = AOA_JELLYDOLL;
+ }
+ }
+
+ return result;
}
void LLVOAvatar::calcMutedAVColor()
@@ -11370,7 +11370,7 @@ void LLVOAvatar::calcMutedAVColor()
}
#ifdef COLORIZE_JELLYDOLLS
else if ( mMutedAVColor == LLColor4::white || mMutedAVColor == LLColor4::grey3 || mMutedAVColor == LLColor4::grey4 )
- {
+ {
// select a color based on the first byte of the agents uuid so any muted agent is always the same color
F32 color_value = (F32) (av_id.mData[0]);
F32 spectrum = (color_value / 256.0); // spectrum is between 0 and 1.f
@@ -11386,17 +11386,17 @@ void LLVOAvatar::calcMutedAVColor()
F32 fractBetween = spectrum - (F32)(spectrum_index_1); // distance between the two indexes (0-1)
new_color = lerp(*spectrum_color[spectrum_index_1], *spectrum_color[spectrum_index_2], fractBetween);
- new_color.normalize();
+ new_color.normalize();
new_color *= 0.28f; // Tone it down
- }
+ }
#endif
else
{
- new_color = LLColor4::grey4;
+ new_color = LLColor4::grey4;
change_msg = " over limit color ";
}
- if (mMutedAVColor != new_color)
+ if (mMutedAVColor != new_color)
{
LL_DEBUGS("AvatarRender") << "avatar "<< av_id << change_msg << std::setprecision(3) << new_color << LL_ENDL;
mMutedAVColor = new_color;
@@ -11406,40 +11406,40 @@ void LLVOAvatar::calcMutedAVColor()
// static
BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index)
{
- return (index < 0 || index >= TEX_NUM_INDICES)
- ? false
- : LLAvatarAppearance::getDictionary()->getTexture(index)->mIsLocalTexture;
+ return (index < 0 || index >= TEX_NUM_INDICES)
+ ? false
+ : LLAvatarAppearance::getDictionary()->getTexture(index)->mIsLocalTexture;
}
// static
BOOL LLVOAvatar::isIndexBakedTexture(ETextureIndex index)
{
- return (index < 0 || index >= TEX_NUM_INDICES)
- ? false
- : LLAvatarAppearance::getDictionary()->getTexture(index)->mIsBakedTexture;
+ return (index < 0 || index >= TEX_NUM_INDICES)
+ ? false
+ : LLAvatarAppearance::getDictionary()->getTexture(index)->mIsBakedTexture;
}
const std::string LLVOAvatar::getBakedStatusForPrintout() const
{
- std::string line;
+ std::string line;
- for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
- iter != LLAvatarAppearance::getDictionary()->getTextures().end();
- ++iter)
- {
- const ETextureIndex index = iter->first;
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
- if (texture_dict->mIsBakedTexture)
- {
- line += texture_dict->mName;
- if (isTextureDefined(index))
- {
- line += "_baked";
- }
- line += " ";
- }
- }
- return line;
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
+ iter != LLAvatarAppearance::getDictionary()->getTextures().end();
+ ++iter)
+ {
+ const ETextureIndex index = iter->first;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
+ if (texture_dict->mIsBakedTexture)
+ {
+ line += texture_dict->mName;
+ if (isTextureDefined(index))
+ {
+ line += "_baked";
+ }
+ line += " ";
+ }
+ }
+ return line;
}
@@ -11447,7 +11447,7 @@ const std::string LLVOAvatar::getBakedStatusForPrintout() const
//virtual
S32 LLVOAvatar::getTexImageSize() const
{
- return TEX_IMAGE_SIZE_OTHER;
+ return TEX_IMAGE_SIZE_OTHER;
}
//-----------------------------------------------------------------------------
@@ -11456,48 +11456,48 @@ S32 LLVOAvatar::getTexImageSize() const
F32 calc_bouncy_animation(F32 x)
{
- return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f;
+ return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f;
}
//virtual
BOOL LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index ) const
{
- if (isIndexLocalTexture(te))
- {
- return FALSE;
- }
-
- if( !getImage( te, index ) )
- {
- LL_WARNS() << "getImage( " << te << ", " << index << " ) returned 0" << LL_ENDL;
- return FALSE;
- }
+ if (isIndexLocalTexture(te))
+ {
+ return FALSE;
+ }
+
+ if( !getImage( te, index ) )
+ {
+ LL_WARNS() << "getImage( " << te << ", " << index << " ) returned 0" << LL_ENDL;
+ return FALSE;
+ }
- return (getImage(te, index)->getID() != IMG_DEFAULT_AVATAR &&
- getImage(te, index)->getID() != IMG_DEFAULT);
+ return (getImage(te, index)->getID() != IMG_DEFAULT_AVATAR &&
+ getImage(te, index)->getID() != IMG_DEFAULT);
}
//virtual
BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
- if (isIndexLocalTexture(type))
- {
- return isTextureDefined(type, index);
- }
- else
- {
- // baked textures can use TE images directly
- return ((isTextureDefined(type) || isSelf())
- && (getTEImage(type)->getID() != IMG_INVISIBLE
- || LLDrawPoolAlpha::sShowDebugAlpha));
- }
+ if (isIndexLocalTexture(type))
+ {
+ return isTextureDefined(type, index);
+ }
+ else
+ {
+ // baked textures can use TE images directly
+ return ((isTextureDefined(type) || isSelf())
+ && (getTEImage(type)->getID() != IMG_INVISIBLE
+ || LLDrawPoolAlpha::sShowDebugAlpha));
+ }
}
//virtual
BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const
{
- // non-self avatars don't have wearables
- return FALSE;
+ // non-self avatars don't have wearables
+ return FALSE;
}
void LLVOAvatar::placeProfileQuery()
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 4bb0c8aa73..c14784cc6d 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,7 +48,7 @@
#include "lltexglobalcolor.h"
#include "lldriverparam.h"
#include "llviewertexlayer.h"
-#include "material_codes.h" // LL_MCODE_END
+#include "material_codes.h" // LL_MCODE_END
#include "llrigginginfo.h"
#include "llviewerstats.h"
#include "llvovolume.h"
@@ -82,19 +82,19 @@ extern U32 gFrameCount;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLVOAvatar
-//
+//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLVOAvatar :
- public LLAvatarAppearance,
- public LLViewerObject,
- public boost::signals2::trackable
+ public LLAvatarAppearance,
+ public LLViewerObject,
+ public boost::signals2::trackable
{
LL_ALIGN_NEW;
- LOG_CLASS(LLVOAvatar);
+ LOG_CLASS(LLVOAvatar);
public:
- friend class LLVOAvatarSelf;
- friend class LLAvatarCheckImpostorMode;
+ friend class LLVOAvatarSelf;
+ friend class LLAvatarCheckImpostorMode;
/********************************************************************************
** **
@@ -102,13 +102,13 @@ public:
**/
public:
- LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
- virtual void markDead();
- static void initClass(); // Initialize data that's only init'd once per class.
- static void cleanupClass(); // Cleanup data that's only init'd once per class.
- virtual void initInstance(); // Called after construction to initialize the class.
+ LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+ virtual void markDead();
+ static void initClass(); // Initialize data that's only init'd once per class.
+ static void cleanupClass(); // Cleanup data that's only init'd once per class.
+ virtual void initInstance(); // Called after construction to initialize the class.
protected:
- virtual ~LLVOAvatar();
+ virtual ~LLVOAvatar();
/** Initialization
** **
@@ -119,125 +119,125 @@ protected:
** INHERITED
**/
- //--------------------------------------------------------------------
- // LLViewerObject interface and related
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // LLViewerObject interface and related
+ //--------------------------------------------------------------------
public:
- /*virtual*/ void updateGL();
- /*virtual*/ LLVOAvatar* asAvatar();
-
- virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num,
- const EObjectUpdateType update_type,
- LLDataPacker *dp);
- virtual void idleUpdate(LLAgent &agent, const F64 &time);
- /*virtual*/ BOOL updateLOD();
- BOOL updateJointLODs();
- void updateLODRiggedAttachments( void );
- /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
- S32Bytes totalTextureMemForUUIDS(std::set<LLUUID>& ids);
- bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const;
- bool allLocalTexturesCompletelyDownloaded() const;
- bool allBakedTexturesCompletelyDownloaded() const;
- void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count,
- S32 &both_count, S32 &neither_count);
- std::string bakedTextureOriginInfo();
- void collectLocalTextureUUIDs(std::set<LLUUID>& ids) const;
- void collectBakedTextureUUIDs(std::set<LLUUID>& ids) const;
- void collectTextureUUIDs(std::set<LLUUID>& ids);
- void releaseOldTextures();
- /*virtual*/ void updateTextures();
- LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid);
- /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim.
- /*virtual*/ void onShift(const LLVector4a& shift_vector);
- /*virtual*/ U32 getPartitionType() const;
- /*virtual*/ const LLVector3 getRenderPosition() const;
- /*virtual*/ void updateDrawable(BOOL force_damped);
- /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
- /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent);
- /*virtual*/ void updateRegion(LLViewerRegion *regionp);
- /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax);
- void calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
- /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face = -1, // which face to check, -1 = ALL_SIDES
- BOOL pick_transparent = FALSE,
- BOOL pick_rigged = FALSE,
+ /*virtual*/ void updateGL();
+ /*virtual*/ LLVOAvatar* asAvatar();
+
+ virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
+ void **user_data,
+ U32 block_num,
+ const EObjectUpdateType update_type,
+ LLDataPacker *dp);
+ virtual void idleUpdate(LLAgent &agent, const F64 &time);
+ /*virtual*/ BOOL updateLOD();
+ BOOL updateJointLODs();
+ void updateLODRiggedAttachments( void );
+ /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
+ S32Bytes totalTextureMemForUUIDS(std::set<LLUUID>& ids);
+ bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const;
+ bool allLocalTexturesCompletelyDownloaded() const;
+ bool allBakedTexturesCompletelyDownloaded() const;
+ void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count,
+ S32 &both_count, S32 &neither_count);
+ std::string bakedTextureOriginInfo();
+ void collectLocalTextureUUIDs(std::set<LLUUID>& ids) const;
+ void collectBakedTextureUUIDs(std::set<LLUUID>& ids) const;
+ void collectTextureUUIDs(std::set<LLUUID>& ids);
+ void releaseOldTextures();
+ /*virtual*/ void updateTextures();
+ LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid);
+ /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim.
+ /*virtual*/ void onShift(const LLVector4a& shift_vector);
+ /*virtual*/ U32 getPartitionType() const;
+ /*virtual*/ const LLVector3 getRenderPosition() const;
+ /*virtual*/ void updateDrawable(BOOL force_damped);
+ /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
+ /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
+ /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent);
+ /*virtual*/ void updateRegion(LLViewerRegion *regionp);
+ /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax);
+ void calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
+ /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
+ S32 face = -1, // which face to check, -1 = ALL_SIDES
+ BOOL pick_transparent = FALSE,
+ BOOL pick_rigged = FALSE,
BOOL pick_unselectable = TRUE,
- S32* face_hit = NULL, // which face was hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL); // return the surface tangent at the intersection point
- virtual LLViewerObject* lineSegmentIntersectRiggedAttachments(
+ S32* face_hit = NULL, // which face was hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL); // return the surface tangent at the intersection point
+ virtual LLViewerObject* lineSegmentIntersectRiggedAttachments(
const LLVector4a& start, const LLVector4a& end,
- S32 face = -1, // which face to check, -1 = ALL_SIDES
- BOOL pick_transparent = FALSE,
- BOOL pick_rigged = FALSE,
+ S32 face = -1, // which face to check, -1 = ALL_SIDES
+ BOOL pick_transparent = FALSE,
+ BOOL pick_rigged = FALSE,
BOOL pick_unselectable = TRUE,
- S32* face_hit = NULL, // which face was hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL); // return the surface tangent at the intersection point
-
- //--------------------------------------------------------------------
- // LLCharacter interface and related
- //--------------------------------------------------------------------
+ S32* face_hit = NULL, // which face was hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL); // return the surface tangent at the intersection point
+
+ //--------------------------------------------------------------------
+ // LLCharacter interface and related
+ //--------------------------------------------------------------------
public:
- /*virtual*/ LLVector3 getCharacterPosition();
- /*virtual*/ LLQuaternion getCharacterRotation();
- /*virtual*/ LLVector3 getCharacterVelocity();
- /*virtual*/ LLVector3 getCharacterAngularVelocity();
-
- /*virtual*/ LLUUID remapMotionID(const LLUUID& id);
- /*virtual*/ BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
- /*virtual*/ BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE);
- virtual bool hasMotionFromSource(const LLUUID& source_id);
- virtual void stopMotionFromSource(const LLUUID& source_id);
- virtual void requestStopMotion(LLMotion* motion);
- LLMotion* findMotion(const LLUUID& id) const;
- void startDefaultMotions();
- void dumpAnimationState();
-
- virtual LLJoint* getJoint(const std::string &name);
- LLJoint* getJoint(S32 num);
+ /*virtual*/ LLVector3 getCharacterPosition();
+ /*virtual*/ LLQuaternion getCharacterRotation();
+ /*virtual*/ LLVector3 getCharacterVelocity();
+ /*virtual*/ LLVector3 getCharacterAngularVelocity();
+
+ /*virtual*/ LLUUID remapMotionID(const LLUUID& id);
+ /*virtual*/ BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
+ /*virtual*/ BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE);
+ virtual bool hasMotionFromSource(const LLUUID& source_id);
+ virtual void stopMotionFromSource(const LLUUID& source_id);
+ virtual void requestStopMotion(LLMotion* motion);
+ LLMotion* findMotion(const LLUUID& id) const;
+ void startDefaultMotions();
+ void dumpAnimationState();
+
+ virtual LLJoint* getJoint(const std::string &name);
+ LLJoint* getJoint(S32 num);
//if you KNOW joint_num is a valid animated joint index, use getSkeletonJoint for efficiency
inline LLJoint* getSkeletonJoint(S32 joint_num) { return mSkeleton[joint_num]; }
inline size_t getSkeletonJointCount() const { return mSkeleton.size(); }
- void notifyAttachmentMeshLoaded();
- void addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LLUUID>* meshes_seen = NULL, bool recursive = true);
- void removeAttachmentOverridesForObject(const LLUUID& mesh_id);
- void removeAttachmentOverridesForObject(LLViewerObject *vo);
- bool jointIsRiggedTo(const LLJoint *joint) const;
- void clearAttachmentOverrides();
- void rebuildAttachmentOverrides();
- void updateAttachmentOverrides();
+ void notifyAttachmentMeshLoaded();
+ void addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LLUUID>* meshes_seen = NULL, bool recursive = true);
+ void removeAttachmentOverridesForObject(const LLUUID& mesh_id);
+ void removeAttachmentOverridesForObject(LLViewerObject *vo);
+ bool jointIsRiggedTo(const LLJoint *joint) const;
+ void clearAttachmentOverrides();
+ void rebuildAttachmentOverrides();
+ void updateAttachmentOverrides();
void showAttachmentOverrides(bool verbose = false) const;
- void getAttachmentOverrideNames(std::set<std::string>& pos_names,
+ void getAttachmentOverrideNames(std::set<std::string>& pos_names,
std::set<std::string>& scale_names) const;
- void getAssociatedVolumes(std::vector<LLVOVolume*>& volumes);
+ void getAssociatedVolumes(std::vector<LLVOVolume*>& volumes);
// virtual
- void updateRiggingInfo();
- // This encodes mesh id and LOD, so we can see whether display is up-to-date.
- std::map<LLUUID,S32> mLastRiggingInfoKey;
-
- std::set<LLUUID> mActiveOverrideMeshes;
- virtual void onActiveOverrideMeshesChanged();
-
- /*virtual*/ const LLUUID& getID() const;
- /*virtual*/ void addDebugText(const std::string& text);
- /*virtual*/ F32 getTimeDilation();
- /*virtual*/ void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
- /*virtual*/ F32 getPixelArea() const;
- /*virtual*/ LLVector3d getPosGlobalFromAgent(const LLVector3 &position);
- /*virtual*/ LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
- virtual void updateVisualParams();
+ void updateRiggingInfo();
+ // This encodes mesh id and LOD, so we can see whether display is up-to-date.
+ std::map<LLUUID,S32> mLastRiggingInfoKey;
+
+ std::set<LLUUID> mActiveOverrideMeshes;
+ virtual void onActiveOverrideMeshesChanged();
+
+ /*virtual*/ const LLUUID& getID() const;
+ /*virtual*/ void addDebugText(const std::string& text);
+ /*virtual*/ F32 getTimeDilation();
+ /*virtual*/ void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
+ /*virtual*/ F32 getPixelArea() const;
+ /*virtual*/ LLVector3d getPosGlobalFromAgent(const LLVector3 &position);
+ /*virtual*/ LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
+ virtual void updateVisualParams();
/** Inherited
** **
@@ -249,61 +249,61 @@ public:
**/
public:
- virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
+ virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
- virtual bool isControlAvatar() const { return mIsControlAvatar; } // True if this avatar is a control av (no associated user)
- virtual bool isUIAvatar() const { return mIsUIAvatar; } // True if this avatar is a supplemental av used in some UI views (no associated user)
+ virtual bool isControlAvatar() const { return mIsControlAvatar; } // True if this avatar is a control av (no associated user)
+ virtual bool isUIAvatar() const { return mIsUIAvatar; } // True if this avatar is a supplemental av used in some UI views (no associated user)
- // If this is an attachment, return the avatar it is attached to. Otherwise NULL.
- virtual const LLVOAvatar *getAttachedAvatar() const { return NULL; }
- virtual LLVOAvatar *getAttachedAvatar() { return NULL; }
+ // If this is an attachment, return the avatar it is attached to. Otherwise NULL.
+ virtual const LLVOAvatar *getAttachedAvatar() const { return NULL; }
+ virtual LLVOAvatar *getAttachedAvatar() { return NULL; }
private: //aligned members
- LL_ALIGN_16(LLVector4a mImpostorExtents[2]);
+ LL_ALIGN_16(LLVector4a mImpostorExtents[2]);
- //--------------------------------------------------------------------
- // Updates
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Updates
+ //--------------------------------------------------------------------
public:
- void updateAppearanceMessageDebugText();
- void updateAnimationDebugText();
- virtual void updateDebugText();
- virtual bool computeNeedsUpdate();
- virtual bool updateCharacter(LLAgent &agent);
- void updateFootstepSounds();
- void computeUpdatePeriod();
- void updateOrientation(LLAgent &agent, F32 speed, F32 delta_time);
- void updateTimeStep();
- void updateRootPositionAndRotation(LLAgent &agent, F32 speed, bool was_sit_ground_constrained);
-
- void idleUpdateVoiceVisualizer(bool voice_enabled, const LLVector3 &position);
- void idleUpdateMisc(bool detailed_update);
- virtual void idleUpdateAppearanceAnimation();
- void idleUpdateLipSync(bool voice_enabled);
- void idleUpdateLoadingEffect();
- void idleUpdateWindEffect();
- void idleUpdateNameTag(const LLVector3& root_pos_last);
- void idleUpdateNameTagText(bool new_name);
- void idleUpdateNameTagAlpha(bool new_name, F32 alpha);
- LLColor4 getNameTagColor(bool is_friend);
- void clearNameTag();
- static void invalidateNameTag(const LLUUID& agent_id);
- // force all name tags to rebuild, useful when display names turned on/off
- static void invalidateNameTags();
- void addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font, const bool use_ellipses = false);
- void idleUpdateRenderComplexity();
- void idleUpdateDebugInfo();
- void accountRenderComplexityForObject(LLViewerObject *attached_object,
+ void updateAppearanceMessageDebugText();
+ void updateAnimationDebugText();
+ virtual void updateDebugText();
+ virtual bool computeNeedsUpdate();
+ virtual bool updateCharacter(LLAgent &agent);
+ void updateFootstepSounds();
+ void computeUpdatePeriod();
+ void updateOrientation(LLAgent &agent, F32 speed, F32 delta_time);
+ void updateTimeStep();
+ void updateRootPositionAndRotation(LLAgent &agent, F32 speed, bool was_sit_ground_constrained);
+
+ void idleUpdateVoiceVisualizer(bool voice_enabled, const LLVector3 &position);
+ void idleUpdateMisc(bool detailed_update);
+ virtual void idleUpdateAppearanceAnimation();
+ void idleUpdateLipSync(bool voice_enabled);
+ void idleUpdateLoadingEffect();
+ void idleUpdateWindEffect();
+ void idleUpdateNameTag(const LLVector3& root_pos_last);
+ void idleUpdateNameTagText(bool new_name);
+ void idleUpdateNameTagAlpha(bool new_name, F32 alpha);
+ LLColor4 getNameTagColor(bool is_friend);
+ void clearNameTag();
+ static void invalidateNameTag(const LLUUID& agent_id);
+ // force all name tags to rebuild, useful when display names turned on/off
+ static void invalidateNameTags();
+ void addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font, const bool use_ellipses = false);
+ void idleUpdateRenderComplexity();
+ void idleUpdateDebugInfo();
+ void accountRenderComplexityForObject(LLViewerObject *attached_object,
const F32 max_attachment_complexity,
LLVOVolume::texture_cost_t& textures,
U32& cost,
hud_complexity_list_t& hud_complexity_list,
object_complexity_list_t& object_complexity_list);
- void calculateUpdateRenderComplexity();
- static const U32 VISUAL_COMPLEXITY_UNKNOWN;
- void updateVisualComplexity();
-
+ void calculateUpdateRenderComplexity();
+ static const U32 VISUAL_COMPLEXITY_UNKNOWN;
+ void updateVisualComplexity();
+
void placeProfileQuery();
void readProfileQuery(S32 retries);
@@ -325,126 +325,126 @@ public:
// return 0.f if this avatar has not been profiled using gPipeline.mProfileAvatar
F32 getCPURenderTime() { return mCPURenderTime; }
-
+
// avatar render cost
- U32 getVisualComplexity() { return mVisualComplexity; };
+ U32 getVisualComplexity() { return mVisualComplexity; };
// surface area calculation
- F32 getAttachmentSurfaceArea() { return mAttachmentSurfaceArea; };
+ F32 getAttachmentSurfaceArea() { return mAttachmentSurfaceArea; };
+
+ U32 getReportedVisualComplexity() { return mReportedVisualComplexity; }; // Numbers as reported by the SL server
+ void setReportedVisualComplexity(U32 value) { mReportedVisualComplexity = value; };
- U32 getReportedVisualComplexity() { return mReportedVisualComplexity; }; // Numbers as reported by the SL server
- void setReportedVisualComplexity(U32 value) { mReportedVisualComplexity = value; };
-
- S32 getUpdatePeriod() { return mUpdatePeriod; };
- const LLColor4 & getMutedAVColor() { return mMutedAVColor; };
- static void updateImpostorRendering(U32 newMaxNonImpostorsValue);
+ S32 getUpdatePeriod() { return mUpdatePeriod; };
+ const LLColor4 & getMutedAVColor() { return mMutedAVColor; };
+ static void updateImpostorRendering(U32 newMaxNonImpostorsValue);
- void idleUpdateBelowWater();
+ void idleUpdateBelowWater();
- static void updateNearbyAvatarCount();
+ static void updateNearbyAvatarCount();
LLVector3 idleCalcNameTagPosition(const LLVector3 &root_pos_last);
- //--------------------------------------------------------------------
- // Static preferences (controlled by user settings/menus)
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Static preferences (controlled by user settings/menus)
+ //--------------------------------------------------------------------
public:
- static S32 sRenderName;
- static BOOL sRenderGroupTitles;
- static const U32 NON_IMPOSTORS_MAX_SLIDER; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors
- * slider in panel_preferences_graphics1.xml */
- static U32 sMaxNonImpostors; // affected by control "RenderAvatarMaxNonImpostors"
- static bool sLimitNonImpostors; // use impostors for far away avatars
- static F32 sRenderDistance; // distance at which avatars will render.
- static BOOL sShowAnimationDebug; // show animation debug info
- static BOOL sShowCollisionVolumes; // show skeletal collision volumes
- static BOOL sVisibleInFirstPerson;
- static S32 sNumLODChangesThisFrame;
- static S32 sNumVisibleChatBubbles;
- static BOOL sDebugInvisible;
- static BOOL sShowAttachmentPoints;
- static F32 sLODFactor; // user-settable LOD factor
- static F32 sPhysicsLODFactor; // user-settable physics LOD factor
- static BOOL sJointDebug; // output total number of joints being touched for each avatar
+ static S32 sRenderName;
+ static BOOL sRenderGroupTitles;
+ static const U32 NON_IMPOSTORS_MAX_SLIDER; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors
+ * slider in panel_preferences_graphics1.xml */
+ static U32 sMaxNonImpostors; // affected by control "RenderAvatarMaxNonImpostors"
+ static bool sLimitNonImpostors; // use impostors for far away avatars
+ static F32 sRenderDistance; // distance at which avatars will render.
+ static BOOL sShowAnimationDebug; // show animation debug info
+ static BOOL sShowCollisionVolumes; // show skeletal collision volumes
+ static BOOL sVisibleInFirstPerson;
+ static S32 sNumLODChangesThisFrame;
+ static S32 sNumVisibleChatBubbles;
+ static BOOL sDebugInvisible;
+ static BOOL sShowAttachmentPoints;
+ static F32 sLODFactor; // user-settable LOD factor
+ static F32 sPhysicsLODFactor; // user-settable physics LOD factor
+ static BOOL sJointDebug; // output total number of joints being touched for each avatar
static LLPointer<LLViewerTexture> sCloudTexture;
- static std::vector<LLUUID> sAVsIgnoringARTLimit;
+ static std::vector<LLUUID> sAVsIgnoringARTLimit;
static S32 sAvatarsNearby;
- //--------------------------------------------------------------------
- // Region state
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Region state
+ //--------------------------------------------------------------------
public:
- LLHost getObjectHost() const;
+ LLHost getObjectHost() const;
- //--------------------------------------------------------------------
- // Loading state
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Loading state
+ //--------------------------------------------------------------------
public:
- BOOL isFullyLoaded() const;
+ BOOL isFullyLoaded() const;
// check and return current state relative to limits
// default will test only the geometry (combined=false).
// this allows us to disable shadows separately on complex avatars.
- inline bool isTooSlowWithoutShadows() const {return mTooSlowWithoutShadows;};
- bool isTooSlow() const;
+ inline bool isTooSlowWithoutShadows() const {return mTooSlowWithoutShadows;};
+ bool isTooSlow() const;
- void updateTooSlow();
+ void updateTooSlow();
- bool isTooComplex() const;
- bool visualParamWeightsAreDefault();
- virtual bool getIsCloud() const;
- BOOL isFullyTextured() const;
- BOOL hasGray() const;
- S32 getRezzedStatus() const; // 0 = cloud, 1 = gray, 2 = textured, 3 = textured and fully downloaded.
- void updateRezzedStatusTimers(S32 status);
+ bool isTooComplex() const;
+ bool visualParamWeightsAreDefault();
+ virtual bool getIsCloud() const;
+ BOOL isFullyTextured() const;
+ BOOL hasGray() const;
+ S32 getRezzedStatus() const; // 0 = cloud, 1 = gray, 2 = textured, 3 = textured and fully downloaded.
+ void updateRezzedStatusTimers(S32 status);
- S32 mLastRezzedStatus;
+ S32 mLastRezzedStatus;
-
- void startPhase(const std::string& phase_name);
- void stopPhase(const std::string& phase_name, bool err_check = true);
- void clearPhases();
- void logPendingPhases();
- static void logPendingPhasesAllAvatars();
- void logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed);
+
+ void startPhase(const std::string& phase_name);
+ void stopPhase(const std::string& phase_name, bool err_check = true);
+ void clearPhases();
+ void logPendingPhases();
+ static void logPendingPhasesAllAvatars();
+ void logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed);
void calcMutedAVColor();
-
+
protected:
- LLViewerStats::PhaseMap& getPhases() { return mPhases; }
- BOOL updateIsFullyLoaded();
- BOOL processFullyLoadedChange(bool loading);
- void updateRuthTimer(bool loading);
- F32 calcMorphAmount();
+ LLViewerStats::PhaseMap& getPhases() { return mPhases; }
+ BOOL updateIsFullyLoaded();
+ BOOL processFullyLoadedChange(bool loading);
+ void updateRuthTimer(bool loading);
+ F32 calcMorphAmount();
private:
- BOOL mFirstFullyVisible;
- F32 mFirstUseDelaySeconds;
- LLFrameTimer mFirstAppearanceMessageTimer;
-
- BOOL mFullyLoaded;
- BOOL mPreviousFullyLoaded;
- BOOL mFullyLoadedInitialized;
- S32 mFullyLoadedFrameCounter;
- LLColor4 mMutedAVColor;
- LLFrameTimer mFullyLoadedTimer;
- LLFrameTimer mRuthTimer;
+ BOOL mFirstFullyVisible;
+ F32 mFirstUseDelaySeconds;
+ LLFrameTimer mFirstAppearanceMessageTimer;
+
+ BOOL mFullyLoaded;
+ BOOL mPreviousFullyLoaded;
+ BOOL mFullyLoadedInitialized;
+ S32 mFullyLoadedFrameCounter;
+ LLColor4 mMutedAVColor;
+ LLFrameTimer mFullyLoadedTimer;
+ LLFrameTimer mRuthTimer;
// variables to hold "slowness" status
- bool mTooSlow{false};
- bool mTooSlowWithoutShadows{false};
+ bool mTooSlow{false};
+ bool mTooSlowWithoutShadows{false};
bool mTuned{false};
private:
- LLViewerStats::PhaseMap mPhases;
+ LLViewerStats::PhaseMap mPhases;
protected:
- LLFrameTimer mInvisibleTimer;
-
+ LLFrameTimer mInvisibleTimer;
+
/** State
** **
*******************************************************************************/
@@ -454,25 +454,25 @@ protected:
**/
protected:
- /*virtual*/ LLAvatarJoint* createAvatarJoint(); // Returns LLViewerJoint
- /*virtual*/ LLAvatarJoint* createAvatarJoint(S32 joint_num); // Returns LLViewerJoint
- /*virtual*/ LLAvatarJointMesh* createAvatarJointMesh(); // Returns LLViewerJointMesh
+ /*virtual*/ LLAvatarJoint* createAvatarJoint(); // Returns LLViewerJoint
+ /*virtual*/ LLAvatarJoint* createAvatarJoint(S32 joint_num); // Returns LLViewerJoint
+ /*virtual*/ LLAvatarJointMesh* createAvatarJointMesh(); // Returns LLViewerJointMesh
public:
- void updateHeadOffset();
- void debugBodySize() const;
- void postPelvisSetRecalc( void );
+ void updateHeadOffset();
+ void debugBodySize() const;
+ void postPelvisSetRecalc( void );
- /*virtual*/ BOOL loadSkeletonNode();
+ /*virtual*/ BOOL loadSkeletonNode();
void initAttachmentPoints(bool ignore_hud_joints = false);
- /*virtual*/ void buildCharacter();
+ /*virtual*/ void buildCharacter();
void resetVisualParams();
- void applyDefaultParams();
- void resetSkeleton(bool reset_animations);
+ void applyDefaultParams();
+ void resetSkeleton(bool reset_animations);
- LLVector3 mCurRootToHeadOffset;
- LLVector3 mTargetRootToHeadOffset;
+ LLVector3 mCurRootToHeadOffset;
+ LLVector3 mTargetRootToHeadOffset;
- S32 mLastSkeletonSerialNum;
+ S32 mLastSkeletonSerialNum;
/** Skeleton
@@ -485,76 +485,76 @@ public:
**/
public:
- U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0);
- bool isVisuallyMuted();
- bool isInMuteList() const;
- void forceUpdateVisualMuteSettings();
-
- // Visual Mute Setting is an input. Does not necessarily determine
- // what the avatar looks like, because it interacts with other
- // settings like muting, complexity threshold. Should be private or protected.
- enum VisualMuteSettings
- {
- AV_RENDER_NORMALLY = 0,
- AV_DO_NOT_RENDER = 1,
- AV_ALWAYS_RENDER = 2
- };
- void setVisualMuteSettings(VisualMuteSettings set);
+ U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0);
+ bool isVisuallyMuted();
+ bool isInMuteList() const;
+ void forceUpdateVisualMuteSettings();
+
+ // Visual Mute Setting is an input. Does not necessarily determine
+ // what the avatar looks like, because it interacts with other
+ // settings like muting, complexity threshold. Should be private or protected.
+ enum VisualMuteSettings
+ {
+ AV_RENDER_NORMALLY = 0,
+ AV_DO_NOT_RENDER = 1,
+ AV_ALWAYS_RENDER = 2
+ };
+ void setVisualMuteSettings(VisualMuteSettings set);
protected:
- // If you think you need to access this outside LLVOAvatar, you probably want getOverallAppearance()
- VisualMuteSettings getVisualMuteSettings() { return mVisuallyMuteSetting; };
+ // If you think you need to access this outside LLVOAvatar, you probably want getOverallAppearance()
+ VisualMuteSettings getVisualMuteSettings() { return mVisuallyMuteSetting; };
public:
- // Overall Appearance is an output. Depending on whether the
- // avatar is blocked/muted, whether it exceeds the complexity
- // threshold, etc, avatar will want to be displayed in one of
- // these ways. Rendering code that wants to know how to display an
- // avatar should be looking at this value, NOT the visual mute
- // settings
- enum AvatarOverallAppearance
- {
- AOA_NORMAL,
- AOA_JELLYDOLL,
- AOA_INVISIBLE
- };
-
- AvatarOverallAppearance getOverallAppearance() const;
- void setOverallAppearanceNormal();
- void setOverallAppearanceJellyDoll();
- void setOverallAppearanceInvisible();
-
- void updateOverallAppearance();
- void updateOverallAppearanceAnimations();
-
- std::set<LLUUID> mJellyAnims;
-
- U32 renderRigid();
- U32 renderSkinned();
- F32 getLastSkinTime() { return mLastSkinTime; }
- U32 renderTransparent(BOOL first_pass);
- void renderCollisionVolumes();
- void renderBones(const std::string &selected_joint = std::string());
- void renderJoints();
- static void deleteCachedImages(bool clearAll=true);
- static void destroyGL();
- static void restoreGL();
- S32 mSpecialRenderMode; // special lighting
-
+ // Overall Appearance is an output. Depending on whether the
+ // avatar is blocked/muted, whether it exceeds the complexity
+ // threshold, etc, avatar will want to be displayed in one of
+ // these ways. Rendering code that wants to know how to display an
+ // avatar should be looking at this value, NOT the visual mute
+ // settings
+ enum AvatarOverallAppearance
+ {
+ AOA_NORMAL,
+ AOA_JELLYDOLL,
+ AOA_INVISIBLE
+ };
+
+ AvatarOverallAppearance getOverallAppearance() const;
+ void setOverallAppearanceNormal();
+ void setOverallAppearanceJellyDoll();
+ void setOverallAppearanceInvisible();
+
+ void updateOverallAppearance();
+ void updateOverallAppearanceAnimations();
+
+ std::set<LLUUID> mJellyAnims;
+
+ U32 renderRigid();
+ U32 renderSkinned();
+ F32 getLastSkinTime() { return mLastSkinTime; }
+ U32 renderTransparent(BOOL first_pass);
+ void renderCollisionVolumes();
+ void renderBones(const std::string &selected_joint = std::string());
+ void renderJoints();
+ static void deleteCachedImages(bool clearAll=true);
+ static void destroyGL();
+ static void restoreGL();
+ S32 mSpecialRenderMode; // special lighting
+
private:
friend class LLPipeline;
- AvatarOverallAppearance mOverallAppearance;
- F32 mAttachmentSurfaceArea; //estimated surface area of attachments
- U32 mAttachmentVisibleTriangleCount;
- F32 mAttachmentEstTriangleCount;
- bool shouldAlphaMask();
+ AvatarOverallAppearance mOverallAppearance;
+ F32 mAttachmentSurfaceArea; //estimated surface area of attachments
+ U32 mAttachmentVisibleTriangleCount;
+ F32 mAttachmentEstTriangleCount;
+ bool shouldAlphaMask();
- BOOL mNeedsSkin; // avatar has been animated and verts have not been updated
- F32 mLastSkinTime; //value of gFrameTimeSeconds at last skin update
+ BOOL mNeedsSkin; // avatar has been animated and verts have not been updated
+ F32 mLastSkinTime; //value of gFrameTimeSeconds at last skin update
- S32 mUpdatePeriod;
- S32 mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer.
+ S32 mUpdatePeriod;
+ S32 mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer.
// profile handle
U32 mGPUTimerQuery = 0;
@@ -568,126 +568,126 @@ private:
// CPU render time in ms
F32 mCPURenderTime = 0.f;
- // the isTooComplex method uses these mutable values to avoid recalculating too frequently
+ // the isTooComplex method uses these mutable values to avoid recalculating too frequently
// DEPRECATED -- obsolete avatar render cost values
- mutable U32 mVisualComplexity;
- mutable bool mVisualComplexityStale;
- U32 mReportedVisualComplexity; // from other viewers through the simulator
+ mutable U32 mVisualComplexity;
+ mutable bool mVisualComplexityStale;
+ U32 mReportedVisualComplexity; // from other viewers through the simulator
- mutable bool mCachedInMuteList;
- mutable F64 mCachedMuteListUpdateTime;
+ mutable bool mCachedInMuteList;
+ mutable F64 mCachedMuteListUpdateTime;
- VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV
+ VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV
- //--------------------------------------------------------------------
- // animated object status
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // animated object status
+ //--------------------------------------------------------------------
public:
bool mIsControlAvatar;
bool mIsUIAvatar;
bool mEnableDefaultMotions;
- //--------------------------------------------------------------------
- // Morph masks
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Morph masks
+ //--------------------------------------------------------------------
public:
- /*virtual*/ void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
- BOOL morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
+ /*virtual*/ void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
+ BOOL morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
-
- //--------------------------------------------------------------------
- // Global colors
- //--------------------------------------------------------------------
+
+ //--------------------------------------------------------------------
+ // Global colors
+ //--------------------------------------------------------------------
public:
- /*virtual*/void onGlobalColorChanged(const LLTexGlobalColor* global_color);
+ /*virtual*/void onGlobalColorChanged(const LLTexGlobalColor* global_color);
- //--------------------------------------------------------------------
- // Visibility
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Visibility
+ //--------------------------------------------------------------------
protected:
- void updateVisibility();
+ void updateVisibility();
private:
- U32 mVisibilityRank;
- BOOL mVisible;
-
- //--------------------------------------------------------------------
- // Shadowing
- //--------------------------------------------------------------------
+ U32 mVisibilityRank;
+ BOOL mVisible;
+
+ //--------------------------------------------------------------------
+ // Shadowing
+ //--------------------------------------------------------------------
public:
- void updateShadowFaces();
- LLDrawable* mShadow;
+ void updateShadowFaces();
+ LLDrawable* mShadow;
private:
- LLFace* mShadow0Facep;
- LLFace* mShadow1Facep;
- LLPointer<LLViewerTexture> mShadowImagep;
+ LLFace* mShadow0Facep;
+ LLFace* mShadow1Facep;
+ LLPointer<LLViewerTexture> mShadowImagep;
- //--------------------------------------------------------------------
- // Impostors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Impostors
+ //--------------------------------------------------------------------
public:
- virtual BOOL isImpostor();
- BOOL shouldImpostor(const F32 rank_factor = 1.0);
- BOOL needsImpostorUpdate() const;
- const LLVector3& getImpostorOffset() const;
- const LLVector2& getImpostorDim() const;
- void getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& distance) const;
- void cacheImpostorValues();
- void setImpostorDim(const LLVector2& dim);
- static void resetImpostors();
- static void updateImpostors();
- LLRenderTarget mImpostor;
- BOOL mNeedsImpostorUpdate;
- S32 mLastImpostorUpdateReason;
- F32SecondsImplicit mLastImpostorUpdateFrameTime;
+ virtual BOOL isImpostor();
+ BOOL shouldImpostor(const F32 rank_factor = 1.0);
+ BOOL needsImpostorUpdate() const;
+ const LLVector3& getImpostorOffset() const;
+ const LLVector2& getImpostorDim() const;
+ void getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& distance) const;
+ void cacheImpostorValues();
+ void setImpostorDim(const LLVector2& dim);
+ static void resetImpostors();
+ static void updateImpostors();
+ LLRenderTarget mImpostor;
+ BOOL mNeedsImpostorUpdate;
+ S32 mLastImpostorUpdateReason;
+ F32SecondsImplicit mLastImpostorUpdateFrameTime;
const LLVector3* getLastAnimExtents() const { return mLastAnimExtents; }
- void setNeedsExtentUpdate(bool val) { mNeedsExtentUpdate = val; }
+ void setNeedsExtentUpdate(bool val) { mNeedsExtentUpdate = val; }
private:
- LLVector3 mImpostorOffset;
- LLVector2 mImpostorDim;
+ LLVector3 mImpostorOffset;
+ LLVector2 mImpostorDim;
// This becomes true in the constructor and false after the first
// idleUpdateMisc(). Not clear it serves any purpose.
- BOOL mNeedsAnimUpdate;
- bool mNeedsExtentUpdate;
- LLVector3 mImpostorAngle;
- F32 mImpostorDistance;
- F32 mImpostorPixelArea;
- LLVector3 mLastAnimExtents[2];
- LLVector3 mLastAnimBasePos;
-
- LLCachedControl<bool> mRenderUnloadedAvatar;
-
- //--------------------------------------------------------------------
- // Wind rippling in clothes
- //--------------------------------------------------------------------
+ BOOL mNeedsAnimUpdate;
+ bool mNeedsExtentUpdate;
+ LLVector3 mImpostorAngle;
+ F32 mImpostorDistance;
+ F32 mImpostorPixelArea;
+ LLVector3 mLastAnimExtents[2];
+ LLVector3 mLastAnimBasePos;
+
+ LLCachedControl<bool> mRenderUnloadedAvatar;
+
+ //--------------------------------------------------------------------
+ // Wind rippling in clothes
+ //--------------------------------------------------------------------
public:
- LLVector4 mWindVec;
- F32 mRipplePhase;
- BOOL mBelowWater;
+ LLVector4 mWindVec;
+ F32 mRipplePhase;
+ BOOL mBelowWater;
private:
- F32 mWindFreq;
- LLFrameTimer mRippleTimer;
- F32 mRippleTimeLast;
- LLVector3 mRippleAccel;
- LLVector3 mLastVel;
-
- //--------------------------------------------------------------------
- // Culling
- //--------------------------------------------------------------------
+ F32 mWindFreq;
+ LLFrameTimer mRippleTimer;
+ F32 mRippleTimeLast;
+ LLVector3 mRippleAccel;
+ LLVector3 mLastVel;
+
+ //--------------------------------------------------------------------
+ // Culling
+ //--------------------------------------------------------------------
public:
- static void cullAvatarsByPixelArea();
- BOOL isCulled() const { return mCulled; }
+ static void cullAvatarsByPixelArea();
+ BOOL isCulled() const { return mCulled; }
private:
- BOOL mCulled;
+ BOOL mCulled;
- //--------------------------------------------------------------------
- // Constants
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Constants
+ //--------------------------------------------------------------------
public:
- virtual LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLGLTexture::BOOST_AVATAR; }
- virtual LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLGLTexture::BOOST_AVATAR_BAKED; }
- virtual S32 getTexImageSize() const;
- /*virtual*/ S32 getTexImageArea() const { return getTexImageSize()*getTexImageSize(); }
+ virtual LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLGLTexture::BOOST_AVATAR; }
+ virtual LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLGLTexture::BOOST_AVATAR_BAKED; }
+ virtual S32 getTexImageSize() const;
+ /*virtual*/ S32 getTexImageArea() const { return getTexImageSize()*getTexImageSize(); }
/** Rendering
** **
@@ -698,94 +698,94 @@ public:
** TEXTURES
**/
- //--------------------------------------------------------------------
- // Loading status
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Loading status
+ //--------------------------------------------------------------------
public:
- virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
- virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
- virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const;
-
- BOOL isFullyBaked();
- static BOOL areAllNearbyInstancesBaked(S32& grey_avatars);
- static void getNearbyRezzedStats(std::vector<S32>& counts);
- static std::string rezStatusToString(S32 status);
-
- //--------------------------------------------------------------------
- // Baked textures
- //--------------------------------------------------------------------
+ virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
+ virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
+ virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const;
+
+ BOOL isFullyBaked();
+ static BOOL areAllNearbyInstancesBaked(S32& grey_avatars);
+ static void getNearbyRezzedStats(std::vector<S32>& counts);
+ static std::string rezStatusToString(S32 status);
+
+ //--------------------------------------------------------------------
+ // Baked textures
+ //--------------------------------------------------------------------
public:
- /*virtual*/ LLTexLayerSet* createTexLayerSet(); // Return LLViewerTexLayerSet
- void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY !
+ /*virtual*/ LLTexLayerSet* createTexLayerSet(); // Return LLViewerTexLayerSet
+ void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY !
protected:
- static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
- static void onInitialBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
- static void onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
- virtual void removeMissingBakedTextures();
- void useBakedTexture(const LLUUID& id);
- LLViewerTexLayerSet* getTexLayerSet(const U32 index) const { return dynamic_cast<LLViewerTexLayerSet*>(mBakedTextureDatas[index].mTexLayerSet); }
-
-
- LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ;
- BOOL mLoadedCallbacksPaused;
- S32 mLoadedCallbackTextures; // count of 'loaded' baked textures, filled from mCallbackTextureList
- LLFrameTimer mLastTexCallbackAddedTime;
- std::set<LLUUID> mTextureIDs;
- //--------------------------------------------------------------------
- // Local Textures
- //--------------------------------------------------------------------
+ static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+ static void onInitialBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+ static void onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+ virtual void removeMissingBakedTextures();
+ void useBakedTexture(const LLUUID& id);
+ LLViewerTexLayerSet* getTexLayerSet(const U32 index) const { return dynamic_cast<LLViewerTexLayerSet*>(mBakedTextureDatas[index].mTexLayerSet); }
+
+
+ LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ;
+ BOOL mLoadedCallbacksPaused;
+ S32 mLoadedCallbackTextures; // count of 'loaded' baked textures, filled from mCallbackTextureList
+ LLFrameTimer mLastTexCallbackAddedTime;
+ std::set<LLUUID> mTextureIDs;
+ //--------------------------------------------------------------------
+ // Local Textures
+ //--------------------------------------------------------------------
protected:
- virtual void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index = 0);
- virtual void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
- // MULTI-WEARABLE: make self-only?
- virtual void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index = 0);
-
- //--------------------------------------------------------------------
- // Texture accessors
- //--------------------------------------------------------------------
+ virtual void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index = 0);
+ virtual void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
+ // MULTI-WEARABLE: make self-only?
+ virtual void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index = 0);
+
+ //--------------------------------------------------------------------
+ // Texture accessors
+ //--------------------------------------------------------------------
private:
- virtual void setImage(const U8 te, LLViewerTexture *imagep, const U32 index);
- virtual LLViewerTexture* getImage(const U8 te, const U32 index) const;
- const std::string getImageURL(const U8 te, const LLUUID &uuid);
+ virtual void setImage(const U8 te, LLViewerTexture *imagep, const U32 index);
+ virtual LLViewerTexture* getImage(const U8 te, const U32 index) const;
+ const std::string getImageURL(const U8 te, const LLUUID &uuid);
- virtual const LLTextureEntry* getTexEntry(const U8 te_num) const;
- virtual void setTexEntry(const U8 index, const LLTextureEntry &te);
+ virtual const LLTextureEntry* getTexEntry(const U8 te_num) const;
+ virtual void setTexEntry(const U8 index, const LLTextureEntry &te);
- void checkTextureLoading() ;
- //--------------------------------------------------------------------
- // Layers
- //--------------------------------------------------------------------
+ void checkTextureLoading() ;
+ //--------------------------------------------------------------------
+ // Layers
+ //--------------------------------------------------------------------
protected:
- void deleteLayerSetCaches(bool clearAll = true);
- void addBakedTextureStats(LLViewerFetchedTexture* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level);
+ void deleteLayerSetCaches(bool clearAll = true);
+ void addBakedTextureStats(LLViewerFetchedTexture* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level);
- //--------------------------------------------------------------------
- // Composites
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Composites
+ //--------------------------------------------------------------------
public:
- virtual void invalidateComposite(LLTexLayerSet* layerset);
- virtual void invalidateAll();
- virtual void setCompositeUpdatesEnabled(bool b) {}
- virtual void setCompositeUpdatesEnabled(U32 index, bool b) {}
- virtual bool isCompositeUpdateEnabled(U32 index) { return false; }
-
- //--------------------------------------------------------------------
- // Static texture/mesh/baked dictionary
- //--------------------------------------------------------------------
+ virtual void invalidateComposite(LLTexLayerSet* layerset);
+ virtual void invalidateAll();
+ virtual void setCompositeUpdatesEnabled(bool b) {}
+ virtual void setCompositeUpdatesEnabled(U32 index, bool b) {}
+ virtual bool isCompositeUpdateEnabled(U32 index) { return false; }
+
+ //--------------------------------------------------------------------
+ // Static texture/mesh/baked dictionary
+ //--------------------------------------------------------------------
public:
- static BOOL isIndexLocalTexture(LLAvatarAppearanceDefines::ETextureIndex i);
- static BOOL isIndexBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i);
+ static BOOL isIndexLocalTexture(LLAvatarAppearanceDefines::ETextureIndex i);
+ static BOOL isIndexBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i);
- //--------------------------------------------------------------------
- // Messaging
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Messaging
+ //--------------------------------------------------------------------
public:
- void onFirstTEMessageReceived();
+ void onFirstTEMessageReceived();
private:
- BOOL mFirstTEMessageReceived;
- BOOL mFirstAppearanceMessageReceived;
-
+ BOOL mFirstTEMessageReceived;
+ BOOL mFirstAppearanceMessageReceived;
+
/** Textures
** **
*******************************************************************************/
@@ -796,13 +796,13 @@ private:
**/
public:
- void debugColorizeSubMeshes(U32 i, const LLColor4& color);
- virtual void updateMeshTextures();
- void updateSexDependentLayerSets();
- virtual void dirtyMesh(); // Dirty the avatar mesh
- void updateMeshData();
- void updateMeshVisibility();
- LLViewerTexture* getBakedTexture(const U8 te);
+ void debugColorizeSubMeshes(U32 i, const LLColor4& color);
+ virtual void updateMeshTextures();
+ void updateSexDependentLayerSets();
+ virtual void dirtyMesh(); // Dirty the avatar mesh
+ void updateMeshData();
+ void updateMeshVisibility();
+ LLViewerTexture* getBakedTexture(const U8 te);
// Matrix palette cache entry
class alignas(16) MatrixPaletteCache
@@ -833,20 +833,20 @@ public:
matrix_palette_cache_t mMatrixPaletteCache;
protected:
- void releaseMeshData();
- virtual void restoreMeshData();
+ void releaseMeshData();
+ virtual void restoreMeshData();
private:
- virtual void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority
- LLViewerJoint* getViewerJoint(S32 idx);
- S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD
- BOOL mMeshTexturesDirty;
-
- //--------------------------------------------------------------------
- // Destroy invisible mesh
- //--------------------------------------------------------------------
+ virtual void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority
+ LLViewerJoint* getViewerJoint(S32 idx);
+ S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD
+ BOOL mMeshTexturesDirty;
+
+ //--------------------------------------------------------------------
+ // Destroy invisible mesh
+ //--------------------------------------------------------------------
protected:
- BOOL mMeshValid;
- LLFrameTimer mMeshInvisibleTime;
+ BOOL mMeshValid;
+ LLFrameTimer mMeshInvisibleTime;
/** Meshes
** **
@@ -857,49 +857,49 @@ protected:
** APPEARANCE
**/
- LLPointer<LLAppearanceMessageContents> mLastProcessedAppearance;
-
+ LLPointer<LLAppearanceMessageContents> mLastProcessedAppearance;
+
public:
- void parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& msg);
- void processAvatarAppearance(LLMessageSystem* mesgsys);
+ void parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& msg);
+ void processAvatarAppearance(LLMessageSystem* mesgsys);
void applyParsedAppearanceMessage(LLAppearanceMessageContents& contents, bool slam_params);
- void hideHair();
- void hideSkirt();
- void startAppearanceAnimation();
-
- //--------------------------------------------------------------------
- // Appearance morphing
- //--------------------------------------------------------------------
+ void hideHair();
+ void hideSkirt();
+ void startAppearanceAnimation();
+
+ //--------------------------------------------------------------------
+ // Appearance morphing
+ //--------------------------------------------------------------------
public:
- BOOL getIsAppearanceAnimating() const { return mAppearanceAnimating; }
+ BOOL getIsAppearanceAnimating() const { return mAppearanceAnimating; }
- // True if we are computing our appearance via local compositing
- // instead of baked textures, as for example during wearable
- // editing or when waiting for a subsequent server rebake.
- /*virtual*/ BOOL isUsingLocalAppearance() const { return mUseLocalAppearance; }
+ // True if we are computing our appearance via local compositing
+ // instead of baked textures, as for example during wearable
+ // editing or when waiting for a subsequent server rebake.
+ /*virtual*/ BOOL isUsingLocalAppearance() const { return mUseLocalAppearance; }
- // True if we are currently in appearance editing mode. Often but
- // not always the same as isUsingLocalAppearance().
- /*virtual*/ BOOL isEditingAppearance() const { return mIsEditingAppearance; }
+ // True if we are currently in appearance editing mode. Often but
+ // not always the same as isUsingLocalAppearance().
+ /*virtual*/ BOOL isEditingAppearance() const { return mIsEditingAppearance; }
- // FIXME review isUsingLocalAppearance uses, some should be isEditing instead.
+ // FIXME review isUsingLocalAppearance uses, some should be isEditing instead.
private:
- BOOL mAppearanceAnimating;
- LLFrameTimer mAppearanceMorphTimer;
- F32 mLastAppearanceBlendTime;
- BOOL mIsEditingAppearance; // flag for if we're actively in appearance editing mode
- BOOL mUseLocalAppearance; // flag for if we're using a local composite
-
- //--------------------------------------------------------------------
- // Visibility
- //--------------------------------------------------------------------
+ BOOL mAppearanceAnimating;
+ LLFrameTimer mAppearanceMorphTimer;
+ F32 mLastAppearanceBlendTime;
+ BOOL mIsEditingAppearance; // flag for if we're actively in appearance editing mode
+ BOOL mUseLocalAppearance; // flag for if we're using a local composite
+
+ //--------------------------------------------------------------------
+ // Visibility
+ //--------------------------------------------------------------------
public:
- BOOL isVisible() const;
+ BOOL isVisible() const;
virtual bool shouldRenderRigged() const;
- void setVisibilityRank(U32 rank);
- U32 getVisibilityRank() const { return mVisibilityRank; }
- static S32 sNumVisibleAvatars; // Number of instances of this class
+ void setVisibilityRank(U32 rank);
+ U32 getVisibilityRank() const { return mVisibilityRank; }
+ static S32 sNumVisibleAvatars; // Number of instances of this class
/** Appearance
** **
*******************************************************************************/
@@ -909,48 +909,48 @@ public:
** WEARABLES
**/
- //--------------------------------------------------------------------
- // Attachments
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Attachments
+ //--------------------------------------------------------------------
public:
- void clampAttachmentPositions();
- virtual const LLViewerJointAttachment* attachObject(LLViewerObject *viewer_object);
- virtual BOOL detachObject(LLViewerObject *viewer_object);
- static bool getRiggedMeshID( LLViewerObject* pVO, LLUUID& mesh_id );
- void cleanupAttachedMesh( LLViewerObject* pVO );
+ void clampAttachmentPositions();
+ virtual const LLViewerJointAttachment* attachObject(LLViewerObject *viewer_object);
+ virtual BOOL detachObject(LLViewerObject *viewer_object);
+ static bool getRiggedMeshID( LLViewerObject* pVO, LLUUID& mesh_id );
+ void cleanupAttachedMesh( LLViewerObject* pVO );
bool hasPendingAttachedMeshes();
- static LLVOAvatar* findAvatarFromAttachment(LLViewerObject* obj);
- /*virtual*/ BOOL isWearingWearableType(LLWearableType::EType type ) const;
- LLViewerObject * findAttachmentByID( const LLUUID & target_id ) const;
- LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object);
+ static LLVOAvatar* findAvatarFromAttachment(LLViewerObject* obj);
+ /*virtual*/ BOOL isWearingWearableType(LLWearableType::EType type ) const;
+ LLViewerObject * findAttachmentByID( const LLUUID & target_id ) const;
+ LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object);
protected:
- void lazyAttach();
- void rebuildRiggedAttachments( void );
+ void lazyAttach();
+ void rebuildRiggedAttachments( void );
- //--------------------------------------------------------------------
- // Map of attachment points, by ID
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Map of attachment points, by ID
+ //--------------------------------------------------------------------
public:
- S32 getAttachmentCount(); // Warning: order(N) not order(1) // currently used only by -self
- typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t;
- attachment_map_t mAttachmentPoints;
- std::vector<LLPointer<LLViewerObject> > mPendingAttachment;
-
- //--------------------------------------------------------------------
- // HUD functions
- //--------------------------------------------------------------------
+ S32 getAttachmentCount(); // Warning: order(N) not order(1) // currently used only by -self
+ typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t;
+ attachment_map_t mAttachmentPoints;
+ std::vector<LLPointer<LLViewerObject> > mPendingAttachment;
+
+ //--------------------------------------------------------------------
+ // HUD functions
+ //--------------------------------------------------------------------
public:
- BOOL hasHUDAttachment() const;
- LLBBox getHUDBBox() const;
- void resetHUDAttachments();
- S32 getMaxAttachments() const;
- BOOL canAttachMoreObjects(U32 n=1) const;
- S32 getMaxAnimatedObjectAttachments() const;
- BOOL canAttachMoreAnimatedObjects(U32 n=1) const;
+ BOOL hasHUDAttachment() const;
+ LLBBox getHUDBBox() const;
+ void resetHUDAttachments();
+ S32 getMaxAttachments() const;
+ BOOL canAttachMoreObjects(U32 n=1) const;
+ S32 getMaxAnimatedObjectAttachments() const;
+ BOOL canAttachMoreAnimatedObjects(U32 n=1) const;
protected:
- U32 getNumAttachments() const; // O(N), not O(1)
- U32 getNumAnimatedObjectAttachments() const; // O(N), not O(1)
+ U32 getNumAttachments() const; // O(N), not O(1)
+ U32 getNumAnimatedObjectAttachments() const; // O(N), not O(1)
/** Wearables
** **
@@ -961,56 +961,56 @@ protected:
** ACTIONS
**/
- //--------------------------------------------------------------------
- // Animations
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Animations
+ //--------------------------------------------------------------------
public:
- BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const;
- void processAnimationStateChanges();
+ BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const;
+ void processAnimationStateChanges();
protected:
- BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start);
- void resetAnimations();
+ BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start);
+ void resetAnimations();
private:
- LLTimer mAnimTimer;
- F32 mTimeLast;
+ LLTimer mAnimTimer;
+ F32 mTimeLast;
- //--------------------------------------------------------------------
- // Animation state data
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Animation state data
+ //--------------------------------------------------------------------
public:
- typedef std::map<LLUUID, S32>::iterator AnimIterator;
- std::map<LLUUID, S32> mSignaledAnimations; // requested state of Animation name/value
- std::map<LLUUID, S32> mPlayingAnimations; // current state of Animation name/value
+ typedef std::map<LLUUID, S32>::iterator AnimIterator;
+ std::map<LLUUID, S32> mSignaledAnimations; // requested state of Animation name/value
+ std::map<LLUUID, S32> mPlayingAnimations; // current state of Animation name/value
- typedef std::multimap<LLUUID, LLUUID> AnimationSourceMap;
- typedef AnimationSourceMap::iterator AnimSourceIterator;
- AnimationSourceMap mAnimationSources; // object ids that triggered anim ids
+ typedef std::multimap<LLUUID, LLUUID> AnimationSourceMap;
+ typedef AnimationSourceMap::iterator AnimSourceIterator;
+ AnimationSourceMap mAnimationSources; // object ids that triggered anim ids
- //--------------------------------------------------------------------
- // Chat
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Chat
+ //--------------------------------------------------------------------
public:
- void addChat(const LLChat& chat);
- void clearChat();
- void startTyping() { mTyping = TRUE; mTypingTimer.reset(); }
- void stopTyping() { mTyping = FALSE; }
+ void addChat(const LLChat& chat);
+ void clearChat();
+ void startTyping() { mTyping = TRUE; mTypingTimer.reset(); }
+ void stopTyping() { mTyping = FALSE; }
private:
- bool mVisibleChat;
+ bool mVisibleChat;
- //--------------------------------------------------------------------
- // Lip synch morphs
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Lip synch morphs
+ //--------------------------------------------------------------------
private:
- bool mLipSyncActive; // we're morphing for lip sync
- LLVisualParam* mOohMorph; // cached pointers morphs for lip sync
- LLVisualParam* mAahMorph; // cached pointers morphs for lip sync
+ bool mLipSyncActive; // we're morphing for lip sync
+ LLVisualParam* mOohMorph; // cached pointers morphs for lip sync
+ LLVisualParam* mAahMorph; // cached pointers morphs for lip sync
- //--------------------------------------------------------------------
- // Flight
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Flight
+ //--------------------------------------------------------------------
public:
- BOOL mInAir;
- LLFrameTimer mTimeInAir;
+ BOOL mInAir;
+ LLFrameTimer mTimeInAir;
/** Actions
** **
@@ -1022,28 +1022,28 @@ public:
**/
private:
- F32 mSpeedAccum; // measures speed (for diagnostics mostly).
- BOOL mTurning; // controls hysteresis on avatar rotation
- F32 mSpeed; // misc. animation repeated state
+ F32 mSpeedAccum; // measures speed (for diagnostics mostly).
+ BOOL mTurning; // controls hysteresis on avatar rotation
+ F32 mSpeed; // misc. animation repeated state
- //--------------------------------------------------------------------
- // Dimensions
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Dimensions
+ //--------------------------------------------------------------------
public:
- void resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm);
- bool distanceToGround( const LLVector3d &startPoint, LLVector3d &collisionPoint, F32 distToIntersectionAlongRay );
- void resolveHeightAgent(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
- void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm);
- void slamPosition(); // Slam position to transmitted position (for teleport);
+ void resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm);
+ bool distanceToGround( const LLVector3d &startPoint, LLVector3d &collisionPoint, F32 distToIntersectionAlongRay );
+ void resolveHeightAgent(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
+ void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm);
+ void slamPosition(); // Slam position to transmitted position (for teleport);
protected:
- //--------------------------------------------------------------------
- // Material being stepped on
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Material being stepped on
+ //--------------------------------------------------------------------
private:
- BOOL mStepOnLand;
- U8 mStepMaterial;
- LLVector3 mStepObjectVelocity;
+ BOOL mStepOnLand;
+ U8 mStepMaterial;
+ LLVector3 mStepObjectVelocity;
/** Physics
** **
@@ -1055,23 +1055,23 @@ private:
**/
public:
- /*virtual*/ BOOL setParent(LLViewerObject* parent);
- /*virtual*/ void addChild(LLViewerObject *childp);
- /*virtual*/ void removeChild(LLViewerObject *childp);
+ /*virtual*/ BOOL setParent(LLViewerObject* parent);
+ /*virtual*/ void addChild(LLViewerObject *childp);
+ /*virtual*/ void removeChild(LLViewerObject *childp);
- //--------------------------------------------------------------------
- // Sitting
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Sitting
+ //--------------------------------------------------------------------
public:
- void sitDown(BOOL bSitting);
- BOOL isSitting(){return mIsSitting;}
- void sitOnObject(LLViewerObject *sit_object);
- void getOffObject();
+ void sitDown(BOOL bSitting);
+ BOOL isSitting(){return mIsSitting;}
+ void sitOnObject(LLViewerObject *sit_object);
+ void getOffObject();
private:
- // set this property only with LLVOAvatar::sitDown method
- BOOL mIsSitting;
- // position backup in case of missing data
- LLVector3 mLastRootPos;
+ // set this property only with LLVOAvatar::sitDown method
+ BOOL mIsSitting;
+ // position backup in case of missing data
+ LLVector3 mLastRootPos;
/** Hierarchy
** **
@@ -1083,34 +1083,34 @@ private:
**/
public:
- virtual std::string getFullname() const; // Returns "FirstName LastName"
- std::string avString() const; // Frequently used string in log messages "Avatar '<full name'"
+ virtual std::string getFullname() const; // Returns "FirstName LastName"
+ std::string avString() const; // Frequently used string in log messages "Avatar '<full name'"
protected:
- static void getAnimLabels(std::vector<std::string>* labels);
- static void getAnimNames(std::vector<std::string>* names);
+ static void getAnimLabels(std::vector<std::string>* labels);
+ static void getAnimNames(std::vector<std::string>* names);
private:
bool mNameIsSet;
- std::string mTitle;
- bool mNameAway;
- bool mNameDoNotDisturb;
- bool mNameMute;
- bool mNameAppearance;
- bool mNameFriend;
- bool mNameCloud;
- F32 mNameAlpha;
- BOOL mRenderGroupTitles;
-
- //--------------------------------------------------------------------
- // Display the name (then optionally fade it out)
- //--------------------------------------------------------------------
+ std::string mTitle;
+ bool mNameAway;
+ bool mNameDoNotDisturb;
+ bool mNameMute;
+ bool mNameAppearance;
+ bool mNameFriend;
+ bool mNameCloud;
+ F32 mNameAlpha;
+ BOOL mRenderGroupTitles;
+
+ //--------------------------------------------------------------------
+ // Display the name (then optionally fade it out)
+ //--------------------------------------------------------------------
public:
- LLFrameTimer mChatTimer;
- LLPointer<LLHUDNameTag> mNameText;
+ LLFrameTimer mChatTimer;
+ LLPointer<LLHUDNameTag> mNameText;
private:
- LLFrameTimer mTimeVisible;
- std::deque<LLChat> mChats;
- BOOL mTyping;
- LLFrameTimer mTypingTimer;
+ LLFrameTimer mTimeVisible;
+ std::deque<LLChat> mChats;
+ BOOL mTyping;
+ LLFrameTimer mTypingTimer;
/** Name
** **
@@ -1121,34 +1121,34 @@ private:
** SOUNDS
**/
- //--------------------------------------------------------------------
- // Voice visualizer
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Voice visualizer
+ //--------------------------------------------------------------------
public:
- // Responsible for detecting the user's voice signal (and when the
- // user speaks, it puts a voice symbol over the avatar's head) and gesticulations
- LLPointer<LLVoiceVisualizer> mVoiceVisualizer;
- int mCurrentGesticulationLevel;
-
- //--------------------------------------------------------------------
- // Step sound
- //--------------------------------------------------------------------
+ // Responsible for detecting the user's voice signal (and when the
+ // user speaks, it puts a voice symbol over the avatar's head) and gesticulations
+ LLPointer<LLVoiceVisualizer> mVoiceVisualizer;
+ int mCurrentGesticulationLevel;
+
+ //--------------------------------------------------------------------
+ // Step sound
+ //--------------------------------------------------------------------
protected:
- const LLUUID& getStepSound() const;
+ const LLUUID& getStepSound() const;
private:
- // Global table of sound ids per material, and the ground
- const static LLUUID sStepSounds[LL_MCODE_END];
- const static LLUUID sStepSoundOnLand;
+ // Global table of sound ids per material, and the ground
+ const static LLUUID sStepSounds[LL_MCODE_END];
+ const static LLUUID sStepSoundOnLand;
- //--------------------------------------------------------------------
- // Foot step state (for generating sounds)
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Foot step state (for generating sounds)
+ //--------------------------------------------------------------------
public:
- void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; }
- LLVector4 mFootPlane;
+ void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; }
+ LLVector4 mFootPlane;
private:
- BOOL mWasOnGroundLeft;
- BOOL mWasOnGroundRight;
+ BOOL mWasOnGroundLeft;
+ BOOL mWasOnGroundRight;
/** Sounds
** **
@@ -1158,56 +1158,56 @@ private:
** **
** DIAGNOSTICS
**/
-
- //--------------------------------------------------------------------
- // General
- //--------------------------------------------------------------------
+
+ //--------------------------------------------------------------------
+ // General
+ //--------------------------------------------------------------------
public:
void getSortedJointNames(S32 joint_type, std::vector<std::string>& result) const;
- void dumpArchetypeXML(const std::string& prefix, bool group_by_wearables = false);
- void dumpAppearanceMsgParams( const std::string& dump_prefix,
- const LLAppearanceMessageContents& contents);
- static void dumpBakedStatus();
- const std::string getBakedStatusForPrintout() const;
- void dumpAvatarTEs(const std::string& context) const;
-
- static F32 sUnbakedTime; // Total seconds with >=1 unbaked avatars
- static F32 sUnbakedUpdateTime; // Last time stats were updated (to prevent multiple updates per frame)
- static F32 sGreyTime; // Total seconds with >=1 grey avatars
- static F32 sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame)
+ void dumpArchetypeXML(const std::string& prefix, bool group_by_wearables = false);
+ void dumpAppearanceMsgParams( const std::string& dump_prefix,
+ const LLAppearanceMessageContents& contents);
+ static void dumpBakedStatus();
+ const std::string getBakedStatusForPrintout() const;
+ void dumpAvatarTEs(const std::string& context) const;
+
+ static F32 sUnbakedTime; // Total seconds with >=1 unbaked avatars
+ static F32 sUnbakedUpdateTime; // Last time stats were updated (to prevent multiple updates per frame)
+ static F32 sGreyTime; // Total seconds with >=1 grey avatars
+ static F32 sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame)
protected:
- S32 getUnbakedPixelAreaRank();
- BOOL mHasGrey;
+ S32 getUnbakedPixelAreaRank();
+ BOOL mHasGrey;
private:
- F32 mMinPixelArea;
- F32 mMaxPixelArea;
- F32 mAdjustedPixelArea;
- std::string mDebugText;
- std::string mBakedTextureDebugText;
+ F32 mMinPixelArea;
+ F32 mMaxPixelArea;
+ F32 mAdjustedPixelArea;
+ std::string mDebugText;
+ std::string mBakedTextureDebugText;
- //--------------------------------------------------------------------
- // Avatar Rez Metrics
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Avatar Rez Metrics
+ //--------------------------------------------------------------------
public:
- void debugAvatarRezTime(std::string notification_name, std::string comment = "");
- F32 debugGetExistenceTimeElapsedF32() const { return mDebugExistenceTimer.getElapsedTimeF32(); }
+ void debugAvatarRezTime(std::string notification_name, std::string comment = "");
+ F32 debugGetExistenceTimeElapsedF32() const { return mDebugExistenceTimer.getElapsedTimeF32(); }
protected:
- LLFrameTimer mRuthDebugTimer; // For tracking how long it takes for av to rez
- LLFrameTimer mDebugExistenceTimer; // Debugging for how long the avatar has been in memory.
- LLFrameTimer mLastAppearanceMessageTimer; // Time since last appearance message received.
+ LLFrameTimer mRuthDebugTimer; // For tracking how long it takes for av to rez
+ LLFrameTimer mDebugExistenceTimer; // Debugging for how long the avatar has been in memory.
+ LLFrameTimer mLastAppearanceMessageTimer; // Time since last appearance message received.
- //--------------------------------------------------------------------
- // COF monitoring
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // COF monitoring
+ //--------------------------------------------------------------------
public:
- // COF version of last viewer-initiated appearance update request. For non-self avs, this will remain at default.
- S32 mLastUpdateRequestCOFVersion;
+ // COF version of last viewer-initiated appearance update request. For non-self avs, this will remain at default.
+ S32 mLastUpdateRequestCOFVersion;
- // COF version of last appearance message received for this av.
- S32 mLastUpdateReceivedCOFVersion;
+ // COF version of last appearance message received for this av.
+ S32 mLastUpdateReceivedCOFVersion;
/** Diagnostics
** **
@@ -1233,7 +1233,7 @@ extern const F32 MAX_HOVER_Z;
extern const F32 MIN_HOVER_Z;
std::string get_sequential_numbered_file_name(const std::string& prefix,
- const std::string& suffix);
+ const std::string& suffix);
void dump_sequential_xml(const std::string outprefix, const LLSD& content);
void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value);
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index f12fc3babc..38742c9c64 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvoavatar.cpp
* @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,7 +47,7 @@
#include "lllocaltextureobject.h"
#include "llnotificationsutil.h"
#include "llselectmgr.h"
-#include "lltoolgrab.h" // for needsRenderBeam
+#include "lltoolgrab.h" // for needsRenderBeam
#include "lltoolmgr.h" // for needsRenderBeam
#include "lltoolmorph.h"
#include "lltrans.h"
@@ -80,31 +80,31 @@ LLPointer<LLVOAvatarSelf> gAgentAvatarp = NULL;
BOOL isAgentAvatarValid()
{
- return (gAgentAvatarp.notNull() && gAgentAvatarp->isValid());
+ return (gAgentAvatarp.notNull() && gAgentAvatarp->isValid());
}
void selfStartPhase(const std::string& phase_name)
{
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->startPhase(phase_name);
- }
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->startPhase(phase_name);
+ }
}
void selfStopPhase(const std::string& phase_name, bool err_check)
{
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->stopPhase(phase_name, err_check);
- }
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->stopPhase(phase_name, err_check);
+ }
}
void selfClearPhases()
{
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->clearPhases();
- }
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->clearPhases();
+ }
}
using namespace LLAvatarAppearanceDefines;
@@ -120,18 +120,18 @@ LLSD summarize_by_buckets(std::vector<LLSD> in_records, std::vector<std::string>
struct LocalTextureData
{
- LocalTextureData() :
- mIsBakedReady(false),
- mDiscard(MAX_DISCARD_LEVEL+1),
- mImage(NULL),
- mWearableID(IMG_DEFAULT_AVATAR),
- mTexEntry(NULL)
- {}
- LLPointer<LLViewerFetchedTexture> mImage;
- bool mIsBakedReady;
- S32 mDiscard;
- LLUUID mWearableID; // UUID of the wearable that this texture belongs to, not of the image itself
- LLTextureEntry *mTexEntry;
+ LocalTextureData() :
+ mIsBakedReady(false),
+ mDiscard(MAX_DISCARD_LEVEL+1),
+ mImage(NULL),
+ mWearableID(IMG_DEFAULT_AVATAR),
+ mTexEntry(NULL)
+ {}
+ LLPointer<LLViewerFetchedTexture> mImage;
+ bool mIsBakedReady;
+ S32 mDiscard;
+ LLUUID mWearableID; // UUID of the wearable that this texture belongs to, not of the image itself
+ LLTextureEntry *mTexEntry;
};
//-----------------------------------------------------------------------------
@@ -160,512 +160,512 @@ std::map< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames;
**/
LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id,
- const LLPCode pcode,
- LLViewerRegion* regionp) :
- LLVOAvatar(id, pcode, regionp),
- mScreenp(NULL),
- mLastRegionHandle(0),
- mRegionCrossingCount(0),
- // Value outside legal range, so will always be a mismatch the
- // first time through.
- mLastHoverOffsetSent(LLVector3(0.0f, 0.0f, -999.0f)),
+ const LLPCode pcode,
+ LLViewerRegion* regionp) :
+ LLVOAvatar(id, pcode, regionp),
+ mScreenp(NULL),
+ mLastRegionHandle(0),
+ mRegionCrossingCount(0),
+ // Value outside legal range, so will always be a mismatch the
+ // first time through.
+ mLastHoverOffsetSent(LLVector3(0.0f, 0.0f, -999.0f)),
mInitialMetric(true),
mMetricSequence(0)
{
- mMotionController.mIsSelf = TRUE;
+ mMotionController.mIsSelf = TRUE;
- LL_DEBUGS() << "Marking avatar as self " << id << LL_ENDL;
+ LL_DEBUGS() << "Marking avatar as self " << id << LL_ENDL;
}
// Called periodically for diagnostics, return true when done.
bool output_self_av_texture_diagnostics()
{
- if (!isAgentAvatarValid())
- return true; // done checking
+ if (!isAgentAvatarValid())
+ return true; // done checking
- gAgentAvatarp->outputRezDiagnostics();
+ gAgentAvatarp->outputRezDiagnostics();
- return false;
+ return false;
}
bool update_avatar_rez_metrics()
{
- if (!isAgentAvatarValid())
- return true;
-
- gAgentAvatarp->updateAvatarRezMetrics(false);
+ if (!isAgentAvatarValid())
+ return true;
+
+ gAgentAvatarp->updateAvatarRezMetrics(false);
- return false;
+ return false;
}
void LLVOAvatarSelf::initInstance()
{
- BOOL status = TRUE;
- // creates hud joint(mScreen) among other things
- status &= loadAvatarSelf();
-
- // adds attachment points to mScreen among other things
- LLVOAvatar::initInstance();
-
- LL_INFOS() << "Self avatar object created. Starting timer." << LL_ENDL;
- mDebugSelfLoadTimer.reset();
- // clear all times to -1 for debugging
- for (U32 i =0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
- {
- for (U32 j = 0; j <= MAX_DISCARD_LEVEL; ++j)
- {
- mDebugTextureLoadTimes[i][j] = -1.0f;
- }
- }
-
- for (U32 i =0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i)
- {
- mDebugBakedTextureTimes[i][0] = -1.0f;
- mDebugBakedTextureTimes[i][1] = -1.0f;
- }
-
- status &= buildMenus();
- if (!status)
- {
- LL_ERRS() << "Unable to load user's avatar" << LL_ENDL;
- return;
- }
-
- setHoverIfRegionEnabled();
-
- //doPeriodically(output_self_av_texture_diagnostics, 30.0);
- doPeriodically(update_avatar_rez_metrics, 5.0);
- doPeriodically(boost::bind(&LLVOAvatarSelf::checkStuckAppearance, this), 30.0);
+ BOOL status = TRUE;
+ // creates hud joint(mScreen) among other things
+ status &= loadAvatarSelf();
+
+ // adds attachment points to mScreen among other things
+ LLVOAvatar::initInstance();
+
+ LL_INFOS() << "Self avatar object created. Starting timer." << LL_ENDL;
+ mDebugSelfLoadTimer.reset();
+ // clear all times to -1 for debugging
+ for (U32 i =0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
+ {
+ for (U32 j = 0; j <= MAX_DISCARD_LEVEL; ++j)
+ {
+ mDebugTextureLoadTimes[i][j] = -1.0f;
+ }
+ }
+
+ for (U32 i =0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i)
+ {
+ mDebugBakedTextureTimes[i][0] = -1.0f;
+ mDebugBakedTextureTimes[i][1] = -1.0f;
+ }
+
+ status &= buildMenus();
+ if (!status)
+ {
+ LL_ERRS() << "Unable to load user's avatar" << LL_ENDL;
+ return;
+ }
+
+ setHoverIfRegionEnabled();
+
+ //doPeriodically(output_self_av_texture_diagnostics, 30.0);
+ doPeriodically(update_avatar_rez_metrics, 5.0);
+ doPeriodically(boost::bind(&LLVOAvatarSelf::checkStuckAppearance, this), 30.0);
mInitFlags |= 1<<2;
}
void LLVOAvatarSelf::setHoverIfRegionEnabled()
{
- if (getRegion() && getRegion()->simulatorFeaturesReceived())
- {
- if (getRegion()->avatarHoverHeightEnabled())
- {
- F32 hover_z = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ");
- setHoverOffset(LLVector3(0.0, 0.0, llclamp(hover_z,MIN_HOVER_Z,MAX_HOVER_Z)));
- LL_INFOS("Avatar") << avString() << " set hover height from debug setting " << hover_z << LL_ENDL;
- }
- else
- {
- setHoverOffset(LLVector3(0.0, 0.0, 0.0));
- LL_INFOS("Avatar") << avString() << " zeroing hover height, region does not support" << LL_ENDL;
- }
- }
- else
- {
- LL_INFOS("Avatar") << avString() << " region or simulator features not known, no change on hover" << LL_ENDL;
- if (getRegion())
- {
- getRegion()->setSimulatorFeaturesReceivedCallback(boost::bind(&LLVOAvatarSelf::onSimulatorFeaturesReceived,this,_1));
- }
-
- }
+ if (getRegion() && getRegion()->simulatorFeaturesReceived())
+ {
+ if (getRegion()->avatarHoverHeightEnabled())
+ {
+ F32 hover_z = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ");
+ setHoverOffset(LLVector3(0.0, 0.0, llclamp(hover_z,MIN_HOVER_Z,MAX_HOVER_Z)));
+ LL_INFOS("Avatar") << avString() << " set hover height from debug setting " << hover_z << LL_ENDL;
+ }
+ else
+ {
+ setHoverOffset(LLVector3(0.0, 0.0, 0.0));
+ LL_INFOS("Avatar") << avString() << " zeroing hover height, region does not support" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_INFOS("Avatar") << avString() << " region or simulator features not known, no change on hover" << LL_ENDL;
+ if (getRegion())
+ {
+ getRegion()->setSimulatorFeaturesReceivedCallback(boost::bind(&LLVOAvatarSelf::onSimulatorFeaturesReceived,this,_1));
+ }
+
+ }
}
bool LLVOAvatarSelf::checkStuckAppearance()
{
- const F32 CONDITIONAL_UNSTICK_INTERVAL = 300.0;
- const F32 UNCONDITIONAL_UNSTICK_INTERVAL = 600.0;
-
- if (gAgentWearables.isCOFChangeInProgress())
- {
- LL_DEBUGS("Avatar") << "checking for stuck appearance" << LL_ENDL;
- F32 change_time = gAgentWearables.getCOFChangeTime();
- LL_DEBUGS("Avatar") << "change in progress for " << change_time << " seconds" << LL_ENDL;
- S32 active_hp = LLAppearanceMgr::instance().countActiveHoldingPatterns();
- LL_DEBUGS("Avatar") << "active holding patterns " << active_hp << " seconds" << LL_ENDL;
- S32 active_copies = LLAppearanceMgr::instance().getActiveCopyOperations();
- LL_DEBUGS("Avatar") << "active copy operations " << active_copies << LL_ENDL;
-
- if ((change_time > CONDITIONAL_UNSTICK_INTERVAL && active_copies == 0) ||
- (change_time > UNCONDITIONAL_UNSTICK_INTERVAL))
- {
- gAgentWearables.notifyLoadingFinished();
- }
- }
-
- // Return false to continue running check periodically.
- return LLApp::isExiting();
+ const F32 CONDITIONAL_UNSTICK_INTERVAL = 300.0;
+ const F32 UNCONDITIONAL_UNSTICK_INTERVAL = 600.0;
+
+ if (gAgentWearables.isCOFChangeInProgress())
+ {
+ LL_DEBUGS("Avatar") << "checking for stuck appearance" << LL_ENDL;
+ F32 change_time = gAgentWearables.getCOFChangeTime();
+ LL_DEBUGS("Avatar") << "change in progress for " << change_time << " seconds" << LL_ENDL;
+ S32 active_hp = LLAppearanceMgr::instance().countActiveHoldingPatterns();
+ LL_DEBUGS("Avatar") << "active holding patterns " << active_hp << " seconds" << LL_ENDL;
+ S32 active_copies = LLAppearanceMgr::instance().getActiveCopyOperations();
+ LL_DEBUGS("Avatar") << "active copy operations " << active_copies << LL_ENDL;
+
+ if ((change_time > CONDITIONAL_UNSTICK_INTERVAL && active_copies == 0) ||
+ (change_time > UNCONDITIONAL_UNSTICK_INTERVAL))
+ {
+ gAgentWearables.notifyLoadingFinished();
+ }
+ }
+
+ // Return false to continue running check periodically.
+ return LLApp::isExiting();
}
// virtual
void LLVOAvatarSelf::markDead()
{
- mBeam = NULL;
- LLVOAvatar::markDead();
+ mBeam = NULL;
+ LLVOAvatar::markDead();
}
/*virtual*/ BOOL LLVOAvatarSelf::loadAvatar()
{
- BOOL success = LLVOAvatar::loadAvatar();
+ BOOL success = LLVOAvatar::loadAvatar();
- // set all parameters stored directly in the avatar to have
- // the isSelfParam to be TRUE - this is used to prevent
- // them from being animated or trigger accidental rebakes
- // when we copy params from the wearable to the base avatar.
- for (LLViewerVisualParam* param = (LLViewerVisualParam*) getFirstVisualParam();
- param;
- param = (LLViewerVisualParam*) getNextVisualParam())
- {
- if (param->getWearableType() != LLWearableType::WT_INVALID)
- {
- param->setIsDummy(TRUE);
- }
- }
+ // set all parameters stored directly in the avatar to have
+ // the isSelfParam to be TRUE - this is used to prevent
+ // them from being animated or trigger accidental rebakes
+ // when we copy params from the wearable to the base avatar.
+ for (LLViewerVisualParam* param = (LLViewerVisualParam*) getFirstVisualParam();
+ param;
+ param = (LLViewerVisualParam*) getNextVisualParam())
+ {
+ if (param->getWearableType() != LLWearableType::WT_INVALID)
+ {
+ param->setIsDummy(TRUE);
+ }
+ }
- return success;
+ return success;
}
BOOL LLVOAvatarSelf::loadAvatarSelf()
{
- BOOL success = TRUE;
- // avatar_skeleton.xml
- if (!buildSkeletonSelf(sAvatarSkeletonInfo))
- {
- LL_WARNS() << "avatar file: buildSkeleton() failed" << LL_ENDL;
- return FALSE;
- }
+ BOOL success = TRUE;
+ // avatar_skeleton.xml
+ if (!buildSkeletonSelf(sAvatarSkeletonInfo))
+ {
+ LL_WARNS() << "avatar file: buildSkeleton() failed" << LL_ENDL;
+ return FALSE;
+ }
- return success;
+ return success;
}
BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLAvatarSkeletonInfo *info)
{
- // add special-purpose "screen" joint
- mScreenp = new LLViewerJoint("mScreen", NULL);
- // for now, put screen at origin, as it is only used during special
- // HUD rendering mode
- F32 aspect = LLViewerCamera::getInstance()->getAspect();
- LLVector3 scale(1.f, aspect, 1.f);
- mScreenp->setScale(scale);
- // SL-315
- mScreenp->setWorldPosition(LLVector3::zero);
- // need to update screen agressively when sidebar opens/closes, for example
- mScreenp->mUpdateXform = TRUE;
- return TRUE;
+ // add special-purpose "screen" joint
+ mScreenp = new LLViewerJoint("mScreen", NULL);
+ // for now, put screen at origin, as it is only used during special
+ // HUD rendering mode
+ F32 aspect = LLViewerCamera::getInstance()->getAspect();
+ LLVector3 scale(1.f, aspect, 1.f);
+ mScreenp->setScale(scale);
+ // SL-315
+ mScreenp->setWorldPosition(LLVector3::zero);
+ // need to update screen agressively when sidebar opens/closes, for example
+ mScreenp->mUpdateXform = TRUE;
+ return TRUE;
}
BOOL LLVOAvatarSelf::buildMenus()
{
- //-------------------------------------------------------------------------
- // build the attach and detach menus
- //-------------------------------------------------------------------------
- gAttachBodyPartPieMenus[0] = NULL;
-
- LLContextMenu::Params params;
- params.label(LLTrans::getString("BodyPartsRightArm"));
- params.name(params.label);
- params.visible(false);
- gAttachBodyPartPieMenus[1] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsHead"));
- params.name(params.label);
- gAttachBodyPartPieMenus[2] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsLeftArm"));
- params.name(params.label);
- gAttachBodyPartPieMenus[3] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- gAttachBodyPartPieMenus[4] = NULL;
-
- params.label(LLTrans::getString("BodyPartsLeftLeg"));
- params.name(params.label);
- gAttachBodyPartPieMenus[5] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsTorso"));
- params.name(params.label);
- gAttachBodyPartPieMenus[6] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsRightLeg"));
- params.name(params.label);
- gAttachBodyPartPieMenus[7] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsEnhancedSkeleton"));
- params.name(params.label);
- gAttachBodyPartPieMenus[8] = LLUICtrlFactory::create<LLContextMenu>(params);
-
- gDetachBodyPartPieMenus[0] = NULL;
-
- params.label(LLTrans::getString("BodyPartsRightArm"));
- params.name(params.label);
- gDetachBodyPartPieMenus[1] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsHead"));
- params.name(params.label);
- gDetachBodyPartPieMenus[2] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsLeftArm"));
- params.name(params.label);
- gDetachBodyPartPieMenus[3] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- gDetachBodyPartPieMenus[4] = NULL;
-
- params.label(LLTrans::getString("BodyPartsLeftLeg"));
- params.name(params.label);
- gDetachBodyPartPieMenus[5] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsTorso"));
- params.name(params.label);
- gDetachBodyPartPieMenus[6] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsRightLeg"));
- params.name(params.label);
- gDetachBodyPartPieMenus[7] = LLUICtrlFactory::create<LLContextMenu> (params);
-
- params.label(LLTrans::getString("BodyPartsEnhancedSkeleton"));
- params.name(params.label);
- gDetachBodyPartPieMenus[8] = LLUICtrlFactory::create<LLContextMenu>(params);
-
- for (S32 i = 0; i < 9; i++)
- {
- if (gAttachBodyPartPieMenus[i])
- {
- gAttachPieMenu->appendContextSubMenu( gAttachBodyPartPieMenus[i] );
- }
- else
- {
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment && attachment->getGroup() == i)
- {
- LLMenuItemCallGL::Params item_params;
-
- std::string sub_piemenu_name = attachment->getName();
- if (LLTrans::getString(sub_piemenu_name) != "")
- {
- item_params.label = LLTrans::getString(sub_piemenu_name);
- }
- else
- {
- item_params.label = sub_piemenu_name;
- }
- item_params.name =(item_params.label );
- item_params.on_click.function_name = "Object.AttachToAvatar";
- item_params.on_click.parameter = iter->first;
- item_params.on_enable.function_name = "Object.EnableWear";
- item_params.on_enable.parameter = iter->first;
- LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
-
- gAttachPieMenu->addChild(item);
-
- break;
-
- }
- }
- }
-
- if (gDetachBodyPartPieMenus[i])
- {
- gDetachPieMenu->appendContextSubMenu( gDetachBodyPartPieMenus[i] );
- gDetachAttSelfMenu->appendContextSubMenu(gDetachBodyPartPieMenus[i]);
- gDetachAvatarMenu->appendContextSubMenu(gDetachBodyPartPieMenus[i]);
- }
- else
- {
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment && attachment->getGroup() == i)
- {
- LLMenuItemCallGL::Params item_params;
- std::string sub_piemenu_name = attachment->getName();
- if (LLTrans::getString(sub_piemenu_name) != "")
- {
- item_params.label = LLTrans::getString(sub_piemenu_name);
- }
- else
- {
- item_params.label = sub_piemenu_name;
- }
- item_params.name =(item_params.label );
- item_params.on_click.function_name = "Attachment.DetachFromPoint";
- item_params.on_click.parameter = iter->first;
- item_params.on_enable.function_name = "Attachment.PointFilled";
- item_params.on_enable.parameter = iter->first;
- LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
-
- gDetachPieMenu->addChild(item);
- gDetachAttSelfMenu->addChild(LLUICtrlFactory::create<LLMenuItemCallGL>(item_params));
- gDetachAvatarMenu->addChild(LLUICtrlFactory::create<LLMenuItemCallGL>(item_params));
- break;
- }
- }
- }
- }
-
-
- // add screen attachments
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment->getGroup() == 9)
- {
- LLMenuItemCallGL::Params item_params;
- std::string sub_piemenu_name = attachment->getName();
- if (LLTrans::getString(sub_piemenu_name) != "")
- {
- item_params.label = LLTrans::getString(sub_piemenu_name);
- }
- else
- {
- item_params.label = sub_piemenu_name;
- }
- item_params.name =(item_params.label );
- item_params.on_click.function_name = "Object.AttachToAvatar";
- item_params.on_click.parameter = iter->first;
- item_params.on_enable.function_name = "Object.EnableWear";
- item_params.on_enable.parameter = iter->first;
- LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
- gAttachScreenPieMenu->addChild(item);
-
- item_params.on_click.function_name = "Attachment.DetachFromPoint";
- item_params.on_click.parameter = iter->first;
- item_params.on_enable.function_name = "Attachment.PointFilled";
- item_params.on_enable.parameter = iter->first;
- item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
- gDetachScreenPieMenu->addChild(item);
- gDetachHUDAttSelfMenu->addChild(LLUICtrlFactory::create<LLMenuItemCallGL>(item_params));
- gDetachHUDAvatarMenu->addChild(LLUICtrlFactory::create<LLMenuItemCallGL>(item_params));
- }
- }
-
- for (S32 pass = 0; pass < 2; pass++)
- {
- // *TODO: Skinning - gAttachSubMenu is an awful, awful hack
- if (!gAttachSubMenu)
- {
- break;
- }
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment->getIsHUDAttachment() != (pass == 1))
- {
- continue;
- }
- LLMenuItemCallGL::Params item_params;
- std::string sub_piemenu_name = attachment->getName();
- if (LLTrans::getString(sub_piemenu_name) != "")
- {
- item_params.label = LLTrans::getString(sub_piemenu_name);
- }
- else
- {
- item_params.label = sub_piemenu_name;
- }
- item_params.name =(item_params.label );
- item_params.on_click.function_name = "Object.AttachToAvatar";
- item_params.on_click.parameter = iter->first;
- item_params.on_enable.function_name = "Object.EnableWear";
- item_params.on_enable.parameter = iter->first;
- //* TODO: Skinning:
- //LLSD params;
- //params["index"] = iter->first;
- //params["label"] = attachment->getName();
- //item->addEventHandler("on_enable", LLMenuItemCallGL::MenuCallback().function_name("Attachment.Label").parameter(params));
-
- LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
- gAttachSubMenu->addChild(item);
-
- item_params.on_click.function_name = "Attachment.DetachFromPoint";
- item_params.on_click.parameter = iter->first;
- item_params.on_enable.function_name = "Attachment.PointFilled";
- item_params.on_enable.parameter = iter->first;
- //* TODO: Skinning: item->addEventHandler("on_enable", LLMenuItemCallGL::MenuCallback().function_name("Attachment.Label").parameter(params));
-
- item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
- gDetachSubMenu->addChild(item);
- }
- if (pass == 0)
- {
- // put separator between non-hud and hud attachments
- gAttachSubMenu->addSeparator();
- gDetachSubMenu->addSeparator();
- }
- }
-
- for (S32 group = 0; group < 9; group++)
- {
- // skip over groups that don't have sub menus
- if (!gAttachBodyPartPieMenus[group] || !gDetachBodyPartPieMenus[group])
- {
- continue;
- }
-
- std::multimap<S32, S32> attachment_pie_menu_map;
-
- // gather up all attachment points assigned to this group, and throw into map sorted by pie slice number
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if(attachment && attachment->getGroup() == group)
- {
- // use multimap to provide a partial order off of the pie slice key
- S32 pie_index = attachment->getPieSlice();
- attachment_pie_menu_map.insert(std::make_pair(pie_index, iter->first));
- }
- }
-
- // add in requested order to pie menu, inserting separators as necessary
- for (std::multimap<S32, S32>::iterator attach_it = attachment_pie_menu_map.begin();
- attach_it != attachment_pie_menu_map.end(); ++attach_it)
- {
- S32 attach_index = attach_it->second;
-
- LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL);
- if (attachment)
- {
- LLMenuItemCallGL::Params item_params;
- item_params.name = attachment->getName();
- item_params.label = LLTrans::getString(attachment->getName());
- item_params.on_click.function_name = "Object.AttachToAvatar";
- item_params.on_click.parameter = attach_index;
- item_params.on_enable.function_name = "Object.EnableWear";
- item_params.on_enable.parameter = attach_index;
-
- LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
- gAttachBodyPartPieMenus[group]->addChild(item);
-
- item_params.on_click.function_name = "Attachment.DetachFromPoint";
- item_params.on_click.parameter = attach_index;
- item_params.on_enable.function_name = "Attachment.PointFilled";
- item_params.on_enable.parameter = attach_index;
- item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
- gDetachBodyPartPieMenus[group]->addChild(item);
- }
- }
- }
- return TRUE;
+ //-------------------------------------------------------------------------
+ // build the attach and detach menus
+ //-------------------------------------------------------------------------
+ gAttachBodyPartPieMenus[0] = NULL;
+
+ LLContextMenu::Params params;
+ params.label(LLTrans::getString("BodyPartsRightArm"));
+ params.name(params.label);
+ params.visible(false);
+ gAttachBodyPartPieMenus[1] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsHead"));
+ params.name(params.label);
+ gAttachBodyPartPieMenus[2] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsLeftArm"));
+ params.name(params.label);
+ gAttachBodyPartPieMenus[3] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ gAttachBodyPartPieMenus[4] = NULL;
+
+ params.label(LLTrans::getString("BodyPartsLeftLeg"));
+ params.name(params.label);
+ gAttachBodyPartPieMenus[5] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsTorso"));
+ params.name(params.label);
+ gAttachBodyPartPieMenus[6] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsRightLeg"));
+ params.name(params.label);
+ gAttachBodyPartPieMenus[7] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsEnhancedSkeleton"));
+ params.name(params.label);
+ gAttachBodyPartPieMenus[8] = LLUICtrlFactory::create<LLContextMenu>(params);
+
+ gDetachBodyPartPieMenus[0] = NULL;
+
+ params.label(LLTrans::getString("BodyPartsRightArm"));
+ params.name(params.label);
+ gDetachBodyPartPieMenus[1] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsHead"));
+ params.name(params.label);
+ gDetachBodyPartPieMenus[2] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsLeftArm"));
+ params.name(params.label);
+ gDetachBodyPartPieMenus[3] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ gDetachBodyPartPieMenus[4] = NULL;
+
+ params.label(LLTrans::getString("BodyPartsLeftLeg"));
+ params.name(params.label);
+ gDetachBodyPartPieMenus[5] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsTorso"));
+ params.name(params.label);
+ gDetachBodyPartPieMenus[6] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsRightLeg"));
+ params.name(params.label);
+ gDetachBodyPartPieMenus[7] = LLUICtrlFactory::create<LLContextMenu> (params);
+
+ params.label(LLTrans::getString("BodyPartsEnhancedSkeleton"));
+ params.name(params.label);
+ gDetachBodyPartPieMenus[8] = LLUICtrlFactory::create<LLContextMenu>(params);
+
+ for (S32 i = 0; i < 9; i++)
+ {
+ if (gAttachBodyPartPieMenus[i])
+ {
+ gAttachPieMenu->appendContextSubMenu( gAttachBodyPartPieMenus[i] );
+ }
+ else
+ {
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment && attachment->getGroup() == i)
+ {
+ LLMenuItemCallGL::Params item_params;
+
+ std::string sub_piemenu_name = attachment->getName();
+ if (LLTrans::getString(sub_piemenu_name) != "")
+ {
+ item_params.label = LLTrans::getString(sub_piemenu_name);
+ }
+ else
+ {
+ item_params.label = sub_piemenu_name;
+ }
+ item_params.name =(item_params.label );
+ item_params.on_click.function_name = "Object.AttachToAvatar";
+ item_params.on_click.parameter = iter->first;
+ item_params.on_enable.function_name = "Object.EnableWear";
+ item_params.on_enable.parameter = iter->first;
+ LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
+
+ gAttachPieMenu->addChild(item);
+
+ break;
+
+ }
+ }
+ }
+
+ if (gDetachBodyPartPieMenus[i])
+ {
+ gDetachPieMenu->appendContextSubMenu( gDetachBodyPartPieMenus[i] );
+ gDetachAttSelfMenu->appendContextSubMenu(gDetachBodyPartPieMenus[i]);
+ gDetachAvatarMenu->appendContextSubMenu(gDetachBodyPartPieMenus[i]);
+ }
+ else
+ {
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment && attachment->getGroup() == i)
+ {
+ LLMenuItemCallGL::Params item_params;
+ std::string sub_piemenu_name = attachment->getName();
+ if (LLTrans::getString(sub_piemenu_name) != "")
+ {
+ item_params.label = LLTrans::getString(sub_piemenu_name);
+ }
+ else
+ {
+ item_params.label = sub_piemenu_name;
+ }
+ item_params.name =(item_params.label );
+ item_params.on_click.function_name = "Attachment.DetachFromPoint";
+ item_params.on_click.parameter = iter->first;
+ item_params.on_enable.function_name = "Attachment.PointFilled";
+ item_params.on_enable.parameter = iter->first;
+ LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
+
+ gDetachPieMenu->addChild(item);
+ gDetachAttSelfMenu->addChild(LLUICtrlFactory::create<LLMenuItemCallGL>(item_params));
+ gDetachAvatarMenu->addChild(LLUICtrlFactory::create<LLMenuItemCallGL>(item_params));
+ break;
+ }
+ }
+ }
+ }
+
+
+ // add screen attachments
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment->getGroup() == 9)
+ {
+ LLMenuItemCallGL::Params item_params;
+ std::string sub_piemenu_name = attachment->getName();
+ if (LLTrans::getString(sub_piemenu_name) != "")
+ {
+ item_params.label = LLTrans::getString(sub_piemenu_name);
+ }
+ else
+ {
+ item_params.label = sub_piemenu_name;
+ }
+ item_params.name =(item_params.label );
+ item_params.on_click.function_name = "Object.AttachToAvatar";
+ item_params.on_click.parameter = iter->first;
+ item_params.on_enable.function_name = "Object.EnableWear";
+ item_params.on_enable.parameter = iter->first;
+ LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
+ gAttachScreenPieMenu->addChild(item);
+
+ item_params.on_click.function_name = "Attachment.DetachFromPoint";
+ item_params.on_click.parameter = iter->first;
+ item_params.on_enable.function_name = "Attachment.PointFilled";
+ item_params.on_enable.parameter = iter->first;
+ item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
+ gDetachScreenPieMenu->addChild(item);
+ gDetachHUDAttSelfMenu->addChild(LLUICtrlFactory::create<LLMenuItemCallGL>(item_params));
+ gDetachHUDAvatarMenu->addChild(LLUICtrlFactory::create<LLMenuItemCallGL>(item_params));
+ }
+ }
+
+ for (S32 pass = 0; pass < 2; pass++)
+ {
+ // *TODO: Skinning - gAttachSubMenu is an awful, awful hack
+ if (!gAttachSubMenu)
+ {
+ break;
+ }
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment->getIsHUDAttachment() != (pass == 1))
+ {
+ continue;
+ }
+ LLMenuItemCallGL::Params item_params;
+ std::string sub_piemenu_name = attachment->getName();
+ if (LLTrans::getString(sub_piemenu_name) != "")
+ {
+ item_params.label = LLTrans::getString(sub_piemenu_name);
+ }
+ else
+ {
+ item_params.label = sub_piemenu_name;
+ }
+ item_params.name =(item_params.label );
+ item_params.on_click.function_name = "Object.AttachToAvatar";
+ item_params.on_click.parameter = iter->first;
+ item_params.on_enable.function_name = "Object.EnableWear";
+ item_params.on_enable.parameter = iter->first;
+ //* TODO: Skinning:
+ //LLSD params;
+ //params["index"] = iter->first;
+ //params["label"] = attachment->getName();
+ //item->addEventHandler("on_enable", LLMenuItemCallGL::MenuCallback().function_name("Attachment.Label").parameter(params));
+
+ LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
+ gAttachSubMenu->addChild(item);
+
+ item_params.on_click.function_name = "Attachment.DetachFromPoint";
+ item_params.on_click.parameter = iter->first;
+ item_params.on_enable.function_name = "Attachment.PointFilled";
+ item_params.on_enable.parameter = iter->first;
+ //* TODO: Skinning: item->addEventHandler("on_enable", LLMenuItemCallGL::MenuCallback().function_name("Attachment.Label").parameter(params));
+
+ item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
+ gDetachSubMenu->addChild(item);
+ }
+ if (pass == 0)
+ {
+ // put separator between non-hud and hud attachments
+ gAttachSubMenu->addSeparator();
+ gDetachSubMenu->addSeparator();
+ }
+ }
+
+ for (S32 group = 0; group < 9; group++)
+ {
+ // skip over groups that don't have sub menus
+ if (!gAttachBodyPartPieMenus[group] || !gDetachBodyPartPieMenus[group])
+ {
+ continue;
+ }
+
+ std::multimap<S32, S32> attachment_pie_menu_map;
+
+ // gather up all attachment points assigned to this group, and throw into map sorted by pie slice number
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if(attachment && attachment->getGroup() == group)
+ {
+ // use multimap to provide a partial order off of the pie slice key
+ S32 pie_index = attachment->getPieSlice();
+ attachment_pie_menu_map.insert(std::make_pair(pie_index, iter->first));
+ }
+ }
+
+ // add in requested order to pie menu, inserting separators as necessary
+ for (std::multimap<S32, S32>::iterator attach_it = attachment_pie_menu_map.begin();
+ attach_it != attachment_pie_menu_map.end(); ++attach_it)
+ {
+ S32 attach_index = attach_it->second;
+
+ LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL);
+ if (attachment)
+ {
+ LLMenuItemCallGL::Params item_params;
+ item_params.name = attachment->getName();
+ item_params.label = LLTrans::getString(attachment->getName());
+ item_params.on_click.function_name = "Object.AttachToAvatar";
+ item_params.on_click.parameter = attach_index;
+ item_params.on_enable.function_name = "Object.EnableWear";
+ item_params.on_enable.parameter = attach_index;
+
+ LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
+ gAttachBodyPartPieMenus[group]->addChild(item);
+
+ item_params.on_click.function_name = "Attachment.DetachFromPoint";
+ item_params.on_click.parameter = attach_index;
+ item_params.on_enable.function_name = "Attachment.PointFilled";
+ item_params.on_enable.parameter = attach_index;
+ item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
+ gDetachBodyPartPieMenus[group]->addChild(item);
+ }
+ }
+ }
+ return TRUE;
}
void LLVOAvatarSelf::cleanup()
{
- markDead();
- delete mScreenp;
- mScreenp = NULL;
- mRegionp = NULL;
+ markDead();
+ delete mScreenp;
+ mScreenp = NULL;
+ mRegionp = NULL;
}
LLVOAvatarSelf::~LLVOAvatarSelf()
{
- cleanup();
+ cleanup();
}
/**
@@ -677,33 +677,33 @@ LLVOAvatarSelf::~LLVOAvatarSelf()
// virtual
bool LLVOAvatarSelf::updateCharacter(LLAgent &agent)
{
- // update screen joint size
- if (mScreenp)
- {
- F32 aspect = LLViewerCamera::getInstance()->getAspect();
- LLVector3 scale(1.f, aspect, 1.f);
- mScreenp->setScale(scale);
- mScreenp->updateWorldMatrixChildren();
- resetHUDAttachments();
- }
-
- return LLVOAvatar::updateCharacter(agent);
+ // update screen joint size
+ if (mScreenp)
+ {
+ F32 aspect = LLViewerCamera::getInstance()->getAspect();
+ LLVector3 scale(1.f, aspect, 1.f);
+ mScreenp->setScale(scale);
+ mScreenp->updateWorldMatrixChildren();
+ resetHUDAttachments();
+ }
+
+ return LLVOAvatar::updateCharacter(agent);
}
// virtual
BOOL LLVOAvatarSelf::isValid() const
{
- return ((getRegion() != NULL) && !isDead());
+ return ((getRegion() != NULL) && !isDead());
}
// virtual
void LLVOAvatarSelf::idleUpdate(LLAgent &agent, const F64 &time)
{
- if (isValid())
- {
- LLVOAvatar::idleUpdate(agent, time);
- idleUpdateTractorBeam();
- }
+ if (isValid())
+ {
+ LLVOAvatar::idleUpdate(agent, time);
+ idleUpdateTractorBeam();
+ }
}
// virtual
@@ -711,14 +711,14 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
{
LLJoint *jointp = NULL;
jointp = LLVOAvatar::getJoint(name);
- if (!jointp && mScreenp)
- {
- jointp = mScreenp->findJoint(name);
+ if (!jointp && mScreenp)
+ {
+ jointp = mScreenp->findJoint(name);
if (jointp)
{
mJointMap[name] = jointp;
}
- }
+ }
if (jointp && jointp != mScreenp && jointp != mRoot)
{
llassert(LLVOAvatar::getJoint((S32)jointp->getJointNum())==jointp);
@@ -729,238 +729,238 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
// virtual
BOOL LLVOAvatarSelf::setVisualParamWeight(const LLVisualParam *which_param, F32 weight)
{
- if (!which_param)
- {
- return FALSE;
- }
- LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(which_param->getID());
- return setParamWeight(param,weight);
+ if (!which_param)
+ {
+ return FALSE;
+ }
+ LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(which_param->getID());
+ return setParamWeight(param,weight);
}
// virtual
BOOL LLVOAvatarSelf::setVisualParamWeight(const char* param_name, F32 weight)
{
- if (!param_name)
- {
- return FALSE;
- }
- LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(param_name);
- return setParamWeight(param,weight);
+ if (!param_name)
+ {
+ return FALSE;
+ }
+ LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(param_name);
+ return setParamWeight(param,weight);
}
// virtual
BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight)
{
- LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(index);
- return setParamWeight(param,weight);
+ LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(index);
+ return setParamWeight(param,weight);
}
BOOL LLVOAvatarSelf::setParamWeight(const LLViewerVisualParam *param, F32 weight)
{
- if (!param)
- {
- return FALSE;
- }
-
- if (param->getCrossWearable())
- {
- LLWearableType::EType type = (LLWearableType::EType)param->getWearableType();
- U32 size = gAgentWearables.getWearableCount(type);
- for (U32 count = 0; count < size; ++count)
- {
- LLViewerWearable *wearable = gAgentWearables.getViewerWearable(type,count);
- if (wearable)
- {
- wearable->setVisualParamWeight(param->getID(), weight);
- }
- }
- }
-
- return LLCharacter::setVisualParamWeight(param,weight);
-}
-
-/*virtual*/
+ if (!param)
+ {
+ return FALSE;
+ }
+
+ if (param->getCrossWearable())
+ {
+ LLWearableType::EType type = (LLWearableType::EType)param->getWearableType();
+ U32 size = gAgentWearables.getWearableCount(type);
+ for (U32 count = 0; count < size; ++count)
+ {
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable(type,count);
+ if (wearable)
+ {
+ wearable->setVisualParamWeight(param->getID(), weight);
+ }
+ }
+ }
+
+ return LLCharacter::setVisualParamWeight(param,weight);
+}
+
+/*virtual*/
void LLVOAvatarSelf::updateVisualParams()
{
- LLVOAvatar::updateVisualParams();
+ LLVOAvatar::updateVisualParams();
}
void LLVOAvatarSelf::writeWearablesToAvatar()
{
- for (U32 type = 0; type < LLWearableType::WT_COUNT; type++)
- {
- LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type);
- if (wearable)
- {
- wearable->writeToAvatar(this);
- }
- }
+ for (U32 type = 0; type < LLWearableType::WT_COUNT; type++)
+ {
+ LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type);
+ if (wearable)
+ {
+ wearable->writeToAvatar(this);
+ }
+ }
}
/*virtual*/
void LLVOAvatarSelf::idleUpdateAppearanceAnimation()
{
- // Animate all top-level wearable visual parameters
- gAgentWearables.animateAllWearableParams(calcMorphAmount());
+ // Animate all top-level wearable visual parameters
+ gAgentWearables.animateAllWearableParams(calcMorphAmount());
- // Apply wearable visual params to avatar
- writeWearablesToAvatar();
+ // Apply wearable visual params to avatar
+ writeWearablesToAvatar();
- //allow avatar to process updates
- LLVOAvatar::idleUpdateAppearanceAnimation();
+ //allow avatar to process updates
+ LLVOAvatar::idleUpdateAppearanceAnimation();
}
// virtual
void LLVOAvatarSelf::requestStopMotion(LLMotion* motion)
{
- // Only agent avatars should handle the stop motion notifications.
+ // Only agent avatars should handle the stop motion notifications.
- // Notify agent that motion has stopped
- gAgent.requestStopMotion(motion);
+ // Notify agent that motion has stopped
+ gAgent.requestStopMotion(motion);
}
// virtual
bool LLVOAvatarSelf::hasMotionFromSource(const LLUUID& source_id)
{
- AnimSourceIterator motion_it = mAnimationSources.find(source_id);
- return motion_it != mAnimationSources.end();
+ AnimSourceIterator motion_it = mAnimationSources.find(source_id);
+ return motion_it != mAnimationSources.end();
}
// virtual
void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id)
{
- for (AnimSourceIterator motion_it = mAnimationSources.find(source_id); motion_it != mAnimationSources.end(); )
- {
- gAgent.sendAnimationRequest(motion_it->second, ANIM_REQUEST_STOP);
- mAnimationSources.erase(motion_it);
- // Must find() after each erase() to deal with potential iterator invalidation
- // This also ensures that we don't go past the end of this source's animations
- // into those of another source.
- motion_it = mAnimationSources.find(source_id);
- }
+ for (AnimSourceIterator motion_it = mAnimationSources.find(source_id); motion_it != mAnimationSources.end(); )
+ {
+ gAgent.sendAnimationRequest(motion_it->second, ANIM_REQUEST_STOP);
+ mAnimationSources.erase(motion_it);
+ // Must find() after each erase() to deal with potential iterator invalidation
+ // This also ensures that we don't go past the end of this source's animations
+ // into those of another source.
+ motion_it = mAnimationSources.find(source_id);
+ }
- LLViewerObject* object = gObjectList.findObject(source_id);
- if (object)
- {
- object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, FALSE);
- }
+ LLViewerObject* object = gObjectList.findObject(source_id);
+ if (object)
+ {
+ object->setFlagsWithoutUpdate(FLAGS_ANIM_SOURCE, FALSE);
+ }
}
void LLVOAvatarSelf::setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index)
{
- if (te >= TEX_NUM_INDICES)
- {
- llassert(0);
- return;
- }
+ if (te >= TEX_NUM_INDICES)
+ {
+ llassert(0);
+ return;
+ }
- if (getTEImage(te)->getID() == image->getID())
- {
- return;
- }
+ if (getTEImage(te)->getID() == image->getID())
+ {
+ return;
+ }
- if (isIndexBakedTexture((ETextureIndex)te))
- {
- llassert(0);
- return;
- }
+ if (isIndexBakedTexture((ETextureIndex)te))
+ {
+ llassert(0);
+ return;
+ }
- setTEImage(te, image);
+ setTEImage(te, image);
}
//virtual
void LLVOAvatarSelf::removeMissingBakedTextures()
-{
- BOOL removed = FALSE;
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- const S32 te = mBakedTextureDatas[i].mTextureIndex;
- const LLViewerTexture* tex = getTEImage(te);
-
- // Replace with default if we can't find the asset, assuming the
- // default is actually valid (which it should be unless something
- // is seriously wrong).
- if (!tex || tex->isMissingAsset())
- {
- LLViewerTexture *imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
- if (imagep && imagep != tex)
- {
- setTEImage(te, imagep);
- removed = TRUE;
- }
- }
- }
-
- if (removed)
- {
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- LLViewerTexLayerSet *layerset = getTexLayerSet(i);
- layerset->setUpdatesEnabled(TRUE);
- invalidateComposite(layerset);
- }
- updateMeshTextures();
- }
+{
+ BOOL removed = FALSE;
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ const S32 te = mBakedTextureDatas[i].mTextureIndex;
+ const LLViewerTexture* tex = getTEImage(te);
+
+ // Replace with default if we can't find the asset, assuming the
+ // default is actually valid (which it should be unless something
+ // is seriously wrong).
+ if (!tex || tex->isMissingAsset())
+ {
+ LLViewerTexture *imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
+ if (imagep && imagep != tex)
+ {
+ setTEImage(te, imagep);
+ removed = TRUE;
+ }
+ }
+ }
+
+ if (removed)
+ {
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ LLViewerTexLayerSet *layerset = getTexLayerSet(i);
+ layerset->setUpdatesEnabled(TRUE);
+ invalidateComposite(layerset);
+ }
+ updateMeshTextures();
+ }
}
void LLVOAvatarSelf::onSimulatorFeaturesReceived(const LLUUID& region_id)
{
- LL_INFOS("Avatar") << "simulator features received, setting hover based on region props" << LL_ENDL;
- setHoverIfRegionEnabled();
+ LL_INFOS("Avatar") << "simulator features received, setting hover based on region props" << LL_ENDL;
+ setHoverIfRegionEnabled();
}
//virtual
void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
{
- // Save the global position
- LLVector3d global_pos_from_old_region = getPositionGlobal();
-
- // Change the region
- setRegion(regionp);
-
- if (regionp)
- { // Set correct region-relative position from global coordinates
- setPositionGlobal(global_pos_from_old_region);
-
- // Diagnostic info
- //LLVector3d pos_from_new_region = getPositionGlobal();
- //LL_INFOS() << "pos_from_old_region is " << global_pos_from_old_region
- // << " while pos_from_new_region is " << pos_from_new_region
- // << LL_ENDL;
-
- // Update hover height, or schedule callback, based on whether
- // it's supported in this region.
- if (regionp->simulatorFeaturesReceived())
- {
- setHoverIfRegionEnabled();
- }
- else
- {
- regionp->setSimulatorFeaturesReceivedCallback(boost::bind(&LLVOAvatarSelf::onSimulatorFeaturesReceived,this,_1));
- }
- }
-
- if (!regionp || (regionp->getHandle() != mLastRegionHandle))
- {
- if (mLastRegionHandle != 0)
- {
- ++mRegionCrossingCount;
- F64Seconds delta(mRegionCrossingTimer.getElapsedTimeF32());
- record(LLStatViewer::REGION_CROSSING_TIME, delta);
-
- // Diagnostics
- LL_INFOS() << "Region crossing took " << (F32)(delta * 1000.0).value() << " ms " << LL_ENDL;
- }
- if (regionp)
- {
- mLastRegionHandle = regionp->getHandle();
- }
- }
- mRegionCrossingTimer.reset();
- LLViewerObject::updateRegion(regionp);
+ // Save the global position
+ LLVector3d global_pos_from_old_region = getPositionGlobal();
+
+ // Change the region
+ setRegion(regionp);
+
+ if (regionp)
+ { // Set correct region-relative position from global coordinates
+ setPositionGlobal(global_pos_from_old_region);
+
+ // Diagnostic info
+ //LLVector3d pos_from_new_region = getPositionGlobal();
+ //LL_INFOS() << "pos_from_old_region is " << global_pos_from_old_region
+ // << " while pos_from_new_region is " << pos_from_new_region
+ // << LL_ENDL;
+
+ // Update hover height, or schedule callback, based on whether
+ // it's supported in this region.
+ if (regionp->simulatorFeaturesReceived())
+ {
+ setHoverIfRegionEnabled();
+ }
+ else
+ {
+ regionp->setSimulatorFeaturesReceivedCallback(boost::bind(&LLVOAvatarSelf::onSimulatorFeaturesReceived,this,_1));
+ }
+ }
+
+ if (!regionp || (regionp->getHandle() != mLastRegionHandle))
+ {
+ if (mLastRegionHandle != 0)
+ {
+ ++mRegionCrossingCount;
+ F64Seconds delta(mRegionCrossingTimer.getElapsedTimeF32());
+ record(LLStatViewer::REGION_CROSSING_TIME, delta);
+
+ // Diagnostics
+ LL_INFOS() << "Region crossing took " << (F32)(delta * 1000.0).value() << " ms " << LL_ENDL;
+ }
+ if (regionp)
+ {
+ mLastRegionHandle = regionp->getHandle();
+ }
+ }
+ mRegionCrossingTimer.reset();
+ LLViewerObject::updateRegion(regionp);
}
//--------------------------------------------------------------------
@@ -969,65 +969,65 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
//virtual
void LLVOAvatarSelf::idleUpdateTractorBeam()
{
- // This is only done for yourself (maybe it should be in the agent?)
- if (!needsRenderBeam() || !isBuilt())
- {
- mBeam = NULL;
- }
- else if (!mBeam || mBeam->isDead())
- {
- // VEFFECT: Tractor Beam
- mBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM);
- mBeam->setColor(LLColor4U(gAgent.getEffectColor()));
- mBeam->setSourceObject(this);
- mBeamTimer.reset();
- }
-
- if (!mBeam.isNull())
- {
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
-
- if (gAgentCamera.mPointAt.notNull())
- {
- // get point from pointat effect
- mBeam->setPositionGlobal(gAgentCamera.mPointAt->getPointAtPosGlobal());
- mBeam->triggerLocal();
- }
- else if (selection->getFirstRootObject() &&
- selection->getSelectType() != SELECT_TYPE_HUD)
- {
- LLViewerObject* objectp = selection->getFirstRootObject();
- mBeam->setTargetObject(objectp);
- }
- else
- {
- mBeam->setTargetObject(NULL);
- LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
- if (tool->isEditing())
- {
- if (tool->getEditingObject())
- {
- mBeam->setTargetObject(tool->getEditingObject());
- }
- else
- {
- mBeam->setPositionGlobal(tool->getEditingPointGlobal());
- }
- }
- else
- {
- const LLPickInfo& pick = gViewerWindow->getLastPick();
- mBeam->setPositionGlobal(pick.mPosGlobal);
- }
-
- }
- if (mBeamTimer.getElapsedTimeF32() > 0.25f)
- {
- mBeam->setColor(LLColor4U(gAgent.getEffectColor()));
- mBeam->setNeedsSendToSim(TRUE);
- mBeamTimer.reset();
- }
- }
+ // This is only done for yourself (maybe it should be in the agent?)
+ if (!needsRenderBeam() || !isBuilt())
+ {
+ mBeam = NULL;
+ }
+ else if (!mBeam || mBeam->isDead())
+ {
+ // VEFFECT: Tractor Beam
+ mBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM);
+ mBeam->setColor(LLColor4U(gAgent.getEffectColor()));
+ mBeam->setSourceObject(this);
+ mBeamTimer.reset();
+ }
+
+ if (!mBeam.isNull())
+ {
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+
+ if (gAgentCamera.mPointAt.notNull())
+ {
+ // get point from pointat effect
+ mBeam->setPositionGlobal(gAgentCamera.mPointAt->getPointAtPosGlobal());
+ mBeam->triggerLocal();
+ }
+ else if (selection->getFirstRootObject() &&
+ selection->getSelectType() != SELECT_TYPE_HUD)
+ {
+ LLViewerObject* objectp = selection->getFirstRootObject();
+ mBeam->setTargetObject(objectp);
+ }
+ else
+ {
+ mBeam->setTargetObject(NULL);
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (tool->isEditing())
+ {
+ if (tool->getEditingObject())
+ {
+ mBeam->setTargetObject(tool->getEditingObject());
+ }
+ else
+ {
+ mBeam->setPositionGlobal(tool->getEditingPointGlobal());
+ }
+ }
+ else
+ {
+ const LLPickInfo& pick = gViewerWindow->getLastPick();
+ mBeam->setPositionGlobal(pick.mPosGlobal);
+ }
+
+ }
+ if (mBeamTimer.getElapsedTimeF32() > 0.25f)
+ {
+ mBeam->setColor(LLColor4U(gAgent.getEffectColor()));
+ mBeam->setNeedsSendToSim(TRUE);
+ mBeamTimer.reset();
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -1036,13 +1036,13 @@ void LLVOAvatarSelf::idleUpdateTractorBeam()
// virtual
void LLVOAvatarSelf::restoreMeshData()
{
- //LL_INFOS() << "Restoring" << LL_ENDL;
- mMeshValid = TRUE;
- updateJointLODs();
- updateAttachmentVisibility(gAgentCamera.getCameraMode());
+ //LL_INFOS() << "Restoring" << LL_ENDL;
+ mMeshValid = TRUE;
+ updateJointLODs();
+ updateAttachmentVisibility(gAgentCamera.getCameraMode());
- // force mesh update as LOD might not have changed to trigger this
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
+ // force mesh update as LOD might not have changed to trigger this
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
}
@@ -1052,35 +1052,35 @@ void LLVOAvatarSelf::restoreMeshData()
//-----------------------------------------------------------------------------
void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode)
{
- for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (attachment->getIsHUDAttachment())
- {
- attachment->setAttachmentVisibility(TRUE);
- }
- else
- {
- switch (camera_mode)
- {
- case CAMERA_MODE_MOUSELOOK:
- if (LLVOAvatar::sVisibleInFirstPerson && attachment->getVisibleInFirstPerson())
- {
- attachment->setAttachmentVisibility(TRUE);
- }
- else
- {
- attachment->setAttachmentVisibility(FALSE);
- }
- break;
- default:
- attachment->setAttachmentVisibility(TRUE);
- break;
- }
- }
- }
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (attachment->getIsHUDAttachment())
+ {
+ attachment->setAttachmentVisibility(TRUE);
+ }
+ else
+ {
+ switch (camera_mode)
+ {
+ case CAMERA_MODE_MOUSELOOK:
+ if (LLVOAvatar::sVisibleInFirstPerson && attachment->getVisibleInFirstPerson())
+ {
+ attachment->setAttachmentVisibility(TRUE);
+ }
+ else
+ {
+ attachment->setAttachmentVisibility(FALSE);
+ }
+ break;
+ default:
+ attachment->setAttachmentVisibility(TRUE);
+ break;
+ }
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -1090,33 +1090,33 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode)
//-----------------------------------------------------------------------------
void LLVOAvatarSelf::wearableUpdated(LLWearableType::EType type)
{
- for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
- baked_iter != sAvatarDictionary->getBakedTextures().end();
- ++baked_iter)
- {
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
- const LLAvatarAppearanceDefines::EBakedTextureIndex index = baked_iter->first;
-
- if (baked_dict)
- {
- for (LLAvatarAppearanceDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin();
- type_iter != baked_dict->mWearables.end();
- ++type_iter)
- {
- const LLWearableType::EType comp_type = *type_iter;
- if (comp_type == type)
- {
- LLViewerTexLayerSet *layerset = getLayerSet(index);
- if (layerset)
- {
- layerset->setUpdatesEnabled(true);
- invalidateComposite(layerset);
- }
- break;
- }
- }
- }
- }
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
+ baked_iter != sAvatarDictionary->getBakedTextures().end();
+ ++baked_iter)
+ {
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDefines::EBakedTextureIndex index = baked_iter->first;
+
+ if (baked_dict)
+ {
+ for (LLAvatarAppearanceDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin();
+ type_iter != baked_dict->mWearables.end();
+ ++type_iter)
+ {
+ const LLWearableType::EType comp_type = *type_iter;
+ if (comp_type == type)
+ {
+ LLViewerTexLayerSet *layerset = getLayerSet(index);
+ if (layerset)
+ {
+ layerset->setUpdatesEnabled(true);
+ invalidateComposite(layerset);
+ }
+ break;
+ }
+ }
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -1124,18 +1124,18 @@ void LLVOAvatarSelf::wearableUpdated(LLWearableType::EType type)
//-----------------------------------------------------------------------------
BOOL LLVOAvatarSelf::isWearingAttachment(const LLUUID& inv_item_id) const
{
- const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id);
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- const LLViewerJointAttachment* attachment = iter->second;
- if (attachment->getAttachedObject(base_inv_item_id))
- {
- return TRUE;
- }
- }
- return FALSE;
+ const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id);
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ const LLViewerJointAttachment* attachment = iter->second;
+ if (attachment->getAttachedObject(base_inv_item_id))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -1143,113 +1143,113 @@ BOOL LLVOAvatarSelf::isWearingAttachment(const LLUUID& inv_item_id) const
//-----------------------------------------------------------------------------
LLViewerObject* LLVOAvatarSelf::getWornAttachment(const LLUUID& inv_item_id)
{
- const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id);
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- LLViewerJointAttachment* attachment = iter->second;
- if (LLViewerObject *attached_object = attachment->getAttachedObject(base_inv_item_id))
- {
- return attached_object;
- }
- }
- return NULL;
+ const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id);
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ if (LLViewerObject *attached_object = attachment->getAttachedObject(base_inv_item_id))
+ {
+ return attached_object;
+ }
+ }
+ return NULL;
}
bool LLVOAvatarSelf::getAttachedPointName(const LLUUID& inv_item_id, std::string& name) const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
- if (!gInventory.getItem(inv_item_id))
- {
- name = "ATTACHMENT_MISSING_ITEM";
- return false;
- }
- const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id);
- if (!gInventory.getItem(base_inv_item_id))
- {
- name = "ATTACHMENT_MISSING_BASE_ITEM";
- return false;
- }
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- const LLViewerJointAttachment* attachment = iter->second;
- if (attachment->getAttachedObject(base_inv_item_id))
- {
- name = attachment->getName();
- return true;
- }
- }
-
- name = "ATTACHMENT_NOT_ATTACHED";
- return false;
+ if (!gInventory.getItem(inv_item_id))
+ {
+ name = "ATTACHMENT_MISSING_ITEM";
+ return false;
+ }
+ const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id);
+ if (!gInventory.getItem(base_inv_item_id))
+ {
+ name = "ATTACHMENT_MISSING_BASE_ITEM";
+ return false;
+ }
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ const LLViewerJointAttachment* attachment = iter->second;
+ if (attachment->getAttachedObject(base_inv_item_id))
+ {
+ name = attachment->getName();
+ return true;
+ }
+ }
+
+ name = "ATTACHMENT_NOT_ATTACHED";
+ return false;
}
//virtual
const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *viewer_object)
{
- const LLViewerJointAttachment *attachment = LLVOAvatar::attachObject(viewer_object);
- if (!attachment)
- {
- return 0;
- }
+ const LLViewerJointAttachment *attachment = LLVOAvatar::attachObject(viewer_object);
+ if (!attachment)
+ {
+ return 0;
+ }
+
+ updateAttachmentVisibility(gAgentCamera.getCameraMode());
- updateAttachmentVisibility(gAgentCamera.getCameraMode());
-
- // Then make sure the inventory is in sync with the avatar.
+ // Then make sure the inventory is in sync with the avatar.
- // Should just be the last object added
- if (attachment->isObjectAttached(viewer_object))
- {
- const LLUUID& attachment_id = viewer_object->getAttachmentItemID();
- LLAppearanceMgr::instance().registerAttachment(attachment_id);
- updateLODRiggedAttachments();
- }
+ // Should just be the last object added
+ if (attachment->isObjectAttached(viewer_object))
+ {
+ const LLUUID& attachment_id = viewer_object->getAttachmentItemID();
+ LLAppearanceMgr::instance().registerAttachment(attachment_id);
+ updateLODRiggedAttachments();
+ }
- return attachment;
+ return attachment;
}
//virtual
BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
{
- const LLUUID attachment_id = viewer_object->getAttachmentItemID();
- if ( LLVOAvatar::detachObject(viewer_object) )
- {
- // the simulator should automatically handle permission revocation
-
- stopMotionFromSource(attachment_id);
- LLFollowCamMgr::getInstance()->setCameraActive(viewer_object->getID(), FALSE);
-
- LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren();
- for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end();
- ++iter)
- {
- LLViewerObject* child_objectp = *iter;
- // the simulator should automatically handle
- // permissions revocation
-
- stopMotionFromSource(child_objectp->getID());
- LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), FALSE);
- }
-
- // Make sure the inventory is in sync with the avatar.
-
- // Update COF contents, don't trigger appearance update.
- if (!isValid())
- {
- LL_INFOS() << "removeItemLinks skipped, avatar is under destruction" << LL_ENDL;
- }
- else
- {
- LLAppearanceMgr::instance().unregisterAttachment(attachment_id);
- }
-
- return TRUE;
- }
- return FALSE;
+ const LLUUID attachment_id = viewer_object->getAttachmentItemID();
+ if ( LLVOAvatar::detachObject(viewer_object) )
+ {
+ // the simulator should automatically handle permission revocation
+
+ stopMotionFromSource(attachment_id);
+ LLFollowCamMgr::getInstance()->setCameraActive(viewer_object->getID(), FALSE);
+
+ LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end();
+ ++iter)
+ {
+ LLViewerObject* child_objectp = *iter;
+ // the simulator should automatically handle
+ // permissions revocation
+
+ stopMotionFromSource(child_objectp->getID());
+ LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), FALSE);
+ }
+
+ // Make sure the inventory is in sync with the avatar.
+
+ // Update COF contents, don't trigger appearance update.
+ if (!isValid())
+ {
+ LL_INFOS() << "removeItemLinks skipped, avatar is under destruction" << LL_ENDL;
+ }
+ else
+ {
+ LLAppearanceMgr::instance().unregisterAttachment(attachment_id);
+ }
+
+ return TRUE;
+ }
+ return FALSE;
}
bool LLVOAvatarSelf::hasAttachmentsInTrash()
@@ -1276,140 +1276,140 @@ bool LLVOAvatarSelf::hasAttachmentsInTrash()
// static
BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id)
{
- LLInventoryItem* item = gInventory.getItem(item_id);
- if (item)
- {
- gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, item_id);
- gMessageSystem->sendReliable(gAgent.getRegionHost());
-
- // This object might have been selected, so let the selection manager know it's gone now
- LLViewerObject *found_obj = gObjectList.findObject(item_id);
- if (found_obj)
- {
- LLSelectMgr::getInstance()->remove(found_obj);
- }
-
- // Error checking in case this object was attached to an invalid point
- // In that case, just remove the item from COF preemptively since detach
- // will fail.
- if (isAgentAvatarValid())
- {
- const LLViewerObject *attached_obj = gAgentAvatarp->getWornAttachment(item_id);
- if (!attached_obj)
- {
- LLAppearanceMgr::instance().removeCOFItemLinks(item_id);
- }
- }
- return TRUE;
- }
- return FALSE;
+ LLInventoryItem* item = gInventory.getItem(item_id);
+ if (item)
+ {
+ gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, item_id);
+ gMessageSystem->sendReliable(gAgent.getRegionHost());
+
+ // This object might have been selected, so let the selection manager know it's gone now
+ LLViewerObject *found_obj = gObjectList.findObject(item_id);
+ if (found_obj)
+ {
+ LLSelectMgr::getInstance()->remove(found_obj);
+ }
+
+ // Error checking in case this object was attached to an invalid point
+ // In that case, just remove the item from COF preemptively since detach
+ // will fail.
+ if (isAgentAvatarValid())
+ {
+ const LLViewerObject *attached_obj = gAgentAvatarp->getWornAttachment(item_id);
+ if (!attached_obj)
+ {
+ LLAppearanceMgr::instance().removeCOFItemLinks(item_id);
+ }
+ }
+ return TRUE;
+ }
+ return FALSE;
}
U32 LLVOAvatarSelf::getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const
{
- LLWearableType::EType type = sAvatarDictionary->getTEWearableType(i);
- return gAgentWearables.getWearableCount(type);
+ LLWearableType::EType type = sAvatarDictionary->getTEWearableType(i);
+ return gAgentWearables.getWearableCount(type);
}
// virtual
void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
-{
-
- const LLUUID& src_id = src_vi->getID();
- LLAvatarTexData *data = (LLAvatarTexData *)userdata;
- ETextureIndex index = data->mIndex;
- if (!isIndexLocalTexture(index)) return;
-
- LLLocalTextureObject *local_tex_obj = getLocalTextureObject(index, 0);
-
- // fix for EXT-268. Preventing using of NULL pointer
- if(NULL == local_tex_obj)
- {
- LL_WARNS("TAG") << "There is no Local Texture Object with index: " << index
- << ", final: " << final
- << LL_ENDL;
- return;
- }
- if (success)
- {
- if (!local_tex_obj->getBakedReady() &&
- local_tex_obj->getImage() != NULL &&
- (local_tex_obj->getID() == src_id) &&
- discard_level < local_tex_obj->getDiscard())
- {
- local_tex_obj->setDiscard(discard_level);
- requestLayerSetUpdate(index);
- if (isEditingAppearance())
- {
- LLVisualParamHint::requestHintUpdates();
- }
- updateMeshTextures();
- }
- }
- else if (final)
- {
- // Failed: asset is missing
- if (!local_tex_obj->getBakedReady() &&
- local_tex_obj->getImage() != NULL &&
- local_tex_obj->getImage()->getID() == src_id)
- {
- local_tex_obj->setDiscard(0);
- requestLayerSetUpdate(index);
- updateMeshTextures();
- }
- }
+{
+
+ const LLUUID& src_id = src_vi->getID();
+ LLAvatarTexData *data = (LLAvatarTexData *)userdata;
+ ETextureIndex index = data->mIndex;
+ if (!isIndexLocalTexture(index)) return;
+
+ LLLocalTextureObject *local_tex_obj = getLocalTextureObject(index, 0);
+
+ // fix for EXT-268. Preventing using of NULL pointer
+ if(NULL == local_tex_obj)
+ {
+ LL_WARNS("TAG") << "There is no Local Texture Object with index: " << index
+ << ", final: " << final
+ << LL_ENDL;
+ return;
+ }
+ if (success)
+ {
+ if (!local_tex_obj->getBakedReady() &&
+ local_tex_obj->getImage() != NULL &&
+ (local_tex_obj->getID() == src_id) &&
+ discard_level < local_tex_obj->getDiscard())
+ {
+ local_tex_obj->setDiscard(discard_level);
+ requestLayerSetUpdate(index);
+ if (isEditingAppearance())
+ {
+ LLVisualParamHint::requestHintUpdates();
+ }
+ updateMeshTextures();
+ }
+ }
+ else if (final)
+ {
+ // Failed: asset is missing
+ if (!local_tex_obj->getBakedReady() &&
+ local_tex_obj->getImage() != NULL &&
+ local_tex_obj->getImage()->getID() == src_id)
+ {
+ local_tex_obj->setDiscard(0);
+ requestLayerSetUpdate(index);
+ updateMeshTextures();
+ }
+ }
}
// virtual
BOOL LLVOAvatarSelf::getLocalTextureGL(ETextureIndex type, LLViewerTexture** tex_pp, U32 index) const
{
- *tex_pp = NULL;
+ *tex_pp = NULL;
- if (!isIndexLocalTexture(type)) return FALSE;
- if (getLocalTextureID(type, index) == IMG_DEFAULT_AVATAR) return TRUE;
+ if (!isIndexLocalTexture(type)) return FALSE;
+ if (getLocalTextureID(type, index) == IMG_DEFAULT_AVATAR) return TRUE;
- const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, index);
- if (!local_tex_obj)
- {
- return FALSE;
- }
- *tex_pp = dynamic_cast<LLViewerTexture*> (local_tex_obj->getImage());
- return TRUE;
+ const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, index);
+ if (!local_tex_obj)
+ {
+ return FALSE;
+ }
+ *tex_pp = dynamic_cast<LLViewerTexture*> (local_tex_obj->getImage());
+ return TRUE;
}
LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
- if (!isIndexLocalTexture(type))
- {
- return NULL;
- }
+ if (!isIndexLocalTexture(type))
+ {
+ return NULL;
+ }
- const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, index);
- if (!local_tex_obj)
- {
- return NULL;
- }
- if (local_tex_obj->getID() == IMG_DEFAULT_AVATAR)
- {
- return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
- }
- return dynamic_cast<LLViewerFetchedTexture*> (local_tex_obj->getImage());
+ const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, index);
+ if (!local_tex_obj)
+ {
+ return NULL;
+ }
+ if (local_tex_obj->getID() == IMG_DEFAULT_AVATAR)
+ {
+ return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
+ }
+ return dynamic_cast<LLViewerFetchedTexture*> (local_tex_obj->getImage());
}
const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) const
{
- if (!isIndexLocalTexture(type)) return IMG_DEFAULT_AVATAR;
+ if (!isIndexLocalTexture(type)) return IMG_DEFAULT_AVATAR;
- const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, index);
- if (local_tex_obj && local_tex_obj->getImage() != NULL)
- {
- return local_tex_obj->getImage()->getID();
- }
- return IMG_DEFAULT_AVATAR;
-}
+ const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, index);
+ if (local_tex_obj && local_tex_obj->getImage() != NULL)
+ {
+ return local_tex_obj->getImage()->getID();
+ }
+ return IMG_DEFAULT_AVATAR;
+}
//-----------------------------------------------------------------------------
@@ -1419,35 +1419,35 @@ const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) c
//-----------------------------------------------------------------------------
BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const
{
- /* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
- return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */
- for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
- baked_iter != sAvatarDictionary->getBakedTextures().end();
- ++baked_iter)
- {
- const EBakedTextureIndex baked_index = baked_iter->first;
- if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
- {
- BOOL ret = true;
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
- for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
- local_tex_iter != baked_dict->mLocalTextures.end();
- ++local_tex_iter)
- {
- const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
- const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
- for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
- {
- BOOL tex_avail = (getLocalDiscardLevel(tex_index, wearable_index) >= 0);
- ret &= tex_avail;
- }
- }
- return ret;
- }
- }
- llassert(0);
- return FALSE;
+ /* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
+ return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
+ baked_iter != sAvatarDictionary->getBakedTextures().end();
+ ++baked_iter)
+ {
+ const EBakedTextureIndex baked_index = baked_iter->first;
+ if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
+ {
+ BOOL ret = true;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
+ for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
+ local_tex_iter != baked_dict->mLocalTextures.end();
+ ++local_tex_iter)
+ {
+ const ETextureIndex tex_index = *local_tex_iter;
+ const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
+ const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
+ for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
+ {
+ BOOL tex_avail = (getLocalDiscardLevel(tex_index, wearable_index) >= 0);
+ ret &= tex_avail;
+ }
+ }
+ return ret;
+ }
+ }
+ llassert(0);
+ return FALSE;
}
//-----------------------------------------------------------------------------
@@ -1458,159 +1458,159 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* laye
//-----------------------------------------------------------------------------
BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const
{
- const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
- // const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels.
-
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- if (layerset == mBakedTextureDatas[i].mTexLayerSet)
- {
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture((EBakedTextureIndex)i);
- for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
- local_tex_iter != baked_dict->mLocalTextures.end();
- ++local_tex_iter)
- {
- const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
- const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
- for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
- {
- S32 local_discard_level = getLocalDiscardLevel(*local_tex_iter, wearable_index);
- if ((local_discard_level > (S32)(desired_tex_discard_level)) ||
- (local_discard_level < 0 ))
- {
- return FALSE;
- }
- }
- }
- return TRUE;
- }
- }
- llassert(0);
- return FALSE;
+ const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
+ // const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels.
+
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ if (layerset == mBakedTextureDatas[i].mTexLayerSet)
+ {
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture((EBakedTextureIndex)i);
+ for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
+ local_tex_iter != baked_dict->mLocalTextures.end();
+ ++local_tex_iter)
+ {
+ const ETextureIndex tex_index = *local_tex_iter;
+ const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
+ const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
+ for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
+ {
+ S32 local_discard_level = getLocalDiscardLevel(*local_tex_iter, wearable_index);
+ if ((local_discard_level > (S32)(desired_tex_discard_level)) ||
+ (local_discard_level < 0 ))
+ {
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+ }
+ }
+ llassert(0);
+ return FALSE;
}
BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
{
- const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
- // const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels
-
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture((EBakedTextureIndex)i);
- for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
- local_tex_iter != baked_dict->mLocalTextures.end();
- ++local_tex_iter)
- {
- const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
- const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
- for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
- {
- S32 local_discard_level = getLocalDiscardLevel(*local_tex_iter, wearable_index);
- if ((local_discard_level > (S32)(desired_tex_discard_level)) ||
- (local_discard_level < 0 ))
- {
- return FALSE;
- }
- }
- }
- }
- return TRUE;
+ const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
+ // const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels
+
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture((EBakedTextureIndex)i);
+ for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
+ local_tex_iter != baked_dict->mLocalTextures.end();
+ ++local_tex_iter)
+ {
+ const ETextureIndex tex_index = *local_tex_iter;
+ const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
+ const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
+ for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
+ {
+ S32 local_discard_level = getLocalDiscardLevel(*local_tex_iter, wearable_index);
+ if ((local_discard_level > (S32)(desired_tex_discard_level)) ||
+ (local_discard_level < 0 ))
+ {
+ return FALSE;
+ }
+ }
+ }
+ }
+ return TRUE;
}
BOOL LLVOAvatarSelf::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
- LLUUID id;
- BOOL isDefined = TRUE;
- if (isIndexLocalTexture(type))
- {
- const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(type);
- const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
- if (index >= wearable_count)
- {
- // invalid index passed in. check all textures of a given type
- for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
- {
- id = getLocalTextureID(type, wearable_index);
- isDefined &= (id != IMG_DEFAULT_AVATAR && id != IMG_DEFAULT);
- }
- }
- else
- {
- id = getLocalTextureID(type, index);
- isDefined &= (id != IMG_DEFAULT_AVATAR && id != IMG_DEFAULT);
- }
- }
- else
- {
- id = getTEImage(type)->getID();
- isDefined &= (id != IMG_DEFAULT_AVATAR && id != IMG_DEFAULT);
- }
-
- return isDefined;
+ LLUUID id;
+ BOOL isDefined = TRUE;
+ if (isIndexLocalTexture(type))
+ {
+ const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(type);
+ const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
+ if (index >= wearable_count)
+ {
+ // invalid index passed in. check all textures of a given type
+ for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
+ {
+ id = getLocalTextureID(type, wearable_index);
+ isDefined &= (id != IMG_DEFAULT_AVATAR && id != IMG_DEFAULT);
+ }
+ }
+ else
+ {
+ id = getLocalTextureID(type, index);
+ isDefined &= (id != IMG_DEFAULT_AVATAR && id != IMG_DEFAULT);
+ }
+ }
+ else
+ {
+ id = getTEImage(type)->getID();
+ isDefined &= (id != IMG_DEFAULT_AVATAR && id != IMG_DEFAULT);
+ }
+
+ return isDefined;
}
//virtual
BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
- if (isIndexBakedTexture(type))
- {
- return LLVOAvatar::isTextureVisible(type, (U32)0);
- }
+ if (isIndexBakedTexture(type))
+ {
+ return LLVOAvatar::isTextureVisible(type, (U32)0);
+ }
- LLUUID tex_id = getLocalTextureID(type,index);
- return (tex_id != IMG_INVISIBLE)
- || (LLDrawPoolAlpha::sShowDebugAlpha);
+ LLUUID tex_id = getLocalTextureID(type,index);
+ return (tex_id != IMG_INVISIBLE)
+ || (LLDrawPoolAlpha::sShowDebugAlpha);
}
//virtual
BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const
{
- if (isIndexBakedTexture(type))
- {
- return LLVOAvatar::isTextureVisible(type);
- }
+ if (isIndexBakedTexture(type))
+ {
+ return LLVOAvatar::isTextureVisible(type);
+ }
- U32 index;
- if (gAgentWearables.getWearableIndex(wearable,index))
- {
- return isTextureVisible(type,index);
- }
- else
- {
- LL_WARNS() << "Wearable not found" << LL_ENDL;
- return FALSE;
- }
+ U32 index;
+ if (gAgentWearables.getWearableIndex(wearable,index))
+ {
+ return isTextureVisible(type,index);
+ }
+ else
+ {
+ LL_WARNS() << "Wearable not found" << LL_ENDL;
+ return FALSE;
+ }
}
bool LLVOAvatarSelf::areTexturesCurrent() const
{
- return gAgentWearables.areWearablesLoaded();
+ return gAgentWearables.areWearablesLoaded();
}
void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset)
{
- LLViewerTexLayerSet *layer_set = dynamic_cast<LLViewerTexLayerSet*>(layerset);
- if( !layer_set || !layer_set->getUpdatesEnabled() )
- {
- return;
- }
- // LL_INFOS() << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegionName() << LL_ENDL;
+ LLViewerTexLayerSet *layer_set = dynamic_cast<LLViewerTexLayerSet*>(layerset);
+ if( !layer_set || !layer_set->getUpdatesEnabled() )
+ {
+ return;
+ }
+ // LL_INFOS() << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegionName() << LL_ENDL;
- layer_set->requestUpdate();
- layer_set->invalidateMorphMasks();
+ layer_set->requestUpdate();
+ layer_set->invalidateMorphMasks();
}
void LLVOAvatarSelf::invalidateAll()
{
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- LLViewerTexLayerSet *layerset = getTexLayerSet(i);
- invalidateComposite(layerset);
- }
- //mDebugSelfLoadTimer.reset();
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ LLViewerTexLayerSet *layerset = getTexLayerSet(i);
+ invalidateComposite(layerset);
+ }
+ //mDebugSelfLoadTimer.reset();
}
//-----------------------------------------------------------------------------
@@ -1618,593 +1618,593 @@ void LLVOAvatarSelf::invalidateAll()
//-----------------------------------------------------------------------------
void LLVOAvatarSelf::setCompositeUpdatesEnabled( bool b )
{
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- setCompositeUpdatesEnabled(i, b);
- }
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ setCompositeUpdatesEnabled(i, b);
+ }
}
void LLVOAvatarSelf::setCompositeUpdatesEnabled(U32 index, bool b)
{
- LLViewerTexLayerSet *layerset = getTexLayerSet(index);
- if (layerset )
- {
- layerset->setUpdatesEnabled( b );
- }
+ LLViewerTexLayerSet *layerset = getTexLayerSet(index);
+ if (layerset )
+ {
+ layerset->setUpdatesEnabled( b );
+ }
}
bool LLVOAvatarSelf::isCompositeUpdateEnabled(U32 index)
{
- LLViewerTexLayerSet *layerset = getTexLayerSet(index);
- if (layerset)
- {
- return layerset->getUpdatesEnabled();
- }
- return false;
+ LLViewerTexLayerSet *layerset = getTexLayerSet(index);
+ if (layerset)
+ {
+ return layerset->getUpdatesEnabled();
+ }
+ return false;
}
void LLVOAvatarSelf::setupComposites()
{
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex;
- BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index));
- LLViewerTexLayerSet *layerset = getTexLayerSet(i);
- if (layerset)
- {
- layerset->setUpdatesEnabled(!layer_baked);
- }
- }
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex;
+ BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index));
+ LLViewerTexLayerSet *layerset = getTexLayerSet(i);
+ if (layerset)
+ {
+ layerset->setUpdatesEnabled(!layer_baked);
+ }
+ }
}
void LLVOAvatarSelf::updateComposites()
{
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- LLViewerTexLayerSet *layerset = getTexLayerSet(i);
- if (layerset
- && ((i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT)))
- {
- layerset->updateComposite();
- }
- }
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ LLViewerTexLayerSet *layerset = getTexLayerSet(i);
+ if (layerset
+ && ((i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT)))
+ {
+ layerset->updateComposite();
+ }
+ }
}
// virtual
S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 wearable_index) const
{
- if (!isIndexLocalTexture(type)) return FALSE;
-
- const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, wearable_index);
- if (local_tex_obj)
- {
- const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
- if (type >= 0
- && local_tex_obj->getID() != IMG_DEFAULT_AVATAR
- && !image->isMissingAsset())
- {
- return image->getDiscardLevel();
- }
- else
- {
- // We don't care about this (no image associated with the layer) treat as fully loaded.
- return 0;
- }
- }
- return 0;
+ if (!isIndexLocalTexture(type)) return FALSE;
+
+ const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, wearable_index);
+ if (local_tex_obj)
+ {
+ const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
+ if (type >= 0
+ && local_tex_obj->getID() != IMG_DEFAULT_AVATAR
+ && !image->isMissingAsset())
+ {
+ return image->getDiscardLevel();
+ }
+ else
+ {
+ // We don't care about this (no image associated with the layer) treat as fully loaded.
+ return 0;
+ }
+ }
+ return 0;
}
// virtual
// Counts the memory footprint of local textures.
void LLVOAvatarSelf::getLocalTextureByteCount(S32* gl_bytes) const
{
- *gl_bytes = 0;
- for (S32 type = 0; type < TEX_NUM_INDICES; type++)
- {
- if (!isIndexLocalTexture((ETextureIndex)type)) continue;
- U32 max_tex = getNumWearables((ETextureIndex) type);
- for (U32 num = 0; num < max_tex; num++)
- {
- const LLLocalTextureObject *local_tex_obj = getLocalTextureObject((ETextureIndex) type, num);
- if (local_tex_obj)
- {
- const LLViewerFetchedTexture* image_gl = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
- if (image_gl)
- {
- S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents();
-
- if (image_gl->hasGLTexture())
- {
- *gl_bytes += bytes;
- }
- }
- }
- }
- }
-}
-
-// virtual
+ *gl_bytes = 0;
+ for (S32 type = 0; type < TEX_NUM_INDICES; type++)
+ {
+ if (!isIndexLocalTexture((ETextureIndex)type)) continue;
+ U32 max_tex = getNumWearables((ETextureIndex) type);
+ for (U32 num = 0; num < max_tex; num++)
+ {
+ const LLLocalTextureObject *local_tex_obj = getLocalTextureObject((ETextureIndex) type, num);
+ if (local_tex_obj)
+ {
+ const LLViewerFetchedTexture* image_gl = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
+ if (image_gl)
+ {
+ S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents();
+
+ if (image_gl->hasGLTexture())
+ {
+ *gl_bytes += bytes;
+ }
+ }
+ }
+ }
+ }
+}
+
+// virtual
void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_tex, BOOL baked_version_ready, U32 index)
{
- if (!isIndexLocalTexture(type)) return;
-
- LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(src_tex, TRUE) ;
- if(!tex)
- {
- return ;
- }
-
- S32 desired_discard = isSelf() ? 0 : 2;
- LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type,index);
- if (!local_tex_obj)
- {
- if (type >= TEX_NUM_INDICES)
- {
- LL_ERRS() << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << LL_ENDL;
- return;
- }
- LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(type);
- if (!gAgentWearables.getViewerWearable(wearable_type,index))
- {
- // no wearable is loaded, cannot set the texture.
- return;
- }
- gAgentWearables.addLocalTextureObject(wearable_type,type,index);
- local_tex_obj = getLocalTextureObject(type,index);
- if (!local_tex_obj)
- {
- LL_ERRS() << "Unable to create LocalTextureObject for wearable type & index: (" << (U32) wearable_type << ", " << index << ")" << LL_ENDL;
- return;
- }
-
- LLViewerTexLayerSet *layer_set = getLayerSet(type);
- if (layer_set)
- {
- layer_set->cloneTemplates(local_tex_obj, type, gAgentWearables.getViewerWearable(wearable_type,index));
- }
-
- }
- if (!baked_version_ready)
- {
- if (tex != local_tex_obj->getImage() || local_tex_obj->getBakedReady())
- {
- local_tex_obj->setDiscard(MAX_DISCARD_LEVEL+1);
- }
- if (tex->getID() != IMG_DEFAULT_AVATAR)
- {
- if (local_tex_obj->getDiscard() > desired_discard)
- {
- S32 tex_discard = tex->getDiscardLevel();
- if (tex_discard >= 0 && tex_discard <= desired_discard)
- {
- local_tex_obj->setDiscard(tex_discard);
- if (isSelf())
- {
- requestLayerSetUpdate(type);
- if (isEditingAppearance())
- {
- LLVisualParamHint::requestHintUpdates();
- }
- }
- }
- else
- {
- tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL);
- }
- }
- tex->setMinDiscardLevel(desired_discard);
- }
- }
- local_tex_obj->setImage(tex);
- local_tex_obj->setID(tex->getID());
- setBakedReady(type,baked_version_ready,index);
+ if (!isIndexLocalTexture(type)) return;
+
+ LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(src_tex, TRUE) ;
+ if(!tex)
+ {
+ return ;
+ }
+
+ S32 desired_discard = isSelf() ? 0 : 2;
+ LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type,index);
+ if (!local_tex_obj)
+ {
+ if (type >= TEX_NUM_INDICES)
+ {
+ LL_ERRS() << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << LL_ENDL;
+ return;
+ }
+ LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(type);
+ if (!gAgentWearables.getViewerWearable(wearable_type,index))
+ {
+ // no wearable is loaded, cannot set the texture.
+ return;
+ }
+ gAgentWearables.addLocalTextureObject(wearable_type,type,index);
+ local_tex_obj = getLocalTextureObject(type,index);
+ if (!local_tex_obj)
+ {
+ LL_ERRS() << "Unable to create LocalTextureObject for wearable type & index: (" << (U32) wearable_type << ", " << index << ")" << LL_ENDL;
+ return;
+ }
+
+ LLViewerTexLayerSet *layer_set = getLayerSet(type);
+ if (layer_set)
+ {
+ layer_set->cloneTemplates(local_tex_obj, type, gAgentWearables.getViewerWearable(wearable_type,index));
+ }
+
+ }
+ if (!baked_version_ready)
+ {
+ if (tex != local_tex_obj->getImage() || local_tex_obj->getBakedReady())
+ {
+ local_tex_obj->setDiscard(MAX_DISCARD_LEVEL+1);
+ }
+ if (tex->getID() != IMG_DEFAULT_AVATAR)
+ {
+ if (local_tex_obj->getDiscard() > desired_discard)
+ {
+ S32 tex_discard = tex->getDiscardLevel();
+ if (tex_discard >= 0 && tex_discard <= desired_discard)
+ {
+ local_tex_obj->setDiscard(tex_discard);
+ if (isSelf())
+ {
+ requestLayerSetUpdate(type);
+ if (isEditingAppearance())
+ {
+ LLVisualParamHint::requestHintUpdates();
+ }
+ }
+ }
+ else
+ {
+ tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL);
+ }
+ }
+ tex->setMinDiscardLevel(desired_discard);
+ }
+ }
+ local_tex_obj->setImage(tex);
+ local_tex_obj->setID(tex->getID());
+ setBakedReady(type,baked_version_ready,index);
}
//virtual
void LLVOAvatarSelf::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index)
{
- if (!isIndexLocalTexture(type)) return;
- LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type,index);
- if (local_tex_obj)
- {
- local_tex_obj->setBakedReady( baked_version_exists );
- }
+ if (!isIndexLocalTexture(type)) return;
+ LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type,index);
+ if (local_tex_obj)
+ {
+ local_tex_obj->setBakedReady( baked_version_exists );
+ }
}
// virtual
void LLVOAvatarSelf::dumpLocalTextures() const
{
- LL_INFOS() << "Local Textures:" << LL_ENDL;
-
- /* ETextureIndex baked_equiv[] = {
- TEX_UPPER_BAKED,
- if (isTextureDefined(baked_equiv[i])) */
- for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = sAvatarDictionary->getTextures().begin();
- iter != sAvatarDictionary->getTextures().end();
- ++iter)
- {
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
- if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
- continue;
-
- const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- const ETextureIndex baked_equiv = sAvatarDictionary->getBakedTexture(baked_index)->mTextureIndex;
-
- const std::string &name = texture_dict->mName;
- const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(iter->first, 0);
- // index is baked texture - index is not relevant. putting in 0 as placeholder
- if (isTextureDefined(baked_equiv, 0))
- {
+ LL_INFOS() << "Local Textures:" << LL_ENDL;
+
+ /* ETextureIndex baked_equiv[] = {
+ TEX_UPPER_BAKED,
+ if (isTextureDefined(baked_equiv[i])) */
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = sAvatarDictionary->getTextures().begin();
+ iter != sAvatarDictionary->getTextures().end();
+ ++iter)
+ {
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
+ if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
+ continue;
+
+ const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+ const ETextureIndex baked_equiv = sAvatarDictionary->getBakedTexture(baked_index)->mTextureIndex;
+
+ const std::string &name = texture_dict->mName;
+ const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(iter->first, 0);
+ // index is baked texture - index is not relevant. putting in 0 as placeholder
+ if (isTextureDefined(baked_equiv, 0))
+ {
#if LL_RELEASE_FOR_DOWNLOAD
- // End users don't get to trivially see avatar texture IDs, makes textures
- // easier to steal. JC
- LL_INFOS() << "LocTex " << name << ": Baked " << LL_ENDL;
+ // End users don't get to trivially see avatar texture IDs, makes textures
+ // easier to steal. JC
+ LL_INFOS() << "LocTex " << name << ": Baked " << LL_ENDL;
#else
- LL_INFOS() << "LocTex " << name << ": Baked " << getTEImage(baked_equiv)->getID() << LL_ENDL;
+ LL_INFOS() << "LocTex " << name << ": Baked " << getTEImage(baked_equiv)->getID() << LL_ENDL;
#endif
- }
- else if (local_tex_obj && local_tex_obj->getImage() != NULL)
- {
- if (local_tex_obj->getImage()->getID() == IMG_DEFAULT_AVATAR)
- {
- LL_INFOS() << "LocTex " << name << ": None" << LL_ENDL;
- }
- else
- {
- LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
-
- LL_INFOS() << "LocTex " << name << ": "
- << "Discard " << image->getDiscardLevel() << ", "
- << "(" << image->getWidth() << ", " << image->getHeight() << ") "
+ }
+ else if (local_tex_obj && local_tex_obj->getImage() != NULL)
+ {
+ if (local_tex_obj->getImage()->getID() == IMG_DEFAULT_AVATAR)
+ {
+ LL_INFOS() << "LocTex " << name << ": None" << LL_ENDL;
+ }
+ else
+ {
+ LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
+
+ LL_INFOS() << "LocTex " << name << ": "
+ << "Discard " << image->getDiscardLevel() << ", "
+ << "(" << image->getWidth() << ", " << image->getHeight() << ") "
#if !LL_RELEASE_FOR_DOWNLOAD
- // End users don't get to trivially see avatar texture IDs,
- // makes textures easier to steal
- << image->getID() << " "
+ // End users don't get to trivially see avatar texture IDs,
+ // makes textures easier to steal
+ << image->getID() << " "
#endif
- << "Priority: " << image->getMaxVirtualSize()
- << LL_ENDL;
- }
- }
- else
- {
- LL_INFOS() << "LocTex " << name << ": No LLViewerTexture" << LL_ENDL;
- }
- }
+ << "Priority: " << image->getMaxVirtualSize()
+ << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_INFOS() << "LocTex " << name << ": No LLViewerTexture" << LL_ENDL;
+ }
+ }
}
//-----------------------------------------------------------------------------
-// static
+// static
// onLocalTextureLoaded()
//-----------------------------------------------------------------------------
void LLVOAvatarSelf::onLocalTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
{
- LLAvatarTexData *data = (LLAvatarTexData *)userdata;
- LLVOAvatarSelf *self = (LLVOAvatarSelf *)gObjectList.findObject(data->mAvatarID);
- if (self)
- {
- // We should only be handling local textures for ourself
- self->localTextureLoaded(success, src_vi, src_raw, aux_src, discard_level, final, userdata);
- }
- // ensure data is cleaned up
- if (final || !success)
- {
- delete data;
- }
+ LLAvatarTexData *data = (LLAvatarTexData *)userdata;
+ LLVOAvatarSelf *self = (LLVOAvatarSelf *)gObjectList.findObject(data->mAvatarID);
+ if (self)
+ {
+ // We should only be handling local textures for ourself
+ self->localTextureLoaded(success, src_vi, src_raw, aux_src, discard_level, final, userdata);
+ }
+ // ensure data is cleaned up
+ if (final || !success)
+ {
+ delete data;
+ }
}
-/*virtual*/ void LLVOAvatarSelf::setImage(const U8 te, LLViewerTexture *imagep, const U32 index)
+/*virtual*/ void LLVOAvatarSelf::setImage(const U8 te, LLViewerTexture *imagep, const U32 index)
{
- if (isIndexLocalTexture((ETextureIndex)te))
- {
- setLocalTexture((ETextureIndex)te, imagep, FALSE ,index);
- }
- else
- {
- setTEImage(te,imagep);
- }
+ if (isIndexLocalTexture((ETextureIndex)te))
+ {
+ setLocalTexture((ETextureIndex)te, imagep, FALSE ,index);
+ }
+ else
+ {
+ setTEImage(te,imagep);
+ }
}
/*virtual*/ LLViewerTexture* LLVOAvatarSelf::getImage(const U8 te, const U32 index) const
{
- if (isIndexLocalTexture((ETextureIndex)te))
- {
- return getLocalTextureGL((ETextureIndex)te,index);
- }
- else
- {
- return getTEImage(te);
- }
+ if (isIndexLocalTexture((ETextureIndex)te))
+ {
+ return getLocalTextureGL((ETextureIndex)te,index);
+ }
+ else
+ {
+ return getTEImage(te);
+ }
}
// static
void LLVOAvatarSelf::dumpTotalLocalTextureByteCount()
{
- S32 gl_bytes = 0;
- gAgentAvatarp->getLocalTextureByteCount(&gl_bytes);
- LL_INFOS() << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << LL_ENDL;
+ S32 gl_bytes = 0;
+ gAgentAvatarp->getLocalTextureByteCount(&gl_bytes);
+ LL_INFOS() << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << LL_ENDL;
}
bool LLVOAvatarSelf::getIsCloud() const
{
- // Let people know why they're clouded without spamming them into oblivion.
- bool do_warn = false;
- static LLTimer time_since_notice;
- F32 update_freq = 30.0;
- if (time_since_notice.getElapsedTimeF32() > update_freq)
- {
- time_since_notice.reset();
- do_warn = true;
- }
-
- // do we have our body parts?
- S32 shape_count = gAgentWearables.getWearableCount(LLWearableType::WT_SHAPE);
- S32 hair_count = gAgentWearables.getWearableCount(LLWearableType::WT_HAIR);
- S32 eye_count = gAgentWearables.getWearableCount(LLWearableType::WT_EYES);
- S32 skin_count = gAgentWearables.getWearableCount(LLWearableType::WT_SKIN);
- if (!shape_count || !hair_count || !eye_count || !skin_count)
- {
- if (do_warn)
- {
- LL_INFOS() << "Self is clouded due to missing one or more required body parts: "
- << (shape_count ? "" : "SHAPE ")
- << (hair_count ? "" : "HAIR ")
- << (eye_count ? "" : "EYES ")
- << (skin_count ? "" : "SKIN ")
- << LL_ENDL;
- }
- return true;
- }
-
- if (!isTextureDefined(TEX_HAIR, 0))
- {
- if (do_warn)
- {
- LL_INFOS() << "Self is clouded because of no hair texture" << LL_ENDL;
- }
- return true;
- }
-
- if (!mPreviousFullyLoaded)
- {
- if (!isLocalTextureDataAvailable(getLayerSet(BAKED_LOWER)) &&
- (!isTextureDefined(TEX_LOWER_BAKED, 0)))
- {
- if (do_warn)
- {
- LL_INFOS() << "Self is clouded because lower textures not baked" << LL_ENDL;
- }
- return true;
- }
-
- if (!isLocalTextureDataAvailable(getLayerSet(BAKED_UPPER)) &&
- (!isTextureDefined(TEX_UPPER_BAKED, 0)))
- {
- if (do_warn)
- {
- LL_INFOS() << "Self is clouded because upper textures not baked" << LL_ENDL;
- }
- return true;
- }
-
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- if (i == BAKED_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT))
- continue;
-
- const BakedTextureData& texture_data = mBakedTextureDatas[i];
- if (!isTextureDefined(texture_data.mTextureIndex, 0))
- continue;
-
- // Check for the case that texture is defined but not sufficiently loaded to display anything.
- const LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 );
- if (!baked_img || !baked_img->hasGLTexture())
- {
- if (do_warn)
- {
- LL_INFOS() << "Self is clouded because texture at index " << i
- << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << LL_ENDL;
- }
- return true;
- }
- }
-
- LL_DEBUGS() << "Avatar de-clouded" << LL_ENDL;
- }
- return false;
+ // Let people know why they're clouded without spamming them into oblivion.
+ bool do_warn = false;
+ static LLTimer time_since_notice;
+ F32 update_freq = 30.0;
+ if (time_since_notice.getElapsedTimeF32() > update_freq)
+ {
+ time_since_notice.reset();
+ do_warn = true;
+ }
+
+ // do we have our body parts?
+ S32 shape_count = gAgentWearables.getWearableCount(LLWearableType::WT_SHAPE);
+ S32 hair_count = gAgentWearables.getWearableCount(LLWearableType::WT_HAIR);
+ S32 eye_count = gAgentWearables.getWearableCount(LLWearableType::WT_EYES);
+ S32 skin_count = gAgentWearables.getWearableCount(LLWearableType::WT_SKIN);
+ if (!shape_count || !hair_count || !eye_count || !skin_count)
+ {
+ if (do_warn)
+ {
+ LL_INFOS() << "Self is clouded due to missing one or more required body parts: "
+ << (shape_count ? "" : "SHAPE ")
+ << (hair_count ? "" : "HAIR ")
+ << (eye_count ? "" : "EYES ")
+ << (skin_count ? "" : "SKIN ")
+ << LL_ENDL;
+ }
+ return true;
+ }
+
+ if (!isTextureDefined(TEX_HAIR, 0))
+ {
+ if (do_warn)
+ {
+ LL_INFOS() << "Self is clouded because of no hair texture" << LL_ENDL;
+ }
+ return true;
+ }
+
+ if (!mPreviousFullyLoaded)
+ {
+ if (!isLocalTextureDataAvailable(getLayerSet(BAKED_LOWER)) &&
+ (!isTextureDefined(TEX_LOWER_BAKED, 0)))
+ {
+ if (do_warn)
+ {
+ LL_INFOS() << "Self is clouded because lower textures not baked" << LL_ENDL;
+ }
+ return true;
+ }
+
+ if (!isLocalTextureDataAvailable(getLayerSet(BAKED_UPPER)) &&
+ (!isTextureDefined(TEX_UPPER_BAKED, 0)))
+ {
+ if (do_warn)
+ {
+ LL_INFOS() << "Self is clouded because upper textures not baked" << LL_ENDL;
+ }
+ return true;
+ }
+
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ if (i == BAKED_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT))
+ continue;
+
+ const BakedTextureData& texture_data = mBakedTextureDatas[i];
+ if (!isTextureDefined(texture_data.mTextureIndex, 0))
+ continue;
+
+ // Check for the case that texture is defined but not sufficiently loaded to display anything.
+ const LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 );
+ if (!baked_img || !baked_img->hasGLTexture())
+ {
+ if (do_warn)
+ {
+ LL_INFOS() << "Self is clouded because texture at index " << i
+ << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << LL_ENDL;
+ }
+ return true;
+ }
+ }
+
+ LL_DEBUGS() << "Avatar de-clouded" << LL_ENDL;
+ }
+ return false;
}
/*static*/
void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
{
- if (gAgentAvatarp.notNull())
- {
- gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
- }
+ if (gAgentAvatarp.notNull())
+ {
+ gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
+ }
}
void LLVOAvatarSelf::debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
{
- LLAvatarTexData *data = (LLAvatarTexData *)userdata;
- if (!data)
- {
- return;
- }
-
- ETextureIndex index = data->mIndex;
-
- if (index < 0 || index >= TEX_NUM_INDICES)
- {
- return;
- }
-
- if (discard_level >=0 && discard_level <= MAX_DISCARD_LEVEL) // ignore discard level -1, as it means we have no data.
- {
- mDebugTextureLoadTimes[(U32)index][(U32)discard_level] = mDebugSelfLoadTimer.getElapsedTimeF32();
- }
- if (final)
- {
- delete data;
- }
+ LLAvatarTexData *data = (LLAvatarTexData *)userdata;
+ if (!data)
+ {
+ return;
+ }
+
+ ETextureIndex index = data->mIndex;
+
+ if (index < 0 || index >= TEX_NUM_INDICES)
+ {
+ return;
+ }
+
+ if (discard_level >=0 && discard_level <= MAX_DISCARD_LEVEL) // ignore discard level -1, as it means we have no data.
+ {
+ mDebugTextureLoadTimes[(U32)index][(U32)discard_level] = mDebugSelfLoadTimer.getElapsedTimeF32();
+ }
+ if (final)
+ {
+ delete data;
+ }
}
void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, BOOL finished)
{
- U32 done = 0;
- if (finished)
- {
- done = 1;
- }
- mDebugBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32();
+ U32 done = 0;
+ if (finished)
+ {
+ done = 1;
+ }
+ mDebugBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32();
}
const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const
{
- std::ostringstream outbuf;
+ std::ostringstream outbuf;
LLWearableType *wr_inst = LLWearableType::getInstance();
- for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter =
- sAvatarDictionary->getBakedTextures().begin();
- baked_iter != sAvatarDictionary->getBakedTextures().end();
- ++baked_iter)
- {
- const EBakedTextureIndex baked_index = baked_iter->first;
- if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
- {
- outbuf << "baked_index: " << baked_index << "\n";
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
- for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
- local_tex_iter != baked_dict->mLocalTextures.end();
- ++local_tex_iter)
- {
- const ETextureIndex tex_index = *local_tex_iter;
- const std::string tex_name = sAvatarDictionary->getTexture(tex_index)->mName;
- outbuf << " tex_index " << (S32) tex_index << " name " << tex_name << "\n";
- const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
- const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
- if (wearable_count > 0)
- {
- for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
- {
- outbuf << " " << wr_inst->getTypeName(wearable_type) << " " << wearable_index << ":";
- const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(tex_index, wearable_index);
- if (local_tex_obj)
- {
- LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
- if (tex_index >= 0
- && local_tex_obj->getID() != IMG_DEFAULT_AVATAR
- && !image->isMissingAsset())
- {
- outbuf << " id: " << image->getID()
- << " refs: " << image->getNumRefs()
- << " glocdisc: " << getLocalDiscardLevel(tex_index, wearable_index)
- << " discard: " << image->getDiscardLevel()
- << " desired: " << image->getDesiredDiscardLevel()
- << " vsize: " << image->getMaxVirtualSize()
- << " ts: " << image->getTextureState()
- << " bl: " << image->getBoostLevel()
- << " fl: " << image->isFullyLoaded() // this is not an accessor for mFullyLoaded - see comment there.
- << " cl: " << (image->isFullyLoaded() && image->getDiscardLevel()==0) // "completely loaded"
- << " mvs: " << image->getMaxVirtualSize()
- << " mvsc: " << image->getMaxVirtualSizeResetCounter()
- << " mem: " << image->getTextureMemory();
- }
- }
- outbuf << "\n";
- }
- }
- }
- break;
- }
- }
- return outbuf.str();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter =
+ sAvatarDictionary->getBakedTextures().begin();
+ baked_iter != sAvatarDictionary->getBakedTextures().end();
+ ++baked_iter)
+ {
+ const EBakedTextureIndex baked_index = baked_iter->first;
+ if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
+ {
+ outbuf << "baked_index: " << baked_index << "\n";
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
+ for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
+ local_tex_iter != baked_dict->mLocalTextures.end();
+ ++local_tex_iter)
+ {
+ const ETextureIndex tex_index = *local_tex_iter;
+ const std::string tex_name = sAvatarDictionary->getTexture(tex_index)->mName;
+ outbuf << " tex_index " << (S32) tex_index << " name " << tex_name << "\n";
+ const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
+ const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
+ if (wearable_count > 0)
+ {
+ for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
+ {
+ outbuf << " " << wr_inst->getTypeName(wearable_type) << " " << wearable_index << ":";
+ const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(tex_index, wearable_index);
+ if (local_tex_obj)
+ {
+ LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
+ if (tex_index >= 0
+ && local_tex_obj->getID() != IMG_DEFAULT_AVATAR
+ && !image->isMissingAsset())
+ {
+ outbuf << " id: " << image->getID()
+ << " refs: " << image->getNumRefs()
+ << " glocdisc: " << getLocalDiscardLevel(tex_index, wearable_index)
+ << " discard: " << image->getDiscardLevel()
+ << " desired: " << image->getDesiredDiscardLevel()
+ << " vsize: " << image->getMaxVirtualSize()
+ << " ts: " << image->getTextureState()
+ << " bl: " << image->getBoostLevel()
+ << " fl: " << image->isFullyLoaded() // this is not an accessor for mFullyLoaded - see comment there.
+ << " cl: " << (image->isFullyLoaded() && image->getDiscardLevel()==0) // "completely loaded"
+ << " mvs: " << image->getMaxVirtualSize()
+ << " mvsc: " << image->getMaxVirtualSizeResetCounter()
+ << " mem: " << image->getTextureMemory();
+ }
+ }
+ outbuf << "\n";
+ }
+ }
+ }
+ break;
+ }
+ }
+ return outbuf.str();
}
void LLVOAvatarSelf::dumpAllTextures() const
{
- std::string vd_text = "Local textures per baked index and wearable:\n";
- for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
- baked_iter != sAvatarDictionary->getBakedTextures().end();
- ++baked_iter)
- {
- const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first;
- const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index);
- if (!layerset) continue;
- const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite();
- if (!layerset_buffer) continue;
- vd_text += verboseDebugDumpLocalTextureDataInfo(layerset);
- }
- LL_DEBUGS("Avatar") << vd_text << LL_ENDL;
+ std::string vd_text = "Local textures per baked index and wearable:\n";
+ for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
+ baked_iter != sAvatarDictionary->getBakedTextures().end();
+ ++baked_iter)
+ {
+ const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first;
+ const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index);
+ if (!layerset) continue;
+ const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite();
+ if (!layerset_buffer) continue;
+ vd_text += verboseDebugDumpLocalTextureDataInfo(layerset);
+ }
+ LL_DEBUGS("Avatar") << vd_text << LL_ENDL;
}
const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const
{
- std::string text="";
+ std::string text="";
LLWearableType *wr_inst = LLWearableType::getInstance();
- text = llformat("[Final:%d Avail:%d] ",isLocalTextureDataFinal(layerset), isLocalTextureDataAvailable(layerset));
-
- /* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
- return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */
- for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
- baked_iter != sAvatarDictionary->getBakedTextures().end();
- ++baked_iter)
- {
- const EBakedTextureIndex baked_index = baked_iter->first;
- if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
- {
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
- text += llformat("%d-%s ( ",baked_index, baked_dict->mName.c_str());
- for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
- local_tex_iter != baked_dict->mLocalTextures.end();
- ++local_tex_iter)
- {
- const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
- const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
- if (wearable_count > 0)
- {
- text += wr_inst->getTypeName(wearable_type) + ":";
- for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
- {
- const U32 discard_level = getLocalDiscardLevel(tex_index, wearable_index);
- std::string discard_str = llformat("%d ",discard_level);
- text += llformat("%d ",discard_level);
- }
- }
- }
- text += ")";
- break;
- }
- }
- return text;
+ text = llformat("[Final:%d Avail:%d] ",isLocalTextureDataFinal(layerset), isLocalTextureDataAvailable(layerset));
+
+ /* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
+ return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
+ baked_iter != sAvatarDictionary->getBakedTextures().end();
+ ++baked_iter)
+ {
+ const EBakedTextureIndex baked_index = baked_iter->first;
+ if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
+ {
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
+ text += llformat("%d-%s ( ",baked_index, baked_dict->mName.c_str());
+ for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
+ local_tex_iter != baked_dict->mLocalTextures.end();
+ ++local_tex_iter)
+ {
+ const ETextureIndex tex_index = *local_tex_iter;
+ const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
+ const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
+ if (wearable_count > 0)
+ {
+ text += wr_inst->getTypeName(wearable_type) + ":";
+ for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
+ {
+ const U32 discard_level = getLocalDiscardLevel(tex_index, wearable_index);
+ std::string discard_str = llformat("%d ",discard_level);
+ text += llformat("%d ",discard_level);
+ }
+ }
+ }
+ text += ")";
+ break;
+ }
+ }
+ return text;
}
const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const
{
- std::string text;
- const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
-
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture((EBakedTextureIndex)i);
- BOOL is_texture_final = TRUE;
- for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
- local_tex_iter != baked_dict->mLocalTextures.end();
- ++local_tex_iter)
- {
- const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
- const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
- for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
- {
- is_texture_final &= (getLocalDiscardLevel(*local_tex_iter, wearable_index) <= (S32)(override_tex_discard_level));
- }
- }
- text += llformat("%s:%d ",baked_dict->mName.c_str(),is_texture_final);
- }
- return text;
+ std::string text;
+ const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
+
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture((EBakedTextureIndex)i);
+ BOOL is_texture_final = TRUE;
+ for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
+ local_tex_iter != baked_dict->mLocalTextures.end();
+ ++local_tex_iter)
+ {
+ const ETextureIndex tex_index = *local_tex_iter;
+ const LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(tex_index);
+ const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
+ for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
+ {
+ is_texture_final &= (getLocalDiscardLevel(*local_tex_iter, wearable_index) <= (S32)(override_tex_discard_level));
+ }
+ }
+ text += llformat("%s:%d ",baked_dict->mName.c_str(),is_texture_final);
+ }
+ return text;
}
void LLVOAvatarSelf::appearanceChangeMetricsCoro(std::string url)
@@ -2241,7 +2241,7 @@ void LLVOAvatarSelf::appearanceChangeMetricsCoro(std::string url)
msg["nearby"][rez_status_name] = rez_counts[rez_stat];
}
- // std::vector<std::string> bucket_fields("timer_name","is_self","grid_x","grid_y","is_using_server_bake");
+ // std::vector<std::string> bucket_fields("timer_name","is_self","grid_x","grid_y","is_using_server_bake");
std::vector<std::string> by_fields;
by_fields.push_back("timer_name");
by_fields.push_back("completed");
@@ -2280,233 +2280,233 @@ void LLVOAvatarSelf::appearanceChangeMetricsCoro(std::string url)
bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send)
{
- const F32 AV_METRICS_INTERVAL_QA = 30.0;
- F32 send_period = 300.0;
+ const F32 AV_METRICS_INTERVAL_QA = 30.0;
+ F32 send_period = 300.0;
- static LLCachedControl<bool> qa_mode_metrics(gSavedSettings,"QAModeMetrics");
- if (qa_mode_metrics)
- {
- send_period = AV_METRICS_INTERVAL_QA;
- }
+ static LLCachedControl<bool> qa_mode_metrics(gSavedSettings,"QAModeMetrics");
+ if (qa_mode_metrics)
+ {
+ send_period = AV_METRICS_INTERVAL_QA;
+ }
- if (force_send || mTimeSinceLastRezMessage.getElapsedTimeF32() > send_period)
- {
- // Stats for completed phases have been getting logged as they
- // complete. This will give us stats for any timers that
- // haven't finished as of the metric's being sent.
-
- if (force_send)
- {
- LLVOAvatar::logPendingPhasesAllAvatars();
- }
- sendViewerAppearanceChangeMetrics();
- }
+ if (force_send || mTimeSinceLastRezMessage.getElapsedTimeF32() > send_period)
+ {
+ // Stats for completed phases have been getting logged as they
+ // complete. This will give us stats for any timers that
+ // haven't finished as of the metric's being sent.
+
+ if (force_send)
+ {
+ LLVOAvatar::logPendingPhasesAllAvatars();
+ }
+ sendViewerAppearanceChangeMetrics();
+ }
- return false;
+ return false;
}
void LLVOAvatarSelf::addMetricsTimerRecord(const LLSD& record)
{
- mPendingTimerRecords.push_back(record);
+ mPendingTimerRecords.push_back(record);
}
bool operator<(const LLSD& a, const LLSD& b)
{
- std::ostringstream aout, bout;
- aout << LLSDNotationStreamer(a);
- bout << LLSDNotationStreamer(b);
- std::string astring = aout.str();
- std::string bstring = bout.str();
+ std::ostringstream aout, bout;
+ aout << LLSDNotationStreamer(a);
+ bout << LLSDNotationStreamer(b);
+ std::string astring = aout.str();
+ std::string bstring = bout.str();
- return astring < bstring;
+ return astring < bstring;
}
// Given a vector of LLSD records, return an LLSD array of bucketed stats for val_field.
LLSD summarize_by_buckets(std::vector<LLSD> in_records,
- std::vector<std::string> by_fields,
- std::string val_field)
-{
- LLSD result = LLSD::emptyArray();
- std::map<LLSD,LLViewerStats::StatsAccumulator> accum;
- for (std::vector<LLSD>::iterator in_record_iter = in_records.begin();
- in_record_iter != in_records.end(); ++in_record_iter)
- {
- LLSD& record = *in_record_iter;
- LLSD key;
- for (std::vector<std::string>::iterator field_iter = by_fields.begin();
- field_iter != by_fields.end(); ++field_iter)
- {
- const std::string& field = *field_iter;
- key[field] = record[field];
- }
- LLViewerStats::StatsAccumulator& stats = accum[key];
- F32 value = record[val_field].asReal();
- stats.push(value);
- }
- for (std::map<LLSD,LLViewerStats::StatsAccumulator>::iterator accum_it = accum.begin();
- accum_it != accum.end(); ++accum_it)
- {
- LLSD out_record = accum_it->first;
- out_record["stats"] = accum_it->second.asLLSD();
- result.append(out_record);
- }
- return result;
+ std::vector<std::string> by_fields,
+ std::string val_field)
+{
+ LLSD result = LLSD::emptyArray();
+ std::map<LLSD,LLViewerStats::StatsAccumulator> accum;
+ for (std::vector<LLSD>::iterator in_record_iter = in_records.begin();
+ in_record_iter != in_records.end(); ++in_record_iter)
+ {
+ LLSD& record = *in_record_iter;
+ LLSD key;
+ for (std::vector<std::string>::iterator field_iter = by_fields.begin();
+ field_iter != by_fields.end(); ++field_iter)
+ {
+ const std::string& field = *field_iter;
+ key[field] = record[field];
+ }
+ LLViewerStats::StatsAccumulator& stats = accum[key];
+ F32 value = record[val_field].asReal();
+ stats.push(value);
+ }
+ for (std::map<LLSD,LLViewerStats::StatsAccumulator>::iterator accum_it = accum.begin();
+ accum_it != accum.end(); ++accum_it)
+ {
+ LLSD out_record = accum_it->first;
+ out_record["stats"] = accum_it->second.asLLSD();
+ result.append(out_record);
+ }
+ return result;
}
void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics()
{
- std::string caps_url;
- if (getRegion())
- {
- // runway - change here to activate.
- caps_url = getRegion()->getCapability("ViewerMetrics");
- }
- if (!caps_url.empty())
- {
+ std::string caps_url;
+ if (getRegion())
+ {
+ // runway - change here to activate.
+ caps_url = getRegion()->getCapability("ViewerMetrics");
+ }
+ if (!caps_url.empty())
+ {
LLCoros::instance().launch("LLVOAvatarSelf::appearanceChangeMetricsCoro",
boost::bind(&LLVOAvatarSelf::appearanceChangeMetricsCoro, this, caps_url));
- mTimeSinceLastRezMessage.reset();
- }
+ mTimeSinceLastRezMessage.reset();
+ }
}
const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) const
{
- if (canGrabBakedTexture(baked_index))
- {
- ETextureIndex tex_index = sAvatarDictionary->bakedToLocalTextureIndex(baked_index);
- if (tex_index == TEX_NUM_INDICES)
- {
- return LLUUID::null;
- }
- return getTEImage( tex_index )->getID();
- }
- return LLUUID::null;
+ if (canGrabBakedTexture(baked_index))
+ {
+ ETextureIndex tex_index = sAvatarDictionary->bakedToLocalTextureIndex(baked_index);
+ if (tex_index == TEX_NUM_INDICES)
+ {
+ return LLUUID::null;
+ }
+ return getTEImage( tex_index )->getID();
+ }
+ return LLUUID::null;
}
BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
{
- ETextureIndex tex_index = sAvatarDictionary->bakedToLocalTextureIndex(baked_index);
- if (tex_index == TEX_NUM_INDICES)
- {
- return FALSE;
- }
- // Check if the texture hasn't been baked yet.
- if (!isTextureDefined(tex_index, 0))
- {
- LL_DEBUGS() << "getTEImage( " << (U32) tex_index << " )->getID() == IMG_DEFAULT_AVATAR" << LL_ENDL;
- return FALSE;
- }
-
- if (gAgent.isGodlikeWithoutAdminMenuFakery())
- return TRUE;
-
- // Check permissions of textures that show up in the
- // baked texture. We don't want people copying people's
- // work via baked textures.
-
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture(baked_index);
- for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin();
- iter != baked_dict->mLocalTextures.end();
- ++iter)
- {
- const ETextureIndex t_index = (*iter);
- LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(t_index);
- U32 count = gAgentWearables.getWearableCount(wearable_type);
- LL_DEBUGS() << "Checking index " << (U32) t_index << " count: " << count << LL_ENDL;
-
- for (U32 wearable_index = 0; wearable_index < count; ++wearable_index)
- {
- LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, wearable_index);
- if (wearable)
- {
- const LLLocalTextureObject *texture = wearable->getLocalTextureObject((S32)t_index);
- const LLUUID& texture_id = texture->getID();
- if (texture_id != IMG_DEFAULT_AVATAR)
- {
- // Search inventory for this texture.
- LLViewerInventoryCategory::cat_array_t cats;
- LLViewerInventoryItem::item_array_t items;
- LLAssetIDMatches asset_id_matches(texture_id);
- gInventory.collectDescendentsIf(LLUUID::null,
- cats,
- items,
- LLInventoryModel::INCLUDE_TRASH,
- asset_id_matches);
-
- BOOL can_grab = FALSE;
- LL_DEBUGS() << "item count for asset " << texture_id << ": " << items.size() << LL_ENDL;
- if (items.size())
- {
- // search for full permissions version
- for (S32 i = 0; i < items.size(); i++)
- {
- LLViewerInventoryItem* itemp = items[i];
- if (itemp->getIsFullPerm())
- {
- can_grab = TRUE;
- break;
- }
- }
- }
- if (!can_grab) return FALSE;
- }
- }
- }
- }
-
- return TRUE;
+ ETextureIndex tex_index = sAvatarDictionary->bakedToLocalTextureIndex(baked_index);
+ if (tex_index == TEX_NUM_INDICES)
+ {
+ return FALSE;
+ }
+ // Check if the texture hasn't been baked yet.
+ if (!isTextureDefined(tex_index, 0))
+ {
+ LL_DEBUGS() << "getTEImage( " << (U32) tex_index << " )->getID() == IMG_DEFAULT_AVATAR" << LL_ENDL;
+ return FALSE;
+ }
+
+ if (gAgent.isGodlikeWithoutAdminMenuFakery())
+ return TRUE;
+
+ // Check permissions of textures that show up in the
+ // baked texture. We don't want people copying people's
+ // work via baked textures.
+
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture(baked_index);
+ for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin();
+ iter != baked_dict->mLocalTextures.end();
+ ++iter)
+ {
+ const ETextureIndex t_index = (*iter);
+ LLWearableType::EType wearable_type = sAvatarDictionary->getTEWearableType(t_index);
+ U32 count = gAgentWearables.getWearableCount(wearable_type);
+ LL_DEBUGS() << "Checking index " << (U32) t_index << " count: " << count << LL_ENDL;
+
+ for (U32 wearable_index = 0; wearable_index < count; ++wearable_index)
+ {
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, wearable_index);
+ if (wearable)
+ {
+ const LLLocalTextureObject *texture = wearable->getLocalTextureObject((S32)t_index);
+ const LLUUID& texture_id = texture->getID();
+ if (texture_id != IMG_DEFAULT_AVATAR)
+ {
+ // Search inventory for this texture.
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLAssetIDMatches asset_id_matches(texture_id);
+ gInventory.collectDescendentsIf(LLUUID::null,
+ cats,
+ items,
+ LLInventoryModel::INCLUDE_TRASH,
+ asset_id_matches);
+
+ BOOL can_grab = FALSE;
+ LL_DEBUGS() << "item count for asset " << texture_id << ": " << items.size() << LL_ENDL;
+ if (items.size())
+ {
+ // search for full permissions version
+ for (S32 i = 0; i < items.size(); i++)
+ {
+ LLViewerInventoryItem* itemp = items[i];
+ if (itemp->getIsFullPerm())
+ {
+ can_grab = TRUE;
+ break;
+ }
+ }
+ }
+ if (!can_grab) return FALSE;
+ }
+ }
+ }
+ }
+
+ return TRUE;
}
void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTexture* imagep,
- F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked)
-{
- if (!isIndexLocalTexture(type)) return;
-
- // Sunshine - ignoring covered_by_baked will force local textures
- // to always load. Fix for SH-4001 and many related issues. Do
- // not restore this without some more targetted fix for the local
- // textures failing to load issue.
- //if (!covered_by_baked)
- {
- if (imagep->getID() != IMG_DEFAULT_AVATAR)
- {
- imagep->setNoDelete();
- if (imagep->getDiscardLevel() != 0)
- {
- F32 desired_pixels;
- desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
-
- imagep->setBoostLevel(getAvatarBoostLevel());
- imagep->resetTextureStats();
- imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTUAL_SIZE_RESET_INTERVAL);
- imagep->addTextureStats( desired_pixels / texel_area_ratio );
- imagep->forceUpdateBindStats() ;
- if (imagep->getDiscardLevel() < 0)
- {
- mHasGrey = TRUE; // for statistics gathering
- }
- }
- }
- else
- {
- // texture asset is missing
- mHasGrey = TRUE; // for statistics gathering
- }
- }
+ F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked)
+{
+ if (!isIndexLocalTexture(type)) return;
+
+ // Sunshine - ignoring covered_by_baked will force local textures
+ // to always load. Fix for SH-4001 and many related issues. Do
+ // not restore this without some more targetted fix for the local
+ // textures failing to load issue.
+ //if (!covered_by_baked)
+ {
+ if (imagep->getID() != IMG_DEFAULT_AVATAR)
+ {
+ imagep->setNoDelete();
+ if (imagep->getDiscardLevel() != 0)
+ {
+ F32 desired_pixels;
+ desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
+
+ imagep->setBoostLevel(getAvatarBoostLevel());
+ imagep->resetTextureStats();
+ imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTUAL_SIZE_RESET_INTERVAL);
+ imagep->addTextureStats( desired_pixels / texel_area_ratio );
+ imagep->forceUpdateBindStats() ;
+ if (imagep->getDiscardLevel() < 0)
+ {
+ mHasGrey = TRUE; // for statistics gathering
+ }
+ }
+ }
+ else
+ {
+ // texture asset is missing
+ mHasGrey = TRUE; // for statistics gathering
+ }
+ }
}
LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 wearable_index) const
{
- LLWearableType::EType type = sAvatarDictionary->getTEWearableType(i);
- LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, wearable_index);
- if (wearable)
- {
- return wearable->getLocalTextureObject(i);
- }
+ LLWearableType::EType type = sAvatarDictionary->getTEWearableType(i);
+ LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, wearable_index);
+ if (wearable)
+ {
+ return wearable->getLocalTextureObject(i);
+ }
- return NULL;
+ return NULL;
}
//-----------------------------------------------------------------------------
@@ -2515,119 +2515,119 @@ LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLAvatarAppearanceDe
//-----------------------------------------------------------------------------
ETextureIndex LLVOAvatarSelf::getBakedTE( const LLViewerTexLayerSet* layerset ) const
{
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- if (layerset == mBakedTextureDatas[i].mTexLayerSet )
- {
- return mBakedTextureDatas[i].mTextureIndex;
- }
- }
- llassert(0);
- return TEX_HEAD_BAKED;
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ if (layerset == mBakedTextureDatas[i].mTexLayerSet )
+ {
+ return mBakedTextureDatas[i].mTextureIndex;
+ }
+ }
+ llassert(0);
+ return TEX_HEAD_BAKED;
}
// FIXME: This is not called consistently. Something may be broken.
void LLVOAvatarSelf::outputRezDiagnostics() const
{
- if(!gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime"))
- {
- return ;
- }
-
- const F32 final_time = mDebugSelfLoadTimer.getElapsedTimeF32();
- LL_DEBUGS("Avatar") << "REZTIME: Myself rez stats:" << LL_ENDL;
- LL_DEBUGS("Avatar") << "\t Time from avatar creation to load wearables: " << (S32)mDebugTimeWearablesLoaded << LL_ENDL;
- LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << LL_ENDL;
- LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << LL_ENDL;
- LL_DEBUGS("Avatar") << "\t Load time for each texture: " << LL_ENDL;
- for (U32 i = 0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
- {
- std::stringstream out;
- out << "\t\t (" << i << ") ";
- U32 j=0;
- for (j=0; j <= MAX_DISCARD_LEVEL; j++)
- {
- out << "\t";
- S32 load_time = (S32)mDebugTextureLoadTimes[i][j];
- if (load_time == -1)
- {
- out << "*";
- if (j == 0)
- break;
- }
- else
- {
- out << load_time;
- }
- }
-
- // Don't print out non-existent textures.
- if (j != 0)
- {
- LL_DEBUGS("Avatar") << out.str() << LL_ENDL;
- }
- }
- LL_DEBUGS("Avatar") << "\t Time points for each upload (start / finish)" << LL_ENDL;
- for (U32 i = 0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i)
- {
- LL_DEBUGS("Avatar") << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << LL_ENDL;
- }
-
- for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
- baked_iter != sAvatarDictionary->getBakedTextures().end();
- ++baked_iter)
- {
- const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first;
- const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index);
- if (!layerset) continue;
- const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite();
- if (!layerset_buffer) continue;
- LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << LL_ENDL;
- }
-
- dumpAllTextures();
+ if(!gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime"))
+ {
+ return ;
+ }
+
+ const F32 final_time = mDebugSelfLoadTimer.getElapsedTimeF32();
+ LL_DEBUGS("Avatar") << "REZTIME: Myself rez stats:" << LL_ENDL;
+ LL_DEBUGS("Avatar") << "\t Time from avatar creation to load wearables: " << (S32)mDebugTimeWearablesLoaded << LL_ENDL;
+ LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << LL_ENDL;
+ LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << LL_ENDL;
+ LL_DEBUGS("Avatar") << "\t Load time for each texture: " << LL_ENDL;
+ for (U32 i = 0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
+ {
+ std::stringstream out;
+ out << "\t\t (" << i << ") ";
+ U32 j=0;
+ for (j=0; j <= MAX_DISCARD_LEVEL; j++)
+ {
+ out << "\t";
+ S32 load_time = (S32)mDebugTextureLoadTimes[i][j];
+ if (load_time == -1)
+ {
+ out << "*";
+ if (j == 0)
+ break;
+ }
+ else
+ {
+ out << load_time;
+ }
+ }
+
+ // Don't print out non-existent textures.
+ if (j != 0)
+ {
+ LL_DEBUGS("Avatar") << out.str() << LL_ENDL;
+ }
+ }
+ LL_DEBUGS("Avatar") << "\t Time points for each upload (start / finish)" << LL_ENDL;
+ for (U32 i = 0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i)
+ {
+ LL_DEBUGS("Avatar") << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << LL_ENDL;
+ }
+
+ for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
+ baked_iter != sAvatarDictionary->getBakedTextures().end();
+ ++baked_iter)
+ {
+ const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first;
+ const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index);
+ if (!layerset) continue;
+ const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite();
+ if (!layerset_buffer) continue;
+ LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << LL_ENDL;
+ }
+
+ dumpAllTextures();
}
void LLVOAvatarSelf::outputRezTiming(const std::string& msg) const
{
- LL_DEBUGS("Avatar")
- << avString()
- << llformat("%s. Time from avatar creation: %.2f", msg.c_str(), mDebugSelfLoadTimer.getElapsedTimeF32())
- << LL_ENDL;
+ LL_DEBUGS("Avatar")
+ << avString()
+ << llformat("%s. Time from avatar creation: %.2f", msg.c_str(), mDebugSelfLoadTimer.getElapsedTimeF32())
+ << LL_ENDL;
}
void LLVOAvatarSelf::reportAvatarRezTime() const
{
- // TODO: report mDebugSelfLoadTimer.getElapsedTimeF32() somehow.
+ // TODO: report mDebugSelfLoadTimer.getElapsedTimeF32() somehow.
}
// SUNSHINE CLEANUP - not clear we need any of this, may be sufficient to request server appearance in llviewermenu.cpp:handle_rebake_textures()
void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
{
- LL_INFOS() << "TAT: forced full rebake. " << LL_ENDL;
+ LL_INFOS() << "TAT: forced full rebake. " << LL_ENDL;
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- ETextureIndex baked_index = mBakedTextureDatas[i].mTextureIndex;
- LLViewerTexLayerSet* layer_set = getLayerSet(baked_index);
- if (layer_set)
- {
- if (slam_for_debug)
- {
- layer_set->setUpdatesEnabled(TRUE);
- }
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ ETextureIndex baked_index = mBakedTextureDatas[i].mTextureIndex;
+ LLViewerTexLayerSet* layer_set = getLayerSet(baked_index);
+ if (layer_set)
+ {
+ if (slam_for_debug)
+ {
+ layer_set->setUpdatesEnabled(TRUE);
+ }
- invalidateComposite(layer_set);
- add(LLStatViewer::TEX_REBAKES, 1);
- }
- else
- {
- LL_WARNS() << "TAT: NO LAYER SET FOR " << (S32)baked_index << LL_ENDL;
- }
- }
+ invalidateComposite(layer_set);
+ add(LLStatViewer::TEX_REBAKES, 1);
+ }
+ else
+ {
+ LL_WARNS() << "TAT: NO LAYER SET FOR " << (S32)baked_index << LL_ENDL;
+ }
+ }
- // Don't know if this is needed
- updateMeshTextures();
+ // Don't know if this is needed
+ updateMeshTextures();
}
//-----------------------------------------------------------------------------
@@ -2635,21 +2635,21 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
//-----------------------------------------------------------------------------
void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index )
{
- /* switch(index)
- case LOCTEX_UPPER_BODYPAINT:
- case LOCTEX_UPPER_SHIRT:
- if( mUpperBodyLayerSet )
- mUpperBodyLayerSet->requestUpdate(); */
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = sAvatarDictionary->getTexture(index);
- if (!texture_dict)
- return;
- if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
- return;
- const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- if (mBakedTextureDatas[baked_index].mTexLayerSet)
- {
- mBakedTextureDatas[baked_index].mTexLayerSet->requestUpdate();
- }
+ /* switch(index)
+ case LOCTEX_UPPER_BODYPAINT:
+ case LOCTEX_UPPER_SHIRT:
+ if( mUpperBodyLayerSet )
+ mUpperBodyLayerSet->requestUpdate(); */
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = sAvatarDictionary->getTexture(index);
+ if (!texture_dict)
+ return;
+ if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
+ return;
+ const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+ if (mBakedTextureDatas[baked_index].mTexLayerSet)
+ {
+ mBakedTextureDatas[baked_index].mTexLayerSet->requestUpdate();
+ }
}
LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
@@ -2675,7 +2675,7 @@ LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index)
return mHeadLayerSet; */
if (baked_index >= 0 && baked_index < BAKED_NUM_INDICES)
{
- return getTexLayerSet(baked_index);
+ return getTexLayerSet(baked_index);
}
return NULL;
}
@@ -2686,54 +2686,54 @@ LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index)
// static
void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch)
{
- if (isAgentAvatarValid())
- {
- LLUIUsage::instance().logCommand("Avatar.CustomizeStart");
- if (!gAgentAvatarp->mEndCustomizeCallback.get())
- {
- gAgentAvatarp->mEndCustomizeCallback = new LLUpdateAppearanceOnDestroy;
- }
-
- gAgentAvatarp->mIsEditingAppearance = true;
- gAgentAvatarp->mUseLocalAppearance = true;
-
- if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch)
- {
- gAgentCamera.changeCameraToCustomizeAvatar();
- }
-
- gAgentAvatarp->invalidateAll(); // mark all bakes as dirty, request updates
- gAgentAvatarp->updateMeshTextures(); // make sure correct textures are applied to the avatar mesh.
- gAgentAvatarp->updateTextures(); // call updateTextureStats
- }
+ if (isAgentAvatarValid())
+ {
+ LLUIUsage::instance().logCommand("Avatar.CustomizeStart");
+ if (!gAgentAvatarp->mEndCustomizeCallback.get())
+ {
+ gAgentAvatarp->mEndCustomizeCallback = new LLUpdateAppearanceOnDestroy;
+ }
+
+ gAgentAvatarp->mIsEditingAppearance = true;
+ gAgentAvatarp->mUseLocalAppearance = true;
+
+ if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch)
+ {
+ gAgentCamera.changeCameraToCustomizeAvatar();
+ }
+
+ gAgentAvatarp->invalidateAll(); // mark all bakes as dirty, request updates
+ gAgentAvatarp->updateMeshTextures(); // make sure correct textures are applied to the avatar mesh.
+ gAgentAvatarp->updateTextures(); // call updateTextureStats
+ }
}
// static
void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch)
{
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->mIsEditingAppearance = false;
- gAgentAvatarp->invalidateAll();
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->mIsEditingAppearance = false;
+ gAgentAvatarp->invalidateAll();
- if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch)
- {
- gAgentCamera.changeCameraToDefault();
- gAgentCamera.resetView();
- }
+ if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch)
+ {
+ gAgentCamera.changeCameraToDefault();
+ gAgentCamera.resetView();
+ }
- // Dereferencing the previous callback will cause
- // updateAppearanceFromCOF to be called, whenever all refs
- // have resolved.
- gAgentAvatarp->mEndCustomizeCallback = NULL;
- }
+ // Dereferencing the previous callback will cause
+ // updateAppearanceFromCOF to be called, whenever all refs
+ // have resolved.
+ gAgentAvatarp->mEndCustomizeCallback = NULL;
+ }
}
// virtual
bool LLVOAvatarSelf::shouldRenderRigged() const
{
- return gAgent.needsRenderAvatar();
+ return gAgent.needsRenderAvatar();
}
// HACK: this will null out the avatar's local texture IDs before the TE message is sent
@@ -2743,39 +2743,39 @@ bool LLVOAvatarSelf::shouldRenderRigged() const
// This will involve further refactoring that is too risky for the initial release of 2.0.
bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const
{
- LLUUID texture_id[TEX_NUM_INDICES];
- // pack away current TEs to make sure we don't send them out
- for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = sAvatarDictionary->getTextures().begin();
- iter != sAvatarDictionary->getTextures().end();
- ++iter)
- {
- const ETextureIndex index = iter->first;
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
- if (!texture_dict->mIsBakedTexture)
- {
- LLTextureEntry* entry = getTE((U8) index);
- texture_id[index] = entry->getID();
- entry->setID(IMG_DEFAULT_AVATAR);
- }
- }
-
- bool success = packTEMessage(mesgsys);
-
- // unpack TEs to make sure we don't re-trigger a bake
- for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = sAvatarDictionary->getTextures().begin();
- iter != sAvatarDictionary->getTextures().end();
- ++iter)
- {
- const ETextureIndex index = iter->first;
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
- if (!texture_dict->mIsBakedTexture)
- {
- LLTextureEntry* entry = getTE((U8) index);
- entry->setID(texture_id[index]);
- }
- }
-
- return success;
+ LLUUID texture_id[TEX_NUM_INDICES];
+ // pack away current TEs to make sure we don't send them out
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = sAvatarDictionary->getTextures().begin();
+ iter != sAvatarDictionary->getTextures().end();
+ ++iter)
+ {
+ const ETextureIndex index = iter->first;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
+ if (!texture_dict->mIsBakedTexture)
+ {
+ LLTextureEntry* entry = getTE((U8) index);
+ texture_id[index] = entry->getID();
+ entry->setID(IMG_DEFAULT_AVATAR);
+ }
+ }
+
+ bool success = packTEMessage(mesgsys);
+
+ // unpack TEs to make sure we don't re-trigger a bake
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = sAvatarDictionary->getTextures().begin();
+ iter != sAvatarDictionary->getTextures().end();
+ ++iter)
+ {
+ const ETextureIndex index = iter->first;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
+ if (!texture_dict->mIsBakedTexture)
+ {
+ LLTextureEntry* entry = getTE((U8) index);
+ entry->setID(texture_id[index]);
+ }
+ }
+
+ return success;
}
//------------------------------------------------------------------------
@@ -2783,37 +2783,37 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const
//------------------------------------------------------------------------
void LLVOAvatarSelf::sendHoverHeight() const
{
- std::string url = gAgent.getRegionCapability("AgentPreferences");
+ std::string url = gAgent.getRegionCapability("AgentPreferences");
- if (!url.empty())
- {
- LLSD update = LLSD::emptyMap();
- const LLVector3& hover_offset = getHoverOffset();
- update["hover_height"] = hover_offset[2];
+ if (!url.empty())
+ {
+ LLSD update = LLSD::emptyMap();
+ const LLVector3& hover_offset = getHoverOffset();
+ update["hover_height"] = hover_offset[2];
- LL_DEBUGS("Avatar") << avString() << "sending hover height value " << hover_offset[2] << LL_ENDL;
+ LL_DEBUGS("Avatar") << avString() << "sending hover height value " << hover_offset[2] << LL_ENDL;
// *TODO: - this class doesn't really do anything, could just use a base
- // class responder if nothing else gets added.
+ // class responder if nothing else gets added.
// (comment from removed Responder)
- LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, update,
+ LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, update,
"Hover height sent to sim", "Hover height not sent to sim");
- mLastHoverOffsetSent = hover_offset;
- }
+ mLastHoverOffsetSent = hover_offset;
+ }
}
void LLVOAvatarSelf::setHoverOffset(const LLVector3& hover_offset, bool send_update)
{
- if (getHoverOffset() != hover_offset)
- {
- LL_INFOS("Avatar") << avString() << " setting hover due to change " << hover_offset[2] << LL_ENDL;
- LLVOAvatar::setHoverOffset(hover_offset, send_update);
- }
- if (send_update && (hover_offset != mLastHoverOffsetSent))
- {
- LL_INFOS("Avatar") << avString() << " sending hover due to change " << hover_offset[2] << LL_ENDL;
- sendHoverHeight();
- }
+ if (getHoverOffset() != hover_offset)
+ {
+ LL_INFOS("Avatar") << avString() << " setting hover due to change " << hover_offset[2] << LL_ENDL;
+ LLVOAvatar::setHoverOffset(hover_offset, send_update);
+ }
+ if (send_update && (hover_offset != mLastHoverOffsetSent))
+ {
+ LL_INFOS("Avatar") << avString() << " sending hover due to change " << hover_offset[2] << LL_ENDL;
+ sendHoverHeight();
+ }
}
//------------------------------------------------------------------------
@@ -2821,9 +2821,9 @@ void LLVOAvatarSelf::setHoverOffset(const LLVector3& hover_offset, bool send_upd
//------------------------------------------------------------------------
BOOL LLVOAvatarSelf::needsRenderBeam()
{
- LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
- BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing());
+ BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing());
LLViewerObject* objp = LLToolGrab::getInstance()->getEditingObject();
if (objp // might need to be "!objp ||" instead of "objp &&".
&& (objp->isAttachment() || objp->isAvatar()))
@@ -2832,65 +2832,65 @@ BOOL LLVOAvatarSelf::needsRenderBeam()
// attachments or avatars
is_touching_or_grabbing = FALSE;
}
- return is_touching_or_grabbing || (getAttachmentState() & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection());
+ return is_touching_or_grabbing || (getAttachmentState() & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection());
}
// static
void LLVOAvatarSelf::deleteScratchTextures()
{
- for(std::map< LLGLenum, LLGLuint*>::iterator it = sScratchTexNames.begin(), end_it = sScratchTexNames.end();
- it != end_it;
- ++it)
- {
- LLImageGL::deleteTextures(1, (U32 *)it->second );
- stop_glerror();
- }
+ for(std::map< LLGLenum, LLGLuint*>::iterator it = sScratchTexNames.begin(), end_it = sScratchTexNames.end();
+ it != end_it;
+ ++it)
+ {
+ LLImageGL::deleteTextures(1, (U32 *)it->second );
+ stop_glerror();
+ }
- if( sScratchTexBytes.value() )
- {
- LL_DEBUGS() << "Clearing Scratch Textures " << (S32Kilobytes)sScratchTexBytes << LL_ENDL;
+ if( sScratchTexBytes.value() )
+ {
+ LL_DEBUGS() << "Clearing Scratch Textures " << (S32Kilobytes)sScratchTexBytes << LL_ENDL;
- delete_and_clear(sScratchTexNames);
- sScratchTexBytes = S32Bytes(0);
- }
+ delete_and_clear(sScratchTexNames);
+ sScratchTexBytes = S32Bytes(0);
+ }
}
-// static
+// static
void LLVOAvatarSelf::dumpScratchTextureByteCount()
{
- LL_INFOS() << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << LL_ENDL;
+ LL_INFOS() << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << LL_ENDL;
}
void LLVOAvatarSelf::dumpWearableInfo(LLAPRFile& outfile)
{
- apr_file_t* file = outfile.getFileHandle();
- if (!file)
- {
- return;
- }
+ apr_file_t* file = outfile.getFileHandle();
+ if (!file)
+ {
+ return;
+ }
-
- apr_file_printf( file, "\n<wearable_info>\n" );
- LLWearableData *wd = getWearableData();
+ apr_file_printf( file, "\n<wearable_info>\n" );
+
+ LLWearableData *wd = getWearableData();
LLWearableType *wr_inst = LLWearableType::getInstance();
- for (S32 type = 0; type < LLWearableType::WT_COUNT; type++)
- {
- const std::string& type_name = wr_inst->getTypeName((LLWearableType::EType)type);
- for (U32 j=0; j< wd->getWearableCount((LLWearableType::EType)type); j++)
- {
- LLViewerWearable *wearable = gAgentWearables.getViewerWearable((LLWearableType::EType)type,j);
- apr_file_printf( file, "\n\t <wearable type=\"%s\" name=\"%s\"/>\n",
- type_name.c_str(), wearable->getName().c_str() );
- LLWearable::visual_param_vec_t v_params;
- wearable->getVisualParams(v_params);
- for (LLWearable::visual_param_vec_t::iterator it = v_params.begin();
- it != v_params.end(); ++it)
- {
- LLVisualParam *param = *it;
- dump_visual_param(file, param, param->getWeight());
- }
- }
- }
- apr_file_printf( file, "\n</wearable_info>\n" );
+ for (S32 type = 0; type < LLWearableType::WT_COUNT; type++)
+ {
+ const std::string& type_name = wr_inst->getTypeName((LLWearableType::EType)type);
+ for (U32 j=0; j< wd->getWearableCount((LLWearableType::EType)type); j++)
+ {
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable((LLWearableType::EType)type,j);
+ apr_file_printf( file, "\n\t <wearable type=\"%s\" name=\"%s\"/>\n",
+ type_name.c_str(), wearable->getName().c_str() );
+ LLWearable::visual_param_vec_t v_params;
+ wearable->getVisualParams(v_params);
+ for (LLWearable::visual_param_vec_t::iterator it = v_params.begin();
+ it != v_params.end(); ++it)
+ {
+ LLVisualParam *param = *it;
+ dump_visual_param(file, param, param->getWeight());
+ }
+ }
+ }
+ apr_file_printf( file, "\n</wearable_info>\n" );
}
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 6384e2b844..736bc11a4c 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,9 +43,9 @@ class LLInventoryCallback;
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLVOAvatarSelf :
- public LLVOAvatar
+ public LLVOAvatar
{
- LOG_CLASS(LLVOAvatarSelf);
+ LOG_CLASS(LLVOAvatarSelf);
/********************************************************************************
** **
@@ -53,16 +53,16 @@ class LLVOAvatarSelf :
**/
public:
- LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
- virtual ~LLVOAvatarSelf();
- virtual void markDead();
- virtual void initInstance(); // Called after construction to initialize the class.
- void cleanup();
+ LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+ virtual ~LLVOAvatarSelf();
+ virtual void markDead();
+ virtual void initInstance(); // Called after construction to initialize the class.
+ void cleanup();
protected:
- /*virtual*/ BOOL loadAvatar();
- BOOL loadAvatarSelf();
- BOOL buildSkeletonSelf(const LLAvatarSkeletonInfo *info);
- BOOL buildMenus();
+ /*virtual*/ BOOL loadAvatar();
+ BOOL loadAvatarSelf();
+ BOOL buildSkeletonSelf(const LLAvatarSkeletonInfo *info);
+ BOOL buildMenus();
/** Initialization
** **
@@ -73,35 +73,35 @@ protected:
** INHERITED
**/
- //--------------------------------------------------------------------
- // LLViewerObject interface and related
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // LLViewerObject interface and related
+ //--------------------------------------------------------------------
public:
- boost::signals2::connection mRegionChangedSlot;
+ boost::signals2::connection mRegionChangedSlot;
- void onSimulatorFeaturesReceived(const LLUUID& region_id);
- /*virtual*/ void updateRegion(LLViewerRegion *regionp);
- /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
+ void onSimulatorFeaturesReceived(const LLUUID& region_id);
+ /*virtual*/ void updateRegion(LLViewerRegion *regionp);
+ /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
- //--------------------------------------------------------------------
- // LLCharacter interface and related
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // LLCharacter interface and related
+ //--------------------------------------------------------------------
public:
- /*virtual*/ bool hasMotionFromSource(const LLUUID& source_id);
- /*virtual*/ void stopMotionFromSource(const LLUUID& source_id);
- /*virtual*/ void requestStopMotion(LLMotion* motion);
- /*virtual*/ LLJoint* getJoint(const std::string &name);
-
- /*virtual*/ BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight);
- /*virtual*/ BOOL setVisualParamWeight(const char* param_name, F32 weight);
- /*virtual*/ BOOL setVisualParamWeight(S32 index, F32 weight);
- /*virtual*/ void updateVisualParams();
- void writeWearablesToAvatar();
- /*virtual*/ void idleUpdateAppearanceAnimation();
+ /*virtual*/ bool hasMotionFromSource(const LLUUID& source_id);
+ /*virtual*/ void stopMotionFromSource(const LLUUID& source_id);
+ /*virtual*/ void requestStopMotion(LLMotion* motion);
+ /*virtual*/ LLJoint* getJoint(const std::string &name);
+
+ /*virtual*/ BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight);
+ /*virtual*/ BOOL setVisualParamWeight(const char* param_name, F32 weight);
+ /*virtual*/ BOOL setVisualParamWeight(S32 index, F32 weight);
+ /*virtual*/ void updateVisualParams();
+ void writeWearablesToAvatar();
+ /*virtual*/ void idleUpdateAppearanceAnimation();
private:
- // helper function. Passed in param is assumed to be in avatar's parameter list.
- BOOL setParamWeight(const LLViewerVisualParam *param, F32 weight);
+ // helper function. Passed in param is assumed to be in avatar's parameter list.
+ BOOL setParamWeight(const LLViewerVisualParam *param, F32 weight);
/********************************************************************************
** **
@@ -109,33 +109,33 @@ private:
**/
public:
- /*virtual*/ bool isSelf() const { return true; }
- /*virtual*/ BOOL isValid() const;
+ /*virtual*/ bool isSelf() const { return true; }
+ /*virtual*/ BOOL isValid() const;
- //--------------------------------------------------------------------
- // Updates
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Updates
+ //--------------------------------------------------------------------
public:
- /*virtual*/ bool updateCharacter(LLAgent &agent);
- /*virtual*/ void idleUpdateTractorBeam();
- bool checkStuckAppearance();
+ /*virtual*/ bool updateCharacter(LLAgent &agent);
+ /*virtual*/ void idleUpdateTractorBeam();
+ bool checkStuckAppearance();
- //--------------------------------------------------------------------
- // Loading state
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Loading state
+ //--------------------------------------------------------------------
public:
- /*virtual*/ bool getIsCloud() const;
+ /*virtual*/ bool getIsCloud() const;
- //--------------------------------------------------------------------
- // Region state
- //--------------------------------------------------------------------
- void resetRegionCrossingTimer() { mRegionCrossingTimer.reset(); }
+ //--------------------------------------------------------------------
+ // Region state
+ //--------------------------------------------------------------------
+ void resetRegionCrossingTimer() { mRegionCrossingTimer.reset(); }
private:
- U64 mLastRegionHandle;
- LLFrameTimer mRegionCrossingTimer;
- S32 mRegionCrossingCount;
-
+ U64 mLastRegionHandle;
+ LLFrameTimer mRegionCrossingTimer;
+ S32 mRegionCrossingCount;
+
/** State
** **
*******************************************************************************/
@@ -145,22 +145,22 @@ private:
** RENDERING
**/
- //--------------------------------------------------------------------
- // Render beam
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Render beam
+ //--------------------------------------------------------------------
protected:
- BOOL needsRenderBeam();
+ BOOL needsRenderBeam();
private:
- LLPointer<LLHUDEffectSpiral> mBeam;
- LLFrameTimer mBeamTimer;
+ LLPointer<LLHUDEffectSpiral> mBeam;
+ LLFrameTimer mBeamTimer;
- //--------------------------------------------------------------------
- // LLVOAvatar Constants
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // LLVOAvatar Constants
+ //--------------------------------------------------------------------
public:
- /*virtual*/ LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLGLTexture::BOOST_AVATAR_SELF; }
- /*virtual*/ LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLGLTexture::BOOST_AVATAR_BAKED_SELF; }
- /*virtual*/ S32 getTexImageSize() const { return LLVOAvatar::getTexImageSize()*4; }
+ /*virtual*/ LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLGLTexture::BOOST_AVATAR_SELF; }
+ /*virtual*/ LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLGLTexture::BOOST_AVATAR_BAKED_SELF; }
+ /*virtual*/ S32 getTexImageSize() const { return LLVOAvatar::getTexImageSize()*4; }
/** Rendering
** **
@@ -171,86 +171,86 @@ public:
** TEXTURES
**/
- //--------------------------------------------------------------------
- // Loading status
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Loading status
+ //--------------------------------------------------------------------
public:
- S32 getLocalDiscardLevel(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
- bool areTexturesCurrent() const;
- BOOL isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const;
- BOOL isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const;
- // If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index
- /*virtual*/ BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
- /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
- /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const;
-
-
- //--------------------------------------------------------------------
- // Local Textures
- //--------------------------------------------------------------------
+ S32 getLocalDiscardLevel(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
+ bool areTexturesCurrent() const;
+ BOOL isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const;
+ BOOL isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const;
+ // If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index
+ /*virtual*/ BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
+ /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
+ /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const;
+
+
+ //--------------------------------------------------------------------
+ // Local Textures
+ //--------------------------------------------------------------------
public:
- BOOL getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture** image_gl_pp, U32 index) const;
- LLViewerFetchedTexture* getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
- const LLUUID& getLocalTextureID(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
- void setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index);
- /*virtual*/ void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index);
+ BOOL getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture** image_gl_pp, U32 index) const;
+ LLViewerFetchedTexture* getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
+ const LLUUID& getLocalTextureID(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
+ void setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index);
+ /*virtual*/ void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index);
protected:
- /*virtual*/ void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index);
- void localTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
- void getLocalTextureByteCount(S32* gl_byte_count) const;
- /*virtual*/ void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
- LLLocalTextureObject* getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 index) const;
+ /*virtual*/ void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index);
+ void localTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+ void getLocalTextureByteCount(S32* gl_byte_count) const;
+ /*virtual*/ void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
+ LLLocalTextureObject* getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 index) const;
private:
- static void onLocalTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+ static void onLocalTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
- /*virtual*/ void setImage(const U8 te, LLViewerTexture *imagep, const U32 index);
- /*virtual*/ LLViewerTexture* getImage(const U8 te, const U32 index) const;
+ /*virtual*/ void setImage(const U8 te, LLViewerTexture *imagep, const U32 index);
+ /*virtual*/ LLViewerTexture* getImage(const U8 te, const U32 index) const;
- //--------------------------------------------------------------------
- // Baked textures
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Baked textures
+ //--------------------------------------------------------------------
public:
- LLAvatarAppearanceDefines::ETextureIndex getBakedTE(const LLViewerTexLayerSet* layerset ) const;
- // SUNSHINE CLEANUP - dead? or update to just call request appearance update?
- void forceBakeAllTextures(bool slam_for_debug = false);
+ LLAvatarAppearanceDefines::ETextureIndex getBakedTE(const LLViewerTexLayerSet* layerset ) const;
+ // SUNSHINE CLEANUP - dead? or update to just call request appearance update?
+ void forceBakeAllTextures(bool slam_for_debug = false);
protected:
- /*virtual*/ void removeMissingBakedTextures();
+ /*virtual*/ void removeMissingBakedTextures();
- //--------------------------------------------------------------------
- // Layers
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Layers
+ //--------------------------------------------------------------------
public:
- void requestLayerSetUpdate(LLAvatarAppearanceDefines::ETextureIndex i);
- LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
- LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::ETextureIndex index) const;
-
-
- //--------------------------------------------------------------------
- // Composites
- //--------------------------------------------------------------------
+ void requestLayerSetUpdate(LLAvatarAppearanceDefines::ETextureIndex i);
+ LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
+ LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::ETextureIndex index) const;
+
+
+ //--------------------------------------------------------------------
+ // Composites
+ //--------------------------------------------------------------------
public:
- /* virtual */ void invalidateComposite(LLTexLayerSet* layerset);
- /* virtual */ void invalidateAll();
- /* virtual */ void setCompositeUpdatesEnabled(bool b); // only works for self
- /* virtual */ void setCompositeUpdatesEnabled(U32 index, bool b);
- /* virtual */ bool isCompositeUpdateEnabled(U32 index);
- void setupComposites();
- void updateComposites();
+ /* virtual */ void invalidateComposite(LLTexLayerSet* layerset);
+ /* virtual */ void invalidateAll();
+ /* virtual */ void setCompositeUpdatesEnabled(bool b); // only works for self
+ /* virtual */ void setCompositeUpdatesEnabled(U32 index, bool b);
+ /* virtual */ bool isCompositeUpdateEnabled(U32 index);
+ void setupComposites();
+ void updateComposites();
- const LLUUID& grabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
- BOOL canGrabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
+ const LLUUID& grabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
+ BOOL canGrabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
- //--------------------------------------------------------------------
- // Scratch textures (used for compositing)
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Scratch textures (used for compositing)
+ //--------------------------------------------------------------------
public:
- static void deleteScratchTextures();
+ static void deleteScratchTextures();
private:
- static S32Bytes sScratchTexBytes;
- static std::map< LLGLenum, LLGLuint*> sScratchTexNames;
+ static S32Bytes sScratchTexBytes;
+ static std::map< LLGLenum, LLGLuint*> sScratchTexNames;
/** Textures
** **
@@ -261,7 +261,7 @@ private:
** MESHES
**/
protected:
- /*virtual*/ void restoreMeshData();
+ /*virtual*/ void restoreMeshData();
/** Meshes
** **
@@ -273,30 +273,30 @@ protected:
**/
public:
- void wearableUpdated(LLWearableType::EType type);
+ void wearableUpdated(LLWearableType::EType type);
protected:
- U32 getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const;
+ U32 getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const;
- //--------------------------------------------------------------------
- // Attachments
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Attachments
+ //--------------------------------------------------------------------
public:
- void updateAttachmentVisibility(U32 camera_mode);
- BOOL isWearingAttachment(const LLUUID& inv_item_id) const;
- LLViewerObject* getWornAttachment(const LLUUID& inv_item_id);
- bool getAttachedPointName(const LLUUID& inv_item_id, std::string& name) const;
- /*virtual*/ const LLViewerJointAttachment *attachObject(LLViewerObject *viewer_object);
- /*virtual*/ BOOL detachObject(LLViewerObject *viewer_object);
- static BOOL detachAttachmentIntoInventory(const LLUUID& item_id);
+ void updateAttachmentVisibility(U32 camera_mode);
+ BOOL isWearingAttachment(const LLUUID& inv_item_id) const;
+ LLViewerObject* getWornAttachment(const LLUUID& inv_item_id);
+ bool getAttachedPointName(const LLUUID& inv_item_id, std::string& name) const;
+ /*virtual*/ const LLViewerJointAttachment *attachObject(LLViewerObject *viewer_object);
+ /*virtual*/ BOOL detachObject(LLViewerObject *viewer_object);
+ static BOOL detachAttachmentIntoInventory(const LLUUID& item_id);
bool hasAttachmentsInTrash();
- //--------------------------------------------------------------------
- // HUDs
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // HUDs
+ //--------------------------------------------------------------------
private:
- LLViewerJoint* mScreenp; // special purpose joint for HUD attachments
-
+ LLViewerJoint* mScreenp; // special purpose joint for HUD attachments
+
/** Attachments
** **
*******************************************************************************/
@@ -307,26 +307,26 @@ private:
**/
public:
- static void onCustomizeStart(bool disable_camera_switch = false);
- static void onCustomizeEnd(bool disable_camera_switch = false);
- LLPointer<LLInventoryCallback> mEndCustomizeCallback;
+ static void onCustomizeStart(bool disable_camera_switch = false);
+ static void onCustomizeEnd(bool disable_camera_switch = false);
+ LLPointer<LLInventoryCallback> mEndCustomizeCallback;
- //--------------------------------------------------------------------
- // Visibility
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Visibility
+ //--------------------------------------------------------------------
/* virtual */ bool shouldRenderRigged() const;
-
+
public:
- bool sendAppearanceMessage(LLMessageSystem *mesgsys) const;
+ bool sendAppearanceMessage(LLMessageSystem *mesgsys) const;
- // -- care and feeding of hover height.
- void setHoverIfRegionEnabled();
- void sendHoverHeight() const;
- /*virtual*/ void setHoverOffset(const LLVector3& hover_offset, bool send_update=true);
+ // -- care and feeding of hover height.
+ void setHoverIfRegionEnabled();
+ void sendHoverHeight() const;
+ /*virtual*/ void setHoverOffset(const LLVector3& hover_offset, bool send_update=true);
private:
- mutable LLVector3 mLastHoverOffsetSent;
+ mutable LLVector3 mLastHoverOffsetSent;
/** Appearance
** **
@@ -337,58 +337,58 @@ private:
** DIAGNOSTICS
**/
- //--------------------------------------------------------------------
- // General
- //--------------------------------------------------------------------
-public:
- static void dumpTotalLocalTextureByteCount();
- void dumpLocalTextures() const;
- static void dumpScratchTextureByteCount();
- void dumpWearableInfo(LLAPRFile& outfile);
-
- //--------------------------------------------------------------------
- // Avatar Rez Metrics
- //--------------------------------------------------------------------
-public:
- struct LLAvatarTexData
- {
- LLAvatarTexData(const LLUUID& id, LLAvatarAppearanceDefines::ETextureIndex index) :
- mAvatarID(id),
- mIndex(index)
- {}
- LLUUID mAvatarID;
- LLAvatarAppearanceDefines::ETextureIndex mIndex;
- };
-
- LLTimer mTimeSinceLastRezMessage;
- bool updateAvatarRezMetrics(bool force_send);
-
- std::vector<LLSD> mPendingTimerRecords;
- void addMetricsTimerRecord(const LLSD& record);
-
- void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); }
- void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); }
- void outputRezDiagnostics() const;
- void outputRezTiming(const std::string& msg) const;
- void reportAvatarRezTime() const;
- void debugBakedTextureUpload(LLAvatarAppearanceDefines::EBakedTextureIndex index, BOOL finished);
- static void debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
-
- BOOL isAllLocalTextureDataFinal() const;
-
- const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return (LLViewerTexLayerSet*)(mBakedTextureDatas[index].mTexLayerSet); }
- const std::string verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer
- void dumpAllTextures() const;
- const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer
- const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD
- void sendViewerAppearanceChangeMetrics(); // send data associated with completing a change.
+ //--------------------------------------------------------------------
+ // General
+ //--------------------------------------------------------------------
+public:
+ static void dumpTotalLocalTextureByteCount();
+ void dumpLocalTextures() const;
+ static void dumpScratchTextureByteCount();
+ void dumpWearableInfo(LLAPRFile& outfile);
+
+ //--------------------------------------------------------------------
+ // Avatar Rez Metrics
+ //--------------------------------------------------------------------
+public:
+ struct LLAvatarTexData
+ {
+ LLAvatarTexData(const LLUUID& id, LLAvatarAppearanceDefines::ETextureIndex index) :
+ mAvatarID(id),
+ mIndex(index)
+ {}
+ LLUUID mAvatarID;
+ LLAvatarAppearanceDefines::ETextureIndex mIndex;
+ };
+
+ LLTimer mTimeSinceLastRezMessage;
+ bool updateAvatarRezMetrics(bool force_send);
+
+ std::vector<LLSD> mPendingTimerRecords;
+ void addMetricsTimerRecord(const LLSD& record);
+
+ void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); }
+ void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); }
+ void outputRezDiagnostics() const;
+ void outputRezTiming(const std::string& msg) const;
+ void reportAvatarRezTime() const;
+ void debugBakedTextureUpload(LLAvatarAppearanceDefines::EBakedTextureIndex index, BOOL finished);
+ static void debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+
+ BOOL isAllLocalTextureDataFinal() const;
+
+ const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return (LLViewerTexLayerSet*)(mBakedTextureDatas[index].mTexLayerSet); }
+ const std::string verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer
+ void dumpAllTextures() const;
+ const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer
+ const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD
+ void sendViewerAppearanceChangeMetrics(); // send data associated with completing a change.
private:
- LLFrameTimer mDebugSelfLoadTimer;
- F32 mDebugTimeWearablesLoaded;
- F32 mDebugTimeAvatarVisible;
- F32 mDebugTextureLoadTimes[LLAvatarAppearanceDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level
- F32 mDebugBakedTextureTimes[LLAvatarAppearanceDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture
- void debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+ LLFrameTimer mDebugSelfLoadTimer;
+ F32 mDebugTimeWearablesLoaded;
+ F32 mDebugTimeAvatarVisible;
+ F32 mDebugTextureLoadTimes[LLAvatarAppearanceDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level
+ F32 mDebugBakedTextureTimes[LLAvatarAppearanceDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture
+ void debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
void appearanceChangeMetricsCoro(std::string url);
bool mInitialMetric;
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index dd5b9f9fd5..e5633f665f 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvocache.cpp
* @brief Cache of objects on the viewer.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,20 +45,20 @@ BOOL LLVOCachePartition::sNeedsOcclusionCheck = FALSE;
const S32 ENTRY_HEADER_SIZE = 6 * sizeof(S32);
const S32 MAX_ENTRY_BODY_SIZE = 10000;
-BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes)
+BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes)
{
- return apr_file->read(src, n_bytes) == n_bytes ;
+ return apr_file->read(src, n_bytes) == n_bytes ;
}
-BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes)
+BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes)
{
- return apr_file->write(src, n_bytes) == n_bytes ;
+ return apr_file->write(src, n_bytes) == n_bytes ;
}
bool LLGLTFOverrideCacheEntry::fromLLSD(const LLSD& data)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
-
+
llassert(data.has("local_id"));
llassert(data.has("object_id"));
llassert(data.has("region_handle_x") && data.has("region_handle_y"));
@@ -152,57 +152,57 @@ LLSD LLGLTFOverrideCacheEntry::toLLSD() const
//---------------------------------------------------------------------------
LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp)
-: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY),
- mLocalID(local_id),
- mCRC(crc),
- mUpdateFlags(-1),
- mHitCount(0),
- mDupeCount(0),
- mCRCChangeCount(0),
- mState(INACTIVE),
- mSceneContrib(0.f),
- mValid(TRUE),
- mParentID(0),
- mBSphereRadius(-1.0f)
+: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY),
+ mLocalID(local_id),
+ mCRC(crc),
+ mUpdateFlags(-1),
+ mHitCount(0),
+ mDupeCount(0),
+ mCRCChangeCount(0),
+ mState(INACTIVE),
+ mSceneContrib(0.f),
+ mValid(TRUE),
+ mParentID(0),
+ mBSphereRadius(-1.0f)
{
- mBuffer = new U8[dp.getBufferSize()];
- mDP.assignBuffer(mBuffer, dp.getBufferSize());
- mDP = dp;
+ mBuffer = new U8[dp.getBufferSize()];
+ mDP.assignBuffer(mBuffer, dp.getBufferSize());
+ mDP = dp;
}
LLVOCacheEntry::LLVOCacheEntry()
-: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY),
- mLocalID(0),
- mCRC(0),
- mUpdateFlags(-1),
- mHitCount(0),
- mDupeCount(0),
- mCRCChangeCount(0),
- mBuffer(NULL),
- mState(INACTIVE),
- mSceneContrib(0.f),
- mValid(TRUE),
- mParentID(0),
- mBSphereRadius(-1.0f)
+: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY),
+ mLocalID(0),
+ mCRC(0),
+ mUpdateFlags(-1),
+ mHitCount(0),
+ mDupeCount(0),
+ mCRCChangeCount(0),
+ mBuffer(NULL),
+ mState(INACTIVE),
+ mSceneContrib(0.f),
+ mValid(TRUE),
+ mParentID(0),
+ mBSphereRadius(-1.0f)
{
- mDP.assignBuffer(mBuffer, 0);
+ mDP.assignBuffer(mBuffer, 0);
}
LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file)
-: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY),
- mBuffer(NULL),
- mUpdateFlags(-1),
- mState(INACTIVE),
- mSceneContrib(0.f),
- mValid(FALSE),
- mParentID(0),
- mBSphereRadius(-1.0f)
+: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY),
+ mBuffer(NULL),
+ mUpdateFlags(-1),
+ mState(INACTIVE),
+ mSceneContrib(0.f),
+ mValid(FALSE),
+ mParentID(0),
+ mBSphereRadius(-1.0f)
{
- S32 size = -1;
- BOOL success;
+ S32 size = -1;
+ BOOL success;
static U8 data_buffer[ENTRY_HEADER_SIZE];
- mDP.assignBuffer(mBuffer, 0);
+ mDP.assignBuffer(mBuffer, 0);
success = check_read(apr_file, (void *)data_buffer, ENTRY_HEADER_SIZE);
if (success)
@@ -214,214 +214,214 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file)
memcpy(&mCRCChangeCount, data_buffer + (4 * sizeof(U32)), sizeof(S32));
memcpy(&size, data_buffer + (5 * sizeof(U32)), sizeof(S32));
- // Corruption in the cache entries
- if ((size > MAX_ENTRY_BODY_SIZE) || (size < 1))
- {
- // We've got a bogus size, skip reading it.
- // We won't bother seeking, because the rest of this file
- // is likely bogus, and will be tossed anyway.
- LL_WARNS() << "Bogus cache entry, size " << size << ", aborting!" << LL_ENDL;
- success = FALSE;
- }
- }
- if(success && size > 0)
- {
- mBuffer = new U8[size];
- success = check_read(apr_file, mBuffer, size);
-
- if(success)
- {
- mDP.assignBuffer(mBuffer, size);
- }
- else
- {
- delete[] mBuffer ;
- mBuffer = NULL ;
- }
- }
-
- if(!success)
- {
- mLocalID = 0;
- mCRC = 0;
- mHitCount = 0;
- mDupeCount = 0;
- mCRCChangeCount = 0;
- mBuffer = NULL;
- mEntry = NULL;
- mState = INACTIVE;
- }
+ // Corruption in the cache entries
+ if ((size > MAX_ENTRY_BODY_SIZE) || (size < 1))
+ {
+ // We've got a bogus size, skip reading it.
+ // We won't bother seeking, because the rest of this file
+ // is likely bogus, and will be tossed anyway.
+ LL_WARNS() << "Bogus cache entry, size " << size << ", aborting!" << LL_ENDL;
+ success = FALSE;
+ }
+ }
+ if(success && size > 0)
+ {
+ mBuffer = new U8[size];
+ success = check_read(apr_file, mBuffer, size);
+
+ if(success)
+ {
+ mDP.assignBuffer(mBuffer, size);
+ }
+ else
+ {
+ delete[] mBuffer ;
+ mBuffer = NULL ;
+ }
+ }
+
+ if(!success)
+ {
+ mLocalID = 0;
+ mCRC = 0;
+ mHitCount = 0;
+ mDupeCount = 0;
+ mCRCChangeCount = 0;
+ mBuffer = NULL;
+ mEntry = NULL;
+ mState = INACTIVE;
+ }
}
LLVOCacheEntry::~LLVOCacheEntry()
{
- mDP.freeBuffer();
+ mDP.freeBuffer();
}
void LLVOCacheEntry::updateEntry(U32 crc, LLDataPackerBinaryBuffer &dp)
-{
- if(mCRC != crc)
- {
- mCRC = crc;
- mCRCChangeCount++;
- }
-
- mDP.freeBuffer();
-
- llassert_always(dp.getBufferSize() > 0);
- mBuffer = new U8[dp.getBufferSize()];
- mDP.assignBuffer(mBuffer, dp.getBufferSize());
- mDP = dp;
+{
+ if(mCRC != crc)
+ {
+ mCRC = crc;
+ mCRCChangeCount++;
+ }
+
+ mDP.freeBuffer();
+
+ llassert_always(dp.getBufferSize() > 0);
+ mBuffer = new U8[dp.getBufferSize()];
+ mDP.assignBuffer(mBuffer, dp.getBufferSize());
+ mDP = dp;
}
-void LLVOCacheEntry::setParentID(U32 id)
+void LLVOCacheEntry::setParentID(U32 id)
{
- if(mParentID != id)
- {
- removeAllChildren();
- mParentID = id;
- }
+ if(mParentID != id)
+ {
+ removeAllChildren();
+ mParentID = id;
+ }
}
void LLVOCacheEntry::removeAllChildren()
{
- if(mChildrenList.empty())
- {
- return;
- }
-
- for(vocache_entry_set_t::iterator iter = mChildrenList.begin(); iter != mChildrenList.end(); ++iter)
- {
- (*iter)->setParentID(0);
- }
- mChildrenList.clear();
-
- return;
+ if(mChildrenList.empty())
+ {
+ return;
+ }
+
+ for(vocache_entry_set_t::iterator iter = mChildrenList.begin(); iter != mChildrenList.end(); ++iter)
+ {
+ (*iter)->setParentID(0);
+ }
+ mChildrenList.clear();
+
+ return;
}
-//virtual
+//virtual
void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry)
{
- if(!entry && mDP.getBufferSize() > 0)
- {
- LLUUID fullid;
- LLViewerObject::unpackUUID(&mDP, fullid, "ID");
-
- LLViewerObject* obj = gObjectList.findObject(fullid);
- if(obj && obj->mDrawable)
- {
- entry = obj->mDrawable->getEntry();
- }
- }
-
- LLViewerOctreeEntryData::setOctreeEntry(entry);
+ if(!entry && mDP.getBufferSize() > 0)
+ {
+ LLUUID fullid;
+ LLViewerObject::unpackUUID(&mDP, fullid, "ID");
+
+ LLViewerObject* obj = gObjectList.findObject(fullid);
+ if(obj && obj->mDrawable)
+ {
+ entry = obj->mDrawable->getEntry();
+ }
+ }
+
+ LLViewerOctreeEntryData::setOctreeEntry(entry);
}
void LLVOCacheEntry::setState(U32 state)
{
- if(state > LOW_BITS) //special states
- {
- mState |= (HIGH_BITS & state);
- return;
- }
-
- //
- //otherwise LOW_BITS states
- //
- clearState(LOW_BITS);
- mState |= (LOW_BITS & state);
-
- if(getState() == ACTIVE)
- {
- const S32 MIN_INTERVAL = 64 + sMinFrameRange;
- U32 last_visible = getVisible();
-
- setVisible();
-
- U32 cur_visible = getVisible();
- if(cur_visible - last_visible > MIN_INTERVAL ||
- cur_visible < MIN_INTERVAL)
- {
- mLastCameraUpdated = 0; //reset
- }
- else
- {
- mLastCameraUpdated = LLViewerRegion::sLastCameraUpdated;
- }
- }
+ if(state > LOW_BITS) //special states
+ {
+ mState |= (HIGH_BITS & state);
+ return;
+ }
+
+ //
+ //otherwise LOW_BITS states
+ //
+ clearState(LOW_BITS);
+ mState |= (LOW_BITS & state);
+
+ if(getState() == ACTIVE)
+ {
+ const S32 MIN_INTERVAL = 64 + sMinFrameRange;
+ U32 last_visible = getVisible();
+
+ setVisible();
+
+ U32 cur_visible = getVisible();
+ if(cur_visible - last_visible > MIN_INTERVAL ||
+ cur_visible < MIN_INTERVAL)
+ {
+ mLastCameraUpdated = 0; //reset
+ }
+ else
+ {
+ mLastCameraUpdated = LLViewerRegion::sLastCameraUpdated;
+ }
+ }
}
void LLVOCacheEntry::addChild(LLVOCacheEntry* entry)
{
- llassert(entry != NULL);
- llassert(entry->getParentID() == mLocalID);
- llassert(entry->getEntry() != NULL);
-
- if(!entry || !entry->getEntry() || entry->getParentID() != mLocalID)
- {
- return;
- }
-
- mChildrenList.insert(entry);
-
- //update parent bbox
- if(getEntry() != NULL && isState(INACTIVE))
- {
- updateParentBoundingInfo(entry);
- resetVisible();
- }
+ llassert(entry != NULL);
+ llassert(entry->getParentID() == mLocalID);
+ llassert(entry->getEntry() != NULL);
+
+ if(!entry || !entry->getEntry() || entry->getParentID() != mLocalID)
+ {
+ return;
+ }
+
+ mChildrenList.insert(entry);
+
+ //update parent bbox
+ if(getEntry() != NULL && isState(INACTIVE))
+ {
+ updateParentBoundingInfo(entry);
+ resetVisible();
+ }
}
-
+
void LLVOCacheEntry::removeChild(LLVOCacheEntry* entry)
{
- entry->setParentID(0);
+ entry->setParentID(0);
- vocache_entry_set_t::iterator iter = mChildrenList.find(entry);
- if(iter != mChildrenList.end())
- {
- mChildrenList.erase(iter);
- }
+ vocache_entry_set_t::iterator iter = mChildrenList.find(entry);
+ if(iter != mChildrenList.end())
+ {
+ mChildrenList.erase(iter);
+ }
}
//remove the first child, and return it.
LLVOCacheEntry* LLVOCacheEntry::getChild()
{
- LLVOCacheEntry* child = NULL;
- vocache_entry_set_t::iterator iter = mChildrenList.begin();
- if(iter != mChildrenList.end())
- {
- child = *iter;
- mChildrenList.erase(iter);
- }
-
- return child;
+ LLVOCacheEntry* child = NULL;
+ vocache_entry_set_t::iterator iter = mChildrenList.begin();
+ if(iter != mChildrenList.end())
+ {
+ child = *iter;
+ mChildrenList.erase(iter);
+ }
+
+ return child;
}
LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP()
{
- if (mDP.getBufferSize() == 0)
- {
- //LL_INFOS() << "Not getting cache entry, invalid!" << LL_ENDL;
- return NULL;
- }
-
- return &mDP;
+ if (mDP.getBufferSize() == 0)
+ {
+ //LL_INFOS() << "Not getting cache entry, invalid!" << LL_ENDL;
+ return NULL;
+ }
+
+ return &mDP;
}
void LLVOCacheEntry::recordHit()
{
- mHitCount++;
+ mHitCount++;
}
void LLVOCacheEntry::dump() const
{
- LL_INFOS() << "local " << mLocalID
- << " crc " << mCRC
- << " hits " << mHitCount
- << " dupes " << mDupeCount
- << " change " << mCRCChangeCount
- << LL_ENDL;
+ LL_INFOS() << "local " << mLocalID
+ << " crc " << mCRC
+ << " hits " << mHitCount
+ << " dupes " << mDupeCount
+ << " change " << mCRCChangeCount
+ << LL_ENDL;
}
S32 LLVOCacheEntry::writeToBuffer(U8 *data_buffer) const
@@ -446,34 +446,34 @@ S32 LLVOCacheEntry::writeToBuffer(U8 *data_buffer) const
}
#ifndef LL_TEST
-//static
+//static
void LLVOCacheEntry::updateDebugSettings()
{
- static LLFrameTimer timer;
- if(timer.getElapsedTimeF32() < 1.0f) //update frequency once per second.
- {
- return;
- }
- timer.reset();
-
- //objects within the view frustum whose visible area is greater than this threshold will be loaded
- static LLCachedControl<F32> front_pixel_threshold(gSavedSettings,"SceneLoadFrontPixelThreshold");
- sFrontPixelThreshold = front_pixel_threshold;
-
- //objects out of the view frustum whose visible area is greater than this threshold will remain loaded
- static LLCachedControl<F32> rear_pixel_threshold(gSavedSettings,"SceneLoadRearPixelThreshold");
- sRearPixelThreshold = rear_pixel_threshold;
- sRearPixelThreshold = llmax(sRearPixelThreshold, sFrontPixelThreshold); //can not be smaller than sFrontPixelThreshold.
-
- //make parameters adaptive to memory usage
- //starts to put restrictions from low_mem_bound_MB, apply tightest restrictions when hits high_mem_bound_MB
- static LLCachedControl<U32> low_mem_bound_MB(gSavedSettings,"SceneLoadLowMemoryBound");
- static LLCachedControl<U32> high_mem_bound_MB(gSavedSettings,"SceneLoadHighMemoryBound");
-
- LLMemory::updateMemoryInfo() ;
- U32 allocated_mem = LLMemory::getAllocatedMemKB().value();
+ static LLFrameTimer timer;
+ if(timer.getElapsedTimeF32() < 1.0f) //update frequency once per second.
+ {
+ return;
+ }
+ timer.reset();
+
+ //objects within the view frustum whose visible area is greater than this threshold will be loaded
+ static LLCachedControl<F32> front_pixel_threshold(gSavedSettings,"SceneLoadFrontPixelThreshold");
+ sFrontPixelThreshold = front_pixel_threshold;
+
+ //objects out of the view frustum whose visible area is greater than this threshold will remain loaded
+ static LLCachedControl<F32> rear_pixel_threshold(gSavedSettings,"SceneLoadRearPixelThreshold");
+ sRearPixelThreshold = rear_pixel_threshold;
+ sRearPixelThreshold = llmax(sRearPixelThreshold, sFrontPixelThreshold); //can not be smaller than sFrontPixelThreshold.
+
+ //make parameters adaptive to memory usage
+ //starts to put restrictions from low_mem_bound_MB, apply tightest restrictions when hits high_mem_bound_MB
+ static LLCachedControl<U32> low_mem_bound_MB(gSavedSettings,"SceneLoadLowMemoryBound");
+ static LLCachedControl<U32> high_mem_bound_MB(gSavedSettings,"SceneLoadHighMemoryBound");
+
+ LLMemory::updateMemoryInfo() ;
+ U32 allocated_mem = LLMemory::getAllocatedMemKB().value();
static const F32 KB_to_MB = 1.f / 1024.f;
- U32 clamped_memory = llclamp(allocated_mem * KB_to_MB, (F32) low_mem_bound_MB, (F32) high_mem_bound_MB);
+ U32 clamped_memory = llclamp(allocated_mem * KB_to_MB, (F32) low_mem_bound_MB, (F32) high_mem_bound_MB);
const F32 adjust_range = high_mem_bound_MB - low_mem_bound_MB;
const F32 adjust_factor = (high_mem_bound_MB - clamped_memory) / adjust_range; // [0, 1]
@@ -500,613 +500,613 @@ void LLVOCacheEntry::updateDebugSettings()
}
#endif // LL_TEST
-//static
+//static
F32 LLVOCacheEntry::getSquaredPixelThreshold(bool is_front)
{
- F32 threshold;
- if(is_front)
- {
- threshold = sFrontPixelThreshold;
- }
- else
- {
- threshold = sRearPixelThreshold;
- }
-
- //object projected area threshold
- F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
- F32 projection_threshold = pixel_meter_ratio > 0.f ? threshold / pixel_meter_ratio : 0.f;
- projection_threshold *= projection_threshold;
-
- return projection_threshold;
+ F32 threshold;
+ if(is_front)
+ {
+ threshold = sFrontPixelThreshold;
+ }
+ else
+ {
+ threshold = sRearPixelThreshold;
+ }
+
+ //object projected area threshold
+ F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
+ F32 projection_threshold = pixel_meter_ratio > 0.f ? threshold / pixel_meter_ratio : 0.f;
+ projection_threshold *= projection_threshold;
+
+ return projection_threshold;
}
bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold)
{
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup();
- if(!group)
- {
- return false;
- }
-
- //any visible
- bool vis = group->isAnyRecentlyVisible();
-
- //not ready to remove
- if(!vis)
- {
- S32 cur_vis = llmax(group->getAnyVisible(), (S32)getVisible());
- vis = (cur_vis + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame());
- }
-
- //within the back sphere
- if(!vis && !mParentID && !group->isOcclusionState(LLOcclusionCullingGroup::OCCLUDED))
- {
- LLVector4a lookAt;
-
- if(mBSphereRadius > 0.f)
- {
- lookAt.setSub(mBSphereCenter, local_camera_origin);
- dist_threshold += mBSphereRadius;
- }
- else
- {
- lookAt.setSub(getPositionGroup(), camera_origin);
- dist_threshold += getBinRadius();
- }
-
- vis = (lookAt.dot3(lookAt).getF32() < dist_threshold * dist_threshold);
- }
-
- return vis;
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup();
+ if(!group)
+ {
+ return false;
+ }
+
+ //any visible
+ bool vis = group->isAnyRecentlyVisible();
+
+ //not ready to remove
+ if(!vis)
+ {
+ S32 cur_vis = llmax(group->getAnyVisible(), (S32)getVisible());
+ vis = (cur_vis + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame());
+ }
+
+ //within the back sphere
+ if(!vis && !mParentID && !group->isOcclusionState(LLOcclusionCullingGroup::OCCLUDED))
+ {
+ LLVector4a lookAt;
+
+ if(mBSphereRadius > 0.f)
+ {
+ lookAt.setSub(mBSphereCenter, local_camera_origin);
+ dist_threshold += mBSphereRadius;
+ }
+ else
+ {
+ lookAt.setSub(getPositionGroup(), camera_origin);
+ dist_threshold += getBinRadius();
+ }
+
+ vis = (lookAt.dot3(lookAt).getF32() < dist_threshold * dist_threshold);
+ }
+
+ return vis;
}
void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 max_dist)
{
- if(!needs_update && getVisible() >= last_update)
- {
- return; //no need to update
- }
-
- LLVector4a lookAt;
- lookAt.setSub(getPositionGroup(), camera_origin);
- F32 distance = lookAt.getLength3().getF32();
- distance -= sNearRadius;
-
- if(distance <= 0.f)
- {
- //nearby objects, set a large number
- const F32 LARGE_SCENE_CONTRIBUTION = 1000.f; //a large number to force to load the object.
- mSceneContrib = LARGE_SCENE_CONTRIBUTION;
- }
- else
- {
- F32 rad = getBinRadius();
- max_dist += rad;
-
- if(distance + sNearRadius < max_dist)
- {
- mSceneContrib = (rad * rad) / distance;
- }
- else
- {
- mSceneContrib = 0.f; //out of draw distance, not to load
- }
- }
-
- setVisible();
+ if(!needs_update && getVisible() >= last_update)
+ {
+ return; //no need to update
+ }
+
+ LLVector4a lookAt;
+ lookAt.setSub(getPositionGroup(), camera_origin);
+ F32 distance = lookAt.getLength3().getF32();
+ distance -= sNearRadius;
+
+ if(distance <= 0.f)
+ {
+ //nearby objects, set a large number
+ const F32 LARGE_SCENE_CONTRIBUTION = 1000.f; //a large number to force to load the object.
+ mSceneContrib = LARGE_SCENE_CONTRIBUTION;
+ }
+ else
+ {
+ F32 rad = getBinRadius();
+ max_dist += rad;
+
+ if(distance + sNearRadius < max_dist)
+ {
+ mSceneContrib = (rad * rad) / distance;
+ }
+ else
+ {
+ mSceneContrib = 0.f; //out of draw distance, not to load
+ }
+ }
+
+ setVisible();
}
void LLVOCacheEntry::saveBoundingSphere()
{
- mBSphereCenter = getPositionGroup();
- mBSphereRadius = getBinRadius();
+ mBSphereCenter = getPositionGroup();
+ mBSphereRadius = getBinRadius();
}
void LLVOCacheEntry::setBoundingInfo(const LLVector3& pos, const LLVector3& scale)
{
- LLVector4a center, newMin, newMax;
- center.load3(pos.mV);
- LLVector4a size;
- size.load3(scale.mV);
- newMin.setSub(center, size);
- newMax.setAdd(center, size);
-
- setPositionGroup(center);
- setSpatialExtents(newMin, newMax);
-
- if(getNumOfChildren() > 0) //has children
- {
- updateParentBoundingInfo();
- }
- else
- {
- setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f));
- }
+ LLVector4a center, newMin, newMax;
+ center.load3(pos.mV);
+ LLVector4a size;
+ size.load3(scale.mV);
+ newMin.setSub(center, size);
+ newMax.setAdd(center, size);
+
+ setPositionGroup(center);
+ setSpatialExtents(newMin, newMax);
+
+ if(getNumOfChildren() > 0) //has children
+ {
+ updateParentBoundingInfo();
+ }
+ else
+ {
+ setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f));
+ }
}
//make the parent bounding box to include all children
void LLVOCacheEntry::updateParentBoundingInfo()
{
- if(mChildrenList.empty())
- {
- return;
- }
-
- for(vocache_entry_set_t::iterator iter = mChildrenList.begin(); iter != mChildrenList.end(); ++iter)
- {
- updateParentBoundingInfo(*iter);
- }
- resetVisible();
+ if(mChildrenList.empty())
+ {
+ return;
+ }
+
+ for(vocache_entry_set_t::iterator iter = mChildrenList.begin(); iter != mChildrenList.end(); ++iter)
+ {
+ updateParentBoundingInfo(*iter);
+ }
+ resetVisible();
}
//make the parent bounding box to include this child
void LLVOCacheEntry::updateParentBoundingInfo(const LLVOCacheEntry* child)
{
- const LLVector4a* child_exts = child->getSpatialExtents();
- LLVector4a newMin, newMax;
- newMin = child_exts[0];
- newMax = child_exts[1];
-
- //move to regional space.
- {
- const LLVector4a& parent_pos = getPositionGroup();
- newMin.add(parent_pos);
- newMax.add(parent_pos);
- }
-
- //update parent's bbox(min, max)
- const LLVector4a* parent_exts = getSpatialExtents();
- update_min_max(newMin, newMax, parent_exts[0]);
- update_min_max(newMin, newMax, parent_exts[1]);
- for(S32 i = 0; i < 4; i++)
- {
- llclamp(newMin[i], 0.f, 256.f);
- llclamp(newMax[i], 0.f, 256.f);
- }
- setSpatialExtents(newMin, newMax);
-
- //update parent's bbox center
- LLVector4a center;
- center.setAdd(newMin, newMax);
- center.mul(0.5f);
- setPositionGroup(center);
-
- //update parent's bbox size vector
- LLVector4a size;
- size.setSub(newMax, newMin);
- size.mul(0.5f);
- setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f));
+ const LLVector4a* child_exts = child->getSpatialExtents();
+ LLVector4a newMin, newMax;
+ newMin = child_exts[0];
+ newMax = child_exts[1];
+
+ //move to regional space.
+ {
+ const LLVector4a& parent_pos = getPositionGroup();
+ newMin.add(parent_pos);
+ newMax.add(parent_pos);
+ }
+
+ //update parent's bbox(min, max)
+ const LLVector4a* parent_exts = getSpatialExtents();
+ update_min_max(newMin, newMax, parent_exts[0]);
+ update_min_max(newMin, newMax, parent_exts[1]);
+ for(S32 i = 0; i < 4; i++)
+ {
+ llclamp(newMin[i], 0.f, 256.f);
+ llclamp(newMax[i], 0.f, 256.f);
+ }
+ setSpatialExtents(newMin, newMax);
+
+ //update parent's bbox center
+ LLVector4a center;
+ center.setAdd(newMin, newMax);
+ center.mul(0.5f);
+ setPositionGroup(center);
+
+ //update parent's bbox size vector
+ LLVector4a size;
+ size.setSub(newMax, newMin);
+ size.mul(0.5f);
+ setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f));
}
//-------------------------------------------------------------------
//LLVOCachePartition
//-------------------------------------------------------------------
LLVOCacheGroup::~LLVOCacheGroup()
{
- if(mOcclusionState[LLViewerCamera::CAMERA_WORLD] & ACTIVE_OCCLUSION)
- {
- ((LLVOCachePartition*)mSpatialPartition)->removeOccluder(this);
- }
+ if(mOcclusionState[LLViewerCamera::CAMERA_WORLD] & ACTIVE_OCCLUSION)
+ {
+ ((LLVOCachePartition*)mSpatialPartition)->removeOccluder(this);
+ }
}
//virtual
void LLVOCacheGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child)
{
- if (child->getListenerCount() == 0)
- {
- new LLVOCacheGroup(child, mSpatialPartition);
- }
- else
- {
- OCT_ERRS << "LLVOCacheGroup redundancy detected." << LL_ENDL;
- }
-
- unbound();
-
- ((LLViewerOctreeGroup*)child->getListener(0))->unbound();
+ if (child->getListenerCount() == 0)
+ {
+ new LLVOCacheGroup(child, mSpatialPartition);
+ }
+ else
+ {
+ OCT_ERRS << "LLVOCacheGroup redundancy detected." << LL_ENDL;
+ }
+
+ unbound();
+
+ ((LLViewerOctreeGroup*)child->getListener(0))->unbound();
}
LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp)
{
- mLODPeriod = 16;
- mRegionp = regionp;
- mPartitionType = LLViewerRegion::PARTITION_VO_CACHE;
- mBackSlectionEnabled = -1;
- mIdleHash = 0;
-
- for(S32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
- {
- mCulledTime[i] = 0;
- }
- mCullHistory = -1;
-
- new LLVOCacheGroup(mOctree, this);
+ mLODPeriod = 16;
+ mRegionp = regionp;
+ mPartitionType = LLViewerRegion::PARTITION_VO_CACHE;
+ mBackSlectionEnabled = -1;
+ mIdleHash = 0;
+
+ for(S32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
+ {
+ mCulledTime[i] = 0;
+ }
+ mCullHistory = -1;
+
+ new LLVOCacheGroup(mOctree, this);
}
LLVOCachePartition::~LLVOCachePartition()
{
// SL-17276 make sure to do base class cleanup while this instance
- // can still be treated as an LLVOCachePartition
+ // can still be treated as an LLVOCachePartition
cleanup();
}
bool LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry)
{
- llassert(entry->hasVOCacheEntry());
+ llassert(entry->hasVOCacheEntry());
- if(!llfinite(entry->getBinRadius()) || !entry->getPositionGroup().isFinite3())
- {
- return false; //data corrupted
- }
+ if(!llfinite(entry->getBinRadius()) || !entry->getPositionGroup().isFinite3())
+ {
+ return false; //data corrupted
+ }
- mOctree->insert(entry);
+ mOctree->insert(entry);
- return true;
+ return true;
}
-
+
void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry)
{
- entry->getVOCacheEntry()->setGroup(NULL);
+ entry->getVOCacheEntry()->setGroup(NULL);
- llassert(!entry->getGroup());
+ llassert(!entry->getGroup());
}
-
+
class LLVOCacheOctreeCull : public LLViewerOctreeCull
{
public:
- LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp,
- const LLVector3& shift, bool use_object_cache_occlusion, F32 pixel_threshold, LLVOCachePartition* part)
- : LLViewerOctreeCull(camera),
- mRegionp(regionp),
- mPartition(part),
- mPixelThreshold(pixel_threshold)
- {
- mLocalShift = shift;
- mUseObjectCacheOcclusion = use_object_cache_occlusion;
- mNearRadius = LLVOCacheEntry::sNearRadius;
- }
-
- virtual bool earlyFail(LLViewerOctreeGroup* base_group)
- {
- if( mUseObjectCacheOcclusion &&
- base_group->getOctreeNode()->getParent()) //never occlusion cull the root node
- {
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
- if(group->needsUpdate())
- {
- //needs to issue new occlusion culling check, perform view culling check first.
- return false;
- }
-
- group->checkOcclusion();
-
- if (group->isOcclusionState(LLOcclusionCullingGroup::OCCLUDED))
- {
- return true;
- }
- }
-
- return false;
- }
-
- virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
- {
+ LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp,
+ const LLVector3& shift, bool use_object_cache_occlusion, F32 pixel_threshold, LLVOCachePartition* part)
+ : LLViewerOctreeCull(camera),
+ mRegionp(regionp),
+ mPartition(part),
+ mPixelThreshold(pixel_threshold)
+ {
+ mLocalShift = shift;
+ mUseObjectCacheOcclusion = use_object_cache_occlusion;
+ mNearRadius = LLVOCacheEntry::sNearRadius;
+ }
+
+ virtual bool earlyFail(LLViewerOctreeGroup* base_group)
+ {
+ if( mUseObjectCacheOcclusion &&
+ base_group->getOctreeNode()->getParent()) //never occlusion cull the root node
+ {
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
+ if(group->needsUpdate())
+ {
+ //needs to issue new occlusion culling check, perform view culling check first.
+ return false;
+ }
+
+ group->checkOcclusion();
+
+ if (group->isOcclusionState(LLOcclusionCullingGroup::OCCLUDED))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
+ {
#if 0
- S32 res = AABBInRegionFrustumGroupBounds(group);
-#else
- S32 res = AABBInRegionFrustumNoFarClipGroupBounds(group);
- if (res != 0)
- {
- res = llmin(res, AABBRegionSphereIntersectGroupExtents(group, mLocalShift));
- }
+ S32 res = AABBInRegionFrustumGroupBounds(group);
+#else
+ S32 res = AABBInRegionFrustumNoFarClipGroupBounds(group);
+ if (res != 0)
+ {
+ res = llmin(res, AABBRegionSphereIntersectGroupExtents(group, mLocalShift));
+ }
#endif
- return res;
- }
+ return res;
+ }
- virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
- {
+ virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
+ {
#if 0
- S32 res = AABBInRegionFrustumObjectBounds(group);
+ S32 res = AABBInRegionFrustumObjectBounds(group);
#else
- S32 res = AABBInRegionFrustumNoFarClipObjectBounds(group);
- if (res != 0)
- {
- res = llmin(res, AABBRegionSphereIntersectObjectExtents(group, mLocalShift));
- }
+ S32 res = AABBInRegionFrustumNoFarClipObjectBounds(group);
+ if (res != 0)
+ {
+ res = llmin(res, AABBRegionSphereIntersectObjectExtents(group, mLocalShift));
+ }
#endif
- if(res != 0)
- {
- //check if the objects projection large enough
- const LLVector4a* exts = group->getObjectExtents();
- res = checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mNearRadius);
- }
-
- return res;
- }
-
- virtual void processGroup(LLViewerOctreeGroup* base_group)
- {
- if( !mUseObjectCacheOcclusion ||
- !base_group->getOctreeNode()->getParent())
- {
- //no occlusion check
- if(mRegionp->addVisibleGroup(base_group))
- {
- base_group->setVisible();
- }
- return;
- }
-
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
- if(group->needsUpdate() || !group->isRecentlyVisible())//needs to issue new occlusion culling check.
- {
- mPartition->addOccluders(group);
- group->setVisible();
- return ; //wait for occlusion culling result
- }
-
- if(group->isOcclusionState(LLOcclusionCullingGroup::QUERY_PENDING) ||
- group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION))
- {
- //keep waiting
- group->setVisible();
- }
- else
- {
- if(mRegionp->addVisibleGroup(base_group))
- {
- base_group->setVisible();
- }
- }
- }
+ if(res != 0)
+ {
+ //check if the objects projection large enough
+ const LLVector4a* exts = group->getObjectExtents();
+ res = checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mNearRadius);
+ }
+
+ return res;
+ }
+
+ virtual void processGroup(LLViewerOctreeGroup* base_group)
+ {
+ if( !mUseObjectCacheOcclusion ||
+ !base_group->getOctreeNode()->getParent())
+ {
+ //no occlusion check
+ if(mRegionp->addVisibleGroup(base_group))
+ {
+ base_group->setVisible();
+ }
+ return;
+ }
+
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
+ if(group->needsUpdate() || !group->isRecentlyVisible())//needs to issue new occlusion culling check.
+ {
+ mPartition->addOccluders(group);
+ group->setVisible();
+ return ; //wait for occlusion culling result
+ }
+
+ if(group->isOcclusionState(LLOcclusionCullingGroup::QUERY_PENDING) ||
+ group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION))
+ {
+ //keep waiting
+ group->setVisible();
+ }
+ else
+ {
+ if(mRegionp->addVisibleGroup(base_group))
+ {
+ base_group->setVisible();
+ }
+ }
+ }
private:
- LLVOCachePartition* mPartition;
- LLViewerRegion* mRegionp;
- LLVector3 mLocalShift; //shift vector from agent space to local region space.
- F32 mPixelThreshold;
- F32 mNearRadius;
- bool mUseObjectCacheOcclusion;
+ LLVOCachePartition* mPartition;
+ LLViewerRegion* mRegionp;
+ LLVector3 mLocalShift; //shift vector from agent space to local region space.
+ F32 mPixelThreshold;
+ F32 mNearRadius;
+ bool mUseObjectCacheOcclusion;
};
//select objects behind camera
class LLVOCacheOctreeBackCull : public LLViewerOctreeCull
{
public:
- LLVOCacheOctreeBackCull(LLCamera* camera, const LLVector3& shift, LLViewerRegion* regionp, F32 pixel_threshold, bool use_occlusion)
- : LLViewerOctreeCull(camera), mRegionp(regionp), mPixelThreshold(pixel_threshold), mUseObjectCacheOcclusion(use_occlusion)
- {
- mLocalShift = shift;
- mSphereRadius = LLVOCacheEntry::sRearFarRadius;
- }
-
- virtual bool earlyFail(LLViewerOctreeGroup* base_group)
- {
- if( mUseObjectCacheOcclusion &&
- base_group->getOctreeNode()->getParent()) //never occlusion cull the root node
- {
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
-
- if (group->getOcclusionState() > 0) //occlusion state is not clear.
- {
- return true;
- }
- }
-
- return false;
- }
-
- virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
- {
- const LLVector4a* exts = group->getExtents();
- return backSphereCheck(exts[0], exts[1]);
- }
-
- virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
- {
- const LLVector4a* exts = group->getObjectExtents();
- if(backSphereCheck(exts[0], exts[1]))
- {
- //check if the objects projection large enough
- const LLVector4a* exts = group->getObjectExtents();
- return checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mSphereRadius);
- }
- return false;
- }
-
- virtual void processGroup(LLViewerOctreeGroup* base_group)
- {
- mRegionp->addVisibleGroup(base_group);
- return;
- }
+ LLVOCacheOctreeBackCull(LLCamera* camera, const LLVector3& shift, LLViewerRegion* regionp, F32 pixel_threshold, bool use_occlusion)
+ : LLViewerOctreeCull(camera), mRegionp(regionp), mPixelThreshold(pixel_threshold), mUseObjectCacheOcclusion(use_occlusion)
+ {
+ mLocalShift = shift;
+ mSphereRadius = LLVOCacheEntry::sRearFarRadius;
+ }
+
+ virtual bool earlyFail(LLViewerOctreeGroup* base_group)
+ {
+ if( mUseObjectCacheOcclusion &&
+ base_group->getOctreeNode()->getParent()) //never occlusion cull the root node
+ {
+ LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group;
+
+ if (group->getOcclusionState() > 0) //occlusion state is not clear.
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ virtual S32 frustumCheck(const LLViewerOctreeGroup* group)
+ {
+ const LLVector4a* exts = group->getExtents();
+ return backSphereCheck(exts[0], exts[1]);
+ }
+
+ virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group)
+ {
+ const LLVector4a* exts = group->getObjectExtents();
+ if(backSphereCheck(exts[0], exts[1]))
+ {
+ //check if the objects projection large enough
+ const LLVector4a* exts = group->getObjectExtents();
+ return checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mSphereRadius);
+ }
+ return false;
+ }
+
+ virtual void processGroup(LLViewerOctreeGroup* base_group)
+ {
+ mRegionp->addVisibleGroup(base_group);
+ return;
+ }
private:
- //a sphere around the camera origin, including objects behind camera.
- S32 backSphereCheck(const LLVector4a& min, const LLVector4a& max)
- {
- return AABBSphereIntersect(min, max, mCamera->getOrigin() - mLocalShift, mSphereRadius);
- }
+ //a sphere around the camera origin, including objects behind camera.
+ S32 backSphereCheck(const LLVector4a& min, const LLVector4a& max)
+ {
+ return AABBSphereIntersect(min, max, mCamera->getOrigin() - mLocalShift, mSphereRadius);
+ }
private:
- F32 mSphereRadius;
- LLViewerRegion* mRegionp;
- LLVector3 mLocalShift; //shift vector from agent space to local region space.
- F32 mPixelThreshold;
- bool mUseObjectCacheOcclusion;
+ F32 mSphereRadius;
+ LLViewerRegion* mRegionp;
+ LLVector3 mLocalShift; //shift vector from agent space to local region space.
+ F32 mPixelThreshold;
+ bool mUseObjectCacheOcclusion;
};
void LLVOCachePartition::selectBackObjects(LLCamera &camera, F32 pixel_threshold, bool use_occlusion)
{
- if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
- {
- return;
- }
-
- if(mBackSlectionEnabled < 0)
- {
- mBackSlectionEnabled = LLVOCacheEntry::sMinFrameRange - 1;
- mBackSlectionEnabled = llmax(mBackSlectionEnabled, (S32)1);
- }
-
- if(!mBackSlectionEnabled)
- {
- return;
- }
-
- //localize the camera
- LLVector3 region_agent = mRegionp->getOriginAgent();
-
- LLVOCacheOctreeBackCull culler(&camera, region_agent, mRegionp, pixel_threshold, use_occlusion);
- culler.traverse(mOctree);
-
- mBackSlectionEnabled--;
- if(!mRegionp->getNumOfVisibleGroups())
- {
- mBackSlectionEnabled = 0;
- }
-
- return;
+ if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
+ {
+ return;
+ }
+
+ if(mBackSlectionEnabled < 0)
+ {
+ mBackSlectionEnabled = LLVOCacheEntry::sMinFrameRange - 1;
+ mBackSlectionEnabled = llmax(mBackSlectionEnabled, (S32)1);
+ }
+
+ if(!mBackSlectionEnabled)
+ {
+ return;
+ }
+
+ //localize the camera
+ LLVector3 region_agent = mRegionp->getOriginAgent();
+
+ LLVOCacheOctreeBackCull culler(&camera, region_agent, mRegionp, pixel_threshold, use_occlusion);
+ culler.traverse(mOctree);
+
+ mBackSlectionEnabled--;
+ if(!mRegionp->getNumOfVisibleGroups())
+ {
+ mBackSlectionEnabled = 0;
+ }
+
+ return;
}
#ifndef LL_TEST
S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
{
- static LLCachedControl<bool> use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion");
-
- if(!LLViewerRegion::sVOCacheCullingEnabled)
- {
- return 0;
- }
- if(mRegionp->isPaused())
- {
- return 0;
- }
-
- ((LLViewerOctreeGroup*)mOctree->getListener(0))->rebound();
-
- if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
- {
- return 0; //no need for those cameras.
- }
-
- if(mCulledTime[LLViewerCamera::sCurCameraID] == LLViewerOctreeEntryData::getCurrentFrame())
- {
- return 0; //already culled
- }
- mCulledTime[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame();
-
- if(!mCullHistory && LLViewerRegion::isViewerCameraStatic())
- {
- U32 seed = llmax(mLODPeriod >> 1, (U32)4);
- if(LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)
- {
- if(!(LLViewerOctreeEntryData::getCurrentFrame() % seed))
- {
- mIdleHash = (mIdleHash + 1) % seed;
- }
- }
- if(LLViewerOctreeEntryData::getCurrentFrame() % seed != mIdleHash)
- {
- mFrontCull = FALSE;
-
- //process back objects selection
- selectBackObjects(camera, LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull),
- do_occlusion && use_object_cache_occlusion);
- return 0; //nothing changed, reduce frequency of culling
- }
- }
- else
- {
- mBackSlectionEnabled = -1; //reset it.
- }
-
- //localize the camera
- LLVector3 region_agent = mRegionp->getOriginAgent();
- camera.calcRegionFrustumPlanes(region_agent, gAgentCamera.mDrawDistance);
-
- mFrontCull = TRUE;
- LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion,
- LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), this);
- culler.traverse(mOctree);
-
- if(!sNeedsOcclusionCheck)
- {
- sNeedsOcclusionCheck = !mOccludedGroups.empty();
- }
- return 1;
+ static LLCachedControl<bool> use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion");
+
+ if(!LLViewerRegion::sVOCacheCullingEnabled)
+ {
+ return 0;
+ }
+ if(mRegionp->isPaused())
+ {
+ return 0;
+ }
+
+ ((LLViewerOctreeGroup*)mOctree->getListener(0))->rebound();
+
+ if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
+ {
+ return 0; //no need for those cameras.
+ }
+
+ if(mCulledTime[LLViewerCamera::sCurCameraID] == LLViewerOctreeEntryData::getCurrentFrame())
+ {
+ return 0; //already culled
+ }
+ mCulledTime[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame();
+
+ if(!mCullHistory && LLViewerRegion::isViewerCameraStatic())
+ {
+ U32 seed = llmax(mLODPeriod >> 1, (U32)4);
+ if(LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)
+ {
+ if(!(LLViewerOctreeEntryData::getCurrentFrame() % seed))
+ {
+ mIdleHash = (mIdleHash + 1) % seed;
+ }
+ }
+ if(LLViewerOctreeEntryData::getCurrentFrame() % seed != mIdleHash)
+ {
+ mFrontCull = FALSE;
+
+ //process back objects selection
+ selectBackObjects(camera, LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull),
+ do_occlusion && use_object_cache_occlusion);
+ return 0; //nothing changed, reduce frequency of culling
+ }
+ }
+ else
+ {
+ mBackSlectionEnabled = -1; //reset it.
+ }
+
+ //localize the camera
+ LLVector3 region_agent = mRegionp->getOriginAgent();
+ camera.calcRegionFrustumPlanes(region_agent, gAgentCamera.mDrawDistance);
+
+ mFrontCull = TRUE;
+ LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion,
+ LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), this);
+ culler.traverse(mOctree);
+
+ if(!sNeedsOcclusionCheck)
+ {
+ sNeedsOcclusionCheck = !mOccludedGroups.empty();
+ }
+ return 1;
}
#endif // LL_TEST
void LLVOCachePartition::setCullHistory(BOOL has_new_object)
{
- mCullHistory <<= 1;
- mCullHistory |= has_new_object;
+ mCullHistory <<= 1;
+ mCullHistory |= has_new_object;
}
void LLVOCachePartition::addOccluders(LLViewerOctreeGroup* gp)
{
- LLVOCacheGroup* group = (LLVOCacheGroup*)gp;
+ LLVOCacheGroup* group = (LLVOCacheGroup*)gp;
- if(!group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION))
- {
- group->setOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION);
- mOccludedGroups.insert(group);
- }
+ if(!group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION))
+ {
+ group->setOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION);
+ mOccludedGroups.insert(group);
+ }
}
void LLVOCachePartition::processOccluders(LLCamera* camera)
{
- if(mOccludedGroups.empty())
- {
- return;
- }
- if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
- {
- return; //no need for those cameras.
- }
-
- LLVector3 region_agent = mRegionp->getOriginAgent();
- LLVector4a shift(region_agent[0], region_agent[1], region_agent[2]);
- for(std::set<LLVOCacheGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter)
- {
- LLVOCacheGroup* group = *iter;
- if(group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION))
- {
- group->doOcclusion(camera, &shift);
- group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION);
- }
- }
-
- //safe to clear mOccludedGroups here because only the world camera accesses it.
- mOccludedGroups.clear();
- sNeedsOcclusionCheck = FALSE;
+ if(mOccludedGroups.empty())
+ {
+ return;
+ }
+ if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
+ {
+ return; //no need for those cameras.
+ }
+
+ LLVector3 region_agent = mRegionp->getOriginAgent();
+ LLVector4a shift(region_agent[0], region_agent[1], region_agent[2]);
+ for(std::set<LLVOCacheGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter)
+ {
+ LLVOCacheGroup* group = *iter;
+ if(group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION))
+ {
+ group->doOcclusion(camera, &shift);
+ group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION);
+ }
+ }
+
+ //safe to clear mOccludedGroups here because only the world camera accesses it.
+ mOccludedGroups.clear();
+ sNeedsOcclusionCheck = FALSE;
}
void LLVOCachePartition::resetOccluders()
{
- if(mOccludedGroups.empty())
- {
- return;
- }
-
- for(std::set<LLVOCacheGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter)
- {
- LLVOCacheGroup* group = *iter;
- group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION);
- }
- mOccludedGroups.clear();
- sNeedsOcclusionCheck = FALSE;
+ if(mOccludedGroups.empty())
+ {
+ return;
+ }
+
+ for(std::set<LLVOCacheGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter)
+ {
+ LLVOCacheGroup* group = *iter;
+ group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION);
+ }
+ mOccludedGroups.clear();
+ sNeedsOcclusionCheck = FALSE;
}
void LLVOCachePartition::removeOccluder(LLVOCacheGroup* group)
{
- if(mOccludedGroups.empty())
- {
- return;
- }
- mOccludedGroups.erase(group);
+ if(mOccludedGroups.empty())
+ {
+ return;
+ }
+ mOccludedGroups.erase(group);
}
//-------------------------------------------------------------------
//LLVOCache
@@ -1123,192 +1123,192 @@ const char* header_filename = "object.cache";
LLVOCache::LLVOCache(bool read_only) :
- mInitialized(false),
- mReadOnly(read_only),
- mNumEntries(0),
- mCacheSize(1),
+ mInitialized(false),
+ mReadOnly(read_only),
+ mNumEntries(0),
+ mCacheSize(1),
mEnabled(true)
{
#ifndef LL_TEST
- mEnabled = gSavedSettings.getBOOL("ObjectCacheEnabled");
+ mEnabled = gSavedSettings.getBOOL("ObjectCacheEnabled");
#endif
- mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
+ mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
}
LLVOCache::~LLVOCache()
{
- if(mEnabled)
- {
- writeCacheHeader();
- clearCacheInMemory();
- }
- delete mLocalAPRFilePoolp;
+ if(mEnabled)
+ {
+ writeCacheHeader();
+ clearCacheInMemory();
+ }
+ delete mLocalAPRFilePoolp;
}
void LLVOCache::setDirNames(ELLPath location)
{
- mHeaderFileName = gDirUtilp->getExpandedFilename(location, object_cache_dirname, header_filename);
- mObjectCacheDirName = gDirUtilp->getExpandedFilename(location, object_cache_dirname);
+ mHeaderFileName = gDirUtilp->getExpandedFilename(location, object_cache_dirname, header_filename);
+ mObjectCacheDirName = gDirUtilp->getExpandedFilename(location, object_cache_dirname);
}
void LLVOCache::initCache(ELLPath location, U32 size, U32 cache_version)
{
- if(!mEnabled)
- {
- LL_WARNS() << "Not initializing cache: Cache is currently disabled." << LL_ENDL;
- return ;
- }
-
- if(mInitialized)
- {
- LL_WARNS() << "Cache already initialized." << LL_ENDL;
- return ;
- }
- mInitialized = true;
-
- setDirNames(location);
- if (!mReadOnly)
- {
- LLFile::mkdir(mObjectCacheDirName);
- }
- mCacheSize = llclamp(size, MIN_ENTRIES_TO_PURGE, MAX_NUM_OBJECT_ENTRIES);
- mMetaInfo.mVersion = cache_version;
+ if(!mEnabled)
+ {
+ LL_WARNS() << "Not initializing cache: Cache is currently disabled." << LL_ENDL;
+ return ;
+ }
+
+ if(mInitialized)
+ {
+ LL_WARNS() << "Cache already initialized." << LL_ENDL;
+ return ;
+ }
+ mInitialized = true;
+
+ setDirNames(location);
+ if (!mReadOnly)
+ {
+ LLFile::mkdir(mObjectCacheDirName);
+ }
+ mCacheSize = llclamp(size, MIN_ENTRIES_TO_PURGE, MAX_NUM_OBJECT_ENTRIES);
+ mMetaInfo.mVersion = cache_version;
#if defined(ADDRESS_SIZE)
- U32 expected_address = ADDRESS_SIZE;
+ U32 expected_address = ADDRESS_SIZE;
#else
- U32 expected_address = 32;
+ U32 expected_address = 32;
#endif
- mMetaInfo.mAddressSize = expected_address;
-
- readCacheHeader();
-
- LL_INFOS() << "Viewer Object Cache Versions - expected: " << cache_version << " found: " << mMetaInfo.mVersion << LL_ENDL;
-
- if( mMetaInfo.mVersion != cache_version
- || mMetaInfo.mAddressSize != expected_address)
- {
- mMetaInfo.mVersion = cache_version ;
- mMetaInfo.mAddressSize = expected_address;
- if(mReadOnly) //disable cache
- {
- clearCacheInMemory();
- }
- else //delete the current cache if the format does not match.
- {
- LL_INFOS() << "Viewer Object Cache Versions unmatched. clearing cache." << LL_ENDL;
- removeCache();
- }
- }
+ mMetaInfo.mAddressSize = expected_address;
+
+ readCacheHeader();
+
+ LL_INFOS() << "Viewer Object Cache Versions - expected: " << cache_version << " found: " << mMetaInfo.mVersion << LL_ENDL;
+
+ if( mMetaInfo.mVersion != cache_version
+ || mMetaInfo.mAddressSize != expected_address)
+ {
+ mMetaInfo.mVersion = cache_version ;
+ mMetaInfo.mAddressSize = expected_address;
+ if(mReadOnly) //disable cache
+ {
+ clearCacheInMemory();
+ }
+ else //delete the current cache if the format does not match.
+ {
+ LL_INFOS() << "Viewer Object Cache Versions unmatched. clearing cache." << LL_ENDL;
+ removeCache();
+ }
+ }
}
-
-void LLVOCache::removeCache(ELLPath location, bool started)
+
+void LLVOCache::removeCache(ELLPath location, bool started)
{
- if(started)
- {
- removeCache();
- return;
- }
-
- if(mReadOnly)
- {
- LL_WARNS() << "Not removing cache at " << location << ": Cache is currently in read-only mode." << LL_ENDL;
- return ;
- }
-
- LL_INFOS() << "about to remove the object cache due to settings." << LL_ENDL ;
-
- std::string mask = "*";
- std::string cache_dir = gDirUtilp->getExpandedFilename(location, object_cache_dirname);
- LL_INFOS() << "Removing cache at " << cache_dir << LL_ENDL;
- gDirUtilp->deleteFilesInDir(cache_dir, mask); //delete all files
- LLFile::rmdir(cache_dir);
-
- clearCacheInMemory();
- mInitialized = false;
+ if(started)
+ {
+ removeCache();
+ return;
+ }
+
+ if(mReadOnly)
+ {
+ LL_WARNS() << "Not removing cache at " << location << ": Cache is currently in read-only mode." << LL_ENDL;
+ return ;
+ }
+
+ LL_INFOS() << "about to remove the object cache due to settings." << LL_ENDL ;
+
+ std::string mask = "*";
+ std::string cache_dir = gDirUtilp->getExpandedFilename(location, object_cache_dirname);
+ LL_INFOS() << "Removing cache at " << cache_dir << LL_ENDL;
+ gDirUtilp->deleteFilesInDir(cache_dir, mask); //delete all files
+ LLFile::rmdir(cache_dir);
+
+ clearCacheInMemory();
+ mInitialized = false;
}
-void LLVOCache::removeCache()
+void LLVOCache::removeCache()
{
- if(!mInitialized)
- {
- //OK to remove cache even it is not initialized.
- LL_WARNS() << "Object cache is not initialized yet." << LL_ENDL;
- }
-
- if(mReadOnly)
- {
- LL_WARNS() << "Not clearing object cache: Cache is currently in read-only mode." << LL_ENDL;
- return ;
- }
-
- std::string mask = "*";
- LL_INFOS() << "Removing object cache at " << mObjectCacheDirName << LL_ENDL;
- gDirUtilp->deleteFilesInDir(mObjectCacheDirName, mask);
-
- clearCacheInMemory() ;
- writeCacheHeader();
+ if(!mInitialized)
+ {
+ //OK to remove cache even it is not initialized.
+ LL_WARNS() << "Object cache is not initialized yet." << LL_ENDL;
+ }
+
+ if(mReadOnly)
+ {
+ LL_WARNS() << "Not clearing object cache: Cache is currently in read-only mode." << LL_ENDL;
+ return ;
+ }
+
+ std::string mask = "*";
+ LL_INFOS() << "Removing object cache at " << mObjectCacheDirName << LL_ENDL;
+ gDirUtilp->deleteFilesInDir(mObjectCacheDirName, mask);
+
+ clearCacheInMemory() ;
+ writeCacheHeader();
}
-void LLVOCache::removeEntry(HeaderEntryInfo* entry)
+void LLVOCache::removeEntry(HeaderEntryInfo* entry)
{
- llassert_always(mInitialized);
- if(mReadOnly)
- {
- return;
- }
- if(!entry)
- {
- return;
- }
-
- header_entry_queue_t::iterator iter = mHeaderEntryQueue.find(entry);
- if(iter != mHeaderEntryQueue.end())
- {
- mHandleEntryMap.erase(entry->mHandle);
- mHeaderEntryQueue.erase(iter);
- removeFromCache(entry);
- delete entry;
-
- mNumEntries = mHandleEntryMap.size() ;
- }
+ llassert_always(mInitialized);
+ if(mReadOnly)
+ {
+ return;
+ }
+ if(!entry)
+ {
+ return;
+ }
+
+ header_entry_queue_t::iterator iter = mHeaderEntryQueue.find(entry);
+ if(iter != mHeaderEntryQueue.end())
+ {
+ mHandleEntryMap.erase(entry->mHandle);
+ mHeaderEntryQueue.erase(iter);
+ removeFromCache(entry);
+ delete entry;
+
+ mNumEntries = mHandleEntryMap.size() ;
+ }
}
-void LLVOCache::removeEntry(U64 handle)
+void LLVOCache::removeEntry(U64 handle)
{
- handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
- if(iter == mHandleEntryMap.end()) //no cache
- {
- return ;
- }
- HeaderEntryInfo* entry = iter->second ;
- removeEntry(entry) ;
+ handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
+ if(iter == mHandleEntryMap.end()) //no cache
+ {
+ return ;
+ }
+ HeaderEntryInfo* entry = iter->second ;
+ removeEntry(entry) ;
}
void LLVOCache::clearCacheInMemory()
{
- if(!mHeaderEntryQueue.empty())
- {
- for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin(); iter != mHeaderEntryQueue.end(); ++iter)
- {
- delete *iter ;
- }
- mHeaderEntryQueue.clear();
- mHandleEntryMap.clear();
- mNumEntries = 0 ;
- }
+ if(!mHeaderEntryQueue.empty())
+ {
+ for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin(); iter != mHeaderEntryQueue.end(); ++iter)
+ {
+ delete *iter ;
+ }
+ mHeaderEntryQueue.clear();
+ mHandleEntryMap.clear();
+ mNumEntries = 0 ;
+ }
}
-void LLVOCache::getObjectCacheFilename(U64 handle, std::string& filename)
+void LLVOCache::getObjectCacheFilename(U64 handle, std::string& filename)
{
- U32 region_x, region_y;
+ U32 region_x, region_y;
- grid_from_region_handle(handle, &region_x, &region_y);
- filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, object_cache_dirname,
- llformat(OBJECT_CACHE_FILENAME, region_x, region_y));
+ grid_from_region_handle(handle, &region_x, &region_y);
+ filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, object_cache_dirname,
+ llformat(OBJECT_CACHE_FILENAME, region_x, region_y));
- return ;
+ return ;
}
std::string LLVOCache::getObjectCacheExtrasFilename(U64 handle)
@@ -1322,227 +1322,227 @@ std::string LLVOCache::getObjectCacheExtrasFilename(U64 handle)
void LLVOCache::removeFromCache(HeaderEntryInfo* entry)
{
- if(mReadOnly)
- {
- LL_WARNS() << "Not removing cache for handle " << entry->mHandle << ": Cache is currently in read-only mode." << LL_ENDL;
- return ;
- }
-
- std::string filename;
- getObjectCacheFilename(entry->mHandle, filename);
- LLAPRFile::remove(filename, mLocalAPRFilePoolp);
- entry->mTime = INVALID_TIME ;
- updateEntry(entry) ; //update the head file.
+ if(mReadOnly)
+ {
+ LL_WARNS() << "Not removing cache for handle " << entry->mHandle << ": Cache is currently in read-only mode." << LL_ENDL;
+ return ;
+ }
+
+ std::string filename;
+ getObjectCacheFilename(entry->mHandle, filename);
+ LLAPRFile::remove(filename, mLocalAPRFilePoolp);
+ entry->mTime = INVALID_TIME ;
+ updateEntry(entry) ; //update the head file.
}
void LLVOCache::readCacheHeader()
{
- if(!mEnabled)
- {
- LL_WARNS() << "Not reading cache header: Cache is currently disabled." << LL_ENDL;
- return;
- }
-
- //clear stale info.
- clearCacheInMemory();
-
- bool success = true ;
- if (LLAPRFile::isExist(mHeaderFileName, mLocalAPRFilePoolp))
- {
- LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
-
- //read the meta element
- success = check_read(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
-
- if(success)
- {
- HeaderEntryInfo* entry = NULL ;
- mNumEntries = 0 ;
- U32 num_read = 0 ;
- while(num_read++ < MAX_NUM_OBJECT_ENTRIES)
- {
- if(!entry)
- {
- entry = new HeaderEntryInfo() ;
- }
- success = check_read(&apr_file, entry, sizeof(HeaderEntryInfo));
-
- if(!success) //failed
- {
- LL_WARNS() << "Error reading cache header entry. (entry_index=" << mNumEntries << ")" << LL_ENDL;
- delete entry ;
- entry = NULL ;
- break ;
- }
- else if(entry->mTime == INVALID_TIME)
- {
- continue ; //an empty entry
- }
-
- entry->mIndex = mNumEntries++ ;
- mHeaderEntryQueue.insert(entry) ;
- mHandleEntryMap[entry->mHandle] = entry ;
- entry = NULL ;
- }
- if(entry)
- {
- delete entry ;
- }
- }
-
- //---------
- //debug code
- //----------
- //std::string name ;
- //for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ; success && iter != mHeaderEntryQueue.end(); ++iter)
- //{
- // getObjectCacheFilename((*iter)->mHandle, name) ;
- // LL_INFOS() << name << LL_ENDL ;
- //}
- //-----------
- }
- else
- {
- writeCacheHeader() ;
- }
-
- if(!success)
- {
- removeCache() ; //failed to read header, clear the cache
- }
- else if(mNumEntries >= mCacheSize)
- {
- purgeEntries(mCacheSize) ;
- }
-
- return ;
+ if(!mEnabled)
+ {
+ LL_WARNS() << "Not reading cache header: Cache is currently disabled." << LL_ENDL;
+ return;
+ }
+
+ //clear stale info.
+ clearCacheInMemory();
+
+ bool success = true ;
+ if (LLAPRFile::isExist(mHeaderFileName, mLocalAPRFilePoolp))
+ {
+ LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
+
+ //read the meta element
+ success = check_read(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
+
+ if(success)
+ {
+ HeaderEntryInfo* entry = NULL ;
+ mNumEntries = 0 ;
+ U32 num_read = 0 ;
+ while(num_read++ < MAX_NUM_OBJECT_ENTRIES)
+ {
+ if(!entry)
+ {
+ entry = new HeaderEntryInfo() ;
+ }
+ success = check_read(&apr_file, entry, sizeof(HeaderEntryInfo));
+
+ if(!success) //failed
+ {
+ LL_WARNS() << "Error reading cache header entry. (entry_index=" << mNumEntries << ")" << LL_ENDL;
+ delete entry ;
+ entry = NULL ;
+ break ;
+ }
+ else if(entry->mTime == INVALID_TIME)
+ {
+ continue ; //an empty entry
+ }
+
+ entry->mIndex = mNumEntries++ ;
+ mHeaderEntryQueue.insert(entry) ;
+ mHandleEntryMap[entry->mHandle] = entry ;
+ entry = NULL ;
+ }
+ if(entry)
+ {
+ delete entry ;
+ }
+ }
+
+ //---------
+ //debug code
+ //----------
+ //std::string name ;
+ //for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ; success && iter != mHeaderEntryQueue.end(); ++iter)
+ //{
+ // getObjectCacheFilename((*iter)->mHandle, name) ;
+ // LL_INFOS() << name << LL_ENDL ;
+ //}
+ //-----------
+ }
+ else
+ {
+ writeCacheHeader() ;
+ }
+
+ if(!success)
+ {
+ removeCache() ; //failed to read header, clear the cache
+ }
+ else if(mNumEntries >= mCacheSize)
+ {
+ purgeEntries(mCacheSize) ;
+ }
+
+ return ;
}
void LLVOCache::writeCacheHeader()
{
- if (!mEnabled)
- {
- LL_WARNS() << "Not writing cache header: Cache is currently disabled." << LL_ENDL;
- return;
- }
-
- if(mReadOnly)
- {
- LL_WARNS() << "Not writing cache header: Cache is currently in read-only mode." << LL_ENDL;
- return;
- }
-
- bool success = true ;
- {
- LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
-
- //write the meta element
- success = check_write(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
-
-
- mNumEntries = 0 ;
- for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ; success && iter != mHeaderEntryQueue.end(); ++iter)
- {
- (*iter)->mIndex = mNumEntries++ ;
- success = check_write(&apr_file, (void*)*iter, sizeof(HeaderEntryInfo));
- }
-
- mNumEntries = mHeaderEntryQueue.size() ;
- if(success && mNumEntries < MAX_NUM_OBJECT_ENTRIES)
- {
- HeaderEntryInfo* entry = new HeaderEntryInfo() ;
- entry->mTime = INVALID_TIME ;
- for(S32 i = mNumEntries ; success && i < MAX_NUM_OBJECT_ENTRIES ; i++)
- {
- //fill the cache with the default entry.
- success = check_write(&apr_file, entry, sizeof(HeaderEntryInfo)) ;
-
- }
- delete entry ;
- }
- }
-
- if(!success)
- {
- clearCacheInMemory() ;
- mReadOnly = TRUE ; //disable the cache.
- }
- return ;
+ if (!mEnabled)
+ {
+ LL_WARNS() << "Not writing cache header: Cache is currently disabled." << LL_ENDL;
+ return;
+ }
+
+ if(mReadOnly)
+ {
+ LL_WARNS() << "Not writing cache header: Cache is currently in read-only mode." << LL_ENDL;
+ return;
+ }
+
+ bool success = true ;
+ {
+ LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+
+ //write the meta element
+ success = check_write(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
+
+
+ mNumEntries = 0 ;
+ for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ; success && iter != mHeaderEntryQueue.end(); ++iter)
+ {
+ (*iter)->mIndex = mNumEntries++ ;
+ success = check_write(&apr_file, (void*)*iter, sizeof(HeaderEntryInfo));
+ }
+
+ mNumEntries = mHeaderEntryQueue.size() ;
+ if(success && mNumEntries < MAX_NUM_OBJECT_ENTRIES)
+ {
+ HeaderEntryInfo* entry = new HeaderEntryInfo() ;
+ entry->mTime = INVALID_TIME ;
+ for(S32 i = mNumEntries ; success && i < MAX_NUM_OBJECT_ENTRIES ; i++)
+ {
+ //fill the cache with the default entry.
+ success = check_write(&apr_file, entry, sizeof(HeaderEntryInfo)) ;
+
+ }
+ delete entry ;
+ }
+ }
+
+ if(!success)
+ {
+ clearCacheInMemory() ;
+ mReadOnly = TRUE ; //disable the cache.
+ }
+ return ;
}
BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry)
{
- LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
- apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo)) ;
+ LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo)) ;
- return check_write(&apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
+ return check_write(&apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
}
-void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map)
+void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map)
{
- if(!mEnabled)
- {
- LL_WARNS() << "Not reading cache for handle " << handle << "): Cache is currently disabled." << LL_ENDL;
- return ;
- }
- llassert_always(mInitialized);
-
- handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
- if(iter == mHandleEntryMap.end()) //no cache
- {
- LL_WARNS() << "No handle map entry for " << handle << LL_ENDL;
- return ;
- }
-
- bool success = true ;
- {
- std::string filename;
- LLUUID cache_id;
- getObjectCacheFilename(handle, filename);
- LLAPRFile apr_file(filename, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
-
- success = check_read(&apr_file, cache_id.mData, UUID_BYTES);
-
- if(success)
- {
- if(cache_id != id)
- {
- LL_INFOS() << "Cache ID doesn't match for this region, discarding"<< LL_ENDL;
- success = false ;
- }
-
- if(success)
- {
- S32 num_entries; // if removal was enabled during write num_entries might be wrong
- success = check_read(&apr_file, &num_entries, sizeof(S32)) ;
-
- if(success)
- {
- for (S32 i = 0; i < num_entries && apr_file.eof() != APR_EOF; i++)
- {
- LLPointer<LLVOCacheEntry> entry = new LLVOCacheEntry(&apr_file);
- if (!entry->getLocalID())
- {
- LL_WARNS() << "Aborting cache file load for " << filename << ", cache file corruption!" << LL_ENDL;
- success = false ;
- break ;
- }
- cache_entry_map[entry->getLocalID()] = entry;
- }
- }
- }
- }
- }
-
- if(!success)
- {
- if(cache_entry_map.empty())
- {
- removeEntry(iter->second) ;
- }
- }
-
- return ;
+ if(!mEnabled)
+ {
+ LL_WARNS() << "Not reading cache for handle " << handle << "): Cache is currently disabled." << LL_ENDL;
+ return ;
+ }
+ llassert_always(mInitialized);
+
+ handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
+ if(iter == mHandleEntryMap.end()) //no cache
+ {
+ LL_WARNS() << "No handle map entry for " << handle << LL_ENDL;
+ return ;
+ }
+
+ bool success = true ;
+ {
+ std::string filename;
+ LLUUID cache_id;
+ getObjectCacheFilename(handle, filename);
+ LLAPRFile apr_file(filename, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
+
+ success = check_read(&apr_file, cache_id.mData, UUID_BYTES);
+
+ if(success)
+ {
+ if(cache_id != id)
+ {
+ LL_INFOS() << "Cache ID doesn't match for this region, discarding"<< LL_ENDL;
+ success = false ;
+ }
+
+ if(success)
+ {
+ S32 num_entries; // if removal was enabled during write num_entries might be wrong
+ success = check_read(&apr_file, &num_entries, sizeof(S32)) ;
+
+ if(success)
+ {
+ for (S32 i = 0; i < num_entries && apr_file.eof() != APR_EOF; i++)
+ {
+ LLPointer<LLVOCacheEntry> entry = new LLVOCacheEntry(&apr_file);
+ if (!entry->getLocalID())
+ {
+ LL_WARNS() << "Aborting cache file load for " << filename << ", cache file corruption!" << LL_ENDL;
+ success = false ;
+ break ;
+ }
+ cache_entry_map[entry->getLocalID()] = entry;
+ }
+ }
+ }
+ }
+ }
+
+ if(!success)
+ {
+ if(cache_entry_map.empty())
+ {
+ removeEntry(iter->second) ;
+ }
+ }
+
+ return ;
}
void LLVOCache::readGenericExtrasFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map)
@@ -1623,88 +1623,88 @@ void LLVOCache::readGenericExtrasFromCache(U64 handle, const LLUUID& id, LLVOCac
void LLVOCache::purgeEntries(U32 size)
{
- while(mHeaderEntryQueue.size() > size)
- {
- header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ;
- HeaderEntryInfo* entry = *iter ;
- mHandleEntryMap.erase(entry->mHandle);
- mHeaderEntryQueue.erase(iter) ;
- removeFromCache(entry) ;
- delete entry;
+ while(mHeaderEntryQueue.size() > size)
+ {
+ header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ;
+ HeaderEntryInfo* entry = *iter ;
+ mHandleEntryMap.erase(entry->mHandle);
+ mHeaderEntryQueue.erase(iter) ;
+ removeFromCache(entry) ;
+ delete entry;
// TODO also delete extras
- }
- mNumEntries = mHandleEntryMap.size() ;
+ }
+ mNumEntries = mHandleEntryMap.size() ;
}
-void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled)
+void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled)
{
- if(!mEnabled)
- {
- LL_WARNS() << "Not writing cache for handle " << handle << "): Cache is currently disabled." << LL_ENDL;
- return ;
- }
- llassert_always(mInitialized);
-
- if(mReadOnly)
- {
- LL_WARNS() << "Not writing cache for handle " << handle << "): Cache is currently in read-only mode." << LL_ENDL;
- return ;
- }
-
- HeaderEntryInfo* entry;
- handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
- if(iter == mHandleEntryMap.end()) //new entry
- {
- if(mNumEntries >= mCacheSize - 1)
- {
- purgeEntries(mCacheSize - 1) ;
- }
-
- entry = new HeaderEntryInfo();
- entry->mHandle = handle ;
- entry->mTime = time(NULL) ;
- entry->mIndex = mNumEntries++;
- mHeaderEntryQueue.insert(entry) ;
- mHandleEntryMap[handle] = entry ;
- }
- else
- {
- // Update access time.
- entry = iter->second ;
-
- //resort
- mHeaderEntryQueue.erase(entry) ;
-
- entry->mTime = time(NULL) ;
- mHeaderEntryQueue.insert(entry) ;
- }
-
- //update cache header
- if(!updateEntry(entry))
- {
- LL_WARNS() << "Failed to update cache header index " << entry->mIndex << ". handle = " << handle << LL_ENDL;
- return ; //update failed.
- }
-
- if(!dirty_cache)
- {
- LL_WARNS() << "Skipping write to cache for handle " << handle << ": cache not dirty" << LL_ENDL;
- return ; //nothing changed, no need to update.
- }
-
- //write to cache file
- bool success = true ;
- {
- std::string filename;
- getObjectCacheFilename(handle, filename);
- LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY|APR_TRUNCATE, mLocalAPRFilePoolp);
-
- success = check_write(&apr_file, (void*)id.mData, UUID_BYTES);
-
- if(success)
- {
- S32 num_entries = cache_entry_map.size(); // if removal is enabled num_entries might be wrong
- success = check_write(&apr_file, &num_entries, sizeof(S32));
+ if(!mEnabled)
+ {
+ LL_WARNS() << "Not writing cache for handle " << handle << "): Cache is currently disabled." << LL_ENDL;
+ return ;
+ }
+ llassert_always(mInitialized);
+
+ if(mReadOnly)
+ {
+ LL_WARNS() << "Not writing cache for handle " << handle << "): Cache is currently in read-only mode." << LL_ENDL;
+ return ;
+ }
+
+ HeaderEntryInfo* entry;
+ handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
+ if(iter == mHandleEntryMap.end()) //new entry
+ {
+ if(mNumEntries >= mCacheSize - 1)
+ {
+ purgeEntries(mCacheSize - 1) ;
+ }
+
+ entry = new HeaderEntryInfo();
+ entry->mHandle = handle ;
+ entry->mTime = time(NULL) ;
+ entry->mIndex = mNumEntries++;
+ mHeaderEntryQueue.insert(entry) ;
+ mHandleEntryMap[handle] = entry ;
+ }
+ else
+ {
+ // Update access time.
+ entry = iter->second ;
+
+ //resort
+ mHeaderEntryQueue.erase(entry) ;
+
+ entry->mTime = time(NULL) ;
+ mHeaderEntryQueue.insert(entry) ;
+ }
+
+ //update cache header
+ if(!updateEntry(entry))
+ {
+ LL_WARNS() << "Failed to update cache header index " << entry->mIndex << ". handle = " << handle << LL_ENDL;
+ return ; //update failed.
+ }
+
+ if(!dirty_cache)
+ {
+ LL_WARNS() << "Skipping write to cache for handle " << handle << ": cache not dirty" << LL_ENDL;
+ return ; //nothing changed, no need to update.
+ }
+
+ //write to cache file
+ bool success = true ;
+ {
+ std::string filename;
+ getObjectCacheFilename(handle, filename);
+ LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY|APR_TRUNCATE, mLocalAPRFilePoolp);
+
+ success = check_write(&apr_file, (void*)id.mData, UUID_BYTES);
+
+ if(success)
+ {
+ S32 num_entries = cache_entry_map.size(); // if removal is enabled num_entries might be wrong
+ success = check_write(&apr_file, &num_entries, sizeof(S32));
if (success)
{
const S32 buffer_size = 32768; //should be large enough for couple MAX_ENTRY_BODY_SIZE
@@ -1748,15 +1748,15 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:
size_in_buffer = 0;
}
}
- }
- }
+ }
+ }
- if(!success)
- {
- removeEntry(entry) ;
- }
+ if(!success)
+ {
+ removeEntry(entry) ;
+ }
- return ;
+ return ;
}
void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map, BOOL dirty_cache, bool removal_enabled)
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index 8525edd121..22c97573be 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvocache.h
* @brief Cache of objects on the viewer.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,48 +53,48 @@ public:
U64 mRegionHandle = 0;
};
-class LLVOCacheEntry
-: public LLViewerOctreeEntryData
+class LLVOCacheEntry
+: public LLViewerOctreeEntryData
{
LL_ALIGN_NEW
public:
- enum
- {
- //low 16-bit state
- INACTIVE = 0x00000000, //not visible
- IN_QUEUE = 0x00000001, //in visible queue, object to be created
- WAITING = 0x00000002, //object creation request sent
- ACTIVE = 0x00000004, //object created, and in rendering pipeline.
-
- //high 16-bit state
- IN_VO_TREE = 0x00010000, //the entry is in the object cache tree.
-
- LOW_BITS = 0x0000ffff,
- HIGH_BITS = 0xffff0000
- };
-
- struct CompareVOCacheEntry
- {
- bool operator()(const LLVOCacheEntry* const& lhs, const LLVOCacheEntry* const& rhs) const
- {
- F32 lpa = lhs->getSceneContribution();
- F32 rpa = rhs->getSceneContribution();
-
- //larger pixel area first
- if(lpa > rpa)
- {
- return true;
- }
- else if(lpa < rpa)
- {
- return false;
- }
- else
- {
- return lhs < rhs;
- }
- }
- };
+ enum
+ {
+ //low 16-bit state
+ INACTIVE = 0x00000000, //not visible
+ IN_QUEUE = 0x00000001, //in visible queue, object to be created
+ WAITING = 0x00000002, //object creation request sent
+ ACTIVE = 0x00000004, //object created, and in rendering pipeline.
+
+ //high 16-bit state
+ IN_VO_TREE = 0x00010000, //the entry is in the object cache tree.
+
+ LOW_BITS = 0x0000ffff,
+ HIGH_BITS = 0xffff0000
+ };
+
+ struct CompareVOCacheEntry
+ {
+ bool operator()(const LLVOCacheEntry* const& lhs, const LLVOCacheEntry* const& rhs) const
+ {
+ F32 lpa = lhs->getSceneContribution();
+ F32 rpa = rhs->getSceneContribution();
+
+ //larger pixel area first
+ if(lpa > rpa)
+ {
+ return true;
+ }
+ else if(lpa < rpa)
+ {
+ return false;
+ }
+ else
+ {
+ return lhs < rhs;
+ }
+ }
+ };
struct ExtrasEntry
{
@@ -103,145 +103,145 @@ public:
};
protected:
- ~LLVOCacheEntry();
+ ~LLVOCacheEntry();
public:
- LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp);
- LLVOCacheEntry(LLAPRFile* apr_file);
- LLVOCacheEntry();
-
- void updateEntry(U32 crc, LLDataPackerBinaryBuffer &dp);
-
- void clearState(U32 state) {mState &= ~state;}
- bool hasState(U32 state) {return mState & state;}
- void setState(U32 state);
- bool isState(U32 state) {return (mState & LOW_BITS) == state;}
- U32 getState() const {return mState & LOW_BITS;}
-
- bool isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold);
-
- U32 getLocalID() const { return mLocalID; }
- U32 getCRC() const { return mCRC; }
- S32 getHitCount() const { return mHitCount; }
- S32 getCRCChangeCount() const { return mCRCChangeCount; }
-
- void calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 dist_threshold);
- void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;}
- F32 getSceneContribution() const { return mSceneContrib;}
-
- void dump() const;
- S32 writeToBuffer(U8 *data_buffer) const;
- LLDataPackerBinaryBuffer *getDP();
- void recordHit();
- void recordDupe() { mDupeCount++; }
-
- /*virtual*/ void setOctreeEntry(LLViewerOctreeEntry* entry);
-
- void setParentID(U32 id);
- U32 getParentID() const {return mParentID;}
- bool isChild() const {return mParentID > 0;}
-
- void addChild(LLVOCacheEntry* entry);
- void removeChild(LLVOCacheEntry* entry);
- void removeAllChildren();
- LLVOCacheEntry* getChild(); //remove the first child, and return it.
- S32 getNumOfChildren() const {return mChildrenList.size();}
-
- void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); //called from processing object update message
- void updateParentBoundingInfo();
- void saveBoundingSphere();
-
- void setValid(BOOL valid = TRUE) {mValid = valid;}
- BOOL isValid() const {return mValid;}
-
- void setUpdateFlags(U32 flags) {mUpdateFlags = flags;}
- U32 getUpdateFlags() const {return mUpdateFlags;}
-
- static void updateDebugSettings();
- static F32 getSquaredPixelThreshold(bool is_front);
+ LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp);
+ LLVOCacheEntry(LLAPRFile* apr_file);
+ LLVOCacheEntry();
+
+ void updateEntry(U32 crc, LLDataPackerBinaryBuffer &dp);
+
+ void clearState(U32 state) {mState &= ~state;}
+ bool hasState(U32 state) {return mState & state;}
+ void setState(U32 state);
+ bool isState(U32 state) {return (mState & LOW_BITS) == state;}
+ U32 getState() const {return mState & LOW_BITS;}
+
+ bool isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold);
+
+ U32 getLocalID() const { return mLocalID; }
+ U32 getCRC() const { return mCRC; }
+ S32 getHitCount() const { return mHitCount; }
+ S32 getCRCChangeCount() const { return mCRCChangeCount; }
+
+ void calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 dist_threshold);
+ void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;}
+ F32 getSceneContribution() const { return mSceneContrib;}
+
+ void dump() const;
+ S32 writeToBuffer(U8 *data_buffer) const;
+ LLDataPackerBinaryBuffer *getDP();
+ void recordHit();
+ void recordDupe() { mDupeCount++; }
+
+ /*virtual*/ void setOctreeEntry(LLViewerOctreeEntry* entry);
+
+ void setParentID(U32 id);
+ U32 getParentID() const {return mParentID;}
+ bool isChild() const {return mParentID > 0;}
+
+ void addChild(LLVOCacheEntry* entry);
+ void removeChild(LLVOCacheEntry* entry);
+ void removeAllChildren();
+ LLVOCacheEntry* getChild(); //remove the first child, and return it.
+ S32 getNumOfChildren() const {return mChildrenList.size();}
+
+ void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); //called from processing object update message
+ void updateParentBoundingInfo();
+ void saveBoundingSphere();
+
+ void setValid(BOOL valid = TRUE) {mValid = valid;}
+ BOOL isValid() const {return mValid;}
+
+ void setUpdateFlags(U32 flags) {mUpdateFlags = flags;}
+ U32 getUpdateFlags() const {return mUpdateFlags;}
+
+ static void updateDebugSettings();
+ static F32 getSquaredPixelThreshold(bool is_front);
private:
- void updateParentBoundingInfo(const LLVOCacheEntry* child);
+ void updateParentBoundingInfo(const LLVOCacheEntry* child);
public:
- typedef std::map<U32, LLPointer<LLVOCacheEntry> > vocache_entry_map_t;
- typedef std::set<LLVOCacheEntry*> vocache_entry_set_t;
- typedef std::set<LLVOCacheEntry*, CompareVOCacheEntry> vocache_entry_priority_list_t;
+ typedef std::map<U32, LLPointer<LLVOCacheEntry> > vocache_entry_map_t;
+ typedef std::set<LLVOCacheEntry*> vocache_entry_set_t;
+ typedef std::set<LLVOCacheEntry*, CompareVOCacheEntry> vocache_entry_priority_list_t;
typedef std::unordered_map<U32, LLGLTFOverrideCacheEntry> vocache_gltf_overrides_map_t;
- S32 mLastCameraUpdated;
+ S32 mLastCameraUpdated;
protected:
- U32 mLocalID;
- U32 mParentID;
- U32 mCRC;
- U32 mUpdateFlags; //receive from sim
- S32 mHitCount;
- S32 mDupeCount;
- S32 mCRCChangeCount;
- LLDataPackerBinaryBuffer mDP;
- U8 *mBuffer;
+ U32 mLocalID;
+ U32 mParentID;
+ U32 mCRC;
+ U32 mUpdateFlags; //receive from sim
+ S32 mHitCount;
+ S32 mDupeCount;
+ S32 mCRCChangeCount;
+ LLDataPackerBinaryBuffer mDP;
+ U8 *mBuffer;
- F32 mSceneContrib; //projected scene contributuion of this object.
- U32 mState; //high 16 bits reserved for special use.
- vocache_entry_set_t mChildrenList; //children entries in a linked set.
+ F32 mSceneContrib; //projected scene contributuion of this object.
+ U32 mState; //high 16 bits reserved for special use.
+ vocache_entry_set_t mChildrenList; //children entries in a linked set.
- BOOL mValid; //if set, this entry is valid, otherwise it is invalid and will be removed.
+ BOOL mValid; //if set, this entry is valid, otherwise it is invalid and will be removed.
- LLVector4a mBSphereCenter; //bounding sphere center
- F32 mBSphereRadius; //bounding sphere radius
+ LLVector4a mBSphereCenter; //bounding sphere center
+ F32 mBSphereRadius; //bounding sphere radius
public:
- static U32 sMinFrameRange;
- static F32 sNearRadius;
- static F32 sRearFarRadius;
- static F32 sFrontPixelThreshold;
- static F32 sRearPixelThreshold;
+ static U32 sMinFrameRange;
+ static F32 sNearRadius;
+ static F32 sRearFarRadius;
+ static F32 sFrontPixelThreshold;
+ static F32 sRearPixelThreshold;
};
class LLVOCacheGroup : public LLOcclusionCullingGroup
{
public:
- LLVOCacheGroup(OctreeNode* node, LLViewerOctreePartition* part) : LLOcclusionCullingGroup(node, part){}
+ LLVOCacheGroup(OctreeNode* node, LLViewerOctreePartition* part) : LLOcclusionCullingGroup(node, part){}
- //virtual
- void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
+ //virtual
+ void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
protected:
- virtual ~LLVOCacheGroup();
+ virtual ~LLVOCacheGroup();
};
class LLVOCachePartition : public LLViewerOctreePartition
{
public:
- LLVOCachePartition(LLViewerRegion* regionp);
+ LLVOCachePartition(LLViewerRegion* regionp);
virtual ~LLVOCachePartition();
- bool addEntry(LLViewerOctreeEntry* entry);
- void removeEntry(LLViewerOctreeEntry* entry);
- /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion);
- void addOccluders(LLViewerOctreeGroup* gp);
- void resetOccluders();
- void processOccluders(LLCamera* camera);
- void removeOccluder(LLVOCacheGroup* group);
+ bool addEntry(LLViewerOctreeEntry* entry);
+ void removeEntry(LLViewerOctreeEntry* entry);
+ /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion);
+ void addOccluders(LLViewerOctreeGroup* gp);
+ void resetOccluders();
+ void processOccluders(LLCamera* camera);
+ void removeOccluder(LLVOCacheGroup* group);
- void setCullHistory(BOOL has_new_object);
+ void setCullHistory(BOOL has_new_object);
- bool isFrontCull() const {return mFrontCull;}
+ bool isFrontCull() const {return mFrontCull;}
private:
- void selectBackObjects(LLCamera &camera, F32 projection_area_cutoff, bool use_occlusion); //select objects behind camera.
+ void selectBackObjects(LLCamera &camera, F32 projection_area_cutoff, bool use_occlusion); //select objects behind camera.
public:
- static BOOL sNeedsOcclusionCheck;
+ static BOOL sNeedsOcclusionCheck;
private:
- BOOL mFrontCull; //the view frustum cull if set, otherwise is back sphere cull.
- U32 mCullHistory;
- U32 mCulledTime[LLViewerCamera::NUM_CAMERAS];
- std::set<LLVOCacheGroup*> mOccludedGroups;
+ BOOL mFrontCull; //the view frustum cull if set, otherwise is back sphere cull.
+ U32 mCullHistory;
+ U32 mCulledTime[LLViewerCamera::NUM_CAMERAS];
+ std::set<LLVOCacheGroup*> mOccludedGroups;
- S32 mBackSlectionEnabled; //enable to select back objects if > 0.
- U32 mIdleHash;
+ S32 mBackSlectionEnabled; //enable to select back objects if > 0.
+ U32 mIdleHash;
};
//
@@ -249,82 +249,82 @@ private:
//
class LLVOCache : public LLParamSingleton<LLVOCache>
{
- LLSINGLETON(LLVOCache, bool read_only);
- ~LLVOCache() ;
+ LLSINGLETON(LLVOCache, bool read_only);
+ ~LLVOCache() ;
private:
- struct HeaderEntryInfo
- {
- HeaderEntryInfo() : mIndex(0), mHandle(0), mTime(0) {}
- S32 mIndex;
- U64 mHandle ;
- U32 mTime ;
- };
-
- struct HeaderMetaInfo
- {
- HeaderMetaInfo() : mVersion(0), mAddressSize(0) {}
-
- U32 mVersion;
- U32 mAddressSize;
- };
-
- struct header_entry_less
- {
- bool operator()(const HeaderEntryInfo* lhs, const HeaderEntryInfo* rhs) const
- {
- if(lhs->mTime == rhs->mTime)
- {
- return lhs < rhs ;
- }
-
- return lhs->mTime < rhs->mTime ; // older entry in front of queue (set)
- }
- };
- typedef std::set<HeaderEntryInfo*, header_entry_less> header_entry_queue_t;
- typedef std::map<U64, HeaderEntryInfo*> handle_entry_map_t;
+ struct HeaderEntryInfo
+ {
+ HeaderEntryInfo() : mIndex(0), mHandle(0), mTime(0) {}
+ S32 mIndex;
+ U64 mHandle ;
+ U32 mTime ;
+ };
+
+ struct HeaderMetaInfo
+ {
+ HeaderMetaInfo() : mVersion(0), mAddressSize(0) {}
+
+ U32 mVersion;
+ U32 mAddressSize;
+ };
+
+ struct header_entry_less
+ {
+ bool operator()(const HeaderEntryInfo* lhs, const HeaderEntryInfo* rhs) const
+ {
+ if(lhs->mTime == rhs->mTime)
+ {
+ return lhs < rhs ;
+ }
+
+ return lhs->mTime < rhs->mTime ; // older entry in front of queue (set)
+ }
+ };
+ typedef std::set<HeaderEntryInfo*, header_entry_less> header_entry_queue_t;
+ typedef std::map<U64, HeaderEntryInfo*> handle_entry_map_t;
public:
- // We need this init to be separate from constructor, since we might construct cache, purge it, then init.
- void initCache(ELLPath location, U32 size, U32 cache_version);
- void removeCache(ELLPath location, bool started = false) ;
+ // We need this init to be separate from constructor, since we might construct cache, purge it, then init.
+ void initCache(ELLPath location, U32 size, U32 cache_version);
+ void removeCache(ELLPath location, bool started = false) ;
- void readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ;
+ void readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ;
void readGenericExtrasFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map);
- void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled);
+ void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled);
void writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map, BOOL dirty_cache, bool removal_enabled);
- void removeEntry(U64 handle) ;
+ void removeEntry(U64 handle) ;
- U32 getCacheEntries() { return mNumEntries; }
- U32 getCacheEntriesMax() { return mCacheSize; }
+ U32 getCacheEntries() { return mNumEntries; }
+ U32 getCacheEntriesMax() { return mCacheSize; }
private:
- void setDirNames(ELLPath location);
- // determine the cache filename for the region from the region handle
- void getObjectCacheFilename(U64 handle, std::string& filename);
+ void setDirNames(ELLPath location);
+ // determine the cache filename for the region from the region handle
+ void getObjectCacheFilename(U64 handle, std::string& filename);
std::string getObjectCacheExtrasFilename(U64 handle);
- void removeFromCache(HeaderEntryInfo* entry);
- void readCacheHeader();
- void writeCacheHeader();
- void clearCacheInMemory();
- void removeCache() ;
- void removeEntry(HeaderEntryInfo* entry) ;
- void purgeEntries(U32 size);
- BOOL updateEntry(const HeaderEntryInfo* entry);
-
+ void removeFromCache(HeaderEntryInfo* entry);
+ void readCacheHeader();
+ void writeCacheHeader();
+ void clearCacheInMemory();
+ void removeCache() ;
+ void removeEntry(HeaderEntryInfo* entry) ;
+ void purgeEntries(U32 size);
+ BOOL updateEntry(const HeaderEntryInfo* entry);
+
private:
- bool mEnabled;
- bool mInitialized ;
- bool mReadOnly ;
- HeaderMetaInfo mMetaInfo;
- U32 mCacheSize;
- U32 mNumEntries;
- std::string mHeaderFileName ;
- std::string mObjectCacheDirName;
- LLVolatileAPRPool* mLocalAPRFilePoolp ;
- header_entry_queue_t mHeaderEntryQueue;
- handle_entry_map_t mHandleEntryMap;
+ bool mEnabled;
+ bool mInitialized ;
+ bool mReadOnly ;
+ HeaderMetaInfo mMetaInfo;
+ U32 mCacheSize;
+ U32 mNumEntries;
+ std::string mHeaderFileName ;
+ std::string mObjectCacheDirName;
+ LLVolatileAPRPool* mLocalAPRFilePoolp ;
+ header_entry_queue_t mHeaderEntryQueue;
+ handle_entry_map_t mHandleEntryMap;
};
#endif
diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp
index b814f15232..a92244b7da 100644
--- a/indra/newview/llvograss.cpp
+++ b/indra/newview/llvograss.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvograss.cpp
* @brief Not a blade, but a clump of grass
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,10 +48,10 @@
#include "llxmltree.h"
#include "llvotree.h"
-const S32 GRASS_MAX_BLADES = 32;
-const F32 GRASS_BLADE_BASE = 0.25f; // Width of grass at base
-const F32 GRASS_BLADE_HEIGHT = 0.5f; // meters
-const F32 GRASS_DISTRIBUTION_SD = 0.15f; // empirically defined
+const S32 GRASS_MAX_BLADES = 32;
+const F32 GRASS_BLADE_BASE = 0.25f; // Width of grass at base
+const F32 GRASS_BLADE_HEIGHT = 0.5f; // meters
+const F32 GRASS_DISTRIBUTION_SD = 0.15f; // empirically defined
F32 exp_x[GRASS_MAX_BLADES];
F32 exp_y[GRASS_MAX_BLADES];
@@ -60,28 +60,28 @@ F32 rot_y[GRASS_MAX_BLADES];
F32 dz_x [GRASS_MAX_BLADES];
F32 dz_y [GRASS_MAX_BLADES];
-F32 w_mod[GRASS_MAX_BLADES]; // Factor to modulate wind movement by to randomize appearance
+F32 w_mod[GRASS_MAX_BLADES]; // Factor to modulate wind movement by to randomize appearance
LLVOGrass::SpeciesMap LLVOGrass::sSpeciesTable;
S32 LLVOGrass::sMaxGrassSpecies = 0;
LLVOGrass::LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
-: LLAlphaObject(id, pcode, regionp)
+: LLAlphaObject(id, pcode, regionp)
{
- mPatch = NULL;
- mLastPatchUpdateTime = 0;
- mGrassVel.clearVec();
- mGrassBend.clearVec();
- mbCanSelect = TRUE;
+ mPatch = NULL;
+ mLastPatchUpdateTime = 0;
+ mGrassVel.clearVec();
+ mGrassBend.clearVec();
+ mbCanSelect = TRUE;
- mBladeWindAngle = 35.f;
- mBWAOverlap = 2.f;
+ mBladeWindAngle = 35.f;
+ mBWAOverlap = 2.f;
- setNumTEs(1);
+ setNumTEs(1);
- setTEColor(0, LLColor4(1.0f, 1.0f, 1.0f, 1.f));
- mNumBlades = GRASS_MAX_BLADES;
+ setTEColor(0, LLColor4(1.0f, 1.0f, 1.0f, 1.f));
+ mNumBlades = GRASS_MAX_BLADES;
}
LLVOGrass::~LLVOGrass()
@@ -91,805 +91,805 @@ LLVOGrass::~LLVOGrass()
void LLVOGrass::updateSpecies()
{
- mSpecies = getAttachmentState();
-
- if (!sSpeciesTable.count(mSpecies))
- {
- LL_INFOS() << "Unknown grass type, substituting grass type." << LL_ENDL;
- SpeciesMap::const_iterator it = sSpeciesTable.begin();
- mSpecies = (*it).first;
- }
- setTEImage(0, LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
+ mSpecies = getAttachmentState();
+
+ if (!sSpeciesTable.count(mSpecies))
+ {
+ LL_INFOS() << "Unknown grass type, substituting grass type." << LL_ENDL;
+ SpeciesMap::const_iterator it = sSpeciesTable.begin();
+ mSpecies = (*it).first;
+ }
+ setTEImage(0, LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
}
void LLVOGrass::initClass()
{
- LLVector3 pos(0.0f, 0.0f, 0.0f);
- // Create nifty list of exponential distribution 0-1
- F32 x = 0.f;
- F32 y = 0.f;
- F32 rot;
-
- std::string xml_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"grass.xml");
-
- LLXmlTree grass_def_grass;
-
- if (!grass_def_grass.parseFile(xml_filename))
- {
- LL_ERRS() << "Failed to parse grass file." << LL_ENDL;
- return;
- }
-
- LLXmlTreeNode* rootp = grass_def_grass.getRoot();
-
- for (LLXmlTreeNode* grass_def = rootp->getFirstChild();
- grass_def;
- grass_def = rootp->getNextChild())
- {
- if (!grass_def->hasName("grass"))
- {
- LL_WARNS() << "Invalid grass definition node " << grass_def->getName() << LL_ENDL;
- continue;
- }
- F32 F32_val;
- LLUUID id;
-
- BOOL success = TRUE;
-
- S32 species;
- static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id");
- if (!grass_def->getFastAttributeS32(species_id_string, species))
- {
- LL_WARNS() << "No species id defined" << LL_ENDL;
- continue;
- }
-
- if (species < 0)
- {
- LL_WARNS() << "Invalid species id " << species << LL_ENDL;
- continue;
- }
-
- GrassSpeciesData* newGrass = new GrassSpeciesData();
-
-
- static LLStdStringHandle texture_id_string = LLXmlTree::addAttributeString("texture_id");
- grass_def->getFastAttributeUUID(texture_id_string, id);
- newGrass->mTextureID = id;
-
- static LLStdStringHandle blade_sizex_string = LLXmlTree::addAttributeString("blade_size_x");
- success &= grass_def->getFastAttributeF32(blade_sizex_string, F32_val);
- newGrass->mBladeSizeX = F32_val;
-
- static LLStdStringHandle blade_sizey_string = LLXmlTree::addAttributeString("blade_size_y");
- success &= grass_def->getFastAttributeF32(blade_sizey_string, F32_val);
- newGrass->mBladeSizeY = F32_val;
-
- if (sSpeciesTable.count(species))
- {
- LL_INFOS() << "Grass species " << species << " already defined! Duplicate discarded." << LL_ENDL;
- delete newGrass;
- continue;
- }
- else
- {
- sSpeciesTable[species] = newGrass;
- }
-
- if (species >= sMaxGrassSpecies) sMaxGrassSpecies = species + 1;
-
- if (!success)
- {
- std::string name;
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- grass_def->getFastAttributeString(name_string, name);
- LL_WARNS() << "Incomplete definition of grass " << name << LL_ENDL;
- }
- }
-
- BOOL have_all_grass = TRUE;
- std::string err;
-
- for (S32 i=0;i<sMaxGrassSpecies;++i)
- {
- if (!sSpeciesTable.count(i))
- {
- err.append(llformat(" %d",i));
- have_all_grass = FALSE;
- }
- }
-
- if (!have_all_grass)
- {
- LLSD args;
- args["SPECIES"] = err;
- LLNotificationsUtil::add("ErrorUndefinedGrasses", args);
- }
-
- for (S32 i = 0; i < GRASS_MAX_BLADES; ++i)
- {
- if (1) //(i%2 == 0) Uncomment for X blading
- {
- F32 u = sqrt(-2.0f * log(ll_frand()));
- F32 v = 2.0f * F_PI * ll_frand();
-
- x = u * sin(v) * GRASS_DISTRIBUTION_SD;
- y = u * cos(v) * GRASS_DISTRIBUTION_SD;
-
- rot = ll_frand(F_PI);
- }
- else
- {
- rot += (F_PI*0.4f + ll_frand(0.2f*F_PI));
- }
-
- exp_x[i] = x;
- exp_y[i] = y;
- rot_x[i] = sin(rot);
- rot_y[i] = cos(rot);
- dz_x[i] = ll_frand(GRASS_BLADE_BASE * 0.25f);
- dz_y[i] = ll_frand(GRASS_BLADE_BASE * 0.25f);
- w_mod[i] = 0.5f + ll_frand(); // Degree to which blade is moved by wind
-
- }
+ LLVector3 pos(0.0f, 0.0f, 0.0f);
+ // Create nifty list of exponential distribution 0-1
+ F32 x = 0.f;
+ F32 y = 0.f;
+ F32 rot;
+
+ std::string xml_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"grass.xml");
+
+ LLXmlTree grass_def_grass;
+
+ if (!grass_def_grass.parseFile(xml_filename))
+ {
+ LL_ERRS() << "Failed to parse grass file." << LL_ENDL;
+ return;
+ }
+
+ LLXmlTreeNode* rootp = grass_def_grass.getRoot();
+
+ for (LLXmlTreeNode* grass_def = rootp->getFirstChild();
+ grass_def;
+ grass_def = rootp->getNextChild())
+ {
+ if (!grass_def->hasName("grass"))
+ {
+ LL_WARNS() << "Invalid grass definition node " << grass_def->getName() << LL_ENDL;
+ continue;
+ }
+ F32 F32_val;
+ LLUUID id;
+
+ BOOL success = TRUE;
+
+ S32 species;
+ static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id");
+ if (!grass_def->getFastAttributeS32(species_id_string, species))
+ {
+ LL_WARNS() << "No species id defined" << LL_ENDL;
+ continue;
+ }
+
+ if (species < 0)
+ {
+ LL_WARNS() << "Invalid species id " << species << LL_ENDL;
+ continue;
+ }
+
+ GrassSpeciesData* newGrass = new GrassSpeciesData();
+
+
+ static LLStdStringHandle texture_id_string = LLXmlTree::addAttributeString("texture_id");
+ grass_def->getFastAttributeUUID(texture_id_string, id);
+ newGrass->mTextureID = id;
+
+ static LLStdStringHandle blade_sizex_string = LLXmlTree::addAttributeString("blade_size_x");
+ success &= grass_def->getFastAttributeF32(blade_sizex_string, F32_val);
+ newGrass->mBladeSizeX = F32_val;
+
+ static LLStdStringHandle blade_sizey_string = LLXmlTree::addAttributeString("blade_size_y");
+ success &= grass_def->getFastAttributeF32(blade_sizey_string, F32_val);
+ newGrass->mBladeSizeY = F32_val;
+
+ if (sSpeciesTable.count(species))
+ {
+ LL_INFOS() << "Grass species " << species << " already defined! Duplicate discarded." << LL_ENDL;
+ delete newGrass;
+ continue;
+ }
+ else
+ {
+ sSpeciesTable[species] = newGrass;
+ }
+
+ if (species >= sMaxGrassSpecies) sMaxGrassSpecies = species + 1;
+
+ if (!success)
+ {
+ std::string name;
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ grass_def->getFastAttributeString(name_string, name);
+ LL_WARNS() << "Incomplete definition of grass " << name << LL_ENDL;
+ }
+ }
+
+ BOOL have_all_grass = TRUE;
+ std::string err;
+
+ for (S32 i=0;i<sMaxGrassSpecies;++i)
+ {
+ if (!sSpeciesTable.count(i))
+ {
+ err.append(llformat(" %d",i));
+ have_all_grass = FALSE;
+ }
+ }
+
+ if (!have_all_grass)
+ {
+ LLSD args;
+ args["SPECIES"] = err;
+ LLNotificationsUtil::add("ErrorUndefinedGrasses", args);
+ }
+
+ for (S32 i = 0; i < GRASS_MAX_BLADES; ++i)
+ {
+ if (1) //(i%2 == 0) Uncomment for X blading
+ {
+ F32 u = sqrt(-2.0f * log(ll_frand()));
+ F32 v = 2.0f * F_PI * ll_frand();
+
+ x = u * sin(v) * GRASS_DISTRIBUTION_SD;
+ y = u * cos(v) * GRASS_DISTRIBUTION_SD;
+
+ rot = ll_frand(F_PI);
+ }
+ else
+ {
+ rot += (F_PI*0.4f + ll_frand(0.2f*F_PI));
+ }
+
+ exp_x[i] = x;
+ exp_y[i] = y;
+ rot_x[i] = sin(rot);
+ rot_y[i] = cos(rot);
+ dz_x[i] = ll_frand(GRASS_BLADE_BASE * 0.25f);
+ dz_y[i] = ll_frand(GRASS_BLADE_BASE * 0.25f);
+ w_mod[i] = 0.5f + ll_frand(); // Degree to which blade is moved by wind
+
+ }
}
void LLVOGrass::cleanupClass()
{
- for_each(sSpeciesTable.begin(), sSpeciesTable.end(), DeletePairedPointer());
- sSpeciesTable.clear();
+ for_each(sSpeciesTable.begin(), sSpeciesTable.end(), DeletePairedPointer());
+ sSpeciesTable.clear();
}
U32 LLVOGrass::processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num,
- const EObjectUpdateType update_type,
- LLDataPacker *dp)
+ void **user_data,
+ U32 block_num,
+ const EObjectUpdateType update_type,
+ LLDataPacker *dp)
{
- // Do base class updates...
- U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
-
- updateSpecies();
-
- if ( (getVelocity().lengthSquared() > 0.f)
- ||(getAcceleration().lengthSquared() > 0.f)
- ||(getAngularVelocity().lengthSquared() > 0.f))
- {
- LL_INFOS() << "ACK! Moving grass!" << LL_ENDL;
- setVelocity(LLVector3::zero);
- setAcceleration(LLVector3::zero);
- setAngularVelocity(LLVector3::zero);
- }
-
- if (mDrawable)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
- }
-
- return retval;
+ // Do base class updates...
+ U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
+
+ updateSpecies();
+
+ if ( (getVelocity().lengthSquared() > 0.f)
+ ||(getAcceleration().lengthSquared() > 0.f)
+ ||(getAngularVelocity().lengthSquared() > 0.f))
+ {
+ LL_INFOS() << "ACK! Moving grass!" << LL_ENDL;
+ setVelocity(LLVector3::zero);
+ setAcceleration(LLVector3::zero);
+ setAngularVelocity(LLVector3::zero);
+ }
+
+ if (mDrawable)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
+ }
+
+ return retval;
}
BOOL LLVOGrass::isActive() const
{
- return TRUE;
+ return TRUE;
}
void LLVOGrass::idleUpdate(LLAgent &agent, const F64 &time)
{
- if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_GRASS)))
- {
- return;
- }
-
- if (!mDrawable)
- {
- // So drones work.
- return;
- }
- if (!LLVOTree::isTreeRenderingStopped() && !mNumBlades)//restart grass rendering
- {
- mNumBlades = GRASS_MAX_BLADES;
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- return;
- }
- if (mPatch && (mLastPatchUpdateTime != mPatch->getLastUpdateTime()))
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
- }
-
- return;
+ if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_GRASS)))
+ {
+ return;
+ }
+
+ if (!mDrawable)
+ {
+ // So drones work.
+ return;
+ }
+ if (!LLVOTree::isTreeRenderingStopped() && !mNumBlades)//restart grass rendering
+ {
+ mNumBlades = GRASS_MAX_BLADES;
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ return;
+ }
+ if (mPatch && (mLastPatchUpdateTime != mPatch->getLastUpdateTime()))
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
+ }
+
+ return;
}
void LLVOGrass::setPixelAreaAndAngle(LLAgent &agent)
{
- // This should be the camera's center, as soon as we move to all region-local.
- LLVector3 relative_position = getPositionAgent() - gAgentCamera.getCameraPositionAgent();
- F32 range = relative_position.length();
+ // This should be the camera's center, as soon as we move to all region-local.
+ LLVector3 relative_position = getPositionAgent() - gAgentCamera.getCameraPositionAgent();
+ F32 range = relative_position.length();
- F32 max_scale = getMaxScale();
+ F32 max_scale = getMaxScale();
- mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG;
+ mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG;
- // Compute pixels per meter at the given range
- F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / (tan(LLViewerCamera::getInstance()->getView()) * range);
+ // Compute pixels per meter at the given range
+ F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / (tan(LLViewerCamera::getInstance()->getView()) * range);
- // Assume grass texture is a 5 meter by 5 meter sprite at the grass object's center
- mPixelArea = (pixels_per_meter) * (pixels_per_meter) * 25.f;
+ // Assume grass texture is a 5 meter by 5 meter sprite at the grass object's center
+ mPixelArea = (pixels_per_meter) * (pixels_per_meter) * 25.f;
}
// BUG could speed this up by caching the relative_position and range calculations
void LLVOGrass::updateTextures()
{
- if (getTEImage(0))
- {
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
- {
- setDebugText(llformat("%4.0f", (F32) sqrt(mPixelArea)));
- }
- getTEImage(0)->addTextureStats(mPixelArea);
- }
+ if (getTEImage(0))
+ {
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
+ {
+ setDebugText(llformat("%4.0f", (F32) sqrt(mPixelArea)));
+ }
+ getTEImage(0)->addTextureStats(mPixelArea);
+ }
}
BOOL LLVOGrass::updateLOD()
{
- if (mDrawable->getNumFaces() <= 0)
- {
- return FALSE;
- }
+ if (mDrawable->getNumFaces() <= 0)
+ {
+ return FALSE;
+ }
LLFace* face = mDrawable->getFace(0);
- if(LLVOTree::isTreeRenderingStopped())
- {
- if(mNumBlades)
- {
- mNumBlades = 0 ;
+ if(LLVOTree::isTreeRenderingStopped())
+ {
+ if(mNumBlades)
+ {
+ mNumBlades = 0 ;
face->setSize(0, 0);
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- }
- return TRUE ;
- }
- if(!mNumBlades)
- {
- mNumBlades = GRASS_MAX_BLADES;
- }
-
- F32 tan_angle = 0.f;
- S32 num_blades = 0;
-
- tan_angle = (mScale.mV[0]*mScale.mV[1])/mDrawable->mDistanceWRTCamera;
- num_blades = llmin(GRASS_MAX_BLADES, lltrunc(tan_angle * 5));
- num_blades = llmax(1, num_blades);
- if (num_blades >= (mNumBlades << 1))
- {
- while (mNumBlades < num_blades)
- {
- mNumBlades <<= 1;
- }
- if (face)
- {
- face->setSize(mNumBlades*8, mNumBlades*12);
- }
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- }
- else if (num_blades <= (mNumBlades >> 1))
- {
- while (mNumBlades > num_blades)
- {
- mNumBlades >>=1;
- }
-
- if (face)
- {
- face->setSize(mNumBlades*8, mNumBlades*12);
- }
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- return TRUE;
- }
-
- return FALSE;
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ return TRUE ;
+ }
+ if(!mNumBlades)
+ {
+ mNumBlades = GRASS_MAX_BLADES;
+ }
+
+ F32 tan_angle = 0.f;
+ S32 num_blades = 0;
+
+ tan_angle = (mScale.mV[0]*mScale.mV[1])/mDrawable->mDistanceWRTCamera;
+ num_blades = llmin(GRASS_MAX_BLADES, lltrunc(tan_angle * 5));
+ num_blades = llmax(1, num_blades);
+ if (num_blades >= (mNumBlades << 1))
+ {
+ while (mNumBlades < num_blades)
+ {
+ mNumBlades <<= 1;
+ }
+ if (face)
+ {
+ face->setSize(mNumBlades*8, mNumBlades*12);
+ }
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ else if (num_blades <= (mNumBlades >> 1))
+ {
+ while (mNumBlades > num_blades)
+ {
+ mNumBlades >>=1;
+ }
+
+ if (face)
+ {
+ face->setSize(mNumBlades*8, mNumBlades*12);
+ }
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ return TRUE;
+ }
+
+ return FALSE;
}
LLDrawable* LLVOGrass::createDrawable(LLPipeline *pipeline)
{
- pipeline->allocDrawable(this);
- mDrawable->setRenderType(LLPipeline::RENDER_TYPE_GRASS);
-
- return mDrawable;
+ pipeline->allocDrawable(this);
+ mDrawable->setRenderType(LLPipeline::RENDER_TYPE_GRASS);
+
+ return mDrawable;
}
static LLTrace::BlockTimerStatHandle FTM_UPDATE_GRASS("Update Grass");
BOOL LLVOGrass::updateGeometry(LLDrawable *drawable)
{
- LL_RECORD_BLOCK_TIME(FTM_UPDATE_GRASS);
-
- dirtySpatialGroup();
-
- if(!mNumBlades)//stop rendering grass
- {
- if (mDrawable->getNumFaces() > 0)
- {
- LLFace* facep = mDrawable->getFace(0);
- if(facep)
- {
- facep->setSize(0, 0);
- }
- }
- }
- else
- {
- plantBlades();
- }
- return TRUE;
+ LL_RECORD_BLOCK_TIME(FTM_UPDATE_GRASS);
+
+ dirtySpatialGroup();
+
+ if(!mNumBlades)//stop rendering grass
+ {
+ if (mDrawable->getNumFaces() > 0)
+ {
+ LLFace* facep = mDrawable->getFace(0);
+ if(facep)
+ {
+ facep->setSize(0, 0);
+ }
+ }
+ }
+ else
+ {
+ plantBlades();
+ }
+ return TRUE;
}
void LLVOGrass::plantBlades()
{
- // It is possible that the species of a grass is not defined
- // This is bad, but not the end of the world.
- if (!sSpeciesTable.count(mSpecies))
- {
- LL_INFOS() << "Unknown grass species " << mSpecies << LL_ENDL;
- return;
- }
-
- if (mDrawable->getNumFaces() < 1)
- {
- mDrawable->setNumFaces(1, NULL, getTEImage(0));
- }
-
- LLFace *face = mDrawable->getFace(0);
- if (face)
- {
- face->setTexture(getTEImage(0));
- face->setState(LLFace::GLOBAL);
- face->setSize(mNumBlades * 8, mNumBlades * 12);
- face->setVertexBuffer(NULL);
- face->setTEOffset(0);
- face->mCenterLocal = mPosition + mRegionp->getOriginAgent();
- }
-
- mDepth = (face->mCenterLocal - LLViewerCamera::getInstance()->getOrigin())*LLViewerCamera::getInstance()->getAtAxis();
- mDrawable->setPosition(face->mCenterLocal);
- mDrawable->movePartition();
- LLPipeline::sCompiles++;
+ // It is possible that the species of a grass is not defined
+ // This is bad, but not the end of the world.
+ if (!sSpeciesTable.count(mSpecies))
+ {
+ LL_INFOS() << "Unknown grass species " << mSpecies << LL_ENDL;
+ return;
+ }
+
+ if (mDrawable->getNumFaces() < 1)
+ {
+ mDrawable->setNumFaces(1, NULL, getTEImage(0));
+ }
+
+ LLFace *face = mDrawable->getFace(0);
+ if (face)
+ {
+ face->setTexture(getTEImage(0));
+ face->setState(LLFace::GLOBAL);
+ face->setSize(mNumBlades * 8, mNumBlades * 12);
+ face->setVertexBuffer(NULL);
+ face->setTEOffset(0);
+ face->mCenterLocal = mPosition + mRegionp->getOriginAgent();
+ }
+
+ mDepth = (face->mCenterLocal - LLViewerCamera::getInstance()->getOrigin())*LLViewerCamera::getInstance()->getAtAxis();
+ mDrawable->setPosition(face->mCenterLocal);
+ mDrawable->movePartition();
+ LLPipeline::sCompiles++;
}
void LLVOGrass::getGeometry(S32 idx,
- LLStrider<LLVector4a>& verticesp,
- LLStrider<LLVector3>& normalsp,
- LLStrider<LLVector2>& texcoordsp,
- LLStrider<LLColor4U>& colorsp,
- LLStrider<LLColor4U>& emissivep,
- LLStrider<U16>& indicesp)
+ LLStrider<LLVector4a>& verticesp,
+ LLStrider<LLVector3>& normalsp,
+ LLStrider<LLVector2>& texcoordsp,
+ LLStrider<LLColor4U>& colorsp,
+ LLStrider<LLColor4U>& emissivep,
+ LLStrider<U16>& indicesp)
{
- if(!mNumBlades)//stop rendering grass
- {
- return ;
- }
-
- mPatch = mRegionp->getLand().resolvePatchRegion(getPositionRegion());
- if (mPatch)
- mLastPatchUpdateTime = mPatch->getLastUpdateTime();
-
- LLVector3 position;
- // Create random blades of grass with gaussian distribution
- F32 x,y,xf,yf,dzx,dzy;
-
- LLColor4U color(255,255,255,255);
-
- LLFace *face = mDrawable->getFace(idx);
- if (!face)
- return;
-
- F32 width = sSpeciesTable[mSpecies]->mBladeSizeX;
- F32 height = sSpeciesTable[mSpecies]->mBladeSizeY;
-
- U32 index_offset = face->getGeomIndex();
-
- for (S32 i = 0; i < mNumBlades; i++)
- {
- x = exp_x[i] * mScale.mV[VX];
- y = exp_y[i] * mScale.mV[VY];
- xf = rot_x[i] * GRASS_BLADE_BASE * width * w_mod[i];
- yf = rot_y[i] * GRASS_BLADE_BASE * width * w_mod[i];
- dzx = dz_x [i];
- dzy = dz_y [i];
-
- LLVector3 v1,v2,v3;
- F32 blade_height= GRASS_BLADE_HEIGHT * height * w_mod[i];
-
- *texcoordsp++ = LLVector2(0, 0);
- *texcoordsp++ = LLVector2(0, 0);
- *texcoordsp++ = LLVector2(0, 0.98f);
- *texcoordsp++ = LLVector2(0, 0.98f);
- *texcoordsp++ = LLVector2(1, 0);
- *texcoordsp++ = LLVector2(1, 0);
- *texcoordsp++ = LLVector2(1, 0.98f);
- *texcoordsp++ = LLVector2(1, 0.98f);
-
- position.mV[0] = mPosition.mV[VX] + x + xf;
- position.mV[1] = mPosition.mV[VY] + y + yf;
- position.mV[2] = mRegionp->getLand().resolveHeightRegion(position);
- v1 = position + mRegionp->getOriginAgent();
- (*verticesp++).load3(v1.mV);
- (*verticesp++).load3(v1.mV);
-
-
- position.mV[0] += dzx;
- position.mV[1] += dzy;
- position.mV[2] += blade_height;
- v2 = position + mRegionp->getOriginAgent();
- (*verticesp++).load3(v2.mV);
- (*verticesp++).load3(v2.mV);
-
- position.mV[0] = mPosition.mV[VX] + x - xf;
- position.mV[1] = mPosition.mV[VY] + y - xf;
- position.mV[2] = mRegionp->getLand().resolveHeightRegion(position);
- v3 = position + mRegionp->getOriginAgent();
- (*verticesp++).load3(v3.mV);
- (*verticesp++).load3(v3.mV);
-
- LLVector3 normal1 = (v1-v2) % (v2-v3);
- normal1.mV[VZ] = 0.75f;
- normal1.normalize();
- LLVector3 normal2 = -normal1;
- normal2.mV[VZ] = -normal2.mV[VZ];
-
- position.mV[0] += dzx;
- position.mV[1] += dzy;
- position.mV[2] += blade_height;
- v1 = position + mRegionp->getOriginAgent();
- (*verticesp++).load3(v1.mV);
- (*verticesp++).load3(v1.mV);
-
- *(normalsp++) = normal1;
- *(normalsp++) = normal2;
- *(normalsp++) = normal1;
- *(normalsp++) = normal2;
-
- *(normalsp++) = normal1;
- *(normalsp++) = normal2;
- *(normalsp++) = normal1;
- *(normalsp++) = normal2;
-
- *(colorsp++) = color;
- *(colorsp++) = color;
- *(colorsp++) = color;
- *(colorsp++) = color;
- *(colorsp++) = color;
- *(colorsp++) = color;
- *(colorsp++) = color;
- *(colorsp++) = color;
-
- *indicesp++ = index_offset + 0;
- *indicesp++ = index_offset + 2;
- *indicesp++ = index_offset + 4;
-
- *indicesp++ = index_offset + 2;
- *indicesp++ = index_offset + 6;
- *indicesp++ = index_offset + 4;
-
- *indicesp++ = index_offset + 1;
- *indicesp++ = index_offset + 5;
- *indicesp++ = index_offset + 3;
-
- *indicesp++ = index_offset + 3;
- *indicesp++ = index_offset + 5;
- *indicesp++ = index_offset + 7;
- index_offset += 8;
- }
-
- LLPipeline::sCompiles++;
+ if(!mNumBlades)//stop rendering grass
+ {
+ return ;
+ }
+
+ mPatch = mRegionp->getLand().resolvePatchRegion(getPositionRegion());
+ if (mPatch)
+ mLastPatchUpdateTime = mPatch->getLastUpdateTime();
+
+ LLVector3 position;
+ // Create random blades of grass with gaussian distribution
+ F32 x,y,xf,yf,dzx,dzy;
+
+ LLColor4U color(255,255,255,255);
+
+ LLFace *face = mDrawable->getFace(idx);
+ if (!face)
+ return;
+
+ F32 width = sSpeciesTable[mSpecies]->mBladeSizeX;
+ F32 height = sSpeciesTable[mSpecies]->mBladeSizeY;
+
+ U32 index_offset = face->getGeomIndex();
+
+ for (S32 i = 0; i < mNumBlades; i++)
+ {
+ x = exp_x[i] * mScale.mV[VX];
+ y = exp_y[i] * mScale.mV[VY];
+ xf = rot_x[i] * GRASS_BLADE_BASE * width * w_mod[i];
+ yf = rot_y[i] * GRASS_BLADE_BASE * width * w_mod[i];
+ dzx = dz_x [i];
+ dzy = dz_y [i];
+
+ LLVector3 v1,v2,v3;
+ F32 blade_height= GRASS_BLADE_HEIGHT * height * w_mod[i];
+
+ *texcoordsp++ = LLVector2(0, 0);
+ *texcoordsp++ = LLVector2(0, 0);
+ *texcoordsp++ = LLVector2(0, 0.98f);
+ *texcoordsp++ = LLVector2(0, 0.98f);
+ *texcoordsp++ = LLVector2(1, 0);
+ *texcoordsp++ = LLVector2(1, 0);
+ *texcoordsp++ = LLVector2(1, 0.98f);
+ *texcoordsp++ = LLVector2(1, 0.98f);
+
+ position.mV[0] = mPosition.mV[VX] + x + xf;
+ position.mV[1] = mPosition.mV[VY] + y + yf;
+ position.mV[2] = mRegionp->getLand().resolveHeightRegion(position);
+ v1 = position + mRegionp->getOriginAgent();
+ (*verticesp++).load3(v1.mV);
+ (*verticesp++).load3(v1.mV);
+
+
+ position.mV[0] += dzx;
+ position.mV[1] += dzy;
+ position.mV[2] += blade_height;
+ v2 = position + mRegionp->getOriginAgent();
+ (*verticesp++).load3(v2.mV);
+ (*verticesp++).load3(v2.mV);
+
+ position.mV[0] = mPosition.mV[VX] + x - xf;
+ position.mV[1] = mPosition.mV[VY] + y - xf;
+ position.mV[2] = mRegionp->getLand().resolveHeightRegion(position);
+ v3 = position + mRegionp->getOriginAgent();
+ (*verticesp++).load3(v3.mV);
+ (*verticesp++).load3(v3.mV);
+
+ LLVector3 normal1 = (v1-v2) % (v2-v3);
+ normal1.mV[VZ] = 0.75f;
+ normal1.normalize();
+ LLVector3 normal2 = -normal1;
+ normal2.mV[VZ] = -normal2.mV[VZ];
+
+ position.mV[0] += dzx;
+ position.mV[1] += dzy;
+ position.mV[2] += blade_height;
+ v1 = position + mRegionp->getOriginAgent();
+ (*verticesp++).load3(v1.mV);
+ (*verticesp++).load3(v1.mV);
+
+ *(normalsp++) = normal1;
+ *(normalsp++) = normal2;
+ *(normalsp++) = normal1;
+ *(normalsp++) = normal2;
+
+ *(normalsp++) = normal1;
+ *(normalsp++) = normal2;
+ *(normalsp++) = normal1;
+ *(normalsp++) = normal2;
+
+ *(colorsp++) = color;
+ *(colorsp++) = color;
+ *(colorsp++) = color;
+ *(colorsp++) = color;
+ *(colorsp++) = color;
+ *(colorsp++) = color;
+ *(colorsp++) = color;
+ *(colorsp++) = color;
+
+ *indicesp++ = index_offset + 0;
+ *indicesp++ = index_offset + 2;
+ *indicesp++ = index_offset + 4;
+
+ *indicesp++ = index_offset + 2;
+ *indicesp++ = index_offset + 6;
+ *indicesp++ = index_offset + 4;
+
+ *indicesp++ = index_offset + 1;
+ *indicesp++ = index_offset + 5;
+ *indicesp++ = index_offset + 3;
+
+ *indicesp++ = index_offset + 3;
+ *indicesp++ = index_offset + 5;
+ *indicesp++ = index_offset + 7;
+ index_offset += 8;
+ }
+
+ LLPipeline::sCompiles++;
}
U32 LLVOGrass::getPartitionType() const
{
- return LLViewerRegion::PARTITION_GRASS;
+ return LLViewerRegion::PARTITION_GRASS;
}
LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp)
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, regionp)
{
- mDrawableType = LLPipeline::RENDER_TYPE_GRASS;
- mPartitionType = LLViewerRegion::PARTITION_GRASS;
- mLODPeriod = 16;
- mDepthMask = TRUE;
- mSlopRatio = 0.1f;
- mRenderPass = LLRenderPass::PASS_GRASS;
+ mDrawableType = LLPipeline::RENDER_TYPE_GRASS;
+ mPartitionType = LLViewerRegion::PARTITION_GRASS;
+ mLODPeriod = 16;
+ mDepthMask = TRUE;
+ mSlopRatio = 0.1f;
+ mRenderPass = LLRenderPass::PASS_GRASS;
}
void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count)
{
- mFaceList.clear();
-
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
- {
- LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
-
- if (!drawablep || drawablep->isDead())
- {
- continue;
- }
-
- LLAlphaObject* obj = (LLAlphaObject*) drawablep->getVObj().get();
- obj->mDepth = 0.f;
-
- U32 count = 0;
- for (S32 j = 0; j < drawablep->getNumFaces(); ++j)
- {
- drawablep->updateFaceSize(j);
-
- LLFace* facep = drawablep->getFace(j);
- if ( !facep || !facep->hasGeometry())
- {
- continue;
- }
-
- if ((facep->getGeomCount() + vertex_count) <= 65536)
- {
- count++;
- facep->mDistance = (facep->mCenterLocal - camera->getOrigin()) * camera->getAtAxis();
- obj->mDepth += facep->mDistance;
-
- mFaceList.push_back(facep);
- vertex_count += facep->getGeomCount();
- index_count += facep->getIndicesCount();
- llassert(facep->getIndicesCount() < 65536);
- }
- else
- {
- facep->clearVertexBuffer();
- }
- }
-
- obj->mDepth /= count;
- }
+ mFaceList.clear();
+
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+ {
+ LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
+
+ if (!drawablep || drawablep->isDead())
+ {
+ continue;
+ }
+
+ LLAlphaObject* obj = (LLAlphaObject*) drawablep->getVObj().get();
+ obj->mDepth = 0.f;
+
+ U32 count = 0;
+ for (S32 j = 0; j < drawablep->getNumFaces(); ++j)
+ {
+ drawablep->updateFaceSize(j);
+
+ LLFace* facep = drawablep->getFace(j);
+ if ( !facep || !facep->hasGeometry())
+ {
+ continue;
+ }
+
+ if ((facep->getGeomCount() + vertex_count) <= 65536)
+ {
+ count++;
+ facep->mDistance = (facep->mCenterLocal - camera->getOrigin()) * camera->getAtAxis();
+ obj->mDepth += facep->mDistance;
+
+ mFaceList.push_back(facep);
+ vertex_count += facep->getGeomCount();
+ index_count += facep->getIndicesCount();
+ llassert(facep->getIndicesCount() < 65536);
+ }
+ else
+ {
+ facep->clearVertexBuffer();
+ }
+ }
+
+ obj->mDepth /= count;
+ }
}
void LLGrassPartition::getGeometry(LLSpatialGroup* group)
{
LL_PROFILE_ZONE_SCOPED;
- std::sort(mFaceList.begin(), mFaceList.end(), LLFace::CompareDistanceGreater());
-
- U32 index_count = 0;
- U32 vertex_count = 0;
-
- group->clearDrawMap();
-
- LLVertexBuffer* buffer = group->mVertexBuffer;
-
- LLStrider<U16> indicesp;
- LLStrider<LLVector4a> verticesp;
- LLStrider<LLVector3> normalsp;
- LLStrider<LLVector2> texcoordsp;
- LLStrider<LLColor4U> colorsp;
-
- buffer->getVertexStrider(verticesp);
- buffer->getNormalStrider(normalsp);
- buffer->getColorStrider(colorsp);
- buffer->getTexCoord0Strider(texcoordsp);
- buffer->getIndexStrider(indicesp);
-
- LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[mRenderPass];
-
- for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
- {
- LLFace* facep = *i;
- LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
- facep->setGeomIndex(vertex_count);
- facep->setIndicesIndex(index_count);
- facep->setVertexBuffer(buffer);
- facep->setPoolType(LLDrawPool::POOL_ALPHA);
-
- //dummy parameter (unused by this implementation)
- LLStrider<LLColor4U> emissivep;
-
- object->getGeometry(facep->getTEOffset(), verticesp, normalsp, texcoordsp, colorsp, emissivep, indicesp);
-
- vertex_count += facep->getGeomCount();
- index_count += facep->getIndicesCount();
-
- S32 idx = draw_vec.size()-1;
-
- bool fullbright = facep->isState(LLFace::FULLBRIGHT);
-
- if (idx >= 0 && draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
- draw_vec[idx]->mTexture == facep->getTexture() &&
- (U16) (draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount()) <= (U32) gGLManager.mGLMaxVertexRange &&
- //draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
- draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() < 4096 &&
- draw_vec[idx]->mFullbright == fullbright)
- {
- draw_vec[idx]->mCount += facep->getIndicesCount();
- draw_vec[idx]->mEnd += facep->getGeomCount();
- }
- else
- {
- U32 start = facep->getGeomIndex();
- U32 end = start + facep->getGeomCount()-1;
- U32 offset = facep->getIndicesStart();
- U32 count = facep->getIndicesCount();
- LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(),
- //facep->getTexture(),
- buffer, object->isSelected(), fullbright);
-
- draw_vec.push_back(info);
- //for alpha sorting
- facep->setDrawInfo(info);
- }
- }
-
- buffer->unmapBuffer();
- mFaceList.clear();
+ std::sort(mFaceList.begin(), mFaceList.end(), LLFace::CompareDistanceGreater());
+
+ U32 index_count = 0;
+ U32 vertex_count = 0;
+
+ group->clearDrawMap();
+
+ LLVertexBuffer* buffer = group->mVertexBuffer;
+
+ LLStrider<U16> indicesp;
+ LLStrider<LLVector4a> verticesp;
+ LLStrider<LLVector3> normalsp;
+ LLStrider<LLVector2> texcoordsp;
+ LLStrider<LLColor4U> colorsp;
+
+ buffer->getVertexStrider(verticesp);
+ buffer->getNormalStrider(normalsp);
+ buffer->getColorStrider(colorsp);
+ buffer->getTexCoord0Strider(texcoordsp);
+ buffer->getIndexStrider(indicesp);
+
+ LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[mRenderPass];
+
+ for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
+ {
+ LLFace* facep = *i;
+ LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
+ facep->setGeomIndex(vertex_count);
+ facep->setIndicesIndex(index_count);
+ facep->setVertexBuffer(buffer);
+ facep->setPoolType(LLDrawPool::POOL_ALPHA);
+
+ //dummy parameter (unused by this implementation)
+ LLStrider<LLColor4U> emissivep;
+
+ object->getGeometry(facep->getTEOffset(), verticesp, normalsp, texcoordsp, colorsp, emissivep, indicesp);
+
+ vertex_count += facep->getGeomCount();
+ index_count += facep->getIndicesCount();
+
+ S32 idx = draw_vec.size()-1;
+
+ bool fullbright = facep->isState(LLFace::FULLBRIGHT);
+
+ if (idx >= 0 && draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
+ draw_vec[idx]->mTexture == facep->getTexture() &&
+ (U16) (draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount()) <= (U32) gGLManager.mGLMaxVertexRange &&
+ //draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
+ draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() < 4096 &&
+ draw_vec[idx]->mFullbright == fullbright)
+ {
+ draw_vec[idx]->mCount += facep->getIndicesCount();
+ draw_vec[idx]->mEnd += facep->getGeomCount();
+ }
+ else
+ {
+ U32 start = facep->getGeomIndex();
+ U32 end = start + facep->getGeomCount()-1;
+ U32 offset = facep->getIndicesStart();
+ U32 count = facep->getIndicesCount();
+ LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(),
+ //facep->getTexture(),
+ buffer, object->isSelected(), fullbright);
+
+ draw_vec.push_back(info);
+ //for alpha sorting
+ facep->setDrawInfo(info);
+ }
+ }
+
+ buffer->unmapBuffer();
+ mFaceList.clear();
}
// virtual
void LLVOGrass::updateDrawable(BOOL force_damped)
{
- // Force an immediate rebuild on any update
- if (mDrawable.notNull())
- {
- mDrawable->updateXform(TRUE);
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- }
- clearChanged(SHIFTED);
+ // Force an immediate rebuild on any update
+ if (mDrawable.notNull())
+ {
+ mDrawable->updateXform(TRUE);
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ clearChanged(SHIFTED);
}
-// virtual
+// virtual
BOOL LLVOGrass::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32 *face_hitp,
- LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
-
+ LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
+
{
- BOOL ret = FALSE;
- if (!mbCanSelect ||
- mDrawable->isDead() ||
- !gPipeline.hasRenderType(mDrawable->getRenderType()))
- {
- return FALSE;
- }
-
- LLVector4a dir;
- dir.setSub(end, start);
-
- mPatch = mRegionp->getLand().resolvePatchRegion(getPositionRegion());
-
- LLVector3 position;
- // Create random blades of grass with gaussian distribution
- F32 x,y,xf,yf,dzx,dzy;
-
- LLColor4U color(255,255,255,255);
-
- F32 width = sSpeciesTable[mSpecies]->mBladeSizeX;
- F32 height = sSpeciesTable[mSpecies]->mBladeSizeY;
-
- LLVector2 tc[4];
- LLVector3 v[4];
- //LLVector3 n[4];
-
- F32 closest_t = 1.f;
-
- for (S32 i = 0; i < mNumBlades; i++)
- {
- x = exp_x[i] * mScale.mV[VX];
- y = exp_y[i] * mScale.mV[VY];
- xf = rot_x[i] * GRASS_BLADE_BASE * width * w_mod[i];
- yf = rot_y[i] * GRASS_BLADE_BASE * width * w_mod[i];
- dzx = dz_x [i];
- dzy = dz_y [i];
-
- LLVector3 v1,v2,v3;
- F32 blade_height= GRASS_BLADE_HEIGHT * height * w_mod[i];
-
- tc[0] = LLVector2(0, 0);
- tc[1] = LLVector2(0, 0.98f);
- tc[2] = LLVector2(1, 0);
- tc[3] = LLVector2(1, 0.98f);
-
- position.mV[0] = mPosition.mV[VX] + x + xf;
- position.mV[1] = mPosition.mV[VY] + y + yf;
- position.mV[2] = mRegionp->getLand().resolveHeightRegion(position);
- v[0] = v1 = position + mRegionp->getOriginAgent();
-
-
-
- position.mV[0] += dzx;
- position.mV[1] += dzy;
- position.mV[2] += blade_height;
- v[1] = v2 = position + mRegionp->getOriginAgent();
-
- position.mV[0] = mPosition.mV[VX] + x - xf;
- position.mV[1] = mPosition.mV[VY] + y - xf;
- position.mV[2] = mRegionp->getLand().resolveHeightRegion(position);
- v[2] = v3 = position + mRegionp->getOriginAgent();
-
- LLVector3 normal1 = (v1-v2) % (v2-v3);
- normal1.normalize();
-
- position.mV[0] += dzx;
- position.mV[1] += dzy;
- position.mV[2] += blade_height;
- v[3] = v1 = position + mRegionp->getOriginAgent();
-
- F32 a,b,t;
-
- BOOL hit = FALSE;
-
-
- U32 idx0 = 0,idx1 = 0,idx2 = 0;
-
- LLVector4a v0a,v1a,v2a,v3a;
-
- v0a.load3(v[0].mV);
- v1a.load3(v[1].mV);
- v2a.load3(v[2].mV);
- v3a.load3(v[3].mV);
-
-
- if (LLTriangleRayIntersect(v0a, v1a, v2a, start, dir, a, b, t))
- {
- hit = TRUE;
- idx0 = 0; idx1 = 1; idx2 = 2;
- }
- else if (LLTriangleRayIntersect(v1a, v3a, v2a, start, dir, a, b, t))
- {
- hit = TRUE;
- idx0 = 1; idx1 = 3; idx2 = 2;
- }
- else if (LLTriangleRayIntersect(v2a, v1a, v0a, start, dir, a, b, t))
- {
- normal1 = -normal1;
- hit = TRUE;
- idx0 = 2; idx1 = 1; idx2 = 0;
- }
- else if (LLTriangleRayIntersect(v2a, v3a, v1a, start, dir, a, b, t))
- {
- normal1 = -normal1;
- hit = TRUE;
- idx0 = 2; idx1 = 3; idx2 = 1;
- }
-
- if (hit)
- {
- if (t >= 0.f &&
- t <= 1.f &&
- t < closest_t)
- {
-
- LLVector2 hit_tc = ((1.f - a - b) * tc[idx0] +
- a * tc[idx1] +
- b * tc[idx2]);
- if (pick_transparent ||
- getTEImage(0)->getMask(hit_tc))
- {
- closest_t = t;
- if (intersection != NULL)
- {
- dir.mul(closest_t);
- intersection->setAdd(start, dir);
- }
-
- if (tex_coord != NULL)
- {
- *tex_coord = hit_tc;
- }
-
- if (normal != NULL)
- {
- normal->load3(normal1.mV);
- }
- ret = TRUE;
- }
- }
- }
- }
-
- return ret;
+ BOOL ret = FALSE;
+ if (!mbCanSelect ||
+ mDrawable->isDead() ||
+ !gPipeline.hasRenderType(mDrawable->getRenderType()))
+ {
+ return FALSE;
+ }
+
+ LLVector4a dir;
+ dir.setSub(end, start);
+
+ mPatch = mRegionp->getLand().resolvePatchRegion(getPositionRegion());
+
+ LLVector3 position;
+ // Create random blades of grass with gaussian distribution
+ F32 x,y,xf,yf,dzx,dzy;
+
+ LLColor4U color(255,255,255,255);
+
+ F32 width = sSpeciesTable[mSpecies]->mBladeSizeX;
+ F32 height = sSpeciesTable[mSpecies]->mBladeSizeY;
+
+ LLVector2 tc[4];
+ LLVector3 v[4];
+ //LLVector3 n[4];
+
+ F32 closest_t = 1.f;
+
+ for (S32 i = 0; i < mNumBlades; i++)
+ {
+ x = exp_x[i] * mScale.mV[VX];
+ y = exp_y[i] * mScale.mV[VY];
+ xf = rot_x[i] * GRASS_BLADE_BASE * width * w_mod[i];
+ yf = rot_y[i] * GRASS_BLADE_BASE * width * w_mod[i];
+ dzx = dz_x [i];
+ dzy = dz_y [i];
+
+ LLVector3 v1,v2,v3;
+ F32 blade_height= GRASS_BLADE_HEIGHT * height * w_mod[i];
+
+ tc[0] = LLVector2(0, 0);
+ tc[1] = LLVector2(0, 0.98f);
+ tc[2] = LLVector2(1, 0);
+ tc[3] = LLVector2(1, 0.98f);
+
+ position.mV[0] = mPosition.mV[VX] + x + xf;
+ position.mV[1] = mPosition.mV[VY] + y + yf;
+ position.mV[2] = mRegionp->getLand().resolveHeightRegion(position);
+ v[0] = v1 = position + mRegionp->getOriginAgent();
+
+
+
+ position.mV[0] += dzx;
+ position.mV[1] += dzy;
+ position.mV[2] += blade_height;
+ v[1] = v2 = position + mRegionp->getOriginAgent();
+
+ position.mV[0] = mPosition.mV[VX] + x - xf;
+ position.mV[1] = mPosition.mV[VY] + y - xf;
+ position.mV[2] = mRegionp->getLand().resolveHeightRegion(position);
+ v[2] = v3 = position + mRegionp->getOriginAgent();
+
+ LLVector3 normal1 = (v1-v2) % (v2-v3);
+ normal1.normalize();
+
+ position.mV[0] += dzx;
+ position.mV[1] += dzy;
+ position.mV[2] += blade_height;
+ v[3] = v1 = position + mRegionp->getOriginAgent();
+
+ F32 a,b,t;
+
+ BOOL hit = FALSE;
+
+
+ U32 idx0 = 0,idx1 = 0,idx2 = 0;
+
+ LLVector4a v0a,v1a,v2a,v3a;
+
+ v0a.load3(v[0].mV);
+ v1a.load3(v[1].mV);
+ v2a.load3(v[2].mV);
+ v3a.load3(v[3].mV);
+
+
+ if (LLTriangleRayIntersect(v0a, v1a, v2a, start, dir, a, b, t))
+ {
+ hit = TRUE;
+ idx0 = 0; idx1 = 1; idx2 = 2;
+ }
+ else if (LLTriangleRayIntersect(v1a, v3a, v2a, start, dir, a, b, t))
+ {
+ hit = TRUE;
+ idx0 = 1; idx1 = 3; idx2 = 2;
+ }
+ else if (LLTriangleRayIntersect(v2a, v1a, v0a, start, dir, a, b, t))
+ {
+ normal1 = -normal1;
+ hit = TRUE;
+ idx0 = 2; idx1 = 1; idx2 = 0;
+ }
+ else if (LLTriangleRayIntersect(v2a, v3a, v1a, start, dir, a, b, t))
+ {
+ normal1 = -normal1;
+ hit = TRUE;
+ idx0 = 2; idx1 = 3; idx2 = 1;
+ }
+
+ if (hit)
+ {
+ if (t >= 0.f &&
+ t <= 1.f &&
+ t < closest_t)
+ {
+
+ LLVector2 hit_tc = ((1.f - a - b) * tc[idx0] +
+ a * tc[idx1] +
+ b * tc[idx2]);
+ if (pick_transparent ||
+ getTEImage(0)->getMask(hit_tc))
+ {
+ closest_t = t;
+ if (intersection != NULL)
+ {
+ dir.mul(closest_t);
+ intersection->setAdd(start, dir);
+ }
+
+ if (tex_coord != NULL)
+ {
+ *tex_coord = hit_tc;
+ }
+
+ if (normal != NULL)
+ {
+ normal->load3(normal1.mV);
+ }
+ ret = TRUE;
+ }
+ }
+ }
+ }
+
+ return ret;
}
diff --git a/indra/newview/llvograss.h b/indra/newview/llvograss.h
index 63876dc099..0d52d4b99c 100644
--- a/indra/newview/llvograss.h
+++ b/indra/newview/llvograss.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvograss.h
* @brief Description of LLVOGrass class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,90 +37,90 @@ class LLViewerTexture;
class LLVOGrass : public LLAlphaObject
{
public:
- LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
-
- // Initialize data that's only inited once per class.
- static void initClass();
- static void cleanupClass();
-
- virtual U32 getPartitionType() const;
-
- /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num,
- const EObjectUpdateType update_type,
- LLDataPacker *dp);
- static void import(LLFILE *file, LLMessageSystem *mesgsys, const LLVector3 &pos);
- /*virtual*/ void exportFile(LLFILE *file, const LLVector3 &position);
-
- void updateDrawable(BOOL force_damped);
-
- /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
- /*virtual*/ void getGeometry(S32 idx,
- LLStrider<LLVector4a>& verticesp,
- LLStrider<LLVector3>& normalsp,
- LLStrider<LLVector2>& texcoordsp,
- LLStrider<LLColor4U>& colorsp,
- LLStrider<LLColor4U>& emissivep,
- LLStrider<U16>& indicesp);
-
- void updateFaceSize(S32 idx) { }
- /*virtual*/ void updateTextures();
- /*virtual*/ BOOL updateLOD();
- /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
-
- void plantBlades();
-
- /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
- /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
-
- /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face = -1, // which face to check, -1 = ALL_SIDES
- BOOL pick_transparent = FALSE,
- BOOL pick_rigged = FALSE,
+ LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+
+ // Initialize data that's only inited once per class.
+ static void initClass();
+ static void cleanupClass();
+
+ virtual U32 getPartitionType() const;
+
+ /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
+ void **user_data,
+ U32 block_num,
+ const EObjectUpdateType update_type,
+ LLDataPacker *dp);
+ static void import(LLFILE *file, LLMessageSystem *mesgsys, const LLVector3 &pos);
+ /*virtual*/ void exportFile(LLFILE *file, const LLVector3 &position);
+
+ void updateDrawable(BOOL force_damped);
+
+ /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
+ /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
+ /*virtual*/ void getGeometry(S32 idx,
+ LLStrider<LLVector4a>& verticesp,
+ LLStrider<LLVector3>& normalsp,
+ LLStrider<LLVector2>& texcoordsp,
+ LLStrider<LLColor4U>& colorsp,
+ LLStrider<LLColor4U>& emissivep,
+ LLStrider<U16>& indicesp);
+
+ void updateFaceSize(S32 idx) { }
+ /*virtual*/ void updateTextures();
+ /*virtual*/ BOOL updateLOD();
+ /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
+
+ void plantBlades();
+
+ /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
+ /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
+
+ /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
+ S32 face = -1, // which face to check, -1 = ALL_SIDES
+ BOOL pick_transparent = FALSE,
+ BOOL pick_rigged = FALSE,
BOOL pick_unselectable = TRUE,
- S32* face_hit = NULL, // which face was hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL // return the surface tangent at the intersection point
- );
-
- static S32 sMaxGrassSpecies;
-
- struct GrassSpeciesData
- {
- LLUUID mTextureID;
-
- F32 mBladeSizeX;
- F32 mBladeSizeY;
- };
-
- typedef std::map<U32, GrassSpeciesData*> SpeciesMap;
-
- U8 mSpecies; // Species of grass
- F32 mBladeSizeX;
- F32 mBladeSizeY;
-
- LLSurfacePatch *mPatch; // Stores the land patch where the grass is centered
-
- U64 mLastPatchUpdateTime;
-
- LLVector3 mGrassBend; // Accumulated wind (used for blowing trees)
- LLVector3 mGrassVel;
- LLVector3 mWind;
- F32 mBladeWindAngle;
- F32 mBWAOverlap;
+ S32* face_hit = NULL, // which face was hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL // return the surface tangent at the intersection point
+ );
+
+ static S32 sMaxGrassSpecies;
+
+ struct GrassSpeciesData
+ {
+ LLUUID mTextureID;
+
+ F32 mBladeSizeX;
+ F32 mBladeSizeY;
+ };
+
+ typedef std::map<U32, GrassSpeciesData*> SpeciesMap;
+
+ U8 mSpecies; // Species of grass
+ F32 mBladeSizeX;
+ F32 mBladeSizeY;
+
+ LLSurfacePatch *mPatch; // Stores the land patch where the grass is centered
+
+ U64 mLastPatchUpdateTime;
+
+ LLVector3 mGrassBend; // Accumulated wind (used for blowing trees)
+ LLVector3 mGrassVel;
+ LLVector3 mWind;
+ F32 mBladeWindAngle;
+ F32 mBWAOverlap;
protected:
- ~LLVOGrass();
+ ~LLVOGrass();
private:
- void updateSpecies();
- F32 mLastHeight; // For cheap update hack
- S32 mNumBlades;
+ void updateSpecies();
+ F32 mLastHeight; // For cheap update hack
+ S32 mNumBlades;
- static SpeciesMap sSpeciesTable;
+ static SpeciesMap sSpeciesTable;
};
#endif // LL_VO_GRASS_
diff --git a/indra/newview/llvoicecallhandler.cpp b/indra/newview/llvoicecallhandler.cpp
index 95e11abd82..8c1fa927c6 100644
--- a/indra/newview/llvoicecallhandler.cpp
+++ b/indra/newview/llvoicecallhandler.cpp
@@ -1,68 +1,68 @@
- /**
+ /**
* @file llvoicecallhandler.cpp
* @brief slapp to handle avatar to avatar voice call.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
-#include "llcommandhandler.h"
+#include "llcommandhandler.h"
#include "llavataractions.h"
#include "llnotificationsutil.h"
#include "llui.h"
class LLVoiceCallAvatarHandler : public LLCommandHandler
{
-public:
- // requires trusted browser to trigger
- LLVoiceCallAvatarHandler() : LLCommandHandler("voicecallavatar", UNTRUSTED_THROTTLE)
- {
- }
-
- bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableVoiceCall"))
- {
- LLNotificationsUtil::add("NoVoiceCall", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
+public:
+ // requires trusted browser to trigger
+ LLVoiceCallAvatarHandler() : LLCommandHandler("voicecallavatar", UNTRUSTED_THROTTLE)
+ {
+ }
+
+ bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableVoiceCall"))
+ {
+ LLNotificationsUtil::add("NoVoiceCall", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
+ return true;
+ }
+
+ //Make sure we have some parameters
+ if (params.size() == 0)
+ {
+ return false;
+ }
+
+ //Get the ID
+ LLUUID id;
+ if (!id.set( params[0], FALSE ))
+ {
+ return false;
+ }
- //Make sure we have some parameters
- if (params.size() == 0)
- {
- return false;
- }
-
- //Get the ID
- LLUUID id;
- if (!id.set( params[0], FALSE ))
- {
- return false;
- }
-
- //instigate call with this avatar
- LLAvatarActions::startCall( id );
- return true;
- }
+ //instigate call with this avatar
+ LLAvatarActions::startCall( id );
+ return true;
+ }
};
LLVoiceCallAvatarHandler gVoiceCallAvatarHandler;
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index b0eb8d962c..7ca73a24bf 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvoicechannel.cpp
* @brief Voice Channel related classes
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,552 +54,552 @@ const U32 DEFAULT_RETRIES_COUNT = 3;
//
// LLVoiceChannel
//
-LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& session_name) :
- mSessionID(session_id),
- mState(STATE_NO_CHANNEL_INFO),
- mSessionName(session_name),
- mCallDirection(OUTGOING_CALL),
- mIgnoreNextSessionLeave(FALSE),
- mCallEndedByAgent(false)
+LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& session_name) :
+ mSessionID(session_id),
+ mState(STATE_NO_CHANNEL_INFO),
+ mSessionName(session_name),
+ mCallDirection(OUTGOING_CALL),
+ mIgnoreNextSessionLeave(FALSE),
+ mCallEndedByAgent(false)
{
- mNotifyArgs["VOICE_CHANNEL_NAME"] = mSessionName;
+ mNotifyArgs["VOICE_CHANNEL_NAME"] = mSessionName;
- if (!sVoiceChannelMap.insert(std::make_pair(session_id, this)).second)
- {
- // a voice channel already exists for this session id, so this instance will be orphaned
- // the end result should simply be the failure to make voice calls
- LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
- }
+ if (!sVoiceChannelMap.insert(std::make_pair(session_id, this)).second)
+ {
+ // a voice channel already exists for this session id, so this instance will be orphaned
+ // the end result should simply be the failure to make voice calls
+ LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
+ }
}
LLVoiceChannel::~LLVoiceChannel()
{
- if (sSuspendedVoiceChannel == this)
- {
- sSuspendedVoiceChannel = NULL;
- }
- if (sCurrentVoiceChannel == this)
- {
- sCurrentVoiceChannel = NULL;
- // Must check instance exists here, the singleton MAY have already been destroyed.
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->removeObserver(this);
- }
- }
-
- sVoiceChannelMap.erase(mSessionID);
- sVoiceChannelURIMap.erase(mURI);
+ if (sSuspendedVoiceChannel == this)
+ {
+ sSuspendedVoiceChannel = NULL;
+ }
+ if (sCurrentVoiceChannel == this)
+ {
+ sCurrentVoiceChannel = NULL;
+ // Must check instance exists here, the singleton MAY have already been destroyed.
+ if(LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->removeObserver(this);
+ }
+ }
+
+ sVoiceChannelMap.erase(mSessionID);
+ sVoiceChannelURIMap.erase(mURI);
}
void LLVoiceChannel::setChannelInfo(
- const std::string& uri,
- const std::string& credentials)
-{
- setURI(uri);
-
- mCredentials = credentials;
-
- if (mState == STATE_NO_CHANNEL_INFO)
- {
- if (mURI.empty())
- {
- LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
- LL_WARNS("Voice") << "Received empty URI for channel " << mSessionName << LL_ENDL;
- deactivate();
- }
- else if (mCredentials.empty())
- {
- LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
- LL_WARNS("Voice") << "Received empty credentials for channel " << mSessionName << LL_ENDL;
- deactivate();
- }
- else
- {
- setState(STATE_READY);
-
- // if we are supposed to be active, reconnect
- // this will happen on initial connect, as we request credentials on first use
- if (sCurrentVoiceChannel == this)
- {
- // just in case we got new channel info while active
- // should move over to new channel
- activate();
- }
- }
- }
+ const std::string& uri,
+ const std::string& credentials)
+{
+ setURI(uri);
+
+ mCredentials = credentials;
+
+ if (mState == STATE_NO_CHANNEL_INFO)
+ {
+ if (mURI.empty())
+ {
+ LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
+ LL_WARNS("Voice") << "Received empty URI for channel " << mSessionName << LL_ENDL;
+ deactivate();
+ }
+ else if (mCredentials.empty())
+ {
+ LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
+ LL_WARNS("Voice") << "Received empty credentials for channel " << mSessionName << LL_ENDL;
+ deactivate();
+ }
+ else
+ {
+ setState(STATE_READY);
+
+ // if we are supposed to be active, reconnect
+ // this will happen on initial connect, as we request credentials on first use
+ if (sCurrentVoiceChannel == this)
+ {
+ // just in case we got new channel info while active
+ // should move over to new channel
+ activate();
+ }
+ }
+ }
}
void LLVoiceChannel::onChange(EStatusType type, const std::string &channelURI, bool proximal)
{
- if (channelURI != mURI)
- {
- return;
- }
+ if (channelURI != mURI)
+ {
+ return;
+ }
- if (type < BEGIN_ERROR_STATUS)
- {
- handleStatusChange(type);
- }
- else
- {
- handleError(type);
- }
+ if (type < BEGIN_ERROR_STATUS)
+ {
+ handleStatusChange(type);
+ }
+ else
+ {
+ handleError(type);
+ }
}
void LLVoiceChannel::handleStatusChange(EStatusType type)
{
- // status updates
- switch(type)
- {
- case STATUS_LOGIN_RETRY:
+ // status updates
+ switch(type)
+ {
+ case STATUS_LOGIN_RETRY:
// no user notice
- break;
- case STATUS_LOGGED_IN:
- break;
- case STATUS_LEFT_CHANNEL:
- if (callStarted() && !mIgnoreNextSessionLeave && !sSuspended)
- {
- // if forceably removed from channel
- // update the UI and revert to default channel
- deactivate();
- }
- mIgnoreNextSessionLeave = FALSE;
- break;
- case STATUS_JOINING:
- if (callStarted())
- {
- setState(STATE_RINGING);
- }
- break;
- case STATUS_JOINED:
- if (callStarted())
- {
- setState(STATE_CONNECTED);
- }
- default:
- break;
- }
+ break;
+ case STATUS_LOGGED_IN:
+ break;
+ case STATUS_LEFT_CHANNEL:
+ if (callStarted() && !mIgnoreNextSessionLeave && !sSuspended)
+ {
+ // if forceably removed from channel
+ // update the UI and revert to default channel
+ deactivate();
+ }
+ mIgnoreNextSessionLeave = FALSE;
+ break;
+ case STATUS_JOINING:
+ if (callStarted())
+ {
+ setState(STATE_RINGING);
+ }
+ break;
+ case STATUS_JOINED:
+ if (callStarted())
+ {
+ setState(STATE_CONNECTED);
+ }
+ default:
+ break;
+ }
}
// default behavior is to just deactivate channel
// derived classes provide specific error messages
void LLVoiceChannel::handleError(EStatusType type)
{
- deactivate();
- setState(STATE_ERROR);
+ deactivate();
+ setState(STATE_ERROR);
}
BOOL LLVoiceChannel::isActive()
-{
- // only considered active when currently bound channel matches what our channel
- return callStarted() && LLVoiceClient::getInstance()->getCurrentChannel() == mURI;
+{
+ // only considered active when currently bound channel matches what our channel
+ return callStarted() && LLVoiceClient::getInstance()->getCurrentChannel() == mURI;
}
BOOL LLVoiceChannel::callStarted()
{
- return mState >= STATE_CALL_STARTED;
+ return mState >= STATE_CALL_STARTED;
}
void LLVoiceChannel::deactivate()
{
- if (mState >= STATE_RINGING)
- {
- // ignore session leave event
- mIgnoreNextSessionLeave = TRUE;
- }
-
- if (callStarted())
- {
- setState(STATE_HUNG_UP);
-
- //Default mic is OFF when leaving voice calls
- if (gSavedSettings.getBOOL("AutoDisengageMic") &&
- sCurrentVoiceChannel == this &&
- LLVoiceClient::getInstance()->getUserPTTState())
- {
- gSavedSettings.setBOOL("PTTCurrentlyEnabled", true);
- LLVoiceClient::getInstance()->setUserPTTState(false);
- }
- }
- LLVoiceClient::getInstance()->removeObserver(this);
-
- if (sCurrentVoiceChannel == this)
- {
- // default channel is proximal channel
- sCurrentVoiceChannel = LLVoiceChannelProximal::getInstance();
- sCurrentVoiceChannel->activate();
- }
+ if (mState >= STATE_RINGING)
+ {
+ // ignore session leave event
+ mIgnoreNextSessionLeave = TRUE;
+ }
+
+ if (callStarted())
+ {
+ setState(STATE_HUNG_UP);
+
+ //Default mic is OFF when leaving voice calls
+ if (gSavedSettings.getBOOL("AutoDisengageMic") &&
+ sCurrentVoiceChannel == this &&
+ LLVoiceClient::getInstance()->getUserPTTState())
+ {
+ gSavedSettings.setBOOL("PTTCurrentlyEnabled", true);
+ LLVoiceClient::getInstance()->setUserPTTState(false);
+ }
+ }
+ LLVoiceClient::getInstance()->removeObserver(this);
+
+ if (sCurrentVoiceChannel == this)
+ {
+ // default channel is proximal channel
+ sCurrentVoiceChannel = LLVoiceChannelProximal::getInstance();
+ sCurrentVoiceChannel->activate();
+ }
}
void LLVoiceChannel::activate()
{
- if (callStarted())
- {
- return;
- }
-
- // deactivate old channel and mark ourselves as the active one
- if (sCurrentVoiceChannel != this)
- {
- // mark as current before deactivating the old channel to prevent
- // activating the proximal channel between IM calls
- LLVoiceChannel* old_channel = sCurrentVoiceChannel;
- sCurrentVoiceChannel = this;
- mCallDialogPayload["old_channel_name"] = "";
- if (old_channel)
- {
- mCallDialogPayload["old_channel_name"] = old_channel->getSessionName();
- old_channel->deactivate();
- }
- }
-
- if (mState == STATE_NO_CHANNEL_INFO)
- {
- // responsible for setting status to active
- getChannelInfo();
- }
- else
- {
- setState(STATE_CALL_STARTED);
- }
-
- LLVoiceClient::getInstance()->addObserver(this);
-
- //do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
- sCurrentVoiceChannelChangedSignal(this->mSessionID);
+ if (callStarted())
+ {
+ return;
+ }
+
+ // deactivate old channel and mark ourselves as the active one
+ if (sCurrentVoiceChannel != this)
+ {
+ // mark as current before deactivating the old channel to prevent
+ // activating the proximal channel between IM calls
+ LLVoiceChannel* old_channel = sCurrentVoiceChannel;
+ sCurrentVoiceChannel = this;
+ mCallDialogPayload["old_channel_name"] = "";
+ if (old_channel)
+ {
+ mCallDialogPayload["old_channel_name"] = old_channel->getSessionName();
+ old_channel->deactivate();
+ }
+ }
+
+ if (mState == STATE_NO_CHANNEL_INFO)
+ {
+ // responsible for setting status to active
+ getChannelInfo();
+ }
+ else
+ {
+ setState(STATE_CALL_STARTED);
+ }
+
+ LLVoiceClient::getInstance()->addObserver(this);
+
+ //do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
+ sCurrentVoiceChannelChangedSignal(this->mSessionID);
}
void LLVoiceChannel::getChannelInfo()
{
- // pretend we have everything we need
- if (sCurrentVoiceChannel == this)
- {
- setState(STATE_CALL_STARTED);
- }
+ // pretend we have everything we need
+ if (sCurrentVoiceChannel == this)
+ {
+ setState(STATE_CALL_STARTED);
+ }
}
-//static
+//static
LLVoiceChannel* LLVoiceChannel::getChannelByID(const LLUUID& session_id)
{
- voice_channel_map_t::iterator found_it = sVoiceChannelMap.find(session_id);
- if (found_it == sVoiceChannelMap.end())
- {
- return NULL;
- }
- else
- {
- return found_it->second;
- }
+ voice_channel_map_t::iterator found_it = sVoiceChannelMap.find(session_id);
+ if (found_it == sVoiceChannelMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return found_it->second;
+ }
}
-//static
+//static
LLVoiceChannel* LLVoiceChannel::getChannelByURI(std::string uri)
{
- voice_channel_map_uri_t::iterator found_it = sVoiceChannelURIMap.find(uri);
- if (found_it == sVoiceChannelURIMap.end())
- {
- return NULL;
- }
- else
- {
- return found_it->second;
- }
+ voice_channel_map_uri_t::iterator found_it = sVoiceChannelURIMap.find(uri);
+ if (found_it == sVoiceChannelURIMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return found_it->second;
+ }
}
LLVoiceChannel* LLVoiceChannel::getCurrentVoiceChannel()
{
- return sCurrentVoiceChannel;
+ return sCurrentVoiceChannel;
}
void LLVoiceChannel::updateSessionID(const LLUUID& new_session_id)
{
- sVoiceChannelMap.erase(sVoiceChannelMap.find(mSessionID));
- mSessionID = new_session_id;
- sVoiceChannelMap.insert(std::make_pair(mSessionID, this));
+ sVoiceChannelMap.erase(sVoiceChannelMap.find(mSessionID));
+ mSessionID = new_session_id;
+ sVoiceChannelMap.insert(std::make_pair(mSessionID, this));
}
void LLVoiceChannel::setURI(std::string uri)
{
- sVoiceChannelURIMap.erase(mURI);
- mURI = uri;
- sVoiceChannelURIMap.insert(std::make_pair(mURI, this));
+ sVoiceChannelURIMap.erase(mURI);
+ mURI = uri;
+ sVoiceChannelURIMap.insert(std::make_pair(mURI, this));
}
void LLVoiceChannel::setState(EState state)
{
- switch(state)
- {
- case STATE_RINGING:
- //TODO: remove or redirect this call status notification
-// LLCallInfoDialog::show("ringing", mNotifyArgs);
- break;
- case STATE_CONNECTED:
- //TODO: remove or redirect this call status notification
-// LLCallInfoDialog::show("connected", mNotifyArgs);
- break;
- case STATE_HUNG_UP:
- //TODO: remove or redirect this call status notification
-// LLCallInfoDialog::show("hang_up", mNotifyArgs);
- break;
- default:
- break;
- }
-
- doSetState(state);
+ switch(state)
+ {
+ case STATE_RINGING:
+ //TODO: remove or redirect this call status notification
+// LLCallInfoDialog::show("ringing", mNotifyArgs);
+ break;
+ case STATE_CONNECTED:
+ //TODO: remove or redirect this call status notification
+// LLCallInfoDialog::show("connected", mNotifyArgs);
+ break;
+ case STATE_HUNG_UP:
+ //TODO: remove or redirect this call status notification
+// LLCallInfoDialog::show("hang_up", mNotifyArgs);
+ break;
+ default:
+ break;
+ }
+
+ doSetState(state);
}
void LLVoiceChannel::doSetState(const EState& new_state)
{
- EState old_state = mState;
- mState = new_state;
+ EState old_state = mState;
+ mState = new_state;
- if (!mStateChangedCallback.empty())
- mStateChangedCallback(old_state, mState, mCallDirection, mCallEndedByAgent, mSessionID);
+ if (!mStateChangedCallback.empty())
+ mStateChangedCallback(old_state, mState, mCallDirection, mCallEndedByAgent, mSessionID);
}
//static
void LLVoiceChannel::initClass()
{
- sCurrentVoiceChannel = LLVoiceChannelProximal::getInstance();
+ sCurrentVoiceChannel = LLVoiceChannelProximal::getInstance();
}
-//static
+//static
void LLVoiceChannel::suspend()
{
- if (!sSuspended)
- {
- sSuspendedVoiceChannel = sCurrentVoiceChannel;
- sSuspended = TRUE;
- }
+ if (!sSuspended)
+ {
+ sSuspendedVoiceChannel = sCurrentVoiceChannel;
+ sSuspended = TRUE;
+ }
}
-//static
+//static
void LLVoiceChannel::resume()
{
- if (sSuspended)
- {
- if (LLVoiceClient::getInstance()->voiceEnabled())
- {
- if (sSuspendedVoiceChannel)
- {
- sSuspendedVoiceChannel->activate();
- }
- else
- {
- LLVoiceChannelProximal::getInstance()->activate();
- }
- }
- sSuspended = FALSE;
- }
+ if (sSuspended)
+ {
+ if (LLVoiceClient::getInstance()->voiceEnabled())
+ {
+ if (sSuspendedVoiceChannel)
+ {
+ sSuspendedVoiceChannel->activate();
+ }
+ else
+ {
+ LLVoiceChannelProximal::getInstance()->activate();
+ }
+ }
+ sSuspended = FALSE;
+ }
}
boost::signals2::connection LLVoiceChannel::setCurrentVoiceChannelChangedCallback(channel_changed_callback_t cb, bool at_front)
{
- if (at_front)
- {
- return sCurrentVoiceChannelChangedSignal.connect(cb, boost::signals2::at_front);
- }
- else
- {
- return sCurrentVoiceChannelChangedSignal.connect(cb);
- }
+ if (at_front)
+ {
+ return sCurrentVoiceChannelChangedSignal.connect(cb, boost::signals2::at_front);
+ }
+ else
+ {
+ return sCurrentVoiceChannelChangedSignal.connect(cb);
+ }
}
//
// LLVoiceChannelGroup
//
-LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name) :
- LLVoiceChannel(session_id, session_name)
+LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name) :
+ LLVoiceChannel(session_id, session_name)
{
- mRetries = DEFAULT_RETRIES_COUNT;
- mIsRetrying = FALSE;
+ mRetries = DEFAULT_RETRIES_COUNT;
+ mIsRetrying = FALSE;
}
void LLVoiceChannelGroup::deactivate()
{
- if (callStarted())
- {
- LLVoiceClient::getInstance()->leaveNonSpatialChannel();
- }
- LLVoiceChannel::deactivate();
+ if (callStarted())
+ {
+ LLVoiceClient::getInstance()->leaveNonSpatialChannel();
+ }
+ LLVoiceChannel::deactivate();
}
void LLVoiceChannelGroup::activate()
{
- if (callStarted()) return;
-
- LLVoiceChannel::activate();
-
- if (callStarted())
- {
- // we have the channel info, just need to use it now
- LLVoiceClient::getInstance()->setNonSpatialChannel(
- mURI,
- mCredentials);
-
- if (!gAgent.isInGroup(mSessionID)) // ad-hoc channel
- {
- LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionID);
- // Adding ad-hoc call participants to Recent People List.
- // If it's an outgoing ad-hoc, we can use mInitialTargetIDs that holds IDs of people we
- // called(both online and offline) as source to get people for recent (STORM-210).
- if (session->isOutgoingAdHoc())
- {
- for (uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();
- it!=session->mInitialTargetIDs.end();++it)
- {
- const LLUUID id = *it;
- LLRecentPeople::instance().add(id);
- }
- }
- // If this ad-hoc is incoming then trying to get ids of people from mInitialTargetIDs
- // would lead to EXT-8246. So in this case we get them from speakers list.
- else
- {
- LLIMModel::addSpeakersToRecent(mSessionID);
- }
- }
-
- //Mic default state is OFF on initiating/joining Ad-Hoc/Group calls
- if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
- {
- LLVoiceClient::getInstance()->inputUserControlState(true);
- }
-
- }
+ if (callStarted()) return;
+
+ LLVoiceChannel::activate();
+
+ if (callStarted())
+ {
+ // we have the channel info, just need to use it now
+ LLVoiceClient::getInstance()->setNonSpatialChannel(
+ mURI,
+ mCredentials);
+
+ if (!gAgent.isInGroup(mSessionID)) // ad-hoc channel
+ {
+ LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionID);
+ // Adding ad-hoc call participants to Recent People List.
+ // If it's an outgoing ad-hoc, we can use mInitialTargetIDs that holds IDs of people we
+ // called(both online and offline) as source to get people for recent (STORM-210).
+ if (session->isOutgoingAdHoc())
+ {
+ for (uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();
+ it!=session->mInitialTargetIDs.end();++it)
+ {
+ const LLUUID id = *it;
+ LLRecentPeople::instance().add(id);
+ }
+ }
+ // If this ad-hoc is incoming then trying to get ids of people from mInitialTargetIDs
+ // would lead to EXT-8246. So in this case we get them from speakers list.
+ else
+ {
+ LLIMModel::addSpeakersToRecent(mSessionID);
+ }
+ }
+
+ //Mic default state is OFF on initiating/joining Ad-Hoc/Group calls
+ if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
+ {
+ LLVoiceClient::getInstance()->inputUserControlState(true);
+ }
+
+ }
}
void LLVoiceChannelGroup::getChannelInfo()
{
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
- std::string url = region->getCapability("ChatSessionRequest");
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ std::string url = region->getCapability("ChatSessionRequest");
LLCoros::instance().launch("LLVoiceChannelGroup::voiceCallCapCoro",
boost::bind(&LLVoiceChannelGroup::voiceCallCapCoro, this, url));
- }
+ }
}
void LLVoiceChannelGroup::setChannelInfo(
- const std::string& uri,
- const std::string& credentials)
-{
- setURI(uri);
-
- mCredentials = credentials;
-
- if (mState == STATE_NO_CHANNEL_INFO)
- {
- if(!mURI.empty() && !mCredentials.empty())
- {
- setState(STATE_READY);
-
- // if we are supposed to be active, reconnect
- // this will happen on initial connect, as we request credentials on first use
- if (sCurrentVoiceChannel == this)
- {
- // just in case we got new channel info while active
- // should move over to new channel
- activate();
- }
- }
- else
- {
- //*TODO: notify user
- LL_WARNS("Voice") << "Received invalid credentials for channel " << mSessionName << LL_ENDL;
- deactivate();
- }
- }
- else if ( mIsRetrying )
- {
- // we have the channel info, just need to use it now
- LLVoiceClient::getInstance()->setNonSpatialChannel(
- mURI,
- mCredentials);
- }
+ const std::string& uri,
+ const std::string& credentials)
+{
+ setURI(uri);
+
+ mCredentials = credentials;
+
+ if (mState == STATE_NO_CHANNEL_INFO)
+ {
+ if(!mURI.empty() && !mCredentials.empty())
+ {
+ setState(STATE_READY);
+
+ // if we are supposed to be active, reconnect
+ // this will happen on initial connect, as we request credentials on first use
+ if (sCurrentVoiceChannel == this)
+ {
+ // just in case we got new channel info while active
+ // should move over to new channel
+ activate();
+ }
+ }
+ else
+ {
+ //*TODO: notify user
+ LL_WARNS("Voice") << "Received invalid credentials for channel " << mSessionName << LL_ENDL;
+ deactivate();
+ }
+ }
+ else if ( mIsRetrying )
+ {
+ // we have the channel info, just need to use it now
+ LLVoiceClient::getInstance()->setNonSpatialChannel(
+ mURI,
+ mCredentials);
+ }
}
void LLVoiceChannelGroup::handleStatusChange(EStatusType type)
{
- // status updates
- switch(type)
- {
- case STATUS_JOINED:
- mRetries = 3;
- mIsRetrying = FALSE;
- default:
- break;
- }
+ // status updates
+ switch(type)
+ {
+ case STATUS_JOINED:
+ mRetries = 3;
+ mIsRetrying = FALSE;
+ default:
+ break;
+ }
- LLVoiceChannel::handleStatusChange(type);
+ LLVoiceChannel::handleStatusChange(type);
}
void LLVoiceChannelGroup::handleError(EStatusType status)
{
- std::string notify;
- switch(status)
- {
- case ERROR_CHANNEL_LOCKED:
- case ERROR_CHANNEL_FULL:
- notify = "VoiceChannelFull";
- break;
- case ERROR_NOT_AVAILABLE:
- //clear URI and credentials
- //set the state to be no info
- //and activate
- if ( mRetries > 0 )
- {
- mRetries--;
- mIsRetrying = TRUE;
- mIgnoreNextSessionLeave = TRUE;
-
- getChannelInfo();
- return;
- }
- else
- {
- notify = "VoiceChannelJoinFailed";
- mRetries = DEFAULT_RETRIES_COUNT;
- mIsRetrying = FALSE;
- }
-
- break;
-
- case ERROR_UNKNOWN:
- default:
- break;
- }
-
- // notification
- if (!notify.empty())
- {
- LLNotificationPtr notification = LLNotificationsUtil::add(notify, mNotifyArgs);
- // echo to im window
- gIMMgr->addMessage(mSessionID, LLUUID::null, SYSTEM_FROM, notification->getMessage());
- }
-
- LLVoiceChannel::handleError(status);
+ std::string notify;
+ switch(status)
+ {
+ case ERROR_CHANNEL_LOCKED:
+ case ERROR_CHANNEL_FULL:
+ notify = "VoiceChannelFull";
+ break;
+ case ERROR_NOT_AVAILABLE:
+ //clear URI and credentials
+ //set the state to be no info
+ //and activate
+ if ( mRetries > 0 )
+ {
+ mRetries--;
+ mIsRetrying = TRUE;
+ mIgnoreNextSessionLeave = TRUE;
+
+ getChannelInfo();
+ return;
+ }
+ else
+ {
+ notify = "VoiceChannelJoinFailed";
+ mRetries = DEFAULT_RETRIES_COUNT;
+ mIsRetrying = FALSE;
+ }
+
+ break;
+
+ case ERROR_UNKNOWN:
+ default:
+ break;
+ }
+
+ // notification
+ if (!notify.empty())
+ {
+ LLNotificationPtr notification = LLNotificationsUtil::add(notify, mNotifyArgs);
+ // echo to im window
+ gIMMgr->addMessage(mSessionID, LLUUID::null, SYSTEM_FROM, notification->getMessage());
+ }
+
+ LLVoiceChannel::handleError(status);
}
void LLVoiceChannelGroup::setState(EState state)
{
- switch(state)
- {
- case STATE_RINGING:
- if ( !mIsRetrying )
- {
- //TODO: remove or redirect this call status notification
-// LLCallInfoDialog::show("ringing", mNotifyArgs);
- }
+ switch(state)
+ {
+ case STATE_RINGING:
+ if ( !mIsRetrying )
+ {
+ //TODO: remove or redirect this call status notification
+// LLCallInfoDialog::show("ringing", mNotifyArgs);
+ }
- doSetState(state);
- break;
- default:
- LLVoiceChannel::setState(state);
- }
+ doSetState(state);
+ break;
+ default:
+ LLVoiceChannel::setState(state);
+ }
}
void LLVoiceChannelGroup::voiceCallCapCoro(std::string url)
@@ -665,283 +665,283 @@ void LLVoiceChannelGroup::voiceCallCapCoro(std::string url)
//
// LLVoiceChannelProximal
//
-LLVoiceChannelProximal::LLVoiceChannelProximal() :
- LLVoiceChannel(LLUUID::null, LLStringUtil::null)
+LLVoiceChannelProximal::LLVoiceChannelProximal() :
+ LLVoiceChannel(LLUUID::null, LLStringUtil::null)
{
}
BOOL LLVoiceChannelProximal::isActive()
{
- return callStarted() && LLVoiceClient::getInstance()->inProximalChannel();
+ return callStarted() && LLVoiceClient::getInstance()->inProximalChannel();
}
void LLVoiceChannelProximal::activate()
{
- if (callStarted()) return;
+ if (callStarted()) return;
+
+ if((LLVoiceChannel::sCurrentVoiceChannel != this) && (LLVoiceChannel::getState() == STATE_CONNECTED))
+ {
+ // we're connected to a non-spatial channel, so disconnect.
+ LLVoiceClient::getInstance()->leaveNonSpatialChannel();
+ }
+ LLVoiceChannel::activate();
- if((LLVoiceChannel::sCurrentVoiceChannel != this) && (LLVoiceChannel::getState() == STATE_CONNECTED))
- {
- // we're connected to a non-spatial channel, so disconnect.
- LLVoiceClient::getInstance()->leaveNonSpatialChannel();
- }
- LLVoiceChannel::activate();
-
}
void LLVoiceChannelProximal::onChange(EStatusType type, const std::string &channelURI, bool proximal)
{
- if (!proximal)
- {
- return;
- }
+ if (!proximal)
+ {
+ return;
+ }
- if (type < BEGIN_ERROR_STATUS)
- {
- handleStatusChange(type);
- }
- else
- {
- handleError(type);
- }
+ if (type < BEGIN_ERROR_STATUS)
+ {
+ handleStatusChange(type);
+ }
+ else
+ {
+ handleError(type);
+ }
}
void LLVoiceChannelProximal::handleStatusChange(EStatusType status)
{
- // status updates
- switch(status)
- {
- case STATUS_LEFT_CHANNEL:
- // do not notify user when leaving proximal channel
- return;
- case STATUS_VOICE_DISABLED:
- LLVoiceClient::getInstance()->setUserPTTState(false);
- gAgent.setVoiceConnected(false);
- //skip showing "Voice not available at your current location" when agent voice is disabled (EXT-4749)
- if(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking())
- {
- //TODO: remove or redirect this call status notification
-// LLCallInfoDialog::show("unavailable", mNotifyArgs);
- }
- return;
- default:
- break;
- }
- LLVoiceChannel::handleStatusChange(status);
+ // status updates
+ switch(status)
+ {
+ case STATUS_LEFT_CHANNEL:
+ // do not notify user when leaving proximal channel
+ return;
+ case STATUS_VOICE_DISABLED:
+ LLVoiceClient::getInstance()->setUserPTTState(false);
+ gAgent.setVoiceConnected(false);
+ //skip showing "Voice not available at your current location" when agent voice is disabled (EXT-4749)
+ if(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking())
+ {
+ //TODO: remove or redirect this call status notification
+// LLCallInfoDialog::show("unavailable", mNotifyArgs);
+ }
+ return;
+ default:
+ break;
+ }
+ LLVoiceChannel::handleStatusChange(status);
}
void LLVoiceChannelProximal::handleError(EStatusType status)
{
- std::string notify;
- switch(status)
- {
- case ERROR_CHANNEL_LOCKED:
- case ERROR_CHANNEL_FULL:
- notify = "ProximalVoiceChannelFull";
- break;
- default:
- break;
- }
+ std::string notify;
+ switch(status)
+ {
+ case ERROR_CHANNEL_LOCKED:
+ case ERROR_CHANNEL_FULL:
+ notify = "ProximalVoiceChannelFull";
+ break;
+ default:
+ break;
+ }
- // notification
- if (!notify.empty())
- {
- LLNotificationsUtil::add(notify, mNotifyArgs);
- }
+ // notification
+ if (!notify.empty())
+ {
+ LLNotificationsUtil::add(notify, mNotifyArgs);
+ }
- LLVoiceChannel::handleError(status);
+ LLVoiceChannel::handleError(status);
}
void LLVoiceChannelProximal::deactivate()
{
- if (callStarted())
- {
- setState(STATE_HUNG_UP);
- }
+ if (callStarted())
+ {
+ setState(STATE_HUNG_UP);
+ }
}
//
// LLVoiceChannelP2P
//
-LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string& session_name, const LLUUID& other_user_id) :
- LLVoiceChannelGroup(session_id, session_name),
- mOtherUserID(other_user_id),
- mReceivedCall(FALSE)
+LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string& session_name, const LLUUID& other_user_id) :
+ LLVoiceChannelGroup(session_id, session_name),
+ mOtherUserID(other_user_id),
+ mReceivedCall(FALSE)
{
- // make sure URI reflects encoded version of other user's agent id
- setURI(LLVoiceClient::getInstance()->sipURIFromID(other_user_id));
+ // make sure URI reflects encoded version of other user's agent id
+ setURI(LLVoiceClient::getInstance()->sipURIFromID(other_user_id));
}
void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
{
- LL_INFOS("Voice") << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << LL_ENDL;
-
- // status updates
- switch(type)
- {
- case STATUS_LEFT_CHANNEL:
- if (callStarted() && !mIgnoreNextSessionLeave && !sSuspended)
- {
- // *TODO: use it to show DECLINE voice notification
- if (mState == STATE_RINGING)
- {
- // other user declined call
- LLNotificationsUtil::add("P2PCallDeclined", mNotifyArgs);
- }
- else
- {
- // other user hung up, so we didn't end the call
- mCallEndedByAgent = false;
- }
- deactivate();
- }
- mIgnoreNextSessionLeave = FALSE;
- return;
- case STATUS_JOINING:
- // because we join session we expect to process session leave event in the future. EXT-7371
- // may be this should be done in the LLVoiceChannel::handleStatusChange.
- mIgnoreNextSessionLeave = FALSE;
- break;
-
- default:
- break;
- }
-
- LLVoiceChannel::handleStatusChange(type);
+ LL_INFOS("Voice") << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << LL_ENDL;
+
+ // status updates
+ switch(type)
+ {
+ case STATUS_LEFT_CHANNEL:
+ if (callStarted() && !mIgnoreNextSessionLeave && !sSuspended)
+ {
+ // *TODO: use it to show DECLINE voice notification
+ if (mState == STATE_RINGING)
+ {
+ // other user declined call
+ LLNotificationsUtil::add("P2PCallDeclined", mNotifyArgs);
+ }
+ else
+ {
+ // other user hung up, so we didn't end the call
+ mCallEndedByAgent = false;
+ }
+ deactivate();
+ }
+ mIgnoreNextSessionLeave = FALSE;
+ return;
+ case STATUS_JOINING:
+ // because we join session we expect to process session leave event in the future. EXT-7371
+ // may be this should be done in the LLVoiceChannel::handleStatusChange.
+ mIgnoreNextSessionLeave = FALSE;
+ break;
+
+ default:
+ break;
+ }
+
+ LLVoiceChannel::handleStatusChange(type);
}
void LLVoiceChannelP2P::handleError(EStatusType type)
{
- switch(type)
- {
- case ERROR_NOT_AVAILABLE:
- LLNotificationsUtil::add("P2PCallNoAnswer", mNotifyArgs);
- break;
- default:
- break;
- }
+ switch(type)
+ {
+ case ERROR_NOT_AVAILABLE:
+ LLNotificationsUtil::add("P2PCallNoAnswer", mNotifyArgs);
+ break;
+ default:
+ break;
+ }
- LLVoiceChannel::handleError(type);
+ LLVoiceChannel::handleError(type);
}
void LLVoiceChannelP2P::activate()
{
- if (callStarted()) return;
-
- //call will be counted as ended by user unless this variable is changed in handleStatusChange()
- mCallEndedByAgent = true;
-
- LLVoiceChannel::activate();
-
- if (callStarted())
- {
- // no session handle yet, we're starting the call
- if (mSessionHandle.empty())
- {
- mReceivedCall = FALSE;
- LLVoiceClient::getInstance()->callUser(mOtherUserID);
- }
- // otherwise answering the call
- else
- {
- if (!LLVoiceClient::getInstance()->answerInvite(mSessionHandle))
- {
- mCallEndedByAgent = false;
- mSessionHandle.clear();
- handleError(ERROR_UNKNOWN);
- return;
- }
- // using the session handle invalidates it. Clear it out here so we can't reuse it by accident.
- mSessionHandle.clear();
- }
-
- // Add the party to the list of people with which we've recently interacted.
- addToTheRecentPeopleList();
-
- //Default mic is ON on initiating/joining P2P calls
- if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
- {
- LLVoiceClient::getInstance()->inputUserControlState(true);
- }
- }
+ if (callStarted()) return;
+
+ //call will be counted as ended by user unless this variable is changed in handleStatusChange()
+ mCallEndedByAgent = true;
+
+ LLVoiceChannel::activate();
+
+ if (callStarted())
+ {
+ // no session handle yet, we're starting the call
+ if (mSessionHandle.empty())
+ {
+ mReceivedCall = FALSE;
+ LLVoiceClient::getInstance()->callUser(mOtherUserID);
+ }
+ // otherwise answering the call
+ else
+ {
+ if (!LLVoiceClient::getInstance()->answerInvite(mSessionHandle))
+ {
+ mCallEndedByAgent = false;
+ mSessionHandle.clear();
+ handleError(ERROR_UNKNOWN);
+ return;
+ }
+ // using the session handle invalidates it. Clear it out here so we can't reuse it by accident.
+ mSessionHandle.clear();
+ }
+
+ // Add the party to the list of people with which we've recently interacted.
+ addToTheRecentPeopleList();
+
+ //Default mic is ON on initiating/joining P2P calls
+ if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
+ {
+ LLVoiceClient::getInstance()->inputUserControlState(true);
+ }
+ }
}
void LLVoiceChannelP2P::getChannelInfo()
{
- // pretend we have everything we need, since P2P doesn't use channel info
- if (sCurrentVoiceChannel == this)
- {
- setState(STATE_CALL_STARTED);
- }
+ // pretend we have everything we need, since P2P doesn't use channel info
+ if (sCurrentVoiceChannel == this)
+ {
+ setState(STATE_CALL_STARTED);
+ }
}
// receiving session from other user who initiated call
void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::string &inURI)
-{
- BOOL needs_activate = FALSE;
- if (callStarted())
- {
- // defer to lower agent id when already active
- if (mOtherUserID < gAgent.getID())
- {
- // pretend we haven't started the call yet, so we can connect to this session instead
- deactivate();
- needs_activate = TRUE;
- }
- else
- {
- // we are active and have priority, invite the other user again
- // under the assumption they will join this new session
- mSessionHandle.clear();
- LLVoiceClient::getInstance()->callUser(mOtherUserID);
- return;
- }
- }
-
- mSessionHandle = handle;
-
- // The URI of a p2p session should always be the other end's SIP URI.
- if(!inURI.empty())
- {
- setURI(inURI);
- }
- else
- {
- LL_WARNS("Voice") << "incoming SIP URL is not provided. Channel may not work properly." << LL_ENDL;
- // See LLVoiceClient::sessionAddedEvent()
- setURI(LLVoiceClient::getInstance()->sipURIFromID(mOtherUserID));
- }
-
- mReceivedCall = TRUE;
-
- if (needs_activate)
- {
- activate();
- }
+{
+ BOOL needs_activate = FALSE;
+ if (callStarted())
+ {
+ // defer to lower agent id when already active
+ if (mOtherUserID < gAgent.getID())
+ {
+ // pretend we haven't started the call yet, so we can connect to this session instead
+ deactivate();
+ needs_activate = TRUE;
+ }
+ else
+ {
+ // we are active and have priority, invite the other user again
+ // under the assumption they will join this new session
+ mSessionHandle.clear();
+ LLVoiceClient::getInstance()->callUser(mOtherUserID);
+ return;
+ }
+ }
+
+ mSessionHandle = handle;
+
+ // The URI of a p2p session should always be the other end's SIP URI.
+ if(!inURI.empty())
+ {
+ setURI(inURI);
+ }
+ else
+ {
+ LL_WARNS("Voice") << "incoming SIP URL is not provided. Channel may not work properly." << LL_ENDL;
+ // See LLVoiceClient::sessionAddedEvent()
+ setURI(LLVoiceClient::getInstance()->sipURIFromID(mOtherUserID));
+ }
+
+ mReceivedCall = TRUE;
+
+ if (needs_activate)
+ {
+ activate();
+ }
}
void LLVoiceChannelP2P::setState(EState state)
{
- LL_INFOS("Voice") << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << LL_ENDL;
+ LL_INFOS("Voice") << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << LL_ENDL;
- if (mReceivedCall) // incoming call
- {
- // you only "answer" voice invites in p2p mode
- // so provide a special purpose message here
- if (mReceivedCall && state == STATE_RINGING)
- {
- //TODO: remove or redirect this call status notification
-// LLCallInfoDialog::show("answering", mNotifyArgs);
- doSetState(state);
- return;
- }
- }
+ if (mReceivedCall) // incoming call
+ {
+ // you only "answer" voice invites in p2p mode
+ // so provide a special purpose message here
+ if (mReceivedCall && state == STATE_RINGING)
+ {
+ //TODO: remove or redirect this call status notification
+// LLCallInfoDialog::show("answering", mNotifyArgs);
+ doSetState(state);
+ return;
+ }
+ }
- LLVoiceChannel::setState(state);
+ LLVoiceChannel::setState(state);
}
void LLVoiceChannelP2P::addToTheRecentPeopleList()
{
- LLRecentPeople::instance().add(mOtherUserID);
+ LLRecentPeople::instance().add(mOtherUserID);
}
diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h
index e68bfbe1ff..28651b73ec 100644
--- a/indra/newview/llvoicechannel.h
+++ b/indra/newview/llvoicechannel.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvoicechannel.h
* @brief Voice channel related classes
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,174 +37,174 @@ class LLPanel;
class LLVoiceChannel : public LLVoiceClientStatusObserver
{
public:
- typedef enum e_voice_channel_state
- {
- STATE_NO_CHANNEL_INFO,
- STATE_ERROR,
- STATE_HUNG_UP,
- STATE_READY,
- STATE_CALL_STARTED,
- STATE_RINGING,
- STATE_CONNECTED
- } EState;
-
- typedef enum e_voice_channel_direction
- {
- INCOMING_CALL,
- OUTGOING_CALL
- } EDirection;
-
- typedef boost::signals2::signal<void(const EState& old_state, const EState& new_state, const EDirection& direction, bool ended_by_agent, const LLUUID& session_id)> state_changed_signal_t;
-
- // on current channel changed signal
- typedef boost::function<void(const LLUUID& session_id)> channel_changed_callback_t;
- typedef boost::signals2::signal<void(const LLUUID& session_id)> channel_changed_signal_t;
- static channel_changed_signal_t sCurrentVoiceChannelChangedSignal;
- static boost::signals2::connection setCurrentVoiceChannelChangedCallback(channel_changed_callback_t cb, bool at_front = false);
-
-
- LLVoiceChannel(const LLUUID& session_id, const std::string& session_name);
- virtual ~LLVoiceChannel();
-
- /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
-
- virtual void handleStatusChange(EStatusType status);
- virtual void handleError(EStatusType status);
- virtual void deactivate();
- virtual void activate();
- virtual void setChannelInfo(
- const std::string& uri,
- const std::string& credentials);
- virtual void getChannelInfo();
- virtual BOOL isActive();
- virtual BOOL callStarted();
-
- // Session name is a UI label used for feedback about which person,
- // group, or phone number you are talking to
- const std::string& getSessionName() const { return mSessionName; }
-
- boost::signals2::connection setStateChangedCallback(const state_changed_signal_t::slot_type& callback)
- { return mStateChangedCallback.connect(callback); }
-
- const LLUUID getSessionID() { return mSessionID; }
- EState getState() { return mState; }
-
- void updateSessionID(const LLUUID& new_session_id);
- const LLSD& getNotifyArgs() { return mNotifyArgs; }
-
- void setCallDirection(EDirection direction) {mCallDirection = direction;}
- EDirection getCallDirection() {return mCallDirection;}
-
- static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
- static LLVoiceChannel* getChannelByURI(std::string uri);
- static LLVoiceChannel* getCurrentVoiceChannel();
-
- static void initClass();
-
- static void suspend();
- static void resume();
+ typedef enum e_voice_channel_state
+ {
+ STATE_NO_CHANNEL_INFO,
+ STATE_ERROR,
+ STATE_HUNG_UP,
+ STATE_READY,
+ STATE_CALL_STARTED,
+ STATE_RINGING,
+ STATE_CONNECTED
+ } EState;
+
+ typedef enum e_voice_channel_direction
+ {
+ INCOMING_CALL,
+ OUTGOING_CALL
+ } EDirection;
+
+ typedef boost::signals2::signal<void(const EState& old_state, const EState& new_state, const EDirection& direction, bool ended_by_agent, const LLUUID& session_id)> state_changed_signal_t;
+
+ // on current channel changed signal
+ typedef boost::function<void(const LLUUID& session_id)> channel_changed_callback_t;
+ typedef boost::signals2::signal<void(const LLUUID& session_id)> channel_changed_signal_t;
+ static channel_changed_signal_t sCurrentVoiceChannelChangedSignal;
+ static boost::signals2::connection setCurrentVoiceChannelChangedCallback(channel_changed_callback_t cb, bool at_front = false);
+
+
+ LLVoiceChannel(const LLUUID& session_id, const std::string& session_name);
+ virtual ~LLVoiceChannel();
+
+ /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
+
+ virtual void handleStatusChange(EStatusType status);
+ virtual void handleError(EStatusType status);
+ virtual void deactivate();
+ virtual void activate();
+ virtual void setChannelInfo(
+ const std::string& uri,
+ const std::string& credentials);
+ virtual void getChannelInfo();
+ virtual BOOL isActive();
+ virtual BOOL callStarted();
+
+ // Session name is a UI label used for feedback about which person,
+ // group, or phone number you are talking to
+ const std::string& getSessionName() const { return mSessionName; }
+
+ boost::signals2::connection setStateChangedCallback(const state_changed_signal_t::slot_type& callback)
+ { return mStateChangedCallback.connect(callback); }
+
+ const LLUUID getSessionID() { return mSessionID; }
+ EState getState() { return mState; }
+
+ void updateSessionID(const LLUUID& new_session_id);
+ const LLSD& getNotifyArgs() { return mNotifyArgs; }
+
+ void setCallDirection(EDirection direction) {mCallDirection = direction;}
+ EDirection getCallDirection() {return mCallDirection;}
+
+ static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
+ static LLVoiceChannel* getChannelByURI(std::string uri);
+ static LLVoiceChannel* getCurrentVoiceChannel();
+
+ static void initClass();
+
+ static void suspend();
+ static void resume();
protected:
- virtual void setState(EState state);
- /**
- * Use this method if you want mStateChangedCallback to be executed while state is changed
- */
- void doSetState(const EState& state);
- void setURI(std::string uri);
-
- // there can be two directions INCOMING and OUTGOING
- EDirection mCallDirection;
-
- std::string mURI;
- std::string mCredentials;
- LLUUID mSessionID;
- EState mState;
- std::string mSessionName;
- LLSD mNotifyArgs;
- LLSD mCallDialogPayload;
- // true if call was ended by agent
- bool mCallEndedByAgent;
- BOOL mIgnoreNextSessionLeave;
- LLHandle<LLPanel> mLoginNotificationHandle;
-
- typedef std::map<LLUUID, LLVoiceChannel*> voice_channel_map_t;
- static voice_channel_map_t sVoiceChannelMap;
-
- typedef std::map<std::string, LLVoiceChannel*> voice_channel_map_uri_t;
- static voice_channel_map_uri_t sVoiceChannelURIMap;
-
- static LLVoiceChannel* sCurrentVoiceChannel;
- static LLVoiceChannel* sSuspendedVoiceChannel;
- static BOOL sSuspended;
+ virtual void setState(EState state);
+ /**
+ * Use this method if you want mStateChangedCallback to be executed while state is changed
+ */
+ void doSetState(const EState& state);
+ void setURI(std::string uri);
+
+ // there can be two directions INCOMING and OUTGOING
+ EDirection mCallDirection;
+
+ std::string mURI;
+ std::string mCredentials;
+ LLUUID mSessionID;
+ EState mState;
+ std::string mSessionName;
+ LLSD mNotifyArgs;
+ LLSD mCallDialogPayload;
+ // true if call was ended by agent
+ bool mCallEndedByAgent;
+ BOOL mIgnoreNextSessionLeave;
+ LLHandle<LLPanel> mLoginNotificationHandle;
+
+ typedef std::map<LLUUID, LLVoiceChannel*> voice_channel_map_t;
+ static voice_channel_map_t sVoiceChannelMap;
+
+ typedef std::map<std::string, LLVoiceChannel*> voice_channel_map_uri_t;
+ static voice_channel_map_uri_t sVoiceChannelURIMap;
+
+ static LLVoiceChannel* sCurrentVoiceChannel;
+ static LLVoiceChannel* sSuspendedVoiceChannel;
+ static BOOL sSuspended;
private:
- state_changed_signal_t mStateChangedCallback;
+ state_changed_signal_t mStateChangedCallback;
};
class LLVoiceChannelGroup : public LLVoiceChannel
{
public:
- LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name);
+ LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name);
- /*virtual*/ void handleStatusChange(EStatusType status);
- /*virtual*/ void handleError(EStatusType status);
- /*virtual*/ void activate();
- /*virtual*/ void deactivate();
- /*vritual*/ void setChannelInfo(
- const std::string& uri,
- const std::string& credentials);
- /*virtual*/ void getChannelInfo();
+ /*virtual*/ void handleStatusChange(EStatusType status);
+ /*virtual*/ void handleError(EStatusType status);
+ /*virtual*/ void activate();
+ /*virtual*/ void deactivate();
+ /*vritual*/ void setChannelInfo(
+ const std::string& uri,
+ const std::string& credentials);
+ /*virtual*/ void getChannelInfo();
protected:
- virtual void setState(EState state);
+ virtual void setState(EState state);
private:
void voiceCallCapCoro(std::string url);
- U32 mRetries;
- BOOL mIsRetrying;
+ U32 mRetries;
+ BOOL mIsRetrying;
};
class LLVoiceChannelProximal : public LLVoiceChannel, public LLSingleton<LLVoiceChannelProximal>
{
- LLSINGLETON(LLVoiceChannelProximal);
+ LLSINGLETON(LLVoiceChannelProximal);
public:
- /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal) override;
- /*virtual*/ void handleStatusChange(EStatusType status) override;
- /*virtual*/ void handleError(EStatusType status) override;
- /*virtual*/ BOOL isActive() override;
- /*virtual*/ void activate() override;
- /*virtual*/ void deactivate() override;
+ /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal) override;
+ /*virtual*/ void handleStatusChange(EStatusType status) override;
+ /*virtual*/ void handleError(EStatusType status) override;
+ /*virtual*/ BOOL isActive() override;
+ /*virtual*/ void activate() override;
+ /*virtual*/ void deactivate() override;
};
class LLVoiceChannelP2P : public LLVoiceChannelGroup
{
public:
- LLVoiceChannelP2P(const LLUUID& session_id, const std::string& session_name, const LLUUID& other_user_id);
+ LLVoiceChannelP2P(const LLUUID& session_id, const std::string& session_name, const LLUUID& other_user_id);
- /*virtual*/ void handleStatusChange(EStatusType status) override;
- /*virtual*/ void handleError(EStatusType status) override;
+ /*virtual*/ void handleStatusChange(EStatusType status) override;
+ /*virtual*/ void handleError(EStatusType status) override;
/*virtual*/ void activate() override;
- /*virtual*/ void getChannelInfo() override;
+ /*virtual*/ void getChannelInfo() override;
- void setSessionHandle(const std::string& handle, const std::string &inURI);
+ void setSessionHandle(const std::string& handle, const std::string &inURI);
protected:
- virtual void setState(EState state) override;
+ virtual void setState(EState state) override;
private:
- /**
- * Add the caller to the list of people with which we've recently interacted
- *
- **/
- void addToTheRecentPeopleList();
+ /**
+ * Add the caller to the list of people with which we've recently interacted
+ *
+ **/
+ void addToTheRecentPeopleList();
- std::string mSessionHandle;
- LLUUID mOtherUserID;
- BOOL mReceivedCall;
+ std::string mSessionHandle;
+ LLUUID mOtherUserID;
+ BOOL mReceivedCall;
};
#endif // LL_VOICECHANNEL_H
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 68d9f4ffab..0d882cf49b 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -1,25 +1,25 @@
- /**
+ /**
* @file llvoiceclient.cpp
* @brief Voice client delegation class implementation.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -50,29 +50,29 @@ const F32 LLVoiceClient::VOLUME_MAX = 1.0f;
class LLVoiceHandler : public LLCommandHandler
{
public:
- // requests will be throttled from a non-trusted browser
- LLVoiceHandler() : LLCommandHandler("voice", UNTRUSTED_THROTTLE) {}
-
- bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
- {
- if (params[0].asString() == "effects")
- {
- LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
- // If the voice client doesn't support voice effects, we can't handle effects SLapps
- if (!effect_interface)
- {
- return false;
- }
-
- // Support secondlife:///app/voice/effects/refresh to update the voice effect list with new effects
- if (params[1].asString() == "refresh")
- {
- effect_interface->refreshVoiceEffectLists(false);
- return true;
- }
- }
- return false;
- }
+ // requests will be throttled from a non-trusted browser
+ LLVoiceHandler() : LLCommandHandler("voice", UNTRUSTED_THROTTLE) {}
+
+ bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
+ {
+ if (params[0].asString() == "effects")
+ {
+ LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
+ // If the voice client doesn't support voice effects, we can't handle effects SLapps
+ if (!effect_interface)
+ {
+ return false;
+ }
+
+ // Support secondlife:///app/voice/effects/refresh to update the voice effect list with new effects
+ if (params[1].asString() == "refresh")
+ {
+ effect_interface->refreshVoiceEffectLists(false);
+ return true;
+ }
+ }
+ return false;
+ }
};
LLVoiceHandler gVoiceHandler;
@@ -80,37 +80,37 @@ LLVoiceHandler gVoiceHandler;
std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus)
{
- std::string result = "UNTRANSLATED";
-
- // Prevent copy-paste errors when updating this list...
+ std::string result = "UNTRANSLATED";
+
+ // Prevent copy-paste errors when updating this list...
#define CASE(x) case x: result = #x; break
-
- switch(inStatus)
- {
- CASE(STATUS_LOGIN_RETRY);
- CASE(STATUS_LOGGED_IN);
- CASE(STATUS_JOINING);
- CASE(STATUS_JOINED);
- CASE(STATUS_LEFT_CHANNEL);
- CASE(STATUS_VOICE_DISABLED);
- CASE(STATUS_VOICE_ENABLED);
- CASE(BEGIN_ERROR_STATUS);
- CASE(ERROR_CHANNEL_FULL);
- CASE(ERROR_CHANNEL_LOCKED);
- CASE(ERROR_NOT_AVAILABLE);
- CASE(ERROR_UNKNOWN);
- default:
+
+ switch(inStatus)
+ {
+ CASE(STATUS_LOGIN_RETRY);
+ CASE(STATUS_LOGGED_IN);
+ CASE(STATUS_JOINING);
+ CASE(STATUS_JOINED);
+ CASE(STATUS_LEFT_CHANNEL);
+ CASE(STATUS_VOICE_DISABLED);
+ CASE(STATUS_VOICE_ENABLED);
+ CASE(BEGIN_ERROR_STATUS);
+ CASE(ERROR_CHANNEL_FULL);
+ CASE(ERROR_CHANNEL_LOCKED);
+ CASE(ERROR_NOT_AVAILABLE);
+ CASE(ERROR_UNKNOWN);
+ default:
{
std::ostringstream stream;
stream << "UNKNOWN(" << (int)inStatus << ")";
result = stream.str();
}
- break;
- }
-
+ break;
+ }
+
#undef CASE
-
- return result;
+
+ return result;
}
@@ -118,23 +118,23 @@ std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserv
///////////////////////////////////////////////////////////////////////////////////////////////
LLVoiceClient::LLVoiceClient(LLPumpIO *pump)
- :
- mVoiceModule(NULL),
- m_servicePump(NULL),
- mVoiceEffectEnabled(LLCachedControl<bool>(gSavedSettings, "VoiceMorphingEnabled", true)),
- mVoiceEffectDefault(LLCachedControl<std::string>(gSavedPerAccountSettings, "VoiceEffectDefault", "00000000-0000-0000-0000-000000000000")),
- mPTTDirty(true),
- mPTT(true),
- mUsePTT(true),
- mPTTMouseButton(0),
- mPTTKey(0),
- mPTTIsToggle(false),
- mUserPTTState(false),
- mMuteMic(false),
- mDisableMic(false)
-{
- updateSettings();
- init(pump);
+ :
+ mVoiceModule(NULL),
+ m_servicePump(NULL),
+ mVoiceEffectEnabled(LLCachedControl<bool>(gSavedSettings, "VoiceMorphingEnabled", true)),
+ mVoiceEffectDefault(LLCachedControl<std::string>(gSavedPerAccountSettings, "VoiceEffectDefault", "00000000-0000-0000-0000-000000000000")),
+ mPTTDirty(true),
+ mPTT(true),
+ mUsePTT(true),
+ mPTTMouseButton(0),
+ mPTTKey(0),
+ mPTTIsToggle(false),
+ mUserPTTState(false),
+ mMuteMic(false),
+ mDisableMic(false)
+{
+ updateSettings();
+ init(pump);
}
//---------------------------------------------------
@@ -147,27 +147,27 @@ LLVoiceClient::~LLVoiceClient()
void LLVoiceClient::init(LLPumpIO *pump)
{
- // Initialize all of the voice modules
- m_servicePump = pump;
+ // Initialize all of the voice modules
+ m_servicePump = pump;
}
void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
{
- // In the future, we should change this to allow voice module registration
- // with a table lookup of sorts.
- std::string voice_server = gSavedSettings.getString("VoiceServerType");
- LL_DEBUGS("Voice") << "voice server type " << voice_server << LL_ENDL;
- if(voice_server == "vivox")
- {
- mVoiceModule = (LLVoiceModuleInterface *)LLVivoxVoiceClient::getInstance();
- }
- else
- {
- mVoiceModule = NULL;
- return;
- }
- mVoiceModule->init(m_servicePump);
- mVoiceModule->userAuthorized(user_id, agentID);
+ // In the future, we should change this to allow voice module registration
+ // with a table lookup of sorts.
+ std::string voice_server = gSavedSettings.getString("VoiceServerType");
+ LL_DEBUGS("Voice") << "voice server type " << voice_server << LL_ENDL;
+ if(voice_server == "vivox")
+ {
+ mVoiceModule = (LLVoiceModuleInterface *)LLVivoxVoiceClient::getInstance();
+ }
+ else
+ {
+ mVoiceModule = NULL;
+ return;
+ }
+ mVoiceModule->init(m_servicePump);
+ mVoiceModule->userAuthorized(user_id, agentID);
}
void LLVoiceClient::setHidden(bool hidden)
@@ -180,8 +180,8 @@ void LLVoiceClient::setHidden(bool hidden)
void LLVoiceClient::terminate()
{
- if (mVoiceModule) mVoiceModule->terminate();
- mVoiceModule = NULL;
+ if (mVoiceModule) mVoiceModule->terminate();
+ mVoiceModule = NULL;
m_servicePump = NULL;
// Shutdown speaker volume storage before LLSingletonBase::deleteAll() does it
@@ -193,29 +193,29 @@ void LLVoiceClient::terminate()
const LLVoiceVersionInfo LLVoiceClient::getVersion()
{
- if (mVoiceModule)
- {
- return mVoiceModule->getVersion();
- }
- else
- {
- LLVoiceVersionInfo result;
- result.serverVersion = std::string();
- result.serverType = std::string();
- result.mBuildVersion = std::string();
- return result;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getVersion();
+ }
+ else
+ {
+ LLVoiceVersionInfo result;
+ result.serverVersion = std::string();
+ result.serverType = std::string();
+ result.mBuildVersion = std::string();
+ return result;
+ }
}
void LLVoiceClient::updateSettings()
{
- setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
- setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
- mDisableMic = gSavedSettings.getBOOL("VoiceDisableMic");
+ setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
+ setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
+ mDisableMic = gSavedSettings.getBOOL("VoiceDisableMic");
- updateMicMuteLogic();
+ updateMicMuteLogic();
- if (mVoiceModule)
+ if (mVoiceModule)
{
mVoiceModule->updateSettings();
}
@@ -226,46 +226,46 @@ void LLVoiceClient::updateSettings()
void LLVoiceClient::tuningStart()
{
- if (mVoiceModule) mVoiceModule->tuningStart();
+ if (mVoiceModule) mVoiceModule->tuningStart();
}
void LLVoiceClient::tuningStop()
{
- if (mVoiceModule) mVoiceModule->tuningStop();
+ if (mVoiceModule) mVoiceModule->tuningStop();
}
bool LLVoiceClient::inTuningMode()
{
- if (mVoiceModule)
- {
- return mVoiceModule->inTuningMode();
- }
- else
- {
- return false;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->inTuningMode();
+ }
+ else
+ {
+ return false;
+ }
}
void LLVoiceClient::tuningSetMicVolume(float volume)
{
- if (mVoiceModule) mVoiceModule->tuningSetMicVolume(volume);
+ if (mVoiceModule) mVoiceModule->tuningSetMicVolume(volume);
}
void LLVoiceClient::tuningSetSpeakerVolume(float volume)
{
- if (mVoiceModule) mVoiceModule->tuningSetSpeakerVolume(volume);
+ if (mVoiceModule) mVoiceModule->tuningSetSpeakerVolume(volume);
}
float LLVoiceClient::tuningGetEnergy(void)
{
- if (mVoiceModule)
- {
- return mVoiceModule->tuningGetEnergy();
- }
- else
- {
- return 0.0;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->tuningGetEnergy();
+ }
+ else
+ {
+ return 0.0;
+ }
}
@@ -274,69 +274,69 @@ float LLVoiceClient::tuningGetEnergy(void)
bool LLVoiceClient::deviceSettingsAvailable()
{
- if (mVoiceModule)
- {
- return mVoiceModule->deviceSettingsAvailable();
- }
- else
- {
- return false;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->deviceSettingsAvailable();
+ }
+ else
+ {
+ return false;
+ }
}
bool LLVoiceClient::deviceSettingsUpdated()
{
- if (mVoiceModule)
- {
- return mVoiceModule->deviceSettingsUpdated();
- }
- else
- {
- return false;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->deviceSettingsUpdated();
+ }
+ else
+ {
+ return false;
+ }
}
void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
{
- if (mVoiceModule) mVoiceModule->refreshDeviceLists(clearCurrentList);
+ if (mVoiceModule) mVoiceModule->refreshDeviceLists(clearCurrentList);
}
void LLVoiceClient::setCaptureDevice(const std::string& name)
{
- if (mVoiceModule) mVoiceModule->setCaptureDevice(name);
-
+ if (mVoiceModule) mVoiceModule->setCaptureDevice(name);
+
}
void LLVoiceClient::setRenderDevice(const std::string& name)
{
- if (mVoiceModule) mVoiceModule->setRenderDevice(name);
+ if (mVoiceModule) mVoiceModule->setRenderDevice(name);
}
const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices()
{
- static LLVoiceDeviceList nullCaptureDevices;
- if (mVoiceModule)
- {
- return mVoiceModule->getCaptureDevices();
- }
- else
- {
- return nullCaptureDevices;
- }
+ static LLVoiceDeviceList nullCaptureDevices;
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getCaptureDevices();
+ }
+ else
+ {
+ return nullCaptureDevices;
+ }
}
const LLVoiceDeviceList& LLVoiceClient::getRenderDevices()
{
- static LLVoiceDeviceList nullRenderDevices;
- if (mVoiceModule)
- {
- return mVoiceModule->getRenderDevices();
- }
- else
- {
- return nullRenderDevices;
- }
+ static LLVoiceDeviceList nullRenderDevices;
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getRenderDevices();
+ }
+ else
+ {
+ return nullRenderDevices;
+ }
}
@@ -345,14 +345,14 @@ const LLVoiceDeviceList& LLVoiceClient::getRenderDevices()
void LLVoiceClient::getParticipantList(std::set<LLUUID> &participants)
{
- if (mVoiceModule)
- {
- mVoiceModule->getParticipantList(participants);
- }
- else
- {
- participants = std::set<LLUUID>();
- }
+ if (mVoiceModule)
+ {
+ mVoiceModule->getParticipantList(participants);
+ }
+ else
+ {
+ participants = std::set<LLUUID>();
+ }
}
bool LLVoiceClient::isParticipant(const LLUUID &speaker_id)
@@ -371,48 +371,48 @@ bool LLVoiceClient::isParticipant(const LLUUID &speaker_id)
BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->isSessionTextIMPossible(id);
- }
- else
- {
- return FALSE;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->isSessionTextIMPossible(id);
+ }
+ else
+ {
+ return FALSE;
+ }
}
BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->isSessionCallBackPossible(id);
- }
- else
- {
- return FALSE;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->isSessionCallBackPossible(id);
+ }
+ else
+ {
+ return FALSE;
+ }
}
/* obsolete
BOOL LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
{
- if (mVoiceModule)
- {
- return mVoiceModule->sendTextMessage(participant_id, message);
- }
- else
- {
- return FALSE;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->sendTextMessage(participant_id, message);
+ }
+ else
+ {
+ return FALSE;
+ }
}
*/
void LLVoiceClient::endUserIMSession(const LLUUID& participant_id)
{
- if (mVoiceModule)
- {
- // mVoiceModule->endUserIMSession(participant_id); // A SLim leftover
- }
+ if (mVoiceModule)
+ {
+ // mVoiceModule->endUserIMSession(participant_id); // A SLim leftover
+ }
}
//----------------------------------------------
@@ -420,31 +420,31 @@ void LLVoiceClient::endUserIMSession(const LLUUID& participant_id)
bool LLVoiceClient::inProximalChannel()
{
- if (mVoiceModule)
- {
- return mVoiceModule->inProximalChannel();
- }
- else
- {
- return false;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->inProximalChannel();
+ }
+ else
+ {
+ return false;
+ }
}
void LLVoiceClient::setNonSpatialChannel(
- const std::string &uri,
- const std::string &credentials)
+ const std::string &uri,
+ const std::string &credentials)
{
- if (mVoiceModule)
+ if (mVoiceModule)
{
mVoiceModule->setNonSpatialChannel(uri, credentials);
}
}
void LLVoiceClient::setSpatialChannel(
- const std::string &uri,
- const std::string &credentials)
+ const std::string &uri,
+ const std::string &credentials)
{
- if (mVoiceModule)
+ if (mVoiceModule)
{
mVoiceModule->setSpatialChannel(uri, credentials);
}
@@ -452,7 +452,7 @@ void LLVoiceClient::setSpatialChannel(
void LLVoiceClient::leaveNonSpatialChannel()
{
- if (mVoiceModule)
+ if (mVoiceModule)
{
mVoiceModule->leaveNonSpatialChannel();
}
@@ -460,7 +460,7 @@ void LLVoiceClient::leaveNonSpatialChannel()
void LLVoiceClient::leaveChannel(void)
{
- if (mVoiceModule)
+ if (mVoiceModule)
{
mVoiceModule->leaveChannel();
}
@@ -468,14 +468,14 @@ void LLVoiceClient::leaveChannel(void)
std::string LLVoiceClient::getCurrentChannel()
{
- if (mVoiceModule)
- {
- return mVoiceModule->getCurrentChannel();
- }
- else
- {
- return std::string();
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getCurrentChannel();
+ }
+ else
+ {
+ return std::string();
+ }
}
@@ -484,36 +484,36 @@ std::string LLVoiceClient::getCurrentChannel()
void LLVoiceClient::callUser(const LLUUID &uuid)
{
- if (mVoiceModule) mVoiceModule->callUser(uuid);
+ if (mVoiceModule) mVoiceModule->callUser(uuid);
}
bool LLVoiceClient::isValidChannel(std::string &session_handle)
{
- if (mVoiceModule)
- {
- return mVoiceModule->isValidChannel(session_handle);
- }
- else
- {
- return false;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->isValidChannel(session_handle);
+ }
+ else
+ {
+ return false;
+ }
}
bool LLVoiceClient::answerInvite(std::string &channelHandle)
{
- if (mVoiceModule)
- {
- return mVoiceModule->answerInvite(channelHandle);
- }
- else
- {
- return false;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->answerInvite(channelHandle);
+ }
+ else
+ {
+ return false;
+ }
}
void LLVoiceClient::declineInvite(std::string &channelHandle)
{
- if (mVoiceModule) mVoiceModule->declineInvite(channelHandle);
+ if (mVoiceModule) mVoiceModule->declineInvite(channelHandle);
}
@@ -523,12 +523,12 @@ void LLVoiceClient::declineInvite(std::string &channelHandle)
void LLVoiceClient::setVoiceVolume(F32 volume)
{
- if (mVoiceModule) mVoiceModule->setVoiceVolume(volume);
+ if (mVoiceModule) mVoiceModule->setVoiceVolume(volume);
}
void LLVoiceClient::setMicGain(F32 volume)
{
- if (mVoiceModule) mVoiceModule->setMicGain(volume);
+ if (mVoiceModule) mVoiceModule->setMicGain(volume);
}
@@ -537,19 +537,19 @@ void LLVoiceClient::setMicGain(F32 volume)
bool LLVoiceClient::voiceEnabled()
{
- if (mVoiceModule)
- {
- return mVoiceModule->voiceEnabled();
- }
- else
- {
- return false;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->voiceEnabled();
+ }
+ else
+ {
+ return false;
+ }
}
void LLVoiceClient::setVoiceEnabled(bool enabled)
{
- if (mVoiceModule)
+ if (mVoiceModule)
{
mVoiceModule->setVoiceEnabled(enabled);
}
@@ -557,46 +557,46 @@ void LLVoiceClient::setVoiceEnabled(bool enabled)
void LLVoiceClient::updateMicMuteLogic()
{
- // If not configured to use PTT, the mic should be open (otherwise the user will be unable to speak).
- bool new_mic_mute = false;
-
- if(mUsePTT)
- {
- // If configured to use PTT, track the user state.
- new_mic_mute = !mUserPTTState;
- }
+ // If not configured to use PTT, the mic should be open (otherwise the user will be unable to speak).
+ bool new_mic_mute = false;
+
+ if(mUsePTT)
+ {
+ // If configured to use PTT, track the user state.
+ new_mic_mute = !mUserPTTState;
+ }
+
+ if(mMuteMic || mDisableMic)
+ {
+ // Either of these always overrides any other PTT setting.
+ new_mic_mute = true;
+ }
- if(mMuteMic || mDisableMic)
- {
- // Either of these always overrides any other PTT setting.
- new_mic_mute = true;
- }
-
- if (mVoiceModule) mVoiceModule->setMuteMic(new_mic_mute);
+ if (mVoiceModule) mVoiceModule->setMuteMic(new_mic_mute);
}
void LLVoiceClient::setLipSyncEnabled(BOOL enabled)
{
- if (mVoiceModule) mVoiceModule->setLipSyncEnabled(enabled);
+ if (mVoiceModule) mVoiceModule->setLipSyncEnabled(enabled);
}
BOOL LLVoiceClient::lipSyncEnabled()
{
- if (mVoiceModule)
- {
- return mVoiceModule->lipSyncEnabled();
- }
- else
- {
- return false;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->lipSyncEnabled();
+ }
+ else
+ {
+ return false;
+ }
}
void LLVoiceClient::setMuteMic(bool muted)
{
- mMuteMic = muted;
- updateMicMuteLogic();
- mMicroChangedSignal();
+ mMuteMic = muted;
+ updateMicMuteLogic();
+ mMicroChangedSignal();
}
@@ -605,68 +605,68 @@ void LLVoiceClient::setMuteMic(bool muted)
void LLVoiceClient::setUserPTTState(bool ptt)
{
- if (ptt)
- {
- LLUIUsage::instance().logCommand("Agent.EnableMicrophone");
- }
- mUserPTTState = ptt;
- updateMicMuteLogic();
- mMicroChangedSignal();
+ if (ptt)
+ {
+ LLUIUsage::instance().logCommand("Agent.EnableMicrophone");
+ }
+ mUserPTTState = ptt;
+ updateMicMuteLogic();
+ mMicroChangedSignal();
}
bool LLVoiceClient::getUserPTTState()
{
- return mUserPTTState;
+ return mUserPTTState;
}
void LLVoiceClient::setUsePTT(bool usePTT)
{
- if(usePTT && !mUsePTT)
- {
- // When the user turns on PTT, reset the current state.
- mUserPTTState = false;
- }
- mUsePTT = usePTT;
-
- updateMicMuteLogic();
+ if(usePTT && !mUsePTT)
+ {
+ // When the user turns on PTT, reset the current state.
+ mUserPTTState = false;
+ }
+ mUsePTT = usePTT;
+
+ updateMicMuteLogic();
}
void LLVoiceClient::setPTTIsToggle(bool PTTIsToggle)
{
- if(!PTTIsToggle && mPTTIsToggle)
- {
- // When the user turns off toggle, reset the current state.
- mUserPTTState = false;
- }
-
- mPTTIsToggle = PTTIsToggle;
+ if(!PTTIsToggle && mPTTIsToggle)
+ {
+ // When the user turns off toggle, reset the current state.
+ mUserPTTState = false;
+ }
- updateMicMuteLogic();
+ mPTTIsToggle = PTTIsToggle;
+
+ updateMicMuteLogic();
}
bool LLVoiceClient::getPTTIsToggle()
{
- return mPTTIsToggle;
+ return mPTTIsToggle;
}
void LLVoiceClient::inputUserControlState(bool down)
{
- if(mPTTIsToggle)
- {
- if(down) // toggle open-mic state on 'down'
- {
- toggleUserPTTState();
- }
- }
- else // set open-mic state as an absolute
- {
- setUserPTTState(down);
- }
+ if(mPTTIsToggle)
+ {
+ if(down) // toggle open-mic state on 'down'
+ {
+ toggleUserPTTState();
+ }
+ }
+ else // set open-mic state as an absolute
+ {
+ setUserPTTState(down);
+ }
}
void LLVoiceClient::toggleUserPTTState(void)
{
- setUserPTTState(!getUserPTTState());
+ setUserPTTState(!getUserPTTState());
}
@@ -675,117 +675,117 @@ void LLVoiceClient::toggleUserPTTState(void)
BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->getVoiceEnabled(id);
- }
- else
- {
- return FALSE;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getVoiceEnabled(id);
+ }
+ else
+ {
+ return FALSE;
+ }
}
std::string LLVoiceClient::getDisplayName(const LLUUID& id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->getDisplayName(id);
- }
- else
- {
- return std::string();
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getDisplayName(id);
+ }
+ else
+ {
+ return std::string();
+ }
}
bool LLVoiceClient::isVoiceWorking() const
{
- if (mVoiceModule)
- {
- return mVoiceModule->isVoiceWorking();
- }
- return false;
+ if (mVoiceModule)
+ {
+ return mVoiceModule->isVoiceWorking();
+ }
+ return false;
}
BOOL LLVoiceClient::isParticipantAvatar(const LLUUID& id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->isParticipantAvatar(id);
- }
- else
- {
- return FALSE;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->isParticipantAvatar(id);
+ }
+ else
+ {
+ return FALSE;
+ }
}
BOOL LLVoiceClient::isOnlineSIP(const LLUUID& id)
{
- return FALSE;
+ return FALSE;
}
BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->getIsSpeaking(id);
- }
- else
- {
- return FALSE;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getIsSpeaking(id);
+ }
+ else
+ {
+ return FALSE;
+ }
}
BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->getIsModeratorMuted(id);
- }
- else
- {
- return FALSE;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getIsModeratorMuted(id);
+ }
+ else
+ {
+ return FALSE;
+ }
}
F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
-{
- if (mVoiceModule)
- {
- return mVoiceModule->getCurrentPower(id);
- }
- else
- {
- return 0.0;
- }
+{
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getCurrentPower(id);
+ }
+ else
+ {
+ return 0.0;
+ }
}
BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->getOnMuteList(id);
- }
- else
- {
- return FALSE;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getOnMuteList(id);
+ }
+ else
+ {
+ return FALSE;
+ }
}
F32 LLVoiceClient::getUserVolume(const LLUUID& id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->getUserVolume(id);
- }
- else
- {
- return 0.0;
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->getUserVolume(id);
+ }
+ else
+ {
+ return 0.0;
+ }
}
void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
{
- if (mVoiceModule) mVoiceModule->setUserVolume(id, volume);
+ if (mVoiceModule) mVoiceModule->setUserVolume(id, volume);
}
//--------------------------------------------------
@@ -793,7 +793,7 @@ void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
{
- if (mVoiceModule) mVoiceModule->addObserver(observer);
+ if (mVoiceModule) mVoiceModule->addObserver(observer);
}
void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
@@ -806,7 +806,7 @@ void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
void LLVoiceClient::addObserver(LLFriendObserver* observer)
{
- if (mVoiceModule) mVoiceModule->addObserver(observer);
+ if (mVoiceModule) mVoiceModule->addObserver(observer);
}
void LLVoiceClient::removeObserver(LLFriendObserver* observer)
@@ -819,7 +819,7 @@ void LLVoiceClient::removeObserver(LLFriendObserver* observer)
void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
{
- if (mVoiceModule) mVoiceModule->addObserver(observer);
+ if (mVoiceModule) mVoiceModule->addObserver(observer);
}
void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
@@ -832,19 +832,19 @@ void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
{
- if (mVoiceModule)
- {
- return mVoiceModule->sipURIFromID(id);
- }
- else
- {
- return std::string();
- }
+ if (mVoiceModule)
+ {
+ return mVoiceModule->sipURIFromID(id);
+ }
+ else
+ {
+ return std::string();
+ }
}
LLVoiceEffectInterface* LLVoiceClient::getVoiceEffectInterface() const
{
- return getVoiceEffectEnabled() ? dynamic_cast<LLVoiceEffectInterface*>(mVoiceModule) : NULL;
+ return getVoiceEffectEnabled() ? dynamic_cast<LLVoiceEffectInterface*>(mVoiceModule) : NULL;
}
///////////////////
@@ -852,89 +852,89 @@ LLVoiceEffectInterface* LLVoiceClient::getVoiceEffectInterface() const
class LLViewerRequiredVoiceVersion : public LLHTTPNode
{
- static BOOL sAlertedUser;
- virtual void post(
- LLHTTPNode::ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- //You received this messsage (most likely on region cross or
- //teleport)
- if ( input.has("body") && input["body"].has("major_version") )
- {
- int major_voice_version =
- input["body"]["major_version"].asInteger();
- // int minor_voice_version =
- // input["body"]["minor_version"].asInteger();
- LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion();
-
- if (major_voice_version > 1)
- {
- if (!sAlertedUser)
- {
- //sAlertedUser = TRUE;
- LLNotificationsUtil::add("VoiceVersionMismatch");
- gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
- }
- }
- }
- }
+ static BOOL sAlertedUser;
+ virtual void post(
+ LLHTTPNode::ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ //You received this messsage (most likely on region cross or
+ //teleport)
+ if ( input.has("body") && input["body"].has("major_version") )
+ {
+ int major_voice_version =
+ input["body"]["major_version"].asInteger();
+ // int minor_voice_version =
+ // input["body"]["minor_version"].asInteger();
+ LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion();
+
+ if (major_voice_version > 1)
+ {
+ if (!sAlertedUser)
+ {
+ //sAlertedUser = TRUE;
+ LLNotificationsUtil::add("VoiceVersionMismatch");
+ gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
+ }
+ }
+ }
+ }
};
class LLViewerParcelVoiceInfo : public LLHTTPNode
{
- virtual void post(
- LLHTTPNode::ResponsePtr response,
- const LLSD& context,
- const LLSD& input) const
- {
- //the parcel you are in has changed something about its
- //voice information
-
- //this is a misnomer, as it can also be when you are not in
- //a parcel at all. Should really be something like
- //LLViewerVoiceInfoChanged.....
- if ( input.has("body") )
- {
- LLSD body = input["body"];
-
- //body has "region_name" (str), "parcel_local_id"(int),
- //"voice_credentials" (map).
-
- //body["voice_credentials"] has "channel_uri" (str),
- //body["voice_credentials"] has "channel_credentials" (str)
-
- //if we really wanted to be extra careful,
- //we'd check the supplied
- //local parcel id to make sure it's for the same parcel
- //we believe we're in
- if ( body.has("voice_credentials") )
- {
- LLSD voice_credentials = body["voice_credentials"];
- std::string uri;
- std::string credentials;
-
- if ( voice_credentials.has("channel_uri") )
- {
- uri = voice_credentials["channel_uri"].asString();
- }
- if ( voice_credentials.has("channel_credentials") )
- {
- credentials =
- voice_credentials["channel_credentials"].asString();
- }
-
- LLVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
- }
- }
- }
+ virtual void post(
+ LLHTTPNode::ResponsePtr response,
+ const LLSD& context,
+ const LLSD& input) const
+ {
+ //the parcel you are in has changed something about its
+ //voice information
+
+ //this is a misnomer, as it can also be when you are not in
+ //a parcel at all. Should really be something like
+ //LLViewerVoiceInfoChanged.....
+ if ( input.has("body") )
+ {
+ LLSD body = input["body"];
+
+ //body has "region_name" (str), "parcel_local_id"(int),
+ //"voice_credentials" (map).
+
+ //body["voice_credentials"] has "channel_uri" (str),
+ //body["voice_credentials"] has "channel_credentials" (str)
+
+ //if we really wanted to be extra careful,
+ //we'd check the supplied
+ //local parcel id to make sure it's for the same parcel
+ //we believe we're in
+ if ( body.has("voice_credentials") )
+ {
+ LLSD voice_credentials = body["voice_credentials"];
+ std::string uri;
+ std::string credentials;
+
+ if ( voice_credentials.has("channel_uri") )
+ {
+ uri = voice_credentials["channel_uri"].asString();
+ }
+ if ( voice_credentials.has("channel_credentials") )
+ {
+ credentials =
+ voice_credentials["channel_credentials"].asString();
+ }
+
+ LLVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
+ }
+ }
+ }
};
const std::string LLSpeakerVolumeStorage::SETTINGS_FILE_NAME = "volume_settings.xml";
LLSpeakerVolumeStorage::LLSpeakerVolumeStorage()
{
- load();
+ load();
}
LLSpeakerVolumeStorage::~LLSpeakerVolumeStorage()
@@ -949,150 +949,150 @@ void LLSpeakerVolumeStorage::cleanupSingleton()
void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 volume)
{
- if ((volume >= LLVoiceClient::VOLUME_MIN) && (volume <= LLVoiceClient::VOLUME_MAX))
- {
- mSpeakersData[speaker_id] = volume;
+ if ((volume >= LLVoiceClient::VOLUME_MIN) && (volume <= LLVoiceClient::VOLUME_MAX))
+ {
+ mSpeakersData[speaker_id] = volume;
- // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
- // LL_DEBUGS("Voice") << "Stored volume = " << volume << " for " << id << LL_ENDL;
- }
- else
- {
- LL_WARNS("Voice") << "Attempted to store out of range volume " << volume << " for " << speaker_id << LL_ENDL;
- llassert(0);
- }
+ // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
+ // LL_DEBUGS("Voice") << "Stored volume = " << volume << " for " << id << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Voice") << "Attempted to store out of range volume " << volume << " for " << speaker_id << LL_ENDL;
+ llassert(0);
+ }
}
bool LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id, F32& volume)
{
- speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id);
-
- if (it != mSpeakersData.end())
- {
- volume = it->second;
+ speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id);
- // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
- // LL_DEBUGS("Voice") << "Retrieved stored volume = " << volume << " for " << id << LL_ENDL;
+ if (it != mSpeakersData.end())
+ {
+ volume = it->second;
+
+ // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
+ // LL_DEBUGS("Voice") << "Retrieved stored volume = " << volume << " for " << id << LL_ENDL;
- return true;
- }
+ return true;
+ }
- return false;
+ return false;
}
void LLSpeakerVolumeStorage::removeSpeakerVolume(const LLUUID& speaker_id)
{
- mSpeakersData.erase(speaker_id);
+ mSpeakersData.erase(speaker_id);
- // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
- // LL_DEBUGS("Voice") << "Removing stored volume for " << id << LL_ENDL;
+ // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
+ // LL_DEBUGS("Voice") << "Removing stored volume for " << id << LL_ENDL;
}
/* static */ F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in)
{
- // Convert to linear-logarithmic [0.0..1.0] with 0.5 = 0dB
- // from legacy characteristic composed of two square-curves
- // that intersect at volume_in = 0.5, volume_out = 0.56
+ // Convert to linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+ // from legacy characteristic composed of two square-curves
+ // that intersect at volume_in = 0.5, volume_out = 0.56
- F32 volume_out = 0.f;
- volume_in = llclamp(volume_in, 0.f, 1.0f);
+ F32 volume_out = 0.f;
+ volume_in = llclamp(volume_in, 0.f, 1.0f);
- if (volume_in <= 0.5f)
- {
- volume_out = volume_in * volume_in * 4.f * 0.56f;
- }
- else
- {
- volume_out = (1.f - 0.56f) * (4.f * volume_in * volume_in - 1.f) / 3.f + 0.56f;
- }
+ if (volume_in <= 0.5f)
+ {
+ volume_out = volume_in * volume_in * 4.f * 0.56f;
+ }
+ else
+ {
+ volume_out = (1.f - 0.56f) * (4.f * volume_in * volume_in - 1.f) / 3.f + 0.56f;
+ }
- return volume_out;
+ return volume_out;
}
/* static */ F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in)
{
- // Convert from linear-logarithmic [0.0..1.0] with 0.5 = 0dB
- // to legacy characteristic composed of two square-curves
- // that intersect at volume_in = 0.56, volume_out = 0.5
+ // Convert from linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+ // to legacy characteristic composed of two square-curves
+ // that intersect at volume_in = 0.56, volume_out = 0.5
- F32 volume_out = 0.f;
- volume_in = llclamp(volume_in, 0.f, 1.0f);
+ F32 volume_out = 0.f;
+ volume_in = llclamp(volume_in, 0.f, 1.0f);
- if (volume_in <= 0.56f)
- {
- volume_out = sqrt(volume_in / (4.f * 0.56f));
- }
- else
- {
- volume_out = sqrt((3.f * (volume_in - 0.56f) / (1.f - 0.56f) + 1.f) / 4.f);
- }
+ if (volume_in <= 0.56f)
+ {
+ volume_out = sqrt(volume_in / (4.f * 0.56f));
+ }
+ else
+ {
+ volume_out = sqrt((3.f * (volume_in - 0.56f) / (1.f - 0.56f) + 1.f) / 4.f);
+ }
- return volume_out;
+ return volume_out;
}
void LLSpeakerVolumeStorage::load()
{
- // load per-resident voice volume information
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
+ // load per-resident voice volume information
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
- LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL;
+ LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL;
- LLSD settings_llsd;
- llifstream file;
- file.open(filename.c_str());
- if (file.is_open())
- {
- if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings_llsd, file))
+ LLSD settings_llsd;
+ llifstream file;
+ file.open(filename.c_str());
+ if (file.is_open())
+ {
+ if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings_llsd, file))
{
LL_WARNS("Voice") << "failed to parse " << filename << LL_ENDL;
-
+
}
-
- }
- for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
- iter != settings_llsd.endMap(); ++iter)
- {
- // Maintain compatibility with 1.23 non-linear saved volume levels
- F32 volume = transformFromLegacyVolume((F32)iter->second.asReal());
+ }
+
+ for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
+ iter != settings_llsd.endMap(); ++iter)
+ {
+ // Maintain compatibility with 1.23 non-linear saved volume levels
+ F32 volume = transformFromLegacyVolume((F32)iter->second.asReal());
- storeSpeakerVolume(LLUUID(iter->first), volume);
- }
+ storeSpeakerVolume(LLUUID(iter->first), volume);
+ }
}
void LLSpeakerVolumeStorage::save()
{
- // If we quit from the login screen we will not have an SL account
- // name. Don't try to save, otherwise we'll dump a file in
- // C:\Program Files\SecondLife\ or similar. JC
- std::string user_dir = gDirUtilp->getLindenUserDir();
- if (!user_dir.empty())
- {
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
- LLSD settings_llsd;
+ // If we quit from the login screen we will not have an SL account
+ // name. Don't try to save, otherwise we'll dump a file in
+ // C:\Program Files\SecondLife\ or similar. JC
+ std::string user_dir = gDirUtilp->getLindenUserDir();
+ if (!user_dir.empty())
+ {
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
+ LLSD settings_llsd;
- LL_INFOS("Voice") << "Saving stored speaker volumes to: " << filename << LL_ENDL;
+ LL_INFOS("Voice") << "Saving stored speaker volumes to: " << filename << LL_ENDL;
- for(speaker_data_map_t::const_iterator iter = mSpeakersData.begin(); iter != mSpeakersData.end(); ++iter)
- {
- // Maintain compatibility with 1.23 non-linear saved volume levels
- F32 volume = transformToLegacyVolume(iter->second);
+ for(speaker_data_map_t::const_iterator iter = mSpeakersData.begin(); iter != mSpeakersData.end(); ++iter)
+ {
+ // Maintain compatibility with 1.23 non-linear saved volume levels
+ F32 volume = transformToLegacyVolume(iter->second);
- settings_llsd[iter->first.asString()] = volume;
- }
+ settings_llsd[iter->first.asString()] = volume;
+ }
- llofstream file;
- file.open(filename.c_str());
- LLSDSerialize::toPrettyXML(settings_llsd, file);
- }
+ llofstream file;
+ file.open(filename.c_str());
+ LLSDSerialize::toPrettyXML(settings_llsd, file);
+ }
}
BOOL LLViewerRequiredVoiceVersion::sAlertedUser = FALSE;
LLHTTPRegistration<LLViewerParcelVoiceInfo>
gHTTPRegistrationMessageParcelVoiceInfo(
- "/message/ParcelVoiceInfo");
+ "/message/ParcelVoiceInfo");
LLHTTPRegistration<LLViewerRequiredVoiceVersion>
gHTTPRegistrationMessageRequiredVoiceVersion(
- "/message/RequiredVoiceVersion");
+ "/message/RequiredVoiceVersion");
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index aa67502908..e0ca739034 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvoiceclient.h
* @brief Declaration of LLVoiceClient class which is the interface to the voice client process.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -57,8 +57,8 @@ typedef std::vector<LLVoiceDevice> LLVoiceDeviceList;
class LLVoiceClientParticipantObserver
{
public:
- virtual ~LLVoiceClientParticipantObserver() { }
- virtual void onParticipantsChanged() = 0;
+ virtual ~LLVoiceClientParticipantObserver() { }
+ virtual void onParticipantsChanged() = 0;
};
@@ -67,35 +67,35 @@ public:
class LLVoiceClientStatusObserver
{
public:
- typedef enum e_voice_status_type
- {
- // NOTE: when updating this enum, please also update the switch in
- // LLVoiceClientStatusObserver::status2string().
- STATUS_LOGIN_RETRY,
- STATUS_LOGGED_IN,
- STATUS_JOINING,
- STATUS_JOINED,
- STATUS_LEFT_CHANNEL,
- STATUS_VOICE_DISABLED,
- STATUS_VOICE_ENABLED,
- BEGIN_ERROR_STATUS,
- ERROR_CHANNEL_FULL,
- ERROR_CHANNEL_LOCKED,
- ERROR_NOT_AVAILABLE,
- ERROR_UNKNOWN
- } EStatusType;
-
- virtual ~LLVoiceClientStatusObserver() { }
- virtual void onChange(EStatusType status, const std::string &channelURI, bool proximal) = 0;
-
- static std::string status2string(EStatusType inStatus);
+ typedef enum e_voice_status_type
+ {
+ // NOTE: when updating this enum, please also update the switch in
+ // LLVoiceClientStatusObserver::status2string().
+ STATUS_LOGIN_RETRY,
+ STATUS_LOGGED_IN,
+ STATUS_JOINING,
+ STATUS_JOINED,
+ STATUS_LEFT_CHANNEL,
+ STATUS_VOICE_DISABLED,
+ STATUS_VOICE_ENABLED,
+ BEGIN_ERROR_STATUS,
+ ERROR_CHANNEL_FULL,
+ ERROR_CHANNEL_LOCKED,
+ ERROR_NOT_AVAILABLE,
+ ERROR_UNKNOWN
+ } EStatusType;
+
+ virtual ~LLVoiceClientStatusObserver() { }
+ virtual void onChange(EStatusType status, const std::string &channelURI, bool proximal) = 0;
+
+ static std::string status2string(EStatusType inStatus);
};
struct LLVoiceVersionInfo
{
- std::string serverType;
- std::string serverVersion;
- std::string mBuildVersion;
+ std::string serverType;
+ std::string serverVersion;
+ std::string mBuildVersion;
};
//////////////////////////////////
@@ -108,147 +108,147 @@ struct LLVoiceVersionInfo
class LLVoiceModuleInterface
{
public:
- LLVoiceModuleInterface() {}
- virtual ~LLVoiceModuleInterface() {}
-
- virtual void init(LLPumpIO *pump)=0; // Call this once at application startup (creates connector)
- virtual void terminate()=0; // Call this to clean up during shutdown
-
- virtual void updateSettings()=0; // call after loading settings and whenever they change
-
- virtual bool isVoiceWorking() const = 0; // connected to a voice server and voice channel
-
+ LLVoiceModuleInterface() {}
+ virtual ~LLVoiceModuleInterface() {}
+
+ virtual void init(LLPumpIO *pump)=0; // Call this once at application startup (creates connector)
+ virtual void terminate()=0; // Call this to clean up during shutdown
+
+ virtual void updateSettings()=0; // call after loading settings and whenever they change
+
+ virtual bool isVoiceWorking() const = 0; // connected to a voice server and voice channel
+
virtual void setHidden(bool hidden)=0; // Hides the user from voice.
- virtual const LLVoiceVersionInfo& getVersion()=0;
-
- /////////////////////
- /// @name Tuning
- //@{
- virtual void tuningStart()=0;
- virtual void tuningStop()=0;
- virtual bool inTuningMode()=0;
-
- virtual void tuningSetMicVolume(float volume)=0;
- virtual void tuningSetSpeakerVolume(float volume)=0;
- virtual float tuningGetEnergy(void)=0;
- //@}
-
- /////////////////////
- /// @name Devices
- //@{
- // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
- // i.e. when the daemon is running and connected, and the device lists are populated.
- virtual bool deviceSettingsAvailable()=0;
- virtual bool deviceSettingsUpdated() = 0;
-
- // Requery the vivox daemon for the current list of input/output devices.
- // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
- // (use this if you want to know when it's done).
- // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
- virtual void refreshDeviceLists(bool clearCurrentList = true)=0;
-
- virtual void setCaptureDevice(const std::string& name)=0;
- virtual void setRenderDevice(const std::string& name)=0;
-
- virtual LLVoiceDeviceList& getCaptureDevices()=0;
- virtual LLVoiceDeviceList& getRenderDevices()=0;
-
- virtual void getParticipantList(std::set<LLUUID> &participants)=0;
- virtual bool isParticipant(const LLUUID& speaker_id)=0;
- //@}
-
- ////////////////////////////
- /// @ name Channel stuff
- //@{
- // returns true iff the user is currently in a proximal (local spatial) channel.
- // Note that gestures should only fire if this returns true.
- virtual bool inProximalChannel()=0;
-
- virtual void setNonSpatialChannel(const std::string &uri,
- const std::string &credentials)=0;
-
- virtual bool setSpatialChannel(const std::string &uri,
- const std::string &credentials)=0;
-
- virtual void leaveNonSpatialChannel()=0;
-
- virtual void leaveChannel(void)=0;
-
- // Returns the URI of the current channel, or an empty string if not currently in a channel.
- // NOTE that it will return an empty string if it's in the process of joining a channel.
- virtual std::string getCurrentChannel()=0;
- //@}
-
-
- //////////////////////////
- /// @name invitations
- //@{
- // start a voice channel with the specified user
- virtual void callUser(const LLUUID &uuid)=0;
- virtual bool isValidChannel(std::string& channelHandle)=0;
- virtual bool answerInvite(std::string &channelHandle)=0;
- virtual void declineInvite(std::string &channelHandle)=0;
- //@}
-
- /////////////////////////
- /// @name Volume/gain
- //@{
- virtual void setVoiceVolume(F32 volume)=0;
- virtual void setMicGain(F32 volume)=0;
- //@}
-
- /////////////////////////
- /// @name enable disable voice and features
- //@{
- virtual bool voiceEnabled()=0;
- virtual void setVoiceEnabled(bool enabled)=0;
- virtual void setLipSyncEnabled(BOOL enabled)=0;
- virtual BOOL lipSyncEnabled()=0;
- virtual void setMuteMic(bool muted)=0; // Set the mute state of the local mic.
- //@}
-
- //////////////////////////
- /// @name nearby speaker accessors
- //@{
- virtual BOOL getVoiceEnabled(const LLUUID& id)=0; // true if we've received data for this avatar
- virtual std::string getDisplayName(const LLUUID& id)=0;
- virtual BOOL isParticipantAvatar(const LLUUID &id)=0;
- virtual BOOL getIsSpeaking(const LLUUID& id)=0;
- virtual BOOL getIsModeratorMuted(const LLUUID& id)=0;
- virtual F32 getCurrentPower(const LLUUID& id)=0; // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
- virtual BOOL getOnMuteList(const LLUUID& id)=0;
- virtual F32 getUserVolume(const LLUUID& id)=0;
- virtual void setUserVolume(const LLUUID& id, F32 volume)=0; // set's volume for specified agent, from 0-1 (where .5 is nominal)
- //@}
-
- //////////////////////////
- /// @name text chat
- //@{
- virtual BOOL isSessionTextIMPossible(const LLUUID& id)=0;
- virtual BOOL isSessionCallBackPossible(const LLUUID& id)=0;
- //virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message)=0;
- virtual void endUserIMSession(const LLUUID &uuid)=0;
- //@}
-
- // authorize the user
- virtual void userAuthorized(const std::string& user_id,
- const LLUUID &agentID)=0;
-
- //////////////////////////////
- /// @name Status notification
- //@{
- virtual void addObserver(LLVoiceClientStatusObserver* observer)=0;
- virtual void removeObserver(LLVoiceClientStatusObserver* observer)=0;
- virtual void addObserver(LLFriendObserver* observer)=0;
- virtual void removeObserver(LLFriendObserver* observer)=0;
- virtual void addObserver(LLVoiceClientParticipantObserver* observer)=0;
- virtual void removeObserver(LLVoiceClientParticipantObserver* observer)=0;
- //@}
-
- virtual std::string sipURIFromID(const LLUUID &id)=0;
- //@}
-
+ virtual const LLVoiceVersionInfo& getVersion()=0;
+
+ /////////////////////
+ /// @name Tuning
+ //@{
+ virtual void tuningStart()=0;
+ virtual void tuningStop()=0;
+ virtual bool inTuningMode()=0;
+
+ virtual void tuningSetMicVolume(float volume)=0;
+ virtual void tuningSetSpeakerVolume(float volume)=0;
+ virtual float tuningGetEnergy(void)=0;
+ //@}
+
+ /////////////////////
+ /// @name Devices
+ //@{
+ // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+ // i.e. when the daemon is running and connected, and the device lists are populated.
+ virtual bool deviceSettingsAvailable()=0;
+ virtual bool deviceSettingsUpdated() = 0;
+
+ // Requery the vivox daemon for the current list of input/output devices.
+ // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+ // (use this if you want to know when it's done).
+ // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+ virtual void refreshDeviceLists(bool clearCurrentList = true)=0;
+
+ virtual void setCaptureDevice(const std::string& name)=0;
+ virtual void setRenderDevice(const std::string& name)=0;
+
+ virtual LLVoiceDeviceList& getCaptureDevices()=0;
+ virtual LLVoiceDeviceList& getRenderDevices()=0;
+
+ virtual void getParticipantList(std::set<LLUUID> &participants)=0;
+ virtual bool isParticipant(const LLUUID& speaker_id)=0;
+ //@}
+
+ ////////////////////////////
+ /// @ name Channel stuff
+ //@{
+ // returns true iff the user is currently in a proximal (local spatial) channel.
+ // Note that gestures should only fire if this returns true.
+ virtual bool inProximalChannel()=0;
+
+ virtual void setNonSpatialChannel(const std::string &uri,
+ const std::string &credentials)=0;
+
+ virtual bool setSpatialChannel(const std::string &uri,
+ const std::string &credentials)=0;
+
+ virtual void leaveNonSpatialChannel()=0;
+
+ virtual void leaveChannel(void)=0;
+
+ // Returns the URI of the current channel, or an empty string if not currently in a channel.
+ // NOTE that it will return an empty string if it's in the process of joining a channel.
+ virtual std::string getCurrentChannel()=0;
+ //@}
+
+
+ //////////////////////////
+ /// @name invitations
+ //@{
+ // start a voice channel with the specified user
+ virtual void callUser(const LLUUID &uuid)=0;
+ virtual bool isValidChannel(std::string& channelHandle)=0;
+ virtual bool answerInvite(std::string &channelHandle)=0;
+ virtual void declineInvite(std::string &channelHandle)=0;
+ //@}
+
+ /////////////////////////
+ /// @name Volume/gain
+ //@{
+ virtual void setVoiceVolume(F32 volume)=0;
+ virtual void setMicGain(F32 volume)=0;
+ //@}
+
+ /////////////////////////
+ /// @name enable disable voice and features
+ //@{
+ virtual bool voiceEnabled()=0;
+ virtual void setVoiceEnabled(bool enabled)=0;
+ virtual void setLipSyncEnabled(BOOL enabled)=0;
+ virtual BOOL lipSyncEnabled()=0;
+ virtual void setMuteMic(bool muted)=0; // Set the mute state of the local mic.
+ //@}
+
+ //////////////////////////
+ /// @name nearby speaker accessors
+ //@{
+ virtual BOOL getVoiceEnabled(const LLUUID& id)=0; // true if we've received data for this avatar
+ virtual std::string getDisplayName(const LLUUID& id)=0;
+ virtual BOOL isParticipantAvatar(const LLUUID &id)=0;
+ virtual BOOL getIsSpeaking(const LLUUID& id)=0;
+ virtual BOOL getIsModeratorMuted(const LLUUID& id)=0;
+ virtual F32 getCurrentPower(const LLUUID& id)=0; // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
+ virtual BOOL getOnMuteList(const LLUUID& id)=0;
+ virtual F32 getUserVolume(const LLUUID& id)=0;
+ virtual void setUserVolume(const LLUUID& id, F32 volume)=0; // set's volume for specified agent, from 0-1 (where .5 is nominal)
+ //@}
+
+ //////////////////////////
+ /// @name text chat
+ //@{
+ virtual BOOL isSessionTextIMPossible(const LLUUID& id)=0;
+ virtual BOOL isSessionCallBackPossible(const LLUUID& id)=0;
+ //virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message)=0;
+ virtual void endUserIMSession(const LLUUID &uuid)=0;
+ //@}
+
+ // authorize the user
+ virtual void userAuthorized(const std::string& user_id,
+ const LLUUID &agentID)=0;
+
+ //////////////////////////////
+ /// @name Status notification
+ //@{
+ virtual void addObserver(LLVoiceClientStatusObserver* observer)=0;
+ virtual void removeObserver(LLVoiceClientStatusObserver* observer)=0;
+ virtual void addObserver(LLFriendObserver* observer)=0;
+ virtual void removeObserver(LLFriendObserver* observer)=0;
+ virtual void addObserver(LLVoiceClientParticipantObserver* observer)=0;
+ virtual void removeObserver(LLVoiceClientParticipantObserver* observer)=0;
+ //@}
+
+ virtual std::string sipURIFromID(const LLUUID &id)=0;
+ //@}
+
};
@@ -257,8 +257,8 @@ public:
class LLVoiceEffectObserver
{
public:
- virtual ~LLVoiceEffectObserver() { }
- virtual void onVoiceEffectChanged(bool effect_list_updated) = 0;
+ virtual ~LLVoiceEffectObserver() { }
+ virtual void onVoiceEffectChanged(bool effect_list_updated) = 0;
};
typedef std::multimap<const std::string, const LLUUID, LLDictionaryLess> voice_effect_list_t;
@@ -273,218 +273,218 @@ typedef std::multimap<const std::string, const LLUUID, LLDictionaryLess> voice_e
class LLVoiceEffectInterface
{
public:
- LLVoiceEffectInterface() {}
- virtual ~LLVoiceEffectInterface() {}
-
- //////////////////////////
- /// @name Accessors
- //@{
- virtual bool setVoiceEffect(const LLUUID& id) = 0;
- virtual const LLUUID getVoiceEffect() = 0;
- virtual LLSD getVoiceEffectProperties(const LLUUID& id) = 0;
-
- virtual void refreshVoiceEffectLists(bool clear_lists) = 0;
- virtual const voice_effect_list_t &getVoiceEffectList() const = 0;
- virtual const voice_effect_list_t &getVoiceEffectTemplateList() const = 0;
- //@}
-
- //////////////////////////////
- /// @name Status notification
- //@{
- virtual void addObserver(LLVoiceEffectObserver* observer) = 0;
- virtual void removeObserver(LLVoiceEffectObserver* observer) = 0;
- //@}
-
- //////////////////////////////
- /// @name Preview buffer
- //@{
- virtual void enablePreviewBuffer(bool enable) = 0;
- virtual void recordPreviewBuffer() = 0;
- virtual void playPreviewBuffer(const LLUUID& effect_id = LLUUID::null) = 0;
- virtual void stopPreviewBuffer() = 0;
-
- virtual bool isPreviewRecording() = 0;
- virtual bool isPreviewPlaying() = 0;
- //@}
+ LLVoiceEffectInterface() {}
+ virtual ~LLVoiceEffectInterface() {}
+
+ //////////////////////////
+ /// @name Accessors
+ //@{
+ virtual bool setVoiceEffect(const LLUUID& id) = 0;
+ virtual const LLUUID getVoiceEffect() = 0;
+ virtual LLSD getVoiceEffectProperties(const LLUUID& id) = 0;
+
+ virtual void refreshVoiceEffectLists(bool clear_lists) = 0;
+ virtual const voice_effect_list_t &getVoiceEffectList() const = 0;
+ virtual const voice_effect_list_t &getVoiceEffectTemplateList() const = 0;
+ //@}
+
+ //////////////////////////////
+ /// @name Status notification
+ //@{
+ virtual void addObserver(LLVoiceEffectObserver* observer) = 0;
+ virtual void removeObserver(LLVoiceEffectObserver* observer) = 0;
+ //@}
+
+ //////////////////////////////
+ /// @name Preview buffer
+ //@{
+ virtual void enablePreviewBuffer(bool enable) = 0;
+ virtual void recordPreviewBuffer() = 0;
+ virtual void playPreviewBuffer(const LLUUID& effect_id = LLUUID::null) = 0;
+ virtual void stopPreviewBuffer() = 0;
+
+ virtual bool isPreviewRecording() = 0;
+ virtual bool isPreviewPlaying() = 0;
+ //@}
};
class LLVoiceClient: public LLParamSingleton<LLVoiceClient>
{
- LLSINGLETON(LLVoiceClient, LLPumpIO *pump);
- LOG_CLASS(LLVoiceClient);
- ~LLVoiceClient();
+ LLSINGLETON(LLVoiceClient, LLPumpIO *pump);
+ LOG_CLASS(LLVoiceClient);
+ ~LLVoiceClient();
public:
- typedef boost::signals2::signal<void(void)> micro_changed_signal_t;
- micro_changed_signal_t mMicroChangedSignal;
-
- void terminate(); // Call this to clean up during shutdown
-
- const LLVoiceVersionInfo getVersion();
-
- static const F32 OVERDRIVEN_POWER_LEVEL;
-
- static const F32 VOLUME_MIN;
- static const F32 VOLUME_DEFAULT;
- static const F32 VOLUME_MAX;
-
- void updateSettings(); // call after loading settings and whenever they change
-
- bool isVoiceWorking() const; // connected to a voice server and voice channel
-
- // tuning
- void tuningStart();
- void tuningStop();
- bool inTuningMode();
-
- void tuningSetMicVolume(float volume);
- void tuningSetSpeakerVolume(float volume);
- float tuningGetEnergy(void);
-
- // devices
-
- // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
- // i.e. when the daemon is running and connected, and the device lists are populated.
- bool deviceSettingsAvailable();
- bool deviceSettingsUpdated(); // returns true when the device list has been updated recently.
-
- // Requery the vivox daemon for the current list of input/output devices.
- // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
- // (use this if you want to know when it's done).
- // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
- void refreshDeviceLists(bool clearCurrentList = true);
-
- void setCaptureDevice(const std::string& name);
- void setRenderDevice(const std::string& name);
+ typedef boost::signals2::signal<void(void)> micro_changed_signal_t;
+ micro_changed_signal_t mMicroChangedSignal;
+
+ void terminate(); // Call this to clean up during shutdown
+
+ const LLVoiceVersionInfo getVersion();
+
+ static const F32 OVERDRIVEN_POWER_LEVEL;
+
+ static const F32 VOLUME_MIN;
+ static const F32 VOLUME_DEFAULT;
+ static const F32 VOLUME_MAX;
+
+ void updateSettings(); // call after loading settings and whenever they change
+
+ bool isVoiceWorking() const; // connected to a voice server and voice channel
+
+ // tuning
+ void tuningStart();
+ void tuningStop();
+ bool inTuningMode();
+
+ void tuningSetMicVolume(float volume);
+ void tuningSetSpeakerVolume(float volume);
+ float tuningGetEnergy(void);
+
+ // devices
+
+ // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+ // i.e. when the daemon is running and connected, and the device lists are populated.
+ bool deviceSettingsAvailable();
+ bool deviceSettingsUpdated(); // returns true when the device list has been updated recently.
+
+ // Requery the vivox daemon for the current list of input/output devices.
+ // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+ // (use this if you want to know when it's done).
+ // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+ void refreshDeviceLists(bool clearCurrentList = true);
+
+ void setCaptureDevice(const std::string& name);
+ void setRenderDevice(const std::string& name);
void setHidden(bool hidden);
- const LLVoiceDeviceList& getCaptureDevices();
- const LLVoiceDeviceList& getRenderDevices();
-
- ////////////////////////////
- // Channel stuff
- //
-
- // returns true iff the user is currently in a proximal (local spatial) channel.
- // Note that gestures should only fire if this returns true.
- bool inProximalChannel();
- void setNonSpatialChannel(
- const std::string &uri,
- const std::string &credentials);
- void setSpatialChannel(
- const std::string &uri,
- const std::string &credentials);
- void leaveNonSpatialChannel();
-
- // Returns the URI of the current channel, or an empty string if not currently in a channel.
- // NOTE that it will return an empty string if it's in the process of joining a channel.
- std::string getCurrentChannel();
- // start a voice channel with the specified user
- void callUser(const LLUUID &uuid);
- bool isValidChannel(std::string& channelHandle);
- bool answerInvite(std::string &channelHandle);
- void declineInvite(std::string &channelHandle);
- void leaveChannel(void); // call this on logout or teleport begin
-
-
- /////////////////////////////
- // Sending updates of current state
-
-
- void setVoiceVolume(F32 volume);
- void setMicGain(F32 volume);
- void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)
- bool voiceEnabled();
- void setLipSyncEnabled(BOOL enabled);
- void setMuteMic(bool muted); // Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
- void setUserPTTState(bool ptt);
- bool getUserPTTState();
- void toggleUserPTTState(void);
- void inputUserControlState(bool down); // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
- void setVoiceEnabled(bool enabled);
-
- void setUsePTT(bool usePTT);
- void setPTTIsToggle(bool PTTIsToggle);
- bool getPTTIsToggle();
-
- void updateMicMuteLogic();
-
- BOOL lipSyncEnabled();
-
- boost::signals2::connection MicroChangedCallback(const micro_changed_signal_t::slot_type& cb ) { return mMicroChangedSignal.connect(cb); }
-
-
- /////////////////////////////
- // Accessors for data related to nearby speakers
- BOOL getVoiceEnabled(const LLUUID& id); // true if we've received data for this avatar
- std::string getDisplayName(const LLUUID& id);
- BOOL isOnlineSIP(const LLUUID &id);
- BOOL isParticipantAvatar(const LLUUID &id);
- BOOL getIsSpeaking(const LLUUID& id);
- BOOL getIsModeratorMuted(const LLUUID& id);
- F32 getCurrentPower(const LLUUID& id); // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
- BOOL getOnMuteList(const LLUUID& id);
- F32 getUserVolume(const LLUUID& id);
-
- /////////////////////////////
- BOOL getAreaVoiceDisabled(); // returns true if the area the avatar is in is speech-disabled.
- // Use this to determine whether to show a "no speech" icon in the menu bar.
- void getParticipantList(std::set<LLUUID> &participants);
- bool isParticipant(const LLUUID& speaker_id);
-
- //////////////////////////
- /// @name text chat
- //@{
- BOOL isSessionTextIMPossible(const LLUUID& id);
- BOOL isSessionCallBackPossible(const LLUUID& id);
- //BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return true;} ;
- void endUserIMSession(const LLUUID &uuid);
- //@}
-
-
- void userAuthorized(const std::string& user_id,
- const LLUUID &agentID);
-
- void addObserver(LLVoiceClientStatusObserver* observer);
- void removeObserver(LLVoiceClientStatusObserver* observer);
- void addObserver(LLFriendObserver* observer);
- void removeObserver(LLFriendObserver* observer);
- void addObserver(LLVoiceClientParticipantObserver* observer);
- void removeObserver(LLVoiceClientParticipantObserver* observer);
-
- std::string sipURIFromID(const LLUUID &id);
-
- //////////////////////////
- /// @name Voice effects
- //@{
- bool getVoiceEffectEnabled() const { return mVoiceEffectEnabled; };
- LLUUID getVoiceEffectDefault() const { return LLUUID(mVoiceEffectDefault); };
-
- // Returns NULL if voice effects are not supported, or not enabled.
- LLVoiceEffectInterface* getVoiceEffectInterface() const;
- //@}
+ const LLVoiceDeviceList& getCaptureDevices();
+ const LLVoiceDeviceList& getRenderDevices();
+
+ ////////////////////////////
+ // Channel stuff
+ //
+
+ // returns true iff the user is currently in a proximal (local spatial) channel.
+ // Note that gestures should only fire if this returns true.
+ bool inProximalChannel();
+ void setNonSpatialChannel(
+ const std::string &uri,
+ const std::string &credentials);
+ void setSpatialChannel(
+ const std::string &uri,
+ const std::string &credentials);
+ void leaveNonSpatialChannel();
+
+ // Returns the URI of the current channel, or an empty string if not currently in a channel.
+ // NOTE that it will return an empty string if it's in the process of joining a channel.
+ std::string getCurrentChannel();
+ // start a voice channel with the specified user
+ void callUser(const LLUUID &uuid);
+ bool isValidChannel(std::string& channelHandle);
+ bool answerInvite(std::string &channelHandle);
+ void declineInvite(std::string &channelHandle);
+ void leaveChannel(void); // call this on logout or teleport begin
+
+
+ /////////////////////////////
+ // Sending updates of current state
+
+
+ void setVoiceVolume(F32 volume);
+ void setMicGain(F32 volume);
+ void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)
+ bool voiceEnabled();
+ void setLipSyncEnabled(BOOL enabled);
+ void setMuteMic(bool muted); // Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
+ void setUserPTTState(bool ptt);
+ bool getUserPTTState();
+ void toggleUserPTTState(void);
+ void inputUserControlState(bool down); // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
+ void setVoiceEnabled(bool enabled);
+
+ void setUsePTT(bool usePTT);
+ void setPTTIsToggle(bool PTTIsToggle);
+ bool getPTTIsToggle();
+
+ void updateMicMuteLogic();
+
+ BOOL lipSyncEnabled();
+
+ boost::signals2::connection MicroChangedCallback(const micro_changed_signal_t::slot_type& cb ) { return mMicroChangedSignal.connect(cb); }
+
+
+ /////////////////////////////
+ // Accessors for data related to nearby speakers
+ BOOL getVoiceEnabled(const LLUUID& id); // true if we've received data for this avatar
+ std::string getDisplayName(const LLUUID& id);
+ BOOL isOnlineSIP(const LLUUID &id);
+ BOOL isParticipantAvatar(const LLUUID &id);
+ BOOL getIsSpeaking(const LLUUID& id);
+ BOOL getIsModeratorMuted(const LLUUID& id);
+ F32 getCurrentPower(const LLUUID& id); // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
+ BOOL getOnMuteList(const LLUUID& id);
+ F32 getUserVolume(const LLUUID& id);
+
+ /////////////////////////////
+ BOOL getAreaVoiceDisabled(); // returns true if the area the avatar is in is speech-disabled.
+ // Use this to determine whether to show a "no speech" icon in the menu bar.
+ void getParticipantList(std::set<LLUUID> &participants);
+ bool isParticipant(const LLUUID& speaker_id);
+
+ //////////////////////////
+ /// @name text chat
+ //@{
+ BOOL isSessionTextIMPossible(const LLUUID& id);
+ BOOL isSessionCallBackPossible(const LLUUID& id);
+ //BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return true;} ;
+ void endUserIMSession(const LLUUID &uuid);
+ //@}
+
+
+ void userAuthorized(const std::string& user_id,
+ const LLUUID &agentID);
+
+ void addObserver(LLVoiceClientStatusObserver* observer);
+ void removeObserver(LLVoiceClientStatusObserver* observer);
+ void addObserver(LLFriendObserver* observer);
+ void removeObserver(LLFriendObserver* observer);
+ void addObserver(LLVoiceClientParticipantObserver* observer);
+ void removeObserver(LLVoiceClientParticipantObserver* observer);
+
+ std::string sipURIFromID(const LLUUID &id);
+
+ //////////////////////////
+ /// @name Voice effects
+ //@{
+ bool getVoiceEffectEnabled() const { return mVoiceEffectEnabled; };
+ LLUUID getVoiceEffectDefault() const { return LLUUID(mVoiceEffectDefault); };
+
+ // Returns NULL if voice effects are not supported, or not enabled.
+ LLVoiceEffectInterface* getVoiceEffectInterface() const;
+ //@}
private:
- void init(LLPumpIO *pump);
+ void init(LLPumpIO *pump);
protected:
- LLVoiceModuleInterface* mVoiceModule;
- LLPumpIO *m_servicePump;
-
-
- LLCachedControl<bool> mVoiceEffectEnabled;
- LLCachedControl<std::string> mVoiceEffectDefault;
-
- bool mPTTDirty;
- bool mPTT;
-
- bool mUsePTT;
- S32 mPTTMouseButton;
- KEY mPTTKey;
- bool mPTTIsToggle;
- bool mUserPTTState;
- bool mMuteMic;
- bool mDisableMic;
+ LLVoiceModuleInterface* mVoiceModule;
+ LLPumpIO *m_servicePump;
+
+
+ LLCachedControl<bool> mVoiceEffectEnabled;
+ LLCachedControl<std::string> mVoiceEffectDefault;
+
+ bool mPTTDirty;
+ bool mPTT;
+
+ bool mUsePTT;
+ S32 mPTTMouseButton;
+ KEY mPTTKey;
+ bool mPTTIsToggle;
+ bool mUserPTTState;
+ bool mMuteMic;
+ bool mDisableMic;
};
/**
@@ -492,50 +492,50 @@ protected:
**/
class LLSpeakerVolumeStorage : public LLSingleton<LLSpeakerVolumeStorage>
{
- LLSINGLETON_C11(LLSpeakerVolumeStorage);
- ~LLSpeakerVolumeStorage();
- LOG_CLASS(LLSpeakerVolumeStorage);
+ LLSINGLETON_C11(LLSpeakerVolumeStorage);
+ ~LLSpeakerVolumeStorage();
+ LOG_CLASS(LLSpeakerVolumeStorage);
protected:
virtual void cleanupSingleton() override;
public:
- /**
- * Stores volume level for specified user.
- *
- * @param[in] speaker_id - LLUUID of user to store volume level for.
- * @param[in] volume - volume level to be stored for user.
- */
- void storeSpeakerVolume(const LLUUID& speaker_id, F32 volume);
-
- /**
- * Gets stored volume level for specified speaker
- *
- * @param[in] speaker_id - LLUUID of user to retrieve volume level for.
- * @param[out] volume - set to stored volume if found, otherwise unmodified.
- * @return - true if a stored volume is found.
- */
- bool getSpeakerVolume(const LLUUID& speaker_id, F32& volume);
-
- /**
- * Removes stored volume level for specified user.
- *
- * @param[in] speaker_id - LLUUID of user to remove.
- */
- void removeSpeakerVolume(const LLUUID& speaker_id);
+ /**
+ * Stores volume level for specified user.
+ *
+ * @param[in] speaker_id - LLUUID of user to store volume level for.
+ * @param[in] volume - volume level to be stored for user.
+ */
+ void storeSpeakerVolume(const LLUUID& speaker_id, F32 volume);
+
+ /**
+ * Gets stored volume level for specified speaker
+ *
+ * @param[in] speaker_id - LLUUID of user to retrieve volume level for.
+ * @param[out] volume - set to stored volume if found, otherwise unmodified.
+ * @return - true if a stored volume is found.
+ */
+ bool getSpeakerVolume(const LLUUID& speaker_id, F32& volume);
+
+ /**
+ * Removes stored volume level for specified user.
+ *
+ * @param[in] speaker_id - LLUUID of user to remove.
+ */
+ void removeSpeakerVolume(const LLUUID& speaker_id);
private:
- const static std::string SETTINGS_FILE_NAME;
+ const static std::string SETTINGS_FILE_NAME;
- void load();
- void save();
+ void load();
+ void save();
- static F32 transformFromLegacyVolume(F32 volume_in);
- static F32 transformToLegacyVolume(F32 volume_in);
+ static F32 transformFromLegacyVolume(F32 volume_in);
+ static F32 transformToLegacyVolume(F32 volume_in);
- typedef std::map<LLUUID, F32> speaker_data_map_t;
- speaker_data_map_t mSpeakersData;
+ typedef std::map<LLUUID, F32> speaker_data_map_t;
+ speaker_data_map_t mSpeakersData;
};
#endif //LL_VOICE_CLIENT_H
diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp
index d4dfd16c3b..0374111972 100644
--- a/indra/newview/llvoicevisualizer.cpp
+++ b/indra/newview/llvoicevisualizer.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvoicevisualizer.cpp
* @brief Draws in-world speaking indicators.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -49,24 +49,24 @@
//--------------------------------------------------------------------------------------
// sound symbol constants
//--------------------------------------------------------------------------------------
-const F32 HEIGHT_ABOVE_HEAD = 0.3f; // how many meters vertically above the av's head the voice symbol will appear
-const F32 RED_THRESHOLD = LLVoiceClient::OVERDRIVEN_POWER_LEVEL; // value above which speaking amplitude causes the voice symbol to turn red
-const F32 GREEN_THRESHOLD = 0.2f; // value above which speaking amplitude causes the voice symbol to turn green
-const F32 FADE_OUT_DURATION = 0.4f; // how many seconds it takes for a pair of waves to fade away
-const F32 EXPANSION_RATE = 1.0f; // how many seconds it takes for the waves to expand to twice their original size
-const F32 EXPANSION_MAX = 1.5f; // maximum size scale to which the waves can expand before popping back to 1.0
-const F32 WAVE_WIDTH_SCALE = 0.03f; // base width of the waves
-const F32 WAVE_HEIGHT_SCALE = 0.02f; // base height of the waves
-const F32 BASE_BRIGHTNESS = 0.7f; // gray level of the voice indicator when quiet (below green threshold)
-const F32 DOT_SIZE = 0.05f; // size of the dot billboard texture
-const F32 DOT_OPACITY = 0.7f; // how opaque the dot is
-const F32 WAVE_MOTION_RATE = 1.5f; // scalar applied to consecutive waves as a function of speaking amplitude
+const F32 HEIGHT_ABOVE_HEAD = 0.3f; // how many meters vertically above the av's head the voice symbol will appear
+const F32 RED_THRESHOLD = LLVoiceClient::OVERDRIVEN_POWER_LEVEL; // value above which speaking amplitude causes the voice symbol to turn red
+const F32 GREEN_THRESHOLD = 0.2f; // value above which speaking amplitude causes the voice symbol to turn green
+const F32 FADE_OUT_DURATION = 0.4f; // how many seconds it takes for a pair of waves to fade away
+const F32 EXPANSION_RATE = 1.0f; // how many seconds it takes for the waves to expand to twice their original size
+const F32 EXPANSION_MAX = 1.5f; // maximum size scale to which the waves can expand before popping back to 1.0
+const F32 WAVE_WIDTH_SCALE = 0.03f; // base width of the waves
+const F32 WAVE_HEIGHT_SCALE = 0.02f; // base height of the waves
+const F32 BASE_BRIGHTNESS = 0.7f; // gray level of the voice indicator when quiet (below green threshold)
+const F32 DOT_SIZE = 0.05f; // size of the dot billboard texture
+const F32 DOT_OPACITY = 0.7f; // how opaque the dot is
+const F32 WAVE_MOTION_RATE = 1.5f; // scalar applied to consecutive waves as a function of speaking amplitude
//--------------------------------------------------------------------------------------
// gesticulation constants
//--------------------------------------------------------------------------------------
-const F32 DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE = 0.2f;
-const F32 DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE = 1.0f;
+const F32 DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE = 0.2f;
+const F32 DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE = 1.0f;
//--------------------------------------------------------------------------------------
// other constants
@@ -76,134 +76,134 @@ const LLVector3 WORLD_UPWARD_DIRECTION = LLVector3( 0.0f, 0.0f, 1.0f ); // Z is
//------------------------------------------------------------------
// Initialize the statics
//------------------------------------------------------------------
-bool LLVoiceVisualizer::sPrefsInitialized = false;
-BOOL LLVoiceVisualizer::sLipSyncEnabled = FALSE;
-F32* LLVoiceVisualizer::sOoh = NULL;
-F32* LLVoiceVisualizer::sAah = NULL;
-U32 LLVoiceVisualizer::sOohs = 0;
-U32 LLVoiceVisualizer::sAahs = 0;
-F32 LLVoiceVisualizer::sOohAahRate = 0.0f;
-F32* LLVoiceVisualizer::sOohPowerTransfer = NULL;
-U32 LLVoiceVisualizer::sOohPowerTransfers = 0;
-F32 LLVoiceVisualizer::sOohPowerTransfersf = 0.0f;
-F32* LLVoiceVisualizer::sAahPowerTransfer = NULL;
-U32 LLVoiceVisualizer::sAahPowerTransfers = 0;
-F32 LLVoiceVisualizer::sAahPowerTransfersf = 0.0f;
+bool LLVoiceVisualizer::sPrefsInitialized = false;
+BOOL LLVoiceVisualizer::sLipSyncEnabled = FALSE;
+F32* LLVoiceVisualizer::sOoh = NULL;
+F32* LLVoiceVisualizer::sAah = NULL;
+U32 LLVoiceVisualizer::sOohs = 0;
+U32 LLVoiceVisualizer::sAahs = 0;
+F32 LLVoiceVisualizer::sOohAahRate = 0.0f;
+F32* LLVoiceVisualizer::sOohPowerTransfer = NULL;
+U32 LLVoiceVisualizer::sOohPowerTransfers = 0;
+F32 LLVoiceVisualizer::sOohPowerTransfersf = 0.0f;
+F32* LLVoiceVisualizer::sAahPowerTransfer = NULL;
+U32 LLVoiceVisualizer::sAahPowerTransfers = 0;
+F32 LLVoiceVisualizer::sAahPowerTransfersf = 0.0f;
//-----------------------------------------------
// constructor
//-----------------------------------------------
LLVoiceVisualizer::LLVoiceVisualizer( const U8 type )
- : LLHUDEffect(type)
+ : LLHUDEffect(type)
{
- mCurrentTime = mTimer.getTotalSeconds();
- mPreviousTime = mCurrentTime;
- mStartTime = mCurrentTime;
- mVoiceSourceWorldPosition = LLVector3( 0.0f, 0.0f, 0.0f );
- mSpeakingAmplitude = 0.0f;
- mCurrentlySpeaking = false;
- mVoiceEnabled = false;
- mMinGesticulationAmplitude = DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE;
- mMaxGesticulationAmplitude = DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE;
- mSoundSymbol.mActive = true;
- mSoundSymbol.mPosition = LLVector3( 0.0f, 0.0f, 0.0f );
-
- mTimer.reset();
-
- const char* sound_level_img[] =
- {
- "voice_meter_dot.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c",
- "voice_meter_rings.j2c"
- };
-
- for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++)
- {
- mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
- mSoundSymbol.mTexture [i] = LLViewerTextureManager::getFetchedTextureFromFile(sound_level_img[i], FTT_LOCAL_FILE, FALSE, LLGLTexture::BOOST_UI);
- mSoundSymbol.mWaveActive [i] = false;
- mSoundSymbol.mWaveOpacity [i] = 1.0f;
- mSoundSymbol.mWaveExpansion [i] = 1.0f;
- }
-
- mSoundSymbol.mTexture[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
-
- // The first instance loads the initial state from prefs.
- if (!sPrefsInitialized)
- {
- setPreferences();
-
- // Set up our listener to get updates on all prefs values we care about.
- gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncOohAahRate")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncOoh")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncAah")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncOohPowerTransfer")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
- gSavedSettings.getControl("LipSyncAahPowerTransfer")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
-
- sPrefsInitialized = true;
- }
+ mCurrentTime = mTimer.getTotalSeconds();
+ mPreviousTime = mCurrentTime;
+ mStartTime = mCurrentTime;
+ mVoiceSourceWorldPosition = LLVector3( 0.0f, 0.0f, 0.0f );
+ mSpeakingAmplitude = 0.0f;
+ mCurrentlySpeaking = false;
+ mVoiceEnabled = false;
+ mMinGesticulationAmplitude = DEFAULT_MINIMUM_GESTICULATION_AMPLITUDE;
+ mMaxGesticulationAmplitude = DEFAULT_MAXIMUM_GESTICULATION_AMPLITUDE;
+ mSoundSymbol.mActive = true;
+ mSoundSymbol.mPosition = LLVector3( 0.0f, 0.0f, 0.0f );
+
+ mTimer.reset();
+
+ const char* sound_level_img[] =
+ {
+ "voice_meter_dot.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c",
+ "voice_meter_rings.j2c"
+ };
+
+ for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++)
+ {
+ mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
+ mSoundSymbol.mTexture [i] = LLViewerTextureManager::getFetchedTextureFromFile(sound_level_img[i], FTT_LOCAL_FILE, FALSE, LLGLTexture::BOOST_UI);
+ mSoundSymbol.mWaveActive [i] = false;
+ mSoundSymbol.mWaveOpacity [i] = 1.0f;
+ mSoundSymbol.mWaveExpansion [i] = 1.0f;
+ }
+
+ mSoundSymbol.mTexture[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
+
+ // The first instance loads the initial state from prefs.
+ if (!sPrefsInitialized)
+ {
+ setPreferences();
+
+ // Set up our listener to get updates on all prefs values we care about.
+ gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncOohAahRate")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncOoh")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncAah")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncOohPowerTransfer")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+ gSavedSettings.getControl("LipSyncAahPowerTransfer")->getSignal()->connect(boost::bind(&LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged, _2));
+
+ sPrefsInitialized = true;
+ }
}//---------------------------------------------------
//---------------------------------------------------
void LLVoiceVisualizer::setMinGesticulationAmplitude( F32 m )
{
- mMinGesticulationAmplitude = m;
+ mMinGesticulationAmplitude = m;
}//---------------------------------------------------
//---------------------------------------------------
void LLVoiceVisualizer::setMaxGesticulationAmplitude( F32 m )
{
- mMaxGesticulationAmplitude = m;
+ mMaxGesticulationAmplitude = m;
}//---------------------------------------------------
//---------------------------------------------------
void LLVoiceVisualizer::setVoiceEnabled( bool v )
{
- mVoiceEnabled = v;
+ mVoiceEnabled = v;
}//---------------------------------------------------
//---------------------------------------------------
void LLVoiceVisualizer::setStartSpeaking()
{
- mStartTime = mTimer.getTotalSeconds();
- mCurrentlySpeaking = true;
- mSoundSymbol.mActive = true;
-
+ mStartTime = mTimer.getTotalSeconds();
+ mCurrentlySpeaking = true;
+ mSoundSymbol.mActive = true;
+
}//---------------------------------------------------
//---------------------------------------------------
bool LLVoiceVisualizer::getCurrentlySpeaking()
{
- return mCurrentlySpeaking;
-
+ return mCurrentlySpeaking;
+
}//---------------------------------------------------
//---------------------------------------------------
void LLVoiceVisualizer::setStopSpeaking()
{
- mCurrentlySpeaking = false;
- mSpeakingAmplitude = 0.0f;
-
+ mCurrentlySpeaking = false;
+ mSpeakingAmplitude = 0.0f;
+
}//---------------------------------------------------
//---------------------------------------------------
void LLVoiceVisualizer::setSpeakingAmplitude( F32 a )
{
- mSpeakingAmplitude = a;
-
+ mSpeakingAmplitude = a;
+
}//---------------------------------------------------
//------------------------------------------------------------------
@@ -211,30 +211,30 @@ void LLVoiceVisualizer::setSpeakingAmplitude( F32 a )
//------------------------------------------------------------------
bool LLVoiceVisualizer::handleVoiceVisualizerPrefsChanged(const LLSD& newvalue)
{
- // Note: Ignore the specific event value, we look up the ones we want
- LLVoiceVisualizer::setPreferences();
- return true;
+ // Note: Ignore the specific event value, we look up the ones we want
+ LLVoiceVisualizer::setPreferences();
+ return true;
}
//---------------------------------------------------
void LLVoiceVisualizer::setPreferences( )
{
- sLipSyncEnabled = gSavedSettings.getBOOL("LipSyncEnabled");
- sOohAahRate = gSavedSettings.getF32("LipSyncOohAahRate");
+ sLipSyncEnabled = gSavedSettings.getBOOL("LipSyncEnabled");
+ sOohAahRate = gSavedSettings.getF32("LipSyncOohAahRate");
- std::string oohString = gSavedSettings.getString("LipSyncOoh");
- lipStringToF32s (oohString, sOoh, sOohs);
+ std::string oohString = gSavedSettings.getString("LipSyncOoh");
+ lipStringToF32s (oohString, sOoh, sOohs);
- std::string aahString = gSavedSettings.getString("LipSyncAah");
- lipStringToF32s (aahString, sAah, sAahs);
+ std::string aahString = gSavedSettings.getString("LipSyncAah");
+ lipStringToF32s (aahString, sAah, sAahs);
- std::string oohPowerString = gSavedSettings.getString("LipSyncOohPowerTransfer");
- lipStringToF32s (oohPowerString, sOohPowerTransfer, sOohPowerTransfers);
- sOohPowerTransfersf = (F32) sOohPowerTransfers;
+ std::string oohPowerString = gSavedSettings.getString("LipSyncOohPowerTransfer");
+ lipStringToF32s (oohPowerString, sOohPowerTransfer, sOohPowerTransfers);
+ sOohPowerTransfersf = (F32) sOohPowerTransfers;
- std::string aahPowerString = gSavedSettings.getString("LipSyncAahPowerTransfer");
- lipStringToF32s (aahPowerString, sAahPowerTransfer, sAahPowerTransfers);
- sAahPowerTransfersf = (F32) sAahPowerTransfers;
+ std::string aahPowerString = gSavedSettings.getString("LipSyncAahPowerTransfer");
+ lipStringToF32s (aahPowerString, sAahPowerTransfer, sAahPowerTransfers);
+ sAahPowerTransfersf = (F32) sAahPowerTransfers;
}//---------------------------------------------------
@@ -246,35 +246,35 @@ void LLVoiceVisualizer::setPreferences( )
//---------------------------------------------------
void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s, U32& count_F32s )
{
- delete[] out_F32s; // get rid of the current array
-
- count_F32s = in_string.length();
- if (count_F32s == 0)
- {
- // we don't like zero length arrays
-
- count_F32s = 1;
- out_F32s = new F32[1];
- out_F32s[0] = 0.0f;
- }
- else
- {
- out_F32s = new F32[count_F32s];
-
- for (U32 i=0; i<count_F32s; i++)
- {
- // we convert the characters 0 to 9 to their numeric value
- // anything else we take the low order four bits with a ceiling of 9
-
- U8 digit = in_string[i];
- U8 four_bits = digit % 16;
- if (four_bits > 9)
- {
- four_bits = 9;
- }
- out_F32s[i] = 0.11f * (F32) four_bits;
- }
- }
+ delete[] out_F32s; // get rid of the current array
+
+ count_F32s = in_string.length();
+ if (count_F32s == 0)
+ {
+ // we don't like zero length arrays
+
+ count_F32s = 1;
+ out_F32s = new F32[1];
+ out_F32s[0] = 0.0f;
+ }
+ else
+ {
+ out_F32s = new F32[count_F32s];
+
+ for (U32 i=0; i<count_F32s; i++)
+ {
+ // we convert the characters 0 to 9 to their numeric value
+ // anything else we take the low order four bits with a ceiling of 9
+
+ U8 digit = in_string[i];
+ U8 four_bits = digit % 16;
+ if (four_bits > 9)
+ {
+ four_bits = 9;
+ }
+ out_F32s[i] = 0.11f * (F32) four_bits;
+ }
+ }
}//---------------------------------------------------
@@ -284,51 +284,51 @@ void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s
//--------------------------------------------------------------------------
void LLVoiceVisualizer::lipSyncOohAah( F32& ooh, F32& aah )
{
- if( ( sLipSyncEnabled == TRUE ) && mCurrentlySpeaking )
- {
- U32 transfer_index = (U32) (sOohPowerTransfersf * mSpeakingAmplitude);
- if (transfer_index >= sOohPowerTransfers)
- {
- transfer_index = sOohPowerTransfers - 1;
- }
- F32 transfer_ooh = sOohPowerTransfer[transfer_index];
-
- transfer_index = (U32) (sAahPowerTransfersf * mSpeakingAmplitude);
- if (transfer_index >= sAahPowerTransfers)
- {
- transfer_index = sAahPowerTransfers - 1;
- }
- F32 transfer_aah = sAahPowerTransfer[transfer_index];
-
- F64 current_time = mTimer.getTotalSeconds();
- F64 elapsed_time = current_time - mStartTime;
- U32 elapsed_frames = (U32) (elapsed_time * sOohAahRate);
- U32 elapsed_oohs = elapsed_frames % sOohs;
- U32 elapsed_aahs = elapsed_frames % sAahs;
-
- ooh = transfer_ooh * sOoh[elapsed_oohs];
- aah = transfer_aah * sAah[elapsed_aahs];
-
- /*
- LL_INFOS() << " elapsed frames " << elapsed_frames
- << " ooh " << ooh
- << " aah " << aah
- << " transfer ooh" << transfer_ooh
- << " transfer aah" << transfer_aah
- << " start time " << mStartTime
- << " current time " << current_time
- << " elapsed time " << elapsed_time
- << " elapsed oohs " << elapsed_oohs
- << " elapsed aahs " << elapsed_aahs
- << LL_ENDL;
- */
- }
- else
- {
- ooh = 0.0f;
- aah = 0.0f;
- }
-
+ if( ( sLipSyncEnabled == TRUE ) && mCurrentlySpeaking )
+ {
+ U32 transfer_index = (U32) (sOohPowerTransfersf * mSpeakingAmplitude);
+ if (transfer_index >= sOohPowerTransfers)
+ {
+ transfer_index = sOohPowerTransfers - 1;
+ }
+ F32 transfer_ooh = sOohPowerTransfer[transfer_index];
+
+ transfer_index = (U32) (sAahPowerTransfersf * mSpeakingAmplitude);
+ if (transfer_index >= sAahPowerTransfers)
+ {
+ transfer_index = sAahPowerTransfers - 1;
+ }
+ F32 transfer_aah = sAahPowerTransfer[transfer_index];
+
+ F64 current_time = mTimer.getTotalSeconds();
+ F64 elapsed_time = current_time - mStartTime;
+ U32 elapsed_frames = (U32) (elapsed_time * sOohAahRate);
+ U32 elapsed_oohs = elapsed_frames % sOohs;
+ U32 elapsed_aahs = elapsed_frames % sAahs;
+
+ ooh = transfer_ooh * sOoh[elapsed_oohs];
+ aah = transfer_aah * sAah[elapsed_aahs];
+
+ /*
+ LL_INFOS() << " elapsed frames " << elapsed_frames
+ << " ooh " << ooh
+ << " aah " << aah
+ << " transfer ooh" << transfer_ooh
+ << " transfer aah" << transfer_aah
+ << " start time " << mStartTime
+ << " current time " << current_time
+ << " elapsed time " << elapsed_time
+ << " elapsed oohs " << elapsed_oohs
+ << " elapsed aahs " << elapsed_aahs
+ << LL_ENDL;
+ */
+ }
+ else
+ {
+ ooh = 0.0f;
+ aah = 0.0f;
+ }
+
}//---------------------------------------------------
@@ -337,217 +337,217 @@ void LLVoiceVisualizer::lipSyncOohAah( F32& ooh, F32& aah )
//---------------------------------------------------
void LLVoiceVisualizer::render()
{
- if ( ! mVoiceEnabled )
- {
- return;
- }
-
- if ( mSoundSymbol.mActive )
- {
- mPreviousTime = mCurrentTime;
- mCurrentTime = mTimer.getTotalSeconds();
-
- //---------------------------------------------------------------
- // set the sound symbol position over the source (avatar's head)
- //---------------------------------------------------------------
+ if ( ! mVoiceEnabled )
+ {
+ return;
+ }
+
+ if ( mSoundSymbol.mActive )
+ {
+ mPreviousTime = mCurrentTime;
+ mCurrentTime = mTimer.getTotalSeconds();
+
+ //---------------------------------------------------------------
+ // set the sound symbol position over the source (avatar's head)
+ //---------------------------------------------------------------
mSoundSymbol.mPosition = gAgent.getPosAgentFromGlobal(mPositionGlobal) + WORLD_UPWARD_DIRECTION * HEIGHT_ABOVE_HEAD;
-
- //---------------------------------------------------------------
- // some gl state
- //---------------------------------------------------------------
- LLGLSPipelineAlpha alpha_blend;
- LLGLDepthTest depth(GL_TRUE, GL_FALSE);
- //LLGLDisable gls_stencil(GL_STENCIL_TEST);
-
- //-------------------------------------------------------------
- // create coordinates of the geometry for the dot
- //-------------------------------------------------------------
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- LLVector3 l = camera->getLeftAxis() * DOT_SIZE;
- LLVector3 u = camera->getUpAxis() * DOT_SIZE;
-
- LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u;
- LLVector3 bottomRight = mSoundSymbol.mPosition - l - u;
- LLVector3 topLeft = mSoundSymbol.mPosition + l + u;
- LLVector3 topRight = mSoundSymbol.mPosition - l + u;
-
- //-----------------------------
- // bind texture 0 (the dot)
- //-----------------------------
- gGL.getTexUnit(0)->bind(mSoundSymbol.mTexture[0]);
-
- //-------------------------------------------------------------
- // now render the dot
- //-------------------------------------------------------------
- gGL.color4fv( LLColor4( 1.0f, 1.0f, 1.0f, DOT_OPACITY ).mV );
-
- gGL.begin( LLRender::TRIANGLE_STRIP );
- gGL.texCoord2i( 0, 0 ); gGL.vertex3fv( bottomLeft.mV );
- gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV );
- gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV );
- gGL.end();
-
- gGL.begin( LLRender::TRIANGLE_STRIP );
- gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV );
- gGL.texCoord2i( 1, 1 ); gGL.vertex3fv( topRight.mV );
- gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV );
- gGL.end();
-
-
-
- //--------------------------------------------------------------------------------------
- // if currently speaking, trigger waves (1 through 6) based on speaking amplitude
- //--------------------------------------------------------------------------------------
- if ( mCurrentlySpeaking )
- {
- F32 min = 0.2f;
- F32 max = 0.7f;
- F32 fraction = ( mSpeakingAmplitude - min ) / ( max - min );
-
- // in case mSpeakingAmplitude > max....
- if ( fraction > 1.0f )
- {
- fraction = 1.0f;
- }
-
- S32 level = 1 + (int)( fraction * ( NUM_VOICE_SYMBOL_WAVES - 2 ) );
-
- for (int i=0; i<level+1; i++)
- {
- mSoundSymbol.mWaveActive [i] = true;
- mSoundSymbol.mWaveOpacity [i] = 1.0f;
- mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
- }
-
- } // if currently speaking
-
- //---------------------------------------------------
- // determine color
- //---------------------------------------------------
- F32 red = 0.0f;
- F32 green = 0.0f;
- F32 blue = 0.0f;
+
+ //---------------------------------------------------------------
+ // some gl state
+ //---------------------------------------------------------------
+ LLGLSPipelineAlpha alpha_blend;
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
+
+ //-------------------------------------------------------------
+ // create coordinates of the geometry for the dot
+ //-------------------------------------------------------------
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ LLVector3 l = camera->getLeftAxis() * DOT_SIZE;
+ LLVector3 u = camera->getUpAxis() * DOT_SIZE;
+
+ LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u;
+ LLVector3 bottomRight = mSoundSymbol.mPosition - l - u;
+ LLVector3 topLeft = mSoundSymbol.mPosition + l + u;
+ LLVector3 topRight = mSoundSymbol.mPosition - l + u;
+
+ //-----------------------------
+ // bind texture 0 (the dot)
+ //-----------------------------
+ gGL.getTexUnit(0)->bind(mSoundSymbol.mTexture[0]);
+
+ //-------------------------------------------------------------
+ // now render the dot
+ //-------------------------------------------------------------
+ gGL.color4fv( LLColor4( 1.0f, 1.0f, 1.0f, DOT_OPACITY ).mV );
+
+ gGL.begin( LLRender::TRIANGLE_STRIP );
+ gGL.texCoord2i( 0, 0 ); gGL.vertex3fv( bottomLeft.mV );
+ gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV );
+ gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV );
+ gGL.end();
+
+ gGL.begin( LLRender::TRIANGLE_STRIP );
+ gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV );
+ gGL.texCoord2i( 1, 1 ); gGL.vertex3fv( topRight.mV );
+ gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV );
+ gGL.end();
+
+
+
+ //--------------------------------------------------------------------------------------
+ // if currently speaking, trigger waves (1 through 6) based on speaking amplitude
+ //--------------------------------------------------------------------------------------
+ if ( mCurrentlySpeaking )
+ {
+ F32 min = 0.2f;
+ F32 max = 0.7f;
+ F32 fraction = ( mSpeakingAmplitude - min ) / ( max - min );
+
+ // in case mSpeakingAmplitude > max....
+ if ( fraction > 1.0f )
+ {
+ fraction = 1.0f;
+ }
+
+ S32 level = 1 + (int)( fraction * ( NUM_VOICE_SYMBOL_WAVES - 2 ) );
+
+ for (int i=0; i<level+1; i++)
+ {
+ mSoundSymbol.mWaveActive [i] = true;
+ mSoundSymbol.mWaveOpacity [i] = 1.0f;
+ mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
+ }
+
+ } // if currently speaking
+
+ //---------------------------------------------------
+ // determine color
+ //---------------------------------------------------
+ F32 red = 0.0f;
+ F32 green = 0.0f;
+ F32 blue = 0.0f;
if ( mSpeakingAmplitude < RED_THRESHOLD )
{
- if ( mSpeakingAmplitude < GREEN_THRESHOLD )
- {
- red = BASE_BRIGHTNESS;
- green = BASE_BRIGHTNESS;
- blue = BASE_BRIGHTNESS;
- }
- else
- {
- //---------------------------------------------------
- // fade from gray to bright green
- //---------------------------------------------------
- F32 fraction = ( mSpeakingAmplitude - GREEN_THRESHOLD ) / ( 1.0f - GREEN_THRESHOLD );
- red = BASE_BRIGHTNESS - ( fraction * BASE_BRIGHTNESS );
- green = BASE_BRIGHTNESS + fraction * ( 1.0f - BASE_BRIGHTNESS );
- blue = BASE_BRIGHTNESS - ( fraction * BASE_BRIGHTNESS );
- }
+ if ( mSpeakingAmplitude < GREEN_THRESHOLD )
+ {
+ red = BASE_BRIGHTNESS;
+ green = BASE_BRIGHTNESS;
+ blue = BASE_BRIGHTNESS;
+ }
+ else
+ {
+ //---------------------------------------------------
+ // fade from gray to bright green
+ //---------------------------------------------------
+ F32 fraction = ( mSpeakingAmplitude - GREEN_THRESHOLD ) / ( 1.0f - GREEN_THRESHOLD );
+ red = BASE_BRIGHTNESS - ( fraction * BASE_BRIGHTNESS );
+ green = BASE_BRIGHTNESS + fraction * ( 1.0f - BASE_BRIGHTNESS );
+ blue = BASE_BRIGHTNESS - ( fraction * BASE_BRIGHTNESS );
+ }
}
else
{
- //---------------------------------------------------
- // redish
- //---------------------------------------------------
- red = 1.0f;
- green = 0.2f;
- blue = 0.2f;
+ //---------------------------------------------------
+ // redish
+ //---------------------------------------------------
+ red = 1.0f;
+ green = 0.2f;
+ blue = 0.2f;
}
-
- for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++)
- {
- if ( mSoundSymbol.mWaveActive[i] )
- {
- F32 fadeOutFraction = (F32)( mCurrentTime - mSoundSymbol.mWaveFadeOutStartTime[i] ) / FADE_OUT_DURATION;
-
- mSoundSymbol.mWaveOpacity[i] = 1.0f - fadeOutFraction;
-
- if ( mSoundSymbol.mWaveOpacity[i] < 0.0f )
- {
- mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
- mSoundSymbol.mWaveOpacity [i] = 0.0f;
- mSoundSymbol.mWaveActive [i] = false;
- }
-
- //----------------------------------------------------------------------------------
- // This is where we calculate the expansion of the waves - that is, the
- // rate at which they are scaled greater than 1.0 so that they grow over time.
- //----------------------------------------------------------------------------------
- F32 timeSlice = (F32)( mCurrentTime - mPreviousTime );
- F32 waveSpeed = mSpeakingAmplitude * WAVE_MOTION_RATE;
- mSoundSymbol.mWaveExpansion[i] *= ( 1.0f + EXPANSION_RATE * timeSlice * waveSpeed );
-
- if ( mSoundSymbol.mWaveExpansion[i] > EXPANSION_MAX )
- {
- mSoundSymbol.mWaveExpansion[i] = 1.0f;
- }
-
- //----------------------------------------------------------------------------------
- // create geometry for the wave billboard textures
- //----------------------------------------------------------------------------------
- F32 width = i * WAVE_WIDTH_SCALE * mSoundSymbol.mWaveExpansion[i];
- F32 height = i * WAVE_HEIGHT_SCALE * mSoundSymbol.mWaveExpansion[i];
-
- LLVector3 l = camera->getLeftAxis() * width;
- LLVector3 u = camera->getUpAxis() * height;
-
- LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u;
- LLVector3 bottomRight = mSoundSymbol.mPosition - l - u;
- LLVector3 topLeft = mSoundSymbol.mPosition + l + u;
- LLVector3 topRight = mSoundSymbol.mPosition - l + u;
-
- gGL.color4fv( LLColor4( red, green, blue, mSoundSymbol.mWaveOpacity[i] ).mV );
- gGL.getTexUnit(0)->bind(mSoundSymbol.mTexture[i]);
-
-
- //---------------------------------------------------
- // now, render the mofo
- //---------------------------------------------------
- gGL.begin( LLRender::TRIANGLE_STRIP );
- gGL.texCoord2i( 0, 0 ); gGL.vertex3fv( bottomLeft.mV );
- gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV );
- gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV );
- gGL.end();
-
- gGL.begin( LLRender::TRIANGLE_STRIP );
- gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV );
- gGL.texCoord2i( 1, 1 ); gGL.vertex3fv( topRight.mV );
- gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV );
- gGL.end();
-
- } //if ( mSoundSymbol.mWaveActive[i] )
-
- }// for loop
-
- }//if ( mSoundSymbol.mActive )
+
+ for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++)
+ {
+ if ( mSoundSymbol.mWaveActive[i] )
+ {
+ F32 fadeOutFraction = (F32)( mCurrentTime - mSoundSymbol.mWaveFadeOutStartTime[i] ) / FADE_OUT_DURATION;
+
+ mSoundSymbol.mWaveOpacity[i] = 1.0f - fadeOutFraction;
+
+ if ( mSoundSymbol.mWaveOpacity[i] < 0.0f )
+ {
+ mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime;
+ mSoundSymbol.mWaveOpacity [i] = 0.0f;
+ mSoundSymbol.mWaveActive [i] = false;
+ }
+
+ //----------------------------------------------------------------------------------
+ // This is where we calculate the expansion of the waves - that is, the
+ // rate at which they are scaled greater than 1.0 so that they grow over time.
+ //----------------------------------------------------------------------------------
+ F32 timeSlice = (F32)( mCurrentTime - mPreviousTime );
+ F32 waveSpeed = mSpeakingAmplitude * WAVE_MOTION_RATE;
+ mSoundSymbol.mWaveExpansion[i] *= ( 1.0f + EXPANSION_RATE * timeSlice * waveSpeed );
+
+ if ( mSoundSymbol.mWaveExpansion[i] > EXPANSION_MAX )
+ {
+ mSoundSymbol.mWaveExpansion[i] = 1.0f;
+ }
+
+ //----------------------------------------------------------------------------------
+ // create geometry for the wave billboard textures
+ //----------------------------------------------------------------------------------
+ F32 width = i * WAVE_WIDTH_SCALE * mSoundSymbol.mWaveExpansion[i];
+ F32 height = i * WAVE_HEIGHT_SCALE * mSoundSymbol.mWaveExpansion[i];
+
+ LLVector3 l = camera->getLeftAxis() * width;
+ LLVector3 u = camera->getUpAxis() * height;
+
+ LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u;
+ LLVector3 bottomRight = mSoundSymbol.mPosition - l - u;
+ LLVector3 topLeft = mSoundSymbol.mPosition + l + u;
+ LLVector3 topRight = mSoundSymbol.mPosition - l + u;
+
+ gGL.color4fv( LLColor4( red, green, blue, mSoundSymbol.mWaveOpacity[i] ).mV );
+ gGL.getTexUnit(0)->bind(mSoundSymbol.mTexture[i]);
+
+
+ //---------------------------------------------------
+ // now, render the mofo
+ //---------------------------------------------------
+ gGL.begin( LLRender::TRIANGLE_STRIP );
+ gGL.texCoord2i( 0, 0 ); gGL.vertex3fv( bottomLeft.mV );
+ gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV );
+ gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV );
+ gGL.end();
+
+ gGL.begin( LLRender::TRIANGLE_STRIP );
+ gGL.texCoord2i( 1, 0 ); gGL.vertex3fv( bottomRight.mV );
+ gGL.texCoord2i( 1, 1 ); gGL.vertex3fv( topRight.mV );
+ gGL.texCoord2i( 0, 1 ); gGL.vertex3fv( topLeft.mV );
+ gGL.end();
+
+ } //if ( mSoundSymbol.mWaveActive[i] )
+
+ }// for loop
+
+ }//if ( mSoundSymbol.mActive )
}//---------------------------------------------------
//---------------------------------------------------
void LLVoiceVisualizer::setVoiceSourceWorldPosition( const LLVector3 &p )
{
- mVoiceSourceWorldPosition = p;
+ mVoiceSourceWorldPosition = p;
}//---------------------------------------------------
//---------------------------------------------------
VoiceGesticulationLevel LLVoiceVisualizer::getCurrentGesticulationLevel()
{
- VoiceGesticulationLevel gesticulationLevel = VOICE_GESTICULATION_LEVEL_OFF; //default
-
- //-----------------------------------------------------------------------------------------
- // Within the range of gesticulation amplitudes, the sound signal is split into
- // three equal amplitude regimes, each specifying one of three gesticulation levels.
- //-----------------------------------------------------------------------------------------
- F32 range = mMaxGesticulationAmplitude - mMinGesticulationAmplitude;
-
- if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.5f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_HIGH; }
- else if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.25f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_MEDIUM; }
- else if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.00000f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_LOW; }
-
- return gesticulationLevel;
+ VoiceGesticulationLevel gesticulationLevel = VOICE_GESTICULATION_LEVEL_OFF; //default
+
+ //-----------------------------------------------------------------------------------------
+ // Within the range of gesticulation amplitudes, the sound signal is split into
+ // three equal amplitude regimes, each specifying one of three gesticulation levels.
+ //-----------------------------------------------------------------------------------------
+ F32 range = mMaxGesticulationAmplitude - mMinGesticulationAmplitude;
+
+ if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.5f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_HIGH; }
+ else if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.25f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_MEDIUM; }
+ else if ( mSpeakingAmplitude > mMinGesticulationAmplitude + range * 0.00000f ) { gesticulationLevel = VOICE_GESTICULATION_LEVEL_LOW; }
+
+ return gesticulationLevel;
}//---------------------------------------------------
@@ -566,15 +566,15 @@ LLVoiceVisualizer::~LLVoiceVisualizer()
//---------------------------------------------------
void LLVoiceVisualizer::packData(LLMessageSystem *mesgsys)
{
- // Pack the default data
- LLHUDEffect::packData(mesgsys);
-
- // TODO -- pack the relevant data for voice effects
- // we'll come up with some cool configurations....TBD
- //U8 packed_data[41];
- //mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, 41);
- U8 packed_data = 0;
- mesgsys->addBinaryDataFast(_PREHASH_TypeData, &packed_data, 1);
+ // Pack the default data
+ LLHUDEffect::packData(mesgsys);
+
+ // TODO -- pack the relevant data for voice effects
+ // we'll come up with some cool configurations....TBD
+ //U8 packed_data[41];
+ //mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, 41);
+ U8 packed_data = 0;
+ mesgsys->addBinaryDataFast(_PREHASH_TypeData, &packed_data, 1);
}
@@ -583,19 +583,19 @@ void LLVoiceVisualizer::packData(LLMessageSystem *mesgsys)
//---------------------------------------------------
void LLVoiceVisualizer::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
{
- // TODO -- find the speaker, unpack binary data, set the properties of this effect
- /*
- LLHUDEffect::unpackData(mesgsys, blocknum);
- LLUUID source_id;
- LLUUID target_id;
- S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
- if (size != 1)
- {
- LL_WARNS() << "Voice effect with bad size " << size << LL_ENDL;
- return;
- }
- mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, 1, blocknum);
- */
+ // TODO -- find the speaker, unpack binary data, set the properties of this effect
+ /*
+ LLHUDEffect::unpackData(mesgsys, blocknum);
+ LLUUID source_id;
+ LLUUID target_id;
+ S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
+ if (size != 1)
+ {
+ LL_WARNS() << "Voice effect with bad size " << size << LL_ENDL;
+ return;
+ }
+ mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, 1, blocknum);
+ */
}
@@ -604,9 +604,9 @@ void LLVoiceVisualizer::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
//------------------------------------------------------------------
void LLVoiceVisualizer::markDead()
{
- mCurrentlySpeaking = false;
- mVoiceEnabled = false;
- mSoundSymbol.mActive = false;
+ mCurrentlySpeaking = false;
+ mVoiceEnabled = false;
+ mSoundSymbol.mActive = false;
- LLHUDEffect::markDead();
+ LLHUDEffect::markDead();
}//------------------------------------------------------------------
diff --git a/indra/newview/llvoicevisualizer.h b/indra/newview/llvoicevisualizer.h
index 36c78252d1..403b3a8819 100644
--- a/indra/newview/llvoicevisualizer.h
+++ b/indra/newview/llvoicevisualizer.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvoicevisualizer.h
* @brief Draws in-world speaking indicators.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,13 +30,13 @@
// author: JJ Ventrella, Linden Lab
// (latest update to this info: Jan 18, 2007)
//
-// The Voice Visualizer is responsible for taking realtime signals from actual users speaking and
-// visualizing this speech in two forms:
+// The Voice Visualizer is responsible for taking realtime signals from actual users speaking and
+// visualizing this speech in two forms:
//
// (1) as a dynamic sound symbol (also referred to as the "voice indicator" that appears over the avatar's head
-// (2) as gesticulation events that are used to trigger avatr gestures
+// (2) as gesticulation events that are used to trigger avatr gestures
//
-// The input for the voice visualizer is a continual stream of voice amplitudes.
+// The input for the voice visualizer is a continual stream of voice amplitudes.
//-----------------------------------------------------------------------------
#ifndef LL_VOICE_VISUALIZER_H
@@ -45,109 +45,109 @@
#include "llhudeffect.h"
//-----------------------------------------------------------------------------------------------
-// The values of voice gesticulation represent energy levels for avatar animation, based on
-// amplitude surge events parsed from the voice signal. These are made available so that
+// The values of voice gesticulation represent energy levels for avatar animation, based on
+// amplitude surge events parsed from the voice signal. These are made available so that
// the appropriate kind of avatar animation can be triggered, and thereby simulate the physical
-// motion effects of speech. It is recommended that multiple body parts be animated as well as
+// motion effects of speech. It is recommended that multiple body parts be animated as well as
// lips, such as head, shoulders, and hands, with large gestures used when the energy level is high.
//-----------------------------------------------------------------------------------------------
enum VoiceGesticulationLevel
{
- VOICE_GESTICULATION_LEVEL_OFF = -1,
- VOICE_GESTICULATION_LEVEL_LOW = 0,
- VOICE_GESTICULATION_LEVEL_MEDIUM,
- VOICE_GESTICULATION_LEVEL_HIGH,
- NUM_VOICE_GESTICULATION_LEVELS
+ VOICE_GESTICULATION_LEVEL_OFF = -1,
+ VOICE_GESTICULATION_LEVEL_LOW = 0,
+ VOICE_GESTICULATION_LEVEL_MEDIUM,
+ VOICE_GESTICULATION_LEVEL_HIGH,
+ NUM_VOICE_GESTICULATION_LEVELS
};
const static int NUM_VOICE_SYMBOL_WAVES = 7;
//----------------------------------------------------
-// LLVoiceVisualizer class
+// LLVoiceVisualizer class
//----------------------------------------------------
class LLVoiceVisualizer : public LLHUDEffect
{
- //---------------------------------------------------
- // public methods
- //---------------------------------------------------
- public:
- LLVoiceVisualizer( const U8 type ); //constructor
- ~LLVoiceVisualizer(); //destructor
-
- void setVoiceSourceWorldPosition( const LLVector3 &p ); // this should be the position of the speaking avatar's head
- void setMinGesticulationAmplitude( F32 ); // the lower range of meaningful amplitude for setting gesticulation level
- void setMaxGesticulationAmplitude( F32 ); // the upper range of meaningful amplitude for setting gesticulation level
- void setStartSpeaking(); // tell me when the av starts speaking
- void setVoiceEnabled( bool ); // tell me whether or not the user is voice enabled
- void setSpeakingAmplitude( F32 ); // tell me how loud the av is speaking (ranges from 0 to 1)
- void setStopSpeaking(); // tell me when the av stops speaking
- bool getCurrentlySpeaking(); // the get for the above set
- VoiceGesticulationLevel getCurrentGesticulationLevel(); // based on voice amplitude, I'll give you the current "energy level" of avatar speech
- void lipSyncOohAah( F32& ooh, F32& aah );
- void render(); // inherited from HUD Effect
- void packData(LLMessageSystem *mesgsys); // inherited from HUD Effect
- void unpackData(LLMessageSystem *mesgsys, S32 blocknum); // inherited from HUD Effect
- void markDead(); // inherited from HUD Effect
-
- //----------------------------------------------------------------------------------------------
- // "setMaxGesticulationAmplitude" and "setMinGesticulationAmplitude" allow for the tuning of the
- // gesticulation level detector to be responsive to different kinds of signals. For instance, we
- // may find that the average voice amplitude rarely exceeds 0.7 (in a range from 0 to 1), and
- // therefore we may want to set 0.7 as the max, so we can more easily catch all the variance
- // within that range. Also, we may find that there is often noise below a certain range like 0.1,
- // and so we would want to set 0.1 as the min so as not to accidentally use this as signal.
- //----------------------------------------------------------------------------------------------
- void setMaxGesticulationAmplitude();
- void setMinGesticulationAmplitude();
-
- //---------------------------------------------------
- // private members
- //---------------------------------------------------
- private:
- static bool handleVoiceVisualizerPrefsChanged(const LLSD& newvalue);
- static void setPreferences( );
- static void lipStringToF32s ( std::string& in_string, F32*& out_F32s, U32& count_F32s ); // convert a string of digits to an array of floats
-
- struct SoundSymbol
- {
- F32 mWaveExpansion [ NUM_VOICE_SYMBOL_WAVES ];
- bool mWaveActive [ NUM_VOICE_SYMBOL_WAVES ];
- F64 mWaveFadeOutStartTime [ NUM_VOICE_SYMBOL_WAVES ];
- F32 mWaveOpacity [ NUM_VOICE_SYMBOL_WAVES ];
- LLPointer<LLViewerFetchedTexture> mTexture [ NUM_VOICE_SYMBOL_WAVES ];
- bool mActive;
- LLVector3 mPosition;
- };
-
- LLFrameTimer mTimer; // so I can ask the current time in seconds
- F64 mStartTime; // time in seconds when speaking started
- F64 mCurrentTime; // current time in seconds, captured every step
- F64 mPreviousTime; // copy of "current time" from last frame
- SoundSymbol mSoundSymbol; // the sound symbol that appears over the avatar's head
- bool mVoiceEnabled; // if off, no rendering should happen
- bool mCurrentlySpeaking; // is the user currently speaking?
- LLVector3 mVoiceSourceWorldPosition; // give this to me every step - I need it to update the sound symbol
- F32 mSpeakingAmplitude; // this should be set as often as possible when the user is speaking
- F32 mMaxGesticulationAmplitude; // this is the upper-limit of the envelope of detectable gesticulation leves
- F32 mMinGesticulationAmplitude; // this is the lower-limit of the envelope of detectable gesticulation leves
-
- //---------------------------------------------------
- // private static members
- //---------------------------------------------------
-
- static BOOL sLipSyncEnabled; // 0 disabled, 1 babble loop
- static bool sPrefsInitialized; // the first instance will initialize the static members
- static F32* sOoh; // the babble loop of amplitudes for the ooh morph
- static F32* sAah; // the babble loop of amplitudes for the ooh morph
- static U32 sOohs; // the number of entries in the ooh loop
- static U32 sAahs; // the number of entries in the aah loop
- static F32 sOohAahRate; // frames per second for the babble loop
- static F32* sOohPowerTransfer; // the power transfer characteristics for the ooh amplitude
- static U32 sOohPowerTransfers; // the number of entries in the ooh transfer characteristics
- static F32 sOohPowerTransfersf; // the number of entries in the ooh transfer characteristics as a float
- static F32* sAahPowerTransfer; // the power transfer characteristics for the aah amplitude
- static U32 sAahPowerTransfers; // the number of entries in the aah transfer characteristics
- static F32 sAahPowerTransfersf; // the number of entries in the aah transfer characteristics as a float
+ //---------------------------------------------------
+ // public methods
+ //---------------------------------------------------
+ public:
+ LLVoiceVisualizer( const U8 type ); //constructor
+ ~LLVoiceVisualizer(); //destructor
+
+ void setVoiceSourceWorldPosition( const LLVector3 &p ); // this should be the position of the speaking avatar's head
+ void setMinGesticulationAmplitude( F32 ); // the lower range of meaningful amplitude for setting gesticulation level
+ void setMaxGesticulationAmplitude( F32 ); // the upper range of meaningful amplitude for setting gesticulation level
+ void setStartSpeaking(); // tell me when the av starts speaking
+ void setVoiceEnabled( bool ); // tell me whether or not the user is voice enabled
+ void setSpeakingAmplitude( F32 ); // tell me how loud the av is speaking (ranges from 0 to 1)
+ void setStopSpeaking(); // tell me when the av stops speaking
+ bool getCurrentlySpeaking(); // the get for the above set
+ VoiceGesticulationLevel getCurrentGesticulationLevel(); // based on voice amplitude, I'll give you the current "energy level" of avatar speech
+ void lipSyncOohAah( F32& ooh, F32& aah );
+ void render(); // inherited from HUD Effect
+ void packData(LLMessageSystem *mesgsys); // inherited from HUD Effect
+ void unpackData(LLMessageSystem *mesgsys, S32 blocknum); // inherited from HUD Effect
+ void markDead(); // inherited from HUD Effect
+
+ //----------------------------------------------------------------------------------------------
+ // "setMaxGesticulationAmplitude" and "setMinGesticulationAmplitude" allow for the tuning of the
+ // gesticulation level detector to be responsive to different kinds of signals. For instance, we
+ // may find that the average voice amplitude rarely exceeds 0.7 (in a range from 0 to 1), and
+ // therefore we may want to set 0.7 as the max, so we can more easily catch all the variance
+ // within that range. Also, we may find that there is often noise below a certain range like 0.1,
+ // and so we would want to set 0.1 as the min so as not to accidentally use this as signal.
+ //----------------------------------------------------------------------------------------------
+ void setMaxGesticulationAmplitude();
+ void setMinGesticulationAmplitude();
+
+ //---------------------------------------------------
+ // private members
+ //---------------------------------------------------
+ private:
+ static bool handleVoiceVisualizerPrefsChanged(const LLSD& newvalue);
+ static void setPreferences( );
+ static void lipStringToF32s ( std::string& in_string, F32*& out_F32s, U32& count_F32s ); // convert a string of digits to an array of floats
+
+ struct SoundSymbol
+ {
+ F32 mWaveExpansion [ NUM_VOICE_SYMBOL_WAVES ];
+ bool mWaveActive [ NUM_VOICE_SYMBOL_WAVES ];
+ F64 mWaveFadeOutStartTime [ NUM_VOICE_SYMBOL_WAVES ];
+ F32 mWaveOpacity [ NUM_VOICE_SYMBOL_WAVES ];
+ LLPointer<LLViewerFetchedTexture> mTexture [ NUM_VOICE_SYMBOL_WAVES ];
+ bool mActive;
+ LLVector3 mPosition;
+ };
+
+ LLFrameTimer mTimer; // so I can ask the current time in seconds
+ F64 mStartTime; // time in seconds when speaking started
+ F64 mCurrentTime; // current time in seconds, captured every step
+ F64 mPreviousTime; // copy of "current time" from last frame
+ SoundSymbol mSoundSymbol; // the sound symbol that appears over the avatar's head
+ bool mVoiceEnabled; // if off, no rendering should happen
+ bool mCurrentlySpeaking; // is the user currently speaking?
+ LLVector3 mVoiceSourceWorldPosition; // give this to me every step - I need it to update the sound symbol
+ F32 mSpeakingAmplitude; // this should be set as often as possible when the user is speaking
+ F32 mMaxGesticulationAmplitude; // this is the upper-limit of the envelope of detectable gesticulation leves
+ F32 mMinGesticulationAmplitude; // this is the lower-limit of the envelope of detectable gesticulation leves
+
+ //---------------------------------------------------
+ // private static members
+ //---------------------------------------------------
+
+ static BOOL sLipSyncEnabled; // 0 disabled, 1 babble loop
+ static bool sPrefsInitialized; // the first instance will initialize the static members
+ static F32* sOoh; // the babble loop of amplitudes for the ooh morph
+ static F32* sAah; // the babble loop of amplitudes for the ooh morph
+ static U32 sOohs; // the number of entries in the ooh loop
+ static U32 sAahs; // the number of entries in the aah loop
+ static F32 sOohAahRate; // frames per second for the babble loop
+ static F32* sOohPowerTransfer; // the power transfer characteristics for the ooh amplitude
+ static U32 sOohPowerTransfers; // the number of entries in the ooh transfer characteristics
+ static F32 sOohPowerTransfersf; // the number of entries in the ooh transfer characteristics as a float
+ static F32* sAahPowerTransfer; // the power transfer characteristics for the aah amplitude
+ static U32 sAahPowerTransfers; // the number of entries in the aah transfer characteristics
+ static F32 sAahPowerTransfersf; // the number of entries in the aah transfer characteristics as a float
};//-----------------------------------------------------------------
// end of LLVoiceVisualizer class
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 310c9ee297..3bb23bf126 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -1,25 +1,25 @@
- /**
+ /**
* @file LLVivoxVoiceClient.cpp
* @brief Implementation of LLVivoxVoiceClient class which is the interface to the voice client process.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,10 +43,10 @@
#endif
#include "llcallbacklist.h"
#include "llviewerregion.h"
-#include "llviewernetwork.h" // for gGridChoice
+#include "llviewernetwork.h" // for gGridChoice
#include "llbase64.h"
#include "llviewercontrol.h"
-#include "llappviewer.h" // for gDisconnected, gDisableVoice
+#include "llappviewer.h" // for gDisconnected, gDisableVoice
#include "llprocess.h"
// Viewer includes
@@ -94,7 +94,7 @@ namespace {
// Don't send positional updates more frequently than this:
const F32 UPDATE_THROTTLE_SECONDS = 0.5f;
- // Timeout for connection to Vivox
+ // Timeout for connection to Vivox
const F32 CONNECT_ATTEMPT_TIMEOUT = 300.0f;
const F32 CONNECT_DNS_TIMEOUT = 5.0f;
const int CONNECT_RETRY_MAX = 3;
@@ -113,8 +113,8 @@ namespace {
const F32 SESSION_JOIN_TIMEOUT = 30.0f;
// Defines the maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine()
- // which is treated as normal. The is the number of frames to wait for a channel join before giving up. This was changed
- // from the original count of 50 for two reason. Modern PCs have higher frame rates and sometimes the SLVoice process
+ // which is treated as normal. The is the number of frames to wait for a channel join before giving up. This was changed
+ // from the original count of 50 for two reason. Modern PCs have higher frame rates and sometimes the SLVoice process
// backs up processing join requests. There is a log statement that records when channel joins take longer than 100 frames.
const int MAX_NORMAL_JOINING_SPATIAL_NUM = 1500;
@@ -133,17 +133,17 @@ namespace {
static int scale_mic_volume(float volume)
{
- // incoming volume has the range [0.0 ... 2.0], with 1.0 as the default.
- // Map it to Vivox levels as follows: 0.0 -> 30, 1.0 -> 50, 2.0 -> 70
- return 30 + (int)(volume * 20.0f);
+ // incoming volume has the range [0.0 ... 2.0], with 1.0 as the default.
+ // Map it to Vivox levels as follows: 0.0 -> 30, 1.0 -> 50, 2.0 -> 70
+ return 30 + (int)(volume * 20.0f);
}
static int scale_speaker_volume(float volume)
{
- // incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
- // Map it to Vivox levels as follows: 0.0 -> 30, 0.5 -> 50, 1.0 -> 70
- return 30 + (int)(volume * 40.0f);
-
+ // incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
+ // Map it to Vivox levels as follows: 0.0 -> 30, 0.5 -> 50, 1.0 -> 70
+ return 30 + (int)(volume * 40.0f);
+
}
@@ -151,7 +151,7 @@ static int scale_speaker_volume(float volume)
class LLVivoxVoiceClientMuteListObserver : public LLMuteListObserver
{
- /* virtual */ void onChange() { LLVivoxVoiceClient::getInstance()->muteListChanged();}
+ /* virtual */ void onChange() { LLVivoxVoiceClient::getInstance()->muteListChanged();}
};
@@ -254,19 +254,19 @@ static LLEventStream sGatewayPump("VivoxDaemonPump", true);
static bool isGatewayRunning()
{
- return sGatewayPtr && sGatewayPtr->isRunning();
+ return sGatewayPtr && sGatewayPtr->isRunning();
}
static void killGateway()
{
- if (sGatewayPtr)
- {
+ if (sGatewayPtr)
+ {
LL_DEBUGS("Voice") << "SLVoice " << sGatewayPtr->getStatusString() << LL_ENDL;
- sGatewayPump.stopListening("VivoxDaemonPump");
- sGatewayPtr->kill(__FUNCTION__);
+ sGatewayPump.stopListening("VivoxDaemonPump");
+ sGatewayPtr->kill(__FUNCTION__);
sGatewayPtr=NULL;
- }
+ }
else
{
LL_DEBUGS("Voice") << "no gateway" << LL_ENDL;
@@ -280,114 +280,114 @@ bool LLVivoxVoiceClient::sConnected = false;
LLPumpIO *LLVivoxVoiceClient::sPump = nullptr;
LLVivoxVoiceClient::LLVivoxVoiceClient() :
- mSessionTerminateRequested(false),
- mRelogRequested(false),
- mTerminateDaemon(false),
- mSpatialJoiningNum(0),
-
- mTuningMode(false),
- mTuningEnergy(0.0f),
- mTuningMicVolume(0),
- mTuningMicVolumeDirty(true),
- mTuningSpeakerVolume(50), // Set to 50 so the user can hear himself when he sets his mic volume
- mTuningSpeakerVolumeDirty(true),
- mDevicesListUpdated(false),
-
- mAreaVoiceDisabled(false),
- mAudioSession(), // TBD - should be NULL
- mAudioSessionChanged(false),
- mNextAudioSession(),
-
- mCurrentParcelLocalID(0),
+ mSessionTerminateRequested(false),
+ mRelogRequested(false),
+ mTerminateDaemon(false),
+ mSpatialJoiningNum(0),
+
+ mTuningMode(false),
+ mTuningEnergy(0.0f),
+ mTuningMicVolume(0),
+ mTuningMicVolumeDirty(true),
+ mTuningSpeakerVolume(50), // Set to 50 so the user can hear himself when he sets his mic volume
+ mTuningSpeakerVolumeDirty(true),
+ mDevicesListUpdated(false),
+
+ mAreaVoiceDisabled(false),
+ mAudioSession(), // TBD - should be NULL
+ mAudioSessionChanged(false),
+ mNextAudioSession(),
+
+ mCurrentParcelLocalID(0),
mConnectorEstablished(false),
mAccountLoggedIn(false),
- mNumberOfAliases(0),
- mCommandCookie(0),
- mLoginRetryCount(0),
-
- mBuddyListMapPopulated(false),
- mBlockRulesListReceived(false),
- mAutoAcceptRulesListReceived(false),
-
- mCaptureDeviceDirty(false),
- mRenderDeviceDirty(false),
- mSpatialCoordsDirty(false),
- mIsInitialized(false),
-
- mMuteMic(false),
- mMuteMicDirty(false),
- mFriendsListDirty(true),
-
- mEarLocation(0),
- mSpeakerVolumeDirty(true),
- mSpeakerMuteDirty(true),
- mMicVolume(0),
- mMicVolumeDirty(true),
-
- mVoiceEnabled(false),
- mWriteInProgress(false),
-
- mLipSyncEnabled(false),
-
- mVoiceFontsReceived(false),
- mVoiceFontsNew(false),
- mVoiceFontListDirty(false),
-
- mCaptureBufferMode(false),
- mCaptureBufferRecording(false),
- mCaptureBufferRecorded(false),
- mCaptureBufferPlaying(false),
- mShutdownComplete(true),
- mPlayRequestCount(0),
-
- mAvatarNameCacheConnection(),
- mIsInTuningMode(false),
- mIsInChannel(false),
- mIsJoiningSession(false),
- mIsWaitingForFonts(false),
- mIsLoggingIn(false),
- mIsLoggedIn(false),
- mIsProcessingChannels(false),
- mIsCoroutineActive(false),
- mVivoxPump("vivoxClientPump")
+ mNumberOfAliases(0),
+ mCommandCookie(0),
+ mLoginRetryCount(0),
+
+ mBuddyListMapPopulated(false),
+ mBlockRulesListReceived(false),
+ mAutoAcceptRulesListReceived(false),
+
+ mCaptureDeviceDirty(false),
+ mRenderDeviceDirty(false),
+ mSpatialCoordsDirty(false),
+ mIsInitialized(false),
+
+ mMuteMic(false),
+ mMuteMicDirty(false),
+ mFriendsListDirty(true),
+
+ mEarLocation(0),
+ mSpeakerVolumeDirty(true),
+ mSpeakerMuteDirty(true),
+ mMicVolume(0),
+ mMicVolumeDirty(true),
+
+ mVoiceEnabled(false),
+ mWriteInProgress(false),
+
+ mLipSyncEnabled(false),
+
+ mVoiceFontsReceived(false),
+ mVoiceFontsNew(false),
+ mVoiceFontListDirty(false),
+
+ mCaptureBufferMode(false),
+ mCaptureBufferRecording(false),
+ mCaptureBufferRecorded(false),
+ mCaptureBufferPlaying(false),
+ mShutdownComplete(true),
+ mPlayRequestCount(0),
+
+ mAvatarNameCacheConnection(),
+ mIsInTuningMode(false),
+ mIsInChannel(false),
+ mIsJoiningSession(false),
+ mIsWaitingForFonts(false),
+ mIsLoggingIn(false),
+ mIsLoggedIn(false),
+ mIsProcessingChannels(false),
+ mIsCoroutineActive(false),
+ mVivoxPump("vivoxClientPump")
{
sShuttingDown = false;
sConnected = false;
sPump = nullptr;
- mSpeakerVolume = scale_speaker_volume(0);
+ mSpeakerVolume = scale_speaker_volume(0);
+
+ mVoiceVersion.serverVersion = "";
+ mVoiceVersion.serverType = VOICE_SERVER_TYPE;
+
+ // gMuteListp isn't set up at this point, so we defer this until later.
+// gMuteListp->addObserver(&mutelist_listener);
- mVoiceVersion.serverVersion = "";
- mVoiceVersion.serverType = VOICE_SERVER_TYPE;
-
- // gMuteListp isn't set up at this point, so we defer this until later.
-// gMuteListp->addObserver(&mutelist_listener);
-
#if LL_DARWIN || LL_LINUX
- // HACK: THIS DOES NOT BELONG HERE
- // When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
- // This should cause us to ignore SIGPIPE and handle the error through proper channels.
- // This should really be set up elsewhere. Where should it go?
- signal(SIGPIPE, SIG_IGN);
-
- // Since we're now launching the gateway with fork/exec instead of system(), we need to deal with zombie processes.
- // Ignoring SIGCHLD should prevent zombies from being created. Alternately, we could use wait(), but I'd rather not do that.
- signal(SIGCHLD, SIG_IGN);
+ // HACK: THIS DOES NOT BELONG HERE
+ // When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
+ // This should cause us to ignore SIGPIPE and handle the error through proper channels.
+ // This should really be set up elsewhere. Where should it go?
+ signal(SIGPIPE, SIG_IGN);
+
+ // Since we're now launching the gateway with fork/exec instead of system(), we need to deal with zombie processes.
+ // Ignoring SIGCHLD should prevent zombies from being created. Alternately, we could use wait(), but I'd rather not do that.
+ signal(SIGCHLD, SIG_IGN);
#endif
- gIdleCallbacks.addFunction(idle, this);
+ gIdleCallbacks.addFunction(idle, this);
}
//---------------------------------------------------
LLVivoxVoiceClient::~LLVivoxVoiceClient()
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
sShuttingDown = true;
}
@@ -395,8 +395,8 @@ LLVivoxVoiceClient::~LLVivoxVoiceClient()
void LLVivoxVoiceClient::init(LLPumpIO *pump)
{
- // constructor will set up LLVoiceClient::getInstance()
- sPump = pump;
+ // constructor will set up LLVoiceClient::getInstance()
+ sPump = pump;
// LLCoros::instance().launch("LLVivoxVoiceClient::voiceControlCoro",
// boost::bind(&LLVivoxVoiceClient::voiceControlCoro, LLVivoxVoiceClient::getInstance()));
@@ -410,23 +410,23 @@ void LLVivoxVoiceClient::terminate()
return;
}
- // needs to be done manually here since we will not get another pass in
+ // needs to be done manually here since we will not get another pass in
// coroutines... that mechanism is long since gone.
if (mIsLoggedIn)
{
logoutOfVivox(false);
}
-
- if(sConnected)
- {
+
+ if(sConnected)
+ {
breakVoiceConnection(false);
sConnected = false;
- }
- else
- {
- mRelogRequested = false;
- killGateway();
- }
+ }
+ else
+ {
+ mRelogRequested = false;
+ killGateway();
+ }
sShuttingDown = true;
sPump = NULL;
@@ -437,10 +437,10 @@ void LLVivoxVoiceClient::terminate()
void LLVivoxVoiceClient::cleanUp()
{
LL_DEBUGS("Voice") << LL_ENDL;
-
- deleteAllSessions();
- deleteAllVoiceFonts();
- deleteVoiceFontTemplates();
+
+ deleteAllSessions();
+ deleteAllVoiceFonts();
+ deleteVoiceFontTemplates();
LL_DEBUGS("Voice") << "exiting" << LL_ENDL;
}
@@ -448,7 +448,7 @@ void LLVivoxVoiceClient::cleanUp()
const LLVoiceVersionInfo& LLVivoxVoiceClient::getVersion()
{
- return mVoiceVersion;
+ return mVoiceVersion;
}
//---------------------------------------------------
@@ -456,15 +456,15 @@ const LLVoiceVersionInfo& LLVivoxVoiceClient::getVersion()
void LLVivoxVoiceClient::updateSettings()
{
setVoiceEnabled(voiceEnabled());
- setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
+ setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
- std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
- setCaptureDevice(inputDevice);
- std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
- setRenderDevice(outputDevice);
- F32 mic_level = gSavedSettings.getF32("AudioLevelMic");
- setMicGain(mic_level);
- setLipSyncEnabled(gSavedSettings.getBOOL("LipSyncEnabled"));
+ std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
+ setCaptureDevice(inputDevice);
+ std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
+ setRenderDevice(outputDevice);
+ F32 mic_level = gSavedSettings.getF32("AudioLevelMic");
+ setMicGain(mic_level);
+ setLipSyncEnabled(gSavedSettings.getBOOL("LipSyncEnabled"));
}
/////////////////////////////
@@ -472,48 +472,48 @@ void LLVivoxVoiceClient::updateSettings()
bool LLVivoxVoiceClient::writeString(const std::string &str)
{
- bool result = false;
+ bool result = false;
LL_DEBUGS("LowVoice") << "sending:\n" << str << LL_ENDL;
- if(sConnected)
- {
- apr_status_t err;
- apr_size_t size = (apr_size_t)str.size();
- apr_size_t written = size;
-
- //MARK: Turn this on to log outgoing XML
+ if(sConnected)
+ {
+ apr_status_t err;
+ apr_size_t size = (apr_size_t)str.size();
+ apr_size_t written = size;
+
+ //MARK: Turn this on to log outgoing XML
// LL_DEBUGS("Voice") << "sending: " << str << LL_ENDL;
- // check return code - sockets will fail (broken, etc.)
- err = apr_socket_send(
- mSocket->getSocket(),
- (const char*)str.data(),
- &written);
-
- if(err == 0 && written == size)
- {
- // Success.
- result = true;
- }
- else if (err == 0 && written != size) {
- // Did a short write, log it for now
- LL_WARNS("Voice") << ") short write on socket sending data to vivox daemon." << "Sent " << written << "bytes instead of " << size <<LL_ENDL;
- }
- else if(APR_STATUS_IS_EAGAIN(err))
- {
- char buf[MAX_STRING];
- LL_WARNS("Voice") << "EAGAIN error " << err << " (" << apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
- }
- else
- {
- // Assume any socket error means something bad. For now, just close the socket.
- char buf[MAX_STRING];
- LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
- daemonDied();
- }
- }
-
- return result;
+ // check return code - sockets will fail (broken, etc.)
+ err = apr_socket_send(
+ mSocket->getSocket(),
+ (const char*)str.data(),
+ &written);
+
+ if(err == 0 && written == size)
+ {
+ // Success.
+ result = true;
+ }
+ else if (err == 0 && written != size) {
+ // Did a short write, log it for now
+ LL_WARNS("Voice") << ") short write on socket sending data to vivox daemon." << "Sent " << written << "bytes instead of " << size <<LL_ENDL;
+ }
+ else if(APR_STATUS_IS_EAGAIN(err))
+ {
+ char buf[MAX_STRING];
+ LL_WARNS("Voice") << "EAGAIN error " << err << " (" << apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
+ }
+ else
+ {
+ // Assume any socket error means something bad. For now, just close the socket.
+ char buf[MAX_STRING];
+ LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
+ daemonDied();
+ }
+ }
+
+ return result;
}
@@ -521,141 +521,141 @@ bool LLVivoxVoiceClient::writeString(const std::string &str)
// session control messages
void LLVivoxVoiceClient::connectorCreate()
{
- std::ostringstream stream;
- std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
-
- // Transition to stateConnectorStarted when the connector handle comes back.
- std::string vivoxLogLevel = gSavedSettings.getString("VivoxDebugLevel");
+ std::ostringstream stream;
+ std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
+
+ // Transition to stateConnectorStarted when the connector handle comes back.
+ std::string vivoxLogLevel = gSavedSettings.getString("VivoxDebugLevel");
if ( vivoxLogLevel.empty() )
{
vivoxLogLevel = "0";
}
LL_DEBUGS("Voice") << "creating connector with log level " << vivoxLogLevel << LL_ENDL;
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
- << "<ClientName>V2 SDK</ClientName>"
- << "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
- << "<Mode>Normal</Mode>"
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
+ << "<ClientName>V2 SDK</ClientName>"
+ << "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
+ << "<Mode>Normal</Mode>"
<< "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
- << "<Logging>"
- << "<Folder>" << logdir << "</Folder>"
- << "<FileNamePrefix>Connector</FileNamePrefix>"
- << "<FileNameSuffix>.log</FileNameSuffix>"
- << "<LogLevel>" << vivoxLogLevel << "</LogLevel>"
- << "</Logging>"
- << "<Application>" << LLVersionInfo::instance().getChannel() << " " << LLVersionInfo::instance().getVersion() << "</Application>"
- //<< "<Application></Application>" //Name can cause problems per vivox.
- << "<MaxCalls>12</MaxCalls>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ << "<Logging>"
+ << "<Folder>" << logdir << "</Folder>"
+ << "<FileNamePrefix>Connector</FileNamePrefix>"
+ << "<FileNameSuffix>.log</FileNameSuffix>"
+ << "<LogLevel>" << vivoxLogLevel << "</LogLevel>"
+ << "</Logging>"
+ << "<Application>" << LLVersionInfo::instance().getChannel() << " " << LLVersionInfo::instance().getVersion() << "</Application>"
+ //<< "<Application></Application>" //Name can cause problems per vivox.
+ << "<MaxCalls>12</MaxCalls>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
}
void LLVivoxVoiceClient::connectorShutdown()
{
- if(mConnectorEstablished)
- {
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.InitiateShutdown.1\">"
- << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
- << "</Request>"
- << "\n\n\n";
-
- mShutdownComplete = false;
- mConnectorEstablished = false;
-
- writeString(stream.str());
- }
- else
- {
- mShutdownComplete = true;
- }
+ if(mConnectorEstablished)
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.InitiateShutdown.1\">"
+ << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
+ << "</Request>"
+ << "\n\n\n";
+
+ mShutdownComplete = false;
+ mConnectorEstablished = false;
+
+ writeString(stream.str());
+ }
+ else
+ {
+ mShutdownComplete = true;
+ }
}
void LLVivoxVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
{
- mAccountDisplayName = user_id;
+ mAccountDisplayName = user_id;
- LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
+ LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
- mAccountName = nameFromID(agentID);
+ mAccountName = nameFromID(agentID);
}
void LLVivoxVoiceClient::setLoginInfo(
- const std::string& account_name,
- const std::string& password,
- const std::string& voice_sip_uri_hostname,
- const std::string& voice_account_server_uri)
-{
- mVoiceSIPURIHostName = voice_sip_uri_hostname;
- mVoiceAccountServerURI = voice_account_server_uri;
-
- if(mAccountLoggedIn)
- {
- // Already logged in.
- LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
-
- // Don't process another login.
- return;
- }
- else if ( account_name != mAccountName )
- {
- LL_WARNS("Voice") << "Mismatched account name! " << account_name
+ const std::string& account_name,
+ const std::string& password,
+ const std::string& voice_sip_uri_hostname,
+ const std::string& voice_account_server_uri)
+{
+ mVoiceSIPURIHostName = voice_sip_uri_hostname;
+ mVoiceAccountServerURI = voice_account_server_uri;
+
+ if(mAccountLoggedIn)
+ {
+ // Already logged in.
+ LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
+
+ // Don't process another login.
+ return;
+ }
+ else if ( account_name != mAccountName )
+ {
+ LL_WARNS("Voice") << "Mismatched account name! " << account_name
<< " instead of " << mAccountName << LL_ENDL;
- }
- else
- {
- mAccountPassword = password;
- }
-
- std::string debugSIPURIHostName = gSavedSettings.getString("VivoxDebugSIPURIHostName");
-
- if( !debugSIPURIHostName.empty() )
- {
+ }
+ else
+ {
+ mAccountPassword = password;
+ }
+
+ std::string debugSIPURIHostName = gSavedSettings.getString("VivoxDebugSIPURIHostName");
+
+ if( !debugSIPURIHostName.empty() )
+ {
LL_INFOS("Voice") << "Overriding account server based on VivoxDebugSIPURIHostName: "
<< debugSIPURIHostName << LL_ENDL;
- mVoiceSIPURIHostName = debugSIPURIHostName;
- }
-
- if( mVoiceSIPURIHostName.empty() )
- {
- // we have an empty account server name
- // so we fall back to hardcoded defaults
-
- if(LLGridManager::getInstance()->isInProductionGrid())
- {
- // Use the release account server
- mVoiceSIPURIHostName = "bhr.vivox.com";
- }
- else
- {
- // Use the development account server
- mVoiceSIPURIHostName = "bhd.vivox.com";
- }
+ mVoiceSIPURIHostName = debugSIPURIHostName;
+ }
+
+ if( mVoiceSIPURIHostName.empty() )
+ {
+ // we have an empty account server name
+ // so we fall back to hardcoded defaults
+
+ if(LLGridManager::getInstance()->isInProductionGrid())
+ {
+ // Use the release account server
+ mVoiceSIPURIHostName = "bhr.vivox.com";
+ }
+ else
+ {
+ // Use the development account server
+ mVoiceSIPURIHostName = "bhd.vivox.com";
+ }
LL_INFOS("Voice") << "Defaulting SIP URI host: "
<< mVoiceSIPURIHostName << LL_ENDL;
- }
-
- std::string debugAccountServerURI = gSavedSettings.getString("VivoxDebugVoiceAccountServerURI");
+ }
+
+ std::string debugAccountServerURI = gSavedSettings.getString("VivoxDebugVoiceAccountServerURI");
- if( !debugAccountServerURI.empty() )
- {
+ if( !debugAccountServerURI.empty() )
+ {
LL_INFOS("Voice") << "Overriding account server based on VivoxDebugVoiceAccountServerURI: "
<< debugAccountServerURI << LL_ENDL;
- mVoiceAccountServerURI = debugAccountServerURI;
- }
-
- if( mVoiceAccountServerURI.empty() )
- {
- // If the account server URI isn't specified, construct it from the SIP URI hostname
- mVoiceAccountServerURI = "https://www." + mVoiceSIPURIHostName + "/api2/";
+ mVoiceAccountServerURI = debugAccountServerURI;
+ }
+
+ if( mVoiceAccountServerURI.empty() )
+ {
+ // If the account server URI isn't specified, construct it from the SIP URI hostname
+ mVoiceAccountServerURI = "https://www." + mVoiceSIPURIHostName + "/api2/";
LL_INFOS("Voice") << "Inferring account server based on SIP URI Host name: "
<< mVoiceAccountServerURI << LL_ENDL;
- }
+ }
}
void LLVivoxVoiceClient::idle(void* user_data)
@@ -663,11 +663,11 @@ void LLVivoxVoiceClient::idle(void* user_data)
}
//=========================================================================
-// the following are methods to support the coroutine implementation of the
-// voice connection and processing. They should only be called in the context
+// the following are methods to support the coroutine implementation of the
+// voice connection and processing. They should only be called in the context
// of a coroutine.
-//
-//
+//
+//
typedef enum e_voice_control_coro_state
{
@@ -816,7 +816,7 @@ void LLVivoxVoiceClient::voiceControlStateMachine(S32 &coro_state)
case VOICE_STATE_SESSION_ESTABLISHED:
{
- // enable/disable the automatic VAD and explicitly set the initial values of
+ // enable/disable the automatic VAD and explicitly set the initial values of
// the VAD variables ourselves when it is off - see SL-15072 for more details
// note: we set the other parameters too even if the auto VAD is on which is ok
unsigned int vad_auto = gSavedSettings.getU32("VivoxVadAuto");
@@ -1011,7 +1011,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
{
LLFile::rename(new_log, old_log);
}
-
+
if (!shutdown_timeout().empty())
{
params.args.add("-st");
@@ -1091,7 +1091,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
llcoro::suspendUntilTimeout(DAEMON_CONNECT_THROTTLE_SECONDS);
}
}
-
+
//---------------------------------------------------------------------
if (sShuttingDown && !sConnected)
{
@@ -1109,7 +1109,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
{
return false;
}
-
+
// MBW -- Note to self: pumps and pipes examples in
// indra/test/io.cpp
// indra/test/llpipeutil.{cpp|h}
@@ -1147,7 +1147,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
// *TODO* Pump a message for wake up.
llcoro::suspend();
}
-
+
if (sShuttingDown)
{
return false;
@@ -1199,7 +1199,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
else
{
provisioned = true;
- }
+ }
} while (!provisioned && ++retryCount <= PROVISION_RETRY_MAX && !sShuttingDown);
if (sShuttingDown && !provisioned)
@@ -1223,7 +1223,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
{
voiceSipUriHostname = result["voice_sip_uri_hostname"].asString();
}
-
+
// this key is actually misnamed -- it will be an entire URI, not just a hostname.
if (result.has("voice_account_server_name"))
{
@@ -1254,7 +1254,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection()
{
return false;
}
-
+
LLSD result;
bool connected(false);
bool giving_up(false);
@@ -1356,7 +1356,7 @@ bool LLVivoxVoiceClient::breakVoiceConnection(bool corowait)
}
LL_DEBUGS("Voice") << "closing SLVoice socket" << LL_ENDL;
- closeSocket(); // Need to do this now -- bad things happen if the destructor does it later.
+ closeSocket(); // Need to do this now -- bad things happen if the destructor does it later.
cleanUp();
sConnected = false;
@@ -1373,7 +1373,7 @@ bool LLVivoxVoiceClient::loginToVivox()
bool account_login(false);
bool send_login(true);
- do
+ do
{
mIsLoggingIn = true;
if (send_login)
@@ -1381,7 +1381,7 @@ bool LLVivoxVoiceClient::loginToVivox()
loginSendMessage();
send_login = false;
}
-
+
LLSD result = llcoro::suspendUntilEventOnWithTimeout(mVivoxPump, LOGIN_ATTEMPT_TIMEOUT, timeoutResult);
if (sShuttingDown)
@@ -1421,7 +1421,7 @@ bool LLVivoxVoiceClient::loginToVivox()
// tell the user there is a problem
LL_WARNS("Voice") << "login " << loginresp << " will retry login in " << timeout << " seconds." << LL_ENDL;
-
+
if (!sShuttingDown)
{
// Todo: this is way to long, viewer can get stuck waiting during shutdown
@@ -1526,7 +1526,7 @@ bool LLVivoxVoiceClient::retrieveVoiceFonts()
mIsWaitingForFonts = true;
LLSD result;
- do
+ do
{
result = llcoro::suspendUntilEventOn(mVivoxPump);
@@ -1561,7 +1561,7 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo()
LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest capability not available in this region" << LL_ENDL;
return false;
}
-
+
// update the parcel
checkParcelChanged(true);
@@ -1624,7 +1624,7 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo()
{
LL_WARNS("Voice") << "No voice channel uri" << LL_ENDL;
}
-
+
if (voice_credentials.has("channel_credentials"))
{
LL_DEBUGS("Voice") << "got voice channel credentials" << LL_ENDL;
@@ -1662,7 +1662,7 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo()
}
}
- // set the spatial channel. If no voice credentials or uri are
+ // set the spatial channel. If no voice credentials or uri are
// available, then we simply drop out of voice spatially.
return !setSpatialChannel(uri, credentials);
}
@@ -1717,7 +1717,7 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession)
notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
LL_WARNS() << "There seems to be problem with connection to voice server. Disabling voice chat abilities." << LL_ENDL;
}
-
+
// Increase mSpatialJoiningNum only for spatial sessions- it's normal to reach this case for
// example for p2p many times while waiting for response, so it can't be used to detect errors
if (mAudioSession && mAudioSession->mIsSpatial)
@@ -1759,8 +1759,8 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession)
LLSD timeoutResult(LLSDMap("session", "timeout"));
- // We are about to start a whole new session. Anything that MIGHT still be in our
- // maildrop is going to be stale and cause us much wailing and gnashing of teeth.
+ // We are about to start a whole new session. Anything that MIGHT still be in our
+ // maildrop is going to be stale and cause us much wailing and gnashing of teeth.
// Just flush it all out and start new.
mVivoxPump.discard();
@@ -1803,25 +1803,25 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession)
}
else if ((message == "failed") || (message == "removed") || (message == "timeout"))
{ // we will get a removed message if a voice call is declined.
-
- if (message == "failed")
+
+ if (message == "failed")
{
int reason = result["reason"].asInteger();
LL_WARNS("Voice") << "Add and join failed for reason " << reason << LL_ENDL;
-
+
if ( (reason == ERROR_VIVOX_NOT_LOGGED_IN)
|| (reason == ERROR_VIVOX_OBJECT_NOT_FOUND))
{
LL_DEBUGS("Voice") << "Requesting reprovision and login." << LL_ENDL;
requestRelog();
- }
+ }
}
else
{
LL_WARNS("Voice") << "session '" << message << "' "
<< LL_ENDL;
}
-
+
notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
mIsJoiningSession = false;
return false;
@@ -1840,8 +1840,8 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession)
// Events that need to happen when a session is joined could go here.
// send an initial positional information immediately upon joining.
- //
- // do an initial update for position and the camera position, then send a
+ //
+ // do an initial update for position and the camera position, then send a
// positional update.
updatePosition();
enforceTether();
@@ -1877,7 +1877,7 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
{
time_t now = time(NULL);
const size_t BUF_SIZE = 64;
- char time_str[BUF_SIZE]; /* Flawfinder: ignore */
+ char time_str[BUF_SIZE]; /* Flawfinder: ignore */
strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
savepath += time_str;
@@ -1948,7 +1948,7 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
// Always reset the terminate request flag when we get here.
- // Some slower PCs have a race condition where they can switch to an incoming P2P call faster than the state machine leaves
+ // Some slower PCs have a race condition where they can switch to an incoming P2P call faster than the state machine leaves
// the region chat.
mSessionTerminateRequested = false;
@@ -1983,7 +1983,7 @@ bool LLVivoxVoiceClient::waitForChannel()
EVoiceWaitForChannelState state = VOICE_CHANNEL_STATE_LOGIN;
- do
+ do
{
if (sShuttingDown)
{
@@ -2166,10 +2166,10 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
LL_DEBUGS("Voice") << "runSession terminate requested " << LL_ENDL;
terminateAudioSession(true);
}
- // if a relog has been requested then addAndJoineSession
+ // if a relog has been requested then addAndJoineSession
// failed in a spectacular way and we need to back out.
// If this is not the case then we were simply trying to
- // make a call and the other party rejected it.
+ // make a call and the other party rejected it.
return !mRelogRequested;
}
@@ -2204,7 +2204,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
mAudioSession->mParticipantsChanged = false;
notifyParticipantObservers();
}
-
+
if (!inSpatialChannel())
{
// When in a non-spatial channel, never send positional updates.
@@ -2216,9 +2216,9 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
if (checkParcelChanged())
{
- // *RIDER: I think I can just return here if the parcel has changed
+ // *RIDER: I think I can just return here if the parcel has changed
// and grab the new voice channel from the outside loop.
- //
+ //
// if the parcel has changed, attempted to request the
// cap for the parcel voice info. If we can't request it
// then we don't have the cap URL so we do nothing and will
@@ -2261,7 +2261,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;
}
if (result.has("session"))
- {
+ {
if (result.has("handle"))
{
if (!mAudioSession)
@@ -2366,7 +2366,7 @@ void LLVivoxVoiceClient::recordingAndPlaybackMode()
int LLVivoxVoiceClient::voiceRecordBuffer()
{
- LLSD timeoutResult(LLSDMap("recplay", "stop"));
+ LLSD timeoutResult(LLSDMap("recplay", "stop"));
LL_INFOS("Voice") << "Recording voice buffer" << LL_ENDL;
@@ -2461,7 +2461,7 @@ bool LLVivoxVoiceClient::performMicTuning()
}
// loop mic back to render device.
- //setMuteMic(0); // make sure the mic is not muted
+ //setMuteMic(0); // make sure the mic is not muted
std::ostringstream stream;
stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
@@ -2538,397 +2538,397 @@ bool LLVivoxVoiceClient::performMicTuning()
void LLVivoxVoiceClient::closeSocket(void)
{
- mSocket.reset();
+ mSocket.reset();
sConnected = false;
- mConnectorEstablished = false;
- mAccountLoggedIn = false;
+ mConnectorEstablished = false;
+ mAccountLoggedIn = false;
}
void LLVivoxVoiceClient::loginSendMessage()
{
- std::ostringstream stream;
+ std::ostringstream stream;
- bool autoPostCrashDumps = gSavedSettings.getBOOL("VivoxAutoPostCrashDumps");
+ bool autoPostCrashDumps = gSavedSettings.getBOOL("VivoxAutoPostCrashDumps");
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Login.1\">"
- << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
- << "<AccountName>" << mAccountName << "</AccountName>"
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Login.1\">"
+ << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
+ << "<AccountName>" << mAccountName << "</AccountName>"
<< "<AccountPassword>" << mAccountPassword << "</AccountPassword>"
<< "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
- << "<AudioSessionAnswerMode>VerifyAnswer</AudioSessionAnswerMode>"
- << "<EnableBuddiesAndPresence>false</EnableBuddiesAndPresence>"
- << "<EnablePresencePersistence>0</EnablePresencePersistence>"
- << "<BuddyManagementMode>Application</BuddyManagementMode>"
- << "<ParticipantPropertyFrequency>5</ParticipantPropertyFrequency>"
- << (autoPostCrashDumps?"<AutopostCrashDumps>true</AutopostCrashDumps>":"")
- << "</Request>\n\n\n";
+ << "<AudioSessionAnswerMode>VerifyAnswer</AudioSessionAnswerMode>"
+ << "<EnableBuddiesAndPresence>false</EnableBuddiesAndPresence>"
+ << "<EnablePresencePersistence>0</EnablePresencePersistence>"
+ << "<BuddyManagementMode>Application</BuddyManagementMode>"
+ << "<ParticipantPropertyFrequency>5</ParticipantPropertyFrequency>"
+ << (autoPostCrashDumps?"<AutopostCrashDumps>true</AutopostCrashDumps>":"")
+ << "</Request>\n\n\n";
LL_INFOS("Voice") << "Attempting voice login" << LL_ENDL;
- writeString(stream.str());
+ writeString(stream.str());
}
void LLVivoxVoiceClient::logout()
{
- // Ensure that we'll re-request provisioning before logging in again
- mAccountPassword.clear();
- mVoiceAccountServerURI.clear();
-
- logoutSendMessage();
+ // Ensure that we'll re-request provisioning before logging in again
+ mAccountPassword.clear();
+ mVoiceAccountServerURI.clear();
+
+ logoutSendMessage();
}
void LLVivoxVoiceClient::logoutSendMessage()
{
- if(mAccountLoggedIn)
- {
+ if(mAccountLoggedIn)
+ {
LL_INFOS("Voice") << "Attempting voice logout" << LL_ENDL;
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Logout.1\">"
- << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
- << "</Request>"
- << "\n\n\n";
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Logout.1\">"
+ << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
+ << "</Request>"
+ << "\n\n\n";
- mAccountLoggedIn = false;
+ mAccountLoggedIn = false;
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::sessionGroupCreateSendMessage()
{
- if(mAccountLoggedIn)
- {
- std::ostringstream stream;
+ if(mAccountLoggedIn)
+ {
+ std::ostringstream stream;
- LL_DEBUGS("Voice") << "creating session group" << LL_ENDL;
+ LL_DEBUGS("Voice") << "creating session group" << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Create.1\">"
- << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
- << "<Type>Normal</Type>"
- << "</Request>"
- << "\n\n\n";
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Create.1\">"
+ << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
+ << "<Type>Normal</Type>"
+ << "</Request>"
+ << "\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::sessionCreateSendMessage(const sessionStatePtr_t &session, bool startAudio, bool startText)
{
- S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
- LL_DEBUGS("Voice") << "Requesting create: " << session->mSIPURI
+ S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
+ LL_DEBUGS("Voice") << "Requesting create: " << session->mSIPURI
<< " with voice font: " << session->mVoiceFontID << " (" << font_index << ")"
<< LL_ENDL;
- session->mCreateInProgress = true;
- if(startAudio)
- {
- session->mMediaConnectInProgress = true;
- }
-
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << session->mSIPURI << "\" action=\"Session.Create.1\">"
- << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
- << "<URI>" << session->mSIPURI << "</URI>";
-
- static const std::string allowed_chars =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
- "0123456789"
- "-._~";
-
- if(!session->mHash.empty())
- {
- stream
- << "<Password>" << LLURI::escape(session->mHash, allowed_chars) << "</Password>"
- << "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>";
- }
-
- stream
- << "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
- << "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
- << "<VoiceFontID>" << font_index << "</VoiceFontID>"
- << "<Name>" << mChannelName << "</Name>"
- << "</Request>\n\n\n";
- writeString(stream.str());
+ session->mCreateInProgress = true;
+ if(startAudio)
+ {
+ session->mMediaConnectInProgress = true;
+ }
+
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << session->mSIPURI << "\" action=\"Session.Create.1\">"
+ << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
+ << "<URI>" << session->mSIPURI << "</URI>";
+
+ static const std::string allowed_chars =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+ "0123456789"
+ "-._~";
+
+ if(!session->mHash.empty())
+ {
+ stream
+ << "<Password>" << LLURI::escape(session->mHash, allowed_chars) << "</Password>"
+ << "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>";
+ }
+
+ stream
+ << "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+ << "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+ << "<VoiceFontID>" << font_index << "</VoiceFontID>"
+ << "<Name>" << mChannelName << "</Name>"
+ << "</Request>\n\n\n";
+ writeString(stream.str());
}
void LLVivoxVoiceClient::sessionGroupAddSessionSendMessage(const sessionStatePtr_t &session, bool startAudio, bool startText)
{
- LL_DEBUGS("Voice") << "Requesting create: " << session->mSIPURI << LL_ENDL;
-
- S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
- LL_DEBUGS("Voice") << "With voice font: " << session->mVoiceFontID << " (" << font_index << ")" << LL_ENDL;
-
- session->mCreateInProgress = true;
- if(startAudio)
- {
- session->mMediaConnectInProgress = true;
- }
-
- std::string password;
- if(!session->mHash.empty())
- {
- static const std::string allowed_chars =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
- "0123456789"
- "-._~"
- ;
- password = LLURI::escape(session->mHash, allowed_chars);
- }
-
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << session->mSIPURI << "\" action=\"SessionGroup.AddSession.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "<URI>" << session->mSIPURI << "</URI>"
- << "<Name>" << mChannelName << "</Name>"
- << "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
- << "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
- << "<VoiceFontID>" << font_index << "</VoiceFontID>"
- << "<Password>" << password << "</Password>"
- << "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>"
- << "</Request>\n\n\n"
- ;
-
- writeString(stream.str());
+ LL_DEBUGS("Voice") << "Requesting create: " << session->mSIPURI << LL_ENDL;
+
+ S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
+ LL_DEBUGS("Voice") << "With voice font: " << session->mVoiceFontID << " (" << font_index << ")" << LL_ENDL;
+
+ session->mCreateInProgress = true;
+ if(startAudio)
+ {
+ session->mMediaConnectInProgress = true;
+ }
+
+ std::string password;
+ if(!session->mHash.empty())
+ {
+ static const std::string allowed_chars =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+ "0123456789"
+ "-._~"
+ ;
+ password = LLURI::escape(session->mHash, allowed_chars);
+ }
+
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << session->mSIPURI << "\" action=\"SessionGroup.AddSession.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "<URI>" << session->mSIPURI << "</URI>"
+ << "<Name>" << mChannelName << "</Name>"
+ << "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+ << "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+ << "<VoiceFontID>" << font_index << "</VoiceFontID>"
+ << "<Password>" << password << "</Password>"
+ << "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>"
+ << "</Request>\n\n\n"
+ ;
+
+ writeString(stream.str());
}
void LLVivoxVoiceClient::sessionMediaConnectSendMessage(const sessionStatePtr_t &session)
{
- S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
- LL_DEBUGS("Voice") << "Connecting audio to session handle: " << session->mHandle
+ S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
+ LL_DEBUGS("Voice") << "Connecting audio to session handle: " << session->mHandle
<< " with voice font: " << session->mVoiceFontID << " (" << font_index << ")"
<< LL_ENDL;
- session->mMediaConnectInProgress = true;
-
- std::ostringstream stream;
+ session->mMediaConnectInProgress = true;
- stream
- << "<Request requestId=\"" << session->mHandle << "\" action=\"Session.MediaConnect.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "<VoiceFontID>" << font_index << "</VoiceFontID>"
- << "<Media>Audio</Media>"
- << "</Request>\n\n\n";
+ std::ostringstream stream;
+
+ stream
+ << "<Request requestId=\"" << session->mHandle << "\" action=\"Session.MediaConnect.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "<VoiceFontID>" << font_index << "</VoiceFontID>"
+ << "<Media>Audio</Media>"
+ << "</Request>\n\n\n";
- writeString(stream.str());
+ writeString(stream.str());
}
void LLVivoxVoiceClient::sessionTextConnectSendMessage(const sessionStatePtr_t &session)
{
- LL_DEBUGS("Voice") << "connecting text to session handle: " << session->mHandle << LL_ENDL;
-
- std::ostringstream stream;
+ LL_DEBUGS("Voice") << "connecting text to session handle: " << session->mHandle << LL_ENDL;
+
+ std::ostringstream stream;
- stream
- << "<Request requestId=\"" << session->mHandle << "\" action=\"Session.TextConnect.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "</Request>\n\n\n";
+ stream
+ << "<Request requestId=\"" << session->mHandle << "\" action=\"Session.TextConnect.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "</Request>\n\n\n";
- writeString(stream.str());
+ writeString(stream.str());
}
void LLVivoxVoiceClient::sessionTerminate()
{
- mSessionTerminateRequested = true;
+ mSessionTerminateRequested = true;
}
void LLVivoxVoiceClient::requestRelog()
{
- mSessionTerminateRequested = true;
- mRelogRequested = true;
+ mSessionTerminateRequested = true;
+ mRelogRequested = true;
}
void LLVivoxVoiceClient::leaveAudioSession()
{
- if(mAudioSession)
- {
- LL_DEBUGS("Voice") << "leaving session: " << mAudioSession->mSIPURI << LL_ENDL;
+ if(mAudioSession)
+ {
+ LL_DEBUGS("Voice") << "leaving session: " << mAudioSession->mSIPURI << LL_ENDL;
- if(!mAudioSession->mHandle.empty())
- {
+ if(!mAudioSession->mHandle.empty())
+ {
#if RECORD_EVERYTHING
- // HACK: for testing only
- // Save looped recording
- std::string savepath("/tmp/vivoxrecording");
- {
- time_t now = time(NULL);
- const size_t BUF_SIZE = 64;
- char time_str[BUF_SIZE]; /* Flawfinder: ignore */
-
- strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
- savepath += time_str;
- }
- recordingLoopSave(savepath);
+ // HACK: for testing only
+ // Save looped recording
+ std::string savepath("/tmp/vivoxrecording");
+ {
+ time_t now = time(NULL);
+ const size_t BUF_SIZE = 64;
+ char time_str[BUF_SIZE]; /* Flawfinder: ignore */
+
+ strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
+ savepath += time_str;
+ }
+ recordingLoopSave(savepath);
#endif
- sessionMediaDisconnectSendMessage(mAudioSession);
- }
- else
- {
- LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS("Voice") << "called with no active session" << LL_ENDL;
- }
+ sessionMediaDisconnectSendMessage(mAudioSession);
+ }
+ else
+ {
+ LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("Voice") << "called with no active session" << LL_ENDL;
+ }
sessionTerminate();
}
void LLVivoxVoiceClient::sessionTerminateSendMessage(const sessionStatePtr_t &session)
{
- std::ostringstream stream;
+ std::ostringstream stream;
- sessionGroupTerminateSendMessage(session);
- return;
- /*
- LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Terminate.1\">"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
- */
+ sessionGroupTerminateSendMessage(session);
+ return;
+ /*
+ LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Terminate.1\">"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+ */
}
void LLVivoxVoiceClient::sessionGroupTerminateSendMessage(const sessionStatePtr_t &session)
{
- std::ostringstream stream;
-
- LL_DEBUGS("Voice") << "Sending SessionGroup.Terminate with handle " << session->mGroupHandle << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Terminate.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ std::ostringstream stream;
+
+ LL_DEBUGS("Voice") << "Sending SessionGroup.Terminate with handle " << session->mGroupHandle << LL_ENDL;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Terminate.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
}
void LLVivoxVoiceClient::sessionMediaDisconnectSendMessage(const sessionStatePtr_t &session)
{
- std::ostringstream stream;
- sessionGroupTerminateSendMessage(session);
- return;
- /*
- LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.MediaDisconnect.1\">"
- << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "<Media>Audio</Media>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
- */
-
+ std::ostringstream stream;
+ sessionGroupTerminateSendMessage(session);
+ return;
+ /*
+ LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.MediaDisconnect.1\">"
+ << "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "<Media>Audio</Media>"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+ */
+
}
void LLVivoxVoiceClient::getCaptureDevicesSendMessage()
{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetCaptureDevices.1\">"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetCaptureDevices.1\">"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
}
void LLVivoxVoiceClient::getRenderDevicesSendMessage()
{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetRenderDevices.1\">"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetRenderDevices.1\">"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
}
void LLVivoxVoiceClient::clearCaptureDevices()
{
- LL_DEBUGS("Voice") << "called" << LL_ENDL;
- mCaptureDevices.clear();
+ LL_DEBUGS("Voice") << "called" << LL_ENDL;
+ mCaptureDevices.clear();
}
void LLVivoxVoiceClient::addCaptureDevice(const LLVoiceDevice& device)
{
- LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL;
+ LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL;
mCaptureDevices.push_back(device);
}
LLVoiceDeviceList& LLVivoxVoiceClient::getCaptureDevices()
{
- return mCaptureDevices;
+ return mCaptureDevices;
}
void LLVivoxVoiceClient::setCaptureDevice(const std::string& name)
{
- if(name == "Default")
- {
- if(!mCaptureDevice.empty())
- {
- mCaptureDevice.clear();
- mCaptureDeviceDirty = true;
- }
- }
- else
- {
- if(mCaptureDevice != name)
- {
- mCaptureDevice = name;
- mCaptureDeviceDirty = true;
- }
- }
+ if(name == "Default")
+ {
+ if(!mCaptureDevice.empty())
+ {
+ mCaptureDevice.clear();
+ mCaptureDeviceDirty = true;
+ }
+ }
+ else
+ {
+ if(mCaptureDevice != name)
+ {
+ mCaptureDevice = name;
+ mCaptureDeviceDirty = true;
+ }
+ }
}
void LLVivoxVoiceClient::setDevicesListUpdated(bool state)
{
- mDevicesListUpdated = state;
+ mDevicesListUpdated = state;
}
void LLVivoxVoiceClient::clearRenderDevices()
-{
- LL_DEBUGS("Voice") << "called" << LL_ENDL;
- mRenderDevices.clear();
+{
+ LL_DEBUGS("Voice") << "called" << LL_ENDL;
+ mRenderDevices.clear();
}
void LLVivoxVoiceClient::addRenderDevice(const LLVoiceDevice& device)
{
- LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL;
+ LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL;
mRenderDevices.push_back(device);
}
LLVoiceDeviceList& LLVivoxVoiceClient::getRenderDevices()
{
- return mRenderDevices;
+ return mRenderDevices;
}
void LLVivoxVoiceClient::setRenderDevice(const std::string& name)
{
- if(name == "Default")
- {
- if(!mRenderDevice.empty())
- {
- mRenderDevice.clear();
- mRenderDeviceDirty = true;
- }
- }
- else
- {
- if(mRenderDevice != name)
- {
- mRenderDevice = name;
- mRenderDeviceDirty = true;
- }
- }
-
+ if(name == "Default")
+ {
+ if(!mRenderDevice.empty())
+ {
+ mRenderDevice.clear();
+ mRenderDeviceDirty = true;
+ }
+ }
+ else
+ {
+ if(mRenderDevice != name)
+ {
+ mRenderDevice = name;
+ mRenderDeviceDirty = true;
+ }
+ }
+
}
void LLVivoxVoiceClient::tuningStart()
@@ -2941,15 +2941,15 @@ void LLVivoxVoiceClient::tuningStart()
boost::bind(&LLVivoxVoiceClient::voiceControlCoro, LLVivoxVoiceClient::getInstance()));
}
else if (mIsInChannel)
- {
- LL_DEBUGS("Voice") << "no channel" << LL_ENDL;
- sessionTerminate();
- }
+ {
+ LL_DEBUGS("Voice") << "no channel" << LL_ENDL;
+ sessionTerminate();
+ }
}
void LLVivoxVoiceClient::tuningStop()
{
- mTuningMode = false;
+ mTuningMode = false;
}
bool LLVivoxVoiceClient::inTuningMode()
@@ -2958,252 +2958,252 @@ bool LLVivoxVoiceClient::inTuningMode()
}
void LLVivoxVoiceClient::tuningRenderStartSendMessage(const std::string& name, bool loop)
-{
- mTuningAudioFile = name;
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStart.1\">"
+{
+ mTuningAudioFile = name;
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStart.1\">"
<< "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
<< "<Loop>" << (loop?"1":"0") << "</Loop>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
}
void LLVivoxVoiceClient::tuningRenderStopSendMessage()
{
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
<< "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
}
void LLVivoxVoiceClient::tuningCaptureStartSendMessage(int loop)
{
- LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
-
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStart.1\">"
- << "<Duration>-1</Duration>"
+ LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
+
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStart.1\">"
+ << "<Duration>-1</Duration>"
<< "<LoopToRenderDevice>" << loop << "</LoopToRenderDevice>"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
}
void LLVivoxVoiceClient::tuningCaptureStopSendMessage()
{
- LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
-
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
- << "</Request>\n\n\n";
-
- writeString(stream.str());
+ LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
- mTuningEnergy = 0.0f;
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
+ << "</Request>\n\n\n";
+
+ writeString(stream.str());
+
+ mTuningEnergy = 0.0f;
}
void LLVivoxVoiceClient::tuningSetMicVolume(float volume)
{
- int scaled_volume = scale_mic_volume(volume);
+ int scaled_volume = scale_mic_volume(volume);
- if(scaled_volume != mTuningMicVolume)
- {
- mTuningMicVolume = scaled_volume;
- mTuningMicVolumeDirty = true;
- }
+ if(scaled_volume != mTuningMicVolume)
+ {
+ mTuningMicVolume = scaled_volume;
+ mTuningMicVolumeDirty = true;
+ }
}
void LLVivoxVoiceClient::tuningSetSpeakerVolume(float volume)
{
- int scaled_volume = scale_speaker_volume(volume);
+ int scaled_volume = scale_speaker_volume(volume);
- if(scaled_volume != mTuningSpeakerVolume)
- {
- mTuningSpeakerVolume = scaled_volume;
- mTuningSpeakerVolumeDirty = true;
- }
+ if(scaled_volume != mTuningSpeakerVolume)
+ {
+ mTuningSpeakerVolume = scaled_volume;
+ mTuningSpeakerVolumeDirty = true;
+ }
}
-
+
float LLVivoxVoiceClient::tuningGetEnergy(void)
{
- return mTuningEnergy;
+ return mTuningEnergy;
}
bool LLVivoxVoiceClient::deviceSettingsAvailable()
{
- bool result = true;
-
- if(!sConnected)
- result = false;
-
- if(mRenderDevices.empty())
- result = false;
-
- return result;
+ bool result = true;
+
+ if(!sConnected)
+ result = false;
+
+ if(mRenderDevices.empty())
+ result = false;
+
+ return result;
}
bool LLVivoxVoiceClient::deviceSettingsUpdated()
{
bool updated = mDevicesListUpdated;
- if (mDevicesListUpdated)
- {
- // a hot swap event or a polling of the audio devices has been parsed since the last redraw of the input and output device panel.
- mDevicesListUpdated = false; // toggle the setting
- }
- return updated;
+ if (mDevicesListUpdated)
+ {
+ // a hot swap event or a polling of the audio devices has been parsed since the last redraw of the input and output device panel.
+ mDevicesListUpdated = false; // toggle the setting
+ }
+ return updated;
}
void LLVivoxVoiceClient::refreshDeviceLists(bool clearCurrentList)
{
- if(clearCurrentList)
- {
- clearCaptureDevices();
- clearRenderDevices();
- }
- getCaptureDevicesSendMessage();
- getRenderDevicesSendMessage();
+ if(clearCurrentList)
+ {
+ clearCaptureDevices();
+ clearRenderDevices();
+ }
+ getCaptureDevicesSendMessage();
+ getRenderDevicesSendMessage();
}
void LLVivoxVoiceClient::daemonDied()
{
- // The daemon died, so the connection is gone. Reset everything and start over.
- LL_WARNS("Voice") << "Connection to vivox daemon lost. Resetting state."<< LL_ENDL;
+ // The daemon died, so the connection is gone. Reset everything and start over.
+ LL_WARNS("Voice") << "Connection to vivox daemon lost. Resetting state."<< LL_ENDL;
- //TODO: Try to relaunch the daemon
+ //TODO: Try to relaunch the daemon
}
void LLVivoxVoiceClient::giveUp()
{
- // All has failed. Clean up and stop trying.
+ // All has failed. Clean up and stop trying.
LL_WARNS("Voice") << "Terminating Voice Service" << LL_ENDL;
- closeSocket();
- cleanUp();
+ closeSocket();
+ cleanUp();
}
static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVector3d &pos, LLVector3 &vel)
{
- F32 nat[3], nup[3], nl[3]; // the new at, up, left vectors and the new position and velocity
-// F32 nvel[3];
- F64 npos[3];
-
- // The original XML command was sent like this:
- /*
- << "<Position>"
- << "<X>" << pos[VX] << "</X>"
- << "<Y>" << pos[VZ] << "</Y>"
- << "<Z>" << pos[VY] << "</Z>"
- << "</Position>"
- << "<Velocity>"
- << "<X>" << mAvatarVelocity[VX] << "</X>"
- << "<Y>" << mAvatarVelocity[VZ] << "</Y>"
- << "<Z>" << mAvatarVelocity[VY] << "</Z>"
- << "</Velocity>"
- << "<AtOrientation>"
- << "<X>" << l.mV[VX] << "</X>"
- << "<Y>" << u.mV[VX] << "</Y>"
- << "<Z>" << a.mV[VX] << "</Z>"
- << "</AtOrientation>"
- << "<UpOrientation>"
- << "<X>" << l.mV[VZ] << "</X>"
- << "<Y>" << u.mV[VY] << "</Y>"
- << "<Z>" << a.mV[VZ] << "</Z>"
- << "</UpOrientation>"
- << "<LeftOrientation>"
- << "<X>" << l.mV [VY] << "</X>"
- << "<Y>" << u.mV [VZ] << "</Y>"
- << "<Z>" << a.mV [VY] << "</Z>"
- << "</LeftOrientation>";
- */
+ F32 nat[3], nup[3], nl[3]; // the new at, up, left vectors and the new position and velocity
+// F32 nvel[3];
+ F64 npos[3];
+
+ // The original XML command was sent like this:
+ /*
+ << "<Position>"
+ << "<X>" << pos[VX] << "</X>"
+ << "<Y>" << pos[VZ] << "</Y>"
+ << "<Z>" << pos[VY] << "</Z>"
+ << "</Position>"
+ << "<Velocity>"
+ << "<X>" << mAvatarVelocity[VX] << "</X>"
+ << "<Y>" << mAvatarVelocity[VZ] << "</Y>"
+ << "<Z>" << mAvatarVelocity[VY] << "</Z>"
+ << "</Velocity>"
+ << "<AtOrientation>"
+ << "<X>" << l.mV[VX] << "</X>"
+ << "<Y>" << u.mV[VX] << "</Y>"
+ << "<Z>" << a.mV[VX] << "</Z>"
+ << "</AtOrientation>"
+ << "<UpOrientation>"
+ << "<X>" << l.mV[VZ] << "</X>"
+ << "<Y>" << u.mV[VY] << "</Y>"
+ << "<Z>" << a.mV[VZ] << "</Z>"
+ << "</UpOrientation>"
+ << "<LeftOrientation>"
+ << "<X>" << l.mV [VY] << "</X>"
+ << "<Y>" << u.mV [VZ] << "</Y>"
+ << "<Z>" << a.mV [VY] << "</Z>"
+ << "</LeftOrientation>";
+ */
#if 1
- // This was the original transform done when building the XML command
- nat[0] = left.mV[VX];
- nat[1] = up.mV[VX];
- nat[2] = at.mV[VX];
-
- nup[0] = left.mV[VZ];
- nup[1] = up.mV[VY];
- nup[2] = at.mV[VZ];
-
- nl[0] = left.mV[VY];
- nl[1] = up.mV[VZ];
- nl[2] = at.mV[VY];
-
- npos[0] = pos.mdV[VX];
- npos[1] = pos.mdV[VZ];
- npos[2] = pos.mdV[VY];
-
-// nvel[0] = vel.mV[VX];
-// nvel[1] = vel.mV[VZ];
-// nvel[2] = vel.mV[VY];
-
- for(int i=0;i<3;++i) {
- at.mV[i] = nat[i];
- up.mV[i] = nup[i];
- left.mV[i] = nl[i];
- pos.mdV[i] = npos[i];
- }
-
- // This was the original transform done in the SDK
- nat[0] = at.mV[2];
- nat[1] = 0; // y component of at vector is always 0, this was up[2]
- nat[2] = -1 * left.mV[2];
-
- // We override whatever the application gives us
- nup[0] = 0; // x component of up vector is always 0
- nup[1] = 1; // y component of up vector is always 1
- nup[2] = 0; // z component of up vector is always 0
-
- nl[0] = at.mV[0];
- nl[1] = 0; // y component of left vector is always zero, this was up[0]
- nl[2] = -1 * left.mV[0];
-
- npos[2] = pos.mdV[2] * -1.0;
- npos[1] = pos.mdV[1];
- npos[0] = pos.mdV[0];
-
- for(int i=0;i<3;++i) {
- at.mV[i] = nat[i];
- up.mV[i] = nup[i];
- left.mV[i] = nl[i];
- pos.mdV[i] = npos[i];
- }
+ // This was the original transform done when building the XML command
+ nat[0] = left.mV[VX];
+ nat[1] = up.mV[VX];
+ nat[2] = at.mV[VX];
+
+ nup[0] = left.mV[VZ];
+ nup[1] = up.mV[VY];
+ nup[2] = at.mV[VZ];
+
+ nl[0] = left.mV[VY];
+ nl[1] = up.mV[VZ];
+ nl[2] = at.mV[VY];
+
+ npos[0] = pos.mdV[VX];
+ npos[1] = pos.mdV[VZ];
+ npos[2] = pos.mdV[VY];
+
+// nvel[0] = vel.mV[VX];
+// nvel[1] = vel.mV[VZ];
+// nvel[2] = vel.mV[VY];
+
+ for(int i=0;i<3;++i) {
+ at.mV[i] = nat[i];
+ up.mV[i] = nup[i];
+ left.mV[i] = nl[i];
+ pos.mdV[i] = npos[i];
+ }
+
+ // This was the original transform done in the SDK
+ nat[0] = at.mV[2];
+ nat[1] = 0; // y component of at vector is always 0, this was up[2]
+ nat[2] = -1 * left.mV[2];
+
+ // We override whatever the application gives us
+ nup[0] = 0; // x component of up vector is always 0
+ nup[1] = 1; // y component of up vector is always 1
+ nup[2] = 0; // z component of up vector is always 0
+
+ nl[0] = at.mV[0];
+ nl[1] = 0; // y component of left vector is always zero, this was up[0]
+ nl[2] = -1 * left.mV[0];
+
+ npos[2] = pos.mdV[2] * -1.0;
+ npos[1] = pos.mdV[1];
+ npos[0] = pos.mdV[0];
+
+ for(int i=0;i<3;++i) {
+ at.mV[i] = nat[i];
+ up.mV[i] = nup[i];
+ left.mV[i] = nl[i];
+ pos.mdV[i] = npos[i];
+ }
#else
- // This is the compose of the two transforms (at least, that's what I'm trying for)
- nat[0] = at.mV[VX];
- nat[1] = 0; // y component of at vector is always 0, this was up[2]
- nat[2] = -1 * up.mV[VZ];
-
- // We override whatever the application gives us
- nup[0] = 0; // x component of up vector is always 0
- nup[1] = 1; // y component of up vector is always 1
- nup[2] = 0; // z component of up vector is always 0
-
- nl[0] = left.mV[VX];
- nl[1] = 0; // y component of left vector is always zero, this was up[0]
- nl[2] = -1 * left.mV[VY];
-
- npos[0] = pos.mdV[VX];
- npos[1] = pos.mdV[VZ];
- npos[2] = pos.mdV[VY] * -1.0;
-
- nvel[0] = vel.mV[VX];
- nvel[1] = vel.mV[VZ];
- nvel[2] = vel.mV[VY];
-
- for(int i=0;i<3;++i) {
- at.mV[i] = nat[i];
- up.mV[i] = nup[i];
- left.mV[i] = nl[i];
- pos.mdV[i] = npos[i];
- }
-
+ // This is the compose of the two transforms (at least, that's what I'm trying for)
+ nat[0] = at.mV[VX];
+ nat[1] = 0; // y component of at vector is always 0, this was up[2]
+ nat[2] = -1 * up.mV[VZ];
+
+ // We override whatever the application gives us
+ nup[0] = 0; // x component of up vector is always 0
+ nup[1] = 1; // y component of up vector is always 1
+ nup[2] = 0; // z component of up vector is always 0
+
+ nl[0] = left.mV[VX];
+ nl[1] = 0; // y component of left vector is always zero, this was up[0]
+ nl[2] = -1 * left.mV[VY];
+
+ npos[0] = pos.mdV[VX];
+ npos[1] = pos.mdV[VZ];
+ npos[2] = pos.mdV[VY] * -1.0;
+
+ nvel[0] = vel.mV[VX];
+ nvel[1] = vel.mV[VZ];
+ nvel[2] = vel.mV[VY];
+
+ for(int i=0;i<3;++i) {
+ at.mV[i] = nat[i];
+ up.mV[i] = nup[i];
+ left.mV[i] = nl[i];
+ pos.mdV[i] = npos[i];
+ }
+
#endif
}
@@ -3213,7 +3213,7 @@ void LLVivoxVoiceClient::setHidden(bool hidden)
if (mHidden && inSpatialChannel())
{
- // get out of the channel entirely
+ // get out of the channel entirely
leaveAudioSession();
}
else
@@ -3223,36 +3223,36 @@ void LLVivoxVoiceClient::setHidden(bool hidden)
}
void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void)
-{
- std::ostringstream stream;
-
- if (mSpatialCoordsDirty && inSpatialChannel())
- {
- LLVector3 l, u, a, vel;
- LLVector3d pos;
-
- mSpatialCoordsDirty = false;
-
- // Always send both speaker and listener positions together.
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Set3DPosition.1\">"
- << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>";
-
- stream << "<SpeakerPosition>";
+{
+ std::ostringstream stream;
+
+ if (mSpatialCoordsDirty && inSpatialChannel())
+ {
+ LLVector3 l, u, a, vel;
+ LLVector3d pos;
+
+ mSpatialCoordsDirty = false;
+
+ // Always send both speaker and listener positions together.
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Set3DPosition.1\">"
+ << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>";
+
+ stream << "<SpeakerPosition>";
LLMatrix3 avatarRot = mAvatarRot.getMatrix3();
-// LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
- l = avatarRot.getLeftRow();
- u = avatarRot.getUpRow();
- a = avatarRot.getFwdRow();
+// LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
+ l = avatarRot.getLeftRow();
+ u = avatarRot.getUpRow();
+ a = avatarRot.getFwdRow();
pos = mAvatarPosition;
- vel = mAvatarVelocity;
+ vel = mAvatarVelocity;
+
+ // SLIM SDK: the old SDK was doing a transform on the passed coordinates that the new one doesn't do anymore.
+ // The old transform is replicated by this function.
+ oldSDKTransform(l, u, a, pos, vel);
- // SLIM SDK: the old SDK was doing a transform on the passed coordinates that the new one doesn't do anymore.
- // The old transform is replicated by this function.
- oldSDKTransform(l, u, a, pos, vel);
-
if (mHidden)
{
for (int i=0;i<3;++i)
@@ -3260,75 +3260,75 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void)
pos.mdV[i] = VX_NULL_POSITION;
}
}
-
- stream
- << "<Position>"
- << "<X>" << pos.mdV[VX] << "</X>"
- << "<Y>" << pos.mdV[VY] << "</Y>"
- << "<Z>" << pos.mdV[VZ] << "</Z>"
- << "</Position>"
- << "<Velocity>"
- << "<X>" << vel.mV[VX] << "</X>"
- << "<Y>" << vel.mV[VY] << "</Y>"
- << "<Z>" << vel.mV[VZ] << "</Z>"
- << "</Velocity>"
- << "<AtOrientation>"
- << "<X>" << a.mV[VX] << "</X>"
- << "<Y>" << a.mV[VY] << "</Y>"
- << "<Z>" << a.mV[VZ] << "</Z>"
- << "</AtOrientation>"
- << "<UpOrientation>"
- << "<X>" << u.mV[VX] << "</X>"
- << "<Y>" << u.mV[VY] << "</Y>"
- << "<Z>" << u.mV[VZ] << "</Z>"
- << "</UpOrientation>"
- << "<LeftOrientation>"
- << "<X>" << l.mV [VX] << "</X>"
- << "<Y>" << l.mV [VY] << "</Y>"
- << "<Z>" << l.mV [VZ] << "</Z>"
- << "</LeftOrientation>"
+
+ stream
+ << "<Position>"
+ << "<X>" << pos.mdV[VX] << "</X>"
+ << "<Y>" << pos.mdV[VY] << "</Y>"
+ << "<Z>" << pos.mdV[VZ] << "</Z>"
+ << "</Position>"
+ << "<Velocity>"
+ << "<X>" << vel.mV[VX] << "</X>"
+ << "<Y>" << vel.mV[VY] << "</Y>"
+ << "<Z>" << vel.mV[VZ] << "</Z>"
+ << "</Velocity>"
+ << "<AtOrientation>"
+ << "<X>" << a.mV[VX] << "</X>"
+ << "<Y>" << a.mV[VY] << "</Y>"
+ << "<Z>" << a.mV[VZ] << "</Z>"
+ << "</AtOrientation>"
+ << "<UpOrientation>"
+ << "<X>" << u.mV[VX] << "</X>"
+ << "<Y>" << u.mV[VY] << "</Y>"
+ << "<Z>" << u.mV[VZ] << "</Z>"
+ << "</UpOrientation>"
+ << "<LeftOrientation>"
+ << "<X>" << l.mV [VX] << "</X>"
+ << "<Y>" << l.mV [VY] << "</Y>"
+ << "<Z>" << l.mV [VZ] << "</Z>"
+ << "</LeftOrientation>"
;
-
- stream << "</SpeakerPosition>";
-
- stream << "<ListenerPosition>";
-
- LLVector3d earPosition;
- LLVector3 earVelocity;
- LLMatrix3 earRot;
-
- switch(mEarLocation)
- {
- case earLocCamera:
- default:
- earPosition = mCameraPosition;
- earVelocity = mCameraVelocity;
- earRot = mCameraRot;
- break;
-
- case earLocAvatar:
- earPosition = mAvatarPosition;
- earVelocity = mAvatarVelocity;
- earRot = avatarRot;
- break;
-
- case earLocMixed:
- earPosition = mAvatarPosition;
- earVelocity = mAvatarVelocity;
- earRot = mCameraRot;
- break;
- }
-
- l = earRot.getLeftRow();
- u = earRot.getUpRow();
- a = earRot.getFwdRow();
+
+ stream << "</SpeakerPosition>";
+
+ stream << "<ListenerPosition>";
+
+ LLVector3d earPosition;
+ LLVector3 earVelocity;
+ LLMatrix3 earRot;
+
+ switch(mEarLocation)
+ {
+ case earLocCamera:
+ default:
+ earPosition = mCameraPosition;
+ earVelocity = mCameraVelocity;
+ earRot = mCameraRot;
+ break;
+
+ case earLocAvatar:
+ earPosition = mAvatarPosition;
+ earVelocity = mAvatarVelocity;
+ earRot = avatarRot;
+ break;
+
+ case earLocMixed:
+ earPosition = mAvatarPosition;
+ earVelocity = mAvatarVelocity;
+ earRot = mCameraRot;
+ break;
+ }
+
+ l = earRot.getLeftRow();
+ u = earRot.getUpRow();
+ a = earRot.getFwdRow();
pos = earPosition;
- vel = earVelocity;
+ vel = earVelocity;
+
+
+ oldSDKTransform(l, u, a, pos, vel);
-
- oldSDKTransform(l, u, a, pos, vel);
-
if (mHidden)
{
for (int i=0;i<3;++i)
@@ -3336,219 +3336,219 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void)
pos.mdV[i] = VX_NULL_POSITION;
}
}
-
- stream
- << "<Position>"
- << "<X>" << pos.mdV[VX] << "</X>"
- << "<Y>" << pos.mdV[VY] << "</Y>"
- << "<Z>" << pos.mdV[VZ] << "</Z>"
- << "</Position>"
- << "<Velocity>"
- << "<X>" << vel.mV[VX] << "</X>"
- << "<Y>" << vel.mV[VY] << "</Y>"
- << "<Z>" << vel.mV[VZ] << "</Z>"
- << "</Velocity>"
- << "<AtOrientation>"
- << "<X>" << a.mV[VX] << "</X>"
- << "<Y>" << a.mV[VY] << "</Y>"
- << "<Z>" << a.mV[VZ] << "</Z>"
- << "</AtOrientation>"
- << "<UpOrientation>"
- << "<X>" << u.mV[VX] << "</X>"
- << "<Y>" << u.mV[VY] << "</Y>"
- << "<Z>" << u.mV[VZ] << "</Z>"
- << "</UpOrientation>"
- << "<LeftOrientation>"
- << "<X>" << l.mV [VX] << "</X>"
- << "<Y>" << l.mV [VY] << "</Y>"
- << "<Z>" << l.mV [VZ] << "</Z>"
- << "</LeftOrientation>"
+
+ stream
+ << "<Position>"
+ << "<X>" << pos.mdV[VX] << "</X>"
+ << "<Y>" << pos.mdV[VY] << "</Y>"
+ << "<Z>" << pos.mdV[VZ] << "</Z>"
+ << "</Position>"
+ << "<Velocity>"
+ << "<X>" << vel.mV[VX] << "</X>"
+ << "<Y>" << vel.mV[VY] << "</Y>"
+ << "<Z>" << vel.mV[VZ] << "</Z>"
+ << "</Velocity>"
+ << "<AtOrientation>"
+ << "<X>" << a.mV[VX] << "</X>"
+ << "<Y>" << a.mV[VY] << "</Y>"
+ << "<Z>" << a.mV[VZ] << "</Z>"
+ << "</AtOrientation>"
+ << "<UpOrientation>"
+ << "<X>" << u.mV[VX] << "</X>"
+ << "<Y>" << u.mV[VY] << "</Y>"
+ << "<Z>" << u.mV[VZ] << "</Z>"
+ << "</UpOrientation>"
+ << "<LeftOrientation>"
+ << "<X>" << l.mV [VX] << "</X>"
+ << "<Y>" << l.mV [VY] << "</Y>"
+ << "<Z>" << l.mV [VZ] << "</Z>"
+ << "</LeftOrientation>"
;
- stream << "</ListenerPosition>";
-
- stream << "<ReqDispositionType>1</ReqDispositionType>"; //do not generate responses for update requests
- stream << "</Request>\n\n\n";
- }
-
- if(mAudioSession && (mAudioSession->mVolumeDirty || mAudioSession->mMuteDirty))
- {
- participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
-
- mAudioSession->mVolumeDirty = false;
- mAudioSession->mMuteDirty = false;
-
- for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
- {
- participantStatePtr_t p(iter->second);
-
- if(p->mVolumeDirty)
- {
- // Can't set volume/mute for yourself
- if(!p->mIsSelf)
- {
- // scale from the range 0.0-1.0 to vivox volume in the range 0-100
- S32 volume = ll_round(p->mVolume / VOLUME_SCALE_VIVOX);
- bool mute = p->mOnMuteList;
-
- if(mute)
- {
- // SetParticipantMuteForMe doesn't work in p2p sessions.
- // If we want the user to be muted, set their volume to 0 as well.
- // This isn't perfect, but it will at least reduce their volume to a minimum.
- volume = 0;
- // Mark the current volume level as set to prevent incoming events
- // changing it to 0, so that we can return to it when unmuting.
- p->mVolumeSet = true;
- }
-
- if(volume == 0)
- {
- mute = true;
- }
-
- LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
-
- // SLIM SDK: Send both volume and mute commands.
-
- // Send a "volume for me" command for the user.
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
- << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
- << "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
- << "<Volume>" << volume << "</Volume>"
- << "</Request>\n\n\n";
-
- if(!mAudioSession->mIsP2P)
- {
- // Send a "mute for me" command for the user
- // Doesn't work in P2P sessions
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantMuteForMe.1\">"
- << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
- << "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
- << "<Mute>" << (mute?"1":"0") << "</Mute>"
- << "<Scope>Audio</Scope>"
- << "</Request>\n\n\n";
- }
- }
-
- p->mVolumeDirty = false;
- }
- }
- }
+ stream << "</ListenerPosition>";
+
+ stream << "<ReqDispositionType>1</ReqDispositionType>"; //do not generate responses for update requests
+ stream << "</Request>\n\n\n";
+ }
+
+ if(mAudioSession && (mAudioSession->mVolumeDirty || mAudioSession->mMuteDirty))
+ {
+ participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+
+ mAudioSession->mVolumeDirty = false;
+ mAudioSession->mMuteDirty = false;
+
+ for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+ {
+ participantStatePtr_t p(iter->second);
+
+ if(p->mVolumeDirty)
+ {
+ // Can't set volume/mute for yourself
+ if(!p->mIsSelf)
+ {
+ // scale from the range 0.0-1.0 to vivox volume in the range 0-100
+ S32 volume = ll_round(p->mVolume / VOLUME_SCALE_VIVOX);
+ bool mute = p->mOnMuteList;
+
+ if(mute)
+ {
+ // SetParticipantMuteForMe doesn't work in p2p sessions.
+ // If we want the user to be muted, set their volume to 0 as well.
+ // This isn't perfect, but it will at least reduce their volume to a minimum.
+ volume = 0;
+ // Mark the current volume level as set to prevent incoming events
+ // changing it to 0, so that we can return to it when unmuting.
+ p->mVolumeSet = true;
+ }
+
+ if(volume == 0)
+ {
+ mute = true;
+ }
+
+ LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
+
+ // SLIM SDK: Send both volume and mute commands.
+
+ // Send a "volume for me" command for the user.
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
+ << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+ << "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+ << "<Volume>" << volume << "</Volume>"
+ << "</Request>\n\n\n";
+
+ if(!mAudioSession->mIsP2P)
+ {
+ // Send a "mute for me" command for the user
+ // Doesn't work in P2P sessions
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantMuteForMe.1\">"
+ << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+ << "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+ << "<Mute>" << (mute?"1":"0") << "</Mute>"
+ << "<Scope>Audio</Scope>"
+ << "</Request>\n\n\n";
+ }
+ }
+
+ p->mVolumeDirty = false;
+ }
+ }
+ }
std::string update(stream.str());
- if(!update.empty())
- {
+ if(!update.empty())
+ {
LL_DEBUGS("VoiceUpdate") << "sending update " << update << LL_ENDL;
- writeString(update);
- }
+ writeString(update);
+ }
}
void LLVivoxVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
{
- if(mCaptureDeviceDirty)
- {
- LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
- << "<CaptureDeviceSpecifier>" << mCaptureDevice << "</CaptureDeviceSpecifier>"
- << "</Request>"
- << "\n\n\n";
-
- mCaptureDeviceDirty = false;
- }
+ if(mCaptureDeviceDirty)
+ {
+ LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
+ << "<CaptureDeviceSpecifier>" << mCaptureDevice << "</CaptureDeviceSpecifier>"
+ << "</Request>"
+ << "\n\n\n";
+
+ mCaptureDeviceDirty = false;
+ }
}
void LLVivoxVoiceClient::buildSetRenderDevice(std::ostringstream &stream)
{
- if(mRenderDeviceDirty)
- {
- LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
-
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
- << "<RenderDeviceSpecifier>" << mRenderDevice << "</RenderDeviceSpecifier>"
- << "</Request>"
- << "\n\n\n";
- mRenderDeviceDirty = false;
- }
+ if(mRenderDeviceDirty)
+ {
+ LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
+
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
+ << "<RenderDeviceSpecifier>" << mRenderDevice << "</RenderDeviceSpecifier>"
+ << "</Request>"
+ << "\n\n\n";
+ mRenderDeviceDirty = false;
+ }
}
void LLVivoxVoiceClient::sendLocalAudioUpdates()
{
- // Check all of the dirty states and then send messages to those needing to be changed.
- // Tuningmode hands its own mute settings.
- std::ostringstream stream;
+ // Check all of the dirty states and then send messages to those needing to be changed.
+ // Tuningmode hands its own mute settings.
+ std::ostringstream stream;
- if (mMuteMicDirty && !mTuningMode)
- {
- mMuteMicDirty = false;
+ if (mMuteMicDirty && !mTuningMode)
+ {
+ mMuteMicDirty = false;
- // Send a local mute command.
+ // Send a local mute command.
- LL_INFOS("Voice") << "Sending MuteLocalMic command with parameter " << (mMuteMic ? "true" : "false") << LL_ENDL;
+ LL_INFOS("Voice") << "Sending MuteLocalMic command with parameter " << (mMuteMic ? "true" : "false") << LL_ENDL;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
- << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
- << "<Value>" << (mMuteMic ? "true" : "false") << "</Value>"
- << "</Request>\n\n\n";
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
+ << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
+ << "<Value>" << (mMuteMic ? "true" : "false") << "</Value>"
+ << "</Request>\n\n\n";
- }
+ }
- if (mSpeakerMuteDirty && !mTuningMode)
- {
- const char *muteval = ((mSpeakerVolume <= scale_speaker_volume(0)) ? "true" : "false");
+ if (mSpeakerMuteDirty && !mTuningMode)
+ {
+ const char *muteval = ((mSpeakerVolume <= scale_speaker_volume(0)) ? "true" : "false");
- mSpeakerMuteDirty = false;
+ mSpeakerMuteDirty = false;
- LL_INFOS("Voice") << "Setting speaker mute to " << muteval << LL_ENDL;
+ LL_INFOS("Voice") << "Setting speaker mute to " << muteval << LL_ENDL;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
- << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
- << "<Value>" << muteval << "</Value>"
- << "</Request>\n\n\n";
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
+ << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
+ << "<Value>" << muteval << "</Value>"
+ << "</Request>\n\n\n";
- }
+ }
- if (mSpeakerVolumeDirty)
- {
- mSpeakerVolumeDirty = false;
+ if (mSpeakerVolumeDirty)
+ {
+ mSpeakerVolumeDirty = false;
- LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume << LL_ENDL;
+ LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume << LL_ENDL;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
- << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
- << "<Value>" << mSpeakerVolume << "</Value>"
- << "</Request>\n\n\n";
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
+ << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
+ << "<Value>" << mSpeakerVolume << "</Value>"
+ << "</Request>\n\n\n";
- }
+ }
- if (mMicVolumeDirty)
- {
- mMicVolumeDirty = false;
+ if (mMicVolumeDirty)
+ {
+ mMicVolumeDirty = false;
- LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume << LL_ENDL;
+ LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume << LL_ENDL;
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
- << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
- << "<Value>" << mMicVolume << "</Value>"
- << "</Request>\n\n\n";
- }
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
+ << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
+ << "<Value>" << mMicVolume << "</Value>"
+ << "</Request>\n\n\n";
+ }
- if (!stream.str().empty())
- {
- writeString(stream.str());
- }
+ if (!stream.str().empty())
+ {
+ writeString(stream.str());
+ }
}
/**
* Because of the recurring voice cutout issues (SL-15072) we are going to try
* to disable the automatic VAD (Voice Activity Detection) and set the associated
* parameters directly. We will expose them via Debug Settings and that should
- * let us iterate on a collection of values that work for us. Hopefully!
+ * let us iterate on a collection of values that work for us. Hopefully!
*
* From the VIVOX Docs:
*
@@ -3558,16 +3558,16 @@ void LLVivoxVoiceClient::sendLocalAudioUpdates()
* for the VAD to switch back to silence from speech mode after the last speech
* frame has been detected.
*
- * VadNoiseFloor: A dimensionless value between 0 and
+ * VadNoiseFloor: A dimensionless value between 0 and
* 20000 (default 576) that controls the maximum level at which the noise floor
* may be set at by the VAD's noise tracking. Too low of a value will make noise
- * tracking ineffective (A value of 0 disables noise tracking and the VAD then
- * relies purely on the sensitivity property). Too high of a value will make
+ * tracking ineffective (A value of 0 disables noise tracking and the VAD then
+ * relies purely on the sensitivity property). Too high of a value will make
* long speech classifiable as noise.
*
- * VadSensitivity: A dimensionless value between 0 and
+ * VadSensitivity: A dimensionless value between 0 and
* 100, indicating the 'sensitivity of the VAD'. Increasing this value corresponds
- * to decreasing the sensitivity of the VAD (i.e. '0' is most sensitive,
+ * to decreasing the sensitivity of the VAD (i.e. '0' is most sensitive,
* while 100 is 'least sensitive')
*/
void LLVivoxVoiceClient::setupVADParams(unsigned int vad_auto,
@@ -3579,14 +3579,14 @@ void LLVivoxVoiceClient::setupVADParams(unsigned int vad_auto,
LL_INFOS("Voice") << "Setting the automatic VAD to "
<< (vad_auto ? "True" : "False")
- << " and discrete values to"
- << " VadHangover = " << vad_hangover
- << ", VadSensitivity = " << vad_sensitivity
- << ", VadNoiseFloor = " << vad_noise_floor
+ << " and discrete values to"
+ << " VadHangover = " << vad_hangover
+ << ", VadSensitivity = " << vad_sensitivity
+ << ", VadNoiseFloor = " << vad_noise_floor
<< LL_ENDL;
- // Create a request to set the VAD parameters:
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetVadProperties.1\">"
+ // Create a request to set the VAD parameters:
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetVadProperties.1\">"
<< "<VadAuto>" << vad_auto << "</VadAuto>"
<< "<VadHangover>" << vad_hangover << "</VadHangover>"
<< "<VadSensitivity>" << vad_sensitivity << "</VadSensitivity>"
@@ -3601,26 +3601,26 @@ void LLVivoxVoiceClient::setupVADParams(unsigned int vad_auto,
void LLVivoxVoiceClient::onVADSettingsChange()
{
- // pick up the VAD variables (one of which was changed)
- unsigned int vad_auto = gSavedSettings.getU32("VivoxVadAuto");
- unsigned int vad_hangover = gSavedSettings.getU32("VivoxVadHangover");
- unsigned int vad_noise_floor = gSavedSettings.getU32("VivoxVadNoiseFloor");
- unsigned int vad_sensitivity = gSavedSettings.getU32("VivoxVadSensitivity");
+ // pick up the VAD variables (one of which was changed)
+ unsigned int vad_auto = gSavedSettings.getU32("VivoxVadAuto");
+ unsigned int vad_hangover = gSavedSettings.getU32("VivoxVadHangover");
+ unsigned int vad_noise_floor = gSavedSettings.getU32("VivoxVadNoiseFloor");
+ unsigned int vad_sensitivity = gSavedSettings.getU32("VivoxVadSensitivity");
- // build a VAD params change request and send it to SLVoice
- setupVADParams(vad_auto, vad_hangover, vad_noise_floor, vad_sensitivity);
+ // build a VAD params change request and send it to SLVoice
+ setupVADParams(vad_auto, vad_hangover, vad_noise_floor, vad_sensitivity);
}
/////////////////////////////
// Response/Event handlers
void LLVivoxVoiceClient::connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID)
-{
+{
LLSD result = LLSD::emptyMap();
- if(statusCode == 0)
- {
- // Connector created, move forward.
+ if(statusCode == 0)
+ {
+ // Connector created, move forward.
if (connectorHandle == LLVivoxSecurity::getInstance()->connectorHandle())
{
LL_INFOS("Voice") << "Voice connector succeeded, Vivox SDK version is " << versionID << " connector handle " << connectorHandle << LL_ENDL;
@@ -3643,13 +3643,13 @@ void LLVivoxVoiceClient::connectorCreateResponse(int statusCode, std::string &st
// Give up.
mTerminateDaemon = true;
}
- }
+ }
else if (statusCode == 10028) // web request timeout prior to login
{
// this is usually fatal, but a long timeout might work
result["connector"] = LLSD::Boolean(false);
result["retry"] = LLSD::Real(CONNECT_ATTEMPT_TIMEOUT);
-
+
LL_WARNS("Voice") << "Voice connection failed" << LL_ENDL;
}
else if (statusCode == 10006) // name resolution failure - a shorter retry may work
@@ -3657,7 +3657,7 @@ void LLVivoxVoiceClient::connectorCreateResponse(int statusCode, std::string &st
// some networks have slower DNS, but a short timeout might let it catch up
result["connector"] = LLSD::Boolean(false);
result["retry"] = LLSD::Real(CONNECT_DNS_TIMEOUT);
-
+
LL_WARNS("Voice") << "Voice connection DNS lookup failed" << LL_ENDL;
}
else // unknown failure - give up
@@ -3671,161 +3671,161 @@ void LLVivoxVoiceClient::connectorCreateResponse(int statusCode, std::string &st
}
void LLVivoxVoiceClient::loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases)
-{
+{
LLSD result = LLSD::emptyMap();
LL_DEBUGS("Voice") << "Account.Login response (" << statusCode << "): " << statusString << LL_ENDL;
-
- // Status code of 20200 means "bad password". We may want to special-case that at some point.
-
- if ( statusCode == HTTP_UNAUTHORIZED )
- {
- // Login failure which is probably caused by the delay after a user's password being updated.
- LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+
+ // Status code of 20200 means "bad password". We may want to special-case that at some point.
+
+ if ( statusCode == HTTP_UNAUTHORIZED )
+ {
+ // Login failure which is probably caused by the delay after a user's password being updated.
+ LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
result["login"] = LLSD::String("retry");
- }
- else if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+ }
+ else if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
result["login"] = LLSD::String("failed");
- }
- else
- {
- // Login succeeded, move forward.
- mAccountLoggedIn = true;
- mNumberOfAliases = numberOfAliases;
+ }
+ else
+ {
+ // Login succeeded, move forward.
+ mAccountLoggedIn = true;
+ mNumberOfAliases = numberOfAliases;
result["login"] = LLSD::String("response_ok");
- }
+ }
mVivoxPump.post(result);
}
void LLVivoxVoiceClient::sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
-{
+{
sessionStatePtr_t session(findSessionBeingCreatedByURI(requestId));
-
- if(session)
- {
- session->mCreateInProgress = false;
- }
-
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
- if(session)
- {
- session->mErrorStatusCode = statusCode;
- session->mErrorStatusString = statusString;
- if(session == mAudioSession)
- {
+
+ if(session)
+ {
+ session->mCreateInProgress = false;
+ }
+
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
+ if(session)
+ {
+ session->mErrorStatusCode = statusCode;
+ session->mErrorStatusString = statusString;
+ if(session == mAudioSession)
+ {
LLSD vivoxevent(LLSDMap("handle", LLSD::String(sessionHandle))
("session", "failed")
("reason", LLSD::Integer(statusCode)));
mVivoxPump.post(vivoxevent);
}
- else
- {
- reapSession(session);
- }
- }
- }
- else
- {
- LL_INFOS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
- if(session)
- {
- setSessionHandle(session, sessionHandle);
- }
+ else
+ {
+ reapSession(session);
+ }
+ }
+ }
+ else
+ {
+ LL_INFOS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
+ if(session)
+ {
+ setSessionHandle(session, sessionHandle);
+ }
LLSD vivoxevent(LLSDMap("handle", LLSD::String(sessionHandle))
("session", "created"));
mVivoxPump.post(vivoxevent);
- }
+ }
}
void LLVivoxVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
-{
+{
sessionStatePtr_t session(findSessionBeingCreatedByURI(requestId));
-
- if(session)
- {
- session->mCreateInProgress = false;
- }
-
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "SessionGroup.AddSession response failure (" << statusCode << "): " << statusString << LL_ENDL;
- if(session)
- {
- session->mErrorStatusCode = statusCode;
- session->mErrorStatusString = statusString;
- if(session == mAudioSession)
- {
+
+ if(session)
+ {
+ session->mCreateInProgress = false;
+ }
+
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "SessionGroup.AddSession response failure (" << statusCode << "): " << statusString << LL_ENDL;
+ if(session)
+ {
+ session->mErrorStatusCode = statusCode;
+ session->mErrorStatusString = statusString;
+ if(session == mAudioSession)
+ {
LLSD vivoxevent(LLSDMap("handle", LLSD::String(sessionHandle))
("session", "failed"));
mVivoxPump.post(vivoxevent);
- }
- else
- {
- reapSession(session);
- }
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "SessionGroup.AddSession response received (success), session handle is " << sessionHandle << LL_ENDL;
- if(session)
- {
- setSessionHandle(session, sessionHandle);
- }
+ }
+ else
+ {
+ reapSession(session);
+ }
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "SessionGroup.AddSession response received (success), session handle is " << sessionHandle << LL_ENDL;
+ if(session)
+ {
+ setSessionHandle(session, sessionHandle);
+ }
LLSD vivoxevent(LLSDMap("handle", LLSD::String(sessionHandle))
("session", "added"));
mVivoxPump.post(vivoxevent);
- }
+ }
}
void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString)
{
sessionStatePtr_t session(findSession(requestId));
- // 1026 is session already has media, somehow mediaconnect was called twice on the same session.
- // set the session info to reflect that the user is already connected.
- if (statusCode == 1026)
- {
- session->mVoiceActive = true;
- session->mMediaConnectInProgress = false;
- session->mMediaStreamState = streamStateConnected;
- //session->mTextStreamState = streamStateConnected;
- session->mErrorStatusCode = 0;
- }
- else if (statusCode != 0)
- {
- LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
- if (session)
- {
- session->mMediaConnectInProgress = false;
- session->mErrorStatusCode = statusCode;
- session->mErrorStatusString = statusString;
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
- }
+ // 1026 is session already has media, somehow mediaconnect was called twice on the same session.
+ // set the session info to reflect that the user is already connected.
+ if (statusCode == 1026)
+ {
+ session->mVoiceActive = true;
+ session->mMediaConnectInProgress = false;
+ session->mMediaStreamState = streamStateConnected;
+ //session->mTextStreamState = streamStateConnected;
+ session->mErrorStatusCode = 0;
+ }
+ else if (statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
+ if (session)
+ {
+ session->mMediaConnectInProgress = false;
+ session->mErrorStatusCode = statusCode;
+ session->mErrorStatusString = statusString;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
+ }
}
void LLVivoxVoiceClient::logoutResponse(int statusCode, std::string &statusString)
-{
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
- // Should this ever fail? do we care if it does?
- }
+{
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
+ // Should this ever fail? do we care if it does?
+ }
LLSD vivoxevent(LLSDMap("logout", LLSD::Boolean(true)));
mVivoxPump.post(vivoxevent);
@@ -3833,261 +3833,261 @@ void LLVivoxVoiceClient::logoutResponse(int statusCode, std::string &statusStrin
void LLVivoxVoiceClient::connectorShutdownResponse(int statusCode, std::string &statusString)
{
- if(statusCode != 0)
- {
- LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
- // Should this ever fail? do we care if it does?
- }
-
- sConnected = false;
- mShutdownComplete = true;
-
+ if(statusCode != 0)
+ {
+ LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
+ // Should this ever fail? do we care if it does?
+ }
+
+ sConnected = false;
+ mShutdownComplete = true;
+
LLSD vivoxevent(LLSDMap("connector", LLSD::Boolean(false)));
mVivoxPump.post(vivoxevent);
}
void LLVivoxVoiceClient::sessionAddedEvent(
- std::string &uriString,
- std::string &alias,
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- bool isChannel,
- bool incoming,
- std::string &nameString,
- std::string &applicationString)
+ std::string &uriString,
+ std::string &alias,
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ bool isChannel,
+ bool incoming,
+ std::string &nameString,
+ std::string &applicationString)
{
sessionStatePtr_t session;
- LL_INFOS("Voice") << "session " << uriString << ", alias " << alias << ", name " << nameString << " handle " << sessionHandle << LL_ENDL;
-
- session = addSession(uriString, sessionHandle);
- if(session)
- {
- session->mGroupHandle = sessionGroupHandle;
- session->mIsChannel = isChannel;
- session->mIncoming = incoming;
- session->mAlias = alias;
-
- // Generate a caller UUID -- don't need to do this for channels
- if(!session->mIsChannel)
- {
- if(IDFromName(session->mSIPURI, session->mCallerID))
- {
- // Normal URI(base64-encoded UUID)
- }
- else if(!session->mAlias.empty() && IDFromName(session->mAlias, session->mCallerID))
- {
- // Wrong URI, but an alias is available. Stash the incoming URI as an alternate
- session->mAlternateSIPURI = session->mSIPURI;
-
- // and generate a proper URI from the ID.
- setSessionURI(session, sipURIFromID(session->mCallerID));
- }
- else
- {
- LL_INFOS("Voice") << "Could not generate caller id from uri, using hash of uri " << session->mSIPURI << LL_ENDL;
- session->mCallerID.generate(session->mSIPURI);
- session->mSynthesizedCallerID = true;
-
- // Can't look up the name in this case -- we have to extract it from the URI.
- std::string namePortion = nameFromsipURI(session->mSIPURI);
- if(namePortion.empty())
- {
- // Didn't seem to be a SIP URI, just use the whole provided name.
- namePortion = nameString;
- }
-
- // Some incoming names may be separated with an underscore instead of a space. Fix this.
- LLStringUtil::replaceChar(namePortion, '_', ' ');
-
- // Act like we just finished resolving the name (this stores it in all the right places)
- avatarNameResolved(session->mCallerID, namePortion);
- }
-
- LL_INFOS("Voice") << "caller ID: " << session->mCallerID << LL_ENDL;
-
- if(!session->mSynthesizedCallerID)
- {
- // If we got here, we don't have a proper name. Initiate a lookup.
- lookupName(session->mCallerID);
- }
- }
- }
+ LL_INFOS("Voice") << "session " << uriString << ", alias " << alias << ", name " << nameString << " handle " << sessionHandle << LL_ENDL;
+
+ session = addSession(uriString, sessionHandle);
+ if(session)
+ {
+ session->mGroupHandle = sessionGroupHandle;
+ session->mIsChannel = isChannel;
+ session->mIncoming = incoming;
+ session->mAlias = alias;
+
+ // Generate a caller UUID -- don't need to do this for channels
+ if(!session->mIsChannel)
+ {
+ if(IDFromName(session->mSIPURI, session->mCallerID))
+ {
+ // Normal URI(base64-encoded UUID)
+ }
+ else if(!session->mAlias.empty() && IDFromName(session->mAlias, session->mCallerID))
+ {
+ // Wrong URI, but an alias is available. Stash the incoming URI as an alternate
+ session->mAlternateSIPURI = session->mSIPURI;
+
+ // and generate a proper URI from the ID.
+ setSessionURI(session, sipURIFromID(session->mCallerID));
+ }
+ else
+ {
+ LL_INFOS("Voice") << "Could not generate caller id from uri, using hash of uri " << session->mSIPURI << LL_ENDL;
+ session->mCallerID.generate(session->mSIPURI);
+ session->mSynthesizedCallerID = true;
+
+ // Can't look up the name in this case -- we have to extract it from the URI.
+ std::string namePortion = nameFromsipURI(session->mSIPURI);
+ if(namePortion.empty())
+ {
+ // Didn't seem to be a SIP URI, just use the whole provided name.
+ namePortion = nameString;
+ }
+
+ // Some incoming names may be separated with an underscore instead of a space. Fix this.
+ LLStringUtil::replaceChar(namePortion, '_', ' ');
+
+ // Act like we just finished resolving the name (this stores it in all the right places)
+ avatarNameResolved(session->mCallerID, namePortion);
+ }
+
+ LL_INFOS("Voice") << "caller ID: " << session->mCallerID << LL_ENDL;
+
+ if(!session->mSynthesizedCallerID)
+ {
+ // If we got here, we don't have a proper name. Initiate a lookup.
+ lookupName(session->mCallerID);
+ }
+ }
+ }
}
void LLVivoxVoiceClient::sessionGroupAddedEvent(std::string &sessionGroupHandle)
{
- LL_DEBUGS("Voice") << "handle " << sessionGroupHandle << LL_ENDL;
-
+ LL_DEBUGS("Voice") << "handle " << sessionGroupHandle << LL_ENDL;
+
#if USE_SESSION_GROUPS
- if(mMainSessionGroupHandle.empty())
- {
- // This is the first (i.e. "main") session group. Save its handle.
- mMainSessionGroupHandle = sessionGroupHandle;
- }
- else
- {
- LL_DEBUGS("Voice") << "Already had a session group handle " << mMainSessionGroupHandle << LL_ENDL;
- }
+ if(mMainSessionGroupHandle.empty())
+ {
+ // This is the first (i.e. "main") session group. Save its handle.
+ mMainSessionGroupHandle = sessionGroupHandle;
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Already had a session group handle " << mMainSessionGroupHandle << LL_ENDL;
+ }
#endif
}
void LLVivoxVoiceClient::joinedAudioSession(const sessionStatePtr_t &session)
{
- LL_DEBUGS("Voice") << "Joined Audio Session" << LL_ENDL;
- if(mAudioSession != session)
- {
+ LL_DEBUGS("Voice") << "Joined Audio Session" << LL_ENDL;
+ if(mAudioSession != session)
+ {
sessionStatePtr_t oldSession = mAudioSession;
- mAudioSession = session;
- mAudioSessionChanged = true;
+ mAudioSession = session;
+ mAudioSessionChanged = true;
+
+ // The old session may now need to be deleted.
+ reapSession(oldSession);
+ }
- // The old session may now need to be deleted.
- reapSession(oldSession);
- }
-
- // This is the session we're joining.
- if(mIsJoiningSession)
- {
+ // This is the session we're joining.
+ if(mIsJoiningSession)
+ {
LLSD vivoxevent(LLSDMap("handle", LLSD::String(session->mHandle))
("session", "joined"));
mVivoxPump.post(vivoxevent);
- // Add the current user as a participant here.
+ // Add the current user as a participant here.
participantStatePtr_t participant(session->addParticipant(sipURIFromName(mAccountName)));
- if(participant)
- {
- participant->mIsSelf = true;
- lookupName(participant->mAvatarID);
-
- LL_INFOS("Voice") << "added self as participant \"" << participant->mAccountName
- << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
- }
-
- if(!session->mIsChannel)
- {
- // this is a p2p session. Make sure the other end is added as a participant.
+ if(participant)
+ {
+ participant->mIsSelf = true;
+ lookupName(participant->mAvatarID);
+
+ LL_INFOS("Voice") << "added self as participant \"" << participant->mAccountName
+ << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+ }
+
+ if(!session->mIsChannel)
+ {
+ // this is a p2p session. Make sure the other end is added as a participant.
participantStatePtr_t participant(session->addParticipant(session->mSIPURI));
- if(participant)
- {
- if(participant->mAvatarIDValid)
- {
- lookupName(participant->mAvatarID);
- }
- else if(!session->mName.empty())
- {
- participant->mDisplayName = session->mName;
- avatarNameResolved(participant->mAvatarID, session->mName);
- }
-
- // TODO: Question: Do we need to set up mAvatarID/mAvatarIDValid here?
- LL_INFOS("Voice") << "added caller as participant \"" << participant->mAccountName
- << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
- }
- }
- }
+ if(participant)
+ {
+ if(participant->mAvatarIDValid)
+ {
+ lookupName(participant->mAvatarID);
+ }
+ else if(!session->mName.empty())
+ {
+ participant->mDisplayName = session->mName;
+ avatarNameResolved(participant->mAvatarID, session->mName);
+ }
+
+ // TODO: Question: Do we need to set up mAvatarID/mAvatarIDValid here?
+ LL_INFOS("Voice") << "added caller as participant \"" << participant->mAccountName
+ << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+ }
+ }
+ }
}
void LLVivoxVoiceClient::sessionRemovedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle)
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle)
{
- LL_INFOS("Voice") << "handle " << sessionHandle << LL_ENDL;
-
+ LL_INFOS("Voice") << "handle " << sessionHandle << LL_ENDL;
+
sessionStatePtr_t session(findSession(sessionHandle));
- if(session)
- {
- leftAudioSession(session);
+ if(session)
+ {
+ leftAudioSession(session);
- // This message invalidates the session's handle. Set it to empty.
+ // This message invalidates the session's handle. Set it to empty.
clearSessionHandle(session);
-
- // This also means that the session's session group is now empty.
- // Terminate the session group so it doesn't leak.
- sessionGroupTerminateSendMessage(session);
-
- // Reset the media state (we now have no info)
- session->mMediaStreamState = streamStateUnknown;
- //session->mTextStreamState = streamStateUnknown;
-
- // Conditionally delete the session
- reapSession(session);
- }
- else
- {
- // Already reaped this session.
- LL_DEBUGS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL;
- }
+
+ // This also means that the session's session group is now empty.
+ // Terminate the session group so it doesn't leak.
+ sessionGroupTerminateSendMessage(session);
+
+ // Reset the media state (we now have no info)
+ session->mMediaStreamState = streamStateUnknown;
+ //session->mTextStreamState = streamStateUnknown;
+
+ // Conditionally delete the session
+ reapSession(session);
+ }
+ else
+ {
+ // Already reaped this session.
+ LL_DEBUGS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL;
+ }
}
void LLVivoxVoiceClient::reapSession(const sessionStatePtr_t &session)
{
- if(session)
- {
-
- if(session->mCreateInProgress)
- {
- LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL;
- }
- else if(session->mMediaConnectInProgress)
- {
- LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (connect in progress)" << LL_ENDL;
- }
- else if(session == mAudioSession)
- {
- LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the current session)" << LL_ENDL;
- }
- else if(session == mNextAudioSession)
- {
- LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the next session)" << LL_ENDL;
- }
- else
- {
- // We don't have a reason to keep tracking this session, so just delete it.
- LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL;
- deleteSession(session);
- }
- }
- else
- {
-// LL_DEBUGS("Voice") << "session is NULL" << LL_ENDL;
- }
+ if(session)
+ {
+
+ if(session->mCreateInProgress)
+ {
+ LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL;
+ }
+ else if(session->mMediaConnectInProgress)
+ {
+ LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (connect in progress)" << LL_ENDL;
+ }
+ else if(session == mAudioSession)
+ {
+ LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the current session)" << LL_ENDL;
+ }
+ else if(session == mNextAudioSession)
+ {
+ LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the next session)" << LL_ENDL;
+ }
+ else
+ {
+ // We don't have a reason to keep tracking this session, so just delete it.
+ LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL;
+ deleteSession(session);
+ }
+ }
+ else
+ {
+// LL_DEBUGS("Voice") << "session is NULL" << LL_ENDL;
+ }
}
// Returns true if the session seems to indicate we've moved to a region on a different voice server
bool LLVivoxVoiceClient::sessionNeedsRelog(const sessionStatePtr_t &session)
{
- bool result = false;
-
- if(session)
- {
- // Only make this check for spatial channels (so it won't happen for group or p2p calls)
- if(session->mIsSpatial)
- {
- std::string::size_type atsign;
-
- atsign = session->mSIPURI.find("@");
-
- if(atsign != std::string::npos)
- {
- std::string urihost = session->mSIPURI.substr(atsign + 1);
- if(stricmp(urihost.c_str(), mVoiceSIPURIHostName.c_str()))
- {
- // The hostname in this URI is different from what we expect. This probably means we need to relog.
-
- // We could make a ProvisionVoiceAccountRequest and compare the result with the current values of
- // mVoiceSIPURIHostName and mVoiceAccountServerURI to be really sure, but this is a pretty good indicator.
-
- result = true;
- }
- }
- }
- }
-
- return result;
+ bool result = false;
+
+ if(session)
+ {
+ // Only make this check for spatial channels (so it won't happen for group or p2p calls)
+ if(session->mIsSpatial)
+ {
+ std::string::size_type atsign;
+
+ atsign = session->mSIPURI.find("@");
+
+ if(atsign != std::string::npos)
+ {
+ std::string urihost = session->mSIPURI.substr(atsign + 1);
+ if(stricmp(urihost.c_str(), mVoiceSIPURIHostName.c_str()))
+ {
+ // The hostname in this URI is different from what we expect. This probably means we need to relog.
+
+ // We could make a ProvisionVoiceAccountRequest and compare the result with the current values of
+ // mVoiceSIPURIHostName and mVoiceAccountServerURI to be really sure, but this is a pretty good indicator.
+
+ result = true;
+ }
+ }
+ }
+ }
+
+ return result;
}
void LLVivoxVoiceClient::leftAudioSession(const sessionStatePtr_t &session)
@@ -4102,27 +4102,27 @@ void LLVivoxVoiceClient::leftAudioSession(const sessionStatePtr_t &session)
}
void LLVivoxVoiceClient::accountLoginStateChangeEvent(
- std::string &accountHandle,
- int statusCode,
- std::string &statusString,
- int state)
+ std::string &accountHandle,
+ int statusCode,
+ std::string &statusString,
+ int state)
{
LLSD levent = LLSD::emptyMap();
- /*
- According to Mike S., status codes for this event are:
- login_state_logged_out=0,
+ /*
+ According to Mike S., status codes for this event are:
+ login_state_logged_out=0,
login_state_logged_in = 1,
login_state_logging_in = 2,
login_state_logging_out = 3,
login_state_resetting = 4,
- login_state_error=100
- */
-
- LL_DEBUGS("Voice") << "state change event: " << state << LL_ENDL;
- switch(state)
- {
- case 1:
+ login_state_error=100
+ */
+
+ LL_DEBUGS("Voice") << "state change event: " << state << LL_ENDL;
+ switch(state)
+ {
+ case 1:
levent["login"] = LLSD::String("account_login");
mVivoxPump.post(levent);
@@ -4148,667 +4148,667 @@ void LLVivoxVoiceClient::accountLoginStateChangeEvent(
mVivoxPump.post(levent);
break;
-
+
default:
- //Used to be a commented out warning
- LL_WARNS("Voice") << "unknown account state event: " << state << LL_ENDL;
- break;
- }
+ //Used to be a commented out warning
+ LL_WARNS("Voice") << "unknown account state event: " << state << LL_ENDL;
+ break;
+ }
}
void LLVivoxVoiceClient::mediaCompletionEvent(std::string &sessionGroupHandle, std::string &mediaCompletionType)
{
LLSD result;
- if (mediaCompletionType == "AuxBufferAudioCapture")
- {
- mCaptureBufferRecording = false;
+ if (mediaCompletionType == "AuxBufferAudioCapture")
+ {
+ mCaptureBufferRecording = false;
result["recplay"] = "end";
- }
- else if (mediaCompletionType == "AuxBufferAudioRender")
- {
- // Ignore all but the last stop event
- if (--mPlayRequestCount <= 0)
- {
- mCaptureBufferPlaying = false;
+ }
+ else if (mediaCompletionType == "AuxBufferAudioRender")
+ {
+ // Ignore all but the last stop event
+ if (--mPlayRequestCount <= 0)
+ {
+ mCaptureBufferPlaying = false;
result["recplay"] = "end";
// result["recplay"] = "done";
}
- }
- else
- {
- LL_WARNS("Voice") << "Unknown MediaCompletionType: " << mediaCompletionType << LL_ENDL;
- }
+ }
+ else
+ {
+ LL_WARNS("Voice") << "Unknown MediaCompletionType: " << mediaCompletionType << LL_ENDL;
+ }
if (!result.isUndefined())
mVivoxPump.post(result);
}
void LLVivoxVoiceClient::mediaStreamUpdatedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- int statusCode,
- std::string &statusString,
- int state,
- bool incoming)
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ int statusCode,
+ std::string &statusString,
+ int state,
+ bool incoming)
{
sessionStatePtr_t session(findSession(sessionHandle));
-
- LL_DEBUGS("Voice") << "session " << sessionHandle << ", status code " << statusCode << ", string \"" << statusString << "\"" << LL_ENDL;
-
- if(session)
- {
- // We know about this session
-
- // Save the state for later use
- session->mMediaStreamState = state;
-
- switch(statusCode)
- {
- case 0:
- case HTTP_OK:
- // generic success
- // Don't change the saved error code (it may have been set elsewhere)
- break;
- default:
- // save the status code for later
- session->mErrorStatusCode = statusCode;
- break;
- }
-
- switch(state)
- {
- case streamStateDisconnecting:
- case streamStateIdle:
- // Standard "left audio session", Vivox state 'disconnected'
- session->mVoiceActive = false;
- session->mMediaConnectInProgress = false;
- leftAudioSession(session);
- break;
-
- case streamStateConnected:
- session->mVoiceActive = true;
- session->mMediaConnectInProgress = false;
- joinedAudioSession(session);
- case streamStateConnecting: // do nothing, but prevents a warning getting into the logs.
- break;
-
- case streamStateRinging:
- if(incoming)
- {
- // Send the voice chat invite to the GUI layer
- // TODO: Question: Should we correlate with the mute list here?
- session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
- session->mVoiceInvitePending = true;
- if(session->mName.empty())
- {
- lookupName(session->mCallerID);
- }
- else
- {
- // Act like we just finished resolving the name
- avatarNameResolved(session->mCallerID, session->mName);
- }
- }
- break;
-
- default:
- LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
- break;
-
- }
-
- }
- else
- {
- // session disconnectintg and disconnected events arriving after we have already left the session.
- LL_DEBUGS("Voice") << "session " << sessionHandle << " not found"<< LL_ENDL;
- }
+
+ LL_DEBUGS("Voice") << "session " << sessionHandle << ", status code " << statusCode << ", string \"" << statusString << "\"" << LL_ENDL;
+
+ if(session)
+ {
+ // We know about this session
+
+ // Save the state for later use
+ session->mMediaStreamState = state;
+
+ switch(statusCode)
+ {
+ case 0:
+ case HTTP_OK:
+ // generic success
+ // Don't change the saved error code (it may have been set elsewhere)
+ break;
+ default:
+ // save the status code for later
+ session->mErrorStatusCode = statusCode;
+ break;
+ }
+
+ switch(state)
+ {
+ case streamStateDisconnecting:
+ case streamStateIdle:
+ // Standard "left audio session", Vivox state 'disconnected'
+ session->mVoiceActive = false;
+ session->mMediaConnectInProgress = false;
+ leftAudioSession(session);
+ break;
+
+ case streamStateConnected:
+ session->mVoiceActive = true;
+ session->mMediaConnectInProgress = false;
+ joinedAudioSession(session);
+ case streamStateConnecting: // do nothing, but prevents a warning getting into the logs.
+ break;
+
+ case streamStateRinging:
+ if(incoming)
+ {
+ // Send the voice chat invite to the GUI layer
+ // TODO: Question: Should we correlate with the mute list here?
+ session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
+ session->mVoiceInvitePending = true;
+ if(session->mName.empty())
+ {
+ lookupName(session->mCallerID);
+ }
+ else
+ {
+ // Act like we just finished resolving the name
+ avatarNameResolved(session->mCallerID, session->mName);
+ }
+ }
+ break;
+
+ default:
+ LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
+ break;
+
+ }
+
+ }
+ else
+ {
+ // session disconnectintg and disconnected events arriving after we have already left the session.
+ LL_DEBUGS("Voice") << "session " << sessionHandle << " not found"<< LL_ENDL;
+ }
}
void LLVivoxVoiceClient::participantAddedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- std::string &uriString,
- std::string &alias,
- std::string &nameString,
- std::string &displayNameString,
- int participantType)
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ std::string &uriString,
+ std::string &alias,
+ std::string &nameString,
+ std::string &displayNameString,
+ int participantType)
{
sessionStatePtr_t session(findSession(sessionHandle));
- if(session)
- {
+ if(session)
+ {
participantStatePtr_t participant(session->addParticipant(uriString));
- if(participant)
- {
- participant->mAccountName = nameString;
-
- LL_DEBUGS("Voice") << "added participant \"" << participant->mAccountName
- << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
-
- if(participant->mAvatarIDValid)
- {
- // Initiate a lookup
- lookupName(participant->mAvatarID);
- }
- else
- {
- // If we don't have a valid avatar UUID, we need to fill in the display name to make the active speakers floater work.
- std::string namePortion = nameFromsipURI(uriString);
- if(namePortion.empty())
- {
- // Problem with the SIP URI, fall back to the display name
- namePortion = displayNameString;
- }
- if(namePortion.empty())
- {
- // Problems with both of the above, fall back to the account name
- namePortion = nameString;
- }
-
- // Set the display name (which is a hint to the active speakers window not to do its own lookup)
- participant->mDisplayName = namePortion;
- avatarNameResolved(participant->mAvatarID, namePortion);
- }
- }
- }
+ if(participant)
+ {
+ participant->mAccountName = nameString;
+
+ LL_DEBUGS("Voice") << "added participant \"" << participant->mAccountName
+ << "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+
+ if(participant->mAvatarIDValid)
+ {
+ // Initiate a lookup
+ lookupName(participant->mAvatarID);
+ }
+ else
+ {
+ // If we don't have a valid avatar UUID, we need to fill in the display name to make the active speakers floater work.
+ std::string namePortion = nameFromsipURI(uriString);
+ if(namePortion.empty())
+ {
+ // Problem with the SIP URI, fall back to the display name
+ namePortion = displayNameString;
+ }
+ if(namePortion.empty())
+ {
+ // Problems with both of the above, fall back to the account name
+ namePortion = nameString;
+ }
+
+ // Set the display name (which is a hint to the active speakers window not to do its own lookup)
+ participant->mDisplayName = namePortion;
+ avatarNameResolved(participant->mAvatarID, namePortion);
+ }
+ }
+ }
}
void LLVivoxVoiceClient::participantRemovedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- std::string &uriString,
- std::string &alias,
- std::string &nameString)
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ std::string &uriString,
+ std::string &alias,
+ std::string &nameString)
{
sessionStatePtr_t session(findSession(sessionHandle));
- if(session)
- {
+ if(session)
+ {
participantStatePtr_t participant(session->findParticipant(uriString));
- if(participant)
- {
- session->removeParticipant(participant);
- }
- else
- {
- LL_DEBUGS("Voice") << "unknown participant " << uriString << LL_ENDL;
- }
- }
- else
- {
- // a late arriving event on a session we have already left.
- LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
- }
+ if(participant)
+ {
+ session->removeParticipant(participant);
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "unknown participant " << uriString << LL_ENDL;
+ }
+ }
+ else
+ {
+ // a late arriving event on a session we have already left.
+ LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+ }
}
void LLVivoxVoiceClient::participantUpdatedEvent(
- std::string &sessionHandle,
- std::string &sessionGroupHandle,
- std::string &uriString,
- std::string &alias,
- bool isModeratorMuted,
- bool isSpeaking,
- int volume,
- F32 energy)
+ std::string &sessionHandle,
+ std::string &sessionGroupHandle,
+ std::string &uriString,
+ std::string &alias,
+ bool isModeratorMuted,
+ bool isSpeaking,
+ int volume,
+ F32 energy)
{
sessionStatePtr_t session(findSession(sessionHandle));
- if(session)
- {
- participantStatePtr_t participant(session->findParticipant(uriString));
-
- if(participant)
- {
+ if(session)
+ {
+ participantStatePtr_t participant(session->findParticipant(uriString));
+
+ if(participant)
+ {
//LL_INFOS("Voice") << "Participant Update for " << participant->mDisplayName << LL_ENDL;
- participant->mIsSpeaking = isSpeaking;
- participant->mIsModeratorMuted = isModeratorMuted;
-
- // SLIM SDK: convert range: ensure that energy is set to zero if is_speaking is false
- if (isSpeaking)
- {
- participant->mSpeakingTimeout.reset();
- participant->mPower = energy;
- }
- else
- {
- participant->mPower = 0.0f;
- }
-
- // Ignore incoming volume level if it has been explicitly set, or there
- // is a volume or mute change pending.
- if ( !participant->mVolumeSet && !participant->mVolumeDirty)
- {
- participant->mVolume = (F32)volume * VOLUME_SCALE_VIVOX;
- }
-
- // *HACK: mantipov: added while working on EXT-3544
- /*
- Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE
- LLViewerChatterBoxSessionAgentListUpdates::post() sometimes AFTER.
-
- participantUpdatedEvent updates voice participant state in particular participantState::mIsModeratorMuted
- Originally we wanted to update session Speaker Manager to fire LLSpeakerVoiceModerationEvent to fix the EXT-3544 bug.
- Calling of the LLSpeakerMgr::update() method was added into LLIMMgr::processAgentListUpdates.
-
- But in case participantUpdatedEvent() is called after LLViewerChatterBoxSessionAgentListUpdates::post()
- voice participant mIsModeratorMuted is changed after speakers are updated in Speaker Manager
- and event is not fired.
-
- So, we have to call LLSpeakerMgr::update() here.
- */
- LLVoiceChannel* voice_cnl = LLVoiceChannel::getCurrentVoiceChannel();
-
- // ignore session ID of local chat
- if (voice_cnl && voice_cnl->getSessionID().notNull())
- {
- LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(voice_cnl->getSessionID());
- if (speaker_manager)
- {
- speaker_manager->update(true);
-
- // also initialize voice moderate_mode depend on Agent's participant. See EXT-6937.
- // *TODO: remove once a way to request the current voice channel moderation mode is implemented.
- if (gAgent.getID() == participant->mAvatarID)
- {
- speaker_manager->initVoiceModerateMode();
- }
- }
- }
- }
- else
- {
- LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
- }
+ participant->mIsSpeaking = isSpeaking;
+ participant->mIsModeratorMuted = isModeratorMuted;
+
+ // SLIM SDK: convert range: ensure that energy is set to zero if is_speaking is false
+ if (isSpeaking)
+ {
+ participant->mSpeakingTimeout.reset();
+ participant->mPower = energy;
+ }
+ else
+ {
+ participant->mPower = 0.0f;
+ }
+
+ // Ignore incoming volume level if it has been explicitly set, or there
+ // is a volume or mute change pending.
+ if ( !participant->mVolumeSet && !participant->mVolumeDirty)
+ {
+ participant->mVolume = (F32)volume * VOLUME_SCALE_VIVOX;
+ }
+
+ // *HACK: mantipov: added while working on EXT-3544
+ /*
+ Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE
+ LLViewerChatterBoxSessionAgentListUpdates::post() sometimes AFTER.
+
+ participantUpdatedEvent updates voice participant state in particular participantState::mIsModeratorMuted
+ Originally we wanted to update session Speaker Manager to fire LLSpeakerVoiceModerationEvent to fix the EXT-3544 bug.
+ Calling of the LLSpeakerMgr::update() method was added into LLIMMgr::processAgentListUpdates.
+
+ But in case participantUpdatedEvent() is called after LLViewerChatterBoxSessionAgentListUpdates::post()
+ voice participant mIsModeratorMuted is changed after speakers are updated in Speaker Manager
+ and event is not fired.
+
+ So, we have to call LLSpeakerMgr::update() here.
+ */
+ LLVoiceChannel* voice_cnl = LLVoiceChannel::getCurrentVoiceChannel();
+
+ // ignore session ID of local chat
+ if (voice_cnl && voice_cnl->getSessionID().notNull())
+ {
+ LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(voice_cnl->getSessionID());
+ if (speaker_manager)
+ {
+ speaker_manager->update(true);
+
+ // also initialize voice moderate_mode depend on Agent's participant. See EXT-6937.
+ // *TODO: remove once a way to request the current voice channel moderation mode is implemented.
+ if (gAgent.getID() == participant->mAvatarID)
+ {
+ speaker_manager->initVoiceModerateMode();
+ }
+ }
+ }
+ }
+ else
+ {
+ LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+ }
}
void LLVivoxVoiceClient::messageEvent(
- std::string &sessionHandle,
- std::string &uriString,
- std::string &alias,
- std::string &messageHeader,
- std::string &messageBody,
- std::string &applicationString)
+ std::string &sessionHandle,
+ std::string &uriString,
+ std::string &alias,
+ std::string &messageHeader,
+ std::string &messageBody,
+ std::string &applicationString)
{
- LL_DEBUGS("Voice") << "Message event, session " << sessionHandle << " from " << uriString << LL_ENDL;
-// LL_DEBUGS("Voice") << " header " << messageHeader << ", body: \n" << messageBody << LL_ENDL;
+ LL_DEBUGS("Voice") << "Message event, session " << sessionHandle << " from " << uriString << LL_ENDL;
+// LL_DEBUGS("Voice") << " header " << messageHeader << ", body: \n" << messageBody << LL_ENDL;
LL_INFOS("Voice") << "Vivox raw message:" << std::endl << messageBody << LL_ENDL;
- if(messageHeader.find(HTTP_CONTENT_TEXT_HTML) != std::string::npos)
- {
- std::string message;
-
- {
- const std::string startMarker = "<body";
- const std::string startMarker2 = ">";
- const std::string endMarker = "</body>";
- const std::string startSpan = "<span";
- const std::string endSpan = "</span>";
- std::string::size_type start;
- std::string::size_type end;
-
- // Default to displaying the raw string, so the message gets through.
- message = messageBody;
-
- // Find the actual message text within the XML fragment
- start = messageBody.find(startMarker);
- start = messageBody.find(startMarker2, start);
- end = messageBody.find(endMarker);
-
- if(start != std::string::npos)
- {
- start += startMarker2.size();
-
- if(end != std::string::npos)
- end -= start;
-
- message.assign(messageBody, start, end);
- }
- else
- {
- // Didn't find a <body>, try looking for a <span> instead.
- start = messageBody.find(startSpan);
- start = messageBody.find(startMarker2, start);
- end = messageBody.find(endSpan);
-
- if(start != std::string::npos)
- {
- start += startMarker2.size();
-
- if(end != std::string::npos)
- end -= start;
-
- message.assign(messageBody, start, end);
- }
- }
- }
-
-// LL_DEBUGS("Voice") << " raw message = \n" << message << LL_ENDL;
-
- // strip formatting tags
- {
- std::string::size_type start;
- std::string::size_type end;
-
- while((start = message.find('<')) != std::string::npos)
- {
- if((end = message.find('>', start + 1)) != std::string::npos)
- {
- // Strip out the tag
- message.erase(start, (end + 1) - start);
- }
- else
- {
- // Avoid an infinite loop
- break;
- }
- }
- }
-
- // Decode ampersand-escaped chars
- {
- std::string::size_type mark = 0;
-
- // The text may contain text encoded with &lt;, &gt;, and &amp;
- mark = 0;
- while((mark = message.find("&lt;", mark)) != std::string::npos)
- {
- message.replace(mark, 4, "<");
- mark += 1;
- }
-
- mark = 0;
- while((mark = message.find("&gt;", mark)) != std::string::npos)
- {
- message.replace(mark, 4, ">");
- mark += 1;
- }
-
- mark = 0;
- while((mark = message.find("&amp;", mark)) != std::string::npos)
- {
- message.replace(mark, 5, "&");
- mark += 1;
- }
- }
-
- // strip leading/trailing whitespace (since we always seem to get a couple newlines)
- LLStringUtil::trim(message);
-
-// LL_DEBUGS("Voice") << " stripped message = \n" << message << LL_ENDL;
-
+ if(messageHeader.find(HTTP_CONTENT_TEXT_HTML) != std::string::npos)
+ {
+ std::string message;
+
+ {
+ const std::string startMarker = "<body";
+ const std::string startMarker2 = ">";
+ const std::string endMarker = "</body>";
+ const std::string startSpan = "<span";
+ const std::string endSpan = "</span>";
+ std::string::size_type start;
+ std::string::size_type end;
+
+ // Default to displaying the raw string, so the message gets through.
+ message = messageBody;
+
+ // Find the actual message text within the XML fragment
+ start = messageBody.find(startMarker);
+ start = messageBody.find(startMarker2, start);
+ end = messageBody.find(endMarker);
+
+ if(start != std::string::npos)
+ {
+ start += startMarker2.size();
+
+ if(end != std::string::npos)
+ end -= start;
+
+ message.assign(messageBody, start, end);
+ }
+ else
+ {
+ // Didn't find a <body>, try looking for a <span> instead.
+ start = messageBody.find(startSpan);
+ start = messageBody.find(startMarker2, start);
+ end = messageBody.find(endSpan);
+
+ if(start != std::string::npos)
+ {
+ start += startMarker2.size();
+
+ if(end != std::string::npos)
+ end -= start;
+
+ message.assign(messageBody, start, end);
+ }
+ }
+ }
+
+// LL_DEBUGS("Voice") << " raw message = \n" << message << LL_ENDL;
+
+ // strip formatting tags
+ {
+ std::string::size_type start;
+ std::string::size_type end;
+
+ while((start = message.find('<')) != std::string::npos)
+ {
+ if((end = message.find('>', start + 1)) != std::string::npos)
+ {
+ // Strip out the tag
+ message.erase(start, (end + 1) - start);
+ }
+ else
+ {
+ // Avoid an infinite loop
+ break;
+ }
+ }
+ }
+
+ // Decode ampersand-escaped chars
+ {
+ std::string::size_type mark = 0;
+
+ // The text may contain text encoded with &lt;, &gt;, and &amp;
+ mark = 0;
+ while((mark = message.find("&lt;", mark)) != std::string::npos)
+ {
+ message.replace(mark, 4, "<");
+ mark += 1;
+ }
+
+ mark = 0;
+ while((mark = message.find("&gt;", mark)) != std::string::npos)
+ {
+ message.replace(mark, 4, ">");
+ mark += 1;
+ }
+
+ mark = 0;
+ while((mark = message.find("&amp;", mark)) != std::string::npos)
+ {
+ message.replace(mark, 5, "&");
+ mark += 1;
+ }
+ }
+
+ // strip leading/trailing whitespace (since we always seem to get a couple newlines)
+ LLStringUtil::trim(message);
+
+// LL_DEBUGS("Voice") << " stripped message = \n" << message << LL_ENDL;
+
sessionStatePtr_t session(findSession(sessionHandle));
- if(session)
- {
- bool is_do_not_disturb = gAgent.isDoNotDisturb();
- bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat);
- bool is_linden = LLMuteList::isLinden(session->mName);
- LLChat chat;
-
- chat.mMuted = is_muted && !is_linden;
-
- if(!chat.mMuted)
- {
- chat.mFromID = session->mCallerID;
- chat.mFromName = session->mName;
- chat.mSourceType = CHAT_SOURCE_AGENT;
-
- if(is_do_not_disturb && !is_linden)
- {
- // TODO: Question: Return do not disturb mode response here? Or maybe when session is started instead?
- }
-
- LL_DEBUGS("Voice") << "adding message, name " << session->mName << " session " << session->mIMSessionID << ", target " << session->mCallerID << LL_ENDL;
- LLIMMgr::getInstance()->addMessage(session->mIMSessionID,
- session->mCallerID,
- session->mName.c_str(),
- message.c_str(),
- false,
- LLStringUtil::null, // default arg
- IM_NOTHING_SPECIAL, // default arg
- 0, // default arg
- LLUUID::null, // default arg
- LLVector3::zero); // default arg
- }
- }
- }
+ if(session)
+ {
+ bool is_do_not_disturb = gAgent.isDoNotDisturb();
+ bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat);
+ bool is_linden = LLMuteList::isLinden(session->mName);
+ LLChat chat;
+
+ chat.mMuted = is_muted && !is_linden;
+
+ if(!chat.mMuted)
+ {
+ chat.mFromID = session->mCallerID;
+ chat.mFromName = session->mName;
+ chat.mSourceType = CHAT_SOURCE_AGENT;
+
+ if(is_do_not_disturb && !is_linden)
+ {
+ // TODO: Question: Return do not disturb mode response here? Or maybe when session is started instead?
+ }
+
+ LL_DEBUGS("Voice") << "adding message, name " << session->mName << " session " << session->mIMSessionID << ", target " << session->mCallerID << LL_ENDL;
+ LLIMMgr::getInstance()->addMessage(session->mIMSessionID,
+ session->mCallerID,
+ session->mName.c_str(),
+ message.c_str(),
+ false,
+ LLStringUtil::null, // default arg
+ IM_NOTHING_SPECIAL, // default arg
+ 0, // default arg
+ LLUUID::null, // default arg
+ LLVector3::zero); // default arg
+ }
+ }
+ }
}
void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType)
{
sessionStatePtr_t session(findSession(sessionHandle));
-
- if(session)
- {
- participantStatePtr_t participant(session->findParticipant(uriString));
- if(participant)
- {
- if (!stricmp(notificationType.c_str(), "Typing"))
- {
- // Other end started typing
- // TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart().
- // It requires some info for the message, which we don't have here.
- }
- else if (!stricmp(notificationType.c_str(), "NotTyping"))
- {
- // Other end stopped typing
- // TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop().
- // It requires some info for the message, which we don't have here.
- }
- else
- {
- LL_DEBUGS("Voice") << "Unknown notification type " << notificationType << "for participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "Unknown participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "Unknown session handle " << sessionHandle << LL_ENDL;
- }
+
+ if(session)
+ {
+ participantStatePtr_t participant(session->findParticipant(uriString));
+ if(participant)
+ {
+ if (!stricmp(notificationType.c_str(), "Typing"))
+ {
+ // Other end started typing
+ // TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart().
+ // It requires some info for the message, which we don't have here.
+ }
+ else if (!stricmp(notificationType.c_str(), "NotTyping"))
+ {
+ // Other end stopped typing
+ // TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop().
+ // It requires some info for the message, which we don't have here.
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Unknown notification type " << notificationType << "for participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Unknown participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Unknown session handle " << sessionHandle << LL_ENDL;
+ }
}
void LLVivoxVoiceClient::voiceServiceConnectionStateChangedEvent(int statusCode, std::string &statusString, std::string &build_id)
{
- // We don't generally need to process this. However, one occurence is when we first connect, and so it is the
- // earliest opportunity to learn what we're connected to.
- if (statusCode)
- {
- LL_WARNS("Voice") << "VoiceServiceConnectionStateChangedEvent statusCode: " << statusCode <<
- "statusString: " << statusString << LL_ENDL;
- return;
- }
- if (build_id.empty())
- {
- return;
- }
- mVoiceVersion.mBuildVersion = build_id;
+ // We don't generally need to process this. However, one occurence is when we first connect, and so it is the
+ // earliest opportunity to learn what we're connected to.
+ if (statusCode)
+ {
+ LL_WARNS("Voice") << "VoiceServiceConnectionStateChangedEvent statusCode: " << statusCode <<
+ "statusString: " << statusString << LL_ENDL;
+ return;
+ }
+ if (build_id.empty())
+ {
+ return;
+ }
+ mVoiceVersion.mBuildVersion = build_id;
}
void LLVivoxVoiceClient::auxAudioPropertiesEvent(F32 energy)
{
- LL_DEBUGS("VoiceEnergy") << "got energy " << energy << LL_ENDL;
- mTuningEnergy = energy;
+ LL_DEBUGS("VoiceEnergy") << "got energy " << energy << LL_ENDL;
+ mTuningEnergy = energy;
}
void LLVivoxVoiceClient::muteListChanged()
{
- // The user's mute list has been updated. Go through the current participant list and sync it with the mute list.
- if(mAudioSession)
- {
- participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
-
- for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
- {
- participantStatePtr_t p(iter->second);
-
- // Check to see if this participant is on the mute list already
- if(p->updateMuteState())
- mAudioSession->mVolumeDirty = true;
- }
- }
+ // The user's mute list has been updated. Go through the current participant list and sync it with the mute list.
+ if(mAudioSession)
+ {
+ participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+
+ for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+ {
+ participantStatePtr_t p(iter->second);
+
+ // Check to see if this participant is on the mute list already
+ if(p->updateMuteState())
+ mAudioSession->mVolumeDirty = true;
+ }
+ }
}
/////////////////////////////
// Managing list of participants
-LLVivoxVoiceClient::participantState::participantState(const std::string &uri) :
- mURI(uri),
- mPTT(false),
- mIsSpeaking(false),
- mIsModeratorMuted(false),
- mLastSpokeTimestamp(0.f),
- mPower(0.f),
- mVolume(LLVoiceClient::VOLUME_DEFAULT),
- mUserVolume(0),
- mOnMuteList(false),
- mVolumeSet(false),
- mVolumeDirty(false),
- mAvatarIDValid(false),
- mIsSelf(false)
+LLVivoxVoiceClient::participantState::participantState(const std::string &uri) :
+ mURI(uri),
+ mPTT(false),
+ mIsSpeaking(false),
+ mIsModeratorMuted(false),
+ mLastSpokeTimestamp(0.f),
+ mPower(0.f),
+ mVolume(LLVoiceClient::VOLUME_DEFAULT),
+ mUserVolume(0),
+ mOnMuteList(false),
+ mVolumeSet(false),
+ mVolumeDirty(false),
+ mAvatarIDValid(false),
+ mIsSelf(false)
{
}
LLVivoxVoiceClient::participantStatePtr_t LLVivoxVoiceClient::sessionState::addParticipant(const std::string &uri)
{
participantStatePtr_t result;
- bool useAlternateURI = false;
-
- // Note: this is mostly the body of LLVivoxVoiceClient::sessionState::findParticipant(), but since we need to know if it
- // matched the alternate SIP URI (so we can add it properly), we need to reproduce it here.
- {
- participantMap::iterator iter = mParticipantsByURI.find(uri);
-
- if(iter == mParticipantsByURI.end())
- {
- if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
- {
- // This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
- // Use mSIPURI instead, since it will be properly encoded.
- iter = mParticipantsByURI.find(mSIPURI);
- useAlternateURI = true;
- }
- }
-
- if(iter != mParticipantsByURI.end())
- {
- result = iter->second;
- }
- }
-
- if(!result)
- {
- // participant isn't already in one list or the other.
- result.reset(new participantState(useAlternateURI?mSIPURI:uri));
- mParticipantsByURI.insert(participantMap::value_type(result->mURI, result));
- mParticipantsChanged = true;
-
- // Try to do a reverse transform on the URI to get the GUID back.
- {
- LLUUID id;
- if(LLVivoxVoiceClient::getInstance()->IDFromName(result->mURI, id))
- {
- result->mAvatarIDValid = true;
- result->mAvatarID = id;
- }
- else
- {
- // Create a UUID by hashing the URI, but do NOT set mAvatarIDValid.
- // This indicates that the ID will not be in the name cache.
- result->mAvatarID.generate(uri);
- }
- }
-
+ bool useAlternateURI = false;
+
+ // Note: this is mostly the body of LLVivoxVoiceClient::sessionState::findParticipant(), but since we need to know if it
+ // matched the alternate SIP URI (so we can add it properly), we need to reproduce it here.
+ {
+ participantMap::iterator iter = mParticipantsByURI.find(uri);
+
+ if(iter == mParticipantsByURI.end())
+ {
+ if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+ {
+ // This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+ // Use mSIPURI instead, since it will be properly encoded.
+ iter = mParticipantsByURI.find(mSIPURI);
+ useAlternateURI = true;
+ }
+ }
+
+ if(iter != mParticipantsByURI.end())
+ {
+ result = iter->second;
+ }
+ }
+
+ if(!result)
+ {
+ // participant isn't already in one list or the other.
+ result.reset(new participantState(useAlternateURI?mSIPURI:uri));
+ mParticipantsByURI.insert(participantMap::value_type(result->mURI, result));
+ mParticipantsChanged = true;
+
+ // Try to do a reverse transform on the URI to get the GUID back.
+ {
+ LLUUID id;
+ if(LLVivoxVoiceClient::getInstance()->IDFromName(result->mURI, id))
+ {
+ result->mAvatarIDValid = true;
+ result->mAvatarID = id;
+ }
+ else
+ {
+ // Create a UUID by hashing the URI, but do NOT set mAvatarIDValid.
+ // This indicates that the ID will not be in the name cache.
+ result->mAvatarID.generate(uri);
+ }
+ }
+
if(result->updateMuteState())
{
- mMuteDirty = true;
+ mMuteDirty = true;
+ }
+
+ mParticipantsByUUID.insert(participantUUIDMap::value_type(result->mAvatarID, result));
+
+ if (LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID, result->mVolume))
+ {
+ result->mVolumeDirty = true;
+ mVolumeDirty = true;
}
-
- mParticipantsByUUID.insert(participantUUIDMap::value_type(result->mAvatarID, result));
- if (LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID, result->mVolume))
- {
- result->mVolumeDirty = true;
- mVolumeDirty = true;
- }
-
- LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
- }
-
- return result;
+ LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
+ }
+
+ return result;
}
bool LLVivoxVoiceClient::participantState::updateMuteState()
{
- bool result = false;
+ bool result = false;
- bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat);
- if(mOnMuteList != isMuted)
- {
- mOnMuteList = isMuted;
- mVolumeDirty = true;
- result = true;
- }
- return result;
+ bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat);
+ if(mOnMuteList != isMuted)
+ {
+ mOnMuteList = isMuted;
+ mVolumeDirty = true;
+ result = true;
+ }
+ return result;
}
bool LLVivoxVoiceClient::participantState::isAvatar()
{
- return mAvatarIDValid;
+ return mAvatarIDValid;
}
void LLVivoxVoiceClient::sessionState::removeParticipant(const LLVivoxVoiceClient::participantStatePtr_t &participant)
{
- if(participant)
- {
- participantMap::iterator iter = mParticipantsByURI.find(participant->mURI);
- participantUUIDMap::iterator iter2 = mParticipantsByUUID.find(participant->mAvatarID);
-
- LL_DEBUGS("Voice") << "participant \"" << participant->mURI << "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
-
- if(iter == mParticipantsByURI.end())
- {
- LL_WARNS("Voice") << "Internal error: participant " << participant->mURI << " not in URI map" << LL_ENDL;
- }
- else if(iter2 == mParticipantsByUUID.end())
- {
- LL_WARNS("Voice") << "Internal error: participant ID " << participant->mAvatarID << " not in UUID map" << LL_ENDL;
- }
- else if(iter->second != iter2->second)
- {
- LL_WARNS("Voice") << "Internal error: participant mismatch!" << LL_ENDL;
- }
- else
- {
- mParticipantsByURI.erase(iter);
- mParticipantsByUUID.erase(iter2);
+ if(participant)
+ {
+ participantMap::iterator iter = mParticipantsByURI.find(participant->mURI);
+ participantUUIDMap::iterator iter2 = mParticipantsByUUID.find(participant->mAvatarID);
+
+ LL_DEBUGS("Voice") << "participant \"" << participant->mURI << "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
+
+ if(iter == mParticipantsByURI.end())
+ {
+ LL_WARNS("Voice") << "Internal error: participant " << participant->mURI << " not in URI map" << LL_ENDL;
+ }
+ else if(iter2 == mParticipantsByUUID.end())
+ {
+ LL_WARNS("Voice") << "Internal error: participant ID " << participant->mAvatarID << " not in UUID map" << LL_ENDL;
+ }
+ else if(iter->second != iter2->second)
+ {
+ LL_WARNS("Voice") << "Internal error: participant mismatch!" << LL_ENDL;
+ }
+ else
+ {
+ mParticipantsByURI.erase(iter);
+ mParticipantsByUUID.erase(iter2);
mParticipantsChanged = true;
- }
- }
+ }
+ }
}
void LLVivoxVoiceClient::sessionState::removeAllParticipants()
{
- LL_DEBUGS("Voice") << "called" << LL_ENDL;
+ LL_DEBUGS("Voice") << "called" << LL_ENDL;
+
+ while(!mParticipantsByURI.empty())
+ {
+ removeParticipant(mParticipantsByURI.begin()->second);
+ }
- while(!mParticipantsByURI.empty())
- {
- removeParticipant(mParticipantsByURI.begin()->second);
- }
-
- if(!mParticipantsByUUID.empty())
- {
- LL_WARNS("Voice") << "Internal error: empty URI map, non-empty UUID map" << LL_ENDL;
- }
+ if(!mParticipantsByUUID.empty())
+ {
+ LL_WARNS("Voice") << "Internal error: empty URI map, non-empty UUID map" << LL_ENDL;
+ }
}
/*static*/
@@ -4830,15 +4830,15 @@ void LLVivoxVoiceClient::sessionState::VerifySessions()
void LLVivoxVoiceClient::getParticipantList(std::set<LLUUID> &participants)
{
- if(mAudioSession)
- {
- for(participantUUIDMap::iterator iter = mAudioSession->mParticipantsByUUID.begin();
- iter != mAudioSession->mParticipantsByUUID.end();
- iter++)
- {
- participants.insert(iter->first);
- }
- }
+ if(mAudioSession)
+ {
+ for(participantUUIDMap::iterator iter = mAudioSession->mParticipantsByUUID.begin();
+ iter != mAudioSession->mParticipantsByUUID.end();
+ iter++)
+ {
+ participants.insert(iter->first);
+ }
+ }
}
bool LLVivoxVoiceClient::isParticipant(const LLUUID &speaker_id)
@@ -4854,50 +4854,50 @@ bool LLVivoxVoiceClient::isParticipant(const LLUUID &speaker_id)
LLVivoxVoiceClient::participantStatePtr_t LLVivoxVoiceClient::sessionState::findParticipant(const std::string &uri)
{
participantStatePtr_t result;
-
- participantMap::iterator iter = mParticipantsByURI.find(uri);
-
- if(iter == mParticipantsByURI.end())
- {
- if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
- {
- // This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
- // Look up the other URI
- iter = mParticipantsByURI.find(mSIPURI);
- }
- }
-
- if(iter != mParticipantsByURI.end())
- {
- result = iter->second;
- }
-
- return result;
+
+ participantMap::iterator iter = mParticipantsByURI.find(uri);
+
+ if(iter == mParticipantsByURI.end())
+ {
+ if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+ {
+ // This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+ // Look up the other URI
+ iter = mParticipantsByURI.find(mSIPURI);
+ }
+ }
+
+ if(iter != mParticipantsByURI.end())
+ {
+ result = iter->second;
+ }
+
+ return result;
}
LLVivoxVoiceClient::participantStatePtr_t LLVivoxVoiceClient::sessionState::findParticipantByID(const LLUUID& id)
{
participantStatePtr_t result;
- participantUUIDMap::iterator iter = mParticipantsByUUID.find(id);
+ participantUUIDMap::iterator iter = mParticipantsByUUID.find(id);
- if(iter != mParticipantsByUUID.end())
- {
- result = iter->second;
- }
+ if(iter != mParticipantsByUUID.end())
+ {
+ result = iter->second;
+ }
- return result;
+ return result;
}
LLVivoxVoiceClient::participantStatePtr_t LLVivoxVoiceClient::findParticipantByID(const LLUUID& id)
{
participantStatePtr_t result;
-
- if(mAudioSession)
- {
- result = mAudioSession->findParticipantByID(id);
- }
-
- return result;
+
+ if(mAudioSession)
+ {
+ result = mAudioSession->findParticipantByID(id);
+ }
+
+ return result;
}
@@ -4905,45 +4905,45 @@ LLVivoxVoiceClient::participantStatePtr_t LLVivoxVoiceClient::findParticipantByI
// Check for parcel boundary crossing
bool LLVivoxVoiceClient::checkParcelChanged(bool update)
{
- LLViewerRegion *region = gAgent.getRegion();
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-
- if(region && parcel)
- {
- S32 parcelLocalID = parcel->getLocalID();
- std::string regionName = region->getName();
-
- // LL_DEBUGS("Voice") << "Region name = \"" << regionName << "\", parcel local ID = " << parcelLocalID << ", cap URI = \"" << capURI << "\"" << LL_ENDL;
-
- // The region name starts out empty and gets filled in later.
- // Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
- // If either is empty, wait for the next time around.
- if(!regionName.empty())
- {
- if((parcelLocalID != mCurrentParcelLocalID) || (regionName != mCurrentRegionName))
- {
- // We have changed parcels. Initiate a parcel channel lookup.
- if (update)
- {
- mCurrentParcelLocalID = parcelLocalID;
- mCurrentRegionName = regionName;
- }
- return true;
- }
- }
- }
- return false;
+ LLViewerRegion *region = gAgent.getRegion();
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+
+ if(region && parcel)
+ {
+ S32 parcelLocalID = parcel->getLocalID();
+ std::string regionName = region->getName();
+
+ // LL_DEBUGS("Voice") << "Region name = \"" << regionName << "\", parcel local ID = " << parcelLocalID << ", cap URI = \"" << capURI << "\"" << LL_ENDL;
+
+ // The region name starts out empty and gets filled in later.
+ // Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
+ // If either is empty, wait for the next time around.
+ if(!regionName.empty())
+ {
+ if((parcelLocalID != mCurrentParcelLocalID) || (regionName != mCurrentRegionName))
+ {
+ // We have changed parcels. Initiate a parcel channel lookup.
+ if (update)
+ {
+ mCurrentParcelLocalID = parcelLocalID;
+ mCurrentRegionName = regionName;
+ }
+ return true;
+ }
+ }
+ }
+ return false;
}
bool LLVivoxVoiceClient::switchChannel(
- std::string uri,
- bool spatial,
- bool no_reconnect,
- bool is_p2p,
- std::string hash)
-{
- bool needsSwitch = !mIsInChannel;
-
+ std::string uri,
+ bool spatial,
+ bool no_reconnect,
+ bool is_p2p,
+ std::string hash)
+{
+ bool needsSwitch = !mIsInChannel;
+
if (mIsInChannel)
{
if (mSessionTerminateRequested)
@@ -4988,17 +4988,17 @@ bool LLVivoxVoiceClient::switchChannel(
}
if(needsSwitch)
- {
- if(uri.empty())
- {
- // Leave any channel we may be in
- LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
+ {
+ if(uri.empty())
+ {
+ // Leave any channel we may be in
+ LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
sessionStatePtr_t oldSession = mNextAudioSession;
- mNextAudioSession.reset();
+ mNextAudioSession.reset();
- // The old session may now need to be deleted.
- reapSession(oldSession);
+ // The old session may now need to be deleted.
+ reapSession(oldSession);
// If voice was on, turn it off
if (LLVoiceClient::getInstance()->getUserPTTState())
@@ -5006,33 +5006,33 @@ bool LLVivoxVoiceClient::switchChannel(
LLVoiceClient::getInstance()->setUserPTTState(false);
}
- notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
- }
- else
- {
- LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
+
+ mNextAudioSession = addSession(uri);
+ mNextAudioSession->mHash = hash;
+ mNextAudioSession->mIsSpatial = spatial;
+ mNextAudioSession->mReconnect = !no_reconnect;
+ mNextAudioSession->mIsP2P = is_p2p;
+ }
- mNextAudioSession = addSession(uri);
- mNextAudioSession->mHash = hash;
- mNextAudioSession->mIsSpatial = spatial;
- mNextAudioSession->mReconnect = !no_reconnect;
- mNextAudioSession->mIsP2P = is_p2p;
- }
-
if (mIsInChannel)
- {
- // If we're already in a channel, or if we're joining one, terminate
- // so we can rejoin with the new session data.
- sessionTerminate();
- }
- }
+ {
+ // If we're already in a channel, or if we're joining one, terminate
+ // so we can rejoin with the new session data.
+ sessionTerminate();
+ }
+ }
return needsSwitch;
}
void LLVivoxVoiceClient::joinSession(const sessionStatePtr_t &session)
{
- mNextAudioSession = session;
+ mNextAudioSession = session;
if (mIsInChannel)
{
@@ -5043,75 +5043,75 @@ void LLVivoxVoiceClient::joinSession(const sessionStatePtr_t &session)
}
void LLVivoxVoiceClient::setNonSpatialChannel(
- const std::string &uri,
- const std::string &credentials)
+ const std::string &uri,
+ const std::string &credentials)
{
- switchChannel(uri, false, false, false, credentials);
+ switchChannel(uri, false, false, false, credentials);
}
bool LLVivoxVoiceClient::setSpatialChannel(
- const std::string &uri,
- const std::string &credentials)
-{
- mSpatialSessionURI = uri;
- mSpatialSessionCredentials = credentials;
- mAreaVoiceDisabled = mSpatialSessionURI.empty();
-
- LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
-
- if((mIsInChannel && mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
- {
- // User is in a non-spatial chat or joining a non-spatial chat. Don't switch channels.
- LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
+ const std::string &uri,
+ const std::string &credentials)
+{
+ mSpatialSessionURI = uri;
+ mSpatialSessionCredentials = credentials;
+ mAreaVoiceDisabled = mSpatialSessionURI.empty();
+
+ LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
+
+ if((mIsInChannel && mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
+ {
+ // User is in a non-spatial chat or joining a non-spatial chat. Don't switch channels.
+ LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
return false;
- }
- else
- {
- return switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
- }
+ }
+ else
+ {
+ return switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
+ }
}
void LLVivoxVoiceClient::callUser(const LLUUID &uuid)
{
- std::string userURI = sipURIFromID(uuid);
+ std::string userURI = sipURIFromID(uuid);
- switchChannel(userURI, false, true, true);
+ switchChannel(userURI, false, true, true);
}
#if 0
// Vivox text IMs are not in use.
LLVivoxVoiceClient::sessionStatePtr_t LLVivoxVoiceClient::startUserIMSession(const LLUUID &uuid)
{
- // Figure out if a session with the user already exists
+ // Figure out if a session with the user already exists
sessionStatePtr_t session(findSession(uuid));
- if(!session)
- {
- // No session with user, need to start one.
- std::string uri = sipURIFromID(uuid);
- session = addSession(uri);
-
- llassert(session);
- if (!session)
+ if(!session)
+ {
+ // No session with user, need to start one.
+ std::string uri = sipURIFromID(uuid);
+ session = addSession(uri);
+
+ llassert(session);
+ if (!session)
return session;
- session->mIsSpatial = false;
- session->mReconnect = false;
- session->mIsP2P = true;
- session->mCallerID = uuid;
- }
-
- if(session->mHandle.empty())
- {
- // Session isn't active -- start it up.
- sessionCreateSendMessage(session, false, false);
- }
- else
- {
- // Session is already active -- start up text.
- sessionTextConnectSendMessage(session);
- }
-
- return session;
+ session->mIsSpatial = false;
+ session->mReconnect = false;
+ session->mIsP2P = true;
+ session->mCallerID = uuid;
+ }
+
+ if(session->mHandle.empty())
+ {
+ // Session isn't active -- start it up.
+ sessionCreateSendMessage(session, false, false);
+ }
+ else
+ {
+ // Session is already active -- start up text.
+ sessionTextConnectSendMessage(session);
+ }
+
+ return session;
}
#endif
@@ -5119,44 +5119,44 @@ void LLVivoxVoiceClient::endUserIMSession(const LLUUID &uuid)
{
#if 0
// Vivox text IMs are not in use.
-
+
// Figure out if a session with the user exists
sessionStatePtr_t session(findSession(uuid));
- if(session)
- {
- // found the session
- if(!session->mHandle.empty())
- {
- // sessionTextDisconnectSendMessage(session); // a SLim leftover, not used any more.
- }
- }
- else
- {
- LL_DEBUGS("Voice") << "Session not found for participant ID " << uuid << LL_ENDL;
- }
+ if(session)
+ {
+ // found the session
+ if(!session->mHandle.empty())
+ {
+ // sessionTextDisconnectSendMessage(session); // a SLim leftover, not used any more.
+ }
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "Session not found for participant ID " << uuid << LL_ENDL;
+ }
#endif
}
bool LLVivoxVoiceClient::isValidChannel(std::string &sessionHandle)
{
return(findSession(sessionHandle) != NULL);
-
+
}
bool LLVivoxVoiceClient::answerInvite(std::string &sessionHandle)
{
- // this is only ever used to answer incoming p2p call invites.
-
+ // this is only ever used to answer incoming p2p call invites.
+
sessionStatePtr_t session(findSession(sessionHandle));
- if(session)
- {
- session->mIsSpatial = false;
- session->mReconnect = false;
- session->mIsP2P = true;
+ if(session)
+ {
+ session->mIsSpatial = false;
+ session->mReconnect = false;
+ session->mIsP2P = true;
- joinSession(session);
- return true;
- }
-
- return false;
+ joinSession(session);
+ return true;
+ }
+
+ return false;
}
bool LLVivoxVoiceClient::isVoiceWorking() const
@@ -5173,283 +5173,283 @@ bool LLVivoxVoiceClient::isVoiceWorking() const
// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
BOOL LLVivoxVoiceClient::isParticipantAvatar(const LLUUID &id)
{
- BOOL result = TRUE;
+ BOOL result = TRUE;
sessionStatePtr_t session(findSession(id));
-
- if(session)
- {
- // this is a p2p session with the indicated caller, or the session with the specified UUID.
- if(session->mSynthesizedCallerID)
- result = FALSE;
- }
- else
- {
- // Didn't find a matching session -- check the current audio session for a matching participant
- if(mAudioSession)
- {
+
+ if(session)
+ {
+ // this is a p2p session with the indicated caller, or the session with the specified UUID.
+ if(session->mSynthesizedCallerID)
+ result = FALSE;
+ }
+ else
+ {
+ // Didn't find a matching session -- check the current audio session for a matching participant
+ if(mAudioSession)
+ {
participantStatePtr_t participant(findParticipantByID(id));
- if(participant)
- {
- result = participant->isAvatar();
- }
- }
- }
-
- return result;
+ if(participant)
+ {
+ result = participant->isAvatar();
+ }
+ }
+ }
+
+ return result;
}
// Returns true if calling back the session URI after the session has closed is possible.
-// Currently this will be false only for PSTN P2P calls.
+// Currently this will be false only for PSTN P2P calls.
BOOL LLVivoxVoiceClient::isSessionCallBackPossible(const LLUUID &session_id)
{
- BOOL result = TRUE;
+ BOOL result = TRUE;
sessionStatePtr_t session(findSession(session_id));
-
- if(session != NULL)
- {
- result = session->isCallBackPossible();
- }
-
- return result;
+
+ if(session != NULL)
+ {
+ result = session->isCallBackPossible();
+ }
+
+ return result;
}
// Returns true if the session can accept text IM's.
// Currently this will be false only for PSTN P2P calls.
BOOL LLVivoxVoiceClient::isSessionTextIMPossible(const LLUUID &session_id)
{
- bool result = TRUE;
+ bool result = TRUE;
sessionStatePtr_t session(findSession(session_id));
-
- if(session != NULL)
- {
- result = session->isTextIMPossible();
- }
-
- return result;
+
+ if(session != NULL)
+ {
+ result = session->isTextIMPossible();
+ }
+
+ return result;
}
-
+
void LLVivoxVoiceClient::declineInvite(std::string &sessionHandle)
{
sessionStatePtr_t session(findSession(sessionHandle));
- if(session)
- {
- sessionMediaDisconnectSendMessage(session);
- }
+ if(session)
+ {
+ sessionMediaDisconnectSendMessage(session);
+ }
}
void LLVivoxVoiceClient::leaveNonSpatialChannel()
{
LL_DEBUGS("Voice") << "Request to leave spacial channel." << LL_ENDL;
-
- // Make sure we don't rejoin the current session.
+
+ // Make sure we don't rejoin the current session.
sessionStatePtr_t oldNextSession(mNextAudioSession);
- mNextAudioSession.reset();
-
- // Most likely this will still be the current session at this point, but check it anyway.
- reapSession(oldNextSession);
-
- verifySessionState();
-
- sessionTerminate();
+ mNextAudioSession.reset();
+
+ // Most likely this will still be the current session at this point, but check it anyway.
+ reapSession(oldNextSession);
+
+ verifySessionState();
+
+ sessionTerminate();
}
std::string LLVivoxVoiceClient::getCurrentChannel()
{
- std::string result;
-
+ std::string result;
+
if (mIsInChannel && !mSessionTerminateRequested)
- {
- result = getAudioSessionURI();
- }
-
- return result;
+ {
+ result = getAudioSessionURI();
+ }
+
+ return result;
}
bool LLVivoxVoiceClient::inProximalChannel()
{
- bool result = false;
-
+ bool result = false;
+
if (mIsInChannel && !mSessionTerminateRequested)
- {
- result = inSpatialChannel();
- }
-
- return result;
+ {
+ result = inSpatialChannel();
+ }
+
+ return result;
}
std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id)
{
- std::string result;
- result = "sip:";
- result += nameFromID(id);
- result += "@";
- result += mVoiceSIPURIHostName;
-
- return result;
+ std::string result;
+ result = "sip:";
+ result += nameFromID(id);
+ result += "@";
+ result += mVoiceSIPURIHostName;
+
+ return result;
}
std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
{
- std::string result;
- if(avatar)
- {
- result = "sip:";
- result += nameFromID(avatar->getID());
- result += "@";
- result += mVoiceSIPURIHostName;
- }
-
- return result;
+ std::string result;
+ if(avatar)
+ {
+ result = "sip:";
+ result += nameFromID(avatar->getID());
+ result += "@";
+ result += mVoiceSIPURIHostName;
+ }
+
+ return result;
}
std::string LLVivoxVoiceClient::nameFromAvatar(LLVOAvatar *avatar)
{
- std::string result;
- if(avatar)
- {
- result = nameFromID(avatar->getID());
- }
- return result;
+ std::string result;
+ if(avatar)
+ {
+ result = nameFromID(avatar->getID());
+ }
+ return result;
}
std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid)
{
- std::string result;
-
- if (uuid.isNull()) {
- //VIVOX, the uuid emtpy look for the mURIString and return that instead.
- //result.assign(uuid.mURIStringName);
- LLStringUtil::replaceChar(result, '_', ' ');
- return result;
- }
- // Prepending this apparently prevents conflicts with reserved names inside the vivox code.
- result = "x";
-
- // Base64 encode and replace the pieces of base64 that are less compatible
- // with e-mail local-parts.
- // See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
- result += LLBase64::encode(uuid.mData, UUID_BYTES);
- LLStringUtil::replaceChar(result, '+', '-');
- LLStringUtil::replaceChar(result, '/', '_');
-
- // If you need to transform a GUID to this form on the Mac OS X command line, this will do so:
- // echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-')
-
- // The reverse transform can be done with:
- // echo 'x5mkTKmxDTuGnjWyC__WfMg==' |cut -b 2- -|tr '_-' '/+' |openssl base64 -d|xxd -p
-
- return result;
+ std::string result;
+
+ if (uuid.isNull()) {
+ //VIVOX, the uuid emtpy look for the mURIString and return that instead.
+ //result.assign(uuid.mURIStringName);
+ LLStringUtil::replaceChar(result, '_', ' ');
+ return result;
+ }
+ // Prepending this apparently prevents conflicts with reserved names inside the vivox code.
+ result = "x";
+
+ // Base64 encode and replace the pieces of base64 that are less compatible
+ // with e-mail local-parts.
+ // See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
+ result += LLBase64::encode(uuid.mData, UUID_BYTES);
+ LLStringUtil::replaceChar(result, '+', '-');
+ LLStringUtil::replaceChar(result, '/', '_');
+
+ // If you need to transform a GUID to this form on the Mac OS X command line, this will do so:
+ // echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-')
+
+ // The reverse transform can be done with:
+ // echo 'x5mkTKmxDTuGnjWyC__WfMg==' |cut -b 2- -|tr '_-' '/+' |openssl base64 -d|xxd -p
+
+ return result;
}
bool LLVivoxVoiceClient::IDFromName(const std::string inName, LLUUID &uuid)
{
- bool result = false;
-
- // SLIM SDK: The "name" may actually be a SIP URI such as: "sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com"
- // If it is, convert to a bare name before doing the transform.
- std::string name = nameFromsipURI(inName);
-
- // Doesn't look like a SIP URI, assume it's an actual name.
- if(name.empty())
- name = inName;
-
- // This will only work if the name is of the proper form.
- // As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
- // "xFnPP04IpREWNkuw1cOXlhw=="
-
- if((name.size() == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
- {
- // The name appears to have the right form.
-
- // Reverse the transforms done by nameFromID
- std::string temp = name;
- LLStringUtil::replaceChar(temp, '-', '+');
- LLStringUtil::replaceChar(temp, '_', '/');
-
- U8 rawuuid[UUID_BYTES + 1];
- int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1);
- if(len == UUID_BYTES)
- {
- // The decode succeeded. Stuff the bits into the result's UUID
- memcpy(uuid.mData, rawuuid, UUID_BYTES);
- result = true;
- }
- }
-
- if(!result)
- {
- // VIVOX: not a standard account name, just copy the URI name mURIString field
- // and hope for the best. bpj
- uuid.setNull(); // VIVOX, set the uuid field to nulls
- }
-
- return result;
+ bool result = false;
+
+ // SLIM SDK: The "name" may actually be a SIP URI such as: "sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com"
+ // If it is, convert to a bare name before doing the transform.
+ std::string name = nameFromsipURI(inName);
+
+ // Doesn't look like a SIP URI, assume it's an actual name.
+ if(name.empty())
+ name = inName;
+
+ // This will only work if the name is of the proper form.
+ // As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
+ // "xFnPP04IpREWNkuw1cOXlhw=="
+
+ if((name.size() == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
+ {
+ // The name appears to have the right form.
+
+ // Reverse the transforms done by nameFromID
+ std::string temp = name;
+ LLStringUtil::replaceChar(temp, '-', '+');
+ LLStringUtil::replaceChar(temp, '_', '/');
+
+ U8 rawuuid[UUID_BYTES + 1];
+ int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1);
+ if(len == UUID_BYTES)
+ {
+ // The decode succeeded. Stuff the bits into the result's UUID
+ memcpy(uuid.mData, rawuuid, UUID_BYTES);
+ result = true;
+ }
+ }
+
+ if(!result)
+ {
+ // VIVOX: not a standard account name, just copy the URI name mURIString field
+ // and hope for the best. bpj
+ uuid.setNull(); // VIVOX, set the uuid field to nulls
+ }
+
+ return result;
}
std::string LLVivoxVoiceClient::displayNameFromAvatar(LLVOAvatar *avatar)
{
- return avatar->getFullname();
+ return avatar->getFullname();
}
std::string LLVivoxVoiceClient::sipURIFromName(std::string &name)
{
- std::string result;
- result = "sip:";
- result += name;
- result += "@";
- result += mVoiceSIPURIHostName;
+ std::string result;
+ result = "sip:";
+ result += name;
+ result += "@";
+ result += mVoiceSIPURIHostName;
-// LLStringUtil::toLower(result);
+// LLStringUtil::toLower(result);
- return result;
+ return result;
}
std::string LLVivoxVoiceClient::nameFromsipURI(const std::string &uri)
{
- std::string result;
+ std::string result;
- std::string::size_type sipOffset, atOffset;
- sipOffset = uri.find("sip:");
- atOffset = uri.find("@");
- if((sipOffset != std::string::npos) && (atOffset != std::string::npos))
- {
- result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4));
- }
-
- return result;
+ std::string::size_type sipOffset, atOffset;
+ sipOffset = uri.find("sip:");
+ atOffset = uri.find("@");
+ if((sipOffset != std::string::npos) && (atOffset != std::string::npos))
+ {
+ result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4));
+ }
+
+ return result;
}
bool LLVivoxVoiceClient::inSpatialChannel(void)
{
- bool result = false;
-
- if(mAudioSession)
+ bool result = false;
+
+ if(mAudioSession)
{
- result = mAudioSession->mIsSpatial;
+ result = mAudioSession->mIsSpatial;
}
-
- return result;
+
+ return result;
}
std::string LLVivoxVoiceClient::getAudioSessionURI()
{
- std::string result;
-
- if(mAudioSession)
- result = mAudioSession->mSIPURI;
-
- return result;
+ std::string result;
+
+ if(mAudioSession)
+ result = mAudioSession->mSIPURI;
+
+ return result;
}
std::string LLVivoxVoiceClient::getAudioSessionHandle()
{
- std::string result;
-
- if(mAudioSession)
- result = mAudioSession->mHandle;
-
- return result;
+ std::string result;
+
+ if(mAudioSession)
+ result = mAudioSession->mHandle;
+
+ return result;
}
@@ -5458,138 +5458,138 @@ std::string LLVivoxVoiceClient::getAudioSessionHandle()
void LLVivoxVoiceClient::enforceTether(void)
{
- LLVector3d tethered = mCameraRequestedPosition;
-
- // constrain 'tethered' to within 50m of mAvatarPosition.
- {
- F32 max_dist = 50.0f;
- LLVector3d camera_offset = mCameraRequestedPosition - mAvatarPosition;
- F32 camera_distance = (F32)camera_offset.magVec();
- if(camera_distance > max_dist)
- {
- tethered = mAvatarPosition +
- (max_dist / camera_distance) * camera_offset;
- }
- }
-
- if(dist_vec_squared(mCameraPosition, tethered) > 0.01)
- {
- mCameraPosition = tethered;
- mSpatialCoordsDirty = true;
- }
+ LLVector3d tethered = mCameraRequestedPosition;
+
+ // constrain 'tethered' to within 50m of mAvatarPosition.
+ {
+ F32 max_dist = 50.0f;
+ LLVector3d camera_offset = mCameraRequestedPosition - mAvatarPosition;
+ F32 camera_distance = (F32)camera_offset.magVec();
+ if(camera_distance > max_dist)
+ {
+ tethered = mAvatarPosition +
+ (max_dist / camera_distance) * camera_offset;
+ }
+ }
+
+ if(dist_vec_squared(mCameraPosition, tethered) > 0.01)
+ {
+ mCameraPosition = tethered;
+ mSpatialCoordsDirty = true;
+ }
}
void LLVivoxVoiceClient::updatePosition(void)
{
- LLViewerRegion *region = gAgent.getRegion();
- if(region && isAgentAvatarValid())
- {
- LLMatrix3 rot;
- LLVector3d pos;
+ LLViewerRegion *region = gAgent.getRegion();
+ if(region && isAgentAvatarValid())
+ {
+ LLMatrix3 rot;
+ LLVector3d pos;
LLQuaternion qrot;
-
- // TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
- // They're currently always set to zero.
-
- // Send the current camera position to the voice code
- rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (), LLViewerCamera::getInstance()->getUpAxis());
- pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
-
- LLVivoxVoiceClient::getInstance()->setCameraPosition(
- pos, // position
- LLVector3::zero, // velocity
- rot); // rotation matrix
-
- // Send the current avatar position to the voice code
+
+ // TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
+ // They're currently always set to zero.
+
+ // Send the current camera position to the voice code
+ rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (), LLViewerCamera::getInstance()->getUpAxis());
+ pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
+
+ LLVivoxVoiceClient::getInstance()->setCameraPosition(
+ pos, // position
+ LLVector3::zero, // velocity
+ rot); // rotation matrix
+
+ // Send the current avatar position to the voice code
qrot = gAgentAvatarp->getRootJoint()->getWorldRotation();
- pos = gAgentAvatarp->getPositionGlobal();
+ pos = gAgentAvatarp->getPositionGlobal();
+
+ // TODO: Can we get the head offset from outside the LLVOAvatar?
+ // pos += LLVector3d(mHeadOffset);
+ pos += LLVector3d(0.f, 0.f, 1.f);
- // TODO: Can we get the head offset from outside the LLVOAvatar?
- // pos += LLVector3d(mHeadOffset);
- pos += LLVector3d(0.f, 0.f, 1.f);
-
- LLVivoxVoiceClient::getInstance()->setAvatarPosition(
- pos, // position
- LLVector3::zero, // velocity
- qrot); // rotation matrix
- }
+ LLVivoxVoiceClient::getInstance()->setAvatarPosition(
+ pos, // position
+ LLVector3::zero, // velocity
+ qrot); // rotation matrix
+ }
}
void LLVivoxVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
{
- mCameraRequestedPosition = position;
-
- if(mCameraVelocity != velocity)
- {
- mCameraVelocity = velocity;
- mSpatialCoordsDirty = true;
- }
-
- if(mCameraRot != rot)
- {
- mCameraRot = rot;
- mSpatialCoordsDirty = true;
- }
+ mCameraRequestedPosition = position;
+
+ if(mCameraVelocity != velocity)
+ {
+ mCameraVelocity = velocity;
+ mSpatialCoordsDirty = true;
+ }
+
+ if(mCameraRot != rot)
+ {
+ mCameraRot = rot;
+ mSpatialCoordsDirty = true;
+ }
}
void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLQuaternion &rot)
{
- if(dist_vec_squared(mAvatarPosition, position) > 0.01)
- {
- mAvatarPosition = position;
- mSpatialCoordsDirty = true;
- }
-
- if(mAvatarVelocity != velocity)
- {
- mAvatarVelocity = velocity;
- mSpatialCoordsDirty = true;
- }
-
+ if(dist_vec_squared(mAvatarPosition, position) > 0.01)
+ {
+ mAvatarPosition = position;
+ mSpatialCoordsDirty = true;
+ }
+
+ if(mAvatarVelocity != velocity)
+ {
+ mAvatarVelocity = velocity;
+ mSpatialCoordsDirty = true;
+ }
+
// If the two rotations are not exactly equal test their dot product
// to get the cos of the angle between them.
// If it is too small, don't update.
F32 rot_cos_diff = llabs(dot(mAvatarRot, rot));
if ((mAvatarRot != rot) && (rot_cos_diff < MINUSCULE_ANGLE_COS))
- {
- mAvatarRot = rot;
- mSpatialCoordsDirty = true;
- }
+ {
+ mAvatarRot = rot;
+ mSpatialCoordsDirty = true;
+ }
}
bool LLVivoxVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
{
- bool result = false;
-
- if(region)
- {
- name = region->getName();
- }
-
- if(!name.empty())
- result = true;
-
- return result;
+ bool result = false;
+
+ if(region)
+ {
+ name = region->getName();
+ }
+
+ if(!name.empty())
+ result = true;
+
+ return result;
}
void LLVivoxVoiceClient::leaveChannel(void)
{
if (mIsInChannel)
- {
- LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
- mChannelName.clear();
- sessionTerminate();
- }
+ {
+ LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
+ mChannelName.clear();
+ sessionTerminate();
+ }
}
void LLVivoxVoiceClient::setMuteMic(bool muted)
{
- if(mMuteMic != muted)
- {
- mMuteMic = muted;
- mMuteMicDirty = true;
- }
+ if(mMuteMic != muted)
+ {
+ mMuteMic = muted;
+ mMuteMicDirty = true;
+ }
}
void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
@@ -5599,19 +5599,19 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
<< " was "<< (mVoiceEnabled ? "enabled" : "disabled")
<< " coro "<< (mIsCoroutineActive ? "active" : "inactive")
<< LL_ENDL;
-
- if (enabled != mVoiceEnabled)
- {
- // TODO: Refactor this so we don't call into LLVoiceChannel, but simply
- // use the status observer
- mVoiceEnabled = enabled;
- LLVoiceClientStatusObserver::EStatusType status;
-
- if (enabled)
- {
+
+ if (enabled != mVoiceEnabled)
+ {
+ // TODO: Refactor this so we don't call into LLVoiceChannel, but simply
+ // use the status observer
+ mVoiceEnabled = enabled;
+ LLVoiceClientStatusObserver::EStatusType status;
+
+ if (enabled)
+ {
LL_DEBUGS("Voice") << "enabling" << LL_ENDL;
- LLVoiceChannel::getCurrentVoiceChannel()->activate();
- status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
+ LLVoiceChannel::getCurrentVoiceChannel()->activate();
+ status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
if (!mIsCoroutineActive)
{
@@ -5622,17 +5622,17 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
{
LL_DEBUGS("Voice") << "coro should be active.. not launching" << LL_ENDL;
}
- }
- else
- {
- // Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
- LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
- gAgent.setVoiceConnected(false);
- status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
- }
-
- notifyStatusObservers(status);
- }
+ }
+ else
+ {
+ // Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
+ LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
+ gAgent.setVoiceConnected(false);
+ status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
+ }
+
+ notifyStatusObservers(status);
+ }
else
{
LL_DEBUGS("Voice") << " no-op" << LL_ENDL;
@@ -5648,162 +5648,162 @@ bool LLVivoxVoiceClient::voiceEnabled()
void LLVivoxVoiceClient::setLipSyncEnabled(BOOL enabled)
{
- mLipSyncEnabled = enabled;
+ mLipSyncEnabled = enabled;
}
BOOL LLVivoxVoiceClient::lipSyncEnabled()
{
-
- if ( mVoiceEnabled )
- {
- return mLipSyncEnabled;
- }
- else
- {
- return FALSE;
- }
+
+ if ( mVoiceEnabled )
+ {
+ return mLipSyncEnabled;
+ }
+ else
+ {
+ return FALSE;
+ }
}
void LLVivoxVoiceClient::setEarLocation(S32 loc)
{
- if(mEarLocation != loc)
- {
- LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
-
- mEarLocation = loc;
- mSpatialCoordsDirty = true;
- }
+ if(mEarLocation != loc)
+ {
+ LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
+
+ mEarLocation = loc;
+ mSpatialCoordsDirty = true;
+ }
}
void LLVivoxVoiceClient::setVoiceVolume(F32 volume)
{
- int scaled_volume = scale_speaker_volume(volume);
+ int scaled_volume = scale_speaker_volume(volume);
- if(scaled_volume != mSpeakerVolume)
- {
- int min_volume = scale_speaker_volume(0);
- if((scaled_volume == min_volume) || (mSpeakerVolume == min_volume))
- {
- mSpeakerMuteDirty = true;
- }
+ if(scaled_volume != mSpeakerVolume)
+ {
+ int min_volume = scale_speaker_volume(0);
+ if((scaled_volume == min_volume) || (mSpeakerVolume == min_volume))
+ {
+ mSpeakerMuteDirty = true;
+ }
- mSpeakerVolume = scaled_volume;
- mSpeakerVolumeDirty = true;
- }
+ mSpeakerVolume = scaled_volume;
+ mSpeakerVolumeDirty = true;
+ }
}
void LLVivoxVoiceClient::setMicGain(F32 volume)
{
- int scaled_volume = scale_mic_volume(volume);
-
- if(scaled_volume != mMicVolume)
- {
- mMicVolume = scaled_volume;
- mMicVolumeDirty = true;
- }
+ int scaled_volume = scale_mic_volume(volume);
+
+ if(scaled_volume != mMicVolume)
+ {
+ mMicVolume = scaled_volume;
+ mMicVolumeDirty = true;
+ }
}
/////////////////////////////
// Accessors for data related to nearby speakers
BOOL LLVivoxVoiceClient::getVoiceEnabled(const LLUUID& id)
{
- BOOL result = FALSE;
+ BOOL result = FALSE;
participantStatePtr_t participant(findParticipantByID(id));
- if(participant)
- {
- // I'm not sure what the semantics of this should be.
- // For now, if we have any data about the user that came through the chat channel, assume they're voice-enabled.
- result = TRUE;
- }
-
- return result;
+ if(participant)
+ {
+ // I'm not sure what the semantics of this should be.
+ // For now, if we have any data about the user that came through the chat channel, assume they're voice-enabled.
+ result = TRUE;
+ }
+
+ return result;
}
std::string LLVivoxVoiceClient::getDisplayName(const LLUUID& id)
{
- std::string result;
+ std::string result;
participantStatePtr_t participant(findParticipantByID(id));
- if(participant)
- {
- result = participant->mDisplayName;
- }
-
- return result;
+ if(participant)
+ {
+ result = participant->mDisplayName;
+ }
+
+ return result;
}
BOOL LLVivoxVoiceClient::getIsSpeaking(const LLUUID& id)
{
- BOOL result = FALSE;
+ BOOL result = FALSE;
participantStatePtr_t participant(findParticipantByID(id));
- if(participant)
- {
- if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT)
- {
- participant->mIsSpeaking = FALSE;
- }
- result = participant->mIsSpeaking;
- }
-
- return result;
+ if(participant)
+ {
+ if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT)
+ {
+ participant->mIsSpeaking = FALSE;
+ }
+ result = participant->mIsSpeaking;
+ }
+
+ return result;
}
BOOL LLVivoxVoiceClient::getIsModeratorMuted(const LLUUID& id)
{
- BOOL result = FALSE;
+ BOOL result = FALSE;
participantStatePtr_t participant(findParticipantByID(id));
- if(participant)
- {
- result = participant->mIsModeratorMuted;
- }
-
- return result;
+ if(participant)
+ {
+ result = participant->mIsModeratorMuted;
+ }
+
+ return result;
}
F32 LLVivoxVoiceClient::getCurrentPower(const LLUUID& id)
-{
- F32 result = 0;
+{
+ F32 result = 0;
participantStatePtr_t participant(findParticipantByID(id));
- if(participant)
- {
- result = participant->mPower;
- }
-
- return result;
+ if(participant)
+ {
+ result = participant->mPower;
+ }
+
+ return result;
}
BOOL LLVivoxVoiceClient::getUsingPTT(const LLUUID& id)
{
- BOOL result = FALSE;
+ BOOL result = FALSE;
participantStatePtr_t participant(findParticipantByID(id));
- if(participant)
- {
- // I'm not sure what the semantics of this should be.
- // Does "using PTT" mean they're configured with a push-to-talk button?
- // For now, we know there's no PTT mechanism in place, so nobody is using it.
- }
-
- return result;
+ if(participant)
+ {
+ // I'm not sure what the semantics of this should be.
+ // Does "using PTT" mean they're configured with a push-to-talk button?
+ // For now, we know there's no PTT mechanism in place, so nobody is using it.
+ }
+
+ return result;
}
BOOL LLVivoxVoiceClient::getOnMuteList(const LLUUID& id)
{
- BOOL result = FALSE;
-
+ BOOL result = FALSE;
+
participantStatePtr_t participant(findParticipantByID(id));
- if(participant)
- {
- result = participant->mOnMuteList;
- }
+ if(participant)
+ {
+ result = participant->mOnMuteList;
+ }
- return result;
+ return result;
}
// External accessors.
@@ -5811,163 +5811,163 @@ F32 LLVivoxVoiceClient::getUserVolume(const LLUUID& id)
{
// Minimum volume will be returned for users with voice disabled
F32 result = LLVoiceClient::VOLUME_MIN;
-
+
participantStatePtr_t participant(findParticipantByID(id));
if(participant)
- {
- result = participant->mVolume;
+ {
+ result = participant->mVolume;
- // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
- // LL_DEBUGS("Voice") << "mVolume = " << result << " for " << id << LL_ENDL;
- }
+ // Enable this when debugging voice slider issues. It's way to spammy even for debug-level logging.
+ // LL_DEBUGS("Voice") << "mVolume = " << result << " for " << id << LL_ENDL;
+ }
- return result;
+ return result;
}
void LLVivoxVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
{
- if(mAudioSession)
- {
+ if(mAudioSession)
+ {
participantStatePtr_t participant(findParticipantByID(id));
- if (participant && !participant->mIsSelf)
- {
- if (!is_approx_equal(volume, LLVoiceClient::VOLUME_DEFAULT))
- {
- // Store this volume setting for future sessions if it has been
- // changed from the default
- LLSpeakerVolumeStorage::getInstance()->storeSpeakerVolume(id, volume);
- }
- else
- {
- // Remove stored volume setting if it is returned to the default
- LLSpeakerVolumeStorage::getInstance()->removeSpeakerVolume(id);
- }
-
- participant->mVolume = llclamp(volume, LLVoiceClient::VOLUME_MIN, LLVoiceClient::VOLUME_MAX);
- participant->mVolumeDirty = true;
- mAudioSession->mVolumeDirty = true;
- }
- }
+ if (participant && !participant->mIsSelf)
+ {
+ if (!is_approx_equal(volume, LLVoiceClient::VOLUME_DEFAULT))
+ {
+ // Store this volume setting for future sessions if it has been
+ // changed from the default
+ LLSpeakerVolumeStorage::getInstance()->storeSpeakerVolume(id, volume);
+ }
+ else
+ {
+ // Remove stored volume setting if it is returned to the default
+ LLSpeakerVolumeStorage::getInstance()->removeSpeakerVolume(id);
+ }
+
+ participant->mVolume = llclamp(volume, LLVoiceClient::VOLUME_MIN, LLVoiceClient::VOLUME_MAX);
+ participant->mVolumeDirty = true;
+ mAudioSession->mVolumeDirty = true;
+ }
+ }
}
std::string LLVivoxVoiceClient::getGroupID(const LLUUID& id)
{
- std::string result;
+ std::string result;
participantStatePtr_t participant(findParticipantByID(id));
- if(participant)
- {
- result = participant->mGroupID;
- }
-
- return result;
+ if(participant)
+ {
+ result = participant->mGroupID;
+ }
+
+ return result;
}
BOOL LLVivoxVoiceClient::getAreaVoiceDisabled()
{
- return mAreaVoiceDisabled;
+ return mAreaVoiceDisabled;
}
void LLVivoxVoiceClient::recordingLoopStart(int seconds, int deltaFramesPerControlFrame)
{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
-
- if(!mMainSessionGroupHandle.empty())
- {
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Start</RecordingControlType>"
- << "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
- << "<Filename>" << "" << "</Filename>"
- << "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
- << "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
- << "</Request>\n\n\n";
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
+
+ if(!mMainSessionGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Start</RecordingControlType>"
+ << "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
+ << "<Filename>" << "" << "</Filename>"
+ << "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
+ << "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
+ << "</Request>\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::recordingLoopSave(const std::string& filename)
{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
- if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
- {
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Flush</RecordingControlType>"
- << "<Filename>" << filename << "</Filename>"
- << "</Request>\n\n\n";
+ if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Flush</RecordingControlType>"
+ << "<Filename>" << filename << "</Filename>"
+ << "</Request>\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::recordingStop()
{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Stop)" << LL_ENDL;
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Stop)" << LL_ENDL;
- if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
- {
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Stop</RecordingControlType>"
- << "</Request>\n\n\n";
+ if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Stop</RecordingControlType>"
+ << "</Request>\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::filePlaybackStart(const std::string& filename)
{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Start)" << LL_ENDL;
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Start)" << LL_ENDL;
- if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
- {
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Start</RecordingControlType>"
- << "<Filename>" << filename << "</Filename>"
- << "</Request>\n\n\n";
+ if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Start</RecordingControlType>"
+ << "<Filename>" << filename << "</Filename>"
+ << "</Request>\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::filePlaybackStop()
{
-// LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Stop)" << LL_ENDL;
+// LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Stop)" << LL_ENDL;
- if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
- {
- std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
- << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
- << "<RecordingControlType>Stop</RecordingControlType>"
- << "</Request>\n\n\n";
+ if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+ {
+ std::ostringstream stream;
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+ << "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+ << "<RecordingControlType>Stop</RecordingControlType>"
+ << "</Request>\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::filePlaybackSetPaused(bool paused)
{
- // TODO: Implement once Vivox gives me a sample
+ // TODO: Implement once Vivox gives me a sample
}
void LLVivoxVoiceClient::filePlaybackSetMode(bool vox, float speed)
{
- // TODO: Implement once Vivox gives me a sample
+ // TODO: Implement once Vivox gives me a sample
}
//------------------------------------------------------------------------
@@ -6013,25 +6013,25 @@ LLVivoxVoiceClient::sessionState::~sessionState()
if (mMyIterator != mSession.end())
mSession.erase(mMyIterator);
- removeAllParticipants();
+ removeAllParticipants();
}
bool LLVivoxVoiceClient::sessionState::isCallBackPossible()
{
- // This may change to be explicitly specified by vivox in the future...
- // Currently, only PSTN P2P calls cannot be returned.
- // Conveniently, this is also the only case where we synthesize a caller UUID.
- return !mSynthesizedCallerID;
+ // This may change to be explicitly specified by vivox in the future...
+ // Currently, only PSTN P2P calls cannot be returned.
+ // Conveniently, this is also the only case where we synthesize a caller UUID.
+ return !mSynthesizedCallerID;
}
bool LLVivoxVoiceClient::sessionState::isTextIMPossible()
{
- // This may change to be explicitly specified by vivox in the future...
- return !mSynthesizedCallerID;
+ // This may change to be explicitly specified by vivox in the future...
+ return !mSynthesizedCallerID;
}
-/*static*/
+/*static*/
LLVivoxVoiceClient::sessionState::ptr_t LLVivoxVoiceClient::sessionState::matchSessionByHandle(const std::string &handle)
{
sessionStatePtr_t result;
@@ -6045,7 +6045,7 @@ LLVivoxVoiceClient::sessionState::ptr_t LLVivoxVoiceClient::sessionState::matchS
return result;
}
-/*static*/
+/*static*/
LLVivoxVoiceClient::sessionState::ptr_t LLVivoxVoiceClient::sessionState::matchCreatingSessionByURI(const std::string &uri)
{
sessionStatePtr_t result;
@@ -6092,7 +6092,7 @@ void LLVivoxVoiceClient::sessionState::for_each(sessionFunc_t func)
std::for_each(mSession.begin(), mSession.end(), boost::bind(for_eachPredicate, _1, func));
}
-// simple test predicates.
+// simple test predicates.
// *TODO: These should be made into lambdas when we can pull the trigger on newer C++ features.
bool LLVivoxVoiceClient::sessionState::testByHandle(const LLVivoxVoiceClient::sessionState::wptr_t &a, std::string handle)
{
@@ -6141,104 +6141,104 @@ void LLVivoxVoiceClient::sessionState::for_eachPredicate(const LLVivoxVoiceClien
LLVivoxVoiceClient::sessionStatePtr_t LLVivoxVoiceClient::findSession(const std::string &handle)
{
sessionStatePtr_t result;
- sessionMap::iterator iter = mSessionsByHandle.find(handle);
- if(iter != mSessionsByHandle.end())
- {
- result = iter->second;
- }
-
- return result;
+ sessionMap::iterator iter = mSessionsByHandle.find(handle);
+ if(iter != mSessionsByHandle.end())
+ {
+ result = iter->second;
+ }
+
+ return result;
}
LLVivoxVoiceClient::sessionStatePtr_t LLVivoxVoiceClient::findSessionBeingCreatedByURI(const std::string &uri)
-{
+{
sessionStatePtr_t result = sessionState::matchCreatingSessionByURI(uri);
-
- return result;
+
+ return result;
}
LLVivoxVoiceClient::sessionStatePtr_t LLVivoxVoiceClient::findSession(const LLUUID &participant_id)
{
sessionStatePtr_t result = sessionState::matchSessionByParticipant(participant_id);
-
- return result;
+
+ return result;
}
LLVivoxVoiceClient::sessionStatePtr_t LLVivoxVoiceClient::addSession(const std::string &uri, const std::string &handle)
{
sessionStatePtr_t result;
-
- if(handle.empty())
- {
+
+ if(handle.empty())
+ {
// No handle supplied.
// Check whether there's already a session with this URI
result = sessionState::matchSessionByURI(uri);
- }
- else // (!handle.empty())
- {
- // Check for an existing session with this handle
- sessionMap::iterator iter = mSessionsByHandle.find(handle);
-
- if(iter != mSessionsByHandle.end())
- {
- result = iter->second;
- }
- }
-
- if(!result)
- {
- // No existing session found.
-
- LL_DEBUGS("Voice") << "adding new session: handle \"" << handle << "\" URI " << uri << LL_ENDL;
+ }
+ else // (!handle.empty())
+ {
+ // Check for an existing session with this handle
+ sessionMap::iterator iter = mSessionsByHandle.find(handle);
+
+ if(iter != mSessionsByHandle.end())
+ {
+ result = iter->second;
+ }
+ }
+
+ if(!result)
+ {
+ // No existing session found.
+
+ LL_DEBUGS("Voice") << "adding new session: handle \"" << handle << "\" URI " << uri << LL_ENDL;
result = sessionState::createSession();
- result->mSIPURI = uri;
- result->mHandle = handle;
-
- if (LLVoiceClient::instance().getVoiceEffectEnabled())
- {
- result->mVoiceFontID = LLVoiceClient::instance().getVoiceEffectDefault();
- }
-
- if(!result->mHandle.empty())
- {
- // *TODO: Rider: This concerns me. There is a path (via switchChannel) where
- // we do not track the session. In theory this means that we could end up with
+ result->mSIPURI = uri;
+ result->mHandle = handle;
+
+ if (LLVoiceClient::instance().getVoiceEffectEnabled())
+ {
+ result->mVoiceFontID = LLVoiceClient::instance().getVoiceEffectDefault();
+ }
+
+ if(!result->mHandle.empty())
+ {
+ // *TODO: Rider: This concerns me. There is a path (via switchChannel) where
+ // we do not track the session. In theory this means that we could end up with
// a mAuidoSession that does not match the session tracked in mSessionsByHandle
- mSessionsByHandle.insert(sessionMap::value_type(result->mHandle, result));
- }
- }
- else
- {
- // Found an existing session
-
- if(uri != result->mSIPURI)
- {
- // TODO: Should this be an internal error?
- LL_DEBUGS("Voice") << "changing uri from " << result->mSIPURI << " to " << uri << LL_ENDL;
- setSessionURI(result, uri);
- }
-
- if(handle != result->mHandle)
- {
- if(handle.empty())
- {
- // There's at least one race condition where where addSession was clearing an existing session handle, which caused things to break.
- LL_DEBUGS("Voice") << "NOT clearing handle " << result->mHandle << LL_ENDL;
- }
- else
- {
- // TODO: Should this be an internal error?
- LL_DEBUGS("Voice") << "changing handle from " << result->mHandle << " to " << handle << LL_ENDL;
- setSessionHandle(result, handle);
- }
- }
-
- LL_DEBUGS("Voice") << "returning existing session: handle " << handle << " URI " << uri << LL_ENDL;
- }
-
- verifySessionState();
-
- return result;
+ mSessionsByHandle.insert(sessionMap::value_type(result->mHandle, result));
+ }
+ }
+ else
+ {
+ // Found an existing session
+
+ if(uri != result->mSIPURI)
+ {
+ // TODO: Should this be an internal error?
+ LL_DEBUGS("Voice") << "changing uri from " << result->mSIPURI << " to " << uri << LL_ENDL;
+ setSessionURI(result, uri);
+ }
+
+ if(handle != result->mHandle)
+ {
+ if(handle.empty())
+ {
+ // There's at least one race condition where where addSession was clearing an existing session handle, which caused things to break.
+ LL_DEBUGS("Voice") << "NOT clearing handle " << result->mHandle << LL_ENDL;
+ }
+ else
+ {
+ // TODO: Should this be an internal error?
+ LL_DEBUGS("Voice") << "changing handle from " << result->mHandle << " to " << handle << LL_ENDL;
+ setSessionHandle(result, handle);
+ }
+ }
+
+ LL_DEBUGS("Voice") << "returning existing session: handle " << handle << " URI " << uri << LL_ENDL;
+ }
+
+ verifySessionState();
+
+ return result;
}
void LLVivoxVoiceClient::clearSessionHandle(const sessionStatePtr_t &session)
@@ -6267,89 +6267,89 @@ void LLVivoxVoiceClient::clearSessionHandle(const sessionStatePtr_t &session)
void LLVivoxVoiceClient::setSessionHandle(const sessionStatePtr_t &session, const std::string &handle)
{
- // Have to remove the session from the handle-indexed map before changing the handle, or things will break badly.
-
- if(!session->mHandle.empty())
- {
- // Remove session from the map if it should have been there.
- sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
- if(iter != mSessionsByHandle.end())
- {
- if(iter->second != session)
- {
- LL_WARNS("Voice") << "Internal error: session mismatch! Session may have been duplicated. Removing version in map." << LL_ENDL;
- }
-
- mSessionsByHandle.erase(iter);
- }
- else
- {
+ // Have to remove the session from the handle-indexed map before changing the handle, or things will break badly.
+
+ if(!session->mHandle.empty())
+ {
+ // Remove session from the map if it should have been there.
+ sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
+ if(iter != mSessionsByHandle.end())
+ {
+ if(iter->second != session)
+ {
+ LL_WARNS("Voice") << "Internal error: session mismatch! Session may have been duplicated. Removing version in map." << LL_ENDL;
+ }
+
+ mSessionsByHandle.erase(iter);
+ }
+ else
+ {
LL_WARNS("Voice") << "Attempt to remove session with handle " << session->mHandle << " not found in map!" << LL_ENDL;
- }
- }
-
- session->mHandle = handle;
+ }
+ }
- if(!handle.empty())
- {
- mSessionsByHandle.insert(sessionMap::value_type(session->mHandle, session));
- }
+ session->mHandle = handle;
+
+ if(!handle.empty())
+ {
+ mSessionsByHandle.insert(sessionMap::value_type(session->mHandle, session));
+ }
- verifySessionState();
+ verifySessionState();
}
void LLVivoxVoiceClient::setSessionURI(const sessionStatePtr_t &session, const std::string &uri)
{
- // There used to be a map of session URIs to sessions, which made this complex....
- session->mSIPURI = uri;
+ // There used to be a map of session URIs to sessions, which made this complex....
+ session->mSIPURI = uri;
- verifySessionState();
+ verifySessionState();
}
void LLVivoxVoiceClient::deleteSession(const sessionStatePtr_t &session)
{
- // Remove the session from the handle map
- if(!session->mHandle.empty())
- {
- sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
- if(iter != mSessionsByHandle.end())
- {
- if(iter->second != session)
- {
- LL_WARNS("Voice") << "Internal error: session mismatch, removing session in map." << LL_ENDL;
- }
- mSessionsByHandle.erase(iter);
- }
- }
-
- // At this point, the session should be unhooked from all lists and all state should be consistent.
- verifySessionState();
-
- // If this is the current audio session, clean up the pointer which will soon be dangling.
- if(mAudioSession == session)
- {
- mAudioSession.reset();
- mAudioSessionChanged = true;
- }
-
- // ditto for the next audio session
- if(mNextAudioSession == session)
- {
- mNextAudioSession.reset();
- }
+ // Remove the session from the handle map
+ if(!session->mHandle.empty())
+ {
+ sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
+ if(iter != mSessionsByHandle.end())
+ {
+ if(iter->second != session)
+ {
+ LL_WARNS("Voice") << "Internal error: session mismatch, removing session in map." << LL_ENDL;
+ }
+ mSessionsByHandle.erase(iter);
+ }
+ }
+
+ // At this point, the session should be unhooked from all lists and all state should be consistent.
+ verifySessionState();
+
+ // If this is the current audio session, clean up the pointer which will soon be dangling.
+ if(mAudioSession == session)
+ {
+ mAudioSession.reset();
+ mAudioSessionChanged = true;
+ }
+
+ // ditto for the next audio session
+ if(mNextAudioSession == session)
+ {
+ mNextAudioSession.reset();
+ }
}
void LLVivoxVoiceClient::deleteAllSessions()
{
- LL_DEBUGS("Voice") << LL_ENDL;
+ LL_DEBUGS("Voice") << LL_ENDL;
while (!mSessionsByHandle.empty())
- {
+ {
const sessionStatePtr_t session = mSessionsByHandle.begin()->second;
deleteSession(session);
- }
-
+ }
+
}
void LLVivoxVoiceClient::verifySessionState(void)
@@ -6360,35 +6360,35 @@ void LLVivoxVoiceClient::verifySessionState(void)
void LLVivoxVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
{
- mParticipantObservers.insert(observer);
+ mParticipantObservers.insert(observer);
}
void LLVivoxVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
{
- mParticipantObservers.erase(observer);
+ mParticipantObservers.erase(observer);
}
void LLVivoxVoiceClient::notifyParticipantObservers()
{
- for (observer_set_t::iterator it = mParticipantObservers.begin();
- it != mParticipantObservers.end();
- )
- {
- LLVoiceClientParticipantObserver* observer = *it;
- observer->onParticipantsChanged();
- // In case onParticipantsChanged() deleted an entry.
- it = mParticipantObservers.upper_bound(observer);
- }
+ for (observer_set_t::iterator it = mParticipantObservers.begin();
+ it != mParticipantObservers.end();
+ )
+ {
+ LLVoiceClientParticipantObserver* observer = *it;
+ observer->onParticipantsChanged();
+ // In case onParticipantsChanged() deleted an entry.
+ it = mParticipantObservers.upper_bound(observer);
+ }
}
void LLVivoxVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
{
- mStatusObservers.insert(observer);
+ mStatusObservers.insert(observer);
}
void LLVivoxVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
{
- mStatusObservers.erase(observer);
+ mStatusObservers.erase(observer);
}
void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
@@ -6397,117 +6397,117 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta
<< " mAudioSession=" << mAudioSession
<< LL_ENDL;
- if(mAudioSession)
- {
- if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
- {
- switch(mAudioSession->mErrorStatusCode)
- {
- case 20713: status = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL; break;
- case 20714: status = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED; break;
- case 20715:
- //invalid channel, we may be using a set of poorly cached
- //info
- status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
- break;
- case 1009:
- //invalid username and password
- status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
- break;
- }
-
- // Reset the error code to make sure it won't be reused later by accident.
- mAudioSession->mErrorStatusCode = 0;
- }
- else if(status == LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL)
- {
- switch(mAudioSession->mErrorStatusCode)
- {
- case HTTP_NOT_FOUND: // NOT_FOUND
- // *TODO: Should this be 503?
- case 480: // TEMPORARILY_UNAVAILABLE
- case HTTP_REQUEST_TIME_OUT: // REQUEST_TIMEOUT
- // call failed because other user was not available
- // treat this as an error case
- status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
-
- // Reset the error code to make sure it won't be reused later by accident.
- mAudioSession->mErrorStatusCode = 0;
- break;
- }
- }
- }
-
- LL_DEBUGS("Voice")
- << " " << LLVoiceClientStatusObserver::status2string(status)
- << ", session URI " << getAudioSessionURI()
- << ", proximal is " << inSpatialChannel()
+ if(mAudioSession)
+ {
+ if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
+ {
+ switch(mAudioSession->mErrorStatusCode)
+ {
+ case 20713: status = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL; break;
+ case 20714: status = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED; break;
+ case 20715:
+ //invalid channel, we may be using a set of poorly cached
+ //info
+ status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+ break;
+ case 1009:
+ //invalid username and password
+ status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+ break;
+ }
+
+ // Reset the error code to make sure it won't be reused later by accident.
+ mAudioSession->mErrorStatusCode = 0;
+ }
+ else if(status == LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL)
+ {
+ switch(mAudioSession->mErrorStatusCode)
+ {
+ case HTTP_NOT_FOUND: // NOT_FOUND
+ // *TODO: Should this be 503?
+ case 480: // TEMPORARILY_UNAVAILABLE
+ case HTTP_REQUEST_TIME_OUT: // REQUEST_TIMEOUT
+ // call failed because other user was not available
+ // treat this as an error case
+ status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+
+ // Reset the error code to make sure it won't be reused later by accident.
+ mAudioSession->mErrorStatusCode = 0;
+ break;
+ }
+ }
+ }
+
+ LL_DEBUGS("Voice")
+ << " " << LLVoiceClientStatusObserver::status2string(status)
+ << ", session URI " << getAudioSessionURI()
+ << ", proximal is " << inSpatialChannel()
<< LL_ENDL;
- for (status_observer_set_t::iterator it = mStatusObservers.begin();
- it != mStatusObservers.end();
- )
- {
- LLVoiceClientStatusObserver* observer = *it;
- observer->onChange(status, getAudioSessionURI(), inSpatialChannel());
- // In case onError() deleted an entry.
- it = mStatusObservers.upper_bound(observer);
- }
+ for (status_observer_set_t::iterator it = mStatusObservers.begin();
+ it != mStatusObservers.end();
+ )
+ {
+ LLVoiceClientStatusObserver* observer = *it;
+ observer->onChange(status, getAudioSessionURI(), inSpatialChannel());
+ // In case onError() deleted an entry.
+ it = mStatusObservers.upper_bound(observer);
+ }
- // skipped to avoid speak button blinking
- if ( status != LLVoiceClientStatusObserver::STATUS_JOINING
- && status != LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL
- && status != LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED)
- {
- bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+ // skipped to avoid speak button blinking
+ if ( status != LLVoiceClientStatusObserver::STATUS_JOINING
+ && status != LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL
+ && status != LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED)
+ {
+ bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
- gAgent.setVoiceConnected(voice_status);
+ gAgent.setVoiceConnected(voice_status);
- if (voice_status)
- {
- LLFirstUse::speak(true);
- }
- }
+ if (voice_status)
+ {
+ LLFirstUse::speak(true);
+ }
+ }
}
void LLVivoxVoiceClient::addObserver(LLFriendObserver* observer)
{
- mFriendObservers.insert(observer);
+ mFriendObservers.insert(observer);
}
void LLVivoxVoiceClient::removeObserver(LLFriendObserver* observer)
{
- mFriendObservers.erase(observer);
+ mFriendObservers.erase(observer);
}
void LLVivoxVoiceClient::notifyFriendObservers()
{
- for (friend_observer_set_t::iterator it = mFriendObservers.begin();
- it != mFriendObservers.end();
- )
- {
- LLFriendObserver* observer = *it;
- it++;
- // The only friend-related thing we notify on is online/offline transitions.
- observer->changed(LLFriendObserver::ONLINE);
- }
+ for (friend_observer_set_t::iterator it = mFriendObservers.begin();
+ it != mFriendObservers.end();
+ )
+ {
+ LLFriendObserver* observer = *it;
+ it++;
+ // The only friend-related thing we notify on is online/offline transitions.
+ observer->changed(LLFriendObserver::ONLINE);
+ }
}
void LLVivoxVoiceClient::lookupName(const LLUUID &id)
{
- if (mAvatarNameCacheConnection.connected())
- {
- mAvatarNameCacheConnection.disconnect();
- }
- mAvatarNameCacheConnection = LLAvatarNameCache::get(id, boost::bind(&LLVivoxVoiceClient::onAvatarNameCache, this, _1, _2));
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(id, boost::bind(&LLVivoxVoiceClient::onAvatarNameCache, this, _1, _2));
}
void LLVivoxVoiceClient::onAvatarNameCache(const LLUUID& agent_id,
- const LLAvatarName& av_name)
+ const LLAvatarName& av_name)
{
- mAvatarNameCacheConnection.disconnect();
- std::string display_name = av_name.getDisplayName();
- avatarNameResolved(agent_id, display_name);
+ mAvatarNameCacheConnection.disconnect();
+ std::string display_name = av_name.getDisplayName();
+ avatarNameResolved(agent_id, display_name);
}
void LLVivoxVoiceClient::predAvatarNameResolution(const LLVivoxVoiceClient::sessionStatePtr_t &session, LLUUID id, std::string name)
@@ -6530,7 +6530,7 @@ void LLVivoxVoiceClient::predAvatarNameResolution(const LLVivoxVoiceClient::sess
{
session->mTextInvitePending = false;
- // We don't need to call LLIMMgr::getInstance()->addP2PSession() here. The first incoming message will create the panel.
+ // We don't need to call LLIMMgr::getInstance()->addP2PSession() here. The first incoming message will create the panel.
}
if (session->mVoiceInvitePending)
{
@@ -6557,80 +6557,80 @@ void LLVivoxVoiceClient::avatarNameResolved(const LLUUID &id, const std::string
bool LLVivoxVoiceClient::setVoiceEffect(const LLUUID& id)
{
- if (!mAudioSession)
- {
- return false;
- }
+ if (!mAudioSession)
+ {
+ return false;
+ }
- if (!id.isNull())
- {
- if (mVoiceFontMap.empty())
- {
- LL_DEBUGS("Voice") << "Voice fonts not available." << LL_ENDL;
- return false;
- }
- else if (mVoiceFontMap.find(id) == mVoiceFontMap.end())
- {
- LL_DEBUGS("Voice") << "Invalid voice font " << id << LL_ENDL;
- return false;
- }
- }
+ if (!id.isNull())
+ {
+ if (mVoiceFontMap.empty())
+ {
+ LL_DEBUGS("Voice") << "Voice fonts not available." << LL_ENDL;
+ return false;
+ }
+ else if (mVoiceFontMap.find(id) == mVoiceFontMap.end())
+ {
+ LL_DEBUGS("Voice") << "Invalid voice font " << id << LL_ENDL;
+ return false;
+ }
+ }
- // *TODO: Check for expired fonts?
- mAudioSession->mVoiceFontID = id;
+ // *TODO: Check for expired fonts?
+ mAudioSession->mVoiceFontID = id;
- // *TODO: Separate voice font defaults for spatial chat and IM?
- gSavedPerAccountSettings.setString("VoiceEffectDefault", id.asString());
+ // *TODO: Separate voice font defaults for spatial chat and IM?
+ gSavedPerAccountSettings.setString("VoiceEffectDefault", id.asString());
- sessionSetVoiceFontSendMessage(mAudioSession);
- notifyVoiceFontObservers();
+ sessionSetVoiceFontSendMessage(mAudioSession);
+ notifyVoiceFontObservers();
- return true;
+ return true;
}
const LLUUID LLVivoxVoiceClient::getVoiceEffect()
{
- return mAudioSession ? mAudioSession->mVoiceFontID : LLUUID::null;
+ return mAudioSession ? mAudioSession->mVoiceFontID : LLUUID::null;
}
LLSD LLVivoxVoiceClient::getVoiceEffectProperties(const LLUUID& id)
{
- LLSD sd;
-
- voice_font_map_t::iterator iter = mVoiceFontMap.find(id);
- if (iter != mVoiceFontMap.end())
- {
- sd["template_only"] = false;
- }
- else
- {
- // Voice effect is not in the voice font map, see if there is a template
- iter = mVoiceFontTemplateMap.find(id);
- if (iter == mVoiceFontTemplateMap.end())
- {
- LL_WARNS("Voice") << "Voice effect " << id << "not found." << LL_ENDL;
- return sd;
- }
- sd["template_only"] = true;
- }
-
- voiceFontEntry *font = iter->second;
- sd["name"] = font->mName;
- sd["expiry_date"] = font->mExpirationDate;
- sd["is_new"] = font->mIsNew;
-
- return sd;
+ LLSD sd;
+
+ voice_font_map_t::iterator iter = mVoiceFontMap.find(id);
+ if (iter != mVoiceFontMap.end())
+ {
+ sd["template_only"] = false;
+ }
+ else
+ {
+ // Voice effect is not in the voice font map, see if there is a template
+ iter = mVoiceFontTemplateMap.find(id);
+ if (iter == mVoiceFontTemplateMap.end())
+ {
+ LL_WARNS("Voice") << "Voice effect " << id << "not found." << LL_ENDL;
+ return sd;
+ }
+ sd["template_only"] = true;
+ }
+
+ voiceFontEntry *font = iter->second;
+ sd["name"] = font->mName;
+ sd["expiry_date"] = font->mExpirationDate;
+ sd["is_new"] = font->mIsNew;
+
+ return sd;
}
LLVivoxVoiceClient::voiceFontEntry::voiceFontEntry(LLUUID& id) :
- mID(id),
- mFontIndex(0),
- mFontType(VOICE_FONT_TYPE_NONE),
- mFontStatus(VOICE_FONT_STATUS_NONE),
- mIsNew(false)
+ mID(id),
+ mFontIndex(0),
+ mFontType(VOICE_FONT_TYPE_NONE),
+ mFontStatus(VOICE_FONT_STATUS_NONE),
+ mIsNew(false)
{
- mExpiryTimer.stop();
- mExpiryWarningTimer.stop();
+ mExpiryTimer.stop();
+ mExpiryWarningTimer.stop();
}
LLVivoxVoiceClient::voiceFontEntry::~voiceFontEntry()
@@ -6639,369 +6639,369 @@ LLVivoxVoiceClient::voiceFontEntry::~voiceFontEntry()
void LLVivoxVoiceClient::refreshVoiceEffectLists(bool clear_lists)
{
- if (clear_lists)
- {
- mVoiceFontsReceived = false;
- deleteAllVoiceFonts();
- deleteVoiceFontTemplates();
- }
+ if (clear_lists)
+ {
+ mVoiceFontsReceived = false;
+ deleteAllVoiceFonts();
+ deleteVoiceFontTemplates();
+ }
- accountGetSessionFontsSendMessage();
- accountGetTemplateFontsSendMessage();
+ accountGetSessionFontsSendMessage();
+ accountGetTemplateFontsSendMessage();
}
const voice_effect_list_t& LLVivoxVoiceClient::getVoiceEffectList() const
{
- return mVoiceFontList;
+ return mVoiceFontList;
}
const voice_effect_list_t& LLVivoxVoiceClient::getVoiceEffectTemplateList() const
{
- return mVoiceFontTemplateList;
+ return mVoiceFontTemplateList;
}
void LLVivoxVoiceClient::addVoiceFont(const S32 font_index,
- const std::string &name,
- const std::string &description,
- const LLDate &expiration_date,
- bool has_expired,
- const S32 font_type,
- const S32 font_status,
- const bool template_font)
-{
- // Vivox SessionFontIDs are not guaranteed to remain the same between
- // sessions or grids so use a UUID for the name.
-
- // If received name is not a UUID, fudge one by hashing the name and type.
- LLUUID font_id;
- if (LLUUID::validate(name))
- {
- font_id = LLUUID(name);
- }
- else
- {
- font_id.generate(STRINGIZE(font_type << ":" << name));
- }
-
- voiceFontEntry *font = NULL;
-
- voice_font_map_t& font_map = template_font ? mVoiceFontTemplateMap : mVoiceFontMap;
- voice_effect_list_t& font_list = template_font ? mVoiceFontTemplateList : mVoiceFontList;
-
- // Check whether we've seen this font before.
- voice_font_map_t::iterator iter = font_map.find(font_id);
- bool new_font = (iter == font_map.end());
-
- // Override the has_expired flag if we have passed the expiration_date as a double check.
- if (expiration_date.secondsSinceEpoch() < (LLDate::now().secondsSinceEpoch() + VOICE_FONT_EXPIRY_INTERVAL))
- {
- has_expired = true;
- }
-
- if (has_expired)
- {
- LL_DEBUGS("VoiceFont") << "Expired " << (template_font ? "Template " : "")
- << expiration_date.asString() << " " << font_id
- << " (" << font_index << ") " << name << LL_ENDL;
-
- // Remove existing session fonts that have expired since we last saw them.
- if (!new_font && !template_font)
- {
- deleteVoiceFont(font_id);
- }
- return;
- }
-
- if (new_font)
- {
- // If it is a new font create a new entry.
- font = new voiceFontEntry(font_id);
- }
- else
- {
- // Not a new font, update the existing entry
- font = iter->second;
- }
-
- if (font)
- {
- font->mFontIndex = font_index;
- // Use the description for the human readable name if available, as the
- // "name" may be a UUID.
- font->mName = description.empty() ? name : description;
- font->mFontType = font_type;
- font->mFontStatus = font_status;
-
- // If the font is new or the expiration date has changed the expiry timers need updating.
- if (!template_font && (new_font || font->mExpirationDate != expiration_date))
- {
- font->mExpirationDate = expiration_date;
-
- // Set the expiry timer to trigger a notification when the voice font can no longer be used.
- font->mExpiryTimer.start();
- font->mExpiryTimer.setExpiryAt(expiration_date.secondsSinceEpoch() - VOICE_FONT_EXPIRY_INTERVAL);
-
- // Set the warning timer to some interval before actual expiry.
- S32 warning_time = gSavedSettings.getS32("VoiceEffectExpiryWarningTime");
- if (warning_time != 0)
- {
- font->mExpiryWarningTimer.start();
- F64 expiry_time = (expiration_date.secondsSinceEpoch() - (F64)warning_time);
- font->mExpiryWarningTimer.setExpiryAt(expiry_time - VOICE_FONT_EXPIRY_INTERVAL);
- }
- else
- {
- // Disable the warning timer.
- font->mExpiryWarningTimer.stop();
- }
-
- // Only flag new session fonts after the first time we have fetched the list.
- if (mVoiceFontsReceived)
- {
- font->mIsNew = true;
- mVoiceFontsNew = true;
- }
- }
-
- LL_DEBUGS("VoiceFont") << (template_font ? "Template " : "")
- << font->mExpirationDate.asString() << " " << font->mID
- << " (" << font->mFontIndex << ") " << name << LL_ENDL;
-
- if (new_font)
- {
- font_map.insert(voice_font_map_t::value_type(font->mID, font));
- font_list.insert(voice_effect_list_t::value_type(font->mName, font->mID));
- }
-
- mVoiceFontListDirty = true;
-
- // Debugging stuff
-
- if (font_type < VOICE_FONT_TYPE_NONE || font_type >= VOICE_FONT_TYPE_UNKNOWN)
- {
- LL_WARNS("VoiceFont") << "Unknown voice font type: " << font_type << LL_ENDL;
- }
- if (font_status < VOICE_FONT_STATUS_NONE || font_status >= VOICE_FONT_STATUS_UNKNOWN)
- {
- LL_WARNS("VoiceFont") << "Unknown voice font status: " << font_status << LL_ENDL;
- }
- }
+ const std::string &name,
+ const std::string &description,
+ const LLDate &expiration_date,
+ bool has_expired,
+ const S32 font_type,
+ const S32 font_status,
+ const bool template_font)
+{
+ // Vivox SessionFontIDs are not guaranteed to remain the same between
+ // sessions or grids so use a UUID for the name.
+
+ // If received name is not a UUID, fudge one by hashing the name and type.
+ LLUUID font_id;
+ if (LLUUID::validate(name))
+ {
+ font_id = LLUUID(name);
+ }
+ else
+ {
+ font_id.generate(STRINGIZE(font_type << ":" << name));
+ }
+
+ voiceFontEntry *font = NULL;
+
+ voice_font_map_t& font_map = template_font ? mVoiceFontTemplateMap : mVoiceFontMap;
+ voice_effect_list_t& font_list = template_font ? mVoiceFontTemplateList : mVoiceFontList;
+
+ // Check whether we've seen this font before.
+ voice_font_map_t::iterator iter = font_map.find(font_id);
+ bool new_font = (iter == font_map.end());
+
+ // Override the has_expired flag if we have passed the expiration_date as a double check.
+ if (expiration_date.secondsSinceEpoch() < (LLDate::now().secondsSinceEpoch() + VOICE_FONT_EXPIRY_INTERVAL))
+ {
+ has_expired = true;
+ }
+
+ if (has_expired)
+ {
+ LL_DEBUGS("VoiceFont") << "Expired " << (template_font ? "Template " : "")
+ << expiration_date.asString() << " " << font_id
+ << " (" << font_index << ") " << name << LL_ENDL;
+
+ // Remove existing session fonts that have expired since we last saw them.
+ if (!new_font && !template_font)
+ {
+ deleteVoiceFont(font_id);
+ }
+ return;
+ }
+
+ if (new_font)
+ {
+ // If it is a new font create a new entry.
+ font = new voiceFontEntry(font_id);
+ }
+ else
+ {
+ // Not a new font, update the existing entry
+ font = iter->second;
+ }
+
+ if (font)
+ {
+ font->mFontIndex = font_index;
+ // Use the description for the human readable name if available, as the
+ // "name" may be a UUID.
+ font->mName = description.empty() ? name : description;
+ font->mFontType = font_type;
+ font->mFontStatus = font_status;
+
+ // If the font is new or the expiration date has changed the expiry timers need updating.
+ if (!template_font && (new_font || font->mExpirationDate != expiration_date))
+ {
+ font->mExpirationDate = expiration_date;
+
+ // Set the expiry timer to trigger a notification when the voice font can no longer be used.
+ font->mExpiryTimer.start();
+ font->mExpiryTimer.setExpiryAt(expiration_date.secondsSinceEpoch() - VOICE_FONT_EXPIRY_INTERVAL);
+
+ // Set the warning timer to some interval before actual expiry.
+ S32 warning_time = gSavedSettings.getS32("VoiceEffectExpiryWarningTime");
+ if (warning_time != 0)
+ {
+ font->mExpiryWarningTimer.start();
+ F64 expiry_time = (expiration_date.secondsSinceEpoch() - (F64)warning_time);
+ font->mExpiryWarningTimer.setExpiryAt(expiry_time - VOICE_FONT_EXPIRY_INTERVAL);
+ }
+ else
+ {
+ // Disable the warning timer.
+ font->mExpiryWarningTimer.stop();
+ }
+
+ // Only flag new session fonts after the first time we have fetched the list.
+ if (mVoiceFontsReceived)
+ {
+ font->mIsNew = true;
+ mVoiceFontsNew = true;
+ }
+ }
+
+ LL_DEBUGS("VoiceFont") << (template_font ? "Template " : "")
+ << font->mExpirationDate.asString() << " " << font->mID
+ << " (" << font->mFontIndex << ") " << name << LL_ENDL;
+
+ if (new_font)
+ {
+ font_map.insert(voice_font_map_t::value_type(font->mID, font));
+ font_list.insert(voice_effect_list_t::value_type(font->mName, font->mID));
+ }
+
+ mVoiceFontListDirty = true;
+
+ // Debugging stuff
+
+ if (font_type < VOICE_FONT_TYPE_NONE || font_type >= VOICE_FONT_TYPE_UNKNOWN)
+ {
+ LL_WARNS("VoiceFont") << "Unknown voice font type: " << font_type << LL_ENDL;
+ }
+ if (font_status < VOICE_FONT_STATUS_NONE || font_status >= VOICE_FONT_STATUS_UNKNOWN)
+ {
+ LL_WARNS("VoiceFont") << "Unknown voice font status: " << font_status << LL_ENDL;
+ }
+ }
}
void LLVivoxVoiceClient::expireVoiceFonts()
{
- // *TODO: If we are selling voice fonts in packs, there are probably
- // going to be a number of fonts with the same expiration time, so would
- // be more efficient to just keep a list of expiration times rather
- // than checking each font individually.
-
- bool have_expired = false;
- bool will_expire = false;
- bool expired_in_use = false;
-
- LLUUID current_effect = LLVoiceClient::instance().getVoiceEffectDefault();
-
- voice_font_map_t::iterator iter;
- for (iter = mVoiceFontMap.begin(); iter != mVoiceFontMap.end(); ++iter)
- {
- voiceFontEntry* voice_font = iter->second;
- LLFrameTimer& expiry_timer = voice_font->mExpiryTimer;
- LLFrameTimer& warning_timer = voice_font->mExpiryWarningTimer;
-
- // Check for expired voice fonts
- if (expiry_timer.getStarted() && expiry_timer.hasExpired())
- {
- // Check whether it is the active voice font
- if (voice_font->mID == current_effect)
- {
- // Reset to no voice effect.
- setVoiceEffect(LLUUID::null);
- expired_in_use = true;
- }
-
- LL_DEBUGS("Voice") << "Voice Font " << voice_font->mName << " has expired." << LL_ENDL;
- deleteVoiceFont(voice_font->mID);
- have_expired = true;
- }
-
- // Check for voice fonts that will expire in less that the warning time
- if (warning_timer.getStarted() && warning_timer.hasExpired())
- {
- LL_DEBUGS("VoiceFont") << "Voice Font " << voice_font->mName << " will expire soon." << LL_ENDL;
- will_expire = true;
- warning_timer.stop();
- }
- }
-
- LLSD args;
- args["URL"] = LLTrans::getString("voice_morphing_url");
- args["PREMIUM_URL"] = LLTrans::getString("premium_voice_morphing_url");
-
- // Give a notification if any voice fonts have expired.
- if (have_expired)
- {
- if (expired_in_use)
- {
- LLNotificationsUtil::add("VoiceEffectsExpiredInUse", args);
- }
- else
- {
- LLNotificationsUtil::add("VoiceEffectsExpired", args);
- }
-
- // Refresh voice font lists in the UI.
- notifyVoiceFontObservers();
- }
-
- // Give a warning notification if any voice fonts are due to expire.
- if (will_expire)
- {
- S32Seconds seconds(gSavedSettings.getS32("VoiceEffectExpiryWarningTime"));
- args["INTERVAL"] = llformat("%d", LLUnit<S32, LLUnits::Days>(seconds).value());
-
- LLNotificationsUtil::add("VoiceEffectsWillExpire", args);
- }
+ // *TODO: If we are selling voice fonts in packs, there are probably
+ // going to be a number of fonts with the same expiration time, so would
+ // be more efficient to just keep a list of expiration times rather
+ // than checking each font individually.
+
+ bool have_expired = false;
+ bool will_expire = false;
+ bool expired_in_use = false;
+
+ LLUUID current_effect = LLVoiceClient::instance().getVoiceEffectDefault();
+
+ voice_font_map_t::iterator iter;
+ for (iter = mVoiceFontMap.begin(); iter != mVoiceFontMap.end(); ++iter)
+ {
+ voiceFontEntry* voice_font = iter->second;
+ LLFrameTimer& expiry_timer = voice_font->mExpiryTimer;
+ LLFrameTimer& warning_timer = voice_font->mExpiryWarningTimer;
+
+ // Check for expired voice fonts
+ if (expiry_timer.getStarted() && expiry_timer.hasExpired())
+ {
+ // Check whether it is the active voice font
+ if (voice_font->mID == current_effect)
+ {
+ // Reset to no voice effect.
+ setVoiceEffect(LLUUID::null);
+ expired_in_use = true;
+ }
+
+ LL_DEBUGS("Voice") << "Voice Font " << voice_font->mName << " has expired." << LL_ENDL;
+ deleteVoiceFont(voice_font->mID);
+ have_expired = true;
+ }
+
+ // Check for voice fonts that will expire in less that the warning time
+ if (warning_timer.getStarted() && warning_timer.hasExpired())
+ {
+ LL_DEBUGS("VoiceFont") << "Voice Font " << voice_font->mName << " will expire soon." << LL_ENDL;
+ will_expire = true;
+ warning_timer.stop();
+ }
+ }
+
+ LLSD args;
+ args["URL"] = LLTrans::getString("voice_morphing_url");
+ args["PREMIUM_URL"] = LLTrans::getString("premium_voice_morphing_url");
+
+ // Give a notification if any voice fonts have expired.
+ if (have_expired)
+ {
+ if (expired_in_use)
+ {
+ LLNotificationsUtil::add("VoiceEffectsExpiredInUse", args);
+ }
+ else
+ {
+ LLNotificationsUtil::add("VoiceEffectsExpired", args);
+ }
+
+ // Refresh voice font lists in the UI.
+ notifyVoiceFontObservers();
+ }
+
+ // Give a warning notification if any voice fonts are due to expire.
+ if (will_expire)
+ {
+ S32Seconds seconds(gSavedSettings.getS32("VoiceEffectExpiryWarningTime"));
+ args["INTERVAL"] = llformat("%d", LLUnit<S32, LLUnits::Days>(seconds).value());
+
+ LLNotificationsUtil::add("VoiceEffectsWillExpire", args);
+ }
}
void LLVivoxVoiceClient::deleteVoiceFont(const LLUUID& id)
{
- // Remove the entry from the voice font list.
- voice_effect_list_t::iterator list_iter = mVoiceFontList.begin();
- while (list_iter != mVoiceFontList.end())
- {
- if (list_iter->second == id)
- {
- LL_DEBUGS("VoiceFont") << "Removing " << id << " from the voice font list." << LL_ENDL;
+ // Remove the entry from the voice font list.
+ voice_effect_list_t::iterator list_iter = mVoiceFontList.begin();
+ while (list_iter != mVoiceFontList.end())
+ {
+ if (list_iter->second == id)
+ {
+ LL_DEBUGS("VoiceFont") << "Removing " << id << " from the voice font list." << LL_ENDL;
list_iter = mVoiceFontList.erase(list_iter);
- mVoiceFontListDirty = true;
- }
- else
- {
- ++list_iter;
- }
- }
+ mVoiceFontListDirty = true;
+ }
+ else
+ {
+ ++list_iter;
+ }
+ }
- // Find the entry in the voice font map and erase its data.
- voice_font_map_t::iterator map_iter = mVoiceFontMap.find(id);
- if (map_iter != mVoiceFontMap.end())
- {
- delete map_iter->second;
- }
+ // Find the entry in the voice font map and erase its data.
+ voice_font_map_t::iterator map_iter = mVoiceFontMap.find(id);
+ if (map_iter != mVoiceFontMap.end())
+ {
+ delete map_iter->second;
+ }
- // Remove the entry from the voice font map.
- mVoiceFontMap.erase(map_iter);
+ // Remove the entry from the voice font map.
+ mVoiceFontMap.erase(map_iter);
}
void LLVivoxVoiceClient::deleteAllVoiceFonts()
{
- mVoiceFontList.clear();
+ mVoiceFontList.clear();
- voice_font_map_t::iterator iter;
- for (iter = mVoiceFontMap.begin(); iter != mVoiceFontMap.end(); ++iter)
- {
- delete iter->second;
- }
- mVoiceFontMap.clear();
+ voice_font_map_t::iterator iter;
+ for (iter = mVoiceFontMap.begin(); iter != mVoiceFontMap.end(); ++iter)
+ {
+ delete iter->second;
+ }
+ mVoiceFontMap.clear();
}
void LLVivoxVoiceClient::deleteVoiceFontTemplates()
{
- mVoiceFontTemplateList.clear();
+ mVoiceFontTemplateList.clear();
- voice_font_map_t::iterator iter;
- for (iter = mVoiceFontTemplateMap.begin(); iter != mVoiceFontTemplateMap.end(); ++iter)
- {
- delete iter->second;
- }
- mVoiceFontTemplateMap.clear();
+ voice_font_map_t::iterator iter;
+ for (iter = mVoiceFontTemplateMap.begin(); iter != mVoiceFontTemplateMap.end(); ++iter)
+ {
+ delete iter->second;
+ }
+ mVoiceFontTemplateMap.clear();
}
S32 LLVivoxVoiceClient::getVoiceFontIndex(const LLUUID& id) const
{
- S32 result = 0;
- if (!id.isNull())
- {
- voice_font_map_t::const_iterator it = mVoiceFontMap.find(id);
- if (it != mVoiceFontMap.end())
- {
- result = it->second->mFontIndex;
- }
- else
- {
- LL_WARNS("VoiceFont") << "Selected voice font " << id << " is not available." << LL_ENDL;
- }
- }
- return result;
+ S32 result = 0;
+ if (!id.isNull())
+ {
+ voice_font_map_t::const_iterator it = mVoiceFontMap.find(id);
+ if (it != mVoiceFontMap.end())
+ {
+ result = it->second->mFontIndex;
+ }
+ else
+ {
+ LL_WARNS("VoiceFont") << "Selected voice font " << id << " is not available." << LL_ENDL;
+ }
+ }
+ return result;
}
S32 LLVivoxVoiceClient::getVoiceFontTemplateIndex(const LLUUID& id) const
{
- S32 result = 0;
- if (!id.isNull())
- {
- voice_font_map_t::const_iterator it = mVoiceFontTemplateMap.find(id);
- if (it != mVoiceFontTemplateMap.end())
- {
- result = it->second->mFontIndex;
- }
- else
- {
- LL_WARNS("VoiceFont") << "Selected voice font template " << id << " is not available." << LL_ENDL;
- }
- }
- return result;
+ S32 result = 0;
+ if (!id.isNull())
+ {
+ voice_font_map_t::const_iterator it = mVoiceFontTemplateMap.find(id);
+ if (it != mVoiceFontTemplateMap.end())
+ {
+ result = it->second->mFontIndex;
+ }
+ else
+ {
+ LL_WARNS("VoiceFont") << "Selected voice font template " << id << " is not available." << LL_ENDL;
+ }
+ }
+ return result;
}
void LLVivoxVoiceClient::accountGetSessionFontsSendMessage()
{
- if(mAccountLoggedIn)
- {
- std::ostringstream stream;
+ if(mAccountLoggedIn)
+ {
+ std::ostringstream stream;
- LL_DEBUGS("VoiceFont") << "Requesting voice font list." << LL_ENDL;
+ LL_DEBUGS("VoiceFont") << "Requesting voice font list." << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.GetSessionFonts.1\">"
- << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
- << "</Request>"
- << "\n\n\n";
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.GetSessionFonts.1\">"
+ << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
+ << "</Request>"
+ << "\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::accountGetTemplateFontsSendMessage()
{
- if(mAccountLoggedIn)
- {
- std::ostringstream stream;
+ if(mAccountLoggedIn)
+ {
+ std::ostringstream stream;
- LL_DEBUGS("VoiceFont") << "Requesting voice font template list." << LL_ENDL;
+ LL_DEBUGS("VoiceFont") << "Requesting voice font template list." << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.GetTemplateFonts.1\">"
- << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
- << "</Request>"
- << "\n\n\n";
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.GetTemplateFonts.1\">"
+ << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
+ << "</Request>"
+ << "\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::sessionSetVoiceFontSendMessage(const sessionStatePtr_t &session)
{
- S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
- LL_DEBUGS("VoiceFont") << "Requesting voice font: " << session->mVoiceFontID << " (" << font_index << "), session handle: " << session->mHandle << LL_ENDL;
+ S32 font_index = getVoiceFontIndex(session->mVoiceFontID);
+ LL_DEBUGS("VoiceFont") << "Requesting voice font: " << session->mVoiceFontID << " (" << font_index << "), session handle: " << session->mHandle << LL_ENDL;
- std::ostringstream stream;
+ std::ostringstream stream;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetVoiceFont.1\">"
- << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
- << "<SessionFontID>" << font_index << "</SessionFontID>"
- << "</Request>\n\n\n";
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetVoiceFont.1\">"
+ << "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+ << "<SessionFontID>" << font_index << "</SessionFontID>"
+ << "</Request>\n\n\n";
- writeString(stream.str());
+ writeString(stream.str());
}
void LLVivoxVoiceClient::accountGetSessionFontsResponse(int statusCode, const std::string &statusString)
@@ -7014,117 +7014,117 @@ void LLVivoxVoiceClient::accountGetSessionFontsResponse(int statusCode, const st
mVivoxPump.post(result);
}
- notifyVoiceFontObservers();
- mVoiceFontsReceived = true;
+ notifyVoiceFontObservers();
+ mVoiceFontsReceived = true;
}
void LLVivoxVoiceClient::accountGetTemplateFontsResponse(int statusCode, const std::string &statusString)
{
- // Voice font list entries were updated via addVoiceFont() during parsing.
- notifyVoiceFontObservers();
+ // Voice font list entries were updated via addVoiceFont() during parsing.
+ notifyVoiceFontObservers();
}
void LLVivoxVoiceClient::addObserver(LLVoiceEffectObserver* observer)
{
- mVoiceFontObservers.insert(observer);
+ mVoiceFontObservers.insert(observer);
}
void LLVivoxVoiceClient::removeObserver(LLVoiceEffectObserver* observer)
{
- mVoiceFontObservers.erase(observer);
+ mVoiceFontObservers.erase(observer);
}
// method checks the item in VoiceMorphing menu for appropriate current voice font
bool LLVivoxVoiceClient::onCheckVoiceEffect(const std::string& voice_effect_name)
{
- LLVoiceEffectInterface * effect_interfacep = LLVoiceClient::instance().getVoiceEffectInterface();
- if (NULL != effect_interfacep)
- {
- const LLUUID& currect_voice_effect_id = effect_interfacep->getVoiceEffect();
-
- if (currect_voice_effect_id.isNull())
- {
- if (voice_effect_name == "NoVoiceMorphing")
- {
- return true;
- }
- }
- else
- {
- const LLSD& voice_effect_props = effect_interfacep->getVoiceEffectProperties(currect_voice_effect_id);
- if (voice_effect_props["name"].asString() == voice_effect_name)
- {
- return true;
- }
- }
- }
-
- return false;
+ LLVoiceEffectInterface * effect_interfacep = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (NULL != effect_interfacep)
+ {
+ const LLUUID& currect_voice_effect_id = effect_interfacep->getVoiceEffect();
+
+ if (currect_voice_effect_id.isNull())
+ {
+ if (voice_effect_name == "NoVoiceMorphing")
+ {
+ return true;
+ }
+ }
+ else
+ {
+ const LLSD& voice_effect_props = effect_interfacep->getVoiceEffectProperties(currect_voice_effect_id);
+ if (voice_effect_props["name"].asString() == voice_effect_name)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
}
// method changes voice font for selected VoiceMorphing menu item
void LLVivoxVoiceClient::onClickVoiceEffect(const std::string& voice_effect_name)
{
- LLVoiceEffectInterface * effect_interfacep = LLVoiceClient::instance().getVoiceEffectInterface();
- if (NULL != effect_interfacep)
- {
- if (voice_effect_name == "NoVoiceMorphing")
- {
- effect_interfacep->setVoiceEffect(LLUUID());
- return;
- }
- const voice_effect_list_t& effect_list = effect_interfacep->getVoiceEffectList();
- if (!effect_list.empty())
- {
- for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it)
- {
- if (voice_effect_name == it->first)
- {
- effect_interfacep->setVoiceEffect(it->second);
- return;
- }
- }
- }
- }
-}
-
-// it updates VoiceMorphing menu items in accordance with purchased properties
+ LLVoiceEffectInterface * effect_interfacep = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (NULL != effect_interfacep)
+ {
+ if (voice_effect_name == "NoVoiceMorphing")
+ {
+ effect_interfacep->setVoiceEffect(LLUUID());
+ return;
+ }
+ const voice_effect_list_t& effect_list = effect_interfacep->getVoiceEffectList();
+ if (!effect_list.empty())
+ {
+ for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it)
+ {
+ if (voice_effect_name == it->first)
+ {
+ effect_interfacep->setVoiceEffect(it->second);
+ return;
+ }
+ }
+ }
+ }
+}
+
+// it updates VoiceMorphing menu items in accordance with purchased properties
void LLVivoxVoiceClient::updateVoiceMorphingMenu()
{
- if (mVoiceFontListDirty)
- {
- LLVoiceEffectInterface * effect_interfacep = LLVoiceClient::instance().getVoiceEffectInterface();
- if (effect_interfacep)
- {
- const voice_effect_list_t& effect_list = effect_interfacep->getVoiceEffectList();
- if (!effect_list.empty())
- {
- LLMenuGL * voice_morphing_menup = gMenuBarView->findChildMenuByName("VoiceMorphing", TRUE);
-
- if (NULL != voice_morphing_menup)
- {
- S32 items = voice_morphing_menup->getItemCount();
- if (items > 0)
- {
- voice_morphing_menup->erase(1, items - 3, false);
-
- S32 pos = 1;
- for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it)
- {
- LLMenuItemCheckGL::Params p;
- p.name = it->first;
- p.label = it->first;
- p.on_check.function(boost::bind(&LLVivoxVoiceClient::onCheckVoiceEffect, this, it->first));
- p.on_click.function(boost::bind(&LLVivoxVoiceClient::onClickVoiceEffect, this, it->first));
- LLMenuItemCheckGL * voice_effect_itemp = LLUICtrlFactory::create<LLMenuItemCheckGL>(p);
- voice_morphing_menup->insert(pos++, voice_effect_itemp, false);
- }
-
- voice_morphing_menup->needsArrange();
- }
- }
- }
- }
- }
+ if (mVoiceFontListDirty)
+ {
+ LLVoiceEffectInterface * effect_interfacep = LLVoiceClient::instance().getVoiceEffectInterface();
+ if (effect_interfacep)
+ {
+ const voice_effect_list_t& effect_list = effect_interfacep->getVoiceEffectList();
+ if (!effect_list.empty())
+ {
+ LLMenuGL * voice_morphing_menup = gMenuBarView->findChildMenuByName("VoiceMorphing", TRUE);
+
+ if (NULL != voice_morphing_menup)
+ {
+ S32 items = voice_morphing_menup->getItemCount();
+ if (items > 0)
+ {
+ voice_morphing_menup->erase(1, items - 3, false);
+
+ S32 pos = 1;
+ for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it)
+ {
+ LLMenuItemCheckGL::Params p;
+ p.name = it->first;
+ p.label = it->first;
+ p.on_check.function(boost::bind(&LLVivoxVoiceClient::onCheckVoiceEffect, this, it->first));
+ p.on_click.function(boost::bind(&LLVivoxVoiceClient::onClickVoiceEffect, this, it->first));
+ LLMenuItemCheckGL * voice_effect_itemp = LLUICtrlFactory::create<LLMenuItemCheckGL>(p);
+ voice_morphing_menup->insert(pos++, voice_effect_itemp, false);
+ }
+
+ voice_morphing_menup->needsArrange();
+ }
+ }
+ }
+ }
+ }
}
void LLVivoxVoiceClient::notifyVoiceFontObservers()
{
@@ -7142,7 +7142,7 @@ void LLVivoxVoiceClient::notifyVoiceFontObservers()
}
mVoiceFontListDirty = false;
- // If new Voice Fonts have been added notify the user.
+ // If new Voice Fonts have been added notify the user.
if (mVoiceFontsNew)
{
if (mVoiceFontsReceived)
@@ -7165,23 +7165,23 @@ void LLVivoxVoiceClient::enablePreviewBuffer(bool enable)
mVivoxPump.post(result);
- if(mCaptureBufferMode && mIsInChannel)
- {
- LL_DEBUGS("Voice") << "no channel" << LL_ENDL;
- sessionTerminate();
- }
+ if(mCaptureBufferMode && mIsInChannel)
+ {
+ LL_DEBUGS("Voice") << "no channel" << LL_ENDL;
+ sessionTerminate();
+ }
}
void LLVivoxVoiceClient::recordPreviewBuffer()
{
- if (!mCaptureBufferMode)
- {
- LL_DEBUGS("Voice") << "Not in voice effect preview mode, cannot start recording." << LL_ENDL;
- mCaptureBufferRecording = false;
- return;
- }
+ if (!mCaptureBufferMode)
+ {
+ LL_DEBUGS("Voice") << "Not in voice effect preview mode, cannot start recording." << LL_ENDL;
+ mCaptureBufferRecording = false;
+ return;
+ }
- mCaptureBufferRecording = true;
+ mCaptureBufferRecording = true;
LLSD result(LLSDMap("recplay", "record"));
mVivoxPump.post(result);
@@ -7189,22 +7189,22 @@ void LLVivoxVoiceClient::recordPreviewBuffer()
void LLVivoxVoiceClient::playPreviewBuffer(const LLUUID& effect_id)
{
- if (!mCaptureBufferMode)
- {
- LL_DEBUGS("Voice") << "Not in voice effect preview mode, no buffer to play." << LL_ENDL;
- mCaptureBufferRecording = false;
- return;
- }
+ if (!mCaptureBufferMode)
+ {
+ LL_DEBUGS("Voice") << "Not in voice effect preview mode, no buffer to play." << LL_ENDL;
+ mCaptureBufferRecording = false;
+ return;
+ }
- if (!mCaptureBufferRecorded)
- {
- // Can't play until we have something recorded!
- mCaptureBufferPlaying = false;
- return;
- }
+ if (!mCaptureBufferRecorded)
+ {
+ // Can't play until we have something recorded!
+ mCaptureBufferPlaying = false;
+ return;
+ }
- mPreviewVoiceFont = effect_id;
- mCaptureBufferPlaying = true;
+ mPreviewVoiceFont = effect_id;
+ mCaptureBufferPlaying = true;
LLSD result(LLSDMap("recplay", "playback"));
mVivoxPump.post(result);
@@ -7212,8 +7212,8 @@ void LLVivoxVoiceClient::playPreviewBuffer(const LLUUID& effect_id)
void LLVivoxVoiceClient::stopPreviewBuffer()
{
- mCaptureBufferRecording = false;
- mCaptureBufferPlaying = false;
+ mCaptureBufferRecording = false;
+ mCaptureBufferPlaying = false;
LLSD result(LLSDMap("recplay", "quit"));
mVivoxPump.post(result);
@@ -7221,236 +7221,236 @@ void LLVivoxVoiceClient::stopPreviewBuffer()
bool LLVivoxVoiceClient::isPreviewRecording()
{
- return (mCaptureBufferMode && mCaptureBufferRecording);
+ return (mCaptureBufferMode && mCaptureBufferRecording);
}
bool LLVivoxVoiceClient::isPreviewPlaying()
{
- return (mCaptureBufferMode && mCaptureBufferPlaying);
+ return (mCaptureBufferMode && mCaptureBufferPlaying);
}
void LLVivoxVoiceClient::captureBufferRecordStartSendMessage()
-{ if(mAccountLoggedIn)
- {
- std::ostringstream stream;
+{ if(mAccountLoggedIn)
+ {
+ std::ostringstream stream;
- LL_DEBUGS("Voice") << "Starting audio capture to buffer." << LL_ENDL;
+ LL_DEBUGS("Voice") << "Starting audio capture to buffer." << LL_ENDL;
- // Start capture
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.StartBufferCapture.1\">"
- << "</Request>"
- << "\n\n\n";
+ // Start capture
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.StartBufferCapture.1\">"
+ << "</Request>"
+ << "\n\n\n";
- // Unmute the mic
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
- << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
- << "<Value>false</Value>"
- << "</Request>\n\n\n";
+ // Unmute the mic
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
+ << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
+ << "<Value>false</Value>"
+ << "</Request>\n\n\n";
- // Dirty the mute mic state so that it will get reset when we finishing previewing
- mMuteMicDirty = true;
+ // Dirty the mute mic state so that it will get reset when we finishing previewing
+ mMuteMicDirty = true;
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::captureBufferRecordStopSendMessage()
{
- if(mAccountLoggedIn)
- {
- std::ostringstream stream;
+ if(mAccountLoggedIn)
+ {
+ std::ostringstream stream;
- LL_DEBUGS("Voice") << "Stopping audio capture to buffer." << LL_ENDL;
+ LL_DEBUGS("Voice") << "Stopping audio capture to buffer." << LL_ENDL;
- // Mute the mic. Mic mute state was dirtied at recording start, so will be reset when finished previewing.
- stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
- << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
- << "<Value>true</Value>"
- << "</Request>\n\n\n";
+ // Mute the mic. Mic mute state was dirtied at recording start, so will be reset when finished previewing.
+ stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
+ << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>"
+ << "<Value>true</Value>"
+ << "</Request>\n\n\n";
- // Stop capture
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
- << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
- << "</Request>"
- << "\n\n\n";
+ // Stop capture
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
+ << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
+ << "</Request>"
+ << "\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::captureBufferPlayStartSendMessage(const LLUUID& voice_font_id)
{
- if(mAccountLoggedIn)
- {
- // Track how may play requests are sent, so we know how many stop events to
- // expect before play actually stops.
- ++mPlayRequestCount;
+ if(mAccountLoggedIn)
+ {
+ // Track how may play requests are sent, so we know how many stop events to
+ // expect before play actually stops.
+ ++mPlayRequestCount;
- std::ostringstream stream;
+ std::ostringstream stream;
- LL_DEBUGS("Voice") << "Starting audio buffer playback." << LL_ENDL;
+ LL_DEBUGS("Voice") << "Starting audio buffer playback." << LL_ENDL;
- S32 font_index = getVoiceFontTemplateIndex(voice_font_id);
- LL_DEBUGS("Voice") << "With voice font: " << voice_font_id << " (" << font_index << ")" << LL_ENDL;
+ S32 font_index = getVoiceFontTemplateIndex(voice_font_id);
+ LL_DEBUGS("Voice") << "With voice font: " << voice_font_id << " (" << font_index << ")" << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.PlayAudioBuffer.1\">"
- << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
- << "<TemplateFontID>" << font_index << "</TemplateFontID>"
- << "<FontDelta />"
- << "</Request>"
- << "\n\n\n";
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.PlayAudioBuffer.1\">"
+ << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
+ << "<TemplateFontID>" << font_index << "</TemplateFontID>"
+ << "<FontDelta />"
+ << "</Request>"
+ << "\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
void LLVivoxVoiceClient::captureBufferPlayStopSendMessage()
{
- if(mAccountLoggedIn)
- {
- std::ostringstream stream;
+ if(mAccountLoggedIn)
+ {
+ std::ostringstream stream;
- LL_DEBUGS("Voice") << "Stopping audio buffer playback." << LL_ENDL;
+ LL_DEBUGS("Voice") << "Stopping audio buffer playback." << LL_ENDL;
- stream
- << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
- << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
- << "</Request>"
- << "\n\n\n";
+ stream
+ << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
+ << "<AccountHandle>" << LLVivoxSecurity::getInstance()->accountHandle() << "</AccountHandle>"
+ << "</Request>"
+ << "\n\n\n";
- writeString(stream.str());
- }
+ writeString(stream.str());
+ }
}
LLVivoxProtocolParser::LLVivoxProtocolParser()
{
- parser = XML_ParserCreate(NULL);
-
- reset();
+ parser = XML_ParserCreate(NULL);
+
+ reset();
}
void LLVivoxProtocolParser::reset()
{
- responseDepth = 0;
- ignoringTags = false;
- accumulateText = false;
- energy = 0.f;
- hasText = false;
- hasAudio = false;
- hasVideo = false;
- terminated = false;
- ignoreDepth = 0;
- isChannel = false;
- incoming = false;
- enabled = false;
- isEvent = false;
- isLocallyMuted = false;
- isModeratorMuted = false;
- isSpeaking = false;
- participantType = 0;
- returnCode = -1;
- state = 0;
- statusCode = 0;
- volume = 0;
- textBuffer.clear();
- alias.clear();
- numberOfAliases = 0;
- applicationString.clear();
-}
-
-//virtual
+ responseDepth = 0;
+ ignoringTags = false;
+ accumulateText = false;
+ energy = 0.f;
+ hasText = false;
+ hasAudio = false;
+ hasVideo = false;
+ terminated = false;
+ ignoreDepth = 0;
+ isChannel = false;
+ incoming = false;
+ enabled = false;
+ isEvent = false;
+ isLocallyMuted = false;
+ isModeratorMuted = false;
+ isSpeaking = false;
+ participantType = 0;
+ returnCode = -1;
+ state = 0;
+ statusCode = 0;
+ volume = 0;
+ textBuffer.clear();
+ alias.clear();
+ numberOfAliases = 0;
+ applicationString.clear();
+}
+
+//virtual
LLVivoxProtocolParser::~LLVivoxProtocolParser()
{
- if (parser)
- XML_ParserFree(parser);
+ if (parser)
+ XML_ParserFree(parser);
}
static LLTrace::BlockTimerStatHandle FTM_VIVOX_PROCESS("Vivox Process");
// virtual
LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
- const LLChannelDescriptors& channels,
- buffer_ptr_t& buffer,
- bool& eos,
- LLSD& context,
- LLPumpIO* pump)
-{
- LL_RECORD_BLOCK_TIME(FTM_VIVOX_PROCESS);
- LLBufferStream istr(channels, buffer.get());
- std::ostringstream ostr;
- while (istr.good())
- {
- char buf[1024];
- istr.read(buf, sizeof(buf));
- mInput.append(buf, istr.gcount());
- }
-
- // Look for input delimiter(s) in the input buffer. If one is found, send the message to the xml parser.
- int start = 0;
- int delim;
- while((delim = mInput.find("\n\n\n", start)) != std::string::npos)
- {
-
- // Reset internal state of the LLVivoxProtocolParser (no effect on the expat parser)
- reset();
-
- XML_ParserReset(parser, NULL);
- XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag);
- XML_SetCharacterDataHandler(parser, ExpatCharHandler);
- XML_SetUserData(parser, this);
- XML_Parse(parser, mInput.data() + start, delim - start, false);
-
+ const LLChannelDescriptors& channels,
+ buffer_ptr_t& buffer,
+ bool& eos,
+ LLSD& context,
+ LLPumpIO* pump)
+{
+ LL_RECORD_BLOCK_TIME(FTM_VIVOX_PROCESS);
+ LLBufferStream istr(channels, buffer.get());
+ std::ostringstream ostr;
+ while (istr.good())
+ {
+ char buf[1024];
+ istr.read(buf, sizeof(buf));
+ mInput.append(buf, istr.gcount());
+ }
+
+ // Look for input delimiter(s) in the input buffer. If one is found, send the message to the xml parser.
+ int start = 0;
+ int delim;
+ while((delim = mInput.find("\n\n\n", start)) != std::string::npos)
+ {
+
+ // Reset internal state of the LLVivoxProtocolParser (no effect on the expat parser)
+ reset();
+
+ XML_ParserReset(parser, NULL);
+ XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag);
+ XML_SetCharacterDataHandler(parser, ExpatCharHandler);
+ XML_SetUserData(parser, this);
+ XML_Parse(parser, mInput.data() + start, delim - start, false);
+
LL_DEBUGS("VivoxProtocolParser") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL;
- start = delim + 3;
- }
-
- if(start != 0)
- mInput = mInput.substr(start);
-
- LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
-
- if(!LLVivoxVoiceClient::sConnected)
- {
- // If voice has been disabled, we just want to close the socket. This does so.
- LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
- return STATUS_STOP;
- }
-
- return STATUS_OK;
+ start = delim + 3;
+ }
+
+ if(start != 0)
+ mInput = mInput.substr(start);
+
+ LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
+
+ if(!LLVivoxVoiceClient::sConnected)
+ {
+ // If voice has been disabled, we just want to close the socket. This does so.
+ LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
+ return STATUS_STOP;
+ }
+
+ return STATUS_OK;
}
void XMLCALL LLVivoxProtocolParser::ExpatStartTag(void *data, const char *el, const char **attr)
{
- if (data)
- {
- LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
- object->StartTag(el, attr);
- }
+ if (data)
+ {
+ LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
+ object->StartTag(el, attr);
+ }
}
// --------------------------------------------------------------------------------
void XMLCALL LLVivoxProtocolParser::ExpatEndTag(void *data, const char *el)
{
- if (data)
- {
- LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
- object->EndTag(el);
- }
+ if (data)
+ {
+ LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
+ object->EndTag(el);
+ }
}
// --------------------------------------------------------------------------------
void XMLCALL LLVivoxProtocolParser::ExpatCharHandler(void *data, const XML_Char *s, int len)
{
- if (data)
- {
- LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
- object->CharData(s, len);
- }
+ if (data)
+ {
+ LLVivoxProtocolParser *object = (LLVivoxProtocolParser*)data;
+ object->CharData(s, len);
+ }
}
// --------------------------------------------------------------------------------
@@ -7458,623 +7458,623 @@ void XMLCALL LLVivoxProtocolParser::ExpatCharHandler(void *data, const XML_Char
void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
{
- // Reset the text accumulator. We shouldn't have strings that are inturrupted by new tags
- textBuffer.clear();
- // only accumulate text if we're not ignoring tags.
- accumulateText = !ignoringTags;
-
- if (responseDepth == 0)
- {
- isEvent = !stricmp("Event", tag);
-
- if (!stricmp("Response", tag) || isEvent)
- {
- // Grab the attributes
- while (*attr)
- {
- const char *key = *attr++;
- const char *value = *attr++;
-
- if (!stricmp("requestId", key))
- {
- requestId = value;
- }
- else if (!stricmp("action", key))
- {
- actionString = value;
- }
- else if (!stricmp("type", key))
- {
- eventTypeString = value;
- }
- }
- }
- LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")" << LL_ENDL;
- }
- else
- {
- if (ignoringTags)
- {
- LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")" << LL_ENDL;
-
- // Ignore the InputXml stuff so we don't get confused
- if (!stricmp("InputXml", tag))
- {
- ignoringTags = true;
- ignoreDepth = responseDepth;
- accumulateText = false;
-
- LL_DEBUGS("VivoxProtocolParser") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
- }
- else if (!stricmp("CaptureDevices", tag))
- {
- LLVivoxVoiceClient::getInstance()->clearCaptureDevices();
- }
- else if (!stricmp("RenderDevices", tag))
- {
- LLVivoxVoiceClient::getInstance()->clearRenderDevices();
- }
- else if (!stricmp("CaptureDevice", tag))
- {
- deviceString.clear();
- }
- else if (!stricmp("RenderDevice", tag))
- {
- deviceString.clear();
- }
- else if (!stricmp("SessionFont", tag))
- {
- id = 0;
- nameString.clear();
- descriptionString.clear();
- expirationDate = LLDate();
- hasExpired = false;
- fontType = 0;
- fontStatus = 0;
- }
- else if (!stricmp("TemplateFont", tag))
- {
- id = 0;
- nameString.clear();
- descriptionString.clear();
- expirationDate = LLDate();
- hasExpired = false;
- fontType = 0;
- fontStatus = 0;
- }
- else if (!stricmp("MediaCompletionType", tag))
- {
- mediaCompletionType.clear();
- }
- }
- }
- responseDepth++;
+ // Reset the text accumulator. We shouldn't have strings that are inturrupted by new tags
+ textBuffer.clear();
+ // only accumulate text if we're not ignoring tags.
+ accumulateText = !ignoringTags;
+
+ if (responseDepth == 0)
+ {
+ isEvent = !stricmp("Event", tag);
+
+ if (!stricmp("Response", tag) || isEvent)
+ {
+ // Grab the attributes
+ while (*attr)
+ {
+ const char *key = *attr++;
+ const char *value = *attr++;
+
+ if (!stricmp("requestId", key))
+ {
+ requestId = value;
+ }
+ else if (!stricmp("action", key))
+ {
+ actionString = value;
+ }
+ else if (!stricmp("type", key))
+ {
+ eventTypeString = value;
+ }
+ }
+ }
+ LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")" << LL_ENDL;
+ }
+ else
+ {
+ if (ignoringTags)
+ {
+ LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")" << LL_ENDL;
+
+ // Ignore the InputXml stuff so we don't get confused
+ if (!stricmp("InputXml", tag))
+ {
+ ignoringTags = true;
+ ignoreDepth = responseDepth;
+ accumulateText = false;
+
+ LL_DEBUGS("VivoxProtocolParser") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
+ }
+ else if (!stricmp("CaptureDevices", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->clearCaptureDevices();
+ }
+ else if (!stricmp("RenderDevices", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->clearRenderDevices();
+ }
+ else if (!stricmp("CaptureDevice", tag))
+ {
+ deviceString.clear();
+ }
+ else if (!stricmp("RenderDevice", tag))
+ {
+ deviceString.clear();
+ }
+ else if (!stricmp("SessionFont", tag))
+ {
+ id = 0;
+ nameString.clear();
+ descriptionString.clear();
+ expirationDate = LLDate();
+ hasExpired = false;
+ fontType = 0;
+ fontStatus = 0;
+ }
+ else if (!stricmp("TemplateFont", tag))
+ {
+ id = 0;
+ nameString.clear();
+ descriptionString.clear();
+ expirationDate = LLDate();
+ hasExpired = false;
+ fontType = 0;
+ fontStatus = 0;
+ }
+ else if (!stricmp("MediaCompletionType", tag))
+ {
+ mediaCompletionType.clear();
+ }
+ }
+ }
+ responseDepth++;
}
// --------------------------------------------------------------------------------
void LLVivoxProtocolParser::EndTag(const char *tag)
{
- const std::string& string = textBuffer;
-
- responseDepth--;
-
- if (ignoringTags)
- {
- if (ignoreDepth == responseDepth)
- {
- LL_DEBUGS("VivoxProtocolParser") << "end of ignore" << LL_ENDL;
- ignoringTags = false;
- }
- else
- {
- LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
- }
- }
-
- if (!ignoringTags)
- {
- LL_DEBUGS("VivoxProtocolParser") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
-
- // Closing a tag. Finalize the text we've accumulated and reset
- if (!stricmp("ReturnCode", tag))
- returnCode = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("SessionHandle", tag))
- sessionHandle = string;
- else if (!stricmp("SessionGroupHandle", tag))
- sessionGroupHandle = string;
- else if (!stricmp("StatusCode", tag))
- statusCode = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("StatusString", tag))
- statusString = string;
- else if (!stricmp("ParticipantURI", tag))
- uriString = string;
- else if (!stricmp("Volume", tag))
- volume = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("Energy", tag))
- energy = (F32)strtod(string.c_str(), NULL);
- else if (!stricmp("IsModeratorMuted", tag))
- isModeratorMuted = !stricmp(string.c_str(), "true");
- else if (!stricmp("IsSpeaking", tag))
- isSpeaking = !stricmp(string.c_str(), "true");
- else if (!stricmp("Alias", tag))
- alias = string;
- else if (!stricmp("NumberOfAliases", tag))
- numberOfAliases = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("Application", tag))
- applicationString = string;
- else if (!stricmp("ConnectorHandle", tag))
- connectorHandle = string;
- else if (!stricmp("VersionID", tag))
- versionID = string;
- else if (!stricmp("Version", tag))
- mBuildID = string;
- else if (!stricmp("AccountHandle", tag))
- accountHandle = string;
- else if (!stricmp("State", tag))
- state = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("URI", tag))
- uriString = string;
- else if (!stricmp("IsChannel", tag))
- isChannel = !stricmp(string.c_str(), "true");
- else if (!stricmp("Incoming", tag))
- incoming = !stricmp(string.c_str(), "true");
- else if (!stricmp("Enabled", tag))
- enabled = !stricmp(string.c_str(), "true");
- else if (!stricmp("Name", tag))
- nameString = string;
- else if (!stricmp("AudioMedia", tag))
- audioMediaString = string;
- else if (!stricmp("ChannelName", tag))
- nameString = string;
- else if (!stricmp("DisplayName", tag))
- displayNameString = string;
- else if (!stricmp("Device", tag))
- deviceString = string;
- else if (!stricmp("AccountName", tag))
- nameString = string;
- else if (!stricmp("ParticipantType", tag))
- participantType = strtol(string.c_str(), NULL, 10);
- else if (!stricmp("IsLocallyMuted", tag))
- isLocallyMuted = !stricmp(string.c_str(), "true");
- else if (!stricmp("MicEnergy", tag))
- energy = (F32)strtod(string.c_str(), NULL);
- else if (!stricmp("ChannelName", tag))
- nameString = string;
- else if (!stricmp("ChannelURI", tag))
- uriString = string;
- else if (!stricmp("BuddyURI", tag))
- uriString = string;
- else if (!stricmp("Presence", tag))
- statusString = string;
- else if (!stricmp("CaptureDevices", tag))
- {
- LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true);
- }
- else if (!stricmp("RenderDevices", tag))
- {
- LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true);
- }
- else if (!stricmp("CaptureDevice", tag))
- {
- LLVivoxVoiceClient::getInstance()->addCaptureDevice(LLVoiceDevice(displayNameString, deviceString));
- }
- else if (!stricmp("RenderDevice", tag))
- {
- LLVivoxVoiceClient::getInstance()->addRenderDevice(LLVoiceDevice(displayNameString, deviceString));
- }
- else if (!stricmp("BlockMask", tag))
- blockMask = string;
- else if (!stricmp("PresenceOnly", tag))
- presenceOnly = string;
- else if (!stricmp("AutoAcceptMask", tag))
- autoAcceptMask = string;
- else if (!stricmp("AutoAddAsBuddy", tag))
- autoAddAsBuddy = string;
- else if (!stricmp("MessageHeader", tag))
- messageHeader = string;
- else if (!stricmp("MessageBody", tag))
- messageBody = string;
- else if (!stricmp("NotificationType", tag))
- notificationType = string;
- else if (!stricmp("HasText", tag))
- hasText = !stricmp(string.c_str(), "true");
- else if (!stricmp("HasAudio", tag))
- hasAudio = !stricmp(string.c_str(), "true");
- else if (!stricmp("HasVideo", tag))
- hasVideo = !stricmp(string.c_str(), "true");
- else if (!stricmp("Terminated", tag))
- terminated = !stricmp(string.c_str(), "true");
- else if (!stricmp("SubscriptionHandle", tag))
- subscriptionHandle = string;
- else if (!stricmp("SubscriptionType", tag))
- subscriptionType = string;
- else if (!stricmp("SessionFont", tag))
- {
- LLVivoxVoiceClient::getInstance()->addVoiceFont(id, nameString, descriptionString, expirationDate, hasExpired, fontType, fontStatus, false);
- }
- else if (!stricmp("TemplateFont", tag))
- {
- LLVivoxVoiceClient::getInstance()->addVoiceFont(id, nameString, descriptionString, expirationDate, hasExpired, fontType, fontStatus, true);
- }
- else if (!stricmp("ID", tag))
- {
- id = strtol(string.c_str(), NULL, 10);
- }
- else if (!stricmp("Description", tag))
- {
- descriptionString = string;
- }
- else if (!stricmp("ExpirationDate", tag))
- {
- expirationDate = expiryTimeStampToLLDate(string);
- }
- else if (!stricmp("Expired", tag))
- {
- hasExpired = !stricmp(string.c_str(), "1");
- }
- else if (!stricmp("Type", tag))
- {
- fontType = strtol(string.c_str(), NULL, 10);
- }
- else if (!stricmp("Status", tag))
- {
- fontStatus = strtol(string.c_str(), NULL, 10);
- }
- else if (!stricmp("MediaCompletionType", tag))
- {
- mediaCompletionType = string;;
- }
-
- textBuffer.clear();
- accumulateText= false;
-
- if (responseDepth == 0)
- {
- // We finished all of the XML, process the data
- processResponse(tag);
- }
- }
+ const std::string& string = textBuffer;
+
+ responseDepth--;
+
+ if (ignoringTags)
+ {
+ if (ignoreDepth == responseDepth)
+ {
+ LL_DEBUGS("VivoxProtocolParser") << "end of ignore" << LL_ENDL;
+ ignoringTags = false;
+ }
+ else
+ {
+ LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+ }
+ }
+
+ if (!ignoringTags)
+ {
+ LL_DEBUGS("VivoxProtocolParser") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+
+ // Closing a tag. Finalize the text we've accumulated and reset
+ if (!stricmp("ReturnCode", tag))
+ returnCode = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("SessionHandle", tag))
+ sessionHandle = string;
+ else if (!stricmp("SessionGroupHandle", tag))
+ sessionGroupHandle = string;
+ else if (!stricmp("StatusCode", tag))
+ statusCode = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("StatusString", tag))
+ statusString = string;
+ else if (!stricmp("ParticipantURI", tag))
+ uriString = string;
+ else if (!stricmp("Volume", tag))
+ volume = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("Energy", tag))
+ energy = (F32)strtod(string.c_str(), NULL);
+ else if (!stricmp("IsModeratorMuted", tag))
+ isModeratorMuted = !stricmp(string.c_str(), "true");
+ else if (!stricmp("IsSpeaking", tag))
+ isSpeaking = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Alias", tag))
+ alias = string;
+ else if (!stricmp("NumberOfAliases", tag))
+ numberOfAliases = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("Application", tag))
+ applicationString = string;
+ else if (!stricmp("ConnectorHandle", tag))
+ connectorHandle = string;
+ else if (!stricmp("VersionID", tag))
+ versionID = string;
+ else if (!stricmp("Version", tag))
+ mBuildID = string;
+ else if (!stricmp("AccountHandle", tag))
+ accountHandle = string;
+ else if (!stricmp("State", tag))
+ state = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("URI", tag))
+ uriString = string;
+ else if (!stricmp("IsChannel", tag))
+ isChannel = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Incoming", tag))
+ incoming = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Enabled", tag))
+ enabled = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Name", tag))
+ nameString = string;
+ else if (!stricmp("AudioMedia", tag))
+ audioMediaString = string;
+ else if (!stricmp("ChannelName", tag))
+ nameString = string;
+ else if (!stricmp("DisplayName", tag))
+ displayNameString = string;
+ else if (!stricmp("Device", tag))
+ deviceString = string;
+ else if (!stricmp("AccountName", tag))
+ nameString = string;
+ else if (!stricmp("ParticipantType", tag))
+ participantType = strtol(string.c_str(), NULL, 10);
+ else if (!stricmp("IsLocallyMuted", tag))
+ isLocallyMuted = !stricmp(string.c_str(), "true");
+ else if (!stricmp("MicEnergy", tag))
+ energy = (F32)strtod(string.c_str(), NULL);
+ else if (!stricmp("ChannelName", tag))
+ nameString = string;
+ else if (!stricmp("ChannelURI", tag))
+ uriString = string;
+ else if (!stricmp("BuddyURI", tag))
+ uriString = string;
+ else if (!stricmp("Presence", tag))
+ statusString = string;
+ else if (!stricmp("CaptureDevices", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true);
+ }
+ else if (!stricmp("RenderDevices", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true);
+ }
+ else if (!stricmp("CaptureDevice", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->addCaptureDevice(LLVoiceDevice(displayNameString, deviceString));
+ }
+ else if (!stricmp("RenderDevice", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->addRenderDevice(LLVoiceDevice(displayNameString, deviceString));
+ }
+ else if (!stricmp("BlockMask", tag))
+ blockMask = string;
+ else if (!stricmp("PresenceOnly", tag))
+ presenceOnly = string;
+ else if (!stricmp("AutoAcceptMask", tag))
+ autoAcceptMask = string;
+ else if (!stricmp("AutoAddAsBuddy", tag))
+ autoAddAsBuddy = string;
+ else if (!stricmp("MessageHeader", tag))
+ messageHeader = string;
+ else if (!stricmp("MessageBody", tag))
+ messageBody = string;
+ else if (!stricmp("NotificationType", tag))
+ notificationType = string;
+ else if (!stricmp("HasText", tag))
+ hasText = !stricmp(string.c_str(), "true");
+ else if (!stricmp("HasAudio", tag))
+ hasAudio = !stricmp(string.c_str(), "true");
+ else if (!stricmp("HasVideo", tag))
+ hasVideo = !stricmp(string.c_str(), "true");
+ else if (!stricmp("Terminated", tag))
+ terminated = !stricmp(string.c_str(), "true");
+ else if (!stricmp("SubscriptionHandle", tag))
+ subscriptionHandle = string;
+ else if (!stricmp("SubscriptionType", tag))
+ subscriptionType = string;
+ else if (!stricmp("SessionFont", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->addVoiceFont(id, nameString, descriptionString, expirationDate, hasExpired, fontType, fontStatus, false);
+ }
+ else if (!stricmp("TemplateFont", tag))
+ {
+ LLVivoxVoiceClient::getInstance()->addVoiceFont(id, nameString, descriptionString, expirationDate, hasExpired, fontType, fontStatus, true);
+ }
+ else if (!stricmp("ID", tag))
+ {
+ id = strtol(string.c_str(), NULL, 10);
+ }
+ else if (!stricmp("Description", tag))
+ {
+ descriptionString = string;
+ }
+ else if (!stricmp("ExpirationDate", tag))
+ {
+ expirationDate = expiryTimeStampToLLDate(string);
+ }
+ else if (!stricmp("Expired", tag))
+ {
+ hasExpired = !stricmp(string.c_str(), "1");
+ }
+ else if (!stricmp("Type", tag))
+ {
+ fontType = strtol(string.c_str(), NULL, 10);
+ }
+ else if (!stricmp("Status", tag))
+ {
+ fontStatus = strtol(string.c_str(), NULL, 10);
+ }
+ else if (!stricmp("MediaCompletionType", tag))
+ {
+ mediaCompletionType = string;;
+ }
+
+ textBuffer.clear();
+ accumulateText= false;
+
+ if (responseDepth == 0)
+ {
+ // We finished all of the XML, process the data
+ processResponse(tag);
+ }
+ }
}
// --------------------------------------------------------------------------------
void LLVivoxProtocolParser::CharData(const char *buffer, int length)
{
- /*
- This method is called for anything that isn't a tag, which can be text you
- want that lies between tags, and a lot of stuff you don't want like file formatting
- (tabs, spaces, CR/LF, etc).
-
- Only copy text if we are in accumulate mode...
- */
- if (accumulateText)
- textBuffer.append(buffer, length);
+ /*
+ This method is called for anything that isn't a tag, which can be text you
+ want that lies between tags, and a lot of stuff you don't want like file formatting
+ (tabs, spaces, CR/LF, etc).
+
+ Only copy text if we are in accumulate mode...
+ */
+ if (accumulateText)
+ textBuffer.append(buffer, length);
}
// --------------------------------------------------------------------------------
LLDate LLVivoxProtocolParser::expiryTimeStampToLLDate(const std::string& vivox_ts)
{
- // *HACK: Vivox reports the time incorrectly. LLDate also only parses a
- // subset of valid ISO 8601 dates (only handles Z, not offsets).
- // So just use the date portion and fix the time here.
- std::string time_stamp = vivox_ts.substr(0, 10);
- time_stamp += VOICE_FONT_EXPIRY_TIME;
+ // *HACK: Vivox reports the time incorrectly. LLDate also only parses a
+ // subset of valid ISO 8601 dates (only handles Z, not offsets).
+ // So just use the date portion and fix the time here.
+ std::string time_stamp = vivox_ts.substr(0, 10);
+ time_stamp += VOICE_FONT_EXPIRY_TIME;
- LL_DEBUGS("VivoxProtocolParser") << "Vivox timestamp " << vivox_ts << " modified to: " << time_stamp << LL_ENDL;
+ LL_DEBUGS("VivoxProtocolParser") << "Vivox timestamp " << vivox_ts << " modified to: " << time_stamp << LL_ENDL;
- return LLDate(time_stamp);
+ return LLDate(time_stamp);
}
// --------------------------------------------------------------------------------
void LLVivoxProtocolParser::processResponse(std::string tag)
{
- LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
-
- // SLIM SDK: the SDK now returns a statusCode of "200" (OK) for success. This is a change vs. previous SDKs.
- // According to Mike S., "The actual API convention is that responses with return codes of 0 are successful, regardless of the status code returned",
- // so I believe this will give correct behavior.
-
- if(returnCode == 0)
- statusCode = 0;
-
- if (isEvent)
- {
- const char *eventTypeCstr = eventTypeString.c_str();
+ LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
+
+ // SLIM SDK: the SDK now returns a statusCode of "200" (OK) for success. This is a change vs. previous SDKs.
+ // According to Mike S., "The actual API convention is that responses with return codes of 0 are successful, regardless of the status code returned",
+ // so I believe this will give correct behavior.
+
+ if(returnCode == 0)
+ statusCode = 0;
+
+ if (isEvent)
+ {
+ const char *eventTypeCstr = eventTypeString.c_str();
LL_DEBUGS("LowVoice") << eventTypeCstr << LL_ENDL;
- if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
- {
- // These happen so often that logging them is pretty useless.
+ if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
+ {
+ // These happen so often that logging them is pretty useless.
LL_DEBUGS("LowVoice") << "Updated Params: " << sessionHandle << ", " << sessionGroupHandle << ", " << uriString << ", " << alias << ", " << isModeratorMuted << ", " << isSpeaking << ", " << volume << ", " << energy << LL_ENDL;
LLVivoxVoiceClient::getInstance()->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
- }
- else if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
- {
- LLVivoxVoiceClient::getInstance()->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
- }
- else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
- {
- /*
- <Event type="SessionAddedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
- <Uri>sip:confctl-1408789@bhr.vivox.com</Uri>
- <IsChannel>true</IsChannel>
- <Incoming>false</Incoming>
- <ChannelName />
- </Event>
- */
- LLVivoxVoiceClient::getInstance()->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
- }
- else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
- {
- LLVivoxVoiceClient::getInstance()->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
- }
- else if (!stricmp(eventTypeCstr, "SessionGroupUpdatedEvent"))
- {
- //nothng useful to process for this event, but we should not WARN that we have received it.
- }
- else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
- {
- LLVivoxVoiceClient::getInstance()->sessionGroupAddedEvent(sessionGroupHandle);
- }
- else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
- {
- /*
- <Event type="MediaStreamUpdatedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
- <StatusCode>200</StatusCode>
- <StatusString>OK</StatusString>
- <State>2</State>
- <Incoming>false</Incoming>
- </Event>
- */
- LLVivoxVoiceClient::getInstance()->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
- }
- else if (!stricmp(eventTypeCstr, "MediaCompletionEvent"))
- {
- /*
- <Event type="MediaCompletionEvent">
- <SessionGroupHandle />
- <MediaCompletionType>AuxBufferAudioCapture</MediaCompletionType>
- </Event>
- */
- LLVivoxVoiceClient::getInstance()->mediaCompletionEvent(sessionGroupHandle, mediaCompletionType);
- }
- else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
- {
- /*
- <Event type="ParticipantAddedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
- <ParticipantUri>sip:xI5auBZ60SJWIk606-1JGRQ==@bhr.vivox.com</ParticipantUri>
- <AccountName>xI5auBZ60SJWIk606-1JGRQ==</AccountName>
- <DisplayName />
- <ParticipantType>0</ParticipantType>
- </Event>
- */
+ }
+ else if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
+ {
+ /*
+ <Event type="SessionAddedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+ <Uri>sip:confctl-1408789@bhr.vivox.com</Uri>
+ <IsChannel>true</IsChannel>
+ <Incoming>false</Incoming>
+ <ChannelName />
+ </Event>
+ */
+ LLVivoxVoiceClient::getInstance()->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionGroupUpdatedEvent"))
+ {
+ //nothng useful to process for this event, but we should not WARN that we have received it.
+ }
+ else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionGroupAddedEvent(sessionGroupHandle);
+ }
+ else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
+ {
+ /*
+ <Event type="MediaStreamUpdatedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+ <StatusCode>200</StatusCode>
+ <StatusString>OK</StatusString>
+ <State>2</State>
+ <Incoming>false</Incoming>
+ </Event>
+ */
+ LLVivoxVoiceClient::getInstance()->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
+ }
+ else if (!stricmp(eventTypeCstr, "MediaCompletionEvent"))
+ {
+ /*
+ <Event type="MediaCompletionEvent">
+ <SessionGroupHandle />
+ <MediaCompletionType>AuxBufferAudioCapture</MediaCompletionType>
+ </Event>
+ */
+ LLVivoxVoiceClient::getInstance()->mediaCompletionEvent(sessionGroupHandle, mediaCompletionType);
+ }
+ else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
+ {
+ /*
+ <Event type="ParticipantAddedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+ <ParticipantUri>sip:xI5auBZ60SJWIk606-1JGRQ==@bhr.vivox.com</ParticipantUri>
+ <AccountName>xI5auBZ60SJWIk606-1JGRQ==</AccountName>
+ <DisplayName />
+ <ParticipantType>0</ParticipantType>
+ </Event>
+ */
LL_DEBUGS("LowVoice") << "Added Params: " << sessionHandle << ", " << sessionGroupHandle << ", " << uriString << ", " << alias << ", " << nameString << ", " << displayNameString << ", " << participantType << LL_ENDL;
- LLVivoxVoiceClient::getInstance()->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
- }
- else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
- {
- /*
- <Event type="ParticipantRemovedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
- <ParticipantUri>sip:xtx7YNV-3SGiG7rA1fo5Ndw==@bhr.vivox.com</ParticipantUri>
- <AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
- </Event>
- */
+ LLVivoxVoiceClient::getInstance()->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
+ }
+ else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
+ {
+ /*
+ <Event type="ParticipantRemovedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+ <ParticipantUri>sip:xtx7YNV-3SGiG7rA1fo5Ndw==@bhr.vivox.com</ParticipantUri>
+ <AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
+ </Event>
+ */
LL_DEBUGS("LowVoice") << "Removed params:" << sessionHandle << ", " << sessionGroupHandle << ", " << uriString << ", " << alias << ", " << nameString << LL_ENDL;
- LLVivoxVoiceClient::getInstance()->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
- }
- else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
- {
- // These are really spammy in tuning mode
- LLVivoxVoiceClient::getInstance()->auxAudioPropertiesEvent(energy);
- }
- else if (!stricmp(eventTypeCstr, "MessageEvent"))
- {
- //TODO: This probably is not received any more, it was used to support SLim clients
- LLVivoxVoiceClient::getInstance()->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
- }
- else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))
- {
- //TODO: This probably is not received any more, it was used to support SLim clients
- LLVivoxVoiceClient::getInstance()->sessionNotificationEvent(sessionHandle, uriString, notificationType);
- }
- else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))
- {
- /*
- <Event type="SessionUpdatedEvent">
- <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
- <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
- <Uri>sip:confctl-9@bhd.vivox.com</Uri>
- <IsMuted>0</IsMuted>
- <Volume>50</Volume>
- <TransmitEnabled>1</TransmitEnabled>
- <IsFocused>0</IsFocused>
- <SpeakerPosition><Position><X>0</X><Y>0</Y><Z>0</Z></Position></SpeakerPosition>
- <SessionFontID>0</SessionFontID>
- </Event>
- */
- // We don't need to process this, but we also shouldn't warn on it, since that confuses people.
- }
- else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent"))
- {
- // We don't need to process this, but we also shouldn't warn on it, since that confuses people.
- }
- else if (!stricmp(eventTypeCstr, "VoiceServiceConnectionStateChangedEvent"))
- {
- LLVivoxVoiceClient::getInstance()->voiceServiceConnectionStateChangedEvent(statusCode, statusString, mBuildID);
- }
- else if (!stricmp(eventTypeCstr, "AudioDeviceHotSwapEvent"))
- {
- /*
- <Event type = "AudioDeviceHotSwapEvent">
- <EventType>RenderDeviceChanged< / EventType>
- <RelevantDevice>
- <Device>Speakers(Turtle Beach P11 Headset)< / Device>
- <DisplayName>Speakers(Turtle Beach P11 Headset)< / DisplayName>
- <Type>SpecificDevice< / Type>
- < / RelevantDevice>
- < / Event>
- */
- // an audio device was removed or added, fetch and update the local list of audio devices.
- LLVivoxVoiceClient::getInstance()->getCaptureDevicesSendMessage();
- LLVivoxVoiceClient::getInstance()->getRenderDevicesSendMessage();
- }
- else
- {
- LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL;
- }
- }
- else
- {
- const char *actionCstr = actionString.c_str();
+ LLVivoxVoiceClient::getInstance()->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
+ }
+ else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
+ {
+ // These are really spammy in tuning mode
+ LLVivoxVoiceClient::getInstance()->auxAudioPropertiesEvent(energy);
+ }
+ else if (!stricmp(eventTypeCstr, "MessageEvent"))
+ {
+ //TODO: This probably is not received any more, it was used to support SLim clients
+ LLVivoxVoiceClient::getInstance()->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))
+ {
+ //TODO: This probably is not received any more, it was used to support SLim clients
+ LLVivoxVoiceClient::getInstance()->sessionNotificationEvent(sessionHandle, uriString, notificationType);
+ }
+ else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))
+ {
+ /*
+ <Event type="SessionUpdatedEvent">
+ <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+ <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+ <Uri>sip:confctl-9@bhd.vivox.com</Uri>
+ <IsMuted>0</IsMuted>
+ <Volume>50</Volume>
+ <TransmitEnabled>1</TransmitEnabled>
+ <IsFocused>0</IsFocused>
+ <SpeakerPosition><Position><X>0</X><Y>0</Y><Z>0</Z></Position></SpeakerPosition>
+ <SessionFontID>0</SessionFontID>
+ </Event>
+ */
+ // We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+ }
+ else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent"))
+ {
+ // We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+ }
+ else if (!stricmp(eventTypeCstr, "VoiceServiceConnectionStateChangedEvent"))
+ {
+ LLVivoxVoiceClient::getInstance()->voiceServiceConnectionStateChangedEvent(statusCode, statusString, mBuildID);
+ }
+ else if (!stricmp(eventTypeCstr, "AudioDeviceHotSwapEvent"))
+ {
+ /*
+ <Event type = "AudioDeviceHotSwapEvent">
+ <EventType>RenderDeviceChanged< / EventType>
+ <RelevantDevice>
+ <Device>Speakers(Turtle Beach P11 Headset)< / Device>
+ <DisplayName>Speakers(Turtle Beach P11 Headset)< / DisplayName>
+ <Type>SpecificDevice< / Type>
+ < / RelevantDevice>
+ < / Event>
+ */
+ // an audio device was removed or added, fetch and update the local list of audio devices.
+ LLVivoxVoiceClient::getInstance()->getCaptureDevicesSendMessage();
+ LLVivoxVoiceClient::getInstance()->getRenderDevicesSendMessage();
+ }
+ else
+ {
+ LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL;
+ }
+ }
+ else
+ {
+ const char *actionCstr = actionString.c_str();
LL_DEBUGS("LowVoice") << actionCstr << LL_ENDL;
- if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
- {
- // We don't need to process these
- }
- else if (!stricmp(actionCstr, "Connector.Create.1"))
- {
- LLVivoxVoiceClient::getInstance()->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
- }
- else if (!stricmp(actionCstr, "Account.Login.1"))
- {
- LLVivoxVoiceClient::getInstance()->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
- }
- else if (!stricmp(actionCstr, "Session.Create.1"))
- {
- LLVivoxVoiceClient::getInstance()->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);
- }
- else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
- {
- LLVivoxVoiceClient::getInstance()->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);
- }
- else if (!stricmp(actionCstr, "Session.Connect.1"))
- {
- LLVivoxVoiceClient::getInstance()->sessionConnectResponse(requestId, statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Account.Logout.1"))
- {
- LLVivoxVoiceClient::getInstance()->logoutResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
- {
- LLVivoxVoiceClient::getInstance()->connectorShutdownResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Account.GetSessionFonts.1"))
- {
- LLVivoxVoiceClient::getInstance()->accountGetSessionFontsResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Account.GetTemplateFonts.1"))
- {
- LLVivoxVoiceClient::getInstance()->accountGetTemplateFontsResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Aux.SetVadProperties.1"))
- {
- // both values of statusCode (old and more recent) indicate valid requests
- if (statusCode != 0 && statusCode != 200)
- {
- LL_WARNS("Voice") << "Aux.SetVadProperties.1 request failed: "
- << "statusCode: " << statusCode
- << " and "
- << "statusString: " << statusString
- << LL_ENDL;
- }
- }
- /*
- else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
- {
- LLVoiceClient::getInstance()->channelGetListResponse(statusCode, statusString);
- }
- else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Connector.MuteLocalMic.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Connector.MuteLocalSpeaker.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Connector.SetLocalMicVolume.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Connector.SetLocalSpeakerVolume.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Session.ListenerSetPosition.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Session.SpeakerSetPosition.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Session.AudioSourceSetPosition.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Session.GetChannelParticipants.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelCreate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelUpdate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelDelete.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelCreateAndInvite.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelFolderCreate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelFolderUpdate.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelFolderDelete.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelAddModerator.1"))
- {
-
- }
- else if (!stricmp(actionCstr, "Account.ChannelDeleteModerator.1"))
- {
-
- }
- */
- }
+ if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
+ {
+ // We don't need to process these
+ }
+ else if (!stricmp(actionCstr, "Connector.Create.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
+ }
+ else if (!stricmp(actionCstr, "Account.Login.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
+ }
+ else if (!stricmp(actionCstr, "Session.Create.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);
+ }
+ else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);
+ }
+ else if (!stricmp(actionCstr, "Session.Connect.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->sessionConnectResponse(requestId, statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Account.Logout.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->logoutResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->connectorShutdownResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Account.GetSessionFonts.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->accountGetSessionFontsResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Account.GetTemplateFonts.1"))
+ {
+ LLVivoxVoiceClient::getInstance()->accountGetTemplateFontsResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Aux.SetVadProperties.1"))
+ {
+ // both values of statusCode (old and more recent) indicate valid requests
+ if (statusCode != 0 && statusCode != 200)
+ {
+ LL_WARNS("Voice") << "Aux.SetVadProperties.1 request failed: "
+ << "statusCode: " << statusCode
+ << " and "
+ << "statusString: " << statusString
+ << LL_ENDL;
+ }
+ }
+ /*
+ else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
+ {
+ LLVoiceClient::getInstance()->channelGetListResponse(statusCode, statusString);
+ }
+ else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Connector.MuteLocalMic.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Connector.MuteLocalSpeaker.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Connector.SetLocalMicVolume.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Connector.SetLocalSpeakerVolume.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Session.ListenerSetPosition.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Session.SpeakerSetPosition.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Session.AudioSourceSetPosition.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Session.GetChannelParticipants.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelCreate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelUpdate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelDelete.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelCreateAndInvite.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelFolderCreate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelFolderUpdate.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelFolderDelete.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelAddModerator.1"))
+ {
+
+ }
+ else if (!stricmp(actionCstr, "Account.ChannelDeleteModerator.1"))
+ {
+
+ }
+ */
+ }
}
LLVivoxSecurity::LLVivoxSecurity()
@@ -8089,7 +8089,7 @@ LLVivoxSecurity::LLVivoxSecurity()
random_value[b] = ll_rand() & 0xff;
}
mConnectorHandle = LLBase64::encode(random_value, VIVOX_TOKEN_BYTES);
-
+
for (int b = 0; b < VIVOX_TOKEN_BYTES; b++)
{
random_value[b] = ll_rand() & 0xff;
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index 7e1835d876..36d3e9d0a1 100644
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvoicevivox.h
* @brief Declaration of LLDiamondwareVoiceClient class which is the interface to the voice client process.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,256 +52,256 @@ class LLAvatarName;
class LLVivoxVoiceClientMuteListObserver;
-class LLVivoxVoiceClient : public LLSingleton<LLVivoxVoiceClient>,
- virtual public LLVoiceModuleInterface,
- virtual public LLVoiceEffectInterface
+class LLVivoxVoiceClient : public LLSingleton<LLVivoxVoiceClient>,
+ virtual public LLVoiceModuleInterface,
+ virtual public LLVoiceEffectInterface
{
- LLSINGLETON(LLVivoxVoiceClient);
- LOG_CLASS(LLVivoxVoiceClient);
- virtual ~LLVivoxVoiceClient();
+ LLSINGLETON(LLVivoxVoiceClient);
+ LOG_CLASS(LLVivoxVoiceClient);
+ virtual ~LLVivoxVoiceClient();
public:
- /// @name LLVoiceModuleInterface virtual implementations
- /// @see LLVoiceModuleInterface
- //@{
- virtual void init(LLPumpIO *pump) override; // Call this once at application startup (creates connector)
- virtual void terminate() override; // Call this to clean up during shutdown
-
- virtual const LLVoiceVersionInfo& getVersion() override;
-
- virtual void updateSettings() override; // call after loading settings and whenever they change
-
- // Returns true if vivox has successfully logged in and is not in error state
- virtual bool isVoiceWorking() const override;
-
- /////////////////////
- /// @name Tuning
- //@{
- virtual void tuningStart() override;
- virtual void tuningStop() override;
- virtual bool inTuningMode() override;
-
- virtual void tuningSetMicVolume(float volume) override;
- virtual void tuningSetSpeakerVolume(float volume) override;
- virtual float tuningGetEnergy(void) override;
- //@}
-
- /////////////////////
- /// @name Devices
- //@{
- // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
- // i.e. when the daemon is running and connected, and the device lists are populated.
- virtual bool deviceSettingsAvailable() override;
- virtual bool deviceSettingsUpdated() override; //return if the list has been updated and never fetched, only to be called from the voicepanel.
-
- // Requery the vivox daemon for the current list of input/output devices.
- // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
- // (use this if you want to know when it's done).
- // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
- virtual void refreshDeviceLists(bool clearCurrentList = true) override;
-
- virtual void setCaptureDevice(const std::string& name) override;
- virtual void setRenderDevice(const std::string& name) override;
-
- virtual LLVoiceDeviceList& getCaptureDevices() override;
- virtual LLVoiceDeviceList& getRenderDevices() override;
- //@}
-
- virtual void getParticipantList(std::set<LLUUID> &participants) override;
- virtual bool isParticipant(const LLUUID& speaker_id) override;
-
- // Send a text message to the specified user, initiating the session if necessary.
- // virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return false;};
-
- // close any existing text IM session with the specified user
- virtual void endUserIMSession(const LLUUID &uuid) override;
-
- // Returns true if calling back the session URI after the session has closed is possible.
- // Currently this will be false only for PSTN P2P calls.
- // NOTE: this will return true if the session can't be found.
- virtual BOOL isSessionCallBackPossible(const LLUUID &session_id) override;
-
- // Returns true if the session can accepte text IM's.
- // Currently this will be false only for PSTN P2P calls.
- // NOTE: this will return true if the session can't be found.
- virtual BOOL isSessionTextIMPossible(const LLUUID &session_id) override;
-
-
- ////////////////////////////
- /// @name Channel stuff
- //@{
- // returns true iff the user is currently in a proximal (local spatial) channel.
- // Note that gestures should only fire if this returns true.
- virtual bool inProximalChannel() override;
-
- virtual void setNonSpatialChannel(const std::string &uri,
- const std::string &credentials) override;
-
- virtual bool setSpatialChannel(const std::string &uri,
- const std::string &credentials) override;
-
- virtual void leaveNonSpatialChannel() override;
-
- virtual void leaveChannel(void) override;
-
- // Returns the URI of the current channel, or an empty string if not currently in a channel.
- // NOTE that it will return an empty string if it's in the process of joining a channel.
- virtual std::string getCurrentChannel() override;
- //@}
-
-
- //////////////////////////
- /// @name invitations
- //@{
- // start a voice channel with the specified user
- virtual void callUser(const LLUUID &uuid) override;
- virtual bool isValidChannel(std::string &channelHandle) override;
- virtual bool answerInvite(std::string &channelHandle) override;
- virtual void declineInvite(std::string &channelHandle) override;
- //@}
-
- /////////////////////////
- /// @name Volume/gain
- //@{
- virtual void setVoiceVolume(F32 volume) override;
- virtual void setMicGain(F32 volume) override;
- //@}
-
- /////////////////////////
- /// @name enable disable voice and features
- //@{
- virtual bool voiceEnabled() override;
- virtual void setVoiceEnabled(bool enabled) override;
- virtual BOOL lipSyncEnabled() override;
- virtual void setLipSyncEnabled(BOOL enabled) override;
- virtual void setMuteMic(bool muted) override; // Set the mute state of the local mic.
- //@}
-
- //////////////////////////
- /// @name nearby speaker accessors
- //@{
- virtual BOOL getVoiceEnabled(const LLUUID& id) override; // true if we've received data for this avatar
- virtual std::string getDisplayName(const LLUUID& id) override;
- virtual BOOL isParticipantAvatar(const LLUUID &id) override;
- virtual BOOL getIsSpeaking(const LLUUID& id) override;
- virtual BOOL getIsModeratorMuted(const LLUUID& id) override;
- virtual F32 getCurrentPower(const LLUUID& id) override; // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
- virtual BOOL getOnMuteList(const LLUUID& id) override;
- virtual F32 getUserVolume(const LLUUID& id) override;
- virtual void setUserVolume(const LLUUID& id, F32 volume) override; // set's volume for specified agent, from 0-1 (where .5 is nominal)
- //@}
-
- // authorize the user
- virtual void userAuthorized(const std::string& user_id,
- const LLUUID &agentID) override;
-
- //////////////////////////////
- /// @name Status notification
- //@{
- virtual void addObserver(LLVoiceClientStatusObserver* observer) override;
- virtual void removeObserver(LLVoiceClientStatusObserver* observer) override;
- virtual void addObserver(LLFriendObserver* observer) override;
- virtual void removeObserver(LLFriendObserver* observer) override;
- virtual void addObserver(LLVoiceClientParticipantObserver* observer) override;
- virtual void removeObserver(LLVoiceClientParticipantObserver* observer) override;
- //@}
-
- virtual std::string sipURIFromID(const LLUUID &id) override;
- //@}
-
- /// @name LLVoiceEffectInterface virtual implementations
- /// @see LLVoiceEffectInterface
- //@{
-
- //////////////////////////
- /// @name Accessors
- //@{
- virtual bool setVoiceEffect(const LLUUID& id) override;
- virtual const LLUUID getVoiceEffect() override;
- virtual LLSD getVoiceEffectProperties(const LLUUID& id) override;
-
- virtual void refreshVoiceEffectLists(bool clear_lists) override;
- virtual const voice_effect_list_t& getVoiceEffectList() const override;
- virtual const voice_effect_list_t& getVoiceEffectTemplateList() const override;
- //@}
-
- //////////////////////////////
- /// @name Status notification
- //@{
- virtual void addObserver(LLVoiceEffectObserver* observer) override;
- virtual void removeObserver(LLVoiceEffectObserver* observer) override;
- //@}
-
- //////////////////////////////
- /// @name Effect preview buffer
- //@{
- virtual void enablePreviewBuffer(bool enable) override;
- virtual void recordPreviewBuffer() override;
- virtual void playPreviewBuffer(const LLUUID& effect_id = LLUUID::null) override;
- virtual void stopPreviewBuffer() override;
-
- virtual bool isPreviewRecording() override;
- virtual bool isPreviewPlaying() override;
- //@}
-
- //@}
-
- bool onCheckVoiceEffect(const std::string& voice_effect_name);
- void onClickVoiceEffect(const std::string& voice_effect_name);
+ /// @name LLVoiceModuleInterface virtual implementations
+ /// @see LLVoiceModuleInterface
+ //@{
+ virtual void init(LLPumpIO *pump) override; // Call this once at application startup (creates connector)
+ virtual void terminate() override; // Call this to clean up during shutdown
+
+ virtual const LLVoiceVersionInfo& getVersion() override;
+
+ virtual void updateSettings() override; // call after loading settings and whenever they change
+
+ // Returns true if vivox has successfully logged in and is not in error state
+ virtual bool isVoiceWorking() const override;
+
+ /////////////////////
+ /// @name Tuning
+ //@{
+ virtual void tuningStart() override;
+ virtual void tuningStop() override;
+ virtual bool inTuningMode() override;
+
+ virtual void tuningSetMicVolume(float volume) override;
+ virtual void tuningSetSpeakerVolume(float volume) override;
+ virtual float tuningGetEnergy(void) override;
+ //@}
+
+ /////////////////////
+ /// @name Devices
+ //@{
+ // This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+ // i.e. when the daemon is running and connected, and the device lists are populated.
+ virtual bool deviceSettingsAvailable() override;
+ virtual bool deviceSettingsUpdated() override; //return if the list has been updated and never fetched, only to be called from the voicepanel.
+
+ // Requery the vivox daemon for the current list of input/output devices.
+ // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+ // (use this if you want to know when it's done).
+ // If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+ virtual void refreshDeviceLists(bool clearCurrentList = true) override;
+
+ virtual void setCaptureDevice(const std::string& name) override;
+ virtual void setRenderDevice(const std::string& name) override;
+
+ virtual LLVoiceDeviceList& getCaptureDevices() override;
+ virtual LLVoiceDeviceList& getRenderDevices() override;
+ //@}
+
+ virtual void getParticipantList(std::set<LLUUID> &participants) override;
+ virtual bool isParticipant(const LLUUID& speaker_id) override;
+
+ // Send a text message to the specified user, initiating the session if necessary.
+ // virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return false;};
+
+ // close any existing text IM session with the specified user
+ virtual void endUserIMSession(const LLUUID &uuid) override;
+
+ // Returns true if calling back the session URI after the session has closed is possible.
+ // Currently this will be false only for PSTN P2P calls.
+ // NOTE: this will return true if the session can't be found.
+ virtual BOOL isSessionCallBackPossible(const LLUUID &session_id) override;
+
+ // Returns true if the session can accepte text IM's.
+ // Currently this will be false only for PSTN P2P calls.
+ // NOTE: this will return true if the session can't be found.
+ virtual BOOL isSessionTextIMPossible(const LLUUID &session_id) override;
+
+
+ ////////////////////////////
+ /// @name Channel stuff
+ //@{
+ // returns true iff the user is currently in a proximal (local spatial) channel.
+ // Note that gestures should only fire if this returns true.
+ virtual bool inProximalChannel() override;
+
+ virtual void setNonSpatialChannel(const std::string &uri,
+ const std::string &credentials) override;
+
+ virtual bool setSpatialChannel(const std::string &uri,
+ const std::string &credentials) override;
+
+ virtual void leaveNonSpatialChannel() override;
+
+ virtual void leaveChannel(void) override;
+
+ // Returns the URI of the current channel, or an empty string if not currently in a channel.
+ // NOTE that it will return an empty string if it's in the process of joining a channel.
+ virtual std::string getCurrentChannel() override;
+ //@}
+
+
+ //////////////////////////
+ /// @name invitations
+ //@{
+ // start a voice channel with the specified user
+ virtual void callUser(const LLUUID &uuid) override;
+ virtual bool isValidChannel(std::string &channelHandle) override;
+ virtual bool answerInvite(std::string &channelHandle) override;
+ virtual void declineInvite(std::string &channelHandle) override;
+ //@}
+
+ /////////////////////////
+ /// @name Volume/gain
+ //@{
+ virtual void setVoiceVolume(F32 volume) override;
+ virtual void setMicGain(F32 volume) override;
+ //@}
+
+ /////////////////////////
+ /// @name enable disable voice and features
+ //@{
+ virtual bool voiceEnabled() override;
+ virtual void setVoiceEnabled(bool enabled) override;
+ virtual BOOL lipSyncEnabled() override;
+ virtual void setLipSyncEnabled(BOOL enabled) override;
+ virtual void setMuteMic(bool muted) override; // Set the mute state of the local mic.
+ //@}
+
+ //////////////////////////
+ /// @name nearby speaker accessors
+ //@{
+ virtual BOOL getVoiceEnabled(const LLUUID& id) override; // true if we've received data for this avatar
+ virtual std::string getDisplayName(const LLUUID& id) override;
+ virtual BOOL isParticipantAvatar(const LLUUID &id) override;
+ virtual BOOL getIsSpeaking(const LLUUID& id) override;
+ virtual BOOL getIsModeratorMuted(const LLUUID& id) override;
+ virtual F32 getCurrentPower(const LLUUID& id) override; // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is...
+ virtual BOOL getOnMuteList(const LLUUID& id) override;
+ virtual F32 getUserVolume(const LLUUID& id) override;
+ virtual void setUserVolume(const LLUUID& id, F32 volume) override; // set's volume for specified agent, from 0-1 (where .5 is nominal)
+ //@}
+
+ // authorize the user
+ virtual void userAuthorized(const std::string& user_id,
+ const LLUUID &agentID) override;
+
+ //////////////////////////////
+ /// @name Status notification
+ //@{
+ virtual void addObserver(LLVoiceClientStatusObserver* observer) override;
+ virtual void removeObserver(LLVoiceClientStatusObserver* observer) override;
+ virtual void addObserver(LLFriendObserver* observer) override;
+ virtual void removeObserver(LLFriendObserver* observer) override;
+ virtual void addObserver(LLVoiceClientParticipantObserver* observer) override;
+ virtual void removeObserver(LLVoiceClientParticipantObserver* observer) override;
+ //@}
+
+ virtual std::string sipURIFromID(const LLUUID &id) override;
+ //@}
+
+ /// @name LLVoiceEffectInterface virtual implementations
+ /// @see LLVoiceEffectInterface
+ //@{
+
+ //////////////////////////
+ /// @name Accessors
+ //@{
+ virtual bool setVoiceEffect(const LLUUID& id) override;
+ virtual const LLUUID getVoiceEffect() override;
+ virtual LLSD getVoiceEffectProperties(const LLUUID& id) override;
+
+ virtual void refreshVoiceEffectLists(bool clear_lists) override;
+ virtual const voice_effect_list_t& getVoiceEffectList() const override;
+ virtual const voice_effect_list_t& getVoiceEffectTemplateList() const override;
+ //@}
+
+ //////////////////////////////
+ /// @name Status notification
+ //@{
+ virtual void addObserver(LLVoiceEffectObserver* observer) override;
+ virtual void removeObserver(LLVoiceEffectObserver* observer) override;
+ //@}
+
+ //////////////////////////////
+ /// @name Effect preview buffer
+ //@{
+ virtual void enablePreviewBuffer(bool enable) override;
+ virtual void recordPreviewBuffer() override;
+ virtual void playPreviewBuffer(const LLUUID& effect_id = LLUUID::null) override;
+ virtual void stopPreviewBuffer() override;
+
+ virtual bool isPreviewRecording() override;
+ virtual bool isPreviewPlaying() override;
+ //@}
+
+ //@}
+
+ bool onCheckVoiceEffect(const std::string& voice_effect_name);
+ void onClickVoiceEffect(const std::string& voice_effect_name);
protected:
- //////////////////////
- // Vivox Specific definitions
-
- friend class LLVivoxVoiceClientMuteListObserver;
- friend class LLVivoxVoiceClientFriendsObserver;
-
-
- enum streamState
- {
- streamStateUnknown = 0,
- streamStateIdle = 1,
- streamStateConnected = 2,
- streamStateRinging = 3,
- streamStateConnecting = 6, // same as Vivox session_media_connecting enum
- streamStateDisconnecting = 7, //Same as Vivox session_media_disconnecting enum
- };
-
- struct participantState
- {
- public:
- participantState(const std::string &uri);
-
- bool updateMuteState(); // true if mute state has changed
- bool isAvatar();
-
- std::string mURI;
- LLUUID mAvatarID;
- std::string mAccountName;
- std::string mDisplayName;
- LLFrameTimer mSpeakingTimeout;
- F32 mLastSpokeTimestamp;
- F32 mPower;
- F32 mVolume;
- std::string mGroupID;
- int mUserVolume;
- bool mPTT;
- bool mIsSpeaking;
- bool mIsModeratorMuted;
- bool mOnMuteList; // true if this avatar is on the user's mute list (and should be muted)
- bool mVolumeSet; // true if incoming volume messages should not change the volume
- bool mVolumeDirty; // true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
- bool mAvatarIDValid;
- bool mIsSelf;
- };
+ //////////////////////
+ // Vivox Specific definitions
+
+ friend class LLVivoxVoiceClientMuteListObserver;
+ friend class LLVivoxVoiceClientFriendsObserver;
+
+
+ enum streamState
+ {
+ streamStateUnknown = 0,
+ streamStateIdle = 1,
+ streamStateConnected = 2,
+ streamStateRinging = 3,
+ streamStateConnecting = 6, // same as Vivox session_media_connecting enum
+ streamStateDisconnecting = 7, //Same as Vivox session_media_disconnecting enum
+ };
+
+ struct participantState
+ {
+ public:
+ participantState(const std::string &uri);
+
+ bool updateMuteState(); // true if mute state has changed
+ bool isAvatar();
+
+ std::string mURI;
+ LLUUID mAvatarID;
+ std::string mAccountName;
+ std::string mDisplayName;
+ LLFrameTimer mSpeakingTimeout;
+ F32 mLastSpokeTimestamp;
+ F32 mPower;
+ F32 mVolume;
+ std::string mGroupID;
+ int mUserVolume;
+ bool mPTT;
+ bool mIsSpeaking;
+ bool mIsModeratorMuted;
+ bool mOnMuteList; // true if this avatar is on the user's mute list (and should be muted)
+ bool mVolumeSet; // true if incoming volume messages should not change the volume
+ bool mVolumeDirty; // true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
+ bool mAvatarIDValid;
+ bool mIsSelf;
+ };
typedef std::shared_ptr<participantState> participantStatePtr_t;
typedef std::weak_ptr<participantState> participantStateWptr_t;
typedef std::map<const std::string, participantStatePtr_t> participantMap;
typedef std::map<const LLUUID, participantStatePtr_t> participantUUIDMap;
-
- struct sessionState
- {
+
+ struct sessionState
+ {
public:
typedef std::shared_ptr<sessionState> ptr_t;
typedef std::weak_ptr<sessionState> wptr_t;
@@ -309,11 +309,11 @@ protected:
typedef std::function<void(const ptr_t &)> sessionFunc_t;
static ptr_t createSession();
- ~sessionState();
-
+ ~sessionState();
+
participantStatePtr_t addParticipant(const std::string &uri);
void removeParticipant(const participantStatePtr_t &participant);
- void removeAllParticipants();
+ void removeAllParticipants();
participantStatePtr_t findParticipant(const std::string &uri);
participantStatePtr_t findParticipantByID(const LLUUID& id);
@@ -323,47 +323,47 @@ protected:
static ptr_t matchSessionByURI(const std::string &uri);
static ptr_t matchSessionByParticipant(const LLUUID &participant_id);
- bool isCallBackPossible();
- bool isTextIMPossible();
-
+ bool isCallBackPossible();
+ bool isTextIMPossible();
+
static void for_each(sessionFunc_t func);
- std::string mHandle;
- std::string mGroupHandle;
- std::string mSIPURI;
- std::string mAlias;
- std::string mName;
- std::string mAlternateSIPURI;
- std::string mHash; // Channel password
- std::string mErrorStatusString;
- std::queue<std::string> mTextMsgQueue;
-
- LLUUID mIMSessionID;
- LLUUID mCallerID;
- int mErrorStatusCode;
- int mMediaStreamState;
- bool mCreateInProgress; // True if a Session.Create has been sent for this session and no response has been received yet.
- bool mMediaConnectInProgress; // True if a Session.MediaConnect has been sent for this session and no response has been received yet.
- bool mVoiceInvitePending; // True if a voice invite is pending for this session (usually waiting on a name lookup)
- bool mTextInvitePending; // True if a text invite is pending for this session (usually waiting on a name lookup)
- bool mSynthesizedCallerID; // True if the caller ID is a hash of the SIP URI -- this means we shouldn't do a name lookup.
- bool mIsChannel; // True for both group and spatial channels (false for p2p, PSTN)
- bool mIsSpatial; // True for spatial channels
- bool mIsP2P;
- bool mIncoming;
- bool mVoiceActive;
- bool mReconnect; // Whether we should try to reconnect to this session if it's dropped
-
- // Set to true when the volume/mute state of someone in the participant list changes.
- // The code will have to walk the list to find the changed participant(s).
- bool mVolumeDirty;
- bool mMuteDirty;
-
- bool mParticipantsChanged;
- participantMap mParticipantsByURI;
- participantUUIDMap mParticipantsByUUID;
-
- LLUUID mVoiceFontID;
+ std::string mHandle;
+ std::string mGroupHandle;
+ std::string mSIPURI;
+ std::string mAlias;
+ std::string mName;
+ std::string mAlternateSIPURI;
+ std::string mHash; // Channel password
+ std::string mErrorStatusString;
+ std::queue<std::string> mTextMsgQueue;
+
+ LLUUID mIMSessionID;
+ LLUUID mCallerID;
+ int mErrorStatusCode;
+ int mMediaStreamState;
+ bool mCreateInProgress; // True if a Session.Create has been sent for this session and no response has been received yet.
+ bool mMediaConnectInProgress; // True if a Session.MediaConnect has been sent for this session and no response has been received yet.
+ bool mVoiceInvitePending; // True if a voice invite is pending for this session (usually waiting on a name lookup)
+ bool mTextInvitePending; // True if a text invite is pending for this session (usually waiting on a name lookup)
+ bool mSynthesizedCallerID; // True if the caller ID is a hash of the SIP URI -- this means we shouldn't do a name lookup.
+ bool mIsChannel; // True for both group and spatial channels (false for p2p, PSTN)
+ bool mIsSpatial; // True for spatial channels
+ bool mIsP2P;
+ bool mIncoming;
+ bool mVoiceActive;
+ bool mReconnect; // Whether we should try to reconnect to this session if it's dropped
+
+ // Set to true when the volume/mute state of someone in the participant list changes.
+ // The code will have to walk the list to find the changed participant(s).
+ bool mVolumeDirty;
+ bool mMuteDirty;
+
+ bool mParticipantsChanged;
+ participantMap mParticipantsByURI;
+ participantUUIDMap mParticipantsByUUID;
+
+ LLUUID mVoiceFontID;
static void VerifySessions();
@@ -380,247 +380,247 @@ protected:
static bool testBySIPOrAlterateURI(const LLVivoxVoiceClient::sessionState::wptr_t &a, std::string uri);
static bool testByCallerId(const LLVivoxVoiceClient::sessionState::wptr_t &a, LLUUID participantId);
- };
+ };
typedef std::shared_ptr<sessionState> sessionStatePtr_t;
typedef std::map<std::string, sessionStatePtr_t> sessionMap;
-
- ///////////////////////////////////////////////////////
- // Private Member Functions
- //////////////////////////////////////////////////////
-
-
-
- //////////////////////////////
- /// @name TVC/Server management and communication
- //@{
- // Call this if the connection to the daemon terminates unexpectedly. It will attempt to reset everything and relaunch.
- void daemonDied();
-
- // Call this if we're just giving up on voice (can't provision an account, etc.). It will clean up and go away.
- void giveUp();
-
- // write to the tvc
- bool writeString(const std::string &str);
-
- void connectorCreate();
- void connectorShutdown();
- void closeSocket(void);
-
-// void requestVoiceAccountProvision(S32 retries = 3);
- void setLoginInfo(
- const std::string& account_name,
- const std::string& password,
- const std::string& voice_sip_uri_hostname,
- const std::string& voice_account_server_uri);
- void loginSendMessage();
- void logout();
- void logoutSendMessage();
-
-
- //@}
-
- //------------------------------------
- // tuning
-
- void tuningRenderStartSendMessage(const std::string& name, bool loop);
- void tuningRenderStopSendMessage();
-
- void tuningCaptureStartSendMessage(int duration);
- void tuningCaptureStopSendMessage();
-
- //----------------------------------
- // devices
- void clearCaptureDevices();
- void addCaptureDevice(const LLVoiceDevice& device);
- void clearRenderDevices();
- void setDevicesListUpdated(bool state);
- void addRenderDevice(const LLVoiceDevice& device);
- void buildSetAudioDevices(std::ostringstream &stream);
-
- void getCaptureDevicesSendMessage();
- void getRenderDevicesSendMessage();
-
- // local audio updates, mic mute, speaker mute, mic volume and speaker volumes
- void sendLocalAudioUpdates();
-
- /////////////////////////////
- // Response/Event handlers
- void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID);
- void loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases);
- void sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
- void sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
- void sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString);
- void logoutResponse(int statusCode, std::string &statusString);
- void connectorShutdownResponse(int statusCode, std::string &statusString);
-
- void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state);
- void mediaCompletionEvent(std::string &sessionGroupHandle, std::string &mediaCompletionType);
- void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming);
- void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString);
- void sessionGroupAddedEvent(std::string &sessionGroupHandle);
- void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle);
- void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
- void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
- void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
- void voiceServiceConnectionStateChangedEvent(int statusCode, std::string &statusString, std::string &build_id);
- void auxAudioPropertiesEvent(F32 energy);
- void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
- void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
-
- void muteListChanged();
-
- /////////////////////////////
- // VAD changes
- // disable auto-VAD and configure VAD parameters explicitly
- void setupVADParams(unsigned int vad_auto, unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity);
- void onVADSettingsChange();
-
- /////////////////////////////
- // Sending updates of current state
- void updatePosition(void);
- void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
- void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLQuaternion &rot);
- bool channelFromRegion(LLViewerRegion *region, std::string &name);
-
- void setEarLocation(S32 loc);
-
-
- /////////////////////////////
- // Accessors for data related to nearby speakers
-
- // MBW -- XXX -- Not sure how to get this data out of the TVC
- BOOL getUsingPTT(const LLUUID& id);
- std::string getGroupID(const LLUUID& id); // group ID if the user is in group chat (empty string if not applicable)
-
- /////////////////////////////
- BOOL getAreaVoiceDisabled(); // returns true if the area the avatar is in is speech-disabled.
- // Use this to determine whether to show a "no speech" icon in the menu bar.
-
-
- /////////////////////////////
- // Recording controls
- void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
- void recordingLoopSave(const std::string& filename);
- void recordingStop();
-
- // Playback controls
- void filePlaybackStart(const std::string& filename);
- void filePlaybackStop();
- void filePlaybackSetPaused(bool paused);
- void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
-
+
+ ///////////////////////////////////////////////////////
+ // Private Member Functions
+ //////////////////////////////////////////////////////
+
+
+
+ //////////////////////////////
+ /// @name TVC/Server management and communication
+ //@{
+ // Call this if the connection to the daemon terminates unexpectedly. It will attempt to reset everything and relaunch.
+ void daemonDied();
+
+ // Call this if we're just giving up on voice (can't provision an account, etc.). It will clean up and go away.
+ void giveUp();
+
+ // write to the tvc
+ bool writeString(const std::string &str);
+
+ void connectorCreate();
+ void connectorShutdown();
+ void closeSocket(void);
+
+// void requestVoiceAccountProvision(S32 retries = 3);
+ void setLoginInfo(
+ const std::string& account_name,
+ const std::string& password,
+ const std::string& voice_sip_uri_hostname,
+ const std::string& voice_account_server_uri);
+ void loginSendMessage();
+ void logout();
+ void logoutSendMessage();
+
+
+ //@}
+
+ //------------------------------------
+ // tuning
+
+ void tuningRenderStartSendMessage(const std::string& name, bool loop);
+ void tuningRenderStopSendMessage();
+
+ void tuningCaptureStartSendMessage(int duration);
+ void tuningCaptureStopSendMessage();
+
+ //----------------------------------
+ // devices
+ void clearCaptureDevices();
+ void addCaptureDevice(const LLVoiceDevice& device);
+ void clearRenderDevices();
+ void setDevicesListUpdated(bool state);
+ void addRenderDevice(const LLVoiceDevice& device);
+ void buildSetAudioDevices(std::ostringstream &stream);
+
+ void getCaptureDevicesSendMessage();
+ void getRenderDevicesSendMessage();
+
+ // local audio updates, mic mute, speaker mute, mic volume and speaker volumes
+ void sendLocalAudioUpdates();
+
+ /////////////////////////////
+ // Response/Event handlers
+ void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID);
+ void loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases);
+ void sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+ void sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+ void sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString);
+ void logoutResponse(int statusCode, std::string &statusString);
+ void connectorShutdownResponse(int statusCode, std::string &statusString);
+
+ void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state);
+ void mediaCompletionEvent(std::string &sessionGroupHandle, std::string &mediaCompletionType);
+ void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming);
+ void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString);
+ void sessionGroupAddedEvent(std::string &sessionGroupHandle);
+ void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle);
+ void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
+ void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
+ void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
+ void voiceServiceConnectionStateChangedEvent(int statusCode, std::string &statusString, std::string &build_id);
+ void auxAudioPropertiesEvent(F32 energy);
+ void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
+ void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
+
+ void muteListChanged();
+
+ /////////////////////////////
+ // VAD changes
+ // disable auto-VAD and configure VAD parameters explicitly
+ void setupVADParams(unsigned int vad_auto, unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity);
+ void onVADSettingsChange();
+
+ /////////////////////////////
+ // Sending updates of current state
+ void updatePosition(void);
+ void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+ void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLQuaternion &rot);
+ bool channelFromRegion(LLViewerRegion *region, std::string &name);
+
+ void setEarLocation(S32 loc);
+
+
+ /////////////////////////////
+ // Accessors for data related to nearby speakers
+
+ // MBW -- XXX -- Not sure how to get this data out of the TVC
+ BOOL getUsingPTT(const LLUUID& id);
+ std::string getGroupID(const LLUUID& id); // group ID if the user is in group chat (empty string if not applicable)
+
+ /////////////////////////////
+ BOOL getAreaVoiceDisabled(); // returns true if the area the avatar is in is speech-disabled.
+ // Use this to determine whether to show a "no speech" icon in the menu bar.
+
+
+ /////////////////////////////
+ // Recording controls
+ void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
+ void recordingLoopSave(const std::string& filename);
+ void recordingStop();
+
+ // Playback controls
+ void filePlaybackStart(const std::string& filename);
+ void filePlaybackStop();
+ void filePlaybackSetPaused(bool paused);
+ void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
+
participantStatePtr_t findParticipantByID(const LLUUID& id);
-
+
#if 0
- ////////////////////////////////////////
- // voice sessions.
+ ////////////////////////////////////////
+ // voice sessions.
typedef std::set<sessionStatePtr_t> sessionSet;
-
- typedef sessionSet::iterator sessionIterator;
- sessionIterator sessionsBegin(void);
- sessionIterator sessionsEnd(void);
+
+ typedef sessionSet::iterator sessionIterator;
+ sessionIterator sessionsBegin(void);
+ sessionIterator sessionsEnd(void);
#endif
sessionStatePtr_t findSession(const std::string &handle);
sessionStatePtr_t findSessionBeingCreatedByURI(const std::string &uri);
sessionStatePtr_t findSession(const LLUUID &participant_id);
-
+
sessionStatePtr_t addSession(const std::string &uri, const std::string &handle = std::string());
void clearSessionHandle(const sessionStatePtr_t &session);
void setSessionHandle(const sessionStatePtr_t &session, const std::string &handle);
void setSessionURI(const sessionStatePtr_t &session, const std::string &uri);
void deleteSession(const sessionStatePtr_t &session);
- void deleteAllSessions(void);
+ void deleteAllSessions(void);
- void verifySessionState(void);
+ void verifySessionState(void);
void joinedAudioSession(const sessionStatePtr_t &session);
void leftAudioSession(const sessionStatePtr_t &session);
- // This is called in several places where the session _may_ need to be deleted.
- // It contains logic for whether to delete the session or keep it around.
+ // This is called in several places where the session _may_ need to be deleted.
+ // It contains logic for whether to delete the session or keep it around.
void reapSession(const sessionStatePtr_t &session);
-
- // Returns true if the session seems to indicate we've moved to a region on a different voice server
+
+ // Returns true if the session seems to indicate we've moved to a region on a different voice server
bool sessionNeedsRelog(const sessionStatePtr_t &session);
-
-
- //////////////////////////////////////
- // buddy list stuff, needed for SLIM later
- struct buddyListEntry
- {
- buddyListEntry(const std::string &uri);
- std::string mURI;
- std::string mDisplayName;
- LLUUID mUUID;
- bool mOnlineSL;
- bool mOnlineSLim;
- bool mCanSeeMeOnline;
- bool mHasBlockListEntry;
- bool mHasAutoAcceptListEntry;
- bool mNameResolved;
- bool mInSLFriends;
- bool mInVivoxBuddies;
- };
-
- typedef std::map<std::string, buddyListEntry*> buddyListMap;
-
- /////////////////////////////
- // session control messages
-
- void accountListBlockRulesSendMessage();
- void accountListAutoAcceptRulesSendMessage();
-
- void sessionGroupCreateSendMessage();
+
+
+ //////////////////////////////////////
+ // buddy list stuff, needed for SLIM later
+ struct buddyListEntry
+ {
+ buddyListEntry(const std::string &uri);
+ std::string mURI;
+ std::string mDisplayName;
+ LLUUID mUUID;
+ bool mOnlineSL;
+ bool mOnlineSLim;
+ bool mCanSeeMeOnline;
+ bool mHasBlockListEntry;
+ bool mHasAutoAcceptListEntry;
+ bool mNameResolved;
+ bool mInSLFriends;
+ bool mInVivoxBuddies;
+ };
+
+ typedef std::map<std::string, buddyListEntry*> buddyListMap;
+
+ /////////////////////////////
+ // session control messages
+
+ void accountListBlockRulesSendMessage();
+ void accountListAutoAcceptRulesSendMessage();
+
+ void sessionGroupCreateSendMessage();
void sessionCreateSendMessage(const sessionStatePtr_t &session, bool startAudio = true, bool startText = false);
void sessionGroupAddSessionSendMessage(const sessionStatePtr_t &session, bool startAudio = true, bool startText = false);
- void sessionMediaConnectSendMessage(const sessionStatePtr_t &session); // just joins the audio session
- void sessionTextConnectSendMessage(const sessionStatePtr_t &session); // just joins the text session
+ void sessionMediaConnectSendMessage(const sessionStatePtr_t &session); // just joins the audio session
+ void sessionTextConnectSendMessage(const sessionStatePtr_t &session); // just joins the text session
void sessionTerminateSendMessage(const sessionStatePtr_t &session);
void sessionGroupTerminateSendMessage(const sessionStatePtr_t &session);
void sessionMediaDisconnectSendMessage(const sessionStatePtr_t &session);
- // void sessionTextDisconnectSendMessage(sessionState *session);
-
-
-
- // Pokes the state machine to leave the audio session next time around.
- void sessionTerminate();
-
- // Pokes the state machine to shut down the connector and restart it.
- void requestRelog();
-
- // Does the actual work to get out of the audio session
- void leaveAudioSession();
-
- friend class LLVivoxVoiceClientCapResponder;
-
-
- void lookupName(const LLUUID &id);
- void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name);
- void avatarNameResolved(const LLUUID &id, const std::string &name);
+ // void sessionTextDisconnectSendMessage(sessionState *session);
+
+
+
+ // Pokes the state machine to leave the audio session next time around.
+ void sessionTerminate();
+
+ // Pokes the state machine to shut down the connector and restart it.
+ void requestRelog();
+
+ // Does the actual work to get out of the audio session
+ void leaveAudioSession();
+
+ friend class LLVivoxVoiceClientCapResponder;
+
+
+ void lookupName(const LLUUID &id);
+ void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name);
+ void avatarNameResolved(const LLUUID &id, const std::string &name);
static void predAvatarNameResolution(const LLVivoxVoiceClient::sessionStatePtr_t &session, LLUUID id, std::string name);
- boost::signals2::connection mAvatarNameCacheConnection;
+ boost::signals2::connection mAvatarNameCacheConnection;
- /////////////////////////////
- // Voice fonts
+ /////////////////////////////
+ // Voice fonts
- void addVoiceFont(const S32 id,
- const std::string &name,
- const std::string &description,
- const LLDate &expiration_date,
- bool has_expired,
- const S32 font_type,
- const S32 font_status,
- const bool template_font = false);
- void accountGetSessionFontsResponse(int statusCode, const std::string &statusString);
- void accountGetTemplateFontsResponse(int statusCode, const std::string &statusString);
+ void addVoiceFont(const S32 id,
+ const std::string &name,
+ const std::string &description,
+ const LLDate &expiration_date,
+ bool has_expired,
+ const S32 font_type,
+ const S32 font_status,
+ const bool template_font = false);
+ void accountGetSessionFontsResponse(int statusCode, const std::string &statusString);
+ void accountGetTemplateFontsResponse(int statusCode, const std::string &statusString);
private:
-
- LLVoiceVersionInfo mVoiceVersion;
+
+ LLVoiceVersionInfo mVoiceVersion;
// Coroutine support methods
//---
@@ -653,258 +653,258 @@ private:
bool performMicTuning();
//---
/// Clean up objects created during a voice session.
- void cleanUp();
-
- bool mSessionTerminateRequested;
- bool mRelogRequested;
- // Number of times (in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine().
- // The larger it is the greater is possibility there is a problem with connection to voice server.
- // Introduced while fixing EXT-4313.
- int mSpatialJoiningNum;
-
- static void idle(void *user_data);
-
- LLHost mDaemonHost;
- LLSocket::ptr_t mSocket;
-
- // We should kill the voice daemon in case of connection alert
- bool mTerminateDaemon;
-
- friend class LLVivoxProtocolParser;
-
- std::string mAccountName;
- std::string mAccountPassword;
- std::string mAccountDisplayName;
-
- bool mTuningMode;
- float mTuningEnergy;
- std::string mTuningAudioFile;
- int mTuningMicVolume;
- bool mTuningMicVolumeDirty;
- int mTuningSpeakerVolume;
- bool mTuningSpeakerVolumeDirty;
- bool mDevicesListUpdated; // set to true when the device list has been updated
- // and false when the panelvoicedevicesettings has queried for an update status.
-
- std::string mSpatialSessionURI;
- std::string mSpatialSessionCredentials;
-
- std::string mMainSessionGroupHandle; // handle of the "main" session group.
-
- std::string mChannelName; // Name of the channel to be looked up
- bool mAreaVoiceDisabled;
- sessionStatePtr_t mAudioSession; // Session state for the current audio session
- bool mAudioSessionChanged; // set to true when the above pointer gets changed, so observers can be notified.
-
- sessionStatePtr_t mNextAudioSession; // Session state for the audio session we're trying to join
-
- S32 mCurrentParcelLocalID; // Used to detect parcel boundary crossings
- std::string mCurrentRegionName; // Used to detect parcel boundary crossings
-
+ void cleanUp();
+
+ bool mSessionTerminateRequested;
+ bool mRelogRequested;
+ // Number of times (in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine().
+ // The larger it is the greater is possibility there is a problem with connection to voice server.
+ // Introduced while fixing EXT-4313.
+ int mSpatialJoiningNum;
+
+ static void idle(void *user_data);
+
+ LLHost mDaemonHost;
+ LLSocket::ptr_t mSocket;
+
+ // We should kill the voice daemon in case of connection alert
+ bool mTerminateDaemon;
+
+ friend class LLVivoxProtocolParser;
+
+ std::string mAccountName;
+ std::string mAccountPassword;
+ std::string mAccountDisplayName;
+
+ bool mTuningMode;
+ float mTuningEnergy;
+ std::string mTuningAudioFile;
+ int mTuningMicVolume;
+ bool mTuningMicVolumeDirty;
+ int mTuningSpeakerVolume;
+ bool mTuningSpeakerVolumeDirty;
+ bool mDevicesListUpdated; // set to true when the device list has been updated
+ // and false when the panelvoicedevicesettings has queried for an update status.
+
+ std::string mSpatialSessionURI;
+ std::string mSpatialSessionCredentials;
+
+ std::string mMainSessionGroupHandle; // handle of the "main" session group.
+
+ std::string mChannelName; // Name of the channel to be looked up
+ bool mAreaVoiceDisabled;
+ sessionStatePtr_t mAudioSession; // Session state for the current audio session
+ bool mAudioSessionChanged; // set to true when the above pointer gets changed, so observers can be notified.
+
+ sessionStatePtr_t mNextAudioSession; // Session state for the audio session we're trying to join
+
+ S32 mCurrentParcelLocalID; // Used to detect parcel boundary crossings
+ std::string mCurrentRegionName; // Used to detect parcel boundary crossings
+
bool mConnectorEstablished; // set by "Create Connector" response
- bool mAccountLoggedIn; // set by login message
- int mNumberOfAliases;
- U32 mCommandCookie;
-
- std::string mVoiceAccountServerURI;
- std::string mVoiceSIPURIHostName;
-
- int mLoginRetryCount;
-
- sessionMap mSessionsByHandle; // Active sessions, indexed by session handle. Sessions which are being initiated may not be in this map.
+ bool mAccountLoggedIn; // set by login message
+ int mNumberOfAliases;
+ U32 mCommandCookie;
+
+ std::string mVoiceAccountServerURI;
+ std::string mVoiceSIPURIHostName;
+
+ int mLoginRetryCount;
+
+ sessionMap mSessionsByHandle; // Active sessions, indexed by session handle. Sessions which are being initiated may not be in this map.
#if 0
- sessionSet mSessions; // All sessions, not indexed. This is the canonical session list.
+ sessionSet mSessions; // All sessions, not indexed. This is the canonical session list.
#endif
-
- bool mBuddyListMapPopulated;
- bool mBlockRulesListReceived;
- bool mAutoAcceptRulesListReceived;
- buddyListMap mBuddyListMap;
-
- LLVoiceDeviceList mCaptureDevices;
- LLVoiceDeviceList mRenderDevices;
-
- std::string mCaptureDevice;
- std::string mRenderDevice;
- bool mCaptureDeviceDirty;
- bool mRenderDeviceDirty;
-
- bool mIsInitialized;
- bool mShutdownComplete;
-
- bool checkParcelChanged(bool update = false);
- bool switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
+
+ bool mBuddyListMapPopulated;
+ bool mBlockRulesListReceived;
+ bool mAutoAcceptRulesListReceived;
+ buddyListMap mBuddyListMap;
+
+ LLVoiceDeviceList mCaptureDevices;
+ LLVoiceDeviceList mRenderDevices;
+
+ std::string mCaptureDevice;
+ std::string mRenderDevice;
+ bool mCaptureDeviceDirty;
+ bool mRenderDeviceDirty;
+
+ bool mIsInitialized;
+ bool mShutdownComplete;
+
+ bool checkParcelChanged(bool update = false);
+ bool switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
void joinSession(const sessionStatePtr_t &session);
-
- std::string nameFromAvatar(LLVOAvatar *avatar);
- std::string nameFromID(const LLUUID &id);
- bool IDFromName(const std::string name, LLUUID &uuid);
- std::string displayNameFromAvatar(LLVOAvatar *avatar);
- std::string sipURIFromAvatar(LLVOAvatar *avatar);
- std::string sipURIFromName(std::string &name);
-
- // Returns the name portion of the SIP URI if the string looks vaguely like a SIP URI, or an empty string if not.
- std::string nameFromsipURI(const std::string &uri);
-
- bool inSpatialChannel(void);
- std::string getAudioSessionURI();
- std::string getAudioSessionHandle();
-
+
+ std::string nameFromAvatar(LLVOAvatar *avatar);
+ std::string nameFromID(const LLUUID &id);
+ bool IDFromName(const std::string name, LLUUID &uuid);
+ std::string displayNameFromAvatar(LLVOAvatar *avatar);
+ std::string sipURIFromAvatar(LLVOAvatar *avatar);
+ std::string sipURIFromName(std::string &name);
+
+ // Returns the name portion of the SIP URI if the string looks vaguely like a SIP URI, or an empty string if not.
+ std::string nameFromsipURI(const std::string &uri);
+
+ bool inSpatialChannel(void);
+ std::string getAudioSessionURI();
+ std::string getAudioSessionHandle();
+
void setHidden(bool hidden) override; //virtual
- void sendPositionAndVolumeUpdate(void);
-
+ void sendPositionAndVolumeUpdate(void);
+
void sendCaptureAndRenderDevices();
void buildSetCaptureDevice(std::ostringstream &stream);
- void buildSetRenderDevice(std::ostringstream &stream);
-
+ void buildSetRenderDevice(std::ostringstream &stream);
- void sendFriendsListUpdates();
+
+ void sendFriendsListUpdates();
#if 0
- // start a text IM session with the specified user
- // This will be asynchronous, the session may be established at a future time.
+ // start a text IM session with the specified user
+ // This will be asynchronous, the session may be established at a future time.
sessionStatePtr_t startUserIMSession(const LLUUID& uuid);
#endif
- void enforceTether(void);
-
- bool mSpatialCoordsDirty;
-
- LLVector3d mCameraPosition;
- LLVector3d mCameraRequestedPosition;
- LLVector3 mCameraVelocity;
- LLMatrix3 mCameraRot;
-
- LLVector3d mAvatarPosition;
- LLVector3 mAvatarVelocity;
- LLQuaternion mAvatarRot;
-
- bool mMuteMic;
- bool mMuteMicDirty;
+ void enforceTether(void);
+
+ bool mSpatialCoordsDirty;
+
+ LLVector3d mCameraPosition;
+ LLVector3d mCameraRequestedPosition;
+ LLVector3 mCameraVelocity;
+ LLMatrix3 mCameraRot;
+
+ LLVector3d mAvatarPosition;
+ LLVector3 mAvatarVelocity;
+ LLQuaternion mAvatarRot;
+
+ bool mMuteMic;
+ bool mMuteMicDirty;
bool mHidden; //Set to true during teleport to hide the agent's position.
-
- // Set to true when the friends list is known to have changed.
- bool mFriendsListDirty;
-
- enum
- {
- earLocCamera = 0, // ear at camera
- earLocAvatar, // ear at avatar
- earLocMixed // ear at avatar location/camera direction
- };
-
- S32 mEarLocation;
-
- bool mSpeakerVolumeDirty;
- bool mSpeakerMuteDirty;
- int mSpeakerVolume;
-
- int mMicVolume;
- bool mMicVolumeDirty;
-
- bool mVoiceEnabled;
- bool mWriteInProgress;
- std::string mWriteString;
- size_t mWriteOffset;
-
- BOOL mLipSyncEnabled;
-
- typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
- observer_set_t mParticipantObservers;
-
- void notifyParticipantObservers();
-
- typedef std::set<LLVoiceClientStatusObserver*> status_observer_set_t;
- status_observer_set_t mStatusObservers;
-
- void notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status);
-
- typedef std::set<LLFriendObserver*> friend_observer_set_t;
- friend_observer_set_t mFriendObservers;
- void notifyFriendObservers();
-
- // Voice Fonts
-
- void expireVoiceFonts();
- void deleteVoiceFont(const LLUUID& id);
- void deleteAllVoiceFonts();
- void deleteVoiceFontTemplates();
-
- S32 getVoiceFontIndex(const LLUUID& id) const;
- S32 getVoiceFontTemplateIndex(const LLUUID& id) const;
-
- void accountGetSessionFontsSendMessage();
- void accountGetTemplateFontsSendMessage();
+
+ // Set to true when the friends list is known to have changed.
+ bool mFriendsListDirty;
+
+ enum
+ {
+ earLocCamera = 0, // ear at camera
+ earLocAvatar, // ear at avatar
+ earLocMixed // ear at avatar location/camera direction
+ };
+
+ S32 mEarLocation;
+
+ bool mSpeakerVolumeDirty;
+ bool mSpeakerMuteDirty;
+ int mSpeakerVolume;
+
+ int mMicVolume;
+ bool mMicVolumeDirty;
+
+ bool mVoiceEnabled;
+ bool mWriteInProgress;
+ std::string mWriteString;
+ size_t mWriteOffset;
+
+ BOOL mLipSyncEnabled;
+
+ typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
+ observer_set_t mParticipantObservers;
+
+ void notifyParticipantObservers();
+
+ typedef std::set<LLVoiceClientStatusObserver*> status_observer_set_t;
+ status_observer_set_t mStatusObservers;
+
+ void notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status);
+
+ typedef std::set<LLFriendObserver*> friend_observer_set_t;
+ friend_observer_set_t mFriendObservers;
+ void notifyFriendObservers();
+
+ // Voice Fonts
+
+ void expireVoiceFonts();
+ void deleteVoiceFont(const LLUUID& id);
+ void deleteAllVoiceFonts();
+ void deleteVoiceFontTemplates();
+
+ S32 getVoiceFontIndex(const LLUUID& id) const;
+ S32 getVoiceFontTemplateIndex(const LLUUID& id) const;
+
+ void accountGetSessionFontsSendMessage();
+ void accountGetTemplateFontsSendMessage();
void sessionSetVoiceFontSendMessage(const sessionStatePtr_t &session);
- void updateVoiceMorphingMenu();
- void notifyVoiceFontObservers();
-
- typedef enum e_voice_font_type
- {
- VOICE_FONT_TYPE_NONE = 0,
- VOICE_FONT_TYPE_ROOT = 1,
- VOICE_FONT_TYPE_USER = 2,
- VOICE_FONT_TYPE_UNKNOWN
- } EVoiceFontType;
-
- typedef enum e_voice_font_status
- {
- VOICE_FONT_STATUS_NONE = 0,
- VOICE_FONT_STATUS_FREE = 1,
- VOICE_FONT_STATUS_NOT_FREE = 2,
- VOICE_FONT_STATUS_UNKNOWN
- } EVoiceFontStatus;
-
- struct voiceFontEntry
- {
- voiceFontEntry(LLUUID& id);
- ~voiceFontEntry();
-
- LLUUID mID;
- S32 mFontIndex;
- std::string mName;
- LLDate mExpirationDate;
- S32 mFontType;
- S32 mFontStatus;
- bool mIsNew;
-
- LLFrameTimer mExpiryTimer;
- LLFrameTimer mExpiryWarningTimer;
- };
-
- bool mVoiceFontsReceived;
- bool mVoiceFontsNew;
- bool mVoiceFontListDirty;
- voice_effect_list_t mVoiceFontList;
- voice_effect_list_t mVoiceFontTemplateList;
-
- typedef std::map<const LLUUID, voiceFontEntry*> voice_font_map_t;
- voice_font_map_t mVoiceFontMap;
- voice_font_map_t mVoiceFontTemplateMap;
-
- typedef std::set<LLVoiceEffectObserver*> voice_font_observer_set_t;
- voice_font_observer_set_t mVoiceFontObservers;
-
- LLFrameTimer mVoiceFontExpiryTimer;
-
-
- // Audio capture buffer
-
- void captureBufferRecordStartSendMessage();
- void captureBufferRecordStopSendMessage();
- void captureBufferPlayStartSendMessage(const LLUUID& voice_font_id = LLUUID::null);
- void captureBufferPlayStopSendMessage();
-
- bool mCaptureBufferMode; // Disconnected from voice channels while using the capture buffer.
- bool mCaptureBufferRecording; // A voice sample is being captured.
- bool mCaptureBufferRecorded; // A voice sample is captured in the buffer ready to play.
- bool mCaptureBufferPlaying; // A voice sample is being played.
-
- LLTimer mCaptureTimer;
- LLUUID mPreviewVoiceFont;
- LLUUID mPreviewVoiceFontLast;
- S32 mPlayRequestCount;
+ void updateVoiceMorphingMenu();
+ void notifyVoiceFontObservers();
+
+ typedef enum e_voice_font_type
+ {
+ VOICE_FONT_TYPE_NONE = 0,
+ VOICE_FONT_TYPE_ROOT = 1,
+ VOICE_FONT_TYPE_USER = 2,
+ VOICE_FONT_TYPE_UNKNOWN
+ } EVoiceFontType;
+
+ typedef enum e_voice_font_status
+ {
+ VOICE_FONT_STATUS_NONE = 0,
+ VOICE_FONT_STATUS_FREE = 1,
+ VOICE_FONT_STATUS_NOT_FREE = 2,
+ VOICE_FONT_STATUS_UNKNOWN
+ } EVoiceFontStatus;
+
+ struct voiceFontEntry
+ {
+ voiceFontEntry(LLUUID& id);
+ ~voiceFontEntry();
+
+ LLUUID mID;
+ S32 mFontIndex;
+ std::string mName;
+ LLDate mExpirationDate;
+ S32 mFontType;
+ S32 mFontStatus;
+ bool mIsNew;
+
+ LLFrameTimer mExpiryTimer;
+ LLFrameTimer mExpiryWarningTimer;
+ };
+
+ bool mVoiceFontsReceived;
+ bool mVoiceFontsNew;
+ bool mVoiceFontListDirty;
+ voice_effect_list_t mVoiceFontList;
+ voice_effect_list_t mVoiceFontTemplateList;
+
+ typedef std::map<const LLUUID, voiceFontEntry*> voice_font_map_t;
+ voice_font_map_t mVoiceFontMap;
+ voice_font_map_t mVoiceFontTemplateMap;
+
+ typedef std::set<LLVoiceEffectObserver*> voice_font_observer_set_t;
+ voice_font_observer_set_t mVoiceFontObservers;
+
+ LLFrameTimer mVoiceFontExpiryTimer;
+
+
+ // Audio capture buffer
+
+ void captureBufferRecordStartSendMessage();
+ void captureBufferRecordStopSendMessage();
+ void captureBufferPlayStartSendMessage(const LLUUID& voice_font_id = LLUUID::null);
+ void captureBufferPlayStopSendMessage();
+
+ bool mCaptureBufferMode; // Disconnected from voice channels while using the capture buffer.
+ bool mCaptureBufferRecording; // A voice sample is being captured.
+ bool mCaptureBufferRecorded; // A voice sample is captured in the buffer ready to play.
+ bool mCaptureBufferPlaying; // A voice sample is being played.
+
+ LLTimer mCaptureTimer;
+ LLUUID mPreviewVoiceFont;
+ LLUUID mPreviewVoiceFontLast;
+ S32 mPlayRequestCount;
bool mIsInTuningMode;
bool mIsInChannel;
bool mIsJoiningSession;
@@ -923,7 +923,7 @@ private:
};
-/**
+/**
* @class LLVivoxProtocolParser
* @brief This class helps construct new LLIOPipe specializations
* @see LLIOPipe
@@ -932,109 +932,109 @@ private:
*/
class LLVivoxProtocolParser : public LLIOPipe
{
- LOG_CLASS(LLVivoxProtocolParser);
+ LOG_CLASS(LLVivoxProtocolParser);
public:
- LLVivoxProtocolParser();
- virtual ~LLVivoxProtocolParser();
-
+ LLVivoxProtocolParser();
+ virtual ~LLVivoxProtocolParser();
+
protected:
- /* @name LLIOPipe virtual implementations
- */
- //@{
- /**
- * @brief Process the data in buffer
- */
- virtual EStatus process_impl(
- const LLChannelDescriptors& channels,
- buffer_ptr_t& buffer,
- bool& eos,
- LLSD& context,
- LLPumpIO* pump);
- //@}
-
- std::string mInput;
-
- // Expat control members
- XML_Parser parser;
- int responseDepth;
- bool ignoringTags;
- bool isEvent;
- int ignoreDepth;
-
- // Members for processing responses. The values are transient and only valid within a call to processResponse().
- int returnCode;
- int statusCode;
- std::string statusString;
- std::string requestId;
- std::string actionString;
- std::string connectorHandle;
- std::string versionID;
- std::string mBuildID;
- std::string accountHandle;
- std::string sessionHandle;
- std::string sessionGroupHandle;
- std::string alias;
- std::string applicationString;
-
- // Members for processing events. The values are transient and only valid within a call to processResponse().
- std::string eventTypeString;
- int state;
- std::string uriString;
- bool isChannel;
- bool incoming;
- bool enabled;
- std::string nameString;
- std::string audioMediaString;
- std::string deviceString;
- std::string displayNameString;
- int participantType;
- bool isLocallyMuted;
- bool isModeratorMuted;
- bool isSpeaking;
- int volume;
- F32 energy;
- std::string messageHeader;
- std::string messageBody;
- std::string notificationType;
- bool hasText;
- bool hasAudio;
- bool hasVideo;
- bool terminated;
- std::string blockMask;
- std::string presenceOnly;
- std::string autoAcceptMask;
- std::string autoAddAsBuddy;
- int numberOfAliases;
- std::string subscriptionHandle;
- std::string subscriptionType;
- S32 id;
- std::string descriptionString;
- LLDate expirationDate;
- bool hasExpired;
- S32 fontType;
- S32 fontStatus;
- std::string mediaCompletionType;
-
- // Members for processing text between tags
- std::string textBuffer;
- bool accumulateText;
-
- void reset();
-
- void processResponse(std::string tag);
-
- static void XMLCALL ExpatStartTag(void *data, const char *el, const char **attr);
- static void XMLCALL ExpatEndTag(void *data, const char *el);
- static void XMLCALL ExpatCharHandler(void *data, const XML_Char *s, int len);
-
- void StartTag(const char *tag, const char **attr);
- void EndTag(const char *tag);
- void CharData(const char *buffer, int length);
- LLDate expiryTimeStampToLLDate(const std::string& vivox_ts);
+ /* @name LLIOPipe virtual implementations
+ */
+ //@{
+ /**
+ * @brief Process the data in buffer
+ */
+ virtual EStatus process_impl(
+ const LLChannelDescriptors& channels,
+ buffer_ptr_t& buffer,
+ bool& eos,
+ LLSD& context,
+ LLPumpIO* pump);
+ //@}
+
+ std::string mInput;
+
+ // Expat control members
+ XML_Parser parser;
+ int responseDepth;
+ bool ignoringTags;
+ bool isEvent;
+ int ignoreDepth;
+
+ // Members for processing responses. The values are transient and only valid within a call to processResponse().
+ int returnCode;
+ int statusCode;
+ std::string statusString;
+ std::string requestId;
+ std::string actionString;
+ std::string connectorHandle;
+ std::string versionID;
+ std::string mBuildID;
+ std::string accountHandle;
+ std::string sessionHandle;
+ std::string sessionGroupHandle;
+ std::string alias;
+ std::string applicationString;
+
+ // Members for processing events. The values are transient and only valid within a call to processResponse().
+ std::string eventTypeString;
+ int state;
+ std::string uriString;
+ bool isChannel;
+ bool incoming;
+ bool enabled;
+ std::string nameString;
+ std::string audioMediaString;
+ std::string deviceString;
+ std::string displayNameString;
+ int participantType;
+ bool isLocallyMuted;
+ bool isModeratorMuted;
+ bool isSpeaking;
+ int volume;
+ F32 energy;
+ std::string messageHeader;
+ std::string messageBody;
+ std::string notificationType;
+ bool hasText;
+ bool hasAudio;
+ bool hasVideo;
+ bool terminated;
+ std::string blockMask;
+ std::string presenceOnly;
+ std::string autoAcceptMask;
+ std::string autoAddAsBuddy;
+ int numberOfAliases;
+ std::string subscriptionHandle;
+ std::string subscriptionType;
+ S32 id;
+ std::string descriptionString;
+ LLDate expirationDate;
+ bool hasExpired;
+ S32 fontType;
+ S32 fontStatus;
+ std::string mediaCompletionType;
+
+ // Members for processing text between tags
+ std::string textBuffer;
+ bool accumulateText;
+
+ void reset();
+
+ void processResponse(std::string tag);
+
+ static void XMLCALL ExpatStartTag(void *data, const char *el, const char **attr);
+ static void XMLCALL ExpatEndTag(void *data, const char *el);
+ static void XMLCALL ExpatCharHandler(void *data, const XML_Char *s, int len);
+
+ void StartTag(const char *tag, const char **attr);
+ void EndTag(const char *tag);
+ void CharData(const char *buffer, int length);
+ LLDate expiryTimeStampToLLDate(const std::string& vivox_ts);
};
-class LLVivoxSecurity : public LLSingleton<LLVivoxSecurity>
+class LLVivoxSecurity : public LLSingleton<LLVivoxSecurity>
{
LLSINGLETON(LLVivoxSecurity);
virtual ~LLVivoxSecurity();
@@ -1053,7 +1053,7 @@ class LLVoiceVivoxStats : public LLSingleton<LLVoiceVivoxStats>
LLSINGLETON(LLVoiceVivoxStats);
LOG_CLASS(LLVoiceVivoxStats);
virtual ~LLVoiceVivoxStats();
-
+
private:
F64SecondsImplicit mStartTime;
@@ -1061,7 +1061,7 @@ class LLVoiceVivoxStats : public LLSingleton<LLVoiceVivoxStats>
F64 mConnectTime;
U32 mConnectAttempts;
-
+
F64 mProvisionTime;
U32 mProvisionAttempts;
diff --git a/indra/newview/llvoinventorylistener.cpp b/indra/newview/llvoinventorylistener.cpp
index 1ea90c6a98..7ebbbd9f6f 100644
--- a/indra/newview/llvoinventorylistener.cpp
+++ b/indra/newview/llvoinventorylistener.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvoinventorylistener.cpp
* @brief Interface for classes that wish to receive updates about viewer object inventory
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,33 +31,33 @@
void LLVOInventoryListener::removeVOInventoryListener()
{
- if (mListenerVObject)
- {
- mListenerVObject->removeInventoryListener(this);
- mListenerVObject = NULL;
- }
+ if (mListenerVObject)
+ {
+ mListenerVObject->removeInventoryListener(this);
+ mListenerVObject = NULL;
+ }
}
void LLVOInventoryListener::registerVOInventoryListener(LLViewerObject* object, void* user_data)
{
- removeVOInventoryListener();
- if (object != NULL)
- {
- mListenerVObject = object;
- object->registerInventoryListener(this,user_data);
- }
+ removeVOInventoryListener();
+ if (object != NULL)
+ {
+ mListenerVObject = object;
+ object->registerInventoryListener(this,user_data);
+ }
}
void LLVOInventoryListener::requestVOInventory()
{
- if (mListenerVObject)
- {
- mListenerVObject->requestInventory();
- }
+ if (mListenerVObject)
+ {
+ mListenerVObject->requestInventory();
+ }
}
// This assumes mListenerVObject is clearing it's own lists
void LLVOInventoryListener::clearVOInventoryListener()
{
- mListenerVObject = NULL;
+ mListenerVObject = NULL;
}
diff --git a/indra/newview/llvoinventorylistener.h b/indra/newview/llvoinventorylistener.h
index c50c475478..3686aa25cf 100644
--- a/indra/newview/llvoinventorylistener.h
+++ b/indra/newview/llvoinventorylistener.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvoinventorylistener.h
* @brief Interface for classes that wish to receive updates about viewer object inventory
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,31 +37,31 @@ class LLViewerObject;
class LLVOInventoryListener
{
public:
- virtual void inventoryChanged(LLViewerObject* object,
- LLInventoryObject::object_list_t* inventory,
- S32 serial_num,
- void* user_data) = 0;
+ virtual void inventoryChanged(LLViewerObject* object,
+ LLInventoryObject::object_list_t* inventory,
+ S32 serial_num,
+ void* user_data) = 0;
- // Remove the listener from the object and clear this listener
- void removeVOInventoryListener();
+ // Remove the listener from the object and clear this listener
+ void removeVOInventoryListener();
- // Just clear this listener, don't worry about the object.
- void clearVOInventoryListener();
+ // Just clear this listener, don't worry about the object.
+ void clearVOInventoryListener();
protected:
- LLVOInventoryListener() : mListenerVObject(NULL) { }
- virtual ~LLVOInventoryListener() { removeVOInventoryListener(); }
+ LLVOInventoryListener() : mListenerVObject(NULL) { }
+ virtual ~LLVOInventoryListener() { removeVOInventoryListener(); }
- void registerVOInventoryListener(LLViewerObject* object, void* user_data);
- void requestVOInventory();
+ void registerVOInventoryListener(LLViewerObject* object, void* user_data);
+ void requestVOInventory();
private:
- // LLViewerObject is normally wrapped by an LLPointer, but not in
- // this case, because it's already sure to be kept alive by
- // LLPointers held by other objects that have longer lifetimes
- // than this one. Plumbing correct LLPointer usage all the way
- // down here has been deemed too much work for now.
- LLViewerObject *mListenerVObject;
+ // LLViewerObject is normally wrapped by an LLPointer, but not in
+ // this case, because it's already sure to be kept alive by
+ // LLPointers held by other objects that have longer lifetimes
+ // than this one. Plumbing correct LLPointer usage all the way
+ // down here has been deemed too much work for now.
+ LLViewerObject *mListenerVObject;
};
#endif
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index 99874b8185..d8d7cab6eb 100644
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvopartgroup.cpp
* @brief Group of particle systems
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,61 +54,61 @@ void LLVOPartGroup::initClass()
void LLVOPartGroup::restoreGL()
{
- //TODO: optimize out binormal mask here. Specular and normal coords as well.
+ //TODO: optimize out binormal mask here. Specular and normal coords as well.
#if 0
- sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2);
- U32 count = LL_MAX_PARTICLE_COUNT;
- if (!sVB->allocateBuffer(count*4, count*6))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer to "
- << count*4 << " vertices and "
- << count * 6 << " indices" << LL_ENDL;
- // we are likelly to crash at following getTexCoord0Strider(), so unref and return
- sVB = NULL;
- return;
- }
-
- //indices and texcoords are always the same, set once
- LLStrider<U16> indicesp;
-
- LLStrider<LLVector4a> verticesp;
-
- sVB->getIndexStrider(indicesp);
- sVB->getVertexStrider(verticesp);
-
- LLVector4a v;
- v.set(0,0,0,0);
-
-
- U16 vert_offset = 0;
-
- for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
- {
- *indicesp++ = vert_offset + 0;
- *indicesp++ = vert_offset + 1;
- *indicesp++ = vert_offset + 2;
-
- *indicesp++ = vert_offset + 1;
- *indicesp++ = vert_offset + 3;
- *indicesp++ = vert_offset + 2;
-
- *verticesp++ = v;
-
- vert_offset += 4;
- }
-
- LLStrider<LLVector2> texcoordsp;
- sVB->getTexCoord0Strider(texcoordsp);
-
- for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
- {
- *texcoordsp++ = LLVector2(0.f, 1.f);
- *texcoordsp++ = LLVector2(0.f, 0.f);
- *texcoordsp++ = LLVector2(1.f, 1.f);
- *texcoordsp++ = LLVector2(1.f, 0.f);
- }
-
- sVB->unmapBuffer();
+ sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2);
+ U32 count = LL_MAX_PARTICLE_COUNT;
+ if (!sVB->allocateBuffer(count*4, count*6))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer to "
+ << count*4 << " vertices and "
+ << count * 6 << " indices" << LL_ENDL;
+ // we are likelly to crash at following getTexCoord0Strider(), so unref and return
+ sVB = NULL;
+ return;
+ }
+
+ //indices and texcoords are always the same, set once
+ LLStrider<U16> indicesp;
+
+ LLStrider<LLVector4a> verticesp;
+
+ sVB->getIndexStrider(indicesp);
+ sVB->getVertexStrider(verticesp);
+
+ LLVector4a v;
+ v.set(0,0,0,0);
+
+
+ U16 vert_offset = 0;
+
+ for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
+ {
+ *indicesp++ = vert_offset + 0;
+ *indicesp++ = vert_offset + 1;
+ *indicesp++ = vert_offset + 2;
+
+ *indicesp++ = vert_offset + 1;
+ *indicesp++ = vert_offset + 3;
+ *indicesp++ = vert_offset + 2;
+
+ *verticesp++ = v;
+
+ vert_offset += 4;
+ }
+
+ LLStrider<LLVector2> texcoordsp;
+ sVB->getTexCoord0Strider(texcoordsp);
+
+ for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
+ {
+ *texcoordsp++ = LLVector2(0.f, 1.f);
+ *texcoordsp++ = LLVector2(0.f, 0.f);
+ *texcoordsp++ = LLVector2(1.f, 1.f);
+ *texcoordsp++ = LLVector2(1.f, 0.f);
+ }
+
+ sVB->unmapBuffer();
#endif
}
@@ -120,26 +120,26 @@ void LLVOPartGroup::destroyGL()
bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end)
{
- /*while (start < end)
- {
- if (*start == idx)
- { //not allocated (in free list)
- return false;
- }
- ++start;
- }*/
-
- //allocated (not in free list)
- return false;
+ /*while (start < end)
+ {
+ if (*start == idx)
+ { //not allocated (in free list)
+ return false;
+ }
+ ++start;
+ }*/
+
+ //allocated (not in free list)
+ return false;
}
LLVOPartGroup::LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
- : LLAlphaObject(id, pcode, regionp),
- mViewerPartGroupp(NULL)
+ : LLAlphaObject(id, pcode, regionp),
+ mViewerPartGroupp(NULL)
{
- setNumTEs(1);
- setTETexture(0, LLUUID::null);
- mbCanSelect = FALSE; // users can't select particle systems
+ setNumTEs(1);
+ setTETexture(0, LLUUID::null);
+ mbCanSelect = FALSE; // users can't select particle systems
}
@@ -149,33 +149,33 @@ LLVOPartGroup::~LLVOPartGroup()
BOOL LLVOPartGroup::isActive() const
{
- return FALSE;
+ return FALSE;
}
F32 LLVOPartGroup::getBinRadius()
-{
- return mViewerPartGroupp->getBoxSide();
+{
+ return mViewerPartGroupp->getBoxSide();
}
void LLVOPartGroup::updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
-{
- const LLVector3& pos_agent = getPositionAgent();
+{
+ const LLVector3& pos_agent = getPositionAgent();
- LLVector4a scale;
- LLVector4a p;
+ LLVector4a scale;
+ LLVector4a p;
- p.load3(pos_agent.mV);
+ p.load3(pos_agent.mV);
- scale.splat(mScale.mV[0]+mViewerPartGroupp->getBoxSide()*0.5f);
+ scale.splat(mScale.mV[0]+mViewerPartGroupp->getBoxSide()*0.5f);
- newMin.setSub(p, scale);
- newMax.setAdd(p,scale);
+ newMin.setSub(p, scale);
+ newMax.setAdd(p,scale);
- llassert(newMin.isFinite3());
- llassert(newMax.isFinite3());
+ llassert(newMin.isFinite3());
+ llassert(newMax.isFinite3());
- llassert(p.isFinite3());
- mDrawable->setPositionGroup(p);
+ llassert(p.isFinite3());
+ mDrawable->setPositionGroup(p);
}
void LLVOPartGroup::idleUpdate(LLAgent &agent, const F64 &time)
@@ -184,538 +184,538 @@ void LLVOPartGroup::idleUpdate(LLAgent &agent, const F64 &time)
void LLVOPartGroup::setPixelAreaAndAngle(LLAgent &agent)
{
- // mPixelArea is calculated during render
- F32 mid_scale = getMidScale();
- F32 range = (getRenderPosition()-LLViewerCamera::getInstance()->getOrigin()).length();
-
- if (range < 0.001f || isHUDAttachment()) // range == zero
- {
- mAppAngle = 180.f;
- }
- else
- {
- mAppAngle = (F32) atan2( mid_scale, range) * RAD_TO_DEG;
- }
+ // mPixelArea is calculated during render
+ F32 mid_scale = getMidScale();
+ F32 range = (getRenderPosition()-LLViewerCamera::getInstance()->getOrigin()).length();
+
+ if (range < 0.001f || isHUDAttachment()) // range == zero
+ {
+ mAppAngle = 180.f;
+ }
+ else
+ {
+ mAppAngle = (F32) atan2( mid_scale, range) * RAD_TO_DEG;
+ }
}
void LLVOPartGroup::updateTextures()
{
- // Texture stats for particles need to be updated in a different way...
+ // Texture stats for particles need to be updated in a different way...
}
LLDrawable* LLVOPartGroup::createDrawable(LLPipeline *pipeline)
{
- pipeline->allocDrawable(this);
- mDrawable->setLit(FALSE);
- mDrawable->setRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
- return mDrawable;
+ pipeline->allocDrawable(this);
+ mDrawable->setLit(FALSE);
+ mDrawable->setRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
+ return mDrawable;
}
const F32 MAX_PARTICLE_AREA_SCALE = 0.02f; // some tuned constant, limits on how much particle area to draw
LLUUID LLVOPartGroup::getPartOwner(S32 idx)
{
- LLUUID ret = LLUUID::null;
+ LLUUID ret = LLUUID::null;
- if (idx < (S32) mViewerPartGroupp->mParticles.size())
- {
- ret = mViewerPartGroupp->mParticles[idx]->mPartSourcep->getOwnerUUID();
- }
+ if (idx < (S32) mViewerPartGroupp->mParticles.size())
+ {
+ ret = mViewerPartGroupp->mParticles[idx]->mPartSourcep->getOwnerUUID();
+ }
- return ret;
+ return ret;
}
LLUUID LLVOPartGroup::getPartSource(S32 idx)
{
- LLUUID ret = LLUUID::null;
-
- if (idx < (S32) mViewerPartGroupp->mParticles.size())
- {
- LLViewerPart* part = mViewerPartGroupp->mParticles[idx];
- if (part && part->mPartSourcep.notNull() &&
- part->mPartSourcep->mSourceObjectp.notNull())
- {
- LLViewerObject* source = part->mPartSourcep->mSourceObjectp;
- ret = source->getID();
- }
- }
-
- return ret;
+ LLUUID ret = LLUUID::null;
+
+ if (idx < (S32) mViewerPartGroupp->mParticles.size())
+ {
+ LLViewerPart* part = mViewerPartGroupp->mParticles[idx];
+ if (part && part->mPartSourcep.notNull() &&
+ part->mPartSourcep->mSourceObjectp.notNull())
+ {
+ LLViewerObject* source = part->mPartSourcep->mSourceObjectp;
+ ret = source->getID();
+ }
+ }
+
+ return ret;
}
F32 LLVOPartGroup::getPartSize(S32 idx)
{
- if (idx < (S32) mViewerPartGroupp->mParticles.size())
- {
- return mViewerPartGroupp->mParticles[idx]->mScale.mV[0];
- }
+ if (idx < (S32) mViewerPartGroupp->mParticles.size())
+ {
+ return mViewerPartGroupp->mParticles[idx]->mScale.mV[0];
+ }
- return 0.f;
+ return 0.f;
}
void LLVOPartGroup::getBlendFunc(S32 idx, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst)
{
- if (idx < (S32) mViewerPartGroupp->mParticles.size())
- {
- LLViewerPart* part = mViewerPartGroupp->mParticles[idx];
- src = (LLRender::eBlendFactor) part->mBlendFuncSource;
- dst = (LLRender::eBlendFactor) part->mBlendFuncDest;
- }
+ if (idx < (S32) mViewerPartGroupp->mParticles.size())
+ {
+ LLViewerPart* part = mViewerPartGroupp->mParticles[idx];
+ src = (LLRender::eBlendFactor) part->mBlendFuncSource;
+ dst = (LLRender::eBlendFactor) part->mBlendFuncDest;
+ }
}
LLVector3 LLVOPartGroup::getCameraPosition() const
{
- return gAgentCamera.getCameraPositionAgent();
+ return gAgentCamera.getCameraPositionAgent();
}
BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable)
{
LL_PROFILE_ZONE_SCOPED;
- dirtySpatialGroup();
-
- S32 num_parts = mViewerPartGroupp->getCount();
- LLFace *facep;
- LLSpatialGroup* group = drawable->getSpatialGroup();
- if (!group && num_parts)
- {
- drawable->movePartition();
- group = drawable->getSpatialGroup();
- }
-
- if (group && group->isVisible())
- {
- dirtySpatialGroup();
- }
-
- if (!num_parts)
- {
- if (group && drawable->getNumFaces())
- {
- group->setState(LLSpatialGroup::GEOM_DIRTY);
- }
- drawable->setNumFaces(0, NULL, getTEImage(0));
- LLPipeline::sCompiles++;
- return TRUE;
- }
-
- if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
- {
- return TRUE;
- }
-
- if (num_parts > drawable->getNumFaces())
- {
- drawable->setNumFacesFast(num_parts+num_parts/4, NULL, getTEImage(0));
- }
-
- F32 tot_area = 0;
-
- F32 max_area = LLViewerPartSim::getMaxPartCount() * MAX_PARTICLE_AREA_SCALE;
- F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
- pixel_meter_ratio *= pixel_meter_ratio;
-
- LLViewerPartSim::checkParticleCount(mViewerPartGroupp->mParticles.size()) ;
-
- S32 count=0;
- mDepth = 0.f;
- S32 i = 0 ;
- LLVector3 camera_agent = getCameraPosition();
-
- F32 max_scale = 0.f;
-
-
- for (i = 0 ; i < (S32)mViewerPartGroupp->mParticles.size(); i++)
- {
- const LLViewerPart *part = mViewerPartGroupp->mParticles[i];
-
-
- //remember the largest particle
- max_scale = llmax(max_scale, part->mScale.mV[0], part->mScale.mV[1]);
-
- if (part->mFlags & LLPartData::LL_PART_RIBBON_MASK)
- { //include ribbon segment length in scale
- const LLVector3* pos_agent = NULL;
- if (part->mParent)
- {
- pos_agent = &(part->mParent->mPosAgent);
- }
- else if (part->mPartSourcep.notNull())
- {
- pos_agent = &(part->mPartSourcep->mPosAgent);
- }
-
- if (pos_agent)
- {
- F32 dist = (*pos_agent-part->mPosAgent).length();
-
- max_scale = llmax(max_scale, dist);
- }
- }
-
- LLVector3 part_pos_agent(part->mPosAgent);
- LLVector3 at(part_pos_agent - camera_agent);
-
-
- F32 camera_dist_squared = at.lengthSquared();
- F32 inv_camera_dist_squared;
- if (camera_dist_squared > 1.f)
- inv_camera_dist_squared = 1.f / camera_dist_squared;
- else
- inv_camera_dist_squared = 1.f;
-
- llassert(llfinite(inv_camera_dist_squared));
- llassert(!llisnan(inv_camera_dist_squared));
-
- F32 area = part->mScale.mV[0] * part->mScale.mV[1] * inv_camera_dist_squared;
- tot_area = llmax(tot_area, area);
-
- if (tot_area > max_area)
- {
- break;
- }
-
- count++;
-
- facep = drawable->getFace(i);
- if (!facep)
- {
- LL_WARNS() << "No face found for index " << i << "!" << LL_ENDL;
- continue;
- }
-
- facep->setTEOffset(i);
- const F32 NEAR_PART_DIST_SQ = 5.f*5.f; // Only discard particles > 5 m from the camera
- const F32 MIN_PART_AREA = .005f*.005f; // only less than 5 mm x 5 mm at 1 m from camera
-
- if (camera_dist_squared > NEAR_PART_DIST_SQ && area < MIN_PART_AREA)
- {
- facep->setSize(0, 0);
- continue;
- }
-
- facep->setSize(4, 6);
-
- facep->setViewerObject(this);
-
- if (part->mFlags & LLPartData::LL_PART_EMISSIVE_MASK)
- {
- facep->setState(LLFace::FULLBRIGHT);
- }
- else
- {
- facep->clearState(LLFace::FULLBRIGHT);
- }
-
- facep->mCenterLocal = part->mPosAgent;
- facep->setFaceColor(part->mColor);
- facep->setTexture(part->mImagep);
-
- //check if this particle texture is replaced by a parcel media texture.
- if(part->mImagep.notNull() && part->mImagep->hasParcelMedia())
- {
- part->mImagep->getParcelMedia()->addMediaToFace(facep) ;
- }
-
- mPixelArea = tot_area * pixel_meter_ratio;
- const F32 area_scale = 10.f; // scale area to increase priority a bit
- facep->setVirtualSize(mPixelArea*area_scale);
- }
- for (i = count; i < drawable->getNumFaces(); i++)
- {
- LLFace* facep = drawable->getFace(i);
- if (!facep)
- {
- LL_WARNS() << "No face found for index " << i << "!" << LL_ENDL;
- continue;
- }
- facep->setTEOffset(i);
- facep->setSize(0, 0);
- }
-
- //record max scale (used to stretch bounding box for visibility culling)
-
- mScale.set(max_scale, max_scale, max_scale);
-
- mDrawable->movePartition();
- LLPipeline::sCompiles++;
- return TRUE;
+ dirtySpatialGroup();
+
+ S32 num_parts = mViewerPartGroupp->getCount();
+ LLFace *facep;
+ LLSpatialGroup* group = drawable->getSpatialGroup();
+ if (!group && num_parts)
+ {
+ drawable->movePartition();
+ group = drawable->getSpatialGroup();
+ }
+
+ if (group && group->isVisible())
+ {
+ dirtySpatialGroup();
+ }
+
+ if (!num_parts)
+ {
+ if (group && drawable->getNumFaces())
+ {
+ group->setState(LLSpatialGroup::GEOM_DIRTY);
+ }
+ drawable->setNumFaces(0, NULL, getTEImage(0));
+ LLPipeline::sCompiles++;
+ return TRUE;
+ }
+
+ if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
+ {
+ return TRUE;
+ }
+
+ if (num_parts > drawable->getNumFaces())
+ {
+ drawable->setNumFacesFast(num_parts+num_parts/4, NULL, getTEImage(0));
+ }
+
+ F32 tot_area = 0;
+
+ F32 max_area = LLViewerPartSim::getMaxPartCount() * MAX_PARTICLE_AREA_SCALE;
+ F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
+ pixel_meter_ratio *= pixel_meter_ratio;
+
+ LLViewerPartSim::checkParticleCount(mViewerPartGroupp->mParticles.size()) ;
+
+ S32 count=0;
+ mDepth = 0.f;
+ S32 i = 0 ;
+ LLVector3 camera_agent = getCameraPosition();
+
+ F32 max_scale = 0.f;
+
+
+ for (i = 0 ; i < (S32)mViewerPartGroupp->mParticles.size(); i++)
+ {
+ const LLViewerPart *part = mViewerPartGroupp->mParticles[i];
+
+
+ //remember the largest particle
+ max_scale = llmax(max_scale, part->mScale.mV[0], part->mScale.mV[1]);
+
+ if (part->mFlags & LLPartData::LL_PART_RIBBON_MASK)
+ { //include ribbon segment length in scale
+ const LLVector3* pos_agent = NULL;
+ if (part->mParent)
+ {
+ pos_agent = &(part->mParent->mPosAgent);
+ }
+ else if (part->mPartSourcep.notNull())
+ {
+ pos_agent = &(part->mPartSourcep->mPosAgent);
+ }
+
+ if (pos_agent)
+ {
+ F32 dist = (*pos_agent-part->mPosAgent).length();
+
+ max_scale = llmax(max_scale, dist);
+ }
+ }
+
+ LLVector3 part_pos_agent(part->mPosAgent);
+ LLVector3 at(part_pos_agent - camera_agent);
+
+
+ F32 camera_dist_squared = at.lengthSquared();
+ F32 inv_camera_dist_squared;
+ if (camera_dist_squared > 1.f)
+ inv_camera_dist_squared = 1.f / camera_dist_squared;
+ else
+ inv_camera_dist_squared = 1.f;
+
+ llassert(llfinite(inv_camera_dist_squared));
+ llassert(!llisnan(inv_camera_dist_squared));
+
+ F32 area = part->mScale.mV[0] * part->mScale.mV[1] * inv_camera_dist_squared;
+ tot_area = llmax(tot_area, area);
+
+ if (tot_area > max_area)
+ {
+ break;
+ }
+
+ count++;
+
+ facep = drawable->getFace(i);
+ if (!facep)
+ {
+ LL_WARNS() << "No face found for index " << i << "!" << LL_ENDL;
+ continue;
+ }
+
+ facep->setTEOffset(i);
+ const F32 NEAR_PART_DIST_SQ = 5.f*5.f; // Only discard particles > 5 m from the camera
+ const F32 MIN_PART_AREA = .005f*.005f; // only less than 5 mm x 5 mm at 1 m from camera
+
+ if (camera_dist_squared > NEAR_PART_DIST_SQ && area < MIN_PART_AREA)
+ {
+ facep->setSize(0, 0);
+ continue;
+ }
+
+ facep->setSize(4, 6);
+
+ facep->setViewerObject(this);
+
+ if (part->mFlags & LLPartData::LL_PART_EMISSIVE_MASK)
+ {
+ facep->setState(LLFace::FULLBRIGHT);
+ }
+ else
+ {
+ facep->clearState(LLFace::FULLBRIGHT);
+ }
+
+ facep->mCenterLocal = part->mPosAgent;
+ facep->setFaceColor(part->mColor);
+ facep->setTexture(part->mImagep);
+
+ //check if this particle texture is replaced by a parcel media texture.
+ if(part->mImagep.notNull() && part->mImagep->hasParcelMedia())
+ {
+ part->mImagep->getParcelMedia()->addMediaToFace(facep) ;
+ }
+
+ mPixelArea = tot_area * pixel_meter_ratio;
+ const F32 area_scale = 10.f; // scale area to increase priority a bit
+ facep->setVirtualSize(mPixelArea*area_scale);
+ }
+ for (i = count; i < drawable->getNumFaces(); i++)
+ {
+ LLFace* facep = drawable->getFace(i);
+ if (!facep)
+ {
+ LL_WARNS() << "No face found for index " << i << "!" << LL_ENDL;
+ continue;
+ }
+ facep->setTEOffset(i);
+ facep->setSize(0, 0);
+ }
+
+ //record max scale (used to stretch bounding box for visibility culling)
+
+ mScale.set(max_scale, max_scale, max_scale);
+
+ mDrawable->movePartition();
+ LLPipeline::sCompiles++;
+ return TRUE;
}
BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face,
- BOOL pick_transparent,
- BOOL pick_rigged,
+ S32 face,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
BOOL pick_unselectable,
- S32* face_hit,
- LLVector4a* intersection,
- LLVector2* tex_coord,
- LLVector4a* normal,
- LLVector4a* bi_normal)
+ S32* face_hit,
+ LLVector4a* intersection,
+ LLVector2* tex_coord,
+ LLVector4a* normal,
+ LLVector4a* bi_normal)
{
- LLVector4a dir;
- dir.setSub(end, start);
-
- F32 closest_t = 2.f;
- BOOL ret = FALSE;
-
- for (U32 idx = 0; idx < mViewerPartGroupp->mParticles.size(); ++idx)
- {
- const LLViewerPart &part = *((LLViewerPart*) (mViewerPartGroupp->mParticles[idx]));
-
- LLVector4a v[4];
- LLStrider<LLVector4a> verticesp;
- verticesp = v;
-
- getGeometry(part, verticesp);
-
- F32 a,b,t;
- if (LLTriangleRayIntersect(v[0], v[1], v[2], start, dir, a,b,t) ||
- LLTriangleRayIntersect(v[1], v[3], v[2], start, dir, a,b,t))
- {
- if (t >= 0.f &&
- t <= 1.f &&
- t < closest_t)
- {
- ret = TRUE;
- closest_t = t;
- if (face_hit)
- {
- *face_hit = idx;
- }
-
- if (intersection)
- {
- LLVector4a intersect = dir;
- intersect.mul(closest_t);
- intersection->setAdd(intersect, start);
- }
- }
- }
- }
-
- return ret;
+ LLVector4a dir;
+ dir.setSub(end, start);
+
+ F32 closest_t = 2.f;
+ BOOL ret = FALSE;
+
+ for (U32 idx = 0; idx < mViewerPartGroupp->mParticles.size(); ++idx)
+ {
+ const LLViewerPart &part = *((LLViewerPart*) (mViewerPartGroupp->mParticles[idx]));
+
+ LLVector4a v[4];
+ LLStrider<LLVector4a> verticesp;
+ verticesp = v;
+
+ getGeometry(part, verticesp);
+
+ F32 a,b,t;
+ if (LLTriangleRayIntersect(v[0], v[1], v[2], start, dir, a,b,t) ||
+ LLTriangleRayIntersect(v[1], v[3], v[2], start, dir, a,b,t))
+ {
+ if (t >= 0.f &&
+ t <= 1.f &&
+ t < closest_t)
+ {
+ ret = TRUE;
+ closest_t = t;
+ if (face_hit)
+ {
+ *face_hit = idx;
+ }
+
+ if (intersection)
+ {
+ LLVector4a intersect = dir;
+ intersect.mul(closest_t);
+ intersection->setAdd(intersect, start);
+ }
+ }
+ }
+ }
+
+ return ret;
}
void LLVOPartGroup::getGeometry(const LLViewerPart& part,
- LLStrider<LLVector4a>& verticesp)
+ LLStrider<LLVector4a>& verticesp)
{
- if (part.mFlags & LLPartData::LL_PART_RIBBON_MASK)
- {
- LLVector4a axis, pos, paxis, ppos;
- F32 scale, pscale;
-
- pos.load3(part.mPosAgent.mV);
- axis.load3(part.mAxis.mV);
- scale = part.mScale.mV[0];
-
- if (part.mParent)
- {
- ppos.load3(part.mParent->mPosAgent.mV);
- paxis.load3(part.mParent->mAxis.mV);
- pscale = part.mParent->mScale.mV[0];
- }
- else
- { //use source object as position
-
- if (part.mPartSourcep->mSourceObjectp.notNull())
- {
- LLVector3 v = LLVector3(0,0,1);
- v *= part.mPartSourcep->mSourceObjectp->getRenderRotation();
- paxis.load3(v.mV);
- ppos.load3(part.mPartSourcep->mPosAgent.mV);
- pscale = part.mStartScale.mV[0];
- }
- else
- { //no source object, no parent, nothing to draw
- ppos = pos;
- pscale = scale;
- paxis = axis;
- }
- }
-
- LLVector4a p0, p1, p2, p3;
-
- scale *= 0.5f;
- pscale *= 0.5f;
-
- axis.mul(scale);
- paxis.mul(pscale);
-
- p0.setAdd(pos, axis);
- p1.setSub(pos,axis);
- p2.setAdd(ppos, paxis);
- p3.setSub(ppos, paxis);
-
- (*verticesp++) = p2;
- (*verticesp++) = p3;
- (*verticesp++) = p0;
- (*verticesp++) = p1;
- }
- else
- {
- LLVector4a part_pos_agent;
- part_pos_agent.load3(part.mPosAgent.mV);
- LLVector4a camera_agent;
- camera_agent.load3(getCameraPosition().mV);
- LLVector4a at;
- at.setSub(part_pos_agent, camera_agent);
- LLVector4a up(0, 0, 1);
- LLVector4a right;
-
- right.setCross3(at, up);
- right.normalize3fast();
-
- up.setCross3(right, at);
- up.normalize3fast();
-
- if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK && !part.mVelocity.isExactlyZero())
- {
- LLVector4a normvel;
- normvel.load3(part.mVelocity.mV);
- normvel.normalize3fast();
- LLVector2 up_fracs;
- up_fracs.mV[0] = normvel.dot3(right).getF32();
- up_fracs.mV[1] = normvel.dot3(up).getF32();
- up_fracs.normalize();
- LLVector4a new_up;
- LLVector4a new_right;
-
- //new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up;
- LLVector4a t = right;
- t.mul(up_fracs.mV[0]);
- new_up = up;
- new_up.mul(up_fracs.mV[1]);
- new_up.add(t);
-
- //new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up;
- t = right;
- t.mul(up_fracs.mV[1]);
- new_right = up;
- new_right.mul(up_fracs.mV[0]);
- t.sub(new_right);
-
- up = new_up;
- right = t;
- up.normalize3fast();
- right.normalize3fast();
- }
-
- right.mul(0.5f*part.mScale.mV[0]);
- up.mul(0.5f*part.mScale.mV[1]);
-
-
- //HACK -- the verticesp->mV[3] = 0.f here are to set the texture index to 0 (particles don't use texture batching, maybe they should)
- // this works because there is actually a 4th float stored after the vertex position which is used as a texture index
- // also, somebody please VECTORIZE THIS
-
- LLVector4a ppapu;
- LLVector4a ppamu;
-
- ppapu.setAdd(part_pos_agent, up);
- ppamu.setSub(part_pos_agent, up);
-
- verticesp->setSub(ppapu, right);
- (*verticesp++).getF32ptr()[3] = 0.f;
- verticesp->setSub(ppamu, right);
- (*verticesp++).getF32ptr()[3] = 0.f;
- verticesp->setAdd(ppapu, right);
- (*verticesp++).getF32ptr()[3] = 0.f;
- verticesp->setAdd(ppamu, right);
- (*verticesp++).getF32ptr()[3] = 0.f;
- }
+ if (part.mFlags & LLPartData::LL_PART_RIBBON_MASK)
+ {
+ LLVector4a axis, pos, paxis, ppos;
+ F32 scale, pscale;
+
+ pos.load3(part.mPosAgent.mV);
+ axis.load3(part.mAxis.mV);
+ scale = part.mScale.mV[0];
+
+ if (part.mParent)
+ {
+ ppos.load3(part.mParent->mPosAgent.mV);
+ paxis.load3(part.mParent->mAxis.mV);
+ pscale = part.mParent->mScale.mV[0];
+ }
+ else
+ { //use source object as position
+
+ if (part.mPartSourcep->mSourceObjectp.notNull())
+ {
+ LLVector3 v = LLVector3(0,0,1);
+ v *= part.mPartSourcep->mSourceObjectp->getRenderRotation();
+ paxis.load3(v.mV);
+ ppos.load3(part.mPartSourcep->mPosAgent.mV);
+ pscale = part.mStartScale.mV[0];
+ }
+ else
+ { //no source object, no parent, nothing to draw
+ ppos = pos;
+ pscale = scale;
+ paxis = axis;
+ }
+ }
+
+ LLVector4a p0, p1, p2, p3;
+
+ scale *= 0.5f;
+ pscale *= 0.5f;
+
+ axis.mul(scale);
+ paxis.mul(pscale);
+
+ p0.setAdd(pos, axis);
+ p1.setSub(pos,axis);
+ p2.setAdd(ppos, paxis);
+ p3.setSub(ppos, paxis);
+
+ (*verticesp++) = p2;
+ (*verticesp++) = p3;
+ (*verticesp++) = p0;
+ (*verticesp++) = p1;
+ }
+ else
+ {
+ LLVector4a part_pos_agent;
+ part_pos_agent.load3(part.mPosAgent.mV);
+ LLVector4a camera_agent;
+ camera_agent.load3(getCameraPosition().mV);
+ LLVector4a at;
+ at.setSub(part_pos_agent, camera_agent);
+ LLVector4a up(0, 0, 1);
+ LLVector4a right;
+
+ right.setCross3(at, up);
+ right.normalize3fast();
+
+ up.setCross3(right, at);
+ up.normalize3fast();
+
+ if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK && !part.mVelocity.isExactlyZero())
+ {
+ LLVector4a normvel;
+ normvel.load3(part.mVelocity.mV);
+ normvel.normalize3fast();
+ LLVector2 up_fracs;
+ up_fracs.mV[0] = normvel.dot3(right).getF32();
+ up_fracs.mV[1] = normvel.dot3(up).getF32();
+ up_fracs.normalize();
+ LLVector4a new_up;
+ LLVector4a new_right;
+
+ //new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up;
+ LLVector4a t = right;
+ t.mul(up_fracs.mV[0]);
+ new_up = up;
+ new_up.mul(up_fracs.mV[1]);
+ new_up.add(t);
+
+ //new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up;
+ t = right;
+ t.mul(up_fracs.mV[1]);
+ new_right = up;
+ new_right.mul(up_fracs.mV[0]);
+ t.sub(new_right);
+
+ up = new_up;
+ right = t;
+ up.normalize3fast();
+ right.normalize3fast();
+ }
+
+ right.mul(0.5f*part.mScale.mV[0]);
+ up.mul(0.5f*part.mScale.mV[1]);
+
+
+ //HACK -- the verticesp->mV[3] = 0.f here are to set the texture index to 0 (particles don't use texture batching, maybe they should)
+ // this works because there is actually a 4th float stored after the vertex position which is used as a texture index
+ // also, somebody please VECTORIZE THIS
+
+ LLVector4a ppapu;
+ LLVector4a ppamu;
+
+ ppapu.setAdd(part_pos_agent, up);
+ ppamu.setSub(part_pos_agent, up);
+
+ verticesp->setSub(ppapu, right);
+ (*verticesp++).getF32ptr()[3] = 0.f;
+ verticesp->setSub(ppamu, right);
+ (*verticesp++).getF32ptr()[3] = 0.f;
+ verticesp->setAdd(ppapu, right);
+ (*verticesp++).getF32ptr()[3] = 0.f;
+ verticesp->setAdd(ppamu, right);
+ (*verticesp++).getF32ptr()[3] = 0.f;
+ }
}
-
+
void LLVOPartGroup::getGeometry(S32 idx,
- LLStrider<LLVector4a>& verticesp,
- LLStrider<LLVector3>& normalsp,
- LLStrider<LLVector2>& texcoordsp,
- LLStrider<LLColor4U>& colorsp,
- LLStrider<LLColor4U>& emissivep,
- LLStrider<U16>& indicesp)
+ LLStrider<LLVector4a>& verticesp,
+ LLStrider<LLVector3>& normalsp,
+ LLStrider<LLVector2>& texcoordsp,
+ LLStrider<LLColor4U>& colorsp,
+ LLStrider<LLColor4U>& emissivep,
+ LLStrider<U16>& indicesp)
{
- if (idx >= (S32) mViewerPartGroupp->mParticles.size())
- {
- return;
- }
-
- const LLViewerPart &part = *((LLViewerPart*) (mViewerPartGroupp->mParticles[idx]));
-
- getGeometry(part, verticesp);
-
- LLColor4U pcolor;
- LLColor4U color = part.mColor;
-
- LLColor4U pglow;
-
- if (part.mFlags & LLPartData::LL_PART_RIBBON_MASK)
- { //make sure color blends properly
- if (part.mParent)
- {
- pglow = part.mParent->mGlow;
- pcolor = part.mParent->mColor;
- }
- else
- {
- pglow = LLColor4U(0, 0, 0, (U8) ll_round(255.f*part.mStartGlow));
- pcolor = part.mStartColor;
- }
- }
- else
- {
- pglow = part.mGlow;
- pcolor = color;
- }
-
- *colorsp++ = pcolor;
- *colorsp++ = pcolor;
- *colorsp++ = color;
- *colorsp++ = color;
-
- //if (pglow.mV[3] || part.mGlow.mV[3])
- { //only write glow if it is not zero
- *emissivep++ = pglow;
- *emissivep++ = pglow;
- *emissivep++ = part.mGlow;
- *emissivep++ = part.mGlow;
- }
-
-
- if (!(part.mFlags & LLPartData::LL_PART_EMISSIVE_MASK))
- { //not fullbright, needs normal
- LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis();
- *normalsp++ = normal;
- *normalsp++ = normal;
- *normalsp++ = normal;
- *normalsp++ = normal;
- }
+ if (idx >= (S32) mViewerPartGroupp->mParticles.size())
+ {
+ return;
+ }
+
+ const LLViewerPart &part = *((LLViewerPart*) (mViewerPartGroupp->mParticles[idx]));
+
+ getGeometry(part, verticesp);
+
+ LLColor4U pcolor;
+ LLColor4U color = part.mColor;
+
+ LLColor4U pglow;
+
+ if (part.mFlags & LLPartData::LL_PART_RIBBON_MASK)
+ { //make sure color blends properly
+ if (part.mParent)
+ {
+ pglow = part.mParent->mGlow;
+ pcolor = part.mParent->mColor;
+ }
+ else
+ {
+ pglow = LLColor4U(0, 0, 0, (U8) ll_round(255.f*part.mStartGlow));
+ pcolor = part.mStartColor;
+ }
+ }
+ else
+ {
+ pglow = part.mGlow;
+ pcolor = color;
+ }
+
+ *colorsp++ = pcolor;
+ *colorsp++ = pcolor;
+ *colorsp++ = color;
+ *colorsp++ = color;
+
+ //if (pglow.mV[3] || part.mGlow.mV[3])
+ { //only write glow if it is not zero
+ *emissivep++ = pglow;
+ *emissivep++ = pglow;
+ *emissivep++ = part.mGlow;
+ *emissivep++ = part.mGlow;
+ }
+
+
+ if (!(part.mFlags & LLPartData::LL_PART_EMISSIVE_MASK))
+ { //not fullbright, needs normal
+ LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis();
+ *normalsp++ = normal;
+ *normalsp++ = normal;
+ *normalsp++ = normal;
+ *normalsp++ = normal;
+ }
}
U32 LLVOPartGroup::getPartitionType() const
-{
- return LLViewerRegion::PARTITION_PARTICLE;
+{
+ return LLViewerRegion::PARTITION_PARTICLE;
}
LLParticlePartition::LLParticlePartition(LLViewerRegion* regionp)
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, regionp)
{
- mRenderPass = LLRenderPass::PASS_ALPHA;
- mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES;
- mPartitionType = LLViewerRegion::PARTITION_PARTICLE;
- mSlopRatio = 0.f;
- mLODPeriod = 1;
+ mRenderPass = LLRenderPass::PASS_ALPHA;
+ mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES;
+ mPartitionType = LLViewerRegion::PARTITION_PARTICLE;
+ mSlopRatio = 0.f;
+ mLODPeriod = 1;
}
LLHUDParticlePartition::LLHUDParticlePartition(LLViewerRegion* regionp) :
- LLParticlePartition(regionp)
+ LLParticlePartition(regionp)
{
- mDrawableType = LLPipeline::RENDER_TYPE_HUD_PARTICLES;
- mPartitionType = LLViewerRegion::PARTITION_HUD_PARTICLE;
+ mDrawableType = LLPipeline::RENDER_TYPE_HUD_PARTICLES;
+ mPartitionType = LLViewerRegion::PARTITION_HUD_PARTICLE;
}
void LLParticlePartition::rebuildGeom(LLSpatialGroup* group)
@@ -782,60 +782,60 @@ void LLParticlePartition::rebuildGeom(LLSpatialGroup* group)
}
-
- getGeometry(group);
- }
- else
- {
- group->mVertexBuffer = NULL;
- group->mBufferMap.clear();
- }
-
- group->mLastUpdateTime = gFrameTimeSeconds;
- group->clearState(LLSpatialGroup::GEOM_DIRTY);
+
+ getGeometry(group);
+ }
+ else
+ {
+ group->mVertexBuffer = NULL;
+ group->mBufferMap.clear();
+ }
+
+ group->mLastUpdateTime = gFrameTimeSeconds;
+ group->clearState(LLSpatialGroup::GEOM_DIRTY);
}
void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count)
{
- mFaceList.clear();
-
- LLViewerCamera* camera = LLViewerCamera::getInstance();
- for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
- {
- LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
-
- if (!drawablep || drawablep->isDead())
- {
- continue;
- }
-
- LLAlphaObject* obj = (LLAlphaObject*) drawablep->getVObj().get();
- obj->mDepth = 0.f;
-
- U32 count = 0;
- for (S32 j = 0; j < drawablep->getNumFaces(); ++j)
- {
- drawablep->updateFaceSize(j);
-
- LLFace* facep = drawablep->getFace(j);
- if ( !facep || !facep->hasGeometry())
- {
- continue;
- }
-
- vertex_count += facep->getGeomCount();
- index_count += facep->getIndicesCount();
-
- count++;
- facep->mDistance = (facep->mCenterLocal - camera->getOrigin()) * camera->getAtAxis();
- obj->mDepth += facep->mDistance;
-
- mFaceList.push_back(facep);
- llassert(facep->getIndicesCount() < 65536);
- }
-
- obj->mDepth /= count;
- }
+ mFaceList.clear();
+
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+ {
+ LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
+
+ if (!drawablep || drawablep->isDead())
+ {
+ continue;
+ }
+
+ LLAlphaObject* obj = (LLAlphaObject*) drawablep->getVObj().get();
+ obj->mDepth = 0.f;
+
+ U32 count = 0;
+ for (S32 j = 0; j < drawablep->getNumFaces(); ++j)
+ {
+ drawablep->updateFaceSize(j);
+
+ LLFace* facep = drawablep->getFace(j);
+ if ( !facep || !facep->hasGeometry())
+ {
+ continue;
+ }
+
+ vertex_count += facep->getGeomCount();
+ index_count += facep->getIndicesCount();
+
+ count++;
+ facep->mDistance = (facep->mCenterLocal - camera->getOrigin()) * camera->getAtAxis();
+ obj->mDepth += facep->mDistance;
+
+ mFaceList.push_back(facep);
+ llassert(facep->getIndicesCount() < 65536);
+ }
+
+ obj->mDepth /= count;
+ }
}
@@ -843,39 +843,39 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
{
LL_PROFILE_ZONE_SCOPED;
- std::sort(mFaceList.begin(), mFaceList.end(), LLFace::CompareDistanceGreater());
+ std::sort(mFaceList.begin(), mFaceList.end(), LLFace::CompareDistanceGreater());
- group->clearDrawMap();
+ group->clearDrawMap();
- LLVertexBuffer* buffer = group->mVertexBuffer;
+ LLVertexBuffer* buffer = group->mVertexBuffer;
- LLStrider<LLVector4a> verticesp;
- LLStrider<LLVector3> normalsp;
- LLStrider<LLColor4U> colorsp;
- LLStrider<LLColor4U> emissivep;
+ LLStrider<LLVector4a> verticesp;
+ LLStrider<LLVector3> normalsp;
+ LLStrider<LLColor4U> colorsp;
+ LLStrider<LLColor4U> emissivep;
- buffer->getVertexStrider(verticesp);
- buffer->getNormalStrider(normalsp);
- buffer->getColorStrider(colorsp);
- buffer->getEmissiveStrider(emissivep);
+ buffer->getVertexStrider(verticesp);
+ buffer->getNormalStrider(normalsp);
+ buffer->getColorStrider(colorsp);
+ buffer->getEmissiveStrider(emissivep);
S32 geom_idx = 0;
S32 indices_idx = 0;
- LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[mRenderPass];
+ LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[mRenderPass];
- for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
- {
- LLFace* facep = *i;
- LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
+ for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
+ {
+ LLFace* facep = *i;
+ LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
facep->setGeomIndex(geom_idx);
facep->setIndicesIndex(indices_idx);
- LLStrider<LLVector4a> cur_vert = verticesp + geom_idx;
- LLStrider<LLVector3> cur_norm = normalsp + geom_idx;
- LLStrider<LLColor4U> cur_col = colorsp + geom_idx;
- LLStrider<LLColor4U> cur_glow = emissivep + geom_idx;
+ LLStrider<LLVector4a> cur_vert = verticesp + geom_idx;
+ LLStrider<LLVector3> cur_norm = normalsp + geom_idx;
+ LLStrider<LLColor4U> cur_col = colorsp + geom_idx;
+ LLStrider<LLColor4U> cur_glow = emissivep + geom_idx;
// not actually used
LLStrider<LLVector2> cur_tc;
@@ -885,100 +885,100 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
geom_idx += 4;
indices_idx += 6;
- LLColor4U* start_glow = cur_glow.get();
+ LLColor4U* start_glow = cur_glow.get();
+
+ object->getGeometry(facep->getTEOffset(), cur_vert, cur_norm, cur_tc, cur_col, cur_glow, cur_idx);
+
+ bool has_glow = FALSE;
+
+ if (cur_glow.get() != start_glow)
+ {
+ has_glow = true;
+ }
+
+ llassert(facep->getGeomCount() == 4);
+ llassert(facep->getIndicesCount() == 6);
- object->getGeometry(facep->getTEOffset(), cur_vert, cur_norm, cur_tc, cur_col, cur_glow, cur_idx);
-
- bool has_glow = FALSE;
+ S32 idx = draw_vec.size()-1;
- if (cur_glow.get() != start_glow)
- {
- has_glow = true;
- }
+ bool fullbright = facep->isState(LLFace::FULLBRIGHT);
- llassert(facep->getGeomCount() == 4);
- llassert(facep->getIndicesCount() == 6);
-
- S32 idx = draw_vec.size()-1;
+ bool batched = false;
- bool fullbright = facep->isState(LLFace::FULLBRIGHT);
-
- bool batched = false;
-
- LLRender::eBlendFactor bf_src = LLRender::BF_SOURCE_ALPHA;
+ LLRender::eBlendFactor bf_src = LLRender::BF_SOURCE_ALPHA;
LLRender::eBlendFactor bf_dst = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
- object->getBlendFunc(facep->getTEOffset(), bf_src, bf_dst);
-
-
- if (idx >= 0)
- {
- LLDrawInfo* info = draw_vec[idx];
-
- if (info->mTexture == facep->getTexture() &&
- info->mHasGlow == has_glow &&
- info->mFullbright == fullbright &&
- info->mBlendFuncDst == bf_dst &&
- info->mBlendFuncSrc == bf_src)
- {
- if (draw_vec[idx]->mEnd == facep->getGeomIndex()-1)
- {
- batched = true;
- info->mCount += facep->getIndicesCount();
- info->mEnd += facep->getGeomCount();
- }
- else if (draw_vec[idx]->mStart == facep->getGeomIndex()+facep->getGeomCount()+1)
- {
- batched = true;
- info->mCount += facep->getIndicesCount();
- info->mStart -= facep->getGeomCount();
- info->mOffset = facep->getIndicesStart();
- }
- }
- }
-
- if (!batched)
- {
- U32 start = facep->getGeomIndex();
- U32 end = start + facep->getGeomCount()-1;
- U32 offset = facep->getIndicesStart();
- U32 count = facep->getIndicesCount();
- LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(),
- buffer, fullbright);
-
- info->mBlendFuncDst = bf_dst;
- info->mBlendFuncSrc = bf_src;
- info->mHasGlow = has_glow;
- draw_vec.push_back(info);
- //for alpha sorting
- facep->setDrawInfo(info);
- }
- }
+ object->getBlendFunc(facep->getTEOffset(), bf_src, bf_dst);
+
+
+ if (idx >= 0)
+ {
+ LLDrawInfo* info = draw_vec[idx];
+
+ if (info->mTexture == facep->getTexture() &&
+ info->mHasGlow == has_glow &&
+ info->mFullbright == fullbright &&
+ info->mBlendFuncDst == bf_dst &&
+ info->mBlendFuncSrc == bf_src)
+ {
+ if (draw_vec[idx]->mEnd == facep->getGeomIndex()-1)
+ {
+ batched = true;
+ info->mCount += facep->getIndicesCount();
+ info->mEnd += facep->getGeomCount();
+ }
+ else if (draw_vec[idx]->mStart == facep->getGeomIndex()+facep->getGeomCount()+1)
+ {
+ batched = true;
+ info->mCount += facep->getIndicesCount();
+ info->mStart -= facep->getGeomCount();
+ info->mOffset = facep->getIndicesStart();
+ }
+ }
+ }
+
+ if (!batched)
+ {
+ U32 start = facep->getGeomIndex();
+ U32 end = start + facep->getGeomCount()-1;
+ U32 offset = facep->getIndicesStart();
+ U32 count = facep->getIndicesCount();
+ LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(),
+ buffer, fullbright);
+
+ info->mBlendFuncDst = bf_dst;
+ info->mBlendFuncSrc = bf_src;
+ info->mHasGlow = has_glow;
+ draw_vec.push_back(info);
+ //for alpha sorting
+ facep->setDrawInfo(info);
+ }
+ }
buffer->unmapBuffer();
- mFaceList.clear();
+ mFaceList.clear();
}
F32 LLParticlePartition::calcPixelArea(LLSpatialGroup* group, LLCamera& camera)
{
- return 1024.f;
+ return 1024.f;
}
U32 LLVOHUDPartGroup::getPartitionType() const
{
- return LLViewerRegion::PARTITION_HUD_PARTICLE;
+ return LLViewerRegion::PARTITION_HUD_PARTICLE;
}
LLDrawable* LLVOHUDPartGroup::createDrawable(LLPipeline *pipeline)
{
- pipeline->allocDrawable(this);
- mDrawable->setLit(FALSE);
- mDrawable->setRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES);
- return mDrawable;
+ pipeline->allocDrawable(this);
+ mDrawable->setLit(FALSE);
+ mDrawable->setRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES);
+ return mDrawable;
}
LLVector3 LLVOHUDPartGroup::getCameraPosition() const
{
- return LLVector3(-1,0,0);
+ return LLVector3(-1,0,0);
}
diff --git a/indra/newview/llvopartgroup.h b/indra/newview/llvopartgroup.h
index 4d471134d4..b93f8924e6 100644
--- a/indra/newview/llvopartgroup.h
+++ b/indra/newview/llvopartgroup.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvopartgroup.h
* @brief Group of particle systems
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,71 +40,71 @@ class LLVOPartGroup : public LLAlphaObject
{
public:
- static void initClass();
- static void restoreGL();
- static void destroyGL();
-
- enum
- {
- VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_NORMAL |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_COLOR |
- LLVertexBuffer::MAP_EMISSIVE |
- LLVertexBuffer::MAP_TEXTURE_INDEX
- };
-
- LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
-
- /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
- void idleUpdate(LLAgent &agent, const F64 &time);
-
- virtual F32 getBinRadius();
- virtual void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
- virtual U32 getPartitionType() const;
-
- /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face,
- BOOL pick_transparent,
- BOOL pick_rigged,
+ static void initClass();
+ static void restoreGL();
+ static void destroyGL();
+
+ enum
+ {
+ VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_NORMAL |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_COLOR |
+ LLVertexBuffer::MAP_EMISSIVE |
+ LLVertexBuffer::MAP_TEXTURE_INDEX
+ };
+
+ LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+
+ /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
+ void idleUpdate(LLAgent &agent, const F64 &time);
+
+ virtual F32 getBinRadius();
+ virtual void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
+ virtual U32 getPartitionType() const;
+
+ /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
+ S32 face,
+ BOOL pick_transparent,
+ BOOL pick_rigged,
BOOL pick_unselectable,
- S32* face_hit,
- LLVector4a* intersection,
- LLVector2* tex_coord,
- LLVector4a* normal,
- LLVector4a* tangent);
-
- /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent);
- /*virtual*/ void updateTextures();
-
- /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
- void getGeometry(const LLViewerPart& part,
- LLStrider<LLVector4a>& verticesp);
-
- void getGeometry(S32 idx,
- LLStrider<LLVector4a>& verticesp,
- LLStrider<LLVector3>& normalsp,
- LLStrider<LLVector2>& texcoordsp,
- LLStrider<LLColor4U>& colorsp,
- LLStrider<LLColor4U>& emissivep,
- LLStrider<U16>& indicesp);
-
- void updateFaceSize(S32 idx) { }
- F32 getPartSize(S32 idx);
- void getBlendFunc(S32 idx, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst);
- LLUUID getPartOwner(S32 idx);
- LLUUID getPartSource(S32 idx);
-
- void setViewerPartGroup(LLViewerPartGroup *part_groupp) { mViewerPartGroupp = part_groupp; }
- LLViewerPartGroup* getViewerPartGroup() { return mViewerPartGroupp; }
+ S32* face_hit,
+ LLVector4a* intersection,
+ LLVector2* tex_coord,
+ LLVector4a* normal,
+ LLVector4a* tangent);
+
+ /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent);
+ /*virtual*/ void updateTextures();
+
+ /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
+ /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
+ void getGeometry(const LLViewerPart& part,
+ LLStrider<LLVector4a>& verticesp);
+
+ void getGeometry(S32 idx,
+ LLStrider<LLVector4a>& verticesp,
+ LLStrider<LLVector3>& normalsp,
+ LLStrider<LLVector2>& texcoordsp,
+ LLStrider<LLColor4U>& colorsp,
+ LLStrider<LLColor4U>& emissivep,
+ LLStrider<U16>& indicesp);
+
+ void updateFaceSize(S32 idx) { }
+ F32 getPartSize(S32 idx);
+ void getBlendFunc(S32 idx, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst);
+ LLUUID getPartOwner(S32 idx);
+ LLUUID getPartSource(S32 idx);
+
+ void setViewerPartGroup(LLViewerPartGroup *part_groupp) { mViewerPartGroupp = part_groupp; }
+ LLViewerPartGroup* getViewerPartGroup() { return mViewerPartGroupp; }
protected:
- ~LLVOPartGroup();
+ ~LLVOPartGroup();
- LLViewerPartGroup *mViewerPartGroupp;
+ LLViewerPartGroup *mViewerPartGroupp;
- virtual LLVector3 getCameraPosition() const;
+ virtual LLVector3 getCameraPosition() const;
};
@@ -112,14 +112,14 @@ protected:
class LLVOHUDPartGroup : public LLVOPartGroup
{
public:
- LLVOHUDPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) :
- LLVOPartGroup(id, pcode, regionp)
- {
- }
+ LLVOHUDPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) :
+ LLVOPartGroup(id, pcode, regionp)
+ {
+ }
protected:
- LLDrawable* createDrawable(LLPipeline *pipeline);
- U32 getPartitionType() const;
- virtual LLVector3 getCameraPosition() const;
+ LLDrawable* createDrawable(LLPipeline *pipeline);
+ U32 getPartitionType() const;
+ virtual LLVector3 getCameraPosition() const;
};
#endif // LL_LLVOPARTGROUP_H
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 20621665fa..5e5c887be6 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -69,8 +69,8 @@ namespace
const S32 MAX_TILES = TOTAL_TILES + 1;
// Heavenly body constants
- const F32 SUN_DISK_RADIUS = 0.5f;
- const F32 MOON_DISK_RADIUS = SUN_DISK_RADIUS * 0.9f;
+ const F32 SUN_DISK_RADIUS = 0.5f;
+ const F32 MOON_DISK_RADIUS = SUN_DISK_RADIUS * 0.9f;
const F32 SUN_INTENSITY = 1e5;
// Texture coordinates:
@@ -84,15 +84,15 @@ namespace
const F32 UPDATE_MIN_DELTA_THRESHOLD = 0.0005f;
}
/***************************************
- SkyTex
+ SkyTex
***************************************/
S32 LLSkyTex::sCurrent = 0;
LLSkyTex::LLSkyTex() :
- mSkyData(NULL),
- mSkyDirs(NULL),
+ mSkyData(NULL),
+ mSkyDirs(NULL),
mIsShiny(false)
{
}
@@ -100,41 +100,41 @@ LLSkyTex::LLSkyTex() :
void LLSkyTex::init(bool isShiny)
{
mIsShiny = isShiny;
- mSkyData = new LLColor4[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)];
- mSkyDirs = new LLVector3[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)];
+ mSkyData = new LLColor4[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)];
+ mSkyDirs = new LLVector3[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)];
- for (S32 i = 0; i < 2; ++i)
- {
- mTexture[i] = LLViewerTextureManager::getLocalTexture(FALSE);
- mTexture[i]->setAddressMode(LLTexUnit::TAM_CLAMP);
- mImageRaw[i] = new LLImageRaw(SKYTEX_RESOLUTION, SKYTEX_RESOLUTION, SKYTEX_COMPONENTS);
+ for (S32 i = 0; i < 2; ++i)
+ {
+ mTexture[i] = LLViewerTextureManager::getLocalTexture(FALSE);
+ mTexture[i]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ mImageRaw[i] = new LLImageRaw(SKYTEX_RESOLUTION, SKYTEX_RESOLUTION, SKYTEX_COMPONENTS);
- initEmpty(i);
- }
+ initEmpty(i);
+ }
}
void LLSkyTex::cleanupGL()
{
- mTexture[0] = NULL;
- mTexture[1] = NULL;
+ mTexture[0] = NULL;
+ mTexture[1] = NULL;
}
void LLSkyTex::restoreGL()
{
- for (S32 i = 0; i < 2; i++)
- {
- mTexture[i] = LLViewerTextureManager::getLocalTexture(FALSE);
- mTexture[i]->setAddressMode(LLTexUnit::TAM_CLAMP);
- }
+ for (S32 i = 0; i < 2; i++)
+ {
+ mTexture[i] = LLViewerTextureManager::getLocalTexture(FALSE);
+ mTexture[i]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
}
LLSkyTex::~LLSkyTex()
{
- delete[] mSkyData;
- mSkyData = NULL;
+ delete[] mSkyData;
+ mSkyData = NULL;
- delete[] mSkyDirs;
- mSkyDirs = NULL;
+ delete[] mSkyDirs;
+ mSkyDirs = NULL;
}
S32 LLSkyTex::getResolution()
@@ -166,53 +166,53 @@ S32 LLSkyTex::getWhich(const BOOL curr)
void LLSkyTex::initEmpty(const S32 tex)
{
- U8* data = mImageRaw[tex]->getData();
- for (S32 i = 0; i < SKYTEX_RESOLUTION; ++i)
- {
- for (S32 j = 0; j < SKYTEX_RESOLUTION; ++j)
- {
- const S32 basic_offset = (i * SKYTEX_RESOLUTION + j);
- S32 offset = basic_offset * SKYTEX_COMPONENTS;
- data[offset] = 0;
- data[offset+1] = 0;
- data[offset+2] = 0;
- data[offset+3] = 255;
-
- mSkyData[basic_offset].setToBlack();
- }
- }
+ U8* data = mImageRaw[tex]->getData();
+ for (S32 i = 0; i < SKYTEX_RESOLUTION; ++i)
+ {
+ for (S32 j = 0; j < SKYTEX_RESOLUTION; ++j)
+ {
+ const S32 basic_offset = (i * SKYTEX_RESOLUTION + j);
+ S32 offset = basic_offset * SKYTEX_COMPONENTS;
+ data[offset] = 0;
+ data[offset+1] = 0;
+ data[offset+2] = 0;
+ data[offset+3] = 255;
+
+ mSkyData[basic_offset].setToBlack();
+ }
+ }
- createGLImage(tex);
+ createGLImage(tex);
}
void LLSkyTex::create()
{
- U8* data = mImageRaw[sCurrent]->getData();
- for (S32 i = 0; i < SKYTEX_RESOLUTION; ++i)
- {
- for (S32 j = 0; j < SKYTEX_RESOLUTION; ++j)
- {
- const S32 basic_offset = (i * SKYTEX_RESOLUTION + j);
- S32 offset = basic_offset * SKYTEX_COMPONENTS;
- U32* pix = (U32*)(data + offset);
- LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
- *pix = temp.asRGBA();
- }
- }
- createGLImage(sCurrent);
+ U8* data = mImageRaw[sCurrent]->getData();
+ for (S32 i = 0; i < SKYTEX_RESOLUTION; ++i)
+ {
+ for (S32 j = 0; j < SKYTEX_RESOLUTION; ++j)
+ {
+ const S32 basic_offset = (i * SKYTEX_RESOLUTION + j);
+ S32 offset = basic_offset * SKYTEX_COMPONENTS;
+ U32* pix = (U32*)(data + offset);
+ LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
+ *pix = temp.asRGBA();
+ }
+ }
+ createGLImage(sCurrent);
}
void LLSkyTex::createGLImage(S32 which)
{
- mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA);
- mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL);
- mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA);
+ mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL);
+ mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP);
}
void LLSkyTex::bindTexture(BOOL curr)
{
int tex = getWhich(curr);
- gGL.getTexUnit(0)->bind(mTexture[tex], true);
+ gGL.getTexUnit(0)->bind(mTexture[tex], true);
}
LLImageRaw* LLSkyTex::getImageRaw(BOOL curr)
@@ -225,7 +225,7 @@ LLImageRaw* LLSkyTex::getImageRaw(BOOL curr)
LLHeavenBody
***************************************/
-F32 LLHeavenBody::sInterpVal = 0;
+F32 LLHeavenBody::sInterpVal = 0;
LLHeavenBody::LLHeavenBody(const F32 rad)
: mDirectionCached(LLVector3(0,0,0)),
@@ -237,8 +237,8 @@ LLHeavenBody::LLHeavenBody(const F32 rad)
mVisibility(1.f),
mVisible(FALSE)
{
- mColor.setToBlack();
- mColorCached.setToBlack();
+ mColor.setToBlack();
+ mColorCached.setToBlack();
}
const LLQuaternion& LLHeavenBody::getRotation() const
@@ -318,7 +318,7 @@ void LLHeavenBody::setInterpVal(const F32 v)
LLColor3 LLHeavenBody::getInterpColor() const
{
- return sInterpVal * mColor + (1 - sInterpVal) * mColorCached;
+ return sInterpVal * mColor + (1 - sInterpVal) * mColorCached;
}
const F32& LLHeavenBody::getVisibility() const
@@ -356,7 +356,7 @@ void LLHeavenBody::setDiskRadius(const F32 radius)
mDiskRadius = radius;
}
-F32 LLHeavenBody::getDiskRadius() const
+F32 LLHeavenBody::getDiskRadius() const
{
return mDiskRadius;
}
@@ -387,66 +387,66 @@ const LLVector3* LLHeavenBody::corners() const
}
/***************************************
- Sky
+ Sky
***************************************/
const S32 SKYTEX_TILE_RES_X = SKYTEX_RESOLUTION / NUM_TILES_X;
const S32 SKYTEX_TILE_RES_Y = SKYTEX_RESOLUTION / NUM_TILES_Y;
LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
-: LLStaticViewerObject(id, pcode, regionp, TRUE),
- mSun(SUN_DISK_RADIUS), mMoon(MOON_DISK_RADIUS),
- mBrightnessScale(1.f),
- mBrightnessScaleNew(0.f),
- mBrightnessScaleGuess(1.f),
- mWeatherChange(FALSE),
- mCloudDensity(0.2f),
- mWind(0.f),
- mForceUpdate(FALSE),
+: LLStaticViewerObject(id, pcode, regionp, TRUE),
+ mSun(SUN_DISK_RADIUS), mMoon(MOON_DISK_RADIUS),
+ mBrightnessScale(1.f),
+ mBrightnessScaleNew(0.f),
+ mBrightnessScaleGuess(1.f),
+ mWeatherChange(FALSE),
+ mCloudDensity(0.2f),
+ mWind(0.f),
+ mForceUpdate(FALSE),
mNeedUpdate(TRUE),
mCubeMapUpdateStage(-1),
- mWorldScale(1.f),
- mBumpSunDir(0.f, 0.f, 1.f)
+ mWorldScale(1.f),
+ mBumpSunDir(0.f, 0.f, 1.f)
{
- /// WL PARAMS
+ /// WL PARAMS
- mInitialized = FALSE;
- mbCanSelect = FALSE;
- mUpdateTimer.reset();
+ mInitialized = FALSE;
+ mbCanSelect = FALSE;
+ mUpdateTimer.reset();
mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY);
mForceUpdateThrottle.reset();
- for (S32 i = 0; i < NUM_CUBEMAP_FACES; i++)
- {
- mSkyTex[i].init(false);
- mShinyTex[i].init(true);
- }
- for (S32 i=0; i<FACE_COUNT; i++)
- {
- mFace[i] = NULL;
- }
+ for (S32 i = 0; i < NUM_CUBEMAP_FACES; i++)
+ {
+ mSkyTex[i].init(false);
+ mShinyTex[i].init(true);
+ }
+ for (S32 i=0; i<FACE_COUNT; i++)
+ {
+ mFace[i] = NULL;
+ }
- mCameraPosAgent = gAgentCamera.getCameraPositionAgent();
- mAtmHeight = ATM_HEIGHT;
- mEarthCenter = LLVector3(mCameraPosAgent.mV[0], mCameraPosAgent.mV[1], -EARTH_RADIUS);
+ mCameraPosAgent = gAgentCamera.getCameraPositionAgent();
+ mAtmHeight = ATM_HEIGHT;
+ mEarthCenter = LLVector3(mCameraPosAgent.mV[0], mCameraPosAgent.mV[1], -EARTH_RADIUS);
- mSun.setIntensity(SUN_INTENSITY);
- mMoon.setIntensity(0.1f * SUN_INTENSITY);
+ mSun.setIntensity(SUN_INTENSITY);
+ mMoon.setIntensity(0.1f * SUN_INTENSITY);
- mHeavenlyBodyUpdated = FALSE ;
+ mHeavenlyBodyUpdated = FALSE ;
- mDrawRefl = 0;
- mInterpVal = 0.f;
+ mDrawRefl = 0;
+ mInterpVal = 0.f;
}
LLVOSky::~LLVOSky()
{
- // Don't delete images - it'll get deleted by gTextureList on shutdown
- // This needs to be done for each texture
+ // Don't delete images - it'll get deleted by gTextureList on shutdown
+ // This needs to be done for each texture
- mCubeMap = NULL;
+ mCubeMap = NULL;
}
void LLVOSky::init()
@@ -461,23 +461,23 @@ void LLVOSky::init()
cacheEnvironment(psky,m_atmosphericsVars);
- // Initialize the cached normalized direction vectors
- for (S32 side = 0; side < NUM_CUBEMAP_FACES; ++side)
- {
- for (S32 tile = 0; tile < NUM_TILES; ++tile)
- {
- initSkyTextureDirs(side, tile);
+ // Initialize the cached normalized direction vectors
+ for (S32 side = 0; side < NUM_CUBEMAP_FACES; ++side)
+ {
+ for (S32 tile = 0; tile < NUM_TILES; ++tile)
+ {
+ initSkyTextureDirs(side, tile);
createSkyTexture(psky, m_atmosphericsVars, side, tile);
- }
+ }
mSkyTex[side].create();
mShinyTex[side].create();
- }
+ }
- initCubeMap();
+ initCubeMap();
- mInitialized = true;
+ mInitialized = true;
- mHeavenlyBodyUpdated = FALSE ;
+ mHeavenlyBodyUpdated = FALSE ;
mRainbowMap = LLViewerTextureManager::getFetchedTexture(psky->getRainbowTextureId(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
mHaloMap = LLViewerTextureManager::getFetchedTexture(psky->getHaloTextureId(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
@@ -514,133 +514,133 @@ void LLVOSky::calc()
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
cacheEnvironment(psky,m_atmosphericsVars);
- mSun.setColor(psky->getSunDiffuse());
- mMoon.setColor(LLColor3(1.0f, 1.0f, 1.0f));
+ mSun.setColor(psky->getSunDiffuse());
+ mMoon.setColor(LLColor3(1.0f, 1.0f, 1.0f));
- mSun.renewDirection();
- mSun.renewColor();
- mMoon.renewDirection();
- mMoon.renewColor();
+ mSun.renewDirection();
+ mSun.renewColor();
+ mMoon.renewDirection();
+ mMoon.renewColor();
}
void LLVOSky::initCubeMap()
{
- std::vector<LLPointer<LLImageRaw> > images;
- for (S32 side = 0; side < NUM_CUBEMAP_FACES; side++)
- {
- images.push_back(mShinyTex[side].getImageRaw());
- }
+ std::vector<LLPointer<LLImageRaw> > images;
+ for (S32 side = 0; side < NUM_CUBEMAP_FACES; side++)
+ {
+ images.push_back(mShinyTex[side].getImageRaw());
+ }
- if (!mCubeMap && gSavedSettings.getBOOL("RenderWater") && LLCubeMap::sUseCubeMaps)
- {
+ if (!mCubeMap && gSavedSettings.getBOOL("RenderWater") && LLCubeMap::sUseCubeMaps)
+ {
mCubeMap = new LLCubeMap(false);
- }
+ }
if (mCubeMap)
- {
- mCubeMap->init(images);
- }
+ {
+ mCubeMap->init(images);
+ }
- gGL.getTexUnit(0)->disable();
+ gGL.getTexUnit(0)->disable();
}
void LLVOSky::cleanupGL()
{
- S32 i;
- for (i = 0; i < NUM_CUBEMAP_FACES; i++)
- {
- mSkyTex[i].cleanupGL();
- }
- if (getCubeMap())
- {
- getCubeMap()->destroyGL();
- }
+ S32 i;
+ for (i = 0; i < NUM_CUBEMAP_FACES; i++)
+ {
+ mSkyTex[i].cleanupGL();
+ }
+ if (getCubeMap())
+ {
+ getCubeMap()->destroyGL();
+ }
}
void LLVOSky::restoreGL()
{
- S32 i;
- for (i = 0; i < NUM_CUBEMAP_FACES; i++)
- {
- mSkyTex[i].restoreGL();
- }
+ S32 i;
+ for (i = 0; i < NUM_CUBEMAP_FACES; i++)
+ {
+ mSkyTex[i].restoreGL();
+ }
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
if (psky)
- {
+ {
setSunTextures(psky->getSunTextureId(), psky->getNextSunTextureId());
setMoonTextures(psky->getMoonTextureId(), psky->getNextMoonTextureId());
}
- updateDirections(psky);
+ updateDirections(psky);
- if (gSavedSettings.getBOOL("RenderWater") && LLCubeMap::sUseCubeMaps)
- {
- initCubeMap();
- }
+ if (gSavedSettings.getBOOL("RenderWater") && LLCubeMap::sUseCubeMaps)
+ {
+ initCubeMap();
+ }
forceSkyUpdate();
- if (mDrawable)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
- }
+ if (mDrawable)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
+ }
}
void LLVOSky::initSkyTextureDirs(const S32 side, const S32 tile)
{
- S32 tile_x = tile % NUM_TILES_X;
- S32 tile_y = tile / NUM_TILES_X;
+ S32 tile_x = tile % NUM_TILES_X;
+ S32 tile_y = tile / NUM_TILES_X;
- S32 tile_x_pos = tile_x * SKYTEX_TILE_RES_X;
- S32 tile_y_pos = tile_y * SKYTEX_TILE_RES_Y;
+ S32 tile_x_pos = tile_x * SKYTEX_TILE_RES_X;
+ S32 tile_y_pos = tile_y * SKYTEX_TILE_RES_Y;
- F32 coeff[3] = {0, 0, 0};
- const S32 curr_coef = side >> 1; // 0/1 = Z axis, 2/3 = Y, 4/5 = X
- const S32 side_dir = (((side & 1) << 1) - 1); // even = -1, odd = 1
- const S32 x_coef = (curr_coef + 1) % 3;
- const S32 y_coef = (x_coef + 1) % 3;
+ F32 coeff[3] = {0, 0, 0};
+ const S32 curr_coef = side >> 1; // 0/1 = Z axis, 2/3 = Y, 4/5 = X
+ const S32 side_dir = (((side & 1) << 1) - 1); // even = -1, odd = 1
+ const S32 x_coef = (curr_coef + 1) % 3;
+ const S32 y_coef = (x_coef + 1) % 3;
- coeff[curr_coef] = (F32)side_dir;
+ coeff[curr_coef] = (F32)side_dir;
- F32 inv_res = 1.f/SKYTEX_RESOLUTION;
- S32 x, y;
- for (y = tile_y_pos; y < (tile_y_pos + SKYTEX_TILE_RES_Y); ++y)
- {
- for (x = tile_x_pos; x < (tile_x_pos + SKYTEX_TILE_RES_X); ++x)
- {
- coeff[x_coef] = F32((x<<1) + 1) * inv_res - 1.f;
- coeff[y_coef] = F32((y<<1) + 1) * inv_res - 1.f;
- LLVector3 dir(coeff[0], coeff[1], coeff[2]);
- dir.normalize();
- mSkyTex[side].setDir(dir, x, y);
- mShinyTex[side].setDir(dir, x, y);
- }
- }
+ F32 inv_res = 1.f/SKYTEX_RESOLUTION;
+ S32 x, y;
+ for (y = tile_y_pos; y < (tile_y_pos + SKYTEX_TILE_RES_Y); ++y)
+ {
+ for (x = tile_x_pos; x < (tile_x_pos + SKYTEX_TILE_RES_X); ++x)
+ {
+ coeff[x_coef] = F32((x<<1) + 1) * inv_res - 1.f;
+ coeff[y_coef] = F32((y<<1) + 1) * inv_res - 1.f;
+ LLVector3 dir(coeff[0], coeff[1], coeff[2]);
+ dir.normalize();
+ mSkyTex[side].setDir(dir, x, y);
+ mShinyTex[side].setDir(dir, x, y);
+ }
+ }
}
void LLVOSky::createSkyTexture(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const S32 side, const S32 tile)
{
const bool low_end = !gPipeline.canUseWindLightShaders();
- S32 tile_x = tile % NUM_TILES_X;
- S32 tile_y = tile / NUM_TILES_X;
+ S32 tile_x = tile % NUM_TILES_X;
+ S32 tile_y = tile / NUM_TILES_X;
- S32 tile_x_pos = tile_x * SKYTEX_TILE_RES_X;
- S32 tile_y_pos = tile_y * SKYTEX_TILE_RES_Y;
+ S32 tile_x_pos = tile_x * SKYTEX_TILE_RES_X;
+ S32 tile_y_pos = tile_y * SKYTEX_TILE_RES_Y;
- S32 x, y;
- for (y = tile_y_pos; y < (tile_y_pos + SKYTEX_TILE_RES_Y); ++y)
- {
- for (x = tile_x_pos; x < (tile_x_pos + SKYTEX_TILE_RES_X); ++x)
- {
- mSkyTex [side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(psky, vars, mSkyTex [side].getDir(x, y), false, low_end), x, y);
- mShinyTex[side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(psky, vars, mShinyTex[side].getDir(x, y), true , low_end), x, y);
- }
- }
+ S32 x, y;
+ for (y = tile_y_pos; y < (tile_y_pos + SKYTEX_TILE_RES_Y); ++y)
+ {
+ for (x = tile_x_pos; x < (tile_x_pos + SKYTEX_TILE_RES_X); ++x)
+ {
+ mSkyTex [side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(psky, vars, mSkyTex [side].getDir(x, y), false, low_end), x, y);
+ mShinyTex[side].setPixel(m_legacyAtmospherics.calcSkyColorInDir(psky, vars, mShinyTex[side].getDir(x, y), true , low_end), x, y);
+ }
+ }
}
void LLVOSky::updateDirections(LLSettingsSky::ptr_t psky)
@@ -668,36 +668,36 @@ bool LLVOSky::updateSky()
{
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)))
- {
- // It's dead. Don't update it.
- return TRUE;
- }
+ if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)))
+ {
+ // It's dead. Don't update it.
+ return TRUE;
+ }
- if (gGLManager.mIsDisabled)
- {
- return TRUE;
- }
+ if (gGLManager.mIsDisabled)
+ {
+ return TRUE;
+ }
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
- static S32 next_frame = 0;
+ static S32 next_frame = 0;
mNeedUpdate = mForceUpdate;
- ++next_frame;
- next_frame = next_frame % MAX_TILES;
+ ++next_frame;
+ next_frame = next_frame % MAX_TILES;
- mInterpVal = (!mInitialized) ? 1 : (F32)next_frame / MAX_TILES;
- LLHeavenBody::setInterpVal( mInterpVal );
- updateDirections(psky);
+ mInterpVal = (!mInitialized) ? 1 : (F32)next_frame / MAX_TILES;
+ LLHeavenBody::setInterpVal( mInterpVal );
+ updateDirections(psky);
if (!mCubeMap || LLPipeline::sReflectionProbesEnabled)
- {
+ {
mCubeMapUpdateStage = NUM_CUBEMAP_FACES;
mForceUpdate = FALSE;
return TRUE;
- }
+ }
if (mCubeMapUpdateStage < 0)
{
@@ -708,15 +708,15 @@ bool LLVOSky::updateSky()
mNeedUpdate = mNeedUpdate || !same_atmospherics;
if (mNeedUpdate && (mForceUpdateThrottle.hasExpired() || mForceUpdate))
- {
+ {
// start updating cube map sides
updateFog(LLViewerCamera::getInstance()->getFar());
mCubeMapUpdateStage = 0;
mForceUpdate = FALSE;
- }
- }
+ }
+ }
else if (mCubeMapUpdateStage == NUM_CUBEMAP_FACES && !LLPipeline::sReflectionProbesEnabled)
- {
+ {
LL_PROFILE_ZONE_NAMED("updateSky - forced");
LLSkyTex::stepCurrent();
@@ -776,7 +776,7 @@ bool LLVOSky::updateSky()
}
// run 0 to 5 faces, each face in own frame
else if (mCubeMapUpdateStage >= 0 && mCubeMapUpdateStage < NUM_CUBEMAP_FACES && !LLPipeline::sReflectionProbesEnabled)
- {
+ {
LL_PROFILE_ZONE_NAMED("updateSky - create");
S32 side = mCubeMapUpdateStage;
// CPU hungry part, createSkyTexture() is math heavy
@@ -791,65 +791,65 @@ bool LLVOSky::updateSky()
mCubeMapUpdateStage++;
}
- return TRUE;
+ return TRUE;
}
void LLVOSky::updateTextures()
{
- if (mSunTexturep[0])
- {
- mSunTexturep[0]->addTextureStats( (F32)MAX_IMAGE_AREA );
- }
+ if (mSunTexturep[0])
+ {
+ mSunTexturep[0]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ }
if (mSunTexturep[1])
- {
- mSunTexturep[1]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ {
+ mSunTexturep[1]->addTextureStats( (F32)MAX_IMAGE_AREA );
}
if (mMoonTexturep[0])
{
- mMoonTexturep[0]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ mMoonTexturep[0]->addTextureStats( (F32)MAX_IMAGE_AREA );
}
if (mMoonTexturep[1])
{
- mMoonTexturep[1]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ mMoonTexturep[1]->addTextureStats( (F32)MAX_IMAGE_AREA );
}
if (mBloomTexturep[0])
- {
- mBloomTexturep[0]->addTextureStats( (F32)MAX_IMAGE_AREA );
- }
+ {
+ mBloomTexturep[0]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ }
if (mBloomTexturep[1])
- {
- mBloomTexturep[1]->addTextureStats( (F32)MAX_IMAGE_AREA );
- }
- }
+ {
+ mBloomTexturep[1]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ }
+ }
LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline)
{
- pipeline->allocDrawable(this);
- mDrawable->setLit(FALSE);
+ pipeline->allocDrawable(this);
+ mDrawable->setLit(FALSE);
- LLDrawPoolSky *poolp = (LLDrawPoolSky*) gPipeline.getPool(LLDrawPool::POOL_SKY);
- poolp->setSkyTex(mSkyTex);
- mDrawable->setRenderType(LLPipeline::RENDER_TYPE_SKY);
+ LLDrawPoolSky *poolp = (LLDrawPoolSky*) gPipeline.getPool(LLDrawPool::POOL_SKY);
+ poolp->setSkyTex(mSkyTex);
+ mDrawable->setRenderType(LLPipeline::RENDER_TYPE_SKY);
- for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i)
- {
- mFace[FACE_SIDE0 + i] = mDrawable->addFace(poolp, NULL);
- }
+ for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i)
+ {
+ mFace[FACE_SIDE0 + i] = mDrawable->addFace(poolp, NULL);
+ }
- mFace[FACE_SUN] = mDrawable->addFace(poolp, nullptr);
- mFace[FACE_MOON] = mDrawable->addFace(poolp, nullptr);
- mFace[FACE_BLOOM] = mDrawable->addFace(poolp, nullptr);
+ mFace[FACE_SUN] = mDrawable->addFace(poolp, nullptr);
+ mFace[FACE_MOON] = mDrawable->addFace(poolp, nullptr);
+ mFace[FACE_BLOOM] = mDrawable->addFace(poolp, nullptr);
- mFace[FACE_SUN]->setMediaAllowed(false);
- mFace[FACE_MOON]->setMediaAllowed(false);
- mFace[FACE_BLOOM]->setMediaAllowed(false);
+ mFace[FACE_SUN]->setMediaAllowed(false);
+ mFace[FACE_MOON]->setMediaAllowed(false);
+ mFace[FACE_BLOOM]->setMediaAllowed(false);
- return mDrawable;
+ return mDrawable;
}
void LLVOSky::setSunScale(F32 sun_scale)
@@ -871,10 +871,10 @@ void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_textur
bool can_use_wl = gPipeline.canUseWindLightShaders();
if (mFace[FACE_SUN])
- {
+ {
if (mSunTexturep[0])
- {
- mSunTexturep[0]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ {
+ mSunTexturep[0]->setAddressMode(LLTexUnit::TAM_CLAMP);
}
LLViewerTexture* current_tex0 = mFace[FACE_SUN]->getTexture(LLRender::DIFFUSE_MAP);
@@ -936,13 +936,13 @@ void LLVOSky::setCloudNoiseTextures(const LLUUID& cloud_noise_texture, const LLU
mCloudNoiseTexturep[1] = cloud_noise_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(cloud_noise_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
if (mCloudNoiseTexturep[0])
- {
- mCloudNoiseTexturep[0]->setAddressMode(LLTexUnit::TAM_WRAP);
- }
+ {
+ mCloudNoiseTexturep[0]->setAddressMode(LLTexUnit::TAM_WRAP);
+ }
if (mCloudNoiseTexturep[1])
{
- mCloudNoiseTexturep[1]->setAddressMode(LLTexUnit::TAM_WRAP);
+ mCloudNoiseTexturep[1]->setAddressMode(LLTexUnit::TAM_WRAP);
}
}
@@ -970,90 +970,90 @@ void LLVOSky::setBloomTextures(const LLUUID& bloom_texture, const LLUUID& bloom_
BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE;
- if (mFace[FACE_REFLECTION] == NULL)
- {
- LLDrawPoolWater *poolp = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER);
- if (gPipeline.getPool(LLDrawPool::POOL_WATER)->getShaderLevel() != 0)
- {
- mFace[FACE_REFLECTION] = drawable->addFace(poolp, NULL);
- }
- }
-
- mCameraPosAgent = drawable->getPositionAgent();
-
- mEarthCenter.mV[0] = mCameraPosAgent.mV[0];
- mEarthCenter.mV[1] = mCameraPosAgent.mV[1];
-
- LLVector3 v_agent[8];
- for (S32 i = 0; i < 8; ++i)
- {
- F32 x_sgn = (i&1) ? 1.f : -1.f;
- F32 y_sgn = (i&2) ? 1.f : -1.f;
- F32 z_sgn = (i&4) ? 1.f : -1.f;
- v_agent[i] = HORIZON_DIST * SKY_BOX_MULT * LLVector3(x_sgn, y_sgn, z_sgn);
- }
-
- LLStrider<LLVector3> verticesp;
- LLStrider<LLVector3> normalsp;
- LLStrider<LLVector2> texCoordsp;
- LLStrider<U16> indicesp;
- U16 index_offset;
- LLFace *face;
-
- for (S32 side = 0; side < NUM_CUBEMAP_FACES; ++side)
- {
- face = mFace[FACE_SIDE0 + side];
-
- if (!face->getVertexBuffer())
- {
- face->setSize(4, 6);
- face->setGeomIndex(0);
- face->setIndicesIndex(0);
- LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK);
- buff->allocateBuffer(4, 6);
- face->setVertexBuffer(buff);
-
- index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
-
- S32 vtx = 0;
- S32 curr_bit = side >> 1; // 0/1 = Z axis, 2/3 = Y, 4/5 = X
- S32 side_dir = side & 1; // even - 0, odd - 1
- S32 i_bit = (curr_bit + 2) % 3;
- S32 j_bit = (i_bit + 2) % 3;
-
- LLVector3 axis;
- axis.mV[curr_bit] = 1;
- face->mCenterAgent = (F32)((side_dir << 1) - 1) * axis * HORIZON_DIST;
-
- vtx = side_dir << curr_bit;
- *(verticesp++) = v_agent[vtx];
- *(verticesp++) = v_agent[vtx | 1 << j_bit];
- *(verticesp++) = v_agent[vtx | 1 << i_bit];
- *(verticesp++) = v_agent[vtx | 1 << i_bit | 1 << j_bit];
-
- *(texCoordsp++) = TEX00;
- *(texCoordsp++) = TEX01;
- *(texCoordsp++) = TEX10;
- *(texCoordsp++) = TEX11;
-
- // Triangles for each side
- *indicesp++ = index_offset + 0;
- *indicesp++ = index_offset + 1;
- *indicesp++ = index_offset + 3;
-
- *indicesp++ = index_offset + 0;
- *indicesp++ = index_offset + 3;
- *indicesp++ = index_offset + 2;
-
- buff->unmapBuffer();
- }
- }
-
- const LLVector3 &look_at = LLViewerCamera::getInstance()->getAtAxis();
- LLVector3 right = look_at % LLVector3::z_axis;
- LLVector3 up = right % look_at;
- right.normalize();
- up.normalize();
+ if (mFace[FACE_REFLECTION] == NULL)
+ {
+ LLDrawPoolWater *poolp = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER);
+ if (gPipeline.getPool(LLDrawPool::POOL_WATER)->getShaderLevel() != 0)
+ {
+ mFace[FACE_REFLECTION] = drawable->addFace(poolp, NULL);
+ }
+ }
+
+ mCameraPosAgent = drawable->getPositionAgent();
+
+ mEarthCenter.mV[0] = mCameraPosAgent.mV[0];
+ mEarthCenter.mV[1] = mCameraPosAgent.mV[1];
+
+ LLVector3 v_agent[8];
+ for (S32 i = 0; i < 8; ++i)
+ {
+ F32 x_sgn = (i&1) ? 1.f : -1.f;
+ F32 y_sgn = (i&2) ? 1.f : -1.f;
+ F32 z_sgn = (i&4) ? 1.f : -1.f;
+ v_agent[i] = HORIZON_DIST * SKY_BOX_MULT * LLVector3(x_sgn, y_sgn, z_sgn);
+ }
+
+ LLStrider<LLVector3> verticesp;
+ LLStrider<LLVector3> normalsp;
+ LLStrider<LLVector2> texCoordsp;
+ LLStrider<U16> indicesp;
+ U16 index_offset;
+ LLFace *face;
+
+ for (S32 side = 0; side < NUM_CUBEMAP_FACES; ++side)
+ {
+ face = mFace[FACE_SIDE0 + side];
+
+ if (!face->getVertexBuffer())
+ {
+ face->setSize(4, 6);
+ face->setGeomIndex(0);
+ face->setIndicesIndex(0);
+ LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK);
+ buff->allocateBuffer(4, 6);
+ face->setVertexBuffer(buff);
+
+ index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
+
+ S32 vtx = 0;
+ S32 curr_bit = side >> 1; // 0/1 = Z axis, 2/3 = Y, 4/5 = X
+ S32 side_dir = side & 1; // even - 0, odd - 1
+ S32 i_bit = (curr_bit + 2) % 3;
+ S32 j_bit = (i_bit + 2) % 3;
+
+ LLVector3 axis;
+ axis.mV[curr_bit] = 1;
+ face->mCenterAgent = (F32)((side_dir << 1) - 1) * axis * HORIZON_DIST;
+
+ vtx = side_dir << curr_bit;
+ *(verticesp++) = v_agent[vtx];
+ *(verticesp++) = v_agent[vtx | 1 << j_bit];
+ *(verticesp++) = v_agent[vtx | 1 << i_bit];
+ *(verticesp++) = v_agent[vtx | 1 << i_bit | 1 << j_bit];
+
+ *(texCoordsp++) = TEX00;
+ *(texCoordsp++) = TEX01;
+ *(texCoordsp++) = TEX10;
+ *(texCoordsp++) = TEX11;
+
+ // Triangles for each side
+ *indicesp++ = index_offset + 0;
+ *indicesp++ = index_offset + 1;
+ *indicesp++ = index_offset + 3;
+
+ *indicesp++ = index_offset + 0;
+ *indicesp++ = index_offset + 3;
+ *indicesp++ = index_offset + 2;
+
+ buff->unmapBuffer();
+ }
+ }
+
+ const LLVector3 &look_at = LLViewerCamera::getInstance()->getAtAxis();
+ LLVector3 right = look_at % LLVector3::z_axis;
+ LLVector3 up = right % look_at;
+ right.normalize();
+ up.normalize();
bool draw_sun = updateHeavenlyBodyGeometry(drawable, mSunScale, FACE_SUN, mSun, up, right);
bool draw_moon = updateHeavenlyBodyGeometry(drawable, mMoonScale, FACE_MOON, mMoon, up, right);
@@ -1061,468 +1061,468 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
draw_sun &= LLEnvironment::getInstance()->getIsSunUp();
draw_moon &= LLEnvironment::getInstance()->getIsMoonUp();
- mSun.setDraw(draw_sun);
- mMoon.setDraw(draw_moon);
+ mSun.setDraw(draw_sun);
+ mMoon.setDraw(draw_moon);
- const F32 water_height = gAgent.getRegion()->getWaterHeight() + 0.01f;
- // LLWorld::getInstance()->getWaterHeight() + 0.01f;
- const F32 camera_height = mCameraPosAgent.mV[2];
- const F32 height_above_water = camera_height - water_height;
+ const F32 water_height = gAgent.getRegion()->getWaterHeight() + 0.01f;
+ // LLWorld::getInstance()->getWaterHeight() + 0.01f;
+ const F32 camera_height = mCameraPosAgent.mV[2];
+ const F32 height_above_water = camera_height - water_height;
- bool sun_flag = FALSE;
- if (mSun.isVisible())
- {
+ bool sun_flag = FALSE;
+ if (mSun.isVisible())
+ {
sun_flag = !mMoon.isVisible() || ((look_at * mSun.getDirection()) > 0);
- }
+ }
bool above_water = (height_above_water > 0);
bool render_ref = above_water && gPipeline.getPool(LLDrawPool::POOL_WATER)->getShaderLevel() == 0;
setDrawRefl(above_water ? (sun_flag ? 0 : 1) : -1);
- if (render_ref)
- {
- updateReflectionGeometry(drawable, height_above_water, mSun);
- }
+ if (render_ref)
+ {
+ updateReflectionGeometry(drawable, height_above_water, mSun);
+ }
- LLPipeline::sCompiles++;
- return TRUE;
+ LLPipeline::sCompiles++;
+ return TRUE;
}
bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const S32 f, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right)
{
- mHeavenlyBodyUpdated = TRUE ;
+ mHeavenlyBodyUpdated = TRUE ;
- LLStrider<LLVector3> verticesp;
- LLStrider<LLVector3> normalsp;
- LLStrider<LLVector2> texCoordsp;
- LLStrider<U16> indicesp;
- S32 index_offset;
- LLFace *facep;
+ LLStrider<LLVector3> verticesp;
+ LLStrider<LLVector3> normalsp;
+ LLStrider<LLVector2> texCoordsp;
+ LLStrider<U16> indicesp;
+ S32 index_offset;
+ LLFace *facep;
LLQuaternion rot = hb.getRotation();
- LLVector3 to_dir = LLVector3::x_axis * rot;
+ LLVector3 to_dir = LLVector3::x_axis * rot;
LLVector3 hb_right = to_dir % LLVector3::z_axis;
- LLVector3 hb_up = hb_right % to_dir;
+ LLVector3 hb_up = hb_right % to_dir;
// at zenith so math below fails spectacularly
if ((to_dir * LLVector3::z_axis) > 0.99f)
- {
+ {
hb_right = LLVector3::y_axis_neg * rot;
- hb_up = LLVector3::z_axis * rot;
- }
+ hb_up = LLVector3::z_axis * rot;
+ }
- LLVector3 draw_pos = to_dir * HEAVENLY_BODY_DIST;
+ LLVector3 draw_pos = to_dir * HEAVENLY_BODY_DIST;
- hb_right.normalize();
- hb_up.normalize();
+ hb_right.normalize();
+ hb_up.normalize();
- const F32 enlargm_factor = ( 1 - to_dir.mV[2] );
- F32 horiz_enlargement = 1 + enlargm_factor * 0.3f;
- F32 vert_enlargement = 1 + enlargm_factor * 0.2f;
+ const F32 enlargm_factor = ( 1 - to_dir.mV[2] );
+ F32 horiz_enlargement = 1 + enlargm_factor * 0.3f;
+ F32 vert_enlargement = 1 + enlargm_factor * 0.2f;
- const LLVector3 scaled_right = horiz_enlargement * scale * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_right;
- const LLVector3 scaled_up = vert_enlargement * scale * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_up;
+ const LLVector3 scaled_right = horiz_enlargement * scale * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_right;
+ const LLVector3 scaled_up = vert_enlargement * scale * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_up;
- LLVector3 v_clipped[4];
+ LLVector3 v_clipped[4];
- v_clipped[0] = draw_pos - scaled_right + scaled_up;
- v_clipped[1] = draw_pos - scaled_right - scaled_up;
- v_clipped[2] = draw_pos + scaled_right + scaled_up;
- v_clipped[3] = draw_pos + scaled_right - scaled_up;
+ v_clipped[0] = draw_pos - scaled_right + scaled_up;
+ v_clipped[1] = draw_pos - scaled_right - scaled_up;
+ v_clipped[2] = draw_pos + scaled_right + scaled_up;
+ v_clipped[3] = draw_pos + scaled_right - scaled_up;
- hb.setVisible(TRUE);
+ hb.setVisible(TRUE);
- facep = mFace[f];
+ facep = mFace[f];
- if (!facep->getVertexBuffer())
- {
- facep->setSize(4, 6);
- LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK);
- if (!buff->allocateBuffer(facep->getGeomCount(), facep->getIndicesCount()))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
- << facep->getGeomCount() << " vertices and "
- << facep->getIndicesCount() << " indices" << LL_ENDL;
- }
- facep->setGeomIndex(0);
- facep->setIndicesIndex(0);
- facep->setVertexBuffer(buff);
- }
+ if (!facep->getVertexBuffer())
+ {
+ facep->setSize(4, 6);
+ LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK);
+ if (!buff->allocateBuffer(facep->getGeomCount(), facep->getIndicesCount()))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
+ << facep->getGeomCount() << " vertices and "
+ << facep->getIndicesCount() << " indices" << LL_ENDL;
+ }
+ facep->setGeomIndex(0);
+ facep->setIndicesIndex(0);
+ facep->setVertexBuffer(buff);
+ }
- llassert(facep->getVertexBuffer()->getNumIndices() == 6);
+ llassert(facep->getVertexBuffer()->getNumIndices() == 6);
- index_offset = facep->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
+ index_offset = facep->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
- if (-1 == index_offset)
- {
- return TRUE;
- }
+ if (-1 == index_offset)
+ {
+ return TRUE;
+ }
- for (S32 vtx = 0; vtx < 4; ++vtx)
- {
- hb.corner(vtx) = v_clipped[vtx];
- *(verticesp++) = hb.corner(vtx) + mCameraPosAgent;
- }
+ for (S32 vtx = 0; vtx < 4; ++vtx)
+ {
+ hb.corner(vtx) = v_clipped[vtx];
+ *(verticesp++) = hb.corner(vtx) + mCameraPosAgent;
+ }
- *(texCoordsp++) = TEX01;
- *(texCoordsp++) = TEX00;
- *(texCoordsp++) = TEX11;
- *(texCoordsp++) = TEX10;
+ *(texCoordsp++) = TEX01;
+ *(texCoordsp++) = TEX00;
+ *(texCoordsp++) = TEX11;
+ *(texCoordsp++) = TEX10;
- *indicesp++ = index_offset + 0;
- *indicesp++ = index_offset + 2;
- *indicesp++ = index_offset + 1;
+ *indicesp++ = index_offset + 0;
+ *indicesp++ = index_offset + 2;
+ *indicesp++ = index_offset + 1;
- *indicesp++ = index_offset + 1;
- *indicesp++ = index_offset + 2;
- *indicesp++ = index_offset + 3;
+ *indicesp++ = index_offset + 1;
+ *indicesp++ = index_offset + 2;
+ *indicesp++ = index_offset + 3;
- facep->getVertexBuffer()->unmapBuffer();
+ facep->getVertexBuffer()->unmapBuffer();
- return TRUE;
+ return TRUE;
}
F32 dtReflection(const LLVector3& p, F32 cos_dir_from_top, F32 sin_dir_from_top, F32 diff_angl_dir)
{
- LLVector3 P = p;
- P.normalize();
+ LLVector3 P = p;
+ P.normalize();
- const F32 cos_dir_angle = -P.mV[VZ];
- const F32 sin_dir_angle = sqrt(1 - cos_dir_angle * cos_dir_angle);
+ const F32 cos_dir_angle = -P.mV[VZ];
+ const F32 sin_dir_angle = sqrt(1 - cos_dir_angle * cos_dir_angle);
- F32 cos_diff_angles = cos_dir_angle * cos_dir_from_top
- + sin_dir_angle * sin_dir_from_top;
+ F32 cos_diff_angles = cos_dir_angle * cos_dir_from_top
+ + sin_dir_angle * sin_dir_from_top;
- F32 diff_angles;
- if (cos_diff_angles > (1 - 1e-7))
- diff_angles = 0;
- else
- diff_angles = acos(cos_diff_angles);
+ F32 diff_angles;
+ if (cos_diff_angles > (1 - 1e-7))
+ diff_angles = 0;
+ else
+ diff_angles = acos(cos_diff_angles);
- const F32 rel_diff_angles = diff_angles / diff_angl_dir;
- const F32 dt = 1 - rel_diff_angles;
+ const F32 rel_diff_angles = diff_angles / diff_angl_dir;
+ const F32 dt = 1 - rel_diff_angles;
- return (dt < 0) ? 0 : dt;
+ return (dt < 0) ? 0 : dt;
}
F32 dtClip(const LLVector3& v0, const LLVector3& v1, F32 far_clip2)
{
- F32 dt_clip;
- const LLVector3 otrezok = v1 - v0;
- const F32 A = otrezok.lengthSquared();
- const F32 B = v0 * otrezok;
- const F32 C = v0.lengthSquared() - far_clip2;
- const F32 det = sqrt(B*B - A*C);
- dt_clip = (-B - det) / A;
- if ((dt_clip < 0) || (dt_clip > 1))
- dt_clip = (-B + det) / A;
- return dt_clip;
+ F32 dt_clip;
+ const LLVector3 otrezok = v1 - v0;
+ const F32 A = otrezok.lengthSquared();
+ const F32 B = v0 * otrezok;
+ const F32 C = v0.lengthSquared() - far_clip2;
+ const F32 det = sqrt(B*B - A*C);
+ dt_clip = (-B - det) / A;
+ if ((dt_clip < 0) || (dt_clip > 1))
+ dt_clip = (-B + det) / A;
+ return dt_clip;
}
void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H,
- const LLHeavenBody& HB)
+ const LLHeavenBody& HB)
{
- const LLVector3 &look_at = LLViewerCamera::getInstance()->getAtAxis();
- // const F32 water_height = gAgent.getRegion()->getWaterHeight() + 0.001f;
- // LLWorld::getInstance()->getWaterHeight() + 0.001f;
+ const LLVector3 &look_at = LLViewerCamera::getInstance()->getAtAxis();
+ // const F32 water_height = gAgent.getRegion()->getWaterHeight() + 0.001f;
+ // LLWorld::getInstance()->getWaterHeight() + 0.001f;
+
+ LLVector3 to_dir = HB.getDirection();
+ LLVector3 hb_pos = to_dir * (HORIZON_DIST - 10);
+ LLVector3 to_dir_proj = to_dir;
+ to_dir_proj.mV[VZ] = 0;
+ to_dir_proj.normalize();
+
+ LLVector3 Right = to_dir % LLVector3::z_axis;
+ LLVector3 Up = Right % to_dir;
+ Right.normalize();
+ Up.normalize();
+
+ // finding angle between look direction and sprite.
+ LLVector3 look_at_right = look_at % LLVector3::z_axis;
+ look_at_right.normalize();
+
+ const F32 enlargm_factor = ( 1 - to_dir.mV[2] );
+ F32 horiz_enlargement = 1 + enlargm_factor * 0.3f;
+ F32 vert_enlargement = 1 + enlargm_factor * 0.2f;
+
+ F32 vert_size = vert_enlargement * HEAVENLY_BODY_SCALE * HB.getDiskRadius();
+ Right *= /*cos_lookAt_toDir */ horiz_enlargement * HEAVENLY_BODY_SCALE * HB.getDiskRadius();
+ Up *= vert_size;
+
+ LLVector3 v_corner[2];
+ LLVector3 stretch_corner[2];
+
+ LLVector3 top_hb = v_corner[0] = stretch_corner[0] = hb_pos - Right + Up;
+ v_corner[1] = stretch_corner[1] = hb_pos - Right - Up;
+
+ LLVector2 TEX0t = TEX00;
+ LLVector2 TEX1t = TEX10;
+ LLVector3 lower_corner = v_corner[1];
- LLVector3 to_dir = HB.getDirection();
- LLVector3 hb_pos = to_dir * (HORIZON_DIST - 10);
- LLVector3 to_dir_proj = to_dir;
- to_dir_proj.mV[VZ] = 0;
- to_dir_proj.normalize();
+ top_hb.normalize();
+ const F32 cos_angle_of_view = fabs(top_hb.mV[VZ]);
+ const F32 extension = llmin (5.0f, 1.0f / cos_angle_of_view);
- LLVector3 Right = to_dir % LLVector3::z_axis;
- LLVector3 Up = Right % to_dir;
- Right.normalize();
- Up.normalize();
+ const S32 cols = 1;
+ const S32 raws = lltrunc(16 * extension);
+ S32 quads = cols * raws;
- // finding angle between look direction and sprite.
- LLVector3 look_at_right = look_at % LLVector3::z_axis;
- look_at_right.normalize();
+ stretch_corner[0] = lower_corner + extension * (stretch_corner[0] - lower_corner);
+ stretch_corner[1] = lower_corner + extension * (stretch_corner[1] - lower_corner);
- const F32 enlargm_factor = ( 1 - to_dir.mV[2] );
- F32 horiz_enlargement = 1 + enlargm_factor * 0.3f;
- F32 vert_enlargement = 1 + enlargm_factor * 0.2f;
+ F32 cos_dir_from_top[2];
- F32 vert_size = vert_enlargement * HEAVENLY_BODY_SCALE * HB.getDiskRadius();
- Right *= /*cos_lookAt_toDir */ horiz_enlargement * HEAVENLY_BODY_SCALE * HB.getDiskRadius();
- Up *= vert_size;
+ LLVector3 dir = stretch_corner[0];
+ dir.normalize();
+ cos_dir_from_top[0] = dir.mV[VZ];
- LLVector3 v_corner[2];
- LLVector3 stretch_corner[2];
-
- LLVector3 top_hb = v_corner[0] = stretch_corner[0] = hb_pos - Right + Up;
- v_corner[1] = stretch_corner[1] = hb_pos - Right - Up;
-
- LLVector2 TEX0t = TEX00;
- LLVector2 TEX1t = TEX10;
- LLVector3 lower_corner = v_corner[1];
+ dir = stretch_corner[1];
+ dir.normalize();
+ cos_dir_from_top[1] = dir.mV[VZ];
- top_hb.normalize();
- const F32 cos_angle_of_view = fabs(top_hb.mV[VZ]);
- const F32 extension = llmin (5.0f, 1.0f / cos_angle_of_view);
-
- const S32 cols = 1;
- const S32 raws = lltrunc(16 * extension);
- S32 quads = cols * raws;
-
- stretch_corner[0] = lower_corner + extension * (stretch_corner[0] - lower_corner);
- stretch_corner[1] = lower_corner + extension * (stretch_corner[1] - lower_corner);
-
- F32 cos_dir_from_top[2];
-
- LLVector3 dir = stretch_corner[0];
- dir.normalize();
- cos_dir_from_top[0] = dir.mV[VZ];
-
- dir = stretch_corner[1];
- dir.normalize();
- cos_dir_from_top[1] = dir.mV[VZ];
-
- const F32 sin_dir_from_top = sqrt(1 - cos_dir_from_top[0] * cos_dir_from_top[0]);
- const F32 sin_dir_from_top2 = sqrt(1 - cos_dir_from_top[1] * cos_dir_from_top[1]);
- const F32 cos_diff_dir = cos_dir_from_top[0] * cos_dir_from_top[1]
- + sin_dir_from_top * sin_dir_from_top2;
- const F32 diff_angl_dir = acos(cos_diff_dir);
-
- v_corner[0] = stretch_corner[0];
- v_corner[1] = lower_corner;
-
-
- LLVector2 TEX0tt = TEX01;
- LLVector2 TEX1tt = TEX11;
-
- LLVector3 v_refl_corner[4];
- LLVector3 v_sprite_corner[4];
-
- S32 vtx;
- for (vtx = 0; vtx < 2; ++vtx)
- {
- LLVector3 light_proj = v_corner[vtx];
- light_proj.normalize();
-
- const F32 z = light_proj.mV[VZ];
- const F32 sin_angle = sqrt(1 - z * z);
- light_proj *= 1.f / sin_angle;
- light_proj.mV[VZ] = 0;
- const F32 to_refl_point = H * sin_angle / fabs(z);
-
- v_refl_corner[vtx] = to_refl_point * light_proj;
- }
-
-
- for (vtx = 2; vtx < 4; ++vtx)
- {
- const LLVector3 to_dir_vec = (to_dir_proj * v_refl_corner[vtx-2]) * to_dir_proj;
- v_refl_corner[vtx] = v_refl_corner[vtx-2] + 2 * (to_dir_vec - v_refl_corner[vtx-2]);
- }
-
- for (vtx = 0; vtx < 4; ++vtx)
- v_refl_corner[vtx].mV[VZ] -= H;
-
- S32 side = 0;
- LLVector3 refl_corn_norm[2];
- refl_corn_norm[0] = v_refl_corner[1];
- refl_corn_norm[0].normalize();
- refl_corn_norm[1] = v_refl_corner[3];
- refl_corn_norm[1].normalize();
-
- F32 cos_refl_look_at[2];
- cos_refl_look_at[0] = refl_corn_norm[0] * look_at;
- cos_refl_look_at[1] = refl_corn_norm[1] * look_at;
+ const F32 sin_dir_from_top = sqrt(1 - cos_dir_from_top[0] * cos_dir_from_top[0]);
+ const F32 sin_dir_from_top2 = sqrt(1 - cos_dir_from_top[1] * cos_dir_from_top[1]);
+ const F32 cos_diff_dir = cos_dir_from_top[0] * cos_dir_from_top[1]
+ + sin_dir_from_top * sin_dir_from_top2;
+ const F32 diff_angl_dir = acos(cos_diff_dir);
- if (cos_refl_look_at[1] > cos_refl_look_at[0])
- {
- side = 2;
- }
+ v_corner[0] = stretch_corner[0];
+ v_corner[1] = lower_corner;
- //const F32 far_clip = (LLViewerCamera::getInstance()->getFar() - 0.01) / far_clip_factor;
- const F32 far_clip = 512;
- const F32 far_clip2 = far_clip*far_clip;
- F32 dt_clip;
- F32 vtx_near2, vtx_far2;
+ LLVector2 TEX0tt = TEX01;
+ LLVector2 TEX1tt = TEX11;
- if ((vtx_far2 = v_refl_corner[side].lengthSquared()) > far_clip2)
- {
- // whole thing is sprite: reflection is beyond far clip plane.
- dt_clip = 1.1f;
- quads = 1;
- }
- else if ((vtx_near2 = v_refl_corner[side+1].lengthSquared()) > far_clip2)
- {
- // part is reflection, the rest is sprite.
- dt_clip = dtClip(v_refl_corner[side + 1], v_refl_corner[side], far_clip2);
- const LLVector3 P = (1 - dt_clip) * v_refl_corner[side + 1] + dt_clip * v_refl_corner[side];
-
- F32 dt_tex = dtReflection(P, cos_dir_from_top[0], sin_dir_from_top, diff_angl_dir);
-
- TEX0tt = LLVector2(0, dt_tex);
- TEX1tt = LLVector2(1, dt_tex);
- quads++;
- }
- else
- {
- // whole thing is correct reflection.
- dt_clip = -0.1f;
- }
-
- LLFace *face = mFace[FACE_REFLECTION];
+ LLVector3 v_refl_corner[4];
+ LLVector3 v_sprite_corner[4];
+
+ S32 vtx;
+ for (vtx = 0; vtx < 2; ++vtx)
+ {
+ LLVector3 light_proj = v_corner[vtx];
+ light_proj.normalize();
+
+ const F32 z = light_proj.mV[VZ];
+ const F32 sin_angle = sqrt(1 - z * z);
+ light_proj *= 1.f / sin_angle;
+ light_proj.mV[VZ] = 0;
+ const F32 to_refl_point = H * sin_angle / fabs(z);
+
+ v_refl_corner[vtx] = to_refl_point * light_proj;
+ }
+
+
+ for (vtx = 2; vtx < 4; ++vtx)
+ {
+ const LLVector3 to_dir_vec = (to_dir_proj * v_refl_corner[vtx-2]) * to_dir_proj;
+ v_refl_corner[vtx] = v_refl_corner[vtx-2] + 2 * (to_dir_vec - v_refl_corner[vtx-2]);
+ }
+
+ for (vtx = 0; vtx < 4; ++vtx)
+ v_refl_corner[vtx].mV[VZ] -= H;
+
+ S32 side = 0;
+ LLVector3 refl_corn_norm[2];
+ refl_corn_norm[0] = v_refl_corner[1];
+ refl_corn_norm[0].normalize();
+ refl_corn_norm[1] = v_refl_corner[3];
+ refl_corn_norm[1].normalize();
+
+ F32 cos_refl_look_at[2];
+ cos_refl_look_at[0] = refl_corn_norm[0] * look_at;
+ cos_refl_look_at[1] = refl_corn_norm[1] * look_at;
+
+ if (cos_refl_look_at[1] > cos_refl_look_at[0])
+ {
+ side = 2;
+ }
+
+ //const F32 far_clip = (LLViewerCamera::getInstance()->getFar() - 0.01) / far_clip_factor;
+ const F32 far_clip = 512;
+ const F32 far_clip2 = far_clip*far_clip;
+
+ F32 dt_clip;
+ F32 vtx_near2, vtx_far2;
+
+ if ((vtx_far2 = v_refl_corner[side].lengthSquared()) > far_clip2)
+ {
+ // whole thing is sprite: reflection is beyond far clip plane.
+ dt_clip = 1.1f;
+ quads = 1;
+ }
+ else if ((vtx_near2 = v_refl_corner[side+1].lengthSquared()) > far_clip2)
+ {
+ // part is reflection, the rest is sprite.
+ dt_clip = dtClip(v_refl_corner[side + 1], v_refl_corner[side], far_clip2);
+ const LLVector3 P = (1 - dt_clip) * v_refl_corner[side + 1] + dt_clip * v_refl_corner[side];
+
+ F32 dt_tex = dtReflection(P, cos_dir_from_top[0], sin_dir_from_top, diff_angl_dir);
+
+ TEX0tt = LLVector2(0, dt_tex);
+ TEX1tt = LLVector2(1, dt_tex);
+ quads++;
+ }
+ else
+ {
+ // whole thing is correct reflection.
+ dt_clip = -0.1f;
+ }
+
+ LLFace *face = mFace[FACE_REFLECTION];
if (face)
{
- if (!face->getVertexBuffer() || quads*4 != face->getGeomCount())
- {
- face->setSize(quads * 4, quads * 6);
- LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK);
- if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount()))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
- << face->getGeomCount() << " vertices and "
- << face->getIndicesCount() << " indices" << LL_ENDL;
- }
- face->setIndicesIndex(0);
- face->setGeomIndex(0);
- face->setVertexBuffer(buff);
- }
-
- LLStrider<LLVector3> verticesp;
- LLStrider<LLVector3> normalsp;
- LLStrider<LLVector2> texCoordsp;
- LLStrider<U16> indicesp;
- S32 index_offset;
-
- index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
- if (-1 == index_offset)
- {
- return;
- }
-
- LLColor3 hb_col3 = HB.getInterpColor();
- hb_col3.clamp();
- const LLColor4 hb_col = LLColor4(hb_col3);
-
- const F32 min_attenuation = 0.4f;
- const F32 max_attenuation = 0.7f;
- const F32 attenuation = min_attenuation
- + cos_angle_of_view * (max_attenuation - min_attenuation);
+ if (!face->getVertexBuffer() || quads*4 != face->getGeomCount())
+ {
+ face->setSize(quads * 4, quads * 6);
+ LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK);
+ if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount()))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
+ << face->getGeomCount() << " vertices and "
+ << face->getIndicesCount() << " indices" << LL_ENDL;
+ }
+ face->setIndicesIndex(0);
+ face->setGeomIndex(0);
+ face->setVertexBuffer(buff);
+ }
+
+ LLStrider<LLVector3> verticesp;
+ LLStrider<LLVector3> normalsp;
+ LLStrider<LLVector2> texCoordsp;
+ LLStrider<U16> indicesp;
+ S32 index_offset;
+
+ index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
+ if (-1 == index_offset)
+ {
+ return;
+ }
+
+ LLColor3 hb_col3 = HB.getInterpColor();
+ hb_col3.clamp();
+ const LLColor4 hb_col = LLColor4(hb_col3);
+
+ const F32 min_attenuation = 0.4f;
+ const F32 max_attenuation = 0.7f;
+ const F32 attenuation = min_attenuation
+ + cos_angle_of_view * (max_attenuation - min_attenuation);
LLColor4 hb_refl_col = (1 - attenuation) * hb_col + attenuation * getSkyFogColor();
- face->setFaceColor(hb_refl_col);
-
- LLVector3 v_far[2];
- v_far[0] = v_refl_corner[1];
- v_far[1] = v_refl_corner[3];
-
- if(dt_clip > 0)
- {
- if (dt_clip >= 1)
- {
- for (S32 vtx = 0; vtx < 4; ++vtx)
- {
- F32 ratio = far_clip / v_refl_corner[vtx].length();
- *(verticesp++) = v_refl_corner[vtx] = ratio * v_refl_corner[vtx] + mCameraPosAgent;
- }
- const LLVector3 draw_pos = 0.25 *
- (v_refl_corner[0] + v_refl_corner[1] + v_refl_corner[2] + v_refl_corner[3]);
- face->mCenterAgent = draw_pos;
- }
- else
- {
- F32 ratio = far_clip / v_refl_corner[1].length();
- v_sprite_corner[1] = v_refl_corner[1] * ratio;
-
- ratio = far_clip / v_refl_corner[3].length();
- v_sprite_corner[3] = v_refl_corner[3] * ratio;
-
- v_refl_corner[1] = (1 - dt_clip) * v_refl_corner[1] + dt_clip * v_refl_corner[0];
- v_refl_corner[3] = (1 - dt_clip) * v_refl_corner[3] + dt_clip * v_refl_corner[2];
- v_sprite_corner[0] = v_refl_corner[1];
- v_sprite_corner[2] = v_refl_corner[3];
-
- for (S32 vtx = 0; vtx < 4; ++vtx)
- {
- *(verticesp++) = v_sprite_corner[vtx] + mCameraPosAgent;
- }
-
- const LLVector3 draw_pos = 0.25 *
- (v_refl_corner[0] + v_sprite_corner[1] + v_refl_corner[2] + v_sprite_corner[3]);
- face->mCenterAgent = draw_pos;
- }
-
- *(texCoordsp++) = TEX0tt;
- *(texCoordsp++) = TEX0t;
- *(texCoordsp++) = TEX1tt;
- *(texCoordsp++) = TEX1t;
-
- *indicesp++ = index_offset + 0;
- *indicesp++ = index_offset + 2;
- *indicesp++ = index_offset + 1;
-
- *indicesp++ = index_offset + 1;
- *indicesp++ = index_offset + 2;
- *indicesp++ = index_offset + 3;
-
- index_offset += 4;
- }
-
- if (dt_clip < 1)
- {
- if (dt_clip <= 0)
- {
- const LLVector3 draw_pos = 0.25 *
- (v_refl_corner[0] + v_refl_corner[1] + v_refl_corner[2] + v_refl_corner[3]);
- face->mCenterAgent = draw_pos;
- }
-
- const F32 raws_inv = 1.f/raws;
- const F32 cols_inv = 1.f/cols;
- LLVector3 left = v_refl_corner[0] - v_refl_corner[1];
- LLVector3 right = v_refl_corner[2] - v_refl_corner[3];
- left *= raws_inv;
- right *= raws_inv;
-
- for (S32 raw = 0; raw < raws; ++raw)
- {
- F32 dt_v0 = raw * raws_inv;
- F32 dt_v1 = (raw + 1) * raws_inv;
- const LLVector3 BL = v_refl_corner[1] + (F32)raw * left;
- const LLVector3 BR = v_refl_corner[3] + (F32)raw * right;
- const LLVector3 EL = BL + left;
- const LLVector3 ER = BR + right;
- dt_v0 = dt_v1 = dtReflection(EL, cos_dir_from_top[0], sin_dir_from_top, diff_angl_dir);
- for (S32 col = 0; col < cols; ++col)
- {
- F32 dt_h0 = col * cols_inv;
- *(verticesp++) = (1 - dt_h0) * EL + dt_h0 * ER + mCameraPosAgent;
- *(verticesp++) = (1 - dt_h0) * BL + dt_h0 * BR + mCameraPosAgent;
- F32 dt_h1 = (col + 1) * cols_inv;
- *(verticesp++) = (1 - dt_h1) * EL + dt_h1 * ER + mCameraPosAgent;
- *(verticesp++) = (1 - dt_h1) * BL + dt_h1 * BR + mCameraPosAgent;
+ face->setFaceColor(hb_refl_col);
+
+ LLVector3 v_far[2];
+ v_far[0] = v_refl_corner[1];
+ v_far[1] = v_refl_corner[3];
+
+ if(dt_clip > 0)
+ {
+ if (dt_clip >= 1)
+ {
+ for (S32 vtx = 0; vtx < 4; ++vtx)
+ {
+ F32 ratio = far_clip / v_refl_corner[vtx].length();
+ *(verticesp++) = v_refl_corner[vtx] = ratio * v_refl_corner[vtx] + mCameraPosAgent;
+ }
+ const LLVector3 draw_pos = 0.25 *
+ (v_refl_corner[0] + v_refl_corner[1] + v_refl_corner[2] + v_refl_corner[3]);
+ face->mCenterAgent = draw_pos;
+ }
+ else
+ {
+ F32 ratio = far_clip / v_refl_corner[1].length();
+ v_sprite_corner[1] = v_refl_corner[1] * ratio;
- *(texCoordsp++) = LLVector2(dt_h0, dt_v1);
- *(texCoordsp++) = LLVector2(dt_h0, dt_v0);
- *(texCoordsp++) = LLVector2(dt_h1, dt_v1);
- *(texCoordsp++) = LLVector2(dt_h1, dt_v0);
+ ratio = far_clip / v_refl_corner[3].length();
+ v_sprite_corner[3] = v_refl_corner[3] * ratio;
- *indicesp++ = index_offset + 0;
- *indicesp++ = index_offset + 2;
- *indicesp++ = index_offset + 1;
+ v_refl_corner[1] = (1 - dt_clip) * v_refl_corner[1] + dt_clip * v_refl_corner[0];
+ v_refl_corner[3] = (1 - dt_clip) * v_refl_corner[3] + dt_clip * v_refl_corner[2];
+ v_sprite_corner[0] = v_refl_corner[1];
+ v_sprite_corner[2] = v_refl_corner[3];
- *indicesp++ = index_offset + 1;
- *indicesp++ = index_offset + 2;
- *indicesp++ = index_offset + 3;
+ for (S32 vtx = 0; vtx < 4; ++vtx)
+ {
+ *(verticesp++) = v_sprite_corner[vtx] + mCameraPosAgent;
+ }
+
+ const LLVector3 draw_pos = 0.25 *
+ (v_refl_corner[0] + v_sprite_corner[1] + v_refl_corner[2] + v_sprite_corner[3]);
+ face->mCenterAgent = draw_pos;
+ }
+
+ *(texCoordsp++) = TEX0tt;
+ *(texCoordsp++) = TEX0t;
+ *(texCoordsp++) = TEX1tt;
+ *(texCoordsp++) = TEX1t;
+
+ *indicesp++ = index_offset + 0;
+ *indicesp++ = index_offset + 2;
+ *indicesp++ = index_offset + 1;
- index_offset += 4;
- }
- }
- }
+ *indicesp++ = index_offset + 1;
+ *indicesp++ = index_offset + 2;
+ *indicesp++ = index_offset + 3;
+
+ index_offset += 4;
+ }
+
+ if (dt_clip < 1)
+ {
+ if (dt_clip <= 0)
+ {
+ const LLVector3 draw_pos = 0.25 *
+ (v_refl_corner[0] + v_refl_corner[1] + v_refl_corner[2] + v_refl_corner[3]);
+ face->mCenterAgent = draw_pos;
+ }
- face->getVertexBuffer()->unmapBuffer();
+ const F32 raws_inv = 1.f/raws;
+ const F32 cols_inv = 1.f/cols;
+ LLVector3 left = v_refl_corner[0] - v_refl_corner[1];
+ LLVector3 right = v_refl_corner[2] - v_refl_corner[3];
+ left *= raws_inv;
+ right *= raws_inv;
+
+ for (S32 raw = 0; raw < raws; ++raw)
+ {
+ F32 dt_v0 = raw * raws_inv;
+ F32 dt_v1 = (raw + 1) * raws_inv;
+ const LLVector3 BL = v_refl_corner[1] + (F32)raw * left;
+ const LLVector3 BR = v_refl_corner[3] + (F32)raw * right;
+ const LLVector3 EL = BL + left;
+ const LLVector3 ER = BR + right;
+ dt_v0 = dt_v1 = dtReflection(EL, cos_dir_from_top[0], sin_dir_from_top, diff_angl_dir);
+ for (S32 col = 0; col < cols; ++col)
+ {
+ F32 dt_h0 = col * cols_inv;
+ *(verticesp++) = (1 - dt_h0) * EL + dt_h0 * ER + mCameraPosAgent;
+ *(verticesp++) = (1 - dt_h0) * BL + dt_h0 * BR + mCameraPosAgent;
+ F32 dt_h1 = (col + 1) * cols_inv;
+ *(verticesp++) = (1 - dt_h1) * EL + dt_h1 * ER + mCameraPosAgent;
+ *(verticesp++) = (1 - dt_h1) * BL + dt_h1 * BR + mCameraPosAgent;
+
+ *(texCoordsp++) = LLVector2(dt_h0, dt_v1);
+ *(texCoordsp++) = LLVector2(dt_h0, dt_v0);
+ *(texCoordsp++) = LLVector2(dt_h1, dt_v1);
+ *(texCoordsp++) = LLVector2(dt_h1, dt_v0);
+
+ *indicesp++ = index_offset + 0;
+ *indicesp++ = index_offset + 2;
+ *indicesp++ = index_offset + 1;
+
+ *indicesp++ = index_offset + 1;
+ *indicesp++ = index_offset + 2;
+ *indicesp++ = index_offset + 3;
+
+ index_offset += 4;
+ }
+ }
+ }
+
+ face->getVertexBuffer()->unmapBuffer();
}
}
@@ -1530,11 +1530,11 @@ void LLVOSky::updateFog(const F32 distance)
{
LLEnvironment& environment = LLEnvironment::instance();
if (environment.getCurrentSky() != nullptr)
- {
+ {
LLVector3 light_dir = LLVector3(environment.getClampedLightNorm());
m_legacyAtmospherics.updateFog(distance, light_dir);
- }
- }
+ }
+ }
void LLVOSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir_cfr, const LLVector3 &moon_dir_cfr)
{
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index 5941ab6e3b..87f801862c 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvosky.h
* @brief LLVOSky class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,10 +38,10 @@
#include "llsettingssky.h"
#include "lllegacyatmospherics.h"
-const F32 SKY_BOX_MULT = 16.0f;
-const F32 HEAVENLY_BODY_DIST = HORIZON_DIST - 20.f;
-const F32 HEAVENLY_BODY_FACTOR = 0.1f;
-const F32 HEAVENLY_BODY_SCALE = HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR;
+const F32 SKY_BOX_MULT = 16.0f;
+const F32 HEAVENLY_BODY_DIST = HORIZON_DIST - 20.f;
+const F32 HEAVENLY_BODY_FACTOR = 0.1f;
+const F32 HEAVENLY_BODY_SCALE = HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR;
const F32 SKYTEX_COMPONENTS = 4;
const F32 SKYTEX_RESOLUTION = 64;
@@ -51,72 +51,72 @@ class LLHaze;
class LLSkyTex
{
- friend class LLVOSky;
+ friend class LLVOSky;
private:
- LLPointer<LLViewerTexture> mTexture[2];
- LLPointer<LLImageRaw> mImageRaw[2];
- LLColor4 *mSkyData;
- LLVector3 *mSkyDirs; // Cache of sky direction vectors
- static S32 sCurrent;
+ LLPointer<LLViewerTexture> mTexture[2];
+ LLPointer<LLImageRaw> mImageRaw[2];
+ LLColor4 *mSkyData;
+ LLVector3 *mSkyDirs; // Cache of sky direction vectors
+ static S32 sCurrent;
public:
- void bindTexture(BOOL curr = TRUE);
-
+ void bindTexture(BOOL curr = TRUE);
+
protected:
- LLSkyTex();
- void init(bool isShiny);
- void cleanupGL();
- void restoreGL();
-
- ~LLSkyTex();
-
-
- static S32 getResolution();
- static S32 getCurrent();
- static S32 stepCurrent();
- static S32 getNext();
- static S32 getWhich(const BOOL curr);
-
- void initEmpty(const S32 tex);
-
- void create();
-
- void setDir(const LLVector3 &dir, const S32 i, const S32 j)
- {
- S32 offset = i * SKYTEX_RESOLUTION + j;
- mSkyDirs[offset] = dir;
- }
-
- const LLVector3 &getDir(const S32 i, const S32 j) const
- {
- S32 offset = i * SKYTEX_RESOLUTION + j;
- return mSkyDirs[offset];
- }
-
- void setPixel(const LLColor4 &col, const S32 i, const S32 j)
- {
- S32 offset = i * SKYTEX_RESOLUTION + j;
- mSkyData[offset] = col;
- }
-
- void setPixel(const LLColor4U &col, const S32 i, const S32 j)
- {
- S32 offset = (i * SKYTEX_RESOLUTION + j) * SKYTEX_COMPONENTS;
- U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]);
- *pix = col.asRGBA();
- }
-
- LLColor4U getPixel(const S32 i, const S32 j)
- {
- LLColor4U col;
- S32 offset = (i * SKYTEX_RESOLUTION + j) * SKYTEX_COMPONENTS;
- U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]);
- col.fromRGBA( *pix );
- return col;
- }
-
- LLImageRaw* getImageRaw(BOOL curr=TRUE);
- void createGLImage(BOOL curr=TRUE);
+ LLSkyTex();
+ void init(bool isShiny);
+ void cleanupGL();
+ void restoreGL();
+
+ ~LLSkyTex();
+
+
+ static S32 getResolution();
+ static S32 getCurrent();
+ static S32 stepCurrent();
+ static S32 getNext();
+ static S32 getWhich(const BOOL curr);
+
+ void initEmpty(const S32 tex);
+
+ void create();
+
+ void setDir(const LLVector3 &dir, const S32 i, const S32 j)
+ {
+ S32 offset = i * SKYTEX_RESOLUTION + j;
+ mSkyDirs[offset] = dir;
+ }
+
+ const LLVector3 &getDir(const S32 i, const S32 j) const
+ {
+ S32 offset = i * SKYTEX_RESOLUTION + j;
+ return mSkyDirs[offset];
+ }
+
+ void setPixel(const LLColor4 &col, const S32 i, const S32 j)
+ {
+ S32 offset = i * SKYTEX_RESOLUTION + j;
+ mSkyData[offset] = col;
+ }
+
+ void setPixel(const LLColor4U &col, const S32 i, const S32 j)
+ {
+ S32 offset = (i * SKYTEX_RESOLUTION + j) * SKYTEX_COMPONENTS;
+ U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]);
+ *pix = col.asRGBA();
+ }
+
+ LLColor4U getPixel(const S32 i, const S32 j)
+ {
+ LLColor4U col;
+ S32 offset = (i * SKYTEX_RESOLUTION + j) * SKYTEX_COMPONENTS;
+ U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]);
+ col.fromRGBA( *pix );
+ return col;
+ }
+
+ LLImageRaw* getImageRaw(BOOL curr=TRUE);
+ void createGLImage(BOOL curr=TRUE);
bool mIsShiny;
};
@@ -125,128 +125,128 @@ protected:
class LLHeavenBody
{
protected:
- LLVector3 mDirectionCached; // hack for events that shouldn't happen every frame
+ LLVector3 mDirectionCached; // hack for events that shouldn't happen every frame
- LLColor3 mColor;
- LLColor3 mColorCached;
- F32 mIntensity;
- LLVector3 mDirection; // direction of the local heavenly body
+ LLColor3 mColor;
+ LLColor3 mColorCached;
+ F32 mIntensity;
+ LLVector3 mDirection; // direction of the local heavenly body
LLQuaternion mRotation;
- LLVector3 mAngularVelocity; // velocity of the local heavenly body
+ LLVector3 mAngularVelocity; // velocity of the local heavenly body
- F32 mDiskRadius;
- bool mDraw; // FALSE - do not draw.
- F32 mHorizonVisibility; // number [0, 1] due to how horizon
- F32 mVisibility; // same but due to other objects being in throng.
- bool mVisible;
- static F32 sInterpVal;
- LLVector3 mQuadCorner[4];
- LLVector3 mO;
+ F32 mDiskRadius;
+ bool mDraw; // FALSE - do not draw.
+ F32 mHorizonVisibility; // number [0, 1] due to how horizon
+ F32 mVisibility; // same but due to other objects being in throng.
+ bool mVisible;
+ static F32 sInterpVal;
+ LLVector3 mQuadCorner[4];
+ LLVector3 mO;
public:
- LLHeavenBody(const F32 rad);
- ~LLHeavenBody() {}
+ LLHeavenBody(const F32 rad);
+ ~LLHeavenBody() {}
const LLQuaternion& getRotation() const;
void setRotation(const LLQuaternion& rot);
- const LLVector3& getDirection() const;
- void setDirection(const LLVector3 &direction);
- void setAngularVelocity(const LLVector3 &ang_vel);
- const LLVector3& getAngularVelocity() const;
+ const LLVector3& getDirection() const;
+ void setDirection(const LLVector3 &direction);
+ void setAngularVelocity(const LLVector3 &ang_vel);
+ const LLVector3& getAngularVelocity() const;
- const LLVector3& getDirectionCached() const;
- void renewDirection();
+ const LLVector3& getDirectionCached() const;
+ void renewDirection();
- const LLColor3& getColorCached() const;
- void setColorCached(const LLColor3& c);
- const LLColor3& getColor() const;
- void setColor(const LLColor3& c);
+ const LLColor3& getColorCached() const;
+ void setColorCached(const LLColor3& c);
+ const LLColor3& getColor() const;
+ void setColor(const LLColor3& c);
- void renewColor();
+ void renewColor();
- static F32 interpVal();
- static void setInterpVal(const F32 v);
+ static F32 interpVal();
+ static void setInterpVal(const F32 v);
- LLColor3 getInterpColor() const;
+ LLColor3 getInterpColor() const;
- const F32& getVisibility() const;
- void setVisibility(const F32 c = 1);
+ const F32& getVisibility() const;
+ void setVisibility(const F32 c = 1);
- bool isVisible() const;
- void setVisible(const bool v);
+ bool isVisible() const;
+ void setVisible(const bool v);
- const F32& getIntensity() const;
- void setIntensity(const F32 c);
+ const F32& getIntensity() const;
+ void setIntensity(const F32 c);
- void setDiskRadius(const F32 radius);
- F32 getDiskRadius() const;
+ void setDiskRadius(const F32 radius);
+ F32 getDiskRadius() const;
- void setDraw(const bool draw);
- bool getDraw() const;
+ void setDraw(const bool draw);
+ bool getDraw() const;
- const LLVector3& corner(const S32 n) const;
- LLVector3& corner(const S32 n);
- const LLVector3* corners() const;
+ const LLVector3& corner(const S32 n) const;
+ LLVector3& corner(const S32 n);
+ const LLVector3* corners() const;
};
class LLCubeMap;
class LLVOSky : public LLStaticViewerObject
{
-public:
- enum
- {
- FACE_SIDE0,
- FACE_SIDE1,
- FACE_SIDE2,
- FACE_SIDE3,
- FACE_SIDE4,
- FACE_SIDE5,
- FACE_SUN, // was 6
- FACE_MOON, // was 7
- FACE_BLOOM, // was 8
- FACE_REFLECTION, // was 10
- FACE_COUNT
- };
-
- LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
-
- // Initialize/delete data that's only inited once per class.
- void init();
- void initCubeMap();
-
- void cleanupGL();
- void restoreGL();
+public:
+ enum
+ {
+ FACE_SIDE0,
+ FACE_SIDE1,
+ FACE_SIDE2,
+ FACE_SIDE3,
+ FACE_SIDE4,
+ FACE_SIDE5,
+ FACE_SUN, // was 6
+ FACE_MOON, // was 7
+ FACE_BLOOM, // was 8
+ FACE_REFLECTION, // was 10
+ FACE_COUNT
+ };
+
+ LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+
+ // Initialize/delete data that's only inited once per class.
+ void init();
+ void initCubeMap();
+
+ void cleanupGL();
+ void restoreGL();
void calc();
void cacheEnvironment(LLSettingsSky::ptr_t psky, AtmosphericsVars& atmosphericsVars);
- /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
- bool updateSky();
-
- // Graphical stuff for objects - maybe broken out into render class
- // later?
- /*virtual*/ void updateTextures();
- /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
+ /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
+ bool updateSky();
- const LLHeavenBody& getSun() const { return mSun; }
- const LLHeavenBody& getMoon() const { return mMoon; }
+ // Graphical stuff for objects - maybe broken out into render class
+ // later?
+ /*virtual*/ void updateTextures();
+ /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
+ /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
- bool isSameFace(S32 idx, const LLFace* face) const { return mFace[idx] == face; }
+ const LLHeavenBody& getSun() const { return mSun; }
+ const LLHeavenBody& getMoon() const { return mMoon; }
+
+ bool isSameFace(S32 idx, const LLFace* face) const { return mFace[idx] == face; }
// directions provided should already be in CFR coord sys (+x at, +z up, +y right)
void setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir, const LLVector3 &moon_dir);
void setSunDirectionCFR(const LLVector3 &sun_direction);
void setMoonDirectionCFR(const LLVector3 &moon_direction);
- bool updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const S32 side, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right);
- void updateReflectionGeometry(LLDrawable *drawable, F32 H, const LLHeavenBody& HB);
-
- F32 getWorldScale() const { return mWorldScale; }
- void setWorldScale(const F32 s) { mWorldScale = s; }
- void updateFog(const F32 distance);
+ bool updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const S32 side, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right);
+ void updateReflectionGeometry(LLDrawable *drawable, F32 H, const LLHeavenBody& HB);
+
+ F32 getWorldScale() const { return mWorldScale; }
+ void setWorldScale(const F32 s) { mWorldScale = s; }
+ void updateFog(const F32 distance);
void setFogRatio(const F32 fog_ratio) { m_legacyAtmospherics.setFogRatio(fog_ratio); }
F32 getFogRatio() const { return m_legacyAtmospherics.getFogRatio(); }
@@ -254,30 +254,30 @@ public:
LLColor4 getSkyFogColor() const { return m_legacyAtmospherics.getFogColor(); }
LLColor4 getGLFogColor() const { return m_legacyAtmospherics.getGLFogColor(); }
- void setCloudDensity(F32 cloud_density) { mCloudDensity = cloud_density; }
- void setWind ( const LLVector3& wind ) { mWind = wind.length(); }
+ void setCloudDensity(F32 cloud_density) { mCloudDensity = cloud_density; }
+ void setWind ( const LLVector3& wind ) { mWind = wind.length(); }
- const LLVector3 &getCameraPosAgent() const { return mCameraPosAgent; }
- LLVector3 getEarthCenter() const { return mEarthCenter; }
+ const LLVector3 &getCameraPosAgent() const { return mCameraPosAgent; }
+ LLVector3 getEarthCenter() const { return mEarthCenter; }
- LLCubeMap *getCubeMap() const { return mCubeMap; }
- S32 getDrawRefl() const { return mDrawRefl; }
- void setDrawRefl(const S32 r) { mDrawRefl = r; }
- bool isReflFace(const LLFace* face) const { return face == mFace[FACE_REFLECTION]; }
- LLFace* getReflFace() const { return mFace[FACE_REFLECTION]; }
+ LLCubeMap *getCubeMap() const { return mCubeMap; }
+ S32 getDrawRefl() const { return mDrawRefl; }
+ void setDrawRefl(const S32 r) { mDrawRefl = r; }
+ bool isReflFace(const LLFace* face) const { return face == mFace[FACE_REFLECTION]; }
+ LLFace* getReflFace() const { return mFace[FACE_REFLECTION]; }
- LLViewerTexture* getSunTex() const { return mSunTexturep[0]; }
- LLViewerTexture* getMoonTex() const { return mMoonTexturep[0]; }
- LLViewerTexture* getBloomTex() const { return mBloomTexturep[0]; }
- LLViewerTexture* getCloudNoiseTex() const { return mCloudNoiseTexturep[0]; }
+ LLViewerTexture* getSunTex() const { return mSunTexturep[0]; }
+ LLViewerTexture* getMoonTex() const { return mMoonTexturep[0]; }
+ LLViewerTexture* getBloomTex() const { return mBloomTexturep[0]; }
+ LLViewerTexture* getCloudNoiseTex() const { return mCloudNoiseTexturep[0]; }
- LLViewerTexture* getRainbowTex() const { return mRainbowMap; }
- LLViewerTexture* getHaloTex() const { return mHaloMap; }
+ LLViewerTexture* getRainbowTex() const { return mRainbowMap; }
+ LLViewerTexture* getHaloTex() const { return mHaloMap; }
- LLViewerTexture* getSunTexNext() const { return mSunTexturep[1]; }
- LLViewerTexture* getMoonTexNext() const { return mMoonTexturep[1]; }
- LLViewerTexture* getBloomTexNext() const { return mBloomTexturep[1]; }
- LLViewerTexture* getCloudNoiseTexNext() const { return mCloudNoiseTexturep[1]; }
+ LLViewerTexture* getSunTexNext() const { return mSunTexturep[1]; }
+ LLViewerTexture* getMoonTexNext() const { return mMoonTexturep[1]; }
+ LLViewerTexture* getBloomTexNext() const { return mBloomTexturep[1]; }
+ LLViewerTexture* getCloudNoiseTexNext() const { return mCloudNoiseTexturep[1]; }
void setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next);
void setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next);
@@ -287,70 +287,70 @@ public:
void setSunScale(F32 sun_scale);
void setMoonScale(F32 sun_scale);
- void forceSkyUpdate(void);
+ void forceSkyUpdate(void);
public:
- LLFace *mFace[FACE_COUNT];
- LLVector3 mBumpSunDir;
+ LLFace *mFace[FACE_COUNT];
+ LLVector3 mBumpSunDir;
F32 getInterpVal() const { return mInterpVal; }
protected:
- ~LLVOSky();
+ ~LLVOSky();
- void updateDirections(LLSettingsSky::ptr_t psky);
+ void updateDirections(LLSettingsSky::ptr_t psky);
- void initSkyTextureDirs(const S32 side, const S32 tile);
- void createSkyTexture(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const S32 side, const S32 tile);
+ void initSkyTextureDirs(const S32 side, const S32 tile);
+ void createSkyTexture(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const S32 side, const S32 tile);
- LLPointer<LLViewerFetchedTexture> mSunTexturep[2];
- LLPointer<LLViewerFetchedTexture> mMoonTexturep[2];
+ LLPointer<LLViewerFetchedTexture> mSunTexturep[2];
+ LLPointer<LLViewerFetchedTexture> mMoonTexturep[2];
LLPointer<LLViewerFetchedTexture> mCloudNoiseTexturep[2];
- LLPointer<LLViewerFetchedTexture> mBloomTexturep[2];
+ LLPointer<LLViewerFetchedTexture> mBloomTexturep[2];
LLPointer<LLViewerFetchedTexture> mRainbowMap;
LLPointer<LLViewerFetchedTexture> mHaloMap;
F32 mSunScale = 1.0f;
F32 mMoonScale = 1.0f;
- static S32 sResolution;
- static S32 sTileResX;
- static S32 sTileResY;
- LLSkyTex mSkyTex[6];
- LLSkyTex mShinyTex[6];
- LLHeavenBody mSun;
- LLHeavenBody mMoon;
- LLVector3 mSunDefaultPosition;
- LLVector3 mSunAngVel;
- F32 mAtmHeight;
- LLVector3 mEarthCenter;
- LLVector3 mCameraPosAgent;
- F32 mBrightnessScale;
- LLColor3 mBrightestPoint;
- F32 mBrightnessScaleNew;
- LLColor3 mBrightestPointNew;
- F32 mBrightnessScaleGuess;
- LLColor3 mBrightestPointGuess;
- bool mWeatherChange;
- F32 mCloudDensity;
- F32 mWind;
-
- bool mInitialized;
- bool mForceUpdate;
- bool mNeedUpdate; // flag to force update of cubemap
- S32 mCubeMapUpdateStage; // state of cubemap uodate: -1 idle; 0-5 per-face updates; 6 finalizing
-
- F32 mAmbientScale;
- LLColor3 mNightColorShift;
- F32 mInterpVal;
- F32 mWorldScale;
-
- LLPointer<LLCubeMap> mCubeMap; // Cube map for the environment
- S32 mDrawRefl;
-
- LLFrameTimer mUpdateTimer;
+ static S32 sResolution;
+ static S32 sTileResX;
+ static S32 sTileResY;
+ LLSkyTex mSkyTex[6];
+ LLSkyTex mShinyTex[6];
+ LLHeavenBody mSun;
+ LLHeavenBody mMoon;
+ LLVector3 mSunDefaultPosition;
+ LLVector3 mSunAngVel;
+ F32 mAtmHeight;
+ LLVector3 mEarthCenter;
+ LLVector3 mCameraPosAgent;
+ F32 mBrightnessScale;
+ LLColor3 mBrightestPoint;
+ F32 mBrightnessScaleNew;
+ LLColor3 mBrightestPointNew;
+ F32 mBrightnessScaleGuess;
+ LLColor3 mBrightestPointGuess;
+ bool mWeatherChange;
+ F32 mCloudDensity;
+ F32 mWind;
+
+ bool mInitialized;
+ bool mForceUpdate;
+ bool mNeedUpdate; // flag to force update of cubemap
+ S32 mCubeMapUpdateStage; // state of cubemap uodate: -1 idle; 0-5 per-face updates; 6 finalizing
+
+ F32 mAmbientScale;
+ LLColor3 mNightColorShift;
+ F32 mInterpVal;
+ F32 mWorldScale;
+
+ LLPointer<LLCubeMap> mCubeMap; // Cube map for the environment
+ S32 mDrawRefl;
+
+ LLFrameTimer mUpdateTimer;
LLTimer mForceUpdateThrottle;
- bool mHeavenlyBodyUpdated ;
+ bool mHeavenlyBodyUpdated ;
AtmosphericsVars m_atmosphericsVars;
AtmosphericsVars m_lastAtmosphericsVars;
diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp
index 15fabf0414..b7d623b725 100644
--- a/indra/newview/llvosurfacepatch.cpp
+++ b/indra/newview/llvosurfacepatch.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvosurfacepatch.cpp
* @brief Viewer-object derived "surface patch", which is a piece of terrain
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,51 +46,51 @@
F32 LLVOSurfacePatch::sLODFactor = 1.f;
LLVOSurfacePatch::LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
- : LLStaticViewerObject(id, pcode, regionp),
- mDirtiedPatch(FALSE),
- mPool(NULL),
- mBaseComp(0),
- mPatchp(NULL),
- mDirtyTexture(FALSE),
- mDirtyTerrain(FALSE),
- mLastNorthStride(0),
- mLastEastStride(0),
- mLastStride(0),
- mLastLength(0)
+ : LLStaticViewerObject(id, pcode, regionp),
+ mDirtiedPatch(FALSE),
+ mPool(NULL),
+ mBaseComp(0),
+ mPatchp(NULL),
+ mDirtyTexture(FALSE),
+ mDirtyTerrain(FALSE),
+ mLastNorthStride(0),
+ mLastEastStride(0),
+ mLastStride(0),
+ mLastLength(0)
{
- // Terrain must draw during selection passes so it can block objects behind it.
- mbCanSelect = TRUE;
- setScale(LLVector3(16.f, 16.f, 16.f)); // Hack for setting scale for bounding boxes/visibility.
+ // Terrain must draw during selection passes so it can block objects behind it.
+ mbCanSelect = TRUE;
+ setScale(LLVector3(16.f, 16.f, 16.f)); // Hack for setting scale for bounding boxes/visibility.
}
LLVOSurfacePatch::~LLVOSurfacePatch()
{
- mPatchp = NULL;
+ mPatchp = NULL;
}
void LLVOSurfacePatch::markDead()
{
- if (mPatchp)
- {
- mPatchp->clearVObj();
- mPatchp = NULL;
- }
- LLViewerObject::markDead();
+ if (mPatchp)
+ {
+ mPatchp->clearVObj();
+ mPatchp = NULL;
+ }
+ LLViewerObject::markDead();
}
BOOL LLVOSurfacePatch::isActive() const
{
- return FALSE;
+ return FALSE;
}
void LLVOSurfacePatch::setPixelAreaAndAngle(LLAgent &agent)
{
- mAppAngle = 50;
- mPixelArea = 500*500;
+ mAppAngle = 50;
+ mPixelArea = 500*500;
}
@@ -101,925 +101,925 @@ void LLVOSurfacePatch::updateTextures()
LLFacePool *LLVOSurfacePatch::getPool()
{
- mPool = (LLDrawPoolTerrain*) gPipeline.getPool(LLDrawPool::POOL_TERRAIN, mPatchp->getSurface()->getSTexture());
+ mPool = (LLDrawPoolTerrain*) gPipeline.getPool(LLDrawPool::POOL_TERRAIN, mPatchp->getSurface()->getSTexture());
- return mPool;
+ return mPool;
}
LLDrawable *LLVOSurfacePatch::createDrawable(LLPipeline *pipeline)
{
- pipeline->allocDrawable(this);
-
- mDrawable->setRenderType(LLPipeline::RENDER_TYPE_TERRAIN);
-
- mBaseComp = llfloor(mPatchp->getMinComposition());
- S32 min_comp, max_comp, range;
- min_comp = llfloor(mPatchp->getMinComposition());
- max_comp = llceil(mPatchp->getMaxComposition());
- range = (max_comp - min_comp);
- range++;
- if (range > 3)
- {
- if ((mPatchp->getMinComposition() - min_comp) > (max_comp - mPatchp->getMaxComposition()))
- {
- // The top side runs over more
- mBaseComp++;
- }
- range = 3;
- }
-
- LLFacePool *poolp = getPool();
-
- mDrawable->addFace(poolp, NULL);
-
- return mDrawable;
+ pipeline->allocDrawable(this);
+
+ mDrawable->setRenderType(LLPipeline::RENDER_TYPE_TERRAIN);
+
+ mBaseComp = llfloor(mPatchp->getMinComposition());
+ S32 min_comp, max_comp, range;
+ min_comp = llfloor(mPatchp->getMinComposition());
+ max_comp = llceil(mPatchp->getMaxComposition());
+ range = (max_comp - min_comp);
+ range++;
+ if (range > 3)
+ {
+ if ((mPatchp->getMinComposition() - min_comp) > (max_comp - mPatchp->getMaxComposition()))
+ {
+ // The top side runs over more
+ mBaseComp++;
+ }
+ range = 3;
+ }
+
+ LLFacePool *poolp = getPool();
+
+ mDrawable->addFace(poolp, NULL);
+
+ return mDrawable;
}
void LLVOSurfacePatch::updateGL()
{
- if (mPatchp)
- {
- LL_PROFILE_ZONE_SCOPED
- mPatchp->updateGL();
- }
+ if (mPatchp)
+ {
+ LL_PROFILE_ZONE_SCOPED
+ mPatchp->updateGL();
+ }
}
BOOL LLVOSurfacePatch::updateGeometry(LLDrawable *drawable)
{
LL_PROFILE_ZONE_SCOPED;
- dirtySpatialGroup();
-
- S32 min_comp, max_comp, range;
- min_comp = lltrunc(mPatchp->getMinComposition());
- max_comp = lltrunc(ceil(mPatchp->getMaxComposition()));
- range = (max_comp - min_comp);
- range++;
- S32 new_base_comp = lltrunc(mPatchp->getMinComposition());
- if (range > 3)
- {
- if ((mPatchp->getMinComposition() - min_comp) > (max_comp - mPatchp->getMaxComposition()))
- {
- // The top side runs over more
- new_base_comp++;
- }
- range = 3;
- }
-
- // Pick the two closest detail textures for this patch...
- // Then create the draw pool for it.
- // Actually, should get the average composition instead of the center.
- mBaseComp = new_base_comp;
-
- //////////////////////////
- //
- // Figure out the strides
- //
- //
-
- U32 patch_width, render_stride, north_stride, east_stride, length;
- render_stride = mPatchp->getRenderStride();
- patch_width = mPatchp->getSurface()->getGridsPerPatchEdge();
-
- length = patch_width / render_stride;
-
- if (mPatchp->getNeighborPatch(NORTH))
- {
- north_stride = mPatchp->getNeighborPatch(NORTH)->getRenderStride();
- }
- else
- {
- north_stride = render_stride;
- }
-
- if (mPatchp->getNeighborPatch(EAST))
- {
- east_stride = mPatchp->getNeighborPatch(EAST)->getRenderStride();
- }
- else
- {
- east_stride = render_stride;
- }
-
- mLastLength = length;
- mLastStride = render_stride;
- mLastNorthStride = north_stride;
- mLastEastStride = east_stride;
-
- return TRUE;
+ dirtySpatialGroup();
+
+ S32 min_comp, max_comp, range;
+ min_comp = lltrunc(mPatchp->getMinComposition());
+ max_comp = lltrunc(ceil(mPatchp->getMaxComposition()));
+ range = (max_comp - min_comp);
+ range++;
+ S32 new_base_comp = lltrunc(mPatchp->getMinComposition());
+ if (range > 3)
+ {
+ if ((mPatchp->getMinComposition() - min_comp) > (max_comp - mPatchp->getMaxComposition()))
+ {
+ // The top side runs over more
+ new_base_comp++;
+ }
+ range = 3;
+ }
+
+ // Pick the two closest detail textures for this patch...
+ // Then create the draw pool for it.
+ // Actually, should get the average composition instead of the center.
+ mBaseComp = new_base_comp;
+
+ //////////////////////////
+ //
+ // Figure out the strides
+ //
+ //
+
+ U32 patch_width, render_stride, north_stride, east_stride, length;
+ render_stride = mPatchp->getRenderStride();
+ patch_width = mPatchp->getSurface()->getGridsPerPatchEdge();
+
+ length = patch_width / render_stride;
+
+ if (mPatchp->getNeighborPatch(NORTH))
+ {
+ north_stride = mPatchp->getNeighborPatch(NORTH)->getRenderStride();
+ }
+ else
+ {
+ north_stride = render_stride;
+ }
+
+ if (mPatchp->getNeighborPatch(EAST))
+ {
+ east_stride = mPatchp->getNeighborPatch(EAST)->getRenderStride();
+ }
+ else
+ {
+ east_stride = render_stride;
+ }
+
+ mLastLength = length;
+ mLastStride = render_stride;
+ mLastNorthStride = north_stride;
+ mLastEastStride = east_stride;
+
+ return TRUE;
}
void LLVOSurfacePatch::updateFaceSize(S32 idx)
{
- if (idx != 0)
- {
- LL_WARNS() << "Terrain partition requested invalid face!!!" << LL_ENDL;
- return;
- }
-
- LLFace* facep = mDrawable->getFace(idx);
- if (facep)
- {
- S32 num_vertices = 0;
- S32 num_indices = 0;
-
- if (mLastStride)
- {
- getGeomSizesMain(mLastStride, num_vertices, num_indices);
- getGeomSizesNorth(mLastStride, mLastNorthStride, num_vertices, num_indices);
- getGeomSizesEast(mLastStride, mLastEastStride, num_vertices, num_indices);
- }
-
- facep->setSize(num_vertices, num_indices);
- }
+ if (idx != 0)
+ {
+ LL_WARNS() << "Terrain partition requested invalid face!!!" << LL_ENDL;
+ return;
+ }
+
+ LLFace* facep = mDrawable->getFace(idx);
+ if (facep)
+ {
+ S32 num_vertices = 0;
+ S32 num_indices = 0;
+
+ if (mLastStride)
+ {
+ getGeomSizesMain(mLastStride, num_vertices, num_indices);
+ getGeomSizesNorth(mLastStride, mLastNorthStride, num_vertices, num_indices);
+ getGeomSizesEast(mLastStride, mLastEastStride, num_vertices, num_indices);
+ }
+
+ facep->setSize(num_vertices, num_indices);
+ }
}
BOOL LLVOSurfacePatch::updateLOD()
{
- return TRUE;
+ return TRUE;
}
void LLVOSurfacePatch::getGeometry(LLStrider<LLVector3> &verticesp,
- LLStrider<LLVector3> &normalsp,
- LLStrider<LLVector2> &texCoords0p,
- LLStrider<LLVector2> &texCoords1p,
- LLStrider<U16> &indicesp)
+ LLStrider<LLVector3> &normalsp,
+ LLStrider<LLVector2> &texCoords0p,
+ LLStrider<LLVector2> &texCoords1p,
+ LLStrider<U16> &indicesp)
{
- LLFace* facep = mDrawable->getFace(0);
- if (facep)
- {
- U32 index_offset = facep->getGeomIndex();
-
- updateMainGeometry(facep,
- verticesp,
- normalsp,
- texCoords0p,
- texCoords1p,
- indicesp,
- index_offset);
- updateNorthGeometry(facep,
- verticesp,
- normalsp,
- texCoords0p,
- texCoords1p,
- indicesp,
- index_offset);
- updateEastGeometry(facep,
- verticesp,
- normalsp,
- texCoords0p,
- texCoords1p,
- indicesp,
- index_offset);
- }
+ LLFace* facep = mDrawable->getFace(0);
+ if (facep)
+ {
+ U32 index_offset = facep->getGeomIndex();
+
+ updateMainGeometry(facep,
+ verticesp,
+ normalsp,
+ texCoords0p,
+ texCoords1p,
+ indicesp,
+ index_offset);
+ updateNorthGeometry(facep,
+ verticesp,
+ normalsp,
+ texCoords0p,
+ texCoords1p,
+ indicesp,
+ index_offset);
+ updateEastGeometry(facep,
+ verticesp,
+ normalsp,
+ texCoords0p,
+ texCoords1p,
+ indicesp,
+ index_offset);
+ }
}
void LLVOSurfacePatch::updateMainGeometry(LLFace *facep,
- LLStrider<LLVector3> &verticesp,
- LLStrider<LLVector3> &normalsp,
- LLStrider<LLVector2> &texCoords0p,
- LLStrider<LLVector2> &texCoords1p,
- LLStrider<U16> &indicesp,
- U32 &index_offset)
+ LLStrider<LLVector3> &verticesp,
+ LLStrider<LLVector3> &normalsp,
+ LLStrider<LLVector2> &texCoords0p,
+ LLStrider<LLVector2> &texCoords1p,
+ LLStrider<U16> &indicesp,
+ U32 &index_offset)
{
- S32 i, j, x, y;
-
- U32 patch_size, render_stride;
- S32 num_vertices, num_indices;
- U32 index;
-
- llassert(mLastStride > 0);
-
- render_stride = mLastStride;
- patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
- S32 vert_size = patch_size / render_stride;
-
- ///////////////////////////
- //
- // Render the main patch
- //
- //
-
- num_vertices = 0;
- num_indices = 0;
- // First, figure out how many vertices we need...
- getGeomSizesMain(render_stride, num_vertices, num_indices);
-
- if (num_vertices > 0)
- {
- facep->mCenterAgent = mPatchp->getPointAgent(8, 8);
-
- // Generate patch points first
- for (j = 0; j < vert_size; j++)
- {
- for (i = 0; i < vert_size; i++)
- {
- x = i * render_stride;
- y = j * render_stride;
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
- }
-
- for (j = 0; j < (vert_size - 1); j++)
- {
- if (j % 2)
- {
- for (i = (vert_size - 1); i > 0; i--)
- {
- index = (i - 1)+ j*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = i + (j+1)*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = (i - 1) + (j+1)*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = (i - 1) + j*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = i + j*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = i + (j+1)*vert_size;
- *(indicesp++) = index_offset + index;
- }
- }
- else
- {
- for (i = 0; i < (vert_size - 1); i++)
- {
- index = i + j*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = (i + 1) + (j+1)*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = i + (j+1)*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = i + j*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = (i + 1) + j*vert_size;
- *(indicesp++) = index_offset + index;
-
- index = (i + 1) + (j + 1)*vert_size;
- *(indicesp++) = index_offset + index;
- }
- }
- }
- }
- index_offset += num_vertices;
+ S32 i, j, x, y;
+
+ U32 patch_size, render_stride;
+ S32 num_vertices, num_indices;
+ U32 index;
+
+ llassert(mLastStride > 0);
+
+ render_stride = mLastStride;
+ patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
+ S32 vert_size = patch_size / render_stride;
+
+ ///////////////////////////
+ //
+ // Render the main patch
+ //
+ //
+
+ num_vertices = 0;
+ num_indices = 0;
+ // First, figure out how many vertices we need...
+ getGeomSizesMain(render_stride, num_vertices, num_indices);
+
+ if (num_vertices > 0)
+ {
+ facep->mCenterAgent = mPatchp->getPointAgent(8, 8);
+
+ // Generate patch points first
+ for (j = 0; j < vert_size; j++)
+ {
+ for (i = 0; i < vert_size; i++)
+ {
+ x = i * render_stride;
+ y = j * render_stride;
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+ }
+
+ for (j = 0; j < (vert_size - 1); j++)
+ {
+ if (j % 2)
+ {
+ for (i = (vert_size - 1); i > 0; i--)
+ {
+ index = (i - 1)+ j*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = i + (j+1)*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = (i - 1) + (j+1)*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = (i - 1) + j*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = i + j*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = i + (j+1)*vert_size;
+ *(indicesp++) = index_offset + index;
+ }
+ }
+ else
+ {
+ for (i = 0; i < (vert_size - 1); i++)
+ {
+ index = i + j*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = (i + 1) + (j+1)*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = i + (j+1)*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = i + j*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = (i + 1) + j*vert_size;
+ *(indicesp++) = index_offset + index;
+
+ index = (i + 1) + (j + 1)*vert_size;
+ *(indicesp++) = index_offset + index;
+ }
+ }
+ }
+ }
+ index_offset += num_vertices;
}
void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep,
- LLStrider<LLVector3> &verticesp,
- LLStrider<LLVector3> &normalsp,
- LLStrider<LLVector2> &texCoords0p,
- LLStrider<LLVector2> &texCoords1p,
- LLStrider<U16> &indicesp,
- U32 &index_offset)
+ LLStrider<LLVector3> &verticesp,
+ LLStrider<LLVector3> &normalsp,
+ LLStrider<LLVector2> &texCoords0p,
+ LLStrider<LLVector2> &texCoords1p,
+ LLStrider<U16> &indicesp,
+ U32 &index_offset)
{
- S32 i, x, y;
-
- S32 num_vertices;
-
- U32 render_stride = mLastStride;
- S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
- S32 length = patch_size / render_stride;
- S32 half_length = length / 2;
- U32 north_stride = mLastNorthStride;
-
- ///////////////////////////
- //
- // Render the north strip
- //
- //
-
- // Stride lengths are the same
- if (north_stride == render_stride)
- {
- num_vertices = 2 * length + 1;
-
- facep->mCenterAgent = (mPatchp->getPointAgent(8, 15) + mPatchp->getPointAgent(8, 16))*0.5f;
-
- // Main patch
- for (i = 0; i < length; i++)
- {
- x = i * render_stride;
- y = 16 - render_stride;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
- // North patch
- for (i = 0; i <= length; i++)
- {
- x = i * render_stride;
- y = 16;
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
-
- for (i = 0; i < length; i++)
- {
- // Generate indices
- *(indicesp++) = index_offset + i;
- *(indicesp++) = index_offset + length + i + 1;
- *(indicesp++) = index_offset + length + i;
-
- if (i != length - 1)
- {
- *(indicesp++) = index_offset + i;
- *(indicesp++) = index_offset + i + 1;
- *(indicesp++) = index_offset + length + i + 1;
- }
- }
- }
- else if (north_stride > render_stride)
- {
- // North stride is longer (has less vertices)
- num_vertices = length + length/2 + 1;
-
- facep->mCenterAgent = (mPatchp->getPointAgent(7, 15) + mPatchp->getPointAgent(8, 16))*0.5f;
-
- // Iterate through this patch's points
- for (i = 0; i < length; i++)
- {
- x = i * render_stride;
- y = 16 - render_stride;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
- // Iterate through the north patch's points
- for (i = 0; i <= length; i+=2)
- {
- x = i * render_stride;
- y = 16;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
-
- for (i = 0; i < length; i++)
- {
- if (!(i % 2))
- {
- *(indicesp++) = index_offset + i;
- *(indicesp++) = index_offset + i + 1;
- *(indicesp++) = index_offset + length + (i/2);
-
- *(indicesp++) = index_offset + i + 1;
- *(indicesp++) = index_offset + length + (i/2) + 1;
- *(indicesp++) = index_offset + length + (i/2);
- }
- else if (i < (length - 1))
- {
- *(indicesp++) = index_offset + i;
- *(indicesp++) = index_offset + i + 1;
- *(indicesp++) = index_offset + length + (i/2) + 1;
- }
- }
- }
- else
- {
- // North stride is shorter (more vertices)
- length = patch_size / north_stride;
- half_length = length / 2;
- num_vertices = length + half_length + 1;
-
- facep->mCenterAgent = (mPatchp->getPointAgent(15, 7) + mPatchp->getPointAgent(16, 8))*0.5f;
-
- // Iterate through this patch's points
- for (i = 0; i < length; i+=2)
- {
- x = i * north_stride;
- y = 16 - render_stride;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
- // Iterate through the north patch's points
- for (i = 0; i <= length; i++)
- {
- x = i * north_stride;
- y = 16;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
- for (i = 0; i < length; i++)
- {
- if (!(i%2))
- {
- *(indicesp++) = index_offset + half_length + i;
- *(indicesp++) = index_offset + i/2;
- *(indicesp++) = index_offset + half_length + i + 1;
- }
- else if (i < (length - 2))
- {
- *(indicesp++) = index_offset + half_length + i;
- *(indicesp++) = index_offset + i/2;
- *(indicesp++) = index_offset + i/2 + 1;
-
- *(indicesp++) = index_offset + half_length + i;
- *(indicesp++) = index_offset + i/2 + 1;
- *(indicesp++) = index_offset + half_length + i + 1;
- }
- else
- {
- *(indicesp++) = index_offset + half_length + i;
- *(indicesp++) = index_offset + i/2;
- *(indicesp++) = index_offset + half_length + i + 1;
- }
- }
- }
- index_offset += num_vertices;
+ S32 i, x, y;
+
+ S32 num_vertices;
+
+ U32 render_stride = mLastStride;
+ S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
+ S32 length = patch_size / render_stride;
+ S32 half_length = length / 2;
+ U32 north_stride = mLastNorthStride;
+
+ ///////////////////////////
+ //
+ // Render the north strip
+ //
+ //
+
+ // Stride lengths are the same
+ if (north_stride == render_stride)
+ {
+ num_vertices = 2 * length + 1;
+
+ facep->mCenterAgent = (mPatchp->getPointAgent(8, 15) + mPatchp->getPointAgent(8, 16))*0.5f;
+
+ // Main patch
+ for (i = 0; i < length; i++)
+ {
+ x = i * render_stride;
+ y = 16 - render_stride;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+ // North patch
+ for (i = 0; i <= length; i++)
+ {
+ x = i * render_stride;
+ y = 16;
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+
+ for (i = 0; i < length; i++)
+ {
+ // Generate indices
+ *(indicesp++) = index_offset + i;
+ *(indicesp++) = index_offset + length + i + 1;
+ *(indicesp++) = index_offset + length + i;
+
+ if (i != length - 1)
+ {
+ *(indicesp++) = index_offset + i;
+ *(indicesp++) = index_offset + i + 1;
+ *(indicesp++) = index_offset + length + i + 1;
+ }
+ }
+ }
+ else if (north_stride > render_stride)
+ {
+ // North stride is longer (has less vertices)
+ num_vertices = length + length/2 + 1;
+
+ facep->mCenterAgent = (mPatchp->getPointAgent(7, 15) + mPatchp->getPointAgent(8, 16))*0.5f;
+
+ // Iterate through this patch's points
+ for (i = 0; i < length; i++)
+ {
+ x = i * render_stride;
+ y = 16 - render_stride;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+ // Iterate through the north patch's points
+ for (i = 0; i <= length; i+=2)
+ {
+ x = i * render_stride;
+ y = 16;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+
+ for (i = 0; i < length; i++)
+ {
+ if (!(i % 2))
+ {
+ *(indicesp++) = index_offset + i;
+ *(indicesp++) = index_offset + i + 1;
+ *(indicesp++) = index_offset + length + (i/2);
+
+ *(indicesp++) = index_offset + i + 1;
+ *(indicesp++) = index_offset + length + (i/2) + 1;
+ *(indicesp++) = index_offset + length + (i/2);
+ }
+ else if (i < (length - 1))
+ {
+ *(indicesp++) = index_offset + i;
+ *(indicesp++) = index_offset + i + 1;
+ *(indicesp++) = index_offset + length + (i/2) + 1;
+ }
+ }
+ }
+ else
+ {
+ // North stride is shorter (more vertices)
+ length = patch_size / north_stride;
+ half_length = length / 2;
+ num_vertices = length + half_length + 1;
+
+ facep->mCenterAgent = (mPatchp->getPointAgent(15, 7) + mPatchp->getPointAgent(16, 8))*0.5f;
+
+ // Iterate through this patch's points
+ for (i = 0; i < length; i+=2)
+ {
+ x = i * north_stride;
+ y = 16 - render_stride;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+ // Iterate through the north patch's points
+ for (i = 0; i <= length; i++)
+ {
+ x = i * north_stride;
+ y = 16;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+ for (i = 0; i < length; i++)
+ {
+ if (!(i%2))
+ {
+ *(indicesp++) = index_offset + half_length + i;
+ *(indicesp++) = index_offset + i/2;
+ *(indicesp++) = index_offset + half_length + i + 1;
+ }
+ else if (i < (length - 2))
+ {
+ *(indicesp++) = index_offset + half_length + i;
+ *(indicesp++) = index_offset + i/2;
+ *(indicesp++) = index_offset + i/2 + 1;
+
+ *(indicesp++) = index_offset + half_length + i;
+ *(indicesp++) = index_offset + i/2 + 1;
+ *(indicesp++) = index_offset + half_length + i + 1;
+ }
+ else
+ {
+ *(indicesp++) = index_offset + half_length + i;
+ *(indicesp++) = index_offset + i/2;
+ *(indicesp++) = index_offset + half_length + i + 1;
+ }
+ }
+ }
+ index_offset += num_vertices;
}
void LLVOSurfacePatch::updateEastGeometry(LLFace *facep,
- LLStrider<LLVector3> &verticesp,
- LLStrider<LLVector3> &normalsp,
- LLStrider<LLVector2> &texCoords0p,
- LLStrider<LLVector2> &texCoords1p,
- LLStrider<U16> &indicesp,
- U32 &index_offset)
+ LLStrider<LLVector3> &verticesp,
+ LLStrider<LLVector3> &normalsp,
+ LLStrider<LLVector2> &texCoords0p,
+ LLStrider<LLVector2> &texCoords1p,
+ LLStrider<U16> &indicesp,
+ U32 &index_offset)
{
- S32 i, x, y;
-
- S32 num_vertices;
-
- U32 render_stride = mLastStride;
- S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
- S32 length = patch_size / render_stride;
- S32 half_length = length / 2;
-
- U32 east_stride = mLastEastStride;
-
- // Stride lengths are the same
- if (east_stride == render_stride)
- {
- num_vertices = 2 * length + 1;
-
- facep->mCenterAgent = (mPatchp->getPointAgent(8, 15) + mPatchp->getPointAgent(8, 16))*0.5f;
-
- // Main patch
- for (i = 0; i < length; i++)
- {
- x = 16 - render_stride;
- y = i * render_stride;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
- // East patch
- for (i = 0; i <= length; i++)
- {
- x = 16;
- y = i * render_stride;
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
-
- for (i = 0; i < length; i++)
- {
- // Generate indices
- *(indicesp++) = index_offset + i;
- *(indicesp++) = index_offset + length + i;
- *(indicesp++) = index_offset + length + i + 1;
-
- if (i != length - 1)
- {
- *(indicesp++) = index_offset + i;
- *(indicesp++) = index_offset + length + i + 1;
- *(indicesp++) = index_offset + i + 1;
- }
- }
- }
- else if (east_stride > render_stride)
- {
- // East stride is longer (has less vertices)
- num_vertices = length + half_length + 1;
-
- facep->mCenterAgent = (mPatchp->getPointAgent(7, 15) + mPatchp->getPointAgent(8, 16))*0.5f;
-
- // Iterate through this patch's points
- for (i = 0; i < length; i++)
- {
- x = 16 - render_stride;
- y = i * render_stride;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
- // Iterate through the east patch's points
- for (i = 0; i <= length; i+=2)
- {
- x = 16;
- y = i * render_stride;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
- for (i = 0; i < length; i++)
- {
- if (!(i % 2))
- {
- *(indicesp++) = index_offset + i;
- *(indicesp++) = index_offset + length + (i/2);
- *(indicesp++) = index_offset + i + 1;
-
- *(indicesp++) = index_offset + i + 1;
- *(indicesp++) = index_offset + length + (i/2);
- *(indicesp++) = index_offset + length + (i/2) + 1;
- }
- else if (i < (length - 1))
- {
- *(indicesp++) = index_offset + i;
- *(indicesp++) = index_offset + length + (i/2) + 1;
- *(indicesp++) = index_offset + i + 1;
- }
- }
- }
- else
- {
- // East stride is shorter (more vertices)
- length = patch_size / east_stride;
- half_length = length / 2;
- num_vertices = length + length/2 + 1;
-
- facep->mCenterAgent = (mPatchp->getPointAgent(15, 7) + mPatchp->getPointAgent(16, 8))*0.5f;
-
- // Iterate through this patch's points
- for (i = 0; i < length; i+=2)
- {
- x = 16 - render_stride;
- y = i * east_stride;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
- // Iterate through the east patch's points
- for (i = 0; i <= length; i++)
- {
- x = 16;
- y = i * east_stride;
-
- mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
- verticesp++;
- normalsp++;
- texCoords0p++;
- texCoords1p++;
- }
-
- for (i = 0; i < length; i++)
- {
- if (!(i%2))
- {
- *(indicesp++) = index_offset + half_length + i;
- *(indicesp++) = index_offset + half_length + i + 1;
- *(indicesp++) = index_offset + i/2;
- }
- else if (i < (length - 2))
- {
- *(indicesp++) = index_offset + half_length + i;
- *(indicesp++) = index_offset + i/2 + 1;
- *(indicesp++) = index_offset + i/2;
-
- *(indicesp++) = index_offset + half_length + i;
- *(indicesp++) = index_offset + half_length + i + 1;
- *(indicesp++) = index_offset + i/2 + 1;
- }
- else
- {
- *(indicesp++) = index_offset + half_length + i;
- *(indicesp++) = index_offset + half_length + i + 1;
- *(indicesp++) = index_offset + i/2;
- }
- }
- }
- index_offset += num_vertices;
+ S32 i, x, y;
+
+ S32 num_vertices;
+
+ U32 render_stride = mLastStride;
+ S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
+ S32 length = patch_size / render_stride;
+ S32 half_length = length / 2;
+
+ U32 east_stride = mLastEastStride;
+
+ // Stride lengths are the same
+ if (east_stride == render_stride)
+ {
+ num_vertices = 2 * length + 1;
+
+ facep->mCenterAgent = (mPatchp->getPointAgent(8, 15) + mPatchp->getPointAgent(8, 16))*0.5f;
+
+ // Main patch
+ for (i = 0; i < length; i++)
+ {
+ x = 16 - render_stride;
+ y = i * render_stride;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+ // East patch
+ for (i = 0; i <= length; i++)
+ {
+ x = 16;
+ y = i * render_stride;
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+
+ for (i = 0; i < length; i++)
+ {
+ // Generate indices
+ *(indicesp++) = index_offset + i;
+ *(indicesp++) = index_offset + length + i;
+ *(indicesp++) = index_offset + length + i + 1;
+
+ if (i != length - 1)
+ {
+ *(indicesp++) = index_offset + i;
+ *(indicesp++) = index_offset + length + i + 1;
+ *(indicesp++) = index_offset + i + 1;
+ }
+ }
+ }
+ else if (east_stride > render_stride)
+ {
+ // East stride is longer (has less vertices)
+ num_vertices = length + half_length + 1;
+
+ facep->mCenterAgent = (mPatchp->getPointAgent(7, 15) + mPatchp->getPointAgent(8, 16))*0.5f;
+
+ // Iterate through this patch's points
+ for (i = 0; i < length; i++)
+ {
+ x = 16 - render_stride;
+ y = i * render_stride;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+ // Iterate through the east patch's points
+ for (i = 0; i <= length; i+=2)
+ {
+ x = 16;
+ y = i * render_stride;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+ for (i = 0; i < length; i++)
+ {
+ if (!(i % 2))
+ {
+ *(indicesp++) = index_offset + i;
+ *(indicesp++) = index_offset + length + (i/2);
+ *(indicesp++) = index_offset + i + 1;
+
+ *(indicesp++) = index_offset + i + 1;
+ *(indicesp++) = index_offset + length + (i/2);
+ *(indicesp++) = index_offset + length + (i/2) + 1;
+ }
+ else if (i < (length - 1))
+ {
+ *(indicesp++) = index_offset + i;
+ *(indicesp++) = index_offset + length + (i/2) + 1;
+ *(indicesp++) = index_offset + i + 1;
+ }
+ }
+ }
+ else
+ {
+ // East stride is shorter (more vertices)
+ length = patch_size / east_stride;
+ half_length = length / 2;
+ num_vertices = length + length/2 + 1;
+
+ facep->mCenterAgent = (mPatchp->getPointAgent(15, 7) + mPatchp->getPointAgent(16, 8))*0.5f;
+
+ // Iterate through this patch's points
+ for (i = 0; i < length; i+=2)
+ {
+ x = 16 - render_stride;
+ y = i * east_stride;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+ // Iterate through the east patch's points
+ for (i = 0; i <= length; i++)
+ {
+ x = 16;
+ y = i * east_stride;
+
+ mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get());
+ verticesp++;
+ normalsp++;
+ texCoords0p++;
+ texCoords1p++;
+ }
+
+ for (i = 0; i < length; i++)
+ {
+ if (!(i%2))
+ {
+ *(indicesp++) = index_offset + half_length + i;
+ *(indicesp++) = index_offset + half_length + i + 1;
+ *(indicesp++) = index_offset + i/2;
+ }
+ else if (i < (length - 2))
+ {
+ *(indicesp++) = index_offset + half_length + i;
+ *(indicesp++) = index_offset + i/2 + 1;
+ *(indicesp++) = index_offset + i/2;
+
+ *(indicesp++) = index_offset + half_length + i;
+ *(indicesp++) = index_offset + half_length + i + 1;
+ *(indicesp++) = index_offset + i/2 + 1;
+ }
+ else
+ {
+ *(indicesp++) = index_offset + half_length + i;
+ *(indicesp++) = index_offset + half_length + i + 1;
+ *(indicesp++) = index_offset + i/2;
+ }
+ }
+ }
+ index_offset += num_vertices;
}
void LLVOSurfacePatch::setPatch(LLSurfacePatch *patchp)
{
- mPatchp = patchp;
+ mPatchp = patchp;
- dirtyPatch();
+ dirtyPatch();
};
void LLVOSurfacePatch::dirtyPatch()
{
- mDirtiedPatch = TRUE;
- dirtyGeom();
- mDirtyTerrain = TRUE;
- LLVector3 center = mPatchp->getCenterRegion();
- LLSurface *surfacep = mPatchp->getSurface();
+ mDirtiedPatch = TRUE;
+ dirtyGeom();
+ mDirtyTerrain = TRUE;
+ LLVector3 center = mPatchp->getCenterRegion();
+ LLSurface *surfacep = mPatchp->getSurface();
- setPositionRegion(center);
+ setPositionRegion(center);
- F32 scale_factor = surfacep->getGridsPerPatchEdge() * surfacep->getMetersPerGrid();
- setScale(LLVector3(scale_factor, scale_factor, mPatchp->getMaxZ() - mPatchp->getMinZ()));
+ F32 scale_factor = surfacep->getGridsPerPatchEdge() * surfacep->getMetersPerGrid();
+ setScale(LLVector3(scale_factor, scale_factor, mPatchp->getMaxZ() - mPatchp->getMinZ()));
}
void LLVOSurfacePatch::dirtyGeom()
{
- if (mDrawable)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- LLFace* facep = mDrawable->getFace(0);
- if (facep)
- {
- facep->setVertexBuffer(NULL);
- }
- mDrawable->movePartition();
- }
+ if (mDrawable)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ LLFace* facep = mDrawable->getFace(0);
+ if (facep)
+ {
+ facep->setVertexBuffer(NULL);
+ }
+ mDrawable->movePartition();
+ }
}
void LLVOSurfacePatch::getGeomSizesMain(const S32 stride, S32 &num_vertices, S32 &num_indices)
{
- S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
-
- // First, figure out how many vertices we need...
- S32 vert_size = patch_size / stride;
- if (vert_size >= 2)
- {
- num_vertices += vert_size * vert_size;
- num_indices += 6 * (vert_size - 1)*(vert_size - 1);
- }
+ S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
+
+ // First, figure out how many vertices we need...
+ S32 vert_size = patch_size / stride;
+ if (vert_size >= 2)
+ {
+ num_vertices += vert_size * vert_size;
+ num_indices += 6 * (vert_size - 1)*(vert_size - 1);
+ }
}
void LLVOSurfacePatch::getGeomSizesNorth(const S32 stride, const S32 north_stride,
- S32 &num_vertices, S32 &num_indices)
+ S32 &num_vertices, S32 &num_indices)
{
- S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
- S32 length = patch_size / stride;
- // Stride lengths are the same
- if (north_stride == stride)
- {
- num_vertices += 2 * length + 1;
- num_indices += length * 6 - 3;
- }
- else if (north_stride > stride)
- {
- // North stride is longer (has less vertices)
- num_vertices += length + (length/2) + 1;
- num_indices += (length/2)*9 - 3;
- }
- else
- {
- // North stride is shorter (more vertices)
- length = patch_size / north_stride;
- num_vertices += length + (length/2) + 1;
- num_indices += 9*(length/2) - 3;
- }
+ S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
+ S32 length = patch_size / stride;
+ // Stride lengths are the same
+ if (north_stride == stride)
+ {
+ num_vertices += 2 * length + 1;
+ num_indices += length * 6 - 3;
+ }
+ else if (north_stride > stride)
+ {
+ // North stride is longer (has less vertices)
+ num_vertices += length + (length/2) + 1;
+ num_indices += (length/2)*9 - 3;
+ }
+ else
+ {
+ // North stride is shorter (more vertices)
+ length = patch_size / north_stride;
+ num_vertices += length + (length/2) + 1;
+ num_indices += 9*(length/2) - 3;
+ }
}
void LLVOSurfacePatch::getGeomSizesEast(const S32 stride, const S32 east_stride,
- S32 &num_vertices, S32 &num_indices)
+ S32 &num_vertices, S32 &num_indices)
{
- S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
- S32 length = patch_size / stride;
- // Stride lengths are the same
- if (east_stride == stride)
- {
- num_vertices += 2 * length + 1;
- num_indices += length * 6 - 3;
- }
- else if (east_stride > stride)
- {
- // East stride is longer (has less vertices)
- num_vertices += length + (length/2) + 1;
- num_indices += (length/2)*9 - 3;
- }
- else
- {
- // East stride is shorter (more vertices)
- length = patch_size / east_stride;
- num_vertices += length + (length/2) + 1;
- num_indices += 9*(length/2) - 3;
- }
+ S32 patch_size = mPatchp->getSurface()->getGridsPerPatchEdge();
+ S32 length = patch_size / stride;
+ // Stride lengths are the same
+ if (east_stride == stride)
+ {
+ num_vertices += 2 * length + 1;
+ num_indices += length * 6 - 3;
+ }
+ else if (east_stride > stride)
+ {
+ // East stride is longer (has less vertices)
+ num_vertices += length + (length/2) + 1;
+ num_indices += (length/2)*9 - 3;
+ }
+ else
+ {
+ // East stride is shorter (more vertices)
+ length = patch_size / east_stride;
+ num_vertices += length + (length/2) + 1;
+ num_indices += 9*(length/2) - 3;
+ }
}
BOOL LLVOSurfacePatch::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32 *face_hitp,
- LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
-
+ LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
+
{
- if (!lineSegmentBoundingBox(start, end))
- {
- return FALSE;
- }
-
- LLVector4a da;
- da.setSub(end, start);
- LLVector3 delta(da.getF32ptr());
-
- LLVector3 pdelta = delta;
- pdelta.mV[2] = 0;
-
- F32 plength = pdelta.length();
-
- F32 tdelta = 1.f/plength;
-
- LLVector3 v_start(start.getF32ptr());
-
- LLVector3 origin = v_start - mRegionp->getOriginAgent();
-
- if (mRegionp->getLandHeightRegion(origin) > origin.mV[2])
- {
- //origin is under ground, treat as no intersection
- return FALSE;
- }
-
- //step one meter at a time until intersection point found
-
- //VECTORIZE THIS
- const LLVector4a* exta = mDrawable->getSpatialExtents();
-
- LLVector3 ext[2];
- ext[0].set(exta[0].getF32ptr());
- ext[1].set(exta[1].getF32ptr());
-
- F32 rad = (delta*tdelta).magVecSquared();
-
- F32 t = 0.f;
- while ( t <= 1.f)
- {
- LLVector3 sample = origin + delta*t;
-
- if (AABBSphereIntersectR2(ext[0], ext[1], sample+mRegionp->getOriginAgent(), rad))
- {
- F32 height = mRegionp->getLandHeightRegion(sample);
- if (height > sample.mV[2])
- { //ray went below ground, positive intersection
- //quick and dirty binary search to get impact point
- tdelta = -tdelta*0.5f;
- F32 err_dist = 0.001f;
- F32 dist = fabsf(sample.mV[2] - height);
-
- while (dist > err_dist && tdelta*tdelta > 0.0f)
- {
- t += tdelta;
- sample = origin+delta*t;
- height = mRegionp->getLandHeightRegion(sample);
- if ((tdelta < 0 && height < sample.mV[2]) ||
- (height > sample.mV[2] && tdelta > 0))
- { //jumped over intersection point, go back
- tdelta = -tdelta;
- }
- tdelta *= 0.5f;
- dist = fabsf(sample.mV[2] - height);
- }
-
- if (intersection)
- {
- F32 height = mRegionp->getLandHeightRegion(sample);
- if (fabsf(sample.mV[2]-height) < delta.length()*tdelta)
- {
- sample.mV[2] = mRegionp->getLandHeightRegion(sample);
- }
- intersection->load3((sample + mRegionp->getOriginAgent()).mV);
- }
-
- if (normal)
- {
- normal->load3((mRegionp->getLand().resolveNormalGlobal(mRegionp->getPosGlobalFromRegion(sample))).mV);
- }
-
- return TRUE;
- }
- }
-
- t += tdelta;
- if (t > 1 && t < 1.f+tdelta*0.99f)
- { //make sure end point is checked (saves vertical lines coming up negative)
- t = 1.f;
- }
- }
-
-
- return FALSE;
+ if (!lineSegmentBoundingBox(start, end))
+ {
+ return FALSE;
+ }
+
+ LLVector4a da;
+ da.setSub(end, start);
+ LLVector3 delta(da.getF32ptr());
+
+ LLVector3 pdelta = delta;
+ pdelta.mV[2] = 0;
+
+ F32 plength = pdelta.length();
+
+ F32 tdelta = 1.f/plength;
+
+ LLVector3 v_start(start.getF32ptr());
+
+ LLVector3 origin = v_start - mRegionp->getOriginAgent();
+
+ if (mRegionp->getLandHeightRegion(origin) > origin.mV[2])
+ {
+ //origin is under ground, treat as no intersection
+ return FALSE;
+ }
+
+ //step one meter at a time until intersection point found
+
+ //VECTORIZE THIS
+ const LLVector4a* exta = mDrawable->getSpatialExtents();
+
+ LLVector3 ext[2];
+ ext[0].set(exta[0].getF32ptr());
+ ext[1].set(exta[1].getF32ptr());
+
+ F32 rad = (delta*tdelta).magVecSquared();
+
+ F32 t = 0.f;
+ while ( t <= 1.f)
+ {
+ LLVector3 sample = origin + delta*t;
+
+ if (AABBSphereIntersectR2(ext[0], ext[1], sample+mRegionp->getOriginAgent(), rad))
+ {
+ F32 height = mRegionp->getLandHeightRegion(sample);
+ if (height > sample.mV[2])
+ { //ray went below ground, positive intersection
+ //quick and dirty binary search to get impact point
+ tdelta = -tdelta*0.5f;
+ F32 err_dist = 0.001f;
+ F32 dist = fabsf(sample.mV[2] - height);
+
+ while (dist > err_dist && tdelta*tdelta > 0.0f)
+ {
+ t += tdelta;
+ sample = origin+delta*t;
+ height = mRegionp->getLandHeightRegion(sample);
+ if ((tdelta < 0 && height < sample.mV[2]) ||
+ (height > sample.mV[2] && tdelta > 0))
+ { //jumped over intersection point, go back
+ tdelta = -tdelta;
+ }
+ tdelta *= 0.5f;
+ dist = fabsf(sample.mV[2] - height);
+ }
+
+ if (intersection)
+ {
+ F32 height = mRegionp->getLandHeightRegion(sample);
+ if (fabsf(sample.mV[2]-height) < delta.length()*tdelta)
+ {
+ sample.mV[2] = mRegionp->getLandHeightRegion(sample);
+ }
+ intersection->load3((sample + mRegionp->getOriginAgent()).mV);
+ }
+
+ if (normal)
+ {
+ normal->load3((mRegionp->getLand().resolveNormalGlobal(mRegionp->getPosGlobalFromRegion(sample))).mV);
+ }
+
+ return TRUE;
+ }
+ }
+
+ t += tdelta;
+ if (t > 1 && t < 1.f+tdelta*0.99f)
+ { //make sure end point is checked (saves vertical lines coming up negative)
+ t = 1.f;
+ }
+ }
+
+
+ return FALSE;
}
void LLVOSurfacePatch::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
{
- LLVector3 posAgent = getPositionAgent();
- LLVector3 scale = getScale();
- //make z-axis scale at least 1 to avoid shadow artifacts on totally flat land
- scale.mV[VZ] = llmax(scale.mV[VZ], 1.f);
- newMin.load3( (posAgent-scale*0.5f).mV); // Changing to 2.f makes the culling a -little- better, but still wrong
- newMax.load3( (posAgent+scale*0.5f).mV);
- LLVector4a pos;
- pos.setAdd(newMin,newMax);
- pos.mul(0.5f);
- mDrawable->setPositionGroup(pos);
+ LLVector3 posAgent = getPositionAgent();
+ LLVector3 scale = getScale();
+ //make z-axis scale at least 1 to avoid shadow artifacts on totally flat land
+ scale.mV[VZ] = llmax(scale.mV[VZ], 1.f);
+ newMin.load3( (posAgent-scale*0.5f).mV); // Changing to 2.f makes the culling a -little- better, but still wrong
+ newMax.load3( (posAgent+scale*0.5f).mV);
+ LLVector4a pos;
+ pos.setAdd(newMin,newMax);
+ pos.mul(0.5f);
+ mDrawable->setPositionGroup(pos);
}
U32 LLVOSurfacePatch::getPartitionType() const
-{
- return LLViewerRegion::PARTITION_TERRAIN;
+{
+ return LLViewerRegion::PARTITION_TERRAIN;
}
LLTerrainPartition::LLTerrainPartition(LLViewerRegion* regionp)
: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, regionp)
{
- mOcclusionEnabled = FALSE;
- mInfiniteFarClip = TRUE;
- mDrawableType = LLPipeline::RENDER_TYPE_TERRAIN;
- mPartitionType = LLViewerRegion::PARTITION_TERRAIN;
+ mOcclusionEnabled = FALSE;
+ mInfiniteFarClip = TRUE;
+ mDrawableType = LLPipeline::RENDER_TYPE_TERRAIN;
+ mPartitionType = LLViewerRegion::PARTITION_TERRAIN;
}
void LLTerrainPartition::getGeometry(LLSpatialGroup* group)
{
LL_PROFILE_ZONE_SCOPED;
- LLVertexBuffer* buffer = group->mVertexBuffer;
+ LLVertexBuffer* buffer = group->mVertexBuffer;
- //get vertex buffer striders
- LLStrider<LLVector3> vertices;
- LLStrider<LLVector3> normals;
- LLStrider<LLVector2> texcoords2;
- LLStrider<LLVector2> texcoords;
- LLStrider<U16> indices;
+ //get vertex buffer striders
+ LLStrider<LLVector3> vertices;
+ LLStrider<LLVector3> normals;
+ LLStrider<LLVector2> texcoords2;
+ LLStrider<LLVector2> texcoords;
+ LLStrider<U16> indices;
- llassert_always(buffer->getVertexStrider(vertices));
- llassert_always(buffer->getNormalStrider(normals));
- llassert_always(buffer->getTexCoord0Strider(texcoords));
- llassert_always(buffer->getTexCoord1Strider(texcoords2));
- llassert_always(buffer->getIndexStrider(indices));
+ llassert_always(buffer->getVertexStrider(vertices));
+ llassert_always(buffer->getNormalStrider(normals));
+ llassert_always(buffer->getTexCoord0Strider(texcoords));
+ llassert_always(buffer->getTexCoord1Strider(texcoords2));
+ llassert_always(buffer->getIndexStrider(indices));
- U32 indices_index = 0;
- U32 index_offset = 0;
+ U32 indices_index = 0;
+ U32 index_offset = 0;
- for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
- {
- LLFace* facep = *i;
+ for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
+ {
+ LLFace* facep = *i;
- facep->setIndicesIndex(indices_index);
- facep->setGeomIndex(index_offset);
- facep->setVertexBuffer(buffer);
+ facep->setIndicesIndex(indices_index);
+ facep->setGeomIndex(index_offset);
+ facep->setVertexBuffer(buffer);
- LLVOSurfacePatch* patchp = (LLVOSurfacePatch*) facep->getViewerObject();
- patchp->getGeometry(vertices, normals, texcoords, texcoords2, indices);
+ LLVOSurfacePatch* patchp = (LLVOSurfacePatch*) facep->getViewerObject();
+ patchp->getGeometry(vertices, normals, texcoords, texcoords2, indices);
- indices_index += facep->getIndicesCount();
- index_offset += facep->getGeomCount();
- }
+ indices_index += facep->getIndicesCount();
+ index_offset += facep->getGeomCount();
+ }
- buffer->unmapBuffer();
- mFaceList.clear();
+ buffer->unmapBuffer();
+ mFaceList.clear();
}
diff --git a/indra/newview/llvosurfacepatch.h b/indra/newview/llvosurfacepatch.h
index aed67162d1..5de70e176a 100644
--- a/indra/newview/llvosurfacepatch.h
+++ b/indra/newview/llvosurfacepatch.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvosurfacepatch.h
* @brief Description of LLVOSurfacePatch class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,103 +39,103 @@ class LLFace;
class LLVOSurfacePatch : public LLStaticViewerObject
{
public:
- static F32 sLODFactor;
+ static F32 sLODFactor;
- enum
- {
- VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
- (1 << LLVertexBuffer::TYPE_NORMAL) |
- (1 << LLVertexBuffer::TYPE_TEXCOORD0) |
- (1 << LLVertexBuffer::TYPE_TEXCOORD1)
- };
+ enum
+ {
+ VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
+ (1 << LLVertexBuffer::TYPE_NORMAL) |
+ (1 << LLVertexBuffer::TYPE_TEXCOORD0) |
+ (1 << LLVertexBuffer::TYPE_TEXCOORD1)
+ };
- LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+ LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
- /*virtual*/ void markDead();
+ /*virtual*/ void markDead();
- // Initialize data that's only inited once per class.
- static void initClass();
+ // Initialize data that's only inited once per class.
+ static void initClass();
- virtual U32 getPartitionType() const;
+ virtual U32 getPartitionType() const;
- /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
- /*virtual*/ void updateGL();
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
- /*virtual*/ BOOL updateLOD();
- /*virtual*/ void updateFaceSize(S32 idx);
- void getGeometry(LLStrider<LLVector3> &verticesp,
- LLStrider<LLVector3> &normalsp,
- LLStrider<LLVector2> &texCoords0p,
- LLStrider<LLVector2> &texCoords1p,
- LLStrider<U16> &indicesp);
+ /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
+ /*virtual*/ void updateGL();
+ /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
+ /*virtual*/ BOOL updateLOD();
+ /*virtual*/ void updateFaceSize(S32 idx);
+ void getGeometry(LLStrider<LLVector3> &verticesp,
+ LLStrider<LLVector3> &normalsp,
+ LLStrider<LLVector2> &texCoords0p,
+ LLStrider<LLVector2> &texCoords1p,
+ LLStrider<U16> &indicesp);
- /*virtual*/ void updateTextures();
- /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
+ /*virtual*/ void updateTextures();
+ /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
- /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
- /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
+ /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
+ /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
- void setPatch(LLSurfacePatch *patchp);
- LLSurfacePatch *getPatch() const { return mPatchp; }
+ void setPatch(LLSurfacePatch *patchp);
+ LLSurfacePatch *getPatch() const { return mPatchp; }
- void dirtyPatch();
- void dirtyGeom();
+ void dirtyPatch();
+ void dirtyGeom();
- /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face = -1, // which face to check, -1 = ALL_SIDES
- BOOL pick_transparent = FALSE,
- BOOL pick_rigged = FALSE,
+ /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
+ S32 face = -1, // which face to check, -1 = ALL_SIDES
+ BOOL pick_transparent = FALSE,
+ BOOL pick_rigged = FALSE,
BOOL pick_unselectable = TRUE,
- S32* face_hit = NULL, // which face was hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL // return the surface tangent at the intersection point
- );
-
- BOOL mDirtiedPatch;
+ S32* face_hit = NULL, // which face was hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL // return the surface tangent at the intersection point
+ );
+
+ BOOL mDirtiedPatch;
protected:
- ~LLVOSurfacePatch();
-
- LLFacePool *mPool;
- LLFacePool *getPool();
- S32 mBaseComp;
- LLSurfacePatch *mPatchp;
- BOOL mDirtyTexture;
- BOOL mDirtyTerrain;
-
- S32 mLastNorthStride;
- S32 mLastEastStride;
- S32 mLastStride;
- S32 mLastLength;
-
- void getGeomSizesMain(const S32 stride, S32 &num_vertices, S32 &num_indices);
- void getGeomSizesNorth(const S32 stride, const S32 north_stride,
- S32 &num_vertices, S32 &num_indices);
- void getGeomSizesEast(const S32 stride, const S32 east_stride,
- S32 &num_vertices, S32 &num_indices);
-
- void updateMainGeometry(LLFace *facep,
- LLStrider<LLVector3> &verticesp,
- LLStrider<LLVector3> &normalsp,
- LLStrider<LLVector2> &texCoords0p,
- LLStrider<LLVector2> &texCoords1p,
- LLStrider<U16> &indicesp,
- U32 &index_offset);
- void updateNorthGeometry(LLFace *facep,
- LLStrider<LLVector3> &verticesp,
- LLStrider<LLVector3> &normalsp,
- LLStrider<LLVector2> &texCoords0p,
- LLStrider<LLVector2> &texCoords1p,
- LLStrider<U16> &indicesp,
- U32 &index_offset);
- void updateEastGeometry(LLFace *facep,
- LLStrider<LLVector3> &verticesp,
- LLStrider<LLVector3> &normalsp,
- LLStrider<LLVector2> &texCoords0p,
- LLStrider<LLVector2> &texCoords1p,
- LLStrider<U16> &indicesp,
- U32 &index_offset);
+ ~LLVOSurfacePatch();
+
+ LLFacePool *mPool;
+ LLFacePool *getPool();
+ S32 mBaseComp;
+ LLSurfacePatch *mPatchp;
+ BOOL mDirtyTexture;
+ BOOL mDirtyTerrain;
+
+ S32 mLastNorthStride;
+ S32 mLastEastStride;
+ S32 mLastStride;
+ S32 mLastLength;
+
+ void getGeomSizesMain(const S32 stride, S32 &num_vertices, S32 &num_indices);
+ void getGeomSizesNorth(const S32 stride, const S32 north_stride,
+ S32 &num_vertices, S32 &num_indices);
+ void getGeomSizesEast(const S32 stride, const S32 east_stride,
+ S32 &num_vertices, S32 &num_indices);
+
+ void updateMainGeometry(LLFace *facep,
+ LLStrider<LLVector3> &verticesp,
+ LLStrider<LLVector3> &normalsp,
+ LLStrider<LLVector2> &texCoords0p,
+ LLStrider<LLVector2> &texCoords1p,
+ LLStrider<U16> &indicesp,
+ U32 &index_offset);
+ void updateNorthGeometry(LLFace *facep,
+ LLStrider<LLVector3> &verticesp,
+ LLStrider<LLVector3> &normalsp,
+ LLStrider<LLVector2> &texCoords0p,
+ LLStrider<LLVector2> &texCoords1p,
+ LLStrider<U16> &indicesp,
+ U32 &index_offset);
+ void updateEastGeometry(LLFace *facep,
+ LLStrider<LLVector3> &verticesp,
+ LLStrider<LLVector3> &normalsp,
+ LLStrider<LLVector2> &texCoords0p,
+ LLStrider<LLVector2> &texCoords1p,
+ LLStrider<U16> &indicesp,
+ U32 &index_offset);
};
#endif // LL_VOSURFACEPATCH_H
diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp
index 575b1dbe7e..8b229ec98b 100644
--- a/indra/newview/llvotree.cpp
+++ b/indra/newview/llvotree.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvotree.cpp
* @brief LLVOTree class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -81,291 +81,291 @@ S32 LLVOTree::sMaxTreeSpecies = 0;
// Tree variables and functions
LLVOTree::LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp):
- LLViewerObject(id, pcode, regionp)
+ LLViewerObject(id, pcode, regionp)
{
- mSpecies = 0;
- mFrameCount = 0;
- mWind = mRegionp->mWind.getVelocity(getPositionRegion());
- mTrunkLOD = 0;
+ mSpecies = 0;
+ mFrameCount = 0;
+ mWind = mRegionp->mWind.getVelocity(getPositionRegion());
+ mTrunkLOD = 0;
- // if assert triggers, idleUpdate() needs to be revised and adjusted to new LOD levels
- llassert(sMAX_NUM_TREE_LOD_LEVELS == LLVolumeLODGroup::NUM_LODS);
+ // if assert triggers, idleUpdate() needs to be revised and adjusted to new LOD levels
+ llassert(sMAX_NUM_TREE_LOD_LEVELS == LLVolumeLODGroup::NUM_LODS);
}
LLVOTree::~LLVOTree()
{
- if (mData)
- {
- delete[] mData;
- mData = NULL;
- }
+ if (mData)
+ {
+ delete[] mData;
+ mData = NULL;
+ }
}
//static
bool LLVOTree::isTreeRenderingStopped()
{
- return LLVOTree::sTreeFactor < LLVOTree::sLODAngles[sMAX_NUM_TREE_LOD_LEVELS - 1] ;
+ return LLVOTree::sTreeFactor < LLVOTree::sLODAngles[sMAX_NUM_TREE_LOD_LEVELS - 1] ;
}
// static
void LLVOTree::initClass()
{
- std::string xml_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"trees.xml");
-
- LLXmlTree tree_def_tree;
-
- if (!tree_def_tree.parseFile(xml_filename))
- {
- LL_ERRS() << "Failed to parse tree file." << LL_ENDL;
- }
-
- LLXmlTreeNode* rootp = tree_def_tree.getRoot();
-
- for (LLXmlTreeNode* tree_def = rootp->getFirstChild();
- tree_def;
- tree_def = rootp->getNextChild())
- {
- if (!tree_def->hasName("tree"))
- {
- LL_WARNS() << "Invalid tree definition node " << tree_def->getName() << LL_ENDL;
- continue;
- }
- F32 F32_val;
- LLUUID id;
- S32 S32_val;
-
- BOOL success = TRUE;
-
-
-
- S32 species;
- static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id");
- if (!tree_def->getFastAttributeS32(species_id_string, species))
- {
- LL_WARNS() << "No species id defined" << LL_ENDL;
- continue;
- }
-
- if (species < 0)
- {
- LL_WARNS() << "Invalid species id " << species << LL_ENDL;
- continue;
- }
-
- if (sSpeciesTable.count(species))
- {
- LL_WARNS() << "Tree species " << species << " already defined! Duplicate discarded." << LL_ENDL;
- continue;
- }
-
- TreeSpeciesData* newTree = new TreeSpeciesData();
-
- static LLStdStringHandle texture_id_string = LLXmlTree::addAttributeString("texture_id");
- success &= tree_def->getFastAttributeUUID(texture_id_string, id);
- newTree->mTextureID = id;
-
- static LLStdStringHandle droop_string = LLXmlTree::addAttributeString("droop");
- success &= tree_def->getFastAttributeF32(droop_string, F32_val);
- newTree->mDroop = F32_val;
-
- static LLStdStringHandle twist_string = LLXmlTree::addAttributeString("twist");
- success &= tree_def->getFastAttributeF32(twist_string, F32_val);
- newTree->mTwist = F32_val;
-
- static LLStdStringHandle branches_string = LLXmlTree::addAttributeString("branches");
- success &= tree_def->getFastAttributeF32(branches_string, F32_val);
- newTree->mBranches = F32_val;
-
- static LLStdStringHandle depth_string = LLXmlTree::addAttributeString("depth");
- success &= tree_def->getFastAttributeS32(depth_string, S32_val);
- newTree->mDepth = S32_val;
-
- static LLStdStringHandle scale_step_string = LLXmlTree::addAttributeString("scale_step");
- success &= tree_def->getFastAttributeF32(scale_step_string, F32_val);
- newTree->mScaleStep = F32_val;
-
- static LLStdStringHandle trunk_depth_string = LLXmlTree::addAttributeString("trunk_depth");
- success &= tree_def->getFastAttributeS32(trunk_depth_string, S32_val);
- newTree->mTrunkDepth = S32_val;
-
- static LLStdStringHandle branch_length_string = LLXmlTree::addAttributeString("branch_length");
- success &= tree_def->getFastAttributeF32(branch_length_string, F32_val);
- newTree->mBranchLength = F32_val;
-
- static LLStdStringHandle trunk_length_string = LLXmlTree::addAttributeString("trunk_length");
- success &= tree_def->getFastAttributeF32(trunk_length_string, F32_val);
- newTree->mTrunkLength = F32_val;
-
- static LLStdStringHandle leaf_scale_string = LLXmlTree::addAttributeString("leaf_scale");
- success &= tree_def->getFastAttributeF32(leaf_scale_string, F32_val);
- newTree->mLeafScale = F32_val;
-
- static LLStdStringHandle billboard_scale_string = LLXmlTree::addAttributeString("billboard_scale");
- success &= tree_def->getFastAttributeF32(billboard_scale_string, F32_val);
- newTree->mBillboardScale = F32_val;
-
- static LLStdStringHandle billboard_ratio_string = LLXmlTree::addAttributeString("billboard_ratio");
- success &= tree_def->getFastAttributeF32(billboard_ratio_string, F32_val);
- newTree->mBillboardRatio = F32_val;
-
- static LLStdStringHandle trunk_aspect_string = LLXmlTree::addAttributeString("trunk_aspect");
- success &= tree_def->getFastAttributeF32(trunk_aspect_string, F32_val);
- newTree->mTrunkAspect = F32_val;
-
- static LLStdStringHandle branch_aspect_string = LLXmlTree::addAttributeString("branch_aspect");
- success &= tree_def->getFastAttributeF32(branch_aspect_string, F32_val);
- newTree->mBranchAspect = F32_val;
-
- static LLStdStringHandle leaf_rotate_string = LLXmlTree::addAttributeString("leaf_rotate");
- success &= tree_def->getFastAttributeF32(leaf_rotate_string, F32_val);
- newTree->mRandomLeafRotate = F32_val;
-
- static LLStdStringHandle noise_mag_string = LLXmlTree::addAttributeString("noise_mag");
- success &= tree_def->getFastAttributeF32(noise_mag_string, F32_val);
- newTree->mNoiseMag = F32_val;
-
- static LLStdStringHandle noise_scale_string = LLXmlTree::addAttributeString("noise_scale");
- success &= tree_def->getFastAttributeF32(noise_scale_string, F32_val);
- newTree->mNoiseScale = F32_val;
-
- static LLStdStringHandle taper_string = LLXmlTree::addAttributeString("taper");
- success &= tree_def->getFastAttributeF32(taper_string, F32_val);
- newTree->mTaper = F32_val;
-
- static LLStdStringHandle repeat_z_string = LLXmlTree::addAttributeString("repeat_z");
- success &= tree_def->getFastAttributeF32(repeat_z_string, F32_val);
- newTree->mRepeatTrunkZ = F32_val;
-
- sSpeciesTable[species] = newTree;
-
- if (species >= sMaxTreeSpecies) sMaxTreeSpecies = species + 1;
-
- if (!success)
- {
- std::string name;
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- tree_def->getFastAttributeString(name_string, name);
- LL_WARNS() << "Incomplete definition of tree " << name << LL_ENDL;
- }
- }
-
- BOOL have_all_trees = TRUE;
- std::string err;
-
- for (S32 i=0;i<sMaxTreeSpecies;++i)
- {
- if (!sSpeciesTable.count(i))
- {
- err.append(llformat(" %d",i));
- have_all_trees = FALSE;
- }
- }
-
- if (!have_all_trees)
- {
- LLSD args;
- args["SPECIES"] = err;
- LLNotificationsUtil::add("ErrorUndefinedTrees", args);
- }
+ std::string xml_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"trees.xml");
+
+ LLXmlTree tree_def_tree;
+
+ if (!tree_def_tree.parseFile(xml_filename))
+ {
+ LL_ERRS() << "Failed to parse tree file." << LL_ENDL;
+ }
+
+ LLXmlTreeNode* rootp = tree_def_tree.getRoot();
+
+ for (LLXmlTreeNode* tree_def = rootp->getFirstChild();
+ tree_def;
+ tree_def = rootp->getNextChild())
+ {
+ if (!tree_def->hasName("tree"))
+ {
+ LL_WARNS() << "Invalid tree definition node " << tree_def->getName() << LL_ENDL;
+ continue;
+ }
+ F32 F32_val;
+ LLUUID id;
+ S32 S32_val;
+
+ BOOL success = TRUE;
+
+
+
+ S32 species;
+ static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id");
+ if (!tree_def->getFastAttributeS32(species_id_string, species))
+ {
+ LL_WARNS() << "No species id defined" << LL_ENDL;
+ continue;
+ }
+
+ if (species < 0)
+ {
+ LL_WARNS() << "Invalid species id " << species << LL_ENDL;
+ continue;
+ }
+
+ if (sSpeciesTable.count(species))
+ {
+ LL_WARNS() << "Tree species " << species << " already defined! Duplicate discarded." << LL_ENDL;
+ continue;
+ }
+
+ TreeSpeciesData* newTree = new TreeSpeciesData();
+
+ static LLStdStringHandle texture_id_string = LLXmlTree::addAttributeString("texture_id");
+ success &= tree_def->getFastAttributeUUID(texture_id_string, id);
+ newTree->mTextureID = id;
+
+ static LLStdStringHandle droop_string = LLXmlTree::addAttributeString("droop");
+ success &= tree_def->getFastAttributeF32(droop_string, F32_val);
+ newTree->mDroop = F32_val;
+
+ static LLStdStringHandle twist_string = LLXmlTree::addAttributeString("twist");
+ success &= tree_def->getFastAttributeF32(twist_string, F32_val);
+ newTree->mTwist = F32_val;
+
+ static LLStdStringHandle branches_string = LLXmlTree::addAttributeString("branches");
+ success &= tree_def->getFastAttributeF32(branches_string, F32_val);
+ newTree->mBranches = F32_val;
+
+ static LLStdStringHandle depth_string = LLXmlTree::addAttributeString("depth");
+ success &= tree_def->getFastAttributeS32(depth_string, S32_val);
+ newTree->mDepth = S32_val;
+
+ static LLStdStringHandle scale_step_string = LLXmlTree::addAttributeString("scale_step");
+ success &= tree_def->getFastAttributeF32(scale_step_string, F32_val);
+ newTree->mScaleStep = F32_val;
+
+ static LLStdStringHandle trunk_depth_string = LLXmlTree::addAttributeString("trunk_depth");
+ success &= tree_def->getFastAttributeS32(trunk_depth_string, S32_val);
+ newTree->mTrunkDepth = S32_val;
+
+ static LLStdStringHandle branch_length_string = LLXmlTree::addAttributeString("branch_length");
+ success &= tree_def->getFastAttributeF32(branch_length_string, F32_val);
+ newTree->mBranchLength = F32_val;
+
+ static LLStdStringHandle trunk_length_string = LLXmlTree::addAttributeString("trunk_length");
+ success &= tree_def->getFastAttributeF32(trunk_length_string, F32_val);
+ newTree->mTrunkLength = F32_val;
+
+ static LLStdStringHandle leaf_scale_string = LLXmlTree::addAttributeString("leaf_scale");
+ success &= tree_def->getFastAttributeF32(leaf_scale_string, F32_val);
+ newTree->mLeafScale = F32_val;
+
+ static LLStdStringHandle billboard_scale_string = LLXmlTree::addAttributeString("billboard_scale");
+ success &= tree_def->getFastAttributeF32(billboard_scale_string, F32_val);
+ newTree->mBillboardScale = F32_val;
+
+ static LLStdStringHandle billboard_ratio_string = LLXmlTree::addAttributeString("billboard_ratio");
+ success &= tree_def->getFastAttributeF32(billboard_ratio_string, F32_val);
+ newTree->mBillboardRatio = F32_val;
+
+ static LLStdStringHandle trunk_aspect_string = LLXmlTree::addAttributeString("trunk_aspect");
+ success &= tree_def->getFastAttributeF32(trunk_aspect_string, F32_val);
+ newTree->mTrunkAspect = F32_val;
+
+ static LLStdStringHandle branch_aspect_string = LLXmlTree::addAttributeString("branch_aspect");
+ success &= tree_def->getFastAttributeF32(branch_aspect_string, F32_val);
+ newTree->mBranchAspect = F32_val;
+
+ static LLStdStringHandle leaf_rotate_string = LLXmlTree::addAttributeString("leaf_rotate");
+ success &= tree_def->getFastAttributeF32(leaf_rotate_string, F32_val);
+ newTree->mRandomLeafRotate = F32_val;
+
+ static LLStdStringHandle noise_mag_string = LLXmlTree::addAttributeString("noise_mag");
+ success &= tree_def->getFastAttributeF32(noise_mag_string, F32_val);
+ newTree->mNoiseMag = F32_val;
+
+ static LLStdStringHandle noise_scale_string = LLXmlTree::addAttributeString("noise_scale");
+ success &= tree_def->getFastAttributeF32(noise_scale_string, F32_val);
+ newTree->mNoiseScale = F32_val;
+
+ static LLStdStringHandle taper_string = LLXmlTree::addAttributeString("taper");
+ success &= tree_def->getFastAttributeF32(taper_string, F32_val);
+ newTree->mTaper = F32_val;
+
+ static LLStdStringHandle repeat_z_string = LLXmlTree::addAttributeString("repeat_z");
+ success &= tree_def->getFastAttributeF32(repeat_z_string, F32_val);
+ newTree->mRepeatTrunkZ = F32_val;
+
+ sSpeciesTable[species] = newTree;
+
+ if (species >= sMaxTreeSpecies) sMaxTreeSpecies = species + 1;
+
+ if (!success)
+ {
+ std::string name;
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ tree_def->getFastAttributeString(name_string, name);
+ LL_WARNS() << "Incomplete definition of tree " << name << LL_ENDL;
+ }
+ }
+
+ BOOL have_all_trees = TRUE;
+ std::string err;
+
+ for (S32 i=0;i<sMaxTreeSpecies;++i)
+ {
+ if (!sSpeciesTable.count(i))
+ {
+ err.append(llformat(" %d",i));
+ have_all_trees = FALSE;
+ }
+ }
+
+ if (!have_all_trees)
+ {
+ LLSD args;
+ args["SPECIES"] = err;
+ LLNotificationsUtil::add("ErrorUndefinedTrees", args);
+ }
};
//static
void LLVOTree::cleanupClass()
{
- std::for_each(sSpeciesTable.begin(), sSpeciesTable.end(), DeletePairedPointer());
- sSpeciesTable.clear();
+ std::for_each(sSpeciesTable.begin(), sSpeciesTable.end(), DeletePairedPointer());
+ sSpeciesTable.clear();
}
U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num, EObjectUpdateType update_type,
- LLDataPacker *dp)
+ void **user_data,
+ U32 block_num, EObjectUpdateType update_type,
+ LLDataPacker *dp)
{
- // Do base class updates...
- U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
-
- if ( (getVelocity().lengthSquared() > 0.f)
- ||(getAcceleration().lengthSquared() > 0.f)
- ||(getAngularVelocity().lengthSquared() > 0.f))
- {
- LL_INFOS() << "ACK! Moving tree!" << LL_ENDL;
- setVelocity(LLVector3::zero);
- setAcceleration(LLVector3::zero);
- setAngularVelocity(LLVector3::zero);
- }
-
- if (update_type == OUT_TERSE_IMPROVED)
- {
- // Nothing else needs to be done for the terse message.
- return retval;
- }
-
- //
- // Load Instance-Specific data
- //
- if (mData)
- {
- mSpecies = ((U8 *)mData)[0];
- }
-
- if (!sSpeciesTable.count(mSpecies))
- {
- if (sSpeciesTable.size())
- {
- SpeciesMap::const_iterator it = sSpeciesTable.begin();
- mSpecies = (*it).first;
- }
- }
-
- //
- // Load Species-Specific data
- //
- static const S32 MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL = 32 ; //frames.
- mTreeImagep = LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- mTreeImagep->setMaxVirtualSizeResetInterval(MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); //allow to wait for at most 16 frames to reset virtual size.
-
- mBranchLength = sSpeciesTable[mSpecies]->mBranchLength;
- mTrunkLength = sSpeciesTable[mSpecies]->mTrunkLength;
- mLeafScale = sSpeciesTable[mSpecies]->mLeafScale;
- mDroop = sSpeciesTable[mSpecies]->mDroop;
- mTwist = sSpeciesTable[mSpecies]->mTwist;
- mBranches = sSpeciesTable[mSpecies]->mBranches;
- mDepth = sSpeciesTable[mSpecies]->mDepth;
- mScaleStep = sSpeciesTable[mSpecies]->mScaleStep;
- mTrunkDepth = sSpeciesTable[mSpecies]->mTrunkDepth;
- mBillboardScale = sSpeciesTable[mSpecies]->mBillboardScale;
- mBillboardRatio = sSpeciesTable[mSpecies]->mBillboardRatio;
- mTrunkAspect = sSpeciesTable[mSpecies]->mTrunkAspect;
- mBranchAspect = sSpeciesTable[mSpecies]->mBranchAspect;
-
- // position change not caused by us, etc. make sure to rebuild.
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
-
- return retval;
+ // Do base class updates...
+ U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
+
+ if ( (getVelocity().lengthSquared() > 0.f)
+ ||(getAcceleration().lengthSquared() > 0.f)
+ ||(getAngularVelocity().lengthSquared() > 0.f))
+ {
+ LL_INFOS() << "ACK! Moving tree!" << LL_ENDL;
+ setVelocity(LLVector3::zero);
+ setAcceleration(LLVector3::zero);
+ setAngularVelocity(LLVector3::zero);
+ }
+
+ if (update_type == OUT_TERSE_IMPROVED)
+ {
+ // Nothing else needs to be done for the terse message.
+ return retval;
+ }
+
+ //
+ // Load Instance-Specific data
+ //
+ if (mData)
+ {
+ mSpecies = ((U8 *)mData)[0];
+ }
+
+ if (!sSpeciesTable.count(mSpecies))
+ {
+ if (sSpeciesTable.size())
+ {
+ SpeciesMap::const_iterator it = sSpeciesTable.begin();
+ mSpecies = (*it).first;
+ }
+ }
+
+ //
+ // Load Species-Specific data
+ //
+ static const S32 MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL = 32 ; //frames.
+ mTreeImagep = LLViewerTextureManager::getFetchedTexture(sSpeciesTable[mSpecies]->mTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ mTreeImagep->setMaxVirtualSizeResetInterval(MAX_TREE_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); //allow to wait for at most 16 frames to reset virtual size.
+
+ mBranchLength = sSpeciesTable[mSpecies]->mBranchLength;
+ mTrunkLength = sSpeciesTable[mSpecies]->mTrunkLength;
+ mLeafScale = sSpeciesTable[mSpecies]->mLeafScale;
+ mDroop = sSpeciesTable[mSpecies]->mDroop;
+ mTwist = sSpeciesTable[mSpecies]->mTwist;
+ mBranches = sSpeciesTable[mSpecies]->mBranches;
+ mDepth = sSpeciesTable[mSpecies]->mDepth;
+ mScaleStep = sSpeciesTable[mSpecies]->mScaleStep;
+ mTrunkDepth = sSpeciesTable[mSpecies]->mTrunkDepth;
+ mBillboardScale = sSpeciesTable[mSpecies]->mBillboardScale;
+ mBillboardRatio = sSpeciesTable[mSpecies]->mBillboardRatio;
+ mTrunkAspect = sSpeciesTable[mSpecies]->mTrunkAspect;
+ mBranchAspect = sSpeciesTable[mSpecies]->mBranchAspect;
+
+ // position change not caused by us, etc. make sure to rebuild.
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+
+ return retval;
}
void LLVOTree::idleUpdate(LLAgent &agent, const F64 &time)
{
- if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TREE)))
- {
- return;
- }
-
- S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ; // disabled
- F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor;
- F32 distance = mDrawable->mDistanceWRTCamera * LLVOVolume::sDistanceFactor * (F_PI / 3.f);
- F32 diameter = getScale().length(); // trees have very broken scale, but length rougtly outlines proper diameter
- F32 sz = mBillboardScale * mBillboardRatio * diameter;
-
- for (S32 j = 0; j < sMAX_NUM_TREE_LOD_LEVELS; j++)
- {
- if (app_angle > LLVOTree::sLODAngles[j])
- {
- trunk_LOD = j;
- break;
- }
- }
+ if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TREE)))
+ {
+ return;
+ }
+
+ S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ; // disabled
+ F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor;
+ F32 distance = mDrawable->mDistanceWRTCamera * LLVOVolume::sDistanceFactor * (F_PI / 3.f);
+ F32 diameter = getScale().length(); // trees have very broken scale, but length rougtly outlines proper diameter
+ F32 sz = mBillboardScale * mBillboardRatio * diameter;
+
+ for (S32 j = 0; j < sMAX_NUM_TREE_LOD_LEVELS; j++)
+ {
+ if (app_angle > LLVOTree::sLODAngles[j])
+ {
+ trunk_LOD = j;
+ break;
+ }
+ }
F32 tan_angle = (LLVOTree::sTreeFactor * 64 * sz) / distance;
S32 cur_detail = LLVolumeLODGroup::getDetailFromTan(ll_round(tan_angle, 0.01f)); // larger value, better quality
@@ -374,41 +374,41 @@ void LLVOTree::idleUpdate(LLAgent &agent, const F64 &time)
trunk_LOD = llmax(trunk_LOD, LLVolumeLODGroup::NUM_LODS - cur_detail - 1);
trunk_LOD = llmin(trunk_LOD, sMAX_NUM_TREE_LOD_LEVELS);
- if (mReferenceBuffer.isNull())
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- }
- else if (trunk_LOD != mTrunkLOD)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
- }
- else
- {
- // we're not animating but we may *still* need to
- // regenerate the mesh if we moved, since position
- // and rotation are baked into the mesh.
- // *TODO: I don't know what's so special about trees
- // that they don't get REBUILD_POSITION automatically
- // at a higher level.
- const LLVector3 &this_position = getPositionRegion();
- if (this_position != mLastPosition)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
- mLastPosition = this_position;
- }
- else
- {
- const LLQuaternion &this_rotation = getRotation();
-
- if (this_rotation != mLastRotation)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
- mLastRotation = this_rotation;
- }
- }
- }
-
- mTrunkLOD = trunk_LOD;
+ if (mReferenceBuffer.isNull())
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ else if (trunk_LOD != mTrunkLOD)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ }
+ else
+ {
+ // we're not animating but we may *still* need to
+ // regenerate the mesh if we moved, since position
+ // and rotation are baked into the mesh.
+ // *TODO: I don't know what's so special about trees
+ // that they don't get REBUILD_POSITION automatically
+ // at a higher level.
+ const LLVector3 &this_position = getPositionRegion();
+ if (this_position != mLastPosition)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
+ mLastPosition = this_position;
+ }
+ else
+ {
+ const LLQuaternion &this_rotation = getRotation();
+
+ if (this_rotation != mLastRotation)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
+ mLastRotation = this_rotation;
+ }
+ }
+ }
+
+ mTrunkLOD = trunk_LOD;
}
void LLVOTree::render(LLAgent &agent)
@@ -418,74 +418,74 @@ void LLVOTree::render(LLAgent &agent)
void LLVOTree::setPixelAreaAndAngle(LLAgent &agent)
{
- LLVector3 center = getPositionAgent();//center of tree.
- LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
- LLVector3 lookAt = center - viewer_pos_agent;
- F32 dist = lookAt.normVec() ;
- F32 cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ;
- F32 radius = getScale().length()*0.5f;
- F32 range = dist - radius;
-
- if (range < F_ALMOST_ZERO || isHUDAttachment()) // range == zero
- {
- mAppAngle = 180.f;
- }
- else
- {
- mAppAngle = (F32) atan2( getMaxScale(), range) * RAD_TO_DEG;
- }
-
- F32 max_scale = mBillboardScale * getMaxScale();
- F32 area = max_scale * (max_scale*mBillboardRatio);
- // Compute pixels per meter at the given range
- F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / (tan(LLViewerCamera::getInstance()->getView()) * dist);
- mPixelArea = pixels_per_meter * pixels_per_meter * area ;
-
- F32 importance = LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist) ;
- mPixelArea = LLFace::adjustPixelArea(importance, mPixelArea) ;
- if (mPixelArea > LLViewerCamera::getInstance()->getScreenPixelArea())
- {
- mAppAngle = 180.f;
- }
+ LLVector3 center = getPositionAgent();//center of tree.
+ LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
+ LLVector3 lookAt = center - viewer_pos_agent;
+ F32 dist = lookAt.normVec() ;
+ F32 cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ;
+ F32 radius = getScale().length()*0.5f;
+ F32 range = dist - radius;
+
+ if (range < F_ALMOST_ZERO || isHUDAttachment()) // range == zero
+ {
+ mAppAngle = 180.f;
+ }
+ else
+ {
+ mAppAngle = (F32) atan2( getMaxScale(), range) * RAD_TO_DEG;
+ }
+
+ F32 max_scale = mBillboardScale * getMaxScale();
+ F32 area = max_scale * (max_scale*mBillboardRatio);
+ // Compute pixels per meter at the given range
+ F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / (tan(LLViewerCamera::getInstance()->getView()) * dist);
+ mPixelArea = pixels_per_meter * pixels_per_meter * area ;
+
+ F32 importance = LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist) ;
+ mPixelArea = LLFace::adjustPixelArea(importance, mPixelArea) ;
+ if (mPixelArea > LLViewerCamera::getInstance()->getScreenPixelArea())
+ {
+ mAppAngle = 180.f;
+ }
#if 0
- // mAppAngle is a bit of voodoo;
- // use the one calculated LLViewerObject::setPixelAreaAndAngle above
- // to avoid LOD miscalculations
- mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG;
+ // mAppAngle is a bit of voodoo;
+ // use the one calculated LLViewerObject::setPixelAreaAndAngle above
+ // to avoid LOD miscalculations
+ mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG;
#endif
}
void LLVOTree::updateTextures()
{
- if (mTreeImagep)
- {
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
- {
- setDebugText(llformat("%4.0f", (F32) sqrt(mPixelArea)));
- }
- mTreeImagep->addTextureStats(mPixelArea);
- }
+ if (mTreeImagep)
+ {
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
+ {
+ setDebugText(llformat("%4.0f", (F32) sqrt(mPixelArea)));
+ }
+ mTreeImagep->addTextureStats(mPixelArea);
+ }
}
LLDrawable* LLVOTree::createDrawable(LLPipeline *pipeline)
{
- pipeline->allocDrawable(this);
- mDrawable->setLit(FALSE);
+ pipeline->allocDrawable(this);
+ mDrawable->setLit(FALSE);
- mDrawable->setRenderType(LLPipeline::RENDER_TYPE_TREE);
+ mDrawable->setRenderType(LLPipeline::RENDER_TYPE_TREE);
- LLDrawPoolTree *poolp = (LLDrawPoolTree*) gPipeline.getPool(LLDrawPool::POOL_TREE, mTreeImagep);
+ LLDrawPoolTree *poolp = (LLDrawPoolTree*) gPipeline.getPool(LLDrawPool::POOL_TREE, mTreeImagep);
- // Just a placeholder for an actual object...
- LLFace *facep = mDrawable->addFace(poolp, mTreeImagep);
- facep->setSize(1, 3);
+ // Just a placeholder for an actual object...
+ LLFace *facep = mDrawable->addFace(poolp, mTreeImagep);
+ facep->setSize(1, 3);
- updateRadius();
+ updateRadius();
- return mDrawable;
+ return mDrawable;
}
@@ -497,744 +497,744 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
{
LL_PROFILE_ZONE_SCOPED;
- if(mTrunkLOD >= sMAX_NUM_TREE_LOD_LEVELS) //do not display the tree.
- {
- mReferenceBuffer = NULL ;
- LLFace * facep = drawable->getFace(0);
- if (facep)
- {
- facep->setVertexBuffer(NULL);
- }
- return TRUE ;
- }
-
- if (mDrawable->getFace(0) &&
- (mReferenceBuffer.isNull() || !mDrawable->getFace(0)->getVertexBuffer()))
- {
- const F32 SRR3 = 0.577350269f; // sqrt(1/3)
- const F32 SRR2 = 0.707106781f; // sqrt(1/2)
- U32 i, j;
-
- U32 slices = MAX_SLICES;
-
- S32 max_indices = LEAF_INDICES;
- S32 max_vertices = LEAF_VERTICES;
- S32 lod;
-
- LLFace *face = drawable->getFace(0);
- if (!face) return TRUE;
-
- face->mCenterAgent = getPositionAgent();
- face->mCenterLocal = face->mCenterAgent;
-
- for (lod = 0; lod < sMAX_NUM_TREE_LOD_LEVELS; lod++)
- {
- slices = sLODSlices[lod];
- sLODVertexOffset[lod] = max_vertices;
- sLODVertexCount[lod] = slices*slices;
- sLODIndexOffset[lod] = max_indices;
- sLODIndexCount[lod] = (slices-1)*(slices-1)*6;
- max_indices += sLODIndexCount[lod];
- max_vertices += sLODVertexCount[lod];
- }
-
- mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
- if (!mReferenceBuffer->allocateBuffer(max_vertices, max_indices))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer on update to "
- << max_vertices << " vertices and "
- << max_indices << " indices" << LL_ENDL;
- mReferenceBuffer = NULL; //unref
- return TRUE;
- }
-
- LLStrider<LLVector3> vertices;
- LLStrider<LLVector3> normals;
+ if(mTrunkLOD >= sMAX_NUM_TREE_LOD_LEVELS) //do not display the tree.
+ {
+ mReferenceBuffer = NULL ;
+ LLFace * facep = drawable->getFace(0);
+ if (facep)
+ {
+ facep->setVertexBuffer(NULL);
+ }
+ return TRUE ;
+ }
+
+ if (mDrawable->getFace(0) &&
+ (mReferenceBuffer.isNull() || !mDrawable->getFace(0)->getVertexBuffer()))
+ {
+ const F32 SRR3 = 0.577350269f; // sqrt(1/3)
+ const F32 SRR2 = 0.707106781f; // sqrt(1/2)
+ U32 i, j;
+
+ U32 slices = MAX_SLICES;
+
+ S32 max_indices = LEAF_INDICES;
+ S32 max_vertices = LEAF_VERTICES;
+ S32 lod;
+
+ LLFace *face = drawable->getFace(0);
+ if (!face) return TRUE;
+
+ face->mCenterAgent = getPositionAgent();
+ face->mCenterLocal = face->mCenterAgent;
+
+ for (lod = 0; lod < sMAX_NUM_TREE_LOD_LEVELS; lod++)
+ {
+ slices = sLODSlices[lod];
+ sLODVertexOffset[lod] = max_vertices;
+ sLODVertexCount[lod] = slices*slices;
+ sLODIndexOffset[lod] = max_indices;
+ sLODIndexCount[lod] = (slices-1)*(slices-1)*6;
+ max_indices += sLODIndexCount[lod];
+ max_vertices += sLODVertexCount[lod];
+ }
+
+ mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
+ if (!mReferenceBuffer->allocateBuffer(max_vertices, max_indices))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer on update to "
+ << max_vertices << " vertices and "
+ << max_indices << " indices" << LL_ENDL;
+ mReferenceBuffer = NULL; //unref
+ return TRUE;
+ }
+
+ LLStrider<LLVector3> vertices;
+ LLStrider<LLVector3> normals;
LLStrider<LLColor4U> colors;
- LLStrider<LLVector2> tex_coords;
- LLStrider<U16> indicesp;
+ LLStrider<LLVector2> tex_coords;
+ LLStrider<U16> indicesp;
- mReferenceBuffer->getVertexStrider(vertices);
- mReferenceBuffer->getNormalStrider(normals);
- mReferenceBuffer->getTexCoord0Strider(tex_coords);
+ mReferenceBuffer->getVertexStrider(vertices);
+ mReferenceBuffer->getNormalStrider(normals);
+ mReferenceBuffer->getTexCoord0Strider(tex_coords);
mReferenceBuffer->getColorStrider(colors);
- mReferenceBuffer->getIndexStrider(indicesp);
-
- S32 vertex_count = 0;
- S32 index_count = 0;
-
- // First leaf
- *(normals++) = LLVector3(-SRR2, -SRR2, 0.f);
- *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
- *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
+ mReferenceBuffer->getIndexStrider(indicesp);
+
+ S32 vertex_count = 0;
+ S32 index_count = 0;
+
+ // First leaf
+ *(normals++) = LLVector3(-SRR2, -SRR2, 0.f);
+ *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
+ *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(SRR3, -SRR3, SRR3);
- *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
- *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
+ *(normals++) = LLVector3(SRR3, -SRR3, SRR3);
+ *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
+ *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(-SRR3, -SRR3, SRR3);
- *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
- *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
+ *(normals++) = LLVector3(-SRR3, -SRR3, SRR3);
+ *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
+ *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(SRR2, -SRR2, 0.f);
- *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
- *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f);
+ *(normals++) = LLVector3(SRR2, -SRR2, 0.f);
+ *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
+ *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
-
- *(indicesp++) = 0;
- index_count++;
- *(indicesp++) = 1;
- index_count++;
- *(indicesp++) = 2;
- index_count++;
-
- *(indicesp++) = 0;
- index_count++;
- *(indicesp++) = 3;
- index_count++;
- *(indicesp++) = 1;
- index_count++;
-
- // Same leaf, inverse winding/normals
- *(normals++) = LLVector3(-SRR2, SRR2, 0.f);
- *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
- *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
+ vertex_count++;
+
+ *(indicesp++) = 0;
+ index_count++;
+ *(indicesp++) = 1;
+ index_count++;
+ *(indicesp++) = 2;
+ index_count++;
+
+ *(indicesp++) = 0;
+ index_count++;
+ *(indicesp++) = 3;
+ index_count++;
+ *(indicesp++) = 1;
+ index_count++;
+
+ // Same leaf, inverse winding/normals
+ *(normals++) = LLVector3(-SRR2, SRR2, 0.f);
+ *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
+ *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(SRR3, SRR3, SRR3);
- *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
- *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
+ *(normals++) = LLVector3(SRR3, SRR3, SRR3);
+ *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
+ *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(-SRR3, SRR3, SRR3);
- *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
- *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
+ *(normals++) = LLVector3(-SRR3, SRR3, SRR3);
+ *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
+ *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(SRR2, SRR2, 0.f);
- *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
- *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f);
+ *(normals++) = LLVector3(SRR2, SRR2, 0.f);
+ *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
+ *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
-
- *(indicesp++) = 4;
- index_count++;
- *(indicesp++) = 6;
- index_count++;
- *(indicesp++) = 5;
- index_count++;
-
- *(indicesp++) = 4;
- index_count++;
- *(indicesp++) = 5;
- index_count++;
- *(indicesp++) = 7;
- index_count++;
-
-
- // next leaf
- *(normals++) = LLVector3(SRR2, -SRR2, 0.f);
- *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
- *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f);
+ vertex_count++;
+
+ *(indicesp++) = 4;
+ index_count++;
+ *(indicesp++) = 6;
+ index_count++;
+ *(indicesp++) = 5;
+ index_count++;
+
+ *(indicesp++) = 4;
+ index_count++;
+ *(indicesp++) = 5;
+ index_count++;
+ *(indicesp++) = 7;
+ index_count++;
+
+
+ // next leaf
+ *(normals++) = LLVector3(SRR2, -SRR2, 0.f);
+ *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
+ *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(SRR3, SRR3, SRR3);
- *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
- *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f);
+ *(normals++) = LLVector3(SRR3, SRR3, SRR3);
+ *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
+ *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(SRR3, -SRR3, SRR3);
- *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
- *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f);
+ *(normals++) = LLVector3(SRR3, -SRR3, SRR3);
+ *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
+ *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(SRR2, SRR2, 0.f);
- *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
- *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f);
+ *(normals++) = LLVector3(SRR2, SRR2, 0.f);
+ *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
+ *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
-
- *(indicesp++) = 8;
- index_count++;
- *(indicesp++) = 9;
- index_count++;
- *(indicesp++) = 10;
- index_count++;
-
- *(indicesp++) = 8;
- index_count++;
- *(indicesp++) = 11;
- index_count++;
- *(indicesp++) = 9;
- index_count++;
-
-
- // other side of same leaf
- *(normals++) = LLVector3(-SRR2, -SRR2, 0.f);
- *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
- *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f);
+ vertex_count++;
+
+ *(indicesp++) = 8;
+ index_count++;
+ *(indicesp++) = 9;
+ index_count++;
+ *(indicesp++) = 10;
+ index_count++;
+
+ *(indicesp++) = 8;
+ index_count++;
+ *(indicesp++) = 11;
+ index_count++;
+ *(indicesp++) = 9;
+ index_count++;
+
+
+ // other side of same leaf
+ *(normals++) = LLVector3(-SRR2, -SRR2, 0.f);
+ *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
+ *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(-SRR3, SRR3, SRR3);
- *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
- *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f);
+ *(normals++) = LLVector3(-SRR3, SRR3, SRR3);
+ *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
+ *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(-SRR3, -SRR3, SRR3);
- *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
- *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f);
+ *(normals++) = LLVector3(-SRR3, -SRR3, SRR3);
+ *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
+ *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
+ vertex_count++;
- *(normals++) = LLVector3(-SRR2, SRR2, 0.f);
- *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
- *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f);
+ *(normals++) = LLVector3(-SRR2, SRR2, 0.f);
+ *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
+ *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f);
*(colors++) = LLColor4U::white;
- vertex_count++;
-
- *(indicesp++) = 12;
- index_count++;
- *(indicesp++) = 14;
- index_count++;
- *(indicesp++) = 13;
- index_count++;
-
- *(indicesp++) = 12;
- index_count++;
- *(indicesp++) = 13;
- index_count++;
- *(indicesp++) = 15;
- index_count++;
-
- // Generate geometry for the cylinders
-
- // Different LOD's
-
- // Generate the vertices
- // Generate the indices
-
- for (lod = 0; lod < sMAX_NUM_TREE_LOD_LEVELS; lod++)
- {
- slices = sLODSlices[lod];
- F32 base_radius = 0.65f;
- F32 top_radius = base_radius * sSpeciesTable[mSpecies]->mTaper;
- //LL_INFOS() << "Species " << ((U32) mSpecies) << ", taper = " << sSpeciesTable[mSpecies].mTaper << LL_ENDL;
- //LL_INFOS() << "Droop " << mDroop << ", branchlength: " << mBranchLength << LL_ENDL;
- F32 angle = 0;
- F32 angle_inc = 360.f/(slices-1);
- F32 z = 0.f;
- F32 z_inc = 1.f;
- if (slices > 3)
- {
- z_inc = 1.f/(slices - 3);
- }
- F32 radius = base_radius;
-
- F32 x1,y1;
- F32 noise_scale = sSpeciesTable[mSpecies]->mNoiseMag;
- LLVector3 nvec;
-
- const F32 cap_nudge = 0.1f; // Height to 'peak' the caps on top/bottom of branch
-
- const S32 fractal_depth = 5;
- F32 nvec_scale = 1.f * sSpeciesTable[mSpecies]->mNoiseScale;
- F32 nvec_scalez = 4.f * sSpeciesTable[mSpecies]->mNoiseScale;
-
- F32 tex_z_repeat = sSpeciesTable[mSpecies]->mRepeatTrunkZ;
-
- F32 start_radius;
- F32 nangle = 0;
- F32 height = 1.f;
- F32 r0;
-
- for (i = 0; i < slices; i++)
- {
- if (i == 0)
- {
- z = - cap_nudge;
- r0 = 0.0;
- }
- else if (i == (slices - 1))
- {
- z = 1.f + cap_nudge;//((i - 2) * z_inc) + cap_nudge;
- r0 = 0.0;
- }
- else
- {
- z = (i - 1) * z_inc;
- r0 = base_radius + (top_radius - base_radius)*z;
- }
-
- for (j = 0; j < slices; j++)
- {
- if (slices - 1 == j)
- {
- angle = 0.f;
- }
- else
- {
- angle = j*angle_inc;
- }
-
- nangle = angle;
-
- x1 = cos(angle * DEG_TO_RAD);
- y1 = sin(angle * DEG_TO_RAD);
- LLVector2 tc;
- // This isn't totally accurate. Should compute based on slope as well.
- start_radius = r0 * (1.f + 1.2f*fabs(z - 0.66f*height)/height);
- nvec.set( cos(nangle * DEG_TO_RAD)*start_radius*nvec_scale,
- sin(nangle * DEG_TO_RAD)*start_radius*nvec_scale,
- z*nvec_scalez);
- // First and last slice at 0 radius (to bring in top/bottom of structure)
- radius = start_radius + turbulence3((F32*)&nvec.mV, (F32)fractal_depth)*noise_scale;
-
- if (slices - 1 == j)
- {
- // Not 0.5 for slight slop factor to avoid edges on leaves
- tc = LLVector2(0.490f, (1.f - z/2.f)*tex_z_repeat);
- }
- else
- {
- tc = LLVector2((angle/360.f)*0.5f, (1.f - z/2.f)*tex_z_repeat);
- }
-
- *(vertices++) = LLVector3(x1*radius, y1*radius, z);
- *(normals++) = LLVector3(x1, y1, 0.f);
- *(tex_coords++) = tc;
+ vertex_count++;
+
+ *(indicesp++) = 12;
+ index_count++;
+ *(indicesp++) = 14;
+ index_count++;
+ *(indicesp++) = 13;
+ index_count++;
+
+ *(indicesp++) = 12;
+ index_count++;
+ *(indicesp++) = 13;
+ index_count++;
+ *(indicesp++) = 15;
+ index_count++;
+
+ // Generate geometry for the cylinders
+
+ // Different LOD's
+
+ // Generate the vertices
+ // Generate the indices
+
+ for (lod = 0; lod < sMAX_NUM_TREE_LOD_LEVELS; lod++)
+ {
+ slices = sLODSlices[lod];
+ F32 base_radius = 0.65f;
+ F32 top_radius = base_radius * sSpeciesTable[mSpecies]->mTaper;
+ //LL_INFOS() << "Species " << ((U32) mSpecies) << ", taper = " << sSpeciesTable[mSpecies].mTaper << LL_ENDL;
+ //LL_INFOS() << "Droop " << mDroop << ", branchlength: " << mBranchLength << LL_ENDL;
+ F32 angle = 0;
+ F32 angle_inc = 360.f/(slices-1);
+ F32 z = 0.f;
+ F32 z_inc = 1.f;
+ if (slices > 3)
+ {
+ z_inc = 1.f/(slices - 3);
+ }
+ F32 radius = base_radius;
+
+ F32 x1,y1;
+ F32 noise_scale = sSpeciesTable[mSpecies]->mNoiseMag;
+ LLVector3 nvec;
+
+ const F32 cap_nudge = 0.1f; // Height to 'peak' the caps on top/bottom of branch
+
+ const S32 fractal_depth = 5;
+ F32 nvec_scale = 1.f * sSpeciesTable[mSpecies]->mNoiseScale;
+ F32 nvec_scalez = 4.f * sSpeciesTable[mSpecies]->mNoiseScale;
+
+ F32 tex_z_repeat = sSpeciesTable[mSpecies]->mRepeatTrunkZ;
+
+ F32 start_radius;
+ F32 nangle = 0;
+ F32 height = 1.f;
+ F32 r0;
+
+ for (i = 0; i < slices; i++)
+ {
+ if (i == 0)
+ {
+ z = - cap_nudge;
+ r0 = 0.0;
+ }
+ else if (i == (slices - 1))
+ {
+ z = 1.f + cap_nudge;//((i - 2) * z_inc) + cap_nudge;
+ r0 = 0.0;
+ }
+ else
+ {
+ z = (i - 1) * z_inc;
+ r0 = base_radius + (top_radius - base_radius)*z;
+ }
+
+ for (j = 0; j < slices; j++)
+ {
+ if (slices - 1 == j)
+ {
+ angle = 0.f;
+ }
+ else
+ {
+ angle = j*angle_inc;
+ }
+
+ nangle = angle;
+
+ x1 = cos(angle * DEG_TO_RAD);
+ y1 = sin(angle * DEG_TO_RAD);
+ LLVector2 tc;
+ // This isn't totally accurate. Should compute based on slope as well.
+ start_radius = r0 * (1.f + 1.2f*fabs(z - 0.66f*height)/height);
+ nvec.set( cos(nangle * DEG_TO_RAD)*start_radius*nvec_scale,
+ sin(nangle * DEG_TO_RAD)*start_radius*nvec_scale,
+ z*nvec_scalez);
+ // First and last slice at 0 radius (to bring in top/bottom of structure)
+ radius = start_radius + turbulence3((F32*)&nvec.mV, (F32)fractal_depth)*noise_scale;
+
+ if (slices - 1 == j)
+ {
+ // Not 0.5 for slight slop factor to avoid edges on leaves
+ tc = LLVector2(0.490f, (1.f - z/2.f)*tex_z_repeat);
+ }
+ else
+ {
+ tc = LLVector2((angle/360.f)*0.5f, (1.f - z/2.f)*tex_z_repeat);
+ }
+
+ *(vertices++) = LLVector3(x1*radius, y1*radius, z);
+ *(normals++) = LLVector3(x1, y1, 0.f);
+ *(tex_coords++) = tc;
*(colors++) = LLColor4U::white;
- vertex_count++;
- }
- }
-
- for (i = 0; i < (slices - 1); i++)
- {
- for (j = 0; j < (slices - 1); j++)
- {
- S32 x1_offset = j+1;
- if ((j+1) == slices)
- {
- x1_offset = 0;
- }
- // Generate the matching quads
- *(indicesp) = j + (i*slices) + sLODVertexOffset[lod];
- llassert(*(indicesp) < (U32)max_vertices);
- indicesp++;
- index_count++;
- *(indicesp) = x1_offset + ((i+1)*slices) + sLODVertexOffset[lod];
- llassert(*(indicesp) < (U32)max_vertices);
- indicesp++;
- index_count++;
- *(indicesp) = j + ((i+1)*slices) + sLODVertexOffset[lod];
- llassert(*(indicesp) < (U32)max_vertices);
- indicesp++;
- index_count++;
-
- *(indicesp) = j + (i*slices) + sLODVertexOffset[lod];
- llassert(*(indicesp) < (U32)max_vertices);
- indicesp++;
- index_count++;
- *(indicesp) = x1_offset + (i*slices) + sLODVertexOffset[lod];
- llassert(*(indicesp) < (U32)max_vertices);
- indicesp++;
- index_count++;
- *(indicesp) = x1_offset + ((i+1)*slices) + sLODVertexOffset[lod];
- llassert(*(indicesp) < (U32)max_vertices);
- indicesp++;
- index_count++;
- }
- }
- slices /= 2;
- }
-
- mReferenceBuffer->unmapBuffer();
- llassert(vertex_count == max_vertices);
- llassert(index_count == max_indices);
+ vertex_count++;
+ }
+ }
+
+ for (i = 0; i < (slices - 1); i++)
+ {
+ for (j = 0; j < (slices - 1); j++)
+ {
+ S32 x1_offset = j+1;
+ if ((j+1) == slices)
+ {
+ x1_offset = 0;
+ }
+ // Generate the matching quads
+ *(indicesp) = j + (i*slices) + sLODVertexOffset[lod];
+ llassert(*(indicesp) < (U32)max_vertices);
+ indicesp++;
+ index_count++;
+ *(indicesp) = x1_offset + ((i+1)*slices) + sLODVertexOffset[lod];
+ llassert(*(indicesp) < (U32)max_vertices);
+ indicesp++;
+ index_count++;
+ *(indicesp) = j + ((i+1)*slices) + sLODVertexOffset[lod];
+ llassert(*(indicesp) < (U32)max_vertices);
+ indicesp++;
+ index_count++;
+
+ *(indicesp) = j + (i*slices) + sLODVertexOffset[lod];
+ llassert(*(indicesp) < (U32)max_vertices);
+ indicesp++;
+ index_count++;
+ *(indicesp) = x1_offset + (i*slices) + sLODVertexOffset[lod];
+ llassert(*(indicesp) < (U32)max_vertices);
+ indicesp++;
+ index_count++;
+ *(indicesp) = x1_offset + ((i+1)*slices) + sLODVertexOffset[lod];
+ llassert(*(indicesp) < (U32)max_vertices);
+ indicesp++;
+ index_count++;
+ }
+ }
+ slices /= 2;
+ }
+
+ mReferenceBuffer->unmapBuffer();
+ llassert(vertex_count == max_vertices);
+ llassert(index_count == max_indices);
#ifndef SHOW_ASSERT
(void)vertex_count;
(void)index_count;
#endif
- }
+ }
- //generate tree mesh
- updateMesh();
-
- return TRUE;
+ //generate tree mesh
+ updateMesh();
+
+ return TRUE;
}
void LLVOTree::updateMesh()
{
- LLMatrix4 matrix;
-
- // Translate to tree base HACK - adjustment in Z plants tree underground
- const LLVector3 &pos_region = getPositionRegion();
- //gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
- LLMatrix4 trans_mat;
- trans_mat.setTranslation(pos_region.mV[VX], pos_region.mV[VY], pos_region.mV[VZ] - 0.1f);
- trans_mat *= matrix;
-
- // Rotate to tree position and bend for current trunk/wind
- // Note that trunk stiffness controls the amount of bend at the trunk as
- // opposed to the crown of the tree
- //
- const F32 TRUNK_STIFF = 22.f;
-
- LLQuaternion rot =
- LLQuaternion(mTrunkBend.magVec()*TRUNK_STIFF*DEG_TO_RAD, LLVector4(mTrunkBend.mV[VX], mTrunkBend.mV[VY], 0)) *
- LLQuaternion(90.f*DEG_TO_RAD, LLVector4(0,0,1)) *
- getRotation();
-
- LLMatrix4 rot_mat(rot);
- rot_mat *= trans_mat;
-
- F32 radius = getScale().magVec()*0.05f;
- LLMatrix4 scale_mat;
- scale_mat.mMatrix[0][0] =
- scale_mat.mMatrix[1][1] =
- scale_mat.mMatrix[2][2] = radius;
-
- scale_mat *= rot_mat;
-
-// const F32 THRESH_ANGLE_FOR_BILLBOARD = 15.f;
-// const F32 BLEND_RANGE_FOR_BILLBOARD = 3.f;
-
- F32 droop = mDroop + 25.f*(1.f - mTrunkBend.magVec());
-
- S32 stop_depth = 0;
- F32 alpha = 1.0;
-
- U32 vert_count = 0;
- U32 index_count = 0;
-
- calcNumVerts(vert_count, index_count, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, mBranches);
-
- LLFace* facep = mDrawable->getFace(0);
- if (!facep) return;
- LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
- if (!buff->allocateBuffer(vert_count, index_count))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer on mesh update to "
- << vert_count << " vertices and "
- << index_count << " indices" << LL_ENDL;
- buff->allocateBuffer(1, 3);
- memset((U8*)buff->getMappedData(), 0, buff->getSize());
- memset((U8*)buff->getMappedIndices(), 0, buff->getIndicesSize());
- facep->setSize(1, 3);
- facep->setVertexBuffer(buff);
- mReferenceBuffer->unmapBuffer();
- buff->unmapBuffer();
- return;
- }
-
- facep->setVertexBuffer(buff);
-
- LLStrider<LLVector3> vertices;
- LLStrider<LLVector3> normals;
- LLStrider<LLVector2> tex_coords;
+ LLMatrix4 matrix;
+
+ // Translate to tree base HACK - adjustment in Z plants tree underground
+ const LLVector3 &pos_region = getPositionRegion();
+ //gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
+ LLMatrix4 trans_mat;
+ trans_mat.setTranslation(pos_region.mV[VX], pos_region.mV[VY], pos_region.mV[VZ] - 0.1f);
+ trans_mat *= matrix;
+
+ // Rotate to tree position and bend for current trunk/wind
+ // Note that trunk stiffness controls the amount of bend at the trunk as
+ // opposed to the crown of the tree
+ //
+ const F32 TRUNK_STIFF = 22.f;
+
+ LLQuaternion rot =
+ LLQuaternion(mTrunkBend.magVec()*TRUNK_STIFF*DEG_TO_RAD, LLVector4(mTrunkBend.mV[VX], mTrunkBend.mV[VY], 0)) *
+ LLQuaternion(90.f*DEG_TO_RAD, LLVector4(0,0,1)) *
+ getRotation();
+
+ LLMatrix4 rot_mat(rot);
+ rot_mat *= trans_mat;
+
+ F32 radius = getScale().magVec()*0.05f;
+ LLMatrix4 scale_mat;
+ scale_mat.mMatrix[0][0] =
+ scale_mat.mMatrix[1][1] =
+ scale_mat.mMatrix[2][2] = radius;
+
+ scale_mat *= rot_mat;
+
+// const F32 THRESH_ANGLE_FOR_BILLBOARD = 15.f;
+// const F32 BLEND_RANGE_FOR_BILLBOARD = 3.f;
+
+ F32 droop = mDroop + 25.f*(1.f - mTrunkBend.magVec());
+
+ S32 stop_depth = 0;
+ F32 alpha = 1.0;
+
+ U32 vert_count = 0;
+ U32 index_count = 0;
+
+ calcNumVerts(vert_count, index_count, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, mBranches);
+
+ LLFace* facep = mDrawable->getFace(0);
+ if (!facep) return;
+ LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
+ if (!buff->allocateBuffer(vert_count, index_count))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer on mesh update to "
+ << vert_count << " vertices and "
+ << index_count << " indices" << LL_ENDL;
+ buff->allocateBuffer(1, 3);
+ memset((U8*)buff->getMappedData(), 0, buff->getSize());
+ memset((U8*)buff->getMappedIndices(), 0, buff->getIndicesSize());
+ facep->setSize(1, 3);
+ facep->setVertexBuffer(buff);
+ mReferenceBuffer->unmapBuffer();
+ buff->unmapBuffer();
+ return;
+ }
+
+ facep->setVertexBuffer(buff);
+
+ LLStrider<LLVector3> vertices;
+ LLStrider<LLVector3> normals;
+ LLStrider<LLVector2> tex_coords;
LLStrider<LLColor4U> colors;
- LLStrider<U16> indices;
- U16 idx_offset = 0;
+ LLStrider<U16> indices;
+ U16 idx_offset = 0;
- buff->getVertexStrider(vertices);
- buff->getNormalStrider(normals);
- buff->getTexCoord0Strider(tex_coords);
+ buff->getVertexStrider(vertices);
+ buff->getNormalStrider(normals);
+ buff->getTexCoord0Strider(tex_coords);
buff->getColorStrider(colors);
- buff->getIndexStrider(indices);
+ buff->getIndexStrider(indices);
+
+ genBranchPipeline(vertices, normals, tex_coords, colors, indices, idx_offset, scale_mat, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, 1.0, mTwist, droop, mBranches, alpha);
- genBranchPipeline(vertices, normals, tex_coords, colors, indices, idx_offset, scale_mat, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, 1.0, mTwist, droop, mBranches, alpha);
-
- mReferenceBuffer->unmapBuffer();
- buff->unmapBuffer();
+ mReferenceBuffer->unmapBuffer();
+ buff->unmapBuffer();
}
-void LLVOTree::appendMesh(LLStrider<LLVector3>& vertices,
- LLStrider<LLVector3>& normals,
- LLStrider<LLVector2>& tex_coords,
- LLStrider<LLColor4U>& colors,
- LLStrider<U16>& indices,
- U16& cur_idx,
- LLMatrix4& matrix,
- LLMatrix4& norm_mat,
- S32 vert_start,
- S32 vert_count,
- S32 index_count,
- S32 index_offset)
+void LLVOTree::appendMesh(LLStrider<LLVector3>& vertices,
+ LLStrider<LLVector3>& normals,
+ LLStrider<LLVector2>& tex_coords,
+ LLStrider<LLColor4U>& colors,
+ LLStrider<U16>& indices,
+ U16& cur_idx,
+ LLMatrix4& matrix,
+ LLMatrix4& norm_mat,
+ S32 vert_start,
+ S32 vert_count,
+ S32 index_count,
+ S32 index_offset)
{
- LLStrider<LLVector3> v;
- LLStrider<LLVector3> n;
- LLStrider<LLVector2> t;
+ LLStrider<LLVector3> v;
+ LLStrider<LLVector3> n;
+ LLStrider<LLVector2> t;
LLStrider<LLColor4U> c;
- LLStrider<U16> idx;
+ LLStrider<U16> idx;
- mReferenceBuffer->getVertexStrider(v);
- mReferenceBuffer->getNormalStrider(n);
- mReferenceBuffer->getTexCoord0Strider(t);
+ mReferenceBuffer->getVertexStrider(v);
+ mReferenceBuffer->getNormalStrider(n);
+ mReferenceBuffer->getTexCoord0Strider(t);
mReferenceBuffer->getColorStrider(c);
- mReferenceBuffer->getIndexStrider(idx);
-
- //copy/transform vertices into mesh - check
- for (S32 i = 0; i < vert_count; i++)
- {
- U16 index = vert_start + i;
- *vertices++ = v[index] * matrix;
- LLVector3 norm = n[index] * norm_mat;
- norm.normalize();
- *normals++ = norm;
- *tex_coords++ = t[index];
+ mReferenceBuffer->getIndexStrider(idx);
+
+ //copy/transform vertices into mesh - check
+ for (S32 i = 0; i < vert_count; i++)
+ {
+ U16 index = vert_start + i;
+ *vertices++ = v[index] * matrix;
+ LLVector3 norm = n[index] * norm_mat;
+ norm.normalize();
+ *normals++ = norm;
+ *tex_coords++ = t[index];
*colors++ = c[index];
- }
+ }
- //copy offset indices into mesh - check
- for (S32 i = 0; i < index_count; i++)
- {
- U16 index = index_offset + i;
- *indices++ = idx[index]-vert_start+cur_idx;
- }
+ //copy offset indices into mesh - check
+ for (S32 i = 0; i < index_count; i++)
+ {
+ U16 index = index_offset + i;
+ *indices++ = idx[index]-vert_start+cur_idx;
+ }
- //increment index offset - check
- cur_idx += vert_count;
+ //increment index offset - check
+ cur_idx += vert_count;
}
-
-void LLVOTree::genBranchPipeline(LLStrider<LLVector3>& vertices,
- LLStrider<LLVector3>& normals,
- LLStrider<LLVector2>& tex_coords,
+
+void LLVOTree::genBranchPipeline(LLStrider<LLVector3>& vertices,
+ LLStrider<LLVector3>& normals,
+ LLStrider<LLVector2>& tex_coords,
LLStrider<LLColor4U>& colors,
- LLStrider<U16>& indices,
- U16& index_offset,
- LLMatrix4& matrix,
- S32 trunk_LOD,
- S32 stop_level,
- U16 depth,
- U16 trunk_depth,
- F32 scale,
- F32 twist,
- F32 droop,
- F32 branches,
- F32 alpha)
+ LLStrider<U16>& indices,
+ U16& index_offset,
+ LLMatrix4& matrix,
+ S32 trunk_LOD,
+ S32 stop_level,
+ U16 depth,
+ U16 trunk_depth,
+ F32 scale,
+ F32 twist,
+ F32 droop,
+ F32 branches,
+ F32 alpha)
{
- //
- // Generates a tree mesh by recursing, generating branches and then a 'leaf' texture.
-
- static F32 constant_twist;
- static F32 width = 0;
-
- F32 length = ((trunk_depth || (scale == 1.f))? mTrunkLength:mBranchLength);
- F32 aspect = ((trunk_depth || (scale == 1.f))? mTrunkAspect:mBranchAspect);
-
- constant_twist = 360.f/branches;
-
- if (stop_level >= 0)
- {
- if (depth > stop_level)
- {
- {
- llassert(sLODIndexCount[trunk_LOD] > 0);
- width = scale * length * aspect;
- LLMatrix4 scale_mat;
- scale_mat.mMatrix[0][0] = width;
- scale_mat.mMatrix[1][1] = width;
- scale_mat.mMatrix[2][2] = scale*length;
- scale_mat *= matrix;
-
- glh::matrix4f norm((F32*) scale_mat.mMatrix);
- LLMatrix4 norm_mat = LLMatrix4(norm.inverse().transpose().m);
-
- norm_mat.invert();
- appendMesh(vertices, normals, tex_coords, colors, indices, index_offset, scale_mat, norm_mat,
- sLODVertexOffset[trunk_LOD], sLODVertexCount[trunk_LOD], sLODIndexCount[trunk_LOD], sLODIndexOffset[trunk_LOD]);
- }
-
- // Recurse to create more branches
- for (S32 i=0; i < (S32)branches; i++)
- {
- LLMatrix4 trans_mat;
- trans_mat.setTranslation(0,0,scale*length);
- trans_mat *= matrix;
-
- LLQuaternion rot =
- LLQuaternion(20.f*DEG_TO_RAD, LLVector4(0.f, 0.f, 1.f)) *
- LLQuaternion(droop*DEG_TO_RAD, LLVector4(0.f, 1.f, 0.f)) *
- LLQuaternion(((constant_twist + ((i%2==0)?twist:-twist))*i)*DEG_TO_RAD, LLVector4(0.f, 0.f, 1.f));
-
- LLMatrix4 rot_mat(rot);
- rot_mat *= trans_mat;
-
- genBranchPipeline(vertices, normals, tex_coords, colors, indices, index_offset, rot_mat, trunk_LOD, stop_level, depth - 1, 0, scale*mScaleStep, twist, droop, branches, alpha);
- }
- // Recurse to continue trunk
- if (trunk_depth)
- {
- LLMatrix4 trans_mat;
- trans_mat.setTranslation(0,0,scale*length);
- trans_mat *= matrix;
-
- LLMatrix4 rot_mat(70.5f*DEG_TO_RAD, LLVector4(0,0,1));
- rot_mat *= trans_mat; // rotate a bit around Z when ascending
- genBranchPipeline(vertices, normals, tex_coords, colors, indices, index_offset, rot_mat, trunk_LOD, stop_level, depth, trunk_depth-1, scale*mScaleStep, twist, droop, branches, alpha);
- }
- }
- else
- {
- //
- // Append leaves as two 90 deg crossed quads with leaf textures
- //
- {
- LLMatrix4 scale_mat;
- scale_mat.mMatrix[0][0] =
- scale_mat.mMatrix[1][1] =
- scale_mat.mMatrix[2][2] = scale*mLeafScale;
-
- scale_mat *= matrix;
-
- glh::matrix4f norm((F32*) scale_mat.mMatrix);
- LLMatrix4 norm_mat = LLMatrix4(norm.inverse().transpose().m);
-
- appendMesh(vertices, normals, tex_coords, colors, indices, index_offset, scale_mat, norm_mat, 0, LEAF_VERTICES, LEAF_INDICES, 0);
- }
- }
- }
+ //
+ // Generates a tree mesh by recursing, generating branches and then a 'leaf' texture.
+
+ static F32 constant_twist;
+ static F32 width = 0;
+
+ F32 length = ((trunk_depth || (scale == 1.f))? mTrunkLength:mBranchLength);
+ F32 aspect = ((trunk_depth || (scale == 1.f))? mTrunkAspect:mBranchAspect);
+
+ constant_twist = 360.f/branches;
+
+ if (stop_level >= 0)
+ {
+ if (depth > stop_level)
+ {
+ {
+ llassert(sLODIndexCount[trunk_LOD] > 0);
+ width = scale * length * aspect;
+ LLMatrix4 scale_mat;
+ scale_mat.mMatrix[0][0] = width;
+ scale_mat.mMatrix[1][1] = width;
+ scale_mat.mMatrix[2][2] = scale*length;
+ scale_mat *= matrix;
+
+ glh::matrix4f norm((F32*) scale_mat.mMatrix);
+ LLMatrix4 norm_mat = LLMatrix4(norm.inverse().transpose().m);
+
+ norm_mat.invert();
+ appendMesh(vertices, normals, tex_coords, colors, indices, index_offset, scale_mat, norm_mat,
+ sLODVertexOffset[trunk_LOD], sLODVertexCount[trunk_LOD], sLODIndexCount[trunk_LOD], sLODIndexOffset[trunk_LOD]);
+ }
+
+ // Recurse to create more branches
+ for (S32 i=0; i < (S32)branches; i++)
+ {
+ LLMatrix4 trans_mat;
+ trans_mat.setTranslation(0,0,scale*length);
+ trans_mat *= matrix;
+
+ LLQuaternion rot =
+ LLQuaternion(20.f*DEG_TO_RAD, LLVector4(0.f, 0.f, 1.f)) *
+ LLQuaternion(droop*DEG_TO_RAD, LLVector4(0.f, 1.f, 0.f)) *
+ LLQuaternion(((constant_twist + ((i%2==0)?twist:-twist))*i)*DEG_TO_RAD, LLVector4(0.f, 0.f, 1.f));
+
+ LLMatrix4 rot_mat(rot);
+ rot_mat *= trans_mat;
+
+ genBranchPipeline(vertices, normals, tex_coords, colors, indices, index_offset, rot_mat, trunk_LOD, stop_level, depth - 1, 0, scale*mScaleStep, twist, droop, branches, alpha);
+ }
+ // Recurse to continue trunk
+ if (trunk_depth)
+ {
+ LLMatrix4 trans_mat;
+ trans_mat.setTranslation(0,0,scale*length);
+ trans_mat *= matrix;
+
+ LLMatrix4 rot_mat(70.5f*DEG_TO_RAD, LLVector4(0,0,1));
+ rot_mat *= trans_mat; // rotate a bit around Z when ascending
+ genBranchPipeline(vertices, normals, tex_coords, colors, indices, index_offset, rot_mat, trunk_LOD, stop_level, depth, trunk_depth-1, scale*mScaleStep, twist, droop, branches, alpha);
+ }
+ }
+ else
+ {
+ //
+ // Append leaves as two 90 deg crossed quads with leaf textures
+ //
+ {
+ LLMatrix4 scale_mat;
+ scale_mat.mMatrix[0][0] =
+ scale_mat.mMatrix[1][1] =
+ scale_mat.mMatrix[2][2] = scale*mLeafScale;
+
+ scale_mat *= matrix;
+
+ glh::matrix4f norm((F32*) scale_mat.mMatrix);
+ LLMatrix4 norm_mat = LLMatrix4(norm.inverse().transpose().m);
+
+ appendMesh(vertices, normals, tex_coords, colors, indices, index_offset, scale_mat, norm_mat, 0, LEAF_VERTICES, LEAF_INDICES, 0);
+ }
+ }
+ }
}
void LLVOTree::calcNumVerts(U32& vert_count, U32& index_count, S32 trunk_LOD, S32 stop_level, U16 depth, U16 trunk_depth, F32 branches)
{
- if (stop_level >= 0)
- {
- if (depth > stop_level)
- {
- index_count += sLODIndexCount[trunk_LOD];
- vert_count += sLODVertexCount[trunk_LOD];
-
- // Recurse to create more branches
- for (S32 i=0; i < (S32)branches; i++)
- {
- calcNumVerts(vert_count, index_count, trunk_LOD, stop_level, depth - 1, 0, branches);
- }
-
- // Recurse to continue trunk
- if (trunk_depth)
- {
- calcNumVerts(vert_count, index_count, trunk_LOD, stop_level, depth, trunk_depth-1, branches);
- }
- }
- else
- {
- index_count += LEAF_INDICES;
- vert_count += LEAF_VERTICES;
- }
- }
- else
- {
- index_count += LEAF_INDICES;
- vert_count += LEAF_VERTICES;
- }
+ if (stop_level >= 0)
+ {
+ if (depth > stop_level)
+ {
+ index_count += sLODIndexCount[trunk_LOD];
+ vert_count += sLODVertexCount[trunk_LOD];
+
+ // Recurse to create more branches
+ for (S32 i=0; i < (S32)branches; i++)
+ {
+ calcNumVerts(vert_count, index_count, trunk_LOD, stop_level, depth - 1, 0, branches);
+ }
+
+ // Recurse to continue trunk
+ if (trunk_depth)
+ {
+ calcNumVerts(vert_count, index_count, trunk_LOD, stop_level, depth, trunk_depth-1, branches);
+ }
+ }
+ else
+ {
+ index_count += LEAF_INDICES;
+ vert_count += LEAF_VERTICES;
+ }
+ }
+ else
+ {
+ index_count += LEAF_INDICES;
+ vert_count += LEAF_VERTICES;
+ }
}
void LLVOTree::updateRadius()
{
- if (mDrawable.isNull())
- {
- return;
- }
-
- mDrawable->setRadius(32.0f);
+ if (mDrawable.isNull())
+ {
+ return;
+ }
+
+ mDrawable->setRadius(32.0f);
}
void LLVOTree::updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
{
- F32 radius = getScale().length()*0.05f;
- LLVector3 center = getRenderPosition();
-
- F32 sz = mBillboardScale*mBillboardRatio*radius*0.5f;
- LLVector3 size(sz,sz,sz);
-
- center += LLVector3(0, 0, size.mV[2]) * getRotation();
-
- newMin.load3((center-size).mV);
- newMax.load3((center+size).mV);
- LLVector4a pos;
- pos.load3(center.mV);
- mDrawable->setPositionGroup(pos);
+ F32 radius = getScale().length()*0.05f;
+ LLVector3 center = getRenderPosition();
+
+ F32 sz = mBillboardScale*mBillboardRatio*radius*0.5f;
+ LLVector3 size(sz,sz,sz);
+
+ center += LLVector3(0, 0, size.mV[2]) * getRotation();
+
+ newMin.load3((center-size).mV);
+ newMax.load3((center+size).mV);
+ LLVector4a pos;
+ pos.load3(center.mV);
+ mDrawable->setPositionGroup(pos);
}
BOOL LLVOTree::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32 *face_hitp,
- LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
-
+ LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
+
{
- if (!lineSegmentBoundingBox(start, end))
- {
- return FALSE;
- }
-
- const LLVector4a* exta = mDrawable->getSpatialExtents();
-
- //VECTORIZE THIS
- LLVector3 ext[2];
- ext[0].set(exta[0].getF32ptr());
- ext[1].set(exta[1].getF32ptr());
-
- LLVector3 center = (ext[1]+ext[0])*0.5f;
- LLVector3 size = (ext[1]-ext[0]);
-
- LLQuaternion quat = getRotation();
-
- center -= LLVector3(0,0,size.magVec() * 0.25f)*quat;
-
- size.scaleVec(LLVector3(0.25f, 0.25f, 1.f));
- size.mV[0] = llmin(size.mV[0], 1.f);
- size.mV[1] = llmin(size.mV[1], 1.f);
-
- LLVector3 pos, norm;
-
- LLVector3 start3(start.getF32ptr());
- LLVector3 end3(end.getF32ptr());
-
- if (linesegment_tetrahedron(start3, end3, center, size, quat, pos, norm))
- {
- if (intersection)
- {
- intersection->load3(pos.mV);
- }
-
- if (normal)
- {
- normal->load3(norm.mV);
- }
- return TRUE;
- }
-
- return FALSE;
+ if (!lineSegmentBoundingBox(start, end))
+ {
+ return FALSE;
+ }
+
+ const LLVector4a* exta = mDrawable->getSpatialExtents();
+
+ //VECTORIZE THIS
+ LLVector3 ext[2];
+ ext[0].set(exta[0].getF32ptr());
+ ext[1].set(exta[1].getF32ptr());
+
+ LLVector3 center = (ext[1]+ext[0])*0.5f;
+ LLVector3 size = (ext[1]-ext[0]);
+
+ LLQuaternion quat = getRotation();
+
+ center -= LLVector3(0,0,size.magVec() * 0.25f)*quat;
+
+ size.scaleVec(LLVector3(0.25f, 0.25f, 1.f));
+ size.mV[0] = llmin(size.mV[0], 1.f);
+ size.mV[1] = llmin(size.mV[1], 1.f);
+
+ LLVector3 pos, norm;
+
+ LLVector3 start3(start.getF32ptr());
+ LLVector3 end3(end.getF32ptr());
+
+ if (linesegment_tetrahedron(start3, end3, center, size, quat, pos, norm))
+ {
+ if (intersection)
+ {
+ intersection->load3(pos.mV);
+ }
+
+ if (normal)
+ {
+ normal->load3(norm.mV);
+ }
+ return TRUE;
+ }
+
+ return FALSE;
}
U32 LLVOTree::getPartitionType() const
-{
- return LLViewerRegion::PARTITION_TREE;
+{
+ return LLViewerRegion::PARTITION_TREE;
}
LLTreePartition::LLTreePartition(LLViewerRegion* regionp)
: LLSpatialPartition(0, FALSE, regionp)
{
- mDrawableType = LLPipeline::RENDER_TYPE_TREE;
- mPartitionType = LLViewerRegion::PARTITION_TREE;
- mSlopRatio = 0.f;
- mLODPeriod = 1;
+ mDrawableType = LLPipeline::RENDER_TYPE_TREE;
+ mPartitionType = LLViewerRegion::PARTITION_TREE;
+ mSlopRatio = 0.f;
+ mLODPeriod = 1;
}
diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h
index 996e970cf8..0facb466dd 100644
--- a/indra/newview/llvotree.h
+++ b/indra/newview/llvotree.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvotree.h
* @brief LLVOTree class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,160 +37,160 @@ class LLViewerFetchedTexture;
class LLVOTree : public LLViewerObject
{
protected:
- ~LLVOTree();
+ ~LLVOTree();
public:
- enum
- {
- VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
- (1 << LLVertexBuffer::TYPE_NORMAL) |
- (1 << LLVertexBuffer::TYPE_TEXCOORD0)
- };
-
- LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
-
- // Initialize data that's only inited once per class.
- static void initClass();
- static void cleanupClass();
- static bool isTreeRenderingStopped();
-
- /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num, const EObjectUpdateType update_type,
- LLDataPacker *dp);
- /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
-
- // Graphical stuff for objects - maybe broken out into render class later?
- /*virtual*/ void render(LLAgent &agent);
- /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent);
- /*virtual*/ void updateTextures();
-
- /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
- /*virtual*/ void updateSpatialExtents(LLVector4a &min, LLVector4a &max);
-
- virtual U32 getPartitionType() const;
-
- void updateRadius();
-
- void calcNumVerts(U32& vert_count, U32& index_count, S32 trunk_LOD, S32 stop_level, U16 depth, U16 trunk_depth, F32 branches);
-
- void updateMesh();
-
- void appendMesh(LLStrider<LLVector3>& vertices,
- LLStrider<LLVector3>& normals,
- LLStrider<LLVector2>& tex_coords,
+ enum
+ {
+ VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
+ (1 << LLVertexBuffer::TYPE_NORMAL) |
+ (1 << LLVertexBuffer::TYPE_TEXCOORD0)
+ };
+
+ LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+
+ // Initialize data that's only inited once per class.
+ static void initClass();
+ static void cleanupClass();
+ static bool isTreeRenderingStopped();
+
+ /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
+ void **user_data,
+ U32 block_num, const EObjectUpdateType update_type,
+ LLDataPacker *dp);
+ /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
+
+ // Graphical stuff for objects - maybe broken out into render class later?
+ /*virtual*/ void render(LLAgent &agent);
+ /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent);
+ /*virtual*/ void updateTextures();
+
+ /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
+ /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
+ /*virtual*/ void updateSpatialExtents(LLVector4a &min, LLVector4a &max);
+
+ virtual U32 getPartitionType() const;
+
+ void updateRadius();
+
+ void calcNumVerts(U32& vert_count, U32& index_count, S32 trunk_LOD, S32 stop_level, U16 depth, U16 trunk_depth, F32 branches);
+
+ void updateMesh();
+
+ void appendMesh(LLStrider<LLVector3>& vertices,
+ LLStrider<LLVector3>& normals,
+ LLStrider<LLVector2>& tex_coords,
LLStrider<LLColor4U>& colors,
- LLStrider<U16>& indices,
- U16& idx_offset,
- LLMatrix4& matrix,
- LLMatrix4& norm_mat,
- S32 vertex_offset,
- S32 vertex_count,
- S32 index_count,
- S32 index_offset);
-
- void genBranchPipeline(LLStrider<LLVector3>& vertices,
- LLStrider<LLVector3>& normals,
- LLStrider<LLVector2>& tex_coords,
+ LLStrider<U16>& indices,
+ U16& idx_offset,
+ LLMatrix4& matrix,
+ LLMatrix4& norm_mat,
+ S32 vertex_offset,
+ S32 vertex_count,
+ S32 index_count,
+ S32 index_offset);
+
+ void genBranchPipeline(LLStrider<LLVector3>& vertices,
+ LLStrider<LLVector3>& normals,
+ LLStrider<LLVector2>& tex_coords,
LLStrider<LLColor4U>& colors,
- LLStrider<U16>& indices,
- U16& index_offset,
- LLMatrix4& matrix,
- S32 trunk_LOD,
- S32 stop_level,
- U16 depth,
- U16 trunk_depth,
- F32 scale,
- F32 twist,
- F32 droop,
- F32 branches,
- F32 alpha);
-
- /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face = -1, // which face to check, -1 = ALL_SIDES
- BOOL pick_transparent = FALSE,
- BOOL pick_rigged = FALSE,
+ LLStrider<U16>& indices,
+ U16& index_offset,
+ LLMatrix4& matrix,
+ S32 trunk_LOD,
+ S32 stop_level,
+ U16 depth,
+ U16 trunk_depth,
+ F32 scale,
+ F32 twist,
+ F32 droop,
+ F32 branches,
+ F32 alpha);
+
+ /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
+ S32 face = -1, // which face to check, -1 = ALL_SIDES
+ BOOL pick_transparent = FALSE,
+ BOOL pick_rigged = FALSE,
BOOL pick_unselectable = TRUE,
- S32* face_hit = NULL, // which face was hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL // return the surface tangent at the intersection point
- );
-
- static S32 sMaxTreeSpecies;
-
- struct TreeSpeciesData
- {
- LLUUID mTextureID;
-
- F32 mBranchLength; // Scale (length) of tree branches
- F32 mDroop; // Droop from vertical (degrees) at each branch recursion
- F32 mTwist; // Twist
- F32 mBranches; // Number of branches emitted at each recursion level
- U8 mDepth; // Number of recursions to tips of branches
- F32 mScaleStep; // Multiplier for scale at each recursion level
- U8 mTrunkDepth;
-
- F32 mLeafScale; // Scales leaf texture when rendering
- F32 mTrunkLength; // Scales branch diameters when rendering
- F32 mBillboardScale; // Scales the billboard representation
- F32 mBillboardRatio; // Height to width aspect ratio
- F32 mTrunkAspect;
- F32 mBranchAspect;
- F32 mRandomLeafRotate;
- F32 mNoiseScale; // Scaling of noise function in perlin space (norm = 1.0)
- F32 mNoiseMag; // amount of perlin noise to deform by (0 = none)
- F32 mTaper; // amount of perlin noise to deform by (0 = none)
- F32 mRepeatTrunkZ; // Times to repeat the trunk texture vertically along trunk
- };
-
- static F32 sTreeFactor; // Tree level of detail factor
- static const S32 sMAX_NUM_TREE_LOD_LEVELS ;
-
- friend class LLDrawPoolTree;
+ S32* face_hit = NULL, // which face was hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL // return the surface tangent at the intersection point
+ );
+
+ static S32 sMaxTreeSpecies;
+
+ struct TreeSpeciesData
+ {
+ LLUUID mTextureID;
+
+ F32 mBranchLength; // Scale (length) of tree branches
+ F32 mDroop; // Droop from vertical (degrees) at each branch recursion
+ F32 mTwist; // Twist
+ F32 mBranches; // Number of branches emitted at each recursion level
+ U8 mDepth; // Number of recursions to tips of branches
+ F32 mScaleStep; // Multiplier for scale at each recursion level
+ U8 mTrunkDepth;
+
+ F32 mLeafScale; // Scales leaf texture when rendering
+ F32 mTrunkLength; // Scales branch diameters when rendering
+ F32 mBillboardScale; // Scales the billboard representation
+ F32 mBillboardRatio; // Height to width aspect ratio
+ F32 mTrunkAspect;
+ F32 mBranchAspect;
+ F32 mRandomLeafRotate;
+ F32 mNoiseScale; // Scaling of noise function in perlin space (norm = 1.0)
+ F32 mNoiseMag; // amount of perlin noise to deform by (0 = none)
+ F32 mTaper; // amount of perlin noise to deform by (0 = none)
+ F32 mRepeatTrunkZ; // Times to repeat the trunk texture vertically along trunk
+ };
+
+ static F32 sTreeFactor; // Tree level of detail factor
+ static const S32 sMAX_NUM_TREE_LOD_LEVELS ;
+
+ friend class LLDrawPoolTree;
protected:
- LLVector3 mTrunkBend; // Accumulated wind (used for blowing trees)
- LLVector3 mWind;
-
- LLPointer<LLVertexBuffer> mReferenceBuffer; //reference geometry for generating tree mesh
- LLPointer<LLViewerFetchedTexture> mTreeImagep; // Pointer to proper tree image
-
- U8 mSpecies; // Species of tree
- F32 mBranchLength; // Scale (length) of tree branches
- F32 mTrunkLength; // Trunk length (first recursion)
- F32 mDroop; // Droop from vertical (degrees) at each branch recursion
- F32 mTwist; // Twist
- F32 mBranches; // Number of branches emitted at each recursion level
- U8 mDepth; // Number of recursions to tips of branches
- F32 mScaleStep; // Multiplier for scale at each recursion level
- U8 mTrunkDepth;
- U32 mTrunkLOD;
- F32 mLeafScale; // Scales leaf texture when rendering
-
- F32 mBillboardScale; // How big to draw the billboard?
- F32 mBillboardRatio; // Height to width ratio of billboard
- F32 mTrunkAspect; // Ratio between width/length of trunk
- F32 mBranchAspect; // Ratio between width/length of branch
- F32 mRandomLeafRotate; // How much to randomly rotate leaves about arbitrary axis
-
- // cache last position+rotation so we can detect the need for a
- // complete rebuild when not animating
- LLVector3 mLastPosition;
- LLQuaternion mLastRotation;
-
- U32 mFrameCount;
-
- typedef std::map<U32, TreeSpeciesData*> SpeciesMap;
- static SpeciesMap sSpeciesTable;
-
- static S32 sLODIndexOffset[4];
- static S32 sLODIndexCount[4];
- static S32 sLODVertexOffset[4];
- static S32 sLODVertexCount[4];
- static S32 sLODSlices[4];
- static F32 sLODAngles[4];
+ LLVector3 mTrunkBend; // Accumulated wind (used for blowing trees)
+ LLVector3 mWind;
+
+ LLPointer<LLVertexBuffer> mReferenceBuffer; //reference geometry for generating tree mesh
+ LLPointer<LLViewerFetchedTexture> mTreeImagep; // Pointer to proper tree image
+
+ U8 mSpecies; // Species of tree
+ F32 mBranchLength; // Scale (length) of tree branches
+ F32 mTrunkLength; // Trunk length (first recursion)
+ F32 mDroop; // Droop from vertical (degrees) at each branch recursion
+ F32 mTwist; // Twist
+ F32 mBranches; // Number of branches emitted at each recursion level
+ U8 mDepth; // Number of recursions to tips of branches
+ F32 mScaleStep; // Multiplier for scale at each recursion level
+ U8 mTrunkDepth;
+ U32 mTrunkLOD;
+ F32 mLeafScale; // Scales leaf texture when rendering
+
+ F32 mBillboardScale; // How big to draw the billboard?
+ F32 mBillboardRatio; // Height to width ratio of billboard
+ F32 mTrunkAspect; // Ratio between width/length of trunk
+ F32 mBranchAspect; // Ratio between width/length of branch
+ F32 mRandomLeafRotate; // How much to randomly rotate leaves about arbitrary axis
+
+ // cache last position+rotation so we can detect the need for a
+ // complete rebuild when not animating
+ LLVector3 mLastPosition;
+ LLQuaternion mLastRotation;
+
+ U32 mFrameCount;
+
+ typedef std::map<U32, TreeSpeciesData*> SpeciesMap;
+ static SpeciesMap sSpeciesTable;
+
+ static S32 sLODIndexOffset[4];
+ static S32 sLODIndexCount[4];
+ static S32 sLODVertexOffset[4];
+ static S32 sLODVertexCount[4];
+ static S32 sLODSlices[4];
+ static F32 sLODAngles[4];
};
#endif
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index e3f2afadc5..ea6fb2e55b 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvovolume.cpp
* @brief LLVOVolume class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -97,7 +97,7 @@ U32 JOINT_COUNT_REQUIRED_FOR_FULLRIG = 1;
BOOL gAnimateTextures = TRUE;
F32 LLVOVolume::sLODFactor = 1.f;
-F32 LLVOVolume::sLODSlopDistanceFactor = 0.5f; //Changing this to zero, effectively disables the LOD transition slop
+F32 LLVOVolume::sLODSlopDistanceFactor = 0.5f; //Changing this to zero, effectively disables the LOD transition slop
F32 LLVOVolume::sDistanceFactor = 1.0f;
S32 LLVOVolume::sNumLODChanges = 0;
S32 LLVOVolume::mRenderComplexity_last = 0;
@@ -111,213 +111,213 @@ extern BOOL gCubeSnapshot;
class LLMediaDataClientObjectImpl : public LLMediaDataClientObject
{
public:
- LLMediaDataClientObjectImpl(LLVOVolume *obj, bool isNew) : mObject(obj), mNew(isNew)
- {
- mObject->addMDCImpl();
- }
- ~LLMediaDataClientObjectImpl()
- {
- mObject->removeMDCImpl();
- }
-
- virtual U8 getMediaDataCount() const
- { return mObject->getNumTEs(); }
-
- virtual LLSD getMediaDataLLSD(U8 index) const
- {
- LLSD result;
- LLTextureEntry *te = mObject->getTE(index);
- if (NULL != te)
- {
- llassert((te->getMediaData() != NULL) == te->hasMedia());
- if (te->getMediaData() != NULL)
- {
- result = te->getMediaData()->asLLSD();
- // XXX HACK: workaround bug in asLLSD() where whitelist is not set properly
- // See DEV-41949
- if (!result.has(LLMediaEntry::WHITELIST_KEY))
- {
- result[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
- }
- }
- }
- return result;
- }
- virtual bool isCurrentMediaUrl(U8 index, const std::string &url) const
- {
- LLTextureEntry *te = mObject->getTE(index);
- if (te)
- {
- if (te->getMediaData())
- {
- return (te->getMediaData()->getCurrentURL() == url);
- }
- }
- return url.empty();
- }
-
- virtual LLUUID getID() const
- { return mObject->getID(); }
-
- virtual void mediaNavigateBounceBack(U8 index)
- { mObject->mediaNavigateBounceBack(index); }
-
- virtual bool hasMedia() const
- { return mObject->hasMedia(); }
-
- virtual void updateObjectMediaData(LLSD const &data, const std::string &version_string)
- { mObject->updateObjectMediaData(data, version_string); }
-
- virtual F64 getMediaInterest() const
- {
- F64 interest = mObject->getTotalMediaInterest();
- if (interest < (F64)0.0)
- {
- // media interest not valid yet, try pixel area
- interest = mObject->getPixelArea();
- // HACK: force recalculation of pixel area if interest is the "magic default" of 1024.
- if (interest == 1024.f)
- {
- const_cast<LLVOVolume*>(static_cast<LLVOVolume*>(mObject))->setPixelAreaAndAngle(gAgent);
- interest = mObject->getPixelArea();
- }
- }
- return interest;
- }
-
- virtual bool isInterestingEnough() const
- {
- return LLViewerMedia::getInstance()->isInterestingEnough(mObject, getMediaInterest());
- }
-
- virtual std::string getCapabilityUrl(const std::string &name) const
- { return mObject->getRegion()->getCapability(name); }
-
- virtual bool isDead() const
- { return mObject->isDead(); }
-
- virtual U32 getMediaVersion() const
- { return LLTextureEntry::getVersionFromMediaVersionString(mObject->getMediaURL()); }
-
- virtual bool isNew() const
- { return mNew; }
+ LLMediaDataClientObjectImpl(LLVOVolume *obj, bool isNew) : mObject(obj), mNew(isNew)
+ {
+ mObject->addMDCImpl();
+ }
+ ~LLMediaDataClientObjectImpl()
+ {
+ mObject->removeMDCImpl();
+ }
+
+ virtual U8 getMediaDataCount() const
+ { return mObject->getNumTEs(); }
+
+ virtual LLSD getMediaDataLLSD(U8 index) const
+ {
+ LLSD result;
+ LLTextureEntry *te = mObject->getTE(index);
+ if (NULL != te)
+ {
+ llassert((te->getMediaData() != NULL) == te->hasMedia());
+ if (te->getMediaData() != NULL)
+ {
+ result = te->getMediaData()->asLLSD();
+ // XXX HACK: workaround bug in asLLSD() where whitelist is not set properly
+ // See DEV-41949
+ if (!result.has(LLMediaEntry::WHITELIST_KEY))
+ {
+ result[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
+ }
+ }
+ }
+ return result;
+ }
+ virtual bool isCurrentMediaUrl(U8 index, const std::string &url) const
+ {
+ LLTextureEntry *te = mObject->getTE(index);
+ if (te)
+ {
+ if (te->getMediaData())
+ {
+ return (te->getMediaData()->getCurrentURL() == url);
+ }
+ }
+ return url.empty();
+ }
+
+ virtual LLUUID getID() const
+ { return mObject->getID(); }
+
+ virtual void mediaNavigateBounceBack(U8 index)
+ { mObject->mediaNavigateBounceBack(index); }
+
+ virtual bool hasMedia() const
+ { return mObject->hasMedia(); }
+
+ virtual void updateObjectMediaData(LLSD const &data, const std::string &version_string)
+ { mObject->updateObjectMediaData(data, version_string); }
+
+ virtual F64 getMediaInterest() const
+ {
+ F64 interest = mObject->getTotalMediaInterest();
+ if (interest < (F64)0.0)
+ {
+ // media interest not valid yet, try pixel area
+ interest = mObject->getPixelArea();
+ // HACK: force recalculation of pixel area if interest is the "magic default" of 1024.
+ if (interest == 1024.f)
+ {
+ const_cast<LLVOVolume*>(static_cast<LLVOVolume*>(mObject))->setPixelAreaAndAngle(gAgent);
+ interest = mObject->getPixelArea();
+ }
+ }
+ return interest;
+ }
+
+ virtual bool isInterestingEnough() const
+ {
+ return LLViewerMedia::getInstance()->isInterestingEnough(mObject, getMediaInterest());
+ }
+
+ virtual std::string getCapabilityUrl(const std::string &name) const
+ { return mObject->getRegion()->getCapability(name); }
+
+ virtual bool isDead() const
+ { return mObject->isDead(); }
+
+ virtual U32 getMediaVersion() const
+ { return LLTextureEntry::getVersionFromMediaVersionString(mObject->getMediaURL()); }
+
+ virtual bool isNew() const
+ { return mNew; }
private:
- LLPointer<LLVOVolume> mObject;
- bool mNew;
+ LLPointer<LLVOVolume> mObject;
+ bool mNew;
};
LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
- : LLViewerObject(id, pcode, regionp),
- mVolumeImpl(NULL)
+ : LLViewerObject(id, pcode, regionp),
+ mVolumeImpl(NULL)
{
- mTexAnimMode = 0;
- mRelativeXform.setIdentity();
- mRelativeXformInvTrans.setIdentity();
+ mTexAnimMode = 0;
+ mRelativeXform.setIdentity();
+ mRelativeXformInvTrans.setIdentity();
- mFaceMappingChanged = FALSE;
- mLOD = MIN_LOD;
+ mFaceMappingChanged = FALSE;
+ mLOD = MIN_LOD;
mLODDistance = 0.0f;
mLODAdjustedDistance = 0.0f;
mLODRadius = 0.0f;
- mTextureAnimp = NULL;
- mVolumeChanged = FALSE;
- mVObjRadius = LLVector3(1,1,0.5f).length();
- mNumFaces = 0;
- mLODChanged = FALSE;
- mSculptChanged = FALSE;
+ mTextureAnimp = NULL;
+ mVolumeChanged = FALSE;
+ mVObjRadius = LLVector3(1,1,0.5f).length();
+ mNumFaces = 0;
+ mLODChanged = FALSE;
+ mSculptChanged = FALSE;
mColorChanged = FALSE;
- mSpotLightPriority = 0.f;
+ mSpotLightPriority = 0.f;
mSkinInfoUnavaliable = false;
- mSkinInfo = NULL;
+ mSkinInfo = NULL;
- mMediaImplList.resize(getNumTEs());
- mLastFetchedMediaVersion = -1;
+ mMediaImplList.resize(getNumTEs());
+ mLastFetchedMediaVersion = -1;
mServerDrawableUpdateCount = 0;
- memset(&mIndexInTex, 0, sizeof(S32) * LLRender::NUM_VOLUME_TEXTURE_CHANNELS);
- mMDCImplCount = 0;
- mLastRiggingInfoLOD = -1;
- mResetDebugText = false;
+ memset(&mIndexInTex, 0, sizeof(S32) * LLRender::NUM_VOLUME_TEXTURE_CHANNELS);
+ mMDCImplCount = 0;
+ mLastRiggingInfoLOD = -1;
+ mResetDebugText = false;
}
LLVOVolume::~LLVOVolume()
{
LL_PROFILE_ZONE_SCOPED;
- delete mTextureAnimp;
- mTextureAnimp = NULL;
- delete mVolumeImpl;
- mVolumeImpl = NULL;
+ delete mTextureAnimp;
+ mTextureAnimp = NULL;
+ delete mVolumeImpl;
+ mVolumeImpl = NULL;
- gMeshRepo.unregisterMesh(this);
+ gMeshRepo.unregisterMesh(this);
- if(!mMediaImplList.empty())
- {
- for(U32 i = 0 ; i < mMediaImplList.size() ; i++)
- {
- if(mMediaImplList[i].notNull())
- {
- mMediaImplList[i]->removeObject(this) ;
- }
- }
- }
+ if(!mMediaImplList.empty())
+ {
+ for(U32 i = 0 ; i < mMediaImplList.size() ; i++)
+ {
+ if(mMediaImplList[i].notNull())
+ {
+ mMediaImplList[i]->removeObject(this) ;
+ }
+ }
+ }
}
void LLVOVolume::markDead()
{
- if (!mDead)
- {
+ if (!mDead)
+ {
LL_PROFILE_ZONE_SCOPED;
if (getVolume())
{
LLSculptIDSize::instance().rem(getVolume()->getParams().getSculptID());
}
- if(getMDCImplCount() > 0)
- {
- LLMediaDataClientObject::ptr_t obj = new LLMediaDataClientObjectImpl(const_cast<LLVOVolume*>(this), false);
- if (sObjectMediaClient) sObjectMediaClient->removeFromQueue(obj);
- if (sObjectMediaNavigateClient) sObjectMediaNavigateClient->removeFromQueue(obj);
- }
-
- // Detach all media impls from this object
- for(U32 i = 0 ; i < mMediaImplList.size() ; i++)
- {
- removeMediaImpl(i);
- }
+ if(getMDCImplCount() > 0)
+ {
+ LLMediaDataClientObject::ptr_t obj = new LLMediaDataClientObjectImpl(const_cast<LLVOVolume*>(this), false);
+ if (sObjectMediaClient) sObjectMediaClient->removeFromQueue(obj);
+ if (sObjectMediaNavigateClient) sObjectMediaNavigateClient->removeFromQueue(obj);
+ }
+
+ // Detach all media impls from this object
+ for(U32 i = 0 ; i < mMediaImplList.size() ; i++)
+ {
+ removeMediaImpl(i);
+ }
+
+ if (mSculptTexture.notNull())
+ {
+ mSculptTexture->removeVolume(LLRender::SCULPT_TEX, this);
+ }
- if (mSculptTexture.notNull())
- {
- mSculptTexture->removeVolume(LLRender::SCULPT_TEX, this);
- }
+ if (mLightTexture.notNull())
+ {
+ mLightTexture->removeVolume(LLRender::LIGHT_TEX, this);
+ }
+ }
- if (mLightTexture.notNull())
- {
- mLightTexture->removeVolume(LLRender::LIGHT_TEX, this);
- }
- }
-
- LLViewerObject::markDead();
+ LLViewerObject::markDead();
}
// static
void LLVOVolume::initClass()
{
- // gSavedSettings better be around
- if (gSavedSettings.getBOOL("PrimMediaMasterEnabled"))
- {
- const F32 queue_timer_delay = gSavedSettings.getF32("PrimMediaRequestQueueDelay");
- const F32 retry_timer_delay = gSavedSettings.getF32("PrimMediaRetryTimerDelay");
- const U32 max_retries = gSavedSettings.getU32("PrimMediaMaxRetries");
- const U32 max_sorted_queue_size = gSavedSettings.getU32("PrimMediaMaxSortedQueueSize");
- const U32 max_round_robin_queue_size = gSavedSettings.getU32("PrimMediaMaxRoundRobinQueueSize");
- sObjectMediaClient = new LLObjectMediaDataClient(queue_timer_delay, retry_timer_delay, max_retries,
- max_sorted_queue_size, max_round_robin_queue_size);
- sObjectMediaNavigateClient = new LLObjectMediaNavigateClient(queue_timer_delay, retry_timer_delay,
- max_retries, max_sorted_queue_size, max_round_robin_queue_size);
- }
+ // gSavedSettings better be around
+ if (gSavedSettings.getBOOL("PrimMediaMasterEnabled"))
+ {
+ const F32 queue_timer_delay = gSavedSettings.getF32("PrimMediaRequestQueueDelay");
+ const F32 retry_timer_delay = gSavedSettings.getF32("PrimMediaRetryTimerDelay");
+ const U32 max_retries = gSavedSettings.getU32("PrimMediaMaxRetries");
+ const U32 max_sorted_queue_size = gSavedSettings.getU32("PrimMediaMaxSortedQueueSize");
+ const U32 max_round_robin_queue_size = gSavedSettings.getU32("PrimMediaMaxRoundRobinQueueSize");
+ sObjectMediaClient = new LLObjectMediaDataClient(queue_timer_delay, retry_timer_delay, max_retries,
+ max_sorted_queue_size, max_round_robin_queue_size);
+ sObjectMediaNavigateClient = new LLObjectMediaNavigateClient(queue_timer_delay, retry_timer_delay,
+ max_retries, max_sorted_queue_size, max_round_robin_queue_size);
+ }
}
// static
@@ -328,65 +328,65 @@ void LLVOVolume::cleanupClass()
}
U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num, EObjectUpdateType update_type,
- LLDataPacker *dp)
+ void **user_data,
+ U32 block_num, EObjectUpdateType update_type,
+ LLDataPacker *dp)
{
-
- LLColor4U color;
- const S32 teDirtyBits = (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR|TEM_CHANGE_MEDIA);
+
+ LLColor4U color;
+ const S32 teDirtyBits = (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR|TEM_CHANGE_MEDIA);
const bool previously_volume_changed = mVolumeChanged;
const bool previously_face_mapping_changed = mFaceMappingChanged;
const bool previously_color_changed = mColorChanged;
- // Do base class updates...
- U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
+ // Do base class updates...
+ U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
- LLUUID sculpt_id;
- U8 sculpt_type = 0;
- if (isSculpted())
- {
- LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
- sculpt_id = sculpt_params->getSculptTexture();
- sculpt_type = sculpt_params->getSculptType();
+ LLUUID sculpt_id;
+ U8 sculpt_type = 0;
+ if (isSculpted())
+ {
+ LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+ sculpt_id = sculpt_params->getSculptTexture();
+ sculpt_type = sculpt_params->getSculptType();
LL_DEBUGS("ObjectUpdate") << "uuid " << mID << " set sculpt_id " << sculpt_id << LL_ENDL;
dumpStack("ObjectUpdateStack");
- }
-
- if (!dp)
- {
- if (update_type == OUT_FULL)
- {
- ////////////////////////////////
- //
- // Unpack texture animation data
- //
- //
-
- if (mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_TextureAnim))
- {
- if (!mTextureAnimp)
- {
- mTextureAnimp = new LLViewerTextureAnim(this);
- }
- else
- {
- if (!(mTextureAnimp->mMode & LLTextureAnim::SMOOTH))
- {
- mTextureAnimp->reset();
- }
- }
- mTexAnimMode = 0;
-
- mTextureAnimp->unpackTAMessage(mesgsys, block_num);
- }
- else
- {
- if (mTextureAnimp)
- {
- delete mTextureAnimp;
- mTextureAnimp = NULL;
+ }
+
+ if (!dp)
+ {
+ if (update_type == OUT_FULL)
+ {
+ ////////////////////////////////
+ //
+ // Unpack texture animation data
+ //
+ //
+
+ if (mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_TextureAnim))
+ {
+ if (!mTextureAnimp)
+ {
+ mTextureAnimp = new LLViewerTextureAnim(this);
+ }
+ else
+ {
+ if (!(mTextureAnimp->mMode & LLTextureAnim::SMOOTH))
+ {
+ mTextureAnimp->reset();
+ }
+ }
+ mTexAnimMode = 0;
+
+ mTextureAnimp->unpackTAMessage(mesgsys, block_num);
+ }
+ else
+ {
+ if (mTextureAnimp)
+ {
+ delete mTextureAnimp;
+ mTextureAnimp = NULL;
for (S32 i = 0; i < getNumTEs(); i++)
{
@@ -399,98 +399,98 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
}
}
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- mTexAnimMode = 0;
- }
- }
-
- // Unpack volume data
- LLVolumeParams volume_params;
- LLVolumeMessage::unpackVolumeParams(&volume_params, mesgsys, _PREHASH_ObjectData, block_num);
- volume_params.setSculptID(sculpt_id, sculpt_type);
-
- if (setVolume(volume_params, 0))
- {
- markForUpdate();
- }
- }
-
- // Sigh, this needs to be done AFTER the volume is set as well, otherwise bad stuff happens...
- ////////////////////////////
- //
- // Unpack texture entry data
- //
-
- S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num);
-
- if (result & TEM_CHANGE_MEDIA)
- {
- retval |= MEDIA_FLAGS_CHANGED;
- }
- }
- else
- {
- if (update_type != OUT_TERSE_IMPROVED)
- {
- LLVolumeParams volume_params;
- BOOL res = LLVolumeMessage::unpackVolumeParams(&volume_params, *dp);
- if (!res)
- {
- LL_WARNS() << "Bogus volume parameters in object " << getID() << LL_ENDL;
- LL_WARNS() << getRegion()->getOriginGlobal() << LL_ENDL;
- }
-
- volume_params.setSculptID(sculpt_id, sculpt_type);
-
- if (setVolume(volume_params, 0))
- {
- markForUpdate();
- }
- S32 res2 = unpackTEMessage(*dp);
- if (TEM_INVALID == res2)
- {
- // There's something bogus in the data that we're unpacking.
- dp->dumpBufferToLog();
- LL_WARNS() << "Flushing cache files" << LL_ENDL;
-
- if(LLVOCache::instanceExists() && getRegion())
- {
- LLVOCache::getInstance()->removeEntry(getRegion()->getHandle()) ;
- }
-
- LL_WARNS() << "Bogus TE data in " << getID() << LL_ENDL;
- }
- else
- {
- if (res2 & TEM_CHANGE_MEDIA)
- {
- retval |= MEDIA_FLAGS_CHANGED;
- }
- }
-
- U32 value = dp->getPassFlags();
-
- if (value & 0x40)
- {
- if (!mTextureAnimp)
- {
- mTextureAnimp = new LLViewerTextureAnim(this);
- }
- else
- {
- if (!(mTextureAnimp->mMode & LLTextureAnim::SMOOTH))
- {
- mTextureAnimp->reset();
- }
- }
- mTexAnimMode = 0;
- mTextureAnimp->unpackTAMessage(*dp);
- }
- else if (mTextureAnimp)
- {
- delete mTextureAnimp;
- mTextureAnimp = NULL;
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ mTexAnimMode = 0;
+ }
+ }
+
+ // Unpack volume data
+ LLVolumeParams volume_params;
+ LLVolumeMessage::unpackVolumeParams(&volume_params, mesgsys, _PREHASH_ObjectData, block_num);
+ volume_params.setSculptID(sculpt_id, sculpt_type);
+
+ if (setVolume(volume_params, 0))
+ {
+ markForUpdate();
+ }
+ }
+
+ // Sigh, this needs to be done AFTER the volume is set as well, otherwise bad stuff happens...
+ ////////////////////////////
+ //
+ // Unpack texture entry data
+ //
+
+ S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num);
+
+ if (result & TEM_CHANGE_MEDIA)
+ {
+ retval |= MEDIA_FLAGS_CHANGED;
+ }
+ }
+ else
+ {
+ if (update_type != OUT_TERSE_IMPROVED)
+ {
+ LLVolumeParams volume_params;
+ BOOL res = LLVolumeMessage::unpackVolumeParams(&volume_params, *dp);
+ if (!res)
+ {
+ LL_WARNS() << "Bogus volume parameters in object " << getID() << LL_ENDL;
+ LL_WARNS() << getRegion()->getOriginGlobal() << LL_ENDL;
+ }
+
+ volume_params.setSculptID(sculpt_id, sculpt_type);
+
+ if (setVolume(volume_params, 0))
+ {
+ markForUpdate();
+ }
+ S32 res2 = unpackTEMessage(*dp);
+ if (TEM_INVALID == res2)
+ {
+ // There's something bogus in the data that we're unpacking.
+ dp->dumpBufferToLog();
+ LL_WARNS() << "Flushing cache files" << LL_ENDL;
+
+ if(LLVOCache::instanceExists() && getRegion())
+ {
+ LLVOCache::getInstance()->removeEntry(getRegion()->getHandle()) ;
+ }
+
+ LL_WARNS() << "Bogus TE data in " << getID() << LL_ENDL;
+ }
+ else
+ {
+ if (res2 & TEM_CHANGE_MEDIA)
+ {
+ retval |= MEDIA_FLAGS_CHANGED;
+ }
+ }
+
+ U32 value = dp->getPassFlags();
+
+ if (value & 0x40)
+ {
+ if (!mTextureAnimp)
+ {
+ mTextureAnimp = new LLViewerTextureAnim(this);
+ }
+ else
+ {
+ if (!(mTextureAnimp->mMode & LLTextureAnim::SMOOTH))
+ {
+ mTextureAnimp->reset();
+ }
+ }
+ mTexAnimMode = 0;
+ mTextureAnimp->unpackTAMessage(*dp);
+ }
+ else if (mTextureAnimp)
+ {
+ delete mTextureAnimp;
+ mTextureAnimp = NULL;
for (S32 i = 0; i < getNumTEs(); i++)
{
@@ -503,59 +503,59 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
}
}
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- mTexAnimMode = 0;
- }
-
- if (value & 0x400)
- { //particle system (new)
- unpackParticleSource(*dp, mOwnerID, false);
- }
- }
- else
- {
- S32 texture_length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_TextureEntry);
- if (texture_length)
- {
- U8 tdpbuffer[1024];
- LLDataPackerBinaryBuffer tdp(tdpbuffer, 1024);
- mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextureEntry, tdpbuffer, 0, block_num, 1024);
- S32 result = unpackTEMessage(tdp);
- if (result & teDirtyBits)
- {
- if (mDrawable)
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ mTexAnimMode = 0;
+ }
+
+ if (value & 0x400)
+ { //particle system (new)
+ unpackParticleSource(*dp, mOwnerID, false);
+ }
+ }
+ else
+ {
+ S32 texture_length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_TextureEntry);
+ if (texture_length)
+ {
+ U8 tdpbuffer[1024];
+ LLDataPackerBinaryBuffer tdp(tdpbuffer, 1024);
+ mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextureEntry, tdpbuffer, 0, block_num, 1024);
+ S32 result = unpackTEMessage(tdp);
+ if (result & teDirtyBits)
+ {
+ if (mDrawable)
{ //on the fly TE updates break batches, isolate in octree
shrinkWrap();
}
- }
- if (result & TEM_CHANGE_MEDIA)
- {
- retval |= MEDIA_FLAGS_CHANGED;
- }
- }
- }
- }
- if (retval & (MEDIA_URL_REMOVED | MEDIA_URL_ADDED | MEDIA_URL_UPDATED | MEDIA_FLAGS_CHANGED))
- {
- // If only the media URL changed, and it isn't a media version URL,
- // ignore it
- if ( ! ( retval & (MEDIA_URL_ADDED | MEDIA_URL_UPDATED) &&
- mMedia && ! mMedia->mMediaURL.empty() &&
- ! LLTextureEntry::isMediaVersionString(mMedia->mMediaURL) ) )
- {
- // If the media changed at all, request new media data
- LL_DEBUGS("MediaOnAPrim") << "Media update: " << getID() << ": retval=" << retval << " Media URL: " <<
+ }
+ if (result & TEM_CHANGE_MEDIA)
+ {
+ retval |= MEDIA_FLAGS_CHANGED;
+ }
+ }
+ }
+ }
+ if (retval & (MEDIA_URL_REMOVED | MEDIA_URL_ADDED | MEDIA_URL_UPDATED | MEDIA_FLAGS_CHANGED))
+ {
+ // If only the media URL changed, and it isn't a media version URL,
+ // ignore it
+ if ( ! ( retval & (MEDIA_URL_ADDED | MEDIA_URL_UPDATED) &&
+ mMedia && ! mMedia->mMediaURL.empty() &&
+ ! LLTextureEntry::isMediaVersionString(mMedia->mMediaURL) ) )
+ {
+ // If the media changed at all, request new media data
+ LL_DEBUGS("MediaOnAPrim") << "Media update: " << getID() << ": retval=" << retval << " Media URL: " <<
((mMedia) ? mMedia->mMediaURL : std::string("")) << LL_ENDL;
- requestMediaDataUpdate(retval & MEDIA_FLAGS_CHANGED);
- }
+ requestMediaDataUpdate(retval & MEDIA_FLAGS_CHANGED);
+ }
else {
LL_INFOS("MediaOnAPrim") << "Ignoring media update for: " << getID() << " Media URL: " <<
((mMedia) ? mMedia->mMediaURL : std::string("")) << LL_ENDL;
}
- }
- // ...and clean up any media impls
- cleanUpMediaImpls();
+ }
+ // ...and clean up any media impls
+ cleanUpMediaImpls();
if ((
(mVolumeChanged && !previously_volume_changed) ||
@@ -566,7 +566,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
onDrawableUpdateFromServer();
}
- return retval;
+ return retval;
}
// Called when a volume, material, etc is updated by the server, possibly by a
@@ -585,117 +585,117 @@ void LLVOVolume::onDrawableUpdateFromServer()
void LLVOVolume::animateTextures()
{
- if (!mDead)
- {
+ if (!mDead)
+ {
shrinkWrap();
- F32 off_s = 0.f, off_t = 0.f, scale_s = 1.f, scale_t = 1.f, rot = 0.f;
- S32 result = mTextureAnimp->animateTextures(off_s, off_t, scale_s, scale_t, rot);
-
- if (result)
- {
- if (!mTexAnimMode)
- {
- mFaceMappingChanged = TRUE;
- gPipeline.markTextured(mDrawable);
- }
- mTexAnimMode = result | mTextureAnimp->mMode;
-
- S32 start=0, end=mDrawable->getNumFaces()-1;
- if (mTextureAnimp->mFace >= 0 && mTextureAnimp->mFace <= end)
- {
- start = end = mTextureAnimp->mFace;
- }
-
- for (S32 i = start; i <= end; i++)
- {
- LLFace* facep = mDrawable->getFace(i);
- if (!facep) continue;
- if(facep->getVirtualSize() <= MIN_TEX_ANIM_SIZE && facep->mTextureMatrix) continue;
-
- const LLTextureEntry* te = facep->getTextureEntry();
-
- if (!te)
- {
- continue;
- }
-
- if (!(result & LLViewerTextureAnim::ROTATE))
- {
- te->getRotation(&rot);
- }
- if (!(result & LLViewerTextureAnim::TRANSLATE))
- {
- te->getOffset(&off_s,&off_t);
- }
- if (!(result & LLViewerTextureAnim::SCALE))
- {
- te->getScale(&scale_s, &scale_t);
- }
-
- if (!facep->mTextureMatrix)
- {
- facep->mTextureMatrix = new LLMatrix4();
- }
-
- LLMatrix4& tex_mat = *facep->mTextureMatrix;
- tex_mat.setIdentity();
- LLVector3 trans ;
-
- trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f));
- tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f));
-
- LLVector3 scale(scale_s, scale_t, 1.f);
- LLQuaternion quat;
- quat.setQuat(rot, 0, 0, -1.f);
-
- tex_mat.rotate(quat);
-
- LLMatrix4 mat;
- mat.initAll(scale, LLQuaternion(), LLVector3());
- tex_mat *= mat;
-
- tex_mat.translate(trans);
- }
- }
- else
- {
- if (mTexAnimMode && mTextureAnimp->mRate == 0)
- {
- U8 start, count;
-
- if (mTextureAnimp->mFace == -1)
- {
- start = 0;
- count = getNumTEs();
- }
- else
- {
- start = (U8) mTextureAnimp->mFace;
- count = 1;
- }
-
- for (S32 i = start; i < start + count; i++)
- {
- if (mTexAnimMode & LLViewerTextureAnim::TRANSLATE)
- {
- setTEOffset(i, mTextureAnimp->mOffS, mTextureAnimp->mOffT);
- }
- if (mTexAnimMode & LLViewerTextureAnim::SCALE)
- {
- setTEScale(i, mTextureAnimp->mScaleS, mTextureAnimp->mScaleT);
- }
- if (mTexAnimMode & LLViewerTextureAnim::ROTATE)
- {
- setTERotation(i, mTextureAnimp->mRot);
- }
- }
-
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- mTexAnimMode = 0;
- }
- }
- }
+ F32 off_s = 0.f, off_t = 0.f, scale_s = 1.f, scale_t = 1.f, rot = 0.f;
+ S32 result = mTextureAnimp->animateTextures(off_s, off_t, scale_s, scale_t, rot);
+
+ if (result)
+ {
+ if (!mTexAnimMode)
+ {
+ mFaceMappingChanged = TRUE;
+ gPipeline.markTextured(mDrawable);
+ }
+ mTexAnimMode = result | mTextureAnimp->mMode;
+
+ S32 start=0, end=mDrawable->getNumFaces()-1;
+ if (mTextureAnimp->mFace >= 0 && mTextureAnimp->mFace <= end)
+ {
+ start = end = mTextureAnimp->mFace;
+ }
+
+ for (S32 i = start; i <= end; i++)
+ {
+ LLFace* facep = mDrawable->getFace(i);
+ if (!facep) continue;
+ if(facep->getVirtualSize() <= MIN_TEX_ANIM_SIZE && facep->mTextureMatrix) continue;
+
+ const LLTextureEntry* te = facep->getTextureEntry();
+
+ if (!te)
+ {
+ continue;
+ }
+
+ if (!(result & LLViewerTextureAnim::ROTATE))
+ {
+ te->getRotation(&rot);
+ }
+ if (!(result & LLViewerTextureAnim::TRANSLATE))
+ {
+ te->getOffset(&off_s,&off_t);
+ }
+ if (!(result & LLViewerTextureAnim::SCALE))
+ {
+ te->getScale(&scale_s, &scale_t);
+ }
+
+ if (!facep->mTextureMatrix)
+ {
+ facep->mTextureMatrix = new LLMatrix4();
+ }
+
+ LLMatrix4& tex_mat = *facep->mTextureMatrix;
+ tex_mat.setIdentity();
+ LLVector3 trans ;
+
+ trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f));
+ tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f));
+
+ LLVector3 scale(scale_s, scale_t, 1.f);
+ LLQuaternion quat;
+ quat.setQuat(rot, 0, 0, -1.f);
+
+ tex_mat.rotate(quat);
+
+ LLMatrix4 mat;
+ mat.initAll(scale, LLQuaternion(), LLVector3());
+ tex_mat *= mat;
+
+ tex_mat.translate(trans);
+ }
+ }
+ else
+ {
+ if (mTexAnimMode && mTextureAnimp->mRate == 0)
+ {
+ U8 start, count;
+
+ if (mTextureAnimp->mFace == -1)
+ {
+ start = 0;
+ count = getNumTEs();
+ }
+ else
+ {
+ start = (U8) mTextureAnimp->mFace;
+ count = 1;
+ }
+
+ for (S32 i = start; i < start + count; i++)
+ {
+ if (mTexAnimMode & LLViewerTextureAnim::TRANSLATE)
+ {
+ setTEOffset(i, mTextureAnimp->mOffS, mTextureAnimp->mOffT);
+ }
+ if (mTexAnimMode & LLViewerTextureAnim::SCALE)
+ {
+ setTEScale(i, mTextureAnimp->mScaleS, mTextureAnimp->mScaleT);
+ }
+ if (mTexAnimMode & LLViewerTextureAnim::ROTATE)
+ {
+ setTERotation(i, mTextureAnimp->mRot);
+ }
+ }
+
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ mTexAnimMode = 0;
+ }
+ }
+ }
}
void LLVOVolume::updateTextures()
@@ -704,403 +704,403 @@ void LLVOVolume::updateTextures()
updateTextureVirtualSize();
}
-BOOL LLVOVolume::isVisible() const
+BOOL LLVOVolume::isVisible() const
{
- if(mDrawable.notNull() && mDrawable->isVisible())
- {
- return TRUE ;
- }
+ if(mDrawable.notNull() && mDrawable->isVisible())
+ {
+ return TRUE ;
+ }
- if(isAttachment())
- {
- LLViewerObject* objp = (LLViewerObject*)getParent() ;
- while(objp && !objp->isAvatar())
- {
- objp = (LLViewerObject*)objp->getParent() ;
- }
+ if(isAttachment())
+ {
+ LLViewerObject* objp = (LLViewerObject*)getParent() ;
+ while(objp && !objp->isAvatar())
+ {
+ objp = (LLViewerObject*)objp->getParent() ;
+ }
- return objp && objp->mDrawable.notNull() && objp->mDrawable->isVisible() ;
- }
+ return objp && objp->mDrawable.notNull() && objp->mDrawable->isVisible() ;
+ }
- return FALSE ;
+ return FALSE ;
}
void LLVOVolume::updateTextureVirtualSize(bool forced)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- // Update the pixel area of all faces
+ // Update the pixel area of all faces
if (mDrawable.isNull() || gCubeSnapshot)
{
return;
}
- if(!forced)
- {
- if(!isVisible())
- { //don't load textures for non-visible faces
- const S32 num_faces = mDrawable->getNumFaces();
- for (S32 i = 0; i < num_faces; i++)
- {
- LLFace* face = mDrawable->getFace(i);
- if (face)
- {
- face->setPixelArea(0.f);
- face->setVirtualSize(0.f);
- }
- }
-
- return ;
- }
-
- if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SIMPLE))
- {
- return;
- }
- }
-
- static LLCachedControl<bool> dont_load_textures(gSavedSettings,"TextureDisable", false);
-
- if (dont_load_textures || LLAppViewer::getTextureFetch()->mDebugPause) // || !mDrawable->isVisible())
- {
- return;
- }
-
- mTextureUpdateTimer.reset();
-
- F32 old_area = mPixelArea;
- mPixelArea = 0.f;
-
- const S32 num_faces = mDrawable->getNumFaces();
- F32 min_vsize=999999999.f, max_vsize=0.f;
- LLViewerCamera* camera = LLViewerCamera::getInstance();
+ if(!forced)
+ {
+ if(!isVisible())
+ { //don't load textures for non-visible faces
+ const S32 num_faces = mDrawable->getNumFaces();
+ for (S32 i = 0; i < num_faces; i++)
+ {
+ LLFace* face = mDrawable->getFace(i);
+ if (face)
+ {
+ face->setPixelArea(0.f);
+ face->setVirtualSize(0.f);
+ }
+ }
+
+ return ;
+ }
+
+ if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SIMPLE))
+ {
+ return;
+ }
+ }
+
+ static LLCachedControl<bool> dont_load_textures(gSavedSettings,"TextureDisable", false);
+
+ if (dont_load_textures || LLAppViewer::getTextureFetch()->mDebugPause) // || !mDrawable->isVisible())
+ {
+ return;
+ }
+
+ mTextureUpdateTimer.reset();
+
+ F32 old_area = mPixelArea;
+ mPixelArea = 0.f;
+
+ const S32 num_faces = mDrawable->getNumFaces();
+ F32 min_vsize=999999999.f, max_vsize=0.f;
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
std::stringstream debug_text;
- for (S32 i = 0; i < num_faces; i++)
- {
- LLFace* face = mDrawable->getFace(i);
- if (!face) continue;
- const LLTextureEntry *te = face->getTextureEntry();
- LLViewerTexture *imagep = face->getTexture();
- if (!imagep || !te ||
- face->mExtents[0].equals3(face->mExtents[1]))
- {
- continue;
- }
-
- F32 vsize;
- F32 old_size = face->getVirtualSize();
-
- if (isHUDAttachment())
- {
- F32 area = (F32) camera->getScreenPixelArea();
- vsize = area;
- imagep->setBoostLevel(LLGLTexture::BOOST_HUD);
- face->setPixelArea(area); // treat as full screen
- face->setVirtualSize(vsize);
- }
- else
- {
- vsize = face->getTextureVirtualSize();
- }
-
- mPixelArea = llmax(mPixelArea, face->getPixelArea());
+ for (S32 i = 0; i < num_faces; i++)
+ {
+ LLFace* face = mDrawable->getFace(i);
+ if (!face) continue;
+ const LLTextureEntry *te = face->getTextureEntry();
+ LLViewerTexture *imagep = face->getTexture();
+ if (!imagep || !te ||
+ face->mExtents[0].equals3(face->mExtents[1]))
+ {
+ continue;
+ }
+
+ F32 vsize;
+ F32 old_size = face->getVirtualSize();
+
+ if (isHUDAttachment())
+ {
+ F32 area = (F32) camera->getScreenPixelArea();
+ vsize = area;
+ imagep->setBoostLevel(LLGLTexture::BOOST_HUD);
+ face->setPixelArea(area); // treat as full screen
+ face->setVirtualSize(vsize);
+ }
+ else
+ {
+ vsize = face->getTextureVirtualSize();
+ }
+
+ mPixelArea = llmax(mPixelArea, face->getPixelArea());
// if the face has gotten small enough to turn off texture animation and texture
// animation is running, rebuild the render batch for this face to turn off
// texture animation
- if (face->mTextureMatrix != NULL)
- {
- if ((vsize < MIN_TEX_ANIM_SIZE && old_size > MIN_TEX_ANIM_SIZE) ||
- (vsize > MIN_TEX_ANIM_SIZE && old_size < MIN_TEX_ANIM_SIZE))
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
- }
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
- {
- LLViewerFetchedTexture* img = LLViewerTextureManager::staticCastToFetchedTexture(imagep) ;
- if(img)
- {
+ if (face->mTextureMatrix != NULL)
+ {
+ if ((vsize < MIN_TEX_ANIM_SIZE && old_size > MIN_TEX_ANIM_SIZE) ||
+ (vsize > MIN_TEX_ANIM_SIZE && old_size < MIN_TEX_ANIM_SIZE))
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
+ }
+ }
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
+ {
+ LLViewerFetchedTexture* img = LLViewerTextureManager::staticCastToFetchedTexture(imagep) ;
+ if(img)
+ {
debug_text << img->getDiscardLevel() << ":" << img->getDesiredDiscardLevel() << ":" << img->getWidth() << ":" << (S32) sqrtf(vsize) << ":" << (S32) sqrtf(img->getMaxVirtualSize()) << "\n";
- /*F32 pri = img->getDecodePriority();
- pri = llmax(pri, 0.0f);
- if (pri < min_vsize) min_vsize = pri;
- if (pri > max_vsize) max_vsize = pri;*/
- }
- }
- else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_FACE_AREA))
- {
- F32 pri = mPixelArea;
- if (pri < min_vsize) min_vsize = pri;
- if (pri > max_vsize) max_vsize = pri;
- }
- }
-
- if (isSculpted())
- {
+ /*F32 pri = img->getDecodePriority();
+ pri = llmax(pri, 0.0f);
+ if (pri < min_vsize) min_vsize = pri;
+ if (pri > max_vsize) max_vsize = pri;*/
+ }
+ }
+ else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_FACE_AREA))
+ {
+ F32 pri = mPixelArea;
+ if (pri < min_vsize) min_vsize = pri;
+ if (pri > max_vsize) max_vsize = pri;
+ }
+ }
+
+ if (isSculpted())
+ {
updateSculptTexture();
-
-
-
- if (mSculptTexture.notNull())
- {
- mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(),
- (S32)LLGLTexture::BOOST_SCULPTED));
- mSculptTexture->setForSculpt() ;
-
- if(!mSculptTexture->isCachedRawImageReady())
- {
- S32 lod = llmin(mLOD, 3);
- F32 lodf = ((F32)(lod + 1.0f)/4.f);
- F32 tex_size = lodf * LLViewerTexture::sMaxSculptRez ;
- mSculptTexture->addTextureStats(2.f * tex_size * tex_size, FALSE);
- }
-
- S32 texture_discard = mSculptTexture->getCachedRawImageLevel(); //try to match the texture
- S32 current_discard = getVolume() ? getVolume()->getSculptLevel() : -2 ;
-
- if (texture_discard >= 0 && //texture has some data available
- (texture_discard < current_discard || //texture has more data than last rebuild
- current_discard < 0)) //no previous rebuild
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
- mSculptChanged = TRUE;
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SCULPTED))
- {
- setDebugText(llformat("T%d C%d V%d\n%dx%d",
- texture_discard, current_discard, getVolume()->getSculptLevel(),
- mSculptTexture->getHeight(), mSculptTexture->getWidth()));
- }
- }
-
- }
-
- if (getLightTextureID().notNull())
- {
- LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
- LLUUID id = params->getLightTexture();
- mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE);
- if (mLightTexture.notNull())
- {
- F32 rad = getLightRadius();
- mLightTexture->addTextureStats(gPipeline.calcPixelArea(getPositionAgent(),
- LLVector3(rad,rad,rad),
- *camera));
- }
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
- {
- setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize)));
- }
- else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
- {
- //setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize)));
+
+
+
+ if (mSculptTexture.notNull())
+ {
+ mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(),
+ (S32)LLGLTexture::BOOST_SCULPTED));
+ mSculptTexture->setForSculpt() ;
+
+ if(!mSculptTexture->isCachedRawImageReady())
+ {
+ S32 lod = llmin(mLOD, 3);
+ F32 lodf = ((F32)(lod + 1.0f)/4.f);
+ F32 tex_size = lodf * LLViewerTexture::sMaxSculptRez ;
+ mSculptTexture->addTextureStats(2.f * tex_size * tex_size, FALSE);
+ }
+
+ S32 texture_discard = mSculptTexture->getCachedRawImageLevel(); //try to match the texture
+ S32 current_discard = getVolume() ? getVolume()->getSculptLevel() : -2 ;
+
+ if (texture_discard >= 0 && //texture has some data available
+ (texture_discard < current_discard || //texture has more data than last rebuild
+ current_discard < 0)) //no previous rebuild
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
+ mSculptChanged = TRUE;
+ }
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SCULPTED))
+ {
+ setDebugText(llformat("T%d C%d V%d\n%dx%d",
+ texture_discard, current_discard, getVolume()->getSculptLevel(),
+ mSculptTexture->getHeight(), mSculptTexture->getWidth()));
+ }
+ }
+
+ }
+
+ if (getLightTextureID().notNull())
+ {
+ LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
+ LLUUID id = params->getLightTexture();
+ mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE);
+ if (mLightTexture.notNull())
+ {
+ F32 rad = getLightRadius();
+ mLightTexture->addTextureStats(gPipeline.calcPixelArea(getPositionAgent(),
+ LLVector3(rad,rad,rad),
+ *camera));
+ }
+ }
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
+ {
+ setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize)));
+ }
+ else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
+ {
+ //setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize)));
setDebugText(debug_text.str());
- }
- else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_FACE_AREA))
- {
- setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize)));
- }
+ }
+ else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_FACE_AREA))
+ {
+ setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize)));
+ }
- if (mPixelArea == 0)
- { //flexi phasing issues make this happen
- mPixelArea = old_area;
- }
+ if (mPixelArea == 0)
+ { //flexi phasing issues make this happen
+ mPixelArea = old_area;
+ }
}
BOOL LLVOVolume::isActive() const
{
- return !mStatic;
+ return !mStatic;
}
BOOL LLVOVolume::setMaterial(const U8 material)
{
- BOOL res = LLViewerObject::setMaterial(material);
-
- return res;
+ BOOL res = LLViewerObject::setMaterial(material);
+
+ return res;
}
void LLVOVolume::setTexture(const S32 face)
{
- llassert(face < getNumTEs());
- gGL.getTexUnit(0)->bind(getTEImage(face));
+ llassert(face < getNumTEs());
+ gGL.getTexUnit(0)->bind(getTEImage(face));
}
void LLVOVolume::setScale(const LLVector3 &scale, BOOL damped)
{
- if (scale != getScale())
- {
- // store local radius
- LLViewerObject::setScale(scale);
+ if (scale != getScale())
+ {
+ // store local radius
+ LLViewerObject::setScale(scale);
+
+ if (mVolumeImpl)
+ {
+ mVolumeImpl->onSetScale(scale, damped);
+ }
- if (mVolumeImpl)
- {
- mVolumeImpl->onSetScale(scale, damped);
- }
-
- updateRadius();
+ updateRadius();
- //since drawable transforms do not include scale, changing volume scale
- //requires an immediate rebuild of volume verts.
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
+ //since drawable transforms do not include scale, changing volume scale
+ //requires an immediate rebuild of volume verts.
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
if (mDrawable)
{
shrinkWrap();
}
- }
+ }
}
LLFace* LLVOVolume::addFace(S32 f)
{
- const LLTextureEntry* te = getTE(f);
- LLViewerTexture* imagep = getTEImage(f);
- if (te->getMaterialParams().notNull())
- {
- LLViewerTexture* normalp = getTENormalMap(f);
- LLViewerTexture* specularp = getTESpecularMap(f);
- return mDrawable->addFace(te, imagep, normalp, specularp);
- }
- return mDrawable->addFace(te, imagep);
+ const LLTextureEntry* te = getTE(f);
+ LLViewerTexture* imagep = getTEImage(f);
+ if (te->getMaterialParams().notNull())
+ {
+ LLViewerTexture* normalp = getTENormalMap(f);
+ LLViewerTexture* specularp = getTESpecularMap(f);
+ return mDrawable->addFace(te, imagep, normalp, specularp);
+ }
+ return mDrawable->addFace(te, imagep);
}
LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline)
{
- pipeline->allocDrawable(this);
-
- mDrawable->setRenderType(LLPipeline::RENDER_TYPE_VOLUME);
+ pipeline->allocDrawable(this);
- S32 max_tes_to_set = getNumTEs();
- for (S32 i = 0; i < max_tes_to_set; i++)
- {
- addFace(i);
- }
- mNumFaces = max_tes_to_set;
+ mDrawable->setRenderType(LLPipeline::RENDER_TYPE_VOLUME);
- if (isAttachment())
- {
- mDrawable->makeActive();
- }
+ S32 max_tes_to_set = getNumTEs();
+ for (S32 i = 0; i < max_tes_to_set; i++)
+ {
+ addFace(i);
+ }
+ mNumFaces = max_tes_to_set;
- if (getIsLight())
- {
- // Add it to the pipeline mLightSet
- gPipeline.setLight(mDrawable, TRUE);
- }
+ if (isAttachment())
+ {
+ mDrawable->makeActive();
+ }
+
+ if (getIsLight())
+ {
+ // Add it to the pipeline mLightSet
+ gPipeline.setLight(mDrawable, TRUE);
+ }
if (isReflectionProbe())
{
updateReflectionProbePtr();
}
- updateRadius();
- bool force_update = true; // avoid non-alpha mDistance update being optimized away
- mDrawable->updateDistance(*LLViewerCamera::getInstance(), force_update);
+ updateRadius();
+ bool force_update = true; // avoid non-alpha mDistance update being optimized away
+ mDrawable->updateDistance(*LLViewerCamera::getInstance(), force_update);
- return mDrawable;
+ return mDrawable;
}
BOOL LLVOVolume::setVolume(const LLVolumeParams &params_in, const S32 detail, bool unique_volume)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- LLVolumeParams volume_params = params_in;
-
- S32 last_lod = mVolumep.notNull() ? LLVolumeLODGroup::getVolumeDetailFromScale(mVolumep->getDetail()) : -1;
- S32 lod = mLOD;
-
- BOOL is404 = FALSE;
-
- if (isSculpted())
- {
- // if it's a mesh
- if ((volume_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
- { //meshes might not have all LODs, get the force detail to best existing LOD
- if (NO_LOD != lod)
- {
- lod = gMeshRepo.getActualMeshLOD(volume_params, lod);
- if (lod == -1)
- {
- is404 = TRUE;
- lod = 0;
- }
- }
- }
- }
-
- // Check if we need to change implementations
- bool is_flexible = (volume_params.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE);
- if (is_flexible)
- {
- setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, TRUE, false);
- if (!mVolumeImpl)
- {
- LLFlexibleObjectData* data = (LLFlexibleObjectData*)getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
- mVolumeImpl = new LLVolumeImplFlexible(this, data);
- }
- }
- else
- {
- // Mark the parameter not in use
- setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, FALSE, false);
- if (mVolumeImpl)
- {
- delete mVolumeImpl;
- mVolumeImpl = NULL;
- if (mDrawable.notNull())
- {
- // Undo the damage we did to this matrix
- mDrawable->updateXform(FALSE);
- }
- }
- }
-
- if (is404)
- {
- setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI));
- //render prim proxy when mesh loading attempts give up
- volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_NONE);
-
- }
-
- if ((LLPrimitive::setVolume(volume_params, lod, (mVolumeImpl && mVolumeImpl->isVolumeUnique()))) || mSculptChanged)
- {
- mFaceMappingChanged = TRUE;
-
- if (mVolumeImpl)
- {
- mVolumeImpl->onSetVolume(volume_params, mLOD);
- }
-
- updateSculptTexture();
-
- if (isSculpted())
- {
- updateSculptTexture();
- // if it's a mesh
- if ((volume_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
- {
- if (mSkinInfo && mSkinInfo->mMeshID != volume_params.getSculptID())
- {
- mSkinInfo = NULL;
- mSkinInfoUnavaliable = false;
- }
-
- if (!getVolume()->isMeshAssetLoaded())
- {
- //load request not yet issued, request pipeline load this mesh
- S32 available_lod = gMeshRepo.loadMesh(this, volume_params, lod, last_lod);
- if (available_lod != lod)
- {
- LLPrimitive::setVolume(volume_params, available_lod);
- }
- }
-
- if (!mSkinInfo && !mSkinInfoUnavaliable)
- {
+ LLVolumeParams volume_params = params_in;
+
+ S32 last_lod = mVolumep.notNull() ? LLVolumeLODGroup::getVolumeDetailFromScale(mVolumep->getDetail()) : -1;
+ S32 lod = mLOD;
+
+ BOOL is404 = FALSE;
+
+ if (isSculpted())
+ {
+ // if it's a mesh
+ if ((volume_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
+ { //meshes might not have all LODs, get the force detail to best existing LOD
+ if (NO_LOD != lod)
+ {
+ lod = gMeshRepo.getActualMeshLOD(volume_params, lod);
+ if (lod == -1)
+ {
+ is404 = TRUE;
+ lod = 0;
+ }
+ }
+ }
+ }
+
+ // Check if we need to change implementations
+ bool is_flexible = (volume_params.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE);
+ if (is_flexible)
+ {
+ setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, TRUE, false);
+ if (!mVolumeImpl)
+ {
+ LLFlexibleObjectData* data = (LLFlexibleObjectData*)getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
+ mVolumeImpl = new LLVolumeImplFlexible(this, data);
+ }
+ }
+ else
+ {
+ // Mark the parameter not in use
+ setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, FALSE, false);
+ if (mVolumeImpl)
+ {
+ delete mVolumeImpl;
+ mVolumeImpl = NULL;
+ if (mDrawable.notNull())
+ {
+ // Undo the damage we did to this matrix
+ mDrawable->updateXform(FALSE);
+ }
+ }
+ }
+
+ if (is404)
+ {
+ setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI));
+ //render prim proxy when mesh loading attempts give up
+ volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_NONE);
+
+ }
+
+ if ((LLPrimitive::setVolume(volume_params, lod, (mVolumeImpl && mVolumeImpl->isVolumeUnique()))) || mSculptChanged)
+ {
+ mFaceMappingChanged = TRUE;
+
+ if (mVolumeImpl)
+ {
+ mVolumeImpl->onSetVolume(volume_params, mLOD);
+ }
+
+ updateSculptTexture();
+
+ if (isSculpted())
+ {
+ updateSculptTexture();
+ // if it's a mesh
+ if ((volume_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
+ {
+ if (mSkinInfo && mSkinInfo->mMeshID != volume_params.getSculptID())
+ {
+ mSkinInfo = NULL;
+ mSkinInfoUnavaliable = false;
+ }
+
+ if (!getVolume()->isMeshAssetLoaded())
+ {
+ //load request not yet issued, request pipeline load this mesh
+ S32 available_lod = gMeshRepo.loadMesh(this, volume_params, lod, last_lod);
+ if (available_lod != lod)
+ {
+ LLPrimitive::setVolume(volume_params, available_lod);
+ }
+ }
+
+ if (!mSkinInfo && !mSkinInfoUnavaliable)
+ {
LLUUID mesh_id = volume_params.getSculptID();
if (gMeshRepo.hasHeader(mesh_id) && !gMeshRepo.hasSkinInfo(mesh_id))
{
@@ -1117,60 +1117,60 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &params_in, const S32 detail, bo
notifySkinInfoLoaded(skin_info);
}
}
- }
- }
- else // otherwise is sculptie
- {
- if (mSculptTexture.notNull())
- {
- sculpt();
- }
- }
- }
+ }
+ }
+ else // otherwise is sculptie
+ {
+ if (mSculptTexture.notNull())
+ {
+ sculpt();
+ }
+ }
+ }
return TRUE;
- }
- else if (NO_LOD == lod)
- {
- LLSculptIDSize::instance().resetSizeSum(volume_params.getSculptID());
- }
+ }
+ else if (NO_LOD == lod)
+ {
+ LLSculptIDSize::instance().resetSizeSum(volume_params.getSculptID());
+ }
- return FALSE;
+ return FALSE;
}
void LLVOVolume::updateSculptTexture()
{
- LLPointer<LLViewerFetchedTexture> old_sculpt = mSculptTexture;
+ LLPointer<LLViewerFetchedTexture> old_sculpt = mSculptTexture;
- if (isSculpted() && !isMesh())
- {
- LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
- LLUUID id = sculpt_params->getSculptTexture();
- if (id.notNull())
- {
- mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- }
+ if (isSculpted() && !isMesh())
+ {
+ LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+ LLUUID id = sculpt_params->getSculptTexture();
+ if (id.notNull())
+ {
+ mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ }
mSkinInfoUnavaliable = false;
- mSkinInfo = NULL;
- }
- else
- {
- mSculptTexture = NULL;
- }
-
- if (mSculptTexture != old_sculpt)
- {
- if (old_sculpt.notNull())
- {
- old_sculpt->removeVolume(LLRender::SCULPT_TEX, this);
- }
- if (mSculptTexture.notNull())
- {
- mSculptTexture->addVolume(LLRender::SCULPT_TEX, this);
- }
- }
-
+ mSkinInfo = NULL;
+ }
+ else
+ {
+ mSculptTexture = NULL;
+ }
+
+ if (mSculptTexture != old_sculpt)
+ {
+ if (old_sculpt.notNull())
+ {
+ old_sculpt->removeVolume(LLRender::SCULPT_TEX, this);
+ }
+ if (mSculptTexture.notNull())
+ {
+ mSculptTexture->addVolume(LLRender::SCULPT_TEX, this);
+ }
+ }
+
}
void LLVOVolume::updateVisualComplexity()
@@ -1188,9 +1188,9 @@ void LLVOVolume::updateVisualComplexity()
}
void LLVOVolume::notifyMeshLoaded()
-{
- mSculptChanged = TRUE;
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
+{
+ mSculptChanged = TRUE;
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
if (!mSkinInfo && !mSkinInfoUnavaliable)
{
@@ -1220,137 +1220,137 @@ void LLVOVolume::notifyMeshLoaded()
void LLVOVolume::notifySkinInfoLoaded(const LLMeshSkinInfo* skin)
{
mSkinInfoUnavaliable = false;
- mSkinInfo = skin;
+ mSkinInfo = skin;
- notifyMeshLoaded();
+ notifyMeshLoaded();
}
void LLVOVolume::notifySkinInfoUnavailable()
{
- mSkinInfoUnavaliable = true;
- mSkinInfo = nullptr;
+ mSkinInfoUnavaliable = true;
+ mSkinInfo = nullptr;
}
// sculpt replaces generate() for sculpted surfaces
void LLVOVolume::sculpt()
-{
- if (mSculptTexture.notNull())
- {
- U16 sculpt_height = 0;
- U16 sculpt_width = 0;
- S8 sculpt_components = 0;
- const U8* sculpt_data = NULL;
-
- S32 discard_level = mSculptTexture->getCachedRawImageLevel() ;
- LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ;
-
- S32 max_discard = mSculptTexture->getMaxDiscardLevel();
- if (discard_level > max_discard)
- {
- discard_level = max_discard; // clamp to the best we can do
- }
- if(discard_level > MAX_DISCARD_LEVEL)
- {
- return; //we think data is not ready yet.
- }
-
- S32 current_discard = getVolume()->getSculptLevel() ;
- if(current_discard < -2)
- {
- static S32 low_sculpty_discard_warning_count = 1;
- S32 exponent = llmax(1, llfloor( log10((F64) low_sculpty_discard_warning_count) ));
- S32 interval = pow(10.0, exponent);
- if ( low_sculpty_discard_warning_count < 10 ||
- (low_sculpty_discard_warning_count % interval) == 0)
- { // Log first 10 time, then decreasing intervals afterwards otherwise this can flood the logs
- LL_WARNS() << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID()
- << " at " << current_discard
- << " is less than -2."
- << " Hit this " << low_sculpty_discard_warning_count << " times"
- << LL_ENDL;
- }
- low_sculpty_discard_warning_count++;
-
- // corrupted volume... don't update the sculpty
- return;
- }
- else if (current_discard > MAX_DISCARD_LEVEL)
- {
- static S32 high_sculpty_discard_warning_count = 1;
- S32 exponent = llmax(1, llfloor( log10((F64) high_sculpty_discard_warning_count) ));
- S32 interval = pow(10.0, exponent);
- if ( high_sculpty_discard_warning_count < 10 ||
- (high_sculpty_discard_warning_count % interval) == 0)
- { // Log first 10 time, then decreasing intervals afterwards otherwise this can flood the logs
- LL_WARNS() << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID()
- << " at " << current_discard
- << " is more than than allowed max of " << MAX_DISCARD_LEVEL
- << ". Hit this " << high_sculpty_discard_warning_count << " times"
- << LL_ENDL;
- }
- high_sculpty_discard_warning_count++;
-
- // corrupted volume... don't update the sculpty
- return;
- }
-
- if (current_discard == discard_level) // no work to do here
- return;
-
- if(!raw_image)
- {
- llassert(discard_level < 0) ;
-
- sculpt_width = 0;
- sculpt_height = 0;
- sculpt_data = NULL ;
-
- if(LLViewerTextureManager::sTesterp)
- {
- LLViewerTextureManager::sTesterp->updateGrayTextureBinding();
- }
- }
- else
- {
- sculpt_height = raw_image->getHeight();
- sculpt_width = raw_image->getWidth();
- sculpt_components = raw_image->getComponents();
-
- sculpt_data = raw_image->getData();
-
- if(LLViewerTextureManager::sTesterp)
- {
- mSculptTexture->updateBindStatsForTester() ;
- }
- }
- getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset());
-
- //notify rebuild any other VOVolumes that reference this sculpty volume
- for (S32 i = 0; i < mSculptTexture->getNumVolumes(LLRender::SCULPT_TEX); ++i)
- {
- LLVOVolume* volume = (*(mSculptTexture->getVolumeList(LLRender::SCULPT_TEX)))[i];
- if (volume != this && volume->getVolume() == getVolume())
- {
- gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY);
- }
- }
- }
-}
-
-S32 LLVOVolume::computeLODDetail(F32 distance, F32 radius, F32 lod_factor)
-{
- S32 cur_detail;
- if (LLPipeline::sDynamicLOD)
- {
- // We've got LOD in the profile, and in the twist. Use radius.
- F32 tan_angle = (lod_factor*radius)/distance;
- cur_detail = LLVolumeLODGroup::getDetailFromTan(ll_round(tan_angle, 0.01f));
- }
- else
- {
- cur_detail = llclamp((S32) (sqrtf(radius)*lod_factor*4.f), 0, 3);
- }
- return cur_detail;
+{
+ if (mSculptTexture.notNull())
+ {
+ U16 sculpt_height = 0;
+ U16 sculpt_width = 0;
+ S8 sculpt_components = 0;
+ const U8* sculpt_data = NULL;
+
+ S32 discard_level = mSculptTexture->getCachedRawImageLevel() ;
+ LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ;
+
+ S32 max_discard = mSculptTexture->getMaxDiscardLevel();
+ if (discard_level > max_discard)
+ {
+ discard_level = max_discard; // clamp to the best we can do
+ }
+ if(discard_level > MAX_DISCARD_LEVEL)
+ {
+ return; //we think data is not ready yet.
+ }
+
+ S32 current_discard = getVolume()->getSculptLevel() ;
+ if(current_discard < -2)
+ {
+ static S32 low_sculpty_discard_warning_count = 1;
+ S32 exponent = llmax(1, llfloor( log10((F64) low_sculpty_discard_warning_count) ));
+ S32 interval = pow(10.0, exponent);
+ if ( low_sculpty_discard_warning_count < 10 ||
+ (low_sculpty_discard_warning_count % interval) == 0)
+ { // Log first 10 time, then decreasing intervals afterwards otherwise this can flood the logs
+ LL_WARNS() << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID()
+ << " at " << current_discard
+ << " is less than -2."
+ << " Hit this " << low_sculpty_discard_warning_count << " times"
+ << LL_ENDL;
+ }
+ low_sculpty_discard_warning_count++;
+
+ // corrupted volume... don't update the sculpty
+ return;
+ }
+ else if (current_discard > MAX_DISCARD_LEVEL)
+ {
+ static S32 high_sculpty_discard_warning_count = 1;
+ S32 exponent = llmax(1, llfloor( log10((F64) high_sculpty_discard_warning_count) ));
+ S32 interval = pow(10.0, exponent);
+ if ( high_sculpty_discard_warning_count < 10 ||
+ (high_sculpty_discard_warning_count % interval) == 0)
+ { // Log first 10 time, then decreasing intervals afterwards otherwise this can flood the logs
+ LL_WARNS() << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID()
+ << " at " << current_discard
+ << " is more than than allowed max of " << MAX_DISCARD_LEVEL
+ << ". Hit this " << high_sculpty_discard_warning_count << " times"
+ << LL_ENDL;
+ }
+ high_sculpty_discard_warning_count++;
+
+ // corrupted volume... don't update the sculpty
+ return;
+ }
+
+ if (current_discard == discard_level) // no work to do here
+ return;
+
+ if(!raw_image)
+ {
+ llassert(discard_level < 0) ;
+
+ sculpt_width = 0;
+ sculpt_height = 0;
+ sculpt_data = NULL ;
+
+ if(LLViewerTextureManager::sTesterp)
+ {
+ LLViewerTextureManager::sTesterp->updateGrayTextureBinding();
+ }
+ }
+ else
+ {
+ sculpt_height = raw_image->getHeight();
+ sculpt_width = raw_image->getWidth();
+ sculpt_components = raw_image->getComponents();
+
+ sculpt_data = raw_image->getData();
+
+ if(LLViewerTextureManager::sTesterp)
+ {
+ mSculptTexture->updateBindStatsForTester() ;
+ }
+ }
+ getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset());
+
+ //notify rebuild any other VOVolumes that reference this sculpty volume
+ for (S32 i = 0; i < mSculptTexture->getNumVolumes(LLRender::SCULPT_TEX); ++i)
+ {
+ LLVOVolume* volume = (*(mSculptTexture->getVolumeList(LLRender::SCULPT_TEX)))[i];
+ if (volume != this && volume->getVolume() == getVolume())
+ {
+ gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY);
+ }
+ }
+ }
+}
+
+S32 LLVOVolume::computeLODDetail(F32 distance, F32 radius, F32 lod_factor)
+{
+ S32 cur_detail;
+ if (LLPipeline::sDynamicLOD)
+ {
+ // We've got LOD in the profile, and in the twist. Use radius.
+ F32 tan_angle = (lod_factor*radius)/distance;
+ cur_detail = LLVolumeLODGroup::getDetailFromTan(ll_round(tan_angle, 0.01f));
+ }
+ else
+ {
+ cur_detail = llclamp((S32) (sqrtf(radius)*lod_factor*4.f), 0, 3);
+ }
+ return cur_detail;
}
std::string get_debug_object_lod_text(LLVOVolume *rootp)
@@ -1395,28 +1395,28 @@ std::string get_debug_object_lod_text(LLVOVolume *rootp)
BOOL LLVOVolume::calcLOD()
{
- if (mDrawable.isNull())
- {
- return FALSE;
- }
+ if (mDrawable.isNull())
+ {
+ return FALSE;
+ }
- S32 cur_detail = 0;
-
- F32 radius;
- F32 distance;
- F32 lod_factor = LLVOVolume::sLODFactor;
+ S32 cur_detail = 0;
- if (mDrawable->isState(LLDrawable::RIGGED))
- {
- LLVOAvatar* avatar = getAvatar();
-
- // Not sure how this can really happen, but alas it does. Better exit here than crashing.
- if( !avatar || !avatar->mDrawable )
- {
- return FALSE;
- }
+ F32 radius;
+ F32 distance;
+ F32 lod_factor = LLVOVolume::sLODFactor;
- distance = avatar->mDrawable->mDistanceWRTCamera;
+ if (mDrawable->isState(LLDrawable::RIGGED))
+ {
+ LLVOAvatar* avatar = getAvatar();
+
+ // Not sure how this can really happen, but alas it does. Better exit here than crashing.
+ if( !avatar || !avatar->mDrawable )
+ {
+ return FALSE;
+ }
+
+ distance = avatar->mDrawable->mDistanceWRTCamera;
if (avatar->isControlAvatar())
@@ -1443,20 +1443,20 @@ BOOL LLVOVolume::calcLOD()
LL_DEBUGS("DynamicBox","CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL;
return FALSE;
}
- }
- else
- {
- distance = mDrawable->mDistanceWRTCamera;
- radius = getVolume() ? getVolume()->mLODScaleBias.scaledVec(getScale()).length() : getScale().length();
+ }
+ else
+ {
+ distance = mDrawable->mDistanceWRTCamera;
+ radius = getVolume() ? getVolume()->mLODScaleBias.scaledVec(getScale()).length() : getScale().length();
if (distance <= 0.f || radius <= 0.f)
{
LL_DEBUGS("DynamicBox","CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL;
return FALSE;
}
- }
-
- //hold onto unmodified distance for debugging
- //F32 debug_distance = distance;
+ }
+
+ //hold onto unmodified distance for debugging
+ //F32 debug_distance = distance;
mLODDistance = distance;
mLODRadius = radius;
@@ -1482,24 +1482,24 @@ BOOL LLVOVolume::calcLOD()
distance *= sDistanceFactor;
- F32 rampDist = LLVOVolume::sLODFactor * 2;
-
- if (distance < rampDist)
- {
- // Boost LOD when you're REALLY close
- distance *= 1.0f/rampDist;
- distance *= distance;
- distance *= rampDist;
- }
-
-
- distance *= F_PI/3.f;
-
- static LLCachedControl<bool> ignore_fov_zoom(gSavedSettings,"IgnoreFOVZoomForLODs");
- if(!ignore_fov_zoom)
- {
- lod_factor *= DEFAULT_FIELD_OF_VIEW / LLViewerCamera::getInstance()->getDefaultFOV();
- }
+ F32 rampDist = LLVOVolume::sLODFactor * 2;
+
+ if (distance < rampDist)
+ {
+ // Boost LOD when you're REALLY close
+ distance *= 1.0f/rampDist;
+ distance *= distance;
+ distance *= rampDist;
+ }
+
+
+ distance *= F_PI/3.f;
+
+ static LLCachedControl<bool> ignore_fov_zoom(gSavedSettings,"IgnoreFOVZoomForLODs");
+ if(!ignore_fov_zoom)
+ {
+ lod_factor *= DEFAULT_FIELD_OF_VIEW / LLViewerCamera::getInstance()->getDefaultFOV();
+ }
mLODAdjustedDistance = distance;
@@ -1522,189 +1522,189 @@ BOOL LLVOVolume::calcLOD()
setDebugText(llformat("TRIS SHOWN %d EST %d", total_tris, est_max_tris));
}
}
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_LOD_INFO) &&
- mDrawable->getFace(0))
- {
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_LOD_INFO) &&
+ mDrawable->getFace(0))
+ {
// This is a debug display for LODs. Please don't put the texture index here.
setDebugText(llformat("%d", cur_detail));
- }
+ }
- if (cur_detail != mLOD)
- {
- LL_DEBUGS("DynamicBox","CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD
+ if (cur_detail != mLOD)
+ {
+ LL_DEBUGS("DynamicBox","CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD
<< " distance " << distance << " radius " << radius << " rampDist " << rampDist
<< " drawable rigged? " << (mDrawable ? (S32) mDrawable->isState(LLDrawable::RIGGED) : (S32) -1)
- << " mRiggedVolume " << (void*)getRiggedVolume()
+ << " mRiggedVolume " << (void*)getRiggedVolume()
<< " distanceWRTCamera " << (mDrawable ? mDrawable->mDistanceWRTCamera : -1.f)
<< LL_ENDL;
-
- mAppAngle = ll_round((F32) atan2( mDrawable->getRadius(), mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
- mLOD = cur_detail;
+
+ mAppAngle = ll_round((F32) atan2( mDrawable->getRadius(), mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
+ mLOD = cur_detail;
return TRUE;
- }
+ }
- return FALSE;
+ return FALSE;
}
BOOL LLVOVolume::updateLOD()
{
- if (mDrawable.isNull())
- {
- return FALSE;
- }
+ if (mDrawable.isNull())
+ {
+ return FALSE;
+ }
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- BOOL lod_changed = FALSE;
-
- if (!LLSculptIDSize::instance().isUnloaded(getVolume()->getParams().getSculptID()))
- {
- lod_changed = calcLOD();
- }
- else
- {
- return FALSE;
- }
-
- if (lod_changed)
- {
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
- mLODChanged = TRUE;
- }
- else
- {
- F32 new_radius = getBinRadius();
- F32 old_radius = mDrawable->getBinRadius();
- if (new_radius < old_radius * 0.9f || new_radius > old_radius*1.1f)
- {
- gPipeline.markPartitionMove(mDrawable);
- }
- }
-
- lod_changed = lod_changed || LLViewerObject::updateLOD();
-
- return lod_changed;
+ BOOL lod_changed = FALSE;
+
+ if (!LLSculptIDSize::instance().isUnloaded(getVolume()->getParams().getSculptID()))
+ {
+ lod_changed = calcLOD();
+ }
+ else
+ {
+ return FALSE;
+ }
+
+ if (lod_changed)
+ {
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
+ mLODChanged = TRUE;
+ }
+ else
+ {
+ F32 new_radius = getBinRadius();
+ F32 old_radius = mDrawable->getBinRadius();
+ if (new_radius < old_radius * 0.9f || new_radius > old_radius*1.1f)
+ {
+ gPipeline.markPartitionMove(mDrawable);
+ }
+ }
+
+ lod_changed = lod_changed || LLViewerObject::updateLOD();
+
+ return lod_changed;
}
BOOL LLVOVolume::setDrawableParent(LLDrawable* parentp)
{
- if (!LLViewerObject::setDrawableParent(parentp))
- {
- // no change in drawable parent
- return FALSE;
- }
-
- if (!mDrawable->isRoot())
- {
- // rebuild vertices in parent relative space
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
-
- if (mDrawable->isActive() && !parentp->isActive())
- {
- parentp->makeActive();
- }
- else if (mDrawable->isStatic() && parentp->isActive())
- {
- mDrawable->makeActive();
- }
- }
-
- return TRUE;
+ if (!LLViewerObject::setDrawableParent(parentp))
+ {
+ // no change in drawable parent
+ return FALSE;
+ }
+
+ if (!mDrawable->isRoot())
+ {
+ // rebuild vertices in parent relative space
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
+
+ if (mDrawable->isActive() && !parentp->isActive())
+ {
+ parentp->makeActive();
+ }
+ else if (mDrawable->isStatic() && parentp->isActive())
+ {
+ mDrawable->makeActive();
+ }
+ }
+
+ return TRUE;
}
void LLVOVolume::updateFaceFlags()
{
- // There's no guarantee that getVolume()->getNumFaces() == mDrawable->getNumFaces()
- for (S32 i = 0; i < getVolume()->getNumFaces() && i < mDrawable->getNumFaces(); i++)
- {
- LLFace *face = mDrawable->getFace(i);
- if (face)
- {
- BOOL fullbright = getTE(i)->getFullbright();
- face->clearState(LLFace::FULLBRIGHT | LLFace::HUD_RENDER | LLFace::LIGHT);
-
- if (fullbright || (mMaterial == LL_MCODE_LIGHT))
- {
- face->setState(LLFace::FULLBRIGHT);
- }
- if (mDrawable->isLight())
- {
- face->setState(LLFace::LIGHT);
- }
- if (isHUDAttachment())
- {
- face->setState(LLFace::HUD_RENDER);
- }
- }
- }
+ // There's no guarantee that getVolume()->getNumFaces() == mDrawable->getNumFaces()
+ for (S32 i = 0; i < getVolume()->getNumFaces() && i < mDrawable->getNumFaces(); i++)
+ {
+ LLFace *face = mDrawable->getFace(i);
+ if (face)
+ {
+ BOOL fullbright = getTE(i)->getFullbright();
+ face->clearState(LLFace::FULLBRIGHT | LLFace::HUD_RENDER | LLFace::LIGHT);
+
+ if (fullbright || (mMaterial == LL_MCODE_LIGHT))
+ {
+ face->setState(LLFace::FULLBRIGHT);
+ }
+ if (mDrawable->isLight())
+ {
+ face->setState(LLFace::LIGHT);
+ }
+ if (isHUDAttachment())
+ {
+ face->setState(LLFace::HUD_RENDER);
+ }
+ }
+ }
}
BOOL LLVOVolume::setParent(LLViewerObject* parent)
{
- BOOL ret = FALSE ;
+ BOOL ret = FALSE ;
LLViewerObject *old_parent = (LLViewerObject*) getParent();
- if (parent != old_parent)
- {
- ret = LLViewerObject::setParent(parent);
- if (ret && mDrawable)
- {
- gPipeline.markMoved(mDrawable);
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
- }
+ if (parent != old_parent)
+ {
+ ret = LLViewerObject::setParent(parent);
+ if (ret && mDrawable)
+ {
+ gPipeline.markMoved(mDrawable);
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
+ }
onReparent(old_parent, parent);
- }
+ }
- return ret ;
+ return ret ;
}
// NOTE: regenFaces() MUST be followed by genTriangles()!
void LLVOVolume::regenFaces()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- // remove existing faces
- BOOL count_changed = mNumFaces != getNumTEs();
-
- if (count_changed)
- {
- deleteFaces();
- // add new faces
- mNumFaces = getNumTEs();
- }
-
- for (S32 i = 0; i < mNumFaces; i++)
- {
- LLFace* facep = count_changed ? addFace(i) : mDrawable->getFace(i);
- if (!facep) continue;
-
- facep->setTEOffset(i);
- facep->setTexture(getTEImage(i));
- if (facep->getTextureEntry()->getMaterialParams().notNull())
- {
- facep->setNormalMap(getTENormalMap(i));
- facep->setSpecularMap(getTESpecularMap(i));
- }
- facep->setViewerObject(this);
-
- // If the face had media on it, this will have broken the link between the LLViewerMediaTexture and the face.
- // Re-establish the link.
- if((int)mMediaImplList.size() > i)
- {
- if(mMediaImplList[i])
- {
- LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[i]->getMediaTextureID()) ;
- if(media_tex)
- {
- media_tex->addMediaToFace(facep) ;
- }
- }
- }
- }
-
- if (!count_changed)
- {
- updateFaceFlags();
- }
+ // remove existing faces
+ BOOL count_changed = mNumFaces != getNumTEs();
+
+ if (count_changed)
+ {
+ deleteFaces();
+ // add new faces
+ mNumFaces = getNumTEs();
+ }
+
+ for (S32 i = 0; i < mNumFaces; i++)
+ {
+ LLFace* facep = count_changed ? addFace(i) : mDrawable->getFace(i);
+ if (!facep) continue;
+
+ facep->setTEOffset(i);
+ facep->setTexture(getTEImage(i));
+ if (facep->getTextureEntry()->getMaterialParams().notNull())
+ {
+ facep->setNormalMap(getTENormalMap(i));
+ facep->setSpecularMap(getTESpecularMap(i));
+ }
+ facep->setViewerObject(this);
+
+ // If the face had media on it, this will have broken the link between the LLViewerMediaTexture and the face.
+ // Re-establish the link.
+ if((int)mMediaImplList.size() > i)
+ {
+ if(mMediaImplList[i])
+ {
+ LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[i]->getMediaTextureID()) ;
+ if(media_tex)
+ {
+ media_tex->addMediaToFace(facep) ;
+ }
+ }
+ }
+ }
+
+ if (!count_changed)
+ {
+ updateFaceFlags();
+ }
}
BOOL LLVOVolume::genBBoxes(BOOL force_global, BOOL should_update_octree_bounds)
@@ -1822,7 +1822,7 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global, BOOL should_update_octree_bounds)
mDrawable->setPositionGroup(min);
}
}
-
+
updateRadius();
mDrawable->movePartition();
}
@@ -1836,581 +1836,581 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global, BOOL should_update_octree_bounds)
void LLVOVolume::preRebuild()
{
- if (mVolumeImpl != NULL)
- {
- mVolumeImpl->preRebuild();
- }
+ if (mVolumeImpl != NULL)
+ {
+ mVolumeImpl->preRebuild();
+ }
}
void LLVOVolume::updateRelativeXform(bool force_identity)
{
- if (mVolumeImpl)
- {
- mVolumeImpl->updateRelativeXform(force_identity);
- return;
- }
-
- LLDrawable* drawable = mDrawable;
-
- if (drawable->isState(LLDrawable::RIGGED) && mRiggedVolume.notNull())
- { //rigged volume (which is in agent space) is used for generating bounding boxes etc
- //inverse of render matrix should go to partition space
- mRelativeXform = getRenderMatrix();
-
- F32* dst = (F32*) mRelativeXformInvTrans.mMatrix;
- F32* src = (F32*) mRelativeXform.mMatrix;
- dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2];
- dst[3] = src[4]; dst[4] = src[5]; dst[5] = src[6];
- dst[6] = src[8]; dst[7] = src[9]; dst[8] = src[10];
-
- mRelativeXform.invert();
- mRelativeXformInvTrans.transpose();
- }
- else if (drawable->isActive() || force_identity)
- {
- // setup relative transforms
- LLQuaternion delta_rot;
- LLVector3 delta_pos, delta_scale;
-
- //matrix from local space to parent relative/global space
- bool use_identity = force_identity || drawable->isSpatialRoot();
- delta_rot = use_identity ? LLQuaternion() : mDrawable->getRotation();
- delta_pos = use_identity ? LLVector3(0,0,0) : mDrawable->getPosition();
- delta_scale = mDrawable->getScale();
-
- // Vertex transform (4x4)
- LLVector3 x_axis = LLVector3(delta_scale.mV[VX], 0.f, 0.f) * delta_rot;
- LLVector3 y_axis = LLVector3(0.f, delta_scale.mV[VY], 0.f) * delta_rot;
- LLVector3 z_axis = LLVector3(0.f, 0.f, delta_scale.mV[VZ]) * delta_rot;
-
- mRelativeXform.initRows(LLVector4(x_axis, 0.f),
- LLVector4(y_axis, 0.f),
- LLVector4(z_axis, 0.f),
- LLVector4(delta_pos, 1.f));
-
-
- // compute inverse transpose for normals
- // mRelativeXformInvTrans.setRows(x_axis, y_axis, z_axis);
- // mRelativeXformInvTrans.invert();
- // mRelativeXformInvTrans.setRows(x_axis, y_axis, z_axis);
- // grumble - invert is NOT a matrix invert, so we do it by hand:
-
- LLMatrix3 rot_inverse = LLMatrix3(~delta_rot);
-
- LLMatrix3 scale_inverse;
- scale_inverse.setRows(LLVector3(1.0, 0.0, 0.0) / delta_scale.mV[VX],
- LLVector3(0.0, 1.0, 0.0) / delta_scale.mV[VY],
- LLVector3(0.0, 0.0, 1.0) / delta_scale.mV[VZ]);
-
-
- mRelativeXformInvTrans = rot_inverse * scale_inverse;
-
- mRelativeXformInvTrans.transpose();
- }
- else
- {
- LLVector3 pos = getPosition();
- LLVector3 scale = getScale();
- LLQuaternion rot = getRotation();
-
- if (mParent)
- {
- pos *= mParent->getRotation();
- pos += mParent->getPosition();
- rot *= mParent->getRotation();
- }
-
- //LLViewerRegion* region = getRegion();
- //pos += region->getOriginAgent();
-
- LLVector3 x_axis = LLVector3(scale.mV[VX], 0.f, 0.f) * rot;
- LLVector3 y_axis = LLVector3(0.f, scale.mV[VY], 0.f) * rot;
- LLVector3 z_axis = LLVector3(0.f, 0.f, scale.mV[VZ]) * rot;
-
- mRelativeXform.initRows(LLVector4(x_axis, 0.f),
- LLVector4(y_axis, 0.f),
- LLVector4(z_axis, 0.f),
- LLVector4(pos, 1.f));
-
- // compute inverse transpose for normals
- LLMatrix3 rot_inverse = LLMatrix3(~rot);
-
- LLMatrix3 scale_inverse;
- scale_inverse.setRows(LLVector3(1.0, 0.0, 0.0) / scale.mV[VX],
- LLVector3(0.0, 1.0, 0.0) / scale.mV[VY],
- LLVector3(0.0, 0.0, 1.0) / scale.mV[VZ]);
-
-
- mRelativeXformInvTrans = rot_inverse * scale_inverse;
-
- mRelativeXformInvTrans.transpose();
- }
+ if (mVolumeImpl)
+ {
+ mVolumeImpl->updateRelativeXform(force_identity);
+ return;
+ }
+
+ LLDrawable* drawable = mDrawable;
+
+ if (drawable->isState(LLDrawable::RIGGED) && mRiggedVolume.notNull())
+ { //rigged volume (which is in agent space) is used for generating bounding boxes etc
+ //inverse of render matrix should go to partition space
+ mRelativeXform = getRenderMatrix();
+
+ F32* dst = (F32*) mRelativeXformInvTrans.mMatrix;
+ F32* src = (F32*) mRelativeXform.mMatrix;
+ dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2];
+ dst[3] = src[4]; dst[4] = src[5]; dst[5] = src[6];
+ dst[6] = src[8]; dst[7] = src[9]; dst[8] = src[10];
+
+ mRelativeXform.invert();
+ mRelativeXformInvTrans.transpose();
+ }
+ else if (drawable->isActive() || force_identity)
+ {
+ // setup relative transforms
+ LLQuaternion delta_rot;
+ LLVector3 delta_pos, delta_scale;
+
+ //matrix from local space to parent relative/global space
+ bool use_identity = force_identity || drawable->isSpatialRoot();
+ delta_rot = use_identity ? LLQuaternion() : mDrawable->getRotation();
+ delta_pos = use_identity ? LLVector3(0,0,0) : mDrawable->getPosition();
+ delta_scale = mDrawable->getScale();
+
+ // Vertex transform (4x4)
+ LLVector3 x_axis = LLVector3(delta_scale.mV[VX], 0.f, 0.f) * delta_rot;
+ LLVector3 y_axis = LLVector3(0.f, delta_scale.mV[VY], 0.f) * delta_rot;
+ LLVector3 z_axis = LLVector3(0.f, 0.f, delta_scale.mV[VZ]) * delta_rot;
+
+ mRelativeXform.initRows(LLVector4(x_axis, 0.f),
+ LLVector4(y_axis, 0.f),
+ LLVector4(z_axis, 0.f),
+ LLVector4(delta_pos, 1.f));
+
+
+ // compute inverse transpose for normals
+ // mRelativeXformInvTrans.setRows(x_axis, y_axis, z_axis);
+ // mRelativeXformInvTrans.invert();
+ // mRelativeXformInvTrans.setRows(x_axis, y_axis, z_axis);
+ // grumble - invert is NOT a matrix invert, so we do it by hand:
+
+ LLMatrix3 rot_inverse = LLMatrix3(~delta_rot);
+
+ LLMatrix3 scale_inverse;
+ scale_inverse.setRows(LLVector3(1.0, 0.0, 0.0) / delta_scale.mV[VX],
+ LLVector3(0.0, 1.0, 0.0) / delta_scale.mV[VY],
+ LLVector3(0.0, 0.0, 1.0) / delta_scale.mV[VZ]);
+
+
+ mRelativeXformInvTrans = rot_inverse * scale_inverse;
+
+ mRelativeXformInvTrans.transpose();
+ }
+ else
+ {
+ LLVector3 pos = getPosition();
+ LLVector3 scale = getScale();
+ LLQuaternion rot = getRotation();
+
+ if (mParent)
+ {
+ pos *= mParent->getRotation();
+ pos += mParent->getPosition();
+ rot *= mParent->getRotation();
+ }
+
+ //LLViewerRegion* region = getRegion();
+ //pos += region->getOriginAgent();
+
+ LLVector3 x_axis = LLVector3(scale.mV[VX], 0.f, 0.f) * rot;
+ LLVector3 y_axis = LLVector3(0.f, scale.mV[VY], 0.f) * rot;
+ LLVector3 z_axis = LLVector3(0.f, 0.f, scale.mV[VZ]) * rot;
+
+ mRelativeXform.initRows(LLVector4(x_axis, 0.f),
+ LLVector4(y_axis, 0.f),
+ LLVector4(z_axis, 0.f),
+ LLVector4(pos, 1.f));
+
+ // compute inverse transpose for normals
+ LLMatrix3 rot_inverse = LLMatrix3(~rot);
+
+ LLMatrix3 scale_inverse;
+ scale_inverse.setRows(LLVector3(1.0, 0.0, 0.0) / scale.mV[VX],
+ LLVector3(0.0, 1.0, 0.0) / scale.mV[VY],
+ LLVector3(0.0, 0.0, 1.0) / scale.mV[VZ]);
+
+
+ mRelativeXformInvTrans = rot_inverse * scale_inverse;
+
+ mRelativeXformInvTrans.transpose();
+ }
}
bool LLVOVolume::lodOrSculptChanged(LLDrawable *drawable, BOOL &compiled, BOOL &should_update_octree_bounds)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- bool regen_faces = false;
+ bool regen_faces = false;
- LLVolume *old_volumep, *new_volumep;
- F32 old_lod, new_lod;
- S32 old_num_faces, new_num_faces;
+ LLVolume *old_volumep, *new_volumep;
+ F32 old_lod, new_lod;
+ S32 old_num_faces, new_num_faces;
- old_volumep = getVolume();
- old_lod = old_volumep->getDetail();
- old_num_faces = old_volumep->getNumFaces();
- old_volumep = NULL;
+ old_volumep = getVolume();
+ old_lod = old_volumep->getDetail();
+ old_num_faces = old_volumep->getNumFaces();
+ old_volumep = NULL;
- {
- const LLVolumeParams &volume_params = getVolume()->getParams();
- setVolume(volume_params, 0);
- }
+ {
+ const LLVolumeParams &volume_params = getVolume()->getParams();
+ setVolume(volume_params, 0);
+ }
- new_volumep = getVolume();
- new_lod = new_volumep->getDetail();
- new_num_faces = new_volumep->getNumFaces();
- new_volumep = NULL;
+ new_volumep = getVolume();
+ new_lod = new_volumep->getDetail();
+ new_num_faces = new_volumep->getNumFaces();
+ new_volumep = NULL;
- if ((new_lod != old_lod) || mSculptChanged)
- {
+ if ((new_lod != old_lod) || mSculptChanged)
+ {
if (mDrawable->isState(LLDrawable::RIGGED))
{
updateVisualComplexity();
}
- compiled = TRUE;
+ compiled = TRUE;
// new_lod > old_lod breaks a feedback loop between LOD updates and
// bounding box updates.
should_update_octree_bounds = should_update_octree_bounds || mSculptChanged || new_lod > old_lod;
- sNumLODChanges += new_num_faces;
-
- if ((S32)getNumTEs() != getVolume()->getNumFaces())
- {
- setNumTEs(getVolume()->getNumFaces()); //mesh loading may change number of faces.
- }
-
- drawable->setState(LLDrawable::REBUILD_VOLUME); // for face->genVolumeTriangles()
-
- {
- regen_faces = new_num_faces != old_num_faces || mNumFaces != (S32)getNumTEs();
- if (regen_faces)
- {
- regenFaces();
- }
-
- if (mSculptChanged)
- { //changes in sculpt maps can thrash an object bounding box without
- //triggering a spatial group bounding box update -- force spatial group
- //to update bounding boxes
- LLSpatialGroup* group = mDrawable->getSpatialGroup();
- if (group)
- {
- group->unbound();
- }
- }
- }
- }
-
- return regen_faces;
+ sNumLODChanges += new_num_faces;
+
+ if ((S32)getNumTEs() != getVolume()->getNumFaces())
+ {
+ setNumTEs(getVolume()->getNumFaces()); //mesh loading may change number of faces.
+ }
+
+ drawable->setState(LLDrawable::REBUILD_VOLUME); // for face->genVolumeTriangles()
+
+ {
+ regen_faces = new_num_faces != old_num_faces || mNumFaces != (S32)getNumTEs();
+ if (regen_faces)
+ {
+ regenFaces();
+ }
+
+ if (mSculptChanged)
+ { //changes in sculpt maps can thrash an object bounding box without
+ //triggering a spatial group bounding box update -- force spatial group
+ //to update bounding boxes
+ LLSpatialGroup* group = mDrawable->getSpatialGroup();
+ if (group)
+ {
+ group->unbound();
+ }
+ }
+ }
+ }
+
+ return regen_faces;
}
BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
-
- if (mDrawable->isState(LLDrawable::REBUILD_RIGGED))
- {
+
+ if (mDrawable->isState(LLDrawable::REBUILD_RIGGED))
+ {
updateRiggedVolume(false);
- genBBoxes(FALSE);
- mDrawable->clearState(LLDrawable::REBUILD_RIGGED);
- }
-
- if (mVolumeImpl != NULL)
- {
- BOOL res;
- {
- res = mVolumeImpl->doUpdateGeometry(drawable);
- }
- updateFaceFlags();
- return res;
- }
-
- LLSpatialGroup* group = drawable->getSpatialGroup();
- if (group)
- {
+ genBBoxes(FALSE);
+ mDrawable->clearState(LLDrawable::REBUILD_RIGGED);
+ }
+
+ if (mVolumeImpl != NULL)
+ {
+ BOOL res;
+ {
+ res = mVolumeImpl->doUpdateGeometry(drawable);
+ }
+ updateFaceFlags();
+ return res;
+ }
+
+ LLSpatialGroup* group = drawable->getSpatialGroup();
+ if (group)
+ {
group->dirtyMesh();
- }
+ }
- updateRelativeXform();
-
- if (mDrawable.isNull()) // Not sure why this is happening, but it is...
- {
- return TRUE; // No update to complete
- }
+ updateRelativeXform();
- BOOL compiled = FALSE;
+ if (mDrawable.isNull()) // Not sure why this is happening, but it is...
+ {
+ return TRUE; // No update to complete
+ }
+
+ BOOL compiled = FALSE;
// This should be true in most cases, unless we're sure no octree update is
// needed.
BOOL should_update_octree_bounds = bool(getRiggedVolume()) || mDrawable->isState(LLDrawable::REBUILD_POSITION) || !mDrawable->getSpatialExtents()->isFinite3();
- if (mVolumeChanged || mFaceMappingChanged)
- {
- dirtySpatialGroup();
+ if (mVolumeChanged || mFaceMappingChanged)
+ {
+ dirtySpatialGroup();
- bool was_regen_faces = false;
+ bool was_regen_faces = false;
should_update_octree_bounds = true;
- if (mVolumeChanged)
- {
+ if (mVolumeChanged)
+ {
was_regen_faces = lodOrSculptChanged(drawable, compiled, should_update_octree_bounds);
- drawable->setState(LLDrawable::REBUILD_VOLUME);
- }
- else if (mSculptChanged || mLODChanged || mColorChanged)
- {
- compiled = TRUE;
+ drawable->setState(LLDrawable::REBUILD_VOLUME);
+ }
+ else if (mSculptChanged || mLODChanged || mColorChanged)
+ {
+ compiled = TRUE;
was_regen_faces = lodOrSculptChanged(drawable, compiled, should_update_octree_bounds);
- }
-
- if (!was_regen_faces) {
- regenFaces();
- }
- }
- else if (mLODChanged || mSculptChanged || mColorChanged)
- {
- dirtySpatialGroup();
- compiled = TRUE;
+ }
+
+ if (!was_regen_faces) {
+ regenFaces();
+ }
+ }
+ else if (mLODChanged || mSculptChanged || mColorChanged)
+ {
+ dirtySpatialGroup();
+ compiled = TRUE;
lodOrSculptChanged(drawable, compiled, should_update_octree_bounds);
-
- if(drawable->isState(LLDrawable::REBUILD_RIGGED | LLDrawable::RIGGED))
- {
- updateRiggedVolume(false);
- }
- }
- // it has its own drawable (it's moved) or it has changed UVs or it has changed xforms from global<->local
- else
- {
- compiled = TRUE;
- // All it did was move or we changed the texture coordinate offset
- }
+
+ if(drawable->isState(LLDrawable::REBUILD_RIGGED | LLDrawable::RIGGED))
+ {
+ updateRiggedVolume(false);
+ }
+ }
+ // it has its own drawable (it's moved) or it has changed UVs or it has changed xforms from global<->local
+ else
+ {
+ compiled = TRUE;
+ // All it did was move or we changed the texture coordinate offset
+ }
// Generate bounding boxes if needed, and update the object's size in the
// octree
genBBoxes(FALSE, should_update_octree_bounds);
- // Update face flags
- updateFaceFlags();
-
- if(compiled)
- {
- LLPipeline::sCompiles++;
- }
-
- mVolumeChanged = FALSE;
- mLODChanged = FALSE;
- mSculptChanged = FALSE;
- mFaceMappingChanged = FALSE;
+ // Update face flags
+ updateFaceFlags();
+
+ if(compiled)
+ {
+ LLPipeline::sCompiles++;
+ }
+
+ mVolumeChanged = FALSE;
+ mLODChanged = FALSE;
+ mSculptChanged = FALSE;
+ mFaceMappingChanged = FALSE;
mColorChanged = FALSE;
-
- return LLViewerObject::updateGeometry(drawable);
+
+ return LLViewerObject::updateGeometry(drawable);
}
void LLVOVolume::updateFaceSize(S32 idx)
{
- if( mDrawable->getNumFaces() <= idx )
- {
- return;
- }
-
- LLFace* facep = mDrawable->getFace(idx);
- if (facep)
- {
- if (idx >= getVolume()->getNumVolumeFaces())
- {
- facep->setSize(0,0, true);
- }
- else
- {
- const LLVolumeFace& vol_face = getVolume()->getVolumeFace(idx);
- facep->setSize(vol_face.mNumVertices, vol_face.mNumIndices,
- true); // <--- volume faces should be padded for 16-byte alignment
-
- }
- }
+ if( mDrawable->getNumFaces() <= idx )
+ {
+ return;
+ }
+
+ LLFace* facep = mDrawable->getFace(idx);
+ if (facep)
+ {
+ if (idx >= getVolume()->getNumVolumeFaces())
+ {
+ facep->setSize(0,0, true);
+ }
+ else
+ {
+ const LLVolumeFace& vol_face = getVolume()->getVolumeFace(idx);
+ facep->setSize(vol_face.mNumVertices, vol_face.mNumIndices,
+ true); // <--- volume faces should be padded for 16-byte alignment
+
+ }
+ }
}
BOOL LLVOVolume::isRootEdit() const
{
- if (mParent && !((LLViewerObject*)mParent)->isAvatar())
- {
- return FALSE;
- }
- return TRUE;
+ if (mParent && !((LLViewerObject*)mParent)->isAvatar())
+ {
+ return FALSE;
+ }
+ return TRUE;
}
//virtual
void LLVOVolume::setNumTEs(const U8 num_tes)
{
- const U8 old_num_tes = getNumTEs() ;
-
- if(old_num_tes && old_num_tes < num_tes) //new faces added
- {
- LLViewerObject::setNumTEs(num_tes) ;
-
- if(mMediaImplList.size() >= old_num_tes && mMediaImplList[old_num_tes -1].notNull())//duplicate the last media textures if exists.
- {
- mMediaImplList.resize(num_tes) ;
- const LLTextureEntry* te = getTE(old_num_tes - 1) ;
- for(U8 i = old_num_tes; i < num_tes ; i++)
- {
- setTE(i, *te) ;
- mMediaImplList[i] = mMediaImplList[old_num_tes -1] ;
- }
- mMediaImplList[old_num_tes -1]->setUpdated(TRUE) ;
- }
- }
- else if(old_num_tes > num_tes && mMediaImplList.size() > num_tes) //old faces removed
- {
- U8 end = (U8)(mMediaImplList.size()) ;
- for(U8 i = num_tes; i < end ; i++)
- {
- removeMediaImpl(i) ;
- }
- mMediaImplList.resize(num_tes) ;
-
- LLViewerObject::setNumTEs(num_tes) ;
- }
- else
- {
- LLViewerObject::setNumTEs(num_tes) ;
- }
-
- return ;
+ const U8 old_num_tes = getNumTEs() ;
+
+ if(old_num_tes && old_num_tes < num_tes) //new faces added
+ {
+ LLViewerObject::setNumTEs(num_tes) ;
+
+ if(mMediaImplList.size() >= old_num_tes && mMediaImplList[old_num_tes -1].notNull())//duplicate the last media textures if exists.
+ {
+ mMediaImplList.resize(num_tes) ;
+ const LLTextureEntry* te = getTE(old_num_tes - 1) ;
+ for(U8 i = old_num_tes; i < num_tes ; i++)
+ {
+ setTE(i, *te) ;
+ mMediaImplList[i] = mMediaImplList[old_num_tes -1] ;
+ }
+ mMediaImplList[old_num_tes -1]->setUpdated(TRUE) ;
+ }
+ }
+ else if(old_num_tes > num_tes && mMediaImplList.size() > num_tes) //old faces removed
+ {
+ U8 end = (U8)(mMediaImplList.size()) ;
+ for(U8 i = num_tes; i < end ; i++)
+ {
+ removeMediaImpl(i) ;
+ }
+ mMediaImplList.resize(num_tes) ;
+
+ LLViewerObject::setNumTEs(num_tes) ;
+ }
+ else
+ {
+ LLViewerObject::setNumTEs(num_tes) ;
+ }
+
+ return ;
}
//virtual
void LLVOVolume::changeTEImage(S32 index, LLViewerTexture* imagep)
{
- BOOL changed = (mTEImages[index] != imagep);
- LLViewerObject::changeTEImage(index, imagep);
- if (changed)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
+ BOOL changed = (mTEImages[index] != imagep);
+ LLViewerObject::changeTEImage(index, imagep);
+ if (changed)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
}
void LLVOVolume::setTEImage(const U8 te, LLViewerTexture *imagep)
{
- BOOL changed = (mTEImages[te] != imagep);
- LLViewerObject::setTEImage(te, imagep);
- if (changed)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
+ BOOL changed = (mTEImages[te] != imagep);
+ LLViewerObject::setTEImage(te, imagep);
+ if (changed)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
}
S32 LLVOVolume::setTETexture(const U8 te, const LLUUID &uuid)
{
- S32 res = LLViewerObject::setTETexture(te, uuid);
- if (res)
- {
+ S32 res = LLViewerObject::setTETexture(te, uuid);
+ if (res)
+ {
if (mDrawable)
{
// dynamic texture changes break batches, isolate in octree
shrinkWrap();
gPipeline.markTextured(mDrawable);
}
- mFaceMappingChanged = TRUE;
- }
- return res;
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEColor(const U8 te, const LLColor3& color)
{
- return setTEColor(te, LLColor4(color));
+ return setTEColor(te, LLColor4(color));
}
S32 LLVOVolume::setTEColor(const U8 te, const LLColor4& color)
{
- S32 retval = 0;
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS("MaterialTEs") << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (color != tep->getColor())
- {
- F32 old_alpha = tep->getColor().mV[3];
- if (color.mV[3] != old_alpha)
- {
- gPipeline.markTextured(mDrawable);
- //treat this alpha change as an LoD update since render batches may need to get rebuilt
- mLODChanged = TRUE;
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
- }
- retval = LLPrimitive::setTEColor(te, color);
- if (mDrawable.notNull() && retval)
- {
- // These should only happen on updates which are not the initial update.
+ S32 retval = 0;
+ const LLTextureEntry *tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS("MaterialTEs") << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ }
+ else if (color != tep->getColor())
+ {
+ F32 old_alpha = tep->getColor().mV[3];
+ if (color.mV[3] != old_alpha)
+ {
+ gPipeline.markTextured(mDrawable);
+ //treat this alpha change as an LoD update since render batches may need to get rebuilt
+ mLODChanged = TRUE;
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME);
+ }
+ retval = LLPrimitive::setTEColor(te, color);
+ if (mDrawable.notNull() && retval)
+ {
+ // These should only happen on updates which are not the initial update.
mColorChanged = TRUE;
- mDrawable->setState(LLDrawable::REBUILD_COLOR);
+ mDrawable->setState(LLDrawable::REBUILD_COLOR);
shrinkWrap();
- dirtyMesh();
- }
- }
+ dirtyMesh();
+ }
+ }
- return retval;
+ return retval;
}
S32 LLVOVolume::setTEBumpmap(const U8 te, const U8 bumpmap)
{
- S32 res = LLViewerObject::setTEBumpmap(te, bumpmap);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEBumpmap(te, bumpmap);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTETexGen(const U8 te, const U8 texgen)
{
- S32 res = LLViewerObject::setTETexGen(te, texgen);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTETexGen(te, texgen);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEMediaTexGen(const U8 te, const U8 media)
{
- S32 res = LLViewerObject::setTEMediaTexGen(te, media);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEMediaTexGen(te, media);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEShiny(const U8 te, const U8 shiny)
{
- S32 res = LLViewerObject::setTEShiny(te, shiny);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEShiny(te, shiny);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEFullbright(const U8 te, const U8 fullbright)
{
- S32 res = LLViewerObject::setTEFullbright(te, fullbright);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEFullbright(te, fullbright);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEBumpShinyFullbright(const U8 te, const U8 bump)
{
- S32 res = LLViewerObject::setTEBumpShinyFullbright(te, bump);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEBumpShinyFullbright(te, bump);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEMediaFlags(const U8 te, const U8 media_flags)
{
- S32 res = LLViewerObject::setTEMediaFlags(te, media_flags);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEMediaFlags(te, media_flags);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow)
{
- S32 res = LLViewerObject::setTEGlow(te, glow);
- if (res)
- {
+ S32 res = LLViewerObject::setTEGlow(te, glow);
+ if (res)
+ {
if (mDrawable)
{
gPipeline.markTextured(mDrawable);
shrinkWrap();
}
- mFaceMappingChanged = TRUE;
- }
- return res;
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
void LLVOVolume::setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te)
{
- LLVOVolume* pVol = (LLVOVolume*)gObjectList.findObject(objectID);
- if (pVol)
- {
- LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL;
- if (te >= pVol->getNumTEs())
- return;
+ LLVOVolume* pVol = (LLVOVolume*)gObjectList.findObject(objectID);
+ if (pVol)
+ {
+ LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL;
+ if (te >= pVol->getNumTEs())
+ return;
- LLTextureEntry* texture_entry = pVol->getTE(te);
- if (texture_entry && (texture_entry->getMaterialID() == pMaterialID))
- {
- pVol->setTEMaterialParams(te, pMaterialParams);
- }
- }
+ LLTextureEntry* texture_entry = pVol->getTE(te);
+ if (texture_entry && (texture_entry->getMaterialID() == pMaterialID))
+ {
+ pVol->setTEMaterialParams(te, pMaterialParams);
+ }
+ }
}
S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
{
- S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID);
- LL_DEBUGS("MaterialTEs") << "te "<< (S32)te << " materialid " << pMaterialID.asString() << " res " << res
- << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" )
- << LL_ENDL;
-
- LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL;
- if (res)
- {
- LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, getID(), _1, _2, _3));
-
- setChanged(ALL_CHANGED);
- if (!mDrawable.isNull())
- {
- gPipeline.markTextured(mDrawable);
- gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL);
- }
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID);
+ LL_DEBUGS("MaterialTEs") << "te "<< (S32)te << " materialid " << pMaterialID.asString() << " res " << res
+ << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" )
+ << LL_ENDL;
+
+ LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL;
+ if (res)
+ {
+ LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, getID(), _1, _2, _3));
+
+ setChanged(ALL_CHANGED);
+ if (!mDrawable.isNull())
+ {
+ gPipeline.markTextured(mDrawable);
+ gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL);
+ }
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
{
- S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams);
+ S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams);
- LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res
- << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" )
- << LL_ENDL;
- setChanged(ALL_CHANGED);
- if (!mDrawable.isNull())
- {
- gPipeline.markTextured(mDrawable);
- gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL);
- }
- mFaceMappingChanged = TRUE;
- return TEM_CHANGE_TEXTURE;
+ LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res
+ << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" )
+ << LL_ENDL;
+ setChanged(ALL_CHANGED);
+ if (!mDrawable.isNull())
+ {
+ gPipeline.markTextured(mDrawable);
+ gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL);
+ }
+ mFaceMappingChanged = TRUE;
+ return TEM_CHANGE_TEXTURE;
}
S32 LLVOVolume::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* mat)
@@ -2433,230 +2433,230 @@ S32 LLVOVolume::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* mat)
S32 LLVOVolume::setTEScale(const U8 te, const F32 s, const F32 t)
{
- S32 res = LLViewerObject::setTEScale(te, s, t);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEScale(te, s, t);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEScaleS(const U8 te, const F32 s)
{
- S32 res = LLViewerObject::setTEScaleS(te, s);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEScaleS(te, s);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
S32 LLVOVolume::setTEScaleT(const U8 te, const F32 t)
{
- S32 res = LLViewerObject::setTEScaleT(te, t);
- if (res)
- {
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- return res;
+ S32 res = LLViewerObject::setTEScaleT(te, t);
+ if (res)
+ {
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
bool LLVOVolume::hasMedia() const
{
- bool result = false;
- const U8 numTEs = getNumTEs();
- for (U8 i = 0; i < numTEs; i++)
- {
- const LLTextureEntry* te = getTE(i);
- if(te->hasMedia())
- {
- result = true;
- break;
- }
- }
- return result;
+ bool result = false;
+ const U8 numTEs = getNumTEs();
+ for (U8 i = 0; i < numTEs; i++)
+ {
+ const LLTextureEntry* te = getTE(i);
+ if(te->hasMedia())
+ {
+ result = true;
+ break;
+ }
+ }
+ return result;
}
LLVector3 LLVOVolume::getApproximateFaceNormal(U8 face_id)
{
- LLVolume* volume = getVolume();
- LLVector4a result;
- result.clear();
+ LLVolume* volume = getVolume();
+ LLVector4a result;
+ result.clear();
- LLVector3 ret;
+ LLVector3 ret;
- if (volume && face_id < volume->getNumVolumeFaces())
- {
- const LLVolumeFace& face = volume->getVolumeFace(face_id);
- for (S32 i = 0; i < (S32)face.mNumVertices; ++i)
- {
- result.add(face.mNormals[i]);
- }
+ if (volume && face_id < volume->getNumVolumeFaces())
+ {
+ const LLVolumeFace& face = volume->getVolumeFace(face_id);
+ for (S32 i = 0; i < (S32)face.mNumVertices; ++i)
+ {
+ result.add(face.mNormals[i]);
+ }
+
+ LLVector3 ret(result.getF32ptr());
+ ret = volumeDirectionToAgent(ret);
+ ret.normVec();
+ }
- LLVector3 ret(result.getF32ptr());
- ret = volumeDirectionToAgent(ret);
- ret.normVec();
- }
-
- return ret;
+ return ret;
}
void LLVOVolume::requestMediaDataUpdate(bool isNew)
{
if (sObjectMediaClient)
- sObjectMediaClient->fetchMedia(new LLMediaDataClientObjectImpl(this, isNew));
+ sObjectMediaClient->fetchMedia(new LLMediaDataClientObjectImpl(this, isNew));
}
bool LLVOVolume::isMediaDataBeingFetched() const
{
- // I know what I'm doing by const_casting this away: this is just
- // a wrapper class that is only going to do a lookup.
- return (sObjectMediaClient) ? sObjectMediaClient->isInQueue(new LLMediaDataClientObjectImpl(const_cast<LLVOVolume*>(this), false)) : false;
+ // I know what I'm doing by const_casting this away: this is just
+ // a wrapper class that is only going to do a lookup.
+ return (sObjectMediaClient) ? sObjectMediaClient->isInQueue(new LLMediaDataClientObjectImpl(const_cast<LLVOVolume*>(this), false)) : false;
}
void LLVOVolume::cleanUpMediaImpls()
{
- // Iterate through our TEs and remove any Impls that are no longer used
- const U8 numTEs = getNumTEs();
- for (U8 i = 0; i < numTEs; i++)
- {
- const LLTextureEntry* te = getTE(i);
- if( ! te->hasMedia())
- {
- // Delete the media IMPL!
- removeMediaImpl(i) ;
- }
- }
+ // Iterate through our TEs and remove any Impls that are no longer used
+ const U8 numTEs = getNumTEs();
+ for (U8 i = 0; i < numTEs; i++)
+ {
+ const LLTextureEntry* te = getTE(i);
+ if( ! te->hasMedia())
+ {
+ // Delete the media IMPL!
+ removeMediaImpl(i) ;
+ }
+ }
}
void LLVOVolume::updateObjectMediaData(const LLSD &media_data_array, const std::string &media_version)
{
- // media_data_array is an array of media entry maps
- // media_version is the version string in the response.
- U32 fetched_version = LLTextureEntry::getVersionFromMediaVersionString(media_version);
-
- // Only update it if it is newer!
- if ( (S32)fetched_version > mLastFetchedMediaVersion)
- {
- mLastFetchedMediaVersion = fetched_version;
- //LL_INFOS() << "updating:" << this->getID() << " " << ll_pretty_print_sd(media_data_array) << LL_ENDL;
-
- LLSD::array_const_iterator iter = media_data_array.beginArray();
- LLSD::array_const_iterator end = media_data_array.endArray();
- U8 texture_index = 0;
- for (; iter != end; ++iter, ++texture_index)
- {
- syncMediaData(texture_index, *iter, false/*merge*/, false/*ignore_agent*/);
- }
- }
+ // media_data_array is an array of media entry maps
+ // media_version is the version string in the response.
+ U32 fetched_version = LLTextureEntry::getVersionFromMediaVersionString(media_version);
+
+ // Only update it if it is newer!
+ if ( (S32)fetched_version > mLastFetchedMediaVersion)
+ {
+ mLastFetchedMediaVersion = fetched_version;
+ //LL_INFOS() << "updating:" << this->getID() << " " << ll_pretty_print_sd(media_data_array) << LL_ENDL;
+
+ LLSD::array_const_iterator iter = media_data_array.beginArray();
+ LLSD::array_const_iterator end = media_data_array.endArray();
+ U8 texture_index = 0;
+ for (; iter != end; ++iter, ++texture_index)
+ {
+ syncMediaData(texture_index, *iter, false/*merge*/, false/*ignore_agent*/);
+ }
+ }
}
void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool merge, bool ignore_agent)
{
- if(mDead)
- {
- // If the object has been marked dead, don't process media updates.
- return;
- }
-
- LLTextureEntry *te = getTE(texture_index);
- if(!te)
- {
- return ;
- }
-
- LL_DEBUGS("MediaOnAPrim") << "BEFORE: texture_index = " << texture_index
- << " hasMedia = " << te->hasMedia() << " : "
- << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << LL_ENDL;
-
- std::string previous_url;
- LLMediaEntry* mep = te->getMediaData();
- if(mep)
- {
- // Save the "current url" from before the update so we can tell if
- // it changes.
- previous_url = mep->getCurrentURL();
- }
-
- if (merge)
- {
- te->mergeIntoMediaData(media_data);
- }
- else {
- // XXX Question: what if the media data is undefined LLSD, but the
- // update we got above said that we have media flags?? Here we clobber
- // that, assuming the data from the service is more up-to-date.
- te->updateMediaData(media_data);
- }
-
- mep = te->getMediaData();
- if(mep)
- {
- bool update_from_self = false;
- if (!ignore_agent)
- {
- LLUUID updating_agent = LLTextureEntry::getAgentIDFromMediaVersionString(getMediaURL());
- update_from_self = (updating_agent == gAgent.getID());
- }
- viewer_media_t media_impl = LLViewerMedia::getInstance()->updateMediaImpl(mep, previous_url, update_from_self);
-
- addMediaImpl(media_impl, texture_index) ;
- }
- else
- {
- removeMediaImpl(texture_index);
- }
-
- LL_DEBUGS("MediaOnAPrim") << "AFTER: texture_index = " << texture_index
- << " hasMedia = " << te->hasMedia() << " : "
- << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << LL_ENDL;
+ if(mDead)
+ {
+ // If the object has been marked dead, don't process media updates.
+ return;
+ }
+
+ LLTextureEntry *te = getTE(texture_index);
+ if(!te)
+ {
+ return ;
+ }
+
+ LL_DEBUGS("MediaOnAPrim") << "BEFORE: texture_index = " << texture_index
+ << " hasMedia = " << te->hasMedia() << " : "
+ << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << LL_ENDL;
+
+ std::string previous_url;
+ LLMediaEntry* mep = te->getMediaData();
+ if(mep)
+ {
+ // Save the "current url" from before the update so we can tell if
+ // it changes.
+ previous_url = mep->getCurrentURL();
+ }
+
+ if (merge)
+ {
+ te->mergeIntoMediaData(media_data);
+ }
+ else {
+ // XXX Question: what if the media data is undefined LLSD, but the
+ // update we got above said that we have media flags?? Here we clobber
+ // that, assuming the data from the service is more up-to-date.
+ te->updateMediaData(media_data);
+ }
+
+ mep = te->getMediaData();
+ if(mep)
+ {
+ bool update_from_self = false;
+ if (!ignore_agent)
+ {
+ LLUUID updating_agent = LLTextureEntry::getAgentIDFromMediaVersionString(getMediaURL());
+ update_from_self = (updating_agent == gAgent.getID());
+ }
+ viewer_media_t media_impl = LLViewerMedia::getInstance()->updateMediaImpl(mep, previous_url, update_from_self);
+
+ addMediaImpl(media_impl, texture_index) ;
+ }
+ else
+ {
+ removeMediaImpl(texture_index);
+ }
+
+ LL_DEBUGS("MediaOnAPrim") << "AFTER: texture_index = " << texture_index
+ << " hasMedia = " << te->hasMedia() << " : "
+ << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << LL_ENDL;
}
void LLVOVolume::mediaNavigateBounceBack(U8 texture_index)
{
- // Find the media entry for this navigate
- const LLMediaEntry* mep = NULL;
- viewer_media_t impl = getMediaImpl(texture_index);
- LLTextureEntry *te = getTE(texture_index);
- if(te)
- {
- mep = te->getMediaData();
- }
-
- if (mep && impl)
- {
+ // Find the media entry for this navigate
+ const LLMediaEntry* mep = NULL;
+ viewer_media_t impl = getMediaImpl(texture_index);
+ LLTextureEntry *te = getTE(texture_index);
+ if(te)
+ {
+ mep = te->getMediaData();
+ }
+
+ if (mep && impl)
+ {
std::string url = mep->getCurrentURL();
- // Look for a ":", if not there, assume "http://"
- if (!url.empty() && std::string::npos == url.find(':'))
- {
- url = "http://" + url;
- }
- // If the url we're trying to "bounce back" to is either empty or not
- // allowed by the whitelist, try the home url. If *that* doesn't work,
- // set the media as failed and unload it
+ // Look for a ":", if not there, assume "http://"
+ if (!url.empty() && std::string::npos == url.find(':'))
+ {
+ url = "http://" + url;
+ }
+ // If the url we're trying to "bounce back" to is either empty or not
+ // allowed by the whitelist, try the home url. If *that* doesn't work,
+ // set the media as failed and unload it
if (url.empty() || !mep->checkCandidateUrl(url))
{
url = mep->getHomeURL();
- // Look for a ":", if not there, assume "http://"
- if (!url.empty() && std::string::npos == url.find(':'))
- {
- url = "http://" + url;
- }
+ // Look for a ":", if not there, assume "http://"
+ if (!url.empty() && std::string::npos == url.find(':'))
+ {
+ url = "http://" + url;
+ }
}
if (url.empty() || !mep->checkCandidateUrl(url))
- {
- // The url to navigate back to is not good, and we have nowhere else
- // to go.
- LL_WARNS("MediaOnAPrim") << "FAILED to bounce back URL \"" << url << "\" -- unloading impl" << LL_ENDL;
- impl->setMediaFailed(true);
- }
- // Make sure we are not bouncing to url we came from
- else if (impl->getCurrentMediaURL() != url)
- {
- // Okay, navigate now
+ {
+ // The url to navigate back to is not good, and we have nowhere else
+ // to go.
+ LL_WARNS("MediaOnAPrim") << "FAILED to bounce back URL \"" << url << "\" -- unloading impl" << LL_ENDL;
+ impl->setMediaFailed(true);
+ }
+ // Make sure we are not bouncing to url we came from
+ else if (impl->getCurrentMediaURL() != url)
+ {
+ // Okay, navigate now
LL_INFOS("MediaOnAPrim") << "bouncing back to URL: " << url << LL_ENDL;
impl->navigateTo(url, "", false, true);
}
@@ -2667,153 +2667,153 @@ bool LLVOVolume::hasMediaPermission(const LLMediaEntry* media_entry, MediaPermTy
{
// NOTE: This logic ALMOST duplicates the logic in the server (in particular, in llmediaservice.cpp).
if (NULL == media_entry ) return false; // XXX should we assert here?
-
+
// The agent has permissions if:
// - world permissions are on, or
// - group permissions are on, and agent_id is in the group, or
// - agent permissions are on, and agent_id is the owner
-
- // *NOTE: We *used* to check for modify permissions here (i.e. permissions were
- // granted if permModify() was true). However, this doesn't make sense in the
- // viewer: we don't want to show controls or allow interaction if the author
- // has deemed it so. See DEV-42115.
-
+
+ // *NOTE: We *used* to check for modify permissions here (i.e. permissions were
+ // granted if permModify() was true). However, this doesn't make sense in the
+ // viewer: we don't want to show controls or allow interaction if the author
+ // has deemed it so. See DEV-42115.
+
U8 media_perms = (perm_type == MEDIA_PERM_INTERACT) ? media_entry->getPermsInteract() : media_entry->getPermsControl();
-
+
// World permissions
- if (0 != (media_perms & LLMediaEntry::PERM_ANYONE))
+ if (0 != (media_perms & LLMediaEntry::PERM_ANYONE))
{
return true;
}
-
+
// Group permissions
else if (0 != (media_perms & LLMediaEntry::PERM_GROUP))
{
- LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this);
- if (obj_perm && gAgent.isInGroup(obj_perm->getGroup()))
- {
- return true;
- }
+ LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this);
+ if (obj_perm && gAgent.isInGroup(obj_perm->getGroup()))
+ {
+ return true;
+ }
}
-
+
// Owner permissions
- else if (0 != (media_perms & LLMediaEntry::PERM_OWNER) && permYouOwner())
+ else if (0 != (media_perms & LLMediaEntry::PERM_OWNER) && permYouOwner())
{
return true;
}
-
+
return false;
-
+
}
void LLVOVolume::mediaNavigated(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, std::string new_location)
{
- bool block_navigation = false;
- // FIXME: if/when we allow the same media impl to be used by multiple faces, the logic here will need to be fixed
- // to deal with multiple face indices.
- int face_index = getFaceIndexWithMediaImpl(impl, -1);
-
- // Find the media entry for this navigate
- LLMediaEntry* mep = NULL;
- LLTextureEntry *te = getTE(face_index);
- if(te)
- {
- mep = te->getMediaData();
- }
-
- if(mep)
- {
- if(!mep->checkCandidateUrl(new_location))
- {
- block_navigation = true;
- }
- if (!block_navigation && !hasMediaPermission(mep, MEDIA_PERM_INTERACT))
- {
- block_navigation = true;
- }
- }
- else
- {
- LL_WARNS("MediaOnAPrim") << "Couldn't find media entry!" << LL_ENDL;
- }
-
- if(block_navigation)
- {
- LL_INFOS("MediaOnAPrim") << "blocking navigate to URI " << new_location << LL_ENDL;
-
- // "bounce back" to the current URL from the media entry
- mediaNavigateBounceBack(face_index);
- }
- else if (sObjectMediaNavigateClient)
- {
-
- LL_DEBUGS("MediaOnAPrim") << "broadcasting navigate with URI " << new_location << LL_ENDL;
-
- sObjectMediaNavigateClient->navigate(new LLMediaDataClientObjectImpl(this, false), face_index, new_location);
- }
+ bool block_navigation = false;
+ // FIXME: if/when we allow the same media impl to be used by multiple faces, the logic here will need to be fixed
+ // to deal with multiple face indices.
+ int face_index = getFaceIndexWithMediaImpl(impl, -1);
+
+ // Find the media entry for this navigate
+ LLMediaEntry* mep = NULL;
+ LLTextureEntry *te = getTE(face_index);
+ if(te)
+ {
+ mep = te->getMediaData();
+ }
+
+ if(mep)
+ {
+ if(!mep->checkCandidateUrl(new_location))
+ {
+ block_navigation = true;
+ }
+ if (!block_navigation && !hasMediaPermission(mep, MEDIA_PERM_INTERACT))
+ {
+ block_navigation = true;
+ }
+ }
+ else
+ {
+ LL_WARNS("MediaOnAPrim") << "Couldn't find media entry!" << LL_ENDL;
+ }
+
+ if(block_navigation)
+ {
+ LL_INFOS("MediaOnAPrim") << "blocking navigate to URI " << new_location << LL_ENDL;
+
+ // "bounce back" to the current URL from the media entry
+ mediaNavigateBounceBack(face_index);
+ }
+ else if (sObjectMediaNavigateClient)
+ {
+
+ LL_DEBUGS("MediaOnAPrim") << "broadcasting navigate with URI " << new_location << LL_ENDL;
+
+ sObjectMediaNavigateClient->navigate(new LLMediaDataClientObjectImpl(this, false), face_index, new_location);
+ }
}
void LLVOVolume::mediaEvent(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, LLViewerMediaObserver::EMediaEvent event)
{
- switch(event)
- {
-
- case LLViewerMediaObserver::MEDIA_EVENT_LOCATION_CHANGED:
- {
- switch(impl->getNavState())
- {
- case LLViewerMediaImpl::MEDIANAVSTATE_FIRST_LOCATION_CHANGED:
- {
- // This is the first location changed event after the start of a non-server-directed nav. It may need to be broadcast or bounced back.
- mediaNavigated(impl, plugin, plugin->getLocation());
- }
- break;
-
- case LLViewerMediaImpl::MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS:
- // This navigate didn't change the current URL.
- LL_DEBUGS("MediaOnAPrim") << " NOT broadcasting navigate (spurious)" << LL_ENDL;
- break;
-
- case LLViewerMediaImpl::MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED:
- // This is the first location changed event after the start of a server-directed nav. Don't broadcast it.
- LL_INFOS("MediaOnAPrim") << " NOT broadcasting navigate (server-directed)" << LL_ENDL;
- break;
-
- default:
- // This is a subsequent location-changed due to a redirect. Don't broadcast.
- LL_INFOS("MediaOnAPrim") << " NOT broadcasting navigate (redirect)" << LL_ENDL;
- break;
- }
- }
- break;
-
- case LLViewerMediaObserver::MEDIA_EVENT_NAVIGATE_COMPLETE:
- {
- switch(impl->getNavState())
- {
- case LLViewerMediaImpl::MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED:
- {
- // This is the first location changed event after the start of a non-server-directed nav. It may need to be broadcast or bounced back.
- mediaNavigated(impl, plugin, plugin->getNavigateURI());
- }
- break;
-
- case LLViewerMediaImpl::MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS:
- // This navigate didn't change the current URL.
- LL_DEBUGS("MediaOnAPrim") << " NOT broadcasting navigate (spurious)" << LL_ENDL;
- break;
-
- case LLViewerMediaImpl::MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED:
- // This is the the navigate complete event from a server-directed nav. Don't broadcast it.
- LL_INFOS("MediaOnAPrim") << " NOT broadcasting navigate (server-directed)" << LL_ENDL;
- break;
-
- default:
- // For all other states, the navigate should have been handled by LOCATION_CHANGED events already.
- break;
- }
- }
- break;
+ switch(event)
+ {
+
+ case LLViewerMediaObserver::MEDIA_EVENT_LOCATION_CHANGED:
+ {
+ switch(impl->getNavState())
+ {
+ case LLViewerMediaImpl::MEDIANAVSTATE_FIRST_LOCATION_CHANGED:
+ {
+ // This is the first location changed event after the start of a non-server-directed nav. It may need to be broadcast or bounced back.
+ mediaNavigated(impl, plugin, plugin->getLocation());
+ }
+ break;
+
+ case LLViewerMediaImpl::MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS:
+ // This navigate didn't change the current URL.
+ LL_DEBUGS("MediaOnAPrim") << " NOT broadcasting navigate (spurious)" << LL_ENDL;
+ break;
+
+ case LLViewerMediaImpl::MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED:
+ // This is the first location changed event after the start of a server-directed nav. Don't broadcast it.
+ LL_INFOS("MediaOnAPrim") << " NOT broadcasting navigate (server-directed)" << LL_ENDL;
+ break;
+
+ default:
+ // This is a subsequent location-changed due to a redirect. Don't broadcast.
+ LL_INFOS("MediaOnAPrim") << " NOT broadcasting navigate (redirect)" << LL_ENDL;
+ break;
+ }
+ }
+ break;
+
+ case LLViewerMediaObserver::MEDIA_EVENT_NAVIGATE_COMPLETE:
+ {
+ switch(impl->getNavState())
+ {
+ case LLViewerMediaImpl::MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED:
+ {
+ // This is the first location changed event after the start of a non-server-directed nav. It may need to be broadcast or bounced back.
+ mediaNavigated(impl, plugin, plugin->getNavigateURI());
+ }
+ break;
+
+ case LLViewerMediaImpl::MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS:
+ // This navigate didn't change the current URL.
+ LL_DEBUGS("MediaOnAPrim") << " NOT broadcasting navigate (spurious)" << LL_ENDL;
+ break;
+
+ case LLViewerMediaImpl::MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED:
+ // This is the the navigate complete event from a server-directed nav. Don't broadcast it.
+ LL_INFOS("MediaOnAPrim") << " NOT broadcasting navigate (server-directed)" << LL_ENDL;
+ break;
+
+ default:
+ // For all other states, the navigate should have been handled by LOCATION_CHANGED events already.
+ break;
+ }
+ }
+ break;
case LLViewerMediaObserver::MEDIA_EVENT_FILE_DOWNLOAD:
{
@@ -2825,233 +2825,233 @@ void LLVOVolume::mediaEvent(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin,
LLNotificationsUtil::add("MediaFileDownloadUnsupported");
}
break;
-
- default:
- break;
- }
+
+ default:
+ break;
+ }
}
void LLVOVolume::sendMediaDataUpdate()
{
if (sObjectMediaClient)
- sObjectMediaClient->updateMedia(new LLMediaDataClientObjectImpl(this, false));
+ sObjectMediaClient->updateMedia(new LLMediaDataClientObjectImpl(this, false));
}
void LLVOVolume::removeMediaImpl(S32 texture_index)
{
- if(mMediaImplList.size() <= (U32)texture_index || mMediaImplList[texture_index].isNull())
- {
- return ;
- }
-
- //make the face referencing to mMediaImplList[texture_index] to point back to the old texture.
- if(mDrawable && texture_index < mDrawable->getNumFaces())
- {
- LLFace* facep = mDrawable->getFace(texture_index) ;
- if(facep)
- {
- LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[texture_index]->getMediaTextureID()) ;
- if(media_tex)
- {
- media_tex->removeMediaFromFace(facep) ;
- }
- }
- }
-
- //check if some other face(s) of this object reference(s)to this media impl.
- S32 i ;
- S32 end = (S32)mMediaImplList.size() ;
- for(i = 0; i < end ; i++)
- {
- if( i != texture_index && mMediaImplList[i] == mMediaImplList[texture_index])
- {
- break ;
- }
- }
-
- if(i == end) //this object does not need this media impl.
- {
- mMediaImplList[texture_index]->removeObject(this) ;
- }
-
- mMediaImplList[texture_index] = NULL ;
- return ;
+ if(mMediaImplList.size() <= (U32)texture_index || mMediaImplList[texture_index].isNull())
+ {
+ return ;
+ }
+
+ //make the face referencing to mMediaImplList[texture_index] to point back to the old texture.
+ if(mDrawable && texture_index < mDrawable->getNumFaces())
+ {
+ LLFace* facep = mDrawable->getFace(texture_index) ;
+ if(facep)
+ {
+ LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[texture_index]->getMediaTextureID()) ;
+ if(media_tex)
+ {
+ media_tex->removeMediaFromFace(facep) ;
+ }
+ }
+ }
+
+ //check if some other face(s) of this object reference(s)to this media impl.
+ S32 i ;
+ S32 end = (S32)mMediaImplList.size() ;
+ for(i = 0; i < end ; i++)
+ {
+ if( i != texture_index && mMediaImplList[i] == mMediaImplList[texture_index])
+ {
+ break ;
+ }
+ }
+
+ if(i == end) //this object does not need this media impl.
+ {
+ mMediaImplList[texture_index]->removeObject(this) ;
+ }
+
+ mMediaImplList[texture_index] = NULL ;
+ return ;
}
void LLVOVolume::addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index)
{
- if((S32)mMediaImplList.size() < texture_index + 1)
- {
- mMediaImplList.resize(texture_index + 1) ;
- }
-
- if(mMediaImplList[texture_index].notNull())
- {
- if(mMediaImplList[texture_index] == media_impl)
- {
- return ;
- }
-
- removeMediaImpl(texture_index) ;
- }
-
- mMediaImplList[texture_index] = media_impl;
- media_impl->addObject(this) ;
-
- //add the face to show the media if it is in playing
- if(mDrawable)
- {
- LLFace* facep(NULL);
- if( texture_index < mDrawable->getNumFaces() )
- {
- facep = mDrawable->getFace(texture_index) ;
- }
-
- if(facep)
- {
- LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[texture_index]->getMediaTextureID()) ;
- if(media_tex)
- {
- media_tex->addMediaToFace(facep) ;
- }
- }
- else //the face is not available now, start media on this face later.
- {
- media_impl->setUpdated(TRUE) ;
- }
- }
- return ;
+ if((S32)mMediaImplList.size() < texture_index + 1)
+ {
+ mMediaImplList.resize(texture_index + 1) ;
+ }
+
+ if(mMediaImplList[texture_index].notNull())
+ {
+ if(mMediaImplList[texture_index] == media_impl)
+ {
+ return ;
+ }
+
+ removeMediaImpl(texture_index) ;
+ }
+
+ mMediaImplList[texture_index] = media_impl;
+ media_impl->addObject(this) ;
+
+ //add the face to show the media if it is in playing
+ if(mDrawable)
+ {
+ LLFace* facep(NULL);
+ if( texture_index < mDrawable->getNumFaces() )
+ {
+ facep = mDrawable->getFace(texture_index) ;
+ }
+
+ if(facep)
+ {
+ LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[texture_index]->getMediaTextureID()) ;
+ if(media_tex)
+ {
+ media_tex->addMediaToFace(facep) ;
+ }
+ }
+ else //the face is not available now, start media on this face later.
+ {
+ media_impl->setUpdated(TRUE) ;
+ }
+ }
+ return ;
}
viewer_media_t LLVOVolume::getMediaImpl(U8 face_id) const
{
- if(mMediaImplList.size() > face_id)
- {
- return mMediaImplList[face_id];
- }
- return NULL;
+ if(mMediaImplList.size() > face_id)
+ {
+ return mMediaImplList[face_id];
+ }
+ return NULL;
}
F64 LLVOVolume::getTotalMediaInterest() const
{
- // If this object is currently focused, this object has "high" interest
- if (LLViewerMediaFocus::getInstance()->getFocusedObjectID() == getID())
- return F64_MAX;
-
- F64 interest = (F64)-1.0; // means not interested;
-
- // If this object is selected, this object has "high" interest, but since
- // there can be more than one, we still add in calculated impl interest
- // XXX Sadly, 'contains()' doesn't take a const :(
- if (LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this)))
- interest = F64_MAX / 2.0;
-
- int i = 0;
- const int end = getNumTEs();
- for ( ; i < end; ++i)
- {
- const viewer_media_t &impl = getMediaImpl(i);
- if (!impl.isNull())
- {
- if (interest == (F64)-1.0) interest = (F64)0.0;
- interest += impl->getInterest();
- }
- }
- return interest;
+ // If this object is currently focused, this object has "high" interest
+ if (LLViewerMediaFocus::getInstance()->getFocusedObjectID() == getID())
+ return F64_MAX;
+
+ F64 interest = (F64)-1.0; // means not interested;
+
+ // If this object is selected, this object has "high" interest, but since
+ // there can be more than one, we still add in calculated impl interest
+ // XXX Sadly, 'contains()' doesn't take a const :(
+ if (LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this)))
+ interest = F64_MAX / 2.0;
+
+ int i = 0;
+ const int end = getNumTEs();
+ for ( ; i < end; ++i)
+ {
+ const viewer_media_t &impl = getMediaImpl(i);
+ if (!impl.isNull())
+ {
+ if (interest == (F64)-1.0) interest = (F64)0.0;
+ interest += impl->getInterest();
+ }
+ }
+ return interest;
}
S32 LLVOVolume::getFaceIndexWithMediaImpl(const LLViewerMediaImpl* media_impl, S32 start_face_id)
{
- S32 end = (S32)mMediaImplList.size() ;
- for(S32 face_id = start_face_id + 1; face_id < end; face_id++)
- {
- if(mMediaImplList[face_id] == media_impl)
- {
- return face_id ;
- }
- }
- return -1 ;
+ S32 end = (S32)mMediaImplList.size() ;
+ for(S32 face_id = start_face_id + 1; face_id < end; face_id++)
+ {
+ if(mMediaImplList[face_id] == media_impl)
+ {
+ return face_id ;
+ }
+ }
+ return -1 ;
}
//----------------------------------------------------------------------------
void LLVOVolume::setLightTextureID(LLUUID id)
{
- LLViewerTexture* old_texturep = getLightTexture(); // same as mLightTexture, but inits if nessesary
- if (id.notNull())
- {
- if (!hasLightTexture())
- {
- setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, TRUE, true);
- }
- else if (old_texturep)
- {
- old_texturep->removeVolume(LLRender::LIGHT_TEX, this);
- }
- LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
- if (param_block && param_block->getLightTexture() != id)
- {
- param_block->setLightTexture(id);
- parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
- }
- LLViewerTexture* tex = getLightTexture();
- if (tex)
- {
- tex->addVolume(LLRender::LIGHT_TEX, this); // new texture
- }
- else
- {
- LL_WARNS() << "Can't get light texture for ID " << id.asString() << LL_ENDL;
- }
- }
- else if (hasLightTexture())
- {
- if (old_texturep)
- {
- old_texturep->removeVolume(LLRender::LIGHT_TEX, this);
- }
- setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, FALSE, true);
- parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
- mLightTexture = NULL;
- }
+ LLViewerTexture* old_texturep = getLightTexture(); // same as mLightTexture, but inits if nessesary
+ if (id.notNull())
+ {
+ if (!hasLightTexture())
+ {
+ setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, TRUE, true);
+ }
+ else if (old_texturep)
+ {
+ old_texturep->removeVolume(LLRender::LIGHT_TEX, this);
+ }
+ LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
+ if (param_block && param_block->getLightTexture() != id)
+ {
+ param_block->setLightTexture(id);
+ parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
+ }
+ LLViewerTexture* tex = getLightTexture();
+ if (tex)
+ {
+ tex->addVolume(LLRender::LIGHT_TEX, this); // new texture
+ }
+ else
+ {
+ LL_WARNS() << "Can't get light texture for ID " << id.asString() << LL_ENDL;
+ }
+ }
+ else if (hasLightTexture())
+ {
+ if (old_texturep)
+ {
+ old_texturep->removeVolume(LLRender::LIGHT_TEX, this);
+ }
+ setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, FALSE, true);
+ parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
+ mLightTexture = NULL;
+ }
}
void LLVOVolume::setSpotLightParams(LLVector3 params)
{
- LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
- if (param_block && param_block->getParams() != params)
- {
- param_block->setParams(params);
- parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
- }
+ LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
+ if (param_block && param_block->getParams() != params)
+ {
+ param_block->setParams(params);
+ parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
+ }
}
-
+
void LLVOVolume::setIsLight(BOOL is_light)
{
- BOOL was_light = getIsLight();
- if (is_light != was_light)
- {
- if (is_light)
- {
- setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT, TRUE, true);
- }
- else
- {
- setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT, FALSE, true);
- }
-
- if (is_light)
- {
- // Add it to the pipeline mLightSet
- gPipeline.setLight(mDrawable, TRUE);
- }
- else
- {
- // Not a light. Remove it from the pipeline's light set.
- gPipeline.setLight(mDrawable, FALSE);
- }
- }
+ BOOL was_light = getIsLight();
+ if (is_light != was_light)
+ {
+ if (is_light)
+ {
+ setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT, TRUE, true);
+ }
+ else
+ {
+ setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT, FALSE, true);
+ }
+
+ if (is_light)
+ {
+ // Add it to the pipeline mLightSet
+ gPipeline.setLight(mDrawable, TRUE);
+ }
+ else
+ {
+ // Not a light. Remove it from the pipeline's light set.
+ gPipeline.setLight(mDrawable, FALSE);
+ }
+ }
}
void LLVOVolume::setLightSRGBColor(const LLColor3& color)
@@ -3061,69 +3061,69 @@ void LLVOVolume::setLightSRGBColor(const LLColor3& color)
void LLVOVolume::setLightLinearColor(const LLColor3& color)
{
- LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- if (param_block->getLinearColor() != color)
- {
- param_block->setLinearColor(LLColor4(color, param_block->getLinearColor().mV[3]));
- parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
- }
- }
+ LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ if (param_block->getLinearColor() != color)
+ {
+ param_block->setLinearColor(LLColor4(color, param_block->getLinearColor().mV[3]));
+ parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ }
}
void LLVOVolume::setLightIntensity(F32 intensity)
{
- LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- if (param_block->getLinearColor().mV[3] != intensity)
- {
- param_block->setLinearColor(LLColor4(LLColor3(param_block->getLinearColor()), intensity));
- parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
- }
- }
+ LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ if (param_block->getLinearColor().mV[3] != intensity)
+ {
+ param_block->setLinearColor(LLColor4(LLColor3(param_block->getLinearColor()), intensity));
+ parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
+ }
+ }
}
void LLVOVolume::setLightRadius(F32 radius)
{
- LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- if (param_block->getRadius() != radius)
- {
- param_block->setRadius(radius);
- parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
- }
- }
+ LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ if (param_block->getRadius() != radius)
+ {
+ param_block->setRadius(radius);
+ parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
+ }
+ }
}
void LLVOVolume::setLightFalloff(F32 falloff)
{
- LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- if (param_block->getFalloff() != falloff)
- {
- param_block->setFalloff(falloff);
- parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
- }
- }
+ LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ if (param_block->getFalloff() != falloff)
+ {
+ param_block->setFalloff(falloff);
+ parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
+ }
+ }
}
void LLVOVolume::setLightCutoff(F32 cutoff)
{
- LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- if (param_block->getCutoff() != cutoff)
- {
- param_block->setCutoff(cutoff);
- parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
- }
- }
+ LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ if (param_block->getCutoff() != cutoff)
+ {
+ param_block->setCutoff(cutoff);
+ parameterChanged(LLNetworkData::PARAMS_LIGHT, true);
+ }
+ }
}
//----------------------------------------------------------------------------
@@ -3146,15 +3146,15 @@ LLColor3 LLVOVolume::getLightSRGBBaseColor() const
LLColor3 LLVOVolume::getLightLinearBaseColor() const
{
- const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- return LLColor3(param_block->getLinearColor());
- }
- else
- {
- return LLColor3(1,1,1);
- }
+ const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ return LLColor3(param_block->getLinearColor());
+ }
+ else
+ {
+ return LLColor3(1,1,1);
+ }
}
LLColor3 LLVOVolume::getLightLinearColor() const
@@ -3179,36 +3179,36 @@ LLColor3 LLVOVolume::getLightSRGBColor() const
LLUUID LLVOVolume::getLightTextureID() const
{
- if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
- {
- const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
- if (param_block)
- {
- return param_block->getLightTexture();
- }
- }
-
- return LLUUID::null;
+ if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
+ {
+ const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
+ if (param_block)
+ {
+ return param_block->getLightTexture();
+ }
+ }
+
+ return LLUUID::null;
}
LLVector3 LLVOVolume::getSpotLightParams() const
{
- if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
- {
- const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
- if (param_block)
- {
- return param_block->getParams();
- }
- }
-
- return LLVector3();
+ if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
+ {
+ const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
+ if (param_block)
+ {
+ return param_block->getParams();
+ }
+ }
+
+ return LLVector3();
}
F32 LLVOVolume::getSpotLightPriority() const
{
- return mSpotLightPriority;
+ return mSpotLightPriority;
}
void LLVOVolume::updateSpotLightPriority()
@@ -3219,104 +3219,104 @@ void LLVOVolume::updateSpotLightPriority()
}
F32 r = getLightRadius();
- LLVector3 pos = mDrawable->getPositionAgent();
+ LLVector3 pos = mDrawable->getPositionAgent();
- LLVector3 at(0,0,-1);
- at *= getRenderRotation();
- pos += at * r;
+ LLVector3 at(0,0,-1);
+ at *= getRenderRotation();
+ pos += at * r;
- at = LLViewerCamera::getInstance()->getAtAxis();
- pos -= at * r;
+ at = LLViewerCamera::getInstance()->getAtAxis();
+ pos -= at * r;
- mSpotLightPriority = gPipeline.calcPixelArea(pos, LLVector3(r,r,r), *LLViewerCamera::getInstance());
+ mSpotLightPriority = gPipeline.calcPixelArea(pos, LLVector3(r,r,r), *LLViewerCamera::getInstance());
- if (mLightTexture.notNull())
- {
- mLightTexture->addTextureStats(mSpotLightPriority);
- }
+ if (mLightTexture.notNull())
+ {
+ mLightTexture->addTextureStats(mSpotLightPriority);
+ }
}
bool LLVOVolume::isLightSpotlight() const
{
- LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
- if (params && getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
- {
- return params->isLightSpotlight();
- }
- return false;
+ LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
+ if (params && getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
+ {
+ return params->isLightSpotlight();
+ }
+ return false;
}
LLViewerTexture* LLVOVolume::getLightTexture()
{
- LLUUID id = getLightTextureID();
+ LLUUID id = getLightTextureID();
- if (id.notNull())
- {
- if (mLightTexture.isNull() || id != mLightTexture->getID())
- {
- mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE);
- }
- }
- else
- {
- mLightTexture = NULL;
- }
+ if (id.notNull())
+ {
+ if (mLightTexture.isNull() || id != mLightTexture->getID())
+ {
+ mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE);
+ }
+ }
+ else
+ {
+ mLightTexture = NULL;
+ }
- return mLightTexture;
+ return mLightTexture;
}
F32 LLVOVolume::getLightIntensity() const
{
- const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- return param_block->getLinearColor().mV[3];
- }
- else
- {
- return 1.f;
- }
+ const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ return param_block->getLinearColor().mV[3];
+ }
+ else
+ {
+ return 1.f;
+ }
}
F32 LLVOVolume::getLightRadius() const
{
- const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- return param_block->getRadius();
- }
- else
- {
- return 0.f;
- }
+ const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ return param_block->getRadius();
+ }
+ else
+ {
+ return 0.f;
+ }
}
F32 LLVOVolume::getLightFalloff(const F32 fudge_factor) const
{
- const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- return param_block->getFalloff() * fudge_factor;
- }
- else
- {
- return 0.f;
- }
+ const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ return param_block->getFalloff() * fudge_factor;
+ }
+ else
+ {
+ return 0.f;
+ }
}
F32 LLVOVolume::getLightCutoff() const
{
- const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
- if (param_block)
- {
- return param_block->getCutoff();
- }
- else
- {
- return 0.f;
- }
+ const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ return param_block->getCutoff();
+ }
+ else
+ {
+ return 0.f;
+ }
}
BOOL LLVOVolume::isReflectionProbe() const
@@ -3441,7 +3441,7 @@ bool LLVOVolume::getReflectionProbeIsBox() const
{
return param_block->getIsBox();
}
-
+
return false;
}
@@ -3458,68 +3458,68 @@ bool LLVOVolume::getReflectionProbeIsDynamic() const
U32 LLVOVolume::getVolumeInterfaceID() const
{
- if (mVolumeImpl)
- {
- return mVolumeImpl->getID();
- }
+ if (mVolumeImpl)
+ {
+ return mVolumeImpl->getID();
+ }
- return 0;
+ return 0;
}
BOOL LLVOVolume::isFlexible() const
{
- if (getParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE))
- {
- LLVolume* volume = getVolume();
- if (volume && volume->getParams().getPathParams().getCurveType() != LL_PCODE_PATH_FLEXIBLE)
- {
- LLVolumeParams volume_params = getVolume()->getParams();
- U8 profile_and_hole = volume_params.getProfileParams().getCurveType();
- volume_params.setType(profile_and_hole, LL_PCODE_PATH_FLEXIBLE);
- }
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ if (getParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE))
+ {
+ LLVolume* volume = getVolume();
+ if (volume && volume->getParams().getPathParams().getCurveType() != LL_PCODE_PATH_FLEXIBLE)
+ {
+ LLVolumeParams volume_params = getVolume()->getParams();
+ U8 profile_and_hole = volume_params.getProfileParams().getCurveType();
+ volume_params.setType(profile_and_hole, LL_PCODE_PATH_FLEXIBLE);
+ }
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
BOOL LLVOVolume::isSculpted() const
{
- if (getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT))
- {
- return TRUE;
- }
-
- return FALSE;
+ if (getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT))
+ {
+ return TRUE;
+ }
+
+ return FALSE;
}
BOOL LLVOVolume::isMesh() const
{
- if (isSculpted())
- {
- LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
- U8 sculpt_type = sculpt_params->getSculptType();
+ if (isSculpted())
+ {
+ LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+ U8 sculpt_type = sculpt_params->getSculptType();
- if ((sculpt_type & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
- // mesh is a mesh
- {
- return TRUE;
- }
- }
+ if ((sculpt_type & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
+ // mesh is a mesh
+ {
+ return TRUE;
+ }
+ }
- return FALSE;
+ return FALSE;
}
BOOL LLVOVolume::hasLightTexture() const
{
- if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
- {
- return TRUE;
- }
+ if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
+ {
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
bool LLVOVolume::isFlexibleFast() const
@@ -3549,67 +3549,67 @@ bool LLVOVolume::isAnimatedObjectFast() const
BOOL LLVOVolume::isVolumeGlobal() const
{
- if (mVolumeImpl)
- {
- return mVolumeImpl->isVolumeGlobal() ? TRUE : FALSE;
- }
- else if (mRiggedVolume.notNull())
- {
- return TRUE;
- }
+ if (mVolumeImpl)
+ {
+ return mVolumeImpl->isVolumeGlobal() ? TRUE : FALSE;
+ }
+ else if (mRiggedVolume.notNull())
+ {
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
BOOL LLVOVolume::canBeFlexible() const
{
- U8 path = getVolume()->getParams().getPathParams().getCurveType();
- return (path == LL_PCODE_PATH_FLEXIBLE || path == LL_PCODE_PATH_LINE);
+ U8 path = getVolume()->getParams().getPathParams().getCurveType();
+ return (path == LL_PCODE_PATH_FLEXIBLE || path == LL_PCODE_PATH_LINE);
}
BOOL LLVOVolume::setIsFlexible(BOOL is_flexible)
{
- BOOL res = FALSE;
- BOOL was_flexible = isFlexible();
- LLVolumeParams volume_params;
- if (is_flexible)
- {
- if (!was_flexible)
- {
- volume_params = getVolume()->getParams();
- U8 profile_and_hole = volume_params.getProfileParams().getCurveType();
- volume_params.setType(profile_and_hole, LL_PCODE_PATH_FLEXIBLE);
- res = TRUE;
- setFlags(FLAGS_USE_PHYSICS, FALSE);
- setFlags(FLAGS_PHANTOM, TRUE);
- setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, TRUE, true);
- if (mDrawable)
- {
- mDrawable->makeActive();
- }
- }
- }
- else
- {
- if (was_flexible)
- {
- volume_params = getVolume()->getParams();
- U8 profile_and_hole = volume_params.getProfileParams().getCurveType();
- volume_params.setType(profile_and_hole, LL_PCODE_PATH_LINE);
- res = TRUE;
- setFlags(FLAGS_PHANTOM, FALSE);
- setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, FALSE, true);
- }
- }
- if (res)
- {
- res = setVolume(volume_params, 1);
- if (res)
- {
- markForUpdate();
- }
- }
- return res;
+ BOOL res = FALSE;
+ BOOL was_flexible = isFlexible();
+ LLVolumeParams volume_params;
+ if (is_flexible)
+ {
+ if (!was_flexible)
+ {
+ volume_params = getVolume()->getParams();
+ U8 profile_and_hole = volume_params.getProfileParams().getCurveType();
+ volume_params.setType(profile_and_hole, LL_PCODE_PATH_FLEXIBLE);
+ res = TRUE;
+ setFlags(FLAGS_USE_PHYSICS, FALSE);
+ setFlags(FLAGS_PHANTOM, TRUE);
+ setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, TRUE, true);
+ if (mDrawable)
+ {
+ mDrawable->makeActive();
+ }
+ }
+ }
+ else
+ {
+ if (was_flexible)
+ {
+ volume_params = getVolume()->getParams();
+ U8 profile_and_hole = volume_params.getProfileParams().getCurveType();
+ volume_params.setType(profile_and_hole, LL_PCODE_PATH_LINE);
+ res = TRUE;
+ setFlags(FLAGS_PHANTOM, FALSE);
+ setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, FALSE, true);
+ }
+ }
+ if (res)
+ {
+ res = setVolume(volume_params, 1);
+ if (res)
+ {
+ markForUpdate();
+ }
+ }
+ return res;
}
const LLMeshSkinInfo* LLVOVolume::getSkinInfo() const
@@ -3633,16 +3633,16 @@ BOOL LLVOVolume::isRiggedMesh() const
//----------------------------------------------------------------------------
U32 LLVOVolume::getExtendedMeshFlags() const
{
- const LLExtendedMeshParams *param_block =
+ const LLExtendedMeshParams *param_block =
(const LLExtendedMeshParams *)getParameterEntry(LLNetworkData::PARAMS_EXTENDED_MESH);
- if (param_block)
- {
- return param_block->getFlags();
- }
- else
- {
- return 0;
- }
+ if (param_block)
+ {
+ return param_block->getFlags();
+ }
+ else
+ {
+ return 0;
+ }
}
void LLVOVolume::onSetExtendedMeshFlags(U32 flags)
@@ -3651,7 +3651,7 @@ void LLVOVolume::onSetExtendedMeshFlags(U32 flags)
// The isAnySelected() check was needed at one point to prevent
// graphics problems. These are now believed to be fixed so the
// check has been disabled.
- if (/*!getRootEdit()->isAnySelected() &&*/ mDrawable.notNull())
+ if (/*!getRootEdit()->isAnySelected() &&*/ mDrawable.notNull())
{
// Need to trigger rebuildGeom(), which is where control avatars get created/removed
getRootEdit()->recursiveMarkForUpdate();
@@ -3679,7 +3679,7 @@ void LLVOVolume::setExtendedMeshFlags(U32 flags)
{
bool in_use = true;
setParameterEntryInUse(LLNetworkData::PARAMS_EXTENDED_MESH, in_use, true);
- LLExtendedMeshParams *param_block =
+ LLExtendedMeshParams *param_block =
(LLExtendedMeshParams *)getParameterEntry(LLNetworkData::PARAMS_EXTENDED_MESH);
if (param_block)
{
@@ -3749,13 +3749,13 @@ void LLVOVolume::onReparent(LLViewerObject *old_parent, LLViewerObject *new_pare
void LLVOVolume::afterReparent()
{
{
- LL_DEBUGS("AnimatedObjects") << "new child added for parent "
+ LL_DEBUGS("AnimatedObjects") << "new child added for parent "
<< ((LLViewerObject*)getParent())->getID() << LL_ENDL;
}
-
+
if (isAnimatedObject() && getControlAvatar())
{
- LL_DEBUGS("AnimatedObjects") << "adding attachment overrides, parent is animated object "
+ LL_DEBUGS("AnimatedObjects") << "adding attachment overrides, parent is animated object "
<< ((LLViewerObject*)getParent())->getID() << LL_ENDL;
// MAINT-8239 - doing a full rebuild whenever parent is set
@@ -3763,15 +3763,15 @@ void LLVOVolume::afterReparent()
// addAttachmentOverrides should be sufficient, but in
// practice doing a full rebuild helps compensate for
// notifyMeshLoaded() not being called reliably enough.
-
+
// was: getControlAvatar()->addAttachmentOverridesForObject(this);
//getControlAvatar()->rebuildAttachmentOverrides();
getControlAvatar()->updateAnimations();
}
else
{
- LL_DEBUGS("AnimatedObjects") << "not adding overrides, parent: "
- << ((LLViewerObject*)getParent())->getID()
+ LL_DEBUGS("AnimatedObjects") << "not adding overrides, parent: "
+ << ((LLViewerObject*)getParent())->getID()
<< " isAnimated: " << isAnimatedObject() << " cav "
<< getControlAvatar() << LL_ENDL;
}
@@ -3804,8 +3804,8 @@ void LLVOVolume::updateRiggingInfo()
}
// Keep the highest LOD info available.
mLastRiggingInfoLOD = getLOD();
- LL_DEBUGS("RigSpammish") << "updated rigging info for LLVOVolume "
- << this << " lod " << mLastRiggingInfoLOD
+ LL_DEBUGS("RigSpammish") << "updated rigging info for LLVOVolume "
+ << this << " lod " << mLastRiggingInfoLOD
<< LL_ENDL;
}
}
@@ -3816,86 +3816,86 @@ void LLVOVolume::updateRiggingInfo()
void LLVOVolume::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point)
{
- LLVolume *volume = getVolume();
-
- if (volume)
- {
- LLVector3 view_vector;
- view_vector = view_point;
-
- //transform view vector into volume space
- view_vector -= getRenderPosition();
- //mDrawable->mDistanceWRTCamera = view_vector.length();
- LLQuaternion worldRot = getRenderRotation();
- view_vector = view_vector * ~worldRot;
- if (!isVolumeGlobal())
- {
- LLVector3 objScale = getScale();
- LLVector3 invObjScale(1.f / objScale.mV[VX], 1.f / objScale.mV[VY], 1.f / objScale.mV[VZ]);
- view_vector.scaleVec(invObjScale);
- }
-
- updateRelativeXform();
- LLMatrix4 trans_mat = mRelativeXform;
- if (mDrawable->isStatic())
- {
- trans_mat.translate(getRegion()->getOriginAgent());
- }
-
- volume->generateSilhouetteVertices(nodep->mSilhouetteVertices, nodep->mSilhouetteNormals, view_vector, trans_mat, mRelativeXformInvTrans, nodep->getTESelectMask());
-
- nodep->mSilhouetteExists = TRUE;
- }
+ LLVolume *volume = getVolume();
+
+ if (volume)
+ {
+ LLVector3 view_vector;
+ view_vector = view_point;
+
+ //transform view vector into volume space
+ view_vector -= getRenderPosition();
+ //mDrawable->mDistanceWRTCamera = view_vector.length();
+ LLQuaternion worldRot = getRenderRotation();
+ view_vector = view_vector * ~worldRot;
+ if (!isVolumeGlobal())
+ {
+ LLVector3 objScale = getScale();
+ LLVector3 invObjScale(1.f / objScale.mV[VX], 1.f / objScale.mV[VY], 1.f / objScale.mV[VZ]);
+ view_vector.scaleVec(invObjScale);
+ }
+
+ updateRelativeXform();
+ LLMatrix4 trans_mat = mRelativeXform;
+ if (mDrawable->isStatic())
+ {
+ trans_mat.translate(getRegion()->getOriginAgent());
+ }
+
+ volume->generateSilhouetteVertices(nodep->mSilhouetteVertices, nodep->mSilhouetteNormals, view_vector, trans_mat, mRelativeXformInvTrans, nodep->getTESelectMask());
+
+ nodep->mSilhouetteExists = TRUE;
+ }
}
void LLVOVolume::deleteFaces()
{
- S32 face_count = mNumFaces;
- if (mDrawable.notNull())
- {
- mDrawable->deleteFaces(0, face_count);
- }
+ S32 face_count = mNumFaces;
+ if (mDrawable.notNull())
+ {
+ mDrawable->deleteFaces(0, face_count);
+ }
- mNumFaces = 0;
+ mNumFaces = 0;
}
void LLVOVolume::updateRadius()
{
- if (mDrawable.isNull())
- {
- return;
- }
-
- mVObjRadius = getScale().length();
- mDrawable->setRadius(mVObjRadius);
+ if (mDrawable.isNull())
+ {
+ return;
+ }
+
+ mVObjRadius = getScale().length();
+ mDrawable->setRadius(mVObjRadius);
}
BOOL LLVOVolume::isAttachment() const
{
- return mAttachmentState != 0 ;
+ return mAttachmentState != 0 ;
}
BOOL LLVOVolume::isHUDAttachment() const
{
- // *NOTE: we assume hud attachment points are in defined range
- // since this range is constant for backwards compatibility
- // reasons this is probably a reasonable assumption to make
- S32 attachment_id = ATTACHMENT_ID_FROM_STATE(mAttachmentState);
- return ( attachment_id >= 31 && attachment_id <= 38 );
+ // *NOTE: we assume hud attachment points are in defined range
+ // since this range is constant for backwards compatibility
+ // reasons this is probably a reasonable assumption to make
+ S32 attachment_id = ATTACHMENT_ID_FROM_STATE(mAttachmentState);
+ return ( attachment_id >= 31 && attachment_id <= 38 );
}
const LLMatrix4 LLVOVolume::getRenderMatrix() const
{
- if (mDrawable->isActive() && !mDrawable->isRoot())
- {
- return mDrawable->getParent()->getWorldMatrix();
- }
- return mDrawable->getWorldMatrix();
+ if (mDrawable->isActive() && !mDrawable->isRoot())
+ {
+ return mDrawable->getParent()->getWorldMatrix();
+ }
+ return mDrawable->getWorldMatrix();
}
-//static
+//static
S32 LLVOVolume::getTextureCost(const LLViewerTexture* img)
{
static const U32 ARC_TEXTURE_COST = 16; // multiplier for texture resolution - performance tested
@@ -3937,57 +3937,57 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const
* the official viewer for consideration.
*****************************************************************/
- // Get access to params we'll need at various points.
- // Skip if this is object doesn't have a volume (e.g. is an avatar).
+ // Get access to params we'll need at various points.
+ // Skip if this is object doesn't have a volume (e.g. is an avatar).
if (getVolume() == NULL)
{
return 0;
}
- U32 num_triangles = 0;
+ U32 num_triangles = 0;
- // per-prim costs
- static const U32 ARC_PARTICLE_COST = 1; // determined experimentally
- static const U32 ARC_PARTICLE_MAX = 2048; // default values
- static const U32 ARC_LIGHT_COST = 500; // static cost for light-producing prims
- static const U32 ARC_MEDIA_FACE_COST = 1500; // static cost per media-enabled face
+ // per-prim costs
+ static const U32 ARC_PARTICLE_COST = 1; // determined experimentally
+ static const U32 ARC_PARTICLE_MAX = 2048; // default values
+ static const U32 ARC_LIGHT_COST = 500; // static cost for light-producing prims
+ static const U32 ARC_MEDIA_FACE_COST = 1500; // static cost per media-enabled face
- // per-prim multipliers
- static const F32 ARC_GLOW_MULT = 1.5f; // tested based on performance
- static const F32 ARC_BUMP_MULT = 1.25f; // tested based on performance
- static const F32 ARC_FLEXI_MULT = 5; // tested based on performance
- static const F32 ARC_SHINY_MULT = 1.6f; // tested based on performance
- static const F32 ARC_INVISI_COST = 1.2f; // tested based on performance
- static const F32 ARC_WEIGHTED_MESH = 1.2f; // tested based on performance
+ // per-prim multipliers
+ static const F32 ARC_GLOW_MULT = 1.5f; // tested based on performance
+ static const F32 ARC_BUMP_MULT = 1.25f; // tested based on performance
+ static const F32 ARC_FLEXI_MULT = 5; // tested based on performance
+ static const F32 ARC_SHINY_MULT = 1.6f; // tested based on performance
+ static const F32 ARC_INVISI_COST = 1.2f; // tested based on performance
+ static const F32 ARC_WEIGHTED_MESH = 1.2f; // tested based on performance
- static const F32 ARC_PLANAR_COST = 1.0f; // tested based on performance to have negligible impact
- static const F32 ARC_ANIM_TEX_COST = 4.f; // tested based on performance
- static const F32 ARC_ALPHA_COST = 4.f; // 4x max - based on performance
+ static const F32 ARC_PLANAR_COST = 1.0f; // tested based on performance to have negligible impact
+ static const F32 ARC_ANIM_TEX_COST = 4.f; // tested based on performance
+ static const F32 ARC_ALPHA_COST = 4.f; // 4x max - based on performance
- F32 shame = 0;
+ F32 shame = 0;
- U32 invisi = 0;
- U32 shiny = 0;
- U32 glow = 0;
- U32 alpha = 0;
- U32 flexi = 0;
- U32 animtex = 0;
- U32 particles = 0;
- U32 bump = 0;
- U32 planar = 0;
- U32 weighted_mesh = 0;
- U32 produces_light = 0;
- U32 media_faces = 0;
+ U32 invisi = 0;
+ U32 shiny = 0;
+ U32 glow = 0;
+ U32 alpha = 0;
+ U32 flexi = 0;
+ U32 animtex = 0;
+ U32 particles = 0;
+ U32 bump = 0;
+ U32 planar = 0;
+ U32 weighted_mesh = 0;
+ U32 produces_light = 0;
+ U32 media_faces = 0;
- const LLDrawable* drawablep = mDrawable;
- U32 num_faces = drawablep->getNumFaces();
+ const LLDrawable* drawablep = mDrawable;
+ U32 num_faces = drawablep->getNumFaces();
- const LLVolumeParams& volume_params = getVolume()->getParams();
+ const LLVolumeParams& volume_params = getVolume()->getParams();
LLMeshCostData costs;
- if (getCostData(costs))
- {
+ if (getCostData(costs))
+ {
if (isAnimatedObjectFast() && isRiggedMeshFast())
{
// Scaling here is to make animated object vs
@@ -4000,58 +4000,58 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const
F32 radius = getScale().length()*0.5f;
num_triangles = costs.getRadiusWeightedTris(radius);
}
- }
-
-
- if (num_triangles <= 0)
- {
- num_triangles = 4;
- }
-
- if (isSculptedFast())
- {
- if (isMeshFast())
- {
- // base cost is dependent on mesh complexity
- // note that 3 is the highest LOD as of the time of this coding.
- S32 size = gMeshRepo.getMeshSize(volume_params.getSculptID(), getLOD());
- if ( size > 0)
- {
- if (isRiggedMeshFast())
- {
- // weighted attachment - 1 point for every 3 bytes
- weighted_mesh = 1;
- }
- }
- else
- {
- // something went wrong - user should know their content isn't render-free
- return 0;
- }
- }
- else
- {
+ }
+
+
+ if (num_triangles <= 0)
+ {
+ num_triangles = 4;
+ }
+
+ if (isSculptedFast())
+ {
+ if (isMeshFast())
+ {
+ // base cost is dependent on mesh complexity
+ // note that 3 is the highest LOD as of the time of this coding.
+ S32 size = gMeshRepo.getMeshSize(volume_params.getSculptID(), getLOD());
+ if ( size > 0)
+ {
+ if (isRiggedMeshFast())
+ {
+ // weighted attachment - 1 point for every 3 bytes
+ weighted_mesh = 1;
+ }
+ }
+ else
+ {
+ // something went wrong - user should know their content isn't render-free
+ return 0;
+ }
+ }
+ else
+ {
LLViewerFetchedTexture* texture = mSculptTexture;
- if (texture && textures.find(texture) == textures.end())
- {
+ if (texture && textures.find(texture) == textures.end())
+ {
textures.insert(texture);
- }
- }
- }
+ }
+ }
+ }
- if (isFlexibleFast())
- {
- flexi = 1;
- }
- if (isParticleSource())
- {
- particles = 1;
- }
+ if (isFlexibleFast())
+ {
+ flexi = 1;
+ }
+ if (isParticleSource())
+ {
+ particles = 1;
+ }
- if (getIsLightFast())
- {
- produces_light = 1;
- }
+ if (getIsLightFast())
+ {
+ produces_light = 1;
+ }
{
LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("ARC - face list");
@@ -4109,79 +4109,79 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const
}
}
- // shame currently has the "base" cost of 1 point per 15 triangles, min 2.
- shame = num_triangles * 5.f;
- shame = shame < 2.f ? 2.f : shame;
-
- // multiply by per-face modifiers
- if (planar)
- {
- shame *= planar * ARC_PLANAR_COST;
- }
-
- if (animtex)
- {
- shame *= animtex * ARC_ANIM_TEX_COST;
- }
-
- if (alpha)
- {
- shame *= alpha * ARC_ALPHA_COST;
- }
-
- if(invisi)
- {
- shame *= invisi * ARC_INVISI_COST;
- }
-
- if (glow)
- {
- shame *= glow * ARC_GLOW_MULT;
- }
-
- if (bump)
- {
- shame *= bump * ARC_BUMP_MULT;
- }
-
- if (shiny)
- {
- shame *= shiny * ARC_SHINY_MULT;
- }
-
-
- // multiply shame by multipliers
- if (weighted_mesh)
- {
- shame *= weighted_mesh * ARC_WEIGHTED_MESH;
- }
-
- if (flexi)
- {
- shame *= flexi * ARC_FLEXI_MULT;
- }
-
-
- // add additional costs
- if (particles)
- {
- const LLPartSysData *part_sys_data = &(mPartSourcep->mPartSysData);
- const LLPartData *part_data = &(part_sys_data->mPartData);
- U32 num_particles = (U32)(part_sys_data->mBurstPartCount * llceil( part_data->mMaxAge / part_sys_data->mBurstRate));
- num_particles = num_particles > ARC_PARTICLE_MAX ? ARC_PARTICLE_MAX : num_particles;
- F32 part_size = (llmax(part_data->mStartScale[0], part_data->mEndScale[0]) + llmax(part_data->mStartScale[1], part_data->mEndScale[1])) / 2.f;
- shame += num_particles * part_size * ARC_PARTICLE_COST;
- }
-
- if (produces_light)
- {
- shame += ARC_LIGHT_COST;
- }
-
- if (media_faces)
- {
- shame += media_faces * ARC_MEDIA_FACE_COST;
- }
+ // shame currently has the "base" cost of 1 point per 15 triangles, min 2.
+ shame = num_triangles * 5.f;
+ shame = shame < 2.f ? 2.f : shame;
+
+ // multiply by per-face modifiers
+ if (planar)
+ {
+ shame *= planar * ARC_PLANAR_COST;
+ }
+
+ if (animtex)
+ {
+ shame *= animtex * ARC_ANIM_TEX_COST;
+ }
+
+ if (alpha)
+ {
+ shame *= alpha * ARC_ALPHA_COST;
+ }
+
+ if(invisi)
+ {
+ shame *= invisi * ARC_INVISI_COST;
+ }
+
+ if (glow)
+ {
+ shame *= glow * ARC_GLOW_MULT;
+ }
+
+ if (bump)
+ {
+ shame *= bump * ARC_BUMP_MULT;
+ }
+
+ if (shiny)
+ {
+ shame *= shiny * ARC_SHINY_MULT;
+ }
+
+
+ // multiply shame by multipliers
+ if (weighted_mesh)
+ {
+ shame *= weighted_mesh * ARC_WEIGHTED_MESH;
+ }
+
+ if (flexi)
+ {
+ shame *= flexi * ARC_FLEXI_MULT;
+ }
+
+
+ // add additional costs
+ if (particles)
+ {
+ const LLPartSysData *part_sys_data = &(mPartSourcep->mPartSysData);
+ const LLPartData *part_data = &(part_sys_data->mPartData);
+ U32 num_particles = (U32)(part_sys_data->mBurstPartCount * llceil( part_data->mMaxAge / part_sys_data->mBurstRate));
+ num_particles = num_particles > ARC_PARTICLE_MAX ? ARC_PARTICLE_MAX : num_particles;
+ F32 part_size = (llmax(part_data->mStartScale[0], part_data->mEndScale[0]) + llmax(part_data->mStartScale[1], part_data->mEndScale[1])) / 2.f;
+ shame += num_particles * part_size * ARC_PARTICLE_COST;
+ }
+
+ if (produces_light)
+ {
+ shame += ARC_LIGHT_COST;
+ }
+
+ if (media_faces)
+ {
+ shame += media_faces * ARC_MEDIA_FACE_COST;
+ }
// Streaming cost for animated objects includes a fixed cost
// per linkset. Add a corresponding charge here translated into
@@ -4191,35 +4191,35 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const
shame += (ANIMATED_OBJECT_BASE_COST/0.06) * 5.0f;
}
- if (shame > mRenderComplexity_current)
- {
- mRenderComplexity_current = (S32)shame;
- }
+ if (shame > mRenderComplexity_current)
+ {
+ mRenderComplexity_current = (S32)shame;
+ }
- return (U32)shame;
+ return (U32)shame;
}
F32 LLVOVolume::getEstTrianglesMax() const
{
- if (isMeshFast() && getVolume())
- {
- return gMeshRepo.getEstTrianglesMax(getVolume()->getParams().getSculptID());
- }
+ if (isMeshFast() && getVolume())
+ {
+ return gMeshRepo.getEstTrianglesMax(getVolume()->getParams().getSculptID());
+ }
return 0.f;
}
F32 LLVOVolume::getEstTrianglesStreamingCost() const
{
- if (isMeshFast() && getVolume())
- {
- return gMeshRepo.getEstTrianglesStreamingCost(getVolume()->getParams().getSculptID());
- }
+ if (isMeshFast() && getVolume())
+ {
+ return gMeshRepo.getEstTrianglesStreamingCost(getVolume()->getParams().getSculptID());
+ }
return 0.f;
}
F32 LLVOVolume::getStreamingCost() const
{
- F32 radius = getScale().length()*0.5f;
+ F32 radius = getScale().length()*0.5f;
F32 linkset_base_cost = 0.f;
LLMeshCostData costs;
@@ -4263,87 +4263,87 @@ bool LLVOVolume::getCostData(LLMeshCostData& costs) const
}
else
{
- LLVolume* volume = getVolume();
- S32 counts[4];
- LLVolume::getLoDTriangleCounts(volume->getParams(), counts);
+ LLVolume* volume = getVolume();
+ S32 counts[4];
+ LLVolume::getLoDTriangleCounts(volume->getParams(), counts);
LLMeshHeader header;
- header.mLodSize[0] = counts[0] * 10;
- header.mLodSize[1] = counts[1] * 10;
- header.mLodSize[2] = counts[2] * 10;
- header.mLodSize[3] = counts[3] * 10;
+ header.mLodSize[0] = counts[0] * 10;
+ header.mLodSize[1] = counts[1] * 10;
+ header.mLodSize[2] = counts[2] * 10;
+ header.mLodSize[3] = counts[3] * 10;
- return gMeshRepo.getCostData(header, costs);
+ return gMeshRepo.getCostData(header, costs);
}
}
-//static
+//static
void LLVOVolume::updateRenderComplexity()
{
- mRenderComplexity_last = mRenderComplexity_current;
- mRenderComplexity_current = 0;
+ mRenderComplexity_last = mRenderComplexity_current;
+ mRenderComplexity_current = 0;
}
U32 LLVOVolume::getTriangleCount(S32* vcount) const
{
- U32 count = 0;
- LLVolume* volume = getVolume();
- if (volume)
- {
- count = volume->getNumTriangles(vcount);
- }
+ U32 count = 0;
+ LLVolume* volume = getVolume();
+ if (volume)
+ {
+ count = volume->getNumTriangles(vcount);
+ }
- return count;
+ return count;
}
U32 LLVOVolume::getHighLODTriangleCount()
{
- U32 ret = 0;
-
- LLVolume* volume = getVolume();
-
- if (!isSculpted())
- {
- LLVolume* ref = LLPrimitive::getVolumeManager()->refVolume(volume->getParams(), 3);
- ret = ref->getNumTriangles();
- LLPrimitive::getVolumeManager()->unrefVolume(ref);
- }
- else if (isMesh())
- {
- LLVolume* ref = LLPrimitive::getVolumeManager()->refVolume(volume->getParams(), 3);
- if (!ref->isMeshAssetLoaded() || ref->getNumVolumeFaces() == 0)
- {
- gMeshRepo.loadMesh(this, volume->getParams(), LLModel::LOD_HIGH);
- }
- ret = ref->getNumTriangles();
- LLPrimitive::getVolumeManager()->unrefVolume(ref);
- }
- else
- { //default sculpts have a constant number of triangles
- ret = 31*2*31; //31 rows of 31 columns of quads for a 32x32 vertex patch
- }
-
- return ret;
+ U32 ret = 0;
+
+ LLVolume* volume = getVolume();
+
+ if (!isSculpted())
+ {
+ LLVolume* ref = LLPrimitive::getVolumeManager()->refVolume(volume->getParams(), 3);
+ ret = ref->getNumTriangles();
+ LLPrimitive::getVolumeManager()->unrefVolume(ref);
+ }
+ else if (isMesh())
+ {
+ LLVolume* ref = LLPrimitive::getVolumeManager()->refVolume(volume->getParams(), 3);
+ if (!ref->isMeshAssetLoaded() || ref->getNumVolumeFaces() == 0)
+ {
+ gMeshRepo.loadMesh(this, volume->getParams(), LLModel::LOD_HIGH);
+ }
+ ret = ref->getNumTriangles();
+ LLPrimitive::getVolumeManager()->unrefVolume(ref);
+ }
+ else
+ { //default sculpts have a constant number of triangles
+ ret = 31*2*31; //31 rows of 31 columns of quads for a 32x32 vertex patch
+ }
+
+ return ret;
}
//static
void LLVOVolume::preUpdateGeom()
{
- sNumLODChanges = 0;
+ sNumLODChanges = 0;
}
void LLVOVolume::parameterChanged(U16 param_type, bool local_origin)
{
- LLViewerObject::parameterChanged(param_type, local_origin);
+ LLViewerObject::parameterChanged(param_type, local_origin);
}
void LLVOVolume::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin)
{
- LLViewerObject::parameterChanged(param_type, data, in_use, local_origin);
- if (mVolumeImpl)
- {
- mVolumeImpl->onParameterChanged(param_type, data, in_use, local_origin);
- }
+ LLViewerObject::parameterChanged(param_type, data, in_use, local_origin);
+ if (mVolumeImpl)
+ {
+ mVolumeImpl->onParameterChanged(param_type, data, in_use, local_origin);
+ }
if (!local_origin && param_type == LLNetworkData::PARAMS_EXTENDED_MESH)
{
U32 extended_mesh_flags = getExtendedMeshFlags();
@@ -4359,15 +4359,15 @@ void LLVOVolume::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_u
onSetExtendedMeshFlags(extended_mesh_flags);
}
}
- if (mDrawable.notNull())
- {
- BOOL is_light = getIsLight();
- if (is_light != mDrawable->isState(LLDrawable::LIGHT))
- {
- gPipeline.setLight(mDrawable, is_light);
- }
- }
-
+ if (mDrawable.notNull())
+ {
+ BOOL is_light = getIsLight();
+ if (is_light != mDrawable->isState(LLDrawable::LIGHT))
+ {
+ gPipeline.setLight(mDrawable, is_light);
+ }
+ }
+
updateReflectionProbePtr();
}
@@ -4388,7 +4388,7 @@ void LLVOVolume::updateReflectionProbePtr()
void LLVOVolume::setSelected(BOOL sel)
{
- LLViewerObject::setSelected(sel);
+ LLViewerObject::setSelected(sel);
if (isAnimatedObject())
{
getRootEdit()->recursiveMarkForUpdate();
@@ -4403,7 +4403,7 @@ void LLVOVolume::setSelected(BOOL sel)
}
void LLVOVolume::updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
-{
+{
}
F32 LLVOVolume::getBinRadius()
@@ -4468,104 +4468,104 @@ F32 LLVOVolume::getBinRadius()
const LLVector3 LLVOVolume::getPivotPositionAgent() const
{
- if (mVolumeImpl)
- {
- return mVolumeImpl->getPivotPosition();
- }
- return LLViewerObject::getPivotPositionAgent();
+ if (mVolumeImpl)
+ {
+ return mVolumeImpl->getPivotPosition();
+ }
+ return LLViewerObject::getPivotPositionAgent();
}
void LLVOVolume::onShift(const LLVector4a &shift_vector)
{
- if (mVolumeImpl)
- {
- mVolumeImpl->onShift(shift_vector);
- }
+ if (mVolumeImpl)
+ {
+ mVolumeImpl->onShift(shift_vector);
+ }
- updateRelativeXform();
+ updateRelativeXform();
}
const LLMatrix4& LLVOVolume::getWorldMatrix(LLXformMatrix* xform) const
{
- if (mVolumeImpl)
- {
- return mVolumeImpl->getWorldMatrix(xform);
- }
- return xform->getWorldMatrix();
+ if (mVolumeImpl)
+ {
+ return mVolumeImpl->getWorldMatrix(xform);
+ }
+ return xform->getWorldMatrix();
}
void LLVOVolume::markForUpdate()
-{
+{
if (mDrawable)
{
shrinkWrap();
}
- LLViewerObject::markForUpdate();
- mVolumeChanged = TRUE;
+ LLViewerObject::markForUpdate();
+ mVolumeChanged = TRUE;
}
LLVector3 LLVOVolume::agentPositionToVolume(const LLVector3& pos) const
{
- LLVector3 ret = pos - getRenderPosition();
- ret = ret * ~getRenderRotation();
- if (!isVolumeGlobal())
- {
- LLVector3 objScale = getScale();
- LLVector3 invObjScale(1.f / objScale.mV[VX], 1.f / objScale.mV[VY], 1.f / objScale.mV[VZ]);
- ret.scaleVec(invObjScale);
- }
-
- return ret;
+ LLVector3 ret = pos - getRenderPosition();
+ ret = ret * ~getRenderRotation();
+ if (!isVolumeGlobal())
+ {
+ LLVector3 objScale = getScale();
+ LLVector3 invObjScale(1.f / objScale.mV[VX], 1.f / objScale.mV[VY], 1.f / objScale.mV[VZ]);
+ ret.scaleVec(invObjScale);
+ }
+
+ return ret;
}
LLVector3 LLVOVolume::agentDirectionToVolume(const LLVector3& dir) const
{
- LLVector3 ret = dir * ~getRenderRotation();
-
- LLVector3 objScale = isVolumeGlobal() ? LLVector3(1,1,1) : getScale();
- ret.scaleVec(objScale);
+ LLVector3 ret = dir * ~getRenderRotation();
- return ret;
+ LLVector3 objScale = isVolumeGlobal() ? LLVector3(1,1,1) : getScale();
+ ret.scaleVec(objScale);
+
+ return ret;
}
LLVector3 LLVOVolume::volumePositionToAgent(const LLVector3& dir) const
{
- LLVector3 ret = dir;
- if (!isVolumeGlobal())
- {
- LLVector3 objScale = getScale();
- ret.scaleVec(objScale);
- }
+ LLVector3 ret = dir;
+ if (!isVolumeGlobal())
+ {
+ LLVector3 objScale = getScale();
+ ret.scaleVec(objScale);
+ }
+
+ ret = ret * getRenderRotation();
+ ret += getRenderPosition();
- ret = ret * getRenderRotation();
- ret += getRenderPosition();
-
- return ret;
+ return ret;
}
LLVector3 LLVOVolume::volumeDirectionToAgent(const LLVector3& dir) const
{
- LLVector3 ret = dir;
- LLVector3 objScale = isVolumeGlobal() ? LLVector3(1,1,1) : getScale();
- LLVector3 invObjScale(1.f / objScale.mV[VX], 1.f / objScale.mV[VY], 1.f / objScale.mV[VZ]);
- ret.scaleVec(invObjScale);
- ret = ret * getRenderRotation();
+ LLVector3 ret = dir;
+ LLVector3 objScale = isVolumeGlobal() ? LLVector3(1,1,1) : getScale();
+ LLVector3 invObjScale(1.f / objScale.mV[VX], 1.f / objScale.mV[VY], 1.f / objScale.mV[VZ]);
+ ret.scaleVec(invObjScale);
+ ret = ret * getRenderRotation();
- return ret;
+ return ret;
}
BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_unselectable, S32 *face_hitp,
- LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
-
+ LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
+
{
- if (!mbCanSelect
- || mDrawable->isDead()
- || !gPipeline.hasRenderType(mDrawable->getRenderType()))
- {
- return FALSE;
- }
+ if (!mbCanSelect
+ || mDrawable->isDead()
+ || !gPipeline.hasRenderType(mDrawable->getRenderType()))
+ {
+ return FALSE;
+ }
if (!pick_unselectable)
{
@@ -4580,203 +4580,203 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
return FALSE;
}
- BOOL ret = FALSE;
+ BOOL ret = FALSE;
- LLVolume* volume = getVolume();
+ LLVolume* volume = getVolume();
- bool transform = true;
+ bool transform = true;
- if (mDrawable->isState(LLDrawable::RIGGED))
- {
- if ((pick_rigged) || (getAvatar() && (getAvatar()->isSelf()) && (LLFloater::isVisible(gFloaterTools))))
- {
+ if (mDrawable->isState(LLDrawable::RIGGED))
+ {
+ if ((pick_rigged) || (getAvatar() && (getAvatar()->isSelf()) && (LLFloater::isVisible(gFloaterTools))))
+ {
updateRiggedVolume(true, LLRiggedVolume::DO_NOT_UPDATE_FACES);
- volume = mRiggedVolume;
- transform = false;
- }
- else
- { //cannot pick rigged attachments on other avatars or when not in build mode
- return FALSE;
- }
- }
-
- if (volume)
- {
- LLVector4a local_start = start;
- LLVector4a local_end = end;
-
- if (transform)
- {
- LLVector3 v_start(start.getF32ptr());
- LLVector3 v_end(end.getF32ptr());
-
- v_start = agentPositionToVolume(v_start);
- v_end = agentPositionToVolume(v_end);
-
- local_start.load3(v_start.mV);
- local_end.load3(v_end.mV);
- }
-
- LLVector4a p;
- LLVector4a n;
- LLVector2 tc;
- LLVector4a tn;
-
- if (intersection != NULL)
- {
- p = *intersection;
- }
-
- if (tex_coord != NULL)
- {
- tc = *tex_coord;
- }
-
- if (normal != NULL)
- {
- n = *normal;
- }
-
- if (tangent != NULL)
- {
- tn = *tangent;
- }
-
- S32 face_hit = -1;
-
- S32 start_face, end_face;
- if (face == -1)
- {
- start_face = 0;
- end_face = volume->getNumVolumeFaces();
- }
- else
- {
- start_face = face;
- end_face = face+1;
- }
- pick_transparent |= isHiglightedOrBeacon();
+ volume = mRiggedVolume;
+ transform = false;
+ }
+ else
+ { //cannot pick rigged attachments on other avatars or when not in build mode
+ return FALSE;
+ }
+ }
+
+ if (volume)
+ {
+ LLVector4a local_start = start;
+ LLVector4a local_end = end;
+
+ if (transform)
+ {
+ LLVector3 v_start(start.getF32ptr());
+ LLVector3 v_end(end.getF32ptr());
+
+ v_start = agentPositionToVolume(v_start);
+ v_end = agentPositionToVolume(v_end);
+
+ local_start.load3(v_start.mV);
+ local_end.load3(v_end.mV);
+ }
+
+ LLVector4a p;
+ LLVector4a n;
+ LLVector2 tc;
+ LLVector4a tn;
+
+ if (intersection != NULL)
+ {
+ p = *intersection;
+ }
+
+ if (tex_coord != NULL)
+ {
+ tc = *tex_coord;
+ }
+
+ if (normal != NULL)
+ {
+ n = *normal;
+ }
+
+ if (tangent != NULL)
+ {
+ tn = *tangent;
+ }
+
+ S32 face_hit = -1;
+
+ S32 start_face, end_face;
+ if (face == -1)
+ {
+ start_face = 0;
+ end_face = volume->getNumVolumeFaces();
+ }
+ else
+ {
+ start_face = face;
+ end_face = face+1;
+ }
+ pick_transparent |= isHiglightedOrBeacon();
// we *probably* shouldn't care about special cursor at all, but we *definitely*
// don't care about special cursor for reflection probes -- makes alt-zoom
// go through reflection probes on vehicles
- bool special_cursor = mReflectionProbe.isNull() && specialHoverCursor();
+ bool special_cursor = mReflectionProbe.isNull() && specialHoverCursor();
- for (S32 i = start_face; i < end_face; ++i)
- {
- if (!special_cursor && !pick_transparent && getTE(i) && getTE(i)->getColor().mV[3] == 0.f)
- { //don't attempt to pick completely transparent faces unless
- //pick_transparent is true
- continue;
- }
+ for (S32 i = start_face; i < end_face; ++i)
+ {
+ if (!special_cursor && !pick_transparent && getTE(i) && getTE(i)->getColor().mV[3] == 0.f)
+ { //don't attempt to pick completely transparent faces unless
+ //pick_transparent is true
+ continue;
+ }
// This calculates the bounding box of the skinned mesh from scratch. It's actually quite expensive, but not nearly as expensive as building a full octree.
// rebuild_face_octrees = false because an octree for this face will be built later only if needed for narrow phase picking.
updateRiggedVolume(true, i, false);
- face_hit = volume->lineSegmentIntersect(local_start, local_end, i,
- &p, &tc, &n, &tn);
-
- if (face_hit >= 0 && mDrawable->getNumFaces() > face_hit)
- {
- LLFace* face = mDrawable->getFace(face_hit);
-
- bool ignore_alpha = false;
-
- const LLTextureEntry* te = face->getTextureEntry();
- if (te)
- {
- LLMaterial* mat = te->getMaterialParams();
- if (mat)
- {
- U8 mode = mat->getDiffuseAlphaMode();
-
- if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE
- || mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE
- || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && mat->getAlphaMaskCutoff() == 0))
- {
- ignore_alpha = true;
- }
- }
- }
+ face_hit = volume->lineSegmentIntersect(local_start, local_end, i,
+ &p, &tc, &n, &tn);
+
+ if (face_hit >= 0 && mDrawable->getNumFaces() > face_hit)
+ {
+ LLFace* face = mDrawable->getFace(face_hit);
+
+ bool ignore_alpha = false;
+
+ const LLTextureEntry* te = face->getTextureEntry();
+ if (te)
+ {
+ LLMaterial* mat = te->getMaterialParams();
+ if (mat)
+ {
+ U8 mode = mat->getDiffuseAlphaMode();
+
+ if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE
+ || mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE
+ || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && mat->getAlphaMaskCutoff() == 0))
+ {
+ ignore_alpha = true;
+ }
+ }
+ }
BOOL no_texture = !face->getTexture() || !face->getTexture()->hasGLTexture();
BOOL mask = no_texture ? FALSE : face->getTexture()->getMask(face->surfaceToTexture(tc, p, n));
- if (face &&
- (ignore_alpha || pick_transparent || no_texture || mask))
- {
- local_end = p;
- if (face_hitp != NULL)
- {
- *face_hitp = face_hit;
- }
-
- if (intersection != NULL)
- {
- if (transform)
- {
- LLVector3 v_p(p.getF32ptr());
-
- intersection->load3(volumePositionToAgent(v_p).mV); // must map back to agent space
- }
- else
- {
- *intersection = p;
- }
- }
-
- if (normal != NULL)
- {
- if (transform)
- {
- LLVector3 v_n(n.getF32ptr());
- normal->load3(volumeDirectionToAgent(v_n).mV);
- }
- else
- {
- *normal = n;
- }
- (*normal).normalize3fast();
- }
-
- if (tangent != NULL)
- {
- if (transform)
- {
- LLVector3 v_tn(tn.getF32ptr());
-
- LLVector4a trans_tangent;
- trans_tangent.load3(volumeDirectionToAgent(v_tn).mV);
-
- LLVector4Logical mask;
- mask.clear();
- mask.setElement<3>();
-
- tangent->setSelectWithMask(mask, tn, trans_tangent);
- }
- else
- {
- *tangent = tn;
- }
- (*tangent).normalize3fast();
- }
-
- if (tex_coord != NULL)
- {
- *tex_coord = tc;
- }
-
- ret = TRUE;
- }
- }
- }
- }
-
- return ret;
+ if (face &&
+ (ignore_alpha || pick_transparent || no_texture || mask))
+ {
+ local_end = p;
+ if (face_hitp != NULL)
+ {
+ *face_hitp = face_hit;
+ }
+
+ if (intersection != NULL)
+ {
+ if (transform)
+ {
+ LLVector3 v_p(p.getF32ptr());
+
+ intersection->load3(volumePositionToAgent(v_p).mV); // must map back to agent space
+ }
+ else
+ {
+ *intersection = p;
+ }
+ }
+
+ if (normal != NULL)
+ {
+ if (transform)
+ {
+ LLVector3 v_n(n.getF32ptr());
+ normal->load3(volumeDirectionToAgent(v_n).mV);
+ }
+ else
+ {
+ *normal = n;
+ }
+ (*normal).normalize3fast();
+ }
+
+ if (tangent != NULL)
+ {
+ if (transform)
+ {
+ LLVector3 v_tn(tn.getF32ptr());
+
+ LLVector4a trans_tangent;
+ trans_tangent.load3(volumeDirectionToAgent(v_tn).mV);
+
+ LLVector4Logical mask;
+ mask.clear();
+ mask.setElement<3>();
+
+ tangent->setSelectWithMask(mask, tn, trans_tangent);
+ }
+ else
+ {
+ *tangent = tn;
+ }
+ (*tangent).normalize3fast();
+ }
+
+ if (tex_coord != NULL)
+ {
+ *tex_coord = tc;
+ }
+
+ ret = TRUE;
+ }
+ }
+ }
+ }
+
+ return ret;
}
bool LLVOVolume::treatAsRigged()
{
- return isSelected() &&
+ return isSelected() &&
(isAttachment() || isAnimatedObject()) &&
mDrawable.notNull() &&
mDrawable->isState(LLDrawable::RIGGED);
@@ -4784,52 +4784,52 @@ bool LLVOVolume::treatAsRigged()
LLRiggedVolume* LLVOVolume::getRiggedVolume()
{
- return mRiggedVolume;
+ return mRiggedVolume;
}
void LLVOVolume::clearRiggedVolume()
{
- if (mRiggedVolume.notNull())
- {
- mRiggedVolume = NULL;
- updateRelativeXform();
- }
+ if (mRiggedVolume.notNull())
+ {
+ mRiggedVolume = NULL;
+ updateRelativeXform();
+ }
}
void LLVOVolume::updateRiggedVolume(bool force_treat_as_rigged, LLRiggedVolume::FaceIndex face_index, bool rebuild_face_octrees)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- //Update mRiggedVolume to match current animation frame of avatar.
- //Also update position/size in octree.
+ //Update mRiggedVolume to match current animation frame of avatar.
+ //Also update position/size in octree.
if ((!force_treat_as_rigged) && (!treatAsRigged()))
- {
- clearRiggedVolume();
-
- return;
- }
-
- LLVolume* volume = getVolume();
- const LLMeshSkinInfo* skin = getSkinInfo();
- if (!skin)
- {
- clearRiggedVolume();
- return;
- }
-
- LLVOAvatar* avatar = getAvatar();
- if (!avatar)
- {
- clearRiggedVolume();
- return;
- }
-
- if (!mRiggedVolume)
- {
- LLVolumeParams p;
- mRiggedVolume = new LLRiggedVolume(p);
- updateRelativeXform();
- }
+ {
+ clearRiggedVolume();
+
+ return;
+ }
+
+ LLVolume* volume = getVolume();
+ const LLMeshSkinInfo* skin = getSkinInfo();
+ if (!skin)
+ {
+ clearRiggedVolume();
+ return;
+ }
+
+ LLVOAvatar* avatar = getAvatar();
+ if (!avatar)
+ {
+ clearRiggedVolume();
+ return;
+ }
+
+ if (!mRiggedVolume)
+ {
+ LLVolumeParams p;
+ mRiggedVolume = new LLRiggedVolume(p);
+ updateRelativeXform();
+ }
mRiggedVolume->update(skin, avatar, volume, face_index, rebuild_face_octrees);
}
@@ -4842,47 +4842,47 @@ void LLRiggedVolume::update(
bool rebuild_face_octrees)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- bool copy = false;
- if (volume->getNumVolumeFaces() != getNumVolumeFaces())
- {
- copy = true;
- }
-
- for (S32 i = 0; i < volume->getNumVolumeFaces() && !copy; ++i)
- {
- const LLVolumeFace& src_face = volume->getVolumeFace(i);
- const LLVolumeFace& dst_face = getVolumeFace(i);
-
- if (src_face.mNumIndices != dst_face.mNumIndices ||
- src_face.mNumVertices != dst_face.mNumVertices)
- {
- copy = true;
- }
- }
-
- if (copy)
- {
- copyVolumeFaces(volume);
- }
+ bool copy = false;
+ if (volume->getNumVolumeFaces() != getNumVolumeFaces())
+ {
+ copy = true;
+ }
+
+ for (S32 i = 0; i < volume->getNumVolumeFaces() && !copy; ++i)
+ {
+ const LLVolumeFace& src_face = volume->getVolumeFace(i);
+ const LLVolumeFace& dst_face = getVolumeFace(i);
+
+ if (src_face.mNumIndices != dst_face.mNumIndices ||
+ src_face.mNumVertices != dst_face.mNumVertices)
+ {
+ copy = true;
+ }
+ }
+
+ if (copy)
+ {
+ copyVolumeFaces(volume);
+ }
else
{
bool is_paused = avatar && avatar->areAnimationsPaused();
- if (is_paused)
- {
+ if (is_paused)
+ {
S32 frames_paused = LLFrameTimer::getFrameCount() - avatar->getMotionController().getPausedFrame();
if (frames_paused > 1)
{
return;
}
- }
+ }
}
- //build matrix palette
- static const size_t kMaxJoints = LL_MAX_JOINTS_PER_MESH_OBJECT;
+ //build matrix palette
+ static const size_t kMaxJoints = LL_MAX_JOINTS_PER_MESH_OBJECT;
- LLMatrix4a mat[kMaxJoints];
- U32 maxJoints = LLSkinningUtil::getMeshJointCount(skin);
+ LLMatrix4a mat[kMaxJoints];
+ U32 maxJoints = LLSkinningUtil::getMeshJointCount(skin);
LLSkinningUtil::initSkinningMatrixPalette(mat, maxJoints, skin, avatar);
const LLMatrix4a bind_shape_matrix = skin->mBindShapeMatrix;
@@ -4907,21 +4907,21 @@ void LLRiggedVolume::update(
face_end = face_begin + 1;
}
for (S32 i = face_begin; i < face_end; ++i)
- {
- const LLVolumeFace& vol_face = volume->getVolumeFace(i);
-
- LLVolumeFace& dst_face = mVolumeFaces[i];
-
- LLVector4a* weight = vol_face.mWeights;
-
- if ( weight )
- {
+ {
+ const LLVolumeFace& vol_face = volume->getVolumeFace(i);
+
+ LLVolumeFace& dst_face = mVolumeFaces[i];
+
+ LLVector4a* weight = vol_face.mWeights;
+
+ if ( weight )
+ {
LLSkinningUtil::checkSkinWeights(weight, dst_face.mNumVertices, skin);
- LLVector4a* pos = dst_face.mPositions;
+ LLVector4a* pos = dst_face.mPositions;
- if (pos && dst_face.mExtents)
- {
+ if (pos && dst_face.mExtents)
+ {
U32 max_joints = LLSkinningUtil::getMaxJointCount();
rigged_vert_count += dst_face.mNumVertices;
rigged_face_count++;
@@ -4933,71 +4933,71 @@ void LLRiggedVolume::update(
U8* joint_indices_cursor = vol_face.mJointIndices;
LLVector4a* just_weights = vol_face.mJustWeights;
for (U32 j = 0; j < dst_face.mNumVertices; ++j)
- {
- LLMatrix4a final_mat;
+ {
+ LLMatrix4a final_mat;
F32* w = just_weights[j].getF32ptr();
LLSkinningUtil::getPerVertexSkinMatrixWithIndices(w, joint_indices_cursor, mat, final_mat, src);
joint_indices_cursor += 4;
- LLVector4a& v = vol_face.mPositions[j];
- LLVector4a t;
- LLVector4a dst;
- bind_shape_matrix.affineTransform(v, t);
- final_mat.affineTransform(t, dst);
- pos[j] = dst;
- }
+ LLVector4a& v = vol_face.mPositions[j];
+ LLVector4a t;
+ LLVector4a dst;
+ bind_shape_matrix.affineTransform(v, t);
+ final_mat.affineTransform(t, dst);
+ pos[j] = dst;
+ }
}
else
#endif
{
- for (U32 j = 0; j < dst_face.mNumVertices; ++j)
- {
- LLMatrix4a final_mat;
+ for (U32 j = 0; j < dst_face.mNumVertices; ++j)
+ {
+ LLMatrix4a final_mat;
LLSkinningUtil::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints);
-
- LLVector4a& v = vol_face.mPositions[j];
- LLVector4a t;
- LLVector4a dst;
- bind_shape_matrix.affineTransform(v, t);
- final_mat.affineTransform(t, dst);
- pos[j] = dst;
- }
+
+ LLVector4a& v = vol_face.mPositions[j];
+ LLVector4a t;
+ LLVector4a dst;
+ bind_shape_matrix.affineTransform(v, t);
+ final_mat.affineTransform(t, dst);
+ pos[j] = dst;
+ }
}
- //update bounding box
- // VFExtents change
- LLVector4a& min = dst_face.mExtents[0];
- LLVector4a& max = dst_face.mExtents[1];
+ //update bounding box
+ // VFExtents change
+ LLVector4a& min = dst_face.mExtents[0];
+ LLVector4a& max = dst_face.mExtents[1];
- min = pos[0];
- max = pos[1];
+ min = pos[0];
+ max = pos[1];
if (i==0)
{
box_min = min;
box_max = max;
}
- for (U32 j = 1; j < dst_face.mNumVertices; ++j)
- {
- min.setMin(min, pos[j]);
- max.setMax(max, pos[j]);
- }
+ for (U32 j = 1; j < dst_face.mNumVertices; ++j)
+ {
+ min.setMin(min, pos[j]);
+ max.setMax(max, pos[j]);
+ }
box_min.setMin(min,box_min);
box_max.setMax(max,box_max);
- dst_face.mCenter->setAdd(dst_face.mExtents[0], dst_face.mExtents[1]);
- dst_face.mCenter->mul(0.5f);
+ dst_face.mCenter->setAdd(dst_face.mExtents[0], dst_face.mExtents[1]);
+ dst_face.mCenter->mul(0.5f);
- }
+ }
if (rebuild_face_octrees)
- {
+ {
dst_face.destroyOctree();
dst_face.createOctree();
- }
- }
- }
+ }
+ }
+ }
mExtraDebugText = llformat("rigged %d/%d - box (%f %f %f) (%f %f %f)",
rigged_face_count, rigged_vert_count,
box_min[0], box_min[1], box_min[2],
@@ -5006,111 +5006,111 @@ void LLRiggedVolume::update(
U32 LLVOVolume::getPartitionType() const
{
- if (isHUDAttachment())
- {
- return LLViewerRegion::PARTITION_HUD;
- }
- if (isAnimatedObject() && getControlAvatar())
- {
- return LLViewerRegion::PARTITION_CONTROL_AV;
- }
- if (isAttachment())
- {
- return LLViewerRegion::PARTITION_AVATAR;
- }
+ if (isHUDAttachment())
+ {
+ return LLViewerRegion::PARTITION_HUD;
+ }
+ if (isAnimatedObject() && getControlAvatar())
+ {
+ return LLViewerRegion::PARTITION_CONTROL_AV;
+ }
+ if (isAttachment())
+ {
+ return LLViewerRegion::PARTITION_AVATAR;
+ }
- return LLViewerRegion::PARTITION_VOLUME;
+ return LLViewerRegion::PARTITION_VOLUME;
}
LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp)
: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, regionp),
LLVolumeGeometryManager()
{
- mLODPeriod = 32;
- mDepthMask = FALSE;
- mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
- mPartitionType = LLViewerRegion::PARTITION_VOLUME;
- mSlopRatio = 0.25f;
+ mLODPeriod = 32;
+ mDepthMask = FALSE;
+ mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
+ mPartitionType = LLViewerRegion::PARTITION_VOLUME;
+ mSlopRatio = 0.25f;
}
LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
: LLSpatialBridge(drawablep, TRUE, LLVOVolume::VERTEX_DATA_MASK, regionp),
LLVolumeGeometryManager()
{
- mDepthMask = FALSE;
- mLODPeriod = 32;
- mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
- mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
-
- mSlopRatio = 0.25f;
+ mDepthMask = FALSE;
+ mLODPeriod = 32;
+ mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
+ mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
+
+ mSlopRatio = 0.25f;
}
LLAvatarBridge::LLAvatarBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
- : LLVolumeBridge(drawablep, regionp)
+ : LLVolumeBridge(drawablep, regionp)
{
- mDrawableType = LLPipeline::RENDER_TYPE_AVATAR;
- mPartitionType = LLViewerRegion::PARTITION_AVATAR;
+ mDrawableType = LLPipeline::RENDER_TYPE_AVATAR;
+ mPartitionType = LLViewerRegion::PARTITION_AVATAR;
}
LLControlAVBridge::LLControlAVBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
- : LLVolumeBridge(drawablep, regionp)
+ : LLVolumeBridge(drawablep, regionp)
{
- mDrawableType = LLPipeline::RENDER_TYPE_CONTROL_AV;
- mPartitionType = LLViewerRegion::PARTITION_CONTROL_AV;
+ mDrawableType = LLPipeline::RENDER_TYPE_CONTROL_AV;
+ mPartitionType = LLViewerRegion::PARTITION_CONTROL_AV;
}
void LLControlAVBridge::updateSpatialExtents()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
- LLSpatialGroup* root = (LLSpatialGroup*)mOctree->getListener(0);
+ LLSpatialGroup* root = (LLSpatialGroup*)mOctree->getListener(0);
- bool rootWasDirty = root->isDirty();
+ bool rootWasDirty = root->isDirty();
- super::updateSpatialExtents(); // root becomes non-dirty here
+ super::updateSpatialExtents(); // root becomes non-dirty here
- // SL-18251 "On-screen animesh characters using pelvis offset animations
- // disappear when root goes off-screen"
- //
- // Expand extents to include Control Avatar placed outside of the bounds
+ // SL-18251 "On-screen animesh characters using pelvis offset animations
+ // disappear when root goes off-screen"
+ //
+ // Expand extents to include Control Avatar placed outside of the bounds
LLControlAvatar* controlAvatar = getVObj() ? getVObj()->getControlAvatar() : NULL;
if (controlAvatar
&& controlAvatar->mDrawable
&& controlAvatar->mDrawable->getEntry()
&& (rootWasDirty || controlAvatar->mPlaying))
- {
- root->expandExtents(controlAvatar->mDrawable->getSpatialExtents(), *mDrawable->getXform());
- }
+ {
+ root->expandExtents(controlAvatar->mDrawable->getSpatialExtents(), *mDrawable->getXform());
+ }
}
bool can_batch_texture(LLFace* facep)
{
- if (facep->getTextureEntry()->getBumpmap())
- { //bump maps aren't worked into texture batching yet
- return false;
- }
-
- if (facep->getTextureEntry()->getMaterialParams().notNull())
- { //materials don't work with texture batching yet
- return false;
- }
-
- if (facep->getTexture() && facep->getTexture()->getPrimaryFormat() == GL_ALPHA)
- { //can't batch invisiprims
- return false;
- }
-
- if (facep->isState(LLFace::TEXTURE_ANIM) && facep->getVirtualSize() > MIN_TEX_ANIM_SIZE)
- { //texture animation breaks batches
- return false;
- }
-
+ if (facep->getTextureEntry()->getBumpmap())
+ { //bump maps aren't worked into texture batching yet
+ return false;
+ }
+
+ if (facep->getTextureEntry()->getMaterialParams().notNull())
+ { //materials don't work with texture batching yet
+ return false;
+ }
+
+ if (facep->getTexture() && facep->getTexture()->getPrimaryFormat() == GL_ALPHA)
+ { //can't batch invisiprims
+ return false;
+ }
+
+ if (facep->isState(LLFace::TEXTURE_ANIM) && facep->getVirtualSize() > MIN_TEX_ANIM_SIZE)
+ { //texture animation breaks batches
+ return false;
+ }
+
if (facep->getTextureEntry()->getGLTFRenderMaterial() != nullptr)
{ // PBR materials break indexed texture batching
return false;
}
- return true;
+ return true;
}
const static U32 MAX_FACE_COUNT = 4096U;
@@ -5125,27 +5125,27 @@ LLFace** LLVolumeGeometryManager::sPbrFaces[2] = { NULL };
LLFace** LLVolumeGeometryManager::sAlphaFaces[2] = { NULL };
LLVolumeGeometryManager::LLVolumeGeometryManager()
- : LLGeometryManager()
+ : LLGeometryManager()
{
- llassert(sInstanceCount >= 0);
- if (sInstanceCount == 0)
- {
- allocateFaces(MAX_FACE_COUNT);
- }
+ llassert(sInstanceCount >= 0);
+ if (sInstanceCount == 0)
+ {
+ allocateFaces(MAX_FACE_COUNT);
+ }
- ++sInstanceCount;
+ ++sInstanceCount;
}
LLVolumeGeometryManager::~LLVolumeGeometryManager()
{
- llassert(sInstanceCount > 0);
- --sInstanceCount;
+ llassert(sInstanceCount > 0);
+ --sInstanceCount;
- if (sInstanceCount <= 0)
- {
- freeFaces();
- sInstanceCount = 0;
- }
+ if (sInstanceCount <= 0)
+ {
+ freeFaces();
+ sInstanceCount = 0;
+ }
}
void LLVolumeGeometryManager::allocateFaces(U32 pMaxFaceCount)
@@ -5190,22 +5190,22 @@ void LLVolumeGeometryManager::freeFaces()
void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- if ( type == LLRenderPass::PASS_ALPHA
- && facep->getTextureEntry()->getMaterialParams().notNull()
- && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_TANGENT)
- && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1)
- {
- LL_WARNS_ONCE("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL;
- }
+ if ( type == LLRenderPass::PASS_ALPHA
+ && facep->getTextureEntry()->getMaterialParams().notNull()
+ && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_TANGENT)
+ && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1)
+ {
+ LL_WARNS_ONCE("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL;
+ }
- bool selected = facep->getViewerObject()->isSelected();
+ bool selected = facep->getViewerObject()->isSelected();
- if (selected && LLSelectMgr::getInstance()->mHideSelectedObjects)
- {
- return;
- }
+ if (selected && LLSelectMgr::getInstance()->mHideSelectedObjects)
+ {
+ return;
+ }
- LL_LABEL_VERTEX_BUFFER(facep->getVertexBuffer(), LLRenderPass::lookupPassName(type));
+ LL_LABEL_VERTEX_BUFFER(facep->getVertexBuffer(), LLRenderPass::lookupPassName(type));
U32 passType = type;
@@ -5217,66 +5217,66 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
// See LLRenderPass PASS_foo enum
passType += 1;
}
- //add face to drawmap
- LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[passType];
+ //add face to drawmap
+ LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[passType];
- S32 idx = draw_vec.size()-1;
+ S32 idx = draw_vec.size()-1;
- bool fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) ||
- (type == LLRenderPass::PASS_INVISIBLE) ||
- (type == LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK) ||
- (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)) ||
- (facep->getTextureEntry()->getFullbright());
-
- if (!fullbright &&
- type != LLRenderPass::PASS_GLOW &&
+ bool fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) ||
+ (type == LLRenderPass::PASS_INVISIBLE) ||
+ (type == LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK) ||
+ (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)) ||
+ (facep->getTextureEntry()->getFullbright());
+
+ if (!fullbright &&
+ type != LLRenderPass::PASS_GLOW &&
!facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_NORMAL))
- {
+ {
llassert(false);
- LL_WARNS() << "Non fullbright face has no normals!" << LL_ENDL;
- return;
- }
+ LL_WARNS() << "Non fullbright face has no normals!" << LL_ENDL;
+ return;
+ }
+
+ const LLMatrix4* tex_mat = NULL;
+ if (facep->isState(LLFace::TEXTURE_ANIM) && facep->getVirtualSize() > MIN_TEX_ANIM_SIZE)
+ {
+ tex_mat = facep->mTextureMatrix;
+ }
- const LLMatrix4* tex_mat = NULL;
- if (facep->isState(LLFace::TEXTURE_ANIM) && facep->getVirtualSize() > MIN_TEX_ANIM_SIZE)
- {
- tex_mat = facep->mTextureMatrix;
- }
+ const LLMatrix4* model_mat = NULL;
- const LLMatrix4* model_mat = NULL;
+ LLDrawable* drawable = facep->getDrawable();
- LLDrawable* drawable = facep->getDrawable();
-
if (rigged)
{
// rigged meshes ignore their model matrix
model_mat = nullptr;
}
- else if (drawable->isState(LLDrawable::ANIMATED_CHILD))
- {
- model_mat = &drawable->getWorldMatrix();
- }
- else if (drawable->isActive())
- {
- model_mat = &drawable->getRenderMatrix();
- }
- else
- {
- model_mat = &(drawable->getRegion()->mRenderMatrix);
- }
-
- //drawable->getVObj()->setDebugText(llformat("%d", drawable->isState(LLDrawable::ANIMATED_CHILD)));
+ else if (drawable->isState(LLDrawable::ANIMATED_CHILD))
+ {
+ model_mat = &drawable->getWorldMatrix();
+ }
+ else if (drawable->isActive())
+ {
+ model_mat = &drawable->getRenderMatrix();
+ }
+ else
+ {
+ model_mat = &(drawable->getRegion()->mRenderMatrix);
+ }
+
+ //drawable->getVObj()->setDebugText(llformat("%d", drawable->isState(LLDrawable::ANIMATED_CHILD)));
const LLTextureEntry* te = facep->getTextureEntry();
- U8 bump = (type == LLRenderPass::PASS_BUMP || type == LLRenderPass::PASS_POST_BUMP) ? te->getBumpmap() : 0;
- U8 shiny = te->getShiny();
-
- LLViewerTexture* tex = facep->getTexture();
+ U8 bump = (type == LLRenderPass::PASS_BUMP || type == LLRenderPass::PASS_POST_BUMP) ? te->getBumpmap() : 0;
+ U8 shiny = te->getShiny();
- U8 index = facep->getTextureIndex();
+ LLViewerTexture* tex = facep->getTexture();
+
+ U8 index = facep->getTextureIndex();
LLMaterial* mat = nullptr;
-
+
LLUUID mat_id;
auto* gltf_mat = (LLFetchedGLTFMaterial*)te->getGLTFRenderMaterial();
@@ -5298,110 +5298,110 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
}
}
- bool batchable = false;
-
- U32 shader_mask = 0xFFFFFFFF; //no shader
-
- if (mat)
- {
- BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) || (te->getColor().mV[3] < 0.999f) ? TRUE : FALSE;
- if (type == LLRenderPass::PASS_ALPHA)
- {
- shader_mask = mat->getShaderMask(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND, is_alpha);
- }
- else
- {
- shader_mask = mat->getShaderMask(LLMaterial::DIFFUSE_ALPHA_MODE_DEFAULT, is_alpha);
- }
- }
-
- if (index < FACE_DO_NOT_BATCH_TEXTURES && idx >= 0)
- {
- if (mat || gltf_mat || draw_vec[idx]->mMaterial)
- { //can't batch textures when materials are present (yet)
- batchable = false;
- }
- else if (index < draw_vec[idx]->mTextureList.size())
- {
- if (draw_vec[idx]->mTextureList[index].isNull())
- {
- batchable = true;
- draw_vec[idx]->mTextureList[index] = tex;
- }
- else if (draw_vec[idx]->mTextureList[index] == tex)
- { //this face's texture index can be used with this batch
- batchable = true;
- }
- }
- else
- { //texture list can be expanded to fit this texture index
- batchable = true;
- }
- }
+ bool batchable = false;
+
+ U32 shader_mask = 0xFFFFFFFF; //no shader
+
+ if (mat)
+ {
+ BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) || (te->getColor().mV[3] < 0.999f) ? TRUE : FALSE;
+ if (type == LLRenderPass::PASS_ALPHA)
+ {
+ shader_mask = mat->getShaderMask(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND, is_alpha);
+ }
+ else
+ {
+ shader_mask = mat->getShaderMask(LLMaterial::DIFFUSE_ALPHA_MODE_DEFAULT, is_alpha);
+ }
+ }
+
+ if (index < FACE_DO_NOT_BATCH_TEXTURES && idx >= 0)
+ {
+ if (mat || gltf_mat || draw_vec[idx]->mMaterial)
+ { //can't batch textures when materials are present (yet)
+ batchable = false;
+ }
+ else if (index < draw_vec[idx]->mTextureList.size())
+ {
+ if (draw_vec[idx]->mTextureList[index].isNull())
+ {
+ batchable = true;
+ draw_vec[idx]->mTextureList[index] = tex;
+ }
+ else if (draw_vec[idx]->mTextureList[index] == tex)
+ { //this face's texture index can be used with this batch
+ batchable = true;
+ }
+ }
+ else
+ { //texture list can be expanded to fit this texture index
+ batchable = true;
+ }
+ }
LLDrawInfo* info = idx >= 0 ? draw_vec[idx] : nullptr;
- if (info &&
- info->mVertexBuffer == facep->getVertexBuffer() &&
- info->mEnd == facep->getGeomIndex()-1 &&
- (LLPipeline::sTextureBindTest || draw_vec[idx]->mTexture == tex || batchable) &&
+ if (info &&
+ info->mVertexBuffer == facep->getVertexBuffer() &&
+ info->mEnd == facep->getGeomIndex()-1 &&
+ (LLPipeline::sTextureBindTest || draw_vec[idx]->mTexture == tex || batchable) &&
#if LL_DARWIN
- info->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange &&
- info->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
+ info->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange &&
+ info->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
#endif
- info->mMaterialID == mat_id &&
- info->mFullbright == fullbright &&
- info->mBump == bump &&
- (!mat || (info->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different
- info->mTextureMatrix == tex_mat &&
- info->mModelMatrix == model_mat &&
- info->mShaderMask == shader_mask &&
+ info->mMaterialID == mat_id &&
+ info->mFullbright == fullbright &&
+ info->mBump == bump &&
+ (!mat || (info->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different
+ info->mTextureMatrix == tex_mat &&
+ info->mModelMatrix == model_mat &&
+ info->mShaderMask == shader_mask &&
info->mAvatar == facep->mAvatar &&
info->getSkinHash() == facep->getSkinHash())
- {
- info->mCount += facep->getIndicesCount();
- info->mEnd += facep->getGeomCount();
-
- if (index < FACE_DO_NOT_BATCH_TEXTURES && index >= info->mTextureList.size())
- {
- info->mTextureList.resize(index+1);
- info->mTextureList[index] = tex;
- }
- info->validate();
- }
- else
- {
- U32 start = facep->getGeomIndex();
- U32 end = start + facep->getGeomCount()-1;
- U32 offset = facep->getIndicesStart();
- U32 count = facep->getIndicesCount();
- LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset, tex,
- facep->getVertexBuffer(), fullbright, bump);
+ {
+ info->mCount += facep->getIndicesCount();
+ info->mEnd += facep->getGeomCount();
+
+ if (index < FACE_DO_NOT_BATCH_TEXTURES && index >= info->mTextureList.size())
+ {
+ info->mTextureList.resize(index+1);
+ info->mTextureList[index] = tex;
+ }
+ info->validate();
+ }
+ else
+ {
+ U32 start = facep->getGeomIndex();
+ U32 end = start + facep->getGeomCount()-1;
+ U32 offset = facep->getIndicesStart();
+ U32 count = facep->getIndicesCount();
+ LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset, tex,
+ facep->getVertexBuffer(), fullbright, bump);
info = draw_info;
- draw_vec.push_back(draw_info);
- draw_info->mTextureMatrix = tex_mat;
- draw_info->mModelMatrix = model_mat;
-
- draw_info->mBump = bump;
- draw_info->mShiny = shiny;
-
- static const float alpha[4] =
- {
- 0.00f,
- 0.25f,
- 0.5f,
- 0.75f
- };
- float spec = alpha[shiny & TEM_SHINY_MASK];
- LLVector4 specColor(spec, spec, spec, spec);
- draw_info->mSpecColor = specColor;
- draw_info->mEnvIntensity = spec;
- draw_info->mSpecularMap = NULL;
- draw_info->mMaterial = mat;
+ draw_vec.push_back(draw_info);
+ draw_info->mTextureMatrix = tex_mat;
+ draw_info->mModelMatrix = model_mat;
+
+ draw_info->mBump = bump;
+ draw_info->mShiny = shiny;
+
+ static const float alpha[4] =
+ {
+ 0.00f,
+ 0.25f,
+ 0.5f,
+ 0.75f
+ };
+ float spec = alpha[shiny & TEM_SHINY_MASK];
+ LLVector4 specColor(spec, spec, spec, spec);
+ draw_info->mSpecColor = specColor;
+ draw_info->mEnvIntensity = spec;
+ draw_info->mSpecularMap = NULL;
+ draw_info->mMaterial = mat;
draw_info->mGLTFMaterial = gltf_mat;
- draw_info->mShaderMask = shader_mask;
+ draw_info->mShaderMask = shader_mask;
draw_info->mAvatar = facep->mAvatar;
draw_info->mSkinInfo = facep->mSkinInfo;
@@ -5411,58 +5411,58 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_info->mMaterialID = mat_id;
}
else if (mat)
- {
- draw_info->mMaterialID = mat_id;
-
- // We have a material. Update our draw info accordingly.
-
- if (!mat->getSpecularID().isNull())
- {
- LLVector4 specColor;
- specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f);
- specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f);
- specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f);
- specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f);
- draw_info->mSpecColor = specColor;
- draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f);
- draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset());
- }
-
- draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f);
- draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode();
- draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset());
- }
- else
- {
- if (type == LLRenderPass::PASS_GRASS)
- {
- draw_info->mAlphaMaskCutoff = 0.5f;
- }
- else
- {
- draw_info->mAlphaMaskCutoff = 0.33f;
- }
- }
-
- // if (type == LLRenderPass::PASS_ALPHA) // always populate the draw_info ptr
- { //for alpha sorting
- facep->setDrawInfo(draw_info);
- }
-
- if (index < FACE_DO_NOT_BATCH_TEXTURES)
- { //initialize texture list for texture batching
- draw_info->mTextureList.resize(index+1);
- draw_info->mTextureList[index] = tex;
- }
- draw_info->validate();
- }
+ {
+ draw_info->mMaterialID = mat_id;
+
+ // We have a material. Update our draw info accordingly.
+
+ if (!mat->getSpecularID().isNull())
+ {
+ LLVector4 specColor;
+ specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f);
+ specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f);
+ specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f);
+ specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f);
+ draw_info->mSpecColor = specColor;
+ draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f);
+ draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset());
+ }
+
+ draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f);
+ draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode();
+ draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset());
+ }
+ else
+ {
+ if (type == LLRenderPass::PASS_GRASS)
+ {
+ draw_info->mAlphaMaskCutoff = 0.5f;
+ }
+ else
+ {
+ draw_info->mAlphaMaskCutoff = 0.33f;
+ }
+ }
+
+ // if (type == LLRenderPass::PASS_ALPHA) // always populate the draw_info ptr
+ { //for alpha sorting
+ facep->setDrawInfo(draw_info);
+ }
+
+ if (index < FACE_DO_NOT_BATCH_TEXTURES)
+ { //initialize texture list for texture batching
+ draw_info->mTextureList.resize(index+1);
+ draw_info->mTextureList[index] = tex;
+ }
+ draw_info->validate();
+ }
llassert(info->mGLTFMaterial == nullptr || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TANGENT) != 0);
llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR || info->mGLTFMaterial != nullptr);
llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_RIGGED || info->mGLTFMaterial != nullptr);
llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK || info->mGLTFMaterial != nullptr);
llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK_RIGGED || info->mGLTFMaterial != nullptr);
-
+
llassert(type != LLRenderPass::PASS_BUMP || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TANGENT) != 0);
llassert(type != LLRenderPass::PASS_NORMSPEC || info->mNormalMap.notNull());
llassert(type != LLRenderPass::PASS_SPECMAP || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TEXCOORD2) != 0);
@@ -5505,93 +5505,93 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
return;
}
- if (group->changeLOD())
- {
- group->mLastUpdateDistance = group->mDistance;
- }
+ if (group->changeLOD())
+ {
+ group->mLastUpdateDistance = group->mDistance;
+ }
- group->mLastUpdateViewAngle = group->mViewAngle;
+ group->mLastUpdateViewAngle = group->mViewAngle;
- if (!group->hasState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::ALPHA_DIRTY))
- {
- if (group->hasState(LLSpatialGroup::MESH_DIRTY))
- {
- rebuildMesh(group);
- }
- return;
- }
+ if (!group->hasState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::ALPHA_DIRTY))
+ {
+ if (group->hasState(LLSpatialGroup::MESH_DIRTY))
+ {
+ rebuildMesh(group);
+ }
+ return;
+ }
+
+ group->mBuilt = 1.f;
- group->mBuilt = 1.f;
-
- LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge();
+ LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge();
LLViewerObject *vobj = NULL;
LLVOVolume *vol_obj = NULL;
- if (bridge)
- {
+ if (bridge)
+ {
vobj = bridge->mDrawable->getVObj();
vol_obj = dynamic_cast<LLVOVolume*>(vobj);
- }
+ }
if (vol_obj)
{
vol_obj->updateVisualComplexity();
}
- group->mGeometryBytes = 0;
- group->mSurfaceArea = 0;
-
- //cache object box size since it might be used for determining visibility
- const LLVector4a* bounds = group->getObjectBounds();
- group->mObjectBoxSize = bounds[1].getLength3().getF32();
+ group->mGeometryBytes = 0;
+ group->mSurfaceArea = 0;
- group->clearDrawMap();
+ //cache object box size since it might be used for determining visibility
+ const LLVector4a* bounds = group->getObjectBounds();
+ group->mObjectBoxSize = bounds[1].getLength3().getF32();
+
+ group->clearDrawMap();
U32 fullbright_count[2] = { 0 };
- U32 bump_count[2] = { 0 };
- U32 simple_count[2] = { 0 };
- U32 alpha_count[2] = { 0 };
- U32 norm_count[2] = { 0 };
- U32 spec_count[2] = { 0 };
- U32 normspec_count[2] = { 0 };
- U32 pbr_count[2] = { 0 };
-
- static LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512);
- static LLCachedControl<S32> max_node_size(gSavedSettings, "RenderMaxNodeSize", 65536);
- U32 max_vertices = (max_vbo_size * 1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
- U32 max_total = (max_node_size * 1024) / LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
- max_vertices = llmin(max_vertices, (U32) 65535);
-
- U32 cur_total = 0;
-
- bool emissive = false;
-
- //Determine if we've received skininfo that contains an
- //alternate bind matrix - if it does then apply the translational component
- //to the joints of the avatar.
+ U32 bump_count[2] = { 0 };
+ U32 simple_count[2] = { 0 };
+ U32 alpha_count[2] = { 0 };
+ U32 norm_count[2] = { 0 };
+ U32 spec_count[2] = { 0 };
+ U32 normspec_count[2] = { 0 };
+ U32 pbr_count[2] = { 0 };
+
+ static LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512);
+ static LLCachedControl<S32> max_node_size(gSavedSettings, "RenderMaxNodeSize", 65536);
+ U32 max_vertices = (max_vbo_size * 1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
+ U32 max_total = (max_node_size * 1024) / LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
+ max_vertices = llmin(max_vertices, (U32) 65535);
+
+ U32 cur_total = 0;
+
+ bool emissive = false;
+
+ //Determine if we've received skininfo that contains an
+ //alternate bind matrix - if it does then apply the translational component
+ //to the joints of the avatar.
#if 0
- bool pelvisGotSet = false;
+ bool pelvisGotSet = false;
#endif
- {
+ {
LL_PROFILE_ZONE_NAMED("rebuildGeom - face list");
- //get all the faces into a list
- for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin();
+ //get all the faces into a list
+ for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin();
drawable_iter != group->getDataEnd(); ++drawable_iter)
- {
- LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
-
- if (!drawablep || drawablep->isDead() || drawablep->isState(LLDrawable::FORCE_INVISIBLE) )
- {
- continue;
- }
-
- LLVOVolume* vobj = drawablep->getVOVolume();
-
- if (!vobj || vobj->isDead())
- {
- continue;
- }
+ {
+ LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
+
+ if (!drawablep || drawablep->isDead() || drawablep->isState(LLDrawable::FORCE_INVISIBLE) )
+ {
+ continue;
+ }
+
+ LLVOVolume* vobj = drawablep->getVOVolume();
+
+ if (!vobj || vobj->isDead())
+ {
+ continue;
+ }
// HACK -- brute force this check every time a drawable gets rebuilt
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
@@ -5621,24 +5621,24 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
}
- LLVolume* volume = vobj->getVolume();
- if (volume)
- {
- const LLVector3& scale = vobj->getScale();
- group->mSurfaceArea += volume->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
- }
+ LLVolume* volume = vobj->getVolume();
+ if (volume)
+ {
+ const LLVector3& scale = vobj->getScale();
+ group->mSurfaceArea += volume->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
+ }
+
-
F32 est_tris = vobj->getEstTrianglesMax();
vobj->updateControlAvatar();
-
+
LL_DEBUGS("AnimatedObjectsLinkset") << vobj_name << " rebuilding, isAttachment: " << (U32) vobj->isAttachment()
<< " is_mesh " << is_mesh
<< " est_tris " << est_tris
<< " is_animated " << vobj->isAnimatedObject()
- << " can_animate " << vobj->canBeAnimatedObject()
- << " cav " << vobj->getControlAvatar()
+ << " can_animate " << vobj->canBeAnimatedObject()
+ << " cav " << vobj->getControlAvatar()
<< " lod " << vobj->getLOD()
<< " drawable rigged " << (drawablep->isState(LLDrawable::RIGGED))
<< " drawable state " << drawablep->getState()
@@ -5646,11 +5646,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
<< " frame " << LLFrameTimer::getFrameCount()
<< LL_ENDL;
- llassert_always(vobj);
- vobj->updateTextureVirtualSize(true);
- vobj->preRebuild();
+ llassert_always(vobj);
+ vobj->updateTextureVirtualSize(true);
+ vobj->preRebuild();
- drawablep->clearState(LLDrawable::HAS_ALPHA);
+ drawablep->clearState(LLDrawable::HAS_ALPHA);
LLVOAvatar* avatar = nullptr;
const LLMeshSkinInfo* skinInfo = nullptr;
@@ -5676,23 +5676,23 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
avatar->addAttachmentOverridesForObject(vobj, NULL, false);
}
- // Standard rigged mesh attachments:
- bool rigged = !vobj->isAnimatedObject() && skinInfo && vobj->isAttachment();
+ // Standard rigged mesh attachments:
+ bool rigged = !vobj->isAnimatedObject() && skinInfo && vobj->isAttachment();
// Animated objects. Have to check for isRiggedMesh() to
// exclude static objects in animated object linksets.
- rigged = rigged || (vobj->isAnimatedObject() && vobj->isRiggedMesh() &&
+ rigged = rigged || (vobj->isAnimatedObject() && vobj->isRiggedMesh() &&
vobj->getControlAvatar() && vobj->getControlAvatar()->mPlaying);
- bool any_rigged_face = false;
+ bool any_rigged_face = false;
- //for each face
- for (S32 i = 0; i < drawablep->getNumFaces(); i++)
- {
- LLFace* facep = drawablep->getFace(i);
- if (!facep)
- {
- continue;
- }
+ //for each face
+ for (S32 i = 0; i < drawablep->getNumFaces(); i++)
+ {
+ LLFace* facep = drawablep->getFace(i);
+ if (!facep)
+ {
+ continue;
+ }
#if 0
#if LL_RELEASE_WITH_DEBUG_INFO
const LLUUID pbr_id( "49c88210-7238-2a6b-70ac-92d4f35963cf" );
@@ -5706,12 +5706,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
bool is_pbr = gltf_mat != nullptr;
#endif
- //ALWAYS null out vertex buffer on rebuild -- if the face lands in a render
- // batch, it will recover its vertex buffer reference from the spatial group
- facep->setVertexBuffer(NULL);
-
- //sum up face verts and indices
- drawablep->updateFaceSize(i);
+ //ALWAYS null out vertex buffer on rebuild -- if the face lands in a render
+ // batch, it will recover its vertex buffer reference from the spatial group
+ facep->setVertexBuffer(NULL);
+
+ //sum up face verts and indices
+ drawablep->updateFaceSize(i);
if (rigged)
{
@@ -5728,7 +5728,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
else
{
if (facep->isState(LLFace::RIGGED))
- {
+ {
//face is not rigged but used to be, remove from rigged face pool
LLDrawPoolAvatar* pool = (LLDrawPoolAvatar*)facep->getPool();
if (pool)
@@ -5741,84 +5741,84 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
}
- if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0)
- {
- facep->clearVertexBuffer();
- continue;
- }
+ if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0)
+ {
+ facep->clearVertexBuffer();
+ continue;
+ }
- if (facep->hasGeometry() &&
+ if (facep->hasGeometry() &&
(rigged || // <-- HACK FIXME -- getPixelArea might be incorrect for rigged objects
facep->getPixelArea() > FORCE_CULL_AREA)) // <-- don't render tiny faces
- {
+ {
cur_total += facep->getGeomCount();
- const LLTextureEntry* te = facep->getTextureEntry();
- LLViewerTexture* tex = facep->getTexture();
+ const LLTextureEntry* te = facep->getTextureEntry();
+ LLViewerTexture* tex = facep->getTexture();
- if (te->getGlow() > 0.f)
- {
- emissive = true;
- }
+ if (te->getGlow() > 0.f)
+ {
+ emissive = true;
+ }
- if (facep->isState(LLFace::TEXTURE_ANIM))
- {
- if (!vobj->mTexAnimMode)
- {
- facep->clearState(LLFace::TEXTURE_ANIM);
- }
- }
+ if (facep->isState(LLFace::TEXTURE_ANIM))
+ {
+ if (!vobj->mTexAnimMode)
+ {
+ facep->clearState(LLFace::TEXTURE_ANIM);
+ }
+ }
- BOOL force_simple = (facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA);
- U32 type = gPipeline.getPoolTypeFromTE(te, tex);
+ BOOL force_simple = (facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA);
+ U32 type = gPipeline.getPoolTypeFromTE(te, tex);
if (is_pbr && gltf_mat && gltf_mat->mAlphaMode != LLGLTFMaterial::ALPHA_MODE_BLEND)
{
type = LLDrawPool::POOL_GLTF_PBR;
}
else
- if (type != LLDrawPool::POOL_ALPHA && force_simple)
- {
- type = LLDrawPool::POOL_SIMPLE;
- }
- facep->setPoolType(type);
-
- if (vobj->isHUDAttachment() && !is_pbr)
- {
- facep->setState(LLFace::FULLBRIGHT);
- }
-
- if (vobj->mTextureAnimp && vobj->mTexAnimMode)
- {
- if (vobj->mTextureAnimp->mFace <= -1)
- {
- S32 face;
- for (face = 0; face < vobj->getNumTEs(); face++)
- {
- LLFace * facep = drawablep->getFace(face);
- if (facep)
- {
- facep->setState(LLFace::TEXTURE_ANIM);
- }
- }
- }
- else if (vobj->mTextureAnimp->mFace < vobj->getNumTEs())
- {
- LLFace * facep = drawablep->getFace(vobj->mTextureAnimp->mFace);
- if (facep)
- {
- facep->setState(LLFace::TEXTURE_ANIM);
- }
- }
- }
-
- if (type == LLDrawPool::POOL_ALPHA)
- {
- if (facep->canRenderAsMask())
- { //can be treated as alpha mask
+ if (type != LLDrawPool::POOL_ALPHA && force_simple)
+ {
+ type = LLDrawPool::POOL_SIMPLE;
+ }
+ facep->setPoolType(type);
+
+ if (vobj->isHUDAttachment() && !is_pbr)
+ {
+ facep->setState(LLFace::FULLBRIGHT);
+ }
+
+ if (vobj->mTextureAnimp && vobj->mTexAnimMode)
+ {
+ if (vobj->mTextureAnimp->mFace <= -1)
+ {
+ S32 face;
+ for (face = 0; face < vobj->getNumTEs(); face++)
+ {
+ LLFace * facep = drawablep->getFace(face);
+ if (facep)
+ {
+ facep->setState(LLFace::TEXTURE_ANIM);
+ }
+ }
+ }
+ else if (vobj->mTextureAnimp->mFace < vobj->getNumTEs())
+ {
+ LLFace * facep = drawablep->getFace(vobj->mTextureAnimp->mFace);
+ if (facep)
+ {
+ facep->setState(LLFace::TEXTURE_ANIM);
+ }
+ }
+ }
+
+ if (type == LLDrawPool::POOL_ALPHA)
+ {
+ if (facep->canRenderAsMask())
+ { //can be treated as alpha mask
add_face(sSimpleFaces, simple_count, facep);
- }
- else
- {
+ }
+ else
+ {
F32 alpha;
if (is_pbr)
{
@@ -5829,33 +5829,33 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
alpha = te->getColor().mV[3];
}
if (alpha > 0.f || te->getGlow() > 0.f)
- { //only treat as alpha in the pipeline if < 100% transparent
- drawablep->setState(LLDrawable::HAS_ALPHA);
- add_face(sAlphaFaces, alpha_count, facep);
- }
- else if (LLDrawPoolAlpha::sShowDebugAlpha ||
- (gPipeline.sRenderHighlight && !drawablep->getParent() &&
- //only root objects are highlighted with red color in this case
- drawablep->getVObj() && drawablep->getVObj()->flagScripted() &&
- (LLPipeline::getRenderScriptedBeacons() ||
- (LLPipeline::getRenderScriptedTouchBeacons() && drawablep->getVObj()->flagHandleTouch()))))
- { //draw the transparent face for debugging purposes using a custom texture
- add_face(sAlphaFaces, alpha_count, facep);
- }
- }
- }
- else
- {
- if (drawablep->isState(LLDrawable::REBUILD_VOLUME))
- {
- facep->mLastUpdateTime = gFrameTimeSeconds;
- }
-
- {
+ { //only treat as alpha in the pipeline if < 100% transparent
+ drawablep->setState(LLDrawable::HAS_ALPHA);
+ add_face(sAlphaFaces, alpha_count, facep);
+ }
+ else if (LLDrawPoolAlpha::sShowDebugAlpha ||
+ (gPipeline.sRenderHighlight && !drawablep->getParent() &&
+ //only root objects are highlighted with red color in this case
+ drawablep->getVObj() && drawablep->getVObj()->flagScripted() &&
+ (LLPipeline::getRenderScriptedBeacons() ||
+ (LLPipeline::getRenderScriptedTouchBeacons() && drawablep->getVObj()->flagHandleTouch()))))
+ { //draw the transparent face for debugging purposes using a custom texture
+ add_face(sAlphaFaces, alpha_count, facep);
+ }
+ }
+ }
+ else
+ {
+ if (drawablep->isState(LLDrawable::REBUILD_VOLUME))
+ {
+ facep->mLastUpdateTime = gFrameTimeSeconds;
+ }
+
+ {
LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial();
- if (gltf_mat != nullptr || (te->getMaterialParams().notNull()))
- {
+ if (gltf_mat != nullptr || (te->getMaterialParams().notNull()))
+ {
if (gltf_mat != nullptr)
{
add_face(sPbrFaces, pbr_count, facep);
@@ -5884,91 +5884,91 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
add_face(sSimpleFaces, simple_count, facep);
}
}
- }
- else if (te->getBumpmap())
- { //needs normal + tangent
+ }
+ else if (te->getBumpmap())
+ { //needs normal + tangent
add_face(sBumpFaces, bump_count, facep);
- }
- else if (te->getShiny() || !te->getFullbright())
- { //needs normal
+ }
+ else if (te->getShiny() || !te->getFullbright())
+ { //needs normal
add_face(sSimpleFaces, simple_count, facep);
- }
- else
- { //doesn't need normal
- facep->setState(LLFace::FULLBRIGHT);
+ }
+ else
+ { //doesn't need normal
+ facep->setState(LLFace::FULLBRIGHT);
add_face(sFullbrightFaces, fullbright_count, facep);
- }
- }
- }
- }
- else
- { //face has no renderable geometry
- facep->clearVertexBuffer();
- }
- }
-
- if (any_rigged_face)
- {
- if (!drawablep->isState(LLDrawable::RIGGED))
- {
- drawablep->setState(LLDrawable::RIGGED);
+ }
+ }
+ }
+ }
+ else
+ { //face has no renderable geometry
+ facep->clearVertexBuffer();
+ }
+ }
+
+ if (any_rigged_face)
+ {
+ if (!drawablep->isState(LLDrawable::RIGGED))
+ {
+ drawablep->setState(LLDrawable::RIGGED);
LLDrawable* root = drawablep->getRoot();
if (root != drawablep)
{
root->setState(LLDrawable::RIGGED_CHILD);
}
- //first time this is drawable is being marked as rigged,
- // do another LoD update to use avatar bounding box
- vobj->updateLOD();
- }
- }
- else
- {
- drawablep->clearState(LLDrawable::RIGGED);
+ //first time this is drawable is being marked as rigged,
+ // do another LoD update to use avatar bounding box
+ vobj->updateLOD();
+ }
+ }
+ else
+ {
+ drawablep->clearState(LLDrawable::RIGGED);
vobj->updateRiggedVolume(false);
- }
- }
- }
-
- //PROCESS NON-ALPHA FACES
- U32 simple_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
- U32 alpha_mask = simple_mask | 0x80000000; //hack to give alpha verts their own VBO
- U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
- U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
-
- U32 norm_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TANGENT;
- U32 normspec_mask = norm_mask | LLVertexBuffer::MAP_TEXCOORD2;
- U32 spec_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD2;
-
- U32 pbr_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TANGENT;
-
- if (emissive)
- { //emissive faces are present, include emissive byte to preserve batching
- simple_mask = simple_mask | LLVertexBuffer::MAP_EMISSIVE;
- alpha_mask = alpha_mask | LLVertexBuffer::MAP_EMISSIVE;
- bump_mask = bump_mask | LLVertexBuffer::MAP_EMISSIVE;
- fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_EMISSIVE;
- norm_mask = norm_mask | LLVertexBuffer::MAP_EMISSIVE;
- normspec_mask = normspec_mask | LLVertexBuffer::MAP_EMISSIVE;
- spec_mask = spec_mask | LLVertexBuffer::MAP_EMISSIVE;
+ }
+ }
+ }
+
+ //PROCESS NON-ALPHA FACES
+ U32 simple_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
+ U32 alpha_mask = simple_mask | 0x80000000; //hack to give alpha verts their own VBO
+ U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
+ U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
+
+ U32 norm_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TANGENT;
+ U32 normspec_mask = norm_mask | LLVertexBuffer::MAP_TEXCOORD2;
+ U32 spec_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD2;
+
+ U32 pbr_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TANGENT;
+
+ if (emissive)
+ { //emissive faces are present, include emissive byte to preserve batching
+ simple_mask = simple_mask | LLVertexBuffer::MAP_EMISSIVE;
+ alpha_mask = alpha_mask | LLVertexBuffer::MAP_EMISSIVE;
+ bump_mask = bump_mask | LLVertexBuffer::MAP_EMISSIVE;
+ fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_EMISSIVE;
+ norm_mask = norm_mask | LLVertexBuffer::MAP_EMISSIVE;
+ normspec_mask = normspec_mask | LLVertexBuffer::MAP_EMISSIVE;
+ spec_mask = spec_mask | LLVertexBuffer::MAP_EMISSIVE;
pbr_mask = pbr_mask | LLVertexBuffer::MAP_EMISSIVE;
- }
+ }
- BOOL batch_textures = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1;
+ BOOL batch_textures = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1;
// add extra vertex data for deferred rendering (not necessarily for batching textures)
- if (batch_textures)
- {
- bump_mask = bump_mask | LLVertexBuffer::MAP_TANGENT;
- simple_mask = simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX;
- alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2;
- fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX;
- }
+ if (batch_textures)
+ {
+ bump_mask = bump_mask | LLVertexBuffer::MAP_TANGENT;
+ simple_mask = simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX;
+ alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2;
+ fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX;
+ }
- group->mGeometryBytes = 0;
+ group->mGeometryBytes = 0;
- U32 geometryBytes = 0;
+ U32 geometryBytes = 0;
// generate render batches for static geometry
U32 extra_mask = LLVertexBuffer::MAP_TEXTURE_INDEX;
@@ -5990,70 +5990,70 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
rigged = TRUE;
}
- group->mGeometryBytes = geometryBytes;
+ group->mGeometryBytes = geometryBytes;
- {
- //drawables have been rebuilt, clear rebuild status
- for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
- {
- LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
- if(drawablep)
- {
+ {
+ //drawables have been rebuilt, clear rebuild status
+ for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
+ {
+ LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
+ if(drawablep)
+ {
drawablep->clearState(LLDrawable::REBUILD_ALL);
}
}
- }
+ }
- group->mLastUpdateTime = gFrameTimeSeconds;
- group->mBuilt = 1.f;
- group->clearState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::ALPHA_DIRTY);
+ group->mLastUpdateTime = gFrameTimeSeconds;
+ group->mBuilt = 1.f;
+ group->clearState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::ALPHA_DIRTY);
}
void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- llassert(group);
- if (group && group->hasState(LLSpatialGroup::MESH_DIRTY) && !group->hasState(LLSpatialGroup::GEOM_DIRTY))
- {
- {
+ llassert(group);
+ if (group && group->hasState(LLSpatialGroup::MESH_DIRTY) && !group->hasState(LLSpatialGroup::GEOM_DIRTY))
+ {
+ {
LL_PROFILE_ZONE_NAMED("rebuildMesh - gen draw info");
group->mBuilt = 1.f;
-
- const U32 MAX_BUFFER_COUNT = 4096;
- LLVertexBuffer* locked_buffer[MAX_BUFFER_COUNT];
- U32 buffer_count = 0;
+ const U32 MAX_BUFFER_COUNT = 4096;
+ LLVertexBuffer* locked_buffer[MAX_BUFFER_COUNT];
+
+ U32 buffer_count = 0;
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
- {
- LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
-
- if (drawablep && !drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL))
- {
- LLVOVolume* vobj = drawablep->getVOVolume();
-
- if (!vobj) continue;
-
- if (vobj->isNoLOD()) continue;
-
- vobj->preRebuild();
-
- if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
- {
- vobj->updateRelativeXform(true);
- }
-
- LLVolume* volume = vobj->getVolume();
- if (!volume) continue;
- for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
- {
- LLFace* face = drawablep->getFace(i);
- if (face)
- {
- LLVertexBuffer* buff = face->getVertexBuffer();
- if (buff)
- {
+ {
+ LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
+
+ if (drawablep && !drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL))
+ {
+ LLVOVolume* vobj = drawablep->getVOVolume();
+
+ if (!vobj) continue;
+
+ if (vobj->isNoLOD()) continue;
+
+ vobj->preRebuild();
+
+ if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
+ {
+ vobj->updateRelativeXform(true);
+ }
+
+ LLVolume* volume = vobj->getVolume();
+ if (!volume) continue;
+ for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
+ {
+ LLFace* face = drawablep->getFace(i);
+ if (face)
+ {
+ LLVertexBuffer* buff = face->getVertexBuffer();
+ if (buff)
+ {
if (!face->getGeometryVolume(*volume, // volume
face->getTEOffset(), // face_index
vobj->getRelativeXform(), // mat_vert_in
@@ -6068,72 +6068,72 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
}
buff->unmapBuffer();
- }
- }
- }
+ }
+ }
+ }
- if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
- {
- vobj->updateRelativeXform();
- }
+ if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
+ {
+ vobj->updateRelativeXform();
+ }
- drawablep->clearState(LLDrawable::REBUILD_ALL);
- }
- }
+ drawablep->clearState(LLDrawable::REBUILD_ALL);
+ }
+ }
- {
+ {
LL_PROFILE_ZONE_NAMED("rebuildMesh - flush");
- for (LLVertexBuffer** iter = locked_buffer, ** end_iter = locked_buffer+buffer_count; iter != end_iter; ++iter)
- {
- (*iter)->unmapBuffer();
- }
-
- // don't forget alpha
- if(group != NULL &&
- !group->mVertexBuffer.isNull())
- {
- group->mVertexBuffer->unmapBuffer();
- }
- }
-
- group->clearState(LLSpatialGroup::MESH_DIRTY | LLSpatialGroup::NEW_DRAWINFO);
- }
- }
+ for (LLVertexBuffer** iter = locked_buffer, ** end_iter = locked_buffer+buffer_count; iter != end_iter; ++iter)
+ {
+ (*iter)->unmapBuffer();
+ }
+
+ // don't forget alpha
+ if(group != NULL &&
+ !group->mVertexBuffer.isNull())
+ {
+ group->mVertexBuffer->unmapBuffer();
+ }
+ }
+
+ group->clearState(LLSpatialGroup::MESH_DIRTY | LLSpatialGroup::NEW_DRAWINFO);
+ }
+ }
}
struct CompareBatchBreaker
{
- bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
- {
- const LLTextureEntry* lte = lhs->getTextureEntry();
- const LLTextureEntry* rte = rhs->getTextureEntry();
+ bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
+ {
+ const LLTextureEntry* lte = lhs->getTextureEntry();
+ const LLTextureEntry* rte = rhs->getTextureEntry();
if (lte->getBumpmap() != rte->getBumpmap())
- {
- return lte->getBumpmap() < rte->getBumpmap();
- }
- else if (lte->getFullbright() != rte->getFullbright())
- {
- return lte->getFullbright() < rte->getFullbright();
- }
+ {
+ return lte->getBumpmap() < rte->getBumpmap();
+ }
+ else if (lte->getFullbright() != rte->getFullbright())
+ {
+ return lte->getFullbright() < rte->getFullbright();
+ }
else if (lte->getMaterialID() != rte->getMaterialID())
{
return lte->getMaterialID() < rte->getMaterialID();
}
- else if (lte->getShiny() != rte->getShiny())
- {
- return lte->getShiny() < rte->getShiny();
- }
+ else if (lte->getShiny() != rte->getShiny())
+ {
+ return lte->getShiny() < rte->getShiny();
+ }
else if (lhs->getTexture() != rhs->getTexture())
- {
- return lhs->getTexture() < rhs->getTexture();
- }
- else
+ {
+ return lhs->getTexture() < rhs->getTexture();
+ }
+ else
{
// all else being equal, maintain consistent draw order
return lhs->getDrawOrderIndex() < rhs->getDrawOrderIndex();
}
- }
+ }
};
struct CompareBatchBreakerRigged
@@ -6161,16 +6161,16 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- U32 geometryBytes = 0;
-
- //calculate maximum number of vertices to store in a single buffer
- static LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512);
- U32 max_vertices = (max_vbo_size * 1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
- max_vertices = llmin(max_vertices, (U32) 65535);
+ U32 geometryBytes = 0;
+
+ //calculate maximum number of vertices to store in a single buffer
+ static LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512);
+ U32 max_vertices = (max_vbo_size * 1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
+ max_vertices = llmin(max_vertices, (U32) 65535);
- {
+ {
LL_PROFILE_ZONE_NAMED("genDrawInfo - sort");
-
+
if (rigged)
{
if (!distance_sort) // <--- alpha "sort" rigged faces by maintaining original draw order
@@ -6184,289 +6184,289 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
//sort faces by things that break batches, not including avatar and mesh id
std::sort(faces, faces + face_count, CompareBatchBreaker());
}
- else
- {
- //sort faces by distance
- std::sort(faces, faces+face_count, LLFace::CompareDistanceGreater());
- }
- }
-
- bool hud_group = group->isHUDGroup() ;
- LLFace** face_iter = faces;
- LLFace** end_faces = faces+face_count;
-
- LLSpatialGroup::buffer_map_t buffer_map;
-
- LLViewerTexture* last_tex = NULL;
-
- S32 texture_index_channels = 1;
-
- if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
- {
- texture_index_channels = LLGLSLShader::sIndexedTextureChannels-1; //always reserve one for shiny for now just for simplicity;
- }
-
- if (distance_sort)
- {
- texture_index_channels = gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels;
- }
-
- texture_index_channels = LLGLSLShader::sIndexedTextureChannels;
-
- bool flexi = false;
-
- while (face_iter != end_faces)
- {
- //pull off next face
- LLFace* facep = *face_iter;
- LLViewerTexture* tex = facep->getTexture();
+ else
+ {
+ //sort faces by distance
+ std::sort(faces, faces+face_count, LLFace::CompareDistanceGreater());
+ }
+ }
+
+ bool hud_group = group->isHUDGroup() ;
+ LLFace** face_iter = faces;
+ LLFace** end_faces = faces+face_count;
+
+ LLSpatialGroup::buffer_map_t buffer_map;
+
+ LLViewerTexture* last_tex = NULL;
+
+ S32 texture_index_channels = 1;
+
+ if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
+ {
+ texture_index_channels = LLGLSLShader::sIndexedTextureChannels-1; //always reserve one for shiny for now just for simplicity;
+ }
+
+ if (distance_sort)
+ {
+ texture_index_channels = gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels;
+ }
+
+ texture_index_channels = LLGLSLShader::sIndexedTextureChannels;
+
+ bool flexi = false;
+
+ while (face_iter != end_faces)
+ {
+ //pull off next face
+ LLFace* facep = *face_iter;
+ LLViewerTexture* tex = facep->getTexture();
const LLTextureEntry* te = facep->getTextureEntry();
- LLMaterialPtr mat = te->getMaterialParams();
+ LLMaterialPtr mat = te->getMaterialParams();
LLMaterialID matId = te->getMaterialID();
- if (distance_sort)
- {
- tex = NULL;
- }
+ if (distance_sort)
+ {
+ tex = NULL;
+ }
- if (last_tex != tex)
- {
- last_tex = tex;
- }
+ if (last_tex != tex)
+ {
+ last_tex = tex;
+ }
+
+ bool bake_sunlight = LLPipeline::sBakeSunlight && facep->getDrawable()->isStatic();
+
+ U32 index_count = facep->getIndicesCount();
+ U32 geom_count = facep->getGeomCount();
- bool bake_sunlight = LLPipeline::sBakeSunlight && facep->getDrawable()->isStatic();
+ flexi = flexi || facep->getViewerObject()->getVolume()->isUnique();
- U32 index_count = facep->getIndicesCount();
- U32 geom_count = facep->getGeomCount();
+ //sum up vertices needed for this render batch
+ LLFace** i = face_iter;
+ ++i;
- flexi = flexi || facep->getViewerObject()->getVolume()->isUnique();
+ const U32 MAX_TEXTURE_COUNT = 32;
+ LLViewerTexture* texture_list[MAX_TEXTURE_COUNT];
- //sum up vertices needed for this render batch
- LLFace** i = face_iter;
- ++i;
-
- const U32 MAX_TEXTURE_COUNT = 32;
- LLViewerTexture* texture_list[MAX_TEXTURE_COUNT];
-
- U32 texture_count = 0;
+ U32 texture_count = 0;
- {
+ {
LL_PROFILE_ZONE_NAMED("genDrawInfo - face size");
- if (batch_textures)
- {
- U8 cur_tex = 0;
- facep->setTextureIndex(cur_tex);
- if (texture_count < MAX_TEXTURE_COUNT)
- {
- texture_list[texture_count++] = tex;
- }
-
- if (can_batch_texture(facep))
- { //populate texture_list with any textures that can be batched
- //move i to the next unbatchable face
- while (i != end_faces)
- {
- facep = *i;
-
- if (!can_batch_texture(facep))
- { //face is bump mapped or has an animated texture matrix -- can't
- //batch more than 1 texture at a time
- facep->setTextureIndex(0);
- break;
- }
-
- if (facep->getTexture() != tex)
- {
- if (distance_sort)
- { //textures might be out of order, see if texture exists in current batch
- bool found = false;
- for (U32 tex_idx = 0; tex_idx < texture_count; ++tex_idx)
- {
- if (facep->getTexture() == texture_list[tex_idx])
- {
- cur_tex = tex_idx;
- found = true;
- break;
- }
- }
-
- if (!found)
- {
- cur_tex = texture_count;
- }
- }
- else
- {
- cur_tex++;
- }
-
- if (cur_tex >= texture_index_channels)
- { //cut batches when index channels are depleted
- break;
- }
-
- tex = facep->getTexture();
-
- if (texture_count < MAX_TEXTURE_COUNT)
- {
- texture_list[texture_count++] = tex;
- }
- }
-
- if (geom_count + facep->getGeomCount() > max_vertices)
- { //cut batches on geom count too big
- break;
- }
-
- ++i;
-
- flexi = flexi || facep->getViewerObject()->getVolume()->isUnique();
-
- index_count += facep->getIndicesCount();
- geom_count += facep->getGeomCount();
-
- facep->setTextureIndex(cur_tex);
- }
- }
- else
- {
- facep->setTextureIndex(0);
- }
-
- tex = texture_list[0];
- }
- else
- {
- while (i != end_faces &&
- (LLPipeline::sTextureBindTest ||
- (distance_sort ||
- ((*i)->getTexture() == tex))))
- {
- facep = *i;
+ if (batch_textures)
+ {
+ U8 cur_tex = 0;
+ facep->setTextureIndex(cur_tex);
+ if (texture_count < MAX_TEXTURE_COUNT)
+ {
+ texture_list[texture_count++] = tex;
+ }
+
+ if (can_batch_texture(facep))
+ { //populate texture_list with any textures that can be batched
+ //move i to the next unbatchable face
+ while (i != end_faces)
+ {
+ facep = *i;
+
+ if (!can_batch_texture(facep))
+ { //face is bump mapped or has an animated texture matrix -- can't
+ //batch more than 1 texture at a time
+ facep->setTextureIndex(0);
+ break;
+ }
+
+ if (facep->getTexture() != tex)
+ {
+ if (distance_sort)
+ { //textures might be out of order, see if texture exists in current batch
+ bool found = false;
+ for (U32 tex_idx = 0; tex_idx < texture_count; ++tex_idx)
+ {
+ if (facep->getTexture() == texture_list[tex_idx])
+ {
+ cur_tex = tex_idx;
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ cur_tex = texture_count;
+ }
+ }
+ else
+ {
+ cur_tex++;
+ }
+
+ if (cur_tex >= texture_index_channels)
+ { //cut batches when index channels are depleted
+ break;
+ }
+
+ tex = facep->getTexture();
+
+ if (texture_count < MAX_TEXTURE_COUNT)
+ {
+ texture_list[texture_count++] = tex;
+ }
+ }
+
+ if (geom_count + facep->getGeomCount() > max_vertices)
+ { //cut batches on geom count too big
+ break;
+ }
+
+ ++i;
+
+ flexi = flexi || facep->getViewerObject()->getVolume()->isUnique();
+
+ index_count += facep->getIndicesCount();
+ geom_count += facep->getGeomCount();
+
+ facep->setTextureIndex(cur_tex);
+ }
+ }
+ else
+ {
+ facep->setTextureIndex(0);
+ }
+
+ tex = texture_list[0];
+ }
+ else
+ {
+ while (i != end_faces &&
+ (LLPipeline::sTextureBindTest ||
+ (distance_sort ||
+ ((*i)->getTexture() == tex))))
+ {
+ facep = *i;
const LLTextureEntry* nextTe = facep->getTextureEntry();
if (nextTe->getMaterialID() != matId)
{
break;
}
- //face has no texture index
- facep->mDrawInfo = NULL;
- facep->setTextureIndex(FACE_DO_NOT_BATCH_TEXTURES);
+ //face has no texture index
+ facep->mDrawInfo = NULL;
+ facep->setTextureIndex(FACE_DO_NOT_BATCH_TEXTURES);
- if (geom_count + facep->getGeomCount() > max_vertices)
- { //cut batches on geom count too big
- break;
- }
+ if (geom_count + facep->getGeomCount() > max_vertices)
+ { //cut batches on geom count too big
+ break;
+ }
- ++i;
- index_count += facep->getIndicesCount();
- geom_count += facep->getGeomCount();
+ ++i;
+ index_count += facep->getIndicesCount();
+ geom_count += facep->getGeomCount();
- flexi = flexi || facep->getViewerObject()->getVolume()->isUnique();
- }
- }
- }
+ flexi = flexi || facep->getViewerObject()->getVolume()->isUnique();
+ }
+ }
+ }
- //create vertex buffer
- LLPointer<LLVertexBuffer> buffer;
+ //create vertex buffer
+ LLPointer<LLVertexBuffer> buffer;
- {
+ {
LL_PROFILE_ZONE_NAMED("genDrawInfo - allocate");
- buffer = new LLVertexBuffer(mask);
- if(!buffer->allocateBuffer(geom_count, index_count))
- {
- LL_WARNS() << "Failed to allocate group Vertex Buffer to "
- << geom_count << " vertices and "
- << index_count << " indices" << LL_ENDL;
- buffer = NULL;
- }
- }
-
- if (buffer)
- {
- geometryBytes += buffer->getSize() + buffer->getIndicesSize();
- buffer_map[mask][*face_iter].push_back(buffer);
- }
-
- //add face geometry
-
- U32 indices_index = 0;
- U16 index_offset = 0;
+ buffer = new LLVertexBuffer(mask);
+ if(!buffer->allocateBuffer(geom_count, index_count))
+ {
+ LL_WARNS() << "Failed to allocate group Vertex Buffer to "
+ << geom_count << " vertices and "
+ << index_count << " indices" << LL_ENDL;
+ buffer = NULL;
+ }
+ }
+
+ if (buffer)
+ {
+ geometryBytes += buffer->getSize() + buffer->getIndicesSize();
+ buffer_map[mask][*face_iter].push_back(buffer);
+ }
+
+ //add face geometry
+
+ U32 indices_index = 0;
+ U16 index_offset = 0;
while (face_iter < i)
- {
- //update face indices for new buffer
- facep = *face_iter;
-
- if (buffer.isNull())
- {
- // Bulk allocation failed
- facep->setVertexBuffer(buffer);
- facep->setSize(0, 0); // mark as no geometry
- ++face_iter;
- continue;
- }
- facep->setIndicesIndex(indices_index);
- facep->setGeomIndex(index_offset);
- facep->setVertexBuffer(buffer);
-
- if (batch_textures && facep->getTextureIndex() == FACE_DO_NOT_BATCH_TEXTURES)
- {
- LL_ERRS() << "Invalid texture index." << LL_ENDL;
- }
-
- {
- //for debugging, set last time face was updated vs moved
- facep->updateRebuildFlags();
-
- { //copy face geometry into vertex buffer
- LLDrawable* drawablep = facep->getDrawable();
- LLVOVolume* vobj = drawablep->getVOVolume();
- LLVolume* volume = vobj->getVolume();
-
- if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
- {
- vobj->updateRelativeXform(true);
- }
-
- U32 te_idx = facep->getTEOffset();
-
- if (!facep->getGeometryVolume(*volume, te_idx,
- vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true))
- {
- LL_WARNS() << "Failed to get geometry for face!" << LL_ENDL;
- }
-
- if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
- {
- vobj->updateRelativeXform(false);
- }
- }
- }
-
- index_offset += facep->getGeomCount();
- indices_index += facep->getIndicesCount();
-
- //append face to appropriate render batch
-
- BOOL force_simple = facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA;
- BOOL fullbright = facep->isState(LLFace::FULLBRIGHT);
- if ((mask & LLVertexBuffer::MAP_NORMAL) == 0)
- { //paranoia check to make sure GL doesn't try to read non-existant normals
- fullbright = TRUE;
- }
+ {
+ //update face indices for new buffer
+ facep = *face_iter;
+
+ if (buffer.isNull())
+ {
+ // Bulk allocation failed
+ facep->setVertexBuffer(buffer);
+ facep->setSize(0, 0); // mark as no geometry
+ ++face_iter;
+ continue;
+ }
+ facep->setIndicesIndex(indices_index);
+ facep->setGeomIndex(index_offset);
+ facep->setVertexBuffer(buffer);
+
+ if (batch_textures && facep->getTextureIndex() == FACE_DO_NOT_BATCH_TEXTURES)
+ {
+ LL_ERRS() << "Invalid texture index." << LL_ENDL;
+ }
+
+ {
+ //for debugging, set last time face was updated vs moved
+ facep->updateRebuildFlags();
+
+ { //copy face geometry into vertex buffer
+ LLDrawable* drawablep = facep->getDrawable();
+ LLVOVolume* vobj = drawablep->getVOVolume();
+ LLVolume* volume = vobj->getVolume();
+
+ if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
+ {
+ vobj->updateRelativeXform(true);
+ }
+
+ U32 te_idx = facep->getTEOffset();
+
+ if (!facep->getGeometryVolume(*volume, te_idx,
+ vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true))
+ {
+ LL_WARNS() << "Failed to get geometry for face!" << LL_ENDL;
+ }
+
+ if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
+ {
+ vobj->updateRelativeXform(false);
+ }
+ }
+ }
+
+ index_offset += facep->getGeomCount();
+ indices_index += facep->getIndicesCount();
+
+ //append face to appropriate render batch
+
+ BOOL force_simple = facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA;
+ BOOL fullbright = facep->isState(LLFace::FULLBRIGHT);
+ if ((mask & LLVertexBuffer::MAP_NORMAL) == 0)
+ { //paranoia check to make sure GL doesn't try to read non-existant normals
+ fullbright = TRUE;
+ }
const LLTextureEntry* te = facep->getTextureEntry();
LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial();
- if (hud_group && gltf_mat == nullptr)
- { //all hud attachments are fullbright
- fullbright = TRUE;
- }
-
- tex = facep->getTexture();
+ if (hud_group && gltf_mat == nullptr)
+ { //all hud attachments are fullbright
+ fullbright = TRUE;
+ }
- BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE;
+ tex = facep->getTexture();
+
+ BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE;
LLMaterial* mat = nullptr;
bool can_be_shiny = false;
@@ -6486,8 +6486,8 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
}
F32 blinn_phong_alpha = te->getColor().mV[3];
- bool use_legacy_bump = te->getBumpmap() && (te->getBumpmap() < 18) && (!mat || mat->getNormalID().isNull());
- bool blinn_phong_opaque = blinn_phong_alpha >= 0.999f;
+ bool use_legacy_bump = te->getBumpmap() && (te->getBumpmap() < 18) && (!mat || mat->getNormalID().isNull());
+ bool blinn_phong_opaque = blinn_phong_alpha >= 0.999f;
bool blinn_phong_transparent = blinn_phong_alpha < 0.999f;
if (!gltf_mat)
@@ -6495,9 +6495,9 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
is_alpha = (is_alpha || blinn_phong_transparent) ? TRUE : FALSE;
}
- if (gltf_mat || (mat && !hud_group))
- {
- bool material_pass = false;
+ if (gltf_mat || (mat && !hud_group))
+ {
+ bool material_pass = false;
if (gltf_mat)
{ // all other parameters ignored if gltf material is present
@@ -6515,82 +6515,82 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
}
}
else
- // do NOT use 'fullbright' for this logic or you risk sending
- // things without normals down the materials pipeline and will
- // render poorly if not crash NORSPEC-240,314
- //
- if (te->getFullbright())
- {
- if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
- {
- if (blinn_phong_opaque)
- {
- registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
- }
- else
- {
- registerFace(group, facep, LLRenderPass::PASS_ALPHA);
- }
- }
- else if (is_alpha)
- {
- registerFace(group, facep, LLRenderPass::PASS_ALPHA);
- }
- else
- {
- if (mat->getEnvironmentIntensity() > 0 || te->getShiny() > 0)
- {
- material_pass = true;
- }
- else
- {
+ // do NOT use 'fullbright' for this logic or you risk sending
+ // things without normals down the materials pipeline and will
+ // render poorly if not crash NORSPEC-240,314
+ //
+ if (te->getFullbright())
+ {
+ if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
+ {
+ if (blinn_phong_opaque)
+ {
+ registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
+ }
+ else
+ {
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA);
+ }
+ }
+ else if (is_alpha)
+ {
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA);
+ }
+ else
+ {
+ if (mat->getEnvironmentIntensity() > 0 || te->getShiny() > 0)
+ {
+ material_pass = true;
+ }
+ else
+ {
if (blinn_phong_opaque)
- {
- registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
+ {
+ registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
}
else
{
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
}
- }
- }
- }
- else if (blinn_phong_transparent)
- {
- registerFace(group, facep, LLRenderPass::PASS_ALPHA);
- }
- else if (use_legacy_bump)
- {
+ }
+ }
+ }
+ else if (blinn_phong_transparent)
+ {
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA);
+ }
+ else if (use_legacy_bump)
+ {
llassert(mask & LLVertexBuffer::MAP_TANGENT);
- // we have a material AND legacy bump settings, but no normal map
- registerFace(group, facep, LLRenderPass::PASS_BUMP);
- }
- else
- {
- material_pass = true;
- }
-
- if (material_pass)
- {
- static const U32 pass[] =
- {
- LLRenderPass::PASS_MATERIAL,
- LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_MATERIAL_ALPHA,
- LLRenderPass::PASS_MATERIAL_ALPHA_MASK,
- LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE,
- LLRenderPass::PASS_SPECMAP,
- LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_SPECMAP_BLEND,
- LLRenderPass::PASS_SPECMAP_MASK,
- LLRenderPass::PASS_SPECMAP_EMISSIVE,
- LLRenderPass::PASS_NORMMAP,
- LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMMAP_BLEND,
- LLRenderPass::PASS_NORMMAP_MASK,
- LLRenderPass::PASS_NORMMAP_EMISSIVE,
- LLRenderPass::PASS_NORMSPEC,
- LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMSPEC_BLEND,
- LLRenderPass::PASS_NORMSPEC_MASK,
- LLRenderPass::PASS_NORMSPEC_EMISSIVE,
- };
+ // we have a material AND legacy bump settings, but no normal map
+ registerFace(group, facep, LLRenderPass::PASS_BUMP);
+ }
+ else
+ {
+ material_pass = true;
+ }
+
+ if (material_pass)
+ {
+ static const U32 pass[] =
+ {
+ LLRenderPass::PASS_MATERIAL,
+ LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_MATERIAL_ALPHA,
+ LLRenderPass::PASS_MATERIAL_ALPHA_MASK,
+ LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE,
+ LLRenderPass::PASS_SPECMAP,
+ LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_SPECMAP_BLEND,
+ LLRenderPass::PASS_SPECMAP_MASK,
+ LLRenderPass::PASS_SPECMAP_EMISSIVE,
+ LLRenderPass::PASS_NORMMAP,
+ LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMMAP_BLEND,
+ LLRenderPass::PASS_NORMMAP_MASK,
+ LLRenderPass::PASS_NORMMAP_EMISSIVE,
+ LLRenderPass::PASS_NORMSPEC,
+ LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMSPEC_BLEND,
+ LLRenderPass::PASS_NORMSPEC_MASK,
+ LLRenderPass::PASS_NORMSPEC_EMISSIVE,
+ };
U32 alpha_mode = mat->getDiffuseAlphaMode();
if (!distance_sort && alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
@@ -6601,180 +6601,180 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
U32 vb_mask = facep->getVertexBuffer()->getTypeMask();
- // HACK - this should also never happen, but sometimes we get here and the material thinks it has a specmap now
+ // HACK - this should also never happen, but sometimes we get here and the material thinks it has a specmap now
// even though it didn't appear to have a specmap when the face was added to the list of faces
if ((mask & 0x4) && !(vb_mask & LLVertexBuffer::MAP_TEXCOORD2))
{
mask &= ~0x4;
}
- llassert(mask < sizeof(pass)/sizeof(U32));
+ llassert(mask < sizeof(pass)/sizeof(U32));
- mask = llmin(mask, (U32)(sizeof(pass)/sizeof(U32)-1));
+ mask = llmin(mask, (U32)(sizeof(pass)/sizeof(U32)-1));
// if this is going into alpha pool, distance sort MUST be true
llassert(pass[mask] == LLRenderPass::PASS_ALPHA ? distance_sort : true);
- registerFace(group, facep, pass[mask]);
- }
- }
- else if (mat)
- {
- U8 mode = mat->getDiffuseAlphaMode();
+ registerFace(group, facep, pass[mask]);
+ }
+ }
+ else if (mat)
+ {
+ U8 mode = mat->getDiffuseAlphaMode();
is_alpha = (is_alpha || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND));
- if (is_alpha)
- {
- mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
- }
-
- if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
- {
- registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK : LLRenderPass::PASS_ALPHA_MASK);
- }
- else if (is_alpha )
- {
- registerFace(group, facep, LLRenderPass::PASS_ALPHA);
- }
- else if (gPipeline.shadersLoaded()
- && te->getShiny()
- && can_be_shiny)
- {
- registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_SHINY : LLRenderPass::PASS_SHINY);
- }
- else
- {
- registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT : LLRenderPass::PASS_SIMPLE);
- }
- }
- else if (is_alpha)
- {
- // can we safely treat this as an alpha mask?
- if (facep->getFaceColor().mV[3] <= 0.f)
- { //100% transparent, don't render unless we're highlighting transparent
- registerFace(group, facep, LLRenderPass::PASS_ALPHA_INVISIBLE);
- }
- else if (facep->canRenderAsMask() && !hud_group)
- {
- if (te->getFullbright() || LLPipeline::sNoAlpha)
- {
- registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
- }
- else
- {
- registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK);
- }
- }
- else
- {
- registerFace(group, facep, LLRenderPass::PASS_ALPHA);
- }
- }
- else if (gPipeline.shadersLoaded()
- && te->getShiny()
- && can_be_shiny)
- { //shiny
- if (tex->getPrimaryFormat() == GL_ALPHA)
- { //invisiprim+shiny
- registerFace(group, facep, LLRenderPass::PASS_INVISI_SHINY);
- registerFace(group, facep, LLRenderPass::PASS_INVISIBLE);
- }
- else if (!hud_group)
- { //deferred rendering
- if (te->getFullbright())
- { //register in post deferred fullbright shiny pass
- registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_SHINY);
- if (te->getBumpmap())
- { //register in post deferred bump pass
- registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
- }
- }
- else if (use_legacy_bump)
- { //register in deferred bump pass
+ if (is_alpha)
+ {
+ mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
+ }
+
+ if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
+ {
+ registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK : LLRenderPass::PASS_ALPHA_MASK);
+ }
+ else if (is_alpha )
+ {
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA);
+ }
+ else if (gPipeline.shadersLoaded()
+ && te->getShiny()
+ && can_be_shiny)
+ {
+ registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_SHINY : LLRenderPass::PASS_SHINY);
+ }
+ else
+ {
+ registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT : LLRenderPass::PASS_SIMPLE);
+ }
+ }
+ else if (is_alpha)
+ {
+ // can we safely treat this as an alpha mask?
+ if (facep->getFaceColor().mV[3] <= 0.f)
+ { //100% transparent, don't render unless we're highlighting transparent
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA_INVISIBLE);
+ }
+ else if (facep->canRenderAsMask() && !hud_group)
+ {
+ if (te->getFullbright() || LLPipeline::sNoAlpha)
+ {
+ registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
+ }
+ else
+ {
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK);
+ }
+ }
+ else
+ {
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA);
+ }
+ }
+ else if (gPipeline.shadersLoaded()
+ && te->getShiny()
+ && can_be_shiny)
+ { //shiny
+ if (tex->getPrimaryFormat() == GL_ALPHA)
+ { //invisiprim+shiny
+ registerFace(group, facep, LLRenderPass::PASS_INVISI_SHINY);
+ registerFace(group, facep, LLRenderPass::PASS_INVISIBLE);
+ }
+ else if (!hud_group)
+ { //deferred rendering
+ if (te->getFullbright())
+ { //register in post deferred fullbright shiny pass
+ registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_SHINY);
+ if (te->getBumpmap())
+ { //register in post deferred bump pass
+ registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
+ }
+ }
+ else if (use_legacy_bump)
+ { //register in deferred bump pass
llassert(mask& LLVertexBuffer::MAP_TANGENT);
- registerFace(group, facep, LLRenderPass::PASS_BUMP);
- }
- else
- { //register in deferred simple pass (deferred simple includes shiny)
- llassert(mask & LLVertexBuffer::MAP_NORMAL);
- registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
- }
- }
- else if (fullbright)
- { //not deferred, register in standard fullbright shiny pass
- registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_SHINY);
- }
- else
- { //not deferred or fullbright, register in standard shiny pass
- registerFace(group, facep, LLRenderPass::PASS_SHINY);
- }
- }
- else
- { //not alpha and not shiny
- if (!is_alpha && tex->getPrimaryFormat() == GL_ALPHA)
- { //invisiprim
- registerFace(group, facep, LLRenderPass::PASS_INVISIBLE);
- }
- else if (fullbright || bake_sunlight)
- { //fullbright
- if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
- {
- registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
- }
- else
- {
- registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
- }
- if (!hud_group && use_legacy_bump)
- { //if this is the deferred render and a bump map is present, register in post deferred bump
- registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
- }
- }
- else
- {
- if (use_legacy_bump)
- { //non-shiny or fullbright deferred bump
+ registerFace(group, facep, LLRenderPass::PASS_BUMP);
+ }
+ else
+ { //register in deferred simple pass (deferred simple includes shiny)
+ llassert(mask & LLVertexBuffer::MAP_NORMAL);
+ registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
+ }
+ }
+ else if (fullbright)
+ { //not deferred, register in standard fullbright shiny pass
+ registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_SHINY);
+ }
+ else
+ { //not deferred or fullbright, register in standard shiny pass
+ registerFace(group, facep, LLRenderPass::PASS_SHINY);
+ }
+ }
+ else
+ { //not alpha and not shiny
+ if (!is_alpha && tex->getPrimaryFormat() == GL_ALPHA)
+ { //invisiprim
+ registerFace(group, facep, LLRenderPass::PASS_INVISIBLE);
+ }
+ else if (fullbright || bake_sunlight)
+ { //fullbright
+ if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
+ {
+ registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
+ }
+ else
+ {
+ registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
+ }
+ if (!hud_group && use_legacy_bump)
+ { //if this is the deferred render and a bump map is present, register in post deferred bump
+ registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
+ }
+ }
+ else
+ {
+ if (use_legacy_bump)
+ { //non-shiny or fullbright deferred bump
llassert(mask& LLVertexBuffer::MAP_TANGENT);
- registerFace(group, facep, LLRenderPass::PASS_BUMP);
- }
- else
- { //all around simple
- llassert(mask & LLVertexBuffer::MAP_NORMAL);
- if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
- { //material alpha mask can be respected in non-deferred
- registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK);
- }
- else
- {
- registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
- }
- }
- }
-
-
- if (!gPipeline.shadersLoaded() &&
- !is_alpha &&
- te->getShiny())
- { //shiny as an extra pass when shaders are disabled
- registerFace(group, facep, LLRenderPass::PASS_SHINY);
- }
- }
-
- //not sure why this is here, and looks like it might cause bump mapped objects to get rendered redundantly -- davep 5/11/2010
- if (!is_alpha && hud_group)
- {
- llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright);
- facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE);
-
- if (!force_simple && use_legacy_bump)
- {
+ registerFace(group, facep, LLRenderPass::PASS_BUMP);
+ }
+ else
+ { //all around simple
+ llassert(mask & LLVertexBuffer::MAP_NORMAL);
+ if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
+ { //material alpha mask can be respected in non-deferred
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK);
+ }
+ else
+ {
+ registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
+ }
+ }
+ }
+
+
+ if (!gPipeline.shadersLoaded() &&
+ !is_alpha &&
+ te->getShiny())
+ { //shiny as an extra pass when shaders are disabled
+ registerFace(group, facep, LLRenderPass::PASS_SHINY);
+ }
+ }
+
+ //not sure why this is here, and looks like it might cause bump mapped objects to get rendered redundantly -- davep 5/11/2010
+ if (!is_alpha && hud_group)
+ {
+ llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright);
+ facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE);
+
+ if (!force_simple && use_legacy_bump)
+ {
llassert(mask & LLVertexBuffer::MAP_TANGENT);
- registerFace(group, facep, LLRenderPass::PASS_BUMP);
- }
- }
+ registerFace(group, facep, LLRenderPass::PASS_BUMP);
+ }
+ }
- if (!is_alpha && LLPipeline::sRenderGlow && te->getGlow() > 0.f)
- {
+ if (!is_alpha && LLPipeline::sRenderGlow && te->getGlow() > 0.f)
+ {
if (gltf_mat)
{
registerFace(group, facep, LLRenderPass::PASS_GLTF_GLOW);
@@ -6783,24 +6783,24 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
{
registerFace(group, facep, LLRenderPass::PASS_GLOW);
}
- }
-
- ++face_iter;
- }
+ }
+
+ ++face_iter;
+ }
- if (buffer)
- {
- buffer->unmapBuffer();
- }
- }
+ if (buffer)
+ {
+ buffer->unmapBuffer();
+ }
+ }
- group->mBufferMap[mask].clear();
- for (LLSpatialGroup::buffer_texture_map_t::iterator i = buffer_map[mask].begin(); i != buffer_map[mask].end(); ++i)
- {
- group->mBufferMap[mask][i->first] = i->second;
- }
+ group->mBufferMap[mask].clear();
+ for (LLSpatialGroup::buffer_texture_map_t::iterator i = buffer_map[mask].begin(); i != buffer_map[mask].end(); ++i)
+ {
+ group->mBufferMap[mask][i->first] = i->second;
+ }
- return geometryBytes;
+ return geometryBytes;
}
void LLVolumeGeometryManager::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count)
@@ -6818,57 +6818,57 @@ void LLVolumeGeometryManager::addGeometryCount(LLSpatialGroup* group, U32& verte
}
void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count)
-{
+{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
//clear off any old faces
mFaceList.clear();
- //for each drawable
- for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
- {
- LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
-
- if (!drawablep || drawablep->isDead())
- {
- continue;
- }
-
- //for each face
- for (S32 i = 0; i < drawablep->getNumFaces(); i++)
- {
- //sum up face verts and indices
- drawablep->updateFaceSize(i);
- LLFace* facep = drawablep->getFace(i);
- if (facep)
- {
- if (facep->hasGeometry() && facep->getPixelArea() > FORCE_CULL_AREA &&
- facep->getGeomCount() + vertex_count <= 65536)
- {
- vertex_count += facep->getGeomCount();
- index_count += facep->getIndicesCount();
-
- //remember face (for sorting)
- mFaceList.push_back(facep);
- }
- else
- {
- facep->clearVertexBuffer();
- }
- }
- }
- }
+ //for each drawable
+ for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
+ {
+ LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
+
+ if (!drawablep || drawablep->isDead())
+ {
+ continue;
+ }
+
+ //for each face
+ for (S32 i = 0; i < drawablep->getNumFaces(); i++)
+ {
+ //sum up face verts and indices
+ drawablep->updateFaceSize(i);
+ LLFace* facep = drawablep->getFace(i);
+ if (facep)
+ {
+ if (facep->hasGeometry() && facep->getPixelArea() > FORCE_CULL_AREA &&
+ facep->getGeomCount() + vertex_count <= 65536)
+ {
+ vertex_count += facep->getGeomCount();
+ index_count += facep->getIndicesCount();
+
+ //remember face (for sorting)
+ mFaceList.push_back(facep);
+ }
+ else
+ {
+ facep->clearVertexBuffer();
+ }
+ }
+ }
+ }
}
LLHUDPartition::LLHUDPartition(LLViewerRegion* regionp) : LLBridgePartition(regionp)
{
- mPartitionType = LLViewerRegion::PARTITION_HUD;
- mDrawableType = LLPipeline::RENDER_TYPE_HUD;
- mSlopRatio = 0.f;
- mLODPeriod = 1;
+ mPartitionType = LLViewerRegion::PARTITION_HUD;
+ mDrawableType = LLPipeline::RENDER_TYPE_HUD;
+ mSlopRatio = 0.f;
+ mLODPeriod = 1;
}
void LLHUDPartition::shift(const LLVector4a &offset)
{
- //HUD objects don't shift with region crossing. That would be silly.
+ //HUD objects don't shift with region crossing. That would be silly.
}
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index aadc1fbcf3..88a10effb3 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvovolume.h
* @brief LLVOVolume class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,8 +32,8 @@
#include "llviewermedia.h"
#include "llframetimer.h"
#include "lllocalbitmaps.h"
-#include "m3math.h" // LLMatrix3
-#include "m4math.h" // LLMatrix4
+#include "m3math.h" // LLMatrix3
+#include "m4math.h" // LLMatrix4
#include <unordered_map>
#include <unordered_set>
@@ -51,7 +51,7 @@ typedef std::vector<viewer_media_t> media_list_t;
enum LLVolumeInterfaceType
{
- INTERFACE_FLEXIBLE = 1,
+ INTERFACE_FLEXIBLE = 1,
};
const F32 MAX_LOD_FACTOR = 4.0f;
@@ -60,10 +60,10 @@ const F32 MAX_LOD_FACTOR = 4.0f;
class LLRiggedVolume : public LLVolume
{
public:
- LLRiggedVolume(const LLVolumeParams& params)
- : LLVolume(params, 0.f)
- {
- }
+ LLRiggedVolume(const LLVolumeParams& params)
+ : LLVolume(params, 0.f)
+ {
+ }
using FaceIndex = S32;
static const FaceIndex UPDATE_ALL_FACES = -1;
@@ -82,218 +82,218 @@ public:
class LLVolumeInterface
{
public:
- virtual ~LLVolumeInterface() { }
- virtual LLVolumeInterfaceType getInterfaceType() const = 0;
- virtual void doIdleUpdate() = 0;
- virtual BOOL doUpdateGeometry(LLDrawable *drawable) = 0;
- virtual LLVector3 getPivotPosition() const = 0;
- virtual void onSetVolume(const LLVolumeParams &volume_params, const S32 detail) = 0;
- virtual void onSetScale(const LLVector3 &scale, BOOL damped) = 0;
- virtual void onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin) = 0;
- virtual void onShift(const LLVector4a &shift_vector) = 0;
- virtual bool isVolumeUnique() const = 0; // Do we need a unique LLVolume instance?
- virtual bool isVolumeGlobal() const = 0; // Are we in global space?
- virtual bool isActive() const = 0; // Is this object currently active?
- virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const = 0;
- virtual void updateRelativeXform(bool force_identity = false) = 0;
- virtual U32 getID() const = 0;
- virtual void preRebuild() = 0;
+ virtual ~LLVolumeInterface() { }
+ virtual LLVolumeInterfaceType getInterfaceType() const = 0;
+ virtual void doIdleUpdate() = 0;
+ virtual BOOL doUpdateGeometry(LLDrawable *drawable) = 0;
+ virtual LLVector3 getPivotPosition() const = 0;
+ virtual void onSetVolume(const LLVolumeParams &volume_params, const S32 detail) = 0;
+ virtual void onSetScale(const LLVector3 &scale, BOOL damped) = 0;
+ virtual void onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin) = 0;
+ virtual void onShift(const LLVector4a &shift_vector) = 0;
+ virtual bool isVolumeUnique() const = 0; // Do we need a unique LLVolume instance?
+ virtual bool isVolumeGlobal() const = 0; // Are we in global space?
+ virtual bool isActive() const = 0; // Is this object currently active?
+ virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const = 0;
+ virtual void updateRelativeXform(bool force_identity = false) = 0;
+ virtual U32 getID() const = 0;
+ virtual void preRebuild() = 0;
};
// Class which embodies all Volume objects (with pcode LL_PCODE_VOLUME)
class LLVOVolume : public LLViewerObject
{
- LOG_CLASS(LLVOVolume);
+ LOG_CLASS(LLVOVolume);
protected:
- virtual ~LLVOVolume();
+ virtual ~LLVOVolume();
public:
- static void initClass();
- static void cleanupClass();
- static void preUpdateGeom();
-
- enum
- {
- VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
- (1 << LLVertexBuffer::TYPE_NORMAL) |
- (1 << LLVertexBuffer::TYPE_TEXCOORD0) |
- (1 << LLVertexBuffer::TYPE_TEXCOORD1) |
- (1 << LLVertexBuffer::TYPE_COLOR)
- };
+ static void initClass();
+ static void cleanupClass();
+ static void preUpdateGeom();
+
+ enum
+ {
+ VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
+ (1 << LLVertexBuffer::TYPE_NORMAL) |
+ (1 << LLVertexBuffer::TYPE_TEXCOORD0) |
+ (1 << LLVertexBuffer::TYPE_TEXCOORD1) |
+ (1 << LLVertexBuffer::TYPE_COLOR)
+ };
public:
- LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
- void markDead() override; // Override (and call through to parent) to clean up media references
-
- LLDrawable* createDrawable(LLPipeline *pipeline) override;
-
- void deleteFaces();
-
- void animateTextures();
-
- BOOL isVisible() const ;
- BOOL isActive() const override;
- BOOL isAttachment() const override;
- BOOL isRootEdit() const override; // overridden for sake of attachments treating themselves as a root object
- BOOL isHUDAttachment() const override;
-
- void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point);
- /*virtual*/ BOOL setParent(LLViewerObject* parent) override;
- S32 getLOD() const override { return mLOD; }
- void setNoLOD() { mLOD = NO_LOD; mLODChanged = TRUE; }
- bool isNoLOD() const { return NO_LOD == mLOD; }
- const LLVector3 getPivotPositionAgent() const override;
- const LLMatrix4& getRelativeXform() const { return mRelativeXform; }
- const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; }
- /*virtual*/ const LLMatrix4 getRenderMatrix() const override;
- typedef std::unordered_set<const LLViewerTexture*> texture_cost_t;
+ LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+ void markDead() override; // Override (and call through to parent) to clean up media references
+
+ LLDrawable* createDrawable(LLPipeline *pipeline) override;
+
+ void deleteFaces();
+
+ void animateTextures();
+
+ BOOL isVisible() const ;
+ BOOL isActive() const override;
+ BOOL isAttachment() const override;
+ BOOL isRootEdit() const override; // overridden for sake of attachments treating themselves as a root object
+ BOOL isHUDAttachment() const override;
+
+ void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point);
+ /*virtual*/ BOOL setParent(LLViewerObject* parent) override;
+ S32 getLOD() const override { return mLOD; }
+ void setNoLOD() { mLOD = NO_LOD; mLODChanged = TRUE; }
+ bool isNoLOD() const { return NO_LOD == mLOD; }
+ const LLVector3 getPivotPositionAgent() const override;
+ const LLMatrix4& getRelativeXform() const { return mRelativeXform; }
+ const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; }
+ /*virtual*/ const LLMatrix4 getRenderMatrix() const override;
+ typedef std::unordered_set<const LLViewerTexture*> texture_cost_t;
static S32 getTextureCost(const LLViewerTexture* img);
- U32 getRenderCost(texture_cost_t &textures) const;
- /*virtual*/ F32 getEstTrianglesMax() const override;
- /*virtual*/ F32 getEstTrianglesStreamingCost() const override;
- /* virtual*/ F32 getStreamingCost() const override;
+ U32 getRenderCost(texture_cost_t &textures) const;
+ /*virtual*/ F32 getEstTrianglesMax() const override;
+ /*virtual*/ F32 getEstTrianglesStreamingCost() const override;
+ /* virtual*/ F32 getStreamingCost() const override;
/*virtual*/ bool getCostData(LLMeshCostData& costs) const override;
- /*virtual*/ U32 getTriangleCount(S32* vcount = NULL) const override;
- /*virtual*/ U32 getHighLODTriangleCount() override;
- /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
- S32 face = -1, // which face to check, -1 = ALL_SIDES
- BOOL pick_transparent = FALSE,
- BOOL pick_rigged = FALSE,
+ /*virtual*/ U32 getTriangleCount(S32* vcount = NULL) const override;
+ /*virtual*/ U32 getHighLODTriangleCount() override;
+ /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
+ S32 face = -1, // which face to check, -1 = ALL_SIDES
+ BOOL pick_transparent = FALSE,
+ BOOL pick_rigged = FALSE,
BOOL pick_unselectable = TRUE,
- S32* face_hit = NULL, // which face was hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL // return the surface tangent at the intersection point
- ) override;
-
- LLVector3 agentPositionToVolume(const LLVector3& pos) const;
- LLVector3 agentDirectionToVolume(const LLVector3& dir) const;
- LLVector3 volumePositionToAgent(const LLVector3& dir) const;
- LLVector3 volumeDirectionToAgent(const LLVector3& dir) const;
-
-
- BOOL getVolumeChanged() const { return mVolumeChanged; }
-
- F32 getVObjRadius() const override { return mVObjRadius; };
- const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const override;
-
- void markForUpdate() override;
- void faceMappingChanged() override { mFaceMappingChanged=TRUE; }
-
- /*virtual*/ void onShift(const LLVector4a &shift_vector) override; // Called when the drawable shifts
-
- /*virtual*/ void parameterChanged(U16 param_type, bool local_origin) override;
- /*virtual*/ void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin) override;
+ S32* face_hit = NULL, // which face was hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL // return the surface tangent at the intersection point
+ ) override;
+
+ LLVector3 agentPositionToVolume(const LLVector3& pos) const;
+ LLVector3 agentDirectionToVolume(const LLVector3& dir) const;
+ LLVector3 volumePositionToAgent(const LLVector3& dir) const;
+ LLVector3 volumeDirectionToAgent(const LLVector3& dir) const;
+
+
+ BOOL getVolumeChanged() const { return mVolumeChanged; }
+
+ F32 getVObjRadius() const override { return mVObjRadius; };
+ const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const override;
+
+ void markForUpdate() override;
+ void faceMappingChanged() override { mFaceMappingChanged=TRUE; }
+
+ /*virtual*/ void onShift(const LLVector4a &shift_vector) override; // Called when the drawable shifts
+
+ /*virtual*/ void parameterChanged(U16 param_type, bool local_origin) override;
+ /*virtual*/ void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin) override;
// update mReflectionProbe based on isReflectionProbe()
void updateReflectionProbePtr();
- /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num, const EObjectUpdateType update_type,
- LLDataPacker *dp) override;
-
- /*virtual*/ void setSelected(BOOL sel) override;
- /*virtual*/ BOOL setDrawableParent(LLDrawable* parentp) override;
-
- /*virtual*/ void setScale(const LLVector3 &scale, BOOL damped) override;
-
- /*virtual*/ void changeTEImage(S32 index, LLViewerTexture* new_image) override;
- /*virtual*/ void setNumTEs(const U8 num_tes) override;
- /*virtual*/ void setTEImage(const U8 te, LLViewerTexture *imagep) override;
- /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid) override;
- /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color) override;
- /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color) override;
- /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump) override;
- /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny) override;
- /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright) override;
- /*virtual*/ S32 setTEBumpShinyFullbright(const U8 te, const U8 bump) override;
- /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags) override;
- /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow) override;
- /*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) override;
-
- static void setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams, U32 te);
-
- /*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) override;
+ /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
+ void **user_data,
+ U32 block_num, const EObjectUpdateType update_type,
+ LLDataPacker *dp) override;
+
+ /*virtual*/ void setSelected(BOOL sel) override;
+ /*virtual*/ BOOL setDrawableParent(LLDrawable* parentp) override;
+
+ /*virtual*/ void setScale(const LLVector3 &scale, BOOL damped) override;
+
+ /*virtual*/ void changeTEImage(S32 index, LLViewerTexture* new_image) override;
+ /*virtual*/ void setNumTEs(const U8 num_tes) override;
+ /*virtual*/ void setTEImage(const U8 te, LLViewerTexture *imagep) override;
+ /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid) override;
+ /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color) override;
+ /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color) override;
+ /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump) override;
+ /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny) override;
+ /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright) override;
+ /*virtual*/ S32 setTEBumpShinyFullbright(const U8 te, const U8 bump) override;
+ /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags) override;
+ /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow) override;
+ /*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) override;
+
+ static void setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams, U32 te);
+
+ /*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) override;
S32 setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* mat) override;
- /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t) override;
- /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s) override;
- /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t) override;
- /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen) override;
- /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media) override;
- /*virtual*/ BOOL setMaterial(const U8 material) override;
-
- void setTexture(const S32 face);
- S32 getIndexInTex(U32 ch) const {return mIndexInTex[ch];}
- /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false) override;
- void updateSculptTexture();
- void setIndexInTex(U32 ch, S32 index) { mIndexInTex[ch] = index ;}
- void sculpt();
- static void rebuildMeshAssetCallback(const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status);
-
- void updateRelativeXform(bool force_identity = false);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable) override;
- /*virtual*/ void updateFaceSize(S32 idx) override;
- /*virtual*/ BOOL updateLOD() override;
- void updateRadius() override;
- /*virtual*/ void updateTextures() override;
- void updateTextureVirtualSize(bool forced = false);
-
- void updateFaceFlags();
- void regenFaces();
+ /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t) override;
+ /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s) override;
+ /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t) override;
+ /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen) override;
+ /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media) override;
+ /*virtual*/ BOOL setMaterial(const U8 material) override;
+
+ void setTexture(const S32 face);
+ S32 getIndexInTex(U32 ch) const {return mIndexInTex[ch];}
+ /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false) override;
+ void updateSculptTexture();
+ void setIndexInTex(U32 ch, S32 index) { mIndexInTex[ch] = index ;}
+ void sculpt();
+ static void rebuildMeshAssetCallback(const LLUUID& asset_uuid,
+ LLAssetType::EType type,
+ void* user_data, S32 status, LLExtStat ext_status);
+
+ void updateRelativeXform(bool force_identity = false);
+ /*virtual*/ BOOL updateGeometry(LLDrawable *drawable) override;
+ /*virtual*/ void updateFaceSize(S32 idx) override;
+ /*virtual*/ BOOL updateLOD() override;
+ void updateRadius() override;
+ /*virtual*/ void updateTextures() override;
+ void updateTextureVirtualSize(bool forced = false);
+
+ void updateFaceFlags();
+ void regenFaces();
BOOL genBBoxes(BOOL force_global, BOOL should_update_octree_bounds = TRUE);
- void preRebuild();
- virtual void updateSpatialExtents(LLVector4a& min, LLVector4a& max) override;
- virtual F32 getBinRadius() override;
-
- virtual U32 getPartitionType() const override;
-
- // For Lights
- void setIsLight(BOOL is_light);
+ void preRebuild();
+ virtual void updateSpatialExtents(LLVector4a& min, LLVector4a& max) override;
+ virtual F32 getBinRadius() override;
+
+ virtual U32 getPartitionType() const override;
+
+ // For Lights
+ void setIsLight(BOOL is_light);
//set the gamma-corrected (sRGB) color of this light
- void setLightSRGBColor(const LLColor3& color);
+ void setLightSRGBColor(const LLColor3& color);
//set the linear color of this light
void setLightLinearColor(const LLColor3& color);
- void setLightIntensity(F32 intensity);
- void setLightRadius(F32 radius);
- void setLightFalloff(F32 falloff);
- void setLightCutoff(F32 cutoff);
- void setLightTextureID(LLUUID id);
- void setSpotLightParams(LLVector3 params);
+ void setLightIntensity(F32 intensity);
+ void setLightRadius(F32 radius);
+ void setLightFalloff(F32 falloff);
+ void setLightCutoff(F32 cutoff);
+ void setLightTextureID(LLUUID id);
+ void setSpotLightParams(LLVector3 params);
- BOOL getIsLight() const;
+ BOOL getIsLight() const;
bool getIsLightFast() const;
// Get the light color in sRGB color space NOT scaled by intensity.
- LLColor3 getLightSRGBBaseColor() const;
+ LLColor3 getLightSRGBBaseColor() const;
// Get the light color in linear color space NOT scaled by intensity.
LLColor3 getLightLinearBaseColor() const;
-
- // Get the light color in linear color space scaled by intensity
+
+ // Get the light color in linear color space scaled by intensity
// this is the value that should be fed into shaders
LLColor3 getLightLinearColor() const;
// Get the light color in sRGB color space scaled by intensity.
- LLColor3 getLightSRGBColor() const;
+ LLColor3 getLightSRGBColor() const;
- LLUUID getLightTextureID() const;
- bool isLightSpotlight() const;
- LLVector3 getSpotLightParams() const;
- void updateSpotLightPriority();
- F32 getSpotLightPriority() const;
+ LLUUID getLightTextureID() const;
+ bool isLightSpotlight() const;
+ LLVector3 getSpotLightParams() const;
+ void updateSpotLightPriority();
+ F32 getSpotLightPriority() const;
- LLViewerTexture* getLightTexture();
- F32 getLightIntensity() const;
- F32 getLightRadius() const;
- F32 getLightFalloff(const F32 fudge_factor = 1.f) const;
- F32 getLightCutoff() const;
+ LLViewerTexture* getLightTexture();
+ F32 getLightIntensity() const;
+ F32 getLightRadius() const;
+ F32 getLightFalloff(const F32 fudge_factor = 1.f) const;
+ F32 getLightCutoff() const;
// Reflection Probes
bool setIsReflectionProbe(BOOL is_probe);
@@ -308,13 +308,13 @@ public:
bool getReflectionProbeIsBox() const;
bool getReflectionProbeIsDynamic() const;
- // Flexible Objects
- U32 getVolumeInterfaceID() const;
- virtual BOOL isFlexible() const override;
- virtual BOOL isSculpted() const override;
- virtual BOOL isMesh() const override;
- virtual BOOL isRiggedMesh() const override;
- virtual BOOL hasLightTexture() const override;
+ // Flexible Objects
+ U32 getVolumeInterfaceID() const;
+ virtual BOOL isFlexible() const override;
+ virtual BOOL isSculpted() const override;
+ virtual BOOL isMesh() const override;
+ virtual BOOL isRiggedMesh() const override;
+ virtual BOOL hasLightTexture() const override;
// fast variants above that use state that is filled in later
// not reliable early in the life of an object, but should be used after
@@ -325,16 +325,16 @@ public:
bool isRiggedMeshFast() const;
bool isAnimatedObjectFast() const;
- BOOL isVolumeGlobal() const;
- BOOL canBeFlexible() const;
- BOOL setIsFlexible(BOOL is_flexible);
+ BOOL isVolumeGlobal() const;
+ BOOL canBeFlexible() const;
+ BOOL setIsFlexible(BOOL is_flexible);
const LLMeshSkinInfo* getSkinInfo() const;
const bool isSkinInfoUnavaliable() const { return mSkinInfoUnavaliable; }
//convenience accessor for mesh ID (which is stored in sculpt id for legacy reasons)
const LLUUID& getMeshID() const { return getVolume()->getParams().getSculptID(); }
-
+
// Extended Mesh Properties
U32 getExtendedMeshFlags() const;
void onSetExtendedMeshFlags(U32 flags);
@@ -347,58 +347,58 @@ public:
//virtual
void updateRiggingInfo() override;
S32 mLastRiggingInfoLOD;
-
+
// Functions that deal with media, or media navigation
-
+
// Update this object's media data with the given media data array
// (typically this is only called upon a response from a server request)
- void updateObjectMediaData(const LLSD &media_data_array, const std::string &media_version);
-
+ void updateObjectMediaData(const LLSD &media_data_array, const std::string &media_version);
+
// Bounce back media at the given index to its current URL (or home URL, if current URL is empty)
- void mediaNavigateBounceBack(U8 texture_index);
-
- // Returns whether or not this object has permission to navigate or control
- // the given media entry
- enum MediaPermType {
- MEDIA_PERM_INTERACT, MEDIA_PERM_CONTROL
- };
+ void mediaNavigateBounceBack(U8 texture_index);
+
+ // Returns whether or not this object has permission to navigate or control
+ // the given media entry
+ enum MediaPermType {
+ MEDIA_PERM_INTERACT, MEDIA_PERM_CONTROL
+ };
bool hasMediaPermission(const LLMediaEntry* media_entry, MediaPermType perm_type);
-
- void mediaNavigated(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, std::string new_location);
- void mediaEvent(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, LLViewerMediaObserver::EMediaEvent event);
-
-
- // Sync the given media data with the impl and the given te
- void syncMediaData(S32 te, const LLSD &media_data, bool merge, bool ignore_agent);
-
- // Send media data update to the simulator.
- void sendMediaDataUpdate();
-
- viewer_media_t getMediaImpl(U8 face_id) const;
- S32 getFaceIndexWithMediaImpl(const LLViewerMediaImpl* media_impl, S32 start_face_id);
- F64 getTotalMediaInterest() const;
-
- bool hasMedia() const;
-
- LLVector3 getApproximateFaceNormal(U8 face_id);
+
+ void mediaNavigated(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, std::string new_location);
+ void mediaEvent(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, LLViewerMediaObserver::EMediaEvent event);
+
+
+ // Sync the given media data with the impl and the given te
+ void syncMediaData(S32 te, const LLSD &media_data, bool merge, bool ignore_agent);
+
+ // Send media data update to the simulator.
+ void sendMediaDataUpdate();
+
+ viewer_media_t getMediaImpl(U8 face_id) const;
+ S32 getFaceIndexWithMediaImpl(const LLViewerMediaImpl* media_impl, S32 start_face_id);
+ F64 getTotalMediaInterest() const;
+
+ bool hasMedia() const;
+
+ LLVector3 getApproximateFaceNormal(U8 face_id);
// Flag any corresponding avatars as needing update.
void updateVisualComplexity();
-
- void notifyMeshLoaded();
- void notifySkinInfoLoaded(const LLMeshSkinInfo* skin);
- void notifySkinInfoUnavailable();
-
- // Returns 'true' iff the media data for this object is in flight
- bool isMediaDataBeingFetched() const;
-
- // Returns the "last fetched" media version, or -1 if not fetched yet
- S32 getLastFetchedMediaVersion() const { return mLastFetchedMediaVersion; }
-
- void addMDCImpl() { ++mMDCImplCount; }
- void removeMDCImpl() { --mMDCImplCount; }
- S32 getMDCImplCount() { return mMDCImplCount; }
-
+
+ void notifyMeshLoaded();
+ void notifySkinInfoLoaded(const LLMeshSkinInfo* skin);
+ void notifySkinInfoUnavailable();
+
+ // Returns 'true' iff the media data for this object is in flight
+ bool isMediaDataBeingFetched() const;
+
+ // Returns the "last fetched" media version, or -1 if not fetched yet
+ S32 getLastFetchedMediaVersion() const { return mLastFetchedMediaVersion; }
+
+ void addMDCImpl() { ++mMDCImplCount; }
+ void removeMDCImpl() { --mMDCImplCount; }
+ S32 getMDCImplCount() { return mMDCImplCount; }
+
// Rigged volume update (for raycasting)
// By default, this updates the bounding boxes of all the faces and builds an octree for precise per-triangle raycasting
@@ -406,69 +406,69 @@ public:
bool force_treat_as_rigged,
LLRiggedVolume::FaceIndex face_index = LLRiggedVolume::UPDATE_ALL_FACES,
bool rebuild_face_octrees = true);
- LLRiggedVolume* getRiggedVolume();
+ LLRiggedVolume* getRiggedVolume();
- //returns true if volume should be treated as a rigged volume
- // - Build tools are open
- // - object is an attachment
- // - object is attached to self
- // - object is rendered as rigged
- bool treatAsRigged();
+ //returns true if volume should be treated as a rigged volume
+ // - Build tools are open
+ // - object is an attachment
+ // - object is attached to self
+ // - object is rendered as rigged
+ bool treatAsRigged();
- //clear out rigged volume and revert back to non-rigged state for picking/LOD/distance updates
- void clearRiggedVolume();
+ //clear out rigged volume and revert back to non-rigged state for picking/LOD/distance updates
+ void clearRiggedVolume();
protected:
- S32 computeLODDetail(F32 distance, F32 radius, F32 lod_factor);
- BOOL calcLOD();
- LLFace* addFace(S32 face_index);
-
- // stats tracking for render complexity
- static S32 mRenderComplexity_last;
- static S32 mRenderComplexity_current;
+ S32 computeLODDetail(F32 distance, F32 radius, F32 lod_factor);
+ BOOL calcLOD();
+ LLFace* addFace(S32 face_index);
+
+ // stats tracking for render complexity
+ static S32 mRenderComplexity_last;
+ static S32 mRenderComplexity_current;
void onDrawableUpdateFromServer();
- void requestMediaDataUpdate(bool isNew);
- void cleanUpMediaImpls();
- void addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index) ;
- void removeMediaImpl(S32 texture_index) ;
+ void requestMediaDataUpdate(bool isNew);
+ void cleanUpMediaImpls();
+ void addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index) ;
+ void removeMediaImpl(S32 texture_index) ;
private:
bool lodOrSculptChanged(LLDrawable *drawable, BOOL &compiled, BOOL &shouldUpdateOctreeBounds);
public:
- static S32 getRenderComplexityMax() {return mRenderComplexity_last;}
- static void updateRenderComplexity();
+ static S32 getRenderComplexityMax() {return mRenderComplexity_last;}
+ static void updateRenderComplexity();
- LLViewerTextureAnim *mTextureAnimp;
- U8 mTexAnimMode;
+ LLViewerTextureAnim *mTextureAnimp;
+ U8 mTexAnimMode;
F32 mLODDistance;
F32 mLODAdjustedDistance;
F32 mLODRadius;
private:
- friend class LLDrawable;
- friend class LLFace;
-
- BOOL mFaceMappingChanged;
- LLFrameTimer mTextureUpdateTimer;
- S32 mLOD;
- BOOL mLODChanged;
- BOOL mSculptChanged;
- BOOL mColorChanged;
- F32 mSpotLightPriority;
- LLMatrix4 mRelativeXform;
- LLMatrix3 mRelativeXformInvTrans;
- BOOL mVolumeChanged;
- F32 mVObjRadius;
- LLVolumeInterface *mVolumeImpl;
- LLPointer<LLViewerFetchedTexture> mSculptTexture;
- LLPointer<LLViewerFetchedTexture> mLightTexture;
- media_list_t mMediaImplList;
- S32 mLastFetchedMediaVersion; // as fetched from the server, starts as -1
+ friend class LLDrawable;
+ friend class LLFace;
+
+ BOOL mFaceMappingChanged;
+ LLFrameTimer mTextureUpdateTimer;
+ S32 mLOD;
+ BOOL mLODChanged;
+ BOOL mSculptChanged;
+ BOOL mColorChanged;
+ F32 mSpotLightPriority;
+ LLMatrix4 mRelativeXform;
+ LLMatrix3 mRelativeXformInvTrans;
+ BOOL mVolumeChanged;
+ F32 mVObjRadius;
+ LLVolumeInterface *mVolumeImpl;
+ LLPointer<LLViewerFetchedTexture> mSculptTexture;
+ LLPointer<LLViewerFetchedTexture> mLightTexture;
+ media_list_t mMediaImplList;
+ S32 mLastFetchedMediaVersion; // as fetched from the server, starts as -1
U32 mServerDrawableUpdateCount;
- S32 mIndexInTex[LLRender::NUM_VOLUME_TEXTURE_CHANNELS];
- S32 mMDCImplCount;
+ S32 mIndexInTex[LLRender::NUM_VOLUME_TEXTURE_CHANNELS];
+ S32 mMDCImplCount;
// cached value of getIsLight to avoid redundant map lookups
// accessed by getIsLightFast
@@ -477,24 +477,24 @@ private:
// cached value of getIsAnimatedObject to avoid redundant map lookups
// accessed by getIsAnimatedObjectFast
mutable bool mIsAnimatedObject = false;
- bool mResetDebugText;
+ bool mResetDebugText;
- LLPointer<LLRiggedVolume> mRiggedVolume;
+ LLPointer<LLRiggedVolume> mRiggedVolume;
- bool mSkinInfoUnavaliable;
- LLConstPointer<LLMeshSkinInfo> mSkinInfo;
- // statics
+ bool mSkinInfoUnavaliable;
+ LLConstPointer<LLMeshSkinInfo> mSkinInfo;
+ // statics
public:
- static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop
- static F32 sLODFactor; // LOD scale factor
- static F32 sDistanceFactor; // LOD distance factor
+ static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop
+ static F32 sLODFactor; // LOD scale factor
+ static F32 sDistanceFactor; // LOD distance factor
- static LLPointer<LLObjectMediaDataClient> sObjectMediaClient;
- static LLPointer<LLObjectMediaNavigateClient> sObjectMediaNavigateClient;
+ static LLPointer<LLObjectMediaDataClient> sObjectMediaClient;
+ static LLPointer<LLObjectMediaNavigateClient> sObjectMediaNavigateClient;
protected:
- static S32 sNumLODChanges;
+ static S32 sNumLODChanges;
- friend class LLVolumeImplFlexible;
+ friend class LLVolumeImplFlexible;
};
#endif // LL_LLVOVOLUME_H
diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp
index 77ad967cef..b2af6c70d3 100644
--- a/indra/newview/llvowater.cpp
+++ b/indra/newview/llvowater.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvowater.cpp
* @brief LLVOWater class implementation
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,40 +46,40 @@
template<class T> inline T LERP(T a, T b, F32 factor)
{
- return a + (b - a) * factor;
+ return a + (b - a) * factor;
}
-LLVOWater::LLVOWater(const LLUUID &id,
- const LLPCode pcode,
- LLViewerRegion *regionp) :
- LLStaticViewerObject(id, pcode, regionp),
- mRenderType(LLPipeline::RENDER_TYPE_WATER)
+LLVOWater::LLVOWater(const LLUUID &id,
+ const LLPCode pcode,
+ LLViewerRegion *regionp) :
+ LLStaticViewerObject(id, pcode, regionp),
+ mRenderType(LLPipeline::RENDER_TYPE_WATER)
{
- // Terrain must draw during selection passes so it can block objects behind it.
- mbCanSelect = FALSE;
- setScale(LLVector3(256.f, 256.f, 0.f)); // Hack for setting scale for bounding boxes/visibility.
+ // Terrain must draw during selection passes so it can block objects behind it.
+ mbCanSelect = FALSE;
+ setScale(LLVector3(256.f, 256.f, 0.f)); // Hack for setting scale for bounding boxes/visibility.
- mUseTexture = TRUE;
- mIsEdgePatch = FALSE;
+ mUseTexture = TRUE;
+ mIsEdgePatch = FALSE;
}
void LLVOWater::markDead()
{
- LLViewerObject::markDead();
+ LLViewerObject::markDead();
}
BOOL LLVOWater::isActive() const
{
- return FALSE;
+ return FALSE;
}
void LLVOWater::setPixelAreaAndAngle(LLAgent &agent)
{
- mAppAngle = 50;
- mPixelArea = 500*500;
+ mAppAngle = 50;
+ mPixelArea = 500*500;
}
@@ -95,52 +95,52 @@ void LLVOWater::idleUpdate(LLAgent &agent, const F64 &time)
LLDrawable *LLVOWater::createDrawable(LLPipeline *pipeline)
{
- pipeline->allocDrawable(this);
- mDrawable->setLit(FALSE);
- mDrawable->setRenderType(mRenderType);
-
- LLDrawPoolWater *pool = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER);
-
- if (mUseTexture)
- {
- mDrawable->setNumFaces(1, pool, mRegionp->getLand().getWaterTexture());
- }
- else
- {
- mDrawable->setNumFaces(1, pool, LLWorld::getInstance()->getDefaultWaterTexture());
- }
-
- return mDrawable;
+ pipeline->allocDrawable(this);
+ mDrawable->setLit(FALSE);
+ mDrawable->setRenderType(mRenderType);
+
+ LLDrawPoolWater *pool = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER);
+
+ if (mUseTexture)
+ {
+ mDrawable->setNumFaces(1, pool, mRegionp->getLand().getWaterTexture());
+ }
+ else
+ {
+ mDrawable->setNumFaces(1, pool, LLWorld::getInstance()->getDefaultWaterTexture());
+ }
+
+ return mDrawable;
}
BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
{
LL_PROFILE_ZONE_SCOPED;
- LLFace *face;
+ LLFace *face;
- if (drawable->getNumFaces() < 1)
- {
- LLDrawPoolWater *poolp = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER);
- drawable->addFace(poolp, NULL);
- }
- face = drawable->getFace(0);
- if (!face)
- {
- return TRUE;
- }
+ if (drawable->getNumFaces() < 1)
+ {
+ LLDrawPoolWater *poolp = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER);
+ drawable->addFace(poolp, NULL);
+ }
+ face = drawable->getFace(0);
+ if (!face)
+ {
+ return TRUE;
+ }
-// LLVector2 uvs[4];
-// LLVector3 vtx[4];
+// LLVector2 uvs[4];
+// LLVector3 vtx[4];
- LLStrider<LLVector3> verticesp, normalsp;
- LLStrider<LLVector2> texCoordsp;
- LLStrider<U16> indicesp;
- U16 index_offset;
+ LLStrider<LLVector3> verticesp, normalsp;
+ LLStrider<LLVector2> texCoordsp;
+ LLStrider<U16> indicesp;
+ U16 index_offset;
- // A quad is 4 vertices and 6 indices (making 2 triangles)
- static const unsigned int vertices_per_quad = 4;
- static const unsigned int indices_per_quad = 6;
+ // A quad is 4 vertices and 6 indices (making 2 triangles)
+ static const unsigned int vertices_per_quad = 4;
+ static const unsigned int indices_per_quad = 6;
S32 size_x = LLPipeline::sRenderTransparentWater ? 8 : 1;
S32 size_y = LLPipeline::sRenderTransparentWater ? 8 : 1;
@@ -149,89 +149,89 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
size_x *= llmin(llround(scale.mV[0] / 256.f), 8);
size_y *= llmin(llround(scale.mV[1] / 256.f), 8);
- const S32 num_quads = size_x * size_y;
- face->setSize(vertices_per_quad * num_quads,
- indices_per_quad * num_quads);
-
- LLVertexBuffer* buff = face->getVertexBuffer();
- if (!buff ||
- buff->getNumIndices() != face->getIndicesCount() ||
+ const S32 num_quads = size_x * size_y;
+ face->setSize(vertices_per_quad * num_quads,
+ indices_per_quad * num_quads);
+
+ LLVertexBuffer* buff = face->getVertexBuffer();
+ if (!buff ||
+ buff->getNumIndices() != face->getIndicesCount() ||
buff->getNumVerts() != face->getGeomCount() ||
face->getIndicesStart() != 0 ||
face->getGeomIndex() != 0)
- {
- buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK);
- if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount()))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer on water update to "
- << face->getGeomCount() << " vertices and "
- << face->getIndicesCount() << " indices" << LL_ENDL;
- }
- face->setIndicesIndex(0);
- face->setGeomIndex(0);
- face->setVertexBuffer(buff);
- }
-
- index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
-
- LLVector3 position_agent;
- position_agent = getPositionAgent();
- face->mCenterAgent = position_agent;
- face->mCenterLocal = position_agent;
-
- S32 x, y;
- F32 step_x = getScale().mV[0] / size_x;
- F32 step_y = getScale().mV[1] / size_y;
-
- const LLVector3 up(0.f, step_y * 0.5f, 0.f);
- const LLVector3 right(step_x * 0.5f, 0.f, 0.f);
- const LLVector3 normal(0.f, 0.f, 1.f);
-
- F32 size_inv_x = 1.f / size_x;
+ {
+ buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK);
+ if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount()))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer on water update to "
+ << face->getGeomCount() << " vertices and "
+ << face->getIndicesCount() << " indices" << LL_ENDL;
+ }
+ face->setIndicesIndex(0);
+ face->setGeomIndex(0);
+ face->setVertexBuffer(buff);
+ }
+
+ index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
+
+ LLVector3 position_agent;
+ position_agent = getPositionAgent();
+ face->mCenterAgent = position_agent;
+ face->mCenterLocal = position_agent;
+
+ S32 x, y;
+ F32 step_x = getScale().mV[0] / size_x;
+ F32 step_y = getScale().mV[1] / size_y;
+
+ const LLVector3 up(0.f, step_y * 0.5f, 0.f);
+ const LLVector3 right(step_x * 0.5f, 0.f, 0.f);
+ const LLVector3 normal(0.f, 0.f, 1.f);
+
+ F32 size_inv_x = 1.f / size_x;
F32 size_inv_y = 1.f / size_y;
- for (y = 0; y < size_y; y++)
- {
- for (x = 0; x < size_x; x++)
- {
- S32 toffset = index_offset + 4*(y*size_x + x);
- position_agent = getPositionAgent() - getScale() * 0.5f;
- position_agent.mV[VX] += (x + 0.5f) * step_x;
- position_agent.mV[VY] += (y + 0.5f) * step_y;
+ for (y = 0; y < size_y; y++)
+ {
+ for (x = 0; x < size_x; x++)
+ {
+ S32 toffset = index_offset + 4*(y*size_x + x);
+ position_agent = getPositionAgent() - getScale() * 0.5f;
+ position_agent.mV[VX] += (x + 0.5f) * step_x;
+ position_agent.mV[VY] += (y + 0.5f) * step_y;
position_agent.mV[VX] = llround(position_agent.mV[VX]);
position_agent.mV[VY] = llround(position_agent.mV[VY]);
- *verticesp++ = position_agent - right + up;
- *verticesp++ = position_agent - right - up;
- *verticesp++ = position_agent + right + up;
- *verticesp++ = position_agent + right - up;
-
- *texCoordsp++ = LLVector2(x*size_inv_x, (y+1)*size_inv_y);
- *texCoordsp++ = LLVector2(x*size_inv_x, y*size_inv_y);
- *texCoordsp++ = LLVector2((x+1)*size_inv_x, (y+1)*size_inv_y);
- *texCoordsp++ = LLVector2((x+1)*size_inv_x, y*size_inv_y);
-
- *normalsp++ = normal;
- *normalsp++ = normal;
- *normalsp++ = normal;
- *normalsp++ = normal;
-
- *indicesp++ = toffset + 0;
- *indicesp++ = toffset + 1;
- *indicesp++ = toffset + 2;
-
- *indicesp++ = toffset + 1;
- *indicesp++ = toffset + 3;
- *indicesp++ = toffset + 2;
- }
- }
-
- buff->unmapBuffer();
-
- mDrawable->movePartition();
- LLPipeline::sCompiles++;
- return TRUE;
+ *verticesp++ = position_agent - right + up;
+ *verticesp++ = position_agent - right - up;
+ *verticesp++ = position_agent + right + up;
+ *verticesp++ = position_agent + right - up;
+
+ *texCoordsp++ = LLVector2(x*size_inv_x, (y+1)*size_inv_y);
+ *texCoordsp++ = LLVector2(x*size_inv_x, y*size_inv_y);
+ *texCoordsp++ = LLVector2((x+1)*size_inv_x, (y+1)*size_inv_y);
+ *texCoordsp++ = LLVector2((x+1)*size_inv_x, y*size_inv_y);
+
+ *normalsp++ = normal;
+ *normalsp++ = normal;
+ *normalsp++ = normal;
+ *normalsp++ = normal;
+
+ *indicesp++ = toffset + 0;
+ *indicesp++ = toffset + 1;
+ *indicesp++ = toffset + 2;
+
+ *indicesp++ = toffset + 1;
+ *indicesp++ = toffset + 3;
+ *indicesp++ = toffset + 2;
+ }
+ }
+
+ buff->unmapBuffer();
+
+ mDrawable->movePartition();
+ LLPipeline::sCompiles++;
+ return TRUE;
}
void LLVOWater::initClass()
@@ -244,64 +244,64 @@ void LLVOWater::cleanupClass()
void setVecZ(LLVector3& v)
{
- v.mV[VX] = 0;
- v.mV[VY] = 0;
- v.mV[VZ] = 1;
+ v.mV[VX] = 0;
+ v.mV[VY] = 0;
+ v.mV[VZ] = 1;
}
void LLVOWater::setUseTexture(const BOOL use_texture)
{
- mUseTexture = use_texture;
+ mUseTexture = use_texture;
}
void LLVOWater::setIsEdgePatch(const BOOL edge_patch)
{
- mIsEdgePatch = edge_patch;
+ mIsEdgePatch = edge_patch;
}
void LLVOWater::updateSpatialExtents(LLVector4a &newMin, LLVector4a& newMax)
{
- LLVector4a pos;
- pos.load3(getPositionAgent().mV);
- LLVector4a scale;
- scale.load3(getScale().mV);
- scale.mul(0.5f);
-
- newMin.setSub(pos, scale);
- newMax.setAdd(pos, scale);
-
- pos.setAdd(newMin,newMax);
- pos.mul(0.5f);
-
- mDrawable->setPositionGroup(pos);
+ LLVector4a pos;
+ pos.load3(getPositionAgent().mV);
+ LLVector4a scale;
+ scale.load3(getScale().mV);
+ scale.mul(0.5f);
+
+ newMin.setSub(pos, scale);
+ newMax.setAdd(pos, scale);
+
+ pos.setAdd(newMin,newMax);
+ pos.mul(0.5f);
+
+ mDrawable->setPositionGroup(pos);
}
U32 LLVOWater::getPartitionType() const
-{
- if (mIsEdgePatch)
- {
- return LLViewerRegion::PARTITION_VOIDWATER;
- }
+{
+ if (mIsEdgePatch)
+ {
+ return LLViewerRegion::PARTITION_VOIDWATER;
+ }
- return LLViewerRegion::PARTITION_WATER;
+ return LLViewerRegion::PARTITION_WATER;
}
U32 LLVOVoidWater::getPartitionType() const
{
- return LLViewerRegion::PARTITION_VOIDWATER;
+ return LLViewerRegion::PARTITION_VOIDWATER;
}
LLWaterPartition::LLWaterPartition(LLViewerRegion* regionp)
: LLSpatialPartition(0, FALSE, regionp)
{
- mInfiniteFarClip = TRUE;
- mDrawableType = LLPipeline::RENDER_TYPE_WATER;
- mPartitionType = LLViewerRegion::PARTITION_WATER;
+ mInfiniteFarClip = TRUE;
+ mDrawableType = LLPipeline::RENDER_TYPE_WATER;
+ mPartitionType = LLViewerRegion::PARTITION_WATER;
}
LLVoidWaterPartition::LLVoidWaterPartition(LLViewerRegion* regionp) : LLWaterPartition(regionp)
{
- mOcclusionEnabled = FALSE;
- mDrawableType = LLPipeline::RENDER_TYPE_VOIDWATER;
- mPartitionType = LLViewerRegion::PARTITION_VOIDWATER;
+ mOcclusionEnabled = FALSE;
+ mDrawableType = LLPipeline::RENDER_TYPE_VOIDWATER;
+ mPartitionType = LLViewerRegion::PARTITION_VOIDWATER;
}
diff --git a/indra/newview/llvowater.h b/indra/newview/llvowater.h
index 7a8d819215..157a7f4891 100644
--- a/indra/newview/llvowater.h
+++ b/indra/newview/llvowater.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvowater.h
* @brief Description of LLVOWater class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,8 +32,8 @@
#include "pipeline.h"
#include "v2math.h"
-const U32 N_RES = 16; //32 // number of subdivisions of wave tile
-const U8 WAVE_STEP = 8;
+const U32 N_RES = 16; //32 // number of subdivisions of wave tile
+const U8 WAVE_STEP = 8;
class LLSurface;
class LLHeavenBody;
@@ -43,53 +43,53 @@ class LLFace;
class LLVOWater : public LLStaticViewerObject
{
public:
- enum
- {
- VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
- (1 << LLVertexBuffer::TYPE_NORMAL) |
- (1 << LLVertexBuffer::TYPE_TEXCOORD0)
- };
+ enum
+ {
+ VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
+ (1 << LLVertexBuffer::TYPE_NORMAL) |
+ (1 << LLVertexBuffer::TYPE_TEXCOORD0)
+ };
- LLVOWater(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+ LLVOWater(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
- /*virtual*/ void markDead();
+ /*virtual*/ void markDead();
- // Initialize data that's only inited once per class.
- static void initClass();
- static void cleanupClass();
+ // Initialize data that's only inited once per class.
+ static void initClass();
+ static void cleanupClass();
- /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
- /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
- /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
+ /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
+ /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
+ /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
+ /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
- /*virtual*/ void updateTextures();
- /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
+ /*virtual*/ void updateTextures();
+ /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
- virtual U32 getPartitionType() const;
+ virtual U32 getPartitionType() const;
- /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
+ /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
- void setUseTexture(const BOOL use_texture);
- void setIsEdgePatch(const BOOL edge_patch);
- BOOL getUseTexture() const { return mUseTexture; }
- BOOL getIsEdgePatch() const { return mIsEdgePatch; }
+ void setUseTexture(const BOOL use_texture);
+ void setIsEdgePatch(const BOOL edge_patch);
+ BOOL getUseTexture() const { return mUseTexture; }
+ BOOL getIsEdgePatch() const { return mIsEdgePatch; }
protected:
- BOOL mUseTexture;
- BOOL mIsEdgePatch;
- S32 mRenderType;
+ BOOL mUseTexture;
+ BOOL mIsEdgePatch;
+ S32 mRenderType;
};
class LLVOVoidWater : public LLVOWater
{
public:
- LLVOVoidWater(LLUUID const& id, LLPCode pcode, LLViewerRegion* regionp) : LLVOWater(id, pcode, regionp)
- {
- mRenderType = LLPipeline::RENDER_TYPE_VOIDWATER;
- }
+ LLVOVoidWater(LLUUID const& id, LLPCode pcode, LLViewerRegion* regionp) : LLVOWater(id, pcode, regionp)
+ {
+ mRenderType = LLPipeline::RENDER_TYPE_VOIDWATER;
+ }
- /*virtual*/ U32 getPartitionType() const;
+ /*virtual*/ U32 getPartitionType() const;
};
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index 9b2871c6a9..776d65487c 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvowlsky.cpp
* @brief LLVOWLSky class implementation
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,60 +41,60 @@ constexpr U32 MAX_SKY_DETAIL = 180;
inline U32 LLVOWLSky::getNumStacks(void)
{
- return llmin(MAX_SKY_DETAIL, llmax(MIN_SKY_DETAIL, gSavedSettings.getU32("WLSkyDetail")));
+ return llmin(MAX_SKY_DETAIL, llmax(MIN_SKY_DETAIL, gSavedSettings.getU32("WLSkyDetail")));
}
inline U32 LLVOWLSky::getNumSlices(void)
{
- return 2 * llmin(MAX_SKY_DETAIL, llmax(MIN_SKY_DETAIL, gSavedSettings.getU32("WLSkyDetail")));
+ return 2 * llmin(MAX_SKY_DETAIL, llmax(MIN_SKY_DETAIL, gSavedSettings.getU32("WLSkyDetail")));
}
inline U32 LLVOWLSky::getStripsNumVerts(void)
{
- return (getNumStacks() - 1) * getNumSlices();
+ return (getNumStacks() - 1) * getNumSlices();
}
inline U32 LLVOWLSky::getStripsNumIndices(void)
{
- return 2 * ((getNumStacks() - 2) * (getNumSlices() + 1)) + 1 ;
+ return 2 * ((getNumStacks() - 2) * (getNumSlices() + 1)) + 1 ;
}
inline U32 LLVOWLSky::getStarsNumVerts(void)
{
- return 1000;
+ return 1000;
}
inline U32 LLVOWLSky::getStarsNumIndices(void)
{
- return 1000;
+ return 1000;
}
LLVOWLSky::LLVOWLSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
- : LLStaticViewerObject(id, pcode, regionp, TRUE)
+ : LLStaticViewerObject(id, pcode, regionp, TRUE)
{
- initStars();
+ initStars();
}
void LLVOWLSky::idleUpdate(LLAgent &agent, const F64 &time)
{
-
+
}
BOOL LLVOWLSky::isActive(void) const
{
- return FALSE;
+ return FALSE;
}
LLDrawable * LLVOWLSky::createDrawable(LLPipeline * pipeline)
{
- pipeline->allocDrawable(this);
+ pipeline->allocDrawable(this);
- //LLDrawPoolWLSky *poolp = static_cast<LLDrawPoolWLSky *>(
- gPipeline.getPool(LLDrawPool::POOL_WL_SKY);
+ //LLDrawPoolWLSky *poolp = static_cast<LLDrawPoolWLSky *>(
+ gPipeline.getPool(LLDrawPool::POOL_WL_SKY);
- mDrawable->setRenderType(LLPipeline::RENDER_TYPE_WL_SKY);
+ mDrawable->setRenderType(LLPipeline::RENDER_TYPE_WL_SKY);
- return mDrawable;
+ return mDrawable;
}
// a tiny helper function for controlling the sky dome tesselation.
@@ -103,274 +103,274 @@ inline F32 calcPhi(const U32 &i, const F32 &reciprocal_num_stacks)
// Calc: PI/8 * 1-((1-t^4)*(1-t^4)) { 0<t<1 }
// Demos: \pi/8*\left(1-((1-x^{4})*(1-x^{4}))\right)\ \left\{0<x\le1\right\}
- // i should range from [0..SKY_STACKS] so t will range from [0.f .. 1.f]
- F32 t = float(i) * reciprocal_num_stacks; //SL-16127: remove: / float(getNumStacks());
+ // i should range from [0..SKY_STACKS] so t will range from [0.f .. 1.f]
+ F32 t = float(i) * reciprocal_num_stacks; //SL-16127: remove: / float(getNumStacks());
- // ^4 the parameter of the tesselation to bias things toward 0 (the dome's apex)
- t *= t;
- t *= t;
+ // ^4 the parameter of the tesselation to bias things toward 0 (the dome's apex)
+ t *= t;
+ t *= t;
- // invert and square the parameter of the tesselation to bias things toward 1 (the horizon)
- t = 1.f - t;
- t = t*t;
- t = 1.f - t;
+ // invert and square the parameter of the tesselation to bias things toward 1 (the horizon)
+ t = 1.f - t;
+ t = t*t;
+ t = 1.f - t;
- return (F_PI / 8.f) * t;
+ return (F_PI / 8.f) * t;
}
void LLVOWLSky::resetVertexBuffers()
{
- mStripsVerts.clear();
- mStarsVerts = nullptr;
+ mStripsVerts.clear();
+ mStarsVerts = nullptr;
mFsSkyVerts = nullptr;
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
}
-
+
void LLVOWLSky::cleanupGL()
{
- mStripsVerts.clear();
- mStarsVerts = nullptr;
+ mStripsVerts.clear();
+ mStarsVerts = nullptr;
mFsSkyVerts = nullptr;
- LLDrawPoolWLSky::cleanupGL();
+ LLDrawPoolWLSky::cleanupGL();
}
void LLVOWLSky::restoreGL()
{
- LLDrawPoolWLSky::restoreGL();
- gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
+ LLDrawPoolWLSky::restoreGL();
+ gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL);
}
BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
{
LL_PROFILE_ZONE_SCOPED;
- LLStrider<LLVector3> vertices;
- LLStrider<LLVector2> texCoords;
- LLStrider<U16> indices;
+ LLStrider<LLVector3> vertices;
+ LLStrider<LLVector2> texCoords;
+ LLStrider<U16> indices;
if (mFsSkyVerts.isNull())
{
mFsSkyVerts = new LLVertexBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK);
if (!mFsSkyVerts->allocateBuffer(4, 6))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer on full screen sky update" << LL_ENDL;
- }
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer on full screen sky update" << LL_ENDL;
+ }
- BOOL success = mFsSkyVerts->getVertexStrider(vertices)
- && mFsSkyVerts->getTexCoord0Strider(texCoords)
- && mFsSkyVerts->getIndexStrider(indices);
+ BOOL success = mFsSkyVerts->getVertexStrider(vertices)
+ && mFsSkyVerts->getTexCoord0Strider(texCoords)
+ && mFsSkyVerts->getIndexStrider(indices);
- if(!success)
- {
- LL_ERRS() << "Failed updating WindLight fullscreen sky geometry." << LL_ENDL;
- }
+ if(!success)
+ {
+ LL_ERRS() << "Failed updating WindLight fullscreen sky geometry." << LL_ENDL;
+ }
*vertices++ = LLVector3(-1.0f, -1.0f, 0.0f);
*vertices++ = LLVector3( 1.0f, -1.0f, 0.0f);
*vertices++ = LLVector3(-1.0f, 1.0f, 0.0f);
*vertices++ = LLVector3( 1.0f, 1.0f, 0.0f);
- *texCoords++ = LLVector2(0.0f, 0.0f);
+ *texCoords++ = LLVector2(0.0f, 0.0f);
*texCoords++ = LLVector2(1.0f, 0.0f);
*texCoords++ = LLVector2(0.0f, 1.0f);
*texCoords++ = LLVector2(1.0f, 1.0f);
- *indices++ = 0;
- *indices++ = 1;
- *indices++ = 2;
+ *indices++ = 0;
+ *indices++ = 1;
+ *indices++ = 2;
*indices++ = 1;
- *indices++ = 3;
- *indices++ = 2;
+ *indices++ = 3;
+ *indices++ = 2;
mFsSkyVerts->unmapBuffer();
}
- {
+ {
const F32 dome_radius = LLEnvironment::instance().getCurrentSky()->getDomeRadius();
- const U32 max_buffer_bytes = gSavedSettings.getS32("RenderMaxVBOSize")*1024;
- const U32 data_mask = LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK;
- const U32 max_verts = max_buffer_bytes / LLVertexBuffer::calcVertexSize(data_mask);
+ const U32 max_buffer_bytes = gSavedSettings.getS32("RenderMaxVBOSize")*1024;
+ const U32 data_mask = LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK;
+ const U32 max_verts = max_buffer_bytes / LLVertexBuffer::calcVertexSize(data_mask);
- const U32 total_stacks = getNumStacks();
+ const U32 total_stacks = getNumStacks();
- const U32 verts_per_stack = getNumSlices();
+ const U32 verts_per_stack = getNumSlices();
- // each seg has to have one more row of verts than it has stacks
- // then round down
- const U32 stacks_per_seg = (max_verts - verts_per_stack) / verts_per_stack;
+ // each seg has to have one more row of verts than it has stacks
+ // then round down
+ const U32 stacks_per_seg = (max_verts - verts_per_stack) / verts_per_stack;
- // round up to a whole number of segments
- const U32 strips_segments = (total_stacks+stacks_per_seg-1) / stacks_per_seg;
+ // round up to a whole number of segments
+ const U32 strips_segments = (total_stacks+stacks_per_seg-1) / stacks_per_seg;
- mStripsVerts.resize(strips_segments, NULL);
+ mStripsVerts.resize(strips_segments, NULL);
#if RELEASE_SHOW_DEBUG
- LL_INFOS() << "WL Skydome strips in " << strips_segments << " batches." << LL_ENDL;
+ LL_INFOS() << "WL Skydome strips in " << strips_segments << " batches." << LL_ENDL;
- LLTimer timer;
- timer.start();
+ LLTimer timer;
+ timer.start();
#endif
- for (U32 i = 0; i < strips_segments ;++i)
- {
- LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK);
- mStripsVerts[i] = segment;
+ for (U32 i = 0; i < strips_segments ;++i)
+ {
+ LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK);
+ mStripsVerts[i] = segment;
- U32 num_stacks_this_seg = stacks_per_seg;
- if ((i == strips_segments - 1) && (total_stacks % stacks_per_seg) != 0)
- {
- // for the last buffer only allocate what we'll use
- num_stacks_this_seg = total_stacks % stacks_per_seg;
- }
+ U32 num_stacks_this_seg = stacks_per_seg;
+ if ((i == strips_segments - 1) && (total_stacks % stacks_per_seg) != 0)
+ {
+ // for the last buffer only allocate what we'll use
+ num_stacks_this_seg = total_stacks % stacks_per_seg;
+ }
- // figure out what range of the sky we're filling
- const U32 begin_stack = i * stacks_per_seg;
- const U32 end_stack = begin_stack + num_stacks_this_seg;
- llassert(end_stack <= total_stacks);
+ // figure out what range of the sky we're filling
+ const U32 begin_stack = i * stacks_per_seg;
+ const U32 end_stack = begin_stack + num_stacks_this_seg;
+ llassert(end_stack <= total_stacks);
- const U32 num_verts_this_seg = verts_per_stack * (num_stacks_this_seg+1);
- llassert(num_verts_this_seg <= max_verts);
+ const U32 num_verts_this_seg = verts_per_stack * (num_stacks_this_seg+1);
+ llassert(num_verts_this_seg <= max_verts);
- const U32 num_indices_this_seg = 1+num_stacks_this_seg*(2+2*verts_per_stack);
- llassert(num_indices_this_seg * sizeof(U16) <= max_buffer_bytes);
+ const U32 num_indices_this_seg = 1+num_stacks_this_seg*(2+2*verts_per_stack);
+ llassert(num_indices_this_seg * sizeof(U16) <= max_buffer_bytes);
- bool allocated = segment->allocateBuffer(num_verts_this_seg, num_indices_this_seg);
+ bool allocated = segment->allocateBuffer(num_verts_this_seg, num_indices_this_seg);
#if RELEASE_SHOW_WARNS
- if( !allocated )
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer on update to "
- << num_verts_this_seg << " vertices and "
- << num_indices_this_seg << " indices" << LL_ENDL;
- }
+ if( !allocated )
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer on update to "
+ << num_verts_this_seg << " vertices and "
+ << num_indices_this_seg << " indices" << LL_ENDL;
+ }
#else
- (void) allocated;
+ (void) allocated;
#endif
- // lock the buffer
- BOOL success = segment->getVertexStrider(vertices)
- && segment->getTexCoord0Strider(texCoords)
- && segment->getIndexStrider(indices);
+ // lock the buffer
+ BOOL success = segment->getVertexStrider(vertices)
+ && segment->getTexCoord0Strider(texCoords)
+ && segment->getIndexStrider(indices);
#if RELEASE_SHOW_DEBUG
- if(!success)
- {
- LL_ERRS() << "Failed updating WindLight sky geometry." << LL_ENDL;
- }
+ if(!success)
+ {
+ LL_ERRS() << "Failed updating WindLight sky geometry." << LL_ENDL;
+ }
#else
- (void) success;
+ (void) success;
#endif
- // fill it
- buildStripsBuffer(begin_stack, end_stack, vertices, texCoords, indices, dome_radius, verts_per_stack, total_stacks);
+ // fill it
+ buildStripsBuffer(begin_stack, end_stack, vertices, texCoords, indices, dome_radius, verts_per_stack, total_stacks);
+
+ // and unlock the buffer
+ segment->unmapBuffer();
+ }
- // and unlock the buffer
- segment->unmapBuffer();
- }
-
#if RELEASE_SHOW_DEBUG
- LL_INFOS() << "completed in " << llformat("%.2f", timer.getElapsedTimeF32().value()) << "seconds" << LL_ENDL;
+ LL_INFOS() << "completed in " << llformat("%.2f", timer.getElapsedTimeF32().value()) << "seconds" << LL_ENDL;
#endif
- }
+ }
- updateStarColors();
- updateStarGeometry(drawable);
+ updateStarColors();
+ updateStarGeometry(drawable);
- LLPipeline::sCompiles++;
+ LLPipeline::sCompiles++;
- return TRUE;
+ return TRUE;
}
void LLVOWLSky::drawStars(void)
{
- // render the stars as a sphere centered at viewer camera
- if (mStarsVerts.notNull())
- {
- mStarsVerts->setBuffer();
- mStarsVerts->drawArrays(LLRender::TRIANGLES, 0, getStarsNumVerts()*4);
- }
+ // render the stars as a sphere centered at viewer camera
+ if (mStarsVerts.notNull())
+ {
+ mStarsVerts->setBuffer();
+ mStarsVerts->drawArrays(LLRender::TRIANGLES, 0, getStarsNumVerts()*4);
+ }
}
void LLVOWLSky::drawFsSky(void)
{
if (mFsSkyVerts.isNull())
- {
- updateGeometry(mDrawable);
- }
+ {
+ updateGeometry(mDrawable);
+ }
LLGLDisable disable_blend(GL_BLEND);
- mFsSkyVerts->setBuffer();
- mFsSkyVerts->drawRange(LLRender::TRIANGLES, 0, mFsSkyVerts->getNumVerts() - 1, mFsSkyVerts->getNumIndices(), 0);
- gPipeline.addTrianglesDrawn(mFsSkyVerts->getNumIndices());
- LLVertexBuffer::unbind();
+ mFsSkyVerts->setBuffer();
+ mFsSkyVerts->drawRange(LLRender::TRIANGLES, 0, mFsSkyVerts->getNumVerts() - 1, mFsSkyVerts->getNumIndices(), 0);
+ gPipeline.addTrianglesDrawn(mFsSkyVerts->getNumIndices());
+ LLVertexBuffer::unbind();
}
void LLVOWLSky::drawDome(void)
{
- if (mStripsVerts.empty())
- {
- updateGeometry(mDrawable);
- }
+ if (mStripsVerts.empty())
+ {
+ updateGeometry(mDrawable);
+ }
- LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- std::vector< LLPointer<LLVertexBuffer> >::const_iterator strips_vbo_iter, end_strips;
- end_strips = mStripsVerts.end();
- for(strips_vbo_iter = mStripsVerts.begin(); strips_vbo_iter != end_strips; ++strips_vbo_iter)
- {
- LLVertexBuffer * strips_segment = strips_vbo_iter->get();
+ std::vector< LLPointer<LLVertexBuffer> >::const_iterator strips_vbo_iter, end_strips;
+ end_strips = mStripsVerts.end();
+ for(strips_vbo_iter = mStripsVerts.begin(); strips_vbo_iter != end_strips; ++strips_vbo_iter)
+ {
+ LLVertexBuffer * strips_segment = strips_vbo_iter->get();
- strips_segment->setBuffer();
+ strips_segment->setBuffer();
- strips_segment->drawRange(
- LLRender::TRIANGLE_STRIP,
- 0, strips_segment->getNumVerts()-1, strips_segment->getNumIndices(),
- 0);
- gPipeline.addTrianglesDrawn(strips_segment->getNumIndices());
- }
+ strips_segment->drawRange(
+ LLRender::TRIANGLE_STRIP,
+ 0, strips_segment->getNumVerts()-1, strips_segment->getNumIndices(),
+ 0);
+ gPipeline.addTrianglesDrawn(strips_segment->getNumIndices());
+ }
- LLVertexBuffer::unbind();
+ LLVertexBuffer::unbind();
}
void LLVOWLSky::initStars()
{
const F32 DISTANCE_TO_STARS = LLEnvironment::instance().getCurrentSky()->getDomeRadius();
- // Initialize star map
- mStarVertices.resize(getStarsNumVerts());
- mStarColors.resize(getStarsNumVerts());
- mStarIntensities.resize(getStarsNumVerts());
-
- std::vector<LLVector3>::iterator v_p = mStarVertices.begin();
- std::vector<LLColor4>::iterator v_c = mStarColors.begin();
- std::vector<F32>::iterator v_i = mStarIntensities.begin();
-
- U32 i;
-
- for (i = 0; i < getStarsNumVerts(); ++i)
- {
- v_p->mV[VX] = ll_frand() - 0.5f;
- v_p->mV[VY] = ll_frand() - 0.5f;
-
- // we only want stars on the top half of the dome!
-
- v_p->mV[VZ] = ll_frand()/2.f;
-
- v_p->normVec();
- *v_p *= DISTANCE_TO_STARS;
- *v_i = llmin((F32)pow(ll_frand(),2.f) + 0.1f, 1.f);
- v_c->mV[VRED] = 0.75f + ll_frand() * 0.25f ;
- v_c->mV[VGREEN] = 1.f ;
- v_c->mV[VBLUE] = 0.75f + ll_frand() * 0.25f ;
- v_c->mV[VALPHA] = 1.f;
- v_c->clamp();
- v_p++;
- v_c++;
- v_i++;
- }
+ // Initialize star map
+ mStarVertices.resize(getStarsNumVerts());
+ mStarColors.resize(getStarsNumVerts());
+ mStarIntensities.resize(getStarsNumVerts());
+
+ std::vector<LLVector3>::iterator v_p = mStarVertices.begin();
+ std::vector<LLColor4>::iterator v_c = mStarColors.begin();
+ std::vector<F32>::iterator v_i = mStarIntensities.begin();
+
+ U32 i;
+
+ for (i = 0; i < getStarsNumVerts(); ++i)
+ {
+ v_p->mV[VX] = ll_frand() - 0.5f;
+ v_p->mV[VY] = ll_frand() - 0.5f;
+
+ // we only want stars on the top half of the dome!
+
+ v_p->mV[VZ] = ll_frand()/2.f;
+
+ v_p->normVec();
+ *v_p *= DISTANCE_TO_STARS;
+ *v_i = llmin((F32)pow(ll_frand(),2.f) + 0.1f, 1.f);
+ v_c->mV[VRED] = 0.75f + ll_frand() * 0.25f ;
+ v_c->mV[VGREEN] = 1.f ;
+ v_c->mV[VBLUE] = 0.75f + ll_frand() * 0.25f ;
+ v_c->mV[VALPHA] = 1.f;
+ v_c->clamp();
+ v_p++;
+ v_c++;
+ v_i++;
+ }
}
void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
@@ -382,200 +382,200 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
const U32& num_slices,
const U32& num_stacks)
{
- U32 i, j;
- F32 phi0, theta, x0, y0, z0;
- const F32 reciprocal_num_stacks = 1.f / num_stacks;
+ U32 i, j;
+ F32 phi0, theta, x0, y0, z0;
+ const F32 reciprocal_num_stacks = 1.f / num_stacks;
- llassert(end_stack <= num_stacks);
+ llassert(end_stack <= num_stacks);
- // stacks are iterated one-indexed since phi(0) was handled by the fan above
+ // stacks are iterated one-indexed since phi(0) was handled by the fan above
#if NEW_TESS
- for(i = begin_stack; i <= end_stack; ++i)
+ for(i = begin_stack; i <= end_stack; ++i)
#else
- for(i = begin_stack + 1; i <= end_stack+1; ++i)
+ for(i = begin_stack + 1; i <= end_stack+1; ++i)
#endif
- {
- phi0 = calcPhi(i, reciprocal_num_stacks);
+ {
+ phi0 = calcPhi(i, reciprocal_num_stacks);
- for(j = 0; j < num_slices; ++j)
- {
- theta = F_TWO_PI * (float(j) / float(num_slices));
+ for(j = 0; j < num_slices; ++j)
+ {
+ theta = F_TWO_PI * (float(j) / float(num_slices));
- // standard transformation from spherical to
- // rectangular coordinates
- x0 = sin(phi0) * cos(theta);
- y0 = cos(phi0);
- z0 = sin(phi0) * sin(theta);
+ // standard transformation from spherical to
+ // rectangular coordinates
+ x0 = sin(phi0) * cos(theta);
+ y0 = cos(phi0);
+ z0 = sin(phi0) * sin(theta);
#if NEW_TESS
*vertices++ = LLVector3(x0 * dome_radius, y0 * dome_radius, z0 * dome_radius);
#else
if (i == num_stacks-2)
- {
- *vertices++ = LLVector3(x0*dome_radius, y0*dome_radius-1024.f*2.f, z0*dome_radius);
- }
- else if (i == num_stacks-1)
- {
- *vertices++ = LLVector3(0, y0*dome_radius-1024.f*2.f, 0);
- }
- else
- {
- *vertices++ = LLVector3(x0 * dome_radius, y0 * dome_radius, z0 * dome_radius);
- }
+ {
+ *vertices++ = LLVector3(x0*dome_radius, y0*dome_radius-1024.f*2.f, z0*dome_radius);
+ }
+ else if (i == num_stacks-1)
+ {
+ *vertices++ = LLVector3(0, y0*dome_radius-1024.f*2.f, 0);
+ }
+ else
+ {
+ *vertices++ = LLVector3(x0 * dome_radius, y0 * dome_radius, z0 * dome_radius);
+ }
#endif
- // generate planar uv coordinates
- // note: x and z are transposed in order for things to animate
- // correctly in the global coordinate system where +x is east and
- // +y is north
- *texCoords++ = LLVector2((-z0 + 1.f) / 2.f, (-x0 + 1.f) / 2.f);
- }
- }
-
- //build triangle strip...
- *indices++ = 0 ;
-
- S32 k = 0 ;
- for(i = 1; i <= end_stack - begin_stack; ++i)
- {
- *indices++ = i * num_slices + k ;
-
- k = (k+1) % num_slices ;
- for(j = 0; j < num_slices ; ++j)
- {
- *indices++ = (i-1) * num_slices + k ;
- *indices++ = i * num_slices + k ;
-
- k = (k+1) % num_slices ;
- }
-
- if((--k) < 0)
- {
- k = num_slices - 1 ;
- }
-
- *indices++ = i * num_slices + k ;
- }
+ // generate planar uv coordinates
+ // note: x and z are transposed in order for things to animate
+ // correctly in the global coordinate system where +x is east and
+ // +y is north
+ *texCoords++ = LLVector2((-z0 + 1.f) / 2.f, (-x0 + 1.f) / 2.f);
+ }
+ }
+
+ //build triangle strip...
+ *indices++ = 0 ;
+
+ S32 k = 0 ;
+ for(i = 1; i <= end_stack - begin_stack; ++i)
+ {
+ *indices++ = i * num_slices + k ;
+
+ k = (k+1) % num_slices ;
+ for(j = 0; j < num_slices ; ++j)
+ {
+ *indices++ = (i-1) * num_slices + k ;
+ *indices++ = i * num_slices + k ;
+
+ k = (k+1) % num_slices ;
+ }
+
+ if((--k) < 0)
+ {
+ k = num_slices - 1 ;
+ }
+
+ *indices++ = i * num_slices + k ;
+ }
}
void LLVOWLSky::updateStarColors()
{
- std::vector<LLColor4>::iterator v_c = mStarColors.begin();
- std::vector<F32>::iterator v_i = mStarIntensities.begin();
- std::vector<LLVector3>::iterator v_p = mStarVertices.begin();
-
- const F32 var = 0.15f;
- const F32 min = 0.5f; //0.75f;
- //const F32 sunclose_max = 0.6f;
- //const F32 sunclose_range = 1 - sunclose_max;
-
- //F32 below_horizon = - llmin(0.0f, gSky.mVOSkyp->getToSunLast().mV[2]);
- //F32 brightness_factor = llmin(1.0f, below_horizon * 20);
-
- static S32 swap = 0;
- swap++;
-
- if ((swap % 2) == 1)
- {
- F32 intensity; // max intensity of each star
- U32 x;
- for (x = 0; x < getStarsNumVerts(); ++x)
- {
- //F32 sundir_factor = 1;
- LLVector3 tostar = *v_p;
- tostar.normVec();
- //const F32 how_close_to_sun = tostar * gSky.mVOSkyp->getToSunLast();
- //if (how_close_to_sun > sunclose_max)
- //{
- // sundir_factor = (1 - how_close_to_sun) / sunclose_range;
- //}
- intensity = *(v_i);
- F32 alpha = v_c->mV[VALPHA] + (ll_frand() - 0.5f) * var * intensity;
- if (alpha < min * intensity)
- {
- alpha = min * intensity;
- }
- if (alpha > intensity)
- {
- alpha = intensity;
- }
- //alpha *= brightness_factor * sundir_factor;
-
- alpha = llclamp(alpha, 0.f, 1.f);
- v_c->mV[VALPHA] = alpha;
- v_c++;
- v_i++;
- v_p++;
- }
- }
+ std::vector<LLColor4>::iterator v_c = mStarColors.begin();
+ std::vector<F32>::iterator v_i = mStarIntensities.begin();
+ std::vector<LLVector3>::iterator v_p = mStarVertices.begin();
+
+ const F32 var = 0.15f;
+ const F32 min = 0.5f; //0.75f;
+ //const F32 sunclose_max = 0.6f;
+ //const F32 sunclose_range = 1 - sunclose_max;
+
+ //F32 below_horizon = - llmin(0.0f, gSky.mVOSkyp->getToSunLast().mV[2]);
+ //F32 brightness_factor = llmin(1.0f, below_horizon * 20);
+
+ static S32 swap = 0;
+ swap++;
+
+ if ((swap % 2) == 1)
+ {
+ F32 intensity; // max intensity of each star
+ U32 x;
+ for (x = 0; x < getStarsNumVerts(); ++x)
+ {
+ //F32 sundir_factor = 1;
+ LLVector3 tostar = *v_p;
+ tostar.normVec();
+ //const F32 how_close_to_sun = tostar * gSky.mVOSkyp->getToSunLast();
+ //if (how_close_to_sun > sunclose_max)
+ //{
+ // sundir_factor = (1 - how_close_to_sun) / sunclose_range;
+ //}
+ intensity = *(v_i);
+ F32 alpha = v_c->mV[VALPHA] + (ll_frand() - 0.5f) * var * intensity;
+ if (alpha < min * intensity)
+ {
+ alpha = min * intensity;
+ }
+ if (alpha > intensity)
+ {
+ alpha = intensity;
+ }
+ //alpha *= brightness_factor * sundir_factor;
+
+ alpha = llclamp(alpha, 0.f, 1.f);
+ v_c->mV[VALPHA] = alpha;
+ v_c++;
+ v_i++;
+ v_p++;
+ }
+ }
}
BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable)
{
- LLStrider<LLVector3> verticesp;
- LLStrider<LLColor4U> colorsp;
- LLStrider<LLVector2> texcoordsp;
-
- if (mStarsVerts.isNull())
- {
- mStarsVerts = new LLVertexBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK);
- if (!mStarsVerts->allocateBuffer(getStarsNumVerts()*6, 0))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer for Sky to " << getStarsNumVerts() * 6 << " vertices" << LL_ENDL;
- }
- }
-
- BOOL success = mStarsVerts->getVertexStrider(verticesp)
- && mStarsVerts->getColorStrider(colorsp)
- && mStarsVerts->getTexCoord0Strider(texcoordsp);
-
- if(!success)
- {
- LL_ERRS() << "Failed updating star geometry." << LL_ENDL;
- }
-
- // *TODO: fix LLStrider with a real prefix increment operator so it can be
- // used as a model of OutputIterator. -Brad
- // std::copy(mStarVertices.begin(), mStarVertices.end(), verticesp);
-
- if (mStarVertices.size() < getStarsNumVerts())
- {
- LL_ERRS() << "Star reference geometry insufficient." << LL_ENDL;
- }
-
- for (U32 vtx = 0; vtx < getStarsNumVerts(); ++vtx)
- {
- LLVector3 at = mStarVertices[vtx];
- at.normVec();
- LLVector3 left = at%LLVector3(0,0,1);
- LLVector3 up = at%left;
-
- F32 sc = 16.0f + (ll_frand() * 20.0f);
- left *= sc;
- up *= sc;
-
- *(verticesp++) = mStarVertices[vtx];
- *(verticesp++) = mStarVertices[vtx]+up;
- *(verticesp++) = mStarVertices[vtx]+left+up;
- *(verticesp++) = mStarVertices[vtx];
- *(verticesp++) = mStarVertices[vtx]+left+up;
- *(verticesp++) = mStarVertices[vtx]+left;
-
- *(texcoordsp++) = LLVector2(1,0);
- *(texcoordsp++) = LLVector2(1,1);
- *(texcoordsp++) = LLVector2(0,1);
- *(texcoordsp++) = LLVector2(1,0);
- *(texcoordsp++) = LLVector2(0,1);
- *(texcoordsp++) = LLVector2(0,0);
-
- *(colorsp++) = LLColor4U(mStarColors[vtx]);
- *(colorsp++) = LLColor4U(mStarColors[vtx]);
- *(colorsp++) = LLColor4U(mStarColors[vtx]);
- *(colorsp++) = LLColor4U(mStarColors[vtx]);
- *(colorsp++) = LLColor4U(mStarColors[vtx]);
- *(colorsp++) = LLColor4U(mStarColors[vtx]);
- }
-
- mStarsVerts->unmapBuffer();
- return TRUE;
+ LLStrider<LLVector3> verticesp;
+ LLStrider<LLColor4U> colorsp;
+ LLStrider<LLVector2> texcoordsp;
+
+ if (mStarsVerts.isNull())
+ {
+ mStarsVerts = new LLVertexBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK);
+ if (!mStarsVerts->allocateBuffer(getStarsNumVerts()*6, 0))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer for Sky to " << getStarsNumVerts() * 6 << " vertices" << LL_ENDL;
+ }
+ }
+
+ BOOL success = mStarsVerts->getVertexStrider(verticesp)
+ && mStarsVerts->getColorStrider(colorsp)
+ && mStarsVerts->getTexCoord0Strider(texcoordsp);
+
+ if(!success)
+ {
+ LL_ERRS() << "Failed updating star geometry." << LL_ENDL;
+ }
+
+ // *TODO: fix LLStrider with a real prefix increment operator so it can be
+ // used as a model of OutputIterator. -Brad
+ // std::copy(mStarVertices.begin(), mStarVertices.end(), verticesp);
+
+ if (mStarVertices.size() < getStarsNumVerts())
+ {
+ LL_ERRS() << "Star reference geometry insufficient." << LL_ENDL;
+ }
+
+ for (U32 vtx = 0; vtx < getStarsNumVerts(); ++vtx)
+ {
+ LLVector3 at = mStarVertices[vtx];
+ at.normVec();
+ LLVector3 left = at%LLVector3(0,0,1);
+ LLVector3 up = at%left;
+
+ F32 sc = 16.0f + (ll_frand() * 20.0f);
+ left *= sc;
+ up *= sc;
+
+ *(verticesp++) = mStarVertices[vtx];
+ *(verticesp++) = mStarVertices[vtx]+up;
+ *(verticesp++) = mStarVertices[vtx]+left+up;
+ *(verticesp++) = mStarVertices[vtx];
+ *(verticesp++) = mStarVertices[vtx]+left+up;
+ *(verticesp++) = mStarVertices[vtx]+left;
+
+ *(texcoordsp++) = LLVector2(1,0);
+ *(texcoordsp++) = LLVector2(1,1);
+ *(texcoordsp++) = LLVector2(0,1);
+ *(texcoordsp++) = LLVector2(1,0);
+ *(texcoordsp++) = LLVector2(0,1);
+ *(texcoordsp++) = LLVector2(0,0);
+
+ *(colorsp++) = LLColor4U(mStarColors[vtx]);
+ *(colorsp++) = LLColor4U(mStarColors[vtx]);
+ *(colorsp++) = LLColor4U(mStarColors[vtx]);
+ *(colorsp++) = LLColor4U(mStarColors[vtx]);
+ *(colorsp++) = LLColor4U(mStarColors[vtx]);
+ *(colorsp++) = LLColor4U(mStarColors[vtx]);
+ }
+
+ mStarsVerts->unmapBuffer();
+ return TRUE;
}
diff --git a/indra/newview/llvowlsky.h b/indra/newview/llvowlsky.h
index 3853dd2c70..36093e8b32 100644
--- a/indra/newview/llvowlsky.h
+++ b/indra/newview/llvowlsky.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvowlsky.h
* @brief LLVOWLSky class definition
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,39 +31,39 @@
class LLVOWLSky : public LLStaticViewerObject {
private:
- inline static U32 getNumStacks(void);
- inline static U32 getNumSlices(void);
- inline static U32 getStripsNumVerts(void);
- inline static U32 getStripsNumIndices(void);
- inline static U32 getStarsNumVerts(void);
- inline static U32 getStarsNumIndices(void);
+ inline static U32 getNumStacks(void);
+ inline static U32 getNumSlices(void);
+ inline static U32 getStripsNumVerts(void);
+ inline static U32 getStripsNumIndices(void);
+ inline static U32 getStarsNumVerts(void);
+ inline static U32 getStarsNumIndices(void);
public:
- LLVOWLSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
+ LLVOWLSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
- /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
- /*virtual*/ BOOL isActive(void) const;
- /*virtual*/ LLDrawable * createDrawable(LLPipeline *pipeline);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
+ /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
+ /*virtual*/ BOOL isActive(void) const;
+ /*virtual*/ LLDrawable * createDrawable(LLPipeline *pipeline);
+ /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
- void drawStars(void);
- void drawDome(void);
+ void drawStars(void);
+ void drawDome(void);
void drawFsSky(void); // fullscreen sky for advanced atmo
- void resetVertexBuffers(void);
-
- void cleanupGL();
- void restoreGL();
+ void resetVertexBuffers(void);
+
+ void cleanupGL();
+ void restoreGL();
private:
- // helper function for initializing the stars.
- void initStars();
+ // helper function for initializing the stars.
+ void initStars();
- // helper function for building the strips vertex buffer.
- // note begin_stack and end_stack follow stl iterator conventions,
- // begin_stack is the first stack to be included, end_stack is the first
- // stack not to be included.
- static void buildStripsBuffer(U32 begin_stack, U32 end_stack,
+ // helper function for building the strips vertex buffer.
+ // note begin_stack and end_stack follow stl iterator conventions,
+ // begin_stack is the first stack to be included, end_stack is the first
+ // stack not to be included.
+ static void buildStripsBuffer(U32 begin_stack, U32 end_stack,
LLStrider<LLVector3> & vertices,
LLStrider<LLVector2> & texCoords,
LLStrider<U16> & indices,
@@ -71,20 +71,20 @@ private:
const U32& num_slices,
const U32& num_stacks);
- // helper function for updating the stars colors.
- void updateStarColors();
+ // helper function for updating the stars colors.
+ void updateStarColors();
- // helper function for updating the stars geometry.
- BOOL updateStarGeometry(LLDrawable *drawable);
+ // helper function for updating the stars geometry.
+ BOOL updateStarGeometry(LLDrawable *drawable);
private:
- LLPointer<LLVertexBuffer> mFsSkyVerts;
- std::vector< LLPointer<LLVertexBuffer> > mStripsVerts;
- LLPointer<LLVertexBuffer> mStarsVerts;
+ LLPointer<LLVertexBuffer> mFsSkyVerts;
+ std::vector< LLPointer<LLVertexBuffer> > mStripsVerts;
+ LLPointer<LLVertexBuffer> mStarsVerts;
- std::vector<LLVector3> mStarVertices; // Star verticies
- std::vector<LLColor4> mStarColors; // Star colors
- std::vector<F32> mStarIntensities; // Star intensities
+ std::vector<LLVector3> mStarVertices; // Star verticies
+ std::vector<LLColor4> mStarColors; // Star colors
+ std::vector<F32> mStarIntensities; // Star intensities
};
#endif // LL_VOWLSKY_H
diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp
index ceff5cc8ee..0a1d346266 100644
--- a/indra/newview/llwatchdog.cpp
+++ b/indra/newview/llwatchdog.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llthreadwatchdog.cpp
* @brief The LLThreadWatchdog class definitions
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,34 +35,34 @@ const U32 WATCHDOG_SLEEP_TIME_USEC = 1000000;
class LLWatchdogTimerThread : public LLThread
{
public:
- LLWatchdogTimerThread() :
- LLThread("Watchdog"),
- mSleepMsecs(0),
- mStopping(false)
- {
- }
-
- ~LLWatchdogTimerThread() {}
-
- void setSleepTime(long ms) { mSleepMsecs = ms; }
- void stop()
- {
- mStopping = true;
- mSleepMsecs = 1;
- }
-
- /* virtual */ void run()
- {
- while(!mStopping)
- {
- LLWatchdog::getInstance()->run();
- ms_sleep(mSleepMsecs);
- }
- }
+ LLWatchdogTimerThread() :
+ LLThread("Watchdog"),
+ mSleepMsecs(0),
+ mStopping(false)
+ {
+ }
+
+ ~LLWatchdogTimerThread() {}
+
+ void setSleepTime(long ms) { mSleepMsecs = ms; }
+ void stop()
+ {
+ mStopping = true;
+ mSleepMsecs = 1;
+ }
+
+ /* virtual */ void run()
+ {
+ while(!mStopping)
+ {
+ LLWatchdog::getInstance()->run();
+ ms_sleep(mSleepMsecs);
+ }
+ }
private:
- long mSleepMsecs;
- bool mStopping;
+ long mSleepMsecs;
+ bool mStopping;
};
// LLWatchdogEntry
@@ -72,12 +72,12 @@ LLWatchdogEntry::LLWatchdogEntry()
LLWatchdogEntry::~LLWatchdogEntry()
{
- stop();
+ stop();
}
void LLWatchdogEntry::start()
{
- LLWatchdog::getInstance()->add(this);
+ LLWatchdog::getInstance()->add(this);
}
void LLWatchdogEntry::stop()
@@ -92,67 +92,67 @@ void LLWatchdogEntry::stop()
// LLWatchdogTimeout
const std::string UNINIT_STRING = "uninitialized";
-LLWatchdogTimeout::LLWatchdogTimeout() :
- mTimeout(0.0f),
- mPingState(UNINIT_STRING)
+LLWatchdogTimeout::LLWatchdogTimeout() :
+ mTimeout(0.0f),
+ mPingState(UNINIT_STRING)
{
}
-LLWatchdogTimeout::~LLWatchdogTimeout()
+LLWatchdogTimeout::~LLWatchdogTimeout()
{
}
-bool LLWatchdogTimeout::isAlive() const
-{
- return (mTimer.getStarted() && !mTimer.hasExpired());
+bool LLWatchdogTimeout::isAlive() const
+{
+ return (mTimer.getStarted() && !mTimer.hasExpired());
}
void LLWatchdogTimeout::reset()
{
- mTimer.setTimerExpirySec(mTimeout);
+ mTimer.setTimerExpirySec(mTimeout);
}
-void LLWatchdogTimeout::setTimeout(F32 d)
+void LLWatchdogTimeout::setTimeout(F32 d)
{
- mTimeout = d;
+ mTimeout = d;
}
-void LLWatchdogTimeout::start(const std::string& state)
+void LLWatchdogTimeout::start(const std::string& state)
{
if (mTimeout == 0)
{
LL_WARNS() << "Cant' start watchdog entry - no timeout set" << LL_ENDL;
return;
}
- // Order of operation is very important here.
- // After LLWatchdogEntry::start() is called
- // LLWatchdogTimeout::isAlive() will be called asynchronously.
- ping(state);
- mTimer.start();
+ // Order of operation is very important here.
+ // After LLWatchdogEntry::start() is called
+ // LLWatchdogTimeout::isAlive() will be called asynchronously.
+ ping(state);
+ mTimer.start();
mTimer.setTimerExpirySec(mTimeout); // timer expiration set to 0 by start()
- LLWatchdogEntry::start();
+ LLWatchdogEntry::start();
}
-void LLWatchdogTimeout::stop()
+void LLWatchdogTimeout::stop()
{
- LLWatchdogEntry::stop();
- mTimer.stop();
+ LLWatchdogEntry::stop();
+ mTimer.stop();
}
-void LLWatchdogTimeout::ping(const std::string& state)
-{
- if(!state.empty())
- {
- mPingState = state;
- }
- reset();
+void LLWatchdogTimeout::ping(const std::string& state)
+{
+ if(!state.empty())
+ {
+ mPingState = state;
+ }
+ reset();
}
// LLWatchdog
LLWatchdog::LLWatchdog()
:mSuspectsAccessMutex()
,mTimer(NULL)
- ,mLastClockCount(0)
+ ,mLastClockCount(0)
{
}
@@ -162,105 +162,105 @@ LLWatchdog::~LLWatchdog()
void LLWatchdog::add(LLWatchdogEntry* e)
{
- lockThread();
- mSuspects.insert(e);
- unlockThread();
+ lockThread();
+ mSuspects.insert(e);
+ unlockThread();
}
void LLWatchdog::remove(LLWatchdogEntry* e)
{
- lockThread();
+ lockThread();
mSuspects.erase(e);
- unlockThread();
+ unlockThread();
}
void LLWatchdog::init()
{
- if(!mSuspectsAccessMutex && !mTimer)
- {
- mSuspectsAccessMutex = new LLMutex();
- mTimer = new LLWatchdogTimerThread();
- mTimer->setSleepTime(WATCHDOG_SLEEP_TIME_USEC / 1000);
- mLastClockCount = LLTimer::getTotalTime();
-
- // mTimer->start() kicks off the thread, any code after
- // start needs to use the mSuspectsAccessMutex
- mTimer->start();
- }
+ if(!mSuspectsAccessMutex && !mTimer)
+ {
+ mSuspectsAccessMutex = new LLMutex();
+ mTimer = new LLWatchdogTimerThread();
+ mTimer->setSleepTime(WATCHDOG_SLEEP_TIME_USEC / 1000);
+ mLastClockCount = LLTimer::getTotalTime();
+
+ // mTimer->start() kicks off the thread, any code after
+ // start needs to use the mSuspectsAccessMutex
+ mTimer->start();
+ }
}
void LLWatchdog::cleanup()
{
- if(mTimer)
- {
- mTimer->stop();
- delete mTimer;
- mTimer = NULL;
- }
-
- if(mSuspectsAccessMutex)
- {
- delete mSuspectsAccessMutex;
- mSuspectsAccessMutex = NULL;
- }
-
- mLastClockCount = 0;
+ if(mTimer)
+ {
+ mTimer->stop();
+ delete mTimer;
+ mTimer = NULL;
+ }
+
+ if(mSuspectsAccessMutex)
+ {
+ delete mSuspectsAccessMutex;
+ mSuspectsAccessMutex = NULL;
+ }
+
+ mLastClockCount = 0;
}
void LLWatchdog::run()
{
- lockThread();
-
- // Check the time since the last call to run...
- // If the time elapsed is two times greater than the regualr sleep time
- // reset the active timeouts.
- const U32 TIME_ELAPSED_MULTIPLIER = 2;
- U64 current_time = LLTimer::getTotalTime();
- U64 current_run_delta = current_time - mLastClockCount;
- mLastClockCount = current_time;
-
- if(current_run_delta > (WATCHDOG_SLEEP_TIME_USEC * TIME_ELAPSED_MULTIPLIER))
- {
- LL_INFOS() << "Watchdog thread delayed: resetting entries." << LL_ENDL;
- for (const auto& suspect : mSuspects)
- {
- suspect->reset();
- }
- }
- else
- {
- SuspectsRegistry::iterator result =
- std::find_if(mSuspects.begin(),
- mSuspects.end(),
- [](const LLWatchdogEntry* suspect){ return ! suspect->isAlive(); });
- if(result != mSuspects.end())
- {
- // error!!!
- if(mTimer)
- {
- mTimer->stop();
- }
+ lockThread();
+
+ // Check the time since the last call to run...
+ // If the time elapsed is two times greater than the regualr sleep time
+ // reset the active timeouts.
+ const U32 TIME_ELAPSED_MULTIPLIER = 2;
+ U64 current_time = LLTimer::getTotalTime();
+ U64 current_run_delta = current_time - mLastClockCount;
+ mLastClockCount = current_time;
+
+ if(current_run_delta > (WATCHDOG_SLEEP_TIME_USEC * TIME_ELAPSED_MULTIPLIER))
+ {
+ LL_INFOS() << "Watchdog thread delayed: resetting entries." << LL_ENDL;
+ for (const auto& suspect : mSuspects)
+ {
+ suspect->reset();
+ }
+ }
+ else
+ {
+ SuspectsRegistry::iterator result =
+ std::find_if(mSuspects.begin(),
+ mSuspects.end(),
+ [](const LLWatchdogEntry* suspect){ return ! suspect->isAlive(); });
+ if(result != mSuspects.end())
+ {
+ // error!!!
+ if(mTimer)
+ {
+ mTimer->stop();
+ }
LL_ERRS() << "Watchdog timer expired; assuming viewer is hung and crashing" << LL_ENDL;
- }
- }
+ }
+ }
- unlockThread();
+ unlockThread();
}
void LLWatchdog::lockThread()
{
- if(mSuspectsAccessMutex != NULL)
- {
- mSuspectsAccessMutex->lock();
- }
+ if(mSuspectsAccessMutex != NULL)
+ {
+ mSuspectsAccessMutex->lock();
+ }
}
void LLWatchdog::unlockThread()
{
- if(mSuspectsAccessMutex != NULL)
- {
- mSuspectsAccessMutex->unlock();
- }
+ if(mSuspectsAccessMutex != NULL)
+ {
+ mSuspectsAccessMutex->unlock();
+ }
}
diff --git a/indra/newview/llwatchdog.h b/indra/newview/llwatchdog.h
index ce5cf748f4..fe8932e298 100644
--- a/indra/newview/llwatchdog.h
+++ b/indra/newview/llwatchdog.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llthreadwatchdog.h
* @brief The LLThreadWatchdog class declaration
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,73 +29,73 @@
#include <boost/function.hpp>
-#ifndef LL_TIMER_H
- #include "lltimer.h"
+#ifndef LL_TIMER_H
+ #include "lltimer.h"
#endif
-// LLWatchdogEntry is the interface used by the tasks that
+// LLWatchdogEntry is the interface used by the tasks that
// need to be watched.
class LLWatchdogEntry
{
public:
- LLWatchdogEntry();
- virtual ~LLWatchdogEntry();
+ LLWatchdogEntry();
+ virtual ~LLWatchdogEntry();
- // isAlive is accessed by the watchdog thread.
- // This may mean that resources used by
- // isAlive and other method may need synchronization.
- virtual bool isAlive() const = 0;
- virtual void reset() = 0;
- virtual void start();
- virtual void stop();
+ // isAlive is accessed by the watchdog thread.
+ // This may mean that resources used by
+ // isAlive and other method may need synchronization.
+ virtual bool isAlive() const = 0;
+ virtual void reset() = 0;
+ virtual void start();
+ virtual void stop();
};
class LLWatchdogTimeout : public LLWatchdogEntry
{
public:
- LLWatchdogTimeout();
- virtual ~LLWatchdogTimeout();
+ LLWatchdogTimeout();
+ virtual ~LLWatchdogTimeout();
- /* virtual */ bool isAlive() const;
- /* virtual */ void reset();
- /* virtual */ void start() { start(""); }
- /* virtual */ void stop();
+ /* virtual */ bool isAlive() const;
+ /* virtual */ void reset();
+ /* virtual */ void start() { start(""); }
+ /* virtual */ void stop();
- void start(const std::string& state);
- void setTimeout(F32 d);
- void ping(const std::string& state);
- const std::string& getState() {return mPingState; }
+ void start(const std::string& state);
+ void setTimeout(F32 d);
+ void ping(const std::string& state);
+ const std::string& getState() {return mPingState; }
private:
- LLTimer mTimer;
- F32 mTimeout;
- std::string mPingState;
+ LLTimer mTimer;
+ F32 mTimeout;
+ std::string mPingState;
};
class LLWatchdogTimerThread; // Defined in the cpp
class LLWatchdog : public LLSingleton<LLWatchdog>
{
- LLSINGLETON(LLWatchdog);
- ~LLWatchdog();
+ LLSINGLETON(LLWatchdog);
+ ~LLWatchdog();
public:
- // Add an entry to the watchdog.
- void add(LLWatchdogEntry* e);
- void remove(LLWatchdogEntry* e);
+ // Add an entry to the watchdog.
+ void add(LLWatchdogEntry* e);
+ void remove(LLWatchdogEntry* e);
+
+ void init();
+ void run();
+ void cleanup();
- void init();
- void run();
- void cleanup();
-
private:
- void lockThread();
- void unlockThread();
+ void lockThread();
+ void unlockThread();
- typedef std::set<LLWatchdogEntry*> SuspectsRegistry;
- SuspectsRegistry mSuspects;
- LLMutex* mSuspectsAccessMutex;
- LLWatchdogTimerThread* mTimer;
- U64 mLastClockCount;
+ typedef std::set<LLWatchdogEntry*> SuspectsRegistry;
+ SuspectsRegistry mSuspects;
+ LLMutex* mSuspectsAccessMutex;
+ LLWatchdogTimerThread* mTimer;
+ U64 mLastClockCount;
};
#endif // LL_LLTHREADWATCHDOG_H
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index 948fe55e0d..84a975b0da 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,26 +44,26 @@
class LLFindOutfitItems : public LLInventoryCollectFunctor
{
public:
- LLFindOutfitItems() {}
- virtual ~LLFindOutfitItems() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
+ LLFindOutfitItems() {}
+ virtual ~LLFindOutfitItems() {}
+ virtual bool operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item);
};
bool LLFindOutfitItems::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
+ LLInventoryItem* item)
{
- if(item)
- {
- if((item->getType() == LLAssetType::AT_CLOTHING)
- || (item->getType() == LLAssetType::AT_BODYPART)
- || (item->getType() == LLAssetType::AT_OBJECT)
- || (item->getType() == LLAssetType::AT_GESTURE))
- {
- return TRUE;
- }
- }
- return FALSE;
+ if(item)
+ {
+ if((item->getType() == LLAssetType::AT_CLOTHING)
+ || (item->getType() == LLAssetType::AT_BODYPART)
+ || (item->getType() == LLAssetType::AT_OBJECT)
+ || (item->getType() == LLAssetType::AT_GESTURE))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
//////////////////////////////////////////////////////////////////////////
@@ -72,16 +72,16 @@ bool LLFindOutfitItems::operator()(LLInventoryCategory* cat,
void LLPanelWearableListItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
- LLPanelInventoryListItemBase::onMouseEnter(x, y, mask);
- setWidgetsVisible(true);
- reshapeWidgets();
+ LLPanelInventoryListItemBase::onMouseEnter(x, y, mask);
+ setWidgetsVisible(true);
+ reshapeWidgets();
}
void LLPanelWearableListItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
- LLPanelInventoryListItemBase::onMouseLeave(x, y, mask);
- setWidgetsVisible(false);
- reshapeWidgets();
+ LLPanelInventoryListItemBase::onMouseLeave(x, y, mask);
+ setWidgetsVisible(false);
+ reshapeWidgets();
}
LLPanelWearableListItem::LLPanelWearableListItem(LLViewerInventoryItem* item, const LLPanelWearableListItem::Params& params)
@@ -103,7 +103,7 @@ LLPanelWearableOutfitItem::Params::Params()
BOOL LLPanelWearableOutfitItem::postBuild()
{
LLPanelWearableListItem::postBuild();
-
+
if(mShowWidgets)
{
addWidgetToRightSide("add_wearable");
@@ -152,19 +152,19 @@ void LLPanelWearableOutfitItem::onRemoveWearable()
// static
LLPanelWearableOutfitItem* LLPanelWearableOutfitItem::create(LLViewerInventoryItem* item,
- bool worn_indication_enabled,
+ bool worn_indication_enabled,
bool show_widgets)
{
- LLPanelWearableOutfitItem* list_item = NULL;
- if (item)
- {
- const LLPanelWearableOutfitItem::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelWearableOutfitItem>();
-
- list_item = new LLPanelWearableOutfitItem(item, worn_indication_enabled, params, show_widgets);
- list_item->initFromParams(params);
- list_item->postBuild();
- }
- return list_item;
+ LLPanelWearableOutfitItem* list_item = NULL;
+ if (item)
+ {
+ const LLPanelWearableOutfitItem::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelWearableOutfitItem>();
+
+ list_item = new LLPanelWearableOutfitItem(item, worn_indication_enabled, params, show_widgets);
+ list_item->initFromParams(params);
+ list_item->postBuild();
+ }
+ return list_item;
}
LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item,
@@ -189,20 +189,20 @@ LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item
// virtual
void LLPanelWearableOutfitItem::updateItem(const std::string& name,
- EItemState item_state)
+ EItemState item_state)
{
- std::string search_label = name;
+ std::string search_label = name;
- // Updating item's worn status depending on whether it is linked in COF or not.
- // We don't use get_is_item_worn() here because this update is triggered by
- // an inventory observer upon link in COF beind added or removed so actual
- // worn status of a linked item may still remain unchanged.
+ // Updating item's worn status depending on whether it is linked in COF or not.
+ // We don't use get_is_item_worn() here because this update is triggered by
+ // an inventory observer upon link in COF beind added or removed so actual
+ // worn status of a linked item may still remain unchanged.
bool is_worn = LLAppearanceMgr::instance().isLinkedInCOF(mInventoryItemUUID);
- if (mWornIndicationEnabled && is_worn)
- {
- search_label += LLTrans::getString("worn");
- item_state = IS_WORN;
- }
+ if (mWornIndicationEnabled && is_worn)
+ {
+ search_label += LLTrans::getString("worn");
+ item_state = IS_WORN;
+ }
if(mShowWidgets)
{
setShowWidget("add_wearable", !is_worn);
@@ -219,7 +219,7 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name,
}
}
- LLPanelInventoryListItemBase::updateItem(search_label, item_state);
+ LLPanelInventoryListItemBase::updateItem(search_label, item_state);
}
//////////////////////////////////////////////////////////////////////////
@@ -229,64 +229,64 @@ static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelClothingListItem(&typ
LLPanelClothingListItem::Params::Params()
-: up_btn("up_btn"),
- down_btn("down_btn"),
- edit_btn("edit_btn"),
- lock_panel("lock_panel"),
- edit_panel("edit_panel"),
- lock_icon("lock_icon")
+: up_btn("up_btn"),
+ down_btn("down_btn"),
+ edit_btn("edit_btn"),
+ lock_panel("lock_panel"),
+ edit_panel("edit_panel"),
+ lock_icon("lock_icon")
{}
// static
LLPanelClothingListItem* LLPanelClothingListItem::create(LLViewerInventoryItem* item)
{
- LLPanelClothingListItem* list_item = NULL;
- if(item)
- {
- const LLPanelClothingListItem::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelClothingListItem>();
- list_item = new LLPanelClothingListItem(item, params);
- list_item->initFromParams(params);
- list_item->postBuild();
- }
- return list_item;
+ LLPanelClothingListItem* list_item = NULL;
+ if(item)
+ {
+ const LLPanelClothingListItem::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelClothingListItem>();
+ list_item = new LLPanelClothingListItem(item, params);
+ list_item->initFromParams(params);
+ list_item->postBuild();
+ }
+ return list_item;
}
LLPanelClothingListItem::LLPanelClothingListItem(LLViewerInventoryItem* item, const LLPanelClothingListItem::Params& params)
: LLPanelDeletableWearableListItem(item, params)
{
- LLButton::Params button_params = params.up_btn;
- applyXUILayout(button_params, this);
- addChild(LLUICtrlFactory::create<LLButton>(button_params));
+ LLButton::Params button_params = params.up_btn;
+ applyXUILayout(button_params, this);
+ addChild(LLUICtrlFactory::create<LLButton>(button_params));
- button_params = params.down_btn;
- applyXUILayout(button_params, this);
- addChild(LLUICtrlFactory::create<LLButton>(button_params));
+ button_params = params.down_btn;
+ applyXUILayout(button_params, this);
+ addChild(LLUICtrlFactory::create<LLButton>(button_params));
- LLPanel::Params panel_params = params.lock_panel;
- applyXUILayout(panel_params, this);
- LLPanel* lock_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
- addChild(lock_panelp);
+ LLPanel::Params panel_params = params.lock_panel;
+ applyXUILayout(panel_params, this);
+ LLPanel* lock_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
+ addChild(lock_panelp);
- panel_params = params.edit_panel;
- applyXUILayout(panel_params, this);
- LLPanel* edit_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
- addChild(edit_panelp);
+ panel_params = params.edit_panel;
+ applyXUILayout(panel_params, this);
+ LLPanel* edit_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
+ addChild(edit_panelp);
- if (lock_panelp)
+ if (lock_panelp)
{
- LLIconCtrl::Params icon_params = params.lock_icon;
- applyXUILayout(icon_params, this);
- lock_panelp->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_params));
+ LLIconCtrl::Params icon_params = params.lock_icon;
+ applyXUILayout(icon_params, this);
+ lock_panelp->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_params));
}
- if (edit_panelp)
+ if (edit_panelp)
{
- button_params = params.edit_btn;
- applyXUILayout(button_params, this);
- edit_panelp->addChild(LLUICtrlFactory::create<LLButton>(button_params));
- }
+ button_params = params.edit_btn;
+ applyXUILayout(button_params, this);
+ edit_panelp->addChild(LLUICtrlFactory::create<LLButton>(button_params));
+ }
- setSeparatorVisible(false);
+ setSeparatorVisible(false);
}
LLPanelClothingListItem::~LLPanelClothingListItem()
@@ -295,17 +295,17 @@ LLPanelClothingListItem::~LLPanelClothingListItem()
BOOL LLPanelClothingListItem::postBuild()
{
- LLPanelDeletableWearableListItem::postBuild();
+ LLPanelDeletableWearableListItem::postBuild();
- addWidgetToRightSide("btn_move_up");
- addWidgetToRightSide("btn_move_down");
- addWidgetToRightSide("btn_lock");
- addWidgetToRightSide("btn_edit_panel");
+ addWidgetToRightSide("btn_move_up");
+ addWidgetToRightSide("btn_move_down");
+ addWidgetToRightSide("btn_lock");
+ addWidgetToRightSide("btn_edit_panel");
- setWidgetsVisible(false);
- reshapeWidgets();
+ setWidgetsVisible(false);
+ reshapeWidgets();
- return TRUE;
+ return TRUE;
}
//////////////////////////////////////////////////////////////////////////
@@ -316,54 +316,54 @@ static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelBodyPartsListItem(&ty
LLPanelBodyPartsListItem::Params::Params()
-: edit_btn("edit_btn"),
- edit_panel("edit_panel"),
- lock_panel("lock_panel"),
- lock_icon("lock_icon")
+: edit_btn("edit_btn"),
+ edit_panel("edit_panel"),
+ lock_panel("lock_panel"),
+ lock_icon("lock_icon")
{}
// static
LLPanelBodyPartsListItem* LLPanelBodyPartsListItem::create(LLViewerInventoryItem* item)
{
- LLPanelBodyPartsListItem* list_item = NULL;
- if(item)
- {
- const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelBodyPartsListItem>();
- list_item = new LLPanelBodyPartsListItem(item, params);
- list_item->initFromParams(params);
- list_item->postBuild();
- }
- return list_item;
+ LLPanelBodyPartsListItem* list_item = NULL;
+ if(item)
+ {
+ const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelBodyPartsListItem>();
+ list_item = new LLPanelBodyPartsListItem(item, params);
+ list_item->initFromParams(params);
+ list_item->postBuild();
+ }
+ return list_item;
}
LLPanelBodyPartsListItem::LLPanelBodyPartsListItem(LLViewerInventoryItem* item, const LLPanelBodyPartsListItem::Params& params)
: LLPanelWearableListItem(item, params)
{
- LLPanel::Params panel_params = params.edit_panel;
- applyXUILayout(panel_params, this);
- LLPanel* edit_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
- addChild(edit_panelp);
-
- panel_params = params.lock_panel;
- applyXUILayout(panel_params, this);
- LLPanel* lock_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
- addChild(lock_panelp);
-
- if (edit_panelp)
- {
- LLButton::Params btn_params = params.edit_btn;
- applyXUILayout(btn_params, this);
- edit_panelp->addChild(LLUICtrlFactory::create<LLButton>(btn_params));
+ LLPanel::Params panel_params = params.edit_panel;
+ applyXUILayout(panel_params, this);
+ LLPanel* edit_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
+ addChild(edit_panelp);
+
+ panel_params = params.lock_panel;
+ applyXUILayout(panel_params, this);
+ LLPanel* lock_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
+ addChild(lock_panelp);
+
+ if (edit_panelp)
+ {
+ LLButton::Params btn_params = params.edit_btn;
+ applyXUILayout(btn_params, this);
+ edit_panelp->addChild(LLUICtrlFactory::create<LLButton>(btn_params));
}
- if (lock_panelp)
+ if (lock_panelp)
{
- LLIconCtrl::Params icon_params = params.lock_icon;
- applyXUILayout(icon_params, this);
- lock_panelp->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_params));
- }
+ LLIconCtrl::Params icon_params = params.lock_icon;
+ applyXUILayout(icon_params, this);
+ lock_panelp->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_params));
+ }
- setSeparatorVisible(true);
+ setSeparatorVisible(true);
}
LLPanelBodyPartsListItem::~LLPanelBodyPartsListItem()
@@ -372,98 +372,98 @@ LLPanelBodyPartsListItem::~LLPanelBodyPartsListItem()
BOOL LLPanelBodyPartsListItem::postBuild()
{
- LLPanelInventoryListItemBase::postBuild();
+ LLPanelInventoryListItemBase::postBuild();
- addWidgetToRightSide("btn_lock");
- addWidgetToRightSide("btn_edit_panel");
+ addWidgetToRightSide("btn_lock");
+ addWidgetToRightSide("btn_edit_panel");
- setWidgetsVisible(false);
- reshapeWidgets();
+ setWidgetsVisible(false);
+ reshapeWidgets();
- return TRUE;
+ return TRUE;
}
static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelDeletableWearableListItem(&typeid(LLPanelDeletableWearableListItem::Params), "deletable_wearable_list_item");
LLPanelDeletableWearableListItem::Params::Params()
-: delete_btn("delete_btn")
+: delete_btn("delete_btn")
{}
// static
LLPanelDeletableWearableListItem* LLPanelDeletableWearableListItem::create(LLViewerInventoryItem* item)
{
- LLPanelDeletableWearableListItem* list_item = NULL;
- if(item)
- {
- const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelDeletableWearableListItem>();
- list_item = new LLPanelDeletableWearableListItem(item, params);
- list_item->initFromParams(params);
- list_item->postBuild();
- }
- return list_item;
+ LLPanelDeletableWearableListItem* list_item = NULL;
+ if(item)
+ {
+ const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelDeletableWearableListItem>();
+ list_item = new LLPanelDeletableWearableListItem(item, params);
+ list_item->initFromParams(params);
+ list_item->postBuild();
+ }
+ return list_item;
}
LLPanelDeletableWearableListItem::LLPanelDeletableWearableListItem(LLViewerInventoryItem* item, const LLPanelDeletableWearableListItem::Params& params)
: LLPanelWearableListItem(item, params)
{
- LLButton::Params button_params = params.delete_btn;
- applyXUILayout(button_params, this);
- addChild(LLUICtrlFactory::create<LLButton>(button_params));
+ LLButton::Params button_params = params.delete_btn;
+ applyXUILayout(button_params, this);
+ addChild(LLUICtrlFactory::create<LLButton>(button_params));
- setSeparatorVisible(true);
+ setSeparatorVisible(true);
}
BOOL LLPanelDeletableWearableListItem::postBuild()
{
- LLPanelWearableListItem::postBuild();
+ LLPanelWearableListItem::postBuild();
- addWidgetToLeftSide("btn_delete");
+ addWidgetToLeftSide("btn_delete");
- LLButton* delete_btn = getChild<LLButton>("btn_delete");
- // Reserve space for 'delete' button event if it is invisible.
- setLeftWidgetsWidth(delete_btn->getRect().mRight);
+ LLButton* delete_btn = getChild<LLButton>("btn_delete");
+ // Reserve space for 'delete' button event if it is invisible.
+ setLeftWidgetsWidth(delete_btn->getRect().mRight);
- setWidgetsVisible(false);
- reshapeWidgets();
+ setWidgetsVisible(false);
+ reshapeWidgets();
- return TRUE;
+ return TRUE;
}
// static
LLPanelAttachmentListItem* LLPanelAttachmentListItem::create(LLViewerInventoryItem* item)
{
- LLPanelAttachmentListItem* list_item = NULL;
- if(item)
- {
- const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelDeletableWearableListItem>();
-
- list_item = new LLPanelAttachmentListItem(item, params);
- list_item->initFromParams(params);
- list_item->postBuild();
- }
- return list_item;
+ LLPanelAttachmentListItem* list_item = NULL;
+ if(item)
+ {
+ const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelDeletableWearableListItem>();
+
+ list_item = new LLPanelAttachmentListItem(item, params);
+ list_item->initFromParams(params);
+ list_item->postBuild();
+ }
+ return list_item;
}
void LLPanelAttachmentListItem::updateItem(const std::string& name,
- EItemState item_state)
+ EItemState item_state)
{
- std::string title_joint = name;
-
- LLViewerInventoryItem* inv_item = getItem();
- if (inv_item && isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(inv_item->getLinkedUUID()))
- {
- std::string found_name;
- bool found = gAgentAvatarp->getAttachedPointName(inv_item->getLinkedUUID(),found_name);
- std::string trans_name = LLTrans::getString(found_name);
- if (!found)
- {
- LL_WARNS() << "invalid attachment joint, err " << found_name << LL_ENDL;
- }
- title_joint = title_joint + " (" + trans_name + ")";
- }
-
- LLPanelInventoryListItemBase::updateItem(title_joint, item_state);
+ std::string title_joint = name;
+
+ LLViewerInventoryItem* inv_item = getItem();
+ if (inv_item && isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(inv_item->getLinkedUUID()))
+ {
+ std::string found_name;
+ bool found = gAgentAvatarp->getAttachedPointName(inv_item->getLinkedUUID(),found_name);
+ std::string trans_name = LLTrans::getString(found_name);
+ if (!found)
+ {
+ LL_WARNS() << "invalid attachment joint, err " << found_name << LL_ENDL;
+ }
+ title_joint = title_joint + " (" + trans_name + ")";
+ }
+
+ LLPanelInventoryListItemBase::updateItem(title_joint, item_state);
}
//////////////////////////////////////////////////////////////////////////
@@ -472,93 +472,93 @@ void LLPanelAttachmentListItem::updateItem(const std::string& name,
static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelDummyClothingListItem(&typeid(LLPanelDummyClothingListItem::Params), "dummy_clothing_list_item");
LLPanelDummyClothingListItem::Params::Params()
-: add_panel("add_panel"),
- add_btn("add_btn")
+: add_panel("add_panel"),
+ add_btn("add_btn")
{}
LLPanelDummyClothingListItem* LLPanelDummyClothingListItem::create(LLWearableType::EType w_type)
{
- const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelDummyClothingListItem>();
+ const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelDummyClothingListItem>();
- LLPanelDummyClothingListItem* list_item = new LLPanelDummyClothingListItem(w_type, params);
- list_item->initFromParams(params);
- list_item->postBuild();
- return list_item;
+ LLPanelDummyClothingListItem* list_item = new LLPanelDummyClothingListItem(w_type, params);
+ list_item->initFromParams(params);
+ list_item->postBuild();
+ return list_item;
}
BOOL LLPanelDummyClothingListItem::postBuild()
{
- addWidgetToRightSide("btn_add_panel");
+ addWidgetToRightSide("btn_add_panel");
- setIconImage(LLInventoryIcon::getIcon(LLAssetType::AT_CLOTHING, LLInventoryType::IT_NONE, mWearableType, FALSE));
- updateItem(wearableTypeToString(mWearableType));
+ setIconImage(LLInventoryIcon::getIcon(LLAssetType::AT_CLOTHING, LLInventoryType::IT_NONE, mWearableType, FALSE));
+ updateItem(wearableTypeToString(mWearableType));
- // Make it look loke clothing item - reserve space for 'delete' button
- setLeftWidgetsWidth(getChildView("item_icon")->getRect().mLeft);
+ // Make it look loke clothing item - reserve space for 'delete' button
+ setLeftWidgetsWidth(getChildView("item_icon")->getRect().mLeft);
- setWidgetsVisible(false);
- reshapeWidgets();
+ setWidgetsVisible(false);
+ reshapeWidgets();
- return TRUE;
+ return TRUE;
}
LLWearableType::EType LLPanelDummyClothingListItem::getWearableType() const
{
- return mWearableType;
+ return mWearableType;
}
LLPanelDummyClothingListItem::LLPanelDummyClothingListItem(LLWearableType::EType w_type, const LLPanelDummyClothingListItem::Params& params)
-: LLPanelWearableListItem(NULL, params),
- mWearableType(w_type)
+: LLPanelWearableListItem(NULL, params),
+ mWearableType(w_type)
{
- LLPanel::Params panel_params(params.add_panel);
- applyXUILayout(panel_params, this);
- LLPanel* add_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
- addChild(add_panelp);
+ LLPanel::Params panel_params(params.add_panel);
+ applyXUILayout(panel_params, this);
+ LLPanel* add_panelp = LLUICtrlFactory::create<LLPanel>(panel_params);
+ addChild(add_panelp);
- if (add_panelp)
+ if (add_panelp)
{
- LLButton::Params button_params(params.add_btn);
- applyXUILayout(button_params, this);
- add_panelp->addChild(LLUICtrlFactory::create<LLButton>(button_params));
+ LLButton::Params button_params(params.add_btn);
+ applyXUILayout(button_params, this);
+ add_panelp->addChild(LLUICtrlFactory::create<LLButton>(button_params));
}
- setSeparatorVisible(true);
+ setSeparatorVisible(true);
}
typedef std::map<LLWearableType::EType, std::string> clothing_to_string_map_t;
clothing_to_string_map_t init_clothing_string_map()
{
- clothing_to_string_map_t w_map;
- w_map.insert(std::make_pair(LLWearableType::WT_SHIRT, "shirt_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_PANTS, "pants_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_SHOES, "shoes_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_SOCKS, "socks_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_JACKET, "jacket_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_GLOVES, "gloves_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_UNDERSHIRT, "undershirt_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_UNDERPANTS, "underpants_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_SKIRT, "skirt_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_ALPHA, "alpha_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_TATTOO, "tattoo_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_UNIVERSAL, "universal_not_worn"));
- w_map.insert(std::make_pair(LLWearableType::WT_PHYSICS, "physics_not_worn"));
- return w_map;
+ clothing_to_string_map_t w_map;
+ w_map.insert(std::make_pair(LLWearableType::WT_SHIRT, "shirt_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_PANTS, "pants_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_SHOES, "shoes_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_SOCKS, "socks_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_JACKET, "jacket_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_GLOVES, "gloves_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_UNDERSHIRT, "undershirt_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_UNDERPANTS, "underpants_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_SKIRT, "skirt_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_ALPHA, "alpha_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_TATTOO, "tattoo_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_UNIVERSAL, "universal_not_worn"));
+ w_map.insert(std::make_pair(LLWearableType::WT_PHYSICS, "physics_not_worn"));
+ return w_map;
}
std::string LLPanelDummyClothingListItem::wearableTypeToString(LLWearableType::EType w_type)
{
- static const clothing_to_string_map_t w_map = init_clothing_string_map();
- static const std::string invalid_str = LLTrans::getString("invalid_not_worn");
-
- std::string type_str = invalid_str;
- clothing_to_string_map_t::const_iterator it = w_map.find(w_type);
- if(w_map.end() != it)
- {
- type_str = LLTrans::getString(it->second);
- }
- return type_str;
+ static const clothing_to_string_map_t w_map = init_clothing_string_map();
+ static const std::string invalid_str = LLTrans::getString("invalid_not_worn");
+
+ std::string type_str = invalid_str;
+ clothing_to_string_map_t::const_iterator it = w_map.find(w_type);
+ if(w_map.end() != it)
+ {
+ type_str = LLTrans::getString(it->second);
+ }
+ return type_str;
}
//////////////////////////////////////////////////////////////////////////
@@ -566,145 +566,145 @@ std::string LLPanelDummyClothingListItem::wearableTypeToString(LLWearableType::E
//////////////////////////////////////////////////////////////////////////
LLWearableItemTypeNameComparator::LLWearableTypeOrder::LLWearableTypeOrder(LLWearableItemTypeNameComparator::ETypeListOrder order_priority, bool sort_asset_by_name, bool sort_wearable_by_name):
- mOrderPriority(order_priority),
- mSortAssetTypeByName(sort_asset_by_name),
- mSortWearableTypeByName(sort_wearable_by_name)
+ mOrderPriority(order_priority),
+ mSortAssetTypeByName(sort_asset_by_name),
+ mSortWearableTypeByName(sort_wearable_by_name)
{
}
LLWearableItemTypeNameComparator::LLWearableItemTypeNameComparator()
{
- // By default the sort order conforms the order by spec of MY OUTFITS items list:
- // 1. CLOTHING - sorted by name
- // 2. OBJECT - sorted by type
- // 3. BODYPART - sorted by name
- mWearableOrder[LLAssetType::AT_CLOTHING] = LLWearableTypeOrder(ORDER_RANK_1, false, false);
- mWearableOrder[LLAssetType::AT_OBJECT] = LLWearableTypeOrder(ORDER_RANK_2, true, true);
- mWearableOrder[LLAssetType::AT_BODYPART] = LLWearableTypeOrder(ORDER_RANK_3, false, true);
- mWearableOrder[LLAssetType::AT_GESTURE] = LLWearableTypeOrder(ORDER_RANK_4, true, false);
+ // By default the sort order conforms the order by spec of MY OUTFITS items list:
+ // 1. CLOTHING - sorted by name
+ // 2. OBJECT - sorted by type
+ // 3. BODYPART - sorted by name
+ mWearableOrder[LLAssetType::AT_CLOTHING] = LLWearableTypeOrder(ORDER_RANK_1, false, false);
+ mWearableOrder[LLAssetType::AT_OBJECT] = LLWearableTypeOrder(ORDER_RANK_2, true, true);
+ mWearableOrder[LLAssetType::AT_BODYPART] = LLWearableTypeOrder(ORDER_RANK_3, false, true);
+ mWearableOrder[LLAssetType::AT_GESTURE] = LLWearableTypeOrder(ORDER_RANK_4, true, false);
}
void LLWearableItemTypeNameComparator::setOrder(LLAssetType::EType items_of_type, LLWearableItemTypeNameComparator::ETypeListOrder order_priority, bool sort_asset_items_by_name, bool sort_wearable_items_by_name)
{
- mWearableOrder[items_of_type] = LLWearableTypeOrder(order_priority, sort_asset_items_by_name, sort_wearable_items_by_name);
+ mWearableOrder[items_of_type] = LLWearableTypeOrder(order_priority, sort_asset_items_by_name, sort_wearable_items_by_name);
}
/*virtual*/
bool LLWearableItemNameComparator::doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const
{
- std::string name1 = wearable_item1->getItemName();
- std::string name2 = wearable_item2->getItemName();
+ std::string name1 = wearable_item1->getItemName();
+ std::string name2 = wearable_item2->getItemName();
- LLStringUtil::toUpper(name1);
- LLStringUtil::toUpper(name2);
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
- return name1 < name2;
+ return name1 < name2;
}
/*virtual*/
bool LLWearableItemTypeNameComparator::doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const
{
- const LLAssetType::EType item_type1 = wearable_item1->getType();
- const LLAssetType::EType item_type2 = wearable_item2->getType();
-
- LLWearableItemTypeNameComparator::ETypeListOrder item_type_order1 = getTypeListOrder(item_type1);
- LLWearableItemTypeNameComparator::ETypeListOrder item_type_order2 = getTypeListOrder(item_type2);
-
- if (item_type_order1 != item_type_order2)
- {
- // If items are of different asset types we can compare them
- // by types order in the list.
- return item_type_order1 < item_type_order2;
- }
-
- if (sortAssetTypeByName(item_type1))
- {
- // If both items are of the same asset type except AT_CLOTHING and AT_BODYPART
- // we can compare them by name.
- return LLWearableItemNameComparator::doCompare(wearable_item1, wearable_item2);
- }
-
- const LLWearableType::EType item_wearable_type1 = wearable_item1->getWearableType();
- const LLWearableType::EType item_wearable_type2 = wearable_item2->getWearableType();
-
- if (item_wearable_type1 != item_wearable_type2)
- // If items are of different LLWearableType::EType types they are compared
- // by LLWearableType::EType. types order determined in LLWearableType::EType.
- {
- // If items are of different LLWearableType::EType types they are compared
- // by LLWearableType::EType. types order determined in LLWearableType::EType.
- return item_wearable_type1 < item_wearable_type2;
- }
- else
- {
- // If both items are of the same clothing type they are compared
- // by description and place in reverse order (i.e. outer layer item
- // on top) OR by name
- if(sortWearableTypeByName(item_type1))
- {
- return LLWearableItemNameComparator::doCompare(wearable_item1, wearable_item2);
- }
- return wearable_item1->getDescription() > wearable_item2->getDescription();
- }
+ const LLAssetType::EType item_type1 = wearable_item1->getType();
+ const LLAssetType::EType item_type2 = wearable_item2->getType();
+
+ LLWearableItemTypeNameComparator::ETypeListOrder item_type_order1 = getTypeListOrder(item_type1);
+ LLWearableItemTypeNameComparator::ETypeListOrder item_type_order2 = getTypeListOrder(item_type2);
+
+ if (item_type_order1 != item_type_order2)
+ {
+ // If items are of different asset types we can compare them
+ // by types order in the list.
+ return item_type_order1 < item_type_order2;
+ }
+
+ if (sortAssetTypeByName(item_type1))
+ {
+ // If both items are of the same asset type except AT_CLOTHING and AT_BODYPART
+ // we can compare them by name.
+ return LLWearableItemNameComparator::doCompare(wearable_item1, wearable_item2);
+ }
+
+ const LLWearableType::EType item_wearable_type1 = wearable_item1->getWearableType();
+ const LLWearableType::EType item_wearable_type2 = wearable_item2->getWearableType();
+
+ if (item_wearable_type1 != item_wearable_type2)
+ // If items are of different LLWearableType::EType types they are compared
+ // by LLWearableType::EType. types order determined in LLWearableType::EType.
+ {
+ // If items are of different LLWearableType::EType types they are compared
+ // by LLWearableType::EType. types order determined in LLWearableType::EType.
+ return item_wearable_type1 < item_wearable_type2;
+ }
+ else
+ {
+ // If both items are of the same clothing type they are compared
+ // by description and place in reverse order (i.e. outer layer item
+ // on top) OR by name
+ if(sortWearableTypeByName(item_type1))
+ {
+ return LLWearableItemNameComparator::doCompare(wearable_item1, wearable_item2);
+ }
+ return wearable_item1->getDescription() > wearable_item2->getDescription();
+ }
}
LLWearableItemTypeNameComparator::ETypeListOrder LLWearableItemTypeNameComparator::getTypeListOrder(LLAssetType::EType item_type) const
{
- wearable_type_order_map_t::const_iterator const_it = mWearableOrder.find(item_type);
+ wearable_type_order_map_t::const_iterator const_it = mWearableOrder.find(item_type);
- if(const_it == mWearableOrder.end())
- {
- LL_WARNS()<<"Absent information about order rang of items of "<<LLAssetType::getDesc(item_type)<<" type"<<LL_ENDL;
- return ORDER_RANK_UNKNOWN;
- }
+ if(const_it == mWearableOrder.end())
+ {
+ LL_WARNS()<<"Absent information about order rang of items of "<<LLAssetType::getDesc(item_type)<<" type"<<LL_ENDL;
+ return ORDER_RANK_UNKNOWN;
+ }
- return const_it->second.mOrderPriority;
+ return const_it->second.mOrderPriority;
}
bool LLWearableItemTypeNameComparator::sortAssetTypeByName(LLAssetType::EType item_type) const
{
- wearable_type_order_map_t::const_iterator const_it = mWearableOrder.find(item_type);
+ wearable_type_order_map_t::const_iterator const_it = mWearableOrder.find(item_type);
- if(const_it == mWearableOrder.end())
- {
- LL_WARNS()<<"Absent information about sorting items of "<<LLAssetType::getDesc(item_type)<<" type"<<LL_ENDL;
- return true;
- }
+ if(const_it == mWearableOrder.end())
+ {
+ LL_WARNS()<<"Absent information about sorting items of "<<LLAssetType::getDesc(item_type)<<" type"<<LL_ENDL;
+ return true;
+ }
- return const_it->second.mSortAssetTypeByName;
- }
+ return const_it->second.mSortAssetTypeByName;
+ }
bool LLWearableItemTypeNameComparator::sortWearableTypeByName(LLAssetType::EType item_type) const
{
- wearable_type_order_map_t::const_iterator const_it = mWearableOrder.find(item_type);
+ wearable_type_order_map_t::const_iterator const_it = mWearableOrder.find(item_type);
- if(const_it == mWearableOrder.end())
- {
- LL_WARNS()<<"Absent information about sorting items of "<<LLAssetType::getDesc(item_type)<<" type"<<LL_ENDL;
- return true;
+ if(const_it == mWearableOrder.end())
+ {
+ LL_WARNS()<<"Absent information about sorting items of "<<LLAssetType::getDesc(item_type)<<" type"<<LL_ENDL;
+ return true;
}
- return const_it->second.mSortWearableTypeByName;
+ return const_it->second.mSortWearableTypeByName;
}
/*virtual*/
bool LLWearableItemCreationDateComparator::doCompare(const LLPanelInventoryListItemBase* item1, const LLPanelInventoryListItemBase* item2) const
{
- time_t date1 = item1->getCreationDate();
- time_t date2 = item2->getCreationDate();
+ time_t date1 = item1->getCreationDate();
+ time_t date2 = item2->getCreationDate();
- if (date1 == date2)
- {
- return LLWearableItemNameComparator::doCompare(item1, item2);
- }
+ if (date1 == date2)
+ {
+ return LLWearableItemNameComparator::doCompare(item1, item2);
+ }
- return date1 > date2;
+ return date1 > date2;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -718,24 +718,24 @@ static const LLWearableItemCreationDateComparator WEARABLE_CREATION_DATE_COMPARA
static const LLDefaultChildRegistry::Register<LLWearableItemsList> r("wearable_items_list");
LLWearableItemsList::Params::Params()
-: standalone("standalone", true)
-, worn_indication_enabled("worn_indication_enabled", true)
+: standalone("standalone", true)
+, worn_indication_enabled("worn_indication_enabled", true)
, show_item_widgets("show_item_widgets", false)
{}
LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p)
-: LLInventoryItemsList(p)
+: LLInventoryItemsList(p)
{
- setSortOrder(E_SORT_BY_TYPE_LAYER, false);
- mMenuWearableType = LLWearableType::WT_NONE;
- mIsStandalone = p.standalone;
- if (mIsStandalone)
- {
- // Use built-in context menu.
- setRightMouseDownCallback(boost::bind(&LLWearableItemsList::onRightClick, this, _2, _3));
- }
- mWornIndicationEnabled = p.worn_indication_enabled;
- setNoItemsCommentText(LLTrans::getString("LoadingData"));
+ setSortOrder(E_SORT_BY_TYPE_LAYER, false);
+ mMenuWearableType = LLWearableType::WT_NONE;
+ mIsStandalone = p.standalone;
+ if (mIsStandalone)
+ {
+ // Use built-in context menu.
+ setRightMouseDownCallback(boost::bind(&LLWearableItemsList::onRightClick, this, _2, _3));
+ }
+ mWornIndicationEnabled = p.worn_indication_enabled;
+ setNoItemsCommentText(LLTrans::getString("LoadingData"));
mShowItemWidgets = p.show_item_widgets;
}
@@ -758,101 +758,101 @@ LLPanel* LLWearableItemsList::createNewItem(LLViewerInventoryItem* item)
void LLWearableItemsList::updateList(const LLUUID& category_id)
{
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
-
- LLFindOutfitItems collector = LLFindOutfitItems();
- // collectDescendentsIf takes non-const reference:
- gInventory.collectDescendentsIf(
- category_id,
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- collector);
-
- if(item_array.empty() && gInventory.isCategoryComplete(category_id))
- {
- setNoItemsCommentText(LLTrans::getString("EmptyOutfitText"));
- }
-
- refreshList(item_array);
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+
+ LLFindOutfitItems collector = LLFindOutfitItems();
+ // collectDescendentsIf takes non-const reference:
+ gInventory.collectDescendentsIf(
+ category_id,
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ collector);
+
+ if(item_array.empty() && gInventory.isCategoryComplete(category_id))
+ {
+ setNoItemsCommentText(LLTrans::getString("EmptyOutfitText"));
+ }
+
+ refreshList(item_array);
}
void LLWearableItemsList::updateChangedItems(const uuid_vec_t& changed_items_uuids)
{
- // nothing to update
- if (changed_items_uuids.empty())
- return;
-
- uuid_vec_t::const_iterator uuids_begin = changed_items_uuids.begin(), uuids_end = changed_items_uuids.end();
- pairs_const_iterator_t pairs_iter = getItemPairs().begin(), pairs_end = getItemPairs().end();
- while (pairs_iter != pairs_end)
- {
- LLPanel* panel = (*(pairs_iter++))->first;
- LLPanelInventoryListItemBase* item = dynamic_cast<LLPanelInventoryListItemBase*>(panel);
- if (!item)
- continue;
-
- LLViewerInventoryItem* inv_item = item->getItem();
- if (!inv_item)
- continue;
+ // nothing to update
+ if (changed_items_uuids.empty())
+ return;
+
+ uuid_vec_t::const_iterator uuids_begin = changed_items_uuids.begin(), uuids_end = changed_items_uuids.end();
+ pairs_const_iterator_t pairs_iter = getItemPairs().begin(), pairs_end = getItemPairs().end();
+ while (pairs_iter != pairs_end)
+ {
+ LLPanel* panel = (*(pairs_iter++))->first;
+ LLPanelInventoryListItemBase* item = dynamic_cast<LLPanelInventoryListItemBase*>(panel);
+ if (!item)
+ continue;
+
+ LLViewerInventoryItem* inv_item = item->getItem();
+ if (!inv_item)
+ continue;
const LLUUID& linked_uuid = inv_item->getLinkedUUID();
if (std::find(uuids_begin, uuids_end, linked_uuid) != uuids_end)
{
item->setNeedsRefresh(true);
}
- }
+ }
}
void LLWearableItemsList::onRightClick(S32 x, S32 y)
{
- uuid_vec_t selected_uuids;
-
- getSelectedUUIDs(selected_uuids);
- if (selected_uuids.empty())
- {
- if ((mMenuWearableType != LLWearableType::WT_NONE) && (size() == 0))
- {
- ContextMenu::instance().show(this, mMenuWearableType, x, y);
- }
- }
- else
- {
- ContextMenu::instance().show(this, selected_uuids, x, y);
- }
+ uuid_vec_t selected_uuids;
+
+ getSelectedUUIDs(selected_uuids);
+ if (selected_uuids.empty())
+ {
+ if ((mMenuWearableType != LLWearableType::WT_NONE) && (size() == 0))
+ {
+ ContextMenu::instance().show(this, mMenuWearableType, x, y);
+ }
+ }
+ else
+ {
+ ContextMenu::instance().show(this, selected_uuids, x, y);
+ }
}
void LLWearableItemsList::setSortOrder(ESortOrder sort_order, bool sort_now)
{
- switch (sort_order)
- {
- case E_SORT_BY_MOST_RECENT:
- setComparator(&WEARABLE_CREATION_DATE_COMPARATOR);
- break;
- case E_SORT_BY_NAME:
- setComparator(&WEARABLE_NAME_COMPARATOR);
- break;
- case E_SORT_BY_TYPE_LAYER:
- setComparator(&WEARABLE_TYPE_LAYER_COMPARATOR);
- break;
- case E_SORT_BY_TYPE_NAME:
- {
- WEARABLE_TYPE_NAME_COMPARATOR.setOrder(LLAssetType::AT_CLOTHING, LLWearableItemTypeNameComparator::ORDER_RANK_1, false, true);
- setComparator(&WEARABLE_TYPE_NAME_COMPARATOR);
- break;
- }
-
- // No "default:" to raise compiler warning
- // if we're not handling something
- }
-
- mSortOrder = sort_order;
-
- if (sort_now)
- {
- sort();
- }
+ switch (sort_order)
+ {
+ case E_SORT_BY_MOST_RECENT:
+ setComparator(&WEARABLE_CREATION_DATE_COMPARATOR);
+ break;
+ case E_SORT_BY_NAME:
+ setComparator(&WEARABLE_NAME_COMPARATOR);
+ break;
+ case E_SORT_BY_TYPE_LAYER:
+ setComparator(&WEARABLE_TYPE_LAYER_COMPARATOR);
+ break;
+ case E_SORT_BY_TYPE_NAME:
+ {
+ WEARABLE_TYPE_NAME_COMPARATOR.setOrder(LLAssetType::AT_CLOTHING, LLWearableItemTypeNameComparator::ORDER_RANK_1, false, true);
+ setComparator(&WEARABLE_TYPE_NAME_COMPARATOR);
+ break;
+ }
+
+ // No "default:" to raise compiler warning
+ // if we're not handling something
+ }
+
+ mSortOrder = sort_order;
+
+ if (sort_now)
+ {
+ sort();
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -860,235 +860,235 @@ void LLWearableItemsList::setSortOrder(ESortOrder sort_order, bool sort_now)
//////////////////////////////////////////////////////////////////////////
LLWearableItemsList::ContextMenu::ContextMenu()
-: mParent(NULL)
+: mParent(NULL)
{
}
void LLWearableItemsList::ContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
{
- mParent = dynamic_cast<LLWearableItemsList*>(spawning_view);
- LLListContextMenu::show(spawning_view, uuids, x, y);
- mParent = NULL; // to avoid dereferencing an invalid pointer
+ mParent = dynamic_cast<LLWearableItemsList*>(spawning_view);
+ LLListContextMenu::show(spawning_view, uuids, x, y);
+ mParent = NULL; // to avoid dereferencing an invalid pointer
}
void LLWearableItemsList::ContextMenu::show(LLView* spawning_view, LLWearableType::EType w_type, S32 x, S32 y)
{
- mParent = dynamic_cast<LLWearableItemsList*>(spawning_view);
- LLContextMenu* menup = mMenuHandle.get();
- if (menup)
- {
- //preventing parent (menu holder) from deleting already "dead" context menus on exit
- LLView* parent = menup->getParent();
- if (parent)
- {
- parent->removeChild(menup);
- }
- delete menup;
- mUUIDs.clear();
- }
-
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ mParent = dynamic_cast<LLWearableItemsList*>(spawning_view);
+ LLContextMenu* menup = mMenuHandle.get();
+ if (menup)
+ {
+ //preventing parent (menu holder) from deleting already "dead" context menus on exit
+ LLView* parent = menup->getParent();
+ if (parent)
+ {
+ parent->removeChild(menup);
+ }
+ delete menup;
+ mUUIDs.clear();
+ }
+
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
registrar.add("Wearable.CreateNew", boost::bind(createNewWearableByType, w_type));
- menup = createFromFile("menu_wearable_list_item.xml");
- if (!menup)
- {
- LL_WARNS() << "Context menu creation failed" << LL_ENDL;
- return;
- }
- setMenuItemVisible(menup, "create_new", true);
- setMenuItemEnabled(menup, "create_new", true);
- setMenuItemVisible(menup, "wearable_attach_to", false);
- setMenuItemVisible(menup, "wearable_attach_to_hud", false);
-
- std::string new_label = LLTrans::getString("create_new_" + LLWearableType::getInstance()->getTypeName(w_type));
- LLMenuItemGL* menu_item = menup->getChild<LLMenuItemGL>("create_new");
- menu_item->setLabel(new_label);
-
- mMenuHandle = menup->getHandle();
- menup->show(x, y);
- LLMenuGL::showPopup(spawning_view, menup, x, y);
-
- mParent = NULL; // to avoid dereferencing an invalid pointer
+ menup = createFromFile("menu_wearable_list_item.xml");
+ if (!menup)
+ {
+ LL_WARNS() << "Context menu creation failed" << LL_ENDL;
+ return;
+ }
+ setMenuItemVisible(menup, "create_new", true);
+ setMenuItemEnabled(menup, "create_new", true);
+ setMenuItemVisible(menup, "wearable_attach_to", false);
+ setMenuItemVisible(menup, "wearable_attach_to_hud", false);
+
+ std::string new_label = LLTrans::getString("create_new_" + LLWearableType::getInstance()->getTypeName(w_type));
+ LLMenuItemGL* menu_item = menup->getChild<LLMenuItemGL>("create_new");
+ menu_item->setLabel(new_label);
+
+ mMenuHandle = menup->getHandle();
+ menup->show(x, y);
+ LLMenuGL::showPopup(spawning_view, menup, x, y);
+
+ mParent = NULL; // to avoid dereferencing an invalid pointer
}
// virtual
LLContextMenu* LLWearableItemsList::ContextMenu::createMenu()
{
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- const uuid_vec_t& ids = mUUIDs; // selected items IDs
- LLUUID selected_id = ids.front(); // ID of the first selected item
-
- // Register handlers common for all wearable types.
- registrar.add("Wearable.Wear", boost::bind(wear_multiple, ids, true));
- registrar.add("Wearable.Add", boost::bind(wear_multiple, ids, false));
- registrar.add("Wearable.Edit", boost::bind(handle_item_edit, selected_id));
- registrar.add("Wearable.CreateNew", boost::bind(createNewWearable, selected_id));
- registrar.add("Wearable.ShowOriginal", boost::bind(show_item_original, selected_id));
- registrar.add("Wearable.TakeOffDetach",
- boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids));
-
- // Register handlers for clothing.
- registrar.add("Clothing.TakeOff",
- boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids));
-
- // Register handlers for body parts.
-
- // Register handlers for attachments.
- registrar.add("Attachment.Detach",
- boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids));
- registrar.add("Attachment.Touch", boost::bind(handle_attachment_touch, selected_id));
- registrar.add("Attachment.Profile", boost::bind(show_item_profile, selected_id));
- registrar.add("Object.Attach", boost::bind(LLViewerAttachMenu::attachObjects, ids, _2));
-
- // Create the menu.
- LLContextMenu* menu = createFromFile("menu_wearable_list_item.xml");
-
- // Determine which items should be visible/enabled.
- updateItemsVisibility(menu);
-
- // Update labels for the items requiring that.
- updateItemsLabels(menu);
- return menu;
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ const uuid_vec_t& ids = mUUIDs; // selected items IDs
+ LLUUID selected_id = ids.front(); // ID of the first selected item
+
+ // Register handlers common for all wearable types.
+ registrar.add("Wearable.Wear", boost::bind(wear_multiple, ids, true));
+ registrar.add("Wearable.Add", boost::bind(wear_multiple, ids, false));
+ registrar.add("Wearable.Edit", boost::bind(handle_item_edit, selected_id));
+ registrar.add("Wearable.CreateNew", boost::bind(createNewWearable, selected_id));
+ registrar.add("Wearable.ShowOriginal", boost::bind(show_item_original, selected_id));
+ registrar.add("Wearable.TakeOffDetach",
+ boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids));
+
+ // Register handlers for clothing.
+ registrar.add("Clothing.TakeOff",
+ boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids));
+
+ // Register handlers for body parts.
+
+ // Register handlers for attachments.
+ registrar.add("Attachment.Detach",
+ boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids));
+ registrar.add("Attachment.Touch", boost::bind(handle_attachment_touch, selected_id));
+ registrar.add("Attachment.Profile", boost::bind(show_item_profile, selected_id));
+ registrar.add("Object.Attach", boost::bind(LLViewerAttachMenu::attachObjects, ids, _2));
+
+ // Create the menu.
+ LLContextMenu* menu = createFromFile("menu_wearable_list_item.xml");
+
+ // Determine which items should be visible/enabled.
+ updateItemsVisibility(menu);
+
+ // Update labels for the items requiring that.
+ updateItemsLabels(menu);
+ return menu;
}
void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu)
{
- if (!menu)
- {
- LL_WARNS() << "Invalid menu" << LL_ENDL;
- return;
- }
-
- const uuid_vec_t& ids = mUUIDs; // selected items IDs
- U32 mask = 0; // mask of selected items' types
- U32 n_items = ids.size(); // number of selected items
- U32 n_worn = 0; // number of worn items among the selected ones
- U32 n_already_worn = 0; // number of items worn of same type as selected items
- U32 n_links = 0; // number of links among the selected items
- U32 n_editable = 0; // number of editable items among the selected ones
- U32 n_touchable = 0; // number of touchable items among the selected ones
-
- bool can_be_worn = true;
-
- for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- LLUUID id = *it;
- LLViewerInventoryItem* item = gInventory.getItem(id);
-
- if (!item)
- {
- LL_WARNS() << "Invalid item" << LL_ENDL;
- // *NOTE: the logic below may not work in this case
- continue;
- }
-
- updateMask(mask, item->getType());
-
- const LLWearableType::EType wearable_type = item->getWearableType();
- const bool is_link = item->getIsLinkType();
- const bool is_worn = get_is_item_worn(id);
- const bool is_editable = get_is_item_editable(id);
- const bool is_touchable = enable_attachment_touch(id);
- const bool is_already_worn = gAgentWearables.selfHasWearable(wearable_type);
- if (is_worn)
- {
- ++n_worn;
- }
- if (is_touchable)
- {
- ++n_touchable;
- }
- if (is_editable)
- {
- ++n_editable;
- }
- if (is_link)
- {
- ++n_links;
- }
- if (is_already_worn)
- {
- ++n_already_worn;
- }
-
- if (can_be_worn)
- {
- can_be_worn = get_can_item_be_worn(item->getLinkedUUID());
- }
- } // for
-
- bool standalone = mParent ? mParent->isStandalone() : false;
- bool wear_add_visible = mask & (MASK_CLOTHING|MASK_ATTACHMENT) && n_worn == 0 && can_be_worn && (n_already_worn != 0 || mask & MASK_ATTACHMENT);
-
- // *TODO: eliminate multiple traversals over the menu items
- setMenuItemVisible(menu, "wear_wear", n_already_worn == 0 && n_worn == 0 && can_be_worn);
- setMenuItemEnabled(menu, "wear_wear", n_already_worn == 0 && n_worn == 0);
- setMenuItemVisible(menu, "wear_add", wear_add_visible);
- setMenuItemEnabled(menu, "wear_add", LLAppearanceMgr::instance().canAddWearables(ids));
- setMenuItemVisible(menu, "wear_replace", n_worn == 0 && n_already_worn != 0 && can_be_worn);
- //visible only when one item selected and this item is worn
- setMenuItemVisible(menu, "touch", !standalone && mask == MASK_ATTACHMENT && n_worn == n_items);
- setMenuItemEnabled(menu, "touch", n_touchable && n_worn == 1 && n_items == 1);
- setMenuItemVisible(menu, "edit", !standalone && mask & (MASK_CLOTHING|MASK_BODYPART|MASK_ATTACHMENT) && n_worn == n_items);
- setMenuItemEnabled(menu, "edit", n_editable && n_worn == 1 && n_items == 1);
- setMenuItemVisible(menu, "create_new", mask & (MASK_CLOTHING|MASK_BODYPART) && n_items == 1);
- setMenuItemEnabled(menu, "create_new", LLAppearanceMgr::instance().canAddWearables(ids));
- setMenuItemVisible(menu, "show_original", !standalone);
- setMenuItemEnabled(menu, "show_original", n_items == 1 && n_links == n_items);
- setMenuItemVisible(menu, "take_off", mask == MASK_CLOTHING && n_worn == n_items);
- setMenuItemVisible(menu, "detach", mask == MASK_ATTACHMENT && n_worn == n_items);
- setMenuItemVisible(menu, "take_off_or_detach", mask == (MASK_ATTACHMENT|MASK_CLOTHING));
- setMenuItemEnabled(menu, "take_off_or_detach", n_worn == n_items);
- setMenuItemVisible(menu, "object_profile", !standalone);
- setMenuItemEnabled(menu, "object_profile", n_items == 1);
- setMenuItemVisible(menu, "--no options--", FALSE);
- setMenuItemEnabled(menu, "--no options--", FALSE);
-
- // Populate or hide the "Attach to..." / "Attach to HUD..." submenus.
- if (mask == MASK_ATTACHMENT && n_worn == 0)
- {
- LLViewerAttachMenu::populateMenus("wearable_attach_to", "wearable_attach_to_hud");
- }
- else
- {
- setMenuItemVisible(menu, "wearable_attach_to", false);
- setMenuItemVisible(menu, "wearable_attach_to_hud", false);
- }
-
- if (mask & MASK_UNKNOWN)
- {
- LL_WARNS() << "Non-wearable items passed." << LL_ENDL;
- }
-
- U32 num_visible_items = 0;
- for (U32 menu_item_index = 0; menu_item_index < menu->getItemCount(); ++menu_item_index)
- {
- const LLMenuItemGL* menu_item = menu->getItem(menu_item_index);
- if (menu_item && menu_item->getVisible())
- {
- num_visible_items++;
- }
- }
- if (num_visible_items == 0)
- {
- setMenuItemVisible(menu, "--no options--", TRUE);
- }
+ if (!menu)
+ {
+ LL_WARNS() << "Invalid menu" << LL_ENDL;
+ return;
+ }
+
+ const uuid_vec_t& ids = mUUIDs; // selected items IDs
+ U32 mask = 0; // mask of selected items' types
+ U32 n_items = ids.size(); // number of selected items
+ U32 n_worn = 0; // number of worn items among the selected ones
+ U32 n_already_worn = 0; // number of items worn of same type as selected items
+ U32 n_links = 0; // number of links among the selected items
+ U32 n_editable = 0; // number of editable items among the selected ones
+ U32 n_touchable = 0; // number of touchable items among the selected ones
+
+ bool can_be_worn = true;
+
+ for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ LLUUID id = *it;
+ LLViewerInventoryItem* item = gInventory.getItem(id);
+
+ if (!item)
+ {
+ LL_WARNS() << "Invalid item" << LL_ENDL;
+ // *NOTE: the logic below may not work in this case
+ continue;
+ }
+
+ updateMask(mask, item->getType());
+
+ const LLWearableType::EType wearable_type = item->getWearableType();
+ const bool is_link = item->getIsLinkType();
+ const bool is_worn = get_is_item_worn(id);
+ const bool is_editable = get_is_item_editable(id);
+ const bool is_touchable = enable_attachment_touch(id);
+ const bool is_already_worn = gAgentWearables.selfHasWearable(wearable_type);
+ if (is_worn)
+ {
+ ++n_worn;
+ }
+ if (is_touchable)
+ {
+ ++n_touchable;
+ }
+ if (is_editable)
+ {
+ ++n_editable;
+ }
+ if (is_link)
+ {
+ ++n_links;
+ }
+ if (is_already_worn)
+ {
+ ++n_already_worn;
+ }
+
+ if (can_be_worn)
+ {
+ can_be_worn = get_can_item_be_worn(item->getLinkedUUID());
+ }
+ } // for
+
+ bool standalone = mParent ? mParent->isStandalone() : false;
+ bool wear_add_visible = mask & (MASK_CLOTHING|MASK_ATTACHMENT) && n_worn == 0 && can_be_worn && (n_already_worn != 0 || mask & MASK_ATTACHMENT);
+
+ // *TODO: eliminate multiple traversals over the menu items
+ setMenuItemVisible(menu, "wear_wear", n_already_worn == 0 && n_worn == 0 && can_be_worn);
+ setMenuItemEnabled(menu, "wear_wear", n_already_worn == 0 && n_worn == 0);
+ setMenuItemVisible(menu, "wear_add", wear_add_visible);
+ setMenuItemEnabled(menu, "wear_add", LLAppearanceMgr::instance().canAddWearables(ids));
+ setMenuItemVisible(menu, "wear_replace", n_worn == 0 && n_already_worn != 0 && can_be_worn);
+ //visible only when one item selected and this item is worn
+ setMenuItemVisible(menu, "touch", !standalone && mask == MASK_ATTACHMENT && n_worn == n_items);
+ setMenuItemEnabled(menu, "touch", n_touchable && n_worn == 1 && n_items == 1);
+ setMenuItemVisible(menu, "edit", !standalone && mask & (MASK_CLOTHING|MASK_BODYPART|MASK_ATTACHMENT) && n_worn == n_items);
+ setMenuItemEnabled(menu, "edit", n_editable && n_worn == 1 && n_items == 1);
+ setMenuItemVisible(menu, "create_new", mask & (MASK_CLOTHING|MASK_BODYPART) && n_items == 1);
+ setMenuItemEnabled(menu, "create_new", LLAppearanceMgr::instance().canAddWearables(ids));
+ setMenuItemVisible(menu, "show_original", !standalone);
+ setMenuItemEnabled(menu, "show_original", n_items == 1 && n_links == n_items);
+ setMenuItemVisible(menu, "take_off", mask == MASK_CLOTHING && n_worn == n_items);
+ setMenuItemVisible(menu, "detach", mask == MASK_ATTACHMENT && n_worn == n_items);
+ setMenuItemVisible(menu, "take_off_or_detach", mask == (MASK_ATTACHMENT|MASK_CLOTHING));
+ setMenuItemEnabled(menu, "take_off_or_detach", n_worn == n_items);
+ setMenuItemVisible(menu, "object_profile", !standalone);
+ setMenuItemEnabled(menu, "object_profile", n_items == 1);
+ setMenuItemVisible(menu, "--no options--", FALSE);
+ setMenuItemEnabled(menu, "--no options--", FALSE);
+
+ // Populate or hide the "Attach to..." / "Attach to HUD..." submenus.
+ if (mask == MASK_ATTACHMENT && n_worn == 0)
+ {
+ LLViewerAttachMenu::populateMenus("wearable_attach_to", "wearable_attach_to_hud");
+ }
+ else
+ {
+ setMenuItemVisible(menu, "wearable_attach_to", false);
+ setMenuItemVisible(menu, "wearable_attach_to_hud", false);
+ }
+
+ if (mask & MASK_UNKNOWN)
+ {
+ LL_WARNS() << "Non-wearable items passed." << LL_ENDL;
+ }
+
+ U32 num_visible_items = 0;
+ for (U32 menu_item_index = 0; menu_item_index < menu->getItemCount(); ++menu_item_index)
+ {
+ const LLMenuItemGL* menu_item = menu->getItem(menu_item_index);
+ if (menu_item && menu_item->getVisible())
+ {
+ num_visible_items++;
+ }
+ }
+ if (num_visible_items == 0)
+ {
+ setMenuItemVisible(menu, "--no options--", TRUE);
+ }
}
void LLWearableItemsList::ContextMenu::updateItemsLabels(LLContextMenu* menu)
{
- llassert(menu);
- if (!menu) return;
+ llassert(menu);
+ if (!menu) return;
- // Set proper label for the "Create new <WEARABLE_TYPE>" menu item.
- LLViewerInventoryItem* item = gInventory.getLinkedItem(mUUIDs.back());
- if (!item || !item->isWearableType()) return;
+ // Set proper label for the "Create new <WEARABLE_TYPE>" menu item.
+ LLViewerInventoryItem* item = gInventory.getLinkedItem(mUUIDs.back());
+ if (!item || !item->isWearableType()) return;
- LLWearableType::EType w_type = item->getWearableType();
- std::string new_label = LLTrans::getString("create_new_" + LLWearableType::getInstance()->getTypeName(w_type));
+ LLWearableType::EType w_type = item->getWearableType();
+ std::string new_label = LLTrans::getString("create_new_" + LLWearableType::getInstance()->getTypeName(w_type));
- LLMenuItemGL* menu_item = menu->getChild<LLMenuItemGL>("create_new");
- menu_item->setLabel(new_label);
+ LLMenuItemGL* menu_item = menu->getChild<LLMenuItemGL>("create_new");
+ menu_item->setLabel(new_label);
}
// We need this method to convert non-zero BOOL values to exactly 1 (TRUE).
@@ -1097,53 +1097,53 @@ void LLWearableItemsList::ContextMenu::updateItemsLabels(LLContextMenu* menu)
// static
void LLWearableItemsList::ContextMenu::setMenuItemVisible(LLContextMenu* menu, const std::string& name, bool val)
{
- menu->setItemVisible(name, val);
+ menu->setItemVisible(name, val);
}
// static
void LLWearableItemsList::ContextMenu::setMenuItemEnabled(LLContextMenu* menu, const std::string& name, bool val)
{
- menu->setItemEnabled(name, val);
+ menu->setItemEnabled(name, val);
}
// static
void LLWearableItemsList::ContextMenu::updateMask(U32& mask, LLAssetType::EType at)
{
- if (at == LLAssetType::AT_CLOTHING)
- {
- mask |= MASK_CLOTHING;
- }
- else if (at == LLAssetType::AT_BODYPART)
- {
- mask |= MASK_BODYPART;
- }
- else if (at == LLAssetType::AT_OBJECT)
- {
- mask |= MASK_ATTACHMENT;
- }
- else if (at == LLAssetType::AT_GESTURE)
- {
- mask |= MASK_GESTURE;
- }
- else
- {
- mask |= MASK_UNKNOWN;
- }
+ if (at == LLAssetType::AT_CLOTHING)
+ {
+ mask |= MASK_CLOTHING;
+ }
+ else if (at == LLAssetType::AT_BODYPART)
+ {
+ mask |= MASK_BODYPART;
+ }
+ else if (at == LLAssetType::AT_OBJECT)
+ {
+ mask |= MASK_ATTACHMENT;
+ }
+ else if (at == LLAssetType::AT_GESTURE)
+ {
+ mask |= MASK_GESTURE;
+ }
+ else
+ {
+ mask |= MASK_UNKNOWN;
+ }
}
// static
void LLWearableItemsList::ContextMenu::createNewWearable(const LLUUID& item_id)
{
- LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id);
- if (!item || !item->isWearableType()) return;
+ LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id);
+ if (!item || !item->isWearableType()) return;
- LLAgentWearables::createWearable(item->getWearableType(), true);
+ LLAgentWearables::createWearable(item->getWearableType(), true);
}
// static
void LLWearableItemsList::ContextMenu::createNewWearableByType(LLWearableType::EType type)
{
- LLAgentWearables::createWearable(type, true);
+ LLAgentWearables::createWearable(type, true);
}
// EOF
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index 0dbe50d5e4..80e211ad6b 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,28 +41,28 @@
* @class LLPanelWearableListItem
*
* Extends LLPanelInventoryListItemBase:
- * - makes side widgets show on mouse_enter and hide on
+ * - makes side widgets show on mouse_enter and hide on
* mouse_leave events.
* - provides callback for button clicks
*/
class LLPanelWearableListItem : public LLPanelInventoryListItemBase
{
- LOG_CLASS(LLPanelWearableListItem);
+ LOG_CLASS(LLPanelWearableListItem);
public:
- /**
- * Shows buttons when mouse is over
- */
- /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
+ /**
+ * Shows buttons when mouse is over
+ */
+ /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
- /**
- * Hides buttons when mouse is out
- */
- /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
+ /**
+ * Hides buttons when mouse is out
+ */
+ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
protected:
- LLPanelWearableListItem(LLViewerInventoryItem* item, const Params& params);
+ LLPanelWearableListItem(LLViewerInventoryItem* item, const Params& params);
};
/**
@@ -74,7 +74,7 @@ protected:
*/
class LLPanelWearableOutfitItem : public LLPanelWearableListItem
{
- LOG_CLASS(LLPanelWearableOutfitItem);
+ LOG_CLASS(LLPanelWearableOutfitItem);
public:
struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params>
{
@@ -86,69 +86,69 @@ public:
BOOL postBuild();
BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
- static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item,
- bool worn_indication_enabled,
+ static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item,
+ bool worn_indication_enabled,
bool show_widgets);
- /**
- * Updates item name and (worn) suffix.
- */
- /*virtual*/ void updateItem(const std::string& name,
- EItemState item_state = IS_DEFAULT);
+ /**
+ * Updates item name and (worn) suffix.
+ */
+ /*virtual*/ void updateItem(const std::string& name,
+ EItemState item_state = IS_DEFAULT);
void onAddWearable();
void onRemoveWearable();
protected:
- LLPanelWearableOutfitItem(LLViewerInventoryItem* item,
- bool worn_indication_enabled, const Params& params, bool show_widgets = false);
+ LLPanelWearableOutfitItem(LLViewerInventoryItem* item,
+ bool worn_indication_enabled, const Params& params, bool show_widgets = false);
private:
- bool mWornIndicationEnabled;
+ bool mWornIndicationEnabled;
bool mShowWidgets;
};
class LLPanelDeletableWearableListItem : public LLPanelWearableListItem
{
- LOG_CLASS(LLPanelDeletableWearableListItem);
+ LOG_CLASS(LLPanelDeletableWearableListItem);
public:
- struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params>
- {
- Optional<LLButton::Params> delete_btn;
+ struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params>
+ {
+ Optional<LLButton::Params> delete_btn;
- Params();
- };
+ Params();
+ };
- static LLPanelDeletableWearableListItem* create(LLViewerInventoryItem* item);
+ static LLPanelDeletableWearableListItem* create(LLViewerInventoryItem* item);
- virtual ~LLPanelDeletableWearableListItem() {};
+ virtual ~LLPanelDeletableWearableListItem() {};
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /**
- * Make button visible during mouse over event.
- */
- inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); }
+ /**
+ * Make button visible during mouse over event.
+ */
+ inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); }
protected:
- LLPanelDeletableWearableListItem(LLViewerInventoryItem* item, const Params& params);
+ LLPanelDeletableWearableListItem(LLViewerInventoryItem* item, const Params& params);
};
/** Outfit list item for an attachment */
class LLPanelAttachmentListItem : public LLPanelDeletableWearableListItem
{
- LOG_CLASS(LLPanelAttachmentListItem);
+ LOG_CLASS(LLPanelAttachmentListItem);
public:
- static LLPanelAttachmentListItem* create(LLViewerInventoryItem* item);
- virtual ~LLPanelAttachmentListItem() {};
+ static LLPanelAttachmentListItem* create(LLViewerInventoryItem* item);
+ virtual ~LLPanelAttachmentListItem() {};
- /** Set item title. Joint name is added to the title in parenthesis */
- /*virtual*/ void updateItem(const std::string& name,
- EItemState item_state = IS_DEFAULT);
+ /** Set item title. Joint name is added to the title in parenthesis */
+ /*virtual*/ void updateItem(const std::string& name,
+ EItemState item_state = IS_DEFAULT);
protected:
- LLPanelAttachmentListItem(LLViewerInventoryItem* item, const Params& params) : LLPanelDeletableWearableListItem(item, params) {};
+ LLPanelAttachmentListItem(LLViewerInventoryItem* item, const Params& params) : LLPanelDeletableWearableListItem(item, params) {};
};
/**
@@ -158,70 +158,70 @@ protected:
*/
class LLPanelClothingListItem : public LLPanelDeletableWearableListItem
{
- LOG_CLASS(LLPanelClothingListItem);
+ LOG_CLASS(LLPanelClothingListItem);
public:
- struct Params : public LLInitParam::Block<Params, LLPanelDeletableWearableListItem::Params>
- {
- Optional<LLButton::Params> up_btn,
- down_btn,
- edit_btn;
- Optional<LLPanel::Params> lock_panel,
- edit_panel;
- Optional<LLIconCtrl::Params> lock_icon;
+ struct Params : public LLInitParam::Block<Params, LLPanelDeletableWearableListItem::Params>
+ {
+ Optional<LLButton::Params> up_btn,
+ down_btn,
+ edit_btn;
+ Optional<LLPanel::Params> lock_panel,
+ edit_panel;
+ Optional<LLIconCtrl::Params> lock_icon;
- Params();
- };
+ Params();
+ };
- static LLPanelClothingListItem* create(LLViewerInventoryItem* item);
+ static LLPanelClothingListItem* create(LLViewerInventoryItem* item);
- virtual ~LLPanelClothingListItem();
+ virtual ~LLPanelClothingListItem();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /**
- * Make button visible during mouse over event.
- */
- inline void setShowMoveUpButton(bool show) { setShowWidget("btn_move_up", show); }
+ /**
+ * Make button visible during mouse over event.
+ */
+ inline void setShowMoveUpButton(bool show) { setShowWidget("btn_move_up", show); }
- inline void setShowMoveDownButton(bool show) { setShowWidget("btn_move_down", show); }
- inline void setShowLockButton(bool show) { setShowWidget("btn_lock", show); }
- inline void setShowEditButton(bool show) { setShowWidget("btn_edit_panel", show); }
+ inline void setShowMoveDownButton(bool show) { setShowWidget("btn_move_down", show); }
+ inline void setShowLockButton(bool show) { setShowWidget("btn_lock", show); }
+ inline void setShowEditButton(bool show) { setShowWidget("btn_edit_panel", show); }
protected:
- LLPanelClothingListItem(LLViewerInventoryItem* item, const Params& params);
+ LLPanelClothingListItem(LLViewerInventoryItem* item, const Params& params);
};
class LLPanelBodyPartsListItem : public LLPanelWearableListItem
{
- LOG_CLASS(LLPanelBodyPartsListItem);
+ LOG_CLASS(LLPanelBodyPartsListItem);
public:
- struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params>
- {
- Optional<LLButton::Params> edit_btn;
- Optional<LLPanel::Params> lock_panel,
- edit_panel;
- Optional<LLIconCtrl::Params> lock_icon;
+ struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params>
+ {
+ Optional<LLButton::Params> edit_btn;
+ Optional<LLPanel::Params> lock_panel,
+ edit_panel;
+ Optional<LLIconCtrl::Params> lock_icon;
- Params();
- };
+ Params();
+ };
- static LLPanelBodyPartsListItem* create(LLViewerInventoryItem* item);
+ static LLPanelBodyPartsListItem* create(LLViewerInventoryItem* item);
- virtual ~LLPanelBodyPartsListItem();
+ virtual ~LLPanelBodyPartsListItem();
- /*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL postBuild();
- /**
- * Make button visible during mouse over event.
- */
- inline void setShowLockButton(bool show) { setShowWidget("btn_lock", show); }
- inline void setShowEditButton(bool show) { setShowWidget("btn_edit_panel", show); }
+ /**
+ * Make button visible during mouse over event.
+ */
+ inline void setShowLockButton(bool show) { setShowWidget("btn_lock", show); }
+ inline void setShowEditButton(bool show) { setShowWidget("btn_edit_panel", show); }
protected:
- LLPanelBodyPartsListItem(LLViewerInventoryItem* item, const Params& params);
+ LLPanelBodyPartsListItem(LLViewerInventoryItem* item, const Params& params);
};
@@ -233,24 +233,24 @@ protected:
class LLPanelDummyClothingListItem : public LLPanelWearableListItem
{
public:
- struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params>
- {
- Optional<LLPanel::Params> add_panel;
- Optional<LLButton::Params> add_btn;
- Params();
- };
- static LLPanelDummyClothingListItem* create(LLWearableType::EType w_type);
+ struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params>
+ {
+ Optional<LLPanel::Params> add_panel;
+ Optional<LLButton::Params> add_btn;
+ Params();
+ };
+ static LLPanelDummyClothingListItem* create(LLWearableType::EType w_type);
- /*virtual*/ BOOL postBuild();
- LLWearableType::EType getWearableType() const;
+ /*virtual*/ BOOL postBuild();
+ LLWearableType::EType getWearableType() const;
protected:
- LLPanelDummyClothingListItem(LLWearableType::EType w_type, const Params& params);
+ LLPanelDummyClothingListItem(LLWearableType::EType w_type, const Params& params);
- static std::string wearableTypeToString(LLWearableType::EType w_type);
+ static std::string wearableTypeToString(LLWearableType::EType w_type);
private:
- LLWearableType::EType mWearableType;
+ LLWearableType::EType mWearableType;
};
/**
@@ -260,33 +260,33 @@ private:
*/
class LLWearableListItemComparator : public LLFlatListView::ItemComparator
{
- LOG_CLASS(LLWearableListItemComparator);
+ LOG_CLASS(LLWearableListItemComparator);
public:
- LLWearableListItemComparator() {};
- virtual ~LLWearableListItemComparator() {};
+ LLWearableListItemComparator() {};
+ virtual ~LLWearableListItemComparator() {};
- virtual bool compare(const LLPanel* item1, const LLPanel* item2) const
- {
- const LLPanelInventoryListItemBase* wearable_item1 = dynamic_cast<const LLPanelInventoryListItemBase*>(item1);
- const LLPanelInventoryListItemBase* wearable_item2 = dynamic_cast<const LLPanelInventoryListItemBase*>(item2);
+ virtual bool compare(const LLPanel* item1, const LLPanel* item2) const
+ {
+ const LLPanelInventoryListItemBase* wearable_item1 = dynamic_cast<const LLPanelInventoryListItemBase*>(item1);
+ const LLPanelInventoryListItemBase* wearable_item2 = dynamic_cast<const LLPanelInventoryListItemBase*>(item2);
- if (!wearable_item1 || !wearable_item2)
- {
- LL_WARNS() << "item1 and item2 cannot be null" << LL_ENDL;
- return true;
- }
+ if (!wearable_item1 || !wearable_item2)
+ {
+ LL_WARNS() << "item1 and item2 cannot be null" << LL_ENDL;
+ return true;
+ }
- return doCompare(wearable_item1, wearable_item2);
- }
+ return doCompare(wearable_item1, wearable_item2);
+ }
protected:
- /**
- * Returns true if wearable_item1 < wearable_item2, false otherwise
- * Implement this method in your particular comparator.
- */
- virtual bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const = 0;
+ /**
+ * Returns true if wearable_item1 < wearable_item2, false otherwise
+ * Implement this method in your particular comparator.
+ */
+ virtual bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const = 0;
};
/**
@@ -296,14 +296,14 @@ protected:
*/
class LLWearableItemNameComparator : public LLWearableListItemComparator
{
- LOG_CLASS(LLWearableItemNameComparator);
+ LOG_CLASS(LLWearableItemNameComparator);
public:
- LLWearableItemNameComparator() {};
- virtual ~LLWearableItemNameComparator() {};
+ LLWearableItemNameComparator() {};
+ virtual ~LLWearableItemNameComparator() {};
protected:
- /*virtual*/ bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const;
+ /*virtual*/ bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const;
};
/**
@@ -313,80 +313,80 @@ protected:
*/
class LLWearableItemTypeNameComparator : public LLWearableItemNameComparator
{
- LOG_CLASS(LLWearableItemTypeNameComparator);
+ LOG_CLASS(LLWearableItemTypeNameComparator);
public:
- LLWearableItemTypeNameComparator();
- virtual ~LLWearableItemTypeNameComparator() {};
+ LLWearableItemTypeNameComparator();
+ virtual ~LLWearableItemTypeNameComparator() {};
- enum ETypeListOrder
- {
- ORDER_RANK_1 = 1,
- ORDER_RANK_2,
- ORDER_RANK_3,
- ORDER_RANK_4,
- ORDER_RANK_UNKNOWN
- };
+ enum ETypeListOrder
+ {
+ ORDER_RANK_1 = 1,
+ ORDER_RANK_2,
+ ORDER_RANK_3,
+ ORDER_RANK_4,
+ ORDER_RANK_UNKNOWN
+ };
- void setOrder(LLAssetType::EType items_of_type, ETypeListOrder order_priority, bool sort_items_by_name, bool sort_wearable_items_by_name);
+ void setOrder(LLAssetType::EType items_of_type, ETypeListOrder order_priority, bool sort_items_by_name, bool sort_wearable_items_by_name);
protected:
- /**
- * All information about sort order is stored in mWearableOrder map
- *
- * mWearableOrder : KEYS VALUES
- * [LLAssetType] [struct LLWearableTypeOrder]
- *
- *---------------------------------------------------------------------------------------------
- * I. Determines order (ORDER_RANK) in which items of LLAssetType should be displayed in list.
- * For example by spec in MY OUTFITS the order is:
- * 1. AT_CLOTHING (ORDER_RANK_1)
- * 2. AT_OBJECT (ORDER_RANK_2)
- * 3. AT_BODYPART (ORDER_RANK_3)
- *
- * II.Items of each type(LLAssetType) are sorted by name or type(LLWearableType)
- * For example by spec in MY OUTFITS the order within each items type(LLAssetType) is:
- * 1. AT_OBJECTS (abc order)
- * 2. AT_CLOTHINGS
- * - by type (types order determined in LLWearableType::EType)
- * - outer layer on top
- * 3. AT_BODYPARTS (abc order)
- *---------------------------------------------------------------------------------------------
- *
- * For each LLAssetType (KEYS in mWearableOrder) the information about:
- *
- * I. ORDER_RANK (the flag is LLWearableTypeOrder::mOrderPriority)
- *
- * II. whether items of this LLAssetType type should be ordered
- * by name or by LLWearableType::EType (the flag is LLWearableTypeOrder::mSortAssetTypeByName)
- *
- * III.whether items of LLWearableType type within this LLAssetType
- * should be ordered by name (the flag is LLWearableTypeOrder::mSortWearableTypeByName)
- *
- * holds in mWearableOrder map as VALUES (struct LLWearableTypeOrder).
- */
- /*virtual*/ bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const;
+ /**
+ * All information about sort order is stored in mWearableOrder map
+ *
+ * mWearableOrder : KEYS VALUES
+ * [LLAssetType] [struct LLWearableTypeOrder]
+ *
+ *---------------------------------------------------------------------------------------------
+ * I. Determines order (ORDER_RANK) in which items of LLAssetType should be displayed in list.
+ * For example by spec in MY OUTFITS the order is:
+ * 1. AT_CLOTHING (ORDER_RANK_1)
+ * 2. AT_OBJECT (ORDER_RANK_2)
+ * 3. AT_BODYPART (ORDER_RANK_3)
+ *
+ * II.Items of each type(LLAssetType) are sorted by name or type(LLWearableType)
+ * For example by spec in MY OUTFITS the order within each items type(LLAssetType) is:
+ * 1. AT_OBJECTS (abc order)
+ * 2. AT_CLOTHINGS
+ * - by type (types order determined in LLWearableType::EType)
+ * - outer layer on top
+ * 3. AT_BODYPARTS (abc order)
+ *---------------------------------------------------------------------------------------------
+ *
+ * For each LLAssetType (KEYS in mWearableOrder) the information about:
+ *
+ * I. ORDER_RANK (the flag is LLWearableTypeOrder::mOrderPriority)
+ *
+ * II. whether items of this LLAssetType type should be ordered
+ * by name or by LLWearableType::EType (the flag is LLWearableTypeOrder::mSortAssetTypeByName)
+ *
+ * III.whether items of LLWearableType type within this LLAssetType
+ * should be ordered by name (the flag is LLWearableTypeOrder::mSortWearableTypeByName)
+ *
+ * holds in mWearableOrder map as VALUES (struct LLWearableTypeOrder).
+ */
+ /*virtual*/ bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const;
private:
- struct LLWearableTypeOrder
- {
- ETypeListOrder mOrderPriority;
- bool mSortAssetTypeByName;
- bool mSortWearableTypeByName;
+ struct LLWearableTypeOrder
+ {
+ ETypeListOrder mOrderPriority;
+ bool mSortAssetTypeByName;
+ bool mSortWearableTypeByName;
- LLWearableTypeOrder(ETypeListOrder order_priority, bool sort_asset_by_name, bool sort_wearable_by_name);
- LLWearableTypeOrder() : mOrderPriority(ORDER_RANK_UNKNOWN), mSortAssetTypeByName(false), mSortWearableTypeByName(false) {};
- };
+ LLWearableTypeOrder(ETypeListOrder order_priority, bool sort_asset_by_name, bool sort_wearable_by_name);
+ LLWearableTypeOrder() : mOrderPriority(ORDER_RANK_UNKNOWN), mSortAssetTypeByName(false), mSortWearableTypeByName(false) {};
+ };
- ETypeListOrder getTypeListOrder(LLAssetType::EType item_type) const;
+ ETypeListOrder getTypeListOrder(LLAssetType::EType item_type) const;
- bool sortAssetTypeByName(LLAssetType::EType item_type) const;
- bool sortWearableTypeByName(LLAssetType::EType item_type) const;
+ bool sortAssetTypeByName(LLAssetType::EType item_type) const;
+ bool sortWearableTypeByName(LLAssetType::EType item_type) const;
- typedef std::map<LLAssetType::EType,LLWearableTypeOrder> wearable_type_order_map_t;
- wearable_type_order_map_t mWearableOrder;
+ typedef std::map<LLAssetType::EType,LLWearableTypeOrder> wearable_type_order_map_t;
+ wearable_type_order_map_t mWearableOrder;
};
/**
@@ -396,14 +396,14 @@ private:
*/
class LLWearableItemCreationDateComparator : public LLWearableItemNameComparator
{
- LOG_CLASS(LLWearableItemCreationDateComparator);
+ LOG_CLASS(LLWearableItemCreationDateComparator);
public:
- // clang demands a default ctor here
- LLWearableItemCreationDateComparator() {}
+ // clang demands a default ctor here
+ LLWearableItemCreationDateComparator() {}
protected:
- /*virtual*/ bool doCompare(const LLPanelInventoryListItemBase* item1, const LLPanelInventoryListItemBase* item2) const;
+ /*virtual*/ bool doCompare(const LLPanelInventoryListItemBase* item1, const LLPanelInventoryListItemBase* item2) const;
};
/**
@@ -417,92 +417,92 @@ protected:
class LLWearableItemsList : public LLInventoryItemsList
{
public:
- /**
- * Context menu.
- *
- * This menu is likely to be used from outside
- * (e.g. for items selected across multiple wearable lists),
- * so making it a singleton.
- */
- class ContextMenu : public LLListContextMenu, public LLSingleton<ContextMenu>
- {
- LLSINGLETON(ContextMenu);
- public:
- /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y) override;
-
- void show(LLView* spawning_view, LLWearableType::EType w_type, S32 x, S32 y);
-
- protected:
- enum {
- MASK_CLOTHING = 0x01,
- MASK_BODYPART = 0x02,
- MASK_ATTACHMENT = 0x04,
- MASK_GESTURE = 0x08,
- MASK_UNKNOWN = 0x10,
- };
-
- /* virtual */ LLContextMenu* createMenu() override;
- void updateItemsVisibility(LLContextMenu* menu);
- void updateItemsLabels(LLContextMenu* menu);
- static void setMenuItemVisible(LLContextMenu* menu, const std::string& name, bool val);
- static void setMenuItemEnabled(LLContextMenu* menu, const std::string& name, bool val);
- static void updateMask(U32& mask, LLAssetType::EType at);
- static void createNewWearable(const LLUUID& item_id);
- static void createNewWearableByType(LLWearableType::EType type);
-
- LLWearableItemsList* mParent;
- };
-
- struct Params : public LLInitParam::Block<Params, LLInventoryItemsList::Params>
- {
- Optional<bool> standalone;
- Optional<bool> worn_indication_enabled;
+ /**
+ * Context menu.
+ *
+ * This menu is likely to be used from outside
+ * (e.g. for items selected across multiple wearable lists),
+ * so making it a singleton.
+ */
+ class ContextMenu : public LLListContextMenu, public LLSingleton<ContextMenu>
+ {
+ LLSINGLETON(ContextMenu);
+ public:
+ /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y) override;
+
+ void show(LLView* spawning_view, LLWearableType::EType w_type, S32 x, S32 y);
+
+ protected:
+ enum {
+ MASK_CLOTHING = 0x01,
+ MASK_BODYPART = 0x02,
+ MASK_ATTACHMENT = 0x04,
+ MASK_GESTURE = 0x08,
+ MASK_UNKNOWN = 0x10,
+ };
+
+ /* virtual */ LLContextMenu* createMenu() override;
+ void updateItemsVisibility(LLContextMenu* menu);
+ void updateItemsLabels(LLContextMenu* menu);
+ static void setMenuItemVisible(LLContextMenu* menu, const std::string& name, bool val);
+ static void setMenuItemEnabled(LLContextMenu* menu, const std::string& name, bool val);
+ static void updateMask(U32& mask, LLAssetType::EType at);
+ static void createNewWearable(const LLUUID& item_id);
+ static void createNewWearableByType(LLWearableType::EType type);
+
+ LLWearableItemsList* mParent;
+ };
+
+ struct Params : public LLInitParam::Block<Params, LLInventoryItemsList::Params>
+ {
+ Optional<bool> standalone;
+ Optional<bool> worn_indication_enabled;
Optional<bool> show_item_widgets;
- Params();
- };
+ Params();
+ };
- typedef enum e_sort_order {
- // Values should be compatible with InventorySortOrder setting.
- E_SORT_BY_NAME = 0,
- E_SORT_BY_MOST_RECENT = 1,
- E_SORT_BY_TYPE_LAYER = 2,
- E_SORT_BY_TYPE_NAME = 3,
- } ESortOrder;
+ typedef enum e_sort_order {
+ // Values should be compatible with InventorySortOrder setting.
+ E_SORT_BY_NAME = 0,
+ E_SORT_BY_MOST_RECENT = 1,
+ E_SORT_BY_TYPE_LAYER = 2,
+ E_SORT_BY_TYPE_NAME = 3,
+ } ESortOrder;
- virtual ~LLWearableItemsList();
+ virtual ~LLWearableItemsList();
- /*virtual*/ LLPanel* createNewItem(LLViewerInventoryItem* item) override;
+ /*virtual*/ LLPanel* createNewItem(LLViewerInventoryItem* item) override;
- void updateList(const LLUUID& category_id);
+ void updateList(const LLUUID& category_id);
- /**
- * Update items that match UUIDs from changed_items_uuids
- * or links that point at such items.
- */
- void updateChangedItems(const uuid_vec_t& changed_items_uuids);
+ /**
+ * Update items that match UUIDs from changed_items_uuids
+ * or links that point at such items.
+ */
+ void updateChangedItems(const uuid_vec_t& changed_items_uuids);
- bool isStandalone() const { return mIsStandalone; }
+ bool isStandalone() const { return mIsStandalone; }
- ESortOrder getSortOrder() const { return mSortOrder; }
+ ESortOrder getSortOrder() const { return mSortOrder; }
- void setSortOrder(ESortOrder sort_order, bool sort_now = true);
+ void setSortOrder(ESortOrder sort_order, bool sort_now = true);
- void setMenuWearableType(LLWearableType::EType type) { mMenuWearableType = type; }
+ void setMenuWearableType(LLWearableType::EType type) { mMenuWearableType = type; }
protected:
- friend class LLUICtrlFactory;
- LLWearableItemsList(const LLWearableItemsList::Params& p);
+ friend class LLUICtrlFactory;
+ LLWearableItemsList(const LLWearableItemsList::Params& p);
- void onRightClick(S32 x, S32 y);
+ void onRightClick(S32 x, S32 y);
- bool mIsStandalone;
- bool mWornIndicationEnabled;
+ bool mIsStandalone;
+ bool mWornIndicationEnabled;
bool mShowItemWidgets;
- ESortOrder mSortOrder;
+ ESortOrder mSortOrder;
- LLWearableType::EType mMenuWearableType;
+ LLWearableType::EType mMenuWearableType;
};
#endif //LL_LLWEARABLEITEMSLIST_H
diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp
index de01fbb73d..5cbc158f8d 100644
--- a/indra/newview/llwearablelist.cpp
+++ b/indra/newview/llwearablelist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwearablelist.cpp
* @brief LLWearableList class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,25 +40,25 @@
// Callback struct
struct LLWearableArrivedData
{
- LLWearableArrivedData(LLAssetType::EType asset_type,
- const std::string& wearable_name,
- LLAvatarAppearance* avatarp,
- void(*asset_arrived_callback)(LLViewerWearable*, void* userdata),
- void* userdata) :
- mAssetType( asset_type ),
- mCallback( asset_arrived_callback ),
- mUserdata( userdata ),
- mName( wearable_name ),
- mRetries(0),
- mAvatarp(avatarp)
- {}
-
- LLAssetType::EType mAssetType;
- void (*mCallback)(LLViewerWearable*, void* userdata);
- void* mUserdata;
- std::string mName;
- S32 mRetries;
- LLAvatarAppearance *mAvatarp;
+ LLWearableArrivedData(LLAssetType::EType asset_type,
+ const std::string& wearable_name,
+ LLAvatarAppearance* avatarp,
+ void(*asset_arrived_callback)(LLViewerWearable*, void* userdata),
+ void* userdata) :
+ mAssetType( asset_type ),
+ mCallback( asset_arrived_callback ),
+ mUserdata( userdata ),
+ mName( wearable_name ),
+ mRetries(0),
+ mAvatarp(avatarp)
+ {}
+
+ LLAssetType::EType mAssetType;
+ void (*mCallback)(LLViewerWearable*, void* userdata);
+ void* mUserdata;
+ std::string mName;
+ S32 mRetries;
+ LLAvatarAppearance *mAvatarp;
};
////////////////////////////////////////////////////////////////////////////
@@ -66,213 +66,213 @@ struct LLWearableArrivedData
LLWearableList::~LLWearableList()
{
- cleanup();
+ cleanup();
}
-void LLWearableList::cleanup()
+void LLWearableList::cleanup()
{
- for_each(mList.begin(), mList.end(), DeletePairedPointer());
- mList.clear();
+ for_each(mList.begin(), mList.end(), DeletePairedPointer());
+ mList.clear();
}
void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAvatarAppearance* avatarp, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata)
{
- llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) );
- LLViewerWearable* instance = get_if_there(mList, assetID, (LLViewerWearable*)NULL );
- if( instance )
- {
- LL_DEBUGS("Avatar") << "wearable " << assetID << " found in LLWearableList" << LL_ENDL;
- asset_arrived_callback( instance, userdata );
- }
- else
- {
- gAssetStorage->getAssetData(assetID,
- asset_type,
- LLWearableList::processGetAssetReply,
- (void*)new LLWearableArrivedData( asset_type, wearable_name, avatarp, asset_arrived_callback, userdata ),
- TRUE);
- }
+ llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) );
+ LLViewerWearable* instance = get_if_there(mList, assetID, (LLViewerWearable*)NULL );
+ if( instance )
+ {
+ LL_DEBUGS("Avatar") << "wearable " << assetID << " found in LLWearableList" << LL_ENDL;
+ asset_arrived_callback( instance, userdata );
+ }
+ else
+ {
+ gAssetStorage->getAssetData(assetID,
+ asset_type,
+ LLWearableList::processGetAssetReply,
+ (void*)new LLWearableArrivedData( asset_type, wearable_name, avatarp, asset_arrived_callback, userdata ),
+ TRUE);
+ }
}
// static
void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID& uuid, void* userdata, S32 status, LLExtStat ext_status )
{
- BOOL isNewWearable = FALSE;
- LLWearableArrivedData* data = (LLWearableArrivedData*) userdata;
- LLViewerWearable* wearable = NULL; // NULL indicates failure
- LLAvatarAppearance *avatarp = data->mAvatarp;
-
- if( !filename )
- {
- LL_WARNS("Wearable") << "Bad Wearable Asset: missing file." << LL_ENDL;
- }
- else if(!avatarp)
- {
- LL_WARNS("Wearable") << "Bad asset request: missing avatar pointer." << LL_ENDL;
- }
- else if (status >= 0)
- {
- // read the file
- llifstream ifs(filename, llifstream::binary);
- if( !ifs.is_open() )
- {
- LL_WARNS("Wearable") << "Bad Wearable Asset: unable to open file: '" << filename << "'" << LL_ENDL;
- }
- else
- {
- wearable = new LLViewerWearable(uuid);
- LLWearable::EImportResult result = wearable->importStream(
- ifs, avatarp );
- if (LLWearable::SUCCESS != result)
- {
- if (wearable->getType() == LLWearableType::WT_COUNT)
- {
- isNewWearable = TRUE;
- }
- delete wearable;
- wearable = NULL;
- }
-
- if(filename)
- {
- if (ifs.is_open())
- {
- ifs.close();
- }
- LLFile::remove(std::string(filename));
- }
- }
- }
- else
- {
- if(filename)
- {
- LLFile::remove(std::string(filename));
- }
-
- LL_WARNS("Wearable") << "Wearable download failed: " << LLAssetStorage::getErrorString( status ) << " " << uuid << LL_ENDL;
- switch( status )
- {
- case LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE:
- {
- // Fail
- break;
- }
- default:
- {
- static const S32 MAX_RETRIES = 3;
- if (data->mRetries < MAX_RETRIES)
- {
- // Try again
- data->mRetries++;
- gAssetStorage->getAssetData(uuid,
- data->mAssetType,
- LLWearableList::processGetAssetReply,
- userdata); // re-use instead of deleting.
- return;
- }
- else
- {
- // Fail
- break;
- }
- }
- }
- }
-
- if (wearable) // success
- {
- LLWearableList::instance().mList[ uuid ] = wearable;
- LL_DEBUGS("Wearable") << "processGetAssetReply()" << LL_ENDL;
- LL_DEBUGS("Wearable") << wearable << LL_ENDL;
- }
- else
- {
- LLSD args;
- args["TYPE"] =LLTrans::getString(LLAssetType::lookupHumanReadable(data->mAssetType));
- if (isNewWearable)
- {
- LLNotificationsUtil::add("InvalidWearable");
- }
- else if (data->mName.empty())
- {
- LLNotificationsUtil::add("FailedToFindWearableUnnamed", args);
- }
- else
- {
- args["DESC"] = data->mName;
- LLNotificationsUtil::add("FailedToFindWearable", args);
- }
- }
- // Always call callback; wearable will be NULL if we failed
- {
- if( data->mCallback )
- {
- data->mCallback( wearable, data->mUserdata );
- }
- }
- delete data;
+ BOOL isNewWearable = FALSE;
+ LLWearableArrivedData* data = (LLWearableArrivedData*) userdata;
+ LLViewerWearable* wearable = NULL; // NULL indicates failure
+ LLAvatarAppearance *avatarp = data->mAvatarp;
+
+ if( !filename )
+ {
+ LL_WARNS("Wearable") << "Bad Wearable Asset: missing file." << LL_ENDL;
+ }
+ else if(!avatarp)
+ {
+ LL_WARNS("Wearable") << "Bad asset request: missing avatar pointer." << LL_ENDL;
+ }
+ else if (status >= 0)
+ {
+ // read the file
+ llifstream ifs(filename, llifstream::binary);
+ if( !ifs.is_open() )
+ {
+ LL_WARNS("Wearable") << "Bad Wearable Asset: unable to open file: '" << filename << "'" << LL_ENDL;
+ }
+ else
+ {
+ wearable = new LLViewerWearable(uuid);
+ LLWearable::EImportResult result = wearable->importStream(
+ ifs, avatarp );
+ if (LLWearable::SUCCESS != result)
+ {
+ if (wearable->getType() == LLWearableType::WT_COUNT)
+ {
+ isNewWearable = TRUE;
+ }
+ delete wearable;
+ wearable = NULL;
+ }
+
+ if(filename)
+ {
+ if (ifs.is_open())
+ {
+ ifs.close();
+ }
+ LLFile::remove(std::string(filename));
+ }
+ }
+ }
+ else
+ {
+ if(filename)
+ {
+ LLFile::remove(std::string(filename));
+ }
+
+ LL_WARNS("Wearable") << "Wearable download failed: " << LLAssetStorage::getErrorString( status ) << " " << uuid << LL_ENDL;
+ switch( status )
+ {
+ case LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE:
+ {
+ // Fail
+ break;
+ }
+ default:
+ {
+ static const S32 MAX_RETRIES = 3;
+ if (data->mRetries < MAX_RETRIES)
+ {
+ // Try again
+ data->mRetries++;
+ gAssetStorage->getAssetData(uuid,
+ data->mAssetType,
+ LLWearableList::processGetAssetReply,
+ userdata); // re-use instead of deleting.
+ return;
+ }
+ else
+ {
+ // Fail
+ break;
+ }
+ }
+ }
+ }
+
+ if (wearable) // success
+ {
+ LLWearableList::instance().mList[ uuid ] = wearable;
+ LL_DEBUGS("Wearable") << "processGetAssetReply()" << LL_ENDL;
+ LL_DEBUGS("Wearable") << wearable << LL_ENDL;
+ }
+ else
+ {
+ LLSD args;
+ args["TYPE"] =LLTrans::getString(LLAssetType::lookupHumanReadable(data->mAssetType));
+ if (isNewWearable)
+ {
+ LLNotificationsUtil::add("InvalidWearable");
+ }
+ else if (data->mName.empty())
+ {
+ LLNotificationsUtil::add("FailedToFindWearableUnnamed", args);
+ }
+ else
+ {
+ args["DESC"] = data->mName;
+ LLNotificationsUtil::add("FailedToFindWearable", args);
+ }
+ }
+ // Always call callback; wearable will be NULL if we failed
+ {
+ if( data->mCallback )
+ {
+ data->mCallback( wearable, data->mUserdata );
+ }
+ }
+ delete data;
}
LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearable, const std::string& new_name)
{
- LL_DEBUGS() << "LLWearableList::createCopy()" << LL_ENDL;
+ LL_DEBUGS() << "LLWearableList::createCopy()" << LL_ENDL;
- LLViewerWearable *wearable = generateNewWearable();
- wearable->copyDataFrom(old_wearable);
+ LLViewerWearable *wearable = generateNewWearable();
+ wearable->copyDataFrom(old_wearable);
- LLPermissions perm(old_wearable->getPermissions());
- perm.setOwnerAndGroup(LLUUID::null, gAgent.getID(), LLUUID::null, true);
- wearable->setPermissions(perm);
+ LLPermissions perm(old_wearable->getPermissions());
+ perm.setOwnerAndGroup(LLUUID::null, gAgent.getID(), LLUUID::null, true);
+ wearable->setPermissions(perm);
- if (!new_name.empty()) wearable->setName(new_name);
+ if (!new_name.empty()) wearable->setName(new_name);
- // Send to the dataserver
- wearable->saveNewAsset();
+ // Send to the dataserver
+ wearable->saveNewAsset();
- return wearable;
+ return wearable;
}
LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type, LLAvatarAppearance *avatarp )
{
- LL_DEBUGS() << "LLWearableList::createNewWearable()" << LL_ENDL;
+ LL_DEBUGS() << "LLWearableList::createNewWearable()" << LL_ENDL;
+
+ LLViewerWearable *wearable = generateNewWearable();
+ wearable->setType( type, avatarp );
- LLViewerWearable *wearable = generateNewWearable();
- wearable->setType( type, avatarp );
-
// LLWearableType has pre-translated getTypeLabel(), but it returns 'name', not 'New Name'.
- std::string name = LLTrans::getString( LLWearableType::getInstance()->getTypeDefaultNewName(wearable->getType()) );
- wearable->setName( name );
+ std::string name = LLTrans::getString( LLWearableType::getInstance()->getTypeDefaultNewName(wearable->getType()) );
+ wearable->setName( name );
- LLPermissions perm;
- perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
- perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER);
- wearable->setPermissions(perm);
+ LLPermissions perm;
+ perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
+ perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER);
+ wearable->setPermissions(perm);
- wearable->setDefinitionVersion(LLWearable::getCurrentDefinitionVersion());
+ wearable->setDefinitionVersion(LLWearable::getCurrentDefinitionVersion());
- // Description and sale info have default values.
- wearable->setParamsToDefaults();
- wearable->setTexturesToDefaults();
+ // Description and sale info have default values.
+ wearable->setParamsToDefaults();
+ wearable->setTexturesToDefaults();
- //mark all values (params & images) as saved
- wearable->saveValues();
+ //mark all values (params & images) as saved
+ wearable->saveValues();
- // Send to the dataserver
- wearable->saveNewAsset();
+ // Send to the dataserver
+ wearable->saveNewAsset();
- return wearable;
+ return wearable;
}
LLViewerWearable *LLWearableList::generateNewWearable()
{
- LLTransactionID tid;
- tid.generate();
- LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
+ LLTransactionID tid;
+ tid.generate();
+ LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
- LLViewerWearable* wearable = new LLViewerWearable(tid);
- mList[new_asset_id] = wearable;
- return wearable;
+ LLViewerWearable* wearable = new LLViewerWearable(tid);
+ mList[new_asset_id] = wearable;
+ return wearable;
}
diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h
index 782f7751e5..be00c058a2 100644
--- a/indra/newview/llwearablelist.h
+++ b/indra/newview/llwearablelist.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwearablelist.h
* @brief LLWearableList class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,38 +33,38 @@
#include "llassetstorage.h"
// Globally constructed; be careful that there's no dependency with gAgent.
-/*
+/*
BUG: mList's system of mapping between assetIDs and wearables is flawed
- since LLWearable* has an associated itemID, and you can have multiple
+ since LLWearable* has an associated itemID, and you can have multiple
inventory items pointing to the same asset (i.e. more than one ItemID
per assetID). EXT-6252
*/
class LLWearableList : public LLSingleton<LLWearableList>
{
- LLSINGLETON_EMPTY_CTOR(LLWearableList);
- ~LLWearableList();
+ LLSINGLETON_EMPTY_CTOR(LLWearableList);
+ ~LLWearableList();
public:
- void cleanup() ;
+ void cleanup() ;
+
+ S32 getLength() const { return mList.size(); }
- S32 getLength() const { return mList.size(); }
+ void getAsset(const LLAssetID& assetID,
+ const std::string& wearable_name,
+ LLAvatarAppearance *avatarp,
+ LLAssetType::EType asset_type,
+ void(*asset_arrived_callback)(LLViewerWearable*, void* userdata),
+ void* userdata);
- void getAsset(const LLAssetID& assetID,
- const std::string& wearable_name,
- LLAvatarAppearance *avatarp,
- LLAssetType::EType asset_type,
- void(*asset_arrived_callback)(LLViewerWearable*, void* userdata),
- void* userdata);
+ LLViewerWearable* createCopy(const LLViewerWearable* old_wearable, const std::string& new_name = std::string());
+ LLViewerWearable* createNewWearable(LLWearableType::EType type, LLAvatarAppearance *avatarp);
- LLViewerWearable* createCopy(const LLViewerWearable* old_wearable, const std::string& new_name = std::string());
- LLViewerWearable* createNewWearable(LLWearableType::EType type, LLAvatarAppearance *avatarp);
-
- // Callback
- static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status);
+ // Callback
+ static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status);
protected:
- LLViewerWearable* generateNewWearable(); // used for the create... functions
+ LLViewerWearable* generateNewWearable(); // used for the create... functions
private:
- std::map<LLUUID, LLViewerWearable*> mList;
+ std::map<LLUUID, LLViewerWearable*> mList;
};
#endif // LL_LLWEARABLELIST_H
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index 9afe332025..6c5313a3ac 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llweb.cpp
* @brief Functions dealing with web browsers
* @author James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@
#include "llweb.h"
// Library includes
-#include "llwindow.h" // spawnWebBrowser()
+#include "llwindow.h" // spawnWebBrowser()
#include "llagent.h"
#include "llappviewer.h"
@@ -58,149 +58,149 @@ bool on_load_url_external_response(const LLSD& notification, const LLSD& respons
// static
void LLWeb::loadURL(const std::string& url, const std::string& target, const std::string& uuid)
{
- if(target == "_internal")
- {
- // Force load in the internal browser, as if with a blank target.
- loadURLInternal(url, "", uuid);
- }
-
- else if (useExternalBrowser(url) || (target == "_external"))
- {
- loadURLExternal(url);
- }
- else
- {
- loadURLInternal(url, target, uuid);
- }
+ if(target == "_internal")
+ {
+ // Force load in the internal browser, as if with a blank target.
+ loadURLInternal(url, "", uuid);
+ }
+
+ else if (useExternalBrowser(url) || (target == "_external"))
+ {
+ loadURLExternal(url);
+ }
+ else
+ {
+ loadURLInternal(url, target, uuid);
+ }
}
// static
// Explicitly open a Web URL using the Web content floater
void LLWeb::loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid, bool dev_mode)
{
- LLFloaterWebContent::Params p;
- p.url(url).target(target).id(uuid).dev_mode(dev_mode);
- LLFloaterReg::showInstance("web_content", p);
+ LLFloaterWebContent::Params p;
+ p.url(url).target(target).id(uuid).dev_mode(dev_mode);
+ LLFloaterReg::showInstance("web_content", p);
}
// static
void LLWeb::loadURLExternal(const std::string& url, const std::string& uuid)
{
- loadURLExternal(url, true, uuid);
+ loadURLExternal(url, true, uuid);
}
// static
void LLWeb::loadURLExternal(const std::string& url, bool async, const std::string& uuid)
{
- // Act like the proxy window was closed, since we won't be able to track targeted windows in the external browser.
- LLViewerMedia::getInstance()->proxyWindowClosed(uuid);
-
- if(gSavedSettings.getBOOL("DisableExternalBrowser"))
- {
- // Don't open an external browser under any circumstances.
- LL_WARNS() << "Blocked attempt to open external browser." << LL_ENDL;
- return;
- }
-
- LLSD payload;
- payload["url"] = url;
- LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, boost::bind(on_load_url_external_response, _1, _2, async));
+ // Act like the proxy window was closed, since we won't be able to track targeted windows in the external browser.
+ LLViewerMedia::getInstance()->proxyWindowClosed(uuid);
+
+ if(gSavedSettings.getBOOL("DisableExternalBrowser"))
+ {
+ // Don't open an external browser under any circumstances.
+ LL_WARNS() << "Blocked attempt to open external browser." << LL_ENDL;
+ return;
+ }
+
+ LLSD payload;
+ payload["url"] = url;
+ LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, boost::bind(on_load_url_external_response, _1, _2, async));
}
-// static
+// static
bool on_load_url_external_response(const LLSD& notification, const LLSD& response, bool async )
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if ( 0 == option )
- {
- LLSD payload = notification["payload"];
- std::string url = payload["url"].asString();
- std::string escaped_url = LLWeb::escapeURL(url);
- if (gViewerWindow)
- {
- gViewerWindow->getWindow()->spawnWebBrowser(escaped_url, async);
- }
- }
- return false;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if ( 0 == option )
+ {
+ LLSD payload = notification["payload"];
+ std::string url = payload["url"].asString();
+ std::string escaped_url = LLWeb::escapeURL(url);
+ if (gViewerWindow)
+ {
+ gViewerWindow->getWindow()->spawnWebBrowser(escaped_url, async);
+ }
+ }
+ return false;
}
// static
std::string LLWeb::escapeURL(const std::string& url)
{
- // The CURL curl_escape() function escapes colons, slashes,
- // and all characters but A-Z and 0-9. Do a cheesy mini-escape.
- std::string escaped_url;
- S32 len = url.length();
- for (S32 i = 0; i < len; i++)
- {
- char c = url[i];
- if (c == ' ')
- {
- escaped_url += "%20";
- }
- else if (c == '\\')
- {
- escaped_url += "%5C";
- }
- else
- {
- escaped_url += c;
- }
- }
- return escaped_url;
+ // The CURL curl_escape() function escapes colons, slashes,
+ // and all characters but A-Z and 0-9. Do a cheesy mini-escape.
+ std::string escaped_url;
+ S32 len = url.length();
+ for (S32 i = 0; i < len; i++)
+ {
+ char c = url[i];
+ if (c == ' ')
+ {
+ escaped_url += "%20";
+ }
+ else if (c == '\\')
+ {
+ escaped_url += "%5C";
+ }
+ else
+ {
+ escaped_url += c;
+ }
+ }
+ return escaped_url;
}
//static
std::string LLWeb::expandURLSubstitutions(const std::string &url,
- const LLSD &default_subs)
+ const LLSD &default_subs)
{
- LLSD substitution = default_subs;
- substitution["VERSION"] = LLVersionInfo::instance().getVersion();
- substitution["VERSION_MAJOR"] = LLVersionInfo::instance().getMajor();
- substitution["VERSION_MINOR"] = LLVersionInfo::instance().getMinor();
- substitution["VERSION_PATCH"] = LLVersionInfo::instance().getPatch();
- substitution["VERSION_BUILD"] = std::to_string(LLVersionInfo::instance().getBuild());
- substitution["CHANNEL"] = LLVersionInfo::instance().getChannel();
- substitution["GRID"] = LLGridManager::getInstance()->getGridId();
- substitution["GRID_LOWERCASE"] = utf8str_tolower(LLGridManager::getInstance()->getGridId());
- substitution["OS"] = LLOSInfo::instance().getOSStringSimple();
- substitution["SESSION_ID"] = gAgent.getSessionID();
- substitution["FIRST_LOGIN"] = gAgent.isFirstLogin();
-
- // work out the current language
- std::string lang = LLUI::getLanguage();
- if (lang == "en-us")
- {
- // *HACK: the correct fix is to change English.lproj/language.txt,
- // but we're late in the release cycle and this is a less risky fix
- lang = "en";
- }
- substitution["LANGUAGE"] = lang;
-
- // find the region ID
- LLUUID region_id;
- LLViewerRegion *region = gAgent.getRegion();
- if (region)
- {
- region_id = region->getRegionID();
- }
- substitution["REGION_ID"] = region_id;
-
- // find the parcel local ID
- S32 parcel_id = 0;
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (parcel)
- {
- parcel_id = parcel->getLocalID();
- }
- substitution["PARCEL_ID"] = llformat("%d", parcel_id);
-
- // find the grid
- std::string current_grid = LLGridManager::getInstance()->getGridId();
- std::transform(current_grid.begin(), current_grid.end(), current_grid.begin(), ::tolower);
+ LLSD substitution = default_subs;
+ substitution["VERSION"] = LLVersionInfo::instance().getVersion();
+ substitution["VERSION_MAJOR"] = LLVersionInfo::instance().getMajor();
+ substitution["VERSION_MINOR"] = LLVersionInfo::instance().getMinor();
+ substitution["VERSION_PATCH"] = LLVersionInfo::instance().getPatch();
+ substitution["VERSION_BUILD"] = std::to_string(LLVersionInfo::instance().getBuild());
+ substitution["CHANNEL"] = LLVersionInfo::instance().getChannel();
+ substitution["GRID"] = LLGridManager::getInstance()->getGridId();
+ substitution["GRID_LOWERCASE"] = utf8str_tolower(LLGridManager::getInstance()->getGridId());
+ substitution["OS"] = LLOSInfo::instance().getOSStringSimple();
+ substitution["SESSION_ID"] = gAgent.getSessionID();
+ substitution["FIRST_LOGIN"] = gAgent.isFirstLogin();
+
+ // work out the current language
+ std::string lang = LLUI::getLanguage();
+ if (lang == "en-us")
+ {
+ // *HACK: the correct fix is to change English.lproj/language.txt,
+ // but we're late in the release cycle and this is a less risky fix
+ lang = "en";
+ }
+ substitution["LANGUAGE"] = lang;
+
+ // find the region ID
+ LLUUID region_id;
+ LLViewerRegion *region = gAgent.getRegion();
+ if (region)
+ {
+ region_id = region->getRegionID();
+ }
+ substitution["REGION_ID"] = region_id;
+
+ // find the parcel local ID
+ S32 parcel_id = 0;
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (parcel)
+ {
+ parcel_id = parcel->getLocalID();
+ }
+ substitution["PARCEL_ID"] = llformat("%d", parcel_id);
+
+ // find the grid
+ std::string current_grid = LLGridManager::getInstance()->getGridId();
+ std::transform(current_grid.begin(), current_grid.end(), current_grid.begin(), ::tolower);
if (current_grid == "damballah")
- {
+ {
// Staging grid has its own naming scheme.
substitution["GRID"] = "secondlife-staging.com";
}
@@ -209,39 +209,39 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
substitution["GRID"] = "secondlife.com";
}
- // expand all of the substitution strings and escape the url
- std::string expanded_url = url;
- LLStringUtil::format(expanded_url, substitution);
+ // expand all of the substitution strings and escape the url
+ std::string expanded_url = url;
+ LLStringUtil::format(expanded_url, substitution);
- return LLWeb::escapeURL(expanded_url);
+ return LLWeb::escapeURL(expanded_url);
}
//static
bool LLWeb::useExternalBrowser(const std::string &url)
{
#ifdef EXTERNAL_TOS
- return true;
+ return true;
#else
- if (gSavedSettings.getU32("PreferredBrowserBehavior") == BROWSER_EXTERNAL_ONLY)
- {
- return true;
- }
- else if (gSavedSettings.getU32("PreferredBrowserBehavior") == BROWSER_INT_LL_EXT_OTHERS)
- {
- LLUriParser up(url);
- up.normalize();
- up.extractParts();
- std::string uri_string = up.host();
-
- boost::regex pattern = boost::regex("\\b(lindenlab.com|secondlife.com|secondlife.io)$", boost::regex::perl|boost::regex::icase);
- boost::match_results<std::string::const_iterator> matches;
- return !(ll_regex_search(uri_string, matches, pattern));
- }
- else
- {
- boost::regex pattern = boost::regex("^mailto:", boost::regex::perl | boost::regex::icase);
- boost::match_results<std::string::const_iterator> matches;
- return ll_regex_search(url, matches, pattern);
- }
+ if (gSavedSettings.getU32("PreferredBrowserBehavior") == BROWSER_EXTERNAL_ONLY)
+ {
+ return true;
+ }
+ else if (gSavedSettings.getU32("PreferredBrowserBehavior") == BROWSER_INT_LL_EXT_OTHERS)
+ {
+ LLUriParser up(url);
+ up.normalize();
+ up.extractParts();
+ std::string uri_string = up.host();
+
+ boost::regex pattern = boost::regex("\\b(lindenlab.com|secondlife.com|secondlife.io)$", boost::regex::perl|boost::regex::icase);
+ boost::match_results<std::string::const_iterator> matches;
+ return !(ll_regex_search(uri_string, matches, pattern));
+ }
+ else
+ {
+ boost::regex pattern = boost::regex("^mailto:", boost::regex::perl | boost::regex::icase);
+ boost::match_results<std::string::const_iterator> matches;
+ return ll_regex_search(url, matches, pattern);
+ }
#endif
}
diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h
index 0426f00f27..fcaaf9d833 100644
--- a/indra/newview/llweb.h
+++ b/indra/newview/llweb.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llweb.h
* @brief Functions dealing with web browsers
* @author James Cook
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,7 +32,7 @@
///
/// The LLWeb class provides various static methods to display the
-/// contents of a Url in a web browser. Variations are provided to
+/// contents of a Url in a web browser. Variations are provided to
/// let you specifically use the Second Life internal browser, the
/// operating system's default browser, or to respect the user's
/// setting for which of these two they prefer to use with SL.
@@ -40,29 +40,29 @@
class LLWeb
{
public:
- enum PreferredBrowser
- {
- BROWSER_EXTERNAL_ONLY = 0,
- BROWSER_INT_LL_EXT_OTHERS = 1,
- BROWSER_INTERNAL_ONLY = 2
- };
-
- /// Load the given url in the operating system's web browser, async if we want to return immediately
- /// before browser has spawned
- static void loadURLExternal(const std::string& url) {loadURLExternal(url, LLStringUtil::null);}
- static void loadURLExternal(const std::string& url, const std::string& uuid);
- static void loadURLExternal(const std::string& url, bool async, const std::string& uuid = LLStringUtil::null);
+ enum PreferredBrowser
+ {
+ BROWSER_EXTERNAL_ONLY = 0,
+ BROWSER_INT_LL_EXT_OTHERS = 1,
+ BROWSER_INTERNAL_ONLY = 2
+ };
+
+ /// Load the given url in the operating system's web browser, async if we want to return immediately
+ /// before browser has spawned
+ static void loadURLExternal(const std::string& url) {loadURLExternal(url, LLStringUtil::null);}
+ static void loadURLExternal(const std::string& url, const std::string& uuid);
+ static void loadURLExternal(const std::string& url, bool async, const std::string& uuid = LLStringUtil::null);
- static void loadURL(const std::string& url, const std::string& target = LLStringUtil::null, const std::string& uuid = LLStringUtil::null);
- // load content using built-in browser
- static void loadURLInternal(const std::string &url, const std::string& target = LLStringUtil::null, const std::string& uuid = LLStringUtil::null, bool dev_mode = false);
+ static void loadURL(const std::string& url, const std::string& target = LLStringUtil::null, const std::string& uuid = LLStringUtil::null);
+ // load content using built-in browser
+ static void loadURLInternal(const std::string &url, const std::string& target = LLStringUtil::null, const std::string& uuid = LLStringUtil::null, bool dev_mode = false);
- /// Returns escaped url (eg, " " to "%20") - used by all loadURL methods
- static std::string escapeURL(const std::string& url);
- /// Expands various strings like [LANG], [VERSION], etc. in a URL
- static std::string expandURLSubstitutions(const std::string &url,
- const LLSD &default_subs);
- static bool useExternalBrowser(const std::string &url);
+ /// Returns escaped url (eg, " " to "%20") - used by all loadURL methods
+ static std::string escapeURL(const std::string& url);
+ /// Expands various strings like [LANG], [VERSION], etc. in a URL
+ static std::string expandURLSubstitutions(const std::string &url,
+ const LLSD &default_subs);
+ static bool useExternalBrowser(const std::string &url);
};
#endif
diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp
index f2d7e4585a..02abf1d4e3 100644
--- a/indra/newview/llwebprofile.cpp
+++ b/indra/newview/llwebprofile.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwebprofile.cpp
* @brief Web profile access.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -74,8 +74,8 @@ void LLWebProfile::uploadImage(LLPointer<LLImageFormatted> image, const std::str
// static
void LLWebProfile::setAuthCookie(const std::string& cookie)
{
- LL_DEBUGS("Snapshots") << "Setting auth cookie: " << cookie << LL_ENDL;
- sAuthCookie = cookie;
+ LL_DEBUGS("Snapshots") << "Setting auth cookie: " << cookie << LL_ENDL;
+ sAuthCookie = cookie;
}
@@ -148,7 +148,7 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin
httpHeaders->append(HTTP_OUT_HEADER_COOKIE, getAuthCookie());
httpHeaders->remove(HTTP_OUT_HEADER_CONTENT_TYPE);
httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, "multipart/form-data; boundary=" + boundary);
-
+
LLCore::BufferArray::ptr_t body = LLWebProfile::buildPostData(data, image, boundary);
result = httpAdapter->postAndSuspend(httpRequest, uploadUrl, body, httpOpts, httpHeaders);
@@ -256,15 +256,15 @@ LLCore::BufferArray::ptr_t LLWebProfile::buildPostData(const LLSD &data, LLPoint
// static
void LLWebProfile::reportImageUploadStatus(bool ok)
{
- if (mStatusCallback)
- {
- mStatusCallback(ok);
- }
+ if (mStatusCallback)
+ {
+ mStatusCallback(ok);
+ }
}
// static
std::string LLWebProfile::getAuthCookie()
{
- // This is needed to test image uploads on Linux viewer built with OpenSSL 1.0.0 (0.9.8 works fine).
- return LLStringUtil::getenv("LL_SNAPSHOT_COOKIE", sAuthCookie);
+ // This is needed to test image uploads on Linux viewer built with OpenSSL 1.0.0 (0.9.8 works fine).
+ return LLStringUtil::getenv("LL_SNAPSHOT_COOKIE", sAuthCookie);
}
diff --git a/indra/newview/llwebprofile.h b/indra/newview/llwebprofile.h
index 6227e00afe..335282bf13 100644
--- a/indra/newview/llwebprofile.h
+++ b/indra/newview/llwebprofile.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwebprofile.h
* @brief Web profile access.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,14 +48,14 @@ namespace LLWebProfileResponders
*/
class LLWebProfile
{
- LOG_CLASS(LLWebProfile);
+ LOG_CLASS(LLWebProfile);
public:
- typedef boost::function<void(bool ok)> status_callback_t;
+ typedef boost::function<void(bool ok)> status_callback_t;
- static void uploadImage(LLPointer<LLImageFormatted> image, const std::string& caption, bool add_location);
- static void setAuthCookie(const std::string& cookie);
- static void setImageUploadResultCallback(status_callback_t cb) { mStatusCallback = cb; }
+ static void uploadImage(LLPointer<LLImageFormatted> image, const std::string& caption, bool add_location);
+ static void setAuthCookie(const std::string& cookie);
+ static void setImageUploadResultCallback(status_callback_t cb) { mStatusCallback = cb; }
private:
static LLCore::HttpHeaders::ptr_t buildDefaultHeaders();
@@ -63,11 +63,11 @@ private:
static void uploadImageCoro(LLPointer<LLImageFormatted> image, std::string caption, bool add_location);
static LLCore::BufferArray::ptr_t buildPostData(const LLSD &data, LLPointer<LLImageFormatted> &image, const std::string &boundary);
- static void reportImageUploadStatus(bool ok);
- static std::string getAuthCookie();
+ static void reportImageUploadStatus(bool ok);
+ static std::string getAuthCookie();
- static std::string sAuthCookie;
- static status_callback_t mStatusCallback;
+ static std::string sAuthCookie;
+ static status_callback_t mStatusCallback;
};
#endif // LL_LLWEBPROFILE_H
diff --git a/indra/newview/llwind.cpp b/indra/newview/llwind.cpp
index 4c39fb5b74..14b7a98c71 100644
--- a/indra/newview/llwind.cpp
+++ b/indra/newview/llwind.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwind.cpp
* @brief LLWind class implementation
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,7 +27,7 @@
// Wind is a lattice. It is computed on the simulator, and transmitted to the viewer.
// It drives special effects like smoke blowing, trees bending, and grass wiggling.
//
-// Currently wind lattice does not interpolate correctly to neighbors. This will need
+// Currently wind lattice does not interpolate correctly to neighbors. This will need
// work.
#include "llviewerprecompiledheaders.h"
@@ -51,16 +51,16 @@
//////////////////////////////////////////////////////////////////////
LLWind::LLWind()
-: mSize(16)
+: mSize(16)
{
- init();
+ init();
}
LLWind::~LLWind()
{
- delete [] mVelX;
- delete [] mVelY;
+ delete [] mVelX;
+ delete [] mVelY;
}
@@ -71,197 +71,197 @@ LLWind::~LLWind()
void LLWind::init()
{
- LL_DEBUGS("Wind") << "initializing wind size: "<< mSize << LL_ENDL;
-
- // Initialize vector data
- mVelX = new F32[mSize*mSize];
- mVelY = new F32[mSize*mSize];
-
- S32 i;
- for (i = 0; i < mSize*mSize; i++)
- {
- mVelX[i] = 0.5f;
- mVelY[i] = 0.5f;
- }
+ LL_DEBUGS("Wind") << "initializing wind size: "<< mSize << LL_ENDL;
+
+ // Initialize vector data
+ mVelX = new F32[mSize*mSize];
+ mVelY = new F32[mSize*mSize];
+
+ S32 i;
+ for (i = 0; i < mSize*mSize; i++)
+ {
+ mVelX[i] = 0.5f;
+ mVelY[i] = 0.5f;
+ }
}
void LLWind::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp)
{
- LLPatchHeader patch_header;
- S32 buffer[16*16];
-
- init_patch_decompressor(group_headerp->patch_size);
-
- // Don't use the packed group_header stride because the strides used on
- // simulator and viewer are not equal.
- group_headerp->stride = group_headerp->patch_size;
- set_group_of_patch_header(group_headerp);
-
- // X component
- decode_patch_header(bitpack, &patch_header);
- decode_patch(bitpack, buffer);
- decompress_patch(mVelX, buffer, &patch_header);
-
- // Y component
- decode_patch_header(bitpack, &patch_header);
- decode_patch(bitpack, buffer);
- decompress_patch(mVelY, buffer, &patch_header);
-
- S32 i, j, k;
-
- for (j=1; j<mSize-1; j++)
- {
- for (i=1; i<mSize-1; i++)
- {
- k = i + j * mSize;
- *(mVelX + k) = *(mVelX + k);
- *(mVelY + k) = *(mVelY + k);
- }
- }
-
- i = mSize - 1;
- for (j=1; j<mSize-1; j++)
- {
- k = i + j * mSize;
- *(mVelX + k) = *(mVelX + k);
- *(mVelY + k) = *(mVelY + k);
- }
- i = 0;
- for (j=1; j<mSize-1; j++)
- {
- k = i + j * mSize;
- *(mVelX + k) = *(mVelX + k);
- *(mVelY + k) = *(mVelY + k);
- }
- j = mSize - 1;
- for (i=1; i<mSize-1; i++)
- {
- k = i + j * mSize;
- *(mVelX + k) = *(mVelX + k);
- *(mVelY + k) = *(mVelY + k);
- }
- j = 0;
- for (i=1; i<mSize-1; i++)
- {
- k = i + j * mSize;
- *(mVelX + k) = *(mVelX + k);
- *(mVelY + k) = *(mVelY + k);
- }
+ LLPatchHeader patch_header;
+ S32 buffer[16*16];
+
+ init_patch_decompressor(group_headerp->patch_size);
+
+ // Don't use the packed group_header stride because the strides used on
+ // simulator and viewer are not equal.
+ group_headerp->stride = group_headerp->patch_size;
+ set_group_of_patch_header(group_headerp);
+
+ // X component
+ decode_patch_header(bitpack, &patch_header);
+ decode_patch(bitpack, buffer);
+ decompress_patch(mVelX, buffer, &patch_header);
+
+ // Y component
+ decode_patch_header(bitpack, &patch_header);
+ decode_patch(bitpack, buffer);
+ decompress_patch(mVelY, buffer, &patch_header);
+
+ S32 i, j, k;
+
+ for (j=1; j<mSize-1; j++)
+ {
+ for (i=1; i<mSize-1; i++)
+ {
+ k = i + j * mSize;
+ *(mVelX + k) = *(mVelX + k);
+ *(mVelY + k) = *(mVelY + k);
+ }
+ }
+
+ i = mSize - 1;
+ for (j=1; j<mSize-1; j++)
+ {
+ k = i + j * mSize;
+ *(mVelX + k) = *(mVelX + k);
+ *(mVelY + k) = *(mVelY + k);
+ }
+ i = 0;
+ for (j=1; j<mSize-1; j++)
+ {
+ k = i + j * mSize;
+ *(mVelX + k) = *(mVelX + k);
+ *(mVelY + k) = *(mVelY + k);
+ }
+ j = mSize - 1;
+ for (i=1; i<mSize-1; i++)
+ {
+ k = i + j * mSize;
+ *(mVelX + k) = *(mVelX + k);
+ *(mVelY + k) = *(mVelY + k);
+ }
+ j = 0;
+ for (i=1; i<mSize-1; i++)
+ {
+ k = i + j * mSize;
+ *(mVelX + k) = *(mVelX + k);
+ *(mVelY + k) = *(mVelY + k);
+ }
}
LLVector3 LLWind::getAverage()
{
- // Returns in average_wind the average wind velocity
- LLVector3 average(0.0f, 0.0f, 0.0f);
- S32 i, grid_count;
- grid_count = mSize * mSize;
- for (i = 0; i < grid_count; i++)
- {
- average.mV[VX] += mVelX[i];
- average.mV[VY] += mVelY[i];
- }
-
- average *= 1.f/((F32)(grid_count)) * WIND_SCALE_HACK;
- return average;
+ // Returns in average_wind the average wind velocity
+ LLVector3 average(0.0f, 0.0f, 0.0f);
+ S32 i, grid_count;
+ grid_count = mSize * mSize;
+ for (i = 0; i < grid_count; i++)
+ {
+ average.mV[VX] += mVelX[i];
+ average.mV[VY] += mVelY[i];
+ }
+
+ average *= 1.f/((F32)(grid_count)) * WIND_SCALE_HACK;
+ return average;
}
LLVector3 LLWind::getVelocityNoisy(const LLVector3 &pos_region, const F32 dim)
{
- // Resolve a value, using fractal summing to perturb the returned value
- LLVector3 r_val(0,0,0);
- F32 norm = 1.0f;
- if (dim == 8)
- {
- norm = 1.875;
- }
- else if (dim == 4)
- {
- norm = 1.75;
- }
- else if (dim == 2)
- {
- norm = 1.5;
- }
-
- F32 temp_dim = dim;
- while (temp_dim >= 1.0)
- {
- LLVector3 pos_region_scaled(pos_region * temp_dim);
- r_val += getVelocity(pos_region_scaled) * (1.0f/temp_dim);
- temp_dim /= 2.0;
- }
-
- return r_val * (1.0f/norm) * WIND_SCALE_HACK;
+ // Resolve a value, using fractal summing to perturb the returned value
+ LLVector3 r_val(0,0,0);
+ F32 norm = 1.0f;
+ if (dim == 8)
+ {
+ norm = 1.875;
+ }
+ else if (dim == 4)
+ {
+ norm = 1.75;
+ }
+ else if (dim == 2)
+ {
+ norm = 1.5;
+ }
+
+ F32 temp_dim = dim;
+ while (temp_dim >= 1.0)
+ {
+ LLVector3 pos_region_scaled(pos_region * temp_dim);
+ r_val += getVelocity(pos_region_scaled) * (1.0f/temp_dim);
+ temp_dim /= 2.0;
+ }
+
+ return r_val * (1.0f/norm) * WIND_SCALE_HACK;
}
LLVector3 LLWind::getVelocity(const LLVector3 &pos_region)
{
- llassert(mSize == 16);
- // Resolves value of wind at a location relative to SW corner of region
- //
- // Returns wind magnitude in X,Y components of vector3
- LLVector3 r_val;
- F32 dx,dy;
- S32 k;
-
- LLVector3 pos_clamped_region(pos_region);
-
- F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters();
-
- if (pos_clamped_region.mV[VX] < 0.f)
- {
- pos_clamped_region.mV[VX] = 0.f;
- }
- else if (pos_clamped_region.mV[VX] >= region_width_meters)
- {
- pos_clamped_region.mV[VX] = (F32) fmod(pos_clamped_region.mV[VX], region_width_meters);
- }
-
- if (pos_clamped_region.mV[VY] < 0.f)
- {
- pos_clamped_region.mV[VY] = 0.f;
- }
- else if (pos_clamped_region.mV[VY] >= region_width_meters)
- {
- pos_clamped_region.mV[VY] = (F32) fmod(pos_clamped_region.mV[VY], region_width_meters);
- }
-
-
- S32 i = llfloor(pos_clamped_region.mV[VX] * mSize / region_width_meters);
- S32 j = llfloor(pos_clamped_region.mV[VY] * mSize / region_width_meters);
- k = i + j*mSize;
- dx = ((pos_clamped_region.mV[VX] * mSize / region_width_meters) - (F32) i);
- dy = ((pos_clamped_region.mV[VY] * mSize / region_width_meters) - (F32) j);
-
- if ((i < mSize-1) && (j < mSize-1))
- {
- // Interior points, no edges
- r_val.mV[VX] = mVelX[k]*(1.0f - dx)*(1.0f - dy) +
- mVelX[k + 1]*dx*(1.0f - dy) +
- mVelX[k + mSize]*dy*(1.0f - dx) +
- mVelX[k + mSize + 1]*dx*dy;
- r_val.mV[VY] = mVelY[k]*(1.0f - dx)*(1.0f - dy) +
- mVelY[k + 1]*dx*(1.0f - dy) +
- mVelY[k + mSize]*dy*(1.0f - dx) +
- mVelY[k + mSize + 1]*dx*dy;
- }
- else
- {
- r_val.mV[VX] = mVelX[k];
- r_val.mV[VY] = mVelY[k];
- }
-
- r_val.mV[VZ] = 0.f;
- return r_val * WIND_SCALE_HACK;
+ llassert(mSize == 16);
+ // Resolves value of wind at a location relative to SW corner of region
+ //
+ // Returns wind magnitude in X,Y components of vector3
+ LLVector3 r_val;
+ F32 dx,dy;
+ S32 k;
+
+ LLVector3 pos_clamped_region(pos_region);
+
+ F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters();
+
+ if (pos_clamped_region.mV[VX] < 0.f)
+ {
+ pos_clamped_region.mV[VX] = 0.f;
+ }
+ else if (pos_clamped_region.mV[VX] >= region_width_meters)
+ {
+ pos_clamped_region.mV[VX] = (F32) fmod(pos_clamped_region.mV[VX], region_width_meters);
+ }
+
+ if (pos_clamped_region.mV[VY] < 0.f)
+ {
+ pos_clamped_region.mV[VY] = 0.f;
+ }
+ else if (pos_clamped_region.mV[VY] >= region_width_meters)
+ {
+ pos_clamped_region.mV[VY] = (F32) fmod(pos_clamped_region.mV[VY], region_width_meters);
+ }
+
+
+ S32 i = llfloor(pos_clamped_region.mV[VX] * mSize / region_width_meters);
+ S32 j = llfloor(pos_clamped_region.mV[VY] * mSize / region_width_meters);
+ k = i + j*mSize;
+ dx = ((pos_clamped_region.mV[VX] * mSize / region_width_meters) - (F32) i);
+ dy = ((pos_clamped_region.mV[VY] * mSize / region_width_meters) - (F32) j);
+
+ if ((i < mSize-1) && (j < mSize-1))
+ {
+ // Interior points, no edges
+ r_val.mV[VX] = mVelX[k]*(1.0f - dx)*(1.0f - dy) +
+ mVelX[k + 1]*dx*(1.0f - dy) +
+ mVelX[k + mSize]*dy*(1.0f - dx) +
+ mVelX[k + mSize + 1]*dx*dy;
+ r_val.mV[VY] = mVelY[k]*(1.0f - dx)*(1.0f - dy) +
+ mVelY[k + 1]*dx*(1.0f - dy) +
+ mVelY[k + mSize]*dy*(1.0f - dx) +
+ mVelY[k + mSize + 1]*dx*dy;
+ }
+ else
+ {
+ r_val.mV[VX] = mVelX[k];
+ r_val.mV[VY] = mVelY[k];
+ }
+
+ r_val.mV[VZ] = 0.f;
+ return r_val * WIND_SCALE_HACK;
}
void LLWind::setOriginGlobal(const LLVector3d &origin_global)
{
- mOriginGlobal = origin_global;
+ mOriginGlobal = origin_global;
}
diff --git a/indra/newview/llwind.h b/indra/newview/llwind.h
index e73d1baa58..7532b9bc3b 100644
--- a/indra/newview/llwind.h
+++ b/indra/newview/llwind.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwind.h
* @brief LLWind class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,31 +35,31 @@ class LLVector3;
class LLBitPack;
class LLGroupHeader;
-const F32 WIND_SCALE_HACK = 2.0f; // hack to make wind speeds more realistic
+const F32 WIND_SCALE_HACK = 2.0f; // hack to make wind speeds more realistic
-class LLWind
+class LLWind
{
public:
- LLWind();
- ~LLWind();
- void renderVectors();
- LLVector3 getVelocity(const LLVector3 &location); // "location" is region-local
- LLVector3 getVelocityNoisy(const LLVector3 &location, const F32 dim); // "location" is region-local
+ LLWind();
+ ~LLWind();
+ void renderVectors();
+ LLVector3 getVelocity(const LLVector3 &location); // "location" is region-local
+ LLVector3 getVelocityNoisy(const LLVector3 &location, const F32 dim); // "location" is region-local
- void decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp);
- LLVector3 getAverage();
+ void decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp);
+ LLVector3 getAverage();
- void setOriginGlobal(const LLVector3d &origin_global);
+ void setOriginGlobal(const LLVector3d &origin_global);
private:
- S32 mSize;
- F32 * mVelX;
- F32 * mVelY;
+ S32 mSize;
+ F32 * mVelX;
+ F32 * mVelY;
- LLVector3d mOriginGlobal;
- void init();
+ LLVector3d mOriginGlobal;
+ void init();
- LOG_CLASS(LLWind);
+ LOG_CLASS(LLWind);
};
#endif
diff --git a/indra/newview/llwindebug.cpp b/indra/newview/llwindebug.cpp
index 92c80ce534..8a66fca349 100644
--- a/indra/newview/llwindebug.cpp
+++ b/indra/newview/llwindebug.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,33 +31,33 @@
// based on dbghelp.h
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
- CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
- CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
- CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
- );
+ CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
+ CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
+ CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
+ );
MINIDUMPWRITEDUMP f_mdwp = NULL;
class LLMemoryReserve {
public:
- LLMemoryReserve();
- ~LLMemoryReserve();
- void reserve();
- void release();
+ LLMemoryReserve();
+ ~LLMemoryReserve();
+ void reserve();
+ void release();
private:
- unsigned char *mReserve;
- static const size_t MEMORY_RESERVATION_SIZE;
+ unsigned char *mReserve;
+ static const size_t MEMORY_RESERVATION_SIZE;
};
LLMemoryReserve::LLMemoryReserve() :
- mReserve(NULL)
+ mReserve(NULL)
{
}
LLMemoryReserve::~LLMemoryReserve()
{
- release();
+ release();
}
// I dunno - this just seemed like a pretty good value.
@@ -65,19 +65,19 @@ const size_t LLMemoryReserve::MEMORY_RESERVATION_SIZE = 5 * 1024 * 1024;
void LLMemoryReserve::reserve()
{
- if(NULL == mReserve)
- {
- mReserve = new unsigned char[MEMORY_RESERVATION_SIZE];
- }
+ if(NULL == mReserve)
+ {
+ mReserve = new unsigned char[MEMORY_RESERVATION_SIZE];
+ }
}
void LLMemoryReserve::release()
{
- if (NULL != mReserve)
- {
- delete [] mReserve;
- }
- mReserve = NULL;
+ if (NULL != mReserve)
+ {
+ delete [] mReserve;
+ }
+ mReserve = NULL;
}
static LLMemoryReserve gEmergencyMemoryReserve;
@@ -85,117 +85,117 @@ static LLMemoryReserve gEmergencyMemoryReserve;
LONG NTAPI vectoredHandler(PEXCEPTION_POINTERS exception_infop)
{
- LLWinDebug::instance().generateMinidump(exception_infop);
- return EXCEPTION_CONTINUE_SEARCH;
+ LLWinDebug::instance().generateMinidump(exception_infop);
+ return EXCEPTION_CONTINUE_SEARCH;
}
// static
void LLWinDebug::initSingleton()
{
- static bool s_first_run = true;
- // Load the dbghelp dll now, instead of waiting for the crash.
- // Less potential for stack mangling
-
- // Don't install vectored exception handler if being debugged.
- if(IsDebuggerPresent()) return;
-
- if (s_first_run)
- {
- // First, try loading from the directory that the app resides in.
- std::string local_dll_name = gDirUtilp->findFile("dbghelp.dll", gDirUtilp->getWorkingDir(), gDirUtilp->getExecutableDir());
-
- HMODULE hDll = NULL;
- hDll = LoadLibraryA(local_dll_name.c_str());
- if (!hDll)
- {
- hDll = LoadLibrary(L"dbghelp.dll");
- }
-
- if (!hDll)
- {
- LL_WARNS("AppInit") << "Couldn't find dbghelp.dll!" << LL_ENDL;
- }
- else
- {
- f_mdwp = (MINIDUMPWRITEDUMP) GetProcAddress(hDll, "MiniDumpWriteDump");
-
- if (!f_mdwp)
- {
- FreeLibrary(hDll);
- hDll = NULL;
- }
- }
-
- gEmergencyMemoryReserve.reserve();
-
- s_first_run = false;
-
- // Add this exeption hanlder to save windows style minidump.
- AddVectoredExceptionHandler(0, &vectoredHandler);
- }
+ static bool s_first_run = true;
+ // Load the dbghelp dll now, instead of waiting for the crash.
+ // Less potential for stack mangling
+
+ // Don't install vectored exception handler if being debugged.
+ if(IsDebuggerPresent()) return;
+
+ if (s_first_run)
+ {
+ // First, try loading from the directory that the app resides in.
+ std::string local_dll_name = gDirUtilp->findFile("dbghelp.dll", gDirUtilp->getWorkingDir(), gDirUtilp->getExecutableDir());
+
+ HMODULE hDll = NULL;
+ hDll = LoadLibraryA(local_dll_name.c_str());
+ if (!hDll)
+ {
+ hDll = LoadLibrary(L"dbghelp.dll");
+ }
+
+ if (!hDll)
+ {
+ LL_WARNS("AppInit") << "Couldn't find dbghelp.dll!" << LL_ENDL;
+ }
+ else
+ {
+ f_mdwp = (MINIDUMPWRITEDUMP) GetProcAddress(hDll, "MiniDumpWriteDump");
+
+ if (!f_mdwp)
+ {
+ FreeLibrary(hDll);
+ hDll = NULL;
+ }
+ }
+
+ gEmergencyMemoryReserve.reserve();
+
+ s_first_run = false;
+
+ // Add this exeption hanlder to save windows style minidump.
+ AddVectoredExceptionHandler(0, &vectoredHandler);
+ }
}
void LLWinDebug::cleanupSingleton()
{
- gEmergencyMemoryReserve.release();
+ gEmergencyMemoryReserve.release();
}
void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename)
{
- // Temporary fix to switch out the code that writes the DMP file.
- // Fix coming that doesn't write a mini dump file for regular C++ exceptions.
- const bool enable_write_dump_file = false;
- if ( enable_write_dump_file )
- {
- if(f_mdwp == NULL || gDirUtilp == NULL)
- {
- return;
- }
- else
- {
- std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, filename);
-
- HANDLE hFile = CreateFileA(dump_path.c_str(),
- GENERIC_WRITE,
- FILE_SHARE_WRITE,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
-
- if (hFile != INVALID_HANDLE_VALUE)
- {
- // Write the dump, ignoring the return value
- f_mdwp(GetCurrentProcess(),
- GetCurrentProcessId(),
- hFile,
- type,
- ExInfop,
- NULL,
- NULL);
-
- CloseHandle(hFile);
- }
-
- }
- }
+ // Temporary fix to switch out the code that writes the DMP file.
+ // Fix coming that doesn't write a mini dump file for regular C++ exceptions.
+ const bool enable_write_dump_file = false;
+ if ( enable_write_dump_file )
+ {
+ if(f_mdwp == NULL || gDirUtilp == NULL)
+ {
+ return;
+ }
+ else
+ {
+ std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, filename);
+
+ HANDLE hFile = CreateFileA(dump_path.c_str(),
+ GENERIC_WRITE,
+ FILE_SHARE_WRITE,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ // Write the dump, ignoring the return value
+ f_mdwp(GetCurrentProcess(),
+ GetCurrentProcessId(),
+ hFile,
+ type,
+ ExInfop,
+ NULL,
+ NULL);
+
+ CloseHandle(hFile);
+ }
+
+ }
+ }
}
// static
void LLWinDebug::generateMinidump(struct _EXCEPTION_POINTERS *exception_infop)
{
- std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
- "SecondLifeException");
- if (exception_infop)
- {
- // Since there is exception info... Release the hounds.
- gEmergencyMemoryReserve.release();
-
- _MINIDUMP_EXCEPTION_INFORMATION ExInfo;
-
- ExInfo.ThreadId = ::GetCurrentThreadId();
- ExInfo.ExceptionPointers = exception_infop;
- ExInfo.ClientPointers = NULL;
- writeDumpToFile((MINIDUMP_TYPE)(MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory), &ExInfo, "SecondLife.dmp");
- }
+ std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
+ "SecondLifeException");
+ if (exception_infop)
+ {
+ // Since there is exception info... Release the hounds.
+ gEmergencyMemoryReserve.release();
+
+ _MINIDUMP_EXCEPTION_INFORMATION ExInfo;
+
+ ExInfo.ThreadId = ::GetCurrentThreadId();
+ ExInfo.ExceptionPointers = exception_infop;
+ ExInfo.ClientPointers = NULL;
+ writeDumpToFile((MINIDUMP_TYPE)(MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory), &ExInfo, "SecondLife.dmp");
+ }
}
diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h
index 31dbfb8ffd..d2801c86e1 100644
--- a/indra/newview/llwindebug.h
+++ b/indra/newview/llwindebug.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwindebug.h
* @brief LLWinDebug class header file
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,15 +36,15 @@
#pragma warning (pop)
class LLWinDebug:
- public LLSingleton<LLWinDebug>
+ public LLSingleton<LLWinDebug>
{
- LLSINGLETON_EMPTY_CTOR(LLWinDebug);
+ LLSINGLETON_EMPTY_CTOR(LLWinDebug);
public:
- void initSingleton() override;
- static void generateMinidump(struct _EXCEPTION_POINTERS *pExceptionInfo = NULL);
- void cleanupSingleton() override;
+ void initSingleton() override;
+ static void generateMinidump(struct _EXCEPTION_POINTERS *pExceptionInfo = NULL);
+ void cleanupSingleton() override;
private:
- static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename);
+ static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename);
};
#endif // LL_LLWINDEBUG_H
diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp
index 0edabf358f..87d18cfc00 100644
--- a/indra/newview/llwindowlistener.cpp
+++ b/indra/newview/llwindowlistener.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwindowlistener.cpp
* @brief EventAPI interface for injecting input into LLWindow
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,96 +47,96 @@
#include <boost/bind.hpp>
LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& kbgetter)
- : LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"),
- mWindow(window),
- mKbGetter(kbgetter)
+ : LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"),
+ mWindow(window),
+ mKbGetter(kbgetter)
{
- std::string keySomething =
- "Given [\"keysym\"], [\"keycode\"] or [\"char\"], inject the specified ";
- std::string keyExplain =
- "(integer keycode values, or keysym string from any addKeyName() call in\n"
- "http://bitbucket.org/lindenlab/viewer-release/src/tip/indra/llwindow/llkeyboard.cpp )\n";
- std::string mask =
- "Specify optional [\"mask\"] as an array containing any of \"CTL\", \"ALT\",\n"
- "\"SHIFT\" or \"MAC_CONTROL\"; the corresponding modifier bits will be combined\n"
- "to form the mask used with the event.";
-
- std::string given = "Given ";
- std::string mouseParams =
- "optional [\"path\"], optional [\"x\"] and [\"y\"], inject the requested mouse ";
- std::string buttonParams =
- std::string("[\"button\"], ") + mouseParams;
- std::string buttonExplain =
- "(button values \"LEFT\", \"MIDDLE\", \"RIGHT\")\n";
- std::string paramsExplain =
- "[\"path\"] is as for LLUI::getInstance()->resolvePath(), described in\n"
- "http://bitbucket.org/lindenlab/viewer-release/src/tip/indra/llui/llui.h\n"
- "If you omit [\"path\"], you must specify both [\"x\"] and [\"y\"].\n"
- "If you specify [\"path\"] without both [\"x\"] and [\"y\"], will synthesize (x, y)\n"
- "in the center of the LLView selected by [\"path\"].\n"
- "You may specify [\"path\"] with both [\"x\"] and [\"y\"], will use your (x, y).\n"
- "This may cause the LLView selected by [\"path\"] to reject the event.\n"
- "Optional [\"reply\"] requests a reply event on the named LLEventPump.\n"
- "reply[\"error\"] isUndefined (None) on success, else an explanatory message.\n";
-
- add("getInfo",
- "Get information about the ui element specified by [\"path\"]",
- &LLWindowListener::getInfo,
- LLSDMap("reply", LLSD()));
- add("getPaths",
- "Send on [\"reply\"] an event in which [\"paths\"] is an array of valid LLView\n"
- "pathnames. Optional [\"under\"] pathname specifies the base node under which\n"
- "to list; all nodes from root if no [\"under\"].",
- &LLWindowListener::getPaths,
- LLSDMap("reply", LLSD()));
- add("keyDown",
- keySomething + "keypress event.\n" + keyExplain + mask,
- &LLWindowListener::keyDown);
- add("keyUp",
- keySomething + "key release event.\n" + keyExplain + mask,
- &LLWindowListener::keyUp);
- add("mouseDown",
- given + buttonParams + "click event.\n" + buttonExplain + paramsExplain + mask,
- &LLWindowListener::mouseDown);
- add("mouseUp",
- given + buttonParams + "release event.\n" + buttonExplain + paramsExplain + mask,
- &LLWindowListener::mouseUp);
- add("mouseMove",
- given + mouseParams + "movement event.\n" + paramsExplain + mask,
- &LLWindowListener::mouseMove);
- add("mouseScroll",
- "Given an integer number of [\"clicks\"], inject the requested mouse scroll event.\n"
- "(positive clicks moves downward through typical content)",
- &LLWindowListener::mouseScroll);
+ std::string keySomething =
+ "Given [\"keysym\"], [\"keycode\"] or [\"char\"], inject the specified ";
+ std::string keyExplain =
+ "(integer keycode values, or keysym string from any addKeyName() call in\n"
+ "http://bitbucket.org/lindenlab/viewer-release/src/tip/indra/llwindow/llkeyboard.cpp )\n";
+ std::string mask =
+ "Specify optional [\"mask\"] as an array containing any of \"CTL\", \"ALT\",\n"
+ "\"SHIFT\" or \"MAC_CONTROL\"; the corresponding modifier bits will be combined\n"
+ "to form the mask used with the event.";
+
+ std::string given = "Given ";
+ std::string mouseParams =
+ "optional [\"path\"], optional [\"x\"] and [\"y\"], inject the requested mouse ";
+ std::string buttonParams =
+ std::string("[\"button\"], ") + mouseParams;
+ std::string buttonExplain =
+ "(button values \"LEFT\", \"MIDDLE\", \"RIGHT\")\n";
+ std::string paramsExplain =
+ "[\"path\"] is as for LLUI::getInstance()->resolvePath(), described in\n"
+ "http://bitbucket.org/lindenlab/viewer-release/src/tip/indra/llui/llui.h\n"
+ "If you omit [\"path\"], you must specify both [\"x\"] and [\"y\"].\n"
+ "If you specify [\"path\"] without both [\"x\"] and [\"y\"], will synthesize (x, y)\n"
+ "in the center of the LLView selected by [\"path\"].\n"
+ "You may specify [\"path\"] with both [\"x\"] and [\"y\"], will use your (x, y).\n"
+ "This may cause the LLView selected by [\"path\"] to reject the event.\n"
+ "Optional [\"reply\"] requests a reply event on the named LLEventPump.\n"
+ "reply[\"error\"] isUndefined (None) on success, else an explanatory message.\n";
+
+ add("getInfo",
+ "Get information about the ui element specified by [\"path\"]",
+ &LLWindowListener::getInfo,
+ LLSDMap("reply", LLSD()));
+ add("getPaths",
+ "Send on [\"reply\"] an event in which [\"paths\"] is an array of valid LLView\n"
+ "pathnames. Optional [\"under\"] pathname specifies the base node under which\n"
+ "to list; all nodes from root if no [\"under\"].",
+ &LLWindowListener::getPaths,
+ LLSDMap("reply", LLSD()));
+ add("keyDown",
+ keySomething + "keypress event.\n" + keyExplain + mask,
+ &LLWindowListener::keyDown);
+ add("keyUp",
+ keySomething + "key release event.\n" + keyExplain + mask,
+ &LLWindowListener::keyUp);
+ add("mouseDown",
+ given + buttonParams + "click event.\n" + buttonExplain + paramsExplain + mask,
+ &LLWindowListener::mouseDown);
+ add("mouseUp",
+ given + buttonParams + "release event.\n" + buttonExplain + paramsExplain + mask,
+ &LLWindowListener::mouseUp);
+ add("mouseMove",
+ given + mouseParams + "movement event.\n" + paramsExplain + mask,
+ &LLWindowListener::mouseMove);
+ add("mouseScroll",
+ "Given an integer number of [\"clicks\"], inject the requested mouse scroll event.\n"
+ "(positive clicks moves downward through typical content)",
+ &LLWindowListener::mouseScroll);
}
template <typename MAPPED>
class StringLookup
{
private:
- std::string mDesc;
- typedef std::map<std::string, MAPPED> Map;
- Map mMap;
+ std::string mDesc;
+ typedef std::map<std::string, MAPPED> Map;
+ Map mMap;
public:
- StringLookup(const std::string& desc): mDesc(desc) {}
-
- MAPPED lookup(const typename Map::key_type& key) const
- {
- typename Map::const_iterator found = mMap.find(key);
- if (found == mMap.end())
- {
- LL_WARNS("LLWindowListener") << "Unknown " << mDesc << " '" << key << "'" << LL_ENDL;
- return MAPPED();
- }
- return found->second;
- }
+ StringLookup(const std::string& desc): mDesc(desc) {}
+
+ MAPPED lookup(const typename Map::key_type& key) const
+ {
+ typename Map::const_iterator found = mMap.find(key);
+ if (found == mMap.end())
+ {
+ LL_WARNS("LLWindowListener") << "Unknown " << mDesc << " '" << key << "'" << LL_ENDL;
+ return MAPPED();
+ }
+ return found->second;
+ }
protected:
- void add(const typename Map::key_type& key, const typename Map::mapped_type& value)
- {
- mMap.insert(typename Map::value_type(key, value));
- }
+ void add(const typename Map::key_type& key, const typename Map::mapped_type& value)
+ {
+ mMap.insert(typename Map::value_type(key, value));
+ }
};
namespace {
@@ -144,212 +144,212 @@ namespace {
// helper for getMask()
MASK lookupMask_(const std::string& maskname)
{
- // It's unclear to me whether MASK_MAC_CONTROL is important, but it's not
- // supported by maskFromString(). Handle that specially.
- if (maskname == "MAC_CONTROL")
- {
- return MASK_MAC_CONTROL;
- }
- else
- {
- // In case of lookup failure, return MASK_NONE, which won't affect our
- // caller's OR.
- MASK mask(MASK_NONE);
- LLKeyboard::maskFromString(maskname, &mask);
- return mask;
- }
+ // It's unclear to me whether MASK_MAC_CONTROL is important, but it's not
+ // supported by maskFromString(). Handle that specially.
+ if (maskname == "MAC_CONTROL")
+ {
+ return MASK_MAC_CONTROL;
+ }
+ else
+ {
+ // In case of lookup failure, return MASK_NONE, which won't affect our
+ // caller's OR.
+ MASK mask(MASK_NONE);
+ LLKeyboard::maskFromString(maskname, &mask);
+ return mask;
+ }
}
MASK getMask(const LLSD& event)
{
- LLSD masknames(event["mask"]);
- if (! masknames.isArray())
- {
- // If event["mask"] is a single string, perform normal lookup on it.
- return lookupMask_(masknames);
- }
-
- // Here event["mask"] is an array of mask-name strings. OR together their
- // corresponding bits.
- MASK mask(MASK_NONE);
- for (LLSD::array_const_iterator ai(masknames.beginArray()), aend(masknames.endArray());
- ai != aend; ++ai)
- {
- mask |= lookupMask_(*ai);
- }
- return mask;
+ LLSD masknames(event["mask"]);
+ if (! masknames.isArray())
+ {
+ // If event["mask"] is a single string, perform normal lookup on it.
+ return lookupMask_(masknames);
+ }
+
+ // Here event["mask"] is an array of mask-name strings. OR together their
+ // corresponding bits.
+ MASK mask(MASK_NONE);
+ for (LLSD::array_const_iterator ai(masknames.beginArray()), aend(masknames.endArray());
+ ai != aend; ++ai)
+ {
+ mask |= lookupMask_(*ai);
+ }
+ return mask;
}
KEY getKEY(const LLSD& event)
{
if (event.has("keysym"))
- {
- // Initialize to KEY_NONE; that way we can ignore the bool return from
- // keyFromString() and, in the lookup-fail case, simply return KEY_NONE.
- KEY key(KEY_NONE);
- LLKeyboard::keyFromString(event["keysym"], &key);
- return key;
- }
- else if (event.has("keycode"))
- {
- return KEY(event["keycode"].asInteger());
- }
- else
- {
- return KEY(event["char"].asString()[0]);
- }
+ {
+ // Initialize to KEY_NONE; that way we can ignore the bool return from
+ // keyFromString() and, in the lookup-fail case, simply return KEY_NONE.
+ KEY key(KEY_NONE);
+ LLKeyboard::keyFromString(event["keysym"], &key);
+ return key;
+ }
+ else if (event.has("keycode"))
+ {
+ return KEY(event["keycode"].asInteger());
+ }
+ else
+ {
+ return KEY(event["char"].asString()[0]);
+ }
}
} // namespace
void LLWindowListener::getInfo(LLSD const & evt)
{
- Response response(LLSD(), evt);
-
- if (evt.has("path"))
- {
- std::string path(evt["path"]);
- LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path);
- if (target_view != 0)
- {
- response.setResponse(target_view->getInfo());
- }
- else
- {
- response.error(STRINGIZE(evt["op"].asString() << " request "
- "specified invalid \"path\": '" << path << "'"));
- }
- }
- else
- {
- response.error(
- STRINGIZE(evt["op"].asString() << "request did not provide a path" ));
- }
+ Response response(LLSD(), evt);
+
+ if (evt.has("path"))
+ {
+ std::string path(evt["path"]);
+ LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path);
+ if (target_view != 0)
+ {
+ response.setResponse(target_view->getInfo());
+ }
+ else
+ {
+ response.error(STRINGIZE(evt["op"].asString() << " request "
+ "specified invalid \"path\": '" << path << "'"));
+ }
+ }
+ else
+ {
+ response.error(
+ STRINGIZE(evt["op"].asString() << "request did not provide a path" ));
+ }
}
void LLWindowListener::getPaths(LLSD const & request)
{
- Response response(LLSD(), request);
- LLView *root(LLUI::getInstance()->getRootView()), *base(NULL);
- // Capturing request["under"] as string means we conflate the case in
- // which there is no ["under"] key with the case in which its value is the
- // empty string. That seems to make sense to me.
- std::string under(request["under"]);
-
- // Deal with optional "under" parameter
- if (under.empty())
- {
- base = root;
- }
- else
- {
- base = LLUI::getInstance()->resolvePath(root, under);
- if (! base)
- {
- return response.error(STRINGIZE(request["op"].asString() << " request "
- "specified invalid \"under\" path: '" << under << "'"));
- }
- }
-
- // Traverse the entire subtree under 'base', collecting pathnames
- for (LLView::tree_iterator_t ti(base->beginTreeDFS()), tend(base->endTreeDFS());
- ti != tend; ++ti)
- {
- response["paths"].append((*ti)->getPathname());
- }
+ Response response(LLSD(), request);
+ LLView *root(LLUI::getInstance()->getRootView()), *base(NULL);
+ // Capturing request["under"] as string means we conflate the case in
+ // which there is no ["under"] key with the case in which its value is the
+ // empty string. That seems to make sense to me.
+ std::string under(request["under"]);
+
+ // Deal with optional "under" parameter
+ if (under.empty())
+ {
+ base = root;
+ }
+ else
+ {
+ base = LLUI::getInstance()->resolvePath(root, under);
+ if (! base)
+ {
+ return response.error(STRINGIZE(request["op"].asString() << " request "
+ "specified invalid \"under\" path: '" << under << "'"));
+ }
+ }
+
+ // Traverse the entire subtree under 'base', collecting pathnames
+ for (LLView::tree_iterator_t ti(base->beginTreeDFS()), tend(base->endTreeDFS());
+ ti != tend; ++ti)
+ {
+ response["paths"].append((*ti)->getPathname());
+ }
}
void LLWindowListener::keyDown(LLSD const & evt)
{
- Response response(LLSD(), evt);
- KEY key = getKEY(evt);
- MASK mask = getMask(evt);
-
- if (evt.has("path"))
- {
- std::string path(evt["path"]);
- LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path);
- if (target_view == 0)
- {
- response.error(STRINGIZE(evt["op"].asString() << " request "
- "specified invalid \"path\": '" << path << "'"));
- }
- else if(target_view->isAvailable())
- {
- response.setResponse(target_view->getInfo());
-
- gFocusMgr.setKeyboardFocus(target_view);
- gViewerInput.handleKey(key, mask, false);
- if(key < 0x80) mWindow->handleUnicodeChar(key, mask);
- }
- else
- {
- response.error(STRINGIZE(evt["op"].asString() << " request "
- "element specified by \"path\": '" << path << "'"
- << " is not visible"));
- }
- }
- else
- {
- gViewerInput.handleKey(key, mask, false);
- if(key < 0x80) mWindow->handleUnicodeChar(key, mask);
- }
+ Response response(LLSD(), evt);
+ KEY key = getKEY(evt);
+ MASK mask = getMask(evt);
+
+ if (evt.has("path"))
+ {
+ std::string path(evt["path"]);
+ LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path);
+ if (target_view == 0)
+ {
+ response.error(STRINGIZE(evt["op"].asString() << " request "
+ "specified invalid \"path\": '" << path << "'"));
+ }
+ else if(target_view->isAvailable())
+ {
+ response.setResponse(target_view->getInfo());
+
+ gFocusMgr.setKeyboardFocus(target_view);
+ gViewerInput.handleKey(key, mask, false);
+ if(key < 0x80) mWindow->handleUnicodeChar(key, mask);
+ }
+ else
+ {
+ response.error(STRINGIZE(evt["op"].asString() << " request "
+ "element specified by \"path\": '" << path << "'"
+ << " is not visible"));
+ }
+ }
+ else
+ {
+ gViewerInput.handleKey(key, mask, false);
+ if(key < 0x80) mWindow->handleUnicodeChar(key, mask);
+ }
}
void LLWindowListener::keyUp(LLSD const & evt)
{
- Response response(LLSD(), evt);
-
- if (evt.has("path"))
- {
- std::string path(evt["path"]);
- LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path);
- if (target_view == 0 )
- {
- response.error(STRINGIZE(evt["op"].asString() << " request "
- "specified invalid \"path\": '" << path << "'"));
- }
- else if (target_view->isAvailable())
- {
- response.setResponse(target_view->getInfo());
-
- gFocusMgr.setKeyboardFocus(target_view);
- mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt));
- }
- else
- {
- response.error(STRINGIZE(evt["op"].asString() << " request "
- "element specified byt \"path\": '" << path << "'"
- << " is not visible"));
- }
- }
- else
- {
- mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt));
- }
+ Response response(LLSD(), evt);
+
+ if (evt.has("path"))
+ {
+ std::string path(evt["path"]);
+ LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path);
+ if (target_view == 0 )
+ {
+ response.error(STRINGIZE(evt["op"].asString() << " request "
+ "specified invalid \"path\": '" << path << "'"));
+ }
+ else if (target_view->isAvailable())
+ {
+ response.setResponse(target_view->getInfo());
+
+ gFocusMgr.setKeyboardFocus(target_view);
+ mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt));
+ }
+ else
+ {
+ response.error(STRINGIZE(evt["op"].asString() << " request "
+ "element specified byt \"path\": '" << path << "'"
+ << " is not visible"));
+ }
+ }
+ else
+ {
+ mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt));
+ }
}
// for WhichButton
typedef BOOL (LLWindowCallbacks::*MouseMethod)(LLWindow *, LLCoordGL, MASK);
struct Actions
{
- Actions(const MouseMethod& d, const MouseMethod& u): down(d), up(u), valid(true) {}
- Actions(): valid(false) {}
- MouseMethod down, up;
- bool valid;
+ Actions(const MouseMethod& d, const MouseMethod& u): down(d), up(u), valid(true) {}
+ Actions(): valid(false) {}
+ MouseMethod down, up;
+ bool valid;
};
struct WhichButton: public StringLookup<Actions>
{
- WhichButton(): StringLookup<Actions>("mouse button")
- {
- add("LEFT", Actions(&LLWindowCallbacks::handleMouseDown,
- &LLWindowCallbacks::handleMouseUp));
- add("RIGHT", Actions(&LLWindowCallbacks::handleRightMouseDown,
- &LLWindowCallbacks::handleRightMouseUp));
- add("MIDDLE", Actions(&LLWindowCallbacks::handleMiddleMouseDown,
- &LLWindowCallbacks::handleMiddleMouseUp));
- }
+ WhichButton(): StringLookup<Actions>("mouse button")
+ {
+ add("LEFT", Actions(&LLWindowCallbacks::handleMouseDown,
+ &LLWindowCallbacks::handleMouseUp));
+ add("RIGHT", Actions(&LLWindowCallbacks::handleRightMouseDown,
+ &LLWindowCallbacks::handleRightMouseUp));
+ add("MIDDLE", Actions(&LLWindowCallbacks::handleMiddleMouseDown,
+ &LLWindowCallbacks::handleMiddleMouseUp));
+ }
};
static WhichButton buttons;
@@ -381,145 +381,145 @@ public:
static void mouseEvent(const MouseFunc& func, const LLSD& request)
{
- // Ensure we send response
- LLEventAPI::Response response(LLSD(), request);
- // We haven't yet established whether the incoming request has "x" and "y",
- // but capture this anyway, with 0 for omitted values.
- LLCoordGL pos(request["x"].asInteger(), request["y"].asInteger());
- bool has_pos(request.has("x") && request.has("y"));
-
- std::unique_ptr<LLView::TemporaryDrilldownFunc> tempfunc;
-
- // Documentation for mouseDown(), mouseUp() and mouseMove() claims you
- // must either specify ["path"], or both of ["x"] and ["y"]. You MAY
- // specify all. Let's say that passing "path" as an empty string is
- // equivalent to not passing it at all.
- std::string path(request["path"]);
- if (path.empty())
- {
- // Without "path", you must specify both "x" and "y".
- if (! has_pos)
- {
- return response.error(STRINGIZE(request["op"].asString() << " request "
- "without \"path\" must specify both \"x\" and \"y\": "
- << request));
- }
- }
- else // ! path.empty()
- {
- LLView* root = LLUI::getInstance()->getRootView();
- LLView* target = LLUI::getInstance()->resolvePath(root, path);
- if (! target)
- {
- return response.error(STRINGIZE(request["op"].asString() << " request "
- "specified invalid \"path\": '" << path << "'"));
- }
-
- response.setResponse(target->getInfo());
-
- // The intent of this test is to prevent trying to drill down to a
- // widget in a hidden floater, or on a tab that's not current, etc.
- if (! target->isInVisibleChain())
- {
- return response.error(STRINGIZE(request["op"].asString() << " request "
- "specified \"path\" not currently visible: '"
- << path << "'"));
- }
-
- // This test isn't folded in with the above error case since you can
- // (e.g.) pop up a tooltip even for a disabled widget.
- if (! target->isInEnabledChain())
- {
- response.warn(STRINGIZE(request["op"].asString() << " request "
- "specified \"path\" not currently enabled: '"
- << path << "'"));
- }
-
- if (! has_pos)
- {
- LLRect rect(target->calcScreenRect());
- pos.set(rect.getCenterX(), rect.getCenterY());
- // nonstandard warning tactic: probably usual case; we want event
- // sender to know synthesized (x, y), but maybe don't need to log?
- response["warnings"].append(STRINGIZE("using center point ("
- << pos.mX << ", " << pos.mY << ")"));
- }
+ // Ensure we send response
+ LLEventAPI::Response response(LLSD(), request);
+ // We haven't yet established whether the incoming request has "x" and "y",
+ // but capture this anyway, with 0 for omitted values.
+ LLCoordGL pos(request["x"].asInteger(), request["y"].asInteger());
+ bool has_pos(request.has("x") && request.has("y"));
+
+ std::unique_ptr<LLView::TemporaryDrilldownFunc> tempfunc;
+
+ // Documentation for mouseDown(), mouseUp() and mouseMove() claims you
+ // must either specify ["path"], or both of ["x"] and ["y"]. You MAY
+ // specify all. Let's say that passing "path" as an empty string is
+ // equivalent to not passing it at all.
+ std::string path(request["path"]);
+ if (path.empty())
+ {
+ // Without "path", you must specify both "x" and "y".
+ if (! has_pos)
+ {
+ return response.error(STRINGIZE(request["op"].asString() << " request "
+ "without \"path\" must specify both \"x\" and \"y\": "
+ << request));
+ }
+ }
+ else // ! path.empty()
+ {
+ LLView* root = LLUI::getInstance()->getRootView();
+ LLView* target = LLUI::getInstance()->resolvePath(root, path);
+ if (! target)
+ {
+ return response.error(STRINGIZE(request["op"].asString() << " request "
+ "specified invalid \"path\": '" << path << "'"));
+ }
+
+ response.setResponse(target->getInfo());
+
+ // The intent of this test is to prevent trying to drill down to a
+ // widget in a hidden floater, or on a tab that's not current, etc.
+ if (! target->isInVisibleChain())
+ {
+ return response.error(STRINGIZE(request["op"].asString() << " request "
+ "specified \"path\" not currently visible: '"
+ << path << "'"));
+ }
+
+ // This test isn't folded in with the above error case since you can
+ // (e.g.) pop up a tooltip even for a disabled widget.
+ if (! target->isInEnabledChain())
+ {
+ response.warn(STRINGIZE(request["op"].asString() << " request "
+ "specified \"path\" not currently enabled: '"
+ << path << "'"));
+ }
+
+ if (! has_pos)
+ {
+ LLRect rect(target->calcScreenRect());
+ pos.set(rect.getCenterX(), rect.getCenterY());
+ // nonstandard warning tactic: probably usual case; we want event
+ // sender to know synthesized (x, y), but maybe don't need to log?
+ response["warnings"].append(STRINGIZE("using center point ("
+ << pos.mX << ", " << pos.mY << ")"));
+ }
/*==========================================================================*|
- // NEVER MIND: the LLView tree defines priority handler layers in
- // front of the normal widget set, so this has never yet produced
- // anything but spam warnings. (sigh)
-
- // recursive childFromPoint() should give us the frontmost, leafmost
- // widget at the specified (x, y).
- LLView* frontmost = root->childFromPoint(pos.mX, pos.mY, true);
- if (frontmost != target)
- {
- response.warn(STRINGIZE(request["op"].asString() << " request "
- "specified \"path\" = '" << path
- << "', but frontmost LLView at (" << pos.mX << ", " << pos.mY
- << ") is '" << LLView::getPathname(frontmost) << "'"));
- }
+ // NEVER MIND: the LLView tree defines priority handler layers in
+ // front of the normal widget set, so this has never yet produced
+ // anything but spam warnings. (sigh)
+
+ // recursive childFromPoint() should give us the frontmost, leafmost
+ // widget at the specified (x, y).
+ LLView* frontmost = root->childFromPoint(pos.mX, pos.mY, true);
+ if (frontmost != target)
+ {
+ response.warn(STRINGIZE(request["op"].asString() << " request "
+ "specified \"path\" = '" << path
+ << "', but frontmost LLView at (" << pos.mX << ", " << pos.mY
+ << ") is '" << LLView::getPathname(frontmost) << "'"));
+ }
|*==========================================================================*/
- // Instantiate a TemporaryDrilldownFunc to route incoming mouse events
- // to the target LLView*. But put it on the heap since "path" is
- // optional. Nonetheless, manage it with a boost::scoped_ptr so it
- // will be destroyed when we leave.
- tempfunc.reset(new LLView::TemporaryDrilldownFunc(llview::TargetEvent(target)));
- }
-
- // The question of whether the requested LLView actually handled the
- // specified event is important enough, and its handling unclear enough,
- // to warrant a separate response attribute. Instead of deciding here to
- // make it a warning, or an error, let caller decide.
- response["handled"] = func(pos, getMask(request));
-
- // On exiting this scope, response will send, tempfunc will restore the
- // normal pointInView(x, y) containment logic, etc.
+ // Instantiate a TemporaryDrilldownFunc to route incoming mouse events
+ // to the target LLView*. But put it on the heap since "path" is
+ // optional. Nonetheless, manage it with a boost::scoped_ptr so it
+ // will be destroyed when we leave.
+ tempfunc.reset(new LLView::TemporaryDrilldownFunc(llview::TargetEvent(target)));
+ }
+
+ // The question of whether the requested LLView actually handled the
+ // specified event is important enough, and its handling unclear enough,
+ // to warrant a separate response attribute. Instead of deciding here to
+ // make it a warning, or an error, let caller decide.
+ response["handled"] = func(pos, getMask(request));
+
+ // On exiting this scope, response will send, tempfunc will restore the
+ // normal pointInView(x, y) containment logic, etc.
}
void LLWindowListener::mouseDown(LLSD const & request)
{
- Actions actions(buttons.lookup(request["button"]));
- if (actions.valid)
- {
- // Normally you can pass NULL to an LLWindow* without compiler
- // complaint, but going through boost::bind() evidently
- // bypasses that special case: it only knows you're trying to pass an
- // int to a pointer. Explicitly cast NULL to the desired pointer type.
- mouseEvent(boost::bind(actions.down, mWindow,
- static_cast<LLWindow*>(NULL), _1, _2),
- request);
- }
+ Actions actions(buttons.lookup(request["button"]));
+ if (actions.valid)
+ {
+ // Normally you can pass NULL to an LLWindow* without compiler
+ // complaint, but going through boost::bind() evidently
+ // bypasses that special case: it only knows you're trying to pass an
+ // int to a pointer. Explicitly cast NULL to the desired pointer type.
+ mouseEvent(boost::bind(actions.down, mWindow,
+ static_cast<LLWindow*>(NULL), _1, _2),
+ request);
+ }
}
void LLWindowListener::mouseUp(LLSD const & request)
{
- Actions actions(buttons.lookup(request["button"]));
- if (actions.valid)
- {
- mouseEvent(boost::bind(actions.up, mWindow,
- static_cast<LLWindow*>(NULL), _1, _2),
- request);
- }
+ Actions actions(buttons.lookup(request["button"]));
+ if (actions.valid)
+ {
+ mouseEvent(boost::bind(actions.up, mWindow,
+ static_cast<LLWindow*>(NULL), _1, _2),
+ request);
+ }
}
void LLWindowListener::mouseMove(LLSD const & request)
{
- // We want to call the same central mouseEvent() routine for
- // handleMouseMove() as for button clicks. But handleMouseMove() returns
- // void, whereas mouseEvent() accepts a function returning bool -- and
- // uses that bool return. Use MouseFuncTrue to construct a callable that
- // returns bool anyway.
- mouseEvent(MouseFuncTrue(boost::bind(&LLWindowCallbacks::handleMouseMove, mWindow,
- static_cast<LLWindow*>(NULL), _1, _2)),
- request);
+ // We want to call the same central mouseEvent() routine for
+ // handleMouseMove() as for button clicks. But handleMouseMove() returns
+ // void, whereas mouseEvent() accepts a function returning bool -- and
+ // uses that bool return. Use MouseFuncTrue to construct a callable that
+ // returns bool anyway.
+ mouseEvent(MouseFuncTrue(boost::bind(&LLWindowCallbacks::handleMouseMove, mWindow,
+ static_cast<LLWindow*>(NULL), _1, _2)),
+ request);
}
void LLWindowListener::mouseScroll(LLSD const & request)
{
- S32 clicks = request["clicks"].asInteger();
+ S32 clicks = request["clicks"].asInteger();
- mWindow->handleScrollWheel(NULL, clicks);
+ mWindow->handleScrollWheel(NULL, clicks);
}
diff --git a/indra/newview/llwindowlistener.h b/indra/newview/llwindowlistener.h
index 7af5ab3b9f..207f64c8c0 100644
--- a/indra/newview/llwindowlistener.h
+++ b/indra/newview/llwindowlistener.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwindowlistener.h
* @brief EventAPI interface for injecting input into LLWindow
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,21 +36,21 @@ class LLViewerWindow;
class LLWindowListener : public LLEventAPI
{
public:
- typedef boost::function<LLKeyboard*()> KeyboardGetter;
- LLWindowListener(LLViewerWindow * window, const KeyboardGetter& kbgetter);
-
- void getInfo(LLSD const & evt);
- void getPaths(LLSD const & evt);
- void keyDown(LLSD const & evt);
- void keyUp(LLSD const & evt);
- void mouseDown(LLSD const & evt);
- void mouseUp(LLSD const & evt);
- void mouseMove(LLSD const & evt);
- void mouseScroll(LLSD const & evt);
+ typedef boost::function<LLKeyboard*()> KeyboardGetter;
+ LLWindowListener(LLViewerWindow * window, const KeyboardGetter& kbgetter);
+
+ void getInfo(LLSD const & evt);
+ void getPaths(LLSD const & evt);
+ void keyDown(LLSD const & evt);
+ void keyUp(LLSD const & evt);
+ void mouseDown(LLSD const & evt);
+ void mouseUp(LLSD const & evt);
+ void mouseMove(LLSD const & evt);
+ void mouseScroll(LLSD const & evt);
private:
- LLViewerWindow * mWindow;
- KeyboardGetter mKbGetter;
+ LLViewerWindow * mWindow;
+ KeyboardGetter mKbGetter;
};
diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp
index 0a331d1823..f73e578daf 100644
--- a/indra/newview/llwldaycycle.cpp
+++ b/indra/newview/llwldaycycle.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,295 +47,295 @@ LLWLDayCycle::~LLWLDayCycle()
void LLWLDayCycle::loadDayCycle(const LLSD& day_data, LLWLParamKey::EScope scope)
{
#if 0
- LL_DEBUGS() << "Loading day cycle (day_data.size() = " << day_data.size() << ", scope = " << scope << ")" << LL_ENDL;
- mTimeMap.clear();
-
- // add each key frame
- for(S32 i = 0; i < day_data.size(); ++i)
- {
- // make sure it's a two array
- if(day_data[i].size() != 2)
- {
- continue;
- }
-
- // check each param key exists in param manager
- bool success;
- LLWLParamSet pset;
- LLWLParamKey frame = LLWLParamKey(day_data[i][1].asString(), scope);
- success =
- LLWLParamManager::getInstance()->getParamSet(frame, pset);
- if(!success)
- {
- // *HACK: If loading region day cycle, try local sky presets as well.
- // Local presets may be referenced by a region day cycle after
- // it has been edited but the changes have not been uploaded.
- if (scope == LLEnvKey::SCOPE_REGION)
- {
- frame.scope = LLEnvKey::SCOPE_LOCAL;
- success = LLWLParamManager::getInstance()->getParamSet(frame, pset);
- }
-
- if (!success)
- {
- // alert the user
- LLSD args;
- args["SKY"] = day_data[i][1].asString();
- LLNotifications::instance().add("WLMissingSky", args, LLSD());
- continue;
- }
- }
-
- // then add the keyframe
- addKeyframe((F32)day_data[i][0].asReal(), frame);
- }
+ LL_DEBUGS() << "Loading day cycle (day_data.size() = " << day_data.size() << ", scope = " << scope << ")" << LL_ENDL;
+ mTimeMap.clear();
+
+ // add each key frame
+ for(S32 i = 0; i < day_data.size(); ++i)
+ {
+ // make sure it's a two array
+ if(day_data[i].size() != 2)
+ {
+ continue;
+ }
+
+ // check each param key exists in param manager
+ bool success;
+ LLWLParamSet pset;
+ LLWLParamKey frame = LLWLParamKey(day_data[i][1].asString(), scope);
+ success =
+ LLWLParamManager::getInstance()->getParamSet(frame, pset);
+ if(!success)
+ {
+ // *HACK: If loading region day cycle, try local sky presets as well.
+ // Local presets may be referenced by a region day cycle after
+ // it has been edited but the changes have not been uploaded.
+ if (scope == LLEnvKey::SCOPE_REGION)
+ {
+ frame.scope = LLEnvKey::SCOPE_LOCAL;
+ success = LLWLParamManager::getInstance()->getParamSet(frame, pset);
+ }
+
+ if (!success)
+ {
+ // alert the user
+ LLSD args;
+ args["SKY"] = day_data[i][1].asString();
+ LLNotifications::instance().add("WLMissingSky", args, LLSD());
+ continue;
+ }
+ }
+
+ // then add the keyframe
+ addKeyframe((F32)day_data[i][0].asReal(), frame);
+ }
#endif
}
void LLWLDayCycle::loadDayCycleFromFile(const std::string & fileName)
{
- loadDayCycle(loadCycleDataFromFile(fileName), LLWLParamKey::SCOPE_LOCAL);
+ loadDayCycle(loadCycleDataFromFile(fileName), LLWLParamKey::SCOPE_LOCAL);
}
/*static*/ LLSD LLWLDayCycle::loadCycleDataFromFile(const std::string & fileName)
{
- // *FIX: Cannot load user day cycles.
- std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,
- "windlight/days", fileName));
+ // *FIX: Cannot load user day cycles.
+ std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,
+ "windlight/days", fileName));
- return loadDayCycleFromPath(pathName);
+ return loadDayCycleFromPath(pathName);
}
// static
LLSD LLWLDayCycle::loadDayCycleFromPath(const std::string& file_path)
{
- LL_DEBUGS("Windlight") << "Loading DayCycle settings from " << file_path << LL_ENDL;
-
- llifstream day_cycle_xml(file_path.c_str());
- if (day_cycle_xml.is_open())
- {
- // load and parse it
- LLSD day_data(LLSD::emptyArray());
- LLPointer<LLSDParser> parser = new LLSDXMLParser();
- parser->parse(day_cycle_xml, day_data, LLSDSerialize::SIZE_UNLIMITED);
- day_cycle_xml.close();
- return day_data;
- }
- else
- {
- return LLSD();
- }
+ LL_DEBUGS("Windlight") << "Loading DayCycle settings from " << file_path << LL_ENDL;
+
+ llifstream day_cycle_xml(file_path.c_str());
+ if (day_cycle_xml.is_open())
+ {
+ // load and parse it
+ LLSD day_data(LLSD::emptyArray());
+ LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ parser->parse(day_cycle_xml, day_data, LLSDSerialize::SIZE_UNLIMITED);
+ day_cycle_xml.close();
+ return day_data;
+ }
+ else
+ {
+ return LLSD();
+ }
}
void LLWLDayCycle::saveDayCycle(const std::string & fileName)
{
- std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName));
- //LL_INFOS() << "Saving WindLight settings to " << pathName << LL_ENDL;
+ std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName));
+ //LL_INFOS() << "Saving WindLight settings to " << pathName << LL_ENDL;
- save(pathName);
+ save(pathName);
}
void LLWLDayCycle::save(const std::string& file_path)
{
- LLSD day_data = asLLSD();
+ LLSD day_data = asLLSD();
- llofstream day_cycle_xml(file_path.c_str());
- LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
- formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY);
- day_cycle_xml.close();
+ llofstream day_cycle_xml(file_path.c_str());
+ LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+ formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY);
+ day_cycle_xml.close();
}
LLSD LLWLDayCycle::asLLSD()
{
- LLSD day_data(LLSD::emptyArray());
- for(std::map<F32, LLWLParamKey>::const_iterator mIt = mTimeMap.begin(); mIt != mTimeMap.end(); ++mIt)
- {
- LLSD key(LLSD::emptyArray());
- key.append(mIt->first);
- key.append(mIt->second.name);
- day_data.append(key);
- }
-
- LL_DEBUGS() << "Dumping day cycle (" << mTimeMap.size() << ") to LLSD: " << day_data << LL_ENDL;
- return day_data;
+ LLSD day_data(LLSD::emptyArray());
+ for(std::map<F32, LLWLParamKey>::const_iterator mIt = mTimeMap.begin(); mIt != mTimeMap.end(); ++mIt)
+ {
+ LLSD key(LLSD::emptyArray());
+ key.append(mIt->first);
+ key.append(mIt->second.name);
+ day_data.append(key);
+ }
+
+ LL_DEBUGS() << "Dumping day cycle (" << mTimeMap.size() << ") to LLSD: " << day_data << LL_ENDL;
+ return day_data;
}
// bool LLWLDayCycle::getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs) const
// {
-// bool result = true;
-// LLWLParamManager& wl_mgr = LLWLParamManager::instance();
-//
-// refs.clear();
-// for (std::map<F32, LLWLParamKey>::const_iterator iter = mTimeMap.begin(); iter != mTimeMap.end(); ++iter)
-// {
-// const LLWLParamKey& key = iter->second;
-// if (!wl_mgr.getParamSet(key, refs[key]))
-// {
-// LL_WARNS() << "Cannot find sky [" << key.name << "] referenced by a day cycle" << LL_ENDL;
-// result = false;
-// }
-// }
-//
-// return result;
+// bool result = true;
+// LLWLParamManager& wl_mgr = LLWLParamManager::instance();
+//
+// refs.clear();
+// for (std::map<F32, LLWLParamKey>::const_iterator iter = mTimeMap.begin(); iter != mTimeMap.end(); ++iter)
+// {
+// const LLWLParamKey& key = iter->second;
+// if (!wl_mgr.getParamSet(key, refs[key]))
+// {
+// LL_WARNS() << "Cannot find sky [" << key.name << "] referenced by a day cycle" << LL_ENDL;
+// result = false;
+// }
+// }
+//
+// return result;
// }
bool LLWLDayCycle::getSkyMap(LLSD& sky_map) const
{
-// std::map<LLWLParamKey, LLWLParamSet> refs;
-//
-// if (!getSkyRefs(refs))
-// {
-// return false;
-// }
-//
-// sky_map = LLWLParamManager::createSkyMap(refs);
- return true;
+// std::map<LLWLParamKey, LLWLParamSet> refs;
+//
+// if (!getSkyRefs(refs))
+// {
+// return false;
+// }
+//
+// sky_map = LLWLParamManager::createSkyMap(refs);
+ return true;
}
void LLWLDayCycle::clearKeyframes()
{
- LL_DEBUGS() << "Clearing key frames" << LL_ENDL;
- mTimeMap.clear();
+ LL_DEBUGS() << "Clearing key frames" << LL_ENDL;
+ mTimeMap.clear();
}
bool LLWLDayCycle::addKeyframe(F32 newTime, LLWLParamKey frame)
{
- // no adding negative time
- if(newTime < 0)
- {
- newTime = 0;
- }
-
- // if time not being used, add it and return true
- if(mTimeMap.find(newTime) == mTimeMap.end())
- {
- mTimeMap.insert(std::pair<F32, LLWLParamKey>(newTime, frame));
- LL_DEBUGS() << "Adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << LL_ENDL;
- return true;
- }
-
- // otherwise, don't add, and return error
- LL_WARNS() << "Error adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << LL_ENDL;
- return false;
+ // no adding negative time
+ if(newTime < 0)
+ {
+ newTime = 0;
+ }
+
+ // if time not being used, add it and return true
+ if(mTimeMap.find(newTime) == mTimeMap.end())
+ {
+ mTimeMap.insert(std::pair<F32, LLWLParamKey>(newTime, frame));
+ LL_DEBUGS() << "Adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << LL_ENDL;
+ return true;
+ }
+
+ // otherwise, don't add, and return error
+ LL_WARNS() << "Error adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << LL_ENDL;
+ return false;
}
bool LLWLDayCycle::changeKeyframeTime(F32 oldTime, F32 newTime)
{
- LL_DEBUGS() << "Changing key frame time (" << oldTime << " => " << newTime << ")" << LL_ENDL;
+ LL_DEBUGS() << "Changing key frame time (" << oldTime << " => " << newTime << ")" << LL_ENDL;
- // just remove and add back
- LLWLParamKey frame = mTimeMap[oldTime];
+ // just remove and add back
+ LLWLParamKey frame = mTimeMap[oldTime];
- bool stat = removeKeyframe(oldTime);
- if(stat == false)
- {
- LL_DEBUGS() << "Failed to change key frame time (" << oldTime << " => " << newTime << ")" << LL_ENDL;
- return stat;
- }
+ bool stat = removeKeyframe(oldTime);
+ if(stat == false)
+ {
+ LL_DEBUGS() << "Failed to change key frame time (" << oldTime << " => " << newTime << ")" << LL_ENDL;
+ return stat;
+ }
- return addKeyframe(newTime, frame);
+ return addKeyframe(newTime, frame);
}
// bool LLWLDayCycle::changeKeyframeParam(F32 time, LLWLParamKey key)
// {
-// LL_DEBUGS() << "Changing key frame param (" << time << ", " << key.toLLSD() << ")" << LL_ENDL;
-//
-// // just remove and add back
-// // make sure param exists
-// LLWLParamSet tmp;
-// bool stat = LLWLParamManager::getInstance()->getParamSet(key, tmp);
-// if(stat == false)
-// {
-// LL_DEBUGS() << "Failed to change key frame param (" << time << ", " << key.toLLSD() << ")" << LL_ENDL;
-// return stat;
-// }
-//
-// mTimeMap[time] = key;
-// return true;
+// LL_DEBUGS() << "Changing key frame param (" << time << ", " << key.toLLSD() << ")" << LL_ENDL;
+//
+// // just remove and add back
+// // make sure param exists
+// LLWLParamSet tmp;
+// bool stat = LLWLParamManager::getInstance()->getParamSet(key, tmp);
+// if(stat == false)
+// {
+// LL_DEBUGS() << "Failed to change key frame param (" << time << ", " << key.toLLSD() << ")" << LL_ENDL;
+// return stat;
+// }
+//
+// mTimeMap[time] = key;
+// return true;
// }
bool LLWLDayCycle::removeKeyframe(F32 time)
{
- LL_DEBUGS() << "Removing key frame (" << time << ")" << LL_ENDL;
+ LL_DEBUGS() << "Removing key frame (" << time << ")" << LL_ENDL;
- // look for the time. If there, erase it
- std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
- if(mIt != mTimeMap.end())
- {
- mTimeMap.erase(mIt);
- return true;
- }
+ // look for the time. If there, erase it
+ std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
+ if(mIt != mTimeMap.end())
+ {
+ mTimeMap.erase(mIt);
+ return true;
+ }
- return false;
+ return false;
}
bool LLWLDayCycle::getKeytime(LLWLParamKey frame, F32& key_time) const
{
- // scroll through till we find the correct value in the map
- std::map<F32, LLWLParamKey>::const_iterator mIt = mTimeMap.begin();
- for(; mIt != mTimeMap.end(); ++mIt)
- {
- if(frame == mIt->second)
- {
- key_time = mIt->first;
- return true;
- }
- }
-
- return false;
+ // scroll through till we find the correct value in the map
+ std::map<F32, LLWLParamKey>::const_iterator mIt = mTimeMap.begin();
+ for(; mIt != mTimeMap.end(); ++mIt)
+ {
+ if(frame == mIt->second)
+ {
+ key_time = mIt->first;
+ return true;
+ }
+ }
+
+ return false;
}
// bool LLWLDayCycle::getKeyedParam(F32 time, LLWLParamSet& param)
// {
-// // just scroll on through till you find it
-// std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
-// if(mIt != mTimeMap.end())
-// {
-// return LLWLParamManager::getInstance()->getParamSet(mIt->second, param);
-// }
-//
-// // return error if not found
-// LL_DEBUGS() << "Key " << time << " not found" << LL_ENDL;
-// return false;
+// // just scroll on through till you find it
+// std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
+// if(mIt != mTimeMap.end())
+// {
+// return LLWLParamManager::getInstance()->getParamSet(mIt->second, param);
+// }
+//
+// // return error if not found
+// LL_DEBUGS() << "Key " << time << " not found" << LL_ENDL;
+// return false;
// }
bool LLWLDayCycle::getKeyedParamName(F32 time, std::string & name)
{
- // just scroll on through till you find it
- std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
- if(mIt != mTimeMap.end())
- {
- name = mTimeMap[time].name;
- return true;
- }
-
- // return error if not found
- LL_DEBUGS() << "Key " << time << " not found" << LL_ENDL;
- return false;
+ // just scroll on through till you find it
+ std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
+ if(mIt != mTimeMap.end())
+ {
+ name = mTimeMap[time].name;
+ return true;
+ }
+
+ // return error if not found
+ LL_DEBUGS() << "Key " << time << " not found" << LL_ENDL;
+ return false;
}
bool LLWLDayCycle::hasReferencesTo(const LLWLParamKey& keyframe) const
{
- F32 dummy;
- return getKeytime(keyframe, dummy);
+ F32 dummy;
+ return getKeytime(keyframe, dummy);
}
void LLWLDayCycle::removeReferencesTo(const LLWLParamKey& keyframe)
{
- LL_DEBUGS() << "Removing references to key frame " << keyframe.toLLSD() << LL_ENDL;
- F32 keytime;
- bool might_exist;
- do
- {
- // look for it
- might_exist = getKeytime(keyframe, keytime);
- if(!might_exist)
- {
- return;
- }
- might_exist = removeKeyframe(keytime);
-
- } while(might_exist); // might be another one
+ LL_DEBUGS() << "Removing references to key frame " << keyframe.toLLSD() << LL_ENDL;
+ F32 keytime;
+ bool might_exist;
+ do
+ {
+ // look for it
+ might_exist = getKeytime(keyframe, keytime);
+ if(!might_exist)
+ {
+ return;
+ }
+ might_exist = removeKeyframe(keytime);
+
+ } while(might_exist); // might be another one
}
diff --git a/indra/newview/llwldaycycle.h b/indra/newview/llwldaycycle.h
index 2f9a2e5c4a..623462043b 100644
--- a/indra/newview/llwldaycycle.h
+++ b/indra/newview/llwldaycycle.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,89 +37,89 @@ struct LLWLParamKey;
class LLWLDayCycle
{
- LOG_CLASS(LLWLDayCycle);
+ LOG_CLASS(LLWLDayCycle);
public:
- // lists what param sets are used when during the day
- std::map<F32, LLWLParamKey> mTimeMap;
+ // lists what param sets are used when during the day
+ std::map<F32, LLWLParamKey> mTimeMap;
- // how long is my day
- F32 mDayRate;
+ // how long is my day
+ F32 mDayRate;
public:
- /// simple constructor
- LLWLDayCycle();
+ /// simple constructor
+ LLWLDayCycle();
- /// simple destructor
- ~LLWLDayCycle();
+ /// simple destructor
+ ~LLWLDayCycle();
- /// load a day cycle
- void loadDayCycle(const LLSD& llsd, LLEnvKey::EScope scope);
+ /// load a day cycle
+ void loadDayCycle(const LLSD& llsd, LLEnvKey::EScope scope);
- /// load a day cycle
- void loadDayCycleFromFile(const std::string & fileName);
+ /// load a day cycle
+ void loadDayCycleFromFile(const std::string & fileName);
- /// save a day cycle
- void saveDayCycle(const std::string & fileName);
+ /// save a day cycle
+ void saveDayCycle(const std::string & fileName);
- /// save a day cycle
- void save(const std::string& file_path);
+ /// save a day cycle
+ void save(const std::string& file_path);
- /// load the LLSD data from a file (returns the undefined LLSD if not found)
- static LLSD loadCycleDataFromFile(const std::string & fileName);
+ /// load the LLSD data from a file (returns the undefined LLSD if not found)
+ static LLSD loadCycleDataFromFile(const std::string & fileName);
- /// load the LLSD data from a file specified by full path
- static LLSD loadDayCycleFromPath(const std::string& file_path);
+ /// load the LLSD data from a file specified by full path
+ static LLSD loadDayCycleFromPath(const std::string& file_path);
- /// get the LLSD data for this day cycle
- LLSD asLLSD();
+ /// get the LLSD data for this day cycle
+ LLSD asLLSD();
- // get skies referenced by this day cycle
-// bool getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs) const;
+ // get skies referenced by this day cycle
+// bool getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs) const;
- // get referenced skies as LLSD
- bool getSkyMap(LLSD& sky_map) const;
+ // get referenced skies as LLSD
+ bool getSkyMap(LLSD& sky_map) const;
- /// clear keyframes
- void clearKeyframes();
+ /// clear keyframes
+ void clearKeyframes();
- /// Getters and Setters
- /// add a new key frame to the day cycle
- /// returns true if successful
- /// no negative time
- bool addKeyframe(F32 newTime, LLWLParamKey key);
+ /// Getters and Setters
+ /// add a new key frame to the day cycle
+ /// returns true if successful
+ /// no negative time
+ bool addKeyframe(F32 newTime, LLWLParamKey key);
- /// adjust a keyframe's placement in the day cycle
- /// returns true if successful
- bool changeKeyframeTime(F32 oldTime, F32 newTime);
+ /// adjust a keyframe's placement in the day cycle
+ /// returns true if successful
+ bool changeKeyframeTime(F32 oldTime, F32 newTime);
- /// adjust a keyframe's parameter used
- /// returns true if successful
- bool changeKeyframeParam(F32 time, LLWLParamKey key);
+ /// adjust a keyframe's parameter used
+ /// returns true if successful
+ bool changeKeyframeParam(F32 time, LLWLParamKey key);
- /// remove a key frame from the day cycle
- /// returns true if successful
- bool removeKeyframe(F32 time);
+ /// remove a key frame from the day cycle
+ /// returns true if successful
+ bool removeKeyframe(F32 time);
- /// get the first key time for a parameter
- /// returns false if not there
- bool getKeytime(LLWLParamKey keyFrame, F32& keyTime) const;
+ /// get the first key time for a parameter
+ /// returns false if not there
+ bool getKeytime(LLWLParamKey keyFrame, F32& keyTime) const;
- /// get the param set at a given time
- /// returns true if found one
-// bool getKeyedParam(F32 time, LLWLParamSet& param);
+ /// get the param set at a given time
+ /// returns true if found one
+// bool getKeyedParam(F32 time, LLWLParamSet& param);
- /// get the name
- /// returns true if it found one
- bool getKeyedParamName(F32 time, std::string & name);
+ /// get the name
+ /// returns true if it found one
+ bool getKeyedParamName(F32 time, std::string & name);
- /// @return true if there are references to the given sky
- bool hasReferencesTo(const LLWLParamKey& keyframe) const;
+ /// @return true if there are references to the given sky
+ bool hasReferencesTo(const LLWLParamKey& keyframe) const;
- /// removes all references to the sky (paramkey)
- /// does nothing if the sky doesn't exist in the day
- void removeReferencesTo(const LLWLParamKey& keyframe);
+ /// removes all references to the sky (paramkey)
+ /// does nothing if the sky doesn't exist in the day
+ void removeReferencesTo(const LLWLParamKey& keyframe);
};
diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp
index d55e1b7cd3..4e3a7a8788 100644
--- a/indra/newview/llwlhandlers.cpp
+++ b/indra/newview/llwlhandlers.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwlhandlers.cpp
* @brief Various classes which handle Windlight-related messaging
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,50 +40,50 @@
// static
bool LLEnvironmentRequest::initiate(LLEnvironment::environment_apply_fn cb)
{
- LLViewerRegion* cur_region = gAgent.getRegion();
+ LLViewerRegion* cur_region = gAgent.getRegion();
- if (!cur_region)
- {
- LL_WARNS("WindlightCaps") << "Viewer region not set yet, skipping env. settings request" << LL_ENDL;
- return false;
- }
+ if (!cur_region)
+ {
+ LL_WARNS("WindlightCaps") << "Viewer region not set yet, skipping env. settings request" << LL_ENDL;
+ return false;
+ }
- if (!cur_region->capabilitiesReceived())
- {
- LL_INFOS("WindlightCaps") << "Deferring windlight settings request until we've got region caps" << LL_ENDL;
+ if (!cur_region->capabilitiesReceived())
+ {
+ LL_INFOS("WindlightCaps") << "Deferring windlight settings request until we've got region caps" << LL_ENDL;
cur_region->setCapabilitiesReceivedCallback([cb](const LLUUID &region_id, LLViewerRegion* regionp) { LLEnvironmentRequest::onRegionCapsReceived(region_id, cb); });
- return false;
- }
+ return false;
+ }
- return doRequest(cb);
+ return doRequest(cb);
}
// static
void LLEnvironmentRequest::onRegionCapsReceived(const LLUUID& region_id, LLEnvironment::environment_apply_fn cb)
{
- if (region_id != gAgent.getRegion()->getRegionID())
- {
- LL_INFOS("WindlightCaps") << "Got caps for a non-current region" << LL_ENDL;
- return;
- }
-
- LL_DEBUGS("WindlightCaps") << "Received region capabilities" << LL_ENDL;
- doRequest(cb);
+ if (region_id != gAgent.getRegion()->getRegionID())
+ {
+ LL_INFOS("WindlightCaps") << "Got caps for a non-current region" << LL_ENDL;
+ return;
+ }
+
+ LL_DEBUGS("WindlightCaps") << "Received region capabilities" << LL_ENDL;
+ doRequest(cb);
}
// static
bool LLEnvironmentRequest::doRequest(LLEnvironment::environment_apply_fn cb)
{
- std::string url = gAgent.getRegionCapability("EnvironmentSettings");
- if (url.empty())
- {
- LL_INFOS("WindlightCaps") << "Skipping windlight setting request - we don't have this capability" << LL_ENDL;
- // region is apparently not capable of this; don't respond at all
+ std::string url = gAgent.getRegionCapability("EnvironmentSettings");
+ if (url.empty())
+ {
+ LL_INFOS("WindlightCaps") << "Skipping windlight setting request - we don't have this capability" << LL_ENDL;
+ // region is apparently not capable of this; don't respond at all
// (there shouldn't be any regions where this is the case... but
LL_INFOS("ENVIRONMENT") << "No legacy windlight caps... just set the region to be the default day." << LL_ENDL;
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_REGION, LLSettingsDay::GetDefaultAssetId());
- return false;
- }
+ return false;
+ }
std::string coroname =
LLCoros::instance().launch("LLEnvironmentRequest::environmentRequestCoro",
@@ -95,12 +95,12 @@ bool LLEnvironmentRequest::doRequest(LLEnvironment::environment_apply_fn cb)
S32 LLEnvironmentRequest::sLastRequest = 0;
-//static
+//static
void LLEnvironmentRequest::environmentRequestCoro(std::string url, LLEnvironment::environment_apply_fn cb)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
S32 requestId = ++LLEnvironmentRequest::sLastRequest;
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EnvironmentRequest", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
@@ -159,26 +159,26 @@ clock_t LLEnvironmentApply::sLastUpdate = clock_t(0.f);
// static
bool LLEnvironmentApply::initiateRequest(const LLSD& content, LLEnvironment::environment_apply_fn cb)
{
- clock_t current = clock();
-
- // Make sure we don't update too frequently.
- if (current < sLastUpdate + (UPDATE_WAIT_SECONDS * CLOCKS_PER_SEC))
- {
- LLSD args(LLSD::emptyMap());
- args["WAIT"] = (F64)UPDATE_WAIT_SECONDS;
- LLNotificationsUtil::add("EnvUpdateRate", args);
- return false;
- }
-
- sLastUpdate = current;
-
- // Send update request.
- std::string url = gAgent.getRegionCapability("ExtEnvironment");
- if (url.empty())
- {
- LL_WARNS("WindlightCaps") << "Applying windlight settings not supported" << LL_ENDL;
- return false;
- }
+ clock_t current = clock();
+
+ // Make sure we don't update too frequently.
+ if (current < sLastUpdate + (UPDATE_WAIT_SECONDS * CLOCKS_PER_SEC))
+ {
+ LLSD args(LLSD::emptyMap());
+ args["WAIT"] = (F64)UPDATE_WAIT_SECONDS;
+ LLNotificationsUtil::add("EnvUpdateRate", args);
+ return false;
+ }
+
+ sLastUpdate = current;
+
+ // Send update request.
+ std::string url = gAgent.getRegionCapability("ExtEnvironment");
+ if (url.empty())
+ {
+ LL_WARNS("WindlightCaps") << "Applying windlight settings not supported" << LL_ENDL;
+ return false;
+ }
LL_INFOS("WindlightCaps") << "Sending windlight settings to " << url << LL_ENDL;
LL_DEBUGS("WindlightCaps") << "content: " << content << LL_ENDL;
@@ -186,7 +186,7 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content, LLEnvironment::env
std::string coroname =
LLCoros::instance().launch("LLEnvironmentApply::environmentApplyCoro",
[url, content, cb]() { LLEnvironmentApply::environmentApplyCoro(url, content, cb); });
- return true;
+ return true;
}
void LLEnvironmentApply::environmentApplyCoro(std::string url, LLSD content, LLEnvironment::environment_apply_fn cb)
@@ -214,7 +214,7 @@ void LLEnvironmentApply::environmentApplyCoro(std::string url, LLSD content, LLE
* }
*/
- do // while false.
+ do // while false.
{ // Breaks from loop in the case of an error.
LLSD httpResults = result["http_result"];
@@ -235,7 +235,7 @@ void LLEnvironmentApply::environmentApplyCoro(std::string url, LLSD content, LLE
notify = LLSD::emptyMap();
notify["FAIL_REASON"] = "Missing regionID, malformed response";
break;
- }
+ }
else if (result["regionID"].asUUID() != gAgent.getRegion()->getRegionID())
{
// note that there is no report to the user in this failure case.
diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h
index b09d2df60f..8496bf651f 100644
--- a/indra/newview/llwlhandlers.h
+++ b/indra/newview/llwlhandlers.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwlhandlers.h
* @brief Headers for classes in llwlhandlers.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,9 +33,9 @@
class LLEnvironmentRequest
{
- LOG_CLASS(LLEnvironmentRequest);
+ LOG_CLASS(LLEnvironmentRequest);
public:
- /// @return true if request was successfully sent
+ /// @return true if request was successfully sent
static bool initiate(LLEnvironment::environment_apply_fn cb);
private:
@@ -49,14 +49,14 @@ private:
class LLEnvironmentApply
{
- LOG_CLASS(LLEnvironmentApply);
+ LOG_CLASS(LLEnvironmentApply);
public:
- /// @return true if request was successfully sent
+ /// @return true if request was successfully sent
static bool initiateRequest(const LLSD& content, LLEnvironment::environment_apply_fn cb);
private:
- static clock_t sLastUpdate;
- static clock_t UPDATE_WAIT_SECONDS;
+ static clock_t sLastUpdate;
+ static clock_t UPDATE_WAIT_SECONDS;
static void environmentApplyCoro(std::string url, LLSD content, LLEnvironment::environment_apply_fn cb);
};
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 9381211e9b..249dd10f46 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llworld.cpp
* @brief Initial test structure to organize viewer regions
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,7 +56,7 @@
#include "llvowater.h"
#include "message.h"
#include "pipeline.h"
-#include "llappviewer.h" // for do_disconnect()
+#include "llappviewer.h" // for do_disconnect()
#include "llscenemonitor.h"
#include <deque>
#include <queue>
@@ -67,7 +67,7 @@
//
// Globals
//
-U32 gAgentPauseSerialNum = 0;
+U32 gAgentPauseSerialNum = 0;
//
// Constants
@@ -89,27 +89,27 @@ const F32 LLWorld::mWidthInMeters = mWidth * mScale;
// allocate the stack
LLWorld::LLWorld() :
- mLandFarClip(DEFAULT_FAR_PLANE),
- mLastPacketsIn(0),
- mLastPacketsOut(0),
- mLastPacketsLost(0),
- mSpaceTimeUSec(0)
+ mLandFarClip(DEFAULT_FAR_PLANE),
+ mLastPacketsIn(0),
+ mLastPacketsOut(0),
+ mLastPacketsLost(0),
+ mSpaceTimeUSec(0)
{
- for (S32 i = 0; i < EDGE_WATER_OBJECTS_COUNT; i++)
- {
- mEdgeWaterObjects[i] = NULL;
- }
-
- LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,4);
- U8 *default_texture = raw->getData();
- *(default_texture++) = MAX_WATER_COLOR.mV[0];
- *(default_texture++) = MAX_WATER_COLOR.mV[1];
- *(default_texture++) = MAX_WATER_COLOR.mV[2];
- *(default_texture++) = MAX_WATER_COLOR.mV[3];
-
- mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
- gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
- mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
+ for (S32 i = 0; i < EDGE_WATER_OBJECTS_COUNT; i++)
+ {
+ mEdgeWaterObjects[i] = NULL;
+ }
+
+ LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,4);
+ U8 *default_texture = raw->getData();
+ *(default_texture++) = MAX_WATER_COLOR.mV[0];
+ *(default_texture++) = MAX_WATER_COLOR.mV[1];
+ *(default_texture++) = MAX_WATER_COLOR.mV[2];
+ *(default_texture++) = MAX_WATER_COLOR.mV[3];
+
+ mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
+ gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
+ mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
LLViewerRegion::sVOCacheCullingEnabled = gSavedSettings.getBOOL("RequestFullRegionCache") && gSavedSettings.getBOOL("ObjectCacheEnabled");
}
@@ -117,564 +117,564 @@ LLWorld::LLWorld() :
void LLWorld::resetClass()
{
- mHoleWaterObjects.clear();
- gObjectList.destroy();
+ mHoleWaterObjects.clear();
+ gObjectList.destroy();
gSky.cleanup(); // references an object
- for(region_list_t::iterator region_it = mRegionList.begin(); region_it != mRegionList.end(); )
- {
- LLViewerRegion* region_to_delete = *region_it++;
- removeRegion(region_to_delete->getHost());
- }
-
- LLViewerPartSim::getInstance()->destroyClass();
-
- mDefaultWaterTexturep = NULL ;
- for (S32 i = 0; i < EDGE_WATER_OBJECTS_COUNT; i++)
- {
- mEdgeWaterObjects[i] = NULL;
- }
-
- //make all visible drawbles invisible.
- LLDrawable::incrementVisible();
-
- LLSceneMonitor::deleteSingleton();
+ for(region_list_t::iterator region_it = mRegionList.begin(); region_it != mRegionList.end(); )
+ {
+ LLViewerRegion* region_to_delete = *region_it++;
+ removeRegion(region_to_delete->getHost());
+ }
+
+ LLViewerPartSim::getInstance()->destroyClass();
+
+ mDefaultWaterTexturep = NULL ;
+ for (S32 i = 0; i < EDGE_WATER_OBJECTS_COUNT; i++)
+ {
+ mEdgeWaterObjects[i] = NULL;
+ }
+
+ //make all visible drawbles invisible.
+ LLDrawable::incrementVisible();
+
+ LLSceneMonitor::deleteSingleton();
}
LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
{
- LL_INFOS() << "Add region with handle: " << region_handle << " on host " << host << LL_ENDL;
- LLViewerRegion *regionp = getRegionFromHandle(region_handle);
- std::string seedUrl;
- if (regionp)
- {
- LLHost old_host = regionp->getHost();
- // region already exists!
- if (host == old_host && regionp->isAlive())
- {
- // This is a duplicate for the same host and it's alive, don't bother.
- LL_INFOS() << "Region already exists and is alive, using existing region" << LL_ENDL;
- return regionp;
- }
-
- if (host != old_host)
- {
- LL_WARNS() << "LLWorld::addRegion exists, but old host " << old_host
- << " does not match new host " << host
- << ", removing old region and creating new" << LL_ENDL;
- }
- if (!regionp->isAlive())
- {
- LL_WARNS() << "LLWorld::addRegion exists, but isn't alive. Removing old region and creating new" << LL_ENDL;
- }
-
- // Save capabilities seed URL
- seedUrl = regionp->getCapability("Seed");
-
- // Kill the old host, and then we can continue on and add the new host. We have to kill even if the host
- // matches, because all the agent state for the new camera is completely different.
- removeRegion(old_host);
- }
- else
- {
- LL_INFOS() << "Region does not exist, creating new one" << LL_ENDL;
- }
-
- U32 iindex = 0;
- U32 jindex = 0;
- from_region_handle(region_handle, &iindex, &jindex);
- S32 x = (S32)(iindex/mWidth);
- S32 y = (S32)(jindex/mWidth);
- LL_INFOS() << "Adding new region (" << x << ":" << y << ")"
- << " on host: " << host << LL_ENDL;
-
- LLVector3d origin_global;
-
- origin_global = from_region_handle(region_handle);
-
- regionp = new LLViewerRegion(region_handle,
- host,
- mWidth,
- WORLD_PATCH_SIZE,
- getRegionWidthInMeters() );
- if (!regionp)
- {
- LL_ERRS() << "Unable to create new region!" << LL_ENDL;
- }
-
- if ( !seedUrl.empty() )
- {
- regionp->setCapability("Seed", seedUrl);
- }
-
- mRegionList.push_back(regionp);
- mActiveRegionList.push_back(regionp);
- mCulledRegionList.push_back(regionp);
-
-
- // Find all the adjacent regions, and attach them.
- // Generate handles for all of the adjacent regions, and attach them in the correct way.
- // connect the edges
- F32 adj_x = 0.f;
- F32 adj_y = 0.f;
- F32 region_x = 0.f;
- F32 region_y = 0.f;
- U64 adj_handle = 0;
-
- F32 width = getRegionWidthInMeters();
-
- LLViewerRegion *neighborp;
- from_region_handle(region_handle, &region_x, &region_y);
-
- // Iterate through all directions, and connect neighbors if there.
- S32 dir;
- for (dir = 0; dir < 8; dir++)
- {
- adj_x = region_x + width * gDirAxes[dir][0];
- adj_y = region_y + width * gDirAxes[dir][1];
- to_region_handle(adj_x, adj_y, &adj_handle);
-
- neighborp = getRegionFromHandle(adj_handle);
- if (neighborp)
- {
- //LL_INFOS() << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << LL_ENDL;
- regionp->connectNeighbor(neighborp, dir);
- }
- }
-
- updateWaterObjects();
-
- return regionp;
+ LL_INFOS() << "Add region with handle: " << region_handle << " on host " << host << LL_ENDL;
+ LLViewerRegion *regionp = getRegionFromHandle(region_handle);
+ std::string seedUrl;
+ if (regionp)
+ {
+ LLHost old_host = regionp->getHost();
+ // region already exists!
+ if (host == old_host && regionp->isAlive())
+ {
+ // This is a duplicate for the same host and it's alive, don't bother.
+ LL_INFOS() << "Region already exists and is alive, using existing region" << LL_ENDL;
+ return regionp;
+ }
+
+ if (host != old_host)
+ {
+ LL_WARNS() << "LLWorld::addRegion exists, but old host " << old_host
+ << " does not match new host " << host
+ << ", removing old region and creating new" << LL_ENDL;
+ }
+ if (!regionp->isAlive())
+ {
+ LL_WARNS() << "LLWorld::addRegion exists, but isn't alive. Removing old region and creating new" << LL_ENDL;
+ }
+
+ // Save capabilities seed URL
+ seedUrl = regionp->getCapability("Seed");
+
+ // Kill the old host, and then we can continue on and add the new host. We have to kill even if the host
+ // matches, because all the agent state for the new camera is completely different.
+ removeRegion(old_host);
+ }
+ else
+ {
+ LL_INFOS() << "Region does not exist, creating new one" << LL_ENDL;
+ }
+
+ U32 iindex = 0;
+ U32 jindex = 0;
+ from_region_handle(region_handle, &iindex, &jindex);
+ S32 x = (S32)(iindex/mWidth);
+ S32 y = (S32)(jindex/mWidth);
+ LL_INFOS() << "Adding new region (" << x << ":" << y << ")"
+ << " on host: " << host << LL_ENDL;
+
+ LLVector3d origin_global;
+
+ origin_global = from_region_handle(region_handle);
+
+ regionp = new LLViewerRegion(region_handle,
+ host,
+ mWidth,
+ WORLD_PATCH_SIZE,
+ getRegionWidthInMeters() );
+ if (!regionp)
+ {
+ LL_ERRS() << "Unable to create new region!" << LL_ENDL;
+ }
+
+ if ( !seedUrl.empty() )
+ {
+ regionp->setCapability("Seed", seedUrl);
+ }
+
+ mRegionList.push_back(regionp);
+ mActiveRegionList.push_back(regionp);
+ mCulledRegionList.push_back(regionp);
+
+
+ // Find all the adjacent regions, and attach them.
+ // Generate handles for all of the adjacent regions, and attach them in the correct way.
+ // connect the edges
+ F32 adj_x = 0.f;
+ F32 adj_y = 0.f;
+ F32 region_x = 0.f;
+ F32 region_y = 0.f;
+ U64 adj_handle = 0;
+
+ F32 width = getRegionWidthInMeters();
+
+ LLViewerRegion *neighborp;
+ from_region_handle(region_handle, &region_x, &region_y);
+
+ // Iterate through all directions, and connect neighbors if there.
+ S32 dir;
+ for (dir = 0; dir < 8; dir++)
+ {
+ adj_x = region_x + width * gDirAxes[dir][0];
+ adj_y = region_y + width * gDirAxes[dir][1];
+ to_region_handle(adj_x, adj_y, &adj_handle);
+
+ neighborp = getRegionFromHandle(adj_handle);
+ if (neighborp)
+ {
+ //LL_INFOS() << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << LL_ENDL;
+ regionp->connectNeighbor(neighborp, dir);
+ }
+ }
+
+ updateWaterObjects();
+
+ return regionp;
}
void LLWorld::removeRegion(const LLHost &host)
{
- F32 x, y;
-
- LLViewerRegion *regionp = getRegion(host);
- if (!regionp)
- {
- LL_WARNS() << "Trying to remove region that doesn't exist!" << LL_ENDL;
- return;
- }
-
- if (regionp == gAgent.getRegion())
- {
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* reg = *iter;
- LL_WARNS() << "RegionDump: " << reg->getName()
- << " " << reg->getHost()
- << " " << reg->getOriginGlobal()
- << LL_ENDL;
- }
-
- LL_WARNS() << "Agent position global " << gAgent.getPositionGlobal()
- << " agent " << gAgent.getPositionAgent()
- << LL_ENDL;
-
- LL_WARNS() << "Regions visited " << gAgent.getRegionsVisited() << LL_ENDL;
-
- LL_WARNS() << "gFrameTimeSeconds " << gFrameTimeSeconds << LL_ENDL;
-
- LL_WARNS() << "Disabling region " << regionp->getName() << " that agent is in!" << LL_ENDL;
- LLAppViewer::instance()->forceDisconnect(LLTrans::getString("YouHaveBeenDisconnected"));
-
- regionp->saveObjectCache() ; //force to save objects here in case that the object cache is about to be destroyed.
- return;
- }
-
- from_region_handle(regionp->getHandle(), &x, &y);
- LL_INFOS() << "Removing region " << x << ":" << y << LL_ENDL;
-
- mRegionList.remove(regionp);
- mActiveRegionList.remove(regionp);
- mCulledRegionList.remove(regionp);
- mVisibleRegionList.remove(regionp);
-
- mRegionRemovedSignal(regionp);
-
- updateWaterObjects();
-
- //double check all objects of this region are removed.
- gObjectList.clearAllMapObjectsInRegion(regionp) ;
- //llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ;
-
- delete regionp; // Delete last to prevent use after free
+ F32 x, y;
+
+ LLViewerRegion *regionp = getRegion(host);
+ if (!regionp)
+ {
+ LL_WARNS() << "Trying to remove region that doesn't exist!" << LL_ENDL;
+ return;
+ }
+
+ if (regionp == gAgent.getRegion())
+ {
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* reg = *iter;
+ LL_WARNS() << "RegionDump: " << reg->getName()
+ << " " << reg->getHost()
+ << " " << reg->getOriginGlobal()
+ << LL_ENDL;
+ }
+
+ LL_WARNS() << "Agent position global " << gAgent.getPositionGlobal()
+ << " agent " << gAgent.getPositionAgent()
+ << LL_ENDL;
+
+ LL_WARNS() << "Regions visited " << gAgent.getRegionsVisited() << LL_ENDL;
+
+ LL_WARNS() << "gFrameTimeSeconds " << gFrameTimeSeconds << LL_ENDL;
+
+ LL_WARNS() << "Disabling region " << regionp->getName() << " that agent is in!" << LL_ENDL;
+ LLAppViewer::instance()->forceDisconnect(LLTrans::getString("YouHaveBeenDisconnected"));
+
+ regionp->saveObjectCache() ; //force to save objects here in case that the object cache is about to be destroyed.
+ return;
+ }
+
+ from_region_handle(regionp->getHandle(), &x, &y);
+ LL_INFOS() << "Removing region " << x << ":" << y << LL_ENDL;
+
+ mRegionList.remove(regionp);
+ mActiveRegionList.remove(regionp);
+ mCulledRegionList.remove(regionp);
+ mVisibleRegionList.remove(regionp);
+
+ mRegionRemovedSignal(regionp);
+
+ updateWaterObjects();
+
+ //double check all objects of this region are removed.
+ gObjectList.clearAllMapObjectsInRegion(regionp) ;
+ //llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ;
+
+ delete regionp; // Delete last to prevent use after free
}
LLViewerRegion* LLWorld::getRegion(const LLHost &host)
{
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if (regionp->getHost() == host)
- {
- return regionp;
- }
- }
- return NULL;
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if (regionp->getHost() == host)
+ {
+ return regionp;
+ }
+ }
+ return NULL;
}
LLViewerRegion* LLWorld::getRegionFromPosAgent(const LLVector3 &pos)
{
- return getRegionFromPosGlobal(gAgent.getPosGlobalFromAgent(pos));
+ return getRegionFromPosGlobal(gAgent.getPosGlobalFromAgent(pos));
}
LLViewerRegion* LLWorld::getRegionFromPosGlobal(const LLVector3d &pos)
{
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if (regionp->pointInRegionGlobal(pos))
- {
- return regionp;
- }
- }
- return NULL;
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if (regionp->pointInRegionGlobal(pos))
+ {
+ return regionp;
+ }
+ }
+ return NULL;
}
-LLVector3d LLWorld::clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos)
+LLVector3d LLWorld::clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos)
{
- if (positionRegionValidGlobal(end_pos))
- {
- return end_pos;
- }
-
- LLViewerRegion* regionp = getRegionFromPosGlobal(start_pos);
- if (!regionp)
- {
- return start_pos;
- }
-
- LLVector3d delta_pos = end_pos - start_pos;
- LLVector3d delta_pos_abs;
- delta_pos_abs.setVec(delta_pos);
- delta_pos_abs.abs();
-
- LLVector3 region_coord = regionp->getPosRegionFromGlobal(end_pos);
- F64 clip_factor = 1.0;
- F32 region_width = regionp->getWidth();
- if (region_coord.mV[VX] < 0.f)
- {
- if (region_coord.mV[VY] < region_coord.mV[VX])
- {
- // clip along y -
- clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
- }
- else
- {
- // clip along x -
- clip_factor = -(region_coord.mV[VX] / delta_pos_abs.mdV[VX]);
- }
- }
- else if (region_coord.mV[VX] > region_width)
- {
- if (region_coord.mV[VY] > region_coord.mV[VX])
- {
- // clip along y +
- clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
- }
- else
- {
- //clip along x +
- clip_factor = (region_coord.mV[VX] - region_width) / delta_pos_abs.mdV[VX];
- }
- }
- else if (region_coord.mV[VY] < 0.f)
- {
- // clip along y -
- clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
- }
- else if (region_coord.mV[VY] > region_width)
- {
- // clip along y +
- clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
- }
-
- // clamp to within region dimensions
- LLVector3d final_region_pos = LLVector3d(region_coord) - (delta_pos * clip_factor);
- final_region_pos.mdV[VX] = llclamp(final_region_pos.mdV[VX], 0.0,
- (F64)(region_width - F_ALMOST_ZERO));
- final_region_pos.mdV[VY] = llclamp(final_region_pos.mdV[VY], 0.0,
- (F64)(region_width - F_ALMOST_ZERO));
- final_region_pos.mdV[VZ] = llclamp(final_region_pos.mdV[VZ], 0.0,
- (F64)(LLWorld::getInstance()->getRegionMaxHeight() - F_ALMOST_ZERO));
- return regionp->getPosGlobalFromRegion(LLVector3(final_region_pos));
+ if (positionRegionValidGlobal(end_pos))
+ {
+ return end_pos;
+ }
+
+ LLViewerRegion* regionp = getRegionFromPosGlobal(start_pos);
+ if (!regionp)
+ {
+ return start_pos;
+ }
+
+ LLVector3d delta_pos = end_pos - start_pos;
+ LLVector3d delta_pos_abs;
+ delta_pos_abs.setVec(delta_pos);
+ delta_pos_abs.abs();
+
+ LLVector3 region_coord = regionp->getPosRegionFromGlobal(end_pos);
+ F64 clip_factor = 1.0;
+ F32 region_width = regionp->getWidth();
+ if (region_coord.mV[VX] < 0.f)
+ {
+ if (region_coord.mV[VY] < region_coord.mV[VX])
+ {
+ // clip along y -
+ clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
+ }
+ else
+ {
+ // clip along x -
+ clip_factor = -(region_coord.mV[VX] / delta_pos_abs.mdV[VX]);
+ }
+ }
+ else if (region_coord.mV[VX] > region_width)
+ {
+ if (region_coord.mV[VY] > region_coord.mV[VX])
+ {
+ // clip along y +
+ clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
+ }
+ else
+ {
+ //clip along x +
+ clip_factor = (region_coord.mV[VX] - region_width) / delta_pos_abs.mdV[VX];
+ }
+ }
+ else if (region_coord.mV[VY] < 0.f)
+ {
+ // clip along y -
+ clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
+ }
+ else if (region_coord.mV[VY] > region_width)
+ {
+ // clip along y +
+ clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
+ }
+
+ // clamp to within region dimensions
+ LLVector3d final_region_pos = LLVector3d(region_coord) - (delta_pos * clip_factor);
+ final_region_pos.mdV[VX] = llclamp(final_region_pos.mdV[VX], 0.0,
+ (F64)(region_width - F_ALMOST_ZERO));
+ final_region_pos.mdV[VY] = llclamp(final_region_pos.mdV[VY], 0.0,
+ (F64)(region_width - F_ALMOST_ZERO));
+ final_region_pos.mdV[VZ] = llclamp(final_region_pos.mdV[VZ], 0.0,
+ (F64)(LLWorld::getInstance()->getRegionMaxHeight() - F_ALMOST_ZERO));
+ return regionp->getPosGlobalFromRegion(LLVector3(final_region_pos));
}
LLViewerRegion* LLWorld::getRegionFromHandle(const U64 &handle)
{
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if (regionp->getHandle() == handle)
- {
- return regionp;
- }
- }
- return NULL;
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if (regionp->getHandle() == handle)
+ {
+ return regionp;
+ }
+ }
+ return NULL;
}
LLViewerRegion* LLWorld::getRegionFromID(const LLUUID& region_id)
{
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if (regionp->getRegionID() == region_id)
- {
- return regionp;
- }
- }
- return NULL;
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if (regionp->getRegionID() == region_id)
+ {
+ return regionp;
+ }
+ }
+ return NULL;
}
void LLWorld::updateAgentOffset(const LLVector3d &offset_global)
{
#if 0
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- regionp->setAgentOffset(offset_global);
- }
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ regionp->setAgentOffset(offset_global);
+ }
#endif
}
BOOL LLWorld::positionRegionValidGlobal(const LLVector3d &pos_global)
{
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if (regionp->pointInRegionGlobal(pos_global))
- {
- return TRUE;
- }
- }
- return FALSE;
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if (regionp->pointInRegionGlobal(pos_global))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
// Allow objects to go up to their radius underground.
F32 LLWorld::getMinAllowedZ(LLViewerObject* object, const LLVector3d &global_pos)
{
- F32 land_height = resolveLandHeightGlobal(global_pos);
- F32 radius = 0.5f * object->getScale().length();
- return land_height - radius;
+ F32 land_height = resolveLandHeightGlobal(global_pos);
+ F32 radius = 0.5f * object->getScale().length();
+ return land_height - radius;
}
LLViewerRegion* LLWorld::resolveRegionGlobal(LLVector3 &pos_region, const LLVector3d &pos_global)
{
- LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
+ LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
- if (regionp)
- {
- pos_region = regionp->getPosRegionFromGlobal(pos_global);
- return regionp;
- }
+ if (regionp)
+ {
+ pos_region = regionp->getPosRegionFromGlobal(pos_global);
+ return regionp;
+ }
- return NULL;
+ return NULL;
}
LLViewerRegion* LLWorld::resolveRegionAgent(LLVector3 &pos_region, const LLVector3 &pos_agent)
{
- LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
- LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
+ LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
+ LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
- if (regionp)
- {
- pos_region = regionp->getPosRegionFromGlobal(pos_global);
- return regionp;
- }
+ if (regionp)
+ {
+ pos_region = regionp->getPosRegionFromGlobal(pos_global);
+ return regionp;
+ }
- return NULL;
+ return NULL;
}
F32 LLWorld::resolveLandHeightAgent(const LLVector3 &pos_agent)
{
- LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
- return resolveLandHeightGlobal(pos_global);
+ LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
+ return resolveLandHeightGlobal(pos_global);
}
F32 LLWorld::resolveLandHeightGlobal(const LLVector3d &pos_global)
{
- LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
- if (regionp)
- {
- return regionp->getLand().resolveHeightGlobal(pos_global);
- }
- return 0.0f;
+ LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
+ if (regionp)
+ {
+ return regionp->getLand().resolveHeightGlobal(pos_global);
+ }
+ return 0.0f;
}
-// Takes a line defined by "point_a" and "point_b" and determines the closest (to point_a)
+// Takes a line defined by "point_a" and "point_b" and determines the closest (to point_a)
// point where the the line intersects an object or the land surface. Stores the results
// in "intersection" and "intersection_normal" and returns a scalar value that represents
// the normalized distance along the line from "point_a" to "intersection".
//
-// Currently assumes point_a and point_b only differ in z-direction,
+// Currently assumes point_a and point_b only differ in z-direction,
// but it may eventually become more general.
-F32 LLWorld::resolveStepHeightGlobal(const LLVOAvatar* avatarp, const LLVector3d &point_a, const LLVector3d &point_b,
- LLVector3d &intersection, LLVector3 &intersection_normal,
- LLViewerObject **viewerObjectPtr)
+F32 LLWorld::resolveStepHeightGlobal(const LLVOAvatar* avatarp, const LLVector3d &point_a, const LLVector3d &point_b,
+ LLVector3d &intersection, LLVector3 &intersection_normal,
+ LLViewerObject **viewerObjectPtr)
{
- // initialize return value to null
- if (viewerObjectPtr)
- {
- *viewerObjectPtr = NULL;
- }
-
- LLViewerRegion *regionp = getRegionFromPosGlobal(point_a);
- if (!regionp)
- {
- // We're outside the world
- intersection = 0.5f * (point_a + point_b);
- intersection_normal.setVec(0.0f, 0.0f, 1.0f);
- return 0.5f;
- }
-
- // calculate the length of the segment
- F32 segment_length = (F32)((point_a - point_b).length());
- if (0.0f == segment_length)
- {
- intersection = point_a;
- intersection_normal.setVec(0.0f, 0.0f, 1.0f);
- return segment_length;
- }
-
- // get land height
- // Note: we assume that the line is parallel to z-axis here
- LLVector3d land_intersection = point_a;
- F32 normalized_land_distance;
-
- land_intersection.mdV[VZ] = regionp->getLand().resolveHeightGlobal(point_a);
- normalized_land_distance = (F32)(point_a.mdV[VZ] - land_intersection.mdV[VZ]) / segment_length;
- intersection = land_intersection;
- intersection_normal = resolveLandNormalGlobal(land_intersection);
-
- if (avatarp && !avatarp->mFootPlane.isExactlyClear())
- {
- LLVector3 foot_plane_normal(avatarp->mFootPlane.mV);
- LLVector3 start_pt = avatarp->getRegion()->getPosRegionFromGlobal(point_a);
- // added 0.05 meters to compensate for error in foot plane reported by Havok
- F32 norm_dist_from_plane = ((start_pt * foot_plane_normal) - avatarp->mFootPlane.mV[VW]) + 0.05f;
- norm_dist_from_plane = llclamp(norm_dist_from_plane / segment_length, 0.f, 1.f);
- if (norm_dist_from_plane < normalized_land_distance)
- {
- // collided with object before land
- normalized_land_distance = norm_dist_from_plane;
- intersection = point_a;
- intersection.mdV[VZ] -= norm_dist_from_plane * segment_length;
- intersection_normal = foot_plane_normal;
- }
- else
- {
- intersection = land_intersection;
- intersection_normal = resolveLandNormalGlobal(land_intersection);
- }
- }
-
- return normalized_land_distance;
+ // initialize return value to null
+ if (viewerObjectPtr)
+ {
+ *viewerObjectPtr = NULL;
+ }
+
+ LLViewerRegion *regionp = getRegionFromPosGlobal(point_a);
+ if (!regionp)
+ {
+ // We're outside the world
+ intersection = 0.5f * (point_a + point_b);
+ intersection_normal.setVec(0.0f, 0.0f, 1.0f);
+ return 0.5f;
+ }
+
+ // calculate the length of the segment
+ F32 segment_length = (F32)((point_a - point_b).length());
+ if (0.0f == segment_length)
+ {
+ intersection = point_a;
+ intersection_normal.setVec(0.0f, 0.0f, 1.0f);
+ return segment_length;
+ }
+
+ // get land height
+ // Note: we assume that the line is parallel to z-axis here
+ LLVector3d land_intersection = point_a;
+ F32 normalized_land_distance;
+
+ land_intersection.mdV[VZ] = regionp->getLand().resolveHeightGlobal(point_a);
+ normalized_land_distance = (F32)(point_a.mdV[VZ] - land_intersection.mdV[VZ]) / segment_length;
+ intersection = land_intersection;
+ intersection_normal = resolveLandNormalGlobal(land_intersection);
+
+ if (avatarp && !avatarp->mFootPlane.isExactlyClear())
+ {
+ LLVector3 foot_plane_normal(avatarp->mFootPlane.mV);
+ LLVector3 start_pt = avatarp->getRegion()->getPosRegionFromGlobal(point_a);
+ // added 0.05 meters to compensate for error in foot plane reported by Havok
+ F32 norm_dist_from_plane = ((start_pt * foot_plane_normal) - avatarp->mFootPlane.mV[VW]) + 0.05f;
+ norm_dist_from_plane = llclamp(norm_dist_from_plane / segment_length, 0.f, 1.f);
+ if (norm_dist_from_plane < normalized_land_distance)
+ {
+ // collided with object before land
+ normalized_land_distance = norm_dist_from_plane;
+ intersection = point_a;
+ intersection.mdV[VZ] -= norm_dist_from_plane * segment_length;
+ intersection_normal = foot_plane_normal;
+ }
+ else
+ {
+ intersection = land_intersection;
+ intersection_normal = resolveLandNormalGlobal(land_intersection);
+ }
+ }
+
+ return normalized_land_distance;
}
LLSurfacePatch * LLWorld::resolveLandPatchGlobal(const LLVector3d &pos_global)
{
- // returns a pointer to the patch at this location
- LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
- if (!regionp)
- {
- return NULL;
- }
-
- return regionp->getLand().resolvePatchGlobal(pos_global);
+ // returns a pointer to the patch at this location
+ LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
+ if (!regionp)
+ {
+ return NULL;
+ }
+
+ return regionp->getLand().resolvePatchGlobal(pos_global);
}
LLVector3 LLWorld::resolveLandNormalGlobal(const LLVector3d &pos_global)
{
- LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
- if (!regionp)
- {
- return LLVector3::z_axis;
- }
+ LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global);
+ if (!regionp)
+ {
+ return LLVector3::z_axis;
+ }
- return regionp->getLand().resolveNormalGlobal(pos_global);
+ return regionp->getLand().resolveNormalGlobal(pos_global);
}
void LLWorld::updateVisibilities()
{
- F32 cur_far_clip = LLViewerCamera::getInstance()->getFar();
-
- // Go through the culled list and check for visible regions (region is visible if land is visible)
- for (region_list_t::iterator iter = mCulledRegionList.begin();
- iter != mCulledRegionList.end(); )
- {
- region_list_t::iterator curiter = iter++;
- LLViewerRegion* regionp = *curiter;
-
- LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
- if (part)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
- const LLVector4a* bounds = group->getBounds();
- if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1]))
- {
- mCulledRegionList.erase(curiter);
- mVisibleRegionList.push_back(regionp);
- }
- }
- }
-
- // Update all of the visible regions
- for (region_list_t::iterator iter = mVisibleRegionList.begin();
- iter != mVisibleRegionList.end(); )
- {
- region_list_t::iterator curiter = iter++;
- LLViewerRegion* regionp = *curiter;
- if (!regionp->getLand().hasZData())
- {
- continue;
- }
-
- LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
- if (part)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
- const LLVector4a* bounds = group->getBounds();
- if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1]))
- {
- regionp->calculateCameraDistance();
- regionp->getLand().updatePatchVisibilities(gAgent);
- }
- else
- {
- mVisibleRegionList.erase(curiter);
- mCulledRegionList.push_back(regionp);
- }
- }
- }
-
- // Sort visible regions
- mVisibleRegionList.sort(LLViewerRegion::CompareDistance());
-
- LLViewerCamera::getInstance()->setFar(cur_far_clip);
+ F32 cur_far_clip = LLViewerCamera::getInstance()->getFar();
+
+ // Go through the culled list and check for visible regions (region is visible if land is visible)
+ for (region_list_t::iterator iter = mCulledRegionList.begin();
+ iter != mCulledRegionList.end(); )
+ {
+ region_list_t::iterator curiter = iter++;
+ LLViewerRegion* regionp = *curiter;
+
+ LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
+ if (part)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
+ const LLVector4a* bounds = group->getBounds();
+ if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1]))
+ {
+ mCulledRegionList.erase(curiter);
+ mVisibleRegionList.push_back(regionp);
+ }
+ }
+ }
+
+ // Update all of the visible regions
+ for (region_list_t::iterator iter = mVisibleRegionList.begin();
+ iter != mVisibleRegionList.end(); )
+ {
+ region_list_t::iterator curiter = iter++;
+ LLViewerRegion* regionp = *curiter;
+ if (!regionp->getLand().hasZData())
+ {
+ continue;
+ }
+
+ LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
+ if (part)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
+ const LLVector4a* bounds = group->getBounds();
+ if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1]))
+ {
+ regionp->calculateCameraDistance();
+ regionp->getLand().updatePatchVisibilities(gAgent);
+ }
+ else
+ {
+ mVisibleRegionList.erase(curiter);
+ mCulledRegionList.push_back(regionp);
+ }
+ }
+ }
+
+ // Sort visible regions
+ mVisibleRegionList.sort(LLViewerRegion::CompareDistance());
+
+ LLViewerCamera::getInstance()->setFar(cur_far_clip);
}
static LLTrace::SampleStatHandle<> sNumActiveCachedObjects("numactivecachedobjects", "Number of objects loaded from cache");
@@ -682,205 +682,205 @@ static LLTrace::SampleStatHandle<> sNumActiveCachedObjects("numactivecachedobjec
void LLWorld::updateRegions(F32 max_update_time)
{
LL_PROFILE_ZONE_SCOPED;
- LLTimer update_timer;
- mNumOfActiveCachedObjects = 0;
-
- if(LLViewerCamera::getInstance()->isChanged())
- {
- LLViewerRegion::sLastCameraUpdated = LLViewerOctreeEntryData::getCurrentFrame() + 1;
- }
- LLViewerRegion::calcNewObjectCreationThrottle();
- if(LLViewerRegion::isNewObjectCreationThrottleDisabled())
- {
- max_update_time = llmax(max_update_time, 1.0f); //seconds, loosen the time throttle.
- }
-
- F32 max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f);
- //update the self avatar region
- LLViewerRegion* self_regionp = gAgent.getRegion();
- if(self_regionp)
- {
- self_regionp->idleUpdate(max_time);
- }
-
- //sort regions by its mLastUpdate
- //smaller mLastUpdate first to make sure every region has chance to get updated.
- LLViewerRegion::region_priority_list_t region_list;
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if(regionp != self_regionp)
- {
- region_list.insert(regionp);
- }
- mNumOfActiveCachedObjects += regionp->getNumOfActiveCachedObjects();
- }
-
- // Perform idle time updates for the regions (and associated surfaces)
- for (LLViewerRegion::region_priority_list_t::iterator iter = region_list.begin();
- iter != region_list.end(); ++iter)
- {
- if(max_time > 0.f)
- {
- max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f);
- }
-
- if(max_time > 0.f)
- {
- (*iter)->idleUpdate(max_time);
- }
- else
- {
- //perform some necessary but very light updates.
- (*iter)->lightIdleUpdate();
- }
- }
-
- if(max_time > 0.f)
- {
- max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f);
- }
- if(max_time > 0.f)
- {
- LLViewerRegion::idleCleanup(max_time);
- }
-
- sample(sNumActiveCachedObjects, mNumOfActiveCachedObjects);
+ LLTimer update_timer;
+ mNumOfActiveCachedObjects = 0;
+
+ if(LLViewerCamera::getInstance()->isChanged())
+ {
+ LLViewerRegion::sLastCameraUpdated = LLViewerOctreeEntryData::getCurrentFrame() + 1;
+ }
+ LLViewerRegion::calcNewObjectCreationThrottle();
+ if(LLViewerRegion::isNewObjectCreationThrottleDisabled())
+ {
+ max_update_time = llmax(max_update_time, 1.0f); //seconds, loosen the time throttle.
+ }
+
+ F32 max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f);
+ //update the self avatar region
+ LLViewerRegion* self_regionp = gAgent.getRegion();
+ if(self_regionp)
+ {
+ self_regionp->idleUpdate(max_time);
+ }
+
+ //sort regions by its mLastUpdate
+ //smaller mLastUpdate first to make sure every region has chance to get updated.
+ LLViewerRegion::region_priority_list_t region_list;
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if(regionp != self_regionp)
+ {
+ region_list.insert(regionp);
+ }
+ mNumOfActiveCachedObjects += regionp->getNumOfActiveCachedObjects();
+ }
+
+ // Perform idle time updates for the regions (and associated surfaces)
+ for (LLViewerRegion::region_priority_list_t::iterator iter = region_list.begin();
+ iter != region_list.end(); ++iter)
+ {
+ if(max_time > 0.f)
+ {
+ max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f);
+ }
+
+ if(max_time > 0.f)
+ {
+ (*iter)->idleUpdate(max_time);
+ }
+ else
+ {
+ //perform some necessary but very light updates.
+ (*iter)->lightIdleUpdate();
+ }
+ }
+
+ if(max_time > 0.f)
+ {
+ max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f);
+ }
+ if(max_time > 0.f)
+ {
+ LLViewerRegion::idleCleanup(max_time);
+ }
+
+ sample(sNumActiveCachedObjects, mNumOfActiveCachedObjects);
}
void LLWorld::clearAllVisibleObjects()
{
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- //clear all cached visible objects.
- (*iter)->clearCachedVisibleObjects();
- }
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ //clear all cached visible objects.
+ (*iter)->clearCachedVisibleObjects();
+ }
clearHoleWaterObjects();
clearEdgeWaterObjects();
}
void LLWorld::updateParticles()
{
- LLViewerPartSim::getInstance()->updateSimulation();
+ LLViewerPartSim::getInstance()->updateSimulation();
}
void LLWorld::renderPropertyLines()
{
- for (region_list_t::iterator iter = mVisibleRegionList.begin();
- iter != mVisibleRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- regionp->renderPropertyLines();
- }
+ for (region_list_t::iterator iter = mVisibleRegionList.begin();
+ iter != mVisibleRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ regionp->renderPropertyLines();
+ }
}
void LLWorld::updateNetStats()
{
- F64Bits bits;
-
- for (region_list_t::iterator iter = mActiveRegionList.begin();
- iter != mActiveRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- regionp->updateNetStats();
- bits += regionp->mBitsReceived;
- regionp->mBitsReceived = (F32Bits)0.f;
- regionp->mPacketsReceived = 0.f;
- }
-
- S32 packets_in = gMessageSystem->mPacketsIn - mLastPacketsIn;
- S32 packets_out = gMessageSystem->mPacketsOut - mLastPacketsOut;
- S32 packets_lost = gMessageSystem->mDroppedPackets - mLastPacketsLost;
-
- F64Bits actual_in_bits(gMessageSystem->mPacketRing.getAndResetActualInBits());
- F64Bits actual_out_bits(gMessageSystem->mPacketRing.getAndResetActualOutBits());
-
- add(LLStatViewer::MESSAGE_SYSTEM_DATA_IN, actual_in_bits);
- add(LLStatViewer::MESSAGE_SYSTEM_DATA_OUT, actual_out_bits);
- add(LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED, bits);
- add(LLStatViewer::PACKETS_IN, packets_in);
- add(LLStatViewer::PACKETS_OUT, packets_out);
- add(LLStatViewer::PACKETS_LOST, packets_lost);
-
- F32 total_packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
- if (total_packets_in > 0)
- {
- F32 total_packets_lost = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_LOST);
- sample(LLStatViewer::PACKETS_LOST_PERCENT, LLUnits::Ratio::fromValue((F32)total_packets_lost/(F32)total_packets_in));
- }
-
- mLastPacketsIn = gMessageSystem->mPacketsIn;
- mLastPacketsOut = gMessageSystem->mPacketsOut;
- mLastPacketsLost = gMessageSystem->mDroppedPackets;
+ F64Bits bits;
+
+ for (region_list_t::iterator iter = mActiveRegionList.begin();
+ iter != mActiveRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ regionp->updateNetStats();
+ bits += regionp->mBitsReceived;
+ regionp->mBitsReceived = (F32Bits)0.f;
+ regionp->mPacketsReceived = 0.f;
+ }
+
+ S32 packets_in = gMessageSystem->mPacketsIn - mLastPacketsIn;
+ S32 packets_out = gMessageSystem->mPacketsOut - mLastPacketsOut;
+ S32 packets_lost = gMessageSystem->mDroppedPackets - mLastPacketsLost;
+
+ F64Bits actual_in_bits(gMessageSystem->mPacketRing.getAndResetActualInBits());
+ F64Bits actual_out_bits(gMessageSystem->mPacketRing.getAndResetActualOutBits());
+
+ add(LLStatViewer::MESSAGE_SYSTEM_DATA_IN, actual_in_bits);
+ add(LLStatViewer::MESSAGE_SYSTEM_DATA_OUT, actual_out_bits);
+ add(LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED, bits);
+ add(LLStatViewer::PACKETS_IN, packets_in);
+ add(LLStatViewer::PACKETS_OUT, packets_out);
+ add(LLStatViewer::PACKETS_LOST, packets_lost);
+
+ F32 total_packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
+ if (total_packets_in > 0)
+ {
+ F32 total_packets_lost = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_LOST);
+ sample(LLStatViewer::PACKETS_LOST_PERCENT, LLUnits::Ratio::fromValue((F32)total_packets_lost/(F32)total_packets_in));
+ }
+
+ mLastPacketsIn = gMessageSystem->mPacketsIn;
+ mLastPacketsOut = gMessageSystem->mPacketsOut;
+ mLastPacketsLost = gMessageSystem->mDroppedPackets;
}
void LLWorld::printPacketsLost()
{
- LL_INFOS() << "Simulators:" << LL_ENDL;
- LL_INFOS() << "----------" << LL_ENDL;
-
- LLCircuitData *cdp = NULL;
- for (region_list_t::iterator iter = mActiveRegionList.begin();
- iter != mActiveRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- cdp = gMessageSystem->mCircuitInfo.findCircuit(regionp->getHost());
- if (cdp)
- {
- LLVector3d range = regionp->getCenterGlobal() - gAgent.getPositionGlobal();
-
- LL_INFOS() << regionp->getHost() << ", range: " << range.length()
- << " packets lost: " << cdp->getPacketsLost() << LL_ENDL;
- }
- }
+ LL_INFOS() << "Simulators:" << LL_ENDL;
+ LL_INFOS() << "----------" << LL_ENDL;
+
+ LLCircuitData *cdp = NULL;
+ for (region_list_t::iterator iter = mActiveRegionList.begin();
+ iter != mActiveRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ cdp = gMessageSystem->mCircuitInfo.findCircuit(regionp->getHost());
+ if (cdp)
+ {
+ LLVector3d range = regionp->getCenterGlobal() - gAgent.getPositionGlobal();
+
+ LL_INFOS() << regionp->getHost() << ", range: " << range.length()
+ << " packets lost: " << cdp->getPacketsLost() << LL_ENDL;
+ }
+ }
}
void LLWorld::processCoarseUpdate(LLMessageSystem* msg, void** user_data)
{
- LLViewerRegion* region = LLWorld::getInstance()->getRegion(msg->getSender());
- if( region )
- {
- region->updateCoarseLocations(msg);
- }
+ LLViewerRegion* region = LLWorld::getInstance()->getRegion(msg->getSender());
+ if( region )
+ {
+ region->updateCoarseLocations(msg);
+ }
}
F32 LLWorld::getLandFarClip() const
{
- return mLandFarClip;
+ return mLandFarClip;
}
void LLWorld::setLandFarClip(const F32 far_clip)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
- static S32 const rwidth = (S32)REGION_WIDTH_U32;
- S32 const n1 = (llceil(mLandFarClip) - 1) / rwidth;
- S32 const n2 = (llceil(far_clip) - 1) / rwidth;
- bool need_water_objects_update = n1 != n2;
+ static S32 const rwidth = (S32)REGION_WIDTH_U32;
+ S32 const n1 = (llceil(mLandFarClip) - 1) / rwidth;
+ S32 const n2 = (llceil(far_clip) - 1) / rwidth;
+ bool need_water_objects_update = n1 != n2;
- mLandFarClip = far_clip;
+ mLandFarClip = far_clip;
- if (need_water_objects_update)
- {
- updateWaterObjects();
- }
+ if (need_water_objects_update)
+ {
+ updateWaterObjects();
+ }
}
// Some region that we're connected to, but not the one we're in, gave us
// a (possibly) new water height. Update it in our local copy.
void LLWorld::waterHeightRegionInfo(std::string const& sim_name, F32 water_height)
{
- for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter)
- {
- if ((*iter)->getName() == sim_name)
- {
- (*iter)->setWaterHeight(water_height);
- break;
- }
- }
+ for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter)
+ {
+ if ((*iter)->getName() == sim_name)
+ {
+ (*iter)->setWaterHeight(water_height);
+ break;
+ }
+ }
}
void LLWorld::clearHoleWaterObjects()
@@ -905,258 +905,258 @@ void LLWorld::clearEdgeWaterObjects()
void LLWorld::updateWaterObjects()
{
- if (!gAgent.getRegion())
- {
- return;
- }
- if (mRegionList.empty())
- {
- LL_WARNS() << "No regions!" << LL_ENDL;
- return;
- }
-
- // First, determine the min and max "box" of water objects
- S32 min_x = 0;
- S32 min_y = 0;
- S32 max_x = 0;
- S32 max_y = 0;
- U32 region_x, region_y;
-
- S32 rwidth = 256;
-
- // We only want to fill in water for stuff that's near us, say, within 256 or 512m
- S32 range = LLViewerCamera::getInstance()->getFar() > 256.f ? 512 : 256;
-
- LLViewerRegion* regionp = gAgent.getRegion();
- from_region_handle(regionp->getHandle(), &region_x, &region_y);
-
- min_x = (S32)region_x - range;
- min_y = (S32)region_y - range;
- max_x = (S32)region_x + range;
- max_y = (S32)region_y + range;
-
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- LLVOWater* waterp = regionp->getLand().getWaterObj();
- if (waterp)
- {
- gObjectList.updateActive(waterp);
- }
- }
+ if (!gAgent.getRegion())
+ {
+ return;
+ }
+ if (mRegionList.empty())
+ {
+ LL_WARNS() << "No regions!" << LL_ENDL;
+ return;
+ }
+
+ // First, determine the min and max "box" of water objects
+ S32 min_x = 0;
+ S32 min_y = 0;
+ S32 max_x = 0;
+ S32 max_y = 0;
+ U32 region_x, region_y;
+
+ S32 rwidth = 256;
+
+ // We only want to fill in water for stuff that's near us, say, within 256 or 512m
+ S32 range = LLViewerCamera::getInstance()->getFar() > 256.f ? 512 : 256;
+
+ LLViewerRegion* regionp = gAgent.getRegion();
+ from_region_handle(regionp->getHandle(), &region_x, &region_y);
+
+ min_x = (S32)region_x - range;
+ min_y = (S32)region_y - range;
+ max_x = (S32)region_x + range;
+ max_y = (S32)region_y + range;
+
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ LLVOWater* waterp = regionp->getLand().getWaterObj();
+ if (waterp)
+ {
+ gObjectList.updateActive(waterp);
+ }
+ }
clearHoleWaterObjects();
- // Use the water height of the region we're on for areas where there is no region
- F32 water_height = gAgent.getRegion()->getWaterHeight();
-
- // Now, get a list of the holes
- S32 x, y;
- for (x = min_x; x <= max_x; x += rwidth)
- {
- for (y = min_y; y <= max_y; y += rwidth)
- {
- U64 region_handle = to_region_handle(x, y);
- if (!getRegionFromHandle(region_handle))
- { // No region at that area, so make water
- LLVOWater* waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion());
- waterp->setUseTexture(FALSE);
- waterp->setPositionGlobal(LLVector3d(x + rwidth/2,
- y + rwidth/2,
- 256.f + water_height));
- waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f));
- gPipeline.createObject(waterp);
- mHoleWaterObjects.push_back(waterp);
- }
- }
- }
-
- // Update edge water objects
- S32 wx, wy;
- S32 center_x, center_y;
- wx = (max_x - min_x) + rwidth;
- wy = (max_y - min_y) + rwidth;
- center_x = min_x + (wx >> 1);
- center_y = min_y + (wy >> 1);
-
- S32 add_boundary[4] = {
- (S32)(512 - (max_x - region_x)),
- (S32)(512 - (max_y - region_y)),
- (S32)(512 - (region_x - min_x)),
- (S32)(512 - (region_y - min_y)) };
-
- S32 dir;
- for (dir = 0; dir < EDGE_WATER_OBJECTS_COUNT; dir++)
- {
- S32 dim[2] = { 0 };
- switch (gDirAxes[dir][0])
- {
- case -1: dim[0] = add_boundary[2]; break;
- case 0: dim[0] = wx; break;
- default: dim[0] = add_boundary[0]; break;
- }
- switch (gDirAxes[dir][1])
- {
- case -1: dim[1] = add_boundary[3]; break;
- case 0: dim[1] = wy; break;
- default: dim[1] = add_boundary[1]; break;
- }
-
- // Resize and reshape the water objects
- const S32 water_center_x = center_x + ll_round((wx + dim[0]) * 0.5f * gDirAxes[dir][0]);
- const S32 water_center_y = center_y + ll_round((wy + dim[1]) * 0.5f * gDirAxes[dir][1]);
-
- LLVOWater* waterp = mEdgeWaterObjects[dir];
- if (!waterp || waterp->isDead())
- {
- // The edge water objects can be dead because they're attached to the region that the
- // agent was in when they were originally created.
- mEdgeWaterObjects[dir] = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_VOID_WATER,
- gAgent.getRegion());
- waterp = mEdgeWaterObjects[dir];
- waterp->setUseTexture(FALSE);
- waterp->setIsEdgePatch(TRUE);
- gPipeline.createObject(waterp);
- }
-
- waterp->setRegion(gAgent.getRegion());
- LLVector3d water_pos(water_center_x, water_center_y, 256.f + water_height) ;
- LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f);
-
- //stretch out to horizon
- water_scale.mV[0] += fabsf(2048.f * gDirAxes[dir][0]);
- water_scale.mV[1] += fabsf(2048.f * gDirAxes[dir][1]);
-
- water_pos.mdV[0] += 1024.f * gDirAxes[dir][0];
- water_pos.mdV[1] += 1024.f * gDirAxes[dir][1];
-
- waterp->setPositionGlobal(water_pos);
- waterp->setScale(water_scale);
-
- gObjectList.updateActive(waterp);
- }
+ // Use the water height of the region we're on for areas where there is no region
+ F32 water_height = gAgent.getRegion()->getWaterHeight();
+
+ // Now, get a list of the holes
+ S32 x, y;
+ for (x = min_x; x <= max_x; x += rwidth)
+ {
+ for (y = min_y; y <= max_y; y += rwidth)
+ {
+ U64 region_handle = to_region_handle(x, y);
+ if (!getRegionFromHandle(region_handle))
+ { // No region at that area, so make water
+ LLVOWater* waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion());
+ waterp->setUseTexture(FALSE);
+ waterp->setPositionGlobal(LLVector3d(x + rwidth/2,
+ y + rwidth/2,
+ 256.f + water_height));
+ waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f));
+ gPipeline.createObject(waterp);
+ mHoleWaterObjects.push_back(waterp);
+ }
+ }
+ }
+
+ // Update edge water objects
+ S32 wx, wy;
+ S32 center_x, center_y;
+ wx = (max_x - min_x) + rwidth;
+ wy = (max_y - min_y) + rwidth;
+ center_x = min_x + (wx >> 1);
+ center_y = min_y + (wy >> 1);
+
+ S32 add_boundary[4] = {
+ (S32)(512 - (max_x - region_x)),
+ (S32)(512 - (max_y - region_y)),
+ (S32)(512 - (region_x - min_x)),
+ (S32)(512 - (region_y - min_y)) };
+
+ S32 dir;
+ for (dir = 0; dir < EDGE_WATER_OBJECTS_COUNT; dir++)
+ {
+ S32 dim[2] = { 0 };
+ switch (gDirAxes[dir][0])
+ {
+ case -1: dim[0] = add_boundary[2]; break;
+ case 0: dim[0] = wx; break;
+ default: dim[0] = add_boundary[0]; break;
+ }
+ switch (gDirAxes[dir][1])
+ {
+ case -1: dim[1] = add_boundary[3]; break;
+ case 0: dim[1] = wy; break;
+ default: dim[1] = add_boundary[1]; break;
+ }
+
+ // Resize and reshape the water objects
+ const S32 water_center_x = center_x + ll_round((wx + dim[0]) * 0.5f * gDirAxes[dir][0]);
+ const S32 water_center_y = center_y + ll_round((wy + dim[1]) * 0.5f * gDirAxes[dir][1]);
+
+ LLVOWater* waterp = mEdgeWaterObjects[dir];
+ if (!waterp || waterp->isDead())
+ {
+ // The edge water objects can be dead because they're attached to the region that the
+ // agent was in when they were originally created.
+ mEdgeWaterObjects[dir] = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_VOID_WATER,
+ gAgent.getRegion());
+ waterp = mEdgeWaterObjects[dir];
+ waterp->setUseTexture(FALSE);
+ waterp->setIsEdgePatch(TRUE);
+ gPipeline.createObject(waterp);
+ }
+
+ waterp->setRegion(gAgent.getRegion());
+ LLVector3d water_pos(water_center_x, water_center_y, 256.f + water_height) ;
+ LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f);
+
+ //stretch out to horizon
+ water_scale.mV[0] += fabsf(2048.f * gDirAxes[dir][0]);
+ water_scale.mV[1] += fabsf(2048.f * gDirAxes[dir][1]);
+
+ water_pos.mdV[0] += 1024.f * gDirAxes[dir][0];
+ water_pos.mdV[1] += 1024.f * gDirAxes[dir][1];
+
+ waterp->setPositionGlobal(water_pos);
+ waterp->setScale(water_scale);
+
+ gObjectList.updateActive(waterp);
+ }
}
void LLWorld::shiftRegions(const LLVector3& offset)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- for (region_list_t::const_iterator i = getRegionList().begin(); i != getRegionList().end(); ++i)
- {
- LLViewerRegion* region = *i;
- region->updateRenderMatrix();
- }
+ for (region_list_t::const_iterator i = getRegionList().begin(); i != getRegionList().end(); ++i)
+ {
+ LLViewerRegion* region = *i;
+ region->updateRenderMatrix();
+ }
- LLViewerPartSim::getInstance()->shift(offset);
+ LLViewerPartSim::getInstance()->shift(offset);
}
LLViewerTexture* LLWorld::getDefaultWaterTexture()
{
- return mDefaultWaterTexturep;
+ return mDefaultWaterTexturep;
}
void LLWorld::setSpaceTimeUSec(const U64MicrosecondsImplicit space_time_usec)
{
- mSpaceTimeUSec = space_time_usec;
+ mSpaceTimeUSec = space_time_usec;
}
U64MicrosecondsImplicit LLWorld::getSpaceTimeUSec() const
{
- return mSpaceTimeUSec;
+ return mSpaceTimeUSec;
}
void LLWorld::requestCacheMisses()
{
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- regionp->requestCacheMisses();
- }
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ regionp->requestCacheMisses();
+ }
}
void LLWorld::getInfo(LLSD& info)
{
- LLSD region_info;
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- regionp->getInfo(region_info);
- info["World"].append(region_info);
- }
+ LLSD region_info;
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ regionp->getInfo(region_info);
+ info["World"].append(region_info);
+ }
}
void LLWorld::disconnectRegions()
{
- LLMessageSystem* msg = gMessageSystem;
- for (region_list_t::iterator iter = mRegionList.begin();
- iter != mRegionList.end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- if (regionp == gAgent.getRegion())
- {
- // Skip the main agent
- continue;
- }
-
- LL_INFOS() << "Sending AgentQuitCopy to: " << regionp->getHost() << LL_ENDL;
- msg->newMessageFast(_PREHASH_AgentQuitCopy);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_FuseBlock);
- msg->addU32Fast(_PREHASH_ViewerCircuitCode, gMessageSystem->mOurCircuitCode);
- msg->sendMessage(regionp->getHost());
- }
+ LLMessageSystem* msg = gMessageSystem;
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ if (regionp == gAgent.getRegion())
+ {
+ // Skip the main agent
+ continue;
+ }
+
+ LL_INFOS() << "Sending AgentQuitCopy to: " << regionp->getHost() << LL_ENDL;
+ msg->newMessageFast(_PREHASH_AgentQuitCopy);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_FuseBlock);
+ msg->addU32Fast(_PREHASH_ViewerCircuitCode, gMessageSystem->mOurCircuitCode);
+ msg->sendMessage(regionp->getHost());
+ }
}
void process_enable_simulator(LLMessageSystem *msg, void **user_data)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
- // enable the appropriate circuit for this simulator and
- // add its values into the gSimulator structure
- U64 handle;
- U32 ip_u32;
- U16 port;
-
- msg->getU64Fast(_PREHASH_SimulatorInfo, _PREHASH_Handle, handle);
- msg->getIPAddrFast(_PREHASH_SimulatorInfo, _PREHASH_IP, ip_u32);
- msg->getIPPortFast(_PREHASH_SimulatorInfo, _PREHASH_Port, port);
-
- // which simulator should we modify?
- LLHost sim(ip_u32, port);
-
- // Viewer trusts the simulator.
- msg->enableCircuit(sim, TRUE);
- LLWorld::getInstance()->addRegion(handle, sim);
-
- // give the simulator a message it can use to get ip and port
- LL_INFOS() << "simulator_enable() Enabling " << sim << " with code " << msg->getOurCircuitCode() << LL_ENDL;
- msg->newMessageFast(_PREHASH_UseCircuitCode);
- msg->nextBlockFast(_PREHASH_CircuitCode);
- msg->addU32Fast(_PREHASH_Code, msg->getOurCircuitCode());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_ID, gAgent.getID());
- msg->sendReliable(sim);
+ // enable the appropriate circuit for this simulator and
+ // add its values into the gSimulator structure
+ U64 handle;
+ U32 ip_u32;
+ U16 port;
+
+ msg->getU64Fast(_PREHASH_SimulatorInfo, _PREHASH_Handle, handle);
+ msg->getIPAddrFast(_PREHASH_SimulatorInfo, _PREHASH_IP, ip_u32);
+ msg->getIPPortFast(_PREHASH_SimulatorInfo, _PREHASH_Port, port);
+
+ // which simulator should we modify?
+ LLHost sim(ip_u32, port);
+
+ // Viewer trusts the simulator.
+ msg->enableCircuit(sim, TRUE);
+ LLWorld::getInstance()->addRegion(handle, sim);
+
+ // give the simulator a message it can use to get ip and port
+ LL_INFOS() << "simulator_enable() Enabling " << sim << " with code " << msg->getOurCircuitCode() << LL_ENDL;
+ msg->newMessageFast(_PREHASH_UseCircuitCode);
+ msg->nextBlockFast(_PREHASH_CircuitCode);
+ msg->addU32Fast(_PREHASH_Code, msg->getOurCircuitCode());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addUUIDFast(_PREHASH_ID, gAgent.getID());
+ msg->sendReliable(sim);
}
class LLEstablishAgentCommunication : public LLHTTPNode
{
- LOG_CLASS(LLEstablishAgentCommunication);
+ LOG_CLASS(LLEstablishAgentCommunication);
public:
- virtual void describe(Description& desc) const
- {
- desc.shortInfo("seed capability info for a region");
- desc.postAPI();
- desc.input(
- "{ seed-capability: ..., sim-ip: ..., sim-port }");
- desc.source(__FILE__, __LINE__);
- }
-
- virtual void post(ResponsePtr response, const LLSD& context, const LLSD& input) const
- {
+ virtual void describe(Description& desc) const
+ {
+ desc.shortInfo("seed capability info for a region");
+ desc.postAPI();
+ desc.input(
+ "{ seed-capability: ..., sim-ip: ..., sim-port }");
+ desc.source(__FILE__, __LINE__);
+ }
+
+ virtual void post(ResponsePtr response, const LLSD& context, const LLSD& input) const
+ {
if (LLApp::isExiting())
{
return;
@@ -1172,13 +1172,13 @@ public:
return;
}
- if (!input["body"].has("agent-id") ||
- !input["body"].has("sim-ip-and-port") ||
- !input["body"].has("seed-capability"))
- {
- LL_WARNS() << "invalid parameters" << LL_ENDL;
+ if (!input["body"].has("agent-id") ||
+ !input["body"].has("sim-ip-and-port") ||
+ !input["body"].has("seed-capability"))
+ {
+ LL_WARNS() << "invalid parameters" << LL_ENDL;
return;
- }
+ }
LLHost sim(input["body"]["sim-ip-and-port"].asString());
if (sim.isInvalid())
@@ -1187,17 +1187,17 @@ public:
return;
}
- LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(sim);
- if (!regionp)
- {
- LL_WARNS() << "Got EstablishAgentCommunication for unknown region "
- << sim << LL_ENDL;
- return;
- }
- LL_DEBUGS("CrossingCaps") << "Calling setSeedCapability from LLEstablishAgentCommunication::post. Seed cap == "
- << input["body"]["seed-capability"] << " for region " << regionp->getRegionID() << LL_ENDL;
- regionp->setSeedCapability(input["body"]["seed-capability"]);
- }
+ LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(sim);
+ if (!regionp)
+ {
+ LL_WARNS() << "Got EstablishAgentCommunication for unknown region "
+ << sim << LL_ENDL;
+ return;
+ }
+ LL_DEBUGS("CrossingCaps") << "Calling setSeedCapability from LLEstablishAgentCommunication::post. Seed cap == "
+ << input["body"]["seed-capability"] << " for region " << regionp->getRegionID() << LL_ENDL;
+ regionp->setSeedCapability(input["body"]["seed-capability"]);
+ }
};
// disable the circuit to this simulator
@@ -1208,169 +1208,169 @@ void process_disable_simulator(LLMessageSystem *mesgsys, void **user_data)
LLHost host = mesgsys->getSender();
- //LL_INFOS() << "Disabling simulator with message from " << host << LL_ENDL;
- LLWorld::getInstance()->removeRegion(host);
+ //LL_INFOS() << "Disabling simulator with message from " << host << LL_ENDL;
+ LLWorld::getInstance()->removeRegion(host);
- mesgsys->disableCircuit(host);
+ mesgsys->disableCircuit(host);
}
void process_region_handshake(LLMessageSystem* msg, void** user_data)
{
- LLHost host = msg->getSender();
- LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(host);
- if (!regionp)
- {
- LL_WARNS() << "Got region handshake for unknown region "
- << host << LL_ENDL;
- return;
- }
-
- regionp->unpackRegionHandshake();
+ LLHost host = msg->getSender();
+ LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(host);
+ if (!regionp)
+ {
+ LL_WARNS() << "Got region handshake for unknown region "
+ << host << LL_ENDL;
+ return;
+ }
+
+ regionp->unpackRegionHandshake();
}
void send_agent_pause()
{
- // *NOTE:Mani Pausing the mainloop timeout. Otherwise a long modal event may cause
- // the thread monitor to timeout.
- LLAppViewer::instance()->pauseMainloopTimeout();
-
- // Note: used to check for LLWorld initialization before it became a singleton.
- // Rather than just remove this check I'm changing it to assure that the message
- // system has been initialized. -MG
- if (!gMessageSystem)
- {
- return;
- }
-
- gMessageSystem->newMessageFast(_PREHASH_AgentPause);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgentID);
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgentSessionID);
-
- gAgentPauseSerialNum++;
- gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum);
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- gMessageSystem->sendReliable(regionp->getHost());
- }
-
- gObjectList.mWasPaused = TRUE;
- LLViewerStats::instance().getRecording().stop();
+ // *NOTE:Mani Pausing the mainloop timeout. Otherwise a long modal event may cause
+ // the thread monitor to timeout.
+ LLAppViewer::instance()->pauseMainloopTimeout();
+
+ // Note: used to check for LLWorld initialization before it became a singleton.
+ // Rather than just remove this check I'm changing it to assure that the message
+ // system has been initialized. -MG
+ if (!gMessageSystem)
+ {
+ return;
+ }
+
+ gMessageSystem->newMessageFast(_PREHASH_AgentPause);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgentID);
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgentSessionID);
+
+ gAgentPauseSerialNum++;
+ gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum);
+
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ gMessageSystem->sendReliable(regionp->getHost());
+ }
+
+ gObjectList.mWasPaused = TRUE;
+ LLViewerStats::instance().getRecording().stop();
}
void send_agent_resume()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK
- // Note: used to check for LLWorld initialization before it became a singleton.
- // Rather than just remove this check I'm changing it to assure that the message
- // system has been initialized. -MG
- if (!gMessageSystem)
- {
- return;
- }
-
- gMessageSystem->newMessageFast(_PREHASH_AgentResume);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgentID);
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgentSessionID);
-
- gAgentPauseSerialNum++;
- gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum);
-
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- gMessageSystem->sendReliable(regionp->getHost());
- }
-
- // Resume data collection to ignore invalid rates
- LLViewerStats::instance().getRecording().resume();
-
- LLAppViewer::instance()->resumeMainloopTimeout();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK
+ // Note: used to check for LLWorld initialization before it became a singleton.
+ // Rather than just remove this check I'm changing it to assure that the message
+ // system has been initialized. -MG
+ if (!gMessageSystem)
+ {
+ return;
+ }
+
+ gMessageSystem->newMessageFast(_PREHASH_AgentResume);
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgentID);
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgentSessionID);
+
+ gAgentPauseSerialNum++;
+ gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum);
+
+
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ gMessageSystem->sendReliable(regionp->getHost());
+ }
+
+ // Resume data collection to ignore invalid rates
+ LLViewerStats::instance().getRecording().resume();
+
+ LLAppViewer::instance()->resumeMainloopTimeout();
}
static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin)
{
- LLVector3d pos_local;
+ LLVector3d pos_local;
- pos_local.mdV[VZ] = (compact_local & 0xFFU) * 4;
- pos_local.mdV[VY] = (compact_local >> 8) & 0xFFU;
- pos_local.mdV[VX] = (compact_local >> 16) & 0xFFU;
+ pos_local.mdV[VZ] = (compact_local & 0xFFU) * 4;
+ pos_local.mdV[VY] = (compact_local >> 8) & 0xFFU;
+ pos_local.mdV[VX] = (compact_local >> 16) & 0xFFU;
- return region_origin + pos_local;
+ return region_origin + pos_local;
}
void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
{
- F32 radius_squared = radius * radius;
-
- if(avatar_ids != NULL)
- {
- avatar_ids->clear();
- }
- if(positions != NULL)
- {
- positions->clear();
- }
- // get the list of avatars from the character list first, so distances are correct
- // when agent is above 1020m and other avatars are nearby
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
- {
- LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter;
-
- if (!pVOAvatar->isDead() && !pVOAvatar->mIsDummy && !pVOAvatar->isOrphaned())
- {
- LLVector3d pos_global = pVOAvatar->getPositionGlobal();
- LLUUID uuid = pVOAvatar->getID();
-
- if (!uuid.isNull()
- && dist_vec_squared(pos_global, relative_to) <= radius_squared)
- {
- if(positions != NULL)
- {
- positions->push_back(pos_global);
- }
- if(avatar_ids !=NULL)
- {
- avatar_ids->push_back(uuid);
- }
- }
- }
- }
- // region avatars added for situations where radius is greater than RenderFarClip
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* regionp = *iter;
- const LLVector3d& origin_global = regionp->getOriginGlobal();
- S32 count = regionp->mMapAvatars.size();
- for (S32 i = 0; i < count; i++)
- {
- LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.at(i), origin_global);
- if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
- {
- LLUUID uuid = regionp->mMapAvatarIDs.at(i);
- // if this avatar doesn't already exist in the list, add it
- if(uuid.notNull() && avatar_ids != NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end())
- {
- if (positions != NULL)
- {
- positions->push_back(pos_global);
- }
- avatar_ids->push_back(uuid);
- }
- }
- }
- }
+ F32 radius_squared = radius * radius;
+
+ if(avatar_ids != NULL)
+ {
+ avatar_ids->clear();
+ }
+ if(positions != NULL)
+ {
+ positions->clear();
+ }
+ // get the list of avatars from the character list first, so distances are correct
+ // when agent is above 1020m and other avatars are nearby
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter;
+
+ if (!pVOAvatar->isDead() && !pVOAvatar->mIsDummy && !pVOAvatar->isOrphaned())
+ {
+ LLVector3d pos_global = pVOAvatar->getPositionGlobal();
+ LLUUID uuid = pVOAvatar->getID();
+
+ if (!uuid.isNull()
+ && dist_vec_squared(pos_global, relative_to) <= radius_squared)
+ {
+ if(positions != NULL)
+ {
+ positions->push_back(pos_global);
+ }
+ if(avatar_ids !=NULL)
+ {
+ avatar_ids->push_back(uuid);
+ }
+ }
+ }
+ }
+ // region avatars added for situations where radius is greater than RenderFarClip
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ const LLVector3d& origin_global = regionp->getOriginGlobal();
+ S32 count = regionp->mMapAvatars.size();
+ for (S32 i = 0; i < count; i++)
+ {
+ LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.at(i), origin_global);
+ if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
+ {
+ LLUUID uuid = regionp->mMapAvatarIDs.at(i);
+ // if this avatar doesn't already exist in the list, add it
+ if(uuid.notNull() && avatar_ids != NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end())
+ {
+ if (positions != NULL)
+ {
+ positions->push_back(pos_global);
+ }
+ avatar_ids->push_back(uuid);
+ }
+ }
+ }
+ }
}
F32 LLWorld::getNearbyAvatarsAndMaxGPUTime(std::vector<LLCharacter*> &valid_nearby_avs)
@@ -1405,15 +1405,15 @@ F32 LLWorld::getNearbyAvatarsAndMaxGPUTime(std::vector<LLCharacter*> &valid_near
bool LLWorld::isRegionListed(const LLViewerRegion* region) const
{
- region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region);
- return it != mRegionList.end();
+ region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region);
+ return it != mRegionList.end();
}
boost::signals2::connection LLWorld::setRegionRemovedCallback(const region_remove_signal_t::slot_type& cb)
{
- return mRegionRemovedSignal.connect(cb);
+ return mRegionRemovedSignal.connect(cb);
}
LLHTTPRegistration<LLEstablishAgentCommunication>
- gHTTPRegistrationEstablishAgentCommunication(
- "/message/EstablishAgentCommunication");
+ gHTTPRegistrationEstablishAgentCommunication(
+ "/message/EstablishAgentCommunication");
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index 2878d10f5e..fae7f58b66 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llworld.h
* @brief Collection of viewer regions in the vacinity of the user.
*
@@ -10,21 +10,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -69,106 +69,106 @@ public:
// Prepares class to be reused or destroyed
void resetClass();
- LLViewerRegion* addRegion(const U64 &region_handle, const LLHost &host);
- // safe to call if already present, does the "right thing" if
- // hosts are same, or if hosts are different, etc...
- void removeRegion(const LLHost &host);
+ LLViewerRegion* addRegion(const U64 &region_handle, const LLHost &host);
+ // safe to call if already present, does the "right thing" if
+ // hosts are same, or if hosts are different, etc...
+ void removeRegion(const LLHost &host);
- void disconnectRegions(); // Send quit messages to all child regions
+ void disconnectRegions(); // Send quit messages to all child regions
- LLViewerRegion* getRegion(const LLHost &host);
- LLViewerRegion* getRegionFromPosGlobal(const LLVector3d &pos);
- LLViewerRegion* getRegionFromPosAgent(const LLVector3 &pos);
- LLViewerRegion* getRegionFromHandle(const U64 &handle);
- LLViewerRegion* getRegionFromID(const LLUUID& region_id);
- BOOL positionRegionValidGlobal(const LLVector3d& pos); // true if position is in valid region
- LLVector3d clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos);
+ LLViewerRegion* getRegion(const LLHost &host);
+ LLViewerRegion* getRegionFromPosGlobal(const LLVector3d &pos);
+ LLViewerRegion* getRegionFromPosAgent(const LLVector3 &pos);
+ LLViewerRegion* getRegionFromHandle(const U64 &handle);
+ LLViewerRegion* getRegionFromID(const LLUUID& region_id);
+ BOOL positionRegionValidGlobal(const LLVector3d& pos); // true if position is in valid region
+ LLVector3d clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos);
- void updateAgentOffset(const LLVector3d &offset);
+ void updateAgentOffset(const LLVector3d &offset);
- // All of these should be in the agent coordinate frame
- LLViewerRegion* resolveRegionGlobal(LLVector3 &localpos, const LLVector3d &position);
- LLViewerRegion* resolveRegionAgent(LLVector3 &localpos, const LLVector3 &position);
- F32 resolveLandHeightGlobal(const LLVector3d &position);
- F32 resolveLandHeightAgent(const LLVector3 &position);
+ // All of these should be in the agent coordinate frame
+ LLViewerRegion* resolveRegionGlobal(LLVector3 &localpos, const LLVector3d &position);
+ LLViewerRegion* resolveRegionAgent(LLVector3 &localpos, const LLVector3 &position);
+ F32 resolveLandHeightGlobal(const LLVector3d &position);
+ F32 resolveLandHeightAgent(const LLVector3 &position);
- // Return the lowest allowed Z point to prevent objects from being moved
- // underground.
- F32 getMinAllowedZ(LLViewerObject* object, const LLVector3d &global_pos);
+ // Return the lowest allowed Z point to prevent objects from being moved
+ // underground.
+ F32 getMinAllowedZ(LLViewerObject* object, const LLVector3d &global_pos);
- // takes a line segment defined by point_a and point_b, then
- // determines the closest (to point_a) point of intersection that is
- // on the land surface or on an object of the world.
- // Stores results in "intersection" and "intersection_normal" and
- // returns a scalar value that is the normalized (by length of line segment)
- // distance along the line from "point_a" to "intersection".
- //
- // Currently assumes point_a and point_b only differ in z-direction,
- // but it may eventually become more general.
- F32 resolveStepHeightGlobal(const LLVOAvatar* avatarp, const LLVector3d &point_a, const LLVector3d &point_b,
- LLVector3d &intersection, LLVector3 &intersection_normal,
- LLViewerObject** viewerObjectPtr=NULL);
+ // takes a line segment defined by point_a and point_b, then
+ // determines the closest (to point_a) point of intersection that is
+ // on the land surface or on an object of the world.
+ // Stores results in "intersection" and "intersection_normal" and
+ // returns a scalar value that is the normalized (by length of line segment)
+ // distance along the line from "point_a" to "intersection".
+ //
+ // Currently assumes point_a and point_b only differ in z-direction,
+ // but it may eventually become more general.
+ F32 resolveStepHeightGlobal(const LLVOAvatar* avatarp, const LLVector3d &point_a, const LLVector3d &point_b,
+ LLVector3d &intersection, LLVector3 &intersection_normal,
+ LLViewerObject** viewerObjectPtr=NULL);
- LLSurfacePatch * resolveLandPatchGlobal(const LLVector3d &position);
- LLVector3 resolveLandNormalGlobal(const LLVector3d &position); // absolute frame
+ LLSurfacePatch * resolveLandPatchGlobal(const LLVector3d &position);
+ LLVector3 resolveLandNormalGlobal(const LLVector3d &position); // absolute frame
- U32 getRegionWidthInPoints() const { return mWidth; }
- F32 getRegionScale() const { return mScale; }
+ U32 getRegionWidthInPoints() const { return mWidth; }
+ F32 getRegionScale() const { return mScale; }
- // region X and Y size in meters
- F32 getRegionWidthInMeters() const { return mWidthInMeters; }
- F32 getRegionMinHeight() const { return -mWidthInMeters; }
- F32 getRegionMaxHeight() const { return MAX_OBJECT_Z; }
+ // region X and Y size in meters
+ F32 getRegionWidthInMeters() const { return mWidthInMeters; }
+ F32 getRegionMinHeight() const { return -mWidthInMeters; }
+ F32 getRegionMaxHeight() const { return MAX_OBJECT_Z; }
- void updateRegions(F32 max_update_time);
- void updateVisibilities();
- void updateParticles();
+ void updateRegions(F32 max_update_time);
+ void updateVisibilities();
+ void updateParticles();
- void renderPropertyLines();
+ void renderPropertyLines();
- void updateNetStats(); // Update network statistics for all the regions...
+ void updateNetStats(); // Update network statistics for all the regions...
- void printPacketsLost();
- void requestCacheMisses();
+ void printPacketsLost();
+ void requestCacheMisses();
- // deal with map object updates in the world.
- static void processCoarseUpdate(LLMessageSystem* msg, void** user_data);
+ // deal with map object updates in the world.
+ static void processCoarseUpdate(LLMessageSystem* msg, void** user_data);
- F32 getLandFarClip() const;
- void setLandFarClip(const F32 far_clip);
+ F32 getLandFarClip() const;
+ void setLandFarClip(const F32 far_clip);
- LLViewerTexture *getDefaultWaterTexture();
+ LLViewerTexture *getDefaultWaterTexture();
void updateWaterObjects();
- void waterHeightRegionInfo(std::string const& sim_name, F32 water_height);
- void shiftRegions(const LLVector3& offset);
+ void waterHeightRegionInfo(std::string const& sim_name, F32 water_height);
+ void shiftRegions(const LLVector3& offset);
- void setSpaceTimeUSec(const U64MicrosecondsImplicit space_time_usec);
- U64MicrosecondsImplicit getSpaceTimeUSec() const;
+ void setSpaceTimeUSec(const U64MicrosecondsImplicit space_time_usec);
+ U64MicrosecondsImplicit getSpaceTimeUSec() const;
- void getInfo(LLSD& info);
- U32 getNumOfActiveCachedObjects() const {return mNumOfActiveCachedObjects;}
+ void getInfo(LLSD& info);
+ U32 getNumOfActiveCachedObjects() const {return mNumOfActiveCachedObjects;}
- void clearAllVisibleObjects();
+ void clearAllVisibleObjects();
public:
- typedef std::list<LLViewerRegion*> region_list_t;
- const region_list_t& getRegionList() const { return mActiveRegionList; }
+ typedef std::list<LLViewerRegion*> region_list_t;
+ const region_list_t& getRegionList() const { return mActiveRegionList; }
- typedef boost::signals2::signal<void(LLViewerRegion*)> region_remove_signal_t;
- boost::signals2::connection setRegionRemovedCallback(const region_remove_signal_t::slot_type& cb);
+ typedef boost::signals2::signal<void(LLViewerRegion*)> region_remove_signal_t;
+ boost::signals2::connection setRegionRemovedCallback(const region_remove_signal_t::slot_type& cb);
- // Returns lists of avatar IDs and their world-space positions within a given distance of a point.
- // All arguments are optional. Given containers will be emptied and then filled.
- // Not supplying origin or radius input returns data on all avatars in the known regions.
- void getAvatars(
- uuid_vec_t* avatar_ids = NULL,
- std::vector<LLVector3d>* positions = NULL,
- const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const;
+ // Returns lists of avatar IDs and their world-space positions within a given distance of a point.
+ // All arguments are optional. Given containers will be emptied and then filled.
+ // Not supplying origin or radius input returns data on all avatars in the known regions.
+ void getAvatars(
+ uuid_vec_t* avatar_ids = NULL,
+ std::vector<LLVector3d>* positions = NULL,
+ const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const;
- // Returns 'true' if the region is in mRegionList,
- // 'false' if the region has been removed due to region change
- // or if the circuit to this simulator had been lost.
- bool isRegionListed(const LLViewerRegion* region) const;
+ // Returns 'true' if the region is in mRegionList,
+ // 'false' if the region has been removed due to region change
+ // or if the circuit to this simulator had been lost.
+ bool isRegionListed(const LLViewerRegion* region) const;
// profile nearby avatars using gPipeline.profileAvatar and update their render times
// return max GPU time
@@ -178,39 +178,39 @@ private:
void clearHoleWaterObjects();
void clearEdgeWaterObjects();
- region_list_t mActiveRegionList;
- region_list_t mRegionList;
- region_list_t mVisibleRegionList;
- region_list_t mCulledRegionList;
+ region_list_t mActiveRegionList;
+ region_list_t mRegionList;
+ region_list_t mVisibleRegionList;
+ region_list_t mCulledRegionList;
- region_remove_signal_t mRegionRemovedSignal;
+ region_remove_signal_t mRegionRemovedSignal;
- // Number of points on edge
- static const U32 mWidth;
+ // Number of points on edge
+ static const U32 mWidth;
- // meters/point, therefore mWidth * mScale = meters per edge
- static const F32 mScale;
+ // meters/point, therefore mWidth * mScale = meters per edge
+ static const F32 mScale;
- static const F32 mWidthInMeters;
+ static const F32 mWidthInMeters;
- F32 mLandFarClip; // Far clip distance for land.
- LLPatchVertexArray mLandPatch;
- S32 mLastPacketsIn;
- S32 mLastPacketsOut;
- S32 mLastPacketsLost;
- U32 mNumOfActiveCachedObjects;
- U64MicrosecondsImplicit mSpaceTimeUSec;
+ F32 mLandFarClip; // Far clip distance for land.
+ LLPatchVertexArray mLandPatch;
+ S32 mLastPacketsIn;
+ S32 mLastPacketsOut;
+ S32 mLastPacketsLost;
+ U32 mNumOfActiveCachedObjects;
+ U64MicrosecondsImplicit mSpaceTimeUSec;
- ////////////////////////////
- //
- // Data for "Fake" objects
- //
+ ////////////////////////////
+ //
+ // Data for "Fake" objects
+ //
- std::list<LLPointer<LLVOWater> > mHoleWaterObjects;
+ std::list<LLPointer<LLVOWater> > mHoleWaterObjects;
static const S32 EDGE_WATER_OBJECTS_COUNT = 8;
LLPointer<LLVOWater> mEdgeWaterObjects[EDGE_WATER_OBJECTS_COUNT];
- LLPointer<LLViewerTexture> mDefaultWaterTexturep;
+ LLPointer<LLViewerTexture> mDefaultWaterTexturep;
};
diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp
index cbb6e85b96..7962c28e6d 100644
--- a/indra/newview/llworldmap.cpp
+++ b/indra/newview/llworldmap.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llworldmap.cpp
* @brief Underlying data representation for map of the world
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,23 +37,23 @@
#include "llgltexture.h"
// Timers to temporise database requests
-const F32 AGENTS_UPDATE_TIMER = 60.0; // Seconds between 2 agent requests for a region
-const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // Seconds before we consider re-requesting item data for the grid
+const F32 AGENTS_UPDATE_TIMER = 60.0; // Seconds between 2 agent requests for a region
+const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // Seconds before we consider re-requesting item data for the grid
//---------------------------------------------------------------------------
// LLItemInfo
//---------------------------------------------------------------------------
LLItemInfo::LLItemInfo(F32 global_x, F32 global_y,
- const std::string& name,
- LLUUID id)
-: mName(name),
- mToolTip(""),
- mPosGlobal(global_x, global_y, 40.0),
- mID(id),
- mCount(1)
-// mSelected(false)
-// mColor()
+ const std::string& name,
+ LLUUID id)
+: mName(name),
+ mToolTip(""),
+ mPosGlobal(global_x, global_y, 40.0),
+ mID(id),
+ mCount(1)
+// mSelected(false)
+// mColor()
{
}
@@ -62,158 +62,158 @@ LLItemInfo::LLItemInfo(F32 global_x, F32 global_y,
//---------------------------------------------------------------------------
LLSimInfo::LLSimInfo(U64 handle)
-: mHandle(handle),
- mName(),
- mAgentsUpdateTime(0),
- mAccess(0x0),
- mRegionFlags(0x0),
- mFirstAgentRequest(true)
-// mWaterHeight(0.f)
+: mHandle(handle),
+ mName(),
+ mAgentsUpdateTime(0),
+ mAccess(0x0),
+ mRegionFlags(0x0),
+ mFirstAgentRequest(true)
+// mWaterHeight(0.f)
{
}
-void LLSimInfo::setLandForSaleImage (LLUUID image_id)
+void LLSimInfo::setLandForSaleImage (LLUUID image_id)
{
- mMapImageID = image_id;
+ mMapImageID = image_id;
- // Fetch the image
- if (mMapImageID.notNull())
- {
- mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE);
- mOverlayImage->setAddressMode(LLTexUnit::TAM_CLAMP);
- }
- else
- {
- mOverlayImage = NULL;
- }
+ // Fetch the image
+ if (mMapImageID.notNull())
+ {
+ mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE);
+ mOverlayImage->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
+ else
+ {
+ mOverlayImage = NULL;
+ }
}
-LLPointer<LLViewerFetchedTexture> LLSimInfo::getLandForSaleImage ()
+LLPointer<LLViewerFetchedTexture> LLSimInfo::getLandForSaleImage ()
{
- if (mOverlayImage.isNull() && mMapImageID.notNull())
- {
- // Fetch the image if it hasn't been done yet (unlikely but...)
- mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE);
- mOverlayImage->setAddressMode(LLTexUnit::TAM_CLAMP);
- }
- if (!mOverlayImage.isNull())
- {
- // Boost the fetch level when we try to access that image
- mOverlayImage->setBoostLevel(LLGLTexture::BOOST_MAP);
- }
- return mOverlayImage;
+ if (mOverlayImage.isNull() && mMapImageID.notNull())
+ {
+ // Fetch the image if it hasn't been done yet (unlikely but...)
+ mOverlayImage = LLViewerTextureManager::getFetchedTexture(mMapImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE);
+ mOverlayImage->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
+ if (!mOverlayImage.isNull())
+ {
+ // Boost the fetch level when we try to access that image
+ mOverlayImage->setBoostLevel(LLGLTexture::BOOST_MAP);
+ }
+ return mOverlayImage;
}
LLVector3d LLSimInfo::getGlobalPos(const LLVector3& local_pos) const
{
- LLVector3d pos = from_region_handle(mHandle);
- pos.mdV[VX] += local_pos.mV[VX];
- pos.mdV[VY] += local_pos.mV[VY];
- pos.mdV[VZ] += local_pos.mV[VZ];
- return pos;
+ LLVector3d pos = from_region_handle(mHandle);
+ pos.mdV[VX] += local_pos.mV[VX];
+ pos.mdV[VY] += local_pos.mV[VY];
+ pos.mdV[VZ] += local_pos.mV[VZ];
+ return pos;
}
LLVector3d LLSimInfo::getGlobalOrigin() const
{
- return from_region_handle(mHandle);
+ return from_region_handle(mHandle);
}
LLVector3 LLSimInfo::getLocalPos(LLVector3d global_pos) const
{
- LLVector3d sim_origin = from_region_handle(mHandle);
- return LLVector3(global_pos - sim_origin);
+ LLVector3d sim_origin = from_region_handle(mHandle);
+ return LLVector3(global_pos - sim_origin);
}
void LLSimInfo::clearImage()
{
- if (!mOverlayImage.isNull())
- {
- mOverlayImage->setBoostLevel(0);
- mOverlayImage = NULL;
- }
+ if (!mOverlayImage.isNull())
+ {
+ mOverlayImage->setBoostLevel(0);
+ mOverlayImage = NULL;
+ }
}
void LLSimInfo::dropImagePriority()
{
- if (!mOverlayImage.isNull())
- {
- mOverlayImage->setBoostLevel(0);
- }
+ if (!mOverlayImage.isNull())
+ {
+ mOverlayImage->setBoostLevel(0);
+ }
}
// Update the agent count for that region
void LLSimInfo::updateAgentCount(F64 time)
{
- if ((time - mAgentsUpdateTime > AGENTS_UPDATE_TIMER) || mFirstAgentRequest)
- {
- LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_AGENT_LOCATIONS, mHandle);
- mAgentsUpdateTime = time;
- mFirstAgentRequest = false;
- }
+ if ((time - mAgentsUpdateTime > AGENTS_UPDATE_TIMER) || mFirstAgentRequest)
+ {
+ LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_AGENT_LOCATIONS, mHandle);
+ mAgentsUpdateTime = time;
+ mFirstAgentRequest = false;
+ }
}
// Get the total agents count
const S32 LLSimInfo::getAgentCount() const
{
- S32 total_agent_count = 0;
- for (LLSimInfo::item_info_list_t::const_iterator it = mAgentLocations.begin(); it != mAgentLocations.end(); ++it)
- {
- total_agent_count += it->getCount();
- }
- return total_agent_count;
+ S32 total_agent_count = 0;
+ for (LLSimInfo::item_info_list_t::const_iterator it = mAgentLocations.begin(); it != mAgentLocations.end(); ++it)
+ {
+ total_agent_count += it->getCount();
+ }
+ return total_agent_count;
}
bool LLSimInfo::isName(const std::string& name) const
{
- return (LLStringUtil::compareInsensitive(name, mName) == 0);
+ return (LLStringUtil::compareInsensitive(name, mName) == 0);
}
void LLSimInfo::dump() const
{
- U32 x_pos, y_pos;
- from_region_handle(mHandle, &x_pos, &y_pos);
+ U32 x_pos, y_pos;
+ from_region_handle(mHandle, &x_pos, &y_pos);
- LL_INFOS("WorldMap") << x_pos << "," << y_pos
- << " " << mName
- << " " << (S32)mAccess
- << " " << std::hex << mRegionFlags << std::dec
-// << " " << mWaterHeight
- << LL_ENDL;
+ LL_INFOS("WorldMap") << x_pos << "," << y_pos
+ << " " << mName
+ << " " << (S32)mAccess
+ << " " << std::hex << mRegionFlags << std::dec
+// << " " << mWaterHeight
+ << LL_ENDL;
}
void LLSimInfo::clearItems()
{
- mTelehubs.clear();
- mInfohubs.clear();
- mPGEvents.clear();
- mMatureEvents.clear();
- mAdultEvents.clear();
- mLandForSale.clear();
- mLandForSaleAdult.clear();
+ mTelehubs.clear();
+ mInfohubs.clear();
+ mPGEvents.clear();
+ mMatureEvents.clear();
+ mAdultEvents.clear();
+ mLandForSale.clear();
+ mLandForSaleAdult.clear();
// We persist the agent count though as it is updated on a frequent basis
-// mAgentLocations.clear();
+// mAgentLocations.clear();
}
-void LLSimInfo::insertAgentLocation(const LLItemInfo& item)
+void LLSimInfo::insertAgentLocation(const LLItemInfo& item)
{
- std::string name = item.getName();
+ std::string name = item.getName();
- // Find the last item in the list with a different name and erase them
- item_info_list_t::iterator lastiter;
- for (lastiter = mAgentLocations.begin(); lastiter != mAgentLocations.end(); ++lastiter)
- {
- LLItemInfo& info = *lastiter;
- if (info.isName(name))
- {
- break;
- }
- }
- if (lastiter != mAgentLocations.begin())
- {
- mAgentLocations.erase(mAgentLocations.begin(), lastiter);
- }
+ // Find the last item in the list with a different name and erase them
+ item_info_list_t::iterator lastiter;
+ for (lastiter = mAgentLocations.begin(); lastiter != mAgentLocations.end(); ++lastiter)
+ {
+ LLItemInfo& info = *lastiter;
+ if (info.isName(name))
+ {
+ break;
+ }
+ }
+ if (lastiter != mAgentLocations.begin())
+ {
+ mAgentLocations.erase(mAgentLocations.begin(), lastiter);
+ }
- // Now append the new location
- mAgentLocations.push_back(item);
+ // Now append the new location
+ mAgentLocations.push_back(item);
}
//---------------------------------------------------------------------------
@@ -221,170 +221,170 @@ void LLSimInfo::insertAgentLocation(const LLItemInfo& item)
//---------------------------------------------------------------------------
LLWorldMap::LLWorldMap() :
- mIsTrackingLocation( false ),
- mIsTrackingFound( false ),
- mIsInvalidLocation( false ),
- mIsTrackingDoubleClick( false ),
- mIsTrackingCommit( false ),
- mTrackingLocation( 0, 0, 0 ),
- mFirstRequest(true)
+ mIsTrackingLocation( false ),
+ mIsTrackingFound( false ),
+ mIsInvalidLocation( false ),
+ mIsTrackingDoubleClick( false ),
+ mIsTrackingCommit( false ),
+ mTrackingLocation( 0, 0, 0 ),
+ mFirstRequest(true)
{
- //LL_INFOS("WorldMap") << "Creating the World Map -> LLWorldMap::LLWorldMap()" << LL_ENDL;
- mMapBlockLoaded = new bool[MAP_BLOCK_RES*MAP_BLOCK_RES];
- clearSimFlags();
+ //LL_INFOS("WorldMap") << "Creating the World Map -> LLWorldMap::LLWorldMap()" << LL_ENDL;
+ mMapBlockLoaded = new bool[MAP_BLOCK_RES*MAP_BLOCK_RES];
+ clearSimFlags();
}
LLWorldMap::~LLWorldMap()
{
- //LL_INFOS("WorldMap") << "Destroying the World Map -> LLWorldMap::~LLWorldMap()" << LL_ENDL;
- reset();
- delete[] mMapBlockLoaded;
+ //LL_INFOS("WorldMap") << "Destroying the World Map -> LLWorldMap::~LLWorldMap()" << LL_ENDL;
+ reset();
+ delete[] mMapBlockLoaded;
}
void LLWorldMap::reset()
{
- clearItems(true); // Clear the items lists
- clearImageRefs(); // Clear the world mipmap and the land for sale tiles
- clearSimFlags(); // Clear the block info flags array
+ clearItems(true); // Clear the items lists
+ clearImageRefs(); // Clear the world mipmap and the land for sale tiles
+ clearSimFlags(); // Clear the block info flags array
- // Finally, clear the region map itself
- for_each(mSimInfoMap.begin(), mSimInfoMap.end(), DeletePairedPointer());
- mSimInfoMap.clear();
+ // Finally, clear the region map itself
+ for_each(mSimInfoMap.begin(), mSimInfoMap.end(), DeletePairedPointer());
+ mSimInfoMap.clear();
}
// Returns true if the items have been cleared
bool LLWorldMap::clearItems(bool force)
{
- bool clear = false;
- if ((mRequestTimer.getElapsedTimeF32() > REQUEST_ITEMS_TIMER) || mFirstRequest || force)
- {
- mRequestTimer.reset();
-
- LLSimInfo* sim_info = NULL;
- for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
- {
- sim_info = it->second;
- if (sim_info)
- {
- sim_info->clearItems();
- }
- }
- clear = true;
- mFirstRequest = false;
- }
- return clear;
+ bool clear = false;
+ if ((mRequestTimer.getElapsedTimeF32() > REQUEST_ITEMS_TIMER) || mFirstRequest || force)
+ {
+ mRequestTimer.reset();
+
+ LLSimInfo* sim_info = NULL;
+ for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
+ {
+ sim_info = it->second;
+ if (sim_info)
+ {
+ sim_info->clearItems();
+ }
+ }
+ clear = true;
+ mFirstRequest = false;
+ }
+ return clear;
}
void LLWorldMap::clearImageRefs()
{
- // We clear the reference to the images we're holding.
- // Images hold by the world mipmap first
- mWorldMipmap.reset();
+ // We clear the reference to the images we're holding.
+ // Images hold by the world mipmap first
+ mWorldMipmap.reset();
- // Images hold by the region map
- LLSimInfo* sim_info = NULL;
- for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
- {
- sim_info = it->second;
- if (sim_info)
- {
- sim_info->clearImage();
- }
- }
+ // Images hold by the region map
+ LLSimInfo* sim_info = NULL;
+ for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
+ {
+ sim_info = it->second;
+ if (sim_info)
+ {
+ sim_info->clearImage();
+ }
+ }
}
// Doesn't clear the already-loaded sim infos, just re-requests them
void LLWorldMap::clearSimFlags()
{
- for (S32 idx=0; idx<MAP_BLOCK_RES*MAP_BLOCK_RES; ++idx)
- {
- mMapBlockLoaded[idx] = false;
- }
+ for (S32 idx=0; idx<MAP_BLOCK_RES*MAP_BLOCK_RES; ++idx)
+ {
+ mMapBlockLoaded[idx] = false;
+ }
}
LLSimInfo* LLWorldMap::createSimInfoFromHandle(const U64 handle)
{
- LLSimInfo* sim_info = new LLSimInfo(handle);
- mSimInfoMap[handle] = sim_info;
- return sim_info;
+ LLSimInfo* sim_info = new LLSimInfo(handle);
+ mSimInfoMap[handle] = sim_info;
+ return sim_info;
}
void LLWorldMap::equalizeBoostLevels()
{
- mWorldMipmap.equalizeBoostLevels();
- return;
+ mWorldMipmap.equalizeBoostLevels();
+ return;
}
LLSimInfo* LLWorldMap::simInfoFromPosGlobal(const LLVector3d& pos_global)
{
- U64 handle = to_region_handle(pos_global);
- return simInfoFromHandle(handle);
+ U64 handle = to_region_handle(pos_global);
+ return simInfoFromHandle(handle);
}
LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle)
{
- sim_info_map_t::iterator it = mSimInfoMap.find(handle);
- if (it != mSimInfoMap.end())
- {
- return it->second;
- }
- return NULL;
+ sim_info_map_t::iterator it = mSimInfoMap.find(handle);
+ if (it != mSimInfoMap.end())
+ {
+ return it->second;
+ }
+ return NULL;
}
LLSimInfo* LLWorldMap::simInfoFromName(const std::string& sim_name)
{
- LLSimInfo* sim_info = NULL;
- if (!sim_name.empty())
- {
- // Iterate through the entire sim info map and compare the name
- sim_info_map_t::iterator it;
- for (it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
- {
- sim_info = it->second;
- if (sim_info && sim_info->isName(sim_name) )
- {
- // break out of loop if success
- break;
- }
- }
- // If we got to the end, we haven't found the sim. Reset the ouput value to NULL.
- if (it == mSimInfoMap.end())
- sim_info = NULL;
- }
- return sim_info;
+ LLSimInfo* sim_info = NULL;
+ if (!sim_name.empty())
+ {
+ // Iterate through the entire sim info map and compare the name
+ sim_info_map_t::iterator it;
+ for (it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
+ {
+ sim_info = it->second;
+ if (sim_info && sim_info->isName(sim_name) )
+ {
+ // break out of loop if success
+ break;
+ }
+ }
+ // If we got to the end, we haven't found the sim. Reset the ouput value to NULL.
+ if (it == mSimInfoMap.end())
+ sim_info = NULL;
+ }
+ return sim_info;
}
bool LLWorldMap::simNameFromPosGlobal(const LLVector3d& pos_global, std::string & outSimName )
{
- LLSimInfo* sim_info = simInfoFromPosGlobal(pos_global);
+ LLSimInfo* sim_info = simInfoFromPosGlobal(pos_global);
- if (sim_info)
- {
- outSimName = sim_info->getName();
- }
- else
- {
- outSimName = "(unknown region)";
- }
+ if (sim_info)
+ {
+ outSimName = sim_info->getName();
+ }
+ else
+ {
+ outSimName = "(unknown region)";
+ }
- return (sim_info != NULL);
+ return (sim_info != NULL);
}
void LLWorldMap::reloadItems(bool force)
{
- //LL_INFOS("WorldMap") << "LLWorldMap::reloadItems()" << LL_ENDL;
- if (clearItems(force))
- {
- LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_TELEHUB);
- LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_PG_EVENT);
- LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_MATURE_EVENT);
- LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_ADULT_EVENT);
- LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_LAND_FOR_SALE);
- LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_LAND_FOR_SALE_ADULT);
- }
+ //LL_INFOS("WorldMap") << "LLWorldMap::reloadItems()" << LL_ENDL;
+ if (clearItems(force))
+ {
+ LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_TELEHUB);
+ LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_PG_EVENT);
+ LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_MATURE_EVENT);
+ LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_ADULT_EVENT);
+ LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_LAND_FOR_SALE);
+ LLWorldMapMessage::getInstance()->sendItemRequest(MAP_ITEM_LAND_FOR_SALE_ADULT);
+ }
}
@@ -393,51 +393,51 @@ void LLWorldMap::reloadItems(bool force)
// returns true if region inserted, false otherwise
bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& image_id, U32 accesscode, U32 region_flags)
{
- // This region doesn't exist
- if (accesscode == 255)
- {
- // Checks if the track point is in it and invalidates it if it is
- if (LLWorldMap::getInstance()->isTrackingInRectangle( x_world, y_world, x_world + REGION_WIDTH_UNITS, y_world + REGION_WIDTH_UNITS))
- {
- LLWorldMap::getInstance()->setTrackingInvalid();
- }
- // return failure to insert
- return false;
- }
- else
- {
- U64 handle = to_region_handle(x_world, y_world);
- //LL_INFOS("WorldMap") << "Map sim : " << name << ", ID : " << image_id.getString() << LL_ENDL;
- // Insert the region in the region map of the world map
- // Loading the LLSimInfo object with what we got and insert it in the map
- LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
- if (siminfo == NULL)
- {
- siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle);
- }
- siminfo->setName(name);
- siminfo->setAccess(accesscode);
- siminfo->setRegionFlags(region_flags);
- // siminfo->setWaterHeight((F32) water_height);
- siminfo->setLandForSaleImage(image_id);
-
- // Handle the location tracking (for teleport, UI feedback and info display)
- if (LLWorldMap::getInstance()->isTrackingInRectangle( x_world, y_world, x_world + REGION_WIDTH_UNITS, y_world + REGION_WIDTH_UNITS))
- {
- if (siminfo->isDown())
- {
- // We were tracking this location, but it's no available
- LLWorldMap::getInstance()->setTrackingInvalid();
- }
- else
- {
- // We were tracking this location, and it does exist and is available
- LLWorldMap::getInstance()->setTrackingValid();
- }
- }
- // return insert region success
- return true;
- }
+ // This region doesn't exist
+ if (accesscode == 255)
+ {
+ // Checks if the track point is in it and invalidates it if it is
+ if (LLWorldMap::getInstance()->isTrackingInRectangle( x_world, y_world, x_world + REGION_WIDTH_UNITS, y_world + REGION_WIDTH_UNITS))
+ {
+ LLWorldMap::getInstance()->setTrackingInvalid();
+ }
+ // return failure to insert
+ return false;
+ }
+ else
+ {
+ U64 handle = to_region_handle(x_world, y_world);
+ //LL_INFOS("WorldMap") << "Map sim : " << name << ", ID : " << image_id.getString() << LL_ENDL;
+ // Insert the region in the region map of the world map
+ // Loading the LLSimInfo object with what we got and insert it in the map
+ LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
+ if (siminfo == NULL)
+ {
+ siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle);
+ }
+ siminfo->setName(name);
+ siminfo->setAccess(accesscode);
+ siminfo->setRegionFlags(region_flags);
+ // siminfo->setWaterHeight((F32) water_height);
+ siminfo->setLandForSaleImage(image_id);
+
+ // Handle the location tracking (for teleport, UI feedback and info display)
+ if (LLWorldMap::getInstance()->isTrackingInRectangle( x_world, y_world, x_world + REGION_WIDTH_UNITS, y_world + REGION_WIDTH_UNITS))
+ {
+ if (siminfo->isDown())
+ {
+ // We were tracking this location, but it's no available
+ LLWorldMap::getInstance()->setTrackingInvalid();
+ }
+ else
+ {
+ // We were tracking this location, and it does exist and is available
+ LLWorldMap::getInstance()->setTrackingValid();
+ }
+ }
+ // return insert region success
+ return true;
+ }
}
// static public
@@ -445,183 +445,183 @@ bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUI
// returns true if item inserted, false otherwise
bool LLWorldMap::insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2)
{
- // Create an item record for the received object
- LLItemInfo new_item((F32)x_world, (F32)y_world, name, uuid);
-
- // Compute a region handle based on the objects coordinates
- LLVector3d pos((F32)x_world, (F32)y_world, 40.0);
- U64 handle = to_region_handle(pos);
-
- // Get the region record for that handle or NULL if we haven't browsed it yet
- LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
- if (siminfo == NULL)
- {
- siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle);
- }
-
- //LL_INFOS("WorldMap") << "Process item : type = " << type << LL_ENDL;
- switch (type)
- {
- case MAP_ITEM_TELEHUB: // telehubs
- {
- /* Merov: we are not using the hub color anymore for display so commenting that out
- // Telehub color
- U32 X = x_world / REGION_WIDTH_UNITS;
- U32 Y = y_world / REGION_WIDTH_UNITS;
- F32 red = fmod((F32)X * 0.11f, 1.f) * 0.8f;
- F32 green = fmod((F32)Y * 0.11f, 1.f) * 0.8f;
- F32 blue = fmod(1.5f * (F32)(X + Y) * 0.11f, 1.f) * 0.8f;
- F32 add_amt = (X % 2) ? 0.15f : -0.15f;
- add_amt += (Y % 2) ? -0.15f : 0.15f;
- LLColor4 color(red + add_amt, green + add_amt, blue + add_amt);
- new_item.setColor(color);
- */
-
- // extra2 specifies whether this is an infohub or a telehub.
- if (extra2)
- {
- siminfo->insertInfoHub(new_item);
- }
- else
- {
- siminfo->insertTeleHub(new_item);
- }
- break;
- }
- case MAP_ITEM_PG_EVENT: // events
- case MAP_ITEM_MATURE_EVENT:
- case MAP_ITEM_ADULT_EVENT:
- {
- std::string timeStr = "["+ LLTrans::getString ("TimeHour")+"]:["
- +LLTrans::getString ("TimeMin")+"] ["
- +LLTrans::getString ("TimeAMPM")+"]";
- LLSD substitution;
- substitution["datetime"] = (S32) extra;
- LLStringUtil::format (timeStr, substitution);
- new_item.setTooltip(timeStr);
-
- // HACK: store Z in extra2
- new_item.setElevation((F64)extra2);
- if (type == MAP_ITEM_PG_EVENT)
- {
- siminfo->insertPGEvent(new_item);
- }
- else if (type == MAP_ITEM_MATURE_EVENT)
- {
- siminfo->insertMatureEvent(new_item);
- }
- else if (type == MAP_ITEM_ADULT_EVENT)
- {
- siminfo->insertAdultEvent(new_item);
- }
- break;
- }
- case MAP_ITEM_LAND_FOR_SALE: // land for sale
- case MAP_ITEM_LAND_FOR_SALE_ADULT: // adult land for sale
- {
- static LLUIString tooltip_fmt = LLTrans::getString("worldmap_item_tooltip_format");
-
- tooltip_fmt.setArg("[AREA]", llformat("%d", extra));
- tooltip_fmt.setArg("[PRICE]", llformat("%d", extra2));
-
- // Check for division by zero
- if (extra != 0)
- {
- tooltip_fmt.setArg("[SQMPRICE]", llformat("%.1f", (F32)extra2 / (F32)extra));
- }
- else
- {
- tooltip_fmt.setArg("[SQMPRICE]", LLTrans::getString("Unknown"));
- }
-
- new_item.setTooltip(tooltip_fmt.getString());
-
- if (type == MAP_ITEM_LAND_FOR_SALE)
- {
- siminfo->insertLandForSale(new_item);
- }
- else if (type == MAP_ITEM_LAND_FOR_SALE_ADULT)
- {
- siminfo->insertLandForSaleAdult(new_item);
- }
- break;
- }
- case MAP_ITEM_CLASSIFIED: // classifieds
- {
- //DEPRECATED: no longer used
- break;
- }
- case MAP_ITEM_AGENT_LOCATIONS: // agent locations
- {
-// LL_INFOS("WorldMap") << "New Location " << new_item.mName << LL_ENDL;
- if (extra > 0)
- {
- new_item.setCount(extra);
- siminfo->insertAgentLocation(new_item);
- }
- break;
- }
- default:
- break;
- }
- return true;
+ // Create an item record for the received object
+ LLItemInfo new_item((F32)x_world, (F32)y_world, name, uuid);
+
+ // Compute a region handle based on the objects coordinates
+ LLVector3d pos((F32)x_world, (F32)y_world, 40.0);
+ U64 handle = to_region_handle(pos);
+
+ // Get the region record for that handle or NULL if we haven't browsed it yet
+ LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
+ if (siminfo == NULL)
+ {
+ siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle);
+ }
+
+ //LL_INFOS("WorldMap") << "Process item : type = " << type << LL_ENDL;
+ switch (type)
+ {
+ case MAP_ITEM_TELEHUB: // telehubs
+ {
+ /* Merov: we are not using the hub color anymore for display so commenting that out
+ // Telehub color
+ U32 X = x_world / REGION_WIDTH_UNITS;
+ U32 Y = y_world / REGION_WIDTH_UNITS;
+ F32 red = fmod((F32)X * 0.11f, 1.f) * 0.8f;
+ F32 green = fmod((F32)Y * 0.11f, 1.f) * 0.8f;
+ F32 blue = fmod(1.5f * (F32)(X + Y) * 0.11f, 1.f) * 0.8f;
+ F32 add_amt = (X % 2) ? 0.15f : -0.15f;
+ add_amt += (Y % 2) ? -0.15f : 0.15f;
+ LLColor4 color(red + add_amt, green + add_amt, blue + add_amt);
+ new_item.setColor(color);
+ */
+
+ // extra2 specifies whether this is an infohub or a telehub.
+ if (extra2)
+ {
+ siminfo->insertInfoHub(new_item);
+ }
+ else
+ {
+ siminfo->insertTeleHub(new_item);
+ }
+ break;
+ }
+ case MAP_ITEM_PG_EVENT: // events
+ case MAP_ITEM_MATURE_EVENT:
+ case MAP_ITEM_ADULT_EVENT:
+ {
+ std::string timeStr = "["+ LLTrans::getString ("TimeHour")+"]:["
+ +LLTrans::getString ("TimeMin")+"] ["
+ +LLTrans::getString ("TimeAMPM")+"]";
+ LLSD substitution;
+ substitution["datetime"] = (S32) extra;
+ LLStringUtil::format (timeStr, substitution);
+ new_item.setTooltip(timeStr);
+
+ // HACK: store Z in extra2
+ new_item.setElevation((F64)extra2);
+ if (type == MAP_ITEM_PG_EVENT)
+ {
+ siminfo->insertPGEvent(new_item);
+ }
+ else if (type == MAP_ITEM_MATURE_EVENT)
+ {
+ siminfo->insertMatureEvent(new_item);
+ }
+ else if (type == MAP_ITEM_ADULT_EVENT)
+ {
+ siminfo->insertAdultEvent(new_item);
+ }
+ break;
+ }
+ case MAP_ITEM_LAND_FOR_SALE: // land for sale
+ case MAP_ITEM_LAND_FOR_SALE_ADULT: // adult land for sale
+ {
+ static LLUIString tooltip_fmt = LLTrans::getString("worldmap_item_tooltip_format");
+
+ tooltip_fmt.setArg("[AREA]", llformat("%d", extra));
+ tooltip_fmt.setArg("[PRICE]", llformat("%d", extra2));
+
+ // Check for division by zero
+ if (extra != 0)
+ {
+ tooltip_fmt.setArg("[SQMPRICE]", llformat("%.1f", (F32)extra2 / (F32)extra));
+ }
+ else
+ {
+ tooltip_fmt.setArg("[SQMPRICE]", LLTrans::getString("Unknown"));
+ }
+
+ new_item.setTooltip(tooltip_fmt.getString());
+
+ if (type == MAP_ITEM_LAND_FOR_SALE)
+ {
+ siminfo->insertLandForSale(new_item);
+ }
+ else if (type == MAP_ITEM_LAND_FOR_SALE_ADULT)
+ {
+ siminfo->insertLandForSaleAdult(new_item);
+ }
+ break;
+ }
+ case MAP_ITEM_CLASSIFIED: // classifieds
+ {
+ //DEPRECATED: no longer used
+ break;
+ }
+ case MAP_ITEM_AGENT_LOCATIONS: // agent locations
+ {
+// LL_INFOS("WorldMap") << "New Location " << new_item.mName << LL_ENDL;
+ if (extra > 0)
+ {
+ new_item.setCount(extra);
+ siminfo->insertAgentLocation(new_item);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ return true;
}
bool LLWorldMap::isTrackingInRectangle(F64 x0, F64 y0, F64 x1, F64 y1)
{
- if (!mIsTrackingLocation)
- return false;
- return ((mTrackingLocation[0] >= x0) && (mTrackingLocation[0] < x1) && (mTrackingLocation[1] >= y0) && (mTrackingLocation[1] < y1));
+ if (!mIsTrackingLocation)
+ return false;
+ return ((mTrackingLocation[0] >= x0) && (mTrackingLocation[0] < x1) && (mTrackingLocation[1] >= y0) && (mTrackingLocation[1] < y1));
}
// Drop priority of all images being fetched by the map
void LLWorldMap::dropImagePriorities()
{
- // Drop the download of tiles priority to nil
- mWorldMipmap.dropBoostLevels();
- // Same for the "land for sale" tiles per region
- for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
- {
- LLSimInfo* info = it->second;
- info->dropImagePriority();
- }
+ // Drop the download of tiles priority to nil
+ mWorldMipmap.dropBoostLevels();
+ // Same for the "land for sale" tiles per region
+ for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
+ {
+ LLSimInfo* info = it->second;
+ info->dropImagePriority();
+ }
}
// Load all regions in a given rectangle (in region grid coordinates, i.e. world / 256 meters)
void LLWorldMap::updateRegions(S32 x0, S32 y0, S32 x1, S32 y1)
{
- // Convert those boundaries to the corresponding (MAP_BLOCK_SIZE x MAP_BLOCK_SIZE) block coordinates
- x0 = x0 / MAP_BLOCK_SIZE;
- x1 = x1 / MAP_BLOCK_SIZE;
- y0 = y0 / MAP_BLOCK_SIZE;
- y1 = y1 / MAP_BLOCK_SIZE;
-
- // Load the region info those blocks
- for (S32 block_x = llmax(x0, 0); block_x <= llmin(x1, MAP_BLOCK_RES-1); ++block_x)
- {
- for (S32 block_y = llmax(y0, 0); block_y <= llmin(y1, MAP_BLOCK_RES-1); ++block_y)
- {
- S32 offset = block_x | (block_y * MAP_BLOCK_RES);
- if (!mMapBlockLoaded[offset])
- {
- //LL_INFOS("WorldMap") << "Loading Block (" << block_x << "," << block_y << ")" << LL_ENDL;
- LLWorldMapMessage::getInstance()->sendMapBlockRequest(block_x * MAP_BLOCK_SIZE, block_y * MAP_BLOCK_SIZE, (block_x * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1, (block_y * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1);
- mMapBlockLoaded[offset] = true;
- }
- }
- }
+ // Convert those boundaries to the corresponding (MAP_BLOCK_SIZE x MAP_BLOCK_SIZE) block coordinates
+ x0 = x0 / MAP_BLOCK_SIZE;
+ x1 = x1 / MAP_BLOCK_SIZE;
+ y0 = y0 / MAP_BLOCK_SIZE;
+ y1 = y1 / MAP_BLOCK_SIZE;
+
+ // Load the region info those blocks
+ for (S32 block_x = llmax(x0, 0); block_x <= llmin(x1, MAP_BLOCK_RES-1); ++block_x)
+ {
+ for (S32 block_y = llmax(y0, 0); block_y <= llmin(y1, MAP_BLOCK_RES-1); ++block_y)
+ {
+ S32 offset = block_x | (block_y * MAP_BLOCK_RES);
+ if (!mMapBlockLoaded[offset])
+ {
+ //LL_INFOS("WorldMap") << "Loading Block (" << block_x << "," << block_y << ")" << LL_ENDL;
+ LLWorldMapMessage::getInstance()->sendMapBlockRequest(block_x * MAP_BLOCK_SIZE, block_y * MAP_BLOCK_SIZE, (block_x * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1, (block_y * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1);
+ mMapBlockLoaded[offset] = true;
+ }
+ }
+ }
}
void LLWorldMap::dump()
{
- LL_INFOS("WorldMap") << "LLWorldMap::dump()" << LL_ENDL;
- for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
- {
- LLSimInfo* info = it->second;
- if (info)
- {
- info->dump();
- }
- }
+ LL_INFOS("WorldMap") << "LLWorldMap::dump()" << LL_ENDL;
+ for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
+ {
+ LLSimInfo* info = it->second;
+ if (info)
+ {
+ info->dump();
+ }
+ }
}
diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h
index 5e5caa6a74..fb9d140851 100644
--- a/indra/newview/llworldmap.h
+++ b/indra/newview/llworldmap.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llworldmap.h
* @brief Underlying data storage for the map of the entire world.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,7 +42,7 @@
const U32 MAP_ITEM_TELEHUB = 0x01;
const U32 MAP_ITEM_PG_EVENT = 0x02;
const U32 MAP_ITEM_MATURE_EVENT = 0x03;
-//const U32 MAP_ITEM_POPULAR = 0x04; // No longer supported, 2009-03-02 KLW
+//const U32 MAP_ITEM_POPULAR = 0x04; // No longer supported, 2009-03-02 KLW
//const U32 MAP_ITEM_AGENT_COUNT = 0x05;
const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06;
const U32 MAP_ITEM_LAND_FOR_SALE = 0x07;
@@ -51,138 +51,138 @@ const U32 MAP_ITEM_ADULT_EVENT = 0x09;
const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a;
// Description of objects like hubs, events, land for sale, people and more (TBD).
-// Note: we don't store a "type" in there so we need to store instances of this class in
+// Note: we don't store a "type" in there so we need to store instances of this class in
// well known objects (i.e. list of objects which type is "well known").
class LLItemInfo
{
public:
- LLItemInfo(F32 global_x, F32 global_y, const std::string& name, LLUUID id);
+ LLItemInfo(F32 global_x, F32 global_y, const std::string& name, LLUUID id);
- // Setters
- void setTooltip(const std::string& tooltip) { mToolTip = tooltip; }
- void setElevation(F64 z) { mPosGlobal.mdV[VZ] = z; }
- void setCount(S32 count) { mCount = count; }
-// void setSelected(bool selected) { mSelected = selected; }
-// void setColor(LLColor4 color) { mColor = color; }
+ // Setters
+ void setTooltip(const std::string& tooltip) { mToolTip = tooltip; }
+ void setElevation(F64 z) { mPosGlobal.mdV[VZ] = z; }
+ void setCount(S32 count) { mCount = count; }
+// void setSelected(bool selected) { mSelected = selected; }
+// void setColor(LLColor4 color) { mColor = color; }
- // Accessors
- const LLVector3d& getGlobalPosition() const { return mPosGlobal; }
- const std::string& getName() const { return mName; }
- const std::string& getToolTip() const { return mToolTip; }
- const LLUUID& getUUID() const { return mID; }
- S32 getCount() const { return mCount; }
+ // Accessors
+ const LLVector3d& getGlobalPosition() const { return mPosGlobal; }
+ const std::string& getName() const { return mName; }
+ const std::string& getToolTip() const { return mToolTip; }
+ const LLUUID& getUUID() const { return mID; }
+ S32 getCount() const { return mCount; }
- U64 getRegionHandle() const { return to_region_handle(mPosGlobal); } // Build the handle on the fly
+ U64 getRegionHandle() const { return to_region_handle(mPosGlobal); } // Build the handle on the fly
- bool isName(const std::string& name) const { return (mName == name); } // True if name same as item's name
-// bool isSelected() const { return mSelected; }
+ bool isName(const std::string& name) const { return (mName == name); } // True if name same as item's name
+// bool isSelected() const { return mSelected; }
private:
- std::string mName; // Name of the individual item
- std::string mToolTip; // Tooltip : typically, something to be displayed to the user when selecting this item
- LLVector3d mPosGlobal; // Global world position
- LLUUID mID; // UUID of the item
- S32 mCount; // Number of elements in item (e.g. people count)
- // Currently not used but might prove useful one day so we comment out
-// bool mSelected; // Selected or not: updated by the viewer UI, not the simulator or asset DB
-// LLColor4 mColor; // Color of the item
+ std::string mName; // Name of the individual item
+ std::string mToolTip; // Tooltip : typically, something to be displayed to the user when selecting this item
+ LLVector3d mPosGlobal; // Global world position
+ LLUUID mID; // UUID of the item
+ S32 mCount; // Number of elements in item (e.g. people count)
+ // Currently not used but might prove useful one day so we comment out
+// bool mSelected; // Selected or not: updated by the viewer UI, not the simulator or asset DB
+// LLColor4 mColor; // Color of the item
};
// Info per region
-// Such records are stored in a global map hold by the LLWorldMap and indexed by region handles.
-// To avoid creating too many of them, they are requested in "blocks" corresponding to areas covered by the screen.
-// Unfortunately, when the screen covers the whole world (zoomed out), that can translate in requesting info for
+// Such records are stored in a global map hold by the LLWorldMap and indexed by region handles.
+// To avoid creating too many of them, they are requested in "blocks" corresponding to areas covered by the screen.
+// Unfortunately, when the screen covers the whole world (zoomed out), that can translate in requesting info for
// every sim on the grid... Not good...
-// To avoid this, the code implements a cut-off threshold for overlay graphics and, therefore, all LLSimInfo.
+// To avoid this, the code implements a cut-off threshold for overlay graphics and, therefore, all LLSimInfo.
// In other words, when zooming out too much, we simply stop requesting LLSimInfo and
-// LLItemInfo and just display the map tiles.
+// LLItemInfo and just display the map tiles.
// As they are stored in different structures (LLSimInfo and LLWorldMipmap), this strategy is now workable.
class LLSimInfo
{
public:
- LLSimInfo(U64 handle);
-
- // Convert local region coordinates into world coordinates
- LLVector3d getGlobalPos(const LLVector3& local_pos) const;
- // Get the world coordinates of the SW corner of that region
- LLVector3d getGlobalOrigin() const;
- LLVector3 getLocalPos(LLVector3d global_pos) const;
-
- void clearImage(); // Clears the reference to the Land for sale image for that region
- void dropImagePriority(); // Drops the boost level of the Land for sale image for that region
- void updateAgentCount(F64 time); // Send an item request for agent count on that region if time's up
-
- // Setters
- void setName(std::string& name) { mName = name; }
- void setAccess (U32 accesscode) { mAccess = accesscode; }
- void setRegionFlags (U32 region_flags) { mRegionFlags = region_flags; }
- void setLandForSaleImage (LLUUID image_id);
-// void setWaterHeight (F32 water_height) { mWaterHeight = water_height; }
-
- // Accessors
- std::string getName() const { return mName; }
- const std::string getFlagsString() const { return LLViewerRegion::regionFlagsToString(mRegionFlags); }
- const std::string getAccessString() const { return LLViewerRegion::accessToString((U8)mAccess); }
-
- const S32 getAgentCount() const; // Compute the total agents count
- LLPointer<LLViewerFetchedTexture> getLandForSaleImage(); // Get the overlay image, fetch it if necessary
-
- bool isName(const std::string& name) const;
- bool isDown() { return (mAccess == SIM_ACCESS_DOWN); }
- bool isPG() { return (mAccess <= SIM_ACCESS_PG); }
- bool isAdult() { return (mAccess == SIM_ACCESS_ADULT); }
-
- // Debug only
- void dump() const; // Print the region info to the standard output
-
- // Items lists handling
- typedef std::vector<LLItemInfo> item_info_list_t;
- void clearItems();
-
- void insertTeleHub(const LLItemInfo& item) { mTelehubs.push_back(item); }
- void insertInfoHub(const LLItemInfo& item) { mInfohubs.push_back(item); }
- void insertPGEvent(const LLItemInfo& item) { mPGEvents.push_back(item); }
- void insertMatureEvent(const LLItemInfo& item) { mMatureEvents.push_back(item); }
- void insertAdultEvent(const LLItemInfo& item) { mAdultEvents.push_back(item); }
- void insertLandForSale(const LLItemInfo& item) { mLandForSale.push_back(item); }
- void insertLandForSaleAdult(const LLItemInfo& item) { mLandForSaleAdult.push_back(item); }
- void insertAgentLocation(const LLItemInfo& item);
-
- const LLSimInfo::item_info_list_t& getTeleHub() const { return mTelehubs; }
- const LLSimInfo::item_info_list_t& getInfoHub() const { return mInfohubs; }
- const LLSimInfo::item_info_list_t& getPGEvent() const { return mPGEvents; }
- const LLSimInfo::item_info_list_t& getMatureEvent() const { return mMatureEvents; }
- const LLSimInfo::item_info_list_t& getAdultEvent() const { return mAdultEvents; }
- const LLSimInfo::item_info_list_t& getLandForSale() const { return mLandForSale; }
- const LLSimInfo::item_info_list_t& getLandForSaleAdult() const { return mLandForSaleAdult; }
- const LLSimInfo::item_info_list_t& getAgentLocation() const { return mAgentLocations; }
+ LLSimInfo(U64 handle);
+
+ // Convert local region coordinates into world coordinates
+ LLVector3d getGlobalPos(const LLVector3& local_pos) const;
+ // Get the world coordinates of the SW corner of that region
+ LLVector3d getGlobalOrigin() const;
+ LLVector3 getLocalPos(LLVector3d global_pos) const;
+
+ void clearImage(); // Clears the reference to the Land for sale image for that region
+ void dropImagePriority(); // Drops the boost level of the Land for sale image for that region
+ void updateAgentCount(F64 time); // Send an item request for agent count on that region if time's up
+
+ // Setters
+ void setName(std::string& name) { mName = name; }
+ void setAccess (U32 accesscode) { mAccess = accesscode; }
+ void setRegionFlags (U32 region_flags) { mRegionFlags = region_flags; }
+ void setLandForSaleImage (LLUUID image_id);
+// void setWaterHeight (F32 water_height) { mWaterHeight = water_height; }
+
+ // Accessors
+ std::string getName() const { return mName; }
+ const std::string getFlagsString() const { return LLViewerRegion::regionFlagsToString(mRegionFlags); }
+ const std::string getAccessString() const { return LLViewerRegion::accessToString((U8)mAccess); }
+
+ const S32 getAgentCount() const; // Compute the total agents count
+ LLPointer<LLViewerFetchedTexture> getLandForSaleImage(); // Get the overlay image, fetch it if necessary
+
+ bool isName(const std::string& name) const;
+ bool isDown() { return (mAccess == SIM_ACCESS_DOWN); }
+ bool isPG() { return (mAccess <= SIM_ACCESS_PG); }
+ bool isAdult() { return (mAccess == SIM_ACCESS_ADULT); }
+
+ // Debug only
+ void dump() const; // Print the region info to the standard output
+
+ // Items lists handling
+ typedef std::vector<LLItemInfo> item_info_list_t;
+ void clearItems();
+
+ void insertTeleHub(const LLItemInfo& item) { mTelehubs.push_back(item); }
+ void insertInfoHub(const LLItemInfo& item) { mInfohubs.push_back(item); }
+ void insertPGEvent(const LLItemInfo& item) { mPGEvents.push_back(item); }
+ void insertMatureEvent(const LLItemInfo& item) { mMatureEvents.push_back(item); }
+ void insertAdultEvent(const LLItemInfo& item) { mAdultEvents.push_back(item); }
+ void insertLandForSale(const LLItemInfo& item) { mLandForSale.push_back(item); }
+ void insertLandForSaleAdult(const LLItemInfo& item) { mLandForSaleAdult.push_back(item); }
+ void insertAgentLocation(const LLItemInfo& item);
+
+ const LLSimInfo::item_info_list_t& getTeleHub() const { return mTelehubs; }
+ const LLSimInfo::item_info_list_t& getInfoHub() const { return mInfohubs; }
+ const LLSimInfo::item_info_list_t& getPGEvent() const { return mPGEvents; }
+ const LLSimInfo::item_info_list_t& getMatureEvent() const { return mMatureEvents; }
+ const LLSimInfo::item_info_list_t& getAdultEvent() const { return mAdultEvents; }
+ const LLSimInfo::item_info_list_t& getLandForSale() const { return mLandForSale; }
+ const LLSimInfo::item_info_list_t& getLandForSaleAdult() const { return mLandForSaleAdult; }
+ const LLSimInfo::item_info_list_t& getAgentLocation() const { return mAgentLocations; }
private:
- U64 mHandle; // This is a hash of the X and Y world coordinates of the SW corner of the sim
- std::string mName; // Region name
-
- F64 mAgentsUpdateTime; // Time stamp giving the last time the agents information was requested for that region
- bool mFirstAgentRequest; // Init agent request flag
-
- U32 mAccess; // Down/up and maturity rating of the region
- U32 mRegionFlags; // Tell us if the siminfo has been received (if non 0) and what kind of region it is (Sandbox, allow damage)
- // Currently not used but might prove useful one day so we comment out
-// F32 mWaterHeight; // Water height on the region (not actively used)
-
- // Handling the "land for sale / land for auction" overlay image
- LLUUID mMapImageID; // Image ID of the overlay image
- LLPointer<LLViewerFetchedTexture> mOverlayImage; // Reference to the overlay image
-
- // Items for this region
- // Those are data received through item requests (as opposed to block requests for the rest of the data)
- item_info_list_t mTelehubs; // List of tele hubs in the region
- item_info_list_t mInfohubs; // List of info hubs in the region
- item_info_list_t mPGEvents; // List of PG events in the region
- item_info_list_t mMatureEvents; // List of Mature events in the region
- item_info_list_t mAdultEvents; // List of Adult events in the region (AO)
- item_info_list_t mLandForSale; // List of Land for sales in the region
- item_info_list_t mLandForSaleAdult; // List of Adult Land for sales in the region (AO)
- item_info_list_t mAgentLocations; // List of agents in the region
+ U64 mHandle; // This is a hash of the X and Y world coordinates of the SW corner of the sim
+ std::string mName; // Region name
+
+ F64 mAgentsUpdateTime; // Time stamp giving the last time the agents information was requested for that region
+ bool mFirstAgentRequest; // Init agent request flag
+
+ U32 mAccess; // Down/up and maturity rating of the region
+ U32 mRegionFlags; // Tell us if the siminfo has been received (if non 0) and what kind of region it is (Sandbox, allow damage)
+ // Currently not used but might prove useful one day so we comment out
+// F32 mWaterHeight; // Water height on the region (not actively used)
+
+ // Handling the "land for sale / land for auction" overlay image
+ LLUUID mMapImageID; // Image ID of the overlay image
+ LLPointer<LLViewerFetchedTexture> mOverlayImage; // Reference to the overlay image
+
+ // Items for this region
+ // Those are data received through item requests (as opposed to block requests for the rest of the data)
+ item_info_list_t mTelehubs; // List of tele hubs in the region
+ item_info_list_t mInfohubs; // List of info hubs in the region
+ item_info_list_t mPGEvents; // List of PG events in the region
+ item_info_list_t mMatureEvents; // List of Mature events in the region
+ item_info_list_t mAdultEvents; // List of Adult events in the region (AO)
+ item_info_list_t mLandForSale; // List of Land for sales in the region
+ item_info_list_t mLandForSaleAdult; // List of Adult Land for sales in the region (AO)
+ item_info_list_t mAgentLocations; // List of agents in the region
};
// We request region data on the world by "blocks" of (MAP_BLOCK_SIZE x MAP_BLOCK_SIZE) regions
@@ -193,91 +193,91 @@ const S32 MAP_BLOCK_RES = (MAP_MAX_SIZE / MAP_BLOCK_SIZE);
class LLWorldMap : public LLSingleton<LLWorldMap>
{
- LLSINGLETON(LLWorldMap);
- ~LLWorldMap();
+ LLSINGLETON(LLWorldMap);
+ ~LLWorldMap();
public:
- // Clear all: list of region info, tiles, blocks and items
- void reset();
+ // Clear all: list of region info, tiles, blocks and items
+ void reset();
- void clearImageRefs(); // Clears the image references
- void dropImagePriorities(); // Drops the priority of the images being fetched
- void reloadItems(bool force = false); // Reload the items (people, hub, etc...)
+ void clearImageRefs(); // Clears the image references
+ void dropImagePriorities(); // Drops the priority of the images being fetched
+ void reloadItems(bool force = false); // Reload the items (people, hub, etc...)
- // Region Map access
- typedef std::map<U64, LLSimInfo*> sim_info_map_t;
- const LLWorldMap::sim_info_map_t& getRegionMap() const { return mSimInfoMap; }
- void updateRegions(S32 x0, S32 y0, S32 x1, S32 y1); // Requests region info for a rectangle of regions (in grid coordinates)
+ // Region Map access
+ typedef std::map<U64, LLSimInfo*> sim_info_map_t;
+ const LLWorldMap::sim_info_map_t& getRegionMap() const { return mSimInfoMap; }
+ void updateRegions(S32 x0, S32 y0, S32 x1, S32 y1); // Requests region info for a rectangle of regions (in grid coordinates)
- // Insert a region and items in the map global instance
- // Note: x_world and y_world in world coordinates (meters)
- static bool insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 accesscode, U32 region_flags);
- static bool insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2);
+ // Insert a region and items in the map global instance
+ // Note: x_world and y_world in world coordinates (meters)
+ static bool insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 accesscode, U32 region_flags);
+ static bool insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2);
- // Get info on sims (region) : note that those methods only search the range of loaded sims (the one that are being browsed)
- // *not* the entire world. So a NULL return does not mean a down or unexisting region, just an out of range region.
- LLSimInfo* simInfoFromHandle(const U64 handle);
- LLSimInfo* simInfoFromPosGlobal(const LLVector3d& pos_global);
- LLSimInfo* simInfoFromName(const std::string& sim_name);
+ // Get info on sims (region) : note that those methods only search the range of loaded sims (the one that are being browsed)
+ // *not* the entire world. So a NULL return does not mean a down or unexisting region, just an out of range region.
+ LLSimInfo* simInfoFromHandle(const U64 handle);
+ LLSimInfo* simInfoFromPosGlobal(const LLVector3d& pos_global);
+ LLSimInfo* simInfoFromName(const std::string& sim_name);
- // Gets simulator name from a global position, returns true if found
- bool simNameFromPosGlobal(const LLVector3d& pos_global, std::string& outSimName );
+ // Gets simulator name from a global position, returns true if found
+ bool simNameFromPosGlobal(const LLVector3d& pos_global, std::string& outSimName );
- // Debug only
- void dump(); // Print the world info to the standard output
+ // Debug only
+ void dump(); // Print the world info to the standard output
- // Track handling
- void cancelTracking() { mIsTrackingLocation = false; mIsTrackingFound = false; mIsInvalidLocation = false; mIsTrackingDoubleClick = false; mIsTrackingCommit = false; }
+ // Track handling
+ void cancelTracking() { mIsTrackingLocation = false; mIsTrackingFound = false; mIsInvalidLocation = false; mIsTrackingDoubleClick = false; mIsTrackingCommit = false; }
- void setTracking(const LLVector3d& loc) { mIsTrackingLocation = true; mTrackingLocation = loc; mIsTrackingFound = false; mIsInvalidLocation = false; mIsTrackingDoubleClick = false; mIsTrackingCommit = false;}
- void setTrackingInvalid() { mIsTrackingFound = true; mIsInvalidLocation = true; }
- void setTrackingValid() { mIsTrackingFound = true; mIsInvalidLocation = false; }
- void setTrackingDoubleClick() { mIsTrackingDoubleClick = true; }
- void setTrackingCommit() { mIsTrackingCommit = true; }
+ void setTracking(const LLVector3d& loc) { mIsTrackingLocation = true; mTrackingLocation = loc; mIsTrackingFound = false; mIsInvalidLocation = false; mIsTrackingDoubleClick = false; mIsTrackingCommit = false;}
+ void setTrackingInvalid() { mIsTrackingFound = true; mIsInvalidLocation = true; }
+ void setTrackingValid() { mIsTrackingFound = true; mIsInvalidLocation = false; }
+ void setTrackingDoubleClick() { mIsTrackingDoubleClick = true; }
+ void setTrackingCommit() { mIsTrackingCommit = true; }
- bool isTracking() { return mIsTrackingLocation; }
- bool isTrackingValidLocation() { return mIsTrackingFound && !mIsInvalidLocation; }
- bool isTrackingInvalidLocation() { return mIsTrackingFound && mIsInvalidLocation; }
- bool isTrackingDoubleClick() { return mIsTrackingDoubleClick; }
- bool isTrackingCommit() { return mIsTrackingCommit; }
- bool isTrackingInRectangle(F64 x0, F64 y0, F64 x1, F64 y1);
+ bool isTracking() { return mIsTrackingLocation; }
+ bool isTrackingValidLocation() { return mIsTrackingFound && !mIsInvalidLocation; }
+ bool isTrackingInvalidLocation() { return mIsTrackingFound && mIsInvalidLocation; }
+ bool isTrackingDoubleClick() { return mIsTrackingDoubleClick; }
+ bool isTrackingCommit() { return mIsTrackingCommit; }
+ bool isTrackingInRectangle(F64 x0, F64 y0, F64 x1, F64 y1);
- LLVector3d getTrackedPositionGlobal() const { return mTrackingLocation; }
+ LLVector3d getTrackedPositionGlobal() const { return mTrackingLocation; }
- // World Mipmap delegation: currently used when drawing the mipmap
- void equalizeBoostLevels();
- LLPointer<LLViewerFetchedTexture> getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load = true) { return mWorldMipmap.getObjectsTile(grid_x, grid_y, level, load); }
+ // World Mipmap delegation: currently used when drawing the mipmap
+ void equalizeBoostLevels();
+ LLPointer<LLViewerFetchedTexture> getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load = true) { return mWorldMipmap.getObjectsTile(grid_x, grid_y, level, load); }
private:
- bool clearItems(bool force = false); // Clears the item lists
- void clearSimFlags(); // Clears the block flags indicating that we've already requested region infos
-
- // Create a region record corresponding to the handle, insert it in the region map and returns a pointer
- LLSimInfo* createSimInfoFromHandle(const U64 handle);
-
- // Map from region-handle to region info
- sim_info_map_t mSimInfoMap;
-
- // Holds the tiled mipmap of the world. This is the structure that contains the images used for rendering.
- LLWorldMipmap mWorldMipmap;
-
- // The World is divided in "blocks" of (MAP_BLOCK_SIZE x MAP_BLOCK_SIZE) regions that get requested at once.
- // This boolean table avoids "blocks" to be requested multiple times.
- // Issue: Not sure this scheme is foolproof though as I've seen
- // cases where a block is never retrieved and, because of this boolean being set, never re-requested
- bool * mMapBlockLoaded; // Telling us if the block of regions has been requested or not
-
- // Track location data : used while there's nothing tracked yet by LLTracker
- bool mIsTrackingLocation; // True when we're tracking a point
- bool mIsTrackingFound; // True when the tracking position has been found, valid or not
- bool mIsInvalidLocation; // The region is down or the location does not correspond to an existing region
- bool mIsTrackingDoubleClick; // User double clicked to set the location (i.e. teleport when found please...)
- bool mIsTrackingCommit; // User used the search or landmark fields to set the location
- LLVector3d mTrackingLocation; // World global position being tracked
-
- // General grid items request timing flags (used for events,hubs and land for sale)
- LLTimer mRequestTimer;
- bool mFirstRequest;
+ bool clearItems(bool force = false); // Clears the item lists
+ void clearSimFlags(); // Clears the block flags indicating that we've already requested region infos
+
+ // Create a region record corresponding to the handle, insert it in the region map and returns a pointer
+ LLSimInfo* createSimInfoFromHandle(const U64 handle);
+
+ // Map from region-handle to region info
+ sim_info_map_t mSimInfoMap;
+
+ // Holds the tiled mipmap of the world. This is the structure that contains the images used for rendering.
+ LLWorldMipmap mWorldMipmap;
+
+ // The World is divided in "blocks" of (MAP_BLOCK_SIZE x MAP_BLOCK_SIZE) regions that get requested at once.
+ // This boolean table avoids "blocks" to be requested multiple times.
+ // Issue: Not sure this scheme is foolproof though as I've seen
+ // cases where a block is never retrieved and, because of this boolean being set, never re-requested
+ bool * mMapBlockLoaded; // Telling us if the block of regions has been requested or not
+
+ // Track location data : used while there's nothing tracked yet by LLTracker
+ bool mIsTrackingLocation; // True when we're tracking a point
+ bool mIsTrackingFound; // True when the tracking position has been found, valid or not
+ bool mIsInvalidLocation; // The region is down or the location does not correspond to an existing region
+ bool mIsTrackingDoubleClick; // User double clicked to set the location (i.e. teleport when found please...)
+ bool mIsTrackingCommit; // User used the search or landmark fields to set the location
+ LLVector3d mTrackingLocation; // World global position being tracked
+
+ // General grid items request timing flags (used for events,hubs and land for sale)
+ LLTimer mRequestTimer;
+ bool mFirstRequest;
};
#endif
diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp
index e4a9f9afdb..d4c5c04fec 100644
--- a/indra/newview/llworldmapmessage.cpp
+++ b/indra/newview/llworldmapmessage.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llworldmapmessage.cpp
* @brief Handling of the messages to the DB made by and for the world map.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,11 +40,11 @@ const U32 LAYER_FLAG = 2;
//---------------------------------------------------------------------------
LLWorldMapMessage::LLWorldMapMessage() :
- mSLURLRegionName(),
- mSLURLRegionHandle(0),
- mSLURL(),
- mSLURLCallback(0),
- mSLURLTeleport(false)
+ mSLURLRegionName(),
+ mSLURLRegionHandle(0),
+ mSLURL(),
+ mSLURLCallback(0),
+ mSLURLTeleport(false)
{
}
@@ -54,209 +54,209 @@ LLWorldMapMessage::~LLWorldMapMessage()
void LLWorldMapMessage::sendItemRequest(U32 type, U64 handle)
{
- //LL_INFOS("WorldMap") << "Send item request : type = " << type << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessageFast(_PREHASH_MapItemRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addU32Fast(_PREHASH_Flags, LAYER_FLAG);
- msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim
- msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim
-
- msg->nextBlockFast(_PREHASH_RequestData);
- msg->addU32Fast(_PREHASH_ItemType, type);
- msg->addU64Fast(_PREHASH_RegionHandle, handle); // If zero, filled in on sim
-
- gAgent.sendReliableMessage();
+ //LL_INFOS("WorldMap") << "Send item request : type = " << type << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessageFast(_PREHASH_MapItemRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addU32Fast(_PREHASH_Flags, LAYER_FLAG);
+ msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim
+ msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim
+
+ msg->nextBlockFast(_PREHASH_RequestData);
+ msg->addU32Fast(_PREHASH_ItemType, type);
+ msg->addU64Fast(_PREHASH_RegionHandle, handle); // If zero, filled in on sim
+
+ gAgent.sendReliableMessage();
}
void LLWorldMapMessage::sendNamedRegionRequest(std::string region_name)
{
- //LL_INFOS("WorldMap") << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
-
- // Request for region data
- msg->newMessageFast(_PREHASH_MapNameRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addU32Fast(_PREHASH_Flags, LAYER_FLAG);
- msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim
- msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim
- msg->nextBlockFast(_PREHASH_NameData);
- msg->addStringFast(_PREHASH_Name, region_name);
- gAgent.sendReliableMessage();
+ //LL_INFOS("WorldMap") << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+
+ // Request for region data
+ msg->newMessageFast(_PREHASH_MapNameRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addU32Fast(_PREHASH_Flags, LAYER_FLAG);
+ msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim
+ msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim
+ msg->nextBlockFast(_PREHASH_NameData);
+ msg->addStringFast(_PREHASH_Name, region_name);
+ gAgent.sendReliableMessage();
}
-void LLWorldMapMessage::sendNamedRegionRequest(std::string region_name,
- url_callback_t callback,
- const std::string& callback_url,
- bool teleport) // immediately teleport when result returned
+void LLWorldMapMessage::sendNamedRegionRequest(std::string region_name,
+ url_callback_t callback,
+ const std::string& callback_url,
+ bool teleport) // immediately teleport when result returned
{
- //LL_INFOS("WorldMap") << LL_ENDL;
- mSLURLRegionName = region_name;
- mSLURLRegionHandle = 0;
- mSLURL = callback_url;
- mSLURLCallback = callback;
- mSLURLTeleport = teleport;
-
- sendNamedRegionRequest(region_name);
+ //LL_INFOS("WorldMap") << LL_ENDL;
+ mSLURLRegionName = region_name;
+ mSLURLRegionHandle = 0;
+ mSLURL = callback_url;
+ mSLURLCallback = callback;
+ mSLURLTeleport = teleport;
+
+ sendNamedRegionRequest(region_name);
}
-void LLWorldMapMessage::sendHandleRegionRequest(U64 region_handle,
- url_callback_t callback,
- const std::string& callback_url,
- bool teleport) // immediately teleport when result returned
+void LLWorldMapMessage::sendHandleRegionRequest(U64 region_handle,
+ url_callback_t callback,
+ const std::string& callback_url,
+ bool teleport) // immediately teleport when result returned
{
- //LL_INFOS("WorldMap") << LL_ENDL;
- mSLURLRegionName.clear();
- mSLURLRegionHandle = region_handle;
- mSLURL = callback_url;
- mSLURLCallback = callback;
- mSLURLTeleport = teleport;
-
- U32 global_x;
- U32 global_y;
- from_region_handle(region_handle, &global_x, &global_y);
- U16 grid_x = (U16)(global_x / REGION_WIDTH_UNITS);
- U16 grid_y = (U16)(global_y / REGION_WIDTH_UNITS);
-
- sendMapBlockRequest(grid_x, grid_y, grid_x, grid_y, true);
+ //LL_INFOS("WorldMap") << LL_ENDL;
+ mSLURLRegionName.clear();
+ mSLURLRegionHandle = region_handle;
+ mSLURL = callback_url;
+ mSLURLCallback = callback;
+ mSLURLTeleport = teleport;
+
+ U32 global_x;
+ U32 global_y;
+ from_region_handle(region_handle, &global_x, &global_y);
+ U16 grid_x = (U16)(global_x / REGION_WIDTH_UNITS);
+ U16 grid_y = (U16)(global_y / REGION_WIDTH_UNITS);
+
+ sendMapBlockRequest(grid_x, grid_y, grid_x, grid_y, true);
}
void LLWorldMapMessage::sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent)
{
- //LL_INFOS("WorldMap" << " min = (" << min_x << ", " << min_y << "), max = (" << max_x << ", " << max_y << ", nonexistent = " << return_nonexistent << LL_ENDL;
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MapBlockRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- U32 flags = LAYER_FLAG;
- flags |= (return_nonexistent ? 0x10000 : 0);
- msg->addU32Fast(_PREHASH_Flags, flags);
- msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim
- msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim
- msg->nextBlockFast(_PREHASH_PositionData);
- msg->addU16Fast(_PREHASH_MinX, min_x);
- msg->addU16Fast(_PREHASH_MinY, min_y);
- msg->addU16Fast(_PREHASH_MaxX, max_x);
- msg->addU16Fast(_PREHASH_MaxY, max_y);
- gAgent.sendReliableMessage();
+ //LL_INFOS("WorldMap" << " min = (" << min_x << ", " << min_y << "), max = (" << max_x << ", " << max_y << ", nonexistent = " << return_nonexistent << LL_ENDL;
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_MapBlockRequest);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ U32 flags = LAYER_FLAG;
+ flags |= (return_nonexistent ? 0x10000 : 0);
+ msg->addU32Fast(_PREHASH_Flags, flags);
+ msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim
+ msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim
+ msg->nextBlockFast(_PREHASH_PositionData);
+ msg->addU16Fast(_PREHASH_MinX, min_x);
+ msg->addU16Fast(_PREHASH_MinY, min_y);
+ msg->addU16Fast(_PREHASH_MaxX, max_x);
+ msg->addU16Fast(_PREHASH_MaxY, max_y);
+ gAgent.sendReliableMessage();
}
// public static
void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**)
{
- if (gNonInteractive)
- {
- return;
- }
- U32 agent_flags;
- msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags);
-
- // There's only one flag that we ever use here
- if (agent_flags != LAYER_FLAG)
- {
- LL_WARNS() << "Invalid map image type returned! layer = " << agent_flags << LL_ENDL;
- return;
- }
-
- S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data);
- //LL_INFOS("WorldMap") << "num_blocks = " << num_blocks << LL_ENDL;
-
- bool found_null_sim = false;
-
- for (S32 block=0; block<num_blocks; ++block)
- {
- U16 x_regions;
- U16 y_regions;
- std::string name;
- U8 accesscode;
- U32 region_flags;
-// U8 water_height;
-// U8 agents;
- LLUUID image_id;
- msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block);
- msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block);
- msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block);
- msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block);
- msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block);
-// msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block);
-// msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block);
- msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block);
-
- U32 x_world = (U32)(x_regions) * REGION_WIDTH_UNITS;
- U32 y_world = (U32)(y_regions) * REGION_WIDTH_UNITS;
-
- // name shouldn't be empty, see EXT-4568
- llassert(!name.empty());
-
- // Insert that region in the world map, if failure, flag it as a "null_sim"
- if (!(LLWorldMap::getInstance()->insertRegion(x_world, y_world, name, image_id, (U32)accesscode, region_flags)))
- {
- found_null_sim = true;
- }
-
- // If we hit a valid tracking location, do what needs to be done app level wise
- if (LLWorldMap::getInstance()->isTrackingValidLocation())
- {
- LLVector3d pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal();
- if (LLWorldMap::getInstance()->isTrackingDoubleClick())
- {
- // Teleport if the user double clicked
- gAgent.teleportViaLocation(pos_global);
- }
- // Update the "real" tracker information
- gFloaterWorldMap->trackLocation(pos_global);
- }
-
- // Handle the SLURL callback if any
- url_callback_t callback = LLWorldMapMessage::getInstance()->mSLURLCallback;
- if(callback != NULL)
- {
- U64 handle = to_region_handle(x_world, y_world);
- // Check if we reached the requested region
- if ((LLStringUtil::compareInsensitive(LLWorldMapMessage::getInstance()->mSLURLRegionName, name)==0)
- || (LLWorldMapMessage::getInstance()->mSLURLRegionHandle == handle))
- {
- LLWorldMapMessage::getInstance()->mSLURLCallback = NULL;
- LLWorldMapMessage::getInstance()->mSLURLRegionName.clear();
- LLWorldMapMessage::getInstance()->mSLURLRegionHandle = 0;
-
- callback(handle, LLWorldMapMessage::getInstance()->mSLURL, image_id, LLWorldMapMessage::getInstance()->mSLURLTeleport);
- }
- }
- }
- // Tell the UI to update itself
- gFloaterWorldMap->updateSims(found_null_sim);
+ if (gNonInteractive)
+ {
+ return;
+ }
+ U32 agent_flags;
+ msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags);
+
+ // There's only one flag that we ever use here
+ if (agent_flags != LAYER_FLAG)
+ {
+ LL_WARNS() << "Invalid map image type returned! layer = " << agent_flags << LL_ENDL;
+ return;
+ }
+
+ S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data);
+ //LL_INFOS("WorldMap") << "num_blocks = " << num_blocks << LL_ENDL;
+
+ bool found_null_sim = false;
+
+ for (S32 block=0; block<num_blocks; ++block)
+ {
+ U16 x_regions;
+ U16 y_regions;
+ std::string name;
+ U8 accesscode;
+ U32 region_flags;
+// U8 water_height;
+// U8 agents;
+ LLUUID image_id;
+ msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block);
+ msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block);
+ msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block);
+ msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block);
+ msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block);
+// msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block);
+// msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block);
+ msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block);
+
+ U32 x_world = (U32)(x_regions) * REGION_WIDTH_UNITS;
+ U32 y_world = (U32)(y_regions) * REGION_WIDTH_UNITS;
+
+ // name shouldn't be empty, see EXT-4568
+ llassert(!name.empty());
+
+ // Insert that region in the world map, if failure, flag it as a "null_sim"
+ if (!(LLWorldMap::getInstance()->insertRegion(x_world, y_world, name, image_id, (U32)accesscode, region_flags)))
+ {
+ found_null_sim = true;
+ }
+
+ // If we hit a valid tracking location, do what needs to be done app level wise
+ if (LLWorldMap::getInstance()->isTrackingValidLocation())
+ {
+ LLVector3d pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal();
+ if (LLWorldMap::getInstance()->isTrackingDoubleClick())
+ {
+ // Teleport if the user double clicked
+ gAgent.teleportViaLocation(pos_global);
+ }
+ // Update the "real" tracker information
+ gFloaterWorldMap->trackLocation(pos_global);
+ }
+
+ // Handle the SLURL callback if any
+ url_callback_t callback = LLWorldMapMessage::getInstance()->mSLURLCallback;
+ if(callback != NULL)
+ {
+ U64 handle = to_region_handle(x_world, y_world);
+ // Check if we reached the requested region
+ if ((LLStringUtil::compareInsensitive(LLWorldMapMessage::getInstance()->mSLURLRegionName, name)==0)
+ || (LLWorldMapMessage::getInstance()->mSLURLRegionHandle == handle))
+ {
+ LLWorldMapMessage::getInstance()->mSLURLCallback = NULL;
+ LLWorldMapMessage::getInstance()->mSLURLRegionName.clear();
+ LLWorldMapMessage::getInstance()->mSLURLRegionHandle = 0;
+
+ callback(handle, LLWorldMapMessage::getInstance()->mSLURL, image_id, LLWorldMapMessage::getInstance()->mSLURLTeleport);
+ }
+ }
+ }
+ // Tell the UI to update itself
+ gFloaterWorldMap->updateSims(found_null_sim);
}
// public static
void LLWorldMapMessage::processMapItemReply(LLMessageSystem* msg, void**)
{
- //LL_INFOS("WorldMap") << LL_ENDL;
- U32 type;
- msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ItemType, type);
-
- S32 num_blocks = msg->getNumberOfBlocks("Data");
-
- for (S32 block=0; block<num_blocks; ++block)
- {
- U32 X, Y;
- std::string name;
- S32 extra, extra2;
- LLUUID uuid;
- msg->getU32Fast(_PREHASH_Data, _PREHASH_X, X, block);
- msg->getU32Fast(_PREHASH_Data, _PREHASH_Y, Y, block);
- msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block);
- msg->getUUIDFast(_PREHASH_Data, _PREHASH_ID, uuid, block);
- msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra, extra, block);
- msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra2, extra2, block);
-
- LLWorldMap::getInstance()->insertItem(X, Y, name, uuid, type, extra, extra2);
- }
+ //LL_INFOS("WorldMap") << LL_ENDL;
+ U32 type;
+ msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ItemType, type);
+
+ S32 num_blocks = msg->getNumberOfBlocks("Data");
+
+ for (S32 block=0; block<num_blocks; ++block)
+ {
+ U32 X, Y;
+ std::string name;
+ S32 extra, extra2;
+ LLUUID uuid;
+ msg->getU32Fast(_PREHASH_Data, _PREHASH_X, X, block);
+ msg->getU32Fast(_PREHASH_Data, _PREHASH_Y, Y, block);
+ msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block);
+ msg->getUUIDFast(_PREHASH_Data, _PREHASH_ID, uuid, block);
+ msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra, extra, block);
+ msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra2, extra2, block);
+
+ LLWorldMap::getInstance()->insertItem(X, Y, name, uuid, type, extra, extra2);
+ }
}
diff --git a/indra/newview/llworldmapmessage.h b/indra/newview/llworldmapmessage.h
index 65276df068..357d31ccc1 100644
--- a/indra/newview/llworldmapmessage.h
+++ b/indra/newview/llworldmapmessage.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llworldmapmessage.h
* @brief Handling of the messages to the DB made by and for the world map.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,46 +34,46 @@ class LLMessageSystem;
class LLWorldMapMessage : public LLSingleton<LLWorldMapMessage>
{
- LLSINGLETON(LLWorldMapMessage);
- ~LLWorldMapMessage();
+ LLSINGLETON(LLWorldMapMessage);
+ ~LLWorldMapMessage();
public:
- typedef boost::function<void(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)>
- url_callback_t;
+ typedef boost::function<void(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)>
+ url_callback_t;
- // Process incoming answers to map stuff requests
- static void processMapBlockReply(LLMessageSystem*, void**);
- static void processMapItemReply(LLMessageSystem*, void**);
+ // Process incoming answers to map stuff requests
+ static void processMapBlockReply(LLMessageSystem*, void**);
+ static void processMapItemReply(LLMessageSystem*, void**);
- // Request data for all regions in a rectangular area. Coordinates in grids (i.e. meters / 256).
- void sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent = false);
+ // Request data for all regions in a rectangular area. Coordinates in grids (i.e. meters / 256).
+ void sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent = false);
- // Various methods to request LLSimInfo data to the simulator and asset DB
- void sendNamedRegionRequest(std::string region_name);
- void sendNamedRegionRequest(std::string region_name,
- url_callback_t callback,
- const std::string& callback_url,
- bool teleport);
- void sendHandleRegionRequest(U64 region_handle,
- url_callback_t callback,
- const std::string& callback_url,
- bool teleport);
+ // Various methods to request LLSimInfo data to the simulator and asset DB
+ void sendNamedRegionRequest(std::string region_name);
+ void sendNamedRegionRequest(std::string region_name,
+ url_callback_t callback,
+ const std::string& callback_url,
+ bool teleport);
+ void sendHandleRegionRequest(U64 region_handle,
+ url_callback_t callback,
+ const std::string& callback_url,
+ bool teleport);
- // Request item data for regions
- // Note: the handle works *only* when requesting agent count (type = MAP_ITEM_AGENT_LOCATIONS). In that case,
- // the request will actually be transitting through the spaceserver (all that is done on the sim).
- // All other values of type do create a global grid request to the asset DB. So no need to try to get, say,
- // the events for one particular region. For such a request, the handle is ignored.
- void sendItemRequest(U32 type, U64 handle = 0);
+ // Request item data for regions
+ // Note: the handle works *only* when requesting agent count (type = MAP_ITEM_AGENT_LOCATIONS). In that case,
+ // the request will actually be transitting through the spaceserver (all that is done on the sim).
+ // All other values of type do create a global grid request to the asset DB. So no need to try to get, say,
+ // the events for one particular region. For such a request, the handle is ignored.
+ void sendItemRequest(U32 type, U64 handle = 0);
private:
- // Search for region (by name or handle) for SLURL processing and teleport
- // None of this relies explicitly on the LLWorldMap instance so better handle it here
- std::string mSLURLRegionName;
- U64 mSLURLRegionHandle;
- std::string mSLURL;
- url_callback_t mSLURLCallback;
- bool mSLURLTeleport;
+ // Search for region (by name or handle) for SLURL processing and teleport
+ // None of this relies explicitly on the LLWorldMap instance so better handle it here
+ std::string mSLURLRegionName;
+ U64 mSLURLRegionHandle;
+ std::string mSLURL;
+ url_callback_t mSLURLCallback;
+ bool mSLURLTeleport;
};
#endif // LL_LLWORLDMAPMESSAGE_H
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index a8676d2ad6..886f5663e4 100755
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llworldmapview.cpp
* @brief LLWorldMapView class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@
#include "indra_constants.h"
#include "llui.h"
-#include "llmath.h" // clampf()
+#include "llmath.h" // clampf()
#include "llregionhandle.h"
#include "lleventflags.h"
#include "llfloaterreg.h"
@@ -66,7 +66,7 @@ static const F32 MAP_ZOOM_ACCELERATION_TIME = 0.3f;
static const F32 MAP_ZOOM_MAX_INTERP = 0.5f;
static const F32 MAP_SCALE_SNAP_THRESHOLD = 0.005f;
-// Basically a C++ implementation of the OCEAN_COLOR defined in mapstitcher.py
+// Basically a C++ implementation of the OCEAN_COLOR defined in mapstitcher.py
// Please ensure consistency between those 2 files (TODO: would be better to get that color from an asset source...)
// OCEAN_COLOR = "#1D475F"
const F32 OCEAN_RED = (F32)(0x1D)/255.f;
@@ -109,9 +109,9 @@ LLFrameTimer LLWorldMapView::sZoomTimer = LLFrameTimer();
std::map<std::string,std::string> LLWorldMapView::sStringsMap;
// Fetch and draw info thresholds
-const F32 DRAW_TEXT_THRESHOLD = 96.f; // Don't draw text under that resolution value (res = width region in meters)
-const S32 DRAW_SIMINFO_THRESHOLD = 3; // Max level for which we load or display sim level information (level in LLWorldMipmap sense)
-const S32 DRAW_LANDFORSALE_THRESHOLD = 2; // Max level for which we load or display land for sale picture data (level in LLWorldMipmap sense)
+const F32 DRAW_TEXT_THRESHOLD = 96.f; // Don't draw text under that resolution value (res = width region in meters)
+const S32 DRAW_SIMINFO_THRESHOLD = 3; // Max level for which we load or display sim level information (level in LLWorldMipmap sense)
+const S32 DRAW_LANDFORSALE_THRESHOLD = 2; // Max level for which we load or display land for sale picture data (level in LLWorldMipmap sense)
// When on, draw an outline for each mipmap tile gotten from S3
#define DEBUG_DRAW_TILE 0
@@ -119,56 +119,56 @@ const S32 DRAW_LANDFORSALE_THRESHOLD = 2; // Max level for which we load or disp
void LLWorldMapView::initClass()
{
- sAvatarSmallImage = LLUI::getUIImage("map_avatar_8.tga");
- sAvatarYouImage = LLUI::getUIImage("map_avatar_16.tga");
- sAvatarYouLargeImage = LLUI::getUIImage("map_avatar_you_32.tga");
- sAvatarLevelImage = LLUI::getUIImage("map_avatar_32.tga");
- sAvatarAboveImage = LLUI::getUIImage("map_avatar_above_32.tga");
- sAvatarBelowImage = LLUI::getUIImage("map_avatar_below_32.tga");
- sAvatarUnknownImage = LLUI::getUIImage("map_avatar_unknown_32.tga");
-
- sHomeImage = LLUI::getUIImage("map_home.tga");
- sTelehubImage = LLUI::getUIImage("map_telehub.tga");
- sInfohubImage = LLUI::getUIImage("map_infohub.tga");
- sEventImage = LLUI::getUIImage("Parcel_PG_Dark");
- sEventMatureImage = LLUI::getUIImage("Parcel_M_Dark");
- // To Do: update the image resource for adult events.
- sEventAdultImage = LLUI::getUIImage("Parcel_R_Dark");
-
- sTrackCircleImage = LLUI::getUIImage("map_track_16.tga");
- sTrackArrowImage = LLUI::getUIImage("direction_arrow.tga");
- sClassifiedsImage = LLUI::getUIImage("icon_top_pick.tga");
- sForSaleImage = LLUI::getUIImage("icon_for_sale.tga");
- // To Do: update the image resource for adult lands on sale.
- sForSaleAdultImage = LLUI::getUIImage("icon_for_sale_adult.tga");
-
- sStringsMap["loading"] = LLTrans::getString("texture_loading");
- sStringsMap["offline"] = LLTrans::getString("worldmap_offline");
+ sAvatarSmallImage = LLUI::getUIImage("map_avatar_8.tga");
+ sAvatarYouImage = LLUI::getUIImage("map_avatar_16.tga");
+ sAvatarYouLargeImage = LLUI::getUIImage("map_avatar_you_32.tga");
+ sAvatarLevelImage = LLUI::getUIImage("map_avatar_32.tga");
+ sAvatarAboveImage = LLUI::getUIImage("map_avatar_above_32.tga");
+ sAvatarBelowImage = LLUI::getUIImage("map_avatar_below_32.tga");
+ sAvatarUnknownImage = LLUI::getUIImage("map_avatar_unknown_32.tga");
+
+ sHomeImage = LLUI::getUIImage("map_home.tga");
+ sTelehubImage = LLUI::getUIImage("map_telehub.tga");
+ sInfohubImage = LLUI::getUIImage("map_infohub.tga");
+ sEventImage = LLUI::getUIImage("Parcel_PG_Dark");
+ sEventMatureImage = LLUI::getUIImage("Parcel_M_Dark");
+ // To Do: update the image resource for adult events.
+ sEventAdultImage = LLUI::getUIImage("Parcel_R_Dark");
+
+ sTrackCircleImage = LLUI::getUIImage("map_track_16.tga");
+ sTrackArrowImage = LLUI::getUIImage("direction_arrow.tga");
+ sClassifiedsImage = LLUI::getUIImage("icon_top_pick.tga");
+ sForSaleImage = LLUI::getUIImage("icon_for_sale.tga");
+ // To Do: update the image resource for adult lands on sale.
+ sForSaleAdultImage = LLUI::getUIImage("icon_for_sale_adult.tga");
+
+ sStringsMap["loading"] = LLTrans::getString("texture_loading");
+ sStringsMap["offline"] = LLTrans::getString("worldmap_offline");
}
// static
void LLWorldMapView::cleanupClass()
{
- sAvatarSmallImage = NULL;
- sAvatarYouImage = NULL;
- sAvatarYouLargeImage = NULL;
- sAvatarLevelImage = NULL;
- sAvatarAboveImage = NULL;
- sAvatarBelowImage = NULL;
- sAvatarUnknownImage = NULL;
-
- sTelehubImage = NULL;
- sInfohubImage = NULL;
- sHomeImage = NULL;
- sEventImage = NULL;
- sEventMatureImage = NULL;
- sEventAdultImage = NULL;
-
- sTrackCircleImage = NULL;
- sTrackArrowImage = NULL;
- sClassifiedsImage = NULL;
- sForSaleImage = NULL;
- sForSaleAdultImage = NULL;
+ sAvatarSmallImage = NULL;
+ sAvatarYouImage = NULL;
+ sAvatarYouLargeImage = NULL;
+ sAvatarLevelImage = NULL;
+ sAvatarAboveImage = NULL;
+ sAvatarBelowImage = NULL;
+ sAvatarUnknownImage = NULL;
+
+ sTelehubImage = NULL;
+ sInfohubImage = NULL;
+ sHomeImage = NULL;
+ sEventImage = NULL;
+ sEventMatureImage = NULL;
+ sEventAdultImage = NULL;
+
+ sTrackCircleImage = NULL;
+ sTrackArrowImage = NULL;
+ sClassifiedsImage = NULL;
+ sForSaleImage = NULL;
+ sForSaleAdultImage = NULL;
}
LLWorldMapView::LLWorldMapView() :
@@ -196,44 +196,44 @@ LLWorldMapView::LLWorldMapView() :
BOOL LLWorldMapView::postBuild()
{
- mTextBoxNorth = getChild<LLTextBox> ("floater_map_north");
- mTextBoxEast = getChild<LLTextBox> ("floater_map_east");
- mTextBoxWest = getChild<LLTextBox> ("floater_map_west");
- mTextBoxSouth = getChild<LLTextBox> ("floater_map_south");
- mTextBoxSouthEast = getChild<LLTextBox> ("floater_map_southeast");
- mTextBoxNorthEast = getChild<LLTextBox> ("floater_map_northeast");
- mTextBoxSouthWest = getChild<LLTextBox> ("floater_map_southwest");
- mTextBoxNorthWest = getChild<LLTextBox> ("floater_map_northwest");
-
- mTextBoxNorth->setText(getString("world_map_north"));
- mTextBoxEast->setText(getString ("world_map_east"));
- mTextBoxWest->setText(getString("world_map_west"));
- mTextBoxSouth->setText(getString ("world_map_south"));
- mTextBoxSouthEast ->setText(getString ("world_map_southeast"));
- mTextBoxNorthEast ->setText(getString ("world_map_northeast"));
- mTextBoxSouthWest->setText(getString ("world_map_southwest"));
- mTextBoxNorthWest ->setText(getString("world_map_northwest"));
-
- mTextBoxNorth->reshapeToFitText();
- mTextBoxEast->reshapeToFitText();
- mTextBoxWest->reshapeToFitText();
- mTextBoxSouth->reshapeToFitText();
- mTextBoxSouthEast ->reshapeToFitText();
- mTextBoxNorthEast ->reshapeToFitText();
- mTextBoxSouthWest->reshapeToFitText();
- mTextBoxNorthWest ->reshapeToFitText();
-
+ mTextBoxNorth = getChild<LLTextBox> ("floater_map_north");
+ mTextBoxEast = getChild<LLTextBox> ("floater_map_east");
+ mTextBoxWest = getChild<LLTextBox> ("floater_map_west");
+ mTextBoxSouth = getChild<LLTextBox> ("floater_map_south");
+ mTextBoxSouthEast = getChild<LLTextBox> ("floater_map_southeast");
+ mTextBoxNorthEast = getChild<LLTextBox> ("floater_map_northeast");
+ mTextBoxSouthWest = getChild<LLTextBox> ("floater_map_southwest");
+ mTextBoxNorthWest = getChild<LLTextBox> ("floater_map_northwest");
+
+ mTextBoxNorth->setText(getString("world_map_north"));
+ mTextBoxEast->setText(getString ("world_map_east"));
+ mTextBoxWest->setText(getString("world_map_west"));
+ mTextBoxSouth->setText(getString ("world_map_south"));
+ mTextBoxSouthEast ->setText(getString ("world_map_southeast"));
+ mTextBoxNorthEast ->setText(getString ("world_map_northeast"));
+ mTextBoxSouthWest->setText(getString ("world_map_southwest"));
+ mTextBoxNorthWest ->setText(getString("world_map_northwest"));
+
+ mTextBoxNorth->reshapeToFitText();
+ mTextBoxEast->reshapeToFitText();
+ mTextBoxWest->reshapeToFitText();
+ mTextBoxSouth->reshapeToFitText();
+ mTextBoxSouthEast ->reshapeToFitText();
+ mTextBoxNorthEast ->reshapeToFitText();
+ mTextBoxSouthWest->reshapeToFitText();
+ mTextBoxNorthWest ->reshapeToFitText();
+
sZoomTimer.stop();
setScale(sMapScaleSetting, true);
- return true;
+ return true;
}
LLWorldMapView::~LLWorldMapView()
{
- //LL_INFOS("WorldMap") << "Destroying the map -> LLWorldMapView::~LLWorldMapView()" << LL_ENDL;
- cleanupTextures();
+ //LL_INFOS("WorldMap") << "Destroying the map -> LLWorldMapView::~LLWorldMapView()" << LL_ENDL;
+ cleanupTextures();
}
@@ -352,25 +352,25 @@ bool LLWorldMapView::showRegionInfo() { return (LLWorldMipmap::scaleToLevel(mMap
BOOL is_agent_in_region(LLViewerRegion* region, LLSimInfo* info)
{
- return (region && info && info->isName(region->getName()));
+ return (region && info && info->isName(region->getName()));
}
///////////////////////////////////////////////////////////////////////////////////
void LLWorldMapView::draw()
{
- static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
-
- LLTextureView::clearDebugImages();
+ static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
- F64 current_time = LLTimer::getElapsedSeconds();
+ LLTextureView::clearDebugImages();
- mVisibleRegions.clear();
+ F64 current_time = LLTimer::getElapsedSeconds();
+
+ mVisibleRegions.clear();
// animate pan if necessary
mPanX = lerp(mPanX, mTargetPanX, LLSmoothInterpolation::getInterpolant(mMapIterpTime));
mPanY = lerp(mPanY, mTargetPanY, LLSmoothInterpolation::getInterpolant(mMapIterpTime));
-
+
//RN: snaps to zoom value because interpolation caused jitter in the text rendering
if (!sZoomTimer.getStarted() && mMapScale != mTargetMapScale)
{
@@ -390,1439 +390,1439 @@ void LLWorldMapView::draw()
F32 map_scale = scaleFromZoom(new_zoom_val);
setScale(map_scale, snap_scale);
- const S32 width = getRect().getWidth();
- const S32 height = getRect().getHeight();
- const F32 half_width = F32(width) / 2.0f;
- const F32 half_height = F32(height) / 2.0f;
- LLVector3d camera_global = gAgentCamera.getCameraPositionGlobal();
+ const S32 width = getRect().getWidth();
+ const S32 height = getRect().getHeight();
+ const F32 half_width = F32(width) / 2.0f;
+ const F32 half_height = F32(height) / 2.0f;
+ LLVector3d camera_global = gAgentCamera.getCameraPositionGlobal();
- S32 level = LLWorldMipmap::scaleToLevel(mMapScale);
+ S32 level = LLWorldMipmap::scaleToLevel(mMapScale);
- LLLocalClipRect clip(getLocalRect());
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLLocalClipRect clip(getLocalRect());
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
// Draw background rectangle
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4fv(mBackgroundColor.mV);
gl_rect_2d(0, height, width, 0);
- // Draw the image tiles
- drawMipmap(width, height);
-
- // Draw per sim overlayed information (names, mature, offline...)
- for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin();
- it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
- {
- U64 handle = it->first;
- LLSimInfo* info = it->second;
-
- LLVector3d origin_global = from_region_handle(handle);
-
- // Find x and y position relative to camera's center.
- LLVector3d rel_region_pos = origin_global - camera_global;
- F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * mMapScale;
- F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * mMapScale;
-
- // Coordinates of the sim in pixels in the UI panel
- // When the view isn't panned, 0,0 = center of rectangle
- F32 bottom = mPanY + half_height + relative_y;
- F32 left = mPanX + half_width + relative_x;
- F32 top = bottom + mMapScale ;
- F32 right = left + mMapScale ;
-
- // Discard if region is outside the screen rectangle (not visible on screen)
- if ((top < 0.f) || (bottom > height) ||
- (right < 0.f) || (left > width) )
- {
- // Drop the "land for sale" fetching priority since it's outside the view rectangle
- info->dropImagePriority();
- continue;
- }
-
- // This list is used by other methods to know which regions are indeed displayed on screen
-
- mVisibleRegions.push_back(handle);
-
- // Update the agent count for that region if we're not too zoomed out already
- if (level <= DRAW_SIMINFO_THRESHOLD)
- {
- info->updateAgentCount(current_time);
- }
-
- if (info->isDown())
- {
- // Draw a transparent red square over down sims
- gGL.color4f(0.2f, 0.0f, 0.0f, 0.4f);
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.begin(LLRender::QUADS);
- gGL.vertex2f(left, top);
- gGL.vertex2f(left, bottom);
- gGL.vertex2f(right, bottom);
- gGL.vertex2f(right, top);
- gGL.end();
- }
+ // Draw the image tiles
+ drawMipmap(width, height);
+
+ // Draw per sim overlayed information (names, mature, offline...)
+ for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin();
+ it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
+ {
+ U64 handle = it->first;
+ LLSimInfo* info = it->second;
+
+ LLVector3d origin_global = from_region_handle(handle);
+
+ // Find x and y position relative to camera's center.
+ LLVector3d rel_region_pos = origin_global - camera_global;
+ F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * mMapScale;
+ F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * mMapScale;
+
+ // Coordinates of the sim in pixels in the UI panel
+ // When the view isn't panned, 0,0 = center of rectangle
+ F32 bottom = mPanY + half_height + relative_y;
+ F32 left = mPanX + half_width + relative_x;
+ F32 top = bottom + mMapScale ;
+ F32 right = left + mMapScale ;
+
+ // Discard if region is outside the screen rectangle (not visible on screen)
+ if ((top < 0.f) || (bottom > height) ||
+ (right < 0.f) || (left > width) )
+ {
+ // Drop the "land for sale" fetching priority since it's outside the view rectangle
+ info->dropImagePriority();
+ continue;
+ }
+
+ // This list is used by other methods to know which regions are indeed displayed on screen
+
+ mVisibleRegions.push_back(handle);
+
+ // Update the agent count for that region if we're not too zoomed out already
+ if (level <= DRAW_SIMINFO_THRESHOLD)
+ {
+ info->updateAgentCount(current_time);
+ }
+
+ if (info->isDown())
+ {
+ // Draw a transparent red square over down sims
+ gGL.color4f(0.2f, 0.0f, 0.0f, 0.4f);
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.begin(LLRender::QUADS);
+ gGL.vertex2f(left, top);
+ gGL.vertex2f(left, bottom);
+ gGL.vertex2f(right, bottom);
+ gGL.vertex2f(right, top);
+ gGL.end();
+ }
else if (gSavedSettings.getBOOL("MapShowLandForSale") && (level <= DRAW_LANDFORSALE_THRESHOLD))
- {
- // Draw the overlay image "Land for Sale / Land for Auction"
- LLViewerFetchedTexture* overlayimage = info->getLandForSaleImage();
- if (overlayimage)
- {
- // Inform the fetch mechanism of the size we need
- S32 draw_size = ll_round(mMapScale);
- overlayimage->setKnownDrawSize(ll_round(draw_size * LLUI::getScaleFactor().mV[VX]), ll_round(draw_size * LLUI::getScaleFactor().mV[VY]));
- // Draw something whenever we have enough info
- if (overlayimage->hasGLTexture())
- {
- gGL.getTexUnit(0)->bind(overlayimage);
- gGL.color4f(1.f, 1.f, 1.f, 1.f);
- gGL.begin(LLRender::QUADS);
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex3f(left, top, -0.5f);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex3f(left, bottom, -0.5f);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex3f(right, bottom, -0.5f);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex3f(right, top, -0.5f);
- gGL.end();
- }
- }
- }
- else
- {
- // If we're not displaying the "land for sale", drop its fetching priority
- info->dropImagePriority();
- }
-
- // Draw the region name in the lower left corner
- if (mMapScale >= DRAW_TEXT_THRESHOLD)
- {
- LLFontGL* font = LLFontGL::getFont(LLFontDescriptor("SansSerif", "Small", LLFontGL::BOLD));
- std::string mesg;
- if (info->isDown())
- {
- mesg = llformat( "%s (%s)", info->getName().c_str(), sStringsMap["offline"].c_str());
- }
- else
- {
- mesg = info->getName();
- }
- if (!mesg.empty())
- {
- font->renderUTF8(
- mesg, 0,
- llfloor(left + 3), llfloor(bottom + 2),
- LLColor4::white,
- LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW,
- S32_MAX, //max_chars
- mMapScale, //max_pixels
- NULL,
- /*use_ellipses*/TRUE);
- }
- }
- }
-
- // Draw item infos if we're not zoomed out too much and there's something to draw
- if ((level <= DRAW_SIMINFO_THRESHOLD) && (gSavedSettings.getBOOL("MapShowInfohubs") ||
- gSavedSettings.getBOOL("MapShowTelehubs") ||
- gSavedSettings.getBOOL("MapShowLandForSale") ||
- gSavedSettings.getBOOL("MapShowEvents") ||
- gSavedSettings.getBOOL("ShowMatureEvents") ||
- gSavedSettings.getBOOL("ShowAdultEvents")))
- {
- drawItems();
- }
-
- // Draw the Home location (always)
- LLVector3d home;
- if (gAgent.getHomePosGlobal(&home))
- {
- drawImage(home, sHomeImage);
- }
-
- // Draw the current agent after all that other stuff.
- LLVector3d pos_global = gAgent.getPositionGlobal();
- drawImage(pos_global, sAvatarYouImage);
-
- LLVector3 pos_map = globalPosToView(pos_global);
- if (!pointInView(ll_round(pos_map.mV[VX]), ll_round(pos_map.mV[VY])))
- {
- drawTracking(pos_global,
- lerp(LLColor4::yellow, LLColor4::orange, 0.4f),
- TRUE,
- "You are here",
- "",
- LLFontGL::getFontSansSerifSmall()->getLineHeight()); // offset vertically by one line, to avoid overlap with target tracking
- }
-
- // Draw the current agent viewing angle
- drawFrustum();
-
- // Draw icons for the avatars in each region.
- // Drawn this after the current agent avatar so one can see nearby people
- if (gSavedSettings.getBOOL("MapShowPeople") && (level <= DRAW_SIMINFO_THRESHOLD))
- {
- drawAgents();
- }
-
- // Always draw tracking information
- LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
- if ( LLTracker::TRACKING_AVATAR == tracking_status )
- {
- drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color, TRUE, LLTracker::getLabel(), "" );
- }
- else if ( LLTracker::TRACKING_LANDMARK == tracking_status
- || LLTracker::TRACKING_LOCATION == tracking_status )
- {
- // While fetching landmarks, will have 0,0,0 location for a while,
- // so don't draw. JC
- LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
- if (!pos_global.isExactlyZero())
- {
- drawTracking( pos_global, map_track_color, TRUE, LLTracker::getLabel(), LLTracker::getToolTip() );
- }
- }
- else if (LLWorldMap::getInstance()->isTracking())
- {
- if (LLWorldMap::getInstance()->isTrackingInvalidLocation())
- {
- // We know this location to be invalid, draw a blue circle
- LLColor4 loading_color(0.0, 0.5, 1.0, 1.0);
- drawTracking( LLWorldMap::getInstance()->getTrackedPositionGlobal(), loading_color, TRUE, getString("InvalidLocation"), "");
- }
- else
- {
- // We don't know yet what that location is, draw a throbing blue circle
- double value = fmod(current_time, 2);
- value = 0.5 + 0.5*cos(value * F_PI);
- LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0);
- drawTracking( LLWorldMap::getInstance()->getTrackedPositionGlobal(), loading_color, TRUE, getString("Loading"), "");
- }
- }
-
-
- // turn off the scissor
- LLGLDisable no_scissor(GL_SCISSOR_TEST);
-
- updateDirections();
-
- LLView::draw();
-
- // Get sim info for all sims in view
- updateVisibleBlocks();
+ {
+ // Draw the overlay image "Land for Sale / Land for Auction"
+ LLViewerFetchedTexture* overlayimage = info->getLandForSaleImage();
+ if (overlayimage)
+ {
+ // Inform the fetch mechanism of the size we need
+ S32 draw_size = ll_round(mMapScale);
+ overlayimage->setKnownDrawSize(ll_round(draw_size * LLUI::getScaleFactor().mV[VX]), ll_round(draw_size * LLUI::getScaleFactor().mV[VY]));
+ // Draw something whenever we have enough info
+ if (overlayimage->hasGLTexture())
+ {
+ gGL.getTexUnit(0)->bind(overlayimage);
+ gGL.color4f(1.f, 1.f, 1.f, 1.f);
+ gGL.begin(LLRender::QUADS);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3f(left, top, -0.5f);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3f(left, bottom, -0.5f);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3f(right, bottom, -0.5f);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3f(right, top, -0.5f);
+ gGL.end();
+ }
+ }
+ }
+ else
+ {
+ // If we're not displaying the "land for sale", drop its fetching priority
+ info->dropImagePriority();
+ }
+
+ // Draw the region name in the lower left corner
+ if (mMapScale >= DRAW_TEXT_THRESHOLD)
+ {
+ LLFontGL* font = LLFontGL::getFont(LLFontDescriptor("SansSerif", "Small", LLFontGL::BOLD));
+ std::string mesg;
+ if (info->isDown())
+ {
+ mesg = llformat( "%s (%s)", info->getName().c_str(), sStringsMap["offline"].c_str());
+ }
+ else
+ {
+ mesg = info->getName();
+ }
+ if (!mesg.empty())
+ {
+ font->renderUTF8(
+ mesg, 0,
+ llfloor(left + 3), llfloor(bottom + 2),
+ LLColor4::white,
+ LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW,
+ S32_MAX, //max_chars
+ mMapScale, //max_pixels
+ NULL,
+ /*use_ellipses*/TRUE);
+ }
+ }
+ }
+
+ // Draw item infos if we're not zoomed out too much and there's something to draw
+ if ((level <= DRAW_SIMINFO_THRESHOLD) && (gSavedSettings.getBOOL("MapShowInfohubs") ||
+ gSavedSettings.getBOOL("MapShowTelehubs") ||
+ gSavedSettings.getBOOL("MapShowLandForSale") ||
+ gSavedSettings.getBOOL("MapShowEvents") ||
+ gSavedSettings.getBOOL("ShowMatureEvents") ||
+ gSavedSettings.getBOOL("ShowAdultEvents")))
+ {
+ drawItems();
+ }
+
+ // Draw the Home location (always)
+ LLVector3d home;
+ if (gAgent.getHomePosGlobal(&home))
+ {
+ drawImage(home, sHomeImage);
+ }
+
+ // Draw the current agent after all that other stuff.
+ LLVector3d pos_global = gAgent.getPositionGlobal();
+ drawImage(pos_global, sAvatarYouImage);
+
+ LLVector3 pos_map = globalPosToView(pos_global);
+ if (!pointInView(ll_round(pos_map.mV[VX]), ll_round(pos_map.mV[VY])))
+ {
+ drawTracking(pos_global,
+ lerp(LLColor4::yellow, LLColor4::orange, 0.4f),
+ TRUE,
+ "You are here",
+ "",
+ LLFontGL::getFontSansSerifSmall()->getLineHeight()); // offset vertically by one line, to avoid overlap with target tracking
+ }
+
+ // Draw the current agent viewing angle
+ drawFrustum();
+
+ // Draw icons for the avatars in each region.
+ // Drawn this after the current agent avatar so one can see nearby people
+ if (gSavedSettings.getBOOL("MapShowPeople") && (level <= DRAW_SIMINFO_THRESHOLD))
+ {
+ drawAgents();
+ }
+
+ // Always draw tracking information
+ LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
+ if ( LLTracker::TRACKING_AVATAR == tracking_status )
+ {
+ drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color, TRUE, LLTracker::getLabel(), "" );
+ }
+ else if ( LLTracker::TRACKING_LANDMARK == tracking_status
+ || LLTracker::TRACKING_LOCATION == tracking_status )
+ {
+ // While fetching landmarks, will have 0,0,0 location for a while,
+ // so don't draw. JC
+ LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
+ if (!pos_global.isExactlyZero())
+ {
+ drawTracking( pos_global, map_track_color, TRUE, LLTracker::getLabel(), LLTracker::getToolTip() );
+ }
+ }
+ else if (LLWorldMap::getInstance()->isTracking())
+ {
+ if (LLWorldMap::getInstance()->isTrackingInvalidLocation())
+ {
+ // We know this location to be invalid, draw a blue circle
+ LLColor4 loading_color(0.0, 0.5, 1.0, 1.0);
+ drawTracking( LLWorldMap::getInstance()->getTrackedPositionGlobal(), loading_color, TRUE, getString("InvalidLocation"), "");
+ }
+ else
+ {
+ // We don't know yet what that location is, draw a throbing blue circle
+ double value = fmod(current_time, 2);
+ value = 0.5 + 0.5*cos(value * F_PI);
+ LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0);
+ drawTracking( LLWorldMap::getInstance()->getTrackedPositionGlobal(), loading_color, TRUE, getString("Loading"), "");
+ }
+ }
+
+
+ // turn off the scissor
+ LLGLDisable no_scissor(GL_SCISSOR_TEST);
+
+ updateDirections();
+
+ LLView::draw();
+
+ // Get sim info for all sims in view
+ updateVisibleBlocks();
} // end draw()
//virtual
void LLWorldMapView::setVisible(BOOL visible)
{
- LLPanel::setVisible(visible);
- if (!visible)
- {
- // Drop the download of tiles and images priority to nil if we hide the map
- LLWorldMap::getInstance()->dropImagePriorities();
- }
+ LLPanel::setVisible(visible);
+ if (!visible)
+ {
+ // Drop the download of tiles and images priority to nil if we hide the map
+ LLWorldMap::getInstance()->dropImagePriorities();
+ }
}
void LLWorldMapView::drawMipmap(S32 width, S32 height)
{
- // Compute the level of the mipmap to use for the current scale level
- S32 level = LLWorldMipmap::scaleToLevel(mMapScale);
- // Set the tile boost level so that unused tiles get to 0
- LLWorldMap::getInstance()->equalizeBoostLevels();
-
- // Render whatever we already have loaded if we haven't the current level
- // complete and use it as a background (scaled up or scaled down)
- if (!sVisibleTilesLoaded)
- {
- // Note: the (load = false) parameter avoids missing tiles to be fetched (i.e. we render what we have, no more)
- // Check all the lower res levels and render them in reverse order (worse to best)
- // We need to traverse all the levels as the user can zoom in very fast
- for (S32 l = LLWorldMipmap::MAP_LEVELS; l > level; l--)
- {
- drawMipmapLevel(width, height, l, false);
- }
- // Skip the current level, as we'll do it anyway here under...
-
- // Just go one level down in res as it can really get too much stuff
- // when zooming out and too small to see anyway...
- if (level > 1)
- {
- drawMipmapLevel(width, height, level - 1, false);
- }
- }
- else
- {
- //LL_INFOS("WorldMap") << "Render complete, don't draw background..." << LL_ENDL;
- }
-
- // Render the current level
- sVisibleTilesLoaded = drawMipmapLevel(width, height, level);
-
- return;
+ // Compute the level of the mipmap to use for the current scale level
+ S32 level = LLWorldMipmap::scaleToLevel(mMapScale);
+ // Set the tile boost level so that unused tiles get to 0
+ LLWorldMap::getInstance()->equalizeBoostLevels();
+
+ // Render whatever we already have loaded if we haven't the current level
+ // complete and use it as a background (scaled up or scaled down)
+ if (!sVisibleTilesLoaded)
+ {
+ // Note: the (load = false) parameter avoids missing tiles to be fetched (i.e. we render what we have, no more)
+ // Check all the lower res levels and render them in reverse order (worse to best)
+ // We need to traverse all the levels as the user can zoom in very fast
+ for (S32 l = LLWorldMipmap::MAP_LEVELS; l > level; l--)
+ {
+ drawMipmapLevel(width, height, l, false);
+ }
+ // Skip the current level, as we'll do it anyway here under...
+
+ // Just go one level down in res as it can really get too much stuff
+ // when zooming out and too small to see anyway...
+ if (level > 1)
+ {
+ drawMipmapLevel(width, height, level - 1, false);
+ }
+ }
+ else
+ {
+ //LL_INFOS("WorldMap") << "Render complete, don't draw background..." << LL_ENDL;
+ }
+
+ // Render the current level
+ sVisibleTilesLoaded = drawMipmapLevel(width, height, level);
+
+ return;
}
// Return true if all the tiles required to render that level have been fetched or are truly missing
bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load)
{
- // Check input level
- llassert (level > 0);
- if (level <= 0)
- return false;
-
- // Count tiles hit and completed
- S32 completed_tiles = 0;
- S32 total_tiles = 0;
-
- // Size in meters (global) of each tile of that level
- S32 tile_width = LLWorldMipmap::MAP_TILE_SIZE * (1 << (level - 1));
- // Dimension of the screen in meter at that scale
- LLVector3d pos_SW = viewPosToGlobal(0, 0);
- LLVector3d pos_NE = viewPosToGlobal(width, height);
- // Add external band of tiles on the outskirt so to hit the partially displayed tiles right and top
- pos_NE[VX] += tile_width;
- pos_NE[VY] += tile_width;
-
- // Iterate through the tiles on screen: we just need to ask for one tile every tile_width meters
- U32 grid_x, grid_y;
- for (F64 index_y = pos_SW[VY]; index_y < pos_NE[VY]; index_y += tile_width)
- {
- for (F64 index_x = pos_SW[VX]; index_x < pos_NE[VX]; index_x += tile_width)
- {
- // Compute the world coordinates of the current point
- LLVector3d pos_global(index_x, index_y, pos_SW[VZ]);
- // Convert to the mipmap level coordinates for that point (i.e. which tile to we hit)
- LLWorldMipmap::globalToMipmap(pos_global[VX], pos_global[VY], level, &grid_x, &grid_y);
- // Get the tile. Note: NULL means that the image does not exist (so it's considered "complete" as far as fetching is concerned)
- LLPointer<LLViewerFetchedTexture> simimage = LLWorldMap::getInstance()->getObjectsTile(grid_x, grid_y, level, load);
- if (simimage)
- {
- // Checks that the image has a valid texture
- if (simimage->hasGLTexture())
- {
- // Increment the number of completly fetched tiles
- completed_tiles++;
-
- // Convert those coordinates (SW corner of the mipmap tile) into world (meters) coordinates
- pos_global[VX] = grid_x * REGION_WIDTH_METERS;
- pos_global[VY] = grid_y * REGION_WIDTH_METERS;
- // Now to screen coordinates for SW corner of that tile
- LLVector3 pos_screen = globalPosToView (pos_global);
- F32 left = pos_screen[VX];
- F32 bottom = pos_screen[VY];
- // Compute the NE corner coordinates of the tile now
- pos_global[VX] += tile_width;
- pos_global[VY] += tile_width;
- pos_screen = globalPosToView (pos_global);
- F32 right = pos_screen[VX];
- F32 top = pos_screen[VY];
-
- // Draw the tile
- LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->bind(simimage.get());
- simimage->setAddressMode(LLTexUnit::TAM_CLAMP);
-
- gGL.color4f(1.f, 1.0f, 1.0f, 1.0f);
-
- gGL.begin(LLRender::QUADS);
- gGL.texCoord2f(0.f, 1.f);
- gGL.vertex3f(left, top, 0.f);
- gGL.texCoord2f(0.f, 0.f);
- gGL.vertex3f(left, bottom, 0.f);
- gGL.texCoord2f(1.f, 0.f);
- gGL.vertex3f(right, bottom, 0.f);
- gGL.texCoord2f(1.f, 1.f);
- gGL.vertex3f(right, top, 0.f);
- gGL.end();
+ // Check input level
+ llassert (level > 0);
+ if (level <= 0)
+ return false;
+
+ // Count tiles hit and completed
+ S32 completed_tiles = 0;
+ S32 total_tiles = 0;
+
+ // Size in meters (global) of each tile of that level
+ S32 tile_width = LLWorldMipmap::MAP_TILE_SIZE * (1 << (level - 1));
+ // Dimension of the screen in meter at that scale
+ LLVector3d pos_SW = viewPosToGlobal(0, 0);
+ LLVector3d pos_NE = viewPosToGlobal(width, height);
+ // Add external band of tiles on the outskirt so to hit the partially displayed tiles right and top
+ pos_NE[VX] += tile_width;
+ pos_NE[VY] += tile_width;
+
+ // Iterate through the tiles on screen: we just need to ask for one tile every tile_width meters
+ U32 grid_x, grid_y;
+ for (F64 index_y = pos_SW[VY]; index_y < pos_NE[VY]; index_y += tile_width)
+ {
+ for (F64 index_x = pos_SW[VX]; index_x < pos_NE[VX]; index_x += tile_width)
+ {
+ // Compute the world coordinates of the current point
+ LLVector3d pos_global(index_x, index_y, pos_SW[VZ]);
+ // Convert to the mipmap level coordinates for that point (i.e. which tile to we hit)
+ LLWorldMipmap::globalToMipmap(pos_global[VX], pos_global[VY], level, &grid_x, &grid_y);
+ // Get the tile. Note: NULL means that the image does not exist (so it's considered "complete" as far as fetching is concerned)
+ LLPointer<LLViewerFetchedTexture> simimage = LLWorldMap::getInstance()->getObjectsTile(grid_x, grid_y, level, load);
+ if (simimage)
+ {
+ // Checks that the image has a valid texture
+ if (simimage->hasGLTexture())
+ {
+ // Increment the number of completly fetched tiles
+ completed_tiles++;
+
+ // Convert those coordinates (SW corner of the mipmap tile) into world (meters) coordinates
+ pos_global[VX] = grid_x * REGION_WIDTH_METERS;
+ pos_global[VY] = grid_y * REGION_WIDTH_METERS;
+ // Now to screen coordinates for SW corner of that tile
+ LLVector3 pos_screen = globalPosToView (pos_global);
+ F32 left = pos_screen[VX];
+ F32 bottom = pos_screen[VY];
+ // Compute the NE corner coordinates of the tile now
+ pos_global[VX] += tile_width;
+ pos_global[VY] += tile_width;
+ pos_screen = globalPosToView (pos_global);
+ F32 right = pos_screen[VX];
+ F32 top = pos_screen[VY];
+
+ // Draw the tile
+ LLGLSUIDefault gls_ui;
+ gGL.getTexUnit(0)->bind(simimage.get());
+ simimage->setAddressMode(LLTexUnit::TAM_CLAMP);
+
+ gGL.color4f(1.f, 1.0f, 1.0f, 1.0f);
+
+ gGL.begin(LLRender::QUADS);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3f(left, top, 0.f);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3f(left, bottom, 0.f);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3f(right, bottom, 0.f);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3f(right, top, 0.f);
+ gGL.end();
#if DEBUG_DRAW_TILE
- drawTileOutline(level, top, left, bottom, right);
+ drawTileOutline(level, top, left, bottom, right);
#endif // DEBUG_DRAW_TILE
- }
- //else
- //{
- // Waiting for a tile -> the level is not complete
- // LL_INFOS("WorldMap") << "Unfetched tile. level = " << level << LL_ENDL;
- //}
- }
- else
- {
- // Unexistent tiles are counted as "completed"
- completed_tiles++;
- }
- // Increment the number of tiles in that level / screen
- total_tiles++;
- }
- }
- return (completed_tiles == total_tiles);
+ }
+ //else
+ //{
+ // Waiting for a tile -> the level is not complete
+ // LL_INFOS("WorldMap") << "Unfetched tile. level = " << level << LL_ENDL;
+ //}
+ }
+ else
+ {
+ // Unexistent tiles are counted as "completed"
+ completed_tiles++;
+ }
+ // Increment the number of tiles in that level / screen
+ total_tiles++;
+ }
+ }
+ return (completed_tiles == total_tiles);
}
// Draw lines (rectangle outline and cross) to visualize the position of the tile
// Used for debug only
void LLWorldMapView::drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F32 right)
{
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- if (level == 1)
- gGL.color3f(1.f, 0.f, 0.f); // red
- else if (level == 2)
- gGL.color3f(0.f, 1.f, 0.f); // green
- else if (level == 3)
- gGL.color3f(0.f, 0.f, 1.f); // blue
- else if (level == 4)
- gGL.color3f(1.f, 1.f, 0.f); // yellow
- else if (level == 5)
- gGL.color3f(1.f, 0.f, 1.f); // magenta
- else if (level == 6)
- gGL.color3f(0.f, 1.f, 1.f); // cyan
- else if (level == 7)
- gGL.color3f(1.f, 1.f, 1.f); // white
- else
- gGL.color3f(0.f, 0.f, 0.f); // black
- gGL.begin(LLRender::LINE_STRIP);
- gGL.vertex2f(left, top);
- gGL.vertex2f(right, bottom);
- gGL.vertex2f(left, bottom);
- gGL.vertex2f(right, top);
- gGL.vertex2f(left, top);
- gGL.vertex2f(left, bottom);
- gGL.vertex2f(right, bottom);
- gGL.vertex2f(right, top);
- gGL.end();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ if (level == 1)
+ gGL.color3f(1.f, 0.f, 0.f); // red
+ else if (level == 2)
+ gGL.color3f(0.f, 1.f, 0.f); // green
+ else if (level == 3)
+ gGL.color3f(0.f, 0.f, 1.f); // blue
+ else if (level == 4)
+ gGL.color3f(1.f, 1.f, 0.f); // yellow
+ else if (level == 5)
+ gGL.color3f(1.f, 0.f, 1.f); // magenta
+ else if (level == 6)
+ gGL.color3f(0.f, 1.f, 1.f); // cyan
+ else if (level == 7)
+ gGL.color3f(1.f, 1.f, 1.f); // white
+ else
+ gGL.color3f(0.f, 0.f, 0.f); // black
+ gGL.begin(LLRender::LINE_STRIP);
+ gGL.vertex2f(left, top);
+ gGL.vertex2f(right, bottom);
+ gGL.vertex2f(left, bottom);
+ gGL.vertex2f(right, top);
+ gGL.vertex2f(left, top);
+ gGL.vertex2f(left, bottom);
+ gGL.vertex2f(right, bottom);
+ gGL.vertex2f(right, top);
+ gGL.end();
}
void LLWorldMapView::drawGenericItems(const LLSimInfo::item_info_list_t& items, LLUIImagePtr image)
{
- LLSimInfo::item_info_list_t::const_iterator e;
- for (e = items.begin(); e != items.end(); ++e)
- {
- drawGenericItem(*e, image);
- }
+ LLSimInfo::item_info_list_t::const_iterator e;
+ for (e = items.begin(); e != items.end(); ++e)
+ {
+ drawGenericItem(*e, image);
+ }
}
void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLUIImagePtr image)
{
- drawImage(item.getGlobalPosition(), image);
+ drawImage(item.getGlobalPosition(), image);
}
void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color)
{
- LLVector3 pos_map = globalPosToView( global_pos );
- image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f),
- ll_round(pos_map.mV[VY] - image->getHeight()/2.f),
- color);
+ LLVector3 pos_map = globalPosToView( global_pos );
+ image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f),
+ ll_round(pos_map.mV[VY] - image->getHeight()/2.f),
+ color);
}
void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color)
{
- LLVector3 pos_map = globalPosToView( global_pos );
- for(U32 i=0; i<count; i++)
- {
- image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f),
- ll_round(pos_map.mV[VY] - image->getHeight()/2.f + i*offset),
- color);
- }
+ LLVector3 pos_map = globalPosToView( global_pos );
+ for(U32 i=0; i<count; i++)
+ {
+ image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f),
+ ll_round(pos_map.mV[VY] - image->getHeight()/2.f + i*offset),
+ color);
+ }
}
void LLWorldMapView::drawItems()
{
- bool mature_enabled = gAgent.canAccessMature();
- bool adult_enabled = gAgent.canAccessAdult();
+ bool mature_enabled = gAgent.canAccessMature();
+ bool adult_enabled = gAgent.canAccessAdult();
BOOL show_mature = mature_enabled && gSavedSettings.getBOOL("ShowMatureEvents");
- BOOL show_adult = adult_enabled && gSavedSettings.getBOOL("ShowAdultEvents");
-
- for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
- {
- U64 handle = *iter;
- LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle);
- if ((info == NULL) || (info->isDown()))
- {
- continue;
- }
- // Infohubs
- if (gSavedSettings.getBOOL("MapShowInfohubs"))
- {
- drawGenericItems(info->getInfoHub(), sInfohubImage);
- }
- // Telehubs
- if (gSavedSettings.getBOOL("MapShowTelehubs"))
- {
- drawGenericItems(info->getTeleHub(), sTelehubImage);
- }
- // Land for sale
- if (gSavedSettings.getBOOL("MapShowLandForSale"))
- {
- drawGenericItems(info->getLandForSale(), sForSaleImage);
- // for 1.23, we're showing normal land and adult land in the same UI; you don't
- // get a choice about which ones you want. If you're currently asking for adult
- // content and land you'll get the adult land.
- if (gAgent.canAccessAdult())
- {
- drawGenericItems(info->getLandForSaleAdult(), sForSaleAdultImage);
- }
- }
- // PG Events
- if (gSavedSettings.getBOOL("MapShowEvents"))
- {
- drawGenericItems(info->getPGEvent(), sEventImage);
- }
- // Mature Events
- if (show_mature)
- {
- drawGenericItems(info->getMatureEvent(), sEventMatureImage);
- }
- // Adult Events
- if (show_adult)
- {
- drawGenericItems(info->getAdultEvent(), sEventAdultImage);
- }
- }
+ BOOL show_adult = adult_enabled && gSavedSettings.getBOOL("ShowAdultEvents");
+
+ for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
+ {
+ U64 handle = *iter;
+ LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle);
+ if ((info == NULL) || (info->isDown()))
+ {
+ continue;
+ }
+ // Infohubs
+ if (gSavedSettings.getBOOL("MapShowInfohubs"))
+ {
+ drawGenericItems(info->getInfoHub(), sInfohubImage);
+ }
+ // Telehubs
+ if (gSavedSettings.getBOOL("MapShowTelehubs"))
+ {
+ drawGenericItems(info->getTeleHub(), sTelehubImage);
+ }
+ // Land for sale
+ if (gSavedSettings.getBOOL("MapShowLandForSale"))
+ {
+ drawGenericItems(info->getLandForSale(), sForSaleImage);
+ // for 1.23, we're showing normal land and adult land in the same UI; you don't
+ // get a choice about which ones you want. If you're currently asking for adult
+ // content and land you'll get the adult land.
+ if (gAgent.canAccessAdult())
+ {
+ drawGenericItems(info->getLandForSaleAdult(), sForSaleAdultImage);
+ }
+ }
+ // PG Events
+ if (gSavedSettings.getBOOL("MapShowEvents"))
+ {
+ drawGenericItems(info->getPGEvent(), sEventImage);
+ }
+ // Mature Events
+ if (show_mature)
+ {
+ drawGenericItems(info->getMatureEvent(), sEventMatureImage);
+ }
+ // Adult Events
+ if (show_adult)
+ {
+ drawGenericItems(info->getAdultEvent(), sEventAdultImage);
+ }
+ }
}
void LLWorldMapView::drawAgents()
{
- static LLUIColor map_avatar_color = LLUIColorTable::instance().getColor("MapAvatarColor", LLColor4::white);
-
- for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
- {
- U64 handle = *iter;
- LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
- if ((siminfo == NULL) || (siminfo->isDown()))
- {
- continue;
- }
- LLSimInfo::item_info_list_t::const_iterator it = siminfo->getAgentLocation().begin();
- while (it != siminfo->getAgentLocation().end())
- {
- // Show Individual agents (or little stacks where real agents are)
-
- // Here's how we'd choose the color if info.mID were available but it's not being sent:
- // LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? friend_color : avatar_color;
- drawImageStack(it->getGlobalPosition(), sAvatarSmallImage, it->getCount(), 3.f, map_avatar_color);
- ++it;
- }
- }
+ static LLUIColor map_avatar_color = LLUIColorTable::instance().getColor("MapAvatarColor", LLColor4::white);
+
+ for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
+ {
+ U64 handle = *iter;
+ LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
+ if ((siminfo == NULL) || (siminfo->isDown()))
+ {
+ continue;
+ }
+ LLSimInfo::item_info_list_t::const_iterator it = siminfo->getAgentLocation().begin();
+ while (it != siminfo->getAgentLocation().end())
+ {
+ // Show Individual agents (or little stacks where real agents are)
+
+ // Here's how we'd choose the color if info.mID were available but it's not being sent:
+ // LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? friend_color : avatar_color;
+ drawImageStack(it->getGlobalPosition(), sAvatarSmallImage, it->getCount(), 3.f, map_avatar_color);
+ ++it;
+ }
+ }
}
void LLWorldMapView::drawFrustum()
{
- // Draw frustum
- F32 meters_to_pixels = mMapScale/ REGION_WIDTH_METERS;
+ // Draw frustum
+ F32 meters_to_pixels = mMapScale/ REGION_WIDTH_METERS;
- F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();
- F32 far_clip_meters = LLViewerCamera::getInstance()->getFar();
- F32 far_clip_pixels = far_clip_meters * meters_to_pixels;
+ F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();
+ F32 far_clip_meters = LLViewerCamera::getInstance()->getFar();
+ F32 far_clip_pixels = far_clip_meters * meters_to_pixels;
- F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 );
- F32 half_width_pixels = half_width_meters * meters_to_pixels;
-
- // Compute the frustum coordinates. Take the UI scale into account.
+ F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 );
+ F32 half_width_pixels = half_width_meters * meters_to_pixels;
+
+ // Compute the frustum coordinates. Take the UI scale into account.
F32 ctr_x = ((getLocalRect().getWidth() * 0.5f + mPanX) * LLUI::getScaleFactor().mV[VX]);
F32 ctr_y = ((getLocalRect().getHeight() * 0.5f + mPanY) * LLUI::getScaleFactor().mV[VY]);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- // Since we don't rotate the map, we have to rotate the frustum.
- gGL.pushMatrix();
- {
- gGL.translatef( ctr_x, ctr_y, 0 );
-
- // Draw triangle with more alpha in far pixels to make it
- // fade out in distance.
- gGL.begin( LLRender::TRIANGLES );
- {
- // get camera look at and left axes
- LLVector3 at_axis = LLViewerCamera::instance().getAtAxis();
- LLVector3 left_axis = LLViewerCamera::instance().getLeftAxis();
-
- // grab components along XY plane
- LLVector2 cam_lookat(at_axis.mV[VX], at_axis.mV[VY]);
- LLVector2 cam_left(left_axis.mV[VX], left_axis.mV[VY]);
-
- // but, when looking near straight up or down...
- if (is_approx_zero(cam_lookat.magVecSquared()))
- {
- //...just fall back to looking down the x axis
- cam_lookat = LLVector2(1.f, 0.f); // x axis
- cam_left = LLVector2(0.f, 1.f); // y axis
- }
-
- // normalize to unit length
- cam_lookat.normVec();
- cam_left.normVec();
-
- gGL.color4f(1.f, 1.f, 1.f, 0.25f);
- gGL.vertex2f( 0, 0 );
-
- gGL.color4f(1.f, 1.f, 1.f, 0.02f);
-
- // use 2d camera vectors to render frustum triangle
- LLVector2 vert = cam_lookat * far_clip_pixels + cam_left * half_width_pixels;
- gGL.vertex2f(vert.mV[VX], vert.mV[VY]);
-
- vert = cam_lookat * far_clip_pixels - cam_left * half_width_pixels;
- gGL.vertex2f(vert.mV[VX], vert.mV[VY]);
- }
- gGL.end();
- }
- gGL.popMatrix();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ // Since we don't rotate the map, we have to rotate the frustum.
+ gGL.pushMatrix();
+ {
+ gGL.translatef( ctr_x, ctr_y, 0 );
+
+ // Draw triangle with more alpha in far pixels to make it
+ // fade out in distance.
+ gGL.begin( LLRender::TRIANGLES );
+ {
+ // get camera look at and left axes
+ LLVector3 at_axis = LLViewerCamera::instance().getAtAxis();
+ LLVector3 left_axis = LLViewerCamera::instance().getLeftAxis();
+
+ // grab components along XY plane
+ LLVector2 cam_lookat(at_axis.mV[VX], at_axis.mV[VY]);
+ LLVector2 cam_left(left_axis.mV[VX], left_axis.mV[VY]);
+
+ // but, when looking near straight up or down...
+ if (is_approx_zero(cam_lookat.magVecSquared()))
+ {
+ //...just fall back to looking down the x axis
+ cam_lookat = LLVector2(1.f, 0.f); // x axis
+ cam_left = LLVector2(0.f, 1.f); // y axis
+ }
+
+ // normalize to unit length
+ cam_lookat.normVec();
+ cam_left.normVec();
+
+ gGL.color4f(1.f, 1.f, 1.f, 0.25f);
+ gGL.vertex2f( 0, 0 );
+
+ gGL.color4f(1.f, 1.f, 1.f, 0.02f);
+
+ // use 2d camera vectors to render frustum triangle
+ LLVector2 vert = cam_lookat * far_clip_pixels + cam_left * half_width_pixels;
+ gGL.vertex2f(vert.mV[VX], vert.mV[VY]);
+
+ vert = cam_lookat * far_clip_pixels - cam_left * half_width_pixels;
+ gGL.vertex2f(vert.mV[VX], vert.mV[VY]);
+ }
+ gGL.end();
+ }
+ gGL.popMatrix();
}
LLVector3 LLWorldMapView::globalPosToView( const LLVector3d& global_pos )
{
- LLVector3d relative_pos_global = global_pos - gAgentCamera.getCameraPositionGlobal();
- LLVector3 pos_local;
- pos_local.setVec(relative_pos_global); // convert to floats from doubles
+ LLVector3d relative_pos_global = global_pos - gAgentCamera.getCameraPositionGlobal();
+ LLVector3 pos_local;
+ pos_local.setVec(relative_pos_global); // convert to floats from doubles
- pos_local.mV[VX] *= mMapScale / REGION_WIDTH_METERS;
- pos_local.mV[VY] *= mMapScale / REGION_WIDTH_METERS;
- // leave Z component in meters
+ pos_local.mV[VX] *= mMapScale / REGION_WIDTH_METERS;
+ pos_local.mV[VY] *= mMapScale / REGION_WIDTH_METERS;
+ // leave Z component in meters
- pos_local.mV[VX] += getRect().getWidth() / 2 + mPanX;
- pos_local.mV[VY] += getRect().getHeight() / 2 + mPanY;
+ pos_local.mV[VX] += getRect().getWidth() / 2 + mPanX;
+ pos_local.mV[VY] += getRect().getHeight() / 2 + mPanY;
- return pos_local;
+ return pos_local;
}
void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& color, BOOL draw_arrow,
- const std::string& label, const std::string& tooltip, S32 vert_offset )
+ const std::string& label, const std::string& tooltip, S32 vert_offset )
{
- LLVector3 pos_local = globalPosToView( pos_global );
- S32 x = ll_round( pos_local.mV[VX] );
- S32 y = ll_round( pos_local.mV[VY] );
- LLFontGL* font = LLFontGL::getFontSansSerifSmall();
- S32 text_x = x;
- S32 text_y = (S32)(y - sTrackCircleImage->getHeight()/2 - font->getLineHeight());
-
- if( x < 0
- || y < 0
- || x >= getRect().getWidth()
- || y >= getRect().getHeight() )
- {
- if (draw_arrow)
- {
- drawTrackingCircle( getRect(), x, y, color, 3, 15 );
- drawTrackingArrow( getRect(), x, y, color );
- text_x = sTrackingArrowX;
- text_y = sTrackingArrowY;
- }
- }
- else if (LLTracker::getTrackingStatus() == LLTracker::TRACKING_LOCATION &&
- LLTracker::getTrackedLocationType() != LLTracker::LOCATION_NOTHING)
- {
- drawTrackingCircle( getRect(), x, y, color, 3, 15 );
- }
- else
- {
- drawImage(pos_global, sTrackCircleImage, color);
- }
-
- // clamp text position to on-screen
- const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2;
- S32 half_text_width = llfloor(font->getWidthF32(label) * 0.5f);
- text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING);
- text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - font->getLineHeight() - TEXT_PADDING - vert_offset);
-
- if (label != "")
- {
- font->renderUTF8(
- label, 0,
- text_x,
- text_y,
- LLColor4::white, LLFontGL::HCENTER,
- LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW);
-
- if (tooltip != "")
- {
- text_y -= font->getLineHeight();
-
- font->renderUTF8(
- tooltip, 0,
- text_x,
- text_y,
- LLColor4::white, LLFontGL::HCENTER,
- LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW);
- }
- }
+ LLVector3 pos_local = globalPosToView( pos_global );
+ S32 x = ll_round( pos_local.mV[VX] );
+ S32 y = ll_round( pos_local.mV[VY] );
+ LLFontGL* font = LLFontGL::getFontSansSerifSmall();
+ S32 text_x = x;
+ S32 text_y = (S32)(y - sTrackCircleImage->getHeight()/2 - font->getLineHeight());
+
+ if( x < 0
+ || y < 0
+ || x >= getRect().getWidth()
+ || y >= getRect().getHeight() )
+ {
+ if (draw_arrow)
+ {
+ drawTrackingCircle( getRect(), x, y, color, 3, 15 );
+ drawTrackingArrow( getRect(), x, y, color );
+ text_x = sTrackingArrowX;
+ text_y = sTrackingArrowY;
+ }
+ }
+ else if (LLTracker::getTrackingStatus() == LLTracker::TRACKING_LOCATION &&
+ LLTracker::getTrackedLocationType() != LLTracker::LOCATION_NOTHING)
+ {
+ drawTrackingCircle( getRect(), x, y, color, 3, 15 );
+ }
+ else
+ {
+ drawImage(pos_global, sTrackCircleImage, color);
+ }
+
+ // clamp text position to on-screen
+ const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2;
+ S32 half_text_width = llfloor(font->getWidthF32(label) * 0.5f);
+ text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING);
+ text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - font->getLineHeight() - TEXT_PADDING - vert_offset);
+
+ if (label != "")
+ {
+ font->renderUTF8(
+ label, 0,
+ text_x,
+ text_y,
+ LLColor4::white, LLFontGL::HCENTER,
+ LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW);
+
+ if (tooltip != "")
+ {
+ text_y -= font->getLineHeight();
+
+ font->renderUTF8(
+ tooltip, 0,
+ text_x,
+ text_y,
+ LLColor4::white, LLFontGL::HCENTER,
+ LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW);
+ }
+ }
}
// If you change this, then you need to change LLTracker::getTrackedPositionGlobal() as well
LLVector3d LLWorldMapView::viewPosToGlobal( S32 x, S32 y )
{
- x -= llfloor((getRect().getWidth() / 2 + mPanX));
- y -= llfloor((getRect().getHeight() / 2 + mPanY));
-
- LLVector3 pos_local( (F32)x, (F32)y, 0.f );
-
- pos_local *= ( REGION_WIDTH_METERS / mMapScale );
-
- LLVector3d pos_global;
- pos_global.setVec( pos_local );
- pos_global += gAgentCamera.getCameraPositionGlobal();
- if(gAgent.isGodlike())
- {
- pos_global.mdV[VZ] = GODLY_TELEPORT_HEIGHT; // Godly height should always be 200.
- }
- else
- {
- pos_global.mdV[VZ] = gAgent.getPositionAgent().mV[VZ]; // Want agent's height, not camera's
- }
-
- return pos_global;
+ x -= llfloor((getRect().getWidth() / 2 + mPanX));
+ y -= llfloor((getRect().getHeight() / 2 + mPanY));
+
+ LLVector3 pos_local( (F32)x, (F32)y, 0.f );
+
+ pos_local *= ( REGION_WIDTH_METERS / mMapScale );
+
+ LLVector3d pos_global;
+ pos_global.setVec( pos_local );
+ pos_global += gAgentCamera.getCameraPositionGlobal();
+ if(gAgent.isGodlike())
+ {
+ pos_global.mdV[VZ] = GODLY_TELEPORT_HEIGHT; // Godly height should always be 200.
+ }
+ else
+ {
+ pos_global.mdV[VZ] = gAgent.getPositionAgent().mV[VZ]; // Want agent's height, not camera's
+ }
+
+ return pos_global;
}
BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, MASK mask )
{
- LLVector3d pos_global = viewPosToGlobal(x, y);
- U64 handle = to_region_handle(pos_global);
- std::string tooltip_msg;
-
- LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle);
- if (info)
- {
- LLViewerRegion *region = gAgent.getRegion();
-
- std::string message = llformat("%s (%s)", info->getName().c_str(), info->getAccessString().c_str());
-
- if (!info->isDown())
- {
- S32 agent_count = info->getAgentCount();
- if (region && (region->getHandle() == handle))
- {
- ++agent_count; // Bump by 1 if we're here
- }
-
- // We may not have an agent count when the map is really
- // zoomed out, so don't display anything about the count. JC
- if (agent_count > 0)
- {
- LLStringUtil::format_map_t string_args;
- string_args["[NUMBER]"] = llformat("%d", agent_count);
- message += '\n';
- message += getString((agent_count == 1 ? "world_map_person" : "world_map_people") , string_args);
- }
- }
- tooltip_msg.assign( message );
-
- // Optionally show region flags
- std::string region_flags = info->getFlagsString();
-
- if (!region_flags.empty())
- {
- tooltip_msg += '\n';
- tooltip_msg += region_flags;
- }
-
- const S32 SLOP = 9;
- S32 screen_x, screen_y;
-
- localPointToScreen(x, y, &screen_x, &screen_y);
- LLRect sticky_rect_screen;
- sticky_rect_screen.setCenterAndSize(screen_x, screen_y, SLOP, SLOP);
-
- LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(tooltip_msg)
- .sticky_rect(sticky_rect_screen));
- }
- return TRUE;
+ LLVector3d pos_global = viewPosToGlobal(x, y);
+ U64 handle = to_region_handle(pos_global);
+ std::string tooltip_msg;
+
+ LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle);
+ if (info)
+ {
+ LLViewerRegion *region = gAgent.getRegion();
+
+ std::string message = llformat("%s (%s)", info->getName().c_str(), info->getAccessString().c_str());
+
+ if (!info->isDown())
+ {
+ S32 agent_count = info->getAgentCount();
+ if (region && (region->getHandle() == handle))
+ {
+ ++agent_count; // Bump by 1 if we're here
+ }
+
+ // We may not have an agent count when the map is really
+ // zoomed out, so don't display anything about the count. JC
+ if (agent_count > 0)
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[NUMBER]"] = llformat("%d", agent_count);
+ message += '\n';
+ message += getString((agent_count == 1 ? "world_map_person" : "world_map_people") , string_args);
+ }
+ }
+ tooltip_msg.assign( message );
+
+ // Optionally show region flags
+ std::string region_flags = info->getFlagsString();
+
+ if (!region_flags.empty())
+ {
+ tooltip_msg += '\n';
+ tooltip_msg += region_flags;
+ }
+
+ const S32 SLOP = 9;
+ S32 screen_x, screen_y;
+
+ localPointToScreen(x, y, &screen_x, &screen_y);
+ LLRect sticky_rect_screen;
+ sticky_rect_screen.setCenterAndSize(screen_x, screen_y, SLOP, SLOP);
+
+ LLToolTipMgr::instance().show(LLToolTip::Params()
+ .message(tooltip_msg)
+ .sticky_rect(sticky_rect_screen));
+ }
+ return TRUE;
}
// Pass relative Z of 0 to draw at same level.
// static
static void drawDot(F32 x_pixels, F32 y_pixels,
- const LLColor4& color,
- F32 relative_z,
- F32 dot_radius,
- LLUIImagePtr dot_image)
+ const LLColor4& color,
+ F32 relative_z,
+ F32 dot_radius,
+ LLUIImagePtr dot_image)
{
- const F32 HEIGHT_THRESHOLD = 7.f;
-
- if(-HEIGHT_THRESHOLD <= relative_z && relative_z <= HEIGHT_THRESHOLD)
- {
- dot_image->draw(ll_round(x_pixels) - dot_image->getWidth()/2,
- ll_round(y_pixels) - dot_image->getHeight()/2,
- color);
- }
- else
- {
- // Draw V indicator for above or below
- // *TODO: Replace this vector drawing with icons
-
- F32 left = x_pixels - dot_radius;
- F32 right = x_pixels + dot_radius;
- F32 center = (left + right) * 0.5f;
- F32 top = y_pixels + dot_radius;
- F32 bottom = y_pixels - dot_radius;
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4fv( color.mV );
- LLUI::setLineWidth(3.0f);
- F32 point = relative_z > HEIGHT_THRESHOLD ? top : bottom; // Y pos of the point of the V
- F32 back = relative_z > HEIGHT_THRESHOLD ? bottom : top; // Y pos of the ends of the V
- gGL.begin( LLRender::LINES );
- gGL.vertex2f(left, back);
- gGL.vertex2f(center, point);
- gGL.vertex2f(center, point);
- gGL.vertex2f(right, back);
- gGL.end();
- LLUI::setLineWidth(1.0f);
- }
+ const F32 HEIGHT_THRESHOLD = 7.f;
+
+ if(-HEIGHT_THRESHOLD <= relative_z && relative_z <= HEIGHT_THRESHOLD)
+ {
+ dot_image->draw(ll_round(x_pixels) - dot_image->getWidth()/2,
+ ll_round(y_pixels) - dot_image->getHeight()/2,
+ color);
+ }
+ else
+ {
+ // Draw V indicator for above or below
+ // *TODO: Replace this vector drawing with icons
+
+ F32 left = x_pixels - dot_radius;
+ F32 right = x_pixels + dot_radius;
+ F32 center = (left + right) * 0.5f;
+ F32 top = y_pixels + dot_radius;
+ F32 bottom = y_pixels - dot_radius;
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.color4fv( color.mV );
+ LLUI::setLineWidth(3.0f);
+ F32 point = relative_z > HEIGHT_THRESHOLD ? top : bottom; // Y pos of the point of the V
+ F32 back = relative_z > HEIGHT_THRESHOLD ? bottom : top; // Y pos of the ends of the V
+ gGL.begin( LLRender::LINES );
+ gGL.vertex2f(left, back);
+ gGL.vertex2f(center, point);
+ gGL.vertex2f(center, point);
+ gGL.vertex2f(right, back);
+ gGL.end();
+ LLUI::setLineWidth(1.0f);
+ }
}
// Pass relative Z of 0 to draw at same level.
// static
-void LLWorldMapView::drawAvatar(F32 x_pixels,
- F32 y_pixels,
- const LLColor4& color,
- F32 relative_z,
- F32 dot_radius,
- bool unknown_relative_z)
+void LLWorldMapView::drawAvatar(F32 x_pixels,
+ F32 y_pixels,
+ const LLColor4& color,
+ F32 relative_z,
+ F32 dot_radius,
+ bool unknown_relative_z)
{
- const F32 HEIGHT_THRESHOLD = 7.f;
- LLUIImagePtr dot_image = sAvatarLevelImage;
- if (unknown_relative_z && llabs(relative_z) > HEIGHT_THRESHOLD)
- {
- dot_image = sAvatarUnknownImage;
- }
- else
- {
- if(relative_z < -HEIGHT_THRESHOLD)
- {
- dot_image = sAvatarBelowImage;
- }
- else if(relative_z > HEIGHT_THRESHOLD)
- {
- dot_image = sAvatarAboveImage;
- }
- }
- S32 dot_width = ll_round(dot_radius * 2.f);
- dot_image->draw(ll_round(x_pixels - dot_radius),
- ll_round(y_pixels - dot_radius),
- dot_width,
- dot_width,
- color);
+ const F32 HEIGHT_THRESHOLD = 7.f;
+ LLUIImagePtr dot_image = sAvatarLevelImage;
+ if (unknown_relative_z && llabs(relative_z) > HEIGHT_THRESHOLD)
+ {
+ dot_image = sAvatarUnknownImage;
+ }
+ else
+ {
+ if(relative_z < -HEIGHT_THRESHOLD)
+ {
+ dot_image = sAvatarBelowImage;
+ }
+ else if(relative_z > HEIGHT_THRESHOLD)
+ {
+ dot_image = sAvatarAboveImage;
+ }
+ }
+ S32 dot_width = ll_round(dot_radius * 2.f);
+ dot_image->draw(ll_round(x_pixels - dot_radius),
+ ll_round(y_pixels - dot_radius),
+ dot_width,
+ dot_width,
+ color);
}
// Pass relative Z of 0 to draw at same level.
// static
-void LLWorldMapView::drawTrackingDot( F32 x_pixels,
- F32 y_pixels,
- const LLColor4& color,
- F32 relative_z,
- F32 dot_radius)
+void LLWorldMapView::drawTrackingDot( F32 x_pixels,
+ F32 y_pixels,
+ const LLColor4& color,
+ F32 relative_z,
+ F32 dot_radius)
{
- drawDot(x_pixels, y_pixels, color, relative_z, dot_radius, sTrackCircleImage);
+ drawDot(x_pixels, y_pixels, color, relative_z, dot_radius, sTrackCircleImage);
}
// Pass relative Z of 0 to draw at same level.
// static
-void LLWorldMapView::drawIconName(F32 x_pixels,
- F32 y_pixels,
- const LLColor4& color,
- const std::string& first_line,
- const std::string& second_line)
+void LLWorldMapView::drawIconName(F32 x_pixels,
+ F32 y_pixels,
+ const LLColor4& color,
+ const std::string& first_line,
+ const std::string& second_line)
{
- const S32 VERT_PAD = 8;
- S32 text_x = ll_round(x_pixels);
- S32 text_y = ll_round(y_pixels
- - BIG_DOT_RADIUS
- - VERT_PAD);
-
- // render text
- LLFontGL::getFontSansSerif()->renderUTF8(first_line, 0,
- text_x,
- text_y,
- color,
- LLFontGL::HCENTER,
- LLFontGL::TOP,
- LLFontGL::NORMAL,
- LLFontGL::DROP_SHADOW);
-
- text_y -= LLFontGL::getFontSansSerif()->getLineHeight();
-
- // render text
- LLFontGL::getFontSansSerif()->renderUTF8(second_line, 0,
- text_x,
- text_y,
- color,
- LLFontGL::HCENTER,
- LLFontGL::TOP,
- LLFontGL::NORMAL,
- LLFontGL::DROP_SHADOW);
+ const S32 VERT_PAD = 8;
+ S32 text_x = ll_round(x_pixels);
+ S32 text_y = ll_round(y_pixels
+ - BIG_DOT_RADIUS
+ - VERT_PAD);
+
+ // render text
+ LLFontGL::getFontSansSerif()->renderUTF8(first_line, 0,
+ text_x,
+ text_y,
+ color,
+ LLFontGL::HCENTER,
+ LLFontGL::TOP,
+ LLFontGL::NORMAL,
+ LLFontGL::DROP_SHADOW);
+
+ text_y -= LLFontGL::getFontSansSerif()->getLineHeight();
+
+ // render text
+ LLFontGL::getFontSansSerif()->renderUTF8(second_line, 0,
+ text_x,
+ text_y,
+ color,
+ LLFontGL::HCENTER,
+ LLFontGL::TOP,
+ LLFontGL::NORMAL,
+ LLFontGL::DROP_SHADOW);
}
-//static
+//static
void LLWorldMapView::drawTrackingCircle( const LLRect& rect, S32 x, S32 y, const LLColor4& color, S32 min_thickness, S32 overlap )
{
- F32 start_theta = 0.f;
- F32 end_theta = F_TWO_PI;
- F32 x_delta = 0.f;
- F32 y_delta = 0.f;
-
- if (x < 0)
- {
- x_delta = 0.f - (F32)x;
- start_theta = F_PI + F_PI_BY_TWO;
- end_theta = F_TWO_PI + F_PI_BY_TWO;
- }
- else if (x > rect.getWidth())
- {
- x_delta = (F32)(x - rect.getWidth());
- start_theta = F_PI_BY_TWO;
- end_theta = F_PI + F_PI_BY_TWO;
- }
-
- if (y < 0)
- {
- y_delta = 0.f - (F32)y;
- if (x < 0)
- {
- start_theta = 0.f;
- end_theta = F_PI_BY_TWO;
- }
- else if (x > rect.getWidth())
- {
- start_theta = F_PI_BY_TWO;
- end_theta = F_PI;
- }
- else
- {
- start_theta = 0.f;
- end_theta = F_PI;
- }
- }
- else if (y > rect.getHeight())
- {
- y_delta = (F32)(y - rect.getHeight());
- if (x < 0)
- {
- start_theta = F_PI + F_PI_BY_TWO;
- end_theta = F_TWO_PI;
- }
- else if (x > rect.getWidth())
- {
- start_theta = F_PI;
- end_theta = F_PI + F_PI_BY_TWO;
- }
- else
- {
- start_theta = F_PI;
- end_theta = F_TWO_PI;
- }
- }
-
- F32 distance = sqrtf(x_delta * x_delta + y_delta * y_delta);
-
- distance = llmax(0.1f, distance);
-
- F32 outer_radius = distance + (1.f + (9.f * sqrtf(x_delta * y_delta) / distance)) * (F32)overlap;
- F32 inner_radius = outer_radius - (F32)min_thickness;
-
- F32 angle_adjust_x = asin(x_delta / outer_radius);
- F32 angle_adjust_y = asin(y_delta / outer_radius);
-
- if (angle_adjust_x)
- {
- if (angle_adjust_y)
- {
- F32 angle_adjust = llmin(angle_adjust_x, angle_adjust_y);
- start_theta += angle_adjust;
- end_theta -= angle_adjust;
- }
- else
- {
- start_theta += angle_adjust_x;
- end_theta -= angle_adjust_x;
- }
- }
- else if (angle_adjust_y)
- {
- start_theta += angle_adjust_y;
- end_theta -= angle_adjust_y;
- }
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.translatef((F32)x * LLUI::getScaleFactor().mV[VX], (F32)y * LLUI::getScaleFactor().mV[VY], 0.f);
- gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color);
- gGL.popMatrix();
+ F32 start_theta = 0.f;
+ F32 end_theta = F_TWO_PI;
+ F32 x_delta = 0.f;
+ F32 y_delta = 0.f;
+
+ if (x < 0)
+ {
+ x_delta = 0.f - (F32)x;
+ start_theta = F_PI + F_PI_BY_TWO;
+ end_theta = F_TWO_PI + F_PI_BY_TWO;
+ }
+ else if (x > rect.getWidth())
+ {
+ x_delta = (F32)(x - rect.getWidth());
+ start_theta = F_PI_BY_TWO;
+ end_theta = F_PI + F_PI_BY_TWO;
+ }
+
+ if (y < 0)
+ {
+ y_delta = 0.f - (F32)y;
+ if (x < 0)
+ {
+ start_theta = 0.f;
+ end_theta = F_PI_BY_TWO;
+ }
+ else if (x > rect.getWidth())
+ {
+ start_theta = F_PI_BY_TWO;
+ end_theta = F_PI;
+ }
+ else
+ {
+ start_theta = 0.f;
+ end_theta = F_PI;
+ }
+ }
+ else if (y > rect.getHeight())
+ {
+ y_delta = (F32)(y - rect.getHeight());
+ if (x < 0)
+ {
+ start_theta = F_PI + F_PI_BY_TWO;
+ end_theta = F_TWO_PI;
+ }
+ else if (x > rect.getWidth())
+ {
+ start_theta = F_PI;
+ end_theta = F_PI + F_PI_BY_TWO;
+ }
+ else
+ {
+ start_theta = F_PI;
+ end_theta = F_TWO_PI;
+ }
+ }
+
+ F32 distance = sqrtf(x_delta * x_delta + y_delta * y_delta);
+
+ distance = llmax(0.1f, distance);
+
+ F32 outer_radius = distance + (1.f + (9.f * sqrtf(x_delta * y_delta) / distance)) * (F32)overlap;
+ F32 inner_radius = outer_radius - (F32)min_thickness;
+
+ F32 angle_adjust_x = asin(x_delta / outer_radius);
+ F32 angle_adjust_y = asin(y_delta / outer_radius);
+
+ if (angle_adjust_x)
+ {
+ if (angle_adjust_y)
+ {
+ F32 angle_adjust = llmin(angle_adjust_x, angle_adjust_y);
+ start_theta += angle_adjust;
+ end_theta -= angle_adjust;
+ }
+ else
+ {
+ start_theta += angle_adjust_x;
+ end_theta -= angle_adjust_x;
+ }
+ }
+ else if (angle_adjust_y)
+ {
+ start_theta += angle_adjust_y;
+ end_theta -= angle_adjust_y;
+ }
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.translatef((F32)x * LLUI::getScaleFactor().mV[VX], (F32)y * LLUI::getScaleFactor().mV[VY], 0.f);
+ gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color);
+ gGL.popMatrix();
}
// static
-void LLWorldMapView::drawTrackingArrow(const LLRect& rect, S32 x, S32 y,
- const LLColor4& color,
- S32 arrow_size)
+void LLWorldMapView::drawTrackingArrow(const LLRect& rect, S32 x, S32 y,
+ const LLColor4& color,
+ S32 arrow_size)
{
- F32 x_center = (F32)rect.getWidth() / 2.f;
- F32 y_center = (F32)rect.getHeight() / 2.f;
-
- F32 x_clamped = (F32)llclamp( x, 0, rect.getWidth() - arrow_size );
- F32 y_clamped = (F32)llclamp( y, 0, rect.getHeight() - arrow_size );
-
- F32 slope = (F32)(y - y_center) / (F32)(x - x_center);
- F32 window_ratio = (F32)rect.getHeight() / (F32)rect.getWidth();
-
- if (llabs(slope) > window_ratio && y_clamped != (F32)y)
- {
- // clamp by y
- x_clamped = (y_clamped - y_center) / slope + x_center;
- // adjust for arrow size
- x_clamped = llclamp(x_clamped , 0.f, (F32)(rect.getWidth() - arrow_size) );
- }
- else if (x_clamped != (F32)x)
- {
- // clamp by x
- y_clamped = (x_clamped - x_center) * slope + y_center;
- // adjust for arrow size
- y_clamped = llclamp( y_clamped, 0.f, (F32)(rect.getHeight() - arrow_size) );
- }
-
- // *FIX: deal with non-square window properly.
- // I do not understand what this comment means -- is it actually
- // broken or is it correctly dealing with non-square
- // windows. Phoenix 2007-01-03.
- S32 half_arrow_size = (S32) (0.5f * arrow_size);
-
- F32 angle = atan2( y + half_arrow_size - y_center, x + half_arrow_size - x_center);
-
- sTrackingArrowX = llfloor(x_clamped);
- sTrackingArrowY = llfloor(y_clamped);
-
- gl_draw_scaled_rotated_image(
- sTrackingArrowX,
- sTrackingArrowY,
- arrow_size, arrow_size,
- RAD_TO_DEG * angle,
- sTrackArrowImage->getImage(),
- color);
+ F32 x_center = (F32)rect.getWidth() / 2.f;
+ F32 y_center = (F32)rect.getHeight() / 2.f;
+
+ F32 x_clamped = (F32)llclamp( x, 0, rect.getWidth() - arrow_size );
+ F32 y_clamped = (F32)llclamp( y, 0, rect.getHeight() - arrow_size );
+
+ F32 slope = (F32)(y - y_center) / (F32)(x - x_center);
+ F32 window_ratio = (F32)rect.getHeight() / (F32)rect.getWidth();
+
+ if (llabs(slope) > window_ratio && y_clamped != (F32)y)
+ {
+ // clamp by y
+ x_clamped = (y_clamped - y_center) / slope + x_center;
+ // adjust for arrow size
+ x_clamped = llclamp(x_clamped , 0.f, (F32)(rect.getWidth() - arrow_size) );
+ }
+ else if (x_clamped != (F32)x)
+ {
+ // clamp by x
+ y_clamped = (x_clamped - x_center) * slope + y_center;
+ // adjust for arrow size
+ y_clamped = llclamp( y_clamped, 0.f, (F32)(rect.getHeight() - arrow_size) );
+ }
+
+ // *FIX: deal with non-square window properly.
+ // I do not understand what this comment means -- is it actually
+ // broken or is it correctly dealing with non-square
+ // windows. Phoenix 2007-01-03.
+ S32 half_arrow_size = (S32) (0.5f * arrow_size);
+
+ F32 angle = atan2( y + half_arrow_size - y_center, x + half_arrow_size - x_center);
+
+ sTrackingArrowX = llfloor(x_clamped);
+ sTrackingArrowY = llfloor(y_clamped);
+
+ gl_draw_scaled_rotated_image(
+ sTrackingArrowX,
+ sTrackingArrowY,
+ arrow_size, arrow_size,
+ RAD_TO_DEG * angle,
+ sTrackArrowImage->getImage(),
+ color);
}
void LLWorldMapView::setDirectionPos( LLTextBox* text_box, F32 rotation )
{
- // Rotation is in radians.
- // Rotation of 0 means x = 1, y = 0 on the unit circle.
+ // Rotation is in radians.
+ // Rotation of 0 means x = 1, y = 0 on the unit circle.
- F32 map_half_height = getRect().getHeight() * 0.5f;
- F32 map_half_width = getRect().getWidth() * 0.5f;
- F32 text_half_height = text_box->getRect().getHeight() * 0.5f;
- F32 text_half_width = text_box->getRect().getWidth() * 0.5f;
- F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width );
+ F32 map_half_height = getRect().getHeight() * 0.5f;
+ F32 map_half_width = getRect().getWidth() * 0.5f;
+ F32 text_half_height = text_box->getRect().getHeight() * 0.5f;
+ F32 text_half_width = text_box->getRect().getWidth() * 0.5f;
+ F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width );
- text_box->setOrigin(
- ll_round(map_half_width - text_half_width + radius * cos( rotation )),
- ll_round(map_half_height - text_half_height + radius * sin( rotation )) );
+ text_box->setOrigin(
+ ll_round(map_half_width - text_half_width + radius * cos( rotation )),
+ ll_round(map_half_height - text_half_height + radius * sin( rotation )) );
}
void LLWorldMapView::updateDirections()
{
- S32 width = getRect().getWidth();
- S32 height = getRect().getHeight();
-
- S32 text_height = mTextBoxNorth->getRect().getHeight();
- S32 text_width = mTextBoxNorth->getRect().getWidth();
-
- const S32 PAD = 2;
- S32 top = height - text_height - PAD;
- S32 left = PAD*2;
- S32 bottom = PAD;
- S32 right = width - text_width - PAD;
- S32 center_x = width/2 - text_width/2;
- S32 center_y = height/2 - text_height/2;
-
- mTextBoxNorth->setOrigin( center_x, top );
- mTextBoxEast->setOrigin( right, center_y );
- mTextBoxSouth->setOrigin( center_x, bottom );
- mTextBoxWest->setOrigin( left, center_y );
-
- // These have wider text boxes
- text_width = mTextBoxNorthWest->getRect().getWidth();
- right = width - text_width - PAD;
-
- mTextBoxNorthWest->setOrigin(left, top);
- mTextBoxNorthEast->setOrigin(right, top);
- mTextBoxSouthWest->setOrigin(left, bottom);
- mTextBoxSouthEast->setOrigin(right, bottom);
-
-// S32 hint_width = mTextBoxScrollHint->getRect().getWidth();
-// mTextBoxScrollHint->setOrigin( width - hint_width - text_width - 2 * PAD,
-// PAD * 2 + text_height );
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
+
+ S32 text_height = mTextBoxNorth->getRect().getHeight();
+ S32 text_width = mTextBoxNorth->getRect().getWidth();
+
+ const S32 PAD = 2;
+ S32 top = height - text_height - PAD;
+ S32 left = PAD*2;
+ S32 bottom = PAD;
+ S32 right = width - text_width - PAD;
+ S32 center_x = width/2 - text_width/2;
+ S32 center_y = height/2 - text_height/2;
+
+ mTextBoxNorth->setOrigin( center_x, top );
+ mTextBoxEast->setOrigin( right, center_y );
+ mTextBoxSouth->setOrigin( center_x, bottom );
+ mTextBoxWest->setOrigin( left, center_y );
+
+ // These have wider text boxes
+ text_width = mTextBoxNorthWest->getRect().getWidth();
+ right = width - text_width - PAD;
+
+ mTextBoxNorthWest->setOrigin(left, top);
+ mTextBoxNorthEast->setOrigin(right, top);
+ mTextBoxSouthWest->setOrigin(left, bottom);
+ mTextBoxSouthEast->setOrigin(right, bottom);
+
+// S32 hint_width = mTextBoxScrollHint->getRect().getWidth();
+// mTextBoxScrollHint->setOrigin( width - hint_width - text_width - 2 * PAD,
+// PAD * 2 + text_height );
}
void LLWorldMapView::reshape( S32 width, S32 height, BOOL called_from_parent )
{
- LLView::reshape( width, height, called_from_parent );
+ LLView::reshape( width, height, called_from_parent );
}
bool LLWorldMapView::checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track)
{
- LLVector3 pos_view = globalPosToView(item.getGlobalPosition());
- S32 item_x = ll_round(pos_view.mV[VX]);
- S32 item_y = ll_round(pos_view.mV[VY]);
-
- if (x < item_x - BIG_DOT_RADIUS) return false;
- if (x > item_x + BIG_DOT_RADIUS) return false;
- if (y < item_y - BIG_DOT_RADIUS) return false;
- if (y > item_y + BIG_DOT_RADIUS) return false;
-
- LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromHandle(item.getRegionHandle());
- if (sim_info)
- {
- if (track)
- {
- gFloaterWorldMap->trackLocation(item.getGlobalPosition());
- }
- }
-
- if (track)
- {
- gFloaterWorldMap->trackGenericItem(item);
- }
-
-// item.setSelected(true);
- *id = item.getUUID();
-
- return true;
+ LLVector3 pos_view = globalPosToView(item.getGlobalPosition());
+ S32 item_x = ll_round(pos_view.mV[VX]);
+ S32 item_y = ll_round(pos_view.mV[VY]);
+
+ if (x < item_x - BIG_DOT_RADIUS) return false;
+ if (x > item_x + BIG_DOT_RADIUS) return false;
+ if (y < item_y - BIG_DOT_RADIUS) return false;
+ if (y > item_y + BIG_DOT_RADIUS) return false;
+
+ LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromHandle(item.getRegionHandle());
+ if (sim_info)
+ {
+ if (track)
+ {
+ gFloaterWorldMap->trackLocation(item.getGlobalPosition());
+ }
+ }
+
+ if (track)
+ {
+ gFloaterWorldMap->trackGenericItem(item);
+ }
+
+// item.setSelected(true);
+ *id = item.getUUID();
+
+ return true;
}
// Handle a click, which might be on a dot
void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
- S32* hit_type,
- LLUUID* id)
+ S32* hit_type,
+ LLUUID* id)
{
- LLVector3d pos_global = viewPosToGlobal(x, y);
-
- // *HACK: Adjust Z values automatically for liaisons & gods so
- // we swoop down when they click on the map. Sadly, the P2P
- // branch does not pay attention to this value; however, the
- // Distributed Messaging branch honors it.
- if(gAgent.isGodlike())
- {
- pos_global.mdV[VZ] = 200.0;
- }
-
- *hit_type = 0; // hit nothing
-
- LLWorldMap::getInstance()->cancelTracking();
-
- S32 level = LLWorldMipmap::scaleToLevel(mMapScale);
- // If the zoom level is not too far out already, test hits
- if (level <= DRAW_SIMINFO_THRESHOLD)
- {
- bool show_mature = gAgent.canAccessMature() && gSavedSettings.getBOOL("ShowMatureEvents");
- bool show_adult = gAgent.canAccessAdult() && gSavedSettings.getBOOL("ShowAdultEvents");
-
- // Test hits if trackable data are displayed, otherwise, we don't even bother
- if (gSavedSettings.getBOOL("MapShowEvents") || show_mature || show_adult || gSavedSettings.getBOOL("MapShowLandForSale"))
- {
- // Iterate through the visible regions
- for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
- {
- U64 handle = *iter;
- LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
- if ((siminfo == NULL) || (siminfo->isDown()))
- {
- continue;
- }
- // If on screen check hits with the visible item lists
- if (gSavedSettings.getBOOL("MapShowEvents"))
- {
- LLSimInfo::item_info_list_t::const_iterator it = siminfo->getPGEvent().begin();
- while (it != siminfo->getPGEvent().end())
- {
- LLItemInfo event = *it;
- if (checkItemHit(x, y, event, id, false))
- {
- *hit_type = MAP_ITEM_PG_EVENT;
- mItemPicked = TRUE;
- gFloaterWorldMap->trackEvent(event);
- return;
- }
- ++it;
- }
- }
- if (show_mature)
- {
- LLSimInfo::item_info_list_t::const_iterator it = siminfo->getMatureEvent().begin();
- while (it != siminfo->getMatureEvent().end())
- {
- LLItemInfo event = *it;
- if (checkItemHit(x, y, event, id, false))
- {
- *hit_type = MAP_ITEM_MATURE_EVENT;
- mItemPicked = TRUE;
- gFloaterWorldMap->trackEvent(event);
- return;
- }
- ++it;
- }
- }
- if (show_adult)
- {
- LLSimInfo::item_info_list_t::const_iterator it = siminfo->getAdultEvent().begin();
- while (it != siminfo->getAdultEvent().end())
- {
- LLItemInfo event = *it;
- if (checkItemHit(x, y, event, id, false))
- {
- *hit_type = MAP_ITEM_ADULT_EVENT;
- mItemPicked = TRUE;
- gFloaterWorldMap->trackEvent(event);
- return;
- }
- ++it;
- }
- }
- if (gSavedSettings.getBOOL("MapShowLandForSale"))
- {
- LLSimInfo::item_info_list_t::const_iterator it = siminfo->getLandForSale().begin();
- while (it != siminfo->getLandForSale().end())
- {
- LLItemInfo event = *it;
- if (checkItemHit(x, y, event, id, true))
- {
- *hit_type = MAP_ITEM_LAND_FOR_SALE;
- mItemPicked = TRUE;
- return;
- }
- ++it;
- }
- // for 1.23, we're showing normal land and adult land in the same UI; you don't
- // get a choice about which ones you want. If you're currently asking for adult
- // content and land you'll get the adult land.
- if (gAgent.canAccessAdult())
- {
- LLSimInfo::item_info_list_t::const_iterator it = siminfo->getLandForSaleAdult().begin();
- while (it != siminfo->getLandForSaleAdult().end())
- {
- LLItemInfo event = *it;
- if (checkItemHit(x, y, event, id, true))
- {
- *hit_type = MAP_ITEM_LAND_FOR_SALE_ADULT;
- mItemPicked = TRUE;
- return;
- }
- ++it;
- }
- }
- }
- }
- }
- }
-
- // If we get here, we haven't clicked on anything
- gFloaterWorldMap->trackLocation(pos_global);
- mItemPicked = FALSE;
- *id = LLUUID::null;
- return;
+ LLVector3d pos_global = viewPosToGlobal(x, y);
+
+ // *HACK: Adjust Z values automatically for liaisons & gods so
+ // we swoop down when they click on the map. Sadly, the P2P
+ // branch does not pay attention to this value; however, the
+ // Distributed Messaging branch honors it.
+ if(gAgent.isGodlike())
+ {
+ pos_global.mdV[VZ] = 200.0;
+ }
+
+ *hit_type = 0; // hit nothing
+
+ LLWorldMap::getInstance()->cancelTracking();
+
+ S32 level = LLWorldMipmap::scaleToLevel(mMapScale);
+ // If the zoom level is not too far out already, test hits
+ if (level <= DRAW_SIMINFO_THRESHOLD)
+ {
+ bool show_mature = gAgent.canAccessMature() && gSavedSettings.getBOOL("ShowMatureEvents");
+ bool show_adult = gAgent.canAccessAdult() && gSavedSettings.getBOOL("ShowAdultEvents");
+
+ // Test hits if trackable data are displayed, otherwise, we don't even bother
+ if (gSavedSettings.getBOOL("MapShowEvents") || show_mature || show_adult || gSavedSettings.getBOOL("MapShowLandForSale"))
+ {
+ // Iterate through the visible regions
+ for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
+ {
+ U64 handle = *iter;
+ LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
+ if ((siminfo == NULL) || (siminfo->isDown()))
+ {
+ continue;
+ }
+ // If on screen check hits with the visible item lists
+ if (gSavedSettings.getBOOL("MapShowEvents"))
+ {
+ LLSimInfo::item_info_list_t::const_iterator it = siminfo->getPGEvent().begin();
+ while (it != siminfo->getPGEvent().end())
+ {
+ LLItemInfo event = *it;
+ if (checkItemHit(x, y, event, id, false))
+ {
+ *hit_type = MAP_ITEM_PG_EVENT;
+ mItemPicked = TRUE;
+ gFloaterWorldMap->trackEvent(event);
+ return;
+ }
+ ++it;
+ }
+ }
+ if (show_mature)
+ {
+ LLSimInfo::item_info_list_t::const_iterator it = siminfo->getMatureEvent().begin();
+ while (it != siminfo->getMatureEvent().end())
+ {
+ LLItemInfo event = *it;
+ if (checkItemHit(x, y, event, id, false))
+ {
+ *hit_type = MAP_ITEM_MATURE_EVENT;
+ mItemPicked = TRUE;
+ gFloaterWorldMap->trackEvent(event);
+ return;
+ }
+ ++it;
+ }
+ }
+ if (show_adult)
+ {
+ LLSimInfo::item_info_list_t::const_iterator it = siminfo->getAdultEvent().begin();
+ while (it != siminfo->getAdultEvent().end())
+ {
+ LLItemInfo event = *it;
+ if (checkItemHit(x, y, event, id, false))
+ {
+ *hit_type = MAP_ITEM_ADULT_EVENT;
+ mItemPicked = TRUE;
+ gFloaterWorldMap->trackEvent(event);
+ return;
+ }
+ ++it;
+ }
+ }
+ if (gSavedSettings.getBOOL("MapShowLandForSale"))
+ {
+ LLSimInfo::item_info_list_t::const_iterator it = siminfo->getLandForSale().begin();
+ while (it != siminfo->getLandForSale().end())
+ {
+ LLItemInfo event = *it;
+ if (checkItemHit(x, y, event, id, true))
+ {
+ *hit_type = MAP_ITEM_LAND_FOR_SALE;
+ mItemPicked = TRUE;
+ return;
+ }
+ ++it;
+ }
+ // for 1.23, we're showing normal land and adult land in the same UI; you don't
+ // get a choice about which ones you want. If you're currently asking for adult
+ // content and land you'll get the adult land.
+ if (gAgent.canAccessAdult())
+ {
+ LLSimInfo::item_info_list_t::const_iterator it = siminfo->getLandForSaleAdult().begin();
+ while (it != siminfo->getLandForSaleAdult().end())
+ {
+ LLItemInfo event = *it;
+ if (checkItemHit(x, y, event, id, true))
+ {
+ *hit_type = MAP_ITEM_LAND_FOR_SALE_ADULT;
+ mItemPicked = TRUE;
+ return;
+ }
+ ++it;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // If we get here, we haven't clicked on anything
+ gFloaterWorldMap->trackLocation(pos_global);
+ mItemPicked = FALSE;
+ *id = LLUUID::null;
+ return;
}
BOOL LLWorldMapView::handleMouseDown( S32 x, S32 y, MASK mask )
{
- gFocusMgr.setMouseCapture( this );
-
- mMouseDownPanX = ll_round(mPanX);
- mMouseDownPanY = ll_round(mPanY);
- mMouseDownX = x;
- mMouseDownY = y;
- sHandledLastClick = TRUE;
- return TRUE;
+ gFocusMgr.setMouseCapture( this );
+
+ mMouseDownPanX = ll_round(mPanX);
+ mMouseDownPanY = ll_round(mPanY);
+ mMouseDownX = x;
+ mMouseDownY = y;
+ sHandledLastClick = TRUE;
+ return TRUE;
}
BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask )
{
- if (hasMouseCapture())
- {
- if (mPanning)
- {
- // restore mouse cursor
- S32 local_x, local_y;
- local_x = mMouseDownX + llfloor(mPanX - mMouseDownPanX);
- local_y = mMouseDownY + llfloor(mPanY - mMouseDownPanY);
- LLRect clip_rect = getRect();
- clip_rect.stretch(-8);
- clip_rect.clipPointToRect(mMouseDownX, mMouseDownY, local_x, local_y);
- LLUI::getInstance()->setMousePositionLocal(this, local_x, local_y);
-
- // finish the pan
- mPanning = FALSE;
-
- mMouseDownX = 0;
- mMouseDownY = 0;
- }
- else
- {
- // ignore whether we hit an event or not
- S32 hit_type;
- LLUUID id;
- handleClick(x, y, mask, &hit_type, &id);
- }
- gViewerWindow->showCursor();
- gFocusMgr.setMouseCapture( NULL );
- return TRUE;
- }
- return FALSE;
+ if (hasMouseCapture())
+ {
+ if (mPanning)
+ {
+ // restore mouse cursor
+ S32 local_x, local_y;
+ local_x = mMouseDownX + llfloor(mPanX - mMouseDownPanX);
+ local_y = mMouseDownY + llfloor(mPanY - mMouseDownPanY);
+ LLRect clip_rect = getRect();
+ clip_rect.stretch(-8);
+ clip_rect.clipPointToRect(mMouseDownX, mMouseDownY, local_x, local_y);
+ LLUI::getInstance()->setMousePositionLocal(this, local_x, local_y);
+
+ // finish the pan
+ mPanning = FALSE;
+
+ mMouseDownX = 0;
+ mMouseDownY = 0;
+ }
+ else
+ {
+ // ignore whether we hit an event or not
+ S32 hit_type;
+ LLUUID id;
+ handleClick(x, y, mask, &hit_type, &id);
+ }
+ gViewerWindow->showCursor();
+ gFocusMgr.setMouseCapture( NULL );
+ return TRUE;
+ }
+ return FALSE;
}
void LLWorldMapView::updateVisibleBlocks()
{
- if (LLWorldMipmap::scaleToLevel(mMapScale) > DRAW_SIMINFO_THRESHOLD)
- {
- // If we're zoomed out too much, we just don't load all those sim info: too much!
- return;
- }
-
- // Load the blocks visible in the current World Map view
-
- // Get the World Map view coordinates and boundaries
- LLVector3d camera_global = gAgentCamera.getCameraPositionGlobal();
- const S32 width = getRect().getWidth();
- const S32 height = getRect().getHeight();
- const F32 half_width = F32(width) / 2.0f;
- const F32 half_height = F32(height) / 2.0f;
-
- // Compute center into sim grid coordinates
- S32 world_center_x = S32((-mPanX / mMapScale) + (camera_global.mdV[0] / REGION_WIDTH_METERS));
- S32 world_center_y = S32((-mPanY / mMapScale) + (camera_global.mdV[1] / REGION_WIDTH_METERS));
-
- // Compute the boundaries into sim grid coordinates
- S32 world_left = world_center_x - S32(half_width / mMapScale) - 1;
- S32 world_right = world_center_x + S32(half_width / mMapScale) + 1;
- S32 world_bottom = world_center_y - S32(half_height / mMapScale) - 1;
- S32 world_top = world_center_y + S32(half_height / mMapScale) + 1;
-
- //LL_INFOS("WorldMap") << "LLWorldMapView::updateVisibleBlocks() : mMapScale = " << mMapScale << ", left = " << world_left << ", right = " << world_right << ", bottom = " << world_bottom << ", top = " << world_top << LL_ENDL;
- LLWorldMap::getInstance()->updateRegions(world_left, world_bottom, world_right, world_top);
+ if (LLWorldMipmap::scaleToLevel(mMapScale) > DRAW_SIMINFO_THRESHOLD)
+ {
+ // If we're zoomed out too much, we just don't load all those sim info: too much!
+ return;
+ }
+
+ // Load the blocks visible in the current World Map view
+
+ // Get the World Map view coordinates and boundaries
+ LLVector3d camera_global = gAgentCamera.getCameraPositionGlobal();
+ const S32 width = getRect().getWidth();
+ const S32 height = getRect().getHeight();
+ const F32 half_width = F32(width) / 2.0f;
+ const F32 half_height = F32(height) / 2.0f;
+
+ // Compute center into sim grid coordinates
+ S32 world_center_x = S32((-mPanX / mMapScale) + (camera_global.mdV[0] / REGION_WIDTH_METERS));
+ S32 world_center_y = S32((-mPanY / mMapScale) + (camera_global.mdV[1] / REGION_WIDTH_METERS));
+
+ // Compute the boundaries into sim grid coordinates
+ S32 world_left = world_center_x - S32(half_width / mMapScale) - 1;
+ S32 world_right = world_center_x + S32(half_width / mMapScale) + 1;
+ S32 world_bottom = world_center_y - S32(half_height / mMapScale) - 1;
+ S32 world_top = world_center_y + S32(half_height / mMapScale) + 1;
+
+ //LL_INFOS("WorldMap") << "LLWorldMapView::updateVisibleBlocks() : mMapScale = " << mMapScale << ", left = " << world_left << ", right = " << world_right << ", bottom = " << world_bottom << ", top = " << world_top << LL_ENDL;
+ LLWorldMap::getInstance()->updateRegions(world_left, world_bottom, world_right, world_top);
}
BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask )
{
- if (hasMouseCapture())
- {
- if (mPanning || llabs(x - mMouseDownX) > 1 || llabs(y - mMouseDownY) > 1)
- {
- // just started panning, so hide cursor
- if (!mPanning)
- {
- mPanning = TRUE;
- gViewerWindow->hideCursor();
- }
-
- F32 delta_x = (F32)(gViewerWindow->getCurrentMouseDX());
- F32 delta_y = (F32)(gViewerWindow->getCurrentMouseDY());
-
- // Set pan to value at start of drag + offset
- mPanX += delta_x;
- mPanY += delta_y;
- mTargetPanX = mPanX;
- mTargetPanY = mPanY;
-
- gViewerWindow->moveCursorToCenter();
- }
-
- // doesn't matter, cursor should be hidden
- gViewerWindow->setCursor(UI_CURSOR_CROSS );
- return TRUE;
- }
- else
- {
- // While we're waiting for data from the tracker, we're busy. JC
- LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
- if (LLTracker::isTracking(NULL)
- && pos_global.isExactlyZero())
- {
- gViewerWindow->setCursor( UI_CURSOR_WAIT );
- }
- else
- {
- gViewerWindow->setCursor( UI_CURSOR_CROSS );
- }
- LL_DEBUGS("UserInput") << "hover handled by LLWorldMapView" << LL_ENDL;
- return TRUE;
- }
+ if (hasMouseCapture())
+ {
+ if (mPanning || llabs(x - mMouseDownX) > 1 || llabs(y - mMouseDownY) > 1)
+ {
+ // just started panning, so hide cursor
+ if (!mPanning)
+ {
+ mPanning = TRUE;
+ gViewerWindow->hideCursor();
+ }
+
+ F32 delta_x = (F32)(gViewerWindow->getCurrentMouseDX());
+ F32 delta_y = (F32)(gViewerWindow->getCurrentMouseDY());
+
+ // Set pan to value at start of drag + offset
+ mPanX += delta_x;
+ mPanY += delta_y;
+ mTargetPanX = mPanX;
+ mTargetPanY = mPanY;
+
+ gViewerWindow->moveCursorToCenter();
+ }
+
+ // doesn't matter, cursor should be hidden
+ gViewerWindow->setCursor(UI_CURSOR_CROSS );
+ return TRUE;
+ }
+ else
+ {
+ // While we're waiting for data from the tracker, we're busy. JC
+ LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
+ if (LLTracker::isTracking(NULL)
+ && pos_global.isExactlyZero())
+ {
+ gViewerWindow->setCursor( UI_CURSOR_WAIT );
+ }
+ else
+ {
+ gViewerWindow->setCursor( UI_CURSOR_CROSS );
+ }
+ LL_DEBUGS("UserInput") << "hover handled by LLWorldMapView" << LL_ENDL;
+ return TRUE;
+ }
}
BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
{
- if( sHandledLastClick )
- {
- S32 hit_type;
- LLUUID id;
- handleClick(x, y, mask, &hit_type, &id);
-
- switch (hit_type)
- {
- case MAP_ITEM_PG_EVENT:
- case MAP_ITEM_MATURE_EVENT:
- case MAP_ITEM_ADULT_EVENT:
- {
- LLFloaterReg::hideInstance("world_map");
- // This is an ungainly hack
- std::string uuid_str;
- S32 event_id;
- id.toString(uuid_str);
- uuid_str = uuid_str.substr(28);
- sscanf(uuid_str.c_str(), "%X", &event_id);
- // Invoke the event details floater if someone is clicking on an event.
- LLSD params(LLSD::emptyArray());
- params.append(event_id);
- LLCommandDispatcher::dispatch("event", params, LLSD(), LLGridManager::getInstance()->getGrid(), NULL, LLCommandHandler::NAV_TYPE_CLICKED, true);
- break;
- }
- case MAP_ITEM_LAND_FOR_SALE:
- case MAP_ITEM_LAND_FOR_SALE_ADULT:
- {
- LLVector3d pos_global = viewPosToGlobal(x, y);
- std::string sim_name;
- if (LLWorldMap::getInstance()->simNameFromPosGlobal(pos_global, sim_name))
- {
- LLFloaterReg::hideInstance("world_map");
- LLFloaterReg::showInstance("search", LLSD().with("category", "land").with("query", sim_name));
- }
- break;
- }
- case MAP_ITEM_CLASSIFIED:
- {
- LLFloaterReg::hideInstance("world_map");
- LLFloaterReg::showInstance("search", LLSD().with("category", "classifieds").with("query", id));
- break;
- }
- default:
- {
- if (LLWorldMap::getInstance()->isTracking())
- {
- LLWorldMap::getInstance()->setTrackingDoubleClick();
- }
- else
- {
- // Teleport if we got a valid location
- LLVector3d pos_global = viewPosToGlobal(x,y);
- LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
- if (sim_info && !sim_info->isDown())
- {
- gAgent.teleportViaLocation( pos_global );
- }
- }
- }
- };
-
- return TRUE;
- }
- return FALSE;
+ if( sHandledLastClick )
+ {
+ S32 hit_type;
+ LLUUID id;
+ handleClick(x, y, mask, &hit_type, &id);
+
+ switch (hit_type)
+ {
+ case MAP_ITEM_PG_EVENT:
+ case MAP_ITEM_MATURE_EVENT:
+ case MAP_ITEM_ADULT_EVENT:
+ {
+ LLFloaterReg::hideInstance("world_map");
+ // This is an ungainly hack
+ std::string uuid_str;
+ S32 event_id;
+ id.toString(uuid_str);
+ uuid_str = uuid_str.substr(28);
+ sscanf(uuid_str.c_str(), "%X", &event_id);
+ // Invoke the event details floater if someone is clicking on an event.
+ LLSD params(LLSD::emptyArray());
+ params.append(event_id);
+ LLCommandDispatcher::dispatch("event", params, LLSD(), LLGridManager::getInstance()->getGrid(), NULL, LLCommandHandler::NAV_TYPE_CLICKED, true);
+ break;
+ }
+ case MAP_ITEM_LAND_FOR_SALE:
+ case MAP_ITEM_LAND_FOR_SALE_ADULT:
+ {
+ LLVector3d pos_global = viewPosToGlobal(x, y);
+ std::string sim_name;
+ if (LLWorldMap::getInstance()->simNameFromPosGlobal(pos_global, sim_name))
+ {
+ LLFloaterReg::hideInstance("world_map");
+ LLFloaterReg::showInstance("search", LLSD().with("category", "land").with("query", sim_name));
+ }
+ break;
+ }
+ case MAP_ITEM_CLASSIFIED:
+ {
+ LLFloaterReg::hideInstance("world_map");
+ LLFloaterReg::showInstance("search", LLSD().with("category", "classifieds").with("query", id));
+ break;
+ }
+ default:
+ {
+ if (LLWorldMap::getInstance()->isTracking())
+ {
+ LLWorldMap::getInstance()->setTrackingDoubleClick();
+ }
+ else
+ {
+ // Teleport if we got a valid location
+ LLVector3d pos_global = viewPosToGlobal(x,y);
+ LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
+ if (sim_info && !sim_info->isDown())
+ {
+ gAgent.teleportViaLocation( pos_global );
+ }
+ }
+ }
+ };
+
+ return TRUE;
+ }
+ return FALSE;
}
// static
diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h
index ce8af76a82..fdc944d7d1 100644
--- a/indra/newview/llworldmapview.h
+++ b/indra/newview/llworldmapview.h
@@ -1,32 +1,32 @@
-/**
+/**
* @file llworldmapview.h
* @brief LLWorldMapView class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// View of the global map of the world
-// The data (model) for the global map (a singleton, unique to the application instance) is
+// The data (model) for the global map (a singleton, unique to the application instance) is
// in LLWorldMap and is typically accessed using LLWorldMap::getInstance()
#ifndef LL_LLWORLDMAPVIEW_H
@@ -47,25 +47,25 @@ class LLTextBox;
class LLWorldMapView : public LLPanel
{
public:
- static void initClass();
- static void cleanupClass();
-
- LLWorldMapView();
- virtual ~LLWorldMapView();
-
- virtual BOOL postBuild();
-
- virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE );
- virtual void setVisible(BOOL visible);
-
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
- virtual BOOL handleHover( S32 x, S32 y, MASK mask );
- virtual BOOL handleToolTip( S32 x, S32 y, MASK mask);
-
- bool checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track);
- void handleClick(S32 x, S32 y, MASK mask, S32* hit_type, LLUUID* id);
+ static void initClass();
+ static void cleanupClass();
+
+ LLWorldMapView();
+ virtual ~LLWorldMapView();
+
+ virtual BOOL postBuild();
+
+ virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE );
+ virtual void setVisible(BOOL visible);
+
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
+ virtual BOOL handleHover( S32 x, S32 y, MASK mask );
+ virtual BOOL handleToolTip( S32 x, S32 y, MASK mask);
+
+ bool checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track);
+ void handleClick(S32 x, S32 y, MASK mask, S32* hit_type, LLUUID* id);
// Scale, aka zoom, is shared across all instances! (i.e. Terrain and Objects maps are always registered)
// Zoom is used for UI and will interpolate the map scale over multiple frames.
@@ -78,130 +78,130 @@ public:
static void setScaleSetting(F32 scaleSetting);
static F32 getScaleSetting();
// Pan is in pixels relative to the center of the map.
- void translatePan( S32 delta_x, S32 delta_y );
+ void translatePan( S32 delta_x, S32 delta_y );
void setPan( S32 x, S32 y, BOOL snap = TRUE );
void setPanWithInterpTime(S32 x, S32 y, BOOL snap, F32 interp_time);
- // Return true if the current scale level is above the threshold for accessing region info
+ // Return true if the current scale level is above the threshold for accessing region info
bool showRegionInfo();
- LLVector3 globalPosToView(const LLVector3d& global_pos);
- LLVector3d viewPosToGlobal(S32 x,S32 y);
-
- virtual void draw();
- void drawGenericItems(const LLSimInfo::item_info_list_t& items, LLUIImagePtr image);
- void drawGenericItem(const LLItemInfo& item, LLUIImagePtr image);
- void drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color = LLColor4::white);
- void drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color);
- void drawAgents();
- void drawItems();
- void drawFrustum();
- void drawMipmap(S32 width, S32 height);
- bool drawMipmapLevel(S32 width, S32 height, S32 level, bool load = true);
-
- static void cleanupTextures();
-
- // Draw the tracking indicator, doing the right thing if it's outside
- // the view area.
- void drawTracking( const LLVector3d& pos_global, const LLColor4& color, BOOL draw_arrow = TRUE,
- const std::string& label = std::string(), const std::string& tooltip = std::string(),
- S32 vert_offset = 0);
- static void drawTrackingArrow(const LLRect& view_rect, S32 x, S32 y,
- const LLColor4& color,
- S32 arrow_size = DEFAULT_TRACKING_ARROW_SIZE);
- static void drawTrackingDot(F32 x_pixels,
- F32 y_pixels,
- const LLColor4& color,
- F32 relative_z = 0.f,
- F32 dot_radius = 5.f);
-
- static void drawTrackingCircle( const LLRect& rect, S32 x, S32 y,
- const LLColor4& color,
- S32 min_thickness,
- S32 overlap );
- static void drawAvatar( F32 x_pixels,
- F32 y_pixels,
- const LLColor4& color,
- F32 relative_z = 0.f,
- F32 dot_radius = 3.f,
- bool reached_max_z = false);
- static void drawIconName(F32 x_pixels,
- F32 y_pixels,
- const LLColor4& color,
- const std::string& first_line,
- const std::string& second_line);
-
- // Prevents accidental double clicks
- static void clearLastClick() { sHandledLastClick = FALSE; }
-
- // if the view changes, download additional sim info as needed
- void updateVisibleBlocks();
+ LLVector3 globalPosToView(const LLVector3d& global_pos);
+ LLVector3d viewPosToGlobal(S32 x,S32 y);
+
+ virtual void draw();
+ void drawGenericItems(const LLSimInfo::item_info_list_t& items, LLUIImagePtr image);
+ void drawGenericItem(const LLItemInfo& item, LLUIImagePtr image);
+ void drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color = LLColor4::white);
+ void drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color);
+ void drawAgents();
+ void drawItems();
+ void drawFrustum();
+ void drawMipmap(S32 width, S32 height);
+ bool drawMipmapLevel(S32 width, S32 height, S32 level, bool load = true);
+
+ static void cleanupTextures();
+
+ // Draw the tracking indicator, doing the right thing if it's outside
+ // the view area.
+ void drawTracking( const LLVector3d& pos_global, const LLColor4& color, BOOL draw_arrow = TRUE,
+ const std::string& label = std::string(), const std::string& tooltip = std::string(),
+ S32 vert_offset = 0);
+ static void drawTrackingArrow(const LLRect& view_rect, S32 x, S32 y,
+ const LLColor4& color,
+ S32 arrow_size = DEFAULT_TRACKING_ARROW_SIZE);
+ static void drawTrackingDot(F32 x_pixels,
+ F32 y_pixels,
+ const LLColor4& color,
+ F32 relative_z = 0.f,
+ F32 dot_radius = 5.f);
+
+ static void drawTrackingCircle( const LLRect& rect, S32 x, S32 y,
+ const LLColor4& color,
+ S32 min_thickness,
+ S32 overlap );
+ static void drawAvatar( F32 x_pixels,
+ F32 y_pixels,
+ const LLColor4& color,
+ F32 relative_z = 0.f,
+ F32 dot_radius = 3.f,
+ bool reached_max_z = false);
+ static void drawIconName(F32 x_pixels,
+ F32 y_pixels,
+ const LLColor4& color,
+ const std::string& first_line,
+ const std::string& second_line);
+
+ // Prevents accidental double clicks
+ static void clearLastClick() { sHandledLastClick = FALSE; }
+
+ // if the view changes, download additional sim info as needed
+ void updateVisibleBlocks();
protected:
- void setDirectionPos( LLTextBox* text_box, F32 rotation );
- void updateDirections();
+ void setDirectionPos( LLTextBox* text_box, F32 rotation );
+ void updateDirections();
public:
- LLColor4 mBackgroundColor;
-
- static LLUIImagePtr sAvatarSmallImage;
- static LLUIImagePtr sAvatarYouImage;
- static LLUIImagePtr sAvatarYouLargeImage;
- static LLUIImagePtr sAvatarLevelImage;
- static LLUIImagePtr sAvatarAboveImage;
- static LLUIImagePtr sAvatarBelowImage;
- static LLUIImagePtr sAvatarUnknownImage;
-
- static LLUIImagePtr sTelehubImage;
- static LLUIImagePtr sInfohubImage;
- static LLUIImagePtr sHomeImage;
- static LLUIImagePtr sEventImage;
- static LLUIImagePtr sEventMatureImage;
- static LLUIImagePtr sEventAdultImage;
- static LLUIImagePtr sTrackCircleImage;
- static LLUIImagePtr sTrackArrowImage;
- static LLUIImagePtr sClassifiedsImage;
- static LLUIImagePtr sForSaleImage;
- static LLUIImagePtr sForSaleAdultImage;
-
- BOOL mItemPicked;
+ LLColor4 mBackgroundColor;
+
+ static LLUIImagePtr sAvatarSmallImage;
+ static LLUIImagePtr sAvatarYouImage;
+ static LLUIImagePtr sAvatarYouLargeImage;
+ static LLUIImagePtr sAvatarLevelImage;
+ static LLUIImagePtr sAvatarAboveImage;
+ static LLUIImagePtr sAvatarBelowImage;
+ static LLUIImagePtr sAvatarUnknownImage;
+
+ static LLUIImagePtr sTelehubImage;
+ static LLUIImagePtr sInfohubImage;
+ static LLUIImagePtr sHomeImage;
+ static LLUIImagePtr sEventImage;
+ static LLUIImagePtr sEventMatureImage;
+ static LLUIImagePtr sEventAdultImage;
+ static LLUIImagePtr sTrackCircleImage;
+ static LLUIImagePtr sTrackArrowImage;
+ static LLUIImagePtr sClassifiedsImage;
+ static LLUIImagePtr sForSaleImage;
+ static LLUIImagePtr sForSaleAdultImage;
+
+ BOOL mItemPicked;
F32 mPanX; // in pixels
F32 mPanY; // in pixels
F32 mTargetPanX; // in pixels
F32 mTargetPanY; // in pixels
- static S32 sTrackingArrowX;
- static S32 sTrackingArrowY;
- static bool sVisibleTilesLoaded;
+ static S32 sTrackingArrowX;
+ static S32 sTrackingArrowY;
+ static bool sVisibleTilesLoaded;
- // Are we mid-pan from a user drag?
- BOOL mPanning;
- S32 mMouseDownPanX; // value at start of drag
- S32 mMouseDownPanY; // value at start of drag
- S32 mMouseDownX;
- S32 mMouseDownY;
+ // Are we mid-pan from a user drag?
+ BOOL mPanning;
+ S32 mMouseDownPanX; // value at start of drag
+ S32 mMouseDownPanY; // value at start of drag
+ S32 mMouseDownX;
+ S32 mMouseDownY;
- LLTextBox* mTextBoxEast;
- LLTextBox* mTextBoxNorth;
- LLTextBox* mTextBoxWest;
- LLTextBox* mTextBoxSouth;
+ LLTextBox* mTextBoxEast;
+ LLTextBox* mTextBoxNorth;
+ LLTextBox* mTextBoxWest;
+ LLTextBox* mTextBoxSouth;
- LLTextBox* mTextBoxSouthEast;
- LLTextBox* mTextBoxNorthEast;
- LLTextBox* mTextBoxNorthWest;
- LLTextBox* mTextBoxSouthWest;
- LLTextBox* mTextBoxScrollHint;
+ LLTextBox* mTextBoxSouthEast;
+ LLTextBox* mTextBoxNorthEast;
+ LLTextBox* mTextBoxNorthWest;
+ LLTextBox* mTextBoxSouthWest;
+ LLTextBox* mTextBoxScrollHint;
- static BOOL sHandledLastClick;
- S32 mSelectIDStart;
+ static BOOL sHandledLastClick;
+ S32 mSelectIDStart;
- // Keep the list of regions that are displayed on screen. Avoids iterating through the whole region map after draw().
- typedef std::vector<U64> handle_list_t;
- handle_list_t mVisibleRegions; // set every frame
+ // Keep the list of regions that are displayed on screen. Avoids iterating through the whole region map after draw().
+ typedef std::vector<U64> handle_list_t;
+ handle_list_t mVisibleRegions; // set every frame
- static std::map<std::string,std::string> sStringsMap;
+ static std::map<std::string,std::string> sStringsMap;
private:
- void drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F32 right);
+ void drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F32 right);
void setScale(F32 scale, bool snap = true);
diff --git a/indra/newview/llworldmipmap.cpp b/indra/newview/llworldmipmap.cpp
index 040d0deaf3..2e8fae6e16 100644
--- a/indra/newview/llworldmipmap.cpp
+++ b/indra/newview/llworldmipmap.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llworldmipmap.cpp
* @brief Data storage for the S3 mipmap of the entire world.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,31 +27,31 @@
#include "llviewerprecompiledheaders.h"
#include "llworldmipmap.h"
-#include "llviewercontrol.h" // LLControlGroup
+#include "llviewercontrol.h" // LLControlGroup
#include "llviewertexturelist.h"
-#include "math.h" // log()
+#include "math.h" // log()
// Turn this on to output tile stats in the standard output
#define DEBUG_TILES_STAT 0
LLWorldMipmap::LLWorldMipmap() :
- mCurrentLevel(0)
+ mCurrentLevel(0)
{
}
LLWorldMipmap::~LLWorldMipmap()
{
- reset();
+ reset();
}
// Delete all sublevel maps and clean them
void LLWorldMipmap::reset()
{
- for (int level = 0; level < MAP_LEVELS; level++)
- {
- mWorldObjectsMipMap[level].clear();
- }
+ for (int level = 0; level < MAP_LEVELS; level++)
+ {
+ mWorldObjectsMipMap[level].clear();
+ }
}
// This method should be called before each use of the mipmap (typically, before each draw), so that to let
@@ -61,141 +61,141 @@ void LLWorldMipmap::reset()
void LLWorldMipmap::equalizeBoostLevels()
{
#if DEBUG_TILES_STAT
- S32 nb_missing = 0;
- S32 nb_tiles = 0;
- S32 nb_visible = 0;
+ S32 nb_missing = 0;
+ S32 nb_tiles = 0;
+ S32 nb_visible = 0;
#endif // DEBUG_TILES_STAT
- // For each level
- for (S32 level = 0; level < MAP_LEVELS; level++)
- {
- sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level];
- // For each tile
- for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
- {
- LLPointer<LLViewerFetchedTexture> img = iter->second;
- S32 current_boost_level = img->getBoostLevel();
- if (current_boost_level == LLGLTexture::BOOST_MAP_VISIBLE)
- {
- // If level was BOOST_MAP_VISIBLE, the tile has been used in the last draw so keep it high
- img->setBoostLevel(LLGLTexture::BOOST_MAP);
- }
- else
- {
- // If level was BOOST_MAP only (or anything else...), the tile wasn't used in the last draw
- // so we drop its boost level to BOOST_NONE.
- img->setBoostLevel(LLGLTexture::BOOST_NONE);
- }
+ // For each level
+ for (S32 level = 0; level < MAP_LEVELS; level++)
+ {
+ sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level];
+ // For each tile
+ for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
+ {
+ LLPointer<LLViewerFetchedTexture> img = iter->second;
+ S32 current_boost_level = img->getBoostLevel();
+ if (current_boost_level == LLGLTexture::BOOST_MAP_VISIBLE)
+ {
+ // If level was BOOST_MAP_VISIBLE, the tile has been used in the last draw so keep it high
+ img->setBoostLevel(LLGLTexture::BOOST_MAP);
+ }
+ else
+ {
+ // If level was BOOST_MAP only (or anything else...), the tile wasn't used in the last draw
+ // so we drop its boost level to BOOST_NONE.
+ img->setBoostLevel(LLGLTexture::BOOST_NONE);
+ }
#if DEBUG_TILES_STAT
- // Increment some stats if compile option on
- nb_tiles++;
- if (current_boost_level == LLGLTexture::BOOST_MAP_VISIBLE)
- {
- nb_visible++;
- }
- if (img->isMissingAsset())
- {
- nb_missing++;
- }
+ // Increment some stats if compile option on
+ nb_tiles++;
+ if (current_boost_level == LLGLTexture::BOOST_MAP_VISIBLE)
+ {
+ nb_visible++;
+ }
+ if (img->isMissingAsset())
+ {
+ nb_missing++;
+ }
#endif // DEBUG_TILES_STAT
- }
- }
+ }
+ }
#if DEBUG_TILES_STAT
- LL_INFOS("WorldMap") << "LLWorldMipmap tile stats : total requested = " << nb_tiles << ", visible = " << nb_visible << ", missing = " << nb_missing << LL_ENDL;
+ LL_INFOS("WorldMap") << "LLWorldMipmap tile stats : total requested = " << nb_tiles << ", visible = " << nb_visible << ", missing = " << nb_missing << LL_ENDL;
#endif // DEBUG_TILES_STAT
}
// This method should be used when the mipmap is not actively used for a while, e.g., the map UI is hidden
void LLWorldMipmap::dropBoostLevels()
{
- // For each level
- for (S32 level = 0; level < MAP_LEVELS; level++)
- {
- sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level];
- // For each tile
- for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
- {
- LLPointer<LLViewerFetchedTexture> img = iter->second;
- img->setBoostLevel(LLGLTexture::BOOST_NONE);
- }
- }
+ // For each level
+ for (S32 level = 0; level < MAP_LEVELS; level++)
+ {
+ sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level];
+ // For each tile
+ for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
+ {
+ LLPointer<LLViewerFetchedTexture> img = iter->second;
+ img->setBoostLevel(LLGLTexture::BOOST_NONE);
+ }
+ }
}
LLPointer<LLViewerFetchedTexture> LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load)
{
- // Check the input data
- llassert(level <= MAP_LEVELS);
- llassert(level >= 1);
+ // Check the input data
+ llassert(level <= MAP_LEVELS);
+ llassert(level >= 1);
- // If the *loading* level changed, cleared the new level from "missed" tiles
- // so that we get a chance to reload them
- if (load && (level != mCurrentLevel))
- {
- cleanMissedTilesFromLevel(level);
- mCurrentLevel = level;
- }
+ // If the *loading* level changed, cleared the new level from "missed" tiles
+ // so that we get a chance to reload them
+ if (load && (level != mCurrentLevel))
+ {
+ cleanMissedTilesFromLevel(level);
+ mCurrentLevel = level;
+ }
- // Build the region handle
- U64 handle = convertGridToHandle(grid_x, grid_y);
+ // Build the region handle
+ U64 handle = convertGridToHandle(grid_x, grid_y);
- // Check if the image is around already
- sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1];
- sublevel_tiles_t::iterator found = level_mipmap.find(handle);
+ // Check if the image is around already
+ sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1];
+ sublevel_tiles_t::iterator found = level_mipmap.find(handle);
- // If not there and load on, go load it
- if (found == level_mipmap.end())
- {
- if (load)
- {
- // Load it
- LLPointer<LLViewerFetchedTexture> img = loadObjectsTile(grid_x, grid_y, level);
- // Insert the image in the map
- level_mipmap.insert(sublevel_tiles_t::value_type( handle, img ));
- // Find the element again in the map (it's there now...)
- found = level_mipmap.find(handle);
- }
- else
- {
- // Return with NULL if not found and we're not trying to load
- return NULL;
- }
- }
+ // If not there and load on, go load it
+ if (found == level_mipmap.end())
+ {
+ if (load)
+ {
+ // Load it
+ LLPointer<LLViewerFetchedTexture> img = loadObjectsTile(grid_x, grid_y, level);
+ // Insert the image in the map
+ level_mipmap.insert(sublevel_tiles_t::value_type( handle, img ));
+ // Find the element again in the map (it's there now...)
+ found = level_mipmap.find(handle);
+ }
+ else
+ {
+ // Return with NULL if not found and we're not trying to load
+ return NULL;
+ }
+ }
- // Get the image pointer and check if this asset is missing
- LLPointer<LLViewerFetchedTexture> img = found->second;
- if (img->isMissingAsset())
- {
- // Return NULL if asset missing
- return NULL;
- }
- else
- {
- // Boost the tile level so to mark it's in use *if* load on
- if (load)
- {
- img->setBoostLevel(LLGLTexture::BOOST_MAP_VISIBLE);
- }
- return img;
- }
+ // Get the image pointer and check if this asset is missing
+ LLPointer<LLViewerFetchedTexture> img = found->second;
+ if (img->isMissingAsset())
+ {
+ // Return NULL if asset missing
+ return NULL;
+ }
+ else
+ {
+ // Boost the tile level so to mark it's in use *if* load on
+ if (load)
+ {
+ img->setBoostLevel(LLGLTexture::BOOST_MAP_VISIBLE);
+ }
+ return img;
+ }
}
LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32 grid_y, S32 level)
{
- // Get the grid coordinates
- std::string imageurl = gSavedSettings.getString("CurrentMapServerURL") + llformat("map-%d-%d-%d-objects.jpg", level, grid_x, grid_y);
+ // Get the grid coordinates
+ std::string imageurl = gSavedSettings.getString("CurrentMapServerURL") + llformat("map-%d-%d-%d-objects.jpg", level, grid_x, grid_y);
- // DO NOT COMMIT!! DEBUG ONLY!!!
- // Use a local jpeg for every tile to test map speed without S3 access
- //imageurl = "file://C:\\Develop\\mapserver-distribute-3\\indra\\build-vc80\\mapserver\\relwithdebinfo\\regions\\00995\\01001\\region-995-1001-prims.jpg";
- // END DEBUG
- //LL_INFOS("WorldMap") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL;
+ // DO NOT COMMIT!! DEBUG ONLY!!!
+ // Use a local jpeg for every tile to test map speed without S3 access
+ //imageurl = "file://C:\\Develop\\mapserver-distribute-3\\indra\\build-vc80\\mapserver\\relwithdebinfo\\regions\\00995\\01001\\region-995-1001-prims.jpg";
+ // END DEBUG
+ //LL_INFOS("WorldMap") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL;
- LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- LL_INFOS("MAPURL") << "fetching map tile from " << imageurl << LL_ENDL;
+ LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ LL_INFOS("MAPURL") << "fetching map tile from " << imageurl << LL_ENDL;
- img->setBoostLevel(LLGLTexture::BOOST_MAP);
+ img->setBoostLevel(LLGLTexture::BOOST_MAP);
- // Return the smart pointer
- return img;
+ // Return the smart pointer
+ return img;
}
// This method is used to clean up a level from tiles marked as "missing".
@@ -204,67 +204,67 @@ LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32
// This creates "blue" areas in a subresolution that never got a chance to reload if we don't clean up the level.
void LLWorldMipmap::cleanMissedTilesFromLevel(S32 level)
{
- // Check the input data
- llassert(level <= MAP_LEVELS);
- llassert(level >= 0);
+ // Check the input data
+ llassert(level <= MAP_LEVELS);
+ llassert(level >= 0);
- // This happens when the object is first initialized
- if (level == 0)
- {
- return;
- }
+ // This happens when the object is first initialized
+ if (level == 0)
+ {
+ return;
+ }
- // Iterate through the subresolution level and suppress the tiles that are marked as missing
- // Note: erasing in a map while iterating through it is bug prone. Using a postfix increment is mandatory here.
- sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1];
- sublevel_tiles_t::iterator it = level_mipmap.begin();
- while (it != level_mipmap.end())
- {
- LLPointer<LLViewerFetchedTexture> img = it->second;
- if (img->isMissingAsset())
- {
- level_mipmap.erase(it++);
- }
- else
- {
- ++it;
- }
- }
- return;
+ // Iterate through the subresolution level and suppress the tiles that are marked as missing
+ // Note: erasing in a map while iterating through it is bug prone. Using a postfix increment is mandatory here.
+ sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1];
+ sublevel_tiles_t::iterator it = level_mipmap.begin();
+ while (it != level_mipmap.end())
+ {
+ LLPointer<LLViewerFetchedTexture> img = it->second;
+ if (img->isMissingAsset())
+ {
+ level_mipmap.erase(it++);
+ }
+ else
+ {
+ ++it;
+ }
+ }
+ return;
}
// static methods
// Compute the level in the world mipmap (between 1 and MAP_LEVELS, as in the URL) given the scale (size of a sim in screen pixels)
S32 LLWorldMipmap::scaleToLevel(F32 scale)
{
- // If scale really small, picks up the higest level there is (lowest resolution)
- if (scale <= F32_MIN)
- return MAP_LEVELS;
- // Compute the power of two resolution level knowing the base level
- S32 level = llfloor((log(REGION_WIDTH_METERS/scale)/log(2.0f)) + 1.0f);
- // Check bounds and return the value
- if (level > MAP_LEVELS)
- return MAP_LEVELS;
- else if (level < 1)
- return 1;
- else
- return level;
+ // If scale really small, picks up the higest level there is (lowest resolution)
+ if (scale <= F32_MIN)
+ return MAP_LEVELS;
+ // Compute the power of two resolution level knowing the base level
+ S32 level = llfloor((log(REGION_WIDTH_METERS/scale)/log(2.0f)) + 1.0f);
+ // Check bounds and return the value
+ if (level > MAP_LEVELS)
+ return MAP_LEVELS;
+ else if (level < 1)
+ return 1;
+ else
+ return level;
}
// Convert world coordinates to mipmap grid coordinates at a given level (between 1 and MAP_LEVELS)
void LLWorldMipmap::globalToMipmap(F64 global_x, F64 global_y, S32 level, U32* grid_x, U32* grid_y)
{
- // Check the input data
- llassert(level <= MAP_LEVELS);
- llassert(level >= 1);
+ // Check the input data
+ llassert(level <= MAP_LEVELS);
+ llassert(level >= 1);
- // Convert world coordinates into grid coordinates
- *grid_x = lltrunc(global_x/REGION_WIDTH_METERS);
- *grid_y = lltrunc(global_y/REGION_WIDTH_METERS);
- // Compute the valid grid coordinates at that level of the mipmap
- S32 regions_in_tile = 1 << (level - 1);
- *grid_x = *grid_x - (*grid_x % regions_in_tile);
- *grid_y = *grid_y - (*grid_y % regions_in_tile);
+ // Convert world coordinates into grid coordinates
+ *grid_x = lltrunc(global_x/REGION_WIDTH_METERS);
+ *grid_y = lltrunc(global_y/REGION_WIDTH_METERS);
+ // Compute the valid grid coordinates at that level of the mipmap
+ S32 regions_in_tile = 1 << (level - 1);
+ *grid_x = *grid_x - (*grid_x % regions_in_tile);
+ *grid_y = *grid_y - (*grid_y % regions_in_tile);
}
diff --git a/indra/newview/llworldmipmap.h b/indra/newview/llworldmipmap.h
index 963aac1403..ab98b55b72 100644
--- a/indra/newview/llworldmipmap.h
+++ b/indra/newview/llworldmipmap.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llworldmipmap.h
* @brief Data storage for the S3 mipmap of the entire world.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -29,18 +29,18 @@
#include <map>
-#include "llmemory.h" // LLPointer
-#include "indra_constants.h" // REGION_WIDTH_UNITS
-#include "llregionhandle.h" // to_region_handle()
+#include "llmemory.h" // LLPointer
+#include "indra_constants.h" // REGION_WIDTH_UNITS
+#include "llregionhandle.h" // to_region_handle()
class LLViewerFetchedTexture;
// LLWorldMipmap : Mipmap handling of all the tiles used to render the world at any resolution.
-// This class provides a clean structured access to the hierarchy of tiles stored in the
+// This class provides a clean structured access to the hierarchy of tiles stored in the
// Amazon S3 repository and abstracts its directory/file structure.
// The interface of this class though still assumes that the caller knows the general level/tiles
// structure (at least, that it exists...) but doesn't requite the caller to know the details of it.
-// IOW, you need to know that rendering levels exists as well as grid coordinates for regions,
+// IOW, you need to know that rendering levels exists as well as grid coordinates for regions,
// but you can ignore where those tiles are located, how to get them, etc...
// The class API gives you back LLPointer<LLViewerFetchedTexture> per tile.
@@ -52,43 +52,43 @@ class LLViewerFetchedTexture;
class LLWorldMipmap
{
public:
- // Parameters of the mipmap
- static const S32 MAP_LEVELS = 8; // Number of subresolution levels computed by the mapserver
- static const S32 MAP_TILE_SIZE = 256; // Width in pixels of the tiles computed by the mapserver
+ // Parameters of the mipmap
+ static const S32 MAP_LEVELS = 8; // Number of subresolution levels computed by the mapserver
+ static const S32 MAP_TILE_SIZE = 256; // Width in pixels of the tiles computed by the mapserver
- LLWorldMipmap();
- ~LLWorldMipmap();
+ LLWorldMipmap();
+ ~LLWorldMipmap();
- // Clear up the maps and release all image handles
- void reset();
- // Manage the boost levels between loops (typically draw() loops)
- void equalizeBoostLevels();
- // Drop the boost levels to none (used when hiding the map)
- void dropBoostLevels();
- // Get the tile smart pointer, does the loading if necessary
- LLPointer<LLViewerFetchedTexture> getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load = true);
+ // Clear up the maps and release all image handles
+ void reset();
+ // Manage the boost levels between loops (typically draw() loops)
+ void equalizeBoostLevels();
+ // Drop the boost levels to none (used when hiding the map)
+ void dropBoostLevels();
+ // Get the tile smart pointer, does the loading if necessary
+ LLPointer<LLViewerFetchedTexture> getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load = true);
- // Helper functions: those are here as they depend solely on the topology of the mipmap though they don't access it
- // Convert sim scale (given in sim width in display pixels) into a mipmap level
- static S32 scaleToLevel(F32 scale);
- // Convert world coordinates to mipmap grid coordinates at a given level
- static void globalToMipmap(F64 global_x, F64 global_y, S32 level, U32* grid_x, U32* grid_y);
+ // Helper functions: those are here as they depend solely on the topology of the mipmap though they don't access it
+ // Convert sim scale (given in sim width in display pixels) into a mipmap level
+ static S32 scaleToLevel(F32 scale);
+ // Convert world coordinates to mipmap grid coordinates at a given level
+ static void globalToMipmap(F64 global_x, F64 global_y, S32 level, U32* grid_x, U32* grid_y);
private:
- // Get a handle (key) from grid coordinates
- U64 convertGridToHandle(U32 grid_x, U32 grid_y) { return to_region_handle(grid_x * REGION_WIDTH_UNITS, grid_y * REGION_WIDTH_UNITS); }
- // Load the relevant tile from S3
- LLPointer<LLViewerFetchedTexture> loadObjectsTile(U32 grid_x, U32 grid_y, S32 level);
- // Clear a level from its "missing" tiles
- void cleanMissedTilesFromLevel(S32 level);
+ // Get a handle (key) from grid coordinates
+ U64 convertGridToHandle(U32 grid_x, U32 grid_y) { return to_region_handle(grid_x * REGION_WIDTH_UNITS, grid_y * REGION_WIDTH_UNITS); }
+ // Load the relevant tile from S3
+ LLPointer<LLViewerFetchedTexture> loadObjectsTile(U32 grid_x, U32 grid_y, S32 level);
+ // Clear a level from its "missing" tiles
+ void cleanMissedTilesFromLevel(S32 level);
- // The mipmap is organized by resolution level (MAP_LEVELS of them). Each resolution level is an std::map
- // using a region_handle as a key and storing a smart pointer to the image as a value.
- typedef std::map<U64, LLPointer<LLViewerFetchedTexture> > sublevel_tiles_t;
- sublevel_tiles_t mWorldObjectsMipMap[MAP_LEVELS];
-// sublevel_tiles_t mWorldTerrainMipMap[MAP_LEVELS];
+ // The mipmap is organized by resolution level (MAP_LEVELS of them). Each resolution level is an std::map
+ // using a region_handle as a key and storing a smart pointer to the image as a value.
+ typedef std::map<U64, LLPointer<LLViewerFetchedTexture> > sublevel_tiles_t;
+ sublevel_tiles_t mWorldObjectsMipMap[MAP_LEVELS];
+// sublevel_tiles_t mWorldTerrainMipMap[MAP_LEVELS];
- S32 mCurrentLevel; // The level last accessed by a getObjectsTile()
+ S32 mCurrentLevel; // The level last accessed by a getObjectsTile()
};
#endif // LL_LLWORLDMIPMAP_H
diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp
index 3c2c6d15c4..0eabb8983e 100644
--- a/indra/newview/llxmlrpclistener.cpp
+++ b/indra/newview/llxmlrpclistener.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-03-18
* @brief Implementation for llxmlrpclistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -88,13 +88,13 @@ class StatusMapper: public StatusMapperBase<LLXMLRPCTransaction::EStatus>
public:
StatusMapper(): StatusMapperBase<LLXMLRPCTransaction::EStatus>("Status")
{
- mMap[LLXMLRPCTransaction::StatusNotStarted] = "NotStarted";
- mMap[LLXMLRPCTransaction::StatusStarted] = "Started";
- mMap[LLXMLRPCTransaction::StatusDownloading] = "Downloading";
- mMap[LLXMLRPCTransaction::StatusComplete] = "Complete";
- mMap[LLXMLRPCTransaction::StatusCURLError] = "CURLError";
- mMap[LLXMLRPCTransaction::StatusXMLRPCError] = "XMLRPCError";
- mMap[LLXMLRPCTransaction::StatusOtherError] = "OtherError";
+ mMap[LLXMLRPCTransaction::StatusNotStarted] = "NotStarted";
+ mMap[LLXMLRPCTransaction::StatusStarted] = "Started";
+ mMap[LLXMLRPCTransaction::StatusDownloading] = "Downloading";
+ mMap[LLXMLRPCTransaction::StatusComplete] = "Complete";
+ mMap[LLXMLRPCTransaction::StatusCURLError] = "CURLError";
+ mMap[LLXMLRPCTransaction::StatusXMLRPCError] = "XMLRPCError";
+ mMap[LLXMLRPCTransaction::StatusOtherError] = "OtherError";
}
};
@@ -285,7 +285,7 @@ public:
XMLRPC_RequestSetData(request, xparams);
mTransaction.reset(new LLXMLRPCTransaction(mUri, request, true, command.has("http_params")? LLSD(command["http_params"]) : LLSD()));
- mPreviousStatus = mTransaction->status(NULL);
+ mPreviousStatus = mTransaction->status(NULL);
// Free the XMLRPC_REQUEST object and the attached data values.
XMLRPC_RequestFree(request, 1);
@@ -323,42 +323,42 @@ public:
data["error"] = "";
data["transfer_rate"] = 0.0;
LLEventPump& replyPump(LLEventPumps::instance().obtain(mReplyPump));
- if (! done)
+ if (! done)
{
// Not done yet, carry on.
- if (status == LLXMLRPCTransaction::StatusDownloading
- && status != mPreviousStatus)
- {
- // If a response has been received, send the
- // 'downloading' status if it hasn't been sent.
- replyPump.post(data);
- }
-
- mPreviousStatus = status;
+ if (status == LLXMLRPCTransaction::StatusDownloading
+ && status != mPreviousStatus)
+ {
+ // If a response has been received, send the
+ // 'downloading' status if it hasn't been sent.
+ replyPump.post(data);
+ }
+
+ mPreviousStatus = status;
return false;
}
// Here the transaction is complete. Check status.
data["error"] = mTransaction->statusMessage();
- data["transfer_rate"] = mTransaction->transferRate();
+ data["transfer_rate"] = mTransaction->transferRate();
LL_INFOS("LLXMLRPCListener") << mMethod << " result from " << mUri << ": status "
<< data["status"].asString() << ", errorcode "
<< data["errorcode"].asString()
<< " (" << data["error"].asString() << ")"
<< LL_ENDL;
-
- switch (curlcode)
- {
+
+ switch (curlcode)
+ {
#if CURLE_SSL_PEER_CERTIFICATE != CURLE_SSL_CACERT
- case CURLE_SSL_PEER_CERTIFICATE:
+ case CURLE_SSL_PEER_CERTIFICATE:
#endif
- case CURLE_SSL_CACERT:
+ case CURLE_SSL_CACERT:
data["certificate"] = mTransaction->getErrorCertData();
- break;
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
// values of 'curlcode':
// CURLE_COULDNT_RESOLVE_HOST,
// CURLE_SSL_PEER_CERTIFICATE,
@@ -545,7 +545,7 @@ private:
const std::string mReplyPump;
LLTempBoundListener mBoundListener;
std::unique_ptr<LLXMLRPCTransaction> mTransaction;
- LLXMLRPCTransaction::EStatus mPreviousStatus; // To detect state changes.
+ LLXMLRPCTransaction::EStatus mPreviousStatus; // To detect state changes.
};
bool LLXMLRPCListener::process(const LLSD& command)
diff --git a/indra/newview/llxmlrpclistener.h b/indra/newview/llxmlrpclistener.h
index 58b38ce1cf..aaed98eec5 100644
--- a/indra/newview/llxmlrpclistener.h
+++ b/indra/newview/llxmlrpclistener.h
@@ -6,25 +6,25 @@
* actually define the API; the API is defined by the pump name on
* which this class listens, and by the expected content of LLSD it
* receives.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index a77c31eee3..1cd72a1cc5 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llxmlrpctransaction.cpp
- * @brief LLXMLRPCTransaction and related class implementations
+ * @brief LLXMLRPCTransaction and related class implementations
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -65,7 +65,7 @@
namespace boost
{
- using ::boost::movelib::unique_ptr; // move unique_ptr into the boost namespace.
+ using ::boost::movelib::unique_ptr; // move unique_ptr into the boost namespace.
}
// Static instance of LLXMLRPCListener declared here so that every time we
@@ -77,168 +77,168 @@ static LLXMLRPCListener listener("LLXMLRPCTransaction");
LLXMLRPCValue LLXMLRPCValue::operator[](const char* id) const
{
- return LLXMLRPCValue(XMLRPC_VectorGetValueWithID(mV, id));
+ return LLXMLRPCValue(XMLRPC_VectorGetValueWithID(mV, id));
}
std::string LLXMLRPCValue::asString() const
{
- const char* s = XMLRPC_GetValueString(mV);
- return s ? s : "";
+ const char* s = XMLRPC_GetValueString(mV);
+ return s ? s : "";
}
-int LLXMLRPCValue::asInt() const { return XMLRPC_GetValueInt(mV); }
-bool LLXMLRPCValue::asBool() const { return XMLRPC_GetValueBoolean(mV) != 0; }
-double LLXMLRPCValue::asDouble() const { return XMLRPC_GetValueDouble(mV); }
+int LLXMLRPCValue::asInt() const { return XMLRPC_GetValueInt(mV); }
+bool LLXMLRPCValue::asBool() const { return XMLRPC_GetValueBoolean(mV) != 0; }
+double LLXMLRPCValue::asDouble() const { return XMLRPC_GetValueDouble(mV); }
LLXMLRPCValue LLXMLRPCValue::rewind()
{
- return LLXMLRPCValue(XMLRPC_VectorRewind(mV));
+ return LLXMLRPCValue(XMLRPC_VectorRewind(mV));
}
LLXMLRPCValue LLXMLRPCValue::next()
{
- return LLXMLRPCValue(XMLRPC_VectorNext(mV));
+ return LLXMLRPCValue(XMLRPC_VectorNext(mV));
}
bool LLXMLRPCValue::isValid() const
{
- return mV != NULL;
+ return mV != NULL;
}
LLXMLRPCValue LLXMLRPCValue::createArray()
{
- return LLXMLRPCValue(XMLRPC_CreateVector(NULL, xmlrpc_vector_array));
+ return LLXMLRPCValue(XMLRPC_CreateVector(NULL, xmlrpc_vector_array));
}
LLXMLRPCValue LLXMLRPCValue::createStruct()
{
- return LLXMLRPCValue(XMLRPC_CreateVector(NULL, xmlrpc_vector_struct));
+ return LLXMLRPCValue(XMLRPC_CreateVector(NULL, xmlrpc_vector_struct));
}
void LLXMLRPCValue::append(LLXMLRPCValue& v)
{
- XMLRPC_AddValueToVector(mV, v.mV);
+ XMLRPC_AddValueToVector(mV, v.mV);
}
void LLXMLRPCValue::appendString(const std::string& v)
{
- XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueString(NULL, v.c_str(), 0));
+ XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueString(NULL, v.c_str(), 0));
}
void LLXMLRPCValue::appendInt(int v)
{
- XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueInt(NULL, v));
+ XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueInt(NULL, v));
}
void LLXMLRPCValue::appendBool(bool v)
{
- XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueBoolean(NULL, v));
+ XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueBoolean(NULL, v));
}
void LLXMLRPCValue::appendDouble(double v)
{
- XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueDouble(NULL, v));
+ XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueDouble(NULL, v));
}
void LLXMLRPCValue::append(const char* id, LLXMLRPCValue& v)
{
- XMLRPC_SetValueID(v.mV, id, 0);
- XMLRPC_AddValueToVector(mV, v.mV);
+ XMLRPC_SetValueID(v.mV, id, 0);
+ XMLRPC_AddValueToVector(mV, v.mV);
}
void LLXMLRPCValue::appendString(const char* id, const std::string& v)
{
- XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueString(id, v.c_str(), 0));
+ XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueString(id, v.c_str(), 0));
}
void LLXMLRPCValue::appendInt(const char* id, int v)
{
- XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueInt(id, v));
+ XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueInt(id, v));
}
void LLXMLRPCValue::appendBool(const char* id, bool v)
{
- XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueBoolean(id, v));
+ XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueBoolean(id, v));
}
void LLXMLRPCValue::appendDouble(const char* id, double v)
{
- XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueDouble(id, v));
+ XMLRPC_AddValueToVector(mV, XMLRPC_CreateValueDouble(id, v));
}
void LLXMLRPCValue::cleanup()
{
- XMLRPC_CleanupValue(mV);
- mV = NULL;
+ XMLRPC_CleanupValue(mV);
+ mV = NULL;
}
XMLRPC_VALUE LLXMLRPCValue::getValue() const
{
- return mV;
+ return mV;
}
class LLXMLRPCTransaction::Handler : public LLCore::HttpHandler
{
-public:
- Handler(LLCore::HttpRequest::ptr_t &request, LLXMLRPCTransaction::Impl *impl);
- virtual ~Handler();
+public:
+ Handler(LLCore::HttpRequest::ptr_t &request, LLXMLRPCTransaction::Impl *impl);
+ virtual ~Handler();
- virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
+ virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
- typedef std::shared_ptr<LLXMLRPCTransaction::Handler> ptr_t;
+ typedef std::shared_ptr<LLXMLRPCTransaction::Handler> ptr_t;
private:
- LLXMLRPCTransaction::Impl *mImpl;
- LLCore::HttpRequest::ptr_t mRequest;
+ LLXMLRPCTransaction::Impl *mImpl;
+ LLCore::HttpRequest::ptr_t mRequest;
};
class LLXMLRPCTransaction::Impl
{
public:
- typedef LLXMLRPCTransaction::EStatus EStatus;
+ typedef LLXMLRPCTransaction::EStatus EStatus;
- LLCore::HttpRequest::ptr_t mHttpRequest;
+ LLCore::HttpRequest::ptr_t mHttpRequest;
- EStatus mStatus;
- CURLcode mCurlCode;
- std::string mStatusMessage;
- std::string mStatusURI;
- LLCore::HttpResponse::TransferStats::ptr_t mTransferStats;
- Handler::ptr_t mHandler;
- LLCore::HttpHandle mPostH;
+ EStatus mStatus;
+ CURLcode mCurlCode;
+ std::string mStatusMessage;
+ std::string mStatusURI;
+ LLCore::HttpResponse::TransferStats::ptr_t mTransferStats;
+ Handler::ptr_t mHandler;
+ LLCore::HttpHandle mPostH;
- std::string mURI;
+ std::string mURI;
- std::string mProxyAddress;
+ std::string mProxyAddress;
- std::string mResponseText;
- XMLRPC_REQUEST mResponse;
- std::string mCertStore;
- LLSD mErrorCertData;
+ std::string mResponseText;
+ XMLRPC_REQUEST mResponse;
+ std::string mCertStore;
+ LLSD mErrorCertData;
- Impl(const std::string& uri, XMLRPC_REQUEST request, bool useGzip, const LLSD& httpParams);
- Impl(const std::string& uri,
- const std::string& method, LLXMLRPCValue params, bool useGzip);
- ~Impl();
+ Impl(const std::string& uri, XMLRPC_REQUEST request, bool useGzip, const LLSD& httpParams);
+ Impl(const std::string& uri,
+ const std::string& method, LLXMLRPCValue params, bool useGzip);
+ ~Impl();
- bool process();
+ bool process();
- void setStatus(EStatus code, const std::string& message = "", const std::string& uri = "");
- void setHttpStatus(const LLCore::HttpStatus &status);
+ void setStatus(EStatus code, const std::string& message = "", const std::string& uri = "");
+ void setHttpStatus(const LLCore::HttpStatus &status);
private:
- void init(XMLRPC_REQUEST request, bool useGzip, const LLSD& httpParams);
+ void init(XMLRPC_REQUEST request, bool useGzip, const LLSD& httpParams);
};
-LLXMLRPCTransaction::Handler::Handler(LLCore::HttpRequest::ptr_t &request,
- LLXMLRPCTransaction::Impl *impl) :
- mImpl(impl),
- mRequest(request)
+LLXMLRPCTransaction::Handler::Handler(LLCore::HttpRequest::ptr_t &request,
+ LLXMLRPCTransaction::Impl *impl) :
+ mImpl(impl),
+ mRequest(request)
{
}
@@ -246,105 +246,105 @@ LLXMLRPCTransaction::Handler::~Handler()
{
}
-void LLXMLRPCTransaction::Handler::onCompleted(LLCore::HttpHandle handle,
- LLCore::HttpResponse * response)
+void LLXMLRPCTransaction::Handler::onCompleted(LLCore::HttpHandle handle,
+ LLCore::HttpResponse * response)
{
- LLCore::HttpStatus status = response->getStatus();
+ LLCore::HttpStatus status = response->getStatus();
- if (!status)
- {
+ if (!status)
+ {
mImpl->setHttpStatus(status);
LLSD errordata = status.getErrorData();
mImpl->mErrorCertData = errordata;
- if ((status.toULong() != CURLE_SSL_PEER_CERTIFICATE) &&
- (status.toULong() != CURLE_SSL_CACERT))
- {
- // if we have a curl error that's not already been handled
- // (a non cert error), then generate the warning message as
- // appropriate
- LL_WARNS() << "LLXMLRPCTransaction error "
- << status.toHex() << ": " << status.toString() << LL_ENDL;
- LL_WARNS() << "LLXMLRPCTransaction request URI: "
- << mImpl->mURI << LL_ENDL;
- }
-
- return;
- }
-
- mImpl->setStatus(LLXMLRPCTransaction::StatusComplete);
- mImpl->mTransferStats = response->getTransferStats();
-
- // the contents of a buffer array are potentially noncontiguous, so we
- // will need to copy them into an contiguous block of memory for XMLRPC.
- LLCore::BufferArray *body = response->getBody();
- char * bodydata = new char[body->size()];
-
- body->read(0, bodydata, body->size());
-
- mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, body->size(), 0);
-
- delete[] bodydata;
-
- bool hasError = false;
- bool hasFault = false;
- int faultCode = 0;
- std::string faultString;
-
- LLXMLRPCValue error(XMLRPC_RequestGetError(mImpl->mResponse));
- if (error.isValid())
- {
- hasError = true;
- faultCode = error["faultCode"].asInt();
- faultString = error["faultString"].asString();
- }
- else if (XMLRPC_ResponseIsFault(mImpl->mResponse))
- {
- hasFault = true;
- faultCode = XMLRPC_GetResponseFaultCode(mImpl->mResponse);
- faultString = XMLRPC_GetResponseFaultString(mImpl->mResponse);
- }
-
- if (hasError || hasFault)
- {
- mImpl->setStatus(LLXMLRPCTransaction::StatusXMLRPCError);
-
- LL_WARNS() << "LLXMLRPCTransaction XMLRPC "
- << (hasError ? "error " : "fault ")
- << faultCode << ": "
- << faultString << LL_ENDL;
- LL_WARNS() << "LLXMLRPCTransaction request URI: "
- << mImpl->mURI << LL_ENDL;
- }
+ if ((status.toULong() != CURLE_SSL_PEER_CERTIFICATE) &&
+ (status.toULong() != CURLE_SSL_CACERT))
+ {
+ // if we have a curl error that's not already been handled
+ // (a non cert error), then generate the warning message as
+ // appropriate
+ LL_WARNS() << "LLXMLRPCTransaction error "
+ << status.toHex() << ": " << status.toString() << LL_ENDL;
+ LL_WARNS() << "LLXMLRPCTransaction request URI: "
+ << mImpl->mURI << LL_ENDL;
+ }
+
+ return;
+ }
+
+ mImpl->setStatus(LLXMLRPCTransaction::StatusComplete);
+ mImpl->mTransferStats = response->getTransferStats();
+
+ // the contents of a buffer array are potentially noncontiguous, so we
+ // will need to copy them into an contiguous block of memory for XMLRPC.
+ LLCore::BufferArray *body = response->getBody();
+ char * bodydata = new char[body->size()];
+
+ body->read(0, bodydata, body->size());
+
+ mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, body->size(), 0);
+
+ delete[] bodydata;
+
+ bool hasError = false;
+ bool hasFault = false;
+ int faultCode = 0;
+ std::string faultString;
+
+ LLXMLRPCValue error(XMLRPC_RequestGetError(mImpl->mResponse));
+ if (error.isValid())
+ {
+ hasError = true;
+ faultCode = error["faultCode"].asInt();
+ faultString = error["faultString"].asString();
+ }
+ else if (XMLRPC_ResponseIsFault(mImpl->mResponse))
+ {
+ hasFault = true;
+ faultCode = XMLRPC_GetResponseFaultCode(mImpl->mResponse);
+ faultString = XMLRPC_GetResponseFaultString(mImpl->mResponse);
+ }
+
+ if (hasError || hasFault)
+ {
+ mImpl->setStatus(LLXMLRPCTransaction::StatusXMLRPCError);
+
+ LL_WARNS() << "LLXMLRPCTransaction XMLRPC "
+ << (hasError ? "error " : "fault ")
+ << faultCode << ": "
+ << faultString << LL_ENDL;
+ LL_WARNS() << "LLXMLRPCTransaction request URI: "
+ << mImpl->mURI << LL_ENDL;
+ }
}
//=========================================================================
LLXMLRPCTransaction::Impl::Impl(const std::string& uri,
- XMLRPC_REQUEST request, bool useGzip, const LLSD& httpParams)
- : mHttpRequest(),
- mStatus(LLXMLRPCTransaction::StatusNotStarted),
- mURI(uri),
- mResponse(0)
+ XMLRPC_REQUEST request, bool useGzip, const LLSD& httpParams)
+ : mHttpRequest(),
+ mStatus(LLXMLRPCTransaction::StatusNotStarted),
+ mURI(uri),
+ mResponse(0)
{
- init(request, useGzip, httpParams);
+ init(request, useGzip, httpParams);
}
LLXMLRPCTransaction::Impl::Impl(const std::string& uri,
- const std::string& method, LLXMLRPCValue params, bool useGzip)
- : mHttpRequest(),
- mStatus(LLXMLRPCTransaction::StatusNotStarted),
- mURI(uri),
- mResponse(0)
-{
- XMLRPC_REQUEST request = XMLRPC_RequestNew();
- XMLRPC_RequestSetMethodName(request, method.c_str());
- XMLRPC_RequestSetRequestType(request, xmlrpc_request_call);
- XMLRPC_RequestSetData(request, params.getValue());
-
- init(request, useGzip, LLSD());
+ const std::string& method, LLXMLRPCValue params, bool useGzip)
+ : mHttpRequest(),
+ mStatus(LLXMLRPCTransaction::StatusNotStarted),
+ mURI(uri),
+ mResponse(0)
+{
+ XMLRPC_REQUEST request = XMLRPC_RequestNew();
+ XMLRPC_RequestSetMethodName(request, method.c_str());
+ XMLRPC_RequestSetRequestType(request, xmlrpc_request_call);
+ XMLRPC_RequestSetData(request, params.getValue());
+
+ init(request, useGzip, LLSD());
// DEV-28398: without this XMLRPC_RequestFree() call, it looks as though
// the 'request' object is simply leaked. It's less clear to me whether we
// should also ask to free request value data (second param 1), since the
@@ -354,266 +354,266 @@ LLXMLRPCTransaction::Impl::Impl(const std::string& uri,
void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip, const LLSD& httpParams)
{
- LLCore::HttpOptions::ptr_t httpOpts;
- LLCore::HttpHeaders::ptr_t httpHeaders;
+ LLCore::HttpOptions::ptr_t httpOpts;
+ LLCore::HttpHeaders::ptr_t httpHeaders;
- if (!mHttpRequest)
- {
- mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest);
- }
+ if (!mHttpRequest)
+ {
+ mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest);
+ }
- // LLRefCounted starts with a 1 ref, so don't add a ref in the smart pointer
- httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions());
+ // LLRefCounted starts with a 1 ref, so don't add a ref in the smart pointer
+ httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions());
- // delay between repeats will start from 5 sec and grow to 20 sec with each repeat
- httpOpts->setMinBackoff(5E6L);
- httpOpts->setMaxBackoff(20E6L);
+ // delay between repeats will start from 5 sec and grow to 20 sec with each repeat
+ httpOpts->setMinBackoff(5E6L);
+ httpOpts->setMaxBackoff(20E6L);
- httpOpts->setTimeout(httpParams.has("timeout") ? httpParams["timeout"].asInteger() : 40L);
- if (httpParams.has("retries"))
- {
- httpOpts->setRetries(httpParams["retries"].asInteger());
- }
- if (httpParams.has("DNSCacheTimeout"))
- {
- httpOpts->setDNSCacheTimeout(httpParams["DNSCacheTimeout"].asInteger());
- }
+ httpOpts->setTimeout(httpParams.has("timeout") ? httpParams["timeout"].asInteger() : 40L);
+ if (httpParams.has("retries"))
+ {
+ httpOpts->setRetries(httpParams["retries"].asInteger());
+ }
+ if (httpParams.has("DNSCacheTimeout"))
+ {
+ httpOpts->setDNSCacheTimeout(httpParams["DNSCacheTimeout"].asInteger());
+ }
- bool vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
- mCertStore = gSavedSettings.getString("CertStore");
+ bool vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
+ mCertStore = gSavedSettings.getString("CertStore");
- httpOpts->setSSLVerifyPeer( vefifySSLCert );
- httpOpts->setSSLVerifyHost( vefifySSLCert ? 2 : 0);
+ httpOpts->setSSLVerifyPeer( vefifySSLCert );
+ httpOpts->setSSLVerifyHost( vefifySSLCert ? 2 : 0);
- // LLRefCounted starts with a 1 ref, so don't add a ref in the smart pointer
- httpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
+ // LLRefCounted starts with a 1 ref, so don't add a ref in the smart pointer
+ httpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
- httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_TEXT_XML);
+ httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_TEXT_XML);
- std::string user_agent = stringize(
- LLVersionInfo::instance().getChannel(), ' ',
- LLVersionInfo::instance().getMajor(), '.',
- LLVersionInfo::instance().getMinor(), '.',
- LLVersionInfo::instance().getPatch(), " (",
- LLVersionInfo::instance().getBuild(), ')');
+ std::string user_agent = stringize(
+ LLVersionInfo::instance().getChannel(), ' ',
+ LLVersionInfo::instance().getMajor(), '.',
+ LLVersionInfo::instance().getMinor(), '.',
+ LLVersionInfo::instance().getPatch(), " (",
+ LLVersionInfo::instance().getBuild(), ')');
- httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, user_agent);
+ httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, user_agent);
- ///* Setting the DNS cache timeout to -1 disables it completely.
- //This might help with bug #503 */
- //httpOpts->setDNSCacheTimeout(-1);
+ ///* Setting the DNS cache timeout to -1 disables it completely.
+ //This might help with bug #503 */
+ //httpOpts->setDNSCacheTimeout(-1);
- LLCore::BufferArray::ptr_t body = LLCore::BufferArray::ptr_t(new LLCore::BufferArray());
+ LLCore::BufferArray::ptr_t body = LLCore::BufferArray::ptr_t(new LLCore::BufferArray());
- // TODO: See if there is a way to serialize to a preallocated buffer I'm
- // not fond of the copy here.
- int requestSize(0);
- char * requestText = XMLRPC_REQUEST_ToXML(request, &requestSize);
+ // TODO: See if there is a way to serialize to a preallocated buffer I'm
+ // not fond of the copy here.
+ int requestSize(0);
+ char * requestText = XMLRPC_REQUEST_ToXML(request, &requestSize);
- body->append(requestText, requestSize);
-
- XMLRPC_Free(requestText);
+ body->append(requestText, requestSize);
- mHandler = LLXMLRPCTransaction::Handler::ptr_t(new Handler( mHttpRequest, this ));
+ XMLRPC_Free(requestText);
- mPostH = mHttpRequest->requestPost(LLCore::HttpRequest::DEFAULT_POLICY_ID,
- mURI, body.get(), httpOpts, httpHeaders, mHandler);
+ mHandler = LLXMLRPCTransaction::Handler::ptr_t(new Handler( mHttpRequest, this ));
+
+ mPostH = mHttpRequest->requestPost(LLCore::HttpRequest::DEFAULT_POLICY_ID,
+ mURI, body.get(), httpOpts, httpHeaders, mHandler);
}
LLXMLRPCTransaction::Impl::~Impl()
{
- if (mResponse)
- {
- XMLRPC_RequestFree(mResponse, 1);
- }
+ if (mResponse)
+ {
+ XMLRPC_RequestFree(mResponse, 1);
+ }
}
bool LLXMLRPCTransaction::Impl::process()
{
- if (!mPostH || !mHttpRequest)
- {
- LL_WARNS() << "transaction failed." << LL_ENDL;
- return true; //failed, quit.
- }
+ if (!mPostH || !mHttpRequest)
+ {
+ LL_WARNS() << "transaction failed." << LL_ENDL;
+ return true; //failed, quit.
+ }
- switch (mStatus)
- {
- case LLXMLRPCTransaction::StatusComplete:
- case LLXMLRPCTransaction::StatusCURLError:
- case LLXMLRPCTransaction::StatusXMLRPCError:
- case LLXMLRPCTransaction::StatusOtherError:
- {
- return true;
- }
+ switch (mStatus)
+ {
+ case LLXMLRPCTransaction::StatusComplete:
+ case LLXMLRPCTransaction::StatusCURLError:
+ case LLXMLRPCTransaction::StatusXMLRPCError:
+ case LLXMLRPCTransaction::StatusOtherError:
+ {
+ return true;
+ }
- case LLXMLRPCTransaction::StatusNotStarted:
- {
- setStatus(LLXMLRPCTransaction::StatusStarted);
- break;
- }
+ case LLXMLRPCTransaction::StatusNotStarted:
+ {
+ setStatus(LLXMLRPCTransaction::StatusStarted);
+ break;
+ }
- default:
- break;
- }
+ default:
+ break;
+ }
- LLCore::HttpStatus status = mHttpRequest->update(0);
+ LLCore::HttpStatus status = mHttpRequest->update(0);
- status = mHttpRequest->getStatus();
- if (!status)
- {
- return false;
- }
+ status = mHttpRequest->getStatus();
+ if (!status)
+ {
+ return false;
+ }
- return false;
+ return false;
}
void LLXMLRPCTransaction::Impl::setStatus(EStatus status,
- const std::string& message, const std::string& uri)
-{
- mStatus = status;
- mStatusMessage = message;
- mStatusURI = uri;
-
- if (mStatusMessage.empty())
- {
- switch (mStatus)
- {
- case StatusNotStarted:
- mStatusMessage = "(not started)";
- break;
-
- case StatusStarted:
- mStatusMessage = "(waiting for server response)";
- break;
-
- case StatusDownloading:
- mStatusMessage = "(reading server response)";
- break;
-
- case StatusComplete:
- mStatusMessage = "(done)";
- break;
- default:
- // Usually this means that there's a problem with the login server,
- // not with the client. Direct user to status page.
- mStatusMessage = LLTrans::getString("server_is_down");
- mStatusURI = "http://status.secondlifegrid.net/";
- }
- }
+ const std::string& message, const std::string& uri)
+{
+ mStatus = status;
+ mStatusMessage = message;
+ mStatusURI = uri;
+
+ if (mStatusMessage.empty())
+ {
+ switch (mStatus)
+ {
+ case StatusNotStarted:
+ mStatusMessage = "(not started)";
+ break;
+
+ case StatusStarted:
+ mStatusMessage = "(waiting for server response)";
+ break;
+
+ case StatusDownloading:
+ mStatusMessage = "(reading server response)";
+ break;
+
+ case StatusComplete:
+ mStatusMessage = "(done)";
+ break;
+ default:
+ // Usually this means that there's a problem with the login server,
+ // not with the client. Direct user to status page.
+ mStatusMessage = LLTrans::getString("server_is_down");
+ mStatusURI = "http://status.secondlifegrid.net/";
+ }
+ }
}
void LLXMLRPCTransaction::Impl::setHttpStatus(const LLCore::HttpStatus &status)
{
- CURLcode code = static_cast<CURLcode>(status.toULong());
- std::string message;
- std::string uri = "http://support.secondlife.com";
- LLURI failuri(mURI);
- LLStringUtil::format_map_t args;
+ CURLcode code = static_cast<CURLcode>(status.toULong());
+ std::string message;
+ std::string uri = "http://support.secondlife.com";
+ LLURI failuri(mURI);
+ LLStringUtil::format_map_t args;
- switch (code)
- {
- case CURLE_COULDNT_RESOLVE_HOST:
- args["[HOSTNAME]"] = failuri.hostName();
- message = LLTrans::getString("couldnt_resolve_host", args);
- break;
+ switch (code)
+ {
+ case CURLE_COULDNT_RESOLVE_HOST:
+ args["[HOSTNAME]"] = failuri.hostName();
+ message = LLTrans::getString("couldnt_resolve_host", args);
+ break;
#if CURLE_SSL_PEER_CERTIFICATE != CURLE_SSL_CACERT
- case CURLE_SSL_PEER_CERTIFICATE:
- message = LLTrans::getString("ssl_peer_certificate");
- break;
+ case CURLE_SSL_PEER_CERTIFICATE:
+ message = LLTrans::getString("ssl_peer_certificate");
+ break;
#endif
- case CURLE_SSL_CACERT:
- case CURLE_SSL_CONNECT_ERROR:
- message = LLTrans::getString("ssl_connect_error");
- break;
+ case CURLE_SSL_CACERT:
+ case CURLE_SSL_CONNECT_ERROR:
+ message = LLTrans::getString("ssl_connect_error");
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- mCurlCode = code;
- setStatus(StatusCURLError, message, uri);
+ mCurlCode = code;
+ setStatus(StatusCURLError, message, uri);
}
LLXMLRPCTransaction::LLXMLRPCTransaction(
- const std::string& uri, XMLRPC_REQUEST request, bool useGzip, const LLSD& httpParams)
+ const std::string& uri, XMLRPC_REQUEST request, bool useGzip, const LLSD& httpParams)
: impl(* new Impl(uri, request, useGzip, httpParams))
{ }
LLXMLRPCTransaction::LLXMLRPCTransaction(
- const std::string& uri,
- const std::string& method, LLXMLRPCValue params, bool useGzip)
+ const std::string& uri,
+ const std::string& method, LLXMLRPCValue params, bool useGzip)
: impl(* new Impl(uri, method, params, useGzip))
{ }
LLXMLRPCTransaction::~LLXMLRPCTransaction()
{
- delete &impl;
+ delete &impl;
}
bool LLXMLRPCTransaction::process()
{
- return impl.process();
+ return impl.process();
}
LLXMLRPCTransaction::EStatus LLXMLRPCTransaction::status(int* curlCode)
{
- if (curlCode)
- {
- *curlCode =
- (impl.mStatus == StatusCURLError)
- ? impl.mCurlCode
- : CURLE_OK;
- }
-
- return impl.mStatus;
+ if (curlCode)
+ {
+ *curlCode =
+ (impl.mStatus == StatusCURLError)
+ ? impl.mCurlCode
+ : CURLE_OK;
+ }
+
+ return impl.mStatus;
}
std::string LLXMLRPCTransaction::statusMessage()
{
- return impl.mStatusMessage;
+ return impl.mStatusMessage;
}
LLSD LLXMLRPCTransaction::getErrorCertData()
{
- return impl.mErrorCertData;
+ return impl.mErrorCertData;
}
std::string LLXMLRPCTransaction::statusURI()
{
- return impl.mStatusURI;
+ return impl.mStatusURI;
}
XMLRPC_REQUEST LLXMLRPCTransaction::response()
{
- return impl.mResponse;
+ return impl.mResponse;
}
LLXMLRPCValue LLXMLRPCTransaction::responseValue()
{
- return LLXMLRPCValue(XMLRPC_RequestGetData(impl.mResponse));
+ return LLXMLRPCValue(XMLRPC_RequestGetData(impl.mResponse));
}
F64 LLXMLRPCTransaction::transferRate()
{
- if (impl.mStatus != StatusComplete)
- {
- return 0.0L;
- }
-
- double rate_bits_per_sec = impl.mTransferStats->mSpeedDownload * 8.0;
-
- LL_INFOS("AppInit") << "Buffer size: " << impl.mResponseText.size() << " B" << LL_ENDL;
- LL_DEBUGS("AppInit") << "Transfer size: " << impl.mTransferStats->mSizeDownload << " B" << LL_ENDL;
- LL_DEBUGS("AppInit") << "Transfer time: " << impl.mTransferStats->mTotalTime << " s" << LL_ENDL;
- LL_INFOS("AppInit") << "Transfer rate: " << rate_bits_per_sec / 1000.0 << " Kb/s" << LL_ENDL;
-
- return rate_bits_per_sec;
+ if (impl.mStatus != StatusComplete)
+ {
+ return 0.0L;
+ }
+
+ double rate_bits_per_sec = impl.mTransferStats->mSpeedDownload * 8.0;
+
+ LL_INFOS("AppInit") << "Buffer size: " << impl.mResponseText.size() << " B" << LL_ENDL;
+ LL_DEBUGS("AppInit") << "Transfer size: " << impl.mTransferStats->mSizeDownload << " B" << LL_ENDL;
+ LL_DEBUGS("AppInit") << "Transfer time: " << impl.mTransferStats->mTotalTime << " s" << LL_ENDL;
+ LL_INFOS("AppInit") << "Transfer rate: " << rate_bits_per_sec / 1000.0 << " Kb/s" << LL_ENDL;
+
+ return rate_bits_per_sec;
}
diff --git a/indra/newview/llxmlrpctransaction.h b/indra/newview/llxmlrpctransaction.h
index 8065a2aff3..4c8796f936 100644
--- a/indra/newview/llxmlrpctransaction.h
+++ b/indra/newview/llxmlrpctransaction.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llxmlrpctransaction.h
* @brief LLXMLRPCTransaction and related class header file
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,106 +31,106 @@
typedef struct _xmlrpc_request* XMLRPC_REQUEST;
typedef struct _xmlrpc_value* XMLRPC_VALUE;
- // foward decl of types from xmlrpc.h (this usage is type safe)
+ // foward decl of types from xmlrpc.h (this usage is type safe)
class LLCertificate;
class LLXMLRPCValue
- // a c++ wrapper around XMLRPC_VALUE
+ // a c++ wrapper around XMLRPC_VALUE
{
public:
- LLXMLRPCValue() : mV(NULL) { }
- LLXMLRPCValue(XMLRPC_VALUE value) : mV(value) { }
-
- bool isValid() const;
-
- std::string asString() const;
- int asInt() const;
- bool asBool() const;
- double asDouble() const;
-
- LLXMLRPCValue operator[](const char*) const;
-
- LLXMLRPCValue rewind();
- LLXMLRPCValue next();
-
- static LLXMLRPCValue createArray();
- static LLXMLRPCValue createStruct();
-
- void append(LLXMLRPCValue&);
- void appendString(const std::string&);
- void appendInt(int);
- void appendBool(bool);
- void appendDouble(double);
- void appendValue(LLXMLRPCValue&);
-
- void append(const char*, LLXMLRPCValue&);
- void appendString(const char*, const std::string&);
- void appendInt(const char*, int);
- void appendBool(const char*, bool);
- void appendDouble(const char*, double);
- void appendValue(const char*, LLXMLRPCValue&);
-
- void cleanup();
- // only call this on the top level created value
-
- XMLRPC_VALUE getValue() const;
-
+ LLXMLRPCValue() : mV(NULL) { }
+ LLXMLRPCValue(XMLRPC_VALUE value) : mV(value) { }
+
+ bool isValid() const;
+
+ std::string asString() const;
+ int asInt() const;
+ bool asBool() const;
+ double asDouble() const;
+
+ LLXMLRPCValue operator[](const char*) const;
+
+ LLXMLRPCValue rewind();
+ LLXMLRPCValue next();
+
+ static LLXMLRPCValue createArray();
+ static LLXMLRPCValue createStruct();
+
+ void append(LLXMLRPCValue&);
+ void appendString(const std::string&);
+ void appendInt(int);
+ void appendBool(bool);
+ void appendDouble(double);
+ void appendValue(LLXMLRPCValue&);
+
+ void append(const char*, LLXMLRPCValue&);
+ void appendString(const char*, const std::string&);
+ void appendInt(const char*, int);
+ void appendBool(const char*, bool);
+ void appendDouble(const char*, double);
+ void appendValue(const char*, LLXMLRPCValue&);
+
+ void cleanup();
+ // only call this on the top level created value
+
+ XMLRPC_VALUE getValue() const;
+
private:
- XMLRPC_VALUE mV;
+ XMLRPC_VALUE mV;
};
class LLXMLRPCTransaction
- // an asynchronous request and responses via XML-RPC
+ // an asynchronous request and responses via XML-RPC
{
public:
- LLXMLRPCTransaction(const std::string& uri,
- XMLRPC_REQUEST request, bool useGzip = true, const LLSD& httpParams = LLSD());
- // does not take ownership of the request object
- // request can be freed as soon as the transaction is constructed
-
- LLXMLRPCTransaction(const std::string& uri,
- const std::string& method, LLXMLRPCValue params, bool useGzip = true);
- // *does* take control of the request value, you must not free it
-
- ~LLXMLRPCTransaction();
-
- typedef enum e_status {
- StatusNotStarted,
- StatusStarted,
- StatusDownloading,
- StatusComplete,
- StatusCURLError,
- StatusXMLRPCError,
- StatusOtherError
- } EStatus;
-
- bool process();
- // run the request a little, returns true when done
-
- EStatus status(int* curlCode);
- // return status, and extended CURL code, if code isn't null
-
- LLSD getErrorCertData();
- std::string statusMessage();
- // return a message string, suitable for showing the user
- std::string statusURI();
- // return a URI for the user with more information
- // can be empty
-
- XMLRPC_REQUEST response();
- LLXMLRPCValue responseValue();
- // only valid if StatusComplete, otherwise NULL
- // retains ownership of the result object, don't free it
-
- F64 transferRate();
- // only valid if StsatusComplete, otherwise 0.0
-
+ LLXMLRPCTransaction(const std::string& uri,
+ XMLRPC_REQUEST request, bool useGzip = true, const LLSD& httpParams = LLSD());
+ // does not take ownership of the request object
+ // request can be freed as soon as the transaction is constructed
+
+ LLXMLRPCTransaction(const std::string& uri,
+ const std::string& method, LLXMLRPCValue params, bool useGzip = true);
+ // *does* take control of the request value, you must not free it
+
+ ~LLXMLRPCTransaction();
+
+ typedef enum e_status {
+ StatusNotStarted,
+ StatusStarted,
+ StatusDownloading,
+ StatusComplete,
+ StatusCURLError,
+ StatusXMLRPCError,
+ StatusOtherError
+ } EStatus;
+
+ bool process();
+ // run the request a little, returns true when done
+
+ EStatus status(int* curlCode);
+ // return status, and extended CURL code, if code isn't null
+
+ LLSD getErrorCertData();
+ std::string statusMessage();
+ // return a message string, suitable for showing the user
+ std::string statusURI();
+ // return a URI for the user with more information
+ // can be empty
+
+ XMLRPC_REQUEST response();
+ LLXMLRPCValue responseValue();
+ // only valid if StatusComplete, otherwise NULL
+ // retains ownership of the result object, don't free it
+
+ F64 transferRate();
+ // only valid if StsatusComplete, otherwise 0.0
+
private:
- class Handler;
- class Impl;
+ class Handler;
+ class Impl;
- Impl& impl;
+ Impl& impl;
};
diff --git a/indra/newview/macmain.h b/indra/newview/macmain.h
index 11c909a8c3..866dda6a2f 100644
--- a/indra/newview/macmain.h
+++ b/indra/newview/macmain.h
@@ -1,44 +1,44 @@
-/**
+/**
* @file macmain.h
* @brief Main Mac viewer defines
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/* main.h */
-#define rMenuBar 128 /* menu bar */
+#define rMenuBar 128 /* menu bar */
-#define mApple 128 /* Apple menu */
-#define iAbout 1
+#define mApple 128 /* Apple menu */
+#define iAbout 1
-#define mFile 129 /* File menu */
-#define iNew 1
-#define iClose 4
-#define iQuitSeparator 10
-#define iQuit 11
+#define mFile 129 /* File menu */
+#define iNew 1
+#define iClose 4
+#define iQuitSeparator 10
+#define iQuit 11
-#define mEdit 130 /* Edit menu */
+#define mEdit 130 /* Edit menu */
-#define kAboutBox 200 /* Dialog resource for About box */
+#define kAboutBox 200 /* Dialog resource for About box */
-#define kSleepTime 32767
+#define kSleepTime 32767
diff --git a/indra/newview/macutil_Prefix.h b/indra/newview/macutil_Prefix.h
index b8df961cac..4972ee4fa5 100644
--- a/indra/newview/macutil_Prefix.h
+++ b/indra/newview/macutil_Prefix.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file macutil_Prefix.h
* @brief Precompiled prefix file
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,8 +27,8 @@
/*
*
* Precompiled prefix file used for
- * AutoUpdater
- * crashreporter
+ * AutoUpdater
+ * crashreporter
*
*/
diff --git a/indra/newview/macview_Prefix.h b/indra/newview/macview_Prefix.h
index 5936197a85..faad8fa704 100644
--- a/indra/newview/macview_Prefix.h
+++ b/indra/newview/macview_Prefix.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file macview_Prefix.h
* @brief Prefix header for all source files of the 'newview' target in the 'newview' project.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -77,11 +77,11 @@
#include "lltalkview.h"
#include "lltool.h"
#include "lltoolfocus.h"
-#include "lltoolcomp.h" // for gToolGun
+#include "lltoolcomp.h" // for gToolGun
#include "lltoolgrab.h"
#include "lltoolmgr.h"
#include "lltoolpie.h"
-#include "llui.h" // for make_ui_sound
+#include "llui.h" // for make_ui_sound
#include "llviewercamera.h"
#include "llviewermenu.h"
#include "llviewerobjectlist.h"
@@ -206,7 +206,7 @@
/////////////////// From llloginview.cpp
#include "llloginview.h"
-#include "indra_constants.h" // for key and mask constants
+#include "indra_constants.h" // for key and mask constants
#include "llfontgl.h"
#include "v4color.h"
#include "llwindow_impl.h"
@@ -220,8 +220,8 @@
#include "llui.h"
//#include "lluiconstants.h"
#include "llviewerimagelist.h"
-#include "llviewermenu.h" // for handle_preferences()
-#include "llviewerwindow.h" // to link into child list
+#include "llviewermenu.h" // for handle_preferences()
+#include "llviewerwindow.h" // to link into child list
#include "llfocusmgr.h"
#include "llmd5.h"
#include "llversion.h"
diff --git a/indra/newview/noise.cpp b/indra/newview/noise.cpp
index 5f2c718b49..91833c242d 100644
--- a/indra/newview/noise.cpp
+++ b/indra/newview/noise.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file noise.cpp
* @brief Perlin noise routines for procedural textures, etc
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,44 +42,44 @@ S32 gNoiseStart = 1;
F32 noise2(F32 *vec)
{
- U8 bx0, bx1, by0, by1;
- U32 b00, b10, b01, b11;
- F32 rx0, rx1, ry0, ry1, *q, sx, sy, a, b, u, v;
- S32 i, j;
+ U8 bx0, bx1, by0, by1;
+ U32 b00, b10, b01, b11;
+ F32 rx0, rx1, ry0, ry1, *q, sx, sy, a, b, u, v;
+ S32 i, j;
- if (gNoiseStart) {
- gNoiseStart = 0;
- init();
- }
+ if (gNoiseStart) {
+ gNoiseStart = 0;
+ init();
+ }
- fast_setup(*vec, bx0, bx1, rx0, rx1);
- fast_setup(*(vec + 1), by0, by1, ry0, ry1);
+ fast_setup(*vec, bx0, bx1, rx0, rx1);
+ fast_setup(*(vec + 1), by0, by1, ry0, ry1);
- i = *(p + bx0);
- j = *(p + bx1);
+ i = *(p + bx0);
+ j = *(p + bx1);
- b00 = *(p + i + by0);
- b10 = *(p + j + by0);
- b01 = *(p + i + by1);
- b11 = *(p + j + by1);
+ b00 = *(p + i + by0);
+ b10 = *(p + j + by0);
+ b01 = *(p + i + by1);
+ b11 = *(p + j + by1);
- sx = s_curve(rx0);
- sy = s_curve(ry0);
+ sx = s_curve(rx0);
+ sy = s_curve(ry0);
- q = *(g2 + b00);
- u = fast_at2(rx0, ry0, q);
- q = *(g2 + b10);
- v = fast_at2(rx1, ry0, q);
- a = lerp_m(sx, u, v);
+ q = *(g2 + b00);
+ u = fast_at2(rx0, ry0, q);
+ q = *(g2 + b10);
+ v = fast_at2(rx1, ry0, q);
+ a = lerp_m(sx, u, v);
- q = *(g2 + b01);
- u = fast_at2(rx0,ry1,q);
- q = *(g2 + b11);
- v = fast_at2(rx1,ry1,q);
- b = lerp_m(sx, u, v);
+ q = *(g2 + b01);
+ u = fast_at2(rx0,ry1,q);
+ q = *(g2 + b11);
+ v = fast_at2(rx1,ry1,q);
+ b = lerp_m(sx, u, v);
- return lerp_m(sy, a, b);
+ return lerp_m(sy, a, b);
}
diff --git a/indra/newview/noise.h b/indra/newview/noise.h
index b3efad73c5..ae819cf542 100644
--- a/indra/newview/noise.h
+++ b/indra/newview/noise.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file noise.h
* @brief Perlin noise routines for procedural textures, etc
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,65 +37,65 @@ F32 noise3(float *vec);
inline F32 bias(F32 a, F32 b)
{
- return (F32)pow(a, (F32)(log(b) / log(0.5f)));
+ return (F32)pow(a, (F32)(log(b) / log(0.5f)));
}
inline F32 gain(F32 a, F32 b)
{
- F32 p = (F32) (log(1.f - b) / log(0.5f));
-
- if (a < .001f)
- return 0.f;
- else if (a > .999f)
- return 1.f;
- if (a < 0.5f)
- return (F32)(pow(2 * a, p) / 2.f);
- else
- return (F32)(1.f - pow(2 * (1.f - a), p) / 2.f);
+ F32 p = (F32) (log(1.f - b) / log(0.5f));
+
+ if (a < .001f)
+ return 0.f;
+ else if (a > .999f)
+ return 1.f;
+ if (a < 0.5f)
+ return (F32)(pow(2 * a, p) / 2.f);
+ else
+ return (F32)(1.f - pow(2 * (1.f - a), p) / 2.f);
}
inline F32 turbulence2(F32 *v, F32 freq)
{
- F32 t, vec[2];
-
- for (t = 0.f ; freq >= 1.f ; freq *= 0.5f) {
- vec[0] = freq * v[0];
- vec[1] = freq * v[1];
- t += noise2(vec)/freq;
- }
- return t;
+ F32 t, vec[2];
+
+ for (t = 0.f ; freq >= 1.f ; freq *= 0.5f) {
+ vec[0] = freq * v[0];
+ vec[1] = freq * v[1];
+ t += noise2(vec)/freq;
+ }
+ return t;
}
inline F32 turbulence3(F32 *v, F32 freq)
{
- F32 t, vec[3];
-
- for (t = 0.f ; freq >= 1.f ; freq *= 0.5f) {
- vec[0] = freq * v[0];
- vec[1] = freq * v[1];
- vec[2] = freq * v[2];
- t += noise3(vec)/freq;
-// t += fabs(noise3(vec)) / freq; // Like snow - bubbly at low frequencies
-// t += sqrt(fabs(noise3(vec))) / freq; // Better at low freq
-// t += (noise3(vec)*noise3(vec)) / freq;
- }
- return t;
+ F32 t, vec[3];
+
+ for (t = 0.f ; freq >= 1.f ; freq *= 0.5f) {
+ vec[0] = freq * v[0];
+ vec[1] = freq * v[1];
+ vec[2] = freq * v[2];
+ t += noise3(vec)/freq;
+// t += fabs(noise3(vec)) / freq; // Like snow - bubbly at low frequencies
+// t += sqrt(fabs(noise3(vec))) / freq; // Better at low freq
+// t += (noise3(vec)*noise3(vec)) / freq;
+ }
+ return t;
}
inline F32 clouds3(F32 *v, F32 freq)
{
- F32 t, vec[3];
-
- for (t = 0.f ; freq >= 1.f ; freq *= 0.5f) {
- vec[0] = freq * v[0];
- vec[1] = freq * v[1];
- vec[2] = freq * v[2];
- //t += noise3(vec)/freq;
-// t += fabs(noise3(vec)) / freq; // Like snow - bubbly at low frequencies
-// t += sqrt(fabs(noise3(vec))) / freq; // Better at low freq
- t += (noise3(vec)*noise3(vec)) / freq;
- }
- return t;
+ F32 t, vec[3];
+
+ for (t = 0.f ; freq >= 1.f ; freq *= 0.5f) {
+ vec[0] = freq * v[0];
+ vec[1] = freq * v[1];
+ vec[2] = freq * v[2];
+ //t += noise3(vec)/freq;
+// t += fabs(noise3(vec)) / freq; // Like snow - bubbly at low frequencies
+// t += sqrt(fabs(noise3(vec))) / freq; // Better at low freq
+ t += (noise3(vec)*noise3(vec)) / freq;
+ }
+ return t;
}
/* noise functions over 1, 2, and 3 dimensions */
@@ -121,230 +121,230 @@ static void init(void);
#define lerp_m(t, a, b) ( a + t * (b - a) )
#define setup_noise(i,b0,b1,r0,r1)\
- t = vec[i] + N;\
- b0 = (lltrunc(t)) & BM;\
- b1 = (b0+1) & BM;\
- r0 = t - lltrunc(t);\
- r1 = r0 - 1.f;
+ t = vec[i] + N;\
+ b0 = (lltrunc(t)) & BM;\
+ b1 = (b0+1) & BM;\
+ r0 = t - lltrunc(t);\
+ r1 = r0 - 1.f;
inline void fast_setup(F32 vec, U8 &b0, U8 &b1, F32 &r0, F32 &r1)
{
- S32 t_S32;
-
- r1 = vec + NF32;
- t_S32 = lltrunc(r1);
- b0 = (U8)t_S32;
- b1 = b0 + 1;
- r0 = r1 - t_S32;
- r1 = r0 - 1.f;
+ S32 t_S32;
+
+ r1 = vec + NF32;
+ t_S32 = lltrunc(r1);
+ b0 = (U8)t_S32;
+ b1 = b0 + 1;
+ r0 = r1 - t_S32;
+ r1 = r0 - 1.f;
}
inline F32 noise1(const F32 arg)
{
- int bx0, bx1;
- F32 rx0, rx1, sx, t, u, v, vec[1];
+ int bx0, bx1;
+ F32 rx0, rx1, sx, t, u, v, vec[1];
- vec[0] = arg;
- if (gNoiseStart) {
- gNoiseStart = 0;
- init();
- }
+ vec[0] = arg;
+ if (gNoiseStart) {
+ gNoiseStart = 0;
+ init();
+ }
- setup_noise(0, bx0,bx1, rx0,rx1);
+ setup_noise(0, bx0,bx1, rx0,rx1);
- sx = s_curve(rx0);
+ sx = s_curve(rx0);
- u = rx0 * g1[ p[ bx0 ] ];
- v = rx1 * g1[ p[ bx1 ] ];
+ u = rx0 * g1[ p[ bx0 ] ];
+ v = rx1 * g1[ p[ bx1 ] ];
- return lerp_m(sx, u, v);
+ return lerp_m(sx, u, v);
}
inline F32 fast_at2(F32 rx, F32 ry, F32 *q)
{
- return rx * (*q) + ry * (*(q + 1));
+ return rx * (*q) + ry * (*(q + 1));
}
inline F32 fast_at3(F32 rx, F32 ry, F32 rz, F32 *q)
{
- return rx * (*q) + ry * (*(q + 1)) + rz * (*(q + 2));
+ return rx * (*q) + ry * (*(q + 1)) + rz * (*(q + 2));
}
inline F32 noise3(F32 *vec)
{
- U8 bx0, bx1, by0, by1, bz0, bz1;
- S32 b00, b10, b01, b11;
- F32 rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
- S32 i, j;
-
- if (gNoiseStart) {
- gNoiseStart = 0;
- init();
- }
-
- fast_setup(*vec, bx0,bx1, rx0,rx1);
- fast_setup(*(vec + 1), by0,by1, ry0,ry1);
- fast_setup(*(vec + 2), bz0,bz1, rz0,rz1);
-
- i = p[ bx0 ];
- j = p[ bx1 ];
-
- b00 = p[ i + by0 ];
- b10 = p[ j + by0 ];
- b01 = p[ i + by1 ];
- b11 = p[ j + by1 ];
-
- t = s_curve(rx0);
- sy = s_curve(ry0);
- sz = s_curve(rz0);
-
- q = g3[ b00 + bz0 ];
- u = fast_at3(rx0,ry0,rz0,q);
- q = g3[ b10 + bz0 ];
- v = fast_at3(rx1,ry0,rz0,q);
- a = lerp_m(t, u, v);
-
- q = g3[ b01 + bz0 ];
- u = fast_at3(rx0,ry1,rz0,q);
- q = g3[ b11 + bz0 ];
- v = fast_at3(rx1,ry1,rz0,q);
- b = lerp_m(t, u, v);
-
- c = lerp_m(sy, a, b);
-
- q = g3[ b00 + bz1 ];
- u = fast_at3(rx0,ry0,rz1,q);
- q = g3[ b10 + bz1 ];
- v = fast_at3(rx1,ry0,rz1,q);
- a = lerp_m(t, u, v);
-
- q = g3[ b01 + bz1 ];
- u = fast_at3(rx0,ry1,rz1,q);
- q = g3[ b11 + bz1 ];
- v = fast_at3(rx1,ry1,rz1,q);
- b = lerp_m(t, u, v);
-
- d = lerp_m(sy, a, b);
-
- return lerp_m(sz, c, d);
+ U8 bx0, bx1, by0, by1, bz0, bz1;
+ S32 b00, b10, b01, b11;
+ F32 rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
+ S32 i, j;
+
+ if (gNoiseStart) {
+ gNoiseStart = 0;
+ init();
+ }
+
+ fast_setup(*vec, bx0,bx1, rx0,rx1);
+ fast_setup(*(vec + 1), by0,by1, ry0,ry1);
+ fast_setup(*(vec + 2), bz0,bz1, rz0,rz1);
+
+ i = p[ bx0 ];
+ j = p[ bx1 ];
+
+ b00 = p[ i + by0 ];
+ b10 = p[ j + by0 ];
+ b01 = p[ i + by1 ];
+ b11 = p[ j + by1 ];
+
+ t = s_curve(rx0);
+ sy = s_curve(ry0);
+ sz = s_curve(rz0);
+
+ q = g3[ b00 + bz0 ];
+ u = fast_at3(rx0,ry0,rz0,q);
+ q = g3[ b10 + bz0 ];
+ v = fast_at3(rx1,ry0,rz0,q);
+ a = lerp_m(t, u, v);
+
+ q = g3[ b01 + bz0 ];
+ u = fast_at3(rx0,ry1,rz0,q);
+ q = g3[ b11 + bz0 ];
+ v = fast_at3(rx1,ry1,rz0,q);
+ b = lerp_m(t, u, v);
+
+ c = lerp_m(sy, a, b);
+
+ q = g3[ b00 + bz1 ];
+ u = fast_at3(rx0,ry0,rz1,q);
+ q = g3[ b10 + bz1 ];
+ v = fast_at3(rx1,ry0,rz1,q);
+ a = lerp_m(t, u, v);
+
+ q = g3[ b01 + bz1 ];
+ u = fast_at3(rx0,ry1,rz1,q);
+ q = g3[ b11 + bz1 ];
+ v = fast_at3(rx1,ry1,rz1,q);
+ b = lerp_m(t, u, v);
+
+ d = lerp_m(sy, a, b);
+
+ return lerp_m(sz, c, d);
}
/*
F32 noise3(F32 *vec)
{
- int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
- F32 rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
- S32 i, j;
+ int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
+ F32 rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
+ S32 i, j;
- if (gNoiseStart) {
- gNoiseStart = 0;
- init();
- }
+ if (gNoiseStart) {
+ gNoiseStart = 0;
+ init();
+ }
- setup_noise(0, bx0,bx1, rx0,rx1);
- setup_noise(1, by0,by1, ry0,ry1);
- setup_noise(2, bz0,bz1, rz0,rz1);
+ setup_noise(0, bx0,bx1, rx0,rx1);
+ setup_noise(1, by0,by1, ry0,ry1);
+ setup_noise(2, bz0,bz1, rz0,rz1);
- i = p[ bx0 ];
- j = p[ bx1 ];
+ i = p[ bx0 ];
+ j = p[ bx1 ];
- b00 = p[ i + by0 ];
- b10 = p[ j + by0 ];
- b01 = p[ i + by1 ];
- b11 = p[ j + by1 ];
+ b00 = p[ i + by0 ];
+ b10 = p[ j + by0 ];
+ b01 = p[ i + by1 ];
+ b11 = p[ j + by1 ];
- t = s_curve(rx0);
- sy = s_curve(ry0);
- sz = s_curve(rz0);
+ t = s_curve(rx0);
+ sy = s_curve(ry0);
+ sz = s_curve(rz0);
#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
- q = g3[ b00 + bz0 ] ; u = at3(rx0,ry0,rz0);
- q = g3[ b10 + bz0 ] ; v = at3(rx1,ry0,rz0);
- a = lerp_m(t, u, v);
+ q = g3[ b00 + bz0 ] ; u = at3(rx0,ry0,rz0);
+ q = g3[ b10 + bz0 ] ; v = at3(rx1,ry0,rz0);
+ a = lerp_m(t, u, v);
- q = g3[ b01 + bz0 ] ; u = at3(rx0,ry1,rz0);
- q = g3[ b11 + bz0 ] ; v = at3(rx1,ry1,rz0);
- b = lerp_m(t, u, v);
+ q = g3[ b01 + bz0 ] ; u = at3(rx0,ry1,rz0);
+ q = g3[ b11 + bz0 ] ; v = at3(rx1,ry1,rz0);
+ b = lerp_m(t, u, v);
- c = lerp_m(sy, a, b);
+ c = lerp_m(sy, a, b);
- q = g3[ b00 + bz1 ] ; u = at3(rx0,ry0,rz1);
- q = g3[ b10 + bz1 ] ; v = at3(rx1,ry0,rz1);
- a = lerp_m(t, u, v);
+ q = g3[ b00 + bz1 ] ; u = at3(rx0,ry0,rz1);
+ q = g3[ b10 + bz1 ] ; v = at3(rx1,ry0,rz1);
+ a = lerp_m(t, u, v);
- q = g3[ b01 + bz1 ] ; u = at3(rx0,ry1,rz1);
- q = g3[ b11 + bz1 ] ; v = at3(rx1,ry1,rz1);
- b = lerp_m(t, u, v);
+ q = g3[ b01 + bz1 ] ; u = at3(rx0,ry1,rz1);
+ q = g3[ b11 + bz1 ] ; v = at3(rx1,ry1,rz1);
+ b = lerp_m(t, u, v);
- d = lerp_m(sy, a, b);
+ d = lerp_m(sy, a, b);
- return lerp_m(sz, c, d);
+ return lerp_m(sz, c, d);
}
*/
static void normalize2(F32 v[2])
{
- F32 s;
+ F32 s;
- s = 1.f/(F32)sqrt(v[0] * v[0] + v[1] * v[1]);
- v[0] = v[0] * s;
- v[1] = v[1] * s;
+ s = 1.f/(F32)sqrt(v[0] * v[0] + v[1] * v[1]);
+ v[0] = v[0] * s;
+ v[1] = v[1] * s;
}
static void normalize3(F32 v[3])
{
- F32 s;
+ F32 s;
- s = 1.f/(F32)sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
- v[0] = v[0] * s;
- v[1] = v[1] * s;
- v[2] = v[2] * s;
+ s = 1.f/(F32)sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+ v[0] = v[0] * s;
+ v[1] = v[1] * s;
+ v[2] = v[2] * s;
}
static void init(void)
{
- // we want repeatable noise (e.g. for stable terrain texturing), so seed with known value
- srand(42);
- int i, j, k;
-
- for (i = 0 ; i < B ; i++) {
- p[i] = i;
-
- g1[i] = (F32)((rand() % (B + B)) - B) / B;
-
- for (j = 0 ; j < 2 ; j++)
- g2[i][j] = (F32)((rand() % (B + B)) - B) / B;
- normalize2(g2[i]);
-
- for (j = 0 ; j < 3 ; j++)
- g3[i][j] = (F32)((rand() % (B + B)) - B) / B;
- normalize3(g3[i]);
- }
-
- while (--i) {
- k = p[i];
- p[i] = p[j = rand() % B];
- p[j] = k;
- }
-
- for (i = 0 ; i < B + 2 ; i++) {
- p[B + i] = p[i];
- g1[B + i] = g1[i];
- for (j = 0 ; j < 2 ; j++)
- g2[B + i][j] = g2[i][j];
- for (j = 0 ; j < 3 ; j++)
- g3[B + i][j] = g3[i][j];
- }
-
- // reintroduce entropy
- srand(time(NULL)); // Flawfinder: ignore
+ // we want repeatable noise (e.g. for stable terrain texturing), so seed with known value
+ srand(42);
+ int i, j, k;
+
+ for (i = 0 ; i < B ; i++) {
+ p[i] = i;
+
+ g1[i] = (F32)((rand() % (B + B)) - B) / B;
+
+ for (j = 0 ; j < 2 ; j++)
+ g2[i][j] = (F32)((rand() % (B + B)) - B) / B;
+ normalize2(g2[i]);
+
+ for (j = 0 ; j < 3 ; j++)
+ g3[i][j] = (F32)((rand() % (B + B)) - B) / B;
+ normalize3(g3[i]);
+ }
+
+ while (--i) {
+ k = p[i];
+ p[i] = p[j = rand() % B];
+ p[j] = k;
+ }
+
+ for (i = 0 ; i < B + 2 ; i++) {
+ p[B + i] = p[i];
+ g1[B + i] = g1[i];
+ for (j = 0 ; j < 2 ; j++)
+ g2[B + i][j] = g2[i][j];
+ for (j = 0 ; j < 3 ; j++)
+ g3[B + i][j] = g3[i][j];
+ }
+
+ // reintroduce entropy
+ srand(time(NULL)); // Flawfinder: ignore
}
#undef B
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index f5f2ba52bf..c5ba03775b 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file pipeline.cpp
* @brief Rendering pipeline.
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,11 +40,11 @@
#include "llvolume.h"
#include "material_codes.h"
#include "v3color.h"
-#include "llui.h"
+#include "llui.h"
#include "llglheaders.h"
#include "llrender.h"
#include "llstartup.h"
-#include "llwindow.h" // swapBuffers()
+#include "llwindow.h" // swapBuffers()
// newview includes
#include "llagent.h"
@@ -213,9 +213,9 @@ extern BOOL gDebugGL;
extern BOOL gCubeSnapshot;
extern BOOL gSnapshotNoPost;
-bool gAvatarBacklight = false;
+bool gAvatarBacklight = false;
-bool gDebugPipeline = false;
+bool gDebugPipeline = false;
LLPipeline gPipeline;
const LLMatrix4* gGLLastMatrix = NULL;
@@ -274,42 +274,42 @@ LLVertexBuffer* ll_create_cube_vb(U32 type_mask);
void display_update_camera();
//----------------------------------------
-S32 LLPipeline::sCompiles = 0;
-
-bool LLPipeline::sPickAvatar = true;
-bool LLPipeline::sDynamicLOD = true;
-bool LLPipeline::sShowHUDAttachments = true;
-bool LLPipeline::sRenderMOAPBeacons = false;
-bool LLPipeline::sRenderPhysicalBeacons = true;
-bool LLPipeline::sRenderScriptedBeacons = false;
-bool LLPipeline::sRenderScriptedTouchBeacons = true;
-bool LLPipeline::sRenderParticleBeacons = false;
-bool LLPipeline::sRenderSoundBeacons = false;
-bool LLPipeline::sRenderBeacons = false;
-bool LLPipeline::sRenderHighlight = true;
+S32 LLPipeline::sCompiles = 0;
+
+bool LLPipeline::sPickAvatar = true;
+bool LLPipeline::sDynamicLOD = true;
+bool LLPipeline::sShowHUDAttachments = true;
+bool LLPipeline::sRenderMOAPBeacons = false;
+bool LLPipeline::sRenderPhysicalBeacons = true;
+bool LLPipeline::sRenderScriptedBeacons = false;
+bool LLPipeline::sRenderScriptedTouchBeacons = true;
+bool LLPipeline::sRenderParticleBeacons = false;
+bool LLPipeline::sRenderSoundBeacons = false;
+bool LLPipeline::sRenderBeacons = false;
+bool LLPipeline::sRenderHighlight = true;
LLRender::eTexIndex LLPipeline::sRenderHighlightTextureChannel = LLRender::DIFFUSE_MAP;
-bool LLPipeline::sForceOldBakedUpload = false;
-S32 LLPipeline::sUseOcclusion = 0;
-bool LLPipeline::sAutoMaskAlphaDeferred = true;
-bool LLPipeline::sAutoMaskAlphaNonDeferred = false;
-bool LLPipeline::sRenderTransparentWater = true;
-bool LLPipeline::sBakeSunlight = false;
-bool LLPipeline::sNoAlpha = false;
-bool LLPipeline::sUseFarClip = true;
-bool LLPipeline::sShadowRender = false;
-bool LLPipeline::sRenderGlow = false;
-bool LLPipeline::sReflectionRender = false;
+bool LLPipeline::sForceOldBakedUpload = false;
+S32 LLPipeline::sUseOcclusion = 0;
+bool LLPipeline::sAutoMaskAlphaDeferred = true;
+bool LLPipeline::sAutoMaskAlphaNonDeferred = false;
+bool LLPipeline::sRenderTransparentWater = true;
+bool LLPipeline::sBakeSunlight = false;
+bool LLPipeline::sNoAlpha = false;
+bool LLPipeline::sUseFarClip = true;
+bool LLPipeline::sShadowRender = false;
+bool LLPipeline::sRenderGlow = false;
+bool LLPipeline::sReflectionRender = false;
bool LLPipeline::sDistortionRender = false;
-bool LLPipeline::sImpostorRender = false;
-bool LLPipeline::sImpostorRenderAlphaDepthPass = false;
-bool LLPipeline::sUnderWaterRender = false;
-bool LLPipeline::sTextureBindTest = false;
-bool LLPipeline::sRenderAttachedLights = true;
-bool LLPipeline::sRenderAttachedParticles = true;
-bool LLPipeline::sRenderDeferred = false;
-bool LLPipeline::sReflectionProbesEnabled = false;
-S32 LLPipeline::sVisibleLightCount = 0;
-bool LLPipeline::sRenderingHUDs;
+bool LLPipeline::sImpostorRender = false;
+bool LLPipeline::sImpostorRenderAlphaDepthPass = false;
+bool LLPipeline::sUnderWaterRender = false;
+bool LLPipeline::sTextureBindTest = false;
+bool LLPipeline::sRenderAttachedLights = true;
+bool LLPipeline::sRenderAttachedParticles = true;
+bool LLPipeline::sRenderDeferred = false;
+bool LLPipeline::sReflectionProbesEnabled = false;
+S32 LLPipeline::sVisibleLightCount = 0;
+bool LLPipeline::sRenderingHUDs;
F32 LLPipeline::sDistortionWaterClipPlaneMargin = 1.0125f;
// EventHost API LLPipeline listener.
@@ -331,29 +331,29 @@ bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false)
}
LLPipeline::LLPipeline() :
- mBackfaceCull(false),
- mMatrixOpCount(0),
- mTextureMatrixOps(0),
- mNumVisibleNodes(0),
- mNumVisibleFaces(0),
- mPoissonOffset(0),
-
- mInitialized(false),
- mShadersLoaded(false),
- mTransformFeedbackPrimitives(0),
- mRenderDebugFeatureMask(0),
- mRenderDebugMask(0),
- mOldRenderDebugMask(0),
- mMeshDirtyQueryObject(0),
- mGroupQ1Locked(false),
- mResetVertexBuffers(false),
- mLastRebuildPool(NULL),
- mLightMask(0),
- mLightMovingMask(0)
-{
- mNoiseMap = 0;
- mTrueNoiseMap = 0;
- mLightFunc = 0;
+ mBackfaceCull(false),
+ mMatrixOpCount(0),
+ mTextureMatrixOps(0),
+ mNumVisibleNodes(0),
+ mNumVisibleFaces(0),
+ mPoissonOffset(0),
+
+ mInitialized(false),
+ mShadersLoaded(false),
+ mTransformFeedbackPrimitives(0),
+ mRenderDebugFeatureMask(0),
+ mRenderDebugMask(0),
+ mOldRenderDebugMask(0),
+ mMeshDirtyQueryObject(0),
+ mGroupQ1Locked(false),
+ mResetVertexBuffers(false),
+ mLastRebuildPool(NULL),
+ mLightMask(0),
+ mLightMovingMask(0)
+{
+ mNoiseMap = 0;
+ mTrueNoiseMap = 0;
+ mLightFunc = 0;
for(U32 i = 0; i < 8; i++)
{
@@ -363,99 +363,99 @@ LLPipeline::LLPipeline() :
void LLPipeline::connectRefreshCachedSettingsSafe(const std::string name)
{
- LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl(name);
- if ( cntrl_ptr.isNull() )
- {
- LL_WARNS() << "Global setting name not found:" << name << LL_ENDL;
- }
- else
- {
- cntrl_ptr->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
- }
+ LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl(name);
+ if ( cntrl_ptr.isNull() )
+ {
+ LL_WARNS() << "Global setting name not found:" << name << LL_ENDL;
+ }
+ else
+ {
+ cntrl_ptr->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+ }
}
void LLPipeline::init()
{
- refreshCachedSettings();
+ refreshCachedSettings();
mRT = &mMainRT;
- gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");
- gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize");
- sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD");
- sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
- sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles");
+ gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");
+ gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize");
+ sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD");
+ sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
+ sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles");
mInitialized = true;
-
- stop_glerror();
- //create render pass pools
- getPool(LLDrawPool::POOL_ALPHA_PRE_WATER);
+ stop_glerror();
+
+ //create render pass pools
+ getPool(LLDrawPool::POOL_ALPHA_PRE_WATER);
getPool(LLDrawPool::POOL_ALPHA_POST_WATER);
- getPool(LLDrawPool::POOL_SIMPLE);
- getPool(LLDrawPool::POOL_ALPHA_MASK);
- getPool(LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK);
- getPool(LLDrawPool::POOL_GRASS);
- getPool(LLDrawPool::POOL_FULLBRIGHT);
- getPool(LLDrawPool::POOL_BUMP);
- getPool(LLDrawPool::POOL_MATERIALS);
- getPool(LLDrawPool::POOL_GLOW);
- getPool(LLDrawPool::POOL_GLTF_PBR);
+ getPool(LLDrawPool::POOL_SIMPLE);
+ getPool(LLDrawPool::POOL_ALPHA_MASK);
+ getPool(LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK);
+ getPool(LLDrawPool::POOL_GRASS);
+ getPool(LLDrawPool::POOL_FULLBRIGHT);
+ getPool(LLDrawPool::POOL_BUMP);
+ getPool(LLDrawPool::POOL_MATERIALS);
+ getPool(LLDrawPool::POOL_GLOW);
+ getPool(LLDrawPool::POOL_GLTF_PBR);
getPool(LLDrawPool::POOL_GLTF_PBR_ALPHA_MASK);
- resetFrameStats();
-
- if (gSavedSettings.getBOOL("DisableAllRenderFeatures"))
- {
- clearAllRenderDebugFeatures();
- }
- else
- {
- setAllRenderDebugFeatures(); // By default, all debugging features on
- }
- clearAllRenderDebugDisplays(); // All debug displays off
-
- if (gSavedSettings.getBOOL("DisableAllRenderTypes"))
- {
- clearAllRenderTypes();
- }
- else if (gNonInteractive)
- {
- clearAllRenderTypes();
- }
- else
- {
- setAllRenderTypes(); // By default, all rendering types start enabled
- }
-
- // make sure RenderPerformanceTest persists (hackity hack hack)
- // disables non-object rendering (UI, sky, water, etc)
- if (gSavedSettings.getBOOL("RenderPerformanceTest"))
- {
- gSavedSettings.setBOOL("RenderPerformanceTest", FALSE);
- gSavedSettings.setBOOL("RenderPerformanceTest", TRUE);
- }
-
- mOldRenderDebugMask = mRenderDebugMask;
-
- mBackfaceCull = true;
-
- // Enable features
- LLViewerShaderMgr::instance()->setShaders();
-
- for (U32 i = 0; i < 2; ++i)
- {
- mSpotLightFade[i] = 1.f;
- }
-
- if (mCubeVB.isNull())
- {
- mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX);
- }
-
- mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK);
- mDeferredVB->allocateBuffer(8, 0);
+ resetFrameStats();
+
+ if (gSavedSettings.getBOOL("DisableAllRenderFeatures"))
+ {
+ clearAllRenderDebugFeatures();
+ }
+ else
+ {
+ setAllRenderDebugFeatures(); // By default, all debugging features on
+ }
+ clearAllRenderDebugDisplays(); // All debug displays off
+
+ if (gSavedSettings.getBOOL("DisableAllRenderTypes"))
+ {
+ clearAllRenderTypes();
+ }
+ else if (gNonInteractive)
+ {
+ clearAllRenderTypes();
+ }
+ else
+ {
+ setAllRenderTypes(); // By default, all rendering types start enabled
+ }
+
+ // make sure RenderPerformanceTest persists (hackity hack hack)
+ // disables non-object rendering (UI, sky, water, etc)
+ if (gSavedSettings.getBOOL("RenderPerformanceTest"))
+ {
+ gSavedSettings.setBOOL("RenderPerformanceTest", FALSE);
+ gSavedSettings.setBOOL("RenderPerformanceTest", TRUE);
+ }
+
+ mOldRenderDebugMask = mRenderDebugMask;
+
+ mBackfaceCull = true;
+
+ // Enable features
+ LLViewerShaderMgr::instance()->setShaders();
+
+ for (U32 i = 0; i < 2; ++i)
+ {
+ mSpotLightFade[i] = 1.f;
+ }
+
+ if (mCubeVB.isNull())
+ {
+ mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX);
+ }
+
+ mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK);
+ mDeferredVB->allocateBuffer(8, 0);
{
mScreenTriangleVB = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX);
@@ -470,83 +470,83 @@ void LLPipeline::init()
mScreenTriangleVB->unmapBuffer();
}
- //
- // Update all settings to trigger a cached settings refresh
- //
- connectRefreshCachedSettingsSafe("RenderAutoMaskAlphaDeferred");
- connectRefreshCachedSettingsSafe("RenderAutoMaskAlphaNonDeferred");
- connectRefreshCachedSettingsSafe("RenderUseFarClip");
- connectRefreshCachedSettingsSafe("RenderAvatarMaxNonImpostors");
- connectRefreshCachedSettingsSafe("UseOcclusion");
- // DEPRECATED -- connectRefreshCachedSettingsSafe("WindLightUseAtmosShaders");
- // DEPRECATED -- connectRefreshCachedSettingsSafe("RenderDeferred");
- connectRefreshCachedSettingsSafe("RenderDeferredSunWash");
- connectRefreshCachedSettingsSafe("RenderFSAASamples");
- connectRefreshCachedSettingsSafe("RenderResolutionDivisor");
- connectRefreshCachedSettingsSafe("RenderUIBuffer");
- connectRefreshCachedSettingsSafe("RenderShadowDetail");
+ //
+ // Update all settings to trigger a cached settings refresh
+ //
+ connectRefreshCachedSettingsSafe("RenderAutoMaskAlphaDeferred");
+ connectRefreshCachedSettingsSafe("RenderAutoMaskAlphaNonDeferred");
+ connectRefreshCachedSettingsSafe("RenderUseFarClip");
+ connectRefreshCachedSettingsSafe("RenderAvatarMaxNonImpostors");
+ connectRefreshCachedSettingsSafe("UseOcclusion");
+ // DEPRECATED -- connectRefreshCachedSettingsSafe("WindLightUseAtmosShaders");
+ // DEPRECATED -- connectRefreshCachedSettingsSafe("RenderDeferred");
+ connectRefreshCachedSettingsSafe("RenderDeferredSunWash");
+ connectRefreshCachedSettingsSafe("RenderFSAASamples");
+ connectRefreshCachedSettingsSafe("RenderResolutionDivisor");
+ connectRefreshCachedSettingsSafe("RenderUIBuffer");
+ connectRefreshCachedSettingsSafe("RenderShadowDetail");
connectRefreshCachedSettingsSafe("RenderShadowSplits");
- connectRefreshCachedSettingsSafe("RenderDeferredSSAO");
- connectRefreshCachedSettingsSafe("RenderShadowResolutionScale");
- connectRefreshCachedSettingsSafe("RenderDelayCreation");
- connectRefreshCachedSettingsSafe("RenderAnimateRes");
- connectRefreshCachedSettingsSafe("FreezeTime");
- connectRefreshCachedSettingsSafe("DebugBeaconLineWidth");
- connectRefreshCachedSettingsSafe("RenderHighlightBrightness");
- connectRefreshCachedSettingsSafe("RenderHighlightColor");
- connectRefreshCachedSettingsSafe("RenderHighlightThickness");
- connectRefreshCachedSettingsSafe("RenderSpotLightsInNondeferred");
- connectRefreshCachedSettingsSafe("PreviewAmbientColor");
- connectRefreshCachedSettingsSafe("PreviewDiffuse0");
- connectRefreshCachedSettingsSafe("PreviewSpecular0");
- connectRefreshCachedSettingsSafe("PreviewDiffuse1");
- connectRefreshCachedSettingsSafe("PreviewSpecular1");
- connectRefreshCachedSettingsSafe("PreviewDiffuse2");
- connectRefreshCachedSettingsSafe("PreviewSpecular2");
- connectRefreshCachedSettingsSafe("PreviewDirection0");
- connectRefreshCachedSettingsSafe("PreviewDirection1");
- connectRefreshCachedSettingsSafe("PreviewDirection2");
- connectRefreshCachedSettingsSafe("RenderGlowMaxExtractAlpha");
- connectRefreshCachedSettingsSafe("RenderGlowWarmthAmount");
- connectRefreshCachedSettingsSafe("RenderGlowLumWeights");
- connectRefreshCachedSettingsSafe("RenderGlowWarmthWeights");
- connectRefreshCachedSettingsSafe("RenderGlowResolutionPow");
- connectRefreshCachedSettingsSafe("RenderGlowIterations");
- connectRefreshCachedSettingsSafe("RenderGlowWidth");
- connectRefreshCachedSettingsSafe("RenderGlowStrength");
- connectRefreshCachedSettingsSafe("RenderGlowNoise");
- connectRefreshCachedSettingsSafe("RenderDepthOfField");
- connectRefreshCachedSettingsSafe("RenderDepthOfFieldInEditMode");
- connectRefreshCachedSettingsSafe("CameraFocusTransitionTime");
- connectRefreshCachedSettingsSafe("CameraFNumber");
- connectRefreshCachedSettingsSafe("CameraFocalLength");
- connectRefreshCachedSettingsSafe("CameraFieldOfView");
- connectRefreshCachedSettingsSafe("RenderShadowNoise");
- connectRefreshCachedSettingsSafe("RenderShadowBlurSize");
- connectRefreshCachedSettingsSafe("RenderSSAOScale");
- connectRefreshCachedSettingsSafe("RenderSSAOMaxScale");
- connectRefreshCachedSettingsSafe("RenderSSAOFactor");
- connectRefreshCachedSettingsSafe("RenderSSAOEffect");
- connectRefreshCachedSettingsSafe("RenderShadowOffsetError");
- connectRefreshCachedSettingsSafe("RenderShadowBiasError");
- connectRefreshCachedSettingsSafe("RenderShadowOffset");
- connectRefreshCachedSettingsSafe("RenderShadowBias");
- connectRefreshCachedSettingsSafe("RenderSpotShadowOffset");
- connectRefreshCachedSettingsSafe("RenderSpotShadowBias");
- connectRefreshCachedSettingsSafe("RenderEdgeDepthCutoff");
- connectRefreshCachedSettingsSafe("RenderEdgeNormCutoff");
- connectRefreshCachedSettingsSafe("RenderShadowGaussian");
- connectRefreshCachedSettingsSafe("RenderShadowBlurDistFactor");
- connectRefreshCachedSettingsSafe("RenderDeferredAtmospheric");
- connectRefreshCachedSettingsSafe("RenderHighlightFadeTime");
- connectRefreshCachedSettingsSafe("RenderFarClip");
- connectRefreshCachedSettingsSafe("RenderShadowSplitExponent");
- connectRefreshCachedSettingsSafe("RenderShadowErrorCutoff");
- connectRefreshCachedSettingsSafe("RenderShadowFOVCutoff");
- connectRefreshCachedSettingsSafe("CameraOffset");
- connectRefreshCachedSettingsSafe("CameraMaxCoF");
- connectRefreshCachedSettingsSafe("CameraDoFResScale");
- connectRefreshCachedSettingsSafe("RenderAutoHideSurfaceAreaLimit");
+ connectRefreshCachedSettingsSafe("RenderDeferredSSAO");
+ connectRefreshCachedSettingsSafe("RenderShadowResolutionScale");
+ connectRefreshCachedSettingsSafe("RenderDelayCreation");
+ connectRefreshCachedSettingsSafe("RenderAnimateRes");
+ connectRefreshCachedSettingsSafe("FreezeTime");
+ connectRefreshCachedSettingsSafe("DebugBeaconLineWidth");
+ connectRefreshCachedSettingsSafe("RenderHighlightBrightness");
+ connectRefreshCachedSettingsSafe("RenderHighlightColor");
+ connectRefreshCachedSettingsSafe("RenderHighlightThickness");
+ connectRefreshCachedSettingsSafe("RenderSpotLightsInNondeferred");
+ connectRefreshCachedSettingsSafe("PreviewAmbientColor");
+ connectRefreshCachedSettingsSafe("PreviewDiffuse0");
+ connectRefreshCachedSettingsSafe("PreviewSpecular0");
+ connectRefreshCachedSettingsSafe("PreviewDiffuse1");
+ connectRefreshCachedSettingsSafe("PreviewSpecular1");
+ connectRefreshCachedSettingsSafe("PreviewDiffuse2");
+ connectRefreshCachedSettingsSafe("PreviewSpecular2");
+ connectRefreshCachedSettingsSafe("PreviewDirection0");
+ connectRefreshCachedSettingsSafe("PreviewDirection1");
+ connectRefreshCachedSettingsSafe("PreviewDirection2");
+ connectRefreshCachedSettingsSafe("RenderGlowMaxExtractAlpha");
+ connectRefreshCachedSettingsSafe("RenderGlowWarmthAmount");
+ connectRefreshCachedSettingsSafe("RenderGlowLumWeights");
+ connectRefreshCachedSettingsSafe("RenderGlowWarmthWeights");
+ connectRefreshCachedSettingsSafe("RenderGlowResolutionPow");
+ connectRefreshCachedSettingsSafe("RenderGlowIterations");
+ connectRefreshCachedSettingsSafe("RenderGlowWidth");
+ connectRefreshCachedSettingsSafe("RenderGlowStrength");
+ connectRefreshCachedSettingsSafe("RenderGlowNoise");
+ connectRefreshCachedSettingsSafe("RenderDepthOfField");
+ connectRefreshCachedSettingsSafe("RenderDepthOfFieldInEditMode");
+ connectRefreshCachedSettingsSafe("CameraFocusTransitionTime");
+ connectRefreshCachedSettingsSafe("CameraFNumber");
+ connectRefreshCachedSettingsSafe("CameraFocalLength");
+ connectRefreshCachedSettingsSafe("CameraFieldOfView");
+ connectRefreshCachedSettingsSafe("RenderShadowNoise");
+ connectRefreshCachedSettingsSafe("RenderShadowBlurSize");
+ connectRefreshCachedSettingsSafe("RenderSSAOScale");
+ connectRefreshCachedSettingsSafe("RenderSSAOMaxScale");
+ connectRefreshCachedSettingsSafe("RenderSSAOFactor");
+ connectRefreshCachedSettingsSafe("RenderSSAOEffect");
+ connectRefreshCachedSettingsSafe("RenderShadowOffsetError");
+ connectRefreshCachedSettingsSafe("RenderShadowBiasError");
+ connectRefreshCachedSettingsSafe("RenderShadowOffset");
+ connectRefreshCachedSettingsSafe("RenderShadowBias");
+ connectRefreshCachedSettingsSafe("RenderSpotShadowOffset");
+ connectRefreshCachedSettingsSafe("RenderSpotShadowBias");
+ connectRefreshCachedSettingsSafe("RenderEdgeDepthCutoff");
+ connectRefreshCachedSettingsSafe("RenderEdgeNormCutoff");
+ connectRefreshCachedSettingsSafe("RenderShadowGaussian");
+ connectRefreshCachedSettingsSafe("RenderShadowBlurDistFactor");
+ connectRefreshCachedSettingsSafe("RenderDeferredAtmospheric");
+ connectRefreshCachedSettingsSafe("RenderHighlightFadeTime");
+ connectRefreshCachedSettingsSafe("RenderFarClip");
+ connectRefreshCachedSettingsSafe("RenderShadowSplitExponent");
+ connectRefreshCachedSettingsSafe("RenderShadowErrorCutoff");
+ connectRefreshCachedSettingsSafe("RenderShadowFOVCutoff");
+ connectRefreshCachedSettingsSafe("CameraOffset");
+ connectRefreshCachedSettingsSafe("CameraMaxCoF");
+ connectRefreshCachedSettingsSafe("CameraDoFResScale");
+ connectRefreshCachedSettingsSafe("RenderAutoHideSurfaceAreaLimit");
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflections");
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionIterations");
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionRayStep");
@@ -554,8 +554,8 @@ void LLPipeline::init()
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionDepthRejectBias");
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionAdaptiveStepMultiplier");
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionGlossySamples");
- connectRefreshCachedSettingsSafe("RenderBufferVisualization");
- gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+ connectRefreshCachedSettingsSafe("RenderBufferVisualization");
+ gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
}
LLPipeline::~LLPipeline()
@@ -564,99 +564,99 @@ LLPipeline::~LLPipeline()
void LLPipeline::cleanup()
{
- assertInitialized();
-
- mGroupQ1.clear() ;
-
- for(pool_set_t::iterator iter = mPools.begin();
- iter != mPools.end(); )
- {
- pool_set_t::iterator curiter = iter++;
- LLDrawPool* poolp = *curiter;
- if (poolp->isFacePool())
- {
- LLFacePool* face_pool = (LLFacePool*) poolp;
- if (face_pool->mReferences.empty())
- {
- mPools.erase(curiter);
- removeFromQuickLookup( poolp );
- delete poolp;
- }
- }
- else
- {
- mPools.erase(curiter);
- removeFromQuickLookup( poolp );
- delete poolp;
- }
- }
-
- if (!mTerrainPools.empty())
- {
- LL_WARNS() << "Terrain Pools not cleaned up" << LL_ENDL;
- }
- if (!mTreePools.empty())
- {
- LL_WARNS() << "Tree Pools not cleaned up" << LL_ENDL;
- }
-
- delete mAlphaPoolPreWater;
+ assertInitialized();
+
+ mGroupQ1.clear() ;
+
+ for(pool_set_t::iterator iter = mPools.begin();
+ iter != mPools.end(); )
+ {
+ pool_set_t::iterator curiter = iter++;
+ LLDrawPool* poolp = *curiter;
+ if (poolp->isFacePool())
+ {
+ LLFacePool* face_pool = (LLFacePool*) poolp;
+ if (face_pool->mReferences.empty())
+ {
+ mPools.erase(curiter);
+ removeFromQuickLookup( poolp );
+ delete poolp;
+ }
+ }
+ else
+ {
+ mPools.erase(curiter);
+ removeFromQuickLookup( poolp );
+ delete poolp;
+ }
+ }
+
+ if (!mTerrainPools.empty())
+ {
+ LL_WARNS() << "Terrain Pools not cleaned up" << LL_ENDL;
+ }
+ if (!mTreePools.empty())
+ {
+ LL_WARNS() << "Tree Pools not cleaned up" << LL_ENDL;
+ }
+
+ delete mAlphaPoolPreWater;
mAlphaPoolPreWater = nullptr;
delete mAlphaPoolPostWater;
mAlphaPoolPostWater = nullptr;
- delete mSkyPool;
- mSkyPool = NULL;
- delete mTerrainPool;
- mTerrainPool = NULL;
- delete mWaterPool;
- mWaterPool = NULL;
- delete mSimplePool;
- mSimplePool = NULL;
- delete mFullbrightPool;
- mFullbrightPool = NULL;
- delete mGlowPool;
- mGlowPool = NULL;
- delete mBumpPool;
- mBumpPool = NULL;
- // don't delete wl sky pool it was handled above in the for loop
- //delete mWLSkyPool;
- mWLSkyPool = NULL;
-
- releaseGLBuffers();
-
- mFaceSelectImagep = NULL;
+ delete mSkyPool;
+ mSkyPool = NULL;
+ delete mTerrainPool;
+ mTerrainPool = NULL;
+ delete mWaterPool;
+ mWaterPool = NULL;
+ delete mSimplePool;
+ mSimplePool = NULL;
+ delete mFullbrightPool;
+ mFullbrightPool = NULL;
+ delete mGlowPool;
+ mGlowPool = NULL;
+ delete mBumpPool;
+ mBumpPool = NULL;
+ // don't delete wl sky pool it was handled above in the for loop
+ //delete mWLSkyPool;
+ mWLSkyPool = NULL;
+
+ releaseGLBuffers();
+
+ mFaceSelectImagep = NULL;
mMovedList.clear();
mMovedBridge.clear();
mShiftList.clear();
- mInitialized = false;
+ mInitialized = false;
- mDeferredVB = NULL;
+ mDeferredVB = NULL;
mScreenTriangleVB = nullptr;
- mCubeVB = NULL;
+ mCubeVB = NULL;
mReflectionMapManager.cleanup();
}
//============================================================================
-void LLPipeline::destroyGL()
+void LLPipeline::destroyGL()
{
- stop_glerror();
- unloadShaders();
- mHighlightFaces.clear();
-
- resetDrawOrders();
+ stop_glerror();
+ unloadShaders();
+ mHighlightFaces.clear();
+
+ resetDrawOrders();
- releaseGLBuffers();
+ releaseGLBuffers();
- if (mMeshDirtyQueryObject)
- {
- glDeleteQueries(1, &mMeshDirtyQueryObject);
- mMeshDirtyQueryObject = 0;
- }
+ if (mMeshDirtyQueryObject)
+ {
+ glDeleteQueries(1, &mMeshDirtyQueryObject);
+ mMeshDirtyQueryObject = 0;
+ }
}
void LLPipeline::requestResizeScreenTexture()
@@ -679,86 +679,86 @@ void LLPipeline::resizeShadowTexture()
void LLPipeline::resizeScreenTexture()
{
- if (gPipeline.shadersLoaded())
- {
- GLuint resX = gViewerWindow->getWorldViewWidthRaw();
- GLuint resY = gViewerWindow->getWorldViewHeightRaw();
-
- if (gResizeScreenTexture || (resX != mRT->screen.getWidth()) || (resY != mRT->screen.getHeight()))
- {
- releaseScreenBuffers();
+ if (gPipeline.shadersLoaded())
+ {
+ GLuint resX = gViewerWindow->getWorldViewWidthRaw();
+ GLuint resY = gViewerWindow->getWorldViewHeightRaw();
+
+ if (gResizeScreenTexture || (resX != mRT->screen.getWidth()) || (resY != mRT->screen.getHeight()))
+ {
+ releaseScreenBuffers();
releaseSunShadowTargets();
releaseSpotShadowTargets();
- allocateScreenBuffer(resX,resY);
+ allocateScreenBuffer(resX,resY);
gResizeScreenTexture = FALSE;
- }
- }
+ }
+ }
}
bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
- eFBOStatus ret = doAllocateScreenBuffer(resX, resY);
+ eFBOStatus ret = doAllocateScreenBuffer(resX, resY);
- return ret == FBO_SUCCESS_FULLRES;
+ return ret == FBO_SUCCESS_FULLRES;
}
LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
- // try to allocate screen buffers at requested resolution and samples
- // - on failure, shrink number of samples and try again
- // - if not multisampled, shrink resolution and try again (favor X resolution over Y)
- // Make sure to call "releaseScreenBuffers" after each failure to cleanup the partially loaded state
+ // try to allocate screen buffers at requested resolution and samples
+ // - on failure, shrink number of samples and try again
+ // - if not multisampled, shrink resolution and try again (favor X resolution over Y)
+ // Make sure to call "releaseScreenBuffers" after each failure to cleanup the partially loaded state
// refresh cached settings here to protect against inconsistent event handling order
refreshCachedSettings();
- U32 samples = RenderFSAASamples;
-
- eFBOStatus ret = FBO_SUCCESS_FULLRES;
- if (!allocateScreenBuffer(resX, resY, samples))
- {
- //failed to allocate at requested specification, return false
- ret = FBO_FAILURE;
-
- releaseScreenBuffers();
- //reduce number of samples
- while (samples > 0)
- {
- samples /= 2;
- if (allocateScreenBuffer(resX, resY, samples))
- { //success
- return FBO_SUCCESS_LOWRES;
- }
- releaseScreenBuffers();
- }
-
- samples = 0;
-
- //reduce resolution
- while (resY > 0 && resX > 0)
- {
- resY /= 2;
- if (allocateScreenBuffer(resX, resY, samples))
- {
- return FBO_SUCCESS_LOWRES;
- }
- releaseScreenBuffers();
-
- resX /= 2;
- if (allocateScreenBuffer(resX, resY, samples))
- {
- return FBO_SUCCESS_LOWRES;
- }
- releaseScreenBuffers();
- }
-
- LL_WARNS() << "Unable to allocate screen buffer at any resolution!" << LL_ENDL;
- }
-
- return ret;
+ U32 samples = RenderFSAASamples;
+
+ eFBOStatus ret = FBO_SUCCESS_FULLRES;
+ if (!allocateScreenBuffer(resX, resY, samples))
+ {
+ //failed to allocate at requested specification, return false
+ ret = FBO_FAILURE;
+
+ releaseScreenBuffers();
+ //reduce number of samples
+ while (samples > 0)
+ {
+ samples /= 2;
+ if (allocateScreenBuffer(resX, resY, samples))
+ { //success
+ return FBO_SUCCESS_LOWRES;
+ }
+ releaseScreenBuffers();
+ }
+
+ samples = 0;
+
+ //reduce resolution
+ while (resY > 0 && resX > 0)
+ {
+ resY /= 2;
+ if (allocateScreenBuffer(resX, resY, samples))
+ {
+ return FBO_SUCCESS_LOWRES;
+ }
+ releaseScreenBuffers();
+
+ resX /= 2;
+ if (allocateScreenBuffer(resX, resY, samples))
+ {
+ return FBO_SUCCESS_LOWRES;
+ }
+ releaseScreenBuffers();
+ }
+
+ LL_WARNS() << "Unable to allocate screen buffer at any resolution!" << LL_ENDL;
+ }
+
+ return ret;
}
bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
@@ -775,59 +775,59 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
gCubeSnapshot = FALSE;
}
- // remember these dimensions
- mRT->width = resX;
- mRT->height = resY;
-
- U32 res_mod = RenderResolutionDivisor;
+ // remember these dimensions
+ mRT->width = resX;
+ mRT->height = resY;
- if (res_mod > 1 && res_mod < resX && res_mod < resY)
- {
- resX /= res_mod;
- resY /= res_mod;
- }
+ U32 res_mod = RenderResolutionDivisor;
+
+ if (res_mod > 1 && res_mod < resX && res_mod < resY)
+ {
+ resX /= res_mod;
+ resY /= res_mod;
+ }
//water reflection texture (always needed as scratch space whether or not transparent water is enabled)
mWaterDis.allocate(resX, resY, GL_RGBA16F, true);
- if (RenderUIBuffer)
- {
- if (!mRT->uiScreen.allocate(resX,resY, GL_RGBA))
- {
- return false;
- }
- }
-
- S32 shadow_detail = RenderShadowDetail;
- bool ssao = RenderDeferredSSAO;
-
- //allocate deferred rendering color buffers
- if (!mRT->deferredScreen.allocate(resX, resY, GL_RGBA, true)) return false;
- if (!addDeferredAttachments(mRT->deferredScreen)) return false;
-
- GLuint screenFormat = GL_RGBA16F;
-
- if (!mRT->screen.allocate(resX, resY, screenFormat)) return false;
+ if (RenderUIBuffer)
+ {
+ if (!mRT->uiScreen.allocate(resX,resY, GL_RGBA))
+ {
+ return false;
+ }
+ }
+
+ S32 shadow_detail = RenderShadowDetail;
+ bool ssao = RenderDeferredSSAO;
+
+ //allocate deferred rendering color buffers
+ if (!mRT->deferredScreen.allocate(resX, resY, GL_RGBA, true)) return false;
+ if (!addDeferredAttachments(mRT->deferredScreen)) return false;
+
+ GLuint screenFormat = GL_RGBA16F;
+
+ if (!mRT->screen.allocate(resX, resY, screenFormat)) return false;
mRT->deferredScreen.shareDepthBuffer(mRT->screen);
- if (samples > 0)
- {
- if (!mRT->fxaaBuffer.allocate(resX, resY, GL_RGBA)) return false;
- }
- else
- {
- mRT->fxaaBuffer.release();
- }
-
- if (shadow_detail > 0 || ssao || RenderDepthOfField || samples > 0)
- { //only need mRT->deferredLight for shadows OR ssao OR dof OR fxaa
- if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16F)) return false;
- }
- else
- {
- mRT->deferredLight.release();
- }
+ if (samples > 0)
+ {
+ if (!mRT->fxaaBuffer.allocate(resX, resY, GL_RGBA)) return false;
+ }
+ else
+ {
+ mRT->fxaaBuffer.release();
+ }
+
+ if (shadow_detail > 0 || ssao || RenderDepthOfField || samples > 0)
+ { //only need mRT->deferredLight for shadows OR ssao OR dof OR fxaa
+ if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16F)) return false;
+ }
+ else
+ {
+ mRT->deferredLight.release();
+ }
allocateShadowBuffer(resX, resY);
@@ -836,7 +836,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
mSceneMap.allocate(resX, resY, GL_RGB, true);
}
- const bool post_hdr = gSavedSettings.getBOOL("RenderPostProcessingHDR");
+ const bool post_hdr = gSavedSettings.getBOOL("RenderPostProcessingHDR");
const U32 post_color_fmt = post_hdr ? GL_RGBA16F : GL_RGBA;
mPostMap.allocate(resX, resY, post_color_fmt);
@@ -848,9 +848,9 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
gGL.getTexUnit(0)->disable();
- stop_glerror();
+ stop_glerror();
- return true;
+ return true;
}
// must be even to avoid a stripe in the horizontal shadow blur
@@ -909,7 +909,7 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY)
// set up shadow map filtering and compare modes
if (shadow_detail > 0)
- {
+ {
for (U32 i = 0; i < 4; i++)
{
LLRenderTarget* shadow_target = getSunShadowTarget(i);
@@ -942,7 +942,7 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY)
}
}
- return true;
+ return true;
}
//static
@@ -955,86 +955,86 @@ void LLPipeline::updateRenderTransparentWater()
void LLPipeline::refreshCachedSettings()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
- LLPipeline::sAutoMaskAlphaDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaDeferred");
- LLPipeline::sAutoMaskAlphaNonDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaNonDeferred");
- LLPipeline::sUseFarClip = gSavedSettings.getBOOL("RenderUseFarClip");
- LLVOAvatar::sMaxNonImpostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors");
- LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors);
-
- LLPipeline::sUseOcclusion =
- (!gUseWireframe
- && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
- && gSavedSettings.getBOOL("UseOcclusion")) ? 2 : 0;
-
+ LLPipeline::sAutoMaskAlphaDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaDeferred");
+ LLPipeline::sAutoMaskAlphaNonDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaNonDeferred");
+ LLPipeline::sUseFarClip = gSavedSettings.getBOOL("RenderUseFarClip");
+ LLVOAvatar::sMaxNonImpostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors");
+ LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors);
+
+ LLPipeline::sUseOcclusion =
+ (!gUseWireframe
+ && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
+ && gSavedSettings.getBOOL("UseOcclusion")) ? 2 : 0;
+
WindLightUseAtmosShaders = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders");
RenderDeferred = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred");
- RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash");
- RenderFSAASamples = LLFeatureManager::getInstance()->isFeatureAvailable("RenderFSAASamples") ? gSavedSettings.getU32("RenderFSAASamples") : 0;
- RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor");
- RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer");
- RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail");
+ RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash");
+ RenderFSAASamples = LLFeatureManager::getInstance()->isFeatureAvailable("RenderFSAASamples") ? gSavedSettings.getU32("RenderFSAASamples") : 0;
+ RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor");
+ RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer");
+ RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail");
RenderShadowSplits = gSavedSettings.getS32("RenderShadowSplits");
- RenderDeferredSSAO = gSavedSettings.getBOOL("RenderDeferredSSAO");
- RenderShadowResolutionScale = gSavedSettings.getF32("RenderShadowResolutionScale");
- RenderDelayCreation = gSavedSettings.getBOOL("RenderDelayCreation");
- RenderAnimateRes = gSavedSettings.getBOOL("RenderAnimateRes");
- FreezeTime = gSavedSettings.getBOOL("FreezeTime");
- DebugBeaconLineWidth = gSavedSettings.getS32("DebugBeaconLineWidth");
- RenderHighlightBrightness = gSavedSettings.getF32("RenderHighlightBrightness");
- RenderHighlightColor = gSavedSettings.getColor4("RenderHighlightColor");
- RenderHighlightThickness = gSavedSettings.getF32("RenderHighlightThickness");
- RenderSpotLightsInNondeferred = gSavedSettings.getBOOL("RenderSpotLightsInNondeferred");
- PreviewAmbientColor = gSavedSettings.getColor4("PreviewAmbientColor");
- PreviewDiffuse0 = gSavedSettings.getColor4("PreviewDiffuse0");
- PreviewSpecular0 = gSavedSettings.getColor4("PreviewSpecular0");
- PreviewDiffuse1 = gSavedSettings.getColor4("PreviewDiffuse1");
- PreviewSpecular1 = gSavedSettings.getColor4("PreviewSpecular1");
- PreviewDiffuse2 = gSavedSettings.getColor4("PreviewDiffuse2");
- PreviewSpecular2 = gSavedSettings.getColor4("PreviewSpecular2");
- PreviewDirection0 = gSavedSettings.getVector3("PreviewDirection0");
- PreviewDirection1 = gSavedSettings.getVector3("PreviewDirection1");
- PreviewDirection2 = gSavedSettings.getVector3("PreviewDirection2");
- RenderGlowMaxExtractAlpha = gSavedSettings.getF32("RenderGlowMaxExtractAlpha");
- RenderGlowWarmthAmount = gSavedSettings.getF32("RenderGlowWarmthAmount");
- RenderGlowLumWeights = gSavedSettings.getVector3("RenderGlowLumWeights");
- RenderGlowWarmthWeights = gSavedSettings.getVector3("RenderGlowWarmthWeights");
- RenderGlowResolutionPow = gSavedSettings.getS32("RenderGlowResolutionPow");
- RenderGlowIterations = gSavedSettings.getS32("RenderGlowIterations");
- RenderGlowWidth = gSavedSettings.getF32("RenderGlowWidth");
- RenderGlowStrength = gSavedSettings.getF32("RenderGlowStrength");
- RenderGlowNoise = gSavedSettings.getBOOL("RenderGlowNoise");
- RenderDepthOfField = gSavedSettings.getBOOL("RenderDepthOfField");
- RenderDepthOfFieldInEditMode = gSavedSettings.getBOOL("RenderDepthOfFieldInEditMode");
- CameraFocusTransitionTime = gSavedSettings.getF32("CameraFocusTransitionTime");
- CameraFNumber = gSavedSettings.getF32("CameraFNumber");
- CameraFocalLength = gSavedSettings.getF32("CameraFocalLength");
- CameraFieldOfView = gSavedSettings.getF32("CameraFieldOfView");
- RenderShadowNoise = gSavedSettings.getF32("RenderShadowNoise");
- RenderShadowBlurSize = gSavedSettings.getF32("RenderShadowBlurSize");
- RenderSSAOScale = gSavedSettings.getF32("RenderSSAOScale");
- RenderSSAOMaxScale = gSavedSettings.getU32("RenderSSAOMaxScale");
- RenderSSAOFactor = gSavedSettings.getF32("RenderSSAOFactor");
- RenderSSAOEffect = gSavedSettings.getVector3("RenderSSAOEffect");
- RenderShadowOffsetError = gSavedSettings.getF32("RenderShadowOffsetError");
- RenderShadowBiasError = gSavedSettings.getF32("RenderShadowBiasError");
- RenderShadowOffset = gSavedSettings.getF32("RenderShadowOffset");
- RenderShadowBias = gSavedSettings.getF32("RenderShadowBias");
- RenderSpotShadowOffset = gSavedSettings.getF32("RenderSpotShadowOffset");
- RenderSpotShadowBias = gSavedSettings.getF32("RenderSpotShadowBias");
- RenderEdgeDepthCutoff = gSavedSettings.getF32("RenderEdgeDepthCutoff");
- RenderEdgeNormCutoff = gSavedSettings.getF32("RenderEdgeNormCutoff");
- RenderShadowGaussian = gSavedSettings.getVector3("RenderShadowGaussian");
- RenderShadowBlurDistFactor = gSavedSettings.getF32("RenderShadowBlurDistFactor");
- RenderDeferredAtmospheric = gSavedSettings.getBOOL("RenderDeferredAtmospheric");
- RenderHighlightFadeTime = gSavedSettings.getF32("RenderHighlightFadeTime");
- RenderFarClip = gSavedSettings.getF32("RenderFarClip");
- RenderShadowSplitExponent = gSavedSettings.getVector3("RenderShadowSplitExponent");
- RenderShadowErrorCutoff = gSavedSettings.getF32("RenderShadowErrorCutoff");
- RenderShadowFOVCutoff = gSavedSettings.getF32("RenderShadowFOVCutoff");
- CameraOffset = gSavedSettings.getBOOL("CameraOffset");
- CameraMaxCoF = gSavedSettings.getF32("CameraMaxCoF");
- CameraDoFResScale = gSavedSettings.getF32("CameraDoFResScale");
- RenderAutoHideSurfaceAreaLimit = gSavedSettings.getF32("RenderAutoHideSurfaceAreaLimit");
+ RenderDeferredSSAO = gSavedSettings.getBOOL("RenderDeferredSSAO");
+ RenderShadowResolutionScale = gSavedSettings.getF32("RenderShadowResolutionScale");
+ RenderDelayCreation = gSavedSettings.getBOOL("RenderDelayCreation");
+ RenderAnimateRes = gSavedSettings.getBOOL("RenderAnimateRes");
+ FreezeTime = gSavedSettings.getBOOL("FreezeTime");
+ DebugBeaconLineWidth = gSavedSettings.getS32("DebugBeaconLineWidth");
+ RenderHighlightBrightness = gSavedSettings.getF32("RenderHighlightBrightness");
+ RenderHighlightColor = gSavedSettings.getColor4("RenderHighlightColor");
+ RenderHighlightThickness = gSavedSettings.getF32("RenderHighlightThickness");
+ RenderSpotLightsInNondeferred = gSavedSettings.getBOOL("RenderSpotLightsInNondeferred");
+ PreviewAmbientColor = gSavedSettings.getColor4("PreviewAmbientColor");
+ PreviewDiffuse0 = gSavedSettings.getColor4("PreviewDiffuse0");
+ PreviewSpecular0 = gSavedSettings.getColor4("PreviewSpecular0");
+ PreviewDiffuse1 = gSavedSettings.getColor4("PreviewDiffuse1");
+ PreviewSpecular1 = gSavedSettings.getColor4("PreviewSpecular1");
+ PreviewDiffuse2 = gSavedSettings.getColor4("PreviewDiffuse2");
+ PreviewSpecular2 = gSavedSettings.getColor4("PreviewSpecular2");
+ PreviewDirection0 = gSavedSettings.getVector3("PreviewDirection0");
+ PreviewDirection1 = gSavedSettings.getVector3("PreviewDirection1");
+ PreviewDirection2 = gSavedSettings.getVector3("PreviewDirection2");
+ RenderGlowMaxExtractAlpha = gSavedSettings.getF32("RenderGlowMaxExtractAlpha");
+ RenderGlowWarmthAmount = gSavedSettings.getF32("RenderGlowWarmthAmount");
+ RenderGlowLumWeights = gSavedSettings.getVector3("RenderGlowLumWeights");
+ RenderGlowWarmthWeights = gSavedSettings.getVector3("RenderGlowWarmthWeights");
+ RenderGlowResolutionPow = gSavedSettings.getS32("RenderGlowResolutionPow");
+ RenderGlowIterations = gSavedSettings.getS32("RenderGlowIterations");
+ RenderGlowWidth = gSavedSettings.getF32("RenderGlowWidth");
+ RenderGlowStrength = gSavedSettings.getF32("RenderGlowStrength");
+ RenderGlowNoise = gSavedSettings.getBOOL("RenderGlowNoise");
+ RenderDepthOfField = gSavedSettings.getBOOL("RenderDepthOfField");
+ RenderDepthOfFieldInEditMode = gSavedSettings.getBOOL("RenderDepthOfFieldInEditMode");
+ CameraFocusTransitionTime = gSavedSettings.getF32("CameraFocusTransitionTime");
+ CameraFNumber = gSavedSettings.getF32("CameraFNumber");
+ CameraFocalLength = gSavedSettings.getF32("CameraFocalLength");
+ CameraFieldOfView = gSavedSettings.getF32("CameraFieldOfView");
+ RenderShadowNoise = gSavedSettings.getF32("RenderShadowNoise");
+ RenderShadowBlurSize = gSavedSettings.getF32("RenderShadowBlurSize");
+ RenderSSAOScale = gSavedSettings.getF32("RenderSSAOScale");
+ RenderSSAOMaxScale = gSavedSettings.getU32("RenderSSAOMaxScale");
+ RenderSSAOFactor = gSavedSettings.getF32("RenderSSAOFactor");
+ RenderSSAOEffect = gSavedSettings.getVector3("RenderSSAOEffect");
+ RenderShadowOffsetError = gSavedSettings.getF32("RenderShadowOffsetError");
+ RenderShadowBiasError = gSavedSettings.getF32("RenderShadowBiasError");
+ RenderShadowOffset = gSavedSettings.getF32("RenderShadowOffset");
+ RenderShadowBias = gSavedSettings.getF32("RenderShadowBias");
+ RenderSpotShadowOffset = gSavedSettings.getF32("RenderSpotShadowOffset");
+ RenderSpotShadowBias = gSavedSettings.getF32("RenderSpotShadowBias");
+ RenderEdgeDepthCutoff = gSavedSettings.getF32("RenderEdgeDepthCutoff");
+ RenderEdgeNormCutoff = gSavedSettings.getF32("RenderEdgeNormCutoff");
+ RenderShadowGaussian = gSavedSettings.getVector3("RenderShadowGaussian");
+ RenderShadowBlurDistFactor = gSavedSettings.getF32("RenderShadowBlurDistFactor");
+ RenderDeferredAtmospheric = gSavedSettings.getBOOL("RenderDeferredAtmospheric");
+ RenderHighlightFadeTime = gSavedSettings.getF32("RenderHighlightFadeTime");
+ RenderFarClip = gSavedSettings.getF32("RenderFarClip");
+ RenderShadowSplitExponent = gSavedSettings.getVector3("RenderShadowSplitExponent");
+ RenderShadowErrorCutoff = gSavedSettings.getF32("RenderShadowErrorCutoff");
+ RenderShadowFOVCutoff = gSavedSettings.getF32("RenderShadowFOVCutoff");
+ CameraOffset = gSavedSettings.getBOOL("CameraOffset");
+ CameraMaxCoF = gSavedSettings.getF32("CameraMaxCoF");
+ CameraDoFResScale = gSavedSettings.getF32("CameraDoFResScale");
+ RenderAutoHideSurfaceAreaLimit = gSavedSettings.getF32("RenderAutoHideSurfaceAreaLimit");
RenderScreenSpaceReflections = gSavedSettings.getBOOL("RenderScreenSpaceReflections");
RenderScreenSpaceReflectionIterations = gSavedSettings.getS32("RenderScreenSpaceReflectionIterations");
RenderScreenSpaceReflectionRayStep = gSavedSettings.getF32("RenderScreenSpaceReflectionRayStep");
@@ -1042,60 +1042,60 @@ void LLPipeline::refreshCachedSettings()
RenderScreenSpaceReflectionDepthRejectBias = gSavedSettings.getF32("RenderScreenSpaceReflectionDepthRejectBias");
RenderScreenSpaceReflectionAdaptiveStepMultiplier = gSavedSettings.getF32("RenderScreenSpaceReflectionAdaptiveStepMultiplier");
RenderScreenSpaceReflectionGlossySamples = gSavedSettings.getS32("RenderScreenSpaceReflectionGlossySamples");
- RenderBufferVisualization = gSavedSettings.getS32("RenderBufferVisualization");
+ RenderBufferVisualization = gSavedSettings.getS32("RenderBufferVisualization");
sReflectionProbesEnabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionsEnabled") && gSavedSettings.getBOOL("RenderReflectionsEnabled");
- RenderSpotLight = nullptr;
+ RenderSpotLight = nullptr;
- if (gNonInteractive)
- {
- LLVOAvatar::sMaxNonImpostors = 1;
- LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors);
- }
+ if (gNonInteractive)
+ {
+ LLVOAvatar::sMaxNonImpostors = 1;
+ LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors);
+ }
}
void LLPipeline::releaseGLBuffers()
{
- assertInitialized();
-
- if (mNoiseMap)
- {
- LLImageGL::deleteTextures(1, &mNoiseMap);
- mNoiseMap = 0;
- }
+ assertInitialized();
- if (mTrueNoiseMap)
- {
- LLImageGL::deleteTextures(1, &mTrueNoiseMap);
- mTrueNoiseMap = 0;
- }
+ if (mNoiseMap)
+ {
+ LLImageGL::deleteTextures(1, &mNoiseMap);
+ mNoiseMap = 0;
+ }
- releaseLUTBuffers();
+ if (mTrueNoiseMap)
+ {
+ LLImageGL::deleteTextures(1, &mTrueNoiseMap);
+ mTrueNoiseMap = 0;
+ }
+
+ releaseLUTBuffers();
- mWaterDis.release();
+ mWaterDis.release();
mBake.release();
-
+
mSceneMap.release();
mPostMap.release();
- for (U32 i = 0; i < 3; i++)
- {
- mGlow[i].release();
- }
+ for (U32 i = 0; i < 3; i++)
+ {
+ mGlow[i].release();
+ }
- releaseScreenBuffers();
+ releaseScreenBuffers();
- gBumpImageList.destroyGL();
- LLVOAvatar::resetImpostors();
+ gBumpImageList.destroyGL();
+ LLVOAvatar::resetImpostors();
}
void LLPipeline::releaseLUTBuffers()
{
- if (mLightFunc)
- {
- LLImageGL::deleteTextures(1, &mLightFunc);
- mLightFunc = 0;
- }
+ if (mLightFunc)
+ {
+ LLImageGL::deleteTextures(1, &mLightFunc);
+ mLightFunc = 0;
+ }
mPbrBrdfLut.release();
@@ -1128,10 +1128,10 @@ void LLPipeline::releaseSunShadowTarget(U32 index)
void LLPipeline::releaseSunShadowTargets()
{
- for (U32 i = 0; i < 4; i++)
- {
+ for (U32 i = 0; i < 4; i++)
+ {
releaseSunShadowTarget(i);
- }
+ }
}
void LLPipeline::releaseSpotShadowTargets()
@@ -1149,19 +1149,19 @@ void LLPipeline::createGLBuffers()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
stop_glerror();
- assertInitialized();
+ assertInitialized();
// Use FBO for bake tex
mBake.allocate(512, 512, GL_RGBA, true); // SL-12781 Build > Upload > Model; 3D Preview
- stop_glerror();
+ stop_glerror();
- GLuint resX = gViewerWindow->getWorldViewWidthRaw();
- GLuint resY = gViewerWindow->getWorldViewHeightRaw();
+ GLuint resX = gViewerWindow->getWorldViewWidthRaw();
+ GLuint resY = gViewerWindow->getWorldViewHeightRaw();
// allocate screen space glow buffers
const U32 glow_res = llmax(1, llmin(512, 1 << gSavedSettings.getS32("RenderGlowResolutionPow")));
- const bool glow_hdr = gSavedSettings.getBOOL("RenderGlowHDR");
+ const bool glow_hdr = gSavedSettings.getBOOL("RenderGlowHDR");
const U32 glow_color_fmt = glow_hdr ? GL_RGBA16F : GL_RGBA;
for (U32 i = 0; i < 3; i++)
{
@@ -1172,100 +1172,100 @@ void LLPipeline::createGLBuffers()
mRT->width = 0;
mRT->height = 0;
-
- if (!mNoiseMap)
- {
- const U32 noiseRes = 128;
- LLVector3 noise[noiseRes*noiseRes];
-
- F32 scaler = gSavedSettings.getF32("RenderDeferredNoise")/100.f;
- for (U32 i = 0; i < noiseRes*noiseRes; ++i)
- {
- noise[i] = LLVector3(ll_frand()-0.5f, ll_frand()-0.5f, 0.f);
- noise[i].normVec();
- noise[i].mV[2] = ll_frand()*scaler+1.f-scaler/2.f;
- }
-
- LLImageGL::generateTextures(1, &mNoiseMap);
-
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap);
- LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise, false);
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
- }
-
- if (!mTrueNoiseMap)
- {
- const U32 noiseRes = 128;
- F32 noise[noiseRes*noiseRes*3];
- for (U32 i = 0; i < noiseRes*noiseRes*3; i++)
- {
- noise[i] = ll_frand()*2.0-1.0;
- }
-
- LLImageGL::generateTextures(1, &mTrueNoiseMap);
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTrueNoiseMap);
- LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB,GL_FLOAT, noise, false);
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
- }
-
- createLUTBuffers();
-
- gBumpImageList.restoreGL();
+
+ if (!mNoiseMap)
+ {
+ const U32 noiseRes = 128;
+ LLVector3 noise[noiseRes*noiseRes];
+
+ F32 scaler = gSavedSettings.getF32("RenderDeferredNoise")/100.f;
+ for (U32 i = 0; i < noiseRes*noiseRes; ++i)
+ {
+ noise[i] = LLVector3(ll_frand()-0.5f, ll_frand()-0.5f, 0.f);
+ noise[i].normVec();
+ noise[i].mV[2] = ll_frand()*scaler+1.f-scaler/2.f;
+ }
+
+ LLImageGL::generateTextures(1, &mNoiseMap);
+
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap);
+ LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise, false);
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+ }
+
+ if (!mTrueNoiseMap)
+ {
+ const U32 noiseRes = 128;
+ F32 noise[noiseRes*noiseRes*3];
+ for (U32 i = 0; i < noiseRes*noiseRes*3; i++)
+ {
+ noise[i] = ll_frand()*2.0-1.0;
+ }
+
+ LLImageGL::generateTextures(1, &mTrueNoiseMap);
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTrueNoiseMap);
+ LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB,GL_FLOAT, noise, false);
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+ }
+
+ createLUTBuffers();
+
+ gBumpImageList.restoreGL();
}
F32 lerpf(F32 a, F32 b, F32 w)
{
- return a + w * (b - a);
+ return a + w * (b - a);
}
void LLPipeline::createLUTBuffers()
{
- if (!mLightFunc)
- {
- U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
- U32 lightResY = gSavedSettings.getU32("RenderSpecularResY");
- F32* ls = new F32[lightResX*lightResY];
- F32 specExp = gSavedSettings.getF32("RenderSpecularExponent");
+ if (!mLightFunc)
+ {
+ U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
+ U32 lightResY = gSavedSettings.getU32("RenderSpecularResY");
+ F32* ls = new F32[lightResX*lightResY];
+ F32 specExp = gSavedSettings.getF32("RenderSpecularExponent");
// Calculate the (normalized) blinn-phong specular lookup texture. (with a few tweaks)
- for (U32 y = 0; y < lightResY; ++y)
- {
- for (U32 x = 0; x < lightResX; ++x)
- {
- ls[y*lightResX+x] = 0;
- F32 sa = (F32) x/(lightResX-1);
- F32 spec = (F32) y/(lightResY-1);
- F32 n = spec * spec * specExp;
-
- // Nothing special here. Just your typical blinn-phong term.
- spec = powf(sa, n);
-
- // Apply our normalization function.
- // Note: This is the full equation that applies the full normalization curve, not an approximation.
- // This is fine, given we only need to create our LUT once per buffer initialization.
- spec *= (((n + 2) * (n + 4)) / (8 * F_PI * (powf(2, -n/2) + n)));
-
- // Since we use R16F, we no longer have a dynamic range issue we need to work around here.
- // Though some older drivers may not like this, newer drivers shouldn't have this problem.
- ls[y*lightResX+x] = spec;
- }
- }
-
- U32 pix_format = GL_R16F;
+ for (U32 y = 0; y < lightResY; ++y)
+ {
+ for (U32 x = 0; x < lightResX; ++x)
+ {
+ ls[y*lightResX+x] = 0;
+ F32 sa = (F32) x/(lightResX-1);
+ F32 spec = (F32) y/(lightResY-1);
+ F32 n = spec * spec * specExp;
+
+ // Nothing special here. Just your typical blinn-phong term.
+ spec = powf(sa, n);
+
+ // Apply our normalization function.
+ // Note: This is the full equation that applies the full normalization curve, not an approximation.
+ // This is fine, given we only need to create our LUT once per buffer initialization.
+ spec *= (((n + 2) * (n + 4)) / (8 * F_PI * (powf(2, -n/2) + n)));
+
+ // Since we use R16F, we no longer have a dynamic range issue we need to work around here.
+ // Though some older drivers may not like this, newer drivers shouldn't have this problem.
+ ls[y*lightResX+x] = spec;
+ }
+ }
+
+ U32 pix_format = GL_R16F;
#if LL_DARWIN
- // Need to work around limited precision with 10.6.8 and older drivers
- //
- pix_format = GL_R32F;
+ // Need to work around limited precision with 10.6.8 and older drivers
+ //
+ pix_format = GL_R32F;
#endif
- LLImageGL::generateTextures(1, &mLightFunc);
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc);
- LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, pix_format, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false);
- gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-
- delete [] ls;
- }
+ LLImageGL::generateTextures(1, &mLightFunc);
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc);
+ LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, pix_format, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false);
+ gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+
+ delete [] ls;
+ }
mPbrBrdfLut.allocate(512, 512, GL_RG16F);
mPbrBrdfLut.bindTarget();
@@ -1297,23 +1297,23 @@ void LLPipeline::createLUTBuffers()
void LLPipeline::restoreGL()
{
- assertInitialized();
+ assertInitialized();
- LLViewerShaderMgr::instance()->setShaders();
+ LLViewerShaderMgr::instance()->setShaders();
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- part->restoreGL();
- }
- }
- }
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
+ {
+ part->restoreGL();
+ }
+ }
+ }
}
bool LLPipeline::shadersLoaded()
@@ -1328,281 +1328,281 @@ bool LLPipeline::canUseWindLightShaders() const
bool LLPipeline::canUseAntiAliasing() const
{
- return true;
+ return true;
}
void LLPipeline::unloadShaders()
{
- LLViewerShaderMgr::instance()->unloadShaders();
- mShadersLoaded = false;
+ LLViewerShaderMgr::instance()->unloadShaders();
+ mShadersLoaded = false;
}
void LLPipeline::assertInitializedDoError()
{
- LL_ERRS() << "LLPipeline used when uninitialized." << LL_ENDL;
+ LL_ERRS() << "LLPipeline used when uninitialized." << LL_ENDL;
}
//============================================================================
void LLPipeline::enableShadows(const bool enable_shadows)
{
- //should probably do something here to wrangle shadows....
+ //should probably do something here to wrangle shadows....
}
class LLOctreeDirtyTexture : public OctreeTraveler
{
public:
- const std::set<LLViewerFetchedTexture*>& mTextures;
-
- LLOctreeDirtyTexture(const std::set<LLViewerFetchedTexture*>& textures) : mTextures(textures) { }
-
- virtual void visit(const OctreeNode* node)
- {
- LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
-
- if (!group->hasState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty())
- {
- for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
- {
- for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
- {
- LLDrawInfo* params = *j;
- LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(params->mTexture);
- if (tex && mTextures.find(tex) != mTextures.end())
- {
- group->setState(LLSpatialGroup::GEOM_DIRTY);
- }
- }
- }
- }
-
- for (LLSpatialGroup::bridge_list_t::iterator i = group->mBridgeList.begin(); i != group->mBridgeList.end(); ++i)
- {
- LLSpatialBridge* bridge = *i;
- traverse(bridge->mOctree);
- }
- }
+ const std::set<LLViewerFetchedTexture*>& mTextures;
+
+ LLOctreeDirtyTexture(const std::set<LLViewerFetchedTexture*>& textures) : mTextures(textures) { }
+
+ virtual void visit(const OctreeNode* node)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
+
+ if (!group->hasState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty())
+ {
+ for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
+ {
+ for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
+ {
+ LLDrawInfo* params = *j;
+ LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(params->mTexture);
+ if (tex && mTextures.find(tex) != mTextures.end())
+ {
+ group->setState(LLSpatialGroup::GEOM_DIRTY);
+ }
+ }
+ }
+ }
+
+ for (LLSpatialGroup::bridge_list_t::iterator i = group->mBridgeList.begin(); i != group->mBridgeList.end(); ++i)
+ {
+ LLSpatialBridge* bridge = *i;
+ traverse(bridge->mOctree);
+ }
+ }
};
// Called when a texture changes # of channels (causes faces to move to alpha pool)
void LLPipeline::dirtyPoolObjectTextures(const std::set<LLViewerFetchedTexture*>& textures)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- assertInitialized();
-
- // *TODO: This is inefficient and causes frame spikes; need a better way to do this
- // Most of the time is spent in dirty.traverse.
-
- for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
- {
- LLDrawPool *poolp = *iter;
- if (poolp->isFacePool())
- {
- ((LLFacePool*) poolp)->dirtyTextures(textures);
- }
- }
-
- LLOctreeDirtyTexture dirty(textures);
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- dirty.traverse(part->mOctree);
- }
- }
- }
+ assertInitialized();
+
+ // *TODO: This is inefficient and causes frame spikes; need a better way to do this
+ // Most of the time is spent in dirty.traverse.
+
+ for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
+ {
+ LLDrawPool *poolp = *iter;
+ if (poolp->isFacePool())
+ {
+ ((LLFacePool*) poolp)->dirtyTextures(textures);
+ }
+ }
+
+ LLOctreeDirtyTexture dirty(textures);
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
+ {
+ dirty.traverse(part->mOctree);
+ }
+ }
+ }
}
LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0)
{
- assertInitialized();
-
- LLDrawPool *poolp = NULL;
- switch( type )
- {
- case LLDrawPool::POOL_SIMPLE:
- poolp = mSimplePool;
- break;
-
- case LLDrawPool::POOL_GRASS:
- poolp = mGrassPool;
- break;
-
- case LLDrawPool::POOL_ALPHA_MASK:
- poolp = mAlphaMaskPool;
- break;
-
- case LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK:
- poolp = mFullbrightAlphaMaskPool;
- break;
-
- case LLDrawPool::POOL_FULLBRIGHT:
- poolp = mFullbrightPool;
- break;
-
- case LLDrawPool::POOL_GLOW:
- poolp = mGlowPool;
- break;
-
- case LLDrawPool::POOL_TREE:
- poolp = get_if_there(mTreePools, (uintptr_t)tex0, (LLDrawPool*)0 );
- break;
-
- case LLDrawPool::POOL_TERRAIN:
- poolp = get_if_there(mTerrainPools, (uintptr_t)tex0, (LLDrawPool*)0 );
- break;
-
- case LLDrawPool::POOL_BUMP:
- poolp = mBumpPool;
- break;
- case LLDrawPool::POOL_MATERIALS:
- poolp = mMaterialsPool;
- break;
- case LLDrawPool::POOL_ALPHA_PRE_WATER:
- poolp = mAlphaPoolPreWater;
- break;
+ assertInitialized();
+
+ LLDrawPool *poolp = NULL;
+ switch( type )
+ {
+ case LLDrawPool::POOL_SIMPLE:
+ poolp = mSimplePool;
+ break;
+
+ case LLDrawPool::POOL_GRASS:
+ poolp = mGrassPool;
+ break;
+
+ case LLDrawPool::POOL_ALPHA_MASK:
+ poolp = mAlphaMaskPool;
+ break;
+
+ case LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK:
+ poolp = mFullbrightAlphaMaskPool;
+ break;
+
+ case LLDrawPool::POOL_FULLBRIGHT:
+ poolp = mFullbrightPool;
+ break;
+
+ case LLDrawPool::POOL_GLOW:
+ poolp = mGlowPool;
+ break;
+
+ case LLDrawPool::POOL_TREE:
+ poolp = get_if_there(mTreePools, (uintptr_t)tex0, (LLDrawPool*)0 );
+ break;
+
+ case LLDrawPool::POOL_TERRAIN:
+ poolp = get_if_there(mTerrainPools, (uintptr_t)tex0, (LLDrawPool*)0 );
+ break;
+
+ case LLDrawPool::POOL_BUMP:
+ poolp = mBumpPool;
+ break;
+ case LLDrawPool::POOL_MATERIALS:
+ poolp = mMaterialsPool;
+ break;
+ case LLDrawPool::POOL_ALPHA_PRE_WATER:
+ poolp = mAlphaPoolPreWater;
+ break;
case LLDrawPool::POOL_ALPHA_POST_WATER:
poolp = mAlphaPoolPostWater;
break;
- case LLDrawPool::POOL_AVATAR:
- case LLDrawPool::POOL_CONTROL_AV:
- break; // Do nothing
+ case LLDrawPool::POOL_AVATAR:
+ case LLDrawPool::POOL_CONTROL_AV:
+ break; // Do nothing
- case LLDrawPool::POOL_SKY:
- poolp = mSkyPool;
- break;
+ case LLDrawPool::POOL_SKY:
+ poolp = mSkyPool;
+ break;
- case LLDrawPool::POOL_WATER:
- poolp = mWaterPool;
- break;
+ case LLDrawPool::POOL_WATER:
+ poolp = mWaterPool;
+ break;
- case LLDrawPool::POOL_WL_SKY:
- poolp = mWLSkyPool;
- break;
+ case LLDrawPool::POOL_WL_SKY:
+ poolp = mWLSkyPool;
+ break;
- case LLDrawPool::POOL_GLTF_PBR:
- poolp = mPBROpaquePool;
- break;
+ case LLDrawPool::POOL_GLTF_PBR:
+ poolp = mPBROpaquePool;
+ break;
case LLDrawPool::POOL_GLTF_PBR_ALPHA_MASK:
poolp = mPBRAlphaMaskPool;
break;
- default:
- llassert(0);
- LL_ERRS() << "Invalid Pool Type in LLPipeline::findPool() type=" << type << LL_ENDL;
- break;
- }
+ default:
+ llassert(0);
+ LL_ERRS() << "Invalid Pool Type in LLPipeline::findPool() type=" << type << LL_ENDL;
+ break;
+ }
- return poolp;
+ return poolp;
}
-LLDrawPool *LLPipeline::getPool(const U32 type, LLViewerTexture *tex0)
+LLDrawPool *LLPipeline::getPool(const U32 type, LLViewerTexture *tex0)
{
- LLDrawPool *poolp = findPool(type, tex0);
- if (poolp)
- {
- return poolp;
- }
+ LLDrawPool *poolp = findPool(type, tex0);
+ if (poolp)
+ {
+ return poolp;
+ }
- LLDrawPool *new_poolp = LLDrawPool::createPool(type, tex0);
- addPool( new_poolp );
+ LLDrawPool *new_poolp = LLDrawPool::createPool(type, tex0);
+ addPool( new_poolp );
- return new_poolp;
+ return new_poolp;
}
// static
LLDrawPool* LLPipeline::getPoolFromTE(const LLTextureEntry* te, LLViewerTexture* imagep)
{
- U32 type = getPoolTypeFromTE(te, imagep);
- return gPipeline.getPool(type, imagep);
+ U32 type = getPoolTypeFromTE(te, imagep);
+ return gPipeline.getPool(type, imagep);
}
-//static
+//static
U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* imagep)
{
- if (!te || !imagep)
- {
- return 0;
- }
-
- LLMaterial* mat = te->getMaterialParams().get();
+ if (!te || !imagep)
+ {
+ return 0;
+ }
+
+ LLMaterial* mat = te->getMaterialParams().get();
LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial();
- bool color_alpha = te->getColor().mV[3] < 0.999f;
- bool alpha = color_alpha;
- if (imagep)
- {
- alpha = alpha || (imagep->getComponents() == 4 && imagep->getType() != LLViewerTexture::MEDIA_TEXTURE) || (imagep->getComponents() == 2);
- }
-
- if (alpha && mat)
- {
- switch (mat->getDiffuseAlphaMode())
- {
- case 1:
- alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool.
- break;
- case 0: //alpha mode set to none, never go to alpha pool
- case 3: //alpha mode set to emissive, never go to alpha pool
- alpha = color_alpha;
- break;
- default: //alpha mode set to "mask", go to alpha pool if fullbright
- alpha = color_alpha; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool.
- break;
- }
- }
-
- if (alpha || (gltf_mat && gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND))
- {
- return LLDrawPool::POOL_ALPHA;
- }
- else if ((te->getBumpmap() || te->getShiny()) && (!mat || mat->getNormalID().isNull()))
- {
- return LLDrawPool::POOL_BUMP;
- }
+ bool color_alpha = te->getColor().mV[3] < 0.999f;
+ bool alpha = color_alpha;
+ if (imagep)
+ {
+ alpha = alpha || (imagep->getComponents() == 4 && imagep->getType() != LLViewerTexture::MEDIA_TEXTURE) || (imagep->getComponents() == 2);
+ }
+
+ if (alpha && mat)
+ {
+ switch (mat->getDiffuseAlphaMode())
+ {
+ case 1:
+ alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool.
+ break;
+ case 0: //alpha mode set to none, never go to alpha pool
+ case 3: //alpha mode set to emissive, never go to alpha pool
+ alpha = color_alpha;
+ break;
+ default: //alpha mode set to "mask", go to alpha pool if fullbright
+ alpha = color_alpha; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool.
+ break;
+ }
+ }
+
+ if (alpha || (gltf_mat && gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND))
+ {
+ return LLDrawPool::POOL_ALPHA;
+ }
+ else if ((te->getBumpmap() || te->getShiny()) && (!mat || mat->getNormalID().isNull()))
+ {
+ return LLDrawPool::POOL_BUMP;
+ }
else if (gltf_mat)
{
return LLDrawPool::POOL_GLTF_PBR;
}
- else if (mat && !alpha)
- {
- return LLDrawPool::POOL_MATERIALS;
- }
- else
- {
- return LLDrawPool::POOL_SIMPLE;
- }
+ else if (mat && !alpha)
+ {
+ return LLDrawPool::POOL_MATERIALS;
+ }
+ else
+ {
+ return LLDrawPool::POOL_SIMPLE;
+ }
}
void LLPipeline::addPool(LLDrawPool *new_poolp)
{
- assertInitialized();
- mPools.insert(new_poolp);
- addToQuickLookup( new_poolp );
+ assertInitialized();
+ mPools.insert(new_poolp);
+ addToQuickLookup( new_poolp );
}
void LLPipeline::allocDrawable(LLViewerObject *vobj)
{
- LLDrawable *drawable = new LLDrawable(vobj);
- vobj->mDrawable = drawable;
-
- //encompass completely sheared objects by taking
- //the most extreme point possible (<1,1,0.5>)
- drawable->setRadius(LLVector3(1,1,0.5f).scaleVec(vobj->getScale()).length());
- if (vobj->isOrphaned())
- {
- drawable->setState(LLDrawable::FORCE_INVISIBLE);
- }
- drawable->updateXform(TRUE);
+ LLDrawable *drawable = new LLDrawable(vobj);
+ vobj->mDrawable = drawable;
+
+ //encompass completely sheared objects by taking
+ //the most extreme point possible (<1,1,0.5>)
+ drawable->setRadius(LLVector3(1,1,0.5f).scaleVec(vobj->getScale()).length());
+ if (vobj->isOrphaned())
+ {
+ drawable->setState(LLDrawable::FORCE_INVISIBLE);
+ }
+ drawable->updateXform(TRUE);
}
@@ -1610,56 +1610,56 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- assertInitialized();
-
- LLPointer<LLDrawable> drawablep = drawable; // make sure this doesn't get deleted before we are done
-
- // Based on flags, remove the drawable from the queues that it's on.
- if (drawablep->isState(LLDrawable::ON_MOVE_LIST))
- {
- LLDrawable::drawable_vector_t::iterator iter = std::find(mMovedList.begin(), mMovedList.end(), drawablep);
- if (iter != mMovedList.end())
- {
- mMovedList.erase(iter);
- }
- }
-
- if (drawablep->getSpatialGroup())
- {
- if (!drawablep->getSpatialGroup()->getSpatialPartition()->remove(drawablep, drawablep->getSpatialGroup()))
- {
+ assertInitialized();
+
+ LLPointer<LLDrawable> drawablep = drawable; // make sure this doesn't get deleted before we are done
+
+ // Based on flags, remove the drawable from the queues that it's on.
+ if (drawablep->isState(LLDrawable::ON_MOVE_LIST))
+ {
+ LLDrawable::drawable_vector_t::iterator iter = std::find(mMovedList.begin(), mMovedList.end(), drawablep);
+ if (iter != mMovedList.end())
+ {
+ mMovedList.erase(iter);
+ }
+ }
+
+ if (drawablep->getSpatialGroup())
+ {
+ if (!drawablep->getSpatialGroup()->getSpatialPartition()->remove(drawablep, drawablep->getSpatialGroup()))
+ {
#ifdef LL_RELEASE_FOR_DOWNLOAD
- LL_WARNS() << "Couldn't remove object from spatial group!" << LL_ENDL;
+ LL_WARNS() << "Couldn't remove object from spatial group!" << LL_ENDL;
#else
- LL_ERRS() << "Couldn't remove object from spatial group!" << LL_ENDL;
+ LL_ERRS() << "Couldn't remove object from spatial group!" << LL_ENDL;
#endif
- }
- }
-
- mLights.erase(drawablep);
-
- for (light_set_t::iterator iter = mNearbyLights.begin();
- iter != mNearbyLights.end(); iter++)
- {
- if (iter->drawable == drawablep)
- {
- mNearbyLights.erase(iter);
- break;
- }
- }
-
- for (U32 i = 0; i < 2; ++i)
- {
- if (mShadowSpotLight[i] == drawablep)
- {
- mShadowSpotLight[i] = NULL;
- }
-
- if (mTargetShadowSpotLight[i] == drawablep)
- {
- mTargetShadowSpotLight[i] = NULL;
- }
- }
+ }
+ }
+
+ mLights.erase(drawablep);
+
+ for (light_set_t::iterator iter = mNearbyLights.begin();
+ iter != mNearbyLights.end(); iter++)
+ {
+ if (iter->drawable == drawablep)
+ {
+ mNearbyLights.erase(iter);
+ break;
+ }
+ }
+
+ for (U32 i = 0; i < 2; ++i)
+ {
+ if (mShadowSpotLight[i] == drawablep)
+ {
+ mShadowSpotLight[i] = NULL;
+ }
+
+ if (mTargetShadowSpotLight[i] == drawablep)
+ {
+ mTargetShadowSpotLight[i] = NULL;
+ }
+ }
}
//static
@@ -1687,239 +1687,239 @@ void LLPipeline::removeMutedAVsLights(LLVOAvatar* muted_avatar)
U32 LLPipeline::addObject(LLViewerObject *vobj)
{
- if (RenderDelayCreation)
- {
- mCreateQ.push_back(vobj);
- }
- else
- {
- createObject(vobj);
- }
+ if (RenderDelayCreation)
+ {
+ mCreateQ.push_back(vobj);
+ }
+ else
+ {
+ createObject(vobj);
+ }
- return 1;
+ return 1;
}
void LLPipeline::createObjects(F32 max_dtime)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- LLTimer update_timer;
+ LLTimer update_timer;
+
+ while (!mCreateQ.empty() && update_timer.getElapsedTimeF32() < max_dtime)
+ {
+ LLViewerObject* vobj = mCreateQ.front();
+ if (!vobj->isDead())
+ {
+ createObject(vobj);
+ }
+ mCreateQ.pop_front();
+ }
- while (!mCreateQ.empty() && update_timer.getElapsedTimeF32() < max_dtime)
- {
- LLViewerObject* vobj = mCreateQ.front();
- if (!vobj->isDead())
- {
- createObject(vobj);
- }
- mCreateQ.pop_front();
- }
-
- //for (LLViewerObject::vobj_list_t::iterator iter = mCreateQ.begin(); iter != mCreateQ.end(); ++iter)
- //{
- // createObject(*iter);
- //}
+ //for (LLViewerObject::vobj_list_t::iterator iter = mCreateQ.begin(); iter != mCreateQ.end(); ++iter)
+ //{
+ // createObject(*iter);
+ //}
- //mCreateQ.clear();
+ //mCreateQ.clear();
}
void LLPipeline::createObject(LLViewerObject* vobj)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- LLDrawable* drawablep = vobj->mDrawable;
-
- if (!drawablep)
- {
- drawablep = vobj->createDrawable(this);
- }
- else
- {
- LL_ERRS() << "Redundant drawable creation!" << LL_ENDL;
- }
-
- llassert(drawablep);
-
- if (vobj->getParent())
- {
- vobj->setDrawableParent(((LLViewerObject*)vobj->getParent())->mDrawable); // LLPipeline::addObject 1
- }
- else
- {
- vobj->setDrawableParent(NULL); // LLPipeline::addObject 2
- }
-
- markRebuild(drawablep, LLDrawable::REBUILD_ALL);
-
- if (drawablep->getVOVolume() && RenderAnimateRes)
- {
- // fun animated res
- drawablep->updateXform(TRUE);
- drawablep->clearState(LLDrawable::MOVE_UNDAMPED);
- drawablep->setScale(LLVector3(0,0,0));
- drawablep->makeActive();
- }
+ LLDrawable* drawablep = vobj->mDrawable;
+
+ if (!drawablep)
+ {
+ drawablep = vobj->createDrawable(this);
+ }
+ else
+ {
+ LL_ERRS() << "Redundant drawable creation!" << LL_ENDL;
+ }
+
+ llassert(drawablep);
+
+ if (vobj->getParent())
+ {
+ vobj->setDrawableParent(((LLViewerObject*)vobj->getParent())->mDrawable); // LLPipeline::addObject 1
+ }
+ else
+ {
+ vobj->setDrawableParent(NULL); // LLPipeline::addObject 2
+ }
+
+ markRebuild(drawablep, LLDrawable::REBUILD_ALL);
+
+ if (drawablep->getVOVolume() && RenderAnimateRes)
+ {
+ // fun animated res
+ drawablep->updateXform(TRUE);
+ drawablep->clearState(LLDrawable::MOVE_UNDAMPED);
+ drawablep->setScale(LLVector3(0,0,0));
+ drawablep->makeActive();
+ }
}
void LLPipeline::resetFrameStats()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- assertInitialized();
+ assertInitialized();
- sCompiles = 0;
- mNumVisibleFaces = 0;
+ sCompiles = 0;
+ mNumVisibleFaces = 0;
- if (mOldRenderDebugMask != mRenderDebugMask)
- {
- gObjectList.clearDebugText();
- mOldRenderDebugMask = mRenderDebugMask;
- }
+ if (mOldRenderDebugMask != mRenderDebugMask)
+ {
+ gObjectList.clearDebugText();
+ mOldRenderDebugMask = mRenderDebugMask;
+ }
}
//external functions for asynchronous updating
void LLPipeline::updateMoveDampedAsync(LLDrawable* drawablep)
{
LL_PROFILE_ZONE_SCOPED;
- if (FreezeTime)
- {
- return;
- }
- if (!drawablep)
- {
- LL_ERRS() << "updateMove called with NULL drawablep" << LL_ENDL;
- return;
- }
- if (drawablep->isState(LLDrawable::EARLY_MOVE))
- {
- return;
- }
-
- assertInitialized();
-
- // update drawable now
- drawablep->clearState(LLDrawable::MOVE_UNDAMPED); // force to DAMPED
- drawablep->updateMove(); // returns done
- drawablep->setState(LLDrawable::EARLY_MOVE); // flag says we already did an undamped move this frame
- // Put on move list so that EARLY_MOVE gets cleared
- if (!drawablep->isState(LLDrawable::ON_MOVE_LIST))
- {
- mMovedList.push_back(drawablep);
- drawablep->setState(LLDrawable::ON_MOVE_LIST);
- }
+ if (FreezeTime)
+ {
+ return;
+ }
+ if (!drawablep)
+ {
+ LL_ERRS() << "updateMove called with NULL drawablep" << LL_ENDL;
+ return;
+ }
+ if (drawablep->isState(LLDrawable::EARLY_MOVE))
+ {
+ return;
+ }
+
+ assertInitialized();
+
+ // update drawable now
+ drawablep->clearState(LLDrawable::MOVE_UNDAMPED); // force to DAMPED
+ drawablep->updateMove(); // returns done
+ drawablep->setState(LLDrawable::EARLY_MOVE); // flag says we already did an undamped move this frame
+ // Put on move list so that EARLY_MOVE gets cleared
+ if (!drawablep->isState(LLDrawable::ON_MOVE_LIST))
+ {
+ mMovedList.push_back(drawablep);
+ drawablep->setState(LLDrawable::ON_MOVE_LIST);
+ }
}
void LLPipeline::updateMoveNormalAsync(LLDrawable* drawablep)
{
LL_PROFILE_ZONE_SCOPED;
- if (FreezeTime)
- {
- return;
- }
- if (!drawablep)
- {
- LL_ERRS() << "updateMove called with NULL drawablep" << LL_ENDL;
- return;
- }
- if (drawablep->isState(LLDrawable::EARLY_MOVE))
- {
- return;
- }
-
- assertInitialized();
-
- // update drawable now
- drawablep->setState(LLDrawable::MOVE_UNDAMPED); // force to UNDAMPED
- drawablep->updateMove();
- drawablep->setState(LLDrawable::EARLY_MOVE); // flag says we already did an undamped move this frame
- // Put on move list so that EARLY_MOVE gets cleared
- if (!drawablep->isState(LLDrawable::ON_MOVE_LIST))
- {
- mMovedList.push_back(drawablep);
- drawablep->setState(LLDrawable::ON_MOVE_LIST);
- }
+ if (FreezeTime)
+ {
+ return;
+ }
+ if (!drawablep)
+ {
+ LL_ERRS() << "updateMove called with NULL drawablep" << LL_ENDL;
+ return;
+ }
+ if (drawablep->isState(LLDrawable::EARLY_MOVE))
+ {
+ return;
+ }
+
+ assertInitialized();
+
+ // update drawable now
+ drawablep->setState(LLDrawable::MOVE_UNDAMPED); // force to UNDAMPED
+ drawablep->updateMove();
+ drawablep->setState(LLDrawable::EARLY_MOVE); // flag says we already did an undamped move this frame
+ // Put on move list so that EARLY_MOVE gets cleared
+ if (!drawablep->isState(LLDrawable::ON_MOVE_LIST))
+ {
+ mMovedList.push_back(drawablep);
+ drawablep->setState(LLDrawable::ON_MOVE_LIST);
+ }
}
void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list)
{
LL_PROFILE_ZONE_SCOPED;
- for (LLDrawable::drawable_vector_t::iterator iter = moved_list.begin();
- iter != moved_list.end(); )
- {
- LLDrawable::drawable_vector_t::iterator curiter = iter++;
- LLDrawable *drawablep = *curiter;
- bool done = true;
- if (!drawablep->isDead() && (!drawablep->isState(LLDrawable::EARLY_MOVE)))
- {
- done = drawablep->updateMove();
- }
- drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED);
- if (done)
- {
- if (drawablep->isRoot() && !drawablep->isState(LLDrawable::ACTIVE))
- {
- drawablep->makeStatic();
- }
- drawablep->clearState(LLDrawable::ON_MOVE_LIST);
- if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
- { //will likely not receive any future world matrix updates
- // -- this keeps attachments from getting stuck in space and falling off your avatar
- drawablep->clearState(LLDrawable::ANIMATED_CHILD);
- markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
- if (drawablep->getVObj())
- {
- drawablep->getVObj()->dirtySpatialGroup();
- }
- }
- iter = moved_list.erase(curiter);
- }
- }
+ for (LLDrawable::drawable_vector_t::iterator iter = moved_list.begin();
+ iter != moved_list.end(); )
+ {
+ LLDrawable::drawable_vector_t::iterator curiter = iter++;
+ LLDrawable *drawablep = *curiter;
+ bool done = true;
+ if (!drawablep->isDead() && (!drawablep->isState(LLDrawable::EARLY_MOVE)))
+ {
+ done = drawablep->updateMove();
+ }
+ drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED);
+ if (done)
+ {
+ if (drawablep->isRoot() && !drawablep->isState(LLDrawable::ACTIVE))
+ {
+ drawablep->makeStatic();
+ }
+ drawablep->clearState(LLDrawable::ON_MOVE_LIST);
+ if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
+ { //will likely not receive any future world matrix updates
+ // -- this keeps attachments from getting stuck in space and falling off your avatar
+ drawablep->clearState(LLDrawable::ANIMATED_CHILD);
+ markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
+ if (drawablep->getVObj())
+ {
+ drawablep->getVObj()->dirtySpatialGroup();
+ }
+ }
+ iter = moved_list.erase(curiter);
+ }
+ }
}
void LLPipeline::updateMove()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- if (FreezeTime)
- {
- return;
- }
-
- assertInitialized();
-
- for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin();
- iter != mRetexturedList.end(); ++iter)
- {
- LLDrawable* drawablep = *iter;
- if (drawablep && !drawablep->isDead())
- {
- drawablep->updateTexture();
- }
- }
- mRetexturedList.clear();
-
- updateMovedList(mMovedList);
-
- //balance octrees
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- part->mOctree->balance();
- }
- }
-
- //balance the VO Cache tree
- LLVOCachePartition* vo_part = region->getVOCachePartition();
- if(vo_part)
- {
- vo_part->mOctree->balance();
- }
- }
+ if (FreezeTime)
+ {
+ return;
+ }
+
+ assertInitialized();
+
+ for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin();
+ iter != mRetexturedList.end(); ++iter)
+ {
+ LLDrawable* drawablep = *iter;
+ if (drawablep && !drawablep->isDead())
+ {
+ drawablep->updateTexture();
+ }
+ }
+ mRetexturedList.clear();
+
+ updateMovedList(mMovedList);
+
+ //balance octrees
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
+ {
+ part->mOctree->balance();
+ }
+ }
+
+ //balance the VO Cache tree
+ LLVOCachePartition* vo_part = region->getVOCachePartition();
+ if(vo_part)
+ {
+ vo_part->mOctree->balance();
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////////
@@ -1930,299 +1930,299 @@ void LLPipeline::updateMove()
F32 LLPipeline::calcPixelArea(LLVector3 center, LLVector3 size, LLCamera &camera)
{
llassert(!gCubeSnapshot); // shouldn't be doing ANY of this during cube snap shots
- LLVector3 lookAt = center - camera.getOrigin();
- F32 dist = lookAt.length();
+ LLVector3 lookAt = center - camera.getOrigin();
+ F32 dist = lookAt.length();
- //ramp down distance for nearby objects
- //shrink dist by dist/16.
- if (dist < 16.f)
- {
- dist /= 16.f;
- dist *= dist;
- dist *= 16.f;
- }
+ //ramp down distance for nearby objects
+ //shrink dist by dist/16.
+ if (dist < 16.f)
+ {
+ dist /= 16.f;
+ dist *= dist;
+ dist *= 16.f;
+ }
- //get area of circle around node
- F32 app_angle = atanf(size.length()/dist);
- F32 radius = app_angle*LLDrawable::sCurPixelAngle;
- return radius*radius * F_PI;
+ //get area of circle around node
+ F32 app_angle = atanf(size.length()/dist);
+ F32 radius = app_angle*LLDrawable::sCurPixelAngle;
+ return radius*radius * F_PI;
}
//static
F32 LLPipeline::calcPixelArea(const LLVector4a& center, const LLVector4a& size, LLCamera &camera)
{
- LLVector4a origin;
- origin.load3(camera.getOrigin().mV);
+ LLVector4a origin;
+ origin.load3(camera.getOrigin().mV);
- LLVector4a lookAt;
- lookAt.setSub(center, origin);
- F32 dist = lookAt.getLength3().getF32();
+ LLVector4a lookAt;
+ lookAt.setSub(center, origin);
+ F32 dist = lookAt.getLength3().getF32();
- //ramp down distance for nearby objects
- //shrink dist by dist/16.
- if (dist < 16.f)
- {
- dist /= 16.f;
- dist *= dist;
- dist *= 16.f;
- }
+ //ramp down distance for nearby objects
+ //shrink dist by dist/16.
+ if (dist < 16.f)
+ {
+ dist /= 16.f;
+ dist *= dist;
+ dist *= 16.f;
+ }
- //get area of circle around node
- F32 app_angle = atanf(size.getLength3().getF32()/dist);
- F32 radius = app_angle*LLDrawable::sCurPixelAngle;
- return radius*radius * F_PI;
+ //get area of circle around node
+ F32 app_angle = atanf(size.getLength3().getF32()/dist);
+ F32 radius = app_angle*LLDrawable::sCurPixelAngle;
+ return radius*radius * F_PI;
}
void LLPipeline::grabReferences(LLCullResult& result)
{
- sCull = &result;
+ sCull = &result;
}
void LLPipeline::clearReferences()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- sCull = NULL;
- mGroupSaveQ1.clear();
+ sCull = NULL;
+ mGroupSaveQ1.clear();
}
void check_references(LLSpatialGroup* group, LLDrawable* drawable)
{
- for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
- {
+ for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+ {
LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
- if (drawable == drawablep)
- {
- LL_ERRS() << "LLDrawable deleted while actively reference by LLPipeline." << LL_ENDL;
- }
- }
+ if (drawable == drawablep)
+ {
+ LL_ERRS() << "LLDrawable deleted while actively reference by LLPipeline." << LL_ENDL;
+ }
+ }
}
void check_references(LLDrawable* drawable, LLFace* face)
{
- for (S32 i = 0; i < drawable->getNumFaces(); ++i)
- {
- if (drawable->getFace(i) == face)
- {
- LL_ERRS() << "LLFace deleted while actively referenced by LLPipeline." << LL_ENDL;
- }
- }
+ for (S32 i = 0; i < drawable->getNumFaces(); ++i)
+ {
+ if (drawable->getFace(i) == face)
+ {
+ LL_ERRS() << "LLFace deleted while actively referenced by LLPipeline." << LL_ENDL;
+ }
+ }
}
void check_references(LLSpatialGroup* group, LLFace* face)
{
- for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
- {
- LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
- if(drawable)
- {
- check_references(drawable, face);
- }
+ for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+ {
+ LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
+ if(drawable)
+ {
+ check_references(drawable, face);
+ }
}
}
void LLPipeline::checkReferences(LLFace* face)
{
#if 0
- if (sCull)
- {
- for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- check_references(group, face);
- }
-
- for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- check_references(group, face);
- }
-
- for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- check_references(group, face);
- }
-
- for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)
- {
- LLDrawable* drawable = *iter;
- check_references(drawable, face);
- }
- }
+ if (sCull)
+ {
+ for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ check_references(group, face);
+ }
+
+ for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ check_references(group, face);
+ }
+
+ for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ check_references(group, face);
+ }
+
+ for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)
+ {
+ LLDrawable* drawable = *iter;
+ check_references(drawable, face);
+ }
+ }
#endif
}
void LLPipeline::checkReferences(LLDrawable* drawable)
{
#if 0
- if (sCull)
- {
- for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- check_references(group, drawable);
- }
-
- for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- check_references(group, drawable);
- }
-
- for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- check_references(group, drawable);
- }
-
- for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)
- {
- if (drawable == *iter)
- {
- LL_ERRS() << "LLDrawable deleted while actively referenced by LLPipeline." << LL_ENDL;
- }
- }
- }
+ if (sCull)
+ {
+ for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ check_references(group, drawable);
+ }
+
+ for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ check_references(group, drawable);
+ }
+
+ for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ check_references(group, drawable);
+ }
+
+ for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)
+ {
+ if (drawable == *iter)
+ {
+ LL_ERRS() << "LLDrawable deleted while actively referenced by LLPipeline." << LL_ENDL;
+ }
+ }
+ }
#endif
}
void check_references(LLSpatialGroup* group, LLDrawInfo* draw_info)
{
- for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
- {
- LLSpatialGroup::drawmap_elem_t& draw_vec = i->second;
- for (LLSpatialGroup::drawmap_elem_t::iterator j = draw_vec.begin(); j != draw_vec.end(); ++j)
- {
- LLDrawInfo* params = *j;
- if (params == draw_info)
- {
- LL_ERRS() << "LLDrawInfo deleted while actively referenced by LLPipeline." << LL_ENDL;
- }
- }
- }
+ for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
+ {
+ LLSpatialGroup::drawmap_elem_t& draw_vec = i->second;
+ for (LLSpatialGroup::drawmap_elem_t::iterator j = draw_vec.begin(); j != draw_vec.end(); ++j)
+ {
+ LLDrawInfo* params = *j;
+ if (params == draw_info)
+ {
+ LL_ERRS() << "LLDrawInfo deleted while actively referenced by LLPipeline." << LL_ENDL;
+ }
+ }
+ }
}
void LLPipeline::checkReferences(LLDrawInfo* draw_info)
{
#if 0
- if (sCull)
- {
- for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- check_references(group, draw_info);
- }
-
- for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- check_references(group, draw_info);
- }
-
- for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- check_references(group, draw_info);
- }
- }
+ if (sCull)
+ {
+ for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ check_references(group, draw_info);
+ }
+
+ for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ check_references(group, draw_info);
+ }
+
+ for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ check_references(group, draw_info);
+ }
+ }
#endif
}
void LLPipeline::checkReferences(LLSpatialGroup* group)
{
#if CHECK_PIPELINE_REFERENCES
- if (sCull)
- {
- for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
- {
- if (group == *iter)
- {
- LL_ERRS() << "LLSpatialGroup deleted while actively referenced by LLPipeline." << LL_ENDL;
- }
- }
-
- for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
- {
- if (group == *iter)
- {
- LL_ERRS() << "LLSpatialGroup deleted while actively referenced by LLPipeline." << LL_ENDL;
- }
- }
-
- for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
- {
- if (group == *iter)
- {
- LL_ERRS() << "LLSpatialGroup deleted while actively referenced by LLPipeline." << LL_ENDL;
- }
- }
- }
+ if (sCull)
+ {
+ for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+ {
+ if (group == *iter)
+ {
+ LL_ERRS() << "LLSpatialGroup deleted while actively referenced by LLPipeline." << LL_ENDL;
+ }
+ }
+
+ for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
+ {
+ if (group == *iter)
+ {
+ LL_ERRS() << "LLSpatialGroup deleted while actively referenced by LLPipeline." << LL_ENDL;
+ }
+ }
+
+ for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+ {
+ if (group == *iter)
+ {
+ LL_ERRS() << "LLSpatialGroup deleted while actively referenced by LLPipeline." << LL_ENDL;
+ }
+ }
+ }
#endif
}
bool LLPipeline::visibleObjectsInFrustum(LLCamera& camera)
{
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
-
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- if (hasRenderType(part->mDrawableType))
- {
- if (part->visibleObjectsInFrustum(camera))
- {
- return true;
- }
- }
- }
- }
- }
-
- return false;
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
+ {
+ if (hasRenderType(part->mDrawableType))
+ {
+ if (part->visibleObjectsInFrustum(camera))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return false;
}
bool LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& max)
{
- const F32 X = 65536.f;
+ const F32 X = 65536.f;
- min = LLVector3(X,X,X);
- max = LLVector3(-X,-X,-X);
+ min = LLVector3(X,X,X);
+ max = LLVector3(-X,-X,-X);
- LLViewerCamera::eCameraID saved_camera_id = LLViewerCamera::sCurCameraID;
- LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+ LLViewerCamera::eCameraID saved_camera_id = LLViewerCamera::sCurCameraID;
+ LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
- bool res = true;
+ bool res = true;
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- if (hasRenderType(part->mDrawableType))
- {
- if (!part->getVisibleExtents(camera, min, max))
- {
- res = false;
- }
- }
- }
- }
- }
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
+ {
+ if (hasRenderType(part->mDrawableType))
+ {
+ if (!part->getVisibleExtents(camera, min, max))
+ {
+ res = false;
+ }
+ }
+ }
+ }
+ }
- LLViewerCamera::sCurCameraID = saved_camera_id;
- return res;
+ LLViewerCamera::sCurCameraID = saved_camera_id;
+ return res;
}
static LLTrace::BlockTimerStatHandle FTM_CULL("Object Culling");
@@ -2230,7 +2230,7 @@ static LLTrace::BlockTimerStatHandle FTM_CULL("Object Culling");
// static
bool LLPipeline::isWaterClip()
{
- return (!sRenderTransparentWater || gCubeSnapshot) && !sRenderingHUDs;
+ return (!sRenderTransparentWater || gCubeSnapshot) && !sRenderingHUDs;
}
void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result)
@@ -2238,11 +2238,11 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result)
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_CULL);
LL_PROFILE_GPU_ZONE("updateCull"); // should always be zero GPU time, but drop a timer to flush stuff out
- bool water_clip = isWaterClip();
+ bool water_clip = isWaterClip();
if (water_clip)
{
-
+
LLVector3 pnorm;
F32 water_height = LLEnvironment::instance().getWaterHeight();
@@ -2257,7 +2257,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result)
//camera is above water, cull below water
pnorm = LLVector3(0, 0, -1);
}
-
+
LLPlane plane;
plane.setVec(LLVector3(0, 0, water_height), pnorm);
@@ -2268,48 +2268,48 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result)
camera.disableUserClipPlane();
}
- grabReferences(result);
-
- sCull->clear();
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
-
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- if (hasRenderType(part->mDrawableType))
- {
- part->cull(camera);
- }
- }
- }
-
- //scan the VO Cache tree
- LLVOCachePartition* vo_part = region->getVOCachePartition();
- if(vo_part)
- {
- vo_part->cull(camera, sUseOcclusion > 0);
- }
- }
-
- if (hasRenderType(LLPipeline::RENDER_TYPE_SKY) &&
- gSky.mVOSkyp.notNull() &&
- gSky.mVOSkyp->mDrawable.notNull())
- {
- gSky.mVOSkyp->mDrawable->setVisible(camera);
- sCull->pushDrawable(gSky.mVOSkyp->mDrawable);
- gSky.updateCull();
- stop_glerror();
- }
-
- if (hasRenderType(LLPipeline::RENDER_TYPE_WL_SKY) &&
+ grabReferences(result);
+
+ sCull->clear();
+
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
+ {
+ if (hasRenderType(part->mDrawableType))
+ {
+ part->cull(camera);
+ }
+ }
+ }
+
+ //scan the VO Cache tree
+ LLVOCachePartition* vo_part = region->getVOCachePartition();
+ if(vo_part)
+ {
+ vo_part->cull(camera, sUseOcclusion > 0);
+ }
+ }
+
+ if (hasRenderType(LLPipeline::RENDER_TYPE_SKY) &&
+ gSky.mVOSkyp.notNull() &&
+ gSky.mVOSkyp->mDrawable.notNull())
+ {
+ gSky.mVOSkyp->mDrawable->setVisible(camera);
+ sCull->pushDrawable(gSky.mVOSkyp->mDrawable);
+ gSky.updateCull();
+ stop_glerror();
+ }
+
+ if (hasRenderType(LLPipeline::RENDER_TYPE_WL_SKY) &&
gPipeline.canUseWindLightShaders() &&
- gSky.mVOWLSkyp.notNull() &&
+ gSky.mVOWLSkyp.notNull() &&
gSky.mVOWLSkyp->mDrawable.notNull())
{
gSky.mVOWLSkyp->mDrawable->setVisible(camera);
@@ -2319,28 +2319,28 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result)
void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera)
{
- if (group->isEmpty())
- {
- return;
- }
-
- group->setVisible();
-
- if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
- {
- group->updateDistance(camera);
- }
-
- assertInitialized();
-
- if (!group->getSpatialPartition()->mRenderByGroup)
- { //render by drawable
- sCull->pushDrawableGroup(group);
- }
- else
- { //render by group
- sCull->pushVisibleGroup(group);
- }
+ if (group->isEmpty())
+ {
+ return;
+ }
+
+ group->setVisible();
+
+ if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
+ {
+ group->updateDistance(camera);
+ }
+
+ assertInitialized();
+
+ if (!group->getSpatialPartition()->mRenderByGroup)
+ { //render by drawable
+ sCull->pushDrawableGroup(group);
+ }
+ else
+ { //render by group
+ sCull->pushVisibleGroup(group);
+ }
if (group->needsUpdate() ||
group->getVisible(LLViewerCamera::sCurCameraID) < LLDrawable::getCurrentFrame() - 1)
@@ -2349,30 +2349,30 @@ void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera)
// an occlusion query to find out if it's an occluder
markOccluder(group);
}
- mNumVisibleNodes++;
+ mNumVisibleNodes++;
}
void LLPipeline::markOccluder(LLSpatialGroup* group)
{
- if (sUseOcclusion > 1 && group && !group->isOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION))
- {
- LLSpatialGroup* parent = group->getParent();
-
- if (!parent || !parent->isOcclusionState(LLSpatialGroup::OCCLUDED))
- { //only mark top most occluders as active occlusion
- sCull->pushOcclusionGroup(group);
- group->setOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION);
-
- if (parent &&
- !parent->isOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION) &&
- parent->getElementCount() == 0 &&
- parent->needsUpdate())
- {
- sCull->pushOcclusionGroup(group);
- parent->setOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION);
- }
- }
- }
+ if (sUseOcclusion > 1 && group && !group->isOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION))
+ {
+ LLSpatialGroup* parent = group->getParent();
+
+ if (!parent || !parent->isOcclusionState(LLSpatialGroup::OCCLUDED))
+ { //only mark top most occluders as active occlusion
+ sCull->pushOcclusionGroup(group);
+ group->setOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION);
+
+ if (parent &&
+ !parent->isOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION) &&
+ parent->getElementCount() == 0 &&
+ parent->needsUpdate())
+ {
+ sCull->pushOcclusionGroup(group);
+ parent->setOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION);
+ }
+ }
+ }
}
void LLPipeline::doOcclusion(LLCamera& camera)
@@ -2402,138 +2402,138 @@ void LLPipeline::doOcclusion(LLCamera& camera)
}
if (LLPipeline::sUseOcclusion > 1 &&
- (sCull->hasOcclusionGroups() || LLVOCachePartition::sNeedsOcclusionCheck))
- {
- LLVertexBuffer::unbind();
+ (sCull->hasOcclusionGroups() || LLVOCachePartition::sNeedsOcclusionCheck))
+ {
+ LLVertexBuffer::unbind();
- gGL.setColorMask(false, false);
+ gGL.setColorMask(false, false);
- LLGLDisable blend(GL_BLEND);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest depth(GL_TRUE, GL_FALSE);
+ LLGLDisable blend(GL_BLEND);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE);
- LLGLDisable cull(GL_CULL_FACE);
+ LLGLDisable cull(GL_CULL_FACE);
gOcclusionCubeProgram.bind();
- if (mCubeVB.isNull())
- { //cube VB will be used for issuing occlusion queries
- mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX);
- }
- mCubeVB->setBuffer();
+ if (mCubeVB.isNull())
+ { //cube VB will be used for issuing occlusion queries
+ mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX);
+ }
+ mCubeVB->setBuffer();
- for (LLCullResult::sg_iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
+ for (LLCullResult::sg_iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
if (!group->isDead())
{
group->doOcclusion(&camera);
group->clearOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION);
}
- }
-
- //apply occlusion culling to object cache tree
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLVOCachePartition* vo_part = (*iter)->getVOCachePartition();
- if(vo_part)
- {
- vo_part->processOccluders(&camera);
- }
- }
-
- gGL.setColorMask(true, true);
- }
-}
-
+ }
+
+ //apply occlusion culling to object cache tree
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLVOCachePartition* vo_part = (*iter)->getVOCachePartition();
+ if(vo_part)
+ {
+ vo_part->processOccluders(&camera);
+ }
+ }
+
+ gGL.setColorMask(true, true);
+ }
+}
+
bool LLPipeline::updateDrawableGeom(LLDrawable* drawablep)
{
- bool update_complete = drawablep->updateGeometry();
- if (update_complete && assertInitialized())
- {
- drawablep->setState(LLDrawable::BUILT);
- }
- return update_complete;
+ bool update_complete = drawablep->updateGeometry();
+ if (update_complete && assertInitialized())
+ {
+ drawablep->setState(LLDrawable::BUILT);
+ }
+ return update_complete;
}
void LLPipeline::updateGL()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- {
- while (!LLGLUpdate::sGLQ.empty())
- {
- LLGLUpdate* glu = LLGLUpdate::sGLQ.front();
- glu->updateGL();
- glu->mInQ = FALSE;
- LLGLUpdate::sGLQ.pop_front();
- }
- }
+ {
+ while (!LLGLUpdate::sGLQ.empty())
+ {
+ LLGLUpdate* glu = LLGLUpdate::sGLQ.front();
+ glu->updateGL();
+ glu->mInQ = FALSE;
+ LLGLUpdate::sGLQ.pop_front();
+ }
+ }
}
void LLPipeline::clearRebuildGroups()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- LLSpatialGroup::sg_vector_t hudGroups;
-
- mGroupQ1Locked = true;
- // Iterate through all drawables on the priority build queue,
- for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin();
- iter != mGroupQ1.end(); ++iter)
- {
- LLSpatialGroup* group = *iter;
-
- // If the group contains HUD objects, save the group
- if (group->isHUDGroup())
- {
- hudGroups.push_back(group);
- }
- // Else, no HUD objects so clear the build state
- else
- {
- group->clearState(LLSpatialGroup::IN_BUILD_Q1);
- }
- }
-
- // Clear the group
- mGroupQ1.clear();
-
- // Copy the saved HUD groups back in
- mGroupQ1.assign(hudGroups.begin(), hudGroups.end());
- mGroupQ1Locked = false;
+ LLSpatialGroup::sg_vector_t hudGroups;
+
+ mGroupQ1Locked = true;
+ // Iterate through all drawables on the priority build queue,
+ for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin();
+ iter != mGroupQ1.end(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+
+ // If the group contains HUD objects, save the group
+ if (group->isHUDGroup())
+ {
+ hudGroups.push_back(group);
+ }
+ // Else, no HUD objects so clear the build state
+ else
+ {
+ group->clearState(LLSpatialGroup::IN_BUILD_Q1);
+ }
+ }
+
+ // Clear the group
+ mGroupQ1.clear();
+
+ // Copy the saved HUD groups back in
+ mGroupQ1.assign(hudGroups.begin(), hudGroups.end());
+ mGroupQ1Locked = false;
}
void LLPipeline::clearRebuildDrawables()
{
- // Clear all drawables on the priority build queue,
- for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin();
- iter != mBuildQ1.end(); ++iter)
- {
- LLDrawable* drawablep = *iter;
- if (drawablep && !drawablep->isDead())
- {
- drawablep->clearState(LLDrawable::IN_REBUILD_Q);
- }
- }
- mBuildQ1.clear();
-
- //clear all moving bridges
- for (LLDrawable::drawable_vector_t::iterator iter = mMovedBridge.begin();
- iter != mMovedBridge.end(); ++iter)
- {
- LLDrawable *drawablep = *iter;
- drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD);
- }
- mMovedBridge.clear();
-
- //clear all moving drawables
- for (LLDrawable::drawable_vector_t::iterator iter = mMovedList.begin();
- iter != mMovedList.end(); ++iter)
- {
- LLDrawable *drawablep = *iter;
- drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD);
- }
- mMovedList.clear();
+ // Clear all drawables on the priority build queue,
+ for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin();
+ iter != mBuildQ1.end(); ++iter)
+ {
+ LLDrawable* drawablep = *iter;
+ if (drawablep && !drawablep->isDead())
+ {
+ drawablep->clearState(LLDrawable::IN_REBUILD_Q);
+ }
+ }
+ mBuildQ1.clear();
+
+ //clear all moving bridges
+ for (LLDrawable::drawable_vector_t::iterator iter = mMovedBridge.begin();
+ iter != mMovedBridge.end(); ++iter)
+ {
+ LLDrawable *drawablep = *iter;
+ drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD);
+ }
+ mMovedBridge.clear();
+
+ //clear all moving drawables
+ for (LLDrawable::drawable_vector_t::iterator iter = mMovedList.begin();
+ iter != mMovedList.end(); ++iter)
+ {
+ LLDrawable *drawablep = *iter;
+ drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD);
+ }
+ mMovedList.clear();
for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin();
iter != mShiftList.end(); ++iter)
@@ -2549,305 +2549,305 @@ void LLPipeline::rebuildPriorityGroups()
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LL_PROFILE_GPU_ZONE("rebuildPriorityGroups");
- LLTimer update_timer;
- assertInitialized();
+ LLTimer update_timer;
+ assertInitialized();
- gMeshRepo.notifyLoadedMeshes();
+ gMeshRepo.notifyLoadedMeshes();
- mGroupQ1Locked = true;
- // Iterate through all drawables on the priority build queue,
- for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin();
- iter != mGroupQ1.end(); ++iter)
- {
- LLSpatialGroup* group = *iter;
- group->rebuildGeom();
- group->clearState(LLSpatialGroup::IN_BUILD_Q1);
- }
+ mGroupQ1Locked = true;
+ // Iterate through all drawables on the priority build queue,
+ for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin();
+ iter != mGroupQ1.end(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+ group->rebuildGeom();
+ group->clearState(LLSpatialGroup::IN_BUILD_Q1);
+ }
- mGroupSaveQ1 = mGroupQ1;
- mGroupQ1.clear();
- mGroupQ1Locked = false;
+ mGroupSaveQ1 = mGroupQ1;
+ mGroupQ1.clear();
+ mGroupQ1Locked = false;
}
void LLPipeline::updateGeom(F32 max_dtime)
{
- LLTimer update_timer;
- LLPointer<LLDrawable> drawablep;
+ LLTimer update_timer;
+ LLPointer<LLDrawable> drawablep;
- LL_RECORD_BLOCK_TIME(FTM_GEO_UPDATE);
+ LL_RECORD_BLOCK_TIME(FTM_GEO_UPDATE);
if (gCubeSnapshot)
{
return;
}
- assertInitialized();
-
- // notify various object types to reset internal cost metrics, etc.
- // for now, only LLVOVolume does this to throttle LOD changes
- LLVOVolume::preUpdateGeom();
-
- // Iterate through all drawables on the priority build queue,
- for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin();
- iter != mBuildQ1.end();)
- {
- LLDrawable::drawable_list_t::iterator curiter = iter++;
- LLDrawable* drawablep = *curiter;
- if (drawablep && !drawablep->isDead())
- {
- if (drawablep->isUnload())
- {
- drawablep->unload();
- drawablep->clearState(LLDrawable::FOR_UNLOAD);
- }
-
- if (updateDrawableGeom(drawablep))
- {
- drawablep->clearState(LLDrawable::IN_REBUILD_Q);
- mBuildQ1.erase(curiter);
- }
- }
- else
- {
- mBuildQ1.erase(curiter);
- }
- }
-
- updateMovedList(mMovedBridge);
+ assertInitialized();
+
+ // notify various object types to reset internal cost metrics, etc.
+ // for now, only LLVOVolume does this to throttle LOD changes
+ LLVOVolume::preUpdateGeom();
+
+ // Iterate through all drawables on the priority build queue,
+ for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin();
+ iter != mBuildQ1.end();)
+ {
+ LLDrawable::drawable_list_t::iterator curiter = iter++;
+ LLDrawable* drawablep = *curiter;
+ if (drawablep && !drawablep->isDead())
+ {
+ if (drawablep->isUnload())
+ {
+ drawablep->unload();
+ drawablep->clearState(LLDrawable::FOR_UNLOAD);
+ }
+
+ if (updateDrawableGeom(drawablep))
+ {
+ drawablep->clearState(LLDrawable::IN_REBUILD_Q);
+ mBuildQ1.erase(curiter);
+ }
+ }
+ else
+ {
+ mBuildQ1.erase(curiter);
+ }
+ }
+
+ updateMovedList(mMovedBridge);
}
void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)
{
- if(drawablep && !drawablep->isDead())
- {
- if (drawablep->isSpatialBridge())
- {
- const LLDrawable* root = ((LLSpatialBridge*) drawablep)->mDrawable;
- llassert(root); // trying to catch a bad assumption
-
- if (root && // // this test may not be needed, see above
- root->getVObj()->isAttachment())
- {
- LLDrawable* rootparent = root->getParent();
- if (rootparent) // this IS sometimes NULL
- {
- LLViewerObject *vobj = rootparent->getVObj();
- llassert(vobj); // trying to catch a bad assumption
- if (vobj) // this test may not be needed, see above
- {
- LLVOAvatar* av = vobj->asAvatar();
- if (av &&
- ((!sImpostorRender && av->isImpostor()) //ignore impostor flag during impostor pass
- || av->isInMuteList()
- || (LLVOAvatar::AOA_JELLYDOLL == av->getOverallAppearance() && !av->needsImpostorUpdate()) ))
- {
- return;
- }
- }
- }
- }
- sCull->pushBridge((LLSpatialBridge*) drawablep);
- }
- else
- {
-
- sCull->pushDrawable(drawablep);
- }
-
- drawablep->setVisible(camera);
- }
+ if(drawablep && !drawablep->isDead())
+ {
+ if (drawablep->isSpatialBridge())
+ {
+ const LLDrawable* root = ((LLSpatialBridge*) drawablep)->mDrawable;
+ llassert(root); // trying to catch a bad assumption
+
+ if (root && // // this test may not be needed, see above
+ root->getVObj()->isAttachment())
+ {
+ LLDrawable* rootparent = root->getParent();
+ if (rootparent) // this IS sometimes NULL
+ {
+ LLViewerObject *vobj = rootparent->getVObj();
+ llassert(vobj); // trying to catch a bad assumption
+ if (vobj) // this test may not be needed, see above
+ {
+ LLVOAvatar* av = vobj->asAvatar();
+ if (av &&
+ ((!sImpostorRender && av->isImpostor()) //ignore impostor flag during impostor pass
+ || av->isInMuteList()
+ || (LLVOAvatar::AOA_JELLYDOLL == av->getOverallAppearance() && !av->needsImpostorUpdate()) ))
+ {
+ return;
+ }
+ }
+ }
+ }
+ sCull->pushBridge((LLSpatialBridge*) drawablep);
+ }
+ else
+ {
+
+ sCull->pushDrawable(drawablep);
+ }
+
+ drawablep->setVisible(camera);
+ }
}
void LLPipeline::markMoved(LLDrawable *drawablep, bool damped_motion)
{
- if (!drawablep)
- {
- //LL_ERRS() << "Sending null drawable to moved list!" << LL_ENDL;
- return;
- }
-
- if (drawablep->isDead())
- {
- LL_WARNS() << "Marking NULL or dead drawable moved!" << LL_ENDL;
- return;
- }
-
- if (drawablep->getParent())
- {
- //ensure that parent drawables are moved first
- markMoved(drawablep->getParent(), damped_motion);
- }
-
- assertInitialized();
-
- if (!drawablep->isState(LLDrawable::ON_MOVE_LIST))
- {
- if (drawablep->isSpatialBridge())
- {
- mMovedBridge.push_back(drawablep);
- }
- else
- {
- mMovedList.push_back(drawablep);
- }
- drawablep->setState(LLDrawable::ON_MOVE_LIST);
- }
- if (! damped_motion)
- {
- drawablep->setState(LLDrawable::MOVE_UNDAMPED); // UNDAMPED trumps DAMPED
- }
- else if (drawablep->isState(LLDrawable::MOVE_UNDAMPED))
- {
- drawablep->clearState(LLDrawable::MOVE_UNDAMPED);
- }
+ if (!drawablep)
+ {
+ //LL_ERRS() << "Sending null drawable to moved list!" << LL_ENDL;
+ return;
+ }
+
+ if (drawablep->isDead())
+ {
+ LL_WARNS() << "Marking NULL or dead drawable moved!" << LL_ENDL;
+ return;
+ }
+
+ if (drawablep->getParent())
+ {
+ //ensure that parent drawables are moved first
+ markMoved(drawablep->getParent(), damped_motion);
+ }
+
+ assertInitialized();
+
+ if (!drawablep->isState(LLDrawable::ON_MOVE_LIST))
+ {
+ if (drawablep->isSpatialBridge())
+ {
+ mMovedBridge.push_back(drawablep);
+ }
+ else
+ {
+ mMovedList.push_back(drawablep);
+ }
+ drawablep->setState(LLDrawable::ON_MOVE_LIST);
+ }
+ if (! damped_motion)
+ {
+ drawablep->setState(LLDrawable::MOVE_UNDAMPED); // UNDAMPED trumps DAMPED
+ }
+ else if (drawablep->isState(LLDrawable::MOVE_UNDAMPED))
+ {
+ drawablep->clearState(LLDrawable::MOVE_UNDAMPED);
+ }
}
void LLPipeline::markShift(LLDrawable *drawablep)
{
- if (!drawablep || drawablep->isDead())
- {
- return;
- }
+ if (!drawablep || drawablep->isDead())
+ {
+ return;
+ }
- assertInitialized();
+ assertInitialized();
- if (!drawablep->isState(LLDrawable::ON_SHIFT_LIST))
- {
- drawablep->getVObj()->setChanged(LLXform::SHIFTED | LLXform::SILHOUETTE);
- if (drawablep->getParent())
- {
- markShift(drawablep->getParent());
- }
- mShiftList.push_back(drawablep);
- drawablep->setState(LLDrawable::ON_SHIFT_LIST);
- }
+ if (!drawablep->isState(LLDrawable::ON_SHIFT_LIST))
+ {
+ drawablep->getVObj()->setChanged(LLXform::SHIFTED | LLXform::SILHOUETTE);
+ if (drawablep->getParent())
+ {
+ markShift(drawablep->getParent());
+ }
+ mShiftList.push_back(drawablep);
+ drawablep->setState(LLDrawable::ON_SHIFT_LIST);
+ }
}
void LLPipeline::shiftObjects(const LLVector3 &offset)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- assertInitialized();
-
- glClear(GL_DEPTH_BUFFER_BIT);
- gDepthDirty = true;
-
- LLVector4a offseta;
- offseta.load3(offset.mV);
-
- for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin();
- iter != mShiftList.end(); iter++)
- {
- LLDrawable *drawablep = *iter;
- if (drawablep->isDead())
- {
- continue;
- }
- drawablep->shiftPos(offseta);
- drawablep->clearState(LLDrawable::ON_SHIFT_LIST);
- }
- mShiftList.resize(0);
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- part->shift(offseta);
- }
- }
- }
+ assertInitialized();
+
+ glClear(GL_DEPTH_BUFFER_BIT);
+ gDepthDirty = true;
+
+ LLVector4a offseta;
+ offseta.load3(offset.mV);
+
+ for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin();
+ iter != mShiftList.end(); iter++)
+ {
+ LLDrawable *drawablep = *iter;
+ if (drawablep->isDead())
+ {
+ continue;
+ }
+ drawablep->shiftPos(offseta);
+ drawablep->clearState(LLDrawable::ON_SHIFT_LIST);
+ }
+ mShiftList.resize(0);
+
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
+ {
+ part->shift(offseta);
+ }
+ }
+ }
mReflectionMapManager.shift(offseta);
- LLHUDText::shiftAll(offset);
- LLHUDNameTag::shiftAll(offset);
+ LLHUDText::shiftAll(offset);
+ LLHUDNameTag::shiftAll(offset);
- display_update_camera();
+ display_update_camera();
}
void LLPipeline::markTextured(LLDrawable *drawablep)
{
- if (drawablep && !drawablep->isDead() && assertInitialized())
- {
- mRetexturedList.insert(drawablep);
- }
+ if (drawablep && !drawablep->isDead() && assertInitialized())
+ {
+ mRetexturedList.insert(drawablep);
+ }
}
void LLPipeline::markGLRebuild(LLGLUpdate* glu)
{
- if (glu && !glu->mInQ)
- {
- LLGLUpdate::sGLQ.push_back(glu);
- glu->mInQ = TRUE;
- }
+ if (glu && !glu->mInQ)
+ {
+ LLGLUpdate::sGLQ.push_back(glu);
+ glu->mInQ = TRUE;
+ }
}
void LLPipeline::markPartitionMove(LLDrawable* drawable)
{
- if (!drawable->isState(LLDrawable::PARTITION_MOVE) &&
- !drawable->getPositionGroup().equals3(LLVector4a::getZero()))
- {
- drawable->setState(LLDrawable::PARTITION_MOVE);
- mPartitionQ.push_back(drawable);
- }
+ if (!drawable->isState(LLDrawable::PARTITION_MOVE) &&
+ !drawable->getPositionGroup().equals3(LLVector4a::getZero()))
+ {
+ drawable->setState(LLDrawable::PARTITION_MOVE);
+ mPartitionQ.push_back(drawable);
+ }
}
void LLPipeline::processPartitionQ()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- for (LLDrawable::drawable_list_t::iterator iter = mPartitionQ.begin(); iter != mPartitionQ.end(); ++iter)
- {
- LLDrawable* drawable = *iter;
- if (!drawable->isDead())
- {
- drawable->updateBinRadius();
- drawable->movePartition();
- }
- drawable->clearState(LLDrawable::PARTITION_MOVE);
- }
+ for (LLDrawable::drawable_list_t::iterator iter = mPartitionQ.begin(); iter != mPartitionQ.end(); ++iter)
+ {
+ LLDrawable* drawable = *iter;
+ if (!drawable->isDead())
+ {
+ drawable->updateBinRadius();
+ drawable->movePartition();
+ }
+ drawable->clearState(LLDrawable::PARTITION_MOVE);
+ }
- mPartitionQ.clear();
+ mPartitionQ.clear();
}
void LLPipeline::markMeshDirty(LLSpatialGroup* group)
{
- mMeshDirtyGroup.push_back(group);
+ mMeshDirtyGroup.push_back(group);
}
void LLPipeline::markRebuild(LLSpatialGroup* group)
{
- if (group && !group->isDead() && group->getSpatialPartition())
- {
- if (!group->hasState(LLSpatialGroup::IN_BUILD_Q1))
- {
- llassert_always(!mGroupQ1Locked);
+ if (group && !group->isDead() && group->getSpatialPartition())
+ {
+ if (!group->hasState(LLSpatialGroup::IN_BUILD_Q1))
+ {
+ llassert_always(!mGroupQ1Locked);
- mGroupQ1.push_back(group);
- group->setState(LLSpatialGroup::IN_BUILD_Q1);
- }
- }
+ mGroupQ1.push_back(group);
+ group->setState(LLSpatialGroup::IN_BUILD_Q1);
+ }
+ }
}
void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag)
{
- if (drawablep && !drawablep->isDead() && assertInitialized())
- {
- if (!drawablep->isState(LLDrawable::IN_REBUILD_Q))
- {
- mBuildQ1.push_back(drawablep);
- drawablep->setState(LLDrawable::IN_REBUILD_Q); // mark drawable as being in priority queue
- }
+ if (drawablep && !drawablep->isDead() && assertInitialized())
+ {
+ if (!drawablep->isState(LLDrawable::IN_REBUILD_Q))
+ {
+ mBuildQ1.push_back(drawablep);
+ drawablep->setState(LLDrawable::IN_REBUILD_Q); // mark drawable as being in priority queue
+ }
if (flag & (LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION))
- {
- drawablep->getVObj()->setChanged(LLXform::SILHOUETTE);
- }
- drawablep->setState(flag);
- }
+ {
+ drawablep->getVObj()->setChanged(LLXform::SILHOUETTE);
+ }
+ drawablep->setState(flag);
+ }
}
void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
@@ -2855,300 +2855,300 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LL_PROFILE_GPU_ZONE("stateSort");
- if (hasAnyRenderType(LLPipeline::RENDER_TYPE_AVATAR,
- LLPipeline::RENDER_TYPE_CONTROL_AV,
- LLPipeline::RENDER_TYPE_TERRAIN,
- LLPipeline::RENDER_TYPE_TREE,
- LLPipeline::RENDER_TYPE_SKY,
- LLPipeline::RENDER_TYPE_VOIDWATER,
- LLPipeline::RENDER_TYPE_WATER,
- LLPipeline::END_RENDER_TYPES))
- {
- //clear faces from face pools
- gPipeline.resetDrawOrders();
- }
-
- //LLVertexBuffer::unbind();
-
- grabReferences(result);
- for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
+ if (hasAnyRenderType(LLPipeline::RENDER_TYPE_AVATAR,
+ LLPipeline::RENDER_TYPE_CONTROL_AV,
+ LLPipeline::RENDER_TYPE_TERRAIN,
+ LLPipeline::RENDER_TYPE_TREE,
+ LLPipeline::RENDER_TYPE_SKY,
+ LLPipeline::RENDER_TYPE_VOIDWATER,
+ LLPipeline::RENDER_TYPE_WATER,
+ LLPipeline::END_RENDER_TYPES))
+ {
+ //clear faces from face pools
+ gPipeline.resetDrawOrders();
+ }
+
+ //LLVertexBuffer::unbind();
+
+ grabReferences(result);
+ for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
if (group->isDead())
{
continue;
}
- group->checkOcclusion();
- if (sUseOcclusion > 1 && group->isOcclusionState(LLSpatialGroup::OCCLUDED))
- {
- markOccluder(group);
- }
- else
- {
- group->setVisible();
- for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
- {
+ group->checkOcclusion();
+ if (sUseOcclusion > 1 && group->isOcclusionState(LLSpatialGroup::OCCLUDED))
+ {
+ markOccluder(group);
+ }
+ else
+ {
+ group->setVisible();
+ for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+ {
LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
- markVisible(drawablep, camera);
- }
-
- { //rebuild mesh as soon as we know it's visible
- group->rebuildMesh();
- }
- }
- }
-
- if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
- {
- LLSpatialGroup* last_group = NULL;
- BOOL fov_changed = LLViewerCamera::getInstance()->isDefaultFOVChanged();
- for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
- {
- LLCullResult::bridge_iterator cur_iter = i;
- LLSpatialBridge* bridge = *cur_iter;
- LLSpatialGroup* group = bridge->getSpatialGroup();
-
- if (last_group == NULL)
- {
- last_group = group;
- }
-
- if (!bridge->isDead() && group && !group->isOcclusionState(LLSpatialGroup::OCCLUDED))
- {
- stateSort(bridge, camera, fov_changed);
- }
-
- if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD &&
- last_group != group && last_group->changeLOD())
- {
- last_group->mLastUpdateDistance = last_group->mDistance;
- }
-
- last_group = group;
- }
-
- if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD &&
- last_group && last_group->changeLOD())
- {
- last_group->mLastUpdateDistance = last_group->mDistance;
- }
- }
-
- for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
- {
- LLSpatialGroup* group = *iter;
+ markVisible(drawablep, camera);
+ }
+
+ { //rebuild mesh as soon as we know it's visible
+ group->rebuildMesh();
+ }
+ }
+ }
+
+ if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
+ {
+ LLSpatialGroup* last_group = NULL;
+ BOOL fov_changed = LLViewerCamera::getInstance()->isDefaultFOVChanged();
+ for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
+ {
+ LLCullResult::bridge_iterator cur_iter = i;
+ LLSpatialBridge* bridge = *cur_iter;
+ LLSpatialGroup* group = bridge->getSpatialGroup();
+
+ if (last_group == NULL)
+ {
+ last_group = group;
+ }
+
+ if (!bridge->isDead() && group && !group->isOcclusionState(LLSpatialGroup::OCCLUDED))
+ {
+ stateSort(bridge, camera, fov_changed);
+ }
+
+ if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD &&
+ last_group != group && last_group->changeLOD())
+ {
+ last_group->mLastUpdateDistance = last_group->mDistance;
+ }
+
+ last_group = group;
+ }
+
+ if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD &&
+ last_group && last_group->changeLOD())
+ {
+ last_group->mLastUpdateDistance = last_group->mDistance;
+ }
+ }
+
+ for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
if (group->isDead())
{
continue;
}
- group->checkOcclusion();
- if (sUseOcclusion > 1 && group->isOcclusionState(LLSpatialGroup::OCCLUDED))
- {
- markOccluder(group);
- }
- else
- {
- group->setVisible();
- stateSort(group, camera);
-
- { //rebuild mesh as soon as we know it's visible
- group->rebuildMesh();
- }
- }
- }
-
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWABLE("stateSort"); // LL_RECORD_BLOCK_TIME(FTM_STATESORT_DRAWABLE);
- for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList();
- iter != sCull->endVisibleList(); ++iter)
- {
- LLDrawable *drawablep = *iter;
- if (!drawablep->isDead())
- {
- stateSort(drawablep, camera);
- }
- }
- }
-
- postSort(camera);
+ group->checkOcclusion();
+ if (sUseOcclusion > 1 && group->isOcclusionState(LLSpatialGroup::OCCLUDED))
+ {
+ markOccluder(group);
+ }
+ else
+ {
+ group->setVisible();
+ stateSort(group, camera);
+
+ { //rebuild mesh as soon as we know it's visible
+ group->rebuildMesh();
+ }
+ }
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWABLE("stateSort"); // LL_RECORD_BLOCK_TIME(FTM_STATESORT_DRAWABLE);
+ for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList();
+ iter != sCull->endVisibleList(); ++iter)
+ {
+ LLDrawable *drawablep = *iter;
+ if (!drawablep->isDead())
+ {
+ stateSort(drawablep, camera);
+ }
+ }
+ }
+
+ postSort(camera);
}
void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
{
- if (group->changeLOD())
- {
- for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
- {
- LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
- stateSort(drawablep, camera);
- }
+ if (group->changeLOD())
+ {
+ for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+ {
+ LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
+ stateSort(drawablep, camera);
+ }
- if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
- { //avoid redundant stateSort calls
- group->mLastUpdateDistance = group->mDistance;
- }
- }
+ if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
+ { //avoid redundant stateSort calls
+ group->mLastUpdateDistance = group->mDistance;
+ }
+ }
}
void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_changed)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
if (bridge->getSpatialGroup()->changeLOD() || fov_changed)
- {
- bool force_update = false;
- bridge->updateDistance(camera, force_update);
- }
+ {
+ bool force_update = false;
+ bridge->updateDistance(camera, force_update);
+ }
}
void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
if (!drawablep
- || drawablep->isDead()
- || !hasRenderType(drawablep->getRenderType()))
- {
- return;
- }
-
+ || drawablep->isDead()
+ || !hasRenderType(drawablep->getRenderType()))
+ {
+ return;
+ }
+
// SL-11353
// ignore our own geo when rendering spotlight shadowmaps...
- //
+ //
if (RenderSpotLight && drawablep == RenderSpotLight)
{
return;
}
- if (LLSelectMgr::getInstance()->mHideSelectedObjects)
- {
- if (drawablep->getVObj().notNull() &&
- drawablep->getVObj()->isSelected())
- {
- return;
- }
- }
-
- if (drawablep->isAvatar())
- { //don't draw avatars beyond render distance or if we don't have a spatial group.
- if ((drawablep->getSpatialGroup() == NULL) ||
- (drawablep->getSpatialGroup()->mDistance > LLVOAvatar::sRenderDistance))
- {
- return;
- }
-
- LLVOAvatar* avatarp = (LLVOAvatar*) drawablep->getVObj().get();
- if (!avatarp->isVisible())
- {
- return;
- }
- }
-
- assertInitialized();
-
- if (hasRenderType(drawablep->mRenderType))
- {
- if (!drawablep->isState(LLDrawable::INVISIBLE|LLDrawable::FORCE_INVISIBLE))
- {
- drawablep->setVisible(camera, NULL, FALSE);
- }
- }
-
- if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
- {
- //if (drawablep->isVisible()) isVisible() check here is redundant, if it wasn't visible, it wouldn't be here
- {
- if (!drawablep->isActive())
- {
- bool force_update = false;
- drawablep->updateDistance(camera, force_update);
- }
- else if (drawablep->isAvatar())
- {
- bool force_update = false;
- drawablep->updateDistance(camera, force_update); // calls vobj->updateLOD() which calls LLVOAvatar::updateVisibility()
- }
- }
- }
-
- if (!drawablep->getVOVolume())
- {
- for (LLDrawable::face_list_t::iterator iter = drawablep->mFaces.begin();
- iter != drawablep->mFaces.end(); iter++)
- {
- LLFace* facep = *iter;
-
- if (facep->hasGeometry())
- {
- if (facep->getPool())
- {
- facep->getPool()->enqueue(facep);
- }
- else
- {
- break;
- }
- }
- }
- }
-
- mNumVisibleFaces += drawablep->getNumFaces();
-}
-
-
-void forAllDrawables(LLCullResult::sg_iterator begin,
- LLCullResult::sg_iterator end,
- void (*func)(LLDrawable*))
-{
- for (LLCullResult::sg_iterator i = begin; i != end; ++i)
- {
+ if (LLSelectMgr::getInstance()->mHideSelectedObjects)
+ {
+ if (drawablep->getVObj().notNull() &&
+ drawablep->getVObj()->isSelected())
+ {
+ return;
+ }
+ }
+
+ if (drawablep->isAvatar())
+ { //don't draw avatars beyond render distance or if we don't have a spatial group.
+ if ((drawablep->getSpatialGroup() == NULL) ||
+ (drawablep->getSpatialGroup()->mDistance > LLVOAvatar::sRenderDistance))
+ {
+ return;
+ }
+
+ LLVOAvatar* avatarp = (LLVOAvatar*) drawablep->getVObj().get();
+ if (!avatarp->isVisible())
+ {
+ return;
+ }
+ }
+
+ assertInitialized();
+
+ if (hasRenderType(drawablep->mRenderType))
+ {
+ if (!drawablep->isState(LLDrawable::INVISIBLE|LLDrawable::FORCE_INVISIBLE))
+ {
+ drawablep->setVisible(camera, NULL, FALSE);
+ }
+ }
+
+ if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
+ {
+ //if (drawablep->isVisible()) isVisible() check here is redundant, if it wasn't visible, it wouldn't be here
+ {
+ if (!drawablep->isActive())
+ {
+ bool force_update = false;
+ drawablep->updateDistance(camera, force_update);
+ }
+ else if (drawablep->isAvatar())
+ {
+ bool force_update = false;
+ drawablep->updateDistance(camera, force_update); // calls vobj->updateLOD() which calls LLVOAvatar::updateVisibility()
+ }
+ }
+ }
+
+ if (!drawablep->getVOVolume())
+ {
+ for (LLDrawable::face_list_t::iterator iter = drawablep->mFaces.begin();
+ iter != drawablep->mFaces.end(); iter++)
+ {
+ LLFace* facep = *iter;
+
+ if (facep->hasGeometry())
+ {
+ if (facep->getPool())
+ {
+ facep->getPool()->enqueue(facep);
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ mNumVisibleFaces += drawablep->getNumFaces();
+}
+
+
+void forAllDrawables(LLCullResult::sg_iterator begin,
+ LLCullResult::sg_iterator end,
+ void (*func)(LLDrawable*))
+{
+ for (LLCullResult::sg_iterator i = begin; i != end; ++i)
+ {
LLSpatialGroup* group = *i;
if (group->isDead())
{
continue;
}
- for (LLSpatialGroup::element_iter j = group->getDataBegin(); j != group->getDataEnd(); ++j)
- {
- if((*j)->hasDrawable())
- {
- func((LLDrawable*)(*j)->getDrawable());
- }
- }
- }
+ for (LLSpatialGroup::element_iter j = group->getDataBegin(); j != group->getDataEnd(); ++j)
+ {
+ if((*j)->hasDrawable())
+ {
+ func((LLDrawable*)(*j)->getDrawable());
+ }
+ }
+ }
}
void LLPipeline::forAllVisibleDrawables(void (*func)(LLDrawable*))
{
- forAllDrawables(sCull->beginDrawableGroups(), sCull->endDrawableGroups(), func);
- forAllDrawables(sCull->beginVisibleGroups(), sCull->endVisibleGroups(), func);
+ forAllDrawables(sCull->beginDrawableGroups(), sCull->endDrawableGroups(), func);
+ forAllDrawables(sCull->beginVisibleGroups(), sCull->endVisibleGroups(), func);
}
//function for creating scripted beacons
void renderScriptedBeacons(LLDrawable* drawablep)
{
- LLViewerObject *vobj = drawablep->getVObj();
- if (vobj
- && !vobj->isAvatar()
- && !vobj->getParent()
- && vobj->flagScripted())
- {
- if (gPipeline.sRenderBeacons)
- {
- gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
- }
-
- if (gPipeline.sRenderHighlight)
- {
- S32 face_id;
- S32 count = drawablep->getNumFaces();
- for (face_id = 0; face_id < count; face_id++)
- {
- LLFace * facep = drawablep->getFace(face_id);
- if (facep)
- {
- gPipeline.mHighlightFaces.push_back(facep);
- }
- }
- }
- }
+ LLViewerObject *vobj = drawablep->getVObj();
+ if (vobj
+ && !vobj->isAvatar()
+ && !vobj->getParent()
+ && vobj->flagScripted())
+ {
+ if (gPipeline.sRenderBeacons)
+ {
+ gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
+ }
+
+ if (gPipeline.sRenderHighlight)
+ {
+ S32 face_id;
+ S32 count = drawablep->getNumFaces();
+ for (face_id = 0; face_id < count; face_id++)
+ {
+ LLFace * facep = drawablep->getFace(face_id);
+ if (facep)
+ {
+ gPipeline.mHighlightFaces.push_back(facep);
+ }
+ }
+ }
+ }
}
void renderScriptedTouchBeacons(LLDrawable *drawablep)
@@ -3551,169 +3551,169 @@ void LLPipeline::postSort(LLCamera &camera)
void render_hud_elements()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI);
- gPipeline.disableLights();
-
- LLGLSUIDefault gls_ui;
-
- //LLGLEnable stencil(GL_STENCIL_TEST);
- //glStencilFunc(GL_ALWAYS, 255, 0xFFFFFFFF);
- //glStencilMask(0xFFFFFFFF);
- //glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
-
- gUIProgram.bind();
+ gPipeline.disableLights();
+
+ LLGLSUIDefault gls_ui;
+
+ //LLGLEnable stencil(GL_STENCIL_TEST);
+ //glStencilFunc(GL_ALWAYS, 255, 0xFFFFFFFF);
+ //glStencilMask(0xFFFFFFFF);
+ //glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+
+ gUIProgram.bind();
gGL.color4f(1, 1, 1, 1);
- LLGLDepthTest depth(GL_TRUE, GL_FALSE);
-
- if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
- {
- gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d()
-
- // Draw the tracking overlays
- LLTracker::render3D();
-
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE);
+
+ if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
+ gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d()
+
+ // Draw the tracking overlays
+ LLTracker::render3D();
+
if (LLWorld::instanceExists())
{
// Show the property lines
LLWorld::getInstance()->renderPropertyLines();
}
- LLViewerParcelMgr::getInstance()->render();
- LLViewerParcelMgr::getInstance()->renderParcelCollision();
- }
- else if (gForceRenderLandFence)
- {
- // This is only set when not rendering the UI, for parcel snapshots
- LLViewerParcelMgr::getInstance()->render();
- }
- else if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
- {
- LLHUDText::renderAllHUD();
- }
+ LLViewerParcelMgr::getInstance()->render();
+ LLViewerParcelMgr::getInstance()->renderParcelCollision();
+ }
+ else if (gForceRenderLandFence)
+ {
+ // This is only set when not rendering the UI, for parcel snapshots
+ LLViewerParcelMgr::getInstance()->render();
+ }
+ else if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
+ {
+ LLHUDText::renderAllHUD();
+ }
- gUIProgram.unbind();
+ gUIProgram.unbind();
}
void LLPipeline::renderHighlights()
{
- assertInitialized();
-
- // Draw 3D UI elements here (before we clear the Z buffer in POOL_HUD)
- // Render highlighted faces.
- LLGLSPipelineAlpha gls_pipeline_alpha;
- LLColor4 color(1.f, 1.f, 1.f, 0.5f);
- disableLights();
-
- if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
- {
- gHighlightProgram.bind();
- gGL.diffuseColor4f(1,1,1,0.5f);
- }
-
- if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && !mFaceSelectImagep)
- {
- mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT);
- }
-
- if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::DIFFUSE_MAP))
- {
- // Make sure the selection image gets downloaded and decoded
- mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA);
-
- U32 count = mSelectedFaces.size();
- for (U32 i = 0; i < count; i++)
- {
- LLFace *facep = mSelectedFaces[i];
- if (!facep || facep->getDrawable()->isDead())
- {
- LL_ERRS() << "Bad face on selection" << LL_ENDL;
- return;
- }
-
- facep->renderSelected(mFaceSelectImagep, color);
- }
- }
-
- if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED))
- {
- // Paint 'em red!
- color.setVec(1.f, 0.f, 0.f, 0.5f);
-
- int count = mHighlightFaces.size();
- for (S32 i = 0; i < count; i++)
- {
- LLFace* facep = mHighlightFaces[i];
- facep->renderSelected(LLViewerTexture::sNullImagep, color);
- }
- }
-
- // Contains a list of the faces of objects that are physical or
- // have touch-handlers.
- mHighlightFaces.clear();
-
- if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)
- {
- gHighlightProgram.unbind();
- }
-
-
- if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::NORMAL_MAP))
- {
- color.setVec(1.0f, 0.5f, 0.5f, 0.5f);
- if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
- {
- gHighlightNormalProgram.bind();
- gGL.diffuseColor4f(1,1,1,0.5f);
- }
-
- mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA);
-
- U32 count = mSelectedFaces.size();
- for (U32 i = 0; i < count; i++)
- {
- LLFace *facep = mSelectedFaces[i];
- if (!facep || facep->getDrawable()->isDead())
- {
- LL_ERRS() << "Bad face on selection" << LL_ENDL;
- return;
- }
-
- facep->renderSelected(mFaceSelectImagep, color);
- }
-
- if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
- {
- gHighlightNormalProgram.unbind();
- }
- }
-
- if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::SPECULAR_MAP))
- {
- color.setVec(0.0f, 0.3f, 1.0f, 0.8f);
- if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
- {
- gHighlightSpecularProgram.bind();
- gGL.diffuseColor4f(1,1,1,0.5f);
- }
-
- mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA);
-
- U32 count = mSelectedFaces.size();
- for (U32 i = 0; i < count; i++)
- {
- LLFace *facep = mSelectedFaces[i];
- if (!facep || facep->getDrawable()->isDead())
- {
- LL_ERRS() << "Bad face on selection" << LL_ENDL;
- return;
- }
-
- facep->renderSelected(mFaceSelectImagep, color);
- }
-
- if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
- {
- gHighlightSpecularProgram.unbind();
- }
- }
+ assertInitialized();
+
+ // Draw 3D UI elements here (before we clear the Z buffer in POOL_HUD)
+ // Render highlighted faces.
+ LLGLSPipelineAlpha gls_pipeline_alpha;
+ LLColor4 color(1.f, 1.f, 1.f, 0.5f);
+ disableLights();
+
+ if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
+ {
+ gHighlightProgram.bind();
+ gGL.diffuseColor4f(1,1,1,0.5f);
+ }
+
+ if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && !mFaceSelectImagep)
+ {
+ mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT);
+ }
+
+ if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::DIFFUSE_MAP))
+ {
+ // Make sure the selection image gets downloaded and decoded
+ mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA);
+
+ U32 count = mSelectedFaces.size();
+ for (U32 i = 0; i < count; i++)
+ {
+ LLFace *facep = mSelectedFaces[i];
+ if (!facep || facep->getDrawable()->isDead())
+ {
+ LL_ERRS() << "Bad face on selection" << LL_ENDL;
+ return;
+ }
+
+ facep->renderSelected(mFaceSelectImagep, color);
+ }
+ }
+
+ if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED))
+ {
+ // Paint 'em red!
+ color.setVec(1.f, 0.f, 0.f, 0.5f);
+
+ int count = mHighlightFaces.size();
+ for (S32 i = 0; i < count; i++)
+ {
+ LLFace* facep = mHighlightFaces[i];
+ facep->renderSelected(LLViewerTexture::sNullImagep, color);
+ }
+ }
+
+ // Contains a list of the faces of objects that are physical or
+ // have touch-handlers.
+ mHighlightFaces.clear();
+
+ if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)
+ {
+ gHighlightProgram.unbind();
+ }
+
+
+ if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::NORMAL_MAP))
+ {
+ color.setVec(1.0f, 0.5f, 0.5f, 0.5f);
+ if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
+ {
+ gHighlightNormalProgram.bind();
+ gGL.diffuseColor4f(1,1,1,0.5f);
+ }
+
+ mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA);
+
+ U32 count = mSelectedFaces.size();
+ for (U32 i = 0; i < count; i++)
+ {
+ LLFace *facep = mSelectedFaces[i];
+ if (!facep || facep->getDrawable()->isDead())
+ {
+ LL_ERRS() << "Bad face on selection" << LL_ENDL;
+ return;
+ }
+
+ facep->renderSelected(mFaceSelectImagep, color);
+ }
+
+ if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
+ {
+ gHighlightNormalProgram.unbind();
+ }
+ }
+
+ if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::SPECULAR_MAP))
+ {
+ color.setVec(0.0f, 0.3f, 1.0f, 0.8f);
+ if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
+ {
+ gHighlightSpecularProgram.bind();
+ gGL.diffuseColor4f(1,1,1,0.5f);
+ }
+
+ mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA);
+
+ U32 count = mSelectedFaces.size();
+ for (U32 i = 0; i < count; i++)
+ {
+ LLFace *facep = mSelectedFaces[i];
+ if (!facep || facep->getDrawable()->isDead())
+ {
+ LL_ERRS() << "Bad face on selection" << LL_ENDL;
+ return;
+ }
+
+ facep->renderSelected(mFaceSelectImagep, color);
+ }
+
+ if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
+ {
+ gHighlightSpecularProgram.unbind();
+ }
+ }
}
//debug use
@@ -3721,8 +3721,8 @@ U32 LLPipeline::sCurRenderPoolType = 0 ;
void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
{
- LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomDeferred");
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY);
+ LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomDeferred");
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY);
LL_PROFILE_GPU_ZONE("renderGeomDeferred");
llassert(!sRenderingHUDs);
@@ -3733,7 +3733,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
}
if (&camera == LLViewerCamera::getInstance())
- { // a bit hacky, this is the start of the main render frame, figure out delta between last modelview matrix and
+ { // a bit hacky, this is the start of the main render frame, figure out delta between last modelview matrix and
// current modelview matrix
glh::matrix4f last_modelview(gGLLastModelView);
glh::matrix4f cur_modelview(gGLModelView);
@@ -3755,23 +3755,23 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
setupHWLights();
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pools");
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pools");
- LLGLEnable cull(GL_CULL_FACE);
+ LLGLEnable cull(GL_CULL_FACE);
- for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
- {
- LLDrawPool *poolp = *iter;
- if (hasRenderType(poolp->getType()))
- {
- poolp->prerender();
- }
- }
+ for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
+ {
+ LLDrawPool *poolp = *iter;
+ if (hasRenderType(poolp->getType()))
+ {
+ poolp->prerender();
+ }
+ }
- LLVertexBuffer::unbind();
+ LLVertexBuffer::unbind();
- LLGLState::checkStates();
+ LLGLState::checkStates();
if (LLViewerShaderMgr::instance()->mShaderLevel[LLViewerShaderMgr::SHADER_DEFERRED] > 1)
{
@@ -3779,17 +3779,17 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
mReflectionMapManager.updateUniforms();
}
- U32 cur_type = 0;
+ U32 cur_type = 0;
- gGL.setColorMask(true, true);
-
- pool_set_t::iterator iter1 = mPools.begin();
+ gGL.setColorMask(true, true);
- while ( iter1 != mPools.end() )
- {
- LLDrawPool *poolp = *iter1;
-
- cur_type = poolp->getType();
+ pool_set_t::iterator iter1 = mPools.begin();
+
+ while ( iter1 != mPools.end() )
+ {
+ LLDrawPool *poolp = *iter1;
+
+ cur_type = poolp->getType();
if (occlude && cur_type >= LLDrawPool::POOL_GRASS)
{
@@ -3800,57 +3800,57 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
doOcclusion(camera);
}
- pool_set_t::iterator iter2 = iter1;
- if (hasRenderType(poolp->getType()) && poolp->getNumDeferredPasses() > 0)
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pool render");
-
- gGLLastMatrix = NULL;
- gGL.loadMatrix(gGLModelView);
-
- for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ )
- {
- LLVertexBuffer::unbind();
- poolp->beginDeferredPass(i);
- for (iter2 = iter1; iter2 != mPools.end(); iter2++)
- {
- LLDrawPool *p = *iter2;
- if (p->getType() != cur_type)
- {
- break;
- }
-
- if ( !p->getSkipRenderFlag() ) { p->renderDeferred(i); }
- }
- poolp->endDeferredPass(i);
- LLVertexBuffer::unbind();
-
- LLGLState::checkStates();
- }
- }
- else
- {
- // Skip all pools of this type
- for (iter2 = iter1; iter2 != mPools.end(); iter2++)
- {
- LLDrawPool *p = *iter2;
- if (p->getType() != cur_type)
- {
- break;
- }
- }
- }
- iter1 = iter2;
- stop_glerror();
- }
-
- gGLLastMatrix = NULL;
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.loadMatrix(gGLModelView);
-
- gGL.setColorMask(true, false);
-
- } // Tracy ZoneScoped
+ pool_set_t::iterator iter2 = iter1;
+ if (hasRenderType(poolp->getType()) && poolp->getNumDeferredPasses() > 0)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pool render");
+
+ gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
+
+ for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ )
+ {
+ LLVertexBuffer::unbind();
+ poolp->beginDeferredPass(i);
+ for (iter2 = iter1; iter2 != mPools.end(); iter2++)
+ {
+ LLDrawPool *p = *iter2;
+ if (p->getType() != cur_type)
+ {
+ break;
+ }
+
+ if ( !p->getSkipRenderFlag() ) { p->renderDeferred(i); }
+ }
+ poolp->endDeferredPass(i);
+ LLVertexBuffer::unbind();
+
+ LLGLState::checkStates();
+ }
+ }
+ else
+ {
+ // Skip all pools of this type
+ for (iter2 = iter1; iter2 != mPools.end(); iter2++)
+ {
+ LLDrawPool *p = *iter2;
+ if (p->getType() != cur_type)
+ {
+ break;
+ }
+ }
+ }
+ iter1 = iter2;
+ stop_glerror();
+ }
+
+ gGLLastMatrix = NULL;
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.loadMatrix(gGLModelView);
+
+ gGL.setColorMask(true, false);
+
+ } // Tracy ZoneScoped
if (gUseWireframe)
{
@@ -3860,7 +3860,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LL_PROFILE_GPU_ZONE("renderGeomPostDeferred");
if (gUseWireframe)
@@ -3868,9 +3868,9 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
- U32 cur_type = 0;
+ U32 cur_type = 0;
- LLGLEnable cull(GL_CULL_FACE);
+ LLGLEnable cull(GL_CULL_FACE);
bool done_atmospherics = LLPipeline::sRenderingHUDs; //skip atmospherics on huds
bool done_water_haze = done_atmospherics;
@@ -3886,24 +3886,24 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
// do water haze just before pre water alpha
U32 water_haze_pass = LLDrawPool::POOL_ALPHA_PRE_WATER;
- calcNearbyLights(camera);
- setupHWLights();
+ calcNearbyLights(camera);
+ setupHWLights();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
- gGL.setColorMask(true, false);
+ gGL.setColorMask(true, false);
- pool_set_t::iterator iter1 = mPools.begin();
+ pool_set_t::iterator iter1 = mPools.begin();
if (gDebugGL || gDebugPipeline)
{
LLGLState::checkStates(GL_FALSE);
}
- while ( iter1 != mPools.end() )
- {
- LLDrawPool *poolp = *iter1;
-
- cur_type = poolp->getType();
+ while ( iter1 != mPools.end() )
+ {
+ LLDrawPool *poolp = *iter1;
+
+ cur_type = poolp->getType();
if (cur_type >= atmospherics_pass && !done_atmospherics)
{ // do atmospherics against depth buffer before rendering alpha
@@ -3917,56 +3917,56 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
done_water_haze = true;
}
- pool_set_t::iterator iter2 = iter1;
- if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0)
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred poolrender");
-
- gGLLastMatrix = NULL;
- gGL.loadMatrix(gGLModelView);
-
- for( S32 i = 0; i < poolp->getNumPostDeferredPasses(); i++ )
- {
- LLVertexBuffer::unbind();
- poolp->beginPostDeferredPass(i);
- for (iter2 = iter1; iter2 != mPools.end(); iter2++)
- {
- LLDrawPool *p = *iter2;
- if (p->getType() != cur_type)
- {
- break;
- }
-
- p->renderPostDeferred(i);
- }
- poolp->endPostDeferredPass(i);
- LLVertexBuffer::unbind();
-
- if (gDebugGL || gDebugPipeline)
- {
- LLGLState::checkStates(GL_FALSE);
- }
- }
- }
- else
- {
- // Skip all pools of this type
- for (iter2 = iter1; iter2 != mPools.end(); iter2++)
- {
- LLDrawPool *p = *iter2;
- if (p->getType() != cur_type)
- {
- break;
- }
- }
- }
- iter1 = iter2;
- stop_glerror();
- }
-
- gGLLastMatrix = NULL;
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.loadMatrix(gGLModelView);
+ pool_set_t::iterator iter2 = iter1;
+ if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred poolrender");
+
+ gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
+
+ for( S32 i = 0; i < poolp->getNumPostDeferredPasses(); i++ )
+ {
+ LLVertexBuffer::unbind();
+ poolp->beginPostDeferredPass(i);
+ for (iter2 = iter1; iter2 != mPools.end(); iter2++)
+ {
+ LLDrawPool *p = *iter2;
+ if (p->getType() != cur_type)
+ {
+ break;
+ }
+
+ p->renderPostDeferred(i);
+ }
+ poolp->endPostDeferredPass(i);
+ LLVertexBuffer::unbind();
+
+ if (gDebugGL || gDebugPipeline)
+ {
+ LLGLState::checkStates(GL_FALSE);
+ }
+ }
+ }
+ else
+ {
+ // Skip all pools of this type
+ for (iter2 = iter1; iter2 != mPools.end(); iter2++)
+ {
+ LLDrawPool *p = *iter2;
+ if (p->getType() != cur_type)
+ {
+ break;
+ }
+ }
+ }
+ iter1 = iter2;
+ stop_glerror();
+ }
+
+ gGLLastMatrix = NULL;
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.loadMatrix(gGLModelView);
if (!gCubeSnapshot)
{
@@ -3988,63 +3988,63 @@ void LLPipeline::renderGeomShadow(LLCamera& camera)
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LL_PROFILE_GPU_ZONE("renderGeomShadow");
U32 cur_type = 0;
-
- LLGLEnable cull(GL_CULL_FACE);
-
- LLVertexBuffer::unbind();
-
- pool_set_t::iterator iter1 = mPools.begin();
-
- while ( iter1 != mPools.end() )
- {
- LLDrawPool *poolp = *iter1;
-
- cur_type = poolp->getType();
-
- pool_set_t::iterator iter2 = iter1;
- if (hasRenderType(poolp->getType()) && poolp->getNumShadowPasses() > 0)
- {
- poolp->prerender() ;
-
- gGLLastMatrix = NULL;
- gGL.loadMatrix(gGLModelView);
-
- for( S32 i = 0; i < poolp->getNumShadowPasses(); i++ )
- {
- LLVertexBuffer::unbind();
- poolp->beginShadowPass(i);
- for (iter2 = iter1; iter2 != mPools.end(); iter2++)
- {
- LLDrawPool *p = *iter2;
- if (p->getType() != cur_type)
- {
- break;
- }
-
- p->renderShadow(i);
- }
- poolp->endShadowPass(i);
- LLVertexBuffer::unbind();
- }
- }
- else
- {
- // Skip all pools of this type
- for (iter2 = iter1; iter2 != mPools.end(); iter2++)
- {
- LLDrawPool *p = *iter2;
- if (p->getType() != cur_type)
- {
- break;
- }
- }
- }
- iter1 = iter2;
- stop_glerror();
- }
-
- gGLLastMatrix = NULL;
- gGL.loadMatrix(gGLModelView);
+
+ LLGLEnable cull(GL_CULL_FACE);
+
+ LLVertexBuffer::unbind();
+
+ pool_set_t::iterator iter1 = mPools.begin();
+
+ while ( iter1 != mPools.end() )
+ {
+ LLDrawPool *poolp = *iter1;
+
+ cur_type = poolp->getType();
+
+ pool_set_t::iterator iter2 = iter1;
+ if (hasRenderType(poolp->getType()) && poolp->getNumShadowPasses() > 0)
+ {
+ poolp->prerender() ;
+
+ gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
+
+ for( S32 i = 0; i < poolp->getNumShadowPasses(); i++ )
+ {
+ LLVertexBuffer::unbind();
+ poolp->beginShadowPass(i);
+ for (iter2 = iter1; iter2 != mPools.end(); iter2++)
+ {
+ LLDrawPool *p = *iter2;
+ if (p->getType() != cur_type)
+ {
+ break;
+ }
+
+ p->renderShadow(i);
+ }
+ poolp->endShadowPass(i);
+ LLVertexBuffer::unbind();
+ }
+ }
+ else
+ {
+ // Skip all pools of this type
+ for (iter2 = iter1; iter2 != mPools.end(); iter2++)
+ {
+ LLDrawPool *p = *iter2;
+ if (p->getType() != cur_type)
+ {
+ break;
+ }
+ }
+ }
+ iter1 = iter2;
+ stop_glerror();
+ }
+
+ gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
}
@@ -4065,10 +4065,10 @@ void LLPipeline::recordTrianglesDrawn()
void LLPipeline::renderPhysicsDisplay()
{
- if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
- {
- return;
- }
+ if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
+ {
+ return;
+ }
gGL.flush();
gDebugProgram.bind();
@@ -4118,7 +4118,7 @@ void LLPipeline::renderPhysicsDisplay()
}
}
glLineWidth(1.f);
- gDebugProgram.unbind();
+ gDebugProgram.unbind();
}
@@ -4128,377 +4128,377 @@ void LLPipeline::renderDebug()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- assertInitialized();
-
- bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD);
-
- if (!hud_only )
- {
- //Render any navmesh geometry
- LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance();
- if ( llPathingLibInstance != NULL )
- {
- //character floater renderables
-
- LLHandle<LLFloaterPathfindingCharacters> pathfindingCharacterHandle = LLFloaterPathfindingCharacters::getInstanceHandle();
- if ( !pathfindingCharacterHandle.isDead() )
- {
- LLFloaterPathfindingCharacters *pathfindingCharacter = pathfindingCharacterHandle.get();
-
- if ( pathfindingCharacter->getVisible() || gAgentCamera.cameraMouselook() )
- {
- gPathfindingProgram.bind();
- gPathfindingProgram.uniform1f(sTint, 1.f);
- gPathfindingProgram.uniform1f(sAmbiance, 1.f);
- gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
-
- //Requried character physics capsule render parameters
- LLUUID id;
- LLVector3 pos;
- LLQuaternion rot;
-
- if ( pathfindingCharacter->isPhysicsCapsuleEnabled( id, pos, rot ) )
- {
- //remove blending artifacts
- gGL.setColorMask(false, false);
- llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
- gGL.setColorMask(true, false);
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
- llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
- gPathfindingProgram.bind();
- }
- }
- }
-
-
- //pathing console renderables
- LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle();
- if (!pathfindingConsoleHandle.isDead())
- {
- LLFloaterPathfindingConsole *pathfindingConsole = pathfindingConsoleHandle.get();
-
- if ( pathfindingConsole->getVisible() || gAgentCamera.cameraMouselook() )
- {
- F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance");
-
- gPathfindingProgram.bind();
-
- gPathfindingProgram.uniform1f(sTint, 1.f);
- gPathfindingProgram.uniform1f(sAmbiance, ambiance);
- gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
-
- if ( !pathfindingConsole->isRenderWorld() )
- {
- const LLColor4 clearColor = gSavedSettings.getColor4("PathfindingNavMeshClear");
- gGL.setColorMask(true, true);
- glClearColor(clearColor.mV[0],clearColor.mV[1],clearColor.mV[2],0);
+ assertInitialized();
+
+ bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD);
+
+ if (!hud_only )
+ {
+ //Render any navmesh geometry
+ LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance();
+ if ( llPathingLibInstance != NULL )
+ {
+ //character floater renderables
+
+ LLHandle<LLFloaterPathfindingCharacters> pathfindingCharacterHandle = LLFloaterPathfindingCharacters::getInstanceHandle();
+ if ( !pathfindingCharacterHandle.isDead() )
+ {
+ LLFloaterPathfindingCharacters *pathfindingCharacter = pathfindingCharacterHandle.get();
+
+ if ( pathfindingCharacter->getVisible() || gAgentCamera.cameraMouselook() )
+ {
+ gPathfindingProgram.bind();
+ gPathfindingProgram.uniform1f(sTint, 1.f);
+ gPathfindingProgram.uniform1f(sAmbiance, 1.f);
+ gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
+
+ //Requried character physics capsule render parameters
+ LLUUID id;
+ LLVector3 pos;
+ LLQuaternion rot;
+
+ if ( pathfindingCharacter->isPhysicsCapsuleEnabled( id, pos, rot ) )
+ {
+ //remove blending artifacts
+ gGL.setColorMask(false, false);
+ llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
+ gGL.setColorMask(true, false);
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
+ llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
+ gPathfindingProgram.bind();
+ }
+ }
+ }
+
+
+ //pathing console renderables
+ LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle();
+ if (!pathfindingConsoleHandle.isDead())
+ {
+ LLFloaterPathfindingConsole *pathfindingConsole = pathfindingConsoleHandle.get();
+
+ if ( pathfindingConsole->getVisible() || gAgentCamera.cameraMouselook() )
+ {
+ F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance");
+
+ gPathfindingProgram.bind();
+
+ gPathfindingProgram.uniform1f(sTint, 1.f);
+ gPathfindingProgram.uniform1f(sAmbiance, ambiance);
+ gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
+
+ if ( !pathfindingConsole->isRenderWorld() )
+ {
+ const LLColor4 clearColor = gSavedSettings.getColor4("PathfindingNavMeshClear");
+ gGL.setColorMask(true, true);
+ glClearColor(clearColor.mV[0],clearColor.mV[1],clearColor.mV[2],0);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // no stencil -- deprecated | GL_STENCIL_BUFFER_BIT);
- gGL.setColorMask(true, false);
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
- }
-
- //NavMesh
- if ( pathfindingConsole->isRenderNavMesh() )
- {
- gGL.flush();
- glLineWidth(2.0f);
- LLGLEnable cull(GL_CULL_FACE);
- LLGLDisable blend(GL_BLEND);
-
- if ( pathfindingConsole->isRenderWorld() )
- {
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.66f);
- llPathingLibInstance->renderNavMesh();
- }
- else
- {
- llPathingLibInstance->renderNavMesh();
- }
-
- //render edges
- gPathfindingNoNormalsProgram.bind();
- gPathfindingNoNormalsProgram.uniform1f(sTint, 1.f);
- gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, 1.f);
- llPathingLibInstance->renderNavMeshEdges();
- gPathfindingProgram.bind();
-
- gGL.flush();
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
- glLineWidth(1.0f);
- gGL.flush();
- }
- //User designated path
- if ( LLPathfindingPathTool::getInstance()->isRenderPath() )
- {
- //The path
- gUIProgram.bind();
- gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
- llPathingLibInstance->renderPath();
- gPathfindingProgram.bind();
+ gGL.setColorMask(true, false);
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+ }
+
+ //NavMesh
+ if ( pathfindingConsole->isRenderNavMesh() )
+ {
+ gGL.flush();
+ glLineWidth(2.0f);
+ LLGLEnable cull(GL_CULL_FACE);
+ LLGLDisable blend(GL_BLEND);
+
+ if ( pathfindingConsole->isRenderWorld() )
+ {
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.66f);
+ llPathingLibInstance->renderNavMesh();
+ }
+ else
+ {
+ llPathingLibInstance->renderNavMesh();
+ }
+
+ //render edges
+ gPathfindingNoNormalsProgram.bind();
+ gPathfindingNoNormalsProgram.uniform1f(sTint, 1.f);
+ gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, 1.f);
+ llPathingLibInstance->renderNavMeshEdges();
+ gPathfindingProgram.bind();
+
+ gGL.flush();
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+ glLineWidth(1.0f);
+ gGL.flush();
+ }
+ //User designated path
+ if ( LLPathfindingPathTool::getInstance()->isRenderPath() )
+ {
+ //The path
+ gUIProgram.bind();
+ gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
+ llPathingLibInstance->renderPath();
+ gPathfindingProgram.bind();
//The bookends
- //remove blending artifacts
- gGL.setColorMask(false, false);
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
-
- gGL.setColorMask(true, false);
- //render the bookends
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
- gPathfindingProgram.bind();
- }
-
- if ( pathfindingConsole->isRenderWaterPlane() )
- {
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
- llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() );
- }
- //physics/exclusion shapes
- if ( pathfindingConsole->isRenderAnyShapes() )
- {
- U32 render_order[] = {
- 1 << LLPathingLib::LLST_ObstacleObjects,
- 1 << LLPathingLib::LLST_WalkableObjects,
- 1 << LLPathingLib::LLST_ExclusionPhantoms,
- 1 << LLPathingLib::LLST_MaterialPhantoms,
- };
-
- U32 flags = pathfindingConsole->getRenderShapeFlags();
-
- for (U32 i = 0; i < 4; i++)
- {
- if (!(flags & render_order[i]))
- {
- continue;
- }
-
- //turn off backface culling for volumes so they are visible when camera is inside volume
- LLGLDisable cull(i >= 2 ? GL_CULL_FACE : 0);
-
- gGL.flush();
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-
- //get rid of some z-fighting
- LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset(1.0f, 1.0f);
-
- //render to depth first to avoid blending artifacts
- gGL.setColorMask(false, false);
- llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
- gGL.setColorMask(true, false);
-
- //get rid of some z-fighting
- glPolygonOffset(0.f, 0.f);
-
- LLGLEnable blend(GL_BLEND);
-
- {
- gPathfindingProgram.uniform1f(sAmbiance, ambiance);
-
- { //draw solid overlay
- LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_LEQUAL);
- llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
- gGL.flush();
- }
-
- LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE);
- glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
-
- F32 offset = gSavedSettings.getF32("PathfindingLineOffset");
-
- if (pathfindingConsole->isRenderXRay())
- {
- gPathfindingProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
- gPathfindingProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
- LLGLEnable blend(GL_BLEND);
- LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
-
- glPolygonOffset(offset, -offset);
-
- if (gSavedSettings.getBOOL("PathfindingXRayWireframe"))
- { //draw hidden wireframe as darker and less opaque
- gPathfindingProgram.uniform1f(sAmbiance, 1.f);
- llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
- }
- else
- {
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
- gPathfindingProgram.uniform1f(sAmbiance, ambiance);
- llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- }
- }
-
- { //draw visible wireframe as brighter, thicker and more opaque
- glPolygonOffset(offset, offset);
- gPathfindingProgram.uniform1f(sAmbiance, 1.f);
- gPathfindingProgram.uniform1f(sTint, 1.f);
- gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
-
- glLineWidth(gSavedSettings.getF32("PathfindingLineWidth"));
- LLGLDisable blendOut(GL_BLEND);
- llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
- gGL.flush();
- glLineWidth(1.f);
- }
-
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
- }
- }
- }
-
- glPolygonOffset(0.f, 0.f);
-
- if ( pathfindingConsole->isRenderNavMesh() && pathfindingConsole->isRenderXRay() )
- { //render navmesh xray
- F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance");
-
- LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE);
- LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
-
- F32 offset = gSavedSettings.getF32("PathfindingLineOffset");
- glPolygonOffset(offset, -offset);
-
- LLGLEnable blend(GL_BLEND);
- LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
- gGL.flush();
- glLineWidth(2.0f);
- LLGLEnable cull(GL_CULL_FACE);
-
- gPathfindingProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
- gPathfindingProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
-
- if (gSavedSettings.getBOOL("PathfindingXRayWireframe"))
- { //draw hidden wireframe as darker and less opaque
- glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
- gPathfindingProgram.uniform1f(sAmbiance, 1.f);
- llPathingLibInstance->renderNavMesh();
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
- }
- else
- {
- gPathfindingProgram.uniform1f(sAmbiance, ambiance);
- llPathingLibInstance->renderNavMesh();
- }
-
- //render edges
- gPathfindingNoNormalsProgram.bind();
- gPathfindingNoNormalsProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
- gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
- llPathingLibInstance->renderNavMeshEdges();
- gPathfindingProgram.bind();
-
- gGL.flush();
- glLineWidth(1.0f);
- }
-
- glPolygonOffset(0.f, 0.f);
-
- gGL.flush();
- gPathfindingProgram.unbind();
- }
- }
- }
- }
-
- gGLLastMatrix = NULL;
- gGL.loadMatrix(gGLModelView);
- gGL.setColorMask(true, false);
-
-
- if (!hud_only && !mDebugBlips.empty())
- { //render debug blips
- gUIProgram.bind();
+ //remove blending artifacts
+ gGL.setColorMask(false, false);
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
+
+ gGL.setColorMask(true, false);
+ //render the bookends
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
+ gPathfindingProgram.bind();
+ }
+
+ if ( pathfindingConsole->isRenderWaterPlane() )
+ {
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
+ llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() );
+ }
+ //physics/exclusion shapes
+ if ( pathfindingConsole->isRenderAnyShapes() )
+ {
+ U32 render_order[] = {
+ 1 << LLPathingLib::LLST_ObstacleObjects,
+ 1 << LLPathingLib::LLST_WalkableObjects,
+ 1 << LLPathingLib::LLST_ExclusionPhantoms,
+ 1 << LLPathingLib::LLST_MaterialPhantoms,
+ };
+
+ U32 flags = pathfindingConsole->getRenderShapeFlags();
+
+ for (U32 i = 0; i < 4; i++)
+ {
+ if (!(flags & render_order[i]))
+ {
+ continue;
+ }
+
+ //turn off backface culling for volumes so they are visible when camera is inside volume
+ LLGLDisable cull(i >= 2 ? GL_CULL_FACE : 0);
+
+ gGL.flush();
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+
+ //get rid of some z-fighting
+ LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(1.0f, 1.0f);
+
+ //render to depth first to avoid blending artifacts
+ gGL.setColorMask(false, false);
+ llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
+ gGL.setColorMask(true, false);
+
+ //get rid of some z-fighting
+ glPolygonOffset(0.f, 0.f);
+
+ LLGLEnable blend(GL_BLEND);
+
+ {
+ gPathfindingProgram.uniform1f(sAmbiance, ambiance);
+
+ { //draw solid overlay
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_LEQUAL);
+ llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
+ gGL.flush();
+ }
+
+ LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE);
+ glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
+
+ F32 offset = gSavedSettings.getF32("PathfindingLineOffset");
+
+ if (pathfindingConsole->isRenderXRay())
+ {
+ gPathfindingProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
+ gPathfindingProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
+ LLGLEnable blend(GL_BLEND);
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
+
+ glPolygonOffset(offset, -offset);
+
+ if (gSavedSettings.getBOOL("PathfindingXRayWireframe"))
+ { //draw hidden wireframe as darker and less opaque
+ gPathfindingProgram.uniform1f(sAmbiance, 1.f);
+ llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
+ }
+ else
+ {
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+ gPathfindingProgram.uniform1f(sAmbiance, ambiance);
+ llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ }
+ }
+
+ { //draw visible wireframe as brighter, thicker and more opaque
+ glPolygonOffset(offset, offset);
+ gPathfindingProgram.uniform1f(sAmbiance, 1.f);
+ gPathfindingProgram.uniform1f(sTint, 1.f);
+ gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
+
+ glLineWidth(gSavedSettings.getF32("PathfindingLineWidth"));
+ LLGLDisable blendOut(GL_BLEND);
+ llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
+ gGL.flush();
+ glLineWidth(1.f);
+ }
+
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+ }
+ }
+ }
+
+ glPolygonOffset(0.f, 0.f);
+
+ if ( pathfindingConsole->isRenderNavMesh() && pathfindingConsole->isRenderXRay() )
+ { //render navmesh xray
+ F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance");
+
+ LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE);
+ LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
+
+ F32 offset = gSavedSettings.getF32("PathfindingLineOffset");
+ glPolygonOffset(offset, -offset);
+
+ LLGLEnable blend(GL_BLEND);
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
+ gGL.flush();
+ glLineWidth(2.0f);
+ LLGLEnable cull(GL_CULL_FACE);
+
+ gPathfindingProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
+ gPathfindingProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
+
+ if (gSavedSettings.getBOOL("PathfindingXRayWireframe"))
+ { //draw hidden wireframe as darker and less opaque
+ glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
+ gPathfindingProgram.uniform1f(sAmbiance, 1.f);
+ llPathingLibInstance->renderNavMesh();
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+ }
+ else
+ {
+ gPathfindingProgram.uniform1f(sAmbiance, ambiance);
+ llPathingLibInstance->renderNavMesh();
+ }
+
+ //render edges
+ gPathfindingNoNormalsProgram.bind();
+ gPathfindingNoNormalsProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
+ gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
+ llPathingLibInstance->renderNavMeshEdges();
+ gPathfindingProgram.bind();
+
+ gGL.flush();
+ glLineWidth(1.0f);
+ }
+
+ glPolygonOffset(0.f, 0.f);
+
+ gGL.flush();
+ gPathfindingProgram.unbind();
+ }
+ }
+ }
+ }
+
+ gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
+ gGL.setColorMask(true, false);
+
+
+ if (!hud_only && !mDebugBlips.empty())
+ { //render debug blips
+ gUIProgram.bind();
gGL.color4f(1, 1, 1, 1);
- gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep, true);
-
- glPointSize(8.f);
- LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
-
- gGL.begin(LLRender::POINTS);
- for (std::list<DebugBlip>::iterator iter = mDebugBlips.begin(); iter != mDebugBlips.end(); )
- {
- DebugBlip& blip = *iter;
-
- blip.mAge += gFrameIntervalSeconds.value();
- if (blip.mAge > 2.f)
- {
- mDebugBlips.erase(iter++);
- }
- else
- {
- iter++;
- }
-
- blip.mPosition.mV[2] += gFrameIntervalSeconds.value()*2.f;
-
- gGL.color4fv(blip.mColor.mV);
- gGL.vertex3fv(blip.mPosition.mV);
- }
- gGL.end();
- gGL.flush();
- glPointSize(1.f);
- }
-
- // Debug stuff.
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- if ( (hud_only && (part->mDrawableType == RENDER_TYPE_HUD || part->mDrawableType == RENDER_TYPE_HUD_PARTICLES)) ||
- (!hud_only && hasRenderType(part->mDrawableType)) )
- {
- part->renderDebug();
- }
- }
- }
- }
-
- for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
- {
- LLSpatialBridge* bridge = *i;
- if (!bridge->isDead() && hasRenderType(bridge->mDrawableType))
- {
- gGL.pushMatrix();
- gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
- bridge->renderDebug();
- gGL.popMatrix();
- }
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
- { //render visible selected group occlusion geometry
- gDebugProgram.bind();
- LLGLDepthTest depth(GL_TRUE, GL_FALSE);
- gGL.diffuseColor3f(1,0,1);
- for (std::set<LLSpatialGroup*>::iterator iter = visible_selected_groups.begin(); iter != visible_selected_groups.end(); ++iter)
- {
- LLSpatialGroup* group = *iter;
-
- LLVector4a fudge;
- fudge.splat(0.25f); //SG_OCCLUSION_FUDGE
-
- LLVector4a size;
- const LLVector4a* bounds = group->getBounds();
- size.setAdd(fudge, bounds[1]);
-
- drawBox(bounds[0], size);
- }
- }
-
- visible_selected_groups.clear();
+ gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep, true);
+
+ glPointSize(8.f);
+ LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
+
+ gGL.begin(LLRender::POINTS);
+ for (std::list<DebugBlip>::iterator iter = mDebugBlips.begin(); iter != mDebugBlips.end(); )
+ {
+ DebugBlip& blip = *iter;
+
+ blip.mAge += gFrameIntervalSeconds.value();
+ if (blip.mAge > 2.f)
+ {
+ mDebugBlips.erase(iter++);
+ }
+ else
+ {
+ iter++;
+ }
+
+ blip.mPosition.mV[2] += gFrameIntervalSeconds.value()*2.f;
+
+ gGL.color4fv(blip.mColor.mV);
+ gGL.vertex3fv(blip.mPosition.mV);
+ }
+ gGL.end();
+ gGL.flush();
+ glPointSize(1.f);
+ }
+
+ // Debug stuff.
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
+ {
+ if ( (hud_only && (part->mDrawableType == RENDER_TYPE_HUD || part->mDrawableType == RENDER_TYPE_HUD_PARTICLES)) ||
+ (!hud_only && hasRenderType(part->mDrawableType)) )
+ {
+ part->renderDebug();
+ }
+ }
+ }
+ }
+
+ for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
+ {
+ LLSpatialBridge* bridge = *i;
+ if (!bridge->isDead() && hasRenderType(bridge->mDrawableType))
+ {
+ gGL.pushMatrix();
+ gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
+ bridge->renderDebug();
+ gGL.popMatrix();
+ }
+ }
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
+ { //render visible selected group occlusion geometry
+ gDebugProgram.bind();
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE);
+ gGL.diffuseColor3f(1,0,1);
+ for (std::set<LLSpatialGroup*>::iterator iter = visible_selected_groups.begin(); iter != visible_selected_groups.end(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+
+ LLVector4a fudge;
+ fudge.splat(0.25f); //SG_OCCLUSION_FUDGE
+
+ LLVector4a size;
+ const LLVector4a* bounds = group->getBounds();
+ size.setAdd(fudge, bounds[1]);
+
+ drawBox(bounds[0], size);
+ }
+ }
+
+ visible_selected_groups.clear();
//draw reflection probes and links between them
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_REFLECTION_PROBES) && !hud_only)
@@ -4521,372 +4521,372 @@ void LLPipeline::renderDebug()
unbindDeferredShader(gReflectionProbeDisplayProgram);
}
- gUIProgram.bind();
-
- if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST) && !hud_only)
- { //draw crosshairs on particle intersection
- if (gDebugRaycastParticle)
- {
- gDebugProgram.bind();
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- LLVector3 center(gDebugRaycastParticleIntersection.getF32ptr());
- LLVector3 size(0.1f, 0.1f, 0.1f);
-
- LLVector3 p[6];
-
- p[0] = center + size.scaledVec(LLVector3(1,0,0));
- p[1] = center + size.scaledVec(LLVector3(-1,0,0));
- p[2] = center + size.scaledVec(LLVector3(0,1,0));
- p[3] = center + size.scaledVec(LLVector3(0,-1,0));
- p[4] = center + size.scaledVec(LLVector3(0,0,1));
- p[5] = center + size.scaledVec(LLVector3(0,0,-1));
-
- gGL.begin(LLRender::LINES);
- gGL.diffuseColor3f(1.f, 1.f, 0.f);
- for (U32 i = 0; i < 6; i++)
- {
- gGL.vertex3fv(p[i].mV);
- }
- gGL.end();
- gGL.flush();
-
- gDebugProgram.unbind();
- }
- }
-
- if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !hud_only)
- {
- LLVertexBuffer::unbind();
-
- LLGLEnable blend(GL_BLEND);
- LLGLDepthTest depth(TRUE, FALSE);
- LLGLDisable cull(GL_CULL_FACE);
-
- gGL.color4f(1,1,1,1);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- F32 a = 0.1f;
-
- F32 col[] =
- {
- 1,0,0,a,
- 0,1,0,a,
- 0,0,1,a,
- 1,0,1,a,
-
- 1,1,0,a,
- 0,1,1,a,
- 1,1,1,a,
- 1,0,1,a,
- };
-
- for (U32 i = 0; i < 8; i++)
- {
- LLVector3* frust = mShadowCamera[i].mAgentFrustum;
-
- if (i > 3)
- { //render shadow frusta as volumes
- if (mShadowFrustPoints[i-4].empty())
- {
- continue;
- }
-
- gGL.color4fv(col+(i-4)*4);
-
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[4].mV);
- gGL.vertex3fv(frust[1].mV); gGL.vertex3fv(frust[5].mV);
- gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[6].mV);
- gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[7].mV);
- gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[4].mV);
- gGL.end();
-
-
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3fv(frust[0].mV);
- gGL.vertex3fv(frust[1].mV);
- gGL.vertex3fv(frust[3].mV);
- gGL.vertex3fv(frust[2].mV);
- gGL.end();
-
- gGL.begin(LLRender::TRIANGLE_STRIP);
- gGL.vertex3fv(frust[4].mV);
- gGL.vertex3fv(frust[5].mV);
- gGL.vertex3fv(frust[7].mV);
- gGL.vertex3fv(frust[6].mV);
- gGL.end();
- }
-
-
- if (i < 4)
- {
-
- //if (i == 0 || !mShadowFrustPoints[i].empty())
- {
- //render visible point cloud
- gGL.flush();
- glPointSize(8.f);
- gGL.begin(LLRender::POINTS);
-
- F32* c = col+i*4;
- gGL.color3fv(c);
-
- for (U32 j = 0; j < mShadowFrustPoints[i].size(); ++j)
- {
- gGL.vertex3fv(mShadowFrustPoints[i][j].mV);
-
- }
- gGL.end();
-
- gGL.flush();
- glPointSize(1.f);
-
- LLVector3* ext = mShadowExtents[i];
- LLVector3 pos = (ext[0]+ext[1])*0.5f;
- LLVector3 size = (ext[1]-ext[0])*0.5f;
- drawBoxOutline(pos, size);
-
- //render camera frustum splits as outlines
- gGL.begin(LLRender::LINES);
- gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[1].mV);
- gGL.vertex3fv(frust[1].mV); gGL.vertex3fv(frust[2].mV);
- gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[3].mV);
- gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[0].mV);
- gGL.vertex3fv(frust[4].mV); gGL.vertex3fv(frust[5].mV);
- gGL.vertex3fv(frust[5].mV); gGL.vertex3fv(frust[6].mV);
- gGL.vertex3fv(frust[6].mV); gGL.vertex3fv(frust[7].mV);
- gGL.vertex3fv(frust[7].mV); gGL.vertex3fv(frust[4].mV);
- gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[4].mV);
- gGL.vertex3fv(frust[1].mV); gGL.vertex3fv(frust[5].mV);
- gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[6].mV);
- gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[7].mV);
- gGL.end();
- }
- }
-
- /*gGL.flush();
- glLineWidth(16-i*2);
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
- for (U32 j = 0; j < LLViewerRegion::NUM_PARTITIONS; j++)
- {
- LLSpatialPartition* part = region->getSpatialPartition(j);
- if (part)
- {
- if (hasRenderType(part->mDrawableType))
- {
- part->renderIntersectingBBoxes(&mShadowCamera[i]);
- }
- }
- }
- }
- gGL.flush();
- glLineWidth(1.f);*/
- }
- }
-
- if (mRenderDebugMask & RENDER_DEBUG_WIND_VECTORS)
- {
- gAgent.getRegion()->mWind.renderVectors();
- }
-
- if (mRenderDebugMask & RENDER_DEBUG_COMPOSITION)
- {
- // Debug composition layers
- F32 x, y;
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- if (gAgent.getRegion())
- {
- gGL.begin(LLRender::POINTS);
- // Draw the composition layer for the region that I'm in.
- for (x = 0; x <= 260; x++)
- {
- for (y = 0; y <= 260; y++)
- {
- if ((x > 255) || (y > 255))
- {
- gGL.color4f(1.f, 0.f, 0.f, 1.f);
- }
- else
- {
- gGL.color4f(0.f, 0.f, 1.f, 1.f);
- }
- F32 z = gAgent.getRegion()->getCompositionXY((S32)x, (S32)y);
- z *= 5.f;
- z += 50.f;
- gGL.vertex3f(x, y, z);
- }
- }
- gGL.end();
- }
- }
-
- gGL.flush();
- gUIProgram.unbind();
+ gUIProgram.bind();
+
+ if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST) && !hud_only)
+ { //draw crosshairs on particle intersection
+ if (gDebugRaycastParticle)
+ {
+ gDebugProgram.bind();
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ LLVector3 center(gDebugRaycastParticleIntersection.getF32ptr());
+ LLVector3 size(0.1f, 0.1f, 0.1f);
+
+ LLVector3 p[6];
+
+ p[0] = center + size.scaledVec(LLVector3(1,0,0));
+ p[1] = center + size.scaledVec(LLVector3(-1,0,0));
+ p[2] = center + size.scaledVec(LLVector3(0,1,0));
+ p[3] = center + size.scaledVec(LLVector3(0,-1,0));
+ p[4] = center + size.scaledVec(LLVector3(0,0,1));
+ p[5] = center + size.scaledVec(LLVector3(0,0,-1));
+
+ gGL.begin(LLRender::LINES);
+ gGL.diffuseColor3f(1.f, 1.f, 0.f);
+ for (U32 i = 0; i < 6; i++)
+ {
+ gGL.vertex3fv(p[i].mV);
+ }
+ gGL.end();
+ gGL.flush();
+
+ gDebugProgram.unbind();
+ }
+ }
+
+ if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !hud_only)
+ {
+ LLVertexBuffer::unbind();
+
+ LLGLEnable blend(GL_BLEND);
+ LLGLDepthTest depth(TRUE, FALSE);
+ LLGLDisable cull(GL_CULL_FACE);
+
+ gGL.color4f(1,1,1,1);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ F32 a = 0.1f;
+
+ F32 col[] =
+ {
+ 1,0,0,a,
+ 0,1,0,a,
+ 0,0,1,a,
+ 1,0,1,a,
+
+ 1,1,0,a,
+ 0,1,1,a,
+ 1,1,1,a,
+ 1,0,1,a,
+ };
+
+ for (U32 i = 0; i < 8; i++)
+ {
+ LLVector3* frust = mShadowCamera[i].mAgentFrustum;
+
+ if (i > 3)
+ { //render shadow frusta as volumes
+ if (mShadowFrustPoints[i-4].empty())
+ {
+ continue;
+ }
+
+ gGL.color4fv(col+(i-4)*4);
+
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[4].mV);
+ gGL.vertex3fv(frust[1].mV); gGL.vertex3fv(frust[5].mV);
+ gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[6].mV);
+ gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[7].mV);
+ gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[4].mV);
+ gGL.end();
+
+
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3fv(frust[0].mV);
+ gGL.vertex3fv(frust[1].mV);
+ gGL.vertex3fv(frust[3].mV);
+ gGL.vertex3fv(frust[2].mV);
+ gGL.end();
+
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex3fv(frust[4].mV);
+ gGL.vertex3fv(frust[5].mV);
+ gGL.vertex3fv(frust[7].mV);
+ gGL.vertex3fv(frust[6].mV);
+ gGL.end();
+ }
+
+
+ if (i < 4)
+ {
+
+ //if (i == 0 || !mShadowFrustPoints[i].empty())
+ {
+ //render visible point cloud
+ gGL.flush();
+ glPointSize(8.f);
+ gGL.begin(LLRender::POINTS);
+
+ F32* c = col+i*4;
+ gGL.color3fv(c);
+
+ for (U32 j = 0; j < mShadowFrustPoints[i].size(); ++j)
+ {
+ gGL.vertex3fv(mShadowFrustPoints[i][j].mV);
+
+ }
+ gGL.end();
+
+ gGL.flush();
+ glPointSize(1.f);
+
+ LLVector3* ext = mShadowExtents[i];
+ LLVector3 pos = (ext[0]+ext[1])*0.5f;
+ LLVector3 size = (ext[1]-ext[0])*0.5f;
+ drawBoxOutline(pos, size);
+
+ //render camera frustum splits as outlines
+ gGL.begin(LLRender::LINES);
+ gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[1].mV);
+ gGL.vertex3fv(frust[1].mV); gGL.vertex3fv(frust[2].mV);
+ gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[3].mV);
+ gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[0].mV);
+ gGL.vertex3fv(frust[4].mV); gGL.vertex3fv(frust[5].mV);
+ gGL.vertex3fv(frust[5].mV); gGL.vertex3fv(frust[6].mV);
+ gGL.vertex3fv(frust[6].mV); gGL.vertex3fv(frust[7].mV);
+ gGL.vertex3fv(frust[7].mV); gGL.vertex3fv(frust[4].mV);
+ gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[4].mV);
+ gGL.vertex3fv(frust[1].mV); gGL.vertex3fv(frust[5].mV);
+ gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[6].mV);
+ gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[7].mV);
+ gGL.end();
+ }
+ }
+
+ /*gGL.flush();
+ glLineWidth(16-i*2);
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+ for (U32 j = 0; j < LLViewerRegion::NUM_PARTITIONS; j++)
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(j);
+ if (part)
+ {
+ if (hasRenderType(part->mDrawableType))
+ {
+ part->renderIntersectingBBoxes(&mShadowCamera[i]);
+ }
+ }
+ }
+ }
+ gGL.flush();
+ glLineWidth(1.f);*/
+ }
+ }
+
+ if (mRenderDebugMask & RENDER_DEBUG_WIND_VECTORS)
+ {
+ gAgent.getRegion()->mWind.renderVectors();
+ }
+
+ if (mRenderDebugMask & RENDER_DEBUG_COMPOSITION)
+ {
+ // Debug composition layers
+ F32 x, y;
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ if (gAgent.getRegion())
+ {
+ gGL.begin(LLRender::POINTS);
+ // Draw the composition layer for the region that I'm in.
+ for (x = 0; x <= 260; x++)
+ {
+ for (y = 0; y <= 260; y++)
+ {
+ if ((x > 255) || (y > 255))
+ {
+ gGL.color4f(1.f, 0.f, 0.f, 1.f);
+ }
+ else
+ {
+ gGL.color4f(0.f, 0.f, 1.f, 1.f);
+ }
+ F32 z = gAgent.getRegion()->getCompositionXY((S32)x, (S32)y);
+ z *= 5.f;
+ z += 50.f;
+ gGL.vertex3f(x, y, z);
+ }
+ }
+ gGL.end();
+ }
+ }
+
+ gGL.flush();
+ gUIProgram.unbind();
}
void LLPipeline::rebuildPools()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- assertInitialized();
-
- S32 max_count = mPools.size();
- pool_set_t::iterator iter1 = mPools.upper_bound(mLastRebuildPool);
- while(max_count > 0 && mPools.size() > 0) // && num_rebuilds < MAX_REBUILDS)
- {
- if (iter1 == mPools.end())
- {
- iter1 = mPools.begin();
- }
- LLDrawPool* poolp = *iter1;
-
- if (poolp->isDead())
- {
- mPools.erase(iter1++);
- removeFromQuickLookup( poolp );
- if (poolp == mLastRebuildPool)
- {
- mLastRebuildPool = NULL;
- }
- delete poolp;
- }
- else
- {
- mLastRebuildPool = poolp;
- iter1++;
- }
- max_count--;
- }
+ assertInitialized();
+
+ S32 max_count = mPools.size();
+ pool_set_t::iterator iter1 = mPools.upper_bound(mLastRebuildPool);
+ while(max_count > 0 && mPools.size() > 0) // && num_rebuilds < MAX_REBUILDS)
+ {
+ if (iter1 == mPools.end())
+ {
+ iter1 = mPools.begin();
+ }
+ LLDrawPool* poolp = *iter1;
+
+ if (poolp->isDead())
+ {
+ mPools.erase(iter1++);
+ removeFromQuickLookup( poolp );
+ if (poolp == mLastRebuildPool)
+ {
+ mLastRebuildPool = NULL;
+ }
+ delete poolp;
+ }
+ else
+ {
+ mLastRebuildPool = poolp;
+ iter1++;
+ }
+ max_count--;
+ }
}
void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp )
{
- assertInitialized();
-
- switch( new_poolp->getType() )
- {
- case LLDrawPool::POOL_SIMPLE:
- if (mSimplePool)
- {
- llassert(0);
- LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL;
- }
- else
- {
- mSimplePool = (LLRenderPass*) new_poolp;
- }
- break;
-
- case LLDrawPool::POOL_ALPHA_MASK:
- if (mAlphaMaskPool)
- {
- llassert(0);
- LL_WARNS() << "Ignoring duplicate alpha mask pool." << LL_ENDL;
- break;
- }
- else
- {
- mAlphaMaskPool = (LLRenderPass*) new_poolp;
- }
- break;
-
- case LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK:
- if (mFullbrightAlphaMaskPool)
- {
- llassert(0);
- LL_WARNS() << "Ignoring duplicate alpha mask pool." << LL_ENDL;
- break;
- }
- else
- {
- mFullbrightAlphaMaskPool = (LLRenderPass*) new_poolp;
- }
- break;
-
- case LLDrawPool::POOL_GRASS:
- if (mGrassPool)
- {
- llassert(0);
- LL_WARNS() << "Ignoring duplicate grass pool." << LL_ENDL;
- }
- else
- {
- mGrassPool = (LLRenderPass*) new_poolp;
- }
- break;
-
- case LLDrawPool::POOL_FULLBRIGHT:
- if (mFullbrightPool)
- {
- llassert(0);
- LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL;
- }
- else
- {
- mFullbrightPool = (LLRenderPass*) new_poolp;
- }
- break;
-
- case LLDrawPool::POOL_GLOW:
- if (mGlowPool)
- {
- llassert(0);
- LL_WARNS() << "Ignoring duplicate glow pool." << LL_ENDL;
- }
- else
- {
- mGlowPool = (LLRenderPass*) new_poolp;
- }
- break;
-
- case LLDrawPool::POOL_TREE:
- mTreePools[ uintptr_t(new_poolp->getTexture()) ] = new_poolp ;
- break;
-
- case LLDrawPool::POOL_TERRAIN:
- mTerrainPools[ uintptr_t(new_poolp->getTexture()) ] = new_poolp ;
- break;
-
- case LLDrawPool::POOL_BUMP:
- if (mBumpPool)
- {
- llassert(0);
- LL_WARNS() << "Ignoring duplicate bump pool." << LL_ENDL;
- }
- else
- {
- mBumpPool = new_poolp;
- }
- break;
- case LLDrawPool::POOL_MATERIALS:
- if (mMaterialsPool)
- {
- llassert(0);
- LL_WARNS() << "Ignorning duplicate materials pool." << LL_ENDL;
- }
- else
- {
- mMaterialsPool = new_poolp;
- }
- break;
- case LLDrawPool::POOL_ALPHA_PRE_WATER:
- if( mAlphaPoolPreWater )
- {
- llassert(0);
- LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Alpha pre-water pool" << LL_ENDL;
- }
- else
- {
- mAlphaPoolPreWater = (LLDrawPoolAlpha*) new_poolp;
- }
- break;
+ assertInitialized();
+
+ switch( new_poolp->getType() )
+ {
+ case LLDrawPool::POOL_SIMPLE:
+ if (mSimplePool)
+ {
+ llassert(0);
+ LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL;
+ }
+ else
+ {
+ mSimplePool = (LLRenderPass*) new_poolp;
+ }
+ break;
+
+ case LLDrawPool::POOL_ALPHA_MASK:
+ if (mAlphaMaskPool)
+ {
+ llassert(0);
+ LL_WARNS() << "Ignoring duplicate alpha mask pool." << LL_ENDL;
+ break;
+ }
+ else
+ {
+ mAlphaMaskPool = (LLRenderPass*) new_poolp;
+ }
+ break;
+
+ case LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK:
+ if (mFullbrightAlphaMaskPool)
+ {
+ llassert(0);
+ LL_WARNS() << "Ignoring duplicate alpha mask pool." << LL_ENDL;
+ break;
+ }
+ else
+ {
+ mFullbrightAlphaMaskPool = (LLRenderPass*) new_poolp;
+ }
+ break;
+
+ case LLDrawPool::POOL_GRASS:
+ if (mGrassPool)
+ {
+ llassert(0);
+ LL_WARNS() << "Ignoring duplicate grass pool." << LL_ENDL;
+ }
+ else
+ {
+ mGrassPool = (LLRenderPass*) new_poolp;
+ }
+ break;
+
+ case LLDrawPool::POOL_FULLBRIGHT:
+ if (mFullbrightPool)
+ {
+ llassert(0);
+ LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL;
+ }
+ else
+ {
+ mFullbrightPool = (LLRenderPass*) new_poolp;
+ }
+ break;
+
+ case LLDrawPool::POOL_GLOW:
+ if (mGlowPool)
+ {
+ llassert(0);
+ LL_WARNS() << "Ignoring duplicate glow pool." << LL_ENDL;
+ }
+ else
+ {
+ mGlowPool = (LLRenderPass*) new_poolp;
+ }
+ break;
+
+ case LLDrawPool::POOL_TREE:
+ mTreePools[ uintptr_t(new_poolp->getTexture()) ] = new_poolp ;
+ break;
+
+ case LLDrawPool::POOL_TERRAIN:
+ mTerrainPools[ uintptr_t(new_poolp->getTexture()) ] = new_poolp ;
+ break;
+
+ case LLDrawPool::POOL_BUMP:
+ if (mBumpPool)
+ {
+ llassert(0);
+ LL_WARNS() << "Ignoring duplicate bump pool." << LL_ENDL;
+ }
+ else
+ {
+ mBumpPool = new_poolp;
+ }
+ break;
+ case LLDrawPool::POOL_MATERIALS:
+ if (mMaterialsPool)
+ {
+ llassert(0);
+ LL_WARNS() << "Ignorning duplicate materials pool." << LL_ENDL;
+ }
+ else
+ {
+ mMaterialsPool = new_poolp;
+ }
+ break;
+ case LLDrawPool::POOL_ALPHA_PRE_WATER:
+ if( mAlphaPoolPreWater )
+ {
+ llassert(0);
+ LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Alpha pre-water pool" << LL_ENDL;
+ }
+ else
+ {
+ mAlphaPoolPreWater = (LLDrawPoolAlpha*) new_poolp;
+ }
+ break;
case LLDrawPool::POOL_ALPHA_POST_WATER:
if (mAlphaPoolPostWater)
{
@@ -4899,45 +4899,45 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp )
}
break;
- case LLDrawPool::POOL_AVATAR:
- case LLDrawPool::POOL_CONTROL_AV:
- break; // Do nothing
-
- case LLDrawPool::POOL_SKY:
- if( mSkyPool )
- {
- llassert(0);
- LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Sky pool" << LL_ENDL;
- }
- else
- {
- mSkyPool = new_poolp;
- }
- break;
-
- case LLDrawPool::POOL_WATER:
- if( mWaterPool )
- {
- llassert(0);
- LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Water pool" << LL_ENDL;
- }
- else
- {
- mWaterPool = new_poolp;
- }
- break;
-
- case LLDrawPool::POOL_WL_SKY:
- if( mWLSkyPool )
- {
- llassert(0);
- LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate WLSky Pool" << LL_ENDL;
- }
- else
- {
- mWLSkyPool = new_poolp;
- }
- break;
+ case LLDrawPool::POOL_AVATAR:
+ case LLDrawPool::POOL_CONTROL_AV:
+ break; // Do nothing
+
+ case LLDrawPool::POOL_SKY:
+ if( mSkyPool )
+ {
+ llassert(0);
+ LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Sky pool" << LL_ENDL;
+ }
+ else
+ {
+ mSkyPool = new_poolp;
+ }
+ break;
+
+ case LLDrawPool::POOL_WATER:
+ if( mWaterPool )
+ {
+ llassert(0);
+ LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Water pool" << LL_ENDL;
+ }
+ else
+ {
+ mWaterPool = new_poolp;
+ }
+ break;
+
+ case LLDrawPool::POOL_WL_SKY:
+ if( mWLSkyPool )
+ {
+ llassert(0);
+ LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate WLSky Pool" << LL_ENDL;
+ }
+ else
+ {
+ mWLSkyPool = new_poolp;
+ }
+ break;
case LLDrawPool::POOL_GLTF_PBR:
if( mPBROpaquePool )
@@ -4964,116 +4964,116 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp )
break;
- default:
- llassert(0);
- LL_WARNS() << "Invalid Pool Type in LLPipeline::addPool()" << LL_ENDL;
- break;
- }
+ default:
+ llassert(0);
+ LL_WARNS() << "Invalid Pool Type in LLPipeline::addPool()" << LL_ENDL;
+ break;
+ }
}
void LLPipeline::removePool( LLDrawPool* poolp )
{
- assertInitialized();
- removeFromQuickLookup(poolp);
- mPools.erase(poolp);
- delete poolp;
+ assertInitialized();
+ removeFromQuickLookup(poolp);
+ mPools.erase(poolp);
+ delete poolp;
}
void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp )
{
- assertInitialized();
- switch( poolp->getType() )
- {
- case LLDrawPool::POOL_SIMPLE:
- llassert(mSimplePool == poolp);
- mSimplePool = NULL;
- break;
-
- case LLDrawPool::POOL_ALPHA_MASK:
- llassert(mAlphaMaskPool == poolp);
- mAlphaMaskPool = NULL;
- break;
-
- case LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK:
- llassert(mFullbrightAlphaMaskPool == poolp);
- mFullbrightAlphaMaskPool = NULL;
- break;
-
- case LLDrawPool::POOL_GRASS:
- llassert(mGrassPool == poolp);
- mGrassPool = NULL;
- break;
-
- case LLDrawPool::POOL_FULLBRIGHT:
- llassert(mFullbrightPool == poolp);
- mFullbrightPool = NULL;
- break;
-
- case LLDrawPool::POOL_WL_SKY:
- llassert(mWLSkyPool == poolp);
- mWLSkyPool = NULL;
- break;
-
- case LLDrawPool::POOL_GLOW:
- llassert(mGlowPool == poolp);
- mGlowPool = NULL;
- break;
-
- case LLDrawPool::POOL_TREE:
- #ifdef _DEBUG
- {
- bool found = mTreePools.erase( (uintptr_t)poolp->getTexture() );
- llassert( found );
- }
- #else
- mTreePools.erase( (uintptr_t)poolp->getTexture() );
- #endif
- break;
-
- case LLDrawPool::POOL_TERRAIN:
- #ifdef _DEBUG
- {
- bool found = mTerrainPools.erase( (uintptr_t)poolp->getTexture() );
- llassert( found );
- }
- #else
- mTerrainPools.erase( (uintptr_t)poolp->getTexture() );
- #endif
- break;
-
- case LLDrawPool::POOL_BUMP:
- llassert( poolp == mBumpPool );
- mBumpPool = NULL;
- break;
-
- case LLDrawPool::POOL_MATERIALS:
- llassert(poolp == mMaterialsPool);
- mMaterialsPool = NULL;
- break;
-
- case LLDrawPool::POOL_ALPHA_PRE_WATER:
- llassert( poolp == mAlphaPoolPreWater );
- mAlphaPoolPreWater = nullptr;
- break;
-
+ assertInitialized();
+ switch( poolp->getType() )
+ {
+ case LLDrawPool::POOL_SIMPLE:
+ llassert(mSimplePool == poolp);
+ mSimplePool = NULL;
+ break;
+
+ case LLDrawPool::POOL_ALPHA_MASK:
+ llassert(mAlphaMaskPool == poolp);
+ mAlphaMaskPool = NULL;
+ break;
+
+ case LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK:
+ llassert(mFullbrightAlphaMaskPool == poolp);
+ mFullbrightAlphaMaskPool = NULL;
+ break;
+
+ case LLDrawPool::POOL_GRASS:
+ llassert(mGrassPool == poolp);
+ mGrassPool = NULL;
+ break;
+
+ case LLDrawPool::POOL_FULLBRIGHT:
+ llassert(mFullbrightPool == poolp);
+ mFullbrightPool = NULL;
+ break;
+
+ case LLDrawPool::POOL_WL_SKY:
+ llassert(mWLSkyPool == poolp);
+ mWLSkyPool = NULL;
+ break;
+
+ case LLDrawPool::POOL_GLOW:
+ llassert(mGlowPool == poolp);
+ mGlowPool = NULL;
+ break;
+
+ case LLDrawPool::POOL_TREE:
+ #ifdef _DEBUG
+ {
+ bool found = mTreePools.erase( (uintptr_t)poolp->getTexture() );
+ llassert( found );
+ }
+ #else
+ mTreePools.erase( (uintptr_t)poolp->getTexture() );
+ #endif
+ break;
+
+ case LLDrawPool::POOL_TERRAIN:
+ #ifdef _DEBUG
+ {
+ bool found = mTerrainPools.erase( (uintptr_t)poolp->getTexture() );
+ llassert( found );
+ }
+ #else
+ mTerrainPools.erase( (uintptr_t)poolp->getTexture() );
+ #endif
+ break;
+
+ case LLDrawPool::POOL_BUMP:
+ llassert( poolp == mBumpPool );
+ mBumpPool = NULL;
+ break;
+
+ case LLDrawPool::POOL_MATERIALS:
+ llassert(poolp == mMaterialsPool);
+ mMaterialsPool = NULL;
+ break;
+
+ case LLDrawPool::POOL_ALPHA_PRE_WATER:
+ llassert( poolp == mAlphaPoolPreWater );
+ mAlphaPoolPreWater = nullptr;
+ break;
+
case LLDrawPool::POOL_ALPHA_POST_WATER:
llassert(poolp == mAlphaPoolPostWater);
mAlphaPoolPostWater = nullptr;
break;
- case LLDrawPool::POOL_AVATAR:
- case LLDrawPool::POOL_CONTROL_AV:
- break; // Do nothing
+ case LLDrawPool::POOL_AVATAR:
+ case LLDrawPool::POOL_CONTROL_AV:
+ break; // Do nothing
- case LLDrawPool::POOL_SKY:
- llassert( poolp == mSkyPool );
- mSkyPool = NULL;
- break;
+ case LLDrawPool::POOL_SKY:
+ llassert( poolp == mSkyPool );
+ mSkyPool = NULL;
+ break;
- case LLDrawPool::POOL_WATER:
- llassert( poolp == mWaterPool );
- mWaterPool = NULL;
- break;
+ case LLDrawPool::POOL_WATER:
+ llassert( poolp == mWaterPool );
+ mWaterPool = NULL;
+ break;
case LLDrawPool::POOL_GLTF_PBR:
llassert( poolp == mPBROpaquePool );
@@ -5085,23 +5085,23 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp )
mPBRAlphaMaskPool = NULL;
break;
- default:
- llassert(0);
- LL_WARNS() << "Invalid Pool Type in LLPipeline::removeFromQuickLookup() type=" << poolp->getType() << LL_ENDL;
- break;
- }
+ default:
+ llassert(0);
+ LL_WARNS() << "Invalid Pool Type in LLPipeline::removeFromQuickLookup() type=" << poolp->getType() << LL_ENDL;
+ break;
+ }
}
void LLPipeline::resetDrawOrders()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- assertInitialized();
- // Iterate through all of the draw pools and rebuild them.
- for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
- {
- LLDrawPool *poolp = *iter;
- poolp->resetDrawOrders();
- }
+ assertInitialized();
+ // Iterate through all of the draw pools and rebuild them.
+ for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
+ {
+ LLDrawPool *poolp = *iter;
+ poolp->resetDrawOrders();
+ }
}
//============================================================================
@@ -5110,7 +5110,7 @@ void LLPipeline::resetDrawOrders()
void LLPipeline::setupAvatarLights(bool for_edit)
{
- assertInitialized();
+ assertInitialized();
LLEnvironment& environment = LLEnvironment::instance();
LLSettingsSky::ptr_t psky = environment.getCurrentSky();
@@ -5118,130 +5118,130 @@ void LLPipeline::setupAvatarLights(bool for_edit)
bool sun_up = environment.getIsSunUp();
- if (for_edit)
- {
- LLColor4 diffuse(1.f, 1.f, 1.f, 0.f);
- LLVector4 light_pos_cam(-8.f, 0.25f, 10.f, 0.f); // w==0 => directional light
- LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview();
- LLMatrix4 camera_rot(camera_mat.getMat3());
- camera_rot.invert();
- LLVector4 light_pos = light_pos_cam * camera_rot;
-
- light_pos.normalize();
-
- LLLightState* light = gGL.getLight(1);
-
- mHWLightColors[1] = diffuse;
-
- light->setDiffuse(diffuse);
- light->setAmbient(LLColor4::black);
- light->setSpecular(LLColor4::black);
- light->setPosition(light_pos);
- light->setConstantAttenuation(1.f);
- light->setLinearAttenuation(0.f);
- light->setQuadraticAttenuation(0.f);
- light->setSpotExponent(0.f);
- light->setSpotCutoff(180.f);
- }
- else if (gAvatarBacklight) // Always true (unless overridden in a devs .ini)
- {
+ if (for_edit)
+ {
+ LLColor4 diffuse(1.f, 1.f, 1.f, 0.f);
+ LLVector4 light_pos_cam(-8.f, 0.25f, 10.f, 0.f); // w==0 => directional light
+ LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview();
+ LLMatrix4 camera_rot(camera_mat.getMat3());
+ camera_rot.invert();
+ LLVector4 light_pos = light_pos_cam * camera_rot;
+
+ light_pos.normalize();
+
+ LLLightState* light = gGL.getLight(1);
+
+ mHWLightColors[1] = diffuse;
+
+ light->setDiffuse(diffuse);
+ light->setAmbient(LLColor4::black);
+ light->setSpecular(LLColor4::black);
+ light->setPosition(light_pos);
+ light->setConstantAttenuation(1.f);
+ light->setLinearAttenuation(0.f);
+ light->setQuadraticAttenuation(0.f);
+ light->setSpotExponent(0.f);
+ light->setSpotCutoff(180.f);
+ }
+ else if (gAvatarBacklight) // Always true (unless overridden in a devs .ini)
+ {
LLVector3 light_dir = sun_up ? LLVector3(mSunDir) : LLVector3(mMoonDir);
- LLVector3 opposite_pos = -light_dir;
- LLVector3 orthog_light_pos = light_dir % LLVector3::z_axis;
- LLVector4 backlight_pos = LLVector4(lerp(opposite_pos, orthog_light_pos, 0.3f), 0.0f);
- backlight_pos.normalize();
-
- LLColor4 light_diffuse = sun_up ? mSunDiffuse : mMoonDiffuse;
-
- LLColor4 backlight_diffuse(1.f - light_diffuse.mV[VRED], 1.f - light_diffuse.mV[VGREEN], 1.f - light_diffuse.mV[VBLUE], 1.f);
- F32 max_component = 0.001f;
- for (S32 i = 0; i < 3; i++)
- {
- if (backlight_diffuse.mV[i] > max_component)
- {
- max_component = backlight_diffuse.mV[i];
- }
- }
- F32 backlight_mag;
- if (LLEnvironment::instance().getIsSunUp())
- {
- backlight_mag = BACKLIGHT_DAY_MAGNITUDE_OBJECT;
- }
- else
- {
- backlight_mag = BACKLIGHT_NIGHT_MAGNITUDE_OBJECT;
- }
- backlight_diffuse *= backlight_mag / max_component;
-
- mHWLightColors[1] = backlight_diffuse;
-
- LLLightState* light = gGL.getLight(1);
-
- light->setPosition(backlight_pos);
- light->setDiffuse(backlight_diffuse);
- light->setAmbient(LLColor4::black);
- light->setSpecular(LLColor4::black);
- light->setConstantAttenuation(1.f);
- light->setLinearAttenuation(0.f);
- light->setQuadraticAttenuation(0.f);
- light->setSpotExponent(0.f);
- light->setSpotCutoff(180.f);
- }
- else
- {
- LLLightState* light = gGL.getLight(1);
-
- mHWLightColors[1] = LLColor4::black;
-
- light->setDiffuse(LLColor4::black);
- light->setAmbient(LLColor4::black);
- light->setSpecular(LLColor4::black);
- }
+ LLVector3 opposite_pos = -light_dir;
+ LLVector3 orthog_light_pos = light_dir % LLVector3::z_axis;
+ LLVector4 backlight_pos = LLVector4(lerp(opposite_pos, orthog_light_pos, 0.3f), 0.0f);
+ backlight_pos.normalize();
+
+ LLColor4 light_diffuse = sun_up ? mSunDiffuse : mMoonDiffuse;
+
+ LLColor4 backlight_diffuse(1.f - light_diffuse.mV[VRED], 1.f - light_diffuse.mV[VGREEN], 1.f - light_diffuse.mV[VBLUE], 1.f);
+ F32 max_component = 0.001f;
+ for (S32 i = 0; i < 3; i++)
+ {
+ if (backlight_diffuse.mV[i] > max_component)
+ {
+ max_component = backlight_diffuse.mV[i];
+ }
+ }
+ F32 backlight_mag;
+ if (LLEnvironment::instance().getIsSunUp())
+ {
+ backlight_mag = BACKLIGHT_DAY_MAGNITUDE_OBJECT;
+ }
+ else
+ {
+ backlight_mag = BACKLIGHT_NIGHT_MAGNITUDE_OBJECT;
+ }
+ backlight_diffuse *= backlight_mag / max_component;
+
+ mHWLightColors[1] = backlight_diffuse;
+
+ LLLightState* light = gGL.getLight(1);
+
+ light->setPosition(backlight_pos);
+ light->setDiffuse(backlight_diffuse);
+ light->setAmbient(LLColor4::black);
+ light->setSpecular(LLColor4::black);
+ light->setConstantAttenuation(1.f);
+ light->setLinearAttenuation(0.f);
+ light->setQuadraticAttenuation(0.f);
+ light->setSpotExponent(0.f);
+ light->setSpotCutoff(180.f);
+ }
+ else
+ {
+ LLLightState* light = gGL.getLight(1);
+
+ mHWLightColors[1] = LLColor4::black;
+
+ light->setDiffuse(LLColor4::black);
+ light->setAmbient(LLColor4::black);
+ light->setSpecular(LLColor4::black);
+ }
}
static F32 calc_light_dist(LLVOVolume* light, const LLVector3& cam_pos, F32 max_dist)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- F32 inten = light->getLightIntensity();
- if (inten < .001f)
- {
- return max_dist;
- }
- bool selected = light->isSelected();
- if (selected)
- {
+ F32 inten = light->getLightIntensity();
+ if (inten < .001f)
+ {
+ return max_dist;
+ }
+ bool selected = light->isSelected();
+ if (selected)
+ {
return 0.f; // selected lights get highest priority
- }
+ }
F32 radius = light->getLightRadius();
F32 dist = dist_vec(light->getRenderPosition(), cam_pos);
dist = llmax(dist - radius, 0.f);
- if (light->mDrawable.notNull() && light->mDrawable->isState(LLDrawable::ACTIVE))
- {
- // moving lights get a little higher priority (too much causes artifacts)
+ if (light->mDrawable.notNull() && light->mDrawable->isState(LLDrawable::ACTIVE))
+ {
+ // moving lights get a little higher priority (too much causes artifacts)
dist = llmax(dist - light->getLightRadius()*0.25f, 0.f);
- }
- return dist;
+ }
+ return dist;
}
void LLPipeline::calcNearbyLights(LLCamera& camera)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- assertInitialized();
+ assertInitialized();
- if (LLPipeline::sReflectionRender || gCubeSnapshot || LLPipeline::sRenderingHUDs)
- {
- return;
- }
+ if (LLPipeline::sReflectionRender || gCubeSnapshot || LLPipeline::sRenderingHUDs)
+ {
+ return;
+ }
static LLCachedControl<S32> local_light_count(gSavedSettings, "RenderLocalLightCount", 256);
- if (local_light_count >= 1)
- {
- // mNearbyLight (and all light_set_t's) are sorted such that
- // begin() == the closest light and rbegin() == the farthest light
- const S32 MAX_LOCAL_LIGHTS = 6;
+ if (local_light_count >= 1)
+ {
+ // mNearbyLight (and all light_set_t's) are sorted such that
+ // begin() == the closest light and rbegin() == the farthest light
+ const S32 MAX_LOCAL_LIGHTS = 6;
LLVector3 cam_pos = camera.getOrigin();
-
+
F32 max_dist;
if (LLPipeline::sRenderDeferred)
{
@@ -5252,15 +5252,15 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
max_dist = llmin(RenderFarClip, LIGHT_MAX_RADIUS * 4.f);
}
- // UPDATE THE EXISTING NEARBY LIGHTS
- light_set_t cur_nearby_lights;
- for (light_set_t::iterator iter = mNearbyLights.begin();
- iter != mNearbyLights.end(); iter++)
- {
- const Light* light = &(*iter);
- LLDrawable* drawable = light->drawable;
+ // UPDATE THE EXISTING NEARBY LIGHTS
+ light_set_t cur_nearby_lights;
+ for (light_set_t::iterator iter = mNearbyLights.begin();
+ iter != mNearbyLights.end(); iter++)
+ {
+ const Light* light = &(*iter);
+ LLDrawable* drawable = light->drawable;
const LLViewerObject *vobj = light->drawable->getVObj();
- if(vobj && vobj->getAvatar()
+ if(vobj && vobj->getAvatar()
&& (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList() || vobj->getAvatar()->isTooSlow())
)
{
@@ -5268,22 +5268,22 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
continue;
}
- LLVOVolume* volight = drawable->getVOVolume();
- if (!volight || !drawable->isState(LLDrawable::LIGHT))
- {
- drawable->clearState(LLDrawable::NEARBY_LIGHT);
- continue;
- }
- if (light->fade <= -LIGHT_FADE_TIME)
- {
- drawable->clearState(LLDrawable::NEARBY_LIGHT);
- continue;
- }
- if (!sRenderAttachedLights && volight && volight->isAttachment())
- {
- drawable->clearState(LLDrawable::NEARBY_LIGHT);
- continue;
- }
+ LLVOVolume* volight = drawable->getVOVolume();
+ if (!volight || !drawable->isState(LLDrawable::LIGHT))
+ {
+ drawable->clearState(LLDrawable::NEARBY_LIGHT);
+ continue;
+ }
+ if (light->fade <= -LIGHT_FADE_TIME)
+ {
+ drawable->clearState(LLDrawable::NEARBY_LIGHT);
+ continue;
+ }
+ if (!sRenderAttachedLights && volight && volight->isAttachment())
+ {
+ drawable->clearState(LLDrawable::NEARBY_LIGHT);
+ continue;
+ }
F32 dist = calc_light_dist(volight, cam_pos, max_dist);
F32 fade = light->fade;
@@ -5317,28 +5317,28 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
}
}
cur_nearby_lights.insert(Light(drawable, dist, fade));
- }
- mNearbyLights = cur_nearby_lights;
-
- // FIND NEW LIGHTS THAT ARE IN RANGE
- light_set_t new_nearby_lights;
- for (LLDrawable::ordered_drawable_set_t::iterator iter = mLights.begin();
- iter != mLights.end(); ++iter)
- {
- LLDrawable* drawable = *iter;
- LLVOVolume* light = drawable->getVOVolume();
- if (!light || drawable->isState(LLDrawable::NEARBY_LIGHT))
- {
- continue;
- }
- if (light->isHUDAttachment())
- {
- continue; // no lighting from HUD objects
- }
+ }
+ mNearbyLights = cur_nearby_lights;
+
+ // FIND NEW LIGHTS THAT ARE IN RANGE
+ light_set_t new_nearby_lights;
+ for (LLDrawable::ordered_drawable_set_t::iterator iter = mLights.begin();
+ iter != mLights.end(); ++iter)
+ {
+ LLDrawable* drawable = *iter;
+ LLVOVolume* light = drawable->getVOVolume();
+ if (!light || drawable->isState(LLDrawable::NEARBY_LIGHT))
+ {
+ continue;
+ }
+ if (light->isHUDAttachment())
+ {
+ continue; // no lighting from HUD objects
+ }
if (!sRenderAttachedLights && light && light->isAttachment())
- {
- continue;
- }
+ {
+ continue;
+ }
LLVOAvatar * av = light->getAvatar();
if (av && (av->isTooComplex() || av->isInMuteList() || av->isTooSlow()))
{
@@ -5347,36 +5347,36 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
}
F32 dist = calc_light_dist(light, cam_pos, max_dist);
if (dist >= max_dist)
- {
- continue;
- }
- new_nearby_lights.insert(Light(drawable, dist, 0.f));
+ {
+ continue;
+ }
+ new_nearby_lights.insert(Light(drawable, dist, 0.f));
if (!LLPipeline::sRenderDeferred && new_nearby_lights.size() > (U32)MAX_LOCAL_LIGHTS)
- {
- new_nearby_lights.erase(--new_nearby_lights.end());
- const Light& last = *new_nearby_lights.rbegin();
- max_dist = last.dist;
- }
- }
-
- // INSERT ANY NEW LIGHTS
- for (light_set_t::iterator iter = new_nearby_lights.begin();
- iter != new_nearby_lights.end(); iter++)
- {
- const Light* light = &(*iter);
+ {
+ new_nearby_lights.erase(--new_nearby_lights.end());
+ const Light& last = *new_nearby_lights.rbegin();
+ max_dist = last.dist;
+ }
+ }
+
+ // INSERT ANY NEW LIGHTS
+ for (light_set_t::iterator iter = new_nearby_lights.begin();
+ iter != new_nearby_lights.end(); iter++)
+ {
+ const Light* light = &(*iter);
if (LLPipeline::sRenderDeferred || mNearbyLights.size() < (U32)MAX_LOCAL_LIGHTS)
- {
- mNearbyLights.insert(*light);
- ((LLDrawable*) light->drawable)->setState(LLDrawable::NEARBY_LIGHT);
- }
- else
- {
- // crazy cast so that we can overwrite the fade value
- // even though gcc enforces sets as const
- // (fade value doesn't affect sort so this is safe)
- Light* farthest_light = (const_cast<Light*>(&(*(mNearbyLights.rbegin()))));
- if (light->dist < farthest_light->dist)
- {
+ {
+ mNearbyLights.insert(*light);
+ ((LLDrawable*) light->drawable)->setState(LLDrawable::NEARBY_LIGHT);
+ }
+ else
+ {
+ // crazy cast so that we can overwrite the fade value
+ // even though gcc enforces sets as const
+ // (fade value doesn't affect sort so this is safe)
+ Light* farthest_light = (const_cast<Light*>(&(*(mNearbyLights.rbegin()))));
+ if (light->dist < farthest_light->dist)
+ {
// mark light to fade out
// visibility goes down from -0 to -LIGHT_FADE_TIME.
//
@@ -5393,29 +5393,29 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
{
farthest_light->fade -= LIGHT_FADE_TIME;
}
- }
- else
- {
- break; // none of the other lights are closer
- }
- }
- }
-
- //mark nearby lights not-removable.
- for (light_set_t::iterator iter = mNearbyLights.begin();
- iter != mNearbyLights.end(); iter++)
- {
- const Light* light = &(*iter);
- ((LLViewerOctreeEntryData*) light->drawable)->setVisible();
- }
- }
+ }
+ else
+ {
+ break; // none of the other lights are closer
+ }
+ }
+ }
+
+ //mark nearby lights not-removable.
+ for (light_set_t::iterator iter = mNearbyLights.begin();
+ iter != mNearbyLights.end(); iter++)
+ {
+ const Light* light = &(*iter);
+ ((LLViewerOctreeEntryData*) light->drawable)->setVisible();
+ }
+ }
}
void LLPipeline::setupHWLights()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
- assertInitialized();
-
+ assertInitialized();
+
if (LLPipeline::sRenderingHUDs)
{
return;
@@ -5435,13 +5435,13 @@ void LLPipeline::setupHWLights()
// Ambient
LLColor4 ambient = psky->getTotalAmbient();
- gGL.setAmbientLightColor(ambient);
+ gGL.setAmbientLightColor(ambient);
bool sun_up = environment.getIsSunUp();
bool moon_up = environment.getIsMoonUp();
- // Light 0 = Sun or Moon (All objects)
- {
+ // Light 0 = Sun or Moon (All objects)
+ {
LLVector4 sun_dir(environment.getSunDirection(), 0.0f);
LLVector4 moon_dir(environment.getMoonDirection(), 0.0f);
@@ -5451,12 +5451,12 @@ void LLPipeline::setupHWLights()
mSunDiffuse.setVec(psky->getSunlightColor());
mMoonDiffuse.setVec(psky->getMoonlightColor());
- F32 max_color = llmax(mSunDiffuse.mV[0], mSunDiffuse.mV[1], mSunDiffuse.mV[2]);
- if (max_color > 1.f)
- {
- mSunDiffuse *= 1.f/max_color;
- }
- mSunDiffuse.clamp();
+ F32 max_color = llmax(mSunDiffuse.mV[0], mSunDiffuse.mV[1], mSunDiffuse.mV[2]);
+ if (max_color > 1.f)
+ {
+ mSunDiffuse *= 1.f/max_color;
+ }
+ mSunDiffuse.clamp();
max_color = llmax(mMoonDiffuse.mV[0], mMoonDiffuse.mV[1], mMoonDiffuse.mV[2]);
if (max_color > 1.f)
@@ -5467,54 +5467,54 @@ void LLPipeline::setupHWLights()
// prevent underlighting from having neither lightsource facing us
if (!sun_up && !moon_up)
- {
+ {
mSunDiffuse.setVec(LLColor4(0.0, 0.0, 0.0, 1.0));
mMoonDiffuse.setVec(LLColor4(0.0, 0.0, 0.0, 1.0));
mSunDir.setVec(LLVector4(0.0, 1.0, 0.0, 0.0));
mMoonDir.setVec(LLVector4(0.0, 1.0, 0.0, 0.0));
- }
+ }
LLVector4 light_dir = sun_up ? mSunDir : mMoonDir;
mHWLightColors[0] = sun_up ? mSunDiffuse : mMoonDiffuse;
- LLLightState* light = gGL.getLight(0);
+ LLLightState* light = gGL.getLight(0);
light->setPosition(light_dir);
light->setSunPrimary(sun_up);
light->setDiffuse(mHWLightColors[0]);
light->setDiffuseB(mMoonDiffuse);
light->setAmbient(psky->getTotalAmbient());
- light->setSpecular(LLColor4::black);
- light->setConstantAttenuation(1.f);
- light->setLinearAttenuation(0.f);
- light->setQuadraticAttenuation(0.f);
- light->setSpotExponent(0.f);
- light->setSpotCutoff(180.f);
- }
-
- // Light 1 = Backlight (for avatars)
- // (set by enableLightsAvatar)
-
- S32 cur_light = 2;
-
- // Nearby lights = LIGHT 2-7
-
- mLightMovingMask = 0;
-
+ light->setSpecular(LLColor4::black);
+ light->setConstantAttenuation(1.f);
+ light->setLinearAttenuation(0.f);
+ light->setQuadraticAttenuation(0.f);
+ light->setSpotExponent(0.f);
+ light->setSpotCutoff(180.f);
+ }
+
+ // Light 1 = Backlight (for avatars)
+ // (set by enableLightsAvatar)
+
+ S32 cur_light = 2;
+
+ // Nearby lights = LIGHT 2-7
+
+ mLightMovingMask = 0;
+
static LLCachedControl<S32> local_light_count(gSavedSettings, "RenderLocalLightCount", 256);
- if (local_light_count >= 1)
- {
- for (light_set_t::iterator iter = mNearbyLights.begin();
- iter != mNearbyLights.end(); ++iter)
- {
- LLDrawable* drawable = iter->drawable;
- LLVOVolume* light = drawable->getVOVolume();
- if (!light)
- {
- continue;
- }
+ if (local_light_count >= 1)
+ {
+ for (light_set_t::iterator iter = mNearbyLights.begin();
+ iter != mNearbyLights.end(); ++iter)
+ {
+ LLDrawable* drawable = iter->drawable;
+ LLVOVolume* light = drawable->getVOVolume();
+ if (!light)
+ {
+ continue;
+ }
if (light->isAttachment())
{
@@ -5524,32 +5524,32 @@ void LLPipeline::setupHWLights()
}
}
- if (drawable->isState(LLDrawable::ACTIVE))
- {
- mLightMovingMask |= (1<<cur_light);
- }
-
+ if (drawable->isState(LLDrawable::ACTIVE))
+ {
+ mLightMovingMask |= (1<<cur_light);
+ }
+
//send linear light color to shader
LLColor4 light_color = light->getLightLinearColor() * light_scale;
- light_color.mV[3] = 0.0f;
-
- F32 fade = iter->fade;
- if (fade < LIGHT_FADE_TIME)
- {
- // fade in/out light
- if (fade >= 0.f)
- {
- fade = fade / LIGHT_FADE_TIME;
- ((Light*) (&(*iter)))->fade += gFrameIntervalSeconds.value();
- }
- else
- {
- fade = 1.f + fade / LIGHT_FADE_TIME;
- ((Light*) (&(*iter)))->fade -= gFrameIntervalSeconds.value();
- }
- fade = llclamp(fade,0.f,1.f);
- light_color *= fade;
- }
+ light_color.mV[3] = 0.0f;
+
+ F32 fade = iter->fade;
+ if (fade < LIGHT_FADE_TIME)
+ {
+ // fade in/out light
+ if (fade >= 0.f)
+ {
+ fade = fade / LIGHT_FADE_TIME;
+ ((Light*) (&(*iter)))->fade += gFrameIntervalSeconds.value();
+ }
+ else
+ {
+ fade = 1.f + fade / LIGHT_FADE_TIME;
+ ((Light*) (&(*iter)))->fade -= gFrameIntervalSeconds.value();
+ }
+ fade = llclamp(fade,0.f,1.f);
+ light_color *= fade;
+ }
if (light_color.magVecSquared() < 0.001f)
{
@@ -5569,213 +5569,213 @@ void LLPipeline::setupHWLights()
F32 linatten = x / adjusted_radius; // % of brightness at radius
mHWLightColors[cur_light] = light_color;
- LLLightState* light_state = gGL.getLight(cur_light);
-
- light_state->setPosition(light_pos_gl);
- light_state->setDiffuse(light_color);
- light_state->setAmbient(LLColor4::black);
- light_state->setConstantAttenuation(0.f);
+ LLLightState* light_state = gGL.getLight(cur_light);
+
+ light_state->setPosition(light_pos_gl);
+ light_state->setDiffuse(light_color);
+ light_state->setAmbient(LLColor4::black);
+ light_state->setConstantAttenuation(0.f);
light_state->setSize(light->getLightRadius() * 1.5f);
light_state->setFalloff(light->getLightFalloff(DEFERRED_LIGHT_FALLOFF));
- if (sRenderDeferred)
- {
- light_state->setLinearAttenuation(linatten);
- light_state->setQuadraticAttenuation(light->getLightFalloff(DEFERRED_LIGHT_FALLOFF) + 1.f); // get falloff to match for forward deferred rendering lights
- }
- else
- {
- light_state->setLinearAttenuation(linatten);
- light_state->setQuadraticAttenuation(0.f);
- }
-
-
- if (light->isLightSpotlight() // directional (spot-)light
- && (LLPipeline::sRenderDeferred || RenderSpotLightsInNondeferred)) // these are only rendered as GL spotlights if we're in deferred rendering mode *or* the setting forces them on
- {
- LLQuaternion quat = light->getRenderRotation();
- LLVector3 at_axis(0,0,-1); // this matches deferred rendering's object light direction
- at_axis *= quat;
-
- light_state->setSpotDirection(at_axis);
- light_state->setSpotCutoff(90.f);
- light_state->setSpotExponent(2.f);
-
- LLVector3 spotParams = light->getSpotLightParams();
-
- const LLColor4 specular(0.f, 0.f, 0.f, spotParams[2]);
- light_state->setSpecular(specular);
- }
- else // omnidirectional (point) light
- {
- light_state->setSpotExponent(0.f);
- light_state->setSpotCutoff(180.f);
-
- // we use specular.z = 1.0 as a cheap hack for the shaders to know that this is omnidirectional rather than a spotlight
- const LLColor4 specular(0.f, 0.f, 1.f, 0.f);
- light_state->setSpecular(specular);
- }
- cur_light++;
- if (cur_light >= 8)
- {
- break; // safety
- }
- }
- }
- for ( ; cur_light < 8 ; cur_light++)
- {
- mHWLightColors[cur_light] = LLColor4::black;
- LLLightState* light = gGL.getLight(cur_light);
+ if (sRenderDeferred)
+ {
+ light_state->setLinearAttenuation(linatten);
+ light_state->setQuadraticAttenuation(light->getLightFalloff(DEFERRED_LIGHT_FALLOFF) + 1.f); // get falloff to match for forward deferred rendering lights
+ }
+ else
+ {
+ light_state->setLinearAttenuation(linatten);
+ light_state->setQuadraticAttenuation(0.f);
+ }
+
+
+ if (light->isLightSpotlight() // directional (spot-)light
+ && (LLPipeline::sRenderDeferred || RenderSpotLightsInNondeferred)) // these are only rendered as GL spotlights if we're in deferred rendering mode *or* the setting forces them on
+ {
+ LLQuaternion quat = light->getRenderRotation();
+ LLVector3 at_axis(0,0,-1); // this matches deferred rendering's object light direction
+ at_axis *= quat;
+
+ light_state->setSpotDirection(at_axis);
+ light_state->setSpotCutoff(90.f);
+ light_state->setSpotExponent(2.f);
+
+ LLVector3 spotParams = light->getSpotLightParams();
+
+ const LLColor4 specular(0.f, 0.f, 0.f, spotParams[2]);
+ light_state->setSpecular(specular);
+ }
+ else // omnidirectional (point) light
+ {
+ light_state->setSpotExponent(0.f);
+ light_state->setSpotCutoff(180.f);
+
+ // we use specular.z = 1.0 as a cheap hack for the shaders to know that this is omnidirectional rather than a spotlight
+ const LLColor4 specular(0.f, 0.f, 1.f, 0.f);
+ light_state->setSpecular(specular);
+ }
+ cur_light++;
+ if (cur_light >= 8)
+ {
+ break; // safety
+ }
+ }
+ }
+ for ( ; cur_light < 8 ; cur_light++)
+ {
+ mHWLightColors[cur_light] = LLColor4::black;
+ LLLightState* light = gGL.getLight(cur_light);
light->setSunPrimary(true);
- light->setDiffuse(LLColor4::black);
- light->setAmbient(LLColor4::black);
- light->setSpecular(LLColor4::black);
- }
+ light->setDiffuse(LLColor4::black);
+ light->setAmbient(LLColor4::black);
+ light->setSpecular(LLColor4::black);
+ }
// Bookmark comment to allow searching for mSpecialRenderMode == 3 (avatar edit mode),
// prev site of forward (non-deferred) character light injection, removed by SL-13522 09/20
- // Init GL state
- for (S32 i = 0; i < 8; ++i)
- {
- gGL.getLight(i)->disable();
- }
- mLightMask = 0;
+ // Init GL state
+ for (S32 i = 0; i < 8; ++i)
+ {
+ gGL.getLight(i)->disable();
+ }
+ mLightMask = 0;
}
void LLPipeline::enableLights(U32 mask)
{
- assertInitialized();
-
- if (mLightMask != mask)
- {
- stop_glerror();
- if (mask)
- {
- stop_glerror();
- for (S32 i=0; i<8; i++)
- {
- LLLightState* light = gGL.getLight(i);
- if (mask & (1<<i))
- {
- light->enable();
- light->setDiffuse(mHWLightColors[i]);
- }
- else
- {
- light->disable();
- light->setDiffuse(LLColor4::black);
- }
- }
- stop_glerror();
- }
- mLightMask = mask;
- stop_glerror();
- }
+ assertInitialized();
+
+ if (mLightMask != mask)
+ {
+ stop_glerror();
+ if (mask)
+ {
+ stop_glerror();
+ for (S32 i=0; i<8; i++)
+ {
+ LLLightState* light = gGL.getLight(i);
+ if (mask & (1<<i))
+ {
+ light->enable();
+ light->setDiffuse(mHWLightColors[i]);
+ }
+ else
+ {
+ light->disable();
+ light->setDiffuse(LLColor4::black);
+ }
+ }
+ stop_glerror();
+ }
+ mLightMask = mask;
+ stop_glerror();
+ }
}
void LLPipeline::enableLightsDynamic()
{
- assertInitialized();
- U32 mask = 0xff & (~2); // Local lights
- enableLights(mask);
-
- if (isAgentAvatarValid())
- {
- if (gAgentAvatarp->mSpecialRenderMode == 0) // normal
- {
- gPipeline.enableLightsAvatar();
- }
- else if (gAgentAvatarp->mSpecialRenderMode == 2) // anim preview
- {
- gPipeline.enableLightsAvatarEdit(LLColor4(0.7f, 0.6f, 0.3f, 1.f));
- }
- }
+ assertInitialized();
+ U32 mask = 0xff & (~2); // Local lights
+ enableLights(mask);
+
+ if (isAgentAvatarValid())
+ {
+ if (gAgentAvatarp->mSpecialRenderMode == 0) // normal
+ {
+ gPipeline.enableLightsAvatar();
+ }
+ else if (gAgentAvatarp->mSpecialRenderMode == 2) // anim preview
+ {
+ gPipeline.enableLightsAvatarEdit(LLColor4(0.7f, 0.6f, 0.3f, 1.f));
+ }
+ }
}
void LLPipeline::enableLightsAvatar()
{
- U32 mask = 0xff; // All lights
- setupAvatarLights(FALSE);
- enableLights(mask);
+ U32 mask = 0xff; // All lights
+ setupAvatarLights(FALSE);
+ enableLights(mask);
}
void LLPipeline::enableLightsPreview()
{
- disableLights();
-
- LLColor4 ambient = PreviewAmbientColor;
- gGL.setAmbientLightColor(ambient);
-
- LLColor4 diffuse0 = PreviewDiffuse0;
- LLColor4 specular0 = PreviewSpecular0;
- LLColor4 diffuse1 = PreviewDiffuse1;
- LLColor4 specular1 = PreviewSpecular1;
- LLColor4 diffuse2 = PreviewDiffuse2;
- LLColor4 specular2 = PreviewSpecular2;
-
- LLVector3 dir0 = PreviewDirection0;
- LLVector3 dir1 = PreviewDirection1;
- LLVector3 dir2 = PreviewDirection2;
-
- dir0.normVec();
- dir1.normVec();
- dir2.normVec();
-
- LLVector4 light_pos(dir0, 0.0f);
-
- LLLightState* light = gGL.getLight(1);
-
- light->enable();
- light->setPosition(light_pos);
- light->setDiffuse(diffuse0);
- light->setAmbient(ambient);
- light->setSpecular(specular0);
- light->setSpotExponent(0.f);
- light->setSpotCutoff(180.f);
-
- light_pos = LLVector4(dir1, 0.f);
-
- light = gGL.getLight(2);
- light->enable();
- light->setPosition(light_pos);
- light->setDiffuse(diffuse1);
- light->setAmbient(ambient);
- light->setSpecular(specular1);
- light->setSpotExponent(0.f);
- light->setSpotCutoff(180.f);
-
- light_pos = LLVector4(dir2, 0.f);
- light = gGL.getLight(3);
- light->enable();
- light->setPosition(light_pos);
- light->setDiffuse(diffuse2);
- light->setAmbient(ambient);
- light->setSpecular(specular2);
- light->setSpotExponent(0.f);
- light->setSpotCutoff(180.f);
+ disableLights();
+
+ LLColor4 ambient = PreviewAmbientColor;
+ gGL.setAmbientLightColor(ambient);
+
+ LLColor4 diffuse0 = PreviewDiffuse0;
+ LLColor4 specular0 = PreviewSpecular0;
+ LLColor4 diffuse1 = PreviewDiffuse1;
+ LLColor4 specular1 = PreviewSpecular1;
+ LLColor4 diffuse2 = PreviewDiffuse2;
+ LLColor4 specular2 = PreviewSpecular2;
+
+ LLVector3 dir0 = PreviewDirection0;
+ LLVector3 dir1 = PreviewDirection1;
+ LLVector3 dir2 = PreviewDirection2;
+
+ dir0.normVec();
+ dir1.normVec();
+ dir2.normVec();
+
+ LLVector4 light_pos(dir0, 0.0f);
+
+ LLLightState* light = gGL.getLight(1);
+
+ light->enable();
+ light->setPosition(light_pos);
+ light->setDiffuse(diffuse0);
+ light->setAmbient(ambient);
+ light->setSpecular(specular0);
+ light->setSpotExponent(0.f);
+ light->setSpotCutoff(180.f);
+
+ light_pos = LLVector4(dir1, 0.f);
+
+ light = gGL.getLight(2);
+ light->enable();
+ light->setPosition(light_pos);
+ light->setDiffuse(diffuse1);
+ light->setAmbient(ambient);
+ light->setSpecular(specular1);
+ light->setSpotExponent(0.f);
+ light->setSpotCutoff(180.f);
+
+ light_pos = LLVector4(dir2, 0.f);
+ light = gGL.getLight(3);
+ light->enable();
+ light->setPosition(light_pos);
+ light->setDiffuse(diffuse2);
+ light->setAmbient(ambient);
+ light->setSpecular(specular2);
+ light->setSpotExponent(0.f);
+ light->setSpotCutoff(180.f);
}
void LLPipeline::enableLightsAvatarEdit(const LLColor4& color)
{
- U32 mask = 0x2002; // Avatar backlight only, set ambient
- setupAvatarLights(TRUE);
- enableLights(mask);
+ U32 mask = 0x2002; // Avatar backlight only, set ambient
+ setupAvatarLights(TRUE);
+ enableLights(mask);
- gGL.setAmbientLightColor(color);
+ gGL.setAmbientLightColor(color);
}
void LLPipeline::enableLightsFullbright()
{
- assertInitialized();
- U32 mask = 0x1000; // Non-0 mask, set ambient
- enableLights(mask);
+ assertInitialized();
+ U32 mask = 0x1000; // Non-0 mask, set ambient
+ enableLights(mask);
}
void LLPipeline::disableLights()
{
- enableLights(0); // no lighting (full bright)
+ enableLights(0); // no lighting (full bright)
}
//============================================================================
@@ -5788,58 +5788,58 @@ class LLVOLeaf;
void LLPipeline::findReferences(LLDrawable *drawablep)
{
- assertInitialized();
- if (mLights.find(drawablep) != mLights.end())
- {
- LL_INFOS() << "In mLights" << LL_ENDL;
- }
- if (std::find(mMovedList.begin(), mMovedList.end(), drawablep) != mMovedList.end())
- {
- LL_INFOS() << "In mMovedList" << LL_ENDL;
- }
- if (std::find(mShiftList.begin(), mShiftList.end(), drawablep) != mShiftList.end())
- {
- LL_INFOS() << "In mShiftList" << LL_ENDL;
- }
- if (mRetexturedList.find(drawablep) != mRetexturedList.end())
- {
- LL_INFOS() << "In mRetexturedList" << LL_ENDL;
- }
-
- if (std::find(mBuildQ1.begin(), mBuildQ1.end(), drawablep) != mBuildQ1.end())
- {
- LL_INFOS() << "In mBuildQ1" << LL_ENDL;
- }
-
- S32 count;
-
- count = gObjectList.findReferences(drawablep);
- if (count)
- {
- LL_INFOS() << "In other drawables: " << count << " references" << LL_ENDL;
- }
+ assertInitialized();
+ if (mLights.find(drawablep) != mLights.end())
+ {
+ LL_INFOS() << "In mLights" << LL_ENDL;
+ }
+ if (std::find(mMovedList.begin(), mMovedList.end(), drawablep) != mMovedList.end())
+ {
+ LL_INFOS() << "In mMovedList" << LL_ENDL;
+ }
+ if (std::find(mShiftList.begin(), mShiftList.end(), drawablep) != mShiftList.end())
+ {
+ LL_INFOS() << "In mShiftList" << LL_ENDL;
+ }
+ if (mRetexturedList.find(drawablep) != mRetexturedList.end())
+ {
+ LL_INFOS() << "In mRetexturedList" << LL_ENDL;
+ }
+
+ if (std::find(mBuildQ1.begin(), mBuildQ1.end(), drawablep) != mBuildQ1.end())
+ {
+ LL_INFOS() << "In mBuildQ1" << LL_ENDL;
+ }
+
+ S32 count;
+
+ count = gObjectList.findReferences(drawablep);
+ if (count)
+ {
+ LL_INFOS() << "In other drawables: " << count << " references" << LL_ENDL;
+ }
}
bool LLPipeline::verify()
{
- bool ok = assertInitialized();
- if (ok)
- {
- for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
- {
- LLDrawPool *poolp = *iter;
- if (!poolp->verify())
- {
- ok = false;
- }
- }
- }
-
- if (!ok)
- {
- LL_WARNS() << "Pipeline verify failed!" << LL_ENDL;
- }
- return ok;
+ bool ok = assertInitialized();
+ if (ok)
+ {
+ for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
+ {
+ LLDrawPool *poolp = *iter;
+ if (!poolp->verify())
+ {
+ ok = false;
+ }
+ }
+ }
+
+ if (!ok)
+ {
+ LL_WARNS() << "Pipeline verify failed!" << LL_ENDL;
+ }
+ return ok;
}
//////////////////////////////
@@ -5850,89 +5850,89 @@ bool LLPipeline::verify()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * A method to compute a ray-AABB intersection.
- * Original code by Andrew Woo, from "Graphics Gems", Academic Press, 1990
- * Optimized code by Pierre Terdiman, 2000 (~20-30% faster on my Celeron 500)
- * Epsilon value added by Klaus Hartmann. (discarding it saves a few cycles only)
+ * A method to compute a ray-AABB intersection.
+ * Original code by Andrew Woo, from "Graphics Gems", Academic Press, 1990
+ * Optimized code by Pierre Terdiman, 2000 (~20-30% faster on my Celeron 500)
+ * Epsilon value added by Klaus Hartmann. (discarding it saves a few cycles only)
*
- * Hence this version is faster as well as more robust than the original one.
+ * Hence this version is faster as well as more robust than the original one.
*
- * Should work provided:
- * 1) the integer representation of 0.0f is 0x00000000
- * 2) the sign bit of the float is the most significant one
+ * Should work provided:
+ * 1) the integer representation of 0.0f is 0x00000000
+ * 2) the sign bit of the float is the most significant one
*
- * Report bugs: p.terdiman@codercorner.com
+ * Report bugs: p.terdiman@codercorner.com
*
- * \param aabb [in] the axis-aligned bounding box
- * \param origin [in] ray origin
- * \param dir [in] ray direction
- * \param coord [out] impact coordinates
- * \return true if ray intersects AABB
+ * \param aabb [in] the axis-aligned bounding box
+ * \param origin [in] ray origin
+ * \param dir [in] ray direction
+ * \param coord [out] impact coordinates
+ * \return true if ray intersects AABB
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//#define RAYAABB_EPSILON 0.00001f
-#define IR(x) ((U32&)x)
+#define IR(x) ((U32&)x)
bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon)
{
- bool Inside = true;
- LLVector3 MinB = center - size;
- LLVector3 MaxB = center + size;
- LLVector3 MaxT;
- MaxT.mV[VX]=MaxT.mV[VY]=MaxT.mV[VZ]=-1.0f;
-
- // Find candidate planes.
- for(U32 i=0;i<3;i++)
- {
- if(origin.mV[i] < MinB.mV[i])
- {
- coord.mV[i] = MinB.mV[i];
- Inside = false;
-
- // Calculate T distances to candidate planes
- if(IR(dir.mV[i])) MaxT.mV[i] = (MinB.mV[i] - origin.mV[i]) / dir.mV[i];
- }
- else if(origin.mV[i] > MaxB.mV[i])
- {
- coord.mV[i] = MaxB.mV[i];
- Inside = false;
-
- // Calculate T distances to candidate planes
- if(IR(dir.mV[i])) MaxT.mV[i] = (MaxB.mV[i] - origin.mV[i]) / dir.mV[i];
- }
- }
-
- // Ray origin inside bounding box
- if(Inside)
- {
- coord = origin;
- return true;
- }
-
- // Get largest of the maxT's for final choice of intersection
- U32 WhichPlane = 0;
- if(MaxT.mV[1] > MaxT.mV[WhichPlane]) WhichPlane = 1;
- if(MaxT.mV[2] > MaxT.mV[WhichPlane]) WhichPlane = 2;
-
- // Check final candidate actually inside box
- if(IR(MaxT.mV[WhichPlane])&0x80000000) return false;
-
- for(U32 i=0;i<3;i++)
- {
- if(i!=WhichPlane)
- {
- coord.mV[i] = origin.mV[i] + MaxT.mV[WhichPlane] * dir.mV[i];
- if (epsilon > 0)
- {
- if(coord.mV[i] < MinB.mV[i] - epsilon || coord.mV[i] > MaxB.mV[i] + epsilon) return false;
- }
- else
- {
- if(coord.mV[i] < MinB.mV[i] || coord.mV[i] > MaxB.mV[i]) return false;
- }
- }
- }
- return true; // ray hits box
+ bool Inside = true;
+ LLVector3 MinB = center - size;
+ LLVector3 MaxB = center + size;
+ LLVector3 MaxT;
+ MaxT.mV[VX]=MaxT.mV[VY]=MaxT.mV[VZ]=-1.0f;
+
+ // Find candidate planes.
+ for(U32 i=0;i<3;i++)
+ {
+ if(origin.mV[i] < MinB.mV[i])
+ {
+ coord.mV[i] = MinB.mV[i];
+ Inside = false;
+
+ // Calculate T distances to candidate planes
+ if(IR(dir.mV[i])) MaxT.mV[i] = (MinB.mV[i] - origin.mV[i]) / dir.mV[i];
+ }
+ else if(origin.mV[i] > MaxB.mV[i])
+ {
+ coord.mV[i] = MaxB.mV[i];
+ Inside = false;
+
+ // Calculate T distances to candidate planes
+ if(IR(dir.mV[i])) MaxT.mV[i] = (MaxB.mV[i] - origin.mV[i]) / dir.mV[i];
+ }
+ }
+
+ // Ray origin inside bounding box
+ if(Inside)
+ {
+ coord = origin;
+ return true;
+ }
+
+ // Get largest of the maxT's for final choice of intersection
+ U32 WhichPlane = 0;
+ if(MaxT.mV[1] > MaxT.mV[WhichPlane]) WhichPlane = 1;
+ if(MaxT.mV[2] > MaxT.mV[WhichPlane]) WhichPlane = 2;
+
+ // Check final candidate actually inside box
+ if(IR(MaxT.mV[WhichPlane])&0x80000000) return false;
+
+ for(U32 i=0;i<3;i++)
+ {
+ if(i!=WhichPlane)
+ {
+ coord.mV[i] = origin.mV[i] + MaxT.mV[WhichPlane] * dir.mV[i];
+ if (epsilon > 0)
+ {
+ if(coord.mV[i] < MinB.mV[i] - epsilon || coord.mV[i] > MaxB.mV[i] + epsilon) return false;
+ }
+ else
+ {
+ if(coord.mV[i] < MinB.mV[i] || coord.mV[i] > MaxB.mV[i]) return false;
+ }
+ }
+ }
+ return true; // ray hits box
}
//////////////////////////////
@@ -5943,537 +5943,537 @@ bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3&
void LLPipeline::setLight(LLDrawable *drawablep, bool is_light)
{
- if (drawablep && assertInitialized())
- {
- if (is_light)
- {
- mLights.insert(drawablep);
- drawablep->setState(LLDrawable::LIGHT);
- }
- else
- {
- drawablep->clearState(LLDrawable::LIGHT);
- mLights.erase(drawablep);
- }
- }
+ if (drawablep && assertInitialized())
+ {
+ if (is_light)
+ {
+ mLights.insert(drawablep);
+ drawablep->setState(LLDrawable::LIGHT);
+ }
+ else
+ {
+ drawablep->clearState(LLDrawable::LIGHT);
+ mLights.erase(drawablep);
+ }
+ }
}
//static
void LLPipeline::toggleRenderType(U32 type)
{
- gPipeline.mRenderTypeEnabled[type] = !gPipeline.mRenderTypeEnabled[type];
- if (type == LLPipeline::RENDER_TYPE_WATER)
- {
- gPipeline.mRenderTypeEnabled[LLPipeline::RENDER_TYPE_VOIDWATER] = !gPipeline.mRenderTypeEnabled[LLPipeline::RENDER_TYPE_VOIDWATER];
- }
+ gPipeline.mRenderTypeEnabled[type] = !gPipeline.mRenderTypeEnabled[type];
+ if (type == LLPipeline::RENDER_TYPE_WATER)
+ {
+ gPipeline.mRenderTypeEnabled[LLPipeline::RENDER_TYPE_VOIDWATER] = !gPipeline.mRenderTypeEnabled[LLPipeline::RENDER_TYPE_VOIDWATER];
+ }
}
//static
void LLPipeline::toggleRenderTypeControl(U32 type)
{
- gPipeline.toggleRenderType(type);
+ gPipeline.toggleRenderType(type);
}
//static
bool LLPipeline::hasRenderTypeControl(U32 type)
{
- return gPipeline.hasRenderType(type);
+ return gPipeline.hasRenderType(type);
}
// Allows UI items labeled "Hide foo" instead of "Show foo"
//static
bool LLPipeline::toggleRenderTypeControlNegated(S32 type)
{
- return !gPipeline.hasRenderType(type);
+ return !gPipeline.hasRenderType(type);
}
//static
void LLPipeline::toggleRenderDebug(U64 bit)
{
- if (gPipeline.hasRenderDebugMask(bit))
- {
- LL_INFOS() << "Toggling render debug mask " << std::hex << bit << " off" << std::dec << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "Toggling render debug mask " << std::hex << bit << " on" << std::dec << LL_ENDL;
- }
- gPipeline.mRenderDebugMask ^= bit;
+ if (gPipeline.hasRenderDebugMask(bit))
+ {
+ LL_INFOS() << "Toggling render debug mask " << std::hex << bit << " off" << std::dec << LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS() << "Toggling render debug mask " << std::hex << bit << " on" << std::dec << LL_ENDL;
+ }
+ gPipeline.mRenderDebugMask ^= bit;
}
//static
bool LLPipeline::toggleRenderDebugControl(U64 bit)
{
- return gPipeline.hasRenderDebugMask(bit);
+ return gPipeline.hasRenderDebugMask(bit);
}
//static
void LLPipeline::toggleRenderDebugFeature(U32 bit)
{
- gPipeline.mRenderDebugFeatureMask ^= bit;
+ gPipeline.mRenderDebugFeatureMask ^= bit;
}
//static
bool LLPipeline::toggleRenderDebugFeatureControl(U32 bit)
{
- return gPipeline.hasRenderDebugFeatureMask(bit);
+ return gPipeline.hasRenderDebugFeatureMask(bit);
}
void LLPipeline::setRenderDebugFeatureControl(U32 bit, bool value)
{
- if (value)
- {
- gPipeline.mRenderDebugFeatureMask |= bit;
- }
- else
- {
- gPipeline.mRenderDebugFeatureMask &= !bit;
- }
+ if (value)
+ {
+ gPipeline.mRenderDebugFeatureMask |= bit;
+ }
+ else
+ {
+ gPipeline.mRenderDebugFeatureMask &= !bit;
+ }
}
void LLPipeline::pushRenderDebugFeatureMask()
{
- mRenderDebugFeatureStack.push(mRenderDebugFeatureMask);
+ mRenderDebugFeatureStack.push(mRenderDebugFeatureMask);
}
void LLPipeline::popRenderDebugFeatureMask()
{
- if (mRenderDebugFeatureStack.empty())
- {
- LL_ERRS() << "Depleted render feature stack." << LL_ENDL;
- }
+ if (mRenderDebugFeatureStack.empty())
+ {
+ LL_ERRS() << "Depleted render feature stack." << LL_ENDL;
+ }
- mRenderDebugFeatureMask = mRenderDebugFeatureStack.top();
- mRenderDebugFeatureStack.pop();
+ mRenderDebugFeatureMask = mRenderDebugFeatureStack.top();
+ mRenderDebugFeatureStack.pop();
}
// static
void LLPipeline::setRenderScriptedBeacons(bool val)
{
- sRenderScriptedBeacons = val;
+ sRenderScriptedBeacons = val;
}
// static
void LLPipeline::toggleRenderScriptedBeacons()
{
- sRenderScriptedBeacons = !sRenderScriptedBeacons;
+ sRenderScriptedBeacons = !sRenderScriptedBeacons;
}
// static
bool LLPipeline::getRenderScriptedBeacons()
{
- return sRenderScriptedBeacons;
+ return sRenderScriptedBeacons;
}
// static
void LLPipeline::setRenderScriptedTouchBeacons(bool val)
{
- sRenderScriptedTouchBeacons = val;
+ sRenderScriptedTouchBeacons = val;
}
// static
void LLPipeline::toggleRenderScriptedTouchBeacons()
{
- sRenderScriptedTouchBeacons = !sRenderScriptedTouchBeacons;
+ sRenderScriptedTouchBeacons = !sRenderScriptedTouchBeacons;
}
// static
bool LLPipeline::getRenderScriptedTouchBeacons()
{
- return sRenderScriptedTouchBeacons;
+ return sRenderScriptedTouchBeacons;
}
// static
void LLPipeline::setRenderMOAPBeacons(bool val)
{
- sRenderMOAPBeacons = val;
+ sRenderMOAPBeacons = val;
}
// static
void LLPipeline::toggleRenderMOAPBeacons()
{
- sRenderMOAPBeacons = !sRenderMOAPBeacons;
+ sRenderMOAPBeacons = !sRenderMOAPBeacons;
}
// static
bool LLPipeline::getRenderMOAPBeacons()
{
- return sRenderMOAPBeacons;
+ return sRenderMOAPBeacons;
}
// static
void LLPipeline::setRenderPhysicalBeacons(bool val)
{
- sRenderPhysicalBeacons = val;
+ sRenderPhysicalBeacons = val;
}
// static
void LLPipeline::toggleRenderPhysicalBeacons()
{
- sRenderPhysicalBeacons = !sRenderPhysicalBeacons;
+ sRenderPhysicalBeacons = !sRenderPhysicalBeacons;
}
// static
bool LLPipeline::getRenderPhysicalBeacons()
{
- return sRenderPhysicalBeacons;
+ return sRenderPhysicalBeacons;
}
// static
void LLPipeline::setRenderParticleBeacons(bool val)
{
- sRenderParticleBeacons = val;
+ sRenderParticleBeacons = val;
}
// static
void LLPipeline::toggleRenderParticleBeacons()
{
- sRenderParticleBeacons = !sRenderParticleBeacons;
+ sRenderParticleBeacons = !sRenderParticleBeacons;
}
// static
bool LLPipeline::getRenderParticleBeacons()
{
- return sRenderParticleBeacons;
+ return sRenderParticleBeacons;
}
// static
void LLPipeline::setRenderSoundBeacons(bool val)
{
- sRenderSoundBeacons = val;
+ sRenderSoundBeacons = val;
}
// static
void LLPipeline::toggleRenderSoundBeacons()
{
- sRenderSoundBeacons = !sRenderSoundBeacons;
+ sRenderSoundBeacons = !sRenderSoundBeacons;
}
// static
bool LLPipeline::getRenderSoundBeacons()
{
- return sRenderSoundBeacons;
+ return sRenderSoundBeacons;
}
// static
void LLPipeline::setRenderBeacons(bool val)
{
- sRenderBeacons = val;
+ sRenderBeacons = val;
}
// static
void LLPipeline::toggleRenderBeacons()
{
- sRenderBeacons = !sRenderBeacons;
+ sRenderBeacons = !sRenderBeacons;
}
// static
bool LLPipeline::getRenderBeacons()
{
- return sRenderBeacons;
+ return sRenderBeacons;
}
// static
void LLPipeline::setRenderHighlights(bool val)
{
- sRenderHighlight = val;
+ sRenderHighlight = val;
}
// static
void LLPipeline::toggleRenderHighlights()
{
- sRenderHighlight = !sRenderHighlight;
+ sRenderHighlight = !sRenderHighlight;
}
// static
bool LLPipeline::getRenderHighlights()
{
- return sRenderHighlight;
+ return sRenderHighlight;
}
// static
void LLPipeline::setRenderHighlightTextureChannel(LLRender::eTexIndex channel)
{
- sRenderHighlightTextureChannel = channel;
+ sRenderHighlightTextureChannel = channel;
}
LLVOPartGroup* LLPipeline::lineSegmentIntersectParticle(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection,
- S32* face_hit)
-{
- LLVector4a local_end = end;
-
- LLVector4a position;
-
- LLDrawable* drawable = NULL;
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
-
- LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_PARTICLE);
- if (part && hasRenderType(part->mDrawableType))
- {
- LLDrawable* hit = part->lineSegmentIntersect(start, local_end, TRUE, FALSE, TRUE, FALSE, face_hit, &position, NULL, NULL, NULL);
- if (hit)
- {
- drawable = hit;
- local_end = position;
- }
- }
- }
-
- LLVOPartGroup* ret = NULL;
- if (drawable)
- {
- //make sure we're returning an LLVOPartGroup
- llassert(drawable->getVObj()->getPCode() == LLViewerObject::LL_VO_PART_GROUP);
- ret = (LLVOPartGroup*) drawable->getVObj().get();
- }
-
- if (intersection)
- {
- *intersection = position;
- }
-
- return ret;
+ S32* face_hit)
+{
+ LLVector4a local_end = end;
+
+ LLVector4a position;
+
+ LLDrawable* drawable = NULL;
+
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+
+ LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_PARTICLE);
+ if (part && hasRenderType(part->mDrawableType))
+ {
+ LLDrawable* hit = part->lineSegmentIntersect(start, local_end, TRUE, FALSE, TRUE, FALSE, face_hit, &position, NULL, NULL, NULL);
+ if (hit)
+ {
+ drawable = hit;
+ local_end = position;
+ }
+ }
+ }
+
+ LLVOPartGroup* ret = NULL;
+ if (drawable)
+ {
+ //make sure we're returning an LLVOPartGroup
+ llassert(drawable->getVObj()->getPCode() == LLViewerObject::LL_VO_PART_GROUP);
+ ret = (LLVOPartGroup*) drawable->getVObj().get();
+ }
+
+ if (intersection)
+ {
+ *intersection = position;
+ }
+
+ return ret;
}
LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start, const LLVector4a& end,
- bool pick_transparent,
- bool pick_rigged,
+ bool pick_transparent,
+ bool pick_rigged,
bool pick_unselectable,
bool pick_reflection_probe,
- S32* face_hit,
- LLVector4a* intersection, // return the intersection point
- LLVector2* tex_coord, // return the texture coordinates of the intersection point
- LLVector4a* normal, // return the surface normal at the intersection point
- LLVector4a* tangent // return the surface tangent at the intersection point
- )
-{
- LLDrawable* drawable = NULL;
-
- LLVector4a local_end = end;
-
- LLVector4a position;
-
- sPickAvatar = false; //! LLToolMgr::getInstance()->inBuildMode();
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
-
- for (U32 j = 0; j < LLViewerRegion::NUM_PARTITIONS; j++)
- {
- if ((j == LLViewerRegion::PARTITION_VOLUME) ||
- (j == LLViewerRegion::PARTITION_BRIDGE) ||
+ S32* face_hit,
+ LLVector4a* intersection, // return the intersection point
+ LLVector2* tex_coord, // return the texture coordinates of the intersection point
+ LLVector4a* normal, // return the surface normal at the intersection point
+ LLVector4a* tangent // return the surface tangent at the intersection point
+ )
+{
+ LLDrawable* drawable = NULL;
+
+ LLVector4a local_end = end;
+
+ LLVector4a position;
+
+ sPickAvatar = false; //! LLToolMgr::getInstance()->inBuildMode();
+
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+
+ for (U32 j = 0; j < LLViewerRegion::NUM_PARTITIONS; j++)
+ {
+ if ((j == LLViewerRegion::PARTITION_VOLUME) ||
+ (j == LLViewerRegion::PARTITION_BRIDGE) ||
(j == LLViewerRegion::PARTITION_AVATAR) || // for attachments
- (j == LLViewerRegion::PARTITION_CONTROL_AV) ||
- (j == LLViewerRegion::PARTITION_TERRAIN) ||
- (j == LLViewerRegion::PARTITION_TREE) ||
- (j == LLViewerRegion::PARTITION_GRASS)) // only check these partitions for now
- {
- LLSpatialPartition* part = region->getSpatialPartition(j);
- if (part && hasRenderType(part->mDrawableType))
- {
- LLDrawable* hit = part->lineSegmentIntersect(start, local_end, pick_transparent, pick_rigged, pick_unselectable, pick_reflection_probe, face_hit, &position, tex_coord, normal, tangent);
- if (hit)
- {
- drawable = hit;
- local_end = position;
- }
- }
- }
- }
- }
-
- if (!sPickAvatar)
- {
- //save hit info in case we need to restore
- //due to attachment override
- LLVector4a local_normal;
- LLVector4a local_tangent;
- LLVector2 local_texcoord;
- S32 local_face_hit = -1;
-
- if (face_hit)
- {
- local_face_hit = *face_hit;
- }
- if (tex_coord)
- {
- local_texcoord = *tex_coord;
- }
- if (tangent)
- {
- local_tangent = *tangent;
- }
- else
- {
- local_tangent.clear();
- }
- if (normal)
- {
- local_normal = *normal;
- }
- else
- {
- local_normal.clear();
- }
-
- const F32 ATTACHMENT_OVERRIDE_DIST = 0.1f;
-
- //check against avatars
- sPickAvatar = true;
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
-
- LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_AVATAR);
- if (part && hasRenderType(part->mDrawableType))
- {
- LLDrawable* hit = part->lineSegmentIntersect(start, local_end, pick_transparent, pick_rigged, pick_unselectable, pick_reflection_probe, face_hit, &position, tex_coord, normal, tangent);
- if (hit)
- {
- LLVector4a delta;
- delta.setSub(position, local_end);
-
- if (!drawable ||
- !drawable->getVObj()->isAttachment() ||
- delta.getLength3().getF32() > ATTACHMENT_OVERRIDE_DIST)
- { //avatar overrides if previously hit drawable is not an attachment or
- //attachment is far enough away from detected intersection
- drawable = hit;
- local_end = position;
- }
- else
- { //prioritize attachments over avatars
- position = local_end;
-
- if (face_hit)
- {
- *face_hit = local_face_hit;
- }
- if (tex_coord)
- {
- *tex_coord = local_texcoord;
- }
- if (tangent)
- {
- *tangent = local_tangent;
- }
- if (normal)
- {
- *normal = local_normal;
- }
- }
- }
- }
- }
- }
-
- //check all avatar nametags (silly, isn't it?)
- for (std::vector< LLCharacter* >::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end();
- ++iter)
- {
- LLVOAvatar* av = (LLVOAvatar*) *iter;
- if (av->mNameText.notNull()
- && av->mNameText->lineSegmentIntersect(start, local_end, position))
- {
- drawable = av->mDrawable;
- local_end = position;
- }
- }
-
- if (intersection)
- {
- *intersection = position;
- }
-
- return drawable ? drawable->getVObj().get() : NULL;
+ (j == LLViewerRegion::PARTITION_CONTROL_AV) ||
+ (j == LLViewerRegion::PARTITION_TERRAIN) ||
+ (j == LLViewerRegion::PARTITION_TREE) ||
+ (j == LLViewerRegion::PARTITION_GRASS)) // only check these partitions for now
+ {
+ LLSpatialPartition* part = region->getSpatialPartition(j);
+ if (part && hasRenderType(part->mDrawableType))
+ {
+ LLDrawable* hit = part->lineSegmentIntersect(start, local_end, pick_transparent, pick_rigged, pick_unselectable, pick_reflection_probe, face_hit, &position, tex_coord, normal, tangent);
+ if (hit)
+ {
+ drawable = hit;
+ local_end = position;
+ }
+ }
+ }
+ }
+ }
+
+ if (!sPickAvatar)
+ {
+ //save hit info in case we need to restore
+ //due to attachment override
+ LLVector4a local_normal;
+ LLVector4a local_tangent;
+ LLVector2 local_texcoord;
+ S32 local_face_hit = -1;
+
+ if (face_hit)
+ {
+ local_face_hit = *face_hit;
+ }
+ if (tex_coord)
+ {
+ local_texcoord = *tex_coord;
+ }
+ if (tangent)
+ {
+ local_tangent = *tangent;
+ }
+ else
+ {
+ local_tangent.clear();
+ }
+ if (normal)
+ {
+ local_normal = *normal;
+ }
+ else
+ {
+ local_normal.clear();
+ }
+
+ const F32 ATTACHMENT_OVERRIDE_DIST = 0.1f;
+
+ //check against avatars
+ sPickAvatar = true;
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+
+ LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_AVATAR);
+ if (part && hasRenderType(part->mDrawableType))
+ {
+ LLDrawable* hit = part->lineSegmentIntersect(start, local_end, pick_transparent, pick_rigged, pick_unselectable, pick_reflection_probe, face_hit, &position, tex_coord, normal, tangent);
+ if (hit)
+ {
+ LLVector4a delta;
+ delta.setSub(position, local_end);
+
+ if (!drawable ||
+ !drawable->getVObj()->isAttachment() ||
+ delta.getLength3().getF32() > ATTACHMENT_OVERRIDE_DIST)
+ { //avatar overrides if previously hit drawable is not an attachment or
+ //attachment is far enough away from detected intersection
+ drawable = hit;
+ local_end = position;
+ }
+ else
+ { //prioritize attachments over avatars
+ position = local_end;
+
+ if (face_hit)
+ {
+ *face_hit = local_face_hit;
+ }
+ if (tex_coord)
+ {
+ *tex_coord = local_texcoord;
+ }
+ if (tangent)
+ {
+ *tangent = local_tangent;
+ }
+ if (normal)
+ {
+ *normal = local_normal;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //check all avatar nametags (silly, isn't it?)
+ for (std::vector< LLCharacter* >::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end();
+ ++iter)
+ {
+ LLVOAvatar* av = (LLVOAvatar*) *iter;
+ if (av->mNameText.notNull()
+ && av->mNameText->lineSegmentIntersect(start, local_end, position))
+ {
+ drawable = av->mDrawable;
+ local_end = position;
+ }
+ }
+
+ if (intersection)
+ {
+ *intersection = position;
+ }
+
+ return drawable ? drawable->getVObj().get() : NULL;
}
LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector4a& start, const LLVector4a& end,
- bool pick_transparent,
- S32* face_hit,
- LLVector4a* intersection, // return the intersection point
- LLVector2* tex_coord, // return the texture coordinates of the intersection point
- LLVector4a* normal, // return the surface normal at the intersection point
- LLVector4a* tangent // return the surface tangent at the intersection point
- )
-{
- LLDrawable* drawable = NULL;
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
- {
- LLViewerRegion* region = *iter;
-
- bool toggle = false;
- if (!hasRenderType(LLPipeline::RENDER_TYPE_HUD))
- {
- toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
- toggle = true;
- }
-
- LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_HUD);
- if (part)
- {
- LLDrawable* hit = part->lineSegmentIntersect(start, end, pick_transparent, FALSE, TRUE, FALSE, face_hit, intersection, tex_coord, normal, tangent);
- if (hit)
- {
- drawable = hit;
- }
- }
-
- if (toggle)
- {
- toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
- }
- }
- return drawable ? drawable->getVObj().get() : NULL;
+ bool pick_transparent,
+ S32* face_hit,
+ LLVector4a* intersection, // return the intersection point
+ LLVector2* tex_coord, // return the texture coordinates of the intersection point
+ LLVector4a* normal, // return the surface normal at the intersection point
+ LLVector4a* tangent // return the surface tangent at the intersection point
+ )
+{
+ LLDrawable* drawable = NULL;
+
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ {
+ LLViewerRegion* region = *iter;
+
+ bool toggle = false;
+ if (!hasRenderType(LLPipeline::RENDER_TYPE_HUD))
+ {
+ toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
+ toggle = true;
+ }
+
+ LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_HUD);
+ if (part)
+ {
+ LLDrawable* hit = part->lineSegmentIntersect(start, end, pick_transparent, FALSE, TRUE, FALSE, face_hit, intersection, tex_coord, normal, tangent);
+ if (hit)
+ {
+ drawable = hit;
+ }
+ }
+
+ if (toggle)
+ {
+ toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
+ }
+ }
+ return drawable ? drawable->getVObj().get() : NULL;
}
LLSpatialPartition* LLPipeline::getSpatialPartition(LLViewerObject* vobj)
{
- if (vobj)
- {
- LLViewerRegion* region = vobj->getRegion();
- if (region)
- {
- return region->getSpatialPartition(vobj->getPartitionType());
- }
- }
- return NULL;
+ if (vobj)
+ {
+ LLViewerRegion* region = vobj->getRegion();
+ if (region)
+ {
+ return region->getSpatialPartition(vobj->getPartitionType());
+ }
+ }
+ return NULL;
}
void LLPipeline::resetVertexBuffers(LLDrawable* drawable)
{
- if (!drawable)
- {
- return;
- }
+ if (!drawable)
+ {
+ return;
+ }
- for (S32 i = 0; i < drawable->getNumFaces(); i++)
- {
- LLFace* facep = drawable->getFace(i);
- if (facep)
- {
- facep->clearVertexBuffer();
- }
- }
+ for (S32 i = 0; i < drawable->getNumFaces(); i++)
+ {
+ LLFace* facep = drawable->getFace(i);
+ if (facep)
+ {
+ facep->clearVertexBuffer();
+ }
+ }
}
void LLPipeline::renderObjects(U32 type, bool texture, bool batch_texture, bool rigged)
{
- assertInitialized();
- gGL.loadMatrix(gGLModelView);
- gGLLastMatrix = NULL;
+ assertInitialized();
+ gGL.loadMatrix(gGLModelView);
+ gGLLastMatrix = NULL;
if (rigged)
{
@@ -6485,7 +6485,7 @@ void LLPipeline::renderObjects(U32 type, bool texture, bool batch_texture, bool
}
gGL.loadMatrix(gGLModelView);
- gGLLastMatrix = NULL;
+ gGLLastMatrix = NULL;
}
void LLPipeline::renderGLTFObjects(U32 type, bool texture, bool rigged)
@@ -6588,9 +6588,9 @@ void LLPipeline::renderAlphaObjects(bool rigged)
// Currently only used for shadows -Cosmic,2023-04-19
void LLPipeline::renderMaskedObjects(U32 type, bool texture, bool batch_texture, bool rigged)
{
- assertInitialized();
- gGL.loadMatrix(gGLModelView);
- gGLLastMatrix = NULL;
+ assertInitialized();
+ gGL.loadMatrix(gGLModelView);
+ gGLLastMatrix = NULL;
if (rigged)
{
mAlphaMaskPool->pushRiggedMaskBatches(type+1, texture, batch_texture);
@@ -6599,16 +6599,16 @@ void LLPipeline::renderMaskedObjects(U32 type, bool texture, bool batch_texture,
{
mAlphaMaskPool->pushMaskBatches(type, texture, batch_texture);
}
- gGL.loadMatrix(gGLModelView);
- gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
+ gGLLastMatrix = NULL;
}
// Currently only used for shadows -Cosmic,2023-04-19
void LLPipeline::renderFullbrightMaskedObjects(U32 type, bool texture, bool batch_texture, bool rigged)
{
- assertInitialized();
- gGL.loadMatrix(gGLModelView);
- gGLLastMatrix = NULL;
+ assertInitialized();
+ gGL.loadMatrix(gGLModelView);
+ gGLLastMatrix = NULL;
if (rigged)
{
mFullbrightAlphaMaskPool->pushRiggedMaskBatches(type+1, texture, batch_texture);
@@ -6617,164 +6617,164 @@ void LLPipeline::renderFullbrightMaskedObjects(U32 type, bool texture, bool batc
{
mFullbrightAlphaMaskPool->pushMaskBatches(type, texture, batch_texture);
}
- gGL.loadMatrix(gGLModelView);
- gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
+ gGLLastMatrix = NULL;
}
void apply_cube_face_rotation(U32 face)
{
- switch (face)
- {
- case 0:
- gGL.rotatef(90.f, 0, 1, 0);
- gGL.rotatef(180.f, 1, 0, 0);
- break;
- case 2:
- gGL.rotatef(-90.f, 1, 0, 0);
- break;
- case 4:
- gGL.rotatef(180.f, 0, 1, 0);
- gGL.rotatef(180.f, 0, 0, 1);
- break;
- case 1:
- gGL.rotatef(-90.f, 0, 1, 0);
- gGL.rotatef(180.f, 1, 0, 0);
- break;
- case 3:
- gGL.rotatef(90, 1, 0, 0);
- break;
- case 5:
- gGL.rotatef(180, 0, 0, 1);
- break;
- }
+ switch (face)
+ {
+ case 0:
+ gGL.rotatef(90.f, 0, 1, 0);
+ gGL.rotatef(180.f, 1, 0, 0);
+ break;
+ case 2:
+ gGL.rotatef(-90.f, 1, 0, 0);
+ break;
+ case 4:
+ gGL.rotatef(180.f, 0, 1, 0);
+ gGL.rotatef(180.f, 0, 0, 1);
+ break;
+ case 1:
+ gGL.rotatef(-90.f, 0, 1, 0);
+ gGL.rotatef(180.f, 1, 0, 0);
+ break;
+ case 3:
+ gGL.rotatef(90, 1, 0, 0);
+ break;
+ case 5:
+ gGL.rotatef(180, 0, 0, 1);
+ break;
+ }
}
void validate_framebuffer_object()
-{
- GLenum status;
- status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
- switch(status)
- {
- case GL_FRAMEBUFFER_COMPLETE:
- //framebuffer OK, no error.
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
- // frame buffer not OK: probably means unsupported depth buffer format
- LL_ERRS() << "Framebuffer Incomplete Missing Attachment." << LL_ENDL;
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
- // frame buffer not OK: probably means unsupported depth buffer format
- LL_ERRS() << "Framebuffer Incomplete Attachment." << LL_ENDL;
- break;
- case GL_FRAMEBUFFER_UNSUPPORTED:
- /* choose different formats */
- LL_ERRS() << "Framebuffer unsupported." << LL_ENDL;
- break;
- default:
- LL_ERRS() << "Unknown framebuffer status." << LL_ENDL;
- break;
- }
-}
-
-void LLPipeline::bindScreenToTexture()
-{
-
+{
+ GLenum status;
+ status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
+ switch(status)
+ {
+ case GL_FRAMEBUFFER_COMPLETE:
+ //framebuffer OK, no error.
+ break;
+ case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
+ // frame buffer not OK: probably means unsupported depth buffer format
+ LL_ERRS() << "Framebuffer Incomplete Missing Attachment." << LL_ENDL;
+ break;
+ case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
+ // frame buffer not OK: probably means unsupported depth buffer format
+ LL_ERRS() << "Framebuffer Incomplete Attachment." << LL_ENDL;
+ break;
+ case GL_FRAMEBUFFER_UNSUPPORTED:
+ /* choose different formats */
+ LL_ERRS() << "Framebuffer unsupported." << LL_ENDL;
+ break;
+ default:
+ LL_ERRS() << "Unknown framebuffer status." << LL_ENDL;
+ break;
+ }
+}
+
+void LLPipeline::bindScreenToTexture()
+{
+
}
static LLTrace::BlockTimerStatHandle FTM_RENDER_BLOOM("Bloom");
void LLPipeline::visualizeBuffers(LLRenderTarget* src, LLRenderTarget* dst, U32 bufferIndex)
{
- dst->bindTarget();
- gDeferredBufferVisualProgram.bind();
- gDeferredBufferVisualProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_BILINEAR, bufferIndex);
+ dst->bindTarget();
+ gDeferredBufferVisualProgram.bind();
+ gDeferredBufferVisualProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_BILINEAR, bufferIndex);
- static LLStaticHashedString mipLevel("mipLevel");
- if (RenderBufferVisualization != 4)
- gDeferredBufferVisualProgram.uniform1f(mipLevel, 0);
- else
- gDeferredBufferVisualProgram.uniform1f(mipLevel, 8);
+ static LLStaticHashedString mipLevel("mipLevel");
+ if (RenderBufferVisualization != 4)
+ gDeferredBufferVisualProgram.uniform1f(mipLevel, 0);
+ else
+ gDeferredBufferVisualProgram.uniform1f(mipLevel, 8);
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- gDeferredBufferVisualProgram.unbind();
- dst->flush();
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ gDeferredBufferVisualProgram.unbind();
+ dst->flush();
}
void LLPipeline::generateLuminance(LLRenderTarget* src, LLRenderTarget* dst)
{
- // luminance sample and mipmap generation
- {
- LL_PROFILE_GPU_ZONE("luminance sample");
+ // luminance sample and mipmap generation
+ {
+ LL_PROFILE_GPU_ZONE("luminance sample");
- dst->bindTarget();
+ dst->bindTarget();
- LLGLDepthTest depth(GL_FALSE, GL_FALSE);
+ LLGLDepthTest depth(GL_FALSE, GL_FALSE);
- gLuminanceProgram.bind();
+ gLuminanceProgram.bind();
- S32 channel = 0;
- channel = gLuminanceProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE);
- if (channel > -1)
- {
- src->bindTexture(0, channel, LLTexUnit::TFO_POINT);
- }
+ S32 channel = 0;
+ channel = gLuminanceProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE);
+ if (channel > -1)
+ {
+ src->bindTexture(0, channel, LLTexUnit::TFO_POINT);
+ }
- channel = gLuminanceProgram.enableTexture(LLShaderMgr::DEFERRED_EMISSIVE);
- if (channel > -1)
- {
- mGlow[1].bindTexture(0, channel);
- }
+ channel = gLuminanceProgram.enableTexture(LLShaderMgr::DEFERRED_EMISSIVE);
+ if (channel > -1)
+ {
+ mGlow[1].bindTexture(0, channel);
+ }
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- dst->flush();
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ dst->flush();
- // note -- unbind AFTER the glGenerateMipMap so time in generatemipmap can be profiled under "Luminance"
- // also note -- keep an eye on the performance of glGenerateMipmap, might need to replace it with a mip generation shader
- gLuminanceProgram.unbind();
- }
+ // note -- unbind AFTER the glGenerateMipMap so time in generatemipmap can be profiled under "Luminance"
+ // also note -- keep an eye on the performance of glGenerateMipmap, might need to replace it with a mip generation shader
+ gLuminanceProgram.unbind();
+ }
}
void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst) {
- // exposure sample
- {
- LL_PROFILE_GPU_ZONE("exposure sample");
+ // exposure sample
+ {
+ LL_PROFILE_GPU_ZONE("exposure sample");
- {
- // copy last frame's exposure into mLastExposure
- mLastExposure.bindTarget();
- gCopyProgram.bind();
- gGL.getTexUnit(0)->bind(dst);
+ {
+ // copy last frame's exposure into mLastExposure
+ mLastExposure.bindTarget();
+ gCopyProgram.bind();
+ gGL.getTexUnit(0)->bind(dst);
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- mLastExposure.flush();
- }
+ mLastExposure.flush();
+ }
- dst->bindTarget();
+ dst->bindTarget();
- LLGLDepthTest depth(GL_FALSE, GL_FALSE);
+ LLGLDepthTest depth(GL_FALSE, GL_FALSE);
- gExposureProgram.bind();
+ gExposureProgram.bind();
- S32 channel = gExposureProgram.enableTexture(LLShaderMgr::DEFERRED_EMISSIVE);
- if (channel > -1)
- {
- mLuminanceMap.bindTexture(0, channel, LLTexUnit::TFO_TRILINEAR);
- }
+ S32 channel = gExposureProgram.enableTexture(LLShaderMgr::DEFERRED_EMISSIVE);
+ if (channel > -1)
+ {
+ mLuminanceMap.bindTexture(0, channel, LLTexUnit::TFO_TRILINEAR);
+ }
- channel = gExposureProgram.enableTexture(LLShaderMgr::EXPOSURE_MAP);
- if (channel > -1)
- {
- mLastExposure.bindTexture(0, channel);
- }
+ channel = gExposureProgram.enableTexture(LLShaderMgr::EXPOSURE_MAP);
+ if (channel > -1)
+ {
+ mLastExposure.bindTexture(0, channel);
+ }
- static LLStaticHashedString dt("dt");
- static LLStaticHashedString noiseVec("noiseVec");
- static LLStaticHashedString dynamic_exposure_params("dynamic_exposure_params");
- static LLCachedControl<F32> dynamic_exposure_coefficient(gSavedSettings, "RenderDynamicExposureCoefficient", 0.175f);
+ static LLStaticHashedString dt("dt");
+ static LLStaticHashedString noiseVec("noiseVec");
+ static LLStaticHashedString dynamic_exposure_params("dynamic_exposure_params");
+ static LLCachedControl<F32> dynamic_exposure_coefficient(gSavedSettings, "RenderDynamicExposureCoefficient", 0.175f);
static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
LLSettingsSky::ptr_t sky = LLEnvironment::instance().getCurrentSky();
@@ -6782,7 +6782,7 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst) {
F32 probe_ambiance = LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust);
F32 exp_min = 1.f;
F32 exp_max = 1.f;
-
+
if (probe_ambiance > 0.f)
{
F32 hdr_scale = sqrtf(LLEnvironment::instance().getCurrentSky()->getGamma())*2.f;
@@ -6793,43 +6793,43 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst) {
exp_max = hdr_scale;
}
}
- gExposureProgram.uniform1f(dt, gFrameIntervalSeconds);
- gExposureProgram.uniform2f(noiseVec, ll_frand() * 2.0 - 1.0, ll_frand() * 2.0 - 1.0);
- gExposureProgram.uniform3f(dynamic_exposure_params, dynamic_exposure_coefficient, exp_min, exp_max);
+ gExposureProgram.uniform1f(dt, gFrameIntervalSeconds);
+ gExposureProgram.uniform2f(noiseVec, ll_frand() * 2.0 - 1.0, ll_frand() * 2.0 - 1.0);
+ gExposureProgram.uniform3f(dynamic_exposure_params, dynamic_exposure_coefficient, exp_min, exp_max);
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- gGL.getTexUnit(channel)->unbind(mLastExposure.getUsage());
- gExposureProgram.unbind();
- dst->flush();
- }
+ gGL.getTexUnit(channel)->unbind(mLastExposure.getUsage());
+ gExposureProgram.unbind();
+ dst->flush();
+ }
}
void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) {
- dst->bindTarget();
- // gamma correct lighting
- {
- LL_PROFILE_GPU_ZONE("gamma correct");
+ dst->bindTarget();
+ // gamma correct lighting
+ {
+ LL_PROFILE_GPU_ZONE("gamma correct");
static LLCachedControl<bool> buildNoPost(gSavedSettings, "RenderDisablePostProcessing", false);
- LLGLDepthTest depth(GL_FALSE, GL_FALSE);
+ LLGLDepthTest depth(GL_FALSE, GL_FALSE);
- // Apply gamma correction to the frame here.
+ // Apply gamma correction to the frame here.
static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
-
+
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
bool no_post = gSnapshotNoPost || (buildNoPost && gFloaterTools->isAvailable());
LLGLSLShader& shader = no_post ? gNoPostGammaCorrectProgram : // no post (no gamma, no exposure, no tonemapping)
psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? gLegacyPostGammaCorrectProgram :
gDeferredPostGammaCorrectProgram;
-
+
shader.bind();
- S32 channel = 0;
+ S32 channel = 0;
shader.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_POINT);
@@ -6837,71 +6837,71 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) {
shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, src->getWidth(), src->getHeight());
- static LLCachedControl<F32> exposure(gSavedSettings, "RenderExposure", 1.f);
+ static LLCachedControl<F32> exposure(gSavedSettings, "RenderExposure", 1.f);
- F32 e = llclamp(exposure(), 0.5f, 4.f);
+ F32 e = llclamp(exposure(), 0.5f, 4.f);
- static LLStaticHashedString s_exposure("exposure");
+ static LLStaticHashedString s_exposure("exposure");
shader.uniform1f(s_exposure, e);
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- gGL.getTexUnit(channel)->unbind(src->getUsage());
+ gGL.getTexUnit(channel)->unbind(src->getUsage());
shader.unbind();
- }
- dst->flush();
+ }
+ dst->flush();
}
-void LLPipeline::copyScreenSpaceReflections(LLRenderTarget* src, LLRenderTarget* dst)
+void LLPipeline::copyScreenSpaceReflections(LLRenderTarget* src, LLRenderTarget* dst)
{
- if (RenderScreenSpaceReflections && !gCubeSnapshot)
- {
- LL_PROFILE_GPU_ZONE("ssr copy");
- LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
+ if (RenderScreenSpaceReflections && !gCubeSnapshot)
+ {
+ LL_PROFILE_GPU_ZONE("ssr copy");
+ LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
- LLRenderTarget& depth_src = mRT->deferredScreen;
+ LLRenderTarget& depth_src = mRT->deferredScreen;
- dst->bindTarget();
- dst->clear();
- gCopyDepthProgram.bind();
+ dst->bindTarget();
+ dst->clear();
+ gCopyDepthProgram.bind();
- S32 diff_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DIFFUSE_MAP);
- S32 depth_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DEFERRED_DEPTH);
+ S32 diff_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DIFFUSE_MAP);
+ S32 depth_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DEFERRED_DEPTH);
- gGL.getTexUnit(diff_map)->bind(src);
- gGL.getTexUnit(depth_map)->bind(&depth_src, true);
+ gGL.getTexUnit(diff_map)->bind(src);
+ gGL.getTexUnit(depth_map)->bind(&depth_src, true);
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- dst->flush();
- }
+ dst->flush();
+ }
}
-void LLPipeline::generateGlow(LLRenderTarget* src)
+void LLPipeline::generateGlow(LLRenderTarget* src)
{
- if (sRenderGlow)
- {
- LL_PROFILE_GPU_ZONE("glow");
- mGlow[2].bindTarget();
- mGlow[2].clear();
-
- gGlowExtractProgram.bind();
- F32 maxAlpha = RenderGlowMaxExtractAlpha;
- F32 warmthAmount = RenderGlowWarmthAmount;
- LLVector3 lumWeights = RenderGlowLumWeights;
- LLVector3 warmthWeights = RenderGlowWarmthWeights;
-
- gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_MIN_LUMINANCE, 9999);
- gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_MAX_EXTRACT_ALPHA, maxAlpha);
- gGlowExtractProgram.uniform3f(LLShaderMgr::GLOW_LUM_WEIGHTS, lumWeights.mV[0], lumWeights.mV[1],
- lumWeights.mV[2]);
- gGlowExtractProgram.uniform3f(LLShaderMgr::GLOW_WARMTH_WEIGHTS, warmthWeights.mV[0], warmthWeights.mV[1],
- warmthWeights.mV[2]);
- gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_WARMTH_AMOUNT, warmthAmount);
+ if (sRenderGlow)
+ {
+ LL_PROFILE_GPU_ZONE("glow");
+ mGlow[2].bindTarget();
+ mGlow[2].clear();
+
+ gGlowExtractProgram.bind();
+ F32 maxAlpha = RenderGlowMaxExtractAlpha;
+ F32 warmthAmount = RenderGlowWarmthAmount;
+ LLVector3 lumWeights = RenderGlowLumWeights;
+ LLVector3 warmthWeights = RenderGlowWarmthWeights;
+
+ gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_MIN_LUMINANCE, 9999);
+ gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_MAX_EXTRACT_ALPHA, maxAlpha);
+ gGlowExtractProgram.uniform3f(LLShaderMgr::GLOW_LUM_WEIGHTS, lumWeights.mV[0], lumWeights.mV[1],
+ lumWeights.mV[2]);
+ gGlowExtractProgram.uniform3f(LLShaderMgr::GLOW_WARMTH_WEIGHTS, warmthWeights.mV[0], warmthWeights.mV[1],
+ warmthWeights.mV[2]);
+ gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_WARMTH_AMOUNT, warmthAmount);
if (RenderGlowNoise)
{
@@ -6916,406 +6916,406 @@ void LLPipeline::generateGlow(LLRenderTarget* src)
mGlow[2].getHeight());
}
- {
- LLGLEnable blend_on(GL_BLEND);
+ {
+ LLGLEnable blend_on(GL_BLEND);
- gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
+ gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
- gGlowExtractProgram.bindTexture(LLShaderMgr::DIFFUSE_MAP, src);
+ gGlowExtractProgram.bindTexture(LLShaderMgr::DIFFUSE_MAP, src);
- gGL.color4f(1, 1, 1, 1);
- gPipeline.enableLightsFullbright();
+ gGL.color4f(1, 1, 1, 1);
+ gPipeline.enableLightsFullbright();
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- mGlow[2].flush();
- }
+ mGlow[2].flush();
+ }
- gGlowExtractProgram.unbind();
+ gGlowExtractProgram.unbind();
- // power of two between 1 and 1024
- U32 glowResPow = RenderGlowResolutionPow;
- const U32 glow_res = llmax(1, llmin(1024, 1 << glowResPow));
+ // power of two between 1 and 1024
+ U32 glowResPow = RenderGlowResolutionPow;
+ const U32 glow_res = llmax(1, llmin(1024, 1 << glowResPow));
- S32 kernel = RenderGlowIterations * 2;
- F32 delta = RenderGlowWidth / glow_res;
- // Use half the glow width if we have the res set to less than 9 so that it looks
- // almost the same in either case.
- if (glowResPow < 9)
- {
- delta *= 0.5f;
- }
- F32 strength = RenderGlowStrength;
+ S32 kernel = RenderGlowIterations * 2;
+ F32 delta = RenderGlowWidth / glow_res;
+ // Use half the glow width if we have the res set to less than 9 so that it looks
+ // almost the same in either case.
+ if (glowResPow < 9)
+ {
+ delta *= 0.5f;
+ }
+ F32 strength = RenderGlowStrength;
- gGlowProgram.bind();
- gGlowProgram.uniform1f(LLShaderMgr::GLOW_STRENGTH, strength);
-
- for (S32 i = 0; i < kernel; i++)
- {
- mGlow[i % 2].bindTarget();
- mGlow[i % 2].clear();
-
- if (i == 0)
- {
- gGlowProgram.bindTexture(LLShaderMgr::DIFFUSE_MAP, &mGlow[2]);
- }
- else
- {
- gGlowProgram.bindTexture(LLShaderMgr::DIFFUSE_MAP, &mGlow[(i - 1) % 2]);
- }
-
- if (i % 2 == 0)
- {
- gGlowProgram.uniform2f(LLShaderMgr::GLOW_DELTA, delta, 0);
- }
- else
- {
- gGlowProgram.uniform2f(LLShaderMgr::GLOW_DELTA, 0, delta);
- }
-
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
-
- mGlow[i % 2].flush();
- }
-
- gGlowProgram.unbind();
-
- }
- else // !sRenderGlow, skip the glow ping-pong and just clear the result target
- {
- mGlow[1].bindTarget();
- mGlow[1].clear();
- mGlow[1].flush();
- }
-}
-
-void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
-{
- {
- llassert(!gCubeSnapshot);
- bool multisample = RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete();
- LLGLSLShader* shader = &gGlowCombineProgram;
-
- S32 width = dst->getWidth();
- S32 height = dst->getHeight();
-
- // Present everything.
- if (multisample)
- {
- LL_PROFILE_GPU_ZONE("aa");
- // bake out texture2D with RGBL for FXAA shader
- mRT->fxaaBuffer.bindTarget();
-
- shader = &gGlowCombineFXAAProgram;
- shader->bind();
-
- S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
- if (channel > -1)
- {
- src->bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
- }
-
- {
- LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- }
-
- shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
- shader->unbind();
-
- mRT->fxaaBuffer.flush();
-
- dst->bindTarget();
- shader = &gFXAAProgram;
- shader->bind();
-
- channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mRT->fxaaBuffer.getUsage());
- if (channel > -1)
- {
- mRT->fxaaBuffer.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
- }
-
- gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
- gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
- gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
- gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
-
- glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
-
- F32 scale_x = (F32)width / mRT->fxaaBuffer.getWidth();
- F32 scale_y = (F32)height / mRT->fxaaBuffer.getHeight();
- shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y);
- shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f / width * scale_x, 1.f / height * scale_y);
- shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f / width * scale_x, -0.5f / height * scale_y,
- 0.5f / width * scale_x, 0.5f / height * scale_y);
- shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT2, -2.f / width * scale_x, -2.f / height * scale_y,
- 2.f / width * scale_x, 2.f / height * scale_y);
-
- {
- LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
- S32 depth_channel = shader->getTextureChannel(LLShaderMgr::DEFERRED_DEPTH);
- gGL.getTexUnit(depth_channel)->bind(&mRT->deferredScreen, true);
-
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- }
-
- shader->unbind();
- dst->flush();
- }
- else {
- copyRenderTarget(src, dst);
- }
- }
+ gGlowProgram.bind();
+ gGlowProgram.uniform1f(LLShaderMgr::GLOW_STRENGTH, strength);
+
+ for (S32 i = 0; i < kernel; i++)
+ {
+ mGlow[i % 2].bindTarget();
+ mGlow[i % 2].clear();
+
+ if (i == 0)
+ {
+ gGlowProgram.bindTexture(LLShaderMgr::DIFFUSE_MAP, &mGlow[2]);
+ }
+ else
+ {
+ gGlowProgram.bindTexture(LLShaderMgr::DIFFUSE_MAP, &mGlow[(i - 1) % 2]);
+ }
+
+ if (i % 2 == 0)
+ {
+ gGlowProgram.uniform2f(LLShaderMgr::GLOW_DELTA, delta, 0);
+ }
+ else
+ {
+ gGlowProgram.uniform2f(LLShaderMgr::GLOW_DELTA, 0, delta);
+ }
+
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
+ mGlow[i % 2].flush();
+ }
+
+ gGlowProgram.unbind();
+
+ }
+ else // !sRenderGlow, skip the glow ping-pong and just clear the result target
+ {
+ mGlow[1].bindTarget();
+ mGlow[1].clear();
+ mGlow[1].flush();
+ }
+}
+
+void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
+{
+ {
+ llassert(!gCubeSnapshot);
+ bool multisample = RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete();
+ LLGLSLShader* shader = &gGlowCombineProgram;
+
+ S32 width = dst->getWidth();
+ S32 height = dst->getHeight();
+
+ // Present everything.
+ if (multisample)
+ {
+ LL_PROFILE_GPU_ZONE("aa");
+ // bake out texture2D with RGBL for FXAA shader
+ mRT->fxaaBuffer.bindTarget();
+
+ shader = &gGlowCombineFXAAProgram;
+ shader->bind();
+
+ S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
+ if (channel > -1)
+ {
+ src->bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
+ }
+
+ {
+ LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ }
+
+ shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
+ shader->unbind();
+
+ mRT->fxaaBuffer.flush();
+
+ dst->bindTarget();
+ shader = &gFXAAProgram;
+ shader->bind();
+
+ channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mRT->fxaaBuffer.getUsage());
+ if (channel > -1)
+ {
+ mRT->fxaaBuffer.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
+ }
+
+ gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+ gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+ gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+ gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+
+ F32 scale_x = (F32)width / mRT->fxaaBuffer.getWidth();
+ F32 scale_y = (F32)height / mRT->fxaaBuffer.getHeight();
+ shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y);
+ shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f / width * scale_x, 1.f / height * scale_y);
+ shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f / width * scale_x, -0.5f / height * scale_y,
+ 0.5f / width * scale_x, 0.5f / height * scale_y);
+ shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT2, -2.f / width * scale_x, -2.f / height * scale_y,
+ 2.f / width * scale_x, 2.f / height * scale_y);
+
+ {
+ LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
+ S32 depth_channel = shader->getTextureChannel(LLShaderMgr::DEFERRED_DEPTH);
+ gGL.getTexUnit(depth_channel)->bind(&mRT->deferredScreen, true);
+
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ }
+
+ shader->unbind();
+ dst->flush();
+ }
+ else {
+ copyRenderTarget(src, dst);
+ }
+ }
}
void LLPipeline::copyRenderTarget(LLRenderTarget* src, LLRenderTarget* dst)
{
- LL_PROFILE_GPU_ZONE("copyRenderTarget");
- dst->bindTarget();
+ LL_PROFILE_GPU_ZONE("copyRenderTarget");
+ dst->bindTarget();
- gDeferredPostNoDoFProgram.bind();
+ gDeferredPostNoDoFProgram.bind();
- gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src);
- gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
+ gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src);
+ gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
- {
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- }
+ {
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ }
- gDeferredPostNoDoFProgram.unbind();
+ gDeferredPostNoDoFProgram.unbind();
- dst->flush();
+ dst->flush();
}
void LLPipeline::combineGlow(LLRenderTarget* src, LLRenderTarget* dst)
{
- // Go ahead and do our glow combine here in our destination. We blit this later into the front buffer.
+ // Go ahead and do our glow combine here in our destination. We blit this later into the front buffer.
- dst->bindTarget();
+ dst->bindTarget();
- {
+ {
- gGlowCombineProgram.bind();
+ gGlowCombineProgram.bind();
- gGlowCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src);
- gGlowCombineProgram.bindTexture(LLShaderMgr::DEFERRED_EMISSIVE, &mGlow[1]);
+ gGlowCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src);
+ gGlowCombineProgram.bindTexture(LLShaderMgr::DEFERRED_EMISSIVE, &mGlow[1]);
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- }
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ }
- dst->flush();
+ dst->flush();
}
void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst)
{
- {
- bool dof_enabled =
- (RenderDepthOfFieldInEditMode || !LLToolMgr::getInstance()->inBuildMode()) &&
- RenderDepthOfField &&
- !gCubeSnapshot;
-
- gViewerWindow->setup3DViewport();
-
- if (dof_enabled)
- {
- LL_PROFILE_GPU_ZONE("dof");
- LLGLDisable blend(GL_BLEND);
-
- // depth of field focal plane calculations
- static F32 current_distance = 16.f;
- static F32 start_distance = 16.f;
- static F32 transition_time = 1.f;
-
- LLVector3 focus_point;
-
- LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject();
- if (obj && obj->mDrawable && obj->isSelected())
- { // focus on selected media object
- S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace();
- if (obj && obj->mDrawable)
- {
- LLFace* face = obj->mDrawable->getFace(face_idx);
- if (face)
- {
- focus_point = face->getPositionAgent();
- }
- }
- }
-
- if (focus_point.isExactlyZero())
- {
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- { // focus on point under cursor
- focus_point.set(gDebugRaycastIntersection.getF32ptr());
- }
- else if (gAgentCamera.cameraMouselook())
- { // focus on point under mouselook crosshairs
- LLVector4a result;
- result.clear();
-
- gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, TRUE, NULL, &result);
-
- focus_point.set(result.getF32ptr());
- }
- else
- {
- // focus on alt-zoom target
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
- {
- focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
- }
- }
- }
-
- LLVector3 eye = LLViewerCamera::getInstance()->getOrigin();
- F32 target_distance = 16.f;
- if (!focus_point.isExactlyZero())
- {
- target_distance = LLViewerCamera::getInstance()->getAtAxis() * (focus_point - eye);
- }
-
- if (transition_time >= 1.f && fabsf(current_distance - target_distance) / current_distance > 0.01f)
- { // large shift happened, interpolate smoothly to new target distance
- transition_time = 0.f;
- start_distance = current_distance;
- }
- else if (transition_time < 1.f)
- { // currently in a transition, continue interpolating
- transition_time += 1.f / CameraFocusTransitionTime * gFrameIntervalSeconds.value();
- transition_time = llmin(transition_time, 1.f);
-
- F32 t = cosf(transition_time * F_PI + F_PI) * 0.5f + 0.5f;
- current_distance = start_distance + (target_distance - start_distance) * t;
- }
- else
- { // small or no change, just snap to target distance
- current_distance = target_distance;
- }
-
- // convert to mm
- F32 subject_distance = current_distance * 1000.f;
- F32 fnumber = CameraFNumber;
- F32 default_focal_length = CameraFocalLength;
-
- F32 fov = LLViewerCamera::getInstance()->getView();
-
- const F32 default_fov = CameraFieldOfView * F_PI / 180.f;
-
- // F32 aspect_ratio = (F32) mRT->screen.getWidth()/(F32)mRT->screen.getHeight();
-
- F32 dv = 2.f * default_focal_length * tanf(default_fov / 2.f);
-
- F32 focal_length = dv / (2 * tanf(fov / 2.f));
-
- // F32 tan_pixel_angle = tanf(LLDrawable::sCurPixelAngle);
-
- // from wikipedia -- c = |s2-s1|/s2 * f^2/(N(S1-f))
- // where N = fnumber
- // s2 = dot distance
- // s1 = subject distance
- // f = focal length
- //
-
- F32 blur_constant = focal_length * focal_length / (fnumber * (subject_distance - focal_length));
- blur_constant /= 1000.f; // convert to meters for shader
- F32 magnification = focal_length / (subject_distance - focal_length);
-
- { // build diffuse+bloom+CoF
- mRT->deferredLight.bindTarget();
-
- gDeferredCoFProgram.bind();
-
- gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
- gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
-
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
- gDeferredCoFProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, dst->getWidth(), dst->getHeight());
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance / 1000.f);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f / LLDrawable::sCurPixelAngle));
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
-
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- gDeferredCoFProgram.unbind();
- mRT->deferredLight.flush();
- }
-
- U32 dof_width = (U32)(mRT->screen.getWidth() * CameraDoFResScale);
- U32 dof_height = (U32)(mRT->screen.getHeight() * CameraDoFResScale);
-
- { // perform DoF sampling at half-res (preserve alpha channel)
- src->bindTarget();
- glViewport(0, 0, dof_width, dof_height);
-
- gGL.setColorMask(true, false);
-
- gDeferredPostProgram.bind();
- gDeferredPostProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, &mRT->deferredLight, LLTexUnit::TFO_POINT);
-
- gDeferredPostProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, dst->getWidth(), dst->getHeight());
- gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
- gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
-
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
-
- gDeferredPostProgram.unbind();
-
- src->flush();
- gGL.setColorMask(true, true);
- }
-
- { // combine result based on alpha
-
- dst->bindTarget();
- if (RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete())
+ {
+ bool dof_enabled =
+ (RenderDepthOfFieldInEditMode || !LLToolMgr::getInstance()->inBuildMode()) &&
+ RenderDepthOfField &&
+ !gCubeSnapshot;
+
+ gViewerWindow->setup3DViewport();
+
+ if (dof_enabled)
+ {
+ LL_PROFILE_GPU_ZONE("dof");
+ LLGLDisable blend(GL_BLEND);
+
+ // depth of field focal plane calculations
+ static F32 current_distance = 16.f;
+ static F32 start_distance = 16.f;
+ static F32 transition_time = 1.f;
+
+ LLVector3 focus_point;
+
+ LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject();
+ if (obj && obj->mDrawable && obj->isSelected())
+ { // focus on selected media object
+ S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace();
+ if (obj && obj->mDrawable)
+ {
+ LLFace* face = obj->mDrawable->getFace(face_idx);
+ if (face)
+ {
+ focus_point = face->getPositionAgent();
+ }
+ }
+ }
+
+ if (focus_point.isExactlyZero())
+ {
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ { // focus on point under cursor
+ focus_point.set(gDebugRaycastIntersection.getF32ptr());
+ }
+ else if (gAgentCamera.cameraMouselook())
+ { // focus on point under mouselook crosshairs
+ LLVector4a result;
+ result.clear();
+
+ gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, TRUE, NULL, &result);
+
+ focus_point.set(result.getF32ptr());
+ }
+ else
{
- glViewport(0, 0, dst->getWidth(), dst->getHeight());
- }
- else
+ // focus on alt-zoom target
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ }
+ }
+ }
+
+ LLVector3 eye = LLViewerCamera::getInstance()->getOrigin();
+ F32 target_distance = 16.f;
+ if (!focus_point.isExactlyZero())
+ {
+ target_distance = LLViewerCamera::getInstance()->getAtAxis() * (focus_point - eye);
+ }
+
+ if (transition_time >= 1.f && fabsf(current_distance - target_distance) / current_distance > 0.01f)
+ { // large shift happened, interpolate smoothly to new target distance
+ transition_time = 0.f;
+ start_distance = current_distance;
+ }
+ else if (transition_time < 1.f)
+ { // currently in a transition, continue interpolating
+ transition_time += 1.f / CameraFocusTransitionTime * gFrameIntervalSeconds.value();
+ transition_time = llmin(transition_time, 1.f);
+
+ F32 t = cosf(transition_time * F_PI + F_PI) * 0.5f + 0.5f;
+ current_distance = start_distance + (target_distance - start_distance) * t;
+ }
+ else
+ { // small or no change, just snap to target distance
+ current_distance = target_distance;
+ }
+
+ // convert to mm
+ F32 subject_distance = current_distance * 1000.f;
+ F32 fnumber = CameraFNumber;
+ F32 default_focal_length = CameraFocalLength;
+
+ F32 fov = LLViewerCamera::getInstance()->getView();
+
+ const F32 default_fov = CameraFieldOfView * F_PI / 180.f;
+
+ // F32 aspect_ratio = (F32) mRT->screen.getWidth()/(F32)mRT->screen.getHeight();
+
+ F32 dv = 2.f * default_focal_length * tanf(default_fov / 2.f);
+
+ F32 focal_length = dv / (2 * tanf(fov / 2.f));
+
+ // F32 tan_pixel_angle = tanf(LLDrawable::sCurPixelAngle);
+
+ // from wikipedia -- c = |s2-s1|/s2 * f^2/(N(S1-f))
+ // where N = fnumber
+ // s2 = dot distance
+ // s1 = subject distance
+ // f = focal length
+ //
+
+ F32 blur_constant = focal_length * focal_length / (fnumber * (subject_distance - focal_length));
+ blur_constant /= 1000.f; // convert to meters for shader
+ F32 magnification = focal_length / (subject_distance - focal_length);
+
+ { // build diffuse+bloom+CoF
+ mRT->deferredLight.bindTarget();
+
+ gDeferredCoFProgram.bind();
+
+ gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
+ gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
+
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
+ gDeferredCoFProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, dst->getWidth(), dst->getHeight());
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance / 1000.f);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f / LLDrawable::sCurPixelAngle));
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ gDeferredCoFProgram.unbind();
+ mRT->deferredLight.flush();
+ }
+
+ U32 dof_width = (U32)(mRT->screen.getWidth() * CameraDoFResScale);
+ U32 dof_height = (U32)(mRT->screen.getHeight() * CameraDoFResScale);
+
+ { // perform DoF sampling at half-res (preserve alpha channel)
+ src->bindTarget();
+ glViewport(0, 0, dof_width, dof_height);
+
+ gGL.setColorMask(true, false);
+
+ gDeferredPostProgram.bind();
+ gDeferredPostProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, &mRT->deferredLight, LLTexUnit::TFO_POINT);
+
+ gDeferredPostProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, dst->getWidth(), dst->getHeight());
+ gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+ gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
+ gDeferredPostProgram.unbind();
+
+ src->flush();
+ gGL.setColorMask(true, true);
+ }
+
+ { // combine result based on alpha
+
+ dst->bindTarget();
+ if (RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete())
+ {
+ glViewport(0, 0, dst->getWidth(), dst->getHeight());
+ }
+ else
{
- gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
- gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
- gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
- gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
- glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
- }
-
- gDeferredDoFCombineProgram.bind();
- gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
- gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_LIGHT, &mRT->deferredLight, LLTexUnit::TFO_POINT);
-
- gDeferredDoFCombineProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, dst->getWidth(), dst->getHeight());
- gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
- gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
- gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_WIDTH, (dof_width - 1) / (F32)src->getWidth());
- gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_HEIGHT, (dof_height - 1) / (F32)src->getHeight());
-
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
-
- gDeferredDoFCombineProgram.unbind();
-
- dst->flush();
- }
- }
- else
- {
- copyRenderTarget(src, dst);
- }
- }
+ gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+ gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+ gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+ gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+ }
+
+ gDeferredDoFCombineProgram.bind();
+ gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
+ gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_LIGHT, &mRT->deferredLight, LLTexUnit::TFO_POINT);
+
+ gDeferredDoFCombineProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, dst->getWidth(), dst->getHeight());
+ gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+ gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+ gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_WIDTH, (dof_width - 1) / (F32)src->getWidth());
+ gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_HEIGHT, (dof_height - 1) / (F32)src->getHeight());
+
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
+ gDeferredDoFCombineProgram.unbind();
+
+ dst->flush();
+ }
+ }
+ else
+ {
+ copyRenderTarget(src, dst);
+ }
+ }
}
void LLPipeline::renderFinalize()
@@ -7339,7 +7339,7 @@ void LLPipeline::renderFinalize()
gGL.setColorMask(true, true);
glClearColor(0, 0, 0, 0);
-
+
copyScreenSpaceReflections(&mRT->screen, &mSceneMap);
generateLuminance(&mRT->screen, &mLuminanceMap);
@@ -7354,49 +7354,49 @@ void LLPipeline::renderFinalize()
combineGlow(&mPostMap, &mRT->screen);
- gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
- gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
- gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
- gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
- glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
-
- renderDoF(&mRT->screen, &mPostMap);
-
- applyFXAA(&mPostMap, &mRT->screen);
- LLRenderTarget* finalBuffer = &mRT->screen;
- if (RenderBufferVisualization > -1)
- {
- finalBuffer = &mPostMap;
- switch (RenderBufferVisualization)
- {
- case 0:
- case 1:
- case 2:
- case 3:
- visualizeBuffers(&mRT->deferredScreen, finalBuffer, RenderBufferVisualization);
- break;
- case 4:
- visualizeBuffers(&mLuminanceMap, finalBuffer, 0);
- default:
- break;
- }
- }
-
- // Present the screen target.
-
- gDeferredPostNoDoFProgram.bind();
-
- // Whatever is last in the above post processing chain should _always_ be rendered directly here. If not, expect problems.
- gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, finalBuffer);
- gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
-
- {
- LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- }
-
- gDeferredPostNoDoFProgram.unbind();
+ gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+ gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+ gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+ gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+
+ renderDoF(&mRT->screen, &mPostMap);
+
+ applyFXAA(&mPostMap, &mRT->screen);
+ LLRenderTarget* finalBuffer = &mRT->screen;
+ if (RenderBufferVisualization > -1)
+ {
+ finalBuffer = &mPostMap;
+ switch (RenderBufferVisualization)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ visualizeBuffers(&mRT->deferredScreen, finalBuffer, RenderBufferVisualization);
+ break;
+ case 4:
+ visualizeBuffers(&mLuminanceMap, finalBuffer, 0);
+ default:
+ break;
+ }
+ }
+
+ // Present the screen target.
+
+ gDeferredPostNoDoFProgram.bind();
+
+ // Whatever is last in the above post processing chain should _always_ be rendered directly here. If not, expect problems.
+ gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, finalBuffer);
+ gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
+
+ {
+ LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ }
+
+ gDeferredPostNoDoFProgram.unbind();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -7486,28 +7486,28 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
LLRenderTarget* deferred_target = &mRT->deferredScreen;
LLRenderTarget* deferred_light_target = &mRT->deferredLight;
- shader.bind();
- S32 channel = 0;
+ shader.bind();
+ S32 channel = 0;
channel = shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, deferred_target->getUsage());
- if (channel > -1)
- {
+ if (channel > -1)
+ {
deferred_target->bindTexture(0,channel, LLTexUnit::TFO_POINT); // frag_data[0]
gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- }
+ }
channel = shader.enableTexture(LLShaderMgr::DEFERRED_SPECULAR, deferred_target->getUsage());
- if (channel > -1)
- {
+ if (channel > -1)
+ {
deferred_target->bindTexture(1, channel, LLTexUnit::TFO_POINT); // frag_data[1]
gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- }
+ }
channel = shader.enableTexture(LLShaderMgr::DEFERRED_NORMAL, deferred_target->getUsage());
- if (channel > -1)
- {
+ if (channel > -1)
+ {
deferred_target->bindTexture(2, channel, LLTexUnit::TFO_POINT); // frag_data[2]
gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- }
+ }
channel = shader.enableTexture(LLShaderMgr::DEFERRED_EMISSIVE, deferred_target->getUsage());
if (channel > -1)
@@ -7538,32 +7538,32 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
if (shader.getUniformLocation(LLShaderMgr::VIEWPORT) != -1)
{
- shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0],
- (F32) gGLViewport[1],
- (F32) gGLViewport[2],
- (F32) gGLViewport[3]);
- }
+ shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0],
+ (F32) gGLViewport[1],
+ (F32) gGLViewport[2],
+ (F32) gGLViewport[3]);
+ }
if (sReflectionRender && !shader.getUniformLocation(LLShaderMgr::MODELVIEW_MATRIX))
{
- shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, FALSE, mReflectionModelView.m);
+ shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, FALSE, mReflectionModelView.m);
}
- channel = shader.enableTexture(LLShaderMgr::DEFERRED_NOISE);
- if (channel > -1)
- {
+ channel = shader.enableTexture(LLShaderMgr::DEFERRED_NOISE);
+ if (channel > -1)
+ {
gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap);
- gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
- }
+ gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+ }
bindLightFunc(shader);
- stop_glerror();
+ stop_glerror();
light_target = light_target ? light_target : deferred_light_target;
channel = shader.enableTexture(LLShaderMgr::DEFERRED_LIGHT, light_target->getUsage());
- if (channel > -1)
- {
+ if (channel > -1)
+ {
if (light_target->isComplete())
{
light_target->bindTexture(0, channel, LLTexUnit::TFO_POINT);
@@ -7572,28 +7572,28 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
{
gGL.getTexUnit(channel)->bindFast(LLViewerFetchedTexture::sWhiteImagep);
}
- }
+ }
- stop_glerror();
+ stop_glerror();
bindShadowMaps(shader);
- stop_glerror();
+ stop_glerror();
- F32 mat[16*6];
- for (U32 i = 0; i < 16; i++)
- {
- mat[i] = mSunShadowMatrix[0].m[i];
- mat[i+16] = mSunShadowMatrix[1].m[i];
- mat[i+32] = mSunShadowMatrix[2].m[i];
- mat[i+48] = mSunShadowMatrix[3].m[i];
- mat[i+64] = mSunShadowMatrix[4].m[i];
- mat[i+80] = mSunShadowMatrix[5].m[i];
- }
+ F32 mat[16*6];
+ for (U32 i = 0; i < 16; i++)
+ {
+ mat[i] = mSunShadowMatrix[0].m[i];
+ mat[i+16] = mSunShadowMatrix[1].m[i];
+ mat[i+32] = mSunShadowMatrix[2].m[i];
+ mat[i+48] = mSunShadowMatrix[3].m[i];
+ mat[i+64] = mSunShadowMatrix[4].m[i];
+ mat[i+80] = mSunShadowMatrix[5].m[i];
+ }
- shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, FALSE, mat);
+ shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, FALSE, mat);
- stop_glerror();
+ stop_glerror();
if (!LLPipeline::sReflectionProbesEnabled)
{
@@ -7655,55 +7655,55 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
{
shader.uniform4fv(LLShaderMgr::DEFERRED_SHADOW_CLIP, 1, mSunClipPlanes.mV);
}
- shader.uniform1f(LLShaderMgr::DEFERRED_SUN_WASH, RenderDeferredSunWash);
- shader.uniform1f(LLShaderMgr::DEFERRED_SHADOW_NOISE, RenderShadowNoise);
- shader.uniform1f(LLShaderMgr::DEFERRED_BLUR_SIZE, RenderShadowBlurSize);
-
- shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_RADIUS, RenderSSAOScale);
- shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_MAX_RADIUS, RenderSSAOMaxScale);
-
- F32 ssao_factor = RenderSSAOFactor;
- shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor);
- shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0/ssao_factor);
-
- LLVector3 ssao_effect = RenderSSAOEffect;
- F32 matrix_diag = (ssao_effect[0] + 2.0*ssao_effect[1])/3.0;
- F32 matrix_nondiag = (ssao_effect[0] - ssao_effect[1])/3.0;
- // This matrix scales (proj of color onto <1/rt(3),1/rt(3),1/rt(3)>) by
- // value factor, and scales remainder by saturation factor
- F32 ssao_effect_mat[] = { matrix_diag, matrix_nondiag, matrix_nondiag,
- matrix_nondiag, matrix_diag, matrix_nondiag,
- matrix_nondiag, matrix_nondiag, matrix_diag};
- shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_SSAO_EFFECT_MAT, 1, GL_FALSE, ssao_effect_mat);
-
- //F32 shadow_offset_error = 1.f + RenderShadowOffsetError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]);
- F32 shadow_bias_error = RenderShadowBiasError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2])/3000.f;
+ shader.uniform1f(LLShaderMgr::DEFERRED_SUN_WASH, RenderDeferredSunWash);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SHADOW_NOISE, RenderShadowNoise);
+ shader.uniform1f(LLShaderMgr::DEFERRED_BLUR_SIZE, RenderShadowBlurSize);
+
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_RADIUS, RenderSSAOScale);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_MAX_RADIUS, RenderSSAOMaxScale);
+
+ F32 ssao_factor = RenderSSAOFactor;
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0/ssao_factor);
+
+ LLVector3 ssao_effect = RenderSSAOEffect;
+ F32 matrix_diag = (ssao_effect[0] + 2.0*ssao_effect[1])/3.0;
+ F32 matrix_nondiag = (ssao_effect[0] - ssao_effect[1])/3.0;
+ // This matrix scales (proj of color onto <1/rt(3),1/rt(3),1/rt(3)>) by
+ // value factor, and scales remainder by saturation factor
+ F32 ssao_effect_mat[] = { matrix_diag, matrix_nondiag, matrix_nondiag,
+ matrix_nondiag, matrix_diag, matrix_nondiag,
+ matrix_nondiag, matrix_nondiag, matrix_diag};
+ shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_SSAO_EFFECT_MAT, 1, GL_FALSE, ssao_effect_mat);
+
+ //F32 shadow_offset_error = 1.f + RenderShadowOffsetError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]);
+ F32 shadow_bias_error = RenderShadowBiasError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2])/3000.f;
F32 shadow_bias = RenderShadowBias + shadow_bias_error;
shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, deferred_target->getWidth(), deferred_target->getHeight());
- shader.uniform1f(LLShaderMgr::DEFERRED_NEAR_CLIP, LLViewerCamera::getInstance()->getNear()*2.f);
- shader.uniform1f (LLShaderMgr::DEFERRED_SHADOW_OFFSET, RenderShadowOffset); //*shadow_offset_error);
+ shader.uniform1f(LLShaderMgr::DEFERRED_NEAR_CLIP, LLViewerCamera::getInstance()->getNear()*2.f);
+ shader.uniform1f (LLShaderMgr::DEFERRED_SHADOW_OFFSET, RenderShadowOffset); //*shadow_offset_error);
shader.uniform1f(LLShaderMgr::DEFERRED_SHADOW_BIAS, shadow_bias);
- shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_OFFSET, RenderSpotShadowOffset);
- shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_BIAS, RenderSpotShadowBias);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_OFFSET, RenderSpotShadowOffset);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_BIAS, RenderSpotShadowBias);
- shader.uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, mTransformedSunDir.mV);
+ shader.uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, mTransformedSunDir.mV);
shader.uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, mTransformedMoonDir.mV);
- shader.uniform2f(LLShaderMgr::DEFERRED_SHADOW_RES, mRT->shadow[0].getWidth(), mRT->shadow[0].getHeight());
- shader.uniform2f(LLShaderMgr::DEFERRED_PROJ_SHADOW_RES, mSpotShadow[0].getWidth(), mSpotShadow[0].getHeight());
- shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
- shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
-
+ shader.uniform2f(LLShaderMgr::DEFERRED_SHADOW_RES, mRT->shadow[0].getWidth(), mRT->shadow[0].getHeight());
+ shader.uniform2f(LLShaderMgr::DEFERRED_PROJ_SHADOW_RES, mSpotShadow[0].getWidth(), mSpotShadow[0].getHeight());
+ shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
+ shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
+
shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, gGLDeltaModelView);
shader.uniformMatrix4fv(LLShaderMgr::INVERSE_MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, gGLInverseDeltaModelView);
shader.uniform1i(LLShaderMgr::CUBE_SNAPSHOT, gCubeSnapshot ? 1 : 0);
- if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0)
- {
+ if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0)
+ {
glh::matrix4f norm_mat = get_current_modelview().inverse().transpose();
- shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m);
- }
+ shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m);
+ }
// auto adjust legacy sun color if needed
static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
@@ -7724,18 +7724,18 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
LLColor3 pow3f(LLColor3 v, F32 f)
{
- v.mV[0] = powf(v.mV[0], f);
- v.mV[1] = powf(v.mV[1], f);
- v.mV[2] = powf(v.mV[2], f);
- return v;
+ v.mV[0] = powf(v.mV[0], f);
+ v.mV[1] = powf(v.mV[1], f);
+ v.mV[2] = powf(v.mV[2], f);
+ return v;
}
LLVector4 pow4fsrgb(LLVector4 v, F32 f)
{
- v.mV[0] = powf(v.mV[0], f);
- v.mV[1] = powf(v.mV[1], f);
- v.mV[2] = powf(v.mV[2], f);
- return v;
+ v.mV[0] = powf(v.mV[0], f);
+ v.mV[1] = powf(v.mV[1], f);
+ v.mV[2] = powf(v.mV[2], f);
+ return v;
}
void LLPipeline::renderDeferredLighting()
@@ -7762,7 +7762,7 @@ void LLPipeline::renderDeferredLighting()
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("deferred");
LLViewerCamera *camera = LLViewerCamera::getInstance();
-
+
if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
{
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
@@ -7914,14 +7914,14 @@ void LLPipeline::renderDeferredLighting()
static LLCachedControl<F32> ssao_max(gSavedSettings, "RenderSSAOIrradianceMax", 0.25f);
static LLStaticHashedString ssao_scale_str("ssao_irradiance_scale");
static LLStaticHashedString ssao_max_str("ssao_irradiance_max");
-
+
soften_shader.uniform1f(ssao_scale_str, ssao_scale);
soften_shader.uniform1f(ssao_max_str, ssao_max);
LLEnvironment &environment = LLEnvironment::instance();
soften_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
soften_shader.uniform3fv(LLShaderMgr::LIGHTNORM, 1, environment.getClampedLightNorm().mV);
-
+
soften_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV);
{
@@ -8295,7 +8295,7 @@ void LLPipeline::doAtmospherics()
// full screen blit
mScreenTriangleVB->setBuffer();
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
-
+
unbindDeferredShader(haze_shader);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -8386,148 +8386,148 @@ void LLPipeline::doWaterHaze()
void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
{
- //construct frustum
- LLVOVolume* volume = drawablep->getVOVolume();
- LLVector3 params = volume->getSpotLightParams();
-
- F32 fov = params.mV[0];
- F32 focus = params.mV[1];
-
- LLVector3 pos = drawablep->getPositionAgent();
- LLQuaternion quat = volume->getRenderRotation();
- LLVector3 scale = volume->getScale();
-
- //get near clip plane
- LLVector3 at_axis(0,0,-scale.mV[2]*0.5f);
- at_axis *= quat;
-
- LLVector3 np = pos+at_axis;
- at_axis.normVec();
-
- //get origin that has given fov for plane np, at_axis, and given scale
- F32 dist = (scale.mV[1]*0.5f)/tanf(fov*0.5f);
-
- LLVector3 origin = np - at_axis*dist;
-
- //matrix from volume space to agent space
- LLMatrix4 light_mat(quat, LLVector4(origin,1.f));
-
- glh::matrix4f light_to_agent((F32*) light_mat.mMatrix);
- glh::matrix4f light_to_screen = get_current_modelview() * light_to_agent;
-
- glh::matrix4f screen_to_light = light_to_screen.inverse();
-
- F32 s = volume->getLightRadius()*1.5f;
- F32 near_clip = dist;
- F32 width = scale.mV[VX];
- F32 height = scale.mV[VY];
- F32 far_clip = s+dist-scale.mV[VZ];
-
- F32 fovy = fov * RAD_TO_DEG;
- F32 aspect = width/height;
-
- glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
- 0.f, 0.5f, 0.f, 0.5f,
- 0.f, 0.f, 0.5f, 0.5f,
- 0.f, 0.f, 0.f, 1.f);
-
- glh::vec3f p1(0, 0, -(near_clip+0.01f));
- glh::vec3f p2(0, 0, -(near_clip+1.f));
-
- glh::vec3f screen_origin(0, 0, 0);
-
- light_to_screen.mult_matrix_vec(p1);
- light_to_screen.mult_matrix_vec(p2);
- light_to_screen.mult_matrix_vec(screen_origin);
-
- glh::vec3f n = p2-p1;
- n.normalize();
-
- F32 proj_range = far_clip - near_clip;
- glh::matrix4f light_proj = gl_perspective(fovy, aspect, near_clip, far_clip);
- screen_to_light = trans * light_proj * screen_to_light;
- shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, FALSE, screen_to_light.m);
- shader.uniform1f(LLShaderMgr::PROJECTOR_NEAR, near_clip);
- shader.uniform3fv(LLShaderMgr::PROJECTOR_P, 1, p1.v);
- shader.uniform3fv(LLShaderMgr::PROJECTOR_N, 1, n.v);
- shader.uniform3fv(LLShaderMgr::PROJECTOR_ORIGIN, 1, screen_origin.v);
- shader.uniform1f(LLShaderMgr::PROJECTOR_RANGE, proj_range);
- shader.uniform1f(LLShaderMgr::PROJECTOR_AMBIANCE, params.mV[2]);
- S32 s_idx = -1;
-
- for (U32 i = 0; i < 2; i++)
- {
- if (mShadowSpotLight[i] == drawablep)
- {
- s_idx = i;
- }
- }
-
- shader.uniform1i(LLShaderMgr::PROJECTOR_SHADOW_INDEX, s_idx);
-
- if (s_idx >= 0)
- {
- shader.uniform1f(LLShaderMgr::PROJECTOR_SHADOW_FADE, 1.f-mSpotLightFade[s_idx]);
- }
- else
- {
- shader.uniform1f(LLShaderMgr::PROJECTOR_SHADOW_FADE, 1.f);
- }
+ //construct frustum
+ LLVOVolume* volume = drawablep->getVOVolume();
+ LLVector3 params = volume->getSpotLightParams();
+
+ F32 fov = params.mV[0];
+ F32 focus = params.mV[1];
+
+ LLVector3 pos = drawablep->getPositionAgent();
+ LLQuaternion quat = volume->getRenderRotation();
+ LLVector3 scale = volume->getScale();
+
+ //get near clip plane
+ LLVector3 at_axis(0,0,-scale.mV[2]*0.5f);
+ at_axis *= quat;
+
+ LLVector3 np = pos+at_axis;
+ at_axis.normVec();
+
+ //get origin that has given fov for plane np, at_axis, and given scale
+ F32 dist = (scale.mV[1]*0.5f)/tanf(fov*0.5f);
+
+ LLVector3 origin = np - at_axis*dist;
+
+ //matrix from volume space to agent space
+ LLMatrix4 light_mat(quat, LLVector4(origin,1.f));
+
+ glh::matrix4f light_to_agent((F32*) light_mat.mMatrix);
+ glh::matrix4f light_to_screen = get_current_modelview() * light_to_agent;
+
+ glh::matrix4f screen_to_light = light_to_screen.inverse();
+
+ F32 s = volume->getLightRadius()*1.5f;
+ F32 near_clip = dist;
+ F32 width = scale.mV[VX];
+ F32 height = scale.mV[VY];
+ F32 far_clip = s+dist-scale.mV[VZ];
+
+ F32 fovy = fov * RAD_TO_DEG;
+ F32 aspect = width/height;
+
+ glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
+ 0.f, 0.5f, 0.f, 0.5f,
+ 0.f, 0.f, 0.5f, 0.5f,
+ 0.f, 0.f, 0.f, 1.f);
+
+ glh::vec3f p1(0, 0, -(near_clip+0.01f));
+ glh::vec3f p2(0, 0, -(near_clip+1.f));
+
+ glh::vec3f screen_origin(0, 0, 0);
+
+ light_to_screen.mult_matrix_vec(p1);
+ light_to_screen.mult_matrix_vec(p2);
+ light_to_screen.mult_matrix_vec(screen_origin);
+
+ glh::vec3f n = p2-p1;
+ n.normalize();
+
+ F32 proj_range = far_clip - near_clip;
+ glh::matrix4f light_proj = gl_perspective(fovy, aspect, near_clip, far_clip);
+ screen_to_light = trans * light_proj * screen_to_light;
+ shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, FALSE, screen_to_light.m);
+ shader.uniform1f(LLShaderMgr::PROJECTOR_NEAR, near_clip);
+ shader.uniform3fv(LLShaderMgr::PROJECTOR_P, 1, p1.v);
+ shader.uniform3fv(LLShaderMgr::PROJECTOR_N, 1, n.v);
+ shader.uniform3fv(LLShaderMgr::PROJECTOR_ORIGIN, 1, screen_origin.v);
+ shader.uniform1f(LLShaderMgr::PROJECTOR_RANGE, proj_range);
+ shader.uniform1f(LLShaderMgr::PROJECTOR_AMBIANCE, params.mV[2]);
+ S32 s_idx = -1;
+
+ for (U32 i = 0; i < 2; i++)
+ {
+ if (mShadowSpotLight[i] == drawablep)
+ {
+ s_idx = i;
+ }
+ }
+
+ shader.uniform1i(LLShaderMgr::PROJECTOR_SHADOW_INDEX, s_idx);
+
+ if (s_idx >= 0)
+ {
+ shader.uniform1f(LLShaderMgr::PROJECTOR_SHADOW_FADE, 1.f-mSpotLightFade[s_idx]);
+ }
+ else
+ {
+ shader.uniform1f(LLShaderMgr::PROJECTOR_SHADOW_FADE, 1.f);
+ }
// make sure we're not already targeting the same spot light with both shadow maps
llassert(mTargetShadowSpotLight[0] != mTargetShadowSpotLight[1] || mTargetShadowSpotLight[0].isNull());
if (!gCubeSnapshot)
- {
- LLDrawable* potential = drawablep;
- //determine if this light is higher priority than one of the existing spot shadows
- F32 m_pri = volume->getSpotLightPriority();
-
- for (U32 i = 0; i < 2; i++)
- {
- F32 pri = 0.f;
-
- if (mTargetShadowSpotLight[i].notNull())
- {
- pri = mTargetShadowSpotLight[i]->getVOVolume()->getSpotLightPriority();
- }
-
- if (m_pri > pri)
- {
- LLDrawable* temp = mTargetShadowSpotLight[i];
- mTargetShadowSpotLight[i] = potential;
- potential = temp;
- m_pri = pri;
- }
- }
- }
+ {
+ LLDrawable* potential = drawablep;
+ //determine if this light is higher priority than one of the existing spot shadows
+ F32 m_pri = volume->getSpotLightPriority();
+
+ for (U32 i = 0; i < 2; i++)
+ {
+ F32 pri = 0.f;
+
+ if (mTargetShadowSpotLight[i].notNull())
+ {
+ pri = mTargetShadowSpotLight[i]->getVOVolume()->getSpotLightPriority();
+ }
+
+ if (m_pri > pri)
+ {
+ LLDrawable* temp = mTargetShadowSpotLight[i];
+ mTargetShadowSpotLight[i] = potential;
+ potential = temp;
+ m_pri = pri;
+ }
+ }
+ }
// make sure we didn't end up targeting the same spot light with both shadow maps
llassert(mTargetShadowSpotLight[0] != mTargetShadowSpotLight[1] || mTargetShadowSpotLight[0].isNull());
- LLViewerTexture* img = volume->getLightTexture();
+ LLViewerTexture* img = volume->getLightTexture();
- if (img == NULL)
- {
- img = LLViewerFetchedTexture::sWhiteImagep;
- }
+ if (img == NULL)
+ {
+ img = LLViewerFetchedTexture::sWhiteImagep;
+ }
- S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
+ S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
- if (channel > -1)
- {
- if (img)
- {
- gGL.getTexUnit(channel)->bind(img);
+ if (channel > -1)
+ {
+ if (img)
+ {
+ gGL.getTexUnit(channel)->bind(img);
+
+ F32 lod_range = logf(img->getWidth())/logf(2.f);
- F32 lod_range = logf(img->getWidth())/logf(2.f);
+ shader.uniform1f(LLShaderMgr::PROJECTOR_FOCUS, focus);
+ shader.uniform1f(LLShaderMgr::PROJECTOR_LOD, lod_range);
+ shader.uniform1f(LLShaderMgr::PROJECTOR_AMBIENT_LOD, llclamp((proj_range-focus)/proj_range*lod_range, 0.f, 1.f));
+ }
+ }
- shader.uniform1f(LLShaderMgr::PROJECTOR_FOCUS, focus);
- shader.uniform1f(LLShaderMgr::PROJECTOR_LOD, lod_range);
- shader.uniform1f(LLShaderMgr::PROJECTOR_AMBIENT_LOD, llclamp((proj_range-focus)/proj_range*lod_range, 0.f, 1.f));
- }
- }
-
}
void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
@@ -8535,7 +8535,7 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
LLRenderTarget* deferred_target = &mRT->deferredScreen;
LLRenderTarget* deferred_light_target = &mRT->deferredLight;
- stop_glerror();
+ stop_glerror();
shader.disableTexture(LLShaderMgr::DEFERRED_NORMAL, deferred_target->getUsage());
shader.disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, deferred_target->getUsage());
shader.disableTexture(LLShaderMgr::DEFERRED_SPECULAR, deferred_target->getUsage());
@@ -8544,27 +8544,27 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
//shader.disableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_depth_target->getUsage());
shader.disableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_target->getUsage());
shader.disableTexture(LLShaderMgr::DEFERRED_LIGHT, deferred_light_target->getUsage());
- shader.disableTexture(LLShaderMgr::DIFFUSE_MAP);
- shader.disableTexture(LLShaderMgr::DEFERRED_BLOOM);
-
- for (U32 i = 0; i < 4; i++)
- {
- if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
- }
- }
-
- for (U32 i = 4; i < 6; i++)
- {
- if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
- }
- }
-
- shader.disableTexture(LLShaderMgr::DEFERRED_NOISE);
- shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC);
+ shader.disableTexture(LLShaderMgr::DIFFUSE_MAP);
+ shader.disableTexture(LLShaderMgr::DEFERRED_BLOOM);
+
+ for (U32 i = 0; i < 4; i++)
+ {
+ if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1)
+ {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
+ }
+ }
+
+ for (U32 i = 4; i < 6; i++)
+ {
+ if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1)
+ {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
+ }
+ }
+
+ shader.disableTexture(LLShaderMgr::DEFERRED_NOISE);
+ shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC);
if (!LLPipeline::sReflectionProbesEnabled)
{
@@ -8581,9 +8581,9 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
unbindReflectionProbes(shader);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(0)->activate();
- shader.unbind();
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->activate();
+ shader.unbind();
}
void LLPipeline::setEnvMat(LLGLSLShader& shader)
@@ -8633,7 +8633,7 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
gGL.getTexUnit(channel)->bind(&mSceneMap);
}
-
+
shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ITR_COUNT, RenderScreenSpaceReflectionIterations);
shader.uniform1f(LLShaderMgr::DEFERRED_SSR_DIST_BIAS, RenderScreenSpaceReflectionDistanceBias);
shader.uniform1f(LLShaderMgr::DEFERRED_SSR_RAY_STEP, RenderScreenSpaceReflectionRayStep);
@@ -8641,7 +8641,7 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
shader.uniform1f(LLShaderMgr::DEFERRED_SSR_REJECT_BIAS, RenderScreenSpaceReflectionDepthRejectBias);
mPoissonOffset++;
- if (mPoissonOffset > 128 - RenderScreenSpaceReflectionGlossySamples)
+ if (mPoissonOffset > 128 - RenderScreenSpaceReflectionGlossySamples)
mPoissonOffset = 0;
shader.uniform1f(LLShaderMgr::DEFERRED_SSR_NOISE_SINE, mPoissonOffset);
@@ -8679,68 +8679,68 @@ inline float sgn(float a)
glh::matrix4f look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up)
{
- glh::matrix4f ret;
+ glh::matrix4f ret;
+
+ LLVector3 dirN;
+ LLVector3 upN;
+ LLVector3 lftN;
+
+ lftN = dir % up;
+ lftN.normVec();
- LLVector3 dirN;
- LLVector3 upN;
- LLVector3 lftN;
+ upN = lftN % dir;
+ upN.normVec();
- lftN = dir % up;
- lftN.normVec();
-
- upN = lftN % dir;
- upN.normVec();
-
- dirN = dir;
- dirN.normVec();
+ dirN = dir;
+ dirN.normVec();
- ret.m[ 0] = lftN[0];
- ret.m[ 1] = upN[0];
- ret.m[ 2] = -dirN[0];
- ret.m[ 3] = 0.f;
+ ret.m[ 0] = lftN[0];
+ ret.m[ 1] = upN[0];
+ ret.m[ 2] = -dirN[0];
+ ret.m[ 3] = 0.f;
- ret.m[ 4] = lftN[1];
- ret.m[ 5] = upN[1];
- ret.m[ 6] = -dirN[1];
- ret.m[ 7] = 0.f;
+ ret.m[ 4] = lftN[1];
+ ret.m[ 5] = upN[1];
+ ret.m[ 6] = -dirN[1];
+ ret.m[ 7] = 0.f;
- ret.m[ 8] = lftN[2];
- ret.m[ 9] = upN[2];
- ret.m[10] = -dirN[2];
- ret.m[11] = 0.f;
+ ret.m[ 8] = lftN[2];
+ ret.m[ 9] = upN[2];
+ ret.m[10] = -dirN[2];
+ ret.m[11] = 0.f;
- ret.m[12] = -(lftN*pos);
- ret.m[13] = -(upN*pos);
- ret.m[14] = dirN*pos;
- ret.m[15] = 1.f;
+ ret.m[12] = -(lftN*pos);
+ ret.m[13] = -(upN*pos);
+ ret.m[14] = dirN*pos;
+ ret.m[15] = 1.f;
- return ret;
+ return ret;
}
glh::matrix4f scale_translate_to_fit(const LLVector3 min, const LLVector3 max)
{
- glh::matrix4f ret;
- ret.m[ 0] = 2/(max[0]-min[0]);
- ret.m[ 4] = 0;
- ret.m[ 8] = 0;
- ret.m[12] = -(max[0]+min[0])/(max[0]-min[0]);
+ glh::matrix4f ret;
+ ret.m[ 0] = 2/(max[0]-min[0]);
+ ret.m[ 4] = 0;
+ ret.m[ 8] = 0;
+ ret.m[12] = -(max[0]+min[0])/(max[0]-min[0]);
- ret.m[ 1] = 0;
- ret.m[ 5] = 2/(max[1]-min[1]);
- ret.m[ 9] = 0;
- ret.m[13] = -(max[1]+min[1])/(max[1]-min[1]);
+ ret.m[ 1] = 0;
+ ret.m[ 5] = 2/(max[1]-min[1]);
+ ret.m[ 9] = 0;
+ ret.m[13] = -(max[1]+min[1])/(max[1]-min[1]);
- ret.m[ 2] = 0;
- ret.m[ 6] = 0;
- ret.m[10] = 2/(max[2]-min[2]);
- ret.m[14] = -(max[2]+min[2])/(max[2]-min[2]);
+ ret.m[ 2] = 0;
+ ret.m[ 6] = 0;
+ ret.m[10] = 2/(max[2]-min[2]);
+ ret.m[14] = -(max[2]+min[2])/(max[2]-min[2]);
- ret.m[ 3] = 0;
- ret.m[ 7] = 0;
- ret.m[11] = 0;
- ret.m[15] = 1;
+ ret.m[ 3] = 0;
+ ret.m[ 7] = 0;
+ ret.m[11] = 0;
+ ret.m[15] = 1;
- return ret;
+ return ret;
}
static LLTrace::BlockTimerStatHandle FTM_SHADOW_RENDER("Render Shadows");
@@ -8758,7 +8758,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_RENDER);
LL_PROFILE_GPU_ZONE("renderShadow");
-
+
LLPipeline::sShadowRender = true;
// disable occlusion culling during shadow render
@@ -8921,7 +8921,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gDeferredShadowGLTFAlphaMaskProgram.bind(rigged);
LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up);
LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width);
-
+
gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
@@ -8961,196 +8961,196 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
bool LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- //get point cloud of intersection of frust and min, max
-
- if (getVisibleExtents(camera, min, max))
- {
- return false;
- }
-
- //get set of planes on bounding box
- LLPlane bp[] = {
- LLPlane(min, LLVector3(-1,0,0)),
- LLPlane(min, LLVector3(0,-1,0)),
- LLPlane(min, LLVector3(0,0,-1)),
- LLPlane(max, LLVector3(1,0,0)),
- LLPlane(max, LLVector3(0,1,0)),
- LLPlane(max, LLVector3(0,0,1))};
-
- //potential points
- std::vector<LLVector3> pp;
-
- //add corners of AABB
- pp.push_back(LLVector3(min.mV[0], min.mV[1], min.mV[2]));
- pp.push_back(LLVector3(max.mV[0], min.mV[1], min.mV[2]));
- pp.push_back(LLVector3(min.mV[0], max.mV[1], min.mV[2]));
- pp.push_back(LLVector3(max.mV[0], max.mV[1], min.mV[2]));
- pp.push_back(LLVector3(min.mV[0], min.mV[1], max.mV[2]));
- pp.push_back(LLVector3(max.mV[0], min.mV[1], max.mV[2]));
- pp.push_back(LLVector3(min.mV[0], max.mV[1], max.mV[2]));
- pp.push_back(LLVector3(max.mV[0], max.mV[1], max.mV[2]));
-
- //add corners of camera frustum
- for (U32 i = 0; i < LLCamera::AGENT_FRUSTRUM_NUM; i++)
- {
- pp.push_back(camera.mAgentFrustum[i]);
- }
-
-
- //bounding box line segments
- U32 bs[] =
- {
- 0,1,
- 1,3,
- 3,2,
- 2,0,
-
- 4,5,
- 5,7,
- 7,6,
- 6,4,
-
- 0,4,
- 1,5,
- 3,7,
- 2,6
- };
-
- for (U32 i = 0; i < 12; i++)
- { //for each line segment in bounding box
- for (U32 j = 0; j < LLCamera::AGENT_PLANE_NO_USER_CLIP_NUM; j++)
- { //for each plane in camera frustum
- const LLPlane& cp = camera.getAgentPlane(j);
- const LLVector3& v1 = pp[bs[i*2+0]];
- const LLVector3& v2 = pp[bs[i*2+1]];
- LLVector3 n;
- cp.getVector3(n);
-
- LLVector3 line = v1-v2;
-
- F32 d1 = line*n;
- F32 d2 = -cp.dist(v2);
-
- F32 t = d2/d1;
-
- if (t > 0.f && t < 1.f)
- {
- LLVector3 intersect = v2+line*t;
- pp.push_back(intersect);
- }
- }
- }
-
- //camera frustum line segments
- const U32 fs[] =
- {
- 0,1,
- 1,2,
- 2,3,
- 3,0,
-
- 4,5,
- 5,6,
- 6,7,
- 7,4,
-
- 0,4,
- 1,5,
- 2,6,
- 3,7
- };
-
- for (U32 i = 0; i < 12; i++)
- {
- for (U32 j = 0; j < 6; ++j)
- {
- const LLVector3& v1 = pp[fs[i*2+0]+8];
- const LLVector3& v2 = pp[fs[i*2+1]+8];
- const LLPlane& cp = bp[j];
- LLVector3 n;
- cp.getVector3(n);
-
- LLVector3 line = v1-v2;
-
- F32 d1 = line*n;
- F32 d2 = -cp.dist(v2);
-
- F32 t = d2/d1;
-
- if (t > 0.f && t < 1.f)
- {
- LLVector3 intersect = v2+line*t;
- pp.push_back(intersect);
- }
- }
- }
-
- LLVector3 ext[] = { min-LLVector3(0.05f,0.05f,0.05f),
- max+LLVector3(0.05f,0.05f,0.05f) };
-
- for (U32 i = 0; i < pp.size(); ++i)
- {
- bool found = true;
-
- const F32* p = pp[i].mV;
-
- for (U32 j = 0; j < 3; ++j)
- {
- if (p[j] < ext[0].mV[j] ||
- p[j] > ext[1].mV[j])
- {
- found = false;
- break;
- }
- }
-
- for (U32 j = 0; j < LLCamera::AGENT_PLANE_NO_USER_CLIP_NUM; ++j)
- {
- const LLPlane& cp = camera.getAgentPlane(j);
- F32 dist = cp.dist(pp[i]);
- if (dist > 0.05f) //point is above some plane, not contained
- {
- found = false;
- break;
- }
- }
-
- if (found)
- {
- fp.push_back(pp[i]);
- }
- }
-
- if (fp.empty())
- {
- return false;
- }
-
- return true;
+ //get point cloud of intersection of frust and min, max
+
+ if (getVisibleExtents(camera, min, max))
+ {
+ return false;
+ }
+
+ //get set of planes on bounding box
+ LLPlane bp[] = {
+ LLPlane(min, LLVector3(-1,0,0)),
+ LLPlane(min, LLVector3(0,-1,0)),
+ LLPlane(min, LLVector3(0,0,-1)),
+ LLPlane(max, LLVector3(1,0,0)),
+ LLPlane(max, LLVector3(0,1,0)),
+ LLPlane(max, LLVector3(0,0,1))};
+
+ //potential points
+ std::vector<LLVector3> pp;
+
+ //add corners of AABB
+ pp.push_back(LLVector3(min.mV[0], min.mV[1], min.mV[2]));
+ pp.push_back(LLVector3(max.mV[0], min.mV[1], min.mV[2]));
+ pp.push_back(LLVector3(min.mV[0], max.mV[1], min.mV[2]));
+ pp.push_back(LLVector3(max.mV[0], max.mV[1], min.mV[2]));
+ pp.push_back(LLVector3(min.mV[0], min.mV[1], max.mV[2]));
+ pp.push_back(LLVector3(max.mV[0], min.mV[1], max.mV[2]));
+ pp.push_back(LLVector3(min.mV[0], max.mV[1], max.mV[2]));
+ pp.push_back(LLVector3(max.mV[0], max.mV[1], max.mV[2]));
+
+ //add corners of camera frustum
+ for (U32 i = 0; i < LLCamera::AGENT_FRUSTRUM_NUM; i++)
+ {
+ pp.push_back(camera.mAgentFrustum[i]);
+ }
+
+
+ //bounding box line segments
+ U32 bs[] =
+ {
+ 0,1,
+ 1,3,
+ 3,2,
+ 2,0,
+
+ 4,5,
+ 5,7,
+ 7,6,
+ 6,4,
+
+ 0,4,
+ 1,5,
+ 3,7,
+ 2,6
+ };
+
+ for (U32 i = 0; i < 12; i++)
+ { //for each line segment in bounding box
+ for (U32 j = 0; j < LLCamera::AGENT_PLANE_NO_USER_CLIP_NUM; j++)
+ { //for each plane in camera frustum
+ const LLPlane& cp = camera.getAgentPlane(j);
+ const LLVector3& v1 = pp[bs[i*2+0]];
+ const LLVector3& v2 = pp[bs[i*2+1]];
+ LLVector3 n;
+ cp.getVector3(n);
+
+ LLVector3 line = v1-v2;
+
+ F32 d1 = line*n;
+ F32 d2 = -cp.dist(v2);
+
+ F32 t = d2/d1;
+
+ if (t > 0.f && t < 1.f)
+ {
+ LLVector3 intersect = v2+line*t;
+ pp.push_back(intersect);
+ }
+ }
+ }
+
+ //camera frustum line segments
+ const U32 fs[] =
+ {
+ 0,1,
+ 1,2,
+ 2,3,
+ 3,0,
+
+ 4,5,
+ 5,6,
+ 6,7,
+ 7,4,
+
+ 0,4,
+ 1,5,
+ 2,6,
+ 3,7
+ };
+
+ for (U32 i = 0; i < 12; i++)
+ {
+ for (U32 j = 0; j < 6; ++j)
+ {
+ const LLVector3& v1 = pp[fs[i*2+0]+8];
+ const LLVector3& v2 = pp[fs[i*2+1]+8];
+ const LLPlane& cp = bp[j];
+ LLVector3 n;
+ cp.getVector3(n);
+
+ LLVector3 line = v1-v2;
+
+ F32 d1 = line*n;
+ F32 d2 = -cp.dist(v2);
+
+ F32 t = d2/d1;
+
+ if (t > 0.f && t < 1.f)
+ {
+ LLVector3 intersect = v2+line*t;
+ pp.push_back(intersect);
+ }
+ }
+ }
+
+ LLVector3 ext[] = { min-LLVector3(0.05f,0.05f,0.05f),
+ max+LLVector3(0.05f,0.05f,0.05f) };
+
+ for (U32 i = 0; i < pp.size(); ++i)
+ {
+ bool found = true;
+
+ const F32* p = pp[i].mV;
+
+ for (U32 j = 0; j < 3; ++j)
+ {
+ if (p[j] < ext[0].mV[j] ||
+ p[j] > ext[1].mV[j])
+ {
+ found = false;
+ break;
+ }
+ }
+
+ for (U32 j = 0; j < LLCamera::AGENT_PLANE_NO_USER_CLIP_NUM; ++j)
+ {
+ const LLPlane& cp = camera.getAgentPlane(j);
+ F32 dist = cp.dist(pp[i]);
+ if (dist > 0.05f) //point is above some plane, not contained
+ {
+ found = false;
+ break;
+ }
+ }
+
+ if (found)
+ {
+ fp.push_back(pp[i]);
+ }
+ }
+
+ if (fp.empty())
+ {
+ return false;
+ }
+
+ return true;
}
void LLPipeline::renderHighlight(const LLViewerObject* obj, F32 fade)
{
- if (obj && obj->getVolume())
- {
- for (LLViewerObject::child_list_t::const_iterator iter = obj->getChildren().begin(); iter != obj->getChildren().end(); ++iter)
- {
- renderHighlight(*iter, fade);
- }
-
- LLDrawable* drawable = obj->mDrawable;
- if (drawable)
- {
- for (S32 i = 0; i < drawable->getNumFaces(); ++i)
- {
- LLFace* face = drawable->getFace(i);
- if (face)
- {
- face->renderSelected(LLViewerTexture::sNullImagep, LLColor4(1,1,1,fade));
- }
- }
- }
- }
+ if (obj && obj->getVolume())
+ {
+ for (LLViewerObject::child_list_t::const_iterator iter = obj->getChildren().begin(); iter != obj->getChildren().end(); ++iter)
+ {
+ renderHighlight(*iter, fade);
+ }
+
+ LLDrawable* drawable = obj->mDrawable;
+ if (drawable)
+ {
+ for (S32 i = 0; i < drawable->getNumFaces(); ++i)
+ {
+ LLFace* face = drawable->getFace(i);
+ if (face)
+ {
+ face->renderSelected(LLViewerTexture::sNullImagep, LLColor4(1,1,1,fade));
+ }
+ }
+ }
+ }
}
@@ -9189,76 +9189,76 @@ public:
void LLPipeline::generateSunShadow(LLCamera& camera)
{
- if (!sRenderDeferred || RenderShadowDetail <= 0)
- {
- return;
- }
+ if (!sRenderDeferred || RenderShadowDetail <= 0)
+ {
+ return;
+ }
- LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW);
LL_PROFILE_GPU_ZONE("generateSunShadow");
LLDisableOcclusionCulling no_occlusion;
- bool skip_avatar_update = false;
- if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
- {
- skip_avatar_update = true;
- }
-
- if (!skip_avatar_update)
- {
- gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
- }
-
- F64 last_modelview[16];
- F64 last_projection[16];
- for (U32 i = 0; i < 16; i++)
- { //store last_modelview of world camera
- last_modelview[i] = gGLLastModelView[i];
- last_projection[i] = gGLLastProjection[i];
- }
-
- pushRenderTypeMask();
- andRenderTypeMask(LLPipeline::RENDER_TYPE_SIMPLE,
- LLPipeline::RENDER_TYPE_ALPHA,
+ bool skip_avatar_update = false;
+ if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
+ {
+ skip_avatar_update = true;
+ }
+
+ if (!skip_avatar_update)
+ {
+ gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
+ }
+
+ F64 last_modelview[16];
+ F64 last_projection[16];
+ for (U32 i = 0; i < 16; i++)
+ { //store last_modelview of world camera
+ last_modelview[i] = gGLLastModelView[i];
+ last_projection[i] = gGLLastProjection[i];
+ }
+
+ pushRenderTypeMask();
+ andRenderTypeMask(LLPipeline::RENDER_TYPE_SIMPLE,
+ LLPipeline::RENDER_TYPE_ALPHA,
LLPipeline::RENDER_TYPE_ALPHA_PRE_WATER,
LLPipeline::RENDER_TYPE_ALPHA_POST_WATER,
- LLPipeline::RENDER_TYPE_GRASS,
+ LLPipeline::RENDER_TYPE_GRASS,
LLPipeline::RENDER_TYPE_GLTF_PBR,
- LLPipeline::RENDER_TYPE_FULLBRIGHT,
- LLPipeline::RENDER_TYPE_BUMP,
- LLPipeline::RENDER_TYPE_VOLUME,
- LLPipeline::RENDER_TYPE_AVATAR,
- LLPipeline::RENDER_TYPE_CONTROL_AV,
- LLPipeline::RENDER_TYPE_TREE,
- LLPipeline::RENDER_TYPE_TERRAIN,
- LLPipeline::RENDER_TYPE_WATER,
- LLPipeline::RENDER_TYPE_VOIDWATER,
- LLPipeline::RENDER_TYPE_PASS_ALPHA,
- LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK,
- LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK,
- LLPipeline::RENDER_TYPE_PASS_GRASS,
- LLPipeline::RENDER_TYPE_PASS_SIMPLE,
- LLPipeline::RENDER_TYPE_PASS_BUMP,
- LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT,
- LLPipeline::RENDER_TYPE_PASS_SHINY,
- LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY,
- LLPipeline::RENDER_TYPE_PASS_MATERIAL,
- LLPipeline::RENDER_TYPE_PASS_MATERIAL_ALPHA,
- LLPipeline::RENDER_TYPE_PASS_MATERIAL_ALPHA_MASK,
- LLPipeline::RENDER_TYPE_PASS_MATERIAL_ALPHA_EMISSIVE,
- LLPipeline::RENDER_TYPE_PASS_SPECMAP,
- LLPipeline::RENDER_TYPE_PASS_SPECMAP_BLEND,
- LLPipeline::RENDER_TYPE_PASS_SPECMAP_MASK,
- LLPipeline::RENDER_TYPE_PASS_SPECMAP_EMISSIVE,
- LLPipeline::RENDER_TYPE_PASS_NORMMAP,
- LLPipeline::RENDER_TYPE_PASS_NORMMAP_BLEND,
- LLPipeline::RENDER_TYPE_PASS_NORMMAP_MASK,
- LLPipeline::RENDER_TYPE_PASS_NORMMAP_EMISSIVE,
- LLPipeline::RENDER_TYPE_PASS_NORMSPEC,
- LLPipeline::RENDER_TYPE_PASS_NORMSPEC_BLEND,
- LLPipeline::RENDER_TYPE_PASS_NORMSPEC_MASK,
- LLPipeline::RENDER_TYPE_PASS_NORMSPEC_EMISSIVE,
+ LLPipeline::RENDER_TYPE_FULLBRIGHT,
+ LLPipeline::RENDER_TYPE_BUMP,
+ LLPipeline::RENDER_TYPE_VOLUME,
+ LLPipeline::RENDER_TYPE_AVATAR,
+ LLPipeline::RENDER_TYPE_CONTROL_AV,
+ LLPipeline::RENDER_TYPE_TREE,
+ LLPipeline::RENDER_TYPE_TERRAIN,
+ LLPipeline::RENDER_TYPE_WATER,
+ LLPipeline::RENDER_TYPE_VOIDWATER,
+ LLPipeline::RENDER_TYPE_PASS_ALPHA,
+ LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK,
+ LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK,
+ LLPipeline::RENDER_TYPE_PASS_GRASS,
+ LLPipeline::RENDER_TYPE_PASS_SIMPLE,
+ LLPipeline::RENDER_TYPE_PASS_BUMP,
+ LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT,
+ LLPipeline::RENDER_TYPE_PASS_SHINY,
+ LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY,
+ LLPipeline::RENDER_TYPE_PASS_MATERIAL,
+ LLPipeline::RENDER_TYPE_PASS_MATERIAL_ALPHA,
+ LLPipeline::RENDER_TYPE_PASS_MATERIAL_ALPHA_MASK,
+ LLPipeline::RENDER_TYPE_PASS_MATERIAL_ALPHA_EMISSIVE,
+ LLPipeline::RENDER_TYPE_PASS_SPECMAP,
+ LLPipeline::RENDER_TYPE_PASS_SPECMAP_BLEND,
+ LLPipeline::RENDER_TYPE_PASS_SPECMAP_MASK,
+ LLPipeline::RENDER_TYPE_PASS_SPECMAP_EMISSIVE,
+ LLPipeline::RENDER_TYPE_PASS_NORMMAP,
+ LLPipeline::RENDER_TYPE_PASS_NORMMAP_BLEND,
+ LLPipeline::RENDER_TYPE_PASS_NORMMAP_MASK,
+ LLPipeline::RENDER_TYPE_PASS_NORMMAP_EMISSIVE,
+ LLPipeline::RENDER_TYPE_PASS_NORMSPEC,
+ LLPipeline::RENDER_TYPE_PASS_NORMSPEC_BLEND,
+ LLPipeline::RENDER_TYPE_PASS_NORMSPEC_MASK,
+ LLPipeline::RENDER_TYPE_PASS_NORMSPEC_EMISSIVE,
LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK_RIGGED,
LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK_RIGGED,
LLPipeline::RENDER_TYPE_PASS_SIMPLE_RIGGED,
@@ -9286,129 +9286,129 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_RIGGED,
LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK,
LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK_RIGGED,
- END_RENDER_TYPES);
+ END_RENDER_TYPES);
- gGL.setColorMask(false, false);
+ gGL.setColorMask(false, false);
LLEnvironment& environment = LLEnvironment::instance();
- //get sun view matrix
-
- //store current projection/modelview matrix
- glh::matrix4f saved_proj = get_current_projection();
- glh::matrix4f saved_view = get_current_modelview();
- glh::matrix4f inv_view = saved_view.inverse();
+ //get sun view matrix
+
+ //store current projection/modelview matrix
+ glh::matrix4f saved_proj = get_current_projection();
+ glh::matrix4f saved_view = get_current_modelview();
+ glh::matrix4f inv_view = saved_view.inverse();
+
+ glh::matrix4f view[6];
+ glh::matrix4f proj[6];
- glh::matrix4f view[6];
- glh::matrix4f proj[6];
-
LLVector3 caster_dir(environment.getIsSunUp() ? mSunDir : mMoonDir);
- //put together a universal "near clip" plane for shadow frusta
- LLPlane shadow_near_clip;
- {
+ //put together a universal "near clip" plane for shadow frusta
+ LLPlane shadow_near_clip;
+ {
LLVector3 p = camera.getOrigin(); // gAgent.getPositionAgent();
- p += caster_dir * RenderFarClip*2.f;
- shadow_near_clip.setVec(p, caster_dir);
- }
-
- LLVector3 lightDir = -caster_dir;
- lightDir.normVec();
-
- glh::vec3f light_dir(lightDir.mV);
-
- //create light space camera matrix
-
- LLVector3 at = lightDir;
-
- LLVector3 up = camera.getAtAxis();
-
- if (fabsf(up*lightDir) > 0.75f)
- {
- up = camera.getUpAxis();
- }
-
- up.normVec();
- at.normVec();
-
-
- LLCamera main_camera = camera;
-
- F32 near_clip = 0.f;
- {
- //get visible point cloud
- std::vector<LLVector3> fp;
-
- main_camera.calcAgentFrustumPlanes(main_camera.mAgentFrustum);
-
- LLVector3 min,max;
- getVisiblePointCloud(main_camera,min,max,fp);
-
- if (fp.empty())
- {
- if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
- {
- mShadowCamera[0] = main_camera;
- mShadowExtents[0][0] = min;
- mShadowExtents[0][1] = max;
-
- mShadowFrustPoints[0].clear();
- mShadowFrustPoints[1].clear();
- mShadowFrustPoints[2].clear();
- mShadowFrustPoints[3].clear();
- }
- popRenderTypeMask();
-
- if (!skip_avatar_update)
- {
- gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
- }
-
- return;
- }
-
- //get good split distances for frustum
- for (U32 i = 0; i < fp.size(); ++i)
- {
- glh::vec3f v(fp[i].mV);
- saved_view.mult_matrix_vec(v);
- fp[i].setVec(v.v);
- }
-
- min = fp[0];
- max = fp[0];
-
- //get camera space bounding box
- for (U32 i = 1; i < fp.size(); ++i)
- {
- update_min_max(min, max, fp[i]);
- }
-
- near_clip = llclamp(-max.mV[2], 0.01f, 4.0f);
- F32 far_clip = llclamp(-min.mV[2]*2.f, 16.0f, 512.0f);
-
- //far_clip = llmin(far_clip, 128.f);
- far_clip = llmin(far_clip, camera.getFar());
-
- F32 range = far_clip-near_clip;
-
- LLVector3 split_exp = RenderShadowSplitExponent;
-
- F32 da = 1.f-llmax( fabsf(lightDir*up), fabsf(lightDir*camera.getLeftAxis()) );
-
- da = powf(da, split_exp.mV[2]);
-
- F32 sxp = split_exp.mV[1] + (split_exp.mV[0]-split_exp.mV[1])*da;
-
- for (U32 i = 0; i < 4; ++i)
- {
- F32 x = (F32)(i+1)/4.f;
- x = powf(x, sxp);
- mSunClipPlanes.mV[i] = near_clip+range*x;
- }
-
- mSunClipPlanes.mV[0] *= 1.25f; //bump back first split for transition padding
- }
+ p += caster_dir * RenderFarClip*2.f;
+ shadow_near_clip.setVec(p, caster_dir);
+ }
+
+ LLVector3 lightDir = -caster_dir;
+ lightDir.normVec();
+
+ glh::vec3f light_dir(lightDir.mV);
+
+ //create light space camera matrix
+
+ LLVector3 at = lightDir;
+
+ LLVector3 up = camera.getAtAxis();
+
+ if (fabsf(up*lightDir) > 0.75f)
+ {
+ up = camera.getUpAxis();
+ }
+
+ up.normVec();
+ at.normVec();
+
+
+ LLCamera main_camera = camera;
+
+ F32 near_clip = 0.f;
+ {
+ //get visible point cloud
+ std::vector<LLVector3> fp;
+
+ main_camera.calcAgentFrustumPlanes(main_camera.mAgentFrustum);
+
+ LLVector3 min,max;
+ getVisiblePointCloud(main_camera,min,max,fp);
+
+ if (fp.empty())
+ {
+ if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
+ {
+ mShadowCamera[0] = main_camera;
+ mShadowExtents[0][0] = min;
+ mShadowExtents[0][1] = max;
+
+ mShadowFrustPoints[0].clear();
+ mShadowFrustPoints[1].clear();
+ mShadowFrustPoints[2].clear();
+ mShadowFrustPoints[3].clear();
+ }
+ popRenderTypeMask();
+
+ if (!skip_avatar_update)
+ {
+ gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+ }
+
+ return;
+ }
+
+ //get good split distances for frustum
+ for (U32 i = 0; i < fp.size(); ++i)
+ {
+ glh::vec3f v(fp[i].mV);
+ saved_view.mult_matrix_vec(v);
+ fp[i].setVec(v.v);
+ }
+
+ min = fp[0];
+ max = fp[0];
+
+ //get camera space bounding box
+ for (U32 i = 1; i < fp.size(); ++i)
+ {
+ update_min_max(min, max, fp[i]);
+ }
+
+ near_clip = llclamp(-max.mV[2], 0.01f, 4.0f);
+ F32 far_clip = llclamp(-min.mV[2]*2.f, 16.0f, 512.0f);
+
+ //far_clip = llmin(far_clip, 128.f);
+ far_clip = llmin(far_clip, camera.getFar());
+
+ F32 range = far_clip-near_clip;
+
+ LLVector3 split_exp = RenderShadowSplitExponent;
+
+ F32 da = 1.f-llmax( fabsf(lightDir*up), fabsf(lightDir*camera.getLeftAxis()) );
+
+ da = powf(da, split_exp.mV[2]);
+
+ F32 sxp = split_exp.mV[1] + (split_exp.mV[0]-split_exp.mV[1])*da;
+
+ for (U32 i = 0; i < 4; ++i)
+ {
+ F32 x = (F32)(i+1)/4.f;
+ x = powf(x, sxp);
+ mSunClipPlanes.mV[i] = near_clip+range*x;
+ }
+
+ mSunClipPlanes.mV[0] *= 1.25f; //bump back first split for transition padding
+ }
if (gCubeSnapshot)
{ // stretch clip planes for reflection probe renders to reduce number of shadow passes
@@ -9418,394 +9418,394 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
}
- // convenience array of 4 near clip plane distances
- F32 dist[] = { near_clip, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] };
-
- if (mSunDiffuse == LLColor4::black)
- { //sun diffuse is totally black shadows don't matter
+ // convenience array of 4 near clip plane distances
+ F32 dist[] = { near_clip, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] };
+
+ if (mSunDiffuse == LLColor4::black)
+ { //sun diffuse is totally black shadows don't matter
skipRenderingShadows();
- }
- else
- {
+ }
+ else
+ {
for (S32 j = 0; j < (gCubeSnapshot ? 2 : 4); j++)
- {
- if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
- {
- mShadowFrustPoints[j].clear();
- }
+ {
+ if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
+ {
+ mShadowFrustPoints[j].clear();
+ }
- LLViewerCamera::sCurCameraID = (LLViewerCamera::eCameraID)(LLViewerCamera::CAMERA_SUN_SHADOW0+j);
+ LLViewerCamera::sCurCameraID = (LLViewerCamera::eCameraID)(LLViewerCamera::CAMERA_SUN_SHADOW0+j);
- //restore render matrices
- set_current_modelview(saved_view);
- set_current_projection(saved_proj);
+ //restore render matrices
+ set_current_modelview(saved_view);
+ set_current_projection(saved_proj);
- LLVector3 eye = camera.getOrigin();
+ LLVector3 eye = camera.getOrigin();
llassert(eye.isFinite());
- //camera used for shadow cull/render
- LLCamera shadow_cam;
-
- //create world space camera frustum for this split
- shadow_cam = camera;
- shadow_cam.setFar(16.f);
-
- LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
-
- LLVector3* frust = shadow_cam.mAgentFrustum;
-
- LLVector3 pn = shadow_cam.getAtAxis();
-
- LLVector3 min, max;
-
- //construct 8 corners of split frustum section
- for (U32 i = 0; i < 4; i++)
- {
- LLVector3 delta = frust[i+4]-eye;
- delta += (frust[i+4]-frust[(i+2)%4+4])*0.05f;
- delta.normVec();
- F32 dp = delta*pn;
- frust[i] = eye + (delta*dist[j]*0.75f)/dp;
- frust[i+4] = eye + (delta*dist[j+1]*1.25f)/dp;
- }
-
- shadow_cam.calcAgentFrustumPlanes(frust);
- shadow_cam.mFrustumCornerDist = 0.f;
-
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
- {
- mShadowCamera[j] = shadow_cam;
- }
-
- std::vector<LLVector3> fp;
-
- if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir)
+ //camera used for shadow cull/render
+ LLCamera shadow_cam;
+
+ //create world space camera frustum for this split
+ shadow_cam = camera;
+ shadow_cam.setFar(16.f);
+
+ LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
+
+ LLVector3* frust = shadow_cam.mAgentFrustum;
+
+ LLVector3 pn = shadow_cam.getAtAxis();
+
+ LLVector3 min, max;
+
+ //construct 8 corners of split frustum section
+ for (U32 i = 0; i < 4; i++)
+ {
+ LLVector3 delta = frust[i+4]-eye;
+ delta += (frust[i+4]-frust[(i+2)%4+4])*0.05f;
+ delta.normVec();
+ F32 dp = delta*pn;
+ frust[i] = eye + (delta*dist[j]*0.75f)/dp;
+ frust[i+4] = eye + (delta*dist[j+1]*1.25f)/dp;
+ }
+
+ shadow_cam.calcAgentFrustumPlanes(frust);
+ shadow_cam.mFrustumCornerDist = 0.f;
+
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
+ {
+ mShadowCamera[j] = shadow_cam;
+ }
+
+ std::vector<LLVector3> fp;
+
+ if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir)
|| j > RenderShadowSplits)
- {
- //no possible shadow receivers
+ {
+ //no possible shadow receivers
if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
- {
- mShadowExtents[j][0] = LLVector3();
- mShadowExtents[j][1] = LLVector3();
- mShadowCamera[j+4] = shadow_cam;
- }
-
- mRT->shadow[j].bindTarget();
- {
- LLGLDepthTest depth(GL_TRUE);
- mRT->shadow[j].clear();
- }
- mRT->shadow[j].flush();
-
- mShadowError.mV[j] = 0.f;
- mShadowFOV.mV[j] = 0.f;
-
- continue;
- }
-
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
- {
- mShadowExtents[j][0] = min;
- mShadowExtents[j][1] = max;
- mShadowFrustPoints[j] = fp;
- }
-
-
- //find a good origin for shadow projection
- LLVector3 origin;
-
- //get a temporary view projection
- view[j] = look(camera.getOrigin(), lightDir, -up);
-
- std::vector<LLVector3> wpf;
-
- for (U32 i = 0; i < fp.size(); i++)
- {
- glh::vec3f p = glh::vec3f(fp[i].mV);
- view[j].mult_matrix_vec(p);
- wpf.push_back(LLVector3(p.v));
- }
-
- min = wpf[0];
- max = wpf[0];
-
- for (U32 i = 0; i < fp.size(); ++i)
- { //get AABB in camera space
- update_min_max(min, max, wpf[i]);
- }
-
- // Construct a perspective transform with perspective along y-axis that contains
- // points in wpf
- //Known:
- // - far clip plane
- // - near clip plane
- // - points in frustum
- //Find:
- // - origin
-
- //get some "interesting" points of reference
- LLVector3 center = (min+max)*0.5f;
- LLVector3 size = (max-min)*0.5f;
- LLVector3 near_center = center;
- near_center.mV[1] += size.mV[1]*2.f;
-
-
- //put all points in wpf in quadrant 0, reletive to center of min/max
- //get the best fit line using least squares
- F32 bfm = 0.f;
- F32 bfb = 0.f;
-
- for (U32 i = 0; i < wpf.size(); ++i)
- {
- wpf[i] -= center;
- wpf[i].mV[0] = fabsf(wpf[i].mV[0]);
- wpf[i].mV[2] = fabsf(wpf[i].mV[2]);
- }
-
- if (!wpf.empty())
- {
- F32 sx = 0.f;
- F32 sx2 = 0.f;
- F32 sy = 0.f;
- F32 sxy = 0.f;
-
- for (U32 i = 0; i < wpf.size(); ++i)
- {
- sx += wpf[i].mV[0];
- sx2 += wpf[i].mV[0]*wpf[i].mV[0];
- sy += wpf[i].mV[1];
- sxy += wpf[i].mV[0]*wpf[i].mV[1];
- }
-
- bfm = (sy*sx-wpf.size()*sxy)/(sx*sx-wpf.size()*sx2);
- bfb = (sx*sxy-sy*sx2)/(sx*sx-bfm*sx2);
- }
-
- {
- // best fit line is y=bfm*x+bfb
-
- //find point that is furthest to the right of line
- F32 off_x = -1.f;
- LLVector3 lp;
-
- for (U32 i = 0; i < wpf.size(); ++i)
- {
- //y = bfm*x+bfb
- //x = (y-bfb)/bfm
- F32 lx = (wpf[i].mV[1]-bfb)/bfm;
-
- lx = wpf[i].mV[0]-lx;
-
- if (off_x < lx)
- {
- off_x = lx;
- lp = wpf[i];
- }
- }
-
- //get line with slope bfm through lp
- // bfb = y-bfm*x
- bfb = lp.mV[1]-bfm*lp.mV[0];
-
- //calculate error
- mShadowError.mV[j] = 0.f;
-
- for (U32 i = 0; i < wpf.size(); ++i)
- {
- F32 lx = (wpf[i].mV[1]-bfb)/bfm;
- mShadowError.mV[j] += fabsf(wpf[i].mV[0]-lx);
- }
-
- mShadowError.mV[j] /= wpf.size();
- mShadowError.mV[j] /= size.mV[0];
-
- if (mShadowError.mV[j] > RenderShadowErrorCutoff)
- { //just use ortho projection
- mShadowFOV.mV[j] = -1.f;
- origin.clearVec();
- proj[j] = gl_ortho(min.mV[0], max.mV[0],
- min.mV[1], max.mV[1],
- -max.mV[2], -min.mV[2]);
- }
- else
- {
- //origin is where line x = 0;
- origin.setVec(0,bfb,0);
-
- F32 fovz = 1.f;
- F32 fovx = 1.f;
-
- LLVector3 zp;
- LLVector3 xp;
-
- for (U32 i = 0; i < wpf.size(); ++i)
- {
- LLVector3 atz = wpf[i]-origin;
- atz.mV[0] = 0.f;
- atz.normVec();
- if (fovz > -atz.mV[1])
- {
- zp = wpf[i];
- fovz = -atz.mV[1];
- }
-
- LLVector3 atx = wpf[i]-origin;
- atx.mV[2] = 0.f;
- atx.normVec();
- if (fovx > -atx.mV[1])
- {
- fovx = -atx.mV[1];
- xp = wpf[i];
- }
- }
-
- fovx = acos(fovx);
- fovz = acos(fovz);
-
- F32 cutoff = llmin((F32) RenderShadowFOVCutoff, 1.4f);
-
- mShadowFOV.mV[j] = fovx;
-
- if (fovx < cutoff && fovz > cutoff)
- {
- //x is a good fit, but z is too big, move away from zp enough so that fovz matches cutoff
- F32 d = zp.mV[2]/tan(cutoff);
- F32 ny = zp.mV[1] + fabsf(d);
-
- origin.mV[1] = ny;
-
- fovz = 1.f;
- fovx = 1.f;
-
- for (U32 i = 0; i < wpf.size(); ++i)
- {
- LLVector3 atz = wpf[i]-origin;
- atz.mV[0] = 0.f;
- atz.normVec();
- fovz = llmin(fovz, -atz.mV[1]);
-
- LLVector3 atx = wpf[i]-origin;
- atx.mV[2] = 0.f;
- atx.normVec();
- fovx = llmin(fovx, -atx.mV[1]);
- }
-
- fovx = acos(fovx);
- fovz = acos(fovz);
-
- mShadowFOV.mV[j] = cutoff;
- }
-
-
- origin += center;
-
- F32 ynear = -(max.mV[1]-origin.mV[1]);
- F32 yfar = -(min.mV[1]-origin.mV[1]);
-
- if (ynear < 0.1f) //keep a sensible near clip plane
- {
- F32 diff = 0.1f-ynear;
- origin.mV[1] += diff;
- ynear += diff;
- yfar += diff;
- }
-
- if (fovx > cutoff)
- { //just use ortho projection
- origin.clearVec();
- mShadowError.mV[j] = -1.f;
- proj[j] = gl_ortho(min.mV[0], max.mV[0],
- min.mV[1], max.mV[1],
- -max.mV[2], -min.mV[2]);
- }
- else
- {
- //get perspective projection
- view[j] = view[j].inverse();
+ {
+ mShadowExtents[j][0] = LLVector3();
+ mShadowExtents[j][1] = LLVector3();
+ mShadowCamera[j+4] = shadow_cam;
+ }
+
+ mRT->shadow[j].bindTarget();
+ {
+ LLGLDepthTest depth(GL_TRUE);
+ mRT->shadow[j].clear();
+ }
+ mRT->shadow[j].flush();
+
+ mShadowError.mV[j] = 0.f;
+ mShadowFOV.mV[j] = 0.f;
+
+ continue;
+ }
+
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
+ {
+ mShadowExtents[j][0] = min;
+ mShadowExtents[j][1] = max;
+ mShadowFrustPoints[j] = fp;
+ }
+
+
+ //find a good origin for shadow projection
+ LLVector3 origin;
+
+ //get a temporary view projection
+ view[j] = look(camera.getOrigin(), lightDir, -up);
+
+ std::vector<LLVector3> wpf;
+
+ for (U32 i = 0; i < fp.size(); i++)
+ {
+ glh::vec3f p = glh::vec3f(fp[i].mV);
+ view[j].mult_matrix_vec(p);
+ wpf.push_back(LLVector3(p.v));
+ }
+
+ min = wpf[0];
+ max = wpf[0];
+
+ for (U32 i = 0; i < fp.size(); ++i)
+ { //get AABB in camera space
+ update_min_max(min, max, wpf[i]);
+ }
+
+ // Construct a perspective transform with perspective along y-axis that contains
+ // points in wpf
+ //Known:
+ // - far clip plane
+ // - near clip plane
+ // - points in frustum
+ //Find:
+ // - origin
+
+ //get some "interesting" points of reference
+ LLVector3 center = (min+max)*0.5f;
+ LLVector3 size = (max-min)*0.5f;
+ LLVector3 near_center = center;
+ near_center.mV[1] += size.mV[1]*2.f;
+
+
+ //put all points in wpf in quadrant 0, reletive to center of min/max
+ //get the best fit line using least squares
+ F32 bfm = 0.f;
+ F32 bfb = 0.f;
+
+ for (U32 i = 0; i < wpf.size(); ++i)
+ {
+ wpf[i] -= center;
+ wpf[i].mV[0] = fabsf(wpf[i].mV[0]);
+ wpf[i].mV[2] = fabsf(wpf[i].mV[2]);
+ }
+
+ if (!wpf.empty())
+ {
+ F32 sx = 0.f;
+ F32 sx2 = 0.f;
+ F32 sy = 0.f;
+ F32 sxy = 0.f;
+
+ for (U32 i = 0; i < wpf.size(); ++i)
+ {
+ sx += wpf[i].mV[0];
+ sx2 += wpf[i].mV[0]*wpf[i].mV[0];
+ sy += wpf[i].mV[1];
+ sxy += wpf[i].mV[0]*wpf[i].mV[1];
+ }
+
+ bfm = (sy*sx-wpf.size()*sxy)/(sx*sx-wpf.size()*sx2);
+ bfb = (sx*sxy-sy*sx2)/(sx*sx-bfm*sx2);
+ }
+
+ {
+ // best fit line is y=bfm*x+bfb
+
+ //find point that is furthest to the right of line
+ F32 off_x = -1.f;
+ LLVector3 lp;
+
+ for (U32 i = 0; i < wpf.size(); ++i)
+ {
+ //y = bfm*x+bfb
+ //x = (y-bfb)/bfm
+ F32 lx = (wpf[i].mV[1]-bfb)/bfm;
+
+ lx = wpf[i].mV[0]-lx;
+
+ if (off_x < lx)
+ {
+ off_x = lx;
+ lp = wpf[i];
+ }
+ }
+
+ //get line with slope bfm through lp
+ // bfb = y-bfm*x
+ bfb = lp.mV[1]-bfm*lp.mV[0];
+
+ //calculate error
+ mShadowError.mV[j] = 0.f;
+
+ for (U32 i = 0; i < wpf.size(); ++i)
+ {
+ F32 lx = (wpf[i].mV[1]-bfb)/bfm;
+ mShadowError.mV[j] += fabsf(wpf[i].mV[0]-lx);
+ }
+
+ mShadowError.mV[j] /= wpf.size();
+ mShadowError.mV[j] /= size.mV[0];
+
+ if (mShadowError.mV[j] > RenderShadowErrorCutoff)
+ { //just use ortho projection
+ mShadowFOV.mV[j] = -1.f;
+ origin.clearVec();
+ proj[j] = gl_ortho(min.mV[0], max.mV[0],
+ min.mV[1], max.mV[1],
+ -max.mV[2], -min.mV[2]);
+ }
+ else
+ {
+ //origin is where line x = 0;
+ origin.setVec(0,bfb,0);
+
+ F32 fovz = 1.f;
+ F32 fovx = 1.f;
+
+ LLVector3 zp;
+ LLVector3 xp;
+
+ for (U32 i = 0; i < wpf.size(); ++i)
+ {
+ LLVector3 atz = wpf[i]-origin;
+ atz.mV[0] = 0.f;
+ atz.normVec();
+ if (fovz > -atz.mV[1])
+ {
+ zp = wpf[i];
+ fovz = -atz.mV[1];
+ }
+
+ LLVector3 atx = wpf[i]-origin;
+ atx.mV[2] = 0.f;
+ atx.normVec();
+ if (fovx > -atx.mV[1])
+ {
+ fovx = -atx.mV[1];
+ xp = wpf[i];
+ }
+ }
+
+ fovx = acos(fovx);
+ fovz = acos(fovz);
+
+ F32 cutoff = llmin((F32) RenderShadowFOVCutoff, 1.4f);
+
+ mShadowFOV.mV[j] = fovx;
+
+ if (fovx < cutoff && fovz > cutoff)
+ {
+ //x is a good fit, but z is too big, move away from zp enough so that fovz matches cutoff
+ F32 d = zp.mV[2]/tan(cutoff);
+ F32 ny = zp.mV[1] + fabsf(d);
+
+ origin.mV[1] = ny;
+
+ fovz = 1.f;
+ fovx = 1.f;
+
+ for (U32 i = 0; i < wpf.size(); ++i)
+ {
+ LLVector3 atz = wpf[i]-origin;
+ atz.mV[0] = 0.f;
+ atz.normVec();
+ fovz = llmin(fovz, -atz.mV[1]);
+
+ LLVector3 atx = wpf[i]-origin;
+ atx.mV[2] = 0.f;
+ atx.normVec();
+ fovx = llmin(fovx, -atx.mV[1]);
+ }
+
+ fovx = acos(fovx);
+ fovz = acos(fovz);
+
+ mShadowFOV.mV[j] = cutoff;
+ }
+
+
+ origin += center;
+
+ F32 ynear = -(max.mV[1]-origin.mV[1]);
+ F32 yfar = -(min.mV[1]-origin.mV[1]);
+
+ if (ynear < 0.1f) //keep a sensible near clip plane
+ {
+ F32 diff = 0.1f-ynear;
+ origin.mV[1] += diff;
+ ynear += diff;
+ yfar += diff;
+ }
+
+ if (fovx > cutoff)
+ { //just use ortho projection
+ origin.clearVec();
+ mShadowError.mV[j] = -1.f;
+ proj[j] = gl_ortho(min.mV[0], max.mV[0],
+ min.mV[1], max.mV[1],
+ -max.mV[2], -min.mV[2]);
+ }
+ else
+ {
+ //get perspective projection
+ view[j] = view[j].inverse();
//llassert(origin.isFinite());
- glh::vec3f origin_agent(origin.mV);
-
- //translate view to origin
- view[j].mult_matrix_vec(origin_agent);
+ glh::vec3f origin_agent(origin.mV);
- eye = LLVector3(origin_agent.v);
+ //translate view to origin
+ view[j].mult_matrix_vec(origin_agent);
+
+ eye = LLVector3(origin_agent.v);
//llassert(eye.isFinite());
- if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
- {
- mShadowFrustOrigin[j] = eye;
- }
-
- view[j] = look(LLVector3(origin_agent.v), lightDir, -up);
-
- F32 fx = 1.f/tanf(fovx);
- F32 fz = 1.f/tanf(fovz);
-
- proj[j] = glh::matrix4f(-fx, 0, 0, 0,
- 0, (yfar+ynear)/(ynear-yfar), 0, (2.f*yfar*ynear)/(ynear-yfar),
- 0, 0, -fz, 0,
- 0, -1.f, 0, 0);
- }
- }
- }
-
- //shadow_cam.setFar(128.f);
- shadow_cam.setOriginAndLookAt(eye, up, center);
-
- shadow_cam.setOrigin(0,0,0);
-
- set_current_modelview(view[j]);
- set_current_projection(proj[j]);
-
- LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
-
- //shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR);
- shadow_cam.getAgentPlane(LLCamera::AGENT_PLANE_NEAR).set(shadow_near_clip);
-
- //translate and scale to from [-1, 1] to [0, 1]
- glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
- 0.f, 0.5f, 0.f, 0.5f,
- 0.f, 0.f, 0.5f, 0.5f,
- 0.f, 0.f, 0.f, 1.f);
-
- set_current_modelview(view[j]);
- set_current_projection(proj[j]);
-
- for (U32 i = 0; i < 16; i++)
- {
- gGLLastModelView[i] = mShadowModelview[j].m[i];
- gGLLastProjection[i] = mShadowProjection[j].m[i];
- }
-
- mShadowModelview[j] = view[j];
- mShadowProjection[j] = proj[j];
- mSunShadowMatrix[j] = trans*proj[j]*view[j]*inv_view;
-
- stop_glerror();
-
- mRT->shadow[j].bindTarget();
- mRT->shadow[j].getViewport(gGLViewport);
- mRT->shadow[j].clear();
-
- {
- static LLCullResult result[4];
- renderShadow(view[j], proj[j], shadow_cam, result[j], true);
- }
-
- mRT->shadow[j].flush();
-
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
- {
- mShadowCamera[j+4] = shadow_cam;
- }
- }
- }
-
- //hack to disable projector shadows
- bool gen_shadow = RenderShadowDetail > 1;
-
- if (gen_shadow)
- {
+ if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
+ {
+ mShadowFrustOrigin[j] = eye;
+ }
+
+ view[j] = look(LLVector3(origin_agent.v), lightDir, -up);
+
+ F32 fx = 1.f/tanf(fovx);
+ F32 fz = 1.f/tanf(fovz);
+
+ proj[j] = glh::matrix4f(-fx, 0, 0, 0,
+ 0, (yfar+ynear)/(ynear-yfar), 0, (2.f*yfar*ynear)/(ynear-yfar),
+ 0, 0, -fz, 0,
+ 0, -1.f, 0, 0);
+ }
+ }
+ }
+
+ //shadow_cam.setFar(128.f);
+ shadow_cam.setOriginAndLookAt(eye, up, center);
+
+ shadow_cam.setOrigin(0,0,0);
+
+ set_current_modelview(view[j]);
+ set_current_projection(proj[j]);
+
+ LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
+
+ //shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR);
+ shadow_cam.getAgentPlane(LLCamera::AGENT_PLANE_NEAR).set(shadow_near_clip);
+
+ //translate and scale to from [-1, 1] to [0, 1]
+ glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
+ 0.f, 0.5f, 0.f, 0.5f,
+ 0.f, 0.f, 0.5f, 0.5f,
+ 0.f, 0.f, 0.f, 1.f);
+
+ set_current_modelview(view[j]);
+ set_current_projection(proj[j]);
+
+ for (U32 i = 0; i < 16; i++)
+ {
+ gGLLastModelView[i] = mShadowModelview[j].m[i];
+ gGLLastProjection[i] = mShadowProjection[j].m[i];
+ }
+
+ mShadowModelview[j] = view[j];
+ mShadowProjection[j] = proj[j];
+ mSunShadowMatrix[j] = trans*proj[j]*view[j]*inv_view;
+
+ stop_glerror();
+
+ mRT->shadow[j].bindTarget();
+ mRT->shadow[j].getViewport(gGLViewport);
+ mRT->shadow[j].clear();
+
+ {
+ static LLCullResult result[4];
+ renderShadow(view[j], proj[j], shadow_cam, result[j], true);
+ }
+
+ mRT->shadow[j].flush();
+
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
+ {
+ mShadowCamera[j+4] = shadow_cam;
+ }
+ }
+ }
+
+ //hack to disable projector shadows
+ bool gen_shadow = RenderShadowDetail > 1;
+
+ if (gen_shadow)
+ {
if (!gCubeSnapshot) //skip updating spot shadow maps during cubemap updates
{
LLTrace::CountStatHandle<>* velocity_stat = LLViewerCamera::getVelocityStat();
@@ -9934,7 +9934,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
//
-
+
mSpotShadow[i].bindTarget();
mSpotShadow[i].getViewport(gGLViewport);
mSpotShadow[i].clear();
@@ -9952,56 +9952,56 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
mSpotShadow[i].flush();
}
}
- }
- else
- { //no spotlight shadows
- mShadowSpotLight[0] = mShadowSpotLight[1] = NULL;
- }
+ }
+ else
+ { //no spotlight shadows
+ mShadowSpotLight[0] = mShadowSpotLight[1] = NULL;
+ }
- if (!CameraOffset)
- {
- set_current_modelview(saved_view);
- set_current_projection(saved_proj);
- }
- else
- {
- set_current_modelview(view[1]);
- set_current_projection(proj[1]);
- gGL.loadMatrix(view[1].m);
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.loadMatrix(proj[1].m);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- }
- gGL.setColorMask(true, true);
+ if (!CameraOffset)
+ {
+ set_current_modelview(saved_view);
+ set_current_projection(saved_proj);
+ }
+ else
+ {
+ set_current_modelview(view[1]);
+ set_current_projection(proj[1]);
+ gGL.loadMatrix(view[1].m);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadMatrix(proj[1].m);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ }
+ gGL.setColorMask(true, true);
- for (U32 i = 0; i < 16; i++)
- {
- gGLLastModelView[i] = last_modelview[i];
- gGLLastProjection[i] = last_projection[i];
- }
+ for (U32 i = 0; i < 16; i++)
+ {
+ gGLLastModelView[i] = last_modelview[i];
+ gGLLastProjection[i] = last_projection[i];
+ }
- popRenderTypeMask();
+ popRenderTypeMask();
- if (!skip_avatar_update)
- {
- gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
- }
+ if (!skip_avatar_update)
+ {
+ gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+ }
}
void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, bool texture)
{
- for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
- {
- LLSpatialGroup* group = *i;
- if (!group->isDead() &&
- (!sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) &&
- gPipeline.hasRenderType(group->getSpatialPartition()->mDrawableType) &&
- group->mDrawMap.find(type) != group->mDrawMap.end())
- {
- pass->renderGroup(group,type,texture);
- }
- }
+ for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
+ {
+ LLSpatialGroup* group = *i;
+ if (!group->isDead() &&
+ (!sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) &&
+ gPipeline.hasRenderType(group->getSpatialPartition()->mDrawableType) &&
+ group->mDrawMap.find(type) != group->mDrawMap.end())
+ {
+ pass->renderGroup(group,type,texture);
+ }
+ }
}
void LLPipeline::renderRiggedGroups(LLRenderPass* pass, U32 type, bool texture)
@@ -10049,8 +10049,8 @@ void LLPipeline::profileAvatar(LLVOAvatar* avatar, bool profile_attachments)
avatar->readProfileQuery(5); // allow up to 5 frames of latency
}
- else
- {
+ else
+ {
// profile attachments one at a time
LLVOAvatar::attachment_map_t::iterator iter;
LLVOAvatar::attachment_map_t::iterator begin = avatar->mAttachmentPoints.begin();
@@ -10093,27 +10093,27 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LL_PROFILE_GPU_ZONE("generateImpostor");
- LLGLState::checkStates();
-
- static LLCullResult result;
- result.clear();
- grabReferences(result);
-
- if (!avatar || !avatar->mDrawable)
- {
+ LLGLState::checkStates();
+
+ static LLCullResult result;
+ result.clear();
+ grabReferences(result);
+
+ if (!avatar || !avatar->mDrawable)
+ {
LL_WARNS_ONCE("AvatarRenderPipeline") << "Avatar is " << (avatar ? "not drawable" : "null") << LL_ENDL;
- return;
- }
+ return;
+ }
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID() << " is drawable" << LL_ENDL;
- assertInitialized();
+ assertInitialized();
// previews can't be muted or impostered
- bool visually_muted = !for_profile && !preview_avatar && avatar->isVisuallyMuted();
+ bool visually_muted = !for_profile && !preview_avatar && avatar->isVisuallyMuted();
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID()
<< " is " << ( visually_muted ? "" : "not ") << "visually muted"
<< LL_ENDL;
- bool too_complex = !for_profile && !preview_avatar && avatar->isTooComplex();
+ bool too_complex = !for_profile && !preview_avatar && avatar->isTooComplex();
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID()
<< " is " << ( too_complex ? "" : "not ") << "too complex"
<< LL_ENDL;
@@ -10123,12 +10123,12 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
if (visually_muted || too_complex)
{
// only show jelly doll geometry
- andRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR,
- LLPipeline::RENDER_TYPE_CONTROL_AV,
- END_RENDER_TYPES);
- }
- else
- {
+ andRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR,
+ LLPipeline::RENDER_TYPE_CONTROL_AV,
+ END_RENDER_TYPES);
+ }
+ else
+ {
//hide world geometry
clearRenderTypeMask(
RENDER_TYPE_SKY,
@@ -10147,25 +10147,25 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
RENDER_TYPE_HUD_PARTICLES,
END_RENDER_TYPES
);
- }
-
+ }
+
if (specific_attachment && specific_attachment->isHUDAttachment())
{ //enable HUD rendering
setRenderTypeMask(RENDER_TYPE_HUD, END_RENDER_TYPES);
}
- S32 occlusion = sUseOcclusion;
- sUseOcclusion = 0;
+ S32 occlusion = sUseOcclusion;
+ sUseOcclusion = 0;
- sReflectionRender = ! sRenderDeferred;
+ sReflectionRender = ! sRenderDeferred;
- sShadowRender = true;
- sImpostorRender = true;
+ sShadowRender = true;
+ sImpostorRender = true;
- LLViewerCamera* viewer_camera = LLViewerCamera::getInstance();
+ LLViewerCamera* viewer_camera = LLViewerCamera::getInstance();
- {
- markVisible(avatar->mDrawable, *viewer_camera);
+ {
+ markVisible(avatar->mDrawable, *viewer_camera);
if (preview_avatar)
{
@@ -10238,70 +10238,70 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
}
}
}
- }
+ }
+
+ stateSort(*LLViewerCamera::getInstance(), result);
- stateSort(*LLViewerCamera::getInstance(), result);
-
- LLCamera camera = *viewer_camera;
- LLVector2 tdim;
- U32 resY = 0;
- U32 resX = 0;
+ LLCamera camera = *viewer_camera;
+ LLVector2 tdim;
+ U32 resY = 0;
+ U32 resX = 0;
if (!preview_avatar)
- {
- const LLVector4a* ext = avatar->mDrawable->getSpatialExtents();
- LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset());
-
- camera.lookAt(viewer_camera->getOrigin(), pos, viewer_camera->getUpAxis());
-
- LLVector4a half_height;
- half_height.setSub(ext[1], ext[0]);
- half_height.mul(0.5f);
-
- LLVector4a left;
- left.load3(camera.getLeftAxis().mV);
- left.mul(left);
- llassert(left.dot3(left).getF32() > F_APPROXIMATELY_ZERO);
- left.normalize3fast();
-
- LLVector4a up;
- up.load3(camera.getUpAxis().mV);
- up.mul(up);
- llassert(up.dot3(up).getF32() > F_APPROXIMATELY_ZERO);
- up.normalize3fast();
-
- tdim.mV[0] = fabsf(half_height.dot3(left).getF32());
- tdim.mV[1] = fabsf(half_height.dot3(up).getF32());
-
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
-
- F32 distance = (pos-camera.getOrigin()).length();
- F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG;
- F32 aspect = tdim.mV[0]/tdim.mV[1];
- glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f);
- set_current_projection(persp);
- gGL.loadMatrix(persp.m);
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- glh::matrix4f mat;
- camera.getOpenGLTransform(mat.m);
-
- mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat;
-
- gGL.loadMatrix(mat.m);
- set_current_modelview(mat);
-
- glClearColor(0.0f,0.0f,0.0f,0.0f);
- gGL.setColorMask(true, true);
-
- // get the number of pixels per angle
- F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView());
-
- //get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing)
- resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512);
- resX = llmin(nhpo2((U32) (atanf(tdim.mV[0]/distance)*2.f*RAD_TO_DEG*pa)), (U32) 512);
+ {
+ const LLVector4a* ext = avatar->mDrawable->getSpatialExtents();
+ LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset());
+
+ camera.lookAt(viewer_camera->getOrigin(), pos, viewer_camera->getUpAxis());
+
+ LLVector4a half_height;
+ half_height.setSub(ext[1], ext[0]);
+ half_height.mul(0.5f);
+
+ LLVector4a left;
+ left.load3(camera.getLeftAxis().mV);
+ left.mul(left);
+ llassert(left.dot3(left).getF32() > F_APPROXIMATELY_ZERO);
+ left.normalize3fast();
+
+ LLVector4a up;
+ up.load3(camera.getUpAxis().mV);
+ up.mul(up);
+ llassert(up.dot3(up).getF32() > F_APPROXIMATELY_ZERO);
+ up.normalize3fast();
+
+ tdim.mV[0] = fabsf(half_height.dot3(left).getF32());
+ tdim.mV[1] = fabsf(half_height.dot3(up).getF32());
+
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+
+ F32 distance = (pos-camera.getOrigin()).length();
+ F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG;
+ F32 aspect = tdim.mV[0]/tdim.mV[1];
+ glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f);
+ set_current_projection(persp);
+ gGL.loadMatrix(persp.m);
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ glh::matrix4f mat;
+ camera.getOpenGLTransform(mat.m);
+
+ mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat;
+
+ gGL.loadMatrix(mat.m);
+ set_current_modelview(mat);
+
+ glClearColor(0.0f,0.0f,0.0f,0.0f);
+ gGL.setColorMask(true, true);
+
+ // get the number of pixels per angle
+ F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView());
+
+ //get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing)
+ resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512);
+ resX = llmin(nhpo2((U32) (atanf(tdim.mV[0]/distance)*2.f*RAD_TO_DEG*pa)), (U32) 512);
if (!for_profile)
{
@@ -10325,14 +10325,14 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
avatar->mImpostor.bindTarget();
}
- }
+ }
- F32 old_alpha = LLDrawPoolAvatar::sMinimumAlpha;
+ F32 old_alpha = LLDrawPoolAvatar::sMinimumAlpha;
- if (visually_muted || too_complex)
- { //disable alpha masking for muted avatars (get whole skin silhouette)
- LLDrawPoolAvatar::sMinimumAlpha = 0.f;
- }
+ if (visually_muted || too_complex)
+ { //disable alpha masking for muted avatars (get whole skin silhouette)
+ LLDrawPoolAvatar::sMinimumAlpha = 0.f;
+ }
if (preview_avatar || for_profile)
{
@@ -10341,91 +10341,91 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
renderGeomPostDeferred(camera);
}
else
- {
- avatar->mImpostor.clear();
- renderGeomDeferred(camera);
+ {
+ avatar->mImpostor.clear();
+ renderGeomDeferred(camera);
- renderGeomPostDeferred(camera);
+ renderGeomPostDeferred(camera);
- // Shameless hack time: render it all again,
- // this time writing the depth
- // values we need to generate the alpha mask below
- // while preserving the alpha-sorted color rendering
- // from the previous pass
- //
- sImpostorRenderAlphaDepthPass = true;
- // depth-only here...
- //
- gGL.setColorMask(false,false);
- renderGeomPostDeferred(camera);
+ // Shameless hack time: render it all again,
+ // this time writing the depth
+ // values we need to generate the alpha mask below
+ // while preserving the alpha-sorted color rendering
+ // from the previous pass
+ //
+ sImpostorRenderAlphaDepthPass = true;
+ // depth-only here...
+ //
+ gGL.setColorMask(false,false);
+ renderGeomPostDeferred(camera);
- sImpostorRenderAlphaDepthPass = false;
+ sImpostorRenderAlphaDepthPass = false;
- }
+ }
- LLDrawPoolAvatar::sMinimumAlpha = old_alpha;
+ LLDrawPoolAvatar::sMinimumAlpha = old_alpha;
if (!for_profile)
- { //create alpha mask based on depth buffer (grey out if muted)
- if (LLPipeline::sRenderDeferred)
- {
- GLuint buff = GL_COLOR_ATTACHMENT0;
- glDrawBuffers(1, &buff);
- }
-
- LLGLDisable blend(GL_BLEND);
-
- if (visually_muted || too_complex)
- {
- gGL.setColorMask(true, true);
- }
- else
- {
- gGL.setColorMask(false, true);
- }
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
-
- gGL.flush();
-
- gGL.pushMatrix();
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadIdentity();
-
- static const F32 clip_plane = 0.99999f;
-
- gDebugProgram.bind();
-
- if (visually_muted)
- { // Visually muted avatar
+ { //create alpha mask based on depth buffer (grey out if muted)
+ if (LLPipeline::sRenderDeferred)
+ {
+ GLuint buff = GL_COLOR_ATTACHMENT0;
+ glDrawBuffers(1, &buff);
+ }
+
+ LLGLDisable blend(GL_BLEND);
+
+ if (visually_muted || too_complex)
+ {
+ gGL.setColorMask(true, true);
+ }
+ else
+ {
+ gGL.setColorMask(false, true);
+ }
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
+
+ gGL.flush();
+
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+
+ static const F32 clip_plane = 0.99999f;
+
+ gDebugProgram.bind();
+
+ if (visually_muted)
+ { // Visually muted avatar
LLColor4 muted_color(avatar->getMutedAVColor());
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID() << " MUTED set solid color " << muted_color << LL_ENDL;
- gGL.diffuseColor4fv( muted_color.mV );
- }
- else if (!preview_avatar)
- { //grey muted avatar
+ gGL.diffuseColor4fv( muted_color.mV );
+ }
+ else if (!preview_avatar)
+ { //grey muted avatar
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID() << " MUTED set grey" << LL_ENDL;
- gGL.diffuseColor4fv(LLColor4::pink.mV );
- }
+ gGL.diffuseColor4fv(LLColor4::pink.mV );
+ }
- gGL.begin(LLRender::QUADS);
- gGL.vertex3f(-1, -1, clip_plane);
- gGL.vertex3f(1, -1, clip_plane);
- gGL.vertex3f(1, 1, clip_plane);
- gGL.vertex3f(-1, 1, clip_plane);
- gGL.end();
- gGL.flush();
+ gGL.begin(LLRender::QUADS);
+ gGL.vertex3f(-1, -1, clip_plane);
+ gGL.vertex3f(1, -1, clip_plane);
+ gGL.vertex3f(1, 1, clip_plane);
+ gGL.vertex3f(-1, 1, clip_plane);
+ gGL.end();
+ gGL.flush();
- gDebugProgram.unbind();
+ gDebugProgram.unbind();
- gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
- }
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+ }
if (!preview_avatar && !for_profile)
{
@@ -10433,16 +10433,16 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
avatar->setImpostorDim(tdim);
}
- sUseOcclusion = occlusion;
- sReflectionRender = false;
- sImpostorRender = false;
- sShadowRender = false;
- popRenderTypeMask();
+ sUseOcclusion = occlusion;
+ sReflectionRender = false;
+ sImpostorRender = false;
+ sShadowRender = false;
+ popRenderTypeMask();
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
if (!preview_avatar && !for_profile)
{
@@ -10451,33 +10451,33 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
avatar->mLastImpostorUpdateFrameTime = gFrameTimeSeconds;
}
- LLVertexBuffer::unbind();
- LLGLState::checkStates();
+ LLVertexBuffer::unbind();
+ LLGLState::checkStates();
}
bool LLPipeline::hasRenderBatches(const U32 type) const
{
- return sCull->getRenderMapSize(type) > 0;
+ return sCull->getRenderMapSize(type) > 0;
}
LLCullResult::drawinfo_iterator LLPipeline::beginRenderMap(U32 type)
{
- return sCull->beginRenderMap(type);
+ return sCull->beginRenderMap(type);
}
LLCullResult::drawinfo_iterator LLPipeline::endRenderMap(U32 type)
{
- return sCull->endRenderMap(type);
+ return sCull->endRenderMap(type);
}
LLCullResult::sg_iterator LLPipeline::beginAlphaGroups()
{
- return sCull->beginAlphaGroups();
+ return sCull->beginAlphaGroups();
}
LLCullResult::sg_iterator LLPipeline::endAlphaGroups()
{
- return sCull->endAlphaGroups();
+ return sCull->endAlphaGroups();
}
LLCullResult::sg_iterator LLPipeline::beginRiggedAlphaGroups()
@@ -10495,278 +10495,278 @@ bool LLPipeline::hasRenderType(const U32 type) const
// STORM-365 : LLViewerJointAttachment::setAttachmentVisibility() is setting type to 0 to actually mean "do not render"
// We then need to test that value here and return false to prevent attachment to render (in mouselook for instance)
// TODO: reintroduce RENDER_TYPE_NONE in LLRenderTypeMask and initialize its mRenderTypeEnabled[RENDER_TYPE_NONE] to false explicitely
- return (type == 0 ? false : mRenderTypeEnabled[type]);
+ return (type == 0 ? false : mRenderTypeEnabled[type]);
}
void LLPipeline::setRenderTypeMask(U32 type, ...)
{
- va_list args;
+ va_list args;
- va_start(args, type);
- while (type < END_RENDER_TYPES)
- {
- mRenderTypeEnabled[type] = true;
- type = va_arg(args, U32);
- }
- va_end(args);
+ va_start(args, type);
+ while (type < END_RENDER_TYPES)
+ {
+ mRenderTypeEnabled[type] = true;
+ type = va_arg(args, U32);
+ }
+ va_end(args);
- if (type > END_RENDER_TYPES)
- {
- LL_ERRS() << "Invalid render type." << LL_ENDL;
- }
+ if (type > END_RENDER_TYPES)
+ {
+ LL_ERRS() << "Invalid render type." << LL_ENDL;
+ }
}
bool LLPipeline::hasAnyRenderType(U32 type, ...) const
{
- va_list args;
+ va_list args;
- va_start(args, type);
- while (type < END_RENDER_TYPES)
- {
- if (mRenderTypeEnabled[type])
- {
- return true;
- }
- type = va_arg(args, U32);
- }
- va_end(args);
+ va_start(args, type);
+ while (type < END_RENDER_TYPES)
+ {
+ if (mRenderTypeEnabled[type])
+ {
+ return true;
+ }
+ type = va_arg(args, U32);
+ }
+ va_end(args);
- if (type > END_RENDER_TYPES)
- {
- LL_ERRS() << "Invalid render type." << LL_ENDL;
- }
+ if (type > END_RENDER_TYPES)
+ {
+ LL_ERRS() << "Invalid render type." << LL_ENDL;
+ }
- return false;
+ return false;
}
void LLPipeline::pushRenderTypeMask()
{
- std::string cur_mask;
- cur_mask.assign((const char*) mRenderTypeEnabled, sizeof(mRenderTypeEnabled));
- mRenderTypeEnableStack.push(cur_mask);
+ std::string cur_mask;
+ cur_mask.assign((const char*) mRenderTypeEnabled, sizeof(mRenderTypeEnabled));
+ mRenderTypeEnableStack.push(cur_mask);
}
void LLPipeline::popRenderTypeMask()
{
- if (mRenderTypeEnableStack.empty())
- {
- LL_ERRS() << "Depleted render type stack." << LL_ENDL;
- }
+ if (mRenderTypeEnableStack.empty())
+ {
+ LL_ERRS() << "Depleted render type stack." << LL_ENDL;
+ }
- memcpy(mRenderTypeEnabled, mRenderTypeEnableStack.top().data(), sizeof(mRenderTypeEnabled));
- mRenderTypeEnableStack.pop();
+ memcpy(mRenderTypeEnabled, mRenderTypeEnableStack.top().data(), sizeof(mRenderTypeEnabled));
+ mRenderTypeEnableStack.pop();
}
void LLPipeline::andRenderTypeMask(U32 type, ...)
{
- va_list args;
+ va_list args;
- bool tmp[NUM_RENDER_TYPES];
- for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
- {
- tmp[i] = false;
- }
+ bool tmp[NUM_RENDER_TYPES];
+ for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
+ {
+ tmp[i] = false;
+ }
- va_start(args, type);
- while (type < END_RENDER_TYPES)
- {
- if (mRenderTypeEnabled[type])
- {
- tmp[type] = true;
- }
+ va_start(args, type);
+ while (type < END_RENDER_TYPES)
+ {
+ if (mRenderTypeEnabled[type])
+ {
+ tmp[type] = true;
+ }
- type = va_arg(args, U32);
- }
- va_end(args);
+ type = va_arg(args, U32);
+ }
+ va_end(args);
- if (type > END_RENDER_TYPES)
- {
- LL_ERRS() << "Invalid render type." << LL_ENDL;
- }
+ if (type > END_RENDER_TYPES)
+ {
+ LL_ERRS() << "Invalid render type." << LL_ENDL;
+ }
- for (U32 i = 0; i < LLPipeline::NUM_RENDER_TYPES; ++i)
- {
- mRenderTypeEnabled[i] = tmp[i];
- }
+ for (U32 i = 0; i < LLPipeline::NUM_RENDER_TYPES; ++i)
+ {
+ mRenderTypeEnabled[i] = tmp[i];
+ }
}
void LLPipeline::clearRenderTypeMask(U32 type, ...)
{
- va_list args;
+ va_list args;
- va_start(args, type);
- while (type < END_RENDER_TYPES)
- {
- mRenderTypeEnabled[type] = false;
-
- type = va_arg(args, U32);
- }
- va_end(args);
+ va_start(args, type);
+ while (type < END_RENDER_TYPES)
+ {
+ mRenderTypeEnabled[type] = false;
+
+ type = va_arg(args, U32);
+ }
+ va_end(args);
- if (type > END_RENDER_TYPES)
- {
- LL_ERRS() << "Invalid render type." << LL_ENDL;
- }
+ if (type > END_RENDER_TYPES)
+ {
+ LL_ERRS() << "Invalid render type." << LL_ENDL;
+ }
}
void LLPipeline::setAllRenderTypes()
{
- for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
- {
- mRenderTypeEnabled[i] = true;
- }
+ for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
+ {
+ mRenderTypeEnabled[i] = true;
+ }
}
void LLPipeline::clearAllRenderTypes()
{
- for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
- {
- mRenderTypeEnabled[i] = false;
- }
+ for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
+ {
+ mRenderTypeEnabled[i] = false;
+ }
}
void LLPipeline::addDebugBlip(const LLVector3& position, const LLColor4& color)
{
- DebugBlip blip(position, color);
- mDebugBlips.push_back(blip);
+ DebugBlip blip(position, color);
+ mDebugBlips.push_back(blip);
}
void LLPipeline::hidePermanentObjects( std::vector<U32>& restoreList )
{
- //This method is used to hide any vo's from the object list that may have
- //the permanent flag set.
-
- U32 objCnt = gObjectList.getNumObjects();
- for (U32 i = 0; i < objCnt; ++i)
- {
- LLViewerObject* pObject = gObjectList.getObject(i);
- if ( pObject && pObject->flagObjectPermanent() )
- {
- LLDrawable *pDrawable = pObject->mDrawable;
-
- if ( pDrawable )
- {
- restoreList.push_back( i );
- hideDrawable( pDrawable );
- }
- }
- }
-
- skipRenderingOfTerrain( true );
+ //This method is used to hide any vo's from the object list that may have
+ //the permanent flag set.
+
+ U32 objCnt = gObjectList.getNumObjects();
+ for (U32 i = 0; i < objCnt; ++i)
+ {
+ LLViewerObject* pObject = gObjectList.getObject(i);
+ if ( pObject && pObject->flagObjectPermanent() )
+ {
+ LLDrawable *pDrawable = pObject->mDrawable;
+
+ if ( pDrawable )
+ {
+ restoreList.push_back( i );
+ hideDrawable( pDrawable );
+ }
+ }
+ }
+
+ skipRenderingOfTerrain( true );
}
void LLPipeline::restorePermanentObjects( const std::vector<U32>& restoreList )
{
- //This method is used to restore(unhide) any vo's from the object list that may have
- //been hidden because their permanency flag was set.
-
- std::vector<U32>::const_iterator itCurrent = restoreList.begin();
- std::vector<U32>::const_iterator itEnd = restoreList.end();
-
- U32 objCnt = gObjectList.getNumObjects();
-
- while ( itCurrent != itEnd )
- {
- U32 index = *itCurrent;
- LLViewerObject* pObject = NULL;
- if ( index < objCnt )
- {
- pObject = gObjectList.getObject( index );
- }
- if ( pObject )
- {
- LLDrawable *pDrawable = pObject->mDrawable;
- if ( pDrawable )
- {
- pDrawable->clearState( LLDrawable::FORCE_INVISIBLE );
- unhideDrawable( pDrawable );
- }
- }
- ++itCurrent;
- }
-
- skipRenderingOfTerrain( false );
+ //This method is used to restore(unhide) any vo's from the object list that may have
+ //been hidden because their permanency flag was set.
+
+ std::vector<U32>::const_iterator itCurrent = restoreList.begin();
+ std::vector<U32>::const_iterator itEnd = restoreList.end();
+
+ U32 objCnt = gObjectList.getNumObjects();
+
+ while ( itCurrent != itEnd )
+ {
+ U32 index = *itCurrent;
+ LLViewerObject* pObject = NULL;
+ if ( index < objCnt )
+ {
+ pObject = gObjectList.getObject( index );
+ }
+ if ( pObject )
+ {
+ LLDrawable *pDrawable = pObject->mDrawable;
+ if ( pDrawable )
+ {
+ pDrawable->clearState( LLDrawable::FORCE_INVISIBLE );
+ unhideDrawable( pDrawable );
+ }
+ }
+ ++itCurrent;
+ }
+
+ skipRenderingOfTerrain( false );
}
void LLPipeline::skipRenderingOfTerrain( bool flag )
{
- pool_set_t::iterator iter = mPools.begin();
- while ( iter != mPools.end() )
- {
- LLDrawPool* pPool = *iter;
- U32 poolType = pPool->getType();
- if ( hasRenderType( pPool->getType() ) && poolType == LLDrawPool::POOL_TERRAIN )
- {
- pPool->setSkipRenderFlag( flag );
- }
- ++iter;
- }
+ pool_set_t::iterator iter = mPools.begin();
+ while ( iter != mPools.end() )
+ {
+ LLDrawPool* pPool = *iter;
+ U32 poolType = pPool->getType();
+ if ( hasRenderType( pPool->getType() ) && poolType == LLDrawPool::POOL_TERRAIN )
+ {
+ pPool->setSkipRenderFlag( flag );
+ }
+ ++iter;
+ }
}
void LLPipeline::hideObject( const LLUUID& id )
{
- LLViewerObject *pVO = gObjectList.findObject( id );
-
- if ( pVO )
- {
- LLDrawable *pDrawable = pVO->mDrawable;
-
- if ( pDrawable )
- {
- hideDrawable( pDrawable );
- }
- }
+ LLViewerObject *pVO = gObjectList.findObject( id );
+
+ if ( pVO )
+ {
+ LLDrawable *pDrawable = pVO->mDrawable;
+
+ if ( pDrawable )
+ {
+ hideDrawable( pDrawable );
+ }
+ }
}
void LLPipeline::hideDrawable( LLDrawable *pDrawable )
{
- pDrawable->setState( LLDrawable::FORCE_INVISIBLE );
- markRebuild( pDrawable, LLDrawable::REBUILD_ALL);
- //hide the children
- LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren();
- for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++ )
- {
- LLViewerObject* child = *iter;
- LLDrawable* drawable = child->mDrawable;
- if ( drawable )
- {
- drawable->setState( LLDrawable::FORCE_INVISIBLE );
- markRebuild( drawable, LLDrawable::REBUILD_ALL);
- }
- }
+ pDrawable->setState( LLDrawable::FORCE_INVISIBLE );
+ markRebuild( pDrawable, LLDrawable::REBUILD_ALL);
+ //hide the children
+ LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren();
+ for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++ )
+ {
+ LLViewerObject* child = *iter;
+ LLDrawable* drawable = child->mDrawable;
+ if ( drawable )
+ {
+ drawable->setState( LLDrawable::FORCE_INVISIBLE );
+ markRebuild( drawable, LLDrawable::REBUILD_ALL);
+ }
+ }
}
void LLPipeline::unhideDrawable( LLDrawable *pDrawable )
{
- pDrawable->clearState( LLDrawable::FORCE_INVISIBLE );
- markRebuild( pDrawable, LLDrawable::REBUILD_ALL);
- //restore children
- LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren();
- for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
- {
- LLViewerObject* child = *iter;
- LLDrawable* drawable = child->mDrawable;
- if ( drawable )
- {
- drawable->clearState( LLDrawable::FORCE_INVISIBLE );
- markRebuild( drawable, LLDrawable::REBUILD_ALL);
- }
- }
+ pDrawable->clearState( LLDrawable::FORCE_INVISIBLE );
+ markRebuild( pDrawable, LLDrawable::REBUILD_ALL);
+ //restore children
+ LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren();
+ for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); iter++)
+ {
+ LLViewerObject* child = *iter;
+ LLDrawable* drawable = child->mDrawable;
+ if ( drawable )
+ {
+ drawable->clearState( LLDrawable::FORCE_INVISIBLE );
+ markRebuild( drawable, LLDrawable::REBUILD_ALL);
+ }
+ }
}
void LLPipeline::restoreHiddenObject( const LLUUID& id )
{
- LLViewerObject *pVO = gObjectList.findObject( id );
-
- if ( pVO )
- {
- LLDrawable *pDrawable = pVO->mDrawable;
- if ( pDrawable )
- {
- unhideDrawable( pDrawable );
- }
- }
+ LLViewerObject *pVO = gObjectList.findObject( id );
+
+ if ( pVO )
+ {
+ LLDrawable *pDrawable = pVO->mDrawable;
+ if ( pDrawable )
+ {
+ unhideDrawable( pDrawable );
+ }
+ }
}
void LLPipeline::skipRenderingShadows()
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 88a7eab813..c5f14a31de 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file pipeline.h
* @brief Rendering pipeline definitions
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -55,8 +55,8 @@ class LLSettingsSky;
typedef enum e_avatar_skinning_method
{
- SKIN_METHOD_SOFTWARE,
- SKIN_METHOD_VERTEX_PROGRAM
+ SKIN_METHOD_SOFTWARE,
+ SKIN_METHOD_VERTEX_PROGRAM
} EAvatarSkinningMethod;
bool compute_min_max(LLMatrix4& box, LLVector2& min, LLVector2& max); // Shouldn't be defined here!
@@ -92,50 +92,50 @@ extern LLTrace::BlockTimerStatHandle FTM_RENDER_UI_2D;
class LLPipeline
{
public:
- LLPipeline();
- ~LLPipeline();
+ LLPipeline();
+ ~LLPipeline();
- void destroyGL();
- void restoreGL();
- void requestResizeScreenTexture(); // set flag only, no work, safer for callbacks...
+ void destroyGL();
+ void restoreGL();
+ void requestResizeScreenTexture(); // set flag only, no work, safer for callbacks...
void requestResizeShadowTexture(); // set flag only, no work, safer for callbacks...
- void resizeScreenTexture();
+ void resizeScreenTexture();
void resizeShadowTexture();
- void releaseGLBuffers();
- void releaseLUTBuffers();
- void releaseScreenBuffers();
+ void releaseGLBuffers();
+ void releaseLUTBuffers();
+ void releaseScreenBuffers();
void releaseShadowBuffers();
- void createGLBuffers();
- void createLUTBuffers();
+ void createGLBuffers();
+ void createLUTBuffers();
- //allocate the largest screen buffer possible up to resX, resY
- //returns true if full size buffer allocated, false if some other size is allocated
- bool allocateScreenBuffer(U32 resX, U32 resY);
+ //allocate the largest screen buffer possible up to resX, resY
+ //returns true if full size buffer allocated, false if some other size is allocated
+ bool allocateScreenBuffer(U32 resX, U32 resY);
- typedef enum {
- FBO_SUCCESS_FULLRES = 0,
- FBO_SUCCESS_LOWRES,
- FBO_FAILURE
- } eFBOStatus;
+ typedef enum {
+ FBO_SUCCESS_FULLRES = 0,
+ FBO_SUCCESS_LOWRES,
+ FBO_FAILURE
+ } eFBOStatus;
private:
- //implementation of above, wrapped for easy error handling
- eFBOStatus doAllocateScreenBuffer(U32 resX, U32 resY);
+ //implementation of above, wrapped for easy error handling
+ eFBOStatus doAllocateScreenBuffer(U32 resX, U32 resY);
public:
- //attempt to allocate screen buffers at resX, resY
- //returns true if allocation successful, false otherwise
- bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples);
+ //attempt to allocate screen buffers at resX, resY
+ //returns true if allocation successful, false otherwise
+ bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples);
bool allocateShadowBuffer(U32 resX, U32 resY);
// rebuild all LLVOVolume render batches
void rebuildDrawInfo();
// Clear LLFace mVertexBuffer pointers
- void resetVertexBuffers(LLDrawable* drawable);
+ void resetVertexBuffers(LLDrawable* drawable);
// perform a profile of the given avatar
// if profile_attachments is true, run a profile for each attachment
@@ -145,171 +145,171 @@ public:
// preview_avatar - if true, a preview window render is being performed
// for_profile - if true, a profile is being performed, do not update actual impostor
// specific_attachment - specific attachment to profile, or nullptr to profile entire avatar
- void generateImpostor(LLVOAvatar* avatar, bool preview_avatar = false, bool for_profile = false, LLViewerObject* specific_attachment = nullptr);
-
- void bindScreenToTexture();
- void renderFinalize();
- void copyScreenSpaceReflections(LLRenderTarget* src, LLRenderTarget* dst);
- void generateLuminance(LLRenderTarget* src, LLRenderTarget* dst);
- void generateExposure(LLRenderTarget* src, LLRenderTarget* dst);
- void gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst);
- void generateGlow(LLRenderTarget* src);
- void applyFXAA(LLRenderTarget* src, LLRenderTarget* dst);
- void renderDoF(LLRenderTarget* src, LLRenderTarget* dst);
- void copyRenderTarget(LLRenderTarget* src, LLRenderTarget* dst);
- void combineGlow(LLRenderTarget* src, LLRenderTarget* dst);
- void visualizeBuffers(LLRenderTarget* src, LLRenderTarget* dst, U32 bufferIndex);
-
- void init();
- void cleanup();
- bool isInit() { return mInitialized; };
-
- /// @brief Get a draw pool from pool type (POOL_SIMPLE, POOL_MEDIA) and texture.
- /// @return Draw pool, or NULL if not found.
- LLDrawPool *findPool(const U32 pool_type, LLViewerTexture *tex0 = NULL);
-
- /// @brief Get a draw pool for faces of the appropriate type and texture. Create if necessary.
- /// @return Always returns a draw pool.
- LLDrawPool *getPool(const U32 pool_type, LLViewerTexture *tex0 = NULL);
-
- /// @brief Figures out draw pool type from texture entry. Creates pool if necessary.
- static LLDrawPool* getPoolFromTE(const LLTextureEntry* te, LLViewerTexture* te_image);
- static U32 getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* imagep);
-
- void addPool(LLDrawPool *poolp); // Only to be used by LLDrawPool classes for splitting pools!
- void removePool( LLDrawPool* poolp );
-
- void allocDrawable(LLViewerObject *obj);
-
- void unlinkDrawable(LLDrawable*);
-
- static void removeMutedAVsLights(LLVOAvatar*);
-
- // Object related methods
- void markVisible(LLDrawable *drawablep, LLCamera& camera);
- void markOccluder(LLSpatialGroup* group);
-
- void doOcclusion(LLCamera& camera);
- void markNotCulled(LLSpatialGroup* group, LLCamera &camera);
- void markMoved(LLDrawable *drawablep, bool damped_motion = false);
- void markShift(LLDrawable *drawablep);
- void markTextured(LLDrawable *drawablep);
- void markGLRebuild(LLGLUpdate* glu);
- void markRebuild(LLSpatialGroup* group);
- void markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL);
- void markPartitionMove(LLDrawable* drawablep);
- void markMeshDirty(LLSpatialGroup* group);
-
- //get the object between start and end that's closest to start.
- LLViewerObject* lineSegmentIntersectInWorld(const LLVector4a& start, const LLVector4a& end,
- bool pick_transparent,
- bool pick_rigged,
+ void generateImpostor(LLVOAvatar* avatar, bool preview_avatar = false, bool for_profile = false, LLViewerObject* specific_attachment = nullptr);
+
+ void bindScreenToTexture();
+ void renderFinalize();
+ void copyScreenSpaceReflections(LLRenderTarget* src, LLRenderTarget* dst);
+ void generateLuminance(LLRenderTarget* src, LLRenderTarget* dst);
+ void generateExposure(LLRenderTarget* src, LLRenderTarget* dst);
+ void gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst);
+ void generateGlow(LLRenderTarget* src);
+ void applyFXAA(LLRenderTarget* src, LLRenderTarget* dst);
+ void renderDoF(LLRenderTarget* src, LLRenderTarget* dst);
+ void copyRenderTarget(LLRenderTarget* src, LLRenderTarget* dst);
+ void combineGlow(LLRenderTarget* src, LLRenderTarget* dst);
+ void visualizeBuffers(LLRenderTarget* src, LLRenderTarget* dst, U32 bufferIndex);
+
+ void init();
+ void cleanup();
+ bool isInit() { return mInitialized; };
+
+ /// @brief Get a draw pool from pool type (POOL_SIMPLE, POOL_MEDIA) and texture.
+ /// @return Draw pool, or NULL if not found.
+ LLDrawPool *findPool(const U32 pool_type, LLViewerTexture *tex0 = NULL);
+
+ /// @brief Get a draw pool for faces of the appropriate type and texture. Create if necessary.
+ /// @return Always returns a draw pool.
+ LLDrawPool *getPool(const U32 pool_type, LLViewerTexture *tex0 = NULL);
+
+ /// @brief Figures out draw pool type from texture entry. Creates pool if necessary.
+ static LLDrawPool* getPoolFromTE(const LLTextureEntry* te, LLViewerTexture* te_image);
+ static U32 getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* imagep);
+
+ void addPool(LLDrawPool *poolp); // Only to be used by LLDrawPool classes for splitting pools!
+ void removePool( LLDrawPool* poolp );
+
+ void allocDrawable(LLViewerObject *obj);
+
+ void unlinkDrawable(LLDrawable*);
+
+ static void removeMutedAVsLights(LLVOAvatar*);
+
+ // Object related methods
+ void markVisible(LLDrawable *drawablep, LLCamera& camera);
+ void markOccluder(LLSpatialGroup* group);
+
+ void doOcclusion(LLCamera& camera);
+ void markNotCulled(LLSpatialGroup* group, LLCamera &camera);
+ void markMoved(LLDrawable *drawablep, bool damped_motion = false);
+ void markShift(LLDrawable *drawablep);
+ void markTextured(LLDrawable *drawablep);
+ void markGLRebuild(LLGLUpdate* glu);
+ void markRebuild(LLSpatialGroup* group);
+ void markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL);
+ void markPartitionMove(LLDrawable* drawablep);
+ void markMeshDirty(LLSpatialGroup* group);
+
+ //get the object between start and end that's closest to start.
+ LLViewerObject* lineSegmentIntersectInWorld(const LLVector4a& start, const LLVector4a& end,
+ bool pick_transparent,
+ bool pick_rigged,
bool pick_unselectable,
bool pick_reflection_probe,
- S32* face_hit, // return the face hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL // return the surface tangent at the intersection point
- );
+ S32* face_hit, // return the face hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL // return the surface tangent at the intersection point
+ );
- //get the closest particle to start between start and end, returns the LLVOPartGroup and particle index
- LLVOPartGroup* lineSegmentIntersectParticle(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection,
- S32* face_hit);
+ //get the closest particle to start between start and end, returns the LLVOPartGroup and particle index
+ LLVOPartGroup* lineSegmentIntersectParticle(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection,
+ S32* face_hit);
- LLViewerObject* lineSegmentIntersectInHUD(const LLVector4a& start, const LLVector4a& end,
- bool pick_transparent,
- S32* face_hit, // return the face hit
- LLVector4a* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector4a* normal = NULL, // return the surface normal at the intersection point
- LLVector4a* tangent = NULL // return the surface tangent at the intersection point
- );
+ LLViewerObject* lineSegmentIntersectInHUD(const LLVector4a& start, const LLVector4a& end,
+ bool pick_transparent,
+ S32* face_hit, // return the face hit
+ LLVector4a* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector4a* normal = NULL, // return the surface normal at the intersection point
+ LLVector4a* tangent = NULL // return the surface tangent at the intersection point
+ );
- // Something about these textures has changed. Dirty them.
- void dirtyPoolObjectTextures(const std::set<LLViewerFetchedTexture*>& textures);
+ // Something about these textures has changed. Dirty them.
+ void dirtyPoolObjectTextures(const std::set<LLViewerFetchedTexture*>& textures);
- void resetDrawOrders();
+ void resetDrawOrders();
- U32 addObject(LLViewerObject *obj);
+ U32 addObject(LLViewerObject *obj);
- void enableShadows(const bool enable_shadows);
+ void enableShadows(const bool enable_shadows);
void releaseSpotShadowTargets();
void releaseSunShadowTargets();
void releaseSunShadowTarget(U32 index);
- bool shadersLoaded();
- bool canUseWindLightShaders() const;
- bool canUseAntiAliasing() const;
+ bool shadersLoaded();
+ bool canUseWindLightShaders() const;
+ bool canUseAntiAliasing() const;
- // phases
- void resetFrameStats();
+ // phases
+ void resetFrameStats();
- void updateMoveDampedAsync(LLDrawable* drawablep);
- void updateMoveNormalAsync(LLDrawable* drawablep);
- void updateMovedList(LLDrawable::drawable_vector_t& move_list);
- void updateMove();
- bool visibleObjectsInFrustum(LLCamera& camera);
- bool getVisibleExtents(LLCamera& camera, LLVector3 &min, LLVector3& max);
- bool getVisiblePointCloud(LLCamera& camera, LLVector3 &min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir = LLVector3(0,0,0));
+ void updateMoveDampedAsync(LLDrawable* drawablep);
+ void updateMoveNormalAsync(LLDrawable* drawablep);
+ void updateMovedList(LLDrawable::drawable_vector_t& move_list);
+ void updateMove();
+ bool visibleObjectsInFrustum(LLCamera& camera);
+ bool getVisibleExtents(LLCamera& camera, LLVector3 &min, LLVector3& max);
+ bool getVisiblePointCloud(LLCamera& camera, LLVector3 &min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir = LLVector3(0,0,0));
// Populate given LLCullResult with results of a frustum cull of the entire scene against the given LLCamera
- void updateCull(LLCamera& camera, LLCullResult& result);
- void createObjects(F32 max_dtime);
- void createObject(LLViewerObject* vobj);
- void processPartitionQ();
- void updateGeom(F32 max_dtime);
- void updateGL();
- void rebuildPriorityGroups();
- void rebuildGroups();
- void clearRebuildGroups();
- void clearRebuildDrawables();
-
- //calculate pixel area of given box from vantage point of given camera
- static F32 calcPixelArea(LLVector3 center, LLVector3 size, LLCamera& camera);
- static F32 calcPixelArea(const LLVector4a& center, const LLVector4a& size, LLCamera &camera);
-
- void stateSort(LLCamera& camera, LLCullResult& result);
- void stateSort(LLSpatialGroup* group, LLCamera& camera);
- void stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_changed = FALSE);
- void stateSort(LLDrawable* drawablep, LLCamera& camera);
- void postSort(LLCamera& camera);
-
- void forAllVisibleDrawables(void (*func)(LLDrawable*));
+ void updateCull(LLCamera& camera, LLCullResult& result);
+ void createObjects(F32 max_dtime);
+ void createObject(LLViewerObject* vobj);
+ void processPartitionQ();
+ void updateGeom(F32 max_dtime);
+ void updateGL();
+ void rebuildPriorityGroups();
+ void rebuildGroups();
+ void clearRebuildGroups();
+ void clearRebuildDrawables();
+
+ //calculate pixel area of given box from vantage point of given camera
+ static F32 calcPixelArea(LLVector3 center, LLVector3 size, LLCamera& camera);
+ static F32 calcPixelArea(const LLVector4a& center, const LLVector4a& size, LLCamera &camera);
+
+ void stateSort(LLCamera& camera, LLCullResult& result);
+ void stateSort(LLSpatialGroup* group, LLCamera& camera);
+ void stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_changed = FALSE);
+ void stateSort(LLDrawable* drawablep, LLCamera& camera);
+ void postSort(LLCamera& camera);
+
+ void forAllVisibleDrawables(void (*func)(LLDrawable*));
void renderObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
void renderGLTFObjects(U32 type, bool texture = true, bool rigged = false);
-
+
void renderAlphaObjects(bool rigged = false);
- void renderMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
+ void renderMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
void renderFullbrightMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
- void renderGroups(LLRenderPass* pass, U32 type, bool texture);
+ void renderGroups(LLRenderPass* pass, U32 type, bool texture);
void renderRiggedGroups(LLRenderPass* pass, U32 type, bool texture);
- void grabReferences(LLCullResult& result);
- void clearReferences();
-
- //check references will assert that there are no references in sCullResult to the provided data
- void checkReferences(LLFace* face);
- void checkReferences(LLDrawable* drawable);
- void checkReferences(LLDrawInfo* draw_info);
- void checkReferences(LLSpatialGroup* group);
-
- void renderGeomDeferred(LLCamera& camera, bool do_occlusion = false);
- void renderGeomPostDeferred(LLCamera& camera);
- void renderGeomShadow(LLCamera& camera);
+ void grabReferences(LLCullResult& result);
+ void clearReferences();
+
+ //check references will assert that there are no references in sCullResult to the provided data
+ void checkReferences(LLFace* face);
+ void checkReferences(LLDrawable* drawable);
+ void checkReferences(LLDrawInfo* draw_info);
+ void checkReferences(LLSpatialGroup* group);
+
+ void renderGeomDeferred(LLCamera& camera, bool do_occlusion = false);
+ void renderGeomPostDeferred(LLCamera& camera);
+ void renderGeomShadow(LLCamera& camera);
void bindLightFunc(LLGLSLShader& shader);
// bind shadow maps
// if setup is true, wil lset texture compare mode function and filtering options
void bindShadowMaps(LLGLSLShader& shader);
void bindDeferredShaderFast(LLGLSLShader& shader);
- void bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_target = nullptr, LLRenderTarget* depth_target = nullptr);
- void setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep);
+ void bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_target = nullptr, LLRenderTarget* depth_target = nullptr);
+ void setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep);
- void unbindDeferredShader(LLGLSLShader& shader);
+ void unbindDeferredShader(LLGLSLShader& shader);
// set env_mat parameter in given shader
void setEnvMat(LLGLSLShader& shader);
@@ -317,10 +317,10 @@ public:
void bindReflectionProbes(LLGLSLShader& shader);
void unbindReflectionProbes(LLGLSLShader& shader);
- void renderDeferredLighting();
+ void renderDeferredLighting();
// apply atmospheric haze based on contents of color and depth buffer
- // should be called just before rendering water when camera is under water
+ // should be called just before rendering water when camera is under water
// and just before rendering alpha when camera is above water
void doAtmospherics();
@@ -328,366 +328,366 @@ public:
// should be called just before rendering pre-water alpha objects
void doWaterHaze();
- void postDeferredGammaCorrect(LLRenderTarget* screen_target);
+ void postDeferredGammaCorrect(LLRenderTarget* screen_target);
- void generateSunShadow(LLCamera& camera);
+ void generateSunShadow(LLCamera& camera);
LLRenderTarget* getSunShadowTarget(U32 i);
LLRenderTarget* getSpotShadowTarget(U32 i);
- void renderHighlight(const LLViewerObject* obj, F32 fade);
-
- void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, bool depth_clamp);
- void renderHighlights();
- void renderDebug();
- void renderPhysicsDisplay();
-
- void rebuildPools(); // Rebuild pools
-
- void findReferences(LLDrawable *drawablep); // Find the lists which have references to this object
- bool verify(); // Verify that all data in the pipeline is "correct"
-
- S32 getLightCount() const { return mLights.size(); }
-
- void calcNearbyLights(LLCamera& camera);
- void setupHWLights();
- void setupAvatarLights(bool for_edit = false);
- void enableLights(U32 mask);
- void enableLightsDynamic();
- void enableLightsAvatar();
- void enableLightsPreview();
- void enableLightsAvatarEdit(const LLColor4& color);
- void enableLightsFullbright();
- void disableLights();
-
- void shiftObjects(const LLVector3 &offset);
-
- void setLight(LLDrawable *drawablep, bool is_light);
-
- bool hasRenderBatches(const U32 type) const;
- LLCullResult::drawinfo_iterator beginRenderMap(U32 type);
- LLCullResult::drawinfo_iterator endRenderMap(U32 type);
- LLCullResult::sg_iterator beginAlphaGroups();
- LLCullResult::sg_iterator endAlphaGroups();
+ void renderHighlight(const LLViewerObject* obj, F32 fade);
+
+ void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, bool depth_clamp);
+ void renderHighlights();
+ void renderDebug();
+ void renderPhysicsDisplay();
+
+ void rebuildPools(); // Rebuild pools
+
+ void findReferences(LLDrawable *drawablep); // Find the lists which have references to this object
+ bool verify(); // Verify that all data in the pipeline is "correct"
+
+ S32 getLightCount() const { return mLights.size(); }
+
+ void calcNearbyLights(LLCamera& camera);
+ void setupHWLights();
+ void setupAvatarLights(bool for_edit = false);
+ void enableLights(U32 mask);
+ void enableLightsDynamic();
+ void enableLightsAvatar();
+ void enableLightsPreview();
+ void enableLightsAvatarEdit(const LLColor4& color);
+ void enableLightsFullbright();
+ void disableLights();
+
+ void shiftObjects(const LLVector3 &offset);
+
+ void setLight(LLDrawable *drawablep, bool is_light);
+
+ bool hasRenderBatches(const U32 type) const;
+ LLCullResult::drawinfo_iterator beginRenderMap(U32 type);
+ LLCullResult::drawinfo_iterator endRenderMap(U32 type);
+ LLCullResult::sg_iterator beginAlphaGroups();
+ LLCullResult::sg_iterator endAlphaGroups();
LLCullResult::sg_iterator beginRiggedAlphaGroups();
LLCullResult::sg_iterator endRiggedAlphaGroups();
-
- void addTrianglesDrawn(S32 index_count);
+
+ void addTrianglesDrawn(S32 index_count);
void recordTrianglesDrawn();
- bool hasRenderDebugFeatureMask(const U32 mask) const { return bool(mRenderDebugFeatureMask & mask); }
- bool hasRenderDebugMask(const U64 mask) const { return bool(mRenderDebugMask & mask); }
- void setAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0xffffffff; }
- void clearAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0x0; }
- void setAllRenderDebugDisplays() { mRenderDebugMask = 0xffffffffffffffff; }
- void clearAllRenderDebugDisplays() { mRenderDebugMask = 0x0; }
-
- bool hasRenderType(const U32 type) const;
- bool hasAnyRenderType(const U32 type, ...) const;
-
- static bool isWaterClip();
-
- void setRenderTypeMask(U32 type, ...);
- // This is equivalent to 'setRenderTypeMask'
- //void orRenderTypeMask(U32 type, ...);
- void andRenderTypeMask(U32 type, ...);
- void clearRenderTypeMask(U32 type, ...);
- void setAllRenderTypes();
- void clearAllRenderTypes();
-
- void pushRenderTypeMask();
- void popRenderTypeMask();
-
- void pushRenderDebugFeatureMask();
- void popRenderDebugFeatureMask();
-
- static void toggleRenderType(U32 type);
-
- // For UI control of render features
- static bool hasRenderTypeControl(U32 data);
- static void toggleRenderDebug(U64 data);
- static void toggleRenderDebugFeature(U32 data);
- static void toggleRenderTypeControl(U32 data);
- static bool toggleRenderTypeControlNegated(S32 data);
- static bool toggleRenderDebugControl(U64 data);
- static bool toggleRenderDebugFeatureControl(U32 data);
- static void setRenderDebugFeatureControl(U32 bit, bool value);
-
- static void setRenderParticleBeacons(bool val);
- static void toggleRenderParticleBeacons();
- static bool getRenderParticleBeacons();
-
- static void setRenderSoundBeacons(bool val);
- static void toggleRenderSoundBeacons();
- static bool getRenderSoundBeacons();
-
- static void setRenderMOAPBeacons(bool val);
- static void toggleRenderMOAPBeacons();
- static bool getRenderMOAPBeacons();
-
- static void setRenderPhysicalBeacons(bool val);
- static void toggleRenderPhysicalBeacons();
- static bool getRenderPhysicalBeacons();
-
- static void setRenderScriptedBeacons(bool val);
- static void toggleRenderScriptedBeacons();
- static bool getRenderScriptedBeacons();
-
- static void setRenderScriptedTouchBeacons(bool val);
- static void toggleRenderScriptedTouchBeacons();
- static bool getRenderScriptedTouchBeacons();
-
- static void setRenderBeacons(bool val);
- static void toggleRenderBeacons();
- static bool getRenderBeacons();
-
- static void setRenderHighlights(bool val);
- static void toggleRenderHighlights();
- static bool getRenderHighlights();
- static void setRenderHighlightTextureChannel(LLRender::eTexIndex channel); // sets which UV setup to display in highlight overlay
-
- static void updateRenderTransparentWater();
- static void refreshCachedSettings();
-
- void addDebugBlip(const LLVector3& position, const LLColor4& color);
-
- void hidePermanentObjects( std::vector<U32>& restoreList );
- void restorePermanentObjects( const std::vector<U32>& restoreList );
- void skipRenderingOfTerrain( bool flag );
- void hideObject( const LLUUID& id );
- void restoreHiddenObject( const LLUUID& id );
+ bool hasRenderDebugFeatureMask(const U32 mask) const { return bool(mRenderDebugFeatureMask & mask); }
+ bool hasRenderDebugMask(const U64 mask) const { return bool(mRenderDebugMask & mask); }
+ void setAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0xffffffff; }
+ void clearAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0x0; }
+ void setAllRenderDebugDisplays() { mRenderDebugMask = 0xffffffffffffffff; }
+ void clearAllRenderDebugDisplays() { mRenderDebugMask = 0x0; }
+
+ bool hasRenderType(const U32 type) const;
+ bool hasAnyRenderType(const U32 type, ...) const;
+
+ static bool isWaterClip();
+
+ void setRenderTypeMask(U32 type, ...);
+ // This is equivalent to 'setRenderTypeMask'
+ //void orRenderTypeMask(U32 type, ...);
+ void andRenderTypeMask(U32 type, ...);
+ void clearRenderTypeMask(U32 type, ...);
+ void setAllRenderTypes();
+ void clearAllRenderTypes();
+
+ void pushRenderTypeMask();
+ void popRenderTypeMask();
+
+ void pushRenderDebugFeatureMask();
+ void popRenderDebugFeatureMask();
+
+ static void toggleRenderType(U32 type);
+
+ // For UI control of render features
+ static bool hasRenderTypeControl(U32 data);
+ static void toggleRenderDebug(U64 data);
+ static void toggleRenderDebugFeature(U32 data);
+ static void toggleRenderTypeControl(U32 data);
+ static bool toggleRenderTypeControlNegated(S32 data);
+ static bool toggleRenderDebugControl(U64 data);
+ static bool toggleRenderDebugFeatureControl(U32 data);
+ static void setRenderDebugFeatureControl(U32 bit, bool value);
+
+ static void setRenderParticleBeacons(bool val);
+ static void toggleRenderParticleBeacons();
+ static bool getRenderParticleBeacons();
+
+ static void setRenderSoundBeacons(bool val);
+ static void toggleRenderSoundBeacons();
+ static bool getRenderSoundBeacons();
+
+ static void setRenderMOAPBeacons(bool val);
+ static void toggleRenderMOAPBeacons();
+ static bool getRenderMOAPBeacons();
+
+ static void setRenderPhysicalBeacons(bool val);
+ static void toggleRenderPhysicalBeacons();
+ static bool getRenderPhysicalBeacons();
+
+ static void setRenderScriptedBeacons(bool val);
+ static void toggleRenderScriptedBeacons();
+ static bool getRenderScriptedBeacons();
+
+ static void setRenderScriptedTouchBeacons(bool val);
+ static void toggleRenderScriptedTouchBeacons();
+ static bool getRenderScriptedTouchBeacons();
+
+ static void setRenderBeacons(bool val);
+ static void toggleRenderBeacons();
+ static bool getRenderBeacons();
+
+ static void setRenderHighlights(bool val);
+ static void toggleRenderHighlights();
+ static bool getRenderHighlights();
+ static void setRenderHighlightTextureChannel(LLRender::eTexIndex channel); // sets which UV setup to display in highlight overlay
+
+ static void updateRenderTransparentWater();
+ static void refreshCachedSettings();
+
+ void addDebugBlip(const LLVector3& position, const LLColor4& color);
+
+ void hidePermanentObjects( std::vector<U32>& restoreList );
+ void restorePermanentObjects( const std::vector<U32>& restoreList );
+ void skipRenderingOfTerrain( bool flag );
+ void hideObject( const LLUUID& id );
+ void restoreHiddenObject( const LLUUID& id );
void handleShadowDetailChanged();
LLReflectionMapManager mReflectionMapManager;
private:
- void unloadShaders();
- void addToQuickLookup( LLDrawPool* new_poolp );
- void removeFromQuickLookup( LLDrawPool* poolp );
- bool updateDrawableGeom(LLDrawable* drawable);
- void assertInitializedDoError();
- bool assertInitialized() { const bool is_init = isInit(); if (!is_init) assertInitializedDoError(); return is_init; };
- void connectRefreshCachedSettingsSafe(const std::string name);
- void hideDrawable( LLDrawable *pDrawable );
- void unhideDrawable( LLDrawable *pDrawable );
+ void unloadShaders();
+ void addToQuickLookup( LLDrawPool* new_poolp );
+ void removeFromQuickLookup( LLDrawPool* poolp );
+ bool updateDrawableGeom(LLDrawable* drawable);
+ void assertInitializedDoError();
+ bool assertInitialized() { const bool is_init = isInit(); if (!is_init) assertInitializedDoError(); return is_init; };
+ void connectRefreshCachedSettingsSafe(const std::string name);
+ void hideDrawable( LLDrawable *pDrawable );
+ void unhideDrawable( LLDrawable *pDrawable );
void skipRenderingShadows();
public:
- enum {GPU_CLASS_MAX = 3 };
-
- enum LLRenderTypeMask
- {
- // Following are pool types (some are also object types)
- RENDER_TYPE_SKY = LLDrawPool::POOL_SKY,
- RENDER_TYPE_WL_SKY = LLDrawPool::POOL_WL_SKY,
- RENDER_TYPE_TERRAIN = LLDrawPool::POOL_TERRAIN,
- RENDER_TYPE_SIMPLE = LLDrawPool::POOL_SIMPLE,
- RENDER_TYPE_GRASS = LLDrawPool::POOL_GRASS,
- RENDER_TYPE_ALPHA_MASK = LLDrawPool::POOL_ALPHA_MASK,
- RENDER_TYPE_FULLBRIGHT_ALPHA_MASK = LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK,
- RENDER_TYPE_FULLBRIGHT = LLDrawPool::POOL_FULLBRIGHT,
- RENDER_TYPE_BUMP = LLDrawPool::POOL_BUMP,
- RENDER_TYPE_MATERIALS = LLDrawPool::POOL_MATERIALS,
- RENDER_TYPE_AVATAR = LLDrawPool::POOL_AVATAR,
- RENDER_TYPE_CONTROL_AV = LLDrawPool::POOL_CONTROL_AV, // Animesh
- RENDER_TYPE_TREE = LLDrawPool::POOL_TREE,
- RENDER_TYPE_VOIDWATER = LLDrawPool::POOL_VOIDWATER,
- RENDER_TYPE_WATER = LLDrawPool::POOL_WATER,
+ enum {GPU_CLASS_MAX = 3 };
+
+ enum LLRenderTypeMask
+ {
+ // Following are pool types (some are also object types)
+ RENDER_TYPE_SKY = LLDrawPool::POOL_SKY,
+ RENDER_TYPE_WL_SKY = LLDrawPool::POOL_WL_SKY,
+ RENDER_TYPE_TERRAIN = LLDrawPool::POOL_TERRAIN,
+ RENDER_TYPE_SIMPLE = LLDrawPool::POOL_SIMPLE,
+ RENDER_TYPE_GRASS = LLDrawPool::POOL_GRASS,
+ RENDER_TYPE_ALPHA_MASK = LLDrawPool::POOL_ALPHA_MASK,
+ RENDER_TYPE_FULLBRIGHT_ALPHA_MASK = LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK,
+ RENDER_TYPE_FULLBRIGHT = LLDrawPool::POOL_FULLBRIGHT,
+ RENDER_TYPE_BUMP = LLDrawPool::POOL_BUMP,
+ RENDER_TYPE_MATERIALS = LLDrawPool::POOL_MATERIALS,
+ RENDER_TYPE_AVATAR = LLDrawPool::POOL_AVATAR,
+ RENDER_TYPE_CONTROL_AV = LLDrawPool::POOL_CONTROL_AV, // Animesh
+ RENDER_TYPE_TREE = LLDrawPool::POOL_TREE,
+ RENDER_TYPE_VOIDWATER = LLDrawPool::POOL_VOIDWATER,
+ RENDER_TYPE_WATER = LLDrawPool::POOL_WATER,
RENDER_TYPE_GLTF_PBR = LLDrawPool::POOL_GLTF_PBR,
RENDER_TYPE_GLTF_PBR_ALPHA_MASK = LLDrawPool::POOL_GLTF_PBR_ALPHA_MASK,
- RENDER_TYPE_ALPHA = LLDrawPool::POOL_ALPHA,
+ RENDER_TYPE_ALPHA = LLDrawPool::POOL_ALPHA,
RENDER_TYPE_ALPHA_PRE_WATER = LLDrawPool::POOL_ALPHA_PRE_WATER,
RENDER_TYPE_ALPHA_POST_WATER = LLDrawPool::POOL_ALPHA_POST_WATER,
- RENDER_TYPE_GLOW = LLDrawPool::POOL_GLOW,
- RENDER_TYPE_PASS_SIMPLE = LLRenderPass::PASS_SIMPLE,
+ RENDER_TYPE_GLOW = LLDrawPool::POOL_GLOW,
+ RENDER_TYPE_PASS_SIMPLE = LLRenderPass::PASS_SIMPLE,
RENDER_TYPE_PASS_SIMPLE_RIGGED = LLRenderPass::PASS_SIMPLE_RIGGED,
- RENDER_TYPE_PASS_GRASS = LLRenderPass::PASS_GRASS,
- RENDER_TYPE_PASS_FULLBRIGHT = LLRenderPass::PASS_FULLBRIGHT,
+ RENDER_TYPE_PASS_GRASS = LLRenderPass::PASS_GRASS,
+ RENDER_TYPE_PASS_FULLBRIGHT = LLRenderPass::PASS_FULLBRIGHT,
RENDER_TYPE_PASS_FULLBRIGHT_RIGGED = LLRenderPass::PASS_FULLBRIGHT_RIGGED,
- RENDER_TYPE_PASS_INVISIBLE = LLRenderPass::PASS_INVISIBLE,
+ RENDER_TYPE_PASS_INVISIBLE = LLRenderPass::PASS_INVISIBLE,
RENDER_TYPE_PASS_INVISIBLE_RIGGED = LLRenderPass::PASS_INVISIBLE_RIGGED,
- RENDER_TYPE_PASS_INVISI_SHINY = LLRenderPass::PASS_INVISI_SHINY,
+ RENDER_TYPE_PASS_INVISI_SHINY = LLRenderPass::PASS_INVISI_SHINY,
RENDER_TYPE_PASS_INVISI_SHINY_RIGGED = LLRenderPass::PASS_INVISI_SHINY_RIGGED,
- RENDER_TYPE_PASS_FULLBRIGHT_SHINY = LLRenderPass::PASS_FULLBRIGHT_SHINY,
+ RENDER_TYPE_PASS_FULLBRIGHT_SHINY = LLRenderPass::PASS_FULLBRIGHT_SHINY,
RENDER_TYPE_PASS_FULLBRIGHT_SHINY_RIGGED = LLRenderPass::PASS_FULLBRIGHT_SHINY_RIGGED,
- RENDER_TYPE_PASS_SHINY = LLRenderPass::PASS_SHINY,
+ RENDER_TYPE_PASS_SHINY = LLRenderPass::PASS_SHINY,
RENDER_TYPE_PASS_SHINY_RIGGED = LLRenderPass::PASS_SHINY_RIGGED,
- RENDER_TYPE_PASS_BUMP = LLRenderPass::PASS_BUMP,
+ RENDER_TYPE_PASS_BUMP = LLRenderPass::PASS_BUMP,
RENDER_TYPE_PASS_BUMP_RIGGED = LLRenderPass::PASS_BUMP_RIGGED,
- RENDER_TYPE_PASS_POST_BUMP = LLRenderPass::PASS_POST_BUMP,
+ RENDER_TYPE_PASS_POST_BUMP = LLRenderPass::PASS_POST_BUMP,
RENDER_TYPE_PASS_POST_BUMP_RIGGED = LLRenderPass::PASS_POST_BUMP_RIGGED,
- RENDER_TYPE_PASS_GLOW = LLRenderPass::PASS_GLOW,
+ RENDER_TYPE_PASS_GLOW = LLRenderPass::PASS_GLOW,
RENDER_TYPE_PASS_GLOW_RIGGED = LLRenderPass::PASS_GLOW_RIGGED,
RENDER_TYPE_PASS_GLTF_GLOW = LLRenderPass::PASS_GLTF_GLOW,
RENDER_TYPE_PASS_GLTF_GLOW_RIGGED = LLRenderPass::PASS_GLTF_GLOW_RIGGED,
- RENDER_TYPE_PASS_ALPHA = LLRenderPass::PASS_ALPHA,
- RENDER_TYPE_PASS_ALPHA_MASK = LLRenderPass::PASS_ALPHA_MASK,
+ RENDER_TYPE_PASS_ALPHA = LLRenderPass::PASS_ALPHA,
+ RENDER_TYPE_PASS_ALPHA_MASK = LLRenderPass::PASS_ALPHA_MASK,
RENDER_TYPE_PASS_ALPHA_MASK_RIGGED = LLRenderPass::PASS_ALPHA_MASK_RIGGED,
- RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK = LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK,
+ RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK = LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK,
RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK_RIGGED = LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED,
- RENDER_TYPE_PASS_MATERIAL = LLRenderPass::PASS_MATERIAL,
+ RENDER_TYPE_PASS_MATERIAL = LLRenderPass::PASS_MATERIAL,
RENDER_TYPE_PASS_MATERIAL_RIGGED = LLRenderPass::PASS_MATERIAL_RIGGED,
- RENDER_TYPE_PASS_MATERIAL_ALPHA = LLRenderPass::PASS_MATERIAL_ALPHA,
+ RENDER_TYPE_PASS_MATERIAL_ALPHA = LLRenderPass::PASS_MATERIAL_ALPHA,
RENDER_TYPE_PASS_MATERIAL_ALPHA_RIGGED = LLRenderPass::PASS_MATERIAL_ALPHA_RIGGED,
- RENDER_TYPE_PASS_MATERIAL_ALPHA_MASK = LLRenderPass::PASS_MATERIAL_ALPHA_MASK,
+ RENDER_TYPE_PASS_MATERIAL_ALPHA_MASK = LLRenderPass::PASS_MATERIAL_ALPHA_MASK,
RENDER_TYPE_PASS_MATERIAL_ALPHA_MASK_RIGGED = LLRenderPass::PASS_MATERIAL_ALPHA_MASK_RIGGED,
- RENDER_TYPE_PASS_MATERIAL_ALPHA_EMISSIVE= LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE,
+ RENDER_TYPE_PASS_MATERIAL_ALPHA_EMISSIVE= LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE,
RENDER_TYPE_PASS_MATERIAL_ALPHA_EMISSIVE_RIGGED = LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE_RIGGED,
- RENDER_TYPE_PASS_SPECMAP = LLRenderPass::PASS_SPECMAP,
+ RENDER_TYPE_PASS_SPECMAP = LLRenderPass::PASS_SPECMAP,
RENDER_TYPE_PASS_SPECMAP_RIGGED = LLRenderPass::PASS_SPECMAP_RIGGED,
- RENDER_TYPE_PASS_SPECMAP_BLEND = LLRenderPass::PASS_SPECMAP_BLEND,
+ RENDER_TYPE_PASS_SPECMAP_BLEND = LLRenderPass::PASS_SPECMAP_BLEND,
RENDER_TYPE_PASS_SPECMAP_BLEND_RIGGED = LLRenderPass::PASS_SPECMAP_BLEND_RIGGED,
- RENDER_TYPE_PASS_SPECMAP_MASK = LLRenderPass::PASS_SPECMAP_MASK,
+ RENDER_TYPE_PASS_SPECMAP_MASK = LLRenderPass::PASS_SPECMAP_MASK,
RENDER_TYPE_PASS_SPECMAP_MASK_RIGGED = LLRenderPass::PASS_SPECMAP_MASK_RIGGED,
- RENDER_TYPE_PASS_SPECMAP_EMISSIVE = LLRenderPass::PASS_SPECMAP_EMISSIVE,
+ RENDER_TYPE_PASS_SPECMAP_EMISSIVE = LLRenderPass::PASS_SPECMAP_EMISSIVE,
RENDER_TYPE_PASS_SPECMAP_EMISSIVE_RIGGED = LLRenderPass::PASS_SPECMAP_EMISSIVE_RIGGED,
- RENDER_TYPE_PASS_NORMMAP = LLRenderPass::PASS_NORMMAP,
+ RENDER_TYPE_PASS_NORMMAP = LLRenderPass::PASS_NORMMAP,
RENDER_TYPE_PASS_NORMMAP_RIGGED = LLRenderPass::PASS_NORMMAP_RIGGED,
- RENDER_TYPE_PASS_NORMMAP_BLEND = LLRenderPass::PASS_NORMMAP_BLEND,
+ RENDER_TYPE_PASS_NORMMAP_BLEND = LLRenderPass::PASS_NORMMAP_BLEND,
RENDER_TYPE_PASS_NORMMAP_BLEND_RIGGED = LLRenderPass::PASS_NORMMAP_BLEND_RIGGED,
- RENDER_TYPE_PASS_NORMMAP_MASK = LLRenderPass::PASS_NORMMAP_MASK,
+ RENDER_TYPE_PASS_NORMMAP_MASK = LLRenderPass::PASS_NORMMAP_MASK,
RENDER_TYPE_PASS_NORMMAP_MASK_RIGGED = LLRenderPass::PASS_NORMMAP_MASK_RIGGED,
- RENDER_TYPE_PASS_NORMMAP_EMISSIVE = LLRenderPass::PASS_NORMMAP_EMISSIVE,
+ RENDER_TYPE_PASS_NORMMAP_EMISSIVE = LLRenderPass::PASS_NORMMAP_EMISSIVE,
RENDER_TYPE_PASS_NORMMAP_EMISSIVE_RIGGED = LLRenderPass::PASS_NORMMAP_EMISSIVE_RIGGED,
- RENDER_TYPE_PASS_NORMSPEC = LLRenderPass::PASS_NORMSPEC,
+ RENDER_TYPE_PASS_NORMSPEC = LLRenderPass::PASS_NORMSPEC,
RENDER_TYPE_PASS_NORMSPEC_RIGGED = LLRenderPass::PASS_NORMSPEC_RIGGED,
- RENDER_TYPE_PASS_NORMSPEC_BLEND = LLRenderPass::PASS_NORMSPEC_BLEND,
+ RENDER_TYPE_PASS_NORMSPEC_BLEND = LLRenderPass::PASS_NORMSPEC_BLEND,
RENDER_TYPE_PASS_NORMSPEC_BLEND_RIGGED = LLRenderPass::PASS_NORMSPEC_BLEND_RIGGED,
- RENDER_TYPE_PASS_NORMSPEC_MASK = LLRenderPass::PASS_NORMSPEC_MASK,
+ RENDER_TYPE_PASS_NORMSPEC_MASK = LLRenderPass::PASS_NORMSPEC_MASK,
RENDER_TYPE_PASS_NORMSPEC_MASK_RIGGED = LLRenderPass::PASS_NORMSPEC_MASK_RIGGED,
- RENDER_TYPE_PASS_NORMSPEC_EMISSIVE = LLRenderPass::PASS_NORMSPEC_EMISSIVE,
+ RENDER_TYPE_PASS_NORMSPEC_EMISSIVE = LLRenderPass::PASS_NORMSPEC_EMISSIVE,
RENDER_TYPE_PASS_NORMSPEC_EMISSIVE_RIGGED = LLRenderPass::PASS_NORMSPEC_EMISSIVE_RIGGED,
RENDER_TYPE_PASS_GLTF_PBR = LLRenderPass::PASS_GLTF_PBR,
RENDER_TYPE_PASS_GLTF_PBR_RIGGED = LLRenderPass::PASS_GLTF_PBR_RIGGED,
RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK = LLRenderPass::PASS_GLTF_PBR_ALPHA_MASK,
RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK_RIGGED = LLRenderPass::PASS_GLTF_PBR_ALPHA_MASK_RIGGED,
- // Following are object types (only used in drawable mRenderType)
- RENDER_TYPE_HUD = LLRenderPass::NUM_RENDER_TYPES,
- RENDER_TYPE_VOLUME,
- RENDER_TYPE_PARTICLES,
- RENDER_TYPE_CLOUDS,
- RENDER_TYPE_HUD_PARTICLES,
- NUM_RENDER_TYPES,
- END_RENDER_TYPES = NUM_RENDER_TYPES
- };
-
- enum LLRenderDebugFeatureMask
- {
- RENDER_DEBUG_FEATURE_UI = 0x0001,
- RENDER_DEBUG_FEATURE_SELECTED = 0x0002,
- RENDER_DEBUG_FEATURE_HIGHLIGHTED = 0x0004,
- RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES = 0x0008,
-// RENDER_DEBUG_FEATURE_HW_LIGHTING = 0x0010,
- RENDER_DEBUG_FEATURE_FLEXIBLE = 0x0010,
- RENDER_DEBUG_FEATURE_FOG = 0x0020,
- RENDER_DEBUG_FEATURE_FR_INFO = 0x0080,
- RENDER_DEBUG_FEATURE_FOOT_SHADOWS = 0x0100,
- };
-
- enum LLRenderDebugMask: U64
- {
- RENDER_DEBUG_COMPOSITION = 0x00000001,
- RENDER_DEBUG_VERIFY = 0x00000002,
- RENDER_DEBUG_BBOXES = 0x00000004,
- RENDER_DEBUG_OCTREE = 0x00000008,
- RENDER_DEBUG_WIND_VECTORS = 0x00000010,
- RENDER_DEBUG_OCCLUSION = 0x00000020,
- RENDER_DEBUG_POINTS = 0x00000040,
- RENDER_DEBUG_TEXTURE_PRIORITY = 0x00000080,
- RENDER_DEBUG_TEXTURE_AREA = 0x00000100,
- RENDER_DEBUG_FACE_AREA = 0x00000200,
- RENDER_DEBUG_PARTICLES = 0x00000400,
- RENDER_DEBUG_GLOW = 0x00000800, // not used
- RENDER_DEBUG_TEXTURE_ANIM = 0x00001000,
- RENDER_DEBUG_LIGHTS = 0x00002000,
- RENDER_DEBUG_BATCH_SIZE = 0x00004000,
- RENDER_DEBUG_ALPHA_BINS = 0x00008000, // not used
- RENDER_DEBUG_RAYCAST = 0x00010000,
- RENDER_DEBUG_AVATAR_DRAW_INFO = 0x00020000,
- RENDER_DEBUG_SHADOW_FRUSTA = 0x00040000,
- RENDER_DEBUG_SCULPTED = 0x00080000,
- RENDER_DEBUG_AVATAR_VOLUME = 0x00100000,
- RENDER_DEBUG_AVATAR_JOINTS = 0x00200000,
- RENDER_DEBUG_AGENT_TARGET = 0x00800000,
- RENDER_DEBUG_UPDATE_TYPE = 0x01000000,
- RENDER_DEBUG_PHYSICS_SHAPES = 0x02000000,
- RENDER_DEBUG_NORMALS = 0x04000000,
- RENDER_DEBUG_LOD_INFO = 0x08000000,
- RENDER_DEBUG_ATTACHMENT_BYTES = 0x20000000, // not used
- RENDER_DEBUG_TEXEL_DENSITY = 0x40000000,
- RENDER_DEBUG_TRIANGLE_COUNT = 0x80000000,
- RENDER_DEBUG_IMPOSTORS = 0x100000000,
+ // Following are object types (only used in drawable mRenderType)
+ RENDER_TYPE_HUD = LLRenderPass::NUM_RENDER_TYPES,
+ RENDER_TYPE_VOLUME,
+ RENDER_TYPE_PARTICLES,
+ RENDER_TYPE_CLOUDS,
+ RENDER_TYPE_HUD_PARTICLES,
+ NUM_RENDER_TYPES,
+ END_RENDER_TYPES = NUM_RENDER_TYPES
+ };
+
+ enum LLRenderDebugFeatureMask
+ {
+ RENDER_DEBUG_FEATURE_UI = 0x0001,
+ RENDER_DEBUG_FEATURE_SELECTED = 0x0002,
+ RENDER_DEBUG_FEATURE_HIGHLIGHTED = 0x0004,
+ RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES = 0x0008,
+// RENDER_DEBUG_FEATURE_HW_LIGHTING = 0x0010,
+ RENDER_DEBUG_FEATURE_FLEXIBLE = 0x0010,
+ RENDER_DEBUG_FEATURE_FOG = 0x0020,
+ RENDER_DEBUG_FEATURE_FR_INFO = 0x0080,
+ RENDER_DEBUG_FEATURE_FOOT_SHADOWS = 0x0100,
+ };
+
+ enum LLRenderDebugMask: U64
+ {
+ RENDER_DEBUG_COMPOSITION = 0x00000001,
+ RENDER_DEBUG_VERIFY = 0x00000002,
+ RENDER_DEBUG_BBOXES = 0x00000004,
+ RENDER_DEBUG_OCTREE = 0x00000008,
+ RENDER_DEBUG_WIND_VECTORS = 0x00000010,
+ RENDER_DEBUG_OCCLUSION = 0x00000020,
+ RENDER_DEBUG_POINTS = 0x00000040,
+ RENDER_DEBUG_TEXTURE_PRIORITY = 0x00000080,
+ RENDER_DEBUG_TEXTURE_AREA = 0x00000100,
+ RENDER_DEBUG_FACE_AREA = 0x00000200,
+ RENDER_DEBUG_PARTICLES = 0x00000400,
+ RENDER_DEBUG_GLOW = 0x00000800, // not used
+ RENDER_DEBUG_TEXTURE_ANIM = 0x00001000,
+ RENDER_DEBUG_LIGHTS = 0x00002000,
+ RENDER_DEBUG_BATCH_SIZE = 0x00004000,
+ RENDER_DEBUG_ALPHA_BINS = 0x00008000, // not used
+ RENDER_DEBUG_RAYCAST = 0x00010000,
+ RENDER_DEBUG_AVATAR_DRAW_INFO = 0x00020000,
+ RENDER_DEBUG_SHADOW_FRUSTA = 0x00040000,
+ RENDER_DEBUG_SCULPTED = 0x00080000,
+ RENDER_DEBUG_AVATAR_VOLUME = 0x00100000,
+ RENDER_DEBUG_AVATAR_JOINTS = 0x00200000,
+ RENDER_DEBUG_AGENT_TARGET = 0x00800000,
+ RENDER_DEBUG_UPDATE_TYPE = 0x01000000,
+ RENDER_DEBUG_PHYSICS_SHAPES = 0x02000000,
+ RENDER_DEBUG_NORMALS = 0x04000000,
+ RENDER_DEBUG_LOD_INFO = 0x08000000,
+ RENDER_DEBUG_ATTACHMENT_BYTES = 0x20000000, // not used
+ RENDER_DEBUG_TEXEL_DENSITY = 0x40000000,
+ RENDER_DEBUG_TRIANGLE_COUNT = 0x80000000,
+ RENDER_DEBUG_IMPOSTORS = 0x100000000,
RENDER_DEBUG_REFLECTION_PROBES = 0x200000000,
RENDER_DEBUG_PROBE_UPDATES = 0x400000000
- };
+ };
public:
-
- LLSpatialPartition* getSpatialPartition(LLViewerObject* vobj);
-
- void updateCamera(bool reset = false);
-
- LLVector3 mFlyCamPosition;
- LLQuaternion mFlyCamRotation;
-
- bool mBackfaceCull;
- S32 mMatrixOpCount;
- S32 mTextureMatrixOps;
- S32 mNumVisibleNodes;
-
- S32 mDebugTextureUploadCost;
- S32 mDebugSculptUploadCost;
- S32 mDebugMeshUploadCost;
-
- S32 mNumVisibleFaces;
-
- S32 mPoissonOffset;
-
- static S32 sCompiles;
-
- static bool sShowHUDAttachments;
- static bool sForceOldBakedUpload; // If true will not use capabilities to upload baked textures.
- static S32 sUseOcclusion; // 0 = no occlusion, 1 = read only, 2 = read/write
- static bool sAutoMaskAlphaDeferred;
- static bool sAutoMaskAlphaNonDeferred;
- static bool sRenderTransparentWater;
- static bool sBakeSunlight;
- static bool sNoAlpha;
- static bool sUseFarClip;
- static bool sShadowRender;
- static bool sDynamicLOD;
- static bool sPickAvatar;
- static bool sReflectionRender;
- static bool sDistortionRender;
- static bool sImpostorRender;
- static bool sImpostorRenderAlphaDepthPass;
- static bool sUnderWaterRender;
- static bool sRenderGlow;
- static bool sTextureBindTest;
- static bool sRenderAttachedLights;
- static bool sRenderAttachedParticles;
- static bool sRenderDeferred;
- static bool sReflectionProbesEnabled;
- static S32 sVisibleLightCount;
- static bool sRenderingHUDs;
+
+ LLSpatialPartition* getSpatialPartition(LLViewerObject* vobj);
+
+ void updateCamera(bool reset = false);
+
+ LLVector3 mFlyCamPosition;
+ LLQuaternion mFlyCamRotation;
+
+ bool mBackfaceCull;
+ S32 mMatrixOpCount;
+ S32 mTextureMatrixOps;
+ S32 mNumVisibleNodes;
+
+ S32 mDebugTextureUploadCost;
+ S32 mDebugSculptUploadCost;
+ S32 mDebugMeshUploadCost;
+
+ S32 mNumVisibleFaces;
+
+ S32 mPoissonOffset;
+
+ static S32 sCompiles;
+
+ static bool sShowHUDAttachments;
+ static bool sForceOldBakedUpload; // If true will not use capabilities to upload baked textures.
+ static S32 sUseOcclusion; // 0 = no occlusion, 1 = read only, 2 = read/write
+ static bool sAutoMaskAlphaDeferred;
+ static bool sAutoMaskAlphaNonDeferred;
+ static bool sRenderTransparentWater;
+ static bool sBakeSunlight;
+ static bool sNoAlpha;
+ static bool sUseFarClip;
+ static bool sShadowRender;
+ static bool sDynamicLOD;
+ static bool sPickAvatar;
+ static bool sReflectionRender;
+ static bool sDistortionRender;
+ static bool sImpostorRender;
+ static bool sImpostorRenderAlphaDepthPass;
+ static bool sUnderWaterRender;
+ static bool sRenderGlow;
+ static bool sTextureBindTest;
+ static bool sRenderAttachedLights;
+ static bool sRenderAttachedParticles;
+ static bool sRenderDeferred;
+ static bool sReflectionProbesEnabled;
+ static S32 sVisibleLightCount;
+ static bool sRenderingHUDs;
static F32 sDistortionWaterClipPlaneMargin;
- static LLTrace::EventStatHandle<S64> sStatBatchSize;
+ static LLTrace::EventStatHandle<S64> sStatBatchSize;
class RenderTargetPack
{
public:
- U32 width = 0;
- U32 height = 0;
+ U32 width = 0;
+ U32 height = 0;
//screen texture
- LLRenderTarget screen;
- LLRenderTarget uiScreen;
- LLRenderTarget deferredScreen;
- LLRenderTarget fxaaBuffer;
- LLRenderTarget edgeMap;
- LLRenderTarget deferredLight;
+ LLRenderTarget screen;
+ LLRenderTarget uiScreen;
+ LLRenderTarget deferredScreen;
+ LLRenderTarget fxaaBuffer;
+ LLRenderTarget edgeMap;
+ LLRenderTarget deferredLight;
//sun shadow map
- LLRenderTarget shadow[4];
+ LLRenderTarget shadow[4];
};
// main full resoltuion render target
@@ -719,334 +719,334 @@ public:
LLCullResult mReflectedObjects;
LLCullResult mRefractedObjects;
- //utility buffers for rendering post effects
- LLPointer<LLVertexBuffer> mDeferredVB;
+ //utility buffers for rendering post effects
+ LLPointer<LLVertexBuffer> mDeferredVB;
// a single triangle that covers the whole screen
LLPointer<LLVertexBuffer> mScreenTriangleVB;
- //utility buffer for rendering cubes, 8 vertices are corners of a cube [-1, 1]
- LLPointer<LLVertexBuffer> mCubeVB;
+ //utility buffer for rendering cubes, 8 vertices are corners of a cube [-1, 1]
+ LLPointer<LLVertexBuffer> mCubeVB;
//list of currently bound reflection maps
std::vector<LLReflectionMap*> mReflectionMaps;
- std::vector<LLVector3> mShadowFrustPoints[4];
- LLVector4 mShadowError;
- LLVector4 mShadowFOV;
- LLVector3 mShadowFrustOrigin[4];
- LLCamera mShadowCamera[8];
- LLVector3 mShadowExtents[4][2];
+ std::vector<LLVector3> mShadowFrustPoints[4];
+ LLVector4 mShadowError;
+ LLVector4 mShadowFOV;
+ LLVector3 mShadowFrustOrigin[4];
+ LLCamera mShadowCamera[8];
+ LLVector3 mShadowExtents[4][2];
// TODO : separate Sun Shadow and Spot Shadow matrices
- glh::matrix4f mSunShadowMatrix[6];
- glh::matrix4f mShadowModelview[6];
- glh::matrix4f mShadowProjection[6];
+ glh::matrix4f mSunShadowMatrix[6];
+ glh::matrix4f mShadowModelview[6];
+ glh::matrix4f mShadowProjection[6];
glh::matrix4f mReflectionModelView;
- LLPointer<LLDrawable> mShadowSpotLight[2];
- F32 mSpotLightFade[2];
- LLPointer<LLDrawable> mTargetShadowSpotLight[2];
+ LLPointer<LLDrawable> mShadowSpotLight[2];
+ F32 mSpotLightFade[2];
+ LLPointer<LLDrawable> mTargetShadowSpotLight[2];
- LLVector4 mSunClipPlanes;
- LLVector4 mSunOrthoClipPlanes;
- LLVector2 mScreenScale;
+ LLVector4 mSunClipPlanes;
+ LLVector4 mSunOrthoClipPlanes;
+ LLVector2 mScreenScale;
- //water distortion texture (refraction)
- LLRenderTarget mWaterDis;
+ //water distortion texture (refraction)
+ LLRenderTarget mWaterDis;
- LLRenderTarget mBake;
+ LLRenderTarget mBake;
- //texture for making the glow
- LLRenderTarget mGlow[3];
+ //texture for making the glow
+ LLRenderTarget mGlow[3];
- //noise map
- U32 mNoiseMap;
- U32 mTrueNoiseMap;
- U32 mLightFunc;
+ //noise map
+ U32 mNoiseMap;
+ U32 mTrueNoiseMap;
+ U32 mLightFunc;
- LLColor4 mSunDiffuse;
- LLColor4 mMoonDiffuse;
- LLVector4 mSunDir;
- LLVector4 mMoonDir;
+ LLColor4 mSunDiffuse;
+ LLColor4 mMoonDiffuse;
+ LLVector4 mSunDir;
+ LLVector4 mMoonDir;
bool mNeedsShadowTargetClear;
- LLVector4 mTransformedSunDir;
- LLVector4 mTransformedMoonDir;
+ LLVector4 mTransformedSunDir;
+ LLVector4 mTransformedMoonDir;
- bool mInitialized;
- bool mShadersLoaded;
+ bool mInitialized;
+ bool mShadersLoaded;
- U32 mTransformFeedbackPrimitives; //number of primitives expected to be generated by transform feedback
+ U32 mTransformFeedbackPrimitives; //number of primitives expected to be generated by transform feedback
protected:
- bool mRenderTypeEnabled[NUM_RENDER_TYPES];
- std::stack<std::string> mRenderTypeEnableStack;
-
- U32 mRenderDebugFeatureMask;
- U64 mRenderDebugMask;
- U64 mOldRenderDebugMask;
- std::stack<U32> mRenderDebugFeatureStack;
-
- /////////////////////////////////////////////
- //
- //
- LLDrawable::drawable_vector_t mMovedList;
- LLDrawable::drawable_vector_t mMovedBridge;
- LLDrawable::drawable_vector_t mShiftList;
-
- /////////////////////////////////////////////
- //
- //
- struct Light
- {
- Light(LLDrawable* ptr, F32 d, F32 f = 0.0f)
- : drawable(ptr),
- dist(d),
- fade(f)
- {}
- LLPointer<LLDrawable> drawable;
- F32 dist;
- F32 fade;
- struct compare
- {
- bool operator()(const Light& a, const Light& b) const
- {
- if ( a.dist < b.dist )
- return true;
- else if ( a.dist > b.dist )
- return false;
- else
- return a.drawable < b.drawable;
- }
- };
- };
- typedef std::set< Light, Light::compare > light_set_t;
-
- LLDrawable::ordered_drawable_set_t mLights;
- light_set_t mNearbyLights; // lights near camera
- LLColor4 mHWLightColors[8];
-
- /////////////////////////////////////////////
- //
- // Different queues of drawables being processed.
- //
- LLDrawable::drawable_list_t mBuildQ1; // priority
- LLSpatialGroup::sg_vector_t mGroupQ1; //priority
-
- LLSpatialGroup::sg_vector_t mGroupSaveQ1; // a place to save mGroupQ1 until it is safe to unref
-
- LLSpatialGroup::sg_vector_t mMeshDirtyGroup; //groups that need rebuildMesh called
- U32 mMeshDirtyQueryObject;
-
- LLDrawable::drawable_list_t mPartitionQ; //drawables that need to update their spatial partition radius
-
- bool mGroupQ1Locked;
-
- bool mResetVertexBuffers; //if true, clear vertex buffers on next update
-
- LLViewerObject::vobj_list_t mCreateQ;
-
- LLDrawable::drawable_set_t mRetexturedList;
-
- class HighlightItem
- {
- public:
- const LLPointer<LLDrawable> mItem;
- mutable F32 mFade;
-
- HighlightItem(LLDrawable* item)
- : mItem(item), mFade(0)
- {
- }
-
- bool operator<(const HighlightItem& rhs) const
- {
- return mItem < rhs.mItem;
- }
-
- bool operator==(const HighlightItem& rhs) const
- {
- return mItem == rhs.mItem;
- }
-
- void incrFade(F32 val) const
- {
- mFade = llclamp(mFade+val, 0.f, 1.f);
- }
- };
-
- //////////////////////////////////////////////////
- //
- // Draw pools are responsible for storing all rendered data,
- // and performing the actual rendering of objects.
- //
- struct compare_pools
- {
- bool operator()(const LLDrawPool* a, const LLDrawPool* b) const
- {
- if (!a)
- return true;
- else if (!b)
- return false;
- else
- {
- S32 atype = a->getType();
- S32 btype = b->getType();
- if (atype < btype)
- return true;
- else if (atype > btype)
- return false;
- else
- return a->getId() < b->getId();
- }
- }
- };
- typedef std::set<LLDrawPool*, compare_pools > pool_set_t;
- pool_set_t mPools;
- LLDrawPool* mLastRebuildPool;
-
- // For quick-lookups into mPools (mapped by texture pointer)
- std::map<uintptr_t, LLDrawPool*> mTerrainPools;
- std::map<uintptr_t, LLDrawPool*> mTreePools;
- LLDrawPoolAlpha* mAlphaPoolPreWater = nullptr;
+ bool mRenderTypeEnabled[NUM_RENDER_TYPES];
+ std::stack<std::string> mRenderTypeEnableStack;
+
+ U32 mRenderDebugFeatureMask;
+ U64 mRenderDebugMask;
+ U64 mOldRenderDebugMask;
+ std::stack<U32> mRenderDebugFeatureStack;
+
+ /////////////////////////////////////////////
+ //
+ //
+ LLDrawable::drawable_vector_t mMovedList;
+ LLDrawable::drawable_vector_t mMovedBridge;
+ LLDrawable::drawable_vector_t mShiftList;
+
+ /////////////////////////////////////////////
+ //
+ //
+ struct Light
+ {
+ Light(LLDrawable* ptr, F32 d, F32 f = 0.0f)
+ : drawable(ptr),
+ dist(d),
+ fade(f)
+ {}
+ LLPointer<LLDrawable> drawable;
+ F32 dist;
+ F32 fade;
+ struct compare
+ {
+ bool operator()(const Light& a, const Light& b) const
+ {
+ if ( a.dist < b.dist )
+ return true;
+ else if ( a.dist > b.dist )
+ return false;
+ else
+ return a.drawable < b.drawable;
+ }
+ };
+ };
+ typedef std::set< Light, Light::compare > light_set_t;
+
+ LLDrawable::ordered_drawable_set_t mLights;
+ light_set_t mNearbyLights; // lights near camera
+ LLColor4 mHWLightColors[8];
+
+ /////////////////////////////////////////////
+ //
+ // Different queues of drawables being processed.
+ //
+ LLDrawable::drawable_list_t mBuildQ1; // priority
+ LLSpatialGroup::sg_vector_t mGroupQ1; //priority
+
+ LLSpatialGroup::sg_vector_t mGroupSaveQ1; // a place to save mGroupQ1 until it is safe to unref
+
+ LLSpatialGroup::sg_vector_t mMeshDirtyGroup; //groups that need rebuildMesh called
+ U32 mMeshDirtyQueryObject;
+
+ LLDrawable::drawable_list_t mPartitionQ; //drawables that need to update their spatial partition radius
+
+ bool mGroupQ1Locked;
+
+ bool mResetVertexBuffers; //if true, clear vertex buffers on next update
+
+ LLViewerObject::vobj_list_t mCreateQ;
+
+ LLDrawable::drawable_set_t mRetexturedList;
+
+ class HighlightItem
+ {
+ public:
+ const LLPointer<LLDrawable> mItem;
+ mutable F32 mFade;
+
+ HighlightItem(LLDrawable* item)
+ : mItem(item), mFade(0)
+ {
+ }
+
+ bool operator<(const HighlightItem& rhs) const
+ {
+ return mItem < rhs.mItem;
+ }
+
+ bool operator==(const HighlightItem& rhs) const
+ {
+ return mItem == rhs.mItem;
+ }
+
+ void incrFade(F32 val) const
+ {
+ mFade = llclamp(mFade+val, 0.f, 1.f);
+ }
+ };
+
+ //////////////////////////////////////////////////
+ //
+ // Draw pools are responsible for storing all rendered data,
+ // and performing the actual rendering of objects.
+ //
+ struct compare_pools
+ {
+ bool operator()(const LLDrawPool* a, const LLDrawPool* b) const
+ {
+ if (!a)
+ return true;
+ else if (!b)
+ return false;
+ else
+ {
+ S32 atype = a->getType();
+ S32 btype = b->getType();
+ if (atype < btype)
+ return true;
+ else if (atype > btype)
+ return false;
+ else
+ return a->getId() < b->getId();
+ }
+ }
+ };
+ typedef std::set<LLDrawPool*, compare_pools > pool_set_t;
+ pool_set_t mPools;
+ LLDrawPool* mLastRebuildPool;
+
+ // For quick-lookups into mPools (mapped by texture pointer)
+ std::map<uintptr_t, LLDrawPool*> mTerrainPools;
+ std::map<uintptr_t, LLDrawPool*> mTreePools;
+ LLDrawPoolAlpha* mAlphaPoolPreWater = nullptr;
LLDrawPoolAlpha* mAlphaPoolPostWater = nullptr;
- LLDrawPool* mSkyPool = nullptr;
- LLDrawPool* mTerrainPool = nullptr;
- LLDrawPool* mWaterPool = nullptr;
- LLRenderPass* mSimplePool = nullptr;
- LLRenderPass* mGrassPool = nullptr;
- LLRenderPass* mAlphaMaskPool = nullptr;
- LLRenderPass* mFullbrightAlphaMaskPool = nullptr;
- LLRenderPass* mFullbrightPool = nullptr;
- LLDrawPool* mGlowPool = nullptr;
- LLDrawPool* mBumpPool = nullptr;
- LLDrawPool* mMaterialsPool = nullptr;
- LLDrawPool* mWLSkyPool = nullptr;
- LLDrawPool* mPBROpaquePool = nullptr;
+ LLDrawPool* mSkyPool = nullptr;
+ LLDrawPool* mTerrainPool = nullptr;
+ LLDrawPool* mWaterPool = nullptr;
+ LLRenderPass* mSimplePool = nullptr;
+ LLRenderPass* mGrassPool = nullptr;
+ LLRenderPass* mAlphaMaskPool = nullptr;
+ LLRenderPass* mFullbrightAlphaMaskPool = nullptr;
+ LLRenderPass* mFullbrightPool = nullptr;
+ LLDrawPool* mGlowPool = nullptr;
+ LLDrawPool* mBumpPool = nullptr;
+ LLDrawPool* mMaterialsPool = nullptr;
+ LLDrawPool* mWLSkyPool = nullptr;
+ LLDrawPool* mPBROpaquePool = nullptr;
LLDrawPool* mPBRAlphaMaskPool = nullptr;
- // Note: no need to keep an quick-lookup to avatar pools, since there's only one per avatar
-
+ // Note: no need to keep an quick-lookup to avatar pools, since there's only one per avatar
+
public:
- std::vector<LLFace*> mHighlightFaces; // highlight faces on physical objects
+ std::vector<LLFace*> mHighlightFaces; // highlight faces on physical objects
protected:
- std::vector<LLFace*> mSelectedFaces;
-
- class DebugBlip
- {
- public:
- LLColor4 mColor;
- LLVector3 mPosition;
- F32 mAge;
-
- DebugBlip(const LLVector3& position, const LLColor4& color)
- : mColor(color), mPosition(position), mAge(0.f)
- { }
- };
-
- std::list<DebugBlip> mDebugBlips;
-
- LLPointer<LLViewerFetchedTexture> mFaceSelectImagep;
-
- U32 mLightMask;
- U32 mLightMovingMask;
-
- static bool sRenderPhysicalBeacons;
- static bool sRenderMOAPBeacons;
- static bool sRenderScriptedTouchBeacons;
- static bool sRenderScriptedBeacons;
- static bool sRenderParticleBeacons;
- static bool sRenderSoundBeacons;
+ std::vector<LLFace*> mSelectedFaces;
+
+ class DebugBlip
+ {
+ public:
+ LLColor4 mColor;
+ LLVector3 mPosition;
+ F32 mAge;
+
+ DebugBlip(const LLVector3& position, const LLColor4& color)
+ : mColor(color), mPosition(position), mAge(0.f)
+ { }
+ };
+
+ std::list<DebugBlip> mDebugBlips;
+
+ LLPointer<LLViewerFetchedTexture> mFaceSelectImagep;
+
+ U32 mLightMask;
+ U32 mLightMovingMask;
+
+ static bool sRenderPhysicalBeacons;
+ static bool sRenderMOAPBeacons;
+ static bool sRenderScriptedTouchBeacons;
+ static bool sRenderScriptedBeacons;
+ static bool sRenderParticleBeacons;
+ static bool sRenderSoundBeacons;
public:
- static bool sRenderBeacons;
- static bool sRenderHighlight;
-
- // Determines which set of UVs to use in highlight display
- //
- static LLRender::eTexIndex sRenderHighlightTextureChannel;
-
- //debug use
- static U32 sCurRenderPoolType ;
-
- //cached settings
- static bool WindLightUseAtmosShaders;
- static bool RenderDeferred;
- static F32 RenderDeferredSunWash;
- static U32 RenderFSAASamples;
- static U32 RenderResolutionDivisor;
- static bool RenderUIBuffer;
- static S32 RenderShadowDetail;
+ static bool sRenderBeacons;
+ static bool sRenderHighlight;
+
+ // Determines which set of UVs to use in highlight display
+ //
+ static LLRender::eTexIndex sRenderHighlightTextureChannel;
+
+ //debug use
+ static U32 sCurRenderPoolType ;
+
+ //cached settings
+ static bool WindLightUseAtmosShaders;
+ static bool RenderDeferred;
+ static F32 RenderDeferredSunWash;
+ static U32 RenderFSAASamples;
+ static U32 RenderResolutionDivisor;
+ static bool RenderUIBuffer;
+ static S32 RenderShadowDetail;
static S32 RenderShadowSplits;
- static bool RenderDeferredSSAO;
- static F32 RenderShadowResolutionScale;
- static bool RenderDelayCreation;
- static bool RenderAnimateRes;
- static bool FreezeTime;
- static S32 DebugBeaconLineWidth;
- static F32 RenderHighlightBrightness;
- static LLColor4 RenderHighlightColor;
- static F32 RenderHighlightThickness;
- static bool RenderSpotLightsInNondeferred;
- static LLColor4 PreviewAmbientColor;
- static LLColor4 PreviewDiffuse0;
- static LLColor4 PreviewSpecular0;
- static LLColor4 PreviewDiffuse1;
- static LLColor4 PreviewSpecular1;
- static LLColor4 PreviewDiffuse2;
- static LLColor4 PreviewSpecular2;
- static LLVector3 PreviewDirection0;
- static LLVector3 PreviewDirection1;
- static LLVector3 PreviewDirection2;
- static F32 RenderGlowMinLuminance;
- static F32 RenderGlowMaxExtractAlpha;
- static F32 RenderGlowWarmthAmount;
- static LLVector3 RenderGlowLumWeights;
- static LLVector3 RenderGlowWarmthWeights;
- static S32 RenderGlowResolutionPow;
- static S32 RenderGlowIterations;
- static F32 RenderGlowWidth;
- static F32 RenderGlowStrength;
- static bool RenderGlowNoise;
- static bool RenderDepthOfField;
- static bool RenderDepthOfFieldInEditMode;
- static F32 CameraFocusTransitionTime;
- static F32 CameraFNumber;
- static F32 CameraFocalLength;
- static F32 CameraFieldOfView;
- static F32 RenderShadowNoise;
- static F32 RenderShadowBlurSize;
- static F32 RenderSSAOScale;
- static U32 RenderSSAOMaxScale;
- static F32 RenderSSAOFactor;
- static LLVector3 RenderSSAOEffect;
- static F32 RenderShadowOffsetError;
- static F32 RenderShadowBiasError;
- static F32 RenderShadowOffset;
- static F32 RenderShadowBias;
- static F32 RenderSpotShadowOffset;
- static F32 RenderSpotShadowBias;
+ static bool RenderDeferredSSAO;
+ static F32 RenderShadowResolutionScale;
+ static bool RenderDelayCreation;
+ static bool RenderAnimateRes;
+ static bool FreezeTime;
+ static S32 DebugBeaconLineWidth;
+ static F32 RenderHighlightBrightness;
+ static LLColor4 RenderHighlightColor;
+ static F32 RenderHighlightThickness;
+ static bool RenderSpotLightsInNondeferred;
+ static LLColor4 PreviewAmbientColor;
+ static LLColor4 PreviewDiffuse0;
+ static LLColor4 PreviewSpecular0;
+ static LLColor4 PreviewDiffuse1;
+ static LLColor4 PreviewSpecular1;
+ static LLColor4 PreviewDiffuse2;
+ static LLColor4 PreviewSpecular2;
+ static LLVector3 PreviewDirection0;
+ static LLVector3 PreviewDirection1;
+ static LLVector3 PreviewDirection2;
+ static F32 RenderGlowMinLuminance;
+ static F32 RenderGlowMaxExtractAlpha;
+ static F32 RenderGlowWarmthAmount;
+ static LLVector3 RenderGlowLumWeights;
+ static LLVector3 RenderGlowWarmthWeights;
+ static S32 RenderGlowResolutionPow;
+ static S32 RenderGlowIterations;
+ static F32 RenderGlowWidth;
+ static F32 RenderGlowStrength;
+ static bool RenderGlowNoise;
+ static bool RenderDepthOfField;
+ static bool RenderDepthOfFieldInEditMode;
+ static F32 CameraFocusTransitionTime;
+ static F32 CameraFNumber;
+ static F32 CameraFocalLength;
+ static F32 CameraFieldOfView;
+ static F32 RenderShadowNoise;
+ static F32 RenderShadowBlurSize;
+ static F32 RenderSSAOScale;
+ static U32 RenderSSAOMaxScale;
+ static F32 RenderSSAOFactor;
+ static LLVector3 RenderSSAOEffect;
+ static F32 RenderShadowOffsetError;
+ static F32 RenderShadowBiasError;
+ static F32 RenderShadowOffset;
+ static F32 RenderShadowBias;
+ static F32 RenderSpotShadowOffset;
+ static F32 RenderSpotShadowBias;
static LLDrawable* RenderSpotLight;
- static F32 RenderEdgeDepthCutoff;
- static F32 RenderEdgeNormCutoff;
- static LLVector3 RenderShadowGaussian;
- static F32 RenderShadowBlurDistFactor;
- static bool RenderDeferredAtmospheric;
- static F32 RenderHighlightFadeTime;
- static F32 RenderFarClip;
- static LLVector3 RenderShadowSplitExponent;
- static F32 RenderShadowErrorCutoff;
- static F32 RenderShadowFOVCutoff;
- static bool CameraOffset;
- static F32 CameraMaxCoF;
- static F32 CameraDoFResScale;
- static F32 RenderAutoHideSurfaceAreaLimit;
- static bool RenderScreenSpaceReflections;
+ static F32 RenderEdgeDepthCutoff;
+ static F32 RenderEdgeNormCutoff;
+ static LLVector3 RenderShadowGaussian;
+ static F32 RenderShadowBlurDistFactor;
+ static bool RenderDeferredAtmospheric;
+ static F32 RenderHighlightFadeTime;
+ static F32 RenderFarClip;
+ static LLVector3 RenderShadowSplitExponent;
+ static F32 RenderShadowErrorCutoff;
+ static F32 RenderShadowFOVCutoff;
+ static bool CameraOffset;
+ static F32 CameraMaxCoF;
+ static F32 CameraDoFResScale;
+ static F32 RenderAutoHideSurfaceAreaLimit;
+ static bool RenderScreenSpaceReflections;
static S32 RenderScreenSpaceReflectionIterations;
- static F32 RenderScreenSpaceReflectionRayStep;
- static F32 RenderScreenSpaceReflectionDistanceBias;
- static F32 RenderScreenSpaceReflectionDepthRejectBias;
- static F32 RenderScreenSpaceReflectionAdaptiveStepMultiplier;
- static S32 RenderScreenSpaceReflectionGlossySamples;
- static S32 RenderBufferVisualization;
+ static F32 RenderScreenSpaceReflectionRayStep;
+ static F32 RenderScreenSpaceReflectionDistanceBias;
+ static F32 RenderScreenSpaceReflectionDepthRejectBias;
+ static F32 RenderScreenSpaceReflectionAdaptiveStepMultiplier;
+ static S32 RenderScreenSpaceReflectionGlossySamples;
+ static S32 RenderBufferVisualization;
};
void render_bbox(const LLVector3 &min, const LLVector3 &max);
diff --git a/indra/newview/res/resource.h b/indra/newview/res/resource.h
index 01d90da971..e904f4a1a8 100644
--- a/indra/newview/res/resource.h
+++ b/indra/newview/res/resource.h
@@ -1,24 +1,24 @@
-/**
+/**
* @file resource.h
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -167,7 +167,7 @@
#define ID_TESTMENU_TEST 40001
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 173
diff --git a/indra/newview/roles_constants.h b/indra/newview/roles_constants.h
index fecf5f9d4a..ae3ec57b86 100644
--- a/indra/newview/roles_constants.h
+++ b/indra/newview/roles_constants.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file roles_constants.h
* @brief General Roles Constants
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,19 +32,19 @@ const S32 MAX_ROLES = 10;
enum LLRoleMemberChangeType
{
- RMC_ADD,
- RMC_REMOVE,
- RMC_NONE
+ RMC_ADD,
+ RMC_REMOVE,
+ RMC_NONE
};
enum LLRoleChangeType
{
- RC_UPDATE_NONE,
- RC_UPDATE_DATA,
- RC_UPDATE_POWERS,
- RC_UPDATE_ALL,
- RC_CREATE,
- RC_DELETE
+ RC_UPDATE_NONE,
+ RC_UPDATE_DATA,
+ RC_UPDATE_POWERS,
+ RC_UPDATE_ALL,
+ RC_CREATE,
+ RC_DELETE
};
//
@@ -62,137 +62,137 @@ const U64 GP_NO_POWERS = 0x0;
const U64 GP_ALL_POWERS = 0xFFFFffffFFFFffffLL;
// Membership
-const U64 GP_MEMBER_INVITE = 0x1LL << 1; // Invite member
-const U64 GP_MEMBER_EJECT = 0x1LL << 2; // Eject member from group
-const U64 GP_MEMBER_OPTIONS = 0x1LL << 3; // Toggle "Open enrollment" and change "Signup Fee"
-const U64 GP_MEMBER_VISIBLE_IN_DIR = 0x1LL << 47;
+const U64 GP_MEMBER_INVITE = 0x1LL << 1; // Invite member
+const U64 GP_MEMBER_EJECT = 0x1LL << 2; // Eject member from group
+const U64 GP_MEMBER_OPTIONS = 0x1LL << 3; // Toggle "Open enrollment" and change "Signup Fee"
+const U64 GP_MEMBER_VISIBLE_IN_DIR = 0x1LL << 47;
// Roles
-const U64 GP_ROLE_CREATE = 0x1LL << 4; // Create new roles
-const U64 GP_ROLE_DELETE = 0x1LL << 5; // Delete roles
-const U64 GP_ROLE_PROPERTIES = 0x1LL << 6; // Change Role Names, Titles, and Descriptions (Of roles the user is in, only, or any role in group?)
-const U64 GP_ROLE_ASSIGN_MEMBER_LIMITED = 0x1LL << 7; // Assign Member to a Role that the assigner is in
-const U64 GP_ROLE_ASSIGN_MEMBER = 0x1LL << 8; // Assign Member to Role
-const U64 GP_ROLE_REMOVE_MEMBER = 0x1LL << 9; // Remove Member from Role
-const U64 GP_ROLE_CHANGE_ACTIONS = 0x1LL << 10; // Change actions a role can perform
+const U64 GP_ROLE_CREATE = 0x1LL << 4; // Create new roles
+const U64 GP_ROLE_DELETE = 0x1LL << 5; // Delete roles
+const U64 GP_ROLE_PROPERTIES = 0x1LL << 6; // Change Role Names, Titles, and Descriptions (Of roles the user is in, only, or any role in group?)
+const U64 GP_ROLE_ASSIGN_MEMBER_LIMITED = 0x1LL << 7; // Assign Member to a Role that the assigner is in
+const U64 GP_ROLE_ASSIGN_MEMBER = 0x1LL << 8; // Assign Member to Role
+const U64 GP_ROLE_REMOVE_MEMBER = 0x1LL << 9; // Remove Member from Role
+const U64 GP_ROLE_CHANGE_ACTIONS = 0x1LL << 10; // Change actions a role can perform
// Group Identity
-const U64 GP_GROUP_CHANGE_IDENTITY = 0x1LL << 11; // Charter, insignia, 'Show In Group List', 'Publish on the web', 'Mature', all 'Show Member In Group Profile' checkboxes
+const U64 GP_GROUP_CHANGE_IDENTITY = 0x1LL << 11; // Charter, insignia, 'Show In Group List', 'Publish on the web', 'Mature', all 'Show Member In Group Profile' checkboxes
// Parcel Management
-const U64 GP_LAND_DEED = 0x1LL << 12; // Deed Land and Buy Land for Group
-const U64 GP_LAND_RELEASE = 0x1LL << 13; // Release Land (to Gov. Linden)
-const U64 GP_LAND_SET_SALE_INFO = 0x1LL << 14; // Set for sale info (Toggle "For Sale", Set Price, Set Target, Toggle "Sell objects with the land")
-const U64 GP_LAND_DIVIDE_JOIN = 0x1LL << 15; // Divide and Join Parcels
+const U64 GP_LAND_DEED = 0x1LL << 12; // Deed Land and Buy Land for Group
+const U64 GP_LAND_RELEASE = 0x1LL << 13; // Release Land (to Gov. Linden)
+const U64 GP_LAND_SET_SALE_INFO = 0x1LL << 14; // Set for sale info (Toggle "For Sale", Set Price, Set Target, Toggle "Sell objects with the land")
+const U64 GP_LAND_DIVIDE_JOIN = 0x1LL << 15; // Divide and Join Parcels
// Parcel Identity
-const U64 GP_LAND_FIND_PLACES = 0x1LL << 17; // Toggle "Show in Find Places" and Set Category.
-const U64 GP_LAND_CHANGE_IDENTITY = 0x1LL << 18; // Change Parcel Identity: Parcel Name, Parcel Description, Snapshot, 'Publish on the web', and 'Mature' checkbox
-const U64 GP_LAND_SET_LANDING_POINT = 0x1LL << 19; // Set Landing Point
+const U64 GP_LAND_FIND_PLACES = 0x1LL << 17; // Toggle "Show in Find Places" and Set Category.
+const U64 GP_LAND_CHANGE_IDENTITY = 0x1LL << 18; // Change Parcel Identity: Parcel Name, Parcel Description, Snapshot, 'Publish on the web', and 'Mature' checkbox
+const U64 GP_LAND_SET_LANDING_POINT = 0x1LL << 19; // Set Landing Point
// Parcel Settings
-const U64 GP_LAND_CHANGE_MEDIA = 0x1LL << 20; // Change Media Settings
-const U64 GP_LAND_EDIT = 0x1LL << 21; // Toggle Edit Land
-const U64 GP_LAND_OPTIONS = 0x1LL << 22; // Toggle Set Home Point, Fly, Outside Scripts, Create/Edit Objects, Landmark, and Damage checkboxes
+const U64 GP_LAND_CHANGE_MEDIA = 0x1LL << 20; // Change Media Settings
+const U64 GP_LAND_EDIT = 0x1LL << 21; // Toggle Edit Land
+const U64 GP_LAND_OPTIONS = 0x1LL << 22; // Toggle Set Home Point, Fly, Outside Scripts, Create/Edit Objects, Landmark, and Damage checkboxes
// Parcel Powers
-const U64 GP_LAND_ALLOW_EDIT_LAND = 0x1LL << 23; // Bypass Edit Land Restriction
-const U64 GP_LAND_ALLOW_FLY = 0x1LL << 24; // Bypass Fly Restriction
-const U64 GP_LAND_ALLOW_CREATE = 0x1LL << 25; // Bypass Create/Edit Objects Restriction
-const U64 GP_LAND_ALLOW_LANDMARK = 0x1LL << 26; // Bypass Landmark Restriction
-const U64 GP_LAND_ALLOW_SET_HOME = 0x1LL << 28; // Bypass Set Home Point Restriction
-const U64 GP_LAND_ALLOW_HOLD_EVENT = 0x1LL << 41; // Allowed to hold events on group-owned land
+const U64 GP_LAND_ALLOW_EDIT_LAND = 0x1LL << 23; // Bypass Edit Land Restriction
+const U64 GP_LAND_ALLOW_FLY = 0x1LL << 24; // Bypass Fly Restriction
+const U64 GP_LAND_ALLOW_CREATE = 0x1LL << 25; // Bypass Create/Edit Objects Restriction
+const U64 GP_LAND_ALLOW_LANDMARK = 0x1LL << 26; // Bypass Landmark Restriction
+const U64 GP_LAND_ALLOW_SET_HOME = 0x1LL << 28; // Bypass Set Home Point Restriction
+const U64 GP_LAND_ALLOW_HOLD_EVENT = 0x1LL << 41; // Allowed to hold events on group-owned land
const U64 GP_LAND_ALLOW_ENVIRONMENT = 0x1LL << 46; // Allowed to change the environment
// Parcel Access
-const U64 GP_LAND_MANAGE_ALLOWED = 0x1LL << 29; // Manage Allowed List
-const U64 GP_LAND_MANAGE_BANNED = 0x1LL << 30; // Manage Banned List
-const U64 GP_LAND_MANAGE_PASSES = 0x1LL << 31; // Change Sell Pass Settings
-const U64 GP_LAND_ADMIN = 0x1LL << 32; // Eject and Freeze Users on the land
+const U64 GP_LAND_MANAGE_ALLOWED = 0x1LL << 29; // Manage Allowed List
+const U64 GP_LAND_MANAGE_BANNED = 0x1LL << 30; // Manage Banned List
+const U64 GP_LAND_MANAGE_PASSES = 0x1LL << 31; // Change Sell Pass Settings
+const U64 GP_LAND_ADMIN = 0x1LL << 32; // Eject and Freeze Users on the land
// Parcel Content
-const U64 GP_LAND_RETURN_GROUP_SET = 0x1LL << 33; // Return objects on parcel that are set to group
-const U64 GP_LAND_RETURN_NON_GROUP = 0x1LL << 34; // Return objects on parcel that are not set to group
-const U64 GP_LAND_RETURN_GROUP_OWNED = 0x1LL << 48; // Return objects on parcel that are owned by the group
+const U64 GP_LAND_RETURN_GROUP_SET = 0x1LL << 33; // Return objects on parcel that are set to group
+const U64 GP_LAND_RETURN_NON_GROUP = 0x1LL << 34; // Return objects on parcel that are not set to group
+const U64 GP_LAND_RETURN_GROUP_OWNED = 0x1LL << 48; // Return objects on parcel that are owned by the group
// Select a power-bit based on an object's relationship to a parcel.
-const U64 GP_LAND_RETURN = GP_LAND_RETURN_GROUP_OWNED
- | GP_LAND_RETURN_GROUP_SET
- | GP_LAND_RETURN_NON_GROUP;
+const U64 GP_LAND_RETURN = GP_LAND_RETURN_GROUP_OWNED
+ | GP_LAND_RETURN_GROUP_SET
+ | GP_LAND_RETURN_NON_GROUP;
-const U64 GP_LAND_GARDENING = 0x1LL << 35; // Parcel Gardening - plant and move linden trees
+const U64 GP_LAND_GARDENING = 0x1LL << 35; // Parcel Gardening - plant and move linden trees
// Object Management
-const U64 GP_OBJECT_DEED = 0x1LL << 36; // Deed Object
-const U64 GP_OBJECT_MANIPULATE = 0x1LL << 38; // Manipulate Group Owned Objects (Move, Copy, Mod)
-const U64 GP_OBJECT_SET_SALE = 0x1LL << 39; // Set Group Owned Object for Sale
+const U64 GP_OBJECT_DEED = 0x1LL << 36; // Deed Object
+const U64 GP_OBJECT_MANIPULATE = 0x1LL << 38; // Manipulate Group Owned Objects (Move, Copy, Mod)
+const U64 GP_OBJECT_SET_SALE = 0x1LL << 39; // Set Group Owned Object for Sale
// Accounting
-const U64 GP_ACCOUNTING_ACCOUNTABLE = 0x1LL << 40; // Pay Group Liabilities and Receive Group Dividends
+const U64 GP_ACCOUNTING_ACCOUNTABLE = 0x1LL << 40; // Pay Group Liabilities and Receive Group Dividends
// Notices
-const U64 GP_NOTICES_SEND = 0x1LL << 42; // Send Notices
-const U64 GP_NOTICES_RECEIVE = 0x1LL << 43; // Receive Notices and View Notice History
+const U64 GP_NOTICES_SEND = 0x1LL << 42; // Send Notices
+const U64 GP_NOTICES_RECEIVE = 0x1LL << 43; // Receive Notices and View Notice History
// Proposals
// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856:
-const U64 GP_PROPOSAL_START = 0x1LL << 44; // Start Proposal
+const U64 GP_PROPOSAL_START = 0x1LL << 44; // Start Proposal
// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856:
-const U64 GP_PROPOSAL_VOTE = 0x1LL << 45; // Vote on Proposal
+const U64 GP_PROPOSAL_VOTE = 0x1LL << 45; // Vote on Proposal
// Group chat moderation related
-const U64 GP_SESSION_JOIN = 0x1LL << 16; //can join session
-const U64 GP_SESSION_VOICE = 0x1LL << 27; //can hear/talk
-const U64 GP_SESSION_MODERATOR = 0x1LL << 37; //can mute people's session
+const U64 GP_SESSION_JOIN = 0x1LL << 16; //can join session
+const U64 GP_SESSION_VOICE = 0x1LL << 27; //can hear/talk
+const U64 GP_SESSION_MODERATOR = 0x1LL << 37; //can mute people's session
-const U64 GP_EXPERIENCE_ADMIN = 0x1LL << 49; // has admin rights to any experiences owned by this group
-const U64 GP_EXPERIENCE_CREATOR = 0x1LL << 50; // can sign scripts for experiences owned by this group
+const U64 GP_EXPERIENCE_ADMIN = 0x1LL << 49; // has admin rights to any experiences owned by this group
+const U64 GP_EXPERIENCE_CREATOR = 0x1LL << 50; // can sign scripts for experiences owned by this group
// Group Banning
-const U64 GP_GROUP_BAN_ACCESS = 0x1LL << 51; // Allows access to ban / un-ban agents from a group.
+const U64 GP_GROUP_BAN_ACCESS = 0x1LL << 51; // Allows access to ban / un-ban agents from a group.
const U64 GP_DEFAULT_MEMBER = GP_ACCOUNTING_ACCOUNTABLE
- | GP_LAND_ALLOW_SET_HOME
- | GP_NOTICES_RECEIVE
- | GP_SESSION_JOIN
- | GP_SESSION_VOICE
- ;
+ | GP_LAND_ALLOW_SET_HOME
+ | GP_NOTICES_RECEIVE
+ | GP_SESSION_JOIN
+ | GP_SESSION_VOICE
+ ;
const U64 GP_DEFAULT_OFFICER = GP_DEFAULT_MEMBER // Superset of GP_DEFAULT_MEMBER
- | GP_GROUP_CHANGE_IDENTITY
- | GP_LAND_ADMIN
- | GP_LAND_ALLOW_EDIT_LAND
- | GP_LAND_ALLOW_FLY
- | GP_LAND_ALLOW_CREATE
+ | GP_GROUP_CHANGE_IDENTITY
+ | GP_LAND_ADMIN
+ | GP_LAND_ALLOW_EDIT_LAND
+ | GP_LAND_ALLOW_FLY
+ | GP_LAND_ALLOW_CREATE
| GP_LAND_ALLOW_ENVIRONMENT
- | GP_LAND_ALLOW_LANDMARK
- | GP_LAND_CHANGE_IDENTITY
- | GP_LAND_CHANGE_MEDIA
- | GP_LAND_DEED
- | GP_LAND_DIVIDE_JOIN
- | GP_LAND_EDIT
- | GP_LAND_FIND_PLACES
- | GP_LAND_GARDENING
- | GP_LAND_MANAGE_ALLOWED
- | GP_LAND_MANAGE_BANNED
- | GP_LAND_MANAGE_PASSES
- | GP_LAND_OPTIONS
- | GP_LAND_RELEASE
- | GP_LAND_RETURN_GROUP_OWNED
- | GP_LAND_RETURN_GROUP_SET
- | GP_LAND_RETURN_NON_GROUP
- | GP_LAND_SET_LANDING_POINT
- | GP_LAND_SET_SALE_INFO
- | GP_MEMBER_EJECT
- | GP_MEMBER_INVITE
- | GP_MEMBER_OPTIONS
- | GP_MEMBER_VISIBLE_IN_DIR
- | GP_NOTICES_SEND
- | GP_OBJECT_DEED
- | GP_OBJECT_MANIPULATE
- | GP_OBJECT_SET_SALE
- | GP_ROLE_ASSIGN_MEMBER_LIMITED
- | GP_ROLE_PROPERTIES
- | GP_SESSION_MODERATOR
- ;
+ | GP_LAND_ALLOW_LANDMARK
+ | GP_LAND_CHANGE_IDENTITY
+ | GP_LAND_CHANGE_MEDIA
+ | GP_LAND_DEED
+ | GP_LAND_DIVIDE_JOIN
+ | GP_LAND_EDIT
+ | GP_LAND_FIND_PLACES
+ | GP_LAND_GARDENING
+ | GP_LAND_MANAGE_ALLOWED
+ | GP_LAND_MANAGE_BANNED
+ | GP_LAND_MANAGE_PASSES
+ | GP_LAND_OPTIONS
+ | GP_LAND_RELEASE
+ | GP_LAND_RETURN_GROUP_OWNED
+ | GP_LAND_RETURN_GROUP_SET
+ | GP_LAND_RETURN_NON_GROUP
+ | GP_LAND_SET_LANDING_POINT
+ | GP_LAND_SET_SALE_INFO
+ | GP_MEMBER_EJECT
+ | GP_MEMBER_INVITE
+ | GP_MEMBER_OPTIONS
+ | GP_MEMBER_VISIBLE_IN_DIR
+ | GP_NOTICES_SEND
+ | GP_OBJECT_DEED
+ | GP_OBJECT_MANIPULATE
+ | GP_OBJECT_SET_SALE
+ | GP_ROLE_ASSIGN_MEMBER_LIMITED
+ | GP_ROLE_PROPERTIES
+ | GP_SESSION_MODERATOR
+ ;
#endif
diff --git a/indra/newview/tests/cppfeatures_test.cpp b/indra/newview/tests/cppfeatures_test.cpp
index 923bb1e1b2..f5ea3a522b 100644
--- a/indra/newview/tests/cppfeatures_test.cpp
+++ b/indra/newview/tests/cppfeatures_test.cpp
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,35 +44,35 @@ tut::cpp_features_test_t tut_cpp_features_test("LLCPPFeatures");
template<> template<>
void cpp_features_test_object_t::test<1>()
{
- S32 explicit_val{3};
- ensure(explicit_val==3);
-
- S32 default_val{};
- ensure(default_val==0);
-
- std::vector<S32> fibs{1,1,2,3,5};
- ensure(fibs[4]==5);
+ S32 explicit_val{3};
+ ensure(explicit_val==3);
+
+ S32 default_val{};
+ ensure(default_val==0);
+
+ std::vector<S32> fibs{1,1,2,3,5};
+ ensure(fibs[4]==5);
}
// auto
//
// https://en.cppreference.com/w/cpp/language/auto
-//
+//
// Can use auto in place of a more complex type specification, if the compiler can infer the type
template<> template<>
void cpp_features_test_object_t::test<2>()
{
- std::vector<S32> numbers{3,6,9};
+ std::vector<S32> numbers{3,6,9};
- // auto element
- auto& aval = numbers[1];
- ensure("auto element", aval==6);
+ // auto element
+ auto& aval = numbers[1];
+ ensure("auto element", aval==6);
- // auto iterator (non-const)
- auto it = numbers.rbegin();
- *it += 1;
- S32 val = *it;
- ensure("auto iterator", val==10);
+ // auto iterator (non-const)
+ auto it = numbers.rbegin();
+ *it += 1;
+ S32 val = *it;
+ ensure("auto iterator", val==10);
}
// range for
@@ -84,42 +84,42 @@ template<> template<>
void cpp_features_test_object_t::test<3>()
{
- // Traditional iterator for with container
- //
- // Problems:
- // * Have to create a new variable for the iterator, which is unrelated to the problem you're trying to solve.
- // * Redundant and somewhat fragile. Have to make sure begin() and end() are both from the right container.
- std::vector<S32> numbers{3,6,9};
- for (auto it = numbers.begin(); it != numbers.end(); ++it)
- {
- auto& n = *it;
- n *= 2;
- }
- ensure("iterator for vector", numbers[2]==18);
-
- // Range for with container
- //
- // Under the hood, this is doing the same thing as the traditional
- // for loop above. Still uses begin() and end() but you don't have
- // to access them directly.
- std::vector<S32> numbersb{3,6,9};
- for (auto& n: numbersb)
- {
- n *= 2;
- }
- ensure("range for vector", numbersb[2]==18);
-
- // Range for over a C-style array.
- //
- // This is handy because the language determines the range automatically.
- // Getting this right manually is a little trickier.
- S32 pows[] = {1,2,4,8,16};
- S32 sum{};
- for (const auto& v: pows)
- {
- sum += v;
- }
- ensure("for C-array", sum==31);
+ // Traditional iterator for with container
+ //
+ // Problems:
+ // * Have to create a new variable for the iterator, which is unrelated to the problem you're trying to solve.
+ // * Redundant and somewhat fragile. Have to make sure begin() and end() are both from the right container.
+ std::vector<S32> numbers{3,6,9};
+ for (auto it = numbers.begin(); it != numbers.end(); ++it)
+ {
+ auto& n = *it;
+ n *= 2;
+ }
+ ensure("iterator for vector", numbers[2]==18);
+
+ // Range for with container
+ //
+ // Under the hood, this is doing the same thing as the traditional
+ // for loop above. Still uses begin() and end() but you don't have
+ // to access them directly.
+ std::vector<S32> numbersb{3,6,9};
+ for (auto& n: numbersb)
+ {
+ n *= 2;
+ }
+ ensure("range for vector", numbersb[2]==18);
+
+ // Range for over a C-style array.
+ //
+ // This is handy because the language determines the range automatically.
+ // Getting this right manually is a little trickier.
+ S32 pows[] = {1,2,4,8,16};
+ S32 sum{};
+ for (const auto& v: pows)
+ {
+ sum += v;
+ }
+ ensure("for C-array", sum==31);
}
// override specifier
@@ -131,30 +131,30 @@ void cpp_features_test_object_t::test<3>()
// * Makes code somewhat easier to read by showing intent.
// * Prevents mistakes where you think something is an override but it doesn't actually match the declaration in the parent class.
// Drawbacks:
-// * Some compilers require that any class using override must use it consistently for all functions.
-// This makes switching a class to use override a lot more work.
+// * Some compilers require that any class using override must use it consistently for all functions.
+// This makes switching a class to use override a lot more work.
class Foo
{
public:
- virtual bool is_happy() const = 0;
+ virtual bool is_happy() const = 0;
};
class Bar: public Foo
{
public:
- bool is_happy() const override { return true; }
- // Override would fail: non-const declaration doesn't match parent
- // bool is_happy() override { return true; }
- // Override would fail: wrong name
- // bool is_happx() override { return true; }
+ bool is_happy() const override { return true; }
+ // Override would fail: non-const declaration doesn't match parent
+ // bool is_happy() override { return true; }
+ // Override would fail: wrong name
+ // bool is_happx() override { return true; }
};
template<> template<>
void cpp_features_test_object_t::test<4>()
{
- Bar b;
- ensure("override", b.is_happy());
+ Bar b;
+ ensure("override", b.is_happy());
}
// final
@@ -166,27 +166,27 @@ void cpp_features_test_object_t::test<4>()
class Vehicle
{
public:
- virtual bool has_wheels() const = 0;
+ virtual bool has_wheels() const = 0;
};
class WheeledVehicle: public Vehicle
{
public:
- virtual bool has_wheels() const final override { return true; }
+ virtual bool has_wheels() const final override { return true; }
};
class Bicycle: public WheeledVehicle
{
public:
- // Error: can't override final version in WheeledVehicle
- // virtual bool has_wheels() override const { return true; }
+ // Error: can't override final version in WheeledVehicle
+ // virtual bool has_wheels() override const { return true; }
};
template<> template<>
void cpp_features_test_object_t::test<5>()
{
- Bicycle bi;
- ensure("final", bi.has_wheels());
+ Bicycle bi;
+ ensure("final", bi.has_wheels());
}
// deleted function declaration
@@ -206,16 +206,16 @@ void cpp_features_test_object_t::test<5>()
class DoNotCopy
{
public:
- DoNotCopy() {}
- DoNotCopy(const DoNotCopy& ref) = delete;
+ DoNotCopy() {}
+ DoNotCopy(const DoNotCopy& ref) = delete;
};
template<> template<>
void cpp_features_test_object_t::test<6>()
{
- DoNotCopy nc; // OK, default constructor
- //DoNotCopy nc2(nc); // No, can't copy
- //DoNotCopy nc3 = nc; // No, this also calls copy constructor (even though it looks like an assignment)
+ DoNotCopy nc; // OK, default constructor
+ //DoNotCopy nc2(nc); // No, can't copy
+ //DoNotCopy nc3 = nc; // No, this also calls copy constructor (even though it looks like an assignment)
}
// defaulted function declaration
@@ -229,22 +229,22 @@ void cpp_features_test_object_t::test<6>()
class DefaultCopyOK
{
public:
- DefaultCopyOK(): mVal(123) {}
- DefaultCopyOK(const DefaultCopyOK&) = default;
- S32 val() const { return mVal; }
+ DefaultCopyOK(): mVal(123) {}
+ DefaultCopyOK(const DefaultCopyOK&) = default;
+ S32 val() const { return mVal; }
private:
- S32 mVal;
+ S32 mVal;
};
template<> template<>
void cpp_features_test_object_t::test<7>()
{
- DefaultCopyOK d; // OK
- DefaultCopyOK d2(d); // OK
- DefaultCopyOK d3 = d; // OK
- ensure("default copy d", d.val()==123);
- ensure("default copy d2", d.val()==d2.val());
- ensure("default copy d3", d.val()==d3.val());
+ DefaultCopyOK d; // OK
+ DefaultCopyOK d2(d); // OK
+ DefaultCopyOK d3 = d; // OK
+ ensure("default copy d", d.val()==123);
+ ensure("default copy d2", d.val()==d2.val());
+ ensure("default copy d3", d.val()==d3.val());
}
// initialize class members inline
@@ -259,32 +259,32 @@ void cpp_features_test_object_t::test<7>()
class InitInline
{
public:
- S32 mFoo{10};
+ S32 mFoo{10};
};
class InitInlineWithConstructor
{
public:
- // Here mFoo is not specified, so you will get the default value of 10.
- // mBar is specified, so 25 will override the default value.
- InitInlineWithConstructor():
- mBar(25)
- {}
-
- // Default values set using two different styles, same effect.
- S32 mFoo{10};
- S32 mBar = 20;
+ // Here mFoo is not specified, so you will get the default value of 10.
+ // mBar is specified, so 25 will override the default value.
+ InitInlineWithConstructor():
+ mBar(25)
+ {}
+
+ // Default values set using two different styles, same effect.
+ S32 mFoo{10};
+ S32 mBar = 20;
};
template<> template<>
void cpp_features_test_object_t::test<8>()
{
- InitInline ii;
- ensure("init member inline 1", ii.mFoo==10);
+ InitInline ii;
+ ensure("init member inline 1", ii.mFoo==10);
- InitInlineWithConstructor iici;
- ensure("init member inline 2", iici.mFoo=10);
- ensure("init member inline 3", iici.mBar==25);
+ InitInlineWithConstructor iici;
+ ensure("init member inline 2", iici.mFoo=10);
+ ensure("init member inline 3", iici.mBar==25);
}
// constexpr
@@ -296,25 +296,25 @@ constexpr S32 compute2() { return 2; }
constexpr S32 ce_factorial(S32 n)
{
- if (n<=0)
- {
- return 1;
- }
- else
- {
- return n*ce_factorial(n-1);
- }
+ if (n<=0)
+ {
+ return 1;
+ }
+ else
+ {
+ return n*ce_factorial(n-1);
+ }
}
template<> template<>
void cpp_features_test_object_t::test<9>()
{
- S32 val = compute2();
- ensure("constexpr 1", val==2);
+ S32 val = compute2();
+ ensure("constexpr 1", val==2);
- // Compile-time factorial. You used to need complex templates to do something this useless.
- S32 fac5 = ce_factorial(5);
- ensure("constexpr 2", fac5==120);
+ // Compile-time factorial. You used to need complex templates to do something this useless.
+ S32 fac5 = ce_factorial(5);
+ ensure("constexpr 2", fac5==120);
}
// static assert
@@ -331,14 +331,14 @@ void cpp_features_test_object_t::test<9>()
template<> template<>
void cpp_features_test_object_t::test<10>()
{
- // static_assert(ce_factorial(6)==720); No, needs a flag we don't currently set.
- static_assert(ce_factorial(6)==720, "bad factorial"); // OK
+ // static_assert(ce_factorial(6)==720); No, needs a flag we don't currently set.
+ static_assert(ce_factorial(6)==720, "bad factorial"); // OK
}
// type aliases
//
// https://en.cppreference.com/w/cpp/language/type_alias
-//
+//
// You can use the "using" statement to create simpler templates that
// are aliases for more complex ones. "Template typedef"
@@ -349,8 +349,8 @@ using stringmap = std::map<std::string, T>;
template<> template<>
void cpp_features_test_object_t::test<11>()
{
- stringmap<S32> name_counts{ {"alice", 3}, {"bob", 2} };
- ensure("type alias", name_counts["bob"]==2);
+ stringmap<S32> name_counts{ {"alice", 3}, {"bob", 2} };
+ ensure("type alias", name_counts["bob"]==2);
}
// Other possibilities:
diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp
index 45ce1ba62f..6739096baa 100644
--- a/indra/newview/tests/llagentaccess_test.cpp
+++ b/indra/newview/tests/llagentaccess_test.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentaccess_test.cpp
* @brief LLAgentAccess tests
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,7 +40,7 @@
static U32 test_preferred_maturity = SIM_ACCESS_PG;
LLControlGroup::LLControlGroup(const std::string& name)
-: LLInstanceTracker<LLControlGroup, std::string>(name)
+: LLInstanceTracker<LLControlGroup, std::string>(name)
{
}
@@ -51,241 +51,241 @@ LLControlGroup::~LLControlGroup()
// Implementation of just the LLControlGroup methods we requre
LLControlVariable* LLControlGroup::declareU32(const std::string& name, U32 initial_val, const std::string& comment, LLControlVariable::ePersist persist)
{
- test_preferred_maturity = initial_val;
- return NULL;
+ test_preferred_maturity = initial_val;
+ return NULL;
}
void LLControlGroup::setU32(const std::string& name, U32 val)
{
- test_preferred_maturity = val;
+ test_preferred_maturity = val;
}
U32 LLControlGroup::getU32(const std::string& name)
{
- return test_preferred_maturity;
+ return test_preferred_maturity;
}
//----------------------------------------------------------------------------
-
+
namespace tut
{
struct agentaccess
{
};
-
- typedef test_group<agentaccess> agentaccess_t;
- typedef agentaccess_t::object agentaccess_object_t;
- tut::agentaccess_t tut_agentaccess("LLAgentAccess");
-
- template<> template<>
- void agentaccess_object_t::test<1>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_PG);
+
+ typedef test_group<agentaccess> agentaccess_t;
+ typedef agentaccess_t::object agentaccess_object_t;
+ tut::agentaccess_t tut_agentaccess("LLAgentAccess");
+
+ template<> template<>
+ void agentaccess_object_t::test<1>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_PG);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 prefersPG", aa.prefersPG());
- ensure("1 prefersMature", !aa.prefersMature());
- ensure("1 prefersAdult", !aa.prefersAdult());
+ ensure("1 prefersPG", aa.prefersPG());
+ ensure("1 prefersMature", !aa.prefersMature());
+ ensure("1 prefersAdult", !aa.prefersAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("2 prefersPG", !aa.prefersPG());
- ensure("2 prefersMature", aa.prefersMature());
- ensure("2 prefersAdult", !aa.prefersAdult());
+ ensure("2 prefersPG", !aa.prefersPG());
+ ensure("2 prefersMature", aa.prefersMature());
+ ensure("2 prefersAdult", !aa.prefersAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("3 prefersPG", !aa.prefersPG());
- ensure("3 prefersMature", aa.prefersMature());
- ensure("3 prefersAdult", aa.prefersAdult());
+ ensure("3 prefersPG", !aa.prefersPG());
+ ensure("3 prefersMature", aa.prefersMature());
+ ensure("3 prefersAdult", aa.prefersAdult());
#endif // HACKED_GODLIKE_VIEWER
}
-
- template<> template<>
- void agentaccess_object_t::test<2>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
- // make sure default is PG
+
+ template<> template<>
+ void agentaccess_object_t::test<2>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
+ // make sure default is PG
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 isTeen", aa.isTeen());
- ensure("1 isMature", !aa.isMature());
- ensure("1 isAdult", !aa.isAdult());
+ ensure("1 isTeen", aa.isTeen());
+ ensure("1 isMature", !aa.isMature());
+ ensure("1 isAdult", !aa.isAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- // check the conversion routine
+
+ // check the conversion routine
#ifndef HACKED_GODLIKE_VIEWER
- ensure_equals("1 conversion", SIM_ACCESS_PG, aa.convertTextToMaturity('P'));
- ensure_equals("2 conversion", SIM_ACCESS_MATURE, aa.convertTextToMaturity('M'));
- ensure_equals("3 conversion", SIM_ACCESS_ADULT, aa.convertTextToMaturity('A'));
- ensure_equals("4 conversion", SIM_ACCESS_MIN, aa.convertTextToMaturity('Q'));
+ ensure_equals("1 conversion", SIM_ACCESS_PG, aa.convertTextToMaturity('P'));
+ ensure_equals("2 conversion", SIM_ACCESS_MATURE, aa.convertTextToMaturity('M'));
+ ensure_equals("3 conversion", SIM_ACCESS_ADULT, aa.convertTextToMaturity('A'));
+ ensure_equals("4 conversion", SIM_ACCESS_MIN, aa.convertTextToMaturity('Q'));
#endif // HACKED_GODLIKE_VIEWER
-
- // now try the other method of setting it - PG
- aa.setMaturity('P');
- ensure("2 isTeen", aa.isTeen());
+
+ // now try the other method of setting it - PG
+ aa.setMaturity('P');
+ ensure("2 isTeen", aa.isTeen());
#ifndef HACKED_GODLIKE_VIEWER
- ensure("2 isMature", !aa.isMature());
- ensure("2 isAdult", !aa.isAdult());
+ ensure("2 isMature", !aa.isMature());
+ ensure("2 isAdult", !aa.isAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- // Mature
- aa.setMaturity('M');
+
+ // Mature
+ aa.setMaturity('M');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("3 isTeen", !aa.isTeen());
- ensure("3 isMature", aa.isMature());
- ensure("3 isAdult", !aa.isAdult());
+ ensure("3 isTeen", !aa.isTeen());
+ ensure("3 isMature", aa.isMature());
+ ensure("3 isAdult", !aa.isAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- // Adult
- aa.setMaturity('A');
+
+ // Adult
+ aa.setMaturity('A');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("4 isTeen", !aa.isTeen());
- ensure("4 isMature", aa.isMature());
- ensure("4 isAdult", aa.isAdult());
+ ensure("4 isTeen", !aa.isTeen());
+ ensure("4 isMature", aa.isMature());
+ ensure("4 isAdult", aa.isAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- }
-
- template<> template<>
- void agentaccess_object_t::test<3>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
+
+ }
+
+ template<> template<>
+ void agentaccess_object_t::test<3>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
#ifndef HACKED_GODLIKE_VIEWER
- ensure("starts normal", !aa.isGodlike());
+ ensure("starts normal", !aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setGodLevel(GOD_NOT);
+ aa.setGodLevel(GOD_NOT);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("stays normal", !aa.isGodlike());
+ ensure("stays normal", !aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setGodLevel(GOD_FULL);
+ aa.setGodLevel(GOD_FULL);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("sets full", aa.isGodlike());
+ ensure("sets full", aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setGodLevel(GOD_NOT);
+ aa.setGodLevel(GOD_NOT);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("resets normal", !aa.isGodlike());
+ ensure("resets normal", !aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setAdminOverride(true);
+ aa.setAdminOverride(true);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("admin true", aa.getAdminOverride());
- ensure("overrides 1", aa.isGodlike());
+ ensure("admin true", aa.getAdminOverride());
+ ensure("overrides 1", aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setGodLevel(GOD_FULL);
+ aa.setGodLevel(GOD_FULL);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("overrides 2", aa.isGodlike());
+ ensure("overrides 2", aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setAdminOverride(false);
+ aa.setAdminOverride(false);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("admin false", !aa.getAdminOverride());
- ensure("overrides 3", aa.isGodlike());
+ ensure("admin false", !aa.getAdminOverride());
+ ensure("overrides 3", aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
}
-
- template<> template<>
- void agentaccess_object_t::test<4>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
+
+ template<> template<>
+ void agentaccess_object_t::test<4>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 pg to start", aa.wantsPGOnly());
- ensure("2 pg to start", !aa.canAccessMature());
- ensure("3 pg to start", !aa.canAccessAdult());
+ ensure("1 pg to start", aa.wantsPGOnly());
+ ensure("2 pg to start", !aa.canAccessMature());
+ ensure("3 pg to start", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- aa.setGodLevel(GOD_FULL);
+
+ aa.setGodLevel(GOD_FULL);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 full god", !aa.wantsPGOnly());
- ensure("2 full god", aa.canAccessMature());
- ensure("3 full god", aa.canAccessAdult());
+ ensure("1 full god", !aa.wantsPGOnly());
+ ensure("2 full god", aa.canAccessMature());
+ ensure("3 full god", aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- aa.setGodLevel(GOD_NOT);
- aa.setAdminOverride(true);
+
+ aa.setGodLevel(GOD_NOT);
+ aa.setAdminOverride(true);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 admin mode", !aa.wantsPGOnly());
- ensure("2 admin mode", aa.canAccessMature());
- ensure("3 admin mode", aa.canAccessAdult());
+ ensure("1 admin mode", !aa.wantsPGOnly());
+ ensure("2 admin mode", aa.canAccessMature());
+ ensure("3 admin mode", aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
- aa.setAdminOverride(false);
- aa.setMaturity('M');
- // preferred is still pg by default
+ aa.setAdminOverride(false);
+ aa.setMaturity('M');
+ // preferred is still pg by default
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 mature pref pg", aa.wantsPGOnly());
- ensure("2 mature pref pg", !aa.canAccessMature());
- ensure("3 mature pref pg", !aa.canAccessAdult());
+ ensure("1 mature pref pg", aa.wantsPGOnly());
+ ensure("2 mature pref pg", !aa.canAccessMature());
+ ensure("3 mature pref pg", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 mature", !aa.wantsPGOnly());
- ensure("2 mature", aa.canAccessMature());
- ensure("3 mature", !aa.canAccessAdult());
+ ensure("1 mature", !aa.wantsPGOnly());
+ ensure("2 mature", aa.canAccessMature());
+ ensure("3 mature", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_PG);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_PG);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 mature pref pg", aa.wantsPGOnly());
- ensure("2 mature pref pg", !aa.canAccessMature());
- ensure("3 mature pref pg", !aa.canAccessAdult());
+ ensure("1 mature pref pg", aa.wantsPGOnly());
+ ensure("2 mature pref pg", !aa.canAccessMature());
+ ensure("3 mature pref pg", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- aa.setMaturity('A');
+
+ aa.setMaturity('A');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 adult pref pg", aa.wantsPGOnly());
- ensure("2 adult pref pg", !aa.canAccessMature());
- ensure("3 adult pref pg", !aa.canAccessAdult());
+ ensure("1 adult pref pg", aa.wantsPGOnly());
+ ensure("2 adult pref pg", !aa.canAccessMature());
+ ensure("3 adult pref pg", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
- cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 adult", !aa.wantsPGOnly());
- ensure("2 adult", aa.canAccessMature());
- ensure("3 adult", aa.canAccessAdult());
+ ensure("1 adult", !aa.wantsPGOnly());
+ ensure("2 adult", aa.canAccessMature());
+ ensure("3 adult", aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
- // make sure that even if pref is high, if access is low we block access
- // this shouldn't occur in real life but we want to be safe
- cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
- aa.setMaturity('P');
+ // make sure that even if pref is high, if access is low we block access
+ // this shouldn't occur in real life but we want to be safe
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
+ aa.setMaturity('P');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 pref adult, actual pg", aa.wantsPGOnly());
- ensure("2 pref adult, actual pg", !aa.canAccessMature());
- ensure("3 pref adult, actual pg", !aa.canAccessAdult());
+ ensure("1 pref adult, actual pg", aa.wantsPGOnly());
+ ensure("2 pref adult, actual pg", !aa.canAccessMature());
+ ensure("3 pref adult, actual pg", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- }
-
- template<> template<>
- void agentaccess_object_t::test<5>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
- aa.setMaturity('M');
+
+ }
+
+ template<> template<>
+ void agentaccess_object_t::test<5>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
+ aa.setMaturity('M');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 preferred maturity pegged to M when maturity is M", cgr.getU32("PreferredMaturity") == SIM_ACCESS_MATURE);
+ ensure("1 preferred maturity pegged to M when maturity is M", cgr.getU32("PreferredMaturity") == SIM_ACCESS_MATURE);
#endif // HACKED_GODLIKE_VIEWER
-
- aa.setMaturity('P');
+
+ aa.setMaturity('P');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 preferred maturity pegged to P when maturity is P", cgr.getU32("PreferredMaturity") == SIM_ACCESS_PG);
+ ensure("1 preferred maturity pegged to P when maturity is P", cgr.getU32("PreferredMaturity") == SIM_ACCESS_PG);
#endif // HACKED_GODLIKE_VIEWER
- }
+ }
}
diff --git a/indra/newview/tests/lldateutil_test.cpp b/indra/newview/tests/lldateutil_test.cpp
index 62158d8f66..e9d4982e35 100644
--- a/indra/newview/tests/lldateutil_test.cpp
+++ b/indra/newview/tests/lldateutil_test.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file lldateutil_test.cpp
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -30,7 +30,7 @@
#include "../lldateutil.h"
#include "lldate.h"
-#include "llstring.h" // LLStringUtil::format()
+#include "llstring.h" // LLStringUtil::format()
#include "lltrans.h"
#include "llui.h"
@@ -47,150 +47,150 @@ std::map< count_string_t, std::string > gCountString;
std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
{
- std::string text = gString[xml_desc];
- LLStringUtil::format(text, args);
- return text;
+ std::string text = gString[xml_desc];
+ LLStringUtil::format(text, args);
+ return text;
}
std::string LLTrans::getCountString(const std::string& language, const std::string& xml_desc, S32 count)
{
- count_string_t key(xml_desc, count);
- if (gCountString.find(key) == gCountString.end())
- {
- return std::string("Couldn't find ") + xml_desc;
- }
- return gCountString[ count_string_t(xml_desc, count) ];
+ count_string_t key(xml_desc, count);
+ if (gCountString.find(key) == gCountString.end())
+ {
+ return std::string("Couldn't find ") + xml_desc;
+ }
+ return gCountString[ count_string_t(xml_desc, count) ];
}
std::string LLUI::getLanguage()
{
- return "en";
+ return "en";
}
namespace tut
{
struct dateutil
{
- // Hard-code a "now" date so unit test doesn't change with
- // current time. Because server strings are in Pacific time
- // roll this forward 8 hours to compensate. This represents
- // 2009-12-31T00:00:00Z UTC.
- dateutil()
- : mNow(std::string("2009-12-31T08:00:00Z"))
- {
- // copied from strings.xml
- gString["YearsMonthsOld"] = "[AGEYEARS] [AGEMONTHS] old";
- gString["YearsOld"] = "[AGEYEARS] old";
- gString["MonthsOld"] = "[AGEMONTHS] old";
- gString["WeeksOld"] = "[AGEWEEKS] old";
- gString["DaysOld"] = "[AGEDAYS] old";
- gString["TodayOld"] = "Joined today";
-
- gCountString[ count_string_t("AgeYears", 1) ] = "1 year";
- gCountString[ count_string_t("AgeYears", 2) ] = "2 years";
- gCountString[ count_string_t("AgeMonths", 1) ] = "1 month";
- gCountString[ count_string_t("AgeMonths", 2) ] = "2 months";
- gCountString[ count_string_t("AgeMonths", 11) ]= "11 months";
- gCountString[ count_string_t("AgeWeeks", 1) ] = "1 week";
- gCountString[ count_string_t("AgeWeeks", 2) ] = "2 weeks";
- gCountString[ count_string_t("AgeWeeks", 3) ] = "3 weeks";
- gCountString[ count_string_t("AgeWeeks", 4) ] = "4 weeks";
- gCountString[ count_string_t("AgeDays", 1) ] = "1 day";
- gCountString[ count_string_t("AgeDays", 2) ] = "2 days";
- }
- LLDate mNow;
+ // Hard-code a "now" date so unit test doesn't change with
+ // current time. Because server strings are in Pacific time
+ // roll this forward 8 hours to compensate. This represents
+ // 2009-12-31T00:00:00Z UTC.
+ dateutil()
+ : mNow(std::string("2009-12-31T08:00:00Z"))
+ {
+ // copied from strings.xml
+ gString["YearsMonthsOld"] = "[AGEYEARS] [AGEMONTHS] old";
+ gString["YearsOld"] = "[AGEYEARS] old";
+ gString["MonthsOld"] = "[AGEMONTHS] old";
+ gString["WeeksOld"] = "[AGEWEEKS] old";
+ gString["DaysOld"] = "[AGEDAYS] old";
+ gString["TodayOld"] = "Joined today";
+
+ gCountString[ count_string_t("AgeYears", 1) ] = "1 year";
+ gCountString[ count_string_t("AgeYears", 2) ] = "2 years";
+ gCountString[ count_string_t("AgeMonths", 1) ] = "1 month";
+ gCountString[ count_string_t("AgeMonths", 2) ] = "2 months";
+ gCountString[ count_string_t("AgeMonths", 11) ]= "11 months";
+ gCountString[ count_string_t("AgeWeeks", 1) ] = "1 week";
+ gCountString[ count_string_t("AgeWeeks", 2) ] = "2 weeks";
+ gCountString[ count_string_t("AgeWeeks", 3) ] = "3 weeks";
+ gCountString[ count_string_t("AgeWeeks", 4) ] = "4 weeks";
+ gCountString[ count_string_t("AgeDays", 1) ] = "1 day";
+ gCountString[ count_string_t("AgeDays", 2) ] = "2 days";
+ }
+ LLDate mNow;
};
-
- typedef test_group<dateutil> dateutil_t;
- typedef dateutil_t::object dateutil_object_t;
- tut::dateutil_t tut_dateutil("LLDateUtil");
-
- template<> template<>
- void dateutil_object_t::test<1>()
- {
- set_test_name("Years");
- ensure_equals("years + months",
- LLDateUtil::ageFromDate("10/30/2007", mNow),
- "2 years 2 months old" );
- ensure_equals("years",
- LLDateUtil::ageFromDate("12/31/2007", mNow),
- "2 years old" );
- ensure_equals("years",
- LLDateUtil::ageFromDate("1/1/2008", mNow),
- "1 year 11 months old" );
- ensure_equals("single year + one month",
- LLDateUtil::ageFromDate("11/30/2008", mNow),
- "1 year 1 month old" );
- ensure_equals("single year + a bit",
- LLDateUtil::ageFromDate("12/12/2008", mNow),
- "1 year old" );
- ensure_equals("single year",
- LLDateUtil::ageFromDate("12/31/2008", mNow),
- "1 year old" );
+
+ typedef test_group<dateutil> dateutil_t;
+ typedef dateutil_t::object dateutil_object_t;
+ tut::dateutil_t tut_dateutil("LLDateUtil");
+
+ template<> template<>
+ void dateutil_object_t::test<1>()
+ {
+ set_test_name("Years");
+ ensure_equals("years + months",
+ LLDateUtil::ageFromDate("10/30/2007", mNow),
+ "2 years 2 months old" );
+ ensure_equals("years",
+ LLDateUtil::ageFromDate("12/31/2007", mNow),
+ "2 years old" );
+ ensure_equals("years",
+ LLDateUtil::ageFromDate("1/1/2008", mNow),
+ "1 year 11 months old" );
+ ensure_equals("single year + one month",
+ LLDateUtil::ageFromDate("11/30/2008", mNow),
+ "1 year 1 month old" );
+ ensure_equals("single year + a bit",
+ LLDateUtil::ageFromDate("12/12/2008", mNow),
+ "1 year old" );
+ ensure_equals("single year",
+ LLDateUtil::ageFromDate("12/31/2008", mNow),
+ "1 year old" );
+ }
+
+ template<> template<>
+ void dateutil_object_t::test<2>()
+ {
+ set_test_name("Months");
+ ensure_equals("months",
+ LLDateUtil::ageFromDate("10/30/2009", mNow),
+ "2 months old" );
+ ensure_equals("months 2",
+ LLDateUtil::ageFromDate("10/31/2009", mNow),
+ "2 months old" );
+ ensure_equals("single month",
+ LLDateUtil::ageFromDate("11/30/2009", mNow),
+ "1 month old" );
+ }
+
+ template<> template<>
+ void dateutil_object_t::test<3>()
+ {
+ set_test_name("Weeks");
+ ensure_equals("4 weeks",
+ LLDateUtil::ageFromDate("12/1/2009", mNow),
+ "4 weeks old" );
+ ensure_equals("weeks",
+ LLDateUtil::ageFromDate("12/17/2009", mNow),
+ "2 weeks old" );
+ ensure_equals("single week",
+ LLDateUtil::ageFromDate("12/24/2009", mNow),
+ "1 week old" );
+ }
+
+ template<> template<>
+ void dateutil_object_t::test<4>()
+ {
+ set_test_name("Days");
+ ensure_equals("days",
+ LLDateUtil::ageFromDate("12/29/2009", mNow),
+ "2 days old" );
+ ensure_equals("single day",
+ LLDateUtil::ageFromDate("12/30/2009", mNow),
+ "1 day old" );
+ ensure_equals("today",
+ LLDateUtil::ageFromDate("12/31/2009", mNow),
+ "Joined today" );
+ }
+
+ template<> template<>
+ void dateutil_object_t::test<5>()
+ {
+ set_test_name("2010 rollover");
+ LLDate now(std::string("2010-01-04T12:00:00Z"));
+ ensure_equals("days",
+ LLDateUtil::ageFromDate("12/13/2009", now),
+ "3 weeks old" );
}
- template<> template<>
- void dateutil_object_t::test<2>()
- {
- set_test_name("Months");
- ensure_equals("months",
- LLDateUtil::ageFromDate("10/30/2009", mNow),
- "2 months old" );
- ensure_equals("months 2",
- LLDateUtil::ageFromDate("10/31/2009", mNow),
- "2 months old" );
- ensure_equals("single month",
- LLDateUtil::ageFromDate("11/30/2009", mNow),
- "1 month old" );
- }
-
- template<> template<>
- void dateutil_object_t::test<3>()
- {
- set_test_name("Weeks");
- ensure_equals("4 weeks",
- LLDateUtil::ageFromDate("12/1/2009", mNow),
- "4 weeks old" );
- ensure_equals("weeks",
- LLDateUtil::ageFromDate("12/17/2009", mNow),
- "2 weeks old" );
- ensure_equals("single week",
- LLDateUtil::ageFromDate("12/24/2009", mNow),
- "1 week old" );
- }
-
- template<> template<>
- void dateutil_object_t::test<4>()
- {
- set_test_name("Days");
- ensure_equals("days",
- LLDateUtil::ageFromDate("12/29/2009", mNow),
- "2 days old" );
- ensure_equals("single day",
- LLDateUtil::ageFromDate("12/30/2009", mNow),
- "1 day old" );
- ensure_equals("today",
- LLDateUtil::ageFromDate("12/31/2009", mNow),
- "Joined today" );
- }
-
- template<> template<>
- void dateutil_object_t::test<5>()
- {
- set_test_name("2010 rollover");
- LLDate now(std::string("2010-01-04T12:00:00Z"));
- ensure_equals("days",
- LLDateUtil::ageFromDate("12/13/2009", now),
- "3 weeks old" );
- }
-
- //template<> template<>
- //void dateutil_object_t::test<6>()
- //{
- // set_test_name("ISO dates");
- // LLDate now(std::string("2010-01-04T12:00:00Z"));
- // ensure_equals("days",
- // LLDateUtil::ageFromDateISO("2009-12-13", now),
- // "3 weeks old" );
- //}
+ //template<> template<>
+ //void dateutil_object_t::test<6>()
+ //{
+ // set_test_name("ISO dates");
+ // LLDate now(std::string("2010-01-04T12:00:00Z"));
+ // ensure_equals("days",
+ // LLDateUtil::ageFromDateISO("2009-12-13", now),
+ // "3 weeks old" );
+ //}
}
diff --git a/indra/newview/tests/lldir_stub.cpp b/indra/newview/tests/lldir_stub.cpp
index 911e9334dd..5d9c2f718b 100644
--- a/indra/newview/tests/lldir_stub.cpp
+++ b/indra/newview/tests/lldir_stub.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldir_stub.cpp
* @brief stub class to allow unit testing
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,9 +46,9 @@ public:
LLDir_stub() = default;
~LLDir_stub() = default;
- void initAppDirs(const std::string &app_name, const std::string &) override {}
+ void initAppDirs(const std::string &app_name, const std::string &) override {}
- std::string getCurPath() override { return "CUR_PATH_FROM_LLDIR"; }
+ std::string getCurPath() override { return "CUR_PATH_FROM_LLDIR"; }
bool fileExists(const std::string &filename) const override { return false; }
std::string getLLPluginLauncher() override { return ""; }
@@ -61,7 +61,7 @@ LLDir* gDirUtilp = &gDirUtil;
std::string LLDir::getExpandedFilename(ELLPath loc, const std::string& subdir, const std::string& filename) const
{
- return subdir + " --- " + filename + " --- expanded!";
+ return subdir + " --- " + filename + " --- expanded!";
}
std::string LLDir::getExpandedFilename(ELLPath location, const std::string &filename) const
diff --git a/indra/newview/tests/llglslshader_stub.cpp b/indra/newview/tests/llglslshader_stub.cpp
index 8947a632c8..537434a6d8 100644
--- a/indra/newview/tests/llglslshader_stub.cpp
+++ b/indra/newview/tests/llglslshader_stub.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llglslshader_stub.cpp
* @brief stub class to allow unit testing
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/tests/llhttpretrypolicy_test.cpp b/indra/newview/tests/llhttpretrypolicy_test.cpp
index 21c83184dc..5c995c807b 100644
--- a/indra/newview/tests/llhttpretrypolicy_test.cpp
+++ b/indra/newview/tests/llhttpretrypolicy_test.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llhttpretrypolicy_test.cpp
* @brief Header tests to exercise the LLHTTPRetryPolicy classes.
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,141 +34,141 @@ struct TestData
{
};
-typedef test_group<TestData> RetryPolicyTestGroup;
-typedef RetryPolicyTestGroup::object RetryPolicyTestObject;
+typedef test_group<TestData> RetryPolicyTestGroup;
+typedef RetryPolicyTestGroup::object RetryPolicyTestObject;
RetryPolicyTestGroup retryPolicyTestGroup("retry_policy");
template<> template<>
void RetryPolicyTestObject::test<1>()
{
- LLAdaptiveRetryPolicy never_retry(1.0,1.0,1.0,0);
- LLSD headers;
- F32 wait_seconds;
-
- // No retry until we've failed a try.
- ensure("never retry 0", !never_retry.shouldRetry(wait_seconds));
-
- // 0 retries max.
- never_retry.onFailure(500,headers);
- ensure("never retry 1", !never_retry.shouldRetry(wait_seconds));
+ LLAdaptiveRetryPolicy never_retry(1.0,1.0,1.0,0);
+ LLSD headers;
+ F32 wait_seconds;
+
+ // No retry until we've failed a try.
+ ensure("never retry 0", !never_retry.shouldRetry(wait_seconds));
+
+ // 0 retries max.
+ never_retry.onFailure(500,headers);
+ ensure("never retry 1", !never_retry.shouldRetry(wait_seconds));
}
template<> template<>
void RetryPolicyTestObject::test<2>()
{
- LLSD headers;
- F32 wait_seconds;
-
- // Normally only retry on server error (5xx)
- LLAdaptiveRetryPolicy noRetry404(1.0,2.0,3.0,10);
- noRetry404.onFailure(404,headers);
- ensure("no retry on 404", !noRetry404.shouldRetry(wait_seconds));
-
- // Can retry on 4xx errors if enabled by flag.
- bool do_retry_4xx = true;
- LLAdaptiveRetryPolicy doRetry404(1.0,2.0,3.0,10,do_retry_4xx);
- doRetry404.onFailure(404,headers);
- ensure("do retry on 404", doRetry404.shouldRetry(wait_seconds));
+ LLSD headers;
+ F32 wait_seconds;
+
+ // Normally only retry on server error (5xx)
+ LLAdaptiveRetryPolicy noRetry404(1.0,2.0,3.0,10);
+ noRetry404.onFailure(404,headers);
+ ensure("no retry on 404", !noRetry404.shouldRetry(wait_seconds));
+
+ // Can retry on 4xx errors if enabled by flag.
+ bool do_retry_4xx = true;
+ LLAdaptiveRetryPolicy doRetry404(1.0,2.0,3.0,10,do_retry_4xx);
+ doRetry404.onFailure(404,headers);
+ ensure("do retry on 404", doRetry404.shouldRetry(wait_seconds));
}
template<> template<>
void RetryPolicyTestObject::test<3>()
{
- // Should retry after 1.0, 2.0, 3.0, 3.0 seconds.
- LLAdaptiveRetryPolicy basic_retry(1.0,3.0,2.0,4);
- LLSD headers;
- F32 wait_seconds;
- bool should_retry;
- U32 frac_bits = 6;
-
- // No retry until we've failed a try.
- ensure("basic_retry 0", !basic_retry.shouldRetry(wait_seconds));
-
- // Starting wait 1.0
- basic_retry.onFailure(500,headers);
- should_retry = basic_retry.shouldRetry(wait_seconds);
- ensure("basic_retry 1", should_retry);
- ensure_approximately_equals("basic_retry 1", wait_seconds, 1.0F, frac_bits);
-
- // Double wait to 2.0
- basic_retry.onFailure(500,headers);
- should_retry = basic_retry.shouldRetry(wait_seconds);
- ensure("basic_retry 2", should_retry);
- ensure_approximately_equals("basic_retry 2", wait_seconds, 2.0F, frac_bits);
-
- // Hit max wait of 3.0 (4.0 clamped to max 3)
- basic_retry.onFailure(500,headers);
- should_retry = basic_retry.shouldRetry(wait_seconds);
- ensure("basic_retry 3", should_retry);
- ensure_approximately_equals("basic_retry 3", wait_seconds, 3.0F, frac_bits);
-
- // At max wait, should stay at 3.0
- basic_retry.onFailure(500,headers);
- should_retry = basic_retry.shouldRetry(wait_seconds);
- ensure("basic_retry 4", should_retry);
- ensure_approximately_equals("basic_retry 4", wait_seconds, 3.0F, frac_bits);
-
- // Max retries, should fail now.
- basic_retry.onFailure(500,headers);
- should_retry = basic_retry.shouldRetry(wait_seconds);
- ensure("basic_retry 5", !should_retry);
-
- // Max retries, should fail now.
- basic_retry.onFailure(500,headers);
- should_retry = basic_retry.shouldRetry(wait_seconds);
- ensure("basic_retry 5", !should_retry);
-
- // After a success, should reset to the starting state.
- basic_retry.onSuccess();
-
- // No retry until we've failed a try.
- ensure("basic_retry 6", !basic_retry.shouldRetry(wait_seconds));
-
- // Starting wait 1.0
- basic_retry.onFailure(500,headers);
- should_retry = basic_retry.shouldRetry(wait_seconds);
- ensure("basic_retry 7", should_retry);
- ensure_approximately_equals("basic_retry 7", wait_seconds, 1.0F, frac_bits);
-
- // Double wait to 2.0
- basic_retry.onFailure(500,headers);
- should_retry = basic_retry.shouldRetry(wait_seconds);
- ensure("basic_retry 8", should_retry);
- ensure_approximately_equals("basic_retry 8", wait_seconds, 2.0F, frac_bits);
+ // Should retry after 1.0, 2.0, 3.0, 3.0 seconds.
+ LLAdaptiveRetryPolicy basic_retry(1.0,3.0,2.0,4);
+ LLSD headers;
+ F32 wait_seconds;
+ bool should_retry;
+ U32 frac_bits = 6;
+
+ // No retry until we've failed a try.
+ ensure("basic_retry 0", !basic_retry.shouldRetry(wait_seconds));
+
+ // Starting wait 1.0
+ basic_retry.onFailure(500,headers);
+ should_retry = basic_retry.shouldRetry(wait_seconds);
+ ensure("basic_retry 1", should_retry);
+ ensure_approximately_equals("basic_retry 1", wait_seconds, 1.0F, frac_bits);
+
+ // Double wait to 2.0
+ basic_retry.onFailure(500,headers);
+ should_retry = basic_retry.shouldRetry(wait_seconds);
+ ensure("basic_retry 2", should_retry);
+ ensure_approximately_equals("basic_retry 2", wait_seconds, 2.0F, frac_bits);
+
+ // Hit max wait of 3.0 (4.0 clamped to max 3)
+ basic_retry.onFailure(500,headers);
+ should_retry = basic_retry.shouldRetry(wait_seconds);
+ ensure("basic_retry 3", should_retry);
+ ensure_approximately_equals("basic_retry 3", wait_seconds, 3.0F, frac_bits);
+
+ // At max wait, should stay at 3.0
+ basic_retry.onFailure(500,headers);
+ should_retry = basic_retry.shouldRetry(wait_seconds);
+ ensure("basic_retry 4", should_retry);
+ ensure_approximately_equals("basic_retry 4", wait_seconds, 3.0F, frac_bits);
+
+ // Max retries, should fail now.
+ basic_retry.onFailure(500,headers);
+ should_retry = basic_retry.shouldRetry(wait_seconds);
+ ensure("basic_retry 5", !should_retry);
+
+ // Max retries, should fail now.
+ basic_retry.onFailure(500,headers);
+ should_retry = basic_retry.shouldRetry(wait_seconds);
+ ensure("basic_retry 5", !should_retry);
+
+ // After a success, should reset to the starting state.
+ basic_retry.onSuccess();
+
+ // No retry until we've failed a try.
+ ensure("basic_retry 6", !basic_retry.shouldRetry(wait_seconds));
+
+ // Starting wait 1.0
+ basic_retry.onFailure(500,headers);
+ should_retry = basic_retry.shouldRetry(wait_seconds);
+ ensure("basic_retry 7", should_retry);
+ ensure_approximately_equals("basic_retry 7", wait_seconds, 1.0F, frac_bits);
+
+ // Double wait to 2.0
+ basic_retry.onFailure(500,headers);
+ should_retry = basic_retry.shouldRetry(wait_seconds);
+ ensure("basic_retry 8", should_retry);
+ ensure_approximately_equals("basic_retry 8", wait_seconds, 2.0F, frac_bits);
}
// Retries should stop as soon as a non-5xx error is received.
template<> template<>
void RetryPolicyTestObject::test<4>()
{
- // Should retry after 1.0, 2.0, 3.0, 3.0 seconds.
- LLAdaptiveRetryPolicy killer404(1.0,3.0,2.0,4);
- LLSD headers;
- F32 wait_seconds;
- bool should_retry;
- U32 frac_bits = 6;
-
- // Starting wait 1.0
- killer404.onFailure(500,headers);
- should_retry = killer404.shouldRetry(wait_seconds);
- ensure("killer404 1", should_retry);
- ensure_approximately_equals("killer404 1", wait_seconds, 1.0F, frac_bits);
-
- // Double wait to 2.0
- killer404.onFailure(500,headers);
- should_retry = killer404.shouldRetry(wait_seconds);
- ensure("killer404 2", should_retry);
- ensure_approximately_equals("killer404 2", wait_seconds, 2.0F, frac_bits);
-
- // Should fail on non-5xx
- killer404.onFailure(404,headers);
- should_retry = killer404.shouldRetry(wait_seconds);
- ensure("killer404 3", !should_retry);
-
- // After a non-5xx, should keep failing.
- killer404.onFailure(500,headers);
- should_retry = killer404.shouldRetry(wait_seconds);
- ensure("killer404 4", !should_retry);
+ // Should retry after 1.0, 2.0, 3.0, 3.0 seconds.
+ LLAdaptiveRetryPolicy killer404(1.0,3.0,2.0,4);
+ LLSD headers;
+ F32 wait_seconds;
+ bool should_retry;
+ U32 frac_bits = 6;
+
+ // Starting wait 1.0
+ killer404.onFailure(500,headers);
+ should_retry = killer404.shouldRetry(wait_seconds);
+ ensure("killer404 1", should_retry);
+ ensure_approximately_equals("killer404 1", wait_seconds, 1.0F, frac_bits);
+
+ // Double wait to 2.0
+ killer404.onFailure(500,headers);
+ should_retry = killer404.shouldRetry(wait_seconds);
+ ensure("killer404 2", should_retry);
+ ensure_approximately_equals("killer404 2", wait_seconds, 2.0F, frac_bits);
+
+ // Should fail on non-5xx
+ killer404.onFailure(404,headers);
+ should_retry = killer404.shouldRetry(wait_seconds);
+ ensure("killer404 3", !should_retry);
+
+ // After a non-5xx, should keep failing.
+ killer404.onFailure(500,headers);
+ should_retry = killer404.shouldRetry(wait_seconds);
+ ensure("killer404 4", !should_retry);
}
// Test handling of "retry-after" header. If present, this header
@@ -179,49 +179,49 @@ void RetryPolicyTestObject::test<4>()
template<> template<>
void RetryPolicyTestObject::test<5>()
{
- LLAdaptiveRetryPolicy policy(1.0,25.0,2.0,6);
- LLSD headers_with_retry;
- headers_with_retry[HTTP_IN_HEADER_RETRY_AFTER] = "666";
- LLSD headers_without_retry;
- F32 wait_seconds;
- bool should_retry;
- U32 frac_bits = 6;
-
- policy.onFailure(500,headers_without_retry);
- should_retry = policy.shouldRetry(wait_seconds);
- ensure("retry header 1", should_retry);
- ensure_approximately_equals("retry header 1", wait_seconds, 1.0F, frac_bits);
-
- policy.onFailure(500,headers_without_retry);
- should_retry = policy.shouldRetry(wait_seconds);
- ensure("retry header 2", should_retry);
- ensure_approximately_equals("retry header 2", wait_seconds, 2.0F, frac_bits);
-
- policy.onFailure(500,headers_with_retry);
- should_retry = policy.shouldRetry(wait_seconds);
- ensure("retry header 3", should_retry);
- // 4.0 overrides by header -> 666.0
- ensure_approximately_equals("retry header 3", wait_seconds, 666.0F, frac_bits);
-
- policy.onFailure(500,headers_with_retry);
- should_retry = policy.shouldRetry(wait_seconds);
- ensure("retry header 4", should_retry);
- // 8.0 overrides by header -> 666.0
- ensure_approximately_equals("retry header 4", wait_seconds, 666.0F, frac_bits);
-
- policy.onFailure(500,headers_without_retry);
- should_retry = policy.shouldRetry(wait_seconds);
- ensure("retry header 5", should_retry);
- ensure_approximately_equals("retry header 5", wait_seconds, 16.0F, frac_bits);
-
- policy.onFailure(500,headers_without_retry);
- should_retry = policy.shouldRetry(wait_seconds);
- ensure("retry header 6", should_retry);
- ensure_approximately_equals("retry header 6", wait_seconds, 25.0F, frac_bits);
-
- policy.onFailure(500,headers_with_retry);
- should_retry = policy.shouldRetry(wait_seconds);
- ensure("retry header 7", !should_retry);
+ LLAdaptiveRetryPolicy policy(1.0,25.0,2.0,6);
+ LLSD headers_with_retry;
+ headers_with_retry[HTTP_IN_HEADER_RETRY_AFTER] = "666";
+ LLSD headers_without_retry;
+ F32 wait_seconds;
+ bool should_retry;
+ U32 frac_bits = 6;
+
+ policy.onFailure(500,headers_without_retry);
+ should_retry = policy.shouldRetry(wait_seconds);
+ ensure("retry header 1", should_retry);
+ ensure_approximately_equals("retry header 1", wait_seconds, 1.0F, frac_bits);
+
+ policy.onFailure(500,headers_without_retry);
+ should_retry = policy.shouldRetry(wait_seconds);
+ ensure("retry header 2", should_retry);
+ ensure_approximately_equals("retry header 2", wait_seconds, 2.0F, frac_bits);
+
+ policy.onFailure(500,headers_with_retry);
+ should_retry = policy.shouldRetry(wait_seconds);
+ ensure("retry header 3", should_retry);
+ // 4.0 overrides by header -> 666.0
+ ensure_approximately_equals("retry header 3", wait_seconds, 666.0F, frac_bits);
+
+ policy.onFailure(500,headers_with_retry);
+ should_retry = policy.shouldRetry(wait_seconds);
+ ensure("retry header 4", should_retry);
+ // 8.0 overrides by header -> 666.0
+ ensure_approximately_equals("retry header 4", wait_seconds, 666.0F, frac_bits);
+
+ policy.onFailure(500,headers_without_retry);
+ should_retry = policy.shouldRetry(wait_seconds);
+ ensure("retry header 5", should_retry);
+ ensure_approximately_equals("retry header 5", wait_seconds, 16.0F, frac_bits);
+
+ policy.onFailure(500,headers_without_retry);
+ should_retry = policy.shouldRetry(wait_seconds);
+ ensure("retry header 6", should_retry);
+ ensure_approximately_equals("retry header 6", wait_seconds, 25.0F, frac_bits);
+
+ policy.onFailure(500,headers_with_retry);
+ should_retry = policy.shouldRetry(wait_seconds);
+ ensure("retry header 7", !should_retry);
}
// Test getSecondsUntilRetryAfter(const std::string& retry_after, F32& seconds_to_wait),
@@ -229,99 +229,99 @@ void RetryPolicyTestObject::test<5>()
template<> template<>
void RetryPolicyTestObject::test<6>()
{
- F32 seconds_to_wait;
- bool success;
+ F32 seconds_to_wait;
+ bool success;
- std::string str1("0");
- seconds_to_wait = F32_MAX;
+ std::string str1("0");
+ seconds_to_wait = F32_MAX;
success = LLAdaptiveRetryPolicy::getSecondsUntilRetryAfter(str1, seconds_to_wait);
- ensure("parse 1", success);
- ensure_equals("parse 1", seconds_to_wait, 0.0);
+ ensure("parse 1", success);
+ ensure_equals("parse 1", seconds_to_wait, 0.0);
- std::string str2("999.9");
- seconds_to_wait = F32_MAX;
+ std::string str2("999.9");
+ seconds_to_wait = F32_MAX;
success = LLAdaptiveRetryPolicy::getSecondsUntilRetryAfter(str2, seconds_to_wait);
- ensure("parse 2", success);
- ensure_approximately_equals("parse 2", seconds_to_wait, 999.9F, 8);
+ ensure("parse 2", success);
+ ensure_approximately_equals("parse 2", seconds_to_wait, 999.9F, 8);
- time_t nowseconds;
- time(&nowseconds);
- std::string str3 = LLDate((F64)(nowseconds+44)).asRFC1123();
- seconds_to_wait = F32_MAX;
+ time_t nowseconds;
+ time(&nowseconds);
+ std::string str3 = LLDate((F64)(nowseconds+44)).asRFC1123();
+ seconds_to_wait = F32_MAX;
success = LLAdaptiveRetryPolicy::getSecondsUntilRetryAfter(str3, seconds_to_wait);
- std::cerr << " str3 [" << str3 << "]" << std::endl;
- ensure("parse 3", success);
- ensure_approximately_equals_range("parse 3", seconds_to_wait, 44.0F, 2.0F);
+ std::cerr << " str3 [" << str3 << "]" << std::endl;
+ ensure("parse 3", success);
+ ensure_approximately_equals_range("parse 3", seconds_to_wait, 44.0F, 2.0F);
}
// Test retry-after field in both llmessage and CoreHttp headers.
template<> template<>
void RetryPolicyTestObject::test<7>()
{
- std::cerr << "7 starts" << std::endl;
-
- LLSD sd_headers;
- time_t nowseconds;
- time(&nowseconds);
- LLAdaptiveRetryPolicy policy(17.0,644.0,3.0,5);
- F32 seconds_to_wait;
- bool should_retry;
-
- // No retry until we've failed a try.
- ensure("header 0", !policy.shouldRetry(seconds_to_wait));
-
- // no retry header, use default.
- policy.onFailure(500,LLSD());
- should_retry = policy.shouldRetry(seconds_to_wait);
- ensure("header 1", should_retry);
- ensure_approximately_equals("header 1", seconds_to_wait, 17.0F, 6);
-
- // retry header should override, give delay of 0
- std::string date_string = LLDate((F64)(nowseconds+7)).asRFC1123();
- sd_headers[HTTP_IN_HEADER_RETRY_AFTER] = date_string;
- policy.onFailure(503,sd_headers);
- should_retry = policy.shouldRetry(seconds_to_wait);
- ensure("header 2", should_retry);
- ensure_approximately_equals_range("header 2", seconds_to_wait, 7.0F, 2.0F);
-
- LLCore::HttpResponse *response;
- LLCore::HttpHeaders::ptr_t headers;
-
- response = new LLCore::HttpResponse();
- headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
- response->setStatus(503);
- response->setHeaders(headers);
- headers->append(HTTP_IN_HEADER_RETRY_AFTER, std::string("600"));
- policy.onFailure(response);
- should_retry = policy.shouldRetry(seconds_to_wait);
- ensure("header 3",should_retry);
- ensure_approximately_equals("header 3", seconds_to_wait, 600.0F, 6);
- response->release();
-
- response = new LLCore::HttpResponse();
- headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
- response->setStatus(503);
- response->setHeaders(headers);
- time(&nowseconds);
- date_string = LLDate((F64)(nowseconds+77)).asRFC1123();
- std::cerr << "date_string [" << date_string << "]" << std::endl;
- headers->append(HTTP_IN_HEADER_RETRY_AFTER,date_string);
- policy.onFailure(response);
- should_retry = policy.shouldRetry(seconds_to_wait);
- ensure("header 4",should_retry);
- ensure_approximately_equals_range("header 4", seconds_to_wait, 77.0F, 2.0F);
- response->release();
-
- // Timeout should be clamped at max.
- policy.onFailure(500,LLSD());
- should_retry = policy.shouldRetry(seconds_to_wait);
- ensure("header 5", should_retry);
- ensure_approximately_equals("header 5", seconds_to_wait, 644.0F, 6);
-
- // No more retries.
- policy.onFailure(500,LLSD());
- should_retry = policy.shouldRetry(seconds_to_wait);
- ensure("header 6", !should_retry);
+ std::cerr << "7 starts" << std::endl;
+
+ LLSD sd_headers;
+ time_t nowseconds;
+ time(&nowseconds);
+ LLAdaptiveRetryPolicy policy(17.0,644.0,3.0,5);
+ F32 seconds_to_wait;
+ bool should_retry;
+
+ // No retry until we've failed a try.
+ ensure("header 0", !policy.shouldRetry(seconds_to_wait));
+
+ // no retry header, use default.
+ policy.onFailure(500,LLSD());
+ should_retry = policy.shouldRetry(seconds_to_wait);
+ ensure("header 1", should_retry);
+ ensure_approximately_equals("header 1", seconds_to_wait, 17.0F, 6);
+
+ // retry header should override, give delay of 0
+ std::string date_string = LLDate((F64)(nowseconds+7)).asRFC1123();
+ sd_headers[HTTP_IN_HEADER_RETRY_AFTER] = date_string;
+ policy.onFailure(503,sd_headers);
+ should_retry = policy.shouldRetry(seconds_to_wait);
+ ensure("header 2", should_retry);
+ ensure_approximately_equals_range("header 2", seconds_to_wait, 7.0F, 2.0F);
+
+ LLCore::HttpResponse *response;
+ LLCore::HttpHeaders::ptr_t headers;
+
+ response = new LLCore::HttpResponse();
+ headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
+ response->setStatus(503);
+ response->setHeaders(headers);
+ headers->append(HTTP_IN_HEADER_RETRY_AFTER, std::string("600"));
+ policy.onFailure(response);
+ should_retry = policy.shouldRetry(seconds_to_wait);
+ ensure("header 3",should_retry);
+ ensure_approximately_equals("header 3", seconds_to_wait, 600.0F, 6);
+ response->release();
+
+ response = new LLCore::HttpResponse();
+ headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
+ response->setStatus(503);
+ response->setHeaders(headers);
+ time(&nowseconds);
+ date_string = LLDate((F64)(nowseconds+77)).asRFC1123();
+ std::cerr << "date_string [" << date_string << "]" << std::endl;
+ headers->append(HTTP_IN_HEADER_RETRY_AFTER,date_string);
+ policy.onFailure(response);
+ should_retry = policy.shouldRetry(seconds_to_wait);
+ ensure("header 4",should_retry);
+ ensure_approximately_equals_range("header 4", seconds_to_wait, 77.0F, 2.0F);
+ response->release();
+
+ // Timeout should be clamped at max.
+ policy.onFailure(500,LLSD());
+ should_retry = policy.shouldRetry(seconds_to_wait);
+ ensure("header 5", should_retry);
+ ensure_approximately_equals("header 5", seconds_to_wait, 644.0F, 6);
+
+ // No more retries.
+ policy.onFailure(500,LLSD());
+ should_retry = policy.shouldRetry(seconds_to_wait);
+ ensure("header 6", !should_retry);
}
}
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index 696fe3536c..62250cbbfd 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -1,25 +1,25 @@
/**
* @file lllogininstance_test.cpp
* @brief Test for lllogininstance.cpp.
- *
+ *
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -83,33 +83,33 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::
{
return std::string("test_trans");
}
-
+
class LLLogin::Impl
{
};
LLLogin::LLLogin() {}
LLLogin::~LLLogin() {}
LLEventPump& LLLogin::getEventPump() { return gTestPump; }
-void LLLogin::connect(const std::string& uri, const LLSD& credentials)
+void LLLogin::connect(const std::string& uri, const LLSD& credentials)
{
- gLoginURI = uri;
- gLoginCreds = credentials;
+ gLoginURI = uri;
+ gLoginCreds = credentials;
}
-void LLLogin::disconnect()
+void LLLogin::disconnect()
{
- gDisconnectCalled = true;
+ gDisconnectCalled = true;
}
LLSD LLCredential::getLoginParams()
{
- LLSD result = LLSD::emptyMap();
+ LLSD result = LLSD::emptyMap();
- // legacy credential
- result["passwd"] = "$1$testpasssd";
- result["first"] = "myfirst";
- result["last"] ="mylast";
- return result;
+ // legacy credential
+ result["passwd"] = "$1$testpasssd";
+ result["first"] = "myfirst";
+ result["last"] ="mylast";
+ return result;
}
void LLCredential::identifierType(std::string &idType)
{
@@ -119,9 +119,9 @@ void LLCredential::authenticatorType(std::string &idType)
{
}
-LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
- const LLSD& substitutions,
- const LLSD& payload,
+LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
+ const LLSD& substitutions,
+ const LLSD& payload,
boost::function<void (const LLSD&, const LLSD&)> functor)
{
return LLNotificationPtr((LLNotification*)NULL);
@@ -140,33 +140,33 @@ LLGridManager::~LLGridManager()
bool LLGridManager::addGrid(LLSD& grid_data)
{
- return true;
+ return true;
}
LLGridManager::LLGridManager()
:
- mIsInProductionGrid(false)
-{
+ mIsInProductionGrid(false)
+{
}
void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
{
- uris.push_back(VIEWERLOGIN_URI);
+ uris.push_back(VIEWERLOGIN_URI);
}
-void LLGridManager::addSystemGrid(const std::string& label,
- const std::string& name,
- const std::string& login,
- const std::string& helper,
- const std::string& login_page,
- const std::string& update_url_base,
- const std::string& web_profile_url,
- const std::string& login_id)
+void LLGridManager::addSystemGrid(const std::string& label,
+ const std::string& name,
+ const std::string& login,
+ const std::string& helper,
+ const std::string& login_page,
+ const std::string& update_url_base,
+ const std::string& web_profile_url,
+ const std::string& login_id)
{
}
std::map<std::string, std::string> LLGridManager::getKnownGrids()
{
- std::map<std::string, std::string> result;
- return result;
+ std::map<std::string, std::string> result;
+ return result;
}
void LLGridManager::setGridChoice(const std::string& grid_name)
@@ -175,16 +175,16 @@ void LLGridManager::setGridChoice(const std::string& grid_name)
bool LLGridManager::isInProductionGrid()
{
- return false;
+ return false;
}
std::string LLGridManager::getSLURLBase(const std::string& grid_name)
{
- return "myslurl";
+ return "myslurl";
}
std::string LLGridManager::getAppSLURLBase(const std::string& grid_name)
{
- return "myappslurl";
+ return "myappslurl";
}
std::string LLGridManager::getGridId(const std::string& grid)
{
@@ -196,7 +196,7 @@ std::string LLGridManager::getGridId(const std::string& grid)
LLControlGroup gSavedSettings("Global");
LLControlGroup::LLControlGroup(const std::string& name) :
- LLInstanceTracker<LLControlGroup, std::string>(name){}
+ LLInstanceTracker<LLControlGroup, std::string>(name){}
LLControlGroup::~LLControlGroup() {}
void LLControlGroup::setBOOL(const std::string& name, BOOL val) {}
BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; }
@@ -213,10 +213,10 @@ void LLUIColorTable::saveUserSettings(void)const {}
//-----------------------------------------------------------------------------
#include "../llversioninfo.h"
-bool llHashedUniqueID(unsigned char* id)
+bool llHashedUniqueID(unsigned char* id)
{
- memcpy( id, "66666666666666666666666666666666", MD5HEX_STR_SIZE );
- return true;
+ memcpy( id, "66666666666666666666666666666666", MD5HEX_STR_SIZE );
+ return true;
}
//-----------------------------------------------------------------------------
@@ -237,9 +237,9 @@ LLPointer<LLSecAPIHandler> gSecAPIHandler;
//static
LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus)
{
- gTOSType = name;
- gTOSReplyPump = &LLEventPumps::instance().obtain(key["reply_pump"]);
- return NULL;
+ gTOSType = name;
+ gTOSReplyPump = &LLEventPumps::instance().obtain(key["reply_pump"]);
+ return NULL;
}
//----------------------------------------------------------------------------
@@ -252,59 +252,59 @@ void LLProgressView::setMessage(std::string const &){}
// LLNotifications
class MockNotifications : public LLNotificationsInterface
{
- boost::function<void (const LLSD&, const LLSD&)> mResponder;
- int mAddedCount;
-
-public:
- MockNotifications() :
- mResponder(0),
- mAddedCount(0)
- {
- }
-
- virtual ~MockNotifications() {}
-
- /* virtual */ LLNotificationPtr add(
- const std::string& name,
- const LLSD& substitutions,
- const LLSD& payload,
- LLNotificationFunctorRegistry::ResponseFunctor functor)
- {
- mResponder = functor;
- mAddedCount++;
- return LLNotificationPtr((LLNotification*)NULL);
- }
-
- void sendYesResponse()
- {
- LLSD notification;
- LLSD response;
- response = 1;
- mResponder(notification, response);
- }
-
- void sendNoResponse()
- {
- LLSD notification;
- LLSD response;
- response = 2;
- mResponder(notification, response);
- }
-
- void sendBogusResponse()
- {
- LLSD notification;
- LLSD response;
- response = 666;
- mResponder(notification, response);
- }
-
- int addedCount() { return mAddedCount; }
+ boost::function<void (const LLSD&, const LLSD&)> mResponder;
+ int mAddedCount;
+
+public:
+ MockNotifications() :
+ mResponder(0),
+ mAddedCount(0)
+ {
+ }
+
+ virtual ~MockNotifications() {}
+
+ /* virtual */ LLNotificationPtr add(
+ const std::string& name,
+ const LLSD& substitutions,
+ const LLSD& payload,
+ LLNotificationFunctorRegistry::ResponseFunctor functor)
+ {
+ mResponder = functor;
+ mAddedCount++;
+ return LLNotificationPtr((LLNotification*)NULL);
+ }
+
+ void sendYesResponse()
+ {
+ LLSD notification;
+ LLSD response;
+ response = 1;
+ mResponder(notification, response);
+ }
+
+ void sendNoResponse()
+ {
+ LLSD notification;
+ LLSD response;
+ response = 2;
+ mResponder(notification, response);
+ }
+
+ void sendBogusResponse()
+ {
+ LLSD notification;
+ LLSD response;
+ response = 666;
+ mResponder(notification, response);
+ }
+
+ int addedCount() { return mAddedCount; }
};
S32 LLNotification::getSelectedOption(const LLSD& notification, const LLSD& response)
{
- return response.asInteger();
+ return response.asInteger();
}
//-----------------------------------------------------------------------------
@@ -313,8 +313,8 @@ unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2};
S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len)
{
- memcpy(unique_id, gMACAddress, len);
- return 1;
+ memcpy(unique_id, gMACAddress, len);
+ return 1;
}
S32 LLMachineID::getLegacyID(unsigned char *unique_id, size_t len)
{
@@ -324,7 +324,7 @@ S32 LLMachineID::getLegacyID(unsigned char *unique_id, size_t len)
// misc
std::string xml_escape_string(const std::string& in)
{
- return in;
+ return in;
}
/*****************************************************************************
@@ -334,50 +334,50 @@ namespace tut
{
struct lllogininstance_data
{
- lllogininstance_data() : logininstance(LLLoginInstance::getInstance())
- {
- // Global initialization
- gLoginURI.clear();
- gLoginCreds.clear();
- gDisconnectCalled = false;
-
- gTOSType = ""; // Set to invalid value.
- gTOSReplyPump = 0; // clear the callback.
-
-
- gSavedSettings.declareBOOL("NoInventoryLibrary", FALSE, "", LLControlVariable::PERSIST_NO);
- gSavedSettings.declareBOOL("ConnectAsGod", FALSE, "", LLControlVariable::PERSIST_NO);
- gSavedSettings.declareBOOL("UseDebugMenus", FALSE, "", LLControlVariable::PERSIST_NO);
- gSavedSettings.declareString("ClientSettingsFile", "test_settings.xml", "", LLControlVariable::PERSIST_NO);
- gSavedSettings.declareString("NextLoginLocation", "", "", LLControlVariable::PERSIST_NO);
- gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", LLControlVariable::PERSIST_NO);
+ lllogininstance_data() : logininstance(LLLoginInstance::getInstance())
+ {
+ // Global initialization
+ gLoginURI.clear();
+ gLoginCreds.clear();
+ gDisconnectCalled = false;
+
+ gTOSType = ""; // Set to invalid value.
+ gTOSReplyPump = 0; // clear the callback.
+
+
+ gSavedSettings.declareBOOL("NoInventoryLibrary", FALSE, "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareBOOL("ConnectAsGod", FALSE, "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareBOOL("UseDebugMenus", FALSE, "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareString("ClientSettingsFile", "test_settings.xml", "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareString("NextLoginLocation", "", "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", LLControlVariable::PERSIST_NO);
gSavedSettings.declareBOOL("CmdLineSkipUpdater", TRUE, "", LLControlVariable::PERSIST_NO);
- LLSD authenticator = LLSD::emptyMap();
- LLSD identifier = LLSD::emptyMap();
- identifier["type"] = "agent";
- identifier["first_name"] = "testfirst";
- identifier["last_name"] = "testlast";
- authenticator["passwd"] = "testpass";
- agentCredential = new LLCredential();
- agentCredential->setCredentialData(identifier, authenticator);
-
- authenticator = LLSD::emptyMap();
- identifier = LLSD::emptyMap();
- identifier["type"] = "account";
- identifier["username"] = "testuser";
- authenticator["secret"] = "testsecret";
- accountCredential = new LLCredential();
- accountCredential->setCredentialData(identifier, authenticator);
-
- logininstance->setNotificationsInterface(&notifications);
- logininstance->setPlatformInfo("win", "1.3.5", "Windows Bogus Version 100.6.6.6");
- }
-
- LLLoginInstance* logininstance;
- LLPointer<LLCredential> agentCredential;
- LLPointer<LLCredential> accountCredential;
- MockNotifications notifications;
+ LLSD authenticator = LLSD::emptyMap();
+ LLSD identifier = LLSD::emptyMap();
+ identifier["type"] = "agent";
+ identifier["first_name"] = "testfirst";
+ identifier["last_name"] = "testlast";
+ authenticator["passwd"] = "testpass";
+ agentCredential = new LLCredential();
+ agentCredential->setCredentialData(identifier, authenticator);
+
+ authenticator = LLSD::emptyMap();
+ identifier = LLSD::emptyMap();
+ identifier["type"] = "account";
+ identifier["username"] = "testuser";
+ authenticator["secret"] = "testsecret";
+ accountCredential = new LLCredential();
+ accountCredential->setCredentialData(identifier, authenticator);
+
+ logininstance->setNotificationsInterface(&notifications);
+ logininstance->setPlatformInfo("win", "1.3.5", "Windows Bogus Version 100.6.6.6");
+ }
+
+ LLLoginInstance* logininstance;
+ LLPointer<LLCredential> agentCredential;
+ LLPointer<LLCredential> accountCredential;
+ MockNotifications notifications;
};
typedef test_group<lllogininstance_data> lllogininstance_group;
@@ -387,103 +387,103 @@ namespace tut
template<> template<>
void lllogininstance_object::test<1>()
{
- set_test_name("Test Simple Success And Disconnect");
+ set_test_name("Test Simple Success And Disconnect");
- // Test default connect.
- logininstance->connect(agentCredential);
+ // Test default connect.
+ logininstance->connect(agentCredential);
- ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
+ ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
- // Dummy success response.
- LLSD response;
- response["state"] = "online";
- response["change"] = "connect";
- response["progress"] = 1.0;
- response["transfer_rate"] = 7;
- response["data"] = "test_data";
+ // Dummy success response.
+ LLSD response;
+ response["state"] = "online";
+ response["change"] = "connect";
+ response["progress"] = 1.0;
+ response["transfer_rate"] = 7;
+ response["data"] = "test_data";
- gTestPump.post(response);
+ gTestPump.post(response);
- ensure("Success response", logininstance->authSuccess());
- ensure_equals("Test Response Data", logininstance->getResponse().asString(), "test_data");
+ ensure("Success response", logininstance->authSuccess());
+ ensure_equals("Test Response Data", logininstance->getResponse().asString(), "test_data");
- logininstance->disconnect();
+ logininstance->disconnect();
- ensure_equals("Called Login Module Disconnect", gDisconnectCalled, true);
+ ensure_equals("Called Login Module Disconnect", gDisconnectCalled, true);
- response.clear();
- response["state"] = "offline";
- response["change"] = "disconnect";
- response["progress"] = 0.0;
- response["transfer_rate"] = 0;
- response["data"] = "test_data";
+ response.clear();
+ response["state"] = "offline";
+ response["change"] = "disconnect";
+ response["progress"] = 0.0;
+ response["transfer_rate"] = 0;
+ response["data"] = "test_data";
- gTestPump.post(response);
+ gTestPump.post(response);
- ensure("Disconnected", !(logininstance->authSuccess()));
+ ensure("Disconnected", !(logininstance->authSuccess()));
}
template<> template<>
void lllogininstance_object::test<2>()
{
- set_test_name("Test User TOS/Critical message Interaction");
-
- const std::string test_uri = "testing-uri";
-
- // Test default connect.
- logininstance->connect(test_uri, agentCredential);
-
- // connect should call LLLogin::connect to init gLoginURI and gLoginCreds.
- ensure_equals("Default connect uri", gLoginURI, "testing-uri");
- ensure_equals("Default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false);
- ensure_equals("Default for read critical", gLoginCreds["params"]["read_critical"].asBoolean(), false);
-
- // TOS failure response.
- LLSD response;
- response["state"] = "offline";
- response["change"] = "fail.login";
- response["progress"] = 0.0;
- response["transfer_rate"] = 7;
- response["data"]["reason"] = "tos";
- gTestPump.post(response);
-
- ensure_equals("TOS Dialog type", gTOSType, "message_tos");
- ensure("TOS callback given", gTOSReplyPump != 0);
- gTOSReplyPump->post(false); // Call callback denying TOS.
- ensure("No TOS, failed auth", logininstance->authFailure());
-
- // Start again.
- logininstance->connect(test_uri, agentCredential);
- gTestPump.post(response); // Fail for tos again.
- gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos.
- ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true);
- ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess());
-
- // Fail connection, attempt connect again.
- // The new request should have reset agree to tos to default.
- response["data"]["reason"] = "key"; // bad creds.
- gTestPump.post(response);
- ensure("TOS auth failure", logininstance->authFailure());
-
- logininstance->connect(test_uri, agentCredential);
- ensure_equals("Reset to default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false);
-
- // Critical Message failure response.
- logininstance->connect(test_uri, agentCredential);
- response["data"]["reason"] = "critical"; // Change response to "critical message"
- gTestPump.post(response);
-
- ensure_equals("TOS Dialog type", gTOSType, "message_critical");
- ensure("TOS callback given", gTOSReplyPump != 0);
- gTOSReplyPump->post(true);
- ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true);
- ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess());
-
- // Fail then attempt new connection
- response["data"]["reason"] = "key"; // bad creds.
- gTestPump.post(response);
- ensure("TOS auth failure", logininstance->authFailure());
- logininstance->connect(test_uri, agentCredential);
- ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false);
- }
+ set_test_name("Test User TOS/Critical message Interaction");
+
+ const std::string test_uri = "testing-uri";
+
+ // Test default connect.
+ logininstance->connect(test_uri, agentCredential);
+
+ // connect should call LLLogin::connect to init gLoginURI and gLoginCreds.
+ ensure_equals("Default connect uri", gLoginURI, "testing-uri");
+ ensure_equals("Default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false);
+ ensure_equals("Default for read critical", gLoginCreds["params"]["read_critical"].asBoolean(), false);
+
+ // TOS failure response.
+ LLSD response;
+ response["state"] = "offline";
+ response["change"] = "fail.login";
+ response["progress"] = 0.0;
+ response["transfer_rate"] = 7;
+ response["data"]["reason"] = "tos";
+ gTestPump.post(response);
+
+ ensure_equals("TOS Dialog type", gTOSType, "message_tos");
+ ensure("TOS callback given", gTOSReplyPump != 0);
+ gTOSReplyPump->post(false); // Call callback denying TOS.
+ ensure("No TOS, failed auth", logininstance->authFailure());
+
+ // Start again.
+ logininstance->connect(test_uri, agentCredential);
+ gTestPump.post(response); // Fail for tos again.
+ gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos.
+ ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true);
+ ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess());
+
+ // Fail connection, attempt connect again.
+ // The new request should have reset agree to tos to default.
+ response["data"]["reason"] = "key"; // bad creds.
+ gTestPump.post(response);
+ ensure("TOS auth failure", logininstance->authFailure());
+
+ logininstance->connect(test_uri, agentCredential);
+ ensure_equals("Reset to default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false);
+
+ // Critical Message failure response.
+ logininstance->connect(test_uri, agentCredential);
+ response["data"]["reason"] = "critical"; // Change response to "critical message"
+ gTestPump.post(response);
+
+ ensure_equals("TOS Dialog type", gTOSType, "message_critical");
+ ensure("TOS callback given", gTOSReplyPump != 0);
+ gTOSReplyPump->post(true);
+ ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true);
+ ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess());
+
+ // Fail then attempt new connection
+ response["data"]["reason"] = "key"; // bad creds.
+ gTestPump.post(response);
+ ensure("TOS auth failure", logininstance->authFailure());
+ logininstance->connect(test_uri, agentCredential);
+ ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false);
+ }
}
diff --git a/indra/newview/tests/llmediadataclient_test.cpp b/indra/newview/tests/llmediadataclient_test.cpp
index 4c0acded9e..f741eb47f6 100644
--- a/indra/newview/tests/llmediadataclient_test.cpp
+++ b/indra/newview/tests/llmediadataclient_test.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmediadataclient_test.cpp
* @brief LLMediaDatClient tests
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -64,42 +64,42 @@
#define FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR "foo_ObjectMediaNavigate_ERROR"
#define MEDIA_DATA "\
-<array> \
-<string>http://foo.example.com</string> \
-<string>http://bar.example.com</string> \
-<string>baz</string> \
+<array> \
+<string>http://foo.example.com</string> \
+<string>http://bar.example.com</string> \
+<string>baz</string> \
</array>"
-#define _DATA_URLS(ID,INTEREST,NEW,URL1,URL2) " \
-<llsd> \
- <map> \
- <key>uuid</key> \
- <string>" ID "</string> \
- <key>interest</key> \
- <real>" INTEREST "</real> \
- <key>cap_urls</key> \
- <map> \
- <key>ObjectMedia</key> \
- <string>" URL1 "</string> \
- <key>ObjectMediaNavigate</key> \
- <string>" URL2 "</string> \
- </map> \
+#define _DATA_URLS(ID,INTEREST,NEW,URL1,URL2) " \
+<llsd> \
+ <map> \
+ <key>uuid</key> \
+ <string>" ID "</string> \
+ <key>interest</key> \
+ <real>" INTEREST "</real> \
+ <key>cap_urls</key> \
+ <map> \
+ <key>ObjectMedia</key> \
+ <string>" URL1 "</string> \
+ <key>ObjectMediaNavigate</key> \
+ <string>" URL2 "</string> \
+ </map> \
<key>media_data</key> \
- " MEDIA_DATA " \
- <key>is_dead</key> \
- <boolean>false</boolean> \
- <key>is_new</key> \
- <boolean>" NEW "</boolean> \
- </map> \
+ " MEDIA_DATA " \
+ <key>is_dead</key> \
+ <boolean>false</boolean> \
+ <key>is_new</key> \
+ <boolean>" NEW "</boolean> \
+ </map> \
</llsd>"
#define _DATA(ID,INTEREST,NEW) _DATA_URLS(ID,INTEREST,NEW,FAKE_OBJECT_MEDIA_CAP_URL,FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL)
const char *DATA = _DATA(VALID_OBJECT_ID,"1.0","true");
-
+
#define STR(I) boost::lexical_cast<std::string>(I)
-#define LOG_TEST(N) LL_DEBUGS("LLMediaDataClient") << "\n" << \
+#define LOG_TEST(N) LL_DEBUGS("LLMediaDataClient") << "\n" << \
"================================================================================\n" << \
"==================================== TEST " #N " ===================================\n" << \
"================================================================================\n" << LL_ENDL;
@@ -109,36 +109,36 @@ F64 gMinimumInterestLevel = (F64)0.0;
#if 0
// stubs:
void LLHTTPClient::post(
- const std::string& url,
- const LLSD& body,
- LLHTTPClient::ResponderPtr responder,
- const LLSD& headers,
- const F32 timeout)
+ const std::string& url,
+ const LLSD& body,
+ LLHTTPClient::ResponderPtr responder,
+ const LLSD& headers,
+ const F32 timeout)
{
- LLSD record;
- record["url"] = url;
- record["body"] = body;
- record["headers"] = headers;
- record["timeout"] = timeout;
- gPostRecords->append(record);
-
- // Magic URL that triggers a 503:
- LLSD result;
- result[LLTextureEntry::OBJECT_ID_KEY] = body[LLTextureEntry::OBJECT_ID_KEY];
- if ( url == FAKE_OBJECT_MEDIA_CAP_URL_503 )
- {
- LLSD content;
- content["reason"] = "fake reason";
- responder->failureResult(HTTP_SERVICE_UNAVAILABLE, "fake reason", content);
- return;
- }
- else if (url == FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR)
- {
- LLSD error;
- error["code"] = LLObjectMediaNavigateClient::ERROR_PERMISSION_DENIED_CODE;
- result["error"] = error;
- }
- responder->successResult(result);
+ LLSD record;
+ record["url"] = url;
+ record["body"] = body;
+ record["headers"] = headers;
+ record["timeout"] = timeout;
+ gPostRecords->append(record);
+
+ // Magic URL that triggers a 503:
+ LLSD result;
+ result[LLTextureEntry::OBJECT_ID_KEY] = body[LLTextureEntry::OBJECT_ID_KEY];
+ if ( url == FAKE_OBJECT_MEDIA_CAP_URL_503 )
+ {
+ LLSD content;
+ content["reason"] = "fake reason";
+ responder->failureResult(HTTP_SERVICE_UNAVAILABLE, "fake reason", content);
+ return;
+ }
+ else if (url == FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR)
+ {
+ LLSD error;
+ error["code"] = LLObjectMediaNavigateClient::ERROR_PERMISSION_DENIED_CODE;
+ result["error"] = error;
+ }
+ responder->successResult(result);
}
#endif
@@ -147,70 +147,70 @@ const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
class LLMediaDataClientObjectTest : public LLMediaDataClientObject
{
public:
- LLMediaDataClientObjectTest(const char *data)
- {
- std::istringstream d(data);
- LLSDSerialize::fromXML(mRep, d);
- mNumBounceBacks = 0;
-
+ LLMediaDataClientObjectTest(const char *data)
+ {
+ std::istringstream d(data);
+ LLSDSerialize::fromXML(mRep, d);
+ mNumBounceBacks = 0;
+
// std::cout << ll_pretty_print_sd(mRep) << std::endl;
// std::cout << "ID: " << getID() << std::endl;
- }
- LLMediaDataClientObjectTest(const LLSD &rep)
- : mRep(rep), mNumBounceBacks(0) {}
- ~LLMediaDataClientObjectTest()
- { LL_DEBUGS("LLMediaDataClient") << "~LLMediaDataClientObjectTest" << LL_ENDL; }
-
- virtual U8 getMediaDataCount() const
- { return mRep["media_data"].size(); }
- virtual LLSD getMediaDataLLSD(U8 index) const
- { return mRep["media_data"][(LLSD::Integer)index]; }
- virtual bool isCurrentMediaUrl(U8 index, const std::string &url) const
- { return (mRep["media_data"][(LLSD::Integer)index].asString() == url); }
- virtual LLUUID getID() const
- { return mRep["uuid"]; }
- virtual void mediaNavigateBounceBack(U8 index)
- { mNumBounceBacks++; }
-
- virtual bool hasMedia() const
- { return mRep.has("media_data"); }
-
- virtual void updateObjectMediaData(LLSD const &media_data_array, const std::string &media_version)
- { mRep["media_data"] = media_data_array; mRep["media_version"] = media_version; }
-
- virtual F64 getMediaInterest() const
- { return (LLSD::Real)mRep["interest"]; }
-
- virtual bool isInterestingEnough() const
- { return getMediaInterest() > gMinimumInterestLevel; }
-
- virtual std::string getCapabilityUrl(const std::string &name) const
- { return mRep["cap_urls"][name]; }
-
- virtual bool isDead() const
- { return mRep["is_dead"]; }
-
- virtual U32 getMediaVersion() const
- { return (LLSD::Integer)mRep["media_version"]; }
-
- virtual bool isNew() const
- { return mRep["is_new"]; }
-
- void setMediaInterest(F64 val)
- { mRep["interest"] = val; }
-
- int getNumBounceBacks() const
- { return mNumBounceBacks; }
-
- void markDead()
- { mRep["is_dead"] = true; }
-
- void markOld()
- { mRep["is_new"] = false; }
-
+ }
+ LLMediaDataClientObjectTest(const LLSD &rep)
+ : mRep(rep), mNumBounceBacks(0) {}
+ ~LLMediaDataClientObjectTest()
+ { LL_DEBUGS("LLMediaDataClient") << "~LLMediaDataClientObjectTest" << LL_ENDL; }
+
+ virtual U8 getMediaDataCount() const
+ { return mRep["media_data"].size(); }
+ virtual LLSD getMediaDataLLSD(U8 index) const
+ { return mRep["media_data"][(LLSD::Integer)index]; }
+ virtual bool isCurrentMediaUrl(U8 index, const std::string &url) const
+ { return (mRep["media_data"][(LLSD::Integer)index].asString() == url); }
+ virtual LLUUID getID() const
+ { return mRep["uuid"]; }
+ virtual void mediaNavigateBounceBack(U8 index)
+ { mNumBounceBacks++; }
+
+ virtual bool hasMedia() const
+ { return mRep.has("media_data"); }
+
+ virtual void updateObjectMediaData(LLSD const &media_data_array, const std::string &media_version)
+ { mRep["media_data"] = media_data_array; mRep["media_version"] = media_version; }
+
+ virtual F64 getMediaInterest() const
+ { return (LLSD::Real)mRep["interest"]; }
+
+ virtual bool isInterestingEnough() const
+ { return getMediaInterest() > gMinimumInterestLevel; }
+
+ virtual std::string getCapabilityUrl(const std::string &name) const
+ { return mRep["cap_urls"][name]; }
+
+ virtual bool isDead() const
+ { return mRep["is_dead"]; }
+
+ virtual U32 getMediaVersion() const
+ { return (LLSD::Integer)mRep["media_version"]; }
+
+ virtual bool isNew() const
+ { return mRep["is_new"]; }
+
+ void setMediaInterest(F64 val)
+ { mRep["interest"] = val; }
+
+ int getNumBounceBacks() const
+ { return mNumBounceBacks; }
+
+ void markDead()
+ { mRep["is_dead"] = true; }
+
+ void markOld()
+ { mRep["is_new"] = false; }
+
private:
- LLSD mRep;
- int mNumBounceBacks;
+ LLSD mRep;
+ int mNumBounceBacks;
};
// This special timer delay should ensure that the timer will fire on the very
@@ -220,28 +220,28 @@ const F32 NO_PERIOD = -1000.0f;
static void pump_timers()
{
- LLEventTimer::updateClass();
+ LLEventTimer::updateClass();
}
namespace tut
{
struct mediadataclient
{
- mediadataclient() {
- gPostRecords = &mLLSD;
- gMinimumInterestLevel = (F64)0.0;
-
-// LLError::setDefaultLevel(LLError::LEVEL_DEBUG);
-// LLError::setClassLevel("LLMediaDataClient", LLError::LEVEL_DEBUG);
-// LLError::setTagLevel("MediaOnAPrim", LLError::LEVEL_DEBUG);
- }
- LLSD mLLSD;
+ mediadataclient() {
+ gPostRecords = &mLLSD;
+ gMinimumInterestLevel = (F64)0.0;
+
+// LLError::setDefaultLevel(LLError::LEVEL_DEBUG);
+// LLError::setClassLevel("LLMediaDataClient", LLError::LEVEL_DEBUG);
+// LLError::setTagLevel("MediaOnAPrim", LLError::LEVEL_DEBUG);
+ }
+ LLSD mLLSD;
};
-
- typedef test_group<mediadataclient> mediadataclient_t;
- typedef mediadataclient_t::object mediadataclient_object_t;
- tut::mediadataclient_t tut_mediadataclient("LLMediaDataClient");
-
+
+ typedef test_group<mediadataclient> mediadataclient_t;
+ typedef mediadataclient_t::object mediadataclient_object_t;
+ tut::mediadataclient_t tut_mediadataclient("LLMediaDataClient");
+
void ensure(const std::string &msg, int value, int expected)
{
std::string m = msg;
@@ -249,7 +249,7 @@ namespace tut
m += ", expected: " + STR(expected);
ensure(m, value == expected);
}
-
+
void ensure(const std::string &msg, const std::string & value, const std::string & expected)
{
std::string m = msg;
@@ -257,7 +257,7 @@ namespace tut
m += ", expected: " + expected;
ensure(m, value == expected);
}
-
+
void ensure(const std::string &msg, const LLUUID & value, const LLUUID & expected)
{
std::string m = msg;
@@ -265,13 +265,13 @@ namespace tut
m += ", expected: " + expected.asString();
ensure(m, value == expected);
}
-
+
void ensure_llsd(const std::string &msg, const LLSD & value, const char *expected)
{
LLSD expected_llsd;
std::istringstream e(expected);
LLSDSerialize::fromXML(expected_llsd, e);
-
+
std::string value_str = ll_pretty_print_sd(value);
std::string expected_str = ll_pretty_print_sd(expected_llsd);
std::string m = msg;
@@ -280,694 +280,694 @@ namespace tut
ensure(m, value_str == expected_str);
}
- //////////////////////////////////////////////////////////////////////////////////////////
-
- template<> template<>
- void mediadataclient_object_t::test<1>()
- {
- //
- // Test fetchMedia()
- //
- LOG_TEST(1);
-
- LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA);
- int num_refs_start = o->getNumRefs();
- {
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
- mdc->fetchMedia(o);
-
- // Make sure no posts happened yet...
- ensure("post records", gPostRecords->size(), 0);
-
- ::pump_timers();
-
- ensure("post records", gPostRecords->size(), 1);
- ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_CAP_URL);
- ensure("post GET", (*gPostRecords)[0]["body"]["verb"], "GET");
- ensure("post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
- ensure("queue empty", mdc->isEmpty());
- }
-
- // Make sure everyone's destroyed properly
- ensure("REF COUNT", o->getNumRefs(), num_refs_start);
+ //////////////////////////////////////////////////////////////////////////////////////////
+
+ template<> template<>
+ void mediadataclient_object_t::test<1>()
+ {
+ //
+ // Test fetchMedia()
+ //
+ LOG_TEST(1);
+
+ LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA);
+ int num_refs_start = o->getNumRefs();
+ {
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+ mdc->fetchMedia(o);
+
+ // Make sure no posts happened yet...
+ ensure("post records", gPostRecords->size(), 0);
+
+ ::pump_timers();
+
+ ensure("post records", gPostRecords->size(), 1);
+ ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_CAP_URL);
+ ensure("post GET", (*gPostRecords)[0]["body"]["verb"], "GET");
+ ensure("post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
+ ensure("queue empty", mdc->isEmpty());
+ }
+
+ // Make sure everyone's destroyed properly
+ ensure("REF COUNT", o->getNumRefs(), num_refs_start);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////
+
+ template<> template<>
+ void mediadataclient_object_t::test<2>()
+ {
+ //
+ // Test updateMedia()
+ //
+ LOG_TEST(2);
+
+ LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA);
+ {
+ // queue time w/ no delay ensures that ::pump_timers() will hit the tick()
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+ mdc->updateMedia(o);
+ ensure("post records", gPostRecords->size(), 0);
+ ::pump_timers();
+
+ ensure("post records", gPostRecords->size(), 1);
+ ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_CAP_URL);
+ ensure("post UPDATE", (*gPostRecords)[0]["body"]["verb"], "UPDATE");
+ ensure("post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
+ ensure_llsd("post data llsd", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_MEDIA_DATA_KEY],
+ "<llsd>" MEDIA_DATA "</llsd>");
+ ensure("queue empty", mdc->isEmpty());
+ }
+
+ ensure("REF COUNT", o->getNumRefs(), 1);
}
- //////////////////////////////////////////////////////////////////////////////////////////
-
- template<> template<>
- void mediadataclient_object_t::test<2>()
- {
- //
- // Test updateMedia()
- //
- LOG_TEST(2);
-
- LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA);
- {
- // queue time w/ no delay ensures that ::pump_timers() will hit the tick()
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
- mdc->updateMedia(o);
- ensure("post records", gPostRecords->size(), 0);
- ::pump_timers();
-
- ensure("post records", gPostRecords->size(), 1);
- ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_CAP_URL);
- ensure("post UPDATE", (*gPostRecords)[0]["body"]["verb"], "UPDATE");
- ensure("post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
- ensure_llsd("post data llsd", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_MEDIA_DATA_KEY],
- "<llsd>" MEDIA_DATA "</llsd>");
- ensure("queue empty", mdc->isEmpty());
- }
-
- ensure("REF COUNT", o->getNumRefs(), 1);
- }
-
- //////////////////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////////////////////
template<> template<>
void mediadataclient_object_t::test<3>()
{
- //
- // Test navigate()
- //
- LOG_TEST(3);
-
- LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA);
- {
- LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD);
- const char *TEST_URL = "http://example.com";
- mdc->navigate(o, 0, TEST_URL);
- ensure("post records", gPostRecords->size(), 0);
- ::pump_timers();
-
- // ensure no bounce back
- ensure("bounce back", dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o))->getNumBounceBacks(), 0);
-
- ensure("post records", gPostRecords->size(), 1);
- ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL);
- ensure("post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
- ensure("post data", (*gPostRecords)[0]["body"][LLTextureEntry::TEXTURE_INDEX_KEY], 0);
- ensure("post data", (*gPostRecords)[0]["body"][LLMediaEntry::CURRENT_URL_KEY], TEST_URL);
- ensure("queue empty", mdc->isEmpty());
- }
- ensure("REF COUNT", o->getNumRefs(), 1);
+ //
+ // Test navigate()
+ //
+ LOG_TEST(3);
+
+ LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA);
+ {
+ LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD);
+ const char *TEST_URL = "http://example.com";
+ mdc->navigate(o, 0, TEST_URL);
+ ensure("post records", gPostRecords->size(), 0);
+ ::pump_timers();
+
+ // ensure no bounce back
+ ensure("bounce back", dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o))->getNumBounceBacks(), 0);
+
+ ensure("post records", gPostRecords->size(), 1);
+ ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL);
+ ensure("post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
+ ensure("post data", (*gPostRecords)[0]["body"][LLTextureEntry::TEXTURE_INDEX_KEY], 0);
+ ensure("post data", (*gPostRecords)[0]["body"][LLMediaEntry::CURRENT_URL_KEY], TEST_URL);
+ ensure("queue empty", mdc->isEmpty());
+ }
+ ensure("REF COUNT", o->getNumRefs(), 1);
}
-
- //////////////////////////////////////////////////////////////////////////////////////////
+
+ //////////////////////////////////////////////////////////////////////////////////////////
template<> template<>
void mediadataclient_object_t::test<4>()
{
- //
- // Test queue ordering
- //
- LOG_TEST(4);
-
- LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(
- _DATA(VALID_OBJECT_ID_1,"1.0","true"));
- LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(
- _DATA(VALID_OBJECT_ID_2,"3.0","true"));
- LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(
- _DATA(VALID_OBJECT_ID_3,"2.0","true"));
- {
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
- const char *ORDERED_OBJECT_IDS[] = { VALID_OBJECT_ID_2, VALID_OBJECT_ID_3, VALID_OBJECT_ID_1 };
- mdc->fetchMedia(o1);
- mdc->fetchMedia(o2);
- mdc->fetchMedia(o3);
-
- // Make sure no posts happened yet...
- ensure("post records", gPostRecords->size(), 0);
-
- // tick 3 times...
- ::pump_timers();
- ensure("post records", gPostRecords->size(), 1);
- ::pump_timers();
- ensure("post records", gPostRecords->size(), 2);
- ::pump_timers();
- ensure("post records", gPostRecords->size(), 3);
-
- for( int i=0; i < 3; i++ )
- {
- ensure("[" + STR(i) + "] post url", (*gPostRecords)[i]["url"], FAKE_OBJECT_MEDIA_CAP_URL);
- ensure("[" + STR(i) + "] post GET", (*gPostRecords)[i]["body"]["verb"], "GET");
- ensure("[" + STR(i) + "] post object id", (*gPostRecords)[i]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(),
- LLUUID(ORDERED_OBJECT_IDS[i]));
- }
-
- ensure("queue empty", mdc->isEmpty());
- }
- ensure("refcount of o1", o1->getNumRefs(), 1);
- ensure("refcount of o2", o2->getNumRefs(), 1);
- ensure("refcount of o3", o3->getNumRefs(), 1);
+ //
+ // Test queue ordering
+ //
+ LOG_TEST(4);
+
+ LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(
+ _DATA(VALID_OBJECT_ID_1,"1.0","true"));
+ LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(
+ _DATA(VALID_OBJECT_ID_2,"3.0","true"));
+ LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(
+ _DATA(VALID_OBJECT_ID_3,"2.0","true"));
+ {
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+ const char *ORDERED_OBJECT_IDS[] = { VALID_OBJECT_ID_2, VALID_OBJECT_ID_3, VALID_OBJECT_ID_1 };
+ mdc->fetchMedia(o1);
+ mdc->fetchMedia(o2);
+ mdc->fetchMedia(o3);
+
+ // Make sure no posts happened yet...
+ ensure("post records", gPostRecords->size(), 0);
+
+ // tick 3 times...
+ ::pump_timers();
+ ensure("post records", gPostRecords->size(), 1);
+ ::pump_timers();
+ ensure("post records", gPostRecords->size(), 2);
+ ::pump_timers();
+ ensure("post records", gPostRecords->size(), 3);
+
+ for( int i=0; i < 3; i++ )
+ {
+ ensure("[" + STR(i) + "] post url", (*gPostRecords)[i]["url"], FAKE_OBJECT_MEDIA_CAP_URL);
+ ensure("[" + STR(i) + "] post GET", (*gPostRecords)[i]["body"]["verb"], "GET");
+ ensure("[" + STR(i) + "] post object id", (*gPostRecords)[i]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(),
+ LLUUID(ORDERED_OBJECT_IDS[i]));
+ }
+
+ ensure("queue empty", mdc->isEmpty());
+ }
+ ensure("refcount of o1", o1->getNumRefs(), 1);
+ ensure("refcount of o2", o2->getNumRefs(), 1);
+ ensure("refcount of o3", o3->getNumRefs(), 1);
}
- //////////////////////////////////////////////////////////////////////////////////////////
-
- template<> template<>
- void mediadataclient_object_t::test<5>()
- {
- //
- // Test fetchMedia() getting a 503 error
- //
- LOG_TEST(5);
-
- LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(
- _DATA_URLS(VALID_OBJECT_ID,
- "1.0","true",
- FAKE_OBJECT_MEDIA_CAP_URL_503,
- FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL));
- int num_refs_start = o->getNumRefs();
- {
- const int NUM_RETRIES = 5;
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD,NUM_RETRIES);
-
- // This should generate a retry
- mdc->fetchMedia(o);
-
- // Make sure no posts happened yet...
- ensure("post records before", gPostRecords->size(), 0);
-
- // Once, causes retry
- // Second, fires retry timer
- // Third, fires queue timer again
- for (int i=0; i<NUM_RETRIES; ++i)
- {
- ::pump_timers(); // Should pump (fire) the queue timer, causing a retry timer to be scheduled
- // XXX This ensure is not guaranteed, because scheduling a timer might actually get it pumped in the same loop
- //ensure("post records " + STR(i), gPostRecords->size(), i+1);
- ::pump_timers(); // Should pump (fire) the retry timer, scheduling the queue timer
- }
-
- // Do some extra pumps to make sure no other timer work occurs.
- ::pump_timers();
- ::pump_timers();
- ::pump_timers();
-
- // Make sure there were 2 posts
- ensure("post records after", gPostRecords->size(), NUM_RETRIES);
- for (int i=0; i<NUM_RETRIES; ++i)
- {
- ensure("[" + STR(i) + "] post url", (*gPostRecords)[i]["url"], FAKE_OBJECT_MEDIA_CAP_URL_503);
- ensure("[" + STR(i) + "] post GET", (*gPostRecords)[i]["body"]["verb"], "GET");
- ensure("[" + STR(i) + "] post object id", (*gPostRecords)[i]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
- }
- ensure("queue empty", mdc->isEmpty());
- }
-
- // Make sure everyone's destroyed properly
- ensure("REF COUNT", o->getNumRefs(), num_refs_start);
+ //////////////////////////////////////////////////////////////////////////////////////////
+
+ template<> template<>
+ void mediadataclient_object_t::test<5>()
+ {
+ //
+ // Test fetchMedia() getting a 503 error
+ //
+ LOG_TEST(5);
+
+ LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(
+ _DATA_URLS(VALID_OBJECT_ID,
+ "1.0","true",
+ FAKE_OBJECT_MEDIA_CAP_URL_503,
+ FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL));
+ int num_refs_start = o->getNumRefs();
+ {
+ const int NUM_RETRIES = 5;
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD,NUM_RETRIES);
+
+ // This should generate a retry
+ mdc->fetchMedia(o);
+
+ // Make sure no posts happened yet...
+ ensure("post records before", gPostRecords->size(), 0);
+
+ // Once, causes retry
+ // Second, fires retry timer
+ // Third, fires queue timer again
+ for (int i=0; i<NUM_RETRIES; ++i)
+ {
+ ::pump_timers(); // Should pump (fire) the queue timer, causing a retry timer to be scheduled
+ // XXX This ensure is not guaranteed, because scheduling a timer might actually get it pumped in the same loop
+ //ensure("post records " + STR(i), gPostRecords->size(), i+1);
+ ::pump_timers(); // Should pump (fire) the retry timer, scheduling the queue timer
+ }
+
+ // Do some extra pumps to make sure no other timer work occurs.
+ ::pump_timers();
+ ::pump_timers();
+ ::pump_timers();
+
+ // Make sure there were 2 posts
+ ensure("post records after", gPostRecords->size(), NUM_RETRIES);
+ for (int i=0; i<NUM_RETRIES; ++i)
+ {
+ ensure("[" + STR(i) + "] post url", (*gPostRecords)[i]["url"], FAKE_OBJECT_MEDIA_CAP_URL_503);
+ ensure("[" + STR(i) + "] post GET", (*gPostRecords)[i]["body"]["verb"], "GET");
+ ensure("[" + STR(i) + "] post object id", (*gPostRecords)[i]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
+ }
+ ensure("queue empty", mdc->isEmpty());
+ }
+
+ // Make sure everyone's destroyed properly
+ ensure("REF COUNT", o->getNumRefs(), num_refs_start);
}
template<> template<>
void mediadataclient_object_t::test<6>()
{
- //
- // Test navigate() with a bounce back
- //
- LOG_TEST(6);
-
- LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(
- _DATA_URLS(VALID_OBJECT_ID,
- "1.0","true",
- FAKE_OBJECT_MEDIA_CAP_URL,
- FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR));
- {
- LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD);
- const char *TEST_URL = "http://example.com";
- mdc->navigate(o, 0, TEST_URL);
- ensure("post records", gPostRecords->size(), 0);
- ::pump_timers();
-
- // ensure bounce back
- ensure("bounce back",
- dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o))->getNumBounceBacks(),
- 1);
-
- ensure("post records", gPostRecords->size(), 1);
- ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR);
- ensure("post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
- ensure("post data", (*gPostRecords)[0]["body"][LLTextureEntry::TEXTURE_INDEX_KEY], 0);
- ensure("post data", (*gPostRecords)[0]["body"][LLMediaEntry::CURRENT_URL_KEY], TEST_URL);
- ensure("queue empty", mdc->isEmpty());
- }
- ensure("REF COUNT", o->getNumRefs(), 1);
+ //
+ // Test navigate() with a bounce back
+ //
+ LOG_TEST(6);
+
+ LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(
+ _DATA_URLS(VALID_OBJECT_ID,
+ "1.0","true",
+ FAKE_OBJECT_MEDIA_CAP_URL,
+ FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR));
+ {
+ LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD);
+ const char *TEST_URL = "http://example.com";
+ mdc->navigate(o, 0, TEST_URL);
+ ensure("post records", gPostRecords->size(), 0);
+ ::pump_timers();
+
+ // ensure bounce back
+ ensure("bounce back",
+ dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o))->getNumBounceBacks(),
+ 1);
+
+ ensure("post records", gPostRecords->size(), 1);
+ ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR);
+ ensure("post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID));
+ ensure("post data", (*gPostRecords)[0]["body"][LLTextureEntry::TEXTURE_INDEX_KEY], 0);
+ ensure("post data", (*gPostRecords)[0]["body"][LLMediaEntry::CURRENT_URL_KEY], TEST_URL);
+ ensure("queue empty", mdc->isEmpty());
+ }
+ ensure("REF COUNT", o->getNumRefs(), 1);
}
- template<> template<>
+ template<> template<>
void mediadataclient_object_t::test<7>()
{
- // Test LLMediaDataClient::isInQueue()
- LOG_TEST(7);
-
- LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(
- _DATA(VALID_OBJECT_ID_1,"3.0","true"));
- LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(
- _DATA(VALID_OBJECT_ID_2,"1.0","true"));
- int num_refs_start = o1->getNumRefs();
- {
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
-
- ensure("not in queue yet 1", ! mdc->isInQueue(o1));
- ensure("not in queue yet 2", ! mdc->isInQueue(o2));
-
- mdc->fetchMedia(o1);
-
- ensure("is in queue", mdc->isInQueue(o1));
- ensure("is not in queue", ! mdc->isInQueue(o2));
-
- ::pump_timers();
-
- ensure("not in queue anymore", ! mdc->isInQueue(o1));
- ensure("still is not in queue", ! mdc->isInQueue(o2));
-
- ensure("queue empty", mdc->isEmpty());
- }
-
- // Make sure everyone's destroyed properly
- ensure("REF COUNT", o1->getNumRefs(), num_refs_start);
-
- }
-
- template<> template<>
+ // Test LLMediaDataClient::isInQueue()
+ LOG_TEST(7);
+
+ LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(
+ _DATA(VALID_OBJECT_ID_1,"3.0","true"));
+ LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(
+ _DATA(VALID_OBJECT_ID_2,"1.0","true"));
+ int num_refs_start = o1->getNumRefs();
+ {
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+
+ ensure("not in queue yet 1", ! mdc->isInQueue(o1));
+ ensure("not in queue yet 2", ! mdc->isInQueue(o2));
+
+ mdc->fetchMedia(o1);
+
+ ensure("is in queue", mdc->isInQueue(o1));
+ ensure("is not in queue", ! mdc->isInQueue(o2));
+
+ ::pump_timers();
+
+ ensure("not in queue anymore", ! mdc->isInQueue(o1));
+ ensure("still is not in queue", ! mdc->isInQueue(o2));
+
+ ensure("queue empty", mdc->isEmpty());
+ }
+
+ // Make sure everyone's destroyed properly
+ ensure("REF COUNT", o1->getNumRefs(), num_refs_start);
+
+ }
+
+ template<> template<>
void mediadataclient_object_t::test<8>()
{
- // Test queue handling of objects that are marked dead.
- LOG_TEST(8);
-
- LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"4.0","true"));
- LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_2,"3.0","true"));
- LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_3,"2.0","true"));
- LLMediaDataClientObject::ptr_t o4 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_4,"1.0","true"));
- {
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
-
- // queue up all 4 objects
- mdc->fetchMedia(o1);
- mdc->fetchMedia(o2);
- mdc->fetchMedia(o3);
- mdc->fetchMedia(o4);
-
- ensure("is in queue 1", mdc->isInQueue(o1));
- ensure("is in queue 2", mdc->isInQueue(o2));
- ensure("is in queue 3", mdc->isInQueue(o3));
- ensure("is in queue 4", mdc->isInQueue(o4));
- ensure("post records", gPostRecords->size(), 0);
-
- // and mark the second and fourth ones dead. Call removeFromQueue when marking dead, since this is what LLVOVolume will do.
- dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o2))->markDead();
- mdc->removeFromQueue(o2);
- dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o4))->markDead();
- mdc->removeFromQueue(o4);
-
- // The removeFromQueue calls should remove the second and fourth ones
- ensure("is in queue 1", mdc->isInQueue(o1));
- ensure("is not in queue 2", !mdc->isInQueue(o2));
- ensure("is in queue 3", mdc->isInQueue(o3));
- ensure("is not in queue 4", !mdc->isInQueue(o4));
- ensure("post records", gPostRecords->size(), 0);
-
- ::pump_timers();
-
- // The first tick should process the first item
- ensure("is not in queue 1", !mdc->isInQueue(o1));
- ensure("is not in queue 2", !mdc->isInQueue(o2));
- ensure("is in queue 3", mdc->isInQueue(o3));
- ensure("is not in queue 4", !mdc->isInQueue(o4));
- ensure("post records", gPostRecords->size(), 1);
-
- ::pump_timers();
-
- // The second tick should process the third, emptying the queue
- ensure("is not in queue 3", !mdc->isInQueue(o3));
- ensure("post records", gPostRecords->size(), 2);
-
- ensure("queue empty", mdc->isEmpty());
- }
- ensure("refcount of o1", o1->getNumRefs(), 1);
- ensure("refcount of o2", o2->getNumRefs(), 1);
- ensure("refcount of o3", o3->getNumRefs(), 1);
- ensure("refcount of o4", o4->getNumRefs(), 1);
-
- }
-
- //////////////////////////////////////////////////////////////////////////////////////////
+ // Test queue handling of objects that are marked dead.
+ LOG_TEST(8);
+
+ LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"4.0","true"));
+ LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_2,"3.0","true"));
+ LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_3,"2.0","true"));
+ LLMediaDataClientObject::ptr_t o4 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_4,"1.0","true"));
+ {
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+
+ // queue up all 4 objects
+ mdc->fetchMedia(o1);
+ mdc->fetchMedia(o2);
+ mdc->fetchMedia(o3);
+ mdc->fetchMedia(o4);
+
+ ensure("is in queue 1", mdc->isInQueue(o1));
+ ensure("is in queue 2", mdc->isInQueue(o2));
+ ensure("is in queue 3", mdc->isInQueue(o3));
+ ensure("is in queue 4", mdc->isInQueue(o4));
+ ensure("post records", gPostRecords->size(), 0);
+
+ // and mark the second and fourth ones dead. Call removeFromQueue when marking dead, since this is what LLVOVolume will do.
+ dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o2))->markDead();
+ mdc->removeFromQueue(o2);
+ dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o4))->markDead();
+ mdc->removeFromQueue(o4);
+
+ // The removeFromQueue calls should remove the second and fourth ones
+ ensure("is in queue 1", mdc->isInQueue(o1));
+ ensure("is not in queue 2", !mdc->isInQueue(o2));
+ ensure("is in queue 3", mdc->isInQueue(o3));
+ ensure("is not in queue 4", !mdc->isInQueue(o4));
+ ensure("post records", gPostRecords->size(), 0);
+
+ ::pump_timers();
+
+ // The first tick should process the first item
+ ensure("is not in queue 1", !mdc->isInQueue(o1));
+ ensure("is not in queue 2", !mdc->isInQueue(o2));
+ ensure("is in queue 3", mdc->isInQueue(o3));
+ ensure("is not in queue 4", !mdc->isInQueue(o4));
+ ensure("post records", gPostRecords->size(), 1);
+
+ ::pump_timers();
+
+ // The second tick should process the third, emptying the queue
+ ensure("is not in queue 3", !mdc->isInQueue(o3));
+ ensure("post records", gPostRecords->size(), 2);
+
+ ensure("queue empty", mdc->isEmpty());
+ }
+ ensure("refcount of o1", o1->getNumRefs(), 1);
+ ensure("refcount of o2", o2->getNumRefs(), 1);
+ ensure("refcount of o3", o3->getNumRefs(), 1);
+ ensure("refcount of o4", o4->getNumRefs(), 1);
+
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////
template<> template<>
void mediadataclient_object_t::test<9>()
{
- //
- // Test queue re-ordering
- //
- LOG_TEST(9);
-
- LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"40.0","true"));
- LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_2,"30.0","true"));
- LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_3,"20.0","true"));
- LLMediaDataClientObjectTest *object4 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_4,"10.0","true"));
- LLMediaDataClientObject::ptr_t o4 = object4;
- {
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
-
- // queue up all 4 objects. They should now be in the queue in
- // order 1 through 4, with 4 being at the front of the queue
- mdc->fetchMedia(o1);
- mdc->fetchMedia(o2);
- mdc->fetchMedia(o3);
- mdc->fetchMedia(o4);
-
- int tick_num = 0;
-
- ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 0);
-
- ::pump_timers();
- ++tick_num;
-
- // The first tick should remove the first one
- ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 1);
-
- // Now, pretend that object 4 moved relative to the avatar such
- // that it is now closest
- object4->setMediaInterest(50.0);
-
- ::pump_timers();
- ++tick_num;
-
- // The second tick should still pick off item 2, but then re-sort
- // have picked off object 4
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
-
- ::pump_timers();
- ++tick_num;
-
- // The third tick should pick off object 2
- ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 3);
-
- // The fourth tick should pick off object 3
- ::pump_timers();
- ++tick_num;
-
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 4);
-
- ensure("queue empty", mdc->isEmpty());
- }
- ensure("refcount of o1", o1->getNumRefs(), 1);
- ensure("refcount of o2", o2->getNumRefs(), 1);
- ensure("refcount of o3", o3->getNumRefs(), 1);
- ensure("refcount of o4", o4->getNumRefs(), 1);
+ //
+ // Test queue re-ordering
+ //
+ LOG_TEST(9);
+
+ LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"40.0","true"));
+ LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_2,"30.0","true"));
+ LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_3,"20.0","true"));
+ LLMediaDataClientObjectTest *object4 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_4,"10.0","true"));
+ LLMediaDataClientObject::ptr_t o4 = object4;
+ {
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+
+ // queue up all 4 objects. They should now be in the queue in
+ // order 1 through 4, with 4 being at the front of the queue
+ mdc->fetchMedia(o1);
+ mdc->fetchMedia(o2);
+ mdc->fetchMedia(o3);
+ mdc->fetchMedia(o4);
+
+ int tick_num = 0;
+
+ ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 0);
+
+ ::pump_timers();
+ ++tick_num;
+
+ // The first tick should remove the first one
+ ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 1);
+
+ // Now, pretend that object 4 moved relative to the avatar such
+ // that it is now closest
+ object4->setMediaInterest(50.0);
+
+ ::pump_timers();
+ ++tick_num;
+
+ // The second tick should still pick off item 2, but then re-sort
+ // have picked off object 4
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
+
+ ::pump_timers();
+ ++tick_num;
+
+ // The third tick should pick off object 2
+ ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 3);
+
+ // The fourth tick should pick off object 3
+ ::pump_timers();
+ ++tick_num;
+
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 4);
+
+ ensure("queue empty", mdc->isEmpty());
+ }
+ ensure("refcount of o1", o1->getNumRefs(), 1);
+ ensure("refcount of o2", o2->getNumRefs(), 1);
+ ensure("refcount of o3", o3->getNumRefs(), 1);
+ ensure("refcount of o4", o4->getNumRefs(), 1);
}
-
-
- template<> template<>
+
+
+ template<> template<>
void mediadataclient_object_t::test<10>()
{
- //
- // Test using the "round-robin" queue
- //
- LOG_TEST(10);
-
- LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"1.0","true"));
- LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_2,"2.0","true"));
- LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_3,"3.0","false"));
- LLMediaDataClientObject::ptr_t o4 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_4,"4.0","false"));
- {
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
-
- // queue up all 4 objects. The first two should be in the sorted
- // queue [2 1], the second in the round-robin queue. The queues
- // are serviced interleaved, so we should expect:
- // 2, 3, 1, 4
- mdc->fetchMedia(o1);
- mdc->fetchMedia(o2);
- mdc->fetchMedia(o3);
- mdc->fetchMedia(o4);
-
- int tick_num = 0;
-
- // 0
- ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 0);
-
- ::pump_timers();
- ++tick_num;
-
- // 1 The first tick should remove object 2
- ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 1);
- ensure(STR(tick_num) + ". post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_2));
-
- ::pump_timers();
- ++tick_num;
-
- // 2 The second tick should send object 3
- ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
- ensure(STR(tick_num) + ". post object id", (*gPostRecords)[1]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_3));
-
- ::pump_timers();
- ++tick_num;
-
- // 3 The third tick should remove object 1
- ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 3);
- ensure(STR(tick_num) + ". post object id", (*gPostRecords)[2]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_1));
-
- ::pump_timers();
- ++tick_num;
-
- // 4 The fourth tick should send object 4
- ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 4);
- ensure(STR(tick_num) + ". post object id", (*gPostRecords)[3]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_4));
-
- ::pump_timers();
- ++tick_num;
-
- // 5 The fifth tick should not change the state of anything.
- ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 4);
-
- ::pump_timers();
-
- // Whew....better be empty
- ensure("queue empty", mdc->isEmpty());
- }
- ensure("refcount of o1", o1->getNumRefs(), 1);
- ensure("refcount of o2", o2->getNumRefs(), 1);
- ensure("refcount of o3", o3->getNumRefs(), 1);
- ensure("refcount of o4", o4->getNumRefs(), 1);
- }
-
-
- template<> template<>
- void mediadataclient_object_t::test<11>()
- {
- //
- // Test LLMediaDataClient's destructor
- //
- LOG_TEST(11);
-
- LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA);
- int num_refs_start = o->getNumRefs();
- {
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
- mdc->fetchMedia(o);
- // must tick enough times to clear refcount of mdc
- ::pump_timers();
- }
- // Make sure everyone's destroyed properly
- ensure("REF COUNT", o->getNumRefs(), num_refs_start);
- }
-
- template<> template<>
+ //
+ // Test using the "round-robin" queue
+ //
+ LOG_TEST(10);
+
+ LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"1.0","true"));
+ LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_2,"2.0","true"));
+ LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_3,"3.0","false"));
+ LLMediaDataClientObject::ptr_t o4 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_4,"4.0","false"));
+ {
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+
+ // queue up all 4 objects. The first two should be in the sorted
+ // queue [2 1], the second in the round-robin queue. The queues
+ // are serviced interleaved, so we should expect:
+ // 2, 3, 1, 4
+ mdc->fetchMedia(o1);
+ mdc->fetchMedia(o2);
+ mdc->fetchMedia(o3);
+ mdc->fetchMedia(o4);
+
+ int tick_num = 0;
+
+ // 0
+ ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 0);
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 1 The first tick should remove object 2
+ ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 1);
+ ensure(STR(tick_num) + ". post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_2));
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 2 The second tick should send object 3
+ ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
+ ensure(STR(tick_num) + ". post object id", (*gPostRecords)[1]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_3));
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 3 The third tick should remove object 1
+ ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 3);
+ ensure(STR(tick_num) + ". post object id", (*gPostRecords)[2]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_1));
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 4 The fourth tick should send object 4
+ ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 4);
+ ensure(STR(tick_num) + ". post object id", (*gPostRecords)[3]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_4));
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 5 The fifth tick should not change the state of anything.
+ ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 4);
+
+ ::pump_timers();
+
+ // Whew....better be empty
+ ensure("queue empty", mdc->isEmpty());
+ }
+ ensure("refcount of o1", o1->getNumRefs(), 1);
+ ensure("refcount of o2", o2->getNumRefs(), 1);
+ ensure("refcount of o3", o3->getNumRefs(), 1);
+ ensure("refcount of o4", o4->getNumRefs(), 1);
+ }
+
+
+ template<> template<>
+ void mediadataclient_object_t::test<11>()
+ {
+ //
+ // Test LLMediaDataClient's destructor
+ //
+ LOG_TEST(11);
+
+ LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA);
+ int num_refs_start = o->getNumRefs();
+ {
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+ mdc->fetchMedia(o);
+ // must tick enough times to clear refcount of mdc
+ ::pump_timers();
+ }
+ // Make sure everyone's destroyed properly
+ ensure("REF COUNT", o->getNumRefs(), num_refs_start);
+ }
+
+ template<> template<>
void mediadataclient_object_t::test<12>()
{
- //
- // Test the "not interesting enough" call
- //
- LOG_TEST(12);
-
- LLMediaDataClientObjectTest *object1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"1.0","true"));
- LLMediaDataClientObject::ptr_t o1 = object1;
- LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_2,"2.0","true"));
- LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_3,"3.0","true"));
- LLMediaDataClientObject::ptr_t o4 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_4,"4.0","true"));
- {
- LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
-
- // queue up all 4 objects. The first two are "interesting enough".
- // Firing the timer 4 times should therefore leave them.
- // Note that they should be sorted 4,3,2,1
- // Then, we'll make one "interesting enough", fire the timer a few
- // times, and make sure only it gets pulled off the queue
- gMinimumInterestLevel = 2.5;
- mdc->fetchMedia(o1);
- mdc->fetchMedia(o2);
- mdc->fetchMedia(o3);
- mdc->fetchMedia(o4);
-
- int tick_num = 0;
-
- // 0
- ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 0);
-
- ::pump_timers();
- ++tick_num;
-
- // 1 The first tick should remove object 4
- ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 1);
- ensure(STR(tick_num) + ". post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_4));
-
- ::pump_timers();
- ++tick_num;
-
- // 2 The second tick should send object 3
- ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
- ensure(STR(tick_num) + ". post object id", (*gPostRecords)[1]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_3));
-
- ::pump_timers();
- ++tick_num;
-
- // 3 The third tick should not pull off anything
- ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
-
- ::pump_timers();
- ++tick_num;
-
- // 4 The fourth tick (for good measure) should not pull off anything
- ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
-
- // Okay, now futz with object 1's interest, such that it is now
- // "interesting enough"
- object1->setMediaInterest((F64)5.0);
-
- // This should sort so that the queue is now [1 2]
- ::pump_timers();
- ++tick_num;
-
- // 5 The fifth tick should now identify objects 3 and 4 as no longer
- // needing "updating", and remove them from the queue
- ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 3);
- ensure(STR(tick_num) + ". post object id", (*gPostRecords)[2]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_1));
-
- ::pump_timers();
- ++tick_num;
-
- // 6 The sixth tick should not pull off anything
- ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
- ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
- ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
- ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
- ensure(STR(tick_num) + ". post records", gPostRecords->size(), 3);
-
- ::pump_timers();
- ++tick_num;
-
- // Whew....better NOT be empty ... o2 should still be there
- ensure("queue not empty", !mdc->isEmpty());
-
- // But, we need to clear the queue, or else we won't destroy MDC...
- // this is a strange interplay between the queue timer and the MDC
- mdc->removeFromQueue(o2);
- // tick
- ::pump_timers();
- }
- ensure("refcount of o1", o1->getNumRefs(), 1);
- ensure("refcount of o2", o2->getNumRefs(), 1);
- ensure("refcount of o3", o3->getNumRefs(), 1);
- ensure("refcount of o4", o4->getNumRefs(), 1);
- }
-
- template<> template<>
- void mediadataclient_object_t::test<13>()
- {
- //
- // Test supression of redundant navigates.
- //
- LOG_TEST(13);
-
- LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"1.0","true"));
- {
- LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD);
- const char *TEST_URL = "http://foo.example.com";
- const char *TEST_URL_2 = "http://example.com";
- mdc->navigate(o1, 0, TEST_URL);
- mdc->navigate(o1, 1, TEST_URL);
- mdc->navigate(o1, 0, TEST_URL_2);
- mdc->navigate(o1, 1, TEST_URL_2);
-
- // This should add two requests to the queue, one for face 0 of the object and one for face 1.
-
- ensure("before pump: 1 is in queue", mdc->isInQueue(o1));
-
- ::pump_timers();
-
- ensure("after first pump: 1 is in queue", mdc->isInQueue(o1));
-
- ::pump_timers();
-
- ensure("after second pump: 1 is not in queue", !mdc->isInQueue(o1));
-
- ensure("first post has correct url", (*gPostRecords)[0]["body"][LLMediaEntry::CURRENT_URL_KEY].asString(), std::string(TEST_URL_2));
- ensure("second post has correct url", (*gPostRecords)[1]["body"][LLMediaEntry::CURRENT_URL_KEY].asString(), std::string(TEST_URL_2));
-
- }
- }
-
+ //
+ // Test the "not interesting enough" call
+ //
+ LOG_TEST(12);
+
+ LLMediaDataClientObjectTest *object1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"1.0","true"));
+ LLMediaDataClientObject::ptr_t o1 = object1;
+ LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_2,"2.0","true"));
+ LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_3,"3.0","true"));
+ LLMediaDataClientObject::ptr_t o4 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_4,"4.0","true"));
+ {
+ LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+
+ // queue up all 4 objects. The first two are "interesting enough".
+ // Firing the timer 4 times should therefore leave them.
+ // Note that they should be sorted 4,3,2,1
+ // Then, we'll make one "interesting enough", fire the timer a few
+ // times, and make sure only it gets pulled off the queue
+ gMinimumInterestLevel = 2.5;
+ mdc->fetchMedia(o1);
+ mdc->fetchMedia(o2);
+ mdc->fetchMedia(o3);
+ mdc->fetchMedia(o4);
+
+ int tick_num = 0;
+
+ // 0
+ ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 0);
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 1 The first tick should remove object 4
+ ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 1);
+ ensure(STR(tick_num) + ". post object id", (*gPostRecords)[0]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_4));
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 2 The second tick should send object 3
+ ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
+ ensure(STR(tick_num) + ". post object id", (*gPostRecords)[1]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_3));
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 3 The third tick should not pull off anything
+ ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 4 The fourth tick (for good measure) should not pull off anything
+ ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2);
+
+ // Okay, now futz with object 1's interest, such that it is now
+ // "interesting enough"
+ object1->setMediaInterest((F64)5.0);
+
+ // This should sort so that the queue is now [1 2]
+ ::pump_timers();
+ ++tick_num;
+
+ // 5 The fifth tick should now identify objects 3 and 4 as no longer
+ // needing "updating", and remove them from the queue
+ ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 3);
+ ensure(STR(tick_num) + ". post object id", (*gPostRecords)[2]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_1));
+
+ ::pump_timers();
+ ++tick_num;
+
+ // 6 The sixth tick should not pull off anything
+ ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1));
+ ensure(STR(tick_num) + ". is in queue 2", mdc->isInQueue(o2));
+ ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3));
+ ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4));
+ ensure(STR(tick_num) + ". post records", gPostRecords->size(), 3);
+
+ ::pump_timers();
+ ++tick_num;
+
+ // Whew....better NOT be empty ... o2 should still be there
+ ensure("queue not empty", !mdc->isEmpty());
+
+ // But, we need to clear the queue, or else we won't destroy MDC...
+ // this is a strange interplay between the queue timer and the MDC
+ mdc->removeFromQueue(o2);
+ // tick
+ ::pump_timers();
+ }
+ ensure("refcount of o1", o1->getNumRefs(), 1);
+ ensure("refcount of o2", o2->getNumRefs(), 1);
+ ensure("refcount of o3", o3->getNumRefs(), 1);
+ ensure("refcount of o4", o4->getNumRefs(), 1);
+ }
+
+ template<> template<>
+ void mediadataclient_object_t::test<13>()
+ {
+ //
+ // Test supression of redundant navigates.
+ //
+ LOG_TEST(13);
+
+ LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"1.0","true"));
+ {
+ LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD);
+ const char *TEST_URL = "http://foo.example.com";
+ const char *TEST_URL_2 = "http://example.com";
+ mdc->navigate(o1, 0, TEST_URL);
+ mdc->navigate(o1, 1, TEST_URL);
+ mdc->navigate(o1, 0, TEST_URL_2);
+ mdc->navigate(o1, 1, TEST_URL_2);
+
+ // This should add two requests to the queue, one for face 0 of the object and one for face 1.
+
+ ensure("before pump: 1 is in queue", mdc->isInQueue(o1));
+
+ ::pump_timers();
+
+ ensure("after first pump: 1 is in queue", mdc->isInQueue(o1));
+
+ ::pump_timers();
+
+ ensure("after second pump: 1 is not in queue", !mdc->isInQueue(o1));
+
+ ensure("first post has correct url", (*gPostRecords)[0]["body"][LLMediaEntry::CURRENT_URL_KEY].asString(), std::string(TEST_URL_2));
+ ensure("second post has correct url", (*gPostRecords)[1]["body"][LLMediaEntry::CURRENT_URL_KEY].asString(), std::string(TEST_URL_2));
+
+ }
+ }
+
}
diff --git a/indra/newview/tests/llpipeline_stub.cpp b/indra/newview/tests/llpipeline_stub.cpp
index ad112cbf6a..62b71e51e5 100644
--- a/indra/newview/tests/llpipeline_stub.cpp
+++ b/indra/newview/tests/llpipeline_stub.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpipeline_stub.cpp
* @brief stub class to allow unit testing
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/tests/llremoteparcelrequest_test.cpp b/indra/newview/tests/llremoteparcelrequest_test.cpp
index 4eddfb46e1..c8fa2fbd6f 100644
--- a/indra/newview/tests/llremoteparcelrequest_test.cpp
+++ b/indra/newview/tests/llremoteparcelrequest_test.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llremoteparcelrequest_test.cpp
* @author Brad Kittenbrink <brad@lindenlab.com>
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,7 +37,7 @@
#include "llpounceable.h"
namespace {
- const LLUUID TEST_PARCEL_ID("11111111-1111-1111-1111-111111111111");
+ const LLUUID TEST_PARCEL_ID("11111111-1111-1111-1111-111111111111");
}
LLCurl::Responder::Responder() { }
@@ -56,7 +56,7 @@ void LLMessageSystem::getS32(char const *,char const *,S32 &,S32) { }
void LLMessageSystem::getString(char const *,char const *, std::string &,S32) { }
void LLMessageSystem::getUUID(char const *,char const *, LLUUID & out_id,S32)
{
- out_id = TEST_PARCEL_ID;
+ out_id = TEST_PARCEL_ID;
}
void LLMessageSystem::nextBlock(char const *) { }
void LLMessageSystem::addUUID(char const *,LLUUID const &) { }
@@ -79,61 +79,61 @@ void LLUrlEntryParcel::processParcelInfo(const LLUrlEntryParcel::LLParcelData& p
namespace tut
{
- struct TestObserver : public LLRemoteParcelInfoObserver {
- TestObserver() : mProcessed(false) { }
+ struct TestObserver : public LLRemoteParcelInfoObserver {
+ TestObserver() : mProcessed(false) { }
- virtual void processParcelInfo(const LLParcelData& parcel_data)
- {
- mProcessed = true;
- }
+ virtual void processParcelInfo(const LLParcelData& parcel_data)
+ {
+ mProcessed = true;
+ }
- virtual void setParcelID(const LLUUID& parcel_id) { }
+ virtual void setParcelID(const LLUUID& parcel_id) { }
- virtual void setErrorStatus(S32 status, const std::string& reason) { }
+ virtual void setErrorStatus(S32 status, const std::string& reason) { }
- bool mProcessed;
- };
+ bool mProcessed;
+ };
struct RemoteParcelRequestData
{
- RemoteParcelRequestData()
- {
- }
+ RemoteParcelRequestData()
+ {
+ }
};
-
- typedef test_group<RemoteParcelRequestData> remoteparcelrequest_t;
- typedef remoteparcelrequest_t::object remoteparcelrequest_object_t;
- tut::remoteparcelrequest_t tut_remoteparcelrequest("LLRemoteParcelRequest");
- template<> template<>
- void remoteparcelrequest_object_t::test<1>()
- {
- set_test_name("observer pointer");
+ typedef test_group<RemoteParcelRequestData> remoteparcelrequest_t;
+ typedef remoteparcelrequest_t::object remoteparcelrequest_object_t;
+ tut::remoteparcelrequest_t tut_remoteparcelrequest("LLRemoteParcelRequest");
+
+ template<> template<>
+ void remoteparcelrequest_object_t::test<1>()
+ {
+ set_test_name("observer pointer");
- std::unique_ptr<TestObserver> observer(new TestObserver());
+ std::unique_ptr<TestObserver> observer(new TestObserver());
- LLRemoteParcelInfoProcessor & processor = LLRemoteParcelInfoProcessor::instance();
- processor.addObserver(LLUUID(TEST_PARCEL_ID), observer.get());
+ LLRemoteParcelInfoProcessor & processor = LLRemoteParcelInfoProcessor::instance();
+ processor.addObserver(LLUUID(TEST_PARCEL_ID), observer.get());
- processor.processParcelInfoReply(gMessageSystem, NULL);
+ processor.processParcelInfoReply(gMessageSystem, NULL);
- ensure(observer->mProcessed);
- }
+ ensure(observer->mProcessed);
+ }
- template<> template<>
- void remoteparcelrequest_object_t::test<2>()
- {
- set_test_name("CHOP-220: dangling observer pointer");
+ template<> template<>
+ void remoteparcelrequest_object_t::test<2>()
+ {
+ set_test_name("CHOP-220: dangling observer pointer");
- LLRemoteParcelInfoObserver * observer = new TestObserver();
+ LLRemoteParcelInfoObserver * observer = new TestObserver();
- LLRemoteParcelInfoProcessor & processor = LLRemoteParcelInfoProcessor::instance();
- processor.addObserver(LLUUID(TEST_PARCEL_ID), observer);
+ LLRemoteParcelInfoProcessor & processor = LLRemoteParcelInfoProcessor::instance();
+ processor.addObserver(LLUUID(TEST_PARCEL_ID), observer);
- delete observer;
- observer = NULL;
+ delete observer;
+ observer = NULL;
- processor.processParcelInfoReply(gMessageSystem, NULL);
- }
+ processor.processParcelInfoReply(gMessageSystem, NULL);
+ }
}
#endif
diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp
index 7d2a9a436f..ef3da40397 100644
--- a/indra/newview/tests/llsecapi_test.cpp
+++ b/indra/newview/tests/llsecapi_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsecapi_test.cpp
* @author Roxie
* @date 2009-02-10
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,8 +33,8 @@
#include "../../llxml/llcontrol.h"
-//----------------------------------------------------------------------------
-// Mock objects for the dependencies of the code we're testing
+//----------------------------------------------------------------------------
+// Mock objects for the dependencies of the code we're testing
LLControlGroup::LLControlGroup(const std::string& name)
: LLInstanceTracker<LLControlGroup, std::string>(name) {}
@@ -46,7 +46,7 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name,
void LLControlGroup::setString(const std::string& name, const std::string& val){}
std::string LLControlGroup::getString(const std::string& name)
{
- return "";
+ return "";
}
@@ -83,51 +83,51 @@ void LLSecAPIBasicHandler::removeCredentialMap(const std::string& storage, const
// -------------------------------------------------------------------------------------------
namespace tut
{
- // Test wrapper declaration : wrapping nothing for the moment
- struct secapiTest
- {
-
- secapiTest()
- {
- }
- ~secapiTest()
- {
- }
- };
-
- // Tut templating thingamagic: test group, object and test instance
- typedef test_group<secapiTest> secapiTestFactory;
- typedef secapiTestFactory::object secapiTestObject;
- tut::secapiTestFactory tut_test("LLSecAPI");
-
- // ---------------------------------------------------------------------------------------
- // Test functions
- // ---------------------------------------------------------------------------------------
- // registration
- template<> template<>
- void secapiTestObject::test<1>()
- {
- // retrieve an unknown handler
+ // Test wrapper declaration : wrapping nothing for the moment
+ struct secapiTest
+ {
+
+ secapiTest()
+ {
+ }
+ ~secapiTest()
+ {
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<secapiTest> secapiTestFactory;
+ typedef secapiTestFactory::object secapiTestObject;
+ tut::secapiTestFactory tut_test("LLSecAPI");
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // ---------------------------------------------------------------------------------------
+ // registration
+ template<> template<>
+ void secapiTestObject::test<1>()
+ {
+ // retrieve an unknown handler
+
+ ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+ LLPointer<LLSecAPIHandler> test1_handler = new LLSecAPIBasicHandler();
+ registerSecHandler("sectest1", test1_handler);
+ ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+ LLPointer<LLSecAPIHandler> retrieved_test1_handler = getSecHandler("sectest1");
+ ensure("Retrieved sectest1 handler should be the same",
+ retrieved_test1_handler == test1_handler);
+
+ // insert a second handler
+ LLPointer<LLSecAPIHandler> test2_handler = new LLSecAPIBasicHandler();
+ registerSecHandler("sectest2", test2_handler);
+ ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+ retrieved_test1_handler = getSecHandler("sectest1");
+ ensure("Retrieved sectest1 handler should be the same",
+ retrieved_test1_handler == test1_handler);
- ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
- LLPointer<LLSecAPIHandler> test1_handler = new LLSecAPIBasicHandler();
- registerSecHandler("sectest1", test1_handler);
- ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
- LLPointer<LLSecAPIHandler> retrieved_test1_handler = getSecHandler("sectest1");
- ensure("Retrieved sectest1 handler should be the same",
- retrieved_test1_handler == test1_handler);
-
- // insert a second handler
- LLPointer<LLSecAPIHandler> test2_handler = new LLSecAPIBasicHandler();
- registerSecHandler("sectest2", test2_handler);
- ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
- retrieved_test1_handler = getSecHandler("sectest1");
- ensure("Retrieved sectest1 handler should be the same",
- retrieved_test1_handler == test1_handler);
+ LLPointer<LLSecAPIHandler> retrieved_test2_handler = getSecHandler("sectest2");
+ ensure("Retrieved sectest1 handler should be the same",
+ retrieved_test2_handler == test2_handler);
- LLPointer<LLSecAPIHandler> retrieved_test2_handler = getSecHandler("sectest2");
- ensure("Retrieved sectest1 handler should be the same",
- retrieved_test2_handler == test2_handler);
-
- }
+ }
}
diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp
index da742370fc..bfe32406cb 100644
--- a/indra/newview/tests/llsechandler_basic_test.cpp
+++ b/indra/newview/tests/llsechandler_basic_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llsechandler_basic_test.cpp
* @author Roxie
* @date 2009-02-10
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -66,8 +66,8 @@ ensure("Exception cert is incorrect for " str, valueCompareLLSD(except.getCertDa
extern bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& wildcard_string);
-//----------------------------------------------------------------------------
-// Mock objects for the dependencies of the code we're testing
+//----------------------------------------------------------------------------
+// Mock objects for the dependencies of the code we're testing
std::string gFirstName;
std::string gLastName;
@@ -82,11 +82,11 @@ void LLControlGroup::setString(const std::string& name, const std::string& val){
std::string LLControlGroup::getString(const std::string& name)
{
- if (name == "FirstName")
- return gFirstName;
- else if (name == "LastName")
- return gLastName;
- return "";
+ if (name == "FirstName")
+ return gFirstName;
+ else if (name == "LastName")
+ return gLastName;
+ return "";
}
// Stub for --no-verify-ssl-cert
@@ -94,13 +94,13 @@ BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; }
LLSD LLCredential::getLoginParams()
{
- LLSD result = LLSD::emptyMap();
-
- // legacy credential
- result["passwd"] = "$1$testpasssd";
- result["first"] = "myfirst";
- result["last"] ="mylast";
- return result;
+ LLSD result = LLSD::emptyMap();
+
+ // legacy credential
+ result["passwd"] = "$1$testpasssd";
+ result["first"] = "myfirst";
+ result["last"] ="mylast";
+ return result;
}
void LLCredential::identifierType(std::string &idType)
@@ -118,15 +118,15 @@ unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2};
S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len)
{
- memcpy(unique_id, gMACAddress, len);
- return 1;
+ memcpy(unique_id, gMACAddress, len);
+ return 1;
}
S32 LLMachineID::getLegacyID(unsigned char *unique_id, size_t len)
{
return 0;
}
S32 LLMachineID::init() { return 1; }
-
+
LLCertException::LLCertException(const LLSD& cert_data, const std::string& msg)
: LLException(msg),
@@ -356,7 +356,7 @@ namespace tut
"qCSO341jpZaEv/+LfkZ68MdzfHCK9RfQrMiJHteJQg9NZsTYuzaorsrhz+KI9s+w\n"
"REpfgVBL1iiBzWzw7OYJCPJZkaJprMeB+qthPttv9n/bGp65XczMM/qVxveNSzDz\n"
"-----END CERTIFICATE-----\n"
- );
+ );
const std::string mPemIntermediateCert(
"Certificate:\n"
@@ -607,73 +607,73 @@ namespace tut
"BdUpK78NAw7pXivdCRj+XjBh\n"
"-----END CERTIFICATE-----\n"
);
-
- // Test wrapper declaration : wrapping nothing for the moment
- struct sechandler_basic_test
- {
- X509 *mX509TestCert, *mX509RootCert, *mX509IntermediateCert, *mX509ChildCert;
+
+ // Test wrapper declaration : wrapping nothing for the moment
+ struct sechandler_basic_test
+ {
+ X509 *mX509TestCert, *mX509RootCert, *mX509IntermediateCert, *mX509ChildCert;
LLSD mValidationDate;
-
- sechandler_basic_test()
- {
+
+ sechandler_basic_test()
+ {
LLMachineID::init();
- OpenSSL_add_all_algorithms();
- OpenSSL_add_all_ciphers();
- OpenSSL_add_all_digests();
- ERR_load_crypto_strings();
- gFirstName = "";
- gLastName = "";
+ OpenSSL_add_all_algorithms();
+ OpenSSL_add_all_ciphers();
+ OpenSSL_add_all_digests();
+ ERR_load_crypto_strings();
+ gFirstName = "";
+ gLastName = "";
mValidationDate[CERT_VALIDATION_DATE] = LLDate("2017-04-11T00:00:00.00Z");
- LLFile::remove("test_password.dat");
- LLFile::remove("sechandler_settings.tmp");
+ LLFile::remove("test_password.dat");
+ LLFile::remove("sechandler_settings.tmp");
- mX509TestCert = NULL;
- mX509RootCert = NULL;
- mX509IntermediateCert = NULL;
- mX509ChildCert = NULL;
+ mX509TestCert = NULL;
+ mX509RootCert = NULL;
+ mX509IntermediateCert = NULL;
+ mX509ChildCert = NULL;
// Read each of the 4 Pem certs and store in mX509*Cert pointers
- BIO * validation_bio;
- validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length());
- PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL);
- BIO_free(validation_bio);
-
- validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length());
- PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL);
- BIO_free(validation_bio);
-
- validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length());
- PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL);
- BIO_free(validation_bio);
-
- validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length());
- PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL);
- BIO_free(validation_bio);
- }
- ~sechandler_basic_test()
- {
- LLFile::remove("test_password.dat");
- LLFile::remove("sechandler_settings.tmp");
- LLFile::remove("mycertstore.pem");
- X509_free(mX509TestCert);
- X509_free(mX509RootCert);
- X509_free(mX509IntermediateCert);
- X509_free(mX509ChildCert);
- }
- };
-
- // Tut templating thingamagic: test group, object and test instance
- typedef test_group<sechandler_basic_test> sechandler_basic_test_factory;
- typedef sechandler_basic_test_factory::object sechandler_basic_test_object;
- tut::sechandler_basic_test_factory tut_test("LLSecHandler");
-
- // ---------------------------------------------------------------------------------------
- // Test functions
- // ---------------------------------------------------------------------------------------
- // test cert data retrieval
- template<> template<>
- void sechandler_basic_test_object::test<1>()
- {
+ BIO * validation_bio;
+ validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length());
+ PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL);
+ BIO_free(validation_bio);
+
+ validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length());
+ PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL);
+ BIO_free(validation_bio);
+
+ validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length());
+ PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL);
+ BIO_free(validation_bio);
+
+ validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length());
+ PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL);
+ BIO_free(validation_bio);
+ }
+ ~sechandler_basic_test()
+ {
+ LLFile::remove("test_password.dat");
+ LLFile::remove("sechandler_settings.tmp");
+ LLFile::remove("mycertstore.pem");
+ X509_free(mX509TestCert);
+ X509_free(mX509RootCert);
+ X509_free(mX509IntermediateCert);
+ X509_free(mX509ChildCert);
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<sechandler_basic_test> sechandler_basic_test_factory;
+ typedef sechandler_basic_test_factory::object sechandler_basic_test_object;
+ tut::sechandler_basic_test_factory tut_test("LLSecHandler");
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // ---------------------------------------------------------------------------------------
+ // test cert data retrieval
+ template<> template<>
+ void sechandler_basic_test_object::test<1>()
+ {
try
{
LLPointer<LLBasicCertificate> test_cert(new LLBasicCertificate(mPemTestCert, &mValidationDate));
@@ -690,729 +690,729 @@ namespace tut
fail("other exception");
}
}
-
+
template<> template<>
void sechandler_basic_test_object::test<2>()
{
- LLPointer<LLCertificate> test_cert(new LLBasicCertificate(mPemChildCert, &mValidationDate));
-
- LLSD llsd_cert;
- test_cert->getLLSD(llsd_cert);
- //std::ostringstream llsd_value;
- //llsd_value << LLSDOStreamer<LLSDNotationFormatter>(llsd_cert) << std::endl;
- LL_DEBUGS() << "test 1 cert " << llsd_cert << LL_ENDL;
-
- ensure_equals("Issuer Name/commonName", (std::string)llsd_cert["issuer_name"]["commonName"], "Integration Test Intermediate CA");
- ensure_equals("Issuer Name/countryName", (std::string)llsd_cert["issuer_name"]["countryName"], "US");
- ensure_equals("Issuer Name/state", (std::string)llsd_cert["issuer_name"]["stateOrProvinceName"], "California");
- ensure_equals("Issuer Name/org name", (std::string)llsd_cert["issuer_name"]["organizationName"], "Linden Lab");
- ensure_equals("Issuer Name/org unit", (std::string)llsd_cert["issuer_name"]["organizationalUnitName"], "Second Life Engineering");
- ensure_equals("Issuer name string", (std::string)llsd_cert["issuer_name_string"],
+ LLPointer<LLCertificate> test_cert(new LLBasicCertificate(mPemChildCert, &mValidationDate));
+
+ LLSD llsd_cert;
+ test_cert->getLLSD(llsd_cert);
+ //std::ostringstream llsd_value;
+ //llsd_value << LLSDOStreamer<LLSDNotationFormatter>(llsd_cert) << std::endl;
+ LL_DEBUGS() << "test 1 cert " << llsd_cert << LL_ENDL;
+
+ ensure_equals("Issuer Name/commonName", (std::string)llsd_cert["issuer_name"]["commonName"], "Integration Test Intermediate CA");
+ ensure_equals("Issuer Name/countryName", (std::string)llsd_cert["issuer_name"]["countryName"], "US");
+ ensure_equals("Issuer Name/state", (std::string)llsd_cert["issuer_name"]["stateOrProvinceName"], "California");
+ ensure_equals("Issuer Name/org name", (std::string)llsd_cert["issuer_name"]["organizationName"], "Linden Lab");
+ ensure_equals("Issuer Name/org unit", (std::string)llsd_cert["issuer_name"]["organizationalUnitName"], "Second Life Engineering");
+ ensure_equals("Issuer name string", (std::string)llsd_cert["issuer_name_string"],
"emailAddress=noreply@lindenlab.com,CN=Integration Test Intermediate CA,OU=Second Life Engineering,O=Linden Lab,ST=California,C=US");
- ensure_equals("subject Name/commonName", (std::string)llsd_cert["subject_name"]["commonName"],
+ ensure_equals("subject Name/commonName", (std::string)llsd_cert["subject_name"]["commonName"],
"Integration Test Server Cert");
- ensure_equals("subject Name/countryName", (std::string)llsd_cert["subject_name"]["countryName"], "US");
- ensure_equals("subject Name/state", (std::string)llsd_cert["subject_name"]["stateOrProvinceName"], "California");
- ensure_equals("subject Name/localityName", (std::string)llsd_cert["subject_name"]["localityName"], "San Francisco");
- ensure_equals("subject Name/org name", (std::string)llsd_cert["subject_name"]["organizationName"], "Linden Lab");
- ensure_equals("subjectName/org unit",
- (std::string)llsd_cert["subject_name"]["organizationalUnitName"], "Second Life Engineering");
-
- ensure_equals("subject name string",
- (std::string)llsd_cert["subject_name_string"],
+ ensure_equals("subject Name/countryName", (std::string)llsd_cert["subject_name"]["countryName"], "US");
+ ensure_equals("subject Name/state", (std::string)llsd_cert["subject_name"]["stateOrProvinceName"], "California");
+ ensure_equals("subject Name/localityName", (std::string)llsd_cert["subject_name"]["localityName"], "San Francisco");
+ ensure_equals("subject Name/org name", (std::string)llsd_cert["subject_name"]["organizationName"], "Linden Lab");
+ ensure_equals("subjectName/org unit",
+ (std::string)llsd_cert["subject_name"]["organizationalUnitName"], "Second Life Engineering");
+
+ ensure_equals("subject name string",
+ (std::string)llsd_cert["subject_name_string"],
"emailAddress=noreply@lindenlab.com,CN=Integration Test Server Cert,OU=Second Life Engineering,O=Linden Lab,L=San Francisco,ST=California,C=US");
- ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "1000");
- ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2018-05-22T22:58:15Z");
- ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2024-07-19T22:58:15Z");
- LLSD expectedKeyUsage = LLSD::emptyArray();
- expectedKeyUsage.append(LLSD((std::string)"digitalSignature"));
- expectedKeyUsage.append(LLSD((std::string)"keyEncipherment"));
- ensure("key usage", valueCompareLLSD(llsd_cert["keyUsage"], expectedKeyUsage));
- ensure_equals("basic constraints", llsd_cert["basicConstraints"]["CA"].asInteger(), 0);
-
- ensure("x509 is equal", !X509_cmp(mX509ChildCert, test_cert->getOpenSSLX509()));
- }
-
-
- // test protected data
- template<> template<>
- void sechandler_basic_test_object::test<3>()
- {
- std::string protected_data = "sUSh3wj77NG9oAMyt3XIhaej3KLZhLZWFZvI6rIGmwUUOmmelrRg0NI9rkOj8ZDpTPxpwToaBT5u"
- "GQhakdaGLJznr9bHr4/6HIC1bouKj4n2rs4TL6j2WSjto114QdlNfLsE8cbbE+ghww58g8SeyLQO"
- "nyzXoz+/PBz0HD5SMFDuObccoPW24gmqYySz8YoEWhSwO0pUtEEqOjVRsAJgF5wLAtJZDeuilGsq"
- "4ZT9Y4wZ9Rh8nnF3fDUL6IGamHe1ClXM1jgBu10F6UMhZbnH4C3aJ2E9+LiOntU+l3iCb2MpkEpr"
- "82r2ZAMwIrpnirL/xoYoyz7MJQYwUuMvBPToZJrxNSsjI+S2Z+I3iEJAELMAAA==";
-
- std::vector<U8> binary_data(apr_base64_decode_len(protected_data.c_str()));
- apr_base64_decode_binary(&binary_data[0], protected_data.c_str());
-
- LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
- cipher.decrypt(&binary_data[0], 16);
- unsigned char unique_id[MAC_ADDRESS_BYTES];
+ ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "1000");
+ ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2018-05-22T22:58:15Z");
+ ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2024-07-19T22:58:15Z");
+ LLSD expectedKeyUsage = LLSD::emptyArray();
+ expectedKeyUsage.append(LLSD((std::string)"digitalSignature"));
+ expectedKeyUsage.append(LLSD((std::string)"keyEncipherment"));
+ ensure("key usage", valueCompareLLSD(llsd_cert["keyUsage"], expectedKeyUsage));
+ ensure_equals("basic constraints", llsd_cert["basicConstraints"]["CA"].asInteger(), 0);
+
+ ensure("x509 is equal", !X509_cmp(mX509ChildCert, test_cert->getOpenSSLX509()));
+ }
+
+
+ // test protected data
+ template<> template<>
+ void sechandler_basic_test_object::test<3>()
+ {
+ std::string protected_data = "sUSh3wj77NG9oAMyt3XIhaej3KLZhLZWFZvI6rIGmwUUOmmelrRg0NI9rkOj8ZDpTPxpwToaBT5u"
+ "GQhakdaGLJznr9bHr4/6HIC1bouKj4n2rs4TL6j2WSjto114QdlNfLsE8cbbE+ghww58g8SeyLQO"
+ "nyzXoz+/PBz0HD5SMFDuObccoPW24gmqYySz8YoEWhSwO0pUtEEqOjVRsAJgF5wLAtJZDeuilGsq"
+ "4ZT9Y4wZ9Rh8nnF3fDUL6IGamHe1ClXM1jgBu10F6UMhZbnH4C3aJ2E9+LiOntU+l3iCb2MpkEpr"
+ "82r2ZAMwIrpnirL/xoYoyz7MJQYwUuMvBPToZJrxNSsjI+S2Z+I3iEJAELMAAA==";
+
+ std::vector<U8> binary_data(apr_base64_decode_len(protected_data.c_str()));
+ apr_base64_decode_binary(&binary_data[0], protected_data.c_str());
+
+ LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
+ cipher.decrypt(&binary_data[0], 16);
+ unsigned char unique_id[MAC_ADDRESS_BYTES];
LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
- LLXORCipher cipher2(unique_id, sizeof(unique_id));
- cipher2.encrypt(&binary_data[0], 16);
- std::ofstream temp_file("sechandler_settings.tmp", std::ofstream::binary);
- temp_file.write((const char *)&binary_data[0], binary_data.size());
- temp_file.close();
-
- LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp",
- "test_password.dat");
- handler->init();
- // data retrieval for existing data
- LLSD data = handler->getProtectedData("test_data_type", "test_data_id");
-
-
- ensure_equals("retrieve existing data1", (std::string)data["data1"], "test_data_1");
- ensure_equals("retrieve existing data2", (std::string)data["data2"], "test_data_2");
- ensure_equals("retrieve existing data3", (std::string)data["data3"]["elem1"], "test element1");
-
- // data storage
- LLSD store_data = LLSD::emptyMap();
- store_data["store_data1"] = "test_store_data1";
- store_data["store_data2"] = 27;
- store_data["store_data3"] = LLSD::emptyMap();
- store_data["store_data3"]["subelem1"] = "test_subelem1";
-
- handler->setProtectedData("test_data_type", "test_data_id1", store_data);
- data = handler->getProtectedData("test_data_type", "test_data_id");
-
- data = handler->getProtectedData("test_data_type", "test_data_id");
- // verify no overwrite of existing data
- ensure_equals("verify no overwrite 1", (std::string)data["data1"], "test_data_1");
- ensure_equals("verify no overwrite 2", (std::string)data["data2"], "test_data_2");
- ensure_equals("verify no overwrite 3", (std::string)data["data3"]["elem1"], "test element1");
-
- // verify written data is good
- data = handler->getProtectedData("test_data_type", "test_data_id1");
- ensure_equals("verify stored data1", (std::string)data["store_data1"], "test_store_data1");
- ensure_equals("verify stored data2", (int)data["store_data2"], 27);
- ensure_equals("verify stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
-
- // verify overwrite works
- handler->setProtectedData("test_data_type", "test_data_id", store_data);
- data = handler->getProtectedData("test_data_type", "test_data_id");
- ensure_equals("verify overwrite stored data1", (std::string)data["store_data1"], "test_store_data1");
- ensure_equals("verify overwrite stored data2", (int)data["store_data2"], 27);
- ensure_equals("verify overwrite stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
-
- // verify other datatype doesn't conflict
- store_data["store_data3"] = "test_store_data3";
- store_data["store_data4"] = 28;
- store_data["store_data5"] = LLSD::emptyMap();
- store_data["store_data5"]["subelem2"] = "test_subelem2";
-
- handler->setProtectedData("test_data_type1", "test_data_id", store_data);
- data = handler->getProtectedData("test_data_type1", "test_data_id");
- ensure_equals("verify datatype stored data3", (std::string)data["store_data3"], "test_store_data3");
- ensure_equals("verify datatype stored data4", (int)data["store_data4"], 28);
- ensure_equals("verify datatype stored data5", (std::string)data["store_data5"]["subelem2"], "test_subelem2");
-
- // test data not found
-
- data = handler->getProtectedData("test_data_type1", "test_data_not_found");
- ensure("not found", data.isUndefined());
-
- // cause a 'write' by using 'LLPointer' to delete then instantiate a handler
- handler = NULL;
- handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
- handler->init();
-
- data = handler->getProtectedData("test_data_type1", "test_data_id");
- ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3");
- ensure_equals("verify datatype stored data4a", (int)data["store_data4"], 28);
- ensure_equals("verify datatype stored data5a", (std::string)data["store_data5"]["subelem2"], "test_subelem2");
-
- // rewrite the initial file to verify reloads
- handler = NULL;
- std::ofstream temp_file2("sechandler_settings.tmp", std::ofstream::binary);
- temp_file2.write((const char *)&binary_data[0], binary_data.size());
- temp_file2.close();
-
- // cause a 'write'
- handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
- handler->init();
- data = handler->getProtectedData("test_data_type1", "test_data_id");
- ensure("not found", data.isUndefined());
-
- handler->deleteProtectedData("test_data_type", "test_data_id");
- ensure("Deleted data not found", handler->getProtectedData("test_data_type", "test_data_id").isUndefined());
-
- LLFile::remove("sechandler_settings.tmp");
- handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
- handler->init();
- data = handler->getProtectedData("test_data_type1", "test_data_id");
- ensure("not found", data.isUndefined());
- handler = NULL;
-
- ensure(LLFile::isfile("sechandler_settings.tmp"));
- }
-
- // test credenitals
- template<> template<>
- void sechandler_basic_test_object::test<4>()
- {
- LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
- handler->init();
-
- LLSD my_id = LLSD::emptyMap();
- LLSD my_authenticator = LLSD::emptyMap();
- my_id["type"] = "test_type";
- my_id["username"] = "testuser@lindenlab.com";
- my_authenticator["type"] = "test_auth";
- my_authenticator["creds"] = "12345";
-
- // test creation of credentials
- LLPointer<LLCredential> my_cred = handler->createCredential("my_grid", my_id, my_authenticator);
-
- // test retrieval of credential components
- ensure_equals("basic credential creation: identifier", my_id, my_cred->getIdentifier());
- ensure_equals("basic credential creation: authenticator", my_authenticator, my_cred->getAuthenticator());
- ensure_equals("basic credential creation: grid", "my_grid", my_cred->getGrid());
-
- // test setting/overwriting of credential components
- my_id["first_name"] = "firstname";
- my_id.erase("username");
- my_authenticator.erase("creds");
- my_authenticator["hash"] = "6563245";
-
- my_cred->setCredentialData(my_id, my_authenticator);
- ensure_equals("set credential data: identifier", my_id, my_cred->getIdentifier());
- ensure_equals("set credential data: authenticator", my_authenticator, my_cred->getAuthenticator());
- ensure_equals("set credential data: grid", "my_grid", my_cred->getGrid());
-
- // test loading of a credential, that hasn't been saved, without
- // any legacy saved credential data
- LLPointer<LLCredential> my_new_cred = handler->loadCredential("my_grid2");
- ensure("unknown credential load test", my_new_cred->getIdentifier().isMap());
- ensure("unknown credential load test", !my_new_cred->getIdentifier().has("type"));
- ensure("unknown credential load test", my_new_cred->getAuthenticator().isMap());
- ensure("unknown credential load test", !my_new_cred->getAuthenticator().has("type"));
- // test saving of a credential
- handler->saveCredential(my_cred, true);
-
- // test loading of a known credential
- my_new_cred = handler->loadCredential("my_grid");
- ensure_equals("load a known credential: identifier", my_id, my_new_cred->getIdentifier());
- ensure_equals("load a known credential: authenticator",my_authenticator, my_new_cred->getAuthenticator());
- ensure_equals("load a known credential: grid", "my_grid", my_cred->getGrid());
-
- // test deletion of a credential
- handler->deleteCredential(my_new_cred);
-
- ensure("delete credential: identifier", my_new_cred->getIdentifier().isUndefined());
- ensure("delete credentialt: authenticator", my_new_cred->getIdentifier().isUndefined());
- ensure_equals("delete credential: grid", "my_grid", my_cred->getGrid());
- // load unknown cred
-
- my_new_cred = handler->loadCredential("my_grid");
- ensure("deleted credential load test", my_new_cred->getIdentifier().isMap());
- ensure("deleted credential load test", !my_new_cred->getIdentifier().has("type"));
- ensure("deleted credential load test", my_new_cred->getAuthenticator().isMap());
- ensure("deleted credential load test", !my_new_cred->getAuthenticator().has("type"));
-
- // test loading of an unknown credential with legacy saved username, but without
- // saved password
- gFirstName = "myfirstname";
- gLastName = "mylastname";
- my_new_cred = handler->loadCredential("my_legacy_grid");
- ensure_equals("legacy credential with no password: type",
- (const std::string)my_new_cred->getIdentifier()["type"], "agent");
- ensure_equals("legacy credential with no password: first_name",
- (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
- ensure_equals("legacy credential with no password: last_name",
- (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
-
- ensure("legacy credential with no password: no authenticator", my_new_cred->getAuthenticator().isUndefined());
-
- // test loading of an unknown credential with legacy saved password and username
-
- std::string hashed_password = "fSQcLG03eyIWJmkzfyYaKm81dSweLmsxeSAYKGE7fSQ=";
- int length = apr_base64_decode_len(hashed_password.c_str());
- std::vector<char> decoded_password(length);
- apr_base64_decode(&decoded_password[0], hashed_password.c_str());
- LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
- cipher.decrypt((U8*)&decoded_password[0], length);
- unsigned char unique_id[MAC_ADDRESS_BYTES];
- LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
- LLXORCipher cipher2(unique_id, sizeof(unique_id));
- cipher2.encrypt((U8*)&decoded_password[0], length);
- llofstream password_file("test_password.dat", std::ofstream::binary);
- password_file.write(&decoded_password[0], length);
- password_file.close();
-
- my_new_cred = handler->loadCredential("my_legacy_grid2");
- ensure_equals("legacy credential with password: type",
- (const std::string)my_new_cred->getIdentifier()["type"], "agent");
- ensure_equals("legacy credential with password: first_name",
- (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
- ensure_equals("legacy credential with password: last_name",
- (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
-
- LLSD legacy_authenticator = my_new_cred->getAuthenticator();
- ensure_equals("legacy credential with password: type",
- (std::string)legacy_authenticator["type"],
- "hash");
- ensure_equals("legacy credential with password: algorithm",
- (std::string)legacy_authenticator["algorithm"],
- "md5");
- ensure_equals("legacy credential with password: algorithm",
- (std::string)legacy_authenticator["secret"],
- "01234567890123456789012345678901");
-
- // test creation of credentials
- my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator);
- // test save without saving authenticator.
- handler->saveCredential(my_cred, FALSE);
- my_new_cred = handler->loadCredential("mysavedgrid");
- ensure_equals("saved credential without auth",
- (const std::string)my_new_cred->getIdentifier()["type"], "test_type");
- ensure("no authenticator values were saved", my_new_cred->getAuthenticator().isUndefined());
- }
-
- // test cert vector
- template<> template<>
- void sechandler_basic_test_object::test<5>()
- {
- // validate create from empty vector
- LLPointer<LLBasicCertificateVector> test_vector = new LLBasicCertificateVector();
- ensure_equals("when loading with nothing, we should result in no certs in vector", test_vector->size(), 0);
-
- test_vector->add(new LLBasicCertificate(mPemTestCert, &mValidationDate));
- ensure_equals("one element in vector", test_vector->size(), 1);
- test_vector->add(new LLBasicCertificate(mPemChildCert, &mValidationDate));
- ensure_equals("two elements in vector after add", test_vector->size(), 2);
-
+ LLXORCipher cipher2(unique_id, sizeof(unique_id));
+ cipher2.encrypt(&binary_data[0], 16);
+ std::ofstream temp_file("sechandler_settings.tmp", std::ofstream::binary);
+ temp_file.write((const char *)&binary_data[0], binary_data.size());
+ temp_file.close();
+
+ LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp",
+ "test_password.dat");
+ handler->init();
+ // data retrieval for existing data
+ LLSD data = handler->getProtectedData("test_data_type", "test_data_id");
+
+
+ ensure_equals("retrieve existing data1", (std::string)data["data1"], "test_data_1");
+ ensure_equals("retrieve existing data2", (std::string)data["data2"], "test_data_2");
+ ensure_equals("retrieve existing data3", (std::string)data["data3"]["elem1"], "test element1");
+
+ // data storage
+ LLSD store_data = LLSD::emptyMap();
+ store_data["store_data1"] = "test_store_data1";
+ store_data["store_data2"] = 27;
+ store_data["store_data3"] = LLSD::emptyMap();
+ store_data["store_data3"]["subelem1"] = "test_subelem1";
+
+ handler->setProtectedData("test_data_type", "test_data_id1", store_data);
+ data = handler->getProtectedData("test_data_type", "test_data_id");
+
+ data = handler->getProtectedData("test_data_type", "test_data_id");
+ // verify no overwrite of existing data
+ ensure_equals("verify no overwrite 1", (std::string)data["data1"], "test_data_1");
+ ensure_equals("verify no overwrite 2", (std::string)data["data2"], "test_data_2");
+ ensure_equals("verify no overwrite 3", (std::string)data["data3"]["elem1"], "test element1");
+
+ // verify written data is good
+ data = handler->getProtectedData("test_data_type", "test_data_id1");
+ ensure_equals("verify stored data1", (std::string)data["store_data1"], "test_store_data1");
+ ensure_equals("verify stored data2", (int)data["store_data2"], 27);
+ ensure_equals("verify stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
+
+ // verify overwrite works
+ handler->setProtectedData("test_data_type", "test_data_id", store_data);
+ data = handler->getProtectedData("test_data_type", "test_data_id");
+ ensure_equals("verify overwrite stored data1", (std::string)data["store_data1"], "test_store_data1");
+ ensure_equals("verify overwrite stored data2", (int)data["store_data2"], 27);
+ ensure_equals("verify overwrite stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
+
+ // verify other datatype doesn't conflict
+ store_data["store_data3"] = "test_store_data3";
+ store_data["store_data4"] = 28;
+ store_data["store_data5"] = LLSD::emptyMap();
+ store_data["store_data5"]["subelem2"] = "test_subelem2";
+
+ handler->setProtectedData("test_data_type1", "test_data_id", store_data);
+ data = handler->getProtectedData("test_data_type1", "test_data_id");
+ ensure_equals("verify datatype stored data3", (std::string)data["store_data3"], "test_store_data3");
+ ensure_equals("verify datatype stored data4", (int)data["store_data4"], 28);
+ ensure_equals("verify datatype stored data5", (std::string)data["store_data5"]["subelem2"], "test_subelem2");
+
+ // test data not found
+
+ data = handler->getProtectedData("test_data_type1", "test_data_not_found");
+ ensure("not found", data.isUndefined());
+
+ // cause a 'write' by using 'LLPointer' to delete then instantiate a handler
+ handler = NULL;
+ handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+ handler->init();
+
+ data = handler->getProtectedData("test_data_type1", "test_data_id");
+ ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3");
+ ensure_equals("verify datatype stored data4a", (int)data["store_data4"], 28);
+ ensure_equals("verify datatype stored data5a", (std::string)data["store_data5"]["subelem2"], "test_subelem2");
+
+ // rewrite the initial file to verify reloads
+ handler = NULL;
+ std::ofstream temp_file2("sechandler_settings.tmp", std::ofstream::binary);
+ temp_file2.write((const char *)&binary_data[0], binary_data.size());
+ temp_file2.close();
+
+ // cause a 'write'
+ handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+ handler->init();
+ data = handler->getProtectedData("test_data_type1", "test_data_id");
+ ensure("not found", data.isUndefined());
+
+ handler->deleteProtectedData("test_data_type", "test_data_id");
+ ensure("Deleted data not found", handler->getProtectedData("test_data_type", "test_data_id").isUndefined());
+
+ LLFile::remove("sechandler_settings.tmp");
+ handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+ handler->init();
+ data = handler->getProtectedData("test_data_type1", "test_data_id");
+ ensure("not found", data.isUndefined());
+ handler = NULL;
+
+ ensure(LLFile::isfile("sechandler_settings.tmp"));
+ }
+
+ // test credenitals
+ template<> template<>
+ void sechandler_basic_test_object::test<4>()
+ {
+ LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+ handler->init();
+
+ LLSD my_id = LLSD::emptyMap();
+ LLSD my_authenticator = LLSD::emptyMap();
+ my_id["type"] = "test_type";
+ my_id["username"] = "testuser@lindenlab.com";
+ my_authenticator["type"] = "test_auth";
+ my_authenticator["creds"] = "12345";
+
+ // test creation of credentials
+ LLPointer<LLCredential> my_cred = handler->createCredential("my_grid", my_id, my_authenticator);
+
+ // test retrieval of credential components
+ ensure_equals("basic credential creation: identifier", my_id, my_cred->getIdentifier());
+ ensure_equals("basic credential creation: authenticator", my_authenticator, my_cred->getAuthenticator());
+ ensure_equals("basic credential creation: grid", "my_grid", my_cred->getGrid());
+
+ // test setting/overwriting of credential components
+ my_id["first_name"] = "firstname";
+ my_id.erase("username");
+ my_authenticator.erase("creds");
+ my_authenticator["hash"] = "6563245";
+
+ my_cred->setCredentialData(my_id, my_authenticator);
+ ensure_equals("set credential data: identifier", my_id, my_cred->getIdentifier());
+ ensure_equals("set credential data: authenticator", my_authenticator, my_cred->getAuthenticator());
+ ensure_equals("set credential data: grid", "my_grid", my_cred->getGrid());
+
+ // test loading of a credential, that hasn't been saved, without
+ // any legacy saved credential data
+ LLPointer<LLCredential> my_new_cred = handler->loadCredential("my_grid2");
+ ensure("unknown credential load test", my_new_cred->getIdentifier().isMap());
+ ensure("unknown credential load test", !my_new_cred->getIdentifier().has("type"));
+ ensure("unknown credential load test", my_new_cred->getAuthenticator().isMap());
+ ensure("unknown credential load test", !my_new_cred->getAuthenticator().has("type"));
+ // test saving of a credential
+ handler->saveCredential(my_cred, true);
+
+ // test loading of a known credential
+ my_new_cred = handler->loadCredential("my_grid");
+ ensure_equals("load a known credential: identifier", my_id, my_new_cred->getIdentifier());
+ ensure_equals("load a known credential: authenticator",my_authenticator, my_new_cred->getAuthenticator());
+ ensure_equals("load a known credential: grid", "my_grid", my_cred->getGrid());
+
+ // test deletion of a credential
+ handler->deleteCredential(my_new_cred);
+
+ ensure("delete credential: identifier", my_new_cred->getIdentifier().isUndefined());
+ ensure("delete credentialt: authenticator", my_new_cred->getIdentifier().isUndefined());
+ ensure_equals("delete credential: grid", "my_grid", my_cred->getGrid());
+ // load unknown cred
+
+ my_new_cred = handler->loadCredential("my_grid");
+ ensure("deleted credential load test", my_new_cred->getIdentifier().isMap());
+ ensure("deleted credential load test", !my_new_cred->getIdentifier().has("type"));
+ ensure("deleted credential load test", my_new_cred->getAuthenticator().isMap());
+ ensure("deleted credential load test", !my_new_cred->getAuthenticator().has("type"));
+
+ // test loading of an unknown credential with legacy saved username, but without
+ // saved password
+ gFirstName = "myfirstname";
+ gLastName = "mylastname";
+ my_new_cred = handler->loadCredential("my_legacy_grid");
+ ensure_equals("legacy credential with no password: type",
+ (const std::string)my_new_cred->getIdentifier()["type"], "agent");
+ ensure_equals("legacy credential with no password: first_name",
+ (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
+ ensure_equals("legacy credential with no password: last_name",
+ (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
+
+ ensure("legacy credential with no password: no authenticator", my_new_cred->getAuthenticator().isUndefined());
+
+ // test loading of an unknown credential with legacy saved password and username
+
+ std::string hashed_password = "fSQcLG03eyIWJmkzfyYaKm81dSweLmsxeSAYKGE7fSQ=";
+ int length = apr_base64_decode_len(hashed_password.c_str());
+ std::vector<char> decoded_password(length);
+ apr_base64_decode(&decoded_password[0], hashed_password.c_str());
+ LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
+ cipher.decrypt((U8*)&decoded_password[0], length);
+ unsigned char unique_id[MAC_ADDRESS_BYTES];
+ LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
+ LLXORCipher cipher2(unique_id, sizeof(unique_id));
+ cipher2.encrypt((U8*)&decoded_password[0], length);
+ llofstream password_file("test_password.dat", std::ofstream::binary);
+ password_file.write(&decoded_password[0], length);
+ password_file.close();
+
+ my_new_cred = handler->loadCredential("my_legacy_grid2");
+ ensure_equals("legacy credential with password: type",
+ (const std::string)my_new_cred->getIdentifier()["type"], "agent");
+ ensure_equals("legacy credential with password: first_name",
+ (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
+ ensure_equals("legacy credential with password: last_name",
+ (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
+
+ LLSD legacy_authenticator = my_new_cred->getAuthenticator();
+ ensure_equals("legacy credential with password: type",
+ (std::string)legacy_authenticator["type"],
+ "hash");
+ ensure_equals("legacy credential with password: algorithm",
+ (std::string)legacy_authenticator["algorithm"],
+ "md5");
+ ensure_equals("legacy credential with password: algorithm",
+ (std::string)legacy_authenticator["secret"],
+ "01234567890123456789012345678901");
+
+ // test creation of credentials
+ my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator);
+ // test save without saving authenticator.
+ handler->saveCredential(my_cred, FALSE);
+ my_new_cred = handler->loadCredential("mysavedgrid");
+ ensure_equals("saved credential without auth",
+ (const std::string)my_new_cred->getIdentifier()["type"], "test_type");
+ ensure("no authenticator values were saved", my_new_cred->getAuthenticator().isUndefined());
+ }
+
+ // test cert vector
+ template<> template<>
+ void sechandler_basic_test_object::test<5>()
+ {
+ // validate create from empty vector
+ LLPointer<LLBasicCertificateVector> test_vector = new LLBasicCertificateVector();
+ ensure_equals("when loading with nothing, we should result in no certs in vector", test_vector->size(), 0);
+
+ test_vector->add(new LLBasicCertificate(mPemTestCert, &mValidationDate));
+ ensure_equals("one element in vector", test_vector->size(), 1);
+ test_vector->add(new LLBasicCertificate(mPemChildCert, &mValidationDate));
+ ensure_equals("two elements in vector after add", test_vector->size(), 2);
+
// add duplicate; should be a no-op (and log at DEBUG level)
- test_vector->add(new LLBasicCertificate(mPemChildCert, &mValidationDate));
- ensure_equals("two elements in vector after re-add", test_vector->size(), 2);
-
- // validate order
- X509* test_cert = (*test_vector)[0]->getOpenSSLX509();
- ensure("first cert added remains first cert", !X509_cmp(test_cert, mX509TestCert));
- X509_free(test_cert);
-
- test_cert = (*test_vector)[1]->getOpenSSLX509();
- ensure("second cert is second cert", !X509_cmp(test_cert, mX509ChildCert));
- X509_free(test_cert);
-
- //
- // validate iterator
- //
- LLBasicCertificateVector::iterator current_cert = test_vector->begin();
- LLBasicCertificateVector::iterator copy_current_cert = current_cert;
- // operator++(int)
- ensure("validate iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[0]);
- ensure("validate 2nd iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[1]);
- ensure("validate end iterator++", current_cert == test_vector->end());
-
- // copy
- ensure("validate copy iterator element in vector is expected cert", *copy_current_cert == (*test_vector)[0]);
-
- // operator--(int)
- current_cert--;
- ensure("validate iterator-- element in vector is expected cert", *current_cert-- == (*test_vector)[1]);
- ensure("validate iterator-- element in vector is expected cert", *current_cert == (*test_vector)[0]);
-
- ensure("begin iterator is equal", current_cert == test_vector->begin());
-
- // operator++
- ensure("validate ++iterator element in vector is expected cert", *++current_cert == (*test_vector)[1]);
- ensure("end of cert vector after ++iterator", ++current_cert == test_vector->end());
- // operator--
- ensure("validate --iterator element in vector is expected cert", *--current_cert == (*test_vector)[1]);
- ensure("validate 2nd --iterator element in vector is expected cert", *--current_cert == (*test_vector)[0]);
-
- test_vector->erase(test_vector->begin());
- ensure_equals("one element in store after remove", test_vector->size(), 1);
- test_cert = (*test_vector)[0]->getOpenSSLX509();
- ensure("Child cert remains", !X509_cmp(test_cert, mX509ChildCert));
- X509_free(test_cert);
-
- // validate insert
- test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemIntermediateCert, &mValidationDate));
- test_cert = (*test_vector)[0]->getOpenSSLX509();
- ensure_equals("two elements in store after insert", test_vector->size(), 2);
- ensure("validate intermediate cert was inserted at first position", !X509_cmp(test_cert, mX509IntermediateCert));
- X509_free(test_cert);
- test_cert = (*test_vector)[1]->getOpenSSLX509();
- ensure("validate child cert still there", !X509_cmp(test_cert, mX509ChildCert));
- X509_free(test_cert);
-
- //validate find
- LLSD find_info = LLSD::emptyMap();
- find_info["subjectKeyIdentifier"] = "bb:59:9f:de:6b:51:a7:6c:b3:6d:5b:8b:42:f7:b1:65:77:17:a4:e4";
- LLBasicCertificateVector::iterator found_cert = test_vector->find(find_info);
- ensure("found some cert", found_cert != test_vector->end());
+ test_vector->add(new LLBasicCertificate(mPemChildCert, &mValidationDate));
+ ensure_equals("two elements in vector after re-add", test_vector->size(), 2);
+
+ // validate order
+ X509* test_cert = (*test_vector)[0]->getOpenSSLX509();
+ ensure("first cert added remains first cert", !X509_cmp(test_cert, mX509TestCert));
+ X509_free(test_cert);
+
+ test_cert = (*test_vector)[1]->getOpenSSLX509();
+ ensure("second cert is second cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ //
+ // validate iterator
+ //
+ LLBasicCertificateVector::iterator current_cert = test_vector->begin();
+ LLBasicCertificateVector::iterator copy_current_cert = current_cert;
+ // operator++(int)
+ ensure("validate iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[0]);
+ ensure("validate 2nd iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[1]);
+ ensure("validate end iterator++", current_cert == test_vector->end());
+
+ // copy
+ ensure("validate copy iterator element in vector is expected cert", *copy_current_cert == (*test_vector)[0]);
+
+ // operator--(int)
+ current_cert--;
+ ensure("validate iterator-- element in vector is expected cert", *current_cert-- == (*test_vector)[1]);
+ ensure("validate iterator-- element in vector is expected cert", *current_cert == (*test_vector)[0]);
+
+ ensure("begin iterator is equal", current_cert == test_vector->begin());
+
+ // operator++
+ ensure("validate ++iterator element in vector is expected cert", *++current_cert == (*test_vector)[1]);
+ ensure("end of cert vector after ++iterator", ++current_cert == test_vector->end());
+ // operator--
+ ensure("validate --iterator element in vector is expected cert", *--current_cert == (*test_vector)[1]);
+ ensure("validate 2nd --iterator element in vector is expected cert", *--current_cert == (*test_vector)[0]);
+
+ test_vector->erase(test_vector->begin());
+ ensure_equals("one element in store after remove", test_vector->size(), 1);
+ test_cert = (*test_vector)[0]->getOpenSSLX509();
+ ensure("Child cert remains", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ // validate insert
+ test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemIntermediateCert, &mValidationDate));
+ test_cert = (*test_vector)[0]->getOpenSSLX509();
+ ensure_equals("two elements in store after insert", test_vector->size(), 2);
+ ensure("validate intermediate cert was inserted at first position", !X509_cmp(test_cert, mX509IntermediateCert));
+ X509_free(test_cert);
+ test_cert = (*test_vector)[1]->getOpenSSLX509();
+ ensure("validate child cert still there", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ //validate find
+ LLSD find_info = LLSD::emptyMap();
+ find_info["subjectKeyIdentifier"] = "bb:59:9f:de:6b:51:a7:6c:b3:6d:5b:8b:42:f7:b1:65:77:17:a4:e4";
+ LLBasicCertificateVector::iterator found_cert = test_vector->find(find_info);
+ ensure("found some cert", found_cert != test_vector->end());
X509* found_x509 = (*found_cert).get()->getOpenSSLX509();
- ensure("child cert was found", !X509_cmp(found_x509, mX509ChildCert));
- X509_free(found_x509);
-
- find_info["subjectKeyIdentifier"] = "00:00:00:00"; // bogus
- current_cert =test_vector->find(find_info);
- ensure("didn't find cert", current_cert == test_vector->end());
- }
-
- // test cert store
- template<> template<>
- void sechandler_basic_test_object::test<6>()
- {
- // validate load with nothing
- LLFile::remove("mycertstore.pem");
- LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
- ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
-
- // validate load with empty file
- test_store->save();
- test_store = NULL;
- test_store = new LLBasicCertificateStore("mycertstore.pem");
- ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
- test_store=NULL;
-
- // instantiate a cert store from a file
- llofstream certstorefile("mycertstore.pem", std::ios::out);
- certstorefile << mPemChildCert << std::endl << mPemTestCert << std::endl;
- certstorefile.close();
- // validate loaded certs
- test_store = new LLBasicCertificateStore("mycertstore.pem");
- ensure_equals("two elements in store", test_store->size(), 2);
-
- // operator[]
- X509* test_cert = (*test_store)[0]->getOpenSSLX509();
-
- ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
- X509_free(test_cert);
- test_cert = (*test_store)[1]->getOpenSSLX509();
- ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));
- X509_free(test_cert);
-
-
- // validate save
- LLFile::remove("mycertstore.pem");
- test_store->save();
- test_store = NULL;
- test_store = new LLBasicCertificateStore("mycertstore.pem");
- ensure_equals("two elements in store after save", test_store->size(), 2);
- LLCertificateStore::iterator current_cert = test_store->begin();
- test_cert = (*current_cert)->getOpenSSLX509();
- ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
- current_cert++;
- X509_free(test_cert);
- test_cert = (*current_cert)->getOpenSSLX509();
- ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));
- X509_free(test_cert);
- current_cert++;
- ensure("end of cert store", current_cert == test_store->end());
-
- }
-
- // cert name wildcard matching
- template<> template<>
- void sechandler_basic_test_object::test<7>()
- {
- ensure("simple name match",
- _cert_hostname_wildcard_match("foo", "foo"));
-
- ensure("simple name match, with end period",
- _cert_hostname_wildcard_match("foo.", "foo."));
-
- ensure("simple name match, with begin period",
- _cert_hostname_wildcard_match(".foo", ".foo"));
-
- ensure("simple name match, with mismatched period cn",
- _cert_hostname_wildcard_match("foo.", "foo"));
-
- ensure("simple name match, with mismatched period hostname",
- _cert_hostname_wildcard_match("foo", "foo."));
-
- ensure("simple name match, with subdomain",
- _cert_hostname_wildcard_match("foo.bar", "foo.bar"));
-
- ensure("stutter name match",
- _cert_hostname_wildcard_match("foobbbbfoo", "foo*bbbfoo"));
-
- ensure("simple name match, with beginning wildcard",
- _cert_hostname_wildcard_match("foobar", "*bar"));
-
- ensure("simple name match, with ending wildcard",
- _cert_hostname_wildcard_match("foobar", "foo*"));
-
- ensure("simple name match, with beginning null wildcard",
- _cert_hostname_wildcard_match("foobar", "*foobar"));
-
- ensure("simple name match, with ending null wildcard",
- _cert_hostname_wildcard_match("foobar", "foobar*"));
-
- ensure("simple name match, with embedded wildcard",
- _cert_hostname_wildcard_match("foobar", "f*r"));
-
- ensure("simple name match, with embedded null wildcard",
- _cert_hostname_wildcard_match("foobar", "foo*bar"));
-
- ensure("simple name match, with dual embedded wildcard",
- _cert_hostname_wildcard_match("foobar", "f*o*ar"));
-
- ensure("simple name mismatch",
- !_cert_hostname_wildcard_match("bar", "foo"));
-
- ensure("simple name mismatch, with end period",
- !_cert_hostname_wildcard_match("foobar.", "foo."));
-
- ensure("simple name mismatch, with begin period",
- !_cert_hostname_wildcard_match(".foobar", ".foo"));
-
- ensure("simple name mismatch, with subdomain",
- !_cert_hostname_wildcard_match("foobar.bar", "foo.bar"));
-
- ensure("simple name mismatch, with beginning wildcard",
- !_cert_hostname_wildcard_match("foobara", "*bar"));
-
- ensure("simple name mismatch, with ending wildcard",
- !_cert_hostname_wildcard_match("oobar", "foo*"));
-
- ensure("simple name mismatch, with embedded wildcard",
- !_cert_hostname_wildcard_match("oobar", "f*r"));
-
- ensure("simple name mismatch, with dual embedded wildcard",
- !_cert_hostname_wildcard_match("foobar", "f*d*ar"));
-
- ensure("simple wildcard",
- _cert_hostname_wildcard_match("foobar", "*"));
-
- ensure("long domain",
- _cert_hostname_wildcard_match("foo.bar.com", "foo.bar.com"));
-
- ensure("long domain with multiple wildcards",
- _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com"));
-
- ensure("end periods",
- _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com."));
-
- ensure("match end period",
- _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com"));
-
- ensure("match end period2",
- _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com."));
-
- ensure("wildcard mismatch",
- !_cert_hostname_wildcard_match("bar.com", "*.bar.com"));
-
- ensure("wildcard match",
- _cert_hostname_wildcard_match("foo.bar.com", "*.bar.com"));
-
- ensure("wildcard match",
- _cert_hostname_wildcard_match("foo.foo.bar.com", "*.bar.com"));
-
- ensure("wildcard match",
- _cert_hostname_wildcard_match("foo.foo.bar.com", "*.*.com"));
-
- ensure("wildcard mismatch",
- !_cert_hostname_wildcard_match("foo.foo.bar.com", "*.foo.com"));
- }
-
- // test cert chain
- template<> template<>
- void sechandler_basic_test_object::test<8>()
- {
- // validate create from empty chain
- LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
- ensure_equals("when loading with nothing, we should result in no certs in chain", test_chain->size(), 0);
-
- // Single cert in the chain.
- X509_STORE_CTX *test_store = X509_STORE_CTX_new();
+ ensure("child cert was found", !X509_cmp(found_x509, mX509ChildCert));
+ X509_free(found_x509);
+
+ find_info["subjectKeyIdentifier"] = "00:00:00:00"; // bogus
+ current_cert =test_vector->find(find_info);
+ ensure("didn't find cert", current_cert == test_vector->end());
+ }
+
+ // test cert store
+ template<> template<>
+ void sechandler_basic_test_object::test<6>()
+ {
+ // validate load with nothing
+ LLFile::remove("mycertstore.pem");
+ LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
+
+ // validate load with empty file
+ test_store->save();
+ test_store = NULL;
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
+ test_store=NULL;
+
+ // instantiate a cert store from a file
+ llofstream certstorefile("mycertstore.pem", std::ios::out);
+ certstorefile << mPemChildCert << std::endl << mPemTestCert << std::endl;
+ certstorefile.close();
+ // validate loaded certs
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_equals("two elements in store", test_store->size(), 2);
+
+ // operator[]
+ X509* test_cert = (*test_store)[0]->getOpenSSLX509();
+
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+ test_cert = (*test_store)[1]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));
+ X509_free(test_cert);
+
+
+ // validate save
+ LLFile::remove("mycertstore.pem");
+ test_store->save();
+ test_store = NULL;
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_equals("two elements in store after save", test_store->size(), 2);
+ LLCertificateStore::iterator current_cert = test_store->begin();
+ test_cert = (*current_cert)->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ current_cert++;
+ X509_free(test_cert);
+ test_cert = (*current_cert)->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));
+ X509_free(test_cert);
+ current_cert++;
+ ensure("end of cert store", current_cert == test_store->end());
+
+ }
+
+ // cert name wildcard matching
+ template<> template<>
+ void sechandler_basic_test_object::test<7>()
+ {
+ ensure("simple name match",
+ _cert_hostname_wildcard_match("foo", "foo"));
+
+ ensure("simple name match, with end period",
+ _cert_hostname_wildcard_match("foo.", "foo."));
+
+ ensure("simple name match, with begin period",
+ _cert_hostname_wildcard_match(".foo", ".foo"));
+
+ ensure("simple name match, with mismatched period cn",
+ _cert_hostname_wildcard_match("foo.", "foo"));
+
+ ensure("simple name match, with mismatched period hostname",
+ _cert_hostname_wildcard_match("foo", "foo."));
+
+ ensure("simple name match, with subdomain",
+ _cert_hostname_wildcard_match("foo.bar", "foo.bar"));
+
+ ensure("stutter name match",
+ _cert_hostname_wildcard_match("foobbbbfoo", "foo*bbbfoo"));
+
+ ensure("simple name match, with beginning wildcard",
+ _cert_hostname_wildcard_match("foobar", "*bar"));
+
+ ensure("simple name match, with ending wildcard",
+ _cert_hostname_wildcard_match("foobar", "foo*"));
+
+ ensure("simple name match, with beginning null wildcard",
+ _cert_hostname_wildcard_match("foobar", "*foobar"));
+
+ ensure("simple name match, with ending null wildcard",
+ _cert_hostname_wildcard_match("foobar", "foobar*"));
+
+ ensure("simple name match, with embedded wildcard",
+ _cert_hostname_wildcard_match("foobar", "f*r"));
+
+ ensure("simple name match, with embedded null wildcard",
+ _cert_hostname_wildcard_match("foobar", "foo*bar"));
+
+ ensure("simple name match, with dual embedded wildcard",
+ _cert_hostname_wildcard_match("foobar", "f*o*ar"));
+
+ ensure("simple name mismatch",
+ !_cert_hostname_wildcard_match("bar", "foo"));
+
+ ensure("simple name mismatch, with end period",
+ !_cert_hostname_wildcard_match("foobar.", "foo."));
+
+ ensure("simple name mismatch, with begin period",
+ !_cert_hostname_wildcard_match(".foobar", ".foo"));
+
+ ensure("simple name mismatch, with subdomain",
+ !_cert_hostname_wildcard_match("foobar.bar", "foo.bar"));
+
+ ensure("simple name mismatch, with beginning wildcard",
+ !_cert_hostname_wildcard_match("foobara", "*bar"));
+
+ ensure("simple name mismatch, with ending wildcard",
+ !_cert_hostname_wildcard_match("oobar", "foo*"));
+
+ ensure("simple name mismatch, with embedded wildcard",
+ !_cert_hostname_wildcard_match("oobar", "f*r"));
+
+ ensure("simple name mismatch, with dual embedded wildcard",
+ !_cert_hostname_wildcard_match("foobar", "f*d*ar"));
+
+ ensure("simple wildcard",
+ _cert_hostname_wildcard_match("foobar", "*"));
+
+ ensure("long domain",
+ _cert_hostname_wildcard_match("foo.bar.com", "foo.bar.com"));
+
+ ensure("long domain with multiple wildcards",
+ _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com"));
+
+ ensure("end periods",
+ _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com."));
+
+ ensure("match end period",
+ _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com"));
+
+ ensure("match end period2",
+ _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com."));
+
+ ensure("wildcard mismatch",
+ !_cert_hostname_wildcard_match("bar.com", "*.bar.com"));
+
+ ensure("wildcard match",
+ _cert_hostname_wildcard_match("foo.bar.com", "*.bar.com"));
+
+ ensure("wildcard match",
+ _cert_hostname_wildcard_match("foo.foo.bar.com", "*.bar.com"));
+
+ ensure("wildcard match",
+ _cert_hostname_wildcard_match("foo.foo.bar.com", "*.*.com"));
+
+ ensure("wildcard mismatch",
+ !_cert_hostname_wildcard_match("foo.foo.bar.com", "*.foo.com"));
+ }
+
+ // test cert chain
+ template<> template<>
+ void sechandler_basic_test_object::test<8>()
+ {
+ // validate create from empty chain
+ LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
+ ensure_equals("when loading with nothing, we should result in no certs in chain", test_chain->size(), 0);
+
+ // Single cert in the chain.
+ X509_STORE_CTX *test_store = X509_STORE_CTX_new();
X509_STORE_CTX_set_cert(test_store, mX509ChildCert);
X509_STORE_CTX_set0_untrusted(test_store, NULL);
- test_chain = new LLBasicCertificateChain(test_store);
- X509_STORE_CTX_free(test_store);
- ensure_equals("two elements in store", test_chain->size(), 1);
- X509* test_cert = (*test_chain)[0]->getOpenSSLX509();
- ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
- X509_free(test_cert);
-
- // cert + CA
-
- test_store = X509_STORE_CTX_new();
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("two elements in store", test_chain->size(), 1);
+ X509* test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ // cert + CA
+
+ test_store = X509_STORE_CTX_new();
X509_STORE_CTX_set_cert(test_store, mX509ChildCert);
X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null());
- sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert);
- test_chain = new LLBasicCertificateChain(test_store);
- X509_STORE_CTX_free(test_store);
- ensure_equals("two elements in store", test_chain->size(), 2);
- test_cert = (*test_chain)[0]->getOpenSSLX509();
- ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
- X509_free(test_cert);
- test_cert = (*test_chain)[1]->getOpenSSLX509();
- ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));
- X509_free(test_cert);
-
- // cert + nonrelated
-
- test_store = X509_STORE_CTX_new();
+ sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert);
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("two elements in store", test_chain->size(), 2);
+ test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+ test_cert = (*test_chain)[1]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));
+ X509_free(test_cert);
+
+ // cert + nonrelated
+
+ test_store = X509_STORE_CTX_new();
X509_STORE_CTX_set_cert(test_store, mX509ChildCert);
X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null());
- sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert);
- test_chain = new LLBasicCertificateChain(test_store);
- X509_STORE_CTX_free(test_store);
- ensure_equals("two elements in store", test_chain->size(), 1);
- test_cert = (*test_chain)[0]->getOpenSSLX509();
- ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
- X509_free(test_cert);
-
- // cert + CA + nonrelated
- test_store = X509_STORE_CTX_new();
+ sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert);
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("two elements in store", test_chain->size(), 1);
+ test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+
+ // cert + CA + nonrelated
+ test_store = X509_STORE_CTX_new();
X509_STORE_CTX_set_cert(test_store, mX509ChildCert);
X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null());
- sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert);
- sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert);
- test_chain = new LLBasicCertificateChain(test_store);
- X509_STORE_CTX_free(test_store);
- ensure_equals("two elements in store", test_chain->size(), 2);
- test_cert = (*test_chain)[0]->getOpenSSLX509();
- ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
- X509_free(test_cert);
- test_cert = (*test_chain)[1]->getOpenSSLX509();
- ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));
- X509_free(test_cert);
-
- // cert + intermediate + CA
- test_store = X509_STORE_CTX_new();
+ sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert);
+ sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert);
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("two elements in store", test_chain->size(), 2);
+ test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+ test_cert = (*test_chain)[1]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));
+ X509_free(test_cert);
+
+ // cert + intermediate + CA
+ test_store = X509_STORE_CTX_new();
X509_STORE_CTX_set_cert(test_store, mX509ChildCert);
X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null());
- sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert);
- sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509RootCert);
- test_chain = new LLBasicCertificateChain(test_store);
- X509_STORE_CTX_free(test_store);
- ensure_equals("three elements in store", test_chain->size(), 3);
- test_cert = (*test_chain)[0]->getOpenSSLX509();
- ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
- X509_free(test_cert);
- test_cert = (*test_chain)[1]->getOpenSSLX509();
- ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));
- X509_free(test_cert);
-
- test_cert = (*test_chain)[2]->getOpenSSLX509();
- ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509RootCert));
- X509_free(test_cert);
- }
-
- // test cert validation
- template<> template<>
- void sechandler_basic_test_object::test<9>()
- {
- // start with a trusted store with our known root cert
- LLFile::remove("mycertstore.pem");
- LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
- test_store->add(new LLBasicCertificate(mX509RootCert, &mValidationDate));
- LLSD validation_params;
-
- // validate basic trust for a chain containing only the intermediate cert. (1 deep)
- LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
-
- test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate));
-
- test_store->validate(0, test_chain, validation_params);
-
- // add the root certificate to the chain and revalidate
- test_chain->add(new LLBasicCertificate(mX509RootCert, &mValidationDate));
- test_store->validate(0, test_chain, validation_params);
-
- // add the child cert at the head of the chain, and revalidate (3 deep chain)
- test_chain->insert(test_chain->begin(), new LLBasicCertificate(mX509ChildCert, &mValidationDate));
- test_store->validate(0, test_chain, validation_params);
-
- // basic failure cases
- test_chain = new LLBasicCertificateChain(NULL);
- //validate with only the child cert in chain, but child cert was previously
- // trusted
- test_chain->add(new LLBasicCertificate(mX509ChildCert, &mValidationDate));
-
- // validate without the trust flag.
- test_store->validate(VALIDATION_POLICY_TRUSTED, test_chain, validation_params);
-
- // Validate with child cert but no parent, and no parent in CA store
- test_store = new LLBasicCertificateStore("mycertstore.pem");
- ensure_throws("no CA, with only a child cert",
- LLCertValidationTrustException,
- (*test_chain)[0],
- test_store->validate,
- VALIDATION_POLICY_TRUSTED,
- test_chain,
- validation_params);
-
-
- // validate without the trust flag.
- test_store->validate(0, test_chain, validation_params);
-
- // clear out the store
- test_store = new LLBasicCertificateStore("mycertstore.pem");
- // append the intermediate cert
- test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate));
- ensure_throws("no CA, with child and intermediate certs",
- LLCertValidationTrustException,
- (*test_chain)[1],
- test_store->validate,
- VALIDATION_POLICY_TRUSTED | VALIDATION_POLICY_TRUSTED,
- test_chain,
- validation_params);
- // validate without the trust flag
- test_store->validate(0, test_chain, validation_params);
-
- // Test time validity
- LLSD child_info;
- ((*test_chain)[0])->getLLSD(child_info);
- validation_params = LLSD::emptyMap();
- validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() + 1.0);
- test_store->validate(VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED,
+ sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert);
+ sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509RootCert);
+ test_chain = new LLBasicCertificateChain(test_store);
+ X509_STORE_CTX_free(test_store);
+ ensure_equals("three elements in store", test_chain->size(), 3);
+ test_cert = (*test_chain)[0]->getOpenSSLX509();
+ ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+ X509_free(test_cert);
+ test_cert = (*test_chain)[1]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));
+ X509_free(test_cert);
+
+ test_cert = (*test_chain)[2]->getOpenSSLX509();
+ ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509RootCert));
+ X509_free(test_cert);
+ }
+
+ // test cert validation
+ template<> template<>
+ void sechandler_basic_test_object::test<9>()
+ {
+ // start with a trusted store with our known root cert
+ LLFile::remove("mycertstore.pem");
+ LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
+ test_store->add(new LLBasicCertificate(mX509RootCert, &mValidationDate));
+ LLSD validation_params;
+
+ // validate basic trust for a chain containing only the intermediate cert. (1 deep)
+ LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
+
+ test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate));
+
+ test_store->validate(0, test_chain, validation_params);
+
+ // add the root certificate to the chain and revalidate
+ test_chain->add(new LLBasicCertificate(mX509RootCert, &mValidationDate));
+ test_store->validate(0, test_chain, validation_params);
+
+ // add the child cert at the head of the chain, and revalidate (3 deep chain)
+ test_chain->insert(test_chain->begin(), new LLBasicCertificate(mX509ChildCert, &mValidationDate));
+ test_store->validate(0, test_chain, validation_params);
+
+ // basic failure cases
+ test_chain = new LLBasicCertificateChain(NULL);
+ //validate with only the child cert in chain, but child cert was previously
+ // trusted
+ test_chain->add(new LLBasicCertificate(mX509ChildCert, &mValidationDate));
+
+ // validate without the trust flag.
+ test_store->validate(VALIDATION_POLICY_TRUSTED, test_chain, validation_params);
+
+ // Validate with child cert but no parent, and no parent in CA store
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_throws("no CA, with only a child cert",
+ LLCertValidationTrustException,
+ (*test_chain)[0],
+ test_store->validate,
+ VALIDATION_POLICY_TRUSTED,
+ test_chain,
+ validation_params);
+
+
+ // validate without the trust flag.
+ test_store->validate(0, test_chain, validation_params);
+
+ // clear out the store
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ // append the intermediate cert
+ test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate));
+ ensure_throws("no CA, with child and intermediate certs",
+ LLCertValidationTrustException,
+ (*test_chain)[1],
+ test_store->validate,
+ VALIDATION_POLICY_TRUSTED | VALIDATION_POLICY_TRUSTED,
+ test_chain,
+ validation_params);
+ // validate without the trust flag
+ test_store->validate(0, test_chain, validation_params);
+
+ // Test time validity
+ LLSD child_info;
+ ((*test_chain)[0])->getLLSD(child_info);
+ validation_params = LLSD::emptyMap();
+ validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() + 1.0);
+ test_store->validate(VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED,
test_chain, validation_params);
- validation_params = LLSD::emptyMap();
- validation_params[CERT_VALIDATION_DATE] = child_info[CERT_VALID_FROM].asDate();
-
- validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() - 1.0);
-
- // test not yet valid
- ensure_throws("Child cert not yet valid" ,
- LLCertValidationExpirationException,
- (*test_chain)[0],
- test_store->validate,
- VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED,
- test_chain,
- validation_params);
- validation_params = LLSD::emptyMap();
- validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_TO].asDate().secondsSinceEpoch() + 1.0);
-
- // test cert expired
- ensure_throws("Child cert expired",
- LLCertValidationExpirationException,
- (*test_chain)[0],
- test_store->validate,
- VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED,
- test_chain,
- validation_params);
-
- // test SSL KU
- // validate basic trust for a chain containing child and intermediate.
- test_chain = new LLBasicCertificateChain(NULL);
- test_chain->add(new LLBasicCertificate(mX509ChildCert, &mValidationDate));
- test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate));
- test_store->validate(VALIDATION_POLICY_SSL_KU | VALIDATION_POLICY_TRUSTED,
- test_chain, validation_params);
-
- test_chain = new LLBasicCertificateChain(NULL);
- test_chain->add(new LLBasicCertificate(mX509TestCert, &mValidationDate));
-
- test_store = new LLBasicCertificateStore("mycertstore.pem");
- ensure_throws("Cert doesn't have ku",
- LLCertKeyUsageValidationException,
- (*test_chain)[0],
- test_store->validate,
- VALIDATION_POLICY_SSL_KU | VALIDATION_POLICY_TRUSTED,
- test_chain,
- validation_params);
-
- test_store->validate(0, test_chain, validation_params);
- }
+ validation_params = LLSD::emptyMap();
+ validation_params[CERT_VALIDATION_DATE] = child_info[CERT_VALID_FROM].asDate();
+
+ validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() - 1.0);
+
+ // test not yet valid
+ ensure_throws("Child cert not yet valid" ,
+ LLCertValidationExpirationException,
+ (*test_chain)[0],
+ test_store->validate,
+ VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED,
+ test_chain,
+ validation_params);
+ validation_params = LLSD::emptyMap();
+ validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_TO].asDate().secondsSinceEpoch() + 1.0);
+
+ // test cert expired
+ ensure_throws("Child cert expired",
+ LLCertValidationExpirationException,
+ (*test_chain)[0],
+ test_store->validate,
+ VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED,
+ test_chain,
+ validation_params);
+
+ // test SSL KU
+ // validate basic trust for a chain containing child and intermediate.
+ test_chain = new LLBasicCertificateChain(NULL);
+ test_chain->add(new LLBasicCertificate(mX509ChildCert, &mValidationDate));
+ test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate));
+ test_store->validate(VALIDATION_POLICY_SSL_KU | VALIDATION_POLICY_TRUSTED,
+ test_chain, validation_params);
+
+ test_chain = new LLBasicCertificateChain(NULL);
+ test_chain->add(new LLBasicCertificate(mX509TestCert, &mValidationDate));
+
+ test_store = new LLBasicCertificateStore("mycertstore.pem");
+ ensure_throws("Cert doesn't have ku",
+ LLCertKeyUsageValidationException,
+ (*test_chain)[0],
+ test_store->validate,
+ VALIDATION_POLICY_SSL_KU | VALIDATION_POLICY_TRUSTED,
+ test_chain,
+ validation_params);
+
+ test_store->validate(0, test_chain, validation_params);
+ }
};
diff --git a/indra/newview/tests/llsky_stub.cpp b/indra/newview/tests/llsky_stub.cpp
index 241d740635..8faca2665a 100644
--- a/indra/newview/tests/llsky_stub.cpp
+++ b/indra/newview/tests/llsky_stub.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -27,8 +27,8 @@
class LLSky
{
public:
- void setOverrideSun(BOOL override);
- void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity);
+ void setOverrideSun(BOOL override);
+ void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity);
};
void LLSky::setOverrideSun(BOOL override) {}
diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp
index 8d21b6ed69..92ba68a073 100644
--- a/indra/newview/tests/llslurl_test.cpp
+++ b/indra/newview/tests/llslurl_test.cpp
@@ -46,12 +46,12 @@ static const char * const TEST_FILENAME("llslurl_test.xml");
class LLTrans
{
public:
- static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
+ static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
};
std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
{
- return std::string();
+ return std::string();
}
//----------------------------------------------------------------------------
@@ -73,268 +73,268 @@ std::string gLoginPage;
std::string gCurrentGrid;
std::string LLControlGroup::getString(const std::string& name)
{
- if (name == "CmdLineGridChoice")
- return gCmdLineGridChoice;
- else if (name == "CmdLineHelperURI")
- return gCmdLineHelperURI;
- else if (name == "LoginPage")
- return gLoginPage;
- else if (name == "CurrentGrid")
- return gCurrentGrid;
- return "";
+ if (name == "CmdLineGridChoice")
+ return gCmdLineGridChoice;
+ else if (name == "CmdLineHelperURI")
+ return gCmdLineHelperURI;
+ else if (name == "LoginPage")
+ return gLoginPage;
+ else if (name == "CurrentGrid")
+ return gCurrentGrid;
+ return "";
}
LLSD LLControlGroup::getLLSD(const std::string& name)
{
- if (name == "CmdLineLoginURI")
- {
- if(!gCmdLineLoginURI.empty())
- {
- return LLSD(gCmdLineLoginURI);
- }
- }
- return LLSD();
+ if (name == "CmdLineLoginURI")
+ {
+ if(!gCmdLineLoginURI.empty())
+ {
+ return LLSD(gCmdLineLoginURI);
+ }
+ }
+ return LLSD();
}
LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name)
{
- ctrl_name_table_t::iterator iter = mNameTable.find(name);
- return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second;
+ ctrl_name_table_t::iterator iter = mNameTable.find(name);
+ return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second;
}
LLControlGroup gSavedSettings("test");
const char *gSampleGridFile =
- "<?xml version=\"1.0\"?>"
- "<llsd>"
- " <map>"
- " <key>foo.bar.com</key>"
- " <map>"
- " <key>helper_uri</key><string>https://foobar/helpers/</string>"
- " <key>label</key><string>Foobar Grid</string>"
- " <key>login_page</key><string>foobar/loginpage</string>"
- " <key>login_uri</key>"
- " <array>"
- " <string>foobar/loginuri</string>"
- " </array>"
- " <key>keyname</key><string>foo.bar.com</string>"
- " <key>credential_type</key><string>agent</string>"
- " <key>grid_login_id</key><string>FooBar</string>"
- " </map>"
- " <key>my.grid.com</key>"
- " <map>"
- " <key>helper_uri</key><string>https://mygrid/helpers/</string>"
- " <key>label</key><string>My Grid</string>"
- " <key>login_page</key><string>mygrid/loginpage</string>"
- " <key>login_uri</key>"
- " <array>"
- " <string>mygrid/loginuri</string>"
- " </array>"
- " <key>keyname</key><string>my.grid.com</string>"
- " <key>credential_type</key><string>agent</string>"
- " <key>grid_login_id</key><string>MyGrid</string>"
- " </map>"
- " </map>"
- "</llsd>"
- ;
+ "<?xml version=\"1.0\"?>"
+ "<llsd>"
+ " <map>"
+ " <key>foo.bar.com</key>"
+ " <map>"
+ " <key>helper_uri</key><string>https://foobar/helpers/</string>"
+ " <key>label</key><string>Foobar Grid</string>"
+ " <key>login_page</key><string>foobar/loginpage</string>"
+ " <key>login_uri</key>"
+ " <array>"
+ " <string>foobar/loginuri</string>"
+ " </array>"
+ " <key>keyname</key><string>foo.bar.com</string>"
+ " <key>credential_type</key><string>agent</string>"
+ " <key>grid_login_id</key><string>FooBar</string>"
+ " </map>"
+ " <key>my.grid.com</key>"
+ " <map>"
+ " <key>helper_uri</key><string>https://mygrid/helpers/</string>"
+ " <key>label</key><string>My Grid</string>"
+ " <key>login_page</key><string>mygrid/loginpage</string>"
+ " <key>login_uri</key>"
+ " <array>"
+ " <string>mygrid/loginuri</string>"
+ " </array>"
+ " <key>keyname</key><string>my.grid.com</string>"
+ " <key>credential_type</key><string>agent</string>"
+ " <key>grid_login_id</key><string>MyGrid</string>"
+ " </map>"
+ " </map>"
+ "</llsd>"
+ ;
// -------------------------------------------------------------------------------------------
// TUT
// -------------------------------------------------------------------------------------------
namespace tut
{
- // Test wrapper declaration : wrapping nothing for the moment
- struct slurlTest
- {
- slurlTest()
- {
- LLGridManager::getInstance()->initialize(std::string(""));
- }
- ~slurlTest()
- {
- }
- };
-
- // Tut templating thingamagic: test group, object and test instance
- typedef test_group<slurlTest> slurlTestFactory;
- typedef slurlTestFactory::object slurlTestObject;
- tut::slurlTestFactory tut_test("LLSlurl");
-
- // ---------------------------------------------------------------------------------------
- // Test functions
- // ---------------------------------------------------------------------------------------
- // construction from slurl string
- template<> template<>
- void slurlTestObject::test<1>()
- {
- llofstream gridfile(TEST_FILENAME);
- gridfile << gSampleGridFile;
- gridfile.close();
-
- LLGridManager::getInstance()->initialize(TEST_FILENAME);
-
- LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
-
- LLSLURL slurl = LLSLURL("");
- ensure_equals("null slurl", (int)slurl.getType(), LLSLURL::LAST_LOCATION);
-
- slurl = LLSLURL("http://slurl.com/secondlife/myregion");
- ensure_equals("slurl.com slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(),
- "http://maps.secondlife.com/secondlife/myregion/128/128/0");
-
- slurl = LLSLURL("http://maps.secondlife.com/secondlife/myregion/1/2/3");
- ensure_equals("maps.secondlife.com slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("maps.secondlife.com slurl, region + coords", slurl.getSLURLString(),
- "http://maps.secondlife.com/secondlife/myregion/1/2/3");
-
- slurl = LLSLURL("secondlife://");
- ensure_equals("secondlife: slurl, empty - type", slurl.getType(), LLSLURL::EMPTY);
-
- slurl = LLSLURL("secondlife:///");
- ensure_equals("secondlife: slurl, root - type", slurl.getType(), LLSLURL::EMPTY);
-
- slurl = LLSLURL("secondlife://myregion");
- ensure_equals("secondlife: slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(),
- "http://maps.secondlife.com/secondlife/myregion/128/128/0");
-
- slurl = LLSLURL("secondlife://myregion/1/2/3");
- ensure_equals("secondlife: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(),
- "http://maps.secondlife.com/secondlife/myregion/1/2/3");
-
- slurl = LLSLURL("/myregion");
- ensure_equals("/region slurl, region- type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("/region slurl, region ", slurl.getSLURLString(),
- "http://maps.secondlife.com/secondlife/myregion/128/128/0");
-
- slurl = LLSLURL("/myregion/1/2/3");
- ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("/ slurl, region + coords", slurl.getSLURLString(),
- "http://maps.secondlife.com/secondlife/myregion/1/2/3");
-
- slurl = LLSLURL("my region/1/2/3");
- ensure_equals(" slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals(" slurl, region + coords", slurl.getSLURLString(),
- "http://maps.secondlife.com/secondlife/my%20region/1/2/3");
-
- LLGridManager::getInstance()->setGridChoice("my.grid.com");
- slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
- ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("grid slurl, region + coords", slurl.getSLURLString(),
- "https://my.grid.com/region/my%20region/1/2/3");
-
- slurl = LLSLURL("https://my.grid.com/region/my region");
- ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("grid slurl, region + coords", slurl.getSLURLString(),
- "https://my.grid.com/region/my%20region/128/128/0");
-
- LLGridManager::getInstance()->setGridChoice("foo.bar.com");
- slurl = LLSLURL("/myregion/1/2/3");
- ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("/ slurl, region + coords", slurl.getSLURLString(),
- "https://foo.bar.com/region/myregion/1/2/3");
-
- slurl = LLSLURL("myregion/1/2/3");
- ensure_equals(": slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals(" slurl, region + coords", slurl.getSLURLString(),
- "https://foo.bar.com/region/myregion/1/2/3");
-
- slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME);
- ensure_equals("home", slurl.getType(), LLSLURL::HOME_LOCATION);
-
- slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST);
- ensure_equals("last", slurl.getType(), LLSLURL::LAST_LOCATION);
-
- slurl = LLSLURL("secondlife:///app/foo/bar?12345");
- ensure_equals("app", slurl.getType(), LLSLURL::APP);
- ensure_equals("appcmd", slurl.getAppCmd(), "foo");
- ensure_equals("apppath", slurl.getAppPath().size(), 1);
- ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
- ensure_equals("appquery", slurl.getAppQuery(), "12345");
- ensure_equals("grid1", slurl.getGrid(), "FooBar");
-
- slurl = LLSLURL("secondlife://Aditi/app/foo/bar?12345");
- ensure_equals("app", slurl.getType(), LLSLURL::APP);
- ensure_equals("appcmd", slurl.getAppCmd(), "foo");
- ensure_equals("apppath", slurl.getAppPath().size(), 1);
- ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
- ensure_equals("appquery", slurl.getAppQuery(), "12345");
- ensure_equals("grid2", slurl.getGrid(), "Aditi");
-
- LLGridManager::getInstance()->setGridChoice("foo.bar.com");
- slurl = LLSLURL("secondlife:///secondlife/myregion/1/2/3");
- ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("region" , "myregion", slurl.getRegion());
- ensure_equals("grid3", slurl.getGrid(), "util.agni.lindenlab.com");
-
- slurl = LLSLURL("secondlife://Aditi/secondlife/myregion/1/2/3");
- ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("region" , "myregion", slurl.getRegion());
- ensure_equals("grid4", slurl.getGrid(), "Aditi" );
-
- LLGridManager::getInstance()->setGridChoice("my.grid.com");
- slurl = LLSLURL("https://my.grid.com/app/foo/bar?12345");
- ensure_equals("app", slurl.getType(), LLSLURL::APP);
- ensure_equals("appcmd", slurl.getAppCmd(), "foo");
- ensure_equals("apppath", slurl.getAppPath().size(), 1);
- ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
- ensure_equals("appquery", slurl.getAppQuery(), "12345");
-
- }
-
- // construction from grid/region/vector combos
- template<> template<>
- void slurlTestObject::test<2>()
- {
- llofstream gridfile(TEST_FILENAME);
- gridfile << gSampleGridFile;
- gridfile.close();
-
- LLGridManager::getInstance()->initialize(TEST_FILENAME);
-
- LLSLURL slurl = LLSLURL("my.grid.com", "my region");
- ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals("grid/region", slurl.getSLURLString(),
- "https://my.grid.com/region/my%20region/128/128/0");
-
- slurl = LLSLURL("my.grid.com", "my region", LLVector3(1,2,3));
- ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals(" grid/region/vector", slurl.getSLURLString(),
- "https://my.grid.com/region/my%20region/1/2/3");
-
- LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
- slurl = LLSLURL("my region", LLVector3(1,2,3));
- ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals(" default grid/region/vector", slurl.getSLURLString(),
- "http://maps.secondlife.com/secondlife/my%20region/1/2/3");
-
- LLGridManager::getInstance()->setGridChoice("MyGrid");
- slurl = LLSLURL("my region", LLVector3(1,2,3));
- ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
- ensure_equals(" default grid/region/vector", slurl.getSLURLString(),
- "https://my.grid.com/region/my%20region/1/2/3");
-
- }
- // Accessors
- template<> template<>
- void slurlTestObject::test<3>()
- {
- llofstream gridfile(TEST_FILENAME);
- gridfile << gSampleGridFile;
- gridfile.close();
-
- LLGridManager::getInstance()->initialize(TEST_FILENAME);
-
- LLGridManager::getInstance()->setGridChoice("my.grid.com");
- LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
- ensure_equals("login string", slurl.getLoginString(), "uri:my region&amp;1&amp;2&amp;3");
- ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3");
- ensure_equals("grid", slurl.getGrid(), "my.grid.com");
- ensure_equals("region", slurl.getRegion(), "my region");
- ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3));
-
- }
+ // Test wrapper declaration : wrapping nothing for the moment
+ struct slurlTest
+ {
+ slurlTest()
+ {
+ LLGridManager::getInstance()->initialize(std::string(""));
+ }
+ ~slurlTest()
+ {
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<slurlTest> slurlTestFactory;
+ typedef slurlTestFactory::object slurlTestObject;
+ tut::slurlTestFactory tut_test("LLSlurl");
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // ---------------------------------------------------------------------------------------
+ // construction from slurl string
+ template<> template<>
+ void slurlTestObject::test<1>()
+ {
+ llofstream gridfile(TEST_FILENAME);
+ gridfile << gSampleGridFile;
+ gridfile.close();
+
+ LLGridManager::getInstance()->initialize(TEST_FILENAME);
+
+ LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
+
+ LLSLURL slurl = LLSLURL("");
+ ensure_equals("null slurl", (int)slurl.getType(), LLSLURL::LAST_LOCATION);
+
+ slurl = LLSLURL("http://slurl.com/secondlife/myregion");
+ ensure_equals("slurl.com slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/128/128/0");
+
+ slurl = LLSLURL("http://maps.secondlife.com/secondlife/myregion/1/2/3");
+ ensure_equals("maps.secondlife.com slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("maps.secondlife.com slurl, region + coords", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/1/2/3");
+
+ slurl = LLSLURL("secondlife://");
+ ensure_equals("secondlife: slurl, empty - type", slurl.getType(), LLSLURL::EMPTY);
+
+ slurl = LLSLURL("secondlife:///");
+ ensure_equals("secondlife: slurl, root - type", slurl.getType(), LLSLURL::EMPTY);
+
+ slurl = LLSLURL("secondlife://myregion");
+ ensure_equals("secondlife: slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/128/128/0");
+
+ slurl = LLSLURL("secondlife://myregion/1/2/3");
+ ensure_equals("secondlife: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/1/2/3");
+
+ slurl = LLSLURL("/myregion");
+ ensure_equals("/region slurl, region- type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("/region slurl, region ", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/128/128/0");
+
+ slurl = LLSLURL("/myregion/1/2/3");
+ ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("/ slurl, region + coords", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/myregion/1/2/3");
+
+ slurl = LLSLURL("my region/1/2/3");
+ ensure_equals(" slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" slurl, region + coords", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/my%20region/1/2/3");
+
+ LLGridManager::getInstance()->setGridChoice("my.grid.com");
+ slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
+ ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("grid slurl, region + coords", slurl.getSLURLString(),
+ "https://my.grid.com/region/my%20region/1/2/3");
+
+ slurl = LLSLURL("https://my.grid.com/region/my region");
+ ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("grid slurl, region + coords", slurl.getSLURLString(),
+ "https://my.grid.com/region/my%20region/128/128/0");
+
+ LLGridManager::getInstance()->setGridChoice("foo.bar.com");
+ slurl = LLSLURL("/myregion/1/2/3");
+ ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("/ slurl, region + coords", slurl.getSLURLString(),
+ "https://foo.bar.com/region/myregion/1/2/3");
+
+ slurl = LLSLURL("myregion/1/2/3");
+ ensure_equals(": slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" slurl, region + coords", slurl.getSLURLString(),
+ "https://foo.bar.com/region/myregion/1/2/3");
+
+ slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME);
+ ensure_equals("home", slurl.getType(), LLSLURL::HOME_LOCATION);
+
+ slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST);
+ ensure_equals("last", slurl.getType(), LLSLURL::LAST_LOCATION);
+
+ slurl = LLSLURL("secondlife:///app/foo/bar?12345");
+ ensure_equals("app", slurl.getType(), LLSLURL::APP);
+ ensure_equals("appcmd", slurl.getAppCmd(), "foo");
+ ensure_equals("apppath", slurl.getAppPath().size(), 1);
+ ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
+ ensure_equals("appquery", slurl.getAppQuery(), "12345");
+ ensure_equals("grid1", slurl.getGrid(), "FooBar");
+
+ slurl = LLSLURL("secondlife://Aditi/app/foo/bar?12345");
+ ensure_equals("app", slurl.getType(), LLSLURL::APP);
+ ensure_equals("appcmd", slurl.getAppCmd(), "foo");
+ ensure_equals("apppath", slurl.getAppPath().size(), 1);
+ ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
+ ensure_equals("appquery", slurl.getAppQuery(), "12345");
+ ensure_equals("grid2", slurl.getGrid(), "Aditi");
+
+ LLGridManager::getInstance()->setGridChoice("foo.bar.com");
+ slurl = LLSLURL("secondlife:///secondlife/myregion/1/2/3");
+ ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("region" , "myregion", slurl.getRegion());
+ ensure_equals("grid3", slurl.getGrid(), "util.agni.lindenlab.com");
+
+ slurl = LLSLURL("secondlife://Aditi/secondlife/myregion/1/2/3");
+ ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("region" , "myregion", slurl.getRegion());
+ ensure_equals("grid4", slurl.getGrid(), "Aditi" );
+
+ LLGridManager::getInstance()->setGridChoice("my.grid.com");
+ slurl = LLSLURL("https://my.grid.com/app/foo/bar?12345");
+ ensure_equals("app", slurl.getType(), LLSLURL::APP);
+ ensure_equals("appcmd", slurl.getAppCmd(), "foo");
+ ensure_equals("apppath", slurl.getAppPath().size(), 1);
+ ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
+ ensure_equals("appquery", slurl.getAppQuery(), "12345");
+
+ }
+
+ // construction from grid/region/vector combos
+ template<> template<>
+ void slurlTestObject::test<2>()
+ {
+ llofstream gridfile(TEST_FILENAME);
+ gridfile << gSampleGridFile;
+ gridfile.close();
+
+ LLGridManager::getInstance()->initialize(TEST_FILENAME);
+
+ LLSLURL slurl = LLSLURL("my.grid.com", "my region");
+ ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals("grid/region", slurl.getSLURLString(),
+ "https://my.grid.com/region/my%20region/128/128/0");
+
+ slurl = LLSLURL("my.grid.com", "my region", LLVector3(1,2,3));
+ ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" grid/region/vector", slurl.getSLURLString(),
+ "https://my.grid.com/region/my%20region/1/2/3");
+
+ LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
+ slurl = LLSLURL("my region", LLVector3(1,2,3));
+ ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" default grid/region/vector", slurl.getSLURLString(),
+ "http://maps.secondlife.com/secondlife/my%20region/1/2/3");
+
+ LLGridManager::getInstance()->setGridChoice("MyGrid");
+ slurl = LLSLURL("my region", LLVector3(1,2,3));
+ ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
+ ensure_equals(" default grid/region/vector", slurl.getSLURLString(),
+ "https://my.grid.com/region/my%20region/1/2/3");
+
+ }
+ // Accessors
+ template<> template<>
+ void slurlTestObject::test<3>()
+ {
+ llofstream gridfile(TEST_FILENAME);
+ gridfile << gSampleGridFile;
+ gridfile.close();
+
+ LLGridManager::getInstance()->initialize(TEST_FILENAME);
+
+ LLGridManager::getInstance()->setGridChoice("my.grid.com");
+ LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
+ ensure_equals("login string", slurl.getLoginString(), "uri:my region&amp;1&amp;2&amp;3");
+ ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3");
+ ensure_equals("grid", slurl.getGrid(), "my.grid.com");
+ ensure_equals("region", slurl.getRegion(), "my region");
+ ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3));
+
+ }
}
diff --git a/indra/newview/tests/lltextureinfo_test.cpp b/indra/newview/tests/lltextureinfo_test.cpp
index 73ace1de37..d491ce0f65 100644
--- a/indra/newview/tests/lltextureinfo_test.cpp
+++ b/indra/newview/tests/lltextureinfo_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llwtextureinfo_test.cpp
* @author Si & Gabriel
* @date 2009-03-30
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,7 +37,7 @@
// -------------------------------------------------------------------------------------------
// Stubbing: Declarations required to link and run the class being tested
-// Notes:
+// Notes:
// * Add here stubbed implementation of the few classes and methods used in the class to be tested
// * Add as little as possible (let the link errors guide you)
// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code)
@@ -53,226 +53,226 @@
namespace tut
{
- // Test wrapper declarations
- struct textureinfo_test
- {
- // Constructor and destructor of the test wrapper
- textureinfo_test()
- {
- }
- ~textureinfo_test()
- {
- }
- };
-
- // Tut templating thingamagic: test group, object and test instance
- typedef test_group<textureinfo_test> textureinfo_t;
- typedef textureinfo_t::object textureinfo_object_t;
- tut::textureinfo_t tut_textureinfo("LLTectureInfo");
-
-
- // ---------------------------------------------------------------------------------------
- // Test functions
- // Notes:
- // * Test as many as you possibly can without requiring a full blown simulation of everything
- // * The tests are executed in sequence so the test instance state may change between calls
- // * Remember that you cannot test private methods with tut
- // ---------------------------------------------------------------------------------------
-
- // ---------------------------------------------------------------------------------------
- // Test the LLTextureInfo
- // ---------------------------------------------------------------------------------------
-
-
- // Test instantiation
- template<> template<>
- void textureinfo_object_t::test<1>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
- ensure("have we crashed?", true);
- }
-
- // Check lltextureinfo does not contain UUIDs we haven't added
- template<> template<>
- void textureinfo_object_t::test<2>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- LLUUID nonExistant("3a0efa3b-84dc-4e17-9b8c-79ea028850c1");
- ensure(!tex_info.has(nonExistant));
- }
-
- // Check we can add a request time for a texture
- template<> template<>
- void textureinfo_object_t::test<3>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
- tex_info.setRequestStartTime(id, 200);
-
- ensure_equals(tex_info.getRequestStartTime(id), 200);
- }
-
- // Check time for non-existant texture
- template<> template<>
- void textureinfo_object_t::test<4>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- LLUUID nonExistant("3a0efa3b-84dc-4e17-9b8c-79ea028850c1");
- ensure_equals(tex_info.getRequestStartTime(nonExistant), 0);
- }
-
- // Check download complete time for non existant texture
- template<> template<>
- void textureinfo_object_t::test<5>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- LLUUID nonExistant("3a0efa3b-84dc-4e17-9b8c-79ea028850c1");
- ensure_equals(tex_info.getRequestCompleteTime(nonExistant), 0);
- }
-
- // requested size is passed in correctly
- template<> template<>
- void textureinfo_object_t::test<6>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
- tex_info.setRequestSize(id, 600);
-
- ensure_equals(tex_info.getRequestSize(id), 600);
- }
-
- // transport type is recorded correctly (http)
- template<> template<>
- void textureinfo_object_t::test<7>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
- tex_info.setRequestType(id, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
-
- ensure_equals(tex_info.getRequestType(id), LLTextureInfoDetails::REQUEST_TYPE_HTTP);
- }
-
- // transport type is recorded correctly (udp)
- template<> template<>
- void textureinfo_object_t::test<8>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
- tex_info.setRequestType(id, LLTextureInfoDetails::REQUEST_TYPE_UDP);
-
- ensure_equals(tex_info.getRequestType(id), LLTextureInfoDetails::REQUEST_TYPE_UDP);
- }
-
- // request offset is recorded correctly
- template<> template<>
- void textureinfo_object_t::test<9>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
- tex_info.setRequestOffset(id, 1234);
-
- ensure_equals(tex_info.getRequestOffset(id), 1234);
- }
-
- // ask for averages gives us correct figure
- template<> template<>
- void textureinfo_object_t::test<10>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- S32 requestStartTimeOne = 200;
- S32 requestEndTimeOne = 400;
- S32 requestSizeOne = 1024;
- S32 requestSizeOneBits = requestSizeOne * 8;
- LLUUID id1("10e65d70-46fd-429f-841a-bf698e9424d3");
- tex_info.setRequestStartTime(id1, requestStartTimeOne);
- tex_info.setRequestSize(id1, requestSizeOne);
- tex_info.setRequestType(id1, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
- tex_info.setRequestCompleteTimeAndLog(id1, requestEndTimeOne);
-
- U32 requestStartTimeTwo = 100;
- U32 requestEndTimeTwo = 500;
- U32 requestSizeTwo = 2048;
- S32 requestSizeTwoBits = requestSizeTwo * 8;
- LLUUID id2("10e65d70-46fd-429f-841a-bf698e9424d4");
- tex_info.setRequestStartTime(id2, requestStartTimeTwo);
- tex_info.setRequestSize(id2, requestSizeTwo);
- tex_info.setRequestType(id2, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
- tex_info.setRequestCompleteTimeAndLog(id2, requestEndTimeTwo);
-
- S32 averageBitRate = ((requestSizeOneBits/(requestEndTimeOne - requestStartTimeOne)) +
- (requestSizeTwoBits/(requestEndTimeTwo - requestStartTimeTwo))) / 2;
-
- S32 totalBytes = requestSizeOne + requestSizeTwo;
-
- LLSD results = tex_info.getAverages();
- ensure_equals("is average bits per second correct", results["bits_per_second"].asInteger(), averageBitRate);
- ensure_equals("is total bytes is correct", results["bytes_downloaded"].asInteger(), totalBytes);
- ensure_equals("is transport correct", results["transport"].asString(), std::string("HTTP"));
- }
-
- // make sure averages cleared when reset is called
- template<> template<>
- void textureinfo_object_t::test<11>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- S32 requestStartTimeOne = 200;
- S32 requestEndTimeOne = 400;
- S32 requestSizeOne = 1024;
- LLUUID id1("10e65d70-46fd-429f-841a-bf698e9424d3");
- tex_info.setRequestStartTime(id1, requestStartTimeOne);
- tex_info.setRequestSize(id1, requestSizeOne);
- tex_info.setRequestType(id1, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
- tex_info.setRequestCompleteTimeAndLog(id1, requestEndTimeOne);
-
- tex_info.getAverages();
- tex_info.reset();
- LLSD results = tex_info.getAverages();
- ensure_equals("is average bits per second correct", results["bits_per_second"].asInteger(), 0);
- ensure_equals("is total bytes is correct", results["bytes_downloaded"].asInteger(), 0);
- ensure_equals("is transport correct", results["transport"].asString(), std::string("NONE"));
- }
-
- // make sure map item removed when expired
- template<> template<>
- void textureinfo_object_t::test<12>()
- {
- LLTextureInfo tex_info;
- tex_info.setUpLogging(true, true);
-
- S32 requestStartTimeOne = 200;
- S32 requestEndTimeOne = 400;
- S32 requestSizeOne = 1024;
- LLUUID id1("10e65d70-46fd-429f-841a-bf698e9424d3");
- tex_info.setRequestStartTime(id1, requestStartTimeOne);
- tex_info.setRequestSize(id1, requestSizeOne);
- tex_info.setRequestType(id1, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
-
- ensure_equals("map item created", tex_info.getTextureInfoMapSize(), 1);
-
- tex_info.setRequestCompleteTimeAndLog(id1, requestEndTimeOne);
-
- ensure_equals("map item removed when consumed", tex_info.getTextureInfoMapSize(), 0);
- }
+ // Test wrapper declarations
+ struct textureinfo_test
+ {
+ // Constructor and destructor of the test wrapper
+ textureinfo_test()
+ {
+ }
+ ~textureinfo_test()
+ {
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<textureinfo_test> textureinfo_t;
+ typedef textureinfo_t::object textureinfo_object_t;
+ tut::textureinfo_t tut_textureinfo("LLTectureInfo");
+
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // Notes:
+ // * Test as many as you possibly can without requiring a full blown simulation of everything
+ // * The tests are executed in sequence so the test instance state may change between calls
+ // * Remember that you cannot test private methods with tut
+ // ---------------------------------------------------------------------------------------
+
+ // ---------------------------------------------------------------------------------------
+ // Test the LLTextureInfo
+ // ---------------------------------------------------------------------------------------
+
+
+ // Test instantiation
+ template<> template<>
+ void textureinfo_object_t::test<1>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+ ensure("have we crashed?", true);
+ }
+
+ // Check lltextureinfo does not contain UUIDs we haven't added
+ template<> template<>
+ void textureinfo_object_t::test<2>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ LLUUID nonExistant("3a0efa3b-84dc-4e17-9b8c-79ea028850c1");
+ ensure(!tex_info.has(nonExistant));
+ }
+
+ // Check we can add a request time for a texture
+ template<> template<>
+ void textureinfo_object_t::test<3>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
+ tex_info.setRequestStartTime(id, 200);
+
+ ensure_equals(tex_info.getRequestStartTime(id), 200);
+ }
+
+ // Check time for non-existant texture
+ template<> template<>
+ void textureinfo_object_t::test<4>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ LLUUID nonExistant("3a0efa3b-84dc-4e17-9b8c-79ea028850c1");
+ ensure_equals(tex_info.getRequestStartTime(nonExistant), 0);
+ }
+
+ // Check download complete time for non existant texture
+ template<> template<>
+ void textureinfo_object_t::test<5>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ LLUUID nonExistant("3a0efa3b-84dc-4e17-9b8c-79ea028850c1");
+ ensure_equals(tex_info.getRequestCompleteTime(nonExistant), 0);
+ }
+
+ // requested size is passed in correctly
+ template<> template<>
+ void textureinfo_object_t::test<6>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
+ tex_info.setRequestSize(id, 600);
+
+ ensure_equals(tex_info.getRequestSize(id), 600);
+ }
+
+ // transport type is recorded correctly (http)
+ template<> template<>
+ void textureinfo_object_t::test<7>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
+ tex_info.setRequestType(id, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
+
+ ensure_equals(tex_info.getRequestType(id), LLTextureInfoDetails::REQUEST_TYPE_HTTP);
+ }
+
+ // transport type is recorded correctly (udp)
+ template<> template<>
+ void textureinfo_object_t::test<8>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
+ tex_info.setRequestType(id, LLTextureInfoDetails::REQUEST_TYPE_UDP);
+
+ ensure_equals(tex_info.getRequestType(id), LLTextureInfoDetails::REQUEST_TYPE_UDP);
+ }
+
+ // request offset is recorded correctly
+ template<> template<>
+ void textureinfo_object_t::test<9>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ LLUUID id("10e65d70-46fd-429f-841a-bf698e9424d3");
+ tex_info.setRequestOffset(id, 1234);
+
+ ensure_equals(tex_info.getRequestOffset(id), 1234);
+ }
+
+ // ask for averages gives us correct figure
+ template<> template<>
+ void textureinfo_object_t::test<10>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ S32 requestStartTimeOne = 200;
+ S32 requestEndTimeOne = 400;
+ S32 requestSizeOne = 1024;
+ S32 requestSizeOneBits = requestSizeOne * 8;
+ LLUUID id1("10e65d70-46fd-429f-841a-bf698e9424d3");
+ tex_info.setRequestStartTime(id1, requestStartTimeOne);
+ tex_info.setRequestSize(id1, requestSizeOne);
+ tex_info.setRequestType(id1, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
+ tex_info.setRequestCompleteTimeAndLog(id1, requestEndTimeOne);
+
+ U32 requestStartTimeTwo = 100;
+ U32 requestEndTimeTwo = 500;
+ U32 requestSizeTwo = 2048;
+ S32 requestSizeTwoBits = requestSizeTwo * 8;
+ LLUUID id2("10e65d70-46fd-429f-841a-bf698e9424d4");
+ tex_info.setRequestStartTime(id2, requestStartTimeTwo);
+ tex_info.setRequestSize(id2, requestSizeTwo);
+ tex_info.setRequestType(id2, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
+ tex_info.setRequestCompleteTimeAndLog(id2, requestEndTimeTwo);
+
+ S32 averageBitRate = ((requestSizeOneBits/(requestEndTimeOne - requestStartTimeOne)) +
+ (requestSizeTwoBits/(requestEndTimeTwo - requestStartTimeTwo))) / 2;
+
+ S32 totalBytes = requestSizeOne + requestSizeTwo;
+
+ LLSD results = tex_info.getAverages();
+ ensure_equals("is average bits per second correct", results["bits_per_second"].asInteger(), averageBitRate);
+ ensure_equals("is total bytes is correct", results["bytes_downloaded"].asInteger(), totalBytes);
+ ensure_equals("is transport correct", results["transport"].asString(), std::string("HTTP"));
+ }
+
+ // make sure averages cleared when reset is called
+ template<> template<>
+ void textureinfo_object_t::test<11>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ S32 requestStartTimeOne = 200;
+ S32 requestEndTimeOne = 400;
+ S32 requestSizeOne = 1024;
+ LLUUID id1("10e65d70-46fd-429f-841a-bf698e9424d3");
+ tex_info.setRequestStartTime(id1, requestStartTimeOne);
+ tex_info.setRequestSize(id1, requestSizeOne);
+ tex_info.setRequestType(id1, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
+ tex_info.setRequestCompleteTimeAndLog(id1, requestEndTimeOne);
+
+ tex_info.getAverages();
+ tex_info.reset();
+ LLSD results = tex_info.getAverages();
+ ensure_equals("is average bits per second correct", results["bits_per_second"].asInteger(), 0);
+ ensure_equals("is total bytes is correct", results["bytes_downloaded"].asInteger(), 0);
+ ensure_equals("is transport correct", results["transport"].asString(), std::string("NONE"));
+ }
+
+ // make sure map item removed when expired
+ template<> template<>
+ void textureinfo_object_t::test<12>()
+ {
+ LLTextureInfo tex_info;
+ tex_info.setUpLogging(true, true);
+
+ S32 requestStartTimeOne = 200;
+ S32 requestEndTimeOne = 400;
+ S32 requestSizeOne = 1024;
+ LLUUID id1("10e65d70-46fd-429f-841a-bf698e9424d3");
+ tex_info.setRequestStartTime(id1, requestStartTimeOne);
+ tex_info.setRequestSize(id1, requestSizeOne);
+ tex_info.setRequestType(id1, LLTextureInfoDetails::REQUEST_TYPE_HTTP);
+
+ ensure_equals("map item created", tex_info.getTextureInfoMapSize(), 1);
+
+ tex_info.setRequestCompleteTimeAndLog(id1, requestEndTimeOne);
+
+ ensure_equals("map item removed when consumed", tex_info.getTextureInfoMapSize(), 0);
+ }
}
diff --git a/indra/newview/tests/lltextureinfodetails_test.cpp b/indra/newview/tests/lltextureinfodetails_test.cpp
index 31ec5f9d4e..58cab03c50 100644
--- a/indra/newview/tests/lltextureinfodetails_test.cpp
+++ b/indra/newview/tests/lltextureinfodetails_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llwtextureinfodetails_test.cpp
* @author Si & Gabriel
* @date 2009-03-30
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,7 +36,7 @@
// -------------------------------------------------------------------------------------------
// Stubbing: Declarations required to link and run the class being tested
-// Notes:
+// Notes:
// * Add here stubbed implementation of the few classes and methods used in the class to be tested
// * Add as little as possible (let the link errors guide you)
// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code)
@@ -52,41 +52,41 @@
namespace tut
{
- // Test wrapper declarations
- struct textureinfodetails_test
- {
- // Constructor and destructor of the test wrapper
- textureinfodetails_test()
- {
- }
- ~textureinfodetails_test()
- {
- }
- };
+ // Test wrapper declarations
+ struct textureinfodetails_test
+ {
+ // Constructor and destructor of the test wrapper
+ textureinfodetails_test()
+ {
+ }
+ ~textureinfodetails_test()
+ {
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<textureinfodetails_test> textureinfodetails_t;
+ typedef textureinfodetails_t::object textureinfodetails_object_t;
+ tut::textureinfodetails_t tut_textureinfodetails("LLTextureInfoDetails");
- // Tut templating thingamagic: test group, object and test instance
- typedef test_group<textureinfodetails_test> textureinfodetails_t;
- typedef textureinfodetails_t::object textureinfodetails_object_t;
- tut::textureinfodetails_t tut_textureinfodetails("LLTextureInfoDetails");
-
- // ---------------------------------------------------------------------------------------
- // Test functions
- // Notes:
- // * Test as many as you possibly can without requiring a full blown simulation of everything
- // * The tests are executed in sequence so the test instance state may change between calls
- // * Remember that you cannot test private methods with tut
- // ---------------------------------------------------------------------------------------
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // Notes:
+ // * Test as many as you possibly can without requiring a full blown simulation of everything
+ // * The tests are executed in sequence so the test instance state may change between calls
+ // * Remember that you cannot test private methods with tut
+ // ---------------------------------------------------------------------------------------
- // ---------------------------------------------------------------------------------------
- // Test the LLTextureInfo
- // ---------------------------------------------------------------------------------------
+ // ---------------------------------------------------------------------------------------
+ // Test the LLTextureInfo
+ // ---------------------------------------------------------------------------------------
- // Test instantiation
- template<> template<>
- void textureinfodetails_object_t::test<1>()
- {
- ensure("have we crashed?", true);
- }
+ // Test instantiation
+ template<> template<>
+ void textureinfodetails_object_t::test<1>()
+ {
+ ensure("have we crashed?", true);
+ }
}
diff --git a/indra/newview/tests/lltexturestatsuploader_test.cpp b/indra/newview/tests/lltexturestatsuploader_test.cpp
index 4438523022..782a4892b9 100644
--- a/indra/newview/tests/lltexturestatsuploader_test.cpp
+++ b/indra/newview/tests/lltexturestatsuploader_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lltexturestatsuploader_test.cpp
* @author Si
* @date 2009-05-27
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,7 +36,7 @@
// -------------------------------------------------------------------------------------------
// Stubbing: Declarations required to link and run the class being tested
-// Notes:
+// Notes:
// * Add here stubbed implementation of the few classes and methods used in the class to be tested
// * Add as little as possible (let the link errors guide you)
// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code)
@@ -51,16 +51,16 @@ static std::string most_recent_url;
static LLSD most_recent_body;
void LLHTTPClient::post(
- const std::string& url,
- const LLSD& body,
- ResponderPtr,
- const LLSD& headers,
- const F32 timeout)
+ const std::string& url,
+ const LLSD& body,
+ ResponderPtr,
+ const LLSD& headers,
+ const F32 timeout)
{
- // set some sensor code
- most_recent_url = url;
- most_recent_body = body;
- return;
+ // set some sensor code
+ most_recent_url = url;
+ most_recent_body = body;
+ return;
}
// End Stubbing
@@ -72,79 +72,79 @@ void LLHTTPClient::post(
namespace tut
{
- // Test wrapper declarations
- struct texturestatsuploader_test
- {
- // Constructor and destructor of the test wrapper
- texturestatsuploader_test()
- {
- most_recent_url = "some sort of default text that should never match anything the tests are expecting!";
- LLSD blank_llsd;
- most_recent_body = blank_llsd;
- }
- ~texturestatsuploader_test()
- {
- }
- };
-
- // Tut templating thingamagic: test group, object and test instance
- typedef test_group<texturestatsuploader_test> texturestatsuploader_t;
- typedef texturestatsuploader_t::object texturestatsuploader_object_t;
- tut::texturestatsuploader_t tut_texturestatsuploader("LLTextureStatsUploader");
-
-
- // ---------------------------------------------------------------------------------------
- // Test functions
- // Notes:
- // * Test as many as you possibly can without requiring a full blown simulation of everything
- // * The tests are executed in sequence so the test instance state may change between calls
- // * Remember that you cannot test private methods with tut
- // ---------------------------------------------------------------------------------------
-
- // ---------------------------------------------------------------------------------------
- // Test the LLTextureInfo
- // ---------------------------------------------------------------------------------------
-
-
- // Test instantiation
- template<> template<>
- void texturestatsuploader_object_t::test<1>()
- {
- LLTextureStatsUploader tsu;
- LL_INFOS() << &tsu << LL_ENDL;
- ensure("have we crashed?", true);
- }
-
- // does it call out to the provided url if we ask it to?
- template<> template<>
- void texturestatsuploader_object_t::test<2>()
- {
- LLTextureStatsUploader tsu;
- std::string url = "http://blahblahblah";
- LLSD texture_stats;
- tsu.uploadStatsToSimulator(url, texture_stats);
- ensure_equals("did the right url get called?", most_recent_url, url);
- ensure_equals("did the right body get sent?", most_recent_body, texture_stats);
- }
-
- // does it not call out to the provided url if we send it an ungranted cap?
- template<> template<>
- void texturestatsuploader_object_t::test<3>()
- {
- LLTextureStatsUploader tsu;
-
- // this url left intentionally blank to mirror
- // not getting a cap in the caller.
- std::string url_for_ungranted_cap = "";
-
- LLSD texture_stats;
- std::string most_recent_url_before_test = most_recent_url;
- tsu.uploadStatsToSimulator(url_for_ungranted_cap, texture_stats);
-
- ensure_equals("hopefully no url got called!", most_recent_url, most_recent_url_before_test);
- }
-
- // does it call out if the data is empty?
- // should it even do that?
+ // Test wrapper declarations
+ struct texturestatsuploader_test
+ {
+ // Constructor and destructor of the test wrapper
+ texturestatsuploader_test()
+ {
+ most_recent_url = "some sort of default text that should never match anything the tests are expecting!";
+ LLSD blank_llsd;
+ most_recent_body = blank_llsd;
+ }
+ ~texturestatsuploader_test()
+ {
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<texturestatsuploader_test> texturestatsuploader_t;
+ typedef texturestatsuploader_t::object texturestatsuploader_object_t;
+ tut::texturestatsuploader_t tut_texturestatsuploader("LLTextureStatsUploader");
+
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // Notes:
+ // * Test as many as you possibly can without requiring a full blown simulation of everything
+ // * The tests are executed in sequence so the test instance state may change between calls
+ // * Remember that you cannot test private methods with tut
+ // ---------------------------------------------------------------------------------------
+
+ // ---------------------------------------------------------------------------------------
+ // Test the LLTextureInfo
+ // ---------------------------------------------------------------------------------------
+
+
+ // Test instantiation
+ template<> template<>
+ void texturestatsuploader_object_t::test<1>()
+ {
+ LLTextureStatsUploader tsu;
+ LL_INFOS() << &tsu << LL_ENDL;
+ ensure("have we crashed?", true);
+ }
+
+ // does it call out to the provided url if we ask it to?
+ template<> template<>
+ void texturestatsuploader_object_t::test<2>()
+ {
+ LLTextureStatsUploader tsu;
+ std::string url = "http://blahblahblah";
+ LLSD texture_stats;
+ tsu.uploadStatsToSimulator(url, texture_stats);
+ ensure_equals("did the right url get called?", most_recent_url, url);
+ ensure_equals("did the right body get sent?", most_recent_body, texture_stats);
+ }
+
+ // does it not call out to the provided url if we send it an ungranted cap?
+ template<> template<>
+ void texturestatsuploader_object_t::test<3>()
+ {
+ LLTextureStatsUploader tsu;
+
+ // this url left intentionally blank to mirror
+ // not getting a cap in the caller.
+ std::string url_for_ungranted_cap = "";
+
+ LLSD texture_stats;
+ std::string most_recent_url_before_test = most_recent_url;
+ tsu.uploadStatsToSimulator(url_for_ungranted_cap, texture_stats);
+
+ ensure_equals("hopefully no url got called!", most_recent_url, most_recent_url_before_test);
+ }
+
+ // does it call out if the data is empty?
+ // should it even do that?
}
diff --git a/indra/newview/tests/llversioninfo_test.cpp b/indra/newview/tests/llversioninfo_test.cpp
index 51a6f8f113..8049e67fc5 100644
--- a/indra/newview/tests/llversioninfo_test.cpp
+++ b/indra/newview/tests/llversioninfo_test.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file llversioninfo_test.cpp
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,82 +40,82 @@ namespace tut
{
struct versioninfo
{
- versioninfo()
- : mResetChannel("Reset Channel")
- {
- std::ostringstream stream;
- stream << LL_VIEWER_VERSION_MAJOR << "."
- << LL_VIEWER_VERSION_MINOR << "."
- << LL_VIEWER_VERSION_PATCH << "."
- << LL_VIEWER_VERSION_BUILD;
- mVersion = stream.str();
- stream.str("");
+ versioninfo()
+ : mResetChannel("Reset Channel")
+ {
+ std::ostringstream stream;
+ stream << LL_VIEWER_VERSION_MAJOR << "."
+ << LL_VIEWER_VERSION_MINOR << "."
+ << LL_VIEWER_VERSION_PATCH << "."
+ << LL_VIEWER_VERSION_BUILD;
+ mVersion = stream.str();
+ stream.str("");
- stream << LL_VIEWER_VERSION_MAJOR << "."
- << LL_VIEWER_VERSION_MINOR << "."
- << LL_VIEWER_VERSION_PATCH;
- mShortVersion = stream.str();
- stream.str("");
+ stream << LL_VIEWER_VERSION_MAJOR << "."
+ << LL_VIEWER_VERSION_MINOR << "."
+ << LL_VIEWER_VERSION_PATCH;
+ mShortVersion = stream.str();
+ stream.str("");
- stream << ll_viewer_channel
- << " "
- << mVersion;
- mVersionAndChannel = stream.str();
- stream.str("");
+ stream << ll_viewer_channel
+ << " "
+ << mVersion;
+ mVersionAndChannel = stream.str();
+ stream.str("");
- stream << mResetChannel
- << " "
- << mVersion;
- mResetVersionAndChannel = stream.str();
- }
- std::string mResetChannel;
- std::string mVersion;
- std::string mShortVersion;
- std::string mVersionAndChannel;
- std::string mResetVersionAndChannel;
+ stream << mResetChannel
+ << " "
+ << mVersion;
+ mResetVersionAndChannel = stream.str();
+ }
+ std::string mResetChannel;
+ std::string mVersion;
+ std::string mShortVersion;
+ std::string mVersionAndChannel;
+ std::string mResetVersionAndChannel;
};
-
- typedef test_group<versioninfo> versioninfo_t;
- typedef versioninfo_t::object versioninfo_object_t;
- tut::versioninfo_t tut_versioninfo("LLVersionInfo");
- template<> template<>
- void versioninfo_object_t::test<1>()
- {
- std::cout << "What we parsed from CMake: " << LL_VIEWER_VERSION_BUILD << std::endl;
- std::cout << "What we get from llversioninfo: " << LLVersionInfo::instance().getBuild() << std::endl;
- ensure_equals("Major version",
- LLVersionInfo::instance().getMajor(),
- LL_VIEWER_VERSION_MAJOR);
- ensure_equals("Minor version",
- LLVersionInfo::instance().getMinor(),
- LL_VIEWER_VERSION_MINOR);
- ensure_equals("Patch version",
- LLVersionInfo::instance().getPatch(),
- LL_VIEWER_VERSION_PATCH);
- ensure_equals("Build version",
- LLVersionInfo::instance().getBuild(),
- LL_VIEWER_VERSION_BUILD);
- ensure_equals("Channel version",
- LLVersionInfo::instance().getChannel(),
- ll_viewer_channel);
- ensure_equals("Version String",
- LLVersionInfo::instance().getVersion(),
- mVersion);
- ensure_equals("Short Version String",
- LLVersionInfo::instance().getShortVersion(),
- mShortVersion);
- ensure_equals("Version and channel String",
- LLVersionInfo::instance().getChannelAndVersion(),
- mVersionAndChannel);
+ typedef test_group<versioninfo> versioninfo_t;
+ typedef versioninfo_t::object versioninfo_object_t;
+ tut::versioninfo_t tut_versioninfo("LLVersionInfo");
+
+ template<> template<>
+ void versioninfo_object_t::test<1>()
+ {
+ std::cout << "What we parsed from CMake: " << LL_VIEWER_VERSION_BUILD << std::endl;
+ std::cout << "What we get from llversioninfo: " << LLVersionInfo::instance().getBuild() << std::endl;
+ ensure_equals("Major version",
+ LLVersionInfo::instance().getMajor(),
+ LL_VIEWER_VERSION_MAJOR);
+ ensure_equals("Minor version",
+ LLVersionInfo::instance().getMinor(),
+ LL_VIEWER_VERSION_MINOR);
+ ensure_equals("Patch version",
+ LLVersionInfo::instance().getPatch(),
+ LL_VIEWER_VERSION_PATCH);
+ ensure_equals("Build version",
+ LLVersionInfo::instance().getBuild(),
+ LL_VIEWER_VERSION_BUILD);
+ ensure_equals("Channel version",
+ LLVersionInfo::instance().getChannel(),
+ ll_viewer_channel);
+ ensure_equals("Version String",
+ LLVersionInfo::instance().getVersion(),
+ mVersion);
+ ensure_equals("Short Version String",
+ LLVersionInfo::instance().getShortVersion(),
+ mShortVersion);
+ ensure_equals("Version and channel String",
+ LLVersionInfo::instance().getChannelAndVersion(),
+ mVersionAndChannel);
- LLVersionInfo::instance().resetChannel(mResetChannel);
- ensure_equals("Reset channel version",
- LLVersionInfo::instance().getChannel(),
- mResetChannel);
+ LLVersionInfo::instance().resetChannel(mResetChannel);
+ ensure_equals("Reset channel version",
+ LLVersionInfo::instance().getChannel(),
+ mResetChannel);
- ensure_equals("Reset Version and channel String",
- LLVersionInfo::instance().getChannelAndVersion(),
- mResetVersionAndChannel);
- }
+ ensure_equals("Reset Version and channel String",
+ LLVersionInfo::instance().getChannelAndVersion(),
+ mResetVersionAndChannel);
+ }
}
diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp
index e2e7f09c3b..278de5f31c 100644
--- a/indra/newview/tests/llviewerassetstats_test.cpp
+++ b/indra/newview/tests/llviewerassetstats_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewerassetstats_tut.cpp
* @date 2010-10-28
* @brief Test cases for some of newview/llviewerassetstats.cpp
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,88 +40,88 @@
namespace LLStatViewer
{
- LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample");
+ LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample");
}
void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts)
{
- counts.resize(3);
- counts[0] = 0;
- counts[1] = 0;
- counts[2] = 1;
+ counts.resize(3);
+ counts[0] = 0;
+ counts[1] = 0;
+ counts[2] = 1;
}
// static
std::string LLVOAvatar::rezStatusToString(S32 rez_status)
{
- if (rez_status==0) return "cloud";
- if (rez_status==1) return "gray";
- if (rez_status==2) return "textured";
- return "unknown";
+ if (rez_status==0) return "cloud";
+ if (rez_status==1) return "gray";
+ if (rez_status==2) return "textured";
+ return "unknown";
}
// static
LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name)
{
- static LLViewerStats::StatsAccumulator junk;
- return junk;
+ static LLViewerStats::StatsAccumulator junk;
+ return junk;
}
-static const char * all_keys[] =
+static const char * all_keys[] =
{
- "duration",
- "fps",
- "get_other_http",
- "get_other_udp",
- "get_texture_temp_http",
- "get_texture_temp_udp",
- "get_texture_non_temp_http",
- "get_texture_non_temp_udp",
- "get_wearable_http",
- "get_wearable_udp",
- "get_sound_http",
- "get_sound_udp",
- "get_gesture_http",
- "get_gesture_udp"
+ "duration",
+ "fps",
+ "get_other_http",
+ "get_other_udp",
+ "get_texture_temp_http",
+ "get_texture_temp_udp",
+ "get_texture_non_temp_http",
+ "get_texture_non_temp_udp",
+ "get_wearable_http",
+ "get_wearable_udp",
+ "get_sound_http",
+ "get_sound_udp",
+ "get_gesture_http",
+ "get_gesture_udp"
};
-static const char * resp_keys[] =
+static const char * resp_keys[] =
{
- "get_other_http",
- "get_other_udp",
- "get_texture_temp_http",
- "get_texture_temp_udp",
- "get_texture_non_temp_http",
- "get_texture_non_temp_udp",
- "get_wearable_http",
- "get_wearable_udp",
- "get_sound_http",
- "get_sound_udp",
- "get_gesture_http",
- "get_gesture_udp"
+ "get_other_http",
+ "get_other_udp",
+ "get_texture_temp_http",
+ "get_texture_temp_udp",
+ "get_texture_non_temp_http",
+ "get_texture_non_temp_udp",
+ "get_wearable_http",
+ "get_wearable_udp",
+ "get_sound_http",
+ "get_sound_udp",
+ "get_gesture_http",
+ "get_gesture_udp"
};
static const char * sub_keys[] =
{
- "dequeued",
- "enqueued",
- "resp_count",
- "resp_max",
- "resp_min",
- "resp_mean"
+ "dequeued",
+ "enqueued",
+ "resp_count",
+ "resp_max",
+ "resp_min",
+ "resp_mean"
};
-static const char * mmm_resp_keys[] =
+static const char * mmm_resp_keys[] =
{
- "fps"
+ "fps"
};
static const char * mmm_sub_keys[] =
{
- "count",
- "max",
- "min",
- "mean"
+ "count",
+ "max",
+ "min",
+ "mean"
};
static const LLUUID region1("4e2d81a3-6263-6ffe-ad5c-8ce04bee07e8");
@@ -135,7 +135,7 @@ static const std::string region2_handle_str("0000030000004200");
static bool
is_empty_map(const LLSD & sd)
{
- return sd.isMap() && 0 == sd.size();
+ return sd.isMap() && 0 == sd.size();
}
#endif
@@ -143,433 +143,433 @@ is_empty_map(const LLSD & sd)
static bool
is_single_key_map(const LLSD & sd, const std::string & key)
{
- return sd.isMap() && 1 == sd.size() && sd.has(key);
+ return sd.isMap() && 1 == sd.size() && sd.has(key);
}
#endif
static bool
is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & key2)
{
- return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2);
+ return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2);
}
#if 0
static bool
is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & key2, const std::string& key3)
{
- return sd.isMap() && 3 == sd.size() && sd.has(key1) && sd.has(key2) && sd.has(key3);
+ return sd.isMap() && 3 == sd.size() && sd.has(key1) && sd.has(key2) && sd.has(key3);
}
#endif
static bool
is_no_stats_map(const LLSD & sd)
{
- return is_double_key_map(sd, "duration", "regions");
+ return is_double_key_map(sd, "duration", "regions");
}
static bool
is_single_slot_array(const LLSD & sd, U64 region_handle)
{
- U32 grid_x(0), grid_y(0);
- grid_from_region_handle(region_handle, &grid_x, &grid_y);
-
- return (sd.isArray() &&
- 1 == sd.size() &&
- sd[0].has("grid_x") &&
- sd[0].has("grid_y") &&
- sd[0]["grid_x"].isInteger() &&
- sd[0]["grid_y"].isInteger() &&
- grid_x == sd[0]["grid_x"].asInteger() &&
- grid_y == sd[0]["grid_y"].asInteger());
+ U32 grid_x(0), grid_y(0);
+ grid_from_region_handle(region_handle, &grid_x, &grid_y);
+
+ return (sd.isArray() &&
+ 1 == sd.size() &&
+ sd[0].has("grid_x") &&
+ sd[0].has("grid_y") &&
+ sd[0]["grid_x"].isInteger() &&
+ sd[0]["grid_y"].isInteger() &&
+ grid_x == sd[0]["grid_x"].asInteger() &&
+ grid_y == sd[0]["grid_y"].asInteger());
}
static bool
is_double_slot_array(const LLSD & sd, U64 region_handle1, U64 region_handle2)
{
- U32 grid_x1(0), grid_y1(0);
- U32 grid_x2(0), grid_y2(0);
- grid_from_region_handle(region_handle1, &grid_x1, &grid_y1);
- grid_from_region_handle(region_handle2, &grid_x2, &grid_y2);
-
- return (sd.isArray() &&
- 2 == sd.size() &&
- sd[0].has("grid_x") &&
- sd[0].has("grid_y") &&
- sd[0]["grid_x"].isInteger() &&
- sd[0]["grid_y"].isInteger() &&
- sd[1].has("grid_x") &&
- sd[1].has("grid_y") &&
- sd[1]["grid_x"].isInteger() &&
- sd[1]["grid_y"].isInteger() &&
- ((grid_x1 == sd[0]["grid_x"].asInteger() &&
- grid_y1 == sd[0]["grid_y"].asInteger() &&
- grid_x2 == sd[1]["grid_x"].asInteger() &&
- grid_y2 == sd[1]["grid_y"].asInteger()) ||
- (grid_x1 == sd[1]["grid_x"].asInteger() &&
- grid_y1 == sd[1]["grid_y"].asInteger() &&
- grid_x2 == sd[0]["grid_x"].asInteger() &&
- grid_y2 == sd[0]["grid_y"].asInteger())));
+ U32 grid_x1(0), grid_y1(0);
+ U32 grid_x2(0), grid_y2(0);
+ grid_from_region_handle(region_handle1, &grid_x1, &grid_y1);
+ grid_from_region_handle(region_handle2, &grid_x2, &grid_y2);
+
+ return (sd.isArray() &&
+ 2 == sd.size() &&
+ sd[0].has("grid_x") &&
+ sd[0].has("grid_y") &&
+ sd[0]["grid_x"].isInteger() &&
+ sd[0]["grid_y"].isInteger() &&
+ sd[1].has("grid_x") &&
+ sd[1].has("grid_y") &&
+ sd[1]["grid_x"].isInteger() &&
+ sd[1]["grid_y"].isInteger() &&
+ ((grid_x1 == sd[0]["grid_x"].asInteger() &&
+ grid_y1 == sd[0]["grid_y"].asInteger() &&
+ grid_x2 == sd[1]["grid_x"].asInteger() &&
+ grid_y2 == sd[1]["grid_y"].asInteger()) ||
+ (grid_x1 == sd[1]["grid_x"].asInteger() &&
+ grid_y1 == sd[1]["grid_y"].asInteger() &&
+ grid_x2 == sd[0]["grid_x"].asInteger() &&
+ grid_y2 == sd[0]["grid_y"].asInteger())));
}
static LLSD
get_region(const LLSD & sd, U64 region_handle1)
{
- U32 grid_x(0), grid_y(0);
- grid_from_region_handle(region_handle1, &grid_x, &grid_y);
-
- for (LLSD::array_const_iterator it(sd["regions"].beginArray());
- sd["regions"].endArray() != it;
- ++it)
- {
- if ((*it).has("grid_x") &&
- (*it).has("grid_y") &&
- (*it)["grid_x"].isInteger() &&
- (*it)["grid_y"].isInteger() &&
- (*it)["grid_x"].asInteger() == grid_x &&
- (*it)["grid_y"].asInteger() == grid_y)
- {
- return *it;
- }
- }
- return LLSD();
+ U32 grid_x(0), grid_y(0);
+ grid_from_region_handle(region_handle1, &grid_x, &grid_y);
+
+ for (LLSD::array_const_iterator it(sd["regions"].beginArray());
+ sd["regions"].endArray() != it;
+ ++it)
+ {
+ if ((*it).has("grid_x") &&
+ (*it).has("grid_y") &&
+ (*it)["grid_x"].isInteger() &&
+ (*it)["grid_y"].isInteger() &&
+ (*it)["grid_x"].asInteger() == grid_x &&
+ (*it)["grid_y"].asInteger() == grid_y)
+ {
+ return *it;
+ }
+ }
+ return LLSD();
}
namespace tut
{
- struct tst_viewerassetstats_index
- {
- tst_viewerassetstats_index()
- {
- LLTrace::set_master_thread_recorder(&mThreadRecorder);
- }
-
- ~tst_viewerassetstats_index()
- {
- LLTrace::set_master_thread_recorder(NULL);
- }
-
- LLTrace::ThreadRecorder mThreadRecorder;
- };
- typedef test_group<tst_viewerassetstats_index> tst_viewerassetstats_index_t;
- typedef tst_viewerassetstats_index_t::object tst_viewerassetstats_index_object_t;
- tut::tst_viewerassetstats_index_t tut_tst_viewerassetstats_index("tst_viewerassetstats_test");
-
- // Testing free functions without global stats allocated
- template<> template<>
- void tst_viewerassetstats_index_object_t::test<1>()
- {
- // Check that helpers aren't bothered by missing global stats
- ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats));
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
-
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
-
- LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_GESTURE, false, false, (U64Microseconds)12300000ULL);
- }
-
- // Create a non-global instance and check the structure
- template<> template<>
- void tst_viewerassetstats_index_object_t::test<2>()
- {
- ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats));
-
- LLViewerAssetStats * it = new LLViewerAssetStats();
-
- ensure("Global gViewerAssetStats should still be NULL", (NULL == gViewerAssetStats));
-
- LLSD sd_full = it->asLLSD(false);
-
- // Default (NULL) region ID doesn't produce LLSD results so should
- // get an empty map back from output
- ensure("Stat-less LLSD initially", is_no_stats_map(sd_full));
-
- // Once the region is set, we will get a response even with no data collection
- it->setRegion(region1_handle);
- sd_full = it->asLLSD(false);
- ensure("Correct single-key LLSD map root", is_double_key_map(sd_full, "duration", "regions"));
- ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd_full["regions"], region1_handle));
-
- LLSD sd = sd_full["regions"][0];
-
- delete it;
-
- // Check the structure of the LLSD
- for (int i = 0; i < LL_ARRAY_SIZE(all_keys); ++i)
- {
- std::string line = llformat("Has '%s' key", all_keys[i]);
- ensure(line, sd.has(all_keys[i]));
- }
-
- for (int i = 0; i < LL_ARRAY_SIZE(resp_keys); ++i)
- {
- for (int j = 0; j < LL_ARRAY_SIZE(sub_keys); ++j)
- {
- std::string line = llformat("Key '%s' has '%s' key", resp_keys[i], sub_keys[j]);
- ensure(line, sd[resp_keys[i]].has(sub_keys[j]));
- }
- }
-
- for (int i = 0; i < LL_ARRAY_SIZE(mmm_resp_keys); ++i)
- {
- for (int j = 0; j < LL_ARRAY_SIZE(mmm_sub_keys); ++j)
- {
- std::string line = llformat("Key '%s' has '%s' key", mmm_resp_keys[i], mmm_sub_keys[j]);
- ensure(line, sd[mmm_resp_keys[i]].has(mmm_sub_keys[j]));
- }
- }
- }
-
- // Create a non-global instance and check some content
- template<> template<>
- void tst_viewerassetstats_index_object_t::test<3>()
- {
- LLViewerAssetStats * it = new LLViewerAssetStats();
- it->setRegion(region1_handle);
-
- LLSD sd = it->asLLSD(false);
- ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
- ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle));
- sd = sd[0];
-
- delete it;
-
- // Check a few points on the tree for content
- ensure("sd[get_texture_temp_http][dequeued] is 0", (0 == sd["get_texture_temp_http"]["dequeued"].asInteger()));
- ensure("sd[get_sound_udp][resp_min] is 0", (0.0 == sd["get_sound_udp"]["resp_min"].asReal()));
- }
-
- // Create a global instance and verify free functions do something useful
- template<> template<>
- void tst_viewerassetstats_index_object_t::test<4>()
- {
- gViewerAssetStats = new LLViewerAssetStats();
- LLViewerAssetStatsFF::set_region(region1_handle);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
-
- LLSD sd = gViewerAssetStats->asLLSD(false);
- ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
- ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle));
- sd = sd["regions"][0];
-
- // Check a few points on the tree for content
- ensure("sd[get_texture_non_temp_udp][enqueued] is 1", (1 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger()));
- ensure("sd[get_texture_temp_udp][enqueued] is 0", (0 == sd["get_texture_temp_udp"]["enqueued"].asInteger()));
- ensure("sd[get_texture_non_temp_http][enqueued] is 0", (0 == sd["get_texture_non_temp_http"]["enqueued"].asInteger()));
- ensure("sd[get_texture_temp_http][enqueued] is 0", (0 == sd["get_texture_temp_http"]["enqueued"].asInteger()));
- ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger()));
-
- // Reset and check zeros...
- // Reset leaves current region in place
- gViewerAssetStats->reset();
- sd = gViewerAssetStats->asLLSD(false)["regions"][region1_handle_str];
-
- delete gViewerAssetStats;
- gViewerAssetStats = NULL;
-
- ensure("sd[get_texture_non_temp_udp][enqueued] is reset", (0 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger()));
- ensure("sd[get_gesture_udp][dequeued] is reset", (0 == sd["get_gesture_udp"]["dequeued"].asInteger()));
- }
+ struct tst_viewerassetstats_index
+ {
+ tst_viewerassetstats_index()
+ {
+ LLTrace::set_master_thread_recorder(&mThreadRecorder);
+ }
+
+ ~tst_viewerassetstats_index()
+ {
+ LLTrace::set_master_thread_recorder(NULL);
+ }
+
+ LLTrace::ThreadRecorder mThreadRecorder;
+ };
+ typedef test_group<tst_viewerassetstats_index> tst_viewerassetstats_index_t;
+ typedef tst_viewerassetstats_index_t::object tst_viewerassetstats_index_object_t;
+ tut::tst_viewerassetstats_index_t tut_tst_viewerassetstats_index("tst_viewerassetstats_test");
+
+ // Testing free functions without global stats allocated
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<1>()
+ {
+ // Check that helpers aren't bothered by missing global stats
+ ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats));
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
+
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
+
+ LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_GESTURE, false, false, (U64Microseconds)12300000ULL);
+ }
+
+ // Create a non-global instance and check the structure
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<2>()
+ {
+ ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats));
+
+ LLViewerAssetStats * it = new LLViewerAssetStats();
+
+ ensure("Global gViewerAssetStats should still be NULL", (NULL == gViewerAssetStats));
+
+ LLSD sd_full = it->asLLSD(false);
+
+ // Default (NULL) region ID doesn't produce LLSD results so should
+ // get an empty map back from output
+ ensure("Stat-less LLSD initially", is_no_stats_map(sd_full));
+
+ // Once the region is set, we will get a response even with no data collection
+ it->setRegion(region1_handle);
+ sd_full = it->asLLSD(false);
+ ensure("Correct single-key LLSD map root", is_double_key_map(sd_full, "duration", "regions"));
+ ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd_full["regions"], region1_handle));
+
+ LLSD sd = sd_full["regions"][0];
+
+ delete it;
+
+ // Check the structure of the LLSD
+ for (int i = 0; i < LL_ARRAY_SIZE(all_keys); ++i)
+ {
+ std::string line = llformat("Has '%s' key", all_keys[i]);
+ ensure(line, sd.has(all_keys[i]));
+ }
+
+ for (int i = 0; i < LL_ARRAY_SIZE(resp_keys); ++i)
+ {
+ for (int j = 0; j < LL_ARRAY_SIZE(sub_keys); ++j)
+ {
+ std::string line = llformat("Key '%s' has '%s' key", resp_keys[i], sub_keys[j]);
+ ensure(line, sd[resp_keys[i]].has(sub_keys[j]));
+ }
+ }
+
+ for (int i = 0; i < LL_ARRAY_SIZE(mmm_resp_keys); ++i)
+ {
+ for (int j = 0; j < LL_ARRAY_SIZE(mmm_sub_keys); ++j)
+ {
+ std::string line = llformat("Key '%s' has '%s' key", mmm_resp_keys[i], mmm_sub_keys[j]);
+ ensure(line, sd[mmm_resp_keys[i]].has(mmm_sub_keys[j]));
+ }
+ }
+ }
+
+ // Create a non-global instance and check some content
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<3>()
+ {
+ LLViewerAssetStats * it = new LLViewerAssetStats();
+ it->setRegion(region1_handle);
+
+ LLSD sd = it->asLLSD(false);
+ ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
+ ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle));
+ sd = sd[0];
+
+ delete it;
+
+ // Check a few points on the tree for content
+ ensure("sd[get_texture_temp_http][dequeued] is 0", (0 == sd["get_texture_temp_http"]["dequeued"].asInteger()));
+ ensure("sd[get_sound_udp][resp_min] is 0", (0.0 == sd["get_sound_udp"]["resp_min"].asReal()));
+ }
+
+ // Create a global instance and verify free functions do something useful
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<4>()
+ {
+ gViewerAssetStats = new LLViewerAssetStats();
+ LLViewerAssetStatsFF::set_region(region1_handle);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
+
+ LLSD sd = gViewerAssetStats->asLLSD(false);
+ ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
+ ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle));
+ sd = sd["regions"][0];
+
+ // Check a few points on the tree for content
+ ensure("sd[get_texture_non_temp_udp][enqueued] is 1", (1 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger()));
+ ensure("sd[get_texture_temp_udp][enqueued] is 0", (0 == sd["get_texture_temp_udp"]["enqueued"].asInteger()));
+ ensure("sd[get_texture_non_temp_http][enqueued] is 0", (0 == sd["get_texture_non_temp_http"]["enqueued"].asInteger()));
+ ensure("sd[get_texture_temp_http][enqueued] is 0", (0 == sd["get_texture_temp_http"]["enqueued"].asInteger()));
+ ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger()));
+
+ // Reset and check zeros...
+ // Reset leaves current region in place
+ gViewerAssetStats->reset();
+ sd = gViewerAssetStats->asLLSD(false)["regions"][region1_handle_str];
+
+ delete gViewerAssetStats;
+ gViewerAssetStats = NULL;
+
+ ensure("sd[get_texture_non_temp_udp][enqueued] is reset", (0 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger()));
+ ensure("sd[get_gesture_udp][dequeued] is reset", (0 == sd["get_gesture_udp"]["dequeued"].asInteger()));
+ }
// Check multiple region collection
- template<> template<>
- void tst_viewerassetstats_index_object_t::test<5>()
- {
- gViewerAssetStats = new LLViewerAssetStats();
-
- LLViewerAssetStatsFF::set_region(region1_handle);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
-
- LLViewerAssetStatsFF::set_region(region2_handle);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
-
- LLSD sd = gViewerAssetStats->asLLSD(false);
-
- // std::cout << sd << std::endl;
-
- ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions"));
- ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle));
- LLSD sd1 = get_region(sd, region1_handle);
- LLSD sd2 = get_region(sd, region2_handle);
- ensure("Region1 is present in results", sd1.isMap());
- ensure("Region2 is present in results", sd2.isMap());
-
- // Check a few points on the tree for content
- ensure_equals("sd1[get_texture_non_temp_udp][enqueued] is 1", sd1["get_texture_non_temp_udp"]["enqueued"].asInteger(), 1);
- ensure_equals("sd1[get_texture_temp_udp][enqueued] is 0", sd1["get_texture_temp_udp"]["enqueued"].asInteger(), 0);
- ensure_equals("sd1[get_texture_non_temp_http][enqueued] is 0", sd1["get_texture_non_temp_http"]["enqueued"].asInteger(), 0);
- ensure_equals("sd1[get_texture_temp_http][enqueued] is 0", sd1["get_texture_temp_http"]["enqueued"].asInteger(), 0);
- ensure_equals("sd1[get_gesture_udp][dequeued] is 0", sd1["get_gesture_udp"]["dequeued"].asInteger(), 0);
-
- // Check a few points on the tree for content
- ensure("sd2[get_gesture_udp][enqueued] is 4", (4 == sd2["get_gesture_udp"]["enqueued"].asInteger()));
- ensure("sd2[get_gesture_udp][dequeued] is 0", (0 == sd2["get_gesture_udp"]["dequeued"].asInteger()));
- ensure("sd2[get_texture_non_temp_udp][enqueued] is 0", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger()));
-
- // Reset and check zeros...
- // Reset leaves current region in place
- gViewerAssetStats->reset();
- sd = gViewerAssetStats->asLLSD(false);
- ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
- ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle));
- sd2 = sd["regions"][0];
-
- delete gViewerAssetStats;
- gViewerAssetStats = NULL;
-
- ensure("sd2[get_texture_non_temp_udp][enqueued] is reset", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger()));
- ensure("sd2[get_gesture_udp][enqueued] is reset", (0 == sd2["get_gesture_udp"]["enqueued"].asInteger()));
- }
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<5>()
+ {
+ gViewerAssetStats = new LLViewerAssetStats();
+
+ LLViewerAssetStatsFF::set_region(region1_handle);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
+
+ LLViewerAssetStatsFF::set_region(region2_handle);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+
+ LLSD sd = gViewerAssetStats->asLLSD(false);
+
+ // std::cout << sd << std::endl;
+
+ ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions"));
+ ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle));
+ LLSD sd1 = get_region(sd, region1_handle);
+ LLSD sd2 = get_region(sd, region2_handle);
+ ensure("Region1 is present in results", sd1.isMap());
+ ensure("Region2 is present in results", sd2.isMap());
+
+ // Check a few points on the tree for content
+ ensure_equals("sd1[get_texture_non_temp_udp][enqueued] is 1", sd1["get_texture_non_temp_udp"]["enqueued"].asInteger(), 1);
+ ensure_equals("sd1[get_texture_temp_udp][enqueued] is 0", sd1["get_texture_temp_udp"]["enqueued"].asInteger(), 0);
+ ensure_equals("sd1[get_texture_non_temp_http][enqueued] is 0", sd1["get_texture_non_temp_http"]["enqueued"].asInteger(), 0);
+ ensure_equals("sd1[get_texture_temp_http][enqueued] is 0", sd1["get_texture_temp_http"]["enqueued"].asInteger(), 0);
+ ensure_equals("sd1[get_gesture_udp][dequeued] is 0", sd1["get_gesture_udp"]["dequeued"].asInteger(), 0);
+
+ // Check a few points on the tree for content
+ ensure("sd2[get_gesture_udp][enqueued] is 4", (4 == sd2["get_gesture_udp"]["enqueued"].asInteger()));
+ ensure("sd2[get_gesture_udp][dequeued] is 0", (0 == sd2["get_gesture_udp"]["dequeued"].asInteger()));
+ ensure("sd2[get_texture_non_temp_udp][enqueued] is 0", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger()));
+
+ // Reset and check zeros...
+ // Reset leaves current region in place
+ gViewerAssetStats->reset();
+ sd = gViewerAssetStats->asLLSD(false);
+ ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
+ ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle));
+ sd2 = sd["regions"][0];
+
+ delete gViewerAssetStats;
+ gViewerAssetStats = NULL;
+
+ ensure("sd2[get_texture_non_temp_udp][enqueued] is reset", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger()));
+ ensure("sd2[get_gesture_udp][enqueued] is reset", (0 == sd2["get_gesture_udp"]["enqueued"].asInteger()));
+ }
// Check multiple region collection jumping back-and-forth between regions
- template<> template<>
- void tst_viewerassetstats_index_object_t::test<6>()
- {
- gViewerAssetStats = new LLViewerAssetStats();
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<6>()
+ {
+ gViewerAssetStats = new LLViewerAssetStats();
+
+ LLViewerAssetStatsFF::set_region(region1_handle);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
+
+ LLViewerAssetStatsFF::set_region(region2_handle);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+
+ LLViewerAssetStatsFF::set_region(region1_handle);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, true, true);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, true, true);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
+
+ LLViewerAssetStatsFF::set_region(region2_handle);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
+
+ LLSD sd = gViewerAssetStats->asLLSD(false);
+
+ ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions"));
+ ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle));
+ LLSD sd1 = get_region(sd, region1_handle);
+ LLSD sd2 = get_region(sd, region2_handle);
+ ensure("Region1 is present in results", sd1.isMap());
+ ensure("Region2 is present in results", sd2.isMap());
+
+ // Check a few points on the tree for content
+ ensure("sd1[get_texture_non_temp_udp][enqueued] is 1", (1 == sd1["get_texture_non_temp_udp"]["enqueued"].asInteger()));
+ ensure("sd1[get_texture_temp_udp][enqueued] is 0", (0 == sd1["get_texture_temp_udp"]["enqueued"].asInteger()));
+ ensure("sd1[get_texture_non_temp_http][enqueued] is 0", (0 == sd1["get_texture_non_temp_http"]["enqueued"].asInteger()));
+ ensure("sd1[get_texture_temp_http][enqueued] is 1", (1 == sd1["get_texture_temp_http"]["enqueued"].asInteger()));
+ ensure("sd1[get_gesture_udp][dequeued] is 0", (0 == sd1["get_gesture_udp"]["dequeued"].asInteger()));
+
+ // Check a few points on the tree for content
+ ensure("sd2[get_gesture_udp][enqueued] is 8", (8 == sd2["get_gesture_udp"]["enqueued"].asInteger()));
+ ensure("sd2[get_gesture_udp][dequeued] is 0", (0 == sd2["get_gesture_udp"]["dequeued"].asInteger()));
+ ensure("sd2[get_texture_non_temp_udp][enqueued] is 0", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger()));
+
+ // Reset and check zeros...
+ // Reset leaves current region in place
+ gViewerAssetStats->reset();
+ sd = gViewerAssetStats->asLLSD(false);
+ ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions"));
+ ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle));
+ sd2 = get_region(sd, region2_handle);
+ ensure("Region2 is present in results", sd2.isMap());
+
+ delete gViewerAssetStats;
+ gViewerAssetStats = NULL;
+
+ ensure_equals("sd2[get_texture_non_temp_udp][enqueued] is reset", sd2["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0);
+ ensure_equals("sd2[get_gesture_udp][enqueued] is reset", sd2["get_gesture_udp"]["enqueued"].asInteger(), 0);
+ }
+
+ // Non-texture assets ignore transport and persistence flags
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<7>()
+ {
+ gViewerAssetStats = new LLViewerAssetStats();
+ LLViewerAssetStatsFF::set_region(region1_handle);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, true);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, true);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, false);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, false);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, true);
+ LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, true);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, false);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, true);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, false);
+
+ LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, true);
+
+ LLSD sd = gViewerAssetStats->asLLSD(false);
+ ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
+ ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle));
+ sd = get_region(sd, region1_handle);
+ ensure("Region1 is present in results", sd.isMap());
+
+ // Check a few points on the tree for content
+ ensure("sd[get_gesture_udp][enqueued] is 0", (0 == sd["get_gesture_udp"]["enqueued"].asInteger()));
+ ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger()));
+
+ ensure("sd[get_wearable_http][enqueued] is 2", (2 == sd["get_wearable_http"]["enqueued"].asInteger()));
+ ensure("sd[get_wearable_http][dequeued] is 2", (2 == sd["get_wearable_http"]["dequeued"].asInteger()));
+
+ ensure("sd[get_wearable_udp][enqueued] is 2", (2 == sd["get_wearable_udp"]["enqueued"].asInteger()));
+ ensure("sd[get_wearable_udp][dequeued] is 2", (2 == sd["get_wearable_udp"]["dequeued"].asInteger()));
- LLViewerAssetStatsFF::set_region(region1_handle);
+ ensure("sd[get_other_http][enqueued] is 2", (2 == sd["get_other_http"]["enqueued"].asInteger()));
+ ensure("sd[get_other_http][dequeued] is 0", (0 == sd["get_other_http"]["dequeued"].asInteger()));
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
-
- LLViewerAssetStatsFF::set_region(region2_handle);
+ ensure("sd[get_other_udp][enqueued] is 2", (2 == sd["get_other_udp"]["enqueued"].asInteger()));
+ ensure("sd[get_other_udp][dequeued] is 0", (0 == sd["get_other_udp"]["dequeued"].asInteger()));
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
-
- LLViewerAssetStatsFF::set_region(region1_handle);
+ // Reset and check zeros...
+ // Reset leaves current region in place
+ gViewerAssetStats->reset();
+ sd = get_region(gViewerAssetStats->asLLSD(false), region1_handle);
+ ensure("Region1 is present in results", sd.isMap());
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, true, true);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, true, true);
+ delete gViewerAssetStats;
+ gViewerAssetStats = NULL;
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
-
- LLViewerAssetStatsFF::set_region(region2_handle);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false);
-
- LLSD sd = gViewerAssetStats->asLLSD(false);
-
- ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions"));
- ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle));
- LLSD sd1 = get_region(sd, region1_handle);
- LLSD sd2 = get_region(sd, region2_handle);
- ensure("Region1 is present in results", sd1.isMap());
- ensure("Region2 is present in results", sd2.isMap());
-
- // Check a few points on the tree for content
- ensure("sd1[get_texture_non_temp_udp][enqueued] is 1", (1 == sd1["get_texture_non_temp_udp"]["enqueued"].asInteger()));
- ensure("sd1[get_texture_temp_udp][enqueued] is 0", (0 == sd1["get_texture_temp_udp"]["enqueued"].asInteger()));
- ensure("sd1[get_texture_non_temp_http][enqueued] is 0", (0 == sd1["get_texture_non_temp_http"]["enqueued"].asInteger()));
- ensure("sd1[get_texture_temp_http][enqueued] is 1", (1 == sd1["get_texture_temp_http"]["enqueued"].asInteger()));
- ensure("sd1[get_gesture_udp][dequeued] is 0", (0 == sd1["get_gesture_udp"]["dequeued"].asInteger()));
-
- // Check a few points on the tree for content
- ensure("sd2[get_gesture_udp][enqueued] is 8", (8 == sd2["get_gesture_udp"]["enqueued"].asInteger()));
- ensure("sd2[get_gesture_udp][dequeued] is 0", (0 == sd2["get_gesture_udp"]["dequeued"].asInteger()));
- ensure("sd2[get_texture_non_temp_udp][enqueued] is 0", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger()));
-
- // Reset and check zeros...
- // Reset leaves current region in place
- gViewerAssetStats->reset();
- sd = gViewerAssetStats->asLLSD(false);
- ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions"));
- ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle));
- sd2 = get_region(sd, region2_handle);
- ensure("Region2 is present in results", sd2.isMap());
-
- delete gViewerAssetStats;
- gViewerAssetStats = NULL;
-
- ensure_equals("sd2[get_texture_non_temp_udp][enqueued] is reset", sd2["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0);
- ensure_equals("sd2[get_gesture_udp][enqueued] is reset", sd2["get_gesture_udp"]["enqueued"].asInteger(), 0);
- }
-
- // Non-texture assets ignore transport and persistence flags
- template<> template<>
- void tst_viewerassetstats_index_object_t::test<7>()
- {
- gViewerAssetStats = new LLViewerAssetStats();
- LLViewerAssetStatsFF::set_region(region1_handle);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, true);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, true);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, false);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, false);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, true);
- LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, true);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, false);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, true);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, false);
-
- LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, true);
-
- LLSD sd = gViewerAssetStats->asLLSD(false);
- ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
- ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle));
- sd = get_region(sd, region1_handle);
- ensure("Region1 is present in results", sd.isMap());
-
- // Check a few points on the tree for content
- ensure("sd[get_gesture_udp][enqueued] is 0", (0 == sd["get_gesture_udp"]["enqueued"].asInteger()));
- ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger()));
-
- ensure("sd[get_wearable_http][enqueued] is 2", (2 == sd["get_wearable_http"]["enqueued"].asInteger()));
- ensure("sd[get_wearable_http][dequeued] is 2", (2 == sd["get_wearable_http"]["dequeued"].asInteger()));
-
- ensure("sd[get_wearable_udp][enqueued] is 2", (2 == sd["get_wearable_udp"]["enqueued"].asInteger()));
- ensure("sd[get_wearable_udp][dequeued] is 2", (2 == sd["get_wearable_udp"]["dequeued"].asInteger()));
-
- ensure("sd[get_other_http][enqueued] is 2", (2 == sd["get_other_http"]["enqueued"].asInteger()));
- ensure("sd[get_other_http][dequeued] is 0", (0 == sd["get_other_http"]["dequeued"].asInteger()));
-
- ensure("sd[get_other_udp][enqueued] is 2", (2 == sd["get_other_udp"]["enqueued"].asInteger()));
- ensure("sd[get_other_udp][dequeued] is 0", (0 == sd["get_other_udp"]["dequeued"].asInteger()));
-
- // Reset and check zeros...
- // Reset leaves current region in place
- gViewerAssetStats->reset();
- sd = get_region(gViewerAssetStats->asLLSD(false), region1_handle);
- ensure("Region1 is present in results", sd.isMap());
-
- delete gViewerAssetStats;
- gViewerAssetStats = NULL;
-
- ensure_equals("sd[get_texture_non_temp_udp][enqueued] is reset", sd["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0);
- ensure_equals("sd[get_gesture_udp][dequeued] is reset", sd["get_gesture_udp"]["dequeued"].asInteger(), 0);
- }
+ ensure_equals("sd[get_texture_non_temp_udp][enqueued] is reset", sd["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0);
+ ensure_equals("sd[get_gesture_udp][dequeued] is reset", sd["get_gesture_udp"]["dequeued"].asInteger(), 0);
+ }
}
diff --git a/indra/newview/tests/llviewercontrollistener_test.cpp b/indra/newview/tests/llviewercontrollistener_test.cpp
index 8aed2a8043..a5eeae8e5b 100644
--- a/indra/newview/tests/llviewercontrollistener_test.cpp
+++ b/indra/newview/tests/llviewercontrollistener_test.cpp
@@ -3,7 +3,7 @@
* @author Nat Goodspeed
* @date 2022-06-09
* @brief Test for llviewercontrollistener.
- *
+ *
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Copyright (c) 2022, Linden Research, Inc.
* $/LicenseInfo$
diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp
index f6456a2839..7890e9330c 100644
--- a/indra/newview/tests/llviewerhelputil_test.cpp
+++ b/indra/newview/tests/llviewerhelputil_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewerhelputil_test.cpp
* @brief LLViewerHelpUtil tests
* @author Tofu Linden
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,29 +47,29 @@ static std::string gOS;
// Mock objects for the dependencies of the code we're testing
LLControlGroup::LLControlGroup(const std::string& name)
- : LLInstanceTracker<LLControlGroup, std::string>(name) {}
+ : LLInstanceTracker<LLControlGroup, std::string>(name) {}
LLControlGroup::~LLControlGroup() {}
LLControlVariable* LLControlGroup::declareString(const std::string& name,
- const std::string& initial_val,
- const std::string& comment,
- LLControlVariable::ePersist persist) {return NULL;}
+ const std::string& initial_val,
+ const std::string& comment,
+ LLControlVariable::ePersist persist) {return NULL;}
void LLControlGroup::setString(const std::string& name, const std::string& val){}
std::string LLControlGroup::getString(const std::string& name)
{
- if (name == "HelpURLFormat")
- return gHelpURL;
- return "";
+ if (name == "HelpURLFormat")
+ return gHelpURL;
+ return "";
}
LLControlGroup gSavedSettings("test");
static void substitute_string(std::string &input, const std::string &search, const std::string &replace)
{
- size_t pos = input.find(search);
- while (pos != std::string::npos)
- {
- input = input.replace(pos, search.size(), replace);
- pos = input.find(search);
- }
+ size_t pos = input.find(search);
+ while (pos != std::string::npos)
+ {
+ input = input.replace(pos, search.size(), replace);
+ pos = input.find(search);
+ }
}
#include "../llagent.h"
@@ -80,81 +80,81 @@ bool LLAgent::isGodlike() const { return FALSE; }
LLAgent gAgent;
std::string LLWeb::expandURLSubstitutions(const std::string &url,
- const LLSD &default_subs)
+ const LLSD &default_subs)
{
- (void)gAgent.isGodlike(); // ref symbol to stop compiler from stripping it
- std::string new_url = url;
- substitute_string(new_url, "[TOPIC]", default_subs["TOPIC"].asString());
- substitute_string(new_url, "[VERSION]", gVersion);
- substitute_string(new_url, "[CHANNEL]", gChannel);
- substitute_string(new_url, "[LANGUAGE]", gLanguage);
- substitute_string(new_url, "[GRID]", gGrid);
- substitute_string(new_url, "[OS]", gOS);
- return new_url;
+ (void)gAgent.isGodlike(); // ref symbol to stop compiler from stripping it
+ std::string new_url = url;
+ substitute_string(new_url, "[TOPIC]", default_subs["TOPIC"].asString());
+ substitute_string(new_url, "[VERSION]", gVersion);
+ substitute_string(new_url, "[CHANNEL]", gChannel);
+ substitute_string(new_url, "[LANGUAGE]", gLanguage);
+ substitute_string(new_url, "[GRID]", gGrid);
+ substitute_string(new_url, "[OS]", gOS);
+ return new_url;
}
//----------------------------------------------------------------------------
-
+
namespace tut
{
struct viewerhelputil
{
};
-
- typedef test_group<viewerhelputil> viewerhelputil_t;
- typedef viewerhelputil_t::object viewerhelputil_object_t;
- tut::viewerhelputil_t tut_viewerhelputil("LLViewerHelpUtil");
-
- template<> template<>
- void viewerhelputil_object_t::test<1>()
- {
- std::string topic("test_topic");
- std::string subresult;
-
- gHelpURL = "fooformat";
- subresult = LLViewerHelpUtil::buildHelpURL(topic);
- ensure_equals("no substitution tags", subresult, "fooformat");
-
- gHelpURL = "";
- subresult = LLViewerHelpUtil::buildHelpURL(topic);
- ensure_equals("blank substitution format", subresult, "");
-
- gHelpURL = "[TOPIC]";
- subresult = LLViewerHelpUtil::buildHelpURL(topic);
- ensure_equals("topic name", subresult, "test_topic");
-
- gHelpURL = "[LANGUAGE]";
- gLanguage = "";
- subresult = LLViewerHelpUtil::buildHelpURL(topic);
- ensure_equals("simple substitution with blank", subresult, "");
-
- gHelpURL = "[LANGUAGE]";
- gLanguage = "Esperanto";
- subresult = LLViewerHelpUtil::buildHelpURL(topic);
- ensure_equals("simple substitution", subresult, "Esperanto");
-
- gHelpURL = "http://secondlife.com/[LANGUAGE]";
- gLanguage = "Gaelic";
- subresult = LLViewerHelpUtil::buildHelpURL(topic);
- ensure_equals("simple substitution with url", subresult, "http://secondlife.com/Gaelic");
-
- gHelpURL = "[XXX]";
- subresult = LLViewerHelpUtil::buildHelpURL(topic);
- ensure_equals("unknown substitution", subresult, "[XXX]");
-
- gHelpURL = "[LANGUAGE]/[LANGUAGE]";
- gLanguage = "Esperanto";
- subresult = LLViewerHelpUtil::buildHelpURL(topic);
- ensure_equals("multiple substitution", subresult, "Esperanto/Esperanto");
-
- gHelpURL = "http://[CHANNEL]/[VERSION]/[LANGUAGE]/[OS]/[GRID]/[XXX]";
- gChannel = "Second Life Test";
- gVersion = "2.0";
- gLanguage = "gaelic";
- gOS = "AmigaOS 2.1";
- gGrid = "mysim";
- subresult = LLViewerHelpUtil::buildHelpURL(topic);
- ensure_equals("complex substitution", subresult, "http://Second Life Test/2.0/gaelic/AmigaOS 2.1/mysim/[XXX]");
- }
+
+ typedef test_group<viewerhelputil> viewerhelputil_t;
+ typedef viewerhelputil_t::object viewerhelputil_object_t;
+ tut::viewerhelputil_t tut_viewerhelputil("LLViewerHelpUtil");
+
+ template<> template<>
+ void viewerhelputil_object_t::test<1>()
+ {
+ std::string topic("test_topic");
+ std::string subresult;
+
+ gHelpURL = "fooformat";
+ subresult = LLViewerHelpUtil::buildHelpURL(topic);
+ ensure_equals("no substitution tags", subresult, "fooformat");
+
+ gHelpURL = "";
+ subresult = LLViewerHelpUtil::buildHelpURL(topic);
+ ensure_equals("blank substitution format", subresult, "");
+
+ gHelpURL = "[TOPIC]";
+ subresult = LLViewerHelpUtil::buildHelpURL(topic);
+ ensure_equals("topic name", subresult, "test_topic");
+
+ gHelpURL = "[LANGUAGE]";
+ gLanguage = "";
+ subresult = LLViewerHelpUtil::buildHelpURL(topic);
+ ensure_equals("simple substitution with blank", subresult, "");
+
+ gHelpURL = "[LANGUAGE]";
+ gLanguage = "Esperanto";
+ subresult = LLViewerHelpUtil::buildHelpURL(topic);
+ ensure_equals("simple substitution", subresult, "Esperanto");
+
+ gHelpURL = "http://secondlife.com/[LANGUAGE]";
+ gLanguage = "Gaelic";
+ subresult = LLViewerHelpUtil::buildHelpURL(topic);
+ ensure_equals("simple substitution with url", subresult, "http://secondlife.com/Gaelic");
+
+ gHelpURL = "[XXX]";
+ subresult = LLViewerHelpUtil::buildHelpURL(topic);
+ ensure_equals("unknown substitution", subresult, "[XXX]");
+
+ gHelpURL = "[LANGUAGE]/[LANGUAGE]";
+ gLanguage = "Esperanto";
+ subresult = LLViewerHelpUtil::buildHelpURL(topic);
+ ensure_equals("multiple substitution", subresult, "Esperanto/Esperanto");
+
+ gHelpURL = "http://[CHANNEL]/[VERSION]/[LANGUAGE]/[OS]/[GRID]/[XXX]";
+ gChannel = "Second Life Test";
+ gVersion = "2.0";
+ gLanguage = "gaelic";
+ gOS = "AmigaOS 2.1";
+ gGrid = "mysim";
+ subresult = LLViewerHelpUtil::buildHelpURL(topic);
+ ensure_equals("complex substitution", subresult, "http://Second Life Test/2.0/gaelic/AmigaOS 2.1/mysim/[XXX]");
+ }
}
diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
index fe81fd63ea..cd5e20f6dd 100644
--- a/indra/newview/tests/llviewernetwork_test.cpp
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -45,22 +45,22 @@ static const char * const TEST_FILENAME("llviewernetwork_test.xml");
class LLTrans
{
public:
- static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
+ static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
};
std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
{
- std::string grid_label = std::string();
- if(xml_desc == "AgniGridLabel")
- {
- grid_label = "Second Life Main Grid (Agni)";
- }
- else if(xml_desc == "AditiGridLabel")
- {
- grid_label = "Second Life Beta Test Grid (Aditi)";
- }
-
- return grid_label;
+ std::string grid_label = std::string();
+ if(xml_desc == "AgniGridLabel")
+ {
+ grid_label = "Second Life Main Grid (Agni)";
+ }
+ else if(xml_desc == "AditiGridLabel")
+ {
+ grid_label = "Second Life Beta Test Grid (Aditi)";
+ }
+
+ return grid_label;
}
//----------------------------------------------------------------------------
@@ -82,89 +82,89 @@ std::string gLoginPage;
std::string gCurrentGrid;
std::string LLControlGroup::getString(const std::string& name)
{
- if (name == "CmdLineGridChoice")
- return gCmdLineGridChoice;
- else if (name == "CmdLineHelperURI")
- return gCmdLineHelperURI;
- else if (name == "LoginPage")
- return gLoginPage;
- else if (name == "CurrentGrid")
- return gCurrentGrid;
- return "";
+ if (name == "CmdLineGridChoice")
+ return gCmdLineGridChoice;
+ else if (name == "CmdLineHelperURI")
+ return gCmdLineHelperURI;
+ else if (name == "LoginPage")
+ return gLoginPage;
+ else if (name == "CurrentGrid")
+ return gCurrentGrid;
+ return "";
}
LLSD LLControlGroup::getLLSD(const std::string& name)
{
- if (name == "CmdLineLoginURI")
- {
- if(!gCmdLineLoginURI.empty())
- {
- return LLSD(gCmdLineLoginURI);
- }
- }
- return LLSD();
+ if (name == "CmdLineLoginURI")
+ {
+ if(!gCmdLineLoginURI.empty())
+ {
+ return LLSD(gCmdLineLoginURI);
+ }
+ }
+ return LLSD();
}
LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name)
{
- ctrl_name_table_t::iterator iter = mNameTable.find(name);
- return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second;
+ ctrl_name_table_t::iterator iter = mNameTable.find(name);
+ return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second;
}
LLControlGroup gSavedSettings("test");
const char *gSampleGridFile =
- "<?xml version=\"1.0\"?>"
- "<llsd>"
- " <map>"
- " <key>altgrid.long.name</key>"
- " <map>"
- " <key>helper_uri</key><string>https://helper1/helpers/</string>"
- " <key>label</key><string>Alternative Grid</string>"
- " <key>login_page</key><string>altgrid/loginpage</string>"
- " <key>login_uri</key>"
- " <array>"
- " <string>altgrid/myloginuri1</string>"
- " <string>altgrid/myloginuri2</string>"
- " </array>"
- " <key>keyname</key><string>altgrid.long.name</string>"
- " <key>credential_type</key><string>agent</string>"
- " <key>grid_login_id</key><string>AltGrid</string>"
- " </map>"
- " <key>minimal.long.name</key>"
- " <map>"
- " <key>keyname</key><string>minimal.long.name</string>"
- " </map>"
- " <!-- Note that the values for agni and aditi below are deliberately"
- " incorrect to test that they are not overwritten -->"
- " <key>util.agni.lindenlab.com</key> <!-- conflict -->"
- " <map>"
- " <key>helper_uri</key><string>https://helper1/helpers/</string>"
- " <key>grid_login_id</key><string>mylabel</string>"
- " <key>label</key><string>mylabel</string>"
- " <key>login_page</key><string>loginpage</string>"
- " <key>login_uri</key>"
- " <array>"
- " <string>myloginuri</string>"
- " </array>"
- " <key>keyname</key><string>util.agni.lindenlab.com</string> <!-- conflict -->"
- " </map>"
- " <key>util.foobar.lindenlab.com</key>"
- " <map>"
- " <key>helper_uri</key><string>https://helper1/helpers/</string>"
- " <key>grid_login_id</key><string>Aditi</string> <!-- conflict -->"
- " <key>label</key><string>mylabel</string>"
- " <key>login_page</key><string>loginpage</string>"
- " <key>login_uri</key>"
- " <array>"
- " <string>myloginuri</string>"
- " </array>"
- " <key>update_query_url_base</key><string>https://update.secondlife.com/update</string>"
- " <key>keyname</key><string>util.foobar.lindenlab.com</string>"
- " </map>"
- " </map>"
- "</llsd>"
- ;
+ "<?xml version=\"1.0\"?>"
+ "<llsd>"
+ " <map>"
+ " <key>altgrid.long.name</key>"
+ " <map>"
+ " <key>helper_uri</key><string>https://helper1/helpers/</string>"
+ " <key>label</key><string>Alternative Grid</string>"
+ " <key>login_page</key><string>altgrid/loginpage</string>"
+ " <key>login_uri</key>"
+ " <array>"
+ " <string>altgrid/myloginuri1</string>"
+ " <string>altgrid/myloginuri2</string>"
+ " </array>"
+ " <key>keyname</key><string>altgrid.long.name</string>"
+ " <key>credential_type</key><string>agent</string>"
+ " <key>grid_login_id</key><string>AltGrid</string>"
+ " </map>"
+ " <key>minimal.long.name</key>"
+ " <map>"
+ " <key>keyname</key><string>minimal.long.name</string>"
+ " </map>"
+ " <!-- Note that the values for agni and aditi below are deliberately"
+ " incorrect to test that they are not overwritten -->"
+ " <key>util.agni.lindenlab.com</key> <!-- conflict -->"
+ " <map>"
+ " <key>helper_uri</key><string>https://helper1/helpers/</string>"
+ " <key>grid_login_id</key><string>mylabel</string>"
+ " <key>label</key><string>mylabel</string>"
+ " <key>login_page</key><string>loginpage</string>"
+ " <key>login_uri</key>"
+ " <array>"
+ " <string>myloginuri</string>"
+ " </array>"
+ " <key>keyname</key><string>util.agni.lindenlab.com</string> <!-- conflict -->"
+ " </map>"
+ " <key>util.foobar.lindenlab.com</key>"
+ " <map>"
+ " <key>helper_uri</key><string>https://helper1/helpers/</string>"
+ " <key>grid_login_id</key><string>Aditi</string> <!-- conflict -->"
+ " <key>label</key><string>mylabel</string>"
+ " <key>login_page</key><string>loginpage</string>"
+ " <key>login_uri</key>"
+ " <array>"
+ " <string>myloginuri</string>"
+ " </array>"
+ " <key>update_query_url_base</key><string>https://update.secondlife.com/update</string>"
+ " <key>keyname</key><string>util.foobar.lindenlab.com</string>"
+ " </map>"
+ " </map>"
+ "</llsd>"
+ ;
// -------------------------------------------------------------------------------------------
// TUT
// -------------------------------------------------------------------------------------------
@@ -172,279 +172,279 @@ namespace tut
{
// Test wrapper declaration : wrapping nothing for the moment
struct viewerNetworkTest
- {
- viewerNetworkTest()
- {
- LLFile::remove(TEST_FILENAME);
- gCmdLineLoginURI.clear();
- gCmdLineGridChoice.clear();
- gCmdLineHelperURI.clear();
- gLoginPage.clear();
- gCurrentGrid.clear();
- }
- ~viewerNetworkTest()
- {
- LLFile::remove(TEST_FILENAME);
- }
- };
-
- // Tut templating thingamagic: test group, object and test instance
- typedef test_group<viewerNetworkTest> viewerNetworkTestFactory;
- typedef viewerNetworkTestFactory::object viewerNetworkTestObject;
- tut::viewerNetworkTestFactory tut_test("LLViewerNetwork");
-
- // ---------------------------------------------------------------------------------------
- // Test functions
- // ---------------------------------------------------------------------------------------
- // initialization without a grid file
- template<> template<>
- void viewerNetworkTestObject::test<1>()
- {
- LLGridManager *manager = LLGridManager::getInstance();
- // grid file doesn't exist
- manager->initialize(TEST_FILENAME);
- // validate that some of the defaults are available.
- std::map<std::string, std::string> known_grids = manager->getKnownGrids();
- ensure_equals("Known grids is a string-string map of size 2", known_grids.size(), 2);
- ensure_equals("Agni has the right name and label",
- known_grids[std::string("util.agni.lindenlab.com")],
- std::string("Second Life Main Grid (Agni)"));
- ensure_equals("Aditi has the right name and label",
- known_grids[std::string("util.aditi.lindenlab.com")],
- std::string("Second Life Beta Test Grid (Aditi)"));
- ensure_equals("name for agni",
- LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"),
- std::string("util.agni.lindenlab.com"));
- ensure_equals("id for agni",
- std::string("Agni"),
- LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"));
- ensure_equals("update url base for Agni", // relies on agni being the default
- std::string("https://update.secondlife.com/update"),
- LLGridManager::getInstance()->getUpdateServiceURL());
- ensure_equals("label for agni",
- LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"),
- std::string("Second Life Main Grid (Agni)"));
-
- std::vector<std::string> login_uris;
- LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris);
- ensure_equals("Number of login uris for agni", 1, login_uris.size());
- ensure_equals("Agni login uri",
- login_uris[0],
- std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
- ensure_equals("Agni helper uri",
- LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"),
- std::string("https://secondlife.com/helpers/"));
- ensure_equals("Agni login page",
- LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"),
- std::string("https://viewer-splash.secondlife.com/"));
- ensure("Agni is a system grid",
- LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com"));
-
- ensure_equals("name for aditi",
- LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"),
- std::string("util.aditi.lindenlab.com"));
- ensure_equals("id for aditi",
- LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"),
- std::string("Aditi"));
- ensure_equals("label for aditi",
- LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"),
- std::string("Second Life Beta Test Grid (Aditi)"));
-
- LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris);
-
- ensure_equals("Number of login uris for aditi", 1, login_uris.size());
- ensure_equals("Aditi login uri",
- login_uris[0],
- std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
- ensure_equals("Aditi helper uri",
- LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"),
+ {
+ viewerNetworkTest()
+ {
+ LLFile::remove(TEST_FILENAME);
+ gCmdLineLoginURI.clear();
+ gCmdLineGridChoice.clear();
+ gCmdLineHelperURI.clear();
+ gLoginPage.clear();
+ gCurrentGrid.clear();
+ }
+ ~viewerNetworkTest()
+ {
+ LLFile::remove(TEST_FILENAME);
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<viewerNetworkTest> viewerNetworkTestFactory;
+ typedef viewerNetworkTestFactory::object viewerNetworkTestObject;
+ tut::viewerNetworkTestFactory tut_test("LLViewerNetwork");
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // ---------------------------------------------------------------------------------------
+ // initialization without a grid file
+ template<> template<>
+ void viewerNetworkTestObject::test<1>()
+ {
+ LLGridManager *manager = LLGridManager::getInstance();
+ // grid file doesn't exist
+ manager->initialize(TEST_FILENAME);
+ // validate that some of the defaults are available.
+ std::map<std::string, std::string> known_grids = manager->getKnownGrids();
+ ensure_equals("Known grids is a string-string map of size 2", known_grids.size(), 2);
+ ensure_equals("Agni has the right name and label",
+ known_grids[std::string("util.agni.lindenlab.com")],
+ std::string("Second Life Main Grid (Agni)"));
+ ensure_equals("Aditi has the right name and label",
+ known_grids[std::string("util.aditi.lindenlab.com")],
+ std::string("Second Life Beta Test Grid (Aditi)"));
+ ensure_equals("name for agni",
+ LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"),
+ std::string("util.agni.lindenlab.com"));
+ ensure_equals("id for agni",
+ std::string("Agni"),
+ LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"));
+ ensure_equals("update url base for Agni", // relies on agni being the default
+ std::string("https://update.secondlife.com/update"),
+ LLGridManager::getInstance()->getUpdateServiceURL());
+ ensure_equals("label for agni",
+ LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"),
+ std::string("Second Life Main Grid (Agni)"));
+
+ std::vector<std::string> login_uris;
+ LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris);
+ ensure_equals("Number of login uris for agni", 1, login_uris.size());
+ ensure_equals("Agni login uri",
+ login_uris[0],
+ std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
+ ensure_equals("Agni helper uri",
+ LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"),
+ std::string("https://secondlife.com/helpers/"));
+ ensure_equals("Agni login page",
+ LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"),
+ std::string("https://viewer-splash.secondlife.com/"));
+ ensure("Agni is a system grid",
+ LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com"));
+
+ ensure_equals("name for aditi",
+ LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"),
+ std::string("util.aditi.lindenlab.com"));
+ ensure_equals("id for aditi",
+ LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"),
+ std::string("Aditi"));
+ ensure_equals("label for aditi",
+ LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"),
+ std::string("Second Life Beta Test Grid (Aditi)"));
+
+ LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris);
+
+ ensure_equals("Number of login uris for aditi", 1, login_uris.size());
+ ensure_equals("Aditi login uri",
+ login_uris[0],
+ std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
+ ensure_equals("Aditi helper uri",
+ LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"),
std::string("https://secondlife.aditi.lindenlab.com/helpers/"));
- ensure_equals("Aditi login page",
- LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"),
- std::string("https://viewer-splash.secondlife.com/"));
- ensure("Aditi is a system grid",
- LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com"));
- }
-
- // initialization with a grid file
- template<> template<>
- void viewerNetworkTestObject::test<2>()
- {
- llofstream gridfile(TEST_FILENAME);
- gridfile << gSampleGridFile;
- gridfile.close();
-
- LLGridManager::getInstance()->initialize(TEST_FILENAME);
- std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure_equals("adding a grid via a grid file increases known grid size",4,
- known_grids.size());
-
- // Verify that Agni and Aditi were not overwritten
- ensure_equals("Agni has the right name and label",
- known_grids[std::string("util.agni.lindenlab.com")],
- std::string("Second Life Main Grid (Agni)"));
- ensure_equals("Aditi has the right name and label",
- known_grids[std::string("util.aditi.lindenlab.com")],
- std::string("Second Life Beta Test Grid (Aditi)"));
- ensure_equals("name for agni",
- LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"),
- std::string("util.agni.lindenlab.com"));
- ensure_equals("id for agni",
- LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"),
- std::string("Agni"));
- ensure_equals("update url base for Agni", // relies on agni being the default
- std::string("https://update.secondlife.com/update"),
- LLGridManager::getInstance()->getUpdateServiceURL());
- ensure_equals("label for agni",
- LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"),
- std::string("Second Life Main Grid (Agni)"));
- std::vector<std::string> login_uris;
- LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris);
- ensure_equals("Number of login uris for agni", 1, login_uris.size());
- ensure_equals("Agni login uri",
- login_uris[0],
- std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
- ensure_equals("Agni helper uri",
- LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"),
- std::string("https://secondlife.com/helpers/"));
- ensure_equals("Agni login page",
- LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"),
- std::string("https://viewer-splash.secondlife.com/"));
- ensure("Agni is a system grid",
- LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com"));
-
- ensure_equals("name for aditi",
- LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"),
- std::string("util.aditi.lindenlab.com"));
- ensure_equals("id for aditi",
- LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"),
- std::string("Aditi"));
- ensure_equals("label for aditi",
- LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"),
- std::string("Second Life Beta Test Grid (Aditi)"));
-
- LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris);
- ensure_equals("Number of login uris for aditi", 1, login_uris.size());
- ensure_equals("Aditi login uri",
- login_uris[0],
- std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
- ensure_equals("Aditi helper uri",
- LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"),
+ ensure_equals("Aditi login page",
+ LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"),
+ std::string("https://viewer-splash.secondlife.com/"));
+ ensure("Aditi is a system grid",
+ LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com"));
+ }
+
+ // initialization with a grid file
+ template<> template<>
+ void viewerNetworkTestObject::test<2>()
+ {
+ llofstream gridfile(TEST_FILENAME);
+ gridfile << gSampleGridFile;
+ gridfile.close();
+
+ LLGridManager::getInstance()->initialize(TEST_FILENAME);
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
+ ensure_equals("adding a grid via a grid file increases known grid size",4,
+ known_grids.size());
+
+ // Verify that Agni and Aditi were not overwritten
+ ensure_equals("Agni has the right name and label",
+ known_grids[std::string("util.agni.lindenlab.com")],
+ std::string("Second Life Main Grid (Agni)"));
+ ensure_equals("Aditi has the right name and label",
+ known_grids[std::string("util.aditi.lindenlab.com")],
+ std::string("Second Life Beta Test Grid (Aditi)"));
+ ensure_equals("name for agni",
+ LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"),
+ std::string("util.agni.lindenlab.com"));
+ ensure_equals("id for agni",
+ LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"),
+ std::string("Agni"));
+ ensure_equals("update url base for Agni", // relies on agni being the default
+ std::string("https://update.secondlife.com/update"),
+ LLGridManager::getInstance()->getUpdateServiceURL());
+ ensure_equals("label for agni",
+ LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"),
+ std::string("Second Life Main Grid (Agni)"));
+ std::vector<std::string> login_uris;
+ LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris);
+ ensure_equals("Number of login uris for agni", 1, login_uris.size());
+ ensure_equals("Agni login uri",
+ login_uris[0],
+ std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
+ ensure_equals("Agni helper uri",
+ LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"),
+ std::string("https://secondlife.com/helpers/"));
+ ensure_equals("Agni login page",
+ LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"),
+ std::string("https://viewer-splash.secondlife.com/"));
+ ensure("Agni is a system grid",
+ LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com"));
+
+ ensure_equals("name for aditi",
+ LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"),
+ std::string("util.aditi.lindenlab.com"));
+ ensure_equals("id for aditi",
+ LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"),
+ std::string("Aditi"));
+ ensure_equals("label for aditi",
+ LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"),
+ std::string("Second Life Beta Test Grid (Aditi)"));
+
+ LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris);
+ ensure_equals("Number of login uris for aditi", 1, login_uris.size());
+ ensure_equals("Aditi login uri",
+ login_uris[0],
+ std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
+ ensure_equals("Aditi helper uri",
+ LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"),
std::string("https://secondlife.aditi.lindenlab.com/helpers/"));
- ensure_equals("Aditi login page",
- LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"),
- std::string("https://viewer-splash.secondlife.com/"));
- ensure("Aditi is a system grid",
- LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com"));
-
- // Check the additional grid from the file
- ensure_equals("alternative grid is in name<->label map",
- known_grids["altgrid.long.name"],
- std::string("Alternative Grid"));
- ensure_equals("alternative grid name is set",
- LLGridManager::getInstance()->getGrid("altgrid.long.name"),
- std::string("altgrid.long.name"));
- ensure_equals("alternative grid id",
- LLGridManager::getInstance()->getGridId("altgrid.long.name"),
- std::string("AltGrid"));
- ensure_equals("alternative grid label",
- LLGridManager::getInstance()->getGridLabel("altgrid.long.name"),
- std::string("Alternative Grid"));
- std::vector<std::string> alt_login_uris;
- LLGridManager::getInstance()->getLoginURIs(std::string("altgrid.long.name"), alt_login_uris);
- ensure_equals("Number of login uris for altgrid", 2, alt_login_uris.size());
- ensure_equals("alternative grid first login uri",
- alt_login_uris[0],
- std::string("altgrid/myloginuri1"));
- ensure_equals("alternative grid second login uri",
- alt_login_uris[1],
- std::string("altgrid/myloginuri2"));
- ensure_equals("alternative grid helper uri",
- LLGridManager::getInstance()->getHelperURI("altgrid.long.name"),
- std::string("https://helper1/helpers/"));
- ensure_equals("alternative grid login page",
- LLGridManager::getInstance()->getLoginPage("altgrid.long.name"),
- std::string("altgrid/loginpage"));
- ensure("alternative grid is NOT a system grid",
- ! LLGridManager::getInstance()->isSystemGrid("altgrid.long.name"));
-
- ensure_equals("minimal grid is in name<->label map",
- known_grids["minimal.long.name"],
- std::string("minimal.long.name"));
- ensure_equals("minimal grid name is set",
- LLGridManager::getInstance()->getGrid("minimal.long.name"),
- std::string("minimal.long.name"));
- ensure_equals("minimal grid id",
- LLGridManager::getInstance()->getGridId("minimal.long.name"),
- std::string("minimal.long.name"));
- ensure_equals("minimal grid label",
- LLGridManager::getInstance()->getGridLabel("minimal.long.name"),
- std::string("minimal.long.name"));
-
- LLGridManager::getInstance()->getLoginURIs(std::string("minimal.long.name"), alt_login_uris);
- ensure_equals("Number of login uris for altgrid", 1, alt_login_uris.size());
- ensure_equals("minimal grid login uri",
- alt_login_uris[0],
- std::string("https://minimal.long.name/cgi-bin/login.cgi"));
- ensure_equals("minimal grid helper uri",
- LLGridManager::getInstance()->getHelperURI("minimal.long.name"),
- std::string("https://minimal.long.name/helpers/"));
- ensure_equals("minimal grid login page",
- LLGridManager::getInstance()->getLoginPage("minimal.long.name"),
- std::string("http://minimal.long.name/app/login/"));
-
- }
-
-
- // validate grid selection
- template<> template<>
- void viewerNetworkTestObject::test<7>()
- {
- // adding a grid with simply a name will populate the values.
- llofstream gridfile(TEST_FILENAME);
- gridfile << gSampleGridFile;
- gridfile.close();
-
- LLGridManager::getInstance()->initialize(TEST_FILENAME);
-
- LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
- ensure_equals("getGridLabel",
- LLGridManager::getInstance()->getGridLabel(),
- std::string("Second Life Main Grid (Agni)"));
- ensure_equals("getGridId",
- LLGridManager::getInstance()->getGridId(),
- std::string("Agni"));
- ensure_equals("getGrid",
- LLGridManager::getInstance()->getGrid(),
- std::string("util.agni.lindenlab.com"));
- ensure_equals("getHelperURI",
- LLGridManager::getInstance()->getHelperURI(),
- std::string("https://secondlife.com/helpers/"));
- ensure_equals("getLoginPage",
- LLGridManager::getInstance()->getLoginPage(),
- std::string("https://viewer-splash.secondlife.com/"));
- ensure_equals("update url base for Agni", // relies on agni being the default
- std::string("https://update.secondlife.com/update"),
- LLGridManager::getInstance()->getUpdateServiceURL());
- ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid());
- std::vector<std::string> uris;
- LLGridManager::getInstance()->getLoginURIs(uris);
- ensure_equals("getLoginURIs size", 1, uris.size());
- ensure_equals("getLoginURIs",
- uris[0],
- std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
-
- LLGridManager::getInstance()->setGridChoice("altgrid.long.name");
- ensure_equals("getGridLabel",
- LLGridManager::getInstance()->getGridLabel(),
- std::string("Alternative Grid"));
- ensure_equals("getGridId",
- LLGridManager::getInstance()->getGridId(),
- std::string("AltGrid"));
- ensure("alternative grid is not a system grid",
- !LLGridManager::getInstance()->isSystemGrid());
- ensure("alternative grid is not a production grid",
- !LLGridManager::getInstance()->isInProductionGrid());
- }
+ ensure_equals("Aditi login page",
+ LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"),
+ std::string("https://viewer-splash.secondlife.com/"));
+ ensure("Aditi is a system grid",
+ LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com"));
+
+ // Check the additional grid from the file
+ ensure_equals("alternative grid is in name<->label map",
+ known_grids["altgrid.long.name"],
+ std::string("Alternative Grid"));
+ ensure_equals("alternative grid name is set",
+ LLGridManager::getInstance()->getGrid("altgrid.long.name"),
+ std::string("altgrid.long.name"));
+ ensure_equals("alternative grid id",
+ LLGridManager::getInstance()->getGridId("altgrid.long.name"),
+ std::string("AltGrid"));
+ ensure_equals("alternative grid label",
+ LLGridManager::getInstance()->getGridLabel("altgrid.long.name"),
+ std::string("Alternative Grid"));
+ std::vector<std::string> alt_login_uris;
+ LLGridManager::getInstance()->getLoginURIs(std::string("altgrid.long.name"), alt_login_uris);
+ ensure_equals("Number of login uris for altgrid", 2, alt_login_uris.size());
+ ensure_equals("alternative grid first login uri",
+ alt_login_uris[0],
+ std::string("altgrid/myloginuri1"));
+ ensure_equals("alternative grid second login uri",
+ alt_login_uris[1],
+ std::string("altgrid/myloginuri2"));
+ ensure_equals("alternative grid helper uri",
+ LLGridManager::getInstance()->getHelperURI("altgrid.long.name"),
+ std::string("https://helper1/helpers/"));
+ ensure_equals("alternative grid login page",
+ LLGridManager::getInstance()->getLoginPage("altgrid.long.name"),
+ std::string("altgrid/loginpage"));
+ ensure("alternative grid is NOT a system grid",
+ ! LLGridManager::getInstance()->isSystemGrid("altgrid.long.name"));
+
+ ensure_equals("minimal grid is in name<->label map",
+ known_grids["minimal.long.name"],
+ std::string("minimal.long.name"));
+ ensure_equals("minimal grid name is set",
+ LLGridManager::getInstance()->getGrid("minimal.long.name"),
+ std::string("minimal.long.name"));
+ ensure_equals("minimal grid id",
+ LLGridManager::getInstance()->getGridId("minimal.long.name"),
+ std::string("minimal.long.name"));
+ ensure_equals("minimal grid label",
+ LLGridManager::getInstance()->getGridLabel("minimal.long.name"),
+ std::string("minimal.long.name"));
+
+ LLGridManager::getInstance()->getLoginURIs(std::string("minimal.long.name"), alt_login_uris);
+ ensure_equals("Number of login uris for altgrid", 1, alt_login_uris.size());
+ ensure_equals("minimal grid login uri",
+ alt_login_uris[0],
+ std::string("https://minimal.long.name/cgi-bin/login.cgi"));
+ ensure_equals("minimal grid helper uri",
+ LLGridManager::getInstance()->getHelperURI("minimal.long.name"),
+ std::string("https://minimal.long.name/helpers/"));
+ ensure_equals("minimal grid login page",
+ LLGridManager::getInstance()->getLoginPage("minimal.long.name"),
+ std::string("http://minimal.long.name/app/login/"));
+
+ }
+
+
+ // validate grid selection
+ template<> template<>
+ void viewerNetworkTestObject::test<7>()
+ {
+ // adding a grid with simply a name will populate the values.
+ llofstream gridfile(TEST_FILENAME);
+ gridfile << gSampleGridFile;
+ gridfile.close();
+
+ LLGridManager::getInstance()->initialize(TEST_FILENAME);
+
+ LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
+ ensure_equals("getGridLabel",
+ LLGridManager::getInstance()->getGridLabel(),
+ std::string("Second Life Main Grid (Agni)"));
+ ensure_equals("getGridId",
+ LLGridManager::getInstance()->getGridId(),
+ std::string("Agni"));
+ ensure_equals("getGrid",
+ LLGridManager::getInstance()->getGrid(),
+ std::string("util.agni.lindenlab.com"));
+ ensure_equals("getHelperURI",
+ LLGridManager::getInstance()->getHelperURI(),
+ std::string("https://secondlife.com/helpers/"));
+ ensure_equals("getLoginPage",
+ LLGridManager::getInstance()->getLoginPage(),
+ std::string("https://viewer-splash.secondlife.com/"));
+ ensure_equals("update url base for Agni", // relies on agni being the default
+ std::string("https://update.secondlife.com/update"),
+ LLGridManager::getInstance()->getUpdateServiceURL());
+ ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid());
+ std::vector<std::string> uris;
+ LLGridManager::getInstance()->getLoginURIs(uris);
+ ensure_equals("getLoginURIs size", 1, uris.size());
+ ensure_equals("getLoginURIs",
+ uris[0],
+ std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
+
+ LLGridManager::getInstance()->setGridChoice("altgrid.long.name");
+ ensure_equals("getGridLabel",
+ LLGridManager::getInstance()->getGridLabel(),
+ std::string("Alternative Grid"));
+ ensure_equals("getGridId",
+ LLGridManager::getInstance()->getGridId(),
+ std::string("AltGrid"));
+ ensure("alternative grid is not a system grid",
+ !LLGridManager::getInstance()->isSystemGrid());
+ ensure("alternative grid is not a production grid",
+ !LLGridManager::getInstance()->isInProductionGrid());
+ }
}
diff --git a/indra/newview/tests/llvieweroctree_stub.cpp b/indra/newview/tests/llvieweroctree_stub.cpp
index ab180c49a3..caf9299a2f 100644
--- a/indra/newview/tests/llvieweroctree_stub.cpp
+++ b/indra/newview/tests/llvieweroctree_stub.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llvieweroctree_stub.cpp
* @brief stub implementations to allow unit testing
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/tests/llviewershadermgr_stub.cpp b/indra/newview/tests/llviewershadermgr_stub.cpp
index 18eff72f3c..5d6cb33019 100644
--- a/indra/newview/tests/llviewershadermgr_stub.cpp
+++ b/indra/newview/tests/llviewershadermgr_stub.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llglslshader_stub.cpp
* @brief stub class to allow unit testing
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,12 +35,12 @@ LLViewerShaderMgr::~LLViewerShaderMgr() {}
LLViewerShaderMgr* stub_instance = NULL;
LLViewerShaderMgr* LLViewerShaderMgr::instance() {
- if(NULL == stub_instance)
- {
- stub_instance = new LLViewerShaderMgr();
- }
+ if(NULL == stub_instance)
+ {
+ stub_instance = new LLViewerShaderMgr();
+ }
- return stub_instance;
+ return stub_instance;
}
LLViewerShaderMgr::shader_iter fake_iter;
LLViewerShaderMgr::shader_iter LLViewerShaderMgr::beginShaders() const {return fake_iter;}
diff --git a/indra/newview/tests/llviewertexture_stub.cpp b/indra/newview/tests/llviewertexture_stub.cpp
index 889ab9bea5..8ac3bf2279 100644
--- a/indra/newview/tests/llviewertexture_stub.cpp
+++ b/indra/newview/tests/llviewertexture_stub.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewertexture_stub.cpp
* @brief stub class to allow unit testing
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/tests/llwlanimator_stub.cpp b/indra/newview/tests/llwlanimator_stub.cpp
index f5e15b2e7b..2b4510a6b7 100644
--- a/indra/newview/tests/llwlanimator_stub.cpp
+++ b/indra/newview/tests/llwlanimator_stub.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwlanimator_stub.cpp
* @brief stub class to allow unit testing
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/tests/llwldaycycle_stub.cpp b/indra/newview/tests/llwldaycycle_stub.cpp
index a7bc9a7b83..cd82e9b200 100644
--- a/indra/newview/tests/llwldaycycle_stub.cpp
+++ b/indra/newview/tests/llwldaycycle_stub.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwldaycycle_stub.cpp
* @brief stub class to allow unit testing
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,13 +34,13 @@ LLWLDayCycle::~LLWLDayCycle(void)
bool LLWLDayCycle::getKeytime(LLWLParamKey keyFrame, F32& keyTime)
{
- keyTime = 0.5;
- return true;
+ keyTime = 0.5;
+ return true;
}
bool LLWLDayCycle::removeKeyframe(F32 time)
{
- return true;
+ return true;
}
void LLWLDayCycle::loadDayCycleFromFile(const std::string& fileName)
diff --git a/indra/newview/tests/llwlparammanager_test.cpp b/indra/newview/tests/llwlparammanager_test.cpp
index be0dc9fd0c..2838ddb719 100644
--- a/indra/newview/tests/llwlparammanager_test.cpp
+++ b/indra/newview/tests/llwlparammanager_test.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwlparammanager_test.cpp
* @brief LLWLParamManager tests
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,219 +53,219 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::
char* curl_unescape(const char* c_str, int length)
{
- char* copy = new char[length+4];
- memcpy(copy, c_str, length);
- copy[length+0] = 'E';
- copy[length+1] = 'S';
- copy[length+2] = 'C';
- copy[length+3] = '\0';
- return copy;
+ char* copy = new char[length+4];
+ memcpy(copy, c_str, length);
+ copy[length+0] = 'E';
+ copy[length+1] = 'S';
+ copy[length+2] = 'C';
+ copy[length+3] = '\0';
+ return copy;
}
void curl_free(void* p) {delete[] ((char*)p);}
char* curl_escape(const char* c_str, int length) {
- char* copy = new char[length+6];
- memcpy(copy, c_str, length);
- copy[length+0] = 'U';
- copy[length+1] = 'N';
- copy[length+2] = 'E';
- copy[length+3] = 'S';
- copy[length+4] = 'C';
- copy[length+5] = '\0';
- return copy;
+ char* copy = new char[length+6];
+ memcpy(copy, c_str, length);
+ copy[length+0] = 'U';
+ copy[length+1] = 'N';
+ copy[length+2] = 'E';
+ copy[length+3] = 'S';
+ copy[length+4] = 'C';
+ copy[length+5] = '\0';
+ return copy;
}
namespace tut
{
- // Main Setup
- struct LLWLParamManagerFixture
- {
- class LLWLParamManagerTest
- {
- };
+ // Main Setup
+ struct LLWLParamManagerFixture
+ {
+ class LLWLParamManagerTest
+ {
+ };
- LLWLParamManager* mTestManager;
+ LLWLParamManager* mTestManager;
- LLWLParamManagerFixture()
- : mTestManager(LLWLParamManager::getInstance())
- {
- }
+ LLWLParamManagerFixture()
+ : mTestManager(LLWLParamManager::getInstance())
+ {
+ }
- ~LLWLParamManagerFixture()
- {
- }
- };
- typedef test_group<LLWLParamManagerFixture> factory;
- typedef factory::object object;
- factory tf("LLWLParamManager test");
+ ~LLWLParamManagerFixture()
+ {
+ }
+ };
+ typedef test_group<LLWLParamManagerFixture> factory;
+ typedef factory::object object;
+ factory tf("LLWLParamManager test");
- // Tests
- template<> template<>
- void object::test<1>()
- {
- try
- {
- std::string preset =
- "<llsd>\
- <map>\
- <key>ambient</key>\
- <array>\
- <real>1.0499999523162842</real>\
- <real>1.0499999523162842</real>\
- <real>1.0499999523162842</real>\
- <real>0.34999999403953552</real>\
- </array>\
- <key>blue_density</key>\
- <array>\
- <real>0.2447581488182351</real>\
- <real>0.44872328639030457</real>\
- <real>0.75999999046325684</real>\
- <real>0.38000004053115788</real>\
- </array>\
- <key>blue_horizon</key>\
- <array>\
- <real>0.49548382097675159</real>\
- <real>0.49548381382419748</real>\
- <real>0.63999999284744291</real>\
- <real>0.31999999642372146</real>\
- </array>\
- <key>cloud_color</key>\
- <array>\
- <real>0.40999999165535073</real>\
- <real>0.40999999165535073</real>\
- <real>0.40999999165535073</real>\
- <real>0.40999999165535073</real>\
- </array>\
- <key>cloud_pos_density1</key>\
- <array>\
- <real>1.6884100437164307</real>\
- <real>0.52609699964523315</real>\
- <real>0.99999999999999289</real>\
- <real>1</real>\
- </array>\
- <key>cloud_pos_density2</key>\
- <array>\
- <real>1.6884100437164307</real>\
- <real>0.52609699964523315</real>\
- <real>0.125</real>\
- <real>1</real>\
- </array>\
- <key>cloud_scale</key>\
- <array>\
- <real>0.4199999868869746</real>\
- <real>0</real>\
- <real>0</real>\
- <real>1</real>\
- </array>\
- <key>cloud_scroll_rate</key>\
- <array>\
- <real>10.199999809265137</real>\
- <real>10.01099967956543</real>\
- </array>\
- <key>cloud_shadow</key>\
- <array>\
- <real>0.26999998092651367</real>\
- <real>0</real>\
- <real>0</real>\
- <real>1</real>\
- </array>\
- <key>density_multiplier</key>\
- <array>\
- <real>0.00017999998817685818</real>\
- <real>0</real>\
- <real>0</real>\
- <real>1</real>\
- </array>\
- <key>distance_multiplier</key>\
- <array>\
- <real>0.80000001192093606</real>\
- <real>0</real>\
- <real>0</real>\
- <real>1</real>\
- </array>\
- <key>east_angle</key>\
- <real>0</real>\
- <key>enable_cloud_scroll</key>\
- <array>\
- <boolean>1</boolean>\
- <boolean>1</boolean>\
- </array>\
- <key>gamma</key>\
- <array>\
- <real>1</real>\
- <real>0</real>\
- <real>0</real>\
- <real>1</real>\
- </array>\
- <key>glow</key>\
- <array>\
- <real>5</real>\
- <real>0.0010000000474974513</real>\
- <real>-0.47999998927116394</real>\
- <real>1</real>\
- </array>\
- <key>haze_density</key>\
- <array>\
- <real>0.69999998807907104</real>\
- <real>0</real>\
- <real>0</real>\
- <real>1</real>\
- </array>\
- <key>haze_horizon</key>\
- <array>\
- <real>0.18999999761581243</real>\
- <real>0.19915600121021271</real>\
- <real>0.19915600121021271</real>\
- <real>1</real>\
- </array>\
- <key>lightnorm</key>\
- <array>\
- <real>0</real>\
- <real>0.70710659027099609</real>\
- <real>-0.70710694789886475</real>\
- <real>0</real>\
- </array>\
- <key>max_y</key>\
- <array>\
- <real>1605</real>\
- <real>0</real>\
- <real>0</real>\
- <real>1</real>\
- </array>\
- <key>preset_num</key>\
- <integer>22</integer>\
- <key>star_brightness</key>\
- <real>0</real>\
- <key>sun_angle</key>\
- <real>2.3561947345733643</real>\
- <key>sunlight_color</key>\
- <array>\
- <real>0.73421055078505759</real>\
- <real>0.78157895803450828</real>\
- <real>0.89999997615813498</real>\
- <real>0.29999998211860301</real>\
- </array>\
- </map>\
- </llsd>";
+ // Tests
+ template<> template<>
+ void object::test<1>()
+ {
+ try
+ {
+ std::string preset =
+ "<llsd>\
+ <map>\
+ <key>ambient</key>\
+ <array>\
+ <real>1.0499999523162842</real>\
+ <real>1.0499999523162842</real>\
+ <real>1.0499999523162842</real>\
+ <real>0.34999999403953552</real>\
+ </array>\
+ <key>blue_density</key>\
+ <array>\
+ <real>0.2447581488182351</real>\
+ <real>0.44872328639030457</real>\
+ <real>0.75999999046325684</real>\
+ <real>0.38000004053115788</real>\
+ </array>\
+ <key>blue_horizon</key>\
+ <array>\
+ <real>0.49548382097675159</real>\
+ <real>0.49548381382419748</real>\
+ <real>0.63999999284744291</real>\
+ <real>0.31999999642372146</real>\
+ </array>\
+ <key>cloud_color</key>\
+ <array>\
+ <real>0.40999999165535073</real>\
+ <real>0.40999999165535073</real>\
+ <real>0.40999999165535073</real>\
+ <real>0.40999999165535073</real>\
+ </array>\
+ <key>cloud_pos_density1</key>\
+ <array>\
+ <real>1.6884100437164307</real>\
+ <real>0.52609699964523315</real>\
+ <real>0.99999999999999289</real>\
+ <real>1</real>\
+ </array>\
+ <key>cloud_pos_density2</key>\
+ <array>\
+ <real>1.6884100437164307</real>\
+ <real>0.52609699964523315</real>\
+ <real>0.125</real>\
+ <real>1</real>\
+ </array>\
+ <key>cloud_scale</key>\
+ <array>\
+ <real>0.4199999868869746</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>cloud_scroll_rate</key>\
+ <array>\
+ <real>10.199999809265137</real>\
+ <real>10.01099967956543</real>\
+ </array>\
+ <key>cloud_shadow</key>\
+ <array>\
+ <real>0.26999998092651367</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>density_multiplier</key>\
+ <array>\
+ <real>0.00017999998817685818</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>distance_multiplier</key>\
+ <array>\
+ <real>0.80000001192093606</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>east_angle</key>\
+ <real>0</real>\
+ <key>enable_cloud_scroll</key>\
+ <array>\
+ <boolean>1</boolean>\
+ <boolean>1</boolean>\
+ </array>\
+ <key>gamma</key>\
+ <array>\
+ <real>1</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>glow</key>\
+ <array>\
+ <real>5</real>\
+ <real>0.0010000000474974513</real>\
+ <real>-0.47999998927116394</real>\
+ <real>1</real>\
+ </array>\
+ <key>haze_density</key>\
+ <array>\
+ <real>0.69999998807907104</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>haze_horizon</key>\
+ <array>\
+ <real>0.18999999761581243</real>\
+ <real>0.19915600121021271</real>\
+ <real>0.19915600121021271</real>\
+ <real>1</real>\
+ </array>\
+ <key>lightnorm</key>\
+ <array>\
+ <real>0</real>\
+ <real>0.70710659027099609</real>\
+ <real>-0.70710694789886475</real>\
+ <real>0</real>\
+ </array>\
+ <key>max_y</key>\
+ <array>\
+ <real>1605</real>\
+ <real>0</real>\
+ <real>0</real>\
+ <real>1</real>\
+ </array>\
+ <key>preset_num</key>\
+ <integer>22</integer>\
+ <key>star_brightness</key>\
+ <real>0</real>\
+ <key>sun_angle</key>\
+ <real>2.3561947345733643</real>\
+ <key>sunlight_color</key>\
+ <array>\
+ <real>0.73421055078505759</real>\
+ <real>0.78157895803450828</real>\
+ <real>0.89999997615813498</real>\
+ <real>0.29999998211860301</real>\
+ </array>\
+ </map>\
+ </llsd>";
- std::stringstream preset_stream(preset);
- mTestManager->loadPresetFromXML(LLWLParamKey("test1", LLWLParamKey::SCOPE_LOCAL), preset_stream);
- LLWLParamSet dummy;
- ensure("Couldn't get ParamSet after loading it", mTestManager->getParamSet(LLWLParamKey("test1", LLWLParamKey::SCOPE_LOCAL), dummy));
- }
- catch (...)
- {
- fail("loadPresetFromXML test crashed!");
- }
- }
+ std::stringstream preset_stream(preset);
+ mTestManager->loadPresetFromXML(LLWLParamKey("test1", LLWLParamKey::SCOPE_LOCAL), preset_stream);
+ LLWLParamSet dummy;
+ ensure("Couldn't get ParamSet after loading it", mTestManager->getParamSet(LLWLParamKey("test1", LLWLParamKey::SCOPE_LOCAL), dummy));
+ }
+ catch (...)
+ {
+ fail("loadPresetFromXML test crashed!");
+ }
+ }
- template<> template<>
- void object::test<2>()
- {
- mTestManager->propagateParameters();
- ensure_equals("Wrong value from getDomeOffset()", mTestManager->getDomeOffset(), 0.96f);
- ensure_equals("Wrong value from getDomeRadius()", mTestManager->getDomeRadius(), 15000.f);
- ensure_equals("Wrong value from getLightDir()", mTestManager->getLightDir(), LLVector4(-0,0,1,0));
- ensure_equals("Wrong value from getClampedLightDir()", mTestManager->getClampedLightDir(), LLVector4(-0,0,1,0));
- ensure_equals("Wrong value from getRotatedLightDir()", mTestManager->getRotatedLightDir(), LLVector4(0,0,0,1));
- }
+ template<> template<>
+ void object::test<2>()
+ {
+ mTestManager->propagateParameters();
+ ensure_equals("Wrong value from getDomeOffset()", mTestManager->getDomeOffset(), 0.96f);
+ ensure_equals("Wrong value from getDomeRadius()", mTestManager->getDomeRadius(), 15000.f);
+ ensure_equals("Wrong value from getLightDir()", mTestManager->getLightDir(), LLVector4(-0,0,1,0));
+ ensure_equals("Wrong value from getClampedLightDir()", mTestManager->getClampedLightDir(), LLVector4(-0,0,1,0));
+ ensure_equals("Wrong value from getRotatedLightDir()", mTestManager->getRotatedLightDir(), LLVector4(0,0,0,1));
+ }
}
diff --git a/indra/newview/tests/llwlparamset_stub.cpp b/indra/newview/tests/llwlparamset_stub.cpp
index ccb99db475..e6c4221895 100644
--- a/indra/newview/tests/llwlparamset_stub.cpp
+++ b/indra/newview/tests/llwlparamset_stub.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwlparamset_stub.cpp
* @brief stub class to allow unit testing
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp
index f1dd8acccf..03ab9de96c 100644
--- a/indra/newview/tests/llworldmap_test.cpp
+++ b/indra/newview/tests/llworldmap_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llworldmap_test.cpp
* @author Merov Linden
* @date 2009-03-09
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,7 +40,7 @@
// -------------------------------------------------------------------------------------------
// Stubbing: Declarations required to link and run the class being tested
-// Notes:
+// Notes:
// * Add here stubbed implementation of the few classes and methods used in the class to be tested
// * Add as little as possible (let the link errors guide you)
// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code)
@@ -50,7 +50,7 @@
void LLGLTexture::setBoostLevel(S32 ) { }
void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { }
LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, BOOL, LLGLTexture::EBoostLevel, S8,
- LLGLint, LLGLenum, LLHost ) { return NULL; }
+ LLGLint, LLGLenum, LLHost ) { return NULL; }
// Stub related map calls
LLWorldMapMessage::LLWorldMapMessage() { }
@@ -88,428 +88,428 @@ const std::string SIM_NAME_TEST = "Sim Foo";
namespace tut
{
- // Test wrapper declarations
- struct iteminfo_test
- {
- // Instance to be tested
- LLItemInfo* mItem;
-
- // Constructor and destructor of the test wrapper
- iteminfo_test()
- {
- LLUUID id;
- mItem = new LLItemInfo(X_WORLD_TEST, Y_WORLD_TEST, ITEM_NAME_TEST, id);
- }
- ~iteminfo_test()
- {
- delete mItem;
- }
- };
-
- struct siminfo_test
- {
- // Instance to be tested
- LLSimInfo* mSim;
-
- // Constructor and destructor of the test wrapper
- siminfo_test()
- {
- U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST);
- mSim = new LLSimInfo(handle);
- }
- ~siminfo_test()
- {
- delete mSim;
- }
- };
-
- struct worldmap_test
- {
- // Instance to be tested
- LLWorldMap* mWorld;
-
- // Constructor and destructor of the test wrapper
- worldmap_test()
- {
- mWorld = LLWorldMap::getInstance();
- }
- ~worldmap_test()
- {
- mWorld = NULL;
- }
- };
-
- // Tut templating thingamagic: test group, object and test instance
- typedef test_group<iteminfo_test> iteminfo_t;
- typedef iteminfo_t::object iteminfo_object_t;
- tut::iteminfo_t tut_iteminfo("LLItemInfo");
-
- typedef test_group<siminfo_test> siminfo_t;
- typedef siminfo_t::object siminfo_object_t;
- tut::siminfo_t tut_siminfo("LLSimInfo");
-
- typedef test_group<worldmap_test> worldmap_t;
- typedef worldmap_t::object worldmap_object_t;
- tut::worldmap_t tut_worldmap("LLWorldMap");
-
- // ---------------------------------------------------------------------------------------
- // Test functions
- // Notes:
- // * Test as many as you possibly can without requiring a full blown simulation of everything
- // * The tests are executed in sequence so the test instance state may change between calls
- // * Remember that you cannot test private methods with tut
- // ---------------------------------------------------------------------------------------
-
- // ---------------------------------------------------------------------------------------
- // Test the LLItemInfo interface
- // ---------------------------------------------------------------------------------------
- template<> template<>
- void iteminfo_object_t::test<1>()
- {
- // Test 1 : setCount() / getCount()
- mItem->setCount(10);
- ensure("LLItemInfo::setCount() test failed", mItem->getCount() == 10);
- // Test 2 : setTooltip() / getToolTip()
- std::string tooltip = TOOLTIP_TEST;
- mItem->setTooltip(tooltip);
- ensure("LLItemInfo::setTooltip() test failed", mItem->getToolTip() == TOOLTIP_TEST);
- // Test 3 : setElevation() / getGlobalPosition()
- mItem->setElevation(Z_WORLD_TEST);
- LLVector3d pos = mItem->getGlobalPosition();
- LLVector3d ref(X_WORLD_TEST, Y_WORLD_TEST, Z_WORLD_TEST);
- ensure("LLItemInfo::getGlobalPosition() test failed", pos == ref);
- // Test 4 : getName()
- std::string name = mItem->getName();
- ensure("LLItemInfo::getName() test failed", name == ITEM_NAME_TEST);
- // Test 5 : isName()
- ensure("LLItemInfo::isName() test failed", mItem->isName(name));
- // Test 6 : getUUID()
- LLUUID id;
- ensure("LLItemInfo::getUUID() test failed", mItem->getUUID() == id);
- // Test 7 : getRegionHandle()
- U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST);
- ensure("LLItemInfo::getRegionHandle() test failed", mItem->getRegionHandle() == handle);
- }
- // ---------------------------------------------------------------------------------------
- // Test the LLSimInfo interface
- // ---------------------------------------------------------------------------------------
- // Test Setters and Accessors methods
- template<> template<>
- void siminfo_object_t::test<1>()
- {
- // Test 1 : setName() / getName()
- std::string name = SIM_NAME_TEST;
- mSim->setName(name);
- ensure("LLSimInfo::setName() test failed", mSim->getName() == SIM_NAME_TEST);
- // Test 2 : isName()
- ensure("LLSimInfo::isName() test failed", mSim->isName(name));
- // Test 3 : getGlobalPos()
- LLVector3 local;
- LLVector3d ref(X_WORLD_TEST, Y_WORLD_TEST, 0.0f);
- LLVector3d pos = mSim->getGlobalPos(local);
- ensure("LLSimInfo::getGlobalPos() test failed", pos == ref);
- // Test 4 : getGlobalOrigin()
- pos = mSim->getGlobalOrigin();
- ensure("LLSimInfo::getGlobalOrigin() test failed", pos == ref);
- // Test 5 : clearImage()
- try {
- mSim->clearImage();
- } catch (...) {
- fail("LLSimInfo::clearImage() test failed");
- }
- // Test 6 : dropImagePriority()
- try {
- mSim->dropImagePriority();
- } catch (...) {
- fail("LLSimInfo::dropImagePriority() test failed");
- }
- // Test 7 : updateAgentCount()
- try {
- mSim->updateAgentCount(0.0f);
- } catch (...) {
- fail("LLSimInfo::updateAgentCount() test failed");
- }
- // Test 8 : getAgentCount()
- S32 agents = mSim->getAgentCount();
- ensure("LLSimInfo::getAgentCount() test failed", agents == 0);
- // Test 9 : setLandForSaleImage() / getLandForSaleImage()
- LLUUID id;
- mSim->setLandForSaleImage(id);
- LLPointer<LLViewerFetchedTexture> image = mSim->getLandForSaleImage();
- ensure("LLSimInfo::getLandForSaleImage() test failed", image.isNull());
- // Test 10 : isPG()
- mSim->setAccess(SIM_ACCESS_PG);
- ensure("LLSimInfo::isPG() test failed", mSim->isPG());
- // Test 11 : isDown()
- mSim->setAccess(SIM_ACCESS_DOWN);
- ensure("LLSimInfo::isDown() test failed", mSim->isDown());
- // Test 12 : Access strings can't be accessed from unit test...
- //ensure("LLSimInfo::getAccessString() test failed", mSim->getAccessString() == "Offline");
- // Test 13 : Region strings can't be accessed from unit test...
- //mSim->setRegionFlags(REGION_FLAGS_SANDBOX);
- //ensure("LLSimInfo::setRegionFlags() test failed", mSim->getFlagsString() == "Sandbox");
- }
- // Test management of LLInfoItem lists
- template<> template<>
- void siminfo_object_t::test<2>()
- {
- // Test 14 : clearItems()
- try {
- mSim->clearItems();
- } catch (...) {
- fail("LLSimInfo::clearItems() at init test failed");
- }
-
- // Test 15 : Verify that all the lists are empty
- LLSimInfo::item_info_list_t list;
- list = mSim->getTeleHub();
- ensure("LLSimInfo::getTeleHub() empty at init test failed", list.empty());
- list = mSim->getInfoHub();
- ensure("LLSimInfo::getInfoHub() empty at init test failed", list.empty());
- list = mSim->getPGEvent();
- ensure("LLSimInfo::getPGEvent() empty at init test failed", list.empty());
- list = mSim->getMatureEvent();
- ensure("LLSimInfo::getMatureEvent() empty at init test failed", list.empty());
- list = mSim->getLandForSale();
- ensure("LLSimInfo::getLandForSale() empty at init test failed", list.empty());
- list = mSim->getAgentLocation();
- ensure("LLSimInfo::getAgentLocation() empty at init test failed", list.empty());
-
- // Create an item to be inserted
- LLUUID id;
- LLItemInfo item(X_WORLD_TEST, Y_WORLD_TEST, ITEM_NAME_TEST, id);
-
- // Insert the item in each list
- mSim->insertTeleHub(item);
- mSim->insertInfoHub(item);
- mSim->insertPGEvent(item);
- mSim->insertMatureEvent(item);
- mSim->insertLandForSale(item);
- mSim->insertAgentLocation(item);
-
- // Test 16 : Verify that the lists contain 1 item each
- list = mSim->getTeleHub();
- ensure("LLSimInfo::insertTeleHub() test failed", list.size() == 1);
- list = mSim->getInfoHub();
- ensure("LLSimInfo::insertInfoHub() test failed", list.size() == 1);
- list = mSim->getPGEvent();
- ensure("LLSimInfo::insertPGEvent() test failed", list.size() == 1);
- list = mSim->getMatureEvent();
- ensure("LLSimInfo::insertMatureEvent() test failed", list.size() == 1);
- list = mSim->getLandForSale();
- ensure("LLSimInfo::insertLandForSale() test failed", list.size() == 1);
- list = mSim->getAgentLocation();
- ensure("LLSimInfo::insertAgentLocation() test failed", list.size() == 1);
-
- // Test 17 : clearItems()
- try {
- mSim->clearItems();
- } catch (...) {
- fail("LLSimInfo::clearItems() at end test failed");
- }
-
- // Test 18 : Verify that all the lists are empty again... *except* agent which is persisted!! (on purpose)
- list = mSim->getTeleHub();
- ensure("LLSimInfo::getTeleHub() empty after clear test failed", list.empty());
- list = mSim->getInfoHub();
- ensure("LLSimInfo::getInfoHub() empty after clear test failed", list.empty());
- list = mSim->getPGEvent();
- ensure("LLSimInfo::getPGEvent() empty after clear test failed", list.empty());
- list = mSim->getMatureEvent();
- ensure("LLSimInfo::getMatureEvent() empty after clear test failed", list.empty());
- list = mSim->getLandForSale();
- ensure("LLSimInfo::getLandForSale() empty after clear test failed", list.empty());
- list = mSim->getAgentLocation();
- ensure("LLSimInfo::getAgentLocation() empty after clear test failed", list.size() == 1);
- }
-
- // ---------------------------------------------------------------------------------------
- // Test the LLWorldMap interface
- // ---------------------------------------------------------------------------------------
- // Test Setters and Accessors methods
- template<> template<>
- void worldmap_object_t::test<1>()
- {
- // Test 1 : reset()
- try {
- mWorld->reset();
- } catch (...) {
- fail("LLWorldMap::reset() at init test failed");
- }
- // Test 2 : clearImageRefs()
- try {
- mWorld->clearImageRefs();
- } catch (...) {
- fail("LLWorldMap::clearImageRefs() test failed");
- }
- // Test 3 : dropImagePriorities()
- try {
- mWorld->dropImagePriorities();
- } catch (...) {
- fail("LLWorldMap::dropImagePriorities() test failed");
- }
- // Test 4 : reloadItems()
- try {
- mWorld->reloadItems(true);
- } catch (...) {
- fail("LLWorldMap::reloadItems() test failed");
- }
- // Test 5 : updateRegions()
- try {
- mWorld->updateRegions(1000, 1000, 1004, 1004);
- } catch (...) {
- fail("LLWorldMap::updateRegions() test failed");
- }
- // Test 6 : equalizeBoostLevels()
- try {
- mWorld->equalizeBoostLevels();
- } catch (...) {
- fail("LLWorldMap::equalizeBoostLevels() test failed");
- }
- // Test 7 : getObjectsTile()
- try {
- LLPointer<LLViewerFetchedTexture> image = mWorld->getObjectsTile((U32)(X_WORLD_TEST/REGION_WIDTH_METERS), (U32)(Y_WORLD_TEST/REGION_WIDTH_METERS), 1);
- ensure("LLWorldMap::getObjectsTile() failed", image.isNull());
- } catch (...) {
- fail("LLWorldMap::getObjectsTile() test failed with exception");
- }
- }
- // Test management of LLSimInfo lists
- template<> template<>
- void worldmap_object_t::test<2>()
- {
- // Test 8 : reset()
- try {
- mWorld->reset();
- } catch (...) {
- fail("LLWorldMap::reset() at init test failed");
- }
-
- // Test 9 : Verify that all the region list is empty
- LLWorldMap::sim_info_map_t list;
- list = mWorld->getRegionMap();
- ensure("LLWorldMap::getRegionMap() empty at init test failed", list.empty());
-
- // Test 10 : Insert a region
- bool success;
- LLUUID id;
- std::string name_sim = SIM_NAME_TEST;
- success = mWorld->insertRegion( U32(X_WORLD_TEST),
- U32(Y_WORLD_TEST),
- name_sim,
- id,
- SIM_ACCESS_PG,
- REGION_FLAGS_SANDBOX);
- list = mWorld->getRegionMap();
- ensure("LLWorldMap::insertRegion() failed", success && (list.size() == 1));
-
- // Test 11 : Insert an item in the same region -> number of regions doesn't increase
- std::string name_item = ITEM_NAME_TEST;
- success = mWorld->insertItem( U32(X_WORLD_TEST + REGION_WIDTH_METERS/2),
- U32(Y_WORLD_TEST + REGION_WIDTH_METERS/2),
- name_item,
- id,
- MAP_ITEM_LAND_FOR_SALE,
- 0, 0);
- list = mWorld->getRegionMap();
- ensure("LLWorldMap::insertItem() in existing region failed", success && (list.size() == 1));
-
- // Test 12 : Insert an item in another region -> number of regions increases
- success = mWorld->insertItem( U32(X_WORLD_TEST + REGION_WIDTH_METERS*2),
- U32(Y_WORLD_TEST + REGION_WIDTH_METERS*2),
- name_item,
- id,
- MAP_ITEM_LAND_FOR_SALE,
- 0, 0);
- list = mWorld->getRegionMap();
- ensure("LLWorldMap::insertItem() in unexisting region failed", success && (list.size() == 2));
-
- // Test 13 : simInfoFromPosGlobal() in region
- LLVector3d pos1( X_WORLD_TEST + REGION_WIDTH_METERS*2 + REGION_WIDTH_METERS/2,
- Y_WORLD_TEST + REGION_WIDTH_METERS*2 + REGION_WIDTH_METERS/2,
- 0.0f);
- LLSimInfo* sim;
- sim = mWorld->simInfoFromPosGlobal(pos1);
- ensure("LLWorldMap::simInfoFromPosGlobal() test on existing region failed", sim != NULL);
-
- // Test 14 : simInfoFromPosGlobal() outside region
- LLVector3d pos2( X_WORLD_TEST + REGION_WIDTH_METERS*4 + REGION_WIDTH_METERS/2,
- Y_WORLD_TEST + REGION_WIDTH_METERS*4 + REGION_WIDTH_METERS/2,
- 0.0f);
- sim = mWorld->simInfoFromPosGlobal(pos2);
- ensure("LLWorldMap::simInfoFromPosGlobal() test outside region failed", sim == NULL);
-
- // Test 15 : simInfoFromName()
- sim = mWorld->simInfoFromName(name_sim);
- ensure("LLWorldMap::simInfoFromName() test on existing region failed", sim != NULL);
-
- // Test 16 : simInfoFromHandle()
- U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST);
- sim = mWorld->simInfoFromHandle(handle);
- ensure("LLWorldMap::simInfoFromHandle() test on existing region failed", sim != NULL);
-
- // Test 17 : simNameFromPosGlobal()
- LLVector3d pos3( X_WORLD_TEST + REGION_WIDTH_METERS/2,
- Y_WORLD_TEST + REGION_WIDTH_METERS/2,
- 0.0f);
- success = mWorld->simNameFromPosGlobal(pos3, name_sim);
- ensure("LLWorldMap::simNameFromPosGlobal() test on existing region failed", success && (name_sim == SIM_NAME_TEST));
-
- // Test 18 : reset()
- try {
- mWorld->reset();
- } catch (...) {
- fail("LLWorldMap::reset() at end test failed");
- }
-
- // Test 19 : Verify that all the region list is empty
- list = mWorld->getRegionMap();
- ensure("LLWorldMap::getRegionMap() empty at end test failed", list.empty());
- }
- // Test tracking
- template<> template<>
- void worldmap_object_t::test<3>()
- {
- // Point to track
- LLVector3d pos( X_WORLD_TEST + REGION_WIDTH_METERS/2, Y_WORLD_TEST + REGION_WIDTH_METERS/2, Z_WORLD_TEST);
-
- // Test 20 : no tracking
- mWorld->cancelTracking();
- ensure("LLWorldMap::cancelTracking() at begin test failed", mWorld->isTracking() == false);
-
- // Test 21 : set tracking
- mWorld->setTracking(pos);
- ensure("LLWorldMap::setTracking() failed", mWorld->isTracking() && !mWorld->isTrackingValidLocation());
-
- // Test 22 : set click and commit flags
- mWorld->setTrackingDoubleClick();
- ensure("LLWorldMap::setTrackingDoubleClick() failed", mWorld->isTrackingDoubleClick());
- mWorld->setTrackingCommit();
- ensure("LLWorldMap::setTrackingCommit() failed", mWorld->isTrackingCommit());
-
- // Test 23 : in rectangle test
- bool inRect = mWorld->isTrackingInRectangle( X_WORLD_TEST, Y_WORLD_TEST,
- X_WORLD_TEST + REGION_WIDTH_METERS,
- Y_WORLD_TEST + REGION_WIDTH_METERS);
- ensure("LLWorldMap::isTrackingInRectangle() in rectangle failed", inRect);
- inRect = mWorld->isTrackingInRectangle( X_WORLD_TEST + REGION_WIDTH_METERS,
- Y_WORLD_TEST + REGION_WIDTH_METERS,
- X_WORLD_TEST + 2 * REGION_WIDTH_METERS,
- Y_WORLD_TEST + 2 * REGION_WIDTH_METERS);
- ensure("LLWorldMap::isTrackingInRectangle() outside rectangle failed", !inRect);
-
- // Test 24 : set tracking to valid and invalid
- mWorld->setTrackingValid();
- ensure("LLWorldMap::setTrackingValid() failed", mWorld->isTrackingValidLocation() && !mWorld->isTrackingInvalidLocation());
- mWorld->setTrackingInvalid();
- ensure("LLWorldMap::setTrackingInvalid() failed", !mWorld->isTrackingValidLocation() && mWorld->isTrackingInvalidLocation());
-
- // Test 25 : getTrackedPositionGlobal()
- LLVector3d res = mWorld->getTrackedPositionGlobal();
- ensure("LLWorldMap::getTrackedPositionGlobal() failed", res == pos);
-
- // Test 26 : reset tracking
- mWorld->cancelTracking();
- ensure("LLWorldMap::cancelTracking() at end test failed", mWorld->isTracking() == false);
- }
+ // Test wrapper declarations
+ struct iteminfo_test
+ {
+ // Instance to be tested
+ LLItemInfo* mItem;
+
+ // Constructor and destructor of the test wrapper
+ iteminfo_test()
+ {
+ LLUUID id;
+ mItem = new LLItemInfo(X_WORLD_TEST, Y_WORLD_TEST, ITEM_NAME_TEST, id);
+ }
+ ~iteminfo_test()
+ {
+ delete mItem;
+ }
+ };
+
+ struct siminfo_test
+ {
+ // Instance to be tested
+ LLSimInfo* mSim;
+
+ // Constructor and destructor of the test wrapper
+ siminfo_test()
+ {
+ U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST);
+ mSim = new LLSimInfo(handle);
+ }
+ ~siminfo_test()
+ {
+ delete mSim;
+ }
+ };
+
+ struct worldmap_test
+ {
+ // Instance to be tested
+ LLWorldMap* mWorld;
+
+ // Constructor and destructor of the test wrapper
+ worldmap_test()
+ {
+ mWorld = LLWorldMap::getInstance();
+ }
+ ~worldmap_test()
+ {
+ mWorld = NULL;
+ }
+ };
+
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<iteminfo_test> iteminfo_t;
+ typedef iteminfo_t::object iteminfo_object_t;
+ tut::iteminfo_t tut_iteminfo("LLItemInfo");
+
+ typedef test_group<siminfo_test> siminfo_t;
+ typedef siminfo_t::object siminfo_object_t;
+ tut::siminfo_t tut_siminfo("LLSimInfo");
+
+ typedef test_group<worldmap_test> worldmap_t;
+ typedef worldmap_t::object worldmap_object_t;
+ tut::worldmap_t tut_worldmap("LLWorldMap");
+
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // Notes:
+ // * Test as many as you possibly can without requiring a full blown simulation of everything
+ // * The tests are executed in sequence so the test instance state may change between calls
+ // * Remember that you cannot test private methods with tut
+ // ---------------------------------------------------------------------------------------
+
+ // ---------------------------------------------------------------------------------------
+ // Test the LLItemInfo interface
+ // ---------------------------------------------------------------------------------------
+ template<> template<>
+ void iteminfo_object_t::test<1>()
+ {
+ // Test 1 : setCount() / getCount()
+ mItem->setCount(10);
+ ensure("LLItemInfo::setCount() test failed", mItem->getCount() == 10);
+ // Test 2 : setTooltip() / getToolTip()
+ std::string tooltip = TOOLTIP_TEST;
+ mItem->setTooltip(tooltip);
+ ensure("LLItemInfo::setTooltip() test failed", mItem->getToolTip() == TOOLTIP_TEST);
+ // Test 3 : setElevation() / getGlobalPosition()
+ mItem->setElevation(Z_WORLD_TEST);
+ LLVector3d pos = mItem->getGlobalPosition();
+ LLVector3d ref(X_WORLD_TEST, Y_WORLD_TEST, Z_WORLD_TEST);
+ ensure("LLItemInfo::getGlobalPosition() test failed", pos == ref);
+ // Test 4 : getName()
+ std::string name = mItem->getName();
+ ensure("LLItemInfo::getName() test failed", name == ITEM_NAME_TEST);
+ // Test 5 : isName()
+ ensure("LLItemInfo::isName() test failed", mItem->isName(name));
+ // Test 6 : getUUID()
+ LLUUID id;
+ ensure("LLItemInfo::getUUID() test failed", mItem->getUUID() == id);
+ // Test 7 : getRegionHandle()
+ U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST);
+ ensure("LLItemInfo::getRegionHandle() test failed", mItem->getRegionHandle() == handle);
+ }
+ // ---------------------------------------------------------------------------------------
+ // Test the LLSimInfo interface
+ // ---------------------------------------------------------------------------------------
+ // Test Setters and Accessors methods
+ template<> template<>
+ void siminfo_object_t::test<1>()
+ {
+ // Test 1 : setName() / getName()
+ std::string name = SIM_NAME_TEST;
+ mSim->setName(name);
+ ensure("LLSimInfo::setName() test failed", mSim->getName() == SIM_NAME_TEST);
+ // Test 2 : isName()
+ ensure("LLSimInfo::isName() test failed", mSim->isName(name));
+ // Test 3 : getGlobalPos()
+ LLVector3 local;
+ LLVector3d ref(X_WORLD_TEST, Y_WORLD_TEST, 0.0f);
+ LLVector3d pos = mSim->getGlobalPos(local);
+ ensure("LLSimInfo::getGlobalPos() test failed", pos == ref);
+ // Test 4 : getGlobalOrigin()
+ pos = mSim->getGlobalOrigin();
+ ensure("LLSimInfo::getGlobalOrigin() test failed", pos == ref);
+ // Test 5 : clearImage()
+ try {
+ mSim->clearImage();
+ } catch (...) {
+ fail("LLSimInfo::clearImage() test failed");
+ }
+ // Test 6 : dropImagePriority()
+ try {
+ mSim->dropImagePriority();
+ } catch (...) {
+ fail("LLSimInfo::dropImagePriority() test failed");
+ }
+ // Test 7 : updateAgentCount()
+ try {
+ mSim->updateAgentCount(0.0f);
+ } catch (...) {
+ fail("LLSimInfo::updateAgentCount() test failed");
+ }
+ // Test 8 : getAgentCount()
+ S32 agents = mSim->getAgentCount();
+ ensure("LLSimInfo::getAgentCount() test failed", agents == 0);
+ // Test 9 : setLandForSaleImage() / getLandForSaleImage()
+ LLUUID id;
+ mSim->setLandForSaleImage(id);
+ LLPointer<LLViewerFetchedTexture> image = mSim->getLandForSaleImage();
+ ensure("LLSimInfo::getLandForSaleImage() test failed", image.isNull());
+ // Test 10 : isPG()
+ mSim->setAccess(SIM_ACCESS_PG);
+ ensure("LLSimInfo::isPG() test failed", mSim->isPG());
+ // Test 11 : isDown()
+ mSim->setAccess(SIM_ACCESS_DOWN);
+ ensure("LLSimInfo::isDown() test failed", mSim->isDown());
+ // Test 12 : Access strings can't be accessed from unit test...
+ //ensure("LLSimInfo::getAccessString() test failed", mSim->getAccessString() == "Offline");
+ // Test 13 : Region strings can't be accessed from unit test...
+ //mSim->setRegionFlags(REGION_FLAGS_SANDBOX);
+ //ensure("LLSimInfo::setRegionFlags() test failed", mSim->getFlagsString() == "Sandbox");
+ }
+ // Test management of LLInfoItem lists
+ template<> template<>
+ void siminfo_object_t::test<2>()
+ {
+ // Test 14 : clearItems()
+ try {
+ mSim->clearItems();
+ } catch (...) {
+ fail("LLSimInfo::clearItems() at init test failed");
+ }
+
+ // Test 15 : Verify that all the lists are empty
+ LLSimInfo::item_info_list_t list;
+ list = mSim->getTeleHub();
+ ensure("LLSimInfo::getTeleHub() empty at init test failed", list.empty());
+ list = mSim->getInfoHub();
+ ensure("LLSimInfo::getInfoHub() empty at init test failed", list.empty());
+ list = mSim->getPGEvent();
+ ensure("LLSimInfo::getPGEvent() empty at init test failed", list.empty());
+ list = mSim->getMatureEvent();
+ ensure("LLSimInfo::getMatureEvent() empty at init test failed", list.empty());
+ list = mSim->getLandForSale();
+ ensure("LLSimInfo::getLandForSale() empty at init test failed", list.empty());
+ list = mSim->getAgentLocation();
+ ensure("LLSimInfo::getAgentLocation() empty at init test failed", list.empty());
+
+ // Create an item to be inserted
+ LLUUID id;
+ LLItemInfo item(X_WORLD_TEST, Y_WORLD_TEST, ITEM_NAME_TEST, id);
+
+ // Insert the item in each list
+ mSim->insertTeleHub(item);
+ mSim->insertInfoHub(item);
+ mSim->insertPGEvent(item);
+ mSim->insertMatureEvent(item);
+ mSim->insertLandForSale(item);
+ mSim->insertAgentLocation(item);
+
+ // Test 16 : Verify that the lists contain 1 item each
+ list = mSim->getTeleHub();
+ ensure("LLSimInfo::insertTeleHub() test failed", list.size() == 1);
+ list = mSim->getInfoHub();
+ ensure("LLSimInfo::insertInfoHub() test failed", list.size() == 1);
+ list = mSim->getPGEvent();
+ ensure("LLSimInfo::insertPGEvent() test failed", list.size() == 1);
+ list = mSim->getMatureEvent();
+ ensure("LLSimInfo::insertMatureEvent() test failed", list.size() == 1);
+ list = mSim->getLandForSale();
+ ensure("LLSimInfo::insertLandForSale() test failed", list.size() == 1);
+ list = mSim->getAgentLocation();
+ ensure("LLSimInfo::insertAgentLocation() test failed", list.size() == 1);
+
+ // Test 17 : clearItems()
+ try {
+ mSim->clearItems();
+ } catch (...) {
+ fail("LLSimInfo::clearItems() at end test failed");
+ }
+
+ // Test 18 : Verify that all the lists are empty again... *except* agent which is persisted!! (on purpose)
+ list = mSim->getTeleHub();
+ ensure("LLSimInfo::getTeleHub() empty after clear test failed", list.empty());
+ list = mSim->getInfoHub();
+ ensure("LLSimInfo::getInfoHub() empty after clear test failed", list.empty());
+ list = mSim->getPGEvent();
+ ensure("LLSimInfo::getPGEvent() empty after clear test failed", list.empty());
+ list = mSim->getMatureEvent();
+ ensure("LLSimInfo::getMatureEvent() empty after clear test failed", list.empty());
+ list = mSim->getLandForSale();
+ ensure("LLSimInfo::getLandForSale() empty after clear test failed", list.empty());
+ list = mSim->getAgentLocation();
+ ensure("LLSimInfo::getAgentLocation() empty after clear test failed", list.size() == 1);
+ }
+
+ // ---------------------------------------------------------------------------------------
+ // Test the LLWorldMap interface
+ // ---------------------------------------------------------------------------------------
+ // Test Setters and Accessors methods
+ template<> template<>
+ void worldmap_object_t::test<1>()
+ {
+ // Test 1 : reset()
+ try {
+ mWorld->reset();
+ } catch (...) {
+ fail("LLWorldMap::reset() at init test failed");
+ }
+ // Test 2 : clearImageRefs()
+ try {
+ mWorld->clearImageRefs();
+ } catch (...) {
+ fail("LLWorldMap::clearImageRefs() test failed");
+ }
+ // Test 3 : dropImagePriorities()
+ try {
+ mWorld->dropImagePriorities();
+ } catch (...) {
+ fail("LLWorldMap::dropImagePriorities() test failed");
+ }
+ // Test 4 : reloadItems()
+ try {
+ mWorld->reloadItems(true);
+ } catch (...) {
+ fail("LLWorldMap::reloadItems() test failed");
+ }
+ // Test 5 : updateRegions()
+ try {
+ mWorld->updateRegions(1000, 1000, 1004, 1004);
+ } catch (...) {
+ fail("LLWorldMap::updateRegions() test failed");
+ }
+ // Test 6 : equalizeBoostLevels()
+ try {
+ mWorld->equalizeBoostLevels();
+ } catch (...) {
+ fail("LLWorldMap::equalizeBoostLevels() test failed");
+ }
+ // Test 7 : getObjectsTile()
+ try {
+ LLPointer<LLViewerFetchedTexture> image = mWorld->getObjectsTile((U32)(X_WORLD_TEST/REGION_WIDTH_METERS), (U32)(Y_WORLD_TEST/REGION_WIDTH_METERS), 1);
+ ensure("LLWorldMap::getObjectsTile() failed", image.isNull());
+ } catch (...) {
+ fail("LLWorldMap::getObjectsTile() test failed with exception");
+ }
+ }
+ // Test management of LLSimInfo lists
+ template<> template<>
+ void worldmap_object_t::test<2>()
+ {
+ // Test 8 : reset()
+ try {
+ mWorld->reset();
+ } catch (...) {
+ fail("LLWorldMap::reset() at init test failed");
+ }
+
+ // Test 9 : Verify that all the region list is empty
+ LLWorldMap::sim_info_map_t list;
+ list = mWorld->getRegionMap();
+ ensure("LLWorldMap::getRegionMap() empty at init test failed", list.empty());
+
+ // Test 10 : Insert a region
+ bool success;
+ LLUUID id;
+ std::string name_sim = SIM_NAME_TEST;
+ success = mWorld->insertRegion( U32(X_WORLD_TEST),
+ U32(Y_WORLD_TEST),
+ name_sim,
+ id,
+ SIM_ACCESS_PG,
+ REGION_FLAGS_SANDBOX);
+ list = mWorld->getRegionMap();
+ ensure("LLWorldMap::insertRegion() failed", success && (list.size() == 1));
+
+ // Test 11 : Insert an item in the same region -> number of regions doesn't increase
+ std::string name_item = ITEM_NAME_TEST;
+ success = mWorld->insertItem( U32(X_WORLD_TEST + REGION_WIDTH_METERS/2),
+ U32(Y_WORLD_TEST + REGION_WIDTH_METERS/2),
+ name_item,
+ id,
+ MAP_ITEM_LAND_FOR_SALE,
+ 0, 0);
+ list = mWorld->getRegionMap();
+ ensure("LLWorldMap::insertItem() in existing region failed", success && (list.size() == 1));
+
+ // Test 12 : Insert an item in another region -> number of regions increases
+ success = mWorld->insertItem( U32(X_WORLD_TEST + REGION_WIDTH_METERS*2),
+ U32(Y_WORLD_TEST + REGION_WIDTH_METERS*2),
+ name_item,
+ id,
+ MAP_ITEM_LAND_FOR_SALE,
+ 0, 0);
+ list = mWorld->getRegionMap();
+ ensure("LLWorldMap::insertItem() in unexisting region failed", success && (list.size() == 2));
+
+ // Test 13 : simInfoFromPosGlobal() in region
+ LLVector3d pos1( X_WORLD_TEST + REGION_WIDTH_METERS*2 + REGION_WIDTH_METERS/2,
+ Y_WORLD_TEST + REGION_WIDTH_METERS*2 + REGION_WIDTH_METERS/2,
+ 0.0f);
+ LLSimInfo* sim;
+ sim = mWorld->simInfoFromPosGlobal(pos1);
+ ensure("LLWorldMap::simInfoFromPosGlobal() test on existing region failed", sim != NULL);
+
+ // Test 14 : simInfoFromPosGlobal() outside region
+ LLVector3d pos2( X_WORLD_TEST + REGION_WIDTH_METERS*4 + REGION_WIDTH_METERS/2,
+ Y_WORLD_TEST + REGION_WIDTH_METERS*4 + REGION_WIDTH_METERS/2,
+ 0.0f);
+ sim = mWorld->simInfoFromPosGlobal(pos2);
+ ensure("LLWorldMap::simInfoFromPosGlobal() test outside region failed", sim == NULL);
+
+ // Test 15 : simInfoFromName()
+ sim = mWorld->simInfoFromName(name_sim);
+ ensure("LLWorldMap::simInfoFromName() test on existing region failed", sim != NULL);
+
+ // Test 16 : simInfoFromHandle()
+ U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST);
+ sim = mWorld->simInfoFromHandle(handle);
+ ensure("LLWorldMap::simInfoFromHandle() test on existing region failed", sim != NULL);
+
+ // Test 17 : simNameFromPosGlobal()
+ LLVector3d pos3( X_WORLD_TEST + REGION_WIDTH_METERS/2,
+ Y_WORLD_TEST + REGION_WIDTH_METERS/2,
+ 0.0f);
+ success = mWorld->simNameFromPosGlobal(pos3, name_sim);
+ ensure("LLWorldMap::simNameFromPosGlobal() test on existing region failed", success && (name_sim == SIM_NAME_TEST));
+
+ // Test 18 : reset()
+ try {
+ mWorld->reset();
+ } catch (...) {
+ fail("LLWorldMap::reset() at end test failed");
+ }
+
+ // Test 19 : Verify that all the region list is empty
+ list = mWorld->getRegionMap();
+ ensure("LLWorldMap::getRegionMap() empty at end test failed", list.empty());
+ }
+ // Test tracking
+ template<> template<>
+ void worldmap_object_t::test<3>()
+ {
+ // Point to track
+ LLVector3d pos( X_WORLD_TEST + REGION_WIDTH_METERS/2, Y_WORLD_TEST + REGION_WIDTH_METERS/2, Z_WORLD_TEST);
+
+ // Test 20 : no tracking
+ mWorld->cancelTracking();
+ ensure("LLWorldMap::cancelTracking() at begin test failed", mWorld->isTracking() == false);
+
+ // Test 21 : set tracking
+ mWorld->setTracking(pos);
+ ensure("LLWorldMap::setTracking() failed", mWorld->isTracking() && !mWorld->isTrackingValidLocation());
+
+ // Test 22 : set click and commit flags
+ mWorld->setTrackingDoubleClick();
+ ensure("LLWorldMap::setTrackingDoubleClick() failed", mWorld->isTrackingDoubleClick());
+ mWorld->setTrackingCommit();
+ ensure("LLWorldMap::setTrackingCommit() failed", mWorld->isTrackingCommit());
+
+ // Test 23 : in rectangle test
+ bool inRect = mWorld->isTrackingInRectangle( X_WORLD_TEST, Y_WORLD_TEST,
+ X_WORLD_TEST + REGION_WIDTH_METERS,
+ Y_WORLD_TEST + REGION_WIDTH_METERS);
+ ensure("LLWorldMap::isTrackingInRectangle() in rectangle failed", inRect);
+ inRect = mWorld->isTrackingInRectangle( X_WORLD_TEST + REGION_WIDTH_METERS,
+ Y_WORLD_TEST + REGION_WIDTH_METERS,
+ X_WORLD_TEST + 2 * REGION_WIDTH_METERS,
+ Y_WORLD_TEST + 2 * REGION_WIDTH_METERS);
+ ensure("LLWorldMap::isTrackingInRectangle() outside rectangle failed", !inRect);
+
+ // Test 24 : set tracking to valid and invalid
+ mWorld->setTrackingValid();
+ ensure("LLWorldMap::setTrackingValid() failed", mWorld->isTrackingValidLocation() && !mWorld->isTrackingInvalidLocation());
+ mWorld->setTrackingInvalid();
+ ensure("LLWorldMap::setTrackingInvalid() failed", !mWorld->isTrackingValidLocation() && mWorld->isTrackingInvalidLocation());
+
+ // Test 25 : getTrackedPositionGlobal()
+ LLVector3d res = mWorld->getTrackedPositionGlobal();
+ ensure("LLWorldMap::getTrackedPositionGlobal() failed", res == pos);
+
+ // Test 26 : reset tracking
+ mWorld->cancelTracking();
+ ensure("LLWorldMap::cancelTracking() at end test failed", mWorld->isTracking() == false);
+ }
}
diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp
index 142d75bcfd..dcbee79536 100644
--- a/indra/newview/tests/llworldmipmap_test.cpp
+++ b/indra/newview/tests/llworldmipmap_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llworldmipmap_test.cpp
* @author Merov Linden
* @date 2009-02-03
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,15 +36,15 @@
// -------------------------------------------------------------------------------------------
// Stubbing: Declarations required to link and run the class being tested
-// Notes:
+// Notes:
// * Add here stubbed implementation of the few classes and methods used in the class to be tested
// * Add as little as possible (let the link errors guide you)
// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code)
// * A simulator for a class can be implemented here. Please comment and document thoroughly.
void LLGLTexture::setBoostLevel(S32 ) { }
-LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, BOOL, LLGLTexture::EBoostLevel, S8,
- LLGLint, LLGLenum, const LLUUID& ) { return NULL; }
+LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, BOOL, LLGLTexture::EBoostLevel, S8,
+ LLGLint, LLGLenum, const LLUUID& ) { return NULL; }
LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) { }
LLControlGroup::~LLControlGroup() { }
@@ -59,107 +59,107 @@ LLControlGroup gSavedSettings("test_settings");
// -------------------------------------------------------------------------------------------
namespace tut
{
- // Test wrapper declaration
- struct worldmipmap_test
- {
- // Derived test class
- class LLTestWorldMipmap : public LLWorldMipmap
- {
- // Put here stubbs of virtual methods we shouldn't call all the way down
- };
- // Instance to be tested
- LLTestWorldMipmap* mMap;
+ // Test wrapper declaration
+ struct worldmipmap_test
+ {
+ // Derived test class
+ class LLTestWorldMipmap : public LLWorldMipmap
+ {
+ // Put here stubbs of virtual methods we shouldn't call all the way down
+ };
+ // Instance to be tested
+ LLTestWorldMipmap* mMap;
- // Constructor and destructor of the test wrapper
- worldmipmap_test()
- {
- mMap = new LLTestWorldMipmap;
- }
- ~worldmipmap_test()
- {
- delete mMap;
- }
- };
+ // Constructor and destructor of the test wrapper
+ worldmipmap_test()
+ {
+ mMap = new LLTestWorldMipmap;
+ }
+ ~worldmipmap_test()
+ {
+ delete mMap;
+ }
+ };
- // Tut templating thingamagic: test group, object and test instance
- typedef test_group<worldmipmap_test> worldmipmap_t;
- typedef worldmipmap_t::object worldmipmap_object_t;
- tut::worldmipmap_t tut_worldmipmap("LLWorldMipmap");
+ // Tut templating thingamagic: test group, object and test instance
+ typedef test_group<worldmipmap_test> worldmipmap_t;
+ typedef worldmipmap_t::object worldmipmap_object_t;
+ tut::worldmipmap_t tut_worldmipmap("LLWorldMipmap");
- // ---------------------------------------------------------------------------------------
- // Test functions
- // Notes:
- // * Test as many as you possibly can without requiring a full blown simulation of everything
- // * The tests are executed in sequence so the test instance state may change between calls
- // * Remember that you cannot test private methods with tut
- // ---------------------------------------------------------------------------------------
- // Test static methods
- // Test 1 : scaleToLevel()
- template<> template<>
- void worldmipmap_object_t::test<1>()
- {
- S32 level = mMap->scaleToLevel(0.0);
- ensure("scaleToLevel() test 1 failed", level == LLWorldMipmap::MAP_LEVELS);
- level = mMap->scaleToLevel((F32)LLWorldMipmap::MAP_TILE_SIZE);
- ensure("scaleToLevel() test 2 failed", level == 1);
- level = mMap->scaleToLevel(10.f * LLWorldMipmap::MAP_TILE_SIZE);
- ensure("scaleToLevel() test 3 failed", level == 1);
- }
- // Test 2 : globalToMipmap()
- template<> template<>
- void worldmipmap_object_t::test<2>()
- {
- U32 grid_x, grid_y;
- mMap->globalToMipmap(1000.f*REGION_WIDTH_METERS, 1000.f*REGION_WIDTH_METERS, 1, &grid_x, &grid_y);
- ensure("globalToMipmap() test 1 failed", (grid_x == 1000) && (grid_y == 1000));
- mMap->globalToMipmap(0.0, 0.0, LLWorldMipmap::MAP_LEVELS, &grid_x, &grid_y);
- ensure("globalToMipmap() test 2 failed", (grid_x == 0) && (grid_y == 0));
- }
- // Test 3 : getObjectsTile()
- template<> template<>
- void worldmipmap_object_t::test<3>()
- {
- // Depends on some inline methods in LLViewerImage... Thinking about how to make this work
- // LLPointer<LLViewerImage> img = mMap->getObjectsTile(0, 0, 1);
- // ensure("getObjectsTile() test failed", img.isNull());
- }
- // Test 4 : equalizeBoostLevels()
- template<> template<>
- void worldmipmap_object_t::test<4>()
- {
- try
- {
- mMap->equalizeBoostLevels();
- }
- catch (...)
- {
- fail("equalizeBoostLevels() test failed");
- }
- }
- // Test 5 : dropBoostLevels()
- template<> template<>
- void worldmipmap_object_t::test<5>()
- {
- try
- {
- mMap->dropBoostLevels();
- }
- catch (...)
- {
- fail("dropBoostLevels() test failed");
- }
- }
- // Test 6 : reset()
- template<> template<>
- void worldmipmap_object_t::test<6>()
- {
- try
- {
- mMap->reset();
- }
- catch (...)
- {
- fail("reset() test failed");
- }
- }
+ // ---------------------------------------------------------------------------------------
+ // Test functions
+ // Notes:
+ // * Test as many as you possibly can without requiring a full blown simulation of everything
+ // * The tests are executed in sequence so the test instance state may change between calls
+ // * Remember that you cannot test private methods with tut
+ // ---------------------------------------------------------------------------------------
+ // Test static methods
+ // Test 1 : scaleToLevel()
+ template<> template<>
+ void worldmipmap_object_t::test<1>()
+ {
+ S32 level = mMap->scaleToLevel(0.0);
+ ensure("scaleToLevel() test 1 failed", level == LLWorldMipmap::MAP_LEVELS);
+ level = mMap->scaleToLevel((F32)LLWorldMipmap::MAP_TILE_SIZE);
+ ensure("scaleToLevel() test 2 failed", level == 1);
+ level = mMap->scaleToLevel(10.f * LLWorldMipmap::MAP_TILE_SIZE);
+ ensure("scaleToLevel() test 3 failed", level == 1);
+ }
+ // Test 2 : globalToMipmap()
+ template<> template<>
+ void worldmipmap_object_t::test<2>()
+ {
+ U32 grid_x, grid_y;
+ mMap->globalToMipmap(1000.f*REGION_WIDTH_METERS, 1000.f*REGION_WIDTH_METERS, 1, &grid_x, &grid_y);
+ ensure("globalToMipmap() test 1 failed", (grid_x == 1000) && (grid_y == 1000));
+ mMap->globalToMipmap(0.0, 0.0, LLWorldMipmap::MAP_LEVELS, &grid_x, &grid_y);
+ ensure("globalToMipmap() test 2 failed", (grid_x == 0) && (grid_y == 0));
+ }
+ // Test 3 : getObjectsTile()
+ template<> template<>
+ void worldmipmap_object_t::test<3>()
+ {
+ // Depends on some inline methods in LLViewerImage... Thinking about how to make this work
+ // LLPointer<LLViewerImage> img = mMap->getObjectsTile(0, 0, 1);
+ // ensure("getObjectsTile() test failed", img.isNull());
+ }
+ // Test 4 : equalizeBoostLevels()
+ template<> template<>
+ void worldmipmap_object_t::test<4>()
+ {
+ try
+ {
+ mMap->equalizeBoostLevels();
+ }
+ catch (...)
+ {
+ fail("equalizeBoostLevels() test failed");
+ }
+ }
+ // Test 5 : dropBoostLevels()
+ template<> template<>
+ void worldmipmap_object_t::test<5>()
+ {
+ try
+ {
+ mMap->dropBoostLevels();
+ }
+ catch (...)
+ {
+ fail("dropBoostLevels() test failed");
+ }
+ }
+ // Test 6 : reset()
+ template<> template<>
+ void worldmipmap_object_t::test<6>()
+ {
+ try
+ {
+ mMap->reset();
+ }
+ catch (...)
+ {
+ fail("reset() test failed");
+ }
+ }
}
diff --git a/indra/newview/tests/llxmlrpclistener_test.cpp b/indra/newview/tests/llxmlrpclistener_test.cpp
index dbaae7280c..ee6281fc24 100644
--- a/indra/newview/tests/llxmlrpclistener_test.cpp
+++ b/indra/newview/tests/llxmlrpclistener_test.cpp
@@ -3,25 +3,25 @@
* @author Nat Goodspeed
* @date 2009-03-20
* @brief Test for llxmlrpclistener.
- *
+ *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 4de4dc8fc5..f249bf470e 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -59,7 +59,7 @@ class ViewerManifest(LLManifest):
# files during the build (see copy_w_viewer_manifest
# and copy_l_viewer_manifest targets)
return 'package' in self.args['actions']
-
+
def construct(self):
super(ViewerManifest, self).construct()
self.path(src="../../scripts/messages/message_template.msg", dst="app_settings/message_template.msg")
@@ -87,7 +87,7 @@ class ViewerManifest(LLManifest):
# ... and the entire image filters directory
self.path("filters")
-
+
# ... and the included spell checking dictionaries
pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
with self.prefix(src=pkgdir):
@@ -260,14 +260,14 @@ class ViewerManifest(LLManifest):
def app_name_oneword(self):
return ''.join(self.app_name().split())
-
+
def icon_path(self):
return "icons/" + self.channel_type()
def extract_names(self,src):
"""Extract contributor names from source file, returns string"""
try:
- with open(src, 'r') as contrib_file:
+ with open(src, 'r') as contrib_file:
lines = contrib_file.readlines()
except IOError:
print("Failed to open '%s'" % src)
@@ -491,7 +491,7 @@ class Windows_x86_64_Manifest(ViewerManifest):
raise Exception("Directories are not supported by test_CRT_and_copy_action()")
else:
print("Doesn't exist:", src)
-
+
def construct(self):
super().construct()
@@ -543,7 +543,7 @@ class Windows_x86_64_Manifest(ViewerManifest):
self.path2basename(os.path.join(os.pardir,
'llplugin', 'slplugin', self.args['configuration']),
"slplugin.exe")
-
+
# Get shared libs from the shared libs staging directory
with self.prefix(src=os.path.join(self.args['build'], os.pardir,
'sharedlibs', self.args['buildtype'])):
@@ -582,7 +582,7 @@ class Windows_x86_64_Manifest(ViewerManifest):
# Vivox libraries
self.path("vivoxsdk_x64.dll")
self.path("ortp_x64.dll")
-
+
# OpenSSL
self.path("libcrypto-1_1-x64.dll")
self.path("libssl-1_1-x64.dll")
@@ -709,7 +709,7 @@ class Windows_x86_64_Manifest(ViewerManifest):
self.path("plugins/")
if not self.is_packaging_viewer():
- self.package_file = "copied_deps"
+ self.package_file = "copied_deps"
def nsi_file_commands(self, install=True):
def INSTDIR(path):
@@ -768,7 +768,7 @@ class Windows_x86_64_Manifest(ViewerManifest):
installer_file = self.installer_base_name() + '_Setup.exe'
substitution_strings['installer_file'] = installer_file
-
+
version_vars = """
!define INSTEXE "SLVersionChecker.exe"
!define VERSION "%(version_short)s"
@@ -777,7 +777,7 @@ class Windows_x86_64_Manifest(ViewerManifest):
!define VERSION_REGISTRY "%(version_registry)s"
!define VIEWER_EXE "%(final_exe)s"
""" % substitution_strings
-
+
if self.channel_type() == 'release':
substitution_strings['caption'] = CHANNEL_VENDOR_BASE
else:
@@ -908,7 +908,7 @@ class Darwin_x86_64_Manifest(ViewerManifest):
# yields a slightly smaller binary but makes crash
# logs mostly useless. This may be desirable for the
# final release. Or not.
- if ("package" in self.args['actions'] or
+ if ("package" in self.args['actions'] or
"unpacked" in self.args['actions']):
self.run_command(
['strip', '-S', executable])
@@ -933,7 +933,7 @@ class Darwin_x86_64_Manifest(ViewerManifest):
with self.prefix(src=relpkgdir, dst=""):
self.path("libndofdev.dylib")
- self.path("libhunspell-*.dylib")
+ self.path("libhunspell-*.dylib")
with self.prefix(src_dst="cursors_mac"):
self.path("*.tif")